From: Andrea Amorese Date: Wed, 1 Sep 2021 07:31:46 +0000 (+0200) Subject: Built motion from commit 81450ced.|2.5.33 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22card-image.png//%27?a=commitdiff_plain;h=8da3cc3251af4cb79aedfbf9ab4d22d16df26155;p=motion2.git Built motion from commit 81450ced.|2.5.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 11d6ac4..7726625 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-09-01T07:14:37.592Z", + "time": "2021-09-01T07:24:18.811Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 358c169..ca3902a 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-01T07:14:37.592Z", + "time": "2021-09-01T07:24:18.811Z", "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 051b61d..9e96bb3 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 _0x99cb=['motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','STRING','integration'];(function(_0x2d06bf,_0x114b2d){var _0x3fa0c7=function(_0x5d31b9){while(--_0x5d31b9){_0x2d06bf['push'](_0x2d06bf['shift']());}};_0x3fa0c7(++_0x114b2d);}(_0x99cb,0x153));var _0xb99c=function(_0x45e5b9,_0x1afb86){_0x45e5b9=_0x45e5b9-0x0;var _0x408bb7=_0x99cb[_0x45e5b9];return _0x408bb7;};'use strict';var Sequelize=require(_0xb99c('0x0'));module[_0xb99c('0x1')]={'name':{'type':Sequelize[_0xb99c('0x2')],'get':function(_0x3ed5b4){return this[_0xb99c('0x3')]('action');}},'action':{'type':Sequelize[_0xb99c('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xb99c('0x5'),_0xb99c('0x6'),_0xb99c('0x7'),'urlForward',_0xb99c('0x8'),'bot',_0xb99c('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xb99c('0xa')},'data1':{'type':Sequelize[_0xb99c('0x4')](0x1000),'comment':_0xb99c('0xb')},'data2':{'type':Sequelize[_0xb99c('0x4')](0x1000),'comment':_0xb99c('0xc')},'data3':{'type':Sequelize[_0xb99c('0x4')](0x1000),'comment':_0xb99c('0xd')},'data4':{'type':Sequelize[_0xb99c('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xb99c('0x4')]},'data7':{'type':Sequelize[_0xb99c('0xe')]}}; \ No newline at end of file +var _0x9002=['integration','motionbar','jscripty','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','getDataValue','STRING','contactManager'];(function(_0x28e3d5,_0xe3971c){var _0x3b0327=function(_0x57bfc5){while(--_0x57bfc5){_0x28e3d5['push'](_0x28e3d5['shift']());}};_0x3b0327(++_0xe3971c);}(_0x9002,0x10c));var _0x2900=function(_0x249cbd,_0x2819f8){_0x249cbd=_0x249cbd-0x0;var _0x161d33=_0x9002[_0x249cbd];return _0x161d33;};'use strict';var Sequelize=require(_0x2900('0x0'));module['exports']={'name':{'type':Sequelize[_0x2900('0x1')],'get':function(_0xe048b1){return this[_0x2900('0x2')]('action');}},'action':{'type':Sequelize[_0x2900('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2900('0x4'),_0x2900('0x5'),_0x2900('0x6'),_0x2900('0x7'),'urlForward','browser',_0x2900('0x8'),'script']],'msg':_0x2900('0x9')}},'comment':_0x2900('0x9')},'data1':{'type':Sequelize[_0x2900('0x3')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x2900('0x3')](0x1000),'comment':_0x2900('0xa')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x2900('0xb')},'data4':{'type':Sequelize[_0x2900('0x3')](0x1000)},'data5':{'type':Sequelize[_0x2900('0x3')](0x1000)},'data6':{'type':Sequelize[_0x2900('0x3')]},'data7':{'type':Sequelize[_0x2900('0xc')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 282998d..c88dae9 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 _0xf13d=['destroy','error','name','body','Action','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xf13d,0x1ec));var _0xdf13=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xf13d[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0xdf13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf13('0x1'));var jsonpatch=require(_0xdf13('0x2'));var rp=require(_0xdf13('0x3'));var moment=require(_0xdf13('0x4'));var BPromise=require(_0xdf13('0x5'));var Mustache=require('mustache');var util=require(_0xdf13('0x6'));var path=require(_0xdf13('0x7'));var sox=require(_0xdf13('0x8'));var csv=require('to-csv');var ejs=require(_0xdf13('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf13('0xa'));var squel=require(_0xdf13('0xb'));var crypto=require('crypto');var jsforce=require(_0xdf13('0xc'));var deskjs=require(_0xdf13('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdf13('0xe'));var Papa=require('papaparse');var Redis=require(_0xdf13('0xf'));var authService=require(_0xdf13('0x10'));var qs=require(_0xdf13('0x11'));var as=require(_0xdf13('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdf13('0x13'));var utils=require(_0xdf13('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdf13('0x15'));var db=require(_0xdf13('0x16'))['db'];function respondWithStatusCode(_0x38e584,_0x4d4af1){_0x4d4af1=_0x4d4af1||0xcc;return function(_0x2b0dab){if(_0x2b0dab){return _0x38e584[_0xdf13('0x17')](_0x4d4af1);}return _0x38e584[_0xdf13('0x18')](_0x4d4af1)[_0xdf13('0x19')]();};}function respondWithResult(_0x1cae25,_0x5f232a){_0x5f232a=_0x5f232a||0xc8;return function(_0x25e775){if(_0x25e775){return _0x1cae25['status'](_0x5f232a)[_0xdf13('0x1a')](_0x25e775);}};}function respondWithFilteredResult(_0x5ce60f,_0x3900d1){return function(_0x39026d){if(_0x39026d){var _0x59d9cd=typeof _0x3900d1[_0xdf13('0x1b')]===_0xdf13('0x1c')&&typeof _0x3900d1[_0xdf13('0x1d')]==='undefined';var _0x1911c7=_0x39026d['count'];var _0x54635d=_0x59d9cd?0x0:_0x3900d1[_0xdf13('0x1b')];var _0x425a10=_0x59d9cd?_0x39026d[_0xdf13('0x1e')]:_0x3900d1['offset']+_0x3900d1[_0xdf13('0x1d')];var _0x5912a1;if(_0x425a10>=_0x1911c7){_0x425a10=_0x1911c7;_0x5912a1=0xc8;}else{_0x5912a1=0xce;}_0x5ce60f[_0xdf13('0x18')](_0x5912a1);return _0x5ce60f[_0xdf13('0x1f')](_0xdf13('0x20'),_0x54635d+'-'+_0x425a10+'/'+_0x1911c7)['json'](_0x39026d);}return null;};}function patchUpdates(_0x1b8dc3){return function(_0x43991a){try{jsonpatch['apply'](_0x43991a,_0x1b8dc3,!![]);}catch(_0x332465){return BPromise['reject'](_0x332465);}return _0x43991a[_0xdf13('0x21')]();};}function saveUpdates(_0x14c3d2,_0x2573ac){return function(_0x59dbc7){if(_0x59dbc7){return _0x59dbc7[_0xdf13('0x22')](_0x14c3d2)[_0xdf13('0x23')](function(_0x2fd366){return _0x2fd366;});}return null;};}function removeEntity(_0x5cc71a,_0x168dc1){return function(_0x182d56){if(_0x182d56){return _0x182d56[_0xdf13('0x24')]()['then'](function(){_0x5cc71a[_0xdf13('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f39c2,_0x113110){return function(_0x5798c8){if(!_0x5798c8){_0x3f39c2[_0xdf13('0x17')](0x194);}return _0x5798c8;};}function handleError(_0x3a0f3a,_0x199056){_0x199056=_0x199056||0x1f4;return function(_0x273798){logger[_0xdf13('0x25')](_0x273798['stack']);if(_0x273798[_0xdf13('0x26')]){delete _0x273798['name'];}_0x3a0f3a[_0xdf13('0x18')](_0x199056)['send'](_0x273798);};}exports[_0xdf13('0x22')]=function(_0x247092,_0xd890d9){if(_0x247092[_0xdf13('0x27')]['id']){delete _0x247092[_0xdf13('0x27')]['id'];}return db[_0xdf13('0x28')][_0xdf13('0x29')]({'where':{'id':_0x247092[_0xdf13('0x2a')]['id']}})['then'](handleEntityNotFound(_0xd890d9,null))['then'](saveUpdates(_0x247092[_0xdf13('0x27')],null))[_0xdf13('0x23')](respondWithResult(_0xd890d9,null))[_0xdf13('0x2b')](handleError(_0xd890d9,null));};exports[_0xdf13('0x24')]=function(_0x5961e4,_0x26efa5){return db[_0xdf13('0x28')][_0xdf13('0x29')]({'where':{'id':_0x5961e4[_0xdf13('0x2a')]['id']}})[_0xdf13('0x23')](handleEntityNotFound(_0x26efa5,null))[_0xdf13('0x23')](removeEntity(_0x26efa5,null))[_0xdf13('0x2b')](handleError(_0x26efa5,null));}; \ No newline at end of file +var _0xc6a8=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','body','find','catch','destroy','Action','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc6a8,0x1b6));var _0x8c6a=function(_0xc37b4e,_0x255db1){_0xc37b4e=_0xc37b4e-0x0;var _0x1e1595=_0xc6a8[_0xc37b4e];return _0x1e1595;};'use strict';var emlformat=require(_0x8c6a('0x0'));var rimraf=require(_0x8c6a('0x1'));var zipdir=require(_0x8c6a('0x2'));var jsonpatch=require(_0x8c6a('0x3'));var rp=require(_0x8c6a('0x4'));var moment=require(_0x8c6a('0x5'));var BPromise=require(_0x8c6a('0x6'));var Mustache=require('mustache');var util=require(_0x8c6a('0x7'));var path=require(_0x8c6a('0x8'));var sox=require(_0x8c6a('0x9'));var csv=require('to-csv');var ejs=require(_0x8c6a('0xa'));var fs=require('fs');var fs_extra=require(_0x8c6a('0xb'));var _=require('lodash');var squel=require(_0x8c6a('0xc'));var crypto=require(_0x8c6a('0xd'));var jsforce=require(_0x8c6a('0xe'));var deskjs=require(_0x8c6a('0xf'));var toCsv=require(_0x8c6a('0x10'));var querystring=require(_0x8c6a('0x11'));var Papa=require('papaparse');var Redis=require(_0x8c6a('0x12'));var authService=require(_0x8c6a('0x13'));var qs=require(_0x8c6a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c6a('0x15'));var logger=require(_0x8c6a('0x16'))(_0x8c6a('0x17'));var utils=require(_0x8c6a('0x18'));var config=require(_0x8c6a('0x19'));var licenseUtil=require(_0x8c6a('0x1a'));var db=require(_0x8c6a('0x1b'))['db'];function respondWithStatusCode(_0x2b7e0f,_0x2decbe){_0x2decbe=_0x2decbe||0xcc;return function(_0x541528){if(_0x541528){return _0x2b7e0f['sendStatus'](_0x2decbe);}return _0x2b7e0f[_0x8c6a('0x1c')](_0x2decbe)[_0x8c6a('0x1d')]();};}function respondWithResult(_0x177c72,_0x1387c7){_0x1387c7=_0x1387c7||0xc8;return function(_0x3fcfad){if(_0x3fcfad){return _0x177c72[_0x8c6a('0x1c')](_0x1387c7)['json'](_0x3fcfad);}};}function respondWithFilteredResult(_0x48ef1c,_0x1e9533){return function(_0x102820){if(_0x102820){var _0x499c65=typeof _0x1e9533[_0x8c6a('0x1e')]==='undefined'&&typeof _0x1e9533['limit']==='undefined';var _0x51bb31=_0x102820[_0x8c6a('0x1f')];var _0xe0df1e=_0x499c65?0x0:_0x1e9533['offset'];var _0x5d2369=_0x499c65?_0x102820[_0x8c6a('0x1f')]:_0x1e9533[_0x8c6a('0x1e')]+_0x1e9533['limit'];var _0x3562ce;if(_0x5d2369>=_0x51bb31){_0x5d2369=_0x51bb31;_0x3562ce=0xc8;}else{_0x3562ce=0xce;}_0x48ef1c[_0x8c6a('0x1c')](_0x3562ce);return _0x48ef1c[_0x8c6a('0x20')](_0x8c6a('0x21'),_0xe0df1e+'-'+_0x5d2369+'/'+_0x51bb31)[_0x8c6a('0x22')](_0x102820);}return null;};}function patchUpdates(_0xaa553){return function(_0x52a15a){try{jsonpatch[_0x8c6a('0x23')](_0x52a15a,_0xaa553,!![]);}catch(_0x272950){return BPromise[_0x8c6a('0x24')](_0x272950);}return _0x52a15a[_0x8c6a('0x25')]();};}function saveUpdates(_0x58b128,_0x230258){return function(_0x423728){if(_0x423728){return _0x423728[_0x8c6a('0x26')](_0x58b128)[_0x8c6a('0x27')](function(_0x56820c){return _0x56820c;});}return null;};}function removeEntity(_0x23ba2d,_0x40a47c){return function(_0x106dc0){if(_0x106dc0){return _0x106dc0['destroy']()[_0x8c6a('0x27')](function(){_0x23ba2d[_0x8c6a('0x1c')](0xcc)[_0x8c6a('0x1d')]();});}};}function handleEntityNotFound(_0xac7e0c,_0x10590b){return function(_0x104e7b){if(!_0x104e7b){_0xac7e0c[_0x8c6a('0x28')](0x194);}return _0x104e7b;};}function handleError(_0xa9f348,_0xe3d7e2){_0xe3d7e2=_0xe3d7e2||0x1f4;return function(_0x2e13b1){logger[_0x8c6a('0x29')](_0x2e13b1[_0x8c6a('0x2a')]);if(_0x2e13b1[_0x8c6a('0x2b')]){delete _0x2e13b1['name'];}_0xa9f348[_0x8c6a('0x1c')](_0xe3d7e2)[_0x8c6a('0x2c')](_0x2e13b1);};}exports[_0x8c6a('0x26')]=function(_0x2bf89d,_0x2c2da4){if(_0x2bf89d[_0x8c6a('0x2d')]['id']){delete _0x2bf89d[_0x8c6a('0x2d')]['id'];}return db['Action'][_0x8c6a('0x2e')]({'where':{'id':_0x2bf89d['params']['id']}})[_0x8c6a('0x27')](handleEntityNotFound(_0x2c2da4,null))['then'](saveUpdates(_0x2bf89d[_0x8c6a('0x2d')],null))[_0x8c6a('0x27')](respondWithResult(_0x2c2da4,null))[_0x8c6a('0x2f')](handleError(_0x2c2da4,null));};exports[_0x8c6a('0x30')]=function(_0x3e9110,_0x2a53da){return db[_0x8c6a('0x31')]['find']({'where':{'id':_0x3e9110[_0x8c6a('0x32')]['id']}})['then'](handleEntityNotFound(_0x2a53da,null))[_0x8c6a('0x27')](removeEntity(_0x2a53da,null))['catch'](handleError(_0x2a53da,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d0e25d9..ca8be26 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 _0x4b67=['Action','tools_actions','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','exports','define'];(function(_0x23691e,_0x28428c){var _0x2a8e13=function(_0x358894){while(--_0x358894){_0x23691e['push'](_0x23691e['shift']());}};_0x2a8e13(++_0x28428c);}(_0x4b67,0x1f0));var _0x74b6=function(_0x39eb3f,_0x5164d2){_0x39eb3f=_0x39eb3f-0x0;var _0x3235d3=_0x4b67[_0x39eb3f];return _0x3235d3;};'use strict';var _=require(_0x74b6('0x0'));var util=require(_0x74b6('0x1'));var logger=require('../../config/logger')(_0x74b6('0x2'));var moment=require(_0x74b6('0x3'));var BPromise=require(_0x74b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74b6('0x5'));var rimraf=require(_0x74b6('0x6'));var config=require(_0x74b6('0x7'));var attributes=require(_0x74b6('0x8'));module[_0x74b6('0x9')]=function(_0x464ebc,_0x58dc59){return _0x464ebc[_0x74b6('0xa')](_0x74b6('0xb'),attributes,{'tableName':_0x74b6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84be=['bluebird','request-promise','path','rimraf','./action.attributes','exports','tools_actions','lodash','util','../../config/logger','api','moment'];(function(_0x597db7,_0x29a65f){var _0x5a7ccb=function(_0x1f8407){while(--_0x1f8407){_0x597db7['push'](_0x597db7['shift']());}};_0x5a7ccb(++_0x29a65f);}(_0x84be,0xc7));var _0xe84b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x84be[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xe84b('0x0'));var util=require(_0xe84b('0x1'));var logger=require(_0xe84b('0x2'))(_0xe84b('0x3'));var moment=require(_0xe84b('0x4'));var BPromise=require(_0xe84b('0x5'));var rp=require(_0xe84b('0x6'));var fs=require('fs');var path=require(_0xe84b('0x7'));var rimraf=require(_0xe84b('0x8'));var config=require('../../config/environment');var attributes=require(_0xe84b('0x9'));module[_0xe84b('0xa')]=function(_0x27b656,_0x4b60a8){return _0x27b656['define']('Action',attributes,{'tableName':_0xe84b('0xb'),'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 33624e7..0b86f95 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1274dd,_0x21624b){var _0xc6919=function(_0xa90669){while(--_0xa90669){_0x1274dd['push'](_0x1274dd['shift']());}};_0xc6919(++_0x21624b);}(_0x5fab,0x177));var _0xb5fa=function(_0x447a9f,_0x48619b){_0x447a9f=_0x447a9f-0x0;var _0x1286fc=_0x5fab[_0x447a9f];return _0x1286fc;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x53ec,0x192));var _0xc53e=function(_0x104c9b,_0x56944d){_0x104c9b=_0x104c9b-0x0;var _0x39ba4d=_0x53ec[_0x104c9b];return _0x39ba4d;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index c96ad60..5f7a489 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 _0xac42=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','delete','/:id','destroy','exports','multer','util','path'];(function(_0x1abd85,_0x59e693){var _0x328022=function(_0x51c81f){while(--_0x51c81f){_0x1abd85['push'](_0x1abd85['shift']());}};_0x328022(++_0x59e693);}(_0xac42,0x84));var _0x2ac4=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0xac42[_0x223461];return _0x4dbe0a;};'use strict';var multer=require(_0x2ac4('0x0'));var util=require(_0x2ac4('0x1'));var path=require(_0x2ac4('0x2'));var timeout=require(_0x2ac4('0x3'));var express=require(_0x2ac4('0x4'));var router=express['Router']();var fs_extra=require(_0x2ac4('0x5'));var auth=require(_0x2ac4('0x6'));var interaction=require(_0x2ac4('0x7'));var config=require(_0x2ac4('0x8'));var controller=require(_0x2ac4('0x9'));router['put']('/:id',auth[_0x2ac4('0xa')](),controller['update']);router[_0x2ac4('0xb')](_0x2ac4('0xc'),auth['isAuthenticated'](),controller[_0x2ac4('0xd')]);module[_0x2ac4('0xe')]=router; \ No newline at end of file +var _0x5e17=['../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x5e17,0x7f));var _0x75e1=function(_0xfcceef,_0xf5d878){_0xfcceef=_0xfcceef-0x0;var _0x5a5360=_0x5e17[_0xfcceef];return _0x5a5360;};'use strict';var multer=require(_0x75e1('0x0'));var util=require(_0x75e1('0x1'));var path=require(_0x75e1('0x2'));var timeout=require(_0x75e1('0x3'));var express=require(_0x75e1('0x4'));var router=express[_0x75e1('0x5')]();var fs_extra=require(_0x75e1('0x6'));var auth=require(_0x75e1('0x7'));var interaction=require(_0x75e1('0x8'));var config=require('../../config/environment');var controller=require(_0x75e1('0x9'));router[_0x75e1('0xa')](_0x75e1('0xb'),auth[_0x75e1('0xc')](),controller['update']);router['delete'](_0x75e1('0xb'),auth[_0x75e1('0xc')](),controller[_0x75e1('0xd')]);module[_0x75e1('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index adeb045..0c94413 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 _0x7fbe=['STRING','TEXT'];(function(_0x3d09e2,_0x58e784){var _0x5d03cd=function(_0x40f355){while(--_0x40f355){_0x3d09e2['push'](_0x3d09e2['shift']());}};_0x5d03cd(++_0x58e784);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x9ff1c0,_0x207afc){_0x9ff1c0=_0x9ff1c0-0x0;var _0x3e6c23=_0x7fbe[_0x9ff1c0];return _0x3e6c23;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','TEXT'];(function(_0x5ba38a,_0x132834){var _0x28eebe=function(_0x56946a){while(--_0x56946a){_0x5ba38a['push'](_0x5ba38a['shift']());}};_0x28eebe(++_0x132834);}(_0x24ca,0x1bc));var _0xa24c=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x24ca[_0x72a33d];return _0x2621d5;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 33a30bc..404e19c 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 _0x3ffd=['count','offset','reject','update','then','destroy','get','end','error','stack','name','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','params','include','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','orderBy','DESC','parse','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','output','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','cross_join','SUM(%s)','AnalyticMetric','eml-format','zip-dir','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','limit','undefined'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x3ffd,0x84));var _0xd3ff=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x3ffd[_0x52085a];return _0x5afc1a;};'use strict';var emlformat=require(_0xd3ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd3ff('0x2'));var path=require(_0xd3ff('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd3ff('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3ff('0x5'));var squel=require(_0xd3ff('0x6'));var crypto=require(_0xd3ff('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xd3ff('0x8'));var toCsv=require(_0xd3ff('0x9'));var querystring=require(_0xd3ff('0xa'));var Papa=require(_0xd3ff('0xb'));var Redis=require('ioredis');var authService=require(_0xd3ff('0xc'));var qs=require(_0xd3ff('0xd'));var as=require(_0xd3ff('0xe'));var hardwareService=require(_0xd3ff('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xd3ff('0x10'));var config=require(_0xd3ff('0x11'));var licenseUtil=require(_0xd3ff('0x12'));var db=require(_0xd3ff('0x13'))['db'];var dbH=require('../../mysqldb')[_0xd3ff('0x14')];function respondWithStatusCode(_0x5da232,_0x4a8d0f){_0x4a8d0f=_0x4a8d0f||0xcc;return function(_0x2c516b){if(_0x2c516b){return _0x5da232[_0xd3ff('0x15')](_0x4a8d0f);}return _0x5da232[_0xd3ff('0x16')](_0x4a8d0f)['end']();};}function respondWithResult(_0x5a8c0f,_0x14a0fe){_0x14a0fe=_0x14a0fe||0xc8;return function(_0x1b100f){if(_0x1b100f){return _0x5a8c0f[_0xd3ff('0x16')](_0x14a0fe)['json'](_0x1b100f);}};}function respondWithFilteredResult(_0x246b98,_0x31f439){return function(_0x4d3eee){if(_0x4d3eee){var _0x5efafa=typeof _0x31f439['offset']==='undefined'&&typeof _0x31f439[_0xd3ff('0x17')]===_0xd3ff('0x18');var _0x49b2e4=_0x4d3eee[_0xd3ff('0x19')];var _0x575446=_0x5efafa?0x0:_0x31f439['offset'];var _0x5fb760=_0x5efafa?_0x4d3eee['count']:_0x31f439[_0xd3ff('0x1a')]+_0x31f439[_0xd3ff('0x17')];var _0x5340b2;if(_0x5fb760>=_0x49b2e4){_0x5fb760=_0x49b2e4;_0x5340b2=0xc8;}else{_0x5340b2=0xce;}_0x246b98[_0xd3ff('0x16')](_0x5340b2);return _0x246b98['set']('Content-Range',_0x575446+'-'+_0x5fb760+'/'+_0x49b2e4)['json'](_0x4d3eee);}return null;};}function patchUpdates(_0x38f022){return function(_0x1ceec9){try{jsonpatch['apply'](_0x1ceec9,_0x38f022,!![]);}catch(_0x4d050b){return BPromise[_0xd3ff('0x1b')](_0x4d050b);}return _0x1ceec9['save']();};}function saveUpdates(_0x2f7acf,_0x415162){return function(_0x165216){if(_0x165216){return _0x165216[_0xd3ff('0x1c')](_0x2f7acf)[_0xd3ff('0x1d')](function(_0x2c445e){return _0x2c445e;});}return null;};}function removeEntity(_0x28097f,_0x498778){return function(_0x1c7ccc){if(_0x1c7ccc){return _0x1c7ccc[_0xd3ff('0x1e')]()[_0xd3ff('0x1d')](function(){var _0xd6fdfb=_0x1c7ccc[_0xd3ff('0x1f')]({'plain':!![]});var _0x5d9b6e='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x5d9b6e,'resourceId':_0xd6fdfb['id']}})[_0xd3ff('0x1d')](function(){return _0x1c7ccc;});})[_0xd3ff('0x1d')](function(){_0x28097f[_0xd3ff('0x16')](0xcc)[_0xd3ff('0x20')]();});}};}function handleEntityNotFound(_0x307c69,_0x400e47){return function(_0xd6ba1b){if(!_0xd6ba1b){_0x307c69[_0xd3ff('0x15')](0x194);}return _0xd6ba1b;};}function handleError(_0x4decc6,_0x24c5f8){_0x24c5f8=_0x24c5f8||0x1f4;return function(_0x3fb4f0){logger[_0xd3ff('0x21')](_0x3fb4f0[_0xd3ff('0x22')]);if(_0x3fb4f0[_0xd3ff('0x23')]){delete _0x3fb4f0[_0xd3ff('0x23')];}_0x4decc6[_0xd3ff('0x16')](_0x24c5f8)['send'](_0x3fb4f0);};}exports[_0xd3ff('0x24')]=function(_0x188f6d,_0x6d888c){var _0x34a2d6={},_0x46348a={},_0x28ee42={'count':0x0,'rows':[]};var _0x2fa3af=_[_0xd3ff('0x25')](db[_0xd3ff('0x26')]['rawAttributes'],function(_0x74f3f1){return{'name':_0x74f3f1[_0xd3ff('0x27')],'type':_0x74f3f1[_0xd3ff('0x28')][_0xd3ff('0x29')]};});_0x46348a[_0xd3ff('0x2a')]=_[_0xd3ff('0x25')](_0x2fa3af,'name');_0x46348a[_0xd3ff('0x2b')]=_[_0xd3ff('0x2c')](_0x188f6d[_0xd3ff('0x2b')]);_0x46348a[_0xd3ff('0x2d')]=_[_0xd3ff('0x2e')](_0x46348a['model'],_0x46348a[_0xd3ff('0x2b')]);_0x34a2d6['attributes']=_[_0xd3ff('0x2e')](_0x46348a[_0xd3ff('0x2a')],qs['fields'](_0x188f6d[_0xd3ff('0x2b')][_0xd3ff('0x2f')]));_0x34a2d6[_0xd3ff('0x30')]=_0x34a2d6[_0xd3ff('0x30')][_0xd3ff('0x31')]?_0x34a2d6[_0xd3ff('0x30')]:_0x46348a['model'];if(!_0x188f6d[_0xd3ff('0x2b')][_0xd3ff('0x32')](_0xd3ff('0x33'))){_0x34a2d6['limit']=qs['limit'](_0x188f6d['query'][_0xd3ff('0x17')]);_0x34a2d6[_0xd3ff('0x1a')]=qs[_0xd3ff('0x1a')](_0x188f6d[_0xd3ff('0x2b')][_0xd3ff('0x1a')]);}_0x34a2d6['order']=qs[_0xd3ff('0x34')](_0x188f6d['query']['sort']);_0x34a2d6['where']=qs[_0xd3ff('0x2d')](_['pick'](_0x188f6d[_0xd3ff('0x2b')],_0x46348a[_0xd3ff('0x2d')]),_0x2fa3af);if(_0x188f6d[_0xd3ff('0x2b')]['filter']){_0x34a2d6[_0xd3ff('0x35')]=_[_0xd3ff('0x36')](_0x34a2d6[_0xd3ff('0x35')],{'$or':_[_0xd3ff('0x25')](_0x2fa3af,function(_0x12c6b8){if(_0x12c6b8[_0xd3ff('0x28')]!==_0xd3ff('0x37')){var _0x2f0c92={};_0x2f0c92[_0x12c6b8[_0xd3ff('0x23')]]={'$like':'%'+_0x188f6d[_0xd3ff('0x2b')][_0xd3ff('0x38')]+'%'};return _0x2f0c92;}})});}_0x34a2d6=_[_0xd3ff('0x36')]({},_0x34a2d6,_0x188f6d[_0xd3ff('0x39')]);var _0x1ce37b={'where':_0x34a2d6['where']};return db[_0xd3ff('0x26')][_0xd3ff('0x19')](_0x1ce37b)['then'](function(_0x2dacc5){_0x28ee42[_0xd3ff('0x19')]=_0x2dacc5;if(_0x188f6d[_0xd3ff('0x2b')][_0xd3ff('0x3a')]){_0x34a2d6['include']=[{'all':!![]}];}return db[_0xd3ff('0x26')][_0xd3ff('0x3b')](_0x34a2d6);})[_0xd3ff('0x1d')](function(_0x211322){_0x28ee42['rows']=_0x211322;return _0x28ee42;})[_0xd3ff('0x1d')](respondWithFilteredResult(_0x6d888c,_0x34a2d6))['catch'](handleError(_0x6d888c,null));};exports['show']=function(_0xa679fc,_0x25d11b){var _0xb55e38={'raw':![],'where':{'id':_0xa679fc[_0xd3ff('0x3c')]['id']}},_0x32cae7={};_0x32cae7[_0xd3ff('0x2a')]=_['keys'](db[_0xd3ff('0x26')]['rawAttributes']);_0x32cae7[_0xd3ff('0x2b')]=_[_0xd3ff('0x2c')](_0xa679fc[_0xd3ff('0x2b')]);_0x32cae7[_0xd3ff('0x2d')]=_[_0xd3ff('0x2e')](_0x32cae7[_0xd3ff('0x2a')],_0x32cae7[_0xd3ff('0x2b')]);_0xb55e38[_0xd3ff('0x30')]=_[_0xd3ff('0x2e')](_0x32cae7[_0xd3ff('0x2a')],qs[_0xd3ff('0x2f')](_0xa679fc['query']['fields']));_0xb55e38[_0xd3ff('0x30')]=_0xb55e38['attributes'][_0xd3ff('0x31')]?_0xb55e38[_0xd3ff('0x30')]:_0x32cae7[_0xd3ff('0x2a')];if(_0xa679fc[_0xd3ff('0x2b')][_0xd3ff('0x3a')]){_0xb55e38[_0xd3ff('0x3d')]=[{'all':!![]}];}_0xb55e38=_[_0xd3ff('0x36')]({},_0xb55e38,_0xa679fc['options']);return db[_0xd3ff('0x26')][_0xd3ff('0x3e')](_0xb55e38)['then'](handleEntityNotFound(_0x25d11b,null))[_0xd3ff('0x1d')](respondWithResult(_0x25d11b,null))[_0xd3ff('0x3f')](handleError(_0x25d11b,null));};exports[_0xd3ff('0x40')]=function(_0xc10fe7,_0x3166f2){return db[_0xd3ff('0x26')]['create'](_0xc10fe7[_0xd3ff('0x41')],{})['then'](function(_0x3734c8){var _0x22d5cd=_0xc10fe7[_0xd3ff('0x42')][_0xd3ff('0x1f')]({'plain':!![]});if(!_0x22d5cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22d5cd[_0xd3ff('0x43')]===_0xd3ff('0x42')){var _0xf8ab0b=_0x3734c8['get']({'plain':!![]});var _0x1ccd81='Reports';return db[_0xd3ff('0x44')][_0xd3ff('0x3e')]({'where':{'name':_0x1ccd81,'userProfileId':_0x22d5cd[_0xd3ff('0x45')]},'raw':!![]})['then'](function(_0x4b0d04){if(_0x4b0d04&&_0x4b0d04[_0xd3ff('0x46')]===0x0){return db[_0xd3ff('0x47')][_0xd3ff('0x40')]({'name':_0xf8ab0b[_0xd3ff('0x23')],'resourceId':_0xf8ab0b['id'],'type':_0xd3ff('0x48'),'sectionId':_0x4b0d04['id']},{})['then'](function(){return _0x3734c8;});}else{return _0x3734c8;}})[_0xd3ff('0x3f')](function(_0x3c0016){logger[_0xd3ff('0x21')](_0xd3ff('0x49'),_0x3c0016);throw _0x3c0016;});}return _0x3734c8;})[_0xd3ff('0x1d')](respondWithResult(_0x3166f2,0xc9))[_0xd3ff('0x3f')](handleError(_0x3166f2,null));};exports[_0xd3ff('0x1c')]=function(_0x2a08d5,_0x5b5417){if(_0x2a08d5[_0xd3ff('0x41')]['id']){delete _0x2a08d5[_0xd3ff('0x41')]['id'];}return db[_0xd3ff('0x26')][_0xd3ff('0x3e')]({'where':{'id':_0x2a08d5[_0xd3ff('0x3c')]['id']}})[_0xd3ff('0x1d')](handleEntityNotFound(_0x5b5417,null))[_0xd3ff('0x1d')](saveUpdates(_0x2a08d5[_0xd3ff('0x41')],null))[_0xd3ff('0x1d')](respondWithResult(_0x5b5417,null))[_0xd3ff('0x3f')](handleError(_0x5b5417,null));};exports[_0xd3ff('0x1e')]=function(_0x197a3c,_0x46eb3b){return db[_0xd3ff('0x26')][_0xd3ff('0x3e')]({'where':{'id':_0x197a3c[_0xd3ff('0x3c')]['id']}})['then'](handleEntityNotFound(_0x46eb3b,null))[_0xd3ff('0x1d')](removeEntity(_0x46eb3b,null))[_0xd3ff('0x3f')](handleError(_0x46eb3b,null));};exports[_0xd3ff('0x4a')]=function(_0x4fd2f3,_0xc4a039){var _0x4af03e=0xa;var _0xdaf718=[_0xd3ff('0x4b'),_0xd3ff('0x4c'),_0xd3ff('0x4d'),'cross_join'];var _0x510eb9={'SUM':'SUM(%s)','COUNT':_0xd3ff('0x4e'),'COUNT DISTINCT':_0xd3ff('0x4f'),'MAX':_0xd3ff('0x50'),'MIN':_0xd3ff('0x51'),'AVG':_0xd3ff('0x52'),'GROUP_CONCAT':_0xd3ff('0x53'),'GROUP_CONCAT ASC':_0xd3ff('0x54'),'GROUP_CONCAT DESC':_0xd3ff('0x55')};var _0x54de6d={'SEC_TO_TIME':_0xd3ff('0x56'),'DATE':_0xd3ff('0x57'),'HOUR':_0xd3ff('0x58'),'ROUND':_0xd3ff('0x59'),'UNIX_TIMESTAMP':_0xd3ff('0x5a')};var _0x2073bf=function(_0x392a8a){return!_[_0xd3ff('0x5b')]([_0xd3ff('0x5c'),_0xd3ff('0x5d'),_0xd3ff('0x5e'),_0xd3ff('0x5f')],_0x392a8a);};var _0x27ae82=function(_0x24da07){if(!_0x24da07||!_0x24da07[_0xd3ff('0x60')]['length']){return'';}for(var _0x35b9fd='(',_0x8662de=0x0;_0x8662de<_0x24da07['rules'][_0xd3ff('0x31')];_0x8662de+=0x1){_0x8662de>0x0&&(_0x35b9fd+='\x20'+_0x24da07[_0xd3ff('0x61')]+'\x20');_0x35b9fd+=_0x24da07[_0xd3ff('0x60')][_0x8662de][_0xd3ff('0x62')]?_0x27ae82(_0x24da07[_0xd3ff('0x60')][_0x8662de][_0xd3ff('0x62')]):_0x24da07[_0xd3ff('0x60')][_0x8662de][_0xd3ff('0x63')]+'\x20'+_0x24da07['rules'][_0x8662de][_0xd3ff('0x64')]+(_0x2073bf(_0x24da07[_0xd3ff('0x60')][_0x8662de][_0xd3ff('0x64')])?'\x20'+_0x24da07[_0xd3ff('0x60')][_0x8662de][_0xd3ff('0x65')]:'');}return _0x35b9fd+')';};var _0x906f24={'where':{'id':_0x4fd2f3[_0xd3ff('0x3c')]['id']}},_0x116295,_0x4dcb11,_0x4f8457,_0x3105c9,_0x5dbdb5;_0x906f24=_[_0xd3ff('0x36')]({},_0x906f24,_0x4fd2f3[_0xd3ff('0x39')]);return db[_0xd3ff('0x26')][_0xd3ff('0x3e')](_0x906f24)[_0xd3ff('0x1d')](function(_0x2e8baf){if(_0x2e8baf){_0x116295=_0x2e8baf;return _0x2e8baf[_0xd3ff('0x66')]();}return null;})['then'](function(_0x1bdd3d){if(_0x1bdd3d){if(!_0x1bdd3d[_0xd3ff('0x31')]){throw new db[(_0xd3ff('0x67'))][(_0xd3ff('0x68'))](_0xd3ff('0x69'),0x193);}_0x4dcb11=_0x1bdd3d;return db['AnalyticMetric'][_0xd3ff('0x3b')]({'raw':!![]});}return null;})[_0xd3ff('0x1d')](function(_0x472af4){if(_0x472af4){_0x4f8457=_[_0xd3ff('0x6a')](_0x472af4,'id');var _0x16cdbe;var _0x168743=squel[_0xd3ff('0x6b')]();_0x168743[_0xd3ff('0x6c')](_0x116295[_0xd3ff('0x6d')]);for(var _0x3dc635=0x0;_0x3dc635<_0x4dcb11['length'];_0x3dc635+=0x1){_0x16cdbe=_0x4dcb11[_0x3dc635][_0xd3ff('0x6e')]?_0x4f8457[_0x4dcb11[_0x3dc635]['MetricId']][_0xd3ff('0x6f')]:_0x4dcb11[_0x3dc635][_0xd3ff('0x63')];_0x16cdbe=_0x4dcb11[_0x3dc635][_0xd3ff('0x70')]?_[_0xd3ff('0x71')](_0x510eb9[_0x4dcb11[_0x3dc635][_0xd3ff('0x70')]],'%s',_0x16cdbe):_0x16cdbe;_0x16cdbe=_0x4dcb11[_0x3dc635][_0xd3ff('0x72')]?_['replace'](_0x54de6d[_0x4dcb11[_0x3dc635]['format']],'%s',_0x16cdbe):_0x16cdbe;if(_0x4dcb11[_0x3dc635][_0xd3ff('0x73')]){_0x168743[_0xd3ff('0x62')](_0x16cdbe);}_0x4dcb11[_0x3dc635]['orderBy']&&_0x168743[_0xd3ff('0x74')](_0x16cdbe,_0x4dcb11[_0x3dc635]['orderBy']==='DESC'?![]:!![]);_0x168743['field'](_0x16cdbe,_0x4dcb11[_0x3dc635][_0xd3ff('0x75')]||_0x16cdbe);}if(_0x116295['joins']){_0x116295[_0xd3ff('0x76')]=JSON['parse'](_0x116295[_0xd3ff('0x76')]);for(var _0x228cb6=0x0;_0x228cb6<_0x116295[_0xd3ff('0x76')][_0xd3ff('0x31')];_0x228cb6+=0x1){if(_0x116295['joins'][_0x228cb6][_0xd3ff('0x28')]&&_['includes'](_0xdaf718,_0x116295[_0xd3ff('0x76')][_0x228cb6][_0xd3ff('0x28')])&&_0x116295[_0xd3ff('0x76')][_0x228cb6][_0xd3ff('0x77')]&&_0x116295['joins'][_0x228cb6]['foreignTable']&&_0x116295[_0xd3ff('0x76')][_0x228cb6][_0xd3ff('0x78')]){_0x168743[_0x116295[_0xd3ff('0x76')][_0x228cb6][_0xd3ff('0x28')]](_0x116295[_0xd3ff('0x76')][_0x228cb6][_0xd3ff('0x79')],null,util[_0xd3ff('0x72')](_0xd3ff('0x7a'),_0x116295[_0xd3ff('0x6d')],_0x116295['joins'][_0x228cb6][_0xd3ff('0x77')],_0x116295[_0xd3ff('0x76')][_0x228cb6]['foreignTable'],_0x116295[_0xd3ff('0x76')][_0x228cb6][_0xd3ff('0x78')]));}}}if(_0x116295['conditions']){_0x116295['conditions']=JSON['parse'](_0x116295[_0xd3ff('0x7b')]);_0x168743['where'](_0x27ae82(_0x116295[_0xd3ff('0x7b')]['group']));}_0x5dbdb5=_0x168743[_0xd3ff('0x7c')]();_0x168743[_0xd3ff('0x17')](_0x4af03e);_0x168743[_0xd3ff('0x1a')](0x0);logger[_0xd3ff('0x7d')](_0xd3ff('0x7e'),_0x168743[_0xd3ff('0x7f')]());return dbH[_0xd3ff('0x80')][_0xd3ff('0x2b')](_0x168743['toString'](),{'type':dbH[_0xd3ff('0x80')]['QueryTypes'][_0xd3ff('0x81')]});}})[_0xd3ff('0x1d')](respondWithResult(_0xc4a039,null))['catch'](handleError(_0xc4a039,null));};function runReport(_0x5e1a0c,_0x542f59,_0x2e39ee){var _0x2fa765=_0x542f59['name'];var _0x1a3238=0xa;var _0x341583=[_0xd3ff('0x4b'),_0xd3ff('0x4c'),_0xd3ff('0x4d'),'cross_join'];var _0xb089f7={'SUM':'SUM(%s)','COUNT':_0xd3ff('0x4e'),'COUNT DISTINCT':_0xd3ff('0x4f'),'MAX':_0xd3ff('0x50'),'MIN':_0xd3ff('0x51'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xd3ff('0x54'),'GROUP_CONCAT DESC':_0xd3ff('0x55')};var _0x2f2f27={'SEC_TO_TIME':_0xd3ff('0x56'),'DATE':_0xd3ff('0x57'),'HOUR':_0xd3ff('0x58'),'ROUND':_0xd3ff('0x59'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x14bd1e=function(_0x27d2ce){return!_[_0xd3ff('0x5b')]([_0xd3ff('0x5c'),_0xd3ff('0x5d'),_0xd3ff('0x5e'),_0xd3ff('0x5f')],_0x27d2ce);};var _0x3c98fc=function(_0x4ad9f3){if(!_0x4ad9f3||!_0x4ad9f3['rules'][_0xd3ff('0x31')]){return'';}for(var _0x36ab81='(',_0x5f2754=0x0;_0x5f2754<_0x4ad9f3[_0xd3ff('0x60')][_0xd3ff('0x31')];_0x5f2754+=0x1){_0x5f2754>0x0&&(_0x36ab81+='\x20'+_0x4ad9f3['operator']+'\x20');_0x36ab81+=_0x4ad9f3[_0xd3ff('0x60')][_0x5f2754][_0xd3ff('0x62')]?_0x3c98fc(_0x4ad9f3[_0xd3ff('0x60')][_0x5f2754][_0xd3ff('0x62')]):_0x4ad9f3[_0xd3ff('0x60')][_0x5f2754][_0xd3ff('0x63')]+'\x20'+_0x4ad9f3[_0xd3ff('0x60')][_0x5f2754][_0xd3ff('0x64')]+(_0x14bd1e(_0x4ad9f3[_0xd3ff('0x60')][_0x5f2754][_0xd3ff('0x64')])?'\x20'+_0x4ad9f3[_0xd3ff('0x60')][_0x5f2754][_0xd3ff('0x65')]:'');}return _0x36ab81+')';};var _0x1743d7={'where':{'id':_0x5e1a0c['id']}},_0x2a18c4,_0xb5de2b,_0x2baf46,_0x42e2d3,_0x3bb30a;_0x1743d7=_['merge']({},_0x1743d7,_0x2e39ee);return db[_0xd3ff('0x26')]['find'](_0x1743d7)[_0xd3ff('0x1d')](function(_0x106ca2){if(_0x106ca2){_0x2a18c4=_0x106ca2;return _0x106ca2[_0xd3ff('0x66')]();}return null;})['then'](function(_0x3c7742){if(_0x3c7742){if(!_0x3c7742['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd3ff('0x69'),0x193);}_0xb5de2b=_0x3c7742;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd3ff('0x1d')](function(_0xa95d30){if(_0xa95d30){_0x2baf46=_[_0xd3ff('0x6a')](_0xa95d30,'id');var _0x3e2a59;var _0x2ead25=squel['select']();_0x2ead25['from'](_0x2a18c4['table']);for(var _0x13a148=0x0;_0x13a148<_0xb5de2b[_0xd3ff('0x31')];_0x13a148+=0x1){_0x3e2a59=_0xb5de2b[_0x13a148]['MetricId']?_0x2baf46[_0xb5de2b[_0x13a148][_0xd3ff('0x6e')]]['metric']:_0xb5de2b[_0x13a148][_0xd3ff('0x63')];_0x3e2a59=_0xb5de2b[_0x13a148]['function']?_['replace'](_0xb089f7[_0xb5de2b[_0x13a148][_0xd3ff('0x70')]],'%s',_0x3e2a59):_0x3e2a59;_0x3e2a59=_0xb5de2b[_0x13a148][_0xd3ff('0x72')]?_[_0xd3ff('0x71')](_0x2f2f27[_0xb5de2b[_0x13a148][_0xd3ff('0x72')]],'%s',_0x3e2a59):_0x3e2a59;if(_0xb5de2b[_0x13a148][_0xd3ff('0x73')]){_0x2ead25[_0xd3ff('0x62')](_0x3e2a59);}_0xb5de2b[_0x13a148][_0xd3ff('0x82')]&&_0x2ead25[_0xd3ff('0x74')](_0x3e2a59,_0xb5de2b[_0x13a148][_0xd3ff('0x82')]===_0xd3ff('0x83')?![]:!![]);_0x2ead25[_0xd3ff('0x63')](_0x3e2a59,_0xb5de2b[_0x13a148][_0xd3ff('0x75')]||_0x3e2a59);}if(_0x2a18c4[_0xd3ff('0x76')]){_0x2a18c4[_0xd3ff('0x76')]=JSON[_0xd3ff('0x84')](_0x2a18c4[_0xd3ff('0x76')]);for(var _0x25cad8=0x0;_0x25cad8<_0x2a18c4[_0xd3ff('0x76')]['length'];_0x25cad8+=0x1){if(_0x2a18c4[_0xd3ff('0x76')][_0x25cad8][_0xd3ff('0x28')]&&_[_0xd3ff('0x5b')](_0x341583,_0x2a18c4[_0xd3ff('0x76')][_0x25cad8][_0xd3ff('0x28')])&&_0x2a18c4['joins'][_0x25cad8][_0xd3ff('0x77')]&&_0x2a18c4['joins'][_0x25cad8][_0xd3ff('0x79')]&&_0x2a18c4[_0xd3ff('0x76')][_0x25cad8][_0xd3ff('0x78')]){_0x2ead25[_0x2a18c4[_0xd3ff('0x76')][_0x25cad8][_0xd3ff('0x28')]](_0x2a18c4[_0xd3ff('0x76')][_0x25cad8][_0xd3ff('0x79')],null,util[_0xd3ff('0x72')](_0xd3ff('0x7a'),_0x2a18c4[_0xd3ff('0x6d')],_0x2a18c4[_0xd3ff('0x76')][_0x25cad8][_0xd3ff('0x77')],_0x2a18c4[_0xd3ff('0x76')][_0x25cad8]['foreignTable'],_0x2a18c4[_0xd3ff('0x76')][_0x25cad8]['foreignKey']));}}}if(_0x2a18c4[_0xd3ff('0x7b')]){_0x2a18c4[_0xd3ff('0x7b')]=JSON[_0xd3ff('0x84')](_0x2a18c4['conditions']);_0x2ead25[_0xd3ff('0x35')](_0x3c98fc(_0x2a18c4[_0xd3ff('0x7b')][_0xd3ff('0x62')]));}_0x3bb30a=_0x2ead25['clone']();_0x2ead25['limit'](_0x1a3238);_0x2ead25[_0xd3ff('0x1a')](0x0);return;}})[_0xd3ff('0x1d')](function(){if(_0x542f59['output']===_0xd3ff('0x85')){return null;}var _0x53d21a=_[_0xd3ff('0x36')](_0x542f59,{'name':_0x542f59[_0xd3ff('0x86')]||_0x542f59[_0xd3ff('0x23')]||_0x2a18c4[_0xd3ff('0x23')],'basename':_0x2fa765,'savename':util['format'](_0xd3ff('0x87'),_0x542f59[_0xd3ff('0x23')]||_0x2a18c4[_0xd3ff('0x23')],require(_0xd3ff('0x88'))[_0xd3ff('0x89')](0x4),_0x542f59['output']||_0xd3ff('0x8a')),'reportId':_0x2a18c4['id'],'reportType':'custom'});return db[_0xd3ff('0x8b')]['create'](_0x53d21a,{'raw':!![]});})[_0xd3ff('0x1d')](function(_0x2241cf){if(_0x2a18c4[_0xd3ff('0x6d')]===_0xd3ff('0x8c')){_0x3bb30a[_0xd3ff('0x35')](_0x2a18c4[_0xd3ff('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x542f59[_0xd3ff('0x8d')],_0x542f59['endDate']);}else{_0x3bb30a[_0xd3ff('0x35')](_0x2a18c4[_0xd3ff('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x542f59[_0xd3ff('0x8d')],_0x542f59[_0xd3ff('0x8e')]);}if(_0x2241cf){logger[_0xd3ff('0x8f')](_0xd3ff('0x90'),_0x3bb30a[_0xd3ff('0x7f')]());require(_0xd3ff('0x91'))[_0xd3ff('0x92')](path['join'](__dirname,_0xd3ff('0x93'),_0x2241cf[_0xd3ff('0x94')]),[_0x2241cf['id'],_0x3bb30a[_0xd3ff('0x7f')](),path[_0xd3ff('0x4b')](__dirname,_0xd3ff('0x95'),_0x2241cf[_0xd3ff('0x96')]),_0x2fa765]);return _0x2241cf;}else{var _0x7f9096=squel[_0xd3ff('0x6b')]();_0x7f9096[_0xd3ff('0x6c')]('('+_0x3bb30a[_0xd3ff('0x7f')]()+')',_0xd3ff('0x97'));_0x7f9096[_0xd3ff('0x63')](_0xd3ff('0x98'),_0xd3ff('0x19'));_0x3bb30a[_0xd3ff('0x17')](_0x542f59[_0xd3ff('0x17')]||_0x1a3238);_0x3bb30a[_0xd3ff('0x1a')](_0x542f59[_0xd3ff('0x1a')]||0x0);return dbH['sequelize']['query'](_0x7f9096['toString'](),{'type':dbH[_0xd3ff('0x80')][_0xd3ff('0x99')][_0xd3ff('0x81')]})[_0xd3ff('0x1d')](function(_0x2f9c9a){if(!_0x2f9c9a[_0xd3ff('0x31')]){_0x42e2d3=0x0;}else{_0x42e2d3=_0x2f9c9a[0x0][_0xd3ff('0x19')]||0x0;}return dbH[_0xd3ff('0x80')][_0xd3ff('0x2b')](_0x3bb30a['toString'](),{'type':dbH['sequelize'][_0xd3ff('0x99')]['SELECT']});})['then'](function(_0x367978){return{'rows':_0x367978||[],'count':_0x42e2d3};});}});}exports['run']=function(_0x6f93bd,_0x1e768d){return runReport(_0x6f93bd[_0xd3ff('0x3c')],_0x6f93bd[_0xd3ff('0x2b')],_0x6f93bd[_0xd3ff('0x39')])[_0xd3ff('0x1d')](respondWithResult(_0x1e768d,null))[_0xd3ff('0x3f')](handleError(_0x1e768d,null));};exports['runReport']=runReport;exports[_0xd3ff('0x2b')]=function(_0x527104,_0x127c85){var _0x5654cc=0xa;var _0x3c13b2=[_0xd3ff('0x4b'),_0xd3ff('0x4c'),_0xd3ff('0x4d'),_0xd3ff('0x9a')];var _0x32ab9e={'SUM':_0xd3ff('0x9b'),'COUNT':_0xd3ff('0x4e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd3ff('0x50'),'MIN':_0xd3ff('0x51'),'AVG':_0xd3ff('0x52'),'GROUP_CONCAT':_0xd3ff('0x53'),'GROUP_CONCAT ASC':_0xd3ff('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xc1d992={'SEC_TO_TIME':_0xd3ff('0x56'),'DATE':_0xd3ff('0x57'),'HOUR':'HOUR(%s)','ROUND':_0xd3ff('0x59'),'UNIX_TIMESTAMP':_0xd3ff('0x5a')};var _0x3a072d=function(_0x3b7157){return!_[_0xd3ff('0x5b')]([_0xd3ff('0x5c'),_0xd3ff('0x5d'),_0xd3ff('0x5e'),_0xd3ff('0x5f')],_0x3b7157);};var _0xca1d43=function(_0x582480){if(!_0x582480||!_0x582480[_0xd3ff('0x60')][_0xd3ff('0x31')]){return'';}for(var _0x13e8d7='(',_0x5ee6ee=0x0;_0x5ee6ee<_0x582480[_0xd3ff('0x60')][_0xd3ff('0x31')];_0x5ee6ee+=0x1){_0x5ee6ee>0x0&&(_0x13e8d7+='\x20'+_0x582480[_0xd3ff('0x61')]+'\x20');_0x13e8d7+=_0x582480[_0xd3ff('0x60')][_0x5ee6ee][_0xd3ff('0x62')]?_0xca1d43(_0x582480['rules'][_0x5ee6ee][_0xd3ff('0x62')]):_0x582480['rules'][_0x5ee6ee]['field']+'\x20'+_0x582480[_0xd3ff('0x60')][_0x5ee6ee][_0xd3ff('0x64')]+(_0x3a072d(_0x582480['rules'][_0x5ee6ee][_0xd3ff('0x64')])?'\x20'+_0x582480['rules'][_0x5ee6ee]['value']:'');}return _0x13e8d7+')';};var _0x136983={'where':{'id':_0x527104['params']['id']}},_0x783ad4,_0x223ab5,_0x40ef40,_0x13cb05,_0x386702;_0x136983=_[_0xd3ff('0x36')]({},_0x136983,_0x527104[_0xd3ff('0x39')]);return db['AnalyticCustomReport'][_0xd3ff('0x3e')](_0x136983)[_0xd3ff('0x1d')](function(_0x4028d1){if(_0x4028d1){_0x783ad4=_0x4028d1;return _0x4028d1['getFields']();}return null;})[_0xd3ff('0x1d')](function(_0x5ed4d5){if(_0x5ed4d5){if(!_0x5ed4d5[_0xd3ff('0x31')]){throw new db[(_0xd3ff('0x67'))][(_0xd3ff('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x223ab5=_0x5ed4d5;return db[_0xd3ff('0x9c')][_0xd3ff('0x3b')]({'raw':!![]});}return null;})[_0xd3ff('0x1d')](function(_0x286992){if(_0x286992){_0x40ef40=_['keyBy'](_0x286992,'id');var _0x48458d;var _0x296cd5=squel[_0xd3ff('0x6b')]();_0x296cd5[_0xd3ff('0x6c')](_0x783ad4[_0xd3ff('0x6d')]);for(var _0x17cd9a=0x0;_0x17cd9a<_0x223ab5[_0xd3ff('0x31')];_0x17cd9a+=0x1){_0x48458d=_0x223ab5[_0x17cd9a][_0xd3ff('0x6e')]?_0x40ef40[_0x223ab5[_0x17cd9a][_0xd3ff('0x6e')]][_0xd3ff('0x6f')]:_0x223ab5[_0x17cd9a][_0xd3ff('0x63')];_0x48458d=_0x223ab5[_0x17cd9a][_0xd3ff('0x70')]?_[_0xd3ff('0x71')](_0x32ab9e[_0x223ab5[_0x17cd9a][_0xd3ff('0x70')]],'%s',_0x48458d):_0x48458d;_0x48458d=_0x223ab5[_0x17cd9a][_0xd3ff('0x72')]?_['replace'](_0xc1d992[_0x223ab5[_0x17cd9a][_0xd3ff('0x72')]],'%s',_0x48458d):_0x48458d;if(_0x223ab5[_0x17cd9a][_0xd3ff('0x73')]){_0x296cd5['group'](_0x48458d);}_0x223ab5[_0x17cd9a][_0xd3ff('0x82')]&&_0x296cd5[_0xd3ff('0x74')](_0x48458d,_0x223ab5[_0x17cd9a][_0xd3ff('0x82')]===_0xd3ff('0x83')?![]:!![]);_0x296cd5[_0xd3ff('0x63')](_0x48458d,_0x223ab5[_0x17cd9a][_0xd3ff('0x75')]||_0x48458d);}if(_0x783ad4['joins']){_0x783ad4[_0xd3ff('0x76')]=JSON['parse'](_0x783ad4['joins']);for(var _0x10fb1b=0x0;_0x10fb1b<_0x783ad4[_0xd3ff('0x76')]['length'];_0x10fb1b+=0x1){if(_0x783ad4[_0xd3ff('0x76')][_0x10fb1b]['type']&&_[_0xd3ff('0x5b')](_0x3c13b2,_0x783ad4[_0xd3ff('0x76')][_0x10fb1b][_0xd3ff('0x28')])&&_0x783ad4[_0xd3ff('0x76')][_0x10fb1b]['parentKey']&&_0x783ad4[_0xd3ff('0x76')][_0x10fb1b][_0xd3ff('0x79')]&&_0x783ad4[_0xd3ff('0x76')][_0x10fb1b][_0xd3ff('0x78')]){_0x296cd5[_0x783ad4[_0xd3ff('0x76')][_0x10fb1b]['type']](_0x783ad4['joins'][_0x10fb1b]['foreignTable'],null,util[_0xd3ff('0x72')](_0xd3ff('0x7a'),_0x783ad4[_0xd3ff('0x6d')],_0x783ad4[_0xd3ff('0x76')][_0x10fb1b][_0xd3ff('0x77')],_0x783ad4['joins'][_0x10fb1b][_0xd3ff('0x79')],_0x783ad4[_0xd3ff('0x76')][_0x10fb1b]['foreignKey']));}}}if(_0x783ad4[_0xd3ff('0x7b')]){_0x783ad4[_0xd3ff('0x7b')]=JSON[_0xd3ff('0x84')](_0x783ad4[_0xd3ff('0x7b')]);_0x296cd5[_0xd3ff('0x35')](_0xca1d43(_0x783ad4['conditions']['group']));}_0x386702=_0x296cd5[_0xd3ff('0x7c')]();_0x296cd5['limit'](_0x5654cc);_0x296cd5[_0xd3ff('0x1a')](0x0);logger[_0xd3ff('0x7d')]('Limited\x20Query:',_0x296cd5['toString']());return dbH[_0xd3ff('0x80')][_0xd3ff('0x2b')](_0x296cd5[_0xd3ff('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0xd3ff('0x81')]});}})['then'](function(){return{'sql':_0x386702[_0xd3ff('0x7f')]()};})[_0xd3ff('0x1d')](respondWithResult(_0x127c85,null))[_0xd3ff('0x3f')](handleError(_0x127c85,null));}; \ No newline at end of file +var _0x63ef=['length','hasOwnProperty','nolimit','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','format','replace','groupBy','order','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','Limited\x20Query:','sequelize','QueryTypes','SELECT','join','cross_join','ROUND(%s)','condition','value','metric','clone','output','web','%s-%s.%s','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','IS\x20NOT\x20NULL','debug','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','name','query','keys','model','attributes','fields'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x63ef,0x11a));var _0xf63e=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x63ef[_0x5756f8];return _0x3bb749;};'use strict';var emlformat=require(_0xf63e('0x0'));var rimraf=require(_0xf63e('0x1'));var zipdir=require(_0xf63e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf63e('0x3'));var moment=require(_0xf63e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf63e('0x5'));var path=require(_0xf63e('0x6'));var sox=require('sox');var csv=require(_0xf63e('0x7'));var ejs=require(_0xf63e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf63e('0x9'));var squel=require(_0xf63e('0xa'));var crypto=require(_0xf63e('0xb'));var jsforce=require(_0xf63e('0xc'));var deskjs=require(_0xf63e('0xd'));var toCsv=require(_0xf63e('0x7'));var querystring=require(_0xf63e('0xe'));var Papa=require(_0xf63e('0xf'));var Redis=require(_0xf63e('0x10'));var authService=require(_0xf63e('0x11'));var qs=require(_0xf63e('0x12'));var as=require(_0xf63e('0x13'));var hardwareService=require(_0xf63e('0x14'));var logger=require(_0xf63e('0x15'))(_0xf63e('0x16'));var utils=require('../../config/utils');var config=require(_0xf63e('0x17'));var licenseUtil=require(_0xf63e('0x18'));var db=require(_0xf63e('0x19'))['db'];var dbH=require(_0xf63e('0x19'))[_0xf63e('0x1a')];function respondWithStatusCode(_0x1c2fe9,_0x536a8c){_0x536a8c=_0x536a8c||0xcc;return function(_0x32a98b){if(_0x32a98b){return _0x1c2fe9[_0xf63e('0x1b')](_0x536a8c);}return _0x1c2fe9[_0xf63e('0x1c')](_0x536a8c)['end']();};}function respondWithResult(_0x5e44a6,_0x5796c7){_0x5796c7=_0x5796c7||0xc8;return function(_0x19ede9){if(_0x19ede9){return _0x5e44a6['status'](_0x5796c7)[_0xf63e('0x1d')](_0x19ede9);}};}function respondWithFilteredResult(_0x1f5412,_0x13f9db){return function(_0x55fa84){if(_0x55fa84){var _0xeb8283=typeof _0x13f9db[_0xf63e('0x1e')]==='undefined'&&typeof _0x13f9db[_0xf63e('0x1f')]===_0xf63e('0x20');var _0xad867a=_0x55fa84['count'];var _0x3b25e3=_0xeb8283?0x0:_0x13f9db[_0xf63e('0x1e')];var _0x2a1726=_0xeb8283?_0x55fa84[_0xf63e('0x21')]:_0x13f9db[_0xf63e('0x1e')]+_0x13f9db[_0xf63e('0x1f')];var _0x71d83e;if(_0x2a1726>=_0xad867a){_0x2a1726=_0xad867a;_0x71d83e=0xc8;}else{_0x71d83e=0xce;}_0x1f5412[_0xf63e('0x1c')](_0x71d83e);return _0x1f5412[_0xf63e('0x22')](_0xf63e('0x23'),_0x3b25e3+'-'+_0x2a1726+'/'+_0xad867a)[_0xf63e('0x1d')](_0x55fa84);}return null;};}function patchUpdates(_0x5aacf7){return function(_0x43ab41){try{jsonpatch[_0xf63e('0x24')](_0x43ab41,_0x5aacf7,!![]);}catch(_0x11be6c){return BPromise[_0xf63e('0x25')](_0x11be6c);}return _0x43ab41['save']();};}function saveUpdates(_0x3b807d,_0x258f4c){return function(_0x27db54){if(_0x27db54){return _0x27db54[_0xf63e('0x26')](_0x3b807d)[_0xf63e('0x27')](function(_0x4ec299){return _0x4ec299;});}return null;};}function removeEntity(_0x299ca9,_0x595ef0){return function(_0x48c3c3){if(_0x48c3c3){return _0x48c3c3[_0xf63e('0x28')]()['then'](function(){var _0x56f34d=_0x48c3c3[_0xf63e('0x29')]({'plain':!![]});var _0x55c699=_0xf63e('0x2a');return db[_0xf63e('0x2b')]['destroy']({'where':{'type':_0x55c699,'resourceId':_0x56f34d['id']}})[_0xf63e('0x27')](function(){return _0x48c3c3;});})[_0xf63e('0x27')](function(){_0x299ca9[_0xf63e('0x1c')](0xcc)[_0xf63e('0x2c')]();});}};}function handleEntityNotFound(_0x305525,_0x366a93){return function(_0x210842){if(!_0x210842){_0x305525['sendStatus'](0x194);}return _0x210842;};}function handleError(_0x30f5a3,_0x21e080){_0x21e080=_0x21e080||0x1f4;return function(_0x363763){logger[_0xf63e('0x2d')](_0x363763[_0xf63e('0x2e')]);if(_0x363763['name']){delete _0x363763['name'];}_0x30f5a3[_0xf63e('0x1c')](_0x21e080)[_0xf63e('0x2f')](_0x363763);};}exports[_0xf63e('0x30')]=function(_0x3049e1,_0x30a397){var _0x5a48fc={},_0x10d007={},_0x45de39={'count':0x0,'rows':[]};var _0x51455f=_[_0xf63e('0x31')](db[_0xf63e('0x32')][_0xf63e('0x33')],function(_0x201cea){return{'name':_0x201cea[_0xf63e('0x34')],'type':_0x201cea[_0xf63e('0x35')]['key']};});_0x10d007['model']=_[_0xf63e('0x31')](_0x51455f,_0xf63e('0x36'));_0x10d007[_0xf63e('0x37')]=_[_0xf63e('0x38')](_0x3049e1[_0xf63e('0x37')]);_0x10d007['filters']=_['intersection'](_0x10d007[_0xf63e('0x39')],_0x10d007[_0xf63e('0x37')]);_0x5a48fc[_0xf63e('0x3a')]=_['intersection'](_0x10d007['model'],qs[_0xf63e('0x3b')](_0x3049e1['query'][_0xf63e('0x3b')]));_0x5a48fc[_0xf63e('0x3a')]=_0x5a48fc[_0xf63e('0x3a')][_0xf63e('0x3c')]?_0x5a48fc['attributes']:_0x10d007[_0xf63e('0x39')];if(!_0x3049e1['query'][_0xf63e('0x3d')](_0xf63e('0x3e'))){_0x5a48fc[_0xf63e('0x1f')]=qs['limit'](_0x3049e1[_0xf63e('0x37')][_0xf63e('0x1f')]);_0x5a48fc[_0xf63e('0x1e')]=qs[_0xf63e('0x1e')](_0x3049e1['query'][_0xf63e('0x1e')]);}_0x5a48fc['order']=qs['sort'](_0x3049e1[_0xf63e('0x37')]['sort']);_0x5a48fc[_0xf63e('0x3f')]=qs[_0xf63e('0x40')](_['pick'](_0x3049e1['query'],_0x10d007['filters']),_0x51455f);if(_0x3049e1[_0xf63e('0x37')][_0xf63e('0x41')]){_0x5a48fc[_0xf63e('0x3f')]=_[_0xf63e('0x42')](_0x5a48fc['where'],{'$or':_[_0xf63e('0x31')](_0x51455f,function(_0xf5199a){if(_0xf5199a[_0xf63e('0x35')]!==_0xf63e('0x43')){var _0x29cf49={};_0x29cf49[_0xf5199a[_0xf63e('0x36')]]={'$like':'%'+_0x3049e1[_0xf63e('0x37')][_0xf63e('0x41')]+'%'};return _0x29cf49;}})});}_0x5a48fc=_['merge']({},_0x5a48fc,_0x3049e1[_0xf63e('0x44')]);var _0x55837f={'where':_0x5a48fc[_0xf63e('0x3f')]};return db[_0xf63e('0x32')]['count'](_0x55837f)[_0xf63e('0x27')](function(_0x59765c){_0x45de39[_0xf63e('0x21')]=_0x59765c;if(_0x3049e1[_0xf63e('0x37')][_0xf63e('0x45')]){_0x5a48fc[_0xf63e('0x46')]=[{'all':!![]}];}return db[_0xf63e('0x32')][_0xf63e('0x47')](_0x5a48fc);})[_0xf63e('0x27')](function(_0x134663){_0x45de39[_0xf63e('0x48')]=_0x134663;return _0x45de39;})[_0xf63e('0x27')](respondWithFilteredResult(_0x30a397,_0x5a48fc))[_0xf63e('0x49')](handleError(_0x30a397,null));};exports[_0xf63e('0x4a')]=function(_0x34c9bc,_0x33dca){var _0x3d63a5={'raw':![],'where':{'id':_0x34c9bc[_0xf63e('0x4b')]['id']}},_0x41a449={};_0x41a449['model']=_['keys'](db[_0xf63e('0x32')]['rawAttributes']);_0x41a449[_0xf63e('0x37')]=_[_0xf63e('0x38')](_0x34c9bc[_0xf63e('0x37')]);_0x41a449[_0xf63e('0x40')]=_[_0xf63e('0x4c')](_0x41a449[_0xf63e('0x39')],_0x41a449[_0xf63e('0x37')]);_0x3d63a5[_0xf63e('0x3a')]=_['intersection'](_0x41a449[_0xf63e('0x39')],qs[_0xf63e('0x3b')](_0x34c9bc[_0xf63e('0x37')][_0xf63e('0x3b')]));_0x3d63a5[_0xf63e('0x3a')]=_0x3d63a5[_0xf63e('0x3a')][_0xf63e('0x3c')]?_0x3d63a5['attributes']:_0x41a449[_0xf63e('0x39')];if(_0x34c9bc[_0xf63e('0x37')][_0xf63e('0x45')]){_0x3d63a5[_0xf63e('0x46')]=[{'all':!![]}];}_0x3d63a5=_[_0xf63e('0x42')]({},_0x3d63a5,_0x34c9bc[_0xf63e('0x44')]);return db[_0xf63e('0x32')][_0xf63e('0x4d')](_0x3d63a5)[_0xf63e('0x27')](handleEntityNotFound(_0x33dca,null))[_0xf63e('0x27')](respondWithResult(_0x33dca,null))[_0xf63e('0x49')](handleError(_0x33dca,null));};exports['create']=function(_0x30d92b,_0x15fde9){return db[_0xf63e('0x32')][_0xf63e('0x4e')](_0x30d92b[_0xf63e('0x4f')],{})[_0xf63e('0x27')](function(_0x142ac8){var _0xb28009=_0x30d92b[_0xf63e('0x50')][_0xf63e('0x29')]({'plain':!![]});if(!_0xb28009)throw new Error(_0xf63e('0x51'));if(_0xb28009[_0xf63e('0x52')]===_0xf63e('0x50')){var _0x4f7738=_0x142ac8['get']({'plain':!![]});var _0x3489e3=_0xf63e('0x53');return db[_0xf63e('0x54')][_0xf63e('0x4d')]({'where':{'name':_0x3489e3,'userProfileId':_0xb28009[_0xf63e('0x55')]},'raw':!![]})[_0xf63e('0x27')](function(_0x3fabc4){if(_0x3fabc4&&_0x3fabc4[_0xf63e('0x56')]===0x0){return db[_0xf63e('0x2b')][_0xf63e('0x4e')]({'name':_0x4f7738[_0xf63e('0x36')],'resourceId':_0x4f7738['id'],'type':_0xf63e('0x2a'),'sectionId':_0x3fabc4['id']},{})['then'](function(){return _0x142ac8;});}else{return _0x142ac8;}})['catch'](function(_0x47f3b1){logger[_0xf63e('0x2d')](_0xf63e('0x57'),_0x47f3b1);throw _0x47f3b1;});}return _0x142ac8;})[_0xf63e('0x27')](respondWithResult(_0x15fde9,0xc9))['catch'](handleError(_0x15fde9,null));};exports['update']=function(_0x128a90,_0x141630){if(_0x128a90[_0xf63e('0x4f')]['id']){delete _0x128a90['body']['id'];}return db[_0xf63e('0x32')][_0xf63e('0x4d')]({'where':{'id':_0x128a90[_0xf63e('0x4b')]['id']}})[_0xf63e('0x27')](handleEntityNotFound(_0x141630,null))[_0xf63e('0x27')](saveUpdates(_0x128a90[_0xf63e('0x4f')],null))['then'](respondWithResult(_0x141630,null))[_0xf63e('0x49')](handleError(_0x141630,null));};exports['destroy']=function(_0x30cc9a,_0x2bd2a4){return db[_0xf63e('0x32')]['find']({'where':{'id':_0x30cc9a[_0xf63e('0x4b')]['id']}})[_0xf63e('0x27')](handleEntityNotFound(_0x2bd2a4,null))[_0xf63e('0x27')](removeEntity(_0x2bd2a4,null))[_0xf63e('0x49')](handleError(_0x2bd2a4,null));};exports[_0xf63e('0x58')]=function(_0xfc8b03,_0x160e48){var _0x1e3d23=0xa;var _0x56dd74=['join',_0xf63e('0x59'),_0xf63e('0x5a'),'cross_join'];var _0x35b880={'SUM':_0xf63e('0x5b'),'COUNT':_0xf63e('0x5c'),'COUNT DISTINCT':_0xf63e('0x5d'),'MAX':_0xf63e('0x5e'),'MIN':_0xf63e('0x5f'),'AVG':_0xf63e('0x60'),'GROUP_CONCAT':_0xf63e('0x61'),'GROUP_CONCAT ASC':_0xf63e('0x62'),'GROUP_CONCAT DESC':_0xf63e('0x63')};var _0x199b6c={'SEC_TO_TIME':_0xf63e('0x64'),'DATE':_0xf63e('0x65'),'HOUR':_0xf63e('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf63e('0x67')};var _0x5232e6=function(_0xc306cd){return!_['includes']([_0xf63e('0x68'),'IS\x20NOT\x20NULL',_0xf63e('0x69'),_0xf63e('0x6a')],_0xc306cd);};var _0xe744aa=function(_0x2a5ade){if(!_0x2a5ade||!_0x2a5ade[_0xf63e('0x6b')][_0xf63e('0x3c')]){return'';}for(var _0x2eebd9='(',_0x6c38f0=0x0;_0x6c38f0<_0x2a5ade['rules'][_0xf63e('0x3c')];_0x6c38f0+=0x1){_0x6c38f0>0x0&&(_0x2eebd9+='\x20'+_0x2a5ade[_0xf63e('0x6c')]+'\x20');_0x2eebd9+=_0x2a5ade['rules'][_0x6c38f0][_0xf63e('0x6d')]?_0xe744aa(_0x2a5ade[_0xf63e('0x6b')][_0x6c38f0][_0xf63e('0x6d')]):_0x2a5ade[_0xf63e('0x6b')][_0x6c38f0][_0xf63e('0x6e')]+'\x20'+_0x2a5ade['rules'][_0x6c38f0]['condition']+(_0x5232e6(_0x2a5ade[_0xf63e('0x6b')][_0x6c38f0]['condition'])?'\x20'+_0x2a5ade['rules'][_0x6c38f0]['value']:'');}return _0x2eebd9+')';};var _0x1a47b5={'where':{'id':_0xfc8b03[_0xf63e('0x4b')]['id']}},_0x3a6591,_0x2fa775,_0x24daf5,_0x4e572c,_0x5d4fc4;_0x1a47b5=_[_0xf63e('0x42')]({},_0x1a47b5,_0xfc8b03[_0xf63e('0x44')]);return db[_0xf63e('0x32')][_0xf63e('0x4d')](_0x1a47b5)[_0xf63e('0x27')](function(_0x2daac2){if(_0x2daac2){_0x3a6591=_0x2daac2;return _0x2daac2[_0xf63e('0x6f')]();}return null;})['then'](function(_0x5ede33){if(_0x5ede33){if(!_0x5ede33[_0xf63e('0x3c')]){throw new db[(_0xf63e('0x70'))][(_0xf63e('0x71'))](_0xf63e('0x72'),0x193);}_0x2fa775=_0x5ede33;return db[_0xf63e('0x73')][_0xf63e('0x47')]({'raw':!![]});}return null;})[_0xf63e('0x27')](function(_0x216c33){if(_0x216c33){_0x24daf5=_[_0xf63e('0x74')](_0x216c33,'id');var _0x246701;var _0x4c8762=squel[_0xf63e('0x75')]();_0x4c8762[_0xf63e('0x76')](_0x3a6591['table']);for(var _0x541bc3=0x0;_0x541bc3<_0x2fa775[_0xf63e('0x3c')];_0x541bc3+=0x1){_0x246701=_0x2fa775[_0x541bc3]['MetricId']?_0x24daf5[_0x2fa775[_0x541bc3][_0xf63e('0x77')]]['metric']:_0x2fa775[_0x541bc3][_0xf63e('0x6e')];_0x246701=_0x2fa775[_0x541bc3][_0xf63e('0x78')]?_['replace'](_0x35b880[_0x2fa775[_0x541bc3]['function']],'%s',_0x246701):_0x246701;_0x246701=_0x2fa775[_0x541bc3][_0xf63e('0x79')]?_[_0xf63e('0x7a')](_0x199b6c[_0x2fa775[_0x541bc3][_0xf63e('0x79')]],'%s',_0x246701):_0x246701;if(_0x2fa775[_0x541bc3][_0xf63e('0x7b')]){_0x4c8762[_0xf63e('0x6d')](_0x246701);}_0x2fa775[_0x541bc3]['orderBy']&&_0x4c8762[_0xf63e('0x7c')](_0x246701,_0x2fa775[_0x541bc3][_0xf63e('0x7d')]===_0xf63e('0x7e')?![]:!![]);_0x4c8762[_0xf63e('0x6e')](_0x246701,_0x2fa775[_0x541bc3][_0xf63e('0x7f')]||_0x246701);}if(_0x3a6591[_0xf63e('0x80')]){_0x3a6591[_0xf63e('0x80')]=JSON[_0xf63e('0x81')](_0x3a6591[_0xf63e('0x80')]);for(var _0x1c4293=0x0;_0x1c4293<_0x3a6591[_0xf63e('0x80')][_0xf63e('0x3c')];_0x1c4293+=0x1){if(_0x3a6591[_0xf63e('0x80')][_0x1c4293][_0xf63e('0x35')]&&_[_0xf63e('0x82')](_0x56dd74,_0x3a6591[_0xf63e('0x80')][_0x1c4293][_0xf63e('0x35')])&&_0x3a6591[_0xf63e('0x80')][_0x1c4293][_0xf63e('0x83')]&&_0x3a6591[_0xf63e('0x80')][_0x1c4293][_0xf63e('0x84')]&&_0x3a6591[_0xf63e('0x80')][_0x1c4293]['foreignKey']){_0x4c8762[_0x3a6591[_0xf63e('0x80')][_0x1c4293][_0xf63e('0x35')]](_0x3a6591[_0xf63e('0x80')][_0x1c4293][_0xf63e('0x84')],null,util[_0xf63e('0x79')](_0xf63e('0x85'),_0x3a6591[_0xf63e('0x86')],_0x3a6591[_0xf63e('0x80')][_0x1c4293]['parentKey'],_0x3a6591['joins'][_0x1c4293]['foreignTable'],_0x3a6591[_0xf63e('0x80')][_0x1c4293][_0xf63e('0x87')]));}}}if(_0x3a6591['conditions']){_0x3a6591['conditions']=JSON['parse'](_0x3a6591[_0xf63e('0x88')]);_0x4c8762['where'](_0xe744aa(_0x3a6591[_0xf63e('0x88')][_0xf63e('0x6d')]));}_0x5d4fc4=_0x4c8762['clone']();_0x4c8762[_0xf63e('0x1f')](_0x1e3d23);_0x4c8762['offset'](0x0);logger['debug'](_0xf63e('0x89'),_0x4c8762['toString']());return dbH[_0xf63e('0x8a')][_0xf63e('0x37')](_0x4c8762['toString'](),{'type':dbH[_0xf63e('0x8a')][_0xf63e('0x8b')][_0xf63e('0x8c')]});}})[_0xf63e('0x27')](respondWithResult(_0x160e48,null))[_0xf63e('0x49')](handleError(_0x160e48,null));};function runReport(_0x5224fc,_0x1ead3f,_0x376c24){var _0x57e2a6=_0x1ead3f[_0xf63e('0x36')];var _0x487d26=0xa;var _0x4d5f7d=[_0xf63e('0x8d'),_0xf63e('0x59'),_0xf63e('0x5a'),_0xf63e('0x8e')];var _0x2df5f6={'SUM':'SUM(%s)','COUNT':_0xf63e('0x5c'),'COUNT DISTINCT':_0xf63e('0x5d'),'MAX':_0xf63e('0x5e'),'MIN':_0xf63e('0x5f'),'AVG':_0xf63e('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf63e('0x62'),'GROUP_CONCAT DESC':_0xf63e('0x63')};var _0x9f888a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xf63e('0x66'),'ROUND':_0xf63e('0x8f'),'UNIX_TIMESTAMP':_0xf63e('0x67')};var _0x3f19cf=function(_0x3ea353){return!_['includes']([_0xf63e('0x68'),'IS\x20NOT\x20NULL',_0xf63e('0x69'),'IS\x20NOT\x20EMPTY'],_0x3ea353);};var _0x4cd9f0=function(_0xf2433e){if(!_0xf2433e||!_0xf2433e[_0xf63e('0x6b')][_0xf63e('0x3c')]){return'';}for(var _0x453b30='(',_0xa93bc4=0x0;_0xa93bc4<_0xf2433e['rules'][_0xf63e('0x3c')];_0xa93bc4+=0x1){_0xa93bc4>0x0&&(_0x453b30+='\x20'+_0xf2433e['operator']+'\x20');_0x453b30+=_0xf2433e[_0xf63e('0x6b')][_0xa93bc4][_0xf63e('0x6d')]?_0x4cd9f0(_0xf2433e[_0xf63e('0x6b')][_0xa93bc4][_0xf63e('0x6d')]):_0xf2433e['rules'][_0xa93bc4][_0xf63e('0x6e')]+'\x20'+_0xf2433e[_0xf63e('0x6b')][_0xa93bc4][_0xf63e('0x90')]+(_0x3f19cf(_0xf2433e[_0xf63e('0x6b')][_0xa93bc4]['condition'])?'\x20'+_0xf2433e[_0xf63e('0x6b')][_0xa93bc4][_0xf63e('0x91')]:'');}return _0x453b30+')';};var _0x34d34b={'where':{'id':_0x5224fc['id']}},_0x1fd043,_0x5236f0,_0x4b2e3f,_0x5a5f29,_0x238579;_0x34d34b=_[_0xf63e('0x42')]({},_0x34d34b,_0x376c24);return db['AnalyticCustomReport']['find'](_0x34d34b)[_0xf63e('0x27')](function(_0x546a74){if(_0x546a74){_0x1fd043=_0x546a74;return _0x546a74[_0xf63e('0x6f')]();}return null;})[_0xf63e('0x27')](function(_0x2ff2bd){if(_0x2ff2bd){if(!_0x2ff2bd['length']){throw new db[(_0xf63e('0x70'))][(_0xf63e('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5236f0=_0x2ff2bd;return db[_0xf63e('0x73')][_0xf63e('0x47')]({'raw':!![]});}return null;})[_0xf63e('0x27')](function(_0x1ae087){if(_0x1ae087){_0x4b2e3f=_[_0xf63e('0x74')](_0x1ae087,'id');var _0x5182f5;var _0x13882d=squel['select']();_0x13882d['from'](_0x1fd043[_0xf63e('0x86')]);for(var _0x1a5350=0x0;_0x1a5350<_0x5236f0['length'];_0x1a5350+=0x1){_0x5182f5=_0x5236f0[_0x1a5350][_0xf63e('0x77')]?_0x4b2e3f[_0x5236f0[_0x1a5350]['MetricId']][_0xf63e('0x92')]:_0x5236f0[_0x1a5350][_0xf63e('0x6e')];_0x5182f5=_0x5236f0[_0x1a5350][_0xf63e('0x78')]?_[_0xf63e('0x7a')](_0x2df5f6[_0x5236f0[_0x1a5350][_0xf63e('0x78')]],'%s',_0x5182f5):_0x5182f5;_0x5182f5=_0x5236f0[_0x1a5350]['format']?_['replace'](_0x9f888a[_0x5236f0[_0x1a5350][_0xf63e('0x79')]],'%s',_0x5182f5):_0x5182f5;if(_0x5236f0[_0x1a5350][_0xf63e('0x7b')]){_0x13882d[_0xf63e('0x6d')](_0x5182f5);}_0x5236f0[_0x1a5350]['orderBy']&&_0x13882d[_0xf63e('0x7c')](_0x5182f5,_0x5236f0[_0x1a5350][_0xf63e('0x7d')]===_0xf63e('0x7e')?![]:!![]);_0x13882d['field'](_0x5182f5,_0x5236f0[_0x1a5350]['alias']||_0x5182f5);}if(_0x1fd043[_0xf63e('0x80')]){_0x1fd043['joins']=JSON[_0xf63e('0x81')](_0x1fd043['joins']);for(var _0x57f998=0x0;_0x57f998<_0x1fd043[_0xf63e('0x80')][_0xf63e('0x3c')];_0x57f998+=0x1){if(_0x1fd043[_0xf63e('0x80')][_0x57f998][_0xf63e('0x35')]&&_['includes'](_0x4d5f7d,_0x1fd043['joins'][_0x57f998][_0xf63e('0x35')])&&_0x1fd043[_0xf63e('0x80')][_0x57f998][_0xf63e('0x83')]&&_0x1fd043['joins'][_0x57f998][_0xf63e('0x84')]&&_0x1fd043['joins'][_0x57f998][_0xf63e('0x87')]){_0x13882d[_0x1fd043[_0xf63e('0x80')][_0x57f998][_0xf63e('0x35')]](_0x1fd043[_0xf63e('0x80')][_0x57f998][_0xf63e('0x84')],null,util['format'](_0xf63e('0x85'),_0x1fd043[_0xf63e('0x86')],_0x1fd043['joins'][_0x57f998][_0xf63e('0x83')],_0x1fd043[_0xf63e('0x80')][_0x57f998][_0xf63e('0x84')],_0x1fd043[_0xf63e('0x80')][_0x57f998]['foreignKey']));}}}if(_0x1fd043[_0xf63e('0x88')]){_0x1fd043['conditions']=JSON['parse'](_0x1fd043['conditions']);_0x13882d[_0xf63e('0x3f')](_0x4cd9f0(_0x1fd043['conditions']['group']));}_0x238579=_0x13882d[_0xf63e('0x93')]();_0x13882d[_0xf63e('0x1f')](_0x487d26);_0x13882d[_0xf63e('0x1e')](0x0);return;}})[_0xf63e('0x27')](function(){if(_0x1ead3f[_0xf63e('0x94')]===_0xf63e('0x95')){return null;}var _0x530158=_[_0xf63e('0x42')](_0x1ead3f,{'name':_0x1ead3f['fullPath']||_0x1ead3f['name']||_0x1fd043['name'],'basename':_0x57e2a6,'savename':util['format'](_0xf63e('0x96'),_0x1ead3f[_0xf63e('0x36')]||_0x1fd043['name'],require('randomstring')[_0xf63e('0x97')](0x4),_0x1ead3f[_0xf63e('0x94')]||_0xf63e('0x98')),'reportId':_0x1fd043['id'],'reportType':_0xf63e('0x99')});return db['AnalyticExtractedReport']['create'](_0x530158,{'raw':!![]});})[_0xf63e('0x27')](function(_0x592dfb){if(_0x1fd043['table']===_0xf63e('0x9a')){_0x238579['where'](_0x1fd043[_0xf63e('0x86')]+_0xf63e('0x9b'),_0x1ead3f[_0xf63e('0x9c')],_0x1ead3f[_0xf63e('0x9d')]);}else{_0x238579['where'](_0x1fd043[_0xf63e('0x86')]+_0xf63e('0x9e'),_0x1ead3f[_0xf63e('0x9c')],_0x1ead3f['endDate']);}if(_0x592dfb){logger[_0xf63e('0x9f')](_0xf63e('0xa0'),_0x238579[_0xf63e('0xa1')]());require(_0xf63e('0xa2'))[_0xf63e('0xa3')](path[_0xf63e('0x8d')](__dirname,_0xf63e('0xa4'),_0x592dfb[_0xf63e('0x94')]),[_0x592dfb['id'],_0x238579[_0xf63e('0xa1')](),path[_0xf63e('0x8d')](__dirname,_0xf63e('0xa5'),_0x592dfb[_0xf63e('0xa6')]),_0x57e2a6]);return _0x592dfb;}else{var _0xc02b05=squel[_0xf63e('0x75')]();_0xc02b05[_0xf63e('0x76')]('('+_0x238579['toString']()+')',_0xf63e('0xa7'));_0xc02b05[_0xf63e('0x6e')]('COUNT(*)',_0xf63e('0x21'));_0x238579['limit'](_0x1ead3f[_0xf63e('0x1f')]||_0x487d26);_0x238579['offset'](_0x1ead3f[_0xf63e('0x1e')]||0x0);return dbH[_0xf63e('0x8a')][_0xf63e('0x37')](_0xc02b05[_0xf63e('0xa1')](),{'type':dbH[_0xf63e('0x8a')][_0xf63e('0x8b')][_0xf63e('0x8c')]})['then'](function(_0x381788){if(!_0x381788[_0xf63e('0x3c')]){_0x5a5f29=0x0;}else{_0x5a5f29=_0x381788[0x0][_0xf63e('0x21')]||0x0;}return dbH[_0xf63e('0x8a')][_0xf63e('0x37')](_0x238579[_0xf63e('0xa1')](),{'type':dbH[_0xf63e('0x8a')][_0xf63e('0x8b')]['SELECT']});})[_0xf63e('0x27')](function(_0x498728){return{'rows':_0x498728||[],'count':_0x5a5f29};});}});}exports[_0xf63e('0xa8')]=function(_0x141185,_0x1db68a){return runReport(_0x141185[_0xf63e('0x4b')],_0x141185[_0xf63e('0x37')],_0x141185[_0xf63e('0x44')])[_0xf63e('0x27')](respondWithResult(_0x1db68a,null))['catch'](handleError(_0x1db68a,null));};exports['runReport']=runReport;exports[_0xf63e('0x37')]=function(_0x5e8944,_0x5c0db9){var _0xdb50f8=0xa;var _0x3e3efa=['join',_0xf63e('0x59'),_0xf63e('0x5a'),_0xf63e('0x8e')];var _0x5a04e7={'SUM':_0xf63e('0x5b'),'COUNT':_0xf63e('0x5c'),'COUNT DISTINCT':_0xf63e('0x5d'),'MAX':_0xf63e('0x5e'),'MIN':_0xf63e('0x5f'),'AVG':_0xf63e('0x60'),'GROUP_CONCAT':_0xf63e('0x61'),'GROUP_CONCAT ASC':_0xf63e('0x62'),'GROUP_CONCAT DESC':_0xf63e('0x63')};var _0x53a4c9={'SEC_TO_TIME':_0xf63e('0x64'),'DATE':_0xf63e('0x65'),'HOUR':_0xf63e('0x66'),'ROUND':_0xf63e('0x8f'),'UNIX_TIMESTAMP':_0xf63e('0x67')};var _0x37f765=function(_0x371b98){return!_[_0xf63e('0x82')]([_0xf63e('0x68'),_0xf63e('0xa9'),'IS\x20EMPTY',_0xf63e('0x6a')],_0x371b98);};var _0xa0986f=function(_0x68fb6d){if(!_0x68fb6d||!_0x68fb6d['rules']['length']){return'';}for(var _0x195d38='(',_0x3080ea=0x0;_0x3080ea<_0x68fb6d[_0xf63e('0x6b')][_0xf63e('0x3c')];_0x3080ea+=0x1){_0x3080ea>0x0&&(_0x195d38+='\x20'+_0x68fb6d[_0xf63e('0x6c')]+'\x20');_0x195d38+=_0x68fb6d['rules'][_0x3080ea][_0xf63e('0x6d')]?_0xa0986f(_0x68fb6d['rules'][_0x3080ea]['group']):_0x68fb6d[_0xf63e('0x6b')][_0x3080ea][_0xf63e('0x6e')]+'\x20'+_0x68fb6d['rules'][_0x3080ea][_0xf63e('0x90')]+(_0x37f765(_0x68fb6d[_0xf63e('0x6b')][_0x3080ea][_0xf63e('0x90')])?'\x20'+_0x68fb6d[_0xf63e('0x6b')][_0x3080ea]['value']:'');}return _0x195d38+')';};var _0x3e995e={'where':{'id':_0x5e8944[_0xf63e('0x4b')]['id']}},_0x4bdb15,_0x63d46b,_0x476d2b,_0x66fe15,_0x5c4069;_0x3e995e=_[_0xf63e('0x42')]({},_0x3e995e,_0x5e8944[_0xf63e('0x44')]);return db[_0xf63e('0x32')]['find'](_0x3e995e)[_0xf63e('0x27')](function(_0x53f81a){if(_0x53f81a){_0x4bdb15=_0x53f81a;return _0x53f81a['getFields']();}return null;})[_0xf63e('0x27')](function(_0x4891f6){if(_0x4891f6){if(!_0x4891f6[_0xf63e('0x3c')]){throw new db[(_0xf63e('0x70'))][(_0xf63e('0x71'))](_0xf63e('0x72'),0x193);}_0x63d46b=_0x4891f6;return db['AnalyticMetric'][_0xf63e('0x47')]({'raw':!![]});}return null;})[_0xf63e('0x27')](function(_0x55f220){if(_0x55f220){_0x476d2b=_[_0xf63e('0x74')](_0x55f220,'id');var _0x330c32;var _0x1eade8=squel[_0xf63e('0x75')]();_0x1eade8[_0xf63e('0x76')](_0x4bdb15[_0xf63e('0x86')]);for(var _0x21d051=0x0;_0x21d051<_0x63d46b[_0xf63e('0x3c')];_0x21d051+=0x1){_0x330c32=_0x63d46b[_0x21d051][_0xf63e('0x77')]?_0x476d2b[_0x63d46b[_0x21d051][_0xf63e('0x77')]][_0xf63e('0x92')]:_0x63d46b[_0x21d051][_0xf63e('0x6e')];_0x330c32=_0x63d46b[_0x21d051][_0xf63e('0x78')]?_['replace'](_0x5a04e7[_0x63d46b[_0x21d051]['function']],'%s',_0x330c32):_0x330c32;_0x330c32=_0x63d46b[_0x21d051][_0xf63e('0x79')]?_[_0xf63e('0x7a')](_0x53a4c9[_0x63d46b[_0x21d051][_0xf63e('0x79')]],'%s',_0x330c32):_0x330c32;if(_0x63d46b[_0x21d051][_0xf63e('0x7b')]){_0x1eade8['group'](_0x330c32);}_0x63d46b[_0x21d051]['orderBy']&&_0x1eade8['order'](_0x330c32,_0x63d46b[_0x21d051]['orderBy']==='DESC'?![]:!![]);_0x1eade8[_0xf63e('0x6e')](_0x330c32,_0x63d46b[_0x21d051][_0xf63e('0x7f')]||_0x330c32);}if(_0x4bdb15['joins']){_0x4bdb15[_0xf63e('0x80')]=JSON[_0xf63e('0x81')](_0x4bdb15['joins']);for(var _0x133a24=0x0;_0x133a24<_0x4bdb15[_0xf63e('0x80')][_0xf63e('0x3c')];_0x133a24+=0x1){if(_0x4bdb15[_0xf63e('0x80')][_0x133a24][_0xf63e('0x35')]&&_[_0xf63e('0x82')](_0x3e3efa,_0x4bdb15['joins'][_0x133a24]['type'])&&_0x4bdb15[_0xf63e('0x80')][_0x133a24][_0xf63e('0x83')]&&_0x4bdb15['joins'][_0x133a24][_0xf63e('0x84')]&&_0x4bdb15[_0xf63e('0x80')][_0x133a24]['foreignKey']){_0x1eade8[_0x4bdb15[_0xf63e('0x80')][_0x133a24][_0xf63e('0x35')]](_0x4bdb15[_0xf63e('0x80')][_0x133a24][_0xf63e('0x84')],null,util[_0xf63e('0x79')]('%s.%s\x20=\x20%s.%s',_0x4bdb15[_0xf63e('0x86')],_0x4bdb15['joins'][_0x133a24][_0xf63e('0x83')],_0x4bdb15['joins'][_0x133a24][_0xf63e('0x84')],_0x4bdb15['joins'][_0x133a24][_0xf63e('0x87')]));}}}if(_0x4bdb15[_0xf63e('0x88')]){_0x4bdb15[_0xf63e('0x88')]=JSON[_0xf63e('0x81')](_0x4bdb15[_0xf63e('0x88')]);_0x1eade8[_0xf63e('0x3f')](_0xa0986f(_0x4bdb15[_0xf63e('0x88')][_0xf63e('0x6d')]));}_0x5c4069=_0x1eade8[_0xf63e('0x93')]();_0x1eade8[_0xf63e('0x1f')](_0xdb50f8);_0x1eade8[_0xf63e('0x1e')](0x0);logger[_0xf63e('0xaa')](_0xf63e('0x89'),_0x1eade8[_0xf63e('0xa1')]());return dbH[_0xf63e('0x8a')][_0xf63e('0x37')](_0x1eade8['toString'](),{'type':dbH[_0xf63e('0x8a')]['QueryTypes'][_0xf63e('0x8c')]});}})[_0xf63e('0x27')](function(){return{'sql':_0x5c4069[_0xf63e('0xa1')]()};})[_0xf63e('0x27')](respondWithResult(_0x5c0db9,null))[_0xf63e('0x49')](handleError(_0x5c0db9,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 725d820..a7ea02a 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 _0x961a=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x36ee26,_0x1a7b7e){var _0x5cb7cf=function(_0x30d6f3){while(--_0x30d6f3){_0x36ee26['push'](_0x36ee26['shift']());}};_0x5cb7cf(++_0x1a7b7e);}(_0x961a,0x134));var _0xa961=function(_0x31da49,_0x12fa05){_0x31da49=_0x31da49-0x0;var _0x2d3a10=_0x961a[_0x31da49];return _0x2d3a10;};'use strict';var _=require('lodash');var util=require(_0xa961('0x0'));var logger=require(_0xa961('0x1'))('api');var moment=require(_0xa961('0x2'));var BPromise=require(_0xa961('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa961('0x4'));var rimraf=require(_0xa961('0x5'));var config=require(_0xa961('0x6'));var attributes=require(_0xa961('0x7'));module[_0xa961('0x8')]=function(_0x31ce49,_0x4e4370){return _0x31ce49[_0xa961('0x9')](_0xa961('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0e0=['lodash','util','api','moment','bluebird','path','rimraf','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x5e473b,_0x471896){var _0x4b4253=function(_0x8697fc){while(--_0x8697fc){_0x5e473b['push'](_0x5e473b['shift']());}};_0x4b4253(++_0x471896);}(_0xa0e0,0xc6));var _0x0a0e=function(_0x3458ed,_0x28e88b){_0x3458ed=_0x3458ed-0x0;var _0x4b38e6=_0xa0e0[_0x3458ed];return _0x4b38e6;};'use strict';var _=require(_0x0a0e('0x0'));var util=require(_0x0a0e('0x1'));var logger=require('../../config/logger')(_0x0a0e('0x2'));var moment=require(_0x0a0e('0x3'));var BPromise=require(_0x0a0e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a0e('0x5'));var rimraf=require(_0x0a0e('0x6'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x0a0e('0x7')]=function(_0x53db73,_0x5131a3){return _0x53db73[_0x0a0e('0x8')](_0x0a0e('0x9'),attributes,{'tableName':_0x0a0e('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index f5bc4da..9e3f45c 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 _0x211b=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x211b,0x8d));var _0xb211=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x211b[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0xb211('0x0'));var util=require('util');var moment=require(_0xb211('0x1'));var BPromise=require(_0xb211('0x2'));var rs=require(_0xb211('0x3'));var fs=require('fs');var Redis=require(_0xb211('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb211('0x5'));var logger=require(_0xb211('0x6'))(_0xb211('0x7'));var config=require(_0xb211('0x8'));var jayson=require(_0xb211('0x9'));var client=jayson[_0xb211('0xa')][_0xb211('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29d4ad,_0x74a575,_0x4cec68){return new BPromise(function(_0x523119,_0x386347){return client[_0xb211('0xc')](_0x29d4ad,_0x4cec68)[_0xb211('0xd')](function(_0x33a450){logger[_0xb211('0xe')](_0xb211('0xf'),_0x74a575,'request\x20sent');logger['debug'](_0xb211('0x10'),_0x74a575,_0xb211('0x11'),JSON[_0xb211('0x12')](_0x33a450));if(_0x33a450[_0xb211('0x13')]){if(_0x33a450['error'][_0xb211('0x14')]===0x1f4){logger[_0xb211('0x13')](_0xb211('0xf'),_0x74a575,_0x33a450[_0xb211('0x13')]['message']);return _0x386347(_0x33a450[_0xb211('0x13')][_0xb211('0x15')]);}logger[_0xb211('0x13')](_0xb211('0xf'),_0x74a575,_0x33a450[_0xb211('0x13')]['message']);return _0x523119(_0x33a450[_0xb211('0x13')][_0xb211('0x15')]);}else{logger[_0xb211('0xe')](_0xb211('0xf'),_0x74a575,_0xb211('0x11'));_0x523119(_0x33a450[_0xb211('0x16')][_0xb211('0x15')]);}})[_0xb211('0x17')](function(_0x4def9d){logger[_0xb211('0x13')](_0xb211('0xf'),_0x74a575,_0x4def9d);_0x386347(_0x4def9d);});});} \ No newline at end of file +var _0xaec1=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x25c2e1,_0x3a031e){var _0x3f60c1=function(_0x512717){while(--_0x512717){_0x25c2e1['push'](_0x25c2e1['shift']());}};_0x3f60c1(++_0x3a031e);}(_0xaec1,0xd6));var _0x1aec=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xaec1[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x1aec('0x0'));var util=require(_0x1aec('0x1'));var moment=require(_0x1aec('0x2'));var BPromise=require(_0x1aec('0x3'));var rs=require(_0x1aec('0x4'));var fs=require('fs');var Redis=require(_0x1aec('0x5'));var db=require(_0x1aec('0x6'))['db'];var utils=require(_0x1aec('0x7'));var logger=require('../../config/logger')(_0x1aec('0x8'));var config=require(_0x1aec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1aec('0xa')][_0x1aec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f449,_0x3dbe18,_0x170d6a){return new BPromise(function(_0x53e008,_0x2f1e68){return client[_0x1aec('0xc')](_0x35f449,_0x170d6a)[_0x1aec('0xd')](function(_0x4255be){logger[_0x1aec('0xe')](_0x1aec('0xf'),_0x3dbe18,_0x1aec('0x10'));logger[_0x1aec('0x11')](_0x1aec('0x12'),_0x3dbe18,_0x1aec('0x10'),JSON[_0x1aec('0x13')](_0x4255be));if(_0x4255be['error']){if(_0x4255be[_0x1aec('0x14')][_0x1aec('0x15')]===0x1f4){logger[_0x1aec('0x14')](_0x1aec('0xf'),_0x3dbe18,_0x4255be[_0x1aec('0x14')]['message']);return _0x2f1e68(_0x4255be['error'][_0x1aec('0x16')]);}logger[_0x1aec('0x14')](_0x1aec('0xf'),_0x3dbe18,_0x4255be[_0x1aec('0x14')][_0x1aec('0x16')]);return _0x53e008(_0x4255be[_0x1aec('0x14')][_0x1aec('0x16')]);}else{logger['info'](_0x1aec('0xf'),_0x3dbe18,_0x1aec('0x10'));_0x53e008(_0x4255be[_0x1aec('0x17')][_0x1aec('0x16')]);}})[_0x1aec('0x18')](function(_0x2e74b7){logger[_0x1aec('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3dbe18,_0x2e74b7);_0x2f1e68(_0x2e74b7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 4e2c009..8209ad9 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 _0x20e7=['isAuthenticated','/:id/run','run','/:id/query','query','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','index','/:id','show','/:id/preview'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x20e7,0x190));var _0x720e=function(_0x2e688a,_0x2cdcba){_0x2e688a=_0x2e688a-0x0;var _0x193dcf=_0x20e7[_0x2e688a];return _0x193dcf;};'use strict';var multer=require(_0x720e('0x0'));var util=require(_0x720e('0x1'));var path=require(_0x720e('0x2'));var timeout=require('connect-timeout');var express=require(_0x720e('0x3'));var router=express[_0x720e('0x4')]();var fs_extra=require(_0x720e('0x5'));var auth=require(_0x720e('0x6'));var interaction=require(_0x720e('0x7'));var config=require('../../config/environment');var controller=require(_0x720e('0x8'));router[_0x720e('0x9')]('/',auth['isAuthenticated'](),controller[_0x720e('0xa')]);router[_0x720e('0x9')](_0x720e('0xb'),auth['isAuthenticated'](),controller[_0x720e('0xc')]);router[_0x720e('0x9')](_0x720e('0xd'),auth[_0x720e('0xe')](),controller['preview']);router[_0x720e('0x9')](_0x720e('0xf'),auth[_0x720e('0xe')](),controller[_0x720e('0x10')]);router[_0x720e('0x9')](_0x720e('0x11'),auth[_0x720e('0xe')](),controller[_0x720e('0x12')]);router['post']('/',auth[_0x720e('0xe')](),controller['create']);router[_0x720e('0x13')](_0x720e('0xb'),auth[_0x720e('0xe')](),controller[_0x720e('0x14')]);router[_0x720e('0x15')](_0x720e('0xb'),auth[_0x720e('0xe')](),controller['destroy']);module[_0x720e('0x16')]=router; \ No newline at end of file +var _0xe3ce=['fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/query','post','create','update','delete','destroy','exports','connect-timeout','express','Router'];(function(_0x47faab,_0x2f0254){var _0x392a8b=function(_0xdbe4f5){while(--_0xdbe4f5){_0x47faab['push'](_0x47faab['shift']());}};_0x392a8b(++_0x2f0254);}(_0xe3ce,0xbb));var _0xee3c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe3ce[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xee3c('0x0'));var express=require(_0xee3c('0x1'));var router=express[_0xee3c('0x2')]();var fs_extra=require(_0xee3c('0x3'));var auth=require(_0xee3c('0x4'));var interaction=require(_0xee3c('0x5'));var config=require('../../config/environment');var controller=require(_0xee3c('0x6'));router[_0xee3c('0x7')]('/',auth[_0xee3c('0x8')](),controller[_0xee3c('0x9')]);router[_0xee3c('0x7')](_0xee3c('0xa'),auth[_0xee3c('0x8')](),controller[_0xee3c('0xb')]);router[_0xee3c('0x7')]('/:id/preview',auth[_0xee3c('0x8')](),controller['preview']);router[_0xee3c('0x7')]('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0xee3c('0x7')](_0xee3c('0xc'),auth[_0xee3c('0x8')](),controller['query']);router[_0xee3c('0xd')]('/',auth[_0xee3c('0x8')](),controller[_0xee3c('0xe')]);router['put'](_0xee3c('0xa'),auth[_0xee3c('0x8')](),controller[_0xee3c('0xf')]);router[_0xee3c('0x10')](_0xee3c('0xa'),auth[_0xee3c('0x8')](),controller[_0xee3c('0x11')]);module[_0xee3c('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6142976..fcf9b93 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 _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x5d2487,_0x38d9b5){var _0x2198bc=function(_0x2865f8){while(--_0x2865f8){_0x5d2487['push'](_0x5d2487['shift']());}};_0x2198bc(++_0x38d9b5);}(_0x1883,0xab));var _0x3188=function(_0x49ec05,_0x2bf173){_0x49ec05=_0x49ec05-0x0;var _0x1697dd=_0x1883[_0x49ec05];return _0x1697dd;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x46ed,0x168));var _0xd46e=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x46ed[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ef6a12f..ab73c2c 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 _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x334a94,_0x26b6d1){var _0x1db170=function(_0x5ee6d8){while(--_0x5ee6d8){_0x334a94['push'](_0x334a94['shift']());}};_0x1db170(++_0x26b6d1);}(_0x2675,0x75));var _0x5267=function(_0x32f970,_0xd35123){_0x32f970=_0x32f970-0x0;var _0xb884f2=_0x2675[_0x32f970];return _0xb884f2;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,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(_0x193461,_0x42ce71){var _0x4c237c=function(_0x544492){while(--_0x544492){_0x193461['push'](_0x193461['shift']());}};_0x4c237c(++_0x42ce71);}(_0xba34,0x119));var _0x4ba3=function(_0x4964c4,_0x32de6e){_0x4964c4=_0x4964c4-0x0;var _0x631caa=_0xba34[_0x4964c4];return _0x631caa;};'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 14e42e1..3be2e4a 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 _0xdd05=['path','rimraf','../../config/environment','exports','define','analytics_default_reports','util','api','request-promise'];(function(_0x296e17,_0x52cf9c){var _0x405150=function(_0x5f5006){while(--_0x5f5006){_0x296e17['push'](_0x296e17['shift']());}};_0x405150(++_0x52cf9c);}(_0xdd05,0x72));var _0x5dd0=function(_0x568ec8,_0x1e0f23){_0x568ec8=_0x568ec8-0x0;var _0x52b2be=_0xdd05[_0x568ec8];return _0x52b2be;};'use strict';var _=require('lodash');var util=require(_0x5dd0('0x0'));var logger=require('../../config/logger')(_0x5dd0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5dd0('0x2'));var fs=require('fs');var path=require(_0x5dd0('0x3'));var rimraf=require(_0x5dd0('0x4'));var config=require(_0x5dd0('0x5'));var attributes=require('./analyticDefaultReport.attributes');module[_0x5dd0('0x6')]=function(_0x4466d5,_0x3133d4){return _0x4466d5[_0x5dd0('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0x5dd0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f93=['AnalyticDefaultReport','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x57aac9,_0x2e4bda){var _0x528913=function(_0x2dba48){while(--_0x2dba48){_0x57aac9['push'](_0x57aac9['shift']());}};_0x528913(++_0x2e4bda);}(_0x8f93,0x123));var _0x38f9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8f93[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x38f9('0x0'));var logger=require(_0x38f9('0x1'))(_0x38f9('0x2'));var moment=require(_0x38f9('0x3'));var BPromise=require(_0x38f9('0x4'));var rp=require(_0x38f9('0x5'));var fs=require('fs');var path=require(_0x38f9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x38f9('0x7')]=function(_0x210073,_0x4b2520){return _0x210073[_0x38f9('0x8')](_0x38f9('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 3d70b43..36e5ed7 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 _0xe6a9=['client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','result','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0xe6a9,0x83));var _0x9e6a=function(_0x16aba3,_0x407392){_0x16aba3=_0x16aba3-0x0;var _0x42bda4=_0xe6a9[_0x16aba3];return _0x42bda4;};'use strict';var _=require(_0x9e6a('0x0'));var util=require(_0x9e6a('0x1'));var moment=require('moment');var BPromise=require(_0x9e6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e6a('0x3'));var db=require(_0x9e6a('0x4'))['db'];var utils=require(_0x9e6a('0x5'));var logger=require(_0x9e6a('0x6'))(_0x9e6a('0x7'));var config=require(_0x9e6a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e6a('0x9')][_0x9e6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x306a94,_0x3de65b,_0x25a9c4){return new BPromise(function(_0x27d8c2,_0xaca3b0){return client['request'](_0x306a94,_0x25a9c4)['then'](function(_0x2edc12){logger[_0x9e6a('0xb')](_0x9e6a('0xc'),_0x3de65b,_0x9e6a('0xd'));logger[_0x9e6a('0xe')](_0x9e6a('0xf'),_0x3de65b,_0x9e6a('0xd'),JSON['stringify'](_0x2edc12));if(_0x2edc12[_0x9e6a('0x10')]){if(_0x2edc12['error'][_0x9e6a('0x11')]===0x1f4){logger[_0x9e6a('0x10')](_0x9e6a('0xc'),_0x3de65b,_0x2edc12[_0x9e6a('0x10')]['message']);return _0xaca3b0(_0x2edc12['error']['message']);}logger[_0x9e6a('0x10')](_0x9e6a('0xc'),_0x3de65b,_0x2edc12[_0x9e6a('0x10')]['message']);return _0x27d8c2(_0x2edc12['error']['message']);}else{logger[_0x9e6a('0xb')](_0x9e6a('0xc'),_0x3de65b,_0x9e6a('0xd'));_0x27d8c2(_0x2edc12[_0x9e6a('0x12')][_0x9e6a('0x13')]);}})['catch'](function(_0x1cc00b){logger[_0x9e6a('0x10')](_0x9e6a('0xc'),_0x3de65b,_0x1cc00b);_0xaca3b0(_0x1cc00b);});});} \ No newline at end of file +var _0x051b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird'];(function(_0x3d4d50,_0x366b2e){var _0x533f58=function(_0x390004){while(--_0x390004){_0x3d4d50['push'](_0x3d4d50['shift']());}};_0x533f58(++_0x366b2e);}(_0x051b,0xbc));var _0xb051=function(_0x3e38e9,_0x4ebaed){_0x3e38e9=_0x3e38e9-0x0;var _0x32eb41=_0x051b[_0x3e38e9];return _0x32eb41;};'use strict';var _=require(_0xb051('0x0'));var util=require(_0xb051('0x1'));var moment=require(_0xb051('0x2'));var BPromise=require(_0xb051('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb051('0x4'));var db=require(_0xb051('0x5'))['db'];var utils=require(_0xb051('0x6'));var logger=require(_0xb051('0x7'))(_0xb051('0x8'));var config=require(_0xb051('0x9'));var jayson=require(_0xb051('0xa'));var client=jayson[_0xb051('0xb')][_0xb051('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26ebc0,_0x13c782,_0x2ba2e9){return new BPromise(function(_0x39d032,_0x3ea51b){return client['request'](_0x26ebc0,_0x2ba2e9)[_0xb051('0xd')](function(_0x429437){logger[_0xb051('0xe')](_0xb051('0xf'),_0x13c782,_0xb051('0x10'));logger[_0xb051('0x11')](_0xb051('0x12'),_0x13c782,_0xb051('0x10'),JSON[_0xb051('0x13')](_0x429437));if(_0x429437['error']){if(_0x429437['error'][_0xb051('0x14')]===0x1f4){logger[_0xb051('0x15')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x13c782,_0x429437['error'][_0xb051('0x16')]);return _0x3ea51b(_0x429437[_0xb051('0x15')][_0xb051('0x16')]);}logger[_0xb051('0x15')](_0xb051('0xf'),_0x13c782,_0x429437[_0xb051('0x15')][_0xb051('0x16')]);return _0x39d032(_0x429437[_0xb051('0x15')][_0xb051('0x16')]);}else{logger[_0xb051('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x13c782,_0xb051('0x10'));_0x39d032(_0x429437[_0xb051('0x17')]['message']);}})['catch'](function(_0x2cc063){logger[_0xb051('0x15')](_0xb051('0xf'),_0x13c782,_0x2cc063);_0x3ea51b(_0x2cc063);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8fe98e2..3678f21 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 _0xe22f=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/preview','/:id/run','run','/:id/query','query','put'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xe22f,0x1e0));var _0xfe22=function(_0x844c87,_0x5719f3){_0x844c87=_0x844c87-0x0;var _0x121b8c=_0xe22f[_0x844c87];return _0x121b8c;};'use strict';var multer=require(_0xfe22('0x0'));var util=require(_0xfe22('0x1'));var path=require(_0xfe22('0x2'));var timeout=require(_0xfe22('0x3'));var express=require(_0xfe22('0x4'));var router=express[_0xfe22('0x5')]();var fs_extra=require(_0xfe22('0x6'));var auth=require(_0xfe22('0x7'));var interaction=require(_0xfe22('0x8'));var config=require(_0xfe22('0x9'));var controller=require('./analyticDefaultReport.controller');router[_0xfe22('0xa')]('/',auth[_0xfe22('0xb')](),controller[_0xfe22('0xc')]);router[_0xfe22('0xa')]('/:id',auth[_0xfe22('0xb')](),controller[_0xfe22('0xd')]);router['get'](_0xfe22('0xe'),auth[_0xfe22('0xb')](),controller['preview']);router[_0xfe22('0xa')](_0xfe22('0xf'),auth[_0xfe22('0xb')](),controller[_0xfe22('0x10')]);router[_0xfe22('0xa')](_0xfe22('0x11'),auth['isAuthenticated'](),controller[_0xfe22('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfe22('0x13')](_0xfe22('0x14'),auth[_0xfe22('0xb')](),controller[_0xfe22('0x15')]);router[_0xfe22('0x16')]('/:id',auth[_0xfe22('0xb')](),controller[_0xfe22('0x17')]);module[_0xfe22('0x18')]=router; \ No newline at end of file +var _0x0e6e=['/:id/run','run','/:id/query','post','create','put','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','/:id/preview','preview'];(function(_0x42bbe2,_0x411e96){var _0xb9b096=function(_0x36ac87){while(--_0x36ac87){_0x42bbe2['push'](_0x42bbe2['shift']());}};_0xb9b096(++_0x411e96);}(_0x0e6e,0x14b));var _0xe0e6=function(_0x23140a,_0x35b799){_0x23140a=_0x23140a-0x0;var _0x2d743b=_0x0e6e[_0x23140a];return _0x2d743b;};'use strict';var multer=require(_0xe0e6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe0e6('0x1'));var router=express[_0xe0e6('0x2')]();var fs_extra=require(_0xe0e6('0x3'));var auth=require(_0xe0e6('0x4'));var interaction=require(_0xe0e6('0x5'));var config=require(_0xe0e6('0x6'));var controller=require(_0xe0e6('0x7'));router['get']('/',auth[_0xe0e6('0x8')](),controller[_0xe0e6('0x9')]);router[_0xe0e6('0xa')](_0xe0e6('0xb'),auth[_0xe0e6('0x8')](),controller['show']);router[_0xe0e6('0xa')](_0xe0e6('0xc'),auth[_0xe0e6('0x8')](),controller[_0xe0e6('0xd')]);router[_0xe0e6('0xa')](_0xe0e6('0xe'),auth[_0xe0e6('0x8')](),controller[_0xe0e6('0xf')]);router[_0xe0e6('0xa')](_0xe0e6('0x10'),auth[_0xe0e6('0x8')](),controller['query']);router[_0xe0e6('0x11')]('/',auth[_0xe0e6('0x8')](),controller[_0xe0e6('0x12')]);router[_0xe0e6('0x13')](_0xe0e6('0xb'),auth[_0xe0e6('0x8')](),controller['update']);router[_0xe0e6('0x14')](_0xe0e6('0xb'),auth[_0xe0e6('0x8')](),controller[_0xe0e6('0x15')]);module[_0xe0e6('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index be937d1..7639ab0 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 _0x26c5=['INTEGER','sequelize','exports','STRING','ENUM','csv','xlsx','DATE','Loading','manual','scheduled'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0x26c5,0x11f));var _0x526c=function(_0x1a5220,_0x2b59a1){_0x1a5220=_0x1a5220-0x0;var _0x8b1086=_0x26c5[_0x1a5220];return _0x8b1086;};'use strict';var Sequelize=require(_0x526c('0x0'));var moment=require('moment');module[_0x526c('0x1')]={'name':{'type':Sequelize[_0x526c('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x526c('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x526c('0x3')](_0x526c('0x4'),'pdf',_0x526c('0x5')),'allowNull':![],'defaultValue':_0x526c('0x4')},'savename':{'type':Sequelize[_0x526c('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x526c('0x6')]},'status':{'type':Sequelize[_0x526c('0x2')],'defaultValue':_0x526c('0x7')},'type':{'type':Sequelize[_0x526c('0x3')](_0x526c('0x8'),_0x526c('0x9')),'allowNull':![],'defaultValue':_0x526c('0x8')},'reportId':{'type':Sequelize[_0x526c('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x526c('0x2')]}}; \ No newline at end of file +var _0xe6f8=['ENUM','manual','INTEGER','sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE','Loading'];(function(_0x547af,_0x17abff){var _0x22f7f4=function(_0x5f0384){while(--_0x5f0384){_0x547af['push'](_0x547af['shift']());}};_0x22f7f4(++_0x17abff);}(_0xe6f8,0x16b));var _0x8e6f=function(_0x283a47,_0xa179ef){_0x283a47=_0x283a47-0x0;var _0x2cb0eb=_0xe6f8[_0x283a47];return _0x2cb0eb;};'use strict';var Sequelize=require(_0x8e6f('0x0'));var moment=require(_0x8e6f('0x1'));module[_0x8e6f('0x2')]={'name':{'type':Sequelize[_0x8e6f('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x8e6f('0x4'),_0x8e6f('0x5'),_0x8e6f('0x6')),'allowNull':![],'defaultValue':_0x8e6f('0x4')},'savename':{'type':Sequelize[_0x8e6f('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x8e6f('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x8e6f('0x8')},'type':{'type':Sequelize[_0x8e6f('0x9')](_0x8e6f('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0x8e6f('0xa')},'reportId':{'type':Sequelize[_0x8e6f('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 660aca0..6c17e48 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 _0x4a23=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','fast-json-patch','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','end','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','map','merge','options','includeAll','include','rows','catch','params','find','create'];(function(_0x178fa4,_0x5c3017){var _0x4cea03=function(_0x2ef899){while(--_0x2ef899){_0x178fa4['push'](_0x178fa4['shift']());}};_0x4cea03(++_0x5c3017);}(_0x4a23,0x12d));var _0x34a2=function(_0x3d1aa7,_0x511227){_0x3d1aa7=_0x3d1aa7-0x0;var _0x59f874=_0x4a23[_0x3d1aa7];return _0x59f874;};'use strict';var emlformat=require(_0x34a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x34a2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x34a2('0x2'));var Mustache=require(_0x34a2('0x3'));var util=require('util');var path=require(_0x34a2('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x34a2('0x5'));var fs=require('fs');var fs_extra=require(_0x34a2('0x6'));var _=require('lodash');var squel=require(_0x34a2('0x7'));var crypto=require(_0x34a2('0x8'));var jsforce=require(_0x34a2('0x9'));var deskjs=require(_0x34a2('0xa'));var toCsv=require(_0x34a2('0xb'));var querystring=require('querystring');var Papa=require(_0x34a2('0xc'));var Redis=require(_0x34a2('0xd'));var authService=require(_0x34a2('0xe'));var qs=require(_0x34a2('0xf'));var as=require(_0x34a2('0x10'));var hardwareService=require(_0x34a2('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x34a2('0x12'));var config=require(_0x34a2('0x13'));var licenseUtil=require(_0x34a2('0x14'));var db=require(_0x34a2('0x15'))['db'];function respondWithStatusCode(_0x416504,_0xb4ba8e){_0xb4ba8e=_0xb4ba8e||0xcc;return function(_0x2a13e2){if(_0x2a13e2){return _0x416504[_0x34a2('0x16')](_0xb4ba8e);}return _0x416504[_0x34a2('0x17')](_0xb4ba8e)['end']();};}function respondWithResult(_0x2a101c,_0x1d66c3){_0x1d66c3=_0x1d66c3||0xc8;return function(_0x1cc115){if(_0x1cc115){return _0x2a101c[_0x34a2('0x17')](_0x1d66c3)['json'](_0x1cc115);}};}function respondWithFilteredResult(_0x5a2f3d,_0x142442){return function(_0x54ddc4){if(_0x54ddc4){var _0x294a33=typeof _0x142442[_0x34a2('0x18')]===_0x34a2('0x19')&&typeof _0x142442['limit']===_0x34a2('0x19');var _0x5db717=_0x54ddc4['count'];var _0x37e816=_0x294a33?0x0:_0x142442['offset'];var _0x298d01=_0x294a33?_0x54ddc4[_0x34a2('0x1a')]:_0x142442[_0x34a2('0x18')]+_0x142442[_0x34a2('0x1b')];var _0x52ca5b;if(_0x298d01>=_0x5db717){_0x298d01=_0x5db717;_0x52ca5b=0xc8;}else{_0x52ca5b=0xce;}_0x5a2f3d[_0x34a2('0x17')](_0x52ca5b);return _0x5a2f3d['set'](_0x34a2('0x1c'),_0x37e816+'-'+_0x298d01+'/'+_0x5db717)[_0x34a2('0x1d')](_0x54ddc4);}return null;};}function patchUpdates(_0x26123a){return function(_0x2f690f){try{jsonpatch['apply'](_0x2f690f,_0x26123a,!![]);}catch(_0x303305){return BPromise[_0x34a2('0x1e')](_0x303305);}return _0x2f690f[_0x34a2('0x1f')]();};}function saveUpdates(_0x5263ad,_0x2d03df){return function(_0x32a5a7){if(_0x32a5a7){return _0x32a5a7[_0x34a2('0x20')](_0x5263ad)[_0x34a2('0x21')](function(_0x405149){return _0x405149;});}return null;};}function removeEntity(_0x270156,_0x12389f){return function(_0x122ca7){if(_0x122ca7){return _0x122ca7[_0x34a2('0x22')]()['then'](function(){var _0x95a5f4=_0x122ca7[_0x34a2('0x23')]({'plain':!![]});var _0x5cef67=_0x34a2('0x24');return db[_0x34a2('0x25')][_0x34a2('0x22')]({'where':{'type':_0x5cef67,'resourceId':_0x95a5f4['id']}})['then'](function(){return _0x122ca7;});})[_0x34a2('0x21')](function(){_0x270156[_0x34a2('0x17')](0xcc)[_0x34a2('0x26')]();});}};}function handleEntityNotFound(_0x373d57,_0x452a51){return function(_0x3733b8){if(!_0x3733b8){_0x373d57[_0x34a2('0x16')](0x194);}return _0x3733b8;};}function handleError(_0x28aceb,_0x508644){_0x508644=_0x508644||0x1f4;return function(_0x307149){logger[_0x34a2('0x27')](_0x307149[_0x34a2('0x28')]);if(_0x307149[_0x34a2('0x29')]){delete _0x307149[_0x34a2('0x29')];}_0x28aceb['status'](_0x508644)[_0x34a2('0x2a')](_0x307149);};}exports[_0x34a2('0x2b')]=function(_0x4a74e5,_0x510c88){var _0x20ddd8={},_0x251336={},_0x42c9ba={'count':0x0,'rows':[]};var _0x4679f3=_['map'](db[_0x34a2('0x2c')][_0x34a2('0x2d')],function(_0x4a81d1){return{'name':_0x4a81d1[_0x34a2('0x2e')],'type':_0x4a81d1[_0x34a2('0x2f')]['key']};});_0x251336['model']=_['map'](_0x4679f3,_0x34a2('0x29'));_0x251336[_0x34a2('0x30')]=_[_0x34a2('0x31')](_0x4a74e5[_0x34a2('0x30')]);_0x251336[_0x34a2('0x32')]=_[_0x34a2('0x33')](_0x251336['model'],_0x251336[_0x34a2('0x30')]);_0x20ddd8[_0x34a2('0x34')]=_[_0x34a2('0x33')](_0x251336[_0x34a2('0x35')],qs[_0x34a2('0x36')](_0x4a74e5[_0x34a2('0x30')][_0x34a2('0x36')]));_0x20ddd8[_0x34a2('0x34')]=_0x20ddd8[_0x34a2('0x34')][_0x34a2('0x37')]?_0x20ddd8['attributes']:_0x251336[_0x34a2('0x35')];if(!_0x4a74e5[_0x34a2('0x30')][_0x34a2('0x38')](_0x34a2('0x39'))){_0x20ddd8[_0x34a2('0x1b')]=qs['limit'](_0x4a74e5[_0x34a2('0x30')][_0x34a2('0x1b')]);_0x20ddd8[_0x34a2('0x18')]=qs['offset'](_0x4a74e5[_0x34a2('0x30')][_0x34a2('0x18')]);}_0x20ddd8['order']=qs[_0x34a2('0x3a')](_0x4a74e5[_0x34a2('0x30')]['sort']);_0x20ddd8[_0x34a2('0x3b')]=qs[_0x34a2('0x32')](_[_0x34a2('0x3c')](_0x4a74e5[_0x34a2('0x30')],_0x251336['filters']),_0x4679f3);if(_0x4a74e5['query']['filter']){_0x20ddd8[_0x34a2('0x3b')]=_['merge'](_0x20ddd8[_0x34a2('0x3b')],{'$or':_[_0x34a2('0x3d')](_0x4679f3,function(_0x3a79ca){if(_0x3a79ca[_0x34a2('0x2f')]!=='VIRTUAL'){var _0x3dcbea={};_0x3dcbea[_0x3a79ca[_0x34a2('0x29')]]={'$like':'%'+_0x4a74e5[_0x34a2('0x30')]['filter']+'%'};return _0x3dcbea;}})});}_0x20ddd8=_[_0x34a2('0x3e')]({},_0x20ddd8,_0x4a74e5[_0x34a2('0x3f')]);var _0x1ba1ea={'where':_0x20ddd8['where']};return db[_0x34a2('0x2c')][_0x34a2('0x1a')](_0x1ba1ea)['then'](function(_0x1c2991){_0x42c9ba[_0x34a2('0x1a')]=_0x1c2991;if(_0x4a74e5[_0x34a2('0x30')][_0x34a2('0x40')]){_0x20ddd8[_0x34a2('0x41')]=[{'all':!![]}];}return db[_0x34a2('0x2c')]['findAll'](_0x20ddd8);})[_0x34a2('0x21')](function(_0x513e93){_0x42c9ba[_0x34a2('0x42')]=_0x513e93;return _0x42c9ba;})[_0x34a2('0x21')](respondWithFilteredResult(_0x510c88,_0x20ddd8))[_0x34a2('0x43')](handleError(_0x510c88,null));};exports['show']=function(_0x3ae32b,_0x128aba){var _0x34ea9a={'raw':!![],'where':{'id':_0x3ae32b[_0x34a2('0x44')]['id']}},_0x123c21={};_0x123c21['model']=_['keys'](db[_0x34a2('0x2c')][_0x34a2('0x2d')]);_0x123c21[_0x34a2('0x30')]=_[_0x34a2('0x31')](_0x3ae32b[_0x34a2('0x30')]);_0x123c21[_0x34a2('0x32')]=_['intersection'](_0x123c21['model'],_0x123c21[_0x34a2('0x30')]);_0x34ea9a['attributes']=_[_0x34a2('0x33')](_0x123c21[_0x34a2('0x35')],qs['fields'](_0x3ae32b[_0x34a2('0x30')][_0x34a2('0x36')]));_0x34ea9a[_0x34a2('0x34')]=_0x34ea9a['attributes'][_0x34a2('0x37')]?_0x34ea9a[_0x34a2('0x34')]:_0x123c21['model'];if(_0x3ae32b[_0x34a2('0x30')][_0x34a2('0x40')]){_0x34ea9a[_0x34a2('0x41')]=[{'all':!![]}];}_0x34ea9a=_[_0x34a2('0x3e')]({},_0x34ea9a,_0x3ae32b[_0x34a2('0x3f')]);return db[_0x34a2('0x2c')][_0x34a2('0x45')](_0x34ea9a)[_0x34a2('0x21')](handleEntityNotFound(_0x128aba,null))[_0x34a2('0x21')](respondWithResult(_0x128aba,null))[_0x34a2('0x43')](handleError(_0x128aba,null));};exports[_0x34a2('0x46')]=function(_0x175172,_0x591bc4){return db['AnalyticExtractedReport'][_0x34a2('0x46')](_0x175172[_0x34a2('0x47')],{})[_0x34a2('0x21')](function(_0x265f13){var _0x51c940=_0x175172[_0x34a2('0x48')][_0x34a2('0x23')]({'plain':!![]});if(!_0x51c940)throw new Error(_0x34a2('0x49'));if(_0x51c940[_0x34a2('0x4a')]===_0x34a2('0x48')){var _0x1d232c=_0x265f13['get']({'plain':!![]});var _0xe7a8d2=_0x34a2('0x24');return db[_0x34a2('0x4b')][_0x34a2('0x45')]({'where':{'name':_0xe7a8d2,'userProfileId':_0x51c940[_0x34a2('0x4c')]},'raw':!![]})[_0x34a2('0x21')](function(_0x4b31f2){if(_0x4b31f2&&_0x4b31f2[_0x34a2('0x4d')]===0x0){return db[_0x34a2('0x25')][_0x34a2('0x46')]({'name':_0x1d232c[_0x34a2('0x29')],'resourceId':_0x1d232c['id'],'type':_0x4b31f2[_0x34a2('0x29')],'sectionId':_0x4b31f2['id']},{})[_0x34a2('0x21')](function(){return _0x265f13;});}else{return _0x265f13;}})['catch'](function(_0x162545){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x162545);throw _0x162545;});}return _0x265f13;})[_0x34a2('0x21')](respondWithResult(_0x591bc4,0xc9))['catch'](handleError(_0x591bc4,null));};exports['update']=function(_0x16230f,_0x333423){if(_0x16230f['body']['id']){delete _0x16230f['body']['id'];}return db['AnalyticExtractedReport'][_0x34a2('0x45')]({'where':{'id':_0x16230f[_0x34a2('0x44')]['id']}})[_0x34a2('0x21')](handleEntityNotFound(_0x333423,null))[_0x34a2('0x21')](saveUpdates(_0x16230f['body'],null))[_0x34a2('0x21')](respondWithResult(_0x333423,null))['catch'](handleError(_0x333423,null));};exports[_0x34a2('0x22')]=function(_0x185915,_0x414182){return db[_0x34a2('0x2c')]['find']({'where':{'id':_0x185915[_0x34a2('0x44')]['id']}})[_0x34a2('0x21')](handleEntityNotFound(_0x414182,null))[_0x34a2('0x21')](removeEntity(_0x414182,null))[_0x34a2('0x43')](handleError(_0x414182,null));};exports[_0x34a2('0x4e')]=function(_0x433f3b,_0x336e7d,_0x1a04ab){return db['AnalyticExtractedReport'][_0x34a2('0x45')]({'where':{'id':_0x433f3b[_0x34a2('0x44')]['id']},'attributes':[_0x34a2('0x29'),_0x34a2('0x4f'),_0x34a2('0x50'),_0x34a2('0x51')],'raw':!![]})[_0x34a2('0x21')](handleEntityNotFound(_0x336e7d,null))['then'](function(_0x22a15f){if(_0x22a15f){if(!fs[_0x34a2('0x52')](path[_0x34a2('0x53')](config[_0x34a2('0x54')],_0x34a2('0x55'),_0x22a15f[_0x34a2('0x50')]))){throw new db[(_0x34a2('0x56'))][(_0x34a2('0x57'))](_0x34a2('0x58'));}if(_0x433f3b['query'][_0x34a2('0x59')]){return _0x336e7d[_0x34a2('0x16')](0xc8);}return _0x336e7d[_0x34a2('0x4e')](path[_0x34a2('0x53')](config[_0x34a2('0x54')],_0x34a2('0x55'),_0x22a15f['savename']),util[_0x34a2('0x5a')](_0x34a2('0x5b'),_0x22a15f[_0x34a2('0x4f')]||_0x22a15f[_0x34a2('0x29')],_0x22a15f[_0x34a2('0x51')][_0x34a2('0x5c')]()));}})[_0x34a2('0x43')](handleError(_0x336e7d,null));}; \ No newline at end of file +var _0xeaff=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','nolimit','sort','where','filters','pick','filter','name','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','format','%s.%s','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x2782db,_0x2a516f){var _0x4af4e4=function(_0x17316a){while(--_0x17316a){_0x2782db['push'](_0x2782db['shift']());}};_0x4af4e4(++_0x2a516f);}(_0xeaff,0x175));var _0xfeaf=function(_0x4022e5,_0x4075){_0x4022e5=_0x4022e5-0x0;var _0x591f67=_0xeaff[_0x4022e5];return _0x591f67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfeaf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfeaf('0x1'));var rp=require(_0xfeaf('0x2'));var moment=require('moment');var BPromise=require(_0xfeaf('0x3'));var Mustache=require(_0xfeaf('0x4'));var util=require(_0xfeaf('0x5'));var path=require(_0xfeaf('0x6'));var sox=require(_0xfeaf('0x7'));var csv=require(_0xfeaf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfeaf('0x9'));var _=require(_0xfeaf('0xa'));var squel=require(_0xfeaf('0xb'));var crypto=require(_0xfeaf('0xc'));var jsforce=require(_0xfeaf('0xd'));var deskjs=require(_0xfeaf('0xe'));var toCsv=require(_0xfeaf('0x8'));var querystring=require(_0xfeaf('0xf'));var Papa=require('papaparse');var Redis=require(_0xfeaf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfeaf('0x11'));var as=require(_0xfeaf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfeaf('0x13'));var utils=require(_0xfeaf('0x14'));var config=require(_0xfeaf('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd9c0de,_0x3a485a){_0x3a485a=_0x3a485a||0xcc;return function(_0x517725){if(_0x517725){return _0xd9c0de['sendStatus'](_0x3a485a);}return _0xd9c0de[_0xfeaf('0x16')](_0x3a485a)[_0xfeaf('0x17')]();};}function respondWithResult(_0x422faa,_0x3b171){_0x3b171=_0x3b171||0xc8;return function(_0x457fc8){if(_0x457fc8){return _0x422faa[_0xfeaf('0x16')](_0x3b171)[_0xfeaf('0x18')](_0x457fc8);}};}function respondWithFilteredResult(_0x172f35,_0xb3e457){return function(_0x4dccc2){if(_0x4dccc2){var _0x1f7240=typeof _0xb3e457[_0xfeaf('0x19')]===_0xfeaf('0x1a')&&typeof _0xb3e457[_0xfeaf('0x1b')]==='undefined';var _0x5f059a=_0x4dccc2[_0xfeaf('0x1c')];var _0x3037aa=_0x1f7240?0x0:_0xb3e457['offset'];var _0x11c3a2=_0x1f7240?_0x4dccc2[_0xfeaf('0x1c')]:_0xb3e457[_0xfeaf('0x19')]+_0xb3e457['limit'];var _0x389ec0;if(_0x11c3a2>=_0x5f059a){_0x11c3a2=_0x5f059a;_0x389ec0=0xc8;}else{_0x389ec0=0xce;}_0x172f35[_0xfeaf('0x16')](_0x389ec0);return _0x172f35[_0xfeaf('0x1d')](_0xfeaf('0x1e'),_0x3037aa+'-'+_0x11c3a2+'/'+_0x5f059a)['json'](_0x4dccc2);}return null;};}function patchUpdates(_0x2f2109){return function(_0x1b1ae0){try{jsonpatch[_0xfeaf('0x1f')](_0x1b1ae0,_0x2f2109,!![]);}catch(_0xebdbf9){return BPromise[_0xfeaf('0x20')](_0xebdbf9);}return _0x1b1ae0[_0xfeaf('0x21')]();};}function saveUpdates(_0x211ba6,_0x3231cf){return function(_0x1f7848){if(_0x1f7848){return _0x1f7848[_0xfeaf('0x22')](_0x211ba6)[_0xfeaf('0x23')](function(_0x5921e4){return _0x5921e4;});}return null;};}function removeEntity(_0x495d16,_0x26a212){return function(_0x2970fd){if(_0x2970fd){return _0x2970fd[_0xfeaf('0x24')]()['then'](function(){var _0x1d0b09=_0x2970fd[_0xfeaf('0x25')]({'plain':!![]});var _0x107e41=_0xfeaf('0x26');return db[_0xfeaf('0x27')][_0xfeaf('0x24')]({'where':{'type':_0x107e41,'resourceId':_0x1d0b09['id']}})[_0xfeaf('0x23')](function(){return _0x2970fd;});})[_0xfeaf('0x23')](function(){_0x495d16[_0xfeaf('0x16')](0xcc)[_0xfeaf('0x17')]();});}};}function handleEntityNotFound(_0x4cec81,_0x5c7b3d){return function(_0xbef279){if(!_0xbef279){_0x4cec81['sendStatus'](0x194);}return _0xbef279;};}function handleError(_0x5a8877,_0x4a58c3){_0x4a58c3=_0x4a58c3||0x1f4;return function(_0x58e4fd){logger['error'](_0x58e4fd[_0xfeaf('0x28')]);if(_0x58e4fd['name']){delete _0x58e4fd['name'];}_0x5a8877[_0xfeaf('0x16')](_0x4a58c3)[_0xfeaf('0x29')](_0x58e4fd);};}exports[_0xfeaf('0x2a')]=function(_0x47c46c,_0x5828db){var _0x44aebc={},_0x180bd5={},_0x1d2695={'count':0x0,'rows':[]};var _0x29b9c2=_[_0xfeaf('0x2b')](db[_0xfeaf('0x2c')][_0xfeaf('0x2d')],function(_0x2bfe78){return{'name':_0x2bfe78[_0xfeaf('0x2e')],'type':_0x2bfe78[_0xfeaf('0x2f')][_0xfeaf('0x30')]};});_0x180bd5['model']=_[_0xfeaf('0x2b')](_0x29b9c2,'name');_0x180bd5['query']=_[_0xfeaf('0x31')](_0x47c46c[_0xfeaf('0x32')]);_0x180bd5['filters']=_[_0xfeaf('0x33')](_0x180bd5[_0xfeaf('0x34')],_0x180bd5[_0xfeaf('0x32')]);_0x44aebc[_0xfeaf('0x35')]=_[_0xfeaf('0x33')](_0x180bd5[_0xfeaf('0x34')],qs['fields'](_0x47c46c['query'][_0xfeaf('0x36')]));_0x44aebc[_0xfeaf('0x35')]=_0x44aebc['attributes']['length']?_0x44aebc['attributes']:_0x180bd5['model'];if(!_0x47c46c[_0xfeaf('0x32')]['hasOwnProperty'](_0xfeaf('0x37'))){_0x44aebc[_0xfeaf('0x1b')]=qs[_0xfeaf('0x1b')](_0x47c46c[_0xfeaf('0x32')][_0xfeaf('0x1b')]);_0x44aebc[_0xfeaf('0x19')]=qs[_0xfeaf('0x19')](_0x47c46c[_0xfeaf('0x32')]['offset']);}_0x44aebc['order']=qs[_0xfeaf('0x38')](_0x47c46c[_0xfeaf('0x32')][_0xfeaf('0x38')]);_0x44aebc[_0xfeaf('0x39')]=qs[_0xfeaf('0x3a')](_[_0xfeaf('0x3b')](_0x47c46c[_0xfeaf('0x32')],_0x180bd5[_0xfeaf('0x3a')]),_0x29b9c2);if(_0x47c46c[_0xfeaf('0x32')][_0xfeaf('0x3c')]){_0x44aebc[_0xfeaf('0x39')]=_['merge'](_0x44aebc[_0xfeaf('0x39')],{'$or':_[_0xfeaf('0x2b')](_0x29b9c2,function(_0xeae25d){if(_0xeae25d[_0xfeaf('0x2f')]!=='VIRTUAL'){var _0xaadf3a={};_0xaadf3a[_0xeae25d[_0xfeaf('0x3d')]]={'$like':'%'+_0x47c46c[_0xfeaf('0x32')][_0xfeaf('0x3c')]+'%'};return _0xaadf3a;}})});}_0x44aebc=_[_0xfeaf('0x3e')]({},_0x44aebc,_0x47c46c[_0xfeaf('0x3f')]);var _0x11afe8={'where':_0x44aebc[_0xfeaf('0x39')]};return db['AnalyticExtractedReport'][_0xfeaf('0x1c')](_0x11afe8)[_0xfeaf('0x23')](function(_0x4f27b1){_0x1d2695[_0xfeaf('0x1c')]=_0x4f27b1;if(_0x47c46c[_0xfeaf('0x32')]['includeAll']){_0x44aebc[_0xfeaf('0x40')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xfeaf('0x41')](_0x44aebc);})[_0xfeaf('0x23')](function(_0x1f9841){_0x1d2695[_0xfeaf('0x42')]=_0x1f9841;return _0x1d2695;})[_0xfeaf('0x23')](respondWithFilteredResult(_0x5828db,_0x44aebc))[_0xfeaf('0x43')](handleError(_0x5828db,null));};exports[_0xfeaf('0x44')]=function(_0x2fa51a,_0x582d71){var _0x53ab60={'raw':!![],'where':{'id':_0x2fa51a[_0xfeaf('0x45')]['id']}},_0x555d65={};_0x555d65[_0xfeaf('0x34')]=_['keys'](db[_0xfeaf('0x2c')][_0xfeaf('0x2d')]);_0x555d65[_0xfeaf('0x32')]=_[_0xfeaf('0x31')](_0x2fa51a[_0xfeaf('0x32')]);_0x555d65[_0xfeaf('0x3a')]=_['intersection'](_0x555d65[_0xfeaf('0x34')],_0x555d65['query']);_0x53ab60[_0xfeaf('0x35')]=_[_0xfeaf('0x33')](_0x555d65[_0xfeaf('0x34')],qs['fields'](_0x2fa51a[_0xfeaf('0x32')][_0xfeaf('0x36')]));_0x53ab60[_0xfeaf('0x35')]=_0x53ab60[_0xfeaf('0x35')][_0xfeaf('0x46')]?_0x53ab60[_0xfeaf('0x35')]:_0x555d65[_0xfeaf('0x34')];if(_0x2fa51a[_0xfeaf('0x32')][_0xfeaf('0x47')]){_0x53ab60[_0xfeaf('0x40')]=[{'all':!![]}];}_0x53ab60=_[_0xfeaf('0x3e')]({},_0x53ab60,_0x2fa51a[_0xfeaf('0x3f')]);return db[_0xfeaf('0x2c')]['find'](_0x53ab60)[_0xfeaf('0x23')](handleEntityNotFound(_0x582d71,null))[_0xfeaf('0x23')](respondWithResult(_0x582d71,null))[_0xfeaf('0x43')](handleError(_0x582d71,null));};exports[_0xfeaf('0x48')]=function(_0x3fc780,_0x343dba){return db[_0xfeaf('0x2c')][_0xfeaf('0x48')](_0x3fc780['body'],{})[_0xfeaf('0x23')](function(_0x2be1c9){var _0x742d4e=_0x3fc780[_0xfeaf('0x49')][_0xfeaf('0x25')]({'plain':!![]});if(!_0x742d4e)throw new Error(_0xfeaf('0x4a'));if(_0x742d4e['role']===_0xfeaf('0x49')){var _0x509fb9=_0x2be1c9[_0xfeaf('0x25')]({'plain':!![]});var _0x189267=_0xfeaf('0x26');return db['UserProfileSection'][_0xfeaf('0x4b')]({'where':{'name':_0x189267,'userProfileId':_0x742d4e[_0xfeaf('0x4c')]},'raw':!![]})[_0xfeaf('0x23')](function(_0x2f77c0){if(_0x2f77c0&&_0x2f77c0[_0xfeaf('0x4d')]===0x0){return db[_0xfeaf('0x27')][_0xfeaf('0x48')]({'name':_0x509fb9[_0xfeaf('0x3d')],'resourceId':_0x509fb9['id'],'type':_0x2f77c0['name'],'sectionId':_0x2f77c0['id']},{})[_0xfeaf('0x23')](function(){return _0x2be1c9;});}else{return _0x2be1c9;}})[_0xfeaf('0x43')](function(_0x47bed9){logger[_0xfeaf('0x4e')](_0xfeaf('0x4f'),_0x47bed9);throw _0x47bed9;});}return _0x2be1c9;})[_0xfeaf('0x23')](respondWithResult(_0x343dba,0xc9))[_0xfeaf('0x43')](handleError(_0x343dba,null));};exports['update']=function(_0x4e1b73,_0x4cd766){if(_0x4e1b73[_0xfeaf('0x50')]['id']){delete _0x4e1b73[_0xfeaf('0x50')]['id'];}return db[_0xfeaf('0x2c')][_0xfeaf('0x4b')]({'where':{'id':_0x4e1b73[_0xfeaf('0x45')]['id']}})[_0xfeaf('0x23')](handleEntityNotFound(_0x4cd766,null))[_0xfeaf('0x23')](saveUpdates(_0x4e1b73['body'],null))['then'](respondWithResult(_0x4cd766,null))['catch'](handleError(_0x4cd766,null));};exports[_0xfeaf('0x24')]=function(_0x189f16,_0x4d19e0){return db[_0xfeaf('0x2c')]['find']({'where':{'id':_0x189f16[_0xfeaf('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d19e0,null))[_0xfeaf('0x23')](removeEntity(_0x4d19e0,null))[_0xfeaf('0x43')](handleError(_0x4d19e0,null));};exports[_0xfeaf('0x51')]=function(_0x419ce5,_0x31ab42,_0x34aa99){return db[_0xfeaf('0x2c')]['find']({'where':{'id':_0x419ce5[_0xfeaf('0x45')]['id']},'attributes':[_0xfeaf('0x3d'),_0xfeaf('0x52'),_0xfeaf('0x53'),_0xfeaf('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x31ab42,null))['then'](function(_0x3353b9){if(_0x3353b9){if(!fs[_0xfeaf('0x55')](path[_0xfeaf('0x56')](config[_0xfeaf('0x57')],_0xfeaf('0x58'),_0x3353b9[_0xfeaf('0x53')]))){throw new db[(_0xfeaf('0x59'))]['ValidationError'](_0xfeaf('0x5a'));}if(_0x419ce5[_0xfeaf('0x32')][_0xfeaf('0x5b')]){return _0x31ab42[_0xfeaf('0x5c')](0xc8);}return _0x31ab42[_0xfeaf('0x51')](path[_0xfeaf('0x56')](config[_0xfeaf('0x57')],_0xfeaf('0x58'),_0x3353b9['savename']),util[_0xfeaf('0x5d')](_0xfeaf('0x5e'),_0x3353b9[_0xfeaf('0x52')]||_0x3353b9[_0xfeaf('0x3d')],_0x3353b9[_0xfeaf('0x54')]['toLowerCase']()));}})[_0xfeaf('0x43')](handleError(_0x31ab42,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 75ed073..22f5555 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 _0xdeb2=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x133f65,_0x1b0766){var _0x2e4652=function(_0xd2955a){while(--_0xd2955a){_0x133f65['push'](_0x133f65['shift']());}};_0x2e4652(++_0x1b0766);}(_0xdeb2,0x1a7));var _0x2deb=function(_0x38c17e,_0x42cae9){_0x38c17e=_0x38c17e-0x0;var _0x42c011=_0xdeb2[_0x38c17e];return _0x42c011;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2deb('0x0'))(_0x2deb('0x1'));var moment=require(_0x2deb('0x2'));var BPromise=require(_0x2deb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2deb('0x4'));var rimraf=require(_0x2deb('0x5'));var config=require(_0x2deb('0x6'));var attributes=require(_0x2deb('0x7'));module[_0x2deb('0x8')]=function(_0x28bb01,_0x31637b){return _0x28bb01[_0x2deb('0x9')](_0x2deb('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68bb=['define','analytics_extracted_reports','lodash','api','moment','rimraf'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_0x68bb,0xc8));var _0xb68b=function(_0x8ac1d8,_0x29d866){_0x8ac1d8=_0x8ac1d8-0x0;var _0x594a9b=_0x68bb[_0x8ac1d8];return _0x594a9b;};'use strict';var _=require(_0xb68b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb68b('0x1'));var moment=require(_0xb68b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb68b('0x3'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0xb7b1a1,_0x5a1692){return _0xb7b1a1[_0xb68b('0x4')]('AnalyticExtractedReport',attributes,{'tableName':_0xb68b('0x5'),'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 507906f..df7af58 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 _0x9584=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x17981e,_0x314461){var _0x1a8b78=function(_0x5f4d13){while(--_0x5f4d13){_0x17981e['push'](_0x17981e['shift']());}};_0x1a8b78(++_0x314461);}(_0x9584,0x1b9));var _0x4958=function(_0x5d7e2f,_0x460f23){_0x5d7e2f=_0x5d7e2f-0x0;var _0x5ef96b=_0x9584[_0x5d7e2f];return _0x5ef96b;};'use strict';var _=require(_0x4958('0x0'));var util=require(_0x4958('0x1'));var moment=require(_0x4958('0x2'));var BPromise=require('bluebird');var rs=require(_0x4958('0x3'));var fs=require('fs');var Redis=require(_0x4958('0x4'));var db=require(_0x4958('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4958('0x6'))(_0x4958('0x7'));var config=require(_0x4958('0x8'));var jayson=require(_0x4958('0x9'));var client=jayson[_0x4958('0xa')][_0x4958('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x527644,_0x1dfabd,_0x152103){return new BPromise(function(_0x27c0ff,_0x276ec8){return client[_0x4958('0xc')](_0x527644,_0x152103)[_0x4958('0xd')](function(_0xf399d6){logger[_0x4958('0xe')](_0x4958('0xf'),_0x1dfabd,_0x4958('0x10'));logger[_0x4958('0x11')](_0x4958('0x12'),_0x1dfabd,'request\x20sent',JSON[_0x4958('0x13')](_0xf399d6));if(_0xf399d6[_0x4958('0x14')]){if(_0xf399d6['error'][_0x4958('0x15')]===0x1f4){logger[_0x4958('0x14')](_0x4958('0xf'),_0x1dfabd,_0xf399d6[_0x4958('0x14')][_0x4958('0x16')]);return _0x276ec8(_0xf399d6[_0x4958('0x14')][_0x4958('0x16')]);}logger[_0x4958('0x14')](_0x4958('0xf'),_0x1dfabd,_0xf399d6[_0x4958('0x14')][_0x4958('0x16')]);return _0x27c0ff(_0xf399d6[_0x4958('0x14')][_0x4958('0x16')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1dfabd,_0x4958('0x10'));_0x27c0ff(_0xf399d6[_0x4958('0x17')]['message']);}})['catch'](function(_0x442552){logger[_0x4958('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1dfabd,_0x442552);_0x276ec8(_0x442552);});});} \ No newline at end of file +var _0x1336=['randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0x34ed07,_0x104791){var _0xda62ac=function(_0x5b0979){while(--_0x5b0979){_0x34ed07['push'](_0x34ed07['shift']());}};_0xda62ac(++_0x104791);}(_0x1336,0xe1));var _0x6133=function(_0x20094d,_0x38ba67){_0x20094d=_0x20094d-0x0;var _0x36b8c8=_0x1336[_0x20094d];return _0x36b8c8;};'use strict';var _=require(_0x6133('0x0'));var util=require('util');var moment=require(_0x6133('0x1'));var BPromise=require(_0x6133('0x2'));var rs=require(_0x6133('0x3'));var fs=require('fs');var Redis=require(_0x6133('0x4'));var db=require(_0x6133('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6133('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6133('0x7')][_0x6133('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3acdf7,_0x4ac9ae,_0x2870bd){return new BPromise(function(_0x1863f9,_0x519ab6){return client[_0x6133('0x9')](_0x3acdf7,_0x2870bd)[_0x6133('0xa')](function(_0xf18af5){logger[_0x6133('0xb')](_0x6133('0xc'),_0x4ac9ae,_0x6133('0xd'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4ac9ae,_0x6133('0xd'),JSON[_0x6133('0xe')](_0xf18af5));if(_0xf18af5[_0x6133('0xf')]){if(_0xf18af5[_0x6133('0xf')][_0x6133('0x10')]===0x1f4){logger[_0x6133('0xf')](_0x6133('0xc'),_0x4ac9ae,_0xf18af5[_0x6133('0xf')][_0x6133('0x11')]);return _0x519ab6(_0xf18af5[_0x6133('0xf')][_0x6133('0x11')]);}logger['error'](_0x6133('0xc'),_0x4ac9ae,_0xf18af5['error'][_0x6133('0x11')]);return _0x1863f9(_0xf18af5['error'][_0x6133('0x11')]);}else{logger[_0x6133('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ac9ae,_0x6133('0xd'));_0x1863f9(_0xf18af5['result']['message']);}})[_0x6133('0x12')](function(_0x5ed575){logger[_0x6133('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4ac9ae,_0x5ed575);_0x519ab6(_0x5ed575);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d446fd0..8cc50b3 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 _0xf32d=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','/:id/download','post','create','put','update','delete','destroy','exports'];(function(_0x4ed6c7,_0x2e6803){var _0x112d0c=function(_0x188c4f){while(--_0x188c4f){_0x4ed6c7['push'](_0x4ed6c7['shift']());}};_0x112d0c(++_0x2e6803);}(_0xf32d,0x10a));var _0xdf32=function(_0x266774,_0x34419f){_0x266774=_0x266774-0x0;var _0x418a73=_0xf32d[_0x266774];return _0x418a73;};'use strict';var multer=require(_0xdf32('0x0'));var util=require('util');var path=require(_0xdf32('0x1'));var timeout=require(_0xdf32('0x2'));var express=require(_0xdf32('0x3'));var router=express[_0xdf32('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdf32('0x5'));var config=require(_0xdf32('0x6'));var controller=require(_0xdf32('0x7'));router[_0xdf32('0x8')]('/',auth[_0xdf32('0x9')](),controller['index']);router[_0xdf32('0x8')](_0xdf32('0xa'),auth[_0xdf32('0x9')](),controller['show']);router['get'](_0xdf32('0xb'),auth['isAuthenticated'](),controller['download']);router[_0xdf32('0xc')]('/',auth['isAuthenticated'](),controller[_0xdf32('0xd')]);router[_0xdf32('0xe')](_0xdf32('0xa'),auth[_0xdf32('0x9')](),controller[_0xdf32('0xf')]);router[_0xdf32('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdf32('0x11')]);module[_0xdf32('0x12')]=router; \ No newline at end of file +var _0x5d20=['/:id/download','download','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x199a6b,_0x5a7c9f){var _0x139305=function(_0x4ff977){while(--_0x4ff977){_0x199a6b['push'](_0x199a6b['shift']());}};_0x139305(++_0x5a7c9f);}(_0x5d20,0x127));var _0x05d2=function(_0x40f0b4,_0x2d4c50){_0x40f0b4=_0x40f0b4-0x0;var _0x2dfe79=_0x5d20[_0x40f0b4];return _0x2dfe79;};'use strict';var multer=require('multer');var util=require(_0x05d2('0x0'));var path=require(_0x05d2('0x1'));var timeout=require(_0x05d2('0x2'));var express=require('express');var router=express[_0x05d2('0x3')]();var fs_extra=require(_0x05d2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x05d2('0x5'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x05d2('0x6')]('/',auth[_0x05d2('0x7')](),controller[_0x05d2('0x8')]);router['get'](_0x05d2('0x9'),auth['isAuthenticated'](),controller[_0x05d2('0xa')]);router['get'](_0x05d2('0xb'),auth['isAuthenticated'](),controller[_0x05d2('0xc')]);router['post']('/',auth[_0x05d2('0x7')](),controller['create']);router[_0x05d2('0xd')]('/:id',auth[_0x05d2('0x7')](),controller[_0x05d2('0xe')]);router['delete'](_0x05d2('0x9'),auth[_0x05d2('0x7')](),controller[_0x05d2('0xf')]);module[_0x05d2('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 7ae4596..3bd0de6 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 _0x0038=['STRING','BOOLEAN','exports','TEXT'];(function(_0x2f6472,_0x1a2a1a){var _0xd1f6e5=function(_0x1fa269){while(--_0x1fa269){_0x2f6472['push'](_0x2f6472['shift']());}};_0xd1f6e5(++_0x1a2a1a);}(_0x0038,0xfa));var _0x8003=function(_0x496428,_0x49083b){_0x496428=_0x496428-0x0;var _0x3104e8=_0x0038[_0x496428];return _0x3104e8;};'use strict';var Sequelize=require('sequelize');module[_0x8003('0x0')]={'field':{'type':Sequelize[_0x8003('0x1')]},'alias':{'type':Sequelize[_0x8003('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x8003('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8003('0x2')]},'custom':{'type':Sequelize[_0x8003('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xcf8e=['sequelize','STRING','BOOLEAN'];(function(_0x319962,_0x29ecd1){var _0x1d9d57=function(_0x4fe2a7){while(--_0x4fe2a7){_0x319962['push'](_0x319962['shift']());}};_0x1d9d57(++_0x29ecd1);}(_0xcf8e,0x19e));var _0xecf8=function(_0x4202b2,_0x4c22e6){_0x4202b2=_0x4202b2-0x0;var _0x70d632=_0xcf8e[_0x4202b2];return _0x70d632;};'use strict';var Sequelize=require(_0xecf8('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xecf8('0x1')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xecf8('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xecf8('0x1')]},'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 de6ddda..608d96e 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 _0x442d=['filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','fieldName','type','key','map','query','keys'];(function(_0x95276b,_0x24e12c){var _0x1d6d1f=function(_0xea99af){while(--_0xea99af){_0x95276b['push'](_0x95276b['shift']());}};_0x1d6d1f(++_0x24e12c);}(_0x442d,0xbf));var _0xd442=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0x442d[_0x2e7f96];return _0x315277;};'use strict';var emlformat=require(_0xd442('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd442('0x1'));var jsonpatch=require(_0xd442('0x2'));var rp=require(_0xd442('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd442('0x4'));var util=require(_0xd442('0x5'));var path=require(_0xd442('0x6'));var sox=require(_0xd442('0x7'));var csv=require(_0xd442('0x8'));var ejs=require(_0xd442('0x9'));var fs=require('fs');var fs_extra=require(_0xd442('0xa'));var _=require(_0xd442('0xb'));var squel=require(_0xd442('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd442('0xd'));var toCsv=require(_0xd442('0x8'));var querystring=require(_0xd442('0xe'));var Papa=require(_0xd442('0xf'));var Redis=require(_0xd442('0x10'));var authService=require(_0xd442('0x11'));var qs=require(_0xd442('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd442('0x13'));var logger=require(_0xd442('0x14'))('api');var utils=require(_0xd442('0x15'));var config=require(_0xd442('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd442('0x17'))['db'];function respondWithStatusCode(_0x47a560,_0x339851){_0x339851=_0x339851||0xcc;return function(_0x235d81){if(_0x235d81){return _0x47a560[_0xd442('0x18')](_0x339851);}return _0x47a560[_0xd442('0x19')](_0x339851)[_0xd442('0x1a')]();};}function respondWithResult(_0x16c6ff,_0x3ed3e7){_0x3ed3e7=_0x3ed3e7||0xc8;return function(_0x44e461){if(_0x44e461){return _0x16c6ff['status'](_0x3ed3e7)['json'](_0x44e461);}};}function respondWithFilteredResult(_0x1054a9,_0x1bf503){return function(_0x376fdd){if(_0x376fdd){var _0x43cfa4=typeof _0x1bf503[_0xd442('0x1b')]==='undefined'&&typeof _0x1bf503[_0xd442('0x1c')]==='undefined';var _0x45df08=_0x376fdd[_0xd442('0x1d')];var _0x9c24b9=_0x43cfa4?0x0:_0x1bf503[_0xd442('0x1b')];var _0x2af54a=_0x43cfa4?_0x376fdd[_0xd442('0x1d')]:_0x1bf503[_0xd442('0x1b')]+_0x1bf503[_0xd442('0x1c')];var _0x183430;if(_0x2af54a>=_0x45df08){_0x2af54a=_0x45df08;_0x183430=0xc8;}else{_0x183430=0xce;}_0x1054a9['status'](_0x183430);return _0x1054a9['set'](_0xd442('0x1e'),_0x9c24b9+'-'+_0x2af54a+'/'+_0x45df08)[_0xd442('0x1f')](_0x376fdd);}return null;};}function patchUpdates(_0x1c3f46){return function(_0x2f5a78){try{jsonpatch[_0xd442('0x20')](_0x2f5a78,_0x1c3f46,!![]);}catch(_0x3bbb32){return BPromise[_0xd442('0x21')](_0x3bbb32);}return _0x2f5a78['save']();};}function saveUpdates(_0x3a1fb5,_0x3041f2){return function(_0x47d8c4){if(_0x47d8c4){return _0x47d8c4[_0xd442('0x22')](_0x3a1fb5)[_0xd442('0x23')](function(_0x2ce83a){return _0x2ce83a;});}return null;};}function removeEntity(_0x4d4159,_0x143ea6){return function(_0x282f1c){if(_0x282f1c){return _0x282f1c[_0xd442('0x24')]()[_0xd442('0x23')](function(){_0x4d4159[_0xd442('0x19')](0xcc)[_0xd442('0x1a')]();});}};}function handleEntityNotFound(_0x24e5c3,_0x4613ce){return function(_0x394ad9){if(!_0x394ad9){_0x24e5c3['sendStatus'](0x194);}return _0x394ad9;};}function handleError(_0x29e7af,_0x287a24){_0x287a24=_0x287a24||0x1f4;return function(_0x44f38b){logger[_0xd442('0x25')](_0x44f38b[_0xd442('0x26')]);if(_0x44f38b[_0xd442('0x27')]){delete _0x44f38b[_0xd442('0x27')];}_0x29e7af[_0xd442('0x19')](_0x287a24)[_0xd442('0x28')](_0x44f38b);};}exports[_0xd442('0x29')]=function(_0x20b13d,_0x16f493){var _0x54e5cb={},_0xc6f04f={},_0x4ceec3={'count':0x0,'rows':[]};var _0x3b9337=_['map'](db[_0xd442('0x2a')]['rawAttributes'],function(_0x266b82){return{'name':_0x266b82[_0xd442('0x2b')],'type':_0x266b82[_0xd442('0x2c')][_0xd442('0x2d')]};});_0xc6f04f['model']=_[_0xd442('0x2e')](_0x3b9337,'name');_0xc6f04f[_0xd442('0x2f')]=_[_0xd442('0x30')](_0x20b13d[_0xd442('0x2f')]);_0xc6f04f[_0xd442('0x31')]=_[_0xd442('0x32')](_0xc6f04f[_0xd442('0x33')],_0xc6f04f[_0xd442('0x2f')]);_0x54e5cb[_0xd442('0x34')]=_[_0xd442('0x32')](_0xc6f04f[_0xd442('0x33')],qs[_0xd442('0x35')](_0x20b13d[_0xd442('0x2f')][_0xd442('0x35')]));_0x54e5cb[_0xd442('0x34')]=_0x54e5cb['attributes'][_0xd442('0x36')]?_0x54e5cb[_0xd442('0x34')]:_0xc6f04f['model'];if(!_0x20b13d['query'][_0xd442('0x37')]('nolimit')){_0x54e5cb['limit']=qs[_0xd442('0x1c')](_0x20b13d[_0xd442('0x2f')]['limit']);_0x54e5cb['offset']=qs[_0xd442('0x1b')](_0x20b13d[_0xd442('0x2f')][_0xd442('0x1b')]);}_0x54e5cb[_0xd442('0x38')]=qs[_0xd442('0x39')](_0x20b13d[_0xd442('0x2f')][_0xd442('0x39')]);_0x54e5cb[_0xd442('0x3a')]=qs[_0xd442('0x31')](_[_0xd442('0x3b')](_0x20b13d[_0xd442('0x2f')],_0xc6f04f[_0xd442('0x31')]),_0x3b9337);if(_0x20b13d[_0xd442('0x2f')][_0xd442('0x3c')]){_0x54e5cb[_0xd442('0x3a')]=_['merge'](_0x54e5cb['where'],{'$or':_[_0xd442('0x2e')](_0x3b9337,function(_0x587e59){if(_0x587e59[_0xd442('0x2c')]!=='VIRTUAL'){var _0x3f1029={};_0x3f1029[_0x587e59[_0xd442('0x27')]]={'$like':'%'+_0x20b13d[_0xd442('0x2f')]['filter']+'%'};return _0x3f1029;}})});}_0x54e5cb=_[_0xd442('0x3d')]({},_0x54e5cb,_0x20b13d[_0xd442('0x3e')]);var _0x403be6={'where':_0x54e5cb[_0xd442('0x3a')]};return db[_0xd442('0x2a')][_0xd442('0x1d')](_0x403be6)[_0xd442('0x23')](function(_0x5266d0){_0x4ceec3[_0xd442('0x1d')]=_0x5266d0;if(_0x20b13d[_0xd442('0x2f')][_0xd442('0x3f')]){_0x54e5cb['include']=[{'all':!![]}];}return db[_0xd442('0x2a')][_0xd442('0x40')](_0x54e5cb);})[_0xd442('0x23')](function(_0x34973d){_0x4ceec3['rows']=_0x34973d;return _0x4ceec3;})[_0xd442('0x23')](respondWithFilteredResult(_0x16f493,_0x54e5cb))[_0xd442('0x41')](handleError(_0x16f493,null));};exports[_0xd442('0x42')]=function(_0x3b4a57,_0x5ac786){var _0x9f7f88={'raw':![],'where':{'id':_0x3b4a57[_0xd442('0x43')]['id']}},_0x1de0c8={};_0x1de0c8[_0xd442('0x33')]=_[_0xd442('0x30')](db[_0xd442('0x2a')][_0xd442('0x44')]);_0x1de0c8[_0xd442('0x2f')]=_[_0xd442('0x30')](_0x3b4a57[_0xd442('0x2f')]);_0x1de0c8[_0xd442('0x31')]=_[_0xd442('0x32')](_0x1de0c8[_0xd442('0x33')],_0x1de0c8[_0xd442('0x2f')]);_0x9f7f88['attributes']=_[_0xd442('0x32')](_0x1de0c8[_0xd442('0x33')],qs[_0xd442('0x35')](_0x3b4a57[_0xd442('0x2f')][_0xd442('0x35')]));_0x9f7f88['attributes']=_0x9f7f88[_0xd442('0x34')][_0xd442('0x36')]?_0x9f7f88[_0xd442('0x34')]:_0x1de0c8[_0xd442('0x33')];if(_0x3b4a57['query'][_0xd442('0x3f')]){_0x9f7f88[_0xd442('0x45')]=[{'all':!![]}];}_0x9f7f88=_[_0xd442('0x3d')]({},_0x9f7f88,_0x3b4a57['options']);return db[_0xd442('0x2a')][_0xd442('0x46')](_0x9f7f88)['then'](handleEntityNotFound(_0x5ac786,null))[_0xd442('0x23')](respondWithResult(_0x5ac786,null))[_0xd442('0x41')](handleError(_0x5ac786,null));};exports[_0xd442('0x47')]=function(_0x522df0,_0x55fb96){return db['AnalyticFieldReport'][_0xd442('0x47')](_0x522df0[_0xd442('0x48')],{})[_0xd442('0x23')](respondWithResult(_0x55fb96,0xc9))[_0xd442('0x41')](handleError(_0x55fb96,null));};exports['bulkCreate']=function(_0x5d54d6,_0x3bfce1){return db[_0xd442('0x2a')][_0xd442('0x49')](_0x5d54d6['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3bfce1,0xc9))[_0xd442('0x41')](handleError(_0x3bfce1,null));};exports['update']=function(_0xfc74e3,_0x48fbdb){if(_0xfc74e3[_0xd442('0x48')]['id']){delete _0xfc74e3[_0xd442('0x48')]['id'];}return db[_0xd442('0x2a')][_0xd442('0x46')]({'where':{'id':_0xfc74e3['params']['id']}})[_0xd442('0x23')](handleEntityNotFound(_0x48fbdb,null))[_0xd442('0x23')](saveUpdates(_0xfc74e3[_0xd442('0x48')],null))['then'](respondWithResult(_0x48fbdb,null))[_0xd442('0x41')](handleError(_0x48fbdb,null));};exports[_0xd442('0x24')]=function(_0x115484,_0x595cc8){return db[_0xd442('0x2a')][_0xd442('0x46')]({'where':{'id':_0x115484[_0xd442('0x43')]['id']}})['then'](handleEntityNotFound(_0x595cc8,null))[_0xd442('0x23')](removeEntity(_0x595cc8,null))[_0xd442('0x41')](handleError(_0x595cc8,null));};exports[_0xd442('0x4a')]=function(_0x5b3105,_0x4b1936){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x5b3105[_0xd442('0x2f')][_0xd442('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xd442('0x23')](respondWithResult(_0x4b1936,0xcc))[_0xd442('0x41')](handleError(_0x4b1936,null));};exports[_0xd442('0x4c')]=function(_0x23e6e2,_0x9a029b,_0x5118d7){return db[_0xd442('0x4d')][_0xd442('0x4e')]({'where':{'id':_0x23e6e2['params']['id']}})[_0xd442('0x23')](handleEntityNotFound(_0x9a029b,null))[_0xd442('0x23')](function(_0x23e528){if(_0x23e528){return db['sequelize'][_0xd442('0x4f')](function(_0x8ddc1f){return db[_0xd442('0x2a')][_0xd442('0x24')]({'where':{'CustomReportId':_0x23e6e2[_0xd442('0x43')]['id']},'transaction':_0x8ddc1f})[_0xd442('0x23')](function(_0x45d5e5){var _0x5c21e7=_[_0xd442('0x2e')](_0x23e6e2[_0xd442('0x48')],function(_0x449400){delete _0x449400['id'];_0x449400['CustomReportId']=_0x23e6e2[_0xd442('0x43')]['id'];return _0x449400;});return db[_0xd442('0x2a')][_0xd442('0x49')](_0x5c21e7,{'transaction':_0x8ddc1f});});})[_0xd442('0x23')](function(){return db[_0xd442('0x2a')][_0xd442('0x40')]({'where':{'CustomReportId':_0x23e6e2[_0xd442('0x43')]['id']}});});}})['then'](respondWithResult(_0x9a029b,null))[_0xd442('0x41')](handleError(_0x9a029b,null));}; \ No newline at end of file +var _0x4a39=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','bulkCreate','update','destroy','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','AnalyticFieldReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x1d8aad,_0x1a9bf8){var _0x10751c=function(_0x438db4){while(--_0x438db4){_0x1d8aad['push'](_0x1d8aad['shift']());}};_0x10751c(++_0x1a9bf8);}(_0x4a39,0xd2));var _0x94a3=function(_0x38323c,_0x36f449){_0x38323c=_0x38323c-0x0;var _0x2cdf79=_0x4a39[_0x38323c];return _0x2cdf79;};'use strict';var emlformat=require(_0x94a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94a3('0x1'));var jsonpatch=require(_0x94a3('0x2'));var rp=require(_0x94a3('0x3'));var moment=require(_0x94a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x94a3('0x5'));var util=require(_0x94a3('0x6'));var path=require(_0x94a3('0x7'));var sox=require(_0x94a3('0x8'));var csv=require(_0x94a3('0x9'));var ejs=require(_0x94a3('0xa'));var fs=require('fs');var fs_extra=require(_0x94a3('0xb'));var _=require('lodash');var squel=require(_0x94a3('0xc'));var crypto=require(_0x94a3('0xd'));var jsforce=require(_0x94a3('0xe'));var deskjs=require(_0x94a3('0xf'));var toCsv=require(_0x94a3('0x9'));var querystring=require(_0x94a3('0x10'));var Papa=require(_0x94a3('0x11'));var Redis=require(_0x94a3('0x12'));var authService=require(_0x94a3('0x13'));var qs=require(_0x94a3('0x14'));var as=require(_0x94a3('0x15'));var hardwareService=require(_0x94a3('0x16'));var logger=require(_0x94a3('0x17'))(_0x94a3('0x18'));var utils=require(_0x94a3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x94a3('0x1a'));var db=require(_0x94a3('0x1b'))['db'];function respondWithStatusCode(_0x4acb8d,_0x4b2111){_0x4b2111=_0x4b2111||0xcc;return function(_0xa54a12){if(_0xa54a12){return _0x4acb8d[_0x94a3('0x1c')](_0x4b2111);}return _0x4acb8d[_0x94a3('0x1d')](_0x4b2111)[_0x94a3('0x1e')]();};}function respondWithResult(_0x5b82bf,_0x1614d0){_0x1614d0=_0x1614d0||0xc8;return function(_0x5d2beb){if(_0x5d2beb){return _0x5b82bf[_0x94a3('0x1d')](_0x1614d0)[_0x94a3('0x1f')](_0x5d2beb);}};}function respondWithFilteredResult(_0xee8890,_0x134863){return function(_0x49efa0){if(_0x49efa0){var _0x5cd6bb=typeof _0x134863[_0x94a3('0x20')]===_0x94a3('0x21')&&typeof _0x134863[_0x94a3('0x22')]==='undefined';var _0x5e7e84=_0x49efa0[_0x94a3('0x23')];var _0x1b21c9=_0x5cd6bb?0x0:_0x134863[_0x94a3('0x20')];var _0xdbd4b5=_0x5cd6bb?_0x49efa0['count']:_0x134863['offset']+_0x134863[_0x94a3('0x22')];var _0x438de5;if(_0xdbd4b5>=_0x5e7e84){_0xdbd4b5=_0x5e7e84;_0x438de5=0xc8;}else{_0x438de5=0xce;}_0xee8890[_0x94a3('0x1d')](_0x438de5);return _0xee8890[_0x94a3('0x24')](_0x94a3('0x25'),_0x1b21c9+'-'+_0xdbd4b5+'/'+_0x5e7e84)[_0x94a3('0x1f')](_0x49efa0);}return null;};}function patchUpdates(_0x5d66df){return function(_0x232280){try{jsonpatch[_0x94a3('0x26')](_0x232280,_0x5d66df,!![]);}catch(_0x3e1651){return BPromise[_0x94a3('0x27')](_0x3e1651);}return _0x232280[_0x94a3('0x28')]();};}function saveUpdates(_0x2529c1,_0x4c8017){return function(_0x4b93bd){if(_0x4b93bd){return _0x4b93bd['update'](_0x2529c1)[_0x94a3('0x29')](function(_0x3d4e28){return _0x3d4e28;});}return null;};}function removeEntity(_0x2d30af,_0x22c5d7){return function(_0x2e9f8b){if(_0x2e9f8b){return _0x2e9f8b['destroy']()[_0x94a3('0x29')](function(){_0x2d30af[_0x94a3('0x1d')](0xcc)[_0x94a3('0x1e')]();});}};}function handleEntityNotFound(_0x2028df,_0x30db2c){return function(_0x5c8582){if(!_0x5c8582){_0x2028df['sendStatus'](0x194);}return _0x5c8582;};}function handleError(_0x433d35,_0x1277f4){_0x1277f4=_0x1277f4||0x1f4;return function(_0x187042){logger[_0x94a3('0x2a')](_0x187042[_0x94a3('0x2b')]);if(_0x187042[_0x94a3('0x2c')]){delete _0x187042[_0x94a3('0x2c')];}_0x433d35[_0x94a3('0x1d')](_0x1277f4)[_0x94a3('0x2d')](_0x187042);};}exports[_0x94a3('0x2e')]=function(_0x24f8ce,_0x4fea49){var _0x5f1572={},_0x2b9425={},_0x48a9db={'count':0x0,'rows':[]};var _0xf88343=_['map'](db[_0x94a3('0x2f')]['rawAttributes'],function(_0x4e08c4){return{'name':_0x4e08c4[_0x94a3('0x30')],'type':_0x4e08c4[_0x94a3('0x31')][_0x94a3('0x32')]};});_0x2b9425[_0x94a3('0x33')]=_[_0x94a3('0x34')](_0xf88343,'name');_0x2b9425[_0x94a3('0x35')]=_['keys'](_0x24f8ce[_0x94a3('0x35')]);_0x2b9425[_0x94a3('0x36')]=_[_0x94a3('0x37')](_0x2b9425[_0x94a3('0x33')],_0x2b9425[_0x94a3('0x35')]);_0x5f1572[_0x94a3('0x38')]=_[_0x94a3('0x37')](_0x2b9425[_0x94a3('0x33')],qs[_0x94a3('0x39')](_0x24f8ce[_0x94a3('0x35')]['fields']));_0x5f1572[_0x94a3('0x38')]=_0x5f1572[_0x94a3('0x38')][_0x94a3('0x3a')]?_0x5f1572[_0x94a3('0x38')]:_0x2b9425[_0x94a3('0x33')];if(!_0x24f8ce['query']['hasOwnProperty'](_0x94a3('0x3b'))){_0x5f1572[_0x94a3('0x22')]=qs['limit'](_0x24f8ce[_0x94a3('0x35')][_0x94a3('0x22')]);_0x5f1572['offset']=qs[_0x94a3('0x20')](_0x24f8ce['query'][_0x94a3('0x20')]);}_0x5f1572[_0x94a3('0x3c')]=qs[_0x94a3('0x3d')](_0x24f8ce[_0x94a3('0x35')]['sort']);_0x5f1572[_0x94a3('0x3e')]=qs[_0x94a3('0x36')](_[_0x94a3('0x3f')](_0x24f8ce[_0x94a3('0x35')],_0x2b9425[_0x94a3('0x36')]),_0xf88343);if(_0x24f8ce[_0x94a3('0x35')][_0x94a3('0x40')]){_0x5f1572['where']=_[_0x94a3('0x41')](_0x5f1572[_0x94a3('0x3e')],{'$or':_[_0x94a3('0x34')](_0xf88343,function(_0x15681f){if(_0x15681f[_0x94a3('0x31')]!==_0x94a3('0x42')){var _0x196623={};_0x196623[_0x15681f[_0x94a3('0x2c')]]={'$like':'%'+_0x24f8ce[_0x94a3('0x35')][_0x94a3('0x40')]+'%'};return _0x196623;}})});}_0x5f1572=_['merge']({},_0x5f1572,_0x24f8ce[_0x94a3('0x43')]);var _0x56145c={'where':_0x5f1572[_0x94a3('0x3e')]};return db[_0x94a3('0x2f')][_0x94a3('0x23')](_0x56145c)[_0x94a3('0x29')](function(_0x40ca42){_0x48a9db[_0x94a3('0x23')]=_0x40ca42;if(_0x24f8ce[_0x94a3('0x35')][_0x94a3('0x44')]){_0x5f1572[_0x94a3('0x45')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x5f1572);})[_0x94a3('0x29')](function(_0x1e4d49){_0x48a9db[_0x94a3('0x46')]=_0x1e4d49;return _0x48a9db;})[_0x94a3('0x29')](respondWithFilteredResult(_0x4fea49,_0x5f1572))[_0x94a3('0x47')](handleError(_0x4fea49,null));};exports[_0x94a3('0x48')]=function(_0x2210b4,_0x233086){var _0x22a6b8={'raw':![],'where':{'id':_0x2210b4[_0x94a3('0x49')]['id']}},_0x45533e={};_0x45533e[_0x94a3('0x33')]=_[_0x94a3('0x4a')](db[_0x94a3('0x2f')][_0x94a3('0x4b')]);_0x45533e[_0x94a3('0x35')]=_[_0x94a3('0x4a')](_0x2210b4['query']);_0x45533e[_0x94a3('0x36')]=_[_0x94a3('0x37')](_0x45533e[_0x94a3('0x33')],_0x45533e[_0x94a3('0x35')]);_0x22a6b8['attributes']=_[_0x94a3('0x37')](_0x45533e['model'],qs[_0x94a3('0x39')](_0x2210b4[_0x94a3('0x35')][_0x94a3('0x39')]));_0x22a6b8[_0x94a3('0x38')]=_0x22a6b8['attributes'][_0x94a3('0x3a')]?_0x22a6b8['attributes']:_0x45533e[_0x94a3('0x33')];if(_0x2210b4[_0x94a3('0x35')][_0x94a3('0x44')]){_0x22a6b8[_0x94a3('0x45')]=[{'all':!![]}];}_0x22a6b8=_[_0x94a3('0x41')]({},_0x22a6b8,_0x2210b4[_0x94a3('0x43')]);return db[_0x94a3('0x2f')][_0x94a3('0x4c')](_0x22a6b8)[_0x94a3('0x29')](handleEntityNotFound(_0x233086,null))[_0x94a3('0x29')](respondWithResult(_0x233086,null))['catch'](handleError(_0x233086,null));};exports[_0x94a3('0x4d')]=function(_0x109d47,_0x43be51){return db[_0x94a3('0x2f')][_0x94a3('0x4d')](_0x109d47[_0x94a3('0x4e')],{})['then'](respondWithResult(_0x43be51,0xc9))[_0x94a3('0x47')](handleError(_0x43be51,null));};exports[_0x94a3('0x4f')]=function(_0x5c443e,_0x1a6fa7){return db[_0x94a3('0x2f')][_0x94a3('0x4f')](_0x5c443e[_0x94a3('0x4e')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1a6fa7,0xc9))['catch'](handleError(_0x1a6fa7,null));};exports[_0x94a3('0x50')]=function(_0x4ab18e,_0x59400e){if(_0x4ab18e[_0x94a3('0x4e')]['id']){delete _0x4ab18e['body']['id'];}return db[_0x94a3('0x2f')][_0x94a3('0x4c')]({'where':{'id':_0x4ab18e['params']['id']}})[_0x94a3('0x29')](handleEntityNotFound(_0x59400e,null))['then'](saveUpdates(_0x4ab18e[_0x94a3('0x4e')],null))[_0x94a3('0x29')](respondWithResult(_0x59400e,null))[_0x94a3('0x47')](handleError(_0x59400e,null));};exports[_0x94a3('0x51')]=function(_0x2f4dc7,_0x838f75){return db[_0x94a3('0x2f')]['find']({'where':{'id':_0x2f4dc7[_0x94a3('0x49')]['id']}})[_0x94a3('0x29')](handleEntityNotFound(_0x838f75,null))[_0x94a3('0x29')](removeEntity(_0x838f75,null))['catch'](handleError(_0x838f75,null));};exports[_0x94a3('0x52')]=function(_0x5b530c,_0x3213a){return db[_0x94a3('0x2f')][_0x94a3('0x51')]({'where':{'id':_0x5b530c[_0x94a3('0x35')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3213a,0xcc))['catch'](handleError(_0x3213a,null));};exports[_0x94a3('0x53')]=function(_0x43f569,_0x4a7022,_0x18ead9){return db[_0x94a3('0x54')][_0x94a3('0x55')]({'where':{'id':_0x43f569['params']['id']}})[_0x94a3('0x29')](handleEntityNotFound(_0x4a7022,null))[_0x94a3('0x29')](function(_0x4af9bd){if(_0x4af9bd){return db[_0x94a3('0x56')][_0x94a3('0x57')](function(_0x55a290){return db[_0x94a3('0x2f')]['destroy']({'where':{'CustomReportId':_0x43f569[_0x94a3('0x49')]['id']},'transaction':_0x55a290})[_0x94a3('0x29')](function(_0x417ac2){var _0x18fe38=_[_0x94a3('0x34')](_0x43f569[_0x94a3('0x4e')],function(_0x3b6511){delete _0x3b6511['id'];_0x3b6511[_0x94a3('0x58')]=_0x43f569[_0x94a3('0x49')]['id'];return _0x3b6511;});return db[_0x94a3('0x2f')][_0x94a3('0x4f')](_0x18fe38,{'transaction':_0x55a290});});})['then'](function(){return db[_0x94a3('0x2f')][_0x94a3('0x59')]({'where':{'CustomReportId':_0x43f569[_0x94a3('0x49')]['id']}});});}})[_0x94a3('0x29')](respondWithResult(_0x4a7022,null))[_0x94a3('0x47')](handleError(_0x4a7022,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ef11510..75f7c97 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 _0x39bf=['./analyticFieldReport.attributes','exports','api','moment','request-promise','path','rimraf'];(function(_0x588a6b,_0x59532d){var _0x426d8f=function(_0x50a17e){while(--_0x50a17e){_0x588a6b['push'](_0x588a6b['shift']());}};_0x426d8f(++_0x59532d);}(_0x39bf,0x1bb));var _0xf39b=function(_0x286cdb,_0x4136a1){_0x286cdb=_0x286cdb-0x0;var _0x3297ec=_0x39bf[_0x286cdb];return _0x3297ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf39b('0x0'));var moment=require(_0xf39b('0x1'));var BPromise=require('bluebird');var rp=require(_0xf39b('0x2'));var fs=require('fs');var path=require(_0xf39b('0x3'));var rimraf=require(_0xf39b('0x4'));var config=require('../../config/environment');var attributes=require(_0xf39b('0x5'));module[_0xf39b('0x6')]=function(_0x72af47,_0x32a008){return _0x72af47['define']('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedc0=['../../config/logger','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0xbdd78d,_0x4da511){var _0x1c4047=function(_0x21fb4e){while(--_0x21fb4e){_0xbdd78d['push'](_0xbdd78d['shift']());}};_0x1c4047(++_0x4da511);}(_0xedc0,0x1ad));var _0x0edc=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xedc0[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x0edc('0x0'));var util=require('util');var logger=require(_0x0edc('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0edc('0x2'));var fs=require('fs');var path=require(_0x0edc('0x3'));var rimraf=require(_0x0edc('0x4'));var config=require(_0x0edc('0x5'));var attributes=require(_0x0edc('0x6'));module[_0x0edc('0x7')]=function(_0x27f93f,_0x527933){return _0x27f93f['define'](_0x0edc('0x8'),attributes,{'tableName':_0x0edc('0x9'),'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 85148ab..36e58e6 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 _0x42e3=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x452d65,_0x3eeb98){var _0x1ec273=function(_0x35706c){while(--_0x35706c){_0x452d65['push'](_0x452d65['shift']());}};_0x1ec273(++_0x3eeb98);}(_0x42e3,0x19d));var _0x342e=function(_0x33aa62,_0x4e3bb9){_0x33aa62=_0x33aa62-0x0;var _0x9a4bfe=_0x42e3[_0x33aa62];return _0x9a4bfe;};'use strict';var _=require(_0x342e('0x0'));var util=require('util');var moment=require(_0x342e('0x1'));var BPromise=require(_0x342e('0x2'));var rs=require(_0x342e('0x3'));var fs=require('fs');var Redis=require(_0x342e('0x4'));var db=require(_0x342e('0x5'))['db'];var utils=require(_0x342e('0x6'));var logger=require(_0x342e('0x7'))('rpc');var config=require(_0x342e('0x8'));var jayson=require(_0x342e('0x9'));var client=jayson[_0x342e('0xa')][_0x342e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13bffd,_0x5a7361,_0x1ded10){return new BPromise(function(_0x5b155b,_0xae64b8){return client['request'](_0x13bffd,_0x1ded10)[_0x342e('0xc')](function(_0x3c2f3e){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x5a7361,_0x342e('0xd'));logger[_0x342e('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x5a7361,_0x342e('0xd'),JSON[_0x342e('0xf')](_0x3c2f3e));if(_0x3c2f3e[_0x342e('0x10')]){if(_0x3c2f3e[_0x342e('0x10')][_0x342e('0x11')]===0x1f4){logger['error'](_0x342e('0x12'),_0x5a7361,_0x3c2f3e[_0x342e('0x10')][_0x342e('0x13')]);return _0xae64b8(_0x3c2f3e[_0x342e('0x10')][_0x342e('0x13')]);}logger[_0x342e('0x10')](_0x342e('0x12'),_0x5a7361,_0x3c2f3e[_0x342e('0x10')][_0x342e('0x13')]);return _0x5b155b(_0x3c2f3e[_0x342e('0x10')][_0x342e('0x13')]);}else{logger[_0x342e('0x14')](_0x342e('0x12'),_0x5a7361,'request\x20sent');_0x5b155b(_0x3c2f3e[_0x342e('0x15')][_0x342e('0x13')]);}})[_0x342e('0x16')](function(_0x2cf400){logger[_0x342e('0x10')](_0x342e('0x12'),_0x5a7361,_0x2cf400);_0xae64b8(_0x2cf400);});});} \ No newline at end of file +var _0xb6c0=['message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5606e8,_0x29416b){var _0x3d593d=function(_0x3d6d2b){while(--_0x3d6d2b){_0x5606e8['push'](_0x5606e8['shift']());}};_0x3d593d(++_0x29416b);}(_0xb6c0,0x1a7));var _0x0b6c=function(_0x33f25b,_0x383e27){_0x33f25b=_0x33f25b-0x0;var _0x36c5=_0xb6c0[_0x33f25b];return _0x36c5;};'use strict';var _=require(_0x0b6c('0x0'));var util=require(_0x0b6c('0x1'));var moment=require(_0x0b6c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b6c('0x3'))['db'];var utils=require(_0x0b6c('0x4'));var logger=require('../../config/logger')(_0x0b6c('0x5'));var config=require(_0x0b6c('0x6'));var jayson=require(_0x0b6c('0x7'));var client=jayson['client'][_0x0b6c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12e698,_0x5ada05,_0x674523){return new BPromise(function(_0x5a2949,_0x5bc191){return client[_0x0b6c('0x9')](_0x12e698,_0x674523)['then'](function(_0x40c6fb){logger[_0x0b6c('0xa')](_0x0b6c('0xb'),_0x5ada05,_0x0b6c('0xc'));logger[_0x0b6c('0xd')](_0x0b6c('0xe'),_0x5ada05,_0x0b6c('0xc'),JSON[_0x0b6c('0xf')](_0x40c6fb));if(_0x40c6fb[_0x0b6c('0x10')]){if(_0x40c6fb[_0x0b6c('0x10')][_0x0b6c('0x11')]===0x1f4){logger[_0x0b6c('0x10')](_0x0b6c('0xb'),_0x5ada05,_0x40c6fb[_0x0b6c('0x10')][_0x0b6c('0x12')]);return _0x5bc191(_0x40c6fb[_0x0b6c('0x10')][_0x0b6c('0x12')]);}logger[_0x0b6c('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5ada05,_0x40c6fb[_0x0b6c('0x10')][_0x0b6c('0x12')]);return _0x5a2949(_0x40c6fb[_0x0b6c('0x10')][_0x0b6c('0x12')]);}else{logger[_0x0b6c('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5ada05,_0x0b6c('0xc'));_0x5a2949(_0x40c6fb[_0x0b6c('0x13')][_0x0b6c('0x12')]);}})[_0x0b6c('0x14')](function(_0x52d771){logger[_0x0b6c('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5ada05,_0x52d771);_0x5bc191(_0x52d771);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a5d8b84..13ed381 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(_0x518271,_0x26a69e){var _0x14a527=function(_0x1bddd3){while(--_0x1bddd3){_0x518271['push'](_0x518271['shift']());}};_0x14a527(++_0x26a69e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x16dd69,_0x76c1d3){var _0x55e637=function(_0x5189e5){while(--_0x5189e5){_0x16dd69['push'](_0x16dd69['shift']());}};_0x55e637(++_0x76c1d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 65639f0..1cf50ab 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 _0x720c=['sequelize','STRING','name','TEXT'];(function(_0x22f691,_0x564090){var _0x4f6f29=function(_0x5e7406){while(--_0x5e7406){_0x22f691['push'](_0x22f691['shift']());}};_0x4f6f29(++_0x564090);}(_0x720c,0x154));var _0xc720=function(_0x27fe19,_0x5ec7c3){_0x27fe19=_0x27fe19-0x0;var _0x17cbe4=_0x720c[_0x27fe19];return _0x17cbe4;};'use strict';var Sequelize=require(_0xc720('0x0'));module['exports']={'name':{'type':Sequelize[_0xc720('0x1')],'allowNull':![],'unique':_0xc720('0x2')},'table':{'type':Sequelize[_0xc720('0x1')]},'metric':{'type':Sequelize[_0xc720('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb910=['exports','STRING','name','TEXT','sequelize'];(function(_0x5d5ad6,_0x542852){var _0x2dfbca=function(_0x541f1f){while(--_0x541f1f){_0x5d5ad6['push'](_0x5d5ad6['shift']());}};_0x2dfbca(++_0x542852);}(_0xb910,0x12b));var _0x0b91=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xb910[_0x4a3898];return _0x25ceb0;};'use strict';var Sequelize=require(_0x0b91('0x0'));module[_0x0b91('0x1')]={'name':{'type':Sequelize[_0x0b91('0x2')],'allowNull':![],'unique':_0x0b91('0x3')},'table':{'type':Sequelize[_0x0b91('0x2')]},'metric':{'type':Sequelize[_0x0b91('0x4')]},'description':{'type':Sequelize[_0x0b91('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e1bb70a..317d705 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 _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x3b628a,_0xf0c949){var _0x3b5b5b=function(_0x2753dd){while(--_0x2753dd){_0x3b628a['push'](_0x3b628a['shift']());}};_0x3b5b5b(++_0xf0c949);}(_0x7217,0x19e));var _0x7721=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7217[_0x173d7e];return _0x2220d6;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file +var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x470a3a,_0x195cc3){var _0x4892b3=function(_0x4b0354){while(--_0x4b0354){_0x470a3a['push'](_0x470a3a['shift']());}};_0x4892b3(++_0x195cc3);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x48c1bf,_0x2e76bf){_0x48c1bf=_0x48c1bf-0x0;var _0x3172b7=_0x7fbe[_0x48c1bf];return _0x3172b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 7cbb8ae..08c4c29 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 _0x9505=['request-promise','path','./analyticMetric.attributes','exports','analytics_metrics','lodash','util','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9505,0x1e5));var _0x5950=function(_0x38a21b,_0x241ae1){_0x38a21b=_0x38a21b-0x0;var _0x5ccb93=_0x9505[_0x38a21b];return _0x5ccb93;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var logger=require('../../config/logger')(_0x5950('0x2'));var moment=require(_0x5950('0x3'));var BPromise=require(_0x5950('0x4'));var rp=require(_0x5950('0x5'));var fs=require('fs');var path=require(_0x5950('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5950('0x7'));module[_0x5950('0x8')]=function(_0x3ac153,_0x3a5973){return _0x3ac153['define']('AnalyticMetric',attributes,{'tableName':_0x5950('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c49=['analytics_metrics','lodash','util','moment','request-promise','path','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x7c49,0x141));var _0x97c4=function(_0x1c9b04,_0x2f3641){_0x1c9b04=_0x1c9b04-0x0;var _0x132775=_0x7c49[_0x1c9b04];return _0x132775;};'use strict';var _=require(_0x97c4('0x0'));var util=require(_0x97c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x97c4('0x2'));var BPromise=require('bluebird');var rp=require(_0x97c4('0x3'));var fs=require('fs');var path=require(_0x97c4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x97c4('0x5'));module[_0x97c4('0x6')]=function(_0x2f02ec,_0x538c14){return _0x2f02ec[_0x97c4('0x7')](_0x97c4('0x8'),attributes,{'tableName':_0x97c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index c9a7213..74068ac 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 _0x3bb4=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util'];(function(_0x266524,_0x272708){var _0xc46f73=function(_0xab5540){while(--_0xab5540){_0x266524['push'](_0x266524['shift']());}};_0xc46f73(++_0x272708);}(_0x3bb4,0x7c));var _0x43bb=function(_0xba1634,_0x234e5a){_0xba1634=_0xba1634-0x0;var _0x2cc37e=_0x3bb4[_0xba1634];return _0x2cc37e;};'use strict';var _=require(_0x43bb('0x0'));var util=require(_0x43bb('0x1'));var moment=require(_0x43bb('0x2'));var BPromise=require(_0x43bb('0x3'));var rs=require(_0x43bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43bb('0x5'))['db'];var utils=require(_0x43bb('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x43bb('0x7'));var client=jayson['client'][_0x43bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x208d42,_0x39c41c,_0x3ef2e1){return new BPromise(function(_0x3f818a,_0x30c685){return client['request'](_0x208d42,_0x3ef2e1)[_0x43bb('0x9')](function(_0x26ca3a){logger[_0x43bb('0xa')](_0x43bb('0xb'),_0x39c41c,_0x43bb('0xc'));logger[_0x43bb('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x39c41c,_0x43bb('0xc'),JSON[_0x43bb('0xe')](_0x26ca3a));if(_0x26ca3a[_0x43bb('0xf')]){if(_0x26ca3a[_0x43bb('0xf')]['code']===0x1f4){logger[_0x43bb('0xf')](_0x43bb('0xb'),_0x39c41c,_0x26ca3a[_0x43bb('0xf')]['message']);return _0x30c685(_0x26ca3a['error'][_0x43bb('0x10')]);}logger[_0x43bb('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x39c41c,_0x26ca3a[_0x43bb('0xf')]['message']);return _0x3f818a(_0x26ca3a[_0x43bb('0xf')][_0x43bb('0x10')]);}else{logger[_0x43bb('0xa')](_0x43bb('0xb'),_0x39c41c,_0x43bb('0xc'));_0x3f818a(_0x26ca3a[_0x43bb('0x11')][_0x43bb('0x10')]);}})['catch'](function(_0x18c69e){logger[_0x43bb('0xf')](_0x43bb('0xb'),_0x39c41c,_0x18c69e);_0x30c685(_0x18c69e);});});} \ No newline at end of file +var _0x3231=['debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x3231,0x1b7));var _0x1323=function(_0x2c778f,_0x436c94){_0x2c778f=_0x2c778f-0x0;var _0x43529e=_0x3231[_0x2c778f];return _0x43529e;};'use strict';var _=require(_0x1323('0x0'));var util=require(_0x1323('0x1'));var moment=require(_0x1323('0x2'));var BPromise=require(_0x1323('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1323('0x4'));var db=require(_0x1323('0x5'))['db'];var utils=require(_0x1323('0x6'));var logger=require(_0x1323('0x7'))(_0x1323('0x8'));var config=require(_0x1323('0x9'));var jayson=require(_0x1323('0xa'));var client=jayson[_0x1323('0xb')][_0x1323('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4abf66,_0x1d272a,_0xb1587f){return new BPromise(function(_0x3713a9,_0x57d8d9){return client[_0x1323('0xd')](_0x4abf66,_0xb1587f)[_0x1323('0xe')](function(_0x19c578){logger['info'](_0x1323('0xf'),_0x1d272a,_0x1323('0x10'));logger[_0x1323('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1d272a,_0x1323('0x10'),JSON[_0x1323('0x12')](_0x19c578));if(_0x19c578[_0x1323('0x13')]){if(_0x19c578[_0x1323('0x13')]['code']===0x1f4){logger[_0x1323('0x13')](_0x1323('0xf'),_0x1d272a,_0x19c578[_0x1323('0x13')][_0x1323('0x14')]);return _0x57d8d9(_0x19c578['error']['message']);}logger[_0x1323('0x13')](_0x1323('0xf'),_0x1d272a,_0x19c578['error'][_0x1323('0x14')]);return _0x3713a9(_0x19c578[_0x1323('0x13')][_0x1323('0x14')]);}else{logger[_0x1323('0x15')](_0x1323('0xf'),_0x1d272a,_0x1323('0x10'));_0x3713a9(_0x19c578[_0x1323('0x16')][_0x1323('0x14')]);}})[_0x1323('0x17')](function(_0x50fc97){logger[_0x1323('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x1d272a,_0x50fc97);_0x57d8d9(_0x50fc97);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index bd1ee44..5d5a307 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 _0xe75a=['delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','show','put','update'];(function(_0x790b6,_0x3665cb){var _0x5d048d=function(_0x24f34f){while(--_0x24f34f){_0x790b6['push'](_0x790b6['shift']());}};_0x5d048d(++_0x3665cb);}(_0xe75a,0x1de));var _0xae75=function(_0x2f3b14,_0x554f94){_0x2f3b14=_0x2f3b14-0x0;var _0x20e924=_0xe75a[_0x2f3b14];return _0x20e924;};'use strict';var multer=require(_0xae75('0x0'));var util=require(_0xae75('0x1'));var path=require('path');var timeout=require(_0xae75('0x2'));var express=require(_0xae75('0x3'));var router=express[_0xae75('0x4')]();var fs_extra=require(_0xae75('0x5'));var auth=require(_0xae75('0x6'));var interaction=require(_0xae75('0x7'));var config=require(_0xae75('0x8'));var controller=require(_0xae75('0x9'));router[_0xae75('0xa')]('/',auth[_0xae75('0xb')](),controller['index']);router[_0xae75('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xae75('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xae75('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xae75('0xe')]);router[_0xae75('0xf')]('/:id',auth[_0xae75('0xb')](),controller[_0xae75('0x10')]);module['exports']=router; \ No newline at end of file +var _0x96e0=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','put','delete','exports'];(function(_0x1852e8,_0x4ed6ed){var _0x140fe2=function(_0x44b706){while(--_0x44b706){_0x1852e8['push'](_0x1852e8['shift']());}};_0x140fe2(++_0x4ed6ed);}(_0x96e0,0x7e));var _0x096e=function(_0x3c4a8b,_0x5978eb){_0x3c4a8b=_0x3c4a8b-0x0;var _0x5ea993=_0x96e0[_0x3c4a8b];return _0x5ea993;};'use strict';var multer=require(_0x096e('0x0'));var util=require('util');var path=require(_0x096e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x096e('0x2')]();var fs_extra=require(_0x096e('0x3'));var auth=require(_0x096e('0x4'));var interaction=require(_0x096e('0x5'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x096e('0x6')](),controller[_0x096e('0x7')]);router[_0x096e('0x8')](_0x096e('0x9'),auth[_0x096e('0x6')](),controller[_0x096e('0xa')]);router['post']('/',auth[_0x096e('0x6')](),controller['create']);router[_0x096e('0xb')](_0x096e('0x9'),auth[_0x096e('0x6')](),controller['update']);router[_0x096e('0xc')](_0x096e('0x9'),auth[_0x096e('0x6')](),controller['destroy']);module[_0x096e('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 05a310a..953eb36 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 _0x1c00=['exports','TEXT','sequelize'];(function(_0x2225bd,_0x408388){var _0x5aea56=function(_0x1f0f43){while(--_0x1f0f43){_0x2225bd['push'](_0x2225bd['shift']());}};_0x5aea56(++_0x408388);}(_0x1c00,0x161));var _0x01c0=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x1c00[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x01c0('0x0'));module[_0x01c0('0x1')]={'tree':{'type':Sequelize[_0x01c0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3c10=['exports'];(function(_0x158783,_0x3c08da){var _0x48de1c=function(_0x3e0715){while(--_0x3e0715){_0x158783['push'](_0x158783['shift']());}};_0x48de1c(++_0x3c08da);}(_0x3c10,0x134));var _0x03c1=function(_0x2769e9,_0x5f389c){_0x2769e9=_0x2769e9-0x0;var _0x3682d7=_0x3c10[_0x2769e9];return _0x3682d7;};'use strict';var Sequelize=require('sequelize');module[_0x03c1('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 9a01b09..d1f87e0 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 _0xfb62=['desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','fs-extra','crypto','jsforce'];(function(_0x212c4c,_0x1824b5){var _0x11fa01=function(_0x6090fb){while(--_0x6090fb){_0x212c4c['push'](_0x212c4c['shift']());}};_0x11fa01(++_0x1824b5);}(_0xfb62,0x1ac));var _0x2fb6=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xfb62[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2fb6('0x0'));var zipdir=require(_0x2fb6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fb6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2fb6('0x3'));var util=require(_0x2fb6('0x4'));var path=require('path');var sox=require(_0x2fb6('0x5'));var csv=require('to-csv');var ejs=require(_0x2fb6('0x6'));var fs=require('fs');var fs_extra=require(_0x2fb6('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2fb6('0x8'));var jsforce=require(_0x2fb6('0x9'));var deskjs=require(_0x2fb6('0xa'));var toCsv=require(_0x2fb6('0xb'));var querystring=require('querystring');var Papa=require(_0x2fb6('0xc'));var Redis=require('ioredis');var authService=require(_0x2fb6('0xd'));var qs=require(_0x2fb6('0xe'));var as=require(_0x2fb6('0xf'));var hardwareService=require(_0x2fb6('0x10'));var logger=require(_0x2fb6('0x11'))(_0x2fb6('0x12'));var utils=require('../../config/utils');var config=require(_0x2fb6('0x13'));var licenseUtil=require(_0x2fb6('0x14'));var db=require(_0x2fb6('0x15'))['db'];function respondWithStatusCode(_0xface4e,_0x56d5ce){_0x56d5ce=_0x56d5ce||0xcc;return function(_0x410d47){if(_0x410d47){return _0xface4e[_0x2fb6('0x16')](_0x56d5ce);}return _0xface4e[_0x2fb6('0x17')](_0x56d5ce)[_0x2fb6('0x18')]();};}function respondWithResult(_0x4a9cf7,_0x2ee055){_0x2ee055=_0x2ee055||0xc8;return function(_0x169052){if(_0x169052){return _0x4a9cf7[_0x2fb6('0x17')](_0x2ee055)[_0x2fb6('0x19')](_0x169052);}};}function respondWithFilteredResult(_0xa5475f,_0x3f4981){return function(_0x40736f){if(_0x40736f){var _0x3ae43c=typeof _0x3f4981['offset']===_0x2fb6('0x1a')&&typeof _0x3f4981[_0x2fb6('0x1b')]==='undefined';var _0x1a6397=_0x40736f[_0x2fb6('0x1c')];var _0x5237cf=_0x3ae43c?0x0:_0x3f4981[_0x2fb6('0x1d')];var _0x246cc7=_0x3ae43c?_0x40736f[_0x2fb6('0x1c')]:_0x3f4981[_0x2fb6('0x1d')]+_0x3f4981[_0x2fb6('0x1b')];var _0x539b8e;if(_0x246cc7>=_0x1a6397){_0x246cc7=_0x1a6397;_0x539b8e=0xc8;}else{_0x539b8e=0xce;}_0xa5475f[_0x2fb6('0x17')](_0x539b8e);return _0xa5475f[_0x2fb6('0x1e')](_0x2fb6('0x1f'),_0x5237cf+'-'+_0x246cc7+'/'+_0x1a6397)['json'](_0x40736f);}return null;};}function patchUpdates(_0x4c32b3){return function(_0x4f819a){try{jsonpatch[_0x2fb6('0x20')](_0x4f819a,_0x4c32b3,!![]);}catch(_0x4b9bbd){return BPromise[_0x2fb6('0x21')](_0x4b9bbd);}return _0x4f819a['save']();};}function saveUpdates(_0x57cc2a,_0x3423fb){return function(_0x9e9b97){if(_0x9e9b97){return _0x9e9b97['update'](_0x57cc2a)['then'](function(_0x15fc94){return _0x15fc94;});}return null;};}function removeEntity(_0x43d2c3,_0x463c77){return function(_0x207b42){if(_0x207b42){return _0x207b42[_0x2fb6('0x22')]()[_0x2fb6('0x23')](function(){_0x43d2c3['status'](0xcc)[_0x2fb6('0x18')]();});}};}function handleEntityNotFound(_0x3a19cf,_0x29390c){return function(_0x96f2b5){if(!_0x96f2b5){_0x3a19cf[_0x2fb6('0x16')](0x194);}return _0x96f2b5;};}function handleError(_0x3e0a62,_0x5205be){_0x5205be=_0x5205be||0x1f4;return function(_0x471522){logger['error'](_0x471522[_0x2fb6('0x24')]);if(_0x471522[_0x2fb6('0x25')]){delete _0x471522[_0x2fb6('0x25')];}_0x3e0a62['status'](_0x5205be)['send'](_0x471522);};}exports[_0x2fb6('0x26')]=function(_0x5becb5,_0x5b293c){var _0x5f3254={},_0x2abf96={},_0x3f3049={'count':0x0,'rows':[]};var _0x16b6ef=_[_0x2fb6('0x27')](db[_0x2fb6('0x28')][_0x2fb6('0x29')],function(_0x48b79b){return{'name':_0x48b79b[_0x2fb6('0x2a')],'type':_0x48b79b[_0x2fb6('0x2b')][_0x2fb6('0x2c')]};});_0x2abf96['model']=_[_0x2fb6('0x27')](_0x16b6ef,_0x2fb6('0x25'));_0x2abf96[_0x2fb6('0x2d')]=_[_0x2fb6('0x2e')](_0x5becb5[_0x2fb6('0x2d')]);_0x2abf96[_0x2fb6('0x2f')]=_[_0x2fb6('0x30')](_0x2abf96[_0x2fb6('0x31')],_0x2abf96[_0x2fb6('0x2d')]);_0x5f3254[_0x2fb6('0x32')]=_[_0x2fb6('0x30')](_0x2abf96[_0x2fb6('0x31')],qs['fields'](_0x5becb5['query'][_0x2fb6('0x33')]));_0x5f3254[_0x2fb6('0x32')]=_0x5f3254[_0x2fb6('0x32')][_0x2fb6('0x34')]?_0x5f3254[_0x2fb6('0x32')]:_0x2abf96['model'];if(!_0x5becb5[_0x2fb6('0x2d')][_0x2fb6('0x35')](_0x2fb6('0x36'))){_0x5f3254[_0x2fb6('0x1b')]=qs[_0x2fb6('0x1b')](_0x5becb5['query'][_0x2fb6('0x1b')]);_0x5f3254['offset']=qs[_0x2fb6('0x1d')](_0x5becb5[_0x2fb6('0x2d')][_0x2fb6('0x1d')]);}_0x5f3254['order']=qs[_0x2fb6('0x37')](_0x5becb5[_0x2fb6('0x2d')][_0x2fb6('0x37')]);_0x5f3254[_0x2fb6('0x38')]=qs['filters'](_[_0x2fb6('0x39')](_0x5becb5[_0x2fb6('0x2d')],_0x2abf96[_0x2fb6('0x2f')]),_0x16b6ef);if(_0x5becb5[_0x2fb6('0x2d')][_0x2fb6('0x3a')]){_0x5f3254[_0x2fb6('0x38')]=_['merge'](_0x5f3254[_0x2fb6('0x38')],{'$or':_[_0x2fb6('0x27')](_0x16b6ef,function(_0xfb1776){if(_0xfb1776[_0x2fb6('0x2b')]!==_0x2fb6('0x3b')){var _0x3dfcca={};_0x3dfcca[_0xfb1776[_0x2fb6('0x25')]]={'$like':'%'+_0x5becb5[_0x2fb6('0x2d')]['filter']+'%'};return _0x3dfcca;}})});}_0x5f3254=_[_0x2fb6('0x3c')]({},_0x5f3254,_0x5becb5[_0x2fb6('0x3d')]);var _0x555188={'where':_0x5f3254['where']};return db['AnalyticTreeReport']['count'](_0x555188)[_0x2fb6('0x23')](function(_0x4fc87c){_0x3f3049[_0x2fb6('0x1c')]=_0x4fc87c;if(_0x5becb5[_0x2fb6('0x2d')]['includeAll']){_0x5f3254[_0x2fb6('0x3e')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x2fb6('0x3f')](_0x5f3254);})['then'](function(_0x457ce7){_0x3f3049[_0x2fb6('0x40')]=_0x457ce7;return _0x3f3049;})[_0x2fb6('0x23')](respondWithFilteredResult(_0x5b293c,_0x5f3254))[_0x2fb6('0x41')](handleError(_0x5b293c,null));};exports[_0x2fb6('0x42')]=function(_0x5c4272,_0x402649){var _0x5a0081={'raw':!![],'where':{'id':_0x5c4272[_0x2fb6('0x43')]['id']}},_0x181d37={};_0x181d37[_0x2fb6('0x31')]=_[_0x2fb6('0x2e')](db[_0x2fb6('0x28')][_0x2fb6('0x29')]);_0x181d37[_0x2fb6('0x2d')]=_['keys'](_0x5c4272[_0x2fb6('0x2d')]);_0x181d37[_0x2fb6('0x2f')]=_[_0x2fb6('0x30')](_0x181d37[_0x2fb6('0x31')],_0x181d37[_0x2fb6('0x2d')]);_0x5a0081[_0x2fb6('0x32')]=_[_0x2fb6('0x30')](_0x181d37[_0x2fb6('0x31')],qs[_0x2fb6('0x33')](_0x5c4272[_0x2fb6('0x2d')][_0x2fb6('0x33')]));_0x5a0081[_0x2fb6('0x32')]=_0x5a0081[_0x2fb6('0x32')]['length']?_0x5a0081[_0x2fb6('0x32')]:_0x181d37[_0x2fb6('0x31')];if(_0x5c4272[_0x2fb6('0x2d')][_0x2fb6('0x44')]){_0x5a0081[_0x2fb6('0x3e')]=[{'all':!![]}];}_0x5a0081=_[_0x2fb6('0x3c')]({},_0x5a0081,_0x5c4272['options']);return db[_0x2fb6('0x28')][_0x2fb6('0x45')](_0x5a0081)['then'](handleEntityNotFound(_0x402649,null))[_0x2fb6('0x23')](respondWithResult(_0x402649,null))[_0x2fb6('0x41')](handleError(_0x402649,null));};exports[_0x2fb6('0x46')]=function(_0x10648b,_0x2936f){return db[_0x2fb6('0x28')]['create'](_0x10648b[_0x2fb6('0x47')],{})[_0x2fb6('0x23')](respondWithResult(_0x2936f,0xc9))['catch'](handleError(_0x2936f,null));};exports[_0x2fb6('0x48')]=function(_0x13394f,_0x235696){if(_0x13394f['body']['id']){delete _0x13394f[_0x2fb6('0x47')]['id'];}return db[_0x2fb6('0x28')]['find']({'where':{'id':_0x13394f['params']['id']}})[_0x2fb6('0x23')](handleEntityNotFound(_0x235696,null))[_0x2fb6('0x23')](saveUpdates(_0x13394f['body'],null))['then'](respondWithResult(_0x235696,null))[_0x2fb6('0x41')](handleError(_0x235696,null));};exports[_0x2fb6('0x22')]=function(_0x50ed0c,_0x1eb020){return db[_0x2fb6('0x28')][_0x2fb6('0x45')]({'where':{'id':_0x50ed0c['params']['id']}})[_0x2fb6('0x23')](handleEntityNotFound(_0x1eb020,null))['then'](removeEntity(_0x1eb020,null))[_0x2fb6('0x41')](handleError(_0x1eb020,null));}; \ No newline at end of file +var _0x4117=['create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','AnalyticTreeReport','findAll','rows','show','rawAttributes','find','catch'];(function(_0x41c613,_0xe0d83d){var _0x268d6c=function(_0x393404){while(--_0x393404){_0x41c613['push'](_0x41c613['shift']());}};_0x268d6c(++_0xe0d83d);}(_0x4117,0x1e3));var _0x7411=function(_0x3c0964,_0x48416f){_0x3c0964=_0x3c0964-0x0;var _0x44bb35=_0x4117[_0x3c0964];return _0x44bb35;};'use strict';var emlformat=require(_0x7411('0x0'));var rimraf=require(_0x7411('0x1'));var zipdir=require(_0x7411('0x2'));var jsonpatch=require(_0x7411('0x3'));var rp=require('request-promise');var moment=require(_0x7411('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7411('0x5'));var util=require(_0x7411('0x6'));var path=require(_0x7411('0x7'));var sox=require(_0x7411('0x8'));var csv=require(_0x7411('0x9'));var ejs=require(_0x7411('0xa'));var fs=require('fs');var fs_extra=require(_0x7411('0xb'));var _=require(_0x7411('0xc'));var squel=require('squel');var crypto=require(_0x7411('0xd'));var jsforce=require(_0x7411('0xe'));var deskjs=require(_0x7411('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7411('0x10'));var Redis=require('ioredis');var authService=require(_0x7411('0x11'));var qs=require(_0x7411('0x12'));var as=require(_0x7411('0x13'));var hardwareService=require(_0x7411('0x14'));var logger=require(_0x7411('0x15'))(_0x7411('0x16'));var utils=require(_0x7411('0x17'));var config=require(_0x7411('0x18'));var licenseUtil=require(_0x7411('0x19'));var db=require(_0x7411('0x1a'))['db'];function respondWithStatusCode(_0xa468bc,_0x3f6175){_0x3f6175=_0x3f6175||0xcc;return function(_0x42c161){if(_0x42c161){return _0xa468bc[_0x7411('0x1b')](_0x3f6175);}return _0xa468bc['status'](_0x3f6175)[_0x7411('0x1c')]();};}function respondWithResult(_0x31ffa4,_0x647694){_0x647694=_0x647694||0xc8;return function(_0x4fa8ea){if(_0x4fa8ea){return _0x31ffa4[_0x7411('0x1d')](_0x647694)[_0x7411('0x1e')](_0x4fa8ea);}};}function respondWithFilteredResult(_0x4885e5,_0x9f9811){return function(_0x5793f2){if(_0x5793f2){var _0x4cef7d=typeof _0x9f9811[_0x7411('0x1f')]===_0x7411('0x20')&&typeof _0x9f9811[_0x7411('0x21')]===_0x7411('0x20');var _0x3025ad=_0x5793f2['count'];var _0x488323=_0x4cef7d?0x0:_0x9f9811[_0x7411('0x1f')];var _0x222815=_0x4cef7d?_0x5793f2['count']:_0x9f9811[_0x7411('0x1f')]+_0x9f9811[_0x7411('0x21')];var _0x9efa8c;if(_0x222815>=_0x3025ad){_0x222815=_0x3025ad;_0x9efa8c=0xc8;}else{_0x9efa8c=0xce;}_0x4885e5[_0x7411('0x1d')](_0x9efa8c);return _0x4885e5[_0x7411('0x22')](_0x7411('0x23'),_0x488323+'-'+_0x222815+'/'+_0x3025ad)[_0x7411('0x1e')](_0x5793f2);}return null;};}function patchUpdates(_0x584d2f){return function(_0x1e6b06){try{jsonpatch[_0x7411('0x24')](_0x1e6b06,_0x584d2f,!![]);}catch(_0x16a0ac){return BPromise[_0x7411('0x25')](_0x16a0ac);}return _0x1e6b06[_0x7411('0x26')]();};}function saveUpdates(_0x3a06e2,_0x3a4fb7){return function(_0x43ad85){if(_0x43ad85){return _0x43ad85[_0x7411('0x27')](_0x3a06e2)['then'](function(_0x43df8a){return _0x43df8a;});}return null;};}function removeEntity(_0x3c574a,_0x2ab1e5){return function(_0x42c028){if(_0x42c028){return _0x42c028[_0x7411('0x28')]()[_0x7411('0x29')](function(){_0x3c574a[_0x7411('0x1d')](0xcc)[_0x7411('0x1c')]();});}};}function handleEntityNotFound(_0x52f14e,_0x308581){return function(_0x2d48af){if(!_0x2d48af){_0x52f14e[_0x7411('0x1b')](0x194);}return _0x2d48af;};}function handleError(_0x15bf80,_0x300d64){_0x300d64=_0x300d64||0x1f4;return function(_0x140b1f){logger[_0x7411('0x2a')](_0x140b1f[_0x7411('0x2b')]);if(_0x140b1f[_0x7411('0x2c')]){delete _0x140b1f[_0x7411('0x2c')];}_0x15bf80['status'](_0x300d64)['send'](_0x140b1f);};}exports[_0x7411('0x2d')]=function(_0xe78d23,_0x822891){var _0x50b466={},_0x356476={},_0x18f236={'count':0x0,'rows':[]};var _0x12fb31=_[_0x7411('0x2e')](db['AnalyticTreeReport']['rawAttributes'],function(_0x22a173){return{'name':_0x22a173[_0x7411('0x2f')],'type':_0x22a173[_0x7411('0x30')][_0x7411('0x31')]};});_0x356476[_0x7411('0x32')]=_[_0x7411('0x2e')](_0x12fb31,_0x7411('0x2c'));_0x356476[_0x7411('0x33')]=_[_0x7411('0x34')](_0xe78d23[_0x7411('0x33')]);_0x356476[_0x7411('0x35')]=_['intersection'](_0x356476[_0x7411('0x32')],_0x356476[_0x7411('0x33')]);_0x50b466['attributes']=_[_0x7411('0x36')](_0x356476[_0x7411('0x32')],qs[_0x7411('0x37')](_0xe78d23[_0x7411('0x33')][_0x7411('0x37')]));_0x50b466[_0x7411('0x38')]=_0x50b466[_0x7411('0x38')][_0x7411('0x39')]?_0x50b466['attributes']:_0x356476['model'];if(!_0xe78d23[_0x7411('0x33')][_0x7411('0x3a')](_0x7411('0x3b'))){_0x50b466['limit']=qs['limit'](_0xe78d23[_0x7411('0x33')]['limit']);_0x50b466[_0x7411('0x1f')]=qs['offset'](_0xe78d23[_0x7411('0x33')][_0x7411('0x1f')]);}_0x50b466[_0x7411('0x3c')]=qs['sort'](_0xe78d23[_0x7411('0x33')][_0x7411('0x3d')]);_0x50b466[_0x7411('0x3e')]=qs[_0x7411('0x35')](_[_0x7411('0x3f')](_0xe78d23[_0x7411('0x33')],_0x356476[_0x7411('0x35')]),_0x12fb31);if(_0xe78d23[_0x7411('0x33')][_0x7411('0x40')]){_0x50b466[_0x7411('0x3e')]=_['merge'](_0x50b466['where'],{'$or':_['map'](_0x12fb31,function(_0x5c0530){if(_0x5c0530['type']!=='VIRTUAL'){var _0x2f1487={};_0x2f1487[_0x5c0530[_0x7411('0x2c')]]={'$like':'%'+_0xe78d23[_0x7411('0x33')]['filter']+'%'};return _0x2f1487;}})});}_0x50b466=_[_0x7411('0x41')]({},_0x50b466,_0xe78d23[_0x7411('0x42')]);var _0x58027a={'where':_0x50b466[_0x7411('0x3e')]};return db['AnalyticTreeReport']['count'](_0x58027a)[_0x7411('0x29')](function(_0x55fb67){_0x18f236[_0x7411('0x43')]=_0x55fb67;if(_0xe78d23[_0x7411('0x33')][_0x7411('0x44')]){_0x50b466[_0x7411('0x45')]=[{'all':!![]}];}return db[_0x7411('0x46')][_0x7411('0x47')](_0x50b466);})['then'](function(_0x4e29e1){_0x18f236[_0x7411('0x48')]=_0x4e29e1;return _0x18f236;})[_0x7411('0x29')](respondWithFilteredResult(_0x822891,_0x50b466))['catch'](handleError(_0x822891,null));};exports[_0x7411('0x49')]=function(_0x4c2ae4,_0x4f95f6){var _0x2e9ddb={'raw':!![],'where':{'id':_0x4c2ae4['params']['id']}},_0x5767b6={};_0x5767b6[_0x7411('0x32')]=_[_0x7411('0x34')](db[_0x7411('0x46')][_0x7411('0x4a')]);_0x5767b6[_0x7411('0x33')]=_[_0x7411('0x34')](_0x4c2ae4['query']);_0x5767b6[_0x7411('0x35')]=_[_0x7411('0x36')](_0x5767b6[_0x7411('0x32')],_0x5767b6[_0x7411('0x33')]);_0x2e9ddb[_0x7411('0x38')]=_[_0x7411('0x36')](_0x5767b6[_0x7411('0x32')],qs['fields'](_0x4c2ae4['query']['fields']));_0x2e9ddb['attributes']=_0x2e9ddb[_0x7411('0x38')][_0x7411('0x39')]?_0x2e9ddb[_0x7411('0x38')]:_0x5767b6[_0x7411('0x32')];if(_0x4c2ae4[_0x7411('0x33')]['includeAll']){_0x2e9ddb[_0x7411('0x45')]=[{'all':!![]}];}_0x2e9ddb=_[_0x7411('0x41')]({},_0x2e9ddb,_0x4c2ae4['options']);return db[_0x7411('0x46')][_0x7411('0x4b')](_0x2e9ddb)[_0x7411('0x29')](handleEntityNotFound(_0x4f95f6,null))[_0x7411('0x29')](respondWithResult(_0x4f95f6,null))[_0x7411('0x4c')](handleError(_0x4f95f6,null));};exports[_0x7411('0x4d')]=function(_0x56ce6c,_0x67f03e){return db[_0x7411('0x46')][_0x7411('0x4d')](_0x56ce6c[_0x7411('0x4e')],{})[_0x7411('0x29')](respondWithResult(_0x67f03e,0xc9))[_0x7411('0x4c')](handleError(_0x67f03e,null));};exports[_0x7411('0x27')]=function(_0x1569f1,_0x2c0e65){if(_0x1569f1['body']['id']){delete _0x1569f1['body']['id'];}return db[_0x7411('0x46')][_0x7411('0x4b')]({'where':{'id':_0x1569f1[_0x7411('0x4f')]['id']}})[_0x7411('0x29')](handleEntityNotFound(_0x2c0e65,null))['then'](saveUpdates(_0x1569f1[_0x7411('0x4e')],null))[_0x7411('0x29')](respondWithResult(_0x2c0e65,null))[_0x7411('0x4c')](handleError(_0x2c0e65,null));};exports['destroy']=function(_0x1495b0,_0x21c606){return db[_0x7411('0x46')][_0x7411('0x4b')]({'where':{'id':_0x1495b0[_0x7411('0x4f')]['id']}})[_0x7411('0x29')](handleEntityNotFound(_0x21c606,null))['then'](removeEntity(_0x21c606,null))[_0x7411('0x4c')](handleError(_0x21c606,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 6e34d44..291f5cd 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 _0xff4c=['../../config/logger','moment','request-promise','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util'];(function(_0x50dcd2,_0x28697b){var _0xb37e63=function(_0x24758c){while(--_0x24758c){_0x50dcd2['push'](_0x50dcd2['shift']());}};_0xb37e63(++_0x28697b);}(_0xff4c,0x1db));var _0xcff4=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0xff4c[_0x188703];return _0x1a0c81;};'use strict';var _=require(_0xcff4('0x0'));var util=require(_0xcff4('0x1'));var logger=require(_0xcff4('0x2'))('api');var moment=require(_0xcff4('0x3'));var BPromise=require('bluebird');var rp=require(_0xcff4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcff4('0x5'));module[_0xcff4('0x6')]=function(_0x2efbb3,_0xea4f6a){return _0x2efbb3[_0xcff4('0x7')](_0xcff4('0x8'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2f5=['exports','define','AnalyticTreeReport','lodash','moment','request-promise','path','rimraf'];(function(_0x3ca4da,_0x3d9e46){var _0xdfcc96=function(_0x4acc19){while(--_0x4acc19){_0x3ca4da['push'](_0x3ca4da['shift']());}};_0xdfcc96(++_0x3d9e46);}(_0xc2f5,0xc3));var _0x5c2f=function(_0x12c589,_0x370e25){_0x12c589=_0x12c589-0x0;var _0x5e1e22=_0xc2f5[_0x12c589];return _0x5e1e22;};'use strict';var _=require(_0x5c2f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5c2f('0x1'));var BPromise=require('bluebird');var rp=require(_0x5c2f('0x2'));var fs=require('fs');var path=require(_0x5c2f('0x3'));var rimraf=require(_0x5c2f('0x4'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x5c2f('0x5')]=function(_0xd8407,_0x1cca21){return _0xd8407[_0x5c2f('0x6')](_0x5c2f('0x7'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 5247c01..3426fc9 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x3112e0,_0x3e59c7){var _0x425881=function(_0x535a9a){while(--_0x535a9a){_0x3112e0['push'](_0x3112e0['shift']());}};_0x425881(++_0x3e59c7);}(_0x1261,0x144));var _0x1126=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0x1261[_0x32bb6b];return _0x58dcb4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x32b09a,_0x426696){var _0x1a543e=function(_0xf8e0c){while(--_0xf8e0c){_0x32b09a['push'](_0x32b09a['shift']());}};_0x1a543e(++_0x426696);}(_0x2ef3,0xba));var _0x32ef=function(_0x962905,_0x3cb28d){_0x962905=_0x962905-0x0;var _0x27e3f6=_0x2ef3[_0x962905];return _0x27e3f6;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 734bc4a..864691f 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 _0x1b0c=['/:id','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','show','put'];(function(_0x486d3d,_0x39c2fb){var _0x39ee60=function(_0x147eee){while(--_0x147eee){_0x486d3d['push'](_0x486d3d['shift']());}};_0x39ee60(++_0x39c2fb);}(_0x1b0c,0xd4));var _0xc1b0=function(_0x31adf9,_0x511868){_0x31adf9=_0x31adf9-0x0;var _0x4412b5=_0x1b0c[_0x31adf9];return _0x4412b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc1b0('0x0'));var timeout=require(_0xc1b0('0x1'));var express=require(_0xc1b0('0x2'));var router=express[_0xc1b0('0x3')]();var fs_extra=require(_0xc1b0('0x4'));var auth=require(_0xc1b0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc1b0('0x6'));var controller=require(_0xc1b0('0x7'));router[_0xc1b0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc1b0('0x8')]('/:id',auth[_0xc1b0('0x9')](),controller[_0xc1b0('0xa')]);router['post']('/',auth[_0xc1b0('0x9')](),controller['create']);router[_0xc1b0('0xb')](_0xc1b0('0xc'),auth['isAuthenticated'](),controller[_0xc1b0('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc1b0('0xe')]);module[_0xc1b0('0xf')]=router; \ No newline at end of file +var _0x9c7a=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','put','delete'];(function(_0x257e64,_0x4f42ce){var _0x1c991d=function(_0x799b94){while(--_0x799b94){_0x257e64['push'](_0x257e64['shift']());}};_0x1c991d(++_0x4f42ce);}(_0x9c7a,0x158));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa9c7('0x0'));var util=require(_0xa9c7('0x1'));var path=require(_0xa9c7('0x2'));var timeout=require(_0xa9c7('0x3'));var express=require('express');var router=express[_0xa9c7('0x4')]();var fs_extra=require(_0xa9c7('0x5'));var auth=require(_0xa9c7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa9c7('0x7'));router[_0xa9c7('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c7('0x9')]);router[_0xa9c7('0x8')](_0xa9c7('0xa'),auth[_0xa9c7('0xb')](),controller[_0xa9c7('0xc')]);router[_0xa9c7('0xd')]('/',auth[_0xa9c7('0xb')](),controller['create']);router[_0xa9c7('0xe')](_0xa9c7('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xa9c7('0xf')]('/:id',auth[_0xa9c7('0xb')](),controller[_0xa9c7('0x10')]);module[_0xa9c7('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 5320354..488ba2b 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 _0x8ccb=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x8ccb[_0x3792e6];return _0x441e44;};'use strict';var Sequelize=require(_0xb8cc('0x0'));module[_0xb8cc('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xb8cc('0x2')]},'type':{'type':Sequelize[_0xb8cc('0x2')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','sequelize'];(function(_0x65f5e8,_0x5b7c27){var _0x48c40a=function(_0x31570f){while(--_0x31570f){_0x65f5e8['push'](_0x65f5e8['shift']());}};_0x48c40a(++_0x5b7c27);}(_0xa41a,0x6b));var _0xaa41=function(_0x296d5a,_0x450ef2){_0x296d5a=_0x296d5a-0x0;var _0x5e859c=_0xa41a[_0x296d5a];return _0x5e859c;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xaa41('0x2')]},'type':{'type':Sequelize[_0xaa41('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5de6690..d4e1a64 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 _0xa28a=['map','Attachment','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','show','includeAll','find','catch','clone','params','rawAttributes','updatedAt','omit','body','createdAt','create','file','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','eml-format','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','update','then','destroy','error','name','send','index'];(function(_0x3e43d6,_0x27116c){var _0x47086f=function(_0x385dd4){while(--_0x385dd4){_0x3e43d6['push'](_0x3e43d6['shift']());}};_0x47086f(++_0x27116c);}(_0xa28a,0x126));var _0xaa28=function(_0x4c1f9c,_0x49d2fc){_0x4c1f9c=_0x4c1f9c-0x0;var _0x2d3c4e=_0xa28a[_0x4c1f9c];return _0x2d3c4e;};'use strict';var emlformat=require(_0xaa28('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaa28('0x1'));var moment=require(_0xaa28('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xaa28('0x3'));var util=require(_0xaa28('0x4'));var path=require(_0xaa28('0x5'));var sox=require(_0xaa28('0x6'));var csv=require('to-csv');var ejs=require(_0xaa28('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa28('0x8'));var squel=require(_0xaa28('0x9'));var crypto=require(_0xaa28('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaa28('0xb'));var toCsv=require(_0xaa28('0xc'));var querystring=require(_0xaa28('0xd'));var Papa=require('papaparse');var Redis=require(_0xaa28('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa28('0xf'));var hardwareService=require(_0xaa28('0x10'));var logger=require(_0xaa28('0x11'))('api');var utils=require(_0xaa28('0x12'));var config=require(_0xaa28('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa28('0x14'))['db'];function respondWithStatusCode(_0x4835be,_0x149fe8){_0x149fe8=_0x149fe8||0xcc;return function(_0x293d1c){if(_0x293d1c){return _0x4835be[_0xaa28('0x15')](_0x149fe8);}return _0x4835be['status'](_0x149fe8)[_0xaa28('0x16')]();};}function respondWithResult(_0x5238bc,_0x271f7d){_0x271f7d=_0x271f7d||0xc8;return function(_0x5316d7){if(_0x5316d7){return _0x5238bc[_0xaa28('0x17')](_0x271f7d)[_0xaa28('0x18')](_0x5316d7);}};}function respondWithFilteredResult(_0x42d87c,_0x2860dc){return function(_0x59fd89){if(_0x59fd89){var _0xd42605=typeof _0x2860dc[_0xaa28('0x19')]==='undefined'&&typeof _0x2860dc[_0xaa28('0x1a')]==='undefined';var _0x1a4f19=_0x59fd89[_0xaa28('0x1b')];var _0x204928=_0xd42605?0x0:_0x2860dc['offset'];var _0x3e95f9=_0xd42605?_0x59fd89[_0xaa28('0x1b')]:_0x2860dc[_0xaa28('0x19')]+_0x2860dc[_0xaa28('0x1a')];var _0x3a1535;if(_0x3e95f9>=_0x1a4f19){_0x3e95f9=_0x1a4f19;_0x3a1535=0xc8;}else{_0x3a1535=0xce;}_0x42d87c[_0xaa28('0x17')](_0x3a1535);return _0x42d87c[_0xaa28('0x1c')](_0xaa28('0x1d'),_0x204928+'-'+_0x3e95f9+'/'+_0x1a4f19)[_0xaa28('0x18')](_0x59fd89);}return null;};}function patchUpdates(_0x553768){return function(_0x3e3c36){try{jsonpatch['apply'](_0x3e3c36,_0x553768,!![]);}catch(_0x461eae){return BPromise[_0xaa28('0x1e')](_0x461eae);}return _0x3e3c36['save']();};}function saveUpdates(_0x2b5dfc,_0x2ee005){return function(_0x11f4e5){if(_0x11f4e5){return _0x11f4e5[_0xaa28('0x1f')](_0x2b5dfc)[_0xaa28('0x20')](function(_0xc59145){return _0xc59145;});}return null;};}function removeEntity(_0x26c97d,_0x3e87f7){return function(_0x3e906d){if(_0x3e906d){return _0x3e906d[_0xaa28('0x21')]()[_0xaa28('0x20')](function(){_0x26c97d['status'](0xcc)[_0xaa28('0x16')]();});}};}function handleEntityNotFound(_0xf669dd,_0x15d162){return function(_0x5799ea){if(!_0x5799ea){_0xf669dd['sendStatus'](0x194);}return _0x5799ea;};}function handleError(_0xded4d6,_0x18ceef){_0x18ceef=_0x18ceef||0x1f4;return function(_0x9534bc){logger[_0xaa28('0x22')](_0x9534bc['stack']);if(_0x9534bc[_0xaa28('0x23')]){delete _0x9534bc[_0xaa28('0x23')];}_0xded4d6[_0xaa28('0x17')](_0x18ceef)[_0xaa28('0x24')](_0x9534bc);};}exports[_0xaa28('0x25')]=function(_0x25e652,_0x5e0260){var _0xbe594e={},_0x4dde1b={},_0x419c8f={'count':0x0,'rows':[]};var _0x3c2e3a=_[_0xaa28('0x26')](db[_0xaa28('0x27')]['rawAttributes'],function(_0x41d358){return{'name':_0x41d358[_0xaa28('0x28')],'type':_0x41d358[_0xaa28('0x29')][_0xaa28('0x2a')]};});_0x4dde1b[_0xaa28('0x2b')]=_[_0xaa28('0x26')](_0x3c2e3a,_0xaa28('0x23'));_0x4dde1b['query']=_[_0xaa28('0x2c')](_0x25e652[_0xaa28('0x2d')]);_0x4dde1b['filters']=_[_0xaa28('0x2e')](_0x4dde1b['model'],_0x4dde1b[_0xaa28('0x2d')]);_0xbe594e[_0xaa28('0x2f')]=_['intersection'](_0x4dde1b['model'],qs['fields'](_0x25e652[_0xaa28('0x2d')][_0xaa28('0x30')]));_0xbe594e[_0xaa28('0x2f')]=_0xbe594e[_0xaa28('0x2f')][_0xaa28('0x31')]?_0xbe594e[_0xaa28('0x2f')]:_0x4dde1b[_0xaa28('0x2b')];if(!_0x25e652[_0xaa28('0x2d')][_0xaa28('0x32')]('nolimit')){_0xbe594e[_0xaa28('0x1a')]=qs[_0xaa28('0x1a')](_0x25e652['query'][_0xaa28('0x1a')]);_0xbe594e[_0xaa28('0x19')]=qs[_0xaa28('0x19')](_0x25e652['query']['offset']);}_0xbe594e[_0xaa28('0x33')]=qs[_0xaa28('0x34')](_0x25e652[_0xaa28('0x2d')][_0xaa28('0x34')]);_0xbe594e[_0xaa28('0x35')]=qs[_0xaa28('0x36')](_[_0xaa28('0x37')](_0x25e652[_0xaa28('0x2d')],_0x4dde1b[_0xaa28('0x36')]),_0x3c2e3a);if(_0x25e652[_0xaa28('0x2d')][_0xaa28('0x38')]){_0xbe594e['where']=_['merge'](_0xbe594e[_0xaa28('0x35')],{'$or':_['map'](_0x3c2e3a,function(_0x32cdad){if(_0x32cdad['type']!==_0xaa28('0x39')){var _0x31c563={};_0x31c563[_0x32cdad[_0xaa28('0x23')]]={'$like':'%'+_0x25e652['query'][_0xaa28('0x38')]+'%'};return _0x31c563;}})});}_0xbe594e=_[_0xaa28('0x3a')]({},_0xbe594e,_0x25e652[_0xaa28('0x3b')]);var _0x3d97fc={'where':_0xbe594e[_0xaa28('0x35')]};return db[_0xaa28('0x27')]['count'](_0x3d97fc)[_0xaa28('0x20')](function(_0x43e6eb){_0x419c8f[_0xaa28('0x1b')]=_0x43e6eb;if(_0x25e652[_0xaa28('0x2d')]['includeAll']){_0xbe594e[_0xaa28('0x3c')]=[{'all':!![]}];}return db[_0xaa28('0x27')][_0xaa28('0x3d')](_0xbe594e);})[_0xaa28('0x20')](function(_0x127cbd){_0x419c8f['rows']=_0x127cbd;return _0x419c8f;})[_0xaa28('0x20')](respondWithFilteredResult(_0x5e0260,_0xbe594e))['catch'](handleError(_0x5e0260,null));};exports[_0xaa28('0x3e')]=function(_0x3a1957,_0x53558e){var _0x111b9a={'raw':!![],'where':{'id':_0x3a1957['params']['id']}},_0x4be68a={};_0x4be68a['model']=_[_0xaa28('0x2c')](db[_0xaa28('0x27')]['rawAttributes']);_0x4be68a[_0xaa28('0x2d')]=_['keys'](_0x3a1957[_0xaa28('0x2d')]);_0x4be68a['filters']=_[_0xaa28('0x2e')](_0x4be68a[_0xaa28('0x2b')],_0x4be68a[_0xaa28('0x2d')]);_0x111b9a[_0xaa28('0x2f')]=_[_0xaa28('0x2e')](_0x4be68a[_0xaa28('0x2b')],qs[_0xaa28('0x30')](_0x3a1957[_0xaa28('0x2d')]['fields']));_0x111b9a['attributes']=_0x111b9a[_0xaa28('0x2f')]['length']?_0x111b9a['attributes']:_0x4be68a[_0xaa28('0x2b')];if(_0x3a1957[_0xaa28('0x2d')][_0xaa28('0x3f')]){_0x111b9a['include']=[{'all':!![]}];}_0x111b9a=_[_0xaa28('0x3a')]({},_0x111b9a,_0x3a1957[_0xaa28('0x3b')]);return db[_0xaa28('0x27')][_0xaa28('0x40')](_0x111b9a)[_0xaa28('0x20')](handleEntityNotFound(_0x53558e,null))[_0xaa28('0x20')](respondWithResult(_0x53558e,null))[_0xaa28('0x41')](handleError(_0x53558e,null));};exports[_0xaa28('0x42')]=function(_0x164ec3,_0x3fce63){var _0x1493b0={'where':{'id':_0x164ec3[_0xaa28('0x43')]['id']}},_0x556aa1={};_0x556aa1[_0xaa28('0x2b')]=_[_0xaa28('0x2c')](db[_0xaa28('0x27')][_0xaa28('0x44')]);_0x1493b0['attributes']=_[_0xaa28('0x2e')](_0x556aa1[_0xaa28('0x2b')],qs[_0xaa28('0x30')](_0x164ec3['query'][_0xaa28('0x30')]));_0x1493b0[_0xaa28('0x2f')]=_0x1493b0['attributes'][_0xaa28('0x31')]?_0x1493b0[_0xaa28('0x2f')]:_0x556aa1[_0xaa28('0x2b')];if(_0x164ec3['query'][_0xaa28('0x3f')]){_0x1493b0[_0xaa28('0x3c')]=[{'all':!![]}];}_0x1493b0=_[_0xaa28('0x3a')]({},_0x1493b0,_0x164ec3[_0xaa28('0x3b')]);return db[_0xaa28('0x27')][_0xaa28('0x40')](_0x1493b0)['then'](handleEntityNotFound(_0x3fce63,null))[_0xaa28('0x20')](function(_0x123607){if(_0x123607){var _0x3ac121=_0x123607['get']({'plain':!![]});_0x3ac121=qs['omit'](_0x3ac121,['id','createdAt',_0xaa28('0x45')]);_0x164ec3['body']=_[_0xaa28('0x46')](_0x164ec3[_0xaa28('0x47')],['id',_0xaa28('0x48'),'updatedAt']);return db[_0xaa28('0x27')][_0xaa28('0x49')](_[_0xaa28('0x3a')](_0x3ac121,_0x164ec3[_0xaa28('0x47')]),{'include':_0x164ec3[_0xaa28('0x2d')][_0xaa28('0x3f')]?[{'all':!![]}]:undefined});}})[_0xaa28('0x20')](respondWithResult(_0x3fce63,0xc9))[_0xaa28('0x41')](handleError(_0x3fce63,null));};exports[_0xaa28('0x1f')]=function(_0x4fa4d9,_0x2550b4){if(_0x4fa4d9[_0xaa28('0x47')]['id']){delete _0x4fa4d9[_0xaa28('0x47')]['id'];}return db[_0xaa28('0x27')][_0xaa28('0x40')]({'where':{'id':_0x4fa4d9[_0xaa28('0x43')]['id']}})[_0xaa28('0x20')](handleEntityNotFound(_0x2550b4,null))['then'](saveUpdates(_0x4fa4d9[_0xaa28('0x47')],null))[_0xaa28('0x20')](respondWithResult(_0x2550b4,null))[_0xaa28('0x41')](handleError(_0x2550b4,null));};exports[_0xaa28('0x21')]=function(_0xadc86f,_0x549c82){return db[_0xaa28('0x27')]['find']({'where':{'id':_0xadc86f['params']['id']}})[_0xaa28('0x20')](handleEntityNotFound(_0x549c82,null))[_0xaa28('0x20')](removeEntity(_0x549c82,null))[_0xaa28('0x41')](handleError(_0x549c82,null));};exports[_0xaa28('0x49')]=function(_0x1c78e0,_0x584c5d,_0x54a0f6){_0x1c78e0[_0xaa28('0x47')]['name']=_0x1c78e0[_0xaa28('0x4a')]['originalname'];_0x1c78e0[_0xaa28('0x47')][_0xaa28('0x4b')]=_0x1c78e0['file']['filename'];_0x1c78e0[_0xaa28('0x47')][_0xaa28('0x29')]=_0x1c78e0[_0xaa28('0x4a')][_0xaa28('0x4c')];return db[_0xaa28('0x27')][_0xaa28('0x49')](_0x1c78e0['body'])[_0xaa28('0x20')](respondWithResult(_0x584c5d,0xc9))[_0xaa28('0x41')](handleError(_0x584c5d,null));};exports[_0xaa28('0x4d')]=function(_0x5a5d94,_0x3ab349,_0x10ac1f){return db['Attachment'][_0xaa28('0x4e')]({'where':{'id':_0x5a5d94[_0xaa28('0x43')]['id']},'raw':!![]})[_0xaa28('0x20')](handleEntityNotFound(_0x3ab349,null))['then'](function(_0x2b608a){if(_0x2b608a){var _0xa0a753=_0x2b608a[_0xaa28('0x4f')]!==null;var _0x2b2e9a=path[_0xaa28('0x50')](config[_0xaa28('0x51')],'server/files/attachments/');if(_0xa0a753){_0x2b2e9a=path[_0xaa28('0x50')](_0x2b2e9a,_0xaa28('0x52'));}var _0x109281=path[_0xaa28('0x50')](_0x2b2e9a,_0x2b608a[_0xaa28('0x4b')]);return _0x3ab349[_0xaa28('0x4d')](_0x109281);}})['catch'](handleError(_0x3ab349,null));}; \ No newline at end of file +var _0x4155=['omit','createdAt','updatedAt','body','includeAll','update','destroy','create','file','originalname','mimetype','ChatOfflineMessageId','join','root','basename','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','options','findAll','rows','catch','params','keys','include','find','clone','get'];(function(_0x1a58a0,_0x468ab9){var _0x1409e9=function(_0x1934ff){while(--_0x1934ff){_0x1a58a0['push'](_0x1a58a0['shift']());}};_0x1409e9(++_0x468ab9);}(_0x4155,0xc3));var _0x5415=function(_0x65fd2e,_0x13f345){_0x65fd2e=_0x65fd2e-0x0;var _0x19f91f=_0x4155[_0x65fd2e];return _0x19f91f;};'use strict';var emlformat=require(_0x5415('0x0'));var rimraf=require(_0x5415('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5415('0x2'));var rp=require(_0x5415('0x3'));var moment=require(_0x5415('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5415('0x5'));var util=require(_0x5415('0x6'));var path=require(_0x5415('0x7'));var sox=require(_0x5415('0x8'));var csv=require(_0x5415('0x9'));var ejs=require(_0x5415('0xa'));var fs=require('fs');var fs_extra=require(_0x5415('0xb'));var _=require(_0x5415('0xc'));var squel=require(_0x5415('0xd'));var crypto=require(_0x5415('0xe'));var jsforce=require(_0x5415('0xf'));var deskjs=require(_0x5415('0x10'));var toCsv=require(_0x5415('0x9'));var querystring=require(_0x5415('0x11'));var Papa=require(_0x5415('0x12'));var Redis=require(_0x5415('0x13'));var authService=require(_0x5415('0x14'));var qs=require(_0x5415('0x15'));var as=require(_0x5415('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5415('0x17'));var utils=require(_0x5415('0x18'));var config=require(_0x5415('0x19'));var licenseUtil=require(_0x5415('0x1a'));var db=require(_0x5415('0x1b'))['db'];function respondWithStatusCode(_0x16a103,_0x1a23d1){_0x1a23d1=_0x1a23d1||0xcc;return function(_0x558ab5){if(_0x558ab5){return _0x16a103['sendStatus'](_0x1a23d1);}return _0x16a103[_0x5415('0x1c')](_0x1a23d1)[_0x5415('0x1d')]();};}function respondWithResult(_0x1e53eb,_0x37de59){_0x37de59=_0x37de59||0xc8;return function(_0x3ffd75){if(_0x3ffd75){return _0x1e53eb[_0x5415('0x1c')](_0x37de59)[_0x5415('0x1e')](_0x3ffd75);}};}function respondWithFilteredResult(_0x21cd96,_0x3171a0){return function(_0x3fa47d){if(_0x3fa47d){var _0x4fa318=typeof _0x3171a0['offset']===_0x5415('0x1f')&&typeof _0x3171a0['limit']===_0x5415('0x1f');var _0x10f735=_0x3fa47d[_0x5415('0x20')];var _0x2360dc=_0x4fa318?0x0:_0x3171a0[_0x5415('0x21')];var _0xcc61ee=_0x4fa318?_0x3fa47d[_0x5415('0x20')]:_0x3171a0[_0x5415('0x21')]+_0x3171a0[_0x5415('0x22')];var _0x3c6585;if(_0xcc61ee>=_0x10f735){_0xcc61ee=_0x10f735;_0x3c6585=0xc8;}else{_0x3c6585=0xce;}_0x21cd96['status'](_0x3c6585);return _0x21cd96[_0x5415('0x23')]('Content-Range',_0x2360dc+'-'+_0xcc61ee+'/'+_0x10f735)[_0x5415('0x1e')](_0x3fa47d);}return null;};}function patchUpdates(_0x242b3a){return function(_0x1e93b7){try{jsonpatch[_0x5415('0x24')](_0x1e93b7,_0x242b3a,!![]);}catch(_0x3b1762){return BPromise[_0x5415('0x25')](_0x3b1762);}return _0x1e93b7[_0x5415('0x26')]();};}function saveUpdates(_0x210899,_0x471f31){return function(_0x363eaa){if(_0x363eaa){return _0x363eaa['update'](_0x210899)[_0x5415('0x27')](function(_0x51150e){return _0x51150e;});}return null;};}function removeEntity(_0x1f1870,_0x16d039){return function(_0x35f768){if(_0x35f768){return _0x35f768['destroy']()[_0x5415('0x27')](function(){_0x1f1870[_0x5415('0x1c')](0xcc)[_0x5415('0x1d')]();});}};}function handleEntityNotFound(_0x2327ff,_0x4a29aa){return function(_0x352b60){if(!_0x352b60){_0x2327ff[_0x5415('0x28')](0x194);}return _0x352b60;};}function handleError(_0x44c40c,_0x3b5865){_0x3b5865=_0x3b5865||0x1f4;return function(_0x4f4b45){logger[_0x5415('0x29')](_0x4f4b45[_0x5415('0x2a')]);if(_0x4f4b45[_0x5415('0x2b')]){delete _0x4f4b45[_0x5415('0x2b')];}_0x44c40c[_0x5415('0x1c')](_0x3b5865)[_0x5415('0x2c')](_0x4f4b45);};}exports[_0x5415('0x2d')]=function(_0x21768a,_0x4e0c79){var _0x42941c={},_0x2e8491={},_0x6e1bb={'count':0x0,'rows':[]};var _0x111d97=_[_0x5415('0x2e')](db[_0x5415('0x2f')][_0x5415('0x30')],function(_0x54fb8f){return{'name':_0x54fb8f[_0x5415('0x31')],'type':_0x54fb8f[_0x5415('0x32')][_0x5415('0x33')]};});_0x2e8491['model']=_['map'](_0x111d97,'name');_0x2e8491[_0x5415('0x34')]=_['keys'](_0x21768a[_0x5415('0x34')]);_0x2e8491[_0x5415('0x35')]=_[_0x5415('0x36')](_0x2e8491[_0x5415('0x37')],_0x2e8491[_0x5415('0x34')]);_0x42941c[_0x5415('0x38')]=_[_0x5415('0x36')](_0x2e8491[_0x5415('0x37')],qs[_0x5415('0x39')](_0x21768a['query'][_0x5415('0x39')]));_0x42941c['attributes']=_0x42941c[_0x5415('0x38')][_0x5415('0x3a')]?_0x42941c[_0x5415('0x38')]:_0x2e8491[_0x5415('0x37')];if(!_0x21768a['query'][_0x5415('0x3b')]('nolimit')){_0x42941c[_0x5415('0x22')]=qs[_0x5415('0x22')](_0x21768a[_0x5415('0x34')][_0x5415('0x22')]);_0x42941c['offset']=qs['offset'](_0x21768a['query']['offset']);}_0x42941c[_0x5415('0x3c')]=qs['sort'](_0x21768a[_0x5415('0x34')]['sort']);_0x42941c[_0x5415('0x3d')]=qs[_0x5415('0x35')](_[_0x5415('0x3e')](_0x21768a[_0x5415('0x34')],_0x2e8491['filters']),_0x111d97);if(_0x21768a[_0x5415('0x34')]['filter']){_0x42941c['where']=_[_0x5415('0x3f')](_0x42941c[_0x5415('0x3d')],{'$or':_['map'](_0x111d97,function(_0x51190a){if(_0x51190a[_0x5415('0x32')]!==_0x5415('0x40')){var _0x16c316={};_0x16c316[_0x51190a[_0x5415('0x2b')]]={'$like':'%'+_0x21768a[_0x5415('0x34')]['filter']+'%'};return _0x16c316;}})});}_0x42941c=_['merge']({},_0x42941c,_0x21768a[_0x5415('0x41')]);var _0x180824={'where':_0x42941c[_0x5415('0x3d')]};return db[_0x5415('0x2f')][_0x5415('0x20')](_0x180824)[_0x5415('0x27')](function(_0x5423e8){_0x6e1bb[_0x5415('0x20')]=_0x5423e8;if(_0x21768a[_0x5415('0x34')]['includeAll']){_0x42941c['include']=[{'all':!![]}];}return db[_0x5415('0x2f')][_0x5415('0x42')](_0x42941c);})['then'](function(_0x521e3f){_0x6e1bb[_0x5415('0x43')]=_0x521e3f;return _0x6e1bb;})['then'](respondWithFilteredResult(_0x4e0c79,_0x42941c))[_0x5415('0x44')](handleError(_0x4e0c79,null));};exports['show']=function(_0xb429f9,_0x28275f){var _0x35c1be={'raw':!![],'where':{'id':_0xb429f9[_0x5415('0x45')]['id']}},_0x3d05d0={};_0x3d05d0[_0x5415('0x37')]=_[_0x5415('0x46')](db[_0x5415('0x2f')][_0x5415('0x30')]);_0x3d05d0[_0x5415('0x34')]=_[_0x5415('0x46')](_0xb429f9['query']);_0x3d05d0['filters']=_[_0x5415('0x36')](_0x3d05d0[_0x5415('0x37')],_0x3d05d0[_0x5415('0x34')]);_0x35c1be[_0x5415('0x38')]=_[_0x5415('0x36')](_0x3d05d0[_0x5415('0x37')],qs[_0x5415('0x39')](_0xb429f9['query'][_0x5415('0x39')]));_0x35c1be[_0x5415('0x38')]=_0x35c1be[_0x5415('0x38')][_0x5415('0x3a')]?_0x35c1be[_0x5415('0x38')]:_0x3d05d0[_0x5415('0x37')];if(_0xb429f9[_0x5415('0x34')]['includeAll']){_0x35c1be[_0x5415('0x47')]=[{'all':!![]}];}_0x35c1be=_[_0x5415('0x3f')]({},_0x35c1be,_0xb429f9[_0x5415('0x41')]);return db[_0x5415('0x2f')][_0x5415('0x48')](_0x35c1be)[_0x5415('0x27')](handleEntityNotFound(_0x28275f,null))['then'](respondWithResult(_0x28275f,null))[_0x5415('0x44')](handleError(_0x28275f,null));};exports[_0x5415('0x49')]=function(_0x5d45fc,_0x21624a){var _0x5a76d3={'where':{'id':_0x5d45fc[_0x5415('0x45')]['id']}},_0x55522e={};_0x55522e[_0x5415('0x37')]=_[_0x5415('0x46')](db[_0x5415('0x2f')][_0x5415('0x30')]);_0x5a76d3['attributes']=_[_0x5415('0x36')](_0x55522e[_0x5415('0x37')],qs['fields'](_0x5d45fc[_0x5415('0x34')]['fields']));_0x5a76d3[_0x5415('0x38')]=_0x5a76d3[_0x5415('0x38')][_0x5415('0x3a')]?_0x5a76d3[_0x5415('0x38')]:_0x55522e[_0x5415('0x37')];if(_0x5d45fc[_0x5415('0x34')]['includeAll']){_0x5a76d3[_0x5415('0x47')]=[{'all':!![]}];}_0x5a76d3=_[_0x5415('0x3f')]({},_0x5a76d3,_0x5d45fc['options']);return db[_0x5415('0x2f')][_0x5415('0x48')](_0x5a76d3)[_0x5415('0x27')](handleEntityNotFound(_0x21624a,null))[_0x5415('0x27')](function(_0x68198d){if(_0x68198d){var _0x3f45d6=_0x68198d[_0x5415('0x4a')]({'plain':!![]});_0x3f45d6=qs[_0x5415('0x4b')](_0x3f45d6,['id',_0x5415('0x4c'),_0x5415('0x4d')]);_0x5d45fc['body']=_[_0x5415('0x4b')](_0x5d45fc['body'],['id',_0x5415('0x4c'),_0x5415('0x4d')]);return db[_0x5415('0x2f')]['create'](_[_0x5415('0x3f')](_0x3f45d6,_0x5d45fc[_0x5415('0x4e')]),{'include':_0x5d45fc[_0x5415('0x34')][_0x5415('0x4f')]?[{'all':!![]}]:undefined});}})[_0x5415('0x27')](respondWithResult(_0x21624a,0xc9))[_0x5415('0x44')](handleError(_0x21624a,null));};exports[_0x5415('0x50')]=function(_0x3706d7,_0x1e5097){if(_0x3706d7[_0x5415('0x4e')]['id']){delete _0x3706d7['body']['id'];}return db['Attachment']['find']({'where':{'id':_0x3706d7[_0x5415('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e5097,null))[_0x5415('0x27')](saveUpdates(_0x3706d7[_0x5415('0x4e')],null))[_0x5415('0x27')](respondWithResult(_0x1e5097,null))[_0x5415('0x44')](handleError(_0x1e5097,null));};exports[_0x5415('0x51')]=function(_0x2d37fa,_0x5dfb67){return db['Attachment']['find']({'where':{'id':_0x2d37fa[_0x5415('0x45')]['id']}})[_0x5415('0x27')](handleEntityNotFound(_0x5dfb67,null))['then'](removeEntity(_0x5dfb67,null))[_0x5415('0x44')](handleError(_0x5dfb67,null));};exports[_0x5415('0x52')]=function(_0x42194c,_0x470a79,_0x4f671a){_0x42194c['body'][_0x5415('0x2b')]=_0x42194c[_0x5415('0x53')][_0x5415('0x54')];_0x42194c[_0x5415('0x4e')]['basename']=_0x42194c['file']['filename'];_0x42194c['body'][_0x5415('0x32')]=_0x42194c[_0x5415('0x53')][_0x5415('0x55')];return db[_0x5415('0x2f')][_0x5415('0x52')](_0x42194c[_0x5415('0x4e')])[_0x5415('0x27')](respondWithResult(_0x470a79,0xc9))[_0x5415('0x44')](handleError(_0x470a79,null));};exports['download']=function(_0x29f24f,_0x744589,_0xf1d798){return db[_0x5415('0x2f')]['findOne']({'where':{'id':_0x29f24f[_0x5415('0x45')]['id']},'raw':!![]})[_0x5415('0x27')](handleEntityNotFound(_0x744589,null))[_0x5415('0x27')](function(_0x3b6fd0){if(_0x3b6fd0){var _0x1fe52c=_0x3b6fd0[_0x5415('0x56')]!==null;var _0x46743a=path[_0x5415('0x57')](config[_0x5415('0x58')],'server/files/attachments/');if(_0x1fe52c){_0x46743a=path['join'](_0x46743a,'offline-chat/');}var _0x23e88b=path['join'](_0x46743a,_0x3b6fd0[_0x5415('0x59')]);return _0x744589['download'](_0x23e88b);}})['catch'](handleError(_0x744589,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index b1001d9..128b908 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 _0x8b21=['rimraf','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3ab738,_0x119fbb){var _0x53800b=function(_0x513c44){while(--_0x513c44){_0x3ab738['push'](_0x3ab738['shift']());}};_0x53800b(++_0x119fbb);}(_0x8b21,0x1a6));var _0x18b2=function(_0x1ca98a,_0x28ad3a){_0x1ca98a=_0x1ca98a-0x0;var _0xedf50e=_0x8b21[_0x1ca98a];return _0xedf50e;};'use strict';var _=require(_0x18b2('0x0'));var util=require(_0x18b2('0x1'));var logger=require('../../config/logger')(_0x18b2('0x2'));var moment=require(_0x18b2('0x3'));var BPromise=require(_0x18b2('0x4'));var rp=require(_0x18b2('0x5'));var fs=require('fs');var path=require(_0x18b2('0x6'));var rimraf=require(_0x18b2('0x7'));var config=require('../../config/environment');var attributes=require(_0x18b2('0x8'));module[_0x18b2('0x9')]=function(_0xd46616,_0xcb4a93){return _0xd46616[_0x18b2('0xa')](_0x18b2('0xb'),attributes,{'tableName':_0x18b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ac1=['path','../../config/environment','./attachment.attributes','Attachment','attachments','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1d2a96,_0x3aff65){var _0x27366a=function(_0xc7aaf6){while(--_0xc7aaf6){_0x1d2a96['push'](_0x1d2a96['shift']());}};_0x27366a(++_0x3aff65);}(_0x6ac1,0x17b));var _0x16ac=function(_0x5fd828,_0xa7ede9){_0x5fd828=_0x5fd828-0x0;var _0x3c1eaa=_0x6ac1[_0x5fd828];return _0x3c1eaa;};'use strict';var _=require(_0x16ac('0x0'));var util=require(_0x16ac('0x1'));var logger=require(_0x16ac('0x2'))('api');var moment=require(_0x16ac('0x3'));var BPromise=require(_0x16ac('0x4'));var rp=require(_0x16ac('0x5'));var fs=require('fs');var path=require(_0x16ac('0x6'));var rimraf=require('rimraf');var config=require(_0x16ac('0x7'));var attributes=require(_0x16ac('0x8'));module['exports']=function(_0x1cf3aa,_0x3f2973){return _0x1cf3aa['define'](_0x16ac('0x9'),attributes,{'tableName':_0x16ac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index c347261..516267f 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 _0x21a3=['Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Attachment','create','body','options','raw','CreateAttachment','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21a3,0x66));var _0x321a=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0x21a3[_0x15106b];return _0x521203;};'use strict';var _=require(_0x321a('0x0'));var util=require('util');var moment=require(_0x321a('0x1'));var BPromise=require(_0x321a('0x2'));var rs=require(_0x321a('0x3'));var fs=require('fs');var Redis=require(_0x321a('0x4'));var db=require(_0x321a('0x5'))['db'];var utils=require(_0x321a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x321a('0x7'));var jayson=require(_0x321a('0x8'));var client=jayson[_0x321a('0x9')][_0x321a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f3b81,_0x388901,_0x24a04c){return new BPromise(function(_0x10c1d3,_0xdfd6b8){return client[_0x321a('0xb')](_0x5f3b81,_0x24a04c)[_0x321a('0xc')](function(_0x2c52dc){logger[_0x321a('0xd')](_0x321a('0xe'),_0x388901,_0x321a('0xf'));logger[_0x321a('0x10')](_0x321a('0x11'),_0x388901,'request\x20sent',JSON[_0x321a('0x12')](_0x2c52dc));if(_0x2c52dc[_0x321a('0x13')]){if(_0x2c52dc['error']['code']===0x1f4){logger[_0x321a('0x13')]('Attachment,\x20%s,\x20%s',_0x388901,_0x2c52dc[_0x321a('0x13')][_0x321a('0x14')]);return _0xdfd6b8(_0x2c52dc['error']['message']);}logger[_0x321a('0x13')](_0x321a('0xe'),_0x388901,_0x2c52dc[_0x321a('0x13')][_0x321a('0x14')]);return _0x10c1d3(_0x2c52dc[_0x321a('0x13')][_0x321a('0x14')]);}else{logger[_0x321a('0xd')](_0x321a('0xe'),_0x388901,'request\x20sent');_0x10c1d3(_0x2c52dc[_0x321a('0x15')][_0x321a('0x14')]);}})['catch'](function(_0x45ceb2){logger[_0x321a('0x13')](_0x321a('0xe'),_0x388901,_0x45ceb2);_0xdfd6b8(_0x45ceb2);});});}exports['CreateAttachment']=function(_0x5b1810){var _0x464bd7=this;return new Promise(function(_0x35fd6f,_0x58595b){return db[_0x321a('0x16')][_0x321a('0x17')](_0x5b1810[_0x321a('0x18')],{'raw':_0x5b1810['options']?_0x5b1810[_0x321a('0x19')][_0x321a('0x1a')]===undefined?!![]:![]:!![]})[_0x321a('0xc')](function(_0x423cb8){logger[_0x321a('0xd')](_0x321a('0x1b'),_0x5b1810);logger[_0x321a('0x10')](_0x321a('0x1b'),_0x5b1810,JSON[_0x321a('0x12')](_0x423cb8));_0x35fd6f(_0x423cb8);})[_0x321a('0x1c')](function(_0x1b94a1){logger[_0x321a('0x13')]('CreateAttachment',_0x1b94a1[_0x321a('0x14')],_0x5b1810);_0x58595b(_0x464bd7[_0x321a('0x13')](0x1f4,_0x1b94a1[_0x321a('0x14')]));});});}; \ No newline at end of file +var _0xbd3b=['body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateAttachment','Attachment'];(function(_0x2b2e94,_0x2796be){var _0x248aff=function(_0x374b20){while(--_0x374b20){_0x2b2e94['push'](_0x2b2e94['shift']());}};_0x248aff(++_0x2796be);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x3f146c,_0x42e0dc){_0x3f146c=_0x3f146c-0x0;var _0x407f72=_0xbd3b[_0x3f146c];return _0x407f72;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var moment=require(_0xbbd3('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbd3('0x3'));var fs=require('fs');var Redis=require(_0xbbd3('0x4'));var db=require(_0xbbd3('0x5'))['db'];var utils=require(_0xbbd3('0x6'));var logger=require('../../config/logger')(_0xbbd3('0x7'));var config=require(_0xbbd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbbd3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc5d9,_0x232ede,_0x44f331){return new BPromise(function(_0x4b8667,_0x3d3f9f){return client[_0xbbd3('0xa')](_0x3cc5d9,_0x44f331)[_0xbbd3('0xb')](function(_0x229f59){logger['info'](_0xbbd3('0xc'),_0x232ede,_0xbbd3('0xd'));logger[_0xbbd3('0xe')](_0xbbd3('0xf'),_0x232ede,'request\x20sent',JSON[_0xbbd3('0x10')](_0x229f59));if(_0x229f59['error']){if(_0x229f59['error'][_0xbbd3('0x11')]===0x1f4){logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x229f59[_0xbbd3('0x12')][_0xbbd3('0x13')]);return _0x3d3f9f(_0x229f59[_0xbbd3('0x12')][_0xbbd3('0x13')]);}logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x229f59[_0xbbd3('0x12')]['message']);return _0x4b8667(_0x229f59['error'][_0xbbd3('0x13')]);}else{logger[_0xbbd3('0x14')](_0xbbd3('0xc'),_0x232ede,_0xbbd3('0xd'));_0x4b8667(_0x229f59[_0xbbd3('0x15')]['message']);}})[_0xbbd3('0x16')](function(_0x49d6b9){logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x49d6b9);_0x3d3f9f(_0x49d6b9);});});}exports[_0xbbd3('0x17')]=function(_0x240a46){var _0x5f3952=this;return new Promise(function(_0x50b6e4,_0x12954a){return db[_0xbbd3('0x18')]['create'](_0x240a46[_0xbbd3('0x19')],{'raw':_0x240a46['options']?_0x240a46[_0xbbd3('0x1a')][_0xbbd3('0x1b')]===undefined?!![]:![]:!![]})[_0xbbd3('0xb')](function(_0x1fa586){logger[_0xbbd3('0x14')](_0xbbd3('0x17'),_0x240a46);logger[_0xbbd3('0xe')]('CreateAttachment',_0x240a46,JSON[_0xbbd3('0x10')](_0x1fa586));_0x50b6e4(_0x1fa586);})['catch'](function(_0x5392eb){logger[_0xbbd3('0x12')](_0xbbd3('0x17'),_0x5392eb[_0xbbd3('0x13')],_0x240a46);_0x12954a(_0x5f3952[_0xbbd3('0x12')](0x1f4,_0x5392eb['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a288c5b..986ef7f 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x11dffc,_0x18bcb5){var _0x1728d5=function(_0x4b759a){while(--_0x4b759a){_0x11dffc['push'](_0x11dffc['shift']());}};_0x1728d5(++_0x18bcb5);}(_0xadb5,0xad));var _0x5adb=function(_0x12d0a4,_0x31ef87){_0x12d0a4=_0x12d0a4-0x0;var _0x5e94ac=_0xadb5[_0x12d0a4];return _0x5e94ac;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 3a73fad..ed6a0c5 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 _0xe63e=['getLicense','catch','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','signToken','../../config/utils','authenticate','google','/login','profile','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser'];(function(_0x548431,_0x18e5d9){var _0x81a492=function(_0x156366){while(--_0x156366){_0x548431['push'](_0x548431['shift']());}};_0x81a492(++_0x18e5d9);}(_0xe63e,0x183));var _0xee63=function(_0x4a2dfd,_0x115cff){_0x4a2dfd=_0x4a2dfd-0x0;var _0x58cd9a=_0xe63e[_0x4a2dfd];return _0x58cd9a;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0xee63('0x0'))[_0xee63('0x1')];var moment=require('moment');var db=require(_0xee63('0x2'))['db'];var config=require(_0xee63('0x3'));var signToken=require('../../components/auth/service')[_0xee63('0x4')];var utils=require(_0xee63('0x5'));exports['login']=passport[_0xee63('0x6')](_0xee63('0x7'),{'failureRedirect':_0xee63('0x8'),'scope':[_0xee63('0x9'),'email'],'session':![]});exports['callback']=passport[_0xee63('0x6')](_0xee63('0x7'),{'failureRedirect':_0xee63('0x8'),'session':![]});passport[_0xee63('0xa')](new GoogleStrategy({'clientID':config[_0xee63('0x7')]?config[_0xee63('0x7')][_0xee63('0xb')]:'id','clientSecret':config[_0xee63('0x7')]?config[_0xee63('0x7')][_0xee63('0xc')]:_0xee63('0xd'),'callbackURL':config[_0xee63('0x7')]?config[_0xee63('0x7')][_0xee63('0xe')]:''},function(_0x53f722,_0x40e49e,_0x3331d8,_0x3a1c30){var _0x5c188d,_0x45f482;return db[_0xee63('0xf')][_0xee63('0x10')]({'where':{'id':0x1},'attributes':[_0xee63('0x11'),_0xee63('0x12')],'raw':!![]})[_0xee63('0x13')](function(_0x412f91){_0x5c188d=_0x412f91;return db[_0xee63('0x14')][_0xee63('0x15')]({'where':{'email':_[_0xee63('0x16')](_0x3331d8['emails'],_0xee63('0x17')),'role':{'$or':[_0xee63('0x18'),'user',_0xee63('0x19')]}}});})['then'](function(_0x36c062){_0x45f482=_0x36c062;if(_0x45f482){if(_0x45f482[_0xee63('0x1a')]){return _0x3a1c30(_0xee63('0x1b'));}else if(_0x5c188d[_0xee63('0x12')]>0x0){if(_0x45f482[_0xee63('0x1c')]){if(moment(_0x45f482[_0xee63('0x1d')])[_0xee63('0x1e')](_0x5c188d[_0xee63('0x12')],_0xee63('0x1f'))>moment()){return _0x3a1c30(_0xee63('0x1b'));}else{return utils[_0xee63('0x20')](_0x45f482,0x0,![],null)[_0xee63('0x13')](function(){return utils[_0xee63('0x21')](_0x45f482);})['then'](function(){return _0x3a1c30(null,_0x45f482);});}}else{return utils[_0xee63('0x21')](_0x45f482)['then'](function(){return _0x3a1c30(null,_0x45f482);});}}else{return utils[_0xee63('0x21')](_0x45f482)['then'](function(){return _0x3a1c30(null,_0x45f482);});}}return _0x3a1c30(_0xee63('0x1b'));})[_0xee63('0x22')](function(_0x30d2ce){_0x3a1c30(_0x30d2ce);});})); \ No newline at end of file +var _0xb6fe=['clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','clearBlockUser','getLicense','catch','passport-google-oauth20','Strategy','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','callback','use','clientID'];(function(_0x5b94d1,_0x4e009c){var _0x3f79c8=function(_0x377973){while(--_0x377973){_0x5b94d1['push'](_0x5b94d1['shift']());}};_0x3f79c8(++_0x4e009c);}(_0xb6fe,0xc4));var _0xeb6f=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xb6fe[_0x2b8077];return _0x308091;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0xeb6f('0x0'))[_0xeb6f('0x1')];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0xeb6f('0x2'));var signToken=require(_0xeb6f('0x3'))[_0xeb6f('0x4')];var utils=require(_0xeb6f('0x5'));exports[_0xeb6f('0x6')]=passport[_0xeb6f('0x7')](_0xeb6f('0x8'),{'failureRedirect':_0xeb6f('0x9'),'scope':[_0xeb6f('0xa'),'email'],'session':![]});exports[_0xeb6f('0xb')]=passport[_0xeb6f('0x7')](_0xeb6f('0x8'),{'failureRedirect':_0xeb6f('0x9'),'session':![]});passport[_0xeb6f('0xc')](new GoogleStrategy({'clientID':config['google']?config[_0xeb6f('0x8')][_0xeb6f('0xd')]:'id','clientSecret':config[_0xeb6f('0x8')]?config[_0xeb6f('0x8')][_0xeb6f('0xe')]:'secret','callbackURL':config[_0xeb6f('0x8')]?config[_0xeb6f('0x8')][_0xeb6f('0xf')]:''},function(_0x3a3af1,_0x1fccd7,_0x55b9af,_0x28e75f){var _0x112128,_0x15f1a3;return db[_0xeb6f('0x10')][_0xeb6f('0x11')]({'where':{'id':0x1},'attributes':[_0xeb6f('0x12'),_0xeb6f('0x13')],'raw':!![]})[_0xeb6f('0x14')](function(_0xb075f5){_0x112128=_0xb075f5;return db[_0xeb6f('0x15')][_0xeb6f('0x16')]({'where':{'email':_[_0xeb6f('0x17')](_0x55b9af[_0xeb6f('0x18')],_0xeb6f('0x19')),'role':{'$or':['admin',_0xeb6f('0x1a'),_0xeb6f('0x1b')]}}});})[_0xeb6f('0x14')](function(_0x48ea61){_0x15f1a3=_0x48ea61;if(_0x15f1a3){if(_0x15f1a3[_0xeb6f('0x1c')]){return _0x28e75f(_0xeb6f('0x1d'));}else if(_0x112128[_0xeb6f('0x13')]>0x0){if(_0x15f1a3[_0xeb6f('0x1e')]){if(moment(_0x15f1a3[_0xeb6f('0x1f')])['add'](_0x112128[_0xeb6f('0x13')],'minutes')>moment()){return _0x28e75f(_0xeb6f('0x1d'));}else{return utils[_0xeb6f('0x20')](_0x15f1a3,0x0,![],null)['then'](function(){return utils['getLicense'](_0x15f1a3);})[_0xeb6f('0x14')](function(){return _0x28e75f(null,_0x15f1a3);});}}else{return utils[_0xeb6f('0x21')](_0x15f1a3)[_0xeb6f('0x14')](function(){return _0x28e75f(null,_0x15f1a3);});}}else{return utils[_0xeb6f('0x21')](_0x15f1a3)['then'](function(){return _0x28e75f(null,_0x15f1a3);});}}return _0x28e75f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xeb6f('0x22')](function(_0x16ee87){_0x28e75f(_0x16ee87);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 78e8825..1e57d9b 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 _0x6dbb=['get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','../user/user.controller.js','../../components/auth/service'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0x6dbb,0x1b5));var _0xb6db=function(_0x167d37,_0x314676){_0x167d37=_0x167d37-0x0;var _0x25f99a=_0x6dbb[_0x167d37];return _0x25f99a;};'use strict';var express=require(_0xb6db('0x0'));var passport=require('passport');var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xb6db('0x1'));var authService=require(_0xb6db('0x2'));router[_0xb6db('0x3')]('/',controller[_0xb6db('0x4')]);router[_0xb6db('0x3')](_0xb6db('0x5'),controller[_0xb6db('0x6')],authService[_0xb6db('0x7')],userController[_0xb6db('0x4')],authService[_0xb6db('0x8')]);module[_0xb6db('0x9')]=router; \ No newline at end of file +var _0x70e4=['login','/callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x10d405,_0x28d136){var _0x12bd98=function(_0x3b6cc3){while(--_0x3b6cc3){_0x10d405['push'](_0x10d405['shift']());}};_0x12bd98(++_0x28d136);}(_0x70e4,0x13d));var _0x470e=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0x70e4[_0x43e4b3];return _0x10c655;};'use strict';var express=require(_0x470e('0x0'));var passport=require(_0x470e('0x1'));var router=express[_0x470e('0x2')]();var controller=require(_0x470e('0x3'));var userController=require(_0x470e('0x4'));var authService=require(_0x470e('0x5'));router[_0x470e('0x6')]('/',controller[_0x470e('0x7')]);router[_0x470e('0x6')](_0x470e('0x8'),controller['callback'],authService[_0x470e('0x9')],userController[_0x470e('0x7')],authService[_0x470e('0xa')]);module[_0x470e('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a2696f1..7b756f4 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 _0xc3be=['pass','merge','\x22%s\x22\x20<%s>','request','SendMail','format','error','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','forgot','body','trim','toLowerCase','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','find','token','now','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','resetPasswordExpires','save','Password\x20reset!','use','util','passport','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','user','authenticate','loginAttempts','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xc3be,0x7b));var _0xec3b=function(_0x4bf5f6,_0x44e324){_0x4bf5f6=_0x4bf5f6-0x0;var _0x21c97e=_0xc3be[_0x4bf5f6];return _0x21c97e;};'use strict';var util=require(_0xec3b('0x0'));var passport=require(_0xec3b('0x1'));var LocalStrategy=require('passport-local')[_0xec3b('0x2')];var jayson=require(_0xec3b('0x3'));var _=require(_0xec3b('0x4'));var rs=require('randomstring');var moment=require(_0xec3b('0x5'));var db=require(_0xec3b('0x6'))['db'];var authService=require(_0xec3b('0x7'));var utils=require(_0xec3b('0x8'));var client=jayson[_0xec3b('0x9')][_0xec3b('0xa')]({'port':0x232b});function localAuthenticate(_0x257ea6,_0x1df9c5,_0x54feaa,_0x44323a){var _0xe0061d,_0x249963;return db[_0xec3b('0xb')][_0xec3b('0xc')]({'where':{'id':0x1},'attributes':[_0xec3b('0xd'),_0xec3b('0xe')],'raw':!![]})[_0xec3b('0xf')](function(_0x2cc068){_0xe0061d=_0x2cc068;return _0x257ea6[_0xec3b('0xc')]({'attributes':['id',_0xec3b('0x10'),_0xec3b('0x11'),_0xec3b('0x12'),_0xec3b('0x13'),_0xec3b('0x14'),_0xec3b('0x15'),_0xec3b('0x16'),'loginAttempts'],'where':{'name':_0x1df9c5,'role':{'$or':['admin',_0xec3b('0x17'),'agent']}}});})['then'](function(_0x29e70b){if(!_0x29e70b||_0x29e70b&&_0x29e70b[_0xec3b('0x10')]!==_0x1df9c5){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x249963=_0x29e70b;return _0x249963;}})[_0xec3b('0xf')](function(){_0x249963[_0xec3b('0x18')](_0x54feaa,function(_0x1c70da,_0x3d0e9d){var _0x3790de=_0x249963[_0xec3b('0x19')]+0x1;if(_0x1c70da){return _0x44323a(_0x1c70da);}else if(!_0x3d0e9d){if(_0x249963[_0xec3b('0x14')]){return _0x44323a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xe0061d['allowedLoginAttempts']>0x0){if(_0x249963['blocked']){if(_0xe0061d['blockDuration']>0x0){if(moment(_0x249963['blockedAt'])[_0xec3b('0x1a')](_0xe0061d['blockDuration'],_0xec3b('0x1b'))>moment()){return _0x44323a(null,![],{'message':_0xec3b('0x1c')});}else{return utils[_0xec3b('0x1d')](_0x249963,_0x3790de,![],null)['then'](function(){return _0x44323a(null,![],{'message':_0xec3b('0x1c')});});}}else{return _0x44323a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3790de>=_0xe0061d['allowedLoginAttempts']){return utils['clearBlockUser'](_0x249963,0x0,!![],moment())['then'](function(){return _0x44323a(null,![],{'message':_0xec3b('0x1c')});});}else{return utils[_0xec3b('0x1d')](_0x249963,_0x3790de,![],null)[_0xec3b('0xf')](function(){return _0x44323a(null,![],{'message':_0xec3b('0x1c')});});}}}else{return _0x44323a(null,![],{'message':_0xec3b('0x1c')});}}else{if(_0x249963[_0xec3b('0x14')]){return _0x44323a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xe0061d[_0xec3b('0xd')]>0x0){if(_0x249963[_0xec3b('0x15')]){if(_0xe0061d['blockDuration']>0x0){if(moment(_0x249963[_0xec3b('0x16')])[_0xec3b('0x1a')](_0xe0061d[_0xec3b('0xe')],_0xec3b('0x1b'))>moment()){return _0x44323a(null,![],{'message':_0xec3b('0x1c')});}else{return utils[_0xec3b('0x1d')](_0x249963,0x0,![],null)[_0xec3b('0xf')](function(){return utils[_0xec3b('0x1e')](_0x249963);})[_0xec3b('0xf')](function(){return _0x44323a(null,_0x249963);});}}else{return _0x44323a(null,![],{'message':_0xec3b('0x1c')});}}else{return utils[_0xec3b('0x1d')](_0x249963,0x0,![],null)[_0xec3b('0xf')](function(){return utils['getLicense'](_0x249963);})[_0xec3b('0xf')](function(){return _0x44323a(null,_0x249963);})['catch'](function(_0x12963b){return _0x44323a(null,![],_0x12963b);});}}else{if(_0x249963[_0xec3b('0x15')]){return _0x44323a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xec3b('0x1e')](_0x249963)['then'](function(){return _0x44323a(null,_0x249963);});}}}});})[_0xec3b('0x1f')](function(_0x24bfc1){return _0x44323a(null,![],_0x24bfc1);});}function sendServiceMail(_0x491951){return db[_0xec3b('0x20')]['find']({'where':{'service':!![]},'attributes':['id',_0xec3b('0x10'),_0xec3b('0x21')],'include':[{'model':db[_0xec3b('0x22')],'as':_0xec3b('0x23')}]})[_0xec3b('0xf')](function(_0x1c4197){if(!_0x1c4197){throw new Error(_0xec3b('0x24'));}var _0x4287da={'tls':{'rejectUnauthorized':![]}};if(_0x1c4197[_0xec3b('0x23')]['service']){_0x4287da['service']=_0x1c4197['Smtp'][_0xec3b('0x25')];}else{_0x4287da[_0xec3b('0x26')]=_0x1c4197[_0xec3b('0x23')][_0xec3b('0x26')];_0x4287da[_0xec3b('0x27')]=_0x1c4197[_0xec3b('0x23')][_0xec3b('0x27')];_0x4287da[_0xec3b('0x28')]=_0x1c4197[_0xec3b('0x23')][_0xec3b('0x28')];}if(_0x1c4197['Smtp'][_0xec3b('0x29')]){_0x4287da[_0xec3b('0x2a')]={'user':_0x1c4197['Smtp']['user'],'pass':_0x1c4197['Smtp'][_0xec3b('0x2b')]};}var _0x3b6cfd={'account':_0x4287da,'message':_[_0xec3b('0x2c')]({'from':util['format'](_0xec3b('0x2d'),_0x1c4197[_0xec3b('0x10')],_0x1c4197[_0xec3b('0x21')]||_0x1c4197[_0xec3b('0x23')][_0xec3b('0x17')])},_0x491951)};return client[_0xec3b('0x2e')](_0xec3b('0x2f'),_0x3b6cfd);})[_0xec3b('0xf')](function(_0x517669){if(_0x517669['error']){throw new Error(util[_0xec3b('0x30')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x517669[_0xec3b('0x31')][_0xec3b('0x32')]||JSON[_0xec3b('0x33')](_0x517669[_0xec3b('0x31')])));}return!![];});}function handleError(_0x57b9db,_0x56ff9a,_0x2c19d0){return _0x57b9db[_0xec3b('0x34')](_0x56ff9a||0x1f4)[_0xec3b('0x35')]({'message':_0x2c19d0?_0x2c19d0[_0xec3b('0x32')]||_0x2c19d0:''});}exports[_0xec3b('0x36')]=function(_0x5e09d1,_0x14f3c4,_0x4b8107){passport[_0xec3b('0x18')](_0xec3b('0x37'),function(_0x31b8ce,_0x5cd02d,_0x50b30f){var _0x25737a=_0x31b8ce||_0x50b30f;if(_0x25737a){return handleError(_0x14f3c4,0x191,_0x25737a);}if(!_0x5cd02d){return handleError(_0x14f3c4,0x194,{'message':_0xec3b('0x38')});}else{var _0x47d6d8={'payload':{'id':_0x5cd02d['id'],'role':_0x5cd02d[_0xec3b('0x13')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x47d6d8)[_0xec3b('0xf')](function(_0x52e238){_0x14f3c4[_0xec3b('0x39')]({'id':_0x5cd02d['id'],'token':_0x52e238,'statusCall':'','isAlreadyLogged':_0x5cd02d['online']});});}})(_0x5e09d1,_0x14f3c4,_0x4b8107);};exports[_0xec3b('0x3a')]=function(_0x1cc888,_0x5962c2,_0x27935a){if(!_0x1cc888['body']['email']){return handleError(_0x5962c2,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x2da47b=rs['generate']();_0x1cc888[_0xec3b('0x3b')][_0xec3b('0x21')]=_0x1cc888[_0xec3b('0x3b')][_0xec3b('0x21')][_0xec3b('0x3c')]()[_0xec3b('0x3d')]();var _0x3dfc88;return db['Setting'][_0xec3b('0xc')]({'where':{'id':0x1},'attributes':[_0xec3b('0xd'),_0xec3b('0xe')],'raw':!![]})[_0xec3b('0xf')](function(_0x246f58){_0x3dfc88=_0x246f58;return db['User']['find']({'where':{'email':_0x1cc888['body'][_0xec3b('0x21')]}});})[_0xec3b('0xf')](function(_0x51a490){if(!_0x51a490){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x51a490['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x51a490[_0xec3b('0x15')]){if(moment(_0x51a490['blockedAt'])[_0xec3b('0x1a')](_0x3dfc88[_0xec3b('0xe')],'minutes')>moment()){throw new Error(_0xec3b('0x3e'));}else{_0x51a490[_0xec3b('0x15')]=![];_0x51a490[_0xec3b('0x16')]=null;}}_0x51a490[_0xec3b('0x3f')]=_0x2da47b;_0x51a490['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x51a490['save']();})[_0xec3b('0xf')](function(){return sendServiceMail({'to':_0x1cc888[_0xec3b('0x3b')][_0xec3b('0x21')],'subject':_0xec3b('0x40'),'text':_0xec3b('0x41')+_0xec3b('0x42')+_0xec3b('0x43')+_0x1cc888['headers'][_0xec3b('0x26')]+_0xec3b('0x44')+_0x2da47b+'\x0a\x0a'+_0xec3b('0x45')});})[_0xec3b('0xf')](function(){_0x5962c2[_0xec3b('0x34')](0xc8)[_0xec3b('0x35')]({'message':_0xec3b('0x46')});})[_0xec3b('0x1f')](function(_0x2cc85c){return handleError(_0x5962c2,0x1f4,_0x2cc85c);});};exports['reset']=function(_0x54f817,_0xfd338b,_0x2906ff){return db[_0xec3b('0x47')][_0xec3b('0x48')]({'where':{'resetPasswordToken':_0x54f817['params'][_0xec3b('0x49')],'resetPasswordExpires':{'$gt':Date[_0xec3b('0x4a')]()}}})['then'](function(_0x2596c2){if(!_0x2596c2){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xec3b('0xb')][_0xec3b('0xc')]({'attributes':['id','securePassword',_0xec3b('0x4b'),_0xec3b('0x4c')]})['then'](function(_0x3f7de0){if(_0x3f7de0[_0xec3b('0x4d')])authService['validatePasswordPattern'](_0x54f817['body'][_0xec3b('0x11')]);if(!_0x3f7de0[_0xec3b('0x4b')]||!_0x2596c2[_0xec3b('0x4e')])return _0x2596c2;authService['validatePasswordHistory'](_0x54f817[_0xec3b('0x3b')][_0xec3b('0x11')],_0x2596c2[_0xec3b('0x4e')],_0x3f7de0['passwordHistoryLimit']);return _0x2596c2;})[_0xec3b('0xf')](function(){_0x2596c2[_0xec3b('0x11')]=_0x54f817[_0xec3b('0x3b')]['password'];_0x2596c2[_0xec3b('0x3f')]=null;_0x2596c2[_0xec3b('0x4f')]=null;return _0x2596c2[_0xec3b('0x50')]();});})[_0xec3b('0xf')](function(){_0xfd338b[_0xec3b('0x34')](0xc8)[_0xec3b('0x35')]({'message':_0xec3b('0x51')});})['catch'](function(_0x214df4){return handleError(_0xfd338b,0x1f4,_0x214df4);});};passport[_0xec3b('0x52')](new LocalStrategy({'usernameField':_0xec3b('0x10'),'passwordField':_0xec3b('0x11')},function(_0x1b9ad3,_0x1c2c3f,_0x1c636a){return localAuthenticate(db[_0xec3b('0x47')],_0x1b9ad3,_0x1c2c3f,_0x1c636a);})); \ No newline at end of file +var _0xd219=['blockDuration','name','password','salt','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','add','clearBlockUser','blocked','minutes','getLicense','Smtp','service','host','port','secure','authentication','auth','\x22%s\x22\x20<%s>','email','request','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','Reset\x20Email\x20sent!','catch','reset','find','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts'];(function(_0x3c9862,_0x2464d5){var _0x5af392=function(_0x441fba){while(--_0x441fba){_0x3c9862['push'](_0x3c9862['shift']());}};_0x5af392(++_0x2464d5);}(_0xd219,0x13e));var _0x9d21=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd219[_0x580576];return _0x3f55a0;};'use strict';var util=require(_0x9d21('0x0'));var passport=require(_0x9d21('0x1'));var LocalStrategy=require(_0x9d21('0x2'))[_0x9d21('0x3')];var jayson=require(_0x9d21('0x4'));var _=require(_0x9d21('0x5'));var rs=require(_0x9d21('0x6'));var moment=require(_0x9d21('0x7'));var db=require(_0x9d21('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x9d21('0x9'));var client=jayson[_0x9d21('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x302b27,_0x4c3f0f,_0x22a220,_0x1ffe1b){var _0xf9866b,_0x2a1f9a;return db[_0x9d21('0xb')][_0x9d21('0xc')]({'where':{'id':0x1},'attributes':[_0x9d21('0xd'),_0x9d21('0xe')],'raw':!![]})['then'](function(_0x2a3d11){_0xf9866b=_0x2a3d11;return _0x302b27[_0x9d21('0xc')]({'attributes':['id',_0x9d21('0xf'),_0x9d21('0x10'),_0x9d21('0x11'),'role',_0x9d21('0x12'),'blocked',_0x9d21('0x13'),_0x9d21('0x14')],'where':{'name':_0x4c3f0f,'role':{'$or':[_0x9d21('0x15'),_0x9d21('0x16'),_0x9d21('0x17')]}}});})['then'](function(_0x5264bc){if(!_0x5264bc||_0x5264bc&&_0x5264bc[_0x9d21('0xf')]!==_0x4c3f0f){throw new Error(_0x9d21('0x18'));}else{_0x2a1f9a=_0x5264bc;return _0x2a1f9a;}})[_0x9d21('0x19')](function(){_0x2a1f9a[_0x9d21('0x1a')](_0x22a220,function(_0x356529,_0x4fa42b){var _0x2eaeb7=_0x2a1f9a[_0x9d21('0x14')]+0x1;if(_0x356529){return _0x1ffe1b(_0x356529);}else if(!_0x4fa42b){if(_0x2a1f9a[_0x9d21('0x12')]){return _0x1ffe1b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xf9866b[_0x9d21('0xd')]>0x0){if(_0x2a1f9a['blocked']){if(_0xf9866b['blockDuration']>0x0){if(moment(_0x2a1f9a[_0x9d21('0x13')])[_0x9d21('0x1b')](_0xf9866b['blockDuration'],'minutes')>moment()){return _0x1ffe1b(null,![],{'message':_0x9d21('0x18')});}else{return utils[_0x9d21('0x1c')](_0x2a1f9a,_0x2eaeb7,![],null)[_0x9d21('0x19')](function(){return _0x1ffe1b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1ffe1b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2eaeb7>=_0xf9866b[_0x9d21('0xd')]){return utils[_0x9d21('0x1c')](_0x2a1f9a,0x0,!![],moment())['then'](function(){return _0x1ffe1b(null,![],{'message':_0x9d21('0x18')});});}else{return utils[_0x9d21('0x1c')](_0x2a1f9a,_0x2eaeb7,![],null)[_0x9d21('0x19')](function(){return _0x1ffe1b(null,![],{'message':_0x9d21('0x18')});});}}}else{return _0x1ffe1b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2a1f9a[_0x9d21('0x12')]){return _0x1ffe1b(null,![],{'message':_0x9d21('0x18')});}else if(_0xf9866b[_0x9d21('0xd')]>0x0){if(_0x2a1f9a[_0x9d21('0x1d')]){if(_0xf9866b[_0x9d21('0xe')]>0x0){if(moment(_0x2a1f9a[_0x9d21('0x13')])[_0x9d21('0x1b')](_0xf9866b['blockDuration'],_0x9d21('0x1e'))>moment()){return _0x1ffe1b(null,![],{'message':_0x9d21('0x18')});}else{return utils[_0x9d21('0x1c')](_0x2a1f9a,0x0,![],null)[_0x9d21('0x19')](function(){return utils[_0x9d21('0x1f')](_0x2a1f9a);})[_0x9d21('0x19')](function(){return _0x1ffe1b(null,_0x2a1f9a);});}}else{return _0x1ffe1b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x9d21('0x1c')](_0x2a1f9a,0x0,![],null)['then'](function(){return utils[_0x9d21('0x1f')](_0x2a1f9a);})[_0x9d21('0x19')](function(){return _0x1ffe1b(null,_0x2a1f9a);})['catch'](function(_0x40e31d){return _0x1ffe1b(null,![],_0x40e31d);});}}else{if(_0x2a1f9a[_0x9d21('0x1d')]){return _0x1ffe1b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x9d21('0x1f')](_0x2a1f9a)[_0x9d21('0x19')](function(){return _0x1ffe1b(null,_0x2a1f9a);});}}}});})['catch'](function(_0x598ee0){return _0x1ffe1b(null,![],_0x598ee0);});}function sendServiceMail(_0x9eb3c6){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x9d21('0xf'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x9d21('0x20')}]})[_0x9d21('0x19')](function(_0x3468cb){if(!_0x3468cb){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x291e34={'tls':{'rejectUnauthorized':![]}};if(_0x3468cb[_0x9d21('0x20')][_0x9d21('0x21')]){_0x291e34[_0x9d21('0x21')]=_0x3468cb[_0x9d21('0x20')][_0x9d21('0x21')];}else{_0x291e34[_0x9d21('0x22')]=_0x3468cb['Smtp']['host'];_0x291e34[_0x9d21('0x23')]=_0x3468cb[_0x9d21('0x20')]['port'];_0x291e34['secure']=_0x3468cb[_0x9d21('0x20')][_0x9d21('0x24')];}if(_0x3468cb[_0x9d21('0x20')][_0x9d21('0x25')]){_0x291e34[_0x9d21('0x26')]={'user':_0x3468cb[_0x9d21('0x20')][_0x9d21('0x16')],'pass':_0x3468cb['Smtp']['pass']};}var _0x2a8ceb={'account':_0x291e34,'message':_['merge']({'from':util['format'](_0x9d21('0x27'),_0x3468cb[_0x9d21('0xf')],_0x3468cb[_0x9d21('0x28')]||_0x3468cb[_0x9d21('0x20')][_0x9d21('0x16')])},_0x9eb3c6)};return client[_0x9d21('0x29')]('SendMail',_0x2a8ceb);})['then'](function(_0x3a2b46){if(_0x3a2b46['error']){throw new Error(util[_0x9d21('0x2a')](_0x9d21('0x2b'),_0x3a2b46[_0x9d21('0x2c')][_0x9d21('0x2d')]||JSON[_0x9d21('0x2e')](_0x3a2b46[_0x9d21('0x2c')])));}return!![];});}function handleError(_0x72d490,_0x319b4c,_0x11c943){return _0x72d490[_0x9d21('0x2f')](_0x319b4c||0x1f4)[_0x9d21('0x30')]({'message':_0x11c943?_0x11c943[_0x9d21('0x2d')]||_0x11c943:''});}exports['login']=function(_0x4f3109,_0x5be8c0,_0x41c9e5){passport['authenticate'](_0x9d21('0x31'),function(_0x15a14d,_0x5d0bed,_0x54cc41){var _0x23aa4c=_0x15a14d||_0x54cc41;if(_0x23aa4c){return handleError(_0x5be8c0,0x191,_0x23aa4c);}if(!_0x5d0bed){return handleError(_0x5be8c0,0x194,{'message':_0x9d21('0x32')});}else{var _0x1022e5={'payload':{'id':_0x5d0bed['id'],'role':_0x5d0bed[_0x9d21('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0x9d21('0x34')](_0x1022e5)[_0x9d21('0x19')](function(_0x529ee3){_0x5be8c0[_0x9d21('0x35')]({'id':_0x5d0bed['id'],'token':_0x529ee3,'statusCall':'','isAlreadyLogged':_0x5d0bed[_0x9d21('0x36')]});});}})(_0x4f3109,_0x5be8c0,_0x41c9e5);};exports[_0x9d21('0x37')]=function(_0x3154dc,_0x3f8098,_0x371e7f){if(!_0x3154dc[_0x9d21('0x38')][_0x9d21('0x28')]){return handleError(_0x3f8098,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x604173=rs[_0x9d21('0x39')]();_0x3154dc['body'][_0x9d21('0x28')]=_0x3154dc[_0x9d21('0x38')][_0x9d21('0x28')][_0x9d21('0x3a')]()[_0x9d21('0x3b')]();var _0x5076c8;return db[_0x9d21('0xb')][_0x9d21('0xc')]({'where':{'id':0x1},'attributes':[_0x9d21('0xd'),'blockDuration'],'raw':!![]})[_0x9d21('0x19')](function(_0x5be958){_0x5076c8=_0x5be958;return db[_0x9d21('0x3c')]['find']({'where':{'email':_0x3154dc['body']['email']}});})['then'](function(_0xe53907){if(!_0xe53907){throw new Error(_0x9d21('0x3d'));}if(_0xe53907[_0x9d21('0x12')]){throw new Error(_0x9d21('0x3e'));}if(_0xe53907[_0x9d21('0x1d')]){if(moment(_0xe53907['blockedAt'])[_0x9d21('0x1b')](_0x5076c8[_0x9d21('0xe')],_0x9d21('0x1e'))>moment()){throw new Error(_0x9d21('0x3f'));}else{_0xe53907[_0x9d21('0x1d')]=![];_0xe53907['blockedAt']=null;}}_0xe53907['resetPasswordToken']=_0x604173;_0xe53907[_0x9d21('0x40')]=Date[_0x9d21('0x41')]()+0x36ee80;return _0xe53907[_0x9d21('0x42')]();})[_0x9d21('0x19')](function(){return sendServiceMail({'to':_0x3154dc[_0x9d21('0x38')][_0x9d21('0x28')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x9d21('0x43')+'https://'+_0x3154dc[_0x9d21('0x44')][_0x9d21('0x22')]+_0x9d21('0x45')+_0x604173+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x9d21('0x19')](function(){_0x3f8098[_0x9d21('0x2f')](0xc8)[_0x9d21('0x30')]({'message':_0x9d21('0x46')});})[_0x9d21('0x47')](function(_0x28adbf){return handleError(_0x3f8098,0x1f4,_0x28adbf);});};exports[_0x9d21('0x48')]=function(_0x326bcf,_0x55dd34,_0x47a0f9){return db[_0x9d21('0x3c')][_0x9d21('0x49')]({'where':{'resetPasswordToken':_0x326bcf[_0x9d21('0x4a')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x9d21('0x19')](function(_0xee4c1b){if(!_0xee4c1b){throw new Error(_0x9d21('0x4b'));}return db[_0x9d21('0xb')][_0x9d21('0xc')]({'attributes':['id',_0x9d21('0x4c'),_0x9d21('0x4d'),_0x9d21('0x4e')]})[_0x9d21('0x19')](function(_0x327561){if(_0x327561[_0x9d21('0x4c')])authService[_0x9d21('0x4f')](_0x326bcf[_0x9d21('0x38')]['password']);if(!_0x327561[_0x9d21('0x4d')]||!_0xee4c1b['previousPasswords'])return _0xee4c1b;authService['validatePasswordHistory'](_0x326bcf['body'][_0x9d21('0x10')],_0xee4c1b[_0x9d21('0x50')],_0x327561[_0x9d21('0x4e')]);return _0xee4c1b;})[_0x9d21('0x19')](function(){_0xee4c1b[_0x9d21('0x10')]=_0x326bcf[_0x9d21('0x38')][_0x9d21('0x10')];_0xee4c1b['resetPasswordToken']=null;_0xee4c1b[_0x9d21('0x40')]=null;return _0xee4c1b['save']();});})[_0x9d21('0x19')](function(){_0x55dd34[_0x9d21('0x2f')](0xc8)[_0x9d21('0x30')]({'message':_0x9d21('0x51')});})[_0x9d21('0x47')](function(_0x15f119){return handleError(_0x55dd34,0x1f4,_0x15f119);});};passport[_0x9d21('0x52')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x574e5e,_0x1ecabd,_0x5b96eb){return localAuthenticate(db[_0x9d21('0x3c')],_0x574e5e,_0x1ecabd,_0x5b96eb);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index d0887aa..2a4cd7f 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 _0x01a0=['post','/forgot','forgot','/reset/:token','reset','./authLocal.controller'];(function(_0x31ec46,_0x389bc0){var _0x643e08=function(_0x39d2b0){while(--_0x39d2b0){_0x31ec46['push'](_0x31ec46['shift']());}};_0x643e08(++_0x389bc0);}(_0x01a0,0x17f));var _0x001a=function(_0x31f36d,_0xa1cd72){_0x31f36d=_0x31f36d-0x0;var _0x22a22d=_0x01a0[_0x31f36d];return _0x22a22d;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x001a('0x0'));router[_0x001a('0x1')]('/',controller['login']);router[_0x001a('0x1')](_0x001a('0x2'),controller[_0x001a('0x3')]);router['post'](_0x001a('0x4'),controller[_0x001a('0x5')]);module['exports']=router; \ No newline at end of file +var _0xa88c=['forgot','post','exports','login','/forgot'];(function(_0xb29e37,_0x3ab103){var _0x1d70c4=function(_0x297484){while(--_0x297484){_0xb29e37['push'](_0xb29e37['shift']());}};_0x1d70c4(++_0x3ab103);}(_0xa88c,0x1a7));var _0xca88=function(_0x2117dd,_0x36eb7d){_0x2117dd=_0x2117dd-0x0;var _0x218574=_0xa88c[_0x2117dd];return _0x218574;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller[_0xca88('0x0')]);router['post'](_0xca88('0x1'),controller[_0xca88('0x2')]);router[_0xca88('0x3')]('/reset/:token',controller['reset']);module[_0xca88('0x4')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e797d88..171adc7 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 _0x1e51=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x1e51,0x11a));var _0x11e5=function(_0x908741,_0x3b5d3d){_0x908741=_0x908741-0x0;var _0x3e332c=_0x1e51[_0x908741];return _0x3e332c;};'use strict';var Sequelize=require(_0x11e5('0x0'));module['exports']={'name':{'type':Sequelize[_0x11e5('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x11e5('0x1')]},'description':{'type':Sequelize[_0x11e5('0x1')]},'status':{'type':Sequelize[_0x11e5('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x11e5('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xe7fd=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe7fd,0xc6));var _0xde7f=function(_0x42feb5,_0x152622){_0x42feb5=_0x42feb5-0x0;var _0x1f350d=_0xe7fd[_0x42feb5];return _0x1f350d;};'use strict';var Sequelize=require(_0xde7f('0x0'));module[_0xde7f('0x1')]={'name':{'type':Sequelize[_0xde7f('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xde7f('0x2')]},'description':{'type':Sequelize[_0xde7f('0x2')]},'status':{'type':Sequelize[_0xde7f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xde7f('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 70559ae..8842d8d 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 _0x0179=['offset','undefined','count','limit','set','apply','reject','save','then','destroy','end','error','stack','name','map','Automation','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','catch','create','body','update','params','Condition','addConditions','ids','omit','findOne','filter','getConditions','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json'];(function(_0x21c0e2,_0x105108){var _0x45ca68=function(_0x1d3bd5){while(--_0x1d3bd5){_0x21c0e2['push'](_0x21c0e2['shift']());}};_0x45ca68(++_0x105108);}(_0x0179,0x135));var _0x9017=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x0179[_0x2555d0];return _0x3bb486;};'use strict';var emlformat=require(_0x9017('0x0'));var rimraf=require(_0x9017('0x1'));var zipdir=require(_0x9017('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9017('0x3'));var moment=require(_0x9017('0x4'));var BPromise=require(_0x9017('0x5'));var Mustache=require(_0x9017('0x6'));var util=require('util');var path=require(_0x9017('0x7'));var sox=require(_0x9017('0x8'));var csv=require(_0x9017('0x9'));var ejs=require(_0x9017('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9017('0xb'));var squel=require(_0x9017('0xc'));var crypto=require(_0x9017('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9017('0xe'));var toCsv=require(_0x9017('0x9'));var querystring=require('querystring');var Papa=require(_0x9017('0xf'));var Redis=require(_0x9017('0x10'));var authService=require(_0x9017('0x11'));var qs=require(_0x9017('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9017('0x13'));var logger=require(_0x9017('0x14'))(_0x9017('0x15'));var utils=require(_0x9017('0x16'));var config=require(_0x9017('0x17'));var licenseUtil=require(_0x9017('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1714b8,_0x39d10d){_0x39d10d=_0x39d10d||0xcc;return function(_0x303c66){if(_0x303c66){return _0x1714b8['sendStatus'](_0x39d10d);}return _0x1714b8[_0x9017('0x19')](_0x39d10d)['end']();};}function respondWithResult(_0x378ccb,_0x49fbad){_0x49fbad=_0x49fbad||0xc8;return function(_0x4310c7){if(_0x4310c7){return _0x378ccb['status'](_0x49fbad)[_0x9017('0x1a')](_0x4310c7);}};}function respondWithFilteredResult(_0x585ab2,_0xc17eee){return function(_0x511c9b){if(_0x511c9b){var _0x5332cb=typeof _0xc17eee[_0x9017('0x1b')]===_0x9017('0x1c')&&typeof _0xc17eee['limit']===_0x9017('0x1c');var _0x3017fe=_0x511c9b[_0x9017('0x1d')];var _0x4dfac3=_0x5332cb?0x0:_0xc17eee[_0x9017('0x1b')];var _0x38b5a6=_0x5332cb?_0x511c9b[_0x9017('0x1d')]:_0xc17eee['offset']+_0xc17eee[_0x9017('0x1e')];var _0x3c7dfc;if(_0x38b5a6>=_0x3017fe){_0x38b5a6=_0x3017fe;_0x3c7dfc=0xc8;}else{_0x3c7dfc=0xce;}_0x585ab2[_0x9017('0x19')](_0x3c7dfc);return _0x585ab2[_0x9017('0x1f')]('Content-Range',_0x4dfac3+'-'+_0x38b5a6+'/'+_0x3017fe)[_0x9017('0x1a')](_0x511c9b);}return null;};}function patchUpdates(_0x16bad0){return function(_0x3d8384){try{jsonpatch[_0x9017('0x20')](_0x3d8384,_0x16bad0,!![]);}catch(_0x3e96ca){return BPromise[_0x9017('0x21')](_0x3e96ca);}return _0x3d8384[_0x9017('0x22')]();};}function saveUpdates(_0x30cd34,_0x3a6e42){return function(_0x4cbd7b){if(_0x4cbd7b){return _0x4cbd7b['update'](_0x30cd34)[_0x9017('0x23')](function(_0x3d5158){return _0x3d5158;});}return null;};}function removeEntity(_0x277584,_0x5b4508){return function(_0x11211b){if(_0x11211b){return _0x11211b[_0x9017('0x24')]()[_0x9017('0x23')](function(){_0x277584[_0x9017('0x19')](0xcc)[_0x9017('0x25')]();});}};}function handleEntityNotFound(_0x33e4e2,_0x392b5f){return function(_0x167943){if(!_0x167943){_0x33e4e2['sendStatus'](0x194);}return _0x167943;};}function handleError(_0xea1f38,_0x537e43){_0x537e43=_0x537e43||0x1f4;return function(_0x167636){logger[_0x9017('0x26')](_0x167636[_0x9017('0x27')]);if(_0x167636[_0x9017('0x28')]){delete _0x167636[_0x9017('0x28')];}_0xea1f38[_0x9017('0x19')](_0x537e43)['send'](_0x167636);};}exports['index']=function(_0x2804b7,_0x369917){var _0x286e34={},_0x1a6573={},_0x1346f0={'count':0x0,'rows':[]};var _0xed7199=_[_0x9017('0x29')](db[_0x9017('0x2a')][_0x9017('0x2b')],function(_0x21b9c7){return{'name':_0x21b9c7[_0x9017('0x2c')],'type':_0x21b9c7[_0x9017('0x2d')]['key']};});_0x1a6573['model']=_[_0x9017('0x29')](_0xed7199,'name');_0x1a6573[_0x9017('0x2e')]=_[_0x9017('0x2f')](_0x2804b7[_0x9017('0x2e')]);_0x1a6573[_0x9017('0x30')]=_['intersection'](_0x1a6573['model'],_0x1a6573['query']);_0x286e34[_0x9017('0x31')]=_[_0x9017('0x32')](_0x1a6573[_0x9017('0x33')],qs[_0x9017('0x34')](_0x2804b7[_0x9017('0x2e')][_0x9017('0x34')]));_0x286e34[_0x9017('0x31')]=_0x286e34[_0x9017('0x31')][_0x9017('0x35')]?_0x286e34['attributes']:_0x1a6573[_0x9017('0x33')];if(!_0x2804b7[_0x9017('0x2e')]['hasOwnProperty'](_0x9017('0x36'))){_0x286e34[_0x9017('0x1e')]=qs[_0x9017('0x1e')](_0x2804b7[_0x9017('0x2e')]['limit']);_0x286e34[_0x9017('0x1b')]=qs[_0x9017('0x1b')](_0x2804b7[_0x9017('0x2e')][_0x9017('0x1b')]);}_0x286e34[_0x9017('0x37')]=qs[_0x9017('0x38')](_0x2804b7[_0x9017('0x2e')][_0x9017('0x38')]);_0x286e34[_0x9017('0x39')]=qs[_0x9017('0x30')](_[_0x9017('0x3a')](_0x2804b7[_0x9017('0x2e')],_0x1a6573[_0x9017('0x30')]),_0xed7199);if(_0x2804b7[_0x9017('0x2e')]['filter']){_0x286e34['where']=_[_0x9017('0x3b')](_0x286e34[_0x9017('0x39')],{'$or':_['map'](_0xed7199,function(_0x1fc914){if(_0x1fc914[_0x9017('0x2d')]!==_0x9017('0x3c')){var _0x155be3={};_0x155be3[_0x1fc914[_0x9017('0x28')]]={'$like':'%'+_0x2804b7[_0x9017('0x2e')]['filter']+'%'};return _0x155be3;}})});}_0x286e34=_[_0x9017('0x3b')]({},_0x286e34,_0x2804b7[_0x9017('0x3d')]);var _0x469510={'where':_0x286e34[_0x9017('0x39')]};return db[_0x9017('0x2a')]['count'](_0x469510)[_0x9017('0x23')](function(_0x415fdc){_0x1346f0['count']=_0x415fdc;if(_0x2804b7[_0x9017('0x2e')]['includeAll']){_0x286e34[_0x9017('0x3e')]=[{'all':!![]}];}return db[_0x9017('0x2a')][_0x9017('0x3f')](_0x286e34);})[_0x9017('0x23')](function(_0x1341f2){_0x1346f0[_0x9017('0x40')]=_0x1341f2;return _0x1346f0;})[_0x9017('0x23')](respondWithFilteredResult(_0x369917,_0x286e34))['catch'](handleError(_0x369917,null));};exports[_0x9017('0x41')]=function(_0x5d7c7c,_0x1aad26){var _0x4abe5c={'raw':![],'where':{'id':_0x5d7c7c['params']['id']}},_0x41b4cc={};_0x41b4cc[_0x9017('0x33')]=_['keys'](db[_0x9017('0x2a')]['rawAttributes']);_0x41b4cc[_0x9017('0x2e')]=_['keys'](_0x5d7c7c[_0x9017('0x2e')]);_0x41b4cc[_0x9017('0x30')]=_[_0x9017('0x32')](_0x41b4cc[_0x9017('0x33')],_0x41b4cc['query']);_0x4abe5c['attributes']=_[_0x9017('0x32')](_0x41b4cc[_0x9017('0x33')],qs[_0x9017('0x34')](_0x5d7c7c[_0x9017('0x2e')][_0x9017('0x34')]));_0x4abe5c[_0x9017('0x31')]=_0x4abe5c['attributes']['length']?_0x4abe5c['attributes']:_0x41b4cc[_0x9017('0x33')];if(_0x5d7c7c[_0x9017('0x2e')][_0x9017('0x42')]){_0x4abe5c[_0x9017('0x3e')]=[{'all':!![]}];}_0x4abe5c=_[_0x9017('0x3b')]({},_0x4abe5c,_0x5d7c7c['options']);return db[_0x9017('0x2a')][_0x9017('0x43')](_0x4abe5c)[_0x9017('0x23')](handleEntityNotFound(_0x1aad26,null))[_0x9017('0x23')](respondWithResult(_0x1aad26,null))[_0x9017('0x44')](handleError(_0x1aad26,null));};exports[_0x9017('0x45')]=function(_0x1f4abd,_0x5866e4){return db[_0x9017('0x2a')][_0x9017('0x45')](_0x1f4abd[_0x9017('0x46')],{})[_0x9017('0x23')](respondWithResult(_0x5866e4,0xc9))['catch'](handleError(_0x5866e4,null));};exports[_0x9017('0x47')]=function(_0x4cfcf0,_0xc24d6d){if(_0x4cfcf0[_0x9017('0x46')]['id']){delete _0x4cfcf0[_0x9017('0x46')]['id'];}return db[_0x9017('0x2a')]['find']({'where':{'id':_0x4cfcf0[_0x9017('0x48')]['id']}})[_0x9017('0x23')](handleEntityNotFound(_0xc24d6d,null))['then'](saveUpdates(_0x4cfcf0[_0x9017('0x46')],null))[_0x9017('0x23')](respondWithResult(_0xc24d6d,null))[_0x9017('0x44')](handleError(_0xc24d6d,null));};exports[_0x9017('0x24')]=function(_0x83731e,_0x57588d){return db[_0x9017('0x2a')][_0x9017('0x43')]({'where':{'id':_0x83731e[_0x9017('0x48')]['id']}})['then'](handleEntityNotFound(_0x57588d,null))[_0x9017('0x23')](removeEntity(_0x57588d,null))[_0x9017('0x44')](handleError(_0x57588d,null));};exports['addConditions']=function(_0x26cf4b,_0x5665c3,_0xedfbe1){return db[_0x9017('0x49')]['find']({'where':{'id':_0x26cf4b[_0x9017('0x48')]['id']}})[_0x9017('0x23')](handleEntityNotFound(_0x5665c3,null))[_0x9017('0x23')](function(_0x2a4717){if(_0x2a4717){return _0x2a4717[_0x9017('0x4a')](_0x26cf4b[_0x9017('0x46')][_0x9017('0x4b')],_[_0x9017('0x4c')](_0x26cf4b[_0x9017('0x46')],[_0x9017('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x5665c3,null))['catch'](handleError(_0x5665c3,null));};exports['getConditions']=function(_0x396046,_0x58cd24,_0x4abf19){var _0x38259b={};var _0x4c4232={};var _0x2685c8;var _0x3bc6ab;return db[_0x9017('0x2a')][_0x9017('0x4d')]({'where':{'id':_0x396046[_0x9017('0x48')]['id']}})[_0x9017('0x23')](handleEntityNotFound(_0x58cd24,null))['then'](function(_0x383f99){if(_0x383f99){_0x2685c8=_0x383f99;_0x4c4232[_0x9017('0x33')]=_[_0x9017('0x2f')](db['Condition'][_0x9017('0x2b')]);_0x4c4232[_0x9017('0x2e')]=_[_0x9017('0x2f')](_0x396046[_0x9017('0x2e')]);_0x4c4232[_0x9017('0x30')]=_[_0x9017('0x32')](_0x4c4232['model'],_0x4c4232[_0x9017('0x2e')]);_0x38259b[_0x9017('0x31')]=_['intersection'](_0x4c4232[_0x9017('0x33')],qs[_0x9017('0x34')](_0x396046[_0x9017('0x2e')][_0x9017('0x34')]));_0x38259b['attributes']=_0x38259b[_0x9017('0x31')][_0x9017('0x35')]?_0x38259b[_0x9017('0x31')]:_0x4c4232[_0x9017('0x33')];_0x38259b[_0x9017('0x37')]=qs[_0x9017('0x38')](_0x396046[_0x9017('0x2e')]['sort']);_0x38259b[_0x9017('0x39')]=qs[_0x9017('0x30')](_[_0x9017('0x3a')](_0x396046[_0x9017('0x2e')],_0x4c4232['filters']));if(_0x396046[_0x9017('0x2e')][_0x9017('0x4e')]){_0x38259b[_0x9017('0x39')]=_[_0x9017('0x3b')](_0x38259b[_0x9017('0x39')],{'$or':_['map'](_0x38259b['attributes'],function(_0x3e7a8e){var _0x4c75c8={};_0x4c75c8[_0x3e7a8e]={'$like':'%'+_0x396046[_0x9017('0x2e')]['filter']+'%'};return _0x4c75c8;})});}_0x38259b=_[_0x9017('0x3b')]({},_0x38259b,_0x396046['options']);return _0x2685c8[_0x9017('0x4f')](_0x38259b);}})['then'](function(_0x3e812e){if(_0x3e812e){_0x3bc6ab=_0x3e812e[_0x9017('0x35')];if(!_0x396046[_0x9017('0x2e')][_0x9017('0x50')](_0x9017('0x36'))){_0x38259b['limit']=qs[_0x9017('0x1e')](_0x396046[_0x9017('0x2e')][_0x9017('0x1e')]);_0x38259b[_0x9017('0x1b')]=qs[_0x9017('0x1b')](_0x396046[_0x9017('0x2e')][_0x9017('0x1b')]);}return _0x2685c8[_0x9017('0x4f')](_0x38259b);}})[_0x9017('0x23')](function(_0x21c969){if(_0x21c969){return _0x21c969?{'count':_0x3bc6ab,'rows':_0x21c969}:null;}})['then'](respondWithResult(_0x58cd24,null))[_0x9017('0x44')](handleError(_0x58cd24,null));};exports[_0x9017('0x51')]=function(_0x4a8ddd,_0x11fb3,_0x543162){return db[_0x9017('0x52')][_0x9017('0x43')]({'where':{'id':_0x4a8ddd[_0x9017('0x48')]['id']}})[_0x9017('0x23')](handleEntityNotFound(_0x11fb3,null))[_0x9017('0x23')](function(_0x4b5ae0){if(_0x4b5ae0){return _0x4b5ae0[_0x9017('0x51')](_0x4a8ddd[_0x9017('0x46')][_0x9017('0x4b')],_[_0x9017('0x4c')](_0x4a8ddd[_0x9017('0x46')],[_0x9017('0x4b'),'id'])||{});}})[_0x9017('0x23')](respondWithResult(_0x11fb3,null))[_0x9017('0x44')](handleError(_0x11fb3,null));};exports[_0x9017('0x53')]=function(_0x4e0af6,_0x58beec,_0x38cfaa){var _0xc8dd6c={};var _0xce8f7a={};var _0x55d12a;var _0x182d22;return db[_0x9017('0x2a')][_0x9017('0x4d')]({'where':{'id':_0x4e0af6['params']['id']}})[_0x9017('0x23')](handleEntityNotFound(_0x58beec,null))['then'](function(_0x4dded4){if(_0x4dded4){_0x55d12a=_0x4dded4;_0xce8f7a['model']=_['keys'](db[_0x9017('0x52')][_0x9017('0x2b')]);_0xce8f7a[_0x9017('0x2e')]=_['keys'](_0x4e0af6[_0x9017('0x2e')]);_0xce8f7a[_0x9017('0x30')]=_['intersection'](_0xce8f7a[_0x9017('0x33')],_0xce8f7a[_0x9017('0x2e')]);_0xc8dd6c[_0x9017('0x31')]=_['intersection'](_0xce8f7a[_0x9017('0x33')],qs['fields'](_0x4e0af6['query'][_0x9017('0x34')]));_0xc8dd6c['attributes']=_0xc8dd6c['attributes'][_0x9017('0x35')]?_0xc8dd6c[_0x9017('0x31')]:_0xce8f7a['model'];_0xc8dd6c[_0x9017('0x37')]=qs[_0x9017('0x38')](_0x4e0af6[_0x9017('0x2e')][_0x9017('0x38')]);_0xc8dd6c[_0x9017('0x39')]=qs[_0x9017('0x30')](_[_0x9017('0x3a')](_0x4e0af6[_0x9017('0x2e')],_0xce8f7a[_0x9017('0x30')]));if(_0x4e0af6[_0x9017('0x2e')]['filter']){_0xc8dd6c[_0x9017('0x39')]=_[_0x9017('0x3b')](_0xc8dd6c['where'],{'$or':_[_0x9017('0x29')](_0xc8dd6c[_0x9017('0x31')],function(_0x8ce2ba){var _0x4bb77c={};_0x4bb77c[_0x8ce2ba]={'$like':'%'+_0x4e0af6[_0x9017('0x2e')][_0x9017('0x4e')]+'%'};return _0x4bb77c;})});}_0xc8dd6c=_[_0x9017('0x3b')]({},_0xc8dd6c,_0x4e0af6[_0x9017('0x3d')]);return _0x55d12a[_0x9017('0x53')](_0xc8dd6c);}})[_0x9017('0x23')](function(_0x353b5a){if(_0x353b5a){_0x182d22=_0x353b5a['length'];if(!_0x4e0af6['query'][_0x9017('0x50')]('nolimit')){_0xc8dd6c['limit']=qs['limit'](_0x4e0af6[_0x9017('0x2e')]['limit']);_0xc8dd6c[_0x9017('0x1b')]=qs['offset'](_0x4e0af6[_0x9017('0x2e')][_0x9017('0x1b')]);}return _0x55d12a[_0x9017('0x53')](_0xc8dd6c);}})['then'](function(_0x31c8e2){if(_0x31c8e2){return _0x31c8e2?{'count':_0x182d22,'rows':_0x31c8e2}:null;}})['then'](respondWithResult(_0x58beec,null))[_0x9017('0x44')](handleError(_0x58beec,null));}; \ No newline at end of file +var _0xd238=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','send','map','rawAttributes','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Automation','includeAll','include','findAll','rows','catch','params','options','create','body','update','find','addConditions','Condition','ids','omit','getConditions','findOne','keys','addActions','getActions','Action','filter','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xd238,0x99));var _0x8d23=function(_0x524392,_0xb7304e){_0x524392=_0x524392-0x0;var _0x5d8d55=_0xd238[_0x524392];return _0x5d8d55;};'use strict';var emlformat=require(_0x8d23('0x0'));var rimraf=require(_0x8d23('0x1'));var zipdir=require(_0x8d23('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d23('0x3'));var moment=require(_0x8d23('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d23('0x5'));var util=require(_0x8d23('0x6'));var path=require('path');var sox=require(_0x8d23('0x7'));var csv=require('to-csv');var ejs=require(_0x8d23('0x8'));var fs=require('fs');var fs_extra=require(_0x8d23('0x9'));var _=require(_0x8d23('0xa'));var squel=require(_0x8d23('0xb'));var crypto=require(_0x8d23('0xc'));var jsforce=require(_0x8d23('0xd'));var deskjs=require(_0x8d23('0xe'));var toCsv=require(_0x8d23('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8d23('0x10'));var authService=require(_0x8d23('0x11'));var qs=require(_0x8d23('0x12'));var as=require(_0x8d23('0x13'));var hardwareService=require(_0x8d23('0x14'));var logger=require(_0x8d23('0x15'))(_0x8d23('0x16'));var utils=require(_0x8d23('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8d23('0x18'));var db=require(_0x8d23('0x19'))['db'];function respondWithStatusCode(_0x3e28c7,_0x426a8f){_0x426a8f=_0x426a8f||0xcc;return function(_0x27d186){if(_0x27d186){return _0x3e28c7[_0x8d23('0x1a')](_0x426a8f);}return _0x3e28c7[_0x8d23('0x1b')](_0x426a8f)[_0x8d23('0x1c')]();};}function respondWithResult(_0x4f1b34,_0x415bba){_0x415bba=_0x415bba||0xc8;return function(_0x4479e5){if(_0x4479e5){return _0x4f1b34['status'](_0x415bba)[_0x8d23('0x1d')](_0x4479e5);}};}function respondWithFilteredResult(_0x4f6958,_0x293fcf){return function(_0x401e57){if(_0x401e57){var _0xb1dd82=typeof _0x293fcf['offset']===_0x8d23('0x1e')&&typeof _0x293fcf[_0x8d23('0x1f')]===_0x8d23('0x1e');var _0x4b3b36=_0x401e57[_0x8d23('0x20')];var _0x4cd7f0=_0xb1dd82?0x0:_0x293fcf[_0x8d23('0x21')];var _0x33aa72=_0xb1dd82?_0x401e57[_0x8d23('0x20')]:_0x293fcf[_0x8d23('0x21')]+_0x293fcf[_0x8d23('0x1f')];var _0xedd0f2;if(_0x33aa72>=_0x4b3b36){_0x33aa72=_0x4b3b36;_0xedd0f2=0xc8;}else{_0xedd0f2=0xce;}_0x4f6958[_0x8d23('0x1b')](_0xedd0f2);return _0x4f6958[_0x8d23('0x22')](_0x8d23('0x23'),_0x4cd7f0+'-'+_0x33aa72+'/'+_0x4b3b36)['json'](_0x401e57);}return null;};}function patchUpdates(_0x535f06){return function(_0x1db795){try{jsonpatch[_0x8d23('0x24')](_0x1db795,_0x535f06,!![]);}catch(_0xad5a19){return BPromise[_0x8d23('0x25')](_0xad5a19);}return _0x1db795['save']();};}function saveUpdates(_0x4deec0,_0x127cd4){return function(_0x23508b){if(_0x23508b){return _0x23508b['update'](_0x4deec0)[_0x8d23('0x26')](function(_0x2428a7){return _0x2428a7;});}return null;};}function removeEntity(_0x23510a,_0x14a9bb){return function(_0x2ec195){if(_0x2ec195){return _0x2ec195[_0x8d23('0x27')]()['then'](function(){_0x23510a['status'](0xcc)[_0x8d23('0x1c')]();});}};}function handleEntityNotFound(_0x32742d,_0x3a319c){return function(_0x30f17c){if(!_0x30f17c){_0x32742d['sendStatus'](0x194);}return _0x30f17c;};}function handleError(_0x3f9ce6,_0x3b9c88){_0x3b9c88=_0x3b9c88||0x1f4;return function(_0xc8c9fe){logger[_0x8d23('0x28')](_0xc8c9fe[_0x8d23('0x29')]);if(_0xc8c9fe['name']){delete _0xc8c9fe['name'];}_0x3f9ce6[_0x8d23('0x1b')](_0x3b9c88)[_0x8d23('0x2a')](_0xc8c9fe);};}exports['index']=function(_0x5d195d,_0x46a2ba){var _0x16ce75={},_0x36a7de={},_0x5613b2={'count':0x0,'rows':[]};var _0x32405c=_[_0x8d23('0x2b')](db['Automation'][_0x8d23('0x2c')],function(_0x365499){return{'name':_0x365499['fieldName'],'type':_0x365499[_0x8d23('0x2d')]['key']};});_0x36a7de['model']=_[_0x8d23('0x2b')](_0x32405c,_0x8d23('0x2e'));_0x36a7de['query']=_['keys'](_0x5d195d[_0x8d23('0x2f')]);_0x36a7de[_0x8d23('0x30')]=_[_0x8d23('0x31')](_0x36a7de[_0x8d23('0x32')],_0x36a7de[_0x8d23('0x2f')]);_0x16ce75[_0x8d23('0x33')]=_[_0x8d23('0x31')](_0x36a7de[_0x8d23('0x32')],qs['fields'](_0x5d195d[_0x8d23('0x2f')][_0x8d23('0x34')]));_0x16ce75[_0x8d23('0x33')]=_0x16ce75[_0x8d23('0x33')][_0x8d23('0x35')]?_0x16ce75[_0x8d23('0x33')]:_0x36a7de['model'];if(!_0x5d195d[_0x8d23('0x2f')][_0x8d23('0x36')](_0x8d23('0x37'))){_0x16ce75[_0x8d23('0x1f')]=qs[_0x8d23('0x1f')](_0x5d195d[_0x8d23('0x2f')][_0x8d23('0x1f')]);_0x16ce75[_0x8d23('0x21')]=qs[_0x8d23('0x21')](_0x5d195d[_0x8d23('0x2f')][_0x8d23('0x21')]);}_0x16ce75[_0x8d23('0x38')]=qs[_0x8d23('0x39')](_0x5d195d[_0x8d23('0x2f')][_0x8d23('0x39')]);_0x16ce75[_0x8d23('0x3a')]=qs[_0x8d23('0x30')](_[_0x8d23('0x3b')](_0x5d195d[_0x8d23('0x2f')],_0x36a7de[_0x8d23('0x30')]),_0x32405c);if(_0x5d195d[_0x8d23('0x2f')]['filter']){_0x16ce75[_0x8d23('0x3a')]=_[_0x8d23('0x3c')](_0x16ce75['where'],{'$or':_[_0x8d23('0x2b')](_0x32405c,function(_0x51a88b){if(_0x51a88b[_0x8d23('0x2d')]!==_0x8d23('0x3d')){var _0x22b7df={};_0x22b7df[_0x51a88b[_0x8d23('0x2e')]]={'$like':'%'+_0x5d195d[_0x8d23('0x2f')]['filter']+'%'};return _0x22b7df;}})});}_0x16ce75=_['merge']({},_0x16ce75,_0x5d195d['options']);var _0x14b367={'where':_0x16ce75[_0x8d23('0x3a')]};return db[_0x8d23('0x3e')][_0x8d23('0x20')](_0x14b367)[_0x8d23('0x26')](function(_0x1c0348){_0x5613b2[_0x8d23('0x20')]=_0x1c0348;if(_0x5d195d['query'][_0x8d23('0x3f')]){_0x16ce75[_0x8d23('0x40')]=[{'all':!![]}];}return db[_0x8d23('0x3e')][_0x8d23('0x41')](_0x16ce75);})[_0x8d23('0x26')](function(_0x56ab6d){_0x5613b2[_0x8d23('0x42')]=_0x56ab6d;return _0x5613b2;})['then'](respondWithFilteredResult(_0x46a2ba,_0x16ce75))[_0x8d23('0x43')](handleError(_0x46a2ba,null));};exports['show']=function(_0x404000,_0x5e926a){var _0x25dc25={'raw':![],'where':{'id':_0x404000[_0x8d23('0x44')]['id']}},_0x27f899={};_0x27f899['model']=_['keys'](db[_0x8d23('0x3e')][_0x8d23('0x2c')]);_0x27f899[_0x8d23('0x2f')]=_['keys'](_0x404000[_0x8d23('0x2f')]);_0x27f899[_0x8d23('0x30')]=_[_0x8d23('0x31')](_0x27f899['model'],_0x27f899[_0x8d23('0x2f')]);_0x25dc25[_0x8d23('0x33')]=_['intersection'](_0x27f899[_0x8d23('0x32')],qs[_0x8d23('0x34')](_0x404000[_0x8d23('0x2f')][_0x8d23('0x34')]));_0x25dc25['attributes']=_0x25dc25[_0x8d23('0x33')]['length']?_0x25dc25['attributes']:_0x27f899[_0x8d23('0x32')];if(_0x404000['query'][_0x8d23('0x3f')]){_0x25dc25[_0x8d23('0x40')]=[{'all':!![]}];}_0x25dc25=_['merge']({},_0x25dc25,_0x404000[_0x8d23('0x45')]);return db[_0x8d23('0x3e')]['find'](_0x25dc25)['then'](handleEntityNotFound(_0x5e926a,null))['then'](respondWithResult(_0x5e926a,null))[_0x8d23('0x43')](handleError(_0x5e926a,null));};exports['create']=function(_0x4d85b1,_0x5328b6){return db['Automation'][_0x8d23('0x46')](_0x4d85b1[_0x8d23('0x47')],{})[_0x8d23('0x26')](respondWithResult(_0x5328b6,0xc9))[_0x8d23('0x43')](handleError(_0x5328b6,null));};exports[_0x8d23('0x48')]=function(_0x35dccf,_0x4c868e){if(_0x35dccf[_0x8d23('0x47')]['id']){delete _0x35dccf[_0x8d23('0x47')]['id'];}return db[_0x8d23('0x3e')][_0x8d23('0x49')]({'where':{'id':_0x35dccf[_0x8d23('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c868e,null))[_0x8d23('0x26')](saveUpdates(_0x35dccf[_0x8d23('0x47')],null))[_0x8d23('0x26')](respondWithResult(_0x4c868e,null))[_0x8d23('0x43')](handleError(_0x4c868e,null));};exports['destroy']=function(_0x57c69f,_0x5a7c4c){return db[_0x8d23('0x3e')][_0x8d23('0x49')]({'where':{'id':_0x57c69f[_0x8d23('0x44')]['id']}})[_0x8d23('0x26')](handleEntityNotFound(_0x5a7c4c,null))[_0x8d23('0x26')](removeEntity(_0x5a7c4c,null))['catch'](handleError(_0x5a7c4c,null));};exports[_0x8d23('0x4a')]=function(_0x24d3df,_0x248176,_0x180fee){return db[_0x8d23('0x4b')]['find']({'where':{'id':_0x24d3df[_0x8d23('0x44')]['id']}})[_0x8d23('0x26')](handleEntityNotFound(_0x248176,null))[_0x8d23('0x26')](function(_0x5ecbb4){if(_0x5ecbb4){return _0x5ecbb4[_0x8d23('0x4a')](_0x24d3df[_0x8d23('0x47')][_0x8d23('0x4c')],_[_0x8d23('0x4d')](_0x24d3df['body'],[_0x8d23('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x248176,null))[_0x8d23('0x43')](handleError(_0x248176,null));};exports[_0x8d23('0x4e')]=function(_0x1dd22c,_0x4f73ea,_0x45b829){var _0x3a0365={};var _0x226093={};var _0x196078;var _0x2f7164;return db[_0x8d23('0x3e')][_0x8d23('0x4f')]({'where':{'id':_0x1dd22c['params']['id']}})[_0x8d23('0x26')](handleEntityNotFound(_0x4f73ea,null))['then'](function(_0x424ccd){if(_0x424ccd){_0x196078=_0x424ccd;_0x226093[_0x8d23('0x32')]=_['keys'](db[_0x8d23('0x4b')]['rawAttributes']);_0x226093['query']=_[_0x8d23('0x50')](_0x1dd22c[_0x8d23('0x2f')]);_0x226093[_0x8d23('0x30')]=_['intersection'](_0x226093[_0x8d23('0x32')],_0x226093[_0x8d23('0x2f')]);_0x3a0365['attributes']=_[_0x8d23('0x31')](_0x226093[_0x8d23('0x32')],qs[_0x8d23('0x34')](_0x1dd22c[_0x8d23('0x2f')][_0x8d23('0x34')]));_0x3a0365[_0x8d23('0x33')]=_0x3a0365[_0x8d23('0x33')][_0x8d23('0x35')]?_0x3a0365[_0x8d23('0x33')]:_0x226093['model'];_0x3a0365[_0x8d23('0x38')]=qs[_0x8d23('0x39')](_0x1dd22c[_0x8d23('0x2f')][_0x8d23('0x39')]);_0x3a0365[_0x8d23('0x3a')]=qs[_0x8d23('0x30')](_[_0x8d23('0x3b')](_0x1dd22c[_0x8d23('0x2f')],_0x226093[_0x8d23('0x30')]));if(_0x1dd22c[_0x8d23('0x2f')]['filter']){_0x3a0365[_0x8d23('0x3a')]=_[_0x8d23('0x3c')](_0x3a0365[_0x8d23('0x3a')],{'$or':_['map'](_0x3a0365['attributes'],function(_0x81bc13){var _0x123840={};_0x123840[_0x81bc13]={'$like':'%'+_0x1dd22c[_0x8d23('0x2f')]['filter']+'%'};return _0x123840;})});}_0x3a0365=_[_0x8d23('0x3c')]({},_0x3a0365,_0x1dd22c[_0x8d23('0x45')]);return _0x196078[_0x8d23('0x4e')](_0x3a0365);}})['then'](function(_0x5bf213){if(_0x5bf213){_0x2f7164=_0x5bf213['length'];if(!_0x1dd22c[_0x8d23('0x2f')][_0x8d23('0x36')](_0x8d23('0x37'))){_0x3a0365[_0x8d23('0x1f')]=qs['limit'](_0x1dd22c[_0x8d23('0x2f')][_0x8d23('0x1f')]);_0x3a0365['offset']=qs[_0x8d23('0x21')](_0x1dd22c[_0x8d23('0x2f')][_0x8d23('0x21')]);}return _0x196078[_0x8d23('0x4e')](_0x3a0365);}})['then'](function(_0x340516){if(_0x340516){return _0x340516?{'count':_0x2f7164,'rows':_0x340516}:null;}})[_0x8d23('0x26')](respondWithResult(_0x4f73ea,null))[_0x8d23('0x43')](handleError(_0x4f73ea,null));};exports['addActions']=function(_0x46486e,_0x3c4ae5,_0x3aecd1){return db['Action'][_0x8d23('0x49')]({'where':{'id':_0x46486e[_0x8d23('0x44')]['id']}})[_0x8d23('0x26')](handleEntityNotFound(_0x3c4ae5,null))[_0x8d23('0x26')](function(_0x1cb82a){if(_0x1cb82a){return _0x1cb82a[_0x8d23('0x51')](_0x46486e[_0x8d23('0x47')][_0x8d23('0x4c')],_[_0x8d23('0x4d')](_0x46486e['body'],[_0x8d23('0x4c'),'id'])||{});}})[_0x8d23('0x26')](respondWithResult(_0x3c4ae5,null))[_0x8d23('0x43')](handleError(_0x3c4ae5,null));};exports[_0x8d23('0x52')]=function(_0x581745,_0x2f0f13,_0x1a97cf){var _0x2aac9e={};var _0x4734f8={};var _0x404cfe;var _0x547e71;return db[_0x8d23('0x3e')][_0x8d23('0x4f')]({'where':{'id':_0x581745[_0x8d23('0x44')]['id']}})[_0x8d23('0x26')](handleEntityNotFound(_0x2f0f13,null))[_0x8d23('0x26')](function(_0x113c96){if(_0x113c96){_0x404cfe=_0x113c96;_0x4734f8[_0x8d23('0x32')]=_['keys'](db[_0x8d23('0x53')][_0x8d23('0x2c')]);_0x4734f8[_0x8d23('0x2f')]=_[_0x8d23('0x50')](_0x581745[_0x8d23('0x2f')]);_0x4734f8['filters']=_[_0x8d23('0x31')](_0x4734f8[_0x8d23('0x32')],_0x4734f8[_0x8d23('0x2f')]);_0x2aac9e[_0x8d23('0x33')]=_['intersection'](_0x4734f8['model'],qs[_0x8d23('0x34')](_0x581745[_0x8d23('0x2f')][_0x8d23('0x34')]));_0x2aac9e[_0x8d23('0x33')]=_0x2aac9e[_0x8d23('0x33')][_0x8d23('0x35')]?_0x2aac9e[_0x8d23('0x33')]:_0x4734f8[_0x8d23('0x32')];_0x2aac9e[_0x8d23('0x38')]=qs[_0x8d23('0x39')](_0x581745['query'][_0x8d23('0x39')]);_0x2aac9e[_0x8d23('0x3a')]=qs[_0x8d23('0x30')](_[_0x8d23('0x3b')](_0x581745[_0x8d23('0x2f')],_0x4734f8[_0x8d23('0x30')]));if(_0x581745[_0x8d23('0x2f')][_0x8d23('0x54')]){_0x2aac9e[_0x8d23('0x3a')]=_[_0x8d23('0x3c')](_0x2aac9e[_0x8d23('0x3a')],{'$or':_[_0x8d23('0x2b')](_0x2aac9e['attributes'],function(_0x2b5553){var _0x125a22={};_0x125a22[_0x2b5553]={'$like':'%'+_0x581745[_0x8d23('0x2f')][_0x8d23('0x54')]+'%'};return _0x125a22;})});}_0x2aac9e=_[_0x8d23('0x3c')]({},_0x2aac9e,_0x581745[_0x8d23('0x45')]);return _0x404cfe[_0x8d23('0x52')](_0x2aac9e);}})[_0x8d23('0x26')](function(_0x218621){if(_0x218621){_0x547e71=_0x218621[_0x8d23('0x35')];if(!_0x581745['query'][_0x8d23('0x36')]('nolimit')){_0x2aac9e[_0x8d23('0x1f')]=qs[_0x8d23('0x1f')](_0x581745[_0x8d23('0x2f')][_0x8d23('0x1f')]);_0x2aac9e[_0x8d23('0x21')]=qs['offset'](_0x581745[_0x8d23('0x2f')][_0x8d23('0x21')]);}return _0x404cfe[_0x8d23('0x52')](_0x2aac9e);}})[_0x8d23('0x26')](function(_0x1a3545){if(_0x1a3545){return _0x1a3545?{'count':_0x547e71,'rows':_0x1a3545}:null;}})[_0x8d23('0x26')](respondWithResult(_0x2f0f13,null))[_0x8d23('0x43')](handleError(_0x2f0f13,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 71c7358..b79dbe7 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 _0x706d=['./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x59b60c,_0x33e4f8){var _0x1533e2=function(_0x5a57d2){while(--_0x5a57d2){_0x59b60c['push'](_0x59b60c['shift']());}};_0x1533e2(++_0x33e4f8);}(_0x706d,0x161));var _0xd706=function(_0x3243da,_0x5d8b64){_0x3243da=_0x3243da-0x0;var _0x3ca32e=_0x706d[_0x3243da];return _0x3ca32e;};'use strict';var _=require(_0xd706('0x0'));var util=require(_0xd706('0x1'));var logger=require(_0xd706('0x2'))(_0xd706('0x3'));var moment=require(_0xd706('0x4'));var BPromise=require('bluebird');var rp=require(_0xd706('0x5'));var fs=require('fs');var path=require(_0xd706('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd706('0x7'));module[_0xd706('0x8')]=function(_0x406dd6,_0x4cc1f2){return _0x406dd6[_0xd706('0x9')](_0xd706('0xa'),attributes,{'tableName':_0xd706('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbde=['api','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0xdbde,0x15e));var _0xedbd=function(_0x279f16,_0x46f3cc){_0x279f16=_0x279f16-0x0;var _0x10d89e=_0xdbde[_0x279f16];return _0x10d89e;};'use strict';var _=require(_0xedbd('0x0'));var util=require(_0xedbd('0x1'));var logger=require('../../config/logger')(_0xedbd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xedbd('0x3'));var fs=require('fs');var path=require(_0xedbd('0x4'));var rimraf=require('rimraf');var config=require(_0xedbd('0x5'));var attributes=require(_0xedbd('0x6'));module[_0xedbd('0x7')]=function(_0x422523,_0x4b1a81){return _0x422523[_0xedbd('0x8')](_0xedbd('0x9'),attributes,{'tableName':_0xedbd('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 4e33055..b712e91 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 _0x9f37=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x21eb4c,_0x1b6053){var _0x190ec4=function(_0x59231d){while(--_0x59231d){_0x21eb4c['push'](_0x21eb4c['shift']());}};_0x190ec4(++_0x1b6053);}(_0x9f37,0xd1));var _0x79f3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9f37[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var moment=require('moment');var BPromise=require(_0x79f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79f3('0x3'))['db'];var utils=require(_0x79f3('0x4'));var logger=require(_0x79f3('0x5'))('rpc');var config=require(_0x79f3('0x6'));var jayson=require(_0x79f3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x171940,_0x42b440,_0x2ad818){return new BPromise(function(_0xe4ed49,_0x59efc6){return client[_0x79f3('0x8')](_0x171940,_0x2ad818)[_0x79f3('0x9')](function(_0x4b4562){logger[_0x79f3('0xa')](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));logger[_0x79f3('0xd')](_0x79f3('0xe'),_0x42b440,'request\x20sent',JSON[_0x79f3('0xf')](_0x4b4562));if(_0x4b4562[_0x79f3('0x10')]){if(_0x4b4562['error']['code']===0x1f4){logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0x59efc6(_0x4b4562['error'][_0x79f3('0x11')]);}logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0xe4ed49(_0x4b4562[_0x79f3('0x10')]['message']);}else{logger['info'](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));_0xe4ed49(_0x4b4562['result'][_0x79f3('0x11')]);}})[_0x79f3('0x12')](function(_0x23874b){logger[_0x79f3('0x10')]('Automation,\x20%s,\x20%s',_0x42b440,_0x23874b);_0x59efc6(_0x23874b);});});} \ No newline at end of file +var _0xbdfb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x471268,_0x5ce885){var _0x1298f3=function(_0x3f5110){while(--_0x3f5110){_0x471268['push'](_0x471268['shift']());}};_0x1298f3(++_0x5ce885);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x442ccd,_0x415d61){_0x442ccd=_0x442ccd-0x0;var _0x1a2c10=_0xbdfb[_0x442ccd];return _0x1a2c10;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var moment=require(_0xbbdf('0x2'));var BPromise=require(_0xbbdf('0x3'));var rs=require(_0xbbdf('0x4'));var fs=require('fs');var Redis=require(_0xbbdf('0x5'));var db=require(_0xbbdf('0x6'))['db'];var utils=require(_0xbbdf('0x7'));var logger=require(_0xbbdf('0x8'))(_0xbbdf('0x9'));var config=require('../../config/environment');var jayson=require(_0xbbdf('0xa'));var client=jayson[_0xbbdf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c930d,_0x17c835,_0x58a929){return new BPromise(function(_0x2f9954,_0x2ae0d8){return client[_0xbbdf('0xc')](_0x3c930d,_0x58a929)[_0xbbdf('0xd')](function(_0x4c1436){logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');logger[_0xbbdf('0x10')](_0xbbdf('0x11'),_0x17c835,_0xbbdf('0x12'),JSON[_0xbbdf('0x13')](_0x4c1436));if(_0x4c1436['error']){if(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x15')]===0x1f4){logger[_0xbbdf('0x14')]('Automation,\x20%s,\x20%s',_0x17c835,_0x4c1436['error']['message']);return _0x2ae0d8(_0x4c1436['error'][_0xbbdf('0x16')]);}logger[_0xbbdf('0x14')](_0xbbdf('0xf'),_0x17c835,_0x4c1436['error'][_0xbbdf('0x16')]);return _0x2f9954(_0x4c1436[_0xbbdf('0x14')][_0xbbdf('0x16')]);}else{logger[_0xbbdf('0xe')](_0xbbdf('0xf'),_0x17c835,'request\x20sent');_0x2f9954(_0x4c1436[_0xbbdf('0x17')][_0xbbdf('0x16')]);}})[_0xbbdf('0x18')](function(_0x547b94){logger['error'](_0xbbdf('0xf'),_0x17c835,_0x547b94);_0x2ae0d8(_0x547b94);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index dd13ac4..6a23ef6 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 _0x5cb5=['getActions','create','addConditions','post','addActions','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x36ac2e,_0x5a9719){var _0xff1a28=function(_0x56b175){while(--_0x56b175){_0x36ac2e['push'](_0x36ac2e['shift']());}};_0xff1a28(++_0x5a9719);}(_0x5cb5,0xd9));var _0x55cb=function(_0x1e59e7,_0x384069){_0x1e59e7=_0x1e59e7-0x0;var _0x220447=_0x5cb5[_0x1e59e7];return _0x220447;};'use strict';var multer=require(_0x55cb('0x0'));var util=require('util');var path=require(_0x55cb('0x1'));var timeout=require(_0x55cb('0x2'));var express=require(_0x55cb('0x3'));var router=express[_0x55cb('0x4')]();var fs_extra=require(_0x55cb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x55cb('0x6'));var config=require(_0x55cb('0x7'));var controller=require(_0x55cb('0x8'));router[_0x55cb('0x9')]('/',auth[_0x55cb('0xa')](),controller[_0x55cb('0xb')]);router[_0x55cb('0x9')](_0x55cb('0xc'),auth[_0x55cb('0xa')](),controller[_0x55cb('0xd')]);router[_0x55cb('0x9')](_0x55cb('0xe'),auth[_0x55cb('0xa')](),controller[_0x55cb('0xf')]);router[_0x55cb('0x9')](_0x55cb('0x10'),auth[_0x55cb('0xa')](),controller[_0x55cb('0x11')]);router['post']('/',auth[_0x55cb('0xa')](),controller[_0x55cb('0x12')]);router['post'](_0x55cb('0xe'),auth[_0x55cb('0xa')](),controller[_0x55cb('0x13')]);router[_0x55cb('0x14')](_0x55cb('0x10'),auth[_0x55cb('0xa')](),controller[_0x55cb('0x15')]);router[_0x55cb('0x16')](_0x55cb('0xc'),auth[_0x55cb('0xa')](),controller[_0x55cb('0x17')]);router[_0x55cb('0x18')]('/:id',auth[_0x55cb('0xa')](),controller['destroy']);module[_0x55cb('0x19')]=router; \ No newline at end of file +var _0xe563=['post','create','addConditions','addActions','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe563,0x125));var _0x3e56=function(_0x3fa256,_0x883d3f){_0x3fa256=_0x3fa256-0x0;var _0x199db8=_0xe563[_0x3fa256];return _0x199db8;};'use strict';var multer=require(_0x3e56('0x0'));var util=require(_0x3e56('0x1'));var path=require(_0x3e56('0x2'));var timeout=require(_0x3e56('0x3'));var express=require(_0x3e56('0x4'));var router=express[_0x3e56('0x5')]();var fs_extra=require(_0x3e56('0x6'));var auth=require(_0x3e56('0x7'));var interaction=require(_0x3e56('0x8'));var config=require(_0x3e56('0x9'));var controller=require('./automation.controller');router[_0x3e56('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e56('0xb')]);router[_0x3e56('0xa')](_0x3e56('0xc'),auth[_0x3e56('0xd')](),controller[_0x3e56('0xe')]);router[_0x3e56('0xa')](_0x3e56('0xf'),auth[_0x3e56('0xd')](),controller[_0x3e56('0x10')]);router[_0x3e56('0xa')](_0x3e56('0x11'),auth['isAuthenticated'](),controller[_0x3e56('0x12')]);router[_0x3e56('0x13')]('/',auth[_0x3e56('0xd')](),controller[_0x3e56('0x14')]);router[_0x3e56('0x13')](_0x3e56('0xf'),auth[_0x3e56('0xd')](),controller[_0x3e56('0x15')]);router[_0x3e56('0x13')](_0x3e56('0x11'),auth[_0x3e56('0xd')](),controller[_0x3e56('0x16')]);router['put'](_0x3e56('0xc'),auth[_0x3e56('0xd')](),controller['update']);router[_0x3e56('0x17')](_0x3e56('0xc'),auth[_0x3e56('0xd')](),controller[_0x3e56('0x18')]);module[_0x3e56('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 fea3283..46e87f0 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 _0xe05d=['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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x275bfe,_0x36e892){var _0x554055=function(_0x184443){while(--_0x184443){_0x275bfe['push'](_0x275bfe['shift']());}};_0x554055(++_0x36e892);}(_0xe05d,0x143));var _0xde05=function(_0x45f42c,_0x2f7378){_0x45f42c=_0x45f42c-0x0;var _0x58ecbb=_0xe05d[_0x45f42c];return _0x58ecbb;};'use strict';var Sequelize=require(_0xde05('0x0'));module[_0xde05('0x1')]={'name':{'type':Sequelize[_0xde05('0x2')],'unique':_0xde05('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xde05('0x4')](_0xde05('0x5')),'allowNull':![],'defaultValue':_0xde05('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xde05('0x6')],'defaultValue':0x0,'comment':_0xde05('0x7')},'limitCalls':{'type':Sequelize[_0xde05('0x8')](0x4)[_0xde05('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xde05('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0xde05('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xde05('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xde05('0x8')](0x3)[_0xde05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde05('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xde05('0x8')](0x5)[_0xde05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde05('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xde05('0x8')](0x3)[_0xde05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde05('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xde05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde05('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xde05('0x8')](0x3)[_0xde05('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xde05('0x8')](0x5)[_0xde05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde05('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xde05('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xde05('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xde05('0x2')],'defaultValue':_0xde05('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xde05('0x4')]('always',_0xde05('0x12'),_0xde05('0x13')),'defaultValue':_0xde05('0x14')},'dialAMDActive':{'type':Sequelize[_0xde05('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xde05('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xde05('0x8')](0x9)[_0xde05('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xde05('0x8')](0x9)[_0xde05('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xde05('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xde05('0x8')](0x9)[_0xde05('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xde05('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xde05('0x8')](0x9)[_0xde05('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xde05('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xde05('0x8')](0x9)[_0xde05('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xde05('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xde05('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xde05('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xde05('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xde05('0x1b'),'ASC'),'defaultValue':_0xde05('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xde05('0x8')](0x3)[_0xde05('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xde05('0x1c')},'dialCutDigit':{'type':Sequelize[_0xde05('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xde05('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xde05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde05('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xde05('0x8')](0x5)[_0xde05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde05('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xde05('0x8')](0x3)[_0xde05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xde05('0x8')](0x5)[_0xde05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde05('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xde05('0x8')](0x3)[_0xde05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xde05('0x8')](0x5)[_0xde05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde05('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xde05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xde05('0x8')](0x5)[_0xde05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xde05('0x8')](0x3)[_0xde05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xde05('0x8')](0x5)[_0xde05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde05('0x22')}}; \ No newline at end of file +var _0x3663=['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','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3572cb,_0x4149d3){var _0x33a398=function(_0x163e27){while(--_0x163e27){_0x3572cb['push'](_0x3572cb['shift']());}};_0x33a398(++_0x4149d3);}(_0x3663,0x1ee));var _0x3366=function(_0x4624dc,_0x2d47e2){_0x4624dc=_0x4624dc-0x0;var _0x230719=_0x3663[_0x4624dc];return _0x230719;};'use strict';var Sequelize=require(_0x3366('0x0'));module[_0x3366('0x1')]={'name':{'type':Sequelize[_0x3366('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3366('0x3')](_0x3366('0x4')),'allowNull':![],'defaultValue':_0x3366('0x4')},'description':{'type':Sequelize[_0x3366('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3366('0x5')},'limitCalls':{'type':Sequelize[_0x3366('0x6')](0x4)[_0x3366('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3366('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3366('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3366('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x3366('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3366('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3366('0x6')](0x3)[_0x3366('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3366('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3366('0x6')](0x5)[_0x3366('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3366('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x3366('0x6')](0x3)[_0x3366('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3366('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3366('0x6')](0x5)[_0x3366('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3366('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3366('0x6')](0x3)[_0x3366('0x7')],'defaultValue':0x3,'comment':_0x3366('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3366('0x6')](0x5)[_0x3366('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3366('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3366('0x6')](0x3)[_0x3366('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x3366('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3366('0x2')],'defaultValue':_0x3366('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x3366('0x3')](_0x3366('0x11'),'never','onlyIfOpen'),'defaultValue':_0x3366('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3366('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x3366('0x6')](0x9)[_0x3366('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3366('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x3366('0x6')](0x9)[_0x3366('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3366('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3366('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3366('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x3366('0x6')](0x9)[_0x3366('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3366('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3366('0x6')](0x9)[_0x3366('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3366('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3366('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3366('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3366('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x3366('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x3366('0x3')](_0x3366('0x1b'),_0x3366('0x1c')),'defaultValue':_0x3366('0x1b')},'dialPrefix':{'type':Sequelize[_0x3366('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3366('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3366('0x1d')},'dialCutDigit':{'type':Sequelize[_0x3366('0x6')](0x3)[_0x3366('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3366('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3366('0x6')](0x3)[_0x3366('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3366('0x6')](0x5)[_0x3366('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3366('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x3366('0x6')](0x3)[_0x3366('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3366('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3366('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3366('0x6')](0x3)[_0x3366('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3366('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3366('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3366('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x3366('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3366('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3366('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3366('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3366('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3366('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3366('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3366('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index a2e46aa..53d3f07 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 _0xcc70=['CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','push','all','removeLists','getBlackLists','addBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','IvrCampaigns','stack','map','Campaign','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','rows','catch','include','options','find','create','get','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','body','getHoppers','findOne','CmHopper','hasOwnProperty','pick'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xcc70,0x1bb));var _0x0cc7=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0xcc70[_0xf168d3];return _0x17fb54;};'use strict';var emlformat=require(_0x0cc7('0x0'));var rimraf=require(_0x0cc7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cc7('0x2'));var rp=require('request-promise');var moment=require(_0x0cc7('0x3'));var BPromise=require(_0x0cc7('0x4'));var Mustache=require(_0x0cc7('0x5'));var util=require(_0x0cc7('0x6'));var path=require(_0x0cc7('0x7'));var sox=require('sox');var csv=require(_0x0cc7('0x8'));var ejs=require(_0x0cc7('0x9'));var fs=require('fs');var fs_extra=require(_0x0cc7('0xa'));var _=require(_0x0cc7('0xb'));var squel=require('squel');var crypto=require(_0x0cc7('0xc'));var jsforce=require(_0x0cc7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0cc7('0x8'));var querystring=require('querystring');var Papa=require(_0x0cc7('0xe'));var Redis=require(_0x0cc7('0xf'));var authService=require(_0x0cc7('0x10'));var qs=require(_0x0cc7('0x11'));var as=require(_0x0cc7('0x12'));var hardwareService=require(_0x0cc7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0cc7('0x14'));var config=require(_0x0cc7('0x15'));var licenseUtil=require(_0x0cc7('0x16'));var db=require(_0x0cc7('0x17'))['db'];function respondWithStatusCode(_0x301d3c,_0x2bf12a){_0x2bf12a=_0x2bf12a||0xcc;return function(_0x494209){if(_0x494209){return _0x301d3c[_0x0cc7('0x18')](_0x2bf12a);}return _0x301d3c[_0x0cc7('0x19')](_0x2bf12a)[_0x0cc7('0x1a')]();};}function respondWithResult(_0x50b09e,_0x2911af){_0x2911af=_0x2911af||0xc8;return function(_0x5d5930){if(_0x5d5930){return _0x50b09e['status'](_0x2911af)['json'](_0x5d5930);}};}function respondWithFilteredResult(_0x5752da,_0x5eeec9){return function(_0x140462){if(_0x140462){var _0x2ceb0e=typeof _0x5eeec9[_0x0cc7('0x1b')]===_0x0cc7('0x1c')&&typeof _0x5eeec9[_0x0cc7('0x1d')]===_0x0cc7('0x1c');var _0x1f5b5e=_0x140462[_0x0cc7('0x1e')];var _0x4bc24c=_0x2ceb0e?0x0:_0x5eeec9['offset'];var _0x3d481e=_0x2ceb0e?_0x140462[_0x0cc7('0x1e')]:_0x5eeec9['offset']+_0x5eeec9[_0x0cc7('0x1d')];var _0x46b92e;if(_0x3d481e>=_0x1f5b5e){_0x3d481e=_0x1f5b5e;_0x46b92e=0xc8;}else{_0x46b92e=0xce;}_0x5752da[_0x0cc7('0x19')](_0x46b92e);return _0x5752da[_0x0cc7('0x1f')](_0x0cc7('0x20'),_0x4bc24c+'-'+_0x3d481e+'/'+_0x1f5b5e)[_0x0cc7('0x21')](_0x140462);}return null;};}function patchUpdates(_0x247441){return function(_0x10e25e){try{jsonpatch[_0x0cc7('0x22')](_0x10e25e,_0x247441,!![]);}catch(_0x4a2daf){return BPromise[_0x0cc7('0x23')](_0x4a2daf);}return _0x10e25e[_0x0cc7('0x24')]();};}function saveUpdates(_0x3a1702,_0x45dba4){return function(_0xbfbd6a){if(_0xbfbd6a){return _0xbfbd6a['update'](_0x3a1702)['then'](function(_0x4a51a1){return _0x4a51a1;});}return null;};}function removeEntity(_0x596f3c,_0x4c6a17){return function(_0xbca65b){if(_0xbca65b){return _0xbca65b[_0x0cc7('0x25')]()[_0x0cc7('0x26')](function(){var _0x590950=_0xbca65b['get']({'plain':!![]});var _0x195f34=_0x0cc7('0x27');return db['UserProfileResource'][_0x0cc7('0x25')]({'where':{'type':_0x195f34,'resourceId':_0x590950['id']}})[_0x0cc7('0x26')](function(){return _0xbca65b;});})[_0x0cc7('0x26')](function(){_0x596f3c[_0x0cc7('0x19')](0xcc)[_0x0cc7('0x1a')]();});}};}function handleEntityNotFound(_0x42ae04,_0x5e01ba){return function(_0x2baff8){if(!_0x2baff8){_0x42ae04['sendStatus'](0x194);}return _0x2baff8;};}function handleError(_0x4a8bf9,_0x55b8f6){_0x55b8f6=_0x55b8f6||0x1f4;return function(_0x5ae7e4){logger['error'](_0x5ae7e4[_0x0cc7('0x28')]);if(_0x5ae7e4['name']){delete _0x5ae7e4['name'];}_0x4a8bf9['status'](_0x55b8f6)['send'](_0x5ae7e4);};}exports['index']=function(_0x5a1aa7,_0x43378c){var _0x45eeff={},_0x411b85={},_0x5e4739={'count':0x0,'rows':[]};var _0x4bce7d=_[_0x0cc7('0x29')](db[_0x0cc7('0x2a')][_0x0cc7('0x2b')],function(_0x70a693){return{'name':_0x70a693[_0x0cc7('0x2c')],'type':_0x70a693[_0x0cc7('0x2d')]['key']};});_0x411b85[_0x0cc7('0x2e')]=_[_0x0cc7('0x29')](_0x4bce7d,_0x0cc7('0x2f'));_0x411b85[_0x0cc7('0x30')]=_[_0x0cc7('0x31')](_0x5a1aa7[_0x0cc7('0x30')]);_0x411b85[_0x0cc7('0x32')]=_[_0x0cc7('0x33')](_0x411b85[_0x0cc7('0x2e')],_0x411b85[_0x0cc7('0x30')]);_0x45eeff['attributes']=_[_0x0cc7('0x33')](_0x411b85[_0x0cc7('0x2e')],qs[_0x0cc7('0x34')](_0x5a1aa7['query'][_0x0cc7('0x34')]));_0x45eeff[_0x0cc7('0x35')]=_0x45eeff[_0x0cc7('0x35')][_0x0cc7('0x36')]?_0x45eeff['attributes']:_0x411b85[_0x0cc7('0x2e')];if(!_0x5a1aa7[_0x0cc7('0x30')]['hasOwnProperty'](_0x0cc7('0x37'))){_0x45eeff[_0x0cc7('0x1d')]=qs[_0x0cc7('0x1d')](_0x5a1aa7[_0x0cc7('0x30')][_0x0cc7('0x1d')]);_0x45eeff[_0x0cc7('0x1b')]=qs[_0x0cc7('0x1b')](_0x5a1aa7['query'][_0x0cc7('0x1b')]);}_0x45eeff[_0x0cc7('0x38')]=qs[_0x0cc7('0x39')](_0x5a1aa7[_0x0cc7('0x30')][_0x0cc7('0x39')]);_0x45eeff[_0x0cc7('0x3a')]=qs[_0x0cc7('0x32')](_['pick'](_0x5a1aa7[_0x0cc7('0x30')],_0x411b85['filters']),_0x4bce7d);if(_0x5a1aa7[_0x0cc7('0x30')][_0x0cc7('0x3b')]){_0x45eeff[_0x0cc7('0x3a')]=_[_0x0cc7('0x3c')](_0x45eeff[_0x0cc7('0x3a')],{'$or':_[_0x0cc7('0x29')](_0x4bce7d,function(_0x54ef8d){if(_0x54ef8d[_0x0cc7('0x2d')]!=='VIRTUAL'){var _0x244340={};_0x244340[_0x54ef8d[_0x0cc7('0x2f')]]={'$like':'%'+_0x5a1aa7[_0x0cc7('0x30')]['filter']+'%'};return _0x244340;}})});}_0x45eeff=_[_0x0cc7('0x3c')]({},_0x45eeff,_0x5a1aa7['options']);var _0x37af7e={'where':_0x45eeff['where']};return db[_0x0cc7('0x2a')][_0x0cc7('0x1e')](_0x37af7e)[_0x0cc7('0x26')](function(_0x15ab90){_0x5e4739[_0x0cc7('0x1e')]=_0x15ab90;if(_0x5a1aa7[_0x0cc7('0x30')]['includeAll']){_0x45eeff['include']=[{'all':!![]}];}return db['Campaign']['findAll'](_0x45eeff);})[_0x0cc7('0x26')](function(_0x311064){_0x5e4739[_0x0cc7('0x3d')]=_0x311064;return _0x5e4739;})['then'](respondWithFilteredResult(_0x43378c,_0x45eeff))[_0x0cc7('0x3e')](handleError(_0x43378c,null));};exports['show']=function(_0x70955f,_0x133f6e){var _0x11f67c={'raw':![],'where':{'id':_0x70955f['params']['id']}},_0x130045={};_0x130045[_0x0cc7('0x2e')]=_['keys'](db['Campaign']['rawAttributes']);_0x130045[_0x0cc7('0x30')]=_[_0x0cc7('0x31')](_0x70955f[_0x0cc7('0x30')]);_0x130045[_0x0cc7('0x32')]=_['intersection'](_0x130045[_0x0cc7('0x2e')],_0x130045[_0x0cc7('0x30')]);_0x11f67c[_0x0cc7('0x35')]=_[_0x0cc7('0x33')](_0x130045[_0x0cc7('0x2e')],qs[_0x0cc7('0x34')](_0x70955f[_0x0cc7('0x30')][_0x0cc7('0x34')]));_0x11f67c['attributes']=_0x11f67c[_0x0cc7('0x35')]['length']?_0x11f67c[_0x0cc7('0x35')]:_0x130045[_0x0cc7('0x2e')];if(_0x70955f[_0x0cc7('0x30')]['includeAll']){_0x11f67c[_0x0cc7('0x3f')]=[{'all':!![]}];}_0x11f67c=_[_0x0cc7('0x3c')]({},_0x11f67c,_0x70955f[_0x0cc7('0x40')]);return db[_0x0cc7('0x2a')][_0x0cc7('0x41')](_0x11f67c)['then'](handleEntityNotFound(_0x133f6e,null))[_0x0cc7('0x26')](respondWithResult(_0x133f6e,null))[_0x0cc7('0x3e')](handleError(_0x133f6e,null));};exports[_0x0cc7('0x42')]=function(_0x36773a,_0x8a322e){return db[_0x0cc7('0x2a')][_0x0cc7('0x42')](_0x36773a['body'],{})['then'](function(_0x28801a){var _0x3f38b8=_0x36773a['user'][_0x0cc7('0x43')]({'plain':!![]});if(!_0x3f38b8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f38b8[_0x0cc7('0x44')]===_0x0cc7('0x45')){var _0x58b6d1=_0x28801a[_0x0cc7('0x43')]({'plain':!![]});var _0xb070b=_0x0cc7('0x27');return db[_0x0cc7('0x46')][_0x0cc7('0x41')]({'where':{'name':_0xb070b,'userProfileId':_0x3f38b8[_0x0cc7('0x47')]},'raw':!![]})[_0x0cc7('0x26')](function(_0x24d495){if(_0x24d495&&_0x24d495[_0x0cc7('0x48')]===0x0){return db[_0x0cc7('0x49')]['create']({'name':_0x58b6d1[_0x0cc7('0x2f')],'resourceId':_0x58b6d1['id'],'type':_0x24d495['name'],'sectionId':_0x24d495['id']},{})[_0x0cc7('0x26')](function(){return _0x28801a;});}else{return _0x28801a;}})[_0x0cc7('0x3e')](function(_0x6ac024){logger[_0x0cc7('0x4a')](_0x0cc7('0x4b'),_0x6ac024);throw _0x6ac024;});}return _0x28801a;})['then'](respondWithResult(_0x8a322e,0xc9))[_0x0cc7('0x3e')](handleError(_0x8a322e,null));};exports[_0x0cc7('0x4c')]=function(_0x51d26e,_0x498ffc){var _0x15d224={'where':{'id':_0x51d26e[_0x0cc7('0x4d')]['id']}},_0x1bb206={};_0x1bb206[_0x0cc7('0x2e')]=_['keys'](db['Campaign'][_0x0cc7('0x2b')]);_0x15d224[_0x0cc7('0x35')]=_[_0x0cc7('0x33')](_0x1bb206[_0x0cc7('0x2e')],qs['fields'](_0x51d26e[_0x0cc7('0x30')]['fields']));_0x15d224[_0x0cc7('0x35')]=_0x15d224[_0x0cc7('0x35')][_0x0cc7('0x36')]?_0x15d224['attributes']:_0x1bb206[_0x0cc7('0x2e')];if(_0x51d26e[_0x0cc7('0x30')][_0x0cc7('0x4e')]){_0x15d224[_0x0cc7('0x3f')]=[{'all':!![]}];}_0x15d224=_[_0x0cc7('0x3c')]({},_0x15d224,_0x51d26e[_0x0cc7('0x40')]);return db[_0x0cc7('0x2a')][_0x0cc7('0x41')](_0x15d224)[_0x0cc7('0x26')](handleEntityNotFound(_0x498ffc,null))[_0x0cc7('0x26')](function(_0x13df55){if(_0x13df55){var _0x51e7bd=_0x13df55[_0x0cc7('0x43')]({'plain':!![]});_0x51e7bd=qs[_0x0cc7('0x4f')](_0x51e7bd,['id',_0x0cc7('0x50'),'updatedAt']);_0x51d26e['body']=_[_0x0cc7('0x4f')](_0x51d26e['body'],['id','createdAt','updatedAt']);return db[_0x0cc7('0x2a')][_0x0cc7('0x42')](_['merge'](_0x51e7bd,_0x51d26e['body']),{'include':_0x51d26e[_0x0cc7('0x30')][_0x0cc7('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x1899e5){var _0x56a462=_0x51d26e['user']['get']({'plain':!![]});if(!_0x56a462)throw new Error(_0x0cc7('0x51'));if(_0x56a462[_0x0cc7('0x44')]===_0x0cc7('0x45')){var _0x3154b8=_0x1899e5[_0x0cc7('0x43')]({'plain':!![]});var _0x1e7f71=_0x0cc7('0x27');return db[_0x0cc7('0x46')][_0x0cc7('0x41')]({'where':{'name':_0x1e7f71,'userProfileId':_0x56a462[_0x0cc7('0x47')]},'raw':!![]})[_0x0cc7('0x26')](function(_0x59cb01){if(_0x59cb01&&_0x59cb01[_0x0cc7('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x3154b8['name'],'resourceId':_0x3154b8['id'],'type':_0x59cb01[_0x0cc7('0x2f')],'sectionId':_0x59cb01['id']},{})[_0x0cc7('0x26')](function(){return _0x1899e5;});}else{return _0x1899e5;}})[_0x0cc7('0x3e')](function(_0x452c93){logger[_0x0cc7('0x4a')](_0x0cc7('0x4b'),_0x452c93);throw _0x452c93;});}return _0x1899e5;});}})[_0x0cc7('0x26')](respondWithResult(_0x498ffc,0xc9))[_0x0cc7('0x3e')](handleError(_0x498ffc,null));};exports[_0x0cc7('0x52')]=function(_0x546a1b,_0x17e53e){if(_0x546a1b['body']['id']){delete _0x546a1b[_0x0cc7('0x53')]['id'];}return db['Campaign'][_0x0cc7('0x41')]({'where':{'id':_0x546a1b[_0x0cc7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17e53e,null))[_0x0cc7('0x26')](saveUpdates(_0x546a1b[_0x0cc7('0x53')],null))[_0x0cc7('0x26')](respondWithResult(_0x17e53e,null))[_0x0cc7('0x3e')](handleError(_0x17e53e,null));};exports[_0x0cc7('0x25')]=function(_0x4c1714,_0x417c78){return db[_0x0cc7('0x2a')][_0x0cc7('0x41')]({'where':{'id':_0x4c1714[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x417c78,null))['then'](removeEntity(_0x417c78,null))[_0x0cc7('0x3e')](handleError(_0x417c78,null));};exports[_0x0cc7('0x54')]=function(_0x1bc33c,_0x21bcb2,_0x41137e){var _0x22d30d={'raw':!![],'where':{}};var _0x223e2c={};var _0x1427a4={'count':0x0,'rows':[]};return db['Campaign'][_0x0cc7('0x55')]({'where':{'id':_0x1bc33c[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x21bcb2,null))[_0x0cc7('0x26')](function(_0x123a98){if(_0x123a98){_0x223e2c[_0x0cc7('0x2e')]=_[_0x0cc7('0x31')](db[_0x0cc7('0x56')][_0x0cc7('0x2b')]);_0x223e2c['query']=_[_0x0cc7('0x31')](_0x1bc33c[_0x0cc7('0x30')]);_0x223e2c['filters']=_[_0x0cc7('0x33')](_0x223e2c['model'],_0x223e2c['query']);_0x22d30d[_0x0cc7('0x35')]=_['intersection'](_0x223e2c[_0x0cc7('0x2e')],qs[_0x0cc7('0x34')](_0x1bc33c[_0x0cc7('0x30')]['fields']));_0x22d30d[_0x0cc7('0x35')]=_0x22d30d['attributes'][_0x0cc7('0x36')]?_0x22d30d['attributes']:_0x223e2c[_0x0cc7('0x2e')];if(!_0x1bc33c[_0x0cc7('0x30')][_0x0cc7('0x57')](_0x0cc7('0x37'))){_0x22d30d[_0x0cc7('0x1d')]=qs['limit'](_0x1bc33c[_0x0cc7('0x30')]['limit']);_0x22d30d['offset']=qs[_0x0cc7('0x1b')](_0x1bc33c['query'][_0x0cc7('0x1b')]);}_0x22d30d[_0x0cc7('0x38')]=qs[_0x0cc7('0x39')](_0x1bc33c['query'][_0x0cc7('0x39')]);_0x22d30d[_0x0cc7('0x3a')]=qs[_0x0cc7('0x32')](_[_0x0cc7('0x58')](_0x1bc33c[_0x0cc7('0x30')],_0x223e2c[_0x0cc7('0x32')]));_0x22d30d[_0x0cc7('0x3a')][_0x0cc7('0x59')]=_0x123a98['id'];if(_0x1bc33c[_0x0cc7('0x30')][_0x0cc7('0x3b')]){_0x22d30d[_0x0cc7('0x3a')]=_[_0x0cc7('0x3c')](_0x22d30d[_0x0cc7('0x3a')],{'$or':_[_0x0cc7('0x29')](_0x22d30d[_0x0cc7('0x35')],function(_0x290517){var _0x4132d8={};_0x4132d8[_0x290517]={'$like':'%'+_0x1bc33c['query']['filter']+'%'};return _0x4132d8;})});}_0x22d30d=_[_0x0cc7('0x3c')]({},_0x22d30d,_0x1bc33c[_0x0cc7('0x40')]);return db[_0x0cc7('0x56')][_0x0cc7('0x1e')]({'where':_0x22d30d[_0x0cc7('0x3a')]})[_0x0cc7('0x26')](function(_0x58eefa){_0x1427a4[_0x0cc7('0x1e')]=_0x58eefa;if(_0x1bc33c[_0x0cc7('0x30')][_0x0cc7('0x4e')]){_0x22d30d[_0x0cc7('0x3f')]=[{'all':!![]}];}return db[_0x0cc7('0x56')][_0x0cc7('0x5a')](_0x22d30d);})['then'](function(_0x3513cc){_0x1427a4[_0x0cc7('0x3d')]=_0x3513cc;return _0x1427a4;});}})[_0x0cc7('0x26')](respondWithFilteredResult(_0x21bcb2,_0x22d30d))[_0x0cc7('0x3e')](handleError(_0x21bcb2,null));};exports[_0x0cc7('0x5b')]=function(_0x27015e,_0x4e0eac,_0x56d3e3){var _0x5f4931={'raw':!![],'where':{}};var _0x3309a4={};var _0x2e7ad8={'count':0x0,'rows':[]};return db[_0x0cc7('0x2a')][_0x0cc7('0x55')]({'where':{'id':_0x27015e[_0x0cc7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4e0eac,null))[_0x0cc7('0x26')](function(_0x9f1d67){if(_0x9f1d67){_0x3309a4['model']=_['keys'](db['CmHopperHistory'][_0x0cc7('0x2b')]);_0x3309a4['query']=_['keys'](_0x27015e[_0x0cc7('0x30')]);_0x3309a4[_0x0cc7('0x32')]=_[_0x0cc7('0x33')](_0x3309a4[_0x0cc7('0x2e')],_0x3309a4[_0x0cc7('0x30')]);_0x5f4931['attributes']=_[_0x0cc7('0x33')](_0x3309a4[_0x0cc7('0x2e')],qs[_0x0cc7('0x34')](_0x27015e['query'][_0x0cc7('0x34')]));_0x5f4931[_0x0cc7('0x35')]=_0x5f4931['attributes'][_0x0cc7('0x36')]?_0x5f4931[_0x0cc7('0x35')]:_0x3309a4['model'];if(!_0x27015e[_0x0cc7('0x30')][_0x0cc7('0x57')](_0x0cc7('0x37'))){_0x5f4931['limit']=qs[_0x0cc7('0x1d')](_0x27015e[_0x0cc7('0x30')][_0x0cc7('0x1d')]);_0x5f4931[_0x0cc7('0x1b')]=qs['offset'](_0x27015e['query'][_0x0cc7('0x1b')]);}_0x5f4931['order']=qs[_0x0cc7('0x39')](_0x27015e[_0x0cc7('0x30')][_0x0cc7('0x39')]);_0x5f4931[_0x0cc7('0x3a')]=qs[_0x0cc7('0x32')](_[_0x0cc7('0x58')](_0x27015e[_0x0cc7('0x30')],_0x3309a4[_0x0cc7('0x32')]));_0x5f4931[_0x0cc7('0x3a')]['CampaignId']=_0x9f1d67['id'];if(_0x27015e[_0x0cc7('0x30')]['filter']){_0x5f4931[_0x0cc7('0x3a')]=_['merge'](_0x5f4931['where'],{'$or':_[_0x0cc7('0x29')](_0x5f4931[_0x0cc7('0x35')],function(_0x3ea5e2){var _0x528b56={};_0x528b56[_0x3ea5e2]={'$like':'%'+_0x27015e['query'][_0x0cc7('0x3b')]+'%'};return _0x528b56;})});}_0x5f4931=_[_0x0cc7('0x3c')]({},_0x5f4931,_0x27015e[_0x0cc7('0x40')]);return db[_0x0cc7('0x5c')][_0x0cc7('0x1e')]({'where':_0x5f4931[_0x0cc7('0x3a')]})[_0x0cc7('0x26')](function(_0x4182b5){_0x2e7ad8[_0x0cc7('0x1e')]=_0x4182b5;if(_0x27015e['query'][_0x0cc7('0x4e')]){_0x5f4931[_0x0cc7('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0cc7('0x5a')](_0x5f4931);})['then'](function(_0x334480){_0x2e7ad8[_0x0cc7('0x3d')]=_0x334480;return _0x2e7ad8;});}})[_0x0cc7('0x26')](respondWithFilteredResult(_0x4e0eac,_0x5f4931))[_0x0cc7('0x3e')](handleError(_0x4e0eac,null));};exports[_0x0cc7('0x5d')]=function(_0x331772,_0x54f2d3,_0x5de6e0){var _0x5d9bf8={'raw':!![],'where':{}};var _0x3a3f32={};var _0x51964f={'count':0x0,'rows':[]};return db[_0x0cc7('0x2a')][_0x0cc7('0x55')]({'where':{'id':_0x331772[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x54f2d3,null))[_0x0cc7('0x26')](function(_0x59d424){if(_0x59d424){_0x3a3f32['model']=_[_0x0cc7('0x31')](db[_0x0cc7('0x5e')][_0x0cc7('0x2b')]);_0x3a3f32['query']=_[_0x0cc7('0x31')](_0x331772[_0x0cc7('0x30')]);_0x3a3f32[_0x0cc7('0x32')]=_['intersection'](_0x3a3f32[_0x0cc7('0x2e')],_0x3a3f32[_0x0cc7('0x30')]);_0x5d9bf8[_0x0cc7('0x35')]=_[_0x0cc7('0x33')](_0x3a3f32['model'],qs[_0x0cc7('0x34')](_0x331772['query']['fields']));_0x5d9bf8[_0x0cc7('0x35')]=_0x5d9bf8['attributes'][_0x0cc7('0x36')]?_0x5d9bf8[_0x0cc7('0x35')]:_0x3a3f32[_0x0cc7('0x2e')];if(!_0x331772[_0x0cc7('0x30')]['hasOwnProperty'](_0x0cc7('0x37'))){_0x5d9bf8['limit']=qs['limit'](_0x331772[_0x0cc7('0x30')][_0x0cc7('0x1d')]);_0x5d9bf8['offset']=qs[_0x0cc7('0x1b')](_0x331772['query']['offset']);}_0x5d9bf8['order']=qs['sort'](_0x331772['query'][_0x0cc7('0x39')]);_0x5d9bf8[_0x0cc7('0x3a')]=qs['filters'](_[_0x0cc7('0x58')](_0x331772[_0x0cc7('0x30')],_0x3a3f32['filters']));_0x5d9bf8['where']['CampaignId']=_0x59d424['id'];if(_0x331772[_0x0cc7('0x30')][_0x0cc7('0x3b')]){_0x5d9bf8['where']=_[_0x0cc7('0x3c')](_0x5d9bf8['where'],{'$or':_[_0x0cc7('0x29')](_0x5d9bf8[_0x0cc7('0x35')],function(_0x12a1bd){var _0x48a879={};_0x48a879[_0x12a1bd]={'$like':'%'+_0x331772['query'][_0x0cc7('0x3b')]+'%'};return _0x48a879;})});}_0x5d9bf8=_[_0x0cc7('0x3c')]({},_0x5d9bf8,_0x331772['options']);return db['CmHopperFinal'][_0x0cc7('0x1e')]({'where':_0x5d9bf8[_0x0cc7('0x3a')]})[_0x0cc7('0x26')](function(_0x13f3f0){_0x51964f[_0x0cc7('0x1e')]=_0x13f3f0;if(_0x331772[_0x0cc7('0x30')][_0x0cc7('0x4e')]){_0x5d9bf8[_0x0cc7('0x3f')]=[{'all':!![]}];}return db[_0x0cc7('0x5e')]['findAll'](_0x5d9bf8);})['then'](function(_0x49a010){_0x51964f[_0x0cc7('0x3d')]=_0x49a010;return _0x51964f;});}})['then'](respondWithFilteredResult(_0x54f2d3,_0x5d9bf8))[_0x0cc7('0x3e')](handleError(_0x54f2d3,null));};exports[_0x0cc7('0x5f')]=function(_0x42c215,_0x5ab722,_0xfe04bc){var _0x44ec57={'raw':!![],'where':{}};var _0x54f2f2={};var _0x3243c8={'count':0x0,'rows':[]};return db[_0x0cc7('0x2a')][_0x0cc7('0x55')]({'where':{'id':_0x42c215[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x5ab722,null))[_0x0cc7('0x26')](function(_0x57794d){if(_0x57794d){_0x54f2f2['model']=_[_0x0cc7('0x31')](db[_0x0cc7('0x60')][_0x0cc7('0x2b')]);_0x54f2f2[_0x0cc7('0x30')]=_['keys'](_0x42c215['query']);_0x54f2f2[_0x0cc7('0x32')]=_['intersection'](_0x54f2f2[_0x0cc7('0x2e')],_0x54f2f2[_0x0cc7('0x30')]);_0x44ec57[_0x0cc7('0x35')]=_['intersection'](_0x54f2f2['model'],qs['fields'](_0x42c215[_0x0cc7('0x30')][_0x0cc7('0x34')]));_0x44ec57[_0x0cc7('0x35')]=_0x44ec57[_0x0cc7('0x35')][_0x0cc7('0x36')]?_0x44ec57[_0x0cc7('0x35')]:_0x54f2f2['model'];if(!_0x42c215[_0x0cc7('0x30')][_0x0cc7('0x57')](_0x0cc7('0x37'))){_0x44ec57[_0x0cc7('0x1d')]=qs[_0x0cc7('0x1d')](_0x42c215[_0x0cc7('0x30')][_0x0cc7('0x1d')]);_0x44ec57[_0x0cc7('0x1b')]=qs[_0x0cc7('0x1b')](_0x42c215[_0x0cc7('0x30')][_0x0cc7('0x1b')]);}_0x44ec57[_0x0cc7('0x38')]=qs[_0x0cc7('0x39')](_0x42c215['query'][_0x0cc7('0x39')]);_0x44ec57['where']=qs[_0x0cc7('0x32')](_['pick'](_0x42c215['query'],_0x54f2f2[_0x0cc7('0x32')]));_0x44ec57[_0x0cc7('0x3a')][_0x0cc7('0x59')]=_0x57794d['id'];if(_0x42c215[_0x0cc7('0x30')][_0x0cc7('0x3b')]){_0x44ec57[_0x0cc7('0x3a')]=_[_0x0cc7('0x3c')](_0x44ec57[_0x0cc7('0x3a')],{'$or':_[_0x0cc7('0x29')](_0x44ec57[_0x0cc7('0x35')],function(_0x5b5d40){var _0x30c1b7={};_0x30c1b7[_0x5b5d40]={'$like':'%'+_0x42c215[_0x0cc7('0x30')][_0x0cc7('0x3b')]+'%'};return _0x30c1b7;})});}_0x44ec57=_[_0x0cc7('0x3c')]({},_0x44ec57,_0x42c215[_0x0cc7('0x40')]);return db[_0x0cc7('0x60')][_0x0cc7('0x1e')]({'where':_0x44ec57[_0x0cc7('0x3a')]})[_0x0cc7('0x26')](function(_0x33b498){_0x3243c8[_0x0cc7('0x1e')]=_0x33b498;if(_0x42c215[_0x0cc7('0x30')]['includeAll']){_0x44ec57[_0x0cc7('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0cc7('0x5a')](_0x44ec57);})[_0x0cc7('0x26')](function(_0xa9d7e3){_0x3243c8[_0x0cc7('0x3d')]=_0xa9d7e3;return _0x3243c8;});}})[_0x0cc7('0x26')](respondWithFilteredResult(_0x5ab722,_0x44ec57))['catch'](handleError(_0x5ab722,null));};exports[_0x0cc7('0x61')]=function(_0x3ca951,_0x190657,_0x1158b7){var _0x4ff070={};var _0xf9e4dd={};var _0x49bc80;var _0x51987c;return db[_0x0cc7('0x2a')][_0x0cc7('0x55')]({'where':{'id':_0x3ca951[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x190657,null))[_0x0cc7('0x26')](function(_0x34fcd8){if(_0x34fcd8){_0x49bc80=_0x34fcd8;_0xf9e4dd[_0x0cc7('0x2e')]=_[_0x0cc7('0x31')](db[_0x0cc7('0x62')]['rawAttributes']);_0xf9e4dd[_0x0cc7('0x30')]=_[_0x0cc7('0x31')](_0x3ca951[_0x0cc7('0x30')]);_0xf9e4dd[_0x0cc7('0x32')]=_[_0x0cc7('0x33')](_0xf9e4dd[_0x0cc7('0x2e')],_0xf9e4dd[_0x0cc7('0x30')]);_0x4ff070[_0x0cc7('0x35')]=_['intersection'](_0xf9e4dd[_0x0cc7('0x2e')],qs[_0x0cc7('0x34')](_0x3ca951[_0x0cc7('0x30')][_0x0cc7('0x34')]));_0x4ff070[_0x0cc7('0x35')]=_0x4ff070[_0x0cc7('0x35')]['length']?_0x4ff070['attributes']:_0xf9e4dd[_0x0cc7('0x2e')];_0x4ff070[_0x0cc7('0x38')]=qs['sort'](_0x3ca951[_0x0cc7('0x30')][_0x0cc7('0x39')]);_0x4ff070[_0x0cc7('0x3a')]=qs[_0x0cc7('0x32')](_[_0x0cc7('0x58')](_0x3ca951[_0x0cc7('0x30')],_0xf9e4dd[_0x0cc7('0x32')]));if(_0x3ca951[_0x0cc7('0x30')]['filter']){_0x4ff070[_0x0cc7('0x3a')]=_[_0x0cc7('0x3c')](_0x4ff070['where'],{'$or':_[_0x0cc7('0x29')](_0x4ff070[_0x0cc7('0x35')],function(_0x1b3984){var _0x2c411d={};_0x2c411d[_0x1b3984]={'$like':'%'+_0x3ca951['query'][_0x0cc7('0x3b')]+'%'};return _0x2c411d;})});}_0x4ff070=_['merge']({},_0x4ff070,_0x3ca951[_0x0cc7('0x40')]);return _0x49bc80[_0x0cc7('0x61')](_0x4ff070);}})['then'](function(_0x158a0b){if(_0x158a0b){_0x51987c=_0x158a0b[_0x0cc7('0x36')];if(!_0x3ca951[_0x0cc7('0x30')][_0x0cc7('0x57')]('nolimit')){_0x4ff070['limit']=qs[_0x0cc7('0x1d')](_0x3ca951[_0x0cc7('0x30')][_0x0cc7('0x1d')]);_0x4ff070['offset']=qs[_0x0cc7('0x1b')](_0x3ca951[_0x0cc7('0x30')][_0x0cc7('0x1b')]);}return _0x49bc80[_0x0cc7('0x61')](_0x4ff070);}})[_0x0cc7('0x26')](function(_0x1561e7){if(_0x1561e7){return _0x1561e7?{'count':_0x51987c,'rows':_0x1561e7}:null;}})['then'](respondWithResult(_0x190657,null))[_0x0cc7('0x3e')](handleError(_0x190657,null));};exports[_0x0cc7('0x63')]=function(_0xa44183,_0x1ba7ab,_0x56909a){var _0x184148,_0x420ea3;return db['Campaign'][_0x0cc7('0x41')]({'where':{'id':_0xa44183[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x1ba7ab,null))[_0x0cc7('0x26')](function(_0x557891){if(_0x557891){_0x420ea3=_0x557891;return _0x557891[_0x0cc7('0x63')](_0xa44183['body'][_0x0cc7('0x64')],_['omit'](_0xa44183['body'],[_0x0cc7('0x64'),'id'])||{});}return null;})[_0x0cc7('0x65')](function(_0x429b7a){var _0xe2bb16;_0x184148=_0x429b7a||[];var _0x4d1dc0=[];if(_0x429b7a){for(var _0x4e6a2e=0x0;_0x4e6a2e<_0x429b7a[_0x0cc7('0x36')];_0x4e6a2e+=0x1){var _0x4358a6=_0x429b7a[_0x4e6a2e][_0x0cc7('0x43')]({'plain':!![]});_0x420ea3[_0x0cc7('0x66')]=_0xa44183[_0x0cc7('0x53')][_0x0cc7('0x66')]?_0xa44183[_0x0cc7('0x53')]['dialCheckDuplicateType']:_0x420ea3['dialCheckDuplicateType'];switch(_0x420ea3[_0x0cc7('0x66')]){case'always':_0xe2bb16=squel['insert']()[_0x0cc7('0x67')](_0x0cc7('0x68'))[_0x0cc7('0x69')]([_0x0cc7('0x6a'),_0x0cc7('0x6b'),_0x0cc7('0x6c'),_0x0cc7('0x6d'),_0x0cc7('0x59'),_0x0cc7('0x50'),'updatedAt'],squel[_0x0cc7('0x6e')]()[_0x0cc7('0x6f')](_0x0cc7('0x6a'),_0x0cc7('0x6a'))[_0x0cc7('0x6f')](_0x0cc7('0x70'),'scheduledAt')[_0x0cc7('0x6f')]('id','ContactId')[_0x0cc7('0x6f')](_0x4358a6[_0x0cc7('0x71')][_0x0cc7('0x72')](),_0x0cc7('0x6d'))[_0x0cc7('0x6f')](_0xa44183['params']['id'][_0x0cc7('0x72')](),'CampaignId')['field'](_0x0cc7('0x70'),_0x0cc7('0x50'))[_0x0cc7('0x6f')](_0x0cc7('0x70'),_0x0cc7('0x73'))[_0x0cc7('0x74')](_0x0cc7('0x75'))[_0x0cc7('0x3a')](_0x0cc7('0x76'))['where'](_0x0cc7('0x77'),_0x4358a6['CmListId'][_0x0cc7('0x72')]())['where'](_0x0cc7('0x78'))[_0x0cc7('0x3a')](_0x0cc7('0x79'),squel[_0x0cc7('0x6e')]()['field'](_0x0cc7('0x7a'))[_0x0cc7('0x74')](_0x0cc7('0x7b'))[_0x0cc7('0x3a')](_0x0cc7('0x7c'),_0xa44183[_0x0cc7('0x4d')]['id'][_0x0cc7('0x72')]()))[_0x0cc7('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0cc7('0x6e')]()['field'](_0x0cc7('0x7d'))[_0x0cc7('0x74')]('cm_hopper')[_0x0cc7('0x3a')](_0x0cc7('0x7c'),_0xa44183[_0x0cc7('0x4d')]['id'][_0x0cc7('0x72')]())))['toString']();break;case _0x0cc7('0x7e'):_0xe2bb16=squel[_0x0cc7('0x7f')]()[_0x0cc7('0x67')](_0x0cc7('0x68'))['fromQuery']([_0x0cc7('0x6a'),_0x0cc7('0x6b'),_0x0cc7('0x6c'),_0x0cc7('0x6d'),_0x0cc7('0x59'),_0x0cc7('0x50'),_0x0cc7('0x73')],squel[_0x0cc7('0x6e')]()[_0x0cc7('0x6f')](_0x0cc7('0x6a'),_0x0cc7('0x6a'))[_0x0cc7('0x6f')](_0x0cc7('0x70'),_0x0cc7('0x6b'))['field']('id',_0x0cc7('0x6c'))[_0x0cc7('0x6f')](_0x4358a6[_0x0cc7('0x71')][_0x0cc7('0x72')](),'ListId')[_0x0cc7('0x6f')](_0xa44183[_0x0cc7('0x4d')]['id'][_0x0cc7('0x72')](),_0x0cc7('0x59'))[_0x0cc7('0x6f')](_0x0cc7('0x70'),_0x0cc7('0x50'))[_0x0cc7('0x6f')](_0x0cc7('0x70'),_0x0cc7('0x73'))[_0x0cc7('0x74')](_0x0cc7('0x75'))[_0x0cc7('0x3a')]('deletedAt\x20IS\x20NULL')[_0x0cc7('0x3a')](_0x0cc7('0x77'),_0x4358a6[_0x0cc7('0x71')]['toString']())[_0x0cc7('0x3a')](_0x0cc7('0x78'))[_0x0cc7('0x3a')](_0x0cc7('0x79'),squel[_0x0cc7('0x6e')]()['field'](_0x0cc7('0x7d'))[_0x0cc7('0x74')](_0x0cc7('0x68'))[_0x0cc7('0x3a')](_0x0cc7('0x7c'),_0xa44183[_0x0cc7('0x4d')]['id'][_0x0cc7('0x72')]())))[_0x0cc7('0x72')]();break;default:_0xe2bb16=squel[_0x0cc7('0x7f')]()['into']('cm_hopper')[_0x0cc7('0x69')]([_0x0cc7('0x6a'),_0x0cc7('0x6b'),_0x0cc7('0x6c'),_0x0cc7('0x6d'),_0x0cc7('0x59'),'createdAt',_0x0cc7('0x73')],squel[_0x0cc7('0x6e')]()[_0x0cc7('0x6f')]('phone','phone')[_0x0cc7('0x6f')](_0x0cc7('0x70'),_0x0cc7('0x6b'))['field']('id',_0x0cc7('0x6c'))['field'](_0x4358a6[_0x0cc7('0x71')]['toString'](),_0x0cc7('0x6d'))[_0x0cc7('0x6f')](_0xa44183[_0x0cc7('0x4d')]['id'][_0x0cc7('0x72')](),'CampaignId')[_0x0cc7('0x6f')](_0x0cc7('0x70'),_0x0cc7('0x50'))['field']('NOW()','updatedAt')[_0x0cc7('0x74')](_0x0cc7('0x75'))[_0x0cc7('0x3a')]('deletedAt\x20IS\x20NULL')[_0x0cc7('0x3a')]('ListId\x20=\x20?',_0x4358a6[_0x0cc7('0x71')]['toString']())[_0x0cc7('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x0cc7('0x72')]();}_0x4d1dc0[_0x0cc7('0x80')](db['sequelize'][_0x0cc7('0x30')](_0xe2bb16));}return BPromise[_0x0cc7('0x81')](_0x4d1dc0);}})['then'](function(){return _0x184148;})[_0x0cc7('0x26')](respondWithResult(_0x1ba7ab,null))[_0x0cc7('0x3e')](handleError(_0x1ba7ab,null));};exports[_0x0cc7('0x82')]=function(_0x4bcb30,_0x415f2c,_0x585c9d){return db[_0x0cc7('0x2a')][_0x0cc7('0x41')]({'where':{'id':_0x4bcb30[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x415f2c,null))[_0x0cc7('0x26')](function(_0x49d6d9){if(_0x49d6d9){return _0x49d6d9[_0x0cc7('0x82')](_0x4bcb30['query'][_0x0cc7('0x64')]);}})[_0x0cc7('0x26')](function(_0x3cf27a){if(_0x3cf27a){return db[_0x0cc7('0x56')][_0x0cc7('0x25')]({'where':{'ListId':_0x4bcb30[_0x0cc7('0x30')]['ids'],'CampaignId':_0x4bcb30[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](function(){return _0x3cf27a;});}})[_0x0cc7('0x26')](respondWithStatusCode(_0x415f2c,null))[_0x0cc7('0x3e')](handleError(_0x415f2c,null));};exports['getBlackLists']=function(_0x811332,_0x34fc35,_0x2c65bf){var _0x4bf868={};var _0x10f5d1={};var _0x167e98;var _0x471572;return db[_0x0cc7('0x2a')][_0x0cc7('0x55')]({'where':{'id':_0x811332[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x34fc35,null))[_0x0cc7('0x26')](function(_0x1e428a){if(_0x1e428a){_0x167e98=_0x1e428a;_0x10f5d1[_0x0cc7('0x2e')]=_[_0x0cc7('0x31')](db[_0x0cc7('0x62')][_0x0cc7('0x2b')]);_0x10f5d1['query']=_[_0x0cc7('0x31')](_0x811332[_0x0cc7('0x30')]);_0x10f5d1[_0x0cc7('0x32')]=_[_0x0cc7('0x33')](_0x10f5d1[_0x0cc7('0x2e')],_0x10f5d1[_0x0cc7('0x30')]);_0x4bf868['attributes']=_['intersection'](_0x10f5d1[_0x0cc7('0x2e')],qs[_0x0cc7('0x34')](_0x811332[_0x0cc7('0x30')][_0x0cc7('0x34')]));_0x4bf868['attributes']=_0x4bf868[_0x0cc7('0x35')][_0x0cc7('0x36')]?_0x4bf868[_0x0cc7('0x35')]:_0x10f5d1[_0x0cc7('0x2e')];_0x4bf868[_0x0cc7('0x38')]=qs[_0x0cc7('0x39')](_0x811332[_0x0cc7('0x30')][_0x0cc7('0x39')]);_0x4bf868[_0x0cc7('0x3a')]=qs[_0x0cc7('0x32')](_[_0x0cc7('0x58')](_0x811332[_0x0cc7('0x30')],_0x10f5d1[_0x0cc7('0x32')]));if(_0x811332[_0x0cc7('0x30')]['filter']){_0x4bf868[_0x0cc7('0x3a')]=_[_0x0cc7('0x3c')](_0x4bf868['where'],{'$or':_['map'](_0x4bf868['attributes'],function(_0x3b7f3b){var _0x402972={};_0x402972[_0x3b7f3b]={'$like':'%'+_0x811332[_0x0cc7('0x30')][_0x0cc7('0x3b')]+'%'};return _0x402972;})});}_0x4bf868=_[_0x0cc7('0x3c')]({},_0x4bf868,_0x811332[_0x0cc7('0x40')]);return _0x167e98[_0x0cc7('0x83')](_0x4bf868);}})[_0x0cc7('0x26')](function(_0x2a819f){if(_0x2a819f){_0x471572=_0x2a819f[_0x0cc7('0x36')];if(!_0x811332[_0x0cc7('0x30')][_0x0cc7('0x57')](_0x0cc7('0x37'))){_0x4bf868[_0x0cc7('0x1d')]=qs['limit'](_0x811332['query'][_0x0cc7('0x1d')]);_0x4bf868[_0x0cc7('0x1b')]=qs['offset'](_0x811332[_0x0cc7('0x30')][_0x0cc7('0x1b')]);}return _0x167e98[_0x0cc7('0x83')](_0x4bf868);}})[_0x0cc7('0x26')](function(_0x21a13c){if(_0x21a13c){return _0x21a13c?{'count':_0x471572,'rows':_0x21a13c}:null;}})[_0x0cc7('0x26')](respondWithResult(_0x34fc35,null))[_0x0cc7('0x3e')](handleError(_0x34fc35,null));};exports[_0x0cc7('0x84')]=function(_0x424837,_0x2dc29c,_0x169a43){var _0xb77a6c,_0xba6655;return db['Campaign'][_0x0cc7('0x41')]({'where':{'id':_0x424837[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x2dc29c,null))[_0x0cc7('0x26')](function(_0x4f2b62){if(_0x4f2b62){_0xba6655=_0x4f2b62;return _0x4f2b62['addBlackLists'](_0x424837[_0x0cc7('0x53')][_0x0cc7('0x64')],_[_0x0cc7('0x4f')](_0x424837['body'],[_0x0cc7('0x64'),'id'])||{});}return null;})[_0x0cc7('0x65')](function(_0x130387){var _0x43fbc9;_0xb77a6c=_0x130387||[];var _0x3410e2=[];if(_0x130387){for(var _0x30e8f7=0x0;_0x30e8f7<_0x130387[_0x0cc7('0x36')];_0x30e8f7+=0x1){var _0x4a2608=_0x130387[_0x30e8f7][_0x0cc7('0x43')]({'plain':!![]});_0x43fbc9=squel[_0x0cc7('0x7f')]()[_0x0cc7('0x67')]('cm_hopper_black')[_0x0cc7('0x69')]([_0x0cc7('0x6a'),_0x0cc7('0x6c'),'ListId',_0x0cc7('0x59'),_0x0cc7('0x50'),_0x0cc7('0x73')],squel['select']()[_0x0cc7('0x6f')]('phone',_0x0cc7('0x6a'))[_0x0cc7('0x6f')]('id',_0x0cc7('0x6c'))[_0x0cc7('0x6f')](_0x4a2608[_0x0cc7('0x71')][_0x0cc7('0x72')](),'ListId')[_0x0cc7('0x6f')](_0x424837['params']['id'][_0x0cc7('0x72')](),_0x0cc7('0x59'))[_0x0cc7('0x6f')]('NOW()',_0x0cc7('0x50'))[_0x0cc7('0x6f')](_0x0cc7('0x70'),_0x0cc7('0x73'))[_0x0cc7('0x74')]('cm_contacts')[_0x0cc7('0x3a')](_0x0cc7('0x76'))['where']('ListId\x20=\x20?',_0x4a2608[_0x0cc7('0x71')][_0x0cc7('0x72')]())[_0x0cc7('0x3a')](_0x0cc7('0x78')))[_0x0cc7('0x72')]();_0x3410e2[_0x0cc7('0x80')](db['sequelize'][_0x0cc7('0x30')](_0x43fbc9));}return BPromise[_0x0cc7('0x81')](_0x3410e2);}})[_0x0cc7('0x26')](function(){return _0xb77a6c;})[_0x0cc7('0x26')](respondWithResult(_0x2dc29c,null))['catch'](handleError(_0x2dc29c,null));};exports['removeBlackLists']=function(_0x4c34fc,_0x99db35,_0x446b74){return db[_0x0cc7('0x2a')]['find']({'where':{'id':_0x4c34fc[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](handleEntityNotFound(_0x99db35,null))[_0x0cc7('0x26')](function(_0xdb096f){if(_0xdb096f){return _0xdb096f['removeBlackLists'](_0x4c34fc[_0x0cc7('0x30')]['ids']);}})['then'](function(_0x5cc61e){if(_0x5cc61e){return db[_0x0cc7('0x60')]['destroy']({'where':{'ListId':_0x4c34fc[_0x0cc7('0x30')][_0x0cc7('0x64')],'CampaignId':_0x4c34fc[_0x0cc7('0x4d')]['id']}})[_0x0cc7('0x26')](function(){return _0x5cc61e;});}})['then'](respondWithStatusCode(_0x99db35,null))[_0x0cc7('0x3e')](handleError(_0x99db35,null));}; \ No newline at end of file +var _0x0a42=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','count','offset','set','json','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','name','send','index','map','Campaign','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','keys','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','nolimit','order','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x23a042,_0x169361){var _0x57543a=function(_0x1fccec){while(--_0x1fccec){_0x23a042['push'](_0x23a042['shift']());}};_0x57543a(++_0x169361);}(_0x0a42,0x181));var _0x20a4=function(_0x5d4670,_0x14cb4e){_0x5d4670=_0x5d4670-0x0;var _0x506b7b=_0x0a42[_0x5d4670];return _0x506b7b;};'use strict';var emlformat=require(_0x20a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x20a4('0x1'));var jsonpatch=require(_0x20a4('0x2'));var rp=require(_0x20a4('0x3'));var moment=require(_0x20a4('0x4'));var BPromise=require(_0x20a4('0x5'));var Mustache=require('mustache');var util=require(_0x20a4('0x6'));var path=require(_0x20a4('0x7'));var sox=require(_0x20a4('0x8'));var csv=require(_0x20a4('0x9'));var ejs=require(_0x20a4('0xa'));var fs=require('fs');var fs_extra=require(_0x20a4('0xb'));var _=require(_0x20a4('0xc'));var squel=require(_0x20a4('0xd'));var crypto=require(_0x20a4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x20a4('0xf'));var toCsv=require(_0x20a4('0x9'));var querystring=require('querystring');var Papa=require(_0x20a4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x20a4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20a4('0x12'));var logger=require('../../config/logger')(_0x20a4('0x13'));var utils=require(_0x20a4('0x14'));var config=require(_0x20a4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x20a4('0x16'))['db'];function respondWithStatusCode(_0x46d5b8,_0x48a258){_0x48a258=_0x48a258||0xcc;return function(_0x3d12ae){if(_0x3d12ae){return _0x46d5b8[_0x20a4('0x17')](_0x48a258);}return _0x46d5b8[_0x20a4('0x18')](_0x48a258)[_0x20a4('0x19')]();};}function respondWithResult(_0x5cbf7f,_0x2d0fcf){_0x2d0fcf=_0x2d0fcf||0xc8;return function(_0x5b7fb2){if(_0x5b7fb2){return _0x5cbf7f[_0x20a4('0x18')](_0x2d0fcf)['json'](_0x5b7fb2);}};}function respondWithFilteredResult(_0x433267,_0x42cc59){return function(_0x41a9dd){if(_0x41a9dd){var _0x4281b0=typeof _0x42cc59['offset']==='undefined'&&typeof _0x42cc59[_0x20a4('0x1a')]==='undefined';var _0x4568f1=_0x41a9dd[_0x20a4('0x1b')];var _0x526ad0=_0x4281b0?0x0:_0x42cc59[_0x20a4('0x1c')];var _0xb565fc=_0x4281b0?_0x41a9dd[_0x20a4('0x1b')]:_0x42cc59[_0x20a4('0x1c')]+_0x42cc59[_0x20a4('0x1a')];var _0x1de1bd;if(_0xb565fc>=_0x4568f1){_0xb565fc=_0x4568f1;_0x1de1bd=0xc8;}else{_0x1de1bd=0xce;}_0x433267[_0x20a4('0x18')](_0x1de1bd);return _0x433267[_0x20a4('0x1d')]('Content-Range',_0x526ad0+'-'+_0xb565fc+'/'+_0x4568f1)[_0x20a4('0x1e')](_0x41a9dd);}return null;};}function patchUpdates(_0x1ec701){return function(_0x418380){try{jsonpatch[_0x20a4('0x1f')](_0x418380,_0x1ec701,!![]);}catch(_0x46909b){return BPromise[_0x20a4('0x20')](_0x46909b);}return _0x418380['save']();};}function saveUpdates(_0xdff68b,_0x2e7133){return function(_0x3915a4){if(_0x3915a4){return _0x3915a4[_0x20a4('0x21')](_0xdff68b)[_0x20a4('0x22')](function(_0x170ac2){return _0x170ac2;});}return null;};}function removeEntity(_0x2ffd5a,_0x277507){return function(_0x16b313){if(_0x16b313){return _0x16b313[_0x20a4('0x23')]()[_0x20a4('0x22')](function(){var _0x33f048=_0x16b313[_0x20a4('0x24')]({'plain':!![]});var _0x52ece=_0x20a4('0x25');return db[_0x20a4('0x26')][_0x20a4('0x23')]({'where':{'type':_0x52ece,'resourceId':_0x33f048['id']}})[_0x20a4('0x22')](function(){return _0x16b313;});})['then'](function(){_0x2ffd5a[_0x20a4('0x18')](0xcc)[_0x20a4('0x19')]();});}};}function handleEntityNotFound(_0x445d59,_0x250306){return function(_0x3162d8){if(!_0x3162d8){_0x445d59[_0x20a4('0x17')](0x194);}return _0x3162d8;};}function handleError(_0x55755a,_0x1eb1c7){_0x1eb1c7=_0x1eb1c7||0x1f4;return function(_0x4195dd){logger['error'](_0x4195dd['stack']);if(_0x4195dd[_0x20a4('0x27')]){delete _0x4195dd[_0x20a4('0x27')];}_0x55755a[_0x20a4('0x18')](_0x1eb1c7)[_0x20a4('0x28')](_0x4195dd);};}exports[_0x20a4('0x29')]=function(_0xd4077c,_0x5a25f3){var _0x3b2c82={},_0x329b1e={},_0x10ac7f={'count':0x0,'rows':[]};var _0x1b30fb=_[_0x20a4('0x2a')](db[_0x20a4('0x2b')][_0x20a4('0x2c')],function(_0x43374b){return{'name':_0x43374b[_0x20a4('0x2d')],'type':_0x43374b[_0x20a4('0x2e')]['key']};});_0x329b1e[_0x20a4('0x2f')]=_[_0x20a4('0x2a')](_0x1b30fb,_0x20a4('0x27'));_0x329b1e[_0x20a4('0x30')]=_['keys'](_0xd4077c[_0x20a4('0x30')]);_0x329b1e['filters']=_[_0x20a4('0x31')](_0x329b1e['model'],_0x329b1e['query']);_0x3b2c82[_0x20a4('0x32')]=_[_0x20a4('0x31')](_0x329b1e[_0x20a4('0x2f')],qs['fields'](_0xd4077c['query'][_0x20a4('0x33')]));_0x3b2c82['attributes']=_0x3b2c82[_0x20a4('0x32')][_0x20a4('0x34')]?_0x3b2c82[_0x20a4('0x32')]:_0x329b1e[_0x20a4('0x2f')];if(!_0xd4077c[_0x20a4('0x30')][_0x20a4('0x35')]('nolimit')){_0x3b2c82[_0x20a4('0x1a')]=qs[_0x20a4('0x1a')](_0xd4077c[_0x20a4('0x30')]['limit']);_0x3b2c82['offset']=qs[_0x20a4('0x1c')](_0xd4077c[_0x20a4('0x30')][_0x20a4('0x1c')]);}_0x3b2c82['order']=qs[_0x20a4('0x36')](_0xd4077c[_0x20a4('0x30')][_0x20a4('0x36')]);_0x3b2c82[_0x20a4('0x37')]=qs[_0x20a4('0x38')](_[_0x20a4('0x39')](_0xd4077c['query'],_0x329b1e[_0x20a4('0x38')]),_0x1b30fb);if(_0xd4077c[_0x20a4('0x30')]['filter']){_0x3b2c82[_0x20a4('0x37')]=_[_0x20a4('0x3a')](_0x3b2c82[_0x20a4('0x37')],{'$or':_['map'](_0x1b30fb,function(_0x1763f3){if(_0x1763f3[_0x20a4('0x2e')]!==_0x20a4('0x3b')){var _0x4cb0b7={};_0x4cb0b7[_0x1763f3[_0x20a4('0x27')]]={'$like':'%'+_0xd4077c[_0x20a4('0x30')][_0x20a4('0x3c')]+'%'};return _0x4cb0b7;}})});}_0x3b2c82=_[_0x20a4('0x3a')]({},_0x3b2c82,_0xd4077c['options']);var _0x44aeaa={'where':_0x3b2c82['where']};return db[_0x20a4('0x2b')]['count'](_0x44aeaa)[_0x20a4('0x22')](function(_0x336610){_0x10ac7f['count']=_0x336610;if(_0xd4077c[_0x20a4('0x30')][_0x20a4('0x3d')]){_0x3b2c82[_0x20a4('0x3e')]=[{'all':!![]}];}return db['Campaign'][_0x20a4('0x3f')](_0x3b2c82);})['then'](function(_0x2ffbae){_0x10ac7f[_0x20a4('0x40')]=_0x2ffbae;return _0x10ac7f;})['then'](respondWithFilteredResult(_0x5a25f3,_0x3b2c82))['catch'](handleError(_0x5a25f3,null));};exports['show']=function(_0x3c484b,_0x51467f){var _0x419cf6={'raw':![],'where':{'id':_0x3c484b[_0x20a4('0x41')]['id']}},_0x2872f2={};_0x2872f2['model']=_['keys'](db['Campaign']['rawAttributes']);_0x2872f2[_0x20a4('0x30')]=_[_0x20a4('0x42')](_0x3c484b[_0x20a4('0x30')]);_0x2872f2['filters']=_['intersection'](_0x2872f2[_0x20a4('0x2f')],_0x2872f2[_0x20a4('0x30')]);_0x419cf6[_0x20a4('0x32')]=_[_0x20a4('0x31')](_0x2872f2[_0x20a4('0x2f')],qs[_0x20a4('0x33')](_0x3c484b[_0x20a4('0x30')][_0x20a4('0x33')]));_0x419cf6[_0x20a4('0x32')]=_0x419cf6['attributes'][_0x20a4('0x34')]?_0x419cf6[_0x20a4('0x32')]:_0x2872f2['model'];if(_0x3c484b[_0x20a4('0x30')][_0x20a4('0x3d')]){_0x419cf6['include']=[{'all':!![]}];}_0x419cf6=_['merge']({},_0x419cf6,_0x3c484b['options']);return db[_0x20a4('0x2b')][_0x20a4('0x43')](_0x419cf6)[_0x20a4('0x22')](handleEntityNotFound(_0x51467f,null))[_0x20a4('0x22')](respondWithResult(_0x51467f,null))[_0x20a4('0x44')](handleError(_0x51467f,null));};exports[_0x20a4('0x45')]=function(_0x36c334,_0x500f1d){return db[_0x20a4('0x2b')][_0x20a4('0x45')](_0x36c334[_0x20a4('0x46')],{})['then'](function(_0x57c74b){var _0x35d988=_0x36c334[_0x20a4('0x47')]['get']({'plain':!![]});if(!_0x35d988)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35d988[_0x20a4('0x48')]===_0x20a4('0x47')){var _0x500339=_0x57c74b[_0x20a4('0x24')]({'plain':!![]});var _0xd8f01a=_0x20a4('0x25');return db[_0x20a4('0x49')]['find']({'where':{'name':_0xd8f01a,'userProfileId':_0x35d988[_0x20a4('0x4a')]},'raw':!![]})['then'](function(_0x1fe883){if(_0x1fe883&&_0x1fe883[_0x20a4('0x4b')]===0x0){return db[_0x20a4('0x26')][_0x20a4('0x45')]({'name':_0x500339['name'],'resourceId':_0x500339['id'],'type':_0x1fe883['name'],'sectionId':_0x1fe883['id']},{})[_0x20a4('0x22')](function(){return _0x57c74b;});}else{return _0x57c74b;}})[_0x20a4('0x44')](function(_0x5972a4){logger[_0x20a4('0x4c')](_0x20a4('0x4d'),_0x5972a4);throw _0x5972a4;});}return _0x57c74b;})[_0x20a4('0x22')](respondWithResult(_0x500f1d,0xc9))[_0x20a4('0x44')](handleError(_0x500f1d,null));};exports[_0x20a4('0x4e')]=function(_0x423315,_0x5991e7){var _0x18aa4d={'where':{'id':_0x423315[_0x20a4('0x41')]['id']}},_0xe45fde={};_0xe45fde['model']=_[_0x20a4('0x42')](db[_0x20a4('0x2b')]['rawAttributes']);_0x18aa4d[_0x20a4('0x32')]=_['intersection'](_0xe45fde[_0x20a4('0x2f')],qs[_0x20a4('0x33')](_0x423315[_0x20a4('0x30')]['fields']));_0x18aa4d[_0x20a4('0x32')]=_0x18aa4d[_0x20a4('0x32')]['length']?_0x18aa4d[_0x20a4('0x32')]:_0xe45fde['model'];if(_0x423315[_0x20a4('0x30')]['includeAll']){_0x18aa4d[_0x20a4('0x3e')]=[{'all':!![]}];}_0x18aa4d=_[_0x20a4('0x3a')]({},_0x18aa4d,_0x423315[_0x20a4('0x4f')]);return db[_0x20a4('0x2b')][_0x20a4('0x43')](_0x18aa4d)[_0x20a4('0x22')](handleEntityNotFound(_0x5991e7,null))['then'](function(_0xf38db6){if(_0xf38db6){var _0x1593c9=_0xf38db6[_0x20a4('0x24')]({'plain':!![]});_0x1593c9=qs['omit'](_0x1593c9,['id',_0x20a4('0x50'),_0x20a4('0x51')]);_0x423315[_0x20a4('0x46')]=_[_0x20a4('0x52')](_0x423315['body'],['id',_0x20a4('0x50'),_0x20a4('0x51')]);return db[_0x20a4('0x2b')][_0x20a4('0x45')](_['merge'](_0x1593c9,_0x423315['body']),{'include':_0x423315['query'][_0x20a4('0x3d')]?[{'all':!![]}]:undefined})[_0x20a4('0x22')](function(_0x2aadfa){var _0x1b9a2c=_0x423315[_0x20a4('0x47')][_0x20a4('0x24')]({'plain':!![]});if(!_0x1b9a2c)throw new Error(_0x20a4('0x53'));if(_0x1b9a2c[_0x20a4('0x48')]===_0x20a4('0x47')){var _0x1d4db7=_0x2aadfa[_0x20a4('0x24')]({'plain':!![]});var _0x4c7059=_0x20a4('0x25');return db['UserProfileSection'][_0x20a4('0x43')]({'where':{'name':_0x4c7059,'userProfileId':_0x1b9a2c['userProfileId']},'raw':!![]})[_0x20a4('0x22')](function(_0x286541){if(_0x286541&&_0x286541[_0x20a4('0x4b')]===0x0){return db[_0x20a4('0x26')][_0x20a4('0x45')]({'name':_0x1d4db7['name'],'resourceId':_0x1d4db7['id'],'type':_0x286541['name'],'sectionId':_0x286541['id']},{})[_0x20a4('0x22')](function(){return _0x2aadfa;});}else{return _0x2aadfa;}})['catch'](function(_0xf31f53){logger[_0x20a4('0x4c')](_0x20a4('0x4d'),_0xf31f53);throw _0xf31f53;});}return _0x2aadfa;});}})[_0x20a4('0x22')](respondWithResult(_0x5991e7,0xc9))['catch'](handleError(_0x5991e7,null));};exports[_0x20a4('0x21')]=function(_0x2a90b3,_0x2b9af4){if(_0x2a90b3['body']['id']){delete _0x2a90b3[_0x20a4('0x46')]['id'];}return db[_0x20a4('0x2b')]['find']({'where':{'id':_0x2a90b3[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x2b9af4,null))[_0x20a4('0x22')](saveUpdates(_0x2a90b3['body'],null))[_0x20a4('0x22')](respondWithResult(_0x2b9af4,null))[_0x20a4('0x44')](handleError(_0x2b9af4,null));};exports[_0x20a4('0x23')]=function(_0x1f92d2,_0x4ae17d){return db[_0x20a4('0x2b')]['find']({'where':{'id':_0x1f92d2[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x4ae17d,null))[_0x20a4('0x22')](removeEntity(_0x4ae17d,null))[_0x20a4('0x44')](handleError(_0x4ae17d,null));};exports[_0x20a4('0x54')]=function(_0x5f3d83,_0x18cf01,_0x5c3f5f){var _0x3ab697={'raw':!![],'where':{}};var _0x18c42f={};var _0x1b1083={'count':0x0,'rows':[]};return db[_0x20a4('0x2b')][_0x20a4('0x55')]({'where':{'id':_0x5f3d83[_0x20a4('0x41')]['id']}})['then'](handleEntityNotFound(_0x18cf01,null))[_0x20a4('0x22')](function(_0x3d0d6b){if(_0x3d0d6b){_0x18c42f[_0x20a4('0x2f')]=_[_0x20a4('0x42')](db['CmHopper'][_0x20a4('0x2c')]);_0x18c42f[_0x20a4('0x30')]=_['keys'](_0x5f3d83[_0x20a4('0x30')]);_0x18c42f[_0x20a4('0x38')]=_[_0x20a4('0x31')](_0x18c42f[_0x20a4('0x2f')],_0x18c42f[_0x20a4('0x30')]);_0x3ab697[_0x20a4('0x32')]=_[_0x20a4('0x31')](_0x18c42f[_0x20a4('0x2f')],qs[_0x20a4('0x33')](_0x5f3d83['query'][_0x20a4('0x33')]));_0x3ab697[_0x20a4('0x32')]=_0x3ab697[_0x20a4('0x32')][_0x20a4('0x34')]?_0x3ab697[_0x20a4('0x32')]:_0x18c42f[_0x20a4('0x2f')];if(!_0x5f3d83['query']['hasOwnProperty'](_0x20a4('0x56'))){_0x3ab697[_0x20a4('0x1a')]=qs[_0x20a4('0x1a')](_0x5f3d83[_0x20a4('0x30')][_0x20a4('0x1a')]);_0x3ab697[_0x20a4('0x1c')]=qs[_0x20a4('0x1c')](_0x5f3d83['query'][_0x20a4('0x1c')]);}_0x3ab697[_0x20a4('0x57')]=qs[_0x20a4('0x36')](_0x5f3d83[_0x20a4('0x30')][_0x20a4('0x36')]);_0x3ab697[_0x20a4('0x37')]=qs[_0x20a4('0x38')](_['pick'](_0x5f3d83[_0x20a4('0x30')],_0x18c42f[_0x20a4('0x38')]));_0x3ab697[_0x20a4('0x37')][_0x20a4('0x58')]=_0x3d0d6b['id'];if(_0x5f3d83[_0x20a4('0x30')][_0x20a4('0x3c')]){_0x3ab697[_0x20a4('0x37')]=_['merge'](_0x3ab697['where'],{'$or':_[_0x20a4('0x2a')](_0x3ab697[_0x20a4('0x32')],function(_0xff3cb7){var _0x2c1b6b={};_0x2c1b6b[_0xff3cb7]={'$like':'%'+_0x5f3d83[_0x20a4('0x30')][_0x20a4('0x3c')]+'%'};return _0x2c1b6b;})});}_0x3ab697=_[_0x20a4('0x3a')]({},_0x3ab697,_0x5f3d83[_0x20a4('0x4f')]);return db[_0x20a4('0x59')][_0x20a4('0x1b')]({'where':_0x3ab697[_0x20a4('0x37')]})[_0x20a4('0x22')](function(_0x2c9e07){_0x1b1083['count']=_0x2c9e07;if(_0x5f3d83[_0x20a4('0x30')][_0x20a4('0x3d')]){_0x3ab697[_0x20a4('0x3e')]=[{'all':!![]}];}return db['CmHopper'][_0x20a4('0x3f')](_0x3ab697);})['then'](function(_0x9b1c8c){_0x1b1083['rows']=_0x9b1c8c;return _0x1b1083;});}})[_0x20a4('0x22')](respondWithFilteredResult(_0x18cf01,_0x3ab697))[_0x20a4('0x44')](handleError(_0x18cf01,null));};exports[_0x20a4('0x5a')]=function(_0x176abf,_0x105588,_0xc7b766){var _0x120946={'raw':!![],'where':{}};var _0x29cbf4={};var _0xfd276={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x176abf[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x105588,null))[_0x20a4('0x22')](function(_0x4d909e){if(_0x4d909e){_0x29cbf4['model']=_[_0x20a4('0x42')](db['CmHopperHistory'][_0x20a4('0x2c')]);_0x29cbf4[_0x20a4('0x30')]=_['keys'](_0x176abf[_0x20a4('0x30')]);_0x29cbf4[_0x20a4('0x38')]=_[_0x20a4('0x31')](_0x29cbf4[_0x20a4('0x2f')],_0x29cbf4[_0x20a4('0x30')]);_0x120946[_0x20a4('0x32')]=_['intersection'](_0x29cbf4[_0x20a4('0x2f')],qs['fields'](_0x176abf[_0x20a4('0x30')][_0x20a4('0x33')]));_0x120946[_0x20a4('0x32')]=_0x120946[_0x20a4('0x32')][_0x20a4('0x34')]?_0x120946['attributes']:_0x29cbf4['model'];if(!_0x176abf[_0x20a4('0x30')][_0x20a4('0x35')]('nolimit')){_0x120946[_0x20a4('0x1a')]=qs[_0x20a4('0x1a')](_0x176abf['query']['limit']);_0x120946[_0x20a4('0x1c')]=qs[_0x20a4('0x1c')](_0x176abf[_0x20a4('0x30')]['offset']);}_0x120946['order']=qs['sort'](_0x176abf[_0x20a4('0x30')][_0x20a4('0x36')]);_0x120946['where']=qs['filters'](_[_0x20a4('0x39')](_0x176abf[_0x20a4('0x30')],_0x29cbf4[_0x20a4('0x38')]));_0x120946['where'][_0x20a4('0x58')]=_0x4d909e['id'];if(_0x176abf[_0x20a4('0x30')][_0x20a4('0x3c')]){_0x120946[_0x20a4('0x37')]=_[_0x20a4('0x3a')](_0x120946[_0x20a4('0x37')],{'$or':_[_0x20a4('0x2a')](_0x120946[_0x20a4('0x32')],function(_0x30055e){var _0x645978={};_0x645978[_0x30055e]={'$like':'%'+_0x176abf[_0x20a4('0x30')]['filter']+'%'};return _0x645978;})});}_0x120946=_[_0x20a4('0x3a')]({},_0x120946,_0x176abf['options']);return db[_0x20a4('0x5b')][_0x20a4('0x1b')]({'where':_0x120946[_0x20a4('0x37')]})[_0x20a4('0x22')](function(_0x450b66){_0xfd276[_0x20a4('0x1b')]=_0x450b66;if(_0x176abf['query'][_0x20a4('0x3d')]){_0x120946[_0x20a4('0x3e')]=[{'all':!![]}];}return db[_0x20a4('0x5b')][_0x20a4('0x3f')](_0x120946);})[_0x20a4('0x22')](function(_0x375b2b){_0xfd276[_0x20a4('0x40')]=_0x375b2b;return _0xfd276;});}})[_0x20a4('0x22')](respondWithFilteredResult(_0x105588,_0x120946))[_0x20a4('0x44')](handleError(_0x105588,null));};exports[_0x20a4('0x5c')]=function(_0x59bb23,_0x5634b6,_0x15da12){var _0x27c473={'raw':!![],'where':{}};var _0x1dc973={};var _0x2dfd6={'count':0x0,'rows':[]};return db[_0x20a4('0x2b')][_0x20a4('0x55')]({'where':{'id':_0x59bb23[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x5634b6,null))['then'](function(_0x314441){if(_0x314441){_0x1dc973[_0x20a4('0x2f')]=_[_0x20a4('0x42')](db[_0x20a4('0x5d')][_0x20a4('0x2c')]);_0x1dc973['query']=_[_0x20a4('0x42')](_0x59bb23[_0x20a4('0x30')]);_0x1dc973[_0x20a4('0x38')]=_[_0x20a4('0x31')](_0x1dc973[_0x20a4('0x2f')],_0x1dc973['query']);_0x27c473[_0x20a4('0x32')]=_[_0x20a4('0x31')](_0x1dc973[_0x20a4('0x2f')],qs[_0x20a4('0x33')](_0x59bb23['query'][_0x20a4('0x33')]));_0x27c473[_0x20a4('0x32')]=_0x27c473[_0x20a4('0x32')][_0x20a4('0x34')]?_0x27c473[_0x20a4('0x32')]:_0x1dc973[_0x20a4('0x2f')];if(!_0x59bb23[_0x20a4('0x30')][_0x20a4('0x35')](_0x20a4('0x56'))){_0x27c473[_0x20a4('0x1a')]=qs[_0x20a4('0x1a')](_0x59bb23[_0x20a4('0x30')]['limit']);_0x27c473['offset']=qs[_0x20a4('0x1c')](_0x59bb23[_0x20a4('0x30')]['offset']);}_0x27c473[_0x20a4('0x57')]=qs[_0x20a4('0x36')](_0x59bb23[_0x20a4('0x30')][_0x20a4('0x36')]);_0x27c473[_0x20a4('0x37')]=qs['filters'](_['pick'](_0x59bb23[_0x20a4('0x30')],_0x1dc973[_0x20a4('0x38')]));_0x27c473[_0x20a4('0x37')][_0x20a4('0x58')]=_0x314441['id'];if(_0x59bb23[_0x20a4('0x30')]['filter']){_0x27c473[_0x20a4('0x37')]=_['merge'](_0x27c473[_0x20a4('0x37')],{'$or':_[_0x20a4('0x2a')](_0x27c473['attributes'],function(_0x11afa6){var _0x1f2fb8={};_0x1f2fb8[_0x11afa6]={'$like':'%'+_0x59bb23[_0x20a4('0x30')][_0x20a4('0x3c')]+'%'};return _0x1f2fb8;})});}_0x27c473=_[_0x20a4('0x3a')]({},_0x27c473,_0x59bb23['options']);return db[_0x20a4('0x5d')][_0x20a4('0x1b')]({'where':_0x27c473['where']})[_0x20a4('0x22')](function(_0x8fb01c){_0x2dfd6[_0x20a4('0x1b')]=_0x8fb01c;if(_0x59bb23[_0x20a4('0x30')][_0x20a4('0x3d')]){_0x27c473[_0x20a4('0x3e')]=[{'all':!![]}];}return db[_0x20a4('0x5d')][_0x20a4('0x3f')](_0x27c473);})[_0x20a4('0x22')](function(_0x4da0d9){_0x2dfd6[_0x20a4('0x40')]=_0x4da0d9;return _0x2dfd6;});}})[_0x20a4('0x22')](respondWithFilteredResult(_0x5634b6,_0x27c473))['catch'](handleError(_0x5634b6,null));};exports['getHopperBlacks']=function(_0x2a9bf3,_0x446561,_0x4e820d){var _0x200f58={'raw':!![],'where':{}};var _0x2a1255={};var _0x41ce45={'count':0x0,'rows':[]};return db[_0x20a4('0x2b')][_0x20a4('0x55')]({'where':{'id':_0x2a9bf3['params']['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x446561,null))[_0x20a4('0x22')](function(_0x3a1905){if(_0x3a1905){_0x2a1255[_0x20a4('0x2f')]=_[_0x20a4('0x42')](db[_0x20a4('0x5e')][_0x20a4('0x2c')]);_0x2a1255['query']=_[_0x20a4('0x42')](_0x2a9bf3[_0x20a4('0x30')]);_0x2a1255['filters']=_['intersection'](_0x2a1255[_0x20a4('0x2f')],_0x2a1255['query']);_0x200f58[_0x20a4('0x32')]=_['intersection'](_0x2a1255[_0x20a4('0x2f')],qs[_0x20a4('0x33')](_0x2a9bf3['query'][_0x20a4('0x33')]));_0x200f58[_0x20a4('0x32')]=_0x200f58['attributes'][_0x20a4('0x34')]?_0x200f58[_0x20a4('0x32')]:_0x2a1255[_0x20a4('0x2f')];if(!_0x2a9bf3['query'][_0x20a4('0x35')](_0x20a4('0x56'))){_0x200f58['limit']=qs[_0x20a4('0x1a')](_0x2a9bf3[_0x20a4('0x30')][_0x20a4('0x1a')]);_0x200f58['offset']=qs[_0x20a4('0x1c')](_0x2a9bf3[_0x20a4('0x30')][_0x20a4('0x1c')]);}_0x200f58[_0x20a4('0x57')]=qs[_0x20a4('0x36')](_0x2a9bf3[_0x20a4('0x30')][_0x20a4('0x36')]);_0x200f58['where']=qs[_0x20a4('0x38')](_[_0x20a4('0x39')](_0x2a9bf3[_0x20a4('0x30')],_0x2a1255[_0x20a4('0x38')]));_0x200f58[_0x20a4('0x37')]['CampaignId']=_0x3a1905['id'];if(_0x2a9bf3[_0x20a4('0x30')][_0x20a4('0x3c')]){_0x200f58[_0x20a4('0x37')]=_[_0x20a4('0x3a')](_0x200f58[_0x20a4('0x37')],{'$or':_[_0x20a4('0x2a')](_0x200f58['attributes'],function(_0x44d2e7){var _0xe57108={};_0xe57108[_0x44d2e7]={'$like':'%'+_0x2a9bf3[_0x20a4('0x30')][_0x20a4('0x3c')]+'%'};return _0xe57108;})});}_0x200f58=_[_0x20a4('0x3a')]({},_0x200f58,_0x2a9bf3[_0x20a4('0x4f')]);return db[_0x20a4('0x5e')][_0x20a4('0x1b')]({'where':_0x200f58[_0x20a4('0x37')]})[_0x20a4('0x22')](function(_0x3966d5){_0x41ce45[_0x20a4('0x1b')]=_0x3966d5;if(_0x2a9bf3[_0x20a4('0x30')]['includeAll']){_0x200f58[_0x20a4('0x3e')]=[{'all':!![]}];}return db[_0x20a4('0x5e')][_0x20a4('0x3f')](_0x200f58);})['then'](function(_0x214cf1){_0x41ce45[_0x20a4('0x40')]=_0x214cf1;return _0x41ce45;});}})['then'](respondWithFilteredResult(_0x446561,_0x200f58))[_0x20a4('0x44')](handleError(_0x446561,null));};exports[_0x20a4('0x5f')]=function(_0x3c797a,_0x434d5f,_0x47810){var _0x190cc6={};var _0xcd76d8={};var _0x4c4282;var _0x427796;return db['Campaign'][_0x20a4('0x55')]({'where':{'id':_0x3c797a['params']['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x434d5f,null))[_0x20a4('0x22')](function(_0x15d32d){if(_0x15d32d){_0x4c4282=_0x15d32d;_0xcd76d8['model']=_[_0x20a4('0x42')](db[_0x20a4('0x60')]['rawAttributes']);_0xcd76d8['query']=_[_0x20a4('0x42')](_0x3c797a[_0x20a4('0x30')]);_0xcd76d8[_0x20a4('0x38')]=_[_0x20a4('0x31')](_0xcd76d8['model'],_0xcd76d8[_0x20a4('0x30')]);_0x190cc6[_0x20a4('0x32')]=_['intersection'](_0xcd76d8[_0x20a4('0x2f')],qs[_0x20a4('0x33')](_0x3c797a[_0x20a4('0x30')][_0x20a4('0x33')]));_0x190cc6[_0x20a4('0x32')]=_0x190cc6[_0x20a4('0x32')][_0x20a4('0x34')]?_0x190cc6[_0x20a4('0x32')]:_0xcd76d8[_0x20a4('0x2f')];_0x190cc6[_0x20a4('0x57')]=qs[_0x20a4('0x36')](_0x3c797a[_0x20a4('0x30')][_0x20a4('0x36')]);_0x190cc6['where']=qs[_0x20a4('0x38')](_[_0x20a4('0x39')](_0x3c797a[_0x20a4('0x30')],_0xcd76d8[_0x20a4('0x38')]));if(_0x3c797a[_0x20a4('0x30')][_0x20a4('0x3c')]){_0x190cc6[_0x20a4('0x37')]=_[_0x20a4('0x3a')](_0x190cc6['where'],{'$or':_[_0x20a4('0x2a')](_0x190cc6[_0x20a4('0x32')],function(_0x5ddf9e){var _0x4f557c={};_0x4f557c[_0x5ddf9e]={'$like':'%'+_0x3c797a['query'][_0x20a4('0x3c')]+'%'};return _0x4f557c;})});}_0x190cc6=_[_0x20a4('0x3a')]({},_0x190cc6,_0x3c797a[_0x20a4('0x4f')]);return _0x4c4282[_0x20a4('0x5f')](_0x190cc6);}})['then'](function(_0x36b6ac){if(_0x36b6ac){_0x427796=_0x36b6ac[_0x20a4('0x34')];if(!_0x3c797a[_0x20a4('0x30')][_0x20a4('0x35')]('nolimit')){_0x190cc6['limit']=qs[_0x20a4('0x1a')](_0x3c797a[_0x20a4('0x30')][_0x20a4('0x1a')]);_0x190cc6[_0x20a4('0x1c')]=qs[_0x20a4('0x1c')](_0x3c797a[_0x20a4('0x30')][_0x20a4('0x1c')]);}return _0x4c4282['getLists'](_0x190cc6);}})[_0x20a4('0x22')](function(_0x39c727){if(_0x39c727){return _0x39c727?{'count':_0x427796,'rows':_0x39c727}:null;}})[_0x20a4('0x22')](respondWithResult(_0x434d5f,null))[_0x20a4('0x44')](handleError(_0x434d5f,null));};exports['addLists']=function(_0x753aa5,_0x1c1cef,_0x22e4b3){var _0x37b5c2,_0x45517f;return db[_0x20a4('0x2b')][_0x20a4('0x43')]({'where':{'id':_0x753aa5[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x1c1cef,null))[_0x20a4('0x22')](function(_0x16e7ec){if(_0x16e7ec){_0x45517f=_0x16e7ec;return _0x16e7ec[_0x20a4('0x61')](_0x753aa5[_0x20a4('0x46')][_0x20a4('0x62')],_[_0x20a4('0x52')](_0x753aa5['body'],[_0x20a4('0x62'),'id'])||{});}return null;})[_0x20a4('0x63')](function(_0x116ba4){var _0x2194ec;_0x37b5c2=_0x116ba4||[];var _0x85399b=[];if(_0x116ba4){for(var _0x520479=0x0;_0x520479<_0x116ba4[_0x20a4('0x34')];_0x520479+=0x1){var _0xf5d9bb=_0x116ba4[_0x520479][_0x20a4('0x24')]({'plain':!![]});_0x45517f[_0x20a4('0x64')]=_0x753aa5[_0x20a4('0x46')][_0x20a4('0x64')]?_0x753aa5[_0x20a4('0x46')][_0x20a4('0x64')]:_0x45517f[_0x20a4('0x64')];switch(_0x45517f['dialCheckDuplicateType']){case _0x20a4('0x65'):_0x2194ec=squel[_0x20a4('0x66')]()[_0x20a4('0x67')](_0x20a4('0x68'))[_0x20a4('0x69')]([_0x20a4('0x6a'),_0x20a4('0x6b'),_0x20a4('0x6c'),'ListId',_0x20a4('0x58'),_0x20a4('0x50'),'updatedAt'],squel[_0x20a4('0x6d')]()[_0x20a4('0x6e')](_0x20a4('0x6a'),_0x20a4('0x6a'))[_0x20a4('0x6e')](_0x20a4('0x6f'),'scheduledAt')[_0x20a4('0x6e')]('id',_0x20a4('0x6c'))[_0x20a4('0x6e')](_0xf5d9bb[_0x20a4('0x70')]['toString'](),_0x20a4('0x71'))['field'](_0x753aa5[_0x20a4('0x41')]['id']['toString'](),_0x20a4('0x58'))['field'](_0x20a4('0x6f'),_0x20a4('0x50'))['field'](_0x20a4('0x6f'),_0x20a4('0x51'))[_0x20a4('0x72')](_0x20a4('0x73'))['where'](_0x20a4('0x74'))[_0x20a4('0x37')](_0x20a4('0x75'),_0xf5d9bb[_0x20a4('0x70')][_0x20a4('0x76')]())[_0x20a4('0x37')](_0x20a4('0x77'))[_0x20a4('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0x20a4('0x6d')]()[_0x20a4('0x6e')](_0x20a4('0x78'))[_0x20a4('0x72')]('cm_hopper_final')[_0x20a4('0x37')](_0x20a4('0x79'),_0x753aa5['params']['id'][_0x20a4('0x76')]()))[_0x20a4('0x37')](_0x20a4('0x7a'),squel[_0x20a4('0x6d')]()[_0x20a4('0x6e')]('COALESCE(phone,\x27\x27)')['from'](_0x20a4('0x68'))[_0x20a4('0x37')](_0x20a4('0x79'),_0x753aa5[_0x20a4('0x41')]['id'][_0x20a4('0x76')]())))[_0x20a4('0x76')]();break;case _0x20a4('0x7b'):_0x2194ec=squel[_0x20a4('0x66')]()[_0x20a4('0x67')](_0x20a4('0x68'))['fromQuery']([_0x20a4('0x6a'),_0x20a4('0x6b'),_0x20a4('0x6c'),_0x20a4('0x71'),_0x20a4('0x58'),_0x20a4('0x50'),_0x20a4('0x51')],squel[_0x20a4('0x6d')]()[_0x20a4('0x6e')](_0x20a4('0x6a'),_0x20a4('0x6a'))[_0x20a4('0x6e')](_0x20a4('0x6f'),_0x20a4('0x6b'))[_0x20a4('0x6e')]('id',_0x20a4('0x6c'))['field'](_0xf5d9bb[_0x20a4('0x70')][_0x20a4('0x76')](),_0x20a4('0x71'))['field'](_0x753aa5[_0x20a4('0x41')]['id'][_0x20a4('0x76')](),'CampaignId')['field'](_0x20a4('0x6f'),_0x20a4('0x50'))[_0x20a4('0x6e')]('NOW()',_0x20a4('0x51'))['from']('cm_contacts')[_0x20a4('0x37')](_0x20a4('0x74'))[_0x20a4('0x37')](_0x20a4('0x75'),_0xf5d9bb[_0x20a4('0x70')]['toString']())['where'](_0x20a4('0x77'))[_0x20a4('0x37')](_0x20a4('0x7a'),squel[_0x20a4('0x6d')]()[_0x20a4('0x6e')]('COALESCE(phone,\x27\x27)')[_0x20a4('0x72')](_0x20a4('0x68'))[_0x20a4('0x37')](_0x20a4('0x79'),_0x753aa5[_0x20a4('0x41')]['id'][_0x20a4('0x76')]())))['toString']();break;default:_0x2194ec=squel[_0x20a4('0x66')]()[_0x20a4('0x67')]('cm_hopper')[_0x20a4('0x69')]([_0x20a4('0x6a'),_0x20a4('0x6b'),_0x20a4('0x6c'),'ListId',_0x20a4('0x58'),_0x20a4('0x50'),_0x20a4('0x51')],squel[_0x20a4('0x6d')]()[_0x20a4('0x6e')]('phone',_0x20a4('0x6a'))[_0x20a4('0x6e')](_0x20a4('0x6f'),'scheduledAt')[_0x20a4('0x6e')]('id',_0x20a4('0x6c'))[_0x20a4('0x6e')](_0xf5d9bb['CmListId'][_0x20a4('0x76')](),'ListId')[_0x20a4('0x6e')](_0x753aa5['params']['id']['toString'](),_0x20a4('0x58'))[_0x20a4('0x6e')](_0x20a4('0x6f'),'createdAt')[_0x20a4('0x6e')](_0x20a4('0x6f'),_0x20a4('0x51'))['from'](_0x20a4('0x73'))['where'](_0x20a4('0x74'))[_0x20a4('0x37')]('ListId\x20=\x20?',_0xf5d9bb[_0x20a4('0x70')][_0x20a4('0x76')]())['where'](_0x20a4('0x77')))[_0x20a4('0x76')]();}_0x85399b[_0x20a4('0x7c')](db['sequelize'][_0x20a4('0x30')](_0x2194ec));}return BPromise[_0x20a4('0x7d')](_0x85399b);}})[_0x20a4('0x22')](function(){return _0x37b5c2;})[_0x20a4('0x22')](respondWithResult(_0x1c1cef,null))[_0x20a4('0x44')](handleError(_0x1c1cef,null));};exports['removeLists']=function(_0x4a462a,_0x30bdcf,_0x42e32f){return db[_0x20a4('0x2b')][_0x20a4('0x43')]({'where':{'id':_0x4a462a[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x30bdcf,null))[_0x20a4('0x22')](function(_0x1e08af){if(_0x1e08af){return _0x1e08af[_0x20a4('0x7e')](_0x4a462a['query']['ids']);}})['then'](function(_0x27a696){if(_0x27a696){return db[_0x20a4('0x59')][_0x20a4('0x23')]({'where':{'ListId':_0x4a462a[_0x20a4('0x30')]['ids'],'CampaignId':_0x4a462a['params']['id']}})['then'](function(){return _0x27a696;});}})['then'](respondWithStatusCode(_0x30bdcf,null))[_0x20a4('0x44')](handleError(_0x30bdcf,null));};exports[_0x20a4('0x7f')]=function(_0x2a223f,_0x4c7df8,_0xf2b407){var _0x33b708={};var _0x21f63f={};var _0x36b84e;var _0x1f1f6d;return db[_0x20a4('0x2b')][_0x20a4('0x55')]({'where':{'id':_0x2a223f[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x4c7df8,null))[_0x20a4('0x22')](function(_0x2a2199){if(_0x2a2199){_0x36b84e=_0x2a2199;_0x21f63f[_0x20a4('0x2f')]=_['keys'](db['CmList']['rawAttributes']);_0x21f63f[_0x20a4('0x30')]=_[_0x20a4('0x42')](_0x2a223f['query']);_0x21f63f[_0x20a4('0x38')]=_[_0x20a4('0x31')](_0x21f63f[_0x20a4('0x2f')],_0x21f63f[_0x20a4('0x30')]);_0x33b708['attributes']=_[_0x20a4('0x31')](_0x21f63f['model'],qs['fields'](_0x2a223f[_0x20a4('0x30')][_0x20a4('0x33')]));_0x33b708[_0x20a4('0x32')]=_0x33b708['attributes'][_0x20a4('0x34')]?_0x33b708[_0x20a4('0x32')]:_0x21f63f[_0x20a4('0x2f')];_0x33b708[_0x20a4('0x57')]=qs[_0x20a4('0x36')](_0x2a223f[_0x20a4('0x30')][_0x20a4('0x36')]);_0x33b708['where']=qs[_0x20a4('0x38')](_[_0x20a4('0x39')](_0x2a223f['query'],_0x21f63f[_0x20a4('0x38')]));if(_0x2a223f[_0x20a4('0x30')][_0x20a4('0x3c')]){_0x33b708[_0x20a4('0x37')]=_[_0x20a4('0x3a')](_0x33b708['where'],{'$or':_[_0x20a4('0x2a')](_0x33b708[_0x20a4('0x32')],function(_0xea4fd3){var _0x44f521={};_0x44f521[_0xea4fd3]={'$like':'%'+_0x2a223f[_0x20a4('0x30')][_0x20a4('0x3c')]+'%'};return _0x44f521;})});}_0x33b708=_[_0x20a4('0x3a')]({},_0x33b708,_0x2a223f[_0x20a4('0x4f')]);return _0x36b84e[_0x20a4('0x7f')](_0x33b708);}})[_0x20a4('0x22')](function(_0x107abf){if(_0x107abf){_0x1f1f6d=_0x107abf[_0x20a4('0x34')];if(!_0x2a223f['query'][_0x20a4('0x35')](_0x20a4('0x56'))){_0x33b708[_0x20a4('0x1a')]=qs[_0x20a4('0x1a')](_0x2a223f[_0x20a4('0x30')][_0x20a4('0x1a')]);_0x33b708[_0x20a4('0x1c')]=qs[_0x20a4('0x1c')](_0x2a223f[_0x20a4('0x30')][_0x20a4('0x1c')]);}return _0x36b84e[_0x20a4('0x7f')](_0x33b708);}})[_0x20a4('0x22')](function(_0x5b2c02){if(_0x5b2c02){return _0x5b2c02?{'count':_0x1f1f6d,'rows':_0x5b2c02}:null;}})[_0x20a4('0x22')](respondWithResult(_0x4c7df8,null))[_0x20a4('0x44')](handleError(_0x4c7df8,null));};exports[_0x20a4('0x80')]=function(_0x5b5faf,_0x296da3,_0xac41a5){var _0x721ad5,_0x5a4d0e;return db[_0x20a4('0x2b')][_0x20a4('0x43')]({'where':{'id':_0x5b5faf[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x296da3,null))[_0x20a4('0x22')](function(_0x1674e1){if(_0x1674e1){_0x5a4d0e=_0x1674e1;return _0x1674e1[_0x20a4('0x80')](_0x5b5faf[_0x20a4('0x46')][_0x20a4('0x62')],_[_0x20a4('0x52')](_0x5b5faf[_0x20a4('0x46')],[_0x20a4('0x62'),'id'])||{});}return null;})[_0x20a4('0x63')](function(_0x2e356b){var _0x5a9242;_0x721ad5=_0x2e356b||[];var _0x549252=[];if(_0x2e356b){for(var _0x298186=0x0;_0x298186<_0x2e356b['length'];_0x298186+=0x1){var _0x4838a5=_0x2e356b[_0x298186][_0x20a4('0x24')]({'plain':!![]});_0x5a9242=squel[_0x20a4('0x66')]()[_0x20a4('0x67')](_0x20a4('0x81'))[_0x20a4('0x69')]([_0x20a4('0x6a'),_0x20a4('0x6c'),_0x20a4('0x71'),_0x20a4('0x58'),_0x20a4('0x50'),'updatedAt'],squel[_0x20a4('0x6d')]()['field']('phone','phone')[_0x20a4('0x6e')]('id',_0x20a4('0x6c'))[_0x20a4('0x6e')](_0x4838a5[_0x20a4('0x70')][_0x20a4('0x76')](),_0x20a4('0x71'))[_0x20a4('0x6e')](_0x5b5faf[_0x20a4('0x41')]['id']['toString'](),'CampaignId')[_0x20a4('0x6e')](_0x20a4('0x6f'),_0x20a4('0x50'))['field'](_0x20a4('0x6f'),'updatedAt')[_0x20a4('0x72')]('cm_contacts')['where'](_0x20a4('0x74'))[_0x20a4('0x37')](_0x20a4('0x75'),_0x4838a5[_0x20a4('0x70')][_0x20a4('0x76')]())[_0x20a4('0x37')](_0x20a4('0x77')))[_0x20a4('0x76')]();_0x549252[_0x20a4('0x7c')](db[_0x20a4('0x82')][_0x20a4('0x30')](_0x5a9242));}return BPromise[_0x20a4('0x7d')](_0x549252);}})['then'](function(){return _0x721ad5;})[_0x20a4('0x22')](respondWithResult(_0x296da3,null))[_0x20a4('0x44')](handleError(_0x296da3,null));};exports['removeBlackLists']=function(_0x14b74c,_0x13c727,_0x2eefd8){return db['Campaign'][_0x20a4('0x43')]({'where':{'id':_0x14b74c[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](handleEntityNotFound(_0x13c727,null))[_0x20a4('0x22')](function(_0x496589){if(_0x496589){return _0x496589['removeBlackLists'](_0x14b74c[_0x20a4('0x30')][_0x20a4('0x62')]);}})[_0x20a4('0x22')](function(_0xe7e847){if(_0xe7e847){return db[_0x20a4('0x5e')][_0x20a4('0x23')]({'where':{'ListId':_0x14b74c[_0x20a4('0x30')][_0x20a4('0x62')],'CampaignId':_0x14b74c[_0x20a4('0x41')]['id']}})[_0x20a4('0x22')](function(){return _0xe7e847;});}})[_0x20a4('0x22')](respondWithStatusCode(_0x13c727,null))[_0x20a4('0x44')](handleError(_0x13c727,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d66cc1e..b684cee 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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 1b405ff..6ebdfa7 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 _0x9099=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','Campaign','options','where','attributes','limit','map','include','model','then','lodash'];(function(_0x257e00,_0x2fb3df){var _0x5f4f91=function(_0x3c6fab){while(--_0x3c6fab){_0x257e00['push'](_0x257e00['shift']());}};_0x5f4f91(++_0x2fb3df);}(_0x9099,0x1ac));var _0x9909=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x9099[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x9909('0x0'));var util=require('util');var moment=require(_0x9909('0x1'));var BPromise=require(_0x9909('0x2'));var rs=require(_0x9909('0x3'));var fs=require('fs');var Redis=require(_0x9909('0x4'));var db=require(_0x9909('0x5'))['db'];var utils=require(_0x9909('0x6'));var logger=require(_0x9909('0x7'))(_0x9909('0x8'));var config=require(_0x9909('0x9'));var jayson=require(_0x9909('0xa'));var client=jayson[_0x9909('0xb')][_0x9909('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b7391,_0x3dc2dd,_0x54011f){return new BPromise(function(_0x6d755a,_0x5dcd39){return client['request'](_0x3b7391,_0x54011f)['then'](function(_0x5023b7){logger[_0x9909('0xd')]('Campaign,\x20%s,\x20%s',_0x3dc2dd,_0x9909('0xe'));logger[_0x9909('0xf')](_0x9909('0x10'),_0x3dc2dd,'request\x20sent',JSON[_0x9909('0x11')](_0x5023b7));if(_0x5023b7['error']){if(_0x5023b7[_0x9909('0x12')][_0x9909('0x13')]===0x1f4){logger[_0x9909('0x12')](_0x9909('0x14'),_0x3dc2dd,_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);return _0x5dcd39(_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);}logger[_0x9909('0x12')](_0x9909('0x14'),_0x3dc2dd,_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);return _0x6d755a(_0x5023b7[_0x9909('0x12')]['message']);}else{logger[_0x9909('0xd')]('Campaign,\x20%s,\x20%s',_0x3dc2dd,_0x9909('0xe'));_0x6d755a(_0x5023b7['result'][_0x9909('0x15')]);}})[_0x9909('0x16')](function(_0x245f0d){logger['error'](_0x9909('0x14'),_0x3dc2dd,_0x245f0d);_0x5dcd39(_0x245f0d);});});}exports[_0x9909('0x17')]=function(_0x180929){var _0x2e6c16=this;return new Promise(function(_0x1106e5,_0x3a38ac){return db[_0x9909('0x18')]['findAll']({'raw':_0x180929[_0x9909('0x19')]?_0x180929[_0x9909('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x180929[_0x9909('0x19')]?_0x180929[_0x9909('0x19')][_0x9909('0x1a')]||null:null,'attributes':_0x180929[_0x9909('0x19')]?_0x180929[_0x9909('0x19')][_0x9909('0x1b')]||null:null,'limit':_0x180929[_0x9909('0x19')]?_0x180929['options'][_0x9909('0x1c')]||null:null,'include':_0x180929[_0x9909('0x19')]?_0x180929['options']['include']?_[_0x9909('0x1d')](_0x180929[_0x9909('0x19')][_0x9909('0x1e')],function(_0x19e66b){return{'model':db[_0x19e66b[_0x9909('0x1f')]],'as':_0x19e66b['as'],'attributes':_0x19e66b['attributes'],'include':_0x19e66b['include']?_[_0x9909('0x1d')](_0x19e66b[_0x9909('0x1e')],function(_0x614308){return{'model':db[_0x614308[_0x9909('0x1f')]],'as':_0x614308['as'],'attributes':_0x614308['attributes'],'include':_0x614308[_0x9909('0x1e')]?_[_0x9909('0x1d')](_0x614308[_0x9909('0x1e')],function(_0x4578a3){return{'model':db[_0x4578a3['model']],'as':_0x4578a3['as'],'attributes':_0x4578a3[_0x9909('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9909('0x20')](function(_0x19c7e8){logger[_0x9909('0xd')]('GetCampaign',_0x180929);logger[_0x9909('0xf')](_0x9909('0x17'),_0x180929,JSON[_0x9909('0x11')](_0x19c7e8));_0x1106e5(_0x19c7e8);})[_0x9909('0x16')](function(_0x26267b){logger[_0x9909('0x12')](_0x9909('0x17'),_0x26267b['message'],_0x180929);_0x3a38ac(_0x2e6c16[_0x9909('0x12')](0x1f4,_0x26267b[_0x9909('0x15')]));});});}; \ No newline at end of file +var _0x24a6=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetCampaign','findAll','options','where','limit','include','map','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x12c849,_0x1f4e64){var _0x5c2143=function(_0x3faef6){while(--_0x3faef6){_0x12c849['push'](_0x12c849['shift']());}};_0x5c2143(++_0x1f4e64);}(_0x24a6,0x14f));var _0x624a=function(_0x16db75,_0x260583){_0x16db75=_0x16db75-0x0;var _0x1775b8=_0x24a6[_0x16db75];return _0x1775b8;};'use strict';var _=require(_0x624a('0x0'));var util=require('util');var moment=require(_0x624a('0x1'));var BPromise=require(_0x624a('0x2'));var rs=require(_0x624a('0x3'));var fs=require('fs');var Redis=require(_0x624a('0x4'));var db=require(_0x624a('0x5'))['db'];var utils=require(_0x624a('0x6'));var logger=require(_0x624a('0x7'))(_0x624a('0x8'));var config=require(_0x624a('0x9'));var jayson=require(_0x624a('0xa'));var client=jayson[_0x624a('0xb')][_0x624a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1af370,_0x3b0720,_0x58243){return new BPromise(function(_0x40cb85,_0x159187){return client[_0x624a('0xd')](_0x1af370,_0x58243)[_0x624a('0xe')](function(_0x159240){logger[_0x624a('0xf')](_0x624a('0x10'),_0x3b0720,_0x624a('0x11'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x3b0720,_0x624a('0x11'),JSON[_0x624a('0x12')](_0x159240));if(_0x159240[_0x624a('0x13')]){if(_0x159240['error'][_0x624a('0x14')]===0x1f4){logger[_0x624a('0x13')]('Campaign,\x20%s,\x20%s',_0x3b0720,_0x159240['error']['message']);return _0x159187(_0x159240[_0x624a('0x13')]['message']);}logger[_0x624a('0x13')](_0x624a('0x10'),_0x3b0720,_0x159240[_0x624a('0x13')][_0x624a('0x15')]);return _0x40cb85(_0x159240['error'][_0x624a('0x15')]);}else{logger['info'](_0x624a('0x10'),_0x3b0720,_0x624a('0x11'));_0x40cb85(_0x159240['result'][_0x624a('0x15')]);}})[_0x624a('0x16')](function(_0x3b6414){logger[_0x624a('0x13')](_0x624a('0x10'),_0x3b0720,_0x3b6414);_0x159187(_0x3b6414);});});}exports[_0x624a('0x17')]=function(_0x364867){var _0x32d6a0=this;return new Promise(function(_0x35342c,_0x4721ac){return db['Campaign'][_0x624a('0x18')]({'raw':_0x364867['options']?_0x364867[_0x624a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x364867[_0x624a('0x19')]?_0x364867[_0x624a('0x19')][_0x624a('0x1a')]||null:null,'attributes':_0x364867[_0x624a('0x19')]?_0x364867[_0x624a('0x19')]['attributes']||null:null,'limit':_0x364867[_0x624a('0x19')]?_0x364867[_0x624a('0x19')][_0x624a('0x1b')]||null:null,'include':_0x364867[_0x624a('0x19')]?_0x364867['options'][_0x624a('0x1c')]?_[_0x624a('0x1d')](_0x364867[_0x624a('0x19')]['include'],function(_0x4aee03){return{'model':db[_0x4aee03['model']],'as':_0x4aee03['as'],'attributes':_0x4aee03[_0x624a('0x1e')],'include':_0x4aee03[_0x624a('0x1c')]?_[_0x624a('0x1d')](_0x4aee03[_0x624a('0x1c')],function(_0x51a817){return{'model':db[_0x51a817['model']],'as':_0x51a817['as'],'attributes':_0x51a817[_0x624a('0x1e')],'include':_0x51a817[_0x624a('0x1c')]?_['map'](_0x51a817[_0x624a('0x1c')],function(_0x19b8a6){return{'model':db[_0x19b8a6['model']],'as':_0x19b8a6['as'],'attributes':_0x19b8a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41993c){logger[_0x624a('0xf')]('GetCampaign',_0x364867);logger['debug']('GetCampaign',_0x364867,JSON[_0x624a('0x12')](_0x41993c));_0x35342c(_0x41993c);})[_0x624a('0x16')](function(_0x4dab19){logger['error'](_0x624a('0x17'),_0x4dab19[_0x624a('0x15')],_0x364867);_0x4721ac(_0x32d6a0['error'](0x1f4,_0x4dab19[_0x624a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 108582f..15e5a8f 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 _0xe2f2=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','post','create','/:id/lists','put','delete','destroy','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0xe2f2,0x6c));var _0x2e2f=function(_0x571c54,_0x26ad26){_0x571c54=_0x571c54-0x0;var _0x24751b=_0xe2f2[_0x571c54];return _0x24751b;};'use strict';var multer=require(_0x2e2f('0x0'));var util=require(_0x2e2f('0x1'));var path=require(_0x2e2f('0x2'));var timeout=require(_0x2e2f('0x3'));var express=require(_0x2e2f('0x4'));var router=express[_0x2e2f('0x5')]();var fs_extra=require(_0x2e2f('0x6'));var auth=require(_0x2e2f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2e2f('0x8'));router[_0x2e2f('0x9')]('/',auth[_0x2e2f('0xa')](),controller[_0x2e2f('0xb')]);router[_0x2e2f('0x9')](_0x2e2f('0xc'),auth[_0x2e2f('0xa')](),controller['show']);router[_0x2e2f('0x9')](_0x2e2f('0xd'),auth['isAuthenticated'](),controller[_0x2e2f('0xe')]);router['get'](_0x2e2f('0xf'),auth[_0x2e2f('0xa')](),controller[_0x2e2f('0x10')]);router['get'](_0x2e2f('0x11'),auth['isAuthenticated'](),controller[_0x2e2f('0x12')]);router[_0x2e2f('0x9')](_0x2e2f('0x13'),auth[_0x2e2f('0xa')](),controller[_0x2e2f('0x14')]);router[_0x2e2f('0x9')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x2e2f('0x9')](_0x2e2f('0x15'),auth[_0x2e2f('0xa')](),controller[_0x2e2f('0x16')]);router[_0x2e2f('0x17')]('/',auth[_0x2e2f('0xa')](),controller[_0x2e2f('0x18')]);router[_0x2e2f('0x17')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router['post'](_0x2e2f('0x19'),auth[_0x2e2f('0xa')](),controller['addLists']);router[_0x2e2f('0x17')]('/:id/blacklists',auth[_0x2e2f('0xa')](),controller['addBlackLists']);router[_0x2e2f('0x1a')](_0x2e2f('0xc'),auth[_0x2e2f('0xa')](),controller['update']);router[_0x2e2f('0x1b')](_0x2e2f('0xc'),auth[_0x2e2f('0xa')](),controller[_0x2e2f('0x1c')]);router['delete']('/:id/lists',auth['isAuthenticated'](),controller[_0x2e2f('0x1d')]);router[_0x2e2f('0x1b')](_0x2e2f('0x15'),auth[_0x2e2f('0xa')](),controller[_0x2e2f('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x12ee=['/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','/:id/lists','/:id','update','destroy','delete','removeLists','removeBlackLists','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals'];(function(_0x1a0b89,_0x4eaf8d){var _0x864ec7=function(_0x5136d8){while(--_0x5136d8){_0x1a0b89['push'](_0x1a0b89['shift']());}};_0x864ec7(++_0x4eaf8d);}(_0x12ee,0x1a3));var _0xe12e=function(_0x1e0584,_0xf49257){_0x1e0584=_0x1e0584-0x0;var _0x2472fa=_0x12ee[_0x1e0584];return _0x2472fa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe12e('0x0'));var timeout=require(_0xe12e('0x1'));var express=require('express');var router=express[_0xe12e('0x2')]();var fs_extra=require(_0xe12e('0x3'));var auth=require(_0xe12e('0x4'));var interaction=require(_0xe12e('0x5'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xe12e('0x6')]('/',auth[_0xe12e('0x7')](),controller[_0xe12e('0x8')]);router[_0xe12e('0x6')]('/:id',auth[_0xe12e('0x7')](),controller[_0xe12e('0x9')]);router[_0xe12e('0x6')](_0xe12e('0xa'),auth[_0xe12e('0x7')](),controller[_0xe12e('0xb')]);router['get'](_0xe12e('0xc'),auth[_0xe12e('0x7')](),controller[_0xe12e('0xd')]);router[_0xe12e('0x6')]('/:id/hopper_finals',auth[_0xe12e('0x7')](),controller[_0xe12e('0xe')]);router[_0xe12e('0x6')](_0xe12e('0xf'),auth[_0xe12e('0x7')](),controller[_0xe12e('0x10')]);router[_0xe12e('0x6')]('/:id/lists',auth[_0xe12e('0x7')](),controller[_0xe12e('0x11')]);router[_0xe12e('0x6')](_0xe12e('0x12'),auth['isAuthenticated'](),controller[_0xe12e('0x13')]);router[_0xe12e('0x14')]('/',auth['isAuthenticated'](),controller[_0xe12e('0x15')]);router['post'](_0xe12e('0x16'),auth[_0xe12e('0x7')](),controller['clone']);router['post'](_0xe12e('0x17'),auth[_0xe12e('0x7')](),controller['addLists']);router[_0xe12e('0x14')](_0xe12e('0x12'),auth[_0xe12e('0x7')](),controller['addBlackLists']);router['put'](_0xe12e('0x18'),auth[_0xe12e('0x7')](),controller[_0xe12e('0x19')]);router['delete'](_0xe12e('0x18'),auth[_0xe12e('0x7')](),controller[_0xe12e('0x1a')]);router[_0xe12e('0x1b')](_0xe12e('0x17'),auth['isAuthenticated'](),controller[_0xe12e('0x1c')]);router[_0xe12e('0x1b')](_0xe12e('0x12'),auth[_0xe12e('0x7')](),controller[_0xe12e('0x1d')]);module[_0xe12e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 5c4a322..1934d77 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 _0x38c6=['TEXT','key','sequelize','exports','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x38c6,0x174));var _0x638c=function(_0x139e6a,_0x443ab7){_0x139e6a=_0x139e6a-0x0;var _0x19c2ba=_0x38c6[_0x139e6a];return _0x19c2ba;};'use strict';var Sequelize=require(_0x638c('0x0'));module[_0x638c('0x1')]={'key':{'type':Sequelize[_0x638c('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x638c('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x638c('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x638c('0x4'));}}}; \ No newline at end of file +var _0xfd09=['exports','TEXT','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x3f9fb7,_0x503086){var _0x52f1db=function(_0x24357d){while(--_0x24357d){_0x3f9fb7['push'](_0x3f9fb7['shift']());}};_0x52f1db(++_0x503086);}(_0xfd09,0x13a));var _0x9fd0=function(_0x300860,_0x509371){_0x300860=_0x300860-0x0;var _0x2094ad=_0xfd09[_0x300860];return _0x2094ad;};'use strict';var Sequelize=require(_0x9fd0('0x0'));module[_0x9fd0('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x9fd0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9fd0('0x3')]},'name':{'type':Sequelize[_0x9fd0('0x4')],'get':function(){return this[_0x9fd0('0x5')](_0x9fd0('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index b6abea3..419c2e2 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 _0x73d0=['fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CannedAnswer','includeAll','include','findAll','rows','catch','show','params','merge','find','body','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes'];(function(_0x2a6763,_0x3d230c){var _0x4c4ea1=function(_0x580227){while(--_0x580227){_0x2a6763['push'](_0x2a6763['shift']());}};_0x4c4ea1(++_0x3d230c);}(_0x73d0,0x1eb));var _0x073d=function(_0x31dfe3,_0x54e1f7){_0x31dfe3=_0x31dfe3-0x0;var _0x3d4b34=_0x73d0[_0x31dfe3];return _0x3d4b34;};'use strict';var emlformat=require(_0x073d('0x0'));var rimraf=require(_0x073d('0x1'));var zipdir=require(_0x073d('0x2'));var jsonpatch=require(_0x073d('0x3'));var rp=require(_0x073d('0x4'));var moment=require(_0x073d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x073d('0x6'));var util=require(_0x073d('0x7'));var path=require(_0x073d('0x8'));var sox=require(_0x073d('0x9'));var csv=require(_0x073d('0xa'));var ejs=require(_0x073d('0xb'));var fs=require('fs');var fs_extra=require(_0x073d('0xc'));var _=require('lodash');var squel=require(_0x073d('0xd'));var crypto=require(_0x073d('0xe'));var jsforce=require(_0x073d('0xf'));var deskjs=require(_0x073d('0x10'));var toCsv=require(_0x073d('0xa'));var querystring=require(_0x073d('0x11'));var Papa=require('papaparse');var Redis=require(_0x073d('0x12'));var authService=require(_0x073d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x073d('0x14'));var hardwareService=require(_0x073d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x073d('0x16'));var config=require(_0x073d('0x17'));var licenseUtil=require(_0x073d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b5e05,_0x243927){_0x243927=_0x243927||0xcc;return function(_0x5170ab){if(_0x5170ab){return _0x5b5e05[_0x073d('0x19')](_0x243927);}return _0x5b5e05[_0x073d('0x1a')](_0x243927)['end']();};}function respondWithResult(_0x216241,_0x3d5cbd){_0x3d5cbd=_0x3d5cbd||0xc8;return function(_0xd8381a){if(_0xd8381a){return _0x216241[_0x073d('0x1a')](_0x3d5cbd)[_0x073d('0x1b')](_0xd8381a);}};}function respondWithFilteredResult(_0x56c6b5,_0xb700cc){return function(_0x287038){if(_0x287038){var _0xc6c7d6=typeof _0xb700cc[_0x073d('0x1c')]===_0x073d('0x1d')&&typeof _0xb700cc[_0x073d('0x1e')]==='undefined';var _0x51ef14=_0x287038[_0x073d('0x1f')];var _0x5da1f5=_0xc6c7d6?0x0:_0xb700cc[_0x073d('0x1c')];var _0x3e5355=_0xc6c7d6?_0x287038[_0x073d('0x1f')]:_0xb700cc['offset']+_0xb700cc[_0x073d('0x1e')];var _0x9d78ad;if(_0x3e5355>=_0x51ef14){_0x3e5355=_0x51ef14;_0x9d78ad=0xc8;}else{_0x9d78ad=0xce;}_0x56c6b5[_0x073d('0x1a')](_0x9d78ad);return _0x56c6b5['set'](_0x073d('0x20'),_0x5da1f5+'-'+_0x3e5355+'/'+_0x51ef14)[_0x073d('0x1b')](_0x287038);}return null;};}function patchUpdates(_0x2b60e7){return function(_0x515ca3){try{jsonpatch[_0x073d('0x21')](_0x515ca3,_0x2b60e7,!![]);}catch(_0xd3196a){return BPromise[_0x073d('0x22')](_0xd3196a);}return _0x515ca3['save']();};}function saveUpdates(_0x222dcd,_0x2f6d3c){return function(_0x5dc0f7){if(_0x5dc0f7){return _0x5dc0f7[_0x073d('0x23')](_0x222dcd)[_0x073d('0x24')](function(_0x3017f1){return _0x3017f1;});}return null;};}function removeEntity(_0x1491b8,_0x12fc18){return function(_0x4c23a5){if(_0x4c23a5){return _0x4c23a5[_0x073d('0x25')]()['then'](function(){var _0x42cad4=_0x4c23a5[_0x073d('0x26')]({'plain':!![]});var _0x2bd7f0=_0x073d('0x27');return db[_0x073d('0x28')][_0x073d('0x25')]({'where':{'type':_0x2bd7f0,'resourceId':_0x42cad4['id']}})[_0x073d('0x24')](function(){return _0x4c23a5;});})[_0x073d('0x24')](function(){_0x1491b8[_0x073d('0x1a')](0xcc)[_0x073d('0x29')]();});}};}function handleEntityNotFound(_0x43421a,_0x236bb9){return function(_0x392385){if(!_0x392385){_0x43421a[_0x073d('0x19')](0x194);}return _0x392385;};}function handleError(_0xb917ea,_0x1a4d66){_0x1a4d66=_0x1a4d66||0x1f4;return function(_0x2ea851){logger[_0x073d('0x2a')](_0x2ea851[_0x073d('0x2b')]);if(_0x2ea851[_0x073d('0x2c')]){delete _0x2ea851[_0x073d('0x2c')];}_0xb917ea[_0x073d('0x1a')](_0x1a4d66)[_0x073d('0x2d')](_0x2ea851);};}exports[_0x073d('0x2e')]=function(_0x39c876,_0x39ab1a){var _0x52ee6b={},_0x2ad703={},_0x3a3efe={'count':0x0,'rows':[]};var _0x3410f1=_[_0x073d('0x2f')](db['CannedAnswer'][_0x073d('0x30')],function(_0x2eeebf){return{'name':_0x2eeebf[_0x073d('0x31')],'type':_0x2eeebf['type']['key']};});_0x2ad703[_0x073d('0x32')]=_[_0x073d('0x2f')](_0x3410f1,_0x073d('0x2c'));_0x2ad703[_0x073d('0x33')]=_[_0x073d('0x34')](_0x39c876[_0x073d('0x33')]);_0x2ad703[_0x073d('0x35')]=_[_0x073d('0x36')](_0x2ad703[_0x073d('0x32')],_0x2ad703['query']);_0x52ee6b[_0x073d('0x37')]=_[_0x073d('0x36')](_0x2ad703['model'],qs[_0x073d('0x38')](_0x39c876[_0x073d('0x33')]['fields']));_0x52ee6b[_0x073d('0x37')]=_0x52ee6b['attributes'][_0x073d('0x39')]?_0x52ee6b[_0x073d('0x37')]:_0x2ad703[_0x073d('0x32')];if(!_0x39c876[_0x073d('0x33')][_0x073d('0x3a')](_0x073d('0x3b'))){_0x52ee6b['limit']=qs[_0x073d('0x1e')](_0x39c876['query'][_0x073d('0x1e')]);_0x52ee6b[_0x073d('0x1c')]=qs[_0x073d('0x1c')](_0x39c876[_0x073d('0x33')][_0x073d('0x1c')]);}_0x52ee6b[_0x073d('0x3c')]=qs['sort'](_0x39c876[_0x073d('0x33')][_0x073d('0x3d')]);_0x52ee6b[_0x073d('0x3e')]=qs[_0x073d('0x35')](_[_0x073d('0x3f')](_0x39c876[_0x073d('0x33')],_0x2ad703[_0x073d('0x35')]),_0x3410f1);if(_0x39c876['query'][_0x073d('0x40')]){_0x52ee6b[_0x073d('0x3e')]=_['merge'](_0x52ee6b[_0x073d('0x3e')],{'$or':[{'key':{'$like':'%'+_0x39c876['query'][_0x073d('0x40')]+'%'}},{'value':{'$like':'%'+_0x39c876[_0x073d('0x33')][_0x073d('0x40')]+'%'}}]});}_0x52ee6b=_['merge']({},_0x52ee6b,_0x39c876[_0x073d('0x41')]);var _0x41b349={'where':_0x52ee6b[_0x073d('0x3e')]};return db[_0x073d('0x42')][_0x073d('0x1f')](_0x41b349)['then'](function(_0xb45e5a){_0x3a3efe[_0x073d('0x1f')]=_0xb45e5a;if(_0x39c876[_0x073d('0x33')][_0x073d('0x43')]){_0x52ee6b[_0x073d('0x44')]=[{'all':!![]}];}return db[_0x073d('0x42')][_0x073d('0x45')](_0x52ee6b);})[_0x073d('0x24')](function(_0x4361c1){_0x3a3efe[_0x073d('0x46')]=_0x4361c1;return _0x3a3efe;})[_0x073d('0x24')](respondWithFilteredResult(_0x39ab1a,_0x52ee6b))[_0x073d('0x47')](handleError(_0x39ab1a,null));};exports[_0x073d('0x48')]=function(_0x1f76f1,_0x5eced8){var _0x26edec={'raw':!![],'where':{'id':_0x1f76f1[_0x073d('0x49')]['id']}},_0x593a7d={};_0x593a7d[_0x073d('0x32')]=_[_0x073d('0x34')](db['CannedAnswer'][_0x073d('0x30')]);_0x593a7d[_0x073d('0x33')]=_[_0x073d('0x34')](_0x1f76f1[_0x073d('0x33')]);_0x593a7d[_0x073d('0x35')]=_[_0x073d('0x36')](_0x593a7d[_0x073d('0x32')],_0x593a7d[_0x073d('0x33')]);_0x26edec[_0x073d('0x37')]=_[_0x073d('0x36')](_0x593a7d[_0x073d('0x32')],qs[_0x073d('0x38')](_0x1f76f1[_0x073d('0x33')][_0x073d('0x38')]));_0x26edec[_0x073d('0x37')]=_0x26edec['attributes']['length']?_0x26edec[_0x073d('0x37')]:_0x593a7d['model'];if(_0x1f76f1[_0x073d('0x33')][_0x073d('0x43')]){_0x26edec[_0x073d('0x44')]=[{'all':!![]}];}_0x26edec=_[_0x073d('0x4a')]({},_0x26edec,_0x1f76f1['options']);return db[_0x073d('0x42')][_0x073d('0x4b')](_0x26edec)[_0x073d('0x24')](handleEntityNotFound(_0x5eced8,null))['then'](respondWithResult(_0x5eced8,null))[_0x073d('0x47')](handleError(_0x5eced8,null));};exports[_0x073d('0x23')]=function(_0x446747,_0x57595c){if(_0x446747[_0x073d('0x4c')]['id']){delete _0x446747[_0x073d('0x4c')]['id'];}return db['CannedAnswer'][_0x073d('0x4b')]({'where':{'id':_0x446747['params']['id']}})['then'](handleEntityNotFound(_0x57595c,null))[_0x073d('0x24')](saveUpdates(_0x446747[_0x073d('0x4c')],null))['then'](respondWithResult(_0x57595c,null))[_0x073d('0x47')](handleError(_0x57595c,null));};exports['destroy']=function(_0x1b2002,_0x3e9f87){return db[_0x073d('0x42')][_0x073d('0x4b')]({'where':{'id':_0x1b2002['params']['id']}})[_0x073d('0x24')](handleEntityNotFound(_0x3e9f87,null))['then'](removeEntity(_0x3e9f87,null))['catch'](handleError(_0x3e9f87,null));};exports['create']=function(_0x1de968,_0x57d3f4){var _0x377b20={'key':_0x1de968[_0x073d('0x4c')][_0x073d('0x4d')]};if(_0x1de968[_0x073d('0x4c')][_0x073d('0x4e')]){_0x377b20['MailAccountId']=_0x1de968[_0x073d('0x4c')][_0x073d('0x4e')];}else if(_0x1de968['body']['SmsAccountId']){_0x377b20[_0x073d('0x4f')]=_0x1de968[_0x073d('0x4c')][_0x073d('0x4f')];}else if(_0x1de968[_0x073d('0x4c')][_0x073d('0x50')]){_0x377b20[_0x073d('0x50')]=_0x1de968['body'][_0x073d('0x50')];}else if(_0x1de968[_0x073d('0x4c')][_0x073d('0x51')]){_0x377b20[_0x073d('0x51')]=_0x1de968[_0x073d('0x4c')][_0x073d('0x51')];}return db[_0x073d('0x42')][_0x073d('0x4b')]({'where':_0x377b20})[_0x073d('0x24')](function(_0x4dd818){if(_0x4dd818){throw new db[(_0x073d('0x52'))]['ValidationError'](_0x073d('0x53'));}return db[_0x073d('0x42')][_0x073d('0x54')](_0x1de968[_0x073d('0x4c')]);})[_0x073d('0x24')](function(_0x41ec0b){var _0x257596=_0x1de968[_0x073d('0x55')][_0x073d('0x26')]({'plain':!![]});if(!_0x257596)throw new Error(_0x073d('0x56'));if(_0x257596[_0x073d('0x57')]===_0x073d('0x55')){var _0x1819db=_0x41ec0b[_0x073d('0x26')]({'plain':!![]});return db[_0x073d('0x58')]['find']({'where':{'name':_0x073d('0x27'),'userProfileId':_0x257596[_0x073d('0x59')]},'raw':!![]})[_0x073d('0x24')](function(_0x56e420){if(_0x56e420&&_0x56e420['autoAssociation']===0x0){return db[_0x073d('0x28')][_0x073d('0x54')]({'name':_0x1819db[_0x073d('0x2c')],'resourceId':_0x1819db['id'],'type':_0x56e420[_0x073d('0x2c')],'sectionId':_0x56e420['id']},{})[_0x073d('0x24')](function(){return _0x41ec0b;});}else{return _0x41ec0b;}})[_0x073d('0x47')](function(_0x52a2f6){logger[_0x073d('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52a2f6);throw _0x52a2f6;});}return _0x41ec0b;})[_0x073d('0x24')](respondWithResult(_0x57d3f4,0xc9))['catch'](handleError(_0x57d3f4,null));}; \ No newline at end of file +var _0x4dea=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filter','merge','CannedAnswer','includeAll','include','findAll','catch','options','body','find','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x1a8adc,_0x2e3c88){var _0x53f272=function(_0x16dce9){while(--_0x16dce9){_0x1a8adc['push'](_0x1a8adc['shift']());}};_0x53f272(++_0x2e3c88);}(_0x4dea,0xe1));var _0xa4de=function(_0x4907d4,_0xac34f2){_0x4907d4=_0x4907d4-0x0;var _0x5d62b7=_0x4dea[_0x4907d4];return _0x5d62b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4de('0x0'));var zipdir=require(_0xa4de('0x1'));var jsonpatch=require(_0xa4de('0x2'));var rp=require(_0xa4de('0x3'));var moment=require(_0xa4de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa4de('0x5'));var util=require(_0xa4de('0x6'));var path=require(_0xa4de('0x7'));var sox=require(_0xa4de('0x8'));var csv=require(_0xa4de('0x9'));var ejs=require(_0xa4de('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa4de('0xb'));var deskjs=require(_0xa4de('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa4de('0xd'));var Papa=require(_0xa4de('0xe'));var Redis=require(_0xa4de('0xf'));var authService=require(_0xa4de('0x10'));var qs=require(_0xa4de('0x11'));var as=require(_0xa4de('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4de('0x13'))('api');var utils=require(_0xa4de('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa4de('0x15'));var db=require(_0xa4de('0x16'))['db'];function respondWithStatusCode(_0x2ad0a2,_0x186b76){_0x186b76=_0x186b76||0xcc;return function(_0x3c6def){if(_0x3c6def){return _0x2ad0a2[_0xa4de('0x17')](_0x186b76);}return _0x2ad0a2[_0xa4de('0x18')](_0x186b76)[_0xa4de('0x19')]();};}function respondWithResult(_0x3828eb,_0x4d41fa){_0x4d41fa=_0x4d41fa||0xc8;return function(_0x1ababe){if(_0x1ababe){return _0x3828eb[_0xa4de('0x18')](_0x4d41fa)['json'](_0x1ababe);}};}function respondWithFilteredResult(_0x564d63,_0xb36759){return function(_0x4cdb8b){if(_0x4cdb8b){var _0x256aa2=typeof _0xb36759[_0xa4de('0x1a')]===_0xa4de('0x1b')&&typeof _0xb36759[_0xa4de('0x1c')]===_0xa4de('0x1b');var _0x33a9b3=_0x4cdb8b[_0xa4de('0x1d')];var _0x15e385=_0x256aa2?0x0:_0xb36759[_0xa4de('0x1a')];var _0x1a887a=_0x256aa2?_0x4cdb8b[_0xa4de('0x1d')]:_0xb36759[_0xa4de('0x1a')]+_0xb36759[_0xa4de('0x1c')];var _0x2cd6f1;if(_0x1a887a>=_0x33a9b3){_0x1a887a=_0x33a9b3;_0x2cd6f1=0xc8;}else{_0x2cd6f1=0xce;}_0x564d63[_0xa4de('0x18')](_0x2cd6f1);return _0x564d63[_0xa4de('0x1e')](_0xa4de('0x1f'),_0x15e385+'-'+_0x1a887a+'/'+_0x33a9b3)[_0xa4de('0x20')](_0x4cdb8b);}return null;};}function patchUpdates(_0x3bf05c){return function(_0x4b5c75){try{jsonpatch[_0xa4de('0x21')](_0x4b5c75,_0x3bf05c,!![]);}catch(_0x103887){return BPromise[_0xa4de('0x22')](_0x103887);}return _0x4b5c75[_0xa4de('0x23')]();};}function saveUpdates(_0x9d8129,_0x5c0bc9){return function(_0x2aae5e){if(_0x2aae5e){return _0x2aae5e[_0xa4de('0x24')](_0x9d8129)[_0xa4de('0x25')](function(_0x2a308e){return _0x2a308e;});}return null;};}function removeEntity(_0x53ac3d,_0xd73509){return function(_0x147f51){if(_0x147f51){return _0x147f51[_0xa4de('0x26')]()[_0xa4de('0x25')](function(){var _0xb1f316=_0x147f51[_0xa4de('0x27')]({'plain':!![]});var _0x26837d='CannedAnswers';return db[_0xa4de('0x28')][_0xa4de('0x26')]({'where':{'type':_0x26837d,'resourceId':_0xb1f316['id']}})['then'](function(){return _0x147f51;});})[_0xa4de('0x25')](function(){_0x53ac3d[_0xa4de('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d524e,_0x162ada){return function(_0x2ef14d){if(!_0x2ef14d){_0x4d524e[_0xa4de('0x17')](0x194);}return _0x2ef14d;};}function handleError(_0x1cf694,_0x2e0493){_0x2e0493=_0x2e0493||0x1f4;return function(_0x3fe651){logger[_0xa4de('0x29')](_0x3fe651['stack']);if(_0x3fe651[_0xa4de('0x2a')]){delete _0x3fe651['name'];}_0x1cf694['status'](_0x2e0493)[_0xa4de('0x2b')](_0x3fe651);};}exports[_0xa4de('0x2c')]=function(_0x46a219,_0x130863){var _0x5eac93={},_0x3fee14={},_0x177241={'count':0x0,'rows':[]};var _0x244f9f=_[_0xa4de('0x2d')](db['CannedAnswer'][_0xa4de('0x2e')],function(_0xe1e4b7){return{'name':_0xe1e4b7[_0xa4de('0x2f')],'type':_0xe1e4b7['type'][_0xa4de('0x30')]};});_0x3fee14[_0xa4de('0x31')]=_[_0xa4de('0x2d')](_0x244f9f,'name');_0x3fee14['query']=_[_0xa4de('0x32')](_0x46a219[_0xa4de('0x33')]);_0x3fee14[_0xa4de('0x34')]=_[_0xa4de('0x35')](_0x3fee14[_0xa4de('0x31')],_0x3fee14[_0xa4de('0x33')]);_0x5eac93['attributes']=_['intersection'](_0x3fee14[_0xa4de('0x31')],qs[_0xa4de('0x36')](_0x46a219[_0xa4de('0x33')]['fields']));_0x5eac93['attributes']=_0x5eac93['attributes']['length']?_0x5eac93[_0xa4de('0x37')]:_0x3fee14['model'];if(!_0x46a219[_0xa4de('0x33')][_0xa4de('0x38')](_0xa4de('0x39'))){_0x5eac93[_0xa4de('0x1c')]=qs[_0xa4de('0x1c')](_0x46a219[_0xa4de('0x33')][_0xa4de('0x1c')]);_0x5eac93['offset']=qs[_0xa4de('0x1a')](_0x46a219[_0xa4de('0x33')][_0xa4de('0x1a')]);}_0x5eac93[_0xa4de('0x3a')]=qs['sort'](_0x46a219[_0xa4de('0x33')]['sort']);_0x5eac93[_0xa4de('0x3b')]=qs[_0xa4de('0x34')](_['pick'](_0x46a219['query'],_0x3fee14[_0xa4de('0x34')]),_0x244f9f);if(_0x46a219[_0xa4de('0x33')][_0xa4de('0x3c')]){_0x5eac93[_0xa4de('0x3b')]=_[_0xa4de('0x3d')](_0x5eac93[_0xa4de('0x3b')],{'$or':[{'key':{'$like':'%'+_0x46a219[_0xa4de('0x33')][_0xa4de('0x3c')]+'%'}},{'value':{'$like':'%'+_0x46a219['query'][_0xa4de('0x3c')]+'%'}}]});}_0x5eac93=_[_0xa4de('0x3d')]({},_0x5eac93,_0x46a219['options']);var _0x58db28={'where':_0x5eac93[_0xa4de('0x3b')]};return db[_0xa4de('0x3e')][_0xa4de('0x1d')](_0x58db28)[_0xa4de('0x25')](function(_0x479397){_0x177241[_0xa4de('0x1d')]=_0x479397;if(_0x46a219[_0xa4de('0x33')][_0xa4de('0x3f')]){_0x5eac93[_0xa4de('0x40')]=[{'all':!![]}];}return db[_0xa4de('0x3e')][_0xa4de('0x41')](_0x5eac93);})[_0xa4de('0x25')](function(_0x5947da){_0x177241['rows']=_0x5947da;return _0x177241;})[_0xa4de('0x25')](respondWithFilteredResult(_0x130863,_0x5eac93))[_0xa4de('0x42')](handleError(_0x130863,null));};exports['show']=function(_0x2b9e3e,_0x5b6b73){var _0x4ee282={'raw':!![],'where':{'id':_0x2b9e3e['params']['id']}},_0x34564c={};_0x34564c['model']=_[_0xa4de('0x32')](db[_0xa4de('0x3e')][_0xa4de('0x2e')]);_0x34564c[_0xa4de('0x33')]=_[_0xa4de('0x32')](_0x2b9e3e[_0xa4de('0x33')]);_0x34564c[_0xa4de('0x34')]=_[_0xa4de('0x35')](_0x34564c[_0xa4de('0x31')],_0x34564c['query']);_0x4ee282[_0xa4de('0x37')]=_['intersection'](_0x34564c[_0xa4de('0x31')],qs[_0xa4de('0x36')](_0x2b9e3e[_0xa4de('0x33')][_0xa4de('0x36')]));_0x4ee282['attributes']=_0x4ee282[_0xa4de('0x37')]['length']?_0x4ee282['attributes']:_0x34564c[_0xa4de('0x31')];if(_0x2b9e3e[_0xa4de('0x33')][_0xa4de('0x3f')]){_0x4ee282[_0xa4de('0x40')]=[{'all':!![]}];}_0x4ee282=_[_0xa4de('0x3d')]({},_0x4ee282,_0x2b9e3e[_0xa4de('0x43')]);return db[_0xa4de('0x3e')]['find'](_0x4ee282)[_0xa4de('0x25')](handleEntityNotFound(_0x5b6b73,null))[_0xa4de('0x25')](respondWithResult(_0x5b6b73,null))[_0xa4de('0x42')](handleError(_0x5b6b73,null));};exports[_0xa4de('0x24')]=function(_0x376ac0,_0x4a1d24){if(_0x376ac0[_0xa4de('0x44')]['id']){delete _0x376ac0[_0xa4de('0x44')]['id'];}return db[_0xa4de('0x3e')][_0xa4de('0x45')]({'where':{'id':_0x376ac0[_0xa4de('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a1d24,null))[_0xa4de('0x25')](saveUpdates(_0x376ac0[_0xa4de('0x44')],null))[_0xa4de('0x25')](respondWithResult(_0x4a1d24,null))[_0xa4de('0x42')](handleError(_0x4a1d24,null));};exports[_0xa4de('0x26')]=function(_0xf10fb4,_0x5971a1){return db[_0xa4de('0x3e')]['find']({'where':{'id':_0xf10fb4[_0xa4de('0x46')]['id']}})[_0xa4de('0x25')](handleEntityNotFound(_0x5971a1,null))[_0xa4de('0x25')](removeEntity(_0x5971a1,null))[_0xa4de('0x42')](handleError(_0x5971a1,null));};exports['create']=function(_0x692053,_0x5a3ae2){var _0x333b19={'key':_0x692053[_0xa4de('0x44')][_0xa4de('0x30')]};if(_0x692053[_0xa4de('0x44')]['MailAccountId']){_0x333b19['MailAccountId']=_0x692053['body'][_0xa4de('0x47')];}else if(_0x692053[_0xa4de('0x44')][_0xa4de('0x48')]){_0x333b19[_0xa4de('0x48')]=_0x692053[_0xa4de('0x44')][_0xa4de('0x48')];}else if(_0x692053[_0xa4de('0x44')][_0xa4de('0x49')]){_0x333b19[_0xa4de('0x49')]=_0x692053[_0xa4de('0x44')][_0xa4de('0x49')];}else if(_0x692053[_0xa4de('0x44')][_0xa4de('0x4a')]){_0x333b19['ChatWebsiteId']=_0x692053[_0xa4de('0x44')][_0xa4de('0x4a')];}return db[_0xa4de('0x3e')][_0xa4de('0x45')]({'where':_0x333b19})['then'](function(_0x28c580){if(_0x28c580){throw new db[(_0xa4de('0x4b'))]['ValidationError'](_0xa4de('0x4c'));}return db[_0xa4de('0x3e')]['create'](_0x692053[_0xa4de('0x44')]);})[_0xa4de('0x25')](function(_0x3a74eb){var _0x2aeab2=_0x692053['user'][_0xa4de('0x27')]({'plain':!![]});if(!_0x2aeab2)throw new Error(_0xa4de('0x4d'));if(_0x2aeab2[_0xa4de('0x4e')]==='user'){var _0x428676=_0x3a74eb[_0xa4de('0x27')]({'plain':!![]});return db[_0xa4de('0x4f')][_0xa4de('0x45')]({'where':{'name':_0xa4de('0x50'),'userProfileId':_0x2aeab2['userProfileId']},'raw':!![]})['then'](function(_0x50980c){if(_0x50980c&&_0x50980c[_0xa4de('0x51')]===0x0){return db[_0xa4de('0x28')][_0xa4de('0x52')]({'name':_0x428676['name'],'resourceId':_0x428676['id'],'type':_0x50980c[_0xa4de('0x2a')],'sectionId':_0x50980c['id']},{})[_0xa4de('0x25')](function(){return _0x3a74eb;});}else{return _0x3a74eb;}})[_0xa4de('0x42')](function(_0x111904){logger[_0xa4de('0x29')](_0xa4de('0x53'),_0x111904);throw _0x111904;});}return _0x3a74eb;})[_0xa4de('0x25')](respondWithResult(_0x5a3ae2,0xc9))[_0xa4de('0x42')](handleError(_0x5a3ae2,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index fa44694..ab9841d 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 _0xcc13=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer'];(function(_0x3baac1,_0x5391e7){var _0x3c4f9e=function(_0x2fc0d3){while(--_0x2fc0d3){_0x3baac1['push'](_0x3baac1['shift']());}};_0x3c4f9e(++_0x5391e7);}(_0xcc13,0x15e));var _0x3cc1=function(_0x2278c2,_0xa2ee08){_0x2278c2=_0x2278c2-0x0;var _0x196843=_0xcc13[_0x2278c2];return _0x196843;};'use strict';var _=require(_0x3cc1('0x0'));var util=require(_0x3cc1('0x1'));var logger=require(_0x3cc1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3cc1('0x3'));var rp=require(_0x3cc1('0x4'));var fs=require('fs');var path=require(_0x3cc1('0x5'));var rimraf=require('rimraf');var config=require(_0x3cc1('0x6'));var attributes=require(_0x3cc1('0x7'));module[_0x3cc1('0x8')]=function(_0x2867f1,_0xe33bcb){return _0x2867f1['define'](_0x3cc1('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3cc1('0xa'),'collate':_0x3cc1('0xb')});}; \ No newline at end of file +var _0x2ab7=['api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger'];(function(_0x10dc94,_0x2fed4f){var _0x4a462d=function(_0x5181bd){while(--_0x5181bd){_0x10dc94['push'](_0x10dc94['shift']());}};_0x4a462d(++_0x2fed4f);}(_0x2ab7,0xe7));var _0x72ab=function(_0x1008b7,_0x53512e){_0x1008b7=_0x1008b7-0x0;var _0x537757=_0x2ab7[_0x1008b7];return _0x537757;};'use strict';var _=require(_0x72ab('0x0'));var util=require(_0x72ab('0x1'));var logger=require(_0x72ab('0x2'))(_0x72ab('0x3'));var moment=require(_0x72ab('0x4'));var BPromise=require(_0x72ab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72ab('0x6'));var rimraf=require(_0x72ab('0x7'));var config=require(_0x72ab('0x8'));var attributes=require(_0x72ab('0x9'));module['exports']=function(_0x58797,_0x48d5e8){return _0x58797['define'](_0x72ab('0xa'),attributes,{'tableName':_0x72ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72ab('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 308dada..ea93302 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(_0x185140,_0x5b596c){var _0x34c3b7=function(_0x3b7843){while(--_0x3b7843){_0x185140['push'](_0x185140['shift']());}};_0x34c3b7(++_0x5b596c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x10ab72,_0xa3f201){var _0xbe8a06=function(_0x293b47){while(--_0x293b47){_0x10ab72['push'](_0x10ab72['shift']());}};_0xbe8a06(++_0xa3f201);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 9c3035a..8d97aec 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 _0xf59c=['../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2a68fb,_0x55b193){var _0xdee18b=function(_0x189ece){while(--_0x189ece){_0x2a68fb['push'](_0x2a68fb['shift']());}};_0xdee18b(++_0x55b193);}(_0xf59c,0x8a));var _0xcf59=function(_0x3f85ce,_0x6b5402){_0x3f85ce=_0x3f85ce-0x0;var _0x14e553=_0xf59c[_0x3f85ce];return _0x14e553;};'use strict';var multer=require('multer');var util=require(_0xcf59('0x0'));var path=require(_0xcf59('0x1'));var timeout=require(_0xcf59('0x2'));var express=require(_0xcf59('0x3'));var router=express[_0xcf59('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcf59('0x5'));var interaction=require(_0xcf59('0x6'));var config=require('../../config/environment');var controller=require(_0xcf59('0x7'));router[_0xcf59('0x8')]('/',auth[_0xcf59('0x9')](),controller[_0xcf59('0xa')]);router[_0xcf59('0x8')](_0xcf59('0xb'),auth[_0xcf59('0x9')](),controller[_0xcf59('0xc')]);router['post']('/',auth[_0xcf59('0x9')](),controller['create']);router[_0xcf59('0xd')](_0xcf59('0xb'),auth[_0xcf59('0x9')](),controller[_0xcf59('0xe')]);router[_0xcf59('0xf')](_0xcf59('0xb'),auth[_0xcf59('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x02dc=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','post','put','update','destroy','exports','multer','util'];(function(_0xf15be4,_0x2c2591){var _0x2b6849=function(_0x544282){while(--_0x544282){_0xf15be4['push'](_0xf15be4['shift']());}};_0x2b6849(++_0x2c2591);}(_0x02dc,0x1c6));var _0xc02d=function(_0xf5c830,_0x2f134f){_0xf5c830=_0xf5c830-0x0;var _0x467687=_0x02dc[_0xf5c830];return _0x467687;};'use strict';var multer=require(_0xc02d('0x0'));var util=require(_0xc02d('0x1'));var path=require(_0xc02d('0x2'));var timeout=require(_0xc02d('0x3'));var express=require(_0xc02d('0x4'));var router=express[_0xc02d('0x5')]();var fs_extra=require(_0xc02d('0x6'));var auth=require(_0xc02d('0x7'));var interaction=require(_0xc02d('0x8'));var config=require(_0xc02d('0x9'));var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc02d('0xa')]);router[_0xc02d('0xb')](_0xc02d('0xc'),auth[_0xc02d('0xd')](),controller['show']);router[_0xc02d('0xe')]('/',auth[_0xc02d('0xd')](),controller['create']);router[_0xc02d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc02d('0x10')]);router['delete']('/:id',auth[_0xc02d('0xd')](),controller[_0xc02d('0x11')]);module[_0xc02d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index fcae2e8..02d9ab7 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 _0x7d5a=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x507dcd,_0x1ee2d9){var _0x96947a=function(_0x337703){while(--_0x337703){_0x507dcd['push'](_0x507dcd['shift']());}};_0x96947a(++_0x1ee2d9);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x2dfaa6,_0x42d5ab){_0x2dfaa6=_0x2dfaa6-0x0;var _0x246b8b=_0x7d5a[_0x2dfaa6];return _0x246b8b;};'use strict';var Sequelize=require(_0xa7d5('0x0'));module[_0xa7d5('0x1')]={'calldate':{'type':Sequelize[_0xa7d5('0x2')],'allowNull':![],'defaultValue':_0xa7d5('0x3')},'clid':{'type':Sequelize[_0xa7d5('0x4')]},'src':{'type':Sequelize[_0xa7d5('0x4')]},'dst':{'type':Sequelize[_0xa7d5('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xa7d5('0x4')]},'lastapp':{'type':Sequelize[_0xa7d5('0x4')]},'lastdata':{'type':Sequelize[_0xa7d5('0x4')]},'duration':{'type':Sequelize[_0xa7d5('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa7d5('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa7d5('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xa7d5('0x4')]},'userfield':{'type':Sequelize[_0xa7d5('0x4')]},'uniqueid':{'type':Sequelize[_0xa7d5('0x4')]},'linkedid':{'type':Sequelize[_0xa7d5('0x4')]},'sequence':{'type':Sequelize[_0xa7d5('0x4')]},'peeraccount':{'type':Sequelize[_0xa7d5('0x4')]},'type':{'type':Sequelize[_0xa7d5('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1020=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x1020,0x1a4));var _0x0102=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x1020[_0x562f3b];return _0x1edd55;};'use strict';var Sequelize=require(_0x0102('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x0102('0x1')],'allowNull':![],'defaultValue':_0x0102('0x2')},'clid':{'type':Sequelize[_0x0102('0x3')]},'src':{'type':Sequelize[_0x0102('0x3')]},'dst':{'type':Sequelize[_0x0102('0x3')]},'dcontext':{'type':Sequelize[_0x0102('0x3')]},'channel':{'type':Sequelize[_0x0102('0x3')]},'dstchannel':{'type':Sequelize[_0x0102('0x3')]},'lastapp':{'type':Sequelize[_0x0102('0x3')]},'lastdata':{'type':Sequelize[_0x0102('0x3')]},'duration':{'type':Sequelize[_0x0102('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0102('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0102('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0102('0x3')]},'userfield':{'type':Sequelize[_0x0102('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x0102('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x0102('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b8e494b..6065966 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 _0x6f47=['undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Cdr','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','describe','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset'];(function(_0x1e9699,_0x57615e){var _0x33cf48=function(_0x1fe59f){while(--_0x1fe59f){_0x1e9699['push'](_0x1e9699['shift']());}};_0x33cf48(++_0x57615e);}(_0x6f47,0xc7));var _0x76f4=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x6f47[_0x42bc91];return _0x3f5507;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['map'](_0x1dea0e,'name');_0x30f02e[_0x76f4('0x2e')]=_[_0x76f4('0x2f')](_0x5346be[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2e')]);_0x10ddb4[_0x76f4('0x32')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5346be[_0x76f4('0x2e')]['fields']));_0x10ddb4['attributes']=_0x10ddb4['attributes']['length']?_0x10ddb4[_0x76f4('0x32')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2e')][_0x76f4('0x34')](_0x76f4('0x35'))){_0x10ddb4['limit']=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x30')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2e')],_0x30f02e[_0x76f4('0x30')]),_0x1dea0e);if(_0x5346be[_0x76f4('0x2e')][_0x76f4('0x3a')]){_0x10ddb4['where']=_[_0x76f4('0x3b')](_0x10ddb4[_0x76f4('0x38')],{'$or':_[_0x76f4('0x3c')](_0x1dea0e,function(_0x589637){if(_0x589637['type']!==_0x76f4('0x3d')){var _0x487926={};_0x487926[_0x589637[_0x76f4('0x27')]]={'$like':'%'+_0x5346be['query'][_0x76f4('0x3a')]+'%'};return _0x487926;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3e')]);var _0x378675={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x378675)[_0x76f4('0x23')](function(_0x16779e){_0x41dea4[_0x76f4('0x1c')]=_0x16779e;if(_0x5346be['query']['includeAll']){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x2b7dc8){_0x41dea4[_0x76f4('0x41')]=_0x2b7dc8;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))[_0x76f4('0x42')](handleError(_0x5b3f07,null));};exports[_0x76f4('0x43')]=function(_0x5b667b,_0xbc3d7e){var _0xe744af={'raw':!![],'where':{'id':_0x5b667b['params']['id']}},_0x4f0d1a={};_0x4f0d1a[_0x76f4('0x2d')]=_[_0x76f4('0x2f')](db[_0x76f4('0x29')][_0x76f4('0x44')]);_0x4f0d1a[_0x76f4('0x2e')]=_['keys'](_0x5b667b[_0x76f4('0x2e')]);_0x4f0d1a[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x4f0d1a[_0x76f4('0x2d')],_0x4f0d1a[_0x76f4('0x2e')]);_0xe744af[_0x76f4('0x32')]=_['intersection'](_0x4f0d1a[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5b667b[_0x76f4('0x2e')]['fields']));_0xe744af['attributes']=_0xe744af[_0x76f4('0x32')][_0x76f4('0x45')]?_0xe744af[_0x76f4('0x32')]:_0x4f0d1a[_0x76f4('0x2d')];if(_0x5b667b[_0x76f4('0x2e')]['includeAll']){_0xe744af['include']=[{'all':!![]}];}_0xe744af=_[_0x76f4('0x3b')]({},_0xe744af,_0x5b667b['options']);return db[_0x76f4('0x29')][_0x76f4('0x46')](_0xe744af)['then'](handleEntityNotFound(_0xbc3d7e,null))['then'](respondWithResult(_0xbc3d7e,null))[_0x76f4('0x42')](handleError(_0xbc3d7e,null));};exports[_0x76f4('0x47')]=function(_0x3f35ce,_0x217d3a){return db['Cdr'][_0x76f4('0x47')](_0x3f35ce[_0x76f4('0x48')],{})[_0x76f4('0x23')](respondWithResult(_0x217d3a,0xc9))['catch'](handleError(_0x217d3a,null));};exports[_0x76f4('0x22')]=function(_0x6bbcf2,_0x535eca){if(_0x6bbcf2['body']['id']){delete _0x6bbcf2[_0x76f4('0x48')]['id'];}return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x6bbcf2[_0x76f4('0x49')]['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x535eca,null))['then'](saveUpdates(_0x6bbcf2[_0x76f4('0x48')],null))['then'](respondWithResult(_0x535eca,null))[_0x76f4('0x42')](handleError(_0x535eca,null));};exports[_0x76f4('0x24')]=function(_0x270baf,_0x5e9a45){return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x270baf['params']['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x5e9a45,null))[_0x76f4('0x23')](removeEntity(_0x5e9a45,null))[_0x76f4('0x42')](handleError(_0x5e9a45,null));};exports[_0x76f4('0x4a')]=function(_0x40ff20,_0x479c4b){return db[_0x76f4('0x29')]['describe']()[_0x76f4('0x23')](respondWithResult(_0x479c4b,null))[_0x76f4('0x42')](handleError(_0x479c4b,null));}; \ No newline at end of file +var _0x7d9f=['util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','Cdr','rawAttributes','model','keys','attributes','intersection','fields','query','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x3fbeb7,_0x316335){_0x3fbeb7=_0x3fbeb7-0x0;var _0x4dcb89=_0x7d9f[_0x3fbeb7];return _0x4dcb89;};'use strict';var emlformat=require(_0xf7d9('0x0'));var rimraf=require(_0xf7d9('0x1'));var zipdir=require(_0xf7d9('0x2'));var jsonpatch=require(_0xf7d9('0x3'));var rp=require(_0xf7d9('0x4'));var moment=require('moment');var BPromise=require(_0xf7d9('0x5'));var Mustache=require(_0xf7d9('0x6'));var util=require(_0xf7d9('0x7'));var path=require(_0xf7d9('0x8'));var sox=require(_0xf7d9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7d9('0xa'));var _=require(_0xf7d9('0xb'));var squel=require('squel');var crypto=require(_0xf7d9('0xc'));var jsforce=require(_0xf7d9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf7d9('0xe'));var querystring=require('querystring');var Papa=require(_0xf7d9('0xf'));var Redis=require(_0xf7d9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf7d9('0x11'));var hardwareService=require(_0xf7d9('0x12'));var logger=require(_0xf7d9('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf7d9('0x14'));var licenseUtil=require(_0xf7d9('0x15'));var db=require(_0xf7d9('0x16'))['db'];function respondWithStatusCode(_0x35e156,_0x594dfe){_0x594dfe=_0x594dfe||0xcc;return function(_0x16e680){if(_0x16e680){return _0x35e156[_0xf7d9('0x17')](_0x594dfe);}return _0x35e156[_0xf7d9('0x18')](_0x594dfe)[_0xf7d9('0x19')]();};}function respondWithResult(_0x49f766,_0x189c82){_0x189c82=_0x189c82||0xc8;return function(_0x359843){if(_0x359843){return _0x49f766[_0xf7d9('0x18')](_0x189c82)[_0xf7d9('0x1a')](_0x359843);}};}function respondWithFilteredResult(_0x5d3029,_0x405ed4){return function(_0x22ed4a){if(_0x22ed4a){var _0x341e27=typeof _0x405ed4['offset']==='undefined'&&typeof _0x405ed4[_0xf7d9('0x1b')]===_0xf7d9('0x1c');var _0xe29103=_0x22ed4a['count'];var _0x44ebd3=_0x341e27?0x0:_0x405ed4[_0xf7d9('0x1d')];var _0x5eb7c9=_0x341e27?_0x22ed4a[_0xf7d9('0x1e')]:_0x405ed4['offset']+_0x405ed4[_0xf7d9('0x1b')];var _0x1bbc77;if(_0x5eb7c9>=_0xe29103){_0x5eb7c9=_0xe29103;_0x1bbc77=0xc8;}else{_0x1bbc77=0xce;}_0x5d3029['status'](_0x1bbc77);return _0x5d3029[_0xf7d9('0x1f')](_0xf7d9('0x20'),_0x44ebd3+'-'+_0x5eb7c9+'/'+_0xe29103)[_0xf7d9('0x1a')](_0x22ed4a);}return null;};}function patchUpdates(_0x316d54){return function(_0x165160){try{jsonpatch[_0xf7d9('0x21')](_0x165160,_0x316d54,!![]);}catch(_0xd04b9d){return BPromise[_0xf7d9('0x22')](_0xd04b9d);}return _0x165160['save']();};}function saveUpdates(_0x5e96df,_0x36b974){return function(_0x4cfe93){if(_0x4cfe93){return _0x4cfe93[_0xf7d9('0x23')](_0x5e96df)[_0xf7d9('0x24')](function(_0x574b12){return _0x574b12;});}return null;};}function removeEntity(_0x8d8e48,_0x27ba8c){return function(_0x514ffa){if(_0x514ffa){return _0x514ffa['destroy']()[_0xf7d9('0x24')](function(){_0x8d8e48[_0xf7d9('0x18')](0xcc)[_0xf7d9('0x19')]();});}};}function handleEntityNotFound(_0x595556,_0x3c0b91){return function(_0x496ab7){if(!_0x496ab7){_0x595556[_0xf7d9('0x17')](0x194);}return _0x496ab7;};}function handleError(_0x3b3ea5,_0x144ae2){_0x144ae2=_0x144ae2||0x1f4;return function(_0x5b1ea5){logger[_0xf7d9('0x25')](_0x5b1ea5[_0xf7d9('0x26')]);if(_0x5b1ea5[_0xf7d9('0x27')]){delete _0x5b1ea5[_0xf7d9('0x27')];}_0x3b3ea5[_0xf7d9('0x18')](_0x144ae2)['send'](_0x5b1ea5);};}exports[_0xf7d9('0x28')]=function(_0x3847ff,_0x2b5f17){var _0x2c04c3={},_0x508b00={},_0x20315e={'count':0x0,'rows':[]};var _0x193add=_[_0xf7d9('0x29')](db[_0xf7d9('0x2a')][_0xf7d9('0x2b')],function(_0x16318f){return{'name':_0x16318f['fieldName'],'type':_0x16318f['type']['key']};});_0x508b00[_0xf7d9('0x2c')]=_['map'](_0x193add,_0xf7d9('0x27'));_0x508b00['query']=_[_0xf7d9('0x2d')](_0x3847ff['query']);_0x508b00['filters']=_['intersection'](_0x508b00[_0xf7d9('0x2c')],_0x508b00['query']);_0x2c04c3[_0xf7d9('0x2e')]=_[_0xf7d9('0x2f')](_0x508b00[_0xf7d9('0x2c')],qs[_0xf7d9('0x30')](_0x3847ff[_0xf7d9('0x31')][_0xf7d9('0x30')]));_0x2c04c3[_0xf7d9('0x2e')]=_0x2c04c3[_0xf7d9('0x2e')]['length']?_0x2c04c3[_0xf7d9('0x2e')]:_0x508b00[_0xf7d9('0x2c')];if(!_0x3847ff['query']['hasOwnProperty'](_0xf7d9('0x32'))){_0x2c04c3[_0xf7d9('0x1b')]=qs[_0xf7d9('0x1b')](_0x3847ff['query'][_0xf7d9('0x1b')]);_0x2c04c3[_0xf7d9('0x1d')]=qs[_0xf7d9('0x1d')](_0x3847ff[_0xf7d9('0x31')][_0xf7d9('0x1d')]);}_0x2c04c3[_0xf7d9('0x33')]=qs[_0xf7d9('0x34')](_0x3847ff[_0xf7d9('0x31')][_0xf7d9('0x34')]);_0x2c04c3[_0xf7d9('0x35')]=qs[_0xf7d9('0x36')](_['pick'](_0x3847ff[_0xf7d9('0x31')],_0x508b00['filters']),_0x193add);if(_0x3847ff[_0xf7d9('0x31')][_0xf7d9('0x37')]){_0x2c04c3[_0xf7d9('0x35')]=_[_0xf7d9('0x38')](_0x2c04c3['where'],{'$or':_['map'](_0x193add,function(_0x2173e2){if(_0x2173e2['type']!==_0xf7d9('0x39')){var _0xb3723c={};_0xb3723c[_0x2173e2[_0xf7d9('0x27')]]={'$like':'%'+_0x3847ff[_0xf7d9('0x31')]['filter']+'%'};return _0xb3723c;}})});}_0x2c04c3=_['merge']({},_0x2c04c3,_0x3847ff[_0xf7d9('0x3a')]);var _0x410c72={'where':_0x2c04c3[_0xf7d9('0x35')]};return db[_0xf7d9('0x2a')]['count'](_0x410c72)[_0xf7d9('0x24')](function(_0xd6d84f){_0x20315e[_0xf7d9('0x1e')]=_0xd6d84f;if(_0x3847ff[_0xf7d9('0x31')][_0xf7d9('0x3b')]){_0x2c04c3['include']=[{'all':!![]}];}return db[_0xf7d9('0x2a')][_0xf7d9('0x3c')](_0x2c04c3);})[_0xf7d9('0x24')](function(_0x3db665){_0x20315e[_0xf7d9('0x3d')]=_0x3db665;return _0x20315e;})[_0xf7d9('0x24')](respondWithFilteredResult(_0x2b5f17,_0x2c04c3))[_0xf7d9('0x3e')](handleError(_0x2b5f17,null));};exports[_0xf7d9('0x3f')]=function(_0x40d026,_0x3d056f){var _0x2a349b={'raw':!![],'where':{'id':_0x40d026['params']['id']}},_0x46b7d4={};_0x46b7d4[_0xf7d9('0x2c')]=_[_0xf7d9('0x2d')](db['Cdr']['rawAttributes']);_0x46b7d4['query']=_[_0xf7d9('0x2d')](_0x40d026['query']);_0x46b7d4[_0xf7d9('0x36')]=_[_0xf7d9('0x2f')](_0x46b7d4[_0xf7d9('0x2c')],_0x46b7d4[_0xf7d9('0x31')]);_0x2a349b[_0xf7d9('0x2e')]=_['intersection'](_0x46b7d4[_0xf7d9('0x2c')],qs[_0xf7d9('0x30')](_0x40d026[_0xf7d9('0x31')][_0xf7d9('0x30')]));_0x2a349b[_0xf7d9('0x2e')]=_0x2a349b['attributes']['length']?_0x2a349b[_0xf7d9('0x2e')]:_0x46b7d4[_0xf7d9('0x2c')];if(_0x40d026[_0xf7d9('0x31')][_0xf7d9('0x3b')]){_0x2a349b[_0xf7d9('0x40')]=[{'all':!![]}];}_0x2a349b=_['merge']({},_0x2a349b,_0x40d026[_0xf7d9('0x3a')]);return db['Cdr'][_0xf7d9('0x41')](_0x2a349b)[_0xf7d9('0x24')](handleEntityNotFound(_0x3d056f,null))[_0xf7d9('0x24')](respondWithResult(_0x3d056f,null))[_0xf7d9('0x3e')](handleError(_0x3d056f,null));};exports[_0xf7d9('0x42')]=function(_0x1e3a53,_0x4003e9){return db[_0xf7d9('0x2a')][_0xf7d9('0x42')](_0x1e3a53[_0xf7d9('0x43')],{})[_0xf7d9('0x24')](respondWithResult(_0x4003e9,0xc9))[_0xf7d9('0x3e')](handleError(_0x4003e9,null));};exports[_0xf7d9('0x23')]=function(_0x3cdeb5,_0x50731a){if(_0x3cdeb5[_0xf7d9('0x43')]['id']){delete _0x3cdeb5[_0xf7d9('0x43')]['id'];}return db['Cdr']['find']({'where':{'id':_0x3cdeb5[_0xf7d9('0x44')]['id']}})['then'](handleEntityNotFound(_0x50731a,null))['then'](saveUpdates(_0x3cdeb5[_0xf7d9('0x43')],null))[_0xf7d9('0x24')](respondWithResult(_0x50731a,null))[_0xf7d9('0x3e')](handleError(_0x50731a,null));};exports[_0xf7d9('0x45')]=function(_0xf923e0,_0x9c3719){return db[_0xf7d9('0x2a')][_0xf7d9('0x41')]({'where':{'id':_0xf923e0[_0xf7d9('0x44')]['id']}})[_0xf7d9('0x24')](handleEntityNotFound(_0x9c3719,null))[_0xf7d9('0x24')](removeEntity(_0x9c3719,null))[_0xf7d9('0x3e')](handleError(_0x9c3719,null));};exports['describe']=function(_0x48076b,_0x42da01){return db[_0xf7d9('0x2a')][_0xf7d9('0x46')]()[_0xf7d9('0x24')](respondWithResult(_0x42da01,null))['catch'](handleError(_0x42da01,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 29a57eb..47a94b3 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(_0x1b6965,_0x367797){var _0x33bb73=function(_0x4d1794){while(--_0x4d1794){_0x1b6965['push'](_0x1b6965['shift']());}};_0x33bb73(++_0x367797);}(_0x7a54,0x106));var _0x47a5=function(_0x805751,_0x52f49e){_0x805751=_0x805751-0x0;var _0x166a73=_0x7a54[_0x805751];return _0x166a73;};'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(_0x2d5b6f,_0x55dcb3){var _0xaf7910=function(_0xfd7707){while(--_0xfd7707){_0x2d5b6f['push'](_0x2d5b6f['shift']());}};_0xaf7910(++_0x55dcb3);}(_0x7a54,0x106));var _0x47a5=function(_0x54ad65,_0xc03f7a){_0x54ad65=_0x54ad65-0x0;var _0x44ae84=_0x7a54[_0x54ad65];return _0x44ae84;};'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 5d27814..2543247 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 _0xe630=['request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe630,0x1aa));var _0x0e63=function(_0x5dff5b,_0x600c5d){_0x5dff5b=_0x5dff5b-0x0;var _0x34dd83=_0xe630[_0x5dff5b];return _0x34dd83;};'use strict';var _=require(_0x0e63('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0e63('0x1'));var rs=require(_0x0e63('0x2'));var fs=require('fs');var Redis=require(_0x0e63('0x3'));var db=require(_0x0e63('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e63('0x5'))(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var jayson=require(_0x0e63('0x8'));var client=jayson[_0x0e63('0x9')][_0x0e63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x251f1d,_0x25b1d1,_0xbfd4a8){return new BPromise(function(_0x556768,_0x20a7ec){return client[_0x0e63('0xb')](_0x251f1d,_0xbfd4a8)[_0x0e63('0xc')](function(_0x11cceb){logger[_0x0e63('0xd')]('Cdr,\x20%s,\x20%s',_0x25b1d1,'request\x20sent');logger[_0x0e63('0xe')](_0x0e63('0xf'),_0x25b1d1,_0x0e63('0x10'),JSON['stringify'](_0x11cceb));if(_0x11cceb[_0x0e63('0x11')]){if(_0x11cceb[_0x0e63('0x11')][_0x0e63('0x12')]===0x1f4){logger[_0x0e63('0x11')](_0x0e63('0x13'),_0x25b1d1,_0x11cceb[_0x0e63('0x11')][_0x0e63('0x14')]);return _0x20a7ec(_0x11cceb['error']['message']);}logger[_0x0e63('0x11')](_0x0e63('0x13'),_0x25b1d1,_0x11cceb[_0x0e63('0x11')][_0x0e63('0x14')]);return _0x556768(_0x11cceb[_0x0e63('0x11')][_0x0e63('0x14')]);}else{logger[_0x0e63('0xd')](_0x0e63('0x13'),_0x25b1d1,_0x0e63('0x10'));_0x556768(_0x11cceb[_0x0e63('0x15')][_0x0e63('0x14')]);}})[_0x0e63('0x16')](function(_0x4ce62b){logger[_0x0e63('0x11')](_0x0e63('0x13'),_0x25b1d1,_0x4ce62b);_0x20a7ec(_0x4ce62b);});});} \ No newline at end of file +var _0x6bea=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1345fa,_0x11947a){var _0xc32585=function(_0x178016){while(--_0x178016){_0x1345fa['push'](_0x1345fa['shift']());}};_0xc32585(++_0x11947a);}(_0x6bea,0x70));var _0xa6be=function(_0x46ce04,_0xa79e72){_0x46ce04=_0x46ce04-0x0;var _0x58cfe6=_0x6bea[_0x46ce04];return _0x58cfe6;};'use strict';var _=require(_0xa6be('0x0'));var util=require(_0xa6be('0x1'));var moment=require(_0xa6be('0x2'));var BPromise=require(_0xa6be('0x3'));var rs=require(_0xa6be('0x4'));var fs=require('fs');var Redis=require(_0xa6be('0x5'));var db=require(_0xa6be('0x6'))['db'];var utils=require(_0xa6be('0x7'));var logger=require(_0xa6be('0x8'))('rpc');var config=require(_0xa6be('0x9'));var jayson=require(_0xa6be('0xa'));var client=jayson[_0xa6be('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb45933,_0x520286,_0x54ab7a){return new BPromise(function(_0x136222,_0x4f4c69){return client[_0xa6be('0xc')](_0xb45933,_0x54ab7a)[_0xa6be('0xd')](function(_0x57df6b){logger[_0xa6be('0xe')](_0xa6be('0xf'),_0x520286,'request\x20sent');logger['debug'](_0xa6be('0x10'),_0x520286,_0xa6be('0x11'),JSON[_0xa6be('0x12')](_0x57df6b));if(_0x57df6b[_0xa6be('0x13')]){if(_0x57df6b['error'][_0xa6be('0x14')]===0x1f4){logger[_0xa6be('0x13')](_0xa6be('0xf'),_0x520286,_0x57df6b[_0xa6be('0x13')][_0xa6be('0x15')]);return _0x4f4c69(_0x57df6b[_0xa6be('0x13')][_0xa6be('0x15')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x520286,_0x57df6b[_0xa6be('0x13')]['message']);return _0x136222(_0x57df6b[_0xa6be('0x13')][_0xa6be('0x15')]);}else{logger[_0xa6be('0xe')](_0xa6be('0xf'),_0x520286,_0xa6be('0x11'));_0x136222(_0x57df6b[_0xa6be('0x16')][_0xa6be('0x15')]);}})[_0xa6be('0x17')](function(_0x452954){logger[_0xa6be('0x13')]('Cdr,\x20%s,\x20%s',_0x520286,_0x452954);_0x4f4c69(_0x452954);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 86df154..19d058a 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(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2d057f,_0x437742){var _0x3f339c=function(_0x3a4a4b){while(--_0x3a4a4b){_0x2d057f['push'](_0x2d057f['shift']());}};_0x3f339c(++_0x437742);}(_0xb10b,0x12a));var _0xbb10=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xb10b[_0x4429e0];return _0x51a5b3;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index b0c07c4..40f9c5e 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 _0x2746=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x4cefee,_0xabb91e){var _0x473af2=function(_0x51e8ad){while(--_0x51e8ad){_0x4cefee['push'](_0x4cefee['shift']());}};_0x473af2(++_0xabb91e);}(_0x2746,0x75));var _0x6274=function(_0x49aa9a,_0x35d64e){_0x49aa9a=_0x49aa9a-0x0;var _0x32b365=_0x2746[_0x49aa9a];return _0x32b365;};'use strict';var Sequelize=require(_0x6274('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6274('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6274('0x2')],'allowNull':![],'defaultValue':_0x6274('0x3')},'appdata':{'type':Sequelize[_0x6274('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6274('0x2')],'defaultValue':_0x6274('0x5')}}; \ No newline at end of file +var _0xd7b1=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x1f51b0,_0x22a682){var _0x27b813=function(_0xcabeca){while(--_0xcabeca){_0x1f51b0['push'](_0x1f51b0['shift']());}};_0x27b813(++_0x22a682);}(_0xd7b1,0xc1));var _0x1d7b=function(_0x54d8c5,_0x39f451){_0x54d8c5=_0x54d8c5-0x0;var _0x4aed6d=_0xd7b1[_0x54d8c5];return _0x4aed6d;};'use strict';var Sequelize=require(_0x1d7b('0x0'));module[_0x1d7b('0x1')]={'priority':{'type':Sequelize[_0x1d7b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1d7b('0x3')],'allowNull':![],'defaultValue':_0x1d7b('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1d7b('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index fa72cad..53ade5d 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 _0xde13=['fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../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','apply','save','update','then','destroy','name','send','show','params','model','keys','query','filters','intersection','attributes','fields','length','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xde13,0x146));var _0x3de1=function(_0x54c0f3,_0xf40657){_0x54c0f3=_0x54c0f3-0x0;var _0x4390e3=_0xde13[_0x54c0f3];return _0x4390e3;};'use strict';var emlformat=require(_0x3de1('0x0'));var rimraf=require(_0x3de1('0x1'));var zipdir=require(_0x3de1('0x2'));var jsonpatch=require(_0x3de1('0x3'));var rp=require(_0x3de1('0x4'));var moment=require('moment');var BPromise=require(_0x3de1('0x5'));var Mustache=require(_0x3de1('0x6'));var util=require(_0x3de1('0x7'));var path=require('path');var sox=require(_0x3de1('0x8'));var csv=require('to-csv');var ejs=require(_0x3de1('0x9'));var fs=require('fs');var fs_extra=require(_0x3de1('0xa'));var _=require(_0x3de1('0xb'));var squel=require(_0x3de1('0xc'));var crypto=require('crypto');var jsforce=require(_0x3de1('0xd'));var deskjs=require(_0x3de1('0xe'));var toCsv=require(_0x3de1('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3de1('0x10'));var qs=require(_0x3de1('0x11'));var as=require(_0x3de1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3de1('0x13'))(_0x3de1('0x14'));var utils=require(_0x3de1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3de1('0x16'))['db'];function respondWithStatusCode(_0x4afe3b,_0x585909){_0x585909=_0x585909||0xcc;return function(_0x5794ff){if(_0x5794ff){return _0x4afe3b[_0x3de1('0x17')](_0x585909);}return _0x4afe3b[_0x3de1('0x18')](_0x585909)[_0x3de1('0x19')]();};}function respondWithResult(_0xa014a6,_0x5e4c56){_0x5e4c56=_0x5e4c56||0xc8;return function(_0x3405f9){if(_0x3405f9){return _0xa014a6['status'](_0x5e4c56)[_0x3de1('0x1a')](_0x3405f9);}};}function respondWithFilteredResult(_0x57ce0e,_0x48e218){return function(_0x14156f){if(_0x14156f){var _0x214f19=typeof _0x48e218['offset']===_0x3de1('0x1b')&&typeof _0x48e218[_0x3de1('0x1c')]===_0x3de1('0x1b');var _0x2cf3e1=_0x14156f[_0x3de1('0x1d')];var _0x510e5a=_0x214f19?0x0:_0x48e218[_0x3de1('0x1e')];var _0x5a10f2=_0x214f19?_0x14156f[_0x3de1('0x1d')]:_0x48e218[_0x3de1('0x1e')]+_0x48e218['limit'];var _0x3b5bcb;if(_0x5a10f2>=_0x2cf3e1){_0x5a10f2=_0x2cf3e1;_0x3b5bcb=0xc8;}else{_0x3b5bcb=0xce;}_0x57ce0e['status'](_0x3b5bcb);return _0x57ce0e[_0x3de1('0x1f')](_0x3de1('0x20'),_0x510e5a+'-'+_0x5a10f2+'/'+_0x2cf3e1)[_0x3de1('0x1a')](_0x14156f);}return null;};}function patchUpdates(_0x5635b5){return function(_0x2c4830){try{jsonpatch[_0x3de1('0x21')](_0x2c4830,_0x5635b5,!![]);}catch(_0x440a36){return BPromise['reject'](_0x440a36);}return _0x2c4830[_0x3de1('0x22')]();};}function saveUpdates(_0x2a4a31,_0x594bdb){return function(_0x4c0c1a){if(_0x4c0c1a){return _0x4c0c1a[_0x3de1('0x23')](_0x2a4a31)[_0x3de1('0x24')](function(_0x412c70){return _0x412c70;});}return null;};}function removeEntity(_0xcfe95c,_0x242ab0){return function(_0x4370f2){if(_0x4370f2){return _0x4370f2[_0x3de1('0x25')]()[_0x3de1('0x24')](function(){_0xcfe95c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9873fa,_0xa2120f){return function(_0x192532){if(!_0x192532){_0x9873fa[_0x3de1('0x17')](0x194);}return _0x192532;};}function handleError(_0x1fd710,_0x5c9a13){_0x5c9a13=_0x5c9a13||0x1f4;return function(_0x5985b2){logger['error'](_0x5985b2['stack']);if(_0x5985b2[_0x3de1('0x26')]){delete _0x5985b2[_0x3de1('0x26')];}_0x1fd710[_0x3de1('0x18')](_0x5c9a13)[_0x3de1('0x27')](_0x5985b2);};}exports[_0x3de1('0x28')]=function(_0x149df5,_0xa5f4a6){var _0x1d2721={'raw':!![],'where':{'id':_0x149df5[_0x3de1('0x29')]['id']}},_0x898786={};_0x898786[_0x3de1('0x2a')]=_[_0x3de1('0x2b')](db['ChatApplication']['rawAttributes']);_0x898786[_0x3de1('0x2c')]=_['keys'](_0x149df5[_0x3de1('0x2c')]);_0x898786[_0x3de1('0x2d')]=_[_0x3de1('0x2e')](_0x898786['model'],_0x898786[_0x3de1('0x2c')]);_0x1d2721[_0x3de1('0x2f')]=_[_0x3de1('0x2e')](_0x898786[_0x3de1('0x2a')],qs[_0x3de1('0x30')](_0x149df5[_0x3de1('0x2c')][_0x3de1('0x30')]));_0x1d2721[_0x3de1('0x2f')]=_0x1d2721[_0x3de1('0x2f')][_0x3de1('0x31')]?_0x1d2721[_0x3de1('0x2f')]:_0x898786[_0x3de1('0x2a')];if(_0x149df5['query']['includeAll']){_0x1d2721['include']=[{'all':!![]}];}_0x1d2721=_[_0x3de1('0x32')]({},_0x1d2721,_0x149df5[_0x3de1('0x33')]);return db[_0x3de1('0x34')][_0x3de1('0x35')](_0x1d2721)['then'](handleEntityNotFound(_0xa5f4a6,null))['then'](respondWithResult(_0xa5f4a6,null))[_0x3de1('0x36')](handleError(_0xa5f4a6,null));};exports['update']=function(_0x563521,_0x3ddfca){if(_0x563521[_0x3de1('0x37')]['id']){delete _0x563521['body']['id'];}return db[_0x3de1('0x34')][_0x3de1('0x35')]({'where':{'id':_0x563521[_0x3de1('0x29')]['id']}})[_0x3de1('0x24')](handleEntityNotFound(_0x3ddfca,null))[_0x3de1('0x24')](saveUpdates(_0x563521['body'],null))[_0x3de1('0x24')](respondWithResult(_0x3ddfca,null))['catch'](handleError(_0x3ddfca,null));};exports[_0x3de1('0x25')]=function(_0x336480,_0x324df5){return db[_0x3de1('0x34')][_0x3de1('0x35')]({'where':{'id':_0x336480[_0x3de1('0x29')]['id']}})[_0x3de1('0x24')](handleEntityNotFound(_0x324df5,null))[_0x3de1('0x24')](removeEntity(_0x324df5,null))[_0x3de1('0x36')](handleError(_0x324df5,null));}; \ No newline at end of file +var _0x1d90=['status','end','json','offset','undefined','limit','count','Content-Range','reject','then','destroy','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','merge','options','ChatApplication','find','catch','update','body','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1d8b10,_0x9603a6){var _0x123f31=function(_0x675fd8){while(--_0x675fd8){_0x1d8b10['push'](_0x1d8b10['shift']());}};_0x123f31(++_0x9603a6);}(_0x1d90,0x13e));var _0x01d9=function(_0x14fd55,_0x2c43d4){_0x14fd55=_0x14fd55-0x0;var _0x1bd36c=_0x1d90[_0x14fd55];return _0x1bd36c;};'use strict';var emlformat=require(_0x01d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x01d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01d9('0x2'));var moment=require('moment');var BPromise=require(_0x01d9('0x3'));var Mustache=require(_0x01d9('0x4'));var util=require('util');var path=require(_0x01d9('0x5'));var sox=require(_0x01d9('0x6'));var csv=require(_0x01d9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01d9('0x8'));var _=require(_0x01d9('0x9'));var squel=require(_0x01d9('0xa'));var crypto=require('crypto');var jsforce=require(_0x01d9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x01d9('0xc'));var Papa=require(_0x01d9('0xd'));var Redis=require(_0x01d9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x01d9('0xf'));var as=require(_0x01d9('0x10'));var hardwareService=require(_0x01d9('0x11'));var logger=require('../../config/logger')(_0x01d9('0x12'));var utils=require(_0x01d9('0x13'));var config=require(_0x01d9('0x14'));var licenseUtil=require(_0x01d9('0x15'));var db=require(_0x01d9('0x16'))['db'];function respondWithStatusCode(_0x3c43c5,_0x411e2e){_0x411e2e=_0x411e2e||0xcc;return function(_0x2895dd){if(_0x2895dd){return _0x3c43c5[_0x01d9('0x17')](_0x411e2e);}return _0x3c43c5[_0x01d9('0x18')](_0x411e2e)[_0x01d9('0x19')]();};}function respondWithResult(_0x2ee7f6,_0x4ae815){_0x4ae815=_0x4ae815||0xc8;return function(_0x1fbbec){if(_0x1fbbec){return _0x2ee7f6[_0x01d9('0x18')](_0x4ae815)[_0x01d9('0x1a')](_0x1fbbec);}};}function respondWithFilteredResult(_0xfdf203,_0x58424c){return function(_0x18cfab){if(_0x18cfab){var _0x5bc7fc=typeof _0x58424c[_0x01d9('0x1b')]===_0x01d9('0x1c')&&typeof _0x58424c[_0x01d9('0x1d')]==='undefined';var _0xb22ca1=_0x18cfab[_0x01d9('0x1e')];var _0x51ebb3=_0x5bc7fc?0x0:_0x58424c[_0x01d9('0x1b')];var _0x2789e9=_0x5bc7fc?_0x18cfab[_0x01d9('0x1e')]:_0x58424c['offset']+_0x58424c['limit'];var _0x35e8ed;if(_0x2789e9>=_0xb22ca1){_0x2789e9=_0xb22ca1;_0x35e8ed=0xc8;}else{_0x35e8ed=0xce;}_0xfdf203['status'](_0x35e8ed);return _0xfdf203['set'](_0x01d9('0x1f'),_0x51ebb3+'-'+_0x2789e9+'/'+_0xb22ca1)[_0x01d9('0x1a')](_0x18cfab);}return null;};}function patchUpdates(_0x319e35){return function(_0x440f0b){try{jsonpatch['apply'](_0x440f0b,_0x319e35,!![]);}catch(_0xde5782){return BPromise[_0x01d9('0x20')](_0xde5782);}return _0x440f0b['save']();};}function saveUpdates(_0x216a49,_0x263e90){return function(_0x26d3e2){if(_0x26d3e2){return _0x26d3e2['update'](_0x216a49)[_0x01d9('0x21')](function(_0x12e465){return _0x12e465;});}return null;};}function removeEntity(_0x3326a1,_0x399d25){return function(_0x5c4c63){if(_0x5c4c63){return _0x5c4c63[_0x01d9('0x22')]()['then'](function(){_0x3326a1[_0x01d9('0x18')](0xcc)[_0x01d9('0x19')]();});}};}function handleEntityNotFound(_0x125ecb,_0x3d352c){return function(_0x30bc4c){if(!_0x30bc4c){_0x125ecb[_0x01d9('0x17')](0x194);}return _0x30bc4c;};}function handleError(_0x2fd2c9,_0x30c910){_0x30c910=_0x30c910||0x1f4;return function(_0xb731ba){logger[_0x01d9('0x23')](_0xb731ba[_0x01d9('0x24')]);if(_0xb731ba[_0x01d9('0x25')]){delete _0xb731ba['name'];}_0x2fd2c9[_0x01d9('0x18')](_0x30c910)[_0x01d9('0x26')](_0xb731ba);};}exports[_0x01d9('0x27')]=function(_0x10e6ae,_0x596cd7){var _0x509cfd={'raw':!![],'where':{'id':_0x10e6ae[_0x01d9('0x28')]['id']}},_0x35a817={};_0x35a817['model']=_[_0x01d9('0x29')](db['ChatApplication'][_0x01d9('0x2a')]);_0x35a817[_0x01d9('0x2b')]=_['keys'](_0x10e6ae['query']);_0x35a817[_0x01d9('0x2c')]=_[_0x01d9('0x2d')](_0x35a817['model'],_0x35a817[_0x01d9('0x2b')]);_0x509cfd['attributes']=_[_0x01d9('0x2d')](_0x35a817[_0x01d9('0x2e')],qs['fields'](_0x10e6ae[_0x01d9('0x2b')][_0x01d9('0x2f')]));_0x509cfd[_0x01d9('0x30')]=_0x509cfd[_0x01d9('0x30')]['length']?_0x509cfd['attributes']:_0x35a817[_0x01d9('0x2e')];if(_0x10e6ae[_0x01d9('0x2b')][_0x01d9('0x31')]){_0x509cfd['include']=[{'all':!![]}];}_0x509cfd=_[_0x01d9('0x32')]({},_0x509cfd,_0x10e6ae[_0x01d9('0x33')]);return db[_0x01d9('0x34')][_0x01d9('0x35')](_0x509cfd)[_0x01d9('0x21')](handleEntityNotFound(_0x596cd7,null))[_0x01d9('0x21')](respondWithResult(_0x596cd7,null))[_0x01d9('0x36')](handleError(_0x596cd7,null));};exports[_0x01d9('0x37')]=function(_0x2c2cf3,_0x416aea){if(_0x2c2cf3[_0x01d9('0x38')]['id']){delete _0x2c2cf3['body']['id'];}return db[_0x01d9('0x34')][_0x01d9('0x35')]({'where':{'id':_0x2c2cf3[_0x01d9('0x28')]['id']}})[_0x01d9('0x21')](handleEntityNotFound(_0x416aea,null))[_0x01d9('0x21')](saveUpdates(_0x2c2cf3[_0x01d9('0x38')],null))[_0x01d9('0x21')](respondWithResult(_0x416aea,null))['catch'](handleError(_0x416aea,null));};exports[_0x01d9('0x22')]=function(_0x183405,_0x419bfc){return db[_0x01d9('0x34')]['find']({'where':{'id':_0x183405[_0x01d9('0x28')]['id']}})['then'](handleEntityNotFound(_0x419bfc,null))['then'](removeEntity(_0x419bfc,null))['catch'](handleError(_0x419bfc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 03006db..3da9673 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 _0x5cea=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3197b6,_0x1be6ef){var _0x3399cd=function(_0x10cd4b){while(--_0x10cd4b){_0x3197b6['push'](_0x3197b6['shift']());}};_0x3399cd(++_0x1be6ef);}(_0x5cea,0x151));var _0xa5ce=function(_0x211273,_0x27b7d9){_0x211273=_0x211273-0x0;var _0x48c869=_0x5cea[_0x211273];return _0x48c869;};'use strict';var _=require('lodash');var util=require(_0xa5ce('0x0'));var logger=require(_0xa5ce('0x1'))(_0xa5ce('0x2'));var moment=require(_0xa5ce('0x3'));var BPromise=require(_0xa5ce('0x4'));var rp=require(_0xa5ce('0x5'));var fs=require('fs');var path=require(_0xa5ce('0x6'));var rimraf=require('rimraf');var config=require(_0xa5ce('0x7'));var attributes=require(_0xa5ce('0x8'));module[_0xa5ce('0x9')]=function(_0xd9fbe6,_0xd04e1){return _0xd9fbe6[_0xa5ce('0xa')](_0xa5ce('0xb'),attributes,{'tableName':_0xa5ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa5ce('0xd'),'collate':_0xa5ce('0xe')});}; \ No newline at end of file +var _0xcd1f=['path','rimraf','../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4a8f87,_0x3d2f52){var _0x53671d=function(_0x26febe){while(--_0x26febe){_0x4a8f87['push'](_0x4a8f87['shift']());}};_0x53671d(++_0x3d2f52);}(_0xcd1f,0x162));var _0xfcd1=function(_0x4c4468,_0x57b9bc){_0x4c4468=_0x4c4468-0x0;var _0x3c3e27=_0xcd1f[_0x4c4468];return _0x3c3e27;};'use strict';var _=require(_0xfcd1('0x0'));var util=require(_0xfcd1('0x1'));var logger=require(_0xfcd1('0x2'))(_0xfcd1('0x3'));var moment=require(_0xfcd1('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcd1('0x5'));var fs=require('fs');var path=require(_0xfcd1('0x6'));var rimraf=require(_0xfcd1('0x7'));var config=require(_0xfcd1('0x8'));var attributes=require('./chatApplication.attributes');module[_0xfcd1('0x9')]=function(_0xd4f335,_0x3c5c75){return _0xd4f335[_0xfcd1('0xa')](_0xfcd1('0xb'),attributes,{'tableName':_0xfcd1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfcd1('0xd'),'collate':_0xfcd1('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 1c535f6..82c3de0 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 _0x70c6=['info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x39b68b,_0x4ad96d){var _0xae091f=function(_0x13b5e1){while(--_0x13b5e1){_0x39b68b['push'](_0x39b68b['shift']());}};_0xae091f(++_0x4ad96d);}(_0x70c6,0x1d6));var _0x670c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x70c6[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x670c('0x0'));var BPromise=require('bluebird');var rs=require(_0x670c('0x1'));var fs=require('fs');var Redis=require(_0x670c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x670c('0x3'));var logger=require(_0x670c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x670c('0x5'));var client=jayson[_0x670c('0x6')][_0x670c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1daffa,_0x3a1e5f,_0x4e242f){return new BPromise(function(_0x23f7bd,_0x5d33b2){return client[_0x670c('0x8')](_0x1daffa,_0x4e242f)[_0x670c('0x9')](function(_0x1c7e6b){logger[_0x670c('0xa')](_0x670c('0xb'),_0x3a1e5f,'request\x20sent');logger[_0x670c('0xc')](_0x670c('0xd'),_0x3a1e5f,'request\x20sent',JSON[_0x670c('0xe')](_0x1c7e6b));if(_0x1c7e6b[_0x670c('0xf')]){if(_0x1c7e6b[_0x670c('0xf')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x3a1e5f,_0x1c7e6b[_0x670c('0xf')][_0x670c('0x10')]);return _0x5d33b2(_0x1c7e6b['error'][_0x670c('0x10')]);}logger[_0x670c('0xf')](_0x670c('0xb'),_0x3a1e5f,_0x1c7e6b[_0x670c('0xf')]['message']);return _0x23f7bd(_0x1c7e6b['error'][_0x670c('0x10')]);}else{logger[_0x670c('0xa')](_0x670c('0xb'),_0x3a1e5f,_0x670c('0x11'));_0x23f7bd(_0x1c7e6b[_0x670c('0x12')][_0x670c('0x10')]);}})[_0x670c('0x13')](function(_0x4f9af0){logger[_0x670c('0xf')]('ChatApplication,\x20%s,\x20%s',_0x3a1e5f,_0x4f9af0);_0x5d33b2(_0x4f9af0);});});} \ No newline at end of file +var _0x4665=['lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x5318bc,_0x17d37d){var _0x1d3175=function(_0x2c195a){while(--_0x2c195a){_0x5318bc['push'](_0x5318bc['shift']());}};_0x1d3175(++_0x17d37d);}(_0x4665,0x111));var _0x5466=function(_0x814257,_0x5403ed){_0x814257=_0x814257-0x0;var _0x4f9aa0=_0x4665[_0x814257];return _0x4f9aa0;};'use strict';var _=require(_0x5466('0x0'));var util=require(_0x5466('0x1'));var moment=require(_0x5466('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5466('0x3'))['db'];var utils=require(_0x5466('0x4'));var logger=require('../../config/logger')(_0x5466('0x5'));var config=require(_0x5466('0x6'));var jayson=require(_0x5466('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24849b,_0x22c3f1,_0x5045e7){return new BPromise(function(_0x5b650c,_0x12223e){return client[_0x5466('0x8')](_0x24849b,_0x5045e7)[_0x5466('0x9')](function(_0x5a5e9c){logger[_0x5466('0xa')]('ChatApplication,\x20%s,\x20%s',_0x22c3f1,_0x5466('0xb'));logger[_0x5466('0xc')](_0x5466('0xd'),_0x22c3f1,'request\x20sent',JSON[_0x5466('0xe')](_0x5a5e9c));if(_0x5a5e9c[_0x5466('0xf')]){if(_0x5a5e9c[_0x5466('0xf')][_0x5466('0x10')]===0x1f4){logger[_0x5466('0xf')](_0x5466('0x11'),_0x22c3f1,_0x5a5e9c[_0x5466('0xf')][_0x5466('0x12')]);return _0x12223e(_0x5a5e9c['error'][_0x5466('0x12')]);}logger[_0x5466('0xf')]('ChatApplication,\x20%s,\x20%s',_0x22c3f1,_0x5a5e9c[_0x5466('0xf')][_0x5466('0x12')]);return _0x5b650c(_0x5a5e9c[_0x5466('0xf')][_0x5466('0x12')]);}else{logger[_0x5466('0xa')](_0x5466('0x11'),_0x22c3f1,_0x5466('0xb'));_0x5b650c(_0x5a5e9c[_0x5466('0x13')]['message']);}})[_0x5466('0x14')](function(_0x4fe8bb){logger[_0x5466('0xf')](_0x5466('0x11'),_0x22c3f1,_0x4fe8bb);_0x12223e(_0x4fe8bb);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c0707ae..a54f8a4 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 _0x18d7=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','show','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x18d7,0x1a6));var _0x718d=function(_0x1e9483,_0x1a4949){_0x1e9483=_0x1e9483-0x0;var _0x4b7e09=_0x18d7[_0x1e9483];return _0x4b7e09;};'use strict';var multer=require(_0x718d('0x0'));var util=require(_0x718d('0x1'));var path=require(_0x718d('0x2'));var timeout=require(_0x718d('0x3'));var express=require(_0x718d('0x4'));var router=express['Router']();var fs_extra=require(_0x718d('0x5'));var auth=require(_0x718d('0x6'));var interaction=require(_0x718d('0x7'));var config=require('../../config/environment');var controller=require(_0x718d('0x8'));router[_0x718d('0x9')]('/:id',auth[_0x718d('0xa')](),controller[_0x718d('0xb')]);router['put'](_0x718d('0xc'),auth[_0x718d('0xa')](),controller[_0x718d('0xd')]);router[_0x718d('0xe')](_0x718d('0xc'),auth[_0x718d('0xa')](),controller[_0x718d('0xf')]);module[_0x718d('0x10')]=router; \ No newline at end of file +var _0xae64=['./chatApplication.controller','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service'];(function(_0x135883,_0x58624c){var _0x308959=function(_0x416faf){while(--_0x416faf){_0x135883['push'](_0x135883['shift']());}};_0x308959(++_0x58624c);}(_0xae64,0xf8));var _0x4ae6=function(_0x513eca,_0x593007){_0x513eca=_0x513eca-0x0;var _0x2c4e0b=_0xae64[_0x513eca];return _0x2c4e0b;};'use strict';var multer=require(_0x4ae6('0x0'));var util=require(_0x4ae6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4ae6('0x2'));var interaction=require(_0x4ae6('0x3'));var config=require('../../config/environment');var controller=require(_0x4ae6('0x4'));router['get']('/:id',auth[_0x4ae6('0x5')](),controller[_0x4ae6('0x6')]);router[_0x4ae6('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4ae6('0x8')]);router[_0x4ae6('0x9')]('/:id',auth[_0x4ae6('0x5')](),controller[_0x4ae6('0xa')]);module[_0x4ae6('0xb')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 3757ec7..8a9d646 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 _0x179d=['STRING','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x179d,0x85));var _0xd179=function(_0xbe322e,_0x42450d){_0xbe322e=_0xbe322e-0x0;var _0x5d609e=_0x179d[_0xbe322e];return _0x5d609e;};'use strict';var Sequelize=require('sequelize');module[_0xd179('0x0')]={'name':{'type':Sequelize[_0xd179('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd179('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0909=['exports','BOOLEAN'];(function(_0x326ae1,_0x559742){var _0x616d33=function(_0xc9f279){while(--_0xc9f279){_0x326ae1['push'](_0x326ae1['shift']());}};_0x616d33(++_0x559742);}(_0x0909,0x1e6));var _0x9090=function(_0x15f3a7,_0x4a01fa){_0x15f3a7=_0x15f3a7-0x0;var _0x57288e=_0x0909[_0x15f3a7];return _0x57288e;};'use strict';var Sequelize=require('sequelize');module[_0x9090('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x9090('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 6ae5159..57da764 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 _0xbd42=['getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','removeMembers','addMessage','ChatGroupId','getMessages','rawAttributes','$gte','split','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','map','ChatGroup','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','catch','body','describe'];(function(_0x57fcb5,_0x59a425){var _0x507375=function(_0x11b5f0){while(--_0x11b5f0){_0x57fcb5['push'](_0x57fcb5['shift']());}};_0x507375(++_0x59a425);}(_0xbd42,0x1e6));var _0x2bd4=function(_0x3684c8,_0x3ddbd1){_0x3684c8=_0x3684c8-0x0;var _0x460f26=_0xbd42[_0x3684c8];return _0x460f26;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bd4('0x0'));var zipdir=require(_0x2bd4('0x1'));var jsonpatch=require(_0x2bd4('0x2'));var rp=require(_0x2bd4('0x3'));var moment=require(_0x2bd4('0x4'));var BPromise=require(_0x2bd4('0x5'));var Mustache=require(_0x2bd4('0x6'));var util=require(_0x2bd4('0x7'));var path=require('path');var sox=require(_0x2bd4('0x8'));var csv=require(_0x2bd4('0x9'));var ejs=require(_0x2bd4('0xa'));var fs=require('fs');var fs_extra=require(_0x2bd4('0xb'));var _=require(_0x2bd4('0xc'));var squel=require(_0x2bd4('0xd'));var crypto=require(_0x2bd4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2bd4('0x9'));var querystring=require('querystring');var Papa=require(_0x2bd4('0xf'));var Redis=require(_0x2bd4('0x10'));var authService=require(_0x2bd4('0x11'));var qs=require(_0x2bd4('0x12'));var as=require(_0x2bd4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bd4('0x14'))('api');var utils=require(_0x2bd4('0x15'));var config=require(_0x2bd4('0x16'));var licenseUtil=require(_0x2bd4('0x17'));var db=require(_0x2bd4('0x18'))['db'];config[_0x2bd4('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2bd4('0x1a'))(new Redis(config[_0x2bd4('0x19')]));require('./chatGroup.socket')[_0x2bd4('0x1b')](socket);function respondWithStatusCode(_0x1d3f16,_0x2b5a6e){_0x2b5a6e=_0x2b5a6e||0xcc;return function(_0x1c7064){if(_0x1c7064){return _0x1d3f16[_0x2bd4('0x1c')](_0x2b5a6e);}return _0x1d3f16[_0x2bd4('0x1d')](_0x2b5a6e)['end']();};}function respondWithResult(_0x401cdd,_0x4e58c4){_0x4e58c4=_0x4e58c4||0xc8;return function(_0x2369eb){if(_0x2369eb){return _0x401cdd[_0x2bd4('0x1d')](_0x4e58c4)['json'](_0x2369eb);}};}function respondWithFilteredResult(_0x4af89c,_0x1e5181){return function(_0x21c6da){if(_0x21c6da){var _0xe96498=typeof _0x1e5181[_0x2bd4('0x1e')]==='undefined'&&typeof _0x1e5181[_0x2bd4('0x1f')]===_0x2bd4('0x20');var _0x41fa90=_0x21c6da[_0x2bd4('0x21')];var _0x30d19f=_0xe96498?0x0:_0x1e5181['offset'];var _0x48d124=_0xe96498?_0x21c6da[_0x2bd4('0x21')]:_0x1e5181[_0x2bd4('0x1e')]+_0x1e5181[_0x2bd4('0x1f')];var _0x27ecf6;if(_0x48d124>=_0x41fa90){_0x48d124=_0x41fa90;_0x27ecf6=0xc8;}else{_0x27ecf6=0xce;}_0x4af89c['status'](_0x27ecf6);return _0x4af89c[_0x2bd4('0x22')](_0x2bd4('0x23'),_0x30d19f+'-'+_0x48d124+'/'+_0x41fa90)[_0x2bd4('0x24')](_0x21c6da);}return null;};}function patchUpdates(_0x156c76){return function(_0x271084){try{jsonpatch[_0x2bd4('0x25')](_0x271084,_0x156c76,!![]);}catch(_0x396396){return BPromise[_0x2bd4('0x26')](_0x396396);}return _0x271084[_0x2bd4('0x27')]();};}function saveUpdates(_0x4c2ff1,_0x6b8014){return function(_0x232772){if(_0x232772){return _0x232772[_0x2bd4('0x28')](_0x4c2ff1)[_0x2bd4('0x29')](function(_0x3bcd17){return _0x3bcd17;});}return null;};}function removeEntity(_0x40c22c,_0x4374bd){return function(_0x4162cd){if(_0x4162cd){return _0x4162cd[_0x2bd4('0x2a')]()[_0x2bd4('0x29')](function(){_0x40c22c[_0x2bd4('0x1d')](0xcc)[_0x2bd4('0x2b')]();});}};}function handleEntityNotFound(_0x420748,_0x296867){return function(_0x288a36){if(!_0x288a36){_0x420748[_0x2bd4('0x1c')](0x194);}return _0x288a36;};}function handleError(_0x339426,_0x12dde5){_0x12dde5=_0x12dde5||0x1f4;return function(_0x6d72c7){logger['error'](_0x6d72c7[_0x2bd4('0x2c')]);if(_0x6d72c7[_0x2bd4('0x2d')]){delete _0x6d72c7[_0x2bd4('0x2d')];}_0x339426[_0x2bd4('0x1d')](_0x12dde5)['send'](_0x6d72c7);};}exports['index']=function(_0x4d1973,_0x257257){var _0x30d70b={},_0x1a4de8={},_0x19ca0d={'count':0x0,'rows':[]};var _0x2f99c0=_[_0x2bd4('0x2e')](db[_0x2bd4('0x2f')]['rawAttributes'],function(_0x2d317e){return{'name':_0x2d317e[_0x2bd4('0x30')],'type':_0x2d317e[_0x2bd4('0x31')]['key']};});_0x1a4de8[_0x2bd4('0x32')]=_[_0x2bd4('0x2e')](_0x2f99c0,_0x2bd4('0x2d'));_0x1a4de8[_0x2bd4('0x33')]=_[_0x2bd4('0x34')](_0x4d1973[_0x2bd4('0x33')]);_0x1a4de8['filters']=_[_0x2bd4('0x35')](_0x1a4de8['model'],_0x1a4de8[_0x2bd4('0x33')]);_0x30d70b[_0x2bd4('0x36')]=_['intersection'](_0x1a4de8[_0x2bd4('0x32')],qs['fields'](_0x4d1973[_0x2bd4('0x33')]['fields']));_0x30d70b[_0x2bd4('0x36')]=_0x30d70b[_0x2bd4('0x36')][_0x2bd4('0x37')]?_0x30d70b[_0x2bd4('0x36')]:_0x1a4de8[_0x2bd4('0x32')];if(!_0x4d1973[_0x2bd4('0x33')][_0x2bd4('0x38')](_0x2bd4('0x39'))){_0x30d70b['limit']=qs[_0x2bd4('0x1f')](_0x4d1973[_0x2bd4('0x33')][_0x2bd4('0x1f')]);_0x30d70b['offset']=qs[_0x2bd4('0x1e')](_0x4d1973['query']['offset']);}_0x30d70b[_0x2bd4('0x3a')]=qs[_0x2bd4('0x3b')](_0x4d1973[_0x2bd4('0x33')][_0x2bd4('0x3b')]);_0x30d70b[_0x2bd4('0x3c')]=qs[_0x2bd4('0x3d')](_[_0x2bd4('0x3e')](_0x4d1973['query'],_0x1a4de8[_0x2bd4('0x3d')]),_0x2f99c0);if(_0x4d1973[_0x2bd4('0x33')][_0x2bd4('0x3f')]){_0x30d70b[_0x2bd4('0x3c')]=_[_0x2bd4('0x40')](_0x30d70b[_0x2bd4('0x3c')],{'$or':_[_0x2bd4('0x2e')](_0x2f99c0,function(_0x146327){if(_0x146327['type']!==_0x2bd4('0x41')){var _0x622f7d={};_0x622f7d[_0x146327[_0x2bd4('0x2d')]]={'$like':'%'+_0x4d1973['query'][_0x2bd4('0x3f')]+'%'};return _0x622f7d;}})});}_0x30d70b=_[_0x2bd4('0x40')]({},_0x30d70b,_0x4d1973[_0x2bd4('0x42')]);var _0x460945={'where':_0x30d70b[_0x2bd4('0x3c')]};return db['ChatGroup'][_0x2bd4('0x21')](_0x460945)['then'](function(_0x54936f){_0x19ca0d[_0x2bd4('0x21')]=_0x54936f;if(_0x4d1973[_0x2bd4('0x33')][_0x2bd4('0x43')]){_0x30d70b[_0x2bd4('0x44')]=[{'all':!![]}];}return db[_0x2bd4('0x2f')][_0x2bd4('0x45')](_0x30d70b);})[_0x2bd4('0x29')](function(_0x49f25d){_0x19ca0d[_0x2bd4('0x46')]=_0x49f25d;return _0x19ca0d;})[_0x2bd4('0x29')](respondWithFilteredResult(_0x257257,_0x30d70b))['catch'](handleError(_0x257257,null));};exports[_0x2bd4('0x47')]=function(_0x256a8d,_0x5e3378){var _0x420027={'raw':!![],'where':{'id':_0x256a8d[_0x2bd4('0x48')]['id']}},_0x3d8998={};_0x3d8998[_0x2bd4('0x32')]=_[_0x2bd4('0x34')](db[_0x2bd4('0x2f')]['rawAttributes']);_0x3d8998[_0x2bd4('0x33')]=_[_0x2bd4('0x34')](_0x256a8d['query']);_0x3d8998[_0x2bd4('0x3d')]=_[_0x2bd4('0x35')](_0x3d8998[_0x2bd4('0x32')],_0x3d8998['query']);_0x420027[_0x2bd4('0x36')]=_[_0x2bd4('0x35')](_0x3d8998[_0x2bd4('0x32')],qs[_0x2bd4('0x49')](_0x256a8d['query']['fields']));_0x420027[_0x2bd4('0x36')]=_0x420027['attributes'][_0x2bd4('0x37')]?_0x420027['attributes']:_0x3d8998[_0x2bd4('0x32')];if(_0x256a8d[_0x2bd4('0x33')]['includeAll']){_0x420027[_0x2bd4('0x44')]=[{'all':!![]}];}_0x420027=_[_0x2bd4('0x40')]({},_0x420027,_0x256a8d['options']);return db[_0x2bd4('0x2f')][_0x2bd4('0x4a')](_0x420027)[_0x2bd4('0x29')](handleEntityNotFound(_0x5e3378,null))[_0x2bd4('0x29')](respondWithResult(_0x5e3378,null))[_0x2bd4('0x4b')](handleError(_0x5e3378,null));};exports['create']=function(_0x35c89f,_0x54da96){return db[_0x2bd4('0x2f')]['create'](_0x35c89f['body'],{})['then'](respondWithResult(_0x54da96,0xc9))[_0x2bd4('0x4b')](handleError(_0x54da96,null));};exports[_0x2bd4('0x28')]=function(_0xc3bb7a,_0x57dd1d){if(_0xc3bb7a[_0x2bd4('0x4c')]['id']){delete _0xc3bb7a[_0x2bd4('0x4c')]['id'];}return db[_0x2bd4('0x2f')][_0x2bd4('0x4a')]({'where':{'id':_0xc3bb7a['params']['id']}})[_0x2bd4('0x29')](handleEntityNotFound(_0x57dd1d,null))[_0x2bd4('0x29')](saveUpdates(_0xc3bb7a[_0x2bd4('0x4c')],null))[_0x2bd4('0x29')](respondWithResult(_0x57dd1d,null))[_0x2bd4('0x4b')](handleError(_0x57dd1d,null));};exports[_0x2bd4('0x2a')]=function(_0x578137,_0x418625){return db[_0x2bd4('0x2f')][_0x2bd4('0x4a')]({'where':{'id':_0x578137[_0x2bd4('0x48')]['id']}})['then'](handleEntityNotFound(_0x418625,null))[_0x2bd4('0x29')](removeEntity(_0x418625,null))[_0x2bd4('0x4b')](handleError(_0x418625,null));};exports[_0x2bd4('0x4d')]=function(_0x5dc60b,_0x5c5e70){return db[_0x2bd4('0x2f')][_0x2bd4('0x4d')]()[_0x2bd4('0x29')](respondWithResult(_0x5c5e70,null))[_0x2bd4('0x4b')](handleError(_0x5c5e70,null));};exports[_0x2bd4('0x4e')]=function(_0x4c3261,_0x278201,_0x42cd75){return db[_0x2bd4('0x4f')][_0x2bd4('0x21')]({'where':{'ChatGroupId':_0x4c3261[_0x2bd4('0x48')]['id'],'ToId':_0x4c3261[_0x2bd4('0x50')]['id'],'read':![]}})[_0x2bd4('0x29')](function(_0x4c69b2){return{'id':_['toInteger'](_0x4c3261[_0x2bd4('0x48')]['id']),'count':_0x4c69b2};})[_0x2bd4('0x29')](respondWithResult(_0x278201,null))['catch'](handleError(_0x278201,null));};exports[_0x2bd4('0x51')]=function(_0xe3e86f,_0x10deb1,_0x49e9ca){return db[_0x2bd4('0x2f')][_0x2bd4('0x4a')]({'where':{'id':_0xe3e86f[_0x2bd4('0x48')]['id']}})['then'](handleEntityNotFound(_0x10deb1,null))[_0x2bd4('0x29')](function(_0x17e92b){if(_0x17e92b){return _0x17e92b[_0x2bd4('0x51')](_0xe3e86f[_0x2bd4('0x4c')][_0x2bd4('0x52')],_[_0x2bd4('0x53')](_0xe3e86f[_0x2bd4('0x4c')],[_0x2bd4('0x52'),'id'])||{});}})['then'](respondWithResult(_0x10deb1,null))[_0x2bd4('0x4b')](handleError(_0x10deb1,null));};exports[_0x2bd4('0x54')]=function(_0x282fef,_0x19cb3f,_0x44ee3e){var _0x3f57d8={};var _0x269945={};var _0x3c99c3;var _0x4f511b;return db[_0x2bd4('0x2f')][_0x2bd4('0x55')]({'where':{'id':_0x282fef['params']['id']}})[_0x2bd4('0x29')](handleEntityNotFound(_0x19cb3f,null))['then'](function(_0x531007){if(_0x531007){_0x3c99c3=_0x531007;_0x269945['model']=_[_0x2bd4('0x34')](db['User']['rawAttributes']);_0x269945['query']=_[_0x2bd4('0x34')](_0x282fef[_0x2bd4('0x33')]);_0x269945['filters']=_[_0x2bd4('0x35')](_0x269945[_0x2bd4('0x32')],_0x269945[_0x2bd4('0x33')]);_0x3f57d8['attributes']=_[_0x2bd4('0x35')](_0x269945[_0x2bd4('0x32')],qs['fields'](_0x282fef[_0x2bd4('0x33')][_0x2bd4('0x49')]));_0x3f57d8[_0x2bd4('0x36')]=_0x3f57d8[_0x2bd4('0x36')][_0x2bd4('0x37')]?_0x3f57d8[_0x2bd4('0x36')]:_0x269945[_0x2bd4('0x32')];_0x3f57d8[_0x2bd4('0x3a')]=qs[_0x2bd4('0x3b')](_0x282fef['query']['sort']);_0x3f57d8['where']=qs['filters'](_[_0x2bd4('0x3e')](_0x282fef[_0x2bd4('0x33')],_0x269945[_0x2bd4('0x3d')]));if(_0x282fef[_0x2bd4('0x33')][_0x2bd4('0x3f')]){_0x3f57d8[_0x2bd4('0x3c')]=_[_0x2bd4('0x40')](_0x3f57d8[_0x2bd4('0x3c')],{'$or':_[_0x2bd4('0x2e')](_0x3f57d8[_0x2bd4('0x36')],function(_0x261139){var _0x17855b={};_0x17855b[_0x261139]={'$like':'%'+_0x282fef[_0x2bd4('0x33')][_0x2bd4('0x3f')]+'%'};return _0x17855b;})});}_0x3f57d8=_[_0x2bd4('0x40')]({},_0x3f57d8,_0x282fef[_0x2bd4('0x42')]);return _0x3c99c3['getMembers'](_0x3f57d8);}})[_0x2bd4('0x29')](function(_0x5c8367){if(_0x5c8367){_0x4f511b=_0x5c8367[_0x2bd4('0x37')];if(!_0x282fef[_0x2bd4('0x33')]['hasOwnProperty'](_0x2bd4('0x39'))){_0x3f57d8[_0x2bd4('0x1f')]=qs['limit'](_0x282fef[_0x2bd4('0x33')]['limit']);_0x3f57d8[_0x2bd4('0x1e')]=qs[_0x2bd4('0x1e')](_0x282fef[_0x2bd4('0x33')][_0x2bd4('0x1e')]);}return _0x3c99c3[_0x2bd4('0x54')](_0x3f57d8);}})[_0x2bd4('0x29')](function(_0x2ccbb3){if(_0x2ccbb3){return _0x2ccbb3?{'count':_0x4f511b,'rows':_0x2ccbb3}:null;}})[_0x2bd4('0x29')](respondWithResult(_0x19cb3f,null))['catch'](handleError(_0x19cb3f,null));};exports[_0x2bd4('0x56')]=function(_0x1e1954,_0x1d1460,_0x5cc52a){return db[_0x2bd4('0x2f')][_0x2bd4('0x4a')]({'where':{'id':_0x1e1954[_0x2bd4('0x48')]['id']}})[_0x2bd4('0x29')](handleEntityNotFound(_0x1d1460,null))[_0x2bd4('0x29')](function(_0x1ab8aa){if(_0x1ab8aa){return _0x1ab8aa[_0x2bd4('0x56')](_0x1e1954['query'][_0x2bd4('0x52')]);}})[_0x2bd4('0x29')](respondWithStatusCode(_0x1d1460,null))[_0x2bd4('0x4b')](handleError(_0x1d1460,null));};exports[_0x2bd4('0x57')]=function(_0x3834fc,_0x5367c1,_0x1133c4){if(_0x3834fc[_0x2bd4('0x4c')]['id']){delete _0x3834fc[_0x2bd4('0x4c')]['id'];}return db[_0x2bd4('0x2f')][_0x2bd4('0x4a')]({'where':{'id':_0x3834fc[_0x2bd4('0x48')]['id']}})['then'](handleEntityNotFound(_0x5367c1,null))[_0x2bd4('0x29')](function(_0x582df6){if(_0x582df6){_0x3834fc[_0x2bd4('0x4c')][_0x2bd4('0x58')]=_0x582df6['id'];return db[_0x2bd4('0x4f')]['create'](_0x3834fc['body']);}})['then'](respondWithResult(_0x5367c1,null))[_0x2bd4('0x4b')](handleError(_0x5367c1,null));};exports[_0x2bd4('0x59')]=function(_0x3cc47c,_0x52f5f7,_0x40f0d3){var _0x16c558={};var _0x5d74a7={};var _0x170e80;var _0x3dd4e5;return db[_0x2bd4('0x2f')][_0x2bd4('0x55')]({'where':{'id':_0x3cc47c[_0x2bd4('0x48')]['id']}})[_0x2bd4('0x29')](handleEntityNotFound(_0x52f5f7,null))[_0x2bd4('0x29')](function(_0x227b0b){if(_0x227b0b){_0x170e80=_0x227b0b;_0x5d74a7['model']=_[_0x2bd4('0x34')](db[_0x2bd4('0x4f')][_0x2bd4('0x5a')]);_0x5d74a7['query']=_[_0x2bd4('0x34')](_0x3cc47c['query']);_0x5d74a7[_0x2bd4('0x3d')]=_[_0x2bd4('0x35')](_0x5d74a7['model'],_0x5d74a7[_0x2bd4('0x33')]);_0x16c558[_0x2bd4('0x36')]=_[_0x2bd4('0x35')](_0x5d74a7['model'],qs[_0x2bd4('0x49')](_0x3cc47c['query'][_0x2bd4('0x49')]));_0x16c558[_0x2bd4('0x36')]=_0x16c558['attributes'][_0x2bd4('0x37')]?_0x16c558[_0x2bd4('0x36')]:_0x5d74a7[_0x2bd4('0x32')];_0x16c558[_0x2bd4('0x3a')]=qs['sort'](_0x3cc47c[_0x2bd4('0x33')]['sort']);_0x16c558[_0x2bd4('0x3c')]=qs['filters'](_[_0x2bd4('0x3e')](_0x3cc47c[_0x2bd4('0x33')],_0x5d74a7[_0x2bd4('0x3d')]));if(_0x3cc47c[_0x2bd4('0x33')][_0x2bd4('0x3f')]){_0x16c558[_0x2bd4('0x3c')]=_[_0x2bd4('0x40')](_0x16c558[_0x2bd4('0x3c')],{'$or':_[_0x2bd4('0x2e')](_0x16c558['attributes'],function(_0x413f2a){var _0x847d0={};_0x847d0[_0x413f2a]={'$like':'%'+_0x3cc47c[_0x2bd4('0x33')][_0x2bd4('0x3f')]+'%'};return _0x847d0;})});}if(_0x3cc47c[_0x2bd4('0x33')][_0x2bd4('0x5b')]){var _0xc00bbd=_0x3cc47c[_0x2bd4('0x33')][_0x2bd4('0x5b')][_0x2bd4('0x5c')](',');var _0x158e6e={};_0x158e6e[_0xc00bbd[0x0]]={'$gte':moment(_0xc00bbd[0x1])[_0x2bd4('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x16c558[_0x2bd4('0x3c')]=_[_0x2bd4('0x40')](_0x16c558[_0x2bd4('0x3c')],_0x158e6e);}_0x16c558=_['merge']({},_0x16c558,_0x3cc47c[_0x2bd4('0x42')]);return _0x170e80[_0x2bd4('0x59')](_0x16c558);}})['then'](function(_0x3b3bb1){if(_0x3b3bb1){_0x3dd4e5=_0x3b3bb1['length'];if(!_0x3cc47c[_0x2bd4('0x33')][_0x2bd4('0x38')](_0x2bd4('0x39'))){_0x16c558[_0x2bd4('0x1f')]=qs[_0x2bd4('0x1f')](_0x3cc47c[_0x2bd4('0x33')][_0x2bd4('0x1f')]);_0x16c558['offset']=qs[_0x2bd4('0x1e')](_0x3cc47c[_0x2bd4('0x33')][_0x2bd4('0x1e')]);}return _0x170e80[_0x2bd4('0x59')](_0x16c558);}})[_0x2bd4('0x29')](function(_0x386a8a){if(_0x386a8a){return _0x386a8a?{'count':_0x3dd4e5,'rows':_0x386a8a}:null;}})['then'](respondWithResult(_0x52f5f7,null))[_0x2bd4('0x4b')](handleError(_0x52f5f7,null));}; \ No newline at end of file +var _0x9e24=['merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','create','body','update','find','describe','ChatInternalMessage','user','toInteger','addMembers','omit','getMembers','findOne','User','removeMembers','ids','addMessage','getMessages','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x9e24,0x1a6));var _0x49e2=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x9e24[_0x5a2d95];return _0x2c3986;};'use strict';var emlformat=require(_0x49e2('0x0'));var rimraf=require(_0x49e2('0x1'));var zipdir=require(_0x49e2('0x2'));var jsonpatch=require(_0x49e2('0x3'));var rp=require(_0x49e2('0x4'));var moment=require('moment');var BPromise=require(_0x49e2('0x5'));var Mustache=require(_0x49e2('0x6'));var util=require(_0x49e2('0x7'));var path=require(_0x49e2('0x8'));var sox=require(_0x49e2('0x9'));var csv=require(_0x49e2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49e2('0xb'));var squel=require(_0x49e2('0xc'));var crypto=require(_0x49e2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x49e2('0xe'));var toCsv=require(_0x49e2('0xa'));var querystring=require(_0x49e2('0xf'));var Papa=require(_0x49e2('0x10'));var Redis=require(_0x49e2('0x11'));var authService=require(_0x49e2('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49e2('0x13'));var logger=require(_0x49e2('0x14'))(_0x49e2('0x15'));var utils=require(_0x49e2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x49e2('0x17'));var db=require(_0x49e2('0x18'))['db'];config[_0x49e2('0x19')]=_[_0x49e2('0x1a')](config['redis'],{'host':_0x49e2('0x1b'),'port':0x18eb});var socket=require(_0x49e2('0x1c'))(new Redis(config['redis']));require(_0x49e2('0x1d'))['register'](socket);function respondWithStatusCode(_0x556f23,_0x293301){_0x293301=_0x293301||0xcc;return function(_0x2a4e98){if(_0x2a4e98){return _0x556f23['sendStatus'](_0x293301);}return _0x556f23[_0x49e2('0x1e')](_0x293301)['end']();};}function respondWithResult(_0x1fb3dc,_0x33945c){_0x33945c=_0x33945c||0xc8;return function(_0x2f037a){if(_0x2f037a){return _0x1fb3dc['status'](_0x33945c)[_0x49e2('0x1f')](_0x2f037a);}};}function respondWithFilteredResult(_0x56ef0f,_0x456e4a){return function(_0x5f1e51){if(_0x5f1e51){var _0x372fea=typeof _0x456e4a[_0x49e2('0x20')]===_0x49e2('0x21')&&typeof _0x456e4a[_0x49e2('0x22')]==='undefined';var _0x64634a=_0x5f1e51[_0x49e2('0x23')];var _0x166149=_0x372fea?0x0:_0x456e4a[_0x49e2('0x20')];var _0x3164de=_0x372fea?_0x5f1e51[_0x49e2('0x23')]:_0x456e4a[_0x49e2('0x20')]+_0x456e4a[_0x49e2('0x22')];var _0x357bd9;if(_0x3164de>=_0x64634a){_0x3164de=_0x64634a;_0x357bd9=0xc8;}else{_0x357bd9=0xce;}_0x56ef0f[_0x49e2('0x1e')](_0x357bd9);return _0x56ef0f[_0x49e2('0x24')](_0x49e2('0x25'),_0x166149+'-'+_0x3164de+'/'+_0x64634a)[_0x49e2('0x1f')](_0x5f1e51);}return null;};}function patchUpdates(_0xc5924e){return function(_0x37338e){try{jsonpatch[_0x49e2('0x26')](_0x37338e,_0xc5924e,!![]);}catch(_0x2f0ca0){return BPromise[_0x49e2('0x27')](_0x2f0ca0);}return _0x37338e[_0x49e2('0x28')]();};}function saveUpdates(_0x285136,_0xa4e39f){return function(_0x24a620){if(_0x24a620){return _0x24a620['update'](_0x285136)[_0x49e2('0x29')](function(_0x3fbfe2){return _0x3fbfe2;});}return null;};}function removeEntity(_0x23d28e,_0x38e3d2){return function(_0x21421f){if(_0x21421f){return _0x21421f[_0x49e2('0x2a')]()[_0x49e2('0x29')](function(){_0x23d28e[_0x49e2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ecf98,_0x57eafd){return function(_0x5c8cef){if(!_0x5c8cef){_0x4ecf98[_0x49e2('0x2b')](0x194);}return _0x5c8cef;};}function handleError(_0x55310d,_0xc65a3f){_0xc65a3f=_0xc65a3f||0x1f4;return function(_0xc9485c){logger[_0x49e2('0x2c')](_0xc9485c[_0x49e2('0x2d')]);if(_0xc9485c[_0x49e2('0x2e')]){delete _0xc9485c[_0x49e2('0x2e')];}_0x55310d[_0x49e2('0x1e')](_0xc65a3f)[_0x49e2('0x2f')](_0xc9485c);};}exports[_0x49e2('0x30')]=function(_0x22f6d9,_0x46a206){var _0xb9d1d4={},_0x3d3184={},_0x451869={'count':0x0,'rows':[]};var _0x3a509b=_[_0x49e2('0x31')](db[_0x49e2('0x32')][_0x49e2('0x33')],function(_0x5d76ba){return{'name':_0x5d76ba[_0x49e2('0x34')],'type':_0x5d76ba['type'][_0x49e2('0x35')]};});_0x3d3184[_0x49e2('0x36')]=_[_0x49e2('0x31')](_0x3a509b,_0x49e2('0x2e'));_0x3d3184['query']=_['keys'](_0x22f6d9[_0x49e2('0x37')]);_0x3d3184['filters']=_['intersection'](_0x3d3184[_0x49e2('0x36')],_0x3d3184['query']);_0xb9d1d4[_0x49e2('0x38')]=_[_0x49e2('0x39')](_0x3d3184[_0x49e2('0x36')],qs[_0x49e2('0x3a')](_0x22f6d9[_0x49e2('0x37')][_0x49e2('0x3a')]));_0xb9d1d4[_0x49e2('0x38')]=_0xb9d1d4['attributes'][_0x49e2('0x3b')]?_0xb9d1d4['attributes']:_0x3d3184[_0x49e2('0x36')];if(!_0x22f6d9[_0x49e2('0x37')][_0x49e2('0x3c')](_0x49e2('0x3d'))){_0xb9d1d4[_0x49e2('0x22')]=qs[_0x49e2('0x22')](_0x22f6d9[_0x49e2('0x37')]['limit']);_0xb9d1d4[_0x49e2('0x20')]=qs[_0x49e2('0x20')](_0x22f6d9[_0x49e2('0x37')][_0x49e2('0x20')]);}_0xb9d1d4[_0x49e2('0x3e')]=qs['sort'](_0x22f6d9[_0x49e2('0x37')][_0x49e2('0x3f')]);_0xb9d1d4[_0x49e2('0x40')]=qs['filters'](_[_0x49e2('0x41')](_0x22f6d9[_0x49e2('0x37')],_0x3d3184[_0x49e2('0x42')]),_0x3a509b);if(_0x22f6d9['query'][_0x49e2('0x43')]){_0xb9d1d4['where']=_[_0x49e2('0x44')](_0xb9d1d4[_0x49e2('0x40')],{'$or':_[_0x49e2('0x31')](_0x3a509b,function(_0x3908c9){if(_0x3908c9[_0x49e2('0x45')]!==_0x49e2('0x46')){var _0x3bd9b6={};_0x3bd9b6[_0x3908c9['name']]={'$like':'%'+_0x22f6d9[_0x49e2('0x37')][_0x49e2('0x43')]+'%'};return _0x3bd9b6;}})});}_0xb9d1d4=_['merge']({},_0xb9d1d4,_0x22f6d9[_0x49e2('0x47')]);var _0x4f7d51={'where':_0xb9d1d4[_0x49e2('0x40')]};return db[_0x49e2('0x32')]['count'](_0x4f7d51)[_0x49e2('0x29')](function(_0x5a1325){_0x451869[_0x49e2('0x23')]=_0x5a1325;if(_0x22f6d9[_0x49e2('0x37')][_0x49e2('0x48')]){_0xb9d1d4['include']=[{'all':!![]}];}return db[_0x49e2('0x32')][_0x49e2('0x49')](_0xb9d1d4);})[_0x49e2('0x29')](function(_0x179c4a){_0x451869[_0x49e2('0x4a')]=_0x179c4a;return _0x451869;})[_0x49e2('0x29')](respondWithFilteredResult(_0x46a206,_0xb9d1d4))[_0x49e2('0x4b')](handleError(_0x46a206,null));};exports['show']=function(_0x2581df,_0x35e270){var _0x3c3ed8={'raw':!![],'where':{'id':_0x2581df[_0x49e2('0x4c')]['id']}},_0x5e3982={};_0x5e3982[_0x49e2('0x36')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x5e3982[_0x49e2('0x37')]=_[_0x49e2('0x4d')](_0x2581df[_0x49e2('0x37')]);_0x5e3982['filters']=_[_0x49e2('0x39')](_0x5e3982['model'],_0x5e3982[_0x49e2('0x37')]);_0x3c3ed8[_0x49e2('0x38')]=_[_0x49e2('0x39')](_0x5e3982[_0x49e2('0x36')],qs[_0x49e2('0x3a')](_0x2581df[_0x49e2('0x37')][_0x49e2('0x3a')]));_0x3c3ed8['attributes']=_0x3c3ed8[_0x49e2('0x38')][_0x49e2('0x3b')]?_0x3c3ed8[_0x49e2('0x38')]:_0x5e3982[_0x49e2('0x36')];if(_0x2581df[_0x49e2('0x37')][_0x49e2('0x48')]){_0x3c3ed8['include']=[{'all':!![]}];}_0x3c3ed8=_[_0x49e2('0x44')]({},_0x3c3ed8,_0x2581df[_0x49e2('0x47')]);return db[_0x49e2('0x32')]['find'](_0x3c3ed8)[_0x49e2('0x29')](handleEntityNotFound(_0x35e270,null))[_0x49e2('0x29')](respondWithResult(_0x35e270,null))['catch'](handleError(_0x35e270,null));};exports[_0x49e2('0x4e')]=function(_0x2b1fa5,_0x42d1a5){return db[_0x49e2('0x32')][_0x49e2('0x4e')](_0x2b1fa5[_0x49e2('0x4f')],{})['then'](respondWithResult(_0x42d1a5,0xc9))[_0x49e2('0x4b')](handleError(_0x42d1a5,null));};exports[_0x49e2('0x50')]=function(_0x4952a1,_0x51728a){if(_0x4952a1['body']['id']){delete _0x4952a1[_0x49e2('0x4f')]['id'];}return db['ChatGroup'][_0x49e2('0x51')]({'where':{'id':_0x4952a1[_0x49e2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51728a,null))[_0x49e2('0x29')](saveUpdates(_0x4952a1[_0x49e2('0x4f')],null))['then'](respondWithResult(_0x51728a,null))[_0x49e2('0x4b')](handleError(_0x51728a,null));};exports['destroy']=function(_0x4455f9,_0x3ca02a){return db[_0x49e2('0x32')][_0x49e2('0x51')]({'where':{'id':_0x4455f9[_0x49e2('0x4c')]['id']}})[_0x49e2('0x29')](handleEntityNotFound(_0x3ca02a,null))[_0x49e2('0x29')](removeEntity(_0x3ca02a,null))[_0x49e2('0x4b')](handleError(_0x3ca02a,null));};exports[_0x49e2('0x52')]=function(_0x49da45,_0x16098f){return db[_0x49e2('0x32')][_0x49e2('0x52')]()['then'](respondWithResult(_0x16098f,null))[_0x49e2('0x4b')](handleError(_0x16098f,null));};exports['getUnread']=function(_0xed5891,_0x11ecc4,_0x290ca6){return db[_0x49e2('0x53')][_0x49e2('0x23')]({'where':{'ChatGroupId':_0xed5891[_0x49e2('0x4c')]['id'],'ToId':_0xed5891[_0x49e2('0x54')]['id'],'read':![]}})['then'](function(_0x2be8cb){return{'id':_[_0x49e2('0x55')](_0xed5891[_0x49e2('0x4c')]['id']),'count':_0x2be8cb};})['then'](respondWithResult(_0x11ecc4,null))[_0x49e2('0x4b')](handleError(_0x11ecc4,null));};exports[_0x49e2('0x56')]=function(_0x358401,_0x259d0f,_0x3a8964){return db[_0x49e2('0x32')][_0x49e2('0x51')]({'where':{'id':_0x358401[_0x49e2('0x4c')]['id']}})[_0x49e2('0x29')](handleEntityNotFound(_0x259d0f,null))[_0x49e2('0x29')](function(_0xb1e186){if(_0xb1e186){return _0xb1e186['addMembers'](_0x358401[_0x49e2('0x4f')]['ids'],_[_0x49e2('0x57')](_0x358401['body'],['ids','id'])||{});}})[_0x49e2('0x29')](respondWithResult(_0x259d0f,null))[_0x49e2('0x4b')](handleError(_0x259d0f,null));};exports[_0x49e2('0x58')]=function(_0x98bbec,_0x1cdf66,_0x50addb){var _0x1063da={};var _0x219d60={};var _0x391c2b;var _0x5b4387;return db[_0x49e2('0x32')][_0x49e2('0x59')]({'where':{'id':_0x98bbec['params']['id']}})[_0x49e2('0x29')](handleEntityNotFound(_0x1cdf66,null))[_0x49e2('0x29')](function(_0x14304c){if(_0x14304c){_0x391c2b=_0x14304c;_0x219d60[_0x49e2('0x36')]=_[_0x49e2('0x4d')](db[_0x49e2('0x5a')]['rawAttributes']);_0x219d60['query']=_[_0x49e2('0x4d')](_0x98bbec[_0x49e2('0x37')]);_0x219d60[_0x49e2('0x42')]=_[_0x49e2('0x39')](_0x219d60['model'],_0x219d60[_0x49e2('0x37')]);_0x1063da[_0x49e2('0x38')]=_[_0x49e2('0x39')](_0x219d60[_0x49e2('0x36')],qs['fields'](_0x98bbec[_0x49e2('0x37')][_0x49e2('0x3a')]));_0x1063da['attributes']=_0x1063da['attributes'][_0x49e2('0x3b')]?_0x1063da[_0x49e2('0x38')]:_0x219d60[_0x49e2('0x36')];_0x1063da['order']=qs[_0x49e2('0x3f')](_0x98bbec['query']['sort']);_0x1063da[_0x49e2('0x40')]=qs['filters'](_[_0x49e2('0x41')](_0x98bbec[_0x49e2('0x37')],_0x219d60[_0x49e2('0x42')]));if(_0x98bbec['query'][_0x49e2('0x43')]){_0x1063da[_0x49e2('0x40')]=_[_0x49e2('0x44')](_0x1063da['where'],{'$or':_[_0x49e2('0x31')](_0x1063da['attributes'],function(_0x259a8d){var _0x49dfaf={};_0x49dfaf[_0x259a8d]={'$like':'%'+_0x98bbec[_0x49e2('0x37')][_0x49e2('0x43')]+'%'};return _0x49dfaf;})});}_0x1063da=_[_0x49e2('0x44')]({},_0x1063da,_0x98bbec['options']);return _0x391c2b[_0x49e2('0x58')](_0x1063da);}})['then'](function(_0x2eafa3){if(_0x2eafa3){_0x5b4387=_0x2eafa3[_0x49e2('0x3b')];if(!_0x98bbec[_0x49e2('0x37')][_0x49e2('0x3c')](_0x49e2('0x3d'))){_0x1063da[_0x49e2('0x22')]=qs[_0x49e2('0x22')](_0x98bbec[_0x49e2('0x37')][_0x49e2('0x22')]);_0x1063da[_0x49e2('0x20')]=qs['offset'](_0x98bbec[_0x49e2('0x37')][_0x49e2('0x20')]);}return _0x391c2b[_0x49e2('0x58')](_0x1063da);}})[_0x49e2('0x29')](function(_0x4a3789){if(_0x4a3789){return _0x4a3789?{'count':_0x5b4387,'rows':_0x4a3789}:null;}})[_0x49e2('0x29')](respondWithResult(_0x1cdf66,null))['catch'](handleError(_0x1cdf66,null));};exports[_0x49e2('0x5b')]=function(_0x401b26,_0xb9e28d,_0x4181c3){return db[_0x49e2('0x32')][_0x49e2('0x51')]({'where':{'id':_0x401b26[_0x49e2('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb9e28d,null))[_0x49e2('0x29')](function(_0x38b0ed){if(_0x38b0ed){return _0x38b0ed[_0x49e2('0x5b')](_0x401b26[_0x49e2('0x37')][_0x49e2('0x5c')]);}})[_0x49e2('0x29')](respondWithStatusCode(_0xb9e28d,null))['catch'](handleError(_0xb9e28d,null));};exports[_0x49e2('0x5d')]=function(_0x370767,_0x4d55d8,_0x3dea0e){if(_0x370767[_0x49e2('0x4f')]['id']){delete _0x370767[_0x49e2('0x4f')]['id'];}return db[_0x49e2('0x32')]['find']({'where':{'id':_0x370767[_0x49e2('0x4c')]['id']}})[_0x49e2('0x29')](handleEntityNotFound(_0x4d55d8,null))['then'](function(_0x11f8e4){if(_0x11f8e4){_0x370767[_0x49e2('0x4f')]['ChatGroupId']=_0x11f8e4['id'];return db[_0x49e2('0x53')][_0x49e2('0x4e')](_0x370767[_0x49e2('0x4f')]);}})[_0x49e2('0x29')](respondWithResult(_0x4d55d8,null))[_0x49e2('0x4b')](handleError(_0x4d55d8,null));};exports[_0x49e2('0x5e')]=function(_0x5e78c5,_0x60e143,_0x52e282){var _0x234f7e={};var _0x4ce826={};var _0xfca45c;var _0x3c43e4;return db[_0x49e2('0x32')][_0x49e2('0x59')]({'where':{'id':_0x5e78c5[_0x49e2('0x4c')]['id']}})[_0x49e2('0x29')](handleEntityNotFound(_0x60e143,null))[_0x49e2('0x29')](function(_0x41e7f4){if(_0x41e7f4){_0xfca45c=_0x41e7f4;_0x4ce826[_0x49e2('0x36')]=_['keys'](db[_0x49e2('0x53')]['rawAttributes']);_0x4ce826[_0x49e2('0x37')]=_['keys'](_0x5e78c5[_0x49e2('0x37')]);_0x4ce826[_0x49e2('0x42')]=_[_0x49e2('0x39')](_0x4ce826[_0x49e2('0x36')],_0x4ce826['query']);_0x234f7e[_0x49e2('0x38')]=_[_0x49e2('0x39')](_0x4ce826[_0x49e2('0x36')],qs[_0x49e2('0x3a')](_0x5e78c5[_0x49e2('0x37')][_0x49e2('0x3a')]));_0x234f7e['attributes']=_0x234f7e['attributes'][_0x49e2('0x3b')]?_0x234f7e[_0x49e2('0x38')]:_0x4ce826['model'];_0x234f7e[_0x49e2('0x3e')]=qs[_0x49e2('0x3f')](_0x5e78c5['query'][_0x49e2('0x3f')]);_0x234f7e[_0x49e2('0x40')]=qs['filters'](_[_0x49e2('0x41')](_0x5e78c5['query'],_0x4ce826[_0x49e2('0x42')]));if(_0x5e78c5['query']['filter']){_0x234f7e[_0x49e2('0x40')]=_[_0x49e2('0x44')](_0x234f7e[_0x49e2('0x40')],{'$or':_[_0x49e2('0x31')](_0x234f7e[_0x49e2('0x38')],function(_0x51a779){var _0x1c9bad={};_0x1c9bad[_0x51a779]={'$like':'%'+_0x5e78c5[_0x49e2('0x37')]['filter']+'%'};return _0x1c9bad;})});}if(_0x5e78c5[_0x49e2('0x37')]['$gte']){var _0x1b2846=_0x5e78c5[_0x49e2('0x37')]['$gte'][_0x49e2('0x5f')](',');var _0x50cc55={};_0x50cc55[_0x1b2846[0x0]]={'$gte':moment(_0x1b2846[0x1])[_0x49e2('0x60')](_0x49e2('0x61'))};_0x234f7e[_0x49e2('0x40')]=_[_0x49e2('0x44')](_0x234f7e[_0x49e2('0x40')],_0x50cc55);}_0x234f7e=_[_0x49e2('0x44')]({},_0x234f7e,_0x5e78c5[_0x49e2('0x47')]);return _0xfca45c[_0x49e2('0x5e')](_0x234f7e);}})['then'](function(_0x105db3){if(_0x105db3){_0x3c43e4=_0x105db3[_0x49e2('0x3b')];if(!_0x5e78c5[_0x49e2('0x37')][_0x49e2('0x3c')](_0x49e2('0x3d'))){_0x234f7e['limit']=qs[_0x49e2('0x22')](_0x5e78c5[_0x49e2('0x37')][_0x49e2('0x22')]);_0x234f7e[_0x49e2('0x20')]=qs[_0x49e2('0x20')](_0x5e78c5[_0x49e2('0x37')]['offset']);}return _0xfca45c['getMessages'](_0x234f7e);}})['then'](function(_0xcbc7d2){if(_0xcbc7d2){return _0xcbc7d2?{'count':_0x3c43e4,'rows':_0xcbc7d2}:null;}})[_0x49e2('0x29')](respondWithResult(_0x60e143,null))['catch'](handleError(_0x60e143,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 846c367..0f8b003 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 _0x8604=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x40b646,_0x17117c){var _0x5bf8d7=function(_0x19f098){while(--_0x19f098){_0x40b646['push'](_0x40b646['shift']());}};_0x5bf8d7(++_0x17117c);}(_0x8604,0x100));var _0x4860=function(_0x4d2d07,_0x59b3f6){_0x4d2d07=_0x4d2d07-0x0;var _0x5b3dd5=_0x8604[_0x4d2d07];return _0x5b3dd5;};'use strict';var EventEmitter=require(_0x4860('0x0'));var ChatGroup=require(_0x4860('0x1'))['db'][_0x4860('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x4860('0x3')](0x0);var events={'afterCreate':_0x4860('0x4'),'afterUpdate':_0x4860('0x5'),'afterDestroy':_0x4860('0x6')};function emitEvent(_0x53474a){return function(_0x13b1ad,_0x6c95b0,_0xb90d93){ChatGroupEvents[_0x4860('0x7')](_0x53474a+':'+_0x13b1ad['id'],_0x13b1ad);ChatGroupEvents['emit'](_0x53474a,_0x13b1ad);_0xb90d93(null);};}for(var e in events){if(events[_0x4860('0x8')](e)){var event=events[e];ChatGroup[_0x4860('0x9')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xc9d9=['events','ChatGroup','save','emit','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9d9,0x195));var _0x9c9d=function(_0x3cc9e2,_0x202f64){_0x3cc9e2=_0x3cc9e2-0x0;var _0x4c262b=_0xc9d9[_0x3cc9e2];return _0x4c262b;};'use strict';var EventEmitter=require(_0x9c9d('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x9c9d('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9c9d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xf59ceb){return function(_0x5b9a28,_0x585489,_0x4c0124){ChatGroupEvents[_0x9c9d('0x3')](_0xf59ceb+':'+_0x5b9a28['id'],_0x5b9a28);ChatGroupEvents[_0x9c9d('0x3')](_0xf59ceb,_0x5b9a28);_0x4c0124(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x9c9d('0x4')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 25b5c81..b8394a2 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 _0x051a=['exports','chat_groups','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes'];(function(_0x46621d,_0x2831e1){var _0x22453b=function(_0x3e803d){while(--_0x3e803d){_0x46621d['push'](_0x46621d['shift']());}};_0x22453b(++_0x2831e1);}(_0x051a,0x1d0));var _0xa051=function(_0x3b6ccf,_0x21c861){_0x3b6ccf=_0x3b6ccf-0x0;var _0x31ddca=_0x051a[_0x3b6ccf];return _0x31ddca;};'use strict';var _=require(_0xa051('0x0'));var util=require(_0xa051('0x1'));var logger=require('../../config/logger')(_0xa051('0x2'));var moment=require(_0xa051('0x3'));var BPromise=require(_0xa051('0x4'));var rp=require(_0xa051('0x5'));var fs=require('fs');var path=require(_0xa051('0x6'));var rimraf=require(_0xa051('0x7'));var config=require('../../config/environment');var attributes=require(_0xa051('0x8'));module[_0xa051('0x9')]=function(_0xc4fe38,_0x36a29b){return _0xc4fe38['define']('ChatGroup',attributes,{'tableName':_0xa051('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe646=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','lodash','../../config/logger'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe646,0x191));var _0x6e64=function(_0xd2aa3e,_0x47956c){_0xd2aa3e=_0xd2aa3e-0x0;var _0x486422=_0xe646[_0xd2aa3e];return _0x486422;};'use strict';var _=require(_0x6e64('0x0'));var util=require('util');var logger=require(_0x6e64('0x1'))(_0x6e64('0x2'));var moment=require(_0x6e64('0x3'));var BPromise=require(_0x6e64('0x4'));var rp=require(_0x6e64('0x5'));var fs=require('fs');var path=require(_0x6e64('0x6'));var rimraf=require(_0x6e64('0x7'));var config=require(_0x6e64('0x8'));var attributes=require('./chatGroup.attributes');module[_0x6e64('0x9')]=function(_0x47030b,_0x13a961){return _0x47030b[_0x6e64('0xa')](_0x6e64('0xb'),attributes,{'tableName':_0x6e64('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 5a6be6f..6100c74 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 _0x23d3=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x216692,_0x2c38c3){var _0x473c78=function(_0x468767){while(--_0x468767){_0x216692['push'](_0x216692['shift']());}};_0x473c78(++_0x2c38c3);}(_0x23d3,0xe8));var _0x323d=function(_0x18ae2a,_0x26e11f){_0x18ae2a=_0x18ae2a-0x0;var _0x5c8050=_0x23d3[_0x18ae2a];return _0x5c8050;};'use strict';var _=require(_0x323d('0x0'));var util=require(_0x323d('0x1'));var moment=require(_0x323d('0x2'));var BPromise=require('bluebird');var rs=require(_0x323d('0x3'));var fs=require('fs');var Redis=require(_0x323d('0x4'));var db=require(_0x323d('0x5'))['db'];var utils=require(_0x323d('0x6'));var logger=require(_0x323d('0x7'))(_0x323d('0x8'));var config=require('../../config/environment');var jayson=require(_0x323d('0x9'));var client=jayson[_0x323d('0xa')][_0x323d('0xb')]({'port':0x232a});config[_0x323d('0xc')]=_['defaults'](config[_0x323d('0xc')],{'host':_0x323d('0xd'),'port':0x18eb});var socket=require(_0x323d('0xe'))(new Redis(config['redis']));require(_0x323d('0xf'))[_0x323d('0x10')](socket);function respondWithRpcPromise(_0x55a1ef,_0x38cb86,_0x1b7cb0){return new BPromise(function(_0xed296d,_0xf11ce4){return client['request'](_0x55a1ef,_0x1b7cb0)[_0x323d('0x11')](function(_0x8843e0){logger[_0x323d('0x12')](_0x323d('0x13'),_0x38cb86,_0x323d('0x14'));logger[_0x323d('0x15')](_0x323d('0x16'),_0x38cb86,'request\x20sent',JSON[_0x323d('0x17')](_0x8843e0));if(_0x8843e0['error']){if(_0x8843e0[_0x323d('0x18')][_0x323d('0x19')]===0x1f4){logger[_0x323d('0x18')](_0x323d('0x13'),_0x38cb86,_0x8843e0[_0x323d('0x18')][_0x323d('0x1a')]);return _0xf11ce4(_0x8843e0[_0x323d('0x18')][_0x323d('0x1a')]);}logger[_0x323d('0x18')](_0x323d('0x13'),_0x38cb86,_0x8843e0[_0x323d('0x18')][_0x323d('0x1a')]);return _0xed296d(_0x8843e0[_0x323d('0x18')][_0x323d('0x1a')]);}else{logger['info'](_0x323d('0x13'),_0x38cb86,_0x323d('0x14'));_0xed296d(_0x8843e0[_0x323d('0x1b')][_0x323d('0x1a')]);}})[_0x323d('0x1c')](function(_0xf55afe){logger[_0x323d('0x18')]('ChatGroup,\x20%s,\x20%s',_0x38cb86,_0xf55afe);_0xf11ce4(_0xf55afe);});});} \ No newline at end of file +var _0x28a2=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','info'];(function(_0xc721f5,_0x42404b){var _0x1bc1bd=function(_0x2870fa){while(--_0x2870fa){_0xc721f5['push'](_0xc721f5['shift']());}};_0x1bc1bd(++_0x42404b);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var moment=require(_0x228a('0x2'));var BPromise=require(_0x228a('0x3'));var rs=require(_0x228a('0x4'));var fs=require('fs');var Redis=require(_0x228a('0x5'));var db=require(_0x228a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x228a('0x7'))('rpc');var config=require(_0x228a('0x8'));var jayson=require(_0x228a('0x9'));var client=jayson[_0x228a('0xa')][_0x228a('0xb')]({'port':0x232a});config[_0x228a('0xc')]=_['defaults'](config[_0x228a('0xc')],{'host':_0x228a('0xd'),'port':0x18eb});var socket=require(_0x228a('0xe'))(new Redis(config[_0x228a('0xc')]));require('./chatGroup.socket')[_0x228a('0xf')](socket);function respondWithRpcPromise(_0x44dec4,_0x3b20dd,_0x1cb14a){return new BPromise(function(_0x2ccb62,_0x36d5a6){return client[_0x228a('0x10')](_0x44dec4,_0x1cb14a)[_0x228a('0x11')](function(_0x5b74cb){logger['info']('ChatGroup,\x20%s,\x20%s',_0x3b20dd,_0x228a('0x12'));logger[_0x228a('0x13')](_0x228a('0x14'),_0x3b20dd,_0x228a('0x12'),JSON[_0x228a('0x15')](_0x5b74cb));if(_0x5b74cb['error']){if(_0x5b74cb[_0x228a('0x16')][_0x228a('0x17')]===0x1f4){logger[_0x228a('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3b20dd,_0x5b74cb['error'][_0x228a('0x18')]);return _0x36d5a6(_0x5b74cb[_0x228a('0x16')][_0x228a('0x18')]);}logger[_0x228a('0x16')](_0x228a('0x19'),_0x3b20dd,_0x5b74cb[_0x228a('0x16')][_0x228a('0x18')]);return _0x2ccb62(_0x5b74cb[_0x228a('0x16')]['message']);}else{logger[_0x228a('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x3b20dd,_0x228a('0x12'));_0x2ccb62(_0x5b74cb[_0x228a('0x1b')][_0x228a('0x18')]);}})[_0x228a('0x1c')](function(_0x492595){logger['error'](_0x228a('0x19'),_0x3b20dd,_0x492595);_0x36d5a6(_0x492595);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 53aad13..5c5be77 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 _0xb407=['remove','emit','length','chatGroup:','./chatGroup.events','save'];(function(_0x2f0dfa,_0x54a5bc){var _0x4f3f77=function(_0x422ca0){while(--_0x422ca0){_0x2f0dfa['push'](_0x2f0dfa['shift']());}};_0x4f3f77(++_0x54a5bc);}(_0xb407,0x172));var _0x7b40=function(_0x1c8a82,_0x11433f){_0x1c8a82=_0x1c8a82-0x0;var _0x35d1d3=_0xb407[_0x1c8a82];return _0x35d1d3;};'use strict';var ChatGroupEvents=require(_0x7b40('0x0'));var events=[_0x7b40('0x1'),_0x7b40('0x2'),'update'];function createListener(_0x28313f,_0x4bfae5){return function(_0x2a6353){_0x4bfae5[_0x7b40('0x3')](_0x28313f,_0x2a6353);};}function removeListener(_0x9e5705,_0x5283b5){return function(){ChatGroupEvents['removeListener'](_0x9e5705,_0x5283b5);};}exports['register']=function(_0x59d5cc){for(var _0x29bbee=0x0,_0x18ce05=events[_0x7b40('0x4')];_0x29bbee<_0x18ce05;_0x29bbee++){var _0x12363e=events[_0x29bbee];var _0x12033b=createListener(_0x7b40('0x5')+_0x12363e,_0x59d5cc);ChatGroupEvents['on'](_0x12363e,_0x12033b);}}; \ No newline at end of file +var _0x1c89=['save','remove','update','emit','register','chatGroup:'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x1c89,0x15c));var _0x91c8=function(_0x272fa4,_0xf712d1){_0x272fa4=_0x272fa4-0x0;var _0x25ec85=_0x1c89[_0x272fa4];return _0x25ec85;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x91c8('0x0'),_0x91c8('0x1'),_0x91c8('0x2')];function createListener(_0x415146,_0xced581){return function(_0x33613b){_0xced581[_0x91c8('0x3')](_0x415146,_0x33613b);};}function removeListener(_0x40fced,_0x28a048){return function(){ChatGroupEvents['removeListener'](_0x40fced,_0x28a048);};}exports[_0x91c8('0x4')]=function(_0x22b268){for(var _0x59e9cd=0x0,_0x3075ba=events['length'];_0x59e9cd<_0x3075ba;_0x59e9cd++){var _0xce0752=events[_0x59e9cd];var _0x7b2609=createListener(_0x91c8('0x5')+_0xce0752,_0x22b268);ChatGroupEvents['on'](_0xce0752,_0x7b2609);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ad877fa..70a3a96 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 _0xd0a5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xd0a5,0xf2));var _0x5d0a=function(_0x201609,_0x3c51a7){_0x201609=_0x201609-0x0;var _0x10b655=_0xd0a5[_0x201609];return _0x10b655;};'use strict';var multer=require(_0x5d0a('0x0'));var util=require('util');var path=require(_0x5d0a('0x1'));var timeout=require(_0x5d0a('0x2'));var express=require(_0x5d0a('0x3'));var router=express[_0x5d0a('0x4')]();var fs_extra=require(_0x5d0a('0x5'));var auth=require(_0x5d0a('0x6'));var interaction=require(_0x5d0a('0x7'));var config=require(_0x5d0a('0x8'));var controller=require(_0x5d0a('0x9'));router[_0x5d0a('0xa')]('/',auth[_0x5d0a('0xb')](),controller[_0x5d0a('0xc')]);router[_0x5d0a('0xa')](_0x5d0a('0xd'),auth[_0x5d0a('0xb')](),controller[_0x5d0a('0xe')]);router[_0x5d0a('0xa')](_0x5d0a('0xf'),auth['isAuthenticated'](),controller[_0x5d0a('0x10')]);router[_0x5d0a('0xa')](_0x5d0a('0x11'),auth[_0x5d0a('0xb')](),controller[_0x5d0a('0x12')]);router[_0x5d0a('0xa')](_0x5d0a('0x13'),auth[_0x5d0a('0xb')](),controller['getMembers']);router[_0x5d0a('0xa')](_0x5d0a('0x14'),auth['isAuthenticated'](),controller[_0x5d0a('0x15')]);router[_0x5d0a('0x16')]('/',auth[_0x5d0a('0xb')](),controller[_0x5d0a('0x17')]);router['post'](_0x5d0a('0x13'),auth['isAuthenticated'](),controller[_0x5d0a('0x18')]);router[_0x5d0a('0x16')](_0x5d0a('0x14'),auth[_0x5d0a('0xb')](),controller[_0x5d0a('0x19')]);router[_0x5d0a('0x1a')](_0x5d0a('0xf'),auth[_0x5d0a('0xb')](),controller[_0x5d0a('0x1b')]);router[_0x5d0a('0x1c')](_0x5d0a('0xf'),auth[_0x5d0a('0xb')](),controller[_0x5d0a('0x1d')]);router['delete'](_0x5d0a('0x13'),auth[_0x5d0a('0xb')](),controller['removeMembers']);module[_0x5d0a('0x1e')]=router; \ No newline at end of file +var _0x6f65=['/:id/unread','getUnread','/:id/members','getMessages','create','post','addMembers','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6f65,0xbd));var _0x56f6=function(_0x5013c5,_0x56339e){_0x5013c5=_0x5013c5-0x0;var _0x231783=_0x6f65[_0x5013c5];return _0x231783;};'use strict';var multer=require(_0x56f6('0x0'));var util=require(_0x56f6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56f6('0x2'));var router=express[_0x56f6('0x3')]();var fs_extra=require(_0x56f6('0x4'));var auth=require(_0x56f6('0x5'));var interaction=require(_0x56f6('0x6'));var config=require(_0x56f6('0x7'));var controller=require(_0x56f6('0x8'));router[_0x56f6('0x9')]('/',auth[_0x56f6('0xa')](),controller['index']);router[_0x56f6('0x9')](_0x56f6('0xb'),auth[_0x56f6('0xa')](),controller[_0x56f6('0xc')]);router[_0x56f6('0x9')](_0x56f6('0xd'),auth[_0x56f6('0xa')](),controller['show']);router['get'](_0x56f6('0xe'),auth[_0x56f6('0xa')](),controller[_0x56f6('0xf')]);router[_0x56f6('0x9')](_0x56f6('0x10'),auth[_0x56f6('0xa')](),controller['getMembers']);router[_0x56f6('0x9')]('/:id/messages',auth[_0x56f6('0xa')](),controller[_0x56f6('0x11')]);router['post']('/',auth[_0x56f6('0xa')](),controller[_0x56f6('0x12')]);router[_0x56f6('0x13')](_0x56f6('0x10'),auth['isAuthenticated'](),controller[_0x56f6('0x14')]);router['post'](_0x56f6('0x15'),auth[_0x56f6('0xa')](),controller[_0x56f6('0x16')]);router[_0x56f6('0x17')](_0x56f6('0xd'),auth[_0x56f6('0xa')](),controller[_0x56f6('0x18')]);router[_0x56f6('0x19')]('/:id',auth[_0x56f6('0xa')](),controller[_0x56f6('0x1a')]);router['delete'](_0x56f6('0x10'),auth[_0x56f6('0xa')](),controller[_0x56f6('0x1b')]);module[_0x56f6('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6823338..84154cc 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 _0x6b24=['long','DATE','out','exports','BOOLEAN','INTEGER','ENUM','TEXT','STRING'];(function(_0x5c4407,_0x4977c8){var _0x535a36=function(_0x3cf8ec){while(--_0x3cf8ec){_0x5c4407['push'](_0x5c4407['shift']());}};_0x535a36(++_0x4977c8);}(_0x6b24,0x1ce));var _0x46b2=function(_0x687ce7,_0x39db4f){_0x687ce7=_0x687ce7-0x0;var _0x8bb835=_0x6b24[_0x687ce7];return _0x8bb835;};'use strict';var Sequelize=require('sequelize');module[_0x46b2('0x0')]={'closed':{'type':Sequelize[_0x46b2('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x46b2('0x2')]},'ratingType':{'type':Sequelize[_0x46b2('0x3')]('star','thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x46b2('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x46b2('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x46b2('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x46b2('0x5')]},'browserName':{'type':Sequelize[_0x46b2('0x5')]},'browserVersion':{'type':Sequelize[_0x46b2('0x5')]},'osName':{'type':Sequelize[_0x46b2('0x5')]},'osVersion':{'type':Sequelize[_0x46b2('0x5')]},'deviceModel':{'type':Sequelize[_0x46b2('0x5')]},'deviceVendor':{'type':Sequelize[_0x46b2('0x5')]},'deviceType':{'type':Sequelize[_0x46b2('0x5')]},'referer':{'type':Sequelize[_0x46b2('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x46b2('0x6'))},'read1stAt':{'type':Sequelize[_0x46b2('0x7')]},'lastMsgAt':{'type':Sequelize[_0x46b2('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x46b2('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x46b2('0x5')]},'customerPort':{'type':Sequelize[_0x46b2('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x46b2('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x087b=['star','TEXT','STRING','DATE','long','out','BOOLEAN','sequelize','exports','ENUM','thumb'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x087b,0x11a));var _0xb087=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x087b[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xb087('0x2')]('star',_0xb087('0x3')),'defaultValue':_0xb087('0x4')},'ratingMessage':{'type':Sequelize[_0xb087('0x5')]},'pathTranscript':{'type':Sequelize[_0xb087('0x5')]},'mailTranscript':{'type':Sequelize[_0xb087('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb087('0x7')]},'disposition':{'type':Sequelize[_0xb087('0x6')]},'secondDisposition':{'type':Sequelize[_0xb087('0x6')]},'thirdDisposition':{'type':Sequelize[_0xb087('0x6')]},'note':{'type':Sequelize[_0xb087('0x6')]},'browserName':{'type':Sequelize[_0xb087('0x6')]},'browserVersion':{'type':Sequelize[_0xb087('0x6')]},'osName':{'type':Sequelize[_0xb087('0x6')]},'osVersion':{'type':Sequelize[_0xb087('0x6')]},'deviceModel':{'type':Sequelize[_0xb087('0x6')]},'deviceVendor':{'type':Sequelize[_0xb087('0x6')]},'deviceType':{'type':Sequelize[_0xb087('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xb087('0x6')]},'formData':{'type':Sequelize[_0xb087('0x5')](_0xb087('0x8'))},'read1stAt':{'type':Sequelize[_0xb087('0x7')]},'lastMsgAt':{'type':Sequelize[_0xb087('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xb087('0x2')]('in',_0xb087('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xb087('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xb087('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xb087('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index eb34ef7..fc80ffc 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 _0xb10b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','stack','name','send','body','contact','interaction','account','Users','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','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','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','some','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','catch','show','params','keys','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','close','mailTranscript','root','now','Messages','format','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','split','YYYY-MM-DD\x20HH:mm:ss','includeAgent','alias','findAll','setTags','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','disposition','osName','referer','customerPort','tail','existsSync','pipe','createWriteStream','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x73e4cf,_0x2a8375){var _0x1e1bf8=function(_0xca0967){while(--_0xca0967){_0x73e4cf['push'](_0x73e4cf['shift']());}};_0x1e1bf8(++_0x2a8375);}(_0xb10b,0x12a));var _0xbb10=function(_0x45fe79,_0x23a48b){_0x45fe79=_0x45fe79-0x0;var _0x23720c=_0xb10b[_0x45fe79];return _0x23720c;};'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 pdf=require(_0xbb10('0x13'));var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))('api');var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb10('0x17'));var db=require(_0xbb10('0x18'))['db'];config[_0xbb10('0x19')]=_[_0xbb10('0x1a')](config[_0xbb10('0x19')],{'host':_0xbb10('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb10('0x19')]));require(_0xbb10('0x1c'))[_0xbb10('0x1d')](socket);var jayson=require(_0xbb10('0x1e'));var client=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232b});var client9004=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3e26f4,_0x2b184e,_0x4a2bfc,_0x2eca0f){return new BPromise(function(_0x1145f1,_0x133ac2){var _0x42db98=_0x2eca0f||client;return _0x42db98[_0xbb10('0x21')](_0x3e26f4,_0x4a2bfc)[_0xbb10('0x22')](function(_0x575cca){logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));logger['debug'](_0xbb10('0x26'),_0x2b184e,_0xbb10('0x25'),JSON[_0xbb10('0x27')](_0x575cca));if(_0x575cca[_0xbb10('0x28')]){if(_0x575cca[_0xbb10('0x28')][_0xbb10('0x29')]===0x1f4){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')]['message']);return _0x133ac2(_0x575cca['error'][_0xbb10('0x2a')]);}logger[_0xbb10('0x28')](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);return _0x1145f1(_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);}else{logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));_0x1145f1(_0x575cca[_0xbb10('0x2b')][_0xbb10('0x2a')]);}})['catch'](function(_0x4fedac){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x4fedac);_0x133ac2(_0x4fedac);});});}function respondWithStatusCode(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0xcc;return function(_0x4e25ff){if(_0x4e25ff){return _0x3c5ae7[_0xbb10('0x2c')](_0x2c89b9);}return _0x3c5ae7[_0xbb10('0x2d')](_0x2c89b9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xc8;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9)['json'](_0x20d946);}};}function respondWithFilteredResult(_0x3796c7,_0x21ac54){return function(_0xfc3595){if(_0xfc3595){var _0x2e0249=typeof _0x21ac54[_0xbb10('0x2f')]===_0xbb10('0x30')&&typeof _0x21ac54['limit']===_0xbb10('0x30');var _0x4ee02e=_0xfc3595[_0xbb10('0x31')];var _0x56f2da=_0x2e0249?0x0:_0x21ac54[_0xbb10('0x2f')];var _0x1dcc9c=_0x2e0249?_0xfc3595[_0xbb10('0x31')]:_0x21ac54['offset']+_0x21ac54['limit'];var _0x4c3744;if(_0x1dcc9c>=_0x4ee02e){_0x1dcc9c=_0x4ee02e;_0x4c3744=0xc8;}else{_0x4c3744=0xce;}_0x3796c7[_0xbb10('0x2d')](_0x4c3744);return _0x3796c7['set'](_0xbb10('0x32'),_0x56f2da+'-'+_0x1dcc9c+'/'+_0x4ee02e)[_0xbb10('0x33')](_0xfc3595);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x22')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x22')](function(){_0x188cbd[_0xbb10('0x2d')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x28')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}function getMustacheRender(_0x25d72f,_0x52de31){return Mustache['render'](_0x25d72f,_['merge'](_0x52de31[_0xbb10('0x3a')],{'contact':_0x52de31[_0xbb10('0x3b')],'message':_0x52de31[_0xbb10('0x2a')],'agent':_0x52de31['agent'],'interaction':_0x52de31[_0xbb10('0x3c')],'account':_0x52de31[_0xbb10('0x3d')]}))||'';}function getInteractionUsers(_0x4345f3,_0x4d1a83){return new BPromise(function(_0x17b6c5,_0x12238a){try{if(_0x4d1a83[_0x4345f3['id']]){_0x4345f3[_0xbb10('0x3e')]=_[_0xbb10('0x3f')](_0x4d1a83[_0x4345f3['id']],function(_0x4f1cdd){return{'id':_0x4f1cdd['id'],'fullname':_0x4f1cdd[_0xbb10('0x40')]};});}}catch(_0x110eb5){_0x12238a(_0x110eb5);}_0x17b6c5(_0x4345f3);});}function getInteractionTags(_0x5835fd,_0xe2040f){return new BPromise(function(_0x2e3214,_0x44d6ae){try{if(_0x5835fd[_0xbb10('0x41')]){_0x5835fd[_0xbb10('0x42')]=[];_0x5835fd[_0xbb10('0x41')]['split'](',')[_0xbb10('0x43')](function(_0x1c7fae){_0x5835fd[_0xbb10('0x42')][_0xbb10('0x44')](_0xe2040f[_0x1c7fae]);});}delete _0x5835fd['TagIds'];}catch(_0x3fff6c){_0x44d6ae(_0x3fff6c);}_0x2e3214(_0x5835fd);});}function updateChatInteraction(_0x331751,_0x23dc18,_0x403beb){return new BPromise(function(_0x5e2cfa,_0x351484){return getInteractionUsers(_0x331751,_0x403beb)[_0xbb10('0x22')](function(_0x54ac18){return getInteractionTags(_0x54ac18,_0x23dc18);})['then'](function(_0x38d78f){_0x5e2cfa(_0x38d78f);})['catch'](function(_0x318984){_0x351484(_0x318984);});});}exports[_0xbb10('0x45')]=function(_0x4c66d8,_0x366608){var _0x1d82bf={},_0x474e99={},_0x5cf4f8={'count':0x0,'rows':[]};var _0x2dd02b=_[_0xbb10('0x3f')](db[_0xbb10('0x46')][_0xbb10('0x47')],function(_0x36e1fa){return{'name':_0x36e1fa[_0xbb10('0x48')],'type':_0x36e1fa[_0xbb10('0x49')][_0xbb10('0x4a')]};});_0x474e99[_0xbb10('0x4b')]=_[_0xbb10('0x3f')](_0x2dd02b,_0xbb10('0x38'));_0x474e99[_0xbb10('0x4c')]=_['keys'](_0x4c66d8[_0xbb10('0x4c')]);_0x474e99[_0xbb10('0x4d')]=_['intersection'](_0x474e99[_0xbb10('0x4b')],_0x474e99[_0xbb10('0x4c')]);_0x1d82bf[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x474e99[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4c66d8[_0xbb10('0x4c')]['fields']));_0x1d82bf['attributes']=_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x51')]?_0x1d82bf[_0xbb10('0x4e')]:_0x474e99['model'];if(!_0x4c66d8['query'][_0xbb10('0x52')](_0xbb10('0x53'))){_0x1d82bf[_0xbb10('0x54')]=qs[_0xbb10('0x54')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x1d82bf[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x1d82bf['order']=qs['sort'](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x1d82bf[_0xbb10('0x56')]=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x4c66d8[_0xbb10('0x4c')],_0x474e99[_0xbb10('0x4d')]),_0x2dd02b);var _0x445870=[];var _0x1c0d8f=squel[_0xbb10('0x58')]()[_0xbb10('0x59')]('id')[_0xbb10('0x59')](_0xbb10('0x38'))[_0xbb10('0x59')](_0xbb10('0x5a'))['from'](_0xbb10('0x5b'));var _0x5bd44d=squel[_0xbb10('0x58')]()[_0xbb10('0x59')](_0xbb10('0x5c'))[_0xbb10('0x59')](_0xbb10('0x5d'))[_0xbb10('0x59')](_0xbb10('0x5e'))[_0xbb10('0x5f')](_0xbb10('0x60'),'ui')[_0xbb10('0x61')](_0xbb10('0x62'),'u',_0xbb10('0x63'));var _0x1d49e1=squel[_0xbb10('0x58')]()[_0xbb10('0x5f')]('chat_interactions','i')[_0xbb10('0x61')](_0xbb10('0x64'),'c',_0xbb10('0x65'))[_0xbb10('0x61')](_0xbb10('0x62'),'o',_0xbb10('0x66'))['left_join'](_0xbb10('0x67'),'a',_0xbb10('0x68'))[_0xbb10('0x61')](_0xbb10('0x69'),'me',_0xbb10('0x6a'))[_0xbb10('0x61')](_0xbb10('0x6b'),'it',_0xbb10('0x6c'))[_0xbb10('0x61')](_0xbb10('0x5b'),'t',_0xbb10('0x6d'));var _0x2a1ce1=squel[_0xbb10('0x6e')]();var _0x4e7fac=[];var _0x4ea1a6=squel[_0xbb10('0x6e')]();var _0x3e6338;if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x6f')]){_0x3e6338=as['parseSearch'](_0x4c66d8['query'][_0xbb10('0x6f')]);var _0xaf2cc3=_0x3e6338[_0xbb10('0x70')];for(var _0x2dd150=0x0;_0x2dd150<_0x3e6338[_0xbb10('0x71')][_0xbb10('0x51')];_0x2dd150++){var _0x45c0dc=_0x3e6338['conditions'][_0x2dd150];var _0x117e84='i';var _0x216cff=_['find'](_0x2dd02b,['name',_0x45c0dc['field']]);if(!_0x216cff){switch(_0x45c0dc[_0xbb10('0x59')]){case _0xbb10('0x72'):if(_0x45c0dc[_0xbb10('0x73')]==0x1){_0x1d49e1['having']('`'+_0x45c0dc['field']+'`\x20=\x200');}else{_0x1d49e1[_0xbb10('0x74')]('`'+_0x45c0dc[_0xbb10('0x59')]+_0xbb10('0x75'));}break;case'Contact':if(_0x45c0dc[_0xbb10('0x76')]===_0xbb10('0x77')){if(_0x45c0dc['value']['split']('\x20')[_0xbb10('0x51')]>0x1){_0x2a1ce1[_0xaf2cc3](_0xbb10('0x78'),qs[_0xbb10('0x79')](_0x45c0dc[_0xbb10('0x73')]),null);}else{var _0x54b7c5='%'+_0x45c0dc[_0xbb10('0x73')]+'%';_0x2a1ce1[_0xaf2cc3](_0xbb10('0x7a'),_0x54b7c5,_0x54b7c5,_0x54b7c5);}}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,['name',_0xbb10('0x7c')]);_0x45c0dc[_0xbb10('0x59')]=_0xbb10('0x7c');_0x329da7=as['buildExpression'](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x7f'):var _0x108e5b=_0x45c0dc[_0xbb10('0x73')]['split'](',')[_0xbb10('0x3f')](function(_0x277fe7){return Number(_0x277fe7);});_0x108e5b[_0xbb10('0x43')](function(_0x2ceb3e){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x2ceb3e+',%');});_0x4e7fac=_[_0xbb10('0x81')](_0x4e7fac,_0x108e5b);break;case _0xbb10('0x82'):if(_0x45c0dc['operator']==='$substring'){_0x2a1ce1[_0xaf2cc3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x45c0dc[_0xbb10('0x73')]+'%',null);}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,[_0xbb10('0x38'),'UserId']);_0x45c0dc['field']=_0xbb10('0x83');_0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x3a'):_0x329da7=as[_0xbb10('0x84')]('me',null,_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')]['start'],_0x329da7['value']['end']);break;}}else{var _0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}}}else{var _0x4bc316=_(_0x4c66d8['query'])['keys']()[_0xbb10('0x3f')](function(_0x13040d){return _[_0xbb10('0x85')](_0x2dd02b,[_0xbb10('0x38'),_0x13040d])?_0x13040d:undefined;})['compact']()[_0xbb10('0x73')]();if(!_['isEmpty'](_0x4bc316)){_0x4bc316['forEach'](function(_0x165fe9){if(_0x165fe9===_0xbb10('0x86')){_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),[][_0xbb10('0x88')](_0x4c66d8['query'][_0x165fe9]));}else if(_0x165fe9===_0xbb10('0x89')){var _0x19fcec=JSON[_0xbb10('0x8a')](_0x4c66d8[_0xbb10('0x4c')][_0x165fe9])[_0xbb10('0x8b')];var _0x27f42f=JSON[_0xbb10('0x8a')](_0x4c66d8['query'][_0x165fe9])[_0xbb10('0x8c')];_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x8d'),_0x19fcec,_0x27f42f);}else{if(_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]===_0xbb10('0x8e')){_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+_0xbb10('0x8f'));}else{_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+'\x20=\x20?',_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]);}}});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x90')]){if(_0x4c66d8['query']['read']==0x1){_0x1d49e1['having'](_0xbb10('0x91'));}else{_0x1d49e1['having']('`unreadMessages`\x20>\x200');}}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]){_0x4e7fac=_[_0xbb10('0x93')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')])?_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]:new Array(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]);_0x4e7fac['forEach'](function(_0x318a14){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x318a14+',%');});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x94')]){var _0x5c8eb8=_0x4c66d8['query'][_0xbb10('0x94')][_0xbb10('0x95')]('\x5c','\x5c\x5c')[_0xbb10('0x95')](/'/g,'\x27\x27');if(qs[_0xbb10('0x96')](_0x5c8eb8)){_0x2a1ce1['or']('i.id\x20LIKE\x20?',_0x5c8eb8+'%');}else{_0x2a1ce1['or'](_0xbb10('0x97'),qs[_0xbb10('0x79')](_0x5c8eb8))['or'](_0xbb10('0x98'),_0x5c8eb8+'%');}}}_0x1d49e1[_0xbb10('0x56')](_0x2a1ce1);_0x1d49e1[_0xbb10('0x99')]('i.id');var _0x5f0691={'type':db[_0xbb10('0x9a')][_0xbb10('0x9b')][_0xbb10('0x9c')],'raw':!![]};var _0x5239da=_0x1d49e1[_0xbb10('0x9d')]();_0x5239da[_0xbb10('0x59')]('i.id');_0x5239da['field'](_0xbb10('0x9e'),_0xbb10('0x72'));if(_0x1d82bf[_0xbb10('0x9f')]){_0x1d82bf['order'][_0xbb10('0x43')](function(_0x3a17fc){var _0xfbb365=_0x3a17fc[0x0]===_0xbb10('0xa0')?_0x3a17fc[0x0]:'i.'+_0x3a17fc[0x0];_0x1d49e1[_0xbb10('0x9f')](_0xfbb365,_0x3a17fc[0x1]===_0xbb10('0xa1')?![]:!![]);});}if(!_[_0xbb10('0xa2')](_0x4e7fac)){_0x1d49e1[_0xbb10('0x74')](_0x4ea1a6);_0x5239da[_0xbb10('0x56')]('t.id\x20IN\x20?',_0x4e7fac);}BPromise[_0xbb10('0xa3')]()[_0xbb10('0x22')](function(){if(!_0x3e6338){if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x86')])return;_0x5239da[_0xbb10('0x56')](_0xbb10('0xa4'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0xa4'));return;}if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]!==_0xbb10('0xa7'))return;return _0x4c66d8[_0xbb10('0xa5')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0xe1fc51){if(_[_0xbb10('0xa2')](_0xe1fc51)){_0x5239da[_0xbb10('0x56')](_0xbb10('0xa8'));_0x1d49e1[_0xbb10('0x56')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x5239da[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));}});})['then'](function(){if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]==='agent'&&!_0x3e6338&&!_0x4c66d8[_0xbb10('0x4c')]['ChatWebsiteId'])return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5239da[_0xbb10('0xaa')](),_0x5f0691);})[_0xbb10('0x22')](function(_0x3a4a6e){_0x5cf4f8['count']=_0x3a4a6e[_0xbb10('0x51')];if(_0x5cf4f8['count']===0x0)return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x1c0d8f['toString'](),_0x5f0691)['then'](function(_0x415407){_0x445870=_[_0xbb10('0xab')](_0x415407,'id');_0x5f0691=_[_0xbb10('0xac')](_0x5f0691,{'model':db[_0xbb10('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x50')]){_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x43')](function(_0x252ab8){_0x1d49e1[_0xbb10('0x59')]('i.'+_0x252ab8);});}else{_0x1d49e1[_0xbb10('0x59')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbb10('0x72'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xad'),_0xbb10('0xae'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xaf'),_0xbb10('0xb0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb1'),_0xbb10('0xa0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb2'));_0x1d49e1['field'](_0xbb10('0xb3'),'Contact.firstName');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb4'),_0xbb10('0xb5'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb6'),'Contact.email');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb7'),_0xbb10('0xb8'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb9'),_0xbb10('0xba'));_0x1d49e1['field']('c.fax',_0xbb10('0xbb'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbc'),'Owner.fullname');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbd'),'Owner.internal');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbe'),'TagIds');}if(_0x1d82bf[_0xbb10('0x54')])_0x1d49e1['limit'](_0x1d82bf[_0xbb10('0x54')]);if(_0x1d82bf[_0xbb10('0x2f')])_0x1d49e1['offset'](_0x1d82bf[_0xbb10('0x2f')]);return db[_0xbb10('0xa9')]['query'](_0x1d49e1['toString'](),_0x5f0691);})[_0xbb10('0x22')](function(_0x13ae83){if(_0x13ae83[_0xbb10('0x51')]>0x0)_0x5bd44d[_0xbb10('0x56')](_0xbb10('0xbf'),_['map'](_0x13ae83,'id'));return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5bd44d[_0xbb10('0xaa')](),_0x5f0691)['then'](function(_0xd68afa){var _0x4f90e6=_[_0xbb10('0xc0')](_0xd68afa,_0xbb10('0xc1'));var _0x44a3e1=[];_0x13ae83[_0xbb10('0x43')](function(_0x1f55d3){_0x44a3e1[_0xbb10('0x44')](updateChatInteraction(_0x1f55d3,_0x445870,_0x4f90e6));});return BPromise[_0xbb10('0xc2')](_0x44a3e1);});});})['then'](function(_0x4fc544){_0x5cf4f8[_0xbb10('0xc3')]=_0x4fc544;return _0x5cf4f8;})[_0xbb10('0x22')](respondWithFilteredResult(_0x366608,_0x1d82bf))[_0xbb10('0xc4')](handleError(_0x366608,null));};exports[_0xbb10('0xc5')]=function(_0x20b585,_0x363b81){var _0x1cccec={'raw':![],'where':{'id':_0x20b585[_0xbb10('0xc6')]['id']}},_0x1674f7={};_0x1674f7[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db[_0xbb10('0x46')][_0xbb10('0x47')]);_0x1674f7['query']=_[_0xbb10('0xc7')](_0x20b585[_0xbb10('0x4c')]);_0x1674f7[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],_0x1674f7[_0xbb10('0x4c')]);_0x1cccec[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x20b585[_0xbb10('0x4c')]['fields']));_0x1cccec[_0xbb10('0x4e')]=_0x1cccec['attributes'][_0xbb10('0x51')]?_0x1cccec[_0xbb10('0x4e')]:_0x1674f7[_0xbb10('0x4b')];if(_0x20b585[_0xbb10('0x4c')][_0xbb10('0xc8')]){_0x1cccec[_0xbb10('0xc9')]=[{'all':!![]}];}_0x1cccec=_['merge']({},_0x1cccec,_0x20b585[_0xbb10('0xca')]);return db['ChatInteraction'][_0xbb10('0x7b')](_0x1cccec)[_0xbb10('0x22')](handleEntityNotFound(_0x363b81,null))[_0xbb10('0x22')](respondWithResult(_0x363b81,null))[_0xbb10('0xc4')](handleError(_0x363b81,null));};exports[_0xbb10('0xcb')]=function(_0x31907e,_0x4f06c){return db[_0xbb10('0x46')][_0xbb10('0xcb')](_0x31907e[_0xbb10('0x3a')],{})[_0xbb10('0x22')](respondWithResult(_0x4f06c,0xc9))[_0xbb10('0xc4')](handleError(_0x4f06c,null));};exports['update']=function(_0x3696b3,_0x516520){if(_0x3696b3[_0xbb10('0x3a')]['id']){delete _0x3696b3[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x3696b3[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x516520,null))[_0xbb10('0x22')](saveUpdates(_0x3696b3['body'],null))[_0xbb10('0x22')](respondWithResult(_0x516520,null))['catch'](handleError(_0x516520,null));};exports['destroy']=function(_0x1513e0,_0x35cbb9){return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x1513e0[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x35cbb9,null))['then'](removeEntity(_0x35cbb9,null))[_0xbb10('0xc4')](handleError(_0x35cbb9,null));};exports[_0xbb10('0xcc')]=function(_0x39aa9e,_0xb1b7c8){return db[_0xbb10('0x46')][_0xbb10('0xcc')]()['then'](respondWithResult(_0xb1b7c8,null))[_0xbb10('0xc4')](handleError(_0xb1b7c8,null));};exports[_0xbb10('0xcd')]=function(_0xb7c454,_0xa8b7c3){var _0x31718f=_0xb7c454[_0xbb10('0xc6')]['id'];var _0x2764e1;var _0x5e405b;var _0x33a43e;return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x31718f}})['then'](function(_0x4c8b68){_0x2764e1=_0x4c8b68;return db[_0xbb10('0xcf')][_0xbb10('0xce')]({'where':{'id':_0x4c8b68[_0xbb10('0x86')]},'attributes':['id',_0xbb10('0xd0'),_0xbb10('0xd1'),'vidaooTopic',_0xbb10('0xd2'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x4dd138){if(_0x4dd138&&_0x4dd138[_0xbb10('0xd0')]&&_0x4dd138[_0xbb10('0xd1')]){_0x5e405b=_0x4dd138;var _0x1b9012={'interaction':{'id':_0x31718f},'agent':{'id':_0xb7c454[_0xbb10('0xa5')]['id'],'name':_0xb7c454[_0xbb10('0xa5')]['name'],'fullname':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0x40')],'email':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]},'contact':_0xb7c454[_0xbb10('0x3a')][_0xbb10('0x3b')],'account':_0xb7c454[_0xbb10('0x3a')]['account']};var _0x4c95c2={'rejectUnauthorized':![],'method':'POST','url':_0xbb10('0xd4'),'headers':{'X-APIKEY':_0x4dd138[_0xbb10('0xd0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]],'buttons':null,'topic':_0x5e405b[_0xbb10('0xd5')],'note':_[_0xbb10('0xd6')](_0x5e405b[_0xbb10('0xd2')])?null:getMustacheRender(_0x5e405b[_0xbb10('0xd2')],_0x1b9012),'metadata':null},'redirect':_0xbb10('0xd7'),'json':!![]};try{if(!_[_0xbb10('0xd6')](_0x5e405b['vidaooMetadata'])){var _0x58295f=getMustacheRender(_0x5e405b['vidaooMetadata'],_0x1b9012);var _0x3d4b89=JSON[_0xbb10('0x8a')](_0x58295f);_0x4c95c2[_0xbb10('0x3a')]['metadata']=_0x3d4b89;}}catch(_0x2bfa8e){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xd9'));}return rp(_0x4c95c2);}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x356660){_0x33a43e=_0x356660;if(_0x33a43e['id']){var _0x48889b={'body':_0x33a43e[_0xbb10('0xda')],'ChatWebsiteId':_0x5e405b['id'],'ChatInteractionId':_0x2764e1['id'],'direction':_0xbb10('0xdb'),'UserId':_0xb7c454[_0xbb10('0xa5')]['id']};return db[_0xbb10('0xdc')][_0xbb10('0xcb')](_0x48889b,{});}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xdd'));}})[_0xbb10('0x22')](function(){return _0x2764e1[_0xbb10('0xde')]({'vidaooSessionId':_0x33a43e['id']});})['then'](respondWithResult(_0xa8b7c3,null))[_0xbb10('0xc4')](handleError(_0xa8b7c3,null));};exports['customUpdate']=function(_0x27bed2,_0x5547fa){if(_0x27bed2[_0xbb10('0x3a')]['id']){delete _0x27bed2[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x27bed2['params']['id']},'include':[{'model':db[_0xbb10('0xdf')],'as':'Contact'}]})[_0xbb10('0x22')](handleEntityNotFound(_0x5547fa,null))[_0xbb10('0x22')](saveUpdates(_0x27bed2[_0xbb10('0x3a')],null))['then'](respondWithResult(_0x5547fa,null))[_0xbb10('0xc4')](handleError(_0x5547fa,null));};exports[_0xbb10('0xe0')]=function(_0x140173,_0x18a44f,_0x11d31b){if(_0x140173[_0xbb10('0x3a')]['id']){delete _0x140173['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x140173[_0xbb10('0xc6')]['id']}})['then'](function(_0x318908){if(!_0x318908){logger['error'](_0xbb10('0xe1'),_0xbb10('0xe0'),0x194,_0xbb10('0xe2'));_0x18a44f['sendStatus'](0x194);}else{if(_0x318908['UserId']){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xe3'));}}return _0x318908;})['then'](function(_0x440108){if(_0x440108){return _0x440108[_0xbb10('0x36')]({'closed':_0x140173[_0xbb10('0x3a')]['closed'],'disposition':_0x140173['body']['disposition']})[_0xbb10('0x22')](function(_0x55aa03){return _0x55aa03;});}})[_0xbb10('0x22')](function(_0x1c2c95){return respondWithRpcPromise(_0xbb10('0xe4'),_0xbb10('0xe0'),_0x140173[_0xbb10('0x3a')],client9004);})[_0xbb10('0x22')](respondWithResult(_0x18a44f,null))[_0xbb10('0xc4')](handleError(_0x18a44f,null));};exports[_0xbb10('0xe5')]=function(_0x2746eb,_0x431792,_0x2e2710){_0x2746eb['body'][_0xbb10('0x38')]=_0x2746eb[_0xbb10('0xe6')]['originalname'];_0x2746eb[_0xbb10('0x3a')]['basename']=_0x2746eb['file'][_0xbb10('0xe7')];_0x2746eb[_0xbb10('0x3a')][_0xbb10('0x49')]=_0x2746eb[_0xbb10('0xe6')][_0xbb10('0xe8')];return db['Attachment'][_0xbb10('0xcb')](_0x2746eb[_0xbb10('0x3a')])['then'](respondWithResult(_0x431792,0xc9))[_0xbb10('0xc4')](handleError(_0x431792,null));};exports[_0xbb10('0xe9')]=function(_0x5a82e7,_0x424c96,_0x4c769b){return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0xc6')]['id']},'raw':!![]})[_0xbb10('0x22')](handleEntityNotFound(_0x424c96,null))[_0xbb10('0x22')](function(_0x20b312){if(_0x20b312){if(_0x20b312[_0xbb10('0xea')]){return _0x424c96['status'](0x193)[_0xbb10('0x33')]({'status':0x193,'message':_0xbb10('0xeb')});}return db[_0xbb10('0xec')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0x4c')][_0xbb10('0xed')]},'raw':!![]})['then'](handleEntityNotFound(_0x424c96,null));}})['then'](function(_0x5a40e8){if(_0x5a40e8){var _0x23849e=_0x5a40e8[_0xbb10('0xee')]!==null;var _0x3e1a86=path[_0xbb10('0xef')](config['root'],_0xbb10('0xf0'));if(_0x23849e){_0x3e1a86=path[_0xbb10('0xef')](_0x3e1a86,_0xbb10('0xf1'));}var _0x577d27=path['join'](_0x3e1a86,_0x5a40e8[_0xbb10('0xf2')]);return _0x424c96['download'](_0x577d27);}})[_0xbb10('0xc4')](handleError(_0x424c96,null));};exports[_0xbb10('0xf3')]=function(_0xb9bc5a,_0x42276f){var _0x425505=null;var _0xcb61bb=null;var _0x1fe250=null;var _0x57933f=null;if(_0xb9bc5a[_0xbb10('0x3a')]['id']){delete _0xb9bc5a[_0xbb10('0x3a')]['id'];}if(_0xb9bc5a['body'][_0xbb10('0xf4')]){_0x57933f=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server/files/chat/upload/',util['format']('transcript-%s.txt',Date[_0xbb10('0xf6')]()));_0xb9bc5a[_0xbb10('0x3a')]['pathTranscript']=_0x57933f;}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0xb9bc5a[_0xbb10('0xc6')]['id']},'include':[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'include':[{'model':db[_0xbb10('0x82')],'as':_0xbb10('0x82')}]}]})['then'](handleEntityNotFound(_0x42276f,null))[_0xbb10('0x22')](saveUpdates(_0xb9bc5a['body'],null))['then'](function(_0x4aa0d7){if(_0x4aa0d7){_0x425505=_0x4aa0d7;return db[_0xbb10('0xcf')][_0xbb10('0x7b')]({'where':{'id':_0x425505['ChatWebsiteId']}});}})[_0xbb10('0x22')](function(_0x49f324){if(_0x49f324){_0x1fe250=_0x49f324;return db[_0xbb10('0xdf')][_0xbb10('0x7b')]({'where':{'id':_0x425505[_0xbb10('0x7c')]}});}})['then'](function(_0x4d10ea){if(_0x4d10ea){_0xcb61bb=_0x4d10ea;if(_0x57933f){var _0x447c0d=null;for(var _0x502e73=0x1;_0x502e73<_0x425505[_0xbb10('0xf7')][_0xbb10('0x51')];++_0x502e73){_0x447c0d=_0x425505['Messages'][_0x502e73];var _0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250['agentAlias'],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');var _0x22f153=_0xb9bc5a['body'][_0xbb10('0xfb')]||util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0xbb10('0xfc'),_0x447c0d[_0xbb10('0x7c')]);switch(_0x1fe250[_0xbb10('0xfd')]){case _0xbb10('0xfe'):_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');break;case'agent_alias':_0x50cd00=_0x447c0d['UserId']?_0x447c0d[_0xbb10('0x82')]['alias']||_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;case'agent_fullname':_0x50cd00=_0x447c0d[_0xbb10('0x83')]?_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;default:_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util['format'](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');}var _0x150d4c=util[_0xbb10('0xf8')]('[%s]\x20%s:\x20%s\x0a',moment(_0x447c0d[_0xbb10('0x89')])[_0xbb10('0xf8')]('MM/DD/YYYY\x20HH:mm:ss'),_0x447c0d[_0xbb10('0x100')]==='in'?_0x22f153:_0x50cd00,_0x447c0d[_0xbb10('0x3a')]);if(!_0x447c0d[_0xbb10('0x101')]){fs[_0xbb10('0x102')](_0x57933f,_0x150d4c);}}return db[_0xbb10('0x103')][_0xbb10('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0xbb10('0x104')],'as':_0xbb10('0x105'),'raw':!![]}]});}}})[_0xbb10('0x22')](function(_0x33d1b7){if(_0x33d1b7&&_0x33d1b7[_0xbb10('0x105')]&&_0xb9bc5a[_0xbb10('0x3a')]){var _0x1db646={'tls':{'rejectUnauthorized':![]}};if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')]){_0x1db646['service']=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')];}else{_0x1db646['host']=_0x33d1b7['Smtp'][_0xbb10('0x107')];_0x1db646[_0xbb10('0x108')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x108')];_0x1db646[_0xbb10('0x109')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x109')];}if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x10a')]){_0x1db646['auth']={'user':_0x33d1b7['Smtp']['user'],'pass':_0x33d1b7['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xbb10('0x10b'),{'account':_0x1db646,'message':{'from':util[_0xbb10('0xf8')](_0xbb10('0x10c'),_0x33d1b7[_0xbb10('0x38')],_0x33d1b7['email']||_0x33d1b7[_0xbb10('0x105')][_0xbb10('0xa5')]),'to':_0xb9bc5a[_0xbb10('0x3a')][_0xbb10('0xf4')],'subject':'Mail\x20Transcript','text':util['format'](_0xbb10('0x10d'),_0xb9bc5a[_0xbb10('0x3a')]['mailTranscript']),'attachments':[{'path':_0x57933f}]}})['then'](function(){return _0x425505;})[_0xbb10('0xc4')](function(_0xf1371a){console[_0xbb10('0x28')](_0xf1371a);});}else{return _0x425505;}})[_0xbb10('0x22')](respondWithStatusCode(_0x42276f,0xc8))[_0xbb10('0xc4')](handleError(_0x42276f,null));};exports['addMessage']=function(_0x4744f4,_0x5382e9,_0x4c97b9){return db[_0xbb10('0xdc')][_0xbb10('0x7b')]({'where':{'id':_0x4744f4[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5382e9,null))[_0xbb10('0x22')](function(_0x21c0fd){if(_0x21c0fd){return _0x21c0fd['addMessage'](_0x4744f4[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x4744f4[_0xbb10('0x3a')],[_0xbb10('0x10e'),'id'])||{});}})[_0xbb10('0x22')](respondWithResult(_0x5382e9,null))[_0xbb10('0xc4')](handleError(_0x5382e9,null));};exports[_0xbb10('0x110')]=function(_0x233d5e,_0x16f3ce,_0xbae19c){var _0x26f4b0={'raw':![],'where':{}};var _0x1dbf7b={};var _0x117e95={'count':0x0,'rows':[]};return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x233d5e[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x16f3ce,null))[_0xbb10('0x22')](function(_0x43a203){if(_0x43a203){_0x1dbf7b[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db['ChatMessage'][_0xbb10('0x47')]);_0x1dbf7b['query']=_[_0xbb10('0xc7')](_0x233d5e[_0xbb10('0x4c')]);_0x1dbf7b[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1dbf7b[_0xbb10('0x4b')],_0x1dbf7b['query']);_0x26f4b0['attributes']=_['intersection'](_0x1dbf7b[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x233d5e['query'][_0xbb10('0x50')]));_0x26f4b0[_0xbb10('0x4e')]=_0x26f4b0[_0xbb10('0x4e')]['length']?_0x26f4b0[_0xbb10('0x4e')]:_0x1dbf7b[_0xbb10('0x4b')];if(!_0x233d5e[_0xbb10('0x4c')]['hasOwnProperty'](_0xbb10('0x53'))){_0x26f4b0['limit']=qs[_0xbb10('0x54')](_0x233d5e['query']['limit']);_0x26f4b0['offset']=qs['offset'](_0x233d5e['query']['offset']);}_0x26f4b0[_0xbb10('0x9f')]=qs[_0xbb10('0x55')](_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x26f4b0['where']=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x233d5e[_0xbb10('0x4c')],_0x1dbf7b[_0xbb10('0x4d')]));_0x26f4b0[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x43a203['id'];if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0['where'],{'$or':_[_0xbb10('0x3f')](_0x26f4b0[_0xbb10('0x4e')],function(_0x288ccc){var _0x5c5ecc={};_0x5c5ecc[_0x288ccc]={'$like':'%'+_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]+'%'};return _0x5c5ecc;})});}if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')]){var _0x5b2292=_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')][_0xbb10('0x111')](',');var _0x22ec50={};_0x22ec50[_0x5b2292[0x0]]={'$gte':moment(_0x5b2292[0x1])[_0xbb10('0xf8')](_0xbb10('0x112'))};_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0[_0xbb10('0x56')],_0x22ec50);}_0x26f4b0=_[_0xbb10('0xac')]({},_0x26f4b0,_0x233d5e[_0xbb10('0xca')]);return db['ChatMessage'][_0xbb10('0x31')]({'where':_0x26f4b0[_0xbb10('0x56')]})['then'](function(_0x5eb1fb){_0x117e95[_0xbb10('0x31')]=_0x5eb1fb;if(_0x233d5e[_0xbb10('0x4c')]['includeAll']){_0x26f4b0[_0xbb10('0xc9')]=[{'all':!![]}];}return db[_0xbb10('0xdc')]['findAll'](_0x26f4b0);})[_0xbb10('0x22')](function(_0x42441e){_0x117e95[_0xbb10('0xc3')]=_0x42441e;return _0x117e95;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x16f3ce,_0x26f4b0))[_0xbb10('0xc4')](handleError(_0x16f3ce,null));};exports['getMyMessages']=function(_0x4fc260,_0x5a502c,_0xaeaa51){var _0x4db9ad={'where':{}},_0x43deea={},_0x53e73e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x4fc260[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5a502c,null))[_0xbb10('0x22')](function(_0x2527f4){if(_0x2527f4){_0x43deea[_0xbb10('0x4b')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x43deea[_0xbb10('0x4c')]=_[_0xbb10('0xc7')](_0x4fc260[_0xbb10('0x4c')]);_0x43deea[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],_0x43deea[_0xbb10('0x4c')]);_0x4db9ad['attributes']=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4fc260[_0xbb10('0x4c')]['fields']));_0x4db9ad[_0xbb10('0x4e')]=_0x4db9ad['attributes']['length']?_0x4db9ad[_0xbb10('0x4e')]:_0x43deea[_0xbb10('0x4b')];if(!_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x52')](_0xbb10('0x53'))){_0x4db9ad[_0xbb10('0x54')]=qs['limit'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x4db9ad[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x4db9ad[_0xbb10('0x9f')]=qs['sort'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x4db9ad[_0xbb10('0x56')]=qs['filters'](_['pick'](_0x4fc260[_0xbb10('0x4c')],_0x43deea[_0xbb10('0x4d')]));_0x4db9ad[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x2527f4['id'];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x4db9ad[_0xbb10('0x56')]=_['merge'](_0x4db9ad[_0xbb10('0x56')],{'$or':_[_0xbb10('0x3f')](_0x4db9ad[_0xbb10('0x4e')],function(_0x55ba78){var _0x5e195a={};_0x5e195a[_0x55ba78]={'$like':'%'+_0x4fc260['query']['filter']+'%'};return _0x5e195a;})});}_0x4db9ad[_0xbb10('0x56')][_0xbb10('0x101')]=![];if(_0x4fc260[_0xbb10('0x4c')]['id']){_0x4db9ad[_0xbb10('0x56')]['id']={'$gt':_0x4fc260['query']['id']};}_0x4db9ad=_[_0xbb10('0xac')]({},_0x4db9ad,_0x4fc260['options']);return db[_0xbb10('0xdc')][_0xbb10('0x31')]({'where':_0x4db9ad[_0xbb10('0x56')]})[_0xbb10('0x22')](function(_0xa16287){_0x53e73e[_0xbb10('0x31')]=_0xa16287;_0x4db9ad[_0xbb10('0xc9')]=[];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x113')]){_0x4db9ad[_0xbb10('0xc9')][_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40'),_0xbb10('0x114')]});}if(_0x4fc260[_0xbb10('0x4c')]['includeAll']){_0x4db9ad[_0xbb10('0xc9')]=[{'all':!![]}];}return db['ChatMessage'][_0xbb10('0x115')](_0x4db9ad);})[_0xbb10('0x22')](function(_0x280119){_0x53e73e[_0xbb10('0xc3')]=_0x280119;return _0x53e73e;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x5a502c,_0x4db9ad))['catch'](handleError(_0x5a502c,null));};exports['addTags']=function(_0x842d94,_0x4cf5cc,_0x553bb8){return db[_0xbb10('0x46')]['find']({'where':{'id':_0x842d94[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4cf5cc,null))[_0xbb10('0x22')](function(_0x4469c4){if(_0x4469c4){return _0x4469c4[_0xbb10('0x116')](_0x842d94[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x842d94['body'],[_0xbb10('0x10e'),'id'])||{})['spread'](function(){return db[_0xbb10('0x7f')]['findAll']({'attributes':['id',_0xbb10('0x38'),_0xbb10('0x5a')],'where':{'id':_0x842d94['body'][_0xbb10('0x10e')]}});})[_0xbb10('0x22')](function(_0x1bb072){socket['emit'](_0xbb10('0x117'),{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]});return{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]};});}})['then'](respondWithResult(_0x4cf5cc,null))[_0xbb10('0xc4')](handleError(_0x4cf5cc,null));};exports[_0xbb10('0x118')]=function(_0x46df90,_0x4b781e,_0x3e6756){return db['ChatInteraction'][_0xbb10('0x7b')]({'where':{'id':_0x46df90[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4b781e,null))[_0xbb10('0x22')](function(_0x583a3e){if(_0x583a3e){return _0x583a3e[_0xbb10('0x118')](_0x46df90[_0xbb10('0x4c')][_0xbb10('0x10e')]);}})[_0xbb10('0x22')](respondWithStatusCode(_0x4b781e,null))[_0xbb10('0xc4')](handleError(_0x4b781e,null));};exports['download']=function(_0x4b10ed,_0x40b5da){var _0x4739a6=moment()[_0xbb10('0x119')]()['toString']();var _0x3d5870=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x11b'),_0xbb10('0x11c'));var _0x81d970=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server',_0xbb10('0x11b'),_0xbb10('0x11d'));var _0x4102af=path[_0xbb10('0xef')](_0x3d5870,_0x4739a6);var _0x4d49a7=util[_0xbb10('0xf8')](_0xbb10('0x11e'),_0x4b10ed[_0xbb10('0xc6')]['id'],_0x4739a6);var _0x59fef2=path['join'](_0x3d5870,_0x4d49a7);var _0x3b45c4=[];_0x3b45c4['push']({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40')],'raw':!![]});_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xdf')],'as':_0xbb10('0x11f'),'attributes':['id',_0xbb10('0x120'),_0xbb10('0x121')],'raw':!![]});if(_0x4b10ed[_0xbb10('0x4c')]['attachments']){_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xec')],'as':_0xbb10('0xec'),'raw':!![]});}var _0x2807d2=[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'attributes':['id','body',_0xbb10('0x89'),_0xbb10('0x100'),_0xbb10('0x101'),_0xbb10('0x90')],'include':_0x3b45c4}];_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0xcf')],'as':_0xbb10('0x122'),'attributes':['id','name']});_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':_0xbb10('0x123'),'attributes':['id','fullname']});return db[_0xbb10('0x46')]['find']({'where':{'id':_0x4b10ed[_0xbb10('0xc6')]['id']},'include':_0x2807d2})[_0xbb10('0x22')](handleEntityNotFound(_0x40b5da,null))[_0xbb10('0x22')](function(_0x58a447){if(_0x58a447){var _0x50fa4e=_0x58a447[_0xbb10('0x124')]({'plain':!![]});fs[_0xbb10('0x125')](_0x4102af);var _0xbb410e={'channel':_0xbb10('0x126'),'account':_0x50fa4e[_0xbb10('0x122')][_0xbb10('0x38')],'agent':_0x50fa4e[_0xbb10('0x123')]?_0x50fa4e[_0xbb10('0x123')][_0xbb10('0x40')]:_0xbb10('0x127'),'createdAt':moment(_0x50fa4e[_0xbb10('0x89')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbb10('0xaa')](),'closedAt':_0x50fa4e[_0xbb10('0xea')]?moment(_0x50fa4e['closedAt'])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')]():'','disposition':_0x50fa4e[_0xbb10('0x128')],'chatInfo':{'browser':_0x50fa4e['browserName'],'os':_0x50fa4e[_0xbb10('0x129')],'referer':_0x50fa4e[_0xbb10('0x12a')],'customerIp':_0x50fa4e['customerIp'],'customerPort':_0x50fa4e[_0xbb10('0x12b')]?_0x50fa4e[_0xbb10('0x12b')]:'N.A.'},'messages':_(_0x50fa4e['Messages'])[_0xbb10('0x12c')]()[_0xbb10('0x94')]({'secret':![]})[_0xbb10('0x3f')](function(_0x5cab64){if(_0x5cab64['Attachment']){var _0x58ee41=path[_0xbb10('0xef')](_0x81d970,_0x5cab64['Attachment'][_0xbb10('0xf2')]);if(fs[_0xbb10('0x12d')](_0x58ee41)){fs['createReadStream'](_0x58ee41)[_0xbb10('0x12e')](fs[_0xbb10('0x12f')](path[_0xbb10('0xef')](_0x4102af,_0x5cab64[_0xbb10('0xec')]['basename'])));}}return{'date':moment(_0x5cab64[_0xbb10('0x89')])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')](),'sender':_0x5cab64[_0xbb10('0x100')]===_0xbb10('0xdb')?_0x5cab64[_0xbb10('0x82')]?_0x5cab64[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa'):_0x5cab64['Contact'][_0xbb10('0x120')]+(_0x5cab64[_0xbb10('0x11f')][_0xbb10('0x121')]?'\x20'+_0x5cab64[_0xbb10('0x11f')]['lastName']:''),'body':_0x5cab64['Attachment']?_0x5cab64[_0xbb10('0xec')][_0xbb10('0xf2')]:_0x5cab64[_0xbb10('0x3a')],'direction':_0x5cab64[_0xbb10('0x100')]==='out'?'A':'C','secret':_0x5cab64[_0xbb10('0x101')],'read':_0x5cab64[_0xbb10('0x90')],'attachment':_0x5cab64['Attachment']};})[_0xbb10('0x73')]()};return ejs['renderFile'](path['join'](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x130'),_0xbb10('0x131')),{'interaction':_0xbb410e})[_0xbb10('0x22')](function(_0x4aa76a){var _0x38403e=path[_0xbb10('0xef')](_0x4102af,_0xbb10('0x132')+_0x50fa4e['id']+'-'+_0x4739a6+_0xbb10('0x133'));var _0x1b7274={'path':_0x38403e,'channel':_0xbb10('0x126'),'interactionId':_0x50fa4e['id']};return pdf[_0xbb10('0x134')](_0x4aa76a,_0x1b7274);})[_0xbb10('0x22')](function(){return new BPromise(function(_0x34f4d6,_0x254b6e){zipdir(_0x4102af,{'saveTo':_0x59fef2},function(_0x368adb,_0xef4ccf){if(_0x368adb)return _0x254b6e(_0x368adb);return _0x34f4d6(_0xef4ccf);});})[_0xbb10('0x22')](function(){return new BPromise(function(_0x9fcc26,_0x111fd4){rimraf(_0x4102af,function(_0x256ce9){if(_0x256ce9)_0x111fd4(_0x256ce9);return _0x9fcc26();});});})[_0xbb10('0x22')](function(){return _0x40b5da[_0xbb10('0x135')](_0x59fef2,_0x4d49a7,function(_0x27e0c5){if(_0x27e0c5){console[_0xbb10('0x136')](_0xbb10('0x137'),_0x27e0c5);}else{fs[_0xbb10('0x138')](_0x59fef2);}});});});}else{return _0x40b5da[_0xbb10('0x2c')](0xc8);}})[_0xbb10('0xc4')](handleError(_0x40b5da,null));}; \ No newline at end of file +var _0x4024=['ChatInteractionId','push','all','rows','show','params','include','options','create','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooNote','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','ChatMessage','Messages','ContactId','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','hasOwnProperty','sort','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','getMyMessages','includeAgent','addTags','setTags','ids','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','Account','get','mkdirSync','Chat','Owner','N.A.','closed','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','end','status','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','then','sendStatus','name','render','merge','agent','interaction','account','Users','TagIds','Tags','split','forEach','catch','map','ChatInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','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','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','text','body','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy'];(function(_0x3a4d53,_0x511760){var _0x4b7438=function(_0x310c74){while(--_0x310c74){_0x3a4d53['push'](_0x3a4d53['shift']());}};_0x4b7438(++_0x511760);}(_0x4024,0x89));var _0x4402=function(_0x1cff18,_0x5b019f){_0x1cff18=_0x1cff18-0x0;var _0x4c5712=_0x4024[_0x1cff18];return _0x4c5712;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x4402('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4402('0xf'))(_0x4402('0x10'));var utils=require('../../config/utils');var config=require(_0x4402('0x11'));var licenseUtil=require(_0x4402('0x12'));var db=require(_0x4402('0x13'))['db'];config['redis']=_[_0x4402('0x14')](config[_0x4402('0x15')],{'host':_0x4402('0x16'),'port':0x18eb});var socket=require(_0x4402('0x17'))(new Redis(config[_0x4402('0x15')]));require(_0x4402('0x18'))[_0x4402('0x19')](socket);var jayson=require(_0x4402('0x1a'));var client=jayson[_0x4402('0x1b')][_0x4402('0x1c')]({'port':0x232b});var client9004=jayson[_0x4402('0x1b')][_0x4402('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x2a2ce8,_0x19fe7b,_0xfd9853,_0x30c390){return new BPromise(function(_0x399c24,_0x25e88b){var _0x186c22=_0x30c390||client;return _0x186c22[_0x4402('0x1d')](_0x2a2ce8,_0xfd9853)['then'](function(_0x494389){logger[_0x4402('0x1e')](_0x4402('0x1f'),_0x19fe7b,'request\x20sent');logger[_0x4402('0x20')](_0x4402('0x21'),_0x19fe7b,'request\x20sent',JSON[_0x4402('0x22')](_0x494389));if(_0x494389['error']){if(_0x494389['error'][_0x4402('0x23')]===0x1f4){logger[_0x4402('0x24')](_0x4402('0x1f'),_0x19fe7b,_0x494389['error'][_0x4402('0x25')]);return _0x25e88b(_0x494389['error']['message']);}logger[_0x4402('0x24')](_0x4402('0x1f'),_0x19fe7b,_0x494389[_0x4402('0x24')][_0x4402('0x25')]);return _0x399c24(_0x494389[_0x4402('0x24')][_0x4402('0x25')]);}else{logger[_0x4402('0x1e')](_0x4402('0x1f'),_0x19fe7b,_0x4402('0x26'));_0x399c24(_0x494389['result'][_0x4402('0x25')]);}})['catch'](function(_0x3733cd){logger[_0x4402('0x24')](_0x4402('0x1f'),_0x19fe7b,_0x3733cd);_0x25e88b(_0x3733cd);});});}function respondWithStatusCode(_0x211424,_0x5a43d0){_0x5a43d0=_0x5a43d0||0xcc;return function(_0x15c19f){if(_0x15c19f){return _0x211424['sendStatus'](_0x5a43d0);}return _0x211424['status'](_0x5a43d0)[_0x4402('0x27')]();};}function respondWithResult(_0x395e49,_0x327d60){_0x327d60=_0x327d60||0xc8;return function(_0xabf61b){if(_0xabf61b){return _0x395e49[_0x4402('0x28')](_0x327d60)['json'](_0xabf61b);}};}function respondWithFilteredResult(_0x41de44,_0x52e625){return function(_0x71da2f){if(_0x71da2f){var _0x1e2340=typeof _0x52e625[_0x4402('0x29')]==='undefined'&&typeof _0x52e625[_0x4402('0x2a')]===_0x4402('0x2b');var _0x316239=_0x71da2f[_0x4402('0x2c')];var _0x2526d1=_0x1e2340?0x0:_0x52e625[_0x4402('0x29')];var _0x1189b8=_0x1e2340?_0x71da2f[_0x4402('0x2c')]:_0x52e625[_0x4402('0x29')]+_0x52e625[_0x4402('0x2a')];var _0xcea26b;if(_0x1189b8>=_0x316239){_0x1189b8=_0x316239;_0xcea26b=0xc8;}else{_0xcea26b=0xce;}_0x41de44['status'](_0xcea26b);return _0x41de44[_0x4402('0x2d')]('Content-Range',_0x2526d1+'-'+_0x1189b8+'/'+_0x316239)[_0x4402('0x2e')](_0x71da2f);}return null;};}function patchUpdates(_0x554096){return function(_0x2dea0f){try{jsonpatch[_0x4402('0x2f')](_0x2dea0f,_0x554096,!![]);}catch(_0x145003){return BPromise[_0x4402('0x30')](_0x145003);}return _0x2dea0f[_0x4402('0x31')]();};}function saveUpdates(_0x480781,_0x3a60af){return function(_0x3fa7ae){if(_0x3fa7ae){return _0x3fa7ae[_0x4402('0x32')](_0x480781)['then'](function(_0x331c75){return _0x331c75;});}return null;};}function removeEntity(_0x3383e3,_0x535e1d){return function(_0x2db1fe){if(_0x2db1fe){return _0x2db1fe[_0x4402('0x33')]()[_0x4402('0x34')](function(){_0x3383e3[_0x4402('0x28')](0xcc)[_0x4402('0x27')]();});}};}function handleEntityNotFound(_0x235f30,_0x1e67ac){return function(_0x6e9fb7){if(!_0x6e9fb7){_0x235f30[_0x4402('0x35')](0x194);}return _0x6e9fb7;};}function handleError(_0x5c819a,_0x2995b6){_0x2995b6=_0x2995b6||0x1f4;return function(_0x28fee8){logger[_0x4402('0x24')](_0x28fee8['stack']);if(_0x28fee8[_0x4402('0x36')]){delete _0x28fee8[_0x4402('0x36')];}_0x5c819a['status'](_0x2995b6)['send'](_0x28fee8);};}function getMustacheRender(_0x2b9d51,_0x5b7c2e){return Mustache[_0x4402('0x37')](_0x2b9d51,_[_0x4402('0x38')](_0x5b7c2e['body'],{'contact':_0x5b7c2e['contact'],'message':_0x5b7c2e['message'],'agent':_0x5b7c2e[_0x4402('0x39')],'interaction':_0x5b7c2e[_0x4402('0x3a')],'account':_0x5b7c2e[_0x4402('0x3b')]}))||'';}function getInteractionUsers(_0x3fd8ce,_0x52af0d){return new BPromise(function(_0x20579c,_0x7d5f2a){try{if(_0x52af0d[_0x3fd8ce['id']]){_0x3fd8ce[_0x4402('0x3c')]=_['map'](_0x52af0d[_0x3fd8ce['id']],function(_0x2b92b7){return{'id':_0x2b92b7['id'],'fullname':_0x2b92b7['fullname']};});}}catch(_0x6e328a){_0x7d5f2a(_0x6e328a);}_0x20579c(_0x3fd8ce);});}function getInteractionTags(_0x3ef31d,_0x5c74b1){return new BPromise(function(_0x16ef2e,_0x529526){try{if(_0x3ef31d[_0x4402('0x3d')]){_0x3ef31d[_0x4402('0x3e')]=[];_0x3ef31d['TagIds'][_0x4402('0x3f')](',')[_0x4402('0x40')](function(_0x250f09){_0x3ef31d[_0x4402('0x3e')]['push'](_0x5c74b1[_0x250f09]);});}delete _0x3ef31d['TagIds'];}catch(_0x2cda0a){_0x529526(_0x2cda0a);}_0x16ef2e(_0x3ef31d);});}function updateChatInteraction(_0x47a3a3,_0x3a589b,_0x2a6d78){return new BPromise(function(_0xb9cf85,_0x2e2391){return getInteractionUsers(_0x47a3a3,_0x2a6d78)[_0x4402('0x34')](function(_0x455a62){return getInteractionTags(_0x455a62,_0x3a589b);})[_0x4402('0x34')](function(_0x390169){_0xb9cf85(_0x390169);})[_0x4402('0x41')](function(_0x42812b){_0x2e2391(_0x42812b);});});}exports['index']=function(_0x14b94b,_0x3236fc){var _0x5e7872={},_0x214eec={},_0x370878={'count':0x0,'rows':[]};var _0x50552a=_[_0x4402('0x42')](db[_0x4402('0x43')][_0x4402('0x44')],function(_0x3278fc){return{'name':_0x3278fc[_0x4402('0x45')],'type':_0x3278fc['type'][_0x4402('0x46')]};});_0x214eec[_0x4402('0x47')]=_[_0x4402('0x42')](_0x50552a,_0x4402('0x36'));_0x214eec[_0x4402('0x48')]=_[_0x4402('0x49')](_0x14b94b[_0x4402('0x48')]);_0x214eec[_0x4402('0x4a')]=_[_0x4402('0x4b')](_0x214eec[_0x4402('0x47')],_0x214eec[_0x4402('0x48')]);_0x5e7872['attributes']=_[_0x4402('0x4b')](_0x214eec['model'],qs[_0x4402('0x4c')](_0x14b94b[_0x4402('0x48')]['fields']));_0x5e7872[_0x4402('0x4d')]=_0x5e7872[_0x4402('0x4d')][_0x4402('0x4e')]?_0x5e7872[_0x4402('0x4d')]:_0x214eec[_0x4402('0x47')];if(!_0x14b94b[_0x4402('0x48')]['hasOwnProperty'](_0x4402('0x4f'))){_0x5e7872[_0x4402('0x2a')]=qs[_0x4402('0x2a')](_0x14b94b[_0x4402('0x48')][_0x4402('0x2a')]);_0x5e7872[_0x4402('0x29')]=qs[_0x4402('0x29')](_0x14b94b[_0x4402('0x48')][_0x4402('0x29')]);}_0x5e7872['order']=qs['sort'](_0x14b94b['query']['sort']);_0x5e7872[_0x4402('0x50')]=qs[_0x4402('0x4a')](_[_0x4402('0x51')](_0x14b94b[_0x4402('0x48')],_0x214eec['filters']),_0x50552a);var _0x169bb2=[];var _0x12d6de=squel[_0x4402('0x52')]()[_0x4402('0x53')]('id')[_0x4402('0x53')](_0x4402('0x36'))[_0x4402('0x53')]('color')[_0x4402('0x54')](_0x4402('0x55'));var _0x38e6d1=squel[_0x4402('0x52')]()[_0x4402('0x53')](_0x4402('0x56'))['field'](_0x4402('0x57'))[_0x4402('0x53')](_0x4402('0x58'))[_0x4402('0x54')](_0x4402('0x59'),'ui')[_0x4402('0x5a')](_0x4402('0x5b'),'u','u.id\x20=\x20ui.UserId');var _0x48e138=squel[_0x4402('0x52')]()[_0x4402('0x54')](_0x4402('0x5c'),'i')['left_join']('cm_contacts','c',_0x4402('0x5d'))[_0x4402('0x5a')](_0x4402('0x5b'),'o',_0x4402('0x5e'))[_0x4402('0x5a')](_0x4402('0x5f'),'a',_0x4402('0x60'))[_0x4402('0x5a')](_0x4402('0x61'),'me',_0x4402('0x62'))[_0x4402('0x5a')](_0x4402('0x63'),'it',_0x4402('0x64'))['left_join'](_0x4402('0x55'),'t','t.id\x20=\x20it.TagId');var _0xe4530a=squel['expr']();var _0x3fb9f0=[];var _0x1e5891=squel[_0x4402('0x65')]();var _0x31e36c;if(_0x14b94b[_0x4402('0x48')][_0x4402('0x66')]){_0x31e36c=as['parseSearch'](_0x14b94b[_0x4402('0x48')][_0x4402('0x66')]);var _0xa390ce=_0x31e36c[_0x4402('0x67')];for(var _0xb341ab=0x0;_0xb341ab<_0x31e36c['conditions'][_0x4402('0x4e')];_0xb341ab++){var _0x31d993=_0x31e36c[_0x4402('0x68')][_0xb341ab];var _0xc15c0b='i';var _0x309077=_[_0x4402('0x69')](_0x50552a,[_0x4402('0x36'),_0x31d993[_0x4402('0x53')]]);if(!_0x309077){switch(_0x31d993['field']){case _0x4402('0x6a'):if(_0x31d993[_0x4402('0x6b')]==0x1){_0x48e138['having']('`'+_0x31d993[_0x4402('0x53')]+_0x4402('0x6c'));}else{_0x48e138['having']('`'+_0x31d993['field']+_0x4402('0x6d'));}break;case _0x4402('0x6e'):if(_0x31d993[_0x4402('0x6f')]==='$substring'){if(_0x31d993[_0x4402('0x6b')][_0x4402('0x3f')]('\x20')[_0x4402('0x4e')]>0x1){_0xe4530a[_0xa390ce]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4402('0x70')](_0x31d993[_0x4402('0x6b')]),null);}else{var _0xdde09f='%'+_0x31d993['value']+'%';_0xe4530a[_0xa390ce](_0x4402('0x71'),_0xdde09f,_0xdde09f,_0xdde09f);}}else{_0x309077=_[_0x4402('0x69')](_0x50552a,['name','ContactId']);_0x31d993[_0x4402('0x53')]='ContactId';_0x53e553=as[_0x4402('0x72')](_0xc15c0b,_0x309077[_0x4402('0x73')],_0x31d993);_0xe4530a[_0xa390ce](_0x53e553['text'],_0x53e553['value'][_0x4402('0x74')],_0x53e553[_0x4402('0x6b')][_0x4402('0x27')]);}break;case _0x4402('0x75'):var _0x4ac95e=_0x31d993[_0x4402('0x6b')][_0x4402('0x3f')](',')[_0x4402('0x42')](function(_0x168095){return Number(_0x168095);});_0x4ac95e[_0x4402('0x40')](function(_0x26b1ad){_0x1e5891['or'](_0x4402('0x76'),'%,'+_0x26b1ad+',%');});_0x3fb9f0=_['union'](_0x3fb9f0,_0x4ac95e);break;case _0x4402('0x77'):if(_0x31d993[_0x4402('0x6f')]==='$substring'){_0xe4530a[_0xa390ce]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x31d993[_0x4402('0x6b')]+'%',null);}else{_0x309077=_['find'](_0x50552a,[_0x4402('0x36'),'UserId']);_0x31d993[_0x4402('0x53')]=_0x4402('0x78');_0x53e553=as[_0x4402('0x72')](_0xc15c0b,_0x309077[_0x4402('0x73')],_0x31d993);_0xe4530a[_0xa390ce](_0x53e553[_0x4402('0x79')],_0x53e553[_0x4402('0x6b')][_0x4402('0x74')],_0x53e553[_0x4402('0x6b')][_0x4402('0x27')]);}break;case _0x4402('0x7a'):_0x53e553=as[_0x4402('0x72')]('me',null,_0x31d993);_0xe4530a[_0xa390ce](_0x53e553[_0x4402('0x79')],_0x53e553[_0x4402('0x6b')][_0x4402('0x74')],_0x53e553[_0x4402('0x6b')][_0x4402('0x27')]);break;}}else{var _0x53e553=as[_0x4402('0x72')](_0xc15c0b,_0x309077[_0x4402('0x73')],_0x31d993);_0xe4530a[_0xa390ce](_0x53e553[_0x4402('0x79')],_0x53e553['value'][_0x4402('0x74')],_0x53e553['value'][_0x4402('0x27')]);}}}else{var _0x1b1147=_(_0x14b94b[_0x4402('0x48')])[_0x4402('0x49')]()['map'](function(_0xac8513){return _['some'](_0x50552a,[_0x4402('0x36'),_0xac8513])?_0xac8513:undefined;})[_0x4402('0x7b')]()[_0x4402('0x6b')]();if(!_['isEmpty'](_0x1b1147)){_0x1b1147[_0x4402('0x40')](function(_0x4c98eb){if(_0x4c98eb===_0x4402('0x7c')){_0x48e138[_0x4402('0x50')](_0x4402('0x7d'),[][_0x4402('0x7e')](_0x14b94b[_0x4402('0x48')][_0x4c98eb]));}else if(_0x4c98eb===_0x4402('0x7f')){var _0x19b427=JSON[_0x4402('0x80')](_0x14b94b[_0x4402('0x48')][_0x4c98eb])['$gte'];var _0x44d806=JSON[_0x4402('0x80')](_0x14b94b[_0x4402('0x48')][_0x4c98eb])[_0x4402('0x81')];_0x48e138[_0x4402('0x50')](_0x4402('0x82'),_0x19b427,_0x44d806);}else{if(_0x14b94b[_0x4402('0x48')][_0x4c98eb]===_0x4402('0x83')){_0x48e138[_0x4402('0x50')]('i.'+_0x4c98eb+'\x20IS\x20NULL');}else{_0x48e138[_0x4402('0x50')]('i.'+_0x4c98eb+_0x4402('0x84'),_0x14b94b[_0x4402('0x48')][_0x4c98eb]);}}});}if(_0x14b94b['query'][_0x4402('0x85')]){if(_0x14b94b['query'][_0x4402('0x85')]==0x1){_0x48e138['having'](_0x4402('0x86'));}else{_0x48e138[_0x4402('0x87')]('`unreadMessages`\x20>\x200');}}if(_0x14b94b[_0x4402('0x48')]['tag']){_0x3fb9f0=_[_0x4402('0x88')](_0x14b94b[_0x4402('0x48')]['tag'])?_0x14b94b[_0x4402('0x48')][_0x4402('0x89')]:new Array(_0x14b94b['query'][_0x4402('0x89')]);_0x3fb9f0[_0x4402('0x40')](function(_0x4f0915){_0x1e5891['or'](_0x4402('0x76'),'%,'+_0x4f0915+',%');});}if(_0x14b94b[_0x4402('0x48')][_0x4402('0x8a')]){var _0x12b834=_0x14b94b[_0x4402('0x48')][_0x4402('0x8a')][_0x4402('0x8b')]('\x5c','\x5c\x5c')[_0x4402('0x8b')](/'/g,'\x27\x27');if(qs[_0x4402('0x8c')](_0x12b834)){_0xe4530a['or'](_0x4402('0x8d'),_0x12b834+'%');}else{_0xe4530a['or'](_0x4402('0x8e'),qs[_0x4402('0x70')](_0x12b834))['or'](_0x4402('0x8f'),_0x12b834+'%');}}}_0x48e138[_0x4402('0x50')](_0xe4530a);_0x48e138['group'](_0x4402('0x90'));var _0xc3914e={'type':db['Sequelize'][_0x4402('0x91')]['SELECT'],'raw':!![]};var _0x2c7ff5=_0x48e138[_0x4402('0x92')]();_0x2c7ff5[_0x4402('0x53')]('i.id');_0x2c7ff5[_0x4402('0x53')](_0x4402('0x93'),_0x4402('0x6a'));if(_0x5e7872['order']){_0x5e7872[_0x4402('0x94')][_0x4402('0x40')](function(_0x179eb4){var _0x1a0a6f=_0x179eb4[0x0]==='contactName'?_0x179eb4[0x0]:'i.'+_0x179eb4[0x0];_0x48e138[_0x4402('0x94')](_0x1a0a6f,_0x179eb4[0x1]===_0x4402('0x95')?![]:!![]);});}if(!_[_0x4402('0x96')](_0x3fb9f0)){_0x48e138[_0x4402('0x87')](_0x1e5891);_0x2c7ff5[_0x4402('0x50')](_0x4402('0x97'),_0x3fb9f0);}BPromise[_0x4402('0x98')]()[_0x4402('0x34')](function(){if(!_0x31e36c){if(_0x14b94b[_0x4402('0x48')][_0x4402('0x7c')])return;_0x2c7ff5[_0x4402('0x50')](_0x4402('0x99'));_0x48e138[_0x4402('0x50')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x14b94b[_0x4402('0x9a')][_0x4402('0x9b')]!==_0x4402('0x39'))return;return _0x14b94b[_0x4402('0x9a')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x284b52){if(_[_0x4402('0x96')](_0x284b52)){_0x2c7ff5[_0x4402('0x50')](_0x4402('0x9c'));_0x48e138['where'](_0x4402('0x9c'));}else{_0x2c7ff5[_0x4402('0x50')]('i.ChatWebsiteId\x20IN\x20?',_[_0x4402('0x42')](_0x284b52,'id'));_0x48e138[_0x4402('0x50')](_0x4402('0x7d'),_[_0x4402('0x42')](_0x284b52,'id'));}});})[_0x4402('0x34')](function(){if(_0x14b94b['user'][_0x4402('0x9b')]===_0x4402('0x39')&&!_0x31e36c&&!_0x14b94b[_0x4402('0x48')][_0x4402('0x7c')])return[];return db[_0x4402('0x9d')][_0x4402('0x48')](_0x2c7ff5[_0x4402('0x9e')](),_0xc3914e);})['then'](function(_0x218640){_0x370878[_0x4402('0x2c')]=_0x218640[_0x4402('0x4e')];if(_0x370878[_0x4402('0x2c')]===0x0)return[];return db[_0x4402('0x9d')]['query'](_0x12d6de[_0x4402('0x9e')](),_0xc3914e)[_0x4402('0x34')](function(_0x572e21){_0x169bb2=_[_0x4402('0x9f')](_0x572e21,'id');_0xc3914e=_['merge'](_0xc3914e,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14b94b[_0x4402('0x48')]['fields']){_0x5e7872[_0x4402('0x4d')]['forEach'](function(_0x51e85d){_0x48e138[_0x4402('0x53')]('i.'+_0x51e85d);});}else{_0x48e138[_0x4402('0x53')](_0x4402('0x93'),_0x4402('0x6a'));_0x48e138[_0x4402('0x53')](_0x4402('0xa0'),'Account.key');_0x48e138[_0x4402('0x53')](_0x4402('0xa1'),'Account.mandatoryDisposition');_0x48e138[_0x4402('0x53')]('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','contactName');_0x48e138[_0x4402('0x53')]('i.*');_0x48e138[_0x4402('0x53')](_0x4402('0xa2'),_0x4402('0xa3'));_0x48e138[_0x4402('0x53')](_0x4402('0xa4'),'Contact.lastName');_0x48e138['field'](_0x4402('0xa5'),_0x4402('0xa6'));_0x48e138['field'](_0x4402('0xa7'),_0x4402('0xa8'));_0x48e138[_0x4402('0x53')](_0x4402('0xa9'),_0x4402('0xaa'));_0x48e138[_0x4402('0x53')]('c.fax','Contact.fax');_0x48e138[_0x4402('0x53')](_0x4402('0xab'),_0x4402('0xac'));_0x48e138[_0x4402('0x53')](_0x4402('0xad'),_0x4402('0xae'));_0x48e138['field'](_0x4402('0xaf'),_0x4402('0x3d'));}if(_0x5e7872[_0x4402('0x2a')])_0x48e138[_0x4402('0x2a')](_0x5e7872[_0x4402('0x2a')]);if(_0x5e7872['offset'])_0x48e138[_0x4402('0x29')](_0x5e7872[_0x4402('0x29')]);return db[_0x4402('0x9d')][_0x4402('0x48')](_0x48e138[_0x4402('0x9e')](),_0xc3914e);})[_0x4402('0x34')](function(_0x518b0b){if(_0x518b0b['length']>0x0)_0x38e6d1[_0x4402('0x50')]('ui.ChatInteractionId\x20IN\x20?',_[_0x4402('0x42')](_0x518b0b,'id'));return db[_0x4402('0x9d')][_0x4402('0x48')](_0x38e6d1[_0x4402('0x9e')](),_0xc3914e)[_0x4402('0x34')](function(_0x25b3ee){var _0x70bdbd=_[_0x4402('0xb0')](_0x25b3ee,_0x4402('0xb1'));var _0x23306f=[];_0x518b0b[_0x4402('0x40')](function(_0x425a1b){_0x23306f[_0x4402('0xb2')](updateChatInteraction(_0x425a1b,_0x169bb2,_0x70bdbd));});return BPromise[_0x4402('0xb3')](_0x23306f);});});})[_0x4402('0x34')](function(_0x1ba5a1){_0x370878[_0x4402('0xb4')]=_0x1ba5a1;return _0x370878;})[_0x4402('0x34')](respondWithFilteredResult(_0x3236fc,_0x5e7872))[_0x4402('0x41')](handleError(_0x3236fc,null));};exports[_0x4402('0xb5')]=function(_0xe37b11,_0x385b8e){var _0x418070={'raw':![],'where':{'id':_0xe37b11[_0x4402('0xb6')]['id']}},_0x47a76a={};_0x47a76a[_0x4402('0x47')]=_[_0x4402('0x49')](db[_0x4402('0x43')][_0x4402('0x44')]);_0x47a76a[_0x4402('0x48')]=_['keys'](_0xe37b11['query']);_0x47a76a[_0x4402('0x4a')]=_[_0x4402('0x4b')](_0x47a76a[_0x4402('0x47')],_0x47a76a['query']);_0x418070['attributes']=_['intersection'](_0x47a76a['model'],qs[_0x4402('0x4c')](_0xe37b11[_0x4402('0x48')][_0x4402('0x4c')]));_0x418070['attributes']=_0x418070[_0x4402('0x4d')][_0x4402('0x4e')]?_0x418070[_0x4402('0x4d')]:_0x47a76a['model'];if(_0xe37b11[_0x4402('0x48')]['includeAll']){_0x418070[_0x4402('0xb7')]=[{'all':!![]}];}_0x418070=_[_0x4402('0x38')]({},_0x418070,_0xe37b11[_0x4402('0xb8')]);return db[_0x4402('0x43')][_0x4402('0x69')](_0x418070)[_0x4402('0x34')](handleEntityNotFound(_0x385b8e,null))['then'](respondWithResult(_0x385b8e,null))[_0x4402('0x41')](handleError(_0x385b8e,null));};exports[_0x4402('0xb9')]=function(_0x3ac6b9,_0x55c3fd){return db[_0x4402('0x43')]['create'](_0x3ac6b9[_0x4402('0x7a')],{})[_0x4402('0x34')](respondWithResult(_0x55c3fd,0xc9))[_0x4402('0x41')](handleError(_0x55c3fd,null));};exports[_0x4402('0x32')]=function(_0x54d6dc,_0x91c49){if(_0x54d6dc[_0x4402('0x7a')]['id']){delete _0x54d6dc[_0x4402('0x7a')]['id'];}return db[_0x4402('0x43')][_0x4402('0x69')]({'where':{'id':_0x54d6dc['params']['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x91c49,null))[_0x4402('0x34')](saveUpdates(_0x54d6dc['body'],null))['then'](respondWithResult(_0x91c49,null))['catch'](handleError(_0x91c49,null));};exports[_0x4402('0x33')]=function(_0x42b774,_0x246ff2){return db[_0x4402('0x43')]['find']({'where':{'id':_0x42b774[_0x4402('0xb6')]['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x246ff2,null))[_0x4402('0x34')](removeEntity(_0x246ff2,null))[_0x4402('0x41')](handleError(_0x246ff2,null));};exports['describe']=function(_0x2a3361,_0x2949ce){return db[_0x4402('0x43')]['describe']()['then'](respondWithResult(_0x2949ce,null))['catch'](handleError(_0x2949ce,null));};exports[_0x4402('0xba')]=function(_0x48bf30,_0x17c5c2){var _0x35c16f=_0x48bf30[_0x4402('0xb6')]['id'];var _0x117911;var _0x87ae2a;var _0xd604a5;return db[_0x4402('0x43')][_0x4402('0xbb')]({'where':{'id':_0x35c16f}})[_0x4402('0x34')](function(_0x423f83){_0x117911=_0x423f83;return db[_0x4402('0xbc')][_0x4402('0xbb')]({'where':{'id':_0x423f83[_0x4402('0x7c')]},'attributes':['id',_0x4402('0xbd'),'vidaooEscalation',_0x4402('0xbe'),_0x4402('0xbf'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x57fd83){if(_0x57fd83&&_0x57fd83[_0x4402('0xbd')]&&_0x57fd83['vidaooEscalation']){_0x87ae2a=_0x57fd83;var _0x47aa8b={'interaction':{'id':_0x35c16f},'agent':{'id':_0x48bf30[_0x4402('0x9a')]['id'],'name':_0x48bf30[_0x4402('0x9a')]['name'],'fullname':_0x48bf30[_0x4402('0x9a')][_0x4402('0xc0')],'email':_0x48bf30[_0x4402('0x9a')][_0x4402('0xc1')]},'contact':_0x48bf30['body'][_0x4402('0xc2')],'account':_0x48bf30[_0x4402('0x7a')][_0x4402('0x3b')]};var _0x286500={'rejectUnauthorized':![],'method':_0x4402('0xc3'),'url':_0x4402('0xc4'),'headers':{'X-APIKEY':_0x57fd83[_0x4402('0xbd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x48bf30[_0x4402('0x9a')][_0x4402('0xc1')]],'buttons':null,'topic':_0x87ae2a['vidaooTopic'],'note':_[_0x4402('0xc5')](_0x87ae2a[_0x4402('0xbf')])?null:getMustacheRender(_0x87ae2a[_0x4402('0xbf')],_0x47aa8b),'metadata':null},'redirect':_0x4402('0xc6'),'json':!![]};try{if(!_['isNull'](_0x87ae2a[_0x4402('0xc7')])){var _0x4bf0ff=getMustacheRender(_0x87ae2a[_0x4402('0xc7')],_0x47aa8b);var _0x29ffd4=JSON['parse'](_0x4bf0ff);_0x286500['body'][_0x4402('0xc8')]=_0x29ffd4;}}catch(_0x173f64){throw new db[(_0x4402('0xc9'))][(_0x4402('0xca'))](_0x4402('0xcb'));}return rp(_0x286500);}else{throw new db[(_0x4402('0xc9'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x4402('0x34')](function(_0x54e61e){_0xd604a5=_0x54e61e;if(_0xd604a5['id']){var _0xc47081={'body':_0xd604a5[_0x4402('0xcc')],'ChatWebsiteId':_0x87ae2a['id'],'ChatInteractionId':_0x117911['id'],'direction':_0x4402('0xcd'),'UserId':_0x48bf30[_0x4402('0x9a')]['id']};return db['ChatMessage'][_0x4402('0xb9')](_0xc47081,{});}else{throw new db[(_0x4402('0xc9'))][(_0x4402('0xca'))](_0x4402('0xce'));}})[_0x4402('0x34')](function(){return _0x117911[_0x4402('0xcf')]({'vidaooSessionId':_0xd604a5['id']});})['then'](respondWithResult(_0x17c5c2,null))['catch'](handleError(_0x17c5c2,null));};exports[_0x4402('0xd0')]=function(_0x5a768b,_0x38d7b5){if(_0x5a768b[_0x4402('0x7a')]['id']){delete _0x5a768b['body']['id'];}return db[_0x4402('0x43')]['find']({'where':{'id':_0x5a768b[_0x4402('0xb6')]['id']},'include':[{'model':db[_0x4402('0xd1')],'as':_0x4402('0x6e')}]})['then'](handleEntityNotFound(_0x38d7b5,null))[_0x4402('0x34')](saveUpdates(_0x5a768b['body'],null))[_0x4402('0x34')](respondWithResult(_0x38d7b5,null))[_0x4402('0x41')](handleError(_0x38d7b5,null));};exports[_0x4402('0xd2')]=function(_0x1fc790,_0xaaf390,_0x53be9e){if(_0x1fc790['body']['id']){delete _0x1fc790[_0x4402('0x7a')]['id'];}return db['ChatInteraction'][_0x4402('0x69')]({'where':{'id':_0x1fc790[_0x4402('0xb6')]['id']}})['then'](function(_0x50d453){if(!_0x50d453){logger[_0x4402('0x24')](_0x4402('0xd3'),_0x4402('0xd2'),0x194,_0x4402('0xd4'));_0xaaf390[_0x4402('0x35')](0x194);}else{if(_0x50d453[_0x4402('0x78')]){throw new db[(_0x4402('0xc9'))][(_0x4402('0xca'))]('Interaction\x20already\x20assigned');}}return _0x50d453;})['then'](function(_0xf3be9){if(_0xf3be9){return _0xf3be9[_0x4402('0x32')]({'closed':_0x1fc790[_0x4402('0x7a')]['closed'],'disposition':_0x1fc790[_0x4402('0x7a')]['disposition']})[_0x4402('0x34')](function(_0x1237a3){return _0x1237a3;});}})[_0x4402('0x34')](function(_0x4a0fd9){return respondWithRpcPromise(_0x4402('0xd5'),_0x4402('0xd2'),_0x1fc790['body'],client9004);})[_0x4402('0x34')](respondWithResult(_0xaaf390,null))[_0x4402('0x41')](handleError(_0xaaf390,null));};exports[_0x4402('0xd6')]=function(_0x8c436d,_0x15e9d3,_0xa0d1ee){_0x8c436d[_0x4402('0x7a')][_0x4402('0x36')]=_0x8c436d[_0x4402('0xd7')][_0x4402('0xd8')];_0x8c436d[_0x4402('0x7a')][_0x4402('0xd9')]=_0x8c436d['file'][_0x4402('0xda')];_0x8c436d[_0x4402('0x7a')][_0x4402('0x73')]=_0x8c436d[_0x4402('0xd7')][_0x4402('0xdb')];return db[_0x4402('0xdc')][_0x4402('0xb9')](_0x8c436d[_0x4402('0x7a')])[_0x4402('0x34')](respondWithResult(_0x15e9d3,0xc9))['catch'](handleError(_0x15e9d3,null));};exports[_0x4402('0xdd')]=function(_0x113451,_0x338e97,_0x4c6d4e){return db[_0x4402('0x43')][_0x4402('0xbb')]({'where':{'id':_0x113451['params']['id']},'raw':!![]})[_0x4402('0x34')](handleEntityNotFound(_0x338e97,null))[_0x4402('0x34')](function(_0x491a8e){if(_0x491a8e){if(_0x491a8e['closed']){return _0x338e97[_0x4402('0x28')](0x193)[_0x4402('0x2e')]({'status':0x193,'message':_0x4402('0xde')});}return db[_0x4402('0xdc')]['findOne']({'where':{'id':_0x113451[_0x4402('0x48')]['attachId']},'raw':!![]})[_0x4402('0x34')](handleEntityNotFound(_0x338e97,null));}})[_0x4402('0x34')](function(_0x171672){if(_0x171672){var _0xdbd1c8=_0x171672[_0x4402('0xdf')]!==null;var _0x5d190e=path[_0x4402('0xe0')](config[_0x4402('0xe1')],_0x4402('0xe2'));if(_0xdbd1c8){_0x5d190e=path[_0x4402('0xe0')](_0x5d190e,_0x4402('0xe3'));}var _0x23de88=path[_0x4402('0xe0')](_0x5d190e,_0x171672[_0x4402('0xd9')]);return _0x338e97[_0x4402('0xe4')](_0x23de88);}})[_0x4402('0x41')](handleError(_0x338e97,null));};exports[_0x4402('0xe5')]=function(_0x55274b,_0x2afc41){var _0x1c5cad=null;var _0x3b8f77=null;var _0x2b3b75=null;var _0x1ba411=null;if(_0x55274b[_0x4402('0x7a')]['id']){delete _0x55274b[_0x4402('0x7a')]['id'];}if(_0x55274b[_0x4402('0x7a')][_0x4402('0xe6')]){_0x1ba411=path[_0x4402('0xe0')](config['root'],_0x4402('0xe7'),util[_0x4402('0xe8')](_0x4402('0xe9'),Date['now']()));_0x55274b[_0x4402('0x7a')][_0x4402('0xea')]=_0x1ba411;}return db['ChatInteraction'][_0x4402('0x69')]({'where':{'id':_0x55274b[_0x4402('0xb6')]['id']},'include':[{'model':db[_0x4402('0xeb')],'as':_0x4402('0xec'),'include':[{'model':db[_0x4402('0x77')],'as':_0x4402('0x77')}]}]})[_0x4402('0x34')](handleEntityNotFound(_0x2afc41,null))[_0x4402('0x34')](saveUpdates(_0x55274b[_0x4402('0x7a')],null))[_0x4402('0x34')](function(_0x2d86c7){if(_0x2d86c7){_0x1c5cad=_0x2d86c7;return db['ChatWebsite'][_0x4402('0x69')]({'where':{'id':_0x1c5cad[_0x4402('0x7c')]}});}})[_0x4402('0x34')](function(_0x47837e){if(_0x47837e){_0x2b3b75=_0x47837e;return db[_0x4402('0xd1')][_0x4402('0x69')]({'where':{'id':_0x1c5cad[_0x4402('0xed')]}});}})[_0x4402('0x34')](function(_0x259c23){if(_0x259c23){_0x3b8f77=_0x259c23;if(_0x1ba411){var _0x535d83=null;for(var _0x2f3d6e=0x1;_0x2f3d6e<_0x1c5cad['Messages'][_0x4402('0x4e')];++_0x2f3d6e){_0x535d83=_0x1c5cad[_0x4402('0xec')][_0x2f3d6e];var _0x395d17=_0x535d83[_0x4402('0x78')]?util[_0x4402('0xe8')](_0x4402('0xee'),_0x2b3b75[_0x4402('0xef')],_0x535d83[_0x4402('0x78')]):_0x4402('0xf0');var _0x51bdf7=_0x55274b[_0x4402('0x7a')]['customer']||util[_0x4402('0xe8')](_0x4402('0xee'),_0x4402('0xf1'),_0x535d83[_0x4402('0xed')]);switch(_0x2b3b75[_0x4402('0xf2')]){case _0x4402('0xf3'):_0x395d17=_0x535d83['UserId']?util[_0x4402('0xe8')]('%s%d',_0x2b3b75[_0x4402('0xef')],_0x535d83['UserId']):_0x4402('0xf0');break;case _0x4402('0xf4'):_0x395d17=_0x535d83[_0x4402('0x78')]?_0x535d83[_0x4402('0x77')][_0x4402('0xf5')]||_0x535d83[_0x4402('0x77')][_0x4402('0xc0')]:_0x4402('0xf0');break;case _0x4402('0xf6'):_0x395d17=_0x535d83['UserId']?_0x535d83[_0x4402('0x77')]['fullname']:'System';break;default:_0x395d17=_0x535d83['UserId']?util[_0x4402('0xe8')](_0x4402('0xee'),_0x2b3b75[_0x4402('0xef')],_0x535d83['UserId']):_0x4402('0xf0');}var _0x1accec=util[_0x4402('0xe8')](_0x4402('0xf7'),moment(_0x535d83[_0x4402('0x7f')])[_0x4402('0xe8')](_0x4402('0xf8')),_0x535d83[_0x4402('0xf9')]==='in'?_0x51bdf7:_0x395d17,_0x535d83[_0x4402('0x7a')]);if(!_0x535d83[_0x4402('0xfa')]){fs[_0x4402('0xfb')](_0x1ba411,_0x1accec);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x4402('0xfc')],'as':_0x4402('0xfd'),'raw':!![]}]});}}})[_0x4402('0x34')](function(_0x23dbb4){if(_0x23dbb4&&_0x23dbb4[_0x4402('0xfd')]&&_0x55274b['body']){var _0x494b72={'tls':{'rejectUnauthorized':![]}};if(_0x23dbb4[_0x4402('0xfd')][_0x4402('0xfe')]){_0x494b72[_0x4402('0xfe')]=_0x23dbb4[_0x4402('0xfd')][_0x4402('0xfe')];}else{_0x494b72[_0x4402('0xff')]=_0x23dbb4[_0x4402('0xfd')][_0x4402('0xff')];_0x494b72[_0x4402('0x100')]=_0x23dbb4[_0x4402('0xfd')][_0x4402('0x100')];_0x494b72[_0x4402('0x101')]=_0x23dbb4[_0x4402('0xfd')][_0x4402('0x101')];}if(_0x23dbb4[_0x4402('0xfd')][_0x4402('0x102')]){_0x494b72[_0x4402('0x103')]={'user':_0x23dbb4[_0x4402('0xfd')][_0x4402('0x9a')],'pass':_0x23dbb4[_0x4402('0xfd')][_0x4402('0x104')]};}return respondWithRpcPromise(_0x4402('0x105'),_0x4402('0x106'),{'account':_0x494b72,'message':{'from':util[_0x4402('0xe8')](_0x4402('0x107'),_0x23dbb4[_0x4402('0x36')],_0x23dbb4['email']||_0x23dbb4[_0x4402('0xfd')][_0x4402('0x9a')]),'to':_0x55274b[_0x4402('0x7a')][_0x4402('0xe6')],'subject':_0x4402('0x108'),'text':util[_0x4402('0xe8')](_0x4402('0x109'),_0x55274b[_0x4402('0x7a')][_0x4402('0xe6')]),'attachments':[{'path':_0x1ba411}]}})['then'](function(){return _0x1c5cad;})[_0x4402('0x41')](function(_0x3ba561){console[_0x4402('0x24')](_0x3ba561);});}else{return _0x1c5cad;}})[_0x4402('0x34')](respondWithStatusCode(_0x2afc41,0xc8))[_0x4402('0x41')](handleError(_0x2afc41,null));};exports[_0x4402('0x10a')]=function(_0x10f917,_0x1155d1,_0x17c1ee){return db['ChatMessage'][_0x4402('0x69')]({'where':{'id':_0x10f917[_0x4402('0xb6')]['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x1155d1,null))[_0x4402('0x34')](function(_0x37ea8d){if(_0x37ea8d){return _0x37ea8d[_0x4402('0x10a')](_0x10f917[_0x4402('0x7a')]['ids'],_[_0x4402('0x10b')](_0x10f917[_0x4402('0x7a')],['ids','id'])||{});}})[_0x4402('0x34')](respondWithResult(_0x1155d1,null))[_0x4402('0x41')](handleError(_0x1155d1,null));};exports[_0x4402('0x10c')]=function(_0x3e78da,_0x1bf636,_0x44b095){var _0x2433a1={'raw':![],'where':{}};var _0x4069cf={};var _0x7be513={'count':0x0,'rows':[]};return db[_0x4402('0x43')][_0x4402('0xbb')]({'where':{'id':_0x3e78da[_0x4402('0xb6')]['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x1bf636,null))[_0x4402('0x34')](function(_0x1f2219){if(_0x1f2219){_0x4069cf[_0x4402('0x47')]=_[_0x4402('0x49')](db[_0x4402('0xeb')][_0x4402('0x44')]);_0x4069cf[_0x4402('0x48')]=_[_0x4402('0x49')](_0x3e78da[_0x4402('0x48')]);_0x4069cf[_0x4402('0x4a')]=_[_0x4402('0x4b')](_0x4069cf[_0x4402('0x47')],_0x4069cf[_0x4402('0x48')]);_0x2433a1[_0x4402('0x4d')]=_[_0x4402('0x4b')](_0x4069cf[_0x4402('0x47')],qs[_0x4402('0x4c')](_0x3e78da[_0x4402('0x48')]['fields']));_0x2433a1[_0x4402('0x4d')]=_0x2433a1['attributes']['length']?_0x2433a1[_0x4402('0x4d')]:_0x4069cf[_0x4402('0x47')];if(!_0x3e78da[_0x4402('0x48')][_0x4402('0x10d')](_0x4402('0x4f'))){_0x2433a1['limit']=qs[_0x4402('0x2a')](_0x3e78da[_0x4402('0x48')][_0x4402('0x2a')]);_0x2433a1['offset']=qs[_0x4402('0x29')](_0x3e78da[_0x4402('0x48')][_0x4402('0x29')]);}_0x2433a1[_0x4402('0x94')]=qs['sort'](_0x3e78da[_0x4402('0x48')][_0x4402('0x10e')]);_0x2433a1['where']=qs['filters'](_['pick'](_0x3e78da['query'],_0x4069cf[_0x4402('0x4a')]));_0x2433a1[_0x4402('0x50')][_0x4402('0xb1')]=_0x1f2219['id'];if(_0x3e78da['query'][_0x4402('0x8a')]){_0x2433a1[_0x4402('0x50')]=_[_0x4402('0x38')](_0x2433a1['where'],{'$or':_[_0x4402('0x42')](_0x2433a1[_0x4402('0x4d')],function(_0x2466a1){var _0x55ed20={};_0x55ed20[_0x2466a1]={'$like':'%'+_0x3e78da[_0x4402('0x48')][_0x4402('0x8a')]+'%'};return _0x55ed20;})});}if(_0x3e78da['query'][_0x4402('0x10f')]){var _0x335d93=_0x3e78da[_0x4402('0x48')][_0x4402('0x10f')]['split'](',');var _0x3aebf6={};_0x3aebf6[_0x335d93[0x0]]={'$gte':moment(_0x335d93[0x1])['format'](_0x4402('0x110'))};_0x2433a1['where']=_['merge'](_0x2433a1[_0x4402('0x50')],_0x3aebf6);}_0x2433a1=_[_0x4402('0x38')]({},_0x2433a1,_0x3e78da[_0x4402('0xb8')]);return db[_0x4402('0xeb')][_0x4402('0x2c')]({'where':_0x2433a1[_0x4402('0x50')]})[_0x4402('0x34')](function(_0x87e1c){_0x7be513['count']=_0x87e1c;if(_0x3e78da[_0x4402('0x48')][_0x4402('0x111')]){_0x2433a1[_0x4402('0xb7')]=[{'all':!![]}];}return db[_0x4402('0xeb')][_0x4402('0x112')](_0x2433a1);})['then'](function(_0x20b540){_0x7be513['rows']=_0x20b540;return _0x7be513;});}})[_0x4402('0x34')](respondWithFilteredResult(_0x1bf636,_0x2433a1))[_0x4402('0x41')](handleError(_0x1bf636,null));};exports[_0x4402('0x113')]=function(_0x516583,_0x182827,_0x284292){var _0x579bab={'where':{}},_0x30cdd6={},_0x1ac943={'count':0x0,'rows':[]};return db[_0x4402('0x43')][_0x4402('0xbb')]({'where':{'id':_0x516583[_0x4402('0xb6')]['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x182827,null))[_0x4402('0x34')](function(_0xe8f398){if(_0xe8f398){_0x30cdd6[_0x4402('0x47')]=_[_0x4402('0x49')](db[_0x4402('0xeb')][_0x4402('0x44')]);_0x30cdd6[_0x4402('0x48')]=_[_0x4402('0x49')](_0x516583['query']);_0x30cdd6[_0x4402('0x4a')]=_[_0x4402('0x4b')](_0x30cdd6[_0x4402('0x47')],_0x30cdd6[_0x4402('0x48')]);_0x579bab[_0x4402('0x4d')]=_[_0x4402('0x4b')](_0x30cdd6[_0x4402('0x47')],qs[_0x4402('0x4c')](_0x516583['query'][_0x4402('0x4c')]));_0x579bab[_0x4402('0x4d')]=_0x579bab[_0x4402('0x4d')]['length']?_0x579bab[_0x4402('0x4d')]:_0x30cdd6[_0x4402('0x47')];if(!_0x516583[_0x4402('0x48')][_0x4402('0x10d')](_0x4402('0x4f'))){_0x579bab[_0x4402('0x2a')]=qs[_0x4402('0x2a')](_0x516583['query']['limit']);_0x579bab[_0x4402('0x29')]=qs[_0x4402('0x29')](_0x516583[_0x4402('0x48')][_0x4402('0x29')]);}_0x579bab[_0x4402('0x94')]=qs['sort'](_0x516583[_0x4402('0x48')][_0x4402('0x10e')]);_0x579bab[_0x4402('0x50')]=qs['filters'](_[_0x4402('0x51')](_0x516583['query'],_0x30cdd6[_0x4402('0x4a')]));_0x579bab[_0x4402('0x50')][_0x4402('0xb1')]=_0xe8f398['id'];if(_0x516583[_0x4402('0x48')]['filter']){_0x579bab[_0x4402('0x50')]=_[_0x4402('0x38')](_0x579bab[_0x4402('0x50')],{'$or':_[_0x4402('0x42')](_0x579bab[_0x4402('0x4d')],function(_0x3adad4){var _0x207b70={};_0x207b70[_0x3adad4]={'$like':'%'+_0x516583['query']['filter']+'%'};return _0x207b70;})});}_0x579bab[_0x4402('0x50')][_0x4402('0xfa')]=![];if(_0x516583[_0x4402('0x48')]['id']){_0x579bab['where']['id']={'$gt':_0x516583[_0x4402('0x48')]['id']};}_0x579bab=_[_0x4402('0x38')]({},_0x579bab,_0x516583[_0x4402('0xb8')]);return db['ChatMessage'][_0x4402('0x2c')]({'where':_0x579bab['where']})[_0x4402('0x34')](function(_0x2903fd){_0x1ac943[_0x4402('0x2c')]=_0x2903fd;_0x579bab['include']=[];if(_0x516583[_0x4402('0x48')][_0x4402('0x114')]){_0x579bab['include']['push']({'model':db['User'],'as':'User','attributes':['id',_0x4402('0xc0'),'alias']});}if(_0x516583['query'][_0x4402('0x111')]){_0x579bab['include']=[{'all':!![]}];}return db[_0x4402('0xeb')][_0x4402('0x112')](_0x579bab);})['then'](function(_0x230904){_0x1ac943[_0x4402('0xb4')]=_0x230904;return _0x1ac943;});}})[_0x4402('0x34')](respondWithFilteredResult(_0x182827,_0x579bab))['catch'](handleError(_0x182827,null));};exports[_0x4402('0x115')]=function(_0x5f42bc,_0x50999c,_0xc4375e){return db['ChatInteraction'][_0x4402('0x69')]({'where':{'id':_0x5f42bc['params']['id']}})[_0x4402('0x34')](handleEntityNotFound(_0x50999c,null))[_0x4402('0x34')](function(_0x21a6d2){if(_0x21a6d2){return _0x21a6d2[_0x4402('0x116')](_0x5f42bc[_0x4402('0x7a')][_0x4402('0x117')],_[_0x4402('0x10b')](_0x5f42bc[_0x4402('0x7a')],[_0x4402('0x117'),'id'])||{})[_0x4402('0x118')](function(){return db[_0x4402('0x75')][_0x4402('0x112')]({'attributes':['id',_0x4402('0x36'),_0x4402('0x119')],'where':{'id':_0x5f42bc[_0x4402('0x7a')]['ids']}});})[_0x4402('0x34')](function(_0x132621){socket[_0x4402('0x11a')](_0x4402('0x11b'),{'id':Number(_0x5f42bc[_0x4402('0xb6')]['id']),'tags':_0x132621||[]});return{'id':Number(_0x5f42bc[_0x4402('0xb6')]['id']),'tags':_0x132621||[]};});}})[_0x4402('0x34')](respondWithResult(_0x50999c,null))[_0x4402('0x41')](handleError(_0x50999c,null));};exports[_0x4402('0x11c')]=function(_0x4e0ae2,_0x21e2c8,_0x1845d8){return db[_0x4402('0x43')]['find']({'where':{'id':_0x4e0ae2[_0x4402('0xb6')]['id']}})['then'](handleEntityNotFound(_0x21e2c8,null))[_0x4402('0x34')](function(_0x424e93){if(_0x424e93){return _0x424e93[_0x4402('0x11c')](_0x4e0ae2[_0x4402('0x48')]['ids']);}})[_0x4402('0x34')](respondWithStatusCode(_0x21e2c8,null))['catch'](handleError(_0x21e2c8,null));};exports[_0x4402('0xe4')]=function(_0x4cb0bf,_0x2a586e){var _0x5325a7=moment()[_0x4402('0x11d')]()['toString']();var _0x157060=path[_0x4402('0xe0')](config[_0x4402('0xe1')],_0x4402('0x11e'),_0x4402('0x11f'),_0x4402('0x120'));var _0x2ead56=path[_0x4402('0xe0')](config['root'],_0x4402('0x11e'),_0x4402('0x11f'),_0x4402('0x121'));var _0x31d19c=path[_0x4402('0xe0')](_0x157060,_0x5325a7);var _0x1675b2=util[_0x4402('0xe8')](_0x4402('0x122'),_0x4cb0bf['params']['id'],_0x5325a7);var _0xe5e2f3=path[_0x4402('0xe0')](_0x157060,_0x1675b2);var _0x22c8a1=[];_0x22c8a1[_0x4402('0xb2')]({'model':db[_0x4402('0x77')],'as':_0x4402('0x77'),'attributes':['id',_0x4402('0xc0')],'raw':!![]});_0x22c8a1[_0x4402('0xb2')]({'model':db[_0x4402('0xd1')],'as':_0x4402('0x6e'),'attributes':['id',_0x4402('0x123'),'lastName'],'raw':!![]});if(_0x4cb0bf[_0x4402('0x48')]['attachments']){_0x22c8a1[_0x4402('0xb2')]({'model':db[_0x4402('0xdc')],'as':_0x4402('0xdc'),'raw':!![]});}var _0x177297=[{'model':db['ChatMessage'],'as':_0x4402('0xec'),'attributes':['id','body',_0x4402('0x7f'),'direction',_0x4402('0xfa'),_0x4402('0x85')],'include':_0x22c8a1}];_0x177297[_0x4402('0xb2')]({'model':db[_0x4402('0xbc')],'as':_0x4402('0x124'),'attributes':['id',_0x4402('0x36')]});_0x177297[_0x4402('0xb2')]({'model':db[_0x4402('0x77')],'as':'Owner','attributes':['id',_0x4402('0xc0')]});return db[_0x4402('0x43')][_0x4402('0x69')]({'where':{'id':_0x4cb0bf[_0x4402('0xb6')]['id']},'include':_0x177297})[_0x4402('0x34')](handleEntityNotFound(_0x2a586e,null))[_0x4402('0x34')](function(_0x140207){if(_0x140207){var _0x1d2478=_0x140207[_0x4402('0x125')]({'plain':!![]});fs[_0x4402('0x126')](_0x31d19c);var _0x286a77={'channel':_0x4402('0x127'),'account':_0x1d2478[_0x4402('0x124')][_0x4402('0x36')],'agent':_0x1d2478['Owner']?_0x1d2478[_0x4402('0x128')][_0x4402('0xc0')]:_0x4402('0x129'),'createdAt':moment(_0x1d2478[_0x4402('0x7f')])[_0x4402('0xe8')](_0x4402('0x110'))[_0x4402('0x9e')](),'closedAt':_0x1d2478[_0x4402('0x12a')]?moment(_0x1d2478['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4402('0x9e')]():'','disposition':_0x1d2478['disposition'],'chatInfo':{'browser':_0x1d2478[_0x4402('0x12b')],'os':_0x1d2478['osName'],'referer':_0x1d2478[_0x4402('0x12c')],'customerIp':_0x1d2478[_0x4402('0x12d')],'customerPort':_0x1d2478[_0x4402('0x12e')]?_0x1d2478['customerPort']:_0x4402('0x129')},'messages':_(_0x1d2478[_0x4402('0xec')])[_0x4402('0x12f')]()[_0x4402('0x8a')]({'secret':![]})['map'](function(_0x633496){if(_0x633496[_0x4402('0xdc')]){var _0x5862a7=path[_0x4402('0xe0')](_0x2ead56,_0x633496['Attachment'][_0x4402('0xd9')]);if(fs[_0x4402('0x130')](_0x5862a7)){fs[_0x4402('0x131')](_0x5862a7)[_0x4402('0x132')](fs[_0x4402('0x133')](path[_0x4402('0xe0')](_0x31d19c,_0x633496[_0x4402('0xdc')][_0x4402('0xd9')])));}}return{'date':moment(_0x633496[_0x4402('0x7f')])[_0x4402('0xe8')](_0x4402('0x110'))[_0x4402('0x9e')](),'sender':_0x633496['direction']===_0x4402('0xcd')?_0x633496[_0x4402('0x77')]?_0x633496[_0x4402('0x77')][_0x4402('0xc0')]:_0x4402('0xf0'):_0x633496['Contact'][_0x4402('0x123')]+(_0x633496[_0x4402('0x6e')][_0x4402('0x134')]?'\x20'+_0x633496[_0x4402('0x6e')][_0x4402('0x134')]:''),'body':_0x633496[_0x4402('0xdc')]?_0x633496[_0x4402('0xdc')]['basename']:_0x633496[_0x4402('0x7a')],'direction':_0x633496['direction']===_0x4402('0xcd')?'A':'C','secret':_0x633496[_0x4402('0xfa')],'read':_0x633496[_0x4402('0x85')],'attachment':_0x633496['Attachment']};})[_0x4402('0x6b')]()};return ejs[_0x4402('0x135')](path[_0x4402('0xe0')](config[_0x4402('0xe1')],_0x4402('0x11e'),'views','downloadInteraction.ejs'),{'interaction':_0x286a77})['then'](function(_0x5b8cd8){var _0x3fc6b3=path[_0x4402('0xe0')](_0x31d19c,'transcript-'+_0x1d2478['id']+'-'+_0x5325a7+_0x4402('0x136'));var _0x15bbe1={'path':_0x3fc6b3,'channel':_0x4402('0x127'),'interactionId':_0x1d2478['id']};return pdf[_0x4402('0x137')](_0x5b8cd8,_0x15bbe1);})[_0x4402('0x34')](function(){return new BPromise(function(_0x303680,_0x281eaa){zipdir(_0x31d19c,{'saveTo':_0xe5e2f3},function(_0x1baf42,_0x3d743e){if(_0x1baf42)return _0x281eaa(_0x1baf42);return _0x303680(_0x3d743e);});})[_0x4402('0x34')](function(){return new BPromise(function(_0x5ad41f,_0xbeb577){rimraf(_0x31d19c,function(_0x8c8f01){if(_0x8c8f01)_0xbeb577(_0x8c8f01);return _0x5ad41f();});});})[_0x4402('0x34')](function(){return _0x2a586e[_0x4402('0xe4')](_0xe5e2f3,_0x1675b2,function(_0xc36aed){if(_0xc36aed){console['log'](_0x4402('0x138'),_0xc36aed);}else{fs[_0x4402('0x139')](_0xe5e2f3);}});});});}else{return _0x2a586e[_0x4402('0x35')](0xc8);}})[_0x4402('0x41')](handleError(_0x2a586e,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 385391e..0c99421 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 _0x98b0=['../../mysqldb','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x98b0,0xba));var _0x098b=function(_0x4b935a,_0x327ee3){_0x4b935a=_0x4b935a-0x0;var _0xa298f0=_0x98b0[_0x4b935a];return _0xa298f0;};'use strict';var EventEmitter=require(_0x098b('0x0'));var ChatInteraction=require(_0x098b('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x098b('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x098b('0x2'),'afterUpdate':_0x098b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x573e6b){return function(_0xef0e74,_0x4b070b,_0x32941a){_0xef0e74[_0x098b('0x4')]({'attributes':['id'],'raw':!![]})[_0x098b('0x5')](function(_0x337c65){_0xef0e74[_0x098b('0x6')](_0x098b('0x7'),_0x337c65[_0x098b('0x8')](function(_0x5d4008){return{'id':_0x5d4008['id']};}));return ChatMessage[_0x098b('0x9')]({'where':{'ChatInteractionId':_0xef0e74['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4cd40a){_0xef0e74[_0x098b('0x6')](_0x098b('0xa'),_0x4cd40a[_0x098b('0xb')]);ChatInteractionEvents[_0x098b('0xc')](_0x573e6b+':'+_0xef0e74['id'],_0xef0e74);ChatInteractionEvents[_0x098b('0xc')](_0x573e6b,_0xef0e74);_0x32941a(null);})[_0x098b('0xd')](_0x32941a(null));};}for(var e in events){if(events[_0x098b('0xe')](e)){var event=events[e];ChatInteraction[_0x098b('0xf')](e,emitEvent(event));}}module[_0x098b('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xa5aa=['emit','catch','hasOwnProperty','hook','exports','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','update','then','setDataValue','Users','findAll','unreadMessages','length'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0xa5aa,0x115));var _0xaa5a=function(_0x3b9e11,_0x2677e0){_0x3b9e11=_0x3b9e11-0x0;var _0x224b39=_0xa5aa[_0x3b9e11];return _0x224b39;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xaa5a('0x0')];var ChatMessage=require(_0xaa5a('0x1'))['db'][_0xaa5a('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xaa5a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa5a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4752e9){return function(_0x422954,_0x24f964,_0x28acab){_0x422954['getUsers']({'attributes':['id'],'raw':!![]})[_0xaa5a('0x5')](function(_0x5172e4){_0x422954[_0xaa5a('0x6')](_0xaa5a('0x7'),_0x5172e4['map'](function(_0x8f185d){return{'id':_0x8f185d['id']};}));return ChatMessage[_0xaa5a('0x8')]({'where':{'ChatInteractionId':_0x422954['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa5a('0x5')](function(_0x54c15b){_0x422954[_0xaa5a('0x6')](_0xaa5a('0x9'),_0x54c15b[_0xaa5a('0xa')]);ChatInteractionEvents[_0xaa5a('0xb')](_0x4752e9+':'+_0x422954['id'],_0x422954);ChatInteractionEvents[_0xaa5a('0xb')](_0x4752e9,_0x422954);_0x28acab(null);})[_0xaa5a('0xc')](_0x28acab(null));};}for(var e in events){if(events[_0xaa5a('0xd')](e)){var event=events[e];ChatInteraction[_0xaa5a('0xe')](e,emitEvent(event));}}module[_0xaa5a('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 0cf5437..b177d80 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 _0xb089=['closedAt','format','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','chat_interactions','closed'];(function(_0x10b477,_0x3f5cbf){var _0x311ed4=function(_0x4a12dd){while(--_0x4a12dd){_0x10b477['push'](_0x10b477['shift']());}};_0x311ed4(++_0x3f5cbf);}(_0xb089,0x13e));var _0x9b08=function(_0x4b8f06,_0x36e998){_0x4b8f06=_0x4b8f06-0x0;var _0x34db50=_0xb089[_0x4b8f06];return _0x34db50;};'use strict';var _=require(_0x9b08('0x0'));var util=require('util');var logger=require(_0x9b08('0x1'))(_0x9b08('0x2'));var moment=require(_0x9b08('0x3'));var BPromise=require('bluebird');var rp=require(_0x9b08('0x4'));var fs=require('fs');var path=require(_0x9b08('0x5'));var rimraf=require(_0x9b08('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b08('0x7'));module[_0x9b08('0x8')]=function(_0x59bdcb,_0x4274fe){return _0x59bdcb[_0x9b08('0x9')]('ChatInteraction',attributes,{'tableName':_0x9b08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c1bbe,_0x3772aa,_0x51985e){if(_0x5c1bbe['changed'](_0x9b08('0xb'))){_0x5c1bbe[_0x9b08('0xc')]=moment()[_0x9b08('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x51985e(null,_0x5c1bbe);}},'charset':'utf8mb4','collate':_0x9b08('0xe')});}; \ No newline at end of file +var _0x0230=['../../config/logger','api','path','../../config/environment','exports','define','chat_interactions','changed','closed','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4a8ce3,_0x13615e){var _0x4bbc6e=function(_0x4b0e4b){while(--_0x4b0e4b){_0x4a8ce3['push'](_0x4a8ce3['shift']());}};_0x4bbc6e(++_0x13615e);}(_0x0230,0xef));var _0x0023=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0230[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0023('0x0'));var util=require('util');var logger=require(_0x0023('0x1'))(_0x0023('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0023('0x3'));var rimraf=require('rimraf');var config=require(_0x0023('0x4'));var attributes=require('./chatInteraction.attributes');module[_0x0023('0x5')]=function(_0x12d510,_0x25eece){return _0x12d510[_0x0023('0x6')]('ChatInteraction',attributes,{'tableName':_0x0023('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f9c14,_0x17b734,_0x4551ce){if(_0x1f9c14[_0x0023('0x8')](_0x0023('0x9'))){_0x1f9c14['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4551ce(null,_0x1f9c14);}},'charset':_0x0023('0xa'),'collate':_0x0023('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 48fee23..cf2048e 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 _0x73c9=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','debug','AddTagsToChatInteraction','ids','body','spread','AddTags','stringify','moment'];(function(_0xf726d2,_0x29432f){var _0x3e0703=function(_0x57b3b3){while(--_0x57b3b3){_0xf726d2['push'](_0xf726d2['shift']());}};_0x3e0703(++_0x29432f);}(_0x73c9,0x93));var _0x973c=function(_0x3144c8,_0x133898){_0x3144c8=_0x3144c8-0x0;var _0xb0124a=_0x73c9[_0x3144c8];return _0xb0124a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x973c('0x0'));var BPromise=require(_0x973c('0x1'));var rs=require(_0x973c('0x2'));var fs=require('fs');var Redis=require(_0x973c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x973c('0x4'))(_0x973c('0x5'));var config=require(_0x973c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x973c('0x7')][_0x973c('0x8')]({'port':0x232a});config[_0x973c('0x9')]=_[_0x973c('0xa')](config[_0x973c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x973c('0x9')]));require(_0x973c('0xb'))[_0x973c('0xc')](socket);function respondWithRpcPromise(_0x18d410,_0x485163,_0x5364a1){return new BPromise(function(_0x43cfa3,_0x27e53c){return client['request'](_0x18d410,_0x5364a1)[_0x973c('0xd')](function(_0x5ee8bc){logger[_0x973c('0xe')](_0x973c('0xf'),_0x485163,'request\x20sent');logger['debug'](_0x973c('0x10'),_0x485163,_0x973c('0x11'),JSON['stringify'](_0x5ee8bc));if(_0x5ee8bc[_0x973c('0x12')]){if(_0x5ee8bc[_0x973c('0x12')][_0x973c('0x13')]===0x1f4){logger[_0x973c('0x12')](_0x973c('0xf'),_0x485163,_0x5ee8bc[_0x973c('0x12')][_0x973c('0x14')]);return _0x27e53c(_0x5ee8bc[_0x973c('0x12')][_0x973c('0x14')]);}logger['error'](_0x973c('0xf'),_0x485163,_0x5ee8bc[_0x973c('0x12')][_0x973c('0x14')]);return _0x43cfa3(_0x5ee8bc[_0x973c('0x12')][_0x973c('0x14')]);}else{logger[_0x973c('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x485163,_0x973c('0x11'));_0x43cfa3(_0x5ee8bc[_0x973c('0x15')][_0x973c('0x14')]);}})[_0x973c('0x16')](function(_0x470fcd){logger[_0x973c('0x12')](_0x973c('0xf'),_0x485163,_0x470fcd);_0x27e53c(_0x470fcd);});});}exports[_0x973c('0x17')]=function(_0x5c185d){var _0x62f1d6=this;return new Promise(function(_0xe1d03e,_0xa7be8){return db[_0x973c('0x18')][_0x973c('0x19')](_0x5c185d['body'],{'raw':_0x5c185d[_0x973c('0x1a')]?_0x5c185d['options'][_0x973c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c185d[_0x973c('0x1a')]?_0x5c185d['options'][_0x973c('0x1c')]||null:null,'attributes':_0x5c185d[_0x973c('0x1a')]?_0x5c185d[_0x973c('0x1a')][_0x973c('0x1d')]||null:null,'limit':_0x5c185d[_0x973c('0x1a')]?_0x5c185d['options']['limit']||null:null})[_0x973c('0xd')](function(_0x15abfd){logger[_0x973c('0xe')](_0x973c('0x17'),_0x5c185d);logger[_0x973c('0x1e')]('UpdateChatInteraction',_0x5c185d,JSON['stringify'](_0x15abfd));_0xe1d03e(_0x15abfd);})['catch'](function(_0x5e384f){logger['error'](_0x973c('0x17'),_0x5e384f[_0x973c('0x14')],_0x5c185d);_0xa7be8(_0x62f1d6[_0x973c('0x12')](0x1f4,_0x5e384f[_0x973c('0x14')]));});});};exports[_0x973c('0x1f')]=function(_0x343a17){return new Promise(function(_0x3ed610,_0x16784c){return db['ChatInteraction']['find']({'where':_0x343a17[_0x973c('0x1a')]?_0x343a17[_0x973c('0x1a')][_0x973c('0x1c')]||null:null})[_0x973c('0xd')](function(_0x1e96b6){if(_0x1e96b6){return _0x1e96b6['addTags'](_0x343a17['body'][_0x973c('0x20')],_['omit'](_0x343a17[_0x973c('0x21')],[_0x973c('0x20'),'id'])||{});}})[_0x973c('0x22')](function(_0x360a35){logger[_0x973c('0xe')](_0x973c('0x23'),_0x343a17);logger[_0x973c('0x1e')]('AddTags',_0x343a17,JSON[_0x973c('0x24')](_0x360a35));_0x3ed610(_0x360a35);})[_0x973c('0x16')](function(_0x10f54d){logger[_0x973c('0x12')](_0x973c('0x23'),_0x10f54d[_0x973c('0x14')],_0x343a17);_0x16784c(_this['error'](0x1f4,_0x10f54d['message']));});});}; \ No newline at end of file +var _0x3be7=['code','error','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','then','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2bdba7,_0x24f2c3){var _0x283dfe=function(_0x1065dc){while(--_0x1065dc){_0x2bdba7['push'](_0x2bdba7['shift']());}};_0x283dfe(++_0x24f2c3);}(_0x3be7,0xcb));var _0x73be=function(_0x2f61ae,_0x205230){_0x2f61ae=_0x2f61ae-0x0;var _0x11f834=_0x3be7[_0x2f61ae];return _0x11f834;};'use strict';var _=require(_0x73be('0x0'));var util=require('util');var moment=require(_0x73be('0x1'));var BPromise=require(_0x73be('0x2'));var rs=require(_0x73be('0x3'));var fs=require('fs');var Redis=require(_0x73be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x73be('0x5'));var logger=require(_0x73be('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x73be('0x7'));var client=jayson[_0x73be('0x8')]['http']({'port':0x232a});config[_0x73be('0x9')]=_[_0x73be('0xa')](config['redis'],{'host':_0x73be('0xb'),'port':0x18eb});var socket=require(_0x73be('0xc'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x393946,_0x144433,_0x12d872){return new BPromise(function(_0x509602,_0x33e230){return client['request'](_0x393946,_0x12d872)['then'](function(_0x5175e7){logger[_0x73be('0xd')](_0x73be('0xe'),_0x144433,_0x73be('0xf'));logger[_0x73be('0x10')](_0x73be('0x11'),_0x144433,_0x73be('0xf'),JSON[_0x73be('0x12')](_0x5175e7));if(_0x5175e7['error']){if(_0x5175e7['error'][_0x73be('0x13')]===0x1f4){logger[_0x73be('0x14')](_0x73be('0xe'),_0x144433,_0x5175e7[_0x73be('0x14')][_0x73be('0x15')]);return _0x33e230(_0x5175e7[_0x73be('0x14')][_0x73be('0x15')]);}logger[_0x73be('0x14')](_0x73be('0xe'),_0x144433,_0x5175e7[_0x73be('0x14')][_0x73be('0x15')]);return _0x509602(_0x5175e7[_0x73be('0x14')]['message']);}else{logger[_0x73be('0xd')](_0x73be('0xe'),_0x144433,_0x73be('0xf'));_0x509602(_0x5175e7['result'][_0x73be('0x15')]);}})[_0x73be('0x16')](function(_0xd6d382){logger['error'](_0x73be('0xe'),_0x144433,_0xd6d382);_0x33e230(_0xd6d382);});});}exports[_0x73be('0x17')]=function(_0x3dbda7){var _0xcc8673=this;return new Promise(function(_0x2a8fff,_0x8b1fc1){return db[_0x73be('0x18')][_0x73be('0x19')](_0x3dbda7[_0x73be('0x1a')],{'raw':_0x3dbda7[_0x73be('0x1b')]?_0x3dbda7[_0x73be('0x1b')][_0x73be('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dbda7[_0x73be('0x1b')]?_0x3dbda7[_0x73be('0x1b')][_0x73be('0x1d')]||null:null,'attributes':_0x3dbda7[_0x73be('0x1b')]?_0x3dbda7[_0x73be('0x1b')][_0x73be('0x1e')]||null:null,'limit':_0x3dbda7['options']?_0x3dbda7[_0x73be('0x1b')][_0x73be('0x1f')]||null:null})[_0x73be('0x20')](function(_0x1586f8){logger[_0x73be('0xd')](_0x73be('0x17'),_0x3dbda7);logger[_0x73be('0x10')](_0x73be('0x17'),_0x3dbda7,JSON[_0x73be('0x12')](_0x1586f8));_0x2a8fff(_0x1586f8);})[_0x73be('0x16')](function(_0x4e8c8c){logger['error']('UpdateChatInteraction',_0x4e8c8c['message'],_0x3dbda7);_0x8b1fc1(_0xcc8673[_0x73be('0x14')](0x1f4,_0x4e8c8c[_0x73be('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x56e5aa){return new Promise(function(_0x3b7762,_0x1bd950){return db[_0x73be('0x18')]['find']({'where':_0x56e5aa['options']?_0x56e5aa['options'][_0x73be('0x1d')]||null:null})[_0x73be('0x20')](function(_0xccb28d){if(_0xccb28d){return _0xccb28d['addTags'](_0x56e5aa['body'][_0x73be('0x21')],_[_0x73be('0x22')](_0x56e5aa['body'],[_0x73be('0x21'),'id'])||{});}})[_0x73be('0x23')](function(_0x1c1a7b){logger[_0x73be('0xd')](_0x73be('0x24'),_0x56e5aa);logger[_0x73be('0x10')](_0x73be('0x24'),_0x56e5aa,JSON['stringify'](_0x1c1a7b));_0x3b7762(_0x1c1a7b);})[_0x73be('0x16')](function(_0x3444ab){logger[_0x73be('0x14')](_0x73be('0x24'),_0x3444ab[_0x73be('0x15')],_0x56e5aa);_0x1bd950(_this[_0x73be('0x14')](0x1f4,_0x3444ab[_0x73be('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7422664..e62b5af 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 _0xdb96=['save','remove','update','emit','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdb96,0x187));var _0x6db9=function(_0x2772ac,_0x456670){_0x2772ac=_0x2772ac-0x0;var _0x56e564=_0xdb96[_0x2772ac];return _0x56e564;};'use strict';var ChatInteractionEvents=require(_0x6db9('0x0'));var events=[_0x6db9('0x1'),_0x6db9('0x2'),_0x6db9('0x3')];function createListener(_0x208b2c,_0x21a658){return function(_0x146380){_0x21a658[_0x6db9('0x4')](_0x208b2c,_0x146380);};}function removeListener(_0x514f65,_0x3115fc){return function(){ChatInteractionEvents['removeListener'](_0x514f65,_0x3115fc);};}exports[_0x6db9('0x5')]=function(_0x277029){for(var _0x5103a9=0x0,_0x2bdbd5=events[_0x6db9('0x6')];_0x5103a9<_0x2bdbd5;_0x5103a9++){var _0x3c1168=events[_0x5103a9];var _0xe28e91=createListener(_0x6db9('0x7')+_0x3c1168,_0x277029);ChatInteractionEvents['on'](_0x3c1168,_0xe28e91);}}; \ No newline at end of file +var _0xa0d6=['update','removeListener','register','chatInteraction:','./chatInteraction.events','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa0d6,0x1f0));var _0x6a0d=function(_0x435187,_0x4138f5){_0x435187=_0x435187-0x0;var _0x105aaf=_0xa0d6[_0x435187];return _0x105aaf;};'use strict';var ChatInteractionEvents=require(_0x6a0d('0x0'));var events=[_0x6a0d('0x1'),'remove',_0x6a0d('0x2')];function createListener(_0x414852,_0x1633d9){return function(_0x512a4f){_0x1633d9['emit'](_0x414852,_0x512a4f);};}function removeListener(_0x50e1c8,_0x4bcab4){return function(){ChatInteractionEvents[_0x6a0d('0x3')](_0x50e1c8,_0x4bcab4);};}exports[_0x6a0d('0x4')]=function(_0x525d3b){for(var _0x4ec26e=0x0,_0x172d9a=events['length'];_0x4ec26e<_0x172d9a;_0x4ec26e++){var _0x123a87=events[_0x4ec26e];var _0x1f7595=createListener(_0x6a0d('0x5')+_0x123a87,_0x525d3b);ChatInteractionEvents['on'](_0x123a87,_0x1f7595);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 7544507..fc1fbf6 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 _0xd921=['put','tracked','chatinteraction:update','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','createVidaooSession','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','chat'];(function(_0x520695,_0x8b07){var _0x147715=function(_0x532d18){while(--_0x532d18){_0x520695['push'](_0x520695['shift']());}};_0x147715(++_0x8b07);}(_0xd921,0x173));var _0x1d92=function(_0x4a3eda,_0x597688){_0x4a3eda=_0x4a3eda-0x0;var _0xbe88b2=_0xd921[_0x4a3eda];return _0xbe88b2;};'use strict';var multer=require(_0x1d92('0x0'));var util=require(_0x1d92('0x1'));var path=require(_0x1d92('0x2'));var timeout=require(_0x1d92('0x3'));var express=require(_0x1d92('0x4'));var router=express[_0x1d92('0x5')]();var fs_extra=require(_0x1d92('0x6'));var auth=require(_0x1d92('0x7'));var interaction=require(_0x1d92('0x8'));var config=require(_0x1d92('0x9'));var controller=require(_0x1d92('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x1d92('0xb')]);router[_0x1d92('0xc')](_0x1d92('0xd'),auth[_0x1d92('0xe')](),controller['describe']);router[_0x1d92('0xc')](_0x1d92('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x1d92('0x10')]);router[_0x1d92('0xc')](_0x1d92('0x11'),auth[_0x1d92('0x12')](),controller['attachmentDownload']);router[_0x1d92('0xc')](_0x1d92('0x13'),auth[_0x1d92('0xe')](),controller[_0x1d92('0x14')]);router['get']('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0x1d92('0x15')]);router[_0x1d92('0xc')](_0x1d92('0x16'),auth[_0x1d92('0xe')](),controller[_0x1d92('0x17')]);router[_0x1d92('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1d92('0x18')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x1d92('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x526c91,_0x477afc,_0x17013a){_0x17013a(null,path['join'](config[_0x1d92('0x1a')],_0x1d92('0x1b')));},'filename':function(_0x3dc697,_0x4dd240,_0x3876a9){_0x3876a9(null,util[_0x1d92('0x1c')](_0x1d92('0x1d'),Date['now'](),_0x4dd240[_0x1d92('0x1e')][_0x1d92('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x1d92('0x20'),upload['single'](_0x1d92('0x21')),controller[_0x1d92('0x22')]);router[_0x1d92('0x18')](_0x1d92('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x1d92('0x23')]);router[_0x1d92('0x18')]('/:id/tags',auth[_0x1d92('0xe')](),interaction['tracked'](_0x1d92('0x24'),'chatinteraction:addtags'),controller['addTags']);router[_0x1d92('0x25')]('/:id',auth[_0x1d92('0xe')](),interaction[_0x1d92('0x26')](_0x1d92('0x24'),_0x1d92('0x27')),controller[_0x1d92('0x28')]);router['put'](_0x1d92('0x29'),controller['customUpdate']);router['put'](_0x1d92('0x2a'),auth[_0x1d92('0x12')](),controller[_0x1d92('0x2b')]);router[_0x1d92('0x25')](_0x1d92('0x2c'),controller[_0x1d92('0x2d')]);router[_0x1d92('0x2e')]('/:id',auth[_0x1d92('0xe')](),interaction[_0x1d92('0x26')](_0x1d92('0x24'),'chatinteraction:destroy'),controller[_0x1d92('0x2f')]);router['delete'](_0x1d92('0x30'),auth[_0x1d92('0xe')](),controller[_0x1d92('0x31')]);module[_0x1d92('0x32')]=router; \ No newline at end of file +var _0x4f77=['format','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','chat','addTags','put','tracked','chatinteraction:update','update','customUpdate','abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0x4f77,0x14a));var _0x74f7=function(_0x524207,_0x343c59){_0x524207=_0x524207-0x0;var _0x4575ac=_0x4f77[_0x524207];return _0x4575ac;};'use strict';var multer=require(_0x74f7('0x0'));var util=require('util');var path=require(_0x74f7('0x1'));var timeout=require(_0x74f7('0x2'));var express=require('express');var router=express[_0x74f7('0x3')]();var fs_extra=require(_0x74f7('0x4'));var auth=require(_0x74f7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x74f7('0x6'));var controller=require(_0x74f7('0x7'));router[_0x74f7('0x8')]('/',auth[_0x74f7('0x9')](),controller[_0x74f7('0xa')]);router[_0x74f7('0x8')](_0x74f7('0xb'),auth['isAuthenticated'](),controller[_0x74f7('0xc')]);router[_0x74f7('0x8')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x74f7('0xd')]);router[_0x74f7('0x8')](_0x74f7('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x74f7('0xf')]);router[_0x74f7('0x8')](_0x74f7('0x10'),auth['isAuthenticated'](),controller[_0x74f7('0x11')]);router[_0x74f7('0x8')](_0x74f7('0x12'),auth[_0x74f7('0x13')](),controller[_0x74f7('0x14')]);router[_0x74f7('0x8')](_0x74f7('0x15'),auth[_0x74f7('0x9')](),controller['download']);router[_0x74f7('0x16')]('/',auth[_0x74f7('0x9')](),controller[_0x74f7('0x17')]);router[_0x74f7('0x16')](_0x74f7('0x18'),auth['isAuthenticated'](),controller[_0x74f7('0x19')]);var upload=multer({'storage':multer[_0x74f7('0x1a')]({'destination':function(_0x5edbc8,_0x3358cc,_0x26b7e3){_0x26b7e3(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x38853c,_0x3cc509,_0x38f852){_0x38f852(null,util[_0x74f7('0x1b')]('%s-%s',Date[_0x74f7('0x1c')](),_0x3cc509[_0x74f7('0x1d')][_0x74f7('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x74f7('0x1f'),upload[_0x74f7('0x20')]('file'),controller[_0x74f7('0x21')]);router['post'](_0x74f7('0x10'),auth[_0x74f7('0x13')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x74f7('0x9')](),interaction['tracked'](_0x74f7('0x22'),'chatinteraction:addtags'),controller[_0x74f7('0x23')]);router[_0x74f7('0x24')]('/:id',auth[_0x74f7('0x9')](),interaction[_0x74f7('0x25')](_0x74f7('0x22'),_0x74f7('0x26')),controller[_0x74f7('0x27')]);router[_0x74f7('0x24')]('/:id/custom_update',controller[_0x74f7('0x28')]);router[_0x74f7('0x24')]('/:id/abandon',auth[_0x74f7('0x13')](),controller[_0x74f7('0x29')]);router['put'](_0x74f7('0x2a'),controller[_0x74f7('0x2b')]);router[_0x74f7('0x2c')](_0x74f7('0x2d'),auth[_0x74f7('0x9')](),interaction['tracked'](_0x74f7('0x22'),_0x74f7('0x2e')),controller[_0x74f7('0x2f')]);router[_0x74f7('0x2c')](_0x74f7('0x30'),auth[_0x74f7('0x9')](),controller[_0x74f7('0x31')]);module[_0x74f7('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5fb98f1..9d370ba 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 _0x95a9=['TEXT','medium','INTEGER','sequelize','exports'];(function(_0x2a6051,_0x3e0808){var _0x2e2ebb=function(_0xc928a2){while(--_0xc928a2){_0x2a6051['push'](_0x2a6051['shift']());}};_0x2e2ebb(++_0x3e0808);}(_0x95a9,0x139));var _0x995a=function(_0x56ec5f,_0x11f523){_0x56ec5f=_0x56ec5f-0x0;var _0x165691=_0x95a9[_0x56ec5f];return _0x165691;};'use strict';var Sequelize=require(_0x995a('0x0'));module[_0x995a('0x1')]={'body':{'type':Sequelize[_0x995a('0x2')](_0x995a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x995a('0x4')]}}; \ No newline at end of file +var _0x98c1=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0x98c1,0xfe));var _0x198c=function(_0x1db7fb,_0x54396b){_0x1db7fb=_0x1db7fb-0x0;var _0x5dd4c7=_0x98c1[_0x1db7fb];return _0x5dd4c7;};'use strict';var Sequelize=require(_0x198c('0x0'));module['exports']={'body':{'type':Sequelize[_0x198c('0x1')](_0x198c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x198c('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x198c('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 3238841..c580df7 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 _0x2de5=['VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','get','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','showWebBar','sort','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','push','FromId','ToId','-createdAt','all','eml-format','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','reject','update','destroy','then','error','stack','name','send','map','ChatInternalMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge'];(function(_0x46a8dd,_0x36fbb6){var _0x4d91d4=function(_0x40b2ff){while(--_0x40b2ff){_0x46a8dd['push'](_0x46a8dd['shift']());}};_0x4d91d4(++_0x36fbb6);}(_0x2de5,0x1cc));var _0x52de=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x2de5[_0x1589dd];return _0x1bddd1;};'use strict';var emlformat=require(_0x52de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x52de('0x1'));var rp=require(_0x52de('0x2'));var moment=require(_0x52de('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x52de('0x4'));var path=require(_0x52de('0x5'));var sox=require(_0x52de('0x6'));var csv=require('to-csv');var ejs=require(_0x52de('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52de('0x8'));var squel=require(_0x52de('0x9'));var crypto=require('crypto');var jsforce=require(_0x52de('0xa'));var deskjs=require(_0x52de('0xb'));var toCsv=require(_0x52de('0xc'));var querystring=require(_0x52de('0xd'));var Papa=require(_0x52de('0xe'));var Redis=require('ioredis');var authService=require(_0x52de('0xf'));var qs=require(_0x52de('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x52de('0x11'));var utils=require(_0x52de('0x12'));var config=require(_0x52de('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x52de('0x14'))['db'];config['redis']=_[_0x52de('0x15')](config[_0x52de('0x16')],{'host':_0x52de('0x17'),'port':0x18eb});var socket=require(_0x52de('0x18'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x52de('0x19')](socket);function respondWithStatusCode(_0x7fe3fd,_0x238533){_0x238533=_0x238533||0xcc;return function(_0x3b9b1d){if(_0x3b9b1d){return _0x7fe3fd['sendStatus'](_0x238533);}return _0x7fe3fd[_0x52de('0x1a')](_0x238533)[_0x52de('0x1b')]();};}function respondWithResult(_0x196e60,_0x26cd24){_0x26cd24=_0x26cd24||0xc8;return function(_0x2edaba){if(_0x2edaba){return _0x196e60['status'](_0x26cd24)[_0x52de('0x1c')](_0x2edaba);}};}function respondWithFilteredResult(_0x5cb1b4,_0xed46c3){return function(_0x2ecf4f){if(_0x2ecf4f){var _0x14253f=typeof _0xed46c3[_0x52de('0x1d')]===_0x52de('0x1e')&&typeof _0xed46c3['limit']===_0x52de('0x1e');var _0x162aae=_0x2ecf4f[_0x52de('0x1f')];var _0x1afb7a=_0x14253f?0x0:_0xed46c3[_0x52de('0x1d')];var _0x1ff71e=_0x14253f?_0x2ecf4f[_0x52de('0x1f')]:_0xed46c3['offset']+_0xed46c3[_0x52de('0x20')];var _0x11972c;if(_0x1ff71e>=_0x162aae){_0x1ff71e=_0x162aae;_0x11972c=0xc8;}else{_0x11972c=0xce;}_0x5cb1b4['status'](_0x11972c);return _0x5cb1b4[_0x52de('0x21')]('Content-Range',_0x1afb7a+'-'+_0x1ff71e+'/'+_0x162aae)['json'](_0x2ecf4f);}return null;};}function patchUpdates(_0x465182){return function(_0x3e965b){try{jsonpatch['apply'](_0x3e965b,_0x465182,!![]);}catch(_0x2771f1){return BPromise[_0x52de('0x22')](_0x2771f1);}return _0x3e965b['save']();};}function saveUpdates(_0x2dc142,_0x5f56ea){return function(_0x4d173f){if(_0x4d173f){return _0x4d173f[_0x52de('0x23')](_0x2dc142)['then'](function(_0x398c3e){return _0x398c3e;});}return null;};}function removeEntity(_0x35fef5,_0x3f3d2b){return function(_0x4dc3b1){if(_0x4dc3b1){return _0x4dc3b1[_0x52de('0x24')]()[_0x52de('0x25')](function(){_0x35fef5[_0x52de('0x1a')](0xcc)[_0x52de('0x1b')]();});}};}function handleEntityNotFound(_0x2d63b0,_0x542f18){return function(_0x1200e1){if(!_0x1200e1){_0x2d63b0['sendStatus'](0x194);}return _0x1200e1;};}function handleError(_0x17e20c,_0xdcf864){_0xdcf864=_0xdcf864||0x1f4;return function(_0x340126){logger[_0x52de('0x26')](_0x340126[_0x52de('0x27')]);if(_0x340126['name']){delete _0x340126[_0x52de('0x28')];}_0x17e20c[_0x52de('0x1a')](_0xdcf864)[_0x52de('0x29')](_0x340126);};}exports['index']=function(_0x35a43f,_0x31e70b){var _0x1c3ef2={},_0x276f76={},_0x3297eb={'count':0x0,'rows':[]};var _0x166bda=_[_0x52de('0x2a')](db[_0x52de('0x2b')]['rawAttributes'],function(_0x4fa8c3){return{'name':_0x4fa8c3[_0x52de('0x2c')],'type':_0x4fa8c3[_0x52de('0x2d')][_0x52de('0x2e')]};});_0x276f76[_0x52de('0x2f')]=_[_0x52de('0x2a')](_0x166bda,_0x52de('0x28'));_0x276f76[_0x52de('0x30')]=_['keys'](_0x35a43f[_0x52de('0x30')]);_0x276f76[_0x52de('0x31')]=_[_0x52de('0x32')](_0x276f76[_0x52de('0x2f')],_0x276f76[_0x52de('0x30')]);_0x1c3ef2[_0x52de('0x33')]=_[_0x52de('0x32')](_0x276f76[_0x52de('0x2f')],qs[_0x52de('0x34')](_0x35a43f[_0x52de('0x30')][_0x52de('0x34')]));_0x1c3ef2[_0x52de('0x33')]=_0x1c3ef2[_0x52de('0x33')][_0x52de('0x35')]?_0x1c3ef2[_0x52de('0x33')]:_0x276f76[_0x52de('0x2f')];if(!_0x35a43f['query'][_0x52de('0x36')](_0x52de('0x37'))){_0x1c3ef2['limit']=qs[_0x52de('0x20')](_0x35a43f[_0x52de('0x30')][_0x52de('0x20')]);_0x1c3ef2[_0x52de('0x1d')]=qs[_0x52de('0x1d')](_0x35a43f[_0x52de('0x30')][_0x52de('0x1d')]);}_0x1c3ef2['order']=qs['sort'](_0x35a43f[_0x52de('0x30')]['sort']);_0x1c3ef2['where']=qs[_0x52de('0x31')](_[_0x52de('0x38')](_0x35a43f[_0x52de('0x30')],_0x276f76[_0x52de('0x31')]),_0x166bda);if(_0x35a43f[_0x52de('0x30')][_0x52de('0x39')]){_0x1c3ef2[_0x52de('0x3a')]=_[_0x52de('0x3b')](_0x1c3ef2[_0x52de('0x3a')],{'$or':_['map'](_0x166bda,function(_0x344e69){if(_0x344e69[_0x52de('0x2d')]!==_0x52de('0x3c')){var _0x486a10={};_0x486a10[_0x344e69['name']]={'$like':'%'+_0x35a43f[_0x52de('0x30')][_0x52de('0x39')]+'%'};return _0x486a10;}})});}_0x1c3ef2=_[_0x52de('0x3b')]({},_0x1c3ef2,_0x35a43f[_0x52de('0x3d')]);var _0x16e310={'where':_0x1c3ef2['where']};return db[_0x52de('0x2b')][_0x52de('0x1f')](_0x16e310)[_0x52de('0x25')](function(_0x2c8c52){_0x3297eb[_0x52de('0x1f')]=_0x2c8c52;if(_0x35a43f[_0x52de('0x30')]['includeAll']){_0x1c3ef2[_0x52de('0x3e')]=[{'all':!![]}];}return db[_0x52de('0x2b')][_0x52de('0x3f')](_0x1c3ef2);})[_0x52de('0x25')](function(_0x3aea1a){_0x3297eb[_0x52de('0x40')]=_0x3aea1a;return _0x3297eb;})[_0x52de('0x25')](respondWithFilteredResult(_0x31e70b,_0x1c3ef2))[_0x52de('0x41')](handleError(_0x31e70b,null));};exports[_0x52de('0x42')]=function(_0x4efd18,_0x389cb1){var _0x44df40={'raw':!![],'where':{'id':_0x4efd18[_0x52de('0x43')]['id']}},_0x337461={};_0x337461[_0x52de('0x2f')]=_[_0x52de('0x44')](db[_0x52de('0x2b')][_0x52de('0x45')]);_0x337461['query']=_[_0x52de('0x44')](_0x4efd18[_0x52de('0x30')]);_0x337461[_0x52de('0x31')]=_[_0x52de('0x32')](_0x337461['model'],_0x337461['query']);_0x44df40['attributes']=_[_0x52de('0x32')](_0x337461[_0x52de('0x2f')],qs[_0x52de('0x34')](_0x4efd18['query'][_0x52de('0x34')]));_0x44df40[_0x52de('0x33')]=_0x44df40[_0x52de('0x33')][_0x52de('0x35')]?_0x44df40[_0x52de('0x33')]:_0x337461[_0x52de('0x2f')];if(_0x4efd18['query'][_0x52de('0x46')]){_0x44df40[_0x52de('0x3e')]=[{'all':!![]}];}_0x44df40=_[_0x52de('0x3b')]({},_0x44df40,_0x4efd18[_0x52de('0x3d')]);return db[_0x52de('0x2b')][_0x52de('0x47')](_0x44df40)[_0x52de('0x25')](handleEntityNotFound(_0x389cb1,null))[_0x52de('0x25')](respondWithResult(_0x389cb1,null))[_0x52de('0x41')](handleError(_0x389cb1,null));};exports[_0x52de('0x48')]=function(_0x64b4e5,_0x1f3732){return db[_0x52de('0x2b')][_0x52de('0x48')](_0x64b4e5['body'],{})[_0x52de('0x25')](respondWithResult(_0x1f3732,0xc9))['catch'](handleError(_0x1f3732,null));};exports['update']=function(_0xcfd39,_0x59449d){if(_0xcfd39[_0x52de('0x49')]['id']){delete _0xcfd39['body']['id'];}return db['ChatInternalMessage'][_0x52de('0x47')]({'where':{'id':_0xcfd39[_0x52de('0x43')]['id']}})['then'](handleEntityNotFound(_0x59449d,null))['then'](saveUpdates(_0xcfd39[_0x52de('0x49')],null))[_0x52de('0x25')](respondWithResult(_0x59449d,null))['catch'](handleError(_0x59449d,null));};exports['destroy']=function(_0x51aa69,_0x53e71d){return db[_0x52de('0x2b')][_0x52de('0x47')]({'where':{'id':_0x51aa69[_0x52de('0x43')]['id']}})['then'](handleEntityNotFound(_0x53e71d,null))['then'](removeEntity(_0x53e71d,null))[_0x52de('0x41')](handleError(_0x53e71d,null));};exports[_0x52de('0x4a')]=function(_0x32a42c,_0x1d0b67){return db[_0x52de('0x2b')][_0x52de('0x4a')]()[_0x52de('0x25')](respondWithResult(_0x1d0b67,null))[_0x52de('0x41')](handleError(_0x1d0b67,null));};function wrapUser(_0x2ddede){return function(_0x80cdcb){var _0x369b4d=_0x2ddede[_0x52de('0x4b')]({'plain':!![]});_0x369b4d[_0x52de('0x4c')]=[];if(_0x80cdcb){_0x369b4d[_0x52de('0x4d')]=_0x80cdcb[_0x52de('0x4e')];_0x369b4d['lastMessage']=_0x80cdcb;}else{_0x369b4d['lastMessageAt']=moment(0x0)['format'](_0x52de('0x4f'));_0x369b4d['lastMessage']={};}return _0x369b4d;};}exports[_0x52de('0x50')]=function(_0xec1189,_0x15e041,_0x387ca0){var _0x398048=[];return db['User']['findAll']({'where':{'role':[_0x52de('0x51'),_0x52de('0x52'),_0x52de('0x53')]},'attributes':['id',_0x52de('0x54'),_0x52de('0x28'),_0x52de('0x55'),_0x52de('0x56'),_0x52de('0x57'),_0x52de('0x58'),_0x52de('0x59'),'allowmessenger',_0x52de('0x5a')],'order':qs[_0x52de('0x5b')](_0x52de('0x5c')),'include':[{'model':db[_0x52de('0x5d')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x52de('0x25')](function(_0x13a136){if(_0x13a136){var _0x3af0d6=_0xec1189[_0x52de('0x53')][_0x52de('0x4b')]({'plain':!![]});if(!_0x3af0d6)throw new Error(_0x52de('0x5e'));if(_0x3af0d6[_0x52de('0x55')]===_0x52de('0x53')){return db['UserProfileSection'][_0x52de('0x47')]({'where':{'name':_0x52de('0x5f'),'userProfileId':_0x3af0d6[_0x52de('0x60')]},'raw':!![]})['then'](function(_0x3b54e3){if(_0x3b54e3){if(_0x3b54e3[_0x52de('0x61')]===0x0){return db[_0x52de('0x62')]['findAll']({'where':{'sectionId':_0x3b54e3['id']},'raw':!![]})[_0x52de('0x25')](function(_0x376816){var _0x17cb86=[];if(_['isEmpty'](_0x376816)){_0x17cb86=_[_0x52de('0x39')](_0x13a136,function(_0x251389){if(_0x251389[_0x52de('0x55')]!==_0x52de('0x51')){return _0x251389;}});return _0x17cb86;}else{for(var _0x2cdc20=0x0;_0x2cdc20<_0x13a136[_0x52de('0x35')];_0x2cdc20++){var _0xf92186=_0x13a136[_0x2cdc20];if(_0xf92186[_0x52de('0x55')]===_0x52de('0x51')){var _0x4abbfc=_[_0x52de('0x47')](_0x376816,function(_0x2e8caf){return _0x2e8caf['resourceId']===_0xf92186['id'];});if(_0x4abbfc)_0x17cb86[_0x52de('0x63')](_0xf92186);}else{_0x17cb86['push'](_0xf92186);}}return _0x17cb86;}});}else{return _0x13a136;}}else{var _0x232707=_['filter'](_0x13a136,function(_0x3523a8){if(_0x3523a8[_0x52de('0x55')]!==_0x52de('0x51')){return _0x3523a8;}});return _0x232707;}});}else{return _0x13a136;}}})[_0x52de('0x25')](function(_0x55a201){var _0x327776=[];if(_0x55a201){_0x398048=_0x55a201;for(var _0x426a75=0x0;_0x426a75<_0x55a201[_0x52de('0x35')];_0x426a75+=0x1){_0x398048[_0x426a75]['messages']=[];_0x327776['push'](db[_0x52de('0x2b')][_0x52de('0x47')]({'where':{'FromId':[_0xec1189[_0x52de('0x53')]['id'],_0x55a201[_0x426a75]['id']],'ToId':[_0xec1189[_0x52de('0x53')]['id'],_0x55a201[_0x426a75]['id']],'ChatGroupId':null},'attributes':['id',_0x52de('0x4e'),_0x52de('0x64'),_0x52de('0x65'),'read',_0x52de('0x49')],'order':qs[_0x52de('0x5b')](_0x52de('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x52de('0x25')](wrapUser(_0x55a201[_0x426a75])));}return BPromise[_0x52de('0x67')](_0x327776);}return[];})[_0x52de('0x25')](function(_0x376381){return{'rows':_0x376381,'count':_0x376381[_0x52de('0x35')]};})[_0x52de('0x25')](respondWithResult(_0x15e041,null))[_0x52de('0x41')](handleError(_0x15e041,null));}; \ No newline at end of file +var _0xb75e=['fields','attributes','nolimit','sort','where','pick','filter','options','include','findAll','catch','show','params','length','includeAll','find','create','body','describe','lastMessageAt','createdAt','lastMessage','format','getUsers','agent','admin','user','role','userpic','internal','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','messages','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','model','query','keys','filters','intersection'];(function(_0x5c619e,_0xd5d312){var _0x4e4572=function(_0x467172){while(--_0x467172){_0x5c619e['push'](_0x5c619e['shift']());}};_0x4e4572(++_0xd5d312);}(_0xb75e,0x17c));var _0xeb75=function(_0x5a00b4,_0x512c19){_0x5a00b4=_0x5a00b4-0x0;var _0x29f320=_0xb75e[_0x5a00b4];return _0x29f320;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb75('0x0'));var zipdir=require(_0xeb75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb75('0x2'));var moment=require(_0xeb75('0x3'));var BPromise=require(_0xeb75('0x4'));var Mustache=require(_0xeb75('0x5'));var util=require(_0xeb75('0x6'));var path=require(_0xeb75('0x7'));var sox=require(_0xeb75('0x8'));var csv=require('to-csv');var ejs=require(_0xeb75('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb75('0xa'));var squel=require('squel');var crypto=require(_0xeb75('0xb'));var jsforce=require(_0xeb75('0xc'));var deskjs=require(_0xeb75('0xd'));var toCsv=require(_0xeb75('0xe'));var querystring=require(_0xeb75('0xf'));var Papa=require(_0xeb75('0x10'));var Redis=require(_0xeb75('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeb75('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb75('0x13'));var logger=require(_0xeb75('0x14'))(_0xeb75('0x15'));var utils=require(_0xeb75('0x16'));var config=require(_0xeb75('0x17'));var licenseUtil=require(_0xeb75('0x18'));var db=require(_0xeb75('0x19'))['db'];config[_0xeb75('0x1a')]=_[_0xeb75('0x1b')](config[_0xeb75('0x1a')],{'host':_0xeb75('0x1c'),'port':0x18eb});var socket=require(_0xeb75('0x1d'))(new Redis(config[_0xeb75('0x1a')]));require(_0xeb75('0x1e'))[_0xeb75('0x1f')](socket);function respondWithStatusCode(_0x235871,_0x18144f){_0x18144f=_0x18144f||0xcc;return function(_0xe148be){if(_0xe148be){return _0x235871[_0xeb75('0x20')](_0x18144f);}return _0x235871[_0xeb75('0x21')](_0x18144f)[_0xeb75('0x22')]();};}function respondWithResult(_0x5971e3,_0x128cf5){_0x128cf5=_0x128cf5||0xc8;return function(_0x44abc8){if(_0x44abc8){return _0x5971e3[_0xeb75('0x21')](_0x128cf5)[_0xeb75('0x23')](_0x44abc8);}};}function respondWithFilteredResult(_0x5274de,_0x5f510a){return function(_0x2c2973){if(_0x2c2973){var _0x4f65b9=typeof _0x5f510a['offset']==='undefined'&&typeof _0x5f510a[_0xeb75('0x24')]===_0xeb75('0x25');var _0x27e783=_0x2c2973[_0xeb75('0x26')];var _0x2e62ab=_0x4f65b9?0x0:_0x5f510a[_0xeb75('0x27')];var _0x14863c=_0x4f65b9?_0x2c2973['count']:_0x5f510a['offset']+_0x5f510a[_0xeb75('0x24')];var _0x1cfc15;if(_0x14863c>=_0x27e783){_0x14863c=_0x27e783;_0x1cfc15=0xc8;}else{_0x1cfc15=0xce;}_0x5274de[_0xeb75('0x21')](_0x1cfc15);return _0x5274de['set'](_0xeb75('0x28'),_0x2e62ab+'-'+_0x14863c+'/'+_0x27e783)['json'](_0x2c2973);}return null;};}function patchUpdates(_0x1b9616){return function(_0x4acf5f){try{jsonpatch[_0xeb75('0x29')](_0x4acf5f,_0x1b9616,!![]);}catch(_0x5aae0e){return BPromise['reject'](_0x5aae0e);}return _0x4acf5f[_0xeb75('0x2a')]();};}function saveUpdates(_0x425d93,_0x922667){return function(_0x4bf00c){if(_0x4bf00c){return _0x4bf00c[_0xeb75('0x2b')](_0x425d93)[_0xeb75('0x2c')](function(_0xb3890c){return _0xb3890c;});}return null;};}function removeEntity(_0x1f0e1c,_0x17adeb){return function(_0x1e6f40){if(_0x1e6f40){return _0x1e6f40[_0xeb75('0x2d')]()['then'](function(){_0x1f0e1c[_0xeb75('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b21a,_0x347c1f){return function(_0x2e0586){if(!_0x2e0586){_0x20b21a['sendStatus'](0x194);}return _0x2e0586;};}function handleError(_0x7404c7,_0x3f77c0){_0x3f77c0=_0x3f77c0||0x1f4;return function(_0x17b72f){logger[_0xeb75('0x2e')](_0x17b72f[_0xeb75('0x2f')]);if(_0x17b72f[_0xeb75('0x30')]){delete _0x17b72f[_0xeb75('0x30')];}_0x7404c7[_0xeb75('0x21')](_0x3f77c0)[_0xeb75('0x31')](_0x17b72f);};}exports[_0xeb75('0x32')]=function(_0x560bfa,_0x13852b){var _0x32c96e={},_0x3ee683={},_0x170394={'count':0x0,'rows':[]};var _0x35c544=_[_0xeb75('0x33')](db[_0xeb75('0x34')][_0xeb75('0x35')],function(_0x1664a9){return{'name':_0x1664a9['fieldName'],'type':_0x1664a9[_0xeb75('0x36')]['key']};});_0x3ee683[_0xeb75('0x37')]=_['map'](_0x35c544,'name');_0x3ee683[_0xeb75('0x38')]=_[_0xeb75('0x39')](_0x560bfa[_0xeb75('0x38')]);_0x3ee683[_0xeb75('0x3a')]=_['intersection'](_0x3ee683[_0xeb75('0x37')],_0x3ee683[_0xeb75('0x38')]);_0x32c96e['attributes']=_[_0xeb75('0x3b')](_0x3ee683[_0xeb75('0x37')],qs['fields'](_0x560bfa[_0xeb75('0x38')][_0xeb75('0x3c')]));_0x32c96e['attributes']=_0x32c96e[_0xeb75('0x3d')]['length']?_0x32c96e['attributes']:_0x3ee683[_0xeb75('0x37')];if(!_0x560bfa[_0xeb75('0x38')]['hasOwnProperty'](_0xeb75('0x3e'))){_0x32c96e[_0xeb75('0x24')]=qs[_0xeb75('0x24')](_0x560bfa['query'][_0xeb75('0x24')]);_0x32c96e['offset']=qs[_0xeb75('0x27')](_0x560bfa['query']['offset']);}_0x32c96e['order']=qs[_0xeb75('0x3f')](_0x560bfa[_0xeb75('0x38')]['sort']);_0x32c96e[_0xeb75('0x40')]=qs[_0xeb75('0x3a')](_[_0xeb75('0x41')](_0x560bfa[_0xeb75('0x38')],_0x3ee683[_0xeb75('0x3a')]),_0x35c544);if(_0x560bfa['query']['filter']){_0x32c96e[_0xeb75('0x40')]=_['merge'](_0x32c96e[_0xeb75('0x40')],{'$or':_[_0xeb75('0x33')](_0x35c544,function(_0xb4bdad){if(_0xb4bdad[_0xeb75('0x36')]!=='VIRTUAL'){var _0x2215f3={};_0x2215f3[_0xb4bdad['name']]={'$like':'%'+_0x560bfa['query'][_0xeb75('0x42')]+'%'};return _0x2215f3;}})});}_0x32c96e=_['merge']({},_0x32c96e,_0x560bfa[_0xeb75('0x43')]);var _0x463f8b={'where':_0x32c96e[_0xeb75('0x40')]};return db['ChatInternalMessage'][_0xeb75('0x26')](_0x463f8b)['then'](function(_0x166e32){_0x170394[_0xeb75('0x26')]=_0x166e32;if(_0x560bfa[_0xeb75('0x38')]['includeAll']){_0x32c96e[_0xeb75('0x44')]=[{'all':!![]}];}return db[_0xeb75('0x34')][_0xeb75('0x45')](_0x32c96e);})[_0xeb75('0x2c')](function(_0x396d36){_0x170394['rows']=_0x396d36;return _0x170394;})[_0xeb75('0x2c')](respondWithFilteredResult(_0x13852b,_0x32c96e))[_0xeb75('0x46')](handleError(_0x13852b,null));};exports[_0xeb75('0x47')]=function(_0x2e60d6,_0x1462bf){var _0x3860f0={'raw':!![],'where':{'id':_0x2e60d6[_0xeb75('0x48')]['id']}},_0x495d31={};_0x495d31['model']=_[_0xeb75('0x39')](db[_0xeb75('0x34')]['rawAttributes']);_0x495d31['query']=_[_0xeb75('0x39')](_0x2e60d6[_0xeb75('0x38')]);_0x495d31[_0xeb75('0x3a')]=_[_0xeb75('0x3b')](_0x495d31[_0xeb75('0x37')],_0x495d31[_0xeb75('0x38')]);_0x3860f0[_0xeb75('0x3d')]=_['intersection'](_0x495d31['model'],qs[_0xeb75('0x3c')](_0x2e60d6[_0xeb75('0x38')][_0xeb75('0x3c')]));_0x3860f0[_0xeb75('0x3d')]=_0x3860f0['attributes'][_0xeb75('0x49')]?_0x3860f0[_0xeb75('0x3d')]:_0x495d31[_0xeb75('0x37')];if(_0x2e60d6[_0xeb75('0x38')][_0xeb75('0x4a')]){_0x3860f0[_0xeb75('0x44')]=[{'all':!![]}];}_0x3860f0=_['merge']({},_0x3860f0,_0x2e60d6['options']);return db[_0xeb75('0x34')][_0xeb75('0x4b')](_0x3860f0)['then'](handleEntityNotFound(_0x1462bf,null))['then'](respondWithResult(_0x1462bf,null))[_0xeb75('0x46')](handleError(_0x1462bf,null));};exports[_0xeb75('0x4c')]=function(_0x3dd3c5,_0x11793d){return db[_0xeb75('0x34')][_0xeb75('0x4c')](_0x3dd3c5[_0xeb75('0x4d')],{})['then'](respondWithResult(_0x11793d,0xc9))['catch'](handleError(_0x11793d,null));};exports[_0xeb75('0x2b')]=function(_0x117f76,_0x590c26){if(_0x117f76[_0xeb75('0x4d')]['id']){delete _0x117f76[_0xeb75('0x4d')]['id'];}return db[_0xeb75('0x34')]['find']({'where':{'id':_0x117f76[_0xeb75('0x48')]['id']}})['then'](handleEntityNotFound(_0x590c26,null))[_0xeb75('0x2c')](saveUpdates(_0x117f76[_0xeb75('0x4d')],null))[_0xeb75('0x2c')](respondWithResult(_0x590c26,null))['catch'](handleError(_0x590c26,null));};exports[_0xeb75('0x2d')]=function(_0x4cccba,_0x30470e){return db[_0xeb75('0x34')]['find']({'where':{'id':_0x4cccba['params']['id']}})[_0xeb75('0x2c')](handleEntityNotFound(_0x30470e,null))[_0xeb75('0x2c')](removeEntity(_0x30470e,null))[_0xeb75('0x46')](handleError(_0x30470e,null));};exports['describe']=function(_0x2f3ff4,_0x32c70d){return db[_0xeb75('0x34')][_0xeb75('0x4e')]()[_0xeb75('0x2c')](respondWithResult(_0x32c70d,null))[_0xeb75('0x46')](handleError(_0x32c70d,null));};function wrapUser(_0x4e94ba){return function(_0x5b9dec){var _0x1cf056=_0x4e94ba['get']({'plain':!![]});_0x1cf056['messages']=[];if(_0x5b9dec){_0x1cf056[_0xeb75('0x4f')]=_0x5b9dec[_0xeb75('0x50')];_0x1cf056[_0xeb75('0x51')]=_0x5b9dec;}else{_0x1cf056[_0xeb75('0x4f')]=moment(0x0)[_0xeb75('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cf056[_0xeb75('0x51')]={};}return _0x1cf056;};}exports[_0xeb75('0x53')]=function(_0x57a30b,_0x209dda,_0x21ae40){var _0xa2a09f=[];return db['User'][_0xeb75('0x45')]({'where':{'role':[_0xeb75('0x54'),_0xeb75('0x55'),_0xeb75('0x56')]},'attributes':['id','fullname',_0xeb75('0x30'),_0xeb75('0x57'),_0xeb75('0x58'),_0xeb75('0x59'),'online',_0xeb75('0x5a'),_0xeb75('0x5b'),'showWebBar'],'order':qs[_0xeb75('0x3f')](_0xeb75('0x5c')),'include':[{'model':db[_0xeb75('0x5d')],'as':_0xeb75('0x5e'),'attributes':['id',_0xeb75('0x30'),_0xeb75('0x36')],'through':{'attributes':[]}}]})[_0xeb75('0x2c')](function(_0x4f8379){if(_0x4f8379){var _0x5a2bdf=_0x57a30b['user'][_0xeb75('0x5f')]({'plain':!![]});if(!_0x5a2bdf)throw new Error(_0xeb75('0x60'));if(_0x5a2bdf[_0xeb75('0x57')]===_0xeb75('0x56')){return db[_0xeb75('0x61')][_0xeb75('0x4b')]({'where':{'name':_0xeb75('0x62'),'userProfileId':_0x5a2bdf[_0xeb75('0x63')]},'raw':!![]})[_0xeb75('0x2c')](function(_0x11e21e){if(_0x11e21e){if(_0x11e21e[_0xeb75('0x64')]===0x0){return db['UserProfileResource'][_0xeb75('0x45')]({'where':{'sectionId':_0x11e21e['id']},'raw':!![]})[_0xeb75('0x2c')](function(_0x361078){var _0x9404ac=[];if(_[_0xeb75('0x65')](_0x361078)){_0x9404ac=_['filter'](_0x4f8379,function(_0x275db9){if(_0x275db9['role']!==_0xeb75('0x54')){return _0x275db9;}});return _0x9404ac;}else{for(var _0x68eb68=0x0;_0x68eb68<_0x4f8379[_0xeb75('0x49')];_0x68eb68++){var _0x52d326=_0x4f8379[_0x68eb68];if(_0x52d326[_0xeb75('0x57')]===_0xeb75('0x54')){var _0x44b9aa=_[_0xeb75('0x4b')](_0x361078,function(_0x44abab){return _0x44abab[_0xeb75('0x66')]===_0x52d326['id'];});if(_0x44b9aa)_0x9404ac[_0xeb75('0x67')](_0x52d326);}else{_0x9404ac[_0xeb75('0x67')](_0x52d326);}}return _0x9404ac;}});}else{return _0x4f8379;}}else{var _0x3a11fe=_[_0xeb75('0x42')](_0x4f8379,function(_0x5ca380){if(_0x5ca380[_0xeb75('0x57')]!==_0xeb75('0x54')){return _0x5ca380;}});return _0x3a11fe;}});}else{return _0x4f8379;}}})['then'](function(_0x4031b2){var _0x20ac77=[];if(_0x4031b2){_0xa2a09f=_0x4031b2;for(var _0x25fe64=0x0;_0x25fe64<_0x4031b2[_0xeb75('0x49')];_0x25fe64+=0x1){_0xa2a09f[_0x25fe64][_0xeb75('0x68')]=[];_0x20ac77['push'](db[_0xeb75('0x34')][_0xeb75('0x4b')]({'where':{'FromId':[_0x57a30b[_0xeb75('0x56')]['id'],_0x4031b2[_0x25fe64]['id']],'ToId':[_0x57a30b[_0xeb75('0x56')]['id'],_0x4031b2[_0x25fe64]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xeb75('0x69'),_0xeb75('0x6a'),_0xeb75('0x6b'),_0xeb75('0x4d')],'order':qs[_0xeb75('0x3f')](_0xeb75('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x4031b2[_0x25fe64])));}return BPromise[_0xeb75('0x6d')](_0x20ac77);}return[];})[_0xeb75('0x2c')](function(_0x196f87){return{'rows':_0x196f87,'count':_0x196f87[_0xeb75('0x49')]};})['then'](respondWithResult(_0x209dda,null))['catch'](handleError(_0x209dda,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a4c8840..de95fc6 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 _0xf1c4=['remove','emit','hook','exports','ChatInternalMessage','setMaxListeners','save'];(function(_0x357049,_0x4bc490){var _0x44575a=function(_0x470956){while(--_0x470956){_0x357049['push'](_0x357049['shift']());}};_0x44575a(++_0x4bc490);}(_0xf1c4,0x15b));var _0x4f1c=function(_0x45f1a0,_0x23609e){_0x45f1a0=_0x45f1a0-0x0;var _0x1426ed=_0xf1c4[_0x45f1a0];return _0x1426ed;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x4f1c('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4f1c('0x1')](0x0);var events={'afterCreate':_0x4f1c('0x2'),'afterUpdate':'update','afterDestroy':_0x4f1c('0x3')};function emitEvent(_0x4ba6ed){return function(_0x38b455,_0x31fd77,_0x22d586){ChatInternalMessageEvents[_0x4f1c('0x4')](_0x4ba6ed+':'+_0x38b455['id'],_0x38b455);ChatInternalMessageEvents['emit'](_0x4ba6ed,_0x38b455);_0x22d586(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x4f1c('0x5')](e,emitEvent(event));}}module[_0x4f1c('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x020b=['update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x186b48,_0x55ad77){var _0x3eb738=function(_0x35c72d){while(--_0x35c72d){_0x186b48['push'](_0x186b48['shift']());}};_0x3eb738(++_0x55ad77);}(_0x020b,0x1d8));var _0xb020=function(_0x6f9689,_0x3e270a){_0x6f9689=_0x6f9689-0x0;var _0x918ac1=_0x020b[_0x6f9689];return _0x918ac1;};'use strict';var EventEmitter=require(_0xb020('0x0'));var ChatInternalMessage=require(_0xb020('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb020('0x2'),'afterDestroy':_0xb020('0x3')};function emitEvent(_0x4980e0){return function(_0x391c73,_0x4f98fd,_0x3a2e9c){ChatInternalMessageEvents[_0xb020('0x4')](_0x4980e0+':'+_0x391c73['id'],_0x391c73);ChatInternalMessageEvents['emit'](_0x4980e0,_0x391c73);_0x3a2e9c(null);};}for(var e in events){if(events[_0xb020('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 75b8904..98b957f 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 _0x9c5d=['ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9c5d,0x65));var _0xd9c5=function(_0x149a9b,_0x5bb275){_0x149a9b=_0x149a9b-0x0;var _0x2c2bf6=_0x9c5d[_0x149a9b];return _0x2c2bf6;};'use strict';var _=require(_0xd9c5('0x0'));var util=require('util');var logger=require(_0xd9c5('0x1'))(_0xd9c5('0x2'));var moment=require(_0xd9c5('0x3'));var BPromise=require(_0xd9c5('0x4'));var rp=require(_0xd9c5('0x5'));var fs=require('fs');var path=require(_0xd9c5('0x6'));var rimraf=require(_0xd9c5('0x7'));var config=require('../../config/environment');var attributes=require(_0xd9c5('0x8'));module[_0xd9c5('0x9')]=function(_0x2c7af6,_0x914591){return _0x2c7af6[_0xd9c5('0xa')](_0xd9c5('0xb'),attributes,{'tableName':_0xd9c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9c5('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfa0a=['utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0xfa0a,0x15e));var _0xafa0=function(_0x1fa3e2,_0x58020c){_0x1fa3e2=_0x1fa3e2-0x0;var _0x1261fc=_0xfa0a[_0x1fa3e2];return _0x1261fc;};'use strict';var _=require(_0xafa0('0x0'));var util=require(_0xafa0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xafa0('0x2'));var BPromise=require('bluebird');var rp=require(_0xafa0('0x3'));var fs=require('fs');var path=require(_0xafa0('0x4'));var rimraf=require('rimraf');var config=require(_0xafa0('0x5'));var attributes=require(_0xafa0('0x6'));module['exports']=function(_0x11cc5c,_0x5653d9){return _0x11cc5c[_0xafa0('0x7')](_0xafa0('0x8'),attributes,{'tableName':_0xafa0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xafa0('0xa'),'collate':_0xafa0('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 488a9c2..eda6471 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 _0xc910=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x373992,_0x2376c6){var _0x12608a=function(_0x1c5d0b){while(--_0x1c5d0b){_0x373992['push'](_0x373992['shift']());}};_0x12608a(++_0x2376c6);}(_0xc910,0x1e1));var _0x0c91=function(_0x11828d,_0x88e047){_0x11828d=_0x11828d-0x0;var _0x269949=_0xc910[_0x11828d];return _0x269949;};'use strict';var _=require('lodash');var util=require(_0x0c91('0x0'));var moment=require(_0x0c91('0x1'));var BPromise=require('bluebird');var rs=require(_0x0c91('0x2'));var fs=require('fs');var Redis=require(_0x0c91('0x3'));var db=require(_0x0c91('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c91('0x5'))(_0x0c91('0x6'));var config=require(_0x0c91('0x7'));var jayson=require(_0x0c91('0x8'));var client=jayson[_0x0c91('0x9')][_0x0c91('0xa')]({'port':0x232a});config[_0x0c91('0xb')]=_['defaults'](config[_0x0c91('0xb')],{'host':_0x0c91('0xc'),'port':0x18eb});var socket=require(_0x0c91('0xd'))(new Redis(config[_0x0c91('0xb')]));require('./chatInternalMessage.socket')[_0x0c91('0xe')](socket);function respondWithRpcPromise(_0x291912,_0x5b466d,_0x52b006){return new BPromise(function(_0x483b1b,_0x481185){return client[_0x0c91('0xf')](_0x291912,_0x52b006)['then'](function(_0x158485){logger['info'](_0x0c91('0x10'),_0x5b466d,_0x0c91('0x11'));logger[_0x0c91('0x12')](_0x0c91('0x13'),_0x5b466d,_0x0c91('0x11'),JSON[_0x0c91('0x14')](_0x158485));if(_0x158485[_0x0c91('0x15')]){if(_0x158485[_0x0c91('0x15')][_0x0c91('0x16')]===0x1f4){logger[_0x0c91('0x15')](_0x0c91('0x10'),_0x5b466d,_0x158485[_0x0c91('0x15')][_0x0c91('0x17')]);return _0x481185(_0x158485['error'][_0x0c91('0x17')]);}logger[_0x0c91('0x15')](_0x0c91('0x10'),_0x5b466d,_0x158485[_0x0c91('0x15')][_0x0c91('0x17')]);return _0x483b1b(_0x158485[_0x0c91('0x15')][_0x0c91('0x17')]);}else{logger[_0x0c91('0x18')](_0x0c91('0x10'),_0x5b466d,_0x0c91('0x11'));_0x483b1b(_0x158485[_0x0c91('0x19')][_0x0c91('0x17')]);}})[_0x0c91('0x1a')](function(_0x593130){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x5b466d,_0x593130);_0x481185(_0x593130);});});} \ No newline at end of file +var _0xa70f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x38b643,_0x14dc0d){var _0x23cf24=function(_0x39e013){while(--_0x39e013){_0x38b643['push'](_0x38b643['shift']());}};_0x23cf24(++_0x14dc0d);}(_0xa70f,0x1f4));var _0xfa70=function(_0x2ae73b,_0x384dd1){_0x2ae73b=_0x2ae73b-0x0;var _0x4c56e0=_0xa70f[_0x2ae73b];return _0x4c56e0;};'use strict';var _=require('lodash');var util=require(_0xfa70('0x0'));var moment=require(_0xfa70('0x1'));var BPromise=require(_0xfa70('0x2'));var rs=require(_0xfa70('0x3'));var fs=require('fs');var Redis=require(_0xfa70('0x4'));var db=require(_0xfa70('0x5'))['db'];var utils=require(_0xfa70('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfa70('0x7'));var jayson=require(_0xfa70('0x8'));var client=jayson['client'][_0xfa70('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xfa70('0xa'),'port':0x18eb});var socket=require(_0xfa70('0xb'))(new Redis(config['redis']));require(_0xfa70('0xc'))[_0xfa70('0xd')](socket);function respondWithRpcPromise(_0x1c4743,_0x3b452a,_0x1e8d20){return new BPromise(function(_0x1814b4,_0x3606c7){return client['request'](_0x1c4743,_0x1e8d20)[_0xfa70('0xe')](function(_0x4b5644){logger[_0xfa70('0xf')](_0xfa70('0x10'),_0x3b452a,_0xfa70('0x11'));logger['debug'](_0xfa70('0x12'),_0x3b452a,'request\x20sent',JSON[_0xfa70('0x13')](_0x4b5644));if(_0x4b5644[_0xfa70('0x14')]){if(_0x4b5644[_0xfa70('0x14')]['code']===0x1f4){logger[_0xfa70('0x14')](_0xfa70('0x10'),_0x3b452a,_0x4b5644[_0xfa70('0x14')][_0xfa70('0x15')]);return _0x3606c7(_0x4b5644[_0xfa70('0x14')][_0xfa70('0x15')]);}logger['error'](_0xfa70('0x10'),_0x3b452a,_0x4b5644[_0xfa70('0x14')]['message']);return _0x1814b4(_0x4b5644[_0xfa70('0x14')][_0xfa70('0x15')]);}else{logger[_0xfa70('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x3b452a,_0xfa70('0x11'));_0x1814b4(_0x4b5644[_0xfa70('0x16')][_0xfa70('0x15')]);}})[_0xfa70('0x17')](function(_0x407940){logger['error'](_0xfa70('0x10'),_0x3b452a,_0x407940);_0x3606c7(_0x407940);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4277018..cd5bfda 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 _0xf830=['./chatInternalMessage.events','save','emit','removeListener','register'];(function(_0x591f14,_0x490274){var _0x236a70=function(_0x30ed3f){while(--_0x30ed3f){_0x591f14['push'](_0x591f14['shift']());}};_0x236a70(++_0x490274);}(_0xf830,0xb4));var _0x0f83=function(_0x44bad6,_0x156b4d){_0x44bad6=_0x44bad6-0x0;var _0x1711e7=_0xf830[_0x44bad6];return _0x1711e7;};'use strict';var ChatInternalMessageEvents=require(_0x0f83('0x0'));var events=[_0x0f83('0x1'),'remove','update'];function createListener(_0x90a1e0,_0x5225e5){return function(_0x584ad6){_0x5225e5[_0x0f83('0x2')](_0x90a1e0,_0x584ad6);};}function removeListener(_0x53ba87,_0x1f3b29){return function(){ChatInternalMessageEvents[_0x0f83('0x3')](_0x53ba87,_0x1f3b29);};}exports[_0x0f83('0x4')]=function(_0xa1467e){for(var _0x1f4a7b=0x0,_0xf310e9=events['length'];_0x1f4a7b<_0xf310e9;_0x1f4a7b++){var _0x256e0b=events[_0x1f4a7b];var _0x72d29e=createListener('chatInternalMessage:'+_0x256e0b,_0xa1467e);ChatInternalMessageEvents['on'](_0x256e0b,_0x72d29e);}}; \ No newline at end of file +var _0xa9b6=['length','./chatInternalMessage.events','save','register'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0xa9b6,0x1d9));var _0x6a9b=function(_0x1561ef,_0x4e433b){_0x1561ef=_0x1561ef-0x0;var _0x2668aa=_0xa9b6[_0x1561ef];return _0x2668aa;};'use strict';var ChatInternalMessageEvents=require(_0x6a9b('0x0'));var events=[_0x6a9b('0x1'),'remove','update'];function createListener(_0x22fb0e,_0x5e5eb2){return function(_0x576b06){_0x5e5eb2['emit'](_0x22fb0e,_0x576b06);};}function removeListener(_0xb851f6,_0x1ef5b5){return function(){ChatInternalMessageEvents['removeListener'](_0xb851f6,_0x1ef5b5);};}exports[_0x6a9b('0x2')]=function(_0x46fa54){for(var _0x192b17=0x0,_0xa49665=events[_0x6a9b('0x3')];_0x192b17<_0xa49665;_0x192b17++){var _0x1e270f=events[_0x192b17];var _0x2d92ac=createListener('chatInternalMessage:'+_0x1e270f,_0x46fa54);ChatInternalMessageEvents['on'](_0x1e270f,_0x2d92ac);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index e0f17cc..1842678 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 _0x299f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','getUsers','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x299f,0x162));var _0xf299=function(_0x5dddc3,_0x5549eb){_0x5dddc3=_0x5dddc3-0x0;var _0x272ab0=_0x299f[_0x5dddc3];return _0x272ab0;};'use strict';var multer=require('multer');var util=require(_0xf299('0x0'));var path=require(_0xf299('0x1'));var timeout=require(_0xf299('0x2'));var express=require('express');var router=express[_0xf299('0x3')]();var fs_extra=require(_0xf299('0x4'));var auth=require(_0xf299('0x5'));var interaction=require(_0xf299('0x6'));var config=require(_0xf299('0x7'));var controller=require('./chatInternalMessage.controller');router[_0xf299('0x8')]('/',auth[_0xf299('0x9')](),controller['index']);router[_0xf299('0x8')](_0xf299('0xa'),auth[_0xf299('0x9')](),controller[_0xf299('0xb')]);router[_0xf299('0x8')]('/users',auth[_0xf299('0x9')](),controller[_0xf299('0xc')]);router[_0xf299('0x8')](_0xf299('0xd'),auth[_0xf299('0x9')](),controller[_0xf299('0xe')]);router[_0xf299('0xf')]('/',auth[_0xf299('0x9')](),controller[_0xf299('0x10')]);router['put'](_0xf299('0xd'),controller[_0xf299('0x11')]);router[_0xf299('0x12')]('/:id',auth[_0xf299('0x9')](),controller[_0xf299('0x13')]);module[_0xf299('0x14')]=router; \ No newline at end of file +var _0xbfc6=['destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','/describe','isAuthenticated','get','/:id','show','post','put','update'];(function(_0x20f291,_0x2fc7ad){var _0x1297f0=function(_0x503c05){while(--_0x503c05){_0x20f291['push'](_0x20f291['shift']());}};_0x1297f0(++_0x2fc7ad);}(_0xbfc6,0x162));var _0x6bfc=function(_0xd32f36,_0x4bfdd0){_0xd32f36=_0xd32f36-0x0;var _0x532739=_0xbfc6[_0xd32f36];return _0x532739;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6bfc('0x0'));var timeout=require('connect-timeout');var express=require(_0x6bfc('0x1'));var router=express[_0x6bfc('0x2')]();var fs_extra=require(_0x6bfc('0x3'));var auth=require(_0x6bfc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6bfc('0x5'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6bfc('0x6'),auth[_0x6bfc('0x7')](),controller['describe']);router[_0x6bfc('0x8')]('/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x6bfc('0x8')](_0x6bfc('0x9'),auth[_0x6bfc('0x7')](),controller[_0x6bfc('0xa')]);router[_0x6bfc('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6bfc('0xc')]('/:id',controller[_0x6bfc('0xd')]);router['delete'](_0x6bfc('0x9'),auth[_0x6bfc('0x7')](),controller[_0x6bfc('0xe')]);module[_0x6bfc('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 65743d1..b5296b3 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 _0xe3d4=['out','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x7e5acc,_0x1db80d){var _0xcefbac=function(_0x51e20f){while(--_0x51e20f){_0x7e5acc['push'](_0x7e5acc['shift']());}};_0xcefbac(++_0x1db80d);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x474035,_0x41e639){_0x474035=_0x474035-0x0;var _0x1b58e0=_0xe3d4[_0x474035];return _0x1b58e0;};'use strict';var Sequelize=require('sequelize');module[_0x4e3d('0x0')]={'body':{'type':Sequelize[_0x4e3d('0x1')](_0x4e3d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4e3d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4e3d('0x4')]('in','out'),'defaultValue':_0x4e3d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4e3d('0x6')]},'providerResponse':{'type':Sequelize[_0x4e3d('0x1')]}}; \ No newline at end of file +var _0xdc9b=['TEXT','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x3605c1,_0x33e1df){var _0xd0b227=function(_0x4f136c){while(--_0x4f136c){_0x3605c1['push'](_0x3605c1['shift']());}};_0xd0b227(++_0x33e1df);}(_0xdc9b,0x70));var _0xbdc9=function(_0x2c7b9f,_0x2e54cd){_0x2c7b9f=_0x2c7b9f-0x0;var _0x5dc961=_0xdc9b[_0x2c7b9f];return _0x5dc961;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'body':{'type':Sequelize[_0xbdc9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xbdc9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbdc9('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbdc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 00142a2..730ab1e 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 _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x35485b,_0x1d5610){var _0x531df0=function(_0x2be97a){while(--_0x2be97a){_0x35485b['push'](_0x35485b['shift']());}};_0x531df0(++_0x1d5610);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x47215c,_0x3c298a){var _0x2ac47c=function(_0x557dc7){while(--_0x557dc7){_0x47215c['push'](_0x47215c['shift']());}};_0x2ac47c(++_0x3c298a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5c8719b..9273b8c 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 _0xf632=['../../mysqldb','save','update','emit','hasOwnProperty','exports','events'];(function(_0x475f1f,_0x16af02){var _0x2b4d83=function(_0x1b6510){while(--_0x1b6510){_0x475f1f['push'](_0x475f1f['shift']());}};_0x2b4d83(++_0x16af02);}(_0xf632,0xca));var _0x2f63=function(_0x27f208,_0x1bbf49){_0x27f208=_0x27f208-0x0;var _0xdf34c5=_0xf632[_0x27f208];return _0xdf34c5;};'use strict';var EventEmitter=require(_0x2f63('0x0'));var ChatMessage=require(_0x2f63('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2f63('0x2'),'afterUpdate':_0x2f63('0x3'),'afterDestroy':'remove'};function emitEvent(_0x171cd0){return function(_0x37a0f0,_0x76e280,_0x1d73f4){ChatMessageEvents[_0x2f63('0x4')](_0x171cd0+':'+_0x37a0f0['id'],_0x37a0f0);ChatMessageEvents[_0x2f63('0x4')](_0x171cd0,_0x37a0f0);_0x1d73f4(null);};}for(var e in events){if(events[_0x2f63('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x2f63('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x205a=['remove','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x205a,0x96));var _0xa205=function(_0x2102c1,_0x15a0d7){_0x2102c1=_0x2102c1-0x0;var _0x4fcc88=_0x205a[_0x2102c1];return _0x4fcc88;};'use strict';var EventEmitter=require(_0xa205('0x0'));var ChatMessage=require(_0xa205('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa205('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa205('0x3'),'afterDestroy':_0xa205('0x4')};function emitEvent(_0x4b23b4){return function(_0x465ab8,_0x20c53a,_0x31b342){ChatMessageEvents['emit'](_0x4b23b4+':'+_0x465ab8['id'],_0x465ab8);ChatMessageEvents['emit'](_0x4b23b4,_0x465ab8);_0x31b342(null);};}for(var e in events){if(events[_0xa205('0x5')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xa205('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1b8278a..791aeed 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 _0xabcb=['body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages'];(function(_0x4a88b6,_0xd2340b){var _0x10ee68=function(_0x29d5be){while(--_0x29d5be){_0x4a88b6['push'](_0x4a88b6['shift']());}};_0x10ee68(++_0xd2340b);}(_0xabcb,0xf9));var _0xbabc=function(_0x33f6fa,_0x778d78){_0x33f6fa=_0x33f6fa-0x0;var _0x38abbe=_0xabcb[_0x33f6fa];return _0x38abbe;};'use strict';var _=require('lodash');var util=require(_0xbabc('0x0'));var logger=require(_0xbabc('0x1'))(_0xbabc('0x2'));var moment=require(_0xbabc('0x3'));var BPromise=require(_0xbabc('0x4'));var rp=require(_0xbabc('0x5'));var fs=require('fs');var path=require(_0xbabc('0x6'));var rimraf=require(_0xbabc('0x7'));var config=require(_0xbabc('0x8'));var attributes=require(_0xbabc('0x9'));module[_0xbabc('0xa')]=function(_0x2dd09d,_0x477329){return _0x2dd09d[_0xbabc('0xb')](_0xbabc('0xc'),attributes,{'tableName':_0xbabc('0xd'),'paranoid':![],'indexes':[{'name':_0xbabc('0xe'),'fields':[_0xbabc('0xf')],'type':_0xbabc('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22a59c,_0x5b2923,_0x290cb8){var _0xf6ac41=_0x2dd09d[_0xbabc('0x11')];var _0x4bd932=_0x22a59c[_0xbabc('0x12')]({'plain':!![]});if(_0x4bd932[_0xbabc('0x13')][_0xbabc('0x14')]()==='in'||_0x4bd932[_0xbabc('0x13')]['toLowerCase']()===_0xbabc('0x15')&&!_0x4bd932[_0xbabc('0x16')]&&!_[_0xbabc('0x17')](_0x4bd932[_0xbabc('0x18')])){_0xf6ac41[_0xbabc('0x19')][_0xbabc('0x1a')]({'where':{'id':_0x4bd932[_0xbabc('0x1b')]}})['then'](function(_0x29ee85){if(_0x29ee85){_0x29ee85[_0xbabc('0x1c')]({'lastMsgAt':_0x4bd932[_0xbabc('0x1d')],'lastMsgDirection':_0x4bd932['direction'][_0xbabc('0x14')]()});}})[_0xbabc('0x1e')](function(_0x13066c){console[_0xbabc('0x1f')](_0x13066c);});}_0x290cb8();}},'charset':'utf8mb4','collate':_0xbabc('0x20')});}; \ No newline at end of file +var _0x7007=['toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','FULLTEXT','models','direction'];(function(_0xb41cc4,_0x9805f4){var _0xc00085=function(_0x401ef1){while(--_0x401ef1){_0xb41cc4['push'](_0xb41cc4['shift']());}};_0xc00085(++_0x9805f4);}(_0x7007,0xa3));var _0x7700=function(_0x1c6e2d,_0x474b2f){_0x1c6e2d=_0x1c6e2d-0x0;var _0x4bb8e9=_0x7007[_0x1c6e2d];return _0x4bb8e9;};'use strict';var _=require(_0x7700('0x0'));var util=require('util');var logger=require(_0x7700('0x1'))(_0x7700('0x2'));var moment=require('moment');var BPromise=require(_0x7700('0x3'));var rp=require(_0x7700('0x4'));var fs=require('fs');var path=require(_0x7700('0x5'));var rimraf=require('rimraf');var config=require(_0x7700('0x6'));var attributes=require(_0x7700('0x7'));module[_0x7700('0x8')]=function(_0x368def,_0xe84b33){return _0x368def['define']('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0x7700('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35af85,_0x364f3e,_0x1ac7f4){var _0x3b9e39=_0x368def[_0x7700('0xa')];var _0x30981c=_0x35af85['get']({'plain':!![]});if(_0x30981c['direction']['toLowerCase']()==='in'||_0x30981c[_0x7700('0xb')][_0x7700('0xc')]()===_0x7700('0xd')&&!_0x30981c[_0x7700('0xe')]&&!_[_0x7700('0xf')](_0x30981c[_0x7700('0x10')])){_0x3b9e39[_0x7700('0x11')][_0x7700('0x12')]({'where':{'id':_0x30981c['ChatInteractionId']}})['then'](function(_0xdf478f){if(_0xdf478f){_0xdf478f[_0x7700('0x13')]({'lastMsgAt':_0x30981c[_0x7700('0x14')],'lastMsgDirection':_0x30981c[_0x7700('0xb')][_0x7700('0xc')]()});}})[_0x7700('0x15')](function(_0x15ab92){console[_0x7700('0x16')](_0x15ab92);});}_0x1ac7f4();}},'charset':_0x7700('0x17'),'collate':_0x7700('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 879b641..90921db 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 _0xe4c9=['then','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','ChatMessage','create','options','raw'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xe4c9,0x98));var _0x9e4c=function(_0x148bd2,_0x3338c6){_0x148bd2=_0x148bd2-0x0;var _0x38c56f=_0xe4c9[_0x148bd2];return _0x38c56f;};'use strict';var _=require(_0x9e4c('0x0'));var util=require(_0x9e4c('0x1'));var moment=require(_0x9e4c('0x2'));var BPromise=require(_0x9e4c('0x3'));var rs=require(_0x9e4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e4c('0x5'))['db'];var utils=require(_0x9e4c('0x6'));var logger=require('../../config/logger')(_0x9e4c('0x7'));var config=require('../../config/environment');var jayson=require(_0x9e4c('0x8'));var client=jayson['client'][_0x9e4c('0x9')]({'port':0x232a});config['redis']=_[_0x9e4c('0xa')](config['redis'],{'host':_0x9e4c('0xb'),'port':0x18eb});var socket=require(_0x9e4c('0xc'))(new Redis(config['redis']));require(_0x9e4c('0xd'))[_0x9e4c('0xe')](socket);function respondWithRpcPromise(_0x1731d9,_0x4ab762,_0x5ee79c){return new BPromise(function(_0x3ed511,_0x318c20){return client['request'](_0x1731d9,_0x5ee79c)['then'](function(_0x47adaa){logger[_0x9e4c('0xf')](_0x9e4c('0x10'),_0x4ab762,'request\x20sent');logger[_0x9e4c('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4ab762,_0x9e4c('0x12'),JSON[_0x9e4c('0x13')](_0x47adaa));if(_0x47adaa[_0x9e4c('0x14')]){if(_0x47adaa['error'][_0x9e4c('0x15')]===0x1f4){logger['error'](_0x9e4c('0x10'),_0x4ab762,_0x47adaa[_0x9e4c('0x14')][_0x9e4c('0x16')]);return _0x318c20(_0x47adaa[_0x9e4c('0x14')][_0x9e4c('0x16')]);}logger['error'](_0x9e4c('0x10'),_0x4ab762,_0x47adaa[_0x9e4c('0x14')][_0x9e4c('0x16')]);return _0x3ed511(_0x47adaa[_0x9e4c('0x14')][_0x9e4c('0x16')]);}else{logger['info'](_0x9e4c('0x10'),_0x4ab762,_0x9e4c('0x12'));_0x3ed511(_0x47adaa['result'][_0x9e4c('0x16')]);}})[_0x9e4c('0x17')](function(_0x4af55b){logger[_0x9e4c('0x14')]('ChatMessage,\x20%s,\x20%s',_0x4ab762,_0x4af55b);_0x318c20(_0x4af55b);});});}exports['CreateChatMessage']=function(_0x2aed13){var _0x21b9ea=this;return new Promise(function(_0x10ad61,_0x126e48){return db[_0x9e4c('0x18')][_0x9e4c('0x19')](_0x2aed13['body'],{'raw':_0x2aed13[_0x9e4c('0x1a')]?_0x2aed13[_0x9e4c('0x1a')][_0x9e4c('0x1b')]===undefined?!![]:![]:!![]})[_0x9e4c('0x1c')](function(_0x43b56f){logger['info'](_0x9e4c('0x1d'),_0x2aed13);logger[_0x9e4c('0x11')](_0x9e4c('0x1d'),_0x2aed13,JSON[_0x9e4c('0x13')](_0x43b56f));_0x10ad61(_0x43b56f);})['catch'](function(_0x4d5430){logger[_0x9e4c('0x14')](_0x9e4c('0x1d'),_0x4d5430[_0x9e4c('0x16')],_0x2aed13);_0x126e48(_0x21b9ea['error'](0x1f4,_0x4d5430[_0x9e4c('0x16')]));});});}; \ No newline at end of file +var _0xf549=['./chatMessage.socket','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x1eff96,_0x58701c){var _0x34cac3=function(_0x2a8d4c){while(--_0x2a8d4c){_0x1eff96['push'](_0x1eff96['shift']());}};_0x34cac3(++_0x58701c);}(_0xf549,0x1ac));var _0x9f54=function(_0x310d8d,_0x3e2eb4){_0x310d8d=_0x310d8d-0x0;var _0x142f6b=_0xf549[_0x310d8d];return _0x142f6b;};'use strict';var _=require(_0x9f54('0x0'));var util=require(_0x9f54('0x1'));var moment=require('moment');var BPromise=require(_0x9f54('0x2'));var rs=require(_0x9f54('0x3'));var fs=require('fs');var Redis=require(_0x9f54('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9f54('0x5'));var logger=require('../../config/logger')(_0x9f54('0x6'));var config=require(_0x9f54('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f54('0x8')][_0x9f54('0x9')]({'port':0x232a});config[_0x9f54('0xa')]=_[_0x9f54('0xb')](config[_0x9f54('0xa')],{'host':_0x9f54('0xc'),'port':0x18eb});var socket=require(_0x9f54('0xd'))(new Redis(config['redis']));require(_0x9f54('0xe'))['register'](socket);function respondWithRpcPromise(_0x2074f5,_0x3e08ab,_0x5da62a){return new BPromise(function(_0x391d71,_0xb181ed){return client[_0x9f54('0xf')](_0x2074f5,_0x5da62a)['then'](function(_0x128da0){logger[_0x9f54('0x10')](_0x9f54('0x11'),_0x3e08ab,_0x9f54('0x12'));logger['debug'](_0x9f54('0x13'),_0x3e08ab,_0x9f54('0x12'),JSON[_0x9f54('0x14')](_0x128da0));if(_0x128da0[_0x9f54('0x15')]){if(_0x128da0[_0x9f54('0x15')][_0x9f54('0x16')]===0x1f4){logger[_0x9f54('0x15')](_0x9f54('0x11'),_0x3e08ab,_0x128da0[_0x9f54('0x15')][_0x9f54('0x17')]);return _0xb181ed(_0x128da0[_0x9f54('0x15')][_0x9f54('0x17')]);}logger['error'](_0x9f54('0x11'),_0x3e08ab,_0x128da0[_0x9f54('0x15')][_0x9f54('0x17')]);return _0x391d71(_0x128da0[_0x9f54('0x15')]['message']);}else{logger[_0x9f54('0x10')]('ChatMessage,\x20%s,\x20%s',_0x3e08ab,_0x9f54('0x12'));_0x391d71(_0x128da0[_0x9f54('0x18')][_0x9f54('0x17')]);}})[_0x9f54('0x19')](function(_0x3220d8){logger[_0x9f54('0x15')](_0x9f54('0x11'),_0x3e08ab,_0x3220d8);_0xb181ed(_0x3220d8);});});}exports[_0x9f54('0x1a')]=function(_0x4c16e9){var _0x3075f9=this;return new Promise(function(_0x582b57,_0xc8fc8d){return db[_0x9f54('0x1b')][_0x9f54('0x1c')](_0x4c16e9[_0x9f54('0x1d')],{'raw':_0x4c16e9[_0x9f54('0x1e')]?_0x4c16e9[_0x9f54('0x1e')][_0x9f54('0x1f')]===undefined?!![]:![]:!![]})[_0x9f54('0x20')](function(_0x20bcb6){logger[_0x9f54('0x10')]('CreateChatMessage',_0x4c16e9);logger[_0x9f54('0x21')](_0x9f54('0x1a'),_0x4c16e9,JSON[_0x9f54('0x14')](_0x20bcb6));_0x582b57(_0x20bcb6);})[_0x9f54('0x19')](function(_0x331adc){logger[_0x9f54('0x15')](_0x9f54('0x1a'),_0x331adc[_0x9f54('0x17')],_0x4c16e9);_0xc8fc8d(_0x3075f9[_0x9f54('0x15')](0x1f4,_0x331adc[_0x9f54('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d5a574e..93d9bc3 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 _0x8ad5=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x8ad5,0xf1));var _0x58ad=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8ad5[_0x550d12];return _0x12103d;};'use strict';var ChatMessageEvents=require(_0x58ad('0x0'));var events=[_0x58ad('0x1'),_0x58ad('0x2'),_0x58ad('0x3')];function createListener(_0x4cfe26,_0x5dca8a){return function(_0x1e5eb9){_0x5dca8a[_0x58ad('0x4')](_0x4cfe26,_0x1e5eb9);};}function removeListener(_0x223e54,_0x22aba9){return function(){ChatMessageEvents[_0x58ad('0x5')](_0x223e54,_0x22aba9);};}exports[_0x58ad('0x6')]=function(_0x51d560){for(var _0x5888f7=0x0,_0x394972=events[_0x58ad('0x7')];_0x5888f7<_0x394972;_0x5888f7++){var _0x220c5f=events[_0x5888f7];var _0x2033a3=createListener(_0x58ad('0x8')+_0x220c5f,_0x51d560);ChatMessageEvents['on'](_0x220c5f,_0x2033a3);}}; \ No newline at end of file +var _0xfd87=['./chatMessage.events','save','remove','update','emit','removeListener','length','chatMessage:'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var ChatMessageEvents=require(_0x7fd8('0x0'));var events=[_0x7fd8('0x1'),_0x7fd8('0x2'),_0x7fd8('0x3')];function createListener(_0x11b128,_0x15d25f){return function(_0x2631d9){_0x15d25f[_0x7fd8('0x4')](_0x11b128,_0x2631d9);};}function removeListener(_0x4429f2,_0x43b442){return function(){ChatMessageEvents[_0x7fd8('0x5')](_0x4429f2,_0x43b442);};}exports['register']=function(_0x1395b6){for(var _0x10a778=0x0,_0x55681d=events[_0x7fd8('0x6')];_0x10a778<_0x55681d;_0x10a778++){var _0x6eaf96=events[_0x10a778];var _0x2e2d74=createListener(_0x7fd8('0x7')+_0x6eaf96,_0x1395b6);ChatMessageEvents['on'](_0x6eaf96,_0x2e2d74);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 4ab4a6e..4fe1e98 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 _0x2b2e=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2b2e,0x1e4));var _0xe2b2=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x2b2e[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xe2b2('0x0'));var util=require(_0xe2b2('0x1'));var path=require(_0xe2b2('0x2'));var timeout=require(_0xe2b2('0x3'));var express=require('express');var router=express[_0xe2b2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe2b2('0x5'));var config=require(_0xe2b2('0x6'));var controller=require('./chatMessage.controller');router[_0xe2b2('0x7')]('/',auth[_0xe2b2('0x8')](),controller[_0xe2b2('0x9')]);router[_0xe2b2('0x7')]('/describe',auth[_0xe2b2('0x8')](),controller[_0xe2b2('0xa')]);router[_0xe2b2('0x7')](_0xe2b2('0xb'),auth['isAuthenticated'](),controller[_0xe2b2('0xc')]);router[_0xe2b2('0xd')]('/',auth[_0xe2b2('0x8')](),interaction[_0xe2b2('0xe')](_0xe2b2('0xf'),_0xe2b2('0x10')),controller[_0xe2b2('0x11')]);router[_0xe2b2('0x12')]('/:id',controller[_0xe2b2('0x13')]);router[_0xe2b2('0x12')](_0xe2b2('0x14'),auth[_0xe2b2('0x8')](),controller[_0xe2b2('0x15')]);router[_0xe2b2('0x12')](_0xe2b2('0x16'),auth[_0xe2b2('0x8')](),controller[_0xe2b2('0x17')]);router[_0xe2b2('0x18')](_0xe2b2('0xb'),auth[_0xe2b2('0x8')](),controller[_0xe2b2('0x19')]);module[_0xe2b2('0x1a')]=router; \ No newline at end of file +var _0xa32f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2d5fc4,_0x11a2b5){var _0x1f6d23=function(_0x559ef2){while(--_0x559ef2){_0x2d5fc4['push'](_0x2d5fc4['shift']());}};_0x1f6d23(++_0x11a2b5);}(_0xa32f,0x126));var _0xfa32=function(_0x19ef9c,_0x1965d6){_0x19ef9c=_0x19ef9c-0x0;var _0x1fa6df=_0xa32f[_0x19ef9c];return _0x1fa6df;};'use strict';var multer=require(_0xfa32('0x0'));var util=require(_0xfa32('0x1'));var path=require(_0xfa32('0x2'));var timeout=require(_0xfa32('0x3'));var express=require(_0xfa32('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfa32('0x5'));var interaction=require(_0xfa32('0x6'));var config=require(_0xfa32('0x7'));var controller=require('./chatMessage.controller');router[_0xfa32('0x8')]('/',auth[_0xfa32('0x9')](),controller[_0xfa32('0xa')]);router[_0xfa32('0x8')](_0xfa32('0xb'),auth[_0xfa32('0x9')](),controller[_0xfa32('0xc')]);router[_0xfa32('0x8')](_0xfa32('0xd'),auth[_0xfa32('0x9')](),controller['show']);router[_0xfa32('0xe')]('/',auth[_0xfa32('0x9')](),interaction[_0xfa32('0xf')]('chat',_0xfa32('0x10')),controller['create']);router[_0xfa32('0x11')](_0xfa32('0xd'),controller[_0xfa32('0x12')]);router[_0xfa32('0x11')](_0xfa32('0x13'),auth[_0xfa32('0x9')](),controller[_0xfa32('0x14')]);router[_0xfa32('0x11')](_0xfa32('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0xfa32('0x16')](_0xfa32('0xd'),auth[_0xfa32('0x9')](),controller[_0xfa32('0x17')]);module[_0xfa32('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 133dd05..3aee8a3 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 _0x11f6=['exports','TEXT','medium','sequelize'];(function(_0x18f027,_0x12de68){var _0x15ccd6=function(_0x51c06e){while(--_0x51c06e){_0x18f027['push'](_0x18f027['shift']());}};_0x15ccd6(++_0x12de68);}(_0x11f6,0x1f3));var _0x611f=function(_0x226ac5,_0x181a82){_0x226ac5=_0x226ac5-0x0;var _0x3238a2=_0x11f6[_0x226ac5];return _0x3238a2;};'use strict';var Sequelize=require(_0x611f('0x0'));module[_0x611f('0x1')]={'body':{'type':Sequelize[_0x611f('0x2')](_0x611f('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xc9cd=['TEXT','medium','sequelize','exports'];(function(_0x1c388e,_0x31f2de){var _0x4e2966=function(_0x21688c){while(--_0x21688c){_0x1c388e['push'](_0x1c388e['shift']());}};_0x4e2966(++_0x31f2de);}(_0xc9cd,0x17e));var _0xdc9c=function(_0x4f84c3,_0x6d094d){_0x4f84c3=_0x4f84c3-0x0;var _0x460f9f=_0xc9cd[_0x4f84c3];return _0x460f9f;};'use strict';var Sequelize=require(_0xdc9c('0x0'));module[_0xdc9c('0x1')]={'body':{'type':Sequelize[_0xdc9c('0x2')](_0xdc9c('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 1060050..95bd9e6 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x304a70,_0x5a8f6b){_0x304a70=_0x304a70-0x0;var _0x536f31=_0x7a54[_0x304a70];return _0x536f31;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x546340,_0x2a5e58){_0x546340=_0x546340-0x0;var _0x2cdf4c=_0x7a54[_0x546340];return _0x2cdf4c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 65efd20..2d2defb 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 _0x09cb=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports'];(function(_0x3bd87,_0xa47434){var _0x21329b=function(_0x512118){while(--_0x512118){_0x3bd87['push'](_0x3bd87['shift']());}};_0x21329b(++_0xa47434);}(_0x09cb,0x16d));var _0xb09c=function(_0x310be1,_0xc2e9b4){_0x310be1=_0x310be1-0x0;var _0x5764b5=_0x09cb[_0x310be1];return _0x5764b5;};'use strict';var _=require(_0xb09c('0x0'));var util=require(_0xb09c('0x1'));var logger=require(_0xb09c('0x2'))(_0xb09c('0x3'));var moment=require(_0xb09c('0x4'));var BPromise=require(_0xb09c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb09c('0x6'));var config=require(_0xb09c('0x7'));var attributes=require(_0xb09c('0x8'));module[_0xb09c('0x9')]=function(_0x51d3ab,_0x5a9bf5){return _0x51d3ab[_0xb09c('0xa')](_0xb09c('0xb'),attributes,{'tableName':_0xb09c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb09c('0xd'),'collate':_0xb09c('0xe')});}; \ No newline at end of file +var _0x194c=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4_unicode_ci','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);}(_0x194c,0xc9));var _0xc194=function(_0x39e98e,_0x42d310){_0x39e98e=_0x39e98e-0x0;var _0x1bf2e7=_0x194c[_0x39e98e];return _0x1bf2e7;};'use strict';var _=require('lodash');var util=require(_0xc194('0x0'));var logger=require(_0xc194('0x1'))(_0xc194('0x2'));var moment=require(_0xc194('0x3'));var BPromise=require(_0xc194('0x4'));var rp=require(_0xc194('0x5'));var fs=require('fs');var path=require(_0xc194('0x6'));var rimraf=require(_0xc194('0x7'));var config=require(_0xc194('0x8'));var attributes=require(_0xc194('0x9'));module[_0xc194('0xa')]=function(_0x4818e9,_0x498b37){return _0x4818e9[_0xc194('0xb')](_0xc194('0xc'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc194('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a21b76f..1bd04f6 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 _0xecfd=['request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xb3b6d2,_0x17eb66){var _0x2e88bd=function(_0x19c0ba){while(--_0x19c0ba){_0xb3b6d2['push'](_0xb3b6d2['shift']());}};_0x2e88bd(++_0x17eb66);}(_0xecfd,0x6c));var _0xdecf=function(_0x4dd887,_0x36661f){_0x4dd887=_0x4dd887-0x0;var _0x22ec81=_0xecfd[_0x4dd887];return _0x22ec81;};'use strict';var _=require(_0xdecf('0x0'));var util=require(_0xdecf('0x1'));var moment=require(_0xdecf('0x2'));var BPromise=require(_0xdecf('0x3'));var rs=require(_0xdecf('0x4'));var fs=require('fs');var Redis=require(_0xdecf('0x5'));var db=require(_0xdecf('0x6'))['db'];var utils=require(_0xdecf('0x7'));var logger=require(_0xdecf('0x8'))('rpc');var config=require(_0xdecf('0x9'));var jayson=require(_0xdecf('0xa'));var client=jayson[_0xdecf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44ed02,_0x5d8df9,_0xfbf802){return new BPromise(function(_0x59c374,_0x10c5fc){return client[_0xdecf('0xc')](_0x44ed02,_0xfbf802)['then'](function(_0x27e388){logger[_0xdecf('0xd')](_0xdecf('0xe'),_0x5d8df9,_0xdecf('0xf'));logger[_0xdecf('0x10')](_0xdecf('0x11'),_0x5d8df9,_0xdecf('0xf'),JSON[_0xdecf('0x12')](_0x27e388));if(_0x27e388[_0xdecf('0x13')]){if(_0x27e388[_0xdecf('0x13')][_0xdecf('0x14')]===0x1f4){logger[_0xdecf('0x13')](_0xdecf('0xe'),_0x5d8df9,_0x27e388[_0xdecf('0x13')]['message']);return _0x10c5fc(_0x27e388[_0xdecf('0x13')][_0xdecf('0x15')]);}logger[_0xdecf('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5d8df9,_0x27e388['error'][_0xdecf('0x15')]);return _0x59c374(_0x27e388['error'][_0xdecf('0x15')]);}else{logger[_0xdecf('0xd')](_0xdecf('0xe'),_0x5d8df9,'request\x20sent');_0x59c374(_0x27e388[_0xdecf('0x16')]['message']);}})[_0xdecf('0x17')](function(_0x367f11){logger[_0xdecf('0x13')](_0xdecf('0xe'),_0x5d8df9,_0x367f11);_0x10c5fc(_0x367f11);});});} \ No newline at end of file +var _0x5594=['message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3287a6,_0x35e598){var _0x9c6449=function(_0x407e41){while(--_0x407e41){_0x3287a6['push'](_0x3287a6['shift']());}};_0x9c6449(++_0x35e598);}(_0x5594,0x173));var _0x4559=function(_0x4f65ac,_0x3a582d){_0x4f65ac=_0x4f65ac-0x0;var _0x341fae=_0x5594[_0x4f65ac];return _0x341fae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4559('0x0'));var BPromise=require(_0x4559('0x1'));var rs=require(_0x4559('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4559('0x3'))['db'];var utils=require(_0x4559('0x4'));var logger=require(_0x4559('0x5'))(_0x4559('0x6'));var config=require(_0x4559('0x7'));var jayson=require(_0x4559('0x8'));var client=jayson[_0x4559('0x9')][_0x4559('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50e06e,_0x370a4e,_0x1aaa44){return new BPromise(function(_0x6ef555,_0x3e618b){return client['request'](_0x50e06e,_0x1aaa44)[_0x4559('0xb')](function(_0xa61f5e){logger[_0x4559('0xc')](_0x4559('0xd'),_0x370a4e,_0x4559('0xe'));logger[_0x4559('0xf')](_0x4559('0x10'),_0x370a4e,_0x4559('0xe'),JSON[_0x4559('0x11')](_0xa61f5e));if(_0xa61f5e[_0x4559('0x12')]){if(_0xa61f5e['error'][_0x4559('0x13')]===0x1f4){logger[_0x4559('0x12')](_0x4559('0xd'),_0x370a4e,_0xa61f5e[_0x4559('0x12')][_0x4559('0x14')]);return _0x3e618b(_0xa61f5e[_0x4559('0x12')][_0x4559('0x14')]);}logger[_0x4559('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x370a4e,_0xa61f5e['error'][_0x4559('0x14')]);return _0x6ef555(_0xa61f5e[_0x4559('0x12')][_0x4559('0x14')]);}else{logger[_0x4559('0xc')](_0x4559('0xd'),_0x370a4e,'request\x20sent');_0x6ef555(_0xa61f5e[_0x4559('0x15')][_0x4559('0x14')]);}})[_0x4559('0x16')](function(_0x24dd3e){logger[_0x4559('0x12')](_0x4559('0xd'),_0x370a4e,_0x24dd3e);_0x3e618b(_0x24dd3e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 15056b5..900737a 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 _0xd3b9=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x5953d5,_0x819d59){var _0x56ba7e=function(_0xd0d8bf){while(--_0xd0d8bf){_0x5953d5['push'](_0x5953d5['shift']());}};_0x56ba7e(++_0x819d59);}(_0xd3b9,0x1b5));var _0x9d3b=function(_0x2dc923,_0x218dbb){_0x2dc923=_0x2dc923-0x0;var _0xf50c34=_0xd3b9[_0x2dc923];return _0xf50c34;};'use strict';var multer=require(_0x9d3b('0x0'));var util=require(_0x9d3b('0x1'));var path=require(_0x9d3b('0x2'));var timeout=require(_0x9d3b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9d3b('0x4'));var auth=require(_0x9d3b('0x5'));var interaction=require(_0x9d3b('0x6'));var config=require(_0x9d3b('0x7'));var controller=require(_0x9d3b('0x8'));router[_0x9d3b('0x9')]('/',auth['isAuthenticated'](),controller[_0x9d3b('0xa')]);router[_0x9d3b('0x9')](_0x9d3b('0xb'),auth[_0x9d3b('0xc')](),controller[_0x9d3b('0xd')]);router[_0x9d3b('0x9')]('/:id',auth[_0x9d3b('0xc')](),controller[_0x9d3b('0xe')]);router[_0x9d3b('0xf')]('/',auth[_0x9d3b('0xc')](),controller[_0x9d3b('0x10')]);router[_0x9d3b('0x11')](_0x9d3b('0x12'),auth[_0x9d3b('0xc')](),controller[_0x9d3b('0x13')]);router[_0x9d3b('0x14')](_0x9d3b('0x12'),auth['isAuthenticated'](),controller[_0x9d3b('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb89b=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','show','post','create','put','/:id','delete','multer'];(function(_0x17ccd1,_0x1a553f){var _0x1d9dab=function(_0x5cabc3){while(--_0x5cabc3){_0x17ccd1['push'](_0x17ccd1['shift']());}};_0x1d9dab(++_0x1a553f);}(_0xb89b,0xe9));var _0xbb89=function(_0x31122e,_0x24fbf7){_0x31122e=_0x31122e-0x0;var _0x54922b=_0xb89b[_0x31122e];return _0x54922b;};'use strict';var multer=require(_0xbb89('0x0'));var util=require(_0xbb89('0x1'));var path=require(_0xbb89('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb89('0x3')]();var fs_extra=require(_0xbb89('0x4'));var auth=require(_0xbb89('0x5'));var interaction=require(_0xbb89('0x6'));var config=require('../../config/environment');var controller=require(_0xbb89('0x7'));router[_0xbb89('0x8')]('/',auth['isAuthenticated'](),controller[_0xbb89('0x9')]);router[_0xbb89('0x8')](_0xbb89('0xa'),auth[_0xbb89('0xb')](),controller['describe']);router[_0xbb89('0x8')]('/:id',auth[_0xbb89('0xb')](),controller[_0xbb89('0xc')]);router[_0xbb89('0xd')]('/',auth[_0xbb89('0xb')](),controller[_0xbb89('0xe')]);router[_0xbb89('0xf')](_0xbb89('0x10'),auth[_0xbb89('0xb')](),controller['update']);router[_0xbb89('0x11')](_0xbb89('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7d7c24b..d9bb492 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 _0x0da1=['exports','STRING','ENUM','mouseOver','timeout','sequelize'];(function(_0x4ade04,_0x5b5c74){var _0x3b6a33=function(_0x5877c8){while(--_0x5877c8){_0x4ade04['push'](_0x4ade04['shift']());}};_0x3b6a33(++_0x5b5c74);}(_0x0da1,0x1a9));var _0x10da=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x0da1[_0x4e6ae6];return _0x23c108;};'use strict';var Sequelize=require(_0x10da('0x0'));module[_0x10da('0x1')]={'name':{'type':Sequelize[_0x10da('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x10da('0x3')](_0x10da('0x4'),_0x10da('0x5')),'defaultValue':_0x10da('0x4')},'selector':{'type':Sequelize[_0x10da('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1a90=['STRING','ENUM','mouseOver','INTEGER','sequelize','exports'];(function(_0x136788,_0x130aae){var _0x171eff=function(_0x2352de){while(--_0x2352de){_0x136788['push'](_0x136788['shift']());}};_0x171eff(++_0x130aae);}(_0x1a90,0x166));var _0x01a9=function(_0x57eae2,_0x42a2be){_0x57eae2=_0x57eae2-0x0;var _0x386e2b=_0x1a90[_0x57eae2];return _0x386e2b;};'use strict';var Sequelize=require(_0x01a9('0x0'));module[_0x01a9('0x1')]={'name':{'type':Sequelize[_0x01a9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x01a9('0x3')](_0x01a9('0x4'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x01a9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e7d3529..647198b 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 _0x63b6=['util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','show','params','keys','query','model','attributes','intersection','fields','length','merge','options','ChatProactiveAction','create','body','update','find','catch','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63b6,0x127));var _0x663b=function(_0x3c7a8e,_0x1be6be){_0x3c7a8e=_0x3c7a8e-0x0;var _0x4179fb=_0x63b6[_0x3c7a8e];return _0x4179fb;};'use strict';var emlformat=require(_0x663b('0x0'));var rimraf=require(_0x663b('0x1'));var zipdir=require(_0x663b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x663b('0x3'));var moment=require('moment');var BPromise=require(_0x663b('0x4'));var Mustache=require('mustache');var util=require(_0x663b('0x5'));var path=require(_0x663b('0x6'));var sox=require(_0x663b('0x7'));var csv=require('to-csv');var ejs=require(_0x663b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x663b('0x9'));var squel=require('squel');var crypto=require(_0x663b('0xa'));var jsforce=require(_0x663b('0xb'));var deskjs=require(_0x663b('0xc'));var toCsv=require(_0x663b('0xd'));var querystring=require(_0x663b('0xe'));var Papa=require(_0x663b('0xf'));var Redis=require('ioredis');var authService=require(_0x663b('0x10'));var qs=require(_0x663b('0x11'));var as=require(_0x663b('0x12'));var hardwareService=require(_0x663b('0x13'));var logger=require(_0x663b('0x14'))(_0x663b('0x15'));var utils=require(_0x663b('0x16'));var config=require(_0x663b('0x17'));var licenseUtil=require(_0x663b('0x18'));var db=require(_0x663b('0x19'))['db'];function respondWithStatusCode(_0x4fa8a3,_0x544643){_0x544643=_0x544643||0xcc;return function(_0x1ef28c){if(_0x1ef28c){return _0x4fa8a3[_0x663b('0x1a')](_0x544643);}return _0x4fa8a3[_0x663b('0x1b')](_0x544643)[_0x663b('0x1c')]();};}function respondWithResult(_0x43449a,_0x13cb09){_0x13cb09=_0x13cb09||0xc8;return function(_0x4e263a){if(_0x4e263a){return _0x43449a[_0x663b('0x1b')](_0x13cb09)[_0x663b('0x1d')](_0x4e263a);}};}function respondWithFilteredResult(_0x4738e2,_0x1f8238){return function(_0x343eac){if(_0x343eac){var _0x46db68=typeof _0x1f8238[_0x663b('0x1e')]===_0x663b('0x1f')&&typeof _0x1f8238[_0x663b('0x20')]===_0x663b('0x1f');var _0x26a596=_0x343eac[_0x663b('0x21')];var _0x14be5c=_0x46db68?0x0:_0x1f8238[_0x663b('0x1e')];var _0x4c8a8a=_0x46db68?_0x343eac[_0x663b('0x21')]:_0x1f8238[_0x663b('0x1e')]+_0x1f8238['limit'];var _0x79a64c;if(_0x4c8a8a>=_0x26a596){_0x4c8a8a=_0x26a596;_0x79a64c=0xc8;}else{_0x79a64c=0xce;}_0x4738e2[_0x663b('0x1b')](_0x79a64c);return _0x4738e2['set']('Content-Range',_0x14be5c+'-'+_0x4c8a8a+'/'+_0x26a596)[_0x663b('0x1d')](_0x343eac);}return null;};}function patchUpdates(_0x12a5b7){return function(_0x33a6b9){try{jsonpatch[_0x663b('0x22')](_0x33a6b9,_0x12a5b7,!![]);}catch(_0x50ecbb){return BPromise[_0x663b('0x23')](_0x50ecbb);}return _0x33a6b9[_0x663b('0x24')]();};}function saveUpdates(_0x4b81c1,_0x58b3ce){return function(_0x521a89){if(_0x521a89){return _0x521a89['update'](_0x4b81c1)[_0x663b('0x25')](function(_0x37236e){return _0x37236e;});}return null;};}function removeEntity(_0x2d1b52,_0xf08506){return function(_0x25c295){if(_0x25c295){return _0x25c295[_0x663b('0x26')]()[_0x663b('0x25')](function(){_0x2d1b52[_0x663b('0x1b')](0xcc)[_0x663b('0x1c')]();});}};}function handleEntityNotFound(_0x5063b2,_0x20edcc){return function(_0x158c09){if(!_0x158c09){_0x5063b2['sendStatus'](0x194);}return _0x158c09;};}function handleError(_0x37a5f4,_0x54bb0d){_0x54bb0d=_0x54bb0d||0x1f4;return function(_0x1e4e97){logger[_0x663b('0x27')](_0x1e4e97[_0x663b('0x28')]);if(_0x1e4e97['name']){delete _0x1e4e97[_0x663b('0x29')];}_0x37a5f4[_0x663b('0x1b')](_0x54bb0d)[_0x663b('0x2a')](_0x1e4e97);};}exports[_0x663b('0x2b')]=function(_0x5a1580,_0x4ef875){var _0x4e7486={'raw':!![],'where':{'id':_0x5a1580[_0x663b('0x2c')]['id']}},_0x110c6c={};_0x110c6c['model']=_[_0x663b('0x2d')](db['ChatProactiveAction']['rawAttributes']);_0x110c6c[_0x663b('0x2e')]=_[_0x663b('0x2d')](_0x5a1580[_0x663b('0x2e')]);_0x110c6c['filters']=_['intersection'](_0x110c6c[_0x663b('0x2f')],_0x110c6c[_0x663b('0x2e')]);_0x4e7486[_0x663b('0x30')]=_[_0x663b('0x31')](_0x110c6c[_0x663b('0x2f')],qs[_0x663b('0x32')](_0x5a1580[_0x663b('0x2e')][_0x663b('0x32')]));_0x4e7486[_0x663b('0x30')]=_0x4e7486[_0x663b('0x30')][_0x663b('0x33')]?_0x4e7486[_0x663b('0x30')]:_0x110c6c[_0x663b('0x2f')];if(_0x5a1580[_0x663b('0x2e')]['includeAll']){_0x4e7486['include']=[{'all':!![]}];}_0x4e7486=_[_0x663b('0x34')]({},_0x4e7486,_0x5a1580[_0x663b('0x35')]);return db[_0x663b('0x36')]['find'](_0x4e7486)['then'](handleEntityNotFound(_0x4ef875,null))['then'](respondWithResult(_0x4ef875,null))['catch'](handleError(_0x4ef875,null));};exports['create']=function(_0xf99e3b,_0x186133){return db[_0x663b('0x36')][_0x663b('0x37')](_0xf99e3b[_0x663b('0x38')],{})[_0x663b('0x25')](respondWithResult(_0x186133,0xc9))['catch'](handleError(_0x186133,null));};exports[_0x663b('0x39')]=function(_0x4635db,_0x4f8a95){if(_0x4635db['body']['id']){delete _0x4635db[_0x663b('0x38')]['id'];}return db[_0x663b('0x36')][_0x663b('0x3a')]({'where':{'id':_0x4635db['params']['id']}})['then'](handleEntityNotFound(_0x4f8a95,null))[_0x663b('0x25')](saveUpdates(_0x4635db[_0x663b('0x38')],null))['then'](respondWithResult(_0x4f8a95,null))[_0x663b('0x3b')](handleError(_0x4f8a95,null));};exports[_0x663b('0x26')]=function(_0x128efe,_0x47f73d){return db[_0x663b('0x36')][_0x663b('0x3a')]({'where':{'id':_0x128efe['params']['id']}})[_0x663b('0x25')](handleEntityNotFound(_0x47f73d,null))[_0x663b('0x25')](removeEntity(_0x47f73d,null))[_0x663b('0x3b')](handleError(_0x47f73d,null));}; \ No newline at end of file +var _0xea31=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','ChatProactiveAction','find','catch','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x38c19e,_0x544d08){var _0x1ca3f5=function(_0x411543){while(--_0x411543){_0x38c19e['push'](_0x38c19e['shift']());}};_0x1ca3f5(++_0x544d08);}(_0xea31,0x6b));var _0x1ea3=function(_0x4f1c67,_0x20ebfb){_0x4f1c67=_0x4f1c67-0x0;var _0x5ab261=_0xea31[_0x4f1c67];return _0x5ab261;};'use strict';var emlformat=require(_0x1ea3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ea3('0x1'));var jsonpatch=require(_0x1ea3('0x2'));var rp=require(_0x1ea3('0x3'));var moment=require(_0x1ea3('0x4'));var BPromise=require(_0x1ea3('0x5'));var Mustache=require(_0x1ea3('0x6'));var util=require(_0x1ea3('0x7'));var path=require('path');var sox=require(_0x1ea3('0x8'));var csv=require(_0x1ea3('0x9'));var ejs=require(_0x1ea3('0xa'));var fs=require('fs');var fs_extra=require(_0x1ea3('0xb'));var _=require(_0x1ea3('0xc'));var squel=require('squel');var crypto=require(_0x1ea3('0xd'));var jsforce=require(_0x1ea3('0xe'));var deskjs=require(_0x1ea3('0xf'));var toCsv=require(_0x1ea3('0x9'));var querystring=require(_0x1ea3('0x10'));var Papa=require(_0x1ea3('0x11'));var Redis=require('ioredis');var authService=require(_0x1ea3('0x12'));var qs=require(_0x1ea3('0x13'));var as=require(_0x1ea3('0x14'));var hardwareService=require(_0x1ea3('0x15'));var logger=require(_0x1ea3('0x16'))(_0x1ea3('0x17'));var utils=require(_0x1ea3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1ea3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe537,_0x2fc7f4){_0x2fc7f4=_0x2fc7f4||0xcc;return function(_0x4305d3){if(_0x4305d3){return _0x3fe537['sendStatus'](_0x2fc7f4);}return _0x3fe537[_0x1ea3('0x1a')](_0x2fc7f4)[_0x1ea3('0x1b')]();};}function respondWithResult(_0x2fd1c9,_0x4b0af9){_0x4b0af9=_0x4b0af9||0xc8;return function(_0x1624ee){if(_0x1624ee){return _0x2fd1c9[_0x1ea3('0x1a')](_0x4b0af9)[_0x1ea3('0x1c')](_0x1624ee);}};}function respondWithFilteredResult(_0x3d0e71,_0x319de8){return function(_0x3fe673){if(_0x3fe673){var _0x29ceac=typeof _0x319de8['offset']===_0x1ea3('0x1d')&&typeof _0x319de8[_0x1ea3('0x1e')]===_0x1ea3('0x1d');var _0x2f6e6f=_0x3fe673[_0x1ea3('0x1f')];var _0x541e18=_0x29ceac?0x0:_0x319de8[_0x1ea3('0x20')];var _0x2a8b47=_0x29ceac?_0x3fe673[_0x1ea3('0x1f')]:_0x319de8['offset']+_0x319de8[_0x1ea3('0x1e')];var _0x21364e;if(_0x2a8b47>=_0x2f6e6f){_0x2a8b47=_0x2f6e6f;_0x21364e=0xc8;}else{_0x21364e=0xce;}_0x3d0e71[_0x1ea3('0x1a')](_0x21364e);return _0x3d0e71['set'](_0x1ea3('0x21'),_0x541e18+'-'+_0x2a8b47+'/'+_0x2f6e6f)['json'](_0x3fe673);}return null;};}function patchUpdates(_0x276e4d){return function(_0x405ec0){try{jsonpatch[_0x1ea3('0x22')](_0x405ec0,_0x276e4d,!![]);}catch(_0x5bad21){return BPromise[_0x1ea3('0x23')](_0x5bad21);}return _0x405ec0['save']();};}function saveUpdates(_0x4582af,_0x498455){return function(_0x941a50){if(_0x941a50){return _0x941a50['update'](_0x4582af)[_0x1ea3('0x24')](function(_0x388019){return _0x388019;});}return null;};}function removeEntity(_0x246231,_0x5ad8ff){return function(_0x50703d){if(_0x50703d){return _0x50703d[_0x1ea3('0x25')]()['then'](function(){_0x246231[_0x1ea3('0x1a')](0xcc)[_0x1ea3('0x1b')]();});}};}function handleEntityNotFound(_0x3c42f3,_0x91abee){return function(_0xa2b868){if(!_0xa2b868){_0x3c42f3['sendStatus'](0x194);}return _0xa2b868;};}function handleError(_0x50e511,_0x30cf8d){_0x30cf8d=_0x30cf8d||0x1f4;return function(_0x2edfb4){logger[_0x1ea3('0x26')](_0x2edfb4[_0x1ea3('0x27')]);if(_0x2edfb4[_0x1ea3('0x28')]){delete _0x2edfb4[_0x1ea3('0x28')];}_0x50e511[_0x1ea3('0x1a')](_0x30cf8d)[_0x1ea3('0x29')](_0x2edfb4);};}exports[_0x1ea3('0x2a')]=function(_0x3d9b63,_0x3bc186){var _0x33f5f2={'raw':!![],'where':{'id':_0x3d9b63[_0x1ea3('0x2b')]['id']}},_0x2c29d7={};_0x2c29d7[_0x1ea3('0x2c')]=_[_0x1ea3('0x2d')](db['ChatProactiveAction'][_0x1ea3('0x2e')]);_0x2c29d7[_0x1ea3('0x2f')]=_[_0x1ea3('0x2d')](_0x3d9b63[_0x1ea3('0x2f')]);_0x2c29d7[_0x1ea3('0x30')]=_['intersection'](_0x2c29d7['model'],_0x2c29d7[_0x1ea3('0x2f')]);_0x33f5f2[_0x1ea3('0x31')]=_['intersection'](_0x2c29d7[_0x1ea3('0x2c')],qs[_0x1ea3('0x32')](_0x3d9b63['query']['fields']));_0x33f5f2[_0x1ea3('0x31')]=_0x33f5f2[_0x1ea3('0x31')][_0x1ea3('0x33')]?_0x33f5f2[_0x1ea3('0x31')]:_0x2c29d7[_0x1ea3('0x2c')];if(_0x3d9b63[_0x1ea3('0x2f')][_0x1ea3('0x34')]){_0x33f5f2[_0x1ea3('0x35')]=[{'all':!![]}];}_0x33f5f2=_[_0x1ea3('0x36')]({},_0x33f5f2,_0x3d9b63['options']);return db[_0x1ea3('0x37')][_0x1ea3('0x38')](_0x33f5f2)[_0x1ea3('0x24')](handleEntityNotFound(_0x3bc186,null))[_0x1ea3('0x24')](respondWithResult(_0x3bc186,null))[_0x1ea3('0x39')](handleError(_0x3bc186,null));};exports[_0x1ea3('0x3a')]=function(_0x36d563,_0x2414ee){return db[_0x1ea3('0x37')][_0x1ea3('0x3a')](_0x36d563['body'],{})[_0x1ea3('0x24')](respondWithResult(_0x2414ee,0xc9))['catch'](handleError(_0x2414ee,null));};exports[_0x1ea3('0x3b')]=function(_0x5578c1,_0x4cc1d0){if(_0x5578c1[_0x1ea3('0x3c')]['id']){delete _0x5578c1['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x5578c1[_0x1ea3('0x2b')]['id']}})[_0x1ea3('0x24')](handleEntityNotFound(_0x4cc1d0,null))[_0x1ea3('0x24')](saveUpdates(_0x5578c1[_0x1ea3('0x3c')],null))[_0x1ea3('0x24')](respondWithResult(_0x4cc1d0,null))['catch'](handleError(_0x4cc1d0,null));};exports[_0x1ea3('0x25')]=function(_0x5ac483,_0x441442){return db[_0x1ea3('0x37')]['find']({'where':{'id':_0x5ac483[_0x1ea3('0x2b')]['id']}})[_0x1ea3('0x24')](handleEntityNotFound(_0x441442,null))[_0x1ea3('0x24')](removeEntity(_0x441442,null))[_0x1ea3('0x39')](handleError(_0x441442,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 36b22f6..44f95f3 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 _0xfe86=['path','rimraf','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x63366e,_0x17e419){var _0x2dc20a=function(_0x443bfe){while(--_0x443bfe){_0x63366e['push'](_0x63366e['shift']());}};_0x2dc20a(++_0x17e419);}(_0xfe86,0x118));var _0x6fe8=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0xfe86[_0x576d8a];return _0x3dc3ef;};'use strict';var _=require(_0x6fe8('0x0'));var util=require(_0x6fe8('0x1'));var logger=require(_0x6fe8('0x2'))(_0x6fe8('0x3'));var moment=require(_0x6fe8('0x4'));var BPromise=require(_0x6fe8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fe8('0x6'));var rimraf=require(_0x6fe8('0x7'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x6fe8('0x8')]=function(_0x25492a,_0x3c3590){return _0x25492a['define'](_0x6fe8('0x9'),attributes,{'tableName':_0x6fe8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3880=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x1c9acb,_0x305c5e){var _0x670b4d=function(_0x35aca2){while(--_0x35aca2){_0x1c9acb['push'](_0x1c9acb['shift']());}};_0x670b4d(++_0x305c5e);}(_0x3880,0x13f));var _0x0388=function(_0x39d39a,_0x4d5d39){_0x39d39a=_0x39d39a-0x0;var _0x3316ca=_0x3880[_0x39d39a];return _0x3316ca;};'use strict';var _=require(_0x0388('0x0'));var util=require(_0x0388('0x1'));var logger=require(_0x0388('0x2'))(_0x0388('0x3'));var moment=require(_0x0388('0x4'));var BPromise=require(_0x0388('0x5'));var rp=require(_0x0388('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0388('0x7'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x392df1,_0x51a6ee){return _0x392df1[_0x0388('0x8')](_0x0388('0x9'),attributes,{'tableName':_0x0388('0xa'),'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 d0c3f53..6dc05e4 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 _0xd3ca=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x87eee5,_0x581852){var _0x17e2dc=function(_0x1122d2){while(--_0x1122d2){_0x87eee5['push'](_0x87eee5['shift']());}};_0x17e2dc(++_0x581852);}(_0xd3ca,0xc2));var _0xad3c=function(_0x5641dd,_0x3560b5){_0x5641dd=_0x5641dd-0x0;var _0x5767ba=_0xd3ca[_0x5641dd];return _0x5767ba;};'use strict';var _=require('lodash');var util=require(_0xad3c('0x0'));var moment=require('moment');var BPromise=require(_0xad3c('0x1'));var rs=require(_0xad3c('0x2'));var fs=require('fs');var Redis=require(_0xad3c('0x3'));var db=require(_0xad3c('0x4'))['db'];var utils=require(_0xad3c('0x5'));var logger=require(_0xad3c('0x6'))('rpc');var config=require(_0xad3c('0x7'));var jayson=require(_0xad3c('0x8'));var client=jayson['client'][_0xad3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191110,_0x543fd2,_0x4592fb){return new BPromise(function(_0x483b05,_0xfce8d8){return client[_0xad3c('0xa')](_0x191110,_0x4592fb)['then'](function(_0x339819){logger[_0xad3c('0xb')](_0xad3c('0xc'),_0x543fd2,_0xad3c('0xd'));logger[_0xad3c('0xe')](_0xad3c('0xf'),_0x543fd2,'request\x20sent',JSON['stringify'](_0x339819));if(_0x339819[_0xad3c('0x10')]){if(_0x339819[_0xad3c('0x10')][_0xad3c('0x11')]===0x1f4){logger[_0xad3c('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x543fd2,_0x339819[_0xad3c('0x10')]['message']);return _0xfce8d8(_0x339819['error']['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x543fd2,_0x339819[_0xad3c('0x10')][_0xad3c('0x12')]);return _0x483b05(_0x339819[_0xad3c('0x10')][_0xad3c('0x12')]);}else{logger[_0xad3c('0xb')](_0xad3c('0xc'),_0x543fd2,'request\x20sent');_0x483b05(_0x339819[_0xad3c('0x13')]['message']);}})[_0xad3c('0x14')](function(_0x24504d){logger[_0xad3c('0x10')](_0xad3c('0xc'),_0x543fd2,_0x24504d);_0xfce8d8(_0x24504d);});});} \ No newline at end of file +var _0x4451=['../../config/utils','../../config/logger','rpc','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x43b393,_0x185488){var _0x2c1c27=function(_0x4b1f9b){while(--_0x4b1f9b){_0x43b393['push'](_0x43b393['shift']());}};_0x2c1c27(++_0x185488);}(_0x4451,0x1b3));var _0x1445=function(_0x2c153d,_0x3207a7){_0x2c153d=_0x2c153d-0x0;var _0x44650f=_0x4451[_0x2c153d];return _0x44650f;};'use strict';var _=require(_0x1445('0x0'));var util=require('util');var moment=require(_0x1445('0x1'));var BPromise=require(_0x1445('0x2'));var rs=require(_0x1445('0x3'));var fs=require('fs');var Redis=require(_0x1445('0x4'));var db=require(_0x1445('0x5'))['db'];var utils=require(_0x1445('0x6'));var logger=require(_0x1445('0x7'))(_0x1445('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1445('0x9')][_0x1445('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2742c4,_0x9f1567,_0x16e38e){return new BPromise(function(_0x40cf75,_0x36090f){return client[_0x1445('0xb')](_0x2742c4,_0x16e38e)[_0x1445('0xc')](function(_0x38823e){logger['info'](_0x1445('0xd'),_0x9f1567,'request\x20sent');logger[_0x1445('0xe')](_0x1445('0xf'),_0x9f1567,_0x1445('0x10'),JSON['stringify'](_0x38823e));if(_0x38823e[_0x1445('0x11')]){if(_0x38823e[_0x1445('0x11')]['code']===0x1f4){logger[_0x1445('0x11')](_0x1445('0xd'),_0x9f1567,_0x38823e[_0x1445('0x11')]['message']);return _0x36090f(_0x38823e[_0x1445('0x11')]['message']);}logger['error'](_0x1445('0xd'),_0x9f1567,_0x38823e[_0x1445('0x11')][_0x1445('0x12')]);return _0x40cf75(_0x38823e[_0x1445('0x11')][_0x1445('0x12')]);}else{logger[_0x1445('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x9f1567,_0x1445('0x10'));_0x40cf75(_0x38823e['result']['message']);}})[_0x1445('0x14')](function(_0x367fc8){logger[_0x1445('0x11')](_0x1445('0xd'),_0x9f1567,_0x367fc8);_0x36090f(_0x367fc8);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 12cc824..557dd8c 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 _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1ad096,_0x22cde6){_0x1ad096=_0x1ad096-0x0;var _0x3b0b4a=_0x8d0e[_0x1ad096];return _0x3b0b4a;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5fd1=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','multer','path','connect-timeout','express'];(function(_0x44be03,_0x22fd29){var _0x49e927=function(_0x5088a7){while(--_0x5088a7){_0x44be03['push'](_0x44be03['shift']());}};_0x49e927(++_0x22fd29);}(_0x5fd1,0x155));var _0x15fd=function(_0x23e6a2,_0x49af1d){_0x23e6a2=_0x23e6a2-0x0;var _0x32858a=_0x5fd1[_0x23e6a2];return _0x32858a;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x15fd('0x7')](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller[_0x15fd('0xa')]);router[_0x15fd('0xb')]('/',auth['isAuthenticated'](),controller[_0x15fd('0xc')]);router[_0x15fd('0xd')](_0x15fd('0x8'),auth['isAuthenticated'](),controller[_0x15fd('0xe')]);router['delete'](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller['destroy']);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 b6bb3eb..d6faa36 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 _0x0d78=['rrmemory','beepall','sequelize','exports','name','INTEGER'];(function(_0x60f09e,_0x383d44){var _0x5a4b42=function(_0x2f73ce){while(--_0x2f73ce){_0x60f09e['push'](_0x60f09e['shift']());}};_0x5a4b42(++_0x383d44);}(_0x0d78,0x8c));var _0x80d7=function(_0x116b8e,_0x1da172){_0x116b8e=_0x116b8e-0x0;var _0x3a884b=_0x0d78[_0x116b8e];return _0x3a884b;};'use strict';var Sequelize=require(_0x80d7('0x0'));module[_0x80d7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x80d7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x80d7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x80d7('0x4'),_0x80d7('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x3cbd=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x5a539f,_0xb4338){var _0x5d7db4=function(_0x41ad83){while(--_0x41ad83){_0x5a539f['push'](_0x5a539f['shift']());}};_0x5d7db4(++_0xb4338);}(_0x3cbd,0xac));var _0xd3cb=function(_0x160d97,_0x5379be){_0x160d97=_0x160d97-0x0;var _0x3a3e8e=_0x3cbd[_0x160d97];return _0x3a3e8e;};'use strict';var Sequelize=require('sequelize');module[_0xd3cb('0x0')]={'name':{'type':Sequelize[_0xd3cb('0x1')],'unique':_0xd3cb('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd3cb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd3cb('0x4')](_0xd3cb('0x5'),_0xd3cb('0x6'),_0xd3cb('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2751e63..18ba9c9 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 _0xfd66=['userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','client','request','then','info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','name','index','map','ChatQueue','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','chatPause','getTeams','order','addTeams','ids','Team','Agents','online','voicePause','sequelize','transaction','each','findOrCreate'];(function(_0x18c5b1,_0x5b0683){var _0x403579=function(_0x1d754b){while(--_0x1d754b){_0x18c5b1['push'](_0x18c5b1['shift']());}};_0x403579(++_0x5b0683);}(_0xfd66,0x156));var _0x6fd6=function(_0x445b26,_0x8643e1){_0x445b26=_0x445b26-0x0;var _0x211c4c=_0xfd66[_0x445b26];return _0x211c4c;};'use strict';var emlformat=require(_0x6fd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fd6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fd6('0x2'));var moment=require(_0x6fd6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6fd6('0x4'));var path=require(_0x6fd6('0x5'));var sox=require(_0x6fd6('0x6'));var csv=require(_0x6fd6('0x7'));var ejs=require(_0x6fd6('0x8'));var fs=require('fs');var fs_extra=require(_0x6fd6('0x9'));var _=require(_0x6fd6('0xa'));var squel=require(_0x6fd6('0xb'));var crypto=require(_0x6fd6('0xc'));var jsforce=require(_0x6fd6('0xd'));var deskjs=require(_0x6fd6('0xe'));var toCsv=require(_0x6fd6('0x7'));var querystring=require(_0x6fd6('0xf'));var Papa=require(_0x6fd6('0x10'));var Redis=require(_0x6fd6('0x11'));var authService=require(_0x6fd6('0x12'));var qs=require(_0x6fd6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fd6('0x14'))(_0x6fd6('0x15'));var utils=require(_0x6fd6('0x16'));var config=require(_0x6fd6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6fd6('0x18'))['db'];config[_0x6fd6('0x19')]=_['defaults'](config[_0x6fd6('0x19')],{'host':_0x6fd6('0x1a'),'port':0x18eb});var socket=require(_0x6fd6('0x1b'))(new Redis(config[_0x6fd6('0x19')]));require(_0x6fd6('0x1c'))[_0x6fd6('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6fd6('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b0861,_0x4fe606,_0x1cdd10,_0x294441){return new BPromise(function(_0x5f393f,_0x18a0bf){var _0x5923e2=_0x294441||client;return _0x5923e2[_0x6fd6('0x1f')](_0x2b0861,_0x1cdd10)[_0x6fd6('0x20')](function(_0x382a0e){logger[_0x6fd6('0x21')](_0x6fd6('0x22'),_0x4fe606,'request\x20sent');logger[_0x6fd6('0x23')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4fe606,_0x6fd6('0x24'),JSON[_0x6fd6('0x25')](_0x382a0e));if(_0x382a0e['error']){if(_0x382a0e['error']['code']===0x1f4){logger[_0x6fd6('0x26')](_0x6fd6('0x22'),_0x4fe606,_0x382a0e['error']['message']);return _0x18a0bf(_0x382a0e['error'][_0x6fd6('0x27')]);}logger[_0x6fd6('0x26')](_0x6fd6('0x22'),_0x4fe606,_0x382a0e[_0x6fd6('0x26')][_0x6fd6('0x27')]);return _0x5f393f(_0x382a0e[_0x6fd6('0x26')][_0x6fd6('0x27')]);}else{logger[_0x6fd6('0x21')](_0x6fd6('0x22'),_0x4fe606,_0x6fd6('0x24'));_0x5f393f(_0x382a0e[_0x6fd6('0x28')][_0x6fd6('0x27')]);}})[_0x6fd6('0x29')](function(_0x4fc2f5){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4fe606,_0x4fc2f5);_0x18a0bf(_0x4fc2f5);});});}function respondWithStatusCode(_0xbdb38d,_0xd6f1bd){_0xd6f1bd=_0xd6f1bd||0xcc;return function(_0x818844){if(_0x818844){return _0xbdb38d[_0x6fd6('0x2a')](_0xd6f1bd);}return _0xbdb38d[_0x6fd6('0x2b')](_0xd6f1bd)[_0x6fd6('0x2c')]();};}function respondWithResult(_0x57e2d6,_0x4f1658){_0x4f1658=_0x4f1658||0xc8;return function(_0x369602){if(_0x369602){return _0x57e2d6[_0x6fd6('0x2b')](_0x4f1658)[_0x6fd6('0x2d')](_0x369602);}};}function respondWithFilteredResult(_0x3fd55d,_0x1cf608){return function(_0x4d3f8c){if(_0x4d3f8c){var _0xc12d47=typeof _0x1cf608[_0x6fd6('0x2e')]===_0x6fd6('0x2f')&&typeof _0x1cf608[_0x6fd6('0x30')]===_0x6fd6('0x2f');var _0x1b04b9=_0x4d3f8c[_0x6fd6('0x31')];var _0x73dec6=_0xc12d47?0x0:_0x1cf608[_0x6fd6('0x2e')];var _0x4806cf=_0xc12d47?_0x4d3f8c[_0x6fd6('0x31')]:_0x1cf608[_0x6fd6('0x2e')]+_0x1cf608['limit'];var _0x4401d7;if(_0x4806cf>=_0x1b04b9){_0x4806cf=_0x1b04b9;_0x4401d7=0xc8;}else{_0x4401d7=0xce;}_0x3fd55d[_0x6fd6('0x2b')](_0x4401d7);return _0x3fd55d[_0x6fd6('0x32')](_0x6fd6('0x33'),_0x73dec6+'-'+_0x4806cf+'/'+_0x1b04b9)[_0x6fd6('0x2d')](_0x4d3f8c);}return null;};}function patchUpdates(_0x3173c6){return function(_0x47015f){try{jsonpatch[_0x6fd6('0x34')](_0x47015f,_0x3173c6,!![]);}catch(_0x558729){return BPromise[_0x6fd6('0x35')](_0x558729);}return _0x47015f[_0x6fd6('0x36')]();};}function saveUpdates(_0x5e61bd,_0x26c880){return function(_0x264c96){if(_0x264c96){return _0x264c96[_0x6fd6('0x37')](_0x5e61bd)[_0x6fd6('0x20')](function(_0x56dfc2){return _0x56dfc2;});}return null;};}function removeEntity(_0x47cea7,_0x212028){return function(_0x3196ea){if(_0x3196ea){return _0x3196ea[_0x6fd6('0x38')]()[_0x6fd6('0x20')](function(){var _0x41e14b=_0x3196ea[_0x6fd6('0x39')]({'plain':!![]});var _0x36ba3e=_0x6fd6('0x3a');return db[_0x6fd6('0x3b')]['destroy']({'where':{'type':_0x36ba3e,'resourceId':_0x41e14b['id']}})[_0x6fd6('0x20')](function(){return _0x3196ea;});})[_0x6fd6('0x20')](function(){_0x47cea7['status'](0xcc)[_0x6fd6('0x2c')]();});}};}function handleEntityNotFound(_0x1b3961,_0x2e161b){return function(_0x24445f){if(!_0x24445f){_0x1b3961['sendStatus'](0x194);}return _0x24445f;};}function handleError(_0x2a0380,_0x154b31){_0x154b31=_0x154b31||0x1f4;return function(_0x2968a2){logger[_0x6fd6('0x26')](_0x2968a2['stack']);if(_0x2968a2[_0x6fd6('0x3c')]){delete _0x2968a2[_0x6fd6('0x3c')];}_0x2a0380['status'](_0x154b31)['send'](_0x2968a2);};}exports[_0x6fd6('0x3d')]=function(_0x1d30f1,_0x22d5c9){var _0x525adc={},_0x2b36c5={},_0x4d882f={'count':0x0,'rows':[]};var _0x2e0638=_[_0x6fd6('0x3e')](db[_0x6fd6('0x3f')]['rawAttributes'],function(_0x1e5369){return{'name':_0x1e5369[_0x6fd6('0x40')],'type':_0x1e5369[_0x6fd6('0x41')][_0x6fd6('0x42')]};});_0x2b36c5['model']=_[_0x6fd6('0x3e')](_0x2e0638,_0x6fd6('0x3c'));_0x2b36c5['query']=_[_0x6fd6('0x43')](_0x1d30f1[_0x6fd6('0x44')]);_0x2b36c5[_0x6fd6('0x45')]=_[_0x6fd6('0x46')](_0x2b36c5[_0x6fd6('0x47')],_0x2b36c5[_0x6fd6('0x44')]);_0x525adc['attributes']=_[_0x6fd6('0x46')](_0x2b36c5[_0x6fd6('0x47')],qs[_0x6fd6('0x48')](_0x1d30f1[_0x6fd6('0x44')]['fields']));_0x525adc[_0x6fd6('0x49')]=_0x525adc[_0x6fd6('0x49')][_0x6fd6('0x4a')]?_0x525adc[_0x6fd6('0x49')]:_0x2b36c5[_0x6fd6('0x47')];if(!_0x1d30f1[_0x6fd6('0x44')][_0x6fd6('0x4b')](_0x6fd6('0x4c'))){_0x525adc[_0x6fd6('0x30')]=qs[_0x6fd6('0x30')](_0x1d30f1[_0x6fd6('0x44')][_0x6fd6('0x30')]);_0x525adc['offset']=qs[_0x6fd6('0x2e')](_0x1d30f1[_0x6fd6('0x44')][_0x6fd6('0x2e')]);}_0x525adc['order']=qs[_0x6fd6('0x4d')](_0x1d30f1[_0x6fd6('0x44')]['sort']);_0x525adc[_0x6fd6('0x4e')]=qs[_0x6fd6('0x45')](_['pick'](_0x1d30f1[_0x6fd6('0x44')],_0x2b36c5[_0x6fd6('0x45')]),_0x2e0638);if(_0x1d30f1[_0x6fd6('0x44')][_0x6fd6('0x4f')]){_0x525adc[_0x6fd6('0x4e')]=_[_0x6fd6('0x50')](_0x525adc[_0x6fd6('0x4e')],{'$or':_[_0x6fd6('0x3e')](_0x2e0638,function(_0x33829b){if(_0x33829b[_0x6fd6('0x41')]!==_0x6fd6('0x51')){var _0x4686ce={};_0x4686ce[_0x33829b[_0x6fd6('0x3c')]]={'$like':'%'+_0x1d30f1[_0x6fd6('0x44')][_0x6fd6('0x4f')]+'%'};return _0x4686ce;}})});}_0x525adc=_['merge']({},_0x525adc,_0x1d30f1[_0x6fd6('0x52')]);var _0x4b0b03={'where':_0x525adc[_0x6fd6('0x4e')]};return db[_0x6fd6('0x3f')]['count'](_0x4b0b03)[_0x6fd6('0x20')](function(_0x2b790b){_0x4d882f[_0x6fd6('0x31')]=_0x2b790b;if(_0x1d30f1[_0x6fd6('0x44')][_0x6fd6('0x53')]){_0x525adc[_0x6fd6('0x54')]=[{'all':!![]}];}return db[_0x6fd6('0x3f')][_0x6fd6('0x55')](_0x525adc);})[_0x6fd6('0x20')](function(_0x1d60bb){_0x4d882f[_0x6fd6('0x56')]=_0x1d60bb;return _0x4d882f;})[_0x6fd6('0x20')](respondWithFilteredResult(_0x22d5c9,_0x525adc))[_0x6fd6('0x29')](handleError(_0x22d5c9,null));};exports[_0x6fd6('0x57')]=function(_0x2486c8,_0x30288a){var _0x3e7a47={'raw':!![],'where':{'id':_0x2486c8[_0x6fd6('0x58')]['id']}},_0x589fab={};_0x589fab[_0x6fd6('0x47')]=_[_0x6fd6('0x43')](db['ChatQueue'][_0x6fd6('0x59')]);_0x589fab[_0x6fd6('0x44')]=_[_0x6fd6('0x43')](_0x2486c8['query']);_0x589fab['filters']=_[_0x6fd6('0x46')](_0x589fab[_0x6fd6('0x47')],_0x589fab[_0x6fd6('0x44')]);_0x3e7a47[_0x6fd6('0x49')]=_[_0x6fd6('0x46')](_0x589fab[_0x6fd6('0x47')],qs['fields'](_0x2486c8[_0x6fd6('0x44')][_0x6fd6('0x48')]));_0x3e7a47[_0x6fd6('0x49')]=_0x3e7a47['attributes'][_0x6fd6('0x4a')]?_0x3e7a47[_0x6fd6('0x49')]:_0x589fab['model'];if(_0x2486c8[_0x6fd6('0x44')][_0x6fd6('0x53')]){_0x3e7a47[_0x6fd6('0x54')]=[{'all':!![]}];}_0x3e7a47=_['merge']({},_0x3e7a47,_0x2486c8[_0x6fd6('0x52')]);return db[_0x6fd6('0x3f')][_0x6fd6('0x5a')](_0x3e7a47)[_0x6fd6('0x20')](handleEntityNotFound(_0x30288a,null))[_0x6fd6('0x20')](respondWithResult(_0x30288a,null))[_0x6fd6('0x29')](handleError(_0x30288a,null));};exports[_0x6fd6('0x5b')]=function(_0xd4a74a,_0x1d4739){return db[_0x6fd6('0x3f')][_0x6fd6('0x5b')](_0xd4a74a[_0x6fd6('0x5c')],{})['then'](function(_0x57f996){var _0x506bd2=_0xd4a74a[_0x6fd6('0x5d')][_0x6fd6('0x39')]({'plain':!![]});if(!_0x506bd2)throw new Error(_0x6fd6('0x5e'));if(_0x506bd2[_0x6fd6('0x5f')]===_0x6fd6('0x5d')){var _0x5b664d=_0x57f996[_0x6fd6('0x39')]({'plain':!![]});var _0xffe782=_0x6fd6('0x3a');return db[_0x6fd6('0x60')]['find']({'where':{'name':_0xffe782,'userProfileId':_0x506bd2['userProfileId']},'raw':!![]})['then'](function(_0x5870c5){if(_0x5870c5&&_0x5870c5[_0x6fd6('0x61')]===0x0){return db[_0x6fd6('0x3b')][_0x6fd6('0x5b')]({'name':_0x5b664d['name'],'resourceId':_0x5b664d['id'],'type':_0x5870c5[_0x6fd6('0x3c')],'sectionId':_0x5870c5['id']},{})[_0x6fd6('0x20')](function(){return _0x57f996;});}else{return _0x57f996;}})[_0x6fd6('0x29')](function(_0x18ddcf){logger['error'](_0x6fd6('0x62'),_0x18ddcf);throw _0x18ddcf;});}return _0x57f996;})['then'](respondWithResult(_0x1d4739,0xc9))['catch'](handleError(_0x1d4739,null));};exports[_0x6fd6('0x37')]=function(_0x4b4f06,_0x5ef75e){if(_0x4b4f06[_0x6fd6('0x5c')]['id']){delete _0x4b4f06['body']['id'];}return db[_0x6fd6('0x3f')][_0x6fd6('0x5a')]({'where':{'id':_0x4b4f06['params']['id']}})[_0x6fd6('0x20')](handleEntityNotFound(_0x5ef75e,null))[_0x6fd6('0x20')](saveUpdates(_0x4b4f06[_0x6fd6('0x5c')],null))['then'](respondWithResult(_0x5ef75e,null))[_0x6fd6('0x29')](handleError(_0x5ef75e,null));};exports[_0x6fd6('0x38')]=function(_0x54341e,_0x17d99e){return db[_0x6fd6('0x3f')][_0x6fd6('0x5a')]({'where':{'id':_0x54341e['params']['id']}})[_0x6fd6('0x20')](handleEntityNotFound(_0x17d99e,null))[_0x6fd6('0x20')](removeEntity(_0x17d99e,null))[_0x6fd6('0x29')](handleError(_0x17d99e,null));};exports[_0x6fd6('0x63')]=function(_0x958c9b,_0x56aa8f){return db[_0x6fd6('0x3f')]['describe']()[_0x6fd6('0x20')](respondWithResult(_0x56aa8f,null))[_0x6fd6('0x29')](handleError(_0x56aa8f,null));};exports[_0x6fd6('0x64')]=function(_0x525477,_0xe4c4dd,_0x452e6){var _0x19a3af={'raw':!![],'where':{}},_0x494018={},_0x4b4e10;return db['ChatQueue'][_0x6fd6('0x65')]({'where':{'id':_0x525477[_0x6fd6('0x58')]['id']}})[_0x6fd6('0x20')](handleEntityNotFound(_0xe4c4dd,null))[_0x6fd6('0x20')](function(_0x4f233b){if(_0x4f233b){_0x4b4e10=_0x4f233b[_0x6fd6('0x39')]({'plain':!![]});_0x494018[_0x6fd6('0x47')]=_[_0x6fd6('0x43')](db[_0x6fd6('0x66')][_0x6fd6('0x59')]);_0x494018[_0x6fd6('0x44')]=_[_0x6fd6('0x43')](_0x525477[_0x6fd6('0x44')]);_0x494018['filters']=_[_0x6fd6('0x46')](_0x494018[_0x6fd6('0x47')],_0x494018[_0x6fd6('0x44')]);_0x19a3af[_0x6fd6('0x49')]=_['intersection'](_0x494018[_0x6fd6('0x47')],qs[_0x6fd6('0x48')](_0x525477[_0x6fd6('0x44')][_0x6fd6('0x48')]));_0x19a3af[_0x6fd6('0x49')]=_0x19a3af[_0x6fd6('0x49')][_0x6fd6('0x4a')]?_0x19a3af[_0x6fd6('0x49')]:_0x494018[_0x6fd6('0x47')];if(!_0x525477[_0x6fd6('0x44')][_0x6fd6('0x4b')](_0x6fd6('0x4c'))){_0x19a3af['limit']=qs[_0x6fd6('0x30')](_0x525477[_0x6fd6('0x44')][_0x6fd6('0x30')]);_0x19a3af['offset']=qs[_0x6fd6('0x2e')](_0x525477['query'][_0x6fd6('0x2e')]);}_0x19a3af['order']=qs[_0x6fd6('0x4d')](_0x525477[_0x6fd6('0x44')]['sort']);_0x19a3af[_0x6fd6('0x4e')]=qs['filters'](_[_0x6fd6('0x67')](_0x525477[_0x6fd6('0x44')],_0x494018['filters']));_0x19a3af[_0x6fd6('0x4e')][_0x6fd6('0x68')]=_0x4f233b['id'];if(_0x525477[_0x6fd6('0x44')][_0x6fd6('0x4f')]){_0x19a3af[_0x6fd6('0x4e')]=_[_0x6fd6('0x50')](_0x19a3af[_0x6fd6('0x4e')],{'$or':_[_0x6fd6('0x3e')](_0x19a3af[_0x6fd6('0x49')],function(_0x3b7f10){var _0x1bb214={};_0x1bb214[_0x3b7f10]={'$like':'%'+_0x525477['query'][_0x6fd6('0x4f')]+'%'};return _0x1bb214;})});}_0x19a3af=_[_0x6fd6('0x50')]({},_0x19a3af,_0x525477[_0x6fd6('0x52')]);return db['UserChatQueue']['findAll'](_0x19a3af);}})[_0x6fd6('0x20')](function(_0x320838){if(_0x320838){return db[_0x6fd6('0x69')][_0x6fd6('0x6a')]({'where':{'id':_[_0x6fd6('0x3e')](_0x320838,_0x6fd6('0x6b')),'role':_0x6fd6('0x6c')},'attributes':['id','name','chatPause','updatedAt',_0x6fd6('0x6d')]});}})[_0x6fd6('0x20')](function(_0x45fd6d){if(_0x45fd6d){return{'count':_0x45fd6d[_0x6fd6('0x31')],'rows':_[_0x6fd6('0x3e')](_0x45fd6d[_0x6fd6('0x56')],function(_0x3c3c07){return{'membername':_0x3c3c07[_0x6fd6('0x3c')],'UserId':_0x3c3c07['id'],'queue_name':_0x4b4e10['name'],'ChatQueueId':_0x4b4e10['id'],'interface':util[_0x6fd6('0x6e')](_0x6fd6('0x6f'),_0x6fd6('0x70'),_0x3c3c07[_0x6fd6('0x3c')]),'penalty':0x0,'paused':_0x3c3c07[_0x6fd6('0x71')],'createdAt':_0x3c3c07[_0x6fd6('0x6d')],'updatedAt':_0x3c3c07['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xe4c4dd,_0x19a3af))[_0x6fd6('0x29')](handleError(_0xe4c4dd,null));};exports[_0x6fd6('0x72')]=function(_0x36cd66,_0x3ba6e2,_0x49d291){var _0x29b9e4={};var _0x2ff8f9={};var _0x5a2666;var _0x461a42;return db[_0x6fd6('0x3f')][_0x6fd6('0x65')]({'where':{'id':_0x36cd66['params']['id']}})[_0x6fd6('0x20')](handleEntityNotFound(_0x3ba6e2,null))[_0x6fd6('0x20')](function(_0x2f0bd8){if(_0x2f0bd8){_0x5a2666=_0x2f0bd8;_0x2ff8f9[_0x6fd6('0x47')]=_[_0x6fd6('0x43')](db['Team']['rawAttributes']);_0x2ff8f9['query']=_[_0x6fd6('0x43')](_0x36cd66[_0x6fd6('0x44')]);_0x2ff8f9[_0x6fd6('0x45')]=_[_0x6fd6('0x46')](_0x2ff8f9['model'],_0x2ff8f9['query']);_0x29b9e4['attributes']=_[_0x6fd6('0x46')](_0x2ff8f9[_0x6fd6('0x47')],qs[_0x6fd6('0x48')](_0x36cd66[_0x6fd6('0x44')][_0x6fd6('0x48')]));_0x29b9e4[_0x6fd6('0x49')]=_0x29b9e4[_0x6fd6('0x49')][_0x6fd6('0x4a')]?_0x29b9e4['attributes']:_0x2ff8f9['model'];_0x29b9e4[_0x6fd6('0x73')]=qs[_0x6fd6('0x4d')](_0x36cd66['query']['sort']);_0x29b9e4[_0x6fd6('0x4e')]=qs[_0x6fd6('0x45')](_[_0x6fd6('0x67')](_0x36cd66[_0x6fd6('0x44')],_0x2ff8f9[_0x6fd6('0x45')]));if(_0x36cd66['query'][_0x6fd6('0x4f')]){_0x29b9e4[_0x6fd6('0x4e')]=_['merge'](_0x29b9e4[_0x6fd6('0x4e')],{'$or':_[_0x6fd6('0x3e')](_0x29b9e4[_0x6fd6('0x49')],function(_0x464292){var _0x5cd6bc={};_0x5cd6bc[_0x464292]={'$like':'%'+_0x36cd66[_0x6fd6('0x44')][_0x6fd6('0x4f')]+'%'};return _0x5cd6bc;})});}_0x29b9e4=_[_0x6fd6('0x50')]({},_0x29b9e4,_0x36cd66[_0x6fd6('0x52')]);return _0x5a2666['getTeams'](_0x29b9e4);}})[_0x6fd6('0x20')](function(_0x39e2a0){if(_0x39e2a0){_0x461a42=_0x39e2a0[_0x6fd6('0x4a')];if(!_0x36cd66['query'][_0x6fd6('0x4b')]('nolimit')){_0x29b9e4[_0x6fd6('0x30')]=qs[_0x6fd6('0x30')](_0x36cd66[_0x6fd6('0x44')][_0x6fd6('0x30')]);_0x29b9e4['offset']=qs['offset'](_0x36cd66[_0x6fd6('0x44')]['offset']);}return _0x5a2666['getTeams'](_0x29b9e4);}})[_0x6fd6('0x20')](function(_0xb14f8a){if(_0xb14f8a){return _0xb14f8a?{'count':_0x461a42,'rows':_0xb14f8a}:null;}})[_0x6fd6('0x20')](respondWithResult(_0x3ba6e2,null))[_0x6fd6('0x29')](handleError(_0x3ba6e2,null));};exports[_0x6fd6('0x74')]=function(_0x56bf56,_0x5885bf,_0x126f27){var _0x4f67a1=_0x56bf56[_0x6fd6('0x5c')][_0x6fd6('0x75')];return db[_0x6fd6('0x76')][_0x6fd6('0x55')]({'where':{'id':_0x4f67a1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6fd6('0x77'),'attributes':['id',_0x6fd6('0x3c'),_0x6fd6('0x78'),_0x6fd6('0x79'),'interface'],'raw':!![]}]})[_0x6fd6('0x20')](function(_0x11bdc9){if(_0x11bdc9){var _0x59af8c=_['flatMap'](_0x11bdc9,function(_0x1a80e7){var _0x118fc0=_0x1a80e7[_0x6fd6('0x39')]({'plain':!![]});return _0x118fc0['Agents'];});return db[_0x6fd6('0x3f')][_0x6fd6('0x5a')]({'where':{'id':_0x56bf56[_0x6fd6('0x58')]['id']}})[_0x6fd6('0x20')](function(_0x451fa9){return db[_0x6fd6('0x7a')][_0x6fd6('0x7b')](function(_0xdbdf3b){return _0x451fa9[_0x6fd6('0x74')](_0x4f67a1,{'transaction':_0xdbdf3b})['then'](function(){return BPromise[_0x6fd6('0x7c')](_0x59af8c,function(_0x3a9037){return db[_0x6fd6('0x66')][_0x6fd6('0x7d')]({'where':{'UserId':_0x3a9037['id'],'ChatQueueId':_0x56bf56[_0x6fd6('0x58')]['id']},'transaction':_0xdbdf3b});});})[_0x6fd6('0x20')](function(){_0x59af8c['forEach'](function(_0x34a987){socket['emit'](_0x6fd6('0x7e'),{'UserId':_0x34a987['id'],'ChatQueueId':_0x451fa9['id']});});});});});}})['then'](respondWithStatusCode(_0x5885bf,null))[_0x6fd6('0x29')](handleError(_0x5885bf,null));};exports[_0x6fd6('0x7f')]=function(_0x218cc7,_0x317e52,_0x52c847){return db[_0x6fd6('0x76')][_0x6fd6('0x55')]({'where':{'id':_0x218cc7[_0x6fd6('0x44')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6fd6('0x69')],'as':_0x6fd6('0x77'),'attributes':['id'],'raw':!![]}]})[_0x6fd6('0x20')](handleEntityNotFound(_0x317e52,null))[_0x6fd6('0x20')](function(_0x5a78f6){var _0x416d2f=_[_0x6fd6('0x3e')](_0x5a78f6,'id');var _0x5dc132=[];var _0xe17be0=[];var _0x89ce5c=squel[_0x6fd6('0x80')]();_0x89ce5c[_0x6fd6('0x81')]('tq.TeamId')[_0x6fd6('0x82')](_0x6fd6('0x83'),'tq')[_0x6fd6('0x84')]('user_has_teams','ut',_0x6fd6('0x85'))[_0x6fd6('0x4e')](_0x6fd6('0x86'),_0x218cc7[_0x6fd6('0x58')]['id']);for(var _0x25c4ac=0x0;_0x25c4ac<_0x5a78f6[_0x6fd6('0x4a')];_0x25c4ac+=0x1){let _0x77e27=_0x5a78f6[_0x25c4ac];for(var _0x303b4e=0x0;_0x303b4e<_0x77e27[_0x6fd6('0x77')][_0x6fd6('0x4a')];_0x303b4e+=0x1){let _0x227cfc=_0x77e27[_0x6fd6('0x77')][_0x303b4e];var _0x592a9e=_0x89ce5c[_0x6fd6('0x87')]();_0x592a9e[_0x6fd6('0x4e')](_0x6fd6('0x88'),_0x227cfc['id']);_0xe17be0[_0x6fd6('0x89')](db[_0x6fd6('0x7a')][_0x6fd6('0x44')](_0x592a9e['toString'](),{'type':db[_0x6fd6('0x7a')][_0x6fd6('0x8a')][_0x6fd6('0x8b')]})[_0x6fd6('0x20')](function(_0xf1207d){if(_0xf1207d[_0x6fd6('0x4a')]===0x1){return _0x227cfc['id'];}else{var _0x384576=_[_0x6fd6('0x8c')](_[_0x6fd6('0x3e')](_0xf1207d,_0x6fd6('0x8d')),function(_0x1ae17c){return _['includes'](_0x416d2f,_0x1ae17c);});if(_0x384576){return _0x227cfc['id'];}}}));}}return BPromise[_0x6fd6('0x8e')](_0xe17be0)[_0x6fd6('0x20')](function(_0x249dc7){_0x5dc132=_(_0x5dc132)[_0x6fd6('0x8f')](_0x249dc7)[_0x6fd6('0x90')]()[_0x6fd6('0x91')]();return db[_0x6fd6('0x3f')][_0x6fd6('0x5a')]({'where':{'id':_0x218cc7[_0x6fd6('0x58')]['id']}})[_0x6fd6('0x20')](function(_0x4c1e0a){return db[_0x6fd6('0x7a')][_0x6fd6('0x7b')](function(_0x1ac0b4){return _0x4c1e0a[_0x6fd6('0x7f')](_0x218cc7[_0x6fd6('0x44')]['ids'],{'transaction':_0x1ac0b4})[_0x6fd6('0x20')](function(){if(!_[_0x6fd6('0x92')](_0x5dc132)){return _0x4c1e0a[_0x6fd6('0x93')](_0x5dc132,{'transaction':_0x1ac0b4});}})['then'](function(){_0x5dc132[_0x6fd6('0x94')](function(_0x47fa46){socket['emit'](_0x6fd6('0x95'),{'UserId':_0x47fa46,'ChatQueueId':_0x4c1e0a['id']});});});});});});})[_0x6fd6('0x20')](respondWithStatusCode(_0x317e52,null))[_0x6fd6('0x29')](handleError(_0x317e52,null));};exports[_0x6fd6('0x96')]=function(_0x5d3244,_0x432637,_0xe6f37a){return db[_0x6fd6('0x3f')][_0x6fd6('0x5a')]({'where':{'id':_0x5d3244['params']['id']}})[_0x6fd6('0x20')](handleEntityNotFound(_0x432637,null))[_0x6fd6('0x20')](function(_0x38635b){if(_0x38635b){return _0x38635b[_0x6fd6('0x96')](_0x5d3244[_0x6fd6('0x5c')][_0x6fd6('0x75')],_[_0x6fd6('0x97')](_0x5d3244['body'],[_0x6fd6('0x75'),'id'])||{})[_0x6fd6('0x98')](function(_0xeabd5a){for(var _0x2d7c3b=0x0;_0x2d7c3b<_0x5d3244[_0x6fd6('0x5c')][_0x6fd6('0x75')][_0x6fd6('0x4a')];_0x2d7c3b+=0x1){socket[_0x6fd6('0x99')](_0x6fd6('0x7e'),{'UserId':Number(_0x5d3244[_0x6fd6('0x5c')][_0x6fd6('0x75')][_0x2d7c3b]),'ChatQueueId':Number(_0x5d3244[_0x6fd6('0x58')]['id'])});}return _0xeabd5a;});}})[_0x6fd6('0x20')](respondWithResult(_0x432637,null))[_0x6fd6('0x29')](handleError(_0x432637,null));};exports[_0x6fd6('0x93')]=function(_0x2df079,_0x1fadbe,_0x187b8){return db['ChatQueue'][_0x6fd6('0x5a')]({'where':{'id':_0x2df079[_0x6fd6('0x58')]['id']}})[_0x6fd6('0x20')](handleEntityNotFound(_0x1fadbe,null))[_0x6fd6('0x20')](function(_0x2cdd3a){if(_0x2cdd3a){return _0x2cdd3a[_0x6fd6('0x93')](_0x2df079[_0x6fd6('0x44')][_0x6fd6('0x75')])['then'](function(){if(_[_0x6fd6('0x9a')](_0x2df079[_0x6fd6('0x44')]['ids'])){for(var _0x559671=0x0;_0x559671<_0x2df079['query']['ids']['length'];_0x559671+=0x1){socket['emit'](_0x6fd6('0x95'),{'UserId':Number(_0x2df079[_0x6fd6('0x44')][_0x6fd6('0x75')][_0x559671]),'ChatQueueId':Number(_0x2df079[_0x6fd6('0x58')]['id'])});}}else{socket['emit'](_0x6fd6('0x95'),{'UserId':Number(_0x2df079[_0x6fd6('0x44')]['ids']),'ChatQueueId':Number(_0x2df079['params']['id'])});}});}})[_0x6fd6('0x20')](respondWithStatusCode(_0x1fadbe,null))['catch'](handleError(_0x1fadbe,null));};exports[_0x6fd6('0x9b')]=function(_0x1b7a74,_0x2544df,_0x4572e8){var _0x11c9d1={};var _0x4815d8={};var _0x19e851;var _0x2652a5;return db[_0x6fd6('0x3f')][_0x6fd6('0x65')]({'where':{'id':_0x1b7a74[_0x6fd6('0x58')]['id']}})[_0x6fd6('0x20')](handleEntityNotFound(_0x2544df,null))[_0x6fd6('0x20')](function(_0x34cb42){if(_0x34cb42){_0x19e851=_0x34cb42;_0x4815d8[_0x6fd6('0x47')]=_[_0x6fd6('0x43')](db[_0x6fd6('0x69')][_0x6fd6('0x59')]);_0x4815d8['query']=_[_0x6fd6('0x43')](_0x1b7a74[_0x6fd6('0x44')]);_0x4815d8[_0x6fd6('0x45')]=_['intersection'](_0x4815d8[_0x6fd6('0x47')],_0x4815d8[_0x6fd6('0x44')]);_0x11c9d1[_0x6fd6('0x49')]=_[_0x6fd6('0x46')](_0x4815d8[_0x6fd6('0x47')],qs[_0x6fd6('0x48')](_0x1b7a74[_0x6fd6('0x44')]['fields']));_0x11c9d1[_0x6fd6('0x49')]=_0x11c9d1['attributes'][_0x6fd6('0x4a')]?_0x11c9d1[_0x6fd6('0x49')]:_0x4815d8[_0x6fd6('0x47')];_0x11c9d1[_0x6fd6('0x73')]=qs[_0x6fd6('0x4d')](_0x1b7a74[_0x6fd6('0x44')][_0x6fd6('0x4d')]);_0x11c9d1['where']=qs[_0x6fd6('0x45')](_[_0x6fd6('0x67')](_0x1b7a74[_0x6fd6('0x44')],_0x4815d8[_0x6fd6('0x45')]));if(_0x1b7a74['query']['filter']){_0x11c9d1[_0x6fd6('0x4e')]=_[_0x6fd6('0x50')](_0x11c9d1['where'],{'$or':_[_0x6fd6('0x3e')](_0x11c9d1[_0x6fd6('0x49')],function(_0x2fd315){var _0x5b6a55={};_0x5b6a55[_0x2fd315]={'$like':'%'+_0x1b7a74['query'][_0x6fd6('0x4f')]+'%'};return _0x5b6a55;})});}_0x11c9d1=_[_0x6fd6('0x50')]({},_0x11c9d1,_0x1b7a74[_0x6fd6('0x52')]);return _0x19e851[_0x6fd6('0x9b')](_0x11c9d1);}})[_0x6fd6('0x20')](function(_0x191ba3){if(_0x191ba3){_0x2652a5=_0x191ba3[_0x6fd6('0x4a')];if(!_0x1b7a74['query']['hasOwnProperty']('nolimit')){_0x11c9d1[_0x6fd6('0x30')]=qs[_0x6fd6('0x30')](_0x1b7a74[_0x6fd6('0x44')][_0x6fd6('0x30')]);_0x11c9d1[_0x6fd6('0x2e')]=qs[_0x6fd6('0x2e')](_0x1b7a74[_0x6fd6('0x44')]['offset']);}return _0x19e851[_0x6fd6('0x9b')](_0x11c9d1);}})[_0x6fd6('0x20')](function(_0x25fc4d){if(_0x25fc4d){return _0x25fc4d?{'count':_0x2652a5,'rows':_0x25fc4d}:null;}})[_0x6fd6('0x20')](respondWithResult(_0x2544df,null))[_0x6fd6('0x29')](handleError(_0x2544df,null));}; \ No newline at end of file +var _0x3c99=['jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','get','UserProfileResource','destroy','end','stack','name','send','index','map','ChatQueue','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','options','includeAll','include','findAll','rows','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','ChatQueueId','merge','UserChatQueue','findAndCountAll','UserId','agent','updatedAt','SIP','createdAt','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','sequelize','toString','SELECT','TeamId','includes','all','union','value','ids','removeAgents','forEach','userChatQueue:remove','addAgents','spread','isArray','getAgents','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatQueue.socket','register'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0x3c99,0x118));var _0x93c9=function(_0x442e4b,_0x526e82){_0x442e4b=_0x442e4b-0x0;var _0x3572c4=_0x3c99[_0x442e4b];return _0x3572c4;};'use strict';var emlformat=require(_0x93c9('0x0'));var rimraf=require(_0x93c9('0x1'));var zipdir=require(_0x93c9('0x2'));var jsonpatch=require(_0x93c9('0x3'));var rp=require(_0x93c9('0x4'));var moment=require(_0x93c9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x93c9('0x6'));var util=require(_0x93c9('0x7'));var path=require('path');var sox=require(_0x93c9('0x8'));var csv=require(_0x93c9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93c9('0xa'));var _=require('lodash');var squel=require(_0x93c9('0xb'));var crypto=require(_0x93c9('0xc'));var jsforce=require(_0x93c9('0xd'));var deskjs=require(_0x93c9('0xe'));var toCsv=require(_0x93c9('0x9'));var querystring=require(_0x93c9('0xf'));var Papa=require(_0x93c9('0x10'));var Redis=require(_0x93c9('0x11'));var authService=require(_0x93c9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x93c9('0x13'));var hardwareService=require(_0x93c9('0x14'));var logger=require(_0x93c9('0x15'))(_0x93c9('0x16'));var utils=require('../../config/utils');var config=require(_0x93c9('0x17'));var licenseUtil=require(_0x93c9('0x18'));var db=require(_0x93c9('0x19'))['db'];config[_0x93c9('0x1a')]=_['defaults'](config[_0x93c9('0x1a')],{'host':_0x93c9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x93c9('0x1c'))[_0x93c9('0x1d')](socket);var jayson=require(_0x93c9('0x1e'));var client=jayson[_0x93c9('0x1f')][_0x93c9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x22eaaf,_0x52c9f7,_0x2f2338,_0x27dbf2){return new BPromise(function(_0x245620,_0x493926){var _0x1282db=_0x27dbf2||client;return _0x1282db[_0x93c9('0x21')](_0x22eaaf,_0x2f2338)[_0x93c9('0x22')](function(_0x13ceec){logger['info'](_0x93c9('0x23'),_0x52c9f7,'request\x20sent');logger[_0x93c9('0x24')](_0x93c9('0x25'),_0x52c9f7,_0x93c9('0x26'),JSON[_0x93c9('0x27')](_0x13ceec));if(_0x13ceec[_0x93c9('0x28')]){if(_0x13ceec[_0x93c9('0x28')][_0x93c9('0x29')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x52c9f7,_0x13ceec[_0x93c9('0x28')]['message']);return _0x493926(_0x13ceec[_0x93c9('0x28')][_0x93c9('0x2a')]);}logger[_0x93c9('0x28')](_0x93c9('0x23'),_0x52c9f7,_0x13ceec['error'][_0x93c9('0x2a')]);return _0x245620(_0x13ceec[_0x93c9('0x28')][_0x93c9('0x2a')]);}else{logger[_0x93c9('0x2b')](_0x93c9('0x23'),_0x52c9f7,_0x93c9('0x26'));_0x245620(_0x13ceec[_0x93c9('0x2c')][_0x93c9('0x2a')]);}})[_0x93c9('0x2d')](function(_0x1bee93){logger[_0x93c9('0x28')](_0x93c9('0x23'),_0x52c9f7,_0x1bee93);_0x493926(_0x1bee93);});});}function respondWithStatusCode(_0x6ee792,_0x839419){_0x839419=_0x839419||0xcc;return function(_0x19faa1){if(_0x19faa1){return _0x6ee792[_0x93c9('0x2e')](_0x839419);}return _0x6ee792[_0x93c9('0x2f')](_0x839419)['end']();};}function respondWithResult(_0x33014e,_0xce1197){_0xce1197=_0xce1197||0xc8;return function(_0x1c8e4c){if(_0x1c8e4c){return _0x33014e[_0x93c9('0x2f')](_0xce1197)['json'](_0x1c8e4c);}};}function respondWithFilteredResult(_0x29ca54,_0x42cefe){return function(_0xc41fd1){if(_0xc41fd1){var _0x963515=typeof _0x42cefe[_0x93c9('0x30')]===_0x93c9('0x31')&&typeof _0x42cefe['limit']===_0x93c9('0x31');var _0x1a9ccd=_0xc41fd1[_0x93c9('0x32')];var _0x5cf165=_0x963515?0x0:_0x42cefe[_0x93c9('0x30')];var _0x1c80eb=_0x963515?_0xc41fd1['count']:_0x42cefe[_0x93c9('0x30')]+_0x42cefe[_0x93c9('0x33')];var _0x4b94b4;if(_0x1c80eb>=_0x1a9ccd){_0x1c80eb=_0x1a9ccd;_0x4b94b4=0xc8;}else{_0x4b94b4=0xce;}_0x29ca54[_0x93c9('0x2f')](_0x4b94b4);return _0x29ca54[_0x93c9('0x34')](_0x93c9('0x35'),_0x5cf165+'-'+_0x1c80eb+'/'+_0x1a9ccd)[_0x93c9('0x36')](_0xc41fd1);}return null;};}function patchUpdates(_0x22d2b9){return function(_0x3538dd){try{jsonpatch['apply'](_0x3538dd,_0x22d2b9,!![]);}catch(_0x3ef665){return BPromise[_0x93c9('0x37')](_0x3ef665);}return _0x3538dd[_0x93c9('0x38')]();};}function saveUpdates(_0x5e8967,_0x547760){return function(_0x1bb157){if(_0x1bb157){return _0x1bb157[_0x93c9('0x39')](_0x5e8967)[_0x93c9('0x22')](function(_0x40ba2f){return _0x40ba2f;});}return null;};}function removeEntity(_0x2be09e,_0x386fb4){return function(_0x59fc92){if(_0x59fc92){return _0x59fc92['destroy']()[_0x93c9('0x22')](function(){var _0x1c108e=_0x59fc92[_0x93c9('0x3a')]({'plain':!![]});var _0x46dbaf='ChatQueues';return db[_0x93c9('0x3b')][_0x93c9('0x3c')]({'where':{'type':_0x46dbaf,'resourceId':_0x1c108e['id']}})[_0x93c9('0x22')](function(){return _0x59fc92;});})[_0x93c9('0x22')](function(){_0x2be09e[_0x93c9('0x2f')](0xcc)[_0x93c9('0x3d')]();});}};}function handleEntityNotFound(_0x8ae12a,_0x194ccf){return function(_0x59aab3){if(!_0x59aab3){_0x8ae12a['sendStatus'](0x194);}return _0x59aab3;};}function handleError(_0x1daaba,_0x6d5e58){_0x6d5e58=_0x6d5e58||0x1f4;return function(_0x303c99){logger[_0x93c9('0x28')](_0x303c99[_0x93c9('0x3e')]);if(_0x303c99[_0x93c9('0x3f')]){delete _0x303c99[_0x93c9('0x3f')];}_0x1daaba[_0x93c9('0x2f')](_0x6d5e58)[_0x93c9('0x40')](_0x303c99);};}exports[_0x93c9('0x41')]=function(_0x30155e,_0x2b132c){var _0x167de0={},_0x27b4de={},_0x42f176={'count':0x0,'rows':[]};var _0x45b0f4=_[_0x93c9('0x42')](db[_0x93c9('0x43')]['rawAttributes'],function(_0xa9a473){return{'name':_0xa9a473[_0x93c9('0x44')],'type':_0xa9a473[_0x93c9('0x45')][_0x93c9('0x46')]};});_0x27b4de[_0x93c9('0x47')]=_[_0x93c9('0x42')](_0x45b0f4,_0x93c9('0x3f'));_0x27b4de[_0x93c9('0x48')]=_[_0x93c9('0x49')](_0x30155e[_0x93c9('0x48')]);_0x27b4de[_0x93c9('0x4a')]=_['intersection'](_0x27b4de[_0x93c9('0x47')],_0x27b4de[_0x93c9('0x48')]);_0x167de0[_0x93c9('0x4b')]=_['intersection'](_0x27b4de[_0x93c9('0x47')],qs['fields'](_0x30155e[_0x93c9('0x48')][_0x93c9('0x4c')]));_0x167de0[_0x93c9('0x4b')]=_0x167de0[_0x93c9('0x4b')][_0x93c9('0x4d')]?_0x167de0[_0x93c9('0x4b')]:_0x27b4de[_0x93c9('0x47')];if(!_0x30155e[_0x93c9('0x48')][_0x93c9('0x4e')](_0x93c9('0x4f'))){_0x167de0[_0x93c9('0x33')]=qs[_0x93c9('0x33')](_0x30155e[_0x93c9('0x48')][_0x93c9('0x33')]);_0x167de0[_0x93c9('0x30')]=qs[_0x93c9('0x30')](_0x30155e[_0x93c9('0x48')][_0x93c9('0x30')]);}_0x167de0['order']=qs['sort'](_0x30155e[_0x93c9('0x48')][_0x93c9('0x50')]);_0x167de0['where']=qs[_0x93c9('0x4a')](_[_0x93c9('0x51')](_0x30155e['query'],_0x27b4de[_0x93c9('0x4a')]),_0x45b0f4);if(_0x30155e['query'][_0x93c9('0x52')]){_0x167de0[_0x93c9('0x53')]=_['merge'](_0x167de0[_0x93c9('0x53')],{'$or':_[_0x93c9('0x42')](_0x45b0f4,function(_0x21aaa5){if(_0x21aaa5[_0x93c9('0x45')]!=='VIRTUAL'){var _0x39144c={};_0x39144c[_0x21aaa5[_0x93c9('0x3f')]]={'$like':'%'+_0x30155e[_0x93c9('0x48')][_0x93c9('0x52')]+'%'};return _0x39144c;}})});}_0x167de0=_['merge']({},_0x167de0,_0x30155e[_0x93c9('0x54')]);var _0x4d3793={'where':_0x167de0[_0x93c9('0x53')]};return db[_0x93c9('0x43')]['count'](_0x4d3793)[_0x93c9('0x22')](function(_0x50d822){_0x42f176[_0x93c9('0x32')]=_0x50d822;if(_0x30155e[_0x93c9('0x48')][_0x93c9('0x55')]){_0x167de0[_0x93c9('0x56')]=[{'all':!![]}];}return db[_0x93c9('0x43')][_0x93c9('0x57')](_0x167de0);})['then'](function(_0x5f0902){_0x42f176[_0x93c9('0x58')]=_0x5f0902;return _0x42f176;})['then'](respondWithFilteredResult(_0x2b132c,_0x167de0))[_0x93c9('0x2d')](handleError(_0x2b132c,null));};exports['show']=function(_0x4747d4,_0xfe662f){var _0x302543={'raw':!![],'where':{'id':_0x4747d4[_0x93c9('0x59')]['id']}},_0x1d8332={};_0x1d8332[_0x93c9('0x47')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x1d8332[_0x93c9('0x48')]=_['keys'](_0x4747d4[_0x93c9('0x48')]);_0x1d8332['filters']=_[_0x93c9('0x5a')](_0x1d8332[_0x93c9('0x47')],_0x1d8332[_0x93c9('0x48')]);_0x302543[_0x93c9('0x4b')]=_[_0x93c9('0x5a')](_0x1d8332[_0x93c9('0x47')],qs[_0x93c9('0x4c')](_0x4747d4[_0x93c9('0x48')][_0x93c9('0x4c')]));_0x302543['attributes']=_0x302543[_0x93c9('0x4b')]['length']?_0x302543[_0x93c9('0x4b')]:_0x1d8332[_0x93c9('0x47')];if(_0x4747d4[_0x93c9('0x48')][_0x93c9('0x55')]){_0x302543[_0x93c9('0x56')]=[{'all':!![]}];}_0x302543=_['merge']({},_0x302543,_0x4747d4['options']);return db[_0x93c9('0x43')][_0x93c9('0x5b')](_0x302543)[_0x93c9('0x22')](handleEntityNotFound(_0xfe662f,null))[_0x93c9('0x22')](respondWithResult(_0xfe662f,null))[_0x93c9('0x2d')](handleError(_0xfe662f,null));};exports[_0x93c9('0x5c')]=function(_0x3e1afe,_0x197076){return db['ChatQueue'][_0x93c9('0x5c')](_0x3e1afe[_0x93c9('0x5d')],{})[_0x93c9('0x22')](function(_0x3619c8){var _0x15b768=_0x3e1afe[_0x93c9('0x5e')][_0x93c9('0x3a')]({'plain':!![]});if(!_0x15b768)throw new Error(_0x93c9('0x5f'));if(_0x15b768[_0x93c9('0x60')]===_0x93c9('0x5e')){var _0x4d2d39=_0x3619c8['get']({'plain':!![]});var _0x1aed1f=_0x93c9('0x61');return db[_0x93c9('0x62')]['find']({'where':{'name':_0x1aed1f,'userProfileId':_0x15b768[_0x93c9('0x63')]},'raw':!![]})[_0x93c9('0x22')](function(_0x20722a){if(_0x20722a&&_0x20722a[_0x93c9('0x64')]===0x0){return db[_0x93c9('0x3b')][_0x93c9('0x5c')]({'name':_0x4d2d39[_0x93c9('0x3f')],'resourceId':_0x4d2d39['id'],'type':_0x20722a[_0x93c9('0x3f')],'sectionId':_0x20722a['id']},{})[_0x93c9('0x22')](function(){return _0x3619c8;});}else{return _0x3619c8;}})['catch'](function(_0x2bb334){logger[_0x93c9('0x28')](_0x93c9('0x65'),_0x2bb334);throw _0x2bb334;});}return _0x3619c8;})[_0x93c9('0x22')](respondWithResult(_0x197076,0xc9))['catch'](handleError(_0x197076,null));};exports[_0x93c9('0x39')]=function(_0x1ad731,_0x3d0912){if(_0x1ad731[_0x93c9('0x5d')]['id']){delete _0x1ad731[_0x93c9('0x5d')]['id'];}return db['ChatQueue'][_0x93c9('0x5b')]({'where':{'id':_0x1ad731[_0x93c9('0x59')]['id']}})[_0x93c9('0x22')](handleEntityNotFound(_0x3d0912,null))[_0x93c9('0x22')](saveUpdates(_0x1ad731[_0x93c9('0x5d')],null))[_0x93c9('0x22')](respondWithResult(_0x3d0912,null))['catch'](handleError(_0x3d0912,null));};exports[_0x93c9('0x3c')]=function(_0x3b717c,_0x266f62){return db[_0x93c9('0x43')][_0x93c9('0x5b')]({'where':{'id':_0x3b717c['params']['id']}})[_0x93c9('0x22')](handleEntityNotFound(_0x266f62,null))[_0x93c9('0x22')](removeEntity(_0x266f62,null))[_0x93c9('0x2d')](handleError(_0x266f62,null));};exports[_0x93c9('0x66')]=function(_0x20a660,_0x3a764e){return db[_0x93c9('0x43')][_0x93c9('0x66')]()[_0x93c9('0x22')](respondWithResult(_0x3a764e,null))[_0x93c9('0x2d')](handleError(_0x3a764e,null));};exports[_0x93c9('0x67')]=function(_0x36c946,_0x3d1b4a,_0x1ae8f9){var _0x26dc99={'raw':!![],'where':{}},_0xf4b114={},_0x3ddf57;return db[_0x93c9('0x43')][_0x93c9('0x68')]({'where':{'id':_0x36c946['params']['id']}})[_0x93c9('0x22')](handleEntityNotFound(_0x3d1b4a,null))['then'](function(_0x22d025){if(_0x22d025){_0x3ddf57=_0x22d025['get']({'plain':!![]});_0xf4b114[_0x93c9('0x47')]=_[_0x93c9('0x49')](db['UserChatQueue']['rawAttributes']);_0xf4b114[_0x93c9('0x48')]=_[_0x93c9('0x49')](_0x36c946[_0x93c9('0x48')]);_0xf4b114[_0x93c9('0x4a')]=_[_0x93c9('0x5a')](_0xf4b114[_0x93c9('0x47')],_0xf4b114['query']);_0x26dc99[_0x93c9('0x4b')]=_['intersection'](_0xf4b114['model'],qs['fields'](_0x36c946[_0x93c9('0x48')]['fields']));_0x26dc99[_0x93c9('0x4b')]=_0x26dc99[_0x93c9('0x4b')][_0x93c9('0x4d')]?_0x26dc99[_0x93c9('0x4b')]:_0xf4b114[_0x93c9('0x47')];if(!_0x36c946[_0x93c9('0x48')]['hasOwnProperty'](_0x93c9('0x4f'))){_0x26dc99[_0x93c9('0x33')]=qs[_0x93c9('0x33')](_0x36c946[_0x93c9('0x48')][_0x93c9('0x33')]);_0x26dc99[_0x93c9('0x30')]=qs[_0x93c9('0x30')](_0x36c946[_0x93c9('0x48')][_0x93c9('0x30')]);}_0x26dc99[_0x93c9('0x69')]=qs['sort'](_0x36c946[_0x93c9('0x48')]['sort']);_0x26dc99[_0x93c9('0x53')]=qs['filters'](_['pick'](_0x36c946['query'],_0xf4b114[_0x93c9('0x4a')]));_0x26dc99[_0x93c9('0x53')][_0x93c9('0x6a')]=_0x22d025['id'];if(_0x36c946['query']['filter']){_0x26dc99[_0x93c9('0x53')]=_[_0x93c9('0x6b')](_0x26dc99['where'],{'$or':_[_0x93c9('0x42')](_0x26dc99[_0x93c9('0x4b')],function(_0x4e127b){var _0x3fb407={};_0x3fb407[_0x4e127b]={'$like':'%'+_0x36c946[_0x93c9('0x48')][_0x93c9('0x52')]+'%'};return _0x3fb407;})});}_0x26dc99=_[_0x93c9('0x6b')]({},_0x26dc99,_0x36c946[_0x93c9('0x54')]);return db[_0x93c9('0x6c')][_0x93c9('0x57')](_0x26dc99);}})[_0x93c9('0x22')](function(_0x10128b){if(_0x10128b){return db['User'][_0x93c9('0x6d')]({'where':{'id':_[_0x93c9('0x42')](_0x10128b,_0x93c9('0x6e')),'role':_0x93c9('0x6f')},'attributes':['id',_0x93c9('0x3f'),'chatPause',_0x93c9('0x70'),'createdAt']});}})['then'](function(_0x316def){if(_0x316def){return{'count':_0x316def['count'],'rows':_[_0x93c9('0x42')](_0x316def[_0x93c9('0x58')],function(_0x5dc1e9){return{'membername':_0x5dc1e9[_0x93c9('0x3f')],'UserId':_0x5dc1e9['id'],'queue_name':_0x3ddf57[_0x93c9('0x3f')],'ChatQueueId':_0x3ddf57['id'],'interface':util['format']('%s/%s',_0x93c9('0x71'),_0x5dc1e9[_0x93c9('0x3f')]),'penalty':0x0,'paused':_0x5dc1e9['chatPause'],'createdAt':_0x5dc1e9[_0x93c9('0x72')],'updatedAt':_0x5dc1e9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x93c9('0x22')](respondWithFilteredResult(_0x3d1b4a,_0x26dc99))[_0x93c9('0x2d')](handleError(_0x3d1b4a,null));};exports[_0x93c9('0x73')]=function(_0x407358,_0x5650e5,_0x57af10){var _0x441a73={};var _0x270815={};var _0x2a11f2;var _0x22d5b8;return db[_0x93c9('0x43')][_0x93c9('0x68')]({'where':{'id':_0x407358[_0x93c9('0x59')]['id']}})[_0x93c9('0x22')](handleEntityNotFound(_0x5650e5,null))['then'](function(_0x55d0cb){if(_0x55d0cb){_0x2a11f2=_0x55d0cb;_0x270815['model']=_[_0x93c9('0x49')](db[_0x93c9('0x74')]['rawAttributes']);_0x270815[_0x93c9('0x48')]=_['keys'](_0x407358[_0x93c9('0x48')]);_0x270815['filters']=_[_0x93c9('0x5a')](_0x270815[_0x93c9('0x47')],_0x270815[_0x93c9('0x48')]);_0x441a73[_0x93c9('0x4b')]=_[_0x93c9('0x5a')](_0x270815['model'],qs['fields'](_0x407358[_0x93c9('0x48')][_0x93c9('0x4c')]));_0x441a73[_0x93c9('0x4b')]=_0x441a73['attributes'][_0x93c9('0x4d')]?_0x441a73[_0x93c9('0x4b')]:_0x270815['model'];_0x441a73[_0x93c9('0x69')]=qs[_0x93c9('0x50')](_0x407358['query']['sort']);_0x441a73[_0x93c9('0x53')]=qs[_0x93c9('0x4a')](_['pick'](_0x407358[_0x93c9('0x48')],_0x270815[_0x93c9('0x4a')]));if(_0x407358[_0x93c9('0x48')][_0x93c9('0x52')]){_0x441a73[_0x93c9('0x53')]=_['merge'](_0x441a73[_0x93c9('0x53')],{'$or':_[_0x93c9('0x42')](_0x441a73['attributes'],function(_0x273d42){var _0x3dc719={};_0x3dc719[_0x273d42]={'$like':'%'+_0x407358['query']['filter']+'%'};return _0x3dc719;})});}_0x441a73=_['merge']({},_0x441a73,_0x407358[_0x93c9('0x54')]);return _0x2a11f2[_0x93c9('0x73')](_0x441a73);}})[_0x93c9('0x22')](function(_0x204dac){if(_0x204dac){_0x22d5b8=_0x204dac[_0x93c9('0x4d')];if(!_0x407358[_0x93c9('0x48')][_0x93c9('0x4e')](_0x93c9('0x4f'))){_0x441a73[_0x93c9('0x33')]=qs[_0x93c9('0x33')](_0x407358['query'][_0x93c9('0x33')]);_0x441a73[_0x93c9('0x30')]=qs['offset'](_0x407358[_0x93c9('0x48')][_0x93c9('0x30')]);}return _0x2a11f2[_0x93c9('0x73')](_0x441a73);}})[_0x93c9('0x22')](function(_0x1882f0){if(_0x1882f0){return _0x1882f0?{'count':_0x22d5b8,'rows':_0x1882f0}:null;}})['then'](respondWithResult(_0x5650e5,null))[_0x93c9('0x2d')](handleError(_0x5650e5,null));};exports[_0x93c9('0x75')]=function(_0x4d6783,_0x42c8fa,_0x2acf0e){var _0x1fa48a=_0x4d6783[_0x93c9('0x5d')]['ids'];return db[_0x93c9('0x74')]['findAll']({'where':{'id':_0x1fa48a},'attributes':['id'],'include':[{'model':db[_0x93c9('0x76')],'as':_0x93c9('0x77'),'attributes':['id',_0x93c9('0x3f'),_0x93c9('0x78'),_0x93c9('0x79'),_0x93c9('0x7a')],'raw':!![]}]})[_0x93c9('0x22')](function(_0x46af7b){if(_0x46af7b){var _0x5a5f43=_[_0x93c9('0x7b')](_0x46af7b,function(_0x3039e0){var _0x4f71f6=_0x3039e0[_0x93c9('0x3a')]({'plain':!![]});return _0x4f71f6[_0x93c9('0x77')];});return db[_0x93c9('0x43')][_0x93c9('0x5b')]({'where':{'id':_0x4d6783[_0x93c9('0x59')]['id']}})[_0x93c9('0x22')](function(_0x378eb9){return db['sequelize'][_0x93c9('0x7c')](function(_0x2b7e89){return _0x378eb9['addTeams'](_0x1fa48a,{'transaction':_0x2b7e89})[_0x93c9('0x22')](function(){return BPromise[_0x93c9('0x7d')](_0x5a5f43,function(_0x11d4a9){return db['UserChatQueue'][_0x93c9('0x7e')]({'where':{'UserId':_0x11d4a9['id'],'ChatQueueId':_0x4d6783[_0x93c9('0x59')]['id']},'transaction':_0x2b7e89});});})['then'](function(){_0x5a5f43['forEach'](function(_0x1ecfe2){socket[_0x93c9('0x7f')](_0x93c9('0x80'),{'UserId':_0x1ecfe2['id'],'ChatQueueId':_0x378eb9['id']});});});});});}})[_0x93c9('0x22')](respondWithStatusCode(_0x42c8fa,null))[_0x93c9('0x2d')](handleError(_0x42c8fa,null));};exports[_0x93c9('0x81')]=function(_0x50b15c,_0x5760e5,_0xd7b5cb){return db[_0x93c9('0x74')]['findAll']({'where':{'id':_0x50b15c['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x93c9('0x76')],'as':_0x93c9('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5760e5,null))[_0x93c9('0x22')](function(_0x45a769){var _0x3a1a8f=_[_0x93c9('0x42')](_0x45a769,'id');var _0x26d7c8=[];var _0x90bb=[];var _0x529a52=squel[_0x93c9('0x82')]();_0x529a52[_0x93c9('0x83')](_0x93c9('0x84'))[_0x93c9('0x85')](_0x93c9('0x86'),'tq')[_0x93c9('0x87')](_0x93c9('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x93c9('0x53')](_0x93c9('0x89'),_0x50b15c['params']['id']);for(var _0x1030e0=0x0;_0x1030e0<_0x45a769[_0x93c9('0x4d')];_0x1030e0+=0x1){let _0x361c97=_0x45a769[_0x1030e0];for(var _0x40ab32=0x0;_0x40ab32<_0x361c97[_0x93c9('0x77')]['length'];_0x40ab32+=0x1){let _0x9e2a08=_0x361c97[_0x93c9('0x77')][_0x40ab32];var _0x52bbac=_0x529a52['clone']();_0x52bbac[_0x93c9('0x53')]('ut.UserId\x20=\x20?',_0x9e2a08['id']);_0x90bb['push'](db[_0x93c9('0x8a')]['query'](_0x52bbac[_0x93c9('0x8b')](),{'type':db[_0x93c9('0x8a')]['QueryTypes'][_0x93c9('0x8c')]})[_0x93c9('0x22')](function(_0x14aaed){if(_0x14aaed[_0x93c9('0x4d')]===0x1){return _0x9e2a08['id'];}else{var _0x351c0b=_['every'](_[_0x93c9('0x42')](_0x14aaed,_0x93c9('0x8d')),function(_0x1496e1){return _[_0x93c9('0x8e')](_0x3a1a8f,_0x1496e1);});if(_0x351c0b){return _0x9e2a08['id'];}}}));}}return BPromise[_0x93c9('0x8f')](_0x90bb)[_0x93c9('0x22')](function(_0x1f1a65){_0x26d7c8=_(_0x26d7c8)[_0x93c9('0x90')](_0x1f1a65)['compact']()[_0x93c9('0x91')]();return db['ChatQueue'][_0x93c9('0x5b')]({'where':{'id':_0x50b15c[_0x93c9('0x59')]['id']}})['then'](function(_0x4ac921){return db[_0x93c9('0x8a')][_0x93c9('0x7c')](function(_0x1777ff){return _0x4ac921[_0x93c9('0x81')](_0x50b15c[_0x93c9('0x48')][_0x93c9('0x92')],{'transaction':_0x1777ff})[_0x93c9('0x22')](function(){if(!_['isEmpty'](_0x26d7c8)){return _0x4ac921[_0x93c9('0x93')](_0x26d7c8,{'transaction':_0x1777ff});}})[_0x93c9('0x22')](function(){_0x26d7c8[_0x93c9('0x94')](function(_0x5496cb){socket[_0x93c9('0x7f')](_0x93c9('0x95'),{'UserId':_0x5496cb,'ChatQueueId':_0x4ac921['id']});});});});});});})[_0x93c9('0x22')](respondWithStatusCode(_0x5760e5,null))[_0x93c9('0x2d')](handleError(_0x5760e5,null));};exports[_0x93c9('0x96')]=function(_0x1a633b,_0x5138de,_0x47c1c9){return db[_0x93c9('0x43')][_0x93c9('0x5b')]({'where':{'id':_0x1a633b[_0x93c9('0x59')]['id']}})['then'](handleEntityNotFound(_0x5138de,null))['then'](function(_0x23a9d1){if(_0x23a9d1){return _0x23a9d1[_0x93c9('0x96')](_0x1a633b[_0x93c9('0x5d')]['ids'],_['omit'](_0x1a633b[_0x93c9('0x5d')],[_0x93c9('0x92'),'id'])||{})[_0x93c9('0x97')](function(_0x4d6f1c){for(var _0x225af6=0x0;_0x225af6<_0x1a633b['body'][_0x93c9('0x92')][_0x93c9('0x4d')];_0x225af6+=0x1){socket[_0x93c9('0x7f')](_0x93c9('0x80'),{'UserId':Number(_0x1a633b[_0x93c9('0x5d')]['ids'][_0x225af6]),'ChatQueueId':Number(_0x1a633b[_0x93c9('0x59')]['id'])});}return _0x4d6f1c;});}})[_0x93c9('0x22')](respondWithResult(_0x5138de,null))['catch'](handleError(_0x5138de,null));};exports[_0x93c9('0x93')]=function(_0x14e80c,_0x210db3,_0x59794d){return db['ChatQueue'][_0x93c9('0x5b')]({'where':{'id':_0x14e80c['params']['id']}})[_0x93c9('0x22')](handleEntityNotFound(_0x210db3,null))[_0x93c9('0x22')](function(_0x23234b){if(_0x23234b){return _0x23234b[_0x93c9('0x93')](_0x14e80c['query'][_0x93c9('0x92')])['then'](function(){if(_[_0x93c9('0x98')](_0x14e80c[_0x93c9('0x48')][_0x93c9('0x92')])){for(var _0x21de1b=0x0;_0x21de1b<_0x14e80c[_0x93c9('0x48')][_0x93c9('0x92')][_0x93c9('0x4d')];_0x21de1b+=0x1){socket[_0x93c9('0x7f')](_0x93c9('0x95'),{'UserId':Number(_0x14e80c['query'][_0x93c9('0x92')][_0x21de1b]),'ChatQueueId':Number(_0x14e80c[_0x93c9('0x59')]['id'])});}}else{socket[_0x93c9('0x7f')]('userChatQueue:remove',{'UserId':Number(_0x14e80c[_0x93c9('0x48')]['ids']),'ChatQueueId':Number(_0x14e80c[_0x93c9('0x59')]['id'])});}});}})[_0x93c9('0x22')](respondWithStatusCode(_0x210db3,null))[_0x93c9('0x2d')](handleError(_0x210db3,null));};exports[_0x93c9('0x99')]=function(_0x2356ce,_0x2d8c1f,_0xa6e824){var _0x2e4461={};var _0x36b778={};var _0x359b21;var _0x3ad856;return db[_0x93c9('0x43')][_0x93c9('0x68')]({'where':{'id':_0x2356ce['params']['id']}})[_0x93c9('0x22')](handleEntityNotFound(_0x2d8c1f,null))[_0x93c9('0x22')](function(_0x3c2b5b){if(_0x3c2b5b){_0x359b21=_0x3c2b5b;_0x36b778['model']=_[_0x93c9('0x49')](db[_0x93c9('0x76')][_0x93c9('0x9a')]);_0x36b778['query']=_[_0x93c9('0x49')](_0x2356ce[_0x93c9('0x48')]);_0x36b778[_0x93c9('0x4a')]=_[_0x93c9('0x5a')](_0x36b778['model'],_0x36b778[_0x93c9('0x48')]);_0x2e4461[_0x93c9('0x4b')]=_['intersection'](_0x36b778[_0x93c9('0x47')],qs[_0x93c9('0x4c')](_0x2356ce[_0x93c9('0x48')][_0x93c9('0x4c')]));_0x2e4461['attributes']=_0x2e4461[_0x93c9('0x4b')][_0x93c9('0x4d')]?_0x2e4461['attributes']:_0x36b778[_0x93c9('0x47')];_0x2e4461[_0x93c9('0x69')]=qs['sort'](_0x2356ce[_0x93c9('0x48')][_0x93c9('0x50')]);_0x2e4461[_0x93c9('0x53')]=qs[_0x93c9('0x4a')](_[_0x93c9('0x51')](_0x2356ce[_0x93c9('0x48')],_0x36b778['filters']));if(_0x2356ce[_0x93c9('0x48')][_0x93c9('0x52')]){_0x2e4461['where']=_[_0x93c9('0x6b')](_0x2e4461[_0x93c9('0x53')],{'$or':_[_0x93c9('0x42')](_0x2e4461['attributes'],function(_0x5a5c28){var _0x111d8a={};_0x111d8a[_0x5a5c28]={'$like':'%'+_0x2356ce[_0x93c9('0x48')]['filter']+'%'};return _0x111d8a;})});}_0x2e4461=_[_0x93c9('0x6b')]({},_0x2e4461,_0x2356ce[_0x93c9('0x54')]);return _0x359b21[_0x93c9('0x99')](_0x2e4461);}})[_0x93c9('0x22')](function(_0x276794){if(_0x276794){_0x3ad856=_0x276794['length'];if(!_0x2356ce[_0x93c9('0x48')][_0x93c9('0x4e')](_0x93c9('0x4f'))){_0x2e4461[_0x93c9('0x33')]=qs[_0x93c9('0x33')](_0x2356ce[_0x93c9('0x48')][_0x93c9('0x33')]);_0x2e4461[_0x93c9('0x30')]=qs[_0x93c9('0x30')](_0x2356ce[_0x93c9('0x48')]['offset']);}return _0x359b21[_0x93c9('0x99')](_0x2e4461);}})[_0x93c9('0x22')](function(_0x279277){if(_0x279277){return _0x279277?{'count':_0x3ad856,'rows':_0x279277}:null;}})[_0x93c9('0x22')](respondWithResult(_0x2d8c1f,null))[_0x93c9('0x2d')](handleError(_0x2d8c1f,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 917c472..96b9596 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 _0xa3e6=['hook','exports','events','ChatQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x4453e8,_0xbc65d4){var _0xa34c40=function(_0x362940){while(--_0x362940){_0x4453e8['push'](_0x4453e8['shift']());}};_0xa34c40(++_0xbc65d4);}(_0xa3e6,0x158));var _0x6a3e=function(_0x26adb0,_0x49a58b){_0x26adb0=_0x26adb0-0x0;var _0x364fe7=_0xa3e6[_0x26adb0];return _0x364fe7;};'use strict';var EventEmitter=require(_0x6a3e('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x6a3e('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a3e('0x2'),'afterUpdate':_0x6a3e('0x3'),'afterDestroy':_0x6a3e('0x4')};function emitEvent(_0x5d8e3d){return function(_0x2190fc,_0x35a2b6,_0x3da56a){ChatQueueEvents[_0x6a3e('0x5')](_0x5d8e3d+':'+_0x2190fc['id'],_0x2190fc);ChatQueueEvents[_0x6a3e('0x5')](_0x5d8e3d,_0x2190fc);_0x3da56a(null);};}for(var e in events){if(events[_0x6a3e('0x6')](e)){var event=events[e];ChatQueue[_0x6a3e('0x7')](e,emitEvent(event));}}module[_0x6a3e('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x10f5=['exports','ChatQueue','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x23ea15,_0x2359c6){var _0x46723c=function(_0x2fdbc0){while(--_0x2fdbc0){_0x23ea15['push'](_0x23ea15['shift']());}};_0x46723c(++_0x2359c6);}(_0x10f5,0x166));var _0x510f=function(_0x11e05f,_0x995310){_0x11e05f=_0x11e05f-0x0;var _0x161c00=_0x10f5[_0x11e05f];return _0x161c00;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x510f('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x510f('0x1')](0x0);var events={'afterCreate':_0x510f('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x320ab3){return function(_0x1ac218,_0x543ec9,_0x259012){ChatQueueEvents['emit'](_0x320ab3+':'+_0x1ac218['id'],_0x1ac218);ChatQueueEvents[_0x510f('0x3')](_0x320ab3,_0x1ac218);_0x259012(null);};}for(var e in events){if(events[_0x510f('0x4')](e)){var event=events[e];ChatQueue[_0x510f('0x5')](e,emitEvent(event));}}module[_0x510f('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index e9822fe..b5a87ac 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 _0x2bc2=['path','rimraf','./chatQueue.attributes','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bc2,0x109));var _0x22bc=function(_0xfa797,_0x423793){_0xfa797=_0xfa797-0x0;var _0x3dc872=_0x2bc2[_0xfa797];return _0x3dc872;};'use strict';var _=require(_0x22bc('0x0'));var util=require(_0x22bc('0x1'));var logger=require(_0x22bc('0x2'))(_0x22bc('0x3'));var moment=require(_0x22bc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x22bc('0x5'));var rimraf=require(_0x22bc('0x6'));var config=require('../../config/environment');var attributes=require(_0x22bc('0x7'));module['exports']=function(_0x173e28,_0xe04cf0){return _0x173e28['define'](_0x22bc('0x8'),attributes,{'tableName':_0x22bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a1f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue','chat_queues'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x0a1f,0x11e));var _0xf0a1=function(_0x3ace6c,_0x204396){_0x3ace6c=_0x3ace6c-0x0;var _0x4df0ca=_0x0a1f[_0x3ace6c];return _0x4df0ca;};'use strict';var _=require('lodash');var util=require(_0xf0a1('0x0'));var logger=require(_0xf0a1('0x1'))(_0xf0a1('0x2'));var moment=require(_0xf0a1('0x3'));var BPromise=require(_0xf0a1('0x4'));var rp=require(_0xf0a1('0x5'));var fs=require('fs');var path=require(_0xf0a1('0x6'));var rimraf=require(_0xf0a1('0x7'));var config=require(_0xf0a1('0x8'));var attributes=require('./chatQueue.attributes');module[_0xf0a1('0x9')]=function(_0x1c3cdf,_0x535b16){return _0x1c3cdf[_0xf0a1('0xa')](_0xf0a1('0xb'),attributes,{'tableName':_0xf0a1('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 721292d..e049f53 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 _0x1bc6=['error','message','ChatQueue,\x20%s,\x20%s','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetChatQueue','stringify','ChatQueue','find','ShowChatQueue','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','code'];(function(_0x4b2a3c,_0x31b0d9){var _0x3f0599=function(_0x3b0641){while(--_0x3b0641){_0x4b2a3c['push'](_0x4b2a3c['shift']());}};_0x3f0599(++_0x31b0d9);}(_0x1bc6,0x94));var _0x61bc=function(_0x4d85d4,_0x1a2a89){_0x4d85d4=_0x4d85d4-0x0;var _0x40885d=_0x1bc6[_0x4d85d4];return _0x40885d;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var moment=require(_0x61bc('0x2'));var BPromise=require(_0x61bc('0x3'));var rs=require(_0x61bc('0x4'));var fs=require('fs');var Redis=require(_0x61bc('0x5'));var db=require(_0x61bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x61bc('0x7'))(_0x61bc('0x8'));var config=require(_0x61bc('0x9'));var jayson=require(_0x61bc('0xa'));var client=jayson[_0x61bc('0xb')][_0x61bc('0xc')]({'port':0x232a});config[_0x61bc('0xd')]=_[_0x61bc('0xe')](config[_0x61bc('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x61bc('0xf'))(new Redis(config['redis']));require(_0x61bc('0x10'))['register'](socket);function respondWithRpcPromise(_0x139c92,_0x526b6c,_0x23ff47){return new BPromise(function(_0x34650a,_0x955483){return client['request'](_0x139c92,_0x23ff47)['then'](function(_0x508f2f){logger['info']('ChatQueue,\x20%s,\x20%s',_0x526b6c,_0x61bc('0x11'));logger['debug'](_0x61bc('0x12'),_0x526b6c,_0x61bc('0x11'),JSON['stringify'](_0x508f2f));if(_0x508f2f['error']){if(_0x508f2f['error'][_0x61bc('0x13')]===0x1f4){logger[_0x61bc('0x14')]('ChatQueue,\x20%s,\x20%s',_0x526b6c,_0x508f2f[_0x61bc('0x14')][_0x61bc('0x15')]);return _0x955483(_0x508f2f[_0x61bc('0x14')][_0x61bc('0x15')]);}logger[_0x61bc('0x14')](_0x61bc('0x16'),_0x526b6c,_0x508f2f['error'][_0x61bc('0x15')]);return _0x34650a(_0x508f2f[_0x61bc('0x14')]['message']);}else{logger['info'](_0x61bc('0x16'),_0x526b6c,_0x61bc('0x11'));_0x34650a(_0x508f2f[_0x61bc('0x17')]['message']);}})[_0x61bc('0x18')](function(_0x44b6d1){logger[_0x61bc('0x14')](_0x61bc('0x16'),_0x526b6c,_0x44b6d1);_0x955483(_0x44b6d1);});});}exports['GetChatQueue']=function(_0x200ba4){var _0x329577=this;return new Promise(function(_0x164b95,_0x144b07){return db['ChatQueue'][_0x61bc('0x19')]({'raw':_0x200ba4[_0x61bc('0x1a')]?_0x200ba4[_0x61bc('0x1a')][_0x61bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x200ba4[_0x61bc('0x1a')]?_0x200ba4[_0x61bc('0x1a')][_0x61bc('0x1c')]||null:null,'attributes':_0x200ba4['options']?_0x200ba4[_0x61bc('0x1a')][_0x61bc('0x1d')]||null:null,'limit':_0x200ba4[_0x61bc('0x1a')]?_0x200ba4[_0x61bc('0x1a')][_0x61bc('0x1e')]||null:null,'include':_0x200ba4['options']?_0x200ba4[_0x61bc('0x1a')][_0x61bc('0x1f')]?_[_0x61bc('0x20')](_0x200ba4[_0x61bc('0x1a')][_0x61bc('0x1f')],function(_0x52432d){return{'model':db[_0x52432d['model']],'as':_0x52432d['as'],'attributes':_0x52432d[_0x61bc('0x1d')],'include':_0x52432d['include']?_[_0x61bc('0x20')](_0x52432d[_0x61bc('0x1f')],function(_0x22b21e){return{'model':db[_0x22b21e[_0x61bc('0x21')]],'as':_0x22b21e['as'],'attributes':_0x22b21e['attributes'],'include':_0x22b21e[_0x61bc('0x1f')]?_[_0x61bc('0x20')](_0x22b21e[_0x61bc('0x1f')],function(_0x256b54){return{'model':db[_0x256b54[_0x61bc('0x21')]],'as':_0x256b54['as'],'attributes':_0x256b54[_0x61bc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x61bc('0x22')](function(_0x13c3db){logger[_0x61bc('0x23')](_0x61bc('0x24'),_0x200ba4);logger['debug'](_0x61bc('0x24'),_0x200ba4,JSON[_0x61bc('0x25')](_0x13c3db));_0x164b95(_0x13c3db);})[_0x61bc('0x18')](function(_0x384a55){logger[_0x61bc('0x14')](_0x61bc('0x24'),_0x384a55[_0x61bc('0x15')],_0x200ba4);_0x144b07(_0x329577[_0x61bc('0x14')](0x1f4,_0x384a55[_0x61bc('0x15')]));});});};exports['ShowChatQueue']=function(_0x51dc4b){var _0x5bc09c=this;return new Promise(function(_0x424a18,_0x12e2d6){return db[_0x61bc('0x26')][_0x61bc('0x27')]({'raw':_0x51dc4b[_0x61bc('0x1a')]?_0x51dc4b[_0x61bc('0x1a')][_0x61bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x51dc4b[_0x61bc('0x1a')]?_0x51dc4b['options'][_0x61bc('0x1c')]||null:null,'attributes':_0x51dc4b[_0x61bc('0x1a')]?_0x51dc4b['options'][_0x61bc('0x1d')]||null:null,'include':_0x51dc4b['options']?_0x51dc4b[_0x61bc('0x1a')]['include']?_[_0x61bc('0x20')](_0x51dc4b[_0x61bc('0x1a')][_0x61bc('0x1f')],function(_0x5bd6e8){return{'model':db[_0x5bd6e8['model']],'as':_0x5bd6e8['as'],'attributes':_0x5bd6e8['attributes'],'include':_0x5bd6e8[_0x61bc('0x1f')]?_[_0x61bc('0x20')](_0x5bd6e8['include'],function(_0x4892fb){return{'model':db[_0x4892fb[_0x61bc('0x21')]],'as':_0x4892fb['as'],'attributes':_0x4892fb[_0x61bc('0x1d')],'include':_0x4892fb['include']?_[_0x61bc('0x20')](_0x4892fb[_0x61bc('0x1f')],function(_0xd4b07c){return{'model':db[_0xd4b07c['model']],'as':_0xd4b07c['as'],'attributes':_0xd4b07c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x38a241){logger['info'](_0x61bc('0x28'),_0x51dc4b);logger[_0x61bc('0x29')](_0x61bc('0x28'),_0x51dc4b,JSON[_0x61bc('0x25')](_0x38a241));_0x424a18(_0x38a241);})['catch'](function(_0x254522){logger['error'](_0x61bc('0x28'),_0x254522['message'],_0x51dc4b);_0x12e2d6(_0x5bc09c[_0x61bc('0x14')](0x1f4,_0x254522[_0x61bc('0x15')]));});});}; \ No newline at end of file +var _0x7c47=['raw','attributes','limit','include','model','map','GetChatQueue','debug','catch','where','ShowChatQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','ChatQueue','findAll','options'];(function(_0x177e2c,_0x29f1da){var _0x3a1f88=function(_0x28f445){while(--_0x28f445){_0x177e2c['push'](_0x177e2c['shift']());}};_0x3a1f88(++_0x29f1da);}(_0x7c47,0x1b8));var _0x77c4=function(_0x2eca03,_0x25c199){_0x2eca03=_0x2eca03-0x0;var _0x5940e7=_0x7c47[_0x2eca03];return _0x5940e7;};'use strict';var _=require(_0x77c4('0x0'));var util=require('util');var moment=require(_0x77c4('0x1'));var BPromise=require(_0x77c4('0x2'));var rs=require(_0x77c4('0x3'));var fs=require('fs');var Redis=require(_0x77c4('0x4'));var db=require(_0x77c4('0x5'))['db'];var utils=require(_0x77c4('0x6'));var logger=require(_0x77c4('0x7'))('rpc');var config=require(_0x77c4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x77c4('0x9')]({'port':0x232a});config[_0x77c4('0xa')]=_['defaults'](config[_0x77c4('0xa')],{'host':_0x77c4('0xb'),'port':0x18eb});var socket=require(_0x77c4('0xc'))(new Redis(config[_0x77c4('0xa')]));require(_0x77c4('0xd'))[_0x77c4('0xe')](socket);function respondWithRpcPromise(_0x4caa82,_0x486d28,_0x233eff){return new BPromise(function(_0x3c6bfb,_0x3b9de9){return client[_0x77c4('0xf')](_0x4caa82,_0x233eff)[_0x77c4('0x10')](function(_0x25c25b){logger['info'](_0x77c4('0x11'),_0x486d28,_0x77c4('0x12'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x486d28,_0x77c4('0x12'),JSON[_0x77c4('0x13')](_0x25c25b));if(_0x25c25b['error']){if(_0x25c25b[_0x77c4('0x14')][_0x77c4('0x15')]===0x1f4){logger[_0x77c4('0x14')](_0x77c4('0x11'),_0x486d28,_0x25c25b[_0x77c4('0x14')]['message']);return _0x3b9de9(_0x25c25b[_0x77c4('0x14')][_0x77c4('0x16')]);}logger['error'](_0x77c4('0x11'),_0x486d28,_0x25c25b[_0x77c4('0x14')][_0x77c4('0x16')]);return _0x3c6bfb(_0x25c25b[_0x77c4('0x14')]['message']);}else{logger[_0x77c4('0x17')](_0x77c4('0x11'),_0x486d28,_0x77c4('0x12'));_0x3c6bfb(_0x25c25b[_0x77c4('0x18')]['message']);}})['catch'](function(_0x1ad6ee){logger['error'](_0x77c4('0x11'),_0x486d28,_0x1ad6ee);_0x3b9de9(_0x1ad6ee);});});}exports['GetChatQueue']=function(_0x123769){var _0x4c478e=this;return new Promise(function(_0x1501f7,_0x35e956){return db[_0x77c4('0x19')][_0x77c4('0x1a')]({'raw':_0x123769[_0x77c4('0x1b')]?_0x123769[_0x77c4('0x1b')][_0x77c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x123769['options']?_0x123769['options']['where']||null:null,'attributes':_0x123769['options']?_0x123769['options'][_0x77c4('0x1d')]||null:null,'limit':_0x123769[_0x77c4('0x1b')]?_0x123769[_0x77c4('0x1b')][_0x77c4('0x1e')]||null:null,'include':_0x123769[_0x77c4('0x1b')]?_0x123769[_0x77c4('0x1b')][_0x77c4('0x1f')]?_['map'](_0x123769[_0x77c4('0x1b')]['include'],function(_0x11a58f){return{'model':db[_0x11a58f[_0x77c4('0x20')]],'as':_0x11a58f['as'],'attributes':_0x11a58f[_0x77c4('0x1d')],'include':_0x11a58f[_0x77c4('0x1f')]?_[_0x77c4('0x21')](_0x11a58f[_0x77c4('0x1f')],function(_0x20b370){return{'model':db[_0x20b370[_0x77c4('0x20')]],'as':_0x20b370['as'],'attributes':_0x20b370['attributes'],'include':_0x20b370[_0x77c4('0x1f')]?_[_0x77c4('0x21')](_0x20b370[_0x77c4('0x1f')],function(_0x4e2676){return{'model':db[_0x4e2676[_0x77c4('0x20')]],'as':_0x4e2676['as'],'attributes':_0x4e2676[_0x77c4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x77c4('0x10')](function(_0x5c8005){logger['info'](_0x77c4('0x22'),_0x123769);logger[_0x77c4('0x23')](_0x77c4('0x22'),_0x123769,JSON[_0x77c4('0x13')](_0x5c8005));_0x1501f7(_0x5c8005);})[_0x77c4('0x24')](function(_0x2e3923){logger[_0x77c4('0x14')](_0x77c4('0x22'),_0x2e3923[_0x77c4('0x16')],_0x123769);_0x35e956(_0x4c478e['error'](0x1f4,_0x2e3923[_0x77c4('0x16')]));});});};exports['ShowChatQueue']=function(_0x380dea){var _0x46222d=this;return new Promise(function(_0xc46df4,_0x7f3d99){return db[_0x77c4('0x19')]['find']({'raw':_0x380dea[_0x77c4('0x1b')]?_0x380dea[_0x77c4('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x380dea[_0x77c4('0x1b')]?_0x380dea[_0x77c4('0x1b')][_0x77c4('0x25')]||null:null,'attributes':_0x380dea[_0x77c4('0x1b')]?_0x380dea[_0x77c4('0x1b')][_0x77c4('0x1d')]||null:null,'include':_0x380dea[_0x77c4('0x1b')]?_0x380dea[_0x77c4('0x1b')]['include']?_[_0x77c4('0x21')](_0x380dea[_0x77c4('0x1b')][_0x77c4('0x1f')],function(_0xb7c06b){return{'model':db[_0xb7c06b[_0x77c4('0x20')]],'as':_0xb7c06b['as'],'attributes':_0xb7c06b['attributes'],'include':_0xb7c06b['include']?_['map'](_0xb7c06b['include'],function(_0x1a0b7c){return{'model':db[_0x1a0b7c[_0x77c4('0x20')]],'as':_0x1a0b7c['as'],'attributes':_0x1a0b7c[_0x77c4('0x1d')],'include':_0x1a0b7c[_0x77c4('0x1f')]?_[_0x77c4('0x21')](_0x1a0b7c['include'],function(_0xa8d5a9){return{'model':db[_0xa8d5a9[_0x77c4('0x20')]],'as':_0xa8d5a9['as'],'attributes':_0xa8d5a9[_0x77c4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16f83d){logger['info']('ShowChatQueue',_0x380dea);logger[_0x77c4('0x23')](_0x77c4('0x26'),_0x380dea,JSON['stringify'](_0x16f83d));_0xc46df4(_0x16f83d);})[_0x77c4('0x24')](function(_0xb98f2d){logger[_0x77c4('0x14')](_0x77c4('0x26'),_0xb98f2d[_0x77c4('0x16')],_0x380dea);_0x7f3d99(_0x46222d[_0x77c4('0x14')](0x1f4,_0xb98f2d[_0x77c4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 65c0a7d..a48cc72 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 _0xb458=['length','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x53181f,_0x243aa4){var _0x3bf911=function(_0x4a0d68){while(--_0x4a0d68){_0x53181f['push'](_0x53181f['shift']());}};_0x3bf911(++_0x243aa4);}(_0xb458,0x103));var _0x8b45=function(_0x57b501,_0x5b583d){_0x57b501=_0x57b501-0x0;var _0x261cb1=_0xb458[_0x57b501];return _0x261cb1;};'use strict';var ChatQueueEvents=require(_0x8b45('0x0'));var events=[_0x8b45('0x1'),_0x8b45('0x2'),'update'];function createListener(_0x58a508,_0xdf89d4){return function(_0x93d9cd){_0xdf89d4[_0x8b45('0x3')](_0x58a508,_0x93d9cd);};}function removeListener(_0x13a8c6,_0x5d51e4){return function(){ChatQueueEvents[_0x8b45('0x4')](_0x13a8c6,_0x5d51e4);};}exports['register']=function(_0x5cc2d5){for(var _0xe8d774=0x0,_0x12bd05=events[_0x8b45('0x5')];_0xe8d774<_0x12bd05;_0xe8d774++){var _0x3a8ccb=events[_0xe8d774];var _0x32342f=createListener('chatQueue:'+_0x3a8ccb,_0x5cc2d5);ChatQueueEvents['on'](_0x3a8ccb,_0x32342f);}}; \ No newline at end of file +var _0x4d9e=['removeListener','register','length','chatQueue:','./chatQueue.events','update','emit'];(function(_0x5481b8,_0x14f375){var _0x480673=function(_0x5e9331){while(--_0x5e9331){_0x5481b8['push'](_0x5481b8['shift']());}};_0x480673(++_0x14f375);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x28ea18,_0x6a156c){_0x28ea18=_0x28ea18-0x0;var _0x25512d=_0x4d9e[_0x28ea18];return _0x25512d;};'use strict';var ChatQueueEvents=require(_0xe4d9('0x0'));var events=['save','remove',_0xe4d9('0x1')];function createListener(_0x574c1d,_0x36adac){return function(_0x4d7687){_0x36adac[_0xe4d9('0x2')](_0x574c1d,_0x4d7687);};}function removeListener(_0x2deaef,_0x47a09f){return function(){ChatQueueEvents[_0xe4d9('0x3')](_0x2deaef,_0x47a09f);};}exports[_0xe4d9('0x4')]=function(_0x278035){for(var _0x34c2a2=0x0,_0x125dbc=events[_0xe4d9('0x5')];_0x34c2a2<_0x125dbc;_0x34c2a2++){var _0x54a63a=events[_0x34c2a2];var _0x36316f=createListener(_0xe4d9('0x6')+_0x54a63a,_0x278035);ChatQueueEvents['on'](_0x54a63a,_0x36316f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 63a6250..097042b 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 _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(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x5fc3[_0x2181fc];return _0x315da1;};'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 +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x422311,_0x54125c){var _0x356858=function(_0x283a0f){while(--_0x283a0f){_0x422311['push'](_0x422311['shift']());}};_0x356858(++_0x54125c);}(_0x55ca,0x126));var _0xa55c=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x55ca[_0xc87d08];return _0x30a714;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f2ca400..4815ec2 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 _0x5556=['DATE','STRING','moment','sequelize','exports'];(function(_0x53309a,_0x4fc4f2){var _0x44b63f=function(_0x498832){while(--_0x498832){_0x53309a['push'](_0x53309a['shift']());}};_0x44b63f(++_0x4fc4f2);}(_0x5556,0x138));var _0x6555=function(_0x114356,_0x561b7a){_0x114356=_0x114356-0x0;var _0xd46fa7=_0x5556[_0x114356];return _0xd46fa7;};'use strict';var moment=require(_0x6555('0x0'));var Sequelize=require(_0x6555('0x1'));module[_0x6555('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6555('0x3')]},'acceptAt':{'type':Sequelize[_0x6555('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6555('0x4')]}}; \ No newline at end of file +var _0xdc69=['DATE','moment','exports','STRING'];(function(_0x62e562,_0x3618a4){var _0x5683fa=function(_0x4858da){while(--_0x4858da){_0x62e562['push'](_0x62e562['shift']());}};_0x5683fa(++_0x3618a4);}(_0xdc69,0x165));var _0x9dc6=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0xdc69[_0x53afe9];return _0x396396;};'use strict';var moment=require(_0x9dc6('0x0'));var Sequelize=require('sequelize');module[_0x9dc6('0x1')]={'uniqueid':{'type':Sequelize[_0x9dc6('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9dc6('0x3')]},'leaveAt':{'type':Sequelize[_0x9dc6('0x3')]},'acceptAt':{'type':Sequelize[_0x9dc6('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9dc6('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 4c145d6..8c8bb93 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 _0x6faf=['nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','options','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x322267,_0xcb0b2f){var _0x30c627=function(_0x54ddce){while(--_0x54ddce){_0x322267['push'](_0x322267['shift']());}};_0x30c627(++_0xcb0b2f);}(_0x6faf,0xf9));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6fa('0x0'));var zipdir=require(_0xf6fa('0x1'));var jsonpatch=require(_0xf6fa('0x2'));var rp=require(_0xf6fa('0x3'));var moment=require(_0xf6fa('0x4'));var BPromise=require(_0xf6fa('0x5'));var Mustache=require('mustache');var util=require(_0xf6fa('0x6'));var path=require('path');var sox=require(_0xf6fa('0x7'));var csv=require('to-csv');var ejs=require(_0xf6fa('0x8'));var fs=require('fs');var fs_extra=require(_0xf6fa('0x9'));var _=require(_0xf6fa('0xa'));var squel=require(_0xf6fa('0xb'));var crypto=require(_0xf6fa('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf6fa('0xd'));var toCsv=require(_0xf6fa('0xe'));var querystring=require(_0xf6fa('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf6fa('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf6fa('0x11'));var hardwareService=require(_0xf6fa('0x12'));var logger=require('../../config/logger')(_0xf6fa('0x13'));var utils=require('../../config/utils');var config=require(_0xf6fa('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dbed1,_0x1e86a2){_0x1e86a2=_0x1e86a2||0xcc;return function(_0xa954e5){if(_0xa954e5){return _0x5dbed1[_0xf6fa('0x15')](_0x1e86a2);}return _0x5dbed1[_0xf6fa('0x16')](_0x1e86a2)[_0xf6fa('0x17')]();};}function respondWithResult(_0x2c55ee,_0x1fc465){_0x1fc465=_0x1fc465||0xc8;return function(_0xdaa809){if(_0xdaa809){return _0x2c55ee[_0xf6fa('0x16')](_0x1fc465)[_0xf6fa('0x18')](_0xdaa809);}};}function respondWithFilteredResult(_0x3aa685,_0x575dcb){return function(_0x313015){if(_0x313015){var _0x1630fe=typeof _0x575dcb['offset']===_0xf6fa('0x19')&&typeof _0x575dcb[_0xf6fa('0x1a')]===_0xf6fa('0x19');var _0x572f68=_0x313015[_0xf6fa('0x1b')];var _0x98737b=_0x1630fe?0x0:_0x575dcb[_0xf6fa('0x1c')];var _0x18b839=_0x1630fe?_0x313015[_0xf6fa('0x1b')]:_0x575dcb['offset']+_0x575dcb[_0xf6fa('0x1a')];var _0x58fc12;if(_0x18b839>=_0x572f68){_0x18b839=_0x572f68;_0x58fc12=0xc8;}else{_0x58fc12=0xce;}_0x3aa685[_0xf6fa('0x16')](_0x58fc12);return _0x3aa685[_0xf6fa('0x1d')](_0xf6fa('0x1e'),_0x98737b+'-'+_0x18b839+'/'+_0x572f68)['json'](_0x313015);}return null;};}function patchUpdates(_0x3877b8){return function(_0xd33b8){try{jsonpatch[_0xf6fa('0x1f')](_0xd33b8,_0x3877b8,!![]);}catch(_0x511852){return BPromise[_0xf6fa('0x20')](_0x511852);}return _0xd33b8[_0xf6fa('0x21')]();};}function saveUpdates(_0x1ebdf8,_0x232848){return function(_0x503e17){if(_0x503e17){return _0x503e17['update'](_0x1ebdf8)[_0xf6fa('0x22')](function(_0x4ebcd3){return _0x4ebcd3;});}return null;};}function removeEntity(_0x82d72d,_0x4c7b29){return function(_0x5ca795){if(_0x5ca795){return _0x5ca795['destroy']()['then'](function(){_0x82d72d['status'](0xcc)[_0xf6fa('0x17')]();});}};}function handleEntityNotFound(_0x1eb180,_0x25e642){return function(_0x221a2a){if(!_0x221a2a){_0x1eb180[_0xf6fa('0x15')](0x194);}return _0x221a2a;};}function handleError(_0x3c6cc,_0x1e3bf8){_0x1e3bf8=_0x1e3bf8||0x1f4;return function(_0x488601){logger[_0xf6fa('0x23')](_0x488601[_0xf6fa('0x24')]);if(_0x488601[_0xf6fa('0x25')]){delete _0x488601['name'];}_0x3c6cc[_0xf6fa('0x16')](_0x1e3bf8)[_0xf6fa('0x26')](_0x488601);};}exports[_0xf6fa('0x27')]=function(_0x419633,_0xef2878){var _0x3c5678={},_0x1034b0={},_0x54ed91={'count':0x0,'rows':[]};var _0x417ac3=_[_0xf6fa('0x28')](db[_0xf6fa('0x29')]['rawAttributes'],function(_0x2dd70e){return{'name':_0x2dd70e[_0xf6fa('0x2a')],'type':_0x2dd70e[_0xf6fa('0x2b')]['key']};});_0x1034b0[_0xf6fa('0x2c')]=_[_0xf6fa('0x28')](_0x417ac3,_0xf6fa('0x25'));_0x1034b0['query']=_['keys'](_0x419633[_0xf6fa('0x2d')]);_0x1034b0[_0xf6fa('0x2e')]=_[_0xf6fa('0x2f')](_0x1034b0[_0xf6fa('0x2c')],_0x1034b0[_0xf6fa('0x2d')]);_0x3c5678[_0xf6fa('0x30')]=_[_0xf6fa('0x2f')](_0x1034b0[_0xf6fa('0x2c')],qs[_0xf6fa('0x31')](_0x419633['query'][_0xf6fa('0x31')]));_0x3c5678[_0xf6fa('0x30')]=_0x3c5678[_0xf6fa('0x30')]['length']?_0x3c5678[_0xf6fa('0x30')]:_0x1034b0[_0xf6fa('0x2c')];if(!_0x419633['query'][_0xf6fa('0x32')](_0xf6fa('0x33'))){_0x3c5678[_0xf6fa('0x1a')]=qs[_0xf6fa('0x1a')](_0x419633[_0xf6fa('0x2d')][_0xf6fa('0x1a')]);_0x3c5678[_0xf6fa('0x1c')]=qs['offset'](_0x419633[_0xf6fa('0x2d')][_0xf6fa('0x1c')]);}_0x3c5678[_0xf6fa('0x34')]=qs[_0xf6fa('0x35')](_0x419633[_0xf6fa('0x2d')][_0xf6fa('0x35')]);_0x3c5678[_0xf6fa('0x36')]=qs[_0xf6fa('0x2e')](_[_0xf6fa('0x37')](_0x419633[_0xf6fa('0x2d')],_0x1034b0[_0xf6fa('0x2e')]),_0x417ac3);if(_0x419633[_0xf6fa('0x2d')][_0xf6fa('0x38')]){_0x3c5678['where']=_['merge'](_0x3c5678[_0xf6fa('0x36')],{'$or':_['map'](_0x417ac3,function(_0x53b94d){if(_0x53b94d['type']!==_0xf6fa('0x39')){var _0x5649d8={};_0x5649d8[_0x53b94d[_0xf6fa('0x25')]]={'$like':'%'+_0x419633[_0xf6fa('0x2d')]['filter']+'%'};return _0x5649d8;}})});}_0x3c5678=_['merge']({},_0x3c5678,_0x419633['options']);var _0x1a060b={'where':_0x3c5678[_0xf6fa('0x36')]};return db[_0xf6fa('0x29')][_0xf6fa('0x1b')](_0x1a060b)[_0xf6fa('0x22')](function(_0x381c1e){_0x54ed91[_0xf6fa('0x1b')]=_0x381c1e;if(_0x419633[_0xf6fa('0x2d')][_0xf6fa('0x3a')]){_0x3c5678[_0xf6fa('0x3b')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xf6fa('0x3c')](_0x3c5678);})['then'](function(_0x5effbb){_0x54ed91[_0xf6fa('0x3d')]=_0x5effbb;return _0x54ed91;})[_0xf6fa('0x22')](respondWithFilteredResult(_0xef2878,_0x3c5678))[_0xf6fa('0x3e')](handleError(_0xef2878,null));};exports[_0xf6fa('0x3f')]=function(_0x1a27e6,_0x417098){var _0x24d709={'raw':!![],'where':{'id':_0x1a27e6[_0xf6fa('0x40')]['id']}},_0x29151c={};_0x29151c['model']=_[_0xf6fa('0x41')](db[_0xf6fa('0x29')][_0xf6fa('0x42')]);_0x29151c['query']=_[_0xf6fa('0x41')](_0x1a27e6['query']);_0x29151c[_0xf6fa('0x2e')]=_['intersection'](_0x29151c[_0xf6fa('0x2c')],_0x29151c[_0xf6fa('0x2d')]);_0x24d709[_0xf6fa('0x30')]=_[_0xf6fa('0x2f')](_0x29151c[_0xf6fa('0x2c')],qs['fields'](_0x1a27e6[_0xf6fa('0x2d')][_0xf6fa('0x31')]));_0x24d709['attributes']=_0x24d709[_0xf6fa('0x30')][_0xf6fa('0x43')]?_0x24d709['attributes']:_0x29151c[_0xf6fa('0x2c')];if(_0x1a27e6[_0xf6fa('0x2d')][_0xf6fa('0x3a')]){_0x24d709['include']=[{'all':!![]}];}_0x24d709=_['merge']({},_0x24d709,_0x1a27e6[_0xf6fa('0x44')]);return db[_0xf6fa('0x29')][_0xf6fa('0x45')](_0x24d709)[_0xf6fa('0x22')](handleEntityNotFound(_0x417098,null))[_0xf6fa('0x22')](respondWithResult(_0x417098,null))[_0xf6fa('0x3e')](handleError(_0x417098,null));};exports[_0xf6fa('0x46')]=function(_0x538030,_0x178e7f){return db[_0xf6fa('0x29')]['create'](_0x538030[_0xf6fa('0x47')],{})[_0xf6fa('0x22')](respondWithResult(_0x178e7f,0xc9))[_0xf6fa('0x3e')](handleError(_0x178e7f,null));};exports[_0xf6fa('0x48')]=function(_0xdfc714,_0x43fd82){if(_0xdfc714['body']['id']){delete _0xdfc714['body']['id'];}return db[_0xf6fa('0x29')]['find']({'where':{'id':_0xdfc714[_0xf6fa('0x40')]['id']}})[_0xf6fa('0x22')](handleEntityNotFound(_0x43fd82,null))['then'](saveUpdates(_0xdfc714[_0xf6fa('0x47')],null))['then'](respondWithResult(_0x43fd82,null))[_0xf6fa('0x3e')](handleError(_0x43fd82,null));};exports[_0xf6fa('0x49')]=function(_0x11edf5,_0x2f8c09){return db[_0xf6fa('0x29')][_0xf6fa('0x45')]({'where':{'id':_0x11edf5[_0xf6fa('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f8c09,null))['then'](removeEntity(_0x2f8c09,null))[_0xf6fa('0x3e')](handleError(_0x2f8c09,null));};exports[_0xf6fa('0x4a')]=function(_0x38208e,_0x120b50){return db[_0xf6fa('0x29')][_0xf6fa('0x4a')]()[_0xf6fa('0x22')](respondWithResult(_0x120b50,null))['catch'](handleError(_0x120b50,null));}; \ No newline at end of file +var _0xe626=['keys','rawAttributes','intersection','length','options','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','type','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','ChatQueueReport','includeAll','include','findAll','rows','show'];(function(_0x41bac1,_0x9a7f1b){var _0x43c6c5=function(_0x989ff3){while(--_0x989ff3){_0x41bac1['push'](_0x41bac1['shift']());}};_0x43c6c5(++_0x9a7f1b);}(_0xe626,0x9d));var _0x6e62=function(_0x23bd3f,_0x1f4798){_0x23bd3f=_0x23bd3f-0x0;var _0x49209b=_0xe626[_0x23bd3f];return _0x49209b;};'use strict';var emlformat=require(_0x6e62('0x0'));var rimraf=require(_0x6e62('0x1'));var zipdir=require(_0x6e62('0x2'));var jsonpatch=require(_0x6e62('0x3'));var rp=require('request-promise');var moment=require(_0x6e62('0x4'));var BPromise=require(_0x6e62('0x5'));var Mustache=require(_0x6e62('0x6'));var util=require(_0x6e62('0x7'));var path=require(_0x6e62('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e62('0x9'));var _=require(_0x6e62('0xa'));var squel=require('squel');var crypto=require(_0x6e62('0xb'));var jsforce=require(_0x6e62('0xc'));var deskjs=require(_0x6e62('0xd'));var toCsv=require(_0x6e62('0xe'));var querystring=require('querystring');var Papa=require(_0x6e62('0xf'));var Redis=require(_0x6e62('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6e62('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e62('0x12'));var logger=require('../../config/logger')(_0x6e62('0x13'));var utils=require('../../config/utils');var config=require(_0x6e62('0x14'));var licenseUtil=require(_0x6e62('0x15'));var db=require(_0x6e62('0x16'))['db'];function respondWithStatusCode(_0x43e3d4,_0x3c3af1){_0x3c3af1=_0x3c3af1||0xcc;return function(_0x1c266b){if(_0x1c266b){return _0x43e3d4[_0x6e62('0x17')](_0x3c3af1);}return _0x43e3d4['status'](_0x3c3af1)['end']();};}function respondWithResult(_0x44b131,_0x3b980d){_0x3b980d=_0x3b980d||0xc8;return function(_0x5328fe){if(_0x5328fe){return _0x44b131[_0x6e62('0x18')](_0x3b980d)[_0x6e62('0x19')](_0x5328fe);}};}function respondWithFilteredResult(_0x19a80d,_0x3f4e35){return function(_0x58d84e){if(_0x58d84e){var _0x416158=typeof _0x3f4e35[_0x6e62('0x1a')]===_0x6e62('0x1b')&&typeof _0x3f4e35[_0x6e62('0x1c')]===_0x6e62('0x1b');var _0x31b304=_0x58d84e[_0x6e62('0x1d')];var _0x45d7ee=_0x416158?0x0:_0x3f4e35[_0x6e62('0x1a')];var _0x15bce5=_0x416158?_0x58d84e['count']:_0x3f4e35[_0x6e62('0x1a')]+_0x3f4e35[_0x6e62('0x1c')];var _0x55ce3b;if(_0x15bce5>=_0x31b304){_0x15bce5=_0x31b304;_0x55ce3b=0xc8;}else{_0x55ce3b=0xce;}_0x19a80d[_0x6e62('0x18')](_0x55ce3b);return _0x19a80d['set'](_0x6e62('0x1e'),_0x45d7ee+'-'+_0x15bce5+'/'+_0x31b304)[_0x6e62('0x19')](_0x58d84e);}return null;};}function patchUpdates(_0x2e162e){return function(_0x270405){try{jsonpatch[_0x6e62('0x1f')](_0x270405,_0x2e162e,!![]);}catch(_0x77c5f9){return BPromise[_0x6e62('0x20')](_0x77c5f9);}return _0x270405[_0x6e62('0x21')]();};}function saveUpdates(_0x3f9067,_0x421d13){return function(_0x1954dc){if(_0x1954dc){return _0x1954dc['update'](_0x3f9067)[_0x6e62('0x22')](function(_0x52d5e7){return _0x52d5e7;});}return null;};}function removeEntity(_0x183469,_0x3dad96){return function(_0x345af8){if(_0x345af8){return _0x345af8[_0x6e62('0x23')]()[_0x6e62('0x22')](function(){_0x183469[_0x6e62('0x18')](0xcc)[_0x6e62('0x24')]();});}};}function handleEntityNotFound(_0x3a1683,_0x2e4fe1){return function(_0x448691){if(!_0x448691){_0x3a1683['sendStatus'](0x194);}return _0x448691;};}function handleError(_0x33f81c,_0x555793){_0x555793=_0x555793||0x1f4;return function(_0x2f9c68){logger[_0x6e62('0x25')](_0x2f9c68[_0x6e62('0x26')]);if(_0x2f9c68[_0x6e62('0x27')]){delete _0x2f9c68[_0x6e62('0x27')];}_0x33f81c[_0x6e62('0x18')](_0x555793)['send'](_0x2f9c68);};}exports[_0x6e62('0x28')]=function(_0x26c991,_0x14cd51){var _0x50ba00={},_0x58afab={},_0x191df5={'count':0x0,'rows':[]};var _0x50813d=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x17f634){return{'name':_0x17f634['fieldName'],'type':_0x17f634[_0x6e62('0x29')]['key']};});_0x58afab[_0x6e62('0x2a')]=_[_0x6e62('0x2b')](_0x50813d,_0x6e62('0x27'));_0x58afab['query']=_['keys'](_0x26c991[_0x6e62('0x2c')]);_0x58afab[_0x6e62('0x2d')]=_['intersection'](_0x58afab['model'],_0x58afab['query']);_0x50ba00[_0x6e62('0x2e')]=_['intersection'](_0x58afab[_0x6e62('0x2a')],qs[_0x6e62('0x2f')](_0x26c991[_0x6e62('0x2c')][_0x6e62('0x2f')]));_0x50ba00[_0x6e62('0x2e')]=_0x50ba00['attributes']['length']?_0x50ba00[_0x6e62('0x2e')]:_0x58afab[_0x6e62('0x2a')];if(!_0x26c991[_0x6e62('0x2c')][_0x6e62('0x30')](_0x6e62('0x31'))){_0x50ba00[_0x6e62('0x1c')]=qs[_0x6e62('0x1c')](_0x26c991[_0x6e62('0x2c')][_0x6e62('0x1c')]);_0x50ba00['offset']=qs[_0x6e62('0x1a')](_0x26c991[_0x6e62('0x2c')][_0x6e62('0x1a')]);}_0x50ba00['order']=qs[_0x6e62('0x32')](_0x26c991[_0x6e62('0x2c')]['sort']);_0x50ba00[_0x6e62('0x33')]=qs[_0x6e62('0x2d')](_[_0x6e62('0x34')](_0x26c991[_0x6e62('0x2c')],_0x58afab[_0x6e62('0x2d')]),_0x50813d);if(_0x26c991['query'][_0x6e62('0x35')]){_0x50ba00[_0x6e62('0x33')]=_[_0x6e62('0x36')](_0x50ba00[_0x6e62('0x33')],{'$or':_[_0x6e62('0x2b')](_0x50813d,function(_0x4900b0){if(_0x4900b0[_0x6e62('0x29')]!==_0x6e62('0x37')){var _0x234710={};_0x234710[_0x4900b0['name']]={'$like':'%'+_0x26c991[_0x6e62('0x2c')][_0x6e62('0x35')]+'%'};return _0x234710;}})});}_0x50ba00=_['merge']({},_0x50ba00,_0x26c991['options']);var _0x13728c={'where':_0x50ba00[_0x6e62('0x33')]};return db[_0x6e62('0x38')]['count'](_0x13728c)['then'](function(_0x1ef318){_0x191df5['count']=_0x1ef318;if(_0x26c991['query'][_0x6e62('0x39')]){_0x50ba00[_0x6e62('0x3a')]=[{'all':!![]}];}return db[_0x6e62('0x38')][_0x6e62('0x3b')](_0x50ba00);})[_0x6e62('0x22')](function(_0x58ac40){_0x191df5[_0x6e62('0x3c')]=_0x58ac40;return _0x191df5;})['then'](respondWithFilteredResult(_0x14cd51,_0x50ba00))['catch'](handleError(_0x14cd51,null));};exports[_0x6e62('0x3d')]=function(_0x469fa1,_0x940288){var _0x5352d3={'raw':!![],'where':{'id':_0x469fa1['params']['id']}},_0x1a7e7f={};_0x1a7e7f[_0x6e62('0x2a')]=_[_0x6e62('0x3e')](db[_0x6e62('0x38')][_0x6e62('0x3f')]);_0x1a7e7f[_0x6e62('0x2c')]=_[_0x6e62('0x3e')](_0x469fa1[_0x6e62('0x2c')]);_0x1a7e7f[_0x6e62('0x2d')]=_[_0x6e62('0x40')](_0x1a7e7f[_0x6e62('0x2a')],_0x1a7e7f['query']);_0x5352d3['attributes']=_['intersection'](_0x1a7e7f[_0x6e62('0x2a')],qs['fields'](_0x469fa1[_0x6e62('0x2c')][_0x6e62('0x2f')]));_0x5352d3['attributes']=_0x5352d3[_0x6e62('0x2e')][_0x6e62('0x41')]?_0x5352d3[_0x6e62('0x2e')]:_0x1a7e7f[_0x6e62('0x2a')];if(_0x469fa1[_0x6e62('0x2c')][_0x6e62('0x39')]){_0x5352d3[_0x6e62('0x3a')]=[{'all':!![]}];}_0x5352d3=_[_0x6e62('0x36')]({},_0x5352d3,_0x469fa1[_0x6e62('0x42')]);return db[_0x6e62('0x38')][_0x6e62('0x43')](_0x5352d3)[_0x6e62('0x22')](handleEntityNotFound(_0x940288,null))[_0x6e62('0x22')](respondWithResult(_0x940288,null))['catch'](handleError(_0x940288,null));};exports[_0x6e62('0x44')]=function(_0x158c75,_0x57c6d1){return db[_0x6e62('0x38')]['create'](_0x158c75[_0x6e62('0x45')],{})[_0x6e62('0x22')](respondWithResult(_0x57c6d1,0xc9))[_0x6e62('0x46')](handleError(_0x57c6d1,null));};exports['update']=function(_0x447fc2,_0x4745a3){if(_0x447fc2[_0x6e62('0x45')]['id']){delete _0x447fc2[_0x6e62('0x45')]['id'];}return db[_0x6e62('0x38')][_0x6e62('0x43')]({'where':{'id':_0x447fc2[_0x6e62('0x47')]['id']}})[_0x6e62('0x22')](handleEntityNotFound(_0x4745a3,null))[_0x6e62('0x22')](saveUpdates(_0x447fc2[_0x6e62('0x45')],null))[_0x6e62('0x22')](respondWithResult(_0x4745a3,null))['catch'](handleError(_0x4745a3,null));};exports['destroy']=function(_0x2d7732,_0xe6f92d){return db[_0x6e62('0x38')][_0x6e62('0x43')]({'where':{'id':_0x2d7732[_0x6e62('0x47')]['id']}})[_0x6e62('0x22')](handleEntityNotFound(_0xe6f92d,null))['then'](removeEntity(_0xe6f92d,null))[_0x6e62('0x46')](handleError(_0xe6f92d,null));};exports['describe']=function(_0x28bcb3,_0xead50c){return db[_0x6e62('0x38')][_0x6e62('0x48')]()[_0x6e62('0x22')](respondWithResult(_0xead50c,null))['catch'](handleError(_0xead50c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index c0dbf74..d3f8761 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d2af6,_0x39459f){var _0x1b0cc7=function(_0x117593){while(--_0x117593){_0x4d2af6['push'](_0x4d2af6['shift']());}};_0x1b0cc7(++_0x39459f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x3dc158,_0x33ff66){var _0x5ed235=function(_0x5eabf5){while(--_0x5eabf5){_0x3dc158['push'](_0x3dc158['shift']());}};_0x5ed235(++_0x33ff66);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 27dd610..94c1933 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 _0xbe54=['attributes','limit','UpdateChatQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','update','where'];(function(_0x9d4709,_0xc548f9){var _0x2e4f4a=function(_0x1195c6){while(--_0x1195c6){_0x9d4709['push'](_0x9d4709['shift']());}};_0x2e4f4a(++_0xc548f9);}(_0xbe54,0xfb));var _0x4be5=function(_0x4efb47,_0x39c113){_0x4efb47=_0x4efb47-0x0;var _0x374d89=_0xbe54[_0x4efb47];return _0x374d89;};'use strict';var _=require(_0x4be5('0x0'));var util=require(_0x4be5('0x1'));var moment=require('moment');var BPromise=require(_0x4be5('0x2'));var rs=require(_0x4be5('0x3'));var fs=require('fs');var Redis=require(_0x4be5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4be5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4be5('0x6'));var jayson=require(_0x4be5('0x7'));var client=jayson[_0x4be5('0x8')][_0x4be5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x296206,_0x3fdf7e,_0x189bd3){return new BPromise(function(_0x5ba1e9,_0x416063){return client[_0x4be5('0xa')](_0x296206,_0x189bd3)[_0x4be5('0xb')](function(_0x3578a3){logger[_0x4be5('0xc')](_0x4be5('0xd'),_0x3fdf7e,_0x4be5('0xe'));logger[_0x4be5('0xf')](_0x4be5('0x10'),_0x3fdf7e,_0x4be5('0xe'),JSON[_0x4be5('0x11')](_0x3578a3));if(_0x3578a3[_0x4be5('0x12')]){if(_0x3578a3[_0x4be5('0x12')]['code']===0x1f4){logger[_0x4be5('0x12')](_0x4be5('0xd'),_0x3fdf7e,_0x3578a3[_0x4be5('0x12')][_0x4be5('0x13')]);return _0x416063(_0x3578a3[_0x4be5('0x12')][_0x4be5('0x13')]);}logger[_0x4be5('0x12')](_0x4be5('0xd'),_0x3fdf7e,_0x3578a3[_0x4be5('0x12')]['message']);return _0x5ba1e9(_0x3578a3['error']['message']);}else{logger['info'](_0x4be5('0xd'),_0x3fdf7e,_0x4be5('0xe'));_0x5ba1e9(_0x3578a3['result'][_0x4be5('0x13')]);}})[_0x4be5('0x14')](function(_0x3d8f1b){logger[_0x4be5('0x12')](_0x4be5('0xd'),_0x3fdf7e,_0x3d8f1b);_0x416063(_0x3d8f1b);});});}exports[_0x4be5('0x15')]=function(_0x393533){var _0x5e4256=this;return new Promise(function(_0x3a7ffb,_0xb8e3cf){return db[_0x4be5('0x16')]['create'](_0x393533[_0x4be5('0x17')],{'raw':_0x393533[_0x4be5('0x18')]?_0x393533['options'][_0x4be5('0x19')]===undefined?!![]:![]:!![]})[_0x4be5('0xb')](function(_0x343411){logger['info'](_0x4be5('0x15'),_0x393533);logger[_0x4be5('0xf')]('CreateChatQueueReport',_0x393533,JSON['stringify'](_0x343411));_0x3a7ffb(_0x343411);})[_0x4be5('0x14')](function(_0x53120e){logger['error']('CreateChatQueueReport',_0x53120e[_0x4be5('0x13')],_0x393533);_0xb8e3cf(_0x5e4256[_0x4be5('0x12')](0x1f4,_0x53120e[_0x4be5('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x8f4368){var _0x16e88a=this;return new Promise(function(_0x19b462,_0x599a13){return db[_0x4be5('0x16')][_0x4be5('0x1a')](_0x8f4368[_0x4be5('0x17')],{'raw':_0x8f4368[_0x4be5('0x18')]?_0x8f4368[_0x4be5('0x18')][_0x4be5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8f4368['options']?_0x8f4368['options'][_0x4be5('0x1b')]||null:null,'attributes':_0x8f4368[_0x4be5('0x18')]?_0x8f4368['options'][_0x4be5('0x1c')]||null:null,'limit':_0x8f4368[_0x4be5('0x18')]?_0x8f4368['options'][_0x4be5('0x1d')]||null:null})[_0x4be5('0xb')](function(_0x528897){logger[_0x4be5('0xc')]('UpdateChatQueueReport',_0x8f4368);logger[_0x4be5('0xf')](_0x4be5('0x1e'),_0x8f4368,JSON['stringify'](_0x528897));_0x19b462(_0x528897);})[_0x4be5('0x14')](function(_0x4fb75f){logger[_0x4be5('0x12')](_0x4be5('0x1e'),_0x4fb75f['message'],_0x8f4368);_0x599a13(_0x16e88a[_0x4be5('0x12')](0x1f4,_0x4fb75f[_0x4be5('0x13')]));});});}; \ No newline at end of file +var _0x88fa=['info','request\x20sent','debug','error','code','ChatQueueReport,\x20%s,\x20%s','message','catch','CreateChatQueueReport','create','options','stringify','UpdateChatQueueReport','update','body','raw','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3bbc07,_0x596706){var _0x1eca5a=function(_0x3ecdd3){while(--_0x3ecdd3){_0x3bbc07['push'](_0x3bbc07['shift']());}};_0x1eca5a(++_0x596706);}(_0x88fa,0x1d3));var _0xa88f=function(_0x388550,_0x3fd74b){_0x388550=_0x388550-0x0;var _0x735860=_0x88fa[_0x388550];return _0x735860;};'use strict';var _=require(_0xa88f('0x0'));var util=require('util');var moment=require(_0xa88f('0x1'));var BPromise=require(_0xa88f('0x2'));var rs=require(_0xa88f('0x3'));var fs=require('fs');var Redis=require(_0xa88f('0x4'));var db=require(_0xa88f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa88f('0x6'));var config=require(_0xa88f('0x7'));var jayson=require(_0xa88f('0x8'));var client=jayson[_0xa88f('0x9')][_0xa88f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5194d6,_0x829bef,_0x3b16ac){return new BPromise(function(_0x5543bd,_0x48cef0){return client[_0xa88f('0xb')](_0x5194d6,_0x3b16ac)[_0xa88f('0xc')](function(_0x22f87e){logger[_0xa88f('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x829bef,_0xa88f('0xe'));logger[_0xa88f('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x829bef,_0xa88f('0xe'),JSON['stringify'](_0x22f87e));if(_0x22f87e[_0xa88f('0x10')]){if(_0x22f87e['error'][_0xa88f('0x11')]===0x1f4){logger[_0xa88f('0x10')](_0xa88f('0x12'),_0x829bef,_0x22f87e[_0xa88f('0x10')][_0xa88f('0x13')]);return _0x48cef0(_0x22f87e['error'][_0xa88f('0x13')]);}logger[_0xa88f('0x10')](_0xa88f('0x12'),_0x829bef,_0x22f87e[_0xa88f('0x10')][_0xa88f('0x13')]);return _0x5543bd(_0x22f87e[_0xa88f('0x10')]['message']);}else{logger[_0xa88f('0xd')](_0xa88f('0x12'),_0x829bef,_0xa88f('0xe'));_0x5543bd(_0x22f87e['result'][_0xa88f('0x13')]);}})[_0xa88f('0x14')](function(_0x4b801f){logger[_0xa88f('0x10')](_0xa88f('0x12'),_0x829bef,_0x4b801f);_0x48cef0(_0x4b801f);});});}exports[_0xa88f('0x15')]=function(_0x3ca1df){var _0x110a5f=this;return new Promise(function(_0x33a044,_0xc6ba1c){return db['ChatQueueReport'][_0xa88f('0x16')](_0x3ca1df['body'],{'raw':_0x3ca1df[_0xa88f('0x17')]?_0x3ca1df[_0xa88f('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8030){logger[_0xa88f('0xd')](_0xa88f('0x15'),_0x3ca1df);logger[_0xa88f('0xf')](_0xa88f('0x15'),_0x3ca1df,JSON[_0xa88f('0x18')](_0x1e8030));_0x33a044(_0x1e8030);})[_0xa88f('0x14')](function(_0x4f4b70){logger[_0xa88f('0x10')]('CreateChatQueueReport',_0x4f4b70['message'],_0x3ca1df);_0xc6ba1c(_0x110a5f[_0xa88f('0x10')](0x1f4,_0x4f4b70[_0xa88f('0x13')]));});});};exports[_0xa88f('0x19')]=function(_0x37cdf0){var _0x4e952e=this;return new Promise(function(_0x31eb78,_0x3579fd){return db['ChatQueueReport'][_0xa88f('0x1a')](_0x37cdf0[_0xa88f('0x1b')],{'raw':_0x37cdf0[_0xa88f('0x17')]?_0x37cdf0[_0xa88f('0x17')][_0xa88f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37cdf0[_0xa88f('0x17')]?_0x37cdf0[_0xa88f('0x17')]['where']||null:null,'attributes':_0x37cdf0['options']?_0x37cdf0[_0xa88f('0x17')][_0xa88f('0x1d')]||null:null,'limit':_0x37cdf0[_0xa88f('0x17')]?_0x37cdf0[_0xa88f('0x17')]['limit']||null:null})[_0xa88f('0xc')](function(_0x50cae7){logger[_0xa88f('0xd')](_0xa88f('0x19'),_0x37cdf0);logger['debug']('UpdateChatQueueReport',_0x37cdf0,JSON[_0xa88f('0x18')](_0x50cae7));_0x31eb78(_0x50cae7);})[_0xa88f('0x14')](function(_0x1819d7){logger[_0xa88f('0x10')]('UpdateChatQueueReport',_0x1819d7[_0xa88f('0x13')],_0x37cdf0);_0x3579fd(_0x4e952e['error'](0x1f4,_0x1819d7['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ffe82da..d589bbc 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 _0x0474=['exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete'];(function(_0x28a741,_0x55fd08){var _0x247cf3=function(_0x497565){while(--_0x497565){_0x28a741['push'](_0x28a741['shift']());}};_0x247cf3(++_0x55fd08);}(_0x0474,0xde));var _0x4047=function(_0xdb61d4,_0x500622){_0xdb61d4=_0xdb61d4-0x0;var _0x5defde=_0x0474[_0xdb61d4];return _0x5defde;};'use strict';var multer=require(_0x4047('0x0'));var util=require(_0x4047('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4047('0x2')]();var fs_extra=require(_0x4047('0x3'));var auth=require(_0x4047('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4047('0x5'));var controller=require(_0x4047('0x6'));router[_0x4047('0x7')]('/',auth[_0x4047('0x8')](),controller[_0x4047('0x9')]);router[_0x4047('0x7')](_0x4047('0xa'),auth[_0x4047('0x8')](),controller['describe']);router['get'](_0x4047('0xb'),auth[_0x4047('0x8')](),controller['show']);router[_0x4047('0xc')]('/',auth['isAuthenticated'](),controller[_0x4047('0xd')]);router['put'](_0x4047('0xb'),auth['isAuthenticated'](),controller[_0x4047('0xe')]);router[_0x4047('0xf')](_0x4047('0xb'),auth[_0x4047('0x8')](),controller['destroy']);module[_0x4047('0x10')]=router; \ No newline at end of file +var _0x8732=['/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8732,0x1ec));var _0x2873=function(_0x2fc284,_0x5d271c){_0x2fc284=_0x2fc284-0x0;var _0x221234=_0x8732[_0x2fc284];return _0x221234;};'use strict';var multer=require(_0x2873('0x0'));var util=require(_0x2873('0x1'));var path=require('path');var timeout=require(_0x2873('0x2'));var express=require(_0x2873('0x3'));var router=express[_0x2873('0x4')]();var fs_extra=require(_0x2873('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2873('0x6'));var config=require(_0x2873('0x7'));var controller=require(_0x2873('0x8'));router[_0x2873('0x9')]('/',auth[_0x2873('0xa')](),controller[_0x2873('0xb')]);router[_0x2873('0x9')](_0x2873('0xc'),auth['isAuthenticated'](),controller[_0x2873('0xd')]);router['get'](_0x2873('0xe'),auth[_0x2873('0xa')](),controller[_0x2873('0xf')]);router[_0x2873('0x10')]('/',auth[_0x2873('0xa')](),controller[_0x2873('0x11')]);router[_0x2873('0x12')](_0x2873('0xe'),auth[_0x2873('0xa')](),controller['update']);router[_0x2873('0x13')](_0x2873('0xe'),auth[_0x2873('0xa')](),controller[_0x2873('0x14')]);module[_0x2873('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 6aab638..1d15df5 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5f4688,_0x3e2e81){var _0x3b56bb=function(_0x2725f4){while(--_0x2725f4){_0x5f4688['push'](_0x5f4688['shift']());}};_0x3b56bb(++_0x3e2e81);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x00bb[_0xbb091];return _0x467a04;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x103b67,_0x241636){_0x103b67=_0x103b67-0x0;var _0xa56305=_0xb43b[_0x103b67];return _0xa56305;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index dfe645d..04296f0 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 _0xd79f=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','ChatTransferReport','rawAttributes','type','map','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','show','params','keys','includeAll','include','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x95975e,_0x51412c){var _0x5d4933=function(_0x1cb2da){while(--_0x1cb2da){_0x95975e['push'](_0x95975e['shift']());}};_0x5d4933(++_0x51412c);}(_0xd79f,0x165));var _0xfd79=function(_0x29baca,_0x3aaf0d){_0x29baca=_0x29baca-0x0;var _0x111640=_0xd79f[_0x29baca];return _0x111640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd79('0x0'));var zipdir=require(_0xfd79('0x1'));var jsonpatch=require(_0xfd79('0x2'));var rp=require(_0xfd79('0x3'));var moment=require(_0xfd79('0x4'));var BPromise=require(_0xfd79('0x5'));var Mustache=require(_0xfd79('0x6'));var util=require(_0xfd79('0x7'));var path=require(_0xfd79('0x8'));var sox=require(_0xfd79('0x9'));var csv=require(_0xfd79('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd79('0xb'));var _=require('lodash');var squel=require(_0xfd79('0xc'));var crypto=require(_0xfd79('0xd'));var jsforce=require(_0xfd79('0xe'));var deskjs=require(_0xfd79('0xf'));var toCsv=require(_0xfd79('0xa'));var querystring=require('querystring');var Papa=require(_0xfd79('0x10'));var Redis=require(_0xfd79('0x11'));var authService=require(_0xfd79('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfd79('0x13'));var hardwareService=require(_0xfd79('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfd79('0x15'));var db=require(_0xfd79('0x16'))['db'];function respondWithStatusCode(_0x1ea452,_0x447e30){_0x447e30=_0x447e30||0xcc;return function(_0x2fa27e){if(_0x2fa27e){return _0x1ea452[_0xfd79('0x17')](_0x447e30);}return _0x1ea452[_0xfd79('0x18')](_0x447e30)[_0xfd79('0x19')]();};}function respondWithResult(_0x544631,_0x50fde7){_0x50fde7=_0x50fde7||0xc8;return function(_0x543ebd){if(_0x543ebd){return _0x544631[_0xfd79('0x18')](_0x50fde7)[_0xfd79('0x1a')](_0x543ebd);}};}function respondWithFilteredResult(_0x30965b,_0x49e781){return function(_0x34fba1){if(_0x34fba1){var _0x1cdc65=typeof _0x49e781[_0xfd79('0x1b')]==='undefined'&&typeof _0x49e781[_0xfd79('0x1c')]===_0xfd79('0x1d');var _0xa6623f=_0x34fba1[_0xfd79('0x1e')];var _0x4b32ad=_0x1cdc65?0x0:_0x49e781[_0xfd79('0x1b')];var _0x125562=_0x1cdc65?_0x34fba1[_0xfd79('0x1e')]:_0x49e781[_0xfd79('0x1b')]+_0x49e781['limit'];var _0xbaab96;if(_0x125562>=_0xa6623f){_0x125562=_0xa6623f;_0xbaab96=0xc8;}else{_0xbaab96=0xce;}_0x30965b['status'](_0xbaab96);return _0x30965b[_0xfd79('0x1f')](_0xfd79('0x20'),_0x4b32ad+'-'+_0x125562+'/'+_0xa6623f)[_0xfd79('0x1a')](_0x34fba1);}return null;};}function patchUpdates(_0x3531a4){return function(_0x2475bd){try{jsonpatch[_0xfd79('0x21')](_0x2475bd,_0x3531a4,!![]);}catch(_0x28fe9d){return BPromise[_0xfd79('0x22')](_0x28fe9d);}return _0x2475bd[_0xfd79('0x23')]();};}function saveUpdates(_0x58afc1,_0x416b2b){return function(_0x184b3c){if(_0x184b3c){return _0x184b3c[_0xfd79('0x24')](_0x58afc1)[_0xfd79('0x25')](function(_0x2f4429){return _0x2f4429;});}return null;};}function removeEntity(_0x1641d1,_0x5042a8){return function(_0x45891d){if(_0x45891d){return _0x45891d[_0xfd79('0x26')]()[_0xfd79('0x25')](function(){_0x1641d1['status'](0xcc)[_0xfd79('0x19')]();});}};}function handleEntityNotFound(_0x4886fb,_0x3bf0fd){return function(_0x355e71){if(!_0x355e71){_0x4886fb[_0xfd79('0x17')](0x194);}return _0x355e71;};}function handleError(_0xfd5bed,_0x5643c8){_0x5643c8=_0x5643c8||0x1f4;return function(_0xacf269){logger['error'](_0xacf269[_0xfd79('0x27')]);if(_0xacf269[_0xfd79('0x28')]){delete _0xacf269['name'];}_0xfd5bed[_0xfd79('0x18')](_0x5643c8)['send'](_0xacf269);};}exports[_0xfd79('0x29')]=function(_0x590916,_0x55683c){var _0x270917={},_0x1f15b5={},_0x25d907={'count':0x0,'rows':[]};var _0x10660d=_['map'](db[_0xfd79('0x2a')][_0xfd79('0x2b')],function(_0x1de7e3){return{'name':_0x1de7e3['fieldName'],'type':_0x1de7e3[_0xfd79('0x2c')]['key']};});_0x1f15b5['model']=_[_0xfd79('0x2d')](_0x10660d,_0xfd79('0x28'));_0x1f15b5[_0xfd79('0x2e')]=_['keys'](_0x590916[_0xfd79('0x2e')]);_0x1f15b5[_0xfd79('0x2f')]=_['intersection'](_0x1f15b5[_0xfd79('0x30')],_0x1f15b5[_0xfd79('0x2e')]);_0x270917[_0xfd79('0x31')]=_[_0xfd79('0x32')](_0x1f15b5['model'],qs[_0xfd79('0x33')](_0x590916['query'][_0xfd79('0x33')]));_0x270917[_0xfd79('0x31')]=_0x270917[_0xfd79('0x31')][_0xfd79('0x34')]?_0x270917['attributes']:_0x1f15b5['model'];if(!_0x590916[_0xfd79('0x2e')]['hasOwnProperty'](_0xfd79('0x35'))){_0x270917[_0xfd79('0x1c')]=qs['limit'](_0x590916['query']['limit']);_0x270917['offset']=qs['offset'](_0x590916['query'][_0xfd79('0x1b')]);}_0x270917[_0xfd79('0x36')]=qs[_0xfd79('0x37')](_0x590916[_0xfd79('0x2e')][_0xfd79('0x37')]);_0x270917[_0xfd79('0x38')]=qs[_0xfd79('0x2f')](_[_0xfd79('0x39')](_0x590916[_0xfd79('0x2e')],_0x1f15b5[_0xfd79('0x2f')]),_0x10660d);if(_0x590916[_0xfd79('0x2e')][_0xfd79('0x3a')]){_0x270917[_0xfd79('0x38')]=_[_0xfd79('0x3b')](_0x270917[_0xfd79('0x38')],{'$or':_[_0xfd79('0x2d')](_0x10660d,function(_0x5f16f7){if(_0x5f16f7[_0xfd79('0x2c')]!==_0xfd79('0x3c')){var _0x1c74ad={};_0x1c74ad[_0x5f16f7['name']]={'$like':'%'+_0x590916[_0xfd79('0x2e')][_0xfd79('0x3a')]+'%'};return _0x1c74ad;}})});}_0x270917=_[_0xfd79('0x3b')]({},_0x270917,_0x590916['options']);var _0x23a330={'where':_0x270917[_0xfd79('0x38')]};return db[_0xfd79('0x2a')][_0xfd79('0x1e')](_0x23a330)[_0xfd79('0x25')](function(_0x2cb731){_0x25d907[_0xfd79('0x1e')]=_0x2cb731;if(_0x590916[_0xfd79('0x2e')]['includeAll']){_0x270917['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xfd79('0x3d')](_0x270917);})['then'](function(_0x2bbb1c){_0x25d907['rows']=_0x2bbb1c;return _0x25d907;})[_0xfd79('0x25')](respondWithFilteredResult(_0x55683c,_0x270917))[_0xfd79('0x3e')](handleError(_0x55683c,null));};exports[_0xfd79('0x3f')]=function(_0x298f1b,_0x2ef19a){var _0x65ede2={'raw':!![],'where':{'id':_0x298f1b[_0xfd79('0x40')]['id']}},_0x5ac1bd={};_0x5ac1bd[_0xfd79('0x30')]=_[_0xfd79('0x41')](db[_0xfd79('0x2a')][_0xfd79('0x2b')]);_0x5ac1bd[_0xfd79('0x2e')]=_[_0xfd79('0x41')](_0x298f1b[_0xfd79('0x2e')]);_0x5ac1bd[_0xfd79('0x2f')]=_[_0xfd79('0x32')](_0x5ac1bd['model'],_0x5ac1bd[_0xfd79('0x2e')]);_0x65ede2[_0xfd79('0x31')]=_[_0xfd79('0x32')](_0x5ac1bd[_0xfd79('0x30')],qs['fields'](_0x298f1b[_0xfd79('0x2e')][_0xfd79('0x33')]));_0x65ede2[_0xfd79('0x31')]=_0x65ede2[_0xfd79('0x31')][_0xfd79('0x34')]?_0x65ede2['attributes']:_0x5ac1bd[_0xfd79('0x30')];if(_0x298f1b[_0xfd79('0x2e')][_0xfd79('0x42')]){_0x65ede2[_0xfd79('0x43')]=[{'all':!![]}];}_0x65ede2=_[_0xfd79('0x3b')]({},_0x65ede2,_0x298f1b[_0xfd79('0x44')]);return db['ChatTransferReport'][_0xfd79('0x45')](_0x65ede2)[_0xfd79('0x25')](handleEntityNotFound(_0x2ef19a,null))[_0xfd79('0x25')](respondWithResult(_0x2ef19a,null))[_0xfd79('0x3e')](handleError(_0x2ef19a,null));};exports['create']=function(_0x1ffdf5,_0x2a3cca){return db['ChatTransferReport'][_0xfd79('0x46')](_0x1ffdf5[_0xfd79('0x47')],{})[_0xfd79('0x25')](respondWithResult(_0x2a3cca,0xc9))['catch'](handleError(_0x2a3cca,null));};exports[_0xfd79('0x24')]=function(_0x47a144,_0x5e891d){if(_0x47a144[_0xfd79('0x47')]['id']){delete _0x47a144[_0xfd79('0x47')]['id'];}return db[_0xfd79('0x2a')][_0xfd79('0x45')]({'where':{'id':_0x47a144[_0xfd79('0x40')]['id']}})[_0xfd79('0x25')](handleEntityNotFound(_0x5e891d,null))[_0xfd79('0x25')](saveUpdates(_0x47a144[_0xfd79('0x47')],null))[_0xfd79('0x25')](respondWithResult(_0x5e891d,null))[_0xfd79('0x3e')](handleError(_0x5e891d,null));};exports[_0xfd79('0x26')]=function(_0x6b7551,_0x2d7719){return db[_0xfd79('0x2a')][_0xfd79('0x45')]({'where':{'id':_0x6b7551[_0xfd79('0x40')]['id']}})[_0xfd79('0x25')](handleEntityNotFound(_0x2d7719,null))[_0xfd79('0x25')](removeEntity(_0x2d7719,null))['catch'](handleError(_0x2d7719,null));};exports[_0xfd79('0x48')]=function(_0x4cb32e,_0x2f9f63){return db['ChatTransferReport'][_0xfd79('0x48')]()[_0xfd79('0x25')](respondWithResult(_0x2f9f63,null))[_0xfd79('0x3e')](handleError(_0x2f9f63,null));}; \ No newline at end of file +var _0x04e4=['request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','then','destroy','error','stack','name','send','ChatTransferReport','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x117bcd,_0x4d0c3e){var _0x16162d=function(_0x174237){while(--_0x174237){_0x117bcd['push'](_0x117bcd['shift']());}};_0x16162d(++_0x4d0c3e);}(_0x04e4,0x17d));var _0x404e=function(_0x3e130f,_0x29c9f6){_0x3e130f=_0x3e130f-0x0;var _0x1d0c3d=_0x04e4[_0x3e130f];return _0x1d0c3d;};'use strict';var emlformat=require(_0x404e('0x0'));var rimraf=require(_0x404e('0x1'));var zipdir=require(_0x404e('0x2'));var jsonpatch=require(_0x404e('0x3'));var rp=require(_0x404e('0x4'));var moment=require('moment');var BPromise=require(_0x404e('0x5'));var Mustache=require(_0x404e('0x6'));var util=require(_0x404e('0x7'));var path=require('path');var sox=require(_0x404e('0x8'));var csv=require('to-csv');var ejs=require(_0x404e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x404e('0xa'));var squel=require(_0x404e('0xb'));var crypto=require('crypto');var jsforce=require(_0x404e('0xc'));var deskjs=require(_0x404e('0xd'));var toCsv=require(_0x404e('0xe'));var querystring=require(_0x404e('0xf'));var Papa=require(_0x404e('0x10'));var Redis=require(_0x404e('0x11'));var authService=require(_0x404e('0x12'));var qs=require(_0x404e('0x13'));var as=require(_0x404e('0x14'));var hardwareService=require(_0x404e('0x15'));var logger=require(_0x404e('0x16'))(_0x404e('0x17'));var utils=require(_0x404e('0x18'));var config=require(_0x404e('0x19'));var licenseUtil=require(_0x404e('0x1a'));var db=require(_0x404e('0x1b'))['db'];function respondWithStatusCode(_0x196a73,_0x1a08bf){_0x1a08bf=_0x1a08bf||0xcc;return function(_0x181e1b){if(_0x181e1b){return _0x196a73[_0x404e('0x1c')](_0x1a08bf);}return _0x196a73['status'](_0x1a08bf)[_0x404e('0x1d')]();};}function respondWithResult(_0x11a594,_0x1d3dde){_0x1d3dde=_0x1d3dde||0xc8;return function(_0x3594e6){if(_0x3594e6){return _0x11a594[_0x404e('0x1e')](_0x1d3dde)[_0x404e('0x1f')](_0x3594e6);}};}function respondWithFilteredResult(_0x1ceafe,_0x41a86c){return function(_0x13880d){if(_0x13880d){var _0x5c2ae6=typeof _0x41a86c[_0x404e('0x20')]===_0x404e('0x21')&&typeof _0x41a86c[_0x404e('0x22')]==='undefined';var _0x5a42ce=_0x13880d[_0x404e('0x23')];var _0x1fdf8e=_0x5c2ae6?0x0:_0x41a86c[_0x404e('0x20')];var _0x47d9d3=_0x5c2ae6?_0x13880d[_0x404e('0x23')]:_0x41a86c['offset']+_0x41a86c[_0x404e('0x22')];var _0x2f705e;if(_0x47d9d3>=_0x5a42ce){_0x47d9d3=_0x5a42ce;_0x2f705e=0xc8;}else{_0x2f705e=0xce;}_0x1ceafe['status'](_0x2f705e);return _0x1ceafe[_0x404e('0x24')]('Content-Range',_0x1fdf8e+'-'+_0x47d9d3+'/'+_0x5a42ce)['json'](_0x13880d);}return null;};}function patchUpdates(_0x31a2da){return function(_0x3f57ae){try{jsonpatch['apply'](_0x3f57ae,_0x31a2da,!![]);}catch(_0x501397){return BPromise['reject'](_0x501397);}return _0x3f57ae[_0x404e('0x25')]();};}function saveUpdates(_0xa0ce8f,_0x57261a){return function(_0x1dd648){if(_0x1dd648){return _0x1dd648[_0x404e('0x26')](_0xa0ce8f)[_0x404e('0x27')](function(_0x194da0){return _0x194da0;});}return null;};}function removeEntity(_0xeb5fc3,_0x2c562f){return function(_0x293aff){if(_0x293aff){return _0x293aff[_0x404e('0x28')]()[_0x404e('0x27')](function(){_0xeb5fc3[_0x404e('0x1e')](0xcc)[_0x404e('0x1d')]();});}};}function handleEntityNotFound(_0x430e75,_0x1d4376){return function(_0x1f982d){if(!_0x1f982d){_0x430e75['sendStatus'](0x194);}return _0x1f982d;};}function handleError(_0x35b89c,_0x4f0b81){_0x4f0b81=_0x4f0b81||0x1f4;return function(_0x43d534){logger[_0x404e('0x29')](_0x43d534[_0x404e('0x2a')]);if(_0x43d534[_0x404e('0x2b')]){delete _0x43d534[_0x404e('0x2b')];}_0x35b89c[_0x404e('0x1e')](_0x4f0b81)[_0x404e('0x2c')](_0x43d534);};}exports['index']=function(_0x4f155d,_0x2b443e){var _0x57fd4f={},_0x90a267={},_0x2cd896={'count':0x0,'rows':[]};var _0x436925=_['map'](db[_0x404e('0x2d')][_0x404e('0x2e')],function(_0xafa01e){return{'name':_0xafa01e['fieldName'],'type':_0xafa01e['type'][_0x404e('0x2f')]};});_0x90a267[_0x404e('0x30')]=_[_0x404e('0x31')](_0x436925,_0x404e('0x2b'));_0x90a267['query']=_[_0x404e('0x32')](_0x4f155d[_0x404e('0x33')]);_0x90a267[_0x404e('0x34')]=_[_0x404e('0x35')](_0x90a267['model'],_0x90a267[_0x404e('0x33')]);_0x57fd4f[_0x404e('0x36')]=_[_0x404e('0x35')](_0x90a267[_0x404e('0x30')],qs['fields'](_0x4f155d[_0x404e('0x33')][_0x404e('0x37')]));_0x57fd4f[_0x404e('0x36')]=_0x57fd4f['attributes']['length']?_0x57fd4f[_0x404e('0x36')]:_0x90a267[_0x404e('0x30')];if(!_0x4f155d[_0x404e('0x33')][_0x404e('0x38')](_0x404e('0x39'))){_0x57fd4f[_0x404e('0x22')]=qs[_0x404e('0x22')](_0x4f155d[_0x404e('0x33')][_0x404e('0x22')]);_0x57fd4f[_0x404e('0x20')]=qs['offset'](_0x4f155d[_0x404e('0x33')][_0x404e('0x20')]);}_0x57fd4f['order']=qs['sort'](_0x4f155d[_0x404e('0x33')][_0x404e('0x3a')]);_0x57fd4f[_0x404e('0x3b')]=qs[_0x404e('0x34')](_[_0x404e('0x3c')](_0x4f155d[_0x404e('0x33')],_0x90a267[_0x404e('0x34')]),_0x436925);if(_0x4f155d[_0x404e('0x33')][_0x404e('0x3d')]){_0x57fd4f[_0x404e('0x3b')]=_[_0x404e('0x3e')](_0x57fd4f['where'],{'$or':_[_0x404e('0x31')](_0x436925,function(_0x307a1f){if(_0x307a1f[_0x404e('0x3f')]!==_0x404e('0x40')){var _0x54ce7c={};_0x54ce7c[_0x307a1f[_0x404e('0x2b')]]={'$like':'%'+_0x4f155d[_0x404e('0x33')][_0x404e('0x3d')]+'%'};return _0x54ce7c;}})});}_0x57fd4f=_[_0x404e('0x3e')]({},_0x57fd4f,_0x4f155d[_0x404e('0x41')]);var _0x2dc03c={'where':_0x57fd4f[_0x404e('0x3b')]};return db[_0x404e('0x2d')][_0x404e('0x23')](_0x2dc03c)[_0x404e('0x27')](function(_0x55db66){_0x2cd896[_0x404e('0x23')]=_0x55db66;if(_0x4f155d[_0x404e('0x33')][_0x404e('0x42')]){_0x57fd4f[_0x404e('0x43')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x404e('0x44')](_0x57fd4f);})[_0x404e('0x27')](function(_0x3f96af){_0x2cd896['rows']=_0x3f96af;return _0x2cd896;})[_0x404e('0x27')](respondWithFilteredResult(_0x2b443e,_0x57fd4f))[_0x404e('0x45')](handleError(_0x2b443e,null));};exports[_0x404e('0x46')]=function(_0x1d1596,_0x3870bd){var _0x1a03f7={'raw':!![],'where':{'id':_0x1d1596[_0x404e('0x47')]['id']}},_0x1fd35e={};_0x1fd35e['model']=_[_0x404e('0x32')](db[_0x404e('0x2d')][_0x404e('0x2e')]);_0x1fd35e['query']=_[_0x404e('0x32')](_0x1d1596[_0x404e('0x33')]);_0x1fd35e[_0x404e('0x34')]=_['intersection'](_0x1fd35e[_0x404e('0x30')],_0x1fd35e[_0x404e('0x33')]);_0x1a03f7[_0x404e('0x36')]=_[_0x404e('0x35')](_0x1fd35e['model'],qs[_0x404e('0x37')](_0x1d1596[_0x404e('0x33')]['fields']));_0x1a03f7[_0x404e('0x36')]=_0x1a03f7[_0x404e('0x36')][_0x404e('0x48')]?_0x1a03f7['attributes']:_0x1fd35e[_0x404e('0x30')];if(_0x1d1596['query'][_0x404e('0x42')]){_0x1a03f7[_0x404e('0x43')]=[{'all':!![]}];}_0x1a03f7=_[_0x404e('0x3e')]({},_0x1a03f7,_0x1d1596[_0x404e('0x41')]);return db[_0x404e('0x2d')][_0x404e('0x49')](_0x1a03f7)[_0x404e('0x27')](handleEntityNotFound(_0x3870bd,null))[_0x404e('0x27')](respondWithResult(_0x3870bd,null))['catch'](handleError(_0x3870bd,null));};exports[_0x404e('0x4a')]=function(_0x35ca06,_0x2c34ed){return db['ChatTransferReport']['create'](_0x35ca06[_0x404e('0x4b')],{})['then'](respondWithResult(_0x2c34ed,0xc9))[_0x404e('0x45')](handleError(_0x2c34ed,null));};exports[_0x404e('0x26')]=function(_0x2d09f7,_0x4d6465){if(_0x2d09f7['body']['id']){delete _0x2d09f7[_0x404e('0x4b')]['id'];}return db[_0x404e('0x2d')][_0x404e('0x49')]({'where':{'id':_0x2d09f7['params']['id']}})[_0x404e('0x27')](handleEntityNotFound(_0x4d6465,null))[_0x404e('0x27')](saveUpdates(_0x2d09f7[_0x404e('0x4b')],null))[_0x404e('0x27')](respondWithResult(_0x4d6465,null))['catch'](handleError(_0x4d6465,null));};exports[_0x404e('0x28')]=function(_0x52c272,_0x347f80){return db[_0x404e('0x2d')][_0x404e('0x49')]({'where':{'id':_0x52c272[_0x404e('0x47')]['id']}})['then'](handleEntityNotFound(_0x347f80,null))['then'](removeEntity(_0x347f80,null))[_0x404e('0x45')](handleError(_0x347f80,null));};exports[_0x404e('0x4c')]=function(_0x5771e1,_0x1b7e7b){return db[_0x404e('0x2d')][_0x404e('0x4c')]()['then'](respondWithResult(_0x1b7e7b,null))[_0x404e('0x45')](handleError(_0x1b7e7b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b963cbb..cdf9bbe 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 _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','lodash','../../config/logger','api'];(function(_0x22c3d1,_0x53db91){var _0x416db6=function(_0x35c5de){while(--_0x35c5de){_0x22c3d1['push'](_0x22c3d1['shift']());}};_0x416db6(++_0x53db91);}(_0xd117,0xb1));var _0x7d11=function(_0x117994,_0x46bbbb){_0x117994=_0x117994-0x0;var _0x40814a=_0xd117[_0x117994];return _0x40814a;};'use strict';var _=require(_0x7d11('0x0'));var util=require('util');var logger=require(_0x7d11('0x1'))(_0x7d11('0x2'));var moment=require('moment');var BPromise=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var fs=require('fs');var path=require(_0x7d11('0x5'));var rimraf=require(_0x7d11('0x6'));var config=require(_0x7d11('0x7'));var attributes=require(_0x7d11('0x8'));module[_0x7d11('0x9')]=function(_0x34712d,_0x410bf5){return _0x34712d[_0x7d11('0xa')](_0x7d11('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x21c5=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x21c5,0x118));var _0x521c=function(_0x5133c2,_0x49fa51){_0x5133c2=_0x5133c2-0x0;var _0x55b197=_0x21c5[_0x5133c2];return _0x55b197;};'use strict';var _=require(_0x521c('0x0'));var util=require(_0x521c('0x1'));var logger=require(_0x521c('0x2'))('api');var moment=require(_0x521c('0x3'));var BPromise=require(_0x521c('0x4'));var rp=require(_0x521c('0x5'));var fs=require('fs');var path=require(_0x521c('0x6'));var rimraf=require(_0x521c('0x7'));var config=require(_0x521c('0x8'));var attributes=require(_0x521c('0x9'));module[_0x521c('0xa')]=function(_0x23342e,_0x3053dd){return _0x23342e[_0x521c('0xb')](_0x521c('0xc'),attributes,{'tableName':_0x521c('0xd'),'paranoid':![],'indexes':[{'name':_0x521c('0xe'),'fields':[_0x521c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index be31333..f4df68d 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 _0xaab9=['message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatTransferReport,\x20%s,\x20%s'];(function(_0xde7e07,_0x289e88){var _0x1320f6=function(_0x4b7919){while(--_0x4b7919){_0xde7e07['push'](_0xde7e07['shift']());}};_0x1320f6(++_0x289e88);}(_0xaab9,0x191));var _0x9aab=function(_0x40a66f,_0x1b974e){_0x40a66f=_0x40a66f-0x0;var _0x10bf2a=_0xaab9[_0x40a66f];return _0x10bf2a;};'use strict';var _=require(_0x9aab('0x0'));var util=require(_0x9aab('0x1'));var moment=require(_0x9aab('0x2'));var BPromise=require(_0x9aab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9aab('0x4'))['db'];var utils=require(_0x9aab('0x5'));var logger=require('../../config/logger')(_0x9aab('0x6'));var config=require(_0x9aab('0x7'));var jayson=require(_0x9aab('0x8'));var client=jayson[_0x9aab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257726,_0x316603,_0x3d4b8a){return new BPromise(function(_0x3fead0,_0x3d1ccb){return client[_0x9aab('0xa')](_0x257726,_0x3d4b8a)[_0x9aab('0xb')](function(_0x3f5d84){logger[_0x9aab('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x316603,_0x9aab('0xd'));logger[_0x9aab('0xe')](_0x9aab('0xf'),_0x316603,_0x9aab('0xd'),JSON[_0x9aab('0x10')](_0x3f5d84));if(_0x3f5d84[_0x9aab('0x11')]){if(_0x3f5d84[_0x9aab('0x11')]['code']===0x1f4){logger[_0x9aab('0x11')](_0x9aab('0x12'),_0x316603,_0x3f5d84[_0x9aab('0x11')][_0x9aab('0x13')]);return _0x3d1ccb(_0x3f5d84[_0x9aab('0x11')]['message']);}logger['error'](_0x9aab('0x12'),_0x316603,_0x3f5d84[_0x9aab('0x11')][_0x9aab('0x13')]);return _0x3fead0(_0x3f5d84[_0x9aab('0x11')][_0x9aab('0x13')]);}else{logger[_0x9aab('0xc')](_0x9aab('0x12'),_0x316603,'request\x20sent');_0x3fead0(_0x3f5d84['result'][_0x9aab('0x13')]);}})[_0x9aab('0x14')](function(_0x8c7e03){logger[_0x9aab('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x316603,_0x8c7e03);_0x3d1ccb(_0x8c7e03);});});} \ No newline at end of file +var _0x73bc=['debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3616bc,_0x19ddee){var _0x1eb469=function(_0x1e652f){while(--_0x1e652f){_0x3616bc['push'](_0x3616bc['shift']());}};_0x1eb469(++_0x19ddee);}(_0x73bc,0xc0));var _0xc73b=function(_0x50d682,_0xe221ed){_0x50d682=_0x50d682-0x0;var _0x56f8ff=_0x73bc[_0x50d682];return _0x56f8ff;};'use strict';var _=require(_0xc73b('0x0'));var util=require(_0xc73b('0x1'));var moment=require(_0xc73b('0x2'));var BPromise=require(_0xc73b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc73b('0x4'));var db=require(_0xc73b('0x5'))['db'];var utils=require(_0xc73b('0x6'));var logger=require(_0xc73b('0x7'))(_0xc73b('0x8'));var config=require(_0xc73b('0x9'));var jayson=require(_0xc73b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49a6af,_0xc203cb,_0x5bbc3c){return new BPromise(function(_0x2ae2c2,_0x59504c){return client[_0xc73b('0xb')](_0x49a6af,_0x5bbc3c)[_0xc73b('0xc')](function(_0x348b84){logger['info'](_0xc73b('0xd'),_0xc203cb,_0xc73b('0xe'));logger[_0xc73b('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xc203cb,_0xc73b('0xe'),JSON[_0xc73b('0x10')](_0x348b84));if(_0x348b84[_0xc73b('0x11')]){if(_0x348b84[_0xc73b('0x11')][_0xc73b('0x12')]===0x1f4){logger[_0xc73b('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0xc203cb,_0x348b84[_0xc73b('0x11')][_0xc73b('0x13')]);return _0x59504c(_0x348b84[_0xc73b('0x11')][_0xc73b('0x13')]);}logger['error'](_0xc73b('0xd'),_0xc203cb,_0x348b84[_0xc73b('0x11')]['message']);return _0x2ae2c2(_0x348b84[_0xc73b('0x11')][_0xc73b('0x13')]);}else{logger[_0xc73b('0x14')](_0xc73b('0xd'),_0xc203cb,'request\x20sent');_0x2ae2c2(_0x348b84[_0xc73b('0x15')]['message']);}})[_0xc73b('0x16')](function(_0x32dc11){logger[_0xc73b('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0xc203cb,_0x32dc11);_0x59504c(_0x32dc11);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index cf05228..d558967 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 _0x34fa=['isAuthenticated','/describe','describe','get','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34fa,0x173));var _0xa34f=function(_0x5ebddf,_0xe93d2a){_0x5ebddf=_0x5ebddf-0x0;var _0x197afe=_0x34fa[_0x5ebddf];return _0x197afe;};'use strict';var multer=require(_0xa34f('0x0'));var util=require(_0xa34f('0x1'));var path=require(_0xa34f('0x2'));var timeout=require(_0xa34f('0x3'));var express=require(_0xa34f('0x4'));var router=express['Router']();var fs_extra=require(_0xa34f('0x5'));var auth=require(_0xa34f('0x6'));var interaction=require(_0xa34f('0x7'));var config=require('../../config/environment');var controller=require(_0xa34f('0x8'));router['get']('/',auth[_0xa34f('0x9')](),controller['index']);router['get'](_0xa34f('0xa'),auth[_0xa34f('0x9')](),controller[_0xa34f('0xb')]);router[_0xa34f('0xc')](_0xa34f('0xd'),auth[_0xa34f('0x9')](),controller['show']);router[_0xa34f('0xe')]('/',auth[_0xa34f('0x9')](),controller[_0xa34f('0xf')]);router[_0xa34f('0x10')]('/:id',auth[_0xa34f('0x9')](),controller[_0xa34f('0x11')]);router['delete'](_0xa34f('0xd'),auth[_0xa34f('0x9')](),controller[_0xa34f('0x12')]);module[_0xa34f('0x13')]=router; \ No newline at end of file +var _0xa106=['post','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','/:id','isAuthenticated','show'];(function(_0x1c5bb5,_0x729571){var _0x527a9c=function(_0x27981a){while(--_0x27981a){_0x1c5bb5['push'](_0x1c5bb5['shift']());}};_0x527a9c(++_0x729571);}(_0xa106,0x112));var _0x6a10=function(_0xd07e81,_0x1ccacd){_0xd07e81=_0xd07e81-0x0;var _0x379364=_0xa106[_0xd07e81];return _0x379364;};'use strict';var multer=require(_0x6a10('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a10('0x1'));var express=require(_0x6a10('0x2'));var router=express[_0x6a10('0x3')]();var fs_extra=require(_0x6a10('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a10('0x5'));var config=require(_0x6a10('0x6'));var controller=require(_0x6a10('0x7'));router[_0x6a10('0x8')]('/',auth['isAuthenticated'](),controller[_0x6a10('0x9')]);router['get'](_0x6a10('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x6a10('0x8')](_0x6a10('0xb'),auth[_0x6a10('0xc')](),controller[_0x6a10('0xd')]);router[_0x6a10('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6a10('0xb'),auth[_0x6a10('0xc')](),controller[_0x6a10('0xf')]);router[_0x6a10('0x10')](_0x6a10('0xb'),auth[_0x6a10('0xc')](),controller[_0x6a10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index baa63f2..b42db27 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 _0x788c=['Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','stringify','text','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','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','address','email','#011F6A','INTEGER','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Form\x20properly\x20submitted'];(function(_0x107cbd,_0x4bbaec){var _0x30abc3=function(_0x584b92){while(--_0x584b92){_0x107cbd['push'](_0x107cbd['shift']());}};_0x30abc3(++_0x4bbaec);}(_0x788c,0x145));var _0xc788=function(_0x21b20a,_0x33d3a2){_0x21b20a=_0x21b20a-0x0;var _0xeab2f2=_0x788c[_0x21b20a];return _0xeab2f2;};'use strict';var Sequelize=require(_0xc788('0x0'));var rs=require(_0xc788('0x1'));module[_0xc788('0x2')]={'name':{'type':Sequelize[_0xc788('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xc788('0x3')],'allowNull':![],'unique':_0xc788('0x4')},'description':{'type':Sequelize[_0xc788('0x3')]},'mapKey':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x5')},'mapKeyOffline':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xc788('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xc788('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc788('0x3')],'allowNull':![],'defaultValue':_0xc788('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xc788('0x3')],'allowNull':![],'defaultValue':_0xc788('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xc788('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc788('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc788('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc788('0x8')]('rounded','squared'),'defaultValue':_0xc788('0x9')},'header_online':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xc788('0xb')},'offline_chat_button':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xc788('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc788('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xc788('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xc788('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x12')},'noteTitle':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x13')},'placeholderMessage':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x14')},'closingMessage':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x15')},'closingMessageButton':{'type':Sequelize[_0xc788('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xc788('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0xc788('0x17'),'thumb'),'defaultValue':_0xc788('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc788('0x10')],'defaultValue':function(){return JSON[_0xc788('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':_0xc788('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xc788('0x1a'),'props':{'title':_0xc788('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xc788('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xc788('0x1b')](_0xc788('0x1c'))?JSON[_0xc788('0x1d')](this[_0xc788('0x1b')](_0xc788('0x1c'))):{};},'set':function(_0x17dd0b){return this[_0xc788('0x1e')]('onlineForm',JSON['stringify'](_0x17dd0b));}},'offlineForm':{'type':Sequelize[_0xc788('0x10')],'defaultValue':function(){return JSON[_0xc788('0x18')]({'items':[{'type':_0xc788('0x1a'),'props':{'title':_0xc788('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xc788('0x5'),'type':_0xc788('0x5')},'variable':null},{'type':_0xc788('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xc788('0x20'),'helpText':_0xc788('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xc788('0x1b')](_0xc788('0x22'))?JSON[_0xc788('0x1d')](this[_0xc788('0x1b')](_0xc788('0x22'))):{};},'set':function(_0x20e4fe){return this[_0xc788('0x1e')](_0xc788('0x22'),JSON[_0xc788('0x18')](_0x20e4fe));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc788('0x23')]();}},'autoclose':{'type':Sequelize[_0xc788('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc788('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc788('0x3')]},'waitingTitle':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x24')},'waitingMessage':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x26')},'offlineMessageBody':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xc788('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x28')},'skipUnmanaged':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x29')},'sendUnmanaged':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc788('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xc788('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc788('0x3')],'defaultValue':_0xc788('0x2b')},'verticalAlignment':{'type':Sequelize[_0xc788('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xc788('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xc788('0x3')]},'customerAvatar':{'type':Sequelize[_0xc788('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc788('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc788('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc788('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xc788('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc788('0x7')],'comment':_0xc788('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x285639){if(!_0x285639)this[_0xc788('0x1e')](_0xc788('0x2d'),null);this[_0xc788('0x1e')](_0xc788('0x2e'),_0x285639);}},'vidaooEscalation':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc788('0x3')]},'vidaooTopic':{'type':Sequelize[_0xc788('0x3')],'allowNull':![],'defaultValue':_0xc788('0x2f')},'vidaooNote':{'type':Sequelize[_0xc788('0x3')],'defaultValue':function(){return _0xc788('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xc788('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xc788('0xf')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc788('0x10')]}}; \ No newline at end of file +var _0xfb9a=['Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','STRING','email','Agent','#011F6A','#ffffff','rounded','Chat','Send','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','input','text','name','getDataValue','onlineForm','parse','TEXT','stringify'];(function(_0x46fc6c,_0x297637){var _0x18694f=function(_0x34e1e0){while(--_0x34e1e0){_0x46fc6c['push'](_0x46fc6c['shift']());}};_0x18694f(++_0x297637);}(_0xfb9a,0x199));var _0xafb9=function(_0x579e57,_0x1feb17){_0x579e57=_0x579e57-0x0;var _0x2d8e54=_0xfb9a[_0x579e57];return _0x2d8e54;};'use strict';var Sequelize=require(_0xafb9('0x0'));var rs=require(_0xafb9('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xafb9('0x2')]},'mapKey':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x3')},'mapKeyOffline':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xafb9('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xafb9('0x4')},'customerAlias':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xafb9('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xafb9('0x2')],'allowNull':![],'defaultValue':_0xafb9('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xafb9('0x2')],'allowNull':![],'defaultValue':_0xafb9('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xafb9('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xafb9('0x7'),'squared'),'defaultValue':_0xafb9('0x7')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x8')},'offline_chat_button':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x9')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xafb9('0xa')},'download_transcript':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xafb9('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x10')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xafb9('0x11')},'closingMessage':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x12')},'closingMessageButton':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x13')},'conditionAgreement':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xafb9('0x14')},'ratingType':{'type':Sequelize[_0xafb9('0x15')](_0xafb9('0x16'),_0xafb9('0x17')),'defaultValue':_0xafb9('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xafb9('0xc')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xafb9('0x18'),'variable':null,'config':{'placeholder':'name','type':_0xafb9('0x19'),'required':!![]},'props':{'title':_0xafb9('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0xafb9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xafb9('0x3'),'type':_0xafb9('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xafb9('0x1b')](_0xafb9('0x1c'))?JSON[_0xafb9('0x1d')](this[_0xafb9('0x1b')](_0xafb9('0x1c'))):{};},'set':function(_0xd29c41){return this['setDataValue']('onlineForm',JSON['stringify'](_0xd29c41));}},'offlineForm':{'type':Sequelize[_0xafb9('0x1e')],'defaultValue':function(){return JSON[_0xafb9('0x1f')]({'items':[{'type':'input','props':{'title':_0xafb9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xafb9('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0xafb9('0x20')},'props':{'title':_0xafb9('0x20'),'helpText':_0xafb9('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xafb9('0x1b')]('offlineForm')?JSON[_0xafb9('0x1d')](this[_0xafb9('0x1b')]('offlineForm')):{};},'set':function(_0x149b9c){return this['setDataValue'](_0xafb9('0x22'),JSON[_0xafb9('0x1f')](_0x149b9c));}},'token':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':function(){return rs[_0xafb9('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xafb9('0x2')]},'forwardOffline':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xafb9('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xafb9('0x24')},'waitingMessage':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xafb9('0x13')},'sendUnmanaged':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x9')},'enableCustomerAttachment':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xafb9('0x2')]},'notificationTemplate':{'type':Sequelize[_0xafb9('0x1e')],'defaultValue':function(){return _0xafb9('0x28');}},'notificationSound':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xafb9('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x2a')},'defaultTitle':{'type':Sequelize[_0xafb9('0x2')]},'customerAvatar':{'type':Sequelize[_0xafb9('0x1e')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xafb9('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xafb9('0x2')],'allowNull':![],'defaultValue':_0xafb9('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xafb9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':_0xafb9('0x2c')},'systemAvatar':{'type':Sequelize[_0xafb9('0x1e')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xafb9('0xc')],'comment':_0xafb9('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![],'comment':_0xafb9('0x2e'),'set':function(_0xc31e95){if(!_0xc31e95)this[_0xafb9('0x2f')]('mandatoryDispositionPauseId',null);this[_0xafb9('0x2f')]('mandatoryDisposition',_0xc31e95);}},'vidaooEscalation':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xafb9('0x2')],'allowNull':![],'defaultValue':_0xafb9('0x30')},'vidaooNote':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xafb9('0x1e')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xafb9('0xb')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xafb9('0x1e')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index df7ab5e..f785397 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 _0x6aca=['server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','toPairs','mimetype','server','offline-chat','openNewInteraction','sequelize','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','chatLicenseExceeded','some','remote','stringify','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','color_button','backgroundColor','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','request-promise','bluebird','util','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./chatWebsite.socket','jayson/promise','http','client','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','info','catch','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','ChatWebsiteId','Disposition','findOne','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','ids','addLogo','file','agentAvatar','filename','addCustomerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','sitepic','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil'];(function(_0x3896b7,_0x312470){var _0x5ab2a5=function(_0x16b838){while(--_0x16b838){_0x3896b7['push'](_0x3896b7['shift']());}};_0x5ab2a5(++_0x312470);}(_0x6aca,0xac));var _0xa6ac=function(_0x419aa4,_0x5926a7){_0x419aa4=_0x419aa4-0x0;var _0x557d9b=_0x6aca[_0x419aa4];return _0x557d9b;};'use strict';var emlformat=require(_0xa6ac('0x0'));var rimraf=require(_0xa6ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa6ac('0x2'));var moment=require('moment');var BPromise=require(_0xa6ac('0x3'));var Mustache=require('mustache');var util=require(_0xa6ac('0x4'));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(_0xa6ac('0x5'));var _=require(_0xa6ac('0x6'));var squel=require(_0xa6ac('0x7'));var crypto=require('crypto');var jsforce=require(_0xa6ac('0x8'));var deskjs=require(_0xa6ac('0x9'));var toCsv=require('to-csv');var querystring=require(_0xa6ac('0xa'));var Papa=require(_0xa6ac('0xb'));var Redis=require(_0xa6ac('0xc'));var authService=require(_0xa6ac('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa6ac('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa6ac('0xf'));var utils=require(_0xa6ac('0x10'));var config=require(_0xa6ac('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa6ac('0x12')](config['redis'],{'host':_0xa6ac('0x13'),'port':0x18eb});var socket=require(_0xa6ac('0x14'))(new Redis(config[_0xa6ac('0x15')]));require(_0xa6ac('0x16'))['register'](socket);var jayson=require(_0xa6ac('0x17'));var client=jayson['client'][_0xa6ac('0x18')]({'port':0x232c});var client9002=jayson[_0xa6ac('0x19')]['http']({'port':0x232a});var client9003=jayson['client'][_0xa6ac('0x18')]({'port':0x232b});var client9001=jayson[_0xa6ac('0x19')]['http']({'port':0x2329});function respondWithRpcPromise(_0x40683c,_0xe050c,_0xf93f4f,_0xe81366){return new BPromise(function(_0x24dfa6,_0x4379f3){var _0x322b91=_0xe81366||client;return _0x322b91['request'](_0x40683c,_0xf93f4f)[_0xa6ac('0x1a')](function(_0x6991ff){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xe050c,_0xa6ac('0x1b'));logger[_0xa6ac('0x1c')](_0xa6ac('0x1d'),_0xe050c,_0xa6ac('0x1b'),JSON['stringify'](_0x6991ff));if(_0x6991ff['error']){if(_0x6991ff[_0xa6ac('0x1e')][_0xa6ac('0x1f')]===0x1f4){logger[_0xa6ac('0x1e')](_0xa6ac('0x20'),_0xe050c,_0x6991ff[_0xa6ac('0x1e')][_0xa6ac('0x21')]);return _0x4379f3(_0x6991ff[_0xa6ac('0x1e')][_0xa6ac('0x21')]);}logger[_0xa6ac('0x1e')](_0xa6ac('0x20'),_0xe050c,_0x6991ff[_0xa6ac('0x1e')][_0xa6ac('0x21')]);return _0x24dfa6(_0x6991ff[_0xa6ac('0x1e')]['message']);}else{logger[_0xa6ac('0x22')](_0xa6ac('0x20'),_0xe050c,_0xa6ac('0x1b'));_0x24dfa6(_0x6991ff['result'][_0xa6ac('0x21')]);}})[_0xa6ac('0x23')](function(_0x5ddbb4){logger[_0xa6ac('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0xe050c,_0x5ddbb4);_0x4379f3(_0x5ddbb4);});});}function respondWithStatusCode(_0x49aba1,_0x3ee6ac){_0x3ee6ac=_0x3ee6ac||0xcc;return function(_0x389c28){if(_0x389c28){return _0x49aba1['sendStatus'](_0x3ee6ac);}return _0x49aba1[_0xa6ac('0x24')](_0x3ee6ac)[_0xa6ac('0x25')]();};}function respondWithResult(_0x445088,_0x14412c){_0x14412c=_0x14412c||0xc8;return function(_0x11a8d8){if(_0x11a8d8){return _0x445088[_0xa6ac('0x24')](_0x14412c)['json'](_0x11a8d8);}};}function respondWithFilteredResult(_0x7a4e7d,_0x6ed30e){return function(_0x773915){if(_0x773915){var _0x5a0f7c=typeof _0x6ed30e['offset']===_0xa6ac('0x26')&&typeof _0x6ed30e[_0xa6ac('0x27')]===_0xa6ac('0x26');var _0x4cca86=_0x773915[_0xa6ac('0x28')];var _0x58b70b=_0x5a0f7c?0x0:_0x6ed30e[_0xa6ac('0x29')];var _0x4a2e52=_0x5a0f7c?_0x773915['count']:_0x6ed30e['offset']+_0x6ed30e['limit'];var _0xf40a83;if(_0x4a2e52>=_0x4cca86){_0x4a2e52=_0x4cca86;_0xf40a83=0xc8;}else{_0xf40a83=0xce;}_0x7a4e7d['status'](_0xf40a83);return _0x7a4e7d[_0xa6ac('0x2a')](_0xa6ac('0x2b'),_0x58b70b+'-'+_0x4a2e52+'/'+_0x4cca86)['json'](_0x773915);}return null;};}function patchUpdates(_0x8e78b0){return function(_0x1c5b23){try{jsonpatch[_0xa6ac('0x2c')](_0x1c5b23,_0x8e78b0,!![]);}catch(_0x5693bd){return BPromise[_0xa6ac('0x2d')](_0x5693bd);}return _0x1c5b23[_0xa6ac('0x2e')]();};}function saveUpdates(_0x3627a3,_0x43128b){return function(_0x169c5b){if(_0x169c5b){return _0x169c5b[_0xa6ac('0x2f')](_0x3627a3)[_0xa6ac('0x1a')](function(_0x4fa872){return _0x4fa872;});}return null;};}function removeEntity(_0x1b0ab0,_0x548097){return function(_0x1e5853){if(_0x1e5853){return _0x1e5853[_0xa6ac('0x30')]()[_0xa6ac('0x1a')](function(){var _0xe94b65=_0x1e5853[_0xa6ac('0x31')]({'plain':!![]});var _0x3d39d1=_0xa6ac('0x32');return db[_0xa6ac('0x33')][_0xa6ac('0x30')]({'where':{'type':_0x3d39d1,'resourceId':_0xe94b65['id']}})[_0xa6ac('0x1a')](function(){return _0x1e5853;});})['then'](function(){_0x1b0ab0[_0xa6ac('0x24')](0xcc)[_0xa6ac('0x25')]();});}};}function handleEntityNotFound(_0x433efe,_0xbd8016){return function(_0x3f6a88){if(!_0x3f6a88){_0x433efe[_0xa6ac('0x34')](0x194);}return _0x3f6a88;};}function handleError(_0x5e4b57,_0x1c5694){_0x1c5694=_0x1c5694||0x1f4;return function(_0x4e1e84){logger[_0xa6ac('0x1e')](_0x4e1e84[_0xa6ac('0x35')]);if(_0x4e1e84['name']){delete _0x4e1e84[_0xa6ac('0x36')];}_0x5e4b57[_0xa6ac('0x24')](_0x1c5694)[_0xa6ac('0x37')](_0x4e1e84);};}exports['index']=function(_0xca09fe,_0x16bf52){var _0x33c99b={'include':[{'model':db[_0xa6ac('0x38')],'as':_0xa6ac('0x39')}]},_0x961354={},_0x4e939f={'count':0x0,'rows':[]};var _0x3270a6=_['map'](db[_0xa6ac('0x3a')][_0xa6ac('0x3b')],function(_0x456394){return{'name':_0x456394[_0xa6ac('0x3c')],'type':_0x456394[_0xa6ac('0x3d')][_0xa6ac('0x3e')]};});_0x961354[_0xa6ac('0x3f')]=_[_0xa6ac('0x40')](_0x3270a6,_0xa6ac('0x36'));_0x961354[_0xa6ac('0x41')]=_[_0xa6ac('0x42')](_0xca09fe['query']);_0x961354[_0xa6ac('0x43')]=_[_0xa6ac('0x44')](_0x961354[_0xa6ac('0x3f')],_0x961354[_0xa6ac('0x41')]);_0x33c99b[_0xa6ac('0x45')]=_[_0xa6ac('0x44')](_0x961354[_0xa6ac('0x3f')],qs[_0xa6ac('0x46')](_0xca09fe['query'][_0xa6ac('0x46')]));_0x33c99b[_0xa6ac('0x45')]=_0x33c99b[_0xa6ac('0x45')][_0xa6ac('0x47')]?_0x33c99b[_0xa6ac('0x45')]:_0x961354[_0xa6ac('0x3f')];if(!_0xca09fe[_0xa6ac('0x41')]['hasOwnProperty'](_0xa6ac('0x48'))){_0x33c99b[_0xa6ac('0x27')]=qs['limit'](_0xca09fe['query'][_0xa6ac('0x27')]);_0x33c99b[_0xa6ac('0x29')]=qs[_0xa6ac('0x29')](_0xca09fe[_0xa6ac('0x41')][_0xa6ac('0x29')]);}_0x33c99b[_0xa6ac('0x49')]=qs[_0xa6ac('0x4a')](_0xca09fe[_0xa6ac('0x41')][_0xa6ac('0x4a')]);_0x33c99b[_0xa6ac('0x4b')]=qs[_0xa6ac('0x43')](_['pick'](_0xca09fe[_0xa6ac('0x41')],_0x961354[_0xa6ac('0x43')]),_0x3270a6);if(_0xca09fe[_0xa6ac('0x41')]['filter']){_0x33c99b['where']=_[_0xa6ac('0x4c')](_0x33c99b['where'],{'$or':_[_0xa6ac('0x40')](_0x3270a6,function(_0x5b6418){if(_0x5b6418[_0xa6ac('0x3d')]!==_0xa6ac('0x4d')){var _0x413530={};_0x413530[_0x5b6418[_0xa6ac('0x36')]]={'$like':'%'+_0xca09fe[_0xa6ac('0x41')][_0xa6ac('0x4e')]+'%'};return _0x413530;}})});}_0x33c99b=_[_0xa6ac('0x4c')]({},_0x33c99b,_0xca09fe['options']);var _0x168f85={'where':_0x33c99b[_0xa6ac('0x4b')]};return db[_0xa6ac('0x3a')][_0xa6ac('0x28')](_0x168f85)[_0xa6ac('0x1a')](function(_0x260325){_0x4e939f[_0xa6ac('0x28')]=_0x260325;if(_0xca09fe[_0xa6ac('0x41')][_0xa6ac('0x4f')]){_0x33c99b[_0xa6ac('0x50')]=[{'all':!![]}];}return db['ChatWebsite'][_0xa6ac('0x51')](_0x33c99b);})['then'](function(_0x4f3e88){_0x4e939f[_0xa6ac('0x52')]=_0x4f3e88;return _0x4e939f;})['then'](respondWithFilteredResult(_0x16bf52,_0x33c99b))[_0xa6ac('0x23')](handleError(_0x16bf52,null));};exports['show']=function(_0x5525c2,_0x47a683){var _0x1afe6e={'raw':![],'where':{'id':_0x5525c2['params']['id']},'include':[{'model':db['Pause'],'as':_0xa6ac('0x39')}]},_0x2f1885={};_0x2f1885[_0xa6ac('0x3f')]=_['keys'](db[_0xa6ac('0x3a')]['rawAttributes']);_0x2f1885['query']=_[_0xa6ac('0x42')](_0x5525c2[_0xa6ac('0x41')]);_0x2f1885[_0xa6ac('0x43')]=_[_0xa6ac('0x44')](_0x2f1885['model'],_0x2f1885[_0xa6ac('0x41')]);_0x1afe6e[_0xa6ac('0x45')]=_[_0xa6ac('0x44')](_0x2f1885[_0xa6ac('0x3f')],qs['fields'](_0x5525c2[_0xa6ac('0x41')]['fields']));_0x1afe6e['attributes']=_0x1afe6e[_0xa6ac('0x45')]['length']?_0x1afe6e[_0xa6ac('0x45')]:_0x2f1885[_0xa6ac('0x3f')];if(_0x5525c2[_0xa6ac('0x41')][_0xa6ac('0x4f')]){_0x1afe6e[_0xa6ac('0x50')]=[{'all':!![]}];}_0x1afe6e=_[_0xa6ac('0x4c')]({},_0x1afe6e,_0x5525c2[_0xa6ac('0x53')]);return db['ChatWebsite'][_0xa6ac('0x54')](_0x1afe6e)['then'](handleEntityNotFound(_0x47a683,null))[_0xa6ac('0x1a')](respondWithResult(_0x47a683,null))[_0xa6ac('0x23')](handleError(_0x47a683,null));};exports[_0xa6ac('0x55')]=function(_0x16ff1c,_0x2f7485){return db['ChatWebsite'][_0xa6ac('0x55')](_0x16ff1c[_0xa6ac('0x56')],{})['then'](function(_0x16e349){var _0x4ad3de=_0x16ff1c[_0xa6ac('0x57')]['get']({'plain':!![]});if(!_0x4ad3de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ad3de[_0xa6ac('0x58')]==='user'){var _0x15f769=_0x16e349[_0xa6ac('0x31')]({'plain':!![]});var _0xbdae95='ChatWebsites';return db[_0xa6ac('0x59')][_0xa6ac('0x54')]({'where':{'name':_0xbdae95,'userProfileId':_0x4ad3de[_0xa6ac('0x5a')]},'raw':!![]})[_0xa6ac('0x1a')](function(_0xf053bf){if(_0xf053bf&&_0xf053bf[_0xa6ac('0x5b')]===0x0){return db[_0xa6ac('0x33')][_0xa6ac('0x55')]({'name':_0x15f769[_0xa6ac('0x36')],'resourceId':_0x15f769['id'],'type':_0xf053bf[_0xa6ac('0x36')],'sectionId':_0xf053bf['id']},{})[_0xa6ac('0x1a')](function(){return _0x16e349;});}else{return _0x16e349;}})[_0xa6ac('0x23')](function(_0x4ce446){logger[_0xa6ac('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ce446);throw _0x4ce446;});}return _0x16e349;})[_0xa6ac('0x1a')](respondWithResult(_0x2f7485,0xc9))[_0xa6ac('0x23')](handleError(_0x2f7485,null));};exports[_0xa6ac('0x2f')]=function(_0x452461,_0x32b77f){if(_0x452461[_0xa6ac('0x56')]['id']){delete _0x452461[_0xa6ac('0x56')]['id'];}return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0x452461[_0xa6ac('0x5c')]['id']},'include':[{'model':db[_0xa6ac('0x38')],'as':_0xa6ac('0x39')}]})[_0xa6ac('0x1a')](handleEntityNotFound(_0x32b77f,null))[_0xa6ac('0x1a')](saveUpdates(_0x452461[_0xa6ac('0x56')],null))[_0xa6ac('0x1a')](respondWithResult(_0x32b77f,null))[_0xa6ac('0x23')](handleError(_0x32b77f,null));};exports[_0xa6ac('0x30')]=function(_0x2edede,_0x83fe9c){return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0x2edede[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x83fe9c,null))[_0xa6ac('0x1a')](removeEntity(_0x83fe9c,null))[_0xa6ac('0x23')](handleError(_0x83fe9c,null));};exports[_0xa6ac('0x5d')]=function(_0x41f54e,_0x38a992){return db[_0xa6ac('0x3a')]['describe']()[_0xa6ac('0x1a')](respondWithResult(_0x38a992,null))[_0xa6ac('0x23')](handleError(_0x38a992,null));};exports[_0xa6ac('0x5e')]=function(_0x21d18f,_0x243364,_0x589c63){if(_0x21d18f[_0xa6ac('0x56')]['id']){delete _0x21d18f[_0xa6ac('0x56')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x21d18f[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x243364,null))[_0xa6ac('0x1a')](function(_0x3db5bd){if(_0x3db5bd){_0x21d18f[_0xa6ac('0x56')][_0xa6ac('0x5f')]=_0x3db5bd['id'];return db[_0xa6ac('0x60')][_0xa6ac('0x55')](_0x21d18f[_0xa6ac('0x56')]);}})[_0xa6ac('0x1a')](respondWithResult(_0x243364,null))[_0xa6ac('0x23')](handleError(_0x243364,null));};exports['getDispositions']=function(_0x2d48f4,_0x527123,_0x575510){var _0x236ea0={'raw':![],'where':{}};var _0x3cd014={};var _0x3e8d55={'count':0x0,'rows':[]};return db[_0xa6ac('0x3a')][_0xa6ac('0x61')]({'where':{'id':_0x2d48f4[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x527123,null))['then'](function(_0x456e33){if(_0x456e33){_0x3cd014[_0xa6ac('0x3f')]=_[_0xa6ac('0x42')](db[_0xa6ac('0x60')]['rawAttributes']);_0x3cd014['query']=_[_0xa6ac('0x42')](_0x2d48f4[_0xa6ac('0x41')]);_0x3cd014['filters']=_[_0xa6ac('0x44')](_0x3cd014['model'],_0x3cd014['query']);_0x236ea0[_0xa6ac('0x45')]=_[_0xa6ac('0x44')](_0x3cd014[_0xa6ac('0x3f')],qs['fields'](_0x2d48f4[_0xa6ac('0x41')]['fields']));_0x236ea0[_0xa6ac('0x45')]=_0x236ea0[_0xa6ac('0x45')][_0xa6ac('0x47')]?_0x236ea0[_0xa6ac('0x45')]:_0x3cd014[_0xa6ac('0x3f')];if(!_0x2d48f4[_0xa6ac('0x41')]['hasOwnProperty'](_0xa6ac('0x48'))){_0x236ea0[_0xa6ac('0x27')]=qs['limit'](_0x2d48f4[_0xa6ac('0x41')][_0xa6ac('0x27')]);_0x236ea0[_0xa6ac('0x29')]=qs[_0xa6ac('0x29')](_0x2d48f4[_0xa6ac('0x41')][_0xa6ac('0x29')]);}_0x236ea0[_0xa6ac('0x49')]=qs[_0xa6ac('0x4a')](_0x2d48f4['query']['sort']);_0x236ea0['where']=qs[_0xa6ac('0x43')](_[_0xa6ac('0x62')](_0x2d48f4[_0xa6ac('0x41')],_0x3cd014['filters']));_0x236ea0[_0xa6ac('0x4b')][_0xa6ac('0x5f')]=_0x456e33['id'];if(_0x2d48f4[_0xa6ac('0x41')][_0xa6ac('0x4e')]){_0x236ea0[_0xa6ac('0x4b')]=_[_0xa6ac('0x4c')](_0x236ea0[_0xa6ac('0x4b')],{'$or':_[_0xa6ac('0x40')](_0x236ea0[_0xa6ac('0x45')],function(_0x3cce28){var _0x31b449={};_0x31b449[_0x3cce28]={'$like':'%'+_0x2d48f4[_0xa6ac('0x41')][_0xa6ac('0x4e')]+'%'};return _0x31b449;})});}_0x236ea0=_[_0xa6ac('0x4c')]({},_0x236ea0,_0x2d48f4['options']);return db[_0xa6ac('0x60')][_0xa6ac('0x28')]({'where':_0x236ea0[_0xa6ac('0x4b')]})['then'](function(_0x51029f){_0x3e8d55[_0xa6ac('0x28')]=_0x51029f;if(_0x2d48f4[_0xa6ac('0x41')][_0xa6ac('0x4f')]){_0x236ea0[_0xa6ac('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x236ea0);})[_0xa6ac('0x1a')](function(_0x697bd2){_0x3e8d55['rows']=_0x697bd2;return _0x3e8d55;});}})[_0xa6ac('0x1a')](respondWithFilteredResult(_0x527123,_0x236ea0))['catch'](handleError(_0x527123,null));};exports[_0xa6ac('0x63')]=function(_0x5c2706,_0x11e3f6,_0x237429){return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0x5c2706[_0xa6ac('0x5c')]['id']}})['then'](handleEntityNotFound(_0x11e3f6,null))['then'](function(_0xc8fb06){if(_0xc8fb06){return _0xc8fb06[_0xa6ac('0x63')](_0x5c2706[_0xa6ac('0x41')]['ids']);}})[_0xa6ac('0x1a')](respondWithStatusCode(_0x11e3f6,null))[_0xa6ac('0x23')](handleError(_0x11e3f6,null));};exports[_0xa6ac('0x64')]=function(_0x174403,_0x34d276,_0x5c70a5){if(_0x174403[_0xa6ac('0x56')]['id']){delete _0x174403[_0xa6ac('0x56')]['id'];}return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0x174403[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x34d276,null))[_0xa6ac('0x1a')](function(_0x45ec88){if(_0x45ec88){_0x174403[_0xa6ac('0x56')][_0xa6ac('0x5f')]=_0x45ec88['id'];return db[_0xa6ac('0x65')]['create'](_0x174403[_0xa6ac('0x56')]);}})[_0xa6ac('0x1a')](respondWithResult(_0x34d276,null))[_0xa6ac('0x23')](handleError(_0x34d276,null));};exports[_0xa6ac('0x66')]=function(_0x27034d,_0x2da70c,_0x11f58a){var _0x49e1f4={'raw':![],'where':{}};var _0x589290={};var _0x499aff={'count':0x0,'rows':[]};return db[_0xa6ac('0x3a')][_0xa6ac('0x61')]({'where':{'id':_0x27034d[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x2da70c,null))[_0xa6ac('0x1a')](function(_0xc43aa){if(_0xc43aa){_0x589290[_0xa6ac('0x3f')]=_[_0xa6ac('0x42')](db[_0xa6ac('0x65')][_0xa6ac('0x3b')]);_0x589290[_0xa6ac('0x41')]=_[_0xa6ac('0x42')](_0x27034d[_0xa6ac('0x41')]);_0x589290['filters']=_['intersection'](_0x589290[_0xa6ac('0x3f')],_0x589290[_0xa6ac('0x41')]);_0x49e1f4[_0xa6ac('0x45')]=_['intersection'](_0x589290[_0xa6ac('0x3f')],qs[_0xa6ac('0x46')](_0x27034d[_0xa6ac('0x41')][_0xa6ac('0x46')]));_0x49e1f4['attributes']=_0x49e1f4[_0xa6ac('0x45')][_0xa6ac('0x47')]?_0x49e1f4['attributes']:_0x589290[_0xa6ac('0x3f')];if(!_0x27034d[_0xa6ac('0x41')][_0xa6ac('0x67')](_0xa6ac('0x48'))){_0x49e1f4[_0xa6ac('0x27')]=qs['limit'](_0x27034d[_0xa6ac('0x41')][_0xa6ac('0x27')]);_0x49e1f4['offset']=qs[_0xa6ac('0x29')](_0x27034d[_0xa6ac('0x41')][_0xa6ac('0x29')]);}_0x49e1f4[_0xa6ac('0x49')]=qs[_0xa6ac('0x4a')](_0x27034d[_0xa6ac('0x41')][_0xa6ac('0x4a')]);_0x49e1f4[_0xa6ac('0x4b')]=qs[_0xa6ac('0x43')](_['pick'](_0x27034d[_0xa6ac('0x41')],_0x589290['filters']));_0x49e1f4['where'][_0xa6ac('0x5f')]=_0xc43aa['id'];if(_0x27034d[_0xa6ac('0x41')]['filter']){_0x49e1f4[_0xa6ac('0x4b')]=_[_0xa6ac('0x4c')](_0x49e1f4[_0xa6ac('0x4b')],{'$or':_[_0xa6ac('0x40')](_0x49e1f4['attributes'],function(_0xda064e){var _0x43a68a={};_0x43a68a[_0xda064e]={'$like':'%'+_0x27034d['query'][_0xa6ac('0x4e')]+'%'};return _0x43a68a;})});}_0x49e1f4=_[_0xa6ac('0x4c')]({},_0x49e1f4,_0x27034d[_0xa6ac('0x53')]);return db['CannedAnswer'][_0xa6ac('0x28')]({'where':_0x49e1f4[_0xa6ac('0x4b')]})[_0xa6ac('0x1a')](function(_0x18d1e9){_0x499aff[_0xa6ac('0x28')]=_0x18d1e9;if(_0x27034d[_0xa6ac('0x41')][_0xa6ac('0x4f')]){_0x49e1f4['include']=[{'all':!![]}];}return db[_0xa6ac('0x65')][_0xa6ac('0x51')](_0x49e1f4);})['then'](function(_0x4e452e){_0x499aff[_0xa6ac('0x52')]=_0x4e452e;return _0x499aff;});}})['then'](respondWithFilteredResult(_0x2da70c,_0x49e1f4))[_0xa6ac('0x23')](handleError(_0x2da70c,null));};exports[_0xa6ac('0x68')]=function(_0xd5623,_0x192d75,_0x4ce06d){return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0xd5623[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x192d75,null))[_0xa6ac('0x1a')](function(_0x20c107){if(_0x20c107){return _0x20c107[_0xa6ac('0x68')](_0xd5623[_0xa6ac('0x41')][_0xa6ac('0x69')]);}})['then'](respondWithStatusCode(_0x192d75,null))['catch'](handleError(_0x192d75,null));};exports[_0xa6ac('0x6a')]=function(_0x275311,_0x28d53c,_0x2a892a){_0x275311[_0xa6ac('0x56')]['sitepic']=_0x275311[_0xa6ac('0x6b')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x275311[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x28d53c,null))[_0xa6ac('0x1a')](saveUpdates(_0x275311[_0xa6ac('0x56')],null))[_0xa6ac('0x1a')](respondWithResult(_0x28d53c,null))[_0xa6ac('0x23')](handleError(_0x28d53c,null));};exports['addAvatar']=function(_0x1cca82,_0x18166c,_0xfefefb){_0x1cca82[_0xa6ac('0x56')][_0xa6ac('0x6c')]=_0x1cca82[_0xa6ac('0x6b')][_0xa6ac('0x6d')];return db[_0xa6ac('0x3a')]['find']({'where':{'id':_0x1cca82[_0xa6ac('0x5c')]['id']}})['then'](handleEntityNotFound(_0x18166c,null))['then'](saveUpdates(_0x1cca82[_0xa6ac('0x56')],null))[_0xa6ac('0x1a')](respondWithResult(_0x18166c,null))['catch'](handleError(_0x18166c,null));};exports[_0xa6ac('0x6e')]=function(_0x5ee412,_0x4995e9,_0x678050){_0x5ee412['body']['customerAvatar']=_0x5ee412[_0xa6ac('0x6b')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x5ee412[_0xa6ac('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4995e9,null))['then'](saveUpdates(_0x5ee412['body'],null))['then'](respondWithResult(_0x4995e9,null))[_0xa6ac('0x23')](handleError(_0x4995e9,null));};exports['addSystemAvatar']=function(_0x398c93,_0x4825f6,_0x517284){_0x398c93[_0xa6ac('0x56')][_0xa6ac('0x6f')]=_0x398c93[_0xa6ac('0x6b')][_0xa6ac('0x6d')];return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0x398c93[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x4825f6,null))[_0xa6ac('0x1a')](saveUpdates(_0x398c93[_0xa6ac('0x56')],null))['then'](respondWithResult(_0x4825f6,null))[_0xa6ac('0x23')](handleError(_0x4825f6,null));};exports[_0xa6ac('0x70')]=function(_0x37c599,_0x3ed23f,_0x41beed){var _0x3140e2=path[_0xa6ac('0x71')](config[_0xa6ac('0x72')],_0xa6ac('0x73'));var _0x54baf5={'where':{'id':_0x37c599['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x331622=![];return require(_0xa6ac('0x74'))[_0xa6ac('0x75')]()['then'](function(_0xb5bf7a){if(_0xb5bf7a){_0x331622=_0xb5bf7a[_0xa6ac('0x76')];}})[_0xa6ac('0x1a')](function(){return db[_0xa6ac('0x3a')][_0xa6ac('0x54')](_0x54baf5);})[_0xa6ac('0x1a')](handleEntityNotFound(_0x3ed23f,null))[_0xa6ac('0x1a')](function(_0x529538){if(_0x529538){if(!_['isNil'](_0x529538[_0xa6ac('0x77')])){if(fs[_0xa6ac('0x78')](path[_0xa6ac('0x71')](config[_0xa6ac('0x72')],_0xa6ac('0x79'),_0x529538[_0xa6ac('0x77')]))&&_0x331622){_0x3140e2=path[_0xa6ac('0x71')](config[_0xa6ac('0x72')],_0xa6ac('0x79'),_0x529538[_0xa6ac('0x77')]);}}return _0x3ed23f[_0xa6ac('0x7a')](_0x3140e2);}})[_0xa6ac('0x23')](handleError(_0x3ed23f,null));};exports[_0xa6ac('0x7b')]=function(_0x31d758,_0x327345,_0x14efbc){var _0x8032e6=path[_0xa6ac('0x71')](config[_0xa6ac('0x72')],_0xa6ac('0x7c'));var _0x8b83b4={'where':{'id':_0x31d758[_0xa6ac('0x5c')]['id']},'attributes':['id',_0xa6ac('0x6c')],'raw':!![]};return db['ChatWebsite'][_0xa6ac('0x54')](_0x8b83b4)[_0xa6ac('0x1a')](handleEntityNotFound(_0x327345,null))[_0xa6ac('0x1a')](function(_0x1f3ebc){if(_0x1f3ebc){if(!_[_0xa6ac('0x7d')](_0x1f3ebc[_0xa6ac('0x6c')])){if(fs['existsSync'](path['join'](config['root'],_0xa6ac('0x7e'),_0x1f3ebc[_0xa6ac('0x6c')]))){_0x8032e6=path[_0xa6ac('0x71')](config['root'],'server/files/images/avatars/',_0x1f3ebc[_0xa6ac('0x6c')]);}}return _0x327345[_0xa6ac('0x7a')](_0x8032e6);}})[_0xa6ac('0x23')](handleError(_0x327345,null));};exports[_0xa6ac('0x7f')]=function(_0x5245b4,_0xe2cac9,_0x3861b0){var _0x268d7d=path[_0xa6ac('0x71')](config['root'],_0xa6ac('0x80'));var _0x39a9c4={'where':{'id':_0x5245b4[_0xa6ac('0x5c')]['id']},'attributes':['id',_0xa6ac('0x81'),_0xa6ac('0x82')],'raw':!![]};return db[_0xa6ac('0x3a')][_0xa6ac('0x54')](_0x39a9c4)[_0xa6ac('0x1a')](handleEntityNotFound(_0xe2cac9,null))[_0xa6ac('0x1a')](function(_0x56e088){if(_0x56e088){if(!_['isNil'](_0x56e088[_0xa6ac('0x81')])){if(fs[_0xa6ac('0x78')](path[_0xa6ac('0x71')](config['root'],_0xa6ac('0x7e'),_0x56e088['customerAvatar']))&&_0x56e088[_0xa6ac('0x82')]){_0x268d7d=path['join'](config[_0xa6ac('0x72')],_0xa6ac('0x7e'),_0x56e088['customerAvatar']);}}return _0xe2cac9[_0xa6ac('0x7a')](_0x268d7d);}})[_0xa6ac('0x23')](handleError(_0xe2cac9,null));};exports[_0xa6ac('0x83')]=function(_0x291a9c,_0x5ebf2a,_0x2feac4){var _0x122f9c=path[_0xa6ac('0x71')](config[_0xa6ac('0x72')],_0xa6ac('0x84'));var _0x3ba996={'where':{'id':_0x291a9c[_0xa6ac('0x5c')]['id']},'attributes':['id',_0xa6ac('0x6f')],'raw':!![]};return db[_0xa6ac('0x3a')][_0xa6ac('0x54')](_0x3ba996)[_0xa6ac('0x1a')](handleEntityNotFound(_0x5ebf2a,null))['then'](function(_0x5e6bac){if(_0x5e6bac){if(!_[_0xa6ac('0x7d')](_0x5e6bac['systemAvatar'])){if(fs[_0xa6ac('0x78')](path['join'](config[_0xa6ac('0x72')],'server/files/images/avatars/',_0x5e6bac[_0xa6ac('0x6f')]))){_0x122f9c=path[_0xa6ac('0x71')](config[_0xa6ac('0x72')],_0xa6ac('0x7e'),_0x5e6bac[_0xa6ac('0x6f')]);}}return _0x5ebf2a['download'](_0x122f9c);}})[_0xa6ac('0x23')](handleError(_0x5ebf2a,null));};exports[_0xa6ac('0x85')]=function(_0x2a6354,_0x1a24bc,_0x5be807){var _0x2c33a9=require(_0xa6ac('0x86'));var _0x49c361=new _0x2c33a9();var _0x4ac464=_0x49c361[_0xa6ac('0x87')](_0x2a6354[_0xa6ac('0x88')]['user-agent'])['getResult']();var _0x28189e={'body':_0x2a6354[_0xa6ac('0x56')],'channel':'chat'};var _0x120d3b=[];var _0x39d923=[];var _0x45c2d8={};var _0x2a3f4d=![];return db[_0xa6ac('0x89')][_0xa6ac('0x5d')]()['then'](function(_0x260038){if(!_0x260038){throw new db['Sequelize']['ValidationError'](_0xa6ac('0x8a'));}_0x120d3b=_[_0xa6ac('0x8b')](_[_0xa6ac('0x42')](_0x260038),[_0xa6ac('0x8c'),_0xa6ac('0x8d')]);_0x39d923=_[_0xa6ac('0x8b')](_['keys'](_0x260038),[_0xa6ac('0x8c'),_0xa6ac('0x8d'),_0xa6ac('0x8e'),_0xa6ac('0x8f')]);if(_0x2a6354['body']['id']){delete _0x2a6354[_0xa6ac('0x56')]['id'];}if(_[_0xa6ac('0x7d')](_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0x90')])){throw new db[(_0xa6ac('0x91'))][(_0xa6ac('0x92'))](_0xa6ac('0x93'));}if(_['isNil'](_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0x56')])||_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0x56')]===''){throw new db[(_0xa6ac('0x91'))]['ValidationError'](_0xa6ac('0x94'));}if(_[_0xa6ac('0x7d')](_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0x95')])){throw new db[(_0xa6ac('0x91'))][(_0xa6ac('0x92'))](_0xa6ac('0x96')+_0x39d923);}if(!_[_0xa6ac('0x97')](_0x39d923,_0x2a6354[_0xa6ac('0x56')]['mapKey'])){throw new db[(_0xa6ac('0x91'))][(_0xa6ac('0x92'))](_0xa6ac('0x98')+_0x39d923);}_0x45c2d8[_0x2a6354['body'][_0xa6ac('0x95')]]=_0x2a6354['body']['from'];})[_0xa6ac('0x1a')](function(){return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0x2a6354[_0xa6ac('0x5c')]['id']},'include':[{'model':db[_0xa6ac('0x99')],'as':_0xa6ac('0x9a'),'include':[{'model':db[_0xa6ac('0x89')],'as':'Contacts','where':_0x45c2d8,'limit':0x1,'order':[[_0xa6ac('0x8d'),_0xa6ac('0x9b')]]}]},{'model':db[_0xa6ac('0x9c')],'as':_0xa6ac('0x9d')}]});})[_0xa6ac('0x1a')](handleEntityNotFound(_0x1a24bc,null))[_0xa6ac('0x1a')](function(_0x1de796){if(_0x1de796&&_0x1de796['List']){_0x28189e[_0xa6ac('0x9e')]=_0x1de796;_0x28189e[_0xa6ac('0x9f')]=_0x1de796[_0xa6ac('0x9d')];_0x28189e[_0xa6ac('0xa0')]=_0x1de796[_0xa6ac('0x9a')];_0x28189e[_0xa6ac('0x9f')]=_[_0xa6ac('0xa1')](_0x28189e['applications'],[_0xa6ac('0xa2')],['asc']);if(_0x28189e[_0xa6ac('0x9e')][_0xa6ac('0x9d')]){delete _0x28189e[_0xa6ac('0x9e')]['Applications'];}if(_0x28189e[_0xa6ac('0x9e')]['List']&&_0x28189e[_0xa6ac('0x9e')][_0xa6ac('0x9a')]['Contacts'][_0xa6ac('0x47')]){return _0x28189e[_0xa6ac('0x9e')][_0xa6ac('0x9a')]['Contacts'][0x0];}var _0x14ab6a=_['defaults'](_0x2a6354[_0xa6ac('0x56')],{'firstName':_0x2a6354['body'][_0xa6ac('0x90')],'ListId':_0x1de796[_0xa6ac('0x8f')]});_0x14ab6a[_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0x95')]]=_0x2a6354['body'][_0xa6ac('0x90')];return db[_0xa6ac('0x89')]['create'](_0x14ab6a,{'fields':_0x120d3b,'raw':!![]});}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x1a24bc,null))[_0xa6ac('0x1a')](function(_0x1d673c){_0x28189e[_0xa6ac('0xa3')]=_0x1d673c;var _0x3579c5=_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xa4')];if(_0x2a6354[_0xa6ac('0x88')][_0xa6ac('0xa5')]){_0x3579c5=_0x2a6354['headers'][_0xa6ac('0xa5')];}else if(_0x2a6354['headers'][_0xa6ac('0xa6')]){_0x3579c5=_['first'](_0x2a6354[_0xa6ac('0x88')]['x-forwarded-for'][_0xa6ac('0xa7')](','));}if(_0x1d673c){var _0x551998={'ContactId':_0x1d673c['id'],'ChatWebsiteId':_0x2a6354['params']['id'],'from':(_0x1d673c[_0xa6ac('0xa8')]||'')+'\x20'+(_0x1d673c[_0xa6ac('0xa9')]||''),'customerIp':_0x3579c5,'customerPort':_0x2a6354[_0xa6ac('0x88')][_0xa6ac('0xaa')]?_0x2a6354[_0xa6ac('0x88')][_0xa6ac('0xaa')]:null,'referer':_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xab')],'browserName':_0x4ac464['browser'][_0xa6ac('0x36')]&&_0x4ac464[_0xa6ac('0xac')][_0xa6ac('0xad')]?util['format'](_0xa6ac('0xae'),_0x4ac464[_0xa6ac('0xac')]['name'],_0x4ac464['browser'][_0xa6ac('0xad')]):'unknown','browserVersion':_0x4ac464[_0xa6ac('0xac')]['version']||_0xa6ac('0xaf'),'osName':util[_0xa6ac('0xb0')]('%s\x20%s',_0x4ac464['os'][_0xa6ac('0x36')],_0x4ac464['os'][_0xa6ac('0xad')]),'osVersion':_0x4ac464['os'][_0xa6ac('0xad')],'deviceModel':_0x4ac464['device'][_0xa6ac('0x3f')]&&_0x4ac464['device']['vendor']?util[_0xa6ac('0xb0')]('%s\x20%s\x20%s',_0x4ac464['device'][_0xa6ac('0x3f')],_0x4ac464[_0xa6ac('0xb1')][_0xa6ac('0xb2')],_0x4ac464['device']['type']):null,'deviceVendor':_0x4ac464['device'][_0xa6ac('0xb2')],'deviceType':_0x4ac464[_0xa6ac('0xb1')][_0xa6ac('0x3d')],'formData':JSON['stringify'](_0x2a6354[_0xa6ac('0x56')])};var _0x188b96={'ChatWebsiteId':_0x2a6354[_0xa6ac('0x5c')]['id'],'closed':![]};if(_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xb3')]){_0x188b96[_0xa6ac('0xb3')]=_0x2a6354['body'][_0xa6ac('0xb3')];return db[_0xa6ac('0xb4')][_0xa6ac('0x54')]({'where':_0x188b96})[_0xa6ac('0x1a')](function(_0xd5505b){if(_0xd5505b){return[_0xd5505b,![]];}_0x551998[_0xa6ac('0xb3')]=_0x2a6354['body'][_0xa6ac('0xb3')];_0x551998[_0xa6ac('0xb5')]=_0x2a6354['body']['externalUrl'];return db[_0xa6ac('0xb4')][_0xa6ac('0x55')](_0x551998)[_0xa6ac('0x1a')](function(_0x39dd35){return[_0x39dd35,!![]];});});}_0x188b96[_0xa6ac('0xb6')]=_0x1d673c['id'];if(_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xb7')]&&_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xb7')]['id']){_0x188b96['id']=_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xb7')]['id'];return db[_0xa6ac('0xb4')][_0xa6ac('0x54')]({'where':_0x188b96})['then'](function(_0x3ce301){if(_0x3ce301){return[_0x3ce301,![]];}return db[_0xa6ac('0xb4')][_0xa6ac('0x55')](_0x551998)[_0xa6ac('0x1a')](function(_0x1a4b5e){return[_0x1a4b5e,!![]];});});}return db['ChatInteraction']['create'](_0x551998)['then'](function(_0x599165){return[_0x599165,!![]];});}})[_0xa6ac('0xb8')](function(_0xda65ed,_0x4573d3){if(_0xda65ed){_0x2a3f4d=_0x4573d3;if(!_0x4573d3){var _0x16bb3f={'from':(_0x28189e[_0xa6ac('0xa3')][_0xa6ac('0xa8')]||'')+'\x20'+(_0x28189e[_0xa6ac('0xa3')][_0xa6ac('0xa9')]||'')};if(_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xb3')]&&_0x2a6354['body'][_0xa6ac('0xb9')]&&_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xb3')]!=_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xb9')]){_0x16bb3f['threadId']=_0x2a6354[_0xa6ac('0x56')][_0xa6ac('0xb9')];}return _0xda65ed[_0xa6ac('0x2f')](_0x16bb3f);}else{return _0xda65ed;}}})[_0xa6ac('0x1a')](function(_0x2b906f){_0x28189e['interaction']=_0x2b906f[_0xa6ac('0x31')]({'plain':!![]});_0x28189e[_0xa6ac('0xb7')][_0xa6ac('0xba')]=_0x2a3f4d;if(_0x28189e['interaction'][_0xa6ac('0xba')]){if(_0x28189e[_0xa6ac('0x9e')][_0xa6ac('0xbb')]){_0x28189e[_0xa6ac('0x9f')][_0xa6ac('0xbc')]({'id':0x0,'priority':_0x28189e[_0xa6ac('0x9f')][_0xa6ac('0x47')]+0x1,'app':'close','appdata':_0xa6ac('0xbd'),'interval':_0xa6ac('0xbe')});}}return db['ChatMessage']['create']({'body':_0x2a6354['body'][_0xa6ac('0x56')],'ChatWebsiteId':_0x2a6354[_0xa6ac('0x5c')]['id'],'ChatInteractionId':_0x2b906f['id'],'direction':'in','ContactId':_0x28189e[_0xa6ac('0xa3')]['id'],'AttachmentId':_0x2a6354[_0xa6ac('0x56')]['AttachmentId']});})[_0xa6ac('0x1a')](function(_0x3b65be){_0x28189e['message']=_0x3b65be;if(_0x28189e[_0xa6ac('0xb7')][_0xa6ac('0xbf')]){return db[_0xa6ac('0xc0')][_0xa6ac('0x54')]({'attributes':['id',_0xa6ac('0x36')],'where':{'id':_0x28189e[_0xa6ac('0xb7')]['UserId']}})[_0xa6ac('0x1a')](function(_0x149d28){if(_0x149d28){_0x28189e[_0xa6ac('0x9f')][_0xa6ac('0xc1')]({'id':0x0,'priority':0x0,'app':_0xa6ac('0xc2'),'appdata':_0x149d28[_0xa6ac('0x36')]+','+(_0x28189e[_0xa6ac('0x9e')][_0xa6ac('0xc3')]||0xa),'interval':_0xa6ac('0xbe')});_0x28189e[_0xa6ac('0xc4')]=!![];}return respondWithRpcPromise(_0xa6ac('0xc5'),'startRouting',_0x28189e);});}return respondWithRpcPromise(_0xa6ac('0xc5'),_0xa6ac('0xc6'),_0x28189e);})[_0xa6ac('0x1a')](function(_0xa2987c){respondWithRpcPromise(_0xa6ac('0xc7'),'EventManager',{'event':_0xa6ac('0x85'),'message':_0xa2987c},client9002);return _0xa2987c;})[_0xa6ac('0x1a')](respondWithResult(_0x1a24bc,null))['catch'](handleError(_0x1a24bc,null));};exports['offline']=function(_0x3fd6ca,_0x234f7a,_0x418d5d){var _0x209f7e,_0x392b82,_0x5a3b1b;var _0x1b2b17=[];var _0x25558b=[];var _0x472cb5={};var _0xc4398c=_0x3fd6ca[_0xa6ac('0xc8')]||[];var _0x5dc604=[];var _0x4e26ca;return db[_0xa6ac('0x89')][_0xa6ac('0x5d')]()[_0xa6ac('0x1a')](function(_0x1f6ad3){if(!_0x1f6ad3){throw new db[(_0xa6ac('0x91'))][(_0xa6ac('0x92'))](_0xa6ac('0x8a'));}_0x25558b=_[_0xa6ac('0x8b')](_['keys'](_0x1f6ad3),[_0xa6ac('0x8c'),_0xa6ac('0x8d')]);_0x1b2b17=_[_0xa6ac('0x8b')](_['keys'](_0x1f6ad3),[_0xa6ac('0x8c'),'updatedAt',_0xa6ac('0x8e'),'ListId']);if(_0x3fd6ca['body']['id']){delete _0x3fd6ca[_0xa6ac('0x56')]['id'];}if(_[_0xa6ac('0x7d')](_0x3fd6ca[_0xa6ac('0x56')][_0xa6ac('0x90')])){throw _0x234f7a['status'](0x1f4)[_0xa6ac('0x37')](new db[(_0xa6ac('0x91'))]['ValidationError'](_0xa6ac('0x93')));}if(_[_0xa6ac('0x7d')](_0x3fd6ca[_0xa6ac('0x56')][_0xa6ac('0x56')])||_0x3fd6ca['body'][_0xa6ac('0x56')]===''){throw _0x234f7a[_0xa6ac('0x24')](0x1f4)[_0xa6ac('0x37')](new db[(_0xa6ac('0x91'))][(_0xa6ac('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa6ac('0x7d')](_0x3fd6ca[_0xa6ac('0x56')][_0xa6ac('0xc9')])){throw _0x234f7a[_0xa6ac('0x24')](0x1f4)['send'](new db[(_0xa6ac('0x91'))]['ValidationError'](_0xa6ac('0xca')+_0x1b2b17));}if(!_[_0xa6ac('0x97')](_0x1b2b17,_0x3fd6ca[_0xa6ac('0x56')][_0xa6ac('0xc9')])){throw _0x234f7a[_0xa6ac('0x24')](0x1f4)[_0xa6ac('0x37')](new db['Sequelize'][(_0xa6ac('0x92'))](_0xa6ac('0xcb')+_0x1b2b17));}_0x472cb5[_0x3fd6ca['body']['mapKeyOffline']]=_0x3fd6ca['body'][_0xa6ac('0x90')];})[_0xa6ac('0x1a')](function(){return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0x3fd6ca[_0xa6ac('0x5c')]['id']},'include':[{'model':db[_0xa6ac('0x99')],'as':_0xa6ac('0x9a')},{'model':db['MailAccount'],'as':_0xa6ac('0xcc')}]});})['then'](handleEntityNotFound(_0x234f7a,null))[_0xa6ac('0x1a')](function(_0x341ac6){if(_0x341ac6&&_0x341ac6[_0xa6ac('0x9a')]){_0x392b82=_0x341ac6;var _0x3ee8f9=_[_0xa6ac('0x12')](_0x3fd6ca[_0xa6ac('0x56')],{'firstName':_0x3fd6ca[_0xa6ac('0x56')][_0xa6ac('0x90')],'phone':_0x3fd6ca[_0xa6ac('0x56')][_0xa6ac('0x90')],'ListId':_0x341ac6[_0xa6ac('0x8f')]});_0x3ee8f9[_0x3fd6ca['body'][_0xa6ac('0xc9')]]=_0x3fd6ca[_0xa6ac('0x56')][_0xa6ac('0x90')];return db[_0xa6ac('0x89')][_0xa6ac('0xcd')]({'where':_0x472cb5,'defaults':_0x3ee8f9});}})['spread'](function(_0xbb8484){if(_0xbb8484){_0x5a3b1b=_0xbb8484;var _0x137e90=fs[_0xa6ac('0xce')](path[_0xa6ac('0x71')](config[_0xa6ac('0x72')],'server/files/templates/chatOfflineMessage.ejs'),_0xa6ac('0xcf'));var _0x2e2836=ejs['render'](_0x137e90,{'body':_[_0xa6ac('0xd0')](_0x3fd6ca[_0xa6ac('0x56')][_0xa6ac('0x56')]),'bodyTitle':_0x392b82['offlineMessageBody']});return db['ChatOfflineMessage'][_0xa6ac('0x55')]({'body':_0x2e2836,'ContactId':_0xbb8484['id'],'ChatWebsiteId':_0x392b82['id']});}})['then'](function(_0x45bda6){_0x4e26ca=_0x45bda6;if(_0xc4398c[_0xa6ac('0x47')]){var _0x23d9aa=_0xc4398c[_0xa6ac('0x40')](function(_0x37e16e){return{'name':_0x37e16e['originalname'],'basename':_0x37e16e['filename'],'type':_0x37e16e[_0xa6ac('0xd1')],'ChatOfflineMessageId':_0x45bda6['id']};});_0x5dc604=_0x23d9aa[_0xa6ac('0x40')](_0x503286=>{var _0x29bc62={'filename':_0x503286['name'],'path':path['join'](config[_0xa6ac('0x72')],_0xa6ac('0xd2'),_0xa6ac('0xc8'),'attachments',_0xa6ac('0xd3'),_0x503286['basename'])};return _0x29bc62;});if(!_0x392b82[_0xa6ac('0xd4')]){return db[_0xa6ac('0xd5')]['transaction'](function(_0x53a23f){return db['Attachment']['bulkCreate'](_0x23d9aa,{'transaction':_0x53a23f});});}}})['then'](function(){if(_0x4e26ca){_0x209f7e=_0x4e26ca;return db[_0xa6ac('0xcc')][_0xa6ac('0x61')]({'where':{'active':!![]},'include':[{'model':db[_0xa6ac('0xd6')],'as':_0xa6ac('0xd7'),'raw':!![]}]});}})[_0xa6ac('0x1a')](function(_0x2728a8){if(_0x2728a8&&_0x2728a8['Smtp']&&_0x392b82[_0xa6ac('0xd8')]&&_0x392b82[_0xa6ac('0xd9')]){var _0x1fe5e2={'tls':{'rejectUnauthorized':![]}};if(_0x2728a8[_0xa6ac('0xd7')][_0xa6ac('0xda')]){_0x1fe5e2['service']=_0x2728a8[_0xa6ac('0xd7')][_0xa6ac('0xda')];}else{_0x1fe5e2[_0xa6ac('0xdb')]=_0x2728a8[_0xa6ac('0xd7')]['host'];_0x1fe5e2[_0xa6ac('0xdc')]=_0x2728a8[_0xa6ac('0xd7')][_0xa6ac('0xdc')];_0x1fe5e2[_0xa6ac('0xdd')]=_0x2728a8[_0xa6ac('0xd7')][_0xa6ac('0xdd')];}if(_0x2728a8['Smtp'][_0xa6ac('0xde')]){_0x1fe5e2['auth']={'user':_0x2728a8[_0xa6ac('0xd7')][_0xa6ac('0x57')],'pass':_0x2728a8[_0xa6ac('0xd7')]['pass']};}return respondWithRpcPromise(_0xa6ac('0xdf'),_0xa6ac('0xe0'),{'account':_0x1fe5e2,'message':{'from':util[_0xa6ac('0xb0')]('\x22%s\x22\x20<%s>',_0x2728a8['name'],_0x2728a8[_0xa6ac('0xe1')]||_0x2728a8[_0xa6ac('0xd7')][_0xa6ac('0x57')]),'to':_0x392b82[_0xa6ac('0xd9')],'subject':_0x392b82[_0xa6ac('0xe2')],'html':_0x209f7e['body'],'attachments':_0x5dc604}},client9003)['then'](function(){return _0x209f7e;})[_0xa6ac('0x23')](function(_0x1aa86b){console['error'](_0x1aa86b);});}})[_0xa6ac('0x1a')](function(){if(_0x392b82&&_0x392b82['openNewInteraction']&&_0x392b82[_0xa6ac('0xe3')]){var _0x3a62a6=[];if(_0xc4398c[_0xa6ac('0x47')]){_0x3a62a6=_0xc4398c[_0xa6ac('0x40')](function(_0xe74957){return{'name':_0xe74957[_0xa6ac('0xe4')],'basename':_0xe74957[_0xa6ac('0x6d')],'type':_0xe74957[_0xa6ac('0xd1')],'ChatOfflineMessageId':_0x4e26ca['id']};});}var _0x13cf26;if(!_['isNil'](_0x392b82[_0xa6ac('0xe5')])){var _0x2ed20c=_['map'](_0x3fd6ca[_0xa6ac('0x56')],function(_0x273074){return _0x273074;});var _0x404c82=_['toPairsIn'](_0x2ed20c)[0x0];var _0x293e05=_[_0xa6ac('0xe6')](_0x404c82,function(_0x47fba6){return _0x47fba6;});_0x13cf26=_0x293e05[0x1][_0x392b82['subjectOffline']];}var _0x2af070={'from':_0x5a3b1b[_0xa6ac('0xe1')],'firstName':_0x5a3b1b[_0xa6ac('0xa8')],'lastName':_0x5a3b1b[_0xa6ac('0xa9')],'mapKey':_0xa6ac('0xe1'),'message':{'from':_0x5a3b1b[_0xa6ac('0xe1')],'to':_0x392b82[_0xa6ac('0xcc')][_0xa6ac('0xe1')],'cc':'','subject':_[_0xa6ac('0x7d')](_0x13cf26)?_0x392b82['offlineMessageSubject']:_0x13cf26,'messageId':'','sentAt':new Date(),'attach':_0x3a62a6['length'],'attachments':_0x3a62a6,'originChannel':_0xa6ac('0xe7'),'ChatWebsiteId':_0x392b82['id'],'ChatOfflineMessageId':_0x209f7e['id'],'originTo':_0x392b82[_0xa6ac('0xcc')][_0xa6ac('0xe1')]},'body':_0x209f7e['body']};var _0xb6eee8={'account':{'id':_0x392b82[_0xa6ac('0xe3')]},'body':_0x2af070,'log':_0xa6ac('0xe8')};return respondWithRpcPromise('NotifyMailAccount',_0xa6ac('0xe9'),_0xb6eee8,client9001)[_0xa6ac('0x1a')](function(){return _0x209f7e;})[_0xa6ac('0x23')](function(_0x30d5a3){console[_0xa6ac('0x1e')](_0x30d5a3);});}return;})[_0xa6ac('0x1a')](function(){if(_0x209f7e){return _0x209f7e;}})[_0xa6ac('0x1a')](respondWithResult(_0x234f7a,null))[_0xa6ac('0x23')](function(_0x4c29c4){console[_0xa6ac('0x1e')](_0xa6ac('0x23'),_0x4c29c4);for(var _0x4ba0c8 of _0xc4398c){var _0x324f73=path[_0xa6ac('0x71')](config[_0xa6ac('0x72')],_0xa6ac('0xd2'),_0xa6ac('0xc8'),'attachments','offline-chat',_0x4ba0c8[_0xa6ac('0x6d')]);fs_extra[_0xa6ac('0xea')](_0x324f73)[_0xa6ac('0x23')](function(_0x1bba29){console[_0xa6ac('0x1e')](_0xa6ac('0xeb'),_0x324f73,_0x1bba29);});}});};exports[_0xa6ac('0xec')]=function(_0x568bcd,_0x52084e,_0x5c77bf){return db[_0xa6ac('0xb4')]['find']({'where':{'id':_0x568bcd['params']['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x52084e,null))[_0xa6ac('0x1a')](function(_0x23a1b8){if(_0x23a1b8){return _0x23a1b8['addInteraction'](_0x568bcd[_0xa6ac('0x56')][_0xa6ac('0x69')],_[_0xa6ac('0xed')](_0x568bcd[_0xa6ac('0x56')],[_0xa6ac('0x69'),'id'])||{});}})[_0xa6ac('0x1a')](respondWithResult(_0x52084e,null))[_0xa6ac('0x23')](handleError(_0x52084e,null));};exports[_0xa6ac('0xee')]=function(_0x48058c,_0x46fe80,_0x30e411){var _0x43b296={'raw':![],'where':{}};var _0x21f143={};var _0x123638={'count':0x0,'rows':[]};return db[_0xa6ac('0x3a')][_0xa6ac('0x61')]({'where':{'id':_0x48058c[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x46fe80,null))[_0xa6ac('0x1a')](function(_0x578879){if(_0x578879){_0x21f143['model']=_['keys'](db[_0xa6ac('0xb4')][_0xa6ac('0x3b')]);_0x21f143[_0xa6ac('0x41')]=_['keys'](_0x48058c[_0xa6ac('0x41')]);_0x21f143[_0xa6ac('0x43')]=_[_0xa6ac('0x44')](_0x21f143[_0xa6ac('0x3f')],_0x21f143[_0xa6ac('0x41')]);_0x43b296[_0xa6ac('0x45')]=_[_0xa6ac('0x44')](_0x21f143[_0xa6ac('0x3f')],qs[_0xa6ac('0x46')](_0x48058c[_0xa6ac('0x41')][_0xa6ac('0x46')]));_0x43b296[_0xa6ac('0x45')]=_0x43b296[_0xa6ac('0x45')][_0xa6ac('0x47')]?_0x43b296[_0xa6ac('0x45')]:_0x21f143[_0xa6ac('0x3f')];if(!_0x48058c[_0xa6ac('0x41')][_0xa6ac('0x67')](_0xa6ac('0x48'))){_0x43b296[_0xa6ac('0x27')]=qs[_0xa6ac('0x27')](_0x48058c[_0xa6ac('0x41')][_0xa6ac('0x27')]);_0x43b296['offset']=qs[_0xa6ac('0x29')](_0x48058c['query'][_0xa6ac('0x29')]);}_0x43b296[_0xa6ac('0x49')]=qs[_0xa6ac('0x4a')](_0x48058c[_0xa6ac('0x41')][_0xa6ac('0x4a')]);_0x43b296[_0xa6ac('0x4b')]=qs[_0xa6ac('0x43')](_[_0xa6ac('0x62')](_0x48058c[_0xa6ac('0x41')],_0x21f143[_0xa6ac('0x43')]));_0x43b296['where']['ChatWebsiteId']=_0x578879['id'];if(_0x48058c[_0xa6ac('0x41')][_0xa6ac('0x4e')]){_0x43b296['where']=_['merge'](_0x43b296[_0xa6ac('0x4b')],{'$or':_[_0xa6ac('0x40')](_0x43b296[_0xa6ac('0x45')],function(_0x2d0b80){var _0x131b37={};_0x131b37[_0x2d0b80]={'$like':'%'+_0x48058c[_0xa6ac('0x41')]['filter']+'%'};return _0x131b37;})});}_0x43b296=_['merge']({},_0x43b296,_0x48058c[_0xa6ac('0x53')]);return db[_0xa6ac('0xb4')]['count']({'where':_0x43b296[_0xa6ac('0x4b')]})[_0xa6ac('0x1a')](function(_0x64a4ca){_0x123638[_0xa6ac('0x28')]=_0x64a4ca;if(_0x48058c[_0xa6ac('0x41')]['includeAll']){_0x43b296['include']=[{'model':db[_0xa6ac('0x89')],'as':'Contact','required':![]},{'model':db[_0xa6ac('0xc0')],'as':_0xa6ac('0xef'),'attributes':[_0xa6ac('0x36'),'fullname',_0xa6ac('0xf0')],'required':![]},{'model':db['Tag'],'as':_0xa6ac('0xf1'),'attributes':['id',_0xa6ac('0x36'),_0xa6ac('0xf2')],'where':_0x48058c[_0xa6ac('0x41')][_0xa6ac('0xf3')]?{'id':_0x48058c[_0xa6ac('0x41')][_0xa6ac('0xf3')]}:undefined,'required':_0x48058c['query'][_0xa6ac('0xf3')]?!![]:![]}];}return db[_0xa6ac('0xb4')]['findAll'](_0x43b296);})[_0xa6ac('0x1a')](function(_0x88ffa0){_0x123638[_0xa6ac('0x52')]=_0x88ffa0;return _0x123638;});}})[_0xa6ac('0x1a')](respondWithFilteredResult(_0x46fe80,_0x43b296))[_0xa6ac('0x23')](handleError(_0x46fe80,null));};function iftimePromise(_0x1b648d,_0x4919a5){return respondWithRpcPromise(_0xa6ac('0xf4'),_0xa6ac('0xf5'),{'command':_0x4919a5[_0xa6ac('0xf6')]?util[_0xa6ac('0xb0')](_0xa6ac('0xf7'),_0x1b648d[_0xa6ac('0xf8')],_0x4919a5[_0xa6ac('0xf6')]):util[_0xa6ac('0xb0')](_0xa6ac('0xf9'),_0x1b648d[_0xa6ac('0xf8')])},client9002)[_0xa6ac('0x1a')](function(_0xd004fd){var _0x5e5b50=_0xd004fd&&_0xd004fd['indexOf'](_0xa6ac('0xfa'))>=0x0?!![]:![];logger[_0xa6ac('0x22')](_0xa6ac('0xfb'),_0x4919a5['id'],_0x1b648d['id'],_0x1b648d[_0xa6ac('0xf8')],_0x5e5b50?_0xa6ac('0xfc'):_0xa6ac('0xfd'),_0x4919a5[_0xa6ac('0xf6')]?_0x4919a5[_0xa6ac('0xf6')]:'No\x20timezone');return _0x5e5b50;})['catch'](function(_0x2767f9){logger[_0xa6ac('0x1e')](_0xa6ac('0xfb'),_0x4919a5['id'],_0x1b648d['id'],_0x1b648d['interval'],util[_0xa6ac('0xfe')](_0x2767f9,{'showHidden':![],'depth':null}),_0x4919a5[_0xa6ac('0xf6')]?_0x4919a5[_0xa6ac('0xf6')]:_0xa6ac('0xff'));return![];});}exports[_0xa6ac('0xf5')]=function(_0x12315a,_0x4f73d5,_0x3c96fb){var _0x24167c=0x0;var _0xe485de=0x0;var _0x2742d9=![];var _0x125c08;var _0x5a693e;return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0x12315a[_0xa6ac('0x5c')]['id']},'include':[{'model':db['Interval'],'as':_0xa6ac('0x100'),'include':[{'model':db['Interval'],'as':_0xa6ac('0x101'),'attributes':['id',_0xa6ac('0xf8')],'raw':!![]}]}]})[_0xa6ac('0x1a')](handleEntityNotFound(_0x4f73d5,null))[_0xa6ac('0x1a')](function(_0x5ee0df){if(_0x5ee0df){_0x125c08=_0x5ee0df;return _0x5ee0df[_0xa6ac('0x102')]({'raw':!![]});}})['then'](function(_0x2f9b1d){if(_0x125c08){if(_0x2f9b1d){_0x5a693e=_0x2f9b1d;}}return require('../../config/license/util')[_0xa6ac('0x75')]();})[_0xa6ac('0x1a')](function(_0xf3c863){if(_0xf3c863){_0xe485de=_0xf3c863[_0xa6ac('0x103')];_0x2742d9=_0xf3c863['custom'];}})['then'](function(){return db[_0xa6ac('0xb4')][_0xa6ac('0x28')]({'where':{'closed':![]}});})[_0xa6ac('0x1a')](function(_0xd1020a){_0x24167c=_0xd1020a;if(_0xe485de&&_0xd1020a>_0xe485de){return db['License'][_0xa6ac('0x61')]({'where':{'id':0x1}})[_0xa6ac('0x1a')](function(_0x57a1db){if(_0x57a1db){_0x57a1db['increment'](_0xa6ac('0x104'));}});}})[_0xa6ac('0x1a')](function(){if(_0x125c08[_0xa6ac('0x100')]&&_0x125c08[_0xa6ac('0x100')]['Intervals']){var _0x5c19e7=[];for(var _0x314a32=0x0;_0x314a32<_0x125c08[_0xa6ac('0x100')][_0xa6ac('0x101')][_0xa6ac('0x47')];_0x314a32++){var _0x19ace5=_0x125c08[_0xa6ac('0x100')][_0xa6ac('0x101')][_0x314a32][_0xa6ac('0x31')]({'plain':!![]});_0x5c19e7[_0xa6ac('0xbc')](iftimePromise(_0x19ace5,_0x125c08));}return BPromise['all'](_0x5c19e7)[_0xa6ac('0x1a')](function(_0x422b77){return _[_0xa6ac('0x105')](_0x422b77);});}else{return!![];}})['then'](function(_0x594e83){var _0x20ee28=fs['readFileSync'](path['join'](config[_0xa6ac('0x72')],'server/files/chat/iframe.ejs'),_0xa6ac('0xcf'));var _0x3d4a90={'remote':_0x125c08[_0xa6ac('0x106')],'query':querystring[_0xa6ac('0x107')](_[_0xa6ac('0x4c')](_0x125c08['get']({'plain':!![]}),{'customerIp':_0x12315a['headers']['x-forwarded-for']||_0x12315a[_0xa6ac('0x88')][_0xa6ac('0x108')]||_0x12315a[_0xa6ac('0x109')][_0xa6ac('0x10a')]||_0x12315a['ip'],'referer':_0x12315a['headers'][_0xa6ac('0xab')],'openedInteractions':_0x24167c,'maxInteractions':_0xe485de,'virtual':_0x2742d9['virtual'],'online':_0x594e83,'custom':_0x2742d9}))[_0xa6ac('0x10b')](/'/g,'\x5c\x27')};_0x4f73d5[_0xa6ac('0x37')](ejs[_0xa6ac('0x10c')](Mustache[_0xa6ac('0x10c')](_0x20ee28,_0x3d4a90),{'proactiveActions':_0x5a693e,'alignment':_0x125c08[_0xa6ac('0x10d')],'verticalAlignment':_0x125c08[_0xa6ac('0x10e')],'div_color':_0x125c08[_0xa6ac('0xf2')],'text_color':_0x125c08['textColor'],'button_color':_0x125c08[_0xa6ac('0x10f')],'background_color':_0x125c08[_0xa6ac('0x110')]}));})[_0xa6ac('0x23')](handleError(_0x4f73d5,null));};exports[_0xa6ac('0x111')]=function(_0xbf5c2a,_0x5d49ad,_0x493d23){return db[_0xa6ac('0x3a')][_0xa6ac('0x61')]({'where':{'id':_0xbf5c2a[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x5d49ad,null))['then'](function(_0x1624f1){if(_0x1624f1){return db['sequelize'][_0xa6ac('0x112')](function(_0x55c0d2){return db[_0xa6ac('0x9c')][_0xa6ac('0x30')]({'where':{'ChatWebsiteId':_0xbf5c2a[_0xa6ac('0x5c')]['id']},'transaction':_0x55c0d2})[_0xa6ac('0x1a')](function(_0x499690){var _0x297135=_['map'](_0xbf5c2a[_0xa6ac('0x56')],function(_0x5c6064){_0x5c6064[_0xa6ac('0x5f')]=_0xbf5c2a['params']['id'];return _0x5c6064;});return db[_0xa6ac('0x9c')][_0xa6ac('0x113')](_0x297135,{'transaction':_0x55c0d2});});})[_0xa6ac('0x1a')](function(){return db[_0xa6ac('0x9c')][_0xa6ac('0x114')]({'where':{'ChatWebsiteId':_0xbf5c2a[_0xa6ac('0x5c')]['id']},'order':'priority'});});}})[_0xa6ac('0x1a')](respondWithResult(_0x5d49ad,null))[_0xa6ac('0x23')](handleError(_0x5d49ad,null));};exports[_0xa6ac('0x115')]=function(_0x11bca5,_0x237342,_0x5f3b3f){var _0x453e6f={};var _0x865954={};var _0x256dbc;var _0x4b424f;return db[_0xa6ac('0x3a')]['findOne']({'where':{'id':_0x11bca5[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x237342,null))['then'](function(_0x18f682){if(_0x18f682){_0x256dbc=_0x18f682;_0x865954[_0xa6ac('0x3f')]=_['keys'](db[_0xa6ac('0x9c')][_0xa6ac('0x3b')]);_0x865954[_0xa6ac('0x41')]=_[_0xa6ac('0x42')](_0x11bca5[_0xa6ac('0x41')]);_0x865954[_0xa6ac('0x43')]=_[_0xa6ac('0x44')](_0x865954['model'],_0x865954['query']);_0x453e6f[_0xa6ac('0x45')]=_['intersection'](_0x865954[_0xa6ac('0x3f')],qs[_0xa6ac('0x46')](_0x11bca5['query'][_0xa6ac('0x46')]));_0x453e6f[_0xa6ac('0x45')]=_0x453e6f[_0xa6ac('0x45')]['length']?_0x453e6f[_0xa6ac('0x45')]:_0x865954[_0xa6ac('0x3f')];_0x453e6f[_0xa6ac('0x49')]=qs[_0xa6ac('0x4a')](_0x11bca5[_0xa6ac('0x41')]['sort']);_0x453e6f[_0xa6ac('0x4b')]=qs[_0xa6ac('0x43')](_[_0xa6ac('0x62')](_0x11bca5[_0xa6ac('0x41')],_0x865954[_0xa6ac('0x43')]));if(_0x11bca5['query']['filter']){_0x453e6f[_0xa6ac('0x4b')]=_['merge'](_0x453e6f[_0xa6ac('0x4b')],{'$or':_[_0xa6ac('0x40')](_0x453e6f['attributes'],function(_0x111209){var _0xbed9ed={};_0xbed9ed[_0x111209]={'$like':'%'+_0x11bca5['query'][_0xa6ac('0x4e')]+'%'};return _0xbed9ed;})});}_0x453e6f=_[_0xa6ac('0x4c')]({},_0x453e6f,_0x11bca5[_0xa6ac('0x53')]);return _0x256dbc['getApplications'](_0x453e6f);}})[_0xa6ac('0x1a')](function(_0x3de23c){if(_0x3de23c){_0x4b424f=_0x3de23c[_0xa6ac('0x47')];if(!_0x11bca5[_0xa6ac('0x41')][_0xa6ac('0x67')](_0xa6ac('0x48'))){_0x453e6f[_0xa6ac('0x27')]=qs[_0xa6ac('0x27')](_0x11bca5[_0xa6ac('0x41')][_0xa6ac('0x27')]);_0x453e6f['offset']=qs[_0xa6ac('0x29')](_0x11bca5['query'][_0xa6ac('0x29')]);}return _0x256dbc[_0xa6ac('0x115')](_0x453e6f);}})[_0xa6ac('0x1a')](function(_0x4178c7){if(_0x4178c7){return _0x4178c7?{'count':_0x4b424f,'rows':_0x4178c7}:null;}})['then'](respondWithResult(_0x237342,null))['catch'](handleError(_0x237342,null));};exports[_0xa6ac('0x116')]=function(_0x89dac9,_0xb1ef50,_0x47e9cc){return db[_0xa6ac('0x117')][_0xa6ac('0x54')]({'where':{'id':_0x89dac9['params']['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0xb1ef50,null))[_0xa6ac('0x1a')](function(_0x3e7e0e){if(_0x3e7e0e){return _0x3e7e0e['addProactiveActions'](_0x89dac9[_0xa6ac('0x56')][_0xa6ac('0x69')],_['omit'](_0x89dac9[_0xa6ac('0x56')],[_0xa6ac('0x69'),'id'])||{});}})[_0xa6ac('0x1a')](respondWithResult(_0xb1ef50,null))[_0xa6ac('0x23')](handleError(_0xb1ef50,null));};exports[_0xa6ac('0x102')]=function(_0x375628,_0x6a4cc8,_0x4471b9){var _0x199ee3={};var _0x518f46={};var _0x584c6a;var _0x2fc6e2;return db['ChatWebsite']['findOne']({'where':{'id':_0x375628[_0xa6ac('0x5c')]['id']}})['then'](handleEntityNotFound(_0x6a4cc8,null))[_0xa6ac('0x1a')](function(_0x326af8){if(_0x326af8){_0x584c6a=_0x326af8;_0x518f46[_0xa6ac('0x3f')]=_[_0xa6ac('0x42')](db[_0xa6ac('0x118')]['rawAttributes']);_0x518f46[_0xa6ac('0x41')]=_[_0xa6ac('0x42')](_0x375628[_0xa6ac('0x41')]);_0x518f46[_0xa6ac('0x43')]=_[_0xa6ac('0x44')](_0x518f46[_0xa6ac('0x3f')],_0x518f46[_0xa6ac('0x41')]);_0x199ee3[_0xa6ac('0x45')]=_['intersection'](_0x518f46[_0xa6ac('0x3f')],qs[_0xa6ac('0x46')](_0x375628[_0xa6ac('0x41')][_0xa6ac('0x46')]));_0x199ee3['attributes']=_0x199ee3[_0xa6ac('0x45')][_0xa6ac('0x47')]?_0x199ee3[_0xa6ac('0x45')]:_0x518f46[_0xa6ac('0x3f')];_0x199ee3[_0xa6ac('0x49')]=qs['sort'](_0x375628[_0xa6ac('0x41')][_0xa6ac('0x4a')]);_0x199ee3['where']=qs[_0xa6ac('0x43')](_[_0xa6ac('0x62')](_0x375628[_0xa6ac('0x41')],_0x518f46[_0xa6ac('0x43')]));if(_0x375628['query'][_0xa6ac('0x4e')]){_0x199ee3[_0xa6ac('0x4b')]=_[_0xa6ac('0x4c')](_0x199ee3[_0xa6ac('0x4b')],{'$or':_[_0xa6ac('0x40')](_0x199ee3[_0xa6ac('0x45')],function(_0x5c0219){var _0x23a66b={};_0x23a66b[_0x5c0219]={'$like':'%'+_0x375628[_0xa6ac('0x41')]['filter']+'%'};return _0x23a66b;})});}_0x199ee3=_[_0xa6ac('0x4c')]({},_0x199ee3,_0x375628[_0xa6ac('0x53')]);return _0x584c6a[_0xa6ac('0x102')](_0x199ee3);}})[_0xa6ac('0x1a')](function(_0x1b420f){if(_0x1b420f){_0x2fc6e2=_0x1b420f[_0xa6ac('0x47')];if(!_0x375628[_0xa6ac('0x41')][_0xa6ac('0x67')](_0xa6ac('0x48'))){_0x199ee3['limit']=qs[_0xa6ac('0x27')](_0x375628['query']['limit']);_0x199ee3['offset']=qs[_0xa6ac('0x29')](_0x375628[_0xa6ac('0x41')][_0xa6ac('0x29')]);}return _0x584c6a[_0xa6ac('0x102')](_0x199ee3);}})[_0xa6ac('0x1a')](function(_0x5d29e5){if(_0x5d29e5){return _0x5d29e5?{'count':_0x2fc6e2,'rows':_0x5d29e5}:null;}})['then'](respondWithResult(_0x6a4cc8,null))[_0xa6ac('0x23')](handleError(_0x6a4cc8,null));};exports['getFields']=function(_0x132a6c,_0x256c69,_0x3d9367){var _0x532c34=_0x132a6c[_0xa6ac('0x41')][_0xa6ac('0x119')]==='false'?_0xa6ac('0x11a'):_0xa6ac('0x11b');return db['ChatWebsite'][_0xa6ac('0x54')]({'attributes':['id',_0x532c34],'where':{'id':_0x132a6c['params']['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x256c69,null))['then'](function(_0x1c8275){if(_0x1c8275){var _0x4eadd9=_0x1c8275[_0x532c34];var _0x3ac929=_0x4eadd9&&_0x4eadd9[_0xa6ac('0x11c')]?_0x4eadd9['items']:[];_0x256c69[_0xa6ac('0x37')]({'fromKey':_[_0xa6ac('0x7d')](_0x4eadd9[_0xa6ac('0x11d')])?undefined:_0x4eadd9[_0xa6ac('0x11d')],'count':_0x3ac929[_0xa6ac('0x47')],'rows':_0x3ac929});}})['catch'](handleError(_0x256c69,null));};exports[_0xa6ac('0x11e')]=function(_0x759f23,_0x56b0d9,_0x2381b4){var _0x2a3b3c={'raw':![],'where':{}};var _0x21a07c={};var _0x7da3d3={'count':0x0,'rows':[]};return db[_0xa6ac('0x3a')]['findOne']({'where':{'id':_0x759f23[_0xa6ac('0x5c')]['id']}})['then'](handleEntityNotFound(_0x56b0d9,null))[_0xa6ac('0x1a')](function(_0xc609e){if(_0xc609e){_0x21a07c[_0xa6ac('0x3f')]=_[_0xa6ac('0x42')](db[_0xa6ac('0x11f')][_0xa6ac('0x3b')]);_0x21a07c[_0xa6ac('0x41')]=_['keys'](_0x759f23[_0xa6ac('0x41')]);_0x21a07c[_0xa6ac('0x43')]=_[_0xa6ac('0x44')](_0x21a07c[_0xa6ac('0x3f')],_0x21a07c['query']);_0x2a3b3c[_0xa6ac('0x45')]=_[_0xa6ac('0x44')](_0x21a07c['model'],qs[_0xa6ac('0x46')](_0x759f23['query']['fields']));_0x2a3b3c['attributes']=_0x2a3b3c[_0xa6ac('0x45')]['length']?_0x2a3b3c[_0xa6ac('0x45')]:_0x21a07c['model'];if(!_0x759f23[_0xa6ac('0x41')][_0xa6ac('0x67')]('nolimit')){_0x2a3b3c[_0xa6ac('0x27')]=qs['limit'](_0x759f23['query']['limit']);_0x2a3b3c[_0xa6ac('0x29')]=qs[_0xa6ac('0x29')](_0x759f23['query'][_0xa6ac('0x29')]);}_0x2a3b3c[_0xa6ac('0x49')]=qs[_0xa6ac('0x4a')](_0x759f23['query'][_0xa6ac('0x4a')]);_0x2a3b3c[_0xa6ac('0x4b')]=qs['filters'](_['pick'](_0x759f23['query'],_0x21a07c[_0xa6ac('0x43')]));_0x2a3b3c[_0xa6ac('0x4b')][_0xa6ac('0x5f')]=_0xc609e['id'];if(_0x759f23[_0xa6ac('0x41')][_0xa6ac('0x4e')]){_0x2a3b3c[_0xa6ac('0x4b')]=_[_0xa6ac('0x4c')](_0x2a3b3c[_0xa6ac('0x4b')],{'$or':_['map'](_0x2a3b3c[_0xa6ac('0x45')],function(_0x4f29a1){var _0x53c2ba={};_0x53c2ba[_0x4f29a1]={'$like':'%'+_0x759f23[_0xa6ac('0x41')][_0xa6ac('0x4e')]+'%'};return _0x53c2ba;})});}_0x2a3b3c=_[_0xa6ac('0x4c')]({},_0x2a3b3c,_0x759f23[_0xa6ac('0x53')]);return db[_0xa6ac('0x11f')][_0xa6ac('0x28')]({'where':_0x2a3b3c[_0xa6ac('0x4b')]})[_0xa6ac('0x1a')](function(_0x4c1884){_0x7da3d3[_0xa6ac('0x28')]=_0x4c1884;if(_0x759f23[_0xa6ac('0x41')]['includeAll']){_0x2a3b3c['include']=[{'all':!![]}];}else{_0x2a3b3c['include']=[{'model':db[_0xa6ac('0x89')],'as':_0xa6ac('0x120'),'required':![]},{'model':db[_0xa6ac('0x121')],'as':_0xa6ac('0x122'),'required':![]}];}return db[_0xa6ac('0x11f')]['findAll'](_0x2a3b3c);})[_0xa6ac('0x1a')](function(_0xb20f14){_0x7da3d3[_0xa6ac('0x52')]=_0xb20f14;return _0x7da3d3;});}})[_0xa6ac('0x1a')](respondWithFilteredResult(_0x56b0d9,_0x2a3b3c))[_0xa6ac('0x23')](handleError(_0x56b0d9,null));};exports[_0xa6ac('0x123')]=function(_0x4a315b,_0x459964,_0x2385a4){return db['ChatWebsite'][_0xa6ac('0x54')]({'where':{'id':_0x4a315b[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x459964,null))['then'](function(_0x268c15){if(_0x268c15){return _0x268c15[_0xa6ac('0x123')](_0x4a315b['body']['ids'],_[_0xa6ac('0xed')](_0x4a315b['body'],[_0xa6ac('0x69'),'id'])||{})['spread'](function(_0x22dd87){for(var _0x39d366=0x0;_0x39d366<_0x4a315b[_0xa6ac('0x56')]['ids'][_0xa6ac('0x47')];_0x39d366+=0x1){socket[_0xa6ac('0x124')](_0xa6ac('0x125'),{'UserId':Number(_0x4a315b['body']['ids'][_0x39d366]),'ChatWebsiteId':Number(_0x4a315b[_0xa6ac('0x5c')]['id'])});}return _0x22dd87;});}})['then'](respondWithResult(_0x459964,null))['catch'](handleError(_0x459964,null));};exports[_0xa6ac('0x126')]=function(_0x1cbf50,_0x2bacdb,_0x26f557){return db[_0xa6ac('0x3a')][_0xa6ac('0x54')]({'where':{'id':_0x1cbf50[_0xa6ac('0x5c')]['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x2bacdb,null))[_0xa6ac('0x1a')](function(_0xbdecfc){if(_0xbdecfc){return _0xbdecfc[_0xa6ac('0x126')](_0x1cbf50['query']['ids'])[_0xa6ac('0x1a')](function(){if(_[_0xa6ac('0x127')](_0x1cbf50[_0xa6ac('0x41')][_0xa6ac('0x69')])){for(var _0x384341=0x0;_0x384341<_0x1cbf50['query']['ids'][_0xa6ac('0x47')];_0x384341+=0x1){socket[_0xa6ac('0x124')](_0xa6ac('0x128'),{'UserId':Number(_0x1cbf50[_0xa6ac('0x41')][_0xa6ac('0x69')][_0x384341]),'ChatWebsiteId':Number(_0x1cbf50['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x1cbf50[_0xa6ac('0x41')][_0xa6ac('0x69')]),'ChatWebsiteId':Number(_0x1cbf50['params']['id'])});}});}})[_0xa6ac('0x1a')](respondWithStatusCode(_0x2bacdb,null))[_0xa6ac('0x23')](handleError(_0x2bacdb,null));};exports['getAgents']=function(_0x326fcf,_0x3c99ca,_0x534873){var _0x4ea57e={};var _0x1fb3e4={};var _0x6c013e;var _0x537df3;return db[_0xa6ac('0x3a')][_0xa6ac('0x61')]({'where':{'id':_0x326fcf['params']['id']}})[_0xa6ac('0x1a')](handleEntityNotFound(_0x3c99ca,null))['then'](function(_0x3964d1){if(_0x3964d1){_0x6c013e=_0x3964d1;_0x1fb3e4[_0xa6ac('0x3f')]=_[_0xa6ac('0x42')](db['User']['rawAttributes']);_0x1fb3e4[_0xa6ac('0x41')]=_['keys'](_0x326fcf[_0xa6ac('0x41')]);_0x1fb3e4['filters']=_[_0xa6ac('0x44')](_0x1fb3e4[_0xa6ac('0x3f')],_0x1fb3e4[_0xa6ac('0x41')]);_0x4ea57e['attributes']=_[_0xa6ac('0x44')](_0x1fb3e4[_0xa6ac('0x3f')],qs[_0xa6ac('0x46')](_0x326fcf['query'][_0xa6ac('0x46')]));_0x4ea57e[_0xa6ac('0x45')]=_0x4ea57e[_0xa6ac('0x45')][_0xa6ac('0x47')]?_0x4ea57e[_0xa6ac('0x45')]:_0x1fb3e4['model'];_0x4ea57e[_0xa6ac('0x49')]=qs[_0xa6ac('0x4a')](_0x326fcf[_0xa6ac('0x41')][_0xa6ac('0x4a')]);_0x4ea57e[_0xa6ac('0x4b')]=qs[_0xa6ac('0x43')](_[_0xa6ac('0x62')](_0x326fcf[_0xa6ac('0x41')],_0x1fb3e4['filters']));if(_0x326fcf[_0xa6ac('0x41')]['filter']){_0x4ea57e[_0xa6ac('0x4b')]=_[_0xa6ac('0x4c')](_0x4ea57e[_0xa6ac('0x4b')],{'$or':_[_0xa6ac('0x40')](_0x4ea57e[_0xa6ac('0x45')],function(_0x5dd941){var _0x24c01e={};_0x24c01e[_0x5dd941]={'$like':'%'+_0x326fcf['query'][_0xa6ac('0x4e')]+'%'};return _0x24c01e;})});}_0x4ea57e=_[_0xa6ac('0x4c')]({},_0x4ea57e,_0x326fcf[_0xa6ac('0x53')]);return _0x6c013e[_0xa6ac('0x129')](_0x4ea57e);}})[_0xa6ac('0x1a')](function(_0xe1daba){if(_0xe1daba){_0x537df3=_0xe1daba['length'];if(!_0x326fcf['query'][_0xa6ac('0x67')](_0xa6ac('0x48'))){_0x4ea57e[_0xa6ac('0x27')]=qs['limit'](_0x326fcf['query'][_0xa6ac('0x27')]);_0x4ea57e[_0xa6ac('0x29')]=qs['offset'](_0x326fcf[_0xa6ac('0x41')][_0xa6ac('0x29')]);}return _0x6c013e[_0xa6ac('0x129')](_0x4ea57e);}})['then'](function(_0xda2294){if(_0xda2294){return _0xda2294?{'count':_0x537df3,'rows':_0xda2294}:null;}})[_0xa6ac('0x1a')](respondWithResult(_0x3c99ca,null))[_0xa6ac('0x23')](handleError(_0x3c99ca,null));}; \ No newline at end of file +var _0xd154=['addDisposition','ChatWebsiteId','getDispositions','Disposition','order','rows','removeDispositions','ids','CannedAnswer','findOne','pick','removeAnswers','addLogo','sitepic','file','filename','addAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','ChatApplication','account','applications','orderBy','asc','Applications','Contacts','defaults','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','browser','format','version','unknown','device','%s\x20%s\x20%s','vendor','threadId','externalUrl','ChatInteraction','interaction','spread','contact','lastName','messageId','autoclose','push','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','send','mapKeyOffline','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','subjectOffline','toPairsIn','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','internal','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','all','some','remote','x-real-ip','remoteAddress','replace','render','alignment','textColor','color_button','transaction','findAndCountAll','priority','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','user','userProfileId','autoAssociation','describe'];(function(_0x2a17b6,_0x1d6ebc){var _0x24828b=function(_0x2938d9){while(--_0x2938d9){_0x2a17b6['push'](_0x2a17b6['shift']());}};_0x24828b(++_0x1d6ebc);}(_0xd154,0xcc));var _0x4d15=function(_0x422a6b,_0x45f564){_0x422a6b=_0x422a6b-0x0;var _0x572927=_0xd154[_0x422a6b];return _0x572927;};'use strict';var emlformat=require(_0x4d15('0x0'));var rimraf=require(_0x4d15('0x1'));var zipdir=require(_0x4d15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d15('0x3'));var moment=require(_0x4d15('0x4'));var BPromise=require(_0x4d15('0x5'));var Mustache=require(_0x4d15('0x6'));var util=require(_0x4d15('0x7'));var path=require(_0x4d15('0x8'));var sox=require(_0x4d15('0x9'));var csv=require('to-csv');var ejs=require(_0x4d15('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d15('0xb'));var squel=require(_0x4d15('0xc'));var crypto=require(_0x4d15('0xd'));var jsforce=require(_0x4d15('0xe'));var deskjs=require(_0x4d15('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4d15('0x10'));var Papa=require('papaparse');var Redis=require(_0x4d15('0x11'));var authService=require(_0x4d15('0x12'));var qs=require(_0x4d15('0x13'));var as=require(_0x4d15('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4d15('0x15'));var utils=require(_0x4d15('0x16'));var config=require(_0x4d15('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d15('0x18'))['db'];config[_0x4d15('0x19')]=_['defaults'](config[_0x4d15('0x19')],{'host':_0x4d15('0x1a'),'port':0x18eb});var socket=require(_0x4d15('0x1b'))(new Redis(config[_0x4d15('0x19')]));require('./chatWebsite.socket')[_0x4d15('0x1c')](socket);var jayson=require(_0x4d15('0x1d'));var client=jayson[_0x4d15('0x1e')][_0x4d15('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x4d15('0x1f')]({'port':0x232a});var client9003=jayson['client'][_0x4d15('0x1f')]({'port':0x232b});var client9001=jayson['client'][_0x4d15('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x2553f4,_0xa471a6,_0x33102c,_0x3049eb){return new BPromise(function(_0xa8efc9,_0x2d6c39){var _0x5ff87d=_0x3049eb||client;return _0x5ff87d[_0x4d15('0x20')](_0x2553f4,_0x33102c)[_0x4d15('0x21')](function(_0x175c4c){logger[_0x4d15('0x22')](_0x4d15('0x23'),_0xa471a6,_0x4d15('0x24'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xa471a6,_0x4d15('0x24'),JSON[_0x4d15('0x25')](_0x175c4c));if(_0x175c4c[_0x4d15('0x26')]){if(_0x175c4c['error']['code']===0x1f4){logger[_0x4d15('0x26')]('ChatWebsite,\x20%s,\x20%s',_0xa471a6,_0x175c4c[_0x4d15('0x26')]['message']);return _0x2d6c39(_0x175c4c[_0x4d15('0x26')][_0x4d15('0x27')]);}logger[_0x4d15('0x26')](_0x4d15('0x23'),_0xa471a6,_0x175c4c[_0x4d15('0x26')][_0x4d15('0x27')]);return _0xa8efc9(_0x175c4c[_0x4d15('0x26')][_0x4d15('0x27')]);}else{logger[_0x4d15('0x22')](_0x4d15('0x23'),_0xa471a6,_0x4d15('0x24'));_0xa8efc9(_0x175c4c['result'][_0x4d15('0x27')]);}})['catch'](function(_0x362630){logger['error'](_0x4d15('0x23'),_0xa471a6,_0x362630);_0x2d6c39(_0x362630);});});}function respondWithStatusCode(_0x56a422,_0x2f0fd4){_0x2f0fd4=_0x2f0fd4||0xcc;return function(_0x45f5a0){if(_0x45f5a0){return _0x56a422[_0x4d15('0x28')](_0x2f0fd4);}return _0x56a422[_0x4d15('0x29')](_0x2f0fd4)[_0x4d15('0x2a')]();};}function respondWithResult(_0x21b2ed,_0x34bc72){_0x34bc72=_0x34bc72||0xc8;return function(_0x5effea){if(_0x5effea){return _0x21b2ed[_0x4d15('0x29')](_0x34bc72)[_0x4d15('0x2b')](_0x5effea);}};}function respondWithFilteredResult(_0x2fefb8,_0x4d7845){return function(_0x50ea88){if(_0x50ea88){var _0x4c5f1d=typeof _0x4d7845[_0x4d15('0x2c')]==='undefined'&&typeof _0x4d7845[_0x4d15('0x2d')]==='undefined';var _0x452bb8=_0x50ea88['count'];var _0x15402b=_0x4c5f1d?0x0:_0x4d7845[_0x4d15('0x2c')];var _0x3d7984=_0x4c5f1d?_0x50ea88[_0x4d15('0x2e')]:_0x4d7845['offset']+_0x4d7845[_0x4d15('0x2d')];var _0xf6b52e;if(_0x3d7984>=_0x452bb8){_0x3d7984=_0x452bb8;_0xf6b52e=0xc8;}else{_0xf6b52e=0xce;}_0x2fefb8[_0x4d15('0x29')](_0xf6b52e);return _0x2fefb8[_0x4d15('0x2f')](_0x4d15('0x30'),_0x15402b+'-'+_0x3d7984+'/'+_0x452bb8)[_0x4d15('0x2b')](_0x50ea88);}return null;};}function patchUpdates(_0x239eb7){return function(_0x5c9944){try{jsonpatch[_0x4d15('0x31')](_0x5c9944,_0x239eb7,!![]);}catch(_0x10a93d){return BPromise[_0x4d15('0x32')](_0x10a93d);}return _0x5c9944['save']();};}function saveUpdates(_0x1053b7,_0x4ba5f0){return function(_0x43ef67){if(_0x43ef67){return _0x43ef67[_0x4d15('0x33')](_0x1053b7)['then'](function(_0x28bce2){return _0x28bce2;});}return null;};}function removeEntity(_0x4ee5d8,_0x4f45da){return function(_0x472e89){if(_0x472e89){return _0x472e89[_0x4d15('0x34')]()['then'](function(){var _0x33eb99=_0x472e89[_0x4d15('0x35')]({'plain':!![]});var _0x2f77cc=_0x4d15('0x36');return db[_0x4d15('0x37')]['destroy']({'where':{'type':_0x2f77cc,'resourceId':_0x33eb99['id']}})[_0x4d15('0x21')](function(){return _0x472e89;});})[_0x4d15('0x21')](function(){_0x4ee5d8[_0x4d15('0x29')](0xcc)[_0x4d15('0x2a')]();});}};}function handleEntityNotFound(_0xae8475,_0xd7afee){return function(_0x2ced50){if(!_0x2ced50){_0xae8475[_0x4d15('0x28')](0x194);}return _0x2ced50;};}function handleError(_0x50a7f1,_0x361c8b){_0x361c8b=_0x361c8b||0x1f4;return function(_0x534985){logger[_0x4d15('0x26')](_0x534985[_0x4d15('0x38')]);if(_0x534985[_0x4d15('0x39')]){delete _0x534985[_0x4d15('0x39')];}_0x50a7f1[_0x4d15('0x29')](_0x361c8b)['send'](_0x534985);};}exports[_0x4d15('0x3a')]=function(_0xf2105c,_0x77ad3e){var _0x50d622={'include':[{'model':db[_0x4d15('0x3b')],'as':_0x4d15('0x3c')}]},_0x1e4cdc={},_0x325df8={'count':0x0,'rows':[]};var _0x165d00=_[_0x4d15('0x3d')](db[_0x4d15('0x3e')][_0x4d15('0x3f')],function(_0x1a5b3a){return{'name':_0x1a5b3a['fieldName'],'type':_0x1a5b3a[_0x4d15('0x40')][_0x4d15('0x41')]};});_0x1e4cdc['model']=_['map'](_0x165d00,'name');_0x1e4cdc[_0x4d15('0x42')]=_[_0x4d15('0x43')](_0xf2105c['query']);_0x1e4cdc['filters']=_[_0x4d15('0x44')](_0x1e4cdc[_0x4d15('0x45')],_0x1e4cdc['query']);_0x50d622[_0x4d15('0x46')]=_[_0x4d15('0x44')](_0x1e4cdc['model'],qs[_0x4d15('0x47')](_0xf2105c['query']['fields']));_0x50d622[_0x4d15('0x46')]=_0x50d622[_0x4d15('0x46')][_0x4d15('0x48')]?_0x50d622[_0x4d15('0x46')]:_0x1e4cdc['model'];if(!_0xf2105c[_0x4d15('0x42')][_0x4d15('0x49')](_0x4d15('0x4a'))){_0x50d622[_0x4d15('0x2d')]=qs['limit'](_0xf2105c['query']['limit']);_0x50d622[_0x4d15('0x2c')]=qs[_0x4d15('0x2c')](_0xf2105c[_0x4d15('0x42')][_0x4d15('0x2c')]);}_0x50d622['order']=qs[_0x4d15('0x4b')](_0xf2105c[_0x4d15('0x42')][_0x4d15('0x4b')]);_0x50d622[_0x4d15('0x4c')]=qs[_0x4d15('0x4d')](_['pick'](_0xf2105c['query'],_0x1e4cdc[_0x4d15('0x4d')]),_0x165d00);if(_0xf2105c[_0x4d15('0x42')]['filter']){_0x50d622[_0x4d15('0x4c')]=_[_0x4d15('0x4e')](_0x50d622[_0x4d15('0x4c')],{'$or':_[_0x4d15('0x3d')](_0x165d00,function(_0x7da9b2){if(_0x7da9b2[_0x4d15('0x40')]!==_0x4d15('0x4f')){var _0x1f3107={};_0x1f3107[_0x7da9b2[_0x4d15('0x39')]]={'$like':'%'+_0xf2105c['query'][_0x4d15('0x50')]+'%'};return _0x1f3107;}})});}_0x50d622=_[_0x4d15('0x4e')]({},_0x50d622,_0xf2105c[_0x4d15('0x51')]);var _0x518c16={'where':_0x50d622[_0x4d15('0x4c')]};return db[_0x4d15('0x3e')][_0x4d15('0x2e')](_0x518c16)['then'](function(_0x223db0){_0x325df8['count']=_0x223db0;if(_0xf2105c[_0x4d15('0x42')]['includeAll']){_0x50d622[_0x4d15('0x52')]=[{'all':!![]}];}return db[_0x4d15('0x3e')][_0x4d15('0x53')](_0x50d622);})[_0x4d15('0x21')](function(_0x41f5f4){_0x325df8['rows']=_0x41f5f4;return _0x325df8;})[_0x4d15('0x21')](respondWithFilteredResult(_0x77ad3e,_0x50d622))[_0x4d15('0x54')](handleError(_0x77ad3e,null));};exports[_0x4d15('0x55')]=function(_0x17efcd,_0x10592a){var _0x23d1e0={'raw':![],'where':{'id':_0x17efcd[_0x4d15('0x56')]['id']},'include':[{'model':db[_0x4d15('0x3b')],'as':_0x4d15('0x3c')}]},_0xfa4b91={};_0xfa4b91[_0x4d15('0x45')]=_[_0x4d15('0x43')](db[_0x4d15('0x3e')][_0x4d15('0x3f')]);_0xfa4b91[_0x4d15('0x42')]=_[_0x4d15('0x43')](_0x17efcd[_0x4d15('0x42')]);_0xfa4b91['filters']=_['intersection'](_0xfa4b91['model'],_0xfa4b91[_0x4d15('0x42')]);_0x23d1e0[_0x4d15('0x46')]=_[_0x4d15('0x44')](_0xfa4b91['model'],qs[_0x4d15('0x47')](_0x17efcd[_0x4d15('0x42')]['fields']));_0x23d1e0[_0x4d15('0x46')]=_0x23d1e0[_0x4d15('0x46')][_0x4d15('0x48')]?_0x23d1e0[_0x4d15('0x46')]:_0xfa4b91[_0x4d15('0x45')];if(_0x17efcd[_0x4d15('0x42')][_0x4d15('0x57')]){_0x23d1e0[_0x4d15('0x52')]=[{'all':!![]}];}_0x23d1e0=_[_0x4d15('0x4e')]({},_0x23d1e0,_0x17efcd[_0x4d15('0x51')]);return db[_0x4d15('0x3e')][_0x4d15('0x58')](_0x23d1e0)[_0x4d15('0x21')](handleEntityNotFound(_0x10592a,null))['then'](respondWithResult(_0x10592a,null))[_0x4d15('0x54')](handleError(_0x10592a,null));};exports[_0x4d15('0x59')]=function(_0x3a0f74,_0x195ebd){return db[_0x4d15('0x3e')][_0x4d15('0x59')](_0x3a0f74[_0x4d15('0x5a')],{})['then'](function(_0x3ba667){var _0x965b4a=_0x3a0f74[_0x4d15('0x5b')][_0x4d15('0x35')]({'plain':!![]});if(!_0x965b4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x965b4a['role']===_0x4d15('0x5b')){var _0x4ae05c=_0x3ba667['get']({'plain':!![]});var _0x357eca=_0x4d15('0x36');return db['UserProfileSection'][_0x4d15('0x58')]({'where':{'name':_0x357eca,'userProfileId':_0x965b4a[_0x4d15('0x5c')]},'raw':!![]})[_0x4d15('0x21')](function(_0x29a052){if(_0x29a052&&_0x29a052[_0x4d15('0x5d')]===0x0){return db['UserProfileResource'][_0x4d15('0x59')]({'name':_0x4ae05c[_0x4d15('0x39')],'resourceId':_0x4ae05c['id'],'type':_0x29a052[_0x4d15('0x39')],'sectionId':_0x29a052['id']},{})[_0x4d15('0x21')](function(){return _0x3ba667;});}else{return _0x3ba667;}})[_0x4d15('0x54')](function(_0x23cf2a){logger[_0x4d15('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23cf2a);throw _0x23cf2a;});}return _0x3ba667;})[_0x4d15('0x21')](respondWithResult(_0x195ebd,0xc9))['catch'](handleError(_0x195ebd,null));};exports[_0x4d15('0x33')]=function(_0x18439b,_0x24bada){if(_0x18439b[_0x4d15('0x5a')]['id']){delete _0x18439b[_0x4d15('0x5a')]['id'];}return db[_0x4d15('0x3e')]['find']({'where':{'id':_0x18439b[_0x4d15('0x56')]['id']},'include':[{'model':db[_0x4d15('0x3b')],'as':_0x4d15('0x3c')}]})[_0x4d15('0x21')](handleEntityNotFound(_0x24bada,null))['then'](saveUpdates(_0x18439b['body'],null))['then'](respondWithResult(_0x24bada,null))[_0x4d15('0x54')](handleError(_0x24bada,null));};exports[_0x4d15('0x34')]=function(_0xd54f04,_0x3dc05a){return db[_0x4d15('0x3e')][_0x4d15('0x58')]({'where':{'id':_0xd54f04['params']['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x3dc05a,null))[_0x4d15('0x21')](removeEntity(_0x3dc05a,null))[_0x4d15('0x54')](handleError(_0x3dc05a,null));};exports[_0x4d15('0x5e')]=function(_0x3f65e1,_0x265dc6){return db[_0x4d15('0x3e')]['describe']()[_0x4d15('0x21')](respondWithResult(_0x265dc6,null))[_0x4d15('0x54')](handleError(_0x265dc6,null));};exports[_0x4d15('0x5f')]=function(_0x2ca708,_0x17cb93,_0x25d301){if(_0x2ca708[_0x4d15('0x5a')]['id']){delete _0x2ca708[_0x4d15('0x5a')]['id'];}return db[_0x4d15('0x3e')]['find']({'where':{'id':_0x2ca708['params']['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x17cb93,null))[_0x4d15('0x21')](function(_0x5330cf){if(_0x5330cf){_0x2ca708['body'][_0x4d15('0x60')]=_0x5330cf['id'];return db['Disposition']['create'](_0x2ca708[_0x4d15('0x5a')]);}})[_0x4d15('0x21')](respondWithResult(_0x17cb93,null))[_0x4d15('0x54')](handleError(_0x17cb93,null));};exports[_0x4d15('0x61')]=function(_0x4e58af,_0x28b751,_0xd8b0a9){var _0x429392={'raw':![],'where':{}};var _0x57e7e5={};var _0x2ae890={'count':0x0,'rows':[]};return db[_0x4d15('0x3e')]['findOne']({'where':{'id':_0x4e58af[_0x4d15('0x56')]['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x28b751,null))[_0x4d15('0x21')](function(_0x43be01){if(_0x43be01){_0x57e7e5['model']=_[_0x4d15('0x43')](db[_0x4d15('0x62')][_0x4d15('0x3f')]);_0x57e7e5[_0x4d15('0x42')]=_[_0x4d15('0x43')](_0x4e58af['query']);_0x57e7e5['filters']=_[_0x4d15('0x44')](_0x57e7e5[_0x4d15('0x45')],_0x57e7e5[_0x4d15('0x42')]);_0x429392[_0x4d15('0x46')]=_[_0x4d15('0x44')](_0x57e7e5[_0x4d15('0x45')],qs['fields'](_0x4e58af[_0x4d15('0x42')][_0x4d15('0x47')]));_0x429392[_0x4d15('0x46')]=_0x429392['attributes']['length']?_0x429392[_0x4d15('0x46')]:_0x57e7e5[_0x4d15('0x45')];if(!_0x4e58af[_0x4d15('0x42')][_0x4d15('0x49')](_0x4d15('0x4a'))){_0x429392[_0x4d15('0x2d')]=qs[_0x4d15('0x2d')](_0x4e58af['query'][_0x4d15('0x2d')]);_0x429392[_0x4d15('0x2c')]=qs[_0x4d15('0x2c')](_0x4e58af[_0x4d15('0x42')][_0x4d15('0x2c')]);}_0x429392[_0x4d15('0x63')]=qs[_0x4d15('0x4b')](_0x4e58af[_0x4d15('0x42')]['sort']);_0x429392[_0x4d15('0x4c')]=qs['filters'](_['pick'](_0x4e58af[_0x4d15('0x42')],_0x57e7e5['filters']));_0x429392[_0x4d15('0x4c')]['ChatWebsiteId']=_0x43be01['id'];if(_0x4e58af[_0x4d15('0x42')][_0x4d15('0x50')]){_0x429392[_0x4d15('0x4c')]=_['merge'](_0x429392[_0x4d15('0x4c')],{'$or':_[_0x4d15('0x3d')](_0x429392[_0x4d15('0x46')],function(_0x2d9ded){var _0x5af70d={};_0x5af70d[_0x2d9ded]={'$like':'%'+_0x4e58af['query'][_0x4d15('0x50')]+'%'};return _0x5af70d;})});}_0x429392=_[_0x4d15('0x4e')]({},_0x429392,_0x4e58af[_0x4d15('0x51')]);return db[_0x4d15('0x62')]['count']({'where':_0x429392[_0x4d15('0x4c')]})[_0x4d15('0x21')](function(_0x5c6744){_0x2ae890['count']=_0x5c6744;if(_0x4e58af[_0x4d15('0x42')][_0x4d15('0x57')]){_0x429392[_0x4d15('0x52')]=[{'all':!![]}];}return db['Disposition'][_0x4d15('0x53')](_0x429392);})[_0x4d15('0x21')](function(_0x4380cd){_0x2ae890[_0x4d15('0x64')]=_0x4380cd;return _0x2ae890;});}})['then'](respondWithFilteredResult(_0x28b751,_0x429392))[_0x4d15('0x54')](handleError(_0x28b751,null));};exports[_0x4d15('0x65')]=function(_0x332fbe,_0x55dd39,_0x6c59b6){return db[_0x4d15('0x3e')][_0x4d15('0x58')]({'where':{'id':_0x332fbe['params']['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x55dd39,null))[_0x4d15('0x21')](function(_0x493506){if(_0x493506){return _0x493506[_0x4d15('0x65')](_0x332fbe[_0x4d15('0x42')][_0x4d15('0x66')]);}})[_0x4d15('0x21')](respondWithStatusCode(_0x55dd39,null))['catch'](handleError(_0x55dd39,null));};exports['addAnswer']=function(_0x31eb0b,_0x4245b5,_0x364f01){if(_0x31eb0b[_0x4d15('0x5a')]['id']){delete _0x31eb0b[_0x4d15('0x5a')]['id'];}return db['ChatWebsite'][_0x4d15('0x58')]({'where':{'id':_0x31eb0b['params']['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x4245b5,null))[_0x4d15('0x21')](function(_0x12bdea){if(_0x12bdea){_0x31eb0b[_0x4d15('0x5a')][_0x4d15('0x60')]=_0x12bdea['id'];return db[_0x4d15('0x67')][_0x4d15('0x59')](_0x31eb0b[_0x4d15('0x5a')]);}})[_0x4d15('0x21')](respondWithResult(_0x4245b5,null))[_0x4d15('0x54')](handleError(_0x4245b5,null));};exports['getAnswers']=function(_0x29b6c8,_0xd48af3,_0x43d2fd){var _0x132591={'raw':![],'where':{}};var _0x3c7d81={};var _0x3b8a9b={'count':0x0,'rows':[]};return db[_0x4d15('0x3e')][_0x4d15('0x68')]({'where':{'id':_0x29b6c8[_0x4d15('0x56')]['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0xd48af3,null))[_0x4d15('0x21')](function(_0x738cb5){if(_0x738cb5){_0x3c7d81['model']=_['keys'](db[_0x4d15('0x67')][_0x4d15('0x3f')]);_0x3c7d81[_0x4d15('0x42')]=_[_0x4d15('0x43')](_0x29b6c8[_0x4d15('0x42')]);_0x3c7d81[_0x4d15('0x4d')]=_[_0x4d15('0x44')](_0x3c7d81[_0x4d15('0x45')],_0x3c7d81[_0x4d15('0x42')]);_0x132591[_0x4d15('0x46')]=_[_0x4d15('0x44')](_0x3c7d81[_0x4d15('0x45')],qs['fields'](_0x29b6c8[_0x4d15('0x42')]['fields']));_0x132591['attributes']=_0x132591['attributes'][_0x4d15('0x48')]?_0x132591['attributes']:_0x3c7d81[_0x4d15('0x45')];if(!_0x29b6c8['query'][_0x4d15('0x49')](_0x4d15('0x4a'))){_0x132591[_0x4d15('0x2d')]=qs[_0x4d15('0x2d')](_0x29b6c8[_0x4d15('0x42')][_0x4d15('0x2d')]);_0x132591[_0x4d15('0x2c')]=qs['offset'](_0x29b6c8[_0x4d15('0x42')]['offset']);}_0x132591[_0x4d15('0x63')]=qs[_0x4d15('0x4b')](_0x29b6c8[_0x4d15('0x42')][_0x4d15('0x4b')]);_0x132591[_0x4d15('0x4c')]=qs[_0x4d15('0x4d')](_[_0x4d15('0x69')](_0x29b6c8['query'],_0x3c7d81[_0x4d15('0x4d')]));_0x132591[_0x4d15('0x4c')][_0x4d15('0x60')]=_0x738cb5['id'];if(_0x29b6c8[_0x4d15('0x42')][_0x4d15('0x50')]){_0x132591[_0x4d15('0x4c')]=_['merge'](_0x132591[_0x4d15('0x4c')],{'$or':_['map'](_0x132591['attributes'],function(_0x2fc518){var _0x408f45={};_0x408f45[_0x2fc518]={'$like':'%'+_0x29b6c8['query'][_0x4d15('0x50')]+'%'};return _0x408f45;})});}_0x132591=_[_0x4d15('0x4e')]({},_0x132591,_0x29b6c8[_0x4d15('0x51')]);return db['CannedAnswer'][_0x4d15('0x2e')]({'where':_0x132591[_0x4d15('0x4c')]})[_0x4d15('0x21')](function(_0x4260c3){_0x3b8a9b[_0x4d15('0x2e')]=_0x4260c3;if(_0x29b6c8[_0x4d15('0x42')][_0x4d15('0x57')]){_0x132591['include']=[{'all':!![]}];}return db[_0x4d15('0x67')][_0x4d15('0x53')](_0x132591);})[_0x4d15('0x21')](function(_0x2ab0eb){_0x3b8a9b['rows']=_0x2ab0eb;return _0x3b8a9b;});}})[_0x4d15('0x21')](respondWithFilteredResult(_0xd48af3,_0x132591))[_0x4d15('0x54')](handleError(_0xd48af3,null));};exports[_0x4d15('0x6a')]=function(_0x168209,_0x54cca1,_0x20fe4d){return db[_0x4d15('0x3e')][_0x4d15('0x58')]({'where':{'id':_0x168209[_0x4d15('0x56')]['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x54cca1,null))[_0x4d15('0x21')](function(_0x223651){if(_0x223651){return _0x223651[_0x4d15('0x6a')](_0x168209[_0x4d15('0x42')][_0x4d15('0x66')]);}})[_0x4d15('0x21')](respondWithStatusCode(_0x54cca1,null))[_0x4d15('0x54')](handleError(_0x54cca1,null));};exports[_0x4d15('0x6b')]=function(_0x2361b7,_0xeae15c,_0x5c0e1c){_0x2361b7[_0x4d15('0x5a')][_0x4d15('0x6c')]=_0x2361b7[_0x4d15('0x6d')][_0x4d15('0x6e')];return db[_0x4d15('0x3e')][_0x4d15('0x58')]({'where':{'id':_0x2361b7['params']['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0xeae15c,null))['then'](saveUpdates(_0x2361b7['body'],null))[_0x4d15('0x21')](respondWithResult(_0xeae15c,null))[_0x4d15('0x54')](handleError(_0xeae15c,null));};exports[_0x4d15('0x6f')]=function(_0x581574,_0x33c3a0,_0x4f72c6){_0x581574[_0x4d15('0x5a')]['agentAvatar']=_0x581574[_0x4d15('0x6d')]['filename'];return db[_0x4d15('0x3e')]['find']({'where':{'id':_0x581574[_0x4d15('0x56')]['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x33c3a0,null))[_0x4d15('0x21')](saveUpdates(_0x581574[_0x4d15('0x5a')],null))['then'](respondWithResult(_0x33c3a0,null))[_0x4d15('0x54')](handleError(_0x33c3a0,null));};exports['addCustomerAvatar']=function(_0x48eaf5,_0x556ba5,_0x165403){_0x48eaf5[_0x4d15('0x5a')][_0x4d15('0x70')]=_0x48eaf5[_0x4d15('0x6d')][_0x4d15('0x6e')];return db[_0x4d15('0x3e')][_0x4d15('0x58')]({'where':{'id':_0x48eaf5['params']['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x556ba5,null))['then'](saveUpdates(_0x48eaf5['body'],null))['then'](respondWithResult(_0x556ba5,null))[_0x4d15('0x54')](handleError(_0x556ba5,null));};exports[_0x4d15('0x71')]=function(_0xd0311e,_0x790560,_0x44f777){_0xd0311e['body']['systemAvatar']=_0xd0311e[_0x4d15('0x6d')][_0x4d15('0x6e')];return db[_0x4d15('0x3e')]['find']({'where':{'id':_0xd0311e['params']['id']}})['then'](handleEntityNotFound(_0x790560,null))['then'](saveUpdates(_0xd0311e[_0x4d15('0x5a')],null))[_0x4d15('0x21')](respondWithResult(_0x790560,null))[_0x4d15('0x54')](handleError(_0x790560,null));};exports[_0x4d15('0x72')]=function(_0x383fb9,_0x3f5da9,_0xe80917){var _0x2116cc=path[_0x4d15('0x73')](config[_0x4d15('0x74')],'server/files/images/logos/default_logo.svg');var _0x2420d7={'where':{'id':_0x383fb9['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x101af0=![];return require(_0x4d15('0x75'))['getLicense']()[_0x4d15('0x21')](function(_0x51436b){if(_0x51436b){_0x101af0=_0x51436b[_0x4d15('0x76')];}})[_0x4d15('0x21')](function(){return db['ChatWebsite'][_0x4d15('0x58')](_0x2420d7);})[_0x4d15('0x21')](handleEntityNotFound(_0x3f5da9,null))[_0x4d15('0x21')](function(_0x102637){if(_0x102637){if(!_[_0x4d15('0x77')](_0x102637[_0x4d15('0x6c')])){if(fs[_0x4d15('0x78')](path[_0x4d15('0x73')](config[_0x4d15('0x74')],'server/files/images/logos/',_0x102637[_0x4d15('0x6c')]))&&_0x101af0){_0x2116cc=path[_0x4d15('0x73')](config['root'],_0x4d15('0x79'),_0x102637[_0x4d15('0x6c')]);}}return _0x3f5da9[_0x4d15('0x7a')](_0x2116cc);}})[_0x4d15('0x54')](handleError(_0x3f5da9,null));};exports[_0x4d15('0x7b')]=function(_0xadfe97,_0x18e0a6,_0x2c1913){var _0x246042=path[_0x4d15('0x73')](config[_0x4d15('0x74')],_0x4d15('0x7c'));var _0x3a75ed={'where':{'id':_0xadfe97[_0x4d15('0x56')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x4d15('0x3e')][_0x4d15('0x58')](_0x3a75ed)[_0x4d15('0x21')](handleEntityNotFound(_0x18e0a6,null))[_0x4d15('0x21')](function(_0x2eea2f){if(_0x2eea2f){if(!_[_0x4d15('0x77')](_0x2eea2f[_0x4d15('0x7d')])){if(fs[_0x4d15('0x78')](path[_0x4d15('0x73')](config[_0x4d15('0x74')],_0x4d15('0x7e'),_0x2eea2f[_0x4d15('0x7d')]))){_0x246042=path[_0x4d15('0x73')](config[_0x4d15('0x74')],_0x4d15('0x7e'),_0x2eea2f[_0x4d15('0x7d')]);}}return _0x18e0a6[_0x4d15('0x7a')](_0x246042);}})['catch'](handleError(_0x18e0a6,null));};exports[_0x4d15('0x7f')]=function(_0x11ec19,_0x2f32ad,_0x5a565e){var _0x2fe74b=path[_0x4d15('0x73')](config[_0x4d15('0x74')],_0x4d15('0x80'));var _0x3d180e={'where':{'id':_0x11ec19[_0x4d15('0x56')]['id']},'attributes':['id',_0x4d15('0x70'),_0x4d15('0x81')],'raw':!![]};return db[_0x4d15('0x3e')][_0x4d15('0x58')](_0x3d180e)[_0x4d15('0x21')](handleEntityNotFound(_0x2f32ad,null))[_0x4d15('0x21')](function(_0x22c866){if(_0x22c866){if(!_[_0x4d15('0x77')](_0x22c866['customerAvatar'])){if(fs[_0x4d15('0x78')](path[_0x4d15('0x73')](config[_0x4d15('0x74')],_0x4d15('0x7e'),_0x22c866[_0x4d15('0x70')]))&&_0x22c866[_0x4d15('0x81')]){_0x2fe74b=path[_0x4d15('0x73')](config['root'],'server/files/images/avatars/',_0x22c866[_0x4d15('0x70')]);}}return _0x2f32ad[_0x4d15('0x7a')](_0x2fe74b);}})[_0x4d15('0x54')](handleError(_0x2f32ad,null));};exports['getSystemAvatar']=function(_0x425882,_0x27cafc,_0x1ca59f){var _0x47a5e5=path[_0x4d15('0x73')](config[_0x4d15('0x74')],_0x4d15('0x82'));var _0x3565ee={'where':{'id':_0x425882['params']['id']},'attributes':['id',_0x4d15('0x83')],'raw':!![]};return db[_0x4d15('0x3e')][_0x4d15('0x58')](_0x3565ee)[_0x4d15('0x21')](handleEntityNotFound(_0x27cafc,null))['then'](function(_0x1efb5a){if(_0x1efb5a){if(!_[_0x4d15('0x77')](_0x1efb5a[_0x4d15('0x83')])){if(fs[_0x4d15('0x78')](path[_0x4d15('0x73')](config[_0x4d15('0x74')],_0x4d15('0x7e'),_0x1efb5a['systemAvatar']))){_0x47a5e5=path[_0x4d15('0x73')](config[_0x4d15('0x74')],_0x4d15('0x7e'),_0x1efb5a[_0x4d15('0x83')]);}}return _0x27cafc[_0x4d15('0x7a')](_0x47a5e5);}})[_0x4d15('0x54')](handleError(_0x27cafc,null));};exports[_0x4d15('0x84')]=function(_0x48e360,_0x3f095a,_0x56d4fd){var _0x50dd85=require(_0x4d15('0x85'));var _0x15a36f=new _0x50dd85();var _0x452f22=_0x15a36f[_0x4d15('0x86')](_0x48e360[_0x4d15('0x87')][_0x4d15('0x88')])[_0x4d15('0x89')]();var _0x1e2525={'body':_0x48e360[_0x4d15('0x5a')],'channel':_0x4d15('0x8a')};var _0x58b9dd=[];var _0x5f0b66=[];var _0x457b31={};var _0x582475=![];return db[_0x4d15('0x8b')][_0x4d15('0x5e')]()[_0x4d15('0x21')](function(_0x1ae55b){if(!_0x1ae55b){throw new db[(_0x4d15('0x8c'))][(_0x4d15('0x8d'))](_0x4d15('0x8e'));}_0x58b9dd=_[_0x4d15('0x8f')](_['keys'](_0x1ae55b),[_0x4d15('0x90'),_0x4d15('0x91')]);_0x5f0b66=_['difference'](_[_0x4d15('0x43')](_0x1ae55b),[_0x4d15('0x90'),_0x4d15('0x91'),_0x4d15('0x92'),_0x4d15('0x93')]);if(_0x48e360[_0x4d15('0x5a')]['id']){delete _0x48e360['body']['id'];}if(_['isNil'](_0x48e360[_0x4d15('0x5a')][_0x4d15('0x94')])){throw new db[(_0x4d15('0x8c'))][(_0x4d15('0x8d'))](_0x4d15('0x95'));}if(_[_0x4d15('0x77')](_0x48e360[_0x4d15('0x5a')][_0x4d15('0x5a')])||_0x48e360[_0x4d15('0x5a')]['body']===''){throw new db[(_0x4d15('0x8c'))]['ValidationError'](_0x4d15('0x96'));}if(_[_0x4d15('0x77')](_0x48e360[_0x4d15('0x5a')][_0x4d15('0x97')])){throw new db[(_0x4d15('0x8c'))][(_0x4d15('0x8d'))](_0x4d15('0x98')+_0x5f0b66);}if(!_[_0x4d15('0x99')](_0x5f0b66,_0x48e360['body'][_0x4d15('0x97')])){throw new db[(_0x4d15('0x8c'))][(_0x4d15('0x8d'))](_0x4d15('0x9a')+_0x5f0b66);}_0x457b31[_0x48e360[_0x4d15('0x5a')]['mapKey']]=_0x48e360[_0x4d15('0x5a')][_0x4d15('0x94')];})[_0x4d15('0x21')](function(){return db['ChatWebsite'][_0x4d15('0x58')]({'where':{'id':_0x48e360['params']['id']},'include':[{'model':db['CmList'],'as':_0x4d15('0x9b'),'include':[{'model':db[_0x4d15('0x8b')],'as':'Contacts','where':_0x457b31,'limit':0x1,'order':[[_0x4d15('0x91'),_0x4d15('0x9c')]]}]},{'model':db[_0x4d15('0x9d')],'as':'Applications'}]});})[_0x4d15('0x21')](handleEntityNotFound(_0x3f095a,null))['then'](function(_0x4d0457){if(_0x4d0457&&_0x4d0457[_0x4d15('0x9b')]){_0x1e2525[_0x4d15('0x9e')]=_0x4d0457;_0x1e2525[_0x4d15('0x9f')]=_0x4d0457['Applications'];_0x1e2525['list']=_0x4d0457['List'];_0x1e2525['applications']=_[_0x4d15('0xa0')](_0x1e2525[_0x4d15('0x9f')],['priority'],[_0x4d15('0xa1')]);if(_0x1e2525[_0x4d15('0x9e')][_0x4d15('0xa2')]){delete _0x1e2525[_0x4d15('0x9e')]['Applications'];}if(_0x1e2525[_0x4d15('0x9e')]['List']&&_0x1e2525[_0x4d15('0x9e')][_0x4d15('0x9b')][_0x4d15('0xa3')]['length']){return _0x1e2525[_0x4d15('0x9e')][_0x4d15('0x9b')][_0x4d15('0xa3')][0x0];}var _0x313f44=_[_0x4d15('0xa4')](_0x48e360[_0x4d15('0x5a')],{'firstName':_0x48e360[_0x4d15('0x5a')][_0x4d15('0x94')],'ListId':_0x4d0457['ListId']});_0x313f44[_0x48e360[_0x4d15('0x5a')][_0x4d15('0x97')]]=_0x48e360[_0x4d15('0x5a')][_0x4d15('0x94')];return db[_0x4d15('0x8b')][_0x4d15('0x59')](_0x313f44,{'fields':_0x58b9dd,'raw':!![]});}})[_0x4d15('0x21')](handleEntityNotFound(_0x3f095a,null))[_0x4d15('0x21')](function(_0x28751a){_0x1e2525['contact']=_0x28751a;var _0x1e76e4=_0x48e360[_0x4d15('0x5a')]['customerIp'];if(_0x48e360['headers'][_0x4d15('0xa5')]){_0x1e76e4=_0x48e360['headers'][_0x4d15('0xa5')];}else if(_0x48e360[_0x4d15('0x87')][_0x4d15('0xa6')]){_0x1e76e4=_['first'](_0x48e360[_0x4d15('0x87')][_0x4d15('0xa6')][_0x4d15('0xa7')](','));}if(_0x28751a){var _0x115e47={'ContactId':_0x28751a['id'],'ChatWebsiteId':_0x48e360[_0x4d15('0x56')]['id'],'from':(_0x28751a[_0x4d15('0xa8')]||'')+'\x20'+(_0x28751a['lastName']||''),'customerIp':_0x1e76e4,'customerPort':_0x48e360[_0x4d15('0x87')][_0x4d15('0xa9')]?_0x48e360[_0x4d15('0x87')][_0x4d15('0xa9')]:null,'referer':_0x48e360[_0x4d15('0x5a')]['referer'],'browserName':_0x452f22[_0x4d15('0xaa')]['name']&&_0x452f22['browser']['version']?util[_0x4d15('0xab')]('%s\x20%s',_0x452f22[_0x4d15('0xaa')][_0x4d15('0x39')],_0x452f22['browser'][_0x4d15('0xac')]):_0x4d15('0xad'),'browserVersion':_0x452f22['browser'][_0x4d15('0xac')]||_0x4d15('0xad'),'osName':util['format']('%s\x20%s',_0x452f22['os']['name'],_0x452f22['os'][_0x4d15('0xac')]),'osVersion':_0x452f22['os'][_0x4d15('0xac')],'deviceModel':_0x452f22[_0x4d15('0xae')][_0x4d15('0x45')]&&_0x452f22[_0x4d15('0xae')]['vendor']?util[_0x4d15('0xab')](_0x4d15('0xaf'),_0x452f22[_0x4d15('0xae')][_0x4d15('0x45')],_0x452f22[_0x4d15('0xae')][_0x4d15('0xb0')],_0x452f22[_0x4d15('0xae')]['type']):null,'deviceVendor':_0x452f22[_0x4d15('0xae')][_0x4d15('0xb0')],'deviceType':_0x452f22['device'][_0x4d15('0x40')],'formData':JSON[_0x4d15('0x25')](_0x48e360[_0x4d15('0x5a')])};var _0x113e36={'ChatWebsiteId':_0x48e360['params']['id'],'closed':![]};if(_0x48e360[_0x4d15('0x5a')][_0x4d15('0xb1')]){_0x113e36[_0x4d15('0xb1')]=_0x48e360[_0x4d15('0x5a')][_0x4d15('0xb1')];return db['ChatInteraction'][_0x4d15('0x58')]({'where':_0x113e36})['then'](function(_0x48e29f){if(_0x48e29f){return[_0x48e29f,![]];}_0x115e47[_0x4d15('0xb1')]=_0x48e360[_0x4d15('0x5a')]['threadId'];_0x115e47['externalUrl']=_0x48e360[_0x4d15('0x5a')][_0x4d15('0xb2')];return db[_0x4d15('0xb3')][_0x4d15('0x59')](_0x115e47)[_0x4d15('0x21')](function(_0x456ec2){return[_0x456ec2,!![]];});});}_0x113e36['ContactId']=_0x28751a['id'];if(_0x48e360[_0x4d15('0x5a')]['interaction']&&_0x48e360[_0x4d15('0x5a')][_0x4d15('0xb4')]['id']){_0x113e36['id']=_0x48e360[_0x4d15('0x5a')][_0x4d15('0xb4')]['id'];return db['ChatInteraction'][_0x4d15('0x58')]({'where':_0x113e36})[_0x4d15('0x21')](function(_0x295994){if(_0x295994){return[_0x295994,![]];}return db[_0x4d15('0xb3')]['create'](_0x115e47)['then'](function(_0x7c21d5){return[_0x7c21d5,!![]];});});}return db[_0x4d15('0xb3')][_0x4d15('0x59')](_0x115e47)[_0x4d15('0x21')](function(_0x4ac53c){return[_0x4ac53c,!![]];});}})[_0x4d15('0xb5')](function(_0x197378,_0x17fc62){if(_0x197378){_0x582475=_0x17fc62;if(!_0x17fc62){var _0x215ea3={'from':(_0x1e2525[_0x4d15('0xb6')][_0x4d15('0xa8')]||'')+'\x20'+(_0x1e2525[_0x4d15('0xb6')][_0x4d15('0xb7')]||'')};if(_0x48e360[_0x4d15('0x5a')][_0x4d15('0xb1')]&&_0x48e360[_0x4d15('0x5a')][_0x4d15('0xb8')]&&_0x48e360[_0x4d15('0x5a')]['threadId']!=_0x48e360[_0x4d15('0x5a')][_0x4d15('0xb8')]){_0x215ea3['threadId']=_0x48e360[_0x4d15('0x5a')][_0x4d15('0xb8')];}return _0x197378[_0x4d15('0x33')](_0x215ea3);}else{return _0x197378;}}})[_0x4d15('0x21')](function(_0x1cfde1){_0x1e2525[_0x4d15('0xb4')]=_0x1cfde1[_0x4d15('0x35')]({'plain':!![]});_0x1e2525[_0x4d15('0xb4')]['created']=_0x582475;if(_0x1e2525[_0x4d15('0xb4')]['created']){if(_0x1e2525[_0x4d15('0x9e')][_0x4d15('0xb9')]){_0x1e2525[_0x4d15('0x9f')][_0x4d15('0xba')]({'id':0x0,'priority':_0x1e2525['applications'][_0x4d15('0x48')]+0x1,'app':_0x4d15('0xbb'),'appdata':_0x4d15('0xbc'),'interval':_0x4d15('0xbd')});}}return db['ChatMessage']['create']({'body':_0x48e360[_0x4d15('0x5a')]['body'],'ChatWebsiteId':_0x48e360['params']['id'],'ChatInteractionId':_0x1cfde1['id'],'direction':'in','ContactId':_0x1e2525['contact']['id'],'AttachmentId':_0x48e360[_0x4d15('0x5a')]['AttachmentId']});})[_0x4d15('0x21')](function(_0x577673){_0x1e2525[_0x4d15('0x27')]=_0x577673;if(_0x1e2525['interaction'][_0x4d15('0xbe')]){return db[_0x4d15('0xbf')][_0x4d15('0x58')]({'attributes':['id','name'],'where':{'id':_0x1e2525['interaction']['UserId']}})['then'](function(_0x359701){if(_0x359701){_0x1e2525[_0x4d15('0x9f')][_0x4d15('0xc0')]({'id':0x0,'priority':0x0,'app':_0x4d15('0xc1'),'appdata':_0x359701[_0x4d15('0x39')]+','+(_0x1e2525['account'][_0x4d15('0xc2')]||0xa),'interval':'*,*,*,*'});_0x1e2525[_0x4d15('0xc3')]=!![];}return respondWithRpcPromise(_0x4d15('0xc4'),_0x4d15('0xc5'),_0x1e2525);});}return respondWithRpcPromise(_0x4d15('0xc4'),'startRouting',_0x1e2525);})[_0x4d15('0x21')](function(_0x5e2f88){respondWithRpcPromise(_0x4d15('0xc6'),_0x4d15('0xc6'),{'event':'notify','message':_0x5e2f88},client9002);return _0x5e2f88;})[_0x4d15('0x21')](respondWithResult(_0x3f095a,null))[_0x4d15('0x54')](handleError(_0x3f095a,null));};exports['offline']=function(_0x20343e,_0x375211,_0xb462fd){var _0x4032fd,_0x7e0839,_0x11a332;var _0x55368e=[];var _0x4182c9=[];var _0x58f5b4={};var _0x304ab7=_0x20343e[_0x4d15('0xc7')]||[];var _0x14b8db=[];var _0x4f23ba;return db[_0x4d15('0x8b')][_0x4d15('0x5e')]()['then'](function(_0x228b24){if(!_0x228b24){throw new db[(_0x4d15('0x8c'))][(_0x4d15('0x8d'))](_0x4d15('0x8e'));}_0x4182c9=_['difference'](_[_0x4d15('0x43')](_0x228b24),[_0x4d15('0x90'),_0x4d15('0x91')]);_0x55368e=_[_0x4d15('0x8f')](_[_0x4d15('0x43')](_0x228b24),['createdAt',_0x4d15('0x91'),'CompanyId',_0x4d15('0x93')]);if(_0x20343e['body']['id']){delete _0x20343e['body']['id'];}if(_[_0x4d15('0x77')](_0x20343e['body'][_0x4d15('0x94')])){throw _0x375211['status'](0x1f4)[_0x4d15('0xc8')](new db[(_0x4d15('0x8c'))][(_0x4d15('0x8d'))](_0x4d15('0x95')));}if(_['isNil'](_0x20343e['body']['body'])||_0x20343e['body']['body']===''){throw _0x375211[_0x4d15('0x29')](0x1f4)[_0x4d15('0xc8')](new db[(_0x4d15('0x8c'))][(_0x4d15('0x8d'))](_0x4d15('0x96')));}if(_['isNil'](_0x20343e[_0x4d15('0x5a')]['mapKeyOffline'])){throw _0x375211[_0x4d15('0x29')](0x1f4)[_0x4d15('0xc8')](new db[(_0x4d15('0x8c'))][(_0x4d15('0x8d'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55368e));}if(!_[_0x4d15('0x99')](_0x55368e,_0x20343e[_0x4d15('0x5a')][_0x4d15('0xc9')])){throw _0x375211[_0x4d15('0x29')](0x1f4)['send'](new db[(_0x4d15('0x8c'))][(_0x4d15('0x8d'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55368e));}_0x58f5b4[_0x20343e[_0x4d15('0x5a')][_0x4d15('0xc9')]]=_0x20343e[_0x4d15('0x5a')][_0x4d15('0x94')];})[_0x4d15('0x21')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x20343e['params']['id']},'include':[{'model':db[_0x4d15('0xca')],'as':_0x4d15('0x9b')},{'model':db[_0x4d15('0xcb')],'as':_0x4d15('0xcb')}]});})['then'](handleEntityNotFound(_0x375211,null))[_0x4d15('0x21')](function(_0x4917bb){if(_0x4917bb&&_0x4917bb[_0x4d15('0x9b')]){_0x7e0839=_0x4917bb;var _0x431c50=_[_0x4d15('0xa4')](_0x20343e[_0x4d15('0x5a')],{'firstName':_0x20343e['body'][_0x4d15('0x94')],'phone':_0x20343e[_0x4d15('0x5a')]['from'],'ListId':_0x4917bb[_0x4d15('0x93')]});_0x431c50[_0x20343e[_0x4d15('0x5a')]['mapKeyOffline']]=_0x20343e[_0x4d15('0x5a')][_0x4d15('0x94')];return db['CmContact'][_0x4d15('0xcc')]({'where':_0x58f5b4,'defaults':_0x431c50});}})[_0x4d15('0xb5')](function(_0x22f39d){if(_0x22f39d){_0x11a332=_0x22f39d;var _0x445a32=fs[_0x4d15('0xcd')](path['join'](config[_0x4d15('0x74')],_0x4d15('0xce')),_0x4d15('0xcf'));var _0x32ba5a=ejs['render'](_0x445a32,{'body':_[_0x4d15('0xd0')](_0x20343e[_0x4d15('0x5a')][_0x4d15('0x5a')]),'bodyTitle':_0x7e0839[_0x4d15('0xd1')]});return db[_0x4d15('0xd2')][_0x4d15('0x59')]({'body':_0x32ba5a,'ContactId':_0x22f39d['id'],'ChatWebsiteId':_0x7e0839['id']});}})['then'](function(_0x44b764){_0x4f23ba=_0x44b764;if(_0x304ab7[_0x4d15('0x48')]){var _0x3cd5d9=_0x304ab7[_0x4d15('0x3d')](function(_0x2c1806){return{'name':_0x2c1806[_0x4d15('0xd3')],'basename':_0x2c1806['filename'],'type':_0x2c1806[_0x4d15('0xd4')],'ChatOfflineMessageId':_0x44b764['id']};});_0x14b8db=_0x3cd5d9[_0x4d15('0x3d')](_0x994a09=>{var _0x41385a={'filename':_0x994a09[_0x4d15('0x39')],'path':path[_0x4d15('0x73')](config['root'],_0x4d15('0xd5'),_0x4d15('0xc7'),_0x4d15('0xd6'),_0x4d15('0xd7'),_0x994a09[_0x4d15('0xd8')])};return _0x41385a;});if(!_0x7e0839[_0x4d15('0xd9')]){return db[_0x4d15('0xda')]['transaction'](function(_0x57a79e){return db[_0x4d15('0xdb')][_0x4d15('0xdc')](_0x3cd5d9,{'transaction':_0x57a79e});});}}})[_0x4d15('0x21')](function(){if(_0x4f23ba){_0x4032fd=_0x4f23ba;return db[_0x4d15('0xcb')][_0x4d15('0x68')]({'where':{'active':!![]},'include':[{'model':db[_0x4d15('0xdd')],'as':_0x4d15('0xde'),'raw':!![]}]});}})[_0x4d15('0x21')](function(_0xa95871){if(_0xa95871&&_0xa95871[_0x4d15('0xde')]&&_0x7e0839[_0x4d15('0xdf')]&&_0x7e0839[_0x4d15('0xe0')]){var _0x478c5c={'tls':{'rejectUnauthorized':![]}};if(_0xa95871['Smtp'][_0x4d15('0xe1')]){_0x478c5c[_0x4d15('0xe1')]=_0xa95871[_0x4d15('0xde')][_0x4d15('0xe1')];}else{_0x478c5c[_0x4d15('0xe2')]=_0xa95871[_0x4d15('0xde')][_0x4d15('0xe2')];_0x478c5c[_0x4d15('0xe3')]=_0xa95871['Smtp'][_0x4d15('0xe3')];_0x478c5c[_0x4d15('0xe4')]=_0xa95871[_0x4d15('0xde')][_0x4d15('0xe4')];}if(_0xa95871[_0x4d15('0xde')]['authentication']){_0x478c5c[_0x4d15('0xe5')]={'user':_0xa95871[_0x4d15('0xde')][_0x4d15('0x5b')],'pass':_0xa95871[_0x4d15('0xde')]['pass']};}return respondWithRpcPromise(_0x4d15('0xe6'),_0x4d15('0xe7'),{'account':_0x478c5c,'message':{'from':util[_0x4d15('0xab')](_0x4d15('0xe8'),_0xa95871['name'],_0xa95871[_0x4d15('0xe9')]||_0xa95871[_0x4d15('0xde')][_0x4d15('0x5b')]),'to':_0x7e0839[_0x4d15('0xe0')],'subject':_0x7e0839['offlineMessageSubject'],'html':_0x4032fd['body'],'attachments':_0x14b8db}},client9003)[_0x4d15('0x21')](function(){return _0x4032fd;})['catch'](function(_0x27f634){console[_0x4d15('0x26')](_0x27f634);});}})[_0x4d15('0x21')](function(){if(_0x7e0839&&_0x7e0839[_0x4d15('0xd9')]&&_0x7e0839['MailAccountId']){var _0x1bb801=[];if(_0x304ab7['length']){_0x1bb801=_0x304ab7[_0x4d15('0x3d')](function(_0x5839d2){return{'name':_0x5839d2[_0x4d15('0xd3')],'basename':_0x5839d2[_0x4d15('0x6e')],'type':_0x5839d2['mimetype'],'ChatOfflineMessageId':_0x4f23ba['id']};});}var _0x5e97e6;if(!_['isNil'](_0x7e0839[_0x4d15('0xea')])){var _0x563276=_['map'](_0x20343e[_0x4d15('0x5a')],function(_0x47801d){return _0x47801d;});var _0x5333e2=_[_0x4d15('0xeb')](_0x563276)[0x0];var _0x530b34=_['mapValues'](_0x5333e2,function(_0x198d69){return _0x198d69;});_0x5e97e6=_0x530b34[0x1][_0x7e0839[_0x4d15('0xea')]];}var _0xe47e33={'from':_0x11a332[_0x4d15('0xe9')],'firstName':_0x11a332[_0x4d15('0xa8')],'lastName':_0x11a332[_0x4d15('0xb7')],'mapKey':'email','message':{'from':_0x11a332[_0x4d15('0xe9')],'to':_0x7e0839['MailAccount']['email'],'cc':'','subject':_[_0x4d15('0x77')](_0x5e97e6)?_0x7e0839[_0x4d15('0xec')]:_0x5e97e6,'messageId':'','sentAt':new Date(),'attach':_0x1bb801[_0x4d15('0x48')],'attachments':_0x1bb801,'originChannel':_0x4d15('0xed'),'ChatWebsiteId':_0x7e0839['id'],'ChatOfflineMessageId':_0x4032fd['id'],'originTo':_0x7e0839[_0x4d15('0xcb')][_0x4d15('0xe9')]},'body':_0x4032fd['body']};var _0x11c03c={'account':{'id':_0x7e0839[_0x4d15('0xee')]},'body':_0xe47e33,'log':_0x4d15('0xef')};return respondWithRpcPromise(_0x4d15('0xef'),_0x4d15('0xf0'),_0x11c03c,client9001)[_0x4d15('0x21')](function(){return _0x4032fd;})[_0x4d15('0x54')](function(_0x158379){console['error'](_0x158379);});}return;})[_0x4d15('0x21')](function(){if(_0x4032fd){return _0x4032fd;}})[_0x4d15('0x21')](respondWithResult(_0x375211,null))[_0x4d15('0x54')](function(_0x3bee56){console[_0x4d15('0x26')]('catch',_0x3bee56);for(var _0x383253 of _0x304ab7){var _0x22572e=path[_0x4d15('0x73')](config[_0x4d15('0x74')],_0x4d15('0xd5'),_0x4d15('0xc7'),_0x4d15('0xd6'),'offline-chat',_0x383253[_0x4d15('0x6e')]);fs_extra[_0x4d15('0xf1')](_0x22572e)[_0x4d15('0x54')](function(_0x1b5272){console[_0x4d15('0x26')](_0x4d15('0xf2'),_0x22572e,_0x1b5272);});}});};exports[_0x4d15('0xf3')]=function(_0x45f792,_0x2867f7,_0x4bdc8c){return db[_0x4d15('0xb3')][_0x4d15('0x58')]({'where':{'id':_0x45f792[_0x4d15('0x56')]['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x2867f7,null))['then'](function(_0x59cd3){if(_0x59cd3){return _0x59cd3['addInteraction'](_0x45f792[_0x4d15('0x5a')][_0x4d15('0x66')],_[_0x4d15('0xf4')](_0x45f792[_0x4d15('0x5a')],[_0x4d15('0x66'),'id'])||{});}})[_0x4d15('0x21')](respondWithResult(_0x2867f7,null))[_0x4d15('0x54')](handleError(_0x2867f7,null));};exports[_0x4d15('0xf5')]=function(_0x826d64,_0x28595c,_0x5cd900){var _0x2057c4={'raw':![],'where':{}};var _0x5ac67={};var _0x522779={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4d15('0x68')]({'where':{'id':_0x826d64['params']['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x28595c,null))['then'](function(_0x2bb5e7){if(_0x2bb5e7){_0x5ac67['model']=_[_0x4d15('0x43')](db[_0x4d15('0xb3')][_0x4d15('0x3f')]);_0x5ac67[_0x4d15('0x42')]=_[_0x4d15('0x43')](_0x826d64[_0x4d15('0x42')]);_0x5ac67[_0x4d15('0x4d')]=_[_0x4d15('0x44')](_0x5ac67[_0x4d15('0x45')],_0x5ac67[_0x4d15('0x42')]);_0x2057c4['attributes']=_[_0x4d15('0x44')](_0x5ac67[_0x4d15('0x45')],qs[_0x4d15('0x47')](_0x826d64[_0x4d15('0x42')][_0x4d15('0x47')]));_0x2057c4[_0x4d15('0x46')]=_0x2057c4[_0x4d15('0x46')][_0x4d15('0x48')]?_0x2057c4[_0x4d15('0x46')]:_0x5ac67[_0x4d15('0x45')];if(!_0x826d64[_0x4d15('0x42')][_0x4d15('0x49')](_0x4d15('0x4a'))){_0x2057c4[_0x4d15('0x2d')]=qs[_0x4d15('0x2d')](_0x826d64[_0x4d15('0x42')]['limit']);_0x2057c4[_0x4d15('0x2c')]=qs['offset'](_0x826d64['query'][_0x4d15('0x2c')]);}_0x2057c4[_0x4d15('0x63')]=qs[_0x4d15('0x4b')](_0x826d64['query'][_0x4d15('0x4b')]);_0x2057c4[_0x4d15('0x4c')]=qs[_0x4d15('0x4d')](_['pick'](_0x826d64[_0x4d15('0x42')],_0x5ac67[_0x4d15('0x4d')]));_0x2057c4[_0x4d15('0x4c')][_0x4d15('0x60')]=_0x2bb5e7['id'];if(_0x826d64['query'][_0x4d15('0x50')]){_0x2057c4[_0x4d15('0x4c')]=_[_0x4d15('0x4e')](_0x2057c4['where'],{'$or':_[_0x4d15('0x3d')](_0x2057c4[_0x4d15('0x46')],function(_0x6f64bd){var _0xe04d15={};_0xe04d15[_0x6f64bd]={'$like':'%'+_0x826d64[_0x4d15('0x42')][_0x4d15('0x50')]+'%'};return _0xe04d15;})});}_0x2057c4=_['merge']({},_0x2057c4,_0x826d64[_0x4d15('0x51')]);return db[_0x4d15('0xb3')]['count']({'where':_0x2057c4['where']})[_0x4d15('0x21')](function(_0x42a818){_0x522779[_0x4d15('0x2e')]=_0x42a818;if(_0x826d64[_0x4d15('0x42')][_0x4d15('0x57')]){_0x2057c4[_0x4d15('0x52')]=[{'model':db[_0x4d15('0x8b')],'as':_0x4d15('0xf6'),'required':![]},{'model':db[_0x4d15('0xbf')],'as':'Owner','attributes':[_0x4d15('0x39'),'fullname',_0x4d15('0xf7')],'required':![]},{'model':db['Tag'],'as':_0x4d15('0xf8'),'attributes':['id','name',_0x4d15('0xf9')],'where':_0x826d64[_0x4d15('0x42')][_0x4d15('0xfa')]?{'id':_0x826d64['query'][_0x4d15('0xfa')]}:undefined,'required':_0x826d64['query'][_0x4d15('0xfa')]?!![]:![]}];}return db[_0x4d15('0xb3')][_0x4d15('0x53')](_0x2057c4);})[_0x4d15('0x21')](function(_0x3af1d4){_0x522779[_0x4d15('0x64')]=_0x3af1d4;return _0x522779;});}})[_0x4d15('0x21')](respondWithFilteredResult(_0x28595c,_0x2057c4))['catch'](handleError(_0x28595c,null));};function iftimePromise(_0x276843,_0xc31d5b){return respondWithRpcPromise(_0x4d15('0xfb'),_0x4d15('0xfc'),{'command':_0xc31d5b[_0x4d15('0xfd')]?util[_0x4d15('0xab')]('iftime\x20%s,%s',_0x276843[_0x4d15('0xfe')],_0xc31d5b[_0x4d15('0xfd')]):util[_0x4d15('0xab')](_0x4d15('0xff'),_0x276843['interval'])},client9002)[_0x4d15('0x21')](function(_0x39b4bb){var _0x2de7a8=_0x39b4bb&&_0x39b4bb['indexOf'](_0x4d15('0x100'))>=0x0?!![]:![];logger[_0x4d15('0x22')](_0x4d15('0x101'),_0xc31d5b['id'],_0x276843['id'],_0x276843['interval'],_0x2de7a8?'ONLINE':_0x4d15('0x102'),_0xc31d5b['timezone']?_0xc31d5b['timezone']:_0x4d15('0x103'));return _0x2de7a8;})[_0x4d15('0x54')](function(_0x15abae){logger[_0x4d15('0x26')](_0x4d15('0x101'),_0xc31d5b['id'],_0x276843['id'],_0x276843[_0x4d15('0xfe')],util[_0x4d15('0x104')](_0x15abae,{'showHidden':![],'depth':null}),_0xc31d5b[_0x4d15('0xfd')]?_0xc31d5b[_0x4d15('0xfd')]:_0x4d15('0x103'));return![];});}exports['getSnippet']=function(_0x55813c,_0x38da1c,_0x223145){var _0x2fbcc2=0x0;var _0x337416=0x0;var _0x5c73c8=![];var _0x5e8c1c;var _0x3e7985;return db['ChatWebsite'][_0x4d15('0x58')]({'where':{'id':_0x55813c['params']['id']},'include':[{'model':db[_0x4d15('0x105')],'as':_0x4d15('0x105'),'include':[{'model':db[_0x4d15('0x105')],'as':_0x4d15('0x106'),'attributes':['id',_0x4d15('0xfe')],'raw':!![]}]}]})[_0x4d15('0x21')](handleEntityNotFound(_0x38da1c,null))['then'](function(_0x2d0737){if(_0x2d0737){_0x5e8c1c=_0x2d0737;return _0x2d0737[_0x4d15('0x107')]({'raw':!![]});}})[_0x4d15('0x21')](function(_0x119672){if(_0x5e8c1c){if(_0x119672){_0x3e7985=_0x119672;}}return require(_0x4d15('0x75'))[_0x4d15('0x108')]();})['then'](function(_0x200a89){if(_0x200a89){_0x337416=_0x200a89[_0x4d15('0x109')];_0x5c73c8=_0x200a89[_0x4d15('0x76')];}})[_0x4d15('0x21')](function(){return db[_0x4d15('0xb3')][_0x4d15('0x2e')]({'where':{'closed':![]}});})[_0x4d15('0x21')](function(_0x58006f){_0x2fbcc2=_0x58006f;if(_0x337416&&_0x58006f>_0x337416){return db[_0x4d15('0x10a')]['findOne']({'where':{'id':0x1}})[_0x4d15('0x21')](function(_0x1f8027){if(_0x1f8027){_0x1f8027[_0x4d15('0x10b')](_0x4d15('0x10c'));}});}})['then'](function(){if(_0x5e8c1c[_0x4d15('0x105')]&&_0x5e8c1c[_0x4d15('0x105')][_0x4d15('0x106')]){var _0x32311f=[];for(var _0x304e8b=0x0;_0x304e8b<_0x5e8c1c[_0x4d15('0x105')]['Intervals'][_0x4d15('0x48')];_0x304e8b++){var _0x179fc2=_0x5e8c1c[_0x4d15('0x105')][_0x4d15('0x106')][_0x304e8b]['get']({'plain':!![]});_0x32311f[_0x4d15('0xba')](iftimePromise(_0x179fc2,_0x5e8c1c));}return BPromise[_0x4d15('0x10d')](_0x32311f)[_0x4d15('0x21')](function(_0x169780){return _[_0x4d15('0x10e')](_0x169780);});}else{return!![];}})[_0x4d15('0x21')](function(_0x590ef3){var _0x5a03b2=fs['readFileSync'](path[_0x4d15('0x73')](config['root'],'server/files/chat/iframe.ejs'),_0x4d15('0xcf'));var _0x2e1ce3={'remote':_0x5e8c1c[_0x4d15('0x10f')],'query':querystring[_0x4d15('0x25')](_[_0x4d15('0x4e')](_0x5e8c1c[_0x4d15('0x35')]({'plain':!![]}),{'customerIp':_0x55813c[_0x4d15('0x87')][_0x4d15('0xa6')]||_0x55813c[_0x4d15('0x87')][_0x4d15('0x110')]||_0x55813c['connection'][_0x4d15('0x111')]||_0x55813c['ip'],'referer':_0x55813c['headers']['referer'],'openedInteractions':_0x2fbcc2,'maxInteractions':_0x337416,'virtual':_0x5c73c8[_0x4d15('0x109')],'online':_0x590ef3,'custom':_0x5c73c8}))[_0x4d15('0x112')](/'/g,'\x5c\x27')};_0x38da1c['send'](ejs[_0x4d15('0x113')](Mustache[_0x4d15('0x113')](_0x5a03b2,_0x2e1ce3),{'proactiveActions':_0x3e7985,'alignment':_0x5e8c1c[_0x4d15('0x114')],'verticalAlignment':_0x5e8c1c['verticalAlignment'],'div_color':_0x5e8c1c[_0x4d15('0xf9')],'text_color':_0x5e8c1c[_0x4d15('0x115')],'button_color':_0x5e8c1c[_0x4d15('0x116')],'background_color':_0x5e8c1c['backgroundColor']}));})[_0x4d15('0x54')](handleError(_0x38da1c,null));};exports['addApplications']=function(_0x1b9996,_0x165a13,_0x1a97d6){return db[_0x4d15('0x3e')]['findOne']({'where':{'id':_0x1b9996[_0x4d15('0x56')]['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x165a13,null))[_0x4d15('0x21')](function(_0x4e58aa){if(_0x4e58aa){return db[_0x4d15('0xda')][_0x4d15('0x117')](function(_0x36667a){return db[_0x4d15('0x9d')][_0x4d15('0x34')]({'where':{'ChatWebsiteId':_0x1b9996[_0x4d15('0x56')]['id']},'transaction':_0x36667a})[_0x4d15('0x21')](function(_0x5a20e6){var _0x27d44c=_[_0x4d15('0x3d')](_0x1b9996[_0x4d15('0x5a')],function(_0x3c8c03){_0x3c8c03['ChatWebsiteId']=_0x1b9996[_0x4d15('0x56')]['id'];return _0x3c8c03;});return db[_0x4d15('0x9d')]['bulkCreate'](_0x27d44c,{'transaction':_0x36667a});});})[_0x4d15('0x21')](function(){return db['ChatApplication'][_0x4d15('0x118')]({'where':{'ChatWebsiteId':_0x1b9996['params']['id']},'order':_0x4d15('0x119')});});}})[_0x4d15('0x21')](respondWithResult(_0x165a13,null))[_0x4d15('0x54')](handleError(_0x165a13,null));};exports[_0x4d15('0x11a')]=function(_0x1d2964,_0x5ee06e,_0x6380c0){var _0x4c7c0c={};var _0x838750={};var _0x36187c;var _0x59eaf;return db[_0x4d15('0x3e')]['findOne']({'where':{'id':_0x1d2964[_0x4d15('0x56')]['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x5ee06e,null))['then'](function(_0x378a79){if(_0x378a79){_0x36187c=_0x378a79;_0x838750[_0x4d15('0x45')]=_[_0x4d15('0x43')](db[_0x4d15('0x9d')][_0x4d15('0x3f')]);_0x838750[_0x4d15('0x42')]=_[_0x4d15('0x43')](_0x1d2964[_0x4d15('0x42')]);_0x838750[_0x4d15('0x4d')]=_['intersection'](_0x838750[_0x4d15('0x45')],_0x838750[_0x4d15('0x42')]);_0x4c7c0c[_0x4d15('0x46')]=_[_0x4d15('0x44')](_0x838750[_0x4d15('0x45')],qs[_0x4d15('0x47')](_0x1d2964['query'][_0x4d15('0x47')]));_0x4c7c0c[_0x4d15('0x46')]=_0x4c7c0c[_0x4d15('0x46')][_0x4d15('0x48')]?_0x4c7c0c['attributes']:_0x838750[_0x4d15('0x45')];_0x4c7c0c[_0x4d15('0x63')]=qs[_0x4d15('0x4b')](_0x1d2964[_0x4d15('0x42')]['sort']);_0x4c7c0c['where']=qs[_0x4d15('0x4d')](_[_0x4d15('0x69')](_0x1d2964['query'],_0x838750['filters']));if(_0x1d2964[_0x4d15('0x42')][_0x4d15('0x50')]){_0x4c7c0c[_0x4d15('0x4c')]=_[_0x4d15('0x4e')](_0x4c7c0c[_0x4d15('0x4c')],{'$or':_[_0x4d15('0x3d')](_0x4c7c0c[_0x4d15('0x46')],function(_0x18c0de){var _0x3c3a96={};_0x3c3a96[_0x18c0de]={'$like':'%'+_0x1d2964[_0x4d15('0x42')][_0x4d15('0x50')]+'%'};return _0x3c3a96;})});}_0x4c7c0c=_[_0x4d15('0x4e')]({},_0x4c7c0c,_0x1d2964[_0x4d15('0x51')]);return _0x36187c[_0x4d15('0x11a')](_0x4c7c0c);}})[_0x4d15('0x21')](function(_0x5be305){if(_0x5be305){_0x59eaf=_0x5be305[_0x4d15('0x48')];if(!_0x1d2964['query'][_0x4d15('0x49')](_0x4d15('0x4a'))){_0x4c7c0c[_0x4d15('0x2d')]=qs['limit'](_0x1d2964[_0x4d15('0x42')][_0x4d15('0x2d')]);_0x4c7c0c[_0x4d15('0x2c')]=qs[_0x4d15('0x2c')](_0x1d2964[_0x4d15('0x42')][_0x4d15('0x2c')]);}return _0x36187c[_0x4d15('0x11a')](_0x4c7c0c);}})['then'](function(_0x2e9276){if(_0x2e9276){return _0x2e9276?{'count':_0x59eaf,'rows':_0x2e9276}:null;}})['then'](respondWithResult(_0x5ee06e,null))[_0x4d15('0x54')](handleError(_0x5ee06e,null));};exports[_0x4d15('0x11b')]=function(_0x5aabd0,_0x30aabe,_0x482fe4){return db['chatProactiveAction'][_0x4d15('0x58')]({'where':{'id':_0x5aabd0[_0x4d15('0x56')]['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x30aabe,null))['then'](function(_0x2ab18b){if(_0x2ab18b){return _0x2ab18b[_0x4d15('0x11b')](_0x5aabd0[_0x4d15('0x5a')][_0x4d15('0x66')],_[_0x4d15('0xf4')](_0x5aabd0[_0x4d15('0x5a')],['ids','id'])||{});}})[_0x4d15('0x21')](respondWithResult(_0x30aabe,null))[_0x4d15('0x54')](handleError(_0x30aabe,null));};exports[_0x4d15('0x107')]=function(_0x523463,_0x1733c6,_0x7908e0){var _0x5e46bb={};var _0x2daf4f={};var _0x267f4d;var _0x450b4d;return db[_0x4d15('0x3e')][_0x4d15('0x68')]({'where':{'id':_0x523463[_0x4d15('0x56')]['id']}})['then'](handleEntityNotFound(_0x1733c6,null))['then'](function(_0x5d56d0){if(_0x5d56d0){_0x267f4d=_0x5d56d0;_0x2daf4f['model']=_[_0x4d15('0x43')](db[_0x4d15('0x11c')][_0x4d15('0x3f')]);_0x2daf4f[_0x4d15('0x42')]=_[_0x4d15('0x43')](_0x523463[_0x4d15('0x42')]);_0x2daf4f[_0x4d15('0x4d')]=_[_0x4d15('0x44')](_0x2daf4f['model'],_0x2daf4f[_0x4d15('0x42')]);_0x5e46bb['attributes']=_[_0x4d15('0x44')](_0x2daf4f['model'],qs[_0x4d15('0x47')](_0x523463[_0x4d15('0x42')][_0x4d15('0x47')]));_0x5e46bb[_0x4d15('0x46')]=_0x5e46bb['attributes'][_0x4d15('0x48')]?_0x5e46bb[_0x4d15('0x46')]:_0x2daf4f['model'];_0x5e46bb[_0x4d15('0x63')]=qs[_0x4d15('0x4b')](_0x523463[_0x4d15('0x42')][_0x4d15('0x4b')]);_0x5e46bb[_0x4d15('0x4c')]=qs[_0x4d15('0x4d')](_[_0x4d15('0x69')](_0x523463[_0x4d15('0x42')],_0x2daf4f['filters']));if(_0x523463[_0x4d15('0x42')][_0x4d15('0x50')]){_0x5e46bb[_0x4d15('0x4c')]=_[_0x4d15('0x4e')](_0x5e46bb['where'],{'$or':_[_0x4d15('0x3d')](_0x5e46bb[_0x4d15('0x46')],function(_0x103e93){var _0x116fd3={};_0x116fd3[_0x103e93]={'$like':'%'+_0x523463[_0x4d15('0x42')][_0x4d15('0x50')]+'%'};return _0x116fd3;})});}_0x5e46bb=_[_0x4d15('0x4e')]({},_0x5e46bb,_0x523463['options']);return _0x267f4d[_0x4d15('0x107')](_0x5e46bb);}})[_0x4d15('0x21')](function(_0x3cd7e8){if(_0x3cd7e8){_0x450b4d=_0x3cd7e8[_0x4d15('0x48')];if(!_0x523463[_0x4d15('0x42')]['hasOwnProperty'](_0x4d15('0x4a'))){_0x5e46bb[_0x4d15('0x2d')]=qs[_0x4d15('0x2d')](_0x523463[_0x4d15('0x42')][_0x4d15('0x2d')]);_0x5e46bb['offset']=qs[_0x4d15('0x2c')](_0x523463['query'][_0x4d15('0x2c')]);}return _0x267f4d[_0x4d15('0x107')](_0x5e46bb);}})[_0x4d15('0x21')](function(_0x463993){if(_0x463993){return _0x463993?{'count':_0x450b4d,'rows':_0x463993}:null;}})[_0x4d15('0x21')](respondWithResult(_0x1733c6,null))[_0x4d15('0x54')](handleError(_0x1733c6,null));};exports[_0x4d15('0x11d')]=function(_0x14e35e,_0x1dc343,_0x25a09d){var _0x94dc8a=_0x14e35e[_0x4d15('0x42')][_0x4d15('0x11e')]==='false'?_0x4d15('0x11f'):_0x4d15('0x120');return db[_0x4d15('0x3e')][_0x4d15('0x58')]({'attributes':['id',_0x94dc8a],'where':{'id':_0x14e35e['params']['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x1dc343,null))[_0x4d15('0x21')](function(_0x5d2c73){if(_0x5d2c73){var _0x36a610=_0x5d2c73[_0x94dc8a];var _0x5770ce=_0x36a610&&_0x36a610['items']?_0x36a610['items']:[];_0x1dc343['send']({'fromKey':_[_0x4d15('0x77')](_0x36a610[_0x4d15('0x121')])?undefined:_0x36a610[_0x4d15('0x121')],'count':_0x5770ce[_0x4d15('0x48')],'rows':_0x5770ce});}})[_0x4d15('0x54')](handleError(_0x1dc343,null));};exports[_0x4d15('0x122')]=function(_0x35ab9f,_0xa58b77,_0x43b7a1){var _0x13dc33={'raw':![],'where':{}};var _0x5638a7={};var _0x282dac={'count':0x0,'rows':[]};return db[_0x4d15('0x3e')]['findOne']({'where':{'id':_0x35ab9f[_0x4d15('0x56')]['id']}})['then'](handleEntityNotFound(_0xa58b77,null))[_0x4d15('0x21')](function(_0x394b70){if(_0x394b70){_0x5638a7[_0x4d15('0x45')]=_[_0x4d15('0x43')](db[_0x4d15('0xd2')][_0x4d15('0x3f')]);_0x5638a7[_0x4d15('0x42')]=_[_0x4d15('0x43')](_0x35ab9f[_0x4d15('0x42')]);_0x5638a7['filters']=_[_0x4d15('0x44')](_0x5638a7[_0x4d15('0x45')],_0x5638a7[_0x4d15('0x42')]);_0x13dc33[_0x4d15('0x46')]=_[_0x4d15('0x44')](_0x5638a7[_0x4d15('0x45')],qs[_0x4d15('0x47')](_0x35ab9f[_0x4d15('0x42')][_0x4d15('0x47')]));_0x13dc33[_0x4d15('0x46')]=_0x13dc33[_0x4d15('0x46')][_0x4d15('0x48')]?_0x13dc33[_0x4d15('0x46')]:_0x5638a7[_0x4d15('0x45')];if(!_0x35ab9f['query'][_0x4d15('0x49')]('nolimit')){_0x13dc33['limit']=qs[_0x4d15('0x2d')](_0x35ab9f[_0x4d15('0x42')][_0x4d15('0x2d')]);_0x13dc33['offset']=qs[_0x4d15('0x2c')](_0x35ab9f[_0x4d15('0x42')][_0x4d15('0x2c')]);}_0x13dc33[_0x4d15('0x63')]=qs['sort'](_0x35ab9f[_0x4d15('0x42')][_0x4d15('0x4b')]);_0x13dc33['where']=qs['filters'](_[_0x4d15('0x69')](_0x35ab9f['query'],_0x5638a7[_0x4d15('0x4d')]));_0x13dc33['where'][_0x4d15('0x60')]=_0x394b70['id'];if(_0x35ab9f[_0x4d15('0x42')][_0x4d15('0x50')]){_0x13dc33[_0x4d15('0x4c')]=_[_0x4d15('0x4e')](_0x13dc33[_0x4d15('0x4c')],{'$or':_[_0x4d15('0x3d')](_0x13dc33[_0x4d15('0x46')],function(_0x1c318b){var _0x1b1bad={};_0x1b1bad[_0x1c318b]={'$like':'%'+_0x35ab9f[_0x4d15('0x42')][_0x4d15('0x50')]+'%'};return _0x1b1bad;})});}_0x13dc33=_[_0x4d15('0x4e')]({},_0x13dc33,_0x35ab9f[_0x4d15('0x51')]);return db[_0x4d15('0xd2')][_0x4d15('0x2e')]({'where':_0x13dc33[_0x4d15('0x4c')]})['then'](function(_0x15f00f){_0x282dac[_0x4d15('0x2e')]=_0x15f00f;if(_0x35ab9f[_0x4d15('0x42')][_0x4d15('0x57')]){_0x13dc33[_0x4d15('0x52')]=[{'all':!![]}];}else{_0x13dc33[_0x4d15('0x52')]=[{'model':db['CmContact'],'as':_0x4d15('0xf6'),'required':![]},{'model':db[_0x4d15('0xdb')],'as':_0x4d15('0x123'),'required':![]}];}return db[_0x4d15('0xd2')]['findAll'](_0x13dc33);})[_0x4d15('0x21')](function(_0x54a390){_0x282dac['rows']=_0x54a390;return _0x282dac;});}})[_0x4d15('0x21')](respondWithFilteredResult(_0xa58b77,_0x13dc33))[_0x4d15('0x54')](handleError(_0xa58b77,null));};exports[_0x4d15('0x124')]=function(_0x7de638,_0x266f22,_0x1e48c0){return db[_0x4d15('0x3e')]['find']({'where':{'id':_0x7de638[_0x4d15('0x56')]['id']}})['then'](handleEntityNotFound(_0x266f22,null))[_0x4d15('0x21')](function(_0x566108){if(_0x566108){return _0x566108[_0x4d15('0x124')](_0x7de638[_0x4d15('0x5a')][_0x4d15('0x66')],_[_0x4d15('0xf4')](_0x7de638['body'],[_0x4d15('0x66'),'id'])||{})['spread'](function(_0x3ec619){for(var _0x5f9ed8=0x0;_0x5f9ed8<_0x7de638[_0x4d15('0x5a')][_0x4d15('0x66')]['length'];_0x5f9ed8+=0x1){socket[_0x4d15('0x125')](_0x4d15('0x126'),{'UserId':Number(_0x7de638[_0x4d15('0x5a')]['ids'][_0x5f9ed8]),'ChatWebsiteId':Number(_0x7de638[_0x4d15('0x56')]['id'])});}return _0x3ec619;});}})[_0x4d15('0x21')](respondWithResult(_0x266f22,null))['catch'](handleError(_0x266f22,null));};exports[_0x4d15('0x127')]=function(_0x12269b,_0x3d4938,_0x171fea){return db['ChatWebsite'][_0x4d15('0x58')]({'where':{'id':_0x12269b[_0x4d15('0x56')]['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x3d4938,null))[_0x4d15('0x21')](function(_0x363967){if(_0x363967){return _0x363967[_0x4d15('0x127')](_0x12269b[_0x4d15('0x42')]['ids'])[_0x4d15('0x21')](function(){if(_[_0x4d15('0x128')](_0x12269b[_0x4d15('0x42')][_0x4d15('0x66')])){for(var _0x5afa91=0x0;_0x5afa91<_0x12269b[_0x4d15('0x42')][_0x4d15('0x66')][_0x4d15('0x48')];_0x5afa91+=0x1){socket[_0x4d15('0x125')](_0x4d15('0x129'),{'UserId':Number(_0x12269b[_0x4d15('0x42')]['ids'][_0x5afa91]),'ChatWebsiteId':Number(_0x12269b['params']['id'])});}}else{socket[_0x4d15('0x125')]('userChatWebsite:remove',{'UserId':Number(_0x12269b[_0x4d15('0x42')][_0x4d15('0x66')]),'ChatWebsiteId':Number(_0x12269b[_0x4d15('0x56')]['id'])});}});}})[_0x4d15('0x21')](respondWithStatusCode(_0x3d4938,null))['catch'](handleError(_0x3d4938,null));};exports[_0x4d15('0x12a')]=function(_0x31fa67,_0x24a6eb,_0x266da6){var _0xb281b={};var _0x1efaed={};var _0x258eb4;var _0x468bbe;return db[_0x4d15('0x3e')][_0x4d15('0x68')]({'where':{'id':_0x31fa67['params']['id']}})[_0x4d15('0x21')](handleEntityNotFound(_0x24a6eb,null))[_0x4d15('0x21')](function(_0x2264a6){if(_0x2264a6){_0x258eb4=_0x2264a6;_0x1efaed[_0x4d15('0x45')]=_[_0x4d15('0x43')](db[_0x4d15('0xbf')][_0x4d15('0x3f')]);_0x1efaed[_0x4d15('0x42')]=_[_0x4d15('0x43')](_0x31fa67['query']);_0x1efaed[_0x4d15('0x4d')]=_[_0x4d15('0x44')](_0x1efaed[_0x4d15('0x45')],_0x1efaed[_0x4d15('0x42')]);_0xb281b[_0x4d15('0x46')]=_[_0x4d15('0x44')](_0x1efaed['model'],qs[_0x4d15('0x47')](_0x31fa67[_0x4d15('0x42')][_0x4d15('0x47')]));_0xb281b['attributes']=_0xb281b[_0x4d15('0x46')][_0x4d15('0x48')]?_0xb281b[_0x4d15('0x46')]:_0x1efaed[_0x4d15('0x45')];_0xb281b['order']=qs[_0x4d15('0x4b')](_0x31fa67[_0x4d15('0x42')][_0x4d15('0x4b')]);_0xb281b[_0x4d15('0x4c')]=qs[_0x4d15('0x4d')](_['pick'](_0x31fa67[_0x4d15('0x42')],_0x1efaed['filters']));if(_0x31fa67[_0x4d15('0x42')][_0x4d15('0x50')]){_0xb281b['where']=_[_0x4d15('0x4e')](_0xb281b[_0x4d15('0x4c')],{'$or':_[_0x4d15('0x3d')](_0xb281b['attributes'],function(_0x23c56d){var _0x20e6ea={};_0x20e6ea[_0x23c56d]={'$like':'%'+_0x31fa67[_0x4d15('0x42')]['filter']+'%'};return _0x20e6ea;})});}_0xb281b=_[_0x4d15('0x4e')]({},_0xb281b,_0x31fa67['options']);return _0x258eb4[_0x4d15('0x12a')](_0xb281b);}})[_0x4d15('0x21')](function(_0xd15dc2){if(_0xd15dc2){_0x468bbe=_0xd15dc2[_0x4d15('0x48')];if(!_0x31fa67[_0x4d15('0x42')]['hasOwnProperty'](_0x4d15('0x4a'))){_0xb281b[_0x4d15('0x2d')]=qs[_0x4d15('0x2d')](_0x31fa67[_0x4d15('0x42')][_0x4d15('0x2d')]);_0xb281b[_0x4d15('0x2c')]=qs[_0x4d15('0x2c')](_0x31fa67[_0x4d15('0x42')][_0x4d15('0x2c')]);}return _0x258eb4[_0x4d15('0x12a')](_0xb281b);}})['then'](function(_0x2a9add){if(_0x2a9add){return _0x2a9add?{'count':_0x468bbe,'rows':_0x2a9add}:null;}})[_0x4d15('0x21')](respondWithResult(_0x24a6eb,null))[_0x4d15('0x54')](handleError(_0x24a6eb,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 60b99bd..02d034c 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 _0xe6c1=['ChatWebsite','setMaxListeners','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1e896c,_0x3f9948){var _0xd149d9=function(_0x3281e5){while(--_0x3281e5){_0x1e896c['push'](_0x1e896c['shift']());}};_0xd149d9(++_0x3f9948);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x1e6c('0x0'))['db'][_0x1e6c('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1e6c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1e6c('0x3')};function emitEvent(_0x37322d){return function(_0x43ee4d,_0x5a1672,_0x4abaac){ChatWebsiteEvents['emit'](_0x37322d+':'+_0x43ee4d['id'],_0x43ee4d);ChatWebsiteEvents['emit'](_0x37322d,_0x43ee4d);_0x4abaac(null);};}for(var e in events){if(events[_0x1e6c('0x4')](e)){var event=events[e];ChatWebsite[_0x1e6c('0x5')](e,emitEvent(event));}}module[_0x1e6c('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xdfe7=['hook','exports','../../mysqldb','ChatWebsite','save','update','remove','emit','hasOwnProperty'];(function(_0x281db6,_0x2d3f21){var _0x319ea2=function(_0x5dc312){while(--_0x5dc312){_0x281db6['push'](_0x281db6['shift']());}};_0x319ea2(++_0x2d3f21);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x2643de,_0x474450){_0x2643de=_0x2643de-0x0;var _0x2097d4=_0xdfe7[_0x2643de];return _0x2097d4;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x7dfe('0x0'))['db'][_0x7dfe('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7dfe('0x2'),'afterUpdate':_0x7dfe('0x3'),'afterDestroy':_0x7dfe('0x4')};function emitEvent(_0xb0b7fb){return function(_0x527490,_0x2c07d2,_0x23ac4c){ChatWebsiteEvents['emit'](_0xb0b7fb+':'+_0x527490['id'],_0x527490);ChatWebsiteEvents[_0x7dfe('0x5')](_0xb0b7fb,_0x527490);_0x23ac4c(null);};}for(var e in events){if(events[_0x7dfe('0x6')](e)){var event=events[e];ChatWebsite[_0x7dfe('0x7')](e,emitEvent(event));}}module[_0x7dfe('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index a5d824b..7e6eb5b 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 _0x720d=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x566610,_0x342878){var _0x411249=function(_0x1e3330){while(--_0x1e3330){_0x566610['push'](_0x566610['shift']());}};_0x411249(++_0x342878);}(_0x720d,0x1a4));var _0xd720=function(_0x391724,_0x412898){_0x391724=_0x391724-0x0;var _0x2fa6f1=_0x720d[_0x391724];return _0x2fa6f1;};'use strict';var _=require(_0xd720('0x0'));var util=require(_0xd720('0x1'));var logger=require('../../config/logger')(_0xd720('0x2'));var moment=require(_0xd720('0x3'));var BPromise=require(_0xd720('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd720('0x5'));var config=require(_0xd720('0x6'));var attributes=require(_0xd720('0x7'));module[_0xd720('0x8')]=function(_0x2a37e3,_0x444148){return _0x2a37e3[_0xd720('0x9')](_0xd720('0xa'),attributes,{'tableName':_0xd720('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa982=['ChatWebsite','chat_websites','lodash','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x5d6923,_0x2b5546){var _0x4dde96=function(_0x4988e5){while(--_0x4988e5){_0x5d6923['push'](_0x5d6923['shift']());}};_0x4dde96(++_0x2b5546);}(_0xa982,0x19c));var _0x2a98=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0xa982[_0x2d2e85];return _0x3e9f5e;};'use strict';var _=require(_0x2a98('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2a98('0x1'));var BPromise=require(_0x2a98('0x2'));var rp=require(_0x2a98('0x3'));var fs=require('fs');var path=require(_0x2a98('0x4'));var rimraf=require(_0x2a98('0x5'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x2a98('0x6')]=function(_0x1f9390,_0x82045){return _0x1f9390[_0x2a98('0x7')](_0x2a98('0x8'),attributes,{'tableName':_0x2a98('0x9'),'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 7b93085..72f9db0 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 _0x0e10=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xe182dc,_0x143af4){var _0x527a62=function(_0x3393aa){while(--_0x3393aa){_0xe182dc['push'](_0xe182dc['shift']());}};_0x527a62(++_0x143af4);}(_0x0e10,0x11a));var _0x00e1=function(_0x43644d,_0x3c188e){_0x43644d=_0x43644d-0x0;var _0x15e8b4=_0x0e10[_0x43644d];return _0x15e8b4;};'use strict';var _=require(_0x00e1('0x0'));var util=require(_0x00e1('0x1'));var moment=require(_0x00e1('0x2'));var BPromise=require(_0x00e1('0x3'));var rs=require(_0x00e1('0x4'));var fs=require('fs');var Redis=require(_0x00e1('0x5'));var db=require(_0x00e1('0x6'))['db'];var utils=require(_0x00e1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x00e1('0x8'));var jayson=require(_0x00e1('0x9'));var client=jayson['client'][_0x00e1('0xa')]({'port':0x232a});config[_0x00e1('0xb')]=_[_0x00e1('0xc')](config['redis'],{'host':_0x00e1('0xd'),'port':0x18eb});var socket=require(_0x00e1('0xe'))(new Redis(config[_0x00e1('0xb')]));require(_0x00e1('0xf'))[_0x00e1('0x10')](socket);function respondWithRpcPromise(_0x5ac27a,_0x2323c0,_0x301453){return new BPromise(function(_0x290e5d,_0x4d5efc){return client[_0x00e1('0x11')](_0x5ac27a,_0x301453)[_0x00e1('0x12')](function(_0x22709a){logger[_0x00e1('0x13')](_0x00e1('0x14'),_0x2323c0,_0x00e1('0x15'));logger['debug'](_0x00e1('0x16'),_0x2323c0,_0x00e1('0x15'),JSON[_0x00e1('0x17')](_0x22709a));if(_0x22709a['error']){if(_0x22709a[_0x00e1('0x18')][_0x00e1('0x19')]===0x1f4){logger[_0x00e1('0x18')](_0x00e1('0x14'),_0x2323c0,_0x22709a[_0x00e1('0x18')]['message']);return _0x4d5efc(_0x22709a[_0x00e1('0x18')]['message']);}logger[_0x00e1('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x2323c0,_0x22709a[_0x00e1('0x18')]['message']);return _0x290e5d(_0x22709a[_0x00e1('0x18')][_0x00e1('0x1a')]);}else{logger[_0x00e1('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x2323c0,_0x00e1('0x15'));_0x290e5d(_0x22709a[_0x00e1('0x1b')][_0x00e1('0x1a')]);}})[_0x00e1('0x1c')](function(_0x154d4c){logger[_0x00e1('0x18')](_0x00e1('0x14'),_0x2323c0,_0x154d4c);_0x4d5efc(_0x154d4c);});});} \ No newline at end of file +var _0x9e9b=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','client','http','redis','localhost','./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x3003e5,_0x3b394c){var _0x303245=function(_0x126711){while(--_0x126711){_0x3003e5['push'](_0x3003e5['shift']());}};_0x303245(++_0x3b394c);}(_0x9e9b,0x7f));var _0xb9e9=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0x9e9b[_0x9c3c56];return _0x2dd782;};'use strict';var _=require(_0xb9e9('0x0'));var util=require(_0xb9e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb9e9('0x2'));var fs=require('fs');var Redis=require(_0xb9e9('0x3'));var db=require(_0xb9e9('0x4'))['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[_0xb9e9('0x5')][_0xb9e9('0x6')]({'port':0x232a});config[_0xb9e9('0x7')]=_['defaults'](config[_0xb9e9('0x7')],{'host':_0xb9e9('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9e9('0x7')]));require(_0xb9e9('0x9'))['register'](socket);function respondWithRpcPromise(_0x3c677d,_0x1b5d77,_0x2a7a53){return new BPromise(function(_0x4359d6,_0x28a354){return client[_0xb9e9('0xa')](_0x3c677d,_0x2a7a53)['then'](function(_0x5168ab){logger[_0xb9e9('0xb')](_0xb9e9('0xc'),_0x1b5d77,_0xb9e9('0xd'));logger[_0xb9e9('0xe')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1b5d77,'request\x20sent',JSON[_0xb9e9('0xf')](_0x5168ab));if(_0x5168ab[_0xb9e9('0x10')]){if(_0x5168ab[_0xb9e9('0x10')][_0xb9e9('0x11')]===0x1f4){logger[_0xb9e9('0x10')](_0xb9e9('0xc'),_0x1b5d77,_0x5168ab[_0xb9e9('0x10')]['message']);return _0x28a354(_0x5168ab[_0xb9e9('0x10')]['message']);}logger[_0xb9e9('0x10')](_0xb9e9('0xc'),_0x1b5d77,_0x5168ab[_0xb9e9('0x10')][_0xb9e9('0x12')]);return _0x4359d6(_0x5168ab['error'][_0xb9e9('0x12')]);}else{logger[_0xb9e9('0xb')]('ChatWebsite,\x20%s,\x20%s',_0x1b5d77,_0xb9e9('0xd'));_0x4359d6(_0x5168ab['result'][_0xb9e9('0x12')]);}})[_0xb9e9('0x13')](function(_0x313437){logger['error'](_0xb9e9('0xc'),_0x1b5d77,_0x313437);_0x28a354(_0x313437);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c34ef8e..bac8daf 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 _0x1bfc=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x1bfc,0x1c6));var _0xc1bf=function(_0x1f50c4,_0x33cde6){_0x1f50c4=_0x1f50c4-0x0;var _0x8213c4=_0x1bfc[_0x1f50c4];return _0x8213c4;};'use strict';var ChatWebsiteEvents=require(_0xc1bf('0x0'));var events=[_0xc1bf('0x1'),_0xc1bf('0x2'),_0xc1bf('0x3')];function createListener(_0x29b1e8,_0x3ae04f){return function(_0x2c41f7){_0x3ae04f[_0xc1bf('0x4')](_0x29b1e8,_0x2c41f7);};}function removeListener(_0x77ea3a,_0x2a66bb){return function(){ChatWebsiteEvents[_0xc1bf('0x5')](_0x77ea3a,_0x2a66bb);};}exports[_0xc1bf('0x6')]=function(_0x6f4fd5){for(var _0x35c070=0x0,_0x4bd51c=events[_0xc1bf('0x7')];_0x35c070<_0x4bd51c;_0x35c070++){var _0x3bfc5d=events[_0x35c070];var _0x3dd7e6=createListener(_0xc1bf('0x8')+_0x3bfc5d,_0x6f4fd5);ChatWebsiteEvents['on'](_0x3bfc5d,_0x3dd7e6);}}; \ No newline at end of file +var _0x4639=['register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0x382755,_0x427f59){var _0x57bb03=function(_0x33b4b8){while(--_0x33b4b8){_0x382755['push'](_0x382755['shift']());}};_0x57bb03(++_0x427f59);}(_0x4639,0xab));var _0x9463=function(_0x2d2a9b,_0x5870ff){_0x2d2a9b=_0x2d2a9b-0x0;var _0x3d2d49=_0x4639[_0x2d2a9b];return _0x3d2d49;};'use strict';var ChatWebsiteEvents=require(_0x9463('0x0'));var events=[_0x9463('0x1'),_0x9463('0x2'),_0x9463('0x3')];function createListener(_0x5ae1b0,_0x4636ee){return function(_0x21b1d5){_0x4636ee[_0x9463('0x4')](_0x5ae1b0,_0x21b1d5);};}function removeListener(_0x1bd9a4,_0x125268){return function(){ChatWebsiteEvents['removeListener'](_0x1bd9a4,_0x125268);};}exports[_0x9463('0x5')]=function(_0x1b303b){for(var _0x36a34c=0x0,_0x4de02d=events[_0x9463('0x6')];_0x36a34c<_0x4de02d;_0x36a34c++){var _0x3f910b=events[_0x36a34c];var _0x5d2d5a=createListener(_0x9463('0x7')+_0x3f910b,_0x1b303b);ChatWebsiteEvents['on'](_0x3f910b,_0x5d2d5a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8333eba..f14c5b1 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 _0x8e76=['addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','any','offline','/:id/proactive_actions','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','index','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','server/files/images/logos/','originalname','single','file','addLogo','server/files/images/avatars/','format','now','addAvatar','join','root','%s-%s'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x8e76,0x96));var _0x68e7=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8e76[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x68e7('0x0'));var util=require(_0x68e7('0x1'));var path=require(_0x68e7('0x2'));var timeout=require(_0x68e7('0x3'));var express=require(_0x68e7('0x4'));var router=express[_0x68e7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x68e7('0x6'));var controller=require('./chatWebsite.controller');router[_0x68e7('0x7')]('/',auth['isAuthenticated'](),controller[_0x68e7('0x8')]);router[_0x68e7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x68e7('0x9')]);router[_0x68e7('0x7')](_0x68e7('0xa'),auth[_0x68e7('0xb')](),controller[_0x68e7('0xc')]);router[_0x68e7('0x7')](_0x68e7('0xd'),auth[_0x68e7('0xb')](),controller[_0x68e7('0xe')]);router[_0x68e7('0x7')](_0x68e7('0xf'),auth[_0x68e7('0xb')](),controller['getAnswers']);router[_0x68e7('0x7')](_0x68e7('0x10'),controller['getLogo']);router[_0x68e7('0x7')](_0x68e7('0x11'),controller[_0x68e7('0x12')]);router[_0x68e7('0x7')](_0x68e7('0x13'),controller[_0x68e7('0x14')]);router['get'](_0x68e7('0x15'),controller[_0x68e7('0x16')]);router['get'](_0x68e7('0x17'),auth[_0x68e7('0xb')](),controller[_0x68e7('0x18')]);router[_0x68e7('0x7')](_0x68e7('0x19'),controller[_0x68e7('0x1a')]);router['get'](_0x68e7('0x1b'),auth['isAuthenticated'](),controller[_0x68e7('0x1c')]);router['get']('/:id/proactive_actions',auth[_0x68e7('0xb')](),controller[_0x68e7('0x1d')]);router[_0x68e7('0x7')](_0x68e7('0x1e'),controller['getFields']);router[_0x68e7('0x7')](_0x68e7('0x1f'),auth[_0x68e7('0xb')](),controller[_0x68e7('0x20')]);router[_0x68e7('0x7')](_0x68e7('0x21'),auth[_0x68e7('0xb')](),controller['getAgents']);router[_0x68e7('0x22')]('/',auth[_0x68e7('0xb')](),controller[_0x68e7('0x23')]);router[_0x68e7('0x22')](_0x68e7('0xd'),auth[_0x68e7('0xb')](),controller[_0x68e7('0x24')]);router[_0x68e7('0x22')](_0x68e7('0xf'),auth[_0x68e7('0xb')](),controller[_0x68e7('0x25')]);var upload=multer({'storage':multer[_0x68e7('0x26')]({'destination':function(_0x1449c8,_0x39dc7e,_0x3d9803){_0x3d9803(null,path['join'](config['root'],_0x68e7('0x27')));},'filename':function(_0x297493,_0x391ffe,_0x1f8a7f){_0x1f8a7f(null,util['format']('%s-%s',Date['now'](),_0x391ffe[_0x68e7('0x28')]));}})});router[_0x68e7('0x22')](_0x68e7('0x10'),upload[_0x68e7('0x29')](_0x68e7('0x2a')),controller[_0x68e7('0x2b')]);var upload=multer({'storage':multer[_0x68e7('0x26')]({'destination':function(_0x4ca0d0,_0x3724b3,_0x31b0d8){_0x31b0d8(null,path['join'](config['root'],_0x68e7('0x2c')));},'filename':function(_0x1aa90c,_0x127c65,_0x523534){_0x523534(null,util[_0x68e7('0x2d')]('%s-%s',Date[_0x68e7('0x2e')](),_0x127c65[_0x68e7('0x28')]));}})});router[_0x68e7('0x22')](_0x68e7('0x11'),upload[_0x68e7('0x29')](_0x68e7('0x2a')),controller[_0x68e7('0x2f')]);var upload=multer({'storage':multer[_0x68e7('0x26')]({'destination':function(_0x5291a1,_0x2d9703,_0x143d2d){_0x143d2d(null,path[_0x68e7('0x30')](config[_0x68e7('0x31')],_0x68e7('0x2c')));},'filename':function(_0x1e64d6,_0x33481e,_0x360e7e){_0x360e7e(null,util[_0x68e7('0x2d')](_0x68e7('0x32'),Date[_0x68e7('0x2e')](),_0x33481e[_0x68e7('0x28')]));}})});router[_0x68e7('0x22')]('/:id/customer_avatar',upload[_0x68e7('0x29')](_0x68e7('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x68e7('0x26')]({'destination':function(_0x39eac2,_0x2f239e,_0x3e38cc){_0x3e38cc(null,path[_0x68e7('0x30')](config[_0x68e7('0x31')],'server/files/images/avatars/'));},'filename':function(_0x25f538,_0x5efc82,_0x3ba85c){_0x3ba85c(null,util[_0x68e7('0x2d')](_0x68e7('0x32'),Date['now'](),_0x5efc82[_0x68e7('0x28')]));}})});router[_0x68e7('0x22')](_0x68e7('0x15'),upload['single'](_0x68e7('0x2a')),controller[_0x68e7('0x33')]);router[_0x68e7('0x22')](_0x68e7('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2764cb,_0x40d388,_0x1d631a){const _0x2e5b21=path[_0x68e7('0x30')](config[_0x68e7('0x31')],_0x68e7('0x35'),_0x68e7('0x36'),_0x68e7('0x37'));fs_extra['ensureDir'](_0x2e5b21,function(){_0x1d631a(null,_0x2e5b21);});},'filename':function(_0x4cb242,_0x70edc1,_0x43d2e0){const _0x604b1b=_0x70edc1['originalname'][_0x68e7('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2d4dfa=path['extname'](_0x604b1b);const _0x5ef7ce=Date['now']()+'-'+_0x604b1b[_0x68e7('0x38')](_0x2d4dfa,'')+_0x2d4dfa;_0x43d2e0(null,_0x5ef7ce);}})});router[_0x68e7('0x22')]('/:id/offline',offlineUploadMulter[_0x68e7('0x39')](),controller[_0x68e7('0x3a')]);router[_0x68e7('0x22')](_0x68e7('0x17'),auth[_0x68e7('0xb')](),controller['addInteraction']);router['post'](_0x68e7('0x1b'),auth[_0x68e7('0xb')](),controller['addApplications']);router[_0x68e7('0x22')](_0x68e7('0x3b'),auth[_0x68e7('0xb')](),controller['addProactiveActions']);router[_0x68e7('0x22')](_0x68e7('0x21'),auth[_0x68e7('0xb')](),controller[_0x68e7('0x3c')]);router[_0x68e7('0x3d')](_0x68e7('0xa'),auth[_0x68e7('0xb')](),controller[_0x68e7('0x3e')]);router[_0x68e7('0x3f')](_0x68e7('0xa'),auth[_0x68e7('0xb')](),controller[_0x68e7('0x40')]);router[_0x68e7('0x3f')](_0x68e7('0xd'),auth[_0x68e7('0xb')](),controller['removeDispositions']);router[_0x68e7('0x3f')](_0x68e7('0xf'),auth[_0x68e7('0xb')](),controller['removeAnswers']);router[_0x68e7('0x3f')]('/:id/users',auth['isAuthenticated'](),controller[_0x68e7('0x41')]);module[_0x68e7('0x42')]=router; \ No newline at end of file +var _0xfed4=['/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','originalname','file','addLogo','root','server/files/images/avatars/','now','single','addCustomerAvatar','/:id/notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addApplications','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields'];(function(_0x318010,_0x29d49a){var _0xed4d9d=function(_0xc815e0){while(--_0xc815e0){_0x318010['push'](_0x318010['shift']());}};_0xed4d9d(++_0x29d49a);}(_0xfed4,0x104));var _0x4fed=function(_0x11b714,_0x4c1ba3){_0x11b714=_0x11b714-0x0;var _0x2608e1=_0xfed4[_0x11b714];return _0x2608e1;};'use strict';var multer=require(_0x4fed('0x0'));var util=require(_0x4fed('0x1'));var path=require(_0x4fed('0x2'));var timeout=require(_0x4fed('0x3'));var express=require(_0x4fed('0x4'));var router=express[_0x4fed('0x5')]();var fs_extra=require(_0x4fed('0x6'));var auth=require(_0x4fed('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4fed('0x8'));var controller=require(_0x4fed('0x9'));router[_0x4fed('0xa')]('/',auth[_0x4fed('0xb')](),controller[_0x4fed('0xc')]);router[_0x4fed('0xa')](_0x4fed('0xd'),auth[_0x4fed('0xb')](),controller[_0x4fed('0xe')]);router[_0x4fed('0xa')](_0x4fed('0xf'),auth['isAuthenticated'](),controller[_0x4fed('0x10')]);router[_0x4fed('0xa')](_0x4fed('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x4fed('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4fed('0x12')]);router[_0x4fed('0xa')](_0x4fed('0x13'),controller[_0x4fed('0x14')]);router['get'](_0x4fed('0x15'),controller[_0x4fed('0x16')]);router[_0x4fed('0xa')](_0x4fed('0x17'),controller[_0x4fed('0x18')]);router[_0x4fed('0xa')](_0x4fed('0x19'),controller[_0x4fed('0x1a')]);router[_0x4fed('0xa')](_0x4fed('0x1b'),auth[_0x4fed('0xb')](),controller[_0x4fed('0x1c')]);router[_0x4fed('0xa')](_0x4fed('0x1d'),controller[_0x4fed('0x1e')]);router[_0x4fed('0xa')](_0x4fed('0x1f'),auth[_0x4fed('0xb')](),controller[_0x4fed('0x20')]);router[_0x4fed('0xa')](_0x4fed('0x21'),auth[_0x4fed('0xb')](),controller[_0x4fed('0x22')]);router[_0x4fed('0xa')]('/:id/fields',controller[_0x4fed('0x23')]);router[_0x4fed('0xa')](_0x4fed('0x24'),auth[_0x4fed('0xb')](),controller[_0x4fed('0x25')]);router['get'](_0x4fed('0x26'),auth[_0x4fed('0xb')](),controller[_0x4fed('0x27')]);router[_0x4fed('0x28')]('/',auth[_0x4fed('0xb')](),controller[_0x4fed('0x29')]);router[_0x4fed('0x28')](_0x4fed('0x11'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x4fed('0x28')](_0x4fed('0x2a'),auth[_0x4fed('0xb')](),controller[_0x4fed('0x2b')]);var upload=multer({'storage':multer[_0x4fed('0x2c')]({'destination':function(_0x43c70b,_0x340d60,_0x27599e){_0x27599e(null,path[_0x4fed('0x2d')](config['root'],_0x4fed('0x2e')));},'filename':function(_0x41ccb7,_0x1d9c7e,_0x45e81f){_0x45e81f(null,util[_0x4fed('0x2f')](_0x4fed('0x30'),Date['now'](),_0x1d9c7e[_0x4fed('0x31')]));}})});router[_0x4fed('0x28')](_0x4fed('0x13'),upload['single'](_0x4fed('0x32')),controller[_0x4fed('0x33')]);var upload=multer({'storage':multer[_0x4fed('0x2c')]({'destination':function(_0x229866,_0x3f223b,_0x38178d){_0x38178d(null,path[_0x4fed('0x2d')](config[_0x4fed('0x34')],_0x4fed('0x35')));},'filename':function(_0x10ea86,_0x5c25ca,_0x58a434){_0x58a434(null,util[_0x4fed('0x2f')]('%s-%s',Date[_0x4fed('0x36')](),_0x5c25ca[_0x4fed('0x31')]));}})});router[_0x4fed('0x28')](_0x4fed('0x15'),upload[_0x4fed('0x37')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0x4fed('0x2c')]({'destination':function(_0x566b3f,_0x7507b9,_0x526fd0){_0x526fd0(null,path[_0x4fed('0x2d')](config[_0x4fed('0x34')],_0x4fed('0x35')));},'filename':function(_0x2a551a,_0x17fd02,_0x26ff98){_0x26ff98(null,util[_0x4fed('0x2f')](_0x4fed('0x30'),Date['now'](),_0x17fd02[_0x4fed('0x31')]));}})});router['post']('/:id/customer_avatar',upload[_0x4fed('0x37')](_0x4fed('0x32')),controller[_0x4fed('0x38')]);var upload=multer({'storage':multer[_0x4fed('0x2c')]({'destination':function(_0x1ac2a0,_0x1201a5,_0x1b23bb){_0x1b23bb(null,path[_0x4fed('0x2d')](config['root'],_0x4fed('0x35')));},'filename':function(_0x4eb156,_0xec59d2,_0x3ab2ed){_0x3ab2ed(null,util[_0x4fed('0x2f')](_0x4fed('0x30'),Date[_0x4fed('0x36')](),_0xec59d2[_0x4fed('0x31')]));}})});router['post']('/:id/system_avatar',upload[_0x4fed('0x37')]('file'),controller['addSystemAvatar']);router[_0x4fed('0x28')](_0x4fed('0x39'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x4fed('0x2c')]({'destination':function(_0x58f89e,_0x5a03d3,_0xd9621a){const _0x257951=path[_0x4fed('0x2d')](config[_0x4fed('0x34')],_0x4fed('0x3a'),'attachments',_0x4fed('0x3b'));fs_extra[_0x4fed('0x3c')](_0x257951,function(){_0xd9621a(null,_0x257951);});},'filename':function(_0x40b329,_0x570750,_0x562ad){const _0x5670f0=_0x570750[_0x4fed('0x31')][_0x4fed('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2fc379=path[_0x4fed('0x3e')](_0x5670f0);const _0x27c125=Date[_0x4fed('0x36')]()+'-'+_0x5670f0['replace'](_0x2fc379,'')+_0x2fc379;_0x562ad(null,_0x27c125);}})});router[_0x4fed('0x28')](_0x4fed('0x3f'),offlineUploadMulter['any'](),controller[_0x4fed('0x40')]);router[_0x4fed('0x28')](_0x4fed('0x1b'),auth[_0x4fed('0xb')](),controller[_0x4fed('0x41')]);router[_0x4fed('0x28')](_0x4fed('0x1f'),auth[_0x4fed('0xb')](),controller[_0x4fed('0x42')]);router[_0x4fed('0x28')](_0x4fed('0x21'),auth[_0x4fed('0xb')](),controller['addProactiveActions']);router[_0x4fed('0x28')](_0x4fed('0x26'),auth['isAuthenticated'](),controller[_0x4fed('0x43')]);router['put']('/:id',auth[_0x4fed('0xb')](),controller[_0x4fed('0x44')]);router[_0x4fed('0x45')](_0x4fed('0xf'),auth[_0x4fed('0xb')](),controller['destroy']);router[_0x4fed('0x45')]('/:id/dispositions',auth[_0x4fed('0xb')](),controller[_0x4fed('0x46')]);router[_0x4fed('0x45')]('/:id/canned_answers',auth[_0x4fed('0xb')](),controller[_0x4fed('0x47')]);router['delete']('/:id/users',auth[_0x4fed('0xb')](),controller[_0x4fed('0x48')]);module[_0x4fed('0x49')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e4b3c90..02b8a8d 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 _0x5353=['ENUM','AmazonAWS','Google','sequelize','STRING'];(function(_0x9af7ad,_0x326b02){var _0x14e368=function(_0x55d28d){while(--_0x55d28d){_0x9af7ad['push'](_0x9af7ad['shift']());}};_0x14e368(++_0x326b02);}(_0x5353,0x12f));var _0x3535=function(_0x15dd12,_0x5e04b0){_0x15dd12=_0x15dd12-0x0;var _0x56ca1f=_0x5353[_0x15dd12];return _0x56ca1f;};'use strict';var Sequelize=require(_0x3535('0x0'));module['exports']={'name':{'type':Sequelize[_0x3535('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3535('0x2')](_0x3535('0x3'),_0x3535('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3535('0x1')]},'data2':{'type':Sequelize[_0x3535('0x1')]}}; \ No newline at end of file +var _0xfb15=['ENUM','AmazonAWS','Google','sequelize','exports','STRING'];(function(_0x5c5889,_0x4a3145){var _0x3b9580=function(_0xd8b841){while(--_0xd8b841){_0x5c5889['push'](_0x5c5889['shift']());}};_0x3b9580(++_0x4a3145);}(_0xfb15,0x12f));var _0x5fb1=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xfb15[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x5fb1('0x0'));module[_0x5fb1('0x1')]={'name':{'type':Sequelize[_0x5fb1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5fb1('0x3')](_0x5fb1('0x4'),_0x5fb1('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5fb1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e599bcd..817daf2 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 _0x5f66=['update','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x4d4e4a,_0x5b8edf){var _0x970acd=function(_0x3d7ab7){while(--_0x3d7ab7){_0x4d4e4a['push'](_0x4d4e4a['shift']());}};_0x970acd(++_0x5b8edf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['CloudProvider'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f0186,_0xdf728c){_0x1f0186=_0x1f0186-0x0;var _0x193747=_0x5f2f[_0x1f0186];return _0x193747;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 268812f..e5082a1 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 _0x4609=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0xc452a9,_0x349be2){var _0x3aff83=function(_0x40fdda){while(--_0x40fdda){_0xc452a9['push'](_0xc452a9['shift']());}};_0x3aff83(++_0x349be2);}(_0x4609,0x87));var _0x9460=function(_0x66435c,_0x53dae7){_0x66435c=_0x66435c-0x0;var _0x3c4230=_0x4609[_0x66435c];return _0x3c4230;};'use strict';var _=require(_0x9460('0x0'));var util=require(_0x9460('0x1'));var logger=require(_0x9460('0x2'))(_0x9460('0x3'));var moment=require(_0x9460('0x4'));var BPromise=require(_0x9460('0x5'));var rp=require(_0x9460('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9460('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x9460('0x8')]=function(_0x3c82b7,_0x1d6367){return _0x3c82b7[_0x9460('0x9')](_0x9460('0xa'),attributes,{'tableName':_0x9460('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bc3=['CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x7bc3,0x152));var _0x37bc=function(_0x3a09a5,_0x5ac78a){_0x3a09a5=_0x3a09a5-0x0;var _0x982ad4=_0x7bc3[_0x3a09a5];return _0x982ad4;};'use strict';var _=require('lodash');var util=require(_0x37bc('0x0'));var logger=require(_0x37bc('0x1'))(_0x37bc('0x2'));var moment=require(_0x37bc('0x3'));var BPromise=require(_0x37bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37bc('0x5'));var rimraf=require(_0x37bc('0x6'));var config=require(_0x37bc('0x7'));var attributes=require(_0x37bc('0x8'));module[_0x37bc('0x9')]=function(_0x4e09b5,_0x556577){return _0x4e09b5['define'](_0x37bc('0xa'),attributes,{'tableName':_0x37bc('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 b9ec6cb..6fc9939 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 _0x5a3c=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x8cdb08,_0x59062f){var _0xd348c3=function(_0x585252){while(--_0x585252){_0x8cdb08['push'](_0x8cdb08['shift']());}};_0xd348c3(++_0x59062f);}(_0x5a3c,0x176));var _0xc5a3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a3c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var moment=require(_0xc5a3('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5a3('0x3'));var fs=require('fs');var Redis=require(_0xc5a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5a3('0x5'));var logger=require(_0xc5a3('0x6'))(_0xc5a3('0x7'));var config=require(_0xc5a3('0x8'));var jayson=require(_0xc5a3('0x9'));var client=jayson[_0xc5a3('0xa')][_0xc5a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18657f,_0x202e42,_0x258d73){return new BPromise(function(_0x3f4f45,_0x237c8e){return client[_0xc5a3('0xc')](_0x18657f,_0x258d73)[_0xc5a3('0xd')](function(_0x4c1718){logger[_0xc5a3('0xe')](_0xc5a3('0xf'),_0x202e42,_0xc5a3('0x10'));logger[_0xc5a3('0x11')](_0xc5a3('0x12'),_0x202e42,_0xc5a3('0x10'),JSON[_0xc5a3('0x13')](_0x4c1718));if(_0x4c1718[_0xc5a3('0x14')]){if(_0x4c1718[_0xc5a3('0x14')]['code']===0x1f4){logger[_0xc5a3('0x14')](_0xc5a3('0xf'),_0x202e42,_0x4c1718[_0xc5a3('0x14')][_0xc5a3('0x15')]);return _0x237c8e(_0x4c1718[_0xc5a3('0x14')][_0xc5a3('0x15')]);}logger[_0xc5a3('0x14')](_0xc5a3('0xf'),_0x202e42,_0x4c1718[_0xc5a3('0x14')][_0xc5a3('0x15')]);return _0x3f4f45(_0x4c1718[_0xc5a3('0x14')][_0xc5a3('0x15')]);}else{logger[_0xc5a3('0xe')](_0xc5a3('0xf'),_0x202e42,_0xc5a3('0x10'));_0x3f4f45(_0x4c1718[_0xc5a3('0x16')][_0xc5a3('0x15')]);}})['catch'](function(_0xb9a90e){logger[_0xc5a3('0x14')]('CloudProvider,\x20%s,\x20%s',_0x202e42,_0xb9a90e);_0x237c8e(_0xb9a90e);});});} \ No newline at end of file +var _0xd237=['client','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x59a727,_0x1deda8){var _0x59fab7=function(_0x55e490){while(--_0x55e490){_0x59a727['push'](_0x59a727['shift']());}};_0x59fab7(++_0x1deda8);}(_0xd237,0x14f));var _0x7d23=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0xd237[_0x13606d];return _0x1b85b0;};'use strict';var _=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var moment=require(_0x7d23('0x2'));var BPromise=require(_0x7d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d23('0x4'));var db=require(_0x7d23('0x5'))['db'];var utils=require(_0x7d23('0x6'));var logger=require(_0x7d23('0x7'))(_0x7d23('0x8'));var config=require(_0x7d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca126,_0x48358f,_0xc43371){return new BPromise(function(_0x42c334,_0x6ce28d){return client[_0x7d23('0xb')](_0x5ca126,_0xc43371)[_0x7d23('0xc')](function(_0x23f1d6){logger[_0x7d23('0xd')](_0x7d23('0xe'),_0x48358f,'request\x20sent');logger[_0x7d23('0xf')](_0x7d23('0x10'),_0x48358f,_0x7d23('0x11'),JSON['stringify'](_0x23f1d6));if(_0x23f1d6[_0x7d23('0x12')]){if(_0x23f1d6['error'][_0x7d23('0x13')]===0x1f4){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x6ce28d(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x42c334(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}else{logger['info'](_0x7d23('0xe'),_0x48358f,'request\x20sent');_0x42c334(_0x23f1d6[_0x7d23('0x15')]['message']);}})[_0x7d23('0x16')](function(_0x46a35b){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x46a35b);_0x6ce28d(_0x46a35b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d947b03..b8e89b2 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 _0x0530=['delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','post','create','/:id'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x0530,0x72));var _0x0053=function(_0x455516,_0x1f8c2b){_0x455516=_0x455516-0x0;var _0x4e52bf=_0x0530[_0x455516];return _0x4e52bf;};'use strict';var multer=require(_0x0053('0x0'));var util=require(_0x0053('0x1'));var path=require('path');var timeout=require(_0x0053('0x2'));var express=require('express');var router=express[_0x0053('0x3')]();var fs_extra=require(_0x0053('0x4'));var auth=require(_0x0053('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0053('0x6'));var controller=require(_0x0053('0x7'));router[_0x0053('0x8')]('/',auth[_0x0053('0x9')](),controller[_0x0053('0xa')]);router['get']('/:id',auth[_0x0053('0x9')](),controller['show']);router[_0x0053('0xb')]('/',auth[_0x0053('0x9')](),controller[_0x0053('0xc')]);router['put'](_0x0053('0xd'),auth[_0x0053('0x9')](),controller['update']);router[_0x0053('0xe')](_0x0053('0xd'),auth[_0x0053('0x9')](),controller['destroy']);module[_0x0053('0xf')]=router; \ No newline at end of file +var _0xefcf=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x46ea03,_0x596b2a){var _0x398efe=function(_0x11286a){while(--_0x11286a){_0x46ea03['push'](_0x46ea03['shift']());}};_0x398efe(++_0x596b2a);}(_0xefcf,0x184));var _0xfefc=function(_0x3b2a34,_0x55027c){_0x3b2a34=_0x3b2a34-0x0;var _0x3304cd=_0xefcf[_0x3b2a34];return _0x3304cd;};'use strict';var multer=require(_0xfefc('0x0'));var util=require(_0xfefc('0x1'));var path=require(_0xfefc('0x2'));var timeout=require(_0xfefc('0x3'));var express=require(_0xfefc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfefc('0x5'));var interaction=require(_0xfefc('0x6'));var config=require(_0xfefc('0x7'));var controller=require('./cloudProvider.controller');router['get']('/',auth[_0xfefc('0x8')](),controller['index']);router['get'](_0xfefc('0x9'),auth[_0xfefc('0x8')](),controller[_0xfefc('0xa')]);router[_0xfefc('0xb')]('/',auth[_0xfefc('0x8')](),controller[_0xfefc('0xc')]);router['put']('/:id',auth[_0xfefc('0x8')](),controller[_0xfefc('0xd')]);router[_0xfefc('0xe')](_0xfefc('0x9'),auth[_0xfefc('0x8')](),controller[_0xfefc('0xf')]);module[_0xfefc('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index e9c1bb3..7bed676 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 _0x096b=['STRING','name','sequelize','exports'];(function(_0x4cff30,_0x546e46){var _0x46d1e7=function(_0x50acc9){while(--_0x50acc9){_0x4cff30['push'](_0x4cff30['shift']());}};_0x46d1e7(++_0x546e46);}(_0x096b,0x13e));var _0xb096=function(_0x44d267,_0x292a5a){_0x44d267=_0x44d267-0x0;var _0x511854=_0x096b[_0x44d267];return _0x511854;};'use strict';var Sequelize=require(_0xb096('0x0'));module[_0xb096('0x1')]={'name':{'type':Sequelize[_0xb096('0x2')],'unique':_0xb096('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb096('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xb096('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb096('0x2')]},'street':{'type':Sequelize[_0xb096('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb096('0x2')]},'country':{'type':Sequelize[_0xb096('0x2')]},'email':{'type':Sequelize[_0xb096('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb096('0x2')]},'sStreet':{'type':Sequelize[_0xb096('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xb096('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x28ed=['exports','name','STRING'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x28ed,0x1b9));var _0xd28e=function(_0x4523a6,_0xe60a70){_0x4523a6=_0x4523a6-0x0;var _0x1b461c=_0x28ed[_0x4523a6];return _0x1b461c;};'use strict';var Sequelize=require('sequelize');module[_0xd28e('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd28e('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd28e('0x2')]},'companyId':{'type':Sequelize[_0xd28e('0x2')]},'website':{'type':Sequelize[_0xd28e('0x2')]},'phone':{'type':Sequelize[_0xd28e('0x2')]},'fax':{'type':Sequelize[_0xd28e('0x2')]},'type':{'type':Sequelize[_0xd28e('0x2')]},'street':{'type':Sequelize[_0xd28e('0x2')]},'postalCode':{'type':Sequelize[_0xd28e('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd28e('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd28e('0x2')]},'sStreet':{'type':Sequelize[_0xd28e('0x2')]},'sPostalCode':{'type':Sequelize[_0xd28e('0x2')]},'sCity':{'type':Sequelize[_0xd28e('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd28e('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index fab95ae..758eb0d 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 _0xb915=['rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','omit','getContacts','rawAttributes','filter','eml-format','rimraf','zip-dir','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','then','destroy','get','Companies','UserProfileResource','error','stack','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','sort','pick','where','merge','map','options'];(function(_0x202b20,_0x5524e4){var _0x58135e=function(_0x2856f8){while(--_0x2856f8){_0x202b20['push'](_0x202b20['shift']());}};_0x58135e(++_0x5524e4);}(_0xb915,0x152));var _0x5b91=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb915[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x5b91('0x0'));var rimraf=require(_0x5b91('0x1'));var zipdir=require(_0x5b91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b91('0x3'));var BPromise=require(_0x5b91('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5b91('0x5'));var csv=require(_0x5b91('0x6'));var ejs=require(_0x5b91('0x7'));var fs=require('fs');var fs_extra=require(_0x5b91('0x8'));var _=require(_0x5b91('0x9'));var squel=require(_0x5b91('0xa'));var crypto=require(_0x5b91('0xb'));var jsforce=require(_0x5b91('0xc'));var deskjs=require(_0x5b91('0xd'));var toCsv=require(_0x5b91('0x6'));var querystring=require(_0x5b91('0xe'));var Papa=require(_0x5b91('0xf'));var Redis=require(_0x5b91('0x10'));var authService=require(_0x5b91('0x11'));var qs=require(_0x5b91('0x12'));var as=require(_0x5b91('0x13'));var hardwareService=require(_0x5b91('0x14'));var logger=require(_0x5b91('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5b91('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ef596,_0x26ac3d){_0x26ac3d=_0x26ac3d||0xcc;return function(_0x1eef03){if(_0x1eef03){return _0x3ef596[_0x5b91('0x17')](_0x26ac3d);}return _0x3ef596[_0x5b91('0x18')](_0x26ac3d)[_0x5b91('0x19')]();};}function respondWithResult(_0x57ed5c,_0x95572f){_0x95572f=_0x95572f||0xc8;return function(_0x2c7c33){if(_0x2c7c33){return _0x57ed5c[_0x5b91('0x18')](_0x95572f)[_0x5b91('0x1a')](_0x2c7c33);}};}function respondWithFilteredResult(_0x373d38,_0x5e694f){return function(_0x3ae58e){if(_0x3ae58e){var _0x19f5bb=typeof _0x5e694f['offset']===_0x5b91('0x1b')&&typeof _0x5e694f[_0x5b91('0x1c')]===_0x5b91('0x1b');var _0x9e9c5e=_0x3ae58e['count'];var _0x2fbfc6=_0x19f5bb?0x0:_0x5e694f[_0x5b91('0x1d')];var _0x1d69f2=_0x19f5bb?_0x3ae58e[_0x5b91('0x1e')]:_0x5e694f['offset']+_0x5e694f[_0x5b91('0x1c')];var _0x3140e3;if(_0x1d69f2>=_0x9e9c5e){_0x1d69f2=_0x9e9c5e;_0x3140e3=0xc8;}else{_0x3140e3=0xce;}_0x373d38[_0x5b91('0x18')](_0x3140e3);return _0x373d38['set'](_0x5b91('0x1f'),_0x2fbfc6+'-'+_0x1d69f2+'/'+_0x9e9c5e)[_0x5b91('0x1a')](_0x3ae58e);}return null;};}function patchUpdates(_0x36650e){return function(_0x4c2e6e){try{jsonpatch[_0x5b91('0x20')](_0x4c2e6e,_0x36650e,!![]);}catch(_0x346958){return BPromise[_0x5b91('0x21')](_0x346958);}return _0x4c2e6e['save']();};}function saveUpdates(_0x39e46c,_0x1652b0){return function(_0x3b1a0e){if(_0x3b1a0e){return _0x3b1a0e['update'](_0x39e46c)[_0x5b91('0x22')](function(_0x1ed63a){return _0x1ed63a;});}return null;};}function removeEntity(_0x2b717c,_0x197f00){return function(_0xae2407){if(_0xae2407){return _0xae2407[_0x5b91('0x23')]()[_0x5b91('0x22')](function(){var _0x593445=_0xae2407[_0x5b91('0x24')]({'plain':!![]});var _0x2c937a=_0x5b91('0x25');return db[_0x5b91('0x26')][_0x5b91('0x23')]({'where':{'type':_0x2c937a,'resourceId':_0x593445['id']}})[_0x5b91('0x22')](function(){return _0xae2407;});})[_0x5b91('0x22')](function(){_0x2b717c[_0x5b91('0x18')](0xcc)[_0x5b91('0x19')]();});}};}function handleEntityNotFound(_0x2c7b98,_0x522fdd){return function(_0x45c362){if(!_0x45c362){_0x2c7b98[_0x5b91('0x17')](0x194);}return _0x45c362;};}function handleError(_0x23539e,_0x313726){_0x313726=_0x313726||0x1f4;return function(_0xd450){logger[_0x5b91('0x27')](_0xd450[_0x5b91('0x28')]);if(_0xd450['name']){delete _0xd450['name'];}_0x23539e[_0x5b91('0x18')](_0x313726)['send'](_0xd450);};}exports['index']=function(_0x45eeb2,_0x17e5f5){var _0x30cdde={},_0x6c711f={},_0x3f3cdd={'count':0x0,'rows':[]};return db[_0x5b91('0x29')][_0x5b91('0x2a')]()[_0x5b91('0x22')](function(_0x35be8c){_0x6c711f[_0x5b91('0x2b')]=_[_0x5b91('0x2c')](_0x35be8c);_0x6c711f[_0x5b91('0x2d')]=_[_0x5b91('0x2c')](_0x45eeb2[_0x5b91('0x2d')]);_0x6c711f[_0x5b91('0x2e')]=_['intersection'](_0x6c711f['model'],_0x6c711f['query']);_0x30cdde[_0x5b91('0x2f')]=_[_0x5b91('0x30')](_0x6c711f[_0x5b91('0x2b')],qs[_0x5b91('0x31')](_0x45eeb2[_0x5b91('0x2d')][_0x5b91('0x31')]));_0x30cdde[_0x5b91('0x2f')]=_0x30cdde['attributes'][_0x5b91('0x32')]?_0x30cdde[_0x5b91('0x2f')]:_0x6c711f[_0x5b91('0x2b')];if(!_0x45eeb2[_0x5b91('0x2d')]['hasOwnProperty']('nolimit')){_0x30cdde[_0x5b91('0x1c')]=qs[_0x5b91('0x1c')](_0x45eeb2[_0x5b91('0x2d')]['limit']);_0x30cdde[_0x5b91('0x1d')]=qs[_0x5b91('0x1d')](_0x45eeb2[_0x5b91('0x2d')][_0x5b91('0x1d')]);}_0x30cdde['order']=qs[_0x5b91('0x33')](_0x45eeb2[_0x5b91('0x2d')][_0x5b91('0x33')]);_0x30cdde['where']=qs[_0x5b91('0x2e')](_[_0x5b91('0x34')](_0x45eeb2[_0x5b91('0x2d')],_0x6c711f[_0x5b91('0x2e')]),_0x35be8c);if(_0x45eeb2[_0x5b91('0x2d')]['filter']){_0x30cdde[_0x5b91('0x35')]=_[_0x5b91('0x36')](_0x30cdde[_0x5b91('0x35')],{'$or':_[_0x5b91('0x37')](_0x30cdde[_0x5b91('0x2f')],function(_0x171318){var _0xcda30c={};_0xcda30c[_0x171318]={'$like':'%'+_0x45eeb2[_0x5b91('0x2d')]['filter']+'%'};return _0xcda30c;})});}_0x30cdde=_[_0x5b91('0x36')]({},_0x30cdde,_0x45eeb2[_0x5b91('0x38')]);var _0x17b8cd={'where':_0x30cdde[_0x5b91('0x35')]};return db['CmCompany'][_0x5b91('0x1e')](_0x17b8cd)[_0x5b91('0x22')](function(_0x2de7c5){_0x3f3cdd[_0x5b91('0x1e')]=_0x2de7c5;if(_0x45eeb2['query']['includeAll']){_0x30cdde['include']=[{'all':!![]}];}return db[_0x5b91('0x29')]['findAll'](_0x30cdde);})['then'](function(_0xa45eef){_0x3f3cdd[_0x5b91('0x39')]=_0xa45eef;return _0x3f3cdd;})[_0x5b91('0x22')](respondWithFilteredResult(_0x17e5f5,_0x30cdde))[_0x5b91('0x3a')](handleError(_0x17e5f5,null));})[_0x5b91('0x3a')](handleError(_0x17e5f5,null));};exports[_0x5b91('0x3b')]=function(_0x3a9436,_0x3fa215){var _0x30ec7a={'raw':![],'where':{'id':_0x3a9436[_0x5b91('0x3c')]['id']}},_0x348d68={};_0x348d68[_0x5b91('0x2b')]=_[_0x5b91('0x2c')](db[_0x5b91('0x29')]['rawAttributes']);_0x348d68['query']=_[_0x5b91('0x2c')](_0x3a9436[_0x5b91('0x2d')]);_0x348d68[_0x5b91('0x2e')]=_[_0x5b91('0x30')](_0x348d68['model'],_0x348d68[_0x5b91('0x2d')]);_0x30ec7a[_0x5b91('0x2f')]=_[_0x5b91('0x30')](_0x348d68['model'],qs[_0x5b91('0x31')](_0x3a9436[_0x5b91('0x2d')][_0x5b91('0x31')]));_0x30ec7a[_0x5b91('0x2f')]=_0x30ec7a['attributes'][_0x5b91('0x32')]?_0x30ec7a['attributes']:_0x348d68['model'];if(_0x3a9436[_0x5b91('0x2d')][_0x5b91('0x3d')]){_0x30ec7a['include']=[{'all':!![]}];}_0x30ec7a=_[_0x5b91('0x36')]({},_0x30ec7a,_0x3a9436[_0x5b91('0x38')]);return db[_0x5b91('0x29')][_0x5b91('0x3e')](_0x30ec7a)[_0x5b91('0x22')](handleEntityNotFound(_0x3fa215,null))['then'](respondWithResult(_0x3fa215,null))[_0x5b91('0x3a')](handleError(_0x3fa215,null));};exports['create']=function(_0x13fe86,_0x46de85){return db[_0x5b91('0x29')][_0x5b91('0x3f')](_0x13fe86[_0x5b91('0x40')],{})[_0x5b91('0x22')](function(_0x2f1e22){var _0x22607b=_0x13fe86[_0x5b91('0x41')][_0x5b91('0x24')]({'plain':!![]});if(!_0x22607b)throw new Error(_0x5b91('0x42'));if(_0x22607b[_0x5b91('0x43')]===_0x5b91('0x41')){var _0x31be79=_0x2f1e22[_0x5b91('0x24')]({'plain':!![]});var _0x502288=_0x5b91('0x25');return db[_0x5b91('0x44')]['find']({'where':{'name':_0x502288,'userProfileId':_0x22607b[_0x5b91('0x45')]},'raw':!![]})[_0x5b91('0x22')](function(_0x1dfd6c){if(_0x1dfd6c&&_0x1dfd6c['autoAssociation']===0x0){return db[_0x5b91('0x26')][_0x5b91('0x3f')]({'name':_0x31be79[_0x5b91('0x46')],'resourceId':_0x31be79['id'],'type':_0x1dfd6c['name'],'sectionId':_0x1dfd6c['id']},{})[_0x5b91('0x22')](function(){return _0x2f1e22;});}else{return _0x2f1e22;}})[_0x5b91('0x3a')](function(_0x4ec4aa){logger[_0x5b91('0x27')](_0x5b91('0x47'),_0x4ec4aa);throw _0x4ec4aa;});}return _0x2f1e22;})[_0x5b91('0x22')](respondWithResult(_0x46de85,0xc9))[_0x5b91('0x3a')](handleError(_0x46de85,null));};exports['update']=function(_0x458e22,_0x1372c5){if(_0x458e22[_0x5b91('0x40')]['id']){delete _0x458e22[_0x5b91('0x40')]['id'];}return db[_0x5b91('0x29')]['find']({'where':{'id':_0x458e22[_0x5b91('0x3c')]['id']}})[_0x5b91('0x22')](handleEntityNotFound(_0x1372c5,null))[_0x5b91('0x22')](saveUpdates(_0x458e22[_0x5b91('0x40')],null))['then'](respondWithResult(_0x1372c5,null))[_0x5b91('0x3a')](handleError(_0x1372c5,null));};exports['destroy']=function(_0x18ce8d,_0x1da5bd){return db[_0x5b91('0x29')][_0x5b91('0x3e')]({'where':{'id':_0x18ce8d[_0x5b91('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1da5bd,null))['then'](removeEntity(_0x1da5bd,null))[_0x5b91('0x3a')](handleError(_0x1da5bd,null));};exports[_0x5b91('0x2a')]=function(_0x41894a,_0x59c16c){return db[_0x5b91('0x29')][_0x5b91('0x2a')]()['then'](respondWithResult(_0x59c16c,null))[_0x5b91('0x3a')](handleError(_0x59c16c,null));};exports['addContacts']=function(_0x28c3ba,_0x2eea74,_0x165beb){return db[_0x5b91('0x48')]['find']({'where':{'id':_0x28c3ba[_0x5b91('0x3c')]['id']}})[_0x5b91('0x22')](handleEntityNotFound(_0x2eea74,null))['then'](function(_0x103048){if(_0x103048){return _0x103048[_0x5b91('0x49')](_0x28c3ba[_0x5b91('0x40')][_0x5b91('0x4a')],_[_0x5b91('0x4b')](_0x28c3ba[_0x5b91('0x40')],[_0x5b91('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x2eea74,null))[_0x5b91('0x3a')](handleError(_0x2eea74,null));};exports[_0x5b91('0x4c')]=function(_0x100cf9,_0x36aa5f,_0x3dfd25){var _0x56a63b={};var _0xae008e={};var _0x45cbd8;var _0x3a4f2b;return db['CmCompany']['findOne']({'where':{'id':_0x100cf9[_0x5b91('0x3c')]['id']}})[_0x5b91('0x22')](handleEntityNotFound(_0x36aa5f,null))[_0x5b91('0x22')](function(_0x4e4366){if(_0x4e4366){_0x45cbd8=_0x4e4366;_0xae008e[_0x5b91('0x2b')]=_[_0x5b91('0x2c')](db[_0x5b91('0x48')][_0x5b91('0x4d')]);_0xae008e[_0x5b91('0x2d')]=_[_0x5b91('0x2c')](_0x100cf9[_0x5b91('0x2d')]);_0xae008e[_0x5b91('0x2e')]=_[_0x5b91('0x30')](_0xae008e['model'],_0xae008e[_0x5b91('0x2d')]);_0x56a63b[_0x5b91('0x2f')]=_['intersection'](_0xae008e[_0x5b91('0x2b')],qs[_0x5b91('0x31')](_0x100cf9[_0x5b91('0x2d')][_0x5b91('0x31')]));_0x56a63b['attributes']=_0x56a63b[_0x5b91('0x2f')][_0x5b91('0x32')]?_0x56a63b[_0x5b91('0x2f')]:_0xae008e['model'];_0x56a63b['order']=qs[_0x5b91('0x33')](_0x100cf9[_0x5b91('0x2d')]['sort']);_0x56a63b[_0x5b91('0x35')]=qs[_0x5b91('0x2e')](_[_0x5b91('0x34')](_0x100cf9['query'],_0xae008e[_0x5b91('0x2e')]));if(_0x100cf9['query'][_0x5b91('0x4e')]){_0x56a63b[_0x5b91('0x35')]=_[_0x5b91('0x36')](_0x56a63b['where'],{'$or':_[_0x5b91('0x37')](_0x56a63b[_0x5b91('0x2f')],function(_0x5e58b0){var _0x13f7fd={};_0x13f7fd[_0x5e58b0]={'$like':'%'+_0x100cf9['query'][_0x5b91('0x4e')]+'%'};return _0x13f7fd;})});}_0x56a63b=_['merge']({},_0x56a63b,_0x100cf9[_0x5b91('0x38')]);return _0x45cbd8['getContacts'](_0x56a63b);}})[_0x5b91('0x22')](function(_0x16c14e){if(_0x16c14e){_0x3a4f2b=_0x16c14e[_0x5b91('0x32')];if(!_0x100cf9[_0x5b91('0x2d')]['hasOwnProperty']('nolimit')){_0x56a63b[_0x5b91('0x1c')]=qs[_0x5b91('0x1c')](_0x100cf9[_0x5b91('0x2d')][_0x5b91('0x1c')]);_0x56a63b['offset']=qs[_0x5b91('0x1d')](_0x100cf9['query'][_0x5b91('0x1d')]);}return _0x45cbd8['getContacts'](_0x56a63b);}})[_0x5b91('0x22')](function(_0x18c66f){if(_0x18c66f){return _0x18c66f?{'count':_0x3a4f2b,'rows':_0x18c66f}:null;}})[_0x5b91('0x22')](respondWithResult(_0x36aa5f,null))[_0x5b91('0x3a')](handleError(_0x36aa5f,null));}; \ No newline at end of file +var _0xebdd=['json','offset','undefined','limit','count','set','apply','save','then','destroy','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','CmContact','ids','getContacts','findOne','rawAttributes','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x14d424,_0x4c84c6){var _0x4d954c=function(_0x28d093){while(--_0x28d093){_0x14d424['push'](_0x14d424['shift']());}};_0x4d954c(++_0x4c84c6);}(_0xebdd,0xe7));var _0xdebd=function(_0x20bc10,_0x35bed9){_0x20bc10=_0x20bc10-0x0;var _0x3bd5ce=_0xebdd[_0x20bc10];return _0x3bd5ce;};'use strict';var emlformat=require(_0xdebd('0x0'));var rimraf=require(_0xdebd('0x1'));var zipdir=require(_0xdebd('0x2'));var jsonpatch=require(_0xdebd('0x3'));var rp=require('request-promise');var moment=require(_0xdebd('0x4'));var BPromise=require(_0xdebd('0x5'));var Mustache=require('mustache');var util=require(_0xdebd('0x6'));var path=require('path');var sox=require(_0xdebd('0x7'));var csv=require(_0xdebd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdebd('0x9'));var _=require(_0xdebd('0xa'));var squel=require(_0xdebd('0xb'));var crypto=require(_0xdebd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdebd('0xd'));var toCsv=require(_0xdebd('0x8'));var querystring=require(_0xdebd('0xe'));var Papa=require(_0xdebd('0xf'));var Redis=require('ioredis');var authService=require(_0xdebd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdebd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdebd('0x12'))(_0xdebd('0x13'));var utils=require(_0xdebd('0x14'));var config=require(_0xdebd('0x15'));var licenseUtil=require(_0xdebd('0x16'));var db=require(_0xdebd('0x17'))['db'];function respondWithStatusCode(_0x1eb2ed,_0x217214){_0x217214=_0x217214||0xcc;return function(_0x228636){if(_0x228636){return _0x1eb2ed[_0xdebd('0x18')](_0x217214);}return _0x1eb2ed['status'](_0x217214)[_0xdebd('0x19')]();};}function respondWithResult(_0x7560a1,_0x33c8f8){_0x33c8f8=_0x33c8f8||0xc8;return function(_0x19a4ac){if(_0x19a4ac){return _0x7560a1[_0xdebd('0x1a')](_0x33c8f8)[_0xdebd('0x1b')](_0x19a4ac);}};}function respondWithFilteredResult(_0x20cc48,_0x54dda7){return function(_0x5cb517){if(_0x5cb517){var _0x134088=typeof _0x54dda7[_0xdebd('0x1c')]===_0xdebd('0x1d')&&typeof _0x54dda7[_0xdebd('0x1e')]==='undefined';var _0x432c54=_0x5cb517[_0xdebd('0x1f')];var _0x26507f=_0x134088?0x0:_0x54dda7[_0xdebd('0x1c')];var _0x561c64=_0x134088?_0x5cb517[_0xdebd('0x1f')]:_0x54dda7[_0xdebd('0x1c')]+_0x54dda7['limit'];var _0x34d1b1;if(_0x561c64>=_0x432c54){_0x561c64=_0x432c54;_0x34d1b1=0xc8;}else{_0x34d1b1=0xce;}_0x20cc48['status'](_0x34d1b1);return _0x20cc48[_0xdebd('0x20')]('Content-Range',_0x26507f+'-'+_0x561c64+'/'+_0x432c54)[_0xdebd('0x1b')](_0x5cb517);}return null;};}function patchUpdates(_0x25665c){return function(_0x3e3dec){try{jsonpatch[_0xdebd('0x21')](_0x3e3dec,_0x25665c,!![]);}catch(_0x103238){return BPromise['reject'](_0x103238);}return _0x3e3dec[_0xdebd('0x22')]();};}function saveUpdates(_0x583191,_0x3847c7){return function(_0x1c2048){if(_0x1c2048){return _0x1c2048['update'](_0x583191)[_0xdebd('0x23')](function(_0x23f7d2){return _0x23f7d2;});}return null;};}function removeEntity(_0x256c44,_0x2ce326){return function(_0x3b54a8){if(_0x3b54a8){return _0x3b54a8[_0xdebd('0x24')]()[_0xdebd('0x23')](function(){var _0x31bcb4=_0x3b54a8['get']({'plain':!![]});var _0x762974=_0xdebd('0x25');return db[_0xdebd('0x26')][_0xdebd('0x24')]({'where':{'type':_0x762974,'resourceId':_0x31bcb4['id']}})[_0xdebd('0x23')](function(){return _0x3b54a8;});})[_0xdebd('0x23')](function(){_0x256c44[_0xdebd('0x1a')](0xcc)[_0xdebd('0x19')]();});}};}function handleEntityNotFound(_0x59a3c7,_0x2195f9){return function(_0x14d1a4){if(!_0x14d1a4){_0x59a3c7['sendStatus'](0x194);}return _0x14d1a4;};}function handleError(_0x4092ca,_0x5dbd8a){_0x5dbd8a=_0x5dbd8a||0x1f4;return function(_0x22c7cf){logger[_0xdebd('0x27')](_0x22c7cf[_0xdebd('0x28')]);if(_0x22c7cf[_0xdebd('0x29')]){delete _0x22c7cf[_0xdebd('0x29')];}_0x4092ca['status'](_0x5dbd8a)[_0xdebd('0x2a')](_0x22c7cf);};}exports['index']=function(_0x4436c8,_0x31bceb){var _0x1d45e0={},_0x33c681={},_0x40385b={'count':0x0,'rows':[]};return db[_0xdebd('0x2b')][_0xdebd('0x2c')]()[_0xdebd('0x23')](function(_0x473d69){_0x33c681['model']=_[_0xdebd('0x2d')](_0x473d69);_0x33c681['query']=_[_0xdebd('0x2d')](_0x4436c8['query']);_0x33c681['filters']=_[_0xdebd('0x2e')](_0x33c681[_0xdebd('0x2f')],_0x33c681[_0xdebd('0x30')]);_0x1d45e0[_0xdebd('0x31')]=_[_0xdebd('0x2e')](_0x33c681[_0xdebd('0x2f')],qs[_0xdebd('0x32')](_0x4436c8['query'][_0xdebd('0x32')]));_0x1d45e0[_0xdebd('0x31')]=_0x1d45e0[_0xdebd('0x31')][_0xdebd('0x33')]?_0x1d45e0['attributes']:_0x33c681[_0xdebd('0x2f')];if(!_0x4436c8[_0xdebd('0x30')][_0xdebd('0x34')](_0xdebd('0x35'))){_0x1d45e0[_0xdebd('0x1e')]=qs['limit'](_0x4436c8['query']['limit']);_0x1d45e0[_0xdebd('0x1c')]=qs[_0xdebd('0x1c')](_0x4436c8['query']['offset']);}_0x1d45e0[_0xdebd('0x36')]=qs[_0xdebd('0x37')](_0x4436c8[_0xdebd('0x30')][_0xdebd('0x37')]);_0x1d45e0[_0xdebd('0x38')]=qs[_0xdebd('0x39')](_[_0xdebd('0x3a')](_0x4436c8[_0xdebd('0x30')],_0x33c681[_0xdebd('0x39')]),_0x473d69);if(_0x4436c8[_0xdebd('0x30')]['filter']){_0x1d45e0[_0xdebd('0x38')]=_[_0xdebd('0x3b')](_0x1d45e0[_0xdebd('0x38')],{'$or':_['map'](_0x1d45e0[_0xdebd('0x31')],function(_0x4e5a4e){var _0x45d33a={};_0x45d33a[_0x4e5a4e]={'$like':'%'+_0x4436c8[_0xdebd('0x30')][_0xdebd('0x3c')]+'%'};return _0x45d33a;})});}_0x1d45e0=_[_0xdebd('0x3b')]({},_0x1d45e0,_0x4436c8[_0xdebd('0x3d')]);var _0x119b6a={'where':_0x1d45e0['where']};return db['CmCompany'][_0xdebd('0x1f')](_0x119b6a)[_0xdebd('0x23')](function(_0x5060ef){_0x40385b[_0xdebd('0x1f')]=_0x5060ef;if(_0x4436c8['query'][_0xdebd('0x3e')]){_0x1d45e0[_0xdebd('0x3f')]=[{'all':!![]}];}return db['CmCompany'][_0xdebd('0x40')](_0x1d45e0);})[_0xdebd('0x23')](function(_0x227f84){_0x40385b[_0xdebd('0x41')]=_0x227f84;return _0x40385b;})['then'](respondWithFilteredResult(_0x31bceb,_0x1d45e0))[_0xdebd('0x42')](handleError(_0x31bceb,null));})[_0xdebd('0x42')](handleError(_0x31bceb,null));};exports[_0xdebd('0x43')]=function(_0x51799f,_0x75d592){var _0x521ca3={'raw':![],'where':{'id':_0x51799f['params']['id']}},_0x2221ca={};_0x2221ca['model']=_[_0xdebd('0x2d')](db[_0xdebd('0x2b')]['rawAttributes']);_0x2221ca[_0xdebd('0x30')]=_[_0xdebd('0x2d')](_0x51799f[_0xdebd('0x30')]);_0x2221ca[_0xdebd('0x39')]=_[_0xdebd('0x2e')](_0x2221ca[_0xdebd('0x2f')],_0x2221ca[_0xdebd('0x30')]);_0x521ca3['attributes']=_['intersection'](_0x2221ca['model'],qs[_0xdebd('0x32')](_0x51799f[_0xdebd('0x30')][_0xdebd('0x32')]));_0x521ca3[_0xdebd('0x31')]=_0x521ca3[_0xdebd('0x31')][_0xdebd('0x33')]?_0x521ca3[_0xdebd('0x31')]:_0x2221ca[_0xdebd('0x2f')];if(_0x51799f['query'][_0xdebd('0x3e')]){_0x521ca3[_0xdebd('0x3f')]=[{'all':!![]}];}_0x521ca3=_[_0xdebd('0x3b')]({},_0x521ca3,_0x51799f[_0xdebd('0x3d')]);return db['CmCompany'][_0xdebd('0x44')](_0x521ca3)[_0xdebd('0x23')](handleEntityNotFound(_0x75d592,null))[_0xdebd('0x23')](respondWithResult(_0x75d592,null))[_0xdebd('0x42')](handleError(_0x75d592,null));};exports[_0xdebd('0x45')]=function(_0x38eb7b,_0x3887c7){return db[_0xdebd('0x2b')][_0xdebd('0x45')](_0x38eb7b[_0xdebd('0x46')],{})['then'](function(_0x4eb177){var _0x3c43ef=_0x38eb7b[_0xdebd('0x47')][_0xdebd('0x48')]({'plain':!![]});if(!_0x3c43ef)throw new Error(_0xdebd('0x49'));if(_0x3c43ef['role']===_0xdebd('0x47')){var _0x1af3bc=_0x4eb177['get']({'plain':!![]});var _0xdcba3e=_0xdebd('0x25');return db[_0xdebd('0x4a')][_0xdebd('0x44')]({'where':{'name':_0xdcba3e,'userProfileId':_0x3c43ef[_0xdebd('0x4b')]},'raw':!![]})[_0xdebd('0x23')](function(_0x36a684){if(_0x36a684&&_0x36a684[_0xdebd('0x4c')]===0x0){return db[_0xdebd('0x26')][_0xdebd('0x45')]({'name':_0x1af3bc['name'],'resourceId':_0x1af3bc['id'],'type':_0x36a684[_0xdebd('0x29')],'sectionId':_0x36a684['id']},{})['then'](function(){return _0x4eb177;});}else{return _0x4eb177;}})[_0xdebd('0x42')](function(_0x490871){logger[_0xdebd('0x27')](_0xdebd('0x4d'),_0x490871);throw _0x490871;});}return _0x4eb177;})[_0xdebd('0x23')](respondWithResult(_0x3887c7,0xc9))[_0xdebd('0x42')](handleError(_0x3887c7,null));};exports[_0xdebd('0x4e')]=function(_0x492f5e,_0x21af13){if(_0x492f5e[_0xdebd('0x46')]['id']){delete _0x492f5e[_0xdebd('0x46')]['id'];}return db[_0xdebd('0x2b')]['find']({'where':{'id':_0x492f5e[_0xdebd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x21af13,null))[_0xdebd('0x23')](saveUpdates(_0x492f5e['body'],null))['then'](respondWithResult(_0x21af13,null))[_0xdebd('0x42')](handleError(_0x21af13,null));};exports['destroy']=function(_0x2735b5,_0x4c9d8d){return db[_0xdebd('0x2b')]['find']({'where':{'id':_0x2735b5[_0xdebd('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4c9d8d,null))[_0xdebd('0x23')](removeEntity(_0x4c9d8d,null))[_0xdebd('0x42')](handleError(_0x4c9d8d,null));};exports[_0xdebd('0x2c')]=function(_0x5f30e3,_0x1fbb70){return db[_0xdebd('0x2b')][_0xdebd('0x2c')]()[_0xdebd('0x23')](respondWithResult(_0x1fbb70,null))[_0xdebd('0x42')](handleError(_0x1fbb70,null));};exports['addContacts']=function(_0x2313f0,_0x44863d,_0x26fe7b){return db[_0xdebd('0x50')][_0xdebd('0x44')]({'where':{'id':_0x2313f0['params']['id']}})[_0xdebd('0x23')](handleEntityNotFound(_0x44863d,null))[_0xdebd('0x23')](function(_0x1243e7){if(_0x1243e7){return _0x1243e7['addContacts'](_0x2313f0['body'][_0xdebd('0x51')],_['omit'](_0x2313f0[_0xdebd('0x46')],[_0xdebd('0x51'),'id'])||{});}})[_0xdebd('0x23')](respondWithResult(_0x44863d,null))['catch'](handleError(_0x44863d,null));};exports[_0xdebd('0x52')]=function(_0x42a926,_0x57f936,_0x327b69){var _0x330ac7={};var _0x14681e={};var _0x399e7e;var _0x2d7fb7;return db['CmCompany'][_0xdebd('0x53')]({'where':{'id':_0x42a926['params']['id']}})['then'](handleEntityNotFound(_0x57f936,null))[_0xdebd('0x23')](function(_0xce5ca7){if(_0xce5ca7){_0x399e7e=_0xce5ca7;_0x14681e[_0xdebd('0x2f')]=_[_0xdebd('0x2d')](db[_0xdebd('0x50')][_0xdebd('0x54')]);_0x14681e[_0xdebd('0x30')]=_[_0xdebd('0x2d')](_0x42a926[_0xdebd('0x30')]);_0x14681e['filters']=_[_0xdebd('0x2e')](_0x14681e['model'],_0x14681e['query']);_0x330ac7[_0xdebd('0x31')]=_[_0xdebd('0x2e')](_0x14681e['model'],qs[_0xdebd('0x32')](_0x42a926[_0xdebd('0x30')][_0xdebd('0x32')]));_0x330ac7[_0xdebd('0x31')]=_0x330ac7['attributes'][_0xdebd('0x33')]?_0x330ac7[_0xdebd('0x31')]:_0x14681e[_0xdebd('0x2f')];_0x330ac7[_0xdebd('0x36')]=qs['sort'](_0x42a926[_0xdebd('0x30')]['sort']);_0x330ac7[_0xdebd('0x38')]=qs[_0xdebd('0x39')](_[_0xdebd('0x3a')](_0x42a926[_0xdebd('0x30')],_0x14681e[_0xdebd('0x39')]));if(_0x42a926[_0xdebd('0x30')][_0xdebd('0x3c')]){_0x330ac7[_0xdebd('0x38')]=_[_0xdebd('0x3b')](_0x330ac7[_0xdebd('0x38')],{'$or':_[_0xdebd('0x55')](_0x330ac7[_0xdebd('0x31')],function(_0x179943){var _0x25661b={};_0x25661b[_0x179943]={'$like':'%'+_0x42a926[_0xdebd('0x30')]['filter']+'%'};return _0x25661b;})});}_0x330ac7=_[_0xdebd('0x3b')]({},_0x330ac7,_0x42a926[_0xdebd('0x3d')]);return _0x399e7e[_0xdebd('0x52')](_0x330ac7);}})[_0xdebd('0x23')](function(_0x12b73c){if(_0x12b73c){_0x2d7fb7=_0x12b73c['length'];if(!_0x42a926[_0xdebd('0x30')]['hasOwnProperty'](_0xdebd('0x35'))){_0x330ac7[_0xdebd('0x1e')]=qs[_0xdebd('0x1e')](_0x42a926[_0xdebd('0x30')][_0xdebd('0x1e')]);_0x330ac7[_0xdebd('0x1c')]=qs[_0xdebd('0x1c')](_0x42a926[_0xdebd('0x30')][_0xdebd('0x1c')]);}return _0x399e7e[_0xdebd('0x52')](_0x330ac7);}})[_0xdebd('0x23')](function(_0x2e2ba0){if(_0x2e2ba0){return _0x2e2ba0?{'count':_0x2d7fb7,'rows':_0x2e2ba0}:null;}})[_0xdebd('0x23')](respondWithResult(_0x57f936,null))[_0xdebd('0x42')](handleError(_0x57f936,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b937d36..4836702 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 _0xc022=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x30d14d,_0x5b7cdc){var _0x47054e=function(_0x3535f2){while(--_0x3535f2){_0x30d14d['push'](_0x30d14d['shift']());}};_0x47054e(++_0x5b7cdc);}(_0xc022,0xfa));var _0x2c02=function(_0x3c013a,_0x3ee6ab){_0x3c013a=_0x3c013a-0x0;var _0x373dca=_0xc022[_0x3c013a];return _0x373dca;};'use strict';var _=require(_0x2c02('0x0'));var util=require(_0x2c02('0x1'));var logger=require(_0x2c02('0x2'))('api');var moment=require(_0x2c02('0x3'));var BPromise=require(_0x2c02('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c02('0x5'));var rimraf=require('rimraf');var config=require(_0x2c02('0x6'));var attributes=require(_0x2c02('0x7'));module[_0x2c02('0x8')]=function(_0x16b7be,_0x36e023){return _0x16b7be[_0x2c02('0x9')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd40=['CmCompany','cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x120da5,_0x35e37c){var _0x2564ab=function(_0x100133){while(--_0x100133){_0x120da5['push'](_0x120da5['shift']());}};_0x2564ab(++_0x35e37c);}(_0xdd40,0x84));var _0x0dd4=function(_0x606192,_0x1c2dfe){_0x606192=_0x606192-0x0;var _0x5cb292=_0xdd40[_0x606192];return _0x5cb292;};'use strict';var _=require(_0x0dd4('0x0'));var util=require(_0x0dd4('0x1'));var logger=require(_0x0dd4('0x2'))('api');var moment=require(_0x0dd4('0x3'));var BPromise=require(_0x0dd4('0x4'));var rp=require(_0x0dd4('0x5'));var fs=require('fs');var path=require(_0x0dd4('0x6'));var rimraf=require(_0x0dd4('0x7'));var config=require(_0x0dd4('0x8'));var attributes=require('./cmCompany.attributes');module[_0x0dd4('0x9')]=function(_0xeffa91,_0x4d0ea1){return _0xeffa91[_0x0dd4('0xa')](_0x0dd4('0xb'),attributes,{'tableName':_0x0dd4('0xc'),'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 127dcd5..46338f1 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 _0x1823=['http','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x2d0a91,_0x359212){var _0x5340c5=function(_0x2e816c){while(--_0x2e816c){_0x2d0a91['push'](_0x2d0a91['shift']());}};_0x5340c5(++_0x359212);}(_0x1823,0xda));var _0x3182=function(_0x45fbc7,_0x2cf50d){_0x45fbc7=_0x45fbc7-0x0;var _0x392cfd=_0x1823[_0x45fbc7];return _0x392cfd;};'use strict';var _=require(_0x3182('0x0'));var util=require(_0x3182('0x1'));var moment=require(_0x3182('0x2'));var BPromise=require(_0x3182('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3182('0x4'));var db=require(_0x3182('0x5'))['db'];var utils=require(_0x3182('0x6'));var logger=require(_0x3182('0x7'))('rpc');var config=require(_0x3182('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3182('0x9')][_0x3182('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17f2b6,_0x13686b,_0x13160c){return new BPromise(function(_0x4974d5,_0x5641f0){return client['request'](_0x17f2b6,_0x13160c)['then'](function(_0x56ed9b){logger[_0x3182('0xb')]('CmCompany,\x20%s,\x20%s',_0x13686b,_0x3182('0xc'));logger[_0x3182('0xd')](_0x3182('0xe'),_0x13686b,_0x3182('0xc'),JSON[_0x3182('0xf')](_0x56ed9b));if(_0x56ed9b['error']){if(_0x56ed9b['error']['code']===0x1f4){logger[_0x3182('0x10')]('CmCompany,\x20%s,\x20%s',_0x13686b,_0x56ed9b['error'][_0x3182('0x11')]);return _0x5641f0(_0x56ed9b['error'][_0x3182('0x11')]);}logger[_0x3182('0x10')]('CmCompany,\x20%s,\x20%s',_0x13686b,_0x56ed9b[_0x3182('0x10')][_0x3182('0x11')]);return _0x4974d5(_0x56ed9b[_0x3182('0x10')][_0x3182('0x11')]);}else{logger[_0x3182('0xb')]('CmCompany,\x20%s,\x20%s',_0x13686b,'request\x20sent');_0x4974d5(_0x56ed9b[_0x3182('0x12')]['message']);}})['catch'](function(_0x3c4a76){logger[_0x3182('0x10')]('CmCompany,\x20%s,\x20%s',_0x13686b,_0x3c4a76);_0x5641f0(_0x3c4a76);});});} \ No newline at end of file +var _0xf90d=['../../config/environment','http','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3a1054,_0x402349){var _0x28a812=function(_0x1c242e){while(--_0x1c242e){_0x3a1054['push'](_0x3a1054['shift']());}};_0x28a812(++_0x402349);}(_0xf90d,0xb4));var _0xdf90=function(_0x270263,_0x28ddea){_0x270263=_0x270263-0x0;var _0x3e1233=_0xf90d[_0x270263];return _0x3e1233;};'use strict';var _=require(_0xdf90('0x0'));var util=require(_0xdf90('0x1'));var moment=require(_0xdf90('0x2'));var BPromise=require(_0xdf90('0x3'));var rs=require(_0xdf90('0x4'));var fs=require('fs');var Redis=require(_0xdf90('0x5'));var db=require(_0xdf90('0x6'))['db'];var utils=require(_0xdf90('0x7'));var logger=require(_0xdf90('0x8'))('rpc');var config=require(_0xdf90('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdf90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc39e71,_0x2cd21a,_0x1e0376){return new BPromise(function(_0x3c836a,_0x26b736){return client['request'](_0xc39e71,_0x1e0376)[_0xdf90('0xb')](function(_0x57beeb){logger['info'](_0xdf90('0xc'),_0x2cd21a,_0xdf90('0xd'));logger[_0xdf90('0xe')](_0xdf90('0xf'),_0x2cd21a,_0xdf90('0xd'),JSON[_0xdf90('0x10')](_0x57beeb));if(_0x57beeb[_0xdf90('0x11')]){if(_0x57beeb['error']['code']===0x1f4){logger[_0xdf90('0x11')](_0xdf90('0xc'),_0x2cd21a,_0x57beeb[_0xdf90('0x11')][_0xdf90('0x12')]);return _0x26b736(_0x57beeb[_0xdf90('0x11')][_0xdf90('0x12')]);}logger[_0xdf90('0x11')]('CmCompany,\x20%s,\x20%s',_0x2cd21a,_0x57beeb['error'][_0xdf90('0x12')]);return _0x3c836a(_0x57beeb[_0xdf90('0x11')][_0xdf90('0x12')]);}else{logger['info'](_0xdf90('0xc'),_0x2cd21a,_0xdf90('0xd'));_0x3c836a(_0x57beeb[_0xdf90('0x13')]['message']);}})[_0xdf90('0x14')](function(_0x580fa0){logger[_0xdf90('0x11')](_0xdf90('0xc'),_0x2cd21a,_0x580fa0);_0x26b736(_0x580fa0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 96b6f8f..358ddc8 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 _0x9133=['path','connect-timeout','express','Router','../../components/interaction/service','./cmCompany.controller','index','get','isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','create','put','delete','destroy','exports','multer','util'];(function(_0x2b6a04,_0xf31c9c){var _0x13ebbe=function(_0x56c212){while(--_0x56c212){_0x2b6a04['push'](_0x2b6a04['shift']());}};_0x13ebbe(++_0xf31c9c);}(_0x9133,0x178));var _0x3913=function(_0x264ca3,_0x65b645){_0x264ca3=_0x264ca3-0x0;var _0x156d1e=_0x9133[_0x264ca3];return _0x156d1e;};'use strict';var multer=require(_0x3913('0x0'));var util=require(_0x3913('0x1'));var path=require(_0x3913('0x2'));var timeout=require(_0x3913('0x3'));var express=require(_0x3913('0x4'));var router=express[_0x3913('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3913('0x6'));var config=require('../../config/environment');var controller=require(_0x3913('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3913('0x8')]);router[_0x3913('0x9')]('/describe',auth[_0x3913('0xa')](),controller[_0x3913('0xb')]);router[_0x3913('0x9')](_0x3913('0xc'),auth[_0x3913('0xa')](),controller['show']);router['get'](_0x3913('0xd'),auth[_0x3913('0xa')](),controller[_0x3913('0xe')]);router[_0x3913('0xf')]('/',auth[_0x3913('0xa')](),controller[_0x3913('0x10')]);router[_0x3913('0xf')](_0x3913('0xd'),auth['isAuthenticated'](),controller['addContacts']);router[_0x3913('0x11')](_0x3913('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3913('0x12')](_0x3913('0xc'),auth[_0x3913('0xa')](),controller[_0x3913('0x13')]);module[_0x3913('0x14')]=router; \ No newline at end of file +var _0x9a46=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','delete','destroy','exports','util','path'];(function(_0x313653,_0x25f119){var _0x19f864=function(_0x3ccd3b){while(--_0x3ccd3b){_0x313653['push'](_0x313653['shift']());}};_0x19f864(++_0x25f119);}(_0x9a46,0xa6));var _0x69a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9a46[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x69a4('0x0'));var path=require(_0x69a4('0x1'));var timeout=require(_0x69a4('0x2'));var express=require(_0x69a4('0x3'));var router=express[_0x69a4('0x4')]();var fs_extra=require(_0x69a4('0x5'));var auth=require(_0x69a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x69a4('0x7'));var controller=require(_0x69a4('0x8'));router[_0x69a4('0x9')]('/',auth[_0x69a4('0xa')](),controller[_0x69a4('0xb')]);router['get'](_0x69a4('0xc'),auth['isAuthenticated'](),controller[_0x69a4('0xd')]);router[_0x69a4('0x9')](_0x69a4('0xe'),auth[_0x69a4('0xa')](),controller[_0x69a4('0xf')]);router[_0x69a4('0x9')](_0x69a4('0x10'),auth['isAuthenticated'](),controller[_0x69a4('0x11')]);router['post']('/',auth[_0x69a4('0xa')](),controller['create']);router[_0x69a4('0x12')](_0x69a4('0x10'),auth[_0x69a4('0xa')](),controller[_0x69a4('0x13')]);router[_0x69a4('0x14')](_0x69a4('0xe'),auth[_0x69a4('0xa')](),controller['update']);router[_0x69a4('0x15')]('/:id',auth[_0x69a4('0xa')](),controller[_0x69a4('0x16')]);module[_0x69a4('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index cb55188..2044a1d 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 _0xf5d3=['DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x520ce3,_0xcc8c1c){var _0x24e8f7=function(_0x48444c){while(--_0x48444c){_0x520ce3['push'](_0x520ce3['shift']());}};_0x24e8f7(++_0xcc8c1c);}(_0xf5d3,0x72));var _0x3f5d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf5d3[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var Sequelize=require(_0x3f5d('0x0'));module[_0x3f5d('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x3f5d('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3f5d('0x2')]},'dateOfBirth':{'type':Sequelize[_0x3f5d('0x2')]},'description':{'type':Sequelize[_0x3f5d('0x3')]},'phone':{'type':Sequelize[_0x3f5d('0x2')]},'mobile':{'type':Sequelize[_0x3f5d('0x2')]},'fax':{'type':Sequelize[_0x3f5d('0x2')]},'email':{'type':Sequelize[_0x3f5d('0x2')]},'url':{'type':Sequelize[_0x3f5d('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x3f5d('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x3f5d('0x2')]},'viber':{'type':Sequelize[_0x3f5d('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x3f5d('0x2')]},'UserId':{'type':Sequelize[_0x3f5d('0x4')]},'priority':{'type':Sequelize[_0x3f5d('0x4')](0x2)[_0x3f5d('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3f5d('0x6')],'defaultValue':Sequelize[_0x3f5d('0x7')]}}; \ No newline at end of file +var _0x5aa4=['STRING','INTEGER','DATE','NOW','lodash','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5aa4,0x177));var _0x45aa=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x5aa4[_0x58a4ac];return _0x545810;};'use strict';var _=require(_0x45aa('0x0'));var Sequelize=require(_0x45aa('0x1'));module[_0x45aa('0x2')]={'firstName':{'type':Sequelize[_0x45aa('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x45aa('0x3')]},'city':{'type':Sequelize[_0x45aa('0x3')]},'country':{'type':Sequelize[_0x45aa('0x3')]},'dateOfBirth':{'type':Sequelize[_0x45aa('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x45aa('0x3')]},'fax':{'type':Sequelize[_0x45aa('0x3')]},'email':{'type':Sequelize[_0x45aa('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x45aa('0x3')]},'fb_data':{'type':Sequelize[_0x45aa('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x45aa('0x3')]},'teams':{'type':Sequelize[_0x45aa('0x3')]},'viber':{'type':Sequelize[_0x45aa('0x3')]},'line':{'type':Sequelize[_0x45aa('0x3')]},'wechat':{'type':Sequelize[_0x45aa('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x45aa('0x4')]},'priority':{'type':Sequelize[_0x45aa('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x45aa('0x5')],'defaultValue':Sequelize[_0x45aa('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index ecff34d..d6ef941 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 _0x42f5=['then','destroy','error','stack','name','send','CmContact','describe','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','length','fieldType','type','model','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','field','from','select','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','Tag','value','split','map','forEach','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','hasOwnProperty','filter','isNil','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','role','agent','some','user','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','columnName','findAll','displayName','alias','values','body','get','mergeWith','tags','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','duplicates','$or','findOrCreate','spread','show','params','omit','format','cf_%d','$and','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','ids','getHoppers','includeAll','getHopperHistories','getHopperFinals','CmHopperFinal','ContactId','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','pid','upload','createReadStream','parse','binding','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','mail','chat','sms','openchannel','fax','whatsapp','voice','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','VoiceCallReport','findAndCountAll','startCase','Website','Account','closedAt','secondDisposition','thirdDisposition','fullname','color','browserName','customerIp','deviceModel','ratingType','ratingValue','subject','substatus','threadId','Interaction','Owner','flatten','sortBy','reverse','slice','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x42f5,0xfe));var _0x542f=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x42f5[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x542f('0x0'));var zipdir=require(_0x542f('0x1'));var jsonpatch=require(_0x542f('0x2'));var rp=require(_0x542f('0x3'));var moment=require(_0x542f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x542f('0x5'));var util=require(_0x542f('0x6'));var path=require(_0x542f('0x7'));var sox=require('sox');var csv=require(_0x542f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x542f('0x9'));var squel=require(_0x542f('0xa'));var crypto=require(_0x542f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x542f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x542f('0xd'));var Papa=require(_0x542f('0xe'));var Redis=require(_0x542f('0xf'));var authService=require(_0x542f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x542f('0x11'));var hardwareService=require(_0x542f('0x12'));var logger=require(_0x542f('0x13'))(_0x542f('0x14'));var utils=require(_0x542f('0x15'));var config=require(_0x542f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x542f('0x17')](config[_0x542f('0x18')],{'host':_0x542f('0x19'),'port':0x18eb});var socket=require(_0x542f('0x1a'))(new Redis(config[_0x542f('0x18')]));require(_0x542f('0x1b'))[_0x542f('0x1c')](socket);function respondWithStatusCode(_0x652c9a,_0x34b9e3){_0x34b9e3=_0x34b9e3||0xcc;return function(_0x589eb5){if(_0x589eb5){return _0x652c9a[_0x542f('0x1d')](_0x34b9e3);}return _0x652c9a[_0x542f('0x1e')](_0x34b9e3)[_0x542f('0x1f')]();};}function respondWithResult(_0x29fdc8,_0xc6d754){_0xc6d754=_0xc6d754||0xc8;return function(_0x2223da){if(_0x2223da){return _0x29fdc8[_0x542f('0x1e')](_0xc6d754)[_0x542f('0x20')](_0x2223da);}};}function respondWithFilteredResult(_0x3e0502,_0x27dcda){return function(_0x33e748){if(_0x33e748){var _0x286368=typeof _0x27dcda[_0x542f('0x21')]===_0x542f('0x22')&&typeof _0x27dcda[_0x542f('0x23')]===_0x542f('0x22');var _0x1ae3fc=_0x33e748[_0x542f('0x24')];var _0x40f1d2=_0x286368?0x0:_0x27dcda['offset'];var _0x1a1da6=_0x286368?_0x33e748[_0x542f('0x24')]:_0x27dcda[_0x542f('0x21')]+_0x27dcda[_0x542f('0x23')];var _0x40cd72;if(_0x1a1da6>=_0x1ae3fc){_0x1a1da6=_0x1ae3fc;_0x40cd72=0xc8;}else{_0x40cd72=0xce;}_0x3e0502['status'](_0x40cd72);return _0x3e0502[_0x542f('0x25')](_0x542f('0x26'),_0x40f1d2+'-'+_0x1a1da6+'/'+_0x1ae3fc)[_0x542f('0x20')](_0x33e748);}return null;};}function patchUpdates(_0x1561fb){return function(_0x24332d){try{jsonpatch['apply'](_0x24332d,_0x1561fb,!![]);}catch(_0x1838cb){return BPromise['reject'](_0x1838cb);}return _0x24332d['save']();};}function saveUpdates(_0x1958a1,_0x2c2bce){return function(_0x1c5b31){if(_0x1c5b31){return _0x1c5b31[_0x542f('0x27')](_0x1958a1)[_0x542f('0x28')](function(_0x5b807f){return _0x5b807f;});}return null;};}function removeEntity(_0x4247e5,_0x4b3dc7){return function(_0x5b6240){if(_0x5b6240){return _0x5b6240[_0x542f('0x29')]()['then'](function(){_0x4247e5[_0x542f('0x1e')](0xcc)[_0x542f('0x1f')]();});}};}function handleEntityNotFound(_0x2f31f7,_0x38fa3b){return function(_0x321d12){if(!_0x321d12){_0x2f31f7[_0x542f('0x1d')](0x194);}return _0x321d12;};}function handleError(_0x3d9cf8,_0xd9d318){_0xd9d318=_0xd9d318||0x1f4;return function(_0x1fcd06){logger[_0x542f('0x2a')](_0x1fcd06[_0x542f('0x2b')]);if(_0x1fcd06['name']){delete _0x1fcd06[_0x542f('0x2c')];}_0x3d9cf8['status'](_0xd9d318)[_0x542f('0x2d')](_0x1fcd06);};}exports['index']=function(_0x31c41d,_0x3d34aa){var _0x204b6e={},_0x80ac2e={},_0x46c255={'count':0x0,'rows':[]};return db[_0x542f('0x2e')][_0x542f('0x2f')]()[_0x542f('0x28')](function(_0x184512){var _0x3a3504=[];for(var _0x1bfbfe=0x0;_0x1bfbfe0x1){_0x55807a['or'](_0x542f('0x71'),qs[_0x542f('0x72')](_0x1bc198),null);}else{if(qs[_0x542f('0x73')](_0x1bc198)){_0x55807a['or'](_0x542f('0x74'),_0x1bc198+'%');_0x55807a['or']('c.phone\x20LIKE\x20?',_0x1bc198+'%');_0x55807a['or']('c.mobile\x20LIKE\x20?',_0x1bc198+'%');_0x55807a['or'](_0x542f('0x75'),_0x1bc198+'%');}else if(qs['isEmail'](_0x1bc198)){_0x55807a['or'](_0x542f('0x76'),_0x1bc198+'%');}else{_0x55807a['or']('c.firstName\x20LIKE\x20?','%'+_0x1bc198+'%');_0x55807a['or']('c.lastName\x20LIKE\x20?','%'+_0x1bc198+'%');_0x55807a['or'](_0x542f('0x76'),'%'+_0x1bc198+'%');}}}}_0x56fc63[_0x542f('0x43')](_0x55807a);_0x56fc63[_0x542f('0x77')](_0x542f('0x78'));var _0x31210a={'type':db[_0x542f('0x79')][_0x542f('0x7a')][_0x542f('0x7b')],'raw':!![]};var _0x48bfa5=_0x56fc63[_0x542f('0x7c')]()[_0x542f('0x46')](_0x542f('0x78'));if(_0x204b6e[_0x542f('0x41')]){_0x204b6e[_0x542f('0x41')]['forEach'](function(_0x5cf3e2){_0x56fc63['order']('c.'+_0x5cf3e2[0x0],_0x5cf3e2[0x1]===_0x542f('0x7d')?![]:!![]);});}if(!_['isEmpty'](_0x280c7e)){_0x56fc63[_0x542f('0x7e')](_0x5adfaf);_0x48bfa5[_0x542f('0x43')](_0x542f('0x7f'),_0x280c7e);}BPromise[_0x542f('0x80')]()[_0x542f('0x28')](function(){if(!_0x1e623b)return;if(_0x31c41d['user'][_0x542f('0x81')]!==_0x542f('0x82'))return;if(!_[_0x542f('0x83')](_0x1e623b['conditions'],[_0x542f('0x46'),_0x542f('0x5b')])){return _0x31c41d[_0x542f('0x84')]['getLists']({'attributes':['id'],'raw':!![]})[_0x542f('0x28')](function(_0x308658){if(_[_0x542f('0x69')](_0x308658)){_0x48bfa5[_0x542f('0x43')]('c.ListId\x20IS\x20NULL');_0x56fc63[_0x542f('0x43')](_0x542f('0x85'));}else{_0x48bfa5[_0x542f('0x43')]('c.ListId\x20IN\x20?',_[_0x542f('0x58')](_0x308658,'id'));_0x56fc63[_0x542f('0x43')](_0x542f('0x86'),_['map'](_0x308658,'id'));}});}})[_0x542f('0x28')](function(){if(_0x31c41d[_0x542f('0x84')][_0x542f('0x81')]==='agent'&&!_0x1e623b&&!_0x31c41d[_0x542f('0x3c')]['ListId'])return[];return db[_0x542f('0x87')]['query'](_0x48bfa5[_0x542f('0x88')](),_0x31210a);})[_0x542f('0x28')](function(_0x39883e){_0x46c255[_0x542f('0x24')]=_0x39883e[_0x542f('0x38')];if(_0x46c255[_0x542f('0x24')]===0x0)return[];return db['sequelize'][_0x542f('0x3c')](_0x5831c3[_0x542f('0x88')](),_0x31210a)['then'](function(_0x3da5d4){_0x4144c1=_[_0x542f('0x89')](_0x3da5d4,'id');_0x31210a=_[_0x542f('0x8a')](_0x31210a,{'model':db[_0x542f('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31c41d[_0x542f('0x3c')]['fields']){_0x204b6e['attributes']['forEach'](function(_0x4e6a5c){_0x56fc63[_0x542f('0x46')]('c.'+_0x4e6a5c);});}else{_0x56fc63['field'](_0x542f('0x78'));_0x56fc63['field'](_0x542f('0x8b'));_0x56fc63[_0x542f('0x46')](_0x542f('0x8c'));_0x56fc63['field'](_0x542f('0x8d'));_0x56fc63['field'](_0x542f('0x8e'));_0x56fc63['field'](_0x542f('0x8f'));_0x56fc63[_0x542f('0x46')](_0x542f('0x90'));_0x56fc63[_0x542f('0x46')]('c.ListId');_0x56fc63[_0x542f('0x46')]('c.createdAt');_0x56fc63['field'](_0x542f('0x91'));_0x56fc63[_0x542f('0x46')](_0x542f('0x92'));_0x56fc63[_0x542f('0x46')](_0x542f('0x93'),'TagIds');}if(_0x204b6e[_0x542f('0x23')])_0x56fc63[_0x542f('0x23')](_0x204b6e[_0x542f('0x23')]);if(_0x204b6e[_0x542f('0x21')])_0x56fc63[_0x542f('0x21')](_0x204b6e[_0x542f('0x21')]);return db['sequelize'][_0x542f('0x3c')](_0x56fc63[_0x542f('0x88')](),_0x31210a);});})[_0x542f('0x28')](function(_0x144d95){_0x144d95['forEach'](function(_0x216fea){if(_0x216fea[_0x542f('0x94')]){_0x216fea[_0x542f('0x95')]=[];_0x216fea[_0x542f('0x94')]['split'](',')[_0x542f('0x59')](function(_0x3a7184){_0x216fea[_0x542f('0x95')]['push'](_0x4144c1[_0x3a7184]);});}delete _0x216fea[_0x542f('0x94')];});_0x46c255[_0x542f('0x96')]=_0x144d95;return _0x46c255;})['then'](respondWithFilteredResult(_0x3d34aa,_0x204b6e));})['catch'](handleError(_0x3d34aa,null));};exports[_0x542f('0x29')]=function(_0x3691c9,_0x458a8c){return db[_0x542f('0x2e')]['find']({'where':{'id':_0x3691c9['params']['id']}})[_0x542f('0x28')](handleEntityNotFound(_0x458a8c,null))[_0x542f('0x28')](removeEntity(_0x458a8c,null))[_0x542f('0x97')](handleError(_0x458a8c,null));};exports['describe']=function(_0x2b44e5,_0x436468){return db['CmContact']['describe']()[_0x542f('0x28')](function(_0x3bb5a7){delete _0x3bb5a7['tags'];for(var _0x3b9664=0x0;_0x3b9664=_0x3c7fdb){_0x54f771=_0x3c7fdb;_0x5d37ed=0xc8;}else{_0x5d37ed=0xce;}_0x114f35[_0x2179('0x20')](_0x5d37ed);return _0x114f35[_0x2179('0x26')](_0x2179('0x27'),_0x48212b+'-'+_0x54f771+'/'+_0x3c7fdb)[_0x2179('0x28')](_0x243538);}return null;};}function patchUpdates(_0xe2ef6d){return function(_0x484b8b){try{jsonpatch[_0x2179('0x29')](_0x484b8b,_0xe2ef6d,!![]);}catch(_0x230b1f){return BPromise[_0x2179('0x2a')](_0x230b1f);}return _0x484b8b[_0x2179('0x2b')]();};}function saveUpdates(_0x590027,_0x3819a0){return function(_0x3f70eb){if(_0x3f70eb){return _0x3f70eb[_0x2179('0x2c')](_0x590027)[_0x2179('0x2d')](function(_0x122aa4){return _0x122aa4;});}return null;};}function removeEntity(_0x188875,_0xd0d681){return function(_0x482cfd){if(_0x482cfd){return _0x482cfd['destroy']()[_0x2179('0x2d')](function(){_0x188875[_0x2179('0x20')](0xcc)[_0x2179('0x21')]();});}};}function handleEntityNotFound(_0x182016,_0x103e21){return function(_0x366b57){if(!_0x366b57){_0x182016[_0x2179('0x2e')](0x194);}return _0x366b57;};}function handleError(_0x499b02,_0x363159){_0x363159=_0x363159||0x1f4;return function(_0x1db5cf){logger[_0x2179('0x2f')](_0x1db5cf[_0x2179('0x30')]);if(_0x1db5cf['name']){delete _0x1db5cf[_0x2179('0x31')];}_0x499b02['status'](_0x363159)[_0x2179('0x32')](_0x1db5cf);};}exports[_0x2179('0x33')]=function(_0x3579bf,_0x3df064){var _0x40cb0e={},_0x2c5e07={},_0x5c5a06={'count':0x0,'rows':[]};return db['CmContact'][_0x2179('0x34')]()[_0x2179('0x2d')](function(_0x1153d3){var _0xe262fe=[];for(var _0x312b7b=0x0;_0x312b7b0x1){_0x3a1d46['or'](_0x2179('0x70'),qs[_0x2179('0x71')](_0x36f250),null);}else{if(qs[_0x2179('0x72')](_0x36f250)){_0x3a1d46['or'](_0x2179('0x73'),_0x36f250+'%');_0x3a1d46['or'](_0x2179('0x74'),_0x36f250+'%');_0x3a1d46['or'](_0x2179('0x75'),_0x36f250+'%');_0x3a1d46['or'](_0x2179('0x76'),_0x36f250+'%');}else if(qs[_0x2179('0x77')](_0x36f250)){_0x3a1d46['or'](_0x2179('0x78'),_0x36f250+'%');}else{_0x3a1d46['or']('c.firstName\x20LIKE\x20?','%'+_0x36f250+'%');_0x3a1d46['or'](_0x2179('0x79'),'%'+_0x36f250+'%');_0x3a1d46['or'](_0x2179('0x78'),'%'+_0x36f250+'%');}}}}_0x34d8d0[_0x2179('0x47')](_0x3a1d46);_0x34d8d0['group'](_0x2179('0x7a'));var _0x552626={'type':db['Sequelize'][_0x2179('0x7b')][_0x2179('0x7c')],'raw':!![]};var _0x1aa787=_0x34d8d0[_0x2179('0x7d')]()[_0x2179('0x49')](_0x2179('0x7a'));if(_0x40cb0e['order']){_0x40cb0e[_0x2179('0x45')][_0x2179('0x6e')](function(_0x4919e0){_0x34d8d0[_0x2179('0x45')]('c.'+_0x4919e0[0x0],_0x4919e0[0x1]===_0x2179('0x7e')?![]:!![]);});}if(!_['isEmpty'](_0x12c226)){_0x34d8d0['having'](_0x5b0f68);_0x1aa787[_0x2179('0x47')]('t.id\x20IN\x20?',_0x12c226);}BPromise[_0x2179('0x7f')]()[_0x2179('0x2d')](function(){if(!_0x3f4698)return;if(_0x3579bf[_0x2179('0x80')]['role']!=='agent')return;if(!_[_0x2179('0x81')](_0x3f4698[_0x2179('0x56')],[_0x2179('0x49'),_0x2179('0x5c')])){return _0x3579bf['user'][_0x2179('0x82')]({'attributes':['id'],'raw':!![]})[_0x2179('0x2d')](function(_0x3fce38){if(_[_0x2179('0x66')](_0x3fce38)){_0x1aa787['where'](_0x2179('0x83'));_0x34d8d0[_0x2179('0x47')](_0x2179('0x83'));}else{_0x1aa787[_0x2179('0x47')](_0x2179('0x68'),_['map'](_0x3fce38,'id'));_0x34d8d0['where']('c.ListId\x20IN\x20?',_[_0x2179('0x59')](_0x3fce38,'id'));}});}})[_0x2179('0x2d')](function(){if(_0x3579bf['user'][_0x2179('0x84')]===_0x2179('0x85')&&!_0x3f4698&&!_0x3579bf[_0x2179('0x3d')]['ListId'])return[];return db[_0x2179('0x86')][_0x2179('0x3d')](_0x1aa787[_0x2179('0x87')](),_0x552626);})[_0x2179('0x2d')](function(_0x1436a6){_0x5c5a06[_0x2179('0x25')]=_0x1436a6[_0x2179('0x3a')];if(_0x5c5a06[_0x2179('0x25')]===0x0)return[];return db[_0x2179('0x86')][_0x2179('0x3d')](_0x2ebd16[_0x2179('0x87')](),_0x552626)[_0x2179('0x2d')](function(_0x514e64){_0x2761b8=_[_0x2179('0x88')](_0x514e64,'id');_0x552626=_['merge'](_0x552626,{'model':db[_0x2179('0x89')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3579bf[_0x2179('0x3d')][_0x2179('0x42')]){_0x40cb0e[_0x2179('0x40')][_0x2179('0x6e')](function(_0x13d70e){_0x34d8d0[_0x2179('0x49')]('c.'+_0x13d70e);});}else{_0x34d8d0[_0x2179('0x49')](_0x2179('0x7a'));_0x34d8d0[_0x2179('0x49')]('c.firstName');_0x34d8d0[_0x2179('0x49')]('c.lastName');_0x34d8d0[_0x2179('0x49')](_0x2179('0x8a'));_0x34d8d0[_0x2179('0x49')]('c.mobile');_0x34d8d0['field'](_0x2179('0x8b'));_0x34d8d0[_0x2179('0x49')](_0x2179('0x8c'));_0x34d8d0[_0x2179('0x49')](_0x2179('0x8d'));_0x34d8d0['field'](_0x2179('0x8e'));_0x34d8d0['field'](_0x2179('0x8f'));_0x34d8d0[_0x2179('0x49')]('c.CompanyId');_0x34d8d0[_0x2179('0x49')](_0x2179('0x90'),_0x2179('0x91'));}if(_0x40cb0e[_0x2179('0x24')])_0x34d8d0[_0x2179('0x24')](_0x40cb0e[_0x2179('0x24')]);if(_0x40cb0e[_0x2179('0x22')])_0x34d8d0[_0x2179('0x22')](_0x40cb0e[_0x2179('0x22')]);return db[_0x2179('0x86')][_0x2179('0x3d')](_0x34d8d0[_0x2179('0x87')](),_0x552626);});})['then'](function(_0x3e0b3b){_0x3e0b3b[_0x2179('0x6e')](function(_0x2c8b66){if(_0x2c8b66[_0x2179('0x91')]){_0x2c8b66['Tags']=[];_0x2c8b66[_0x2179('0x91')][_0x2179('0x58')](',')[_0x2179('0x6e')](function(_0x5d74c9){_0x2c8b66[_0x2179('0x92')][_0x2179('0x37')](_0x2761b8[_0x5d74c9]);});}delete _0x2c8b66['TagIds'];});_0x5c5a06[_0x2179('0x93')]=_0x3e0b3b;return _0x5c5a06;})[_0x2179('0x2d')](respondWithFilteredResult(_0x3df064,_0x40cb0e));})['catch'](handleError(_0x3df064,null));};exports[_0x2179('0x94')]=function(_0x119c52,_0xf54d6d){return db[_0x2179('0x89')][_0x2179('0x95')]({'where':{'id':_0x119c52['params']['id']}})[_0x2179('0x2d')](handleEntityNotFound(_0xf54d6d,null))[_0x2179('0x2d')](removeEntity(_0xf54d6d,null))[_0x2179('0x96')](handleError(_0xf54d6d,null));};exports[_0x2179('0x34')]=function(_0x3fd753,_0x3dd11f){return db[_0x2179('0x89')][_0x2179('0x34')]()[_0x2179('0x2d')](function(_0x40c4c2){delete _0x40c4c2[_0x2179('0x97')];for(var _0x37adaf=0x0;_0x37adaf{}\s\\|]/g,'-');_0x1b53fa(null,util[_0xf24e('0x25')](_0xf24e('0x26'),path[_0xf24e('0x27')](_0x42c97d[_0xf24e('0x24')],path[_0xf24e('0x28')](_0x42c97d['originalname'])),Date[_0xf24e('0x29')](),path['extname'](_0x42c97d[_0xf24e('0x24')])));}})});router[_0xf24e('0x1b')]('/csv',upload[_0xf24e('0x2a')](_0xf24e('0x2b')),controller[_0xf24e('0x2c')]);var upload=multer({'storage':multer[_0xf24e('0x20')]({'destination':function(_0x36d9fd,_0x5d421f,_0x2c0812){_0x2c0812(null,path[_0xf24e('0x21')](config[_0xf24e('0x22')],_0xf24e('0x23')));},'filename':function(_0x3364af,_0x519747,_0x4b233f){_0x519747['originalname']=_0x519747[_0xf24e('0x24')][_0xf24e('0x2d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4b233f(null,util[_0xf24e('0x25')](_0xf24e('0x26'),path[_0xf24e('0x27')](_0x519747[_0xf24e('0x24')],path[_0xf24e('0x28')](_0x519747['originalname'])),Date[_0xf24e('0x29')](),path[_0xf24e('0x28')](_0x519747[_0xf24e('0x24')])));}})});router['post'](_0xf24e('0x2e'),upload[_0xf24e('0x2a')](_0xf24e('0x2b')),controller['upload']);router['post'](_0xf24e('0x2f'),auth['isAuthenticated'](),controller['import']);router[_0xf24e('0x30')](_0xf24e('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xf24e('0x31')](_0xf24e('0x10'),auth['isAuthenticated'](),controller[_0xf24e('0x32')]);module[_0xf24e('0x33')]=router; \ No newline at end of file +var _0x62d6=['describe','/:id','show','getTags','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','setTags','diskStorage','root','server/files/tmp','originalname','format','%s-%s%s','basename','extname','now','/csv','single','uploadCsv','join','replace','/upload','file','upload','/upload/:id','import','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','/describe'];(function(_0x20a3ca,_0x42fb0c){var _0x58691c=function(_0x62f436){while(--_0x62f436){_0x20a3ca['push'](_0x20a3ca['shift']());}};_0x58691c(++_0x42fb0c);}(_0x62d6,0xc0));var _0x662d=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x62d6[_0x12bcf7];return _0x2825a;};'use strict';var multer=require('multer');var util=require(_0x662d('0x0'));var path=require(_0x662d('0x1'));var timeout=require(_0x662d('0x2'));var express=require(_0x662d('0x3'));var router=express[_0x662d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x662d('0x5'));var interaction=require(_0x662d('0x6'));var config=require(_0x662d('0x7'));var controller=require(_0x662d('0x8'));router[_0x662d('0x9')]('/',auth[_0x662d('0xa')](),controller['index']);router[_0x662d('0x9')](_0x662d('0xb'),auth[_0x662d('0xa')](),controller[_0x662d('0xc')]);router[_0x662d('0x9')](_0x662d('0xd'),auth[_0x662d('0xa')](),controller[_0x662d('0xe')]);router[_0x662d('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x662d('0xf')]);router['get'](_0x662d('0x10'),auth[_0x662d('0xa')](),controller[_0x662d('0x11')]);router[_0x662d('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x662d('0x12')]);router[_0x662d('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x662d('0x13')]);router[_0x662d('0x9')](_0x662d('0x14'),auth[_0x662d('0xa')](),controller[_0x662d('0x15')]);router[_0x662d('0x9')]('/:id/journey',auth['isAuthenticated'](),controller['getJourney']);router[_0x662d('0x16')](_0x662d('0x17'),auth['isAuthenticated'](),controller[_0x662d('0x18')]);router[_0x662d('0x16')]('/',auth['isAuthenticated'](),controller[_0x662d('0x19')]);router[_0x662d('0x16')](_0x662d('0x1a'),auth[_0x662d('0xa')](),controller[_0x662d('0x1b')]);router[_0x662d('0x16')](_0x662d('0x1c'),auth[_0x662d('0xa')](),controller[_0x662d('0x1d')]);var upload=multer({'storage':multer[_0x662d('0x1e')]({'destination':function(_0x10e3a2,_0x3f1b73,_0x4c8ea2){_0x4c8ea2(null,path['join'](config[_0x662d('0x1f')],_0x662d('0x20')));},'filename':function(_0x2ce5ec,_0xad6357,_0x135aa9){_0xad6357[_0x662d('0x21')]=_0xad6357[_0x662d('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x135aa9(null,util[_0x662d('0x22')](_0x662d('0x23'),path[_0x662d('0x24')](_0xad6357[_0x662d('0x21')],path[_0x662d('0x25')](_0xad6357['originalname'])),Date[_0x662d('0x26')](),path[_0x662d('0x25')](_0xad6357['originalname'])));}})});router[_0x662d('0x16')](_0x662d('0x27'),upload[_0x662d('0x28')]('file'),controller[_0x662d('0x29')]);var upload=multer({'storage':multer[_0x662d('0x1e')]({'destination':function(_0x4feff4,_0x2d17f4,_0x165346){_0x165346(null,path[_0x662d('0x2a')](config[_0x662d('0x1f')],_0x662d('0x20')));},'filename':function(_0x75cca7,_0x43a086,_0x346f1d){_0x43a086[_0x662d('0x21')]=_0x43a086[_0x662d('0x21')][_0x662d('0x2b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x346f1d(null,util[_0x662d('0x22')](_0x662d('0x23'),path[_0x662d('0x24')](_0x43a086[_0x662d('0x21')],path['extname'](_0x43a086[_0x662d('0x21')])),Date[_0x662d('0x26')](),path[_0x662d('0x25')](_0x43a086['originalname'])));}})});router[_0x662d('0x16')](_0x662d('0x2c'),upload[_0x662d('0x28')](_0x662d('0x2d')),controller[_0x662d('0x2e')]);router[_0x662d('0x16')](_0x662d('0x2f'),auth[_0x662d('0xa')](),controller[_0x662d('0x30')]);router['put'](_0x662d('0xd'),auth[_0x662d('0xa')](),controller[_0x662d('0x31')]);router['delete'](_0x662d('0xd'),auth['isAuthenticated'](),controller[_0x662d('0x32')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a6611c4..42a9d41 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 _0xb03c=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse','values','isArray','stringify','BOOLEAN','voice'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xb03c,0xc6));var _0xcb03=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xb03c[_0x31ced5];return _0x10d9e5;};'use strict';var Sequelize=require(_0xcb03('0x0'));var _=require(_0xcb03('0x1'));module[_0xcb03('0x2')]={'name':{'type':Sequelize[_0xcb03('0x3')],'get':function(_0x59ef38){return this[_0xcb03('0x4')](_0xcb03('0x5'));}},'alias':{'type':Sequelize[_0xcb03('0x6')],'allowNull':![],'set':function(_0x5103fe){this[_0xcb03('0x7')](_0xcb03('0x5'),_0x5103fe?_0x5103fe:this[_0xcb03('0x4')](_0xcb03('0x8')));}},'type':{'type':Sequelize[_0xcb03('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xcb03('0x9')](_0xcb03('0xa')),'get':function(){if(this[_0xcb03('0x4')]('type')===_0xcb03('0xb')){return JSON[_0xcb03('0xc')](this[_0xcb03('0x4')]('values'));}else{return this['getDataValue'](_0xcb03('0xd'));}},'set':function(_0x299782){if(Array[_0xcb03('0xe')](_0x299782)){this['setDataValue']('values',JSON[_0xcb03('0xf')](_0x299782));}else{this['setDataValue'](_0xcb03('0xd'),_0x299782);}}},'required':{'type':Sequelize[_0xcb03('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xcb03('0x11'))}}; \ No newline at end of file +var _0xf7bf=['getDataValue','values','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','alias','STRING','setDataValue','name','TEXT','long','type','select'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xf7bf,0x16b));var _0xff7b=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xf7bf[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require('sequelize');var _=require(_0xff7b('0x0'));module[_0xff7b('0x1')]={'name':{'type':Sequelize[_0xff7b('0x2')],'get':function(_0x4fef7a){return this['getDataValue'](_0xff7b('0x3'));}},'alias':{'type':Sequelize[_0xff7b('0x4')],'allowNull':![],'set':function(_0x24d206){this[_0xff7b('0x5')](_0xff7b('0x3'),_0x24d206?_0x24d206:this['getDataValue'](_0xff7b('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xff7b('0x7')](_0xff7b('0x8')),'get':function(){if(this['getDataValue'](_0xff7b('0x9'))===_0xff7b('0xa')){return JSON['parse'](this[_0xff7b('0xb')](_0xff7b('0xc')));}else{return this[_0xff7b('0xb')](_0xff7b('0xc'));}},'set':function(_0x2da4dc){if(Array['isArray'](_0x2da4dc)){this['setDataValue'](_0xff7b('0xc'),JSON[_0xff7b('0xd')](_0x2da4dc));}else{this[_0xff7b('0x5')](_0xff7b('0xc'),_0x2da4dc);}}},'required':{'type':Sequelize[_0xff7b('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xff7b('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xff7b('0xf')](_0xff7b('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 2bf1b10..990ab7f 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 _0x356b=['request-promise','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','CmCustomField','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','cf_%d','eml-format','rimraf','zip-dir'];(function(_0x38b297,_0x27dcd0){var _0x5e8157=function(_0x17e020){while(--_0x17e020){_0x38b297['push'](_0x38b297['shift']());}};_0x5e8157(++_0x27dcd0);}(_0x356b,0x1a1));var _0xb356=function(_0x3dfa74,_0x3f9278){_0x3dfa74=_0x3dfa74-0x0;var _0x3958ed=_0x356b[_0x3dfa74];return _0x3958ed;};'use strict';var emlformat=require(_0xb356('0x0'));var rimraf=require(_0xb356('0x1'));var zipdir=require(_0xb356('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb356('0x3'));var moment=require('moment');var BPromise=require(_0xb356('0x4'));var Mustache=require(_0xb356('0x5'));var util=require(_0xb356('0x6'));var path=require('path');var sox=require(_0xb356('0x7'));var csv=require(_0xb356('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb356('0x9'));var crypto=require(_0xb356('0xa'));var jsforce=require(_0xb356('0xb'));var deskjs=require(_0xb356('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb356('0xd'));var Papa=require(_0xb356('0xe'));var Redis=require(_0xb356('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb356('0x10'));var hardwareService=require(_0xb356('0x11'));var logger=require(_0xb356('0x12'))(_0xb356('0x13'));var utils=require(_0xb356('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb356('0x15'));var db=require(_0xb356('0x16'))['db'];function respondWithStatusCode(_0x28b010,_0x47e677){_0x47e677=_0x47e677||0xcc;return function(_0x51660c){if(_0x51660c){return _0x28b010[_0xb356('0x17')](_0x47e677);}return _0x28b010[_0xb356('0x18')](_0x47e677)[_0xb356('0x19')]();};}function respondWithResult(_0x3489ed,_0x223679){_0x223679=_0x223679||0xc8;return function(_0x5240e5){if(_0x5240e5){return _0x3489ed[_0xb356('0x18')](_0x223679)['json'](_0x5240e5);}};}function respondWithFilteredResult(_0x309d8d,_0x4547f1){return function(_0x1985da){if(_0x1985da){var _0x50abdd=typeof _0x4547f1[_0xb356('0x1a')]===_0xb356('0x1b')&&typeof _0x4547f1[_0xb356('0x1c')]===_0xb356('0x1b');var _0x68bda1=_0x1985da[_0xb356('0x1d')];var _0x37f1c8=_0x50abdd?0x0:_0x4547f1[_0xb356('0x1a')];var _0x490624=_0x50abdd?_0x1985da['count']:_0x4547f1[_0xb356('0x1a')]+_0x4547f1[_0xb356('0x1c')];var _0x516ed5;if(_0x490624>=_0x68bda1){_0x490624=_0x68bda1;_0x516ed5=0xc8;}else{_0x516ed5=0xce;}_0x309d8d[_0xb356('0x18')](_0x516ed5);return _0x309d8d[_0xb356('0x1e')](_0xb356('0x1f'),_0x37f1c8+'-'+_0x490624+'/'+_0x68bda1)[_0xb356('0x20')](_0x1985da);}return null;};}function patchUpdates(_0x5e714b){return function(_0x2bef70){try{jsonpatch[_0xb356('0x21')](_0x2bef70,_0x5e714b,!![]);}catch(_0x17f2ea){return BPromise[_0xb356('0x22')](_0x17f2ea);}return _0x2bef70[_0xb356('0x23')]();};}function saveUpdates(_0x4bd75f,_0x95c3e3){return function(_0x42548c){if(_0x42548c){return _0x42548c[_0xb356('0x24')](_0x4bd75f)[_0xb356('0x25')](function(_0x2421c5){return _0x2421c5;});}return null;};}function removeEntity(_0x14b9e7,_0x2573f6){return function(_0x4fc348){if(_0x4fc348){return _0x4fc348[_0xb356('0x26')]()['then'](function(){_0x14b9e7[_0xb356('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5414db,_0x55ff26){return function(_0x29c2ba){if(!_0x29c2ba){_0x5414db[_0xb356('0x17')](0x194);}return _0x29c2ba;};}function handleError(_0x267f0b,_0x38c371){_0x38c371=_0x38c371||0x1f4;return function(_0x4cf6fc){logger['error'](_0x4cf6fc[_0xb356('0x27')]);if(_0x4cf6fc[_0xb356('0x28')]){delete _0x4cf6fc[_0xb356('0x28')];}_0x267f0b[_0xb356('0x18')](_0x38c371)[_0xb356('0x29')](_0x4cf6fc);};}exports['index']=function(_0x14be36,_0x5a9936){var _0x645c44={},_0x447313={},_0x25e554={'count':0x0,'rows':[]};var _0x27887e=_[_0xb356('0x2a')](db[_0xb356('0x2b')][_0xb356('0x2c')],function(_0x507ec4){return{'name':_0x507ec4[_0xb356('0x2d')],'type':_0x507ec4['type']['key']};});_0x447313[_0xb356('0x2e')]=_['differenceBy'](_[_0xb356('0x2a')](_0x27887e,_0xb356('0x28')),[_0xb356('0x28')]);_0x447313[_0xb356('0x2f')]=_[_0xb356('0x30')](_0x14be36[_0xb356('0x2f')]);_0x447313[_0xb356('0x31')]=_['intersection'](_0x447313['model'],_0x447313['query']);_0x645c44[_0xb356('0x32')]=_[_0xb356('0x33')](_0x447313[_0xb356('0x2e')],qs['fields'](_0x14be36['query'][_0xb356('0x34')]));_0x645c44[_0xb356('0x32')]=_0x645c44[_0xb356('0x32')][_0xb356('0x35')]?_0x645c44[_0xb356('0x32')]:_0x447313[_0xb356('0x2e')];if(!_0x14be36[_0xb356('0x2f')][_0xb356('0x36')]('nolimit')){_0x645c44[_0xb356('0x1c')]=qs[_0xb356('0x1c')](_0x14be36[_0xb356('0x2f')][_0xb356('0x1c')]);_0x645c44['offset']=qs['offset'](_0x14be36['query'][_0xb356('0x1a')]);}_0x645c44[_0xb356('0x37')]=qs[_0xb356('0x38')](_0x14be36[_0xb356('0x2f')][_0xb356('0x38')]);_0x645c44['where']=qs['filters'](_[_0xb356('0x39')](_0x14be36[_0xb356('0x2f')],_0x447313['filters']),_0x27887e);if(_0x14be36[_0xb356('0x2f')][_0xb356('0x3a')]){_0x645c44[_0xb356('0x3b')]=_[_0xb356('0x3c')](_0x645c44['where'],{'$or':_[_0xb356('0x2a')](_0x27887e,function(_0x119593){if(_0x119593[_0xb356('0x3d')]!==_0xb356('0x3e')){var _0xe98779={};_0xe98779[_0x119593[_0xb356('0x28')]]={'$like':'%'+_0x14be36[_0xb356('0x2f')][_0xb356('0x3a')]+'%'};return _0xe98779;}})});}_0x645c44=_[_0xb356('0x3c')]({},_0x645c44,_0x14be36[_0xb356('0x3f')]);var _0x8c3647={'where':_0x645c44['where']};return db[_0xb356('0x2b')][_0xb356('0x1d')](_0x8c3647)['then'](function(_0x414fed){_0x25e554[_0xb356('0x1d')]=_0x414fed;if(_0x14be36[_0xb356('0x2f')]['includeAll']){_0x645c44['include']=[{'all':!![]}];}return db[_0xb356('0x2b')][_0xb356('0x40')](_0x645c44);})[_0xb356('0x25')](function(_0x2065ea){_0x25e554[_0xb356('0x41')]=_0x2065ea;return _0x25e554;})[_0xb356('0x25')](respondWithFilteredResult(_0x5a9936,_0x645c44))[_0xb356('0x42')](handleError(_0x5a9936,null));};exports[_0xb356('0x43')]=function(_0x33241d,_0x185d92){var _0x54f48d={'raw':!![],'where':{'id':_0x33241d[_0xb356('0x44')]['id']}},_0x58fac5={};_0x58fac5[_0xb356('0x2e')]=_[_0xb356('0x30')](db[_0xb356('0x2b')][_0xb356('0x2c')]);_0x58fac5[_0xb356('0x2f')]=_[_0xb356('0x30')](_0x33241d['query']);_0x58fac5[_0xb356('0x31')]=_[_0xb356('0x33')](_0x58fac5[_0xb356('0x2e')],_0x58fac5['query']);_0x54f48d[_0xb356('0x32')]=_['intersection'](_0x58fac5['model'],qs[_0xb356('0x34')](_0x33241d[_0xb356('0x2f')][_0xb356('0x34')]));_0x54f48d[_0xb356('0x32')]=_0x54f48d['attributes'][_0xb356('0x35')]?_0x54f48d[_0xb356('0x32')]:_0x58fac5[_0xb356('0x2e')];if(_0x33241d['query'][_0xb356('0x45')]){_0x54f48d[_0xb356('0x46')]=[{'all':!![]}];}_0x54f48d=_[_0xb356('0x3c')]({},_0x54f48d,_0x33241d[_0xb356('0x3f')]);return db[_0xb356('0x2b')][_0xb356('0x47')](_0x54f48d)[_0xb356('0x25')](handleEntityNotFound(_0x185d92,null))[_0xb356('0x25')](respondWithResult(_0x185d92,null))[_0xb356('0x42')](handleError(_0x185d92,null));};exports[_0xb356('0x24')]=function(_0x3cbd68,_0x5dabc9){if(_0x3cbd68['body']['id']){delete _0x3cbd68[_0xb356('0x48')]['id'];}return db[_0xb356('0x2b')][_0xb356('0x47')]({'where':{'id':_0x3cbd68[_0xb356('0x44')]['id']}})['then'](handleEntityNotFound(_0x5dabc9,null))[_0xb356('0x25')](saveUpdates(_0x3cbd68['body'],null))[_0xb356('0x25')](respondWithResult(_0x5dabc9,null))[_0xb356('0x42')](handleError(_0x5dabc9,null));};exports[_0xb356('0x26')]=function(_0xcf10c7,_0x403c03){return db[_0xb356('0x2b')]['find']({'where':{'id':_0xcf10c7[_0xb356('0x44')]['id']}})[_0xb356('0x25')](handleEntityNotFound(_0x403c03,null))[_0xb356('0x25')](removeEntity(_0x403c03,null))[_0xb356('0x42')](handleError(_0x403c03,null));};exports['create']=function(_0x98e984,_0x23a946){var _0x16dbdb;return db[_0xb356('0x49')][_0xb356('0x4a')](function(_0x4aeac7){return db['CmCustomField']['create'](_0x98e984['body'],{'transaction':_0x4aeac7})[_0xb356('0x25')](function(_0x2aece2){_0x16dbdb=_0x2aece2;var _0x5ac7ba={'type':db[_0xb356('0x4b')][_0xb356('0x4c')],'transaction':_0x4aeac7};switch(_0x98e984[_0xb356('0x48')][_0xb356('0x3d')]){case _0xb356('0x4d'):_0x5ac7ba[_0xb356('0x3d')]=db[_0xb356('0x4b')][_0xb356('0x4c')];break;case _0xb356('0x4e'):_0x5ac7ba[_0xb356('0x3d')]=db[_0xb356('0x4b')][_0xb356('0x4f')];break;case _0xb356('0x50'):_0x5ac7ba[_0xb356('0x3d')]=db[_0xb356('0x4b')]['BOOLEAN'];_0x5ac7ba[_0xb356('0x51')]=![];break;default:}return db[_0xb356('0x49')][_0xb356('0x52')]['addColumn']('cm_contacts',util['format'](_0xb356('0x53'),_0x16dbdb['id']),_0x5ac7ba);})[_0xb356('0x25')](function(){return _0x16dbdb;});})['then'](respondWithResult(_0x23a946,0xc9))[_0xb356('0x42')](handleError(_0x23a946,null));}; \ No newline at end of file +var _0x631c=['Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','CmCustomField','filters','fields','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set'];(function(_0x41927b,_0x81f6c7){var _0x4334ed=function(_0x29bdf5){while(--_0x29bdf5){_0x41927b['push'](_0x41927b['shift']());}};_0x4334ed(++_0x81f6c7);}(_0x631c,0x155));var _0xc631=function(_0x56bf1e,_0x849e86){_0x56bf1e=_0x56bf1e-0x0;var _0x55f541=_0x631c[_0x56bf1e];return _0x55f541;};'use strict';var emlformat=require(_0xc631('0x0'));var rimraf=require(_0xc631('0x1'));var zipdir=require(_0xc631('0x2'));var jsonpatch=require(_0xc631('0x3'));var rp=require(_0xc631('0x4'));var moment=require(_0xc631('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc631('0x6'));var util=require(_0xc631('0x7'));var path=require(_0xc631('0x8'));var sox=require(_0xc631('0x9'));var csv=require('to-csv');var ejs=require(_0xc631('0xa'));var fs=require('fs');var fs_extra=require(_0xc631('0xb'));var _=require(_0xc631('0xc'));var squel=require(_0xc631('0xd'));var crypto=require(_0xc631('0xe'));var jsforce=require(_0xc631('0xf'));var deskjs=require(_0xc631('0x10'));var toCsv=require(_0xc631('0x11'));var querystring=require(_0xc631('0x12'));var Papa=require(_0xc631('0x13'));var Redis=require(_0xc631('0x14'));var authService=require(_0xc631('0x15'));var qs=require(_0xc631('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc631('0x17'));var logger=require(_0xc631('0x18'))(_0xc631('0x19'));var utils=require(_0xc631('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xc631('0x1b'));var db=require(_0xc631('0x1c'))['db'];function respondWithStatusCode(_0x34aa88,_0x2ba456){_0x2ba456=_0x2ba456||0xcc;return function(_0x3eb68b){if(_0x3eb68b){return _0x34aa88[_0xc631('0x1d')](_0x2ba456);}return _0x34aa88[_0xc631('0x1e')](_0x2ba456)['end']();};}function respondWithResult(_0x4c81db,_0x25c6b7){_0x25c6b7=_0x25c6b7||0xc8;return function(_0x1af884){if(_0x1af884){return _0x4c81db[_0xc631('0x1e')](_0x25c6b7)['json'](_0x1af884);}};}function respondWithFilteredResult(_0xcec7c1,_0x5b5fd9){return function(_0x425441){if(_0x425441){var _0x5bf3b6=typeof _0x5b5fd9['offset']==='undefined'&&typeof _0x5b5fd9['limit']==='undefined';var _0x4e2d2b=_0x425441[_0xc631('0x1f')];var _0x233a2f=_0x5bf3b6?0x0:_0x5b5fd9[_0xc631('0x20')];var _0x4fa21a=_0x5bf3b6?_0x425441[_0xc631('0x1f')]:_0x5b5fd9[_0xc631('0x20')]+_0x5b5fd9[_0xc631('0x21')];var _0x32ba5e;if(_0x4fa21a>=_0x4e2d2b){_0x4fa21a=_0x4e2d2b;_0x32ba5e=0xc8;}else{_0x32ba5e=0xce;}_0xcec7c1[_0xc631('0x1e')](_0x32ba5e);return _0xcec7c1[_0xc631('0x22')](_0xc631('0x23'),_0x233a2f+'-'+_0x4fa21a+'/'+_0x4e2d2b)[_0xc631('0x24')](_0x425441);}return null;};}function patchUpdates(_0x1d072a){return function(_0xef2aa2){try{jsonpatch[_0xc631('0x25')](_0xef2aa2,_0x1d072a,!![]);}catch(_0x5abd49){return BPromise[_0xc631('0x26')](_0x5abd49);}return _0xef2aa2[_0xc631('0x27')]();};}function saveUpdates(_0x249400,_0x30afd5){return function(_0x5494ff){if(_0x5494ff){return _0x5494ff[_0xc631('0x28')](_0x249400)[_0xc631('0x29')](function(_0x199bf8){return _0x199bf8;});}return null;};}function removeEntity(_0x373511,_0x47645f){return function(_0x3c6ff1){if(_0x3c6ff1){return _0x3c6ff1[_0xc631('0x2a')]()['then'](function(){_0x373511[_0xc631('0x1e')](0xcc)[_0xc631('0x2b')]();});}};}function handleEntityNotFound(_0xac942,_0x1b11e2){return function(_0x523b30){if(!_0x523b30){_0xac942[_0xc631('0x1d')](0x194);}return _0x523b30;};}function handleError(_0x5e94a2,_0x2946fe){_0x2946fe=_0x2946fe||0x1f4;return function(_0x22f72c){logger[_0xc631('0x2c')](_0x22f72c[_0xc631('0x2d')]);if(_0x22f72c['name']){delete _0x22f72c[_0xc631('0x2e')];}_0x5e94a2['status'](_0x2946fe)[_0xc631('0x2f')](_0x22f72c);};}exports[_0xc631('0x30')]=function(_0x33f3c3,_0x4fdf50){var _0x5fee26={},_0x3d0532={},_0x139739={'count':0x0,'rows':[]};var _0x1ded85=_[_0xc631('0x31')](db['CmCustomField'][_0xc631('0x32')],function(_0x430155){return{'name':_0x430155[_0xc631('0x33')],'type':_0x430155[_0xc631('0x34')][_0xc631('0x35')]};});_0x3d0532[_0xc631('0x36')]=_[_0xc631('0x37')](_['map'](_0x1ded85,_0xc631('0x2e')),['name']);_0x3d0532[_0xc631('0x38')]=_[_0xc631('0x39')](_0x33f3c3['query']);_0x3d0532['filters']=_[_0xc631('0x3a')](_0x3d0532['model'],_0x3d0532[_0xc631('0x38')]);_0x5fee26['attributes']=_[_0xc631('0x3a')](_0x3d0532[_0xc631('0x36')],qs['fields'](_0x33f3c3[_0xc631('0x38')]['fields']));_0x5fee26[_0xc631('0x3b')]=_0x5fee26['attributes']['length']?_0x5fee26['attributes']:_0x3d0532[_0xc631('0x36')];if(!_0x33f3c3[_0xc631('0x38')][_0xc631('0x3c')](_0xc631('0x3d'))){_0x5fee26[_0xc631('0x21')]=qs['limit'](_0x33f3c3[_0xc631('0x38')][_0xc631('0x21')]);_0x5fee26[_0xc631('0x20')]=qs[_0xc631('0x20')](_0x33f3c3[_0xc631('0x38')]['offset']);}_0x5fee26[_0xc631('0x3e')]=qs[_0xc631('0x3f')](_0x33f3c3['query']['sort']);_0x5fee26[_0xc631('0x40')]=qs['filters'](_[_0xc631('0x41')](_0x33f3c3[_0xc631('0x38')],_0x3d0532['filters']),_0x1ded85);if(_0x33f3c3[_0xc631('0x38')][_0xc631('0x42')]){_0x5fee26[_0xc631('0x40')]=_[_0xc631('0x43')](_0x5fee26[_0xc631('0x40')],{'$or':_[_0xc631('0x31')](_0x1ded85,function(_0x239624){if(_0x239624[_0xc631('0x34')]!=='VIRTUAL'){var _0x37d7cc={};_0x37d7cc[_0x239624[_0xc631('0x2e')]]={'$like':'%'+_0x33f3c3[_0xc631('0x38')][_0xc631('0x42')]+'%'};return _0x37d7cc;}})});}_0x5fee26=_['merge']({},_0x5fee26,_0x33f3c3[_0xc631('0x44')]);var _0x4aa628={'where':_0x5fee26['where']};return db['CmCustomField'][_0xc631('0x1f')](_0x4aa628)[_0xc631('0x29')](function(_0x3b8da1){_0x139739[_0xc631('0x1f')]=_0x3b8da1;if(_0x33f3c3[_0xc631('0x38')][_0xc631('0x45')]){_0x5fee26['include']=[{'all':!![]}];}return db['CmCustomField'][_0xc631('0x46')](_0x5fee26);})[_0xc631('0x29')](function(_0x164074){_0x139739[_0xc631('0x47')]=_0x164074;return _0x139739;})[_0xc631('0x29')](respondWithFilteredResult(_0x4fdf50,_0x5fee26))[_0xc631('0x48')](handleError(_0x4fdf50,null));};exports[_0xc631('0x49')]=function(_0x441ce9,_0x4e0481){var _0x27c7b4={'raw':!![],'where':{'id':_0x441ce9[_0xc631('0x4a')]['id']}},_0x552a59={};_0x552a59[_0xc631('0x36')]=_[_0xc631('0x39')](db[_0xc631('0x4b')]['rawAttributes']);_0x552a59[_0xc631('0x38')]=_['keys'](_0x441ce9['query']);_0x552a59[_0xc631('0x4c')]=_[_0xc631('0x3a')](_0x552a59[_0xc631('0x36')],_0x552a59[_0xc631('0x38')]);_0x27c7b4[_0xc631('0x3b')]=_[_0xc631('0x3a')](_0x552a59[_0xc631('0x36')],qs[_0xc631('0x4d')](_0x441ce9[_0xc631('0x38')][_0xc631('0x4d')]));_0x27c7b4['attributes']=_0x27c7b4[_0xc631('0x3b')]['length']?_0x27c7b4[_0xc631('0x3b')]:_0x552a59[_0xc631('0x36')];if(_0x441ce9[_0xc631('0x38')][_0xc631('0x45')]){_0x27c7b4['include']=[{'all':!![]}];}_0x27c7b4=_['merge']({},_0x27c7b4,_0x441ce9[_0xc631('0x44')]);return db[_0xc631('0x4b')][_0xc631('0x4e')](_0x27c7b4)[_0xc631('0x29')](handleEntityNotFound(_0x4e0481,null))[_0xc631('0x29')](respondWithResult(_0x4e0481,null))[_0xc631('0x48')](handleError(_0x4e0481,null));};exports[_0xc631('0x28')]=function(_0xc64bff,_0x2fc5d5){if(_0xc64bff[_0xc631('0x4f')]['id']){delete _0xc64bff[_0xc631('0x4f')]['id'];}return db[_0xc631('0x4b')][_0xc631('0x4e')]({'where':{'id':_0xc64bff[_0xc631('0x4a')]['id']}})[_0xc631('0x29')](handleEntityNotFound(_0x2fc5d5,null))[_0xc631('0x29')](saveUpdates(_0xc64bff[_0xc631('0x4f')],null))[_0xc631('0x29')](respondWithResult(_0x2fc5d5,null))[_0xc631('0x48')](handleError(_0x2fc5d5,null));};exports['destroy']=function(_0x2b8194,_0x34a81a){return db['CmCustomField'][_0xc631('0x4e')]({'where':{'id':_0x2b8194[_0xc631('0x4a')]['id']}})['then'](handleEntityNotFound(_0x34a81a,null))[_0xc631('0x29')](removeEntity(_0x34a81a,null))[_0xc631('0x48')](handleError(_0x34a81a,null));};exports[_0xc631('0x50')]=function(_0x39e3a4,_0x5da0a7){var _0x44cdf5;return db[_0xc631('0x51')][_0xc631('0x52')](function(_0xa41d2a){return db['CmCustomField'][_0xc631('0x50')](_0x39e3a4[_0xc631('0x4f')],{'transaction':_0xa41d2a})['then'](function(_0x4a1c02){_0x44cdf5=_0x4a1c02;var _0x879e11={'type':db[_0xc631('0x53')][_0xc631('0x54')],'transaction':_0xa41d2a};switch(_0x39e3a4[_0xc631('0x4f')][_0xc631('0x34')]){case _0xc631('0x55'):_0x879e11['type']=db[_0xc631('0x53')][_0xc631('0x54')];break;case _0xc631('0x56'):_0x879e11[_0xc631('0x34')]=db[_0xc631('0x53')][_0xc631('0x57')];break;case _0xc631('0x58'):_0x879e11[_0xc631('0x34')]=db[_0xc631('0x53')][_0xc631('0x59')];_0x879e11['defaultValue']=![];break;default:}return db['sequelize'][_0xc631('0x5a')][_0xc631('0x5b')](_0xc631('0x5c'),util[_0xc631('0x5d')]('cf_%d',_0x44cdf5['id']),_0x879e11);})[_0xc631('0x29')](function(){return _0x44cdf5;});})[_0xc631('0x29')](respondWithResult(_0x5da0a7,0xc9))[_0xc631('0x48')](handleError(_0x5da0a7,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index b6af124..6db22f9 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 _0x98ab=['CmCustomField','cm_custom_fields','util','../../config/logger','moment','bluebird','rimraf','exports'];(function(_0x34481b,_0xdbdda6){var _0xe90f3f=function(_0x1a1a8f){while(--_0x1a1a8f){_0x34481b['push'](_0x34481b['shift']());}};_0xe90f3f(++_0xdbdda6);}(_0x98ab,0xda));var _0xb98a=function(_0x34bc21,_0x2a96fc){_0x34bc21=_0x34bc21-0x0;var _0x3b5035=_0x98ab[_0x34bc21];return _0x3b5035;};'use strict';var _=require('lodash');var util=require(_0xb98a('0x0'));var logger=require(_0xb98a('0x1'))('api');var moment=require(_0xb98a('0x2'));var BPromise=require(_0xb98a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb98a('0x4'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xb98a('0x5')]=function(_0x4b5e42,_0x1a4fe2){return _0x4b5e42['define'](_0xb98a('0x6'),attributes,{'tableName':_0xb98a('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa03e=['path','rimraf','../../config/environment','./cmCustomField.attributes','define','cm_custom_fields','lodash','util','bluebird','request-promise'];(function(_0x27baa7,_0x118f62){var _0x23d6f7=function(_0x3077ca){while(--_0x3077ca){_0x27baa7['push'](_0x27baa7['shift']());}};_0x23d6f7(++_0x118f62);}(_0xa03e,0x1d2));var _0xea03=function(_0x43c0ed,_0x62b859){_0x43c0ed=_0x43c0ed-0x0;var _0x35414d=_0xa03e[_0x43c0ed];return _0x35414d;};'use strict';var _=require(_0xea03('0x0'));var util=require(_0xea03('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xea03('0x2'));var rp=require(_0xea03('0x3'));var fs=require('fs');var path=require(_0xea03('0x4'));var rimraf=require(_0xea03('0x5'));var config=require(_0xea03('0x6'));var attributes=require(_0xea03('0x7'));module['exports']=function(_0x2faa9f,_0x592510){return _0x2faa9f[_0xea03('0x8')]('CmCustomField',attributes,{'tableName':_0xea03('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 30009b6..4325451 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 _0x5bba=['then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5b6fdf,_0xdd8747){var _0x302bc2=function(_0x523534){while(--_0x523534){_0x5b6fdf['push'](_0x5b6fdf['shift']());}};_0x302bc2(++_0xdd8747);}(_0x5bba,0x9b));var _0xa5bb=function(_0x4ceeba,_0x484d5d){_0x4ceeba=_0x4ceeba-0x0;var _0x372b77=_0x5bba[_0x4ceeba];return _0x372b77;};'use strict';var _=require('lodash');var util=require(_0xa5bb('0x0'));var moment=require(_0xa5bb('0x1'));var BPromise=require(_0xa5bb('0x2'));var rs=require(_0xa5bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5bb('0x4'))['db'];var utils=require(_0xa5bb('0x5'));var logger=require(_0xa5bb('0x6'))(_0xa5bb('0x7'));var config=require(_0xa5bb('0x8'));var jayson=require(_0xa5bb('0x9'));var client=jayson[_0xa5bb('0xa')][_0xa5bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a89c,_0xc034c6,_0x723c22){return new BPromise(function(_0x454970,_0x522f2a){return client[_0xa5bb('0xc')](_0x22a89c,_0x723c22)[_0xa5bb('0xd')](function(_0x1c7214){logger[_0xa5bb('0xe')](_0xa5bb('0xf'),_0xc034c6,_0xa5bb('0x10'));logger[_0xa5bb('0x11')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0xc034c6,_0xa5bb('0x10'),JSON[_0xa5bb('0x12')](_0x1c7214));if(_0x1c7214[_0xa5bb('0x13')]){if(_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x14')]===0x1f4){logger[_0xa5bb('0x13')]('CmCustomField,\x20%s,\x20%s',_0xc034c6,_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x15')]);return _0x522f2a(_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x15')]);}logger[_0xa5bb('0x13')](_0xa5bb('0xf'),_0xc034c6,_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x15')]);return _0x454970(_0x1c7214['error'][_0xa5bb('0x15')]);}else{logger[_0xa5bb('0xe')]('CmCustomField,\x20%s,\x20%s',_0xc034c6,_0xa5bb('0x10'));_0x454970(_0x1c7214[_0xa5bb('0x16')]['message']);}})[_0xa5bb('0x17')](function(_0x246191){logger[_0xa5bb('0x13')]('CmCustomField,\x20%s,\x20%s',_0xc034c6,_0x246191);_0x522f2a(_0x246191);});});} \ No newline at end of file +var _0x2560=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2560,0x104));var _0x0256=function(_0xb73a1,_0x4a2c98){_0xb73a1=_0xb73a1-0x0;var _0x21c420=_0x2560[_0xb73a1];return _0x21c420;};'use strict';var _=require(_0x0256('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0256('0x1'));var fs=require('fs');var Redis=require(_0x0256('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0256('0x3'));var logger=require(_0x0256('0x4'))(_0x0256('0x5'));var config=require(_0x0256('0x6'));var jayson=require(_0x0256('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x233fca,_0x2161ae,_0x28c761){return new BPromise(function(_0x4b908b,_0x3105f0){return client[_0x0256('0x8')](_0x233fca,_0x28c761)[_0x0256('0x9')](function(_0x43c5eb){logger[_0x0256('0xa')](_0x0256('0xb'),_0x2161ae,_0x0256('0xc'));logger['debug'](_0x0256('0xd'),_0x2161ae,_0x0256('0xc'),JSON[_0x0256('0xe')](_0x43c5eb));if(_0x43c5eb[_0x0256('0xf')]){if(_0x43c5eb[_0x0256('0xf')][_0x0256('0x10')]===0x1f4){logger['error'](_0x0256('0xb'),_0x2161ae,_0x43c5eb[_0x0256('0xf')][_0x0256('0x11')]);return _0x3105f0(_0x43c5eb[_0x0256('0xf')][_0x0256('0x11')]);}logger[_0x0256('0xf')]('CmCustomField,\x20%s,\x20%s',_0x2161ae,_0x43c5eb['error'][_0x0256('0x11')]);return _0x4b908b(_0x43c5eb[_0x0256('0xf')][_0x0256('0x11')]);}else{logger[_0x0256('0xa')](_0x0256('0xb'),_0x2161ae,_0x0256('0xc'));_0x4b908b(_0x43c5eb[_0x0256('0x12')][_0x0256('0x11')]);}})[_0x0256('0x13')](function(_0x503752){logger['error'](_0x0256('0xb'),_0x2161ae,_0x503752);_0x3105f0(_0x503752);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 655989e..88e3f6a 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 _0x16a7=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x58e1b0,_0x64e502){var _0x321c27=function(_0x5df3e0){while(--_0x5df3e0){_0x58e1b0['push'](_0x58e1b0['shift']());}};_0x321c27(++_0x64e502);}(_0x16a7,0xa5));var _0x716a=function(_0x4a7baa,_0x1f6d64){_0x4a7baa=_0x4a7baa-0x0;var _0x25b066=_0x16a7[_0x4a7baa];return _0x25b066;};'use strict';var multer=require(_0x716a('0x0'));var util=require(_0x716a('0x1'));var path=require(_0x716a('0x2'));var timeout=require(_0x716a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x716a('0x4'));var auth=require(_0x716a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x716a('0x6'));var controller=require(_0x716a('0x7'));router[_0x716a('0x8')]('/',auth[_0x716a('0x9')](),controller[_0x716a('0xa')]);router['get'](_0x716a('0xb'),auth[_0x716a('0x9')](),controller[_0x716a('0xc')]);router[_0x716a('0xd')]('/',auth['isAuthenticated'](),controller[_0x716a('0xe')]);router[_0x716a('0xf')](_0x716a('0xb'),auth[_0x716a('0x9')](),controller[_0x716a('0x10')]);router[_0x716a('0x11')]('/:id',auth[_0x716a('0x9')](),controller[_0x716a('0x12')]);module[_0x716a('0x13')]=router; \ No newline at end of file +var _0x36b2=['../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x234dc1,_0x25cf40){var _0x531b7c=function(_0xaa6372){while(--_0xaa6372){_0x234dc1['push'](_0x234dc1['shift']());}};_0x531b7c(++_0x25cf40);}(_0x36b2,0x6b));var _0x236b=function(_0x3e4ba4,_0x4e6143){_0x3e4ba4=_0x3e4ba4-0x0;var _0x4bffb2=_0x36b2[_0x3e4ba4];return _0x4bffb2;};'use strict';var multer=require(_0x236b('0x0'));var util=require(_0x236b('0x1'));var path=require(_0x236b('0x2'));var timeout=require('connect-timeout');var express=require(_0x236b('0x3'));var router=express[_0x236b('0x4')]();var fs_extra=require(_0x236b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x236b('0x6'));var config=require(_0x236b('0x7'));var controller=require('./cmCustomField.controller');router[_0x236b('0x8')]('/',auth[_0x236b('0x9')](),controller[_0x236b('0xa')]);router[_0x236b('0x8')](_0x236b('0xb'),auth[_0x236b('0x9')](),controller['show']);router[_0x236b('0xc')]('/',auth[_0x236b('0x9')](),controller[_0x236b('0xd')]);router[_0x236b('0xe')]('/:id',auth[_0x236b('0x9')](),controller[_0x236b('0xf')]);router[_0x236b('0x10')]('/:id',auth[_0x236b('0x9')](),controller[_0x236b('0x11')]);module[_0x236b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 3a3ece7..a6e8447 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 _0x83d0=['BOOLEAN','DATE','format','INTEGER','moment','sequelize','exports','STRING'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x83d0,0x1e4));var _0x083d=function(_0x12ec38,_0x588e0e){_0x12ec38=_0x12ec38-0x0;var _0x501638=_0x83d0[_0x12ec38];return _0x501638;};'use strict';var moment=require(_0x083d('0x0'));var Sequelize=require(_0x083d('0x1'));module[_0x083d('0x2')]={'phone':{'type':Sequelize[_0x083d('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x083d('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x083d('0x5')],'defaultValue':moment()[_0x083d('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x083d('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x083d('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x083d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x083d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x083d('0x5')]},'priority':{'type':Sequelize[_0x083d('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x083d('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x083d('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x083d('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x083d('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x083d('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x083d('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x083d('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x083d('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d89=['INTEGER','DATE','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN'];(function(_0xc6d1c4,_0x2c943f){var _0x729e1e=function(_0x1153f6){while(--_0x1153f6){_0xc6d1c4['push'](_0xc6d1c4['shift']());}};_0x729e1e(++_0x2c943f);}(_0x0d89,0x1e4));var _0x90d8=function(_0x44406f,_0x428cc6){_0x44406f=_0x44406f-0x0;var _0x59dfaf=_0x0d89[_0x44406f];return _0x59dfaf;};'use strict';var moment=require(_0x90d8('0x0'));var Sequelize=require(_0x90d8('0x1'));module['exports']={'phone':{'type':Sequelize[_0x90d8('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x90d8('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x90d8('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x90d8('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x90d8('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x90d8('0x5')]},'priority':{'type':Sequelize[_0x90d8('0x4')](0x2)[_0x90d8('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x90d8('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x90d8('0x4')],'unique':_0x90d8('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x90d8('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x90d8('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x90d8('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x90d8('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x90d8('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'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 12b294a..8b08ba2 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 _0x5437=['isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','Queue','getOpenContacts','outbound','YYYY-MM-DD\x20HH:mm:ss','isNumber','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','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','$and','$or','$gt','$gte','$lt','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$notILike','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','campaign','membername','user','UserId','deleted','deletedat','format','calleridnum','phone','campaigntype','ivr','CmContact','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev'];(function(_0x1e69f0,_0x1a2fba){var _0x5ddbc5=function(_0x265322){while(--_0x265322){_0x1e69f0['push'](_0x1e69f0['shift']());}};_0x5ddbc5(++_0x1a2fba);}(_0x5437,0xaf));var _0x7543=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x5437[_0x3e6729];return _0x535bcd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7543('0x0'));var zipdir=require(_0x7543('0x1'));var jsonpatch=require(_0x7543('0x2'));var rp=require(_0x7543('0x3'));var moment=require(_0x7543('0x4'));var BPromise=require(_0x7543('0x5'));var Mustache=require(_0x7543('0x6'));var util=require(_0x7543('0x7'));var path=require(_0x7543('0x8'));var sox=require(_0x7543('0x9'));var csv=require(_0x7543('0xa'));var ejs=require(_0x7543('0xb'));var fs=require('fs');var fs_extra=require(_0x7543('0xc'));var _=require(_0x7543('0xd'));var squel=require(_0x7543('0xe'));var crypto=require('crypto');var jsforce=require(_0x7543('0xf'));var deskjs=require(_0x7543('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7543('0x11'));var Redis=require('ioredis');var authService=require(_0x7543('0x12'));var qs=require(_0x7543('0x13'));var as=require(_0x7543('0x14'));var hardwareService=require(_0x7543('0x15'));var logger=require(_0x7543('0x16'))(_0x7543('0x17'));var utils=require(_0x7543('0x18'));var config=require(_0x7543('0x19'));var licenseUtil=require(_0x7543('0x1a'));var db=require(_0x7543('0x1b'))['db'];function respondWithStatusCode(_0x2aad30,_0xf41960){_0xf41960=_0xf41960||0xcc;return function(_0x4f3829){if(_0x4f3829){return _0x2aad30['sendStatus'](_0xf41960);}return _0x2aad30['status'](_0xf41960)[_0x7543('0x1c')]();};}function respondWithResult(_0x26b69a,_0x530c5e){_0x530c5e=_0x530c5e||0xc8;return function(_0x376e77){if(_0x376e77){return _0x26b69a[_0x7543('0x1d')](_0x530c5e)[_0x7543('0x1e')](_0x376e77);}};}function respondWithFilteredResult(_0x108f25,_0x4abbd1){return function(_0x5e8bf9){if(_0x5e8bf9){var _0x47ee99=typeof _0x4abbd1['offset']===_0x7543('0x1f')&&typeof _0x4abbd1[_0x7543('0x20')]===_0x7543('0x1f');var _0xc7fae6=_0x5e8bf9[_0x7543('0x21')];var _0x5e5737=_0x47ee99?0x0:_0x4abbd1['offset'];var _0x42fc8b=_0x47ee99?_0x5e8bf9['count']:_0x4abbd1[_0x7543('0x22')]+_0x4abbd1['limit'];var _0x16bdfc;if(_0x42fc8b>=_0xc7fae6){_0x42fc8b=_0xc7fae6;_0x16bdfc=0xc8;}else{_0x16bdfc=0xce;}_0x108f25[_0x7543('0x1d')](_0x16bdfc);return _0x108f25[_0x7543('0x23')](_0x7543('0x24'),_0x5e5737+'-'+_0x42fc8b+'/'+_0xc7fae6)[_0x7543('0x1e')](_0x5e8bf9);}return null;};}function patchUpdates(_0x55f0d8){return function(_0x592240){try{jsonpatch[_0x7543('0x25')](_0x592240,_0x55f0d8,!![]);}catch(_0x23125e){return BPromise[_0x7543('0x26')](_0x23125e);}return _0x592240[_0x7543('0x27')]();};}function saveUpdates(_0x49841b,_0x4b0ac6){return function(_0x1a651c){if(_0x1a651c){return _0x1a651c[_0x7543('0x28')](_0x49841b)[_0x7543('0x29')](function(_0x44aa04){return _0x44aa04;});}return null;};}function removeEntity(_0x2b4714,_0x769497){return function(_0x51e132){if(_0x51e132){return _0x51e132[_0x7543('0x2a')]()[_0x7543('0x29')](function(){_0x2b4714['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1103f3,_0x5d4331){return function(_0x2d2521){if(!_0x2d2521){_0x1103f3[_0x7543('0x2b')](0x194);}return _0x2d2521;};}function handleError(_0x1528ab,_0x3b34ec){_0x3b34ec=_0x3b34ec||0x1f4;return function(_0x51decb){logger[_0x7543('0x2c')](_0x51decb[_0x7543('0x2d')]);if(_0x51decb[_0x7543('0x2e')]){delete _0x51decb[_0x7543('0x2e')];}_0x1528ab[_0x7543('0x1d')](_0x3b34ec)[_0x7543('0x2f')](_0x51decb);};}exports[_0x7543('0x30')]=function(_0x31784c,_0xd8fd26){var _0x5012de={},_0x344289={},_0x12f520={'count':0x0,'rows':[]};var _0x341419=_[_0x7543('0x31')](db[_0x7543('0x32')][_0x7543('0x33')],function(_0x129d23){return{'name':_0x129d23[_0x7543('0x34')],'type':_0x129d23[_0x7543('0x35')]['key']};});_0x344289[_0x7543('0x36')]=_[_0x7543('0x31')](_0x341419,_0x7543('0x2e'));_0x344289[_0x7543('0x37')]=_[_0x7543('0x38')](_0x31784c['query']);_0x344289[_0x7543('0x39')]=_['intersection'](_0x344289[_0x7543('0x36')],_0x344289[_0x7543('0x37')]);_0x344289['filters']=_['concat'](_0x344289[_0x7543('0x39')],[_0x7543('0x3a'),_0x7543('0x3b'),_0x7543('0x3c'),_0x7543('0x3d'),_0x7543('0x3e'),'$lte',_0x7543('0x3f'),_0x7543('0x40'),'$not',_0x7543('0x41'),_0x7543('0x42'),_0x7543('0x43'),'$notIn',_0x7543('0x44'),_0x7543('0x45'),'$iLike',_0x7543('0x46'),_0x7543('0x44'),'$overlap',_0x7543('0x47'),_0x7543('0x48'),_0x7543('0x49')]);_0x5012de[_0x7543('0x4a')]=_[_0x7543('0x4b')](_0x344289['model'],qs[_0x7543('0x4c')](_0x31784c['query'][_0x7543('0x4c')]));_0x5012de[_0x7543('0x4a')]=_0x5012de[_0x7543('0x4a')][_0x7543('0x4d')]?_0x5012de['attributes']:_0x344289[_0x7543('0x36')];if(!_0x31784c[_0x7543('0x37')][_0x7543('0x4e')](_0x7543('0x4f'))){_0x5012de[_0x7543('0x20')]=qs[_0x7543('0x20')](_0x31784c[_0x7543('0x37')][_0x7543('0x20')]);_0x5012de[_0x7543('0x22')]=qs[_0x7543('0x22')](_0x31784c[_0x7543('0x37')][_0x7543('0x22')]);}_0x5012de['order']=qs[_0x7543('0x50')](_0x31784c[_0x7543('0x37')][_0x7543('0x50')]);_0x5012de[_0x7543('0x51')]=qs[_0x7543('0x39')](_['pick'](_0x31784c[_0x7543('0x37')],_0x344289[_0x7543('0x39')]),_0x341419);if(_0x31784c[_0x7543('0x37')][_0x7543('0x52')]){_0x5012de['where']=_['merge'](_0x5012de[_0x7543('0x51')],{'$or':_['map'](_0x341419,function(_0x7fcab){if(_0x7fcab['type']!==_0x7543('0x53')){var _0x1ddc25={};_0x1ddc25[_0x7fcab[_0x7543('0x2e')]]={'$like':'%'+_0x31784c[_0x7543('0x37')][_0x7543('0x52')]+'%'};return _0x1ddc25;}})});}_0x5012de=_[_0x7543('0x54')]({},_0x5012de,_0x31784c[_0x7543('0x55')]);var _0x3d946d={'where':_0x5012de[_0x7543('0x51')]};return db[_0x7543('0x32')]['count'](_0x3d946d)['then'](function(_0x437534){_0x12f520[_0x7543('0x21')]=_0x437534;if(_0x31784c['query'][_0x7543('0x56')]){_0x5012de[_0x7543('0x57')]=[{'all':!![]}];}return db[_0x7543('0x32')][_0x7543('0x58')](_0x5012de);})[_0x7543('0x29')](function(_0x29b60e){_0x12f520[_0x7543('0x59')]=_0x29b60e;return _0x12f520;})['then'](respondWithFilteredResult(_0xd8fd26,_0x5012de))[_0x7543('0x5a')](handleError(_0xd8fd26,null));};exports['show']=function(_0x4e8c42,_0x486ab2){var _0xc1acc5={'raw':!![],'where':{'id':_0x4e8c42[_0x7543('0x5b')]['id']}},_0x5e18a6={};_0x5e18a6['model']=_[_0x7543('0x38')](db[_0x7543('0x32')][_0x7543('0x33')]);_0x5e18a6['query']=_[_0x7543('0x38')](_0x4e8c42[_0x7543('0x37')]);_0x5e18a6[_0x7543('0x39')]=_[_0x7543('0x4b')](_0x5e18a6[_0x7543('0x36')],_0x5e18a6[_0x7543('0x37')]);_0xc1acc5[_0x7543('0x4a')]=_[_0x7543('0x4b')](_0x5e18a6['model'],qs[_0x7543('0x4c')](_0x4e8c42[_0x7543('0x37')][_0x7543('0x4c')]));_0xc1acc5[_0x7543('0x4a')]=_0xc1acc5[_0x7543('0x4a')][_0x7543('0x4d')]?_0xc1acc5[_0x7543('0x4a')]:_0x5e18a6[_0x7543('0x36')];if(_0x4e8c42[_0x7543('0x37')][_0x7543('0x56')]){_0xc1acc5[_0x7543('0x57')]=[{'all':!![]}];}_0xc1acc5=_[_0x7543('0x54')]({},_0xc1acc5,_0x4e8c42[_0x7543('0x55')]);return db[_0x7543('0x32')][_0x7543('0x5c')](_0xc1acc5)[_0x7543('0x29')](handleEntityNotFound(_0x486ab2,null))[_0x7543('0x29')](respondWithResult(_0x486ab2,null))['catch'](handleError(_0x486ab2,null));};exports[_0x7543('0x5d')]=function(_0x1c2404,_0x3c4593){return db[_0x7543('0x32')][_0x7543('0x5d')](_0x1c2404[_0x7543('0x5e')],{})['then'](respondWithResult(_0x3c4593,0xc9))['catch'](handleError(_0x3c4593,null));};exports[_0x7543('0x28')]=function(_0xe075ff,_0x58f300){if(_0xe075ff[_0x7543('0x5e')]['id']){delete _0xe075ff[_0x7543('0x5e')]['id'];}return db[_0x7543('0x32')][_0x7543('0x5c')]({'where':{'id':_0xe075ff['params']['id']}})['then'](handleEntityNotFound(_0x58f300,null))[_0x7543('0x29')](saveUpdates(_0xe075ff['body'],null))['then'](respondWithResult(_0x58f300,null))[_0x7543('0x5a')](handleError(_0x58f300,null));};exports['describe']=function(_0x323713,_0x3b3f4b){return db['CmHopper'][_0x7543('0x5f')]()['then'](respondWithResult(_0x3b3f4b,null))[_0x7543('0x5a')](handleError(_0x3b3f4b,null));};exports[_0x7543('0x2a')]=function(_0x2a3694,_0x4eff6d){var _0x32c918;return db[_0x7543('0x32')][_0x7543('0x5c')]({'where':{'id':_0x2a3694['params']['id']}})[_0x7543('0x29')](handleEntityNotFound(_0x4eff6d,null))[_0x7543('0x29')](function(_0x3455f0){if(_0x3455f0){return _0x3455f0['destroy']()[_0x7543('0x29')](function(_0x5b9188){return _0x5b9188;});}})['then'](function(_0x486487){_0x32c918=_0x486487;if(_0x486487){if(_0x486487[_0x7543('0x60')]||_0x486487['CampaignId']){return db[_0x486487[_0x7543('0x60')]?_0x7543('0x61'):_0x7543('0x62')][_0x7543('0x5c')]({'where':{'id':_0x486487[_0x7543('0x60')]?_0x486487[_0x7543('0x60')]:_0x486487[_0x7543('0x63')]},'attributes':['id',_0x7543('0x2e')],'raw':!![]});}}})['then'](function(_0x1ec9c5){var _0x3543f4={};if(_0x1ec9c5){_[_0x7543('0x54')](_0x3543f4,_[_0x7543('0x64')](_0x32c918[_0x7543('0x65')],[_0x7543('0x66'),_0x7543('0x67'),'id']));_0x3543f4[_0x7543('0x68')]=0x15;_0x3543f4['statedesc']='deleted';_0x3543f4[_0x7543('0x69')]=_0x1ec9c5[_0x7543('0x2e')];_0x3543f4[_0x7543('0x6a')]=_0x2a3694[_0x7543('0x6b')]['name'];_0x3543f4[_0x7543('0x6c')]=_0x2a3694['user']['id'];_0x3543f4[_0x7543('0x6d')]=!![];_0x3543f4[_0x7543('0x6e')]=moment()[_0x7543('0x6f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3543f4[_0x7543('0x70')]=_0x32c918[_0x7543('0x71')];_0x3543f4[_0x7543('0x72')]=_0x32c918[_0x7543('0x60')]?'queue':_0x7543('0x73');return db[_0x7543('0x74')][_0x7543('0x5c')]({'where':{'id':_0x3543f4['ContactId']},'attributes':[_0x7543('0x75'),'lastName']})[_0x7543('0x29')](function(_0x28f775){if(!_[_0x7543('0x76')](_0x4eff6d)&&!_[_0x7543('0x76')](_0x28f775[_0x7543('0x75')])){_0x3543f4[_0x7543('0x77')]=_0x28f775['firstName'];if(!_['isNil'](_0x28f775['lastName'])){_0x3543f4[_0x7543('0x77')]+='\x20'+_0x28f775[_0x7543('0x78')];}}})[_0x7543('0x79')](function(){return db[_0x7543('0x7a')]['create'](_0x3543f4);});}})['then'](function(){return _0x4eff6d[_0x7543('0x1d')](0xcc)[_0x7543('0x1c')]();})['catch'](handleError(_0x4eff6d,null));};exports[_0x7543('0x7b')]=function(_0x2573cf,_0x140d86,_0x7553fd){var _0x5b1a94=[];return db[_0x7543('0x74')][_0x7543('0x5f')]()['then'](function(_0x2205ba){_0x5b1a94=_[_0x7543('0x38')](_0x2205ba);return _0x2573cf[_0x7543('0x6b')][_0x7543('0x7c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x7543('0x7d')},'attributes':['id',_0x7543('0x7e')],'raw':!![]});})['then'](function(_0x21acf4){if(_0x21acf4&&_0x21acf4[_0x7543('0x4d')]){return db[_0x7543('0x7f')][_0x7543('0x80')](function(_0xc10df9){var _0x493d3d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x7543('0x31')](_0x21acf4,'id')},'$or':[{'UserId':null},{'UserId':_0x2573cf['user']['id']}]};var _0x4c45fa=[];if(_0x2573cf[_0x7543('0x5e')][_0x7543('0x81')]&&_0x2573cf['body'][_0x7543('0x81')]===_0x7543('0x82')){if(!_[_0x7543('0x83')](_0x2573cf[_0x7543('0x5e')][_0x7543('0x84')])){_0x493d3d['id']={'$in':_0x2573cf['body'][_0x7543('0x84')]};}_0x4c45fa=[[_0x7543('0x85'),_0x7543('0x86')],[_0x7543('0x87'),_0x21acf4[0x0][_0x7543('0x7e')]===_0x7543('0x86')?_0x7543('0x88'):_0x7543('0x86')],db[_0x7543('0x7f')]['literal'](_0x7543('0x89')),['id',_0x7543('0x88')]];}else{if(!_[_0x7543('0x83')](_0x2573cf[_0x7543('0x5e')][_0x7543('0x84')])){_0x493d3d['id']={'$notIn':_0x2573cf['body'][_0x7543('0x84')]};}_0x4c45fa=[[_0x7543('0x85'),_0x7543('0x88')],['scheduledAt',_0x21acf4[0x0]['dialOrderByScheduledAt']],db[_0x7543('0x7f')][_0x7543('0x8a')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x7543('0x86')]];}return db[_0x7543('0x32')][_0x7543('0x8b')]({'attributes':['id',_0x7543('0x8c')],'where':_0x493d3d,'order':_0x4c45fa,'transaction':_0xc10df9,'lock':_0xc10df9[_0x7543('0x8d')][_0x7543('0x8e')],'include':[{'model':db[_0x7543('0x74')],'as':'Contact','attributes':_0x5b1a94,'include':[{'model':db[_0x7543('0x8f')],'as':_0x7543('0x90'),'attributes':['id',_0x7543('0x2e')]}]},{'model':db[_0x7543('0x91')],'as':'List','attributes':['id',_0x7543('0x2e')]},{'model':db['VoiceQueue'],'as':_0x7543('0x92'),'attributes':['id','name','dialActive']}]})[_0x7543('0x29')](function(_0x218f2c){if(_0x218f2c){return _0x218f2c[_0x7543('0x28')]({'UserId':_0x2573cf[_0x7543('0x6b')]['id']},{'transaction':_0xc10df9});}});});}})[_0x7543('0x29')](handleEntityNotFound(_0x140d86,null))[_0x7543('0x29')](respondWithResult(_0x140d86,null))['catch'](handleError(_0x140d86,null));};exports[_0x7543('0x93')]=function(_0x56af77,_0x491a4d,_0x383751){return _0x56af77[_0x7543('0x6b')][_0x7543('0x7c')]({'where':{'type':_0x7543('0x94'),'dialActive':!![],'dialMethod':_0x7543('0x7d')},'attributes':['id'],'raw':!![]})[_0x7543('0x29')](function(_0x3cca99){if(_0x3cca99&&_0x3cca99[_0x7543('0x4d')]){return db[_0x7543('0x32')][_0x7543('0x21')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7543('0x6f')](_0x7543('0x95'))},'VoiceQueueId':{'$in':_[_0x7543('0x31')](_0x3cca99,'id')},'$or':[{'UserId':null},{'UserId':_0x56af77[_0x7543('0x6b')]['id']}]}});}return 0x0;})[_0x7543('0x29')](function(_0x1d3a6d){if(!_[_0x7543('0x76')](_0x1d3a6d)&&_[_0x7543('0x96')](_0x1d3a6d)){return _0x491a4d['status'](0xc8)[_0x7543('0x1e')]({'contacts':_0x1d3a6d});}else{logger['error'](_0x7543('0x97'),'getOpenContacts',0x194,_0x7543('0x98'));_0x491a4d['sendStatus'](0x194);}})[_0x7543('0x5a')](handleError(_0x491a4d,null));}; \ No newline at end of file +var _0xad35=['ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','error','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','destroy','then','stack','name','send','CmHopper','type','key','map','query','keys','filters','intersection','$and','$or','$gte','$lt','$ne','$eq','$between','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','model','fields','attributes','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','state','deleted','campaign','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xad35,0xaf));var _0x5ad3=function(_0x18c599,_0x4f61b6){_0x18c599=_0x18c599-0x0;var _0x1cc8fa=_0xad35[_0x18c599];return _0x1cc8fa;};'use strict';var emlformat=require(_0x5ad3('0x0'));var rimraf=require(_0x5ad3('0x1'));var zipdir=require(_0x5ad3('0x2'));var jsonpatch=require(_0x5ad3('0x3'));var rp=require('request-promise');var moment=require(_0x5ad3('0x4'));var BPromise=require(_0x5ad3('0x5'));var Mustache=require(_0x5ad3('0x6'));var util=require(_0x5ad3('0x7'));var path=require(_0x5ad3('0x8'));var sox=require(_0x5ad3('0x9'));var csv=require(_0x5ad3('0xa'));var ejs=require(_0x5ad3('0xb'));var fs=require('fs');var fs_extra=require(_0x5ad3('0xc'));var _=require(_0x5ad3('0xd'));var squel=require(_0x5ad3('0xe'));var crypto=require(_0x5ad3('0xf'));var jsforce=require(_0x5ad3('0x10'));var deskjs=require(_0x5ad3('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5ad3('0x12'));var Papa=require(_0x5ad3('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5ad3('0x14'));var as=require(_0x5ad3('0x15'));var hardwareService=require(_0x5ad3('0x16'));var logger=require(_0x5ad3('0x17'))(_0x5ad3('0x18'));var utils=require(_0x5ad3('0x19'));var config=require(_0x5ad3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a214a,_0x3f1540){_0x3f1540=_0x3f1540||0xcc;return function(_0x1b80a1){if(_0x1b80a1){return _0x3a214a[_0x5ad3('0x1b')](_0x3f1540);}return _0x3a214a[_0x5ad3('0x1c')](_0x3f1540)[_0x5ad3('0x1d')]();};}function respondWithResult(_0x10498f,_0x5e1768){_0x5e1768=_0x5e1768||0xc8;return function(_0x467b23){if(_0x467b23){return _0x10498f[_0x5ad3('0x1c')](_0x5e1768)[_0x5ad3('0x1e')](_0x467b23);}};}function respondWithFilteredResult(_0x54c5cd,_0x31d091){return function(_0x3d54e9){if(_0x3d54e9){var _0x2c54c1=typeof _0x31d091[_0x5ad3('0x1f')]===_0x5ad3('0x20')&&typeof _0x31d091[_0x5ad3('0x21')]===_0x5ad3('0x20');var _0x3f7429=_0x3d54e9['count'];var _0x2f04aa=_0x2c54c1?0x0:_0x31d091[_0x5ad3('0x1f')];var _0x54bc83=_0x2c54c1?_0x3d54e9['count']:_0x31d091['offset']+_0x31d091['limit'];var _0x329ae5;if(_0x54bc83>=_0x3f7429){_0x54bc83=_0x3f7429;_0x329ae5=0xc8;}else{_0x329ae5=0xce;}_0x54c5cd[_0x5ad3('0x1c')](_0x329ae5);return _0x54c5cd[_0x5ad3('0x22')]('Content-Range',_0x2f04aa+'-'+_0x54bc83+'/'+_0x3f7429)['json'](_0x3d54e9);}return null;};}function patchUpdates(_0x5b8afb){return function(_0x50d973){try{jsonpatch[_0x5ad3('0x23')](_0x50d973,_0x5b8afb,!![]);}catch(_0x4fe361){return BPromise[_0x5ad3('0x24')](_0x4fe361);}return _0x50d973['save']();};}function saveUpdates(_0x43f453,_0x2fa6b9){return function(_0x43feb0){if(_0x43feb0){return _0x43feb0[_0x5ad3('0x25')](_0x43f453)['then'](function(_0xcf584a){return _0xcf584a;});}return null;};}function removeEntity(_0x1c0d3b,_0x3a89d0){return function(_0x5f5799){if(_0x5f5799){return _0x5f5799[_0x5ad3('0x26')]()[_0x5ad3('0x27')](function(){_0x1c0d3b[_0x5ad3('0x1c')](0xcc)[_0x5ad3('0x1d')]();});}};}function handleEntityNotFound(_0x48d12e,_0x5571dc){return function(_0x28984b){if(!_0x28984b){_0x48d12e['sendStatus'](0x194);}return _0x28984b;};}function handleError(_0x363229,_0x46386b){_0x46386b=_0x46386b||0x1f4;return function(_0x320379){logger['error'](_0x320379[_0x5ad3('0x28')]);if(_0x320379['name']){delete _0x320379[_0x5ad3('0x29')];}_0x363229[_0x5ad3('0x1c')](_0x46386b)[_0x5ad3('0x2a')](_0x320379);};}exports['index']=function(_0x152d44,_0x300ef5){var _0x341ddb={},_0x4b2cc2={},_0x4c37fa={'count':0x0,'rows':[]};var _0x9679a9=_['map'](db[_0x5ad3('0x2b')]['rawAttributes'],function(_0x257560){return{'name':_0x257560['fieldName'],'type':_0x257560[_0x5ad3('0x2c')][_0x5ad3('0x2d')]};});_0x4b2cc2['model']=_[_0x5ad3('0x2e')](_0x9679a9,_0x5ad3('0x29'));_0x4b2cc2[_0x5ad3('0x2f')]=_[_0x5ad3('0x30')](_0x152d44[_0x5ad3('0x2f')]);_0x4b2cc2[_0x5ad3('0x31')]=_[_0x5ad3('0x32')](_0x4b2cc2['model'],_0x4b2cc2[_0x5ad3('0x2f')]);_0x4b2cc2['filters']=_['concat'](_0x4b2cc2[_0x5ad3('0x31')],[_0x5ad3('0x33'),_0x5ad3('0x34'),'$gt',_0x5ad3('0x35'),_0x5ad3('0x36'),'$lte',_0x5ad3('0x37'),_0x5ad3('0x38'),'$not',_0x5ad3('0x39'),'$notBetween','$in',_0x5ad3('0x3a'),_0x5ad3('0x3b'),_0x5ad3('0x3c'),_0x5ad3('0x3d'),'$notILike',_0x5ad3('0x3b'),_0x5ad3('0x3e'),_0x5ad3('0x3f'),_0x5ad3('0x40'),_0x5ad3('0x41')]);_0x341ddb['attributes']=_['intersection'](_0x4b2cc2[_0x5ad3('0x42')],qs[_0x5ad3('0x43')](_0x152d44[_0x5ad3('0x2f')][_0x5ad3('0x43')]));_0x341ddb[_0x5ad3('0x44')]=_0x341ddb['attributes'][_0x5ad3('0x45')]?_0x341ddb[_0x5ad3('0x44')]:_0x4b2cc2['model'];if(!_0x152d44[_0x5ad3('0x2f')][_0x5ad3('0x46')]('nolimit')){_0x341ddb[_0x5ad3('0x21')]=qs[_0x5ad3('0x21')](_0x152d44[_0x5ad3('0x2f')][_0x5ad3('0x21')]);_0x341ddb['offset']=qs[_0x5ad3('0x1f')](_0x152d44['query'][_0x5ad3('0x1f')]);}_0x341ddb['order']=qs['sort'](_0x152d44[_0x5ad3('0x2f')][_0x5ad3('0x47')]);_0x341ddb[_0x5ad3('0x48')]=qs[_0x5ad3('0x31')](_['pick'](_0x152d44[_0x5ad3('0x2f')],_0x4b2cc2[_0x5ad3('0x31')]),_0x9679a9);if(_0x152d44[_0x5ad3('0x2f')][_0x5ad3('0x49')]){_0x341ddb['where']=_['merge'](_0x341ddb[_0x5ad3('0x48')],{'$or':_[_0x5ad3('0x2e')](_0x9679a9,function(_0x39a9a7){if(_0x39a9a7[_0x5ad3('0x2c')]!==_0x5ad3('0x4a')){var _0x2a4543={};_0x2a4543[_0x39a9a7['name']]={'$like':'%'+_0x152d44['query']['filter']+'%'};return _0x2a4543;}})});}_0x341ddb=_[_0x5ad3('0x4b')]({},_0x341ddb,_0x152d44[_0x5ad3('0x4c')]);var _0x464f1e={'where':_0x341ddb['where']};return db[_0x5ad3('0x2b')]['count'](_0x464f1e)[_0x5ad3('0x27')](function(_0xf66693){_0x4c37fa[_0x5ad3('0x4d')]=_0xf66693;if(_0x152d44[_0x5ad3('0x2f')][_0x5ad3('0x4e')]){_0x341ddb[_0x5ad3('0x4f')]=[{'all':!![]}];}return db[_0x5ad3('0x2b')]['findAll'](_0x341ddb);})[_0x5ad3('0x27')](function(_0xa7f906){_0x4c37fa[_0x5ad3('0x50')]=_0xa7f906;return _0x4c37fa;})[_0x5ad3('0x27')](respondWithFilteredResult(_0x300ef5,_0x341ddb))[_0x5ad3('0x51')](handleError(_0x300ef5,null));};exports[_0x5ad3('0x52')]=function(_0x3cd563,_0x36310d){var _0x4d3cc3={'raw':!![],'where':{'id':_0x3cd563[_0x5ad3('0x53')]['id']}},_0x22c614={};_0x22c614[_0x5ad3('0x42')]=_[_0x5ad3('0x30')](db[_0x5ad3('0x2b')]['rawAttributes']);_0x22c614['query']=_[_0x5ad3('0x30')](_0x3cd563['query']);_0x22c614[_0x5ad3('0x31')]=_[_0x5ad3('0x32')](_0x22c614[_0x5ad3('0x42')],_0x22c614[_0x5ad3('0x2f')]);_0x4d3cc3[_0x5ad3('0x44')]=_[_0x5ad3('0x32')](_0x22c614[_0x5ad3('0x42')],qs[_0x5ad3('0x43')](_0x3cd563[_0x5ad3('0x2f')][_0x5ad3('0x43')]));_0x4d3cc3[_0x5ad3('0x44')]=_0x4d3cc3[_0x5ad3('0x44')]['length']?_0x4d3cc3[_0x5ad3('0x44')]:_0x22c614[_0x5ad3('0x42')];if(_0x3cd563[_0x5ad3('0x2f')]['includeAll']){_0x4d3cc3[_0x5ad3('0x4f')]=[{'all':!![]}];}_0x4d3cc3=_[_0x5ad3('0x4b')]({},_0x4d3cc3,_0x3cd563[_0x5ad3('0x4c')]);return db['CmHopper'][_0x5ad3('0x54')](_0x4d3cc3)[_0x5ad3('0x27')](handleEntityNotFound(_0x36310d,null))['then'](respondWithResult(_0x36310d,null))[_0x5ad3('0x51')](handleError(_0x36310d,null));};exports[_0x5ad3('0x55')]=function(_0x23fd1c,_0x2bae85){return db['CmHopper'][_0x5ad3('0x55')](_0x23fd1c[_0x5ad3('0x56')],{})[_0x5ad3('0x27')](respondWithResult(_0x2bae85,0xc9))[_0x5ad3('0x51')](handleError(_0x2bae85,null));};exports[_0x5ad3('0x25')]=function(_0x2703be,_0x55d15b){if(_0x2703be['body']['id']){delete _0x2703be[_0x5ad3('0x56')]['id'];}return db[_0x5ad3('0x2b')][_0x5ad3('0x54')]({'where':{'id':_0x2703be[_0x5ad3('0x53')]['id']}})[_0x5ad3('0x27')](handleEntityNotFound(_0x55d15b,null))[_0x5ad3('0x27')](saveUpdates(_0x2703be['body'],null))['then'](respondWithResult(_0x55d15b,null))['catch'](handleError(_0x55d15b,null));};exports['describe']=function(_0x59bd05,_0x486956){return db[_0x5ad3('0x2b')][_0x5ad3('0x57')]()[_0x5ad3('0x27')](respondWithResult(_0x486956,null))['catch'](handleError(_0x486956,null));};exports[_0x5ad3('0x26')]=function(_0x2ed680,_0x55e4e1){var _0x2f9104;return db['CmHopper'][_0x5ad3('0x54')]({'where':{'id':_0x2ed680[_0x5ad3('0x53')]['id']}})[_0x5ad3('0x27')](handleEntityNotFound(_0x55e4e1,null))[_0x5ad3('0x27')](function(_0x5b55f1){if(_0x5b55f1){return _0x5b55f1[_0x5ad3('0x26')]()[_0x5ad3('0x27')](function(_0x22805b){return _0x22805b;});}})['then'](function(_0x26f98c){_0x2f9104=_0x26f98c;if(_0x26f98c){if(_0x26f98c[_0x5ad3('0x58')]||_0x26f98c[_0x5ad3('0x59')]){return db[_0x26f98c[_0x5ad3('0x58')]?_0x5ad3('0x5a'):'Campaign'][_0x5ad3('0x54')]({'where':{'id':_0x26f98c[_0x5ad3('0x58')]?_0x26f98c['VoiceQueueId']:_0x26f98c[_0x5ad3('0x59')]},'attributes':['id','name'],'raw':!![]});}}})[_0x5ad3('0x27')](function(_0x202a7f){var _0x5df44a={};if(_0x202a7f){_['merge'](_0x5df44a,_['omit'](_0x2f9104['dataValues'],['createdAt','updatedAt','id']));_0x5df44a[_0x5ad3('0x5b')]=0x15;_0x5df44a['statedesc']=_0x5ad3('0x5c');_0x5df44a[_0x5ad3('0x5d')]=_0x202a7f[_0x5ad3('0x29')];_0x5df44a['membername']=_0x2ed680[_0x5ad3('0x5e')][_0x5ad3('0x29')];_0x5df44a['UserId']=_0x2ed680[_0x5ad3('0x5e')]['id'];_0x5df44a[_0x5ad3('0x5c')]=!![];_0x5df44a[_0x5ad3('0x5f')]=moment()['format'](_0x5ad3('0x60'));_0x5df44a[_0x5ad3('0x61')]=_0x2f9104[_0x5ad3('0x62')];_0x5df44a['campaigntype']=_0x2f9104[_0x5ad3('0x58')]?_0x5ad3('0x63'):'ivr';return db[_0x5ad3('0x64')][_0x5ad3('0x54')]({'where':{'id':_0x5df44a[_0x5ad3('0x65')]},'attributes':[_0x5ad3('0x66'),'lastName']})[_0x5ad3('0x27')](function(_0x191172){if(!_[_0x5ad3('0x67')](_0x55e4e1)&&!_['isNil'](_0x191172[_0x5ad3('0x66')])){_0x5df44a[_0x5ad3('0x68')]=_0x191172[_0x5ad3('0x66')];if(!_['isNil'](_0x191172[_0x5ad3('0x69')])){_0x5df44a[_0x5ad3('0x68')]+='\x20'+_0x191172[_0x5ad3('0x69')];}}})[_0x5ad3('0x6a')](function(){return db[_0x5ad3('0x6b')][_0x5ad3('0x55')](_0x5df44a);});}})[_0x5ad3('0x27')](function(){return _0x55e4e1[_0x5ad3('0x1c')](0xcc)[_0x5ad3('0x1d')]();})[_0x5ad3('0x51')](handleError(_0x55e4e1,null));};exports['getPreview']=function(_0x5f4186,_0x1b2ff6,_0x1cd06b){var _0x4a42dc=[];return db[_0x5ad3('0x64')][_0x5ad3('0x57')]()[_0x5ad3('0x27')](function(_0x1c8a5e){_0x4a42dc=_['keys'](_0x1c8a5e);return _0x5f4186[_0x5ad3('0x5e')][_0x5ad3('0x6c')]({'where':{'type':_0x5ad3('0x6d'),'dialActive':!![],'dialMethod':_0x5ad3('0x6e')},'attributes':['id',_0x5ad3('0x6f')],'raw':!![]});})[_0x5ad3('0x27')](function(_0x4af3b3){if(_0x4af3b3&&_0x4af3b3[_0x5ad3('0x45')]){return db[_0x5ad3('0x70')][_0x5ad3('0x71')](function(_0x56e9c7){var _0x5219c4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5ad3('0x72')](_0x5ad3('0x60'))},'VoiceQueueId':{'$in':_[_0x5ad3('0x2e')](_0x4af3b3,'id')},'$or':[{'UserId':null},{'UserId':_0x5f4186[_0x5ad3('0x5e')]['id']}]};var _0x53499e=[];if(_0x5f4186[_0x5ad3('0x56')]['direction']&&_0x5f4186[_0x5ad3('0x56')][_0x5ad3('0x73')]===_0x5ad3('0x74')){if(!_[_0x5ad3('0x75')](_0x5f4186[_0x5ad3('0x56')][_0x5ad3('0x76')])){_0x5219c4['id']={'$in':_0x5f4186['body'][_0x5ad3('0x76')]};}_0x53499e=[[_0x5ad3('0x77'),_0x5ad3('0x78')],['scheduledAt',_0x4af3b3[0x0][_0x5ad3('0x6f')]===_0x5ad3('0x78')?_0x5ad3('0x79'):_0x5ad3('0x78')],db[_0x5ad3('0x70')][_0x5ad3('0x7a')](_0x5ad3('0x7b')),['id',_0x5ad3('0x79')]];}else{if(!_[_0x5ad3('0x75')](_0x5f4186[_0x5ad3('0x56')][_0x5ad3('0x76')])){_0x5219c4['id']={'$notIn':_0x5f4186['body'][_0x5ad3('0x76')]};}_0x53499e=[[_0x5ad3('0x77'),_0x5ad3('0x79')],[_0x5ad3('0x7c'),_0x4af3b3[0x0]['dialOrderByScheduledAt']],db[_0x5ad3('0x70')][_0x5ad3('0x7a')](_0x5ad3('0x7d')),['id',_0x5ad3('0x78')]];}return db[_0x5ad3('0x2b')]['findOne']({'attributes':['id',_0x5ad3('0x7e')],'where':_0x5219c4,'order':_0x53499e,'transaction':_0x56e9c7,'lock':_0x56e9c7[_0x5ad3('0x7f')][_0x5ad3('0x80')],'include':[{'model':db[_0x5ad3('0x64')],'as':'Contact','attributes':_0x4a42dc,'include':[{'model':db[_0x5ad3('0x81')],'as':_0x5ad3('0x82'),'attributes':['id',_0x5ad3('0x29')]}]},{'model':db[_0x5ad3('0x83')],'as':_0x5ad3('0x84'),'attributes':['id',_0x5ad3('0x29')]},{'model':db[_0x5ad3('0x5a')],'as':_0x5ad3('0x85'),'attributes':['id',_0x5ad3('0x29'),_0x5ad3('0x86')]}]})['then'](function(_0x1c350b){if(_0x1c350b){return _0x1c350b[_0x5ad3('0x25')]({'UserId':_0x5f4186['user']['id']},{'transaction':_0x56e9c7});}});});}})[_0x5ad3('0x27')](handleEntityNotFound(_0x1b2ff6,null))[_0x5ad3('0x27')](respondWithResult(_0x1b2ff6,null))[_0x5ad3('0x51')](handleError(_0x1b2ff6,null));};exports[_0x5ad3('0x87')]=function(_0x8eebb6,_0x2129de,_0x1217ef){return _0x8eebb6[_0x5ad3('0x5e')][_0x5ad3('0x6c')]({'where':{'type':_0x5ad3('0x6d'),'dialActive':!![],'dialMethod':_0x5ad3('0x6e')},'attributes':['id'],'raw':!![]})[_0x5ad3('0x27')](function(_0x40faea){if(_0x40faea&&_0x40faea[_0x5ad3('0x45')]){return db['CmHopper'][_0x5ad3('0x4d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x5ad3('0x60'))},'VoiceQueueId':{'$in':_['map'](_0x40faea,'id')},'$or':[{'UserId':null},{'UserId':_0x8eebb6['user']['id']}]}});}return 0x0;})['then'](function(_0x3572b4){if(!_[_0x5ad3('0x67')](_0x3572b4)&&_['isNumber'](_0x3572b4)){return _0x2129de[_0x5ad3('0x1c')](0xc8)[_0x5ad3('0x1e')]({'contacts':_0x3572b4});}else{logger[_0x5ad3('0x88')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x5ad3('0x87'),0x194,_0x5ad3('0x89'));_0x2129de[_0x5ad3('0x1b')](0x194);}})[_0x5ad3('0x51')](handleError(_0x2129de,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a7eaa20..bb26c4c 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 _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x90b1,0x1bb));var _0x190b=function(_0x692282,_0x279660){_0x692282=_0x692282-0x0;var _0x172aa8=_0x90b1[_0x692282];return _0x172aa8;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xabce,0x103));var _0xeabc=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xabce[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 3ec95ce..45fd0ed 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 _0xaf9e=['CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','model','include','debug','ShowCmHopper','find','CreateCmHopper','UpdateCmHopper','update','body','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','order','LOCK','UPDATE','CmContact','Contact','User','Agent','name','voicePause','UserId','push','includes','all','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','length','keys','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xaf9e,0x1d7));var _0xeaf9=function(_0x3e8e26,_0x2012c3){_0x3e8e26=_0x3e8e26-0x0;var _0x227e66=_0xaf9e[_0x3e8e26];return _0x227e66;};'use strict';var _=require(_0xeaf9('0x0'));var util=require(_0xeaf9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeaf9('0x2'));var fs=require('fs');var Redis=require(_0xeaf9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeaf9('0x4'))('rpc');var config=require(_0xeaf9('0x5'));var jayson=require(_0xeaf9('0x6'));var client=jayson[_0xeaf9('0x7')][_0xeaf9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb272,_0x1100c1,_0x2048ac){return new BPromise(function(_0x486579,_0x39b5a4){return client[_0xeaf9('0x9')](_0x1bb272,_0x2048ac)[_0xeaf9('0xa')](function(_0x9ba151){logger[_0xeaf9('0xb')](_0xeaf9('0xc'),_0x1100c1,'request\x20sent');logger['debug'](_0xeaf9('0xd'),_0x1100c1,_0xeaf9('0xe'),JSON[_0xeaf9('0xf')](_0x9ba151));if(_0x9ba151[_0xeaf9('0x10')]){if(_0x9ba151[_0xeaf9('0x10')]['code']===0x1f4){logger[_0xeaf9('0x10')](_0xeaf9('0xc'),_0x1100c1,_0x9ba151['error']['message']);return _0x39b5a4(_0x9ba151[_0xeaf9('0x10')][_0xeaf9('0x11')]);}logger[_0xeaf9('0x10')](_0xeaf9('0xc'),_0x1100c1,_0x9ba151['error']['message']);return _0x486579(_0x9ba151[_0xeaf9('0x10')][_0xeaf9('0x11')]);}else{logger[_0xeaf9('0xb')]('CmHopper,\x20%s,\x20%s',_0x1100c1,_0xeaf9('0xe'));_0x486579(_0x9ba151['result']['message']);}})[_0xeaf9('0x12')](function(_0x17b6c9){logger[_0xeaf9('0x10')](_0xeaf9('0xc'),_0x1100c1,_0x17b6c9);_0x39b5a4(_0x17b6c9);});});}exports[_0xeaf9('0x13')]=function(_0x45c7ed){var _0x4e096d=this;return new Promise(function(_0x2ecffc,_0x2e14ff){return db[_0xeaf9('0x14')][_0xeaf9('0x15')]({'raw':_0x45c7ed[_0xeaf9('0x16')]?_0x45c7ed[_0xeaf9('0x16')][_0xeaf9('0x17')]===undefined?!![]:![]:!![],'where':_0x45c7ed[_0xeaf9('0x16')]?_0x45c7ed[_0xeaf9('0x16')][_0xeaf9('0x18')]||null:null,'attributes':_0x45c7ed[_0xeaf9('0x16')]?_0x45c7ed[_0xeaf9('0x16')][_0xeaf9('0x19')]||null:null,'limit':_0x45c7ed['options']?_0x45c7ed['options'][_0xeaf9('0x1a')]||null:null,'include':_0x45c7ed[_0xeaf9('0x16')]?_0x45c7ed[_0xeaf9('0x16')]['include']?_[_0xeaf9('0x1b')](_0x45c7ed['options']['include'],function(_0x30b711){return{'model':db[_0x30b711[_0xeaf9('0x1c')]],'as':_0x30b711['as'],'attributes':_0x30b711['attributes'],'include':_0x30b711[_0xeaf9('0x1d')]?_[_0xeaf9('0x1b')](_0x30b711[_0xeaf9('0x1d')],function(_0x16474b){return{'model':db[_0x16474b[_0xeaf9('0x1c')]],'as':_0x16474b['as'],'attributes':_0x16474b['attributes'],'include':_0x16474b[_0xeaf9('0x1d')]?_[_0xeaf9('0x1b')](_0x16474b[_0xeaf9('0x1d')],function(_0x28e849){return{'model':db[_0x28e849[_0xeaf9('0x1c')]],'as':_0x28e849['as'],'attributes':_0x28e849['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3efe4e){logger[_0xeaf9('0xb')](_0xeaf9('0x13'),_0x45c7ed);logger[_0xeaf9('0x1e')]('GetCmHopper',_0x45c7ed,JSON[_0xeaf9('0xf')](_0x3efe4e));_0x2ecffc(_0x3efe4e);})[_0xeaf9('0x12')](function(_0x3a4c23){logger[_0xeaf9('0x10')](_0xeaf9('0x13'),_0x3a4c23[_0xeaf9('0x11')],_0x45c7ed);_0x2e14ff(_0x4e096d[_0xeaf9('0x10')](0x1f4,_0x3a4c23[_0xeaf9('0x11')]));});});};exports[_0xeaf9('0x1f')]=function(_0x1cb3bb){var _0x3eb7f1=this;return new Promise(function(_0x4a7dde,_0x593ac3){return db[_0xeaf9('0x14')][_0xeaf9('0x20')]({'raw':_0x1cb3bb['options']?_0x1cb3bb['options'][_0xeaf9('0x17')]===undefined?!![]:![]:!![],'where':_0x1cb3bb[_0xeaf9('0x16')]?_0x1cb3bb[_0xeaf9('0x16')][_0xeaf9('0x18')]||null:null,'attributes':_0x1cb3bb[_0xeaf9('0x16')]?_0x1cb3bb['options'][_0xeaf9('0x19')]||null:null,'include':_0x1cb3bb[_0xeaf9('0x16')]?_0x1cb3bb[_0xeaf9('0x16')][_0xeaf9('0x1d')]?_['map'](_0x1cb3bb[_0xeaf9('0x16')]['include'],function(_0x33b937){return{'model':db[_0x33b937[_0xeaf9('0x1c')]],'as':_0x33b937['as'],'attributes':_0x33b937[_0xeaf9('0x19')],'include':_0x33b937['include']?_['map'](_0x33b937[_0xeaf9('0x1d')],function(_0x141cee){return{'model':db[_0x141cee['model']],'as':_0x141cee['as'],'attributes':_0x141cee['attributes'],'include':_0x141cee[_0xeaf9('0x1d')]?_[_0xeaf9('0x1b')](_0x141cee['include'],function(_0x570fa7){return{'model':db[_0x570fa7[_0xeaf9('0x1c')]],'as':_0x570fa7['as'],'attributes':_0x570fa7[_0xeaf9('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeaf9('0xa')](function(_0x5b7a68){logger[_0xeaf9('0xb')](_0xeaf9('0x1f'),_0x1cb3bb);logger['debug']('ShowCmHopper',_0x1cb3bb,JSON[_0xeaf9('0xf')](_0x5b7a68));_0x4a7dde(_0x5b7a68);})[_0xeaf9('0x12')](function(_0x2ce566){logger[_0xeaf9('0x10')](_0xeaf9('0x1f'),_0x2ce566[_0xeaf9('0x11')],_0x1cb3bb);_0x593ac3(_0x3eb7f1[_0xeaf9('0x10')](0x1f4,_0x2ce566[_0xeaf9('0x11')]));});});};exports[_0xeaf9('0x21')]=function(_0x9c8702){var _0x247e65=this;return new Promise(function(_0x34480c,_0x311d2b){return db[_0xeaf9('0x14')]['create'](_0x9c8702['body'],{'raw':_0x9c8702[_0xeaf9('0x16')]?_0x9c8702[_0xeaf9('0x16')][_0xeaf9('0x17')]===undefined?!![]:![]:!![]})[_0xeaf9('0xa')](function(_0x509176){logger[_0xeaf9('0xb')](_0xeaf9('0x21'),_0x9c8702);logger[_0xeaf9('0x1e')](_0xeaf9('0x21'),_0x9c8702,JSON[_0xeaf9('0xf')](_0x509176));_0x34480c(_0x509176);})['catch'](function(_0x131afa){logger['error']('CreateCmHopper',_0x131afa[_0xeaf9('0x11')],_0x9c8702);_0x311d2b(_0x247e65[_0xeaf9('0x10')](0x1f4,_0x131afa[_0xeaf9('0x11')]));});});};exports[_0xeaf9('0x22')]=function(_0x240dc0){var _0x42d1a7=this;return new Promise(function(_0x13b962,_0x1d48b0){return db[_0xeaf9('0x14')][_0xeaf9('0x23')](_0x240dc0[_0xeaf9('0x24')],{'raw':_0x240dc0[_0xeaf9('0x16')]?_0x240dc0[_0xeaf9('0x16')][_0xeaf9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x240dc0[_0xeaf9('0x16')]?_0x240dc0[_0xeaf9('0x16')][_0xeaf9('0x18')]||null:null,'attributes':_0x240dc0[_0xeaf9('0x16')]?_0x240dc0[_0xeaf9('0x16')][_0xeaf9('0x19')]||null:null,'limit':_0x240dc0['options']?_0x240dc0[_0xeaf9('0x16')]['limit']||null:null})['then'](function(_0x329473){logger[_0xeaf9('0xb')]('UpdateCmHopper',_0x240dc0);logger[_0xeaf9('0x1e')]('UpdateCmHopper',_0x240dc0,JSON[_0xeaf9('0xf')](_0x329473));_0x13b962(_0x329473);})[_0xeaf9('0x12')](function(_0x2d9944){logger[_0xeaf9('0x10')]('UpdateCmHopper',_0x2d9944['message'],_0x240dc0);_0x1d48b0(_0x42d1a7[_0xeaf9('0x10')](0x1f4,_0x2d9944['message']));});});};exports[_0xeaf9('0x25')]=function(_0xd7f76){var _0x3dda68=this;return new Promise(function(_0x407b18,_0x36388d){return db[_0xeaf9('0x14')][_0xeaf9('0x26')]({'where':_0xd7f76[_0xeaf9('0x16')]?_0xd7f76[_0xeaf9('0x16')][_0xeaf9('0x18')]||null:null})['then'](function(_0x341775){logger['info'](_0xeaf9('0x25'),_0xd7f76);logger[_0xeaf9('0x1e')]('DestroyCmHopper',_0xd7f76,JSON[_0xeaf9('0xf')](_0x341775));_0x407b18(_0x341775);})['catch'](function(_0xd51279){logger[_0xeaf9('0x10')](_0xeaf9('0x25'),_0xd51279[_0xeaf9('0x11')],_0xd7f76);_0x36388d(_0x3dda68['error'](0x1f4,_0xd51279[_0xeaf9('0x11')]));});});};exports[_0xeaf9('0x27')]=function(_0x5367c3){var _0x205641=this;return new Promise(function(_0x4d3b02,_0x531ec5){return db['CmContact'][_0xeaf9('0x28')]()[_0xeaf9('0xa')](function(_0x3afea5){return db[_0xeaf9('0x29')]['transaction'](function(_0x2ad4cf){return db[_0xeaf9('0x14')][_0xeaf9('0x15')]({'where':_0x5367c3[_0xeaf9('0x16')]?_0x5367c3[_0xeaf9('0x16')][_0xeaf9('0x18')]||null:null,'attributes':_0x5367c3[_0xeaf9('0x16')]?_0x5367c3['options'][_0xeaf9('0x19')]||null:null,'limit':_0x5367c3[_0xeaf9('0x16')]?_0x5367c3[_0xeaf9('0x16')][_0xeaf9('0x1a')]||null:null,'order':_0x5367c3[_0xeaf9('0x16')]?_0x5367c3[_0xeaf9('0x16')][_0xeaf9('0x2a')]||null:null,'transaction':_0x2ad4cf,'lock':_0x2ad4cf[_0xeaf9('0x2b')][_0xeaf9('0x2c')],'include':[{'model':db[_0xeaf9('0x2d')],'as':_0xeaf9('0x2e'),'attributes':_['keys'](_0x3afea5)},{'model':db[_0xeaf9('0x2f')],'as':_0xeaf9('0x30'),'attributes':['id',_0xeaf9('0x31'),_0xeaf9('0x32')]}]})[_0xeaf9('0xa')](function(_0x2ee96d){var _0x413374=[];var _0x255b11=[];for(var _0x24c44d=0x0;_0x24c44d<_0x2ee96d['length'];_0x24c44d+=0x1){var _0x138551=_0x2ee96d[_0x24c44d][_0xeaf9('0x33')];if(_0x138551===null){_0x413374[_0xeaf9('0x34')](_0x2ee96d[_0x24c44d][_0xeaf9('0x23')](_0x5367c3['body'],{'transaction':_0x2ad4cf}));}else if(!_0x255b11[_0xeaf9('0x35')](_0x138551)){_0x255b11['push'](_0x138551);_0x413374[_0xeaf9('0x34')](_0x2ee96d[_0x24c44d][_0xeaf9('0x23')](_0x5367c3[_0xeaf9('0x24')],{'transaction':_0x2ad4cf}));}}return BPromise[_0xeaf9('0x36')](_0x413374);});})[_0xeaf9('0xa')](function(_0x1c8d4d){logger[_0xeaf9('0xb')](_0xeaf9('0x27'),_0x5367c3);logger[_0xeaf9('0x1e')](_0xeaf9('0x27'),_0x5367c3,JSON['stringify'](_0x1c8d4d));_0x4d3b02(_0x1c8d4d);})[_0xeaf9('0x12')](function(_0x1dd5fd){logger[_0xeaf9('0x10')](_0xeaf9('0x27'),_0x1dd5fd[_0xeaf9('0x11')],_0x5367c3);_0x531ec5(_0x205641[_0xeaf9('0x10')](0x1f4,_0x1dd5fd[_0xeaf9('0x11')]));});});});};exports[_0xeaf9('0x37')]=function(_0x210bf2){var _0x1432d8=this;return new Promise(function(_0x4cfb2a,_0xf5dc26){return db[_0xeaf9('0x29')][_0xeaf9('0x38')](function(_0x3193c8){return db[_0xeaf9('0x39')]['create'](_0x210bf2[_0xeaf9('0x24')],{'raw':_0x210bf2[_0xeaf9('0x16')]?_0x210bf2[_0xeaf9('0x16')][_0xeaf9('0x17')]===undefined?!![]:![]:!![],'transaction':_0x3193c8})[_0xeaf9('0xa')](function(){return db[_0xeaf9('0x14')]['destroy']({'where':_0x210bf2['options']?_0x210bf2[_0xeaf9('0x16')]['where']||null:null,'transaction':_0x3193c8});});})[_0xeaf9('0xa')](function(_0x56e320){logger[_0xeaf9('0xb')](_0xeaf9('0x37'),_0x210bf2);logger[_0xeaf9('0x1e')](_0xeaf9('0x37'),_0x210bf2,JSON[_0xeaf9('0xf')](_0x56e320));_0x4cfb2a(_0x56e320);})[_0xeaf9('0x12')](function(_0x277dc7){logger[_0xeaf9('0x10')]('MoveContactManagedDialer',_0x277dc7[_0xeaf9('0x11')],_0x210bf2);_0xf5dc26(_0x1432d8[_0xeaf9('0x10')](0x1f4,_0x277dc7[_0xeaf9('0x11')]));});});};exports[_0xeaf9('0x3a')]=function(_0x31fb5f){var _0x5cdf57=this;return new Promise(function(_0x376990,_0x5b0c25){return db['CmHopper'][_0xeaf9('0x15')]({'raw':_0x31fb5f[_0xeaf9('0x16')]?_0x31fb5f[_0xeaf9('0x16')][_0xeaf9('0x17')]===undefined?!![]:![]:!![],'where':_0x31fb5f[_0xeaf9('0x16')]?_0x31fb5f['options'][_0xeaf9('0x18')]||null:null,'attributes':[[db['sequelize']['fn'](_0xeaf9('0x3b'),db[_0xeaf9('0x29')]['fn']('IF',db[_0xeaf9('0x29')][_0xeaf9('0x3c')](_0xeaf9('0x3d')+util['format']('\x22%s\x22',moment()[_0xeaf9('0x3e')](_0xeaf9('0x3f')))+_0xeaf9('0x40')))),_0xeaf9('0x41')]]})['then'](function(_0xfbd266){logger[_0xeaf9('0xb')](_0xeaf9('0x3a'),_0x31fb5f);logger[_0xeaf9('0x1e')](_0xeaf9('0x3a'),_0x31fb5f,JSON['stringify'](_0xfbd266));_0x376990(_0xfbd266);})[_0xeaf9('0x12')](function(_0x363835){logger[_0xeaf9('0x10')](_0xeaf9('0x3a'),_0x363835[_0xeaf9('0x11')],_0x31fb5f);_0x5b0c25(_0x5cdf57['error'](0x1f4,_0x363835['message']));});});};exports[_0xeaf9('0x42')]=function(_0x1a41c6){var _0xa83bfc=this;return new Promise(function(_0x61d52f,_0x3caeac){return db[_0xeaf9('0x2d')][_0xeaf9('0x28')]()['then'](function(_0x6175){return db[_0xeaf9('0x29')]['transaction'](function(_0x1452d4){return db[_0xeaf9('0x14')][_0xeaf9('0x15')]({'where':_0x1a41c6[_0xeaf9('0x16')]?_0x1a41c6['options'][_0xeaf9('0x18')]||null:null,'attributes':_0x1a41c6[_0xeaf9('0x16')]?_0x1a41c6[_0xeaf9('0x16')][_0xeaf9('0x19')]||null:null,'limit':0x1,'order':_0x1a41c6[_0xeaf9('0x16')]?_0x1a41c6[_0xeaf9('0x16')][_0xeaf9('0x2a')]||null:null,'group':db[_0xeaf9('0x14')][_0xeaf9('0x33')],'transaction':_0x1452d4,'lock':_0x1452d4[_0xeaf9('0x2b')]['UPDATE'],'include':_0x1a41c6[_0xeaf9('0x16')]?_0x1a41c6['options'][_0xeaf9('0x1d')]?_[_0xeaf9('0x1b')](_0x1a41c6[_0xeaf9('0x16')][_0xeaf9('0x1d')],function(_0x1bdd3e){return{'model':db[_0x1bdd3e['model']],'as':_0x1bdd3e['as'],'attributes':_0x1bdd3e[_0xeaf9('0x19')],'include':_0x1bdd3e[_0xeaf9('0x1d')]?_[_0xeaf9('0x1b')](_0x1bdd3e[_0xeaf9('0x1d')],function(_0x87417c){return{'model':db[_0x87417c['model']],'as':_0x87417c['as'],'attributes':_0x87417c[_0xeaf9('0x19')],'include':_0x87417c['include']?_['map'](_0x87417c[_0xeaf9('0x1d')],function(_0x3d8755){return{'model':db[_0x3d8755[_0xeaf9('0x1c')]],'as':_0x3d8755['as'],'attributes':_0x3d8755[_0xeaf9('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeaf9('0xa')](function(_0x44ceb2){var _0x3825ac=[];for(var _0x177efa=0x0;_0x177efa<_0x44ceb2[_0xeaf9('0x43')];_0x177efa+=0x1){_0x3825ac[_0xeaf9('0x34')](_0x44ceb2[_0x177efa][_0xeaf9('0x23')](_0x1a41c6['body'],{'transaction':_0x1452d4}));}return BPromise[_0xeaf9('0x36')](_0x3825ac);});})[_0xeaf9('0xa')](function(_0x4bf1d3){logger['info'](_0xeaf9('0x42'),_0x1a41c6);logger[_0xeaf9('0x1e')]('GetContactRecallMe',_0x1a41c6,JSON[_0xeaf9('0xf')](_0x4bf1d3));_0x61d52f(_0x4bf1d3);})[_0xeaf9('0x12')](function(_0x3b4540){logger[_0xeaf9('0x10')](_0xeaf9('0x42'),_0x3b4540['message'],_0x1a41c6);_0x3caeac(_0xa83bfc[_0xeaf9('0x10')](0x1f4,_0x3b4540[_0xeaf9('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x2163b8){var _0x43d36a=this;return new Promise(function(_0x22116e,_0x4a7270){db[_0xeaf9('0x2d')]['describe']()['then'](function(_0x5ba5c2){return db[_0xeaf9('0x14')][_0xeaf9('0x15')]({'raw':_0x2163b8[_0xeaf9('0x16')]?_0x2163b8[_0xeaf9('0x16')][_0xeaf9('0x17')]===undefined?!![]:![]:!![],'where':_0x2163b8[_0xeaf9('0x16')]?_0x2163b8[_0xeaf9('0x16')][_0xeaf9('0x18')]||null:null,'attributes':_0x2163b8[_0xeaf9('0x16')]?_0x2163b8[_0xeaf9('0x16')][_0xeaf9('0x19')]||null:null,'limit':_0x2163b8[_0xeaf9('0x16')]?_0x2163b8[_0xeaf9('0x16')]['limit']||null:null,'include':_0x2163b8['options']?_0x2163b8[_0xeaf9('0x16')][_0xeaf9('0x1d')]?_['map'](_0x2163b8[_0xeaf9('0x16')][_0xeaf9('0x1d')],function(_0x2c48c9){return{'model':db[_0x2c48c9['model']],'as':_0x2c48c9['as'],'attributes':_0x2c48c9['as']===_0xeaf9('0x2e')?_[_0xeaf9('0x44')](_0x5ba5c2):_0x2c48c9[_0xeaf9('0x19')],'include':_0x2c48c9[_0xeaf9('0x1d')]?_['map'](_0x2c48c9['include'],function(_0x8356e0){return{'model':db[_0x8356e0[_0xeaf9('0x1c')]],'as':_0x8356e0['as'],'attributes':_0x8356e0[_0xeaf9('0x19')],'include':_0x8356e0['include']?_['map'](_0x8356e0['include'],function(_0x233c9b){return{'model':db[_0x233c9b[_0xeaf9('0x1c')]],'as':_0x233c9b['as'],'attributes':_0x233c9b[_0xeaf9('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeaf9('0xa')](function(_0x26822a){logger['info'](_0xeaf9('0x13'),_0x2163b8);logger['debug'](_0xeaf9('0x13'),_0x2163b8,JSON[_0xeaf9('0xf')](_0x26822a));_0x22116e(_0x26822a);})[_0xeaf9('0x12')](function(_0x590d2a){logger[_0xeaf9('0x10')](_0xeaf9('0x13'),_0x590d2a[_0xeaf9('0x11')],_0x2163b8);_0x4a7270(_0x43d36a['error'](0x1f4,_0x590d2a[_0xeaf9('0x11')]));});});});}; \ No newline at end of file +var _0x702d=['keys','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetCmHopper','debug','stringify','find','ShowCmHopper','CreateCmHopper','CmHopper','create','body','UpdateCmHopper','limit','DestroyCmHopper','destroy','CmContact','describe','sequelize','LOCK','UPDATE','Contact','User','Agent','name','length','UserId','push','update','includes','all','GetContactDialer','MoveContactManagedDialer','transaction','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','order','GetContactRecallMe','GetCmHopperPreview'];(function(_0x273b36,_0x18be49){var _0x374f7c=function(_0x2fb75e){while(--_0x2fb75e){_0x273b36['push'](_0x273b36['shift']());}};_0x374f7c(++_0x18be49);}(_0x702d,0xdf));var _0xd702=function(_0x3bcedd,_0x29fd1f){_0x3bcedd=_0x3bcedd-0x0;var _0x5560a0=_0x702d[_0x3bcedd];return _0x5560a0;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))('rpc');var config=require(_0xd702('0x8'));var jayson=require(_0xd702('0x9'));var client=jayson[_0xd702('0xa')][_0xd702('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x168f98,_0x3f7f8e,_0x5e57ff){return new BPromise(function(_0x4536b9,_0x508c87){return client[_0xd702('0xc')](_0x168f98,_0x5e57ff)[_0xd702('0xd')](function(_0x1a9cb6){logger[_0xd702('0xe')](_0xd702('0xf'),_0x3f7f8e,_0xd702('0x10'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x3f7f8e,_0xd702('0x10'),JSON['stringify'](_0x1a9cb6));if(_0x1a9cb6['error']){if(_0x1a9cb6[_0xd702('0x11')]['code']===0x1f4){logger['error'](_0xd702('0xf'),_0x3f7f8e,_0x1a9cb6[_0xd702('0x11')]['message']);return _0x508c87(_0x1a9cb6[_0xd702('0x11')]['message']);}logger['error'](_0xd702('0xf'),_0x3f7f8e,_0x1a9cb6[_0xd702('0x11')][_0xd702('0x12')]);return _0x4536b9(_0x1a9cb6[_0xd702('0x11')]['message']);}else{logger[_0xd702('0xe')](_0xd702('0xf'),_0x3f7f8e,_0xd702('0x10'));_0x4536b9(_0x1a9cb6[_0xd702('0x13')][_0xd702('0x12')]);}})[_0xd702('0x14')](function(_0x4ea71a){logger[_0xd702('0x11')](_0xd702('0xf'),_0x3f7f8e,_0x4ea71a);_0x508c87(_0x4ea71a);});});}exports['GetCmHopper']=function(_0xbf9ac3){var _0x26bb14=this;return new Promise(function(_0x26102e,_0x5dab40){return db['CmHopper'][_0xd702('0x15')]({'raw':_0xbf9ac3[_0xd702('0x16')]?_0xbf9ac3[_0xd702('0x16')][_0xd702('0x17')]===undefined?!![]:![]:!![],'where':_0xbf9ac3['options']?_0xbf9ac3['options'][_0xd702('0x18')]||null:null,'attributes':_0xbf9ac3['options']?_0xbf9ac3['options'][_0xd702('0x19')]||null:null,'limit':_0xbf9ac3[_0xd702('0x16')]?_0xbf9ac3[_0xd702('0x16')]['limit']||null:null,'include':_0xbf9ac3[_0xd702('0x16')]?_0xbf9ac3['options'][_0xd702('0x1a')]?_[_0xd702('0x1b')](_0xbf9ac3[_0xd702('0x16')][_0xd702('0x1a')],function(_0x1be953){return{'model':db[_0x1be953[_0xd702('0x1c')]],'as':_0x1be953['as'],'attributes':_0x1be953[_0xd702('0x19')],'include':_0x1be953[_0xd702('0x1a')]?_[_0xd702('0x1b')](_0x1be953[_0xd702('0x1a')],function(_0x38187c){return{'model':db[_0x38187c[_0xd702('0x1c')]],'as':_0x38187c['as'],'attributes':_0x38187c[_0xd702('0x19')],'include':_0x38187c[_0xd702('0x1a')]?_[_0xd702('0x1b')](_0x38187c['include'],function(_0x22f1cf){return{'model':db[_0x22f1cf[_0xd702('0x1c')]],'as':_0x22f1cf['as'],'attributes':_0x22f1cf['attributes']};}):[]};}):[]};}):[]:[]})[_0xd702('0xd')](function(_0x210217){logger[_0xd702('0xe')](_0xd702('0x1d'),_0xbf9ac3);logger[_0xd702('0x1e')](_0xd702('0x1d'),_0xbf9ac3,JSON[_0xd702('0x1f')](_0x210217));_0x26102e(_0x210217);})[_0xd702('0x14')](function(_0x2a9d64){logger[_0xd702('0x11')](_0xd702('0x1d'),_0x2a9d64[_0xd702('0x12')],_0xbf9ac3);_0x5dab40(_0x26bb14[_0xd702('0x11')](0x1f4,_0x2a9d64[_0xd702('0x12')]));});});};exports['ShowCmHopper']=function(_0x2387e4){var _0x36e3e2=this;return new Promise(function(_0x32738b,_0x1d67bc){return db['CmHopper'][_0xd702('0x20')]({'raw':_0x2387e4[_0xd702('0x16')]?_0x2387e4[_0xd702('0x16')][_0xd702('0x17')]===undefined?!![]:![]:!![],'where':_0x2387e4[_0xd702('0x16')]?_0x2387e4[_0xd702('0x16')][_0xd702('0x18')]||null:null,'attributes':_0x2387e4['options']?_0x2387e4[_0xd702('0x16')][_0xd702('0x19')]||null:null,'include':_0x2387e4[_0xd702('0x16')]?_0x2387e4[_0xd702('0x16')]['include']?_[_0xd702('0x1b')](_0x2387e4[_0xd702('0x16')][_0xd702('0x1a')],function(_0x3a81d1){return{'model':db[_0x3a81d1['model']],'as':_0x3a81d1['as'],'attributes':_0x3a81d1[_0xd702('0x19')],'include':_0x3a81d1[_0xd702('0x1a')]?_['map'](_0x3a81d1[_0xd702('0x1a')],function(_0xffa346){return{'model':db[_0xffa346['model']],'as':_0xffa346['as'],'attributes':_0xffa346[_0xd702('0x19')],'include':_0xffa346['include']?_[_0xd702('0x1b')](_0xffa346['include'],function(_0x41f550){return{'model':db[_0x41f550[_0xd702('0x1c')]],'as':_0x41f550['as'],'attributes':_0x41f550['attributes']};}):[]};}):[]};}):[]:[]})[_0xd702('0xd')](function(_0x4ef50d){logger['info'](_0xd702('0x21'),_0x2387e4);logger['debug'](_0xd702('0x21'),_0x2387e4,JSON[_0xd702('0x1f')](_0x4ef50d));_0x32738b(_0x4ef50d);})[_0xd702('0x14')](function(_0x1fbccc){logger[_0xd702('0x11')]('ShowCmHopper',_0x1fbccc[_0xd702('0x12')],_0x2387e4);_0x1d67bc(_0x36e3e2[_0xd702('0x11')](0x1f4,_0x1fbccc[_0xd702('0x12')]));});});};exports[_0xd702('0x22')]=function(_0xd9b7b5){var _0x1fdffa=this;return new Promise(function(_0x4a6501,_0x421b2e){return db[_0xd702('0x23')][_0xd702('0x24')](_0xd9b7b5[_0xd702('0x25')],{'raw':_0xd9b7b5[_0xd702('0x16')]?_0xd9b7b5[_0xd702('0x16')][_0xd702('0x17')]===undefined?!![]:![]:!![]})[_0xd702('0xd')](function(_0x48defb){logger['info'](_0xd702('0x22'),_0xd9b7b5);logger[_0xd702('0x1e')](_0xd702('0x22'),_0xd9b7b5,JSON[_0xd702('0x1f')](_0x48defb));_0x4a6501(_0x48defb);})[_0xd702('0x14')](function(_0x32e823){logger['error'](_0xd702('0x22'),_0x32e823[_0xd702('0x12')],_0xd9b7b5);_0x421b2e(_0x1fdffa[_0xd702('0x11')](0x1f4,_0x32e823[_0xd702('0x12')]));});});};exports[_0xd702('0x26')]=function(_0x2a6230){var _0x6420d8=this;return new Promise(function(_0x22cb91,_0x48d0fa){return db['CmHopper']['update'](_0x2a6230['body'],{'raw':_0x2a6230['options']?_0x2a6230['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a6230[_0xd702('0x16')]?_0x2a6230[_0xd702('0x16')][_0xd702('0x18')]||null:null,'attributes':_0x2a6230[_0xd702('0x16')]?_0x2a6230[_0xd702('0x16')][_0xd702('0x19')]||null:null,'limit':_0x2a6230[_0xd702('0x16')]?_0x2a6230['options'][_0xd702('0x27')]||null:null})[_0xd702('0xd')](function(_0x5f411f){logger[_0xd702('0xe')](_0xd702('0x26'),_0x2a6230);logger[_0xd702('0x1e')](_0xd702('0x26'),_0x2a6230,JSON[_0xd702('0x1f')](_0x5f411f));_0x22cb91(_0x5f411f);})[_0xd702('0x14')](function(_0x2f023c){logger['error']('UpdateCmHopper',_0x2f023c[_0xd702('0x12')],_0x2a6230);_0x48d0fa(_0x6420d8[_0xd702('0x11')](0x1f4,_0x2f023c[_0xd702('0x12')]));});});};exports[_0xd702('0x28')]=function(_0x140742){var _0x16952f=this;return new Promise(function(_0x1ff4d9,_0x17aa1b){return db[_0xd702('0x23')][_0xd702('0x29')]({'where':_0x140742[_0xd702('0x16')]?_0x140742[_0xd702('0x16')][_0xd702('0x18')]||null:null})[_0xd702('0xd')](function(_0x54e5bc){logger[_0xd702('0xe')]('DestroyCmHopper',_0x140742);logger[_0xd702('0x1e')](_0xd702('0x28'),_0x140742,JSON[_0xd702('0x1f')](_0x54e5bc));_0x1ff4d9(_0x54e5bc);})[_0xd702('0x14')](function(_0x4f7dc2){logger[_0xd702('0x11')](_0xd702('0x28'),_0x4f7dc2[_0xd702('0x12')],_0x140742);_0x17aa1b(_0x16952f['error'](0x1f4,_0x4f7dc2[_0xd702('0x12')]));});});};exports['GetContactDialer']=function(_0x2d7b83){var _0x275931=this;return new Promise(function(_0x4fa436,_0x380822){return db[_0xd702('0x2a')][_0xd702('0x2b')]()[_0xd702('0xd')](function(_0x6abd4e){return db[_0xd702('0x2c')]['transaction'](function(_0x49e254){return db[_0xd702('0x23')]['findAll']({'where':_0x2d7b83[_0xd702('0x16')]?_0x2d7b83[_0xd702('0x16')][_0xd702('0x18')]||null:null,'attributes':_0x2d7b83[_0xd702('0x16')]?_0x2d7b83[_0xd702('0x16')][_0xd702('0x19')]||null:null,'limit':_0x2d7b83[_0xd702('0x16')]?_0x2d7b83[_0xd702('0x16')][_0xd702('0x27')]||null:null,'order':_0x2d7b83[_0xd702('0x16')]?_0x2d7b83[_0xd702('0x16')]['order']||null:null,'transaction':_0x49e254,'lock':_0x49e254[_0xd702('0x2d')][_0xd702('0x2e')],'include':[{'model':db[_0xd702('0x2a')],'as':_0xd702('0x2f'),'attributes':_['keys'](_0x6abd4e)},{'model':db[_0xd702('0x30')],'as':_0xd702('0x31'),'attributes':['id',_0xd702('0x32'),'voicePause']}]})[_0xd702('0xd')](function(_0x288ab6){var _0x18c080=[];var _0x4b74ad=[];for(var _0x4fc006=0x0;_0x4fc006<_0x288ab6[_0xd702('0x33')];_0x4fc006+=0x1){var _0x37b4e7=_0x288ab6[_0x4fc006][_0xd702('0x34')];if(_0x37b4e7===null){_0x18c080[_0xd702('0x35')](_0x288ab6[_0x4fc006][_0xd702('0x36')](_0x2d7b83[_0xd702('0x25')],{'transaction':_0x49e254}));}else if(!_0x4b74ad[_0xd702('0x37')](_0x37b4e7)){_0x4b74ad['push'](_0x37b4e7);_0x18c080['push'](_0x288ab6[_0x4fc006][_0xd702('0x36')](_0x2d7b83[_0xd702('0x25')],{'transaction':_0x49e254}));}}return BPromise[_0xd702('0x38')](_0x18c080);});})[_0xd702('0xd')](function(_0x53cb99){logger['info']('GetContactDialer',_0x2d7b83);logger['debug'](_0xd702('0x39'),_0x2d7b83,JSON[_0xd702('0x1f')](_0x53cb99));_0x4fa436(_0x53cb99);})[_0xd702('0x14')](function(_0x1f958e){logger[_0xd702('0x11')](_0xd702('0x39'),_0x1f958e[_0xd702('0x12')],_0x2d7b83);_0x380822(_0x275931[_0xd702('0x11')](0x1f4,_0x1f958e['message']));});});});};exports[_0xd702('0x3a')]=function(_0x4aedd4){var _0x747df3=this;return new Promise(function(_0x407125,_0x37de56){return db[_0xd702('0x2c')][_0xd702('0x3b')](function(_0x1b35d1){return db[_0xd702('0x3c')][_0xd702('0x24')](_0x4aedd4[_0xd702('0x25')],{'raw':_0x4aedd4[_0xd702('0x16')]?_0x4aedd4[_0xd702('0x16')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1b35d1})[_0xd702('0xd')](function(){return db[_0xd702('0x23')][_0xd702('0x29')]({'where':_0x4aedd4[_0xd702('0x16')]?_0x4aedd4[_0xd702('0x16')][_0xd702('0x18')]||null:null,'transaction':_0x1b35d1});});})[_0xd702('0xd')](function(_0x65aab6){logger[_0xd702('0xe')](_0xd702('0x3a'),_0x4aedd4);logger[_0xd702('0x1e')]('MoveContactManagedDialer',_0x4aedd4,JSON[_0xd702('0x1f')](_0x65aab6));_0x407125(_0x65aab6);})[_0xd702('0x14')](function(_0x30f77e){logger[_0xd702('0x11')](_0xd702('0x3a'),_0x30f77e[_0xd702('0x12')],_0x4aedd4);_0x37de56(_0x747df3[_0xd702('0x11')](0x1f4,_0x30f77e[_0xd702('0x12')]));});});};exports['CountReScheduled']=function(_0x583df6){var _0x30dcff=this;return new Promise(function(_0x4ee49d,_0x4409f0){return db[_0xd702('0x23')][_0xd702('0x15')]({'raw':_0x583df6['options']?_0x583df6[_0xd702('0x16')][_0xd702('0x17')]===undefined?!![]:![]:!![],'where':_0x583df6['options']?_0x583df6['options']['where']||null:null,'attributes':[[db[_0xd702('0x2c')]['fn'](_0xd702('0x3d'),db[_0xd702('0x2c')]['fn']('IF',db[_0xd702('0x2c')][_0xd702('0x3e')](_0xd702('0x3f')+util[_0xd702('0x40')](_0xd702('0x41'),moment()['format'](_0xd702('0x42')))+_0xd702('0x43')))),_0xd702('0x44')]]})['then'](function(_0x181f92){logger['info']('CountReScheduled',_0x583df6);logger[_0xd702('0x1e')](_0xd702('0x45'),_0x583df6,JSON[_0xd702('0x1f')](_0x181f92));_0x4ee49d(_0x181f92);})[_0xd702('0x14')](function(_0x54a792){logger[_0xd702('0x11')](_0xd702('0x45'),_0x54a792[_0xd702('0x12')],_0x583df6);_0x4409f0(_0x30dcff['error'](0x1f4,_0x54a792[_0xd702('0x12')]));});});};exports['GetContactRecallMe']=function(_0x226e9a){var _0x4dc1eb=this;return new Promise(function(_0x124558,_0x43f96){return db[_0xd702('0x2a')][_0xd702('0x2b')]()[_0xd702('0xd')](function(_0x46b7b7){return db['sequelize']['transaction'](function(_0x162018){return db[_0xd702('0x23')][_0xd702('0x15')]({'where':_0x226e9a[_0xd702('0x16')]?_0x226e9a[_0xd702('0x16')][_0xd702('0x18')]||null:null,'attributes':_0x226e9a['options']?_0x226e9a[_0xd702('0x16')][_0xd702('0x19')]||null:null,'limit':0x1,'order':_0x226e9a[_0xd702('0x16')]?_0x226e9a['options'][_0xd702('0x46')]||null:null,'group':db[_0xd702('0x23')]['UserId'],'transaction':_0x162018,'lock':_0x162018[_0xd702('0x2d')]['UPDATE'],'include':_0x226e9a[_0xd702('0x16')]?_0x226e9a['options'][_0xd702('0x1a')]?_['map'](_0x226e9a['options']['include'],function(_0x3632e9){return{'model':db[_0x3632e9[_0xd702('0x1c')]],'as':_0x3632e9['as'],'attributes':_0x3632e9[_0xd702('0x19')],'include':_0x3632e9['include']?_[_0xd702('0x1b')](_0x3632e9[_0xd702('0x1a')],function(_0x574631){return{'model':db[_0x574631[_0xd702('0x1c')]],'as':_0x574631['as'],'attributes':_0x574631[_0xd702('0x19')],'include':_0x574631[_0xd702('0x1a')]?_[_0xd702('0x1b')](_0x574631[_0xd702('0x1a')],function(_0x1c583f){return{'model':db[_0x1c583f[_0xd702('0x1c')]],'as':_0x1c583f['as'],'attributes':_0x1c583f[_0xd702('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd702('0xd')](function(_0x57cad9){var _0x382959=[];for(var _0x5c7f82=0x0;_0x5c7f82<_0x57cad9[_0xd702('0x33')];_0x5c7f82+=0x1){_0x382959['push'](_0x57cad9[_0x5c7f82][_0xd702('0x36')](_0x226e9a['body'],{'transaction':_0x162018}));}return BPromise[_0xd702('0x38')](_0x382959);});})['then'](function(_0x486148){logger[_0xd702('0xe')](_0xd702('0x47'),_0x226e9a);logger[_0xd702('0x1e')](_0xd702('0x47'),_0x226e9a,JSON[_0xd702('0x1f')](_0x486148));_0x124558(_0x486148);})[_0xd702('0x14')](function(_0x481e42){logger[_0xd702('0x11')](_0xd702('0x47'),_0x481e42[_0xd702('0x12')],_0x226e9a);_0x43f96(_0x4dc1eb['error'](0x1f4,_0x481e42['message']));});});});};exports[_0xd702('0x48')]=function(_0x7e5fb4){var _0x246e78=this;return new Promise(function(_0x130733,_0x259691){db[_0xd702('0x2a')][_0xd702('0x2b')]()['then'](function(_0x30459c){return db['CmHopper'][_0xd702('0x15')]({'raw':_0x7e5fb4[_0xd702('0x16')]?_0x7e5fb4[_0xd702('0x16')][_0xd702('0x17')]===undefined?!![]:![]:!![],'where':_0x7e5fb4['options']?_0x7e5fb4[_0xd702('0x16')][_0xd702('0x18')]||null:null,'attributes':_0x7e5fb4[_0xd702('0x16')]?_0x7e5fb4[_0xd702('0x16')][_0xd702('0x19')]||null:null,'limit':_0x7e5fb4[_0xd702('0x16')]?_0x7e5fb4['options'][_0xd702('0x27')]||null:null,'include':_0x7e5fb4[_0xd702('0x16')]?_0x7e5fb4[_0xd702('0x16')]['include']?_[_0xd702('0x1b')](_0x7e5fb4['options'][_0xd702('0x1a')],function(_0x1d7fa2){return{'model':db[_0x1d7fa2[_0xd702('0x1c')]],'as':_0x1d7fa2['as'],'attributes':_0x1d7fa2['as']===_0xd702('0x2f')?_[_0xd702('0x49')](_0x30459c):_0x1d7fa2[_0xd702('0x19')],'include':_0x1d7fa2[_0xd702('0x1a')]?_[_0xd702('0x1b')](_0x1d7fa2[_0xd702('0x1a')],function(_0x1332af){return{'model':db[_0x1332af[_0xd702('0x1c')]],'as':_0x1332af['as'],'attributes':_0x1332af['attributes'],'include':_0x1332af[_0xd702('0x1a')]?_[_0xd702('0x1b')](_0x1332af[_0xd702('0x1a')],function(_0x1f5df6){return{'model':db[_0x1f5df6[_0xd702('0x1c')]],'as':_0x1f5df6['as'],'attributes':_0x1f5df6[_0xd702('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x381343){logger[_0xd702('0xe')](_0xd702('0x1d'),_0x7e5fb4);logger[_0xd702('0x1e')]('GetCmHopper',_0x7e5fb4,JSON[_0xd702('0x1f')](_0x381343));_0x130733(_0x381343);})[_0xd702('0x14')](function(_0x33950b){logger['error'](_0xd702('0x1d'),_0x33950b[_0xd702('0x12')],_0x7e5fb4);_0x259691(_0x246e78[_0xd702('0x11')](0x1f4,_0x33950b[_0xd702('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 74a8b30..53534a2 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 _0x14b7=['/:id','show','create','post','/preview','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x14b7,0x130));var _0x714b=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x14b7[_0xe896bf];return _0x4c7a8a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x714b('0x0'));var timeout=require(_0x714b('0x1'));var express=require(_0x714b('0x2'));var router=express[_0x714b('0x3')]();var fs_extra=require(_0x714b('0x4'));var auth=require(_0x714b('0x5'));var interaction=require(_0x714b('0x6'));var config=require(_0x714b('0x7'));var controller=require('./cmHopper.controller');router[_0x714b('0x8')]('/',auth[_0x714b('0x9')](),controller['index']);router['get']('/describe',auth[_0x714b('0x9')](),controller[_0x714b('0xa')]);router[_0x714b('0x8')]('/opencontacts',auth[_0x714b('0x9')](),controller['getOpenContacts']);router[_0x714b('0x8')](_0x714b('0xb'),auth[_0x714b('0x9')](),controller[_0x714b('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x714b('0xd')]);router[_0x714b('0xe')](_0x714b('0xf'),auth[_0x714b('0x9')](),controller['getPreview']);router[_0x714b('0x10')](_0x714b('0xb'),auth[_0x714b('0x9')](),controller[_0x714b('0x11')]);router[_0x714b('0x12')](_0x714b('0xb'),auth['isAuthenticated'](),controller[_0x714b('0x13')]);module[_0x714b('0x14')]=router; \ No newline at end of file +var _0xceab=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','getPreview','put','update','delete'];(function(_0x44e061,_0x578093){var _0x428896=function(_0x462d69){while(--_0x462d69){_0x44e061['push'](_0x44e061['shift']());}};_0x428896(++_0x578093);}(_0xceab,0x95));var _0xbcea=function(_0x1750a9,_0x237e5e){_0x1750a9=_0x1750a9-0x0;var _0x29b709=_0xceab[_0x1750a9];return _0x29b709;};'use strict';var multer=require('multer');var util=require(_0xbcea('0x0'));var path=require(_0xbcea('0x1'));var timeout=require(_0xbcea('0x2'));var express=require(_0xbcea('0x3'));var router=express[_0xbcea('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbcea('0x5'));var config=require('../../config/environment');var controller=require(_0xbcea('0x6'));router[_0xbcea('0x7')]('/',auth[_0xbcea('0x8')](),controller[_0xbcea('0x9')]);router[_0xbcea('0x7')](_0xbcea('0xa'),auth[_0xbcea('0x8')](),controller['describe']);router[_0xbcea('0x7')]('/opencontacts',auth[_0xbcea('0x8')](),controller['getOpenContacts']);router[_0xbcea('0x7')](_0xbcea('0xb'),auth[_0xbcea('0x8')](),controller[_0xbcea('0xc')]);router[_0xbcea('0xd')]('/',auth['isAuthenticated'](),controller[_0xbcea('0xe')]);router[_0xbcea('0xd')]('/preview',auth['isAuthenticated'](),controller[_0xbcea('0xf')]);router[_0xbcea('0x10')](_0xbcea('0xb'),auth[_0xbcea('0x8')](),controller[_0xbcea('0x11')]);router[_0xbcea('0x12')](_0xbcea('0xb'),auth[_0xbcea('0x8')](),controller[_0xbcea('0x13')]);module[_0xbcea('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index e8c1ec4..589c433 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 _0xf072=['sequelize','exports','STRING','contactListQueue','INTEGER','moment'];(function(_0x34ac64,_0x23f246){var _0xae8ae9=function(_0x34cdcd){while(--_0x34cdcd){_0x34ac64['push'](_0x34ac64['shift']());}};_0xae8ae9(++_0x23f246);}(_0xf072,0x131));var _0x2f07=function(_0x209f2f,_0x38b54e){_0x209f2f=_0x209f2f-0x0;var _0x1597cf=_0xf072[_0x209f2f];return _0x1597cf;};'use strict';var moment=require(_0x2f07('0x0'));var Sequelize=require(_0x2f07('0x1'));module[_0x2f07('0x2')]={'phone':{'type':Sequelize[_0x2f07('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x2f07('0x4')},'ListId':{'type':Sequelize[_0x2f07('0x5')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x2f07('0x5')],'unique':_0x2f07('0x4')}}; \ No newline at end of file +var _0xf47e=['INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x470b7d,_0x12cac2){var _0x195460=function(_0x5033a1){while(--_0x5033a1){_0x470b7d['push'](_0x470b7d['shift']());}};_0x195460(++_0x12cac2);}(_0xf47e,0x1bf));var _0xef47=function(_0xa3e49f,_0x4093e6){_0xa3e49f=_0xa3e49f-0x0;var _0x80d1f9=_0xf47e[_0xa3e49f];return _0x80d1f9;};'use strict';var moment=require(_0xef47('0x0'));var Sequelize=require(_0xef47('0x1'));module['exports']={'phone':{'type':Sequelize[_0xef47('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xef47('0x3')],'unique':_0xef47('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xef47('0x4')},'VoiceQueueId':{'type':Sequelize[_0xef47('0x3')],'unique':_0xef47('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 84cfbcc..ad71ad5 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 _0x7d4e=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','then','destroy','end','error','stack','name','send','fieldName','type','model','map','keys','query','filters','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','CmHopperBlack','include','findAll','catch','params','rawAttributes','attributes','includeAll','find','update','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x584513,_0x37c6c9){var _0xe4a14e=function(_0x4aadc0){while(--_0x4aadc0){_0x584513['push'](_0x584513['shift']());}};_0xe4a14e(++_0x37c6c9);}(_0x7d4e,0xbb));var _0xe7d4=function(_0x1bf658,_0x1044af){_0x1bf658=_0x1bf658-0x0;var _0x756213=_0x7d4e[_0x1bf658];return _0x756213;};'use strict';var emlformat=require(_0xe7d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7d4('0x2'));var moment=require(_0xe7d4('0x3'));var BPromise=require(_0xe7d4('0x4'));var Mustache=require(_0xe7d4('0x5'));var util=require(_0xe7d4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe7d4('0x7'));var ejs=require(_0xe7d4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7d4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe7d4('0xa'));var deskjs=require(_0xe7d4('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe7d4('0xc'));var Papa=require(_0xe7d4('0xd'));var Redis=require(_0xe7d4('0xe'));var authService=require(_0xe7d4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe7d4('0x10'));var hardwareService=require(_0xe7d4('0x11'));var logger=require(_0xe7d4('0x12'))(_0xe7d4('0x13'));var utils=require(_0xe7d4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe7d4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d16c1,_0x54be0b){_0x54be0b=_0x54be0b||0xcc;return function(_0x1d4db3){if(_0x1d4db3){return _0x5d16c1[_0xe7d4('0x16')](_0x54be0b);}return _0x5d16c1[_0xe7d4('0x17')](_0x54be0b)['end']();};}function respondWithResult(_0x47b3b1,_0x1e41ba){_0x1e41ba=_0x1e41ba||0xc8;return function(_0x2f8a44){if(_0x2f8a44){return _0x47b3b1[_0xe7d4('0x17')](_0x1e41ba)[_0xe7d4('0x18')](_0x2f8a44);}};}function respondWithFilteredResult(_0x5f58e7,_0x45349e){return function(_0x485ae1){if(_0x485ae1){var _0x2f2e17=typeof _0x45349e['offset']===_0xe7d4('0x19')&&typeof _0x45349e[_0xe7d4('0x1a')]==='undefined';var _0x1e1d69=_0x485ae1['count'];var _0x331c0f=_0x2f2e17?0x0:_0x45349e[_0xe7d4('0x1b')];var _0xee4ebe=_0x2f2e17?_0x485ae1[_0xe7d4('0x1c')]:_0x45349e[_0xe7d4('0x1b')]+_0x45349e[_0xe7d4('0x1a')];var _0x3003d4;if(_0xee4ebe>=_0x1e1d69){_0xee4ebe=_0x1e1d69;_0x3003d4=0xc8;}else{_0x3003d4=0xce;}_0x5f58e7['status'](_0x3003d4);return _0x5f58e7[_0xe7d4('0x1d')](_0xe7d4('0x1e'),_0x331c0f+'-'+_0xee4ebe+'/'+_0x1e1d69)['json'](_0x485ae1);}return null;};}function patchUpdates(_0x4e7437){return function(_0x175996){try{jsonpatch[_0xe7d4('0x1f')](_0x175996,_0x4e7437,!![]);}catch(_0x4c8d8e){return BPromise['reject'](_0x4c8d8e);}return _0x175996['save']();};}function saveUpdates(_0x190ab5,_0x4f10b7){return function(_0x5e59e9){if(_0x5e59e9){return _0x5e59e9['update'](_0x190ab5)[_0xe7d4('0x20')](function(_0x3a64e7){return _0x3a64e7;});}return null;};}function removeEntity(_0x929370,_0x4c1717){return function(_0x51e13c){if(_0x51e13c){return _0x51e13c[_0xe7d4('0x21')]()[_0xe7d4('0x20')](function(){_0x929370['status'](0xcc)[_0xe7d4('0x22')]();});}};}function handleEntityNotFound(_0x2de6b7,_0x19983e){return function(_0x3fcf24){if(!_0x3fcf24){_0x2de6b7[_0xe7d4('0x16')](0x194);}return _0x3fcf24;};}function handleError(_0x11b1a4,_0xbaf873){_0xbaf873=_0xbaf873||0x1f4;return function(_0x3eb21d){logger[_0xe7d4('0x23')](_0x3eb21d[_0xe7d4('0x24')]);if(_0x3eb21d[_0xe7d4('0x25')]){delete _0x3eb21d[_0xe7d4('0x25')];}_0x11b1a4[_0xe7d4('0x17')](_0xbaf873)[_0xe7d4('0x26')](_0x3eb21d);};}exports['index']=function(_0xc36a3a,_0x3fe2c2){var _0x11ce00={},_0x55fedd={},_0x29be8c={'count':0x0,'rows':[]};var _0x305f42=_['map'](db['CmHopperBlack']['rawAttributes'],function(_0xa22aa){return{'name':_0xa22aa[_0xe7d4('0x27')],'type':_0xa22aa[_0xe7d4('0x28')]['key']};});_0x55fedd[_0xe7d4('0x29')]=_[_0xe7d4('0x2a')](_0x305f42,'name');_0x55fedd['query']=_[_0xe7d4('0x2b')](_0xc36a3a[_0xe7d4('0x2c')]);_0x55fedd[_0xe7d4('0x2d')]=_[_0xe7d4('0x2e')](_0x55fedd[_0xe7d4('0x29')],_0x55fedd[_0xe7d4('0x2c')]);_0x11ce00['attributes']=_[_0xe7d4('0x2e')](_0x55fedd['model'],qs[_0xe7d4('0x2f')](_0xc36a3a[_0xe7d4('0x2c')][_0xe7d4('0x2f')]));_0x11ce00['attributes']=_0x11ce00['attributes'][_0xe7d4('0x30')]?_0x11ce00['attributes']:_0x55fedd[_0xe7d4('0x29')];if(!_0xc36a3a[_0xe7d4('0x2c')]['hasOwnProperty'](_0xe7d4('0x31'))){_0x11ce00[_0xe7d4('0x1a')]=qs[_0xe7d4('0x1a')](_0xc36a3a[_0xe7d4('0x2c')]['limit']);_0x11ce00[_0xe7d4('0x1b')]=qs[_0xe7d4('0x1b')](_0xc36a3a[_0xe7d4('0x2c')][_0xe7d4('0x1b')]);}_0x11ce00['order']=qs['sort'](_0xc36a3a[_0xe7d4('0x2c')][_0xe7d4('0x32')]);_0x11ce00[_0xe7d4('0x33')]=qs[_0xe7d4('0x2d')](_[_0xe7d4('0x34')](_0xc36a3a[_0xe7d4('0x2c')],_0x55fedd['filters']),_0x305f42);if(_0xc36a3a['query'][_0xe7d4('0x35')]){_0x11ce00[_0xe7d4('0x33')]=_[_0xe7d4('0x36')](_0x11ce00['where'],{'$or':_[_0xe7d4('0x2a')](_0x305f42,function(_0x2138c2){if(_0x2138c2['type']!=='VIRTUAL'){var _0x153a40={};_0x153a40[_0x2138c2[_0xe7d4('0x25')]]={'$like':'%'+_0xc36a3a[_0xe7d4('0x2c')]['filter']+'%'};return _0x153a40;}})});}_0x11ce00=_[_0xe7d4('0x36')]({},_0x11ce00,_0xc36a3a[_0xe7d4('0x37')]);var _0x3c09b5={'where':_0x11ce00[_0xe7d4('0x33')]};return db[_0xe7d4('0x38')]['count'](_0x3c09b5)[_0xe7d4('0x20')](function(_0xd30e56){_0x29be8c[_0xe7d4('0x1c')]=_0xd30e56;if(_0xc36a3a[_0xe7d4('0x2c')]['includeAll']){_0x11ce00[_0xe7d4('0x39')]=[{'all':!![]}];}return db[_0xe7d4('0x38')][_0xe7d4('0x3a')](_0x11ce00);})[_0xe7d4('0x20')](function(_0x461f51){_0x29be8c['rows']=_0x461f51;return _0x29be8c;})[_0xe7d4('0x20')](respondWithFilteredResult(_0x3fe2c2,_0x11ce00))[_0xe7d4('0x3b')](handleError(_0x3fe2c2,null));};exports['show']=function(_0x2953fc,_0x44cf64){var _0x39b774={'raw':!![],'where':{'id':_0x2953fc[_0xe7d4('0x3c')]['id']}},_0x4406c6={};_0x4406c6[_0xe7d4('0x29')]=_[_0xe7d4('0x2b')](db[_0xe7d4('0x38')][_0xe7d4('0x3d')]);_0x4406c6[_0xe7d4('0x2c')]=_[_0xe7d4('0x2b')](_0x2953fc[_0xe7d4('0x2c')]);_0x4406c6[_0xe7d4('0x2d')]=_['intersection'](_0x4406c6[_0xe7d4('0x29')],_0x4406c6[_0xe7d4('0x2c')]);_0x39b774[_0xe7d4('0x3e')]=_[_0xe7d4('0x2e')](_0x4406c6[_0xe7d4('0x29')],qs[_0xe7d4('0x2f')](_0x2953fc[_0xe7d4('0x2c')]['fields']));_0x39b774['attributes']=_0x39b774[_0xe7d4('0x3e')][_0xe7d4('0x30')]?_0x39b774[_0xe7d4('0x3e')]:_0x4406c6[_0xe7d4('0x29')];if(_0x2953fc[_0xe7d4('0x2c')][_0xe7d4('0x3f')]){_0x39b774[_0xe7d4('0x39')]=[{'all':!![]}];}_0x39b774=_[_0xe7d4('0x36')]({},_0x39b774,_0x2953fc[_0xe7d4('0x37')]);return db[_0xe7d4('0x38')][_0xe7d4('0x40')](_0x39b774)['then'](handleEntityNotFound(_0x44cf64,null))[_0xe7d4('0x20')](respondWithResult(_0x44cf64,null))[_0xe7d4('0x3b')](handleError(_0x44cf64,null));};exports[_0xe7d4('0x41')]=function(_0x650408,_0x5b3a27){if(_0x650408[_0xe7d4('0x42')]['id']){delete _0x650408['body']['id'];}return db[_0xe7d4('0x38')]['find']({'where':{'id':_0x650408['params']['id']}})[_0xe7d4('0x20')](handleEntityNotFound(_0x5b3a27,null))['then'](saveUpdates(_0x650408[_0xe7d4('0x42')],null))[_0xe7d4('0x20')](respondWithResult(_0x5b3a27,null))[_0xe7d4('0x3b')](handleError(_0x5b3a27,null));};exports['destroy']=function(_0x54a19c,_0x5d1f46){return db[_0xe7d4('0x38')]['find']({'where':{'id':_0x54a19c[_0xe7d4('0x3c')]['id']}})[_0xe7d4('0x20')](handleEntityNotFound(_0x5d1f46,null))[_0xe7d4('0x20')](removeEntity(_0x5d1f46,null))[_0xe7d4('0x3b')](handleError(_0x5d1f46,null));};exports[_0xe7d4('0x43')]=function(_0x3b7fb7,_0x2844a3){return db['CmHopperBlack']['describe']()[_0xe7d4('0x20')](respondWithResult(_0x2844a3,null))[_0xe7d4('0x3b')](handleError(_0x2844a3,null));}; \ No newline at end of file +var _0xacc6=['sendStatus','error','stack','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','CmHopperBlack','include','findAll','rows','catch','show','keys','length','includeAll','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacc6,0x150));var _0x6acc=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0xacc6[_0x4ca6a4];return _0x120555;};'use strict';var emlformat=require(_0x6acc('0x0'));var rimraf=require(_0x6acc('0x1'));var zipdir=require(_0x6acc('0x2'));var jsonpatch=require(_0x6acc('0x3'));var rp=require(_0x6acc('0x4'));var moment=require('moment');var BPromise=require(_0x6acc('0x5'));var Mustache=require(_0x6acc('0x6'));var util=require(_0x6acc('0x7'));var path=require('path');var sox=require(_0x6acc('0x8'));var csv=require('to-csv');var ejs=require(_0x6acc('0x9'));var fs=require('fs');var fs_extra=require(_0x6acc('0xa'));var _=require('lodash');var squel=require(_0x6acc('0xb'));var crypto=require('crypto');var jsforce=require(_0x6acc('0xc'));var deskjs=require(_0x6acc('0xd'));var toCsv=require(_0x6acc('0xe'));var querystring=require(_0x6acc('0xf'));var Papa=require('papaparse');var Redis=require(_0x6acc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6acc('0x11'));var as=require(_0x6acc('0x12'));var hardwareService=require(_0x6acc('0x13'));var logger=require(_0x6acc('0x14'))(_0x6acc('0x15'));var utils=require(_0x6acc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6acc('0x17'));var db=require(_0x6acc('0x18'))['db'];function respondWithStatusCode(_0x1d951c,_0xcf8224){_0xcf8224=_0xcf8224||0xcc;return function(_0x1b95a6){if(_0x1b95a6){return _0x1d951c['sendStatus'](_0xcf8224);}return _0x1d951c['status'](_0xcf8224)[_0x6acc('0x19')]();};}function respondWithResult(_0x497356,_0x14a543){_0x14a543=_0x14a543||0xc8;return function(_0x230318){if(_0x230318){return _0x497356[_0x6acc('0x1a')](_0x14a543)[_0x6acc('0x1b')](_0x230318);}};}function respondWithFilteredResult(_0x3c4e61,_0x4034fb){return function(_0xf24527){if(_0xf24527){var _0xc07208=typeof _0x4034fb[_0x6acc('0x1c')]===_0x6acc('0x1d')&&typeof _0x4034fb[_0x6acc('0x1e')]===_0x6acc('0x1d');var _0x24f513=_0xf24527[_0x6acc('0x1f')];var _0x3818d8=_0xc07208?0x0:_0x4034fb[_0x6acc('0x1c')];var _0x4ee616=_0xc07208?_0xf24527[_0x6acc('0x1f')]:_0x4034fb[_0x6acc('0x1c')]+_0x4034fb[_0x6acc('0x1e')];var _0x151282;if(_0x4ee616>=_0x24f513){_0x4ee616=_0x24f513;_0x151282=0xc8;}else{_0x151282=0xce;}_0x3c4e61['status'](_0x151282);return _0x3c4e61[_0x6acc('0x20')]('Content-Range',_0x3818d8+'-'+_0x4ee616+'/'+_0x24f513)['json'](_0xf24527);}return null;};}function patchUpdates(_0x4af9e){return function(_0x5d5382){try{jsonpatch[_0x6acc('0x21')](_0x5d5382,_0x4af9e,!![]);}catch(_0x3edf4a){return BPromise[_0x6acc('0x22')](_0x3edf4a);}return _0x5d5382[_0x6acc('0x23')]();};}function saveUpdates(_0x245536,_0x5ecb25){return function(_0x3e4a71){if(_0x3e4a71){return _0x3e4a71[_0x6acc('0x24')](_0x245536)['then'](function(_0x334416){return _0x334416;});}return null;};}function removeEntity(_0x5ba0b6,_0x22abf1){return function(_0x1db7bd){if(_0x1db7bd){return _0x1db7bd[_0x6acc('0x25')]()[_0x6acc('0x26')](function(){_0x5ba0b6['status'](0xcc)[_0x6acc('0x19')]();});}};}function handleEntityNotFound(_0xa4d97c,_0x4a4ca1){return function(_0x10f286){if(!_0x10f286){_0xa4d97c[_0x6acc('0x27')](0x194);}return _0x10f286;};}function handleError(_0x441f90,_0x125084){_0x125084=_0x125084||0x1f4;return function(_0x212bde){logger[_0x6acc('0x28')](_0x212bde[_0x6acc('0x29')]);if(_0x212bde[_0x6acc('0x2a')]){delete _0x212bde['name'];}_0x441f90[_0x6acc('0x1a')](_0x125084)[_0x6acc('0x2b')](_0x212bde);};}exports[_0x6acc('0x2c')]=function(_0x490ce6,_0x1bcfad){var _0x8e75a9={},_0x3c8c95={},_0x259373={'count':0x0,'rows':[]};var _0x19fdd3=_[_0x6acc('0x2d')](db['CmHopperBlack']['rawAttributes'],function(_0x47ff48){return{'name':_0x47ff48['fieldName'],'type':_0x47ff48[_0x6acc('0x2e')][_0x6acc('0x2f')]};});_0x3c8c95[_0x6acc('0x30')]=_[_0x6acc('0x2d')](_0x19fdd3,_0x6acc('0x2a'));_0x3c8c95[_0x6acc('0x31')]=_['keys'](_0x490ce6['query']);_0x3c8c95[_0x6acc('0x32')]=_[_0x6acc('0x33')](_0x3c8c95[_0x6acc('0x30')],_0x3c8c95[_0x6acc('0x31')]);_0x8e75a9['attributes']=_[_0x6acc('0x33')](_0x3c8c95[_0x6acc('0x30')],qs['fields'](_0x490ce6[_0x6acc('0x31')][_0x6acc('0x34')]));_0x8e75a9[_0x6acc('0x35')]=_0x8e75a9['attributes']['length']?_0x8e75a9[_0x6acc('0x35')]:_0x3c8c95[_0x6acc('0x30')];if(!_0x490ce6['query']['hasOwnProperty'](_0x6acc('0x36'))){_0x8e75a9[_0x6acc('0x1e')]=qs[_0x6acc('0x1e')](_0x490ce6['query'][_0x6acc('0x1e')]);_0x8e75a9[_0x6acc('0x1c')]=qs[_0x6acc('0x1c')](_0x490ce6[_0x6acc('0x31')][_0x6acc('0x1c')]);}_0x8e75a9['order']=qs[_0x6acc('0x37')](_0x490ce6['query'][_0x6acc('0x37')]);_0x8e75a9[_0x6acc('0x38')]=qs['filters'](_[_0x6acc('0x39')](_0x490ce6['query'],_0x3c8c95['filters']),_0x19fdd3);if(_0x490ce6[_0x6acc('0x31')][_0x6acc('0x3a')]){_0x8e75a9[_0x6acc('0x38')]=_['merge'](_0x8e75a9[_0x6acc('0x38')],{'$or':_['map'](_0x19fdd3,function(_0x1841b1){if(_0x1841b1['type']!==_0x6acc('0x3b')){var _0x13f74a={};_0x13f74a[_0x1841b1['name']]={'$like':'%'+_0x490ce6[_0x6acc('0x31')][_0x6acc('0x3a')]+'%'};return _0x13f74a;}})});}_0x8e75a9=_[_0x6acc('0x3c')]({},_0x8e75a9,_0x490ce6[_0x6acc('0x3d')]);var _0x46f7db={'where':_0x8e75a9[_0x6acc('0x38')]};return db[_0x6acc('0x3e')]['count'](_0x46f7db)['then'](function(_0x3481ad){_0x259373[_0x6acc('0x1f')]=_0x3481ad;if(_0x490ce6[_0x6acc('0x31')]['includeAll']){_0x8e75a9[_0x6acc('0x3f')]=[{'all':!![]}];}return db[_0x6acc('0x3e')][_0x6acc('0x40')](_0x8e75a9);})[_0x6acc('0x26')](function(_0x3f848c){_0x259373[_0x6acc('0x41')]=_0x3f848c;return _0x259373;})[_0x6acc('0x26')](respondWithFilteredResult(_0x1bcfad,_0x8e75a9))[_0x6acc('0x42')](handleError(_0x1bcfad,null));};exports[_0x6acc('0x43')]=function(_0x1c2776,_0x114709){var _0x17f828={'raw':!![],'where':{'id':_0x1c2776['params']['id']}},_0x5c938d={};_0x5c938d['model']=_[_0x6acc('0x44')](db['CmHopperBlack']['rawAttributes']);_0x5c938d[_0x6acc('0x31')]=_[_0x6acc('0x44')](_0x1c2776[_0x6acc('0x31')]);_0x5c938d[_0x6acc('0x32')]=_[_0x6acc('0x33')](_0x5c938d[_0x6acc('0x30')],_0x5c938d[_0x6acc('0x31')]);_0x17f828[_0x6acc('0x35')]=_[_0x6acc('0x33')](_0x5c938d[_0x6acc('0x30')],qs[_0x6acc('0x34')](_0x1c2776[_0x6acc('0x31')][_0x6acc('0x34')]));_0x17f828['attributes']=_0x17f828[_0x6acc('0x35')][_0x6acc('0x45')]?_0x17f828['attributes']:_0x5c938d[_0x6acc('0x30')];if(_0x1c2776['query'][_0x6acc('0x46')]){_0x17f828[_0x6acc('0x3f')]=[{'all':!![]}];}_0x17f828=_['merge']({},_0x17f828,_0x1c2776[_0x6acc('0x3d')]);return db[_0x6acc('0x3e')][_0x6acc('0x47')](_0x17f828)[_0x6acc('0x26')](handleEntityNotFound(_0x114709,null))[_0x6acc('0x26')](respondWithResult(_0x114709,null))['catch'](handleError(_0x114709,null));};exports[_0x6acc('0x24')]=function(_0x391a4f,_0x45c5e0){if(_0x391a4f[_0x6acc('0x48')]['id']){delete _0x391a4f[_0x6acc('0x48')]['id'];}return db[_0x6acc('0x3e')][_0x6acc('0x47')]({'where':{'id':_0x391a4f[_0x6acc('0x49')]['id']}})[_0x6acc('0x26')](handleEntityNotFound(_0x45c5e0,null))[_0x6acc('0x26')](saveUpdates(_0x391a4f[_0x6acc('0x48')],null))[_0x6acc('0x26')](respondWithResult(_0x45c5e0,null))[_0x6acc('0x42')](handleError(_0x45c5e0,null));};exports[_0x6acc('0x25')]=function(_0x2a634f,_0x2ad59d){return db[_0x6acc('0x3e')]['find']({'where':{'id':_0x2a634f['params']['id']}})['then'](handleEntityNotFound(_0x2ad59d,null))[_0x6acc('0x26')](removeEntity(_0x2ad59d,null))[_0x6acc('0x42')](handleError(_0x2ad59d,null));};exports['describe']=function(_0x13e10e,_0x16508d){return db[_0x6acc('0x3e')][_0x6acc('0x4a')]()['then'](respondWithResult(_0x16508d,null))[_0x6acc('0x42')](handleError(_0x16508d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 0d28dd7..4c8ca73 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 _0x6a86=['./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4760f6,_0x220599){var _0x4432bd=function(_0x59f1bf){while(--_0x59f1bf){_0x4760f6['push'](_0x4760f6['shift']());}};_0x4432bd(++_0x220599);}(_0x6a86,0x108));var _0x66a8=function(_0x1416ed,_0x4de25d){_0x1416ed=_0x1416ed-0x0;var _0x30313a=_0x6a86[_0x1416ed];return _0x30313a;};'use strict';var _=require(_0x66a8('0x0'));var util=require(_0x66a8('0x1'));var logger=require(_0x66a8('0x2'))(_0x66a8('0x3'));var moment=require(_0x66a8('0x4'));var BPromise=require('bluebird');var rp=require(_0x66a8('0x5'));var fs=require('fs');var path=require(_0x66a8('0x6'));var rimraf=require(_0x66a8('0x7'));var config=require(_0x66a8('0x8'));var attributes=require(_0x66a8('0x9'));module[_0x66a8('0xa')]=function(_0x2e5d0c,_0x483d83){return _0x2e5d0c['define'](_0x66a8('0xb'),attributes,{'tableName':_0x66a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9237=['../../config/environment','./cmHopperBlack.attributes','exports','define','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x387a1a,_0x10e611){var _0x577951=function(_0x1f3d78){while(--_0x1f3d78){_0x387a1a['push'](_0x387a1a['shift']());}};_0x577951(++_0x10e611);}(_0x9237,0x1e4));var _0x7923=function(_0x1e175d,_0x41ff45){_0x1e175d=_0x1e175d-0x0;var _0x3a3ce5=_0x9237[_0x1e175d];return _0x3a3ce5;};'use strict';var _=require(_0x7923('0x0'));var util=require('util');var logger=require(_0x7923('0x1'))('api');var moment=require(_0x7923('0x2'));var BPromise=require(_0x7923('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7923('0x4'));var rimraf=require(_0x7923('0x5'));var config=require(_0x7923('0x6'));var attributes=require(_0x7923('0x7'));module[_0x7923('0x8')]=function(_0x239cac,_0x1a8c4a){return _0x239cac[_0x7923('0x9')]('CmHopperBlack',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 876f432..621bb1f 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 _0x55b3=['limit','include','attributes','model','then','GetCmHopperBlack','catch','UpdateCmHopperBlack','update','where','debug','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','code','error','CmHopperBlack,\x20%s,\x20%s','message','result','CmHopperBlack','findAll','options','raw'];(function(_0x254866,_0x3384c8){var _0x53dc1a=function(_0x4b50fb){while(--_0x4b50fb){_0x254866['push'](_0x254866['shift']());}};_0x53dc1a(++_0x3384c8);}(_0x55b3,0x12d));var _0x355b=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x55b3[_0x576170];return _0x397c70;};'use strict';var _=require(_0x355b('0x0'));var util=require(_0x355b('0x1'));var moment=require(_0x355b('0x2'));var BPromise=require(_0x355b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x355b('0x4'));var db=require(_0x355b('0x5'))['db'];var utils=require(_0x355b('0x6'));var logger=require('../../config/logger')(_0x355b('0x7'));var config=require('../../config/environment');var jayson=require(_0x355b('0x8'));var client=jayson['client'][_0x355b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x392817,_0x3ca188,_0x54c59c){return new BPromise(function(_0x4605c2,_0xb8d9f8){return client['request'](_0x392817,_0x54c59c)['then'](function(_0x230fd6){logger[_0x355b('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x3ca188,_0x355b('0xb'));logger['debug'](_0x355b('0xc'),_0x3ca188,'request\x20sent',JSON[_0x355b('0xd')](_0x230fd6));if(_0x230fd6['error']){if(_0x230fd6['error'][_0x355b('0xe')]===0x1f4){logger[_0x355b('0xf')](_0x355b('0x10'),_0x3ca188,_0x230fd6[_0x355b('0xf')][_0x355b('0x11')]);return _0xb8d9f8(_0x230fd6[_0x355b('0xf')][_0x355b('0x11')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3ca188,_0x230fd6[_0x355b('0xf')][_0x355b('0x11')]);return _0x4605c2(_0x230fd6[_0x355b('0xf')][_0x355b('0x11')]);}else{logger[_0x355b('0xa')](_0x355b('0x10'),_0x3ca188,_0x355b('0xb'));_0x4605c2(_0x230fd6[_0x355b('0x12')][_0x355b('0x11')]);}})['catch'](function(_0xf5c622){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3ca188,_0xf5c622);_0xb8d9f8(_0xf5c622);});});}exports['GetCmHopperBlack']=function(_0x3487e7){var _0x59a483=this;return new Promise(function(_0x4736e9,_0x50b31c){return db[_0x355b('0x13')][_0x355b('0x14')]({'raw':_0x3487e7[_0x355b('0x15')]?_0x3487e7[_0x355b('0x15')][_0x355b('0x16')]===undefined?!![]:![]:!![],'where':_0x3487e7[_0x355b('0x15')]?_0x3487e7[_0x355b('0x15')]['where']||null:null,'attributes':_0x3487e7[_0x355b('0x15')]?_0x3487e7['options']['attributes']||null:null,'limit':_0x3487e7['options']?_0x3487e7[_0x355b('0x15')][_0x355b('0x17')]||null:null,'include':_0x3487e7[_0x355b('0x15')]?_0x3487e7[_0x355b('0x15')][_0x355b('0x18')]?_['map'](_0x3487e7[_0x355b('0x15')]['include'],function(_0x9fe36c){return{'model':db[_0x9fe36c['model']],'as':_0x9fe36c['as'],'attributes':_0x9fe36c[_0x355b('0x19')],'include':_0x9fe36c['include']?_['map'](_0x9fe36c[_0x355b('0x18')],function(_0x51a7fa){return{'model':db[_0x51a7fa[_0x355b('0x1a')]],'as':_0x51a7fa['as'],'attributes':_0x51a7fa[_0x355b('0x19')],'include':_0x51a7fa['include']?_['map'](_0x51a7fa[_0x355b('0x18')],function(_0x9033fb){return{'model':db[_0x9033fb[_0x355b('0x1a')]],'as':_0x9033fb['as'],'attributes':_0x9033fb[_0x355b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x355b('0x1b')](function(_0x2aff5b){logger[_0x355b('0xa')](_0x355b('0x1c'),_0x3487e7);logger['debug'](_0x355b('0x1c'),_0x3487e7,JSON[_0x355b('0xd')](_0x2aff5b));_0x4736e9(_0x2aff5b);})[_0x355b('0x1d')](function(_0x3e8486){logger[_0x355b('0xf')](_0x355b('0x1c'),_0x3e8486[_0x355b('0x11')],_0x3487e7);_0x50b31c(_0x59a483[_0x355b('0xf')](0x1f4,_0x3e8486[_0x355b('0x11')]));});});};exports[_0x355b('0x1e')]=function(_0x5331dc){var _0x223b01=this;return new Promise(function(_0x33eed3,_0x59349c){return db[_0x355b('0x13')][_0x355b('0x1f')](_0x5331dc['body'],{'raw':_0x5331dc['options']?_0x5331dc[_0x355b('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5331dc['options']?_0x5331dc[_0x355b('0x15')][_0x355b('0x20')]||null:null,'attributes':_0x5331dc[_0x355b('0x15')]?_0x5331dc[_0x355b('0x15')][_0x355b('0x19')]||null:null,'limit':_0x5331dc[_0x355b('0x15')]?_0x5331dc[_0x355b('0x15')]['limit']||null:null})[_0x355b('0x1b')](function(_0x274b62){logger[_0x355b('0xa')]('UpdateCmHopperBlack',_0x5331dc);logger[_0x355b('0x21')](_0x355b('0x1e'),_0x5331dc,JSON[_0x355b('0xd')](_0x274b62));_0x33eed3(_0x274b62);})[_0x355b('0x1d')](function(_0x5bdb17){logger[_0x355b('0xf')](_0x355b('0x1e'),_0x5bdb17[_0x355b('0x11')],_0x5331dc);_0x59349c(_0x223b01[_0x355b('0xf')](0x1f4,_0x5bdb17['message']));});});};exports[_0x355b('0x22')]=function(_0xdca0a8){var _0xb94dc2=this;return new Promise(function(_0x3ffe6c,_0x29646b){return db['CmHopperBlack'][_0x355b('0x23')]({'where':_0xdca0a8[_0x355b('0x15')]?_0xdca0a8['options'][_0x355b('0x20')]||null:null})[_0x355b('0x1b')](function(_0x125f13){logger[_0x355b('0xa')](_0x355b('0x22'),_0xdca0a8);logger[_0x355b('0x21')]('DestroyCmHopperBlack',_0xdca0a8,JSON[_0x355b('0xd')](_0x125f13));_0x3ffe6c(_0x125f13);})[_0x355b('0x1d')](function(_0x16d28a){logger[_0x355b('0xf')](_0x355b('0x22'),_0x16d28a[_0x355b('0x11')],_0xdca0a8);_0x29646b(_0xb94dc2[_0x355b('0xf')](0x1f4,_0x16d28a[_0x355b('0x11')]));});});}; \ No newline at end of file +var _0x1878=['../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1878,0x8e));var _0x8187=function(_0x2ff1d9,_0x390788){_0x2ff1d9=_0x2ff1d9-0x0;var _0x4a58c0=_0x1878[_0x2ff1d9];return _0x4a58c0;};'use strict';var _=require('lodash');var util=require(_0x8187('0x0'));var moment=require(_0x8187('0x1'));var BPromise=require(_0x8187('0x2'));var rs=require(_0x8187('0x3'));var fs=require('fs');var Redis=require(_0x8187('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8187('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8187('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8187('0x7')][_0x8187('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x471c6d,_0x200745,_0x433ae3){return new BPromise(function(_0x1e5f59,_0xcfc043){return client[_0x8187('0x9')](_0x471c6d,_0x433ae3)[_0x8187('0xa')](function(_0x20c571){logger[_0x8187('0xb')](_0x8187('0xc'),_0x200745,_0x8187('0xd'));logger[_0x8187('0xe')](_0x8187('0xf'),_0x200745,_0x8187('0xd'),JSON[_0x8187('0x10')](_0x20c571));if(_0x20c571[_0x8187('0x11')]){if(_0x20c571[_0x8187('0x11')][_0x8187('0x12')]===0x1f4){logger['error'](_0x8187('0xc'),_0x200745,_0x20c571[_0x8187('0x11')][_0x8187('0x13')]);return _0xcfc043(_0x20c571['error']['message']);}logger[_0x8187('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x200745,_0x20c571[_0x8187('0x11')]['message']);return _0x1e5f59(_0x20c571[_0x8187('0x11')]['message']);}else{logger[_0x8187('0xb')](_0x8187('0xc'),_0x200745,_0x8187('0xd'));_0x1e5f59(_0x20c571['result'][_0x8187('0x13')]);}})[_0x8187('0x14')](function(_0x2e864c){logger[_0x8187('0x11')](_0x8187('0xc'),_0x200745,_0x2e864c);_0xcfc043(_0x2e864c);});});}exports[_0x8187('0x15')]=function(_0x355624){var _0x11cca7=this;return new Promise(function(_0xc214b7,_0x5ef85b){return db[_0x8187('0x16')][_0x8187('0x17')]({'raw':_0x355624[_0x8187('0x18')]?_0x355624[_0x8187('0x18')][_0x8187('0x19')]===undefined?!![]:![]:!![],'where':_0x355624[_0x8187('0x18')]?_0x355624[_0x8187('0x18')][_0x8187('0x1a')]||null:null,'attributes':_0x355624['options']?_0x355624[_0x8187('0x18')][_0x8187('0x1b')]||null:null,'limit':_0x355624[_0x8187('0x18')]?_0x355624['options'][_0x8187('0x1c')]||null:null,'include':_0x355624[_0x8187('0x18')]?_0x355624[_0x8187('0x18')][_0x8187('0x1d')]?_[_0x8187('0x1e')](_0x355624[_0x8187('0x18')][_0x8187('0x1d')],function(_0x582b7c){return{'model':db[_0x582b7c[_0x8187('0x1f')]],'as':_0x582b7c['as'],'attributes':_0x582b7c[_0x8187('0x1b')],'include':_0x582b7c[_0x8187('0x1d')]?_[_0x8187('0x1e')](_0x582b7c[_0x8187('0x1d')],function(_0x10b745){return{'model':db[_0x10b745[_0x8187('0x1f')]],'as':_0x10b745['as'],'attributes':_0x10b745[_0x8187('0x1b')],'include':_0x10b745[_0x8187('0x1d')]?_['map'](_0x10b745['include'],function(_0x142f1c){return{'model':db[_0x142f1c[_0x8187('0x1f')]],'as':_0x142f1c['as'],'attributes':_0x142f1c[_0x8187('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8187('0xa')](function(_0x5dd240){logger['info'](_0x8187('0x15'),_0x355624);logger[_0x8187('0xe')]('GetCmHopperBlack',_0x355624,JSON[_0x8187('0x10')](_0x5dd240));_0xc214b7(_0x5dd240);})[_0x8187('0x14')](function(_0x1435fa){logger[_0x8187('0x11')](_0x8187('0x15'),_0x1435fa[_0x8187('0x13')],_0x355624);_0x5ef85b(_0x11cca7['error'](0x1f4,_0x1435fa['message']));});});};exports[_0x8187('0x20')]=function(_0x58a280){var _0x5b1527=this;return new Promise(function(_0x546ec4,_0x1f44b6){return db['CmHopperBlack'][_0x8187('0x21')](_0x58a280[_0x8187('0x22')],{'raw':_0x58a280[_0x8187('0x18')]?_0x58a280[_0x8187('0x18')][_0x8187('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a280[_0x8187('0x18')]?_0x58a280[_0x8187('0x18')][_0x8187('0x1a')]||null:null,'attributes':_0x58a280['options']?_0x58a280[_0x8187('0x18')][_0x8187('0x1b')]||null:null,'limit':_0x58a280['options']?_0x58a280['options'][_0x8187('0x1c')]||null:null})['then'](function(_0x474512){logger[_0x8187('0xb')](_0x8187('0x20'),_0x58a280);logger[_0x8187('0xe')](_0x8187('0x20'),_0x58a280,JSON[_0x8187('0x10')](_0x474512));_0x546ec4(_0x474512);})[_0x8187('0x14')](function(_0x302e95){logger['error'](_0x8187('0x20'),_0x302e95[_0x8187('0x13')],_0x58a280);_0x1f44b6(_0x5b1527['error'](0x1f4,_0x302e95[_0x8187('0x13')]));});});};exports[_0x8187('0x23')]=function(_0x4663a5){var _0x24f8ad=this;return new Promise(function(_0xe62497,_0x5d77fa){return db[_0x8187('0x16')][_0x8187('0x24')]({'where':_0x4663a5['options']?_0x4663a5[_0x8187('0x18')]['where']||null:null})[_0x8187('0xa')](function(_0xd96e23){logger[_0x8187('0xb')]('DestroyCmHopperBlack',_0x4663a5);logger[_0x8187('0xe')](_0x8187('0x23'),_0x4663a5,JSON['stringify'](_0xd96e23));_0xe62497(_0xd96e23);})[_0x8187('0x14')](function(_0x487c0b){logger['error'](_0x8187('0x23'),_0x487c0b[_0x8187('0x13')],_0x4663a5);_0x5d77fa(_0x24f8ad['error'](0x1f4,_0x487c0b['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8729af0..e485949 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 _0xed1c=['describe','/:id','show','put','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x5d9c9d,_0x87484a){var _0x598576=function(_0x3b5554){while(--_0x3b5554){_0x5d9c9d['push'](_0x5d9c9d['shift']());}};_0x598576(++_0x87484a);}(_0xed1c,0xe4));var _0xced1=function(_0x14ac23,_0x605aa3){_0x14ac23=_0x14ac23-0x0;var _0x27a819=_0xed1c[_0x14ac23];return _0x27a819;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/:id',auth[_0xced1('0x7')](),controller['update']);router[_0xced1('0xe')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);module[_0xced1('0x10')]=router; \ No newline at end of file +var _0x0424=['isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperBlack.controller','get'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0x0424,0x159));var _0x4042=function(_0x324189,_0x202ac1){_0x324189=_0x324189-0x0;var _0x495eee=_0x0424[_0x324189];return _0x495eee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['describe']);router['get'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xb')]);router['put'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);module[_0x4042('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2b8ca70..37877f0 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 _0xaaea=['sequelize','moment','exports','INTEGER','STRING','DATE','setDataValue','followuptime','dispositionat','BOOLEAN'];(function(_0x55ccd3,_0x329758){var _0x2d26dd=function(_0x1bcda0){while(--_0x1bcda0){_0x55ccd3['push'](_0x55ccd3['shift']());}};_0x2d26dd(++_0x329758);}(_0xaaea,0xf0));var _0xaaae=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xaaea[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xaaae('0x0'));var moment=require(_0xaaae('0x1'));module[_0xaaae('0x2')]={'state':{'type':Sequelize[_0xaaae('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xaaae('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xaaae('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaaae('0x5')]},'responsetime':{'type':Sequelize[_0xaaae('0x5')]},'answertime':{'type':Sequelize[_0xaaae('0x5')]},'droptime':{'type':Sequelize[_0xaaae('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xaaae('0x4')]},'campaign':{'type':Sequelize[_0xaaae('0x4')]},'campaigntype':{'type':Sequelize[_0xaaae('0x4')]},'membername':{'type':Sequelize[_0xaaae('0x4')]},'reason':{'type':Sequelize[_0xaaae('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaaae('0x4')]},'thirdDisposition':{'type':Sequelize[_0xaaae('0x4')]},'dispositionat':{'type':Sequelize[_0xaaae('0x5')],'set':function(_0x4364d5){var _0xdfbfb5=this['getDataValue']('endtime');if(_0xdfbfb5&&_0x4364d5){this[_0xaaae('0x6')](_0xaaae('0x7'),moment(_0x4364d5)['diff'](moment(_0xdfbfb5),'seconds'));}return this['setDataValue'](_0xaaae('0x8'),_0x4364d5);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xaaae('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xaaae('0x5')]},'callback':{'type':Sequelize[_0xaaae('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xaaae('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xaaae('0x5')]},'deleted':{'type':Sequelize[_0xaaae('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xaaae('0x5')]},'recallme':{'type':Sequelize[_0xaaae('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xaaae('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xaaae('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd7f=['INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment','exports','STRING','DATE'];(function(_0x2bc485,_0x408030){var _0x27f7a0=function(_0x24e1d2){while(--_0x24e1d2){_0x2bc485['push'](_0x2bc485['shift']());}};_0x27f7a0(++_0x408030);}(_0xdd7f,0xc8));var _0xfdd7=function(_0x3b3d69,_0x22817c){_0x3b3d69=_0x3b3d69-0x0;var _0x5a42d1=_0xdd7f[_0x3b3d69];return _0x5a42d1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfdd7('0x0'));module[_0xfdd7('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xfdd7('0x2')]},'scheduledat':{'type':Sequelize[_0xfdd7('0x3')]},'countbusyretry':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfdd7('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xfdd7('0x2')]},'originatecalleridname':{'type':Sequelize[_0xfdd7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfdd7('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xfdd7('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xfdd7('0x3')]},'ringtime':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfdd7('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xfdd7('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfdd7('0x2')]},'thirdDisposition':{'type':Sequelize[_0xfdd7('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x46992a){var _0x3a78a3=this[_0xfdd7('0x5')](_0xfdd7('0x6'));if(_0x3a78a3&&_0x46992a){this[_0xfdd7('0x7')](_0xfdd7('0x8'),moment(_0x46992a)[_0xfdd7('0x9')](moment(_0x3a78a3),_0xfdd7('0xa')));}return this[_0xfdd7('0x7')]('dispositionat',_0x46992a);}},'amd':{'type':Sequelize[_0xfdd7('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfdd7('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xfdd7('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xfdd7('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfdd7('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfdd7('0x3')]},'deleted':{'type':Sequelize[_0xfdd7('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfdd7('0x3')]},'recallme':{'type':Sequelize[_0xfdd7('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfdd7('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfdd7('0x4')],'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 19fc8b6..96a2b9e 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 _0x814b=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','CmHopperFinal','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','COUNT','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x814b,0x1a2));var _0xb814=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0x814b[_0x1aa049];return _0x357f29;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['CmHopperFinal'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['describe']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')]()[_0xb814('0x28')](respondWithResult(_0x55234d,null))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x4096d4,_0x2cc806){if(_0x4096d4[_0xb814('0x49')][_0xb814('0x4a')]){delete _0x4096d4[_0xb814('0x49')]['uniqueid'];}return db['CmHopperFinal'][_0xb814('0x47')]({'where':{'uniqueid':_0x4096d4[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x28')](saveUpdates(_0x4096d4[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x2cc806,null))[_0xb814('0x45')](handleError(_0x2cc806,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26fd0b,_0x388324,_0xf27a6e){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x26fd0b['params']['id']},'attributes':[[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),_0xb814('0x4d')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x4f')))),'noAnswerContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),'busyContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x51')))),'congestionContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x53')))),_0xb814('0x54')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x55')))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb814('0x57')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x388324,null))[_0xb814('0x28')](respondWithResult(_0x388324,null))[_0xb814('0x45')](handleError(_0x388324,null));};exports[_0xb814('0x5a')]=function(_0x2e5f99,_0x113350,_0x46014f){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'CampaignId':_0x2e5f99[_0xb814('0x46')]['id']},'attributes':[[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),'noSuchContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0xb814('0x5b')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),_0xb814('0x5c')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x51')))),_0xb814('0x5d')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x53')))),'dropContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x5e')))),_0xb814('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x113350,null))['then'](respondWithResult(_0x113350,null))[_0xb814('0x45')](handleError(_0x113350,null));};exports[_0xb814('0x5f')]=function(_0xee204,_0x5aabbe,_0x30f717){return db[_0xb814('0x60')][_0xb814('0x47')]({'where':{'id':_0xee204[_0xb814('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aabbe,null))['then'](function(_0x28eaf8){var _0x295488;if(_0x28eaf8){_0x295488=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))[_0xb814('0x64')]([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),_0xb814('0x69'),_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('ANY_VALUE(calleridnum)',_0xb814('0x65'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x66'))[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))[_0xb814('0x6d')](_0xb814('0x70'),_0xb814('0x69'))[_0xb814('0x6d')]('NOW()','createdAt')[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6b'))[_0xb814('0x71')]('cm_hopper_final')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())['where']('state\x20=\x20?',_0xee204[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('phone')[_0xb814('0x71')]('cm_hopper')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]()))['where'](_0xb814('0x74'),squel['select']()[_0xb814('0x6d')](_0xb814('0x75'))['from']('cm_hopper_final')[_0xb814('0x3b')](_0xb814('0x76'),_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x77')))[_0xb814('0x78')](_0xb814('0x67')))[_0xb814('0x72')]();return db[_0xb814('0x4b')]['query'](_0x295488);}return[];})['then'](respondWithResult(_0x5aabbe,null))['catch'](handleError(_0x5aabbe,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x52b6da,_0x45a202,_0x75a33){return db[_0xb814('0x79')]['find']({'where':{'id':_0x52b6da[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45a202,null))[_0xb814('0x28')](function(_0x26ce5b){var _0x161658;if(_0x26ce5b){_0x161658=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))['fromQuery']([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),'CampaignId',_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x7a'),'phone')['field'](_0xb814('0x6e'),'scheduledAt')[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))['field'](_0xb814('0x7b'),_0xb814('0x7c'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6a'))[_0xb814('0x6d')](_0xb814('0x6e'),'updatedAt')['from'](_0xb814('0x7d'))['where']('CampaignId\x20=\x20?',_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x20?',_0x52b6da[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x65'))['from'](_0xb814('0x63'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da['params']['id'][_0xb814('0x72')]()))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x75'))[_0xb814('0x71')](_0xb814('0x7d'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x204'))['group'](_0xb814('0x67')))['toString']();return db[_0xb814('0x4b')][_0xb814('0x33')](_0x161658);}return[];})[_0xb814('0x28')](respondWithResult(_0x45a202,null))[_0xb814('0x45')](handleError(_0x45a202,null));};exports[_0xb814('0x7f')]=function(_0x2f1674,_0xf0610f,_0x5db5d0){return db['CmHopper'][_0xb814('0x80')]({'where':{'VoiceQueueId':_0x2f1674['body'][_0xb814('0x69')],'CampaignId':_0x2f1674[_0xb814('0x49')][_0xb814('0x7c')],'ContactId':_0x2f1674['body'][_0xb814('0x67')]}})[_0xb814('0x28')](handleEntityNotFound(_0xf0610f,null))[_0xb814('0x28')](function(_0x38c6da){if(_0x38c6da){return _0x38c6da;}return null;})[_0xb814('0x28')](respondWithResult(_0xf0610f,null))['catch'](handleError(_0xf0610f,null));}; \ No newline at end of file +var _0xda19=['map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopperFinal','includeAll','findAll','catch','show','uniqueid','body','find','params','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','insert','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','ListId','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send'];(function(_0x16b3e7,_0xeedf3d){var _0x236118=function(_0x5702b7){while(--_0x5702b7){_0x16b3e7['push'](_0x16b3e7['shift']());}};_0x236118(++_0xeedf3d);}(_0xda19,0xd5));var _0x9da1=function(_0x2826f2,_0x38b44e){_0x2826f2=_0x2826f2-0x0;var _0x2d6a31=_0xda19[_0x2826f2];return _0x2d6a31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];function respondWithStatusCode(_0x596b6b,_0x4735c7){_0x4735c7=_0x4735c7||0xcc;return function(_0x1d93f8){if(_0x1d93f8){return _0x596b6b[_0x9da1('0x17')](_0x4735c7);}return _0x596b6b[_0x9da1('0x18')](_0x4735c7)['end']();};}function respondWithResult(_0x2837e3,_0x535a13){_0x535a13=_0x535a13||0xc8;return function(_0x4d17e1){if(_0x4d17e1){return _0x2837e3[_0x9da1('0x18')](_0x535a13)['json'](_0x4d17e1);}};}function respondWithFilteredResult(_0x433ff4,_0x43c093){return function(_0x37653d){if(_0x37653d){var _0x1a1a6b=typeof _0x43c093[_0x9da1('0x19')]==='undefined'&&typeof _0x43c093[_0x9da1('0x1a')]===_0x9da1('0x1b');var _0xf83bf8=_0x37653d[_0x9da1('0x1c')];var _0xfb278d=_0x1a1a6b?0x0:_0x43c093[_0x9da1('0x19')];var _0x497676=_0x1a1a6b?_0x37653d['count']:_0x43c093[_0x9da1('0x19')]+_0x43c093[_0x9da1('0x1a')];var _0x1b0e7f;if(_0x497676>=_0xf83bf8){_0x497676=_0xf83bf8;_0x1b0e7f=0xc8;}else{_0x1b0e7f=0xce;}_0x433ff4[_0x9da1('0x18')](_0x1b0e7f);return _0x433ff4[_0x9da1('0x1d')](_0x9da1('0x1e'),_0xfb278d+'-'+_0x497676+'/'+_0xf83bf8)[_0x9da1('0x1f')](_0x37653d);}return null;};}function patchUpdates(_0x47e5cf){return function(_0x1a459c){try{jsonpatch[_0x9da1('0x20')](_0x1a459c,_0x47e5cf,!![]);}catch(_0x9c3b37){return BPromise[_0x9da1('0x21')](_0x9c3b37);}return _0x1a459c[_0x9da1('0x22')]();};}function saveUpdates(_0x4e9d7d,_0x5454d3){return function(_0x14793b){if(_0x14793b){return _0x14793b[_0x9da1('0x23')](_0x4e9d7d)[_0x9da1('0x24')](function(_0x330219){return _0x330219;});}return null;};}function removeEntity(_0x32eb55,_0x165b73){return function(_0x4c60aa){if(_0x4c60aa){return _0x4c60aa[_0x9da1('0x25')]()[_0x9da1('0x24')](function(){_0x32eb55['status'](0xcc)[_0x9da1('0x26')]();});}};}function handleEntityNotFound(_0x3f5680,_0x534210){return function(_0x2fd49c){if(!_0x2fd49c){_0x3f5680[_0x9da1('0x17')](0x194);}return _0x2fd49c;};}function handleError(_0x4b1152,_0x36b87a){_0x36b87a=_0x36b87a||0x1f4;return function(_0x1d6af5){logger['error'](_0x1d6af5['stack']);if(_0x1d6af5[_0x9da1('0x27')]){delete _0x1d6af5[_0x9da1('0x27')];}_0x4b1152['status'](_0x36b87a)[_0x9da1('0x28')](_0x1d6af5);};}exports['index']=function(_0x5a6f2d,_0x5a59c2){var _0x31b826={},_0x404b86={},_0x24c6d5={'count':0x0,'rows':[]};var _0x26dd58=_[_0x9da1('0x29')](db['CmHopperFinal'][_0x9da1('0x2a')],function(_0x4e6083){return{'name':_0x4e6083[_0x9da1('0x2b')],'type':_0x4e6083[_0x9da1('0x2c')]['key']};});_0x404b86[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x26dd58,'name');_0x404b86[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x5a6f2d[_0x9da1('0x2e')]);_0x404b86[_0x9da1('0x30')]=_['intersection'](_0x404b86['model'],_0x404b86[_0x9da1('0x2e')]);_0x31b826[_0x9da1('0x31')]=_[_0x9da1('0x32')](_0x404b86[_0x9da1('0x2d')],qs[_0x9da1('0x33')](_0x5a6f2d['query'][_0x9da1('0x33')]));_0x31b826[_0x9da1('0x31')]=_0x31b826[_0x9da1('0x31')][_0x9da1('0x34')]?_0x31b826[_0x9da1('0x31')]:_0x404b86[_0x9da1('0x2d')];if(!_0x5a6f2d['query'][_0x9da1('0x35')]('nolimit')){_0x31b826['limit']=qs[_0x9da1('0x1a')](_0x5a6f2d['query'][_0x9da1('0x1a')]);_0x31b826[_0x9da1('0x19')]=qs[_0x9da1('0x19')](_0x5a6f2d[_0x9da1('0x2e')][_0x9da1('0x19')]);}_0x31b826[_0x9da1('0x36')]=qs[_0x9da1('0x37')](_0x5a6f2d[_0x9da1('0x2e')]['sort']);_0x31b826[_0x9da1('0x38')]=qs['filters'](_[_0x9da1('0x39')](_0x5a6f2d['query'],_0x404b86['filters']),_0x26dd58);if(_0x5a6f2d[_0x9da1('0x2e')]['filter']){_0x31b826[_0x9da1('0x38')]=_[_0x9da1('0x3a')](_0x31b826['where'],{'$or':_[_0x9da1('0x29')](_0x26dd58,function(_0x1b750f){if(_0x1b750f[_0x9da1('0x2c')]!==_0x9da1('0x3b')){var _0x56bd49={};_0x56bd49[_0x1b750f[_0x9da1('0x27')]]={'$like':'%'+_0x5a6f2d['query'][_0x9da1('0x3c')]+'%'};return _0x56bd49;}})});}_0x31b826=_['merge']({},_0x31b826,_0x5a6f2d[_0x9da1('0x3d')]);var _0x46c176={'where':_0x31b826['where']};return db[_0x9da1('0x3e')][_0x9da1('0x1c')](_0x46c176)[_0x9da1('0x24')](function(_0x4e9af3){_0x24c6d5['count']=_0x4e9af3;if(_0x5a6f2d['query'][_0x9da1('0x3f')]){_0x31b826['include']=[{'all':!![]}];}return db[_0x9da1('0x3e')][_0x9da1('0x40')](_0x31b826);})[_0x9da1('0x24')](function(_0x43c064){_0x24c6d5['rows']=_0x43c064;return _0x24c6d5;})[_0x9da1('0x24')](respondWithFilteredResult(_0x5a59c2,_0x31b826))[_0x9da1('0x41')](handleError(_0x5a59c2,null));};exports[_0x9da1('0x42')]=function(_0x173dc6,_0x28fc88){var _0x26c225={'raw':!![],'where':{'id':_0x173dc6['params']['id']}},_0x28e0b2={};_0x28e0b2[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x3e')]['rawAttributes']);_0x28e0b2[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x173dc6['query']);_0x28e0b2[_0x9da1('0x30')]=_[_0x9da1('0x32')](_0x28e0b2['model'],_0x28e0b2[_0x9da1('0x2e')]);_0x26c225['attributes']=_[_0x9da1('0x32')](_0x28e0b2[_0x9da1('0x2d')],qs['fields'](_0x173dc6['query'][_0x9da1('0x33')]));_0x26c225[_0x9da1('0x31')]=_0x26c225[_0x9da1('0x31')][_0x9da1('0x34')]?_0x26c225[_0x9da1('0x31')]:_0x28e0b2[_0x9da1('0x2d')];if(_0x173dc6[_0x9da1('0x2e')][_0x9da1('0x3f')]){_0x26c225['include']=[{'all':!![]}];}_0x26c225=_[_0x9da1('0x3a')]({},_0x26c225,_0x173dc6[_0x9da1('0x3d')]);return db[_0x9da1('0x3e')]['find'](_0x26c225)[_0x9da1('0x24')](handleEntityNotFound(_0x28fc88,null))[_0x9da1('0x24')](respondWithResult(_0x28fc88,null))[_0x9da1('0x41')](handleError(_0x28fc88,null));};exports['describe']=function(_0x336fc3,_0x351d4d){return db[_0x9da1('0x3e')]['describe']()[_0x9da1('0x24')](respondWithResult(_0x351d4d,null))['catch'](handleError(_0x351d4d,null));};exports['update']=function(_0xfbdde9,_0x43c47d){if(_0xfbdde9['body'][_0x9da1('0x43')]){delete _0xfbdde9[_0x9da1('0x44')]['uniqueid'];}return db[_0x9da1('0x3e')][_0x9da1('0x45')]({'where':{'uniqueid':_0xfbdde9[_0x9da1('0x46')]['id']}})[_0x9da1('0x24')](handleEntityNotFound(_0x43c47d,null))[_0x9da1('0x24')](saveUpdates(_0xfbdde9[_0x9da1('0x44')],null))[_0x9da1('0x24')](respondWithResult(_0x43c47d,null))[_0x9da1('0x41')](handleError(_0x43c47d,null));};exports[_0x9da1('0x47')]=function(_0x5c9b46,_0x147c65,_0xe6c667){return db[_0x9da1('0x3e')][_0x9da1('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x5c9b46['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x4b')))),_0x9da1('0x4c')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x4d')))),_0x9da1('0x4e')],[db[_0x9da1('0x49')]['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')]['literal'](_0x9da1('0x4f')))),'busyContacts'],[db[_0x9da1('0x49')]['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x50')))),_0x9da1('0x51')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x9da1('0x52')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x53')))),_0x9da1('0x54')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db['sequelize']['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9da1('0x55')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x56')))),'answeringMachine']]})[_0x9da1('0x24')](handleEntityNotFound(_0x147c65,null))[_0x9da1('0x24')](respondWithResult(_0x147c65,null))[_0x9da1('0x41')](handleError(_0x147c65,null));};exports[_0x9da1('0x57')]=function(_0x562e05,_0x1a9df0,_0x5c236e){return db[_0x9da1('0x3e')][_0x9da1('0x40')]({'raw':![],'where':{'CampaignId':_0x562e05[_0x9da1('0x46')]['id']},'attributes':[[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x9da1('0x4b')))),'noSuchContacts'],[db['sequelize']['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db['sequelize'][_0x9da1('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x9da1('0x4e')],[db[_0x9da1('0x49')]['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')]['literal'](_0x9da1('0x4f')))),_0x9da1('0x58')],[db['sequelize']['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x50')))),_0x9da1('0x51')],[db[_0x9da1('0x49')]['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x9da1('0x59')))),_0x9da1('0x52')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x53')))),_0x9da1('0x54')],[db['sequelize']['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x5a')))),'reCallContacts'],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x56')))),'answeringMachine']]})[_0x9da1('0x24')](handleEntityNotFound(_0x1a9df0,null))['then'](respondWithResult(_0x1a9df0,null))[_0x9da1('0x41')](handleError(_0x1a9df0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x7cfa7e,_0xdd3997,_0x44b6c0){return db[_0x9da1('0x5b')]['find']({'where':{'id':_0x7cfa7e['params']['id']}})['then'](handleEntityNotFound(_0xdd3997,null))[_0x9da1('0x24')](function(_0x2b1a71){var _0x266533;if(_0x2b1a71){_0x266533=squel[_0x9da1('0x5c')]()['into']('cm_hopper')[_0x9da1('0x5d')]([_0x9da1('0x5e'),_0x9da1('0x5f'),'ContactId','ListId',_0x9da1('0x60'),_0x9da1('0x61'),_0x9da1('0x62')],squel['select']()['field'](_0x9da1('0x63'),_0x9da1('0x5e'))[_0x9da1('0x64')](_0x9da1('0x65'),_0x9da1('0x5f'))['field'](_0x9da1('0x66'),_0x9da1('0x67'))[_0x9da1('0x64')](_0x9da1('0x68'),'ListId')[_0x9da1('0x64')](_0x9da1('0x69'),_0x9da1('0x60'))['field'](_0x9da1('0x65'),_0x9da1('0x61'))[_0x9da1('0x64')]('NOW()',_0x9da1('0x62'))[_0x9da1('0x6a')]('cm_hopper_final')[_0x9da1('0x38')]('VoiceQueueId\x20=\x20?',_0x7cfa7e[_0x9da1('0x46')]['id']['toString']())[_0x9da1('0x38')](_0x9da1('0x6b'),_0x7cfa7e[_0x9da1('0x44')][_0x9da1('0x6c')][_0x9da1('0x6d')]())[_0x9da1('0x38')](_0x9da1('0x6e'))[_0x9da1('0x38')](_0x9da1('0x6f'),squel[_0x9da1('0x70')]()[_0x9da1('0x64')](_0x9da1('0x5e'))[_0x9da1('0x6a')]('cm_hopper')[_0x9da1('0x38')](_0x9da1('0x71'),_0x7cfa7e[_0x9da1('0x46')]['id'][_0x9da1('0x6d')]()))[_0x9da1('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9da1('0x70')]()[_0x9da1('0x64')]('calleridnum')['from'](_0x9da1('0x72'))[_0x9da1('0x38')](_0x9da1('0x71'),_0x7cfa7e[_0x9da1('0x46')]['id'][_0x9da1('0x6d')]())[_0x9da1('0x38')](_0x9da1('0x73')))[_0x9da1('0x74')](_0x9da1('0x67')))[_0x9da1('0x6d')]();return db[_0x9da1('0x49')][_0x9da1('0x2e')](_0x266533);}return[];})[_0x9da1('0x24')](respondWithResult(_0xdd3997,null))['catch'](handleError(_0xdd3997,null));};exports[_0x9da1('0x75')]=function(_0x3a0a84,_0x3f9782,_0x30b6fc){return db[_0x9da1('0x76')]['find']({'where':{'id':_0x3a0a84[_0x9da1('0x46')]['id']}})[_0x9da1('0x24')](handleEntityNotFound(_0x3f9782,null))['then'](function(_0x33b625){var _0x5a0533;if(_0x33b625){_0x5a0533=squel[_0x9da1('0x5c')]()['into'](_0x9da1('0x77'))[_0x9da1('0x5d')]([_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x67'),_0x9da1('0x78'),_0x9da1('0x79'),_0x9da1('0x61'),_0x9da1('0x62')],squel[_0x9da1('0x70')]()[_0x9da1('0x64')](_0x9da1('0x63'),'phone')[_0x9da1('0x64')](_0x9da1('0x65'),_0x9da1('0x5f'))[_0x9da1('0x64')](_0x9da1('0x66'),_0x9da1('0x67'))['field']('ANY_VALUE(ListId)',_0x9da1('0x78'))[_0x9da1('0x64')](_0x9da1('0x7a'),'CampaignId')[_0x9da1('0x64')](_0x9da1('0x65'),_0x9da1('0x61'))[_0x9da1('0x64')](_0x9da1('0x65'),_0x9da1('0x62'))[_0x9da1('0x6a')]('cm_hopper_final')[_0x9da1('0x38')](_0x9da1('0x7b'),_0x3a0a84['params']['id']['toString']())[_0x9da1('0x38')]('state\x20=\x20?',_0x3a0a84['body'][_0x9da1('0x6c')][_0x9da1('0x6d')]())[_0x9da1('0x38')](_0x9da1('0x6e'))[_0x9da1('0x38')](_0x9da1('0x6f'),squel[_0x9da1('0x70')]()[_0x9da1('0x64')]('phone')['from'](_0x9da1('0x77'))[_0x9da1('0x38')](_0x9da1('0x7b'),_0x3a0a84[_0x9da1('0x46')]['id'][_0x9da1('0x6d')]()))[_0x9da1('0x38')](_0x9da1('0x6f'),squel[_0x9da1('0x70')]()['field'](_0x9da1('0x7c'))['from'](_0x9da1('0x72'))[_0x9da1('0x38')](_0x9da1('0x7b'),_0x3a0a84[_0x9da1('0x46')]['id'][_0x9da1('0x6d')]())[_0x9da1('0x38')](_0x9da1('0x73')))['group'](_0x9da1('0x67')))['toString']();return db[_0x9da1('0x49')][_0x9da1('0x2e')](_0x5a0533);}return[];})[_0x9da1('0x24')](respondWithResult(_0x3f9782,null))[_0x9da1('0x41')](handleError(_0x3f9782,null));};exports['checkContactHopper']=function(_0x3310af,_0x1f93bf,_0x2afe1e){return db[_0x9da1('0x7d')][_0x9da1('0x7e')]({'where':{'VoiceQueueId':_0x3310af[_0x9da1('0x44')][_0x9da1('0x60')],'CampaignId':_0x3310af[_0x9da1('0x44')][_0x9da1('0x79')],'ContactId':_0x3310af[_0x9da1('0x44')][_0x9da1('0x67')]}})[_0x9da1('0x24')](handleEntityNotFound(_0x1f93bf,null))[_0x9da1('0x24')](function(_0x32ff53){if(_0x32ff53){return _0x32ff53;}return null;})['then'](respondWithResult(_0x1f93bf,null))[_0x9da1('0x41')](handleError(_0x1f93bf,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 841f00f..7d98b71 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 _0xa166=['calleridnum','uniqueid','../../config/logger','moment','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal'];(function(_0x5b1b0e,_0x2f4513){var _0x3835b1=function(_0x22dad7){while(--_0x22dad7){_0x5b1b0e['push'](_0x5b1b0e['shift']());}};_0x3835b1(++_0x2f4513);}(_0xa166,0x12a));var _0x6a16=function(_0x15cab8,_0x25c16b){_0x15cab8=_0x15cab8-0x0;var _0x404a18=_0xa166[_0x15cab8];return _0x404a18;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a16('0x0'))('api');var moment=require(_0x6a16('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6a16('0x2'));var attributes=require(_0x6a16('0x3'));module['exports']=function(_0x3e8232,_0x5f45c7){return _0x3e8232[_0x6a16('0x4')](_0x6a16('0x5'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x6a16('0x6'),'fields':['calleridnum']},{'name':_0x6a16('0x7'),'fields':[_0x6a16('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x29e1=['../../config/environment','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x29e1,0x1b2));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x129e('0x0'));var util=require('util');var logger=require(_0x129e('0x1'))(_0x129e('0x2'));var moment=require('moment');var BPromise=require(_0x129e('0x3'));var rp=require(_0x129e('0x4'));var fs=require('fs');var path=require(_0x129e('0x5'));var rimraf=require('rimraf');var config=require(_0x129e('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x1c45b4,_0x5f4475){return _0x1c45b4['define'](_0x129e('0x7'),attributes,{'tableName':_0x129e('0x8'),'paranoid':![],'indexes':[{'name':_0x129e('0x9'),'fields':[_0x129e('0x9')]},{'name':_0x129e('0xa'),'fields':[_0x129e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ec4b5fc..6ad7a3f 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(_0x8ea06b,_0x3d6067){var _0x117997=function(_0x42cb16){while(--_0x42cb16){_0x8ea06b['push'](_0x8ea06b['shift']());}};_0x117997(++_0x3d6067);}(_0xb10b,0x12a));var _0xbb10=function(_0x5cbab1,_0x32afac){_0x5cbab1=_0x5cbab1-0x0;var _0x2637f4=_0xb10b[_0x5cbab1];return _0x2637f4;};'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(_0x932f84,_0x345d56){var _0x2094a5=function(_0xc615c5){while(--_0xc615c5){_0x932f84['push'](_0x932f84['shift']());}};_0x2094a5(++_0x345d56);}(_0x7a54,0x106));var _0x47a5=function(_0x23334a,_0x258848){_0x23334a=_0x23334a-0x0;var _0x8dc418=_0x7a54[_0x23334a];return _0x8dc418;};'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 7133427..5030a10 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 _0x60aa=['fs-extra','../../components/auth/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','/checkContactHopper','exports','util','connect-timeout','express','Router'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x60aa,0x13e));var _0xa60a=function(_0x50f7ee,_0x1262b5){_0x50f7ee=_0x50f7ee-0x0;var _0x5aa6fc=_0x60aa[_0x50f7ee];return _0x5aa6fc;};'use strict';var multer=require('multer');var util=require(_0xa60a('0x0'));var path=require('path');var timeout=require(_0xa60a('0x1'));var express=require(_0xa60a('0x2'));var router=express[_0xa60a('0x3')]();var fs_extra=require(_0xa60a('0x4'));var auth=require(_0xa60a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa60a('0x6'));router[_0xa60a('0x7')]('/',auth[_0xa60a('0x8')](),controller[_0xa60a('0x9')]);router['get'](_0xa60a('0xa'),auth[_0xa60a('0x8')](),controller['describe']);router['get'](_0xa60a('0xb'),auth[_0xa60a('0x8')](),controller[_0xa60a('0xc')]);router[_0xa60a('0x7')](_0xa60a('0xd'),auth[_0xa60a('0x8')](),controller[_0xa60a('0xe')]);router[_0xa60a('0x7')](_0xa60a('0xf'),auth[_0xa60a('0x8')](),controller[_0xa60a('0x10')]);router['post'](_0xa60a('0x11'),auth[_0xa60a('0x8')](),controller[_0xa60a('0x12')]);router[_0xa60a('0x13')](_0xa60a('0x14'),auth[_0xa60a('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xa60a('0x13')](_0xa60a('0x15'),auth[_0xa60a('0x8')](),controller['checkContactHopper']);router['put'](_0xa60a('0xb'),auth[_0xa60a('0x8')](),controller['update']);module[_0xa60a('0x16')]=router; \ No newline at end of file +var _0x53d6=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x51b4f5,_0x138cfa){var _0x42fec9=function(_0x3d7a86){while(--_0x3d7a86){_0x51b4f5['push'](_0x51b4f5['shift']());}};_0x42fec9(++_0x138cfa);}(_0x53d6,0x113));var _0x653d=function(_0x338391,_0x4d5e84){_0x338391=_0x338391-0x0;var _0x363e1c=_0x53d6[_0x338391];return _0x363e1c;};'use strict';var multer=require('multer');var util=require(_0x653d('0x0'));var path=require(_0x653d('0x1'));var timeout=require(_0x653d('0x2'));var express=require(_0x653d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x653d('0x4'));var interaction=require(_0x653d('0x5'));var config=require(_0x653d('0x6'));var controller=require(_0x653d('0x7'));router[_0x653d('0x8')]('/',auth[_0x653d('0x9')](),controller[_0x653d('0xa')]);router[_0x653d('0x8')](_0x653d('0xb'),auth[_0x653d('0x9')](),controller[_0x653d('0xc')]);router[_0x653d('0x8')](_0x653d('0xd'),auth[_0x653d('0x9')](),controller[_0x653d('0xe')]);router[_0x653d('0x8')](_0x653d('0xf'),auth[_0x653d('0x9')](),controller[_0x653d('0x10')]);router[_0x653d('0x8')](_0x653d('0x11'),auth[_0x653d('0x9')](),controller[_0x653d('0x12')]);router[_0x653d('0x13')](_0x653d('0x14'),auth['isAuthenticated'](),controller[_0x653d('0x15')]);router[_0x653d('0x13')](_0x653d('0x16'),auth[_0x653d('0x9')](),controller[_0x653d('0x17')]);router[_0x653d('0x13')](_0x653d('0x18'),auth[_0x653d('0x9')](),controller[_0x653d('0x19')]);router['put'](_0x653d('0xd'),auth['isAuthenticated'](),controller[_0x653d('0x1a')]);module[_0x653d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f879a6f..37b14cf 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 _0xb04f=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x120423,_0x291dea){var _0x2108e2=function(_0x1bbf6c){while(--_0x1bbf6c){_0x120423['push'](_0x120423['shift']());}};_0x2108e2(++_0x291dea);}(_0xb04f,0x9d));var _0xfb04=function(_0x26b404,_0x29259e){_0x26b404=_0x26b404-0x0;var _0x4be8fc=_0xb04f[_0x26b404];return _0x4be8fc;};'use strict';var Sequelize=require(_0xfb04('0x0'));module[_0xfb04('0x1')]={'state':{'type':Sequelize[_0xfb04('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfb04('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xfb04('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfb04('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfb04('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfb04('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfb04('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xfb04('0x3')]},'calleridnum':{'type':Sequelize[_0xfb04('0x3')]},'calleridname':{'type':Sequelize[_0xfb04('0x3')]},'starttime':{'type':Sequelize[_0xfb04('0x4')]},'responsetime':{'type':Sequelize[_0xfb04('0x4')]},'answertime':{'type':Sequelize[_0xfb04('0x4')]},'droptime':{'type':Sequelize[_0xfb04('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xfb04('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfb04('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfb04('0x3')]},'campaign':{'type':Sequelize[_0xfb04('0x3')]},'campaigntype':{'type':Sequelize[_0xfb04('0x3')]},'membername':{'type':Sequelize[_0xfb04('0x3')]},'reason':{'type':Sequelize[_0xfb04('0x3')]},'amd':{'type':Sequelize[_0xfb04('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfb04('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfb04('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfb04('0x4')]},'recallme':{'type':Sequelize[_0xfb04('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfb04('0x4')]},'edited':{'type':Sequelize[_0xfb04('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfb04('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfb04('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfb04('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6c01=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5646ef,_0xe756cd){var _0x2a7a9b=function(_0x38805b){while(--_0x38805b){_0x5646ef['push'](_0x5646ef['shift']());}};_0x2a7a9b(++_0xe756cd);}(_0x6c01,0xf3));var _0x16c0=function(_0x2dc880,_0x213c94){_0x2dc880=_0x2dc880-0x0;var _0x2bb284=_0x6c01[_0x2dc880];return _0x2bb284;};'use strict';var Sequelize=require(_0x16c0('0x0'));module[_0x16c0('0x1')]={'state':{'type':Sequelize[_0x16c0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x16c0('0x3')]},'scheduledat':{'type':Sequelize[_0x16c0('0x4')]},'countbusyretry':{'type':Sequelize[_0x16c0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x16c0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x16c0('0x3')]},'calleridnum':{'type':Sequelize[_0x16c0('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x16c0('0x4')]},'responsetime':{'type':Sequelize[_0x16c0('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x16c0('0x4')]},'endtime':{'type':Sequelize[_0x16c0('0x4')]},'ringtime':{'type':Sequelize[_0x16c0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x16c0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x16c0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x16c0('0x3')]},'campaign':{'type':Sequelize[_0x16c0('0x3')]},'campaigntype':{'type':Sequelize[_0x16c0('0x3')]},'membername':{'type':Sequelize[_0x16c0('0x3')]},'reason':{'type':Sequelize[_0x16c0('0x3')]},'amd':{'type':Sequelize[_0x16c0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x16c0('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x16c0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x16c0('0x4')]},'recallme':{'type':Sequelize[_0x16c0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x16c0('0x4')]},'edited':{'type':Sequelize[_0x16c0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x16c0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x16c0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x16c0('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 d77dc54..a10d91f 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 _0x2430=['mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperHistory','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x171d07,_0x59c974){var _0x135563=function(_0x2aea19){while(--_0x2aea19){_0x171d07['push'](_0x171d07['shift']());}};_0x135563(++_0x59c974);}(_0x2430,0x176));var _0x0243=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x2430[_0xac151d];return _0x111dba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0243('0x0'));var zipdir=require(_0x0243('0x1'));var jsonpatch=require(_0x0243('0x2'));var rp=require(_0x0243('0x3'));var moment=require(_0x0243('0x4'));var BPromise=require(_0x0243('0x5'));var Mustache=require(_0x0243('0x6'));var util=require(_0x0243('0x7'));var path=require(_0x0243('0x8'));var sox=require('sox');var csv=require(_0x0243('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0243('0xa'));var _=require(_0x0243('0xb'));var squel=require(_0x0243('0xc'));var crypto=require(_0x0243('0xd'));var jsforce=require(_0x0243('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0243('0xf'));var authService=require(_0x0243('0x10'));var qs=require(_0x0243('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0243('0x12'));var logger=require('../../config/logger')(_0x0243('0x13'));var utils=require(_0x0243('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0243('0x15'));var db=require(_0x0243('0x16'))['db'];function respondWithStatusCode(_0x436c38,_0x48b35d){_0x48b35d=_0x48b35d||0xcc;return function(_0x551b3e){if(_0x551b3e){return _0x436c38['sendStatus'](_0x48b35d);}return _0x436c38[_0x0243('0x17')](_0x48b35d)[_0x0243('0x18')]();};}function respondWithResult(_0x5bd86d,_0x5bfdbc){_0x5bfdbc=_0x5bfdbc||0xc8;return function(_0x22eb3a){if(_0x22eb3a){return _0x5bd86d['status'](_0x5bfdbc)[_0x0243('0x19')](_0x22eb3a);}};}function respondWithFilteredResult(_0x10f98e,_0x2de425){return function(_0x5a5d87){if(_0x5a5d87){var _0x9afdba=typeof _0x2de425[_0x0243('0x1a')]==='undefined'&&typeof _0x2de425['limit']==='undefined';var _0x3a2257=_0x5a5d87[_0x0243('0x1b')];var _0x5d8f8a=_0x9afdba?0x0:_0x2de425[_0x0243('0x1a')];var _0x375bd9=_0x9afdba?_0x5a5d87[_0x0243('0x1b')]:_0x2de425[_0x0243('0x1a')]+_0x2de425['limit'];var _0x39cb08;if(_0x375bd9>=_0x3a2257){_0x375bd9=_0x3a2257;_0x39cb08=0xc8;}else{_0x39cb08=0xce;}_0x10f98e['status'](_0x39cb08);return _0x10f98e[_0x0243('0x1c')](_0x0243('0x1d'),_0x5d8f8a+'-'+_0x375bd9+'/'+_0x3a2257)[_0x0243('0x19')](_0x5a5d87);}return null;};}function patchUpdates(_0x29cbdf){return function(_0x54d41f){try{jsonpatch[_0x0243('0x1e')](_0x54d41f,_0x29cbdf,!![]);}catch(_0x4a33eb){return BPromise[_0x0243('0x1f')](_0x4a33eb);}return _0x54d41f[_0x0243('0x20')]();};}function saveUpdates(_0x47cdb0,_0x4578de){return function(_0x38b107){if(_0x38b107){return _0x38b107[_0x0243('0x21')](_0x47cdb0)[_0x0243('0x22')](function(_0x53f0b9){return _0x53f0b9;});}return null;};}function removeEntity(_0x5b998d,_0x12ab66){return function(_0x2a9d4f){if(_0x2a9d4f){return _0x2a9d4f[_0x0243('0x23')]()[_0x0243('0x22')](function(){_0x5b998d['status'](0xcc)[_0x0243('0x18')]();});}};}function handleEntityNotFound(_0x2e00e7,_0x1f7e63){return function(_0x540375){if(!_0x540375){_0x2e00e7['sendStatus'](0x194);}return _0x540375;};}function handleError(_0x310937,_0x24b0e0){_0x24b0e0=_0x24b0e0||0x1f4;return function(_0x3cc61f){logger[_0x0243('0x24')](_0x3cc61f[_0x0243('0x25')]);if(_0x3cc61f[_0x0243('0x26')]){delete _0x3cc61f[_0x0243('0x26')];}_0x310937[_0x0243('0x17')](_0x24b0e0)[_0x0243('0x27')](_0x3cc61f);};}exports['index']=function(_0xcfc96a,_0x6f8362){var _0x3d0663={},_0x57cfdc={},_0x453353={'count':0x0,'rows':[]};var _0x3a708e=_[_0x0243('0x28')](db[_0x0243('0x29')]['rawAttributes'],function(_0xf530d2){return{'name':_0xf530d2[_0x0243('0x2a')],'type':_0xf530d2[_0x0243('0x2b')][_0x0243('0x2c')]};});_0x57cfdc['model']=_[_0x0243('0x28')](_0x3a708e,_0x0243('0x26'));_0x57cfdc[_0x0243('0x2d')]=_[_0x0243('0x2e')](_0xcfc96a['query']);_0x57cfdc['filters']=_['intersection'](_0x57cfdc['model'],_0x57cfdc[_0x0243('0x2d')]);_0x3d0663['attributes']=_[_0x0243('0x2f')](_0x57cfdc[_0x0243('0x30')],qs[_0x0243('0x31')](_0xcfc96a[_0x0243('0x2d')][_0x0243('0x31')]));_0x3d0663[_0x0243('0x32')]=_0x3d0663[_0x0243('0x32')]['length']?_0x3d0663[_0x0243('0x32')]:_0x57cfdc[_0x0243('0x30')];if(!_0xcfc96a[_0x0243('0x2d')][_0x0243('0x33')](_0x0243('0x34'))){_0x3d0663[_0x0243('0x35')]=qs[_0x0243('0x35')](_0xcfc96a[_0x0243('0x2d')][_0x0243('0x35')]);_0x3d0663[_0x0243('0x1a')]=qs[_0x0243('0x1a')](_0xcfc96a[_0x0243('0x2d')][_0x0243('0x1a')]);}_0x3d0663[_0x0243('0x36')]=qs[_0x0243('0x37')](_0xcfc96a[_0x0243('0x2d')][_0x0243('0x37')]);_0x3d0663[_0x0243('0x38')]=qs['filters'](_[_0x0243('0x39')](_0xcfc96a[_0x0243('0x2d')],_0x57cfdc[_0x0243('0x3a')]),_0x3a708e);if(_0xcfc96a[_0x0243('0x2d')][_0x0243('0x3b')]){_0x3d0663[_0x0243('0x38')]=_['merge'](_0x3d0663[_0x0243('0x38')],{'$or':_[_0x0243('0x28')](_0x3a708e,function(_0x20c5b7){if(_0x20c5b7['type']!==_0x0243('0x3c')){var _0x405b96={};_0x405b96[_0x20c5b7[_0x0243('0x26')]]={'$like':'%'+_0xcfc96a[_0x0243('0x2d')][_0x0243('0x3b')]+'%'};return _0x405b96;}})});}_0x3d0663=_[_0x0243('0x3d')]({},_0x3d0663,_0xcfc96a[_0x0243('0x3e')]);var _0x4824d2={'where':_0x3d0663['where']};return db['CmHopperHistory'][_0x0243('0x1b')](_0x4824d2)['then'](function(_0x1c89dd){_0x453353[_0x0243('0x1b')]=_0x1c89dd;if(_0xcfc96a[_0x0243('0x2d')][_0x0243('0x3f')]){_0x3d0663[_0x0243('0x40')]=[{'all':!![]}];}return db[_0x0243('0x29')][_0x0243('0x41')](_0x3d0663);})[_0x0243('0x22')](function(_0x2b43f0){_0x453353[_0x0243('0x42')]=_0x2b43f0;return _0x453353;})[_0x0243('0x22')](respondWithFilteredResult(_0x6f8362,_0x3d0663))[_0x0243('0x43')](handleError(_0x6f8362,null));};exports[_0x0243('0x44')]=function(_0x285602,_0x1edf0a){var _0x2619cc={'raw':!![],'where':{'id':_0x285602[_0x0243('0x45')]['id']}},_0x236975={};_0x236975[_0x0243('0x30')]=_[_0x0243('0x2e')](db[_0x0243('0x29')]['rawAttributes']);_0x236975['query']=_[_0x0243('0x2e')](_0x285602[_0x0243('0x2d')]);_0x236975['filters']=_[_0x0243('0x2f')](_0x236975['model'],_0x236975[_0x0243('0x2d')]);_0x2619cc[_0x0243('0x32')]=_[_0x0243('0x2f')](_0x236975['model'],qs['fields'](_0x285602[_0x0243('0x2d')]['fields']));_0x2619cc[_0x0243('0x32')]=_0x2619cc[_0x0243('0x32')][_0x0243('0x46')]?_0x2619cc[_0x0243('0x32')]:_0x236975[_0x0243('0x30')];if(_0x285602['query'][_0x0243('0x3f')]){_0x2619cc[_0x0243('0x40')]=[{'all':!![]}];}_0x2619cc=_[_0x0243('0x3d')]({},_0x2619cc,_0x285602[_0x0243('0x3e')]);return db['CmHopperHistory'][_0x0243('0x47')](_0x2619cc)[_0x0243('0x22')](handleEntityNotFound(_0x1edf0a,null))[_0x0243('0x22')](respondWithResult(_0x1edf0a,null))[_0x0243('0x43')](handleError(_0x1edf0a,null));};exports[_0x0243('0x48')]=function(_0x224cd7,_0x420e3f){return db[_0x0243('0x29')]['create'](_0x224cd7[_0x0243('0x49')],{})['then'](respondWithResult(_0x420e3f,0xc9))[_0x0243('0x43')](handleError(_0x420e3f,null));};exports[_0x0243('0x4a')]=function(_0x1bc1e6,_0x2f090e){return db[_0x0243('0x29')][_0x0243('0x4a')]()[_0x0243('0x22')](respondWithResult(_0x2f090e,null))[_0x0243('0x43')](handleError(_0x2f090e,null));};exports[_0x0243('0x21')]=function(_0x24fd75,_0x3dd2d2){if(_0x24fd75[_0x0243('0x49')][_0x0243('0x4b')]){delete _0x24fd75['body'][_0x0243('0x4b')];}return db[_0x0243('0x29')][_0x0243('0x47')]({'where':{'uniqueid':_0x24fd75[_0x0243('0x45')]['id']}})[_0x0243('0x22')](handleEntityNotFound(_0x3dd2d2,null))[_0x0243('0x22')](saveUpdates(_0x24fd75[_0x0243('0x49')],null))[_0x0243('0x22')](respondWithResult(_0x3dd2d2,null))[_0x0243('0x43')](handleError(_0x3dd2d2,null));}; \ No newline at end of file +var _0x4817=['includeAll','findAll','rows','catch','params','include','find','create','body','describe','update','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','name','options'];(function(_0x1166a5,_0x3c56a6){var _0x391192=function(_0x3e1100){while(--_0x3e1100){_0x1166a5['push'](_0x1166a5['shift']());}};_0x391192(++_0x3c56a6);}(_0x4817,0xa8));var _0x7481=function(_0x5a810b,_0x506113){_0x5a810b=_0x5a810b-0x0;var _0x1dad51=_0x4817[_0x5a810b];return _0x1dad51;};'use strict';var emlformat=require(_0x7481('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7481('0x1'));var jsonpatch=require(_0x7481('0x2'));var rp=require(_0x7481('0x3'));var moment=require(_0x7481('0x4'));var BPromise=require(_0x7481('0x5'));var Mustache=require(_0x7481('0x6'));var util=require(_0x7481('0x7'));var path=require(_0x7481('0x8'));var sox=require('sox');var csv=require(_0x7481('0x9'));var ejs=require(_0x7481('0xa'));var fs=require('fs');var fs_extra=require(_0x7481('0xb'));var _=require(_0x7481('0xc'));var squel=require(_0x7481('0xd'));var crypto=require(_0x7481('0xe'));var jsforce=require(_0x7481('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7481('0x9'));var querystring=require(_0x7481('0x10'));var Papa=require(_0x7481('0x11'));var Redis=require('ioredis');var authService=require(_0x7481('0x12'));var qs=require(_0x7481('0x13'));var as=require(_0x7481('0x14'));var hardwareService=require(_0x7481('0x15'));var logger=require(_0x7481('0x16'))(_0x7481('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7481('0x18'))['db'];function respondWithStatusCode(_0x207430,_0x1819b8){_0x1819b8=_0x1819b8||0xcc;return function(_0x36dfc8){if(_0x36dfc8){return _0x207430['sendStatus'](_0x1819b8);}return _0x207430[_0x7481('0x19')](_0x1819b8)[_0x7481('0x1a')]();};}function respondWithResult(_0x8790e9,_0x5bcef7){_0x5bcef7=_0x5bcef7||0xc8;return function(_0x1a1928){if(_0x1a1928){return _0x8790e9[_0x7481('0x19')](_0x5bcef7)['json'](_0x1a1928);}};}function respondWithFilteredResult(_0x33a3f0,_0x202ffd){return function(_0x1a2a07){if(_0x1a2a07){var _0x236df0=typeof _0x202ffd[_0x7481('0x1b')]===_0x7481('0x1c')&&typeof _0x202ffd[_0x7481('0x1d')]===_0x7481('0x1c');var _0x59d291=_0x1a2a07[_0x7481('0x1e')];var _0x1af1ef=_0x236df0?0x0:_0x202ffd[_0x7481('0x1b')];var _0x43f7e9=_0x236df0?_0x1a2a07[_0x7481('0x1e')]:_0x202ffd[_0x7481('0x1b')]+_0x202ffd['limit'];var _0x5241ef;if(_0x43f7e9>=_0x59d291){_0x43f7e9=_0x59d291;_0x5241ef=0xc8;}else{_0x5241ef=0xce;}_0x33a3f0['status'](_0x5241ef);return _0x33a3f0['set'](_0x7481('0x1f'),_0x1af1ef+'-'+_0x43f7e9+'/'+_0x59d291)[_0x7481('0x20')](_0x1a2a07);}return null;};}function patchUpdates(_0x2beef4){return function(_0xf30515){try{jsonpatch[_0x7481('0x21')](_0xf30515,_0x2beef4,!![]);}catch(_0x34c762){return BPromise[_0x7481('0x22')](_0x34c762);}return _0xf30515[_0x7481('0x23')]();};}function saveUpdates(_0x2fb198,_0x5adbf3){return function(_0x267ac8){if(_0x267ac8){return _0x267ac8['update'](_0x2fb198)['then'](function(_0xa44811){return _0xa44811;});}return null;};}function removeEntity(_0x32ab89,_0x273e6a){return function(_0x623854){if(_0x623854){return _0x623854[_0x7481('0x24')]()[_0x7481('0x25')](function(){_0x32ab89[_0x7481('0x19')](0xcc)[_0x7481('0x1a')]();});}};}function handleEntityNotFound(_0x39dbc7,_0x8235a2){return function(_0x434a96){if(!_0x434a96){_0x39dbc7[_0x7481('0x26')](0x194);}return _0x434a96;};}function handleError(_0x463a34,_0x3dfc9e){_0x3dfc9e=_0x3dfc9e||0x1f4;return function(_0x4145be){logger['error'](_0x4145be[_0x7481('0x27')]);if(_0x4145be['name']){delete _0x4145be['name'];}_0x463a34[_0x7481('0x19')](_0x3dfc9e)[_0x7481('0x28')](_0x4145be);};}exports[_0x7481('0x29')]=function(_0x27ce42,_0x1f6716){var _0xe21063={},_0xae932a={},_0x263501={'count':0x0,'rows':[]};var _0x32dd15=_[_0x7481('0x2a')](db[_0x7481('0x2b')][_0x7481('0x2c')],function(_0x5f4247){return{'name':_0x5f4247[_0x7481('0x2d')],'type':_0x5f4247[_0x7481('0x2e')][_0x7481('0x2f')]};});_0xae932a['model']=_['map'](_0x32dd15,'name');_0xae932a[_0x7481('0x30')]=_[_0x7481('0x31')](_0x27ce42[_0x7481('0x30')]);_0xae932a[_0x7481('0x32')]=_[_0x7481('0x33')](_0xae932a[_0x7481('0x34')],_0xae932a[_0x7481('0x30')]);_0xe21063[_0x7481('0x35')]=_[_0x7481('0x33')](_0xae932a[_0x7481('0x34')],qs[_0x7481('0x36')](_0x27ce42[_0x7481('0x30')][_0x7481('0x36')]));_0xe21063[_0x7481('0x35')]=_0xe21063[_0x7481('0x35')][_0x7481('0x37')]?_0xe21063[_0x7481('0x35')]:_0xae932a[_0x7481('0x34')];if(!_0x27ce42[_0x7481('0x30')][_0x7481('0x38')](_0x7481('0x39'))){_0xe21063[_0x7481('0x1d')]=qs[_0x7481('0x1d')](_0x27ce42[_0x7481('0x30')][_0x7481('0x1d')]);_0xe21063[_0x7481('0x1b')]=qs['offset'](_0x27ce42[_0x7481('0x30')]['offset']);}_0xe21063[_0x7481('0x3a')]=qs[_0x7481('0x3b')](_0x27ce42[_0x7481('0x30')][_0x7481('0x3b')]);_0xe21063['where']=qs[_0x7481('0x32')](_[_0x7481('0x3c')](_0x27ce42[_0x7481('0x30')],_0xae932a['filters']),_0x32dd15);if(_0x27ce42[_0x7481('0x30')][_0x7481('0x3d')]){_0xe21063['where']=_[_0x7481('0x3e')](_0xe21063[_0x7481('0x3f')],{'$or':_[_0x7481('0x2a')](_0x32dd15,function(_0x3bbd30){if(_0x3bbd30[_0x7481('0x2e')]!=='VIRTUAL'){var _0x4c0124={};_0x4c0124[_0x3bbd30[_0x7481('0x40')]]={'$like':'%'+_0x27ce42[_0x7481('0x30')][_0x7481('0x3d')]+'%'};return _0x4c0124;}})});}_0xe21063=_[_0x7481('0x3e')]({},_0xe21063,_0x27ce42[_0x7481('0x41')]);var _0x532ac5={'where':_0xe21063['where']};return db[_0x7481('0x2b')][_0x7481('0x1e')](_0x532ac5)['then'](function(_0x593341){_0x263501[_0x7481('0x1e')]=_0x593341;if(_0x27ce42[_0x7481('0x30')][_0x7481('0x42')]){_0xe21063['include']=[{'all':!![]}];}return db[_0x7481('0x2b')][_0x7481('0x43')](_0xe21063);})[_0x7481('0x25')](function(_0x35f889){_0x263501[_0x7481('0x44')]=_0x35f889;return _0x263501;})[_0x7481('0x25')](respondWithFilteredResult(_0x1f6716,_0xe21063))[_0x7481('0x45')](handleError(_0x1f6716,null));};exports['show']=function(_0x11aab6,_0x17d4d2){var _0x34f6c9={'raw':!![],'where':{'id':_0x11aab6[_0x7481('0x46')]['id']}},_0x3b2844={};_0x3b2844[_0x7481('0x34')]=_[_0x7481('0x31')](db[_0x7481('0x2b')]['rawAttributes']);_0x3b2844['query']=_[_0x7481('0x31')](_0x11aab6[_0x7481('0x30')]);_0x3b2844['filters']=_['intersection'](_0x3b2844[_0x7481('0x34')],_0x3b2844[_0x7481('0x30')]);_0x34f6c9[_0x7481('0x35')]=_[_0x7481('0x33')](_0x3b2844[_0x7481('0x34')],qs[_0x7481('0x36')](_0x11aab6[_0x7481('0x30')]['fields']));_0x34f6c9[_0x7481('0x35')]=_0x34f6c9[_0x7481('0x35')]['length']?_0x34f6c9['attributes']:_0x3b2844[_0x7481('0x34')];if(_0x11aab6[_0x7481('0x30')]['includeAll']){_0x34f6c9[_0x7481('0x47')]=[{'all':!![]}];}_0x34f6c9=_[_0x7481('0x3e')]({},_0x34f6c9,_0x11aab6[_0x7481('0x41')]);return db[_0x7481('0x2b')][_0x7481('0x48')](_0x34f6c9)[_0x7481('0x25')](handleEntityNotFound(_0x17d4d2,null))[_0x7481('0x25')](respondWithResult(_0x17d4d2,null))[_0x7481('0x45')](handleError(_0x17d4d2,null));};exports[_0x7481('0x49')]=function(_0x1d7ac9,_0x5613b8){return db[_0x7481('0x2b')][_0x7481('0x49')](_0x1d7ac9[_0x7481('0x4a')],{})['then'](respondWithResult(_0x5613b8,0xc9))[_0x7481('0x45')](handleError(_0x5613b8,null));};exports[_0x7481('0x4b')]=function(_0xf5d09d,_0x18646e){return db[_0x7481('0x2b')][_0x7481('0x4b')]()[_0x7481('0x25')](respondWithResult(_0x18646e,null))[_0x7481('0x45')](handleError(_0x18646e,null));};exports[_0x7481('0x4c')]=function(_0x2b1015,_0x485708){if(_0x2b1015['body'][_0x7481('0x4d')]){delete _0x2b1015[_0x7481('0x4a')][_0x7481('0x4d')];}return db[_0x7481('0x2b')][_0x7481('0x48')]({'where':{'uniqueid':_0x2b1015[_0x7481('0x46')]['id']}})[_0x7481('0x25')](handleEntityNotFound(_0x485708,null))[_0x7481('0x25')](saveUpdates(_0x2b1015[_0x7481('0x4a')],null))[_0x7481('0x25')](respondWithResult(_0x485708,null))[_0x7481('0x45')](handleError(_0x485708,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 3908593..58a852c 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 _0xcaef=['rimraf','../../config/environment','exports','define','endtime','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xcaef,0x1c9));var _0xfcae=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xcaef[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));var logger=require(_0xfcae('0x1'))(_0xfcae('0x2'));var moment=require(_0xfcae('0x3'));var BPromise=require('bluebird');var rp=require(_0xfcae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcae('0x5'));var config=require(_0xfcae('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0xfcae('0x7')]=function(_0x19dd62,_0x4e8311){return _0x19dd62[_0xfcae('0x8')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xfcae('0x9'),'fields':[_0xfcae('0x9')]},{'name':_0xfcae('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdec3=['moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x53acd7,_0x331f39){var _0x3e5639=function(_0x231d40){while(--_0x231d40){_0x53acd7['push'](_0x53acd7['shift']());}};_0x3e5639(++_0x331f39);}(_0xdec3,0x89));var _0x3dec=function(_0x268073,_0x29c404){_0x268073=_0x268073-0x0;var _0x409f2c=_0xdec3[_0x268073];return _0x409f2c;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var logger=require(_0x3dec('0x1'))(_0x3dec('0x2'));var moment=require(_0x3dec('0x3'));var BPromise=require('bluebird');var rp=require(_0x3dec('0x4'));var fs=require('fs');var path=require(_0x3dec('0x5'));var rimraf=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x3dec('0x8')]=function(_0x2894eb,_0x347c06){return _0x2894eb[_0x3dec('0x9')](_0x3dec('0xa'),attributes,{'tableName':_0x3dec('0xb'),'paranoid':![],'indexes':[{'name':_0x3dec('0xc'),'fields':['endtime']},{'name':_0x3dec('0xd'),'fields':[_0x3dec('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index a063be9..7a1e4e1 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 _0x63e4=['outboundRejectCallsDay','outboundReCallsDay','stringify','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','CmHopperHistory','col','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0x63e4,0x12a));var _0x463e=function(_0x5c9960,_0x38fdb5){_0x5c9960=_0x5c9960-0x0;var _0x155b16=_0x63e4[_0x5c9960];return _0x155b16;};'use strict';var _=require(_0x463e('0x0'));var util=require(_0x463e('0x1'));var moment=require(_0x463e('0x2'));var BPromise=require(_0x463e('0x3'));var rs=require(_0x463e('0x4'));var fs=require('fs');var Redis=require(_0x463e('0x5'));var db=require(_0x463e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x463e('0x7'))(_0x463e('0x8'));var config=require(_0x463e('0x9'));var jayson=require(_0x463e('0xa'));var client=jayson[_0x463e('0xb')][_0x463e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x703906,_0x273c7a,_0x3a5492){return new BPromise(function(_0x6d5e93,_0x441fed){return client[_0x463e('0xd')](_0x703906,_0x3a5492)[_0x463e('0xe')](function(_0x33e94f){logger[_0x463e('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x273c7a,_0x463e('0x10'));logger[_0x463e('0x11')](_0x463e('0x12'),_0x273c7a,_0x463e('0x10'),JSON['stringify'](_0x33e94f));if(_0x33e94f[_0x463e('0x13')]){if(_0x33e94f[_0x463e('0x13')]['code']===0x1f4){logger[_0x463e('0x13')](_0x463e('0x14'),_0x273c7a,_0x33e94f[_0x463e('0x13')][_0x463e('0x15')]);return _0x441fed(_0x33e94f['error'][_0x463e('0x15')]);}logger[_0x463e('0x13')](_0x463e('0x14'),_0x273c7a,_0x33e94f[_0x463e('0x13')]['message']);return _0x6d5e93(_0x33e94f[_0x463e('0x13')][_0x463e('0x15')]);}else{logger[_0x463e('0xf')](_0x463e('0x14'),_0x273c7a,_0x463e('0x10'));_0x6d5e93(_0x33e94f[_0x463e('0x16')][_0x463e('0x15')]);}})[_0x463e('0x17')](function(_0x1b29ad){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x273c7a,_0x1b29ad);_0x441fed(_0x1b29ad);});});}exports[_0x463e('0x18')]=function(_0x12d637){var _0x292639=this;return new Promise(function(_0x52789a,_0x7390d5){return db['CmHopperHistory'][_0x463e('0x19')](_0x12d637[_0x463e('0x1a')],{'raw':_0x12d637[_0x463e('0x1b')]?_0x12d637[_0x463e('0x1b')][_0x463e('0x1c')]===undefined?!![]:![]:!![]})[_0x463e('0xe')](function(_0x1b196b){logger[_0x463e('0xf')](_0x463e('0x18'),_0x12d637);logger['debug']('CreateCmHopperHistory',_0x12d637,JSON['stringify'](_0x1b196b));_0x52789a(_0x1b196b);})[_0x463e('0x17')](function(_0x402c74){logger['error'](_0x463e('0x18'),_0x402c74[_0x463e('0x15')],_0x12d637);_0x7390d5(_0x292639['error'](0x1f4,_0x402c74[_0x463e('0x15')]));});});};exports[_0x463e('0x1d')]=function(_0x3f001d){var _0x44d4ec=this;return new Promise(function(_0x77473b,_0x4726a5){return db[_0x463e('0x1e')]['findAll']({'raw':_0x3f001d[_0x463e('0x1b')]?_0x3f001d['options'][_0x463e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f001d['options']?_0x3f001d[_0x463e('0x1b')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x463e('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x23')))),_0x463e('0x24')],[db['sequelize']['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x25')))),_0x463e('0x26')],[db[_0x463e('0x20')]['fn']('COUNT',db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x27')))),_0x463e('0x28')],[db[_0x463e('0x20')]['fn'](_0x463e('0x29'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x2a')))),_0x463e('0x2b')],[db[_0x463e('0x20')]['fn'](_0x463e('0x29'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x2c')))),_0x463e('0x2d')]]})[_0x463e('0xe')](function(_0x547615){logger['info'](_0x463e('0x1d'),_0x3f001d);logger['debug'](_0x463e('0x1d'),_0x3f001d,JSON['stringify'](_0x547615));_0x77473b(_0x547615);})[_0x463e('0x17')](function(_0x494ce3){logger[_0x463e('0x13')](_0x463e('0x1d'),_0x494ce3[_0x463e('0x15')],_0x3f001d);_0x4726a5(_0x44d4ec['error'](0x1f4,_0x494ce3[_0x463e('0x15')]));});});};exports[_0x463e('0x2e')]=function(_0x10795f){var _0x23ac94=this;return new Promise(function(_0x5e1f8c,_0x1f9f75){return db[_0x463e('0x1e')]['findAll']({'raw':_0x10795f[_0x463e('0x1b')]?_0x10795f[_0x463e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x10795f[_0x463e('0x1b')]?_0x10795f[_0x463e('0x1b')]['where']||null:null,'attributes':[[_0x463e('0x2f'),_0x463e('0x30')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db['sequelize']['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x31')))),_0x463e('0x32')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db['sequelize']['literal'](_0x463e('0x33')))),_0x463e('0x34')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x463e('0x35')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x36')))),'outboundBusyCallsDay'],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x37')))),_0x463e('0x38')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x39')))),_0x463e('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x3b')))),_0x463e('0x3c')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x463e('0x22')](_0x463e('0x3d')))),_0x463e('0x3e')],[db[_0x463e('0x20')]['fn']('COUNT',db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x463e('0x3f')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db['sequelize']['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x40')))),_0x463e('0x41')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x42')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db['sequelize'][_0x463e('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x463e('0x43')],[db['sequelize']['fn']('COUNT',db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x463e('0x44')]],'group':[_0x463e('0x2f')]})[_0x463e('0xe')](function(_0x33f6ad){logger[_0x463e('0xf')](_0x463e('0x2e'),_0x10795f);logger[_0x463e('0x11')](_0x463e('0x2e'),_0x10795f,JSON[_0x463e('0x45')](_0x33f6ad));_0x5e1f8c(_0x33f6ad);})[_0x463e('0x17')](function(_0x4fa09e){logger[_0x463e('0x13')]('GetVoiceQueueHopperHistory',_0x4fa09e[_0x463e('0x15')],_0x10795f);_0x1f9f75(_0x23ac94[_0x463e('0x13')](0x1f4,_0x4fa09e[_0x463e('0x15')]));});});};exports[_0x463e('0x46')]=function(_0x5eb382){var _0x1c184b=this;return new Promise(function(_0x46f223,_0x352021){return db[_0x463e('0x1e')][_0x463e('0x47')]({'raw':_0x5eb382[_0x463e('0x1b')]?_0x5eb382[_0x463e('0x1b')][_0x463e('0x1c')]===undefined?!![]:![]:!![],'where':_0x5eb382[_0x463e('0x1b')]?_0x5eb382[_0x463e('0x1b')]['where']||null:null,'attributes':[[_0x463e('0x2f'),_0x463e('0x30')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db['sequelize'][_0x463e('0x1f')]('id')),_0x463e('0x48')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x23')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x463e('0xe')](function(_0x3e64c1){logger['info'](_0x463e('0x46'),_0x5eb382);logger[_0x463e('0x11')](_0x463e('0x46'),_0x5eb382,JSON[_0x463e('0x45')](_0x3e64c1));_0x46f223(_0x3e64c1);})['catch'](function(_0x35c0ea){logger['error'](_0x463e('0x46'),_0x35c0ea[_0x463e('0x15')],_0x5eb382);_0x352021(_0x1c184b[_0x463e('0x13')](0x1f4,_0x35c0ea[_0x463e('0x15')]));});});}; \ No newline at end of file +var _0xa900=['message','info','request\x20sent','result','catch','CmHopperHistory','create','options','raw','CreateCmHopperHistory','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','findAll','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','campaign','name','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa900,0x101));var _0x0a90=function(_0x3d56d5,_0x492dc9){_0x3d56d5=_0x3d56d5-0x0;var _0x50b4f3=_0xa900[_0x3d56d5];return _0x50b4f3;};'use strict';var _=require(_0x0a90('0x0'));var util=require(_0x0a90('0x1'));var moment=require(_0x0a90('0x2'));var BPromise=require(_0x0a90('0x3'));var rs=require(_0x0a90('0x4'));var fs=require('fs');var Redis=require(_0x0a90('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a90('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a90('0x7'));var jayson=require(_0x0a90('0x8'));var client=jayson[_0x0a90('0x9')][_0x0a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56a1e5,_0x3909ac,_0x4718e9){return new BPromise(function(_0x33e3cf,_0x4f2b58){return client[_0x0a90('0xb')](_0x56a1e5,_0x4718e9)[_0x0a90('0xc')](function(_0x36c82f){logger['info'](_0x0a90('0xd'),_0x3909ac,'request\x20sent');logger[_0x0a90('0xe')](_0x0a90('0xf'),_0x3909ac,'request\x20sent',JSON[_0x0a90('0x10')](_0x36c82f));if(_0x36c82f[_0x0a90('0x11')]){if(_0x36c82f[_0x0a90('0x11')][_0x0a90('0x12')]===0x1f4){logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x36c82f[_0x0a90('0x11')][_0x0a90('0x13')]);return _0x4f2b58(_0x36c82f[_0x0a90('0x11')][_0x0a90('0x13')]);}logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x36c82f[_0x0a90('0x11')]['message']);return _0x33e3cf(_0x36c82f['error'][_0x0a90('0x13')]);}else{logger[_0x0a90('0x14')](_0x0a90('0xd'),_0x3909ac,_0x0a90('0x15'));_0x33e3cf(_0x36c82f[_0x0a90('0x16')][_0x0a90('0x13')]);}})[_0x0a90('0x17')](function(_0x4c5979){logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x4c5979);_0x4f2b58(_0x4c5979);});});}exports['CreateCmHopperHistory']=function(_0x2c0719){var _0x5cbe3c=this;return new Promise(function(_0x619487,_0x44b75d){return db[_0x0a90('0x18')][_0x0a90('0x19')](_0x2c0719['body'],{'raw':_0x2c0719[_0x0a90('0x1a')]?_0x2c0719[_0x0a90('0x1a')][_0x0a90('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4ba044){logger[_0x0a90('0x14')]('CreateCmHopperHistory',_0x2c0719);logger[_0x0a90('0xe')]('CreateCmHopperHistory',_0x2c0719,JSON[_0x0a90('0x10')](_0x4ba044));_0x619487(_0x4ba044);})[_0x0a90('0x17')](function(_0xf3e76f){logger[_0x0a90('0x11')](_0x0a90('0x1c'),_0xf3e76f[_0x0a90('0x13')],_0x2c0719);_0x44b75d(_0x5cbe3c[_0x0a90('0x11')](0x1f4,_0xf3e76f[_0x0a90('0x13')]));});});};exports[_0x0a90('0x1d')]=function(_0x228279){var _0x5a1bf3=this;return new Promise(function(_0x22c241,_0x413814){return db[_0x0a90('0x18')]['findAll']({'raw':_0x228279[_0x0a90('0x1a')]?_0x228279[_0x0a90('0x1a')][_0x0a90('0x1b')]===undefined?!![]:![]:!![],'where':_0x228279[_0x0a90('0x1a')]?_0x228279['options'][_0x0a90('0x1e')]||null:null,'attributes':[[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')][_0x0a90('0x21')]('id')),_0x0a90('0x22')],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')]['literal'](_0x0a90('0x23')))),_0x0a90('0x24')],[db[_0x0a90('0x1f')]['fn']('COUNT',db[_0x0a90('0x1f')]['fn']('IF',db['sequelize'][_0x0a90('0x25')](_0x0a90('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x0a90('0x1f')]['fn']('COUNT',db[_0x0a90('0x1f')]['fn']('IF',db['sequelize'][_0x0a90('0x25')](_0x0a90('0x27')))),_0x0a90('0x28')],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x29'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x2a')))),'predictiveIntervalAvgHoldtime'],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x29'),db['sequelize']['fn']('IF',db['sequelize'][_0x0a90('0x25')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x0a90('0xc')](function(_0x20a765){logger[_0x0a90('0x14')](_0x0a90('0x1d'),_0x228279);logger[_0x0a90('0xe')](_0x0a90('0x1d'),_0x228279,JSON[_0x0a90('0x10')](_0x20a765));_0x22c241(_0x20a765);})['catch'](function(_0x2e9af9){logger[_0x0a90('0x11')](_0x0a90('0x1d'),_0x2e9af9[_0x0a90('0x13')],_0x228279);_0x413814(_0x5a1bf3['error'](0x1f4,_0x2e9af9['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4f91b9){var _0x1303ed=this;return new Promise(function(_0x2b8fdc,_0x49922c){return db[_0x0a90('0x18')][_0x0a90('0x2b')]({'raw':_0x4f91b9['options']?_0x4f91b9[_0x0a90('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4f91b9[_0x0a90('0x1a')]?_0x4f91b9[_0x0a90('0x1a')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db['sequelize'][_0x0a90('0x25')]('`state`\x20=\x200,\x201,\x20null'))),_0x0a90('0x2c')],[db['sequelize']['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')]['literal'](_0x0a90('0x2d')))),_0x0a90('0x2e')],[db['sequelize']['fn'](_0x0a90('0x20'),db['sequelize']['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x23')))),_0x0a90('0x2f')],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')]['literal'](_0x0a90('0x30')))),'outboundBusyCallsDay'],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x31')))),_0x0a90('0x32')],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')]['literal'](_0x0a90('0x33')))),_0x0a90('0x34')],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x35')))),_0x0a90('0x36')],[db['sequelize']['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x0a90('0x37')))),_0x0a90('0x38')],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x39')))),_0x0a90('0x3a')],[db['sequelize']['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x3b')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x3c')))),_0x0a90('0x3d')],[db[_0x0a90('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0x0a90('0x3e')],[db[_0x0a90('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x3f')))),_0x0a90('0x3d')],[db[_0x0a90('0x1f')]['fn']('COUNT',db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x40')))),'outboundReCallsDay']],'group':['campaign']})[_0x0a90('0xc')](function(_0x20d28e){logger[_0x0a90('0x14')](_0x0a90('0x41'),_0x4f91b9);logger['debug'](_0x0a90('0x41'),_0x4f91b9,JSON[_0x0a90('0x10')](_0x20d28e));_0x2b8fdc(_0x20d28e);})['catch'](function(_0x1cdc27){logger[_0x0a90('0x11')](_0x0a90('0x41'),_0x1cdc27[_0x0a90('0x13')],_0x4f91b9);_0x49922c(_0x1303ed['error'](0x1f4,_0x1cdc27[_0x0a90('0x13')]));});});};exports[_0x0a90('0x42')]=function(_0x650eb8){var _0x784af0=this;return new Promise(function(_0xb6750a,_0x31e24d){return db[_0x0a90('0x18')][_0x0a90('0x2b')]({'raw':_0x650eb8[_0x0a90('0x1a')]?_0x650eb8[_0x0a90('0x1a')][_0x0a90('0x1b')]===undefined?!![]:![]:!![],'where':_0x650eb8['options']?_0x650eb8[_0x0a90('0x1a')]['where']||null:null,'attributes':[[_0x0a90('0x43'),_0x0a90('0x44')],[db[_0x0a90('0x1f')]['fn']('COUNT',db['sequelize']['col']('id')),'ivrTotalCallsDays'],[db[_0x0a90('0x1f')]['fn'](_0x0a90('0x20'),db[_0x0a90('0x1f')]['fn']('IF',db[_0x0a90('0x1f')][_0x0a90('0x25')](_0x0a90('0x23')))),'ivrAnswerCallsDay']],'group':[_0x0a90('0x43')]})[_0x0a90('0xc')](function(_0x1fa0ab){logger['info'](_0x0a90('0x42'),_0x650eb8);logger[_0x0a90('0xe')]('GetCampaignHopperHistory',_0x650eb8,JSON[_0x0a90('0x10')](_0x1fa0ab));_0xb6750a(_0x1fa0ab);})[_0x0a90('0x17')](function(_0x3f2268){logger[_0x0a90('0x11')](_0x0a90('0x42'),_0x3f2268[_0x0a90('0x13')],_0x650eb8);_0x31e24d(_0x784af0['error'](0x1f4,_0x3f2268[_0x0a90('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a6ba5bb..69835cc 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 _0xbf30=['update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbf30,0xc9));var _0x0bf3=function(_0xc08b2,_0x4ba9d1){_0xc08b2=_0xc08b2-0x0;var _0x3a6f1f=_0xbf30[_0xc08b2];return _0x3a6f1f;};'use strict';var multer=require(_0x0bf3('0x0'));var util=require(_0x0bf3('0x1'));var path=require(_0x0bf3('0x2'));var timeout=require(_0x0bf3('0x3'));var express=require(_0x0bf3('0x4'));var router=express[_0x0bf3('0x5')]();var fs_extra=require(_0x0bf3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0bf3('0x7'));var config=require(_0x0bf3('0x8'));var controller=require(_0x0bf3('0x9'));router[_0x0bf3('0xa')]('/',auth['isAuthenticated'](),controller[_0x0bf3('0xb')]);router[_0x0bf3('0xa')](_0x0bf3('0xc'),auth[_0x0bf3('0xd')](),controller[_0x0bf3('0xe')]);router[_0x0bf3('0xa')](_0x0bf3('0xf'),auth['isAuthenticated'](),controller[_0x0bf3('0x10')]);router[_0x0bf3('0x11')]('/',auth[_0x0bf3('0xd')](),controller['create']);router[_0x0bf3('0x12')](_0x0bf3('0xf'),auth[_0x0bf3('0xd')](),controller[_0x0bf3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x052d=['isAuthenticated','update','exports','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','describe','show','post','put'];(function(_0x2478a7,_0x5c3223){var _0xcaac7b=function(_0x42c209){while(--_0x42c209){_0x2478a7['push'](_0x2478a7['shift']());}};_0xcaac7b(++_0x5c3223);}(_0x052d,0x1d3));var _0xd052=function(_0x502fdd,_0x17495b){_0x502fdd=_0x502fdd-0x0;var _0x3023a6=_0x052d[_0x502fdd];return _0x3023a6;};'use strict';var multer=require(_0xd052('0x0'));var util=require('util');var path=require(_0xd052('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd052('0x2')]();var fs_extra=require(_0xd052('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd052('0x4'));var config=require(_0xd052('0x5'));var controller=require('./cmHopperHistory.controller');router[_0xd052('0x6')]('/',auth['isAuthenticated'](),controller[_0xd052('0x7')]);router[_0xd052('0x6')](_0xd052('0x8'),auth['isAuthenticated'](),controller[_0xd052('0x9')]);router[_0xd052('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xd052('0xa')]);router[_0xd052('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd052('0xc')]('/:id',auth[_0xd052('0xd')](),controller[_0xd052('0xe')]);module[_0xd052('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 511d16e..38d97de 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 _0xe94a=['exports','STRING','sequelize'];(function(_0x308bc6,_0x564ec7){var _0x422fcf=function(_0x8451a8){while(--_0x8451a8){_0x308bc6['push'](_0x308bc6['shift']());}};_0x422fcf(++_0x564ec7);}(_0xe94a,0x1c7));var _0xae94=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0xe94a[_0x2136a6];return _0x55b948;};'use strict';var Sequelize=require(_0xae94('0x0'));module[_0xae94('0x1')]={'name':{'type':Sequelize[_0xae94('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xae94('0x2')]},'dialPrefix':{'type':Sequelize[_0xae94('0x2')]}}; \ No newline at end of file +var _0x899a=['name','STRING','sequelize','exports'];(function(_0x2a7211,_0x1821be){var _0x6eda40=function(_0x4491d2){while(--_0x4491d2){_0x2a7211['push'](_0x2a7211['shift']());}};_0x6eda40(++_0x1821be);}(_0x899a,0x1b6));var _0xa899=function(_0x157f56,_0x23634f){_0x157f56=_0x157f56-0x0;var _0x903d62=_0x899a[_0x157f56];return _0x903d62;};'use strict';var Sequelize=require(_0xa899('0x0'));module[_0xa899('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa899('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa899('0x3')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index bdc08ec..10ca2ac 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 _0xe30f=['sort','rows','removeDispositions','CmContact','tags','isArray','join','push','each','omit','ids','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','switch','defaultValue','sequelize','queryInterface','cm_contacts','cf_%s','getCustomFields','findOne','findAndCountAll','addAgents','spread','userCmList:save','userCmList:remove','emit','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','json','offset','undefined','count','limit','status','set','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','CmList','includeAll','findAll','show','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','catch','params','describe','addDisposition','ListId','Disposition','getDispositions'];(function(_0x61bb05,_0x47421f){var _0x3ceb3e=function(_0x54b8f7){while(--_0x54b8f7){_0x61bb05['push'](_0x61bb05['shift']());}};_0x3ceb3e(++_0x47421f);}(_0xe30f,0xc1));var _0xfe30=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe30f[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xfe30('0x0'));var rimraf=require(_0xfe30('0x1'));var zipdir=require(_0xfe30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe30('0x3'));var moment=require(_0xfe30('0x4'));var BPromise=require(_0xfe30('0x5'));var Mustache=require(_0xfe30('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfe30('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe30('0x8'));var _=require(_0xfe30('0x9'));var squel=require(_0xfe30('0xa'));var crypto=require(_0xfe30('0xb'));var jsforce=require(_0xfe30('0xc'));var deskjs=require(_0xfe30('0xd'));var toCsv=require(_0xfe30('0xe'));var querystring=require('querystring');var Papa=require(_0xfe30('0xf'));var Redis=require(_0xfe30('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfe30('0x11'));var as=require(_0xfe30('0x12'));var hardwareService=require(_0xfe30('0x13'));var logger=require(_0xfe30('0x14'))(_0xfe30('0x15'));var utils=require(_0xfe30('0x16'));var config=require(_0xfe30('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe30('0x18'))['db'];config[_0xfe30('0x19')]=_[_0xfe30('0x1a')](config['redis'],{'host':_0xfe30('0x1b'),'port':0x18eb});var socket=require(_0xfe30('0x1c'))(new Redis(config['redis']));require(_0xfe30('0x1d'))[_0xfe30('0x1e')](socket);function respondWithStatusCode(_0x5bbfc0,_0x53cd02){_0x53cd02=_0x53cd02||0xcc;return function(_0x5dcb1e){if(_0x5dcb1e){return _0x5bbfc0['sendStatus'](_0x53cd02);}return _0x5bbfc0['status'](_0x53cd02)['end']();};}function respondWithResult(_0x3f4cbc,_0xff5311){_0xff5311=_0xff5311||0xc8;return function(_0xbe0392){if(_0xbe0392){return _0x3f4cbc['status'](_0xff5311)[_0xfe30('0x1f')](_0xbe0392);}};}function respondWithFilteredResult(_0x4c0133,_0x4ffb17){return function(_0x1888b3){if(_0x1888b3){var _0x5437d9=typeof _0x4ffb17[_0xfe30('0x20')]===_0xfe30('0x21')&&typeof _0x4ffb17['limit']===_0xfe30('0x21');var _0x5b94f1=_0x1888b3[_0xfe30('0x22')];var _0x32a6d0=_0x5437d9?0x0:_0x4ffb17[_0xfe30('0x20')];var _0x1852c6=_0x5437d9?_0x1888b3[_0xfe30('0x22')]:_0x4ffb17['offset']+_0x4ffb17[_0xfe30('0x23')];var _0x424044;if(_0x1852c6>=_0x5b94f1){_0x1852c6=_0x5b94f1;_0x424044=0xc8;}else{_0x424044=0xce;}_0x4c0133[_0xfe30('0x24')](_0x424044);return _0x4c0133[_0xfe30('0x25')](_0xfe30('0x26'),_0x32a6d0+'-'+_0x1852c6+'/'+_0x5b94f1)[_0xfe30('0x1f')](_0x1888b3);}return null;};}function patchUpdates(_0x300ce3){return function(_0x1e43b2){try{jsonpatch['apply'](_0x1e43b2,_0x300ce3,!![]);}catch(_0x53e115){return BPromise[_0xfe30('0x27')](_0x53e115);}return _0x1e43b2[_0xfe30('0x28')]();};}function saveUpdates(_0x30a458,_0x5aa73d){return function(_0x558446){if(_0x558446){return _0x558446[_0xfe30('0x29')](_0x30a458)[_0xfe30('0x2a')](function(_0x1c937f){return _0x1c937f;});}return null;};}function removeEntity(_0x3f51e5,_0x326710){return function(_0x3d210a){if(_0x3d210a){return _0x3d210a[_0xfe30('0x2b')]()[_0xfe30('0x2a')](function(){var _0xf77462=_0x3d210a[_0xfe30('0x2c')]({'plain':!![]});var _0x108f8b=_0xfe30('0x2d');return db[_0xfe30('0x2e')][_0xfe30('0x2b')]({'where':{'type':_0x108f8b,'resourceId':_0xf77462['id']}})[_0xfe30('0x2a')](function(){return _0x3d210a;});})['then'](function(){_0x3f51e5[_0xfe30('0x24')](0xcc)[_0xfe30('0x2f')]();});}};}function handleEntityNotFound(_0x45752a,_0x2537c3){return function(_0x3053cb){if(!_0x3053cb){_0x45752a[_0xfe30('0x30')](0x194);}return _0x3053cb;};}function handleError(_0xb9691,_0x9f9e0d){_0x9f9e0d=_0x9f9e0d||0x1f4;return function(_0x4fd090){logger[_0xfe30('0x31')](_0x4fd090[_0xfe30('0x32')]);if(_0x4fd090['name']){delete _0x4fd090[_0xfe30('0x33')];}_0xb9691[_0xfe30('0x24')](_0x9f9e0d)[_0xfe30('0x34')](_0x4fd090);};}exports['index']=function(_0x5c2603,_0x1ac34f){var _0x4daf42={},_0x124b21={},_0x371362={'count':0x0,'rows':[]};var _0xb05560=_[_0xfe30('0x35')](db['CmList'][_0xfe30('0x36')],function(_0x2cae68){return{'name':_0x2cae68[_0xfe30('0x37')],'type':_0x2cae68[_0xfe30('0x38')]['key']};});_0x124b21[_0xfe30('0x39')]=_['map'](_0xb05560,'name');_0x124b21[_0xfe30('0x3a')]=_[_0xfe30('0x3b')](_0x5c2603[_0xfe30('0x3a')]);_0x124b21['filters']=_[_0xfe30('0x3c')](_0x124b21[_0xfe30('0x39')],_0x124b21[_0xfe30('0x3a')]);_0x4daf42[_0xfe30('0x3d')]=_[_0xfe30('0x3c')](_0x124b21[_0xfe30('0x39')],qs[_0xfe30('0x3e')](_0x5c2603[_0xfe30('0x3a')][_0xfe30('0x3e')]));_0x4daf42[_0xfe30('0x3d')]=_0x4daf42['attributes'][_0xfe30('0x3f')]?_0x4daf42[_0xfe30('0x3d')]:_0x124b21[_0xfe30('0x39')];if(!_0x5c2603[_0xfe30('0x3a')][_0xfe30('0x40')](_0xfe30('0x41'))){_0x4daf42['limit']=qs[_0xfe30('0x23')](_0x5c2603['query'][_0xfe30('0x23')]);_0x4daf42[_0xfe30('0x20')]=qs[_0xfe30('0x20')](_0x5c2603['query'][_0xfe30('0x20')]);}_0x4daf42[_0xfe30('0x42')]=qs['sort'](_0x5c2603[_0xfe30('0x3a')]['sort']);_0x4daf42[_0xfe30('0x43')]=qs[_0xfe30('0x44')](_[_0xfe30('0x45')](_0x5c2603[_0xfe30('0x3a')],_0x124b21[_0xfe30('0x44')]),_0xb05560);if(_0x5c2603[_0xfe30('0x3a')][_0xfe30('0x46')]){_0x4daf42[_0xfe30('0x43')]=_['merge'](_0x4daf42[_0xfe30('0x43')],{'$or':_[_0xfe30('0x35')](_0xb05560,function(_0x40caea){if(_0x40caea[_0xfe30('0x38')]!==_0xfe30('0x47')){var _0x48fb91={};_0x48fb91[_0x40caea[_0xfe30('0x33')]]={'$like':'%'+_0x5c2603['query'][_0xfe30('0x46')]+'%'};return _0x48fb91;}})});}_0x4daf42=_[_0xfe30('0x48')]({},_0x4daf42,_0x5c2603['options']);var _0x3cf362={'where':_0x4daf42['where']};return db[_0xfe30('0x49')]['count'](_0x3cf362)[_0xfe30('0x2a')](function(_0x174dfa){_0x371362[_0xfe30('0x22')]=_0x174dfa;if(_0x5c2603[_0xfe30('0x3a')][_0xfe30('0x4a')]){_0x4daf42['include']=[{'all':!![]}];}return db[_0xfe30('0x49')][_0xfe30('0x4b')](_0x4daf42);})['then'](function(_0x4ba9ce){_0x371362['rows']=_0x4ba9ce;return _0x371362;})[_0xfe30('0x2a')](respondWithFilteredResult(_0x1ac34f,_0x4daf42))['catch'](handleError(_0x1ac34f,null));};exports[_0xfe30('0x4c')]=function(_0x456636,_0x1b7c0e){var _0x446a27={'raw':![],'where':{'id':_0x456636['params']['id']}},_0x32b114={};_0x32b114[_0xfe30('0x39')]=_[_0xfe30('0x3b')](db['CmList']['rawAttributes']);_0x32b114[_0xfe30('0x3a')]=_[_0xfe30('0x3b')](_0x456636[_0xfe30('0x3a')]);_0x32b114['filters']=_['intersection'](_0x32b114[_0xfe30('0x39')],_0x32b114['query']);_0x446a27[_0xfe30('0x3d')]=_[_0xfe30('0x3c')](_0x32b114['model'],qs[_0xfe30('0x3e')](_0x456636[_0xfe30('0x3a')]['fields']));_0x446a27[_0xfe30('0x3d')]=_0x446a27[_0xfe30('0x3d')][_0xfe30('0x3f')]?_0x446a27[_0xfe30('0x3d')]:_0x32b114[_0xfe30('0x39')];if(_0x456636[_0xfe30('0x3a')][_0xfe30('0x4a')]){_0x446a27[_0xfe30('0x4d')]=[{'all':!![]}];}_0x446a27=_[_0xfe30('0x48')]({},_0x446a27,_0x456636[_0xfe30('0x4e')]);return db[_0xfe30('0x49')][_0xfe30('0x4f')](_0x446a27)['then'](handleEntityNotFound(_0x1b7c0e,null))[_0xfe30('0x2a')](respondWithResult(_0x1b7c0e,null))['catch'](handleError(_0x1b7c0e,null));};exports['create']=function(_0x399007,_0x47d4e0){return db['CmList'][_0xfe30('0x50')](_0x399007[_0xfe30('0x51')],{})[_0xfe30('0x2a')](function(_0x23bc30){var _0x4af14e=_0x399007['user'][_0xfe30('0x2c')]({'plain':!![]});if(!_0x4af14e)throw new Error(_0xfe30('0x52'));if(_0x4af14e['role']===_0xfe30('0x53')){var _0x312aef=_0x23bc30[_0xfe30('0x2c')]({'plain':!![]});var _0xe52c6b='Lists';return db['UserProfileSection'][_0xfe30('0x4f')]({'where':{'name':_0xe52c6b,'userProfileId':_0x4af14e[_0xfe30('0x54')]},'raw':!![]})['then'](function(_0x518b5a){if(_0x518b5a&&_0x518b5a[_0xfe30('0x55')]===0x0){return db[_0xfe30('0x2e')][_0xfe30('0x50')]({'name':_0x312aef[_0xfe30('0x33')],'resourceId':_0x312aef['id'],'type':_0x518b5a['name'],'sectionId':_0x518b5a['id']},{})[_0xfe30('0x2a')](function(){return _0x23bc30;});}else{return _0x23bc30;}})['catch'](function(_0x27ad0a){logger[_0xfe30('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27ad0a);throw _0x27ad0a;});}return _0x23bc30;})[_0xfe30('0x2a')](respondWithResult(_0x47d4e0,0xc9))[_0xfe30('0x56')](handleError(_0x47d4e0,null));};exports[_0xfe30('0x29')]=function(_0x359da9,_0x5ec600){if(_0x359da9[_0xfe30('0x51')]['id']){delete _0x359da9['body']['id'];}return db[_0xfe30('0x49')][_0xfe30('0x4f')]({'where':{'id':_0x359da9[_0xfe30('0x57')]['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x5ec600,null))[_0xfe30('0x2a')](saveUpdates(_0x359da9[_0xfe30('0x51')],null))[_0xfe30('0x2a')](respondWithResult(_0x5ec600,null))[_0xfe30('0x56')](handleError(_0x5ec600,null));};exports[_0xfe30('0x2b')]=function(_0x76e337,_0x283470){return db[_0xfe30('0x49')][_0xfe30('0x4f')]({'where':{'id':_0x76e337[_0xfe30('0x57')]['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x283470,null))[_0xfe30('0x2a')](removeEntity(_0x283470,null))[_0xfe30('0x56')](handleError(_0x283470,null));};exports[_0xfe30('0x58')]=function(_0x39d95e,_0x3d52c1){return db['CmList'][_0xfe30('0x58')]()[_0xfe30('0x2a')](respondWithResult(_0x3d52c1,null))[_0xfe30('0x56')](handleError(_0x3d52c1,null));};exports[_0xfe30('0x59')]=function(_0x1f74ee,_0x35210c,_0x5dd26c){if(_0x1f74ee[_0xfe30('0x51')]['id']){delete _0x1f74ee['body']['id'];}return db['CmList'][_0xfe30('0x4f')]({'where':{'id':_0x1f74ee[_0xfe30('0x57')]['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x35210c,null))[_0xfe30('0x2a')](function(_0x43766d){if(_0x43766d){_0x1f74ee[_0xfe30('0x51')][_0xfe30('0x5a')]=_0x43766d['id'];return db[_0xfe30('0x5b')][_0xfe30('0x50')](_0x1f74ee[_0xfe30('0x51')]);}})[_0xfe30('0x2a')](respondWithResult(_0x35210c,null))[_0xfe30('0x56')](handleError(_0x35210c,null));};exports[_0xfe30('0x5c')]=function(_0x4c9ac1,_0x27e868,_0x2ca1ea){var _0x469ab5={'raw':![],'where':{}};var _0xbd9e8b={};var _0xac6f63={'count':0x0,'rows':[]};return db[_0xfe30('0x49')]['findOne']({'where':{'id':_0x4c9ac1[_0xfe30('0x57')]['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x27e868,null))[_0xfe30('0x2a')](function(_0x39ca0d){if(_0x39ca0d){_0xbd9e8b[_0xfe30('0x39')]=_[_0xfe30('0x3b')](db['Disposition']['rawAttributes']);_0xbd9e8b['query']=_[_0xfe30('0x3b')](_0x4c9ac1['query']);_0xbd9e8b[_0xfe30('0x44')]=_[_0xfe30('0x3c')](_0xbd9e8b[_0xfe30('0x39')],_0xbd9e8b[_0xfe30('0x3a')]);_0x469ab5[_0xfe30('0x3d')]=_[_0xfe30('0x3c')](_0xbd9e8b[_0xfe30('0x39')],qs[_0xfe30('0x3e')](_0x4c9ac1[_0xfe30('0x3a')]['fields']));_0x469ab5[_0xfe30('0x3d')]=_0x469ab5[_0xfe30('0x3d')]['length']?_0x469ab5[_0xfe30('0x3d')]:_0xbd9e8b['model'];if(!_0x4c9ac1[_0xfe30('0x3a')]['hasOwnProperty'](_0xfe30('0x41'))){_0x469ab5['limit']=qs[_0xfe30('0x23')](_0x4c9ac1[_0xfe30('0x3a')][_0xfe30('0x23')]);_0x469ab5[_0xfe30('0x20')]=qs[_0xfe30('0x20')](_0x4c9ac1[_0xfe30('0x3a')]['offset']);}_0x469ab5['order']=qs[_0xfe30('0x5d')](_0x4c9ac1['query']['sort']);_0x469ab5[_0xfe30('0x43')]=qs[_0xfe30('0x44')](_['pick'](_0x4c9ac1[_0xfe30('0x3a')],_0xbd9e8b[_0xfe30('0x44')]));_0x469ab5[_0xfe30('0x43')]['ListId']=_0x39ca0d['id'];if(_0x4c9ac1[_0xfe30('0x3a')][_0xfe30('0x46')]){_0x469ab5[_0xfe30('0x43')]=_[_0xfe30('0x48')](_0x469ab5[_0xfe30('0x43')],{'$or':_[_0xfe30('0x35')](_0x469ab5['attributes'],function(_0x2d50e9){var _0x43e4c4={};_0x43e4c4[_0x2d50e9]={'$like':'%'+_0x4c9ac1[_0xfe30('0x3a')]['filter']+'%'};return _0x43e4c4;})});}_0x469ab5=_['merge']({},_0x469ab5,_0x4c9ac1[_0xfe30('0x4e')]);return db['Disposition'][_0xfe30('0x22')]({'where':_0x469ab5[_0xfe30('0x43')]})[_0xfe30('0x2a')](function(_0x18c55f){_0xac6f63['count']=_0x18c55f;if(_0x4c9ac1[_0xfe30('0x3a')][_0xfe30('0x4a')]){_0x469ab5[_0xfe30('0x4d')]=[{'all':!![]}];}return db[_0xfe30('0x5b')][_0xfe30('0x4b')](_0x469ab5);})[_0xfe30('0x2a')](function(_0x659774){_0xac6f63[_0xfe30('0x5e')]=_0x659774;return _0xac6f63;});}})[_0xfe30('0x2a')](respondWithFilteredResult(_0x27e868,_0x469ab5))[_0xfe30('0x56')](handleError(_0x27e868,null));};exports[_0xfe30('0x5f')]=function(_0x29ca21,_0x5bdc75,_0x2fdb67){return db[_0xfe30('0x49')][_0xfe30('0x4f')]({'where':{'id':_0x29ca21[_0xfe30('0x57')]['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x5bdc75,null))[_0xfe30('0x2a')](function(_0x17bd91){if(_0x17bd91){return _0x17bd91[_0xfe30('0x5f')](_0x29ca21[_0xfe30('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x5bdc75,null))[_0xfe30('0x56')](handleError(_0x5bdc75,null));};exports['addContacts']=function(_0x521f70,_0xf4a8f4,_0x5e4242){return db[_0xfe30('0x49')][_0xfe30('0x4f')]({'where':{'id':_0x521f70['params']['id']}})['then'](handleEntityNotFound(_0xf4a8f4,null))[_0xfe30('0x2a')](function(_0x4622de){if(_0x4622de){var _0x597731=[];var _0x5394a8={'success':[],'errors':[]};return db[_0xfe30('0x60')][_0xfe30('0x58')]()[_0xfe30('0x2a')](function(_0xcdb219){if(_0x521f70[_0xfe30('0x51')][_0xfe30('0x61')]&&_[_0xfe30('0x62')](_0x521f70[_0xfe30('0x51')][_0xfe30('0x61')])){if(_0x521f70['body'][_0xfe30('0x61')]['length']){_0x521f70['body'][_0xfe30('0x61')]=_0x521f70[_0xfe30('0x51')]['tags'][_0xfe30('0x63')](';')+';';}else{_0x521f70['body'][_0xfe30('0x61')]=null;}}else{_0x521f70[_0xfe30('0x51')][_0xfe30('0x61')]=null;}if(_0x521f70[_0xfe30('0x51')]&&_['isArray'](_0x521f70[_0xfe30('0x51')])){for(var _0x58baf8=0x0;_0x58baf8<_0x521f70[_0xfe30('0x51')][_0xfe30('0x3f')];_0x58baf8+=0x1){_0x521f70[_0xfe30('0x51')][_0x58baf8]['ListId']=_0x521f70[_0xfe30('0x57')]['id'];_0x597731[_0xfe30('0x64')](_0x521f70[_0xfe30('0x51')][_0x58baf8]);}return BPromise[_0xfe30('0x65')](_0x597731,function(_0x4ec0af){return db[_0xfe30('0x60')][_0xfe30('0x50')](_[_0xfe30('0x66')](_0x4ec0af,[_0xfe30('0x67'),'id'])||{},{'fields':_['keys'](_0xcdb219),'raw':!![]})[_0xfe30('0x2a')](function(_0xffa3de){_0x5394a8[_0xfe30('0x68')][_0xfe30('0x64')](_0xffa3de[_0xfe30('0x69')]);})[_0xfe30('0x56')](function(_0x3b833f){_0x5394a8[_0xfe30('0x6a')][_0xfe30('0x64')]({'data':_0x4ec0af,'error':_0x3b833f[_0xfe30('0x6b')]});});})[_0xfe30('0x2a')](function(_0x23b744){return _0x5394a8;})[_0xfe30('0x56')](function(_0x337075){return _0x337075;});}else{_0xf4a8f4[_0xfe30('0x24')](0x190)[_0xfe30('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xfe30('0x2a')](respondWithResult(_0xf4a8f4,null))[_0xfe30('0x56')](handleError(_0xf4a8f4,null));};exports[_0xfe30('0x6c')]=function(_0x55f3c2,_0x24bfd8,_0x4ae02e){var _0x394783;return db[_0xfe30('0x49')]['find']({'where':{'id':_0x55f3c2['params']['id']},'include':[{'model':db[_0xfe30('0x6d')],'as':_0xfe30('0x6e')}]})['then'](handleEntityNotFound(_0x24bfd8,null))[_0xfe30('0x2a')](function(_0x38f9f6){if(_0x38f9f6){_0x394783=_0x38f9f6;return db[_0xfe30('0x60')]['rawAttributes'];}})['then'](function(_0x1cb959){if(_0x1cb959){var _0x32f3b8={};var _0x5c98a1={};_0x5c98a1['model']=_[_0xfe30('0x6f')](_['keys'](_0x1cb959),_[_0xfe30('0x35')](_0x394783[_0xfe30('0x6e')],function(_0x3f551c){return util[_0xfe30('0x70')]('cf_%d',_0x3f551c['id']);}));_0x5c98a1['query']=_['keys'](_0x55f3c2[_0xfe30('0x3a')]);_0x5c98a1['filters']=_[_0xfe30('0x3c')](_0x5c98a1['model'],_0x5c98a1[_0xfe30('0x3a')]);_0x32f3b8[_0xfe30('0x3d')]=_[_0xfe30('0x3c')](_0x5c98a1[_0xfe30('0x39')],qs['fields'](_0x55f3c2[_0xfe30('0x3a')][_0xfe30('0x3e')]));_0x32f3b8[_0xfe30('0x3d')]=_0x32f3b8[_0xfe30('0x3d')][_0xfe30('0x3f')]?_0x32f3b8['attributes']:_0x5c98a1['model'];if(!_0x55f3c2[_0xfe30('0x3a')][_0xfe30('0x40')]('nolimit')){_0x32f3b8[_0xfe30('0x23')]=qs[_0xfe30('0x23')](_0x55f3c2[_0xfe30('0x3a')][_0xfe30('0x23')]);_0x32f3b8[_0xfe30('0x20')]=qs[_0xfe30('0x20')](_0x55f3c2[_0xfe30('0x3a')]['offset']);}_0x32f3b8[_0xfe30('0x42')]=qs[_0xfe30('0x5d')](_0x55f3c2[_0xfe30('0x3a')][_0xfe30('0x5d')]);_0x32f3b8[_0xfe30('0x43')]=qs['filters'](_[_0xfe30('0x45')](_0x55f3c2[_0xfe30('0x3a')],_0x5c98a1['filters']));_0x32f3b8['raw']=!![];if(_0x55f3c2['query'][_0xfe30('0x46')]){_0x32f3b8[_0xfe30('0x43')]=_[_0xfe30('0x48')](_0x32f3b8['where'],{'$or':_['map'](_0x32f3b8[_0xfe30('0x3d')],function(_0x5a278c){var _0x9d0e5c={};_0x9d0e5c[_0x5a278c]={'$like':'%'+_0x55f3c2['query']['filter']+'%'};return _0x9d0e5c;})});}_0x32f3b8=_[_0xfe30('0x48')]({},_0x32f3b8,_0x55f3c2[_0xfe30('0x4e')]);return _0x394783[_0xfe30('0x6c')](_0x32f3b8);}})['then'](respondWithResult(_0x24bfd8,null))['catch'](handleError(_0x24bfd8,null));};exports['getContactsCsv']=function(_0x1bd091,_0x130bef,_0x1e3268){var _0x36955e;return db[_0xfe30('0x49')][_0xfe30('0x4f')]({'where':{'id':_0x1bd091[_0xfe30('0x57')]['id']},'include':[{'model':db[_0xfe30('0x6d')],'as':_0xfe30('0x6e')}]})[_0xfe30('0x2a')](handleEntityNotFound(_0x130bef,null))[_0xfe30('0x2a')](function(_0x274812){if(_0x274812){_0x36955e=_0x274812;return db[_0xfe30('0x60')][_0xfe30('0x36')];}})[_0xfe30('0x2a')](function(_0x38a740){if(_0x38a740){var _0x2af465={};var _0x781fec={};_0x781fec[_0xfe30('0x39')]=_[_0xfe30('0x6f')](_[_0xfe30('0x3b')](_0x38a740),_['map'](_0x36955e['CustomFields'],function(_0x41c06b){return util[_0xfe30('0x70')](_0xfe30('0x71'),_0x41c06b['id']);}));_0x781fec[_0xfe30('0x3a')]=_[_0xfe30('0x3b')](_0x1bd091[_0xfe30('0x3a')]);_0x781fec['filters']=_[_0xfe30('0x3c')](_0x781fec[_0xfe30('0x39')],_0x781fec['query']);_0x2af465[_0xfe30('0x3d')]=_[_0xfe30('0x3c')](_0x781fec[_0xfe30('0x39')],qs[_0xfe30('0x3e')](_0x1bd091[_0xfe30('0x3a')]['fields']));_0x2af465[_0xfe30('0x3d')]=_0x2af465[_0xfe30('0x3d')][_0xfe30('0x3f')]?_0x2af465['attributes']:_0x781fec[_0xfe30('0x39')];if(!_0x1bd091[_0xfe30('0x3a')][_0xfe30('0x40')](_0xfe30('0x41'))){_0x2af465[_0xfe30('0x23')]=qs[_0xfe30('0x23')](_0x1bd091[_0xfe30('0x3a')][_0xfe30('0x23')]);_0x2af465[_0xfe30('0x20')]=qs[_0xfe30('0x20')](_0x1bd091[_0xfe30('0x3a')]['offset']);}_0x2af465[_0xfe30('0x42')]=qs[_0xfe30('0x5d')](_0x1bd091[_0xfe30('0x3a')][_0xfe30('0x5d')]);_0x2af465[_0xfe30('0x43')]=qs[_0xfe30('0x44')](_['pick'](_0x1bd091[_0xfe30('0x3a')],_0x781fec[_0xfe30('0x44')]));_0x2af465[_0xfe30('0x72')]=!![];if(_0x1bd091['query'][_0xfe30('0x46')]){_0x2af465[_0xfe30('0x43')]=_[_0xfe30('0x48')](_0x2af465['where'],{'$or':_[_0xfe30('0x35')](_0x2af465[_0xfe30('0x3d')],function(_0x4594ab){var _0x8863d4={};_0x8863d4[_0x4594ab]={'$like':'%'+_0x1bd091['query'][_0xfe30('0x46')]+'%'};return _0x8863d4;})});}_0x2af465=_[_0xfe30('0x48')]({},_0x2af465,_0x1bd091['options']);return _0x36955e[_0xfe30('0x6c')](_0x2af465);}})[_0xfe30('0x2a')](function(_0x27be20){if(!_['isEmpty'](_0x27be20)){var _0x87c670=toCsv(_0x27be20);var _0x3bd522=Date[_0xfe30('0x73')]();fs['writeFileSync'](util['format'](_0xfe30('0x74'),_0x36955e['id'],_0x3bd522),_0x87c670);_0x130bef[_0xfe30('0x75')](_0xfe30('0x76'),'attachment;\x20filename='+util[_0xfe30('0x70')](_0xfe30('0x77'),_0x36955e['id'],_0x3bd522));_0x130bef[_0xfe30('0x75')](_0xfe30('0x78'),_0xfe30('0x79'));return _0x130bef[_0xfe30('0x7a')](util[_0xfe30('0x70')]('/tmp/list_%d_%s.csv',_0x36955e['id'],_0x3bd522));}else{return _0x130bef[_0xfe30('0x30')](0xcc);}})[_0xfe30('0x56')](handleError(_0x130bef,null));};exports[_0xfe30('0x7b')]=function(_0x1489a5,_0x372787,_0x35bfd1){var _0xc0a6ac;delete _0x1489a5[_0xfe30('0x51')]['id'];return db['CmList']['findOne']({'where':{'id':_0x1489a5[_0xfe30('0x57')]['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x372787,null))['then'](function(_0x3a8871){if(_0x3a8871){return db['sequelize'][_0xfe30('0x7c')](function(_0x514253){return db['CmCustomField'][_0xfe30('0x50')](_0x1489a5[_0xfe30('0x51')],{'transaction':_0x514253})['then'](function(_0x33dcc8){_0xc0a6ac=_0x33dcc8;return _0x3a8871[_0xfe30('0x7d')](_0x33dcc8,{'transaction':_0x514253});})[_0xfe30('0x2a')](function(){var _0x456473={'type':db[_0xfe30('0x7e')]['TEXT'],'transaction':_0x514253};switch(_0x1489a5[_0xfe30('0x51')][_0xfe30('0x38')]){case'text':_0x456473[_0xfe30('0x38')]=db[_0xfe30('0x7e')]['TEXT'];break;case'number':_0x456473['type']=db[_0xfe30('0x7e')]['INTEGER'];break;case _0xfe30('0x7f'):_0x456473['type']=db[_0xfe30('0x7e')]['BOOLEAN'];_0x456473[_0xfe30('0x80')]=![];break;default:}return db[_0xfe30('0x81')][_0xfe30('0x82')]['addColumn'](_0xfe30('0x83'),util[_0xfe30('0x70')](_0xfe30('0x84'),_0xc0a6ac['id']),_0x456473);})[_0xfe30('0x2a')](function(){return _0xc0a6ac;});});}})['then'](respondWithResult(_0x372787,null))[_0xfe30('0x56')](handleError(_0x372787,null));};exports[_0xfe30('0x85')]=function(_0x45c6c9,_0x4658fb,_0xc1f57){var _0x2fe23e={};var _0x342306={};var _0x5abb1d;var _0x464eb9;return db[_0xfe30('0x49')][_0xfe30('0x86')]({'where':{'id':_0x45c6c9['params']['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x4658fb,null))['then'](function(_0x291093){if(_0x291093){_0x5abb1d=_0x291093;_0x342306['model']=_[_0xfe30('0x3b')](db[_0xfe30('0x6d')][_0xfe30('0x36')]);_0x342306[_0xfe30('0x3a')]=_[_0xfe30('0x3b')](_0x45c6c9['query']);_0x342306[_0xfe30('0x44')]=_[_0xfe30('0x3c')](_0x342306['model'],_0x342306[_0xfe30('0x3a')]);_0x2fe23e[_0xfe30('0x3d')]=_[_0xfe30('0x3c')](_0x342306[_0xfe30('0x39')],qs[_0xfe30('0x3e')](_0x45c6c9[_0xfe30('0x3a')]['fields']));_0x2fe23e[_0xfe30('0x3d')]=_0x2fe23e[_0xfe30('0x3d')]['length']?_0x2fe23e[_0xfe30('0x3d')]:_0x342306[_0xfe30('0x39')];_0x2fe23e[_0xfe30('0x42')]=qs[_0xfe30('0x5d')](_0x45c6c9[_0xfe30('0x3a')][_0xfe30('0x5d')]);_0x2fe23e['where']=qs['filters'](_[_0xfe30('0x45')](_0x45c6c9[_0xfe30('0x3a')],_0x342306[_0xfe30('0x44')]));_0x2fe23e[_0xfe30('0x43')]=_[_0xfe30('0x48')](_0x2fe23e['where'],{'$or':[{'ListId':_0x291093['id']},{'ListId':null}]});if(_0x45c6c9[_0xfe30('0x3a')]['filter']){_0x2fe23e['where']=_[_0xfe30('0x48')](_0x2fe23e[_0xfe30('0x43')],{'$or':_[_0xfe30('0x35')](_0x2fe23e[_0xfe30('0x3d')],function(_0xd0662f){var _0xde313d={};_0xde313d[_0xd0662f]={'$like':'%'+_0x45c6c9['query']['filter']+'%'};return _0xde313d;})});}_0x2fe23e=_[_0xfe30('0x48')]({},_0x2fe23e,_0x45c6c9['options']);return db['CmCustomField'][_0xfe30('0x87')](_0x2fe23e);}})['then'](respondWithResult(_0x4658fb,null))[_0xfe30('0x56')](handleError(_0x4658fb,null));};exports[_0xfe30('0x88')]=function(_0x1d249d,_0x4a334f,_0x68528e){return db['CmList'][_0xfe30('0x4f')]({'where':{'id':_0x1d249d[_0xfe30('0x57')]['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x4a334f,null))[_0xfe30('0x2a')](function(_0x2eba09){if(_0x2eba09){return _0x2eba09[_0xfe30('0x88')](_0x1d249d[_0xfe30('0x51')][_0xfe30('0x67')],_[_0xfe30('0x66')](_0x1d249d[_0xfe30('0x51')],[_0xfe30('0x67'),'id'])||{})[_0xfe30('0x89')](function(_0x1a2375){for(var _0x502d88=0x0;_0x502d88<_0x1d249d[_0xfe30('0x51')][_0xfe30('0x67')][_0xfe30('0x3f')];_0x502d88+=0x1){socket['emit'](_0xfe30('0x8a'),{'UserId':Number(_0x1d249d['body'][_0xfe30('0x67')][_0x502d88]),'CmListId':Number(_0x1d249d['params']['id'])});}return _0x1a2375;});}})[_0xfe30('0x2a')](respondWithResult(_0x4a334f,null))[_0xfe30('0x56')](handleError(_0x4a334f,null));};exports['removeAgents']=function(_0x9eef16,_0x35a7b0,_0x35b86e){return db['CmList'][_0xfe30('0x4f')]({'where':{'id':_0x9eef16[_0xfe30('0x57')]['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x35a7b0,null))[_0xfe30('0x2a')](function(_0x4d3aca){if(_0x4d3aca){return _0x4d3aca['removeAgents'](_0x9eef16[_0xfe30('0x3a')][_0xfe30('0x67')])[_0xfe30('0x2a')](function(){if(_[_0xfe30('0x62')](_0x9eef16['query']['ids'])){for(var _0x3aeb08=0x0;_0x3aeb08<_0x9eef16[_0xfe30('0x3a')]['ids'][_0xfe30('0x3f')];_0x3aeb08+=0x1){socket['emit'](_0xfe30('0x8b'),{'UserId':Number(_0x9eef16[_0xfe30('0x3a')][_0xfe30('0x67')][_0x3aeb08]),'CmListId':Number(_0x9eef16['params']['id'])});}}else{socket[_0xfe30('0x8c')](_0xfe30('0x8b'),{'UserId':Number(_0x9eef16[_0xfe30('0x3a')]['ids']),'CmListId':Number(_0x9eef16[_0xfe30('0x57')]['id'])});}});}})[_0xfe30('0x2a')](respondWithStatusCode(_0x35a7b0,null))[_0xfe30('0x56')](handleError(_0x35a7b0,null));};exports[_0xfe30('0x8d')]=function(_0xdbe1dc,_0x756d59,_0x1b699b){var _0x206195={};var _0x2849d8={};var _0x16a5c3;var _0x14743c;return db['CmList'][_0xfe30('0x86')]({'where':{'id':_0xdbe1dc[_0xfe30('0x57')]['id']}})[_0xfe30('0x2a')](handleEntityNotFound(_0x756d59,null))[_0xfe30('0x2a')](function(_0x1cfa93){if(_0x1cfa93){_0x16a5c3=_0x1cfa93;_0x2849d8['model']=_[_0xfe30('0x3b')](db[_0xfe30('0x8e')][_0xfe30('0x36')]);_0x2849d8[_0xfe30('0x3a')]=_[_0xfe30('0x3b')](_0xdbe1dc['query']);_0x2849d8[_0xfe30('0x44')]=_['intersection'](_0x2849d8[_0xfe30('0x39')],_0x2849d8[_0xfe30('0x3a')]);_0x206195[_0xfe30('0x3d')]=_['intersection'](_0x2849d8['model'],qs['fields'](_0xdbe1dc[_0xfe30('0x3a')][_0xfe30('0x3e')]));_0x206195[_0xfe30('0x3d')]=_0x206195[_0xfe30('0x3d')][_0xfe30('0x3f')]?_0x206195[_0xfe30('0x3d')]:_0x2849d8[_0xfe30('0x39')];_0x206195['order']=qs['sort'](_0xdbe1dc[_0xfe30('0x3a')][_0xfe30('0x5d')]);_0x206195['where']=qs[_0xfe30('0x44')](_['pick'](_0xdbe1dc[_0xfe30('0x3a')],_0x2849d8['filters']));if(_0xdbe1dc[_0xfe30('0x3a')][_0xfe30('0x46')]){_0x206195[_0xfe30('0x43')]=_['merge'](_0x206195[_0xfe30('0x43')],{'$or':_[_0xfe30('0x35')](_0x206195[_0xfe30('0x3d')],function(_0x35da22){var _0x35efc2={};_0x35efc2[_0x35da22]={'$like':'%'+_0xdbe1dc[_0xfe30('0x3a')][_0xfe30('0x46')]+'%'};return _0x35efc2;})});}_0x206195=_[_0xfe30('0x48')]({},_0x206195,_0xdbe1dc['options']);return _0x16a5c3[_0xfe30('0x8d')](_0x206195);}})[_0xfe30('0x2a')](function(_0x253ee8){if(_0x253ee8){_0x14743c=_0x253ee8['length'];if(!_0xdbe1dc[_0xfe30('0x3a')]['hasOwnProperty'](_0xfe30('0x41'))){_0x206195['limit']=qs[_0xfe30('0x23')](_0xdbe1dc[_0xfe30('0x3a')][_0xfe30('0x23')]);_0x206195[_0xfe30('0x20')]=qs[_0xfe30('0x20')](_0xdbe1dc['query'][_0xfe30('0x20')]);}return _0x16a5c3['getAgents'](_0x206195);}})[_0xfe30('0x2a')](function(_0x2bd811){if(_0x2bd811){return _0x2bd811?{'count':_0x14743c,'rows':_0x2bd811}:null;}})[_0xfe30('0x2a')](respondWithResult(_0x756d59,null))[_0xfe30('0x56')](handleError(_0x756d59,null));}; \ No newline at end of file +var _0xebf1=['bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','status','end','json','limit','undefined','offset','count','set','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','CmList','rawAttributes','fieldName','type','model','map','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','Disposition','pick','removeDispositions','ids','tags','join','isArray','push','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','CmContact','format','cf_%d','raw','CmCustomField','concat','hasOwnProperty','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','download','findOne','sequelize','transaction','Sequelize','TEXT','text','number','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xebf1,0x1a0));var _0x1ebf=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0xebf1[_0x154983];return _0x3d1243;};'use strict';var emlformat=require(_0x1ebf('0x0'));var rimraf=require(_0x1ebf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ebf('0x2'));var rp=require(_0x1ebf('0x3'));var moment=require('moment');var BPromise=require(_0x1ebf('0x4'));var Mustache=require(_0x1ebf('0x5'));var util=require(_0x1ebf('0x6'));var path=require('path');var sox=require(_0x1ebf('0x7'));var csv=require('to-csv');var ejs=require(_0x1ebf('0x8'));var fs=require('fs');var fs_extra=require(_0x1ebf('0x9'));var _=require(_0x1ebf('0xa'));var squel=require(_0x1ebf('0xb'));var crypto=require('crypto');var jsforce=require(_0x1ebf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1ebf('0xd'));var querystring=require('querystring');var Papa=require(_0x1ebf('0xe'));var Redis=require(_0x1ebf('0xf'));var authService=require(_0x1ebf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1ebf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1ebf('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1ebf('0x13'));var db=require(_0x1ebf('0x14'))['db'];config[_0x1ebf('0x15')]=_['defaults'](config[_0x1ebf('0x15')],{'host':_0x1ebf('0x16'),'port':0x18eb});var socket=require(_0x1ebf('0x17'))(new Redis(config[_0x1ebf('0x15')]));require(_0x1ebf('0x18'))['register'](socket);function respondWithStatusCode(_0x2a6e26,_0xa8c4b9){_0xa8c4b9=_0xa8c4b9||0xcc;return function(_0x4cdd92){if(_0x4cdd92){return _0x2a6e26['sendStatus'](_0xa8c4b9);}return _0x2a6e26[_0x1ebf('0x19')](_0xa8c4b9)[_0x1ebf('0x1a')]();};}function respondWithResult(_0x1f6664,_0x182372){_0x182372=_0x182372||0xc8;return function(_0x1c7c0b){if(_0x1c7c0b){return _0x1f6664['status'](_0x182372)[_0x1ebf('0x1b')](_0x1c7c0b);}};}function respondWithFilteredResult(_0x5dbbb8,_0x57d971){return function(_0x5aa612){if(_0x5aa612){var _0x33e5c3=typeof _0x57d971['offset']==='undefined'&&typeof _0x57d971[_0x1ebf('0x1c')]===_0x1ebf('0x1d');var _0x38ac87=_0x5aa612['count'];var _0x14917f=_0x33e5c3?0x0:_0x57d971[_0x1ebf('0x1e')];var _0x374893=_0x33e5c3?_0x5aa612[_0x1ebf('0x1f')]:_0x57d971['offset']+_0x57d971['limit'];var _0x4eaf85;if(_0x374893>=_0x38ac87){_0x374893=_0x38ac87;_0x4eaf85=0xc8;}else{_0x4eaf85=0xce;}_0x5dbbb8[_0x1ebf('0x19')](_0x4eaf85);return _0x5dbbb8[_0x1ebf('0x20')]('Content-Range',_0x14917f+'-'+_0x374893+'/'+_0x38ac87)['json'](_0x5aa612);}return null;};}function patchUpdates(_0x21072b){return function(_0x4c5adf){try{jsonpatch[_0x1ebf('0x21')](_0x4c5adf,_0x21072b,!![]);}catch(_0x37cd7f){return BPromise[_0x1ebf('0x22')](_0x37cd7f);}return _0x4c5adf[_0x1ebf('0x23')]();};}function saveUpdates(_0x5332f3,_0x53dc7e){return function(_0x4008f8){if(_0x4008f8){return _0x4008f8[_0x1ebf('0x24')](_0x5332f3)[_0x1ebf('0x25')](function(_0x4ddfcf){return _0x4ddfcf;});}return null;};}function removeEntity(_0x254b86,_0x4fdf03){return function(_0x39849d){if(_0x39849d){return _0x39849d[_0x1ebf('0x26')]()[_0x1ebf('0x25')](function(){var _0x19ec80=_0x39849d[_0x1ebf('0x27')]({'plain':!![]});var _0x347c29=_0x1ebf('0x28');return db[_0x1ebf('0x29')][_0x1ebf('0x26')]({'where':{'type':_0x347c29,'resourceId':_0x19ec80['id']}})[_0x1ebf('0x25')](function(){return _0x39849d;});})[_0x1ebf('0x25')](function(){_0x254b86[_0x1ebf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb5b9f8,_0x241329){return function(_0x465fdb){if(!_0x465fdb){_0xb5b9f8[_0x1ebf('0x2a')](0x194);}return _0x465fdb;};}function handleError(_0x2bd087,_0x2d27c6){_0x2d27c6=_0x2d27c6||0x1f4;return function(_0x34d047){logger[_0x1ebf('0x2b')](_0x34d047[_0x1ebf('0x2c')]);if(_0x34d047[_0x1ebf('0x2d')]){delete _0x34d047['name'];}_0x2bd087[_0x1ebf('0x19')](_0x2d27c6)[_0x1ebf('0x2e')](_0x34d047);};}exports['index']=function(_0x48f479,_0x5b64e8){var _0x121cdc={},_0x5d907f={},_0xed39c1={'count':0x0,'rows':[]};var _0x29c68e=_['map'](db[_0x1ebf('0x2f')][_0x1ebf('0x30')],function(_0x2452c9){return{'name':_0x2452c9[_0x1ebf('0x31')],'type':_0x2452c9[_0x1ebf('0x32')]['key']};});_0x5d907f[_0x1ebf('0x33')]=_[_0x1ebf('0x34')](_0x29c68e,_0x1ebf('0x2d'));_0x5d907f['query']=_[_0x1ebf('0x35')](_0x48f479[_0x1ebf('0x36')]);_0x5d907f['filters']=_[_0x1ebf('0x37')](_0x5d907f[_0x1ebf('0x33')],_0x5d907f[_0x1ebf('0x36')]);_0x121cdc['attributes']=_['intersection'](_0x5d907f[_0x1ebf('0x33')],qs[_0x1ebf('0x38')](_0x48f479['query'][_0x1ebf('0x38')]));_0x121cdc[_0x1ebf('0x39')]=_0x121cdc['attributes'][_0x1ebf('0x3a')]?_0x121cdc[_0x1ebf('0x39')]:_0x5d907f[_0x1ebf('0x33')];if(!_0x48f479['query']['hasOwnProperty'](_0x1ebf('0x3b'))){_0x121cdc[_0x1ebf('0x1c')]=qs[_0x1ebf('0x1c')](_0x48f479['query'][_0x1ebf('0x1c')]);_0x121cdc[_0x1ebf('0x1e')]=qs[_0x1ebf('0x1e')](_0x48f479[_0x1ebf('0x36')][_0x1ebf('0x1e')]);}_0x121cdc[_0x1ebf('0x3c')]=qs['sort'](_0x48f479['query'][_0x1ebf('0x3d')]);_0x121cdc[_0x1ebf('0x3e')]=qs[_0x1ebf('0x3f')](_['pick'](_0x48f479['query'],_0x5d907f[_0x1ebf('0x3f')]),_0x29c68e);if(_0x48f479[_0x1ebf('0x36')][_0x1ebf('0x40')]){_0x121cdc[_0x1ebf('0x3e')]=_[_0x1ebf('0x41')](_0x121cdc[_0x1ebf('0x3e')],{'$or':_[_0x1ebf('0x34')](_0x29c68e,function(_0x252d42){if(_0x252d42['type']!==_0x1ebf('0x42')){var _0xd5ec57={};_0xd5ec57[_0x252d42[_0x1ebf('0x2d')]]={'$like':'%'+_0x48f479[_0x1ebf('0x36')][_0x1ebf('0x40')]+'%'};return _0xd5ec57;}})});}_0x121cdc=_[_0x1ebf('0x41')]({},_0x121cdc,_0x48f479[_0x1ebf('0x43')]);var _0x240a03={'where':_0x121cdc['where']};return db['CmList'][_0x1ebf('0x1f')](_0x240a03)['then'](function(_0x41c06c){_0xed39c1[_0x1ebf('0x1f')]=_0x41c06c;if(_0x48f479[_0x1ebf('0x36')][_0x1ebf('0x44')]){_0x121cdc[_0x1ebf('0x45')]=[{'all':!![]}];}return db[_0x1ebf('0x2f')]['findAll'](_0x121cdc);})[_0x1ebf('0x25')](function(_0x253c71){_0xed39c1[_0x1ebf('0x46')]=_0x253c71;return _0xed39c1;})[_0x1ebf('0x25')](respondWithFilteredResult(_0x5b64e8,_0x121cdc))[_0x1ebf('0x47')](handleError(_0x5b64e8,null));};exports[_0x1ebf('0x48')]=function(_0x35289a,_0x41d744){var _0x69272c={'raw':![],'where':{'id':_0x35289a[_0x1ebf('0x49')]['id']}},_0x221829={};_0x221829[_0x1ebf('0x33')]=_['keys'](db['CmList'][_0x1ebf('0x30')]);_0x221829['query']=_[_0x1ebf('0x35')](_0x35289a[_0x1ebf('0x36')]);_0x221829['filters']=_['intersection'](_0x221829[_0x1ebf('0x33')],_0x221829[_0x1ebf('0x36')]);_0x69272c[_0x1ebf('0x39')]=_[_0x1ebf('0x37')](_0x221829[_0x1ebf('0x33')],qs[_0x1ebf('0x38')](_0x35289a[_0x1ebf('0x36')][_0x1ebf('0x38')]));_0x69272c[_0x1ebf('0x39')]=_0x69272c[_0x1ebf('0x39')][_0x1ebf('0x3a')]?_0x69272c['attributes']:_0x221829['model'];if(_0x35289a[_0x1ebf('0x36')][_0x1ebf('0x44')]){_0x69272c[_0x1ebf('0x45')]=[{'all':!![]}];}_0x69272c=_[_0x1ebf('0x41')]({},_0x69272c,_0x35289a['options']);return db[_0x1ebf('0x2f')][_0x1ebf('0x4a')](_0x69272c)[_0x1ebf('0x25')](handleEntityNotFound(_0x41d744,null))[_0x1ebf('0x25')](respondWithResult(_0x41d744,null))[_0x1ebf('0x47')](handleError(_0x41d744,null));};exports[_0x1ebf('0x4b')]=function(_0x99c96b,_0x3169c0){return db['CmList'][_0x1ebf('0x4b')](_0x99c96b[_0x1ebf('0x4c')],{})['then'](function(_0x23b629){var _0x6d8b27=_0x99c96b[_0x1ebf('0x4d')][_0x1ebf('0x27')]({'plain':!![]});if(!_0x6d8b27)throw new Error(_0x1ebf('0x4e'));if(_0x6d8b27[_0x1ebf('0x4f')]===_0x1ebf('0x4d')){var _0x3ac232=_0x23b629[_0x1ebf('0x27')]({'plain':!![]});var _0xc8e034=_0x1ebf('0x28');return db['UserProfileSection'][_0x1ebf('0x4a')]({'where':{'name':_0xc8e034,'userProfileId':_0x6d8b27[_0x1ebf('0x50')]},'raw':!![]})[_0x1ebf('0x25')](function(_0x4cfd9c){if(_0x4cfd9c&&_0x4cfd9c[_0x1ebf('0x51')]===0x0){return db[_0x1ebf('0x29')][_0x1ebf('0x4b')]({'name':_0x3ac232[_0x1ebf('0x2d')],'resourceId':_0x3ac232['id'],'type':_0x4cfd9c[_0x1ebf('0x2d')],'sectionId':_0x4cfd9c['id']},{})['then'](function(){return _0x23b629;});}else{return _0x23b629;}})['catch'](function(_0x57af07){logger[_0x1ebf('0x2b')](_0x1ebf('0x52'),_0x57af07);throw _0x57af07;});}return _0x23b629;})[_0x1ebf('0x25')](respondWithResult(_0x3169c0,0xc9))[_0x1ebf('0x47')](handleError(_0x3169c0,null));};exports[_0x1ebf('0x24')]=function(_0x1acdff,_0x254c44){if(_0x1acdff[_0x1ebf('0x4c')]['id']){delete _0x1acdff[_0x1ebf('0x4c')]['id'];}return db[_0x1ebf('0x2f')][_0x1ebf('0x4a')]({'where':{'id':_0x1acdff[_0x1ebf('0x49')]['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x254c44,null))['then'](saveUpdates(_0x1acdff[_0x1ebf('0x4c')],null))['then'](respondWithResult(_0x254c44,null))[_0x1ebf('0x47')](handleError(_0x254c44,null));};exports[_0x1ebf('0x26')]=function(_0x1631f0,_0x2a622f){return db[_0x1ebf('0x2f')]['find']({'where':{'id':_0x1631f0[_0x1ebf('0x49')]['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x2a622f,null))['then'](removeEntity(_0x2a622f,null))[_0x1ebf('0x47')](handleError(_0x2a622f,null));};exports[_0x1ebf('0x53')]=function(_0xd8f402,_0x4fe18d){return db[_0x1ebf('0x2f')]['describe']()[_0x1ebf('0x25')](respondWithResult(_0x4fe18d,null))['catch'](handleError(_0x4fe18d,null));};exports[_0x1ebf('0x54')]=function(_0x51b7f9,_0x4cdff6,_0x54acfa){if(_0x51b7f9['body']['id']){delete _0x51b7f9[_0x1ebf('0x4c')]['id'];}return db['CmList']['find']({'where':{'id':_0x51b7f9[_0x1ebf('0x49')]['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x4cdff6,null))[_0x1ebf('0x25')](function(_0x22d7f7){if(_0x22d7f7){_0x51b7f9['body'][_0x1ebf('0x55')]=_0x22d7f7['id'];return db['Disposition']['create'](_0x51b7f9[_0x1ebf('0x4c')]);}})[_0x1ebf('0x25')](respondWithResult(_0x4cdff6,null))[_0x1ebf('0x47')](handleError(_0x4cdff6,null));};exports[_0x1ebf('0x56')]=function(_0x13b2d6,_0x56fb65,_0x264a06){var _0x3be01a={'raw':![],'where':{}};var _0x133b33={};var _0x19942d={'count':0x0,'rows':[]};return db[_0x1ebf('0x2f')]['findOne']({'where':{'id':_0x13b2d6[_0x1ebf('0x49')]['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x56fb65,null))[_0x1ebf('0x25')](function(_0x225b93){if(_0x225b93){_0x133b33[_0x1ebf('0x33')]=_[_0x1ebf('0x35')](db[_0x1ebf('0x57')][_0x1ebf('0x30')]);_0x133b33[_0x1ebf('0x36')]=_[_0x1ebf('0x35')](_0x13b2d6['query']);_0x133b33['filters']=_[_0x1ebf('0x37')](_0x133b33[_0x1ebf('0x33')],_0x133b33['query']);_0x3be01a[_0x1ebf('0x39')]=_[_0x1ebf('0x37')](_0x133b33[_0x1ebf('0x33')],qs[_0x1ebf('0x38')](_0x13b2d6['query'][_0x1ebf('0x38')]));_0x3be01a[_0x1ebf('0x39')]=_0x3be01a[_0x1ebf('0x39')]['length']?_0x3be01a[_0x1ebf('0x39')]:_0x133b33[_0x1ebf('0x33')];if(!_0x13b2d6[_0x1ebf('0x36')]['hasOwnProperty'](_0x1ebf('0x3b'))){_0x3be01a[_0x1ebf('0x1c')]=qs[_0x1ebf('0x1c')](_0x13b2d6[_0x1ebf('0x36')][_0x1ebf('0x1c')]);_0x3be01a[_0x1ebf('0x1e')]=qs[_0x1ebf('0x1e')](_0x13b2d6['query']['offset']);}_0x3be01a['order']=qs[_0x1ebf('0x3d')](_0x13b2d6[_0x1ebf('0x36')][_0x1ebf('0x3d')]);_0x3be01a[_0x1ebf('0x3e')]=qs['filters'](_[_0x1ebf('0x58')](_0x13b2d6[_0x1ebf('0x36')],_0x133b33[_0x1ebf('0x3f')]));_0x3be01a[_0x1ebf('0x3e')][_0x1ebf('0x55')]=_0x225b93['id'];if(_0x13b2d6[_0x1ebf('0x36')][_0x1ebf('0x40')]){_0x3be01a[_0x1ebf('0x3e')]=_[_0x1ebf('0x41')](_0x3be01a[_0x1ebf('0x3e')],{'$or':_[_0x1ebf('0x34')](_0x3be01a[_0x1ebf('0x39')],function(_0x5e626f){var _0x2e919a={};_0x2e919a[_0x5e626f]={'$like':'%'+_0x13b2d6[_0x1ebf('0x36')][_0x1ebf('0x40')]+'%'};return _0x2e919a;})});}_0x3be01a=_[_0x1ebf('0x41')]({},_0x3be01a,_0x13b2d6['options']);return db['Disposition'][_0x1ebf('0x1f')]({'where':_0x3be01a[_0x1ebf('0x3e')]})['then'](function(_0x5e7533){_0x19942d[_0x1ebf('0x1f')]=_0x5e7533;if(_0x13b2d6[_0x1ebf('0x36')][_0x1ebf('0x44')]){_0x3be01a[_0x1ebf('0x45')]=[{'all':!![]}];}return db[_0x1ebf('0x57')]['findAll'](_0x3be01a);})[_0x1ebf('0x25')](function(_0x49f259){_0x19942d[_0x1ebf('0x46')]=_0x49f259;return _0x19942d;});}})[_0x1ebf('0x25')](respondWithFilteredResult(_0x56fb65,_0x3be01a))[_0x1ebf('0x47')](handleError(_0x56fb65,null));};exports['removeDispositions']=function(_0x5b5e21,_0x2860af,_0x105528){return db[_0x1ebf('0x2f')]['find']({'where':{'id':_0x5b5e21[_0x1ebf('0x49')]['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x2860af,null))[_0x1ebf('0x25')](function(_0x3c82d0){if(_0x3c82d0){return _0x3c82d0[_0x1ebf('0x59')](_0x5b5e21[_0x1ebf('0x36')][_0x1ebf('0x5a')]);}})[_0x1ebf('0x25')](respondWithStatusCode(_0x2860af,null))[_0x1ebf('0x47')](handleError(_0x2860af,null));};exports['addContacts']=function(_0x1e5df0,_0x51dfb9,_0x178075){return db['CmList'][_0x1ebf('0x4a')]({'where':{'id':_0x1e5df0[_0x1ebf('0x49')]['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x51dfb9,null))['then'](function(_0x1960a3){if(_0x1960a3){var _0x3cb6af=[];var _0x499a56={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x1ebf('0x25')](function(_0x542b1e){if(_0x1e5df0['body']['tags']&&_['isArray'](_0x1e5df0[_0x1ebf('0x4c')]['tags'])){if(_0x1e5df0['body'][_0x1ebf('0x5b')][_0x1ebf('0x3a')]){_0x1e5df0[_0x1ebf('0x4c')]['tags']=_0x1e5df0[_0x1ebf('0x4c')][_0x1ebf('0x5b')][_0x1ebf('0x5c')](';')+';';}else{_0x1e5df0['body']['tags']=null;}}else{_0x1e5df0['body']['tags']=null;}if(_0x1e5df0[_0x1ebf('0x4c')]&&_[_0x1ebf('0x5d')](_0x1e5df0['body'])){for(var _0x4e9850=0x0;_0x4e9850<_0x1e5df0[_0x1ebf('0x4c')][_0x1ebf('0x3a')];_0x4e9850+=0x1){_0x1e5df0[_0x1ebf('0x4c')][_0x4e9850][_0x1ebf('0x55')]=_0x1e5df0[_0x1ebf('0x49')]['id'];_0x3cb6af[_0x1ebf('0x5e')](_0x1e5df0['body'][_0x4e9850]);}return BPromise['each'](_0x3cb6af,function(_0x3dcd39){return db['CmContact'][_0x1ebf('0x4b')](_['omit'](_0x3dcd39,['ids','id'])||{},{'fields':_[_0x1ebf('0x35')](_0x542b1e),'raw':!![]})[_0x1ebf('0x25')](function(_0x5a7f38){_0x499a56[_0x1ebf('0x5f')]['push'](_0x5a7f38[_0x1ebf('0x60')]);})['catch'](function(_0x2cb012){_0x499a56[_0x1ebf('0x61')][_0x1ebf('0x5e')]({'data':_0x3dcd39,'error':_0x2cb012['message']});});})[_0x1ebf('0x25')](function(_0x490471){return _0x499a56;})[_0x1ebf('0x47')](function(_0x1d0287){return _0x1d0287;});}else{_0x51dfb9[_0x1ebf('0x19')](0x190)[_0x1ebf('0x1b')]({'message':_0x1ebf('0x62')});}});}})[_0x1ebf('0x25')](respondWithResult(_0x51dfb9,null))[_0x1ebf('0x47')](handleError(_0x51dfb9,null));};exports[_0x1ebf('0x63')]=function(_0x558c5a,_0x59b712,_0x32b993){var _0xab692b;return db[_0x1ebf('0x2f')][_0x1ebf('0x4a')]({'where':{'id':_0x558c5a[_0x1ebf('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x1ebf('0x64')}]})['then'](handleEntityNotFound(_0x59b712,null))[_0x1ebf('0x25')](function(_0x4ba86b){if(_0x4ba86b){_0xab692b=_0x4ba86b;return db[_0x1ebf('0x65')]['rawAttributes'];}})[_0x1ebf('0x25')](function(_0xc7d02e){if(_0xc7d02e){var _0x3905cf={};var _0x1dc56c={};_0x1dc56c[_0x1ebf('0x33')]=_['concat'](_[_0x1ebf('0x35')](_0xc7d02e),_[_0x1ebf('0x34')](_0xab692b['CustomFields'],function(_0x2d7b19){return util[_0x1ebf('0x66')](_0x1ebf('0x67'),_0x2d7b19['id']);}));_0x1dc56c[_0x1ebf('0x36')]=_[_0x1ebf('0x35')](_0x558c5a[_0x1ebf('0x36')]);_0x1dc56c[_0x1ebf('0x3f')]=_['intersection'](_0x1dc56c[_0x1ebf('0x33')],_0x1dc56c[_0x1ebf('0x36')]);_0x3905cf[_0x1ebf('0x39')]=_['intersection'](_0x1dc56c[_0x1ebf('0x33')],qs[_0x1ebf('0x38')](_0x558c5a[_0x1ebf('0x36')][_0x1ebf('0x38')]));_0x3905cf[_0x1ebf('0x39')]=_0x3905cf[_0x1ebf('0x39')][_0x1ebf('0x3a')]?_0x3905cf[_0x1ebf('0x39')]:_0x1dc56c[_0x1ebf('0x33')];if(!_0x558c5a[_0x1ebf('0x36')]['hasOwnProperty']('nolimit')){_0x3905cf[_0x1ebf('0x1c')]=qs['limit'](_0x558c5a['query'][_0x1ebf('0x1c')]);_0x3905cf[_0x1ebf('0x1e')]=qs[_0x1ebf('0x1e')](_0x558c5a['query']['offset']);}_0x3905cf[_0x1ebf('0x3c')]=qs[_0x1ebf('0x3d')](_0x558c5a[_0x1ebf('0x36')][_0x1ebf('0x3d')]);_0x3905cf[_0x1ebf('0x3e')]=qs[_0x1ebf('0x3f')](_['pick'](_0x558c5a[_0x1ebf('0x36')],_0x1dc56c[_0x1ebf('0x3f')]));_0x3905cf[_0x1ebf('0x68')]=!![];if(_0x558c5a['query'][_0x1ebf('0x40')]){_0x3905cf[_0x1ebf('0x3e')]=_[_0x1ebf('0x41')](_0x3905cf[_0x1ebf('0x3e')],{'$or':_[_0x1ebf('0x34')](_0x3905cf['attributes'],function(_0x7bb1){var _0x24e0e4={};_0x24e0e4[_0x7bb1]={'$like':'%'+_0x558c5a['query']['filter']+'%'};return _0x24e0e4;})});}_0x3905cf=_[_0x1ebf('0x41')]({},_0x3905cf,_0x558c5a[_0x1ebf('0x43')]);return _0xab692b[_0x1ebf('0x63')](_0x3905cf);}})[_0x1ebf('0x25')](respondWithResult(_0x59b712,null))[_0x1ebf('0x47')](handleError(_0x59b712,null));};exports['getContactsCsv']=function(_0x19a0ad,_0x57c012,_0x2282b3){var _0x12e5fb;return db[_0x1ebf('0x2f')][_0x1ebf('0x4a')]({'where':{'id':_0x19a0ad['params']['id']},'include':[{'model':db[_0x1ebf('0x69')],'as':_0x1ebf('0x64')}]})['then'](handleEntityNotFound(_0x57c012,null))['then'](function(_0x1bfe48){if(_0x1bfe48){_0x12e5fb=_0x1bfe48;return db[_0x1ebf('0x65')][_0x1ebf('0x30')];}})[_0x1ebf('0x25')](function(_0x4f6244){if(_0x4f6244){var _0x363a5a={};var _0x5c6236={};_0x5c6236[_0x1ebf('0x33')]=_[_0x1ebf('0x6a')](_[_0x1ebf('0x35')](_0x4f6244),_['map'](_0x12e5fb[_0x1ebf('0x64')],function(_0x48ccf3){return util['format'](_0x1ebf('0x67'),_0x48ccf3['id']);}));_0x5c6236['query']=_['keys'](_0x19a0ad[_0x1ebf('0x36')]);_0x5c6236[_0x1ebf('0x3f')]=_[_0x1ebf('0x37')](_0x5c6236[_0x1ebf('0x33')],_0x5c6236[_0x1ebf('0x36')]);_0x363a5a[_0x1ebf('0x39')]=_['intersection'](_0x5c6236[_0x1ebf('0x33')],qs[_0x1ebf('0x38')](_0x19a0ad['query'][_0x1ebf('0x38')]));_0x363a5a[_0x1ebf('0x39')]=_0x363a5a[_0x1ebf('0x39')][_0x1ebf('0x3a')]?_0x363a5a[_0x1ebf('0x39')]:_0x5c6236[_0x1ebf('0x33')];if(!_0x19a0ad[_0x1ebf('0x36')][_0x1ebf('0x6b')](_0x1ebf('0x3b'))){_0x363a5a['limit']=qs[_0x1ebf('0x1c')](_0x19a0ad['query']['limit']);_0x363a5a['offset']=qs[_0x1ebf('0x1e')](_0x19a0ad[_0x1ebf('0x36')][_0x1ebf('0x1e')]);}_0x363a5a[_0x1ebf('0x3c')]=qs['sort'](_0x19a0ad[_0x1ebf('0x36')][_0x1ebf('0x3d')]);_0x363a5a[_0x1ebf('0x3e')]=qs[_0x1ebf('0x3f')](_[_0x1ebf('0x58')](_0x19a0ad[_0x1ebf('0x36')],_0x5c6236['filters']));_0x363a5a[_0x1ebf('0x68')]=!![];if(_0x19a0ad[_0x1ebf('0x36')][_0x1ebf('0x40')]){_0x363a5a[_0x1ebf('0x3e')]=_['merge'](_0x363a5a[_0x1ebf('0x3e')],{'$or':_[_0x1ebf('0x34')](_0x363a5a[_0x1ebf('0x39')],function(_0x118a74){var _0x1cd5a8={};_0x1cd5a8[_0x118a74]={'$like':'%'+_0x19a0ad[_0x1ebf('0x36')]['filter']+'%'};return _0x1cd5a8;})});}_0x363a5a=_[_0x1ebf('0x41')]({},_0x363a5a,_0x19a0ad[_0x1ebf('0x43')]);return _0x12e5fb[_0x1ebf('0x63')](_0x363a5a);}})['then'](function(_0x205c76){if(!_[_0x1ebf('0x6c')](_0x205c76)){var _0x8622f9=toCsv(_0x205c76);var _0x5d57e0=Date[_0x1ebf('0x6d')]();fs[_0x1ebf('0x6e')](util[_0x1ebf('0x66')](_0x1ebf('0x6f'),_0x12e5fb['id'],_0x5d57e0),_0x8622f9);_0x57c012['setHeader']('Content-disposition',_0x1ebf('0x70')+util[_0x1ebf('0x66')](_0x1ebf('0x71'),_0x12e5fb['id'],_0x5d57e0));_0x57c012[_0x1ebf('0x72')](_0x1ebf('0x73'),'text/csv');return _0x57c012[_0x1ebf('0x74')](util[_0x1ebf('0x66')](_0x1ebf('0x6f'),_0x12e5fb['id'],_0x5d57e0));}else{return _0x57c012[_0x1ebf('0x2a')](0xcc);}})[_0x1ebf('0x47')](handleError(_0x57c012,null));};exports['addCustomField']=function(_0x8f84d5,_0x14f48e,_0xc01dec){var _0x430925;delete _0x8f84d5[_0x1ebf('0x4c')]['id'];return db[_0x1ebf('0x2f')][_0x1ebf('0x75')]({'where':{'id':_0x8f84d5['params']['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x14f48e,null))[_0x1ebf('0x25')](function(_0x5b53eb){if(_0x5b53eb){return db[_0x1ebf('0x76')][_0x1ebf('0x77')](function(_0xdb9958){return db['CmCustomField'][_0x1ebf('0x4b')](_0x8f84d5[_0x1ebf('0x4c')],{'transaction':_0xdb9958})[_0x1ebf('0x25')](function(_0x3195f0){_0x430925=_0x3195f0;return _0x5b53eb['addCustomFields'](_0x3195f0,{'transaction':_0xdb9958});})[_0x1ebf('0x25')](function(){var _0x7db43a={'type':db[_0x1ebf('0x78')][_0x1ebf('0x79')],'transaction':_0xdb9958};switch(_0x8f84d5[_0x1ebf('0x4c')][_0x1ebf('0x32')]){case _0x1ebf('0x7a'):_0x7db43a[_0x1ebf('0x32')]=db['Sequelize'][_0x1ebf('0x79')];break;case _0x1ebf('0x7b'):_0x7db43a['type']=db['Sequelize']['INTEGER'];break;case _0x1ebf('0x7c'):_0x7db43a[_0x1ebf('0x32')]=db[_0x1ebf('0x78')]['BOOLEAN'];_0x7db43a[_0x1ebf('0x7d')]=![];break;default:}return db[_0x1ebf('0x76')][_0x1ebf('0x7e')][_0x1ebf('0x7f')](_0x1ebf('0x80'),util['format'](_0x1ebf('0x81'),_0x430925['id']),_0x7db43a);})[_0x1ebf('0x25')](function(){return _0x430925;});});}})[_0x1ebf('0x25')](respondWithResult(_0x14f48e,null))[_0x1ebf('0x47')](handleError(_0x14f48e,null));};exports[_0x1ebf('0x82')]=function(_0x5239d4,_0x127735,_0xb1aabd){var _0x3a0043={};var _0x32a6a2={};var _0x17693d;var _0x2bcf07;return db[_0x1ebf('0x2f')]['findOne']({'where':{'id':_0x5239d4[_0x1ebf('0x49')]['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x127735,null))[_0x1ebf('0x25')](function(_0x56224f){if(_0x56224f){_0x17693d=_0x56224f;_0x32a6a2[_0x1ebf('0x33')]=_[_0x1ebf('0x35')](db['CmCustomField'][_0x1ebf('0x30')]);_0x32a6a2[_0x1ebf('0x36')]=_['keys'](_0x5239d4[_0x1ebf('0x36')]);_0x32a6a2[_0x1ebf('0x3f')]=_[_0x1ebf('0x37')](_0x32a6a2[_0x1ebf('0x33')],_0x32a6a2[_0x1ebf('0x36')]);_0x3a0043[_0x1ebf('0x39')]=_[_0x1ebf('0x37')](_0x32a6a2['model'],qs[_0x1ebf('0x38')](_0x5239d4[_0x1ebf('0x36')][_0x1ebf('0x38')]));_0x3a0043[_0x1ebf('0x39')]=_0x3a0043[_0x1ebf('0x39')][_0x1ebf('0x3a')]?_0x3a0043[_0x1ebf('0x39')]:_0x32a6a2[_0x1ebf('0x33')];_0x3a0043['order']=qs[_0x1ebf('0x3d')](_0x5239d4[_0x1ebf('0x36')]['sort']);_0x3a0043[_0x1ebf('0x3e')]=qs[_0x1ebf('0x3f')](_['pick'](_0x5239d4[_0x1ebf('0x36')],_0x32a6a2[_0x1ebf('0x3f')]));_0x3a0043['where']=_[_0x1ebf('0x41')](_0x3a0043[_0x1ebf('0x3e')],{'$or':[{'ListId':_0x56224f['id']},{'ListId':null}]});if(_0x5239d4[_0x1ebf('0x36')][_0x1ebf('0x40')]){_0x3a0043[_0x1ebf('0x3e')]=_[_0x1ebf('0x41')](_0x3a0043[_0x1ebf('0x3e')],{'$or':_[_0x1ebf('0x34')](_0x3a0043[_0x1ebf('0x39')],function(_0x329ee8){var _0x15afb5={};_0x15afb5[_0x329ee8]={'$like':'%'+_0x5239d4['query'][_0x1ebf('0x40')]+'%'};return _0x15afb5;})});}_0x3a0043=_[_0x1ebf('0x41')]({},_0x3a0043,_0x5239d4[_0x1ebf('0x43')]);return db[_0x1ebf('0x69')][_0x1ebf('0x83')](_0x3a0043);}})[_0x1ebf('0x25')](respondWithResult(_0x127735,null))[_0x1ebf('0x47')](handleError(_0x127735,null));};exports[_0x1ebf('0x84')]=function(_0x3703f6,_0x4722be,_0x317326){return db[_0x1ebf('0x2f')][_0x1ebf('0x4a')]({'where':{'id':_0x3703f6[_0x1ebf('0x49')]['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x4722be,null))[_0x1ebf('0x25')](function(_0x5aa003){if(_0x5aa003){return _0x5aa003[_0x1ebf('0x84')](_0x3703f6['body'][_0x1ebf('0x5a')],_['omit'](_0x3703f6[_0x1ebf('0x4c')],['ids','id'])||{})[_0x1ebf('0x85')](function(_0xbb4dcb){for(var _0x11e60a=0x0;_0x11e60a<_0x3703f6[_0x1ebf('0x4c')][_0x1ebf('0x5a')]['length'];_0x11e60a+=0x1){socket[_0x1ebf('0x86')](_0x1ebf('0x87'),{'UserId':Number(_0x3703f6[_0x1ebf('0x4c')][_0x1ebf('0x5a')][_0x11e60a]),'CmListId':Number(_0x3703f6['params']['id'])});}return _0xbb4dcb;});}})[_0x1ebf('0x25')](respondWithResult(_0x4722be,null))[_0x1ebf('0x47')](handleError(_0x4722be,null));};exports[_0x1ebf('0x88')]=function(_0x378df1,_0x1bcc61,_0x1aaf63){return db[_0x1ebf('0x2f')]['find']({'where':{'id':_0x378df1[_0x1ebf('0x49')]['id']}})[_0x1ebf('0x25')](handleEntityNotFound(_0x1bcc61,null))[_0x1ebf('0x25')](function(_0x989498){if(_0x989498){return _0x989498[_0x1ebf('0x88')](_0x378df1[_0x1ebf('0x36')]['ids'])['then'](function(){if(_[_0x1ebf('0x5d')](_0x378df1['query'][_0x1ebf('0x5a')])){for(var _0x2752df=0x0;_0x2752df<_0x378df1['query'][_0x1ebf('0x5a')][_0x1ebf('0x3a')];_0x2752df+=0x1){socket[_0x1ebf('0x86')]('userCmList:remove',{'UserId':Number(_0x378df1[_0x1ebf('0x36')][_0x1ebf('0x5a')][_0x2752df]),'CmListId':Number(_0x378df1[_0x1ebf('0x49')]['id'])});}}else{socket[_0x1ebf('0x86')](_0x1ebf('0x89'),{'UserId':Number(_0x378df1[_0x1ebf('0x36')][_0x1ebf('0x5a')]),'CmListId':Number(_0x378df1[_0x1ebf('0x49')]['id'])});}});}})[_0x1ebf('0x25')](respondWithStatusCode(_0x1bcc61,null))[_0x1ebf('0x47')](handleError(_0x1bcc61,null));};exports[_0x1ebf('0x8a')]=function(_0xe7d108,_0x2a1403,_0x584422){var _0x301681={};var _0x4f92a4={};var _0x3d3485;var _0x280e03;return db['CmList'][_0x1ebf('0x75')]({'where':{'id':_0xe7d108['params']['id']}})['then'](handleEntityNotFound(_0x2a1403,null))[_0x1ebf('0x25')](function(_0x279960){if(_0x279960){_0x3d3485=_0x279960;_0x4f92a4[_0x1ebf('0x33')]=_[_0x1ebf('0x35')](db[_0x1ebf('0x8b')][_0x1ebf('0x30')]);_0x4f92a4[_0x1ebf('0x36')]=_[_0x1ebf('0x35')](_0xe7d108[_0x1ebf('0x36')]);_0x4f92a4[_0x1ebf('0x3f')]=_['intersection'](_0x4f92a4[_0x1ebf('0x33')],_0x4f92a4[_0x1ebf('0x36')]);_0x301681[_0x1ebf('0x39')]=_[_0x1ebf('0x37')](_0x4f92a4[_0x1ebf('0x33')],qs[_0x1ebf('0x38')](_0xe7d108['query'][_0x1ebf('0x38')]));_0x301681[_0x1ebf('0x39')]=_0x301681[_0x1ebf('0x39')]['length']?_0x301681['attributes']:_0x4f92a4[_0x1ebf('0x33')];_0x301681[_0x1ebf('0x3c')]=qs[_0x1ebf('0x3d')](_0xe7d108['query'][_0x1ebf('0x3d')]);_0x301681[_0x1ebf('0x3e')]=qs[_0x1ebf('0x3f')](_[_0x1ebf('0x58')](_0xe7d108[_0x1ebf('0x36')],_0x4f92a4['filters']));if(_0xe7d108[_0x1ebf('0x36')][_0x1ebf('0x40')]){_0x301681[_0x1ebf('0x3e')]=_[_0x1ebf('0x41')](_0x301681[_0x1ebf('0x3e')],{'$or':_[_0x1ebf('0x34')](_0x301681[_0x1ebf('0x39')],function(_0x116a11){var _0x35e459={};_0x35e459[_0x116a11]={'$like':'%'+_0xe7d108[_0x1ebf('0x36')]['filter']+'%'};return _0x35e459;})});}_0x301681=_[_0x1ebf('0x41')]({},_0x301681,_0xe7d108[_0x1ebf('0x43')]);return _0x3d3485[_0x1ebf('0x8a')](_0x301681);}})[_0x1ebf('0x25')](function(_0x5617d1){if(_0x5617d1){_0x280e03=_0x5617d1[_0x1ebf('0x3a')];if(!_0xe7d108[_0x1ebf('0x36')][_0x1ebf('0x6b')](_0x1ebf('0x3b'))){_0x301681[_0x1ebf('0x1c')]=qs[_0x1ebf('0x1c')](_0xe7d108[_0x1ebf('0x36')]['limit']);_0x301681[_0x1ebf('0x1e')]=qs['offset'](_0xe7d108[_0x1ebf('0x36')][_0x1ebf('0x1e')]);}return _0x3d3485[_0x1ebf('0x8a')](_0x301681);}})['then'](function(_0x2107fd){if(_0x2107fd){return _0x2107fd?{'count':_0x280e03,'rows':_0x2107fd}:null;}})['then'](respondWithResult(_0x2a1403,null))[_0x1ebf('0x47')](handleError(_0x2a1403,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4dd60b2..de8691d 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe14b,0x93));var _0xbe14=function(_0x5a392e,_0x720a74){_0x5a392e=_0x5a392e-0x0;var _0x29cf38=_0xe14b[_0x5a392e];return _0x29cf38;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0x9a1155,_0x1d4fce){_0x9a1155=_0x9a1155-0x0;var _0x3da8fa=_0xe14b[_0x9a1155];return _0x3da8fa;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index cb4c4b4..db11b2b 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 _0x2547=['rimraf','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x50c30d,_0x1484bf){var _0x498d5e=function(_0x22abd4){while(--_0x22abd4){_0x50c30d['push'](_0x50c30d['shift']());}};_0x498d5e(++_0x1484bf);}(_0x2547,0x1cd));var _0x7254=function(_0x1755a3,_0x246c41){_0x1755a3=_0x1755a3-0x0;var _0x3df916=_0x2547[_0x1755a3];return _0x3df916;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41bb=['bluebird','request-promise','path','rimraf','./cmList.attributes','exports','cm_lists','lodash','util','api'];(function(_0x9bd2e,_0xb29284){var _0x53a5c5=function(_0x12961b){while(--_0x12961b){_0x9bd2e['push'](_0x9bd2e['shift']());}};_0x53a5c5(++_0xb29284);}(_0x41bb,0xc5));var _0xb41b=function(_0x435713,_0x5dd205){_0x435713=_0x435713-0x0;var _0x4ed61e=_0x41bb[_0x435713];return _0x4ed61e;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('CmList',attributes,{'tableName':_0xb41b('0x9'),'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 5ef3f83..7b850ea 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 _0x648d=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0xd73d3,_0x392d57){var _0x126331=function(_0x12c4f9){while(--_0x12c4f9){_0xd73d3['push'](_0xd73d3['shift']());}};_0x126331(++_0x392d57);}(_0x648d,0x19c));var _0xd648=function(_0x236d2a,_0xfbeba8){_0x236d2a=_0x236d2a-0x0;var _0x43daea=_0x648d[_0x236d2a];return _0x43daea;};'use strict';var _=require(_0xd648('0x0'));var util=require(_0xd648('0x1'));var moment=require(_0xd648('0x2'));var BPromise=require(_0xd648('0x3'));var rs=require(_0xd648('0x4'));var fs=require('fs');var Redis=require(_0xd648('0x5'));var db=require(_0xd648('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd648('0x7'));var config=require(_0xd648('0x8'));var jayson=require(_0xd648('0x9'));var client=jayson[_0xd648('0xa')][_0xd648('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd648('0xc')],{'host':_0xd648('0xd'),'port':0x18eb});var socket=require(_0xd648('0xe'))(new Redis(config[_0xd648('0xc')]));require('./cmList.socket')[_0xd648('0xf')](socket);function respondWithRpcPromise(_0x258880,_0x44d755,_0x8c9b84){return new BPromise(function(_0x5f3fe3,_0xce8052){return client[_0xd648('0x10')](_0x258880,_0x8c9b84)['then'](function(_0x5d9378){logger[_0xd648('0x11')](_0xd648('0x12'),_0x44d755,_0xd648('0x13'));logger[_0xd648('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x44d755,_0xd648('0x13'),JSON[_0xd648('0x15')](_0x5d9378));if(_0x5d9378['error']){if(_0x5d9378[_0xd648('0x16')][_0xd648('0x17')]===0x1f4){logger[_0xd648('0x16')](_0xd648('0x12'),_0x44d755,_0x5d9378[_0xd648('0x16')][_0xd648('0x18')]);return _0xce8052(_0x5d9378[_0xd648('0x16')][_0xd648('0x18')]);}logger[_0xd648('0x16')](_0xd648('0x12'),_0x44d755,_0x5d9378[_0xd648('0x16')][_0xd648('0x18')]);return _0x5f3fe3(_0x5d9378[_0xd648('0x16')]['message']);}else{logger['info'](_0xd648('0x12'),_0x44d755,_0xd648('0x13'));_0x5f3fe3(_0x5d9378[_0xd648('0x19')]['message']);}})[_0xd648('0x1a')](function(_0x23afaf){logger['error'](_0xd648('0x12'),_0x44d755,_0x23afaf);_0xce8052(_0x23afaf);});});} \ No newline at end of file +var _0x134e=['client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x2a292b,_0x34d43e){var _0x31adfb=function(_0x42406d){while(--_0x42406d){_0x2a292b['push'](_0x2a292b['shift']());}};_0x31adfb(++_0x34d43e);}(_0x134e,0x69));var _0xe134=function(_0x10c781,_0x322cc2){_0x10c781=_0x10c781-0x0;var _0x53e8dd=_0x134e[_0x10c781];return _0x53e8dd;};'use strict';var _=require(_0xe134('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe134('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe134('0x2'));var db=require(_0xe134('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe134('0x4'))(_0xe134('0x5'));var config=require('../../config/environment');var jayson=require(_0xe134('0x6'));var client=jayson[_0xe134('0x7')][_0xe134('0x8')]({'port':0x232a});config[_0xe134('0x9')]=_[_0xe134('0xa')](config[_0xe134('0x9')],{'host':_0xe134('0xb'),'port':0x18eb});var socket=require(_0xe134('0xc'))(new Redis(config[_0xe134('0x9')]));require(_0xe134('0xd'))[_0xe134('0xe')](socket);function respondWithRpcPromise(_0x55f2d9,_0x15da99,_0x26f9a8){return new BPromise(function(_0x84ebbe,_0x2a1570){return client[_0xe134('0xf')](_0x55f2d9,_0x26f9a8)[_0xe134('0x10')](function(_0x3ef833){logger[_0xe134('0x11')](_0xe134('0x12'),_0x15da99,_0xe134('0x13'));logger[_0xe134('0x14')](_0xe134('0x15'),_0x15da99,_0xe134('0x13'),JSON[_0xe134('0x16')](_0x3ef833));if(_0x3ef833[_0xe134('0x17')]){if(_0x3ef833[_0xe134('0x17')][_0xe134('0x18')]===0x1f4){logger[_0xe134('0x17')](_0xe134('0x12'),_0x15da99,_0x3ef833['error'][_0xe134('0x19')]);return _0x2a1570(_0x3ef833['error']['message']);}logger[_0xe134('0x17')]('CmList,\x20%s,\x20%s',_0x15da99,_0x3ef833[_0xe134('0x17')]['message']);return _0x84ebbe(_0x3ef833[_0xe134('0x17')][_0xe134('0x19')]);}else{logger[_0xe134('0x11')]('CmList,\x20%s,\x20%s',_0x15da99,_0xe134('0x13'));_0x84ebbe(_0x3ef833[_0xe134('0x1a')][_0xe134('0x19')]);}})[_0xe134('0x1b')](function(_0x11ef83){logger[_0xe134('0x17')](_0xe134('0x12'),_0x15da99,_0x11ef83);_0x2a1570(_0x11ef83);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 52da5f2..b3c7049 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 _0xe3cd=['update','removeListener','cmList:','./cmList.events','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe3cd,0x16b));var _0xde3c=function(_0x1b557a,_0x50fff2){_0x1b557a=_0x1b557a-0x0;var _0x192104=_0xe3cd[_0x1b557a];return _0x192104;};'use strict';var CmListEvents=require(_0xde3c('0x0'));var events=['save',_0xde3c('0x1'),_0xde3c('0x2')];function createListener(_0x552366,_0x3fc364){return function(_0x3d5109){_0x3fc364['emit'](_0x552366,_0x3d5109);};}function removeListener(_0x536e1e,_0x18f5e9){return function(){CmListEvents[_0xde3c('0x3')](_0x536e1e,_0x18f5e9);};}exports['register']=function(_0x2c09c5){for(var _0x121415=0x0,_0x4bb5de=events['length'];_0x121415<_0x4bb5de;_0x121415++){var _0x5c1a09=events[_0x121415];var _0xe58e27=createListener(_0xde3c('0x4')+_0x5c1a09,_0x2c09c5);CmListEvents['on'](_0x5c1a09,_0xe58e27);}}; \ No newline at end of file +var _0x1c94=['update','emit','removeListener','register','cmList:','./cmList.events','remove'];(function(_0x4bb0d5,_0x469210){var _0x3bbdea=function(_0xb23e74){while(--_0xb23e74){_0x4bb0d5['push'](_0x4bb0d5['shift']());}};_0x3bbdea(++_0x469210);}(_0x1c94,0x11d));var _0x41c9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1c94[_0x321bb2];return _0x9c12ed;};'use strict';var CmListEvents=require(_0x41c9('0x0'));var events=['save',_0x41c9('0x1'),_0x41c9('0x2')];function createListener(_0x50f2d8,_0x38f744){return function(_0x4e76a2){_0x38f744[_0x41c9('0x3')](_0x50f2d8,_0x4e76a2);};}function removeListener(_0x4d3635,_0x3f7f4c){return function(){CmListEvents[_0x41c9('0x4')](_0x4d3635,_0x3f7f4c);};}exports[_0x41c9('0x5')]=function(_0x36b239){for(var _0x5a5cf6=0x0,_0x2a4769=events['length'];_0x5a5cf6<_0x2a4769;_0x5a5cf6++){var _0x5caa5d=events[_0x5a5cf6];var _0x33a367=createListener(_0x41c9('0x6')+_0x5caa5d,_0x36b239);CmListEvents['on'](_0x5caa5d,_0x33a367);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 92133bd..5ffb172 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 _0x6968=['addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','post','create'];(function(_0x281f7f,_0x3eca4e){var _0x299eff=function(_0x49a8ad){while(--_0x49a8ad){_0x281f7f['push'](_0x281f7f['shift']());}};_0x299eff(++_0x3eca4e);}(_0x6968,0x6e));var _0x8696=function(_0x486df7,_0x5f803a){_0x486df7=_0x486df7-0x0;var _0x3c0d43=_0x6968[_0x486df7];return _0x3c0d43;};'use strict';var multer=require('multer');var util=require(_0x8696('0x0'));var path=require(_0x8696('0x1'));var timeout=require('connect-timeout');var express=require(_0x8696('0x2'));var router=express['Router']();var fs_extra=require(_0x8696('0x3'));var auth=require(_0x8696('0x4'));var interaction=require(_0x8696('0x5'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x8696('0x6')]('/',auth[_0x8696('0x7')](),controller[_0x8696('0x8')]);router[_0x8696('0x6')](_0x8696('0x9'),auth['isAuthenticated'](),controller[_0x8696('0xa')]);router['get'](_0x8696('0xb'),auth[_0x8696('0x7')](),controller['show']);router[_0x8696('0x6')](_0x8696('0xc'),auth[_0x8696('0x7')](),controller[_0x8696('0xd')]);router[_0x8696('0x6')](_0x8696('0xe'),auth[_0x8696('0x7')](),controller[_0x8696('0xf')]);router[_0x8696('0x6')](_0x8696('0x10'),auth[_0x8696('0x7')](),controller[_0x8696('0x11')]);router[_0x8696('0x6')]('/:id/fields',auth[_0x8696('0x7')](),controller['getCustomFields']);router[_0x8696('0x6')](_0x8696('0x12'),auth[_0x8696('0x7')](),controller[_0x8696('0x13')]);router[_0x8696('0x14')]('/',auth[_0x8696('0x7')](),controller[_0x8696('0x15')]);router[_0x8696('0x14')](_0x8696('0xc'),auth[_0x8696('0x7')](),controller[_0x8696('0x16')]);router[_0x8696('0x14')](_0x8696('0xe'),auth[_0x8696('0x7')](),controller[_0x8696('0x17')]);router[_0x8696('0x14')](_0x8696('0x18'),auth[_0x8696('0x7')](),controller[_0x8696('0x19')]);router[_0x8696('0x14')]('/:id/users',auth[_0x8696('0x7')](),controller[_0x8696('0x1a')]);router[_0x8696('0x1b')]('/:id',auth[_0x8696('0x7')](),controller['update']);router[_0x8696('0x1c')](_0x8696('0xb'),auth[_0x8696('0x7')](),controller[_0x8696('0x1d')]);router[_0x8696('0x1c')](_0x8696('0xc'),auth[_0x8696('0x7')](),controller[_0x8696('0x1e')]);router['delete'](_0x8696('0x12'),auth['isAuthenticated'](),controller[_0x8696('0x1f')]);module[_0x8696('0x20')]=router; \ No newline at end of file +var _0x38df=['/:id/dispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x5d78f0,_0x3784f9){var _0x4d1012=function(_0x23d0ba){while(--_0x23d0ba){_0x5d78f0['push'](_0x5d78f0['shift']());}};_0x4d1012(++_0x3784f9);}(_0x38df,0x144));var _0xf38d=function(_0x5eaa16,_0x28ebad){_0x5eaa16=_0x5eaa16-0x0;var _0x352569=_0x38df[_0x5eaa16];return _0x352569;};'use strict';var multer=require(_0xf38d('0x0'));var util=require(_0xf38d('0x1'));var path=require(_0xf38d('0x2'));var timeout=require(_0xf38d('0x3'));var express=require(_0xf38d('0x4'));var router=express[_0xf38d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf38d('0x6'));var config=require(_0xf38d('0x7'));var controller=require(_0xf38d('0x8'));router['get']('/',auth[_0xf38d('0x9')](),controller[_0xf38d('0xa')]);router[_0xf38d('0xb')](_0xf38d('0xc'),auth[_0xf38d('0x9')](),controller[_0xf38d('0xd')]);router[_0xf38d('0xb')](_0xf38d('0xe'),auth[_0xf38d('0x9')](),controller[_0xf38d('0xf')]);router[_0xf38d('0xb')](_0xf38d('0x10'),auth[_0xf38d('0x9')](),controller['getDispositions']);router[_0xf38d('0xb')](_0xf38d('0x11'),auth[_0xf38d('0x9')](),controller[_0xf38d('0x12')]);router['get']('/:id/contacts/csv',auth[_0xf38d('0x9')](),controller[_0xf38d('0x13')]);router['get'](_0xf38d('0x14'),auth[_0xf38d('0x9')](),controller[_0xf38d('0x15')]);router['get'](_0xf38d('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0xf38d('0x17')]('/',auth[_0xf38d('0x9')](),controller[_0xf38d('0x18')]);router[_0xf38d('0x17')](_0xf38d('0x10'),auth[_0xf38d('0x9')](),controller['addDisposition']);router[_0xf38d('0x17')](_0xf38d('0x11'),auth[_0xf38d('0x9')](),controller[_0xf38d('0x19')]);router[_0xf38d('0x17')](_0xf38d('0x14'),auth[_0xf38d('0x9')](),controller[_0xf38d('0x1a')]);router[_0xf38d('0x17')](_0xf38d('0x16'),auth[_0xf38d('0x9')](),controller[_0xf38d('0x1b')]);router[_0xf38d('0x1c')](_0xf38d('0xe'),auth['isAuthenticated'](),controller[_0xf38d('0x1d')]);router[_0xf38d('0x1e')](_0xf38d('0xe'),auth[_0xf38d('0x9')](),controller[_0xf38d('0x1f')]);router['delete']('/:id/dispositions',auth[_0xf38d('0x9')](),controller['removeDispositions']);router[_0xf38d('0x1e')](_0xf38d('0x16'),auth[_0xf38d('0x9')](),controller[_0xf38d('0x20')]);module[_0xf38d('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 323dc23..34123b4 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 _0x2a9a=['getDataValue','field','STRING','sequelize'];(function(_0x333796,_0x516af4){var _0x93ca2=function(_0x10736f){while(--_0x10736f){_0x333796['push'](_0x333796['shift']());}};_0x93ca2(++_0x516af4);}(_0x2a9a,0x93));var _0xa2a9=function(_0x3c041,_0x3ae6f1){_0x3c041=_0x3c041-0x0;var _0x8b02f5=_0x2a9a[_0x3c041];return _0x8b02f5;};'use strict';var Sequelize=require(_0xa2a9('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x589812){return this[_0xa2a9('0x1')](_0xa2a9('0x2'));}},'field':{'type':Sequelize[_0xa2a9('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xa2a9('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xa2a9('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x8958=['sequelize','exports','VIRTUAL','field','STRING'];(function(_0xc662c7,_0x35bc01){var _0x3c275f=function(_0x27c7a4){while(--_0x27c7a4){_0xc662c7['push'](_0xc662c7['shift']());}};_0x3c275f(++_0x35bc01);}(_0x8958,0x140));var _0x8895=function(_0x4eba56,_0x28a323){_0x4eba56=_0x4eba56-0x0;var _0x33132c=_0x8958[_0x4eba56];return _0x33132c;};'use strict';var Sequelize=require(_0x8895('0x0'));module[_0x8895('0x1')]={'name':{'type':Sequelize[_0x8895('0x2')],'get':function(_0x2d6655){return this['getDataValue'](_0x8895('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x8895('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 a16b4ce..be0d922 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x7d2005,_0x5c73af){var _0x5a1250=function(_0x51523d){while(--_0x51523d){_0x7d2005['push'](_0x7d2005['shift']());}};_0x5a1250(++_0x5c73af);}(_0x7a54,0x106));var _0x47a5=function(_0x20e3ff,_0x358517){_0x20e3ff=_0x20e3ff-0x0;var _0x1893af=_0x7a54[_0x20e3ff];return _0x1893af;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x46d8af,_0x4d3ad9){var _0x3c9781=function(_0x3becf1){while(--_0x3becf1){_0x46d8af['push'](_0x46d8af['shift']());}};_0x3c9781(++_0x4d3ad9);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 15864ce..f1afd6a 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 _0x0926=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','util'];(function(_0x48a8e4,_0x3f2f9f){var _0x58d1fb=function(_0x6e9d0e){while(--_0x6e9d0e){_0x48a8e4['push'](_0x48a8e4['shift']());}};_0x58d1fb(++_0x3f2f9f);}(_0x0926,0x1ee));var _0x6092=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0x0926[_0x82140];return _0x2b15a6;};'use strict';var _=require('lodash');var util=require(_0x6092('0x0'));var logger=require(_0x6092('0x1'))(_0x6092('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6092('0x3'));var fs=require('fs');var path=require(_0x6092('0x4'));var rimraf=require(_0x6092('0x5'));var config=require(_0x6092('0x6'));var attributes=require(_0x6092('0x7'));module[_0x6092('0x8')]=function(_0x286e2b,_0x4076f8){return _0x286e2b['define'](_0x6092('0x9'),attributes,{'tableName':_0x6092('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe64d=['Condition','tools_conditions','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','define'];(function(_0xdbd42c,_0x3ac170){var _0x672780=function(_0x148579){while(--_0x148579){_0xdbd42c['push'](_0xdbd42c['shift']());}};_0x672780(++_0x3ac170);}(_0xe64d,0x199));var _0xde64=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0xe64d[_0x590b63];return _0x3c9380;};'use strict';var _=require('lodash');var util=require(_0xde64('0x0'));var logger=require('../../config/logger')(_0xde64('0x1'));var moment=require('moment');var BPromise=require(_0xde64('0x2'));var rp=require(_0xde64('0x3'));var fs=require('fs');var path=require(_0xde64('0x4'));var rimraf=require(_0xde64('0x5'));var config=require(_0xde64('0x6'));var attributes=require(_0xde64('0x7'));module['exports']=function(_0x276316,_0x407815){return _0x276316[_0xde64('0x8')](_0xde64('0x9'),attributes,{'tableName':_0xde64('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 34b7371..a0aa7d4 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 _0xc561=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Condition,\x20%s,\x20%s','message','catch'];(function(_0x40fcb1,_0x5c792f){var _0x17f24f=function(_0x3466c3){while(--_0x3466c3){_0x40fcb1['push'](_0x40fcb1['shift']());}};_0x17f24f(++_0x5c792f);}(_0xc561,0x6e));var _0x1c56=function(_0x4152fa,_0x6dc7a3){_0x4152fa=_0x4152fa-0x0;var _0x3c3779=_0xc561[_0x4152fa];return _0x3c3779;};'use strict';var _=require(_0x1c56('0x0'));var util=require(_0x1c56('0x1'));var moment=require(_0x1c56('0x2'));var BPromise=require(_0x1c56('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c56('0x4'));var db=require(_0x1c56('0x5'))['db'];var utils=require(_0x1c56('0x6'));var logger=require(_0x1c56('0x7'))(_0x1c56('0x8'));var config=require('../../config/environment');var jayson=require(_0x1c56('0x9'));var client=jayson['client'][_0x1c56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eab33,_0x2ab383,_0x4f520f){return new BPromise(function(_0x491fc1,_0x246458){return client[_0x1c56('0xb')](_0x2eab33,_0x4f520f)[_0x1c56('0xc')](function(_0x10c994){logger[_0x1c56('0xd')]('Condition,\x20%s,\x20%s',_0x2ab383,'request\x20sent');logger[_0x1c56('0xe')](_0x1c56('0xf'),_0x2ab383,_0x1c56('0x10'),JSON[_0x1c56('0x11')](_0x10c994));if(_0x10c994[_0x1c56('0x12')]){if(_0x10c994[_0x1c56('0x12')]['code']===0x1f4){logger['error'](_0x1c56('0x13'),_0x2ab383,_0x10c994['error']['message']);return _0x246458(_0x10c994['error'][_0x1c56('0x14')]);}logger['error'](_0x1c56('0x13'),_0x2ab383,_0x10c994[_0x1c56('0x12')][_0x1c56('0x14')]);return _0x491fc1(_0x10c994[_0x1c56('0x12')][_0x1c56('0x14')]);}else{logger['info'](_0x1c56('0x13'),_0x2ab383,_0x1c56('0x10'));_0x491fc1(_0x10c994['result']['message']);}})[_0x1c56('0x15')](function(_0x5ab5a8){logger[_0x1c56('0x12')](_0x1c56('0x13'),_0x2ab383,_0x5ab5a8);_0x246458(_0x5ab5a8);});});} \ No newline at end of file +var _0x0738=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4037f8,_0x3c1548){var _0x35b116=function(_0x4d2e00){while(--_0x4d2e00){_0x4037f8['push'](_0x4037f8['shift']());}};_0x35b116(++_0x3c1548);}(_0x0738,0xa7));var _0x8073=function(_0x254744,_0x219e6b){_0x254744=_0x254744-0x0;var _0x2a6a96=_0x0738[_0x254744];return _0x2a6a96;};'use strict';var _=require('lodash');var util=require(_0x8073('0x0'));var moment=require(_0x8073('0x1'));var BPromise=require(_0x8073('0x2'));var rs=require(_0x8073('0x3'));var fs=require('fs');var Redis=require(_0x8073('0x4'));var db=require(_0x8073('0x5'))['db'];var utils=require(_0x8073('0x6'));var logger=require(_0x8073('0x7'))(_0x8073('0x8'));var config=require(_0x8073('0x9'));var jayson=require(_0x8073('0xa'));var client=jayson[_0x8073('0xb')][_0x8073('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a36a3,_0x57493f,_0xb60b3b){return new BPromise(function(_0x3f34e5,_0x2cb6f1){return client[_0x8073('0xd')](_0x4a36a3,_0xb60b3b)['then'](function(_0x3225fc){logger['info'](_0x8073('0xe'),_0x57493f,_0x8073('0xf'));logger[_0x8073('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x57493f,_0x8073('0xf'),JSON[_0x8073('0x11')](_0x3225fc));if(_0x3225fc[_0x8073('0x12')]){if(_0x3225fc['error'][_0x8073('0x13')]===0x1f4){logger[_0x8073('0x12')](_0x8073('0xe'),_0x57493f,_0x3225fc[_0x8073('0x12')]['message']);return _0x2cb6f1(_0x3225fc[_0x8073('0x12')]['message']);}logger['error'](_0x8073('0xe'),_0x57493f,_0x3225fc[_0x8073('0x12')][_0x8073('0x14')]);return _0x3f34e5(_0x3225fc[_0x8073('0x12')][_0x8073('0x14')]);}else{logger['info'](_0x8073('0xe'),_0x57493f,_0x8073('0xf'));_0x3f34e5(_0x3225fc[_0x8073('0x15')][_0x8073('0x14')]);}})[_0x8073('0x16')](function(_0x39f522){logger['error']('Condition,\x20%s,\x20%s',_0x57493f,_0x39f522);_0x2cb6f1(_0x39f522);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 643b654..7f9cddc 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 _0x3cb3=['/:id','isAuthenticated','update','destroy','exports','util','express','fs-extra','../../components/auth/service','put'];(function(_0x4a1de3,_0x1602ab){var _0x1f73b5=function(_0x16e9ea){while(--_0x16e9ea){_0x4a1de3['push'](_0x4a1de3['shift']());}};_0x1f73b5(++_0x1602ab);}(_0x3cb3,0x177));var _0x33cb=function(_0x3e57ef,_0x1bd886){_0x3e57ef=_0x3e57ef-0x0;var _0x3eca5e=_0x3cb3[_0x3e57ef];return _0x3eca5e;};'use strict';var multer=require('multer');var util=require(_0x33cb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x33cb('0x1'));var router=express['Router']();var fs_extra=require(_0x33cb('0x2'));var auth=require(_0x33cb('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x33cb('0x4')](_0x33cb('0x5'),auth[_0x33cb('0x6')](),controller[_0x33cb('0x7')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x33cb('0x8')]);module[_0x33cb('0x9')]=router; \ No newline at end of file +var _0xe8ce=['delete','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','put','/:id','update'];(function(_0xb127e1,_0x204ab9){var _0x1e5fe3=function(_0x1b370a){while(--_0x1b370a){_0xb127e1['push'](_0xb127e1['shift']());}};_0x1e5fe3(++_0x204ab9);}(_0xe8ce,0xd6));var _0xee8c=function(_0x3c324f,_0x5a3bcc){_0x3c324f=_0x3c324f-0x0;var _0x7487e9=_0xe8ce[_0x3c324f];return _0x7487e9;};'use strict';var multer=require(_0xee8c('0x0'));var util=require(_0xee8c('0x1'));var path=require('path');var timeout=require(_0xee8c('0x2'));var express=require(_0xee8c('0x3'));var router=express[_0xee8c('0x4')]();var fs_extra=require(_0xee8c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xee8c('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xee8c('0x7')](_0xee8c('0x8'),auth['isAuthenticated'](),controller[_0xee8c('0x9')]);router[_0xee8c('0xa')]('/:id',auth[_0xee8c('0xb')](),controller[_0xee8c('0xc')]);module[_0xee8c('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 2be3e3e..358a643 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 _0x0713=['STRING','name'];(function(_0x4fb5e7,_0x5061fb){var _0x6e6328=function(_0x451480){while(--_0x451480){_0x4fb5e7['push'](_0x4fb5e7['shift']());}};_0x6e6328(++_0x5061fb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x415772,_0x1d524e){var _0x3b8a07=function(_0x4ab3be){while(--_0x4ab3be){_0x415772['push'](_0x415772['shift']());}};_0x3b8a07(++_0x1d524e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d8f8fa1..077a426 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 _0xf543=['Dashboard','includeAll','include','findAll','rows','catch','show','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','params','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options'];(function(_0x54d31e,_0x4d1eb2){var _0x31a099=function(_0x42ce80){while(--_0x42ce80){_0x54d31e['push'](_0x54d31e['shift']());}};_0x31a099(++_0x4d1eb2);}(_0xf543,0x1b6));var _0x3f54=function(_0x55d4ee,_0x3b9a1c){_0x55d4ee=_0x55d4ee-0x0;var _0xadbe7d=_0xf543[_0x55d4ee];return _0xadbe7d;};'use strict';var emlformat=require(_0x3f54('0x0'));var rimraf=require(_0x3f54('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f54('0x2'));var rp=require(_0x3f54('0x3'));var moment=require(_0x3f54('0x4'));var BPromise=require(_0x3f54('0x5'));var Mustache=require(_0x3f54('0x6'));var util=require(_0x3f54('0x7'));var path=require('path');var sox=require(_0x3f54('0x8'));var csv=require(_0x3f54('0x9'));var ejs=require(_0x3f54('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f54('0xb'));var squel=require(_0x3f54('0xc'));var crypto=require(_0x3f54('0xd'));var jsforce=require(_0x3f54('0xe'));var deskjs=require(_0x3f54('0xf'));var toCsv=require(_0x3f54('0x9'));var querystring=require(_0x3f54('0x10'));var Papa=require(_0x3f54('0x11'));var Redis=require('ioredis');var authService=require(_0x3f54('0x12'));var qs=require(_0x3f54('0x13'));var as=require(_0x3f54('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f54('0x15'))(_0x3f54('0x16'));var utils=require(_0x3f54('0x17'));var config=require(_0x3f54('0x18'));var licenseUtil=require(_0x3f54('0x19'));var db=require(_0x3f54('0x1a'))['db'];config[_0x3f54('0x1b')]=_[_0x3f54('0x1c')](config[_0x3f54('0x1b')],{'host':_0x3f54('0x1d'),'port':0x18eb});var socket=require(_0x3f54('0x1e'))(new Redis(config['redis']));require('./dashboard.socket')[_0x3f54('0x1f')](socket);function respondWithStatusCode(_0x2aca6f,_0xbca8b0){_0xbca8b0=_0xbca8b0||0xcc;return function(_0x4070e2){if(_0x4070e2){return _0x2aca6f[_0x3f54('0x20')](_0xbca8b0);}return _0x2aca6f['status'](_0xbca8b0)[_0x3f54('0x21')]();};}function respondWithResult(_0x2628f7,_0x369d5f){_0x369d5f=_0x369d5f||0xc8;return function(_0x19fad6){if(_0x19fad6){return _0x2628f7[_0x3f54('0x22')](_0x369d5f)[_0x3f54('0x23')](_0x19fad6);}};}function respondWithFilteredResult(_0xba8ae5,_0x1b5986){return function(_0x2783af){if(_0x2783af){var _0x54630f=typeof _0x1b5986['offset']==='undefined'&&typeof _0x1b5986[_0x3f54('0x24')]===_0x3f54('0x25');var _0x12ae8e=_0x2783af[_0x3f54('0x26')];var _0x4cbde4=_0x54630f?0x0:_0x1b5986[_0x3f54('0x27')];var _0x3a1ce6=_0x54630f?_0x2783af[_0x3f54('0x26')]:_0x1b5986[_0x3f54('0x27')]+_0x1b5986['limit'];var _0x3ced72;if(_0x3a1ce6>=_0x12ae8e){_0x3a1ce6=_0x12ae8e;_0x3ced72=0xc8;}else{_0x3ced72=0xce;}_0xba8ae5['status'](_0x3ced72);return _0xba8ae5['set'](_0x3f54('0x28'),_0x4cbde4+'-'+_0x3a1ce6+'/'+_0x12ae8e)[_0x3f54('0x23')](_0x2783af);}return null;};}function patchUpdates(_0x4bec03){return function(_0x5b4423){try{jsonpatch['apply'](_0x5b4423,_0x4bec03,!![]);}catch(_0x1cc51d){return BPromise[_0x3f54('0x29')](_0x1cc51d);}return _0x5b4423[_0x3f54('0x2a')]();};}function saveUpdates(_0x3b4301,_0x52d8b4){return function(_0xeae3b2){if(_0xeae3b2){return _0xeae3b2[_0x3f54('0x2b')](_0x3b4301)[_0x3f54('0x2c')](function(_0x204a1f){return _0x204a1f;});}return null;};}function removeEntity(_0x3e19fa,_0x34d182){return function(_0x11bbf1){if(_0x11bbf1){return _0x11bbf1[_0x3f54('0x2d')]()[_0x3f54('0x2c')](function(){var _0x36b9c0=_0x11bbf1[_0x3f54('0x2e')]({'plain':!![]});var _0x17d0fe=_0x3f54('0x2f');return db['UserProfileResource'][_0x3f54('0x2d')]({'where':{'type':_0x17d0fe,'resourceId':_0x36b9c0['id']}})[_0x3f54('0x2c')](function(){return _0x11bbf1;});})[_0x3f54('0x2c')](function(){_0x3e19fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cbce8,_0x5064f6){return function(_0x73e2e9){if(!_0x73e2e9){_0x2cbce8['sendStatus'](0x194);}return _0x73e2e9;};}function handleError(_0x176fe2,_0x9a5efa){_0x9a5efa=_0x9a5efa||0x1f4;return function(_0x481539){logger[_0x3f54('0x30')](_0x481539[_0x3f54('0x31')]);if(_0x481539[_0x3f54('0x32')]){delete _0x481539[_0x3f54('0x32')];}_0x176fe2[_0x3f54('0x22')](_0x9a5efa)[_0x3f54('0x33')](_0x481539);};}exports[_0x3f54('0x34')]=function(_0x3e975a,_0xc37ed2){var _0x22e9e1={},_0x36c3a5={},_0x50aaa0={'count':0x0,'rows':[]};var _0xd3d0c2=_[_0x3f54('0x35')](db['Dashboard'][_0x3f54('0x36')],function(_0x18b250){return{'name':_0x18b250['fieldName'],'type':_0x18b250[_0x3f54('0x37')][_0x3f54('0x38')]};});_0x36c3a5[_0x3f54('0x39')]=_[_0x3f54('0x35')](_0xd3d0c2,_0x3f54('0x32'));_0x36c3a5['query']=_[_0x3f54('0x3a')](_0x3e975a[_0x3f54('0x3b')]);_0x36c3a5[_0x3f54('0x3c')]=_[_0x3f54('0x3d')](_0x36c3a5['model'],_0x36c3a5[_0x3f54('0x3b')]);_0x22e9e1['attributes']=_['intersection'](_0x36c3a5[_0x3f54('0x39')],qs['fields'](_0x3e975a[_0x3f54('0x3b')][_0x3f54('0x3e')]));_0x22e9e1[_0x3f54('0x3f')]=_0x22e9e1[_0x3f54('0x3f')][_0x3f54('0x40')]?_0x22e9e1['attributes']:_0x36c3a5['model'];if(!_0x3e975a[_0x3f54('0x3b')]['hasOwnProperty'](_0x3f54('0x41'))){_0x22e9e1['limit']=qs[_0x3f54('0x24')](_0x3e975a[_0x3f54('0x3b')][_0x3f54('0x24')]);_0x22e9e1[_0x3f54('0x27')]=qs[_0x3f54('0x27')](_0x3e975a[_0x3f54('0x3b')][_0x3f54('0x27')]);}_0x22e9e1[_0x3f54('0x42')]=qs[_0x3f54('0x43')](_0x3e975a[_0x3f54('0x3b')][_0x3f54('0x43')]);_0x22e9e1['where']=qs['filters'](_[_0x3f54('0x44')](_0x3e975a[_0x3f54('0x3b')],_0x36c3a5[_0x3f54('0x3c')]),_0xd3d0c2);if(_0x3e975a['query'][_0x3f54('0x45')]){_0x22e9e1[_0x3f54('0x46')]=_['merge'](_0x22e9e1['where'],{'$or':_[_0x3f54('0x35')](_0xd3d0c2,function(_0x48f4e4){if(_0x48f4e4[_0x3f54('0x37')]!==_0x3f54('0x47')){var _0x5cc0b9={};_0x5cc0b9[_0x48f4e4[_0x3f54('0x32')]]={'$like':'%'+_0x3e975a['query'][_0x3f54('0x45')]+'%'};return _0x5cc0b9;}})});}_0x22e9e1=_[_0x3f54('0x48')]({},_0x22e9e1,_0x3e975a[_0x3f54('0x49')]);var _0x4b1bda={'where':_0x22e9e1[_0x3f54('0x46')]};return db[_0x3f54('0x4a')][_0x3f54('0x26')](_0x4b1bda)[_0x3f54('0x2c')](function(_0x3f6c20){_0x50aaa0[_0x3f54('0x26')]=_0x3f6c20;if(_0x3e975a['query'][_0x3f54('0x4b')]){_0x22e9e1[_0x3f54('0x4c')]=[{'all':!![]}];}return db[_0x3f54('0x4a')][_0x3f54('0x4d')](_0x22e9e1);})[_0x3f54('0x2c')](function(_0x72fa01){_0x50aaa0[_0x3f54('0x4e')]=_0x72fa01;return _0x50aaa0;})['then'](respondWithFilteredResult(_0xc37ed2,_0x22e9e1))[_0x3f54('0x4f')](handleError(_0xc37ed2,null));};exports[_0x3f54('0x50')]=function(_0x4e2dd1,_0x5af571){var _0x173779={'raw':![],'where':{'id':_0x4e2dd1['params']['id']}},_0x4adb81={};_0x4adb81['model']=_['keys'](db[_0x3f54('0x4a')][_0x3f54('0x36')]);_0x4adb81[_0x3f54('0x3b')]=_[_0x3f54('0x3a')](_0x4e2dd1[_0x3f54('0x3b')]);_0x4adb81[_0x3f54('0x3c')]=_['intersection'](_0x4adb81[_0x3f54('0x39')],_0x4adb81[_0x3f54('0x3b')]);_0x173779['attributes']=_[_0x3f54('0x3d')](_0x4adb81[_0x3f54('0x39')],qs[_0x3f54('0x3e')](_0x4e2dd1[_0x3f54('0x3b')]['fields']));_0x173779[_0x3f54('0x3f')]=_0x173779[_0x3f54('0x3f')][_0x3f54('0x40')]?_0x173779['attributes']:_0x4adb81[_0x3f54('0x39')];if(_0x4e2dd1[_0x3f54('0x3b')][_0x3f54('0x4b')]){_0x173779[_0x3f54('0x4c')]=[{'all':!![]}];}_0x173779=_[_0x3f54('0x48')]({},_0x173779,_0x4e2dd1['options']);return db[_0x3f54('0x4a')][_0x3f54('0x51')](_0x173779)[_0x3f54('0x2c')](handleEntityNotFound(_0x5af571,null))[_0x3f54('0x2c')](respondWithResult(_0x5af571,null))[_0x3f54('0x4f')](handleError(_0x5af571,null));};exports[_0x3f54('0x52')]=function(_0x1337f1,_0x34f634){return db['Dashboard'][_0x3f54('0x52')](_0x1337f1[_0x3f54('0x53')],{})['then'](function(_0x146cb4){var _0x5f2cb0=_0x1337f1[_0x3f54('0x54')][_0x3f54('0x2e')]({'plain':!![]});if(!_0x5f2cb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f2cb0[_0x3f54('0x55')]===_0x3f54('0x54')){var _0x51cf09=_0x146cb4[_0x3f54('0x2e')]({'plain':!![]});var _0x4ace2f=_0x3f54('0x2f');return db[_0x3f54('0x56')][_0x3f54('0x51')]({'where':{'name':_0x4ace2f,'userProfileId':_0x5f2cb0[_0x3f54('0x57')]},'raw':!![]})[_0x3f54('0x2c')](function(_0x22d243){if(_0x22d243&&_0x22d243[_0x3f54('0x58')]===0x0){return db['UserProfileResource'][_0x3f54('0x52')]({'name':_0x51cf09[_0x3f54('0x32')],'resourceId':_0x51cf09['id'],'type':_0x22d243[_0x3f54('0x32')],'sectionId':_0x22d243['id']},{})['then'](function(){return _0x146cb4;});}else{return _0x146cb4;}})['catch'](function(_0x4b548c){logger[_0x3f54('0x30')](_0x3f54('0x59'),_0x4b548c);throw _0x4b548c;});}return _0x146cb4;})['then'](respondWithResult(_0x34f634,0xc9))[_0x3f54('0x4f')](handleError(_0x34f634,null));};exports[_0x3f54('0x5a')]=function(_0x4fa4cd,_0x12e646){var _0xcc28b4={'where':{'id':_0x4fa4cd['params']['id']}},_0x2d9243={};_0x2d9243[_0x3f54('0x39')]=_[_0x3f54('0x3a')](db['Dashboard'][_0x3f54('0x36')]);_0xcc28b4['attributes']=_[_0x3f54('0x3d')](_0x2d9243['model'],qs[_0x3f54('0x3e')](_0x4fa4cd['query'][_0x3f54('0x3e')]));_0xcc28b4[_0x3f54('0x3f')]=_0xcc28b4[_0x3f54('0x3f')][_0x3f54('0x40')]?_0xcc28b4[_0x3f54('0x3f')]:_0x2d9243[_0x3f54('0x39')];if(_0x4fa4cd['query'][_0x3f54('0x4b')]){_0xcc28b4[_0x3f54('0x4c')]=[{'all':!![]}];}_0xcc28b4=_[_0x3f54('0x48')]({},_0xcc28b4,_0x4fa4cd['options']);return db[_0x3f54('0x4a')][_0x3f54('0x51')](_0xcc28b4)[_0x3f54('0x2c')](handleEntityNotFound(_0x12e646,null))[_0x3f54('0x2c')](function(_0x22a8dd){if(_0x22a8dd){var _0x68094d=_0x22a8dd[_0x3f54('0x2e')]({'plain':!![]});_0x68094d=qs[_0x3f54('0x5b')](_0x68094d,['id',_0x3f54('0x5c'),_0x3f54('0x5d')]);_0x4fa4cd[_0x3f54('0x53')]=_[_0x3f54('0x5b')](_0x4fa4cd[_0x3f54('0x53')],['id','createdAt',_0x3f54('0x5d')]);return db[_0x3f54('0x4a')]['create'](_[_0x3f54('0x48')](_0x68094d,_0x4fa4cd[_0x3f54('0x53')]),{'include':_0x4fa4cd[_0x3f54('0x3b')][_0x3f54('0x4b')]?[{'all':!![]}]:undefined})[_0x3f54('0x2c')](function(_0xacf0f6){var _0x12854e=_0x4fa4cd[_0x3f54('0x54')][_0x3f54('0x2e')]({'plain':!![]});if(!_0x12854e)throw new Error(_0x3f54('0x5e'));if(_0x12854e[_0x3f54('0x55')]===_0x3f54('0x54')){var _0xef9b7a=_0xacf0f6['get']({'plain':!![]});var _0x1babde='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x1babde,'userProfileId':_0x12854e[_0x3f54('0x57')]},'raw':!![]})[_0x3f54('0x2c')](function(_0x4d2367){if(_0x4d2367&&_0x4d2367[_0x3f54('0x58')]===0x0){return db[_0x3f54('0x5f')][_0x3f54('0x52')]({'name':_0xef9b7a[_0x3f54('0x32')],'resourceId':_0xef9b7a['id'],'type':_0x4d2367['name'],'sectionId':_0x4d2367['id']},{})[_0x3f54('0x2c')](function(){return _0xacf0f6;});}else{return _0xacf0f6;}})[_0x3f54('0x4f')](function(_0x358843){logger[_0x3f54('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x358843);throw _0x358843;});}return _0xacf0f6;});}})[_0x3f54('0x2c')](respondWithResult(_0x12e646,0xc9))[_0x3f54('0x4f')](handleError(_0x12e646,null));};exports['update']=function(_0x35350f,_0x3d60c2){if(_0x35350f['body']['id']){delete _0x35350f[_0x3f54('0x53')]['id'];}return db['Dashboard'][_0x3f54('0x51')]({'where':{'id':_0x35350f[_0x3f54('0x60')]['id']}})['then'](handleEntityNotFound(_0x3d60c2,null))[_0x3f54('0x2c')](saveUpdates(_0x35350f[_0x3f54('0x53')],null))[_0x3f54('0x2c')](respondWithResult(_0x3d60c2,null))[_0x3f54('0x4f')](handleError(_0x3d60c2,null));};exports[_0x3f54('0x2d')]=function(_0x4b5b79,_0x7fb408){return db['Dashboard'][_0x3f54('0x51')]({'where':{'id':_0x4b5b79[_0x3f54('0x60')]['id']}})['then'](handleEntityNotFound(_0x7fb408,null))[_0x3f54('0x2c')](removeEntity(_0x7fb408,null))[_0x3f54('0x4f')](handleError(_0x7fb408,null));};function widgetAttributes(_0x3a3402){try{switch(_0x3a3402['type']){case _0x3f54('0x61'):return[{'name':'attrUrl','value':_0x3a3402[_0x3f54('0x62')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402['attrs'][0x0]?_0x3a3402[_0x3f54('0x63')][0x0][_0x3f54('0x64')]:undefined)||_0x3f54('0x65')}];case _0x3f54('0x66'):return[{'name':_0x3f54('0x67'),'value':_0x3a3402[_0x3f54('0x67')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402[_0x3f54('0x63')][0x0]?_0x3a3402[_0x3f54('0x63')][0x0][_0x3f54('0x64')]:undefined)||''}];case _0x3f54('0x68'):return[{'name':_0x3f54('0x69'),'value':_0x3a3402[_0x3f54('0x69')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402[_0x3f54('0x63')][0x0]?_0x3a3402['attrs'][0x0]['value']:undefined)||_0x3f54('0x6a')},{'name':_0x3f54('0x6b'),'value':_0x3a3402[_0x3f54('0x6b')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402[_0x3f54('0x63')][0x1]?_0x3a3402[_0x3f54('0x63')][0x1][_0x3f54('0x64')]:undefined)||'0.00'},{'name':_0x3f54('0x6c'),'value':_0x3a3402[_0x3f54('0x6c')]||(_0x3a3402['attrs']&&_0x3a3402[_0x3f54('0x63')][0x2]?_0x3a3402[_0x3f54('0x63')][0x2][_0x3f54('0x64')]:undefined)||0xc}];case _0x3f54('0x6d'):return[{'name':_0x3f54('0x6e'),'value':_0x3a3402[_0x3f54('0x6e')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402[_0x3f54('0x63')][0x0]?_0x3a3402[_0x3f54('0x63')][0x0][_0x3f54('0x64')]:undefined)||_0x3f54('0x6f')},{'name':'attrVoiceQueues','value':_0x3a3402[_0x3f54('0x70')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402[_0x3f54('0x63')][0x1]?_0x3a3402['attrs'][0x1][_0x3f54('0x64')]:undefined)||[]},{'name':_0x3f54('0x6c'),'value':_0x3a3402[_0x3f54('0x6c')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402[_0x3f54('0x63')][0x2]?_0x3a3402[_0x3f54('0x63')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0x3f54('0x71'):return[{'name':'attrSerie1','value':_0x3a3402[_0x3f54('0x72')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402[_0x3f54('0x63')][0x0]?_0x3a3402[_0x3f54('0x63')][0x0][_0x3f54('0x64')]:undefined)||_0x3f54('0x6f')},{'name':'attrSerie2','value':_0x3a3402[_0x3f54('0x73')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402[_0x3f54('0x63')][0x1]?_0x3a3402[_0x3f54('0x63')][0x1][_0x3f54('0x64')]:undefined)||null},{'name':_0x3f54('0x74'),'value':_0x3a3402[_0x3f54('0x74')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402['attrs'][0x2]?_0x3a3402['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x3a3402[_0x3f54('0x70')]||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402['attrs'][0x3]?_0x3a3402[_0x3f54('0x63')][0x3]['value']:undefined)||[]}];case _0x3f54('0x75'):return[{'name':_0x3f54('0x76'),'type':_0x3a3402[_0x3f54('0x77')]||(_0x3a3402['attrs']&&_0x3a3402[_0x3f54('0x63')][0x0]?_0x3a3402[_0x3f54('0x63')][0x0][_0x3f54('0x37')]:undefined)||null,'value':_0x3a3402['attrReport']||(_0x3a3402[_0x3f54('0x63')]&&_0x3a3402[_0x3f54('0x63')][0x0]?_0x3a3402[_0x3f54('0x63')][0x0]['value']:undefined)||null},{'name':_0x3f54('0x78'),'value':_0x3a3402[_0x3f54('0x78')]||(_0x3a3402['attrs']&&_0x3a3402[_0x3f54('0x63')][0x1]?_0x3a3402[_0x3f54('0x63')][0x1][_0x3f54('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x2d4731){logger['error'](_0x3f54('0x79'),JSON[_0x3f54('0x7a')](_0x2d4731));return[];}}exports[_0x3f54('0x7b')]=function(_0x4e2feb,_0xf7865c,_0x3c0fe6){if(_0x4e2feb[_0x3f54('0x53')]['id']){delete _0x4e2feb[_0x3f54('0x53')]['id'];}return db['Dashboard'][_0x3f54('0x51')]({'where':{'id':_0x4e2feb[_0x3f54('0x60')]['id']}})['then'](handleEntityNotFound(_0xf7865c,null))[_0x3f54('0x2c')](function(_0x1dc2ed){if(_0x1dc2ed){_0x4e2feb[_0x3f54('0x53')][_0x3f54('0x7c')]=_0x1dc2ed['id'];_0x4e2feb[_0x3f54('0x53')][_0x3f54('0x63')]=widgetAttributes(_0x4e2feb[_0x3f54('0x53')]);return db[_0x3f54('0x7d')][_0x3f54('0x52')](_0x4e2feb['body']);}})[_0x3f54('0x2c')](respondWithResult(_0xf7865c,null))[_0x3f54('0x4f')](handleError(_0xf7865c,null));};exports[_0x3f54('0x7e')]=function(_0x4b9356,_0x249959,_0x1b7ed3){var _0x1063ef={};var _0xe7f49b={};var _0xd10f33;var _0x5e0106;return db[_0x3f54('0x4a')][_0x3f54('0x7f')]({'where':{'id':_0x4b9356['params']['id']}})[_0x3f54('0x2c')](handleEntityNotFound(_0x249959,null))[_0x3f54('0x2c')](function(_0x372688){if(_0x372688){_0xd10f33=_0x372688;_0xe7f49b[_0x3f54('0x39')]=_[_0x3f54('0x3a')](db[_0x3f54('0x7d')][_0x3f54('0x36')]);_0xe7f49b['query']=_[_0x3f54('0x3a')](_0x4b9356[_0x3f54('0x3b')]);_0xe7f49b[_0x3f54('0x3c')]=_[_0x3f54('0x3d')](_0xe7f49b['model'],_0xe7f49b['query']);_0x1063ef['attributes']=_['intersection'](_0xe7f49b['model'],qs[_0x3f54('0x3e')](_0x4b9356['query']['fields']));_0x1063ef[_0x3f54('0x3f')]=_0x1063ef[_0x3f54('0x3f')][_0x3f54('0x40')]?_0x1063ef[_0x3f54('0x3f')]:_0xe7f49b['model'];_0x1063ef[_0x3f54('0x42')]=qs['sort'](_0x4b9356['query'][_0x3f54('0x43')]);_0x1063ef[_0x3f54('0x46')]=qs[_0x3f54('0x3c')](_[_0x3f54('0x44')](_0x4b9356[_0x3f54('0x3b')],_0xe7f49b[_0x3f54('0x3c')]));if(_0x4b9356[_0x3f54('0x3b')]['filter']){_0x1063ef['where']=_[_0x3f54('0x48')](_0x1063ef[_0x3f54('0x46')],{'$or':_[_0x3f54('0x35')](_0x1063ef[_0x3f54('0x3f')],function(_0x48b7bf){var _0x2eb19b={};_0x2eb19b[_0x48b7bf]={'$like':'%'+_0x4b9356[_0x3f54('0x3b')]['filter']+'%'};return _0x2eb19b;})});}_0x1063ef=_[_0x3f54('0x48')]({},_0x1063ef,_0x4b9356[_0x3f54('0x49')]);return _0xd10f33[_0x3f54('0x7e')](_0x1063ef);}})[_0x3f54('0x2c')](function(_0xca26d4){if(_0xca26d4){_0x5e0106=_0xca26d4[_0x3f54('0x40')];if(!_0x4b9356[_0x3f54('0x3b')]['hasOwnProperty'](_0x3f54('0x41'))){_0x1063ef['limit']=qs[_0x3f54('0x24')](_0x4b9356['query']['limit']);_0x1063ef[_0x3f54('0x27')]=qs[_0x3f54('0x27')](_0x4b9356[_0x3f54('0x3b')][_0x3f54('0x27')]);}return _0xd10f33[_0x3f54('0x7e')](_0x1063ef);}})['then'](function(_0x401cf4){if(_0x401cf4){return _0x401cf4?{'count':_0x5e0106,'rows':_0x401cf4}:null;}})[_0x3f54('0x2c')](respondWithResult(_0x249959,null))[_0x3f54('0x4f')](handleError(_0x249959,null));}; \ No newline at end of file +var _0x6a25=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','clone','rawAttributes','include','updatedAt','omit','createdAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','filter','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','apply','then','get','CustomDashboards','destroy','end','error','stack','name','send','fieldName','type','key','map','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','sort','where','options','Dashboard','includeAll','findAll','rows','show','params','merge','find','catch','create','user'];(function(_0x1913c1,_0xe25386){var _0x45b05a=function(_0xe8bac9){while(--_0xe8bac9){_0x1913c1['push'](_0x1913c1['shift']());}};_0x45b05a(++_0xe25386);}(_0x6a25,0x18e));var _0x56a2=function(_0xfd79ad,_0x5940c7){_0xfd79ad=_0xfd79ad-0x0;var _0x2432ea=_0x6a25[_0xfd79ad];return _0x2432ea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x56a2('0x0'));var jsonpatch=require(_0x56a2('0x1'));var rp=require(_0x56a2('0x2'));var moment=require(_0x56a2('0x3'));var BPromise=require(_0x56a2('0x4'));var Mustache=require(_0x56a2('0x5'));var util=require('util');var path=require(_0x56a2('0x6'));var sox=require(_0x56a2('0x7'));var csv=require(_0x56a2('0x8'));var ejs=require(_0x56a2('0x9'));var fs=require('fs');var fs_extra=require(_0x56a2('0xa'));var _=require(_0x56a2('0xb'));var squel=require(_0x56a2('0xc'));var crypto=require(_0x56a2('0xd'));var jsforce=require(_0x56a2('0xe'));var deskjs=require(_0x56a2('0xf'));var toCsv=require(_0x56a2('0x8'));var querystring=require(_0x56a2('0x10'));var Papa=require(_0x56a2('0x11'));var Redis=require(_0x56a2('0x12'));var authService=require(_0x56a2('0x13'));var qs=require(_0x56a2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56a2('0x15'));var logger=require(_0x56a2('0x16'))(_0x56a2('0x17'));var utils=require(_0x56a2('0x18'));var config=require(_0x56a2('0x19'));var licenseUtil=require(_0x56a2('0x1a'));var db=require('../../mysqldb')['db'];config[_0x56a2('0x1b')]=_[_0x56a2('0x1c')](config[_0x56a2('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x56a2('0x1d'))(new Redis(config[_0x56a2('0x1b')]));require(_0x56a2('0x1e'))[_0x56a2('0x1f')](socket);function respondWithStatusCode(_0x193dee,_0x5e6df6){_0x5e6df6=_0x5e6df6||0xcc;return function(_0x1976ed){if(_0x1976ed){return _0x193dee[_0x56a2('0x20')](_0x5e6df6);}return _0x193dee[_0x56a2('0x21')](_0x5e6df6)['end']();};}function respondWithResult(_0x436237,_0x1d66ef){_0x1d66ef=_0x1d66ef||0xc8;return function(_0x24e922){if(_0x24e922){return _0x436237['status'](_0x1d66ef)[_0x56a2('0x22')](_0x24e922);}};}function respondWithFilteredResult(_0x480bcf,_0x57d4d0){return function(_0x23ce5e){if(_0x23ce5e){var _0x761199=typeof _0x57d4d0[_0x56a2('0x23')]===_0x56a2('0x24')&&typeof _0x57d4d0['limit']==='undefined';var _0x2b6792=_0x23ce5e[_0x56a2('0x25')];var _0x3be0f3=_0x761199?0x0:_0x57d4d0['offset'];var _0x2a3f3c=_0x761199?_0x23ce5e[_0x56a2('0x25')]:_0x57d4d0[_0x56a2('0x23')]+_0x57d4d0[_0x56a2('0x26')];var _0x573e78;if(_0x2a3f3c>=_0x2b6792){_0x2a3f3c=_0x2b6792;_0x573e78=0xc8;}else{_0x573e78=0xce;}_0x480bcf[_0x56a2('0x21')](_0x573e78);return _0x480bcf[_0x56a2('0x27')]('Content-Range',_0x3be0f3+'-'+_0x2a3f3c+'/'+_0x2b6792)[_0x56a2('0x22')](_0x23ce5e);}return null;};}function patchUpdates(_0x2fdfd0){return function(_0x49f0ba){try{jsonpatch[_0x56a2('0x28')](_0x49f0ba,_0x2fdfd0,!![]);}catch(_0x10dc33){return BPromise['reject'](_0x10dc33);}return _0x49f0ba['save']();};}function saveUpdates(_0x25a6a8,_0x2f3b5f){return function(_0x4cee79){if(_0x4cee79){return _0x4cee79['update'](_0x25a6a8)[_0x56a2('0x29')](function(_0x32d7ea){return _0x32d7ea;});}return null;};}function removeEntity(_0x4ccae7,_0x5970a3){return function(_0x93f036){if(_0x93f036){return _0x93f036['destroy']()[_0x56a2('0x29')](function(){var _0x51c721=_0x93f036[_0x56a2('0x2a')]({'plain':!![]});var _0x5755df=_0x56a2('0x2b');return db['UserProfileResource'][_0x56a2('0x2c')]({'where':{'type':_0x5755df,'resourceId':_0x51c721['id']}})['then'](function(){return _0x93f036;});})[_0x56a2('0x29')](function(){_0x4ccae7[_0x56a2('0x21')](0xcc)[_0x56a2('0x2d')]();});}};}function handleEntityNotFound(_0x10683c,_0x367644){return function(_0x1c76e1){if(!_0x1c76e1){_0x10683c[_0x56a2('0x20')](0x194);}return _0x1c76e1;};}function handleError(_0x4c8c97,_0x14e219){_0x14e219=_0x14e219||0x1f4;return function(_0x444638){logger[_0x56a2('0x2e')](_0x444638[_0x56a2('0x2f')]);if(_0x444638[_0x56a2('0x30')]){delete _0x444638['name'];}_0x4c8c97[_0x56a2('0x21')](_0x14e219)[_0x56a2('0x31')](_0x444638);};}exports['index']=function(_0x22e42b,_0x16d2e1){var _0x1132c9={},_0x4fcfeb={},_0x145900={'count':0x0,'rows':[]};var _0x50e33e=_['map'](db['Dashboard']['rawAttributes'],function(_0x569e45){return{'name':_0x569e45[_0x56a2('0x32')],'type':_0x569e45[_0x56a2('0x33')][_0x56a2('0x34')]};});_0x4fcfeb['model']=_[_0x56a2('0x35')](_0x50e33e,_0x56a2('0x30'));_0x4fcfeb[_0x56a2('0x36')]=_[_0x56a2('0x37')](_0x22e42b['query']);_0x4fcfeb[_0x56a2('0x38')]=_['intersection'](_0x4fcfeb['model'],_0x4fcfeb[_0x56a2('0x36')]);_0x1132c9[_0x56a2('0x39')]=_[_0x56a2('0x3a')](_0x4fcfeb['model'],qs[_0x56a2('0x3b')](_0x22e42b[_0x56a2('0x36')][_0x56a2('0x3b')]));_0x1132c9['attributes']=_0x1132c9['attributes'][_0x56a2('0x3c')]?_0x1132c9[_0x56a2('0x39')]:_0x4fcfeb[_0x56a2('0x3d')];if(!_0x22e42b[_0x56a2('0x36')][_0x56a2('0x3e')](_0x56a2('0x3f'))){_0x1132c9['limit']=qs[_0x56a2('0x26')](_0x22e42b[_0x56a2('0x36')]['limit']);_0x1132c9[_0x56a2('0x23')]=qs['offset'](_0x22e42b[_0x56a2('0x36')][_0x56a2('0x23')]);}_0x1132c9['order']=qs[_0x56a2('0x40')](_0x22e42b[_0x56a2('0x36')][_0x56a2('0x40')]);_0x1132c9['where']=qs[_0x56a2('0x38')](_['pick'](_0x22e42b[_0x56a2('0x36')],_0x4fcfeb['filters']),_0x50e33e);if(_0x22e42b[_0x56a2('0x36')]['filter']){_0x1132c9[_0x56a2('0x41')]=_['merge'](_0x1132c9[_0x56a2('0x41')],{'$or':_[_0x56a2('0x35')](_0x50e33e,function(_0x49519d){if(_0x49519d['type']!=='VIRTUAL'){var _0x3e76a7={};_0x3e76a7[_0x49519d['name']]={'$like':'%'+_0x22e42b[_0x56a2('0x36')]['filter']+'%'};return _0x3e76a7;}})});}_0x1132c9=_['merge']({},_0x1132c9,_0x22e42b[_0x56a2('0x42')]);var _0x365f49={'where':_0x1132c9['where']};return db[_0x56a2('0x43')]['count'](_0x365f49)[_0x56a2('0x29')](function(_0x35ddf6){_0x145900[_0x56a2('0x25')]=_0x35ddf6;if(_0x22e42b[_0x56a2('0x36')][_0x56a2('0x44')]){_0x1132c9['include']=[{'all':!![]}];}return db['Dashboard'][_0x56a2('0x45')](_0x1132c9);})[_0x56a2('0x29')](function(_0xfe4e1d){_0x145900[_0x56a2('0x46')]=_0xfe4e1d;return _0x145900;})[_0x56a2('0x29')](respondWithFilteredResult(_0x16d2e1,_0x1132c9))['catch'](handleError(_0x16d2e1,null));};exports[_0x56a2('0x47')]=function(_0x204a0f,_0x1126d5){var _0x47bbb8={'raw':![],'where':{'id':_0x204a0f[_0x56a2('0x48')]['id']}},_0x57c9ed={};_0x57c9ed[_0x56a2('0x3d')]=_[_0x56a2('0x37')](db[_0x56a2('0x43')]['rawAttributes']);_0x57c9ed[_0x56a2('0x36')]=_[_0x56a2('0x37')](_0x204a0f['query']);_0x57c9ed[_0x56a2('0x38')]=_['intersection'](_0x57c9ed[_0x56a2('0x3d')],_0x57c9ed[_0x56a2('0x36')]);_0x47bbb8[_0x56a2('0x39')]=_[_0x56a2('0x3a')](_0x57c9ed[_0x56a2('0x3d')],qs[_0x56a2('0x3b')](_0x204a0f[_0x56a2('0x36')][_0x56a2('0x3b')]));_0x47bbb8[_0x56a2('0x39')]=_0x47bbb8[_0x56a2('0x39')][_0x56a2('0x3c')]?_0x47bbb8[_0x56a2('0x39')]:_0x57c9ed[_0x56a2('0x3d')];if(_0x204a0f['query'][_0x56a2('0x44')]){_0x47bbb8['include']=[{'all':!![]}];}_0x47bbb8=_[_0x56a2('0x49')]({},_0x47bbb8,_0x204a0f[_0x56a2('0x42')]);return db[_0x56a2('0x43')][_0x56a2('0x4a')](_0x47bbb8)[_0x56a2('0x29')](handleEntityNotFound(_0x1126d5,null))['then'](respondWithResult(_0x1126d5,null))[_0x56a2('0x4b')](handleError(_0x1126d5,null));};exports[_0x56a2('0x4c')]=function(_0x570eba,_0x3362b4){return db[_0x56a2('0x43')][_0x56a2('0x4c')](_0x570eba['body'],{})[_0x56a2('0x29')](function(_0x39d5a7){var _0x327a47=_0x570eba[_0x56a2('0x4d')]['get']({'plain':!![]});if(!_0x327a47)throw new Error(_0x56a2('0x4e'));if(_0x327a47[_0x56a2('0x4f')]===_0x56a2('0x4d')){var _0x31340c=_0x39d5a7[_0x56a2('0x2a')]({'plain':!![]});var _0x3b6ad3=_0x56a2('0x2b');return db[_0x56a2('0x50')]['find']({'where':{'name':_0x3b6ad3,'userProfileId':_0x327a47['userProfileId']},'raw':!![]})[_0x56a2('0x29')](function(_0xdb5433){if(_0xdb5433&&_0xdb5433[_0x56a2('0x51')]===0x0){return db[_0x56a2('0x52')][_0x56a2('0x4c')]({'name':_0x31340c['name'],'resourceId':_0x31340c['id'],'type':_0xdb5433[_0x56a2('0x30')],'sectionId':_0xdb5433['id']},{})[_0x56a2('0x29')](function(){return _0x39d5a7;});}else{return _0x39d5a7;}})[_0x56a2('0x4b')](function(_0x5a05b7){logger[_0x56a2('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a05b7);throw _0x5a05b7;});}return _0x39d5a7;})[_0x56a2('0x29')](respondWithResult(_0x3362b4,0xc9))[_0x56a2('0x4b')](handleError(_0x3362b4,null));};exports[_0x56a2('0x53')]=function(_0x3e6f4d,_0x53fe99){var _0x56d11d={'where':{'id':_0x3e6f4d[_0x56a2('0x48')]['id']}},_0x11b803={};_0x11b803[_0x56a2('0x3d')]=_[_0x56a2('0x37')](db[_0x56a2('0x43')][_0x56a2('0x54')]);_0x56d11d[_0x56a2('0x39')]=_[_0x56a2('0x3a')](_0x11b803[_0x56a2('0x3d')],qs['fields'](_0x3e6f4d['query'][_0x56a2('0x3b')]));_0x56d11d['attributes']=_0x56d11d[_0x56a2('0x39')][_0x56a2('0x3c')]?_0x56d11d['attributes']:_0x11b803[_0x56a2('0x3d')];if(_0x3e6f4d[_0x56a2('0x36')]['includeAll']){_0x56d11d[_0x56a2('0x55')]=[{'all':!![]}];}_0x56d11d=_[_0x56a2('0x49')]({},_0x56d11d,_0x3e6f4d['options']);return db[_0x56a2('0x43')]['find'](_0x56d11d)[_0x56a2('0x29')](handleEntityNotFound(_0x53fe99,null))[_0x56a2('0x29')](function(_0x2547d8){if(_0x2547d8){var _0x11e34a=_0x2547d8['get']({'plain':!![]});_0x11e34a=qs['omit'](_0x11e34a,['id','createdAt',_0x56a2('0x56')]);_0x3e6f4d['body']=_[_0x56a2('0x57')](_0x3e6f4d['body'],['id',_0x56a2('0x58'),_0x56a2('0x56')]);return db['Dashboard'][_0x56a2('0x4c')](_[_0x56a2('0x49')](_0x11e34a,_0x3e6f4d[_0x56a2('0x59')]),{'include':_0x3e6f4d['query']['includeAll']?[{'all':!![]}]:undefined})[_0x56a2('0x29')](function(_0x4c713b){var _0x59c76d=_0x3e6f4d[_0x56a2('0x4d')][_0x56a2('0x2a')]({'plain':!![]});if(!_0x59c76d)throw new Error(_0x56a2('0x4e'));if(_0x59c76d[_0x56a2('0x4f')]==='user'){var _0x2683be=_0x4c713b[_0x56a2('0x2a')]({'plain':!![]});var _0x238071=_0x56a2('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x238071,'userProfileId':_0x59c76d['userProfileId']},'raw':!![]})['then'](function(_0x67c69f){if(_0x67c69f&&_0x67c69f[_0x56a2('0x51')]===0x0){return db[_0x56a2('0x52')]['create']({'name':_0x2683be[_0x56a2('0x30')],'resourceId':_0x2683be['id'],'type':_0x67c69f[_0x56a2('0x30')],'sectionId':_0x67c69f['id']},{})[_0x56a2('0x29')](function(){return _0x4c713b;});}else{return _0x4c713b;}})[_0x56a2('0x4b')](function(_0x48b150){logger[_0x56a2('0x2e')](_0x56a2('0x5a'),_0x48b150);throw _0x48b150;});}return _0x4c713b;});}})[_0x56a2('0x29')](respondWithResult(_0x53fe99,0xc9))[_0x56a2('0x4b')](handleError(_0x53fe99,null));};exports['update']=function(_0xc9f412,_0x393bd1){if(_0xc9f412['body']['id']){delete _0xc9f412['body']['id'];}return db[_0x56a2('0x43')][_0x56a2('0x4a')]({'where':{'id':_0xc9f412['params']['id']}})[_0x56a2('0x29')](handleEntityNotFound(_0x393bd1,null))[_0x56a2('0x29')](saveUpdates(_0xc9f412[_0x56a2('0x59')],null))[_0x56a2('0x29')](respondWithResult(_0x393bd1,null))[_0x56a2('0x4b')](handleError(_0x393bd1,null));};exports['destroy']=function(_0x4bc198,_0x41e092){return db[_0x56a2('0x43')][_0x56a2('0x4a')]({'where':{'id':_0x4bc198[_0x56a2('0x48')]['id']}})['then'](handleEntityNotFound(_0x41e092,null))[_0x56a2('0x29')](removeEntity(_0x41e092,null))['catch'](handleError(_0x41e092,null));};function widgetAttributes(_0x394924){try{switch(_0x394924[_0x56a2('0x33')]){case _0x56a2('0x5b'):return[{'name':'attrUrl','value':_0x394924[_0x56a2('0x5c')]||(_0x394924['attrs']&&_0x394924[_0x56a2('0x5d')][0x0]?_0x394924[_0x56a2('0x5d')][0x0][_0x56a2('0x5e')]:undefined)||_0x56a2('0x5f')}];case _0x56a2('0x60'):return[{'name':'attrPath','value':_0x394924[_0x56a2('0x61')]||(_0x394924['attrs']&&_0x394924[_0x56a2('0x5d')][0x0]?_0x394924[_0x56a2('0x5d')][0x0][_0x56a2('0x5e')]:undefined)||''}];case _0x56a2('0x62'):return[{'name':_0x56a2('0x63'),'value':_0x394924[_0x56a2('0x63')]||(_0x394924[_0x56a2('0x5d')]&&_0x394924[_0x56a2('0x5d')][0x0]?_0x394924[_0x56a2('0x5d')][0x0][_0x56a2('0x5e')]:undefined)||_0x56a2('0x64')},{'name':_0x56a2('0x65'),'value':_0x394924['attrTimezone']||(_0x394924[_0x56a2('0x5d')]&&_0x394924['attrs'][0x1]?_0x394924['attrs'][0x1][_0x56a2('0x5e')]:undefined)||_0x56a2('0x66')},{'name':'attrFontSize','value':_0x394924[_0x56a2('0x67')]||(_0x394924['attrs']&&_0x394924[_0x56a2('0x5d')][0x2]?_0x394924[_0x56a2('0x5d')][0x2][_0x56a2('0x5e')]:undefined)||0xc}];case _0x56a2('0x68'):return[{'name':_0x56a2('0x69'),'value':_0x394924['attrMetric']||(_0x394924['attrs']&&_0x394924[_0x56a2('0x5d')][0x0]?_0x394924[_0x56a2('0x5d')][0x0]['value']:undefined)||'total'},{'name':_0x56a2('0x6a'),'value':_0x394924[_0x56a2('0x6a')]||(_0x394924[_0x56a2('0x5d')]&&_0x394924['attrs'][0x1]?_0x394924[_0x56a2('0x5d')][0x1][_0x56a2('0x5e')]:undefined)||[]},{'name':_0x56a2('0x67'),'value':_0x394924[_0x56a2('0x67')]||(_0x394924[_0x56a2('0x5d')]&&_0x394924[_0x56a2('0x5d')][0x2]?_0x394924[_0x56a2('0x5d')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0x56a2('0x6b'):return[{'name':_0x56a2('0x6c'),'value':_0x394924[_0x56a2('0x6c')]||(_0x394924[_0x56a2('0x5d')]&&_0x394924['attrs'][0x0]?_0x394924[_0x56a2('0x5d')][0x0][_0x56a2('0x5e')]:undefined)||'total'},{'name':_0x56a2('0x6d'),'value':_0x394924['attrSerie2']||(_0x394924['attrs']&&_0x394924[_0x56a2('0x5d')][0x1]?_0x394924[_0x56a2('0x5d')][0x1]['value']:undefined)||null},{'name':_0x56a2('0x6e'),'value':_0x394924[_0x56a2('0x6e')]||(_0x394924[_0x56a2('0x5d')]&&_0x394924[_0x56a2('0x5d')][0x2]?_0x394924[_0x56a2('0x5d')][0x2][_0x56a2('0x5e')]:undefined)||null},{'name':_0x56a2('0x6a'),'value':_0x394924['attrVoiceQueues']||(_0x394924[_0x56a2('0x5d')]&&_0x394924['attrs'][0x3]?_0x394924['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x394924['reportType']||(_0x394924[_0x56a2('0x5d')]&&_0x394924[_0x56a2('0x5d')][0x0]?_0x394924[_0x56a2('0x5d')][0x0][_0x56a2('0x33')]:undefined)||null,'value':_0x394924['attrReport']||(_0x394924[_0x56a2('0x5d')]&&_0x394924[_0x56a2('0x5d')][0x0]?_0x394924[_0x56a2('0x5d')][0x0]['value']:undefined)||null},{'name':_0x56a2('0x6f'),'value':_0x394924[_0x56a2('0x6f')]||(_0x394924[_0x56a2('0x5d')]&&_0x394924['attrs'][0x1]?_0x394924[_0x56a2('0x5d')][0x1][_0x56a2('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x403fd8){logger[_0x56a2('0x2e')](_0x56a2('0x70'),JSON[_0x56a2('0x71')](_0x403fd8));return[];}}exports['addItem']=function(_0x26c379,_0x5d6c06,_0x4a292e){if(_0x26c379['body']['id']){delete _0x26c379[_0x56a2('0x59')]['id'];}return db[_0x56a2('0x43')][_0x56a2('0x4a')]({'where':{'id':_0x26c379[_0x56a2('0x48')]['id']}})[_0x56a2('0x29')](handleEntityNotFound(_0x5d6c06,null))[_0x56a2('0x29')](function(_0xd220ab){if(_0xd220ab){_0x26c379[_0x56a2('0x59')][_0x56a2('0x72')]=_0xd220ab['id'];_0x26c379[_0x56a2('0x59')][_0x56a2('0x5d')]=widgetAttributes(_0x26c379[_0x56a2('0x59')]);return db[_0x56a2('0x73')][_0x56a2('0x4c')](_0x26c379[_0x56a2('0x59')]);}})[_0x56a2('0x29')](respondWithResult(_0x5d6c06,null))[_0x56a2('0x4b')](handleError(_0x5d6c06,null));};exports[_0x56a2('0x74')]=function(_0x4f63af,_0x393044,_0x4a940d){var _0x312eaa={};var _0x227419={};var _0x2c2aa6;var _0x4cee97;return db[_0x56a2('0x43')][_0x56a2('0x75')]({'where':{'id':_0x4f63af[_0x56a2('0x48')]['id']}})[_0x56a2('0x29')](handleEntityNotFound(_0x393044,null))[_0x56a2('0x29')](function(_0x532526){if(_0x532526){_0x2c2aa6=_0x532526;_0x227419[_0x56a2('0x3d')]=_[_0x56a2('0x37')](db[_0x56a2('0x73')]['rawAttributes']);_0x227419[_0x56a2('0x36')]=_['keys'](_0x4f63af[_0x56a2('0x36')]);_0x227419[_0x56a2('0x38')]=_[_0x56a2('0x3a')](_0x227419[_0x56a2('0x3d')],_0x227419[_0x56a2('0x36')]);_0x312eaa['attributes']=_[_0x56a2('0x3a')](_0x227419['model'],qs[_0x56a2('0x3b')](_0x4f63af[_0x56a2('0x36')][_0x56a2('0x3b')]));_0x312eaa[_0x56a2('0x39')]=_0x312eaa[_0x56a2('0x39')][_0x56a2('0x3c')]?_0x312eaa[_0x56a2('0x39')]:_0x227419[_0x56a2('0x3d')];_0x312eaa['order']=qs[_0x56a2('0x40')](_0x4f63af[_0x56a2('0x36')][_0x56a2('0x40')]);_0x312eaa[_0x56a2('0x41')]=qs[_0x56a2('0x38')](_['pick'](_0x4f63af[_0x56a2('0x36')],_0x227419[_0x56a2('0x38')]));if(_0x4f63af['query']['filter']){_0x312eaa['where']=_['merge'](_0x312eaa['where'],{'$or':_['map'](_0x312eaa['attributes'],function(_0x3fa15f){var _0x1ba651={};_0x1ba651[_0x3fa15f]={'$like':'%'+_0x4f63af['query'][_0x56a2('0x76')]+'%'};return _0x1ba651;})});}_0x312eaa=_[_0x56a2('0x49')]({},_0x312eaa,_0x4f63af[_0x56a2('0x42')]);return _0x2c2aa6[_0x56a2('0x74')](_0x312eaa);}})[_0x56a2('0x29')](function(_0x263a57){if(_0x263a57){_0x4cee97=_0x263a57[_0x56a2('0x3c')];if(!_0x4f63af['query'][_0x56a2('0x3e')](_0x56a2('0x3f'))){_0x312eaa[_0x56a2('0x26')]=qs[_0x56a2('0x26')](_0x4f63af[_0x56a2('0x36')][_0x56a2('0x26')]);_0x312eaa['offset']=qs[_0x56a2('0x23')](_0x4f63af['query'][_0x56a2('0x23')]);}return _0x2c2aa6[_0x56a2('0x74')](_0x312eaa);}})['then'](function(_0x4d7bd6){if(_0x4d7bd6){return _0x4d7bd6?{'count':_0x4cee97,'rows':_0x4d7bd6}:null;}})[_0x56a2('0x29')](respondWithResult(_0x393044,null))[_0x56a2('0x4b')](handleError(_0x393044,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b88bbe3..958607e 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 _0xbbd7=['hook','exports','../../mysqldb','Dashboard','remove','emit'];(function(_0x3c2883,_0x4b3c4f){var _0x5525a0=function(_0x539114){while(--_0x539114){_0x3c2883['push'](_0x3c2883['shift']());}};_0x5525a0(++_0x4b3c4f);}(_0xbbd7,0x8c));var _0x7bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x7bbd('0x0'))['db'][_0x7bbd('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7bbd('0x2')};function emitEvent(_0x2c5d1f){return function(_0xf52fd0,_0xd082df,_0x34ff60){DashboardEvents[_0x7bbd('0x3')](_0x2c5d1f+':'+_0xf52fd0['id'],_0xf52fd0);DashboardEvents[_0x7bbd('0x3')](_0x2c5d1f,_0xf52fd0);_0x34ff60(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x7bbd('0x4')](e,emitEvent(event));}}module[_0x7bbd('0x5')]=DashboardEvents; \ No newline at end of file +var _0x1122=['exports','events','Dashboard','setMaxListeners','save','update','remove','emit','hook'];(function(_0x48f29a,_0x1f9f1a){var _0x467232=function(_0xf1ae7e){while(--_0xf1ae7e){_0x48f29a['push'](_0x48f29a['shift']());}};_0x467232(++_0x1f9f1a);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2112('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x2112('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2112('0x2')](0x0);var events={'afterCreate':_0x2112('0x3'),'afterUpdate':_0x2112('0x4'),'afterDestroy':_0x2112('0x5')};function emitEvent(_0x4f2bbe){return function(_0x5e16d6,_0x20d49a,_0x4c5a48){DashboardEvents[_0x2112('0x6')](_0x4f2bbe+':'+_0x5e16d6['id'],_0x5e16d6);DashboardEvents[_0x2112('0x6')](_0x4f2bbe,_0x5e16d6);_0x4c5a48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x2112('0x7')](e,emitEvent(event));}}module[_0x2112('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index b4a26f5..ff50273 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 _0x153b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Dashboard','dashboards','lodash','util'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x153b,0x9a));var _0xb153=function(_0xb14b6e,_0x4bc4be){_0xb14b6e=_0xb14b6e-0x0;var _0x864f4f=_0x153b[_0xb14b6e];return _0x864f4f;};'use strict';var _=require(_0xb153('0x0'));var util=require(_0xb153('0x1'));var logger=require(_0xb153('0x2'))(_0xb153('0x3'));var moment=require(_0xb153('0x4'));var BPromise=require(_0xb153('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb153('0x6'));var rimraf=require(_0xb153('0x7'));var config=require(_0xb153('0x8'));var attributes=require('./dashboard.attributes');module[_0xb153('0x9')]=function(_0x7b28cc,_0x5c594a){return _0x7b28cc[_0xb153('0xa')](_0xb153('0xb'),attributes,{'tableName':_0xb153('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92e2=['../../config/environment','define','Dashboard','dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92e2,0x19c));var _0x292e=function(_0x55de81,_0x1ebe60){_0x55de81=_0x55de81-0x0;var _0x21d6e6=_0x92e2[_0x55de81];return _0x21d6e6;};'use strict';var _=require(_0x292e('0x0'));var util=require('util');var logger=require(_0x292e('0x1'))(_0x292e('0x2'));var moment=require(_0x292e('0x3'));var BPromise=require(_0x292e('0x4'));var rp=require(_0x292e('0x5'));var fs=require('fs');var path=require(_0x292e('0x6'));var rimraf=require(_0x292e('0x7'));var config=require(_0x292e('0x8'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x438572,_0x4aba1e){return _0x438572[_0x292e('0x9')](_0x292e('0xa'),attributes,{'tableName':_0x292e('0xb'),'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 be410ec..b231af5 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 _0x9321=['info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','redis','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1350f6,_0x20b3ca){var _0x2acea6=function(_0x47c106){while(--_0x47c106){_0x1350f6['push'](_0x1350f6['shift']());}};_0x2acea6(++_0x20b3ca);}(_0x9321,0xf6));var _0x1932=function(_0x26a60a,_0x4d1a6f){_0x26a60a=_0x26a60a-0x0;var _0x4246f9=_0x9321[_0x26a60a];return _0x4246f9;};'use strict';var _=require(_0x1932('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1932('0x1'));var rs=require(_0x1932('0x2'));var fs=require('fs');var Redis=require(_0x1932('0x3'));var db=require(_0x1932('0x4'))['db'];var utils=require(_0x1932('0x5'));var logger=require(_0x1932('0x6'))(_0x1932('0x7'));var config=require('../../config/environment');var jayson=require(_0x1932('0x8'));var client=jayson[_0x1932('0x9')][_0x1932('0xa')]({'port':0x232a});config['redis']=_[_0x1932('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1932('0xc'))(new Redis(config[_0x1932('0xd')]));require(_0x1932('0xe'))[_0x1932('0xf')](socket);function respondWithRpcPromise(_0x4cb6c7,_0x55461c,_0x4b2cb9){return new BPromise(function(_0x2965cd,_0x14a0d6){return client[_0x1932('0x10')](_0x4cb6c7,_0x4b2cb9)['then'](function(_0x233acd){logger['info'](_0x1932('0x11'),_0x55461c,_0x1932('0x12'));logger['debug'](_0x1932('0x13'),_0x55461c,'request\x20sent',JSON[_0x1932('0x14')](_0x233acd));if(_0x233acd[_0x1932('0x15')]){if(_0x233acd[_0x1932('0x15')][_0x1932('0x16')]===0x1f4){logger['error'](_0x1932('0x11'),_0x55461c,_0x233acd[_0x1932('0x15')][_0x1932('0x17')]);return _0x14a0d6(_0x233acd[_0x1932('0x15')][_0x1932('0x17')]);}logger[_0x1932('0x15')](_0x1932('0x11'),_0x55461c,_0x233acd[_0x1932('0x15')][_0x1932('0x17')]);return _0x2965cd(_0x233acd[_0x1932('0x15')][_0x1932('0x17')]);}else{logger[_0x1932('0x18')](_0x1932('0x11'),_0x55461c,_0x1932('0x12'));_0x2965cd(_0x233acd[_0x1932('0x19')][_0x1932('0x17')]);}})[_0x1932('0x1a')](function(_0x4ae52a){logger[_0x1932('0x15')]('Dashboard,\x20%s,\x20%s',_0x55461c,_0x4ae52a);_0x14a0d6(_0x4ae52a);});});} \ No newline at end of file +var _0xade7=['lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','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','message','result','catch'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xade7,0xd8));var _0x7ade=function(_0x285db,_0x4f4926){_0x285db=_0x285db-0x0;var _0x2ebec6=_0xade7[_0x285db];return _0x2ebec6;};'use strict';var _=require(_0x7ade('0x0'));var util=require(_0x7ade('0x1'));var moment=require('moment');var BPromise=require(_0x7ade('0x2'));var rs=require(_0x7ade('0x3'));var fs=require('fs');var Redis=require(_0x7ade('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7ade('0x5'))(_0x7ade('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ade('0x7'));var client=jayson[_0x7ade('0x8')][_0x7ade('0x9')]({'port':0x232a});config[_0x7ade('0xa')]=_[_0x7ade('0xb')](config[_0x7ade('0xa')],{'host':_0x7ade('0xc'),'port':0x18eb});var socket=require(_0x7ade('0xd'))(new Redis(config[_0x7ade('0xa')]));require(_0x7ade('0xe'))[_0x7ade('0xf')](socket);function respondWithRpcPromise(_0x53785f,_0x15b9c5,_0x49e407){return new BPromise(function(_0x533882,_0x43293c){return client[_0x7ade('0x10')](_0x53785f,_0x49e407)[_0x7ade('0x11')](function(_0x20afdd){logger[_0x7ade('0x12')](_0x7ade('0x13'),_0x15b9c5,_0x7ade('0x14'));logger[_0x7ade('0x15')](_0x7ade('0x16'),_0x15b9c5,'request\x20sent',JSON['stringify'](_0x20afdd));if(_0x20afdd[_0x7ade('0x17')]){if(_0x20afdd['error']['code']===0x1f4){logger[_0x7ade('0x17')](_0x7ade('0x13'),_0x15b9c5,_0x20afdd[_0x7ade('0x17')][_0x7ade('0x18')]);return _0x43293c(_0x20afdd['error'][_0x7ade('0x18')]);}logger[_0x7ade('0x17')]('Dashboard,\x20%s,\x20%s',_0x15b9c5,_0x20afdd[_0x7ade('0x17')]['message']);return _0x533882(_0x20afdd[_0x7ade('0x17')]['message']);}else{logger[_0x7ade('0x12')]('Dashboard,\x20%s,\x20%s',_0x15b9c5,_0x7ade('0x14'));_0x533882(_0x20afdd[_0x7ade('0x19')][_0x7ade('0x18')]);}})[_0x7ade('0x1a')](function(_0x312269){logger[_0x7ade('0x17')]('Dashboard,\x20%s,\x20%s',_0x15b9c5,_0x312269);_0x43293c(_0x312269);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index b70cd91..3f975bd 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 _0xb96b=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register','length'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb96b,0x18d));var _0xbb96=function(_0x3753f5,_0x12a1f1){_0x3753f5=_0x3753f5-0x0;var _0x419010=_0xb96b[_0x3753f5];return _0x419010;};'use strict';var DashboardEvents=require(_0xbb96('0x0'));var events=[_0xbb96('0x1'),_0xbb96('0x2'),_0xbb96('0x3')];function createListener(_0x1981da,_0x23d6fd){return function(_0x2d3144){_0x23d6fd[_0xbb96('0x4')](_0x1981da,_0x2d3144);};}function removeListener(_0x170931,_0xd6a6f7){return function(){DashboardEvents[_0xbb96('0x5')](_0x170931,_0xd6a6f7);};}exports[_0xbb96('0x6')]=function(_0x4d2493){for(var _0x349a76=0x0,_0x49b19d=events[_0xbb96('0x7')];_0x349a76<_0x49b19d;_0x349a76++){var _0x4af749=events[_0x349a76];var _0x507af1=createListener(_0xbb96('0x8')+_0x4af749,_0x4d2493);DashboardEvents['on'](_0x4af749,_0x507af1);}}; \ No newline at end of file +var _0x7f18=['remove','update','emit','register','length','dashboard:','./dashboard.events','save'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0x7f18,0x9e));var _0x87f1=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x7f18[_0x1f9f37];return _0x21c080;};'use strict';var DashboardEvents=require(_0x87f1('0x0'));var events=[_0x87f1('0x1'),_0x87f1('0x2'),_0x87f1('0x3')];function createListener(_0x5b663f,_0x472013){return function(_0x57504f){_0x472013[_0x87f1('0x4')](_0x5b663f,_0x57504f);};}function removeListener(_0x567fd5,_0x38f6ed){return function(){DashboardEvents['removeListener'](_0x567fd5,_0x38f6ed);};}exports[_0x87f1('0x5')]=function(_0x23e0c3){for(var _0x5d4c5a=0x0,_0x27471f=events[_0x87f1('0x6')];_0x5d4c5a<_0x27471f;_0x5d4c5a++){var _0x5e43c9=events[_0x5d4c5a];var _0x5671b4=createListener(_0x87f1('0x7')+_0x5e43c9,_0x23e0c3);DashboardEvents['on'](_0x5e43c9,_0x5671b4);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ba40cf9..336fcb2 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 _0x4dff=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','getItems','post','create','/:id/clone','clone','/:id/items','addItem','put','/:id','update','delete','destroy','util'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4dff,0x1e3));var _0xf4df=function(_0x272d5a,_0x156aeb){_0x272d5a=_0x272d5a-0x0;var _0x33fba6=_0x4dff[_0x272d5a];return _0x33fba6;};'use strict';var multer=require('multer');var util=require(_0xf4df('0x0'));var path=require('path');var timeout=require(_0xf4df('0x1'));var express=require(_0xf4df('0x2'));var router=express[_0xf4df('0x3')]();var fs_extra=require(_0xf4df('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf4df('0x5'));var config=require(_0xf4df('0x6'));var controller=require(_0xf4df('0x7'));router[_0xf4df('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xf4df('0x9')](),controller['show']);router[_0xf4df('0x8')]('/:id/items',auth[_0xf4df('0x9')](),controller[_0xf4df('0xa')]);router[_0xf4df('0xb')]('/',auth[_0xf4df('0x9')](),controller[_0xf4df('0xc')]);router[_0xf4df('0xb')](_0xf4df('0xd'),auth[_0xf4df('0x9')](),controller[_0xf4df('0xe')]);router[_0xf4df('0xb')](_0xf4df('0xf'),auth[_0xf4df('0x9')](),controller[_0xf4df('0x10')]);router[_0xf4df('0x11')](_0xf4df('0x12'),auth[_0xf4df('0x9')](),controller[_0xf4df('0x13')]);router[_0xf4df('0x14')](_0xf4df('0x12'),auth[_0xf4df('0x9')](),controller[_0xf4df('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe530=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','index','/:id','show','get','getItems','post','isAuthenticated','clone','addItem','put','update'];(function(_0x3ed9ad,_0x18fddd){var _0x5bfb0f=function(_0x38db6f){while(--_0x38db6f){_0x3ed9ad['push'](_0x3ed9ad['shift']());}};_0x5bfb0f(++_0x18fddd);}(_0xe530,0x1a5));var _0x0e53=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe530[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x0e53('0x0'));var util=require('util');var path=require(_0x0e53('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e53('0x2'));var router=express[_0x0e53('0x3')]();var fs_extra=require(_0x0e53('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0e53('0x5'));var config=require(_0x0e53('0x6'));var controller=require(_0x0e53('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0e53('0x8')]);router['get'](_0x0e53('0x9'),auth['isAuthenticated'](),controller[_0x0e53('0xa')]);router[_0x0e53('0xb')]('/:id/items',auth['isAuthenticated'](),controller[_0x0e53('0xc')]);router[_0x0e53('0xd')]('/',auth[_0x0e53('0xe')](),controller['create']);router[_0x0e53('0xd')]('/:id/clone',auth[_0x0e53('0xe')](),controller[_0x0e53('0xf')]);router[_0x0e53('0xd')]('/:id/items',auth[_0x0e53('0xe')](),controller[_0x0e53('0x10')]);router[_0x0e53('0x11')](_0x0e53('0x9'),auth[_0x0e53('0xe')](),controller[_0x0e53('0x12')]);router[_0x0e53('0x13')](_0x0e53('0x9'),auth[_0x0e53('0xe')](),controller[_0x0e53('0x14')]);module[_0x0e53('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 2954999..70ef726 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','exports','STRING'];(function(_0x93b854,_0xf02eb4){var _0x115732=function(_0x30a9ae){while(--_0x30a9ae){_0x93b854['push'](_0x93b854['shift']());}};_0x115732(++_0xf02eb4);}(_0xadb5,0xad));var _0x5adb=function(_0x161a89,_0x340b4b){_0x161a89=_0x161a89-0x0;var _0x11eb0f=_0xadb5[_0x161a89];return _0x11eb0f;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5adb('0x0'));var _=require('lodash');module[_0x5adb('0x1')]={'title':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5adb('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5adb('0x3')),'get':function(){try{return JSON[_0x5adb('0x4')](this[_0x5adb('0x5')]('attrs'));}catch(_0x35a5d3){return[];}},'set':function(_0x168d89){try{this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')](_0x168d89));}catch(_0x353885){this[_0x5adb('0x6')](_0x5adb('0x7'),JSON[_0x5adb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5adb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5adb('0x9')]},'col':{'type':Sequelize[_0x5adb('0x9')]},'background':{'type':Sequelize[_0x5adb('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5adb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5adb('0x2')]},'titleFontSize':{'type':Sequelize[_0x5adb('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x9536=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x594624,_0x181b4f){var _0x1fd710=function(_0x19bcd2){while(--_0x19bcd2){_0x594624['push'](_0x594624['shift']());}};_0x1fd710(++_0x181b4f);}(_0x9536,0x179));var _0x6953=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x9536[_0x2df724];return _0x1b2504;};'use strict';var Sequelize=require(_0x6953('0x0'));var squel=require(_0x6953('0x1'));var _=require(_0x6953('0x2'));module[_0x6953('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6953('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x6953('0x5')),'get':function(){try{return JSON[_0x6953('0x6')](this[_0x6953('0x7')](_0x6953('0x8')));}catch(_0x2f3cc3){return[];}},'set':function(_0x494ac2){try{this[_0x6953('0x9')](_0x6953('0x8'),JSON[_0x6953('0xa')](_0x494ac2));}catch(_0x3e1aff){this[_0x6953('0x9')]('attrs',JSON[_0x6953('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x6953('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6953('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6953('0xb')]},'background':{'type':Sequelize[_0x6953('0x4')],'allowNull':![],'defaultValue':_0x6953('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6953('0x4')],'allowNull':![],'defaultValue':_0x6953('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6953('0x4')]},'titleFontSize':{'type':Sequelize[_0x6953('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 64f215a..c548121 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 _0x6fcf=['find','catch','type','attrUrl','attrs','value','https://','attrPath','clock','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','json','save','then','destroy','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options'];(function(_0x3106be,_0x3b19da){var _0x5619bd=function(_0x2b5196){while(--_0x2b5196){_0x3106be['push'](_0x3106be['shift']());}};_0x5619bd(++_0x3b19da);}(_0x6fcf,0x175));var _0xf6fc=function(_0x1153ff,_0x2bb354){_0x1153ff=_0x1153ff-0x0;var _0xbc230a=_0x6fcf[_0x1153ff];return _0xbc230a;};'use strict';var emlformat=require(_0xf6fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6fc('0x1'));var jsonpatch=require(_0xf6fc('0x2'));var rp=require(_0xf6fc('0x3'));var moment=require('moment');var BPromise=require(_0xf6fc('0x4'));var Mustache=require(_0xf6fc('0x5'));var util=require(_0xf6fc('0x6'));var path=require(_0xf6fc('0x7'));var sox=require(_0xf6fc('0x8'));var csv=require(_0xf6fc('0x9'));var ejs=require(_0xf6fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf6fc('0xb'));var crypto=require(_0xf6fc('0xc'));var jsforce=require(_0xf6fc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf6fc('0x9'));var querystring=require('querystring');var Papa=require(_0xf6fc('0xe'));var Redis=require('ioredis');var authService=require(_0xf6fc('0xf'));var qs=require(_0xf6fc('0x10'));var as=require(_0xf6fc('0x11'));var hardwareService=require(_0xf6fc('0x12'));var logger=require('../../config/logger')(_0xf6fc('0x13'));var utils=require('../../config/utils');var config=require(_0xf6fc('0x14'));var licenseUtil=require(_0xf6fc('0x15'));var db=require(_0xf6fc('0x16'))['db'];config[_0xf6fc('0x17')]=_[_0xf6fc('0x18')](config[_0xf6fc('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6fc('0x19'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xf6fc('0x1a')](socket);function respondWithStatusCode(_0x3f1a8c,_0x2d7ec8){_0x2d7ec8=_0x2d7ec8||0xcc;return function(_0x132574){if(_0x132574){return _0x3f1a8c[_0xf6fc('0x1b')](_0x2d7ec8);}return _0x3f1a8c[_0xf6fc('0x1c')](_0x2d7ec8)[_0xf6fc('0x1d')]();};}function respondWithResult(_0x3728d3,_0x3696d0){_0x3696d0=_0x3696d0||0xc8;return function(_0x1e0a43){if(_0x1e0a43){return _0x3728d3['status'](_0x3696d0)['json'](_0x1e0a43);}};}function respondWithFilteredResult(_0x343278,_0x4774b6){return function(_0x279080){if(_0x279080){var _0x49a3f2=typeof _0x4774b6[_0xf6fc('0x1e')]===_0xf6fc('0x1f')&&typeof _0x4774b6[_0xf6fc('0x20')]===_0xf6fc('0x1f');var _0x3418c6=_0x279080[_0xf6fc('0x21')];var _0x9223a4=_0x49a3f2?0x0:_0x4774b6[_0xf6fc('0x1e')];var _0x1b8c35=_0x49a3f2?_0x279080[_0xf6fc('0x21')]:_0x4774b6[_0xf6fc('0x1e')]+_0x4774b6[_0xf6fc('0x20')];var _0x32fd7e;if(_0x1b8c35>=_0x3418c6){_0x1b8c35=_0x3418c6;_0x32fd7e=0xc8;}else{_0x32fd7e=0xce;}_0x343278['status'](_0x32fd7e);return _0x343278[_0xf6fc('0x22')]('Content-Range',_0x9223a4+'-'+_0x1b8c35+'/'+_0x3418c6)[_0xf6fc('0x23')](_0x279080);}return null;};}function patchUpdates(_0x3cabec){return function(_0x5a6129){try{jsonpatch['apply'](_0x5a6129,_0x3cabec,!![]);}catch(_0xdfe2d7){return BPromise['reject'](_0xdfe2d7);}return _0x5a6129[_0xf6fc('0x24')]();};}function saveUpdates(_0x9e8c15,_0x48c98e){return function(_0xacc918){if(_0xacc918){return _0xacc918['update'](_0x9e8c15)[_0xf6fc('0x25')](function(_0x1dbb40){return _0x1dbb40;});}return null;};}function removeEntity(_0x1b7169,_0x10108f){return function(_0x894697){if(_0x894697){return _0x894697[_0xf6fc('0x26')]()[_0xf6fc('0x25')](function(){_0x1b7169[_0xf6fc('0x1c')](0xcc)[_0xf6fc('0x1d')]();});}};}function handleEntityNotFound(_0x52dae0,_0x8d112c){return function(_0x136296){if(!_0x136296){_0x52dae0[_0xf6fc('0x1b')](0x194);}return _0x136296;};}function handleError(_0xd53b93,_0x29caa3){_0x29caa3=_0x29caa3||0x1f4;return function(_0x243383){logger['error'](_0x243383[_0xf6fc('0x27')]);if(_0x243383[_0xf6fc('0x28')]){delete _0x243383[_0xf6fc('0x28')];}_0xd53b93[_0xf6fc('0x1c')](_0x29caa3)[_0xf6fc('0x29')](_0x243383);};}exports[_0xf6fc('0x2a')]=function(_0x450955,_0x54239e){var _0x1c2f9c={'raw':![],'where':{'id':_0x450955[_0xf6fc('0x2b')]['id']}},_0x982df={};_0x982df[_0xf6fc('0x2c')]=_[_0xf6fc('0x2d')](db[_0xf6fc('0x2e')][_0xf6fc('0x2f')]);_0x982df[_0xf6fc('0x30')]=_[_0xf6fc('0x2d')](_0x450955[_0xf6fc('0x30')]);_0x982df['filters']=_[_0xf6fc('0x31')](_0x982df[_0xf6fc('0x2c')],_0x982df['query']);_0x1c2f9c[_0xf6fc('0x32')]=_[_0xf6fc('0x31')](_0x982df[_0xf6fc('0x2c')],qs[_0xf6fc('0x33')](_0x450955[_0xf6fc('0x30')][_0xf6fc('0x33')]));_0x1c2f9c['attributes']=_0x1c2f9c[_0xf6fc('0x32')][_0xf6fc('0x34')]?_0x1c2f9c[_0xf6fc('0x32')]:_0x982df[_0xf6fc('0x2c')];if(_0x450955[_0xf6fc('0x30')][_0xf6fc('0x35')]){_0x1c2f9c[_0xf6fc('0x36')]=[{'all':!![]}];}_0x1c2f9c=_[_0xf6fc('0x37')]({},_0x1c2f9c,_0x450955[_0xf6fc('0x38')]);return db[_0xf6fc('0x2e')][_0xf6fc('0x39')](_0x1c2f9c)[_0xf6fc('0x25')](handleEntityNotFound(_0x54239e,null))[_0xf6fc('0x25')](respondWithResult(_0x54239e,null))[_0xf6fc('0x3a')](handleError(_0x54239e,null));};exports[_0xf6fc('0x26')]=function(_0x1c9f3c,_0x16069b){return db[_0xf6fc('0x2e')][_0xf6fc('0x39')]({'where':{'id':_0x1c9f3c[_0xf6fc('0x2b')]['id']}})[_0xf6fc('0x25')](handleEntityNotFound(_0x16069b,null))[_0xf6fc('0x25')](removeEntity(_0x16069b,null))[_0xf6fc('0x3a')](handleError(_0x16069b,null));};function widgetAttributes(_0x4534e5){try{switch(_0x4534e5[_0xf6fc('0x3b')]){case'iframe':return[{'name':_0xf6fc('0x3c'),'value':_0x4534e5['attrUrl']||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x0]?_0x4534e5[_0xf6fc('0x3d')][0x0][_0xf6fc('0x3e')]:undefined)||_0xf6fc('0x3f')}];case'custom':return[{'name':_0xf6fc('0x40'),'value':_0x4534e5[_0xf6fc('0x40')]||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x0]?_0x4534e5['attrs'][0x0]['value']:undefined)||''}];case _0xf6fc('0x41'):return[{'name':'attrHourFormat','value':_0x4534e5['attrHourFormat']||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x0]?_0x4534e5[_0xf6fc('0x3d')][0x0][_0xf6fc('0x3e')]:undefined)||'HH:mm:ss'},{'name':_0xf6fc('0x42'),'value':_0x4534e5[_0xf6fc('0x42')]||(_0x4534e5['attrs']&&_0x4534e5[_0xf6fc('0x3d')][0x1]?_0x4534e5['attrs'][0x1][_0xf6fc('0x3e')]:undefined)||_0xf6fc('0x43')},{'name':_0xf6fc('0x44'),'value':_0x4534e5[_0xf6fc('0x44')]||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x2]?_0x4534e5[_0xf6fc('0x3d')][0x2]['value']:undefined)||0xc}];case _0xf6fc('0x45'):return[{'name':_0xf6fc('0x46'),'value':_0x4534e5[_0xf6fc('0x46')]||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5['attrs'][0x0]?_0x4534e5['attrs'][0x0]['value']:undefined)||'total'},{'name':_0xf6fc('0x47'),'value':_0x4534e5['attrVoiceQueues']||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x1]?_0x4534e5[_0xf6fc('0x3d')][0x1][_0xf6fc('0x3e')]:undefined)||[]},{'name':_0xf6fc('0x44'),'value':_0x4534e5[_0xf6fc('0x44')]||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x2]?_0x4534e5[_0xf6fc('0x3d')][0x2][_0xf6fc('0x3e')]:undefined)||0x14}];case _0xf6fc('0x48'):case _0xf6fc('0x49'):return[{'name':'attrSerie1','value':_0x4534e5[_0xf6fc('0x4a')]||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5['attrs'][0x0]?_0x4534e5[_0xf6fc('0x3d')][0x0]['value']:undefined)||_0xf6fc('0x4b')},{'name':'attrSerie2','value':_0x4534e5[_0xf6fc('0x4c')]||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x1]?_0x4534e5[_0xf6fc('0x3d')][0x1][_0xf6fc('0x3e')]:undefined)||null},{'name':_0xf6fc('0x4d'),'value':_0x4534e5[_0xf6fc('0x4d')]||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x2]?_0x4534e5['attrs'][0x2][_0xf6fc('0x3e')]:undefined)||null},{'name':_0xf6fc('0x47'),'value':_0x4534e5['attrVoiceQueues']||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x3]?_0x4534e5[_0xf6fc('0x3d')][0x3][_0xf6fc('0x3e')]:undefined)||[]}];case _0xf6fc('0x4e'):return[{'name':_0xf6fc('0x4f'),'type':_0x4534e5[_0xf6fc('0x50')]||(_0x4534e5['attrs']&&_0x4534e5[_0xf6fc('0x3d')][0x0]?_0x4534e5[_0xf6fc('0x3d')][0x0][_0xf6fc('0x3b')]:undefined)||null,'value':_0x4534e5[_0xf6fc('0x4f')]||(_0x4534e5['attrs']&&_0x4534e5[_0xf6fc('0x3d')][0x0]?_0x4534e5['attrs'][0x0][_0xf6fc('0x3e')]:undefined)||null},{'name':_0xf6fc('0x51'),'value':_0x4534e5[_0xf6fc('0x51')]||(_0x4534e5[_0xf6fc('0x3d')]&&_0x4534e5[_0xf6fc('0x3d')][0x1]?_0x4534e5[_0xf6fc('0x3d')][0x1][_0xf6fc('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x37b633){logger[_0xf6fc('0x52')]('widgetAttributes:\x20%s',JSON['stringify'](_0x37b633));return[];}}exports[_0xf6fc('0x53')]=function(_0x39d945,_0x3ecb12){if(_0x39d945[_0xf6fc('0x54')]){_0x39d945[_0xf6fc('0x54')][_0xf6fc('0x3d')]=widgetAttributes(_0x39d945[_0xf6fc('0x54')]);}return db[_0xf6fc('0x2e')][_0xf6fc('0x53')](_0x39d945['body'],{})[_0xf6fc('0x25')](respondWithResult(_0x3ecb12,0xc9))[_0xf6fc('0x3a')](handleError(_0x3ecb12,null));};exports[_0xf6fc('0x55')]=function(_0x5286d4,_0x59942c){if(_0x5286d4[_0xf6fc('0x54')]['id']){delete _0x5286d4[_0xf6fc('0x54')]['id'];}_0x5286d4['body'][_0xf6fc('0x3d')]=widgetAttributes(_0x5286d4[_0xf6fc('0x54')]);return db['DashboardItem'][_0xf6fc('0x39')]({'where':{'id':_0x5286d4['params']['id']}})[_0xf6fc('0x25')](handleEntityNotFound(_0x59942c,null))[_0xf6fc('0x25')](saveUpdates(_0x5286d4['body'],null))['then'](respondWithResult(_0x59942c,null))[_0xf6fc('0x3a')](handleError(_0x59942c,null));}; \ No newline at end of file +var _0x7e51=['value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','find','eml-format','rimraf','moment','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','destroy','status','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','model','fields','includeAll','include','merge','options','catch','type','iframe','attrUrl','attrs'];(function(_0x315a23,_0x337b59){var _0x524945=function(_0x55074d){while(--_0x55074d){_0x315a23['push'](_0x315a23['shift']());}};_0x524945(++_0x337b59);}(_0x7e51,0x1d1));var _0x17e5=function(_0x24d562,_0x570f65){_0x24d562=_0x24d562-0x0;var _0x478496=_0x7e51[_0x24d562];return _0x478496;};'use strict';var emlformat=require(_0x17e5('0x0'));var rimraf=require(_0x17e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x17e5('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x17e5('0x3'));var sox=require(_0x17e5('0x4'));var csv=require(_0x17e5('0x5'));var ejs=require(_0x17e5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x17e5('0x7'));var squel=require(_0x17e5('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x17e5('0x9'));var toCsv=require('to-csv');var querystring=require(_0x17e5('0xa'));var Papa=require('papaparse');var Redis=require(_0x17e5('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x17e5('0xc'));var as=require(_0x17e5('0xd'));var hardwareService=require(_0x17e5('0xe'));var logger=require(_0x17e5('0xf'))(_0x17e5('0x10'));var utils=require(_0x17e5('0x11'));var config=require(_0x17e5('0x12'));var licenseUtil=require(_0x17e5('0x13'));var db=require('../../mysqldb')['db'];config[_0x17e5('0x14')]=_[_0x17e5('0x15')](config[_0x17e5('0x14')],{'host':_0x17e5('0x16'),'port':0x18eb});var socket=require(_0x17e5('0x17'))(new Redis(config[_0x17e5('0x14')]));require(_0x17e5('0x18'))[_0x17e5('0x19')](socket);function respondWithStatusCode(_0x3ae01c,_0x342a3d){_0x342a3d=_0x342a3d||0xcc;return function(_0x3cce10){if(_0x3cce10){return _0x3ae01c[_0x17e5('0x1a')](_0x342a3d);}return _0x3ae01c['status'](_0x342a3d)[_0x17e5('0x1b')]();};}function respondWithResult(_0x11f109,_0xc17ed2){_0xc17ed2=_0xc17ed2||0xc8;return function(_0x372f4d){if(_0x372f4d){return _0x11f109['status'](_0xc17ed2)['json'](_0x372f4d);}};}function respondWithFilteredResult(_0x366c88,_0x3ff561){return function(_0x4147bd){if(_0x4147bd){var _0x58c4c0=typeof _0x3ff561['offset']===_0x17e5('0x1c')&&typeof _0x3ff561[_0x17e5('0x1d')]===_0x17e5('0x1c');var _0x531d5d=_0x4147bd[_0x17e5('0x1e')];var _0x1e2445=_0x58c4c0?0x0:_0x3ff561[_0x17e5('0x1f')];var _0x330a0f=_0x58c4c0?_0x4147bd['count']:_0x3ff561['offset']+_0x3ff561[_0x17e5('0x1d')];var _0x8f1d76;if(_0x330a0f>=_0x531d5d){_0x330a0f=_0x531d5d;_0x8f1d76=0xc8;}else{_0x8f1d76=0xce;}_0x366c88['status'](_0x8f1d76);return _0x366c88['set'](_0x17e5('0x20'),_0x1e2445+'-'+_0x330a0f+'/'+_0x531d5d)[_0x17e5('0x21')](_0x4147bd);}return null;};}function patchUpdates(_0x24b2f2){return function(_0x581a98){try{jsonpatch[_0x17e5('0x22')](_0x581a98,_0x24b2f2,!![]);}catch(_0x4a09c4){return BPromise['reject'](_0x4a09c4);}return _0x581a98[_0x17e5('0x23')]();};}function saveUpdates(_0xf327f9,_0x2cffa2){return function(_0x6ff9d9){if(_0x6ff9d9){return _0x6ff9d9[_0x17e5('0x24')](_0xf327f9)[_0x17e5('0x25')](function(_0x116a5e){return _0x116a5e;});}return null;};}function removeEntity(_0x51033e,_0x23626c){return function(_0x50713f){if(_0x50713f){return _0x50713f[_0x17e5('0x26')]()[_0x17e5('0x25')](function(){_0x51033e[_0x17e5('0x27')](0xcc)[_0x17e5('0x1b')]();});}};}function handleEntityNotFound(_0x48ffe5,_0x51c730){return function(_0x4b4190){if(!_0x4b4190){_0x48ffe5['sendStatus'](0x194);}return _0x4b4190;};}function handleError(_0x5cd054,_0x4d46b2){_0x4d46b2=_0x4d46b2||0x1f4;return function(_0x33700b){logger['error'](_0x33700b[_0x17e5('0x28')]);if(_0x33700b[_0x17e5('0x29')]){delete _0x33700b[_0x17e5('0x29')];}_0x5cd054['status'](_0x4d46b2)[_0x17e5('0x2a')](_0x33700b);};}exports[_0x17e5('0x2b')]=function(_0x1dbefc,_0x31a586){var _0x569b0b={'raw':![],'where':{'id':_0x1dbefc[_0x17e5('0x2c')]['id']}},_0x23f3ac={};_0x23f3ac['model']=_[_0x17e5('0x2d')](db[_0x17e5('0x2e')][_0x17e5('0x2f')]);_0x23f3ac['query']=_['keys'](_0x1dbefc[_0x17e5('0x30')]);_0x23f3ac[_0x17e5('0x31')]=_[_0x17e5('0x32')](_0x23f3ac['model'],_0x23f3ac[_0x17e5('0x30')]);_0x569b0b[_0x17e5('0x33')]=_[_0x17e5('0x32')](_0x23f3ac[_0x17e5('0x34')],qs['fields'](_0x1dbefc[_0x17e5('0x30')][_0x17e5('0x35')]));_0x569b0b[_0x17e5('0x33')]=_0x569b0b[_0x17e5('0x33')]['length']?_0x569b0b[_0x17e5('0x33')]:_0x23f3ac[_0x17e5('0x34')];if(_0x1dbefc[_0x17e5('0x30')][_0x17e5('0x36')]){_0x569b0b[_0x17e5('0x37')]=[{'all':!![]}];}_0x569b0b=_[_0x17e5('0x38')]({},_0x569b0b,_0x1dbefc[_0x17e5('0x39')]);return db[_0x17e5('0x2e')]['find'](_0x569b0b)[_0x17e5('0x25')](handleEntityNotFound(_0x31a586,null))['then'](respondWithResult(_0x31a586,null))[_0x17e5('0x3a')](handleError(_0x31a586,null));};exports[_0x17e5('0x26')]=function(_0x255841,_0x575088){return db[_0x17e5('0x2e')]['find']({'where':{'id':_0x255841[_0x17e5('0x2c')]['id']}})[_0x17e5('0x25')](handleEntityNotFound(_0x575088,null))['then'](removeEntity(_0x575088,null))[_0x17e5('0x3a')](handleError(_0x575088,null));};function widgetAttributes(_0xa47aae){try{switch(_0xa47aae[_0x17e5('0x3b')]){case _0x17e5('0x3c'):return[{'name':_0x17e5('0x3d'),'value':_0xa47aae['attrUrl']||(_0xa47aae['attrs']&&_0xa47aae[_0x17e5('0x3e')][0x0]?_0xa47aae[_0x17e5('0x3e')][0x0][_0x17e5('0x3f')]:undefined)||_0x17e5('0x40')}];case'custom':return[{'name':_0x17e5('0x41'),'value':_0xa47aae[_0x17e5('0x41')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x0]?_0xa47aae[_0x17e5('0x3e')][0x0][_0x17e5('0x3f')]:undefined)||''}];case _0x17e5('0x42'):return[{'name':_0x17e5('0x43'),'value':_0xa47aae[_0x17e5('0x43')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x0]?_0xa47aae[_0x17e5('0x3e')][0x0][_0x17e5('0x3f')]:undefined)||_0x17e5('0x44')},{'name':_0x17e5('0x45'),'value':_0xa47aae[_0x17e5('0x45')]||(_0xa47aae['attrs']&&_0xa47aae[_0x17e5('0x3e')][0x1]?_0xa47aae['attrs'][0x1][_0x17e5('0x3f')]:undefined)||_0x17e5('0x46')},{'name':_0x17e5('0x47'),'value':_0xa47aae[_0x17e5('0x47')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x2]?_0xa47aae[_0x17e5('0x3e')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x17e5('0x48'),'value':_0xa47aae[_0x17e5('0x48')]||(_0xa47aae['attrs']&&_0xa47aae[_0x17e5('0x3e')][0x0]?_0xa47aae[_0x17e5('0x3e')][0x0][_0x17e5('0x3f')]:undefined)||_0x17e5('0x49')},{'name':_0x17e5('0x4a'),'value':_0xa47aae[_0x17e5('0x4a')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x1]?_0xa47aae[_0x17e5('0x3e')][0x1][_0x17e5('0x3f')]:undefined)||[]},{'name':'attrFontSize','value':_0xa47aae[_0x17e5('0x47')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x2]?_0xa47aae[_0x17e5('0x3e')][0x2]['value']:undefined)||0x14}];case _0x17e5('0x4b'):case _0x17e5('0x4c'):return[{'name':_0x17e5('0x4d'),'value':_0xa47aae[_0x17e5('0x4d')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x0]?_0xa47aae[_0x17e5('0x3e')][0x0][_0x17e5('0x3f')]:undefined)||_0x17e5('0x49')},{'name':'attrSerie2','value':_0xa47aae[_0x17e5('0x4e')]||(_0xa47aae['attrs']&&_0xa47aae[_0x17e5('0x3e')][0x1]?_0xa47aae[_0x17e5('0x3e')][0x1]['value']:undefined)||null},{'name':_0x17e5('0x4f'),'value':_0xa47aae[_0x17e5('0x4f')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x2]?_0xa47aae[_0x17e5('0x3e')][0x2]['value']:undefined)||null},{'name':_0x17e5('0x4a'),'value':_0xa47aae[_0x17e5('0x4a')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x3]?_0xa47aae[_0x17e5('0x3e')][0x3][_0x17e5('0x3f')]:undefined)||[]}];case'web-report':return[{'name':_0x17e5('0x50'),'type':_0xa47aae[_0x17e5('0x51')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x0]?_0xa47aae['attrs'][0x0]['type']:undefined)||null,'value':_0xa47aae['attrReport']||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae[_0x17e5('0x3e')][0x0]?_0xa47aae[_0x17e5('0x3e')][0x0]['value']:undefined)||null},{'name':_0x17e5('0x52'),'value':_0xa47aae[_0x17e5('0x52')]||(_0xa47aae[_0x17e5('0x3e')]&&_0xa47aae['attrs'][0x1]?_0xa47aae[_0x17e5('0x3e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x48a6f5){logger['error'](_0x17e5('0x53'),JSON[_0x17e5('0x54')](_0x48a6f5));return[];}}exports[_0x17e5('0x55')]=function(_0x880975,_0x3190c1){if(_0x880975[_0x17e5('0x56')]){_0x880975['body'][_0x17e5('0x3e')]=widgetAttributes(_0x880975['body']);}return db['DashboardItem'][_0x17e5('0x55')](_0x880975[_0x17e5('0x56')],{})['then'](respondWithResult(_0x3190c1,0xc9))[_0x17e5('0x3a')](handleError(_0x3190c1,null));};exports[_0x17e5('0x24')]=function(_0x2769bb,_0x1da5fc){if(_0x2769bb[_0x17e5('0x56')]['id']){delete _0x2769bb[_0x17e5('0x56')]['id'];}_0x2769bb[_0x17e5('0x56')][_0x17e5('0x3e')]=widgetAttributes(_0x2769bb[_0x17e5('0x56')]);return db[_0x17e5('0x2e')][_0x17e5('0x57')]({'where':{'id':_0x2769bb[_0x17e5('0x2c')]['id']}})[_0x17e5('0x25')](handleEntityNotFound(_0x1da5fc,null))['then'](saveUpdates(_0x2769bb[_0x17e5('0x56')],null))[_0x17e5('0x25')](respondWithResult(_0x1da5fc,null))[_0x17e5('0x3a')](handleError(_0x1da5fc,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 33c5e5e..0e92eb5 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 _0x508a=['emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x53b53a,_0x4ed810){var _0x3fcf70=function(_0x33ce1b){while(--_0x33ce1b){_0x53b53a['push'](_0x53b53a['shift']());}};_0x3fcf70(++_0x4ed810);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa508('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xa508('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa508('0x2')](0x0);var events={'afterCreate':_0xa508('0x3'),'afterUpdate':_0xa508('0x4'),'afterDestroy':_0xa508('0x5')};function emitEvent(_0x587f6a){return function(_0x8f1c7a,_0x40f2f0,_0x2e26ae){DashboardItemEvents['emit'](_0x587f6a+':'+_0x8f1c7a['id'],_0x8f1c7a);DashboardItemEvents[_0xa508('0x6')](_0x587f6a,_0x8f1c7a);_0x2e26ae(null);};}for(var e in events){if(events[_0xa508('0x7')](e)){var event=events[e];DashboardItem[_0xa508('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xfa21=['save','update','remove','emit','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x11cd17,_0x489e02){var _0x3343ad=function(_0xfb1588){while(--_0xfb1588){_0x11cd17['push'](_0x11cd17['shift']());}};_0x3343ad(++_0x489e02);}(_0xfa21,0x178));var _0x1fa2=function(_0x6217d9,_0x83786a){_0x6217d9=_0x6217d9-0x0;var _0x385c27=_0xfa21[_0x6217d9];return _0x385c27;};'use strict';var EventEmitter=require(_0x1fa2('0x0'));var DashboardItem=require(_0x1fa2('0x1'))['db'][_0x1fa2('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1fa2('0x3')](0x0);var events={'afterCreate':_0x1fa2('0x4'),'afterUpdate':_0x1fa2('0x5'),'afterDestroy':_0x1fa2('0x6')};function emitEvent(_0x4e3ce9){return function(_0x12b952,_0x3cc6a6,_0x537ee9){DashboardItemEvents[_0x1fa2('0x7')](_0x4e3ce9+':'+_0x12b952['id'],_0x12b952);DashboardItemEvents[_0x1fa2('0x7')](_0x4e3ce9,_0x12b952);_0x537ee9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x1fa2('0x8')](e,emitEvent(event));}}module[_0x1fa2('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 98304b6..365e449 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 _0x8134=['api','moment','request-promise','rimraf','../../config/environment','exports','DashboardItem','util','../../config/logger'];(function(_0x2fbf52,_0x560d64){var _0x5cd59d=function(_0x3b94b0){while(--_0x3b94b0){_0x2fbf52['push'](_0x2fbf52['shift']());}};_0x5cd59d(++_0x560d64);}(_0x8134,0xf1));var _0x4813=function(_0x5d6ff1,_0x1c28dd){_0x5d6ff1=_0x5d6ff1-0x0;var _0x4023d8=_0x8134[_0x5d6ff1];return _0x4023d8;};'use strict';var _=require('lodash');var util=require(_0x4813('0x0'));var logger=require(_0x4813('0x1'))(_0x4813('0x2'));var moment=require(_0x4813('0x3'));var BPromise=require('bluebird');var rp=require(_0x4813('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4813('0x5'));var config=require(_0x4813('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x4813('0x7')]=function(_0x2bac94,_0x4f7a30){return _0x2bac94['define'](_0x4813('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb74=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','lodash','util'];(function(_0x46f6d2,_0x11ec10){var _0x1ad411=function(_0x355c6e){while(--_0x355c6e){_0x46f6d2['push'](_0x46f6d2['shift']());}};_0x1ad411(++_0x11ec10);}(_0xeb74,0x143));var _0x4eb7=function(_0x15af04,_0x59ff4f){_0x15af04=_0x15af04-0x0;var _0x3a2392=_0xeb74[_0x15af04];return _0x3a2392;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var logger=require(_0x4eb7('0x2'))('api');var moment=require(_0x4eb7('0x3'));var BPromise=require(_0x4eb7('0x4'));var rp=require(_0x4eb7('0x5'));var fs=require('fs');var path=require(_0x4eb7('0x6'));var rimraf=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var attributes=require(_0x4eb7('0x9'));module[_0x4eb7('0xa')]=function(_0x90b219,_0x9bc3a){return _0x90b219[_0x4eb7('0xb')](_0x4eb7('0xc'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index e859e1d..8aa68de 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 _0x7863=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7863,0x119));var _0x3786=function(_0x377199,_0x1439fa){_0x377199=_0x377199-0x0;var _0x501155=_0x7863[_0x377199];return _0x501155;};'use strict';var _=require(_0x3786('0x0'));var util=require('util');var moment=require(_0x3786('0x1'));var BPromise=require(_0x3786('0x2'));var rs=require(_0x3786('0x3'));var fs=require('fs');var Redis=require(_0x3786('0x4'));var db=require(_0x3786('0x5'))['db'];var utils=require(_0x3786('0x6'));var logger=require(_0x3786('0x7'))(_0x3786('0x8'));var config=require(_0x3786('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3786('0xa')]({'port':0x232a});config[_0x3786('0xb')]=_['defaults'](config[_0x3786('0xb')],{'host':_0x3786('0xc'),'port':0x18eb});var socket=require(_0x3786('0xd'))(new Redis(config[_0x3786('0xb')]));require(_0x3786('0xe'))[_0x3786('0xf')](socket);function respondWithRpcPromise(_0x21d513,_0x5a9bfa,_0x5bff63){return new BPromise(function(_0x188ccb,_0x1fb365){return client[_0x3786('0x10')](_0x21d513,_0x5bff63)[_0x3786('0x11')](function(_0x3212da){logger[_0x3786('0x12')](_0x3786('0x13'),_0x5a9bfa,_0x3786('0x14'));logger[_0x3786('0x15')](_0x3786('0x16'),_0x5a9bfa,'request\x20sent',JSON[_0x3786('0x17')](_0x3212da));if(_0x3212da['error']){if(_0x3212da[_0x3786('0x18')]['code']===0x1f4){logger[_0x3786('0x18')](_0x3786('0x13'),_0x5a9bfa,_0x3212da[_0x3786('0x18')]['message']);return _0x1fb365(_0x3212da[_0x3786('0x18')][_0x3786('0x19')]);}logger[_0x3786('0x18')](_0x3786('0x13'),_0x5a9bfa,_0x3212da[_0x3786('0x18')]['message']);return _0x188ccb(_0x3212da[_0x3786('0x18')][_0x3786('0x19')]);}else{logger[_0x3786('0x12')]('DashboardItem,\x20%s,\x20%s',_0x5a9bfa,_0x3786('0x14'));_0x188ccb(_0x3212da[_0x3786('0x1a')][_0x3786('0x19')]);}})[_0x3786('0x1b')](function(_0x3cfd45){logger[_0x3786('0x18')]('DashboardItem,\x20%s,\x20%s',_0x5a9bfa,_0x3cfd45);_0x1fb365(_0x3cfd45);});});} \ No newline at end of file +var _0x3b1a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x1448f4,_0x1d8f4e){var _0x37fe18=function(_0x56e4bf){while(--_0x56e4bf){_0x1448f4['push'](_0x1448f4['shift']());}};_0x37fe18(++_0x1d8f4e);}(_0x3b1a,0x185));var _0xa3b1=function(_0x25831a,_0x3027d1){_0x25831a=_0x25831a-0x0;var _0x141686=_0x3b1a[_0x25831a];return _0x141686;};'use strict';var _=require(_0xa3b1('0x0'));var util=require(_0xa3b1('0x1'));var moment=require(_0xa3b1('0x2'));var BPromise=require(_0xa3b1('0x3'));var rs=require(_0xa3b1('0x4'));var fs=require('fs');var Redis=require(_0xa3b1('0x5'));var db=require(_0xa3b1('0x6'))['db'];var utils=require(_0xa3b1('0x7'));var logger=require(_0xa3b1('0x8'))(_0xa3b1('0x9'));var config=require(_0xa3b1('0xa'));var jayson=require(_0xa3b1('0xb'));var client=jayson[_0xa3b1('0xc')]['http']({'port':0x232a});config[_0xa3b1('0xd')]=_['defaults'](config[_0xa3b1('0xd')],{'host':_0xa3b1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa3b1('0xf'))['register'](socket);function respondWithRpcPromise(_0x29760e,_0x548005,_0x1ac4af){return new BPromise(function(_0x420b92,_0x3784fc){return client[_0xa3b1('0x10')](_0x29760e,_0x1ac4af)[_0xa3b1('0x11')](function(_0x3fc091){logger[_0xa3b1('0x12')](_0xa3b1('0x13'),_0x548005,_0xa3b1('0x14'));logger[_0xa3b1('0x15')](_0xa3b1('0x16'),_0x548005,_0xa3b1('0x14'),JSON[_0xa3b1('0x17')](_0x3fc091));if(_0x3fc091[_0xa3b1('0x18')]){if(_0x3fc091[_0xa3b1('0x18')][_0xa3b1('0x19')]===0x1f4){logger[_0xa3b1('0x18')](_0xa3b1('0x13'),_0x548005,_0x3fc091[_0xa3b1('0x18')][_0xa3b1('0x1a')]);return _0x3784fc(_0x3fc091[_0xa3b1('0x18')][_0xa3b1('0x1a')]);}logger[_0xa3b1('0x18')](_0xa3b1('0x13'),_0x548005,_0x3fc091[_0xa3b1('0x18')]['message']);return _0x420b92(_0x3fc091[_0xa3b1('0x18')][_0xa3b1('0x1a')]);}else{logger[_0xa3b1('0x12')](_0xa3b1('0x13'),_0x548005,_0xa3b1('0x14'));_0x420b92(_0x3fc091[_0xa3b1('0x1b')][_0xa3b1('0x1a')]);}})['catch'](function(_0x76d2a4){logger['error'](_0xa3b1('0x13'),_0x548005,_0x76d2a4);_0x3784fc(_0x76d2a4);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index cba5c6b..6968926 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 _0x5a07=['emit','register','dashboardItem:','./dashboardItem.events','update'];(function(_0x5997d2,_0x4e2d4d){var _0x29ff34=function(_0x40e73d){while(--_0x40e73d){_0x5997d2['push'](_0x5997d2['shift']());}};_0x29ff34(++_0x4e2d4d);}(_0x5a07,0x193));var _0x75a0=function(_0x1661ab,_0x5bf27f){_0x1661ab=_0x1661ab-0x0;var _0x4f0d6f=_0x5a07[_0x1661ab];return _0x4f0d6f;};'use strict';var DashboardItemEvents=require(_0x75a0('0x0'));var events=['save','remove',_0x75a0('0x1')];function createListener(_0x5ed966,_0x3310e7){return function(_0x3a75ee){_0x3310e7[_0x75a0('0x2')](_0x5ed966,_0x3a75ee);};}function removeListener(_0x1cd5ff,_0x503f83){return function(){DashboardItemEvents['removeListener'](_0x1cd5ff,_0x503f83);};}exports[_0x75a0('0x3')]=function(_0x22d497){for(var _0x38d183=0x0,_0x27cb14=events['length'];_0x38d183<_0x27cb14;_0x38d183++){var _0x19e330=events[_0x38d183];var _0x395175=createListener(_0x75a0('0x4')+_0x19e330,_0x22d497);DashboardItemEvents['on'](_0x19e330,_0x395175);}}; \ No newline at end of file +var _0xd483=['length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xd483,0x1d2));var _0x3d48=function(_0x405162,_0x39f235){_0x405162=_0x405162-0x0;var _0xe34074=_0xd483[_0x405162];return _0xe34074;};'use strict';var DashboardItemEvents=require(_0x3d48('0x0'));var events=['save',_0x3d48('0x1'),_0x3d48('0x2')];function createListener(_0x41f994,_0x2cc341){return function(_0x6134ee){_0x2cc341[_0x3d48('0x3')](_0x41f994,_0x6134ee);};}function removeListener(_0x384c31,_0x278788){return function(){DashboardItemEvents[_0x3d48('0x4')](_0x384c31,_0x278788);};}exports[_0x3d48('0x5')]=function(_0x466598){for(var _0x29068a=0x0,_0xf96a49=events[_0x3d48('0x6')];_0x29068a<_0xf96a49;_0x29068a++){var _0x2dea6c=events[_0x29068a];var _0x26e1ab=createListener(_0x3d48('0x7')+_0x2dea6c,_0x466598);DashboardItemEvents['on'](_0x2dea6c,_0x26e1ab);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 70858ff..e1569ff 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 _0xc840=['./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x45b0cd,_0x53ba76){var _0x1e4029=function(_0x3ffe98){while(--_0x3ffe98){_0x45b0cd['push'](_0x45b0cd['shift']());}};_0x1e4029(++_0x53ba76);}(_0xc840,0x1a9));var _0x0c84=function(_0x21c3ee,_0x4c4b6f){_0x21c3ee=_0x21c3ee-0x0;var _0x8657b2=_0xc840[_0x21c3ee];return _0x8657b2;};'use strict';var multer=require(_0x0c84('0x0'));var util=require(_0x0c84('0x1'));var path=require(_0x0c84('0x2'));var timeout=require(_0x0c84('0x3'));var express=require('express');var router=express[_0x0c84('0x4')]();var fs_extra=require(_0x0c84('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c84('0x6'));var controller=require(_0x0c84('0x7'));router[_0x0c84('0x8')](_0x0c84('0x9'),auth[_0x0c84('0xa')](),controller[_0x0c84('0xb')]);router[_0x0c84('0xc')]('/',auth[_0x0c84('0xa')](),controller[_0x0c84('0xd')]);router[_0x0c84('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0c84('0xf')]);router[_0x0c84('0x10')](_0x0c84('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x0c84('0x11')]=router; \ No newline at end of file +var _0x07ab=['isAuthenticated','post','create','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x5e1a38,_0xa2a991){var _0x3e10cb=function(_0x214666){while(--_0x214666){_0x5e1a38['push'](_0x5e1a38['shift']());}};_0x3e10cb(++_0xa2a991);}(_0x07ab,0x67));var _0xb07a=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x07ab[_0x5d80de];return _0x1c7556;};'use strict';var multer=require(_0xb07a('0x0'));var util=require('util');var path=require(_0xb07a('0x1'));var timeout=require(_0xb07a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb07a('0x3'));var interaction=require(_0xb07a('0x4'));var config=require(_0xb07a('0x5'));var controller=require(_0xb07a('0x6'));router[_0xb07a('0x7')](_0xb07a('0x8'),auth[_0xb07a('0x9')](),controller['show']);router[_0xb07a('0xa')]('/',auth['isAuthenticated'](),controller[_0xb07a('0xb')]);router['put']('/:id',auth[_0xb07a('0x9')](),controller[_0xb07a('0xc')]);router[_0xb07a('0xd')](_0xb07a('0x8'),auth[_0xb07a('0x9')](),controller[_0xb07a('0xe')]);module[_0xb07a('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index bbc64ed..4babe0e 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 _0x696f=['exports','STRING','ENUM','first','second','third','sequelize'];(function(_0x4366c0,_0x29efcc){var _0x5a5838=function(_0x2fd0c2){while(--_0x2fd0c2){_0x4366c0['push'](_0x4366c0['shift']());}};_0x5a5838(++_0x29efcc);}(_0x696f,0x16b));var _0xf696=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x696f[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xf696('0x0'));module[_0xf696('0x1')]={'name':{'type':Sequelize[_0xf696('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xf696('0x3')](_0xf696('0x4'),_0xf696('0x5'),_0xf696('0x6')),'allowNull':![],'defaultValue':_0xf696('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x03a1=['sequelize','exports','STRING','ENUM','first'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x03a1,0x19f));var _0x103a=function(_0x27cbf7,_0x1438f6){_0x27cbf7=_0x27cbf7-0x0;var _0x284f77=_0x03a1[_0x27cbf7];return _0x284f77;};'use strict';var Sequelize=require(_0x103a('0x0'));module[_0x103a('0x1')]={'name':{'type':Sequelize[_0x103a('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x103a('0x3')](_0x103a('0x4'),'second','third'),'allowNull':![],'defaultValue':_0x103a('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index d87b9d5..e06c57a 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 _0x556c=['show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','Disposition','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch'];(function(_0x5f3562,_0x212f41){var _0x1b39b4=function(_0x153e49){while(--_0x153e49){_0x5f3562['push'](_0x5f3562['shift']());}};_0x1b39b4(++_0x212f41);}(_0x556c,0xa7));var _0xc556=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x556c[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc556('0x0'));var zipdir=require(_0xc556('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc556('0x2'));var moment=require(_0xc556('0x3'));var BPromise=require(_0xc556('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc556('0x5'));var sox=require(_0xc556('0x6'));var csv=require(_0xc556('0x7'));var ejs=require(_0xc556('0x8'));var fs=require('fs');var fs_extra=require(_0xc556('0x9'));var _=require('lodash');var squel=require(_0xc556('0xa'));var crypto=require(_0xc556('0xb'));var jsforce=require(_0xc556('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc556('0xd'));var Papa=require(_0xc556('0xe'));var Redis=require('ioredis');var authService=require(_0xc556('0xf'));var qs=require(_0xc556('0x10'));var as=require(_0xc556('0x11'));var hardwareService=require(_0xc556('0x12'));var logger=require(_0xc556('0x13'))(_0xc556('0x14'));var utils=require(_0xc556('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc556('0x16'));var db=require(_0xc556('0x17'))['db'];function respondWithStatusCode(_0x23a35c,_0x127a99){_0x127a99=_0x127a99||0xcc;return function(_0x210e3e){if(_0x210e3e){return _0x23a35c[_0xc556('0x18')](_0x127a99);}return _0x23a35c[_0xc556('0x19')](_0x127a99)[_0xc556('0x1a')]();};}function respondWithResult(_0x1cd1d8,_0x5a4f58){_0x5a4f58=_0x5a4f58||0xc8;return function(_0x37268c){if(_0x37268c){return _0x1cd1d8[_0xc556('0x19')](_0x5a4f58)[_0xc556('0x1b')](_0x37268c);}};}function respondWithFilteredResult(_0xdc7671,_0x19b64f){return function(_0x2e90d3){if(_0x2e90d3){var _0x5491d9=typeof _0x19b64f[_0xc556('0x1c')]==='undefined'&&typeof _0x19b64f[_0xc556('0x1d')]===_0xc556('0x1e');var _0x4d8d93=_0x2e90d3[_0xc556('0x1f')];var _0x55f495=_0x5491d9?0x0:_0x19b64f['offset'];var _0x27e493=_0x5491d9?_0x2e90d3[_0xc556('0x1f')]:_0x19b64f['offset']+_0x19b64f['limit'];var _0x449905;if(_0x27e493>=_0x4d8d93){_0x27e493=_0x4d8d93;_0x449905=0xc8;}else{_0x449905=0xce;}_0xdc7671[_0xc556('0x19')](_0x449905);return _0xdc7671[_0xc556('0x20')](_0xc556('0x21'),_0x55f495+'-'+_0x27e493+'/'+_0x4d8d93)[_0xc556('0x1b')](_0x2e90d3);}return null;};}function patchUpdates(_0x322c5){return function(_0x58f7d1){try{jsonpatch[_0xc556('0x22')](_0x58f7d1,_0x322c5,!![]);}catch(_0x4cfa0d){return BPromise[_0xc556('0x23')](_0x4cfa0d);}return _0x58f7d1[_0xc556('0x24')]();};}function saveUpdates(_0xd24557,_0x549545){return function(_0x3d8a45){if(_0x3d8a45){return _0x3d8a45[_0xc556('0x25')](_0xd24557)['then'](function(_0x56ec1c){return _0x56ec1c;});}return null;};}function removeEntity(_0x2082a5,_0x3b0c53){return function(_0x37e69b){if(_0x37e69b){return _0x37e69b['destroy']()[_0xc556('0x26')](function(){var _0x1a1541=_0x37e69b['get']({'plain':!![]});var _0x3d191f=_0xc556('0x27');return db[_0xc556('0x28')][_0xc556('0x29')]({'where':{'type':_0x3d191f,'resourceId':_0x1a1541['id']}})[_0xc556('0x26')](function(){return _0x37e69b;});})[_0xc556('0x26')](function(){_0x2082a5[_0xc556('0x19')](0xcc)[_0xc556('0x1a')]();});}};}function handleEntityNotFound(_0x36e68d,_0x4ee88e){return function(_0x2ed954){if(!_0x2ed954){_0x36e68d[_0xc556('0x18')](0x194);}return _0x2ed954;};}function handleError(_0x51fa77,_0x35c4d5){_0x35c4d5=_0x35c4d5||0x1f4;return function(_0x468ce8){logger[_0xc556('0x2a')](_0x468ce8[_0xc556('0x2b')]);if(_0x468ce8[_0xc556('0x2c')]){delete _0x468ce8[_0xc556('0x2c')];}_0x51fa77[_0xc556('0x19')](_0x35c4d5)[_0xc556('0x2d')](_0x468ce8);};}exports[_0xc556('0x2e')]=function(_0x1fbd49,_0x2df923){var _0x50b633={},_0x2f1044={},_0x3d4d30={'count':0x0,'rows':[]};var _0xecf902=_['map'](db[_0xc556('0x2f')]['rawAttributes'],function(_0x8b0d4d){return{'name':_0x8b0d4d['fieldName'],'type':_0x8b0d4d[_0xc556('0x30')][_0xc556('0x31')]};});_0x2f1044[_0xc556('0x32')]=_[_0xc556('0x33')](_0xecf902,_0xc556('0x2c'));_0x2f1044[_0xc556('0x34')]=_[_0xc556('0x35')](_0x1fbd49[_0xc556('0x34')]);_0x2f1044['filters']=_[_0xc556('0x36')](_0x2f1044['model'],_0x2f1044['query']);_0x50b633[_0xc556('0x37')]=_[_0xc556('0x36')](_0x2f1044['model'],qs[_0xc556('0x38')](_0x1fbd49['query']['fields']));_0x50b633[_0xc556('0x37')]=_0x50b633[_0xc556('0x37')][_0xc556('0x39')]?_0x50b633[_0xc556('0x37')]:_0x2f1044[_0xc556('0x32')];if(!_0x1fbd49[_0xc556('0x34')][_0xc556('0x3a')]('nolimit')){_0x50b633['limit']=qs[_0xc556('0x1d')](_0x1fbd49[_0xc556('0x34')][_0xc556('0x1d')]);_0x50b633[_0xc556('0x1c')]=qs[_0xc556('0x1c')](_0x1fbd49[_0xc556('0x34')]['offset']);}_0x50b633['order']=qs[_0xc556('0x3b')](_0x1fbd49[_0xc556('0x34')]['sort']);_0x50b633[_0xc556('0x3c')]=qs['filters'](_['pick'](_0x1fbd49[_0xc556('0x34')],_0x2f1044[_0xc556('0x3d')]),_0xecf902);if(_0x1fbd49['query']['filter']){_0x50b633[_0xc556('0x3c')]=_[_0xc556('0x3e')](_0x50b633['where'],{'$or':_[_0xc556('0x33')](_0xecf902,function(_0x9f5efd){if(_0x9f5efd[_0xc556('0x30')]!==_0xc556('0x3f')){var _0x31f7b0={};_0x31f7b0[_0x9f5efd['name']]={'$like':'%'+_0x1fbd49[_0xc556('0x34')][_0xc556('0x40')]+'%'};return _0x31f7b0;}})});}_0x50b633=_[_0xc556('0x3e')]({},_0x50b633,_0x1fbd49[_0xc556('0x41')]);var _0x2c9ba2={'where':_0x50b633['where']};return db[_0xc556('0x2f')][_0xc556('0x1f')](_0x2c9ba2)[_0xc556('0x26')](function(_0x5a25e9){_0x3d4d30[_0xc556('0x1f')]=_0x5a25e9;if(_0x1fbd49[_0xc556('0x34')][_0xc556('0x42')]){_0x50b633[_0xc556('0x43')]=[{'all':!![]}];}return db[_0xc556('0x2f')][_0xc556('0x44')](_0x50b633);})['then'](function(_0x2f8cb3){_0x3d4d30['rows']=_0x2f8cb3;return _0x3d4d30;})['then'](respondWithFilteredResult(_0x2df923,_0x50b633))[_0xc556('0x45')](handleError(_0x2df923,null));};exports[_0xc556('0x46')]=function(_0x87d9c4,_0x2b857b){var _0x18647d={'raw':!![],'where':{'id':_0x87d9c4[_0xc556('0x47')]['id']}},_0x1878ec={};_0x1878ec['model']=_['keys'](db[_0xc556('0x2f')]['rawAttributes']);_0x1878ec[_0xc556('0x34')]=_[_0xc556('0x35')](_0x87d9c4[_0xc556('0x34')]);_0x1878ec['filters']=_['intersection'](_0x1878ec[_0xc556('0x32')],_0x1878ec[_0xc556('0x34')]);_0x18647d[_0xc556('0x37')]=_[_0xc556('0x36')](_0x1878ec['model'],qs[_0xc556('0x38')](_0x87d9c4[_0xc556('0x34')][_0xc556('0x38')]));_0x18647d[_0xc556('0x37')]=_0x18647d[_0xc556('0x37')]['length']?_0x18647d[_0xc556('0x37')]:_0x1878ec[_0xc556('0x32')];if(_0x87d9c4[_0xc556('0x34')][_0xc556('0x42')]){_0x18647d[_0xc556('0x43')]=[{'all':!![]}];}_0x18647d=_[_0xc556('0x3e')]({},_0x18647d,_0x87d9c4['options']);return db['Disposition'][_0xc556('0x48')](_0x18647d)['then'](handleEntityNotFound(_0x2b857b,null))[_0xc556('0x26')](respondWithResult(_0x2b857b,null))[_0xc556('0x45')](handleError(_0x2b857b,null));};exports[_0xc556('0x49')]=function(_0x3eec47,_0x3de8fd){return db[_0xc556('0x2f')][_0xc556('0x49')](_0x3eec47['body'],{})[_0xc556('0x26')](function(_0x57ee63){var _0x49d222=_0x3eec47[_0xc556('0x4a')]['get']({'plain':!![]});if(!_0x49d222)throw new Error(_0xc556('0x4b'));if(_0x49d222['role']==='user'){var _0x82eb91=_0x57ee63['get']({'plain':!![]});var _0x37857b=_0xc556('0x27');return db['UserProfileSection'][_0xc556('0x48')]({'where':{'name':_0x37857b,'userProfileId':_0x49d222['userProfileId']},'raw':!![]})['then'](function(_0x434e9e){if(_0x434e9e&&_0x434e9e[_0xc556('0x4c')]===0x0){return db[_0xc556('0x28')]['create']({'name':_0x82eb91[_0xc556('0x2c')],'resourceId':_0x82eb91['id'],'type':_0x434e9e['name'],'sectionId':_0x434e9e['id']},{})[_0xc556('0x26')](function(){return _0x57ee63;});}else{return _0x57ee63;}})[_0xc556('0x45')](function(_0x38c5f9){logger[_0xc556('0x2a')](_0xc556('0x4d'),_0x38c5f9);throw _0x38c5f9;});}return _0x57ee63;})[_0xc556('0x26')](respondWithResult(_0x3de8fd,0xc9))[_0xc556('0x45')](handleError(_0x3de8fd,null));};exports[_0xc556('0x25')]=function(_0x1a5be1,_0x56bffd){if(_0x1a5be1[_0xc556('0x4e')]['id']){delete _0x1a5be1[_0xc556('0x4e')]['id'];}return db[_0xc556('0x2f')][_0xc556('0x48')]({'where':{'id':_0x1a5be1[_0xc556('0x47')]['id']}})[_0xc556('0x26')](handleEntityNotFound(_0x56bffd,null))['then'](saveUpdates(_0x1a5be1[_0xc556('0x4e')],null))['then'](respondWithResult(_0x56bffd,null))[_0xc556('0x45')](handleError(_0x56bffd,null));};exports['destroy']=function(_0x28eaf2,_0x2d3348){return db[_0xc556('0x2f')][_0xc556('0x48')]({'where':{'id':_0x28eaf2[_0xc556('0x47')]['id']}})[_0xc556('0x26')](handleEntityNotFound(_0x2d3348,null))[_0xc556('0x26')](removeEntity(_0x2d3348,null))[_0xc556('0x45')](handleError(_0x2d3348,null));}; \ No newline at end of file +var _0x9ff9=['util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','Dispositions','destroy','end','name','index','map','Disposition','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','keys','length','find','body','role','user','UserProfileSection','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x3b8618,_0x2ac2b0){var _0x24c98=function(_0x182761){while(--_0x182761){_0x3b8618['push'](_0x3b8618['shift']());}};_0x24c98(++_0x2ac2b0);}(_0x9ff9,0x1c3));var _0x99ff=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9ff9[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99ff('0x1'));var rp=require(_0x99ff('0x2'));var moment=require('moment');var BPromise=require(_0x99ff('0x3'));var Mustache=require(_0x99ff('0x4'));var util=require(_0x99ff('0x5'));var path=require(_0x99ff('0x6'));var sox=require('sox');var csv=require(_0x99ff('0x7'));var ejs=require(_0x99ff('0x8'));var fs=require('fs');var fs_extra=require(_0x99ff('0x9'));var _=require(_0x99ff('0xa'));var squel=require(_0x99ff('0xb'));var crypto=require('crypto');var jsforce=require(_0x99ff('0xc'));var deskjs=require(_0x99ff('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x99ff('0xe'));var Redis=require('ioredis');var authService=require(_0x99ff('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x99ff('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99ff('0x11'))(_0x99ff('0x12'));var utils=require(_0x99ff('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x99ff('0x14'));var db=require(_0x99ff('0x15'))['db'];function respondWithStatusCode(_0x1de5be,_0x1b782f){_0x1b782f=_0x1b782f||0xcc;return function(_0x4ec802){if(_0x4ec802){return _0x1de5be[_0x99ff('0x16')](_0x1b782f);}return _0x1de5be[_0x99ff('0x17')](_0x1b782f)['end']();};}function respondWithResult(_0x25af26,_0x4a3a32){_0x4a3a32=_0x4a3a32||0xc8;return function(_0x54fd60){if(_0x54fd60){return _0x25af26[_0x99ff('0x17')](_0x4a3a32)[_0x99ff('0x18')](_0x54fd60);}};}function respondWithFilteredResult(_0x115c25,_0x380718){return function(_0x3c145e){if(_0x3c145e){var _0x45df30=typeof _0x380718[_0x99ff('0x19')]===_0x99ff('0x1a')&&typeof _0x380718['limit']==='undefined';var _0x5d5e95=_0x3c145e[_0x99ff('0x1b')];var _0x2a2584=_0x45df30?0x0:_0x380718[_0x99ff('0x19')];var _0x3517f3=_0x45df30?_0x3c145e[_0x99ff('0x1b')]:_0x380718[_0x99ff('0x19')]+_0x380718[_0x99ff('0x1c')];var _0x4cb396;if(_0x3517f3>=_0x5d5e95){_0x3517f3=_0x5d5e95;_0x4cb396=0xc8;}else{_0x4cb396=0xce;}_0x115c25['status'](_0x4cb396);return _0x115c25[_0x99ff('0x1d')]('Content-Range',_0x2a2584+'-'+_0x3517f3+'/'+_0x5d5e95)[_0x99ff('0x18')](_0x3c145e);}return null;};}function patchUpdates(_0x2e8015){return function(_0x15e444){try{jsonpatch[_0x99ff('0x1e')](_0x15e444,_0x2e8015,!![]);}catch(_0x464350){return BPromise[_0x99ff('0x1f')](_0x464350);}return _0x15e444[_0x99ff('0x20')]();};}function saveUpdates(_0x2f537a,_0x4a1c85){return function(_0x2a5ff0){if(_0x2a5ff0){return _0x2a5ff0[_0x99ff('0x21')](_0x2f537a)[_0x99ff('0x22')](function(_0x2271e3){return _0x2271e3;});}return null;};}function removeEntity(_0x4d1c7a,_0x3eb51d){return function(_0x2545ff){if(_0x2545ff){return _0x2545ff['destroy']()[_0x99ff('0x22')](function(){var _0x2b4ffb=_0x2545ff[_0x99ff('0x23')]({'plain':!![]});var _0x424b86=_0x99ff('0x24');return db['UserProfileResource'][_0x99ff('0x25')]({'where':{'type':_0x424b86,'resourceId':_0x2b4ffb['id']}})[_0x99ff('0x22')](function(){return _0x2545ff;});})[_0x99ff('0x22')](function(){_0x4d1c7a[_0x99ff('0x17')](0xcc)[_0x99ff('0x26')]();});}};}function handleEntityNotFound(_0x21b2ed,_0x281750){return function(_0xe3a021){if(!_0xe3a021){_0x21b2ed[_0x99ff('0x16')](0x194);}return _0xe3a021;};}function handleError(_0x39d4f1,_0xd5d704){_0xd5d704=_0xd5d704||0x1f4;return function(_0x8d2710){logger['error'](_0x8d2710['stack']);if(_0x8d2710[_0x99ff('0x27')]){delete _0x8d2710[_0x99ff('0x27')];}_0x39d4f1[_0x99ff('0x17')](_0xd5d704)['send'](_0x8d2710);};}exports[_0x99ff('0x28')]=function(_0x5ddde5,_0x4b49bb){var _0x4c8c65={},_0x26f67f={},_0x2a92d7={'count':0x0,'rows':[]};var _0x39ba4e=_[_0x99ff('0x29')](db[_0x99ff('0x2a')][_0x99ff('0x2b')],function(_0x4d09b1){return{'name':_0x4d09b1['fieldName'],'type':_0x4d09b1['type']['key']};});_0x26f67f[_0x99ff('0x2c')]=_['map'](_0x39ba4e,_0x99ff('0x27'));_0x26f67f[_0x99ff('0x2d')]=_['keys'](_0x5ddde5['query']);_0x26f67f[_0x99ff('0x2e')]=_[_0x99ff('0x2f')](_0x26f67f[_0x99ff('0x2c')],_0x26f67f[_0x99ff('0x2d')]);_0x4c8c65[_0x99ff('0x30')]=_[_0x99ff('0x2f')](_0x26f67f[_0x99ff('0x2c')],qs[_0x99ff('0x31')](_0x5ddde5[_0x99ff('0x2d')][_0x99ff('0x31')]));_0x4c8c65[_0x99ff('0x30')]=_0x4c8c65[_0x99ff('0x30')]['length']?_0x4c8c65[_0x99ff('0x30')]:_0x26f67f[_0x99ff('0x2c')];if(!_0x5ddde5[_0x99ff('0x2d')][_0x99ff('0x32')]('nolimit')){_0x4c8c65[_0x99ff('0x1c')]=qs[_0x99ff('0x1c')](_0x5ddde5[_0x99ff('0x2d')]['limit']);_0x4c8c65[_0x99ff('0x19')]=qs[_0x99ff('0x19')](_0x5ddde5[_0x99ff('0x2d')][_0x99ff('0x19')]);}_0x4c8c65[_0x99ff('0x33')]=qs[_0x99ff('0x34')](_0x5ddde5[_0x99ff('0x2d')][_0x99ff('0x34')]);_0x4c8c65['where']=qs['filters'](_['pick'](_0x5ddde5[_0x99ff('0x2d')],_0x26f67f['filters']),_0x39ba4e);if(_0x5ddde5['query'][_0x99ff('0x35')]){_0x4c8c65[_0x99ff('0x36')]=_['merge'](_0x4c8c65['where'],{'$or':_['map'](_0x39ba4e,function(_0x180213){if(_0x180213[_0x99ff('0x37')]!==_0x99ff('0x38')){var _0x20e2c1={};_0x20e2c1[_0x180213['name']]={'$like':'%'+_0x5ddde5[_0x99ff('0x2d')]['filter']+'%'};return _0x20e2c1;}})});}_0x4c8c65=_[_0x99ff('0x39')]({},_0x4c8c65,_0x5ddde5[_0x99ff('0x3a')]);var _0x514fe5={'where':_0x4c8c65[_0x99ff('0x36')]};return db[_0x99ff('0x2a')]['count'](_0x514fe5)[_0x99ff('0x22')](function(_0xabf91f){_0x2a92d7['count']=_0xabf91f;if(_0x5ddde5[_0x99ff('0x2d')][_0x99ff('0x3b')]){_0x4c8c65['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4c8c65);})[_0x99ff('0x22')](function(_0x5f3cbe){_0x2a92d7[_0x99ff('0x3c')]=_0x5f3cbe;return _0x2a92d7;})['then'](respondWithFilteredResult(_0x4b49bb,_0x4c8c65))[_0x99ff('0x3d')](handleError(_0x4b49bb,null));};exports[_0x99ff('0x3e')]=function(_0x33ea10,_0x3a374e){var _0x8929e5={'raw':!![],'where':{'id':_0x33ea10[_0x99ff('0x3f')]['id']}},_0x17079d={};_0x17079d[_0x99ff('0x2c')]=_[_0x99ff('0x40')](db[_0x99ff('0x2a')]['rawAttributes']);_0x17079d[_0x99ff('0x2d')]=_[_0x99ff('0x40')](_0x33ea10[_0x99ff('0x2d')]);_0x17079d[_0x99ff('0x2e')]=_['intersection'](_0x17079d[_0x99ff('0x2c')],_0x17079d[_0x99ff('0x2d')]);_0x8929e5[_0x99ff('0x30')]=_[_0x99ff('0x2f')](_0x17079d[_0x99ff('0x2c')],qs[_0x99ff('0x31')](_0x33ea10[_0x99ff('0x2d')][_0x99ff('0x31')]));_0x8929e5['attributes']=_0x8929e5[_0x99ff('0x30')][_0x99ff('0x41')]?_0x8929e5['attributes']:_0x17079d[_0x99ff('0x2c')];if(_0x33ea10[_0x99ff('0x2d')][_0x99ff('0x3b')]){_0x8929e5['include']=[{'all':!![]}];}_0x8929e5=_[_0x99ff('0x39')]({},_0x8929e5,_0x33ea10[_0x99ff('0x3a')]);return db[_0x99ff('0x2a')][_0x99ff('0x42')](_0x8929e5)[_0x99ff('0x22')](handleEntityNotFound(_0x3a374e,null))[_0x99ff('0x22')](respondWithResult(_0x3a374e,null))['catch'](handleError(_0x3a374e,null));};exports['create']=function(_0x5eb954,_0x1eeb28){return db[_0x99ff('0x2a')]['create'](_0x5eb954[_0x99ff('0x43')],{})['then'](function(_0x11ffc3){var _0x265046=_0x5eb954['user'][_0x99ff('0x23')]({'plain':!![]});if(!_0x265046)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x265046[_0x99ff('0x44')]===_0x99ff('0x45')){var _0x1fb97d=_0x11ffc3[_0x99ff('0x23')]({'plain':!![]});var _0x41579=_0x99ff('0x24');return db[_0x99ff('0x46')][_0x99ff('0x42')]({'where':{'name':_0x41579,'userProfileId':_0x265046['userProfileId']},'raw':!![]})[_0x99ff('0x22')](function(_0x168b62){if(_0x168b62&&_0x168b62[_0x99ff('0x47')]===0x0){return db[_0x99ff('0x48')][_0x99ff('0x49')]({'name':_0x1fb97d[_0x99ff('0x27')],'resourceId':_0x1fb97d['id'],'type':_0x168b62[_0x99ff('0x27')],'sectionId':_0x168b62['id']},{})[_0x99ff('0x22')](function(){return _0x11ffc3;});}else{return _0x11ffc3;}})[_0x99ff('0x3d')](function(_0x2fd54c){logger[_0x99ff('0x4a')](_0x99ff('0x4b'),_0x2fd54c);throw _0x2fd54c;});}return _0x11ffc3;})[_0x99ff('0x22')](respondWithResult(_0x1eeb28,0xc9))[_0x99ff('0x3d')](handleError(_0x1eeb28,null));};exports['update']=function(_0x53e2eb,_0x566a88){if(_0x53e2eb[_0x99ff('0x43')]['id']){delete _0x53e2eb[_0x99ff('0x43')]['id'];}return db[_0x99ff('0x2a')]['find']({'where':{'id':_0x53e2eb[_0x99ff('0x3f')]['id']}})[_0x99ff('0x22')](handleEntityNotFound(_0x566a88,null))[_0x99ff('0x22')](saveUpdates(_0x53e2eb[_0x99ff('0x43')],null))[_0x99ff('0x22')](respondWithResult(_0x566a88,null))[_0x99ff('0x3d')](handleError(_0x566a88,null));};exports[_0x99ff('0x25')]=function(_0xd9f03e,_0x14d7de){return db[_0x99ff('0x2a')][_0x99ff('0x42')]({'where':{'id':_0xd9f03e[_0x99ff('0x3f')]['id']}})['then'](handleEntityNotFound(_0x14d7de,null))[_0x99ff('0x22')](removeEntity(_0x14d7de,null))[_0x99ff('0x3d')](handleError(_0x14d7de,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a10da0e..aa4262f 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 _0xcccc=['name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird','path','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','name_mail'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xcccc,0x1c0));var _0xcccc=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0xcccc[_0x27530d];return _0x59e561;};'use strict';var _=require('lodash');var util=require(_0xcccc('0x0'));var logger=require(_0xcccc('0x1'))(_0xcccc('0x2'));var moment=require('moment');var BPromise=require(_0xcccc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcccc('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcccc('0x5'));module[_0xcccc('0x6')]=function(_0x59b7ca,_0x59d971){return _0x59b7ca[_0xcccc('0x7')]('Disposition',attributes,{'tableName':_0xcccc('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xcccc('0x9'),'fields':[_0xcccc('0xa'),_0xcccc('0xb')]},{'unique':!![],'name':_0xcccc('0xc'),'fields':[_0xcccc('0xa'),'ChatWebsiteId']},{'unique':!![],'name':_0xcccc('0xd'),'fields':[_0xcccc('0xa'),'MailAccountId']},{'unique':!![],'name':_0xcccc('0xe'),'fields':[_0xcccc('0xa'),'SmsAccountId']},{'unique':!![],'name':_0xcccc('0xf'),'fields':['name',_0xcccc('0x10')]},{'unique':!![],'name':_0xcccc('0x11'),'fields':[_0xcccc('0xa'),_0xcccc('0x12')]},{'unique':!![],'name':_0xcccc('0x13'),'fields':[_0xcccc('0xa'),_0xcccc('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdac3=['MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','ListId','name_chat','name'];(function(_0x4c1595,_0x3fd027){var _0x500e25=function(_0x51bade){while(--_0x51bade){_0x4c1595['push'](_0x4c1595['shift']());}};_0x500e25(++_0x3fd027);}(_0xdac3,0x1ec));var _0x3dac=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0xdac3[_0x2bb66c];return _0x1e0f98;};'use strict';var _=require(_0x3dac('0x0'));var util=require(_0x3dac('0x1'));var logger=require(_0x3dac('0x2'))('api');var moment=require(_0x3dac('0x3'));var BPromise=require(_0x3dac('0x4'));var rp=require(_0x3dac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dac('0x6'));var config=require(_0x3dac('0x7'));var attributes=require(_0x3dac('0x8'));module[_0x3dac('0x9')]=function(_0x466516,_0x4bca4c){return _0x466516['define'](_0x3dac('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0x3dac('0xb')]},{'unique':!![],'name':_0x3dac('0xc'),'fields':[_0x3dac('0xd'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':['name',_0x3dac('0xe')]},{'unique':!![],'name':_0x3dac('0xf'),'fields':[_0x3dac('0xd'),_0x3dac('0x10')]},{'unique':!![],'name':'name_fax','fields':[_0x3dac('0xd'),_0x3dac('0x11')]},{'unique':!![],'name':_0x3dac('0x12'),'fields':[_0x3dac('0xd'),_0x3dac('0x13')]},{'unique':!![],'name':_0x3dac('0x14'),'fields':[_0x3dac('0xd'),_0x3dac('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 88795e2..4987ac0 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(_0x26ce47,_0x935a29){var _0x4bf901=function(_0x17724e){while(--_0x17724e){_0x26ce47['push'](_0x26ce47['shift']());}};_0x4bf901(++_0x935a29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x5bc93b,_0x2694a3){var _0x2ed54b=function(_0x303ee9){while(--_0x303ee9){_0x5bc93b['push'](_0x5bc93b['shift']());}};_0x2ed54b(++_0x2694a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 02cd658..314e9ce 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 _0x77f9=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','path'];(function(_0x287b6a,_0x3b181d){var _0x4c070e=function(_0x5700ba){while(--_0x5700ba){_0x287b6a['push'](_0x287b6a['shift']());}};_0x4c070e(++_0x3b181d);}(_0x77f9,0x13e));var _0x977f=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x77f9[_0x1d1d09];return _0x8827e;};'use strict';var multer=require(_0x977f('0x0'));var util=require('util');var path=require(_0x977f('0x1'));var timeout=require(_0x977f('0x2'));var express=require(_0x977f('0x3'));var router=express[_0x977f('0x4')]();var fs_extra=require(_0x977f('0x5'));var auth=require(_0x977f('0x6'));var interaction=require(_0x977f('0x7'));var config=require(_0x977f('0x8'));var controller=require(_0x977f('0x9'));router[_0x977f('0xa')]('/',auth[_0x977f('0xb')](),controller[_0x977f('0xc')]);router[_0x977f('0xa')](_0x977f('0xd'),auth[_0x977f('0xb')](),controller[_0x977f('0xe')]);router[_0x977f('0xf')]('/',auth[_0x977f('0xb')](),controller[_0x977f('0x10')]);router['put'](_0x977f('0xd'),auth[_0x977f('0xb')](),controller[_0x977f('0x11')]);router[_0x977f('0x12')]('/:id',auth[_0x977f('0xb')](),controller['destroy']);module[_0x977f('0x13')]=router; \ No newline at end of file +var _0x97ee=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0x18b04b,_0x14e373){var _0x361749=function(_0xbf51f6){while(--_0xbf51f6){_0x18b04b['push'](_0x18b04b['shift']());}};_0x361749(++_0x14e373);}(_0x97ee,0x11d));var _0xe97e=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x97ee[_0x308213];return _0x2e1619;};'use strict';var multer=require(_0xe97e('0x0'));var util=require('util');var path=require(_0xe97e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe97e('0x2')]();var fs_extra=require(_0xe97e('0x3'));var auth=require(_0xe97e('0x4'));var interaction=require(_0xe97e('0x5'));var config=require('../../config/environment');var controller=require(_0xe97e('0x6'));router['get']('/',auth[_0xe97e('0x7')](),controller['index']);router['get'](_0xe97e('0x8'),auth[_0xe97e('0x7')](),controller[_0xe97e('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe97e('0xa')]);router[_0xe97e('0xb')](_0xe97e('0x8'),auth[_0xe97e('0x7')](),controller[_0xe97e('0xc')]);router[_0xe97e('0xd')]('/:id',auth[_0xe97e('0x7')](),controller[_0xe97e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index c106265..b0bc585 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 _0xba99=['STRING','yes','localstationid','ENUM','2400','9600','12000','14400','4800','7200','INTEGER','SIP','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x5bed39,_0x3d4347){var _0x523a8e=function(_0x294bc6){while(--_0x294bc6){_0x5bed39['push'](_0x5bed39['shift']());}};_0x523a8e(++_0x3d4347);}(_0xba99,0x153));var _0x9ba9=function(_0x887aca,_0x1c29c0){_0x887aca=_0x887aca-0x0;var _0x47a782=_0xba99[_0x887aca];return _0x47a782;};'use strict';var Sequelize=require(_0x9ba9('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ba9('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9ba9('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x9ba9('0x2'),'no'),'defaultValue':_0x9ba9('0x2')},'headerinfo':{'type':Sequelize[_0x9ba9('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x9ba9('0x1')],'unique':_0x9ba9('0x3')},'minrate':{'type':Sequelize[_0x9ba9('0x4')](_0x9ba9('0x5'),'4800','7200',_0x9ba9('0x6'),_0x9ba9('0x7'),_0x9ba9('0x8')),'defaultValue':_0x9ba9('0x9')},'maxrate':{'type':Sequelize[_0x9ba9('0x4')]('2400','4800',_0x9ba9('0xa'),_0x9ba9('0x6'),'12000',_0x9ba9('0x8')),'defaultValue':_0x9ba9('0x8')},'modem':{'type':Sequelize[_0x9ba9('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x9ba9('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9ba9('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9ba9('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9ba9('0x4')](_0x9ba9('0xc'),'IAX','DADHI',_0x9ba9('0xd')),'defaultValue':_0x9ba9('0xc')},'key':{'type':Sequelize[_0x9ba9('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9ba9('0xe')],'defaultValue':function(){return _0x9ba9('0xf');}},'notificationSound':{'type':Sequelize[_0x9ba9('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9ba9('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9ba9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9ba9('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ba9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9ba9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9ba9('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5a74e1){if(!_0x5a74e1)this[_0x9ba9('0x11')](_0x9ba9('0x12'),null);this['setDataValue'](_0x9ba9('0x13'),_0x5a74e1);}}}; \ No newline at end of file +var _0x2a4d=['mandatoryDisposition','sequelize','exports','STRING','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','ENUM','14400','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x83b40d,_0x5349fb){var _0x5d0269=function(_0x168930){while(--_0x168930){_0x83b40d['push'](_0x83b40d['shift']());}};_0x5d0269(++_0x5349fb);}(_0x2a4d,0x1e1));var _0xd2a4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x2a4d[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0xd2a4('0x0'));module[_0xd2a4('0x1')]={'name':{'type':Sequelize[_0xd2a4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd2a4('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xd2a4('0x2')],'defaultValue':_0xd2a4('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xd2a4('0x4')},'minrate':{'type':Sequelize['ENUM'](_0xd2a4('0x5'),_0xd2a4('0x6'),_0xd2a4('0x7'),_0xd2a4('0x8'),_0xd2a4('0x9'),'14400'),'defaultValue':_0xd2a4('0x6')},'maxrate':{'type':Sequelize[_0xd2a4('0xa')](_0xd2a4('0x5'),'4800',_0xd2a4('0x7'),_0xd2a4('0x8'),_0xd2a4('0x9'),_0xd2a4('0xb')),'defaultValue':_0xd2a4('0xb')},'modem':{'type':Sequelize[_0xd2a4('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xd2a4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd2a4('0xa')](_0xd2a4('0xc'),_0xd2a4('0xd'),_0xd2a4('0xe'),_0xd2a4('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xd2a4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd2a4('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd2a4('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd2a4('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd2a4('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd2a4('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd2a4('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd2a4('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd2a4('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0xd2a4('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xd2a4('0x11')],'defaultValue':![],'comment':_0xd2a4('0x14'),'set':function(_0x22e0c5){if(!_0x22e0c5)this[_0xd2a4('0x15')](_0xd2a4('0x16'),null);this['setDataValue'](_0xd2a4('0x17'),_0x22e0c5);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5d7cdb7..3318b79 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 _0xe433=['addAnswer','CannedAnswer','getAnswers','include','addInteraction','FaxInteraction','omit','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','FaxApplication','bulkCreate','getApplications','context','from-voip-provider','localstationid','app','system','appdata','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','transaction','createdAt','updatedAt','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','defaults','ListId','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','moment','bluebird','mustache','util','path','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','includeAll','FaxAccount','findAll','rows','params','mandatoryDispositionPause','options','find','body','user','get','userProfileId','autoAssociation','create','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids'];(function(_0x4b9772,_0x38b81a){var _0xb833d4=function(_0x5d9ded){while(--_0x5d9ded){_0x4b9772['push'](_0x4b9772['shift']());}};_0xb833d4(++_0x38b81a);}(_0xe433,0x102));var _0x3e43=function(_0x4f23ed,_0x3eea38){_0x4f23ed=_0x4f23ed-0x0;var _0x2beac4=_0xe433[_0x4f23ed];return _0x2beac4;};'use strict';var emlformat=require(_0x3e43('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3e43('0x1'));var BPromise=require(_0x3e43('0x2'));var Mustache=require(_0x3e43('0x3'));var util=require(_0x3e43('0x4'));var path=require(_0x3e43('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e43('0x6'));var _=require('lodash');var squel=require(_0x3e43('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3e43('0x8'));var toCsv=require(_0x3e43('0x9'));var querystring=require(_0x3e43('0xa'));var Papa=require('papaparse');var Redis=require(_0x3e43('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x3e43('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e43('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x3e43('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0x3e43('0xf'));var db=require(_0x3e43('0x10'))['db'];config[_0x3e43('0x11')]=_['defaults'](config[_0x3e43('0x11')],{'host':_0x3e43('0x12'),'port':0x18eb});var socket=require(_0x3e43('0x13'))(new Redis(config['redis']));require(_0x3e43('0x14'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3e43('0x15')][_0x3e43('0x16')]({'port':0x232c});var client9002=jayson[_0x3e43('0x15')][_0x3e43('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x4ff9b7,_0x1e2ff0,_0x572f8d,_0x1ead17){return new BPromise(function(_0x3fece4,_0x4d733d){var _0xbb7056=_0x1ead17||client;return _0xbb7056[_0x3e43('0x17')](_0x4ff9b7,_0x572f8d)[_0x3e43('0x18')](function(_0x2025cd){logger[_0x3e43('0x19')]('FaxAccount,\x20%s,\x20%s',_0x1e2ff0,_0x3e43('0x1a'));logger[_0x3e43('0x1b')](_0x3e43('0x1c'),_0x1e2ff0,_0x3e43('0x1a'),JSON[_0x3e43('0x1d')](_0x2025cd));if(_0x2025cd['error']){if(_0x2025cd[_0x3e43('0x1e')][_0x3e43('0x1f')]===0x1f4){logger[_0x3e43('0x1e')](_0x3e43('0x20'),_0x1e2ff0,_0x2025cd['error'][_0x3e43('0x21')]);return _0x4d733d(_0x2025cd[_0x3e43('0x1e')][_0x3e43('0x21')]);}logger[_0x3e43('0x1e')](_0x3e43('0x20'),_0x1e2ff0,_0x2025cd[_0x3e43('0x1e')]['message']);return _0x3fece4(_0x2025cd[_0x3e43('0x1e')][_0x3e43('0x21')]);}else{logger[_0x3e43('0x19')](_0x3e43('0x20'),_0x1e2ff0,'request\x20sent');_0x3fece4(_0x2025cd[_0x3e43('0x22')]['message']);}})[_0x3e43('0x23')](function(_0x1d0f30){logger['error'](_0x3e43('0x20'),_0x1e2ff0,_0x1d0f30);_0x4d733d(_0x1d0f30);});});}function respondWithStatusCode(_0x5d2d25,_0x108df6){_0x108df6=_0x108df6||0xcc;return function(_0x2aac6d){if(_0x2aac6d){return _0x5d2d25[_0x3e43('0x24')](_0x108df6);}return _0x5d2d25['status'](_0x108df6)['end']();};}function respondWithResult(_0x5cf372,_0x2a0792){_0x2a0792=_0x2a0792||0xc8;return function(_0x35f057){if(_0x35f057){return _0x5cf372[_0x3e43('0x25')](_0x2a0792)[_0x3e43('0x26')](_0x35f057);}};}function respondWithFilteredResult(_0x4d9eba,_0x507368){return function(_0x359c9c){if(_0x359c9c){var _0x1aef20=typeof _0x507368[_0x3e43('0x27')]===_0x3e43('0x28')&&typeof _0x507368[_0x3e43('0x29')]===_0x3e43('0x28');var _0x2c0000=_0x359c9c['count'];var _0x13f67b=_0x1aef20?0x0:_0x507368[_0x3e43('0x27')];var _0x398132=_0x1aef20?_0x359c9c[_0x3e43('0x2a')]:_0x507368[_0x3e43('0x27')]+_0x507368[_0x3e43('0x29')];var _0x44ca13;if(_0x398132>=_0x2c0000){_0x398132=_0x2c0000;_0x44ca13=0xc8;}else{_0x44ca13=0xce;}_0x4d9eba[_0x3e43('0x25')](_0x44ca13);return _0x4d9eba['set'](_0x3e43('0x2b'),_0x13f67b+'-'+_0x398132+'/'+_0x2c0000)[_0x3e43('0x26')](_0x359c9c);}return null;};}function patchUpdates(_0xf63213){return function(_0x3d2bb5){try{jsonpatch['apply'](_0x3d2bb5,_0xf63213,!![]);}catch(_0x3fdbf8){return BPromise[_0x3e43('0x2c')](_0x3fdbf8);}return _0x3d2bb5[_0x3e43('0x2d')]();};}function saveUpdates(_0xa11c6b,_0x360556){return function(_0x4b2130){if(_0x4b2130){return _0x4b2130['update'](_0xa11c6b)[_0x3e43('0x18')](function(_0x2ce374){return _0x2ce374;});}return null;};}function removeEntity(_0x2fc768,_0x317d31){return function(_0x243402){if(_0x243402){return _0x243402[_0x3e43('0x2e')]()['then'](function(){var _0x1b35c3=_0x243402['get']({'plain':!![]});var _0xa357f7=_0x3e43('0x2f');return db[_0x3e43('0x30')][_0x3e43('0x2e')]({'where':{'type':_0xa357f7,'resourceId':_0x1b35c3['id']}})[_0x3e43('0x18')](function(){return _0x243402;});})[_0x3e43('0x18')](function(){_0x2fc768['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd29ba,_0x2513b8){return function(_0x2ce759){if(!_0x2ce759){_0xdd29ba['sendStatus'](0x194);}return _0x2ce759;};}function handleError(_0x1b62c1,_0x18b386){_0x18b386=_0x18b386||0x1f4;return function(_0x7d5d7b){logger[_0x3e43('0x1e')](_0x7d5d7b[_0x3e43('0x31')]);if(_0x7d5d7b['name']){delete _0x7d5d7b[_0x3e43('0x32')];}_0x1b62c1['status'](_0x18b386)[_0x3e43('0x33')](_0x7d5d7b);};}exports[_0x3e43('0x34')]=function(_0x37977a,_0x2d5c2e){var _0xf9aca7={'include':[{'model':db[_0x3e43('0x35')],'as':'mandatoryDispositionPause'}]},_0x505ecf={},_0x11dbc9={'count':0x0,'rows':[]};var _0x4f0828=_[_0x3e43('0x36')](db['FaxAccount'][_0x3e43('0x37')],function(_0x2326c4){return{'name':_0x2326c4[_0x3e43('0x38')],'type':_0x2326c4['type'][_0x3e43('0x39')]};});_0x505ecf[_0x3e43('0x3a')]=_[_0x3e43('0x36')](_0x4f0828,_0x3e43('0x32'));_0x505ecf[_0x3e43('0x3b')]=_[_0x3e43('0x3c')](_0x37977a[_0x3e43('0x3b')]);_0x505ecf[_0x3e43('0x3d')]=_[_0x3e43('0x3e')](_0x505ecf[_0x3e43('0x3a')],_0x505ecf[_0x3e43('0x3b')]);_0xf9aca7[_0x3e43('0x3f')]=_[_0x3e43('0x3e')](_0x505ecf[_0x3e43('0x3a')],qs[_0x3e43('0x40')](_0x37977a[_0x3e43('0x3b')][_0x3e43('0x40')]));_0xf9aca7[_0x3e43('0x3f')]=_0xf9aca7['attributes'][_0x3e43('0x41')]?_0xf9aca7[_0x3e43('0x3f')]:_0x505ecf[_0x3e43('0x3a')];if(!_0x37977a[_0x3e43('0x3b')][_0x3e43('0x42')](_0x3e43('0x43'))){_0xf9aca7['limit']=qs[_0x3e43('0x29')](_0x37977a[_0x3e43('0x3b')][_0x3e43('0x29')]);_0xf9aca7['offset']=qs[_0x3e43('0x27')](_0x37977a['query'][_0x3e43('0x27')]);}_0xf9aca7['order']=qs[_0x3e43('0x44')](_0x37977a[_0x3e43('0x3b')][_0x3e43('0x44')]);_0xf9aca7['where']=qs[_0x3e43('0x3d')](_[_0x3e43('0x45')](_0x37977a[_0x3e43('0x3b')],_0x505ecf[_0x3e43('0x3d')]),_0x4f0828);if(_0x37977a[_0x3e43('0x3b')][_0x3e43('0x46')]){_0xf9aca7[_0x3e43('0x47')]=_[_0x3e43('0x48')](_0xf9aca7[_0x3e43('0x47')],{'$or':_[_0x3e43('0x36')](_0x4f0828,function(_0x4db08c){if(_0x4db08c[_0x3e43('0x49')]!=='VIRTUAL'){var _0x2cd776={};_0x2cd776[_0x4db08c[_0x3e43('0x32')]]={'$like':'%'+_0x37977a['query'][_0x3e43('0x46')]+'%'};return _0x2cd776;}})});}_0xf9aca7=_[_0x3e43('0x48')]({},_0xf9aca7,_0x37977a['options']);var _0x4addd8={'where':_0xf9aca7[_0x3e43('0x47')]};return db['FaxAccount'][_0x3e43('0x2a')](_0x4addd8)[_0x3e43('0x18')](function(_0x2a8425){_0x11dbc9[_0x3e43('0x2a')]=_0x2a8425;if(_0x37977a[_0x3e43('0x3b')][_0x3e43('0x4a')]){_0xf9aca7['include']=[{'all':!![]}];}return db[_0x3e43('0x4b')][_0x3e43('0x4c')](_0xf9aca7);})[_0x3e43('0x18')](function(_0x325bdb){_0x11dbc9[_0x3e43('0x4d')]=_0x325bdb;return _0x11dbc9;})['then'](respondWithFilteredResult(_0x2d5c2e,_0xf9aca7))[_0x3e43('0x23')](handleError(_0x2d5c2e,null));};exports['show']=function(_0x52d9a4,_0x39cd27){var _0x5b6308={'raw':![],'where':{'id':_0x52d9a4[_0x3e43('0x4e')]['id']},'include':[{'model':db[_0x3e43('0x35')],'as':_0x3e43('0x4f')}]},_0x569d2a={};_0x569d2a[_0x3e43('0x3a')]=_[_0x3e43('0x3c')](db[_0x3e43('0x4b')][_0x3e43('0x37')]);_0x569d2a[_0x3e43('0x3b')]=_[_0x3e43('0x3c')](_0x52d9a4['query']);_0x569d2a['filters']=_[_0x3e43('0x3e')](_0x569d2a['model'],_0x569d2a[_0x3e43('0x3b')]);_0x5b6308[_0x3e43('0x3f')]=_[_0x3e43('0x3e')](_0x569d2a[_0x3e43('0x3a')],qs[_0x3e43('0x40')](_0x52d9a4[_0x3e43('0x3b')][_0x3e43('0x40')]));_0x5b6308['attributes']=_0x5b6308[_0x3e43('0x3f')]['length']?_0x5b6308['attributes']:_0x569d2a[_0x3e43('0x3a')];if(_0x52d9a4['query'][_0x3e43('0x4a')]){_0x5b6308['include']=[{'all':!![]}];}_0x5b6308=_[_0x3e43('0x48')]({},_0x5b6308,_0x52d9a4[_0x3e43('0x50')]);return db[_0x3e43('0x4b')][_0x3e43('0x51')](_0x5b6308)[_0x3e43('0x18')](handleEntityNotFound(_0x39cd27,null))[_0x3e43('0x18')](respondWithResult(_0x39cd27,null))['catch'](handleError(_0x39cd27,null));};exports['create']=function(_0x45fba4,_0x1111cd){return db['FaxAccount']['create'](_0x45fba4[_0x3e43('0x52')],{})[_0x3e43('0x18')](function(_0x131da7){var _0x37ac08=_0x45fba4[_0x3e43('0x53')]['get']({'plain':!![]});if(!_0x37ac08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37ac08['role']==='user'){var _0x9bdba0=_0x131da7[_0x3e43('0x54')]({'plain':!![]});var _0x481c72=_0x3e43('0x2f');return db['UserProfileSection'][_0x3e43('0x51')]({'where':{'name':_0x481c72,'userProfileId':_0x37ac08[_0x3e43('0x55')]},'raw':!![]})[_0x3e43('0x18')](function(_0x1769ed){if(_0x1769ed&&_0x1769ed[_0x3e43('0x56')]===0x0){return db[_0x3e43('0x30')][_0x3e43('0x57')]({'name':_0x9bdba0['name'],'resourceId':_0x9bdba0['id'],'type':_0x1769ed['name'],'sectionId':_0x1769ed['id']},{})[_0x3e43('0x18')](function(){return _0x131da7;});}else{return _0x131da7;}})[_0x3e43('0x23')](function(_0x411357){logger[_0x3e43('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x411357);throw _0x411357;});}return _0x131da7;})[_0x3e43('0x18')](respondWithResult(_0x1111cd,0xc9))[_0x3e43('0x23')](handleError(_0x1111cd,null));};exports[_0x3e43('0x58')]=function(_0x1a1459,_0x9da115){if(_0x1a1459['body']['id']){delete _0x1a1459['body']['id'];}return db[_0x3e43('0x4b')][_0x3e43('0x51')]({'where':{'id':_0x1a1459[_0x3e43('0x4e')]['id']},'include':[{'model':db[_0x3e43('0x35')],'as':_0x3e43('0x4f')}]})['then'](handleEntityNotFound(_0x9da115,null))[_0x3e43('0x18')](saveUpdates(_0x1a1459[_0x3e43('0x52')],null))[_0x3e43('0x18')](respondWithResult(_0x9da115,null))[_0x3e43('0x23')](handleError(_0x9da115,null));};exports[_0x3e43('0x2e')]=function(_0x1c0ebe,_0x1bd5a0){return db[_0x3e43('0x4b')][_0x3e43('0x51')]({'where':{'id':_0x1c0ebe[_0x3e43('0x4e')]['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0x1bd5a0,null))[_0x3e43('0x18')](removeEntity(_0x1bd5a0,null))[_0x3e43('0x23')](handleError(_0x1bd5a0,null));};exports['describe']=function(_0x485f1b,_0x3b00c6){return db[_0x3e43('0x4b')][_0x3e43('0x59')]()['then'](respondWithResult(_0x3b00c6,null))[_0x3e43('0x23')](handleError(_0x3b00c6,null));};exports[_0x3e43('0x5a')]=function(_0x4c4397,_0x309733,_0x12ec4c){if(_0x4c4397[_0x3e43('0x52')]['id']){delete _0x4c4397['body']['id'];}return db[_0x3e43('0x4b')]['find']({'where':{'id':_0x4c4397[_0x3e43('0x4e')]['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0x309733,null))[_0x3e43('0x18')](function(_0x2ff682){if(_0x2ff682){_0x4c4397[_0x3e43('0x52')][_0x3e43('0x5b')]=_0x2ff682['id'];return db[_0x3e43('0x5c')][_0x3e43('0x57')](_0x4c4397[_0x3e43('0x52')]);}})[_0x3e43('0x18')](respondWithResult(_0x309733,null))[_0x3e43('0x23')](handleError(_0x309733,null));};exports[_0x3e43('0x5d')]=function(_0x70e84a,_0x203d32,_0x1609a0){var _0x4b2121={'raw':![],'where':{}};var _0x2a2678={};var _0x2b49a7={'count':0x0,'rows':[]};return db[_0x3e43('0x4b')][_0x3e43('0x5e')]({'where':{'id':_0x70e84a['params']['id']}})['then'](handleEntityNotFound(_0x203d32,null))[_0x3e43('0x18')](function(_0x47a6df){if(_0x47a6df){_0x2a2678[_0x3e43('0x3a')]=_[_0x3e43('0x3c')](db[_0x3e43('0x5c')][_0x3e43('0x37')]);_0x2a2678[_0x3e43('0x3b')]=_[_0x3e43('0x3c')](_0x70e84a['query']);_0x2a2678[_0x3e43('0x3d')]=_[_0x3e43('0x3e')](_0x2a2678[_0x3e43('0x3a')],_0x2a2678['query']);_0x4b2121[_0x3e43('0x3f')]=_['intersection'](_0x2a2678[_0x3e43('0x3a')],qs[_0x3e43('0x40')](_0x70e84a[_0x3e43('0x3b')][_0x3e43('0x40')]));_0x4b2121[_0x3e43('0x3f')]=_0x4b2121[_0x3e43('0x3f')][_0x3e43('0x41')]?_0x4b2121[_0x3e43('0x3f')]:_0x2a2678[_0x3e43('0x3a')];if(!_0x70e84a['query'][_0x3e43('0x42')](_0x3e43('0x43'))){_0x4b2121[_0x3e43('0x29')]=qs[_0x3e43('0x29')](_0x70e84a[_0x3e43('0x3b')][_0x3e43('0x29')]);_0x4b2121[_0x3e43('0x27')]=qs[_0x3e43('0x27')](_0x70e84a[_0x3e43('0x3b')][_0x3e43('0x27')]);}_0x4b2121[_0x3e43('0x5f')]=qs[_0x3e43('0x44')](_0x70e84a[_0x3e43('0x3b')][_0x3e43('0x44')]);_0x4b2121['where']=qs['filters'](_[_0x3e43('0x45')](_0x70e84a[_0x3e43('0x3b')],_0x2a2678[_0x3e43('0x3d')]));_0x4b2121[_0x3e43('0x47')][_0x3e43('0x5b')]=_0x47a6df['id'];if(_0x70e84a[_0x3e43('0x3b')][_0x3e43('0x46')]){_0x4b2121['where']=_[_0x3e43('0x48')](_0x4b2121[_0x3e43('0x47')],{'$or':_[_0x3e43('0x36')](_0x4b2121[_0x3e43('0x3f')],function(_0x54fed5){var _0x419ed5={};_0x419ed5[_0x54fed5]={'$like':'%'+_0x70e84a[_0x3e43('0x3b')][_0x3e43('0x46')]+'%'};return _0x419ed5;})});}_0x4b2121=_[_0x3e43('0x48')]({},_0x4b2121,_0x70e84a[_0x3e43('0x50')]);return db[_0x3e43('0x5c')][_0x3e43('0x2a')]({'where':_0x4b2121[_0x3e43('0x47')]})[_0x3e43('0x18')](function(_0x59cf82){_0x2b49a7[_0x3e43('0x2a')]=_0x59cf82;if(_0x70e84a[_0x3e43('0x3b')][_0x3e43('0x4a')]){_0x4b2121['include']=[{'all':!![]}];}return db[_0x3e43('0x5c')][_0x3e43('0x4c')](_0x4b2121);})[_0x3e43('0x18')](function(_0x958b71){_0x2b49a7[_0x3e43('0x4d')]=_0x958b71;return _0x2b49a7;});}})[_0x3e43('0x18')](respondWithFilteredResult(_0x203d32,_0x4b2121))[_0x3e43('0x23')](handleError(_0x203d32,null));};exports['removeDispositions']=function(_0x17b01c,_0x4c9a9e,_0x51f77c){return db[_0x3e43('0x4b')]['find']({'where':{'id':_0x17b01c[_0x3e43('0x4e')]['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0x4c9a9e,null))[_0x3e43('0x18')](function(_0x10d2ce){if(_0x10d2ce){return _0x10d2ce[_0x3e43('0x60')](_0x17b01c[_0x3e43('0x3b')][_0x3e43('0x61')]);}})[_0x3e43('0x18')](respondWithStatusCode(_0x4c9a9e,null))[_0x3e43('0x23')](handleError(_0x4c9a9e,null));};exports[_0x3e43('0x62')]=function(_0x3ef7ac,_0x1c8ee7,_0x23abc2){if(_0x3ef7ac[_0x3e43('0x52')]['id']){delete _0x3ef7ac[_0x3e43('0x52')]['id'];}return db['FaxAccount'][_0x3e43('0x51')]({'where':{'id':_0x3ef7ac[_0x3e43('0x4e')]['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0x1c8ee7,null))[_0x3e43('0x18')](function(_0x36f4bd){if(_0x36f4bd){_0x3ef7ac[_0x3e43('0x52')][_0x3e43('0x5b')]=_0x36f4bd['id'];return db[_0x3e43('0x63')][_0x3e43('0x57')](_0x3ef7ac[_0x3e43('0x52')]);}})[_0x3e43('0x18')](respondWithResult(_0x1c8ee7,null))[_0x3e43('0x23')](handleError(_0x1c8ee7,null));};exports[_0x3e43('0x64')]=function(_0xded485,_0x30d704,_0x300c30){var _0x2661a9={'raw':![],'where':{}};var _0x40e9db={};var _0x5e5793={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xded485['params']['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0x30d704,null))[_0x3e43('0x18')](function(_0x117a71){if(_0x117a71){_0x40e9db[_0x3e43('0x3a')]=_[_0x3e43('0x3c')](db['CannedAnswer'][_0x3e43('0x37')]);_0x40e9db[_0x3e43('0x3b')]=_[_0x3e43('0x3c')](_0xded485[_0x3e43('0x3b')]);_0x40e9db[_0x3e43('0x3d')]=_['intersection'](_0x40e9db[_0x3e43('0x3a')],_0x40e9db[_0x3e43('0x3b')]);_0x2661a9[_0x3e43('0x3f')]=_[_0x3e43('0x3e')](_0x40e9db[_0x3e43('0x3a')],qs[_0x3e43('0x40')](_0xded485[_0x3e43('0x3b')][_0x3e43('0x40')]));_0x2661a9[_0x3e43('0x3f')]=_0x2661a9[_0x3e43('0x3f')][_0x3e43('0x41')]?_0x2661a9['attributes']:_0x40e9db[_0x3e43('0x3a')];if(!_0xded485['query'][_0x3e43('0x42')]('nolimit')){_0x2661a9[_0x3e43('0x29')]=qs[_0x3e43('0x29')](_0xded485[_0x3e43('0x3b')]['limit']);_0x2661a9[_0x3e43('0x27')]=qs[_0x3e43('0x27')](_0xded485['query'][_0x3e43('0x27')]);}_0x2661a9[_0x3e43('0x5f')]=qs[_0x3e43('0x44')](_0xded485['query'][_0x3e43('0x44')]);_0x2661a9[_0x3e43('0x47')]=qs[_0x3e43('0x3d')](_[_0x3e43('0x45')](_0xded485[_0x3e43('0x3b')],_0x40e9db[_0x3e43('0x3d')]));_0x2661a9[_0x3e43('0x47')]['FaxAccountId']=_0x117a71['id'];if(_0xded485[_0x3e43('0x3b')][_0x3e43('0x46')]){_0x2661a9[_0x3e43('0x47')]=_[_0x3e43('0x48')](_0x2661a9[_0x3e43('0x47')],{'$or':_[_0x3e43('0x36')](_0x2661a9[_0x3e43('0x3f')],function(_0x4afd09){var _0x5adfd8={};_0x5adfd8[_0x4afd09]={'$like':'%'+_0xded485[_0x3e43('0x3b')][_0x3e43('0x46')]+'%'};return _0x5adfd8;})});}_0x2661a9=_[_0x3e43('0x48')]({},_0x2661a9,_0xded485[_0x3e43('0x50')]);return db[_0x3e43('0x63')][_0x3e43('0x2a')]({'where':_0x2661a9[_0x3e43('0x47')]})[_0x3e43('0x18')](function(_0x2a743d){_0x5e5793[_0x3e43('0x2a')]=_0x2a743d;if(_0xded485['query'][_0x3e43('0x4a')]){_0x2661a9[_0x3e43('0x65')]=[{'all':!![]}];}return db[_0x3e43('0x63')][_0x3e43('0x4c')](_0x2661a9);})[_0x3e43('0x18')](function(_0x5d4e31){_0x5e5793[_0x3e43('0x4d')]=_0x5d4e31;return _0x5e5793;});}})['then'](respondWithFilteredResult(_0x30d704,_0x2661a9))[_0x3e43('0x23')](handleError(_0x30d704,null));};exports['removeAnswers']=function(_0x3e79c6,_0x56000e,_0xf2ac54){return db[_0x3e43('0x4b')][_0x3e43('0x51')]({'where':{'id':_0x3e79c6[_0x3e43('0x4e')]['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0x56000e,null))[_0x3e43('0x18')](function(_0x5446b9){if(_0x5446b9){return _0x5446b9['removeAnswers'](_0x3e79c6['query']['ids']);}})[_0x3e43('0x18')](respondWithStatusCode(_0x56000e,null))[_0x3e43('0x23')](handleError(_0x56000e,null));};exports[_0x3e43('0x66')]=function(_0x25e159,_0x3086a8,_0x46a555){return db[_0x3e43('0x67')][_0x3e43('0x51')]({'where':{'id':_0x25e159[_0x3e43('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3086a8,null))[_0x3e43('0x18')](function(_0x103f6a){if(_0x103f6a){return _0x103f6a['addInteraction'](_0x25e159[_0x3e43('0x52')][_0x3e43('0x61')],_[_0x3e43('0x68')](_0x25e159[_0x3e43('0x52')],[_0x3e43('0x61'),'id'])||{});}})['then'](respondWithResult(_0x3086a8,null))[_0x3e43('0x23')](handleError(_0x3086a8,null));};exports['getInteractions']=function(_0x3845bb,_0x5781ad,_0x5f18af){var _0xb6febc={'raw':![],'where':{}};var _0x594f5c={};var _0x3f38af={'count':0x0,'rows':[]};return db[_0x3e43('0x4b')][_0x3e43('0x5e')]({'where':{'id':_0x3845bb[_0x3e43('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5781ad,null))[_0x3e43('0x18')](function(_0x106c62){if(_0x106c62){_0x594f5c[_0x3e43('0x3a')]=_['keys'](db['FaxInteraction'][_0x3e43('0x37')]);_0x594f5c[_0x3e43('0x3b')]=_[_0x3e43('0x3c')](_0x3845bb[_0x3e43('0x3b')]);_0x594f5c[_0x3e43('0x3d')]=_[_0x3e43('0x3e')](_0x594f5c[_0x3e43('0x3a')],_0x594f5c[_0x3e43('0x3b')]);_0xb6febc['attributes']=_['intersection'](_0x594f5c[_0x3e43('0x3a')],qs['fields'](_0x3845bb[_0x3e43('0x3b')][_0x3e43('0x40')]));_0xb6febc[_0x3e43('0x3f')]=_0xb6febc[_0x3e43('0x3f')][_0x3e43('0x41')]?_0xb6febc[_0x3e43('0x3f')]:_0x594f5c[_0x3e43('0x3a')];if(!_0x3845bb[_0x3e43('0x3b')]['hasOwnProperty'](_0x3e43('0x43'))){_0xb6febc[_0x3e43('0x29')]=qs['limit'](_0x3845bb['query'][_0x3e43('0x29')]);_0xb6febc[_0x3e43('0x27')]=qs[_0x3e43('0x27')](_0x3845bb[_0x3e43('0x3b')][_0x3e43('0x27')]);}_0xb6febc['order']=qs[_0x3e43('0x44')](_0x3845bb['query'][_0x3e43('0x44')]);_0xb6febc[_0x3e43('0x47')]=qs[_0x3e43('0x3d')](_[_0x3e43('0x45')](_0x3845bb[_0x3e43('0x3b')],_0x594f5c[_0x3e43('0x3d')]));_0xb6febc[_0x3e43('0x47')][_0x3e43('0x5b')]=_0x106c62['id'];if(_0x3845bb[_0x3e43('0x3b')][_0x3e43('0x46')]){_0xb6febc['where']=_[_0x3e43('0x48')](_0xb6febc['where'],{'$or':_[_0x3e43('0x36')](_0xb6febc[_0x3e43('0x3f')],function(_0x4d151d){var _0x504d6e={};_0x504d6e[_0x4d151d]={'$like':'%'+_0x3845bb[_0x3e43('0x3b')]['filter']+'%'};return _0x504d6e;})});}_0xb6febc=_['merge']({},_0xb6febc,_0x3845bb[_0x3e43('0x50')]);return db[_0x3e43('0x67')][_0x3e43('0x2a')]({'where':_0xb6febc[_0x3e43('0x47')]})['then'](function(_0x3ca0d1){_0x3f38af['count']=_0x3ca0d1;if(_0x3845bb[_0x3e43('0x3b')][_0x3e43('0x4a')]){_0xb6febc[_0x3e43('0x65')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x3e43('0x69')],'as':_0x3e43('0x6a'),'attributes':[_0x3e43('0x32'),_0x3e43('0x6b'),'internal'],'required':![]},{'model':db[_0x3e43('0x6c')],'as':_0x3e43('0x6d'),'attributes':['id',_0x3e43('0x32'),'color'],'where':_0x3845bb['query'][_0x3e43('0x6e')]?{'id':_0x3845bb[_0x3e43('0x3b')][_0x3e43('0x6e')]}:undefined,'required':_0x3845bb[_0x3e43('0x3b')][_0x3e43('0x6e')]?!![]:![]}];}return db[_0x3e43('0x67')]['findAll'](_0xb6febc);})[_0x3e43('0x18')](function(_0x53a9d2){_0x3f38af[_0x3e43('0x4d')]=_0x53a9d2;return _0x3f38af;});}})[_0x3e43('0x18')](respondWithFilteredResult(_0x5781ad,_0xb6febc))[_0x3e43('0x23')](handleError(_0x5781ad,null));};exports[_0x3e43('0x6f')]=function(_0x376009,_0xb1fd2a,_0x442e86){return db[_0x3e43('0x4b')]['findOne']({'where':{'id':_0x376009[_0x3e43('0x4e')]['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0xb1fd2a,null))['then'](function(_0x1543c2){if(_0x1543c2){return db[_0x3e43('0x70')]['transaction'](function(_0x3b84df){return db[_0x3e43('0x71')][_0x3e43('0x2e')]({'where':{'FaxAccountId':_0x376009[_0x3e43('0x4e')]['id']},'transaction':_0x3b84df})[_0x3e43('0x18')](function(_0xfca52b){var _0x9a9816=_[_0x3e43('0x36')](_0x376009[_0x3e43('0x52')],function(_0x2a70fd){_0x2a70fd[_0x3e43('0x5b')]=_0x376009['params']['id'];return _0x2a70fd;});return db[_0x3e43('0x71')][_0x3e43('0x72')](_0x9a9816,{'transaction':_0x3b84df});});})[_0x3e43('0x18')](function(){return db[_0x3e43('0x71')]['findAndCountAll']({'where':{'FaxAccountId':_0x376009[_0x3e43('0x4e')]['id']},'order':'priority'});});}})[_0x3e43('0x18')](respondWithResult(_0xb1fd2a,null))[_0x3e43('0x23')](handleError(_0xb1fd2a,null));};exports[_0x3e43('0x73')]=function(_0x41f32f,_0x101f66,_0x69b50e){var _0x2b478f={};var _0x1d7daa={};var _0x33d606;var _0x3055bd;return db['FaxAccount'][_0x3e43('0x5e')]({'where':{'id':_0x41f32f[_0x3e43('0x4e')]['id']}})['then'](handleEntityNotFound(_0x101f66,null))['then'](function(_0x59cf6a){if(_0x59cf6a){_0x33d606=_0x59cf6a;_0x1d7daa['model']=_[_0x3e43('0x3c')](db[_0x3e43('0x71')][_0x3e43('0x37')]);_0x1d7daa['query']=_[_0x3e43('0x3c')](_0x41f32f[_0x3e43('0x3b')]);_0x1d7daa[_0x3e43('0x3d')]=_[_0x3e43('0x3e')](_0x1d7daa[_0x3e43('0x3a')],_0x1d7daa[_0x3e43('0x3b')]);_0x2b478f[_0x3e43('0x3f')]=_[_0x3e43('0x3e')](_0x1d7daa[_0x3e43('0x3a')],qs[_0x3e43('0x40')](_0x41f32f[_0x3e43('0x3b')][_0x3e43('0x40')]));_0x2b478f['attributes']=_0x2b478f[_0x3e43('0x3f')][_0x3e43('0x41')]?_0x2b478f[_0x3e43('0x3f')]:_0x1d7daa[_0x3e43('0x3a')];_0x2b478f[_0x3e43('0x5f')]=qs['sort'](_0x41f32f[_0x3e43('0x3b')][_0x3e43('0x44')]);_0x2b478f[_0x3e43('0x47')]=qs[_0x3e43('0x3d')](_[_0x3e43('0x45')](_0x41f32f[_0x3e43('0x3b')],_0x1d7daa[_0x3e43('0x3d')]));if(_0x41f32f[_0x3e43('0x3b')][_0x3e43('0x46')]){_0x2b478f[_0x3e43('0x47')]=_[_0x3e43('0x48')](_0x2b478f[_0x3e43('0x47')],{'$or':_[_0x3e43('0x36')](_0x2b478f[_0x3e43('0x3f')],function(_0x9f60a7){var _0x20b0b4={};_0x20b0b4[_0x9f60a7]={'$like':'%'+_0x41f32f[_0x3e43('0x3b')][_0x3e43('0x46')]+'%'};return _0x20b0b4;})});}_0x2b478f=_[_0x3e43('0x48')]({},_0x2b478f,_0x41f32f[_0x3e43('0x50')]);return _0x33d606[_0x3e43('0x73')](_0x2b478f);}})['then'](function(_0x56f666){if(_0x56f666){_0x3055bd=_0x56f666[_0x3e43('0x41')];if(!_0x41f32f['query'][_0x3e43('0x42')](_0x3e43('0x43'))){_0x2b478f[_0x3e43('0x29')]=qs[_0x3e43('0x29')](_0x41f32f[_0x3e43('0x3b')]['limit']);_0x2b478f[_0x3e43('0x27')]=qs[_0x3e43('0x27')](_0x41f32f[_0x3e43('0x3b')][_0x3e43('0x27')]);}return _0x33d606[_0x3e43('0x73')](_0x2b478f);}})[_0x3e43('0x18')](function(_0x1d4123){if(_0x1d4123){return _0x1d4123?{'count':_0x3055bd,'rows':_0x1d4123}:null;}})[_0x3e43('0x18')](respondWithResult(_0x101f66,null))['catch'](handleError(_0x101f66,null));};function Extension(_0x1a7e86,_0x2918b0,_0x5110e3,_0x25ae2e){this[_0x3e43('0x74')]=_0x3e43('0x75');this['exten']=_0x1a7e86[_0x3e43('0x76')];this[_0x3e43('0x77')]=_0x25ae2e;this[_0x3e43('0x49')]=_0x3e43('0x78');this['description']='Fax\x20Extension';this[_0x3e43('0x5b')]=_0x1a7e86['id'];this['priority']=_0x2918b0;this[_0x3e43('0x79')]=_0x5110e3;}function createExtensionsReciveFax(_0x1c4128){var _0x1767f8=0x1;var _0x6e4ace=[];_0x6e4ace[_0x3e43('0x7a')](new Extension(_0x1c4128,_0x1767f8,'','Answer'));_0x1767f8+=0x1;_0x6e4ace['push'](new Extension(_0x1c4128,_0x1767f8,_0x3e43('0x7b'),_0x3e43('0x7c')));_0x1767f8+=0x1;for(var _0x295f9c in _0x1c4128){if(_0x1c4128['hasOwnProperty'](_0x295f9c)&&(_0x295f9c==='ecm'||_0x295f9c===_0x3e43('0x76')||_0x295f9c===_0x3e43('0x7d')||_0x295f9c===_0x3e43('0x7e')||_0x295f9c===_0x3e43('0x7f')||_0x295f9c===_0x3e43('0x80')||_0x295f9c===_0x3e43('0x81')||_0x295f9c===_0x3e43('0x82')||_0x295f9c===_0x3e43('0x83'))){_0x6e4ace['push'](new Extension(_0x1c4128,_0x1767f8,_0x3e43('0x84')+_0x295f9c+')='+_0x1c4128[_0x295f9c],_0x3e43('0x7c')));_0x1767f8+=0x1;}}_0x6e4ace['push'](new Extension(_0x1c4128,_0x1767f8,'6',_0x3e43('0x85')));_0x1767f8+=0x1;_0x6e4ace['push'](new Extension(_0x1c4128,_0x1767f8,_0x3e43('0x86'),_0x3e43('0x87')));_0x1767f8=0x0;return _0x6e4ace;}exports[_0x3e43('0x88')]=function(_0x1b8713,_0x16922d,_0x213eea){var _0x15ba60;return db[_0x3e43('0x70')]['transaction'](function(_0x53158f){return db[_0x3e43('0x4b')][_0x3e43('0x57')](_0x1b8713[_0x3e43('0x52')],{'transaction':_0x53158f})[_0x3e43('0x18')](function(_0x53b019){_0x15ba60=_0x53b019[_0x3e43('0x54')]({'plain':!![]});return db[_0x3e43('0x89')]['bulkCreate'](createExtensionsReciveFax(_0x15ba60),{'transaction':_0x53158f});});})[_0x3e43('0x18')](function(){return _0x15ba60;})['then'](respondWithResult(_0x16922d,null))[_0x3e43('0x23')](handleError(_0x16922d,null));};exports[_0x3e43('0x8a')]=function(_0x48c87f,_0x23ca9d,_0x5247b3){var _0x1edcd5;return db[_0x3e43('0x70')][_0x3e43('0x8b')](function(_0xcc9d90){return db[_0x3e43('0x4b')][_0x3e43('0x58')](_0x48c87f[_0x3e43('0x52')],{'where':{'id':_0x48c87f['body']['id']},'transaction':_0xcc9d90})[_0x3e43('0x18')](function(_0x96443b){return db[_0x3e43('0x89')]['destroy']({'where':{'FaxAccountId':_0x48c87f[_0x3e43('0x52')]['id']},'transaction':_0xcc9d90})[_0x3e43('0x18')](function(_0x38e496){return db[_0x3e43('0x89')][_0x3e43('0x72')](createExtensionsReciveFax(_['omit'](_0x48c87f[_0x3e43('0x52')],['tech',_0x3e43('0x39'),_0x3e43('0x8c'),_0x3e43('0x8d'),'TrunkId','ListId'])),{'transaction':_0xcc9d90});});});})[_0x3e43('0x18')](function(){return db['FaxAccount'][_0x3e43('0x8e')](_0x48c87f[_0x3e43('0x52')]['id']);})[_0x3e43('0x18')](respondWithResult(_0x23ca9d,null))[_0x3e43('0x23')](handleError(_0x23ca9d,null));};exports[_0x3e43('0x8f')]=function(_0x50ad18,_0x3a7461,_0x1591ec){var _0x5ad804={'raw':!![],'where':{}};var _0x5a058e={};var _0x2684d8={'count':0x0,'rows':[]};return db[_0x3e43('0x4b')][_0x3e43('0x5e')]({'where':{'id':_0x50ad18['params']['id']}})['then'](handleEntityNotFound(_0x3a7461,null))['then'](function(_0x376e8e){if(_0x376e8e){_0x5a058e[_0x3e43('0x3a')]=_[_0x3e43('0x3c')](db[_0x3e43('0x90')][_0x3e43('0x37')]);_0x5a058e[_0x3e43('0x3b')]=_['keys'](_0x50ad18['query']);_0x5a058e[_0x3e43('0x3d')]=_['intersection'](_0x5a058e[_0x3e43('0x3a')],_0x5a058e[_0x3e43('0x3b')]);_0x5ad804[_0x3e43('0x3f')]=_['intersection'](_0x5a058e[_0x3e43('0x3a')],qs[_0x3e43('0x40')](_0x50ad18[_0x3e43('0x3b')][_0x3e43('0x40')]));_0x5ad804[_0x3e43('0x3f')]=_0x5ad804[_0x3e43('0x3f')][_0x3e43('0x41')]?_0x5ad804[_0x3e43('0x3f')]:_0x5a058e[_0x3e43('0x3a')];if(!_0x50ad18[_0x3e43('0x3b')][_0x3e43('0x42')](_0x3e43('0x43'))){_0x5ad804[_0x3e43('0x29')]=qs[_0x3e43('0x29')](_0x50ad18['query'][_0x3e43('0x29')]);_0x5ad804['offset']=qs[_0x3e43('0x27')](_0x50ad18[_0x3e43('0x3b')][_0x3e43('0x27')]);}_0x5ad804[_0x3e43('0x5f')]=qs[_0x3e43('0x44')](_0x50ad18[_0x3e43('0x3b')][_0x3e43('0x44')]);_0x5ad804[_0x3e43('0x47')]=qs['filters'](_[_0x3e43('0x45')](_0x50ad18[_0x3e43('0x3b')],_0x5a058e[_0x3e43('0x3d')]));_0x5ad804['where'][_0x3e43('0x5b')]=_0x376e8e['id'];if(_0x50ad18[_0x3e43('0x3b')][_0x3e43('0x46')]){_0x5ad804['where']=_[_0x3e43('0x48')](_0x5ad804[_0x3e43('0x47')],{'$or':_[_0x3e43('0x36')](_0x5ad804['attributes'],function(_0x27675b){var _0x4963a6={};_0x4963a6[_0x27675b]={'$like':'%'+_0x50ad18[_0x3e43('0x3b')][_0x3e43('0x46')]+'%'};return _0x4963a6;})});}if(_0x50ad18['query'][_0x3e43('0x91')]){var _0x5029a7=_0x50ad18['query'][_0x3e43('0x91')]['split'](',');var _0x5dc951={};_0x5dc951[_0x5029a7[0x0]]={'$gte':moment(_0x5029a7[0x1])[_0x3e43('0x92')](_0x3e43('0x93'))};_0x5ad804[_0x3e43('0x47')]=_[_0x3e43('0x48')](_0x5ad804[_0x3e43('0x47')],_0x5dc951);}_0x5ad804=_[_0x3e43('0x48')]({},_0x5ad804,_0x50ad18[_0x3e43('0x50')]);return db['FaxMessage'][_0x3e43('0x2a')]({'where':_0x5ad804[_0x3e43('0x47')]})[_0x3e43('0x18')](function(_0x350083){_0x2684d8[_0x3e43('0x2a')]=_0x350083;if(_0x50ad18['query']['includeAll']){_0x5ad804[_0x3e43('0x65')]=[{'all':!![]}];}return db[_0x3e43('0x90')][_0x3e43('0x4c')](_0x5ad804);})['then'](function(_0x52200b){_0x2684d8[_0x3e43('0x4d')]=_0x52200b;return _0x2684d8;});}})[_0x3e43('0x18')](respondWithFilteredResult(_0x3a7461,_0x5ad804))[_0x3e43('0x23')](handleError(_0x3a7461,null));};exports[_0x3e43('0x33')]=function(_0x36ddba,_0x2e516a,_0x2db3b0){var _0x966942,_0x395600={},_0x104bfe;if(_0x36ddba[_0x3e43('0x52')]['to']){_0x104bfe=_0x36ddba['body']['to'][0x0];}return db[_0x3e43('0x4b')][_0x3e43('0x51')]({'where':{'id':_0x36ddba[_0x3e43('0x4e')]['id']},'include':[{'model':db['CmList'],'as':_0x3e43('0x94'),'include':[{'model':db['CmContact'],'as':_0x3e43('0x95'),'where':{'fax':_0x104bfe},'limit':0x1,'order':[['updatedAt',_0x3e43('0x96')]]}]}]})[_0x3e43('0x18')](handleEntityNotFound(_0x2e516a,null))[_0x3e43('0x18')](function(_0xfc0a9f){_0x966942=_0xfc0a9f;if(_0x36ddba[_0x3e43('0x52')]['attachments']&&_0x36ddba['body'][_0x3e43('0x97')]['length']){for(var _0x2544f3=0x0;_0x2544f3<_0x36ddba['body'][_0x3e43('0x97')]['length'];_0x2544f3+=0x1){_0x36ddba['body'][_0x3e43('0x97')][_0x2544f3]={'filename':_0x36ddba[_0x3e43('0x52')][_0x3e43('0x97')][_0x2544f3][_0x3e43('0x32')],'id':_0x36ddba[_0x3e43('0x52')]['attachments'][_0x2544f3]['id'],'path':path['join'](config[_0x3e43('0x98')],_0x3e43('0x99'),_0x36ddba[_0x3e43('0x52')]['attachments'][_0x2544f3][_0x3e43('0x9a')])};}}return respondWithRpcPromise(_0x3e43('0x9b'),_0x3e43('0x9b'),{'FaxAccountId':_[_0x3e43('0x9c')](_0x36ddba['params']['id'])?undefined:_0x36ddba[_0x3e43('0x4e')]['id'],'path':_['isNil'](_0x36ddba[_0x3e43('0x52')][_0x3e43('0x97')][0x0]['path'])?undefined:_0x36ddba[_0x3e43('0x52')][_0x3e43('0x97')][0x0]['path'],'fax':_[_0x3e43('0x9c')](_0x36ddba[_0x3e43('0x52')]['to'][0x0])?undefined:_0x36ddba[_0x3e43('0x52')]['to'][0x0]},client9002);})[_0x3e43('0x18')](function(){if(_0x966942){if(_['isNil'](_0x36ddba[_0x3e43('0x52')][_0x3e43('0x9d')])){_0x36ddba['body']['from']=util[_0x3e43('0x92')]('\x22%s\x22\x20<%s>',_0x966942[_0x3e43('0x32')],_0x966942[_0x3e43('0x9e')]);}if(_0x966942[_0x3e43('0x94')]){if(_0x966942[_0x3e43('0x94')][_0x3e43('0x95')]['length']){return _0x966942[_0x3e43('0x94')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x3e43('0x9f')](_0x36ddba[_0x3e43('0x52')],{'firstName':_0x36ddba[_0x3e43('0x52')]['to'][0x0],'phone':_0x36ddba[_0x3e43('0x52')]['to'][0x0],'fax':_0x36ddba['body']['to'][0x0],'ListId':_0x966942[_0x3e43('0xa0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x3e43('0xa1'));}})[_0x3e43('0x18')](function(_0x151bdc){if(_0x151bdc){return db[_0x3e43('0x67')]['find']({'where':{'ContactId':_0x151bdc['id'],'closed':![],'FaxAccountId':_0x966942['id']}})[_0x3e43('0x18')](function(_0x54cc11){if(_0x54cc11){return[_0x54cc11,![]];}return db[_0x3e43('0x67')][_0x3e43('0x57')]({'UserId':_0x36ddba[_0x3e43('0x53')]['id'],'ContactId':_0x151bdc['id'],'FaxAccountId':_0x966942['id'],'fax':_0x36ddba[_0x3e43('0x52')]['to'][0x0],'firstMsgDirection':_0x3e43('0xa2'),'Messages':[_[_0x3e43('0x48')](_0x36ddba[_0x3e43('0x52')],{'read':![],'body':_0x36ddba['body'][_0x3e43('0x97')][0x0][_0x3e43('0xa3')],'FaxAccountId':_0x966942['id'],'UserId':_0x36ddba[_0x3e43('0x53')]['id'],'ContactId':_0x151bdc['id'],'AttachmentId':_0x36ddba['body'][_0x3e43('0x97')][0x0]['id']})]},{'include':[{'model':db[_0x3e43('0x90')],'as':_0x3e43('0xa4')}]})[_0x3e43('0x18')](function(_0x449ddd){return[_0x449ddd,!![]];});});}else{throw new Error(_0x3e43('0xa5'));}})[_0x3e43('0xa6')](function(_0x105e77,_0x4c7fec){if(_0x4c7fec){return _0x105e77;}return db[_0x3e43('0x90')][_0x3e43('0x57')]({'direction':_0x3e43('0xa2'),'read':![],'body':_0x36ddba[_0x3e43('0x52')][_0x3e43('0x97')][0x0][_0x3e43('0xa3')],'FaxAccountId':_0x966942['id'],'FaxInteractionId':_0x105e77['id'],'UserId':_0x36ddba[_0x3e43('0x53')]['id'],'ContactId':_0x105e77[_0x3e43('0xa7')],'AttachmentId':_0x36ddba['body'][_0x3e43('0x97')][0x0]['id']})[_0x3e43('0x18')](function(_0x5485eb){_0x105e77['dataValues']['Messages']=[];_0x105e77[_0x3e43('0xa8')][_0x3e43('0xa4')]['push'](_0x5485eb[_0x3e43('0xa8')]);return _0x105e77;});})[_0x3e43('0x18')](function(_0x2b7916){respondWithRpcPromise('SendFax',_0x3e43('0xa9'),{'FaxAccountId':_[_0x3e43('0x9c')](_0x36ddba[_0x3e43('0x4e')]['id'])?undefined:_0x36ddba[_0x3e43('0x4e')]['id'],'path':_[_0x3e43('0x9c')](_0x36ddba[_0x3e43('0x52')][_0x3e43('0x97')][0x0][_0x3e43('0x5')])?undefined:_0x36ddba[_0x3e43('0x52')]['attachments'][0x0][_0x3e43('0x5')],'fax':_[_0x3e43('0x9c')](_0x36ddba['body']['to'][0x0])?undefined:_0x36ddba[_0x3e43('0x52')]['to'][0x0],'AttachmentId':_0x36ddba[_0x3e43('0x52')][_0x3e43('0x97')][0x0]['id']},client9002)['then'](function(_0x2bb451){logger[_0x3e43('0x19')](_0x3e43('0xaa'),_0x2bb451);})[_0x3e43('0x23')](function(_0x2c3bfe){logger['info'](_0x3e43('0xaa'),_0x2c3bfe);});return _0x2b7916;})['then'](respondWithResult(_0x2e516a,null))[_0x3e43('0x23')](handleError(_0x2e516a,null));};exports[_0x3e43('0xab')]=function(_0x278240,_0x379c3a,_0x3cb150){return db[_0x3e43('0x4b')][_0x3e43('0x51')]({'where':{'id':_0x278240[_0x3e43('0x4e')]['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0x379c3a,null))[_0x3e43('0x18')](function(_0x2420e5){if(_0x2420e5){return _0x2420e5['addAgents'](_0x278240[_0x3e43('0x52')]['ids'],_[_0x3e43('0x68')](_0x278240[_0x3e43('0x52')],[_0x3e43('0x61'),'id'])||{})['spread'](function(_0x3948c3){for(var _0x722a3=0x0;_0x722a3<_0x278240['body'][_0x3e43('0x61')][_0x3e43('0x41')];_0x722a3+=0x1){socket[_0x3e43('0xac')](_0x3e43('0xad'),{'UserId':Number(_0x278240['body'][_0x3e43('0x61')][_0x722a3]),'FaxAccountId':Number(_0x278240[_0x3e43('0x4e')]['id'])});}return _0x3948c3;});}})[_0x3e43('0x18')](respondWithResult(_0x379c3a,null))[_0x3e43('0x23')](handleError(_0x379c3a,null));};exports['removeAgents']=function(_0x3b79d9,_0x59f21b,_0x5da59a){return db[_0x3e43('0x4b')][_0x3e43('0x51')]({'where':{'id':_0x3b79d9[_0x3e43('0x4e')]['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0x59f21b,null))[_0x3e43('0x18')](function(_0x591fce){if(_0x591fce){return _0x591fce[_0x3e43('0xae')](_0x3b79d9[_0x3e43('0x3b')][_0x3e43('0x61')])['then'](function(){if(_[_0x3e43('0xaf')](_0x3b79d9[_0x3e43('0x3b')][_0x3e43('0x61')])){for(var _0x2421e6=0x0;_0x2421e6<_0x3b79d9[_0x3e43('0x3b')]['ids'][_0x3e43('0x41')];_0x2421e6+=0x1){socket[_0x3e43('0xac')](_0x3e43('0xb0'),{'UserId':Number(_0x3b79d9['query'][_0x3e43('0x61')][_0x2421e6]),'FaxAccountId':Number(_0x3b79d9['params']['id'])});}}else{socket[_0x3e43('0xac')](_0x3e43('0xb0'),{'UserId':Number(_0x3b79d9['query']['ids']),'FaxAccountId':Number(_0x3b79d9[_0x3e43('0x4e')]['id'])});}});}})[_0x3e43('0x18')](respondWithStatusCode(_0x59f21b,null))[_0x3e43('0x23')](handleError(_0x59f21b,null));};exports['getAgents']=function(_0x2bf950,_0x25354a,_0x17d547){var _0x36cbd3={};var _0x2b7e67={};var _0x1e62ad;var _0x1b082a;return db[_0x3e43('0x4b')][_0x3e43('0x5e')]({'where':{'id':_0x2bf950['params']['id']}})[_0x3e43('0x18')](handleEntityNotFound(_0x25354a,null))['then'](function(_0x68ffca){if(_0x68ffca){_0x1e62ad=_0x68ffca;_0x2b7e67[_0x3e43('0x3a')]=_[_0x3e43('0x3c')](db[_0x3e43('0x69')][_0x3e43('0x37')]);_0x2b7e67[_0x3e43('0x3b')]=_[_0x3e43('0x3c')](_0x2bf950['query']);_0x2b7e67[_0x3e43('0x3d')]=_[_0x3e43('0x3e')](_0x2b7e67['model'],_0x2b7e67[_0x3e43('0x3b')]);_0x36cbd3['attributes']=_['intersection'](_0x2b7e67['model'],qs[_0x3e43('0x40')](_0x2bf950['query'][_0x3e43('0x40')]));_0x36cbd3[_0x3e43('0x3f')]=_0x36cbd3[_0x3e43('0x3f')][_0x3e43('0x41')]?_0x36cbd3['attributes']:_0x2b7e67[_0x3e43('0x3a')];_0x36cbd3['order']=qs[_0x3e43('0x44')](_0x2bf950[_0x3e43('0x3b')]['sort']);_0x36cbd3[_0x3e43('0x47')]=qs['filters'](_['pick'](_0x2bf950[_0x3e43('0x3b')],_0x2b7e67[_0x3e43('0x3d')]));if(_0x2bf950[_0x3e43('0x3b')]['filter']){_0x36cbd3['where']=_[_0x3e43('0x48')](_0x36cbd3['where'],{'$or':_[_0x3e43('0x36')](_0x36cbd3[_0x3e43('0x3f')],function(_0x322c32){var _0x4a9cf3={};_0x4a9cf3[_0x322c32]={'$like':'%'+_0x2bf950[_0x3e43('0x3b')][_0x3e43('0x46')]+'%'};return _0x4a9cf3;})});}_0x36cbd3=_['merge']({},_0x36cbd3,_0x2bf950['options']);return _0x1e62ad[_0x3e43('0xb1')](_0x36cbd3);}})[_0x3e43('0x18')](function(_0x11ec84){if(_0x11ec84){_0x1b082a=_0x11ec84[_0x3e43('0x41')];if(!_0x2bf950[_0x3e43('0x3b')][_0x3e43('0x42')](_0x3e43('0x43'))){_0x36cbd3[_0x3e43('0x29')]=qs['limit'](_0x2bf950[_0x3e43('0x3b')]['limit']);_0x36cbd3['offset']=qs[_0x3e43('0x27')](_0x2bf950[_0x3e43('0x3b')][_0x3e43('0x27')]);}return _0x1e62ad[_0x3e43('0xb1')](_0x36cbd3);}})[_0x3e43('0x18')](function(_0x36cf7e){if(_0x36cf7e){return _0x36cf7e?{'count':_0x1b082a,'rows':_0x36cf7e}:null;}})[_0x3e43('0x18')](respondWithResult(_0x25354a,null))[_0x3e43('0x23')](handleError(_0x25354a,null));}; \ No newline at end of file +var _0xe49e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','client','http','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','FaxAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','map','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','mandatoryDispositionPause','rawAttributes','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','body','params','describe','addDisposition','Disposition','getDispositions','nolimit','pick','removeDispositions','ids','addAnswer','FaxAccountId','CannedAnswer','getAnswers','order','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','tag','addApplications','findOne','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','priority','appdata','push','CDR(type)=inbound-fax','ecm','gateway','headerinfo','minrate','modem','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','VoiceExtension','tech','createdAt','updatedAt','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','attachments','server/files/attachments','isNil','from','fax','List','ListId','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','getAgents','rimraf','request-promise','moment'];(function(_0x6ca895,_0x312d00){var _0xf71c47=function(_0x39e20a){while(--_0x39e20a){_0x6ca895['push'](_0x6ca895['shift']());}};_0xf71c47(++_0x312d00);}(_0xe49e,0xb7));var _0xee49=function(_0x4c8d54,_0xded934){_0x4c8d54=_0x4c8d54-0x0;var _0x232b52=_0xe49e[_0x4c8d54];return _0x232b52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee49('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xee49('0x1'));var moment=require(_0xee49('0x2'));var BPromise=require(_0xee49('0x3'));var Mustache=require(_0xee49('0x4'));var util=require(_0xee49('0x5'));var path=require(_0xee49('0x6'));var sox=require(_0xee49('0x7'));var csv=require(_0xee49('0x8'));var ejs=require(_0xee49('0x9'));var fs=require('fs');var fs_extra=require(_0xee49('0xa'));var _=require(_0xee49('0xb'));var squel=require(_0xee49('0xc'));var crypto=require(_0xee49('0xd'));var jsforce=require(_0xee49('0xe'));var deskjs=require(_0xee49('0xf'));var toCsv=require('to-csv');var querystring=require(_0xee49('0x10'));var Papa=require('papaparse');var Redis=require(_0xee49('0x11'));var authService=require(_0xee49('0x12'));var qs=require(_0xee49('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xee49('0x14'))(_0xee49('0x15'));var utils=require(_0xee49('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee49('0x17'))['db'];config[_0xee49('0x18')]=_[_0xee49('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xee49('0x1a'))(new Redis(config[_0xee49('0x18')]));require(_0xee49('0x1b'))[_0xee49('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xee49('0x1d')][_0xee49('0x1e')]({'port':0x232c});var client9002=jayson[_0xee49('0x1d')][_0xee49('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5b07ba,_0x34465a,_0x44140d,_0x184dbd){return new BPromise(function(_0x15e5b3,_0x463757){var _0x4c4861=_0x184dbd||client;return _0x4c4861['request'](_0x5b07ba,_0x44140d)[_0xee49('0x1f')](function(_0x560646){logger[_0xee49('0x20')]('FaxAccount,\x20%s,\x20%s',_0x34465a,_0xee49('0x21'));logger['debug'](_0xee49('0x22'),_0x34465a,_0xee49('0x21'),JSON['stringify'](_0x560646));if(_0x560646['error']){if(_0x560646[_0xee49('0x23')][_0xee49('0x24')]===0x1f4){logger[_0xee49('0x23')](_0xee49('0x25'),_0x34465a,_0x560646[_0xee49('0x23')][_0xee49('0x26')]);return _0x463757(_0x560646['error']['message']);}logger['error'](_0xee49('0x25'),_0x34465a,_0x560646[_0xee49('0x23')][_0xee49('0x26')]);return _0x15e5b3(_0x560646[_0xee49('0x23')]['message']);}else{logger[_0xee49('0x20')]('FaxAccount,\x20%s,\x20%s',_0x34465a,'request\x20sent');_0x15e5b3(_0x560646['result'][_0xee49('0x26')]);}})['catch'](function(_0x1713f5){logger[_0xee49('0x23')](_0xee49('0x25'),_0x34465a,_0x1713f5);_0x463757(_0x1713f5);});});}function respondWithStatusCode(_0x1ea2a1,_0x3dbe7b){_0x3dbe7b=_0x3dbe7b||0xcc;return function(_0x35e7ae){if(_0x35e7ae){return _0x1ea2a1[_0xee49('0x27')](_0x3dbe7b);}return _0x1ea2a1[_0xee49('0x28')](_0x3dbe7b)[_0xee49('0x29')]();};}function respondWithResult(_0x1eeddb,_0x452702){_0x452702=_0x452702||0xc8;return function(_0x14a126){if(_0x14a126){return _0x1eeddb[_0xee49('0x28')](_0x452702)[_0xee49('0x2a')](_0x14a126);}};}function respondWithFilteredResult(_0x5df8da,_0x5ca50d){return function(_0x5d9dd1){if(_0x5d9dd1){var _0x41a71e=typeof _0x5ca50d[_0xee49('0x2b')]===_0xee49('0x2c')&&typeof _0x5ca50d[_0xee49('0x2d')]==='undefined';var _0x178016=_0x5d9dd1['count'];var _0x496952=_0x41a71e?0x0:_0x5ca50d[_0xee49('0x2b')];var _0x23eb50=_0x41a71e?_0x5d9dd1['count']:_0x5ca50d[_0xee49('0x2b')]+_0x5ca50d[_0xee49('0x2d')];var _0x319631;if(_0x23eb50>=_0x178016){_0x23eb50=_0x178016;_0x319631=0xc8;}else{_0x319631=0xce;}_0x5df8da['status'](_0x319631);return _0x5df8da[_0xee49('0x2e')](_0xee49('0x2f'),_0x496952+'-'+_0x23eb50+'/'+_0x178016)[_0xee49('0x2a')](_0x5d9dd1);}return null;};}function patchUpdates(_0x22f4cd){return function(_0x7bff5b){try{jsonpatch[_0xee49('0x30')](_0x7bff5b,_0x22f4cd,!![]);}catch(_0x2925d9){return BPromise['reject'](_0x2925d9);}return _0x7bff5b[_0xee49('0x31')]();};}function saveUpdates(_0x878e66,_0x3ff69d){return function(_0x4c1174){if(_0x4c1174){return _0x4c1174[_0xee49('0x32')](_0x878e66)[_0xee49('0x1f')](function(_0x2f2aa9){return _0x2f2aa9;});}return null;};}function removeEntity(_0x4c938f,_0x24fe47){return function(_0x1980bc){if(_0x1980bc){return _0x1980bc[_0xee49('0x33')]()[_0xee49('0x1f')](function(){var _0xb7caed=_0x1980bc['get']({'plain':!![]});var _0x2fd735=_0xee49('0x34');return db[_0xee49('0x35')][_0xee49('0x33')]({'where':{'type':_0x2fd735,'resourceId':_0xb7caed['id']}})[_0xee49('0x1f')](function(){return _0x1980bc;});})[_0xee49('0x1f')](function(){_0x4c938f['status'](0xcc)[_0xee49('0x29')]();});}};}function handleEntityNotFound(_0x3551fd,_0xbaf160){return function(_0xc71136){if(!_0xc71136){_0x3551fd['sendStatus'](0x194);}return _0xc71136;};}function handleError(_0x22e3e5,_0x4b7e2f){_0x4b7e2f=_0x4b7e2f||0x1f4;return function(_0x92c13a){logger[_0xee49('0x23')](_0x92c13a[_0xee49('0x36')]);if(_0x92c13a[_0xee49('0x37')]){delete _0x92c13a[_0xee49('0x37')];}_0x22e3e5[_0xee49('0x28')](_0x4b7e2f)[_0xee49('0x38')](_0x92c13a);};}exports[_0xee49('0x39')]=function(_0x2e5b5d,_0x5ca7dc){var _0x3ec1a9={'include':[{'model':db[_0xee49('0x3a')],'as':'mandatoryDispositionPause'}]},_0x3076dc={},_0x3c1512={'count':0x0,'rows':[]};var _0x18bb7d=_['map'](db[_0xee49('0x3b')]['rawAttributes'],function(_0x3712f7){return{'name':_0x3712f7[_0xee49('0x3c')],'type':_0x3712f7[_0xee49('0x3d')][_0xee49('0x3e')]};});_0x3076dc[_0xee49('0x3f')]=_['map'](_0x18bb7d,'name');_0x3076dc[_0xee49('0x40')]=_[_0xee49('0x41')](_0x2e5b5d[_0xee49('0x40')]);_0x3076dc[_0xee49('0x42')]=_[_0xee49('0x43')](_0x3076dc['model'],_0x3076dc[_0xee49('0x40')]);_0x3ec1a9[_0xee49('0x44')]=_[_0xee49('0x43')](_0x3076dc[_0xee49('0x3f')],qs[_0xee49('0x45')](_0x2e5b5d['query'][_0xee49('0x45')]));_0x3ec1a9[_0xee49('0x44')]=_0x3ec1a9['attributes'][_0xee49('0x46')]?_0x3ec1a9['attributes']:_0x3076dc[_0xee49('0x3f')];if(!_0x2e5b5d[_0xee49('0x40')][_0xee49('0x47')]('nolimit')){_0x3ec1a9[_0xee49('0x2d')]=qs[_0xee49('0x2d')](_0x2e5b5d['query'][_0xee49('0x2d')]);_0x3ec1a9[_0xee49('0x2b')]=qs[_0xee49('0x2b')](_0x2e5b5d[_0xee49('0x40')][_0xee49('0x2b')]);}_0x3ec1a9['order']=qs[_0xee49('0x48')](_0x2e5b5d[_0xee49('0x40')][_0xee49('0x48')]);_0x3ec1a9['where']=qs[_0xee49('0x42')](_['pick'](_0x2e5b5d[_0xee49('0x40')],_0x3076dc[_0xee49('0x42')]),_0x18bb7d);if(_0x2e5b5d[_0xee49('0x40')][_0xee49('0x49')]){_0x3ec1a9[_0xee49('0x4a')]=_['merge'](_0x3ec1a9['where'],{'$or':_[_0xee49('0x4b')](_0x18bb7d,function(_0x24afac){if(_0x24afac[_0xee49('0x3d')]!==_0xee49('0x4c')){var _0x591f10={};_0x591f10[_0x24afac[_0xee49('0x37')]]={'$like':'%'+_0x2e5b5d[_0xee49('0x40')][_0xee49('0x49')]+'%'};return _0x591f10;}})});}_0x3ec1a9=_[_0xee49('0x4d')]({},_0x3ec1a9,_0x2e5b5d[_0xee49('0x4e')]);var _0x4be11a={'where':_0x3ec1a9[_0xee49('0x4a')]};return db[_0xee49('0x3b')]['count'](_0x4be11a)[_0xee49('0x1f')](function(_0x3232c0){_0x3c1512[_0xee49('0x4f')]=_0x3232c0;if(_0x2e5b5d[_0xee49('0x40')][_0xee49('0x50')]){_0x3ec1a9[_0xee49('0x51')]=[{'all':!![]}];}return db[_0xee49('0x3b')][_0xee49('0x52')](_0x3ec1a9);})[_0xee49('0x1f')](function(_0x14db3a){_0x3c1512[_0xee49('0x53')]=_0x14db3a;return _0x3c1512;})[_0xee49('0x1f')](respondWithFilteredResult(_0x5ca7dc,_0x3ec1a9))[_0xee49('0x54')](handleError(_0x5ca7dc,null));};exports[_0xee49('0x55')]=function(_0x1b049c,_0x275202){var _0x3fd082={'raw':![],'where':{'id':_0x1b049c['params']['id']},'include':[{'model':db[_0xee49('0x3a')],'as':_0xee49('0x56')}]},_0x1a4b26={};_0x1a4b26[_0xee49('0x3f')]=_[_0xee49('0x41')](db['FaxAccount'][_0xee49('0x57')]);_0x1a4b26['query']=_[_0xee49('0x41')](_0x1b049c[_0xee49('0x40')]);_0x1a4b26[_0xee49('0x42')]=_[_0xee49('0x43')](_0x1a4b26['model'],_0x1a4b26[_0xee49('0x40')]);_0x3fd082['attributes']=_[_0xee49('0x43')](_0x1a4b26[_0xee49('0x3f')],qs[_0xee49('0x45')](_0x1b049c[_0xee49('0x40')][_0xee49('0x45')]));_0x3fd082['attributes']=_0x3fd082['attributes']['length']?_0x3fd082[_0xee49('0x44')]:_0x1a4b26[_0xee49('0x3f')];if(_0x1b049c[_0xee49('0x40')][_0xee49('0x50')]){_0x3fd082[_0xee49('0x51')]=[{'all':!![]}];}_0x3fd082=_['merge']({},_0x3fd082,_0x1b049c[_0xee49('0x4e')]);return db['FaxAccount'][_0xee49('0x58')](_0x3fd082)[_0xee49('0x1f')](handleEntityNotFound(_0x275202,null))['then'](respondWithResult(_0x275202,null))[_0xee49('0x54')](handleError(_0x275202,null));};exports[_0xee49('0x59')]=function(_0x3affb3,_0x472a29){return db['FaxAccount'][_0xee49('0x59')](_0x3affb3['body'],{})[_0xee49('0x1f')](function(_0x30a428){var _0x51ac8c=_0x3affb3['user'][_0xee49('0x5a')]({'plain':!![]});if(!_0x51ac8c)throw new Error(_0xee49('0x5b'));if(_0x51ac8c['role']===_0xee49('0x5c')){var _0x417a34=_0x30a428[_0xee49('0x5a')]({'plain':!![]});var _0x5da4ef=_0xee49('0x34');return db[_0xee49('0x5d')]['find']({'where':{'name':_0x5da4ef,'userProfileId':_0x51ac8c[_0xee49('0x5e')]},'raw':!![]})[_0xee49('0x1f')](function(_0x3ebecd){if(_0x3ebecd&&_0x3ebecd[_0xee49('0x5f')]===0x0){return db[_0xee49('0x35')][_0xee49('0x59')]({'name':_0x417a34[_0xee49('0x37')],'resourceId':_0x417a34['id'],'type':_0x3ebecd[_0xee49('0x37')],'sectionId':_0x3ebecd['id']},{})[_0xee49('0x1f')](function(){return _0x30a428;});}else{return _0x30a428;}})[_0xee49('0x54')](function(_0x2fd6f8){logger[_0xee49('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fd6f8);throw _0x2fd6f8;});}return _0x30a428;})[_0xee49('0x1f')](respondWithResult(_0x472a29,0xc9))[_0xee49('0x54')](handleError(_0x472a29,null));};exports['update']=function(_0x17c562,_0x53b00c){if(_0x17c562[_0xee49('0x60')]['id']){delete _0x17c562[_0xee49('0x60')]['id'];}return db[_0xee49('0x3b')][_0xee49('0x58')]({'where':{'id':_0x17c562['params']['id']},'include':[{'model':db[_0xee49('0x3a')],'as':_0xee49('0x56')}]})[_0xee49('0x1f')](handleEntityNotFound(_0x53b00c,null))[_0xee49('0x1f')](saveUpdates(_0x17c562[_0xee49('0x60')],null))[_0xee49('0x1f')](respondWithResult(_0x53b00c,null))['catch'](handleError(_0x53b00c,null));};exports[_0xee49('0x33')]=function(_0x380928,_0x59bc48){return db[_0xee49('0x3b')][_0xee49('0x58')]({'where':{'id':_0x380928[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x59bc48,null))[_0xee49('0x1f')](removeEntity(_0x59bc48,null))[_0xee49('0x54')](handleError(_0x59bc48,null));};exports[_0xee49('0x62')]=function(_0x54c598,_0x4fbdf){return db[_0xee49('0x3b')][_0xee49('0x62')]()['then'](respondWithResult(_0x4fbdf,null))[_0xee49('0x54')](handleError(_0x4fbdf,null));};exports[_0xee49('0x63')]=function(_0x4ca754,_0x7d1c4e,_0x516e9c){if(_0x4ca754[_0xee49('0x60')]['id']){delete _0x4ca754['body']['id'];}return db[_0xee49('0x3b')][_0xee49('0x58')]({'where':{'id':_0x4ca754[_0xee49('0x61')]['id']}})['then'](handleEntityNotFound(_0x7d1c4e,null))[_0xee49('0x1f')](function(_0x1be285){if(_0x1be285){_0x4ca754[_0xee49('0x60')]['FaxAccountId']=_0x1be285['id'];return db[_0xee49('0x64')][_0xee49('0x59')](_0x4ca754[_0xee49('0x60')]);}})['then'](respondWithResult(_0x7d1c4e,null))[_0xee49('0x54')](handleError(_0x7d1c4e,null));};exports[_0xee49('0x65')]=function(_0x3167d0,_0x11bb4,_0x23aa6e){var _0x2cb181={'raw':![],'where':{}};var _0x30f7ae={};var _0x505283={'count':0x0,'rows':[]};return db[_0xee49('0x3b')]['findOne']({'where':{'id':_0x3167d0[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x11bb4,null))[_0xee49('0x1f')](function(_0x215ee6){if(_0x215ee6){_0x30f7ae['model']=_[_0xee49('0x41')](db[_0xee49('0x64')]['rawAttributes']);_0x30f7ae[_0xee49('0x40')]=_[_0xee49('0x41')](_0x3167d0[_0xee49('0x40')]);_0x30f7ae[_0xee49('0x42')]=_['intersection'](_0x30f7ae[_0xee49('0x3f')],_0x30f7ae['query']);_0x2cb181[_0xee49('0x44')]=_[_0xee49('0x43')](_0x30f7ae[_0xee49('0x3f')],qs['fields'](_0x3167d0[_0xee49('0x40')]['fields']));_0x2cb181[_0xee49('0x44')]=_0x2cb181[_0xee49('0x44')][_0xee49('0x46')]?_0x2cb181[_0xee49('0x44')]:_0x30f7ae[_0xee49('0x3f')];if(!_0x3167d0[_0xee49('0x40')][_0xee49('0x47')](_0xee49('0x66'))){_0x2cb181['limit']=qs[_0xee49('0x2d')](_0x3167d0['query'][_0xee49('0x2d')]);_0x2cb181[_0xee49('0x2b')]=qs[_0xee49('0x2b')](_0x3167d0[_0xee49('0x40')][_0xee49('0x2b')]);}_0x2cb181['order']=qs[_0xee49('0x48')](_0x3167d0[_0xee49('0x40')][_0xee49('0x48')]);_0x2cb181[_0xee49('0x4a')]=qs[_0xee49('0x42')](_[_0xee49('0x67')](_0x3167d0['query'],_0x30f7ae['filters']));_0x2cb181[_0xee49('0x4a')]['FaxAccountId']=_0x215ee6['id'];if(_0x3167d0[_0xee49('0x40')][_0xee49('0x49')]){_0x2cb181[_0xee49('0x4a')]=_[_0xee49('0x4d')](_0x2cb181[_0xee49('0x4a')],{'$or':_[_0xee49('0x4b')](_0x2cb181[_0xee49('0x44')],function(_0x33d85b){var _0x9c78bc={};_0x9c78bc[_0x33d85b]={'$like':'%'+_0x3167d0[_0xee49('0x40')][_0xee49('0x49')]+'%'};return _0x9c78bc;})});}_0x2cb181=_[_0xee49('0x4d')]({},_0x2cb181,_0x3167d0[_0xee49('0x4e')]);return db[_0xee49('0x64')][_0xee49('0x4f')]({'where':_0x2cb181[_0xee49('0x4a')]})[_0xee49('0x1f')](function(_0x1e17b9){_0x505283[_0xee49('0x4f')]=_0x1e17b9;if(_0x3167d0[_0xee49('0x40')][_0xee49('0x50')]){_0x2cb181['include']=[{'all':!![]}];}return db[_0xee49('0x64')][_0xee49('0x52')](_0x2cb181);})[_0xee49('0x1f')](function(_0x4a3c83){_0x505283[_0xee49('0x53')]=_0x4a3c83;return _0x505283;});}})[_0xee49('0x1f')](respondWithFilteredResult(_0x11bb4,_0x2cb181))['catch'](handleError(_0x11bb4,null));};exports[_0xee49('0x68')]=function(_0x1f4f2d,_0x4b0e9c,_0x94384a){return db[_0xee49('0x3b')][_0xee49('0x58')]({'where':{'id':_0x1f4f2d[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x4b0e9c,null))[_0xee49('0x1f')](function(_0x40597e){if(_0x40597e){return _0x40597e[_0xee49('0x68')](_0x1f4f2d[_0xee49('0x40')][_0xee49('0x69')]);}})[_0xee49('0x1f')](respondWithStatusCode(_0x4b0e9c,null))[_0xee49('0x54')](handleError(_0x4b0e9c,null));};exports[_0xee49('0x6a')]=function(_0x6cb1e6,_0x4f078b,_0x500b4a){if(_0x6cb1e6[_0xee49('0x60')]['id']){delete _0x6cb1e6[_0xee49('0x60')]['id'];}return db[_0xee49('0x3b')]['find']({'where':{'id':_0x6cb1e6[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x4f078b,null))['then'](function(_0x1d631c){if(_0x1d631c){_0x6cb1e6[_0xee49('0x60')][_0xee49('0x6b')]=_0x1d631c['id'];return db[_0xee49('0x6c')][_0xee49('0x59')](_0x6cb1e6[_0xee49('0x60')]);}})[_0xee49('0x1f')](respondWithResult(_0x4f078b,null))[_0xee49('0x54')](handleError(_0x4f078b,null));};exports[_0xee49('0x6d')]=function(_0x2c0f84,_0x3de5f6,_0x3ac08b){var _0x523697={'raw':![],'where':{}};var _0x2d27df={};var _0x4c3d3e={'count':0x0,'rows':[]};return db[_0xee49('0x3b')]['findOne']({'where':{'id':_0x2c0f84[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x3de5f6,null))[_0xee49('0x1f')](function(_0xfadca2){if(_0xfadca2){_0x2d27df['model']=_[_0xee49('0x41')](db['CannedAnswer'][_0xee49('0x57')]);_0x2d27df[_0xee49('0x40')]=_[_0xee49('0x41')](_0x2c0f84['query']);_0x2d27df[_0xee49('0x42')]=_[_0xee49('0x43')](_0x2d27df[_0xee49('0x3f')],_0x2d27df[_0xee49('0x40')]);_0x523697[_0xee49('0x44')]=_[_0xee49('0x43')](_0x2d27df['model'],qs[_0xee49('0x45')](_0x2c0f84['query'][_0xee49('0x45')]));_0x523697[_0xee49('0x44')]=_0x523697['attributes'][_0xee49('0x46')]?_0x523697[_0xee49('0x44')]:_0x2d27df[_0xee49('0x3f')];if(!_0x2c0f84[_0xee49('0x40')][_0xee49('0x47')](_0xee49('0x66'))){_0x523697[_0xee49('0x2d')]=qs[_0xee49('0x2d')](_0x2c0f84[_0xee49('0x40')][_0xee49('0x2d')]);_0x523697[_0xee49('0x2b')]=qs[_0xee49('0x2b')](_0x2c0f84[_0xee49('0x40')][_0xee49('0x2b')]);}_0x523697[_0xee49('0x6e')]=qs['sort'](_0x2c0f84[_0xee49('0x40')]['sort']);_0x523697[_0xee49('0x4a')]=qs[_0xee49('0x42')](_['pick'](_0x2c0f84[_0xee49('0x40')],_0x2d27df[_0xee49('0x42')]));_0x523697[_0xee49('0x4a')]['FaxAccountId']=_0xfadca2['id'];if(_0x2c0f84[_0xee49('0x40')][_0xee49('0x49')]){_0x523697[_0xee49('0x4a')]=_['merge'](_0x523697['where'],{'$or':_[_0xee49('0x4b')](_0x523697[_0xee49('0x44')],function(_0xca34fe){var _0x360590={};_0x360590[_0xca34fe]={'$like':'%'+_0x2c0f84[_0xee49('0x40')][_0xee49('0x49')]+'%'};return _0x360590;})});}_0x523697=_[_0xee49('0x4d')]({},_0x523697,_0x2c0f84[_0xee49('0x4e')]);return db['CannedAnswer'][_0xee49('0x4f')]({'where':_0x523697['where']})[_0xee49('0x1f')](function(_0x74f95b){_0x4c3d3e[_0xee49('0x4f')]=_0x74f95b;if(_0x2c0f84[_0xee49('0x40')][_0xee49('0x50')]){_0x523697[_0xee49('0x51')]=[{'all':!![]}];}return db[_0xee49('0x6c')][_0xee49('0x52')](_0x523697);})[_0xee49('0x1f')](function(_0x52cf14){_0x4c3d3e[_0xee49('0x53')]=_0x52cf14;return _0x4c3d3e;});}})[_0xee49('0x1f')](respondWithFilteredResult(_0x3de5f6,_0x523697))[_0xee49('0x54')](handleError(_0x3de5f6,null));};exports[_0xee49('0x6f')]=function(_0x2e0c68,_0x1aebc5,_0x1b86b8){return db['FaxAccount'][_0xee49('0x58')]({'where':{'id':_0x2e0c68[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x1aebc5,null))['then'](function(_0x424e0d){if(_0x424e0d){return _0x424e0d[_0xee49('0x6f')](_0x2e0c68[_0xee49('0x40')][_0xee49('0x69')]);}})[_0xee49('0x1f')](respondWithStatusCode(_0x1aebc5,null))[_0xee49('0x54')](handleError(_0x1aebc5,null));};exports[_0xee49('0x70')]=function(_0xdc8868,_0x549ea6,_0x377cab){return db[_0xee49('0x71')][_0xee49('0x58')]({'where':{'id':_0xdc8868[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x549ea6,null))['then'](function(_0x5954dd){if(_0x5954dd){return _0x5954dd['addInteraction'](_0xdc8868[_0xee49('0x60')][_0xee49('0x69')],_[_0xee49('0x72')](_0xdc8868['body'],[_0xee49('0x69'),'id'])||{});}})[_0xee49('0x1f')](respondWithResult(_0x549ea6,null))[_0xee49('0x54')](handleError(_0x549ea6,null));};exports[_0xee49('0x73')]=function(_0x1116c7,_0x59dcad,_0x431d66){var _0x45093d={'raw':![],'where':{}};var _0x82478c={};var _0x5b78ab={'count':0x0,'rows':[]};return db[_0xee49('0x3b')]['findOne']({'where':{'id':_0x1116c7['params']['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x59dcad,null))[_0xee49('0x1f')](function(_0x3115b3){if(_0x3115b3){_0x82478c[_0xee49('0x3f')]=_['keys'](db['FaxInteraction'][_0xee49('0x57')]);_0x82478c['query']=_[_0xee49('0x41')](_0x1116c7[_0xee49('0x40')]);_0x82478c[_0xee49('0x42')]=_[_0xee49('0x43')](_0x82478c['model'],_0x82478c[_0xee49('0x40')]);_0x45093d[_0xee49('0x44')]=_[_0xee49('0x43')](_0x82478c[_0xee49('0x3f')],qs[_0xee49('0x45')](_0x1116c7[_0xee49('0x40')][_0xee49('0x45')]));_0x45093d[_0xee49('0x44')]=_0x45093d[_0xee49('0x44')][_0xee49('0x46')]?_0x45093d['attributes']:_0x82478c['model'];if(!_0x1116c7[_0xee49('0x40')][_0xee49('0x47')](_0xee49('0x66'))){_0x45093d[_0xee49('0x2d')]=qs['limit'](_0x1116c7[_0xee49('0x40')][_0xee49('0x2d')]);_0x45093d[_0xee49('0x2b')]=qs[_0xee49('0x2b')](_0x1116c7[_0xee49('0x40')][_0xee49('0x2b')]);}_0x45093d[_0xee49('0x6e')]=qs['sort'](_0x1116c7[_0xee49('0x40')]['sort']);_0x45093d[_0xee49('0x4a')]=qs['filters'](_['pick'](_0x1116c7[_0xee49('0x40')],_0x82478c['filters']));_0x45093d[_0xee49('0x4a')]['FaxAccountId']=_0x3115b3['id'];if(_0x1116c7[_0xee49('0x40')][_0xee49('0x49')]){_0x45093d[_0xee49('0x4a')]=_['merge'](_0x45093d[_0xee49('0x4a')],{'$or':_[_0xee49('0x4b')](_0x45093d[_0xee49('0x44')],function(_0xacfe04){var _0x3aed80={};_0x3aed80[_0xacfe04]={'$like':'%'+_0x1116c7['query'][_0xee49('0x49')]+'%'};return _0x3aed80;})});}_0x45093d=_[_0xee49('0x4d')]({},_0x45093d,_0x1116c7['options']);return db[_0xee49('0x71')][_0xee49('0x4f')]({'where':_0x45093d[_0xee49('0x4a')]})[_0xee49('0x1f')](function(_0x402398){_0x5b78ab['count']=_0x402398;if(_0x1116c7['query'][_0xee49('0x50')]){_0x45093d[_0xee49('0x51')]=[{'model':db[_0xee49('0x74')],'as':_0xee49('0x75'),'required':![]},{'model':db[_0xee49('0x76')],'as':_0xee49('0x77'),'attributes':[_0xee49('0x37'),'fullname',_0xee49('0x78')],'required':![]},{'model':db[_0xee49('0x79')],'as':_0xee49('0x7a'),'attributes':['id',_0xee49('0x37'),'color'],'where':_0x1116c7[_0xee49('0x40')][_0xee49('0x7b')]?{'id':_0x1116c7[_0xee49('0x40')][_0xee49('0x7b')]}:undefined,'required':_0x1116c7[_0xee49('0x40')][_0xee49('0x7b')]?!![]:![]}];}return db[_0xee49('0x71')][_0xee49('0x52')](_0x45093d);})[_0xee49('0x1f')](function(_0x30e87a){_0x5b78ab[_0xee49('0x53')]=_0x30e87a;return _0x5b78ab;});}})['then'](respondWithFilteredResult(_0x59dcad,_0x45093d))['catch'](handleError(_0x59dcad,null));};exports[_0xee49('0x7c')]=function(_0x2df980,_0x536fb4,_0xda526){return db['FaxAccount'][_0xee49('0x7d')]({'where':{'id':_0x2df980[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x536fb4,null))[_0xee49('0x1f')](function(_0x4c2a1b){if(_0x4c2a1b){return db[_0xee49('0x7e')][_0xee49('0x7f')](function(_0x4e61b6){return db[_0xee49('0x80')]['destroy']({'where':{'FaxAccountId':_0x2df980[_0xee49('0x61')]['id']},'transaction':_0x4e61b6})[_0xee49('0x1f')](function(_0x4fd3ba){var _0x147410=_[_0xee49('0x4b')](_0x2df980[_0xee49('0x60')],function(_0x2428f6){_0x2428f6[_0xee49('0x6b')]=_0x2df980[_0xee49('0x61')]['id'];return _0x2428f6;});return db[_0xee49('0x80')][_0xee49('0x81')](_0x147410,{'transaction':_0x4e61b6});});})[_0xee49('0x1f')](function(){return db[_0xee49('0x80')][_0xee49('0x82')]({'where':{'FaxAccountId':_0x2df980[_0xee49('0x61')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x536fb4,null))[_0xee49('0x54')](handleError(_0x536fb4,null));};exports[_0xee49('0x83')]=function(_0x3ed5d5,_0x37470d,_0x30383c){var _0x30a96c={};var _0xbe1e4f={};var _0x5d07a0;var _0x4cb484;return db['FaxAccount'][_0xee49('0x7d')]({'where':{'id':_0x3ed5d5[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x37470d,null))[_0xee49('0x1f')](function(_0x1fd3e7){if(_0x1fd3e7){_0x5d07a0=_0x1fd3e7;_0xbe1e4f[_0xee49('0x3f')]=_[_0xee49('0x41')](db[_0xee49('0x80')][_0xee49('0x57')]);_0xbe1e4f[_0xee49('0x40')]=_[_0xee49('0x41')](_0x3ed5d5[_0xee49('0x40')]);_0xbe1e4f[_0xee49('0x42')]=_[_0xee49('0x43')](_0xbe1e4f[_0xee49('0x3f')],_0xbe1e4f[_0xee49('0x40')]);_0x30a96c[_0xee49('0x44')]=_[_0xee49('0x43')](_0xbe1e4f[_0xee49('0x3f')],qs[_0xee49('0x45')](_0x3ed5d5[_0xee49('0x40')]['fields']));_0x30a96c['attributes']=_0x30a96c[_0xee49('0x44')]['length']?_0x30a96c[_0xee49('0x44')]:_0xbe1e4f[_0xee49('0x3f')];_0x30a96c[_0xee49('0x6e')]=qs[_0xee49('0x48')](_0x3ed5d5[_0xee49('0x40')]['sort']);_0x30a96c[_0xee49('0x4a')]=qs[_0xee49('0x42')](_[_0xee49('0x67')](_0x3ed5d5[_0xee49('0x40')],_0xbe1e4f[_0xee49('0x42')]));if(_0x3ed5d5[_0xee49('0x40')]['filter']){_0x30a96c['where']=_[_0xee49('0x4d')](_0x30a96c[_0xee49('0x4a')],{'$or':_[_0xee49('0x4b')](_0x30a96c[_0xee49('0x44')],function(_0x48c41b){var _0x2967c0={};_0x2967c0[_0x48c41b]={'$like':'%'+_0x3ed5d5[_0xee49('0x40')]['filter']+'%'};return _0x2967c0;})});}_0x30a96c=_[_0xee49('0x4d')]({},_0x30a96c,_0x3ed5d5['options']);return _0x5d07a0[_0xee49('0x83')](_0x30a96c);}})['then'](function(_0x5452f9){if(_0x5452f9){_0x4cb484=_0x5452f9[_0xee49('0x46')];if(!_0x3ed5d5[_0xee49('0x40')][_0xee49('0x47')](_0xee49('0x66'))){_0x30a96c[_0xee49('0x2d')]=qs['limit'](_0x3ed5d5[_0xee49('0x40')][_0xee49('0x2d')]);_0x30a96c['offset']=qs[_0xee49('0x2b')](_0x3ed5d5['query'][_0xee49('0x2b')]);}return _0x5d07a0[_0xee49('0x83')](_0x30a96c);}})[_0xee49('0x1f')](function(_0x1c6f01){if(_0x1c6f01){return _0x1c6f01?{'count':_0x4cb484,'rows':_0x1c6f01}:null;}})[_0xee49('0x1f')](respondWithResult(_0x37470d,null))[_0xee49('0x54')](handleError(_0x37470d,null));};function Extension(_0x2b7e5a,_0x3e03d,_0x559fd0,_0x1417da){this[_0xee49('0x84')]=_0xee49('0x85');this[_0xee49('0x86')]=_0x2b7e5a[_0xee49('0x87')];this[_0xee49('0x88')]=_0x1417da;this[_0xee49('0x3d')]=_0xee49('0x89');this['description']=_0xee49('0x8a');this[_0xee49('0x6b')]=_0x2b7e5a['id'];this[_0xee49('0x8b')]=_0x3e03d;this[_0xee49('0x8c')]=_0x559fd0;}function createExtensionsReciveFax(_0x1f5182){var _0x4aa4a4=0x1;var _0x2b4721=[];_0x2b4721[_0xee49('0x8d')](new Extension(_0x1f5182,_0x4aa4a4,'','Answer'));_0x4aa4a4+=0x1;_0x2b4721[_0xee49('0x8d')](new Extension(_0x1f5182,_0x4aa4a4,_0xee49('0x8e'),'Set'));_0x4aa4a4+=0x1;for(var _0x366a8c in _0x1f5182){if(_0x1f5182[_0xee49('0x47')](_0x366a8c)&&(_0x366a8c===_0xee49('0x8f')||_0x366a8c==='localstationid'||_0x366a8c===_0xee49('0x90')||_0x366a8c==='faxdetect'||_0x366a8c===_0xee49('0x91')||_0x366a8c==='maxrate'||_0x366a8c===_0xee49('0x92')||_0x366a8c===_0xee49('0x93')||_0x366a8c==='t38timeout')){_0x2b4721['push'](new Extension(_0x1f5182,_0x4aa4a4,_0xee49('0x94')+_0x366a8c+')='+_0x1f5182[_0x366a8c],'Set'));_0x4aa4a4+=0x1;}}_0x2b4721['push'](new Extension(_0x1f5182,_0x4aa4a4,'6',_0xee49('0x95')));_0x4aa4a4+=0x1;_0x2b4721[_0xee49('0x8d')](new Extension(_0x1f5182,_0x4aa4a4,_0xee49('0x96'),_0xee49('0x97')));_0x4aa4a4=0x0;return _0x2b4721;}exports[_0xee49('0x98')]=function(_0x11020b,_0x1d5148,_0x12ddd7){var _0x104f5f;return db[_0xee49('0x7e')][_0xee49('0x7f')](function(_0x1a64ad){return db[_0xee49('0x3b')][_0xee49('0x59')](_0x11020b['body'],{'transaction':_0x1a64ad})[_0xee49('0x1f')](function(_0x3def08){_0x104f5f=_0x3def08[_0xee49('0x5a')]({'plain':!![]});return db[_0xee49('0x99')][_0xee49('0x81')](createExtensionsReciveFax(_0x104f5f),{'transaction':_0x1a64ad});});})['then'](function(){return _0x104f5f;})['then'](respondWithResult(_0x1d5148,null))[_0xee49('0x54')](handleError(_0x1d5148,null));};exports['updateAccountApplications']=function(_0x38dbb2,_0x39e38f,_0x45aa32){var _0x598047;return db[_0xee49('0x7e')][_0xee49('0x7f')](function(_0x3284f5){return db[_0xee49('0x3b')][_0xee49('0x32')](_0x38dbb2[_0xee49('0x60')],{'where':{'id':_0x38dbb2[_0xee49('0x60')]['id']},'transaction':_0x3284f5})[_0xee49('0x1f')](function(_0x17a31f){return db[_0xee49('0x99')][_0xee49('0x33')]({'where':{'FaxAccountId':_0x38dbb2[_0xee49('0x60')]['id']},'transaction':_0x3284f5})[_0xee49('0x1f')](function(_0x90c38f){return db[_0xee49('0x99')][_0xee49('0x81')](createExtensionsReciveFax(_[_0xee49('0x72')](_0x38dbb2['body'],[_0xee49('0x9a'),_0xee49('0x3e'),_0xee49('0x9b'),_0xee49('0x9c'),'TrunkId','ListId'])),{'transaction':_0x3284f5});});});})['then'](function(){return db['FaxAccount']['findById'](_0x38dbb2['body']['id']);})[_0xee49('0x1f')](respondWithResult(_0x39e38f,null))[_0xee49('0x54')](handleError(_0x39e38f,null));};exports[_0xee49('0x9d')]=function(_0x526024,_0x241da9,_0x592fd4){var _0x15fc2d={'raw':!![],'where':{}};var _0xbd5f03={};var _0x5ca223={'count':0x0,'rows':[]};return db[_0xee49('0x3b')][_0xee49('0x7d')]({'where':{'id':_0x526024['params']['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x241da9,null))[_0xee49('0x1f')](function(_0x28daba){if(_0x28daba){_0xbd5f03['model']=_[_0xee49('0x41')](db[_0xee49('0x9e')]['rawAttributes']);_0xbd5f03[_0xee49('0x40')]=_[_0xee49('0x41')](_0x526024['query']);_0xbd5f03[_0xee49('0x42')]=_[_0xee49('0x43')](_0xbd5f03['model'],_0xbd5f03['query']);_0x15fc2d[_0xee49('0x44')]=_[_0xee49('0x43')](_0xbd5f03['model'],qs[_0xee49('0x45')](_0x526024['query'][_0xee49('0x45')]));_0x15fc2d['attributes']=_0x15fc2d[_0xee49('0x44')][_0xee49('0x46')]?_0x15fc2d[_0xee49('0x44')]:_0xbd5f03[_0xee49('0x3f')];if(!_0x526024[_0xee49('0x40')]['hasOwnProperty'](_0xee49('0x66'))){_0x15fc2d[_0xee49('0x2d')]=qs['limit'](_0x526024[_0xee49('0x40')][_0xee49('0x2d')]);_0x15fc2d[_0xee49('0x2b')]=qs[_0xee49('0x2b')](_0x526024[_0xee49('0x40')][_0xee49('0x2b')]);}_0x15fc2d['order']=qs[_0xee49('0x48')](_0x526024[_0xee49('0x40')][_0xee49('0x48')]);_0x15fc2d[_0xee49('0x4a')]=qs[_0xee49('0x42')](_[_0xee49('0x67')](_0x526024[_0xee49('0x40')],_0xbd5f03[_0xee49('0x42')]));_0x15fc2d[_0xee49('0x4a')][_0xee49('0x6b')]=_0x28daba['id'];if(_0x526024[_0xee49('0x40')][_0xee49('0x49')]){_0x15fc2d[_0xee49('0x4a')]=_[_0xee49('0x4d')](_0x15fc2d['where'],{'$or':_[_0xee49('0x4b')](_0x15fc2d['attributes'],function(_0x491580){var _0x397b6e={};_0x397b6e[_0x491580]={'$like':'%'+_0x526024['query'][_0xee49('0x49')]+'%'};return _0x397b6e;})});}if(_0x526024[_0xee49('0x40')][_0xee49('0x9f')]){var _0x50c978=_0x526024['query'][_0xee49('0x9f')][_0xee49('0xa0')](',');var _0x2bba44={};_0x2bba44[_0x50c978[0x0]]={'$gte':moment(_0x50c978[0x1])[_0xee49('0xa1')](_0xee49('0xa2'))};_0x15fc2d[_0xee49('0x4a')]=_[_0xee49('0x4d')](_0x15fc2d['where'],_0x2bba44);}_0x15fc2d=_['merge']({},_0x15fc2d,_0x526024[_0xee49('0x4e')]);return db[_0xee49('0x9e')]['count']({'where':_0x15fc2d[_0xee49('0x4a')]})['then'](function(_0x41a358){_0x5ca223[_0xee49('0x4f')]=_0x41a358;if(_0x526024[_0xee49('0x40')][_0xee49('0x50')]){_0x15fc2d[_0xee49('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0xee49('0x52')](_0x15fc2d);})['then'](function(_0x1daf5c){_0x5ca223[_0xee49('0x53')]=_0x1daf5c;return _0x5ca223;});}})[_0xee49('0x1f')](respondWithFilteredResult(_0x241da9,_0x15fc2d))[_0xee49('0x54')](handleError(_0x241da9,null));};exports[_0xee49('0x38')]=function(_0x8ef65d,_0x2961c1,_0x17cb3a){var _0x38d53a,_0x52572a={},_0x5d08d6;if(_0x8ef65d['body']['to']){_0x5d08d6=_0x8ef65d['body']['to'][0x0];}return db[_0xee49('0x3b')][_0xee49('0x58')]({'where':{'id':_0x8ef65d[_0xee49('0x61')]['id']},'include':[{'model':db[_0xee49('0xa3')],'as':'List','include':[{'model':db[_0xee49('0x74')],'as':_0xee49('0xa4'),'where':{'fax':_0x5d08d6},'limit':0x1,'order':[[_0xee49('0x9c'),'DESC']]}]}]})[_0xee49('0x1f')](handleEntityNotFound(_0x2961c1,null))[_0xee49('0x1f')](function(_0x12e2ab){_0x38d53a=_0x12e2ab;if(_0x8ef65d[_0xee49('0x60')][_0xee49('0xa5')]&&_0x8ef65d['body'][_0xee49('0xa5')]['length']){for(var _0x149b19=0x0;_0x149b19<_0x8ef65d[_0xee49('0x60')][_0xee49('0xa5')]['length'];_0x149b19+=0x1){_0x8ef65d['body'][_0xee49('0xa5')][_0x149b19]={'filename':_0x8ef65d['body'][_0xee49('0xa5')][_0x149b19][_0xee49('0x37')],'id':_0x8ef65d[_0xee49('0x60')][_0xee49('0xa5')][_0x149b19]['id'],'path':path['join'](config['root'],_0xee49('0xa6'),_0x8ef65d[_0xee49('0x60')]['attachments'][_0x149b19]['basename'])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_['isNil'](_0x8ef65d[_0xee49('0x61')]['id'])?undefined:_0x8ef65d['params']['id'],'path':_[_0xee49('0xa7')](_0x8ef65d['body'][_0xee49('0xa5')][0x0][_0xee49('0x6')])?undefined:_0x8ef65d[_0xee49('0x60')][_0xee49('0xa5')][0x0][_0xee49('0x6')],'fax':_[_0xee49('0xa7')](_0x8ef65d[_0xee49('0x60')]['to'][0x0])?undefined:_0x8ef65d[_0xee49('0x60')]['to'][0x0]},client9002);})[_0xee49('0x1f')](function(){if(_0x38d53a){if(_['isNil'](_0x8ef65d['body']['from'])){_0x8ef65d['body'][_0xee49('0xa8')]=util['format']('\x22%s\x22\x20<%s>',_0x38d53a[_0xee49('0x37')],_0x38d53a[_0xee49('0xa9')]);}if(_0x38d53a[_0xee49('0xaa')]){if(_0x38d53a[_0xee49('0xaa')][_0xee49('0xa4')][_0xee49('0x46')]){return _0x38d53a[_0xee49('0xaa')][_0xee49('0xa4')][0x0];}else{return db[_0xee49('0x74')][_0xee49('0x59')](_['defaults'](_0x8ef65d['body'],{'firstName':_0x8ef65d[_0xee49('0x60')]['to'][0x0],'phone':_0x8ef65d[_0xee49('0x60')]['to'][0x0],'fax':_0x8ef65d[_0xee49('0x60')]['to'][0x0],'ListId':_0x38d53a[_0xee49('0xab')]}));}}else{throw new Error(_0xee49('0xac'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xee49('0x1f')](function(_0x5b3ff0){if(_0x5b3ff0){return db[_0xee49('0x71')]['find']({'where':{'ContactId':_0x5b3ff0['id'],'closed':![],'FaxAccountId':_0x38d53a['id']}})[_0xee49('0x1f')](function(_0x356325){if(_0x356325){return[_0x356325,![]];}return db[_0xee49('0x71')]['create']({'UserId':_0x8ef65d[_0xee49('0x5c')]['id'],'ContactId':_0x5b3ff0['id'],'FaxAccountId':_0x38d53a['id'],'fax':_0x8ef65d[_0xee49('0x60')]['to'][0x0],'firstMsgDirection':_0xee49('0xad'),'Messages':[_[_0xee49('0x4d')](_0x8ef65d['body'],{'read':![],'body':_0x8ef65d[_0xee49('0x60')]['attachments'][0x0][_0xee49('0xae')],'FaxAccountId':_0x38d53a['id'],'UserId':_0x8ef65d[_0xee49('0x5c')]['id'],'ContactId':_0x5b3ff0['id'],'AttachmentId':_0x8ef65d[_0xee49('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xee49('0x9e')],'as':_0xee49('0xaf')}]})[_0xee49('0x1f')](function(_0x2fbea3){return[_0x2fbea3,!![]];});});}else{throw new Error(_0xee49('0xb0'));}})[_0xee49('0xb1')](function(_0x511724,_0x1ecc0e){if(_0x1ecc0e){return _0x511724;}return db[_0xee49('0x9e')]['create']({'direction':_0xee49('0xad'),'read':![],'body':_0x8ef65d['body'][_0xee49('0xa5')][0x0][_0xee49('0xae')],'FaxAccountId':_0x38d53a['id'],'FaxInteractionId':_0x511724['id'],'UserId':_0x8ef65d[_0xee49('0x5c')]['id'],'ContactId':_0x511724['ContactId'],'AttachmentId':_0x8ef65d['body']['attachments'][0x0]['id']})[_0xee49('0x1f')](function(_0x51c362){_0x511724['dataValues'][_0xee49('0xaf')]=[];_0x511724[_0xee49('0xb2')]['Messages']['push'](_0x51c362[_0xee49('0xb2')]);return _0x511724;});})[_0xee49('0x1f')](function(_0x581f4b){respondWithRpcPromise('SendFax',_0xee49('0xb3'),{'FaxAccountId':_[_0xee49('0xa7')](_0x8ef65d[_0xee49('0x61')]['id'])?undefined:_0x8ef65d['params']['id'],'path':_[_0xee49('0xa7')](_0x8ef65d['body'][_0xee49('0xa5')][0x0][_0xee49('0x6')])?undefined:_0x8ef65d[_0xee49('0x60')][_0xee49('0xa5')][0x0][_0xee49('0x6')],'fax':_[_0xee49('0xa7')](_0x8ef65d['body']['to'][0x0])?undefined:_0x8ef65d[_0xee49('0x60')]['to'][0x0],'AttachmentId':_0x8ef65d[_0xee49('0x60')][_0xee49('0xa5')][0x0]['id']},client9002)[_0xee49('0x1f')](function(_0x395166){logger[_0xee49('0x20')](_0xee49('0xb4'),_0x395166);})[_0xee49('0x54')](function(_0x25c357){logger[_0xee49('0x20')](_0xee49('0xb4'),_0x25c357);});return _0x581f4b;})['then'](respondWithResult(_0x2961c1,null))['catch'](handleError(_0x2961c1,null));};exports[_0xee49('0xb5')]=function(_0x6e9f0f,_0x31e435,_0x41745f){return db[_0xee49('0x3b')]['find']({'where':{'id':_0x6e9f0f[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x31e435,null))[_0xee49('0x1f')](function(_0x391f66){if(_0x391f66){return _0x391f66[_0xee49('0xb5')](_0x6e9f0f[_0xee49('0x60')][_0xee49('0x69')],_[_0xee49('0x72')](_0x6e9f0f[_0xee49('0x60')],['ids','id'])||{})[_0xee49('0xb1')](function(_0x10d4f8){for(var _0x33a4ca=0x0;_0x33a4ca<_0x6e9f0f['body']['ids']['length'];_0x33a4ca+=0x1){socket[_0xee49('0xb6')](_0xee49('0xb7'),{'UserId':Number(_0x6e9f0f[_0xee49('0x60')]['ids'][_0x33a4ca]),'FaxAccountId':Number(_0x6e9f0f[_0xee49('0x61')]['id'])});}return _0x10d4f8;});}})['then'](respondWithResult(_0x31e435,null))[_0xee49('0x54')](handleError(_0x31e435,null));};exports[_0xee49('0xb8')]=function(_0x3327c2,_0x198690,_0x9e6c1e){return db['FaxAccount']['find']({'where':{'id':_0x3327c2[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x198690,null))['then'](function(_0x2dc9fc){if(_0x2dc9fc){return _0x2dc9fc[_0xee49('0xb8')](_0x3327c2[_0xee49('0x40')][_0xee49('0x69')])[_0xee49('0x1f')](function(){if(_['isArray'](_0x3327c2[_0xee49('0x40')][_0xee49('0x69')])){for(var _0x5a4da5=0x0;_0x5a4da5<_0x3327c2[_0xee49('0x40')][_0xee49('0x69')]['length'];_0x5a4da5+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3327c2['query'][_0xee49('0x69')][_0x5a4da5]),'FaxAccountId':Number(_0x3327c2['params']['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3327c2[_0xee49('0x40')][_0xee49('0x69')]),'FaxAccountId':Number(_0x3327c2[_0xee49('0x61')]['id'])});}});}})[_0xee49('0x1f')](respondWithStatusCode(_0x198690,null))[_0xee49('0x54')](handleError(_0x198690,null));};exports[_0xee49('0xb9')]=function(_0x3796ce,_0x13bb08,_0x50e159){var _0x23dcec={};var _0x2e63a7={};var _0x15be6f;var _0x47e202;return db[_0xee49('0x3b')][_0xee49('0x7d')]({'where':{'id':_0x3796ce[_0xee49('0x61')]['id']}})[_0xee49('0x1f')](handleEntityNotFound(_0x13bb08,null))[_0xee49('0x1f')](function(_0x4c210f){if(_0x4c210f){_0x15be6f=_0x4c210f;_0x2e63a7[_0xee49('0x3f')]=_['keys'](db[_0xee49('0x76')][_0xee49('0x57')]);_0x2e63a7[_0xee49('0x40')]=_[_0xee49('0x41')](_0x3796ce['query']);_0x2e63a7[_0xee49('0x42')]=_['intersection'](_0x2e63a7[_0xee49('0x3f')],_0x2e63a7[_0xee49('0x40')]);_0x23dcec[_0xee49('0x44')]=_['intersection'](_0x2e63a7[_0xee49('0x3f')],qs[_0xee49('0x45')](_0x3796ce[_0xee49('0x40')][_0xee49('0x45')]));_0x23dcec['attributes']=_0x23dcec[_0xee49('0x44')][_0xee49('0x46')]?_0x23dcec[_0xee49('0x44')]:_0x2e63a7[_0xee49('0x3f')];_0x23dcec['order']=qs[_0xee49('0x48')](_0x3796ce[_0xee49('0x40')][_0xee49('0x48')]);_0x23dcec[_0xee49('0x4a')]=qs[_0xee49('0x42')](_['pick'](_0x3796ce[_0xee49('0x40')],_0x2e63a7['filters']));if(_0x3796ce[_0xee49('0x40')][_0xee49('0x49')]){_0x23dcec['where']=_[_0xee49('0x4d')](_0x23dcec[_0xee49('0x4a')],{'$or':_[_0xee49('0x4b')](_0x23dcec[_0xee49('0x44')],function(_0x24b410){var _0x2cbeb6={};_0x2cbeb6[_0x24b410]={'$like':'%'+_0x3796ce[_0xee49('0x40')]['filter']+'%'};return _0x2cbeb6;})});}_0x23dcec=_[_0xee49('0x4d')]({},_0x23dcec,_0x3796ce['options']);return _0x15be6f[_0xee49('0xb9')](_0x23dcec);}})[_0xee49('0x1f')](function(_0xe97b3b){if(_0xe97b3b){_0x47e202=_0xe97b3b[_0xee49('0x46')];if(!_0x3796ce[_0xee49('0x40')][_0xee49('0x47')]('nolimit')){_0x23dcec[_0xee49('0x2d')]=qs[_0xee49('0x2d')](_0x3796ce[_0xee49('0x40')][_0xee49('0x2d')]);_0x23dcec[_0xee49('0x2b')]=qs[_0xee49('0x2b')](_0x3796ce[_0xee49('0x40')][_0xee49('0x2b')]);}return _0x15be6f[_0xee49('0xb9')](_0x23dcec);}})[_0xee49('0x1f')](function(_0x3f83da){if(_0x3f83da){return _0x3f83da?{'count':_0x47e202,'rows':_0x3f83da}:null;}})['then'](respondWithResult(_0x13bb08,null))[_0xee49('0x54')](handleError(_0x13bb08,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 0a97842..2e56500 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 _0xf7e0=['../../mysqldb','save','update','remove','emit','hook','events'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xf7e0,0x68));var _0x0f7e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf7e0[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x0f7e('0x0'));var FaxAccount=require(_0x0f7e('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f7e('0x2'),'afterUpdate':_0x0f7e('0x3'),'afterDestroy':_0x0f7e('0x4')};function emitEvent(_0x214bb7){return function(_0x1e0d6f,_0x5cf2e8,_0x1fce80){FaxAccountEvents[_0x0f7e('0x5')](_0x214bb7+':'+_0x1e0d6f['id'],_0x1e0d6f);FaxAccountEvents['emit'](_0x214bb7,_0x1e0d6f);_0x1fce80(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x0f7e('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x1969=['events','../../mysqldb','FaxAccount','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x550076,_0x3fe03f){var _0x22e477=function(_0x238141){while(--_0x238141){_0x550076['push'](_0x550076['shift']());}};_0x22e477(++_0x3fe03f);}(_0x1969,0xa2));var _0x9196=function(_0x9ce03f,_0x564de1){_0x9ce03f=_0x9ce03f-0x0;var _0x5cc5a=_0x1969[_0x9ce03f];return _0x5cc5a;};'use strict';var EventEmitter=require(_0x9196('0x0'));var FaxAccount=require(_0x9196('0x1'))['db'][_0x9196('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9196('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9196('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3faf7b){return function(_0xf36066,_0x30d1f9,_0x3ff7f9){FaxAccountEvents[_0x9196('0x5')](_0x3faf7b+':'+_0xf36066['id'],_0xf36066);FaxAccountEvents['emit'](_0x3faf7b,_0xf36066);_0x3ff7f9(null);};}for(var e in events){if(events[_0x9196('0x6')](e)){var event=events[e];FaxAccount[_0x9196('0x7')](e,emitEvent(event));}}module[_0x9196('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9bd6858..9ec806e 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 _0x6b2a=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x42cb73,_0x2e8b6){var _0x18d89c=function(_0x5eacdf){while(--_0x5eacdf){_0x42cb73['push'](_0x42cb73['shift']());}};_0x18d89c(++_0x2e8b6);}(_0x6b2a,0xf3));var _0xa6b2=function(_0x561a85,_0x36d66a){_0x561a85=_0x561a85-0x0;var _0x1520a3=_0x6b2a[_0x561a85];return _0x1520a3;};'use strict';var _=require(_0xa6b2('0x0'));var util=require(_0xa6b2('0x1'));var logger=require(_0xa6b2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa6b2('0x3'));var rp=require(_0xa6b2('0x4'));var fs=require('fs');var path=require(_0xa6b2('0x5'));var rimraf=require(_0xa6b2('0x6'));var config=require(_0xa6b2('0x7'));var attributes=require(_0xa6b2('0x8'));module['exports']=function(_0x1bdac6,_0x2c8f2d){return _0x1bdac6[_0xa6b2('0x9')](_0xa6b2('0xa'),attributes,{'tableName':_0xa6b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7e4=['../../config/environment','./faxAccount.attributes','define','lodash','moment','bluebird','request-promise','path'];(function(_0x543b59,_0x207d9d){var _0xbfe24f=function(_0x5460ae){while(--_0x5460ae){_0x543b59['push'](_0x543b59['shift']());}};_0xbfe24f(++_0x207d9d);}(_0xa7e4,0x1d3));var _0x4a7e=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xa7e4[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x4a7e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4a7e('0x1'));var BPromise=require(_0x4a7e('0x2'));var rp=require(_0x4a7e('0x3'));var fs=require('fs');var path=require(_0x4a7e('0x4'));var rimraf=require('rimraf');var config=require(_0x4a7e('0x5'));var attributes=require(_0x4a7e('0x6'));module['exports']=function(_0x10c5a4,_0x290973){return _0x10c5a4[_0x4a7e('0x7')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index a6939cc..bf41367 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 _0x0cf8=['createdAt','updatedAt','CompanyId','ListId','Sequelize','ValidationError','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','priority','asc','length','create','FaxInteraction','find','Contact\x20not\x20found','spread','push','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','User','interaction','unshift','name','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','FaxAccount','findAll','options','raw','where','include','map','attributes','model','GetFaxAccount','NotifyFaxAccount','body','fax','describe','difference','keys'];(function(_0x3c7a73,_0x3cd0f5){var _0xd0e2b6=function(_0x5df90d){while(--_0x5df90d){_0x3c7a73['push'](_0x3c7a73['shift']());}};_0xd0e2b6(++_0x3cd0f5);}(_0x0cf8,0x7e));var _0x80cf=function(_0x1952b4,_0x937c9c){_0x1952b4=_0x1952b4-0x0;var _0x417acf=_0x0cf8[_0x1952b4];return _0x417acf;};'use strict';var _=require('lodash');var util=require(_0x80cf('0x0'));var moment=require(_0x80cf('0x1'));var BPromise=require(_0x80cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80cf('0x3'));var db=require(_0x80cf('0x4'))['db'];var utils=require(_0x80cf('0x5'));var logger=require(_0x80cf('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x80cf('0x7'));var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0x80cf('0x8')](config[_0x80cf('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x80cf('0xa'))(new Redis(config[_0x80cf('0x9')]));require(_0x80cf('0xb'))[_0x80cf('0xc')](socket);function respondWithRpcPromise(_0x17c069,_0x4029b0,_0x1d152e){return new BPromise(function(_0xc50a0,_0x39404e){return client[_0x80cf('0xd')](_0x17c069,_0x1d152e)[_0x80cf('0xe')](function(_0x201f62){logger[_0x80cf('0xf')](_0x80cf('0x10'),_0x4029b0,_0x80cf('0x11'));logger[_0x80cf('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4029b0,_0x80cf('0x11'),JSON[_0x80cf('0x13')](_0x201f62));if(_0x201f62['error']){if(_0x201f62['error'][_0x80cf('0x14')]===0x1f4){logger[_0x80cf('0x15')](_0x80cf('0x10'),_0x4029b0,_0x201f62[_0x80cf('0x15')][_0x80cf('0x16')]);return _0x39404e(_0x201f62[_0x80cf('0x15')][_0x80cf('0x16')]);}logger[_0x80cf('0x15')](_0x80cf('0x10'),_0x4029b0,_0x201f62[_0x80cf('0x15')][_0x80cf('0x16')]);return _0xc50a0(_0x201f62[_0x80cf('0x15')][_0x80cf('0x16')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4029b0,_0x80cf('0x11'));_0xc50a0(_0x201f62['result'][_0x80cf('0x16')]);}})[_0x80cf('0x17')](function(_0x569e1d){logger['error']('FaxAccount,\x20%s,\x20%s',_0x4029b0,_0x569e1d);_0x39404e(_0x569e1d);});});}exports['GetFaxAccount']=function(_0x1f013f){var _0x218a63=this;return new Promise(function(_0x30f505,_0x1fa129){return db[_0x80cf('0x18')][_0x80cf('0x19')]({'raw':_0x1f013f[_0x80cf('0x1a')]?_0x1f013f[_0x80cf('0x1a')][_0x80cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f013f['options']?_0x1f013f[_0x80cf('0x1a')][_0x80cf('0x1c')]||null:null,'attributes':_0x1f013f['options']?_0x1f013f[_0x80cf('0x1a')]['attributes']||null:null,'limit':_0x1f013f['options']?_0x1f013f[_0x80cf('0x1a')]['limit']||null:null,'include':_0x1f013f[_0x80cf('0x1a')]?_0x1f013f[_0x80cf('0x1a')][_0x80cf('0x1d')]?_[_0x80cf('0x1e')](_0x1f013f['options']['include'],function(_0x206377){return{'model':db[_0x206377['model']],'as':_0x206377['as'],'attributes':_0x206377[_0x80cf('0x1f')],'include':_0x206377[_0x80cf('0x1d')]?_[_0x80cf('0x1e')](_0x206377[_0x80cf('0x1d')],function(_0x1c8bc3){return{'model':db[_0x1c8bc3['model']],'as':_0x1c8bc3['as'],'attributes':_0x1c8bc3[_0x80cf('0x1f')],'include':_0x1c8bc3[_0x80cf('0x1d')]?_[_0x80cf('0x1e')](_0x1c8bc3[_0x80cf('0x1d')],function(_0x409ced){return{'model':db[_0x409ced[_0x80cf('0x20')]],'as':_0x409ced['as'],'attributes':_0x409ced[_0x80cf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x80cf('0xe')](function(_0x4aaa21){logger[_0x80cf('0xf')]('GetFaxAccount',_0x1f013f);logger[_0x80cf('0x12')](_0x80cf('0x21'),_0x1f013f,JSON[_0x80cf('0x13')](_0x4aaa21));_0x30f505(_0x4aaa21);})['catch'](function(_0x402582){logger['error']('GetFaxAccount',_0x402582['message'],_0x1f013f);_0x1fa129(_0x218a63[_0x80cf('0x15')](0x1f4,_0x402582[_0x80cf('0x16')]));});});};exports[_0x80cf('0x22')]=function(_0x22b284,_0x42afc9,_0x4ff1ae){var _0x3863f8=this;return new Promise(function(_0x417025,_0x3d5339){var _0x2b1ca8={'body':_0x22b284[_0x80cf('0x23')],'channel':_0x80cf('0x24')};var _0xe5b11d=[];var _0x18a1c0=[];var _0x26bd9f={};return db['CmContact'][_0x80cf('0x25')]()[_0x80cf('0xe')](function(_0x27649f){if(!_0x27649f){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0xe5b11d=_[_0x80cf('0x26')](_[_0x80cf('0x27')](_0x27649f),[_0x80cf('0x28'),'updatedAt']);_0x18a1c0=_['difference'](_[_0x80cf('0x27')](_0x27649f),[_0x80cf('0x28'),_0x80cf('0x29'),_0x80cf('0x2a'),_0x80cf('0x2b')]);if(_0x22b284[_0x80cf('0x23')]['id']){delete _0x22b284[_0x80cf('0x23')]['id'];}if(_['isNil'](_0x22b284['body']['from'])){throw new db[(_0x80cf('0x2c'))][(_0x80cf('0x2d'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x22b284['body'][_0x80cf('0x23')])||_0x22b284['body'][_0x80cf('0x23')]===''){throw new db[(_0x80cf('0x2c'))][(_0x80cf('0x2d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x22b284[_0x80cf('0x23')][_0x80cf('0x2e')])){throw new db['Sequelize'][(_0x80cf('0x2d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18a1c0);}if(!_['includes'](_0x18a1c0,_0x22b284['body']['mapKey'])){throw new db[(_0x80cf('0x2c'))][(_0x80cf('0x2d'))](_0x80cf('0x2f')+_0x18a1c0);}_0x26bd9f[_0x22b284[_0x80cf('0x23')][_0x80cf('0x2e')]]=_0x22b284['body'][_0x80cf('0x30')];})[_0x80cf('0xe')](function(){return db[_0x80cf('0x18')]['find']({'where':{'id':_0x22b284[_0x80cf('0x31')]['id']},'include':[{'model':db[_0x80cf('0x32')],'as':_0x80cf('0x33'),'include':[{'model':db[_0x80cf('0x34')],'as':_0x80cf('0x35'),'where':_0x26bd9f,'limit':0x1,'order':[['updatedAt',_0x80cf('0x36')]]}]},{'model':db[_0x80cf('0x37')],'as':_0x80cf('0x38')}]});})[_0x80cf('0xe')](function(_0x506a7c){if(_0x506a7c&&_0x506a7c[_0x80cf('0x33')]){var _0x191669=_0x506a7c[_0x80cf('0x39')]({'plain':!![]});_0x2b1ca8[_0x80cf('0x31')]=_0x191669;_0x2b1ca8['applications']=_0x191669['Applications'];_0x2b1ca8[_0x80cf('0x3a')]=_0x191669[_0x80cf('0x33')];_0x2b1ca8[_0x80cf('0x3b')]=_[_0x80cf('0x3c')](_0x2b1ca8[_0x80cf('0x3b')],[_0x80cf('0x3d')],[_0x80cf('0x3e')]);if(_0x2b1ca8['account'][_0x80cf('0x38')]){delete _0x2b1ca8[_0x80cf('0x31')][_0x80cf('0x38')];}if(_0x2b1ca8[_0x80cf('0x31')][_0x80cf('0x33')]&&_0x2b1ca8[_0x80cf('0x31')][_0x80cf('0x33')]['Contacts'][_0x80cf('0x3f')]){return _0x2b1ca8[_0x80cf('0x31')][_0x80cf('0x33')][_0x80cf('0x35')][0x0];}var _0x4bb630=_[_0x80cf('0x8')](_0x22b284['body'],{'firstName':_0x22b284['body']['from'],'ListId':_0x191669[_0x80cf('0x2b')]});_0x4bb630[_0x22b284[_0x80cf('0x23')][_0x80cf('0x2e')]]=_0x22b284[_0x80cf('0x23')][_0x80cf('0x30')];return db['CmContact'][_0x80cf('0x40')](_0x4bb630,{'fields':_0xe5b11d,'raw':!![]});}})[_0x80cf('0xe')](function(_0x226539){_0x2b1ca8['contact']=_0x226539;if(_0x226539){var _0x526d46={'ContactId':_0x226539['id'],'FaxAccountId':_0x22b284['account']['id'],'fax':_0x226539['fax']};return db[_0x80cf('0x41')][_0x80cf('0x42')]({'where':{'ContactId':_0x226539['id'],'closed':![],'FaxAccountId':_0x22b284['account']['id']}})['then'](function(_0x303d21){if(_0x303d21){return[_0x303d21,![]];}return db[_0x80cf('0x41')][_0x80cf('0x40')](_0x526d46)['then'](function(_0xd4072a){return[_0xd4072a,!![]];});});}else{throw new Error(_0x80cf('0x43'));}})[_0x80cf('0x44')](function(_0x17b93,_0x46dd87){var _0x231503=_0x17b93[_0x80cf('0x39')]({'plain':!![]});if(_0x46dd87){if(_0x2b1ca8[_0x80cf('0x31')]['autoclose']){_0x2b1ca8[_0x80cf('0x3b')][_0x80cf('0x45')]({'id':0x0,'priority':_0x2b1ca8[_0x80cf('0x3b')][_0x80cf('0x3f')]+0x1,'app':'close','appdata':_0x80cf('0x46'),'interval':_0x80cf('0x47')});}_0x231503[_0x80cf('0x48')]=!![];}else{_0x231503[_0x80cf('0x48')]=![];}_0x2b1ca8['interaction']=_0x231503;return db['FaxMessage']['create']({'body':_0x22b284[_0x80cf('0x23')][_0x80cf('0x23')],'FaxAccountId':_0x22b284[_0x80cf('0x31')]['id'],'FaxInteractionId':_0x17b93['id'],'direction':'in','ContactId':_0x17b93[_0x80cf('0x49')],'AttachmentId':_0x22b284[_0x80cf('0x23')][_0x80cf('0x4a')]});})[_0x80cf('0xe')](function(_0x1edb15){_0x2b1ca8[_0x80cf('0x16')]=_0x1edb15;if(_0x2b1ca8['interaction'][_0x80cf('0x4b')]){return db[_0x80cf('0x4c')][_0x80cf('0x42')]({'attributes':['id','name'],'where':{'id':_0x2b1ca8[_0x80cf('0x4d')][_0x80cf('0x4b')]}})['then'](function(_0x4d4cee){if(_0x4d4cee){_0x2b1ca8[_0x80cf('0x3b')][_0x80cf('0x4e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4d4cee[_0x80cf('0x4f')]+','+(_0x2b1ca8[_0x80cf('0x31')][_0x80cf('0x50')]||0xa),'interval':_0x80cf('0x47')});}return respondWithRpcPromise(_0x80cf('0x51'),_0x80cf('0x52'),_0x2b1ca8);});}return respondWithRpcPromise(_0x80cf('0x51'),_0x80cf('0x52'),_0x2b1ca8);})[_0x80cf('0xe')](function(_0x5535f3){_0x417025(_0x5535f3);})[_0x80cf('0x17')](function(_0x412171){_0x3d5339(_0x3863f8[_0x80cf('0x15')](0x1f4,_0x412171[_0x80cf('0x16')]));});});}; \ No newline at end of file +var _0x4dc5=['*,*,*,*','created','interaction','ContactId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','include','map','model','attributes','debug','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','body','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','asc','length','ListId','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged'];(function(_0x3a3548,_0x2e794c){var _0x579293=function(_0x49167c){while(--_0x49167c){_0x3a3548['push'](_0x3a3548['shift']());}};_0x579293(++_0x2e794c);}(_0x4dc5,0x1ce));var _0x54dc=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x4dc5[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x54dc('0x0'));var util=require(_0x54dc('0x1'));var moment=require(_0x54dc('0x2'));var BPromise=require(_0x54dc('0x3'));var rs=require(_0x54dc('0x4'));var fs=require('fs');var Redis=require(_0x54dc('0x5'));var db=require(_0x54dc('0x6'))['db'];var utils=require(_0x54dc('0x7'));var logger=require(_0x54dc('0x8'))('rpc');var config=require(_0x54dc('0x9'));var jayson=require(_0x54dc('0xa'));var client=jayson[_0x54dc('0xb')]['http']({'port':0x232c});config[_0x54dc('0xc')]=_[_0x54dc('0xd')](config[_0x54dc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x54dc('0xe'))(new Redis(config[_0x54dc('0xc')]));require(_0x54dc('0xf'))[_0x54dc('0x10')](socket);function respondWithRpcPromise(_0x2be6b2,_0x2e6167,_0x260b79){return new BPromise(function(_0x18c744,_0x170585){return client[_0x54dc('0x11')](_0x2be6b2,_0x260b79)[_0x54dc('0x12')](function(_0xe2cf61){logger[_0x54dc('0x13')](_0x54dc('0x14'),_0x2e6167,_0x54dc('0x15'));logger['debug'](_0x54dc('0x16'),_0x2e6167,_0x54dc('0x15'),JSON[_0x54dc('0x17')](_0xe2cf61));if(_0xe2cf61[_0x54dc('0x18')]){if(_0xe2cf61[_0x54dc('0x18')][_0x54dc('0x19')]===0x1f4){logger[_0x54dc('0x18')](_0x54dc('0x14'),_0x2e6167,_0xe2cf61[_0x54dc('0x18')][_0x54dc('0x1a')]);return _0x170585(_0xe2cf61[_0x54dc('0x18')]['message']);}logger[_0x54dc('0x18')](_0x54dc('0x14'),_0x2e6167,_0xe2cf61[_0x54dc('0x18')][_0x54dc('0x1a')]);return _0x18c744(_0xe2cf61[_0x54dc('0x18')][_0x54dc('0x1a')]);}else{logger[_0x54dc('0x13')](_0x54dc('0x14'),_0x2e6167,_0x54dc('0x15'));_0x18c744(_0xe2cf61[_0x54dc('0x1b')][_0x54dc('0x1a')]);}})['catch'](function(_0x591fac){logger[_0x54dc('0x18')](_0x54dc('0x14'),_0x2e6167,_0x591fac);_0x170585(_0x591fac);});});}exports[_0x54dc('0x1c')]=function(_0x2fb260){var _0x41725a=this;return new Promise(function(_0x790cd6,_0x138c12){return db[_0x54dc('0x1d')][_0x54dc('0x1e')]({'raw':_0x2fb260[_0x54dc('0x1f')]?_0x2fb260['options'][_0x54dc('0x20')]===undefined?!![]:![]:!![],'where':_0x2fb260[_0x54dc('0x1f')]?_0x2fb260['options'][_0x54dc('0x21')]||null:null,'attributes':_0x2fb260[_0x54dc('0x1f')]?_0x2fb260[_0x54dc('0x1f')]['attributes']||null:null,'limit':_0x2fb260[_0x54dc('0x1f')]?_0x2fb260[_0x54dc('0x1f')]['limit']||null:null,'include':_0x2fb260[_0x54dc('0x1f')]?_0x2fb260[_0x54dc('0x1f')][_0x54dc('0x22')]?_[_0x54dc('0x23')](_0x2fb260[_0x54dc('0x1f')]['include'],function(_0x594b4d){return{'model':db[_0x594b4d[_0x54dc('0x24')]],'as':_0x594b4d['as'],'attributes':_0x594b4d['attributes'],'include':_0x594b4d[_0x54dc('0x22')]?_['map'](_0x594b4d[_0x54dc('0x22')],function(_0x3b4d17){return{'model':db[_0x3b4d17[_0x54dc('0x24')]],'as':_0x3b4d17['as'],'attributes':_0x3b4d17[_0x54dc('0x25')],'include':_0x3b4d17['include']?_[_0x54dc('0x23')](_0x3b4d17[_0x54dc('0x22')],function(_0xa8d342){return{'model':db[_0xa8d342['model']],'as':_0xa8d342['as'],'attributes':_0xa8d342[_0x54dc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x54dc('0x12')](function(_0x3fb28a){logger[_0x54dc('0x13')](_0x54dc('0x1c'),_0x2fb260);logger[_0x54dc('0x26')](_0x54dc('0x1c'),_0x2fb260,JSON[_0x54dc('0x17')](_0x3fb28a));_0x790cd6(_0x3fb28a);})['catch'](function(_0x149529){logger[_0x54dc('0x18')]('GetFaxAccount',_0x149529[_0x54dc('0x1a')],_0x2fb260);_0x138c12(_0x41725a['error'](0x1f4,_0x149529[_0x54dc('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x4f7e10,_0x66f8c3,_0xaf37fb){var _0x5ca1f1=this;return new Promise(function(_0x28437e,_0x4f7e75){var _0x507361={'body':_0x4f7e10['body'],'channel':_0x54dc('0x27')};var _0xfbf592=[];var _0x1295f7=[];var _0x8236e8={};return db[_0x54dc('0x28')][_0x54dc('0x29')]()[_0x54dc('0x12')](function(_0x1f3167){if(!_0x1f3167){throw new db[(_0x54dc('0x2a'))][(_0x54dc('0x2b'))](_0x54dc('0x2c'));}_0xfbf592=_[_0x54dc('0x2d')](_[_0x54dc('0x2e')](_0x1f3167),[_0x54dc('0x2f'),'updatedAt']);_0x1295f7=_['difference'](_[_0x54dc('0x2e')](_0x1f3167),[_0x54dc('0x2f'),_0x54dc('0x30'),'CompanyId','ListId']);if(_0x4f7e10[_0x54dc('0x31')]['id']){delete _0x4f7e10['body']['id'];}if(_['isNil'](_0x4f7e10[_0x54dc('0x31')]['from'])){throw new db[(_0x54dc('0x2a'))][(_0x54dc('0x2b'))](_0x54dc('0x32'));}if(_[_0x54dc('0x33')](_0x4f7e10[_0x54dc('0x31')][_0x54dc('0x31')])||_0x4f7e10[_0x54dc('0x31')][_0x54dc('0x31')]===''){throw new db[(_0x54dc('0x2a'))]['ValidationError'](_0x54dc('0x34'));}if(_[_0x54dc('0x33')](_0x4f7e10['body'][_0x54dc('0x35')])){throw new db[(_0x54dc('0x2a'))][(_0x54dc('0x2b'))](_0x54dc('0x36')+_0x1295f7);}if(!_['includes'](_0x1295f7,_0x4f7e10[_0x54dc('0x31')][_0x54dc('0x35')])){throw new db[(_0x54dc('0x2a'))]['ValidationError'](_0x54dc('0x37')+_0x1295f7);}_0x8236e8[_0x4f7e10[_0x54dc('0x31')][_0x54dc('0x35')]]=_0x4f7e10['body'][_0x54dc('0x38')];})[_0x54dc('0x12')](function(){return db[_0x54dc('0x1d')][_0x54dc('0x39')]({'where':{'id':_0x4f7e10[_0x54dc('0x3a')]['id']},'include':[{'model':db[_0x54dc('0x3b')],'as':_0x54dc('0x3c'),'include':[{'model':db[_0x54dc('0x28')],'as':_0x54dc('0x3d'),'where':_0x8236e8,'limit':0x1,'order':[[_0x54dc('0x30'),_0x54dc('0x3e')]]}]},{'model':db[_0x54dc('0x3f')],'as':'Applications'}]});})[_0x54dc('0x12')](function(_0x549dee){if(_0x549dee&&_0x549dee['List']){var _0x1875d5=_0x549dee[_0x54dc('0x40')]({'plain':!![]});_0x507361['account']=_0x1875d5;_0x507361[_0x54dc('0x41')]=_0x1875d5[_0x54dc('0x42')];_0x507361[_0x54dc('0x43')]=_0x1875d5['List'];_0x507361[_0x54dc('0x41')]=_['orderBy'](_0x507361['applications'],['priority'],[_0x54dc('0x44')]);if(_0x507361[_0x54dc('0x3a')][_0x54dc('0x42')]){delete _0x507361['account'][_0x54dc('0x42')];}if(_0x507361[_0x54dc('0x3a')][_0x54dc('0x3c')]&&_0x507361[_0x54dc('0x3a')]['List'][_0x54dc('0x3d')][_0x54dc('0x45')]){return _0x507361['account'][_0x54dc('0x3c')][_0x54dc('0x3d')][0x0];}var _0x4ea972=_[_0x54dc('0xd')](_0x4f7e10[_0x54dc('0x31')],{'firstName':_0x4f7e10[_0x54dc('0x31')]['from'],'ListId':_0x1875d5[_0x54dc('0x46')]});_0x4ea972[_0x4f7e10[_0x54dc('0x31')]['mapKey']]=_0x4f7e10[_0x54dc('0x31')]['from'];return db['CmContact'][_0x54dc('0x47')](_0x4ea972,{'fields':_0xfbf592,'raw':!![]});}})[_0x54dc('0x12')](function(_0x3742ea){_0x507361['contact']=_0x3742ea;if(_0x3742ea){var _0x84abc9={'ContactId':_0x3742ea['id'],'FaxAccountId':_0x4f7e10[_0x54dc('0x3a')]['id'],'fax':_0x3742ea[_0x54dc('0x27')]};return db[_0x54dc('0x48')][_0x54dc('0x39')]({'where':{'ContactId':_0x3742ea['id'],'closed':![],'FaxAccountId':_0x4f7e10[_0x54dc('0x3a')]['id']}})[_0x54dc('0x12')](function(_0x393fda){if(_0x393fda){return[_0x393fda,![]];}return db['FaxInteraction'][_0x54dc('0x47')](_0x84abc9)[_0x54dc('0x12')](function(_0x3a53f1){return[_0x3a53f1,!![]];});});}else{throw new Error(_0x54dc('0x49'));}})[_0x54dc('0x4a')](function(_0x130d9e,_0x3fab66){var _0xe7936c=_0x130d9e[_0x54dc('0x40')]({'plain':!![]});if(_0x3fab66){if(_0x507361['account'][_0x54dc('0x4b')]){_0x507361[_0x54dc('0x41')]['push']({'id':0x0,'priority':_0x507361['applications'][_0x54dc('0x45')]+0x1,'app':_0x54dc('0x4c'),'appdata':_0x54dc('0x4d'),'interval':_0x54dc('0x4e')});}_0xe7936c['created']=!![];}else{_0xe7936c[_0x54dc('0x4f')]=![];}_0x507361[_0x54dc('0x50')]=_0xe7936c;return db['FaxMessage']['create']({'body':_0x4f7e10[_0x54dc('0x31')][_0x54dc('0x31')],'FaxAccountId':_0x4f7e10['account']['id'],'FaxInteractionId':_0x130d9e['id'],'direction':'in','ContactId':_0x130d9e[_0x54dc('0x51')],'AttachmentId':_0x4f7e10[_0x54dc('0x31')]['AttachmentId']});})[_0x54dc('0x12')](function(_0x24ece3){_0x507361['message']=_0x24ece3;if(_0x507361['interaction'][_0x54dc('0x52')]){return db['User'][_0x54dc('0x39')]({'attributes':['id',_0x54dc('0x53')],'where':{'id':_0x507361['interaction']['UserId']}})['then'](function(_0x4fc386){if(_0x4fc386){_0x507361['applications'][_0x54dc('0x54')]({'id':0x0,'priority':0x0,'app':_0x54dc('0x55'),'appdata':_0x4fc386[_0x54dc('0x53')]+','+(_0x507361[_0x54dc('0x3a')][_0x54dc('0x56')]||0xa),'interval':_0x54dc('0x4e')});}return respondWithRpcPromise(_0x54dc('0x57'),_0x54dc('0x58'),_0x507361);});}return respondWithRpcPromise(_0x54dc('0x57'),_0x54dc('0x58'),_0x507361);})[_0x54dc('0x12')](function(_0x1920cd){_0x28437e(_0x1920cd);})[_0x54dc('0x59')](function(_0x27edf4){_0x4f7e75(_0x5ca1f1[_0x54dc('0x18')](0x1f4,_0x27edf4[_0x54dc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 64442d5..e221970 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 _0xe2fc=['save','remove','update','emit','removeListener','register','./faxAccount.events'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xe2fc,0xa0));var _0xce2f=function(_0x582284,_0x19879a){_0x582284=_0x582284-0x0;var _0x2fe5b8=_0xe2fc[_0x582284];return _0x2fe5b8;};'use strict';var FaxAccountEvents=require(_0xce2f('0x0'));var events=[_0xce2f('0x1'),_0xce2f('0x2'),_0xce2f('0x3')];function createListener(_0x5e58e4,_0x30d9d7){return function(_0x490245){_0x30d9d7[_0xce2f('0x4')](_0x5e58e4,_0x490245);};}function removeListener(_0x13d4e3,_0x2b5a15){return function(){FaxAccountEvents[_0xce2f('0x5')](_0x13d4e3,_0x2b5a15);};}exports[_0xce2f('0x6')]=function(_0x3af29e){for(var _0x53b239=0x0,_0x18a26c=events['length'];_0x53b239<_0x18a26c;_0x53b239++){var _0x4e8cb5=events[_0x53b239];var _0x22a4a1=createListener('faxAccount:'+_0x4e8cb5,_0x3af29e);FaxAccountEvents['on'](_0x4e8cb5,_0x22a4a1);}}; \ No newline at end of file +var _0x0d16=['register','length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x0d16,0x162));var _0x60d1=function(_0x1f6059,_0xaf4ba7){_0x1f6059=_0x1f6059-0x0;var _0x6a1148=_0x0d16[_0x1f6059];return _0x6a1148;};'use strict';var FaxAccountEvents=require(_0x60d1('0x0'));var events=[_0x60d1('0x1'),_0x60d1('0x2'),_0x60d1('0x3')];function createListener(_0x4816fd,_0x3e9419){return function(_0x5ef0f8){_0x3e9419[_0x60d1('0x4')](_0x4816fd,_0x5ef0f8);};}function removeListener(_0x1f15fd,_0x5680d0){return function(){FaxAccountEvents[_0x60d1('0x5')](_0x1f15fd,_0x5680d0);};}exports[_0x60d1('0x6')]=function(_0x95d5c){for(var _0x5c5121=0x0,_0x387a96=events[_0x60d1('0x7')];_0x5c5121<_0x387a96;_0x5c5121++){var _0x36e12c=events[_0x5c5121];var _0x333250=createListener(_0x60d1('0x8')+_0x36e12c,_0x95d5c);FaxAccountEvents['on'](_0x36e12c,_0x333250);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 5d64474..ad118c2 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(_0x14f586,_0x5280e8){var _0x1d6d98=function(_0xa4c2b1){while(--_0xa4c2b1){_0x14f586['push'](_0x14f586['shift']());}};_0x1d6d98(++_0x5280e8);}(_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['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(_0xbea8ac,_0x341d80){var _0x4600af=function(_0xa0587){while(--_0xa0587){_0xbea8ac['push'](_0xbea8ac['shift']());}};_0x4600af(++_0x341d80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 36a33b1..cd77367 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 _0x49d9=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x49d9,0x10b));var _0x949d=function(_0x212fc7,_0x50b512){_0x212fc7=_0x212fc7-0x0;var _0x56e248=_0x49d9[_0x212fc7];return _0x56e248;};'use strict';var Sequelize=require(_0x949d('0x0'));module[_0x949d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x949d('0x2')],'allowNull':![],'defaultValue':_0x949d('0x3')},'appdata':{'type':Sequelize[_0x949d('0x4')]()},'description':{'type':Sequelize[_0x949d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x949d('0x5')}}; \ No newline at end of file +var _0x03bc=['noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x24dfd2,_0x504fac){var _0x3abda1=function(_0x55bc85){while(--_0x55bc85){_0x24dfd2['push'](_0x24dfd2['shift']());}};_0x3abda1(++_0x504fac);}(_0x03bc,0x94));var _0xc03b=function(_0x1cee17,_0x3971b1){_0x1cee17=_0x1cee17-0x0;var _0x4774d6=_0x03bc[_0x1cee17];return _0x4774d6;};'use strict';var Sequelize=require(_0xc03b('0x0'));module[_0xc03b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc03b('0x2')},'appdata':{'type':Sequelize[_0xc03b('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc03b('0x4')],'defaultValue':_0xc03b('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 622d523..bd0bb12 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 _0x0e1d=['Content-Range','apply','reject','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxApplication','include','findAll','rows','catch','params','includeAll','find','create','body','rimraf','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x2bbe84,_0x27e011){var _0x5467bd=function(_0x3051e1){while(--_0x3051e1){_0x2bbe84['push'](_0x2bbe84['shift']());}};_0x5467bd(++_0x27e011);}(_0x0e1d,0xb7));var _0xd0e1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0e1d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0e1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd0e1('0x1'));var Mustache=require(_0xd0e1('0x2'));var util=require(_0xd0e1('0x3'));var path=require(_0xd0e1('0x4'));var sox=require(_0xd0e1('0x5'));var csv=require('to-csv');var ejs=require(_0xd0e1('0x6'));var fs=require('fs');var fs_extra=require(_0xd0e1('0x7'));var _=require(_0xd0e1('0x8'));var squel=require(_0xd0e1('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd0e1('0xa'));var querystring=require(_0xd0e1('0xb'));var Papa=require(_0xd0e1('0xc'));var Redis=require('ioredis');var authService=require(_0xd0e1('0xd'));var qs=require(_0xd0e1('0xe'));var as=require(_0xd0e1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0e1('0x10'))(_0xd0e1('0x11'));var utils=require(_0xd0e1('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd0e1('0x13'));var db=require(_0xd0e1('0x14'))['db'];function respondWithStatusCode(_0x20d779,_0x27a7a7){_0x27a7a7=_0x27a7a7||0xcc;return function(_0x2d107c){if(_0x2d107c){return _0x20d779[_0xd0e1('0x15')](_0x27a7a7);}return _0x20d779[_0xd0e1('0x16')](_0x27a7a7)[_0xd0e1('0x17')]();};}function respondWithResult(_0x28594d,_0x53e0a5){_0x53e0a5=_0x53e0a5||0xc8;return function(_0x26347b){if(_0x26347b){return _0x28594d['status'](_0x53e0a5)[_0xd0e1('0x18')](_0x26347b);}};}function respondWithFilteredResult(_0x4428e8,_0x130a6c){return function(_0x2b91b0){if(_0x2b91b0){var _0x2ee8cd=typeof _0x130a6c['offset']===_0xd0e1('0x19')&&typeof _0x130a6c[_0xd0e1('0x1a')]===_0xd0e1('0x19');var _0x19573a=_0x2b91b0[_0xd0e1('0x1b')];var _0x52726b=_0x2ee8cd?0x0:_0x130a6c[_0xd0e1('0x1c')];var _0x1ff0ea=_0x2ee8cd?_0x2b91b0[_0xd0e1('0x1b')]:_0x130a6c[_0xd0e1('0x1c')]+_0x130a6c[_0xd0e1('0x1a')];var _0x3edd1f;if(_0x1ff0ea>=_0x19573a){_0x1ff0ea=_0x19573a;_0x3edd1f=0xc8;}else{_0x3edd1f=0xce;}_0x4428e8[_0xd0e1('0x16')](_0x3edd1f);return _0x4428e8[_0xd0e1('0x1d')](_0xd0e1('0x1e'),_0x52726b+'-'+_0x1ff0ea+'/'+_0x19573a)[_0xd0e1('0x18')](_0x2b91b0);}return null;};}function patchUpdates(_0x5366a9){return function(_0x456178){try{jsonpatch[_0xd0e1('0x1f')](_0x456178,_0x5366a9,!![]);}catch(_0x15745f){return BPromise[_0xd0e1('0x20')](_0x15745f);}return _0x456178['save']();};}function saveUpdates(_0x3800bc,_0x58fe10){return function(_0x1df13d){if(_0x1df13d){return _0x1df13d[_0xd0e1('0x21')](_0x3800bc)[_0xd0e1('0x22')](function(_0x354030){return _0x354030;});}return null;};}function removeEntity(_0x39576a,_0x8d06a8){return function(_0x19e106){if(_0x19e106){return _0x19e106[_0xd0e1('0x23')]()[_0xd0e1('0x22')](function(){_0x39576a['status'](0xcc)[_0xd0e1('0x17')]();});}};}function handleEntityNotFound(_0x456269,_0x530902){return function(_0x17b2f7){if(!_0x17b2f7){_0x456269[_0xd0e1('0x15')](0x194);}return _0x17b2f7;};}function handleError(_0x1c4e21,_0x4273d0){_0x4273d0=_0x4273d0||0x1f4;return function(_0x20d025){logger['error'](_0x20d025[_0xd0e1('0x24')]);if(_0x20d025['name']){delete _0x20d025[_0xd0e1('0x25')];}_0x1c4e21[_0xd0e1('0x16')](_0x4273d0)[_0xd0e1('0x26')](_0x20d025);};}exports['index']=function(_0x463f12,_0x5d445e){var _0x5423de={},_0x451e4a={},_0x57f74b={'count':0x0,'rows':[]};var _0x2f309e=_['map'](db['FaxApplication'][_0xd0e1('0x27')],function(_0x24422e){return{'name':_0x24422e[_0xd0e1('0x28')],'type':_0x24422e[_0xd0e1('0x29')][_0xd0e1('0x2a')]};});_0x451e4a[_0xd0e1('0x2b')]=_[_0xd0e1('0x2c')](_0x2f309e,_0xd0e1('0x25'));_0x451e4a[_0xd0e1('0x2d')]=_[_0xd0e1('0x2e')](_0x463f12['query']);_0x451e4a[_0xd0e1('0x2f')]=_[_0xd0e1('0x30')](_0x451e4a[_0xd0e1('0x2b')],_0x451e4a[_0xd0e1('0x2d')]);_0x5423de[_0xd0e1('0x31')]=_[_0xd0e1('0x30')](_0x451e4a[_0xd0e1('0x2b')],qs['fields'](_0x463f12['query'][_0xd0e1('0x32')]));_0x5423de[_0xd0e1('0x31')]=_0x5423de[_0xd0e1('0x31')][_0xd0e1('0x33')]?_0x5423de[_0xd0e1('0x31')]:_0x451e4a[_0xd0e1('0x2b')];if(!_0x463f12[_0xd0e1('0x2d')][_0xd0e1('0x34')](_0xd0e1('0x35'))){_0x5423de[_0xd0e1('0x1a')]=qs[_0xd0e1('0x1a')](_0x463f12[_0xd0e1('0x2d')][_0xd0e1('0x1a')]);_0x5423de[_0xd0e1('0x1c')]=qs[_0xd0e1('0x1c')](_0x463f12[_0xd0e1('0x2d')][_0xd0e1('0x1c')]);}_0x5423de[_0xd0e1('0x36')]=qs['sort'](_0x463f12[_0xd0e1('0x2d')][_0xd0e1('0x37')]);_0x5423de[_0xd0e1('0x38')]=qs['filters'](_['pick'](_0x463f12[_0xd0e1('0x2d')],_0x451e4a[_0xd0e1('0x2f')]),_0x2f309e);if(_0x463f12[_0xd0e1('0x2d')][_0xd0e1('0x39')]){_0x5423de[_0xd0e1('0x38')]=_[_0xd0e1('0x3a')](_0x5423de[_0xd0e1('0x38')],{'$or':_[_0xd0e1('0x2c')](_0x2f309e,function(_0x43d46f){if(_0x43d46f[_0xd0e1('0x29')]!==_0xd0e1('0x3b')){var _0x3931a1={};_0x3931a1[_0x43d46f['name']]={'$like':'%'+_0x463f12[_0xd0e1('0x2d')]['filter']+'%'};return _0x3931a1;}})});}_0x5423de=_['merge']({},_0x5423de,_0x463f12[_0xd0e1('0x3c')]);var _0xb1a8e7={'where':_0x5423de[_0xd0e1('0x38')]};return db[_0xd0e1('0x3d')][_0xd0e1('0x1b')](_0xb1a8e7)[_0xd0e1('0x22')](function(_0x46cb66){_0x57f74b[_0xd0e1('0x1b')]=_0x46cb66;if(_0x463f12[_0xd0e1('0x2d')]['includeAll']){_0x5423de[_0xd0e1('0x3e')]=[{'all':!![]}];}return db[_0xd0e1('0x3d')][_0xd0e1('0x3f')](_0x5423de);})[_0xd0e1('0x22')](function(_0x4d1c73){_0x57f74b[_0xd0e1('0x40')]=_0x4d1c73;return _0x57f74b;})[_0xd0e1('0x22')](respondWithFilteredResult(_0x5d445e,_0x5423de))[_0xd0e1('0x41')](handleError(_0x5d445e,null));};exports['show']=function(_0x414e83,_0x3f56f5){var _0x897c37={'raw':!![],'where':{'id':_0x414e83[_0xd0e1('0x42')]['id']}},_0x545ee3={};_0x545ee3[_0xd0e1('0x2b')]=_[_0xd0e1('0x2e')](db[_0xd0e1('0x3d')]['rawAttributes']);_0x545ee3['query']=_['keys'](_0x414e83['query']);_0x545ee3[_0xd0e1('0x2f')]=_[_0xd0e1('0x30')](_0x545ee3[_0xd0e1('0x2b')],_0x545ee3[_0xd0e1('0x2d')]);_0x897c37[_0xd0e1('0x31')]=_['intersection'](_0x545ee3[_0xd0e1('0x2b')],qs['fields'](_0x414e83[_0xd0e1('0x2d')]['fields']));_0x897c37['attributes']=_0x897c37[_0xd0e1('0x31')][_0xd0e1('0x33')]?_0x897c37[_0xd0e1('0x31')]:_0x545ee3['model'];if(_0x414e83[_0xd0e1('0x2d')][_0xd0e1('0x43')]){_0x897c37[_0xd0e1('0x3e')]=[{'all':!![]}];}_0x897c37=_[_0xd0e1('0x3a')]({},_0x897c37,_0x414e83[_0xd0e1('0x3c')]);return db['FaxApplication'][_0xd0e1('0x44')](_0x897c37)[_0xd0e1('0x22')](handleEntityNotFound(_0x3f56f5,null))[_0xd0e1('0x22')](respondWithResult(_0x3f56f5,null))[_0xd0e1('0x41')](handleError(_0x3f56f5,null));};exports['create']=function(_0xb60efb,_0x4f4989){return db[_0xd0e1('0x3d')][_0xd0e1('0x45')](_0xb60efb[_0xd0e1('0x46')],{})['then'](respondWithResult(_0x4f4989,0xc9))[_0xd0e1('0x41')](handleError(_0x4f4989,null));};exports[_0xd0e1('0x21')]=function(_0x40278b,_0x1782a5){if(_0x40278b[_0xd0e1('0x46')]['id']){delete _0x40278b[_0xd0e1('0x46')]['id'];}return db['FaxApplication'][_0xd0e1('0x44')]({'where':{'id':_0x40278b[_0xd0e1('0x42')]['id']}})[_0xd0e1('0x22')](handleEntityNotFound(_0x1782a5,null))[_0xd0e1('0x22')](saveUpdates(_0x40278b[_0xd0e1('0x46')],null))[_0xd0e1('0x22')](respondWithResult(_0x1782a5,null))[_0xd0e1('0x41')](handleError(_0x1782a5,null));};exports['destroy']=function(_0x347b46,_0x19df19){return db['FaxApplication']['find']({'where':{'id':_0x347b46[_0xd0e1('0x42')]['id']}})[_0xd0e1('0x22')](handleEntityNotFound(_0x19df19,null))['then'](removeEntity(_0x19df19,null))[_0xd0e1('0x41')](handleError(_0x19df19,null));}; \ No newline at end of file +var _0x9ddd=['map','FaxApplication','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9ddd,0x6d));var _0xd9dd=function(_0x1979ed,_0x14e570){_0x1979ed=_0x1979ed-0x0;var _0x245eac=_0x9ddd[_0x1979ed];return _0x245eac;};'use strict';var emlformat=require(_0xd9dd('0x0'));var rimraf=require(_0xd9dd('0x1'));var zipdir=require(_0xd9dd('0x2'));var jsonpatch=require(_0xd9dd('0x3'));var rp=require('request-promise');var moment=require(_0xd9dd('0x4'));var BPromise=require(_0xd9dd('0x5'));var Mustache=require(_0xd9dd('0x6'));var util=require(_0xd9dd('0x7'));var path=require(_0xd9dd('0x8'));var sox=require(_0xd9dd('0x9'));var csv=require('to-csv');var ejs=require(_0xd9dd('0xa'));var fs=require('fs');var fs_extra=require(_0xd9dd('0xb'));var _=require(_0xd9dd('0xc'));var squel=require(_0xd9dd('0xd'));var crypto=require(_0xd9dd('0xe'));var jsforce=require(_0xd9dd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd9dd('0x10'));var querystring=require(_0xd9dd('0x11'));var Papa=require(_0xd9dd('0x12'));var Redis=require(_0xd9dd('0x13'));var authService=require(_0xd9dd('0x14'));var qs=require(_0xd9dd('0x15'));var as=require(_0xd9dd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd9dd('0x17'));var utils=require(_0xd9dd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd9dd('0x19'));var db=require(_0xd9dd('0x1a'))['db'];function respondWithStatusCode(_0x319705,_0x16d1b8){_0x16d1b8=_0x16d1b8||0xcc;return function(_0x2c76f1){if(_0x2c76f1){return _0x319705[_0xd9dd('0x1b')](_0x16d1b8);}return _0x319705[_0xd9dd('0x1c')](_0x16d1b8)['end']();};}function respondWithResult(_0x2baf4c,_0x50c08c){_0x50c08c=_0x50c08c||0xc8;return function(_0xc4bdf3){if(_0xc4bdf3){return _0x2baf4c[_0xd9dd('0x1c')](_0x50c08c)[_0xd9dd('0x1d')](_0xc4bdf3);}};}function respondWithFilteredResult(_0x523bbf,_0x1af868){return function(_0xb47d34){if(_0xb47d34){var _0x4df790=typeof _0x1af868[_0xd9dd('0x1e')]===_0xd9dd('0x1f')&&typeof _0x1af868[_0xd9dd('0x20')]===_0xd9dd('0x1f');var _0x22c780=_0xb47d34[_0xd9dd('0x21')];var _0xa15f61=_0x4df790?0x0:_0x1af868[_0xd9dd('0x1e')];var _0x56aaf8=_0x4df790?_0xb47d34['count']:_0x1af868['offset']+_0x1af868[_0xd9dd('0x20')];var _0x2a3baf;if(_0x56aaf8>=_0x22c780){_0x56aaf8=_0x22c780;_0x2a3baf=0xc8;}else{_0x2a3baf=0xce;}_0x523bbf['status'](_0x2a3baf);return _0x523bbf['set'](_0xd9dd('0x22'),_0xa15f61+'-'+_0x56aaf8+'/'+_0x22c780)[_0xd9dd('0x1d')](_0xb47d34);}return null;};}function patchUpdates(_0x51fecf){return function(_0x4b7769){try{jsonpatch[_0xd9dd('0x23')](_0x4b7769,_0x51fecf,!![]);}catch(_0x479764){return BPromise[_0xd9dd('0x24')](_0x479764);}return _0x4b7769[_0xd9dd('0x25')]();};}function saveUpdates(_0x546ea9,_0xbfb8f7){return function(_0x1244f9){if(_0x1244f9){return _0x1244f9[_0xd9dd('0x26')](_0x546ea9)[_0xd9dd('0x27')](function(_0x5f4f3d){return _0x5f4f3d;});}return null;};}function removeEntity(_0x5d0704,_0x1dfd2a){return function(_0x3b8421){if(_0x3b8421){return _0x3b8421[_0xd9dd('0x28')]()[_0xd9dd('0x27')](function(){_0x5d0704[_0xd9dd('0x1c')](0xcc)[_0xd9dd('0x29')]();});}};}function handleEntityNotFound(_0x490a80,_0x209d1d){return function(_0x463211){if(!_0x463211){_0x490a80[_0xd9dd('0x1b')](0x194);}return _0x463211;};}function handleError(_0x2abcc5,_0xd23e9b){_0xd23e9b=_0xd23e9b||0x1f4;return function(_0x4d2480){logger[_0xd9dd('0x2a')](_0x4d2480[_0xd9dd('0x2b')]);if(_0x4d2480[_0xd9dd('0x2c')]){delete _0x4d2480[_0xd9dd('0x2c')];}_0x2abcc5[_0xd9dd('0x1c')](_0xd23e9b)[_0xd9dd('0x2d')](_0x4d2480);};}exports[_0xd9dd('0x2e')]=function(_0x1546fe,_0x5a2d09){var _0x2b6694={},_0x2ce60c={},_0x4764c6={'count':0x0,'rows':[]};var _0x46bcf7=_[_0xd9dd('0x2f')](db[_0xd9dd('0x30')][_0xd9dd('0x31')],function(_0x141b44){return{'name':_0x141b44['fieldName'],'type':_0x141b44[_0xd9dd('0x32')]['key']};});_0x2ce60c[_0xd9dd('0x33')]=_[_0xd9dd('0x2f')](_0x46bcf7,_0xd9dd('0x2c'));_0x2ce60c['query']=_[_0xd9dd('0x34')](_0x1546fe[_0xd9dd('0x35')]);_0x2ce60c[_0xd9dd('0x36')]=_['intersection'](_0x2ce60c['model'],_0x2ce60c[_0xd9dd('0x35')]);_0x2b6694[_0xd9dd('0x37')]=_[_0xd9dd('0x38')](_0x2ce60c[_0xd9dd('0x33')],qs[_0xd9dd('0x39')](_0x1546fe[_0xd9dd('0x35')][_0xd9dd('0x39')]));_0x2b6694[_0xd9dd('0x37')]=_0x2b6694[_0xd9dd('0x37')][_0xd9dd('0x3a')]?_0x2b6694[_0xd9dd('0x37')]:_0x2ce60c[_0xd9dd('0x33')];if(!_0x1546fe[_0xd9dd('0x35')][_0xd9dd('0x3b')](_0xd9dd('0x3c'))){_0x2b6694[_0xd9dd('0x20')]=qs[_0xd9dd('0x20')](_0x1546fe['query'][_0xd9dd('0x20')]);_0x2b6694['offset']=qs[_0xd9dd('0x1e')](_0x1546fe[_0xd9dd('0x35')][_0xd9dd('0x1e')]);}_0x2b6694[_0xd9dd('0x3d')]=qs[_0xd9dd('0x3e')](_0x1546fe['query'][_0xd9dd('0x3e')]);_0x2b6694[_0xd9dd('0x3f')]=qs['filters'](_[_0xd9dd('0x40')](_0x1546fe[_0xd9dd('0x35')],_0x2ce60c[_0xd9dd('0x36')]),_0x46bcf7);if(_0x1546fe[_0xd9dd('0x35')][_0xd9dd('0x41')]){_0x2b6694[_0xd9dd('0x3f')]=_[_0xd9dd('0x42')](_0x2b6694[_0xd9dd('0x3f')],{'$or':_[_0xd9dd('0x2f')](_0x46bcf7,function(_0x531a52){if(_0x531a52[_0xd9dd('0x32')]!==_0xd9dd('0x43')){var _0x3c3e9f={};_0x3c3e9f[_0x531a52['name']]={'$like':'%'+_0x1546fe[_0xd9dd('0x35')]['filter']+'%'};return _0x3c3e9f;}})});}_0x2b6694=_[_0xd9dd('0x42')]({},_0x2b6694,_0x1546fe[_0xd9dd('0x44')]);var _0x4f0424={'where':_0x2b6694['where']};return db[_0xd9dd('0x30')][_0xd9dd('0x21')](_0x4f0424)[_0xd9dd('0x27')](function(_0x4174a7){_0x4764c6['count']=_0x4174a7;if(_0x1546fe[_0xd9dd('0x35')][_0xd9dd('0x45')]){_0x2b6694['include']=[{'all':!![]}];}return db[_0xd9dd('0x30')][_0xd9dd('0x46')](_0x2b6694);})[_0xd9dd('0x27')](function(_0x59bbf1){_0x4764c6['rows']=_0x59bbf1;return _0x4764c6;})[_0xd9dd('0x27')](respondWithFilteredResult(_0x5a2d09,_0x2b6694))[_0xd9dd('0x47')](handleError(_0x5a2d09,null));};exports[_0xd9dd('0x48')]=function(_0x13be9a,_0x566af6){var _0x2b599a={'raw':!![],'where':{'id':_0x13be9a['params']['id']}},_0x45e702={};_0x45e702['model']=_[_0xd9dd('0x34')](db['FaxApplication'][_0xd9dd('0x31')]);_0x45e702[_0xd9dd('0x35')]=_[_0xd9dd('0x34')](_0x13be9a[_0xd9dd('0x35')]);_0x45e702[_0xd9dd('0x36')]=_['intersection'](_0x45e702[_0xd9dd('0x33')],_0x45e702[_0xd9dd('0x35')]);_0x2b599a[_0xd9dd('0x37')]=_[_0xd9dd('0x38')](_0x45e702[_0xd9dd('0x33')],qs[_0xd9dd('0x39')](_0x13be9a[_0xd9dd('0x35')][_0xd9dd('0x39')]));_0x2b599a[_0xd9dd('0x37')]=_0x2b599a[_0xd9dd('0x37')][_0xd9dd('0x3a')]?_0x2b599a['attributes']:_0x45e702[_0xd9dd('0x33')];if(_0x13be9a[_0xd9dd('0x35')]['includeAll']){_0x2b599a[_0xd9dd('0x49')]=[{'all':!![]}];}_0x2b599a=_[_0xd9dd('0x42')]({},_0x2b599a,_0x13be9a[_0xd9dd('0x44')]);return db['FaxApplication'][_0xd9dd('0x4a')](_0x2b599a)['then'](handleEntityNotFound(_0x566af6,null))[_0xd9dd('0x27')](respondWithResult(_0x566af6,null))['catch'](handleError(_0x566af6,null));};exports['create']=function(_0x265002,_0x847cb7){return db[_0xd9dd('0x30')][_0xd9dd('0x4b')](_0x265002[_0xd9dd('0x4c')],{})[_0xd9dd('0x27')](respondWithResult(_0x847cb7,0xc9))[_0xd9dd('0x47')](handleError(_0x847cb7,null));};exports[_0xd9dd('0x26')]=function(_0x43fd07,_0x298e8b){if(_0x43fd07[_0xd9dd('0x4c')]['id']){delete _0x43fd07[_0xd9dd('0x4c')]['id'];}return db[_0xd9dd('0x30')][_0xd9dd('0x4a')]({'where':{'id':_0x43fd07['params']['id']}})['then'](handleEntityNotFound(_0x298e8b,null))[_0xd9dd('0x27')](saveUpdates(_0x43fd07[_0xd9dd('0x4c')],null))[_0xd9dd('0x27')](respondWithResult(_0x298e8b,null))[_0xd9dd('0x47')](handleError(_0x298e8b,null));};exports[_0xd9dd('0x28')]=function(_0x29171f,_0x2db138){return db[_0xd9dd('0x30')][_0xd9dd('0x4a')]({'where':{'id':_0x29171f[_0xd9dd('0x4d')]['id']}})[_0xd9dd('0x27')](handleEntityNotFound(_0x2db138,null))[_0xd9dd('0x27')](removeEntity(_0x2db138,null))['catch'](handleError(_0x2db138,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 1aeae91..0b66890 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 _0x9919=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0xb0143c,_0x499fb0){var _0xc5e888=function(_0xfd78e8){while(--_0xfd78e8){_0xb0143c['push'](_0xb0143c['shift']());}};_0xc5e888(++_0x499fb0);}(_0x9919,0x7a));var _0x9991=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0x9919[_0x35d775];return _0x59384d;};'use strict';var _=require('lodash');var util=require(_0x9991('0x0'));var logger=require(_0x9991('0x1'))(_0x9991('0x2'));var moment=require(_0x9991('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9991('0x4'));var rimraf=require(_0x9991('0x5'));var config=require(_0x9991('0x6'));var attributes=require(_0x9991('0x7'));module[_0x9991('0x8')]=function(_0x5e42a4,_0x4bb68a){return _0x5e42a4[_0x9991('0x9')](_0x9991('0xa'),attributes,{'tableName':_0x9991('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9991('0xc'),'collate':_0x9991('0xd')});}; \ No newline at end of file +var _0xbea8=['bluebird','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','lodash','util','moment'];(function(_0x3d8f5a,_0x11026d){var _0xee63cb=function(_0x139334){while(--_0x139334){_0x3d8f5a['push'](_0x3d8f5a['shift']());}};_0xee63cb(++_0x11026d);}(_0xbea8,0x1b5));var _0x8bea=function(_0x390752,_0x42cad3){_0x390752=_0x390752-0x0;var _0x5eca55=_0xbea8[_0x390752];return _0x5eca55;};'use strict';var _=require(_0x8bea('0x0'));var util=require(_0x8bea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8bea('0x2'));var BPromise=require(_0x8bea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8bea('0x4'));var attributes=require(_0x8bea('0x5'));module[_0x8bea('0x6')]=function(_0x52f282,_0x5f0c25){return _0x52f282['define'](_0x8bea('0x7'),attributes,{'tableName':_0x8bea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8bea('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 94ab007..dff59c9 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 _0xe93b=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','FaxApplication','update','body','options','raw','where','limit','UpdateFaxApplication','lodash'];(function(_0x46eb81,_0x5e7ae4){var _0x827434=function(_0x1b7496){while(--_0x1b7496){_0x46eb81['push'](_0x46eb81['shift']());}};_0x827434(++_0x5e7ae4);}(_0xe93b,0xb9));var _0xbe93=function(_0xeacb07,_0x47f22f){_0xeacb07=_0xeacb07-0x0;var _0x1c6ae3=_0xe93b[_0xeacb07];return _0x1c6ae3;};'use strict';var _=require(_0xbe93('0x0'));var util=require(_0xbe93('0x1'));var moment=require(_0xbe93('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe93('0x3'));var fs=require('fs');var Redis=require(_0xbe93('0x4'));var db=require(_0xbe93('0x5'))['db'];var utils=require(_0xbe93('0x6'));var logger=require('../../config/logger')(_0xbe93('0x7'));var config=require(_0xbe93('0x8'));var jayson=require(_0xbe93('0x9'));var client=jayson[_0xbe93('0xa')][_0xbe93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59b8b1,_0xe59fb3,_0x2c4f9f){return new BPromise(function(_0x555897,_0x549c4d){return client['request'](_0x59b8b1,_0x2c4f9f)[_0xbe93('0xc')](function(_0x26e55f){logger['info'](_0xbe93('0xd'),_0xe59fb3,_0xbe93('0xe'));logger[_0xbe93('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xe59fb3,'request\x20sent',JSON[_0xbe93('0x10')](_0x26e55f));if(_0x26e55f[_0xbe93('0x11')]){if(_0x26e55f[_0xbe93('0x11')][_0xbe93('0x12')]===0x1f4){logger[_0xbe93('0x11')](_0xbe93('0xd'),_0xe59fb3,_0x26e55f[_0xbe93('0x11')]['message']);return _0x549c4d(_0x26e55f['error'][_0xbe93('0x13')]);}logger['error'](_0xbe93('0xd'),_0xe59fb3,_0x26e55f[_0xbe93('0x11')][_0xbe93('0x13')]);return _0x555897(_0x26e55f[_0xbe93('0x11')]['message']);}else{logger[_0xbe93('0x14')](_0xbe93('0xd'),_0xe59fb3,'request\x20sent');_0x555897(_0x26e55f[_0xbe93('0x15')][_0xbe93('0x13')]);}})[_0xbe93('0x16')](function(_0x55ab22){logger[_0xbe93('0x11')](_0xbe93('0xd'),_0xe59fb3,_0x55ab22);_0x549c4d(_0x55ab22);});});}exports['UpdateFaxApplication']=function(_0x3aaf34){var _0xa1b310=this;return new Promise(function(_0x35960e,_0x430d00){return db[_0xbe93('0x17')][_0xbe93('0x18')](_0x3aaf34[_0xbe93('0x19')],{'raw':_0x3aaf34[_0xbe93('0x1a')]?_0x3aaf34[_0xbe93('0x1a')][_0xbe93('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aaf34[_0xbe93('0x1a')]?_0x3aaf34[_0xbe93('0x1a')][_0xbe93('0x1c')]||null:null,'attributes':_0x3aaf34[_0xbe93('0x1a')]?_0x3aaf34['options']['attributes']||null:null,'limit':_0x3aaf34['options']?_0x3aaf34[_0xbe93('0x1a')][_0xbe93('0x1d')]||null:null})['then'](function(_0x31844c){logger['info'](_0xbe93('0x1e'),_0x3aaf34);logger[_0xbe93('0xf')]('UpdateFaxApplication',_0x3aaf34,JSON[_0xbe93('0x10')](_0x31844c));_0x35960e(_0x31844c);})[_0xbe93('0x16')](function(_0x287265){logger[_0xbe93('0x11')](_0xbe93('0x1e'),_0x287265[_0xbe93('0x13')],_0x3aaf34);_0x430d00(_0xa1b310[_0xbe93('0x11')](0x1f4,_0x287265[_0xbe93('0x13')]));});});}; \ No newline at end of file +var _0xf5f1=['update','body','options','raw','where','attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication'];(function(_0x4c7b5c,_0x2a01f9){var _0x33c7c5=function(_0x57191b){while(--_0x57191b){_0x4c7b5c['push'](_0x4c7b5c['shift']());}};_0x33c7c5(++_0x2a01f9);}(_0xf5f1,0x1c8));var _0x1f5f=function(_0x5c08a1,_0x502fff){_0x5c08a1=_0x5c08a1-0x0;var _0x7c8277=_0xf5f1[_0x5c08a1];return _0x7c8277;};'use strict';var _=require('lodash');var util=require(_0x1f5f('0x0'));var moment=require(_0x1f5f('0x1'));var BPromise=require(_0x1f5f('0x2'));var rs=require(_0x1f5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f5f('0x4'))['db'];var utils=require(_0x1f5f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1f5f('0x6'));var jayson=require(_0x1f5f('0x7'));var client=jayson[_0x1f5f('0x8')][_0x1f5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8ff339,_0x5db92e,_0x13c9a6){return new BPromise(function(_0x4e38a0,_0x3bf52c){return client[_0x1f5f('0xa')](_0x8ff339,_0x13c9a6)[_0x1f5f('0xb')](function(_0x1c5e3b){logger[_0x1f5f('0xc')](_0x1f5f('0xd'),_0x5db92e,_0x1f5f('0xe'));logger['debug'](_0x1f5f('0xf'),_0x5db92e,'request\x20sent',JSON[_0x1f5f('0x10')](_0x1c5e3b));if(_0x1c5e3b['error']){if(_0x1c5e3b[_0x1f5f('0x11')][_0x1f5f('0x12')]===0x1f4){logger[_0x1f5f('0x11')](_0x1f5f('0xd'),_0x5db92e,_0x1c5e3b[_0x1f5f('0x11')][_0x1f5f('0x13')]);return _0x3bf52c(_0x1c5e3b['error'][_0x1f5f('0x13')]);}logger[_0x1f5f('0x11')](_0x1f5f('0xd'),_0x5db92e,_0x1c5e3b[_0x1f5f('0x11')][_0x1f5f('0x13')]);return _0x4e38a0(_0x1c5e3b['error'][_0x1f5f('0x13')]);}else{logger[_0x1f5f('0xc')](_0x1f5f('0xd'),_0x5db92e,'request\x20sent');_0x4e38a0(_0x1c5e3b[_0x1f5f('0x14')][_0x1f5f('0x13')]);}})[_0x1f5f('0x15')](function(_0x246823){logger['error'](_0x1f5f('0xd'),_0x5db92e,_0x246823);_0x3bf52c(_0x246823);});});}exports[_0x1f5f('0x16')]=function(_0x2719c0){var _0x1c561a=this;return new Promise(function(_0x33fde4,_0xda6833){return db[_0x1f5f('0x17')][_0x1f5f('0x18')](_0x2719c0[_0x1f5f('0x19')],{'raw':_0x2719c0[_0x1f5f('0x1a')]?_0x2719c0[_0x1f5f('0x1a')][_0x1f5f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2719c0[_0x1f5f('0x1a')]?_0x2719c0[_0x1f5f('0x1a')][_0x1f5f('0x1c')]||null:null,'attributes':_0x2719c0['options']?_0x2719c0[_0x1f5f('0x1a')][_0x1f5f('0x1d')]||null:null,'limit':_0x2719c0[_0x1f5f('0x1a')]?_0x2719c0[_0x1f5f('0x1a')]['limit']||null:null})[_0x1f5f('0xb')](function(_0x4aa903){logger['info']('UpdateFaxApplication',_0x2719c0);logger['debug']('UpdateFaxApplication',_0x2719c0,JSON[_0x1f5f('0x10')](_0x4aa903));_0x33fde4(_0x4aa903);})[_0x1f5f('0x15')](function(_0xa880b2){logger[_0x1f5f('0x11')](_0x1f5f('0x16'),_0xa880b2[_0x1f5f('0x13')],_0x2719c0);_0xda6833(_0x1c561a[_0x1f5f('0x11')](0x1f4,_0xa880b2[_0x1f5f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b030bf9..8daa4ce 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x2be1f9,_0x546bf8){var _0x310fa4=function(_0x1e99d9){while(--_0x1e99d9){_0x2be1f9['push'](_0x2be1f9['shift']());}};_0x310fa4(++_0x546bf8);}(_0xda3f,0xec));var _0xfda3=function(_0x410e96,_0x3c660c){_0x410e96=_0x410e96-0x0;var _0x158a11=_0xda3f[_0x410e96];return _0x158a11;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./faxApplication.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _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(_0x20bedd,_0x3abbd5){var _0x3f5b8e=function(_0xa890d3){while(--_0xa890d3){_0x20bedd['push'](_0x20bedd['shift']());}};_0x3f5b8e(++_0x3abbd5);}(_0xed3c,0x1a6));var _0xced3=function(_0x50b295,_0x420eaf){_0x50b295=_0x50b295-0x0;var _0x230324=_0xed3c[_0x50b295];return _0x230324;};'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 69e35f4..a9b5577 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 _0xa647=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x182eab,_0x1cb6d2){var _0x75f653=function(_0x42db78){while(--_0x42db78){_0x182eab['push'](_0x182eab['shift']());}};_0x75f653(++_0x1cb6d2);}(_0xa647,0x11a));var _0x7a64=function(_0x228459,_0x45bfde){_0x228459=_0x228459-0x0;var _0x445d6c=_0xa647[_0x228459];return _0x445d6c;};'use strict';var Sequelize=require(_0x7a64('0x0'));module[_0x7a64('0x1')]={'closed':{'type':Sequelize[_0x7a64('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7a64('0x3')]},'disposition':{'type':Sequelize[_0x7a64('0x4')]},'secondDisposition':{'type':Sequelize[_0x7a64('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7a64('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7a64('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x7a64('0x5')]('in',_0x7a64('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7a64('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x9676=['DATE','ENUM','out','BOOLEAN','STRING'];(function(_0x4ca536,_0x57c8de){var _0x3bd35f=function(_0x26d91d){while(--_0x26d91d){_0x4ca536['push'](_0x4ca536['shift']());}};_0x3bd35f(++_0x57c8de);}(_0x9676,0x1ca));var _0x6967=function(_0x8e7958,_0x579780){_0x8e7958=_0x8e7958-0x0;var _0x34299c=_0x9676[_0x8e7958];return _0x34299c;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x6967('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6967('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6967('0x1')]},'note':{'type':Sequelize[_0x6967('0x1')]},'read1stAt':{'type':Sequelize[_0x6967('0x2')]},'fax':{'type':Sequelize[_0x6967('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x6967('0x3')]('in',_0x6967('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6967('0x3')]('in',_0x6967('0x4')),'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 73ac73b..436676b 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 _0x44cf=['o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','rawAttributes','includeAll','include','options','create','params','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','nolimit','format','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','server','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','join','existsSync','pipe','createWriteStream','basename','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','offset','undefined','limit','count','status','json','apply','reject','save','then','destroy','stack','name','send','Users','fullname','TagIds','split','forEach','Tags','push','catch','map','FaxInteraction','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','field','color','from','select','u.fullname','user_has_fax_interactions','left_join','users','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','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','UserId','buildExpression','body','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`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','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.fax'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x44cf,0x1da));var _0xf44c=function(_0x3d584c,_0x31094d){_0x3d584c=_0x3d584c-0x0;var _0x91a827=_0x44cf[_0x3d584c];return _0x91a827;};'use strict';var emlformat=require(_0xf44c('0x0'));var rimraf=require(_0xf44c('0x1'));var zipdir=require(_0xf44c('0x2'));var jsonpatch=require(_0xf44c('0x3'));var rp=require(_0xf44c('0x4'));var moment=require(_0xf44c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf44c('0x6'));var util=require(_0xf44c('0x7'));var path=require('path');var sox=require(_0xf44c('0x8'));var csv=require(_0xf44c('0x9'));var ejs=require(_0xf44c('0xa'));var fs=require('fs');var fs_extra=require(_0xf44c('0xb'));var _=require(_0xf44c('0xc'));var squel=require('squel');var crypto=require(_0xf44c('0xd'));var jsforce=require(_0xf44c('0xe'));var deskjs=require(_0xf44c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf44c('0x10'));var Papa=require(_0xf44c('0x11'));var Redis=require(_0xf44c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf44c('0x13'));var as=require(_0xf44c('0x14'));var hardwareService=require(_0xf44c('0x15'));var logger=require(_0xf44c('0x16'))('api');var utils=require(_0xf44c('0x17'));var config=require(_0xf44c('0x18'));var licenseUtil=require(_0xf44c('0x19'));var db=require(_0xf44c('0x1a'))['db'];config[_0xf44c('0x1b')]=_[_0xf44c('0x1c')](config[_0xf44c('0x1b')],{'host':_0xf44c('0x1d'),'port':0x18eb});var socket=require(_0xf44c('0x1e'))(new Redis(config[_0xf44c('0x1b')]));require(_0xf44c('0x1f'))[_0xf44c('0x20')](socket);function respondWithStatusCode(_0x587508,_0x2bd281){_0x2bd281=_0x2bd281||0xcc;return function(_0xdaef0f){if(_0xdaef0f){return _0x587508[_0xf44c('0x21')](_0x2bd281);}return _0x587508['status'](_0x2bd281)[_0xf44c('0x22')]();};}function respondWithResult(_0x4cdbb5,_0x2b2eb7){_0x2b2eb7=_0x2b2eb7||0xc8;return function(_0x7a4b8c){if(_0x7a4b8c){return _0x4cdbb5['status'](_0x2b2eb7)['json'](_0x7a4b8c);}};}function respondWithFilteredResult(_0x1dfdad,_0x3c21f2){return function(_0x46dcd6){if(_0x46dcd6){var _0x264aa0=typeof _0x3c21f2[_0xf44c('0x23')]===_0xf44c('0x24')&&typeof _0x3c21f2[_0xf44c('0x25')]==='undefined';var _0x1f632c=_0x46dcd6[_0xf44c('0x26')];var _0x1f3ea4=_0x264aa0?0x0:_0x3c21f2[_0xf44c('0x23')];var _0x595643=_0x264aa0?_0x46dcd6[_0xf44c('0x26')]:_0x3c21f2[_0xf44c('0x23')]+_0x3c21f2[_0xf44c('0x25')];var _0x2b74af;if(_0x595643>=_0x1f632c){_0x595643=_0x1f632c;_0x2b74af=0xc8;}else{_0x2b74af=0xce;}_0x1dfdad[_0xf44c('0x27')](_0x2b74af);return _0x1dfdad['set']('Content-Range',_0x1f3ea4+'-'+_0x595643+'/'+_0x1f632c)[_0xf44c('0x28')](_0x46dcd6);}return null;};}function patchUpdates(_0x32d28f){return function(_0x50d23f){try{jsonpatch[_0xf44c('0x29')](_0x50d23f,_0x32d28f,!![]);}catch(_0x54147e){return BPromise[_0xf44c('0x2a')](_0x54147e);}return _0x50d23f[_0xf44c('0x2b')]();};}function saveUpdates(_0x474d04,_0x51153d){return function(_0x3be7eb){if(_0x3be7eb){return _0x3be7eb['update'](_0x474d04)[_0xf44c('0x2c')](function(_0x4ed387){return _0x4ed387;});}return null;};}function removeEntity(_0x49bc62,_0x4bc3bc){return function(_0x2cc350){if(_0x2cc350){return _0x2cc350[_0xf44c('0x2d')]()[_0xf44c('0x2c')](function(){_0x49bc62[_0xf44c('0x27')](0xcc)[_0xf44c('0x22')]();});}};}function handleEntityNotFound(_0x3aed5f,_0x1b2987){return function(_0x1ff3a7){if(!_0x1ff3a7){_0x3aed5f['sendStatus'](0x194);}return _0x1ff3a7;};}function handleError(_0x336a6b,_0x383bb6){_0x383bb6=_0x383bb6||0x1f4;return function(_0x230cc5){logger['error'](_0x230cc5[_0xf44c('0x2e')]);if(_0x230cc5['name']){delete _0x230cc5[_0xf44c('0x2f')];}_0x336a6b[_0xf44c('0x27')](_0x383bb6)[_0xf44c('0x30')](_0x230cc5);};}function getInteractionUsers(_0x4629a1,_0x279f88){return new BPromise(function(_0x359ae0,_0x3a5cfb){try{if(_0x279f88[_0x4629a1['id']]){_0x4629a1[_0xf44c('0x31')]=_['map'](_0x279f88[_0x4629a1['id']],function(_0x20b3e5){return{'id':_0x20b3e5['id'],'fullname':_0x20b3e5[_0xf44c('0x32')]};});}}catch(_0x39e284){_0x3a5cfb(_0x39e284);}_0x359ae0(_0x4629a1);});}function getInteractionTags(_0x4ba0a2,_0x1ec091){return new BPromise(function(_0x6854d4,_0x23a589){try{if(_0x4ba0a2['TagIds']){_0x4ba0a2['Tags']=[];_0x4ba0a2[_0xf44c('0x33')][_0xf44c('0x34')](',')[_0xf44c('0x35')](function(_0x4aff58){_0x4ba0a2[_0xf44c('0x36')][_0xf44c('0x37')](_0x1ec091[_0x4aff58]);});}delete _0x4ba0a2[_0xf44c('0x33')];}catch(_0x3e4085){_0x23a589(_0x3e4085);}_0x6854d4(_0x4ba0a2);});}function updateFaxInteraction(_0x3f510c,_0x15f643,_0x169719){return new BPromise(function(_0x36c1b8,_0x3d5238){return getInteractionUsers(_0x3f510c,_0x169719)[_0xf44c('0x2c')](function(_0x31b7f0){return getInteractionTags(_0x31b7f0,_0x15f643);})[_0xf44c('0x2c')](function(_0x5ae6f2){_0x36c1b8(_0x5ae6f2);})[_0xf44c('0x38')](function(_0x5d20a7){_0x3d5238(_0x5d20a7);});});}exports['index']=function(_0xb8b318,_0x5dcc47){var _0x286e07={},_0x2816a7={},_0x1c390e={'count':0x0,'rows':[]};var _0x5da512=_[_0xf44c('0x39')](db[_0xf44c('0x3a')]['rawAttributes'],function(_0x4c9498){return{'name':_0x4c9498[_0xf44c('0x3b')],'type':_0x4c9498[_0xf44c('0x3c')][_0xf44c('0x3d')]};});_0x2816a7[_0xf44c('0x3e')]=_[_0xf44c('0x39')](_0x5da512,_0xf44c('0x2f'));_0x2816a7[_0xf44c('0x3f')]=_[_0xf44c('0x40')](_0xb8b318['query']);_0x2816a7['filters']=_[_0xf44c('0x41')](_0x2816a7[_0xf44c('0x3e')],_0x2816a7['query']);_0x286e07['attributes']=_[_0xf44c('0x41')](_0x2816a7[_0xf44c('0x3e')],qs['fields'](_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x42')]));_0x286e07[_0xf44c('0x43')]=_0x286e07[_0xf44c('0x43')][_0xf44c('0x44')]?_0x286e07['attributes']:_0x2816a7['model'];if(!_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x45')]('nolimit')){_0x286e07['limit']=qs['limit'](_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x25')]);_0x286e07[_0xf44c('0x23')]=qs[_0xf44c('0x23')](_0xb8b318['query'][_0xf44c('0x23')]);}_0x286e07['order']=qs[_0xf44c('0x46')](_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x46')]);_0x286e07[_0xf44c('0x47')]=qs[_0xf44c('0x48')](_[_0xf44c('0x49')](_0xb8b318[_0xf44c('0x3f')],_0x2816a7[_0xf44c('0x48')]),_0x5da512);var _0x1d3448=[];var _0xd71e3f=squel['select']()[_0xf44c('0x4a')]('id')[_0xf44c('0x4a')](_0xf44c('0x2f'))[_0xf44c('0x4a')](_0xf44c('0x4b'))[_0xf44c('0x4c')]('tools_tags');var _0x16cafc=squel[_0xf44c('0x4d')]()[_0xf44c('0x4a')]('u.id')['field'](_0xf44c('0x4e'))[_0xf44c('0x4a')]('ui.FaxInteractionId')[_0xf44c('0x4c')](_0xf44c('0x4f'),'ui')[_0xf44c('0x50')](_0xf44c('0x51'),'u',_0xf44c('0x52'));var _0x1fce52=squel['select']()[_0xf44c('0x4c')](_0xf44c('0x53'),'i')['left_join'](_0xf44c('0x54'),'c',_0xf44c('0x55'))[_0xf44c('0x50')](_0xf44c('0x51'),'o',_0xf44c('0x56'))[_0xf44c('0x50')](_0xf44c('0x57'),'a',_0xf44c('0x58'))[_0xf44c('0x50')](_0xf44c('0x59'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xf44c('0x50')](_0xf44c('0x5a'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xf44c('0x50')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x285266=squel['expr']();var _0x3df9c3=[];var _0x5622a5=squel['expr']();var _0x40b42b;if(_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x5b')]){_0x40b42b=as[_0xf44c('0x5c')](_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x5b')]);var _0x4392fc=_0x40b42b['sqlOperator'];for(var _0x1b6f60=0x0;_0x1b6f60<_0x40b42b[_0xf44c('0x5d')][_0xf44c('0x44')];_0x1b6f60++){var _0x1546d8=_0x40b42b['conditions'][_0x1b6f60];var _0x7f890f='i';var _0x1fea20=_['find'](_0x5da512,['name',_0x1546d8[_0xf44c('0x4a')]]);if(!_0x1fea20){switch(_0x1546d8[_0xf44c('0x4a')]){case _0xf44c('0x5e'):if(_0x1546d8[_0xf44c('0x5f')]==0x1){_0x1fce52[_0xf44c('0x60')]('`'+_0x1546d8[_0xf44c('0x4a')]+_0xf44c('0x61'));}else{_0x1fce52[_0xf44c('0x60')]('`'+_0x1546d8['field']+_0xf44c('0x62'));}break;case _0xf44c('0x63'):if(_0x1546d8[_0xf44c('0x64')]==='$substring'){if(_0x1546d8[_0xf44c('0x5f')][_0xf44c('0x34')]('\x20')[_0xf44c('0x44')]>0x1){_0x285266[_0x4392fc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf44c('0x65')](_0x1546d8[_0xf44c('0x5f')]),null);}else{var _0x56c4b8='%'+_0x1546d8[_0xf44c('0x5f')]+'%';_0x285266[_0x4392fc](_0xf44c('0x66'),_0x56c4b8,_0x56c4b8,_0x56c4b8);}}else{_0x1fea20=_[_0xf44c('0x67')](_0x5da512,[_0xf44c('0x2f'),_0xf44c('0x68')]);_0x1546d8['field']=_0xf44c('0x68');_0x54ff84=as['buildExpression'](_0x7f890f,_0x1fea20[_0xf44c('0x3c')],_0x1546d8);_0x285266[_0x4392fc](_0x54ff84[_0xf44c('0x69')],_0x54ff84[_0xf44c('0x5f')][_0xf44c('0x6a')],_0x54ff84[_0xf44c('0x5f')][_0xf44c('0x22')]);}break;case _0xf44c('0x6b'):var _0x3c7ac3=_0x1546d8[_0xf44c('0x5f')][_0xf44c('0x34')](',')['map'](function(_0x461b2d){return Number(_0x461b2d);});_0x3c7ac3['forEach'](function(_0x57f91e){_0x5622a5['or'](_0xf44c('0x6c'),'%,'+_0x57f91e+',%');});_0x3df9c3=_[_0xf44c('0x6d')](_0x3df9c3,_0x3c7ac3);break;case'User':if(_0x1546d8['operator']===_0xf44c('0x6e')){_0x285266[_0x4392fc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1546d8[_0xf44c('0x5f')]+'%',null);}else{_0x1fea20=_[_0xf44c('0x67')](_0x5da512,['name',_0xf44c('0x6f')]);_0x1546d8['field']=_0xf44c('0x6f');_0x54ff84=as[_0xf44c('0x70')](_0x7f890f,_0x1fea20[_0xf44c('0x3c')],_0x1546d8);_0x285266[_0x4392fc](_0x54ff84[_0xf44c('0x69')],_0x54ff84[_0xf44c('0x5f')][_0xf44c('0x6a')],_0x54ff84[_0xf44c('0x5f')][_0xf44c('0x22')]);}break;case _0xf44c('0x71'):_0x54ff84=as[_0xf44c('0x70')]('me',null,_0x1546d8);_0x285266[_0x4392fc](_0x54ff84[_0xf44c('0x69')],_0x54ff84[_0xf44c('0x5f')][_0xf44c('0x6a')],_0x54ff84[_0xf44c('0x5f')][_0xf44c('0x22')]);break;}}else{var _0x54ff84=as[_0xf44c('0x70')](_0x7f890f,_0x1fea20[_0xf44c('0x3c')],_0x1546d8);_0x285266[_0x4392fc](_0x54ff84[_0xf44c('0x69')],_0x54ff84[_0xf44c('0x5f')][_0xf44c('0x6a')],_0x54ff84[_0xf44c('0x5f')][_0xf44c('0x22')]);}}}else{var _0x1163bb=_(_0xb8b318[_0xf44c('0x3f')])[_0xf44c('0x40')]()[_0xf44c('0x39')](function(_0x13a09c){return _[_0xf44c('0x72')](_0x5da512,[_0xf44c('0x2f'),_0x13a09c])?_0x13a09c:undefined;})[_0xf44c('0x73')]()[_0xf44c('0x5f')]();if(!_['isEmpty'](_0x1163bb)){_0x1163bb[_0xf44c('0x35')](function(_0x12a29a){if(_0x12a29a===_0xf44c('0x74')){_0x1fce52[_0xf44c('0x47')](_0xf44c('0x75'),[][_0xf44c('0x76')](_0xb8b318['query'][_0x12a29a]));}else if(_0x12a29a===_0xf44c('0x77')){var _0x1b5e5d=JSON[_0xf44c('0x78')](_0xb8b318[_0xf44c('0x3f')][_0x12a29a])[_0xf44c('0x79')];var _0x4e00b3=JSON['parse'](_0xb8b318[_0xf44c('0x3f')][_0x12a29a])['$lte'];_0x1fce52[_0xf44c('0x47')](_0xf44c('0x7a'),_0x1b5e5d,_0x4e00b3);}else{if(_0xb8b318[_0xf44c('0x3f')][_0x12a29a]===_0xf44c('0x7b')){_0x1fce52[_0xf44c('0x47')]('i.'+_0x12a29a+'\x20IS\x20NULL');}else{_0x1fce52[_0xf44c('0x47')]('i.'+_0x12a29a+_0xf44c('0x7c'),_0xb8b318[_0xf44c('0x3f')][_0x12a29a]);}}});}if(_0xb8b318['query'][_0xf44c('0x7d')]){if(_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x7d')]==0x1){_0x1fce52['having'](_0xf44c('0x7e'));}else{_0x1fce52[_0xf44c('0x60')](_0xf44c('0x7f'));}}if(_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x80')]){_0x3df9c3=_[_0xf44c('0x81')](_0xb8b318['query']['tag'])?_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x80')]:new Array(_0xb8b318[_0xf44c('0x3f')]['tag']);_0x3df9c3[_0xf44c('0x35')](function(_0x139482){_0x5622a5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x139482+',%');});}if(_0xb8b318['query'][_0xf44c('0x82')]){var _0x1c656a=_0xb8b318[_0xf44c('0x3f')][_0xf44c('0x82')][_0xf44c('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf44c('0x84')](_0x1c656a)){_0x285266['or'](_0xf44c('0x85'),_0x1c656a+'%')['or']('i.fax\x20LIKE\x20?',_0x1c656a+'%');}_0x285266['or'](_0xf44c('0x86'),_0x1c656a+'%');}}_0x1fce52[_0xf44c('0x47')](_0x285266);_0x1fce52['group'](_0xf44c('0x87'));var _0x431271={'type':db['Sequelize'][_0xf44c('0x88')]['SELECT'],'raw':!![]};var _0x379579=_0x1fce52[_0xf44c('0x89')]();_0x379579[_0xf44c('0x4a')](_0xf44c('0x87'));_0x379579[_0xf44c('0x4a')](_0xf44c('0x8a'),'unreadMessages');if(_0x286e07[_0xf44c('0x8b')]){_0x286e07[_0xf44c('0x8b')]['forEach'](function(_0x3d8025){var _0x90cad8=_0x3d8025[0x0]===_0xf44c('0x8c')?_0x3d8025[0x0]:'i.'+_0x3d8025[0x0];_0x1fce52[_0xf44c('0x8b')](_0x90cad8,_0x3d8025[0x1]===_0xf44c('0x8d')?![]:!![]);});}if(!_[_0xf44c('0x8e')](_0x3df9c3)){_0x1fce52[_0xf44c('0x60')](_0x5622a5);_0x379579['where'](_0xf44c('0x8f'),_0x3df9c3);}BPromise[_0xf44c('0x90')]()[_0xf44c('0x2c')](function(){if(!_0x40b42b){if(_0xb8b318[_0xf44c('0x3f')]['FaxAccountId'])return;_0x379579[_0xf44c('0x47')](_0xf44c('0x91'));_0x1fce52[_0xf44c('0x47')](_0xf44c('0x91'));return;}if(_0xb8b318['user'][_0xf44c('0x92')]!=='agent')return;return _0xb8b318[_0xf44c('0x93')][_0xf44c('0x94')]({'attributes':['id'],'raw':!![]})[_0xf44c('0x2c')](function(_0x48ca76){if(_[_0xf44c('0x8e')](_0x48ca76)){_0x379579[_0xf44c('0x47')](_0xf44c('0x95'));_0x1fce52[_0xf44c('0x47')](_0xf44c('0x95'));}else{_0x379579[_0xf44c('0x47')](_0xf44c('0x75'),_[_0xf44c('0x39')](_0x48ca76,'id'));_0x1fce52[_0xf44c('0x47')](_0xf44c('0x75'),_[_0xf44c('0x39')](_0x48ca76,'id'));}});})[_0xf44c('0x2c')](function(){if(_0xb8b318[_0xf44c('0x93')][_0xf44c('0x92')]===_0xf44c('0x96')&&!_0x40b42b&&!_0xb8b318[_0xf44c('0x3f')]['FaxAccountId'])return[];return db[_0xf44c('0x97')][_0xf44c('0x3f')](_0x379579[_0xf44c('0x98')](),_0x431271);})[_0xf44c('0x2c')](function(_0x550c86){_0x1c390e[_0xf44c('0x26')]=_0x550c86[_0xf44c('0x44')];if(_0x1c390e['count']===0x0)return[];return db[_0xf44c('0x97')]['query'](_0xd71e3f[_0xf44c('0x98')](),_0x431271)['then'](function(_0x26e77a){_0x1d3448=_[_0xf44c('0x99')](_0x26e77a,'id');_0x431271=_[_0xf44c('0x9a')](_0x431271,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb8b318['query'][_0xf44c('0x42')]){_0x286e07[_0xf44c('0x43')][_0xf44c('0x35')](function(_0x221e7e){_0x1fce52['field']('i.'+_0x221e7e);});}else{_0x1fce52[_0xf44c('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf44c('0x5e'));_0x1fce52[_0xf44c('0x4a')]('a.key','Account.key');_0x1fce52[_0xf44c('0x4a')](_0xf44c('0x9b'),'Account.mandatoryDisposition');_0x1fce52[_0xf44c('0x4a')](_0xf44c('0x9c'),_0xf44c('0x8c'));_0x1fce52['field'](_0xf44c('0x9d'));_0x1fce52[_0xf44c('0x4a')]('c.firstName',_0xf44c('0x9e'));_0x1fce52[_0xf44c('0x4a')](_0xf44c('0x9f'),_0xf44c('0xa0'));_0x1fce52[_0xf44c('0x4a')](_0xf44c('0xa1'),_0xf44c('0xa2'));_0x1fce52[_0xf44c('0x4a')](_0xf44c('0xa3'),'Contact.phone');_0x1fce52[_0xf44c('0x4a')]('c.mobile','Contact.mobile');_0x1fce52['field']('c.fax',_0xf44c('0xa4'));_0x1fce52[_0xf44c('0x4a')](_0xf44c('0xa5'),'Owner.fullname');_0x1fce52['field'](_0xf44c('0xa6'),'Owner.internal');_0x1fce52[_0xf44c('0x4a')](_0xf44c('0xa7'),_0xf44c('0x33'));}if(_0x286e07[_0xf44c('0x25')])_0x1fce52[_0xf44c('0x25')](_0x286e07[_0xf44c('0x25')]);if(_0x286e07['offset'])_0x1fce52[_0xf44c('0x23')](_0x286e07['offset']);return db['sequelize'][_0xf44c('0x3f')](_0x1fce52['toString'](),_0x431271);})[_0xf44c('0x2c')](function(_0x3ffaf5){if(_0x3ffaf5[_0xf44c('0x44')]>0x0)_0x16cafc['where'](_0xf44c('0xa8'),_[_0xf44c('0x39')](_0x3ffaf5,'id'));return db[_0xf44c('0x97')][_0xf44c('0x3f')](_0x16cafc[_0xf44c('0x98')](),_0x431271)[_0xf44c('0x2c')](function(_0x2858d5){var _0x47fb23=_[_0xf44c('0xa9')](_0x2858d5,_0xf44c('0xaa'));var _0x219166=[];_0x3ffaf5[_0xf44c('0x35')](function(_0x8796f){_0x219166[_0xf44c('0x37')](updateFaxInteraction(_0x8796f,_0x1d3448,_0x47fb23));});return BPromise[_0xf44c('0xab')](_0x219166);});});})[_0xf44c('0x2c')](function(_0x310e2e){_0x1c390e[_0xf44c('0xac')]=_0x310e2e;return _0x1c390e;})[_0xf44c('0x2c')](respondWithFilteredResult(_0x5dcc47,_0x286e07))['catch'](handleError(_0x5dcc47,null));};exports[_0xf44c('0xad')]=function(_0x25606e,_0x38901f){var _0x294041={'raw':![],'where':{'id':_0x25606e['params']['id']}},_0x13d7e3={};_0x13d7e3['model']=_[_0xf44c('0x40')](db[_0xf44c('0x3a')][_0xf44c('0xae')]);_0x13d7e3[_0xf44c('0x3f')]=_[_0xf44c('0x40')](_0x25606e['query']);_0x13d7e3[_0xf44c('0x48')]=_[_0xf44c('0x41')](_0x13d7e3['model'],_0x13d7e3['query']);_0x294041[_0xf44c('0x43')]=_['intersection'](_0x13d7e3[_0xf44c('0x3e')],qs[_0xf44c('0x42')](_0x25606e['query'][_0xf44c('0x42')]));_0x294041['attributes']=_0x294041[_0xf44c('0x43')][_0xf44c('0x44')]?_0x294041[_0xf44c('0x43')]:_0x13d7e3['model'];if(_0x25606e[_0xf44c('0x3f')][_0xf44c('0xaf')]){_0x294041[_0xf44c('0xb0')]=[{'all':!![]}];}_0x294041=_[_0xf44c('0x9a')]({},_0x294041,_0x25606e[_0xf44c('0xb1')]);return db[_0xf44c('0x3a')]['find'](_0x294041)[_0xf44c('0x2c')](handleEntityNotFound(_0x38901f,null))[_0xf44c('0x2c')](respondWithResult(_0x38901f,null))[_0xf44c('0x38')](handleError(_0x38901f,null));};exports[_0xf44c('0xb2')]=function(_0x7a3db0,_0x1a63ed){return db[_0xf44c('0x3a')]['create'](_0x7a3db0[_0xf44c('0x71')],{})['then'](respondWithResult(_0x1a63ed,0xc9))[_0xf44c('0x38')](handleError(_0x1a63ed,null));};exports['update']=function(_0x408393,_0x1be209){if(_0x408393[_0xf44c('0x71')]['id']){delete _0x408393['body']['id'];}return db[_0xf44c('0x3a')][_0xf44c('0x67')]({'where':{'id':_0x408393[_0xf44c('0xb3')]['id']}})[_0xf44c('0x2c')](handleEntityNotFound(_0x1be209,null))[_0xf44c('0x2c')](saveUpdates(_0x408393[_0xf44c('0x71')],null))[_0xf44c('0x2c')](respondWithResult(_0x1be209,null))[_0xf44c('0x38')](handleError(_0x1be209,null));};exports[_0xf44c('0x2d')]=function(_0x26a66b,_0x5ec7fc){return db[_0xf44c('0x3a')][_0xf44c('0x67')]({'where':{'id':_0x26a66b['params']['id']}})[_0xf44c('0x2c')](handleEntityNotFound(_0x5ec7fc,null))['then'](removeEntity(_0x5ec7fc,null))['catch'](handleError(_0x5ec7fc,null));};exports[_0xf44c('0xb4')]=function(_0x696347,_0x53d87d){return db[_0xf44c('0x3a')][_0xf44c('0xb4')]()[_0xf44c('0x2c')](respondWithResult(_0x53d87d,null))['catch'](handleError(_0x53d87d,null));};exports[_0xf44c('0xb5')]=function(_0x5019fb,_0x38050f,_0x3a422b){return db['FaxMessage'][_0xf44c('0x67')]({'where':{'id':_0x5019fb[_0xf44c('0xb3')]['id']}})[_0xf44c('0x2c')](handleEntityNotFound(_0x38050f,null))[_0xf44c('0x2c')](function(_0x2fbd47){if(_0x2fbd47){return _0x2fbd47[_0xf44c('0xb5')](_0x5019fb['body'][_0xf44c('0xb6')],_[_0xf44c('0xb7')](_0x5019fb[_0xf44c('0x71')],[_0xf44c('0xb6'),'id'])||{});}})[_0xf44c('0x2c')](respondWithResult(_0x38050f,null))[_0xf44c('0x38')](handleError(_0x38050f,null));};exports[_0xf44c('0xb8')]=function(_0x10b823,_0x569415,_0xfd070e){var _0xb58270={'raw':![],'where':{}};var _0x497659={};var _0x53e577={'count':0x0,'rows':[]};return db[_0xf44c('0x3a')][_0xf44c('0xb9')]({'where':{'id':_0x10b823[_0xf44c('0xb3')]['id']}})[_0xf44c('0x2c')](handleEntityNotFound(_0x569415,null))[_0xf44c('0x2c')](function(_0x2ed066){if(_0x2ed066){_0x497659[_0xf44c('0x3e')]=_['keys'](db[_0xf44c('0xba')][_0xf44c('0xae')]);_0x497659[_0xf44c('0x3f')]=_[_0xf44c('0x40')](_0x10b823[_0xf44c('0x3f')]);_0x497659[_0xf44c('0x48')]=_[_0xf44c('0x41')](_0x497659[_0xf44c('0x3e')],_0x497659[_0xf44c('0x3f')]);_0xb58270[_0xf44c('0x43')]=_[_0xf44c('0x41')](_0x497659[_0xf44c('0x3e')],qs[_0xf44c('0x42')](_0x10b823['query'][_0xf44c('0x42')]));_0xb58270[_0xf44c('0x43')]=_0xb58270[_0xf44c('0x43')][_0xf44c('0x44')]?_0xb58270[_0xf44c('0x43')]:_0x497659[_0xf44c('0x3e')];if(!_0x10b823[_0xf44c('0x3f')][_0xf44c('0x45')](_0xf44c('0xbb'))){_0xb58270[_0xf44c('0x25')]=qs['limit'](_0x10b823['query'][_0xf44c('0x25')]);_0xb58270[_0xf44c('0x23')]=qs[_0xf44c('0x23')](_0x10b823[_0xf44c('0x3f')]['offset']);}_0xb58270[_0xf44c('0x8b')]=qs[_0xf44c('0x46')](_0x10b823['query'][_0xf44c('0x46')]);_0xb58270['where']=qs[_0xf44c('0x48')](_['pick'](_0x10b823[_0xf44c('0x3f')],_0x497659[_0xf44c('0x48')]));_0xb58270[_0xf44c('0x47')]['FaxInteractionId']=_0x2ed066['id'];if(_0x10b823[_0xf44c('0x3f')][_0xf44c('0x82')]){_0xb58270[_0xf44c('0x47')]=_[_0xf44c('0x9a')](_0xb58270[_0xf44c('0x47')],{'$or':_[_0xf44c('0x39')](_0xb58270[_0xf44c('0x43')],function(_0x522de){var _0x397a97={};_0x397a97[_0x522de]={'$like':'%'+_0x10b823[_0xf44c('0x3f')]['filter']+'%'};return _0x397a97;})});}if(_0x10b823[_0xf44c('0x3f')][_0xf44c('0x79')]){var _0x44ae5f=_0x10b823[_0xf44c('0x3f')][_0xf44c('0x79')]['split'](',');var _0x162a2d={};_0x162a2d[_0x44ae5f[0x0]]={'$gte':moment(_0x44ae5f[0x1])[_0xf44c('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0xb58270[_0xf44c('0x47')]=_[_0xf44c('0x9a')](_0xb58270[_0xf44c('0x47')],_0x162a2d);}_0xb58270=_['merge']({},_0xb58270,_0x10b823[_0xf44c('0xb1')]);return db[_0xf44c('0xba')][_0xf44c('0x26')]({'where':_0xb58270[_0xf44c('0x47')]})['then'](function(_0x5cd9b3){_0x53e577[_0xf44c('0x26')]=_0x5cd9b3;if(_0x10b823[_0xf44c('0x3f')][_0xf44c('0xaf')]){_0xb58270['include']=[{'all':!![]}];}return db[_0xf44c('0xba')][_0xf44c('0xbd')](_0xb58270);})[_0xf44c('0x2c')](function(_0x1204c4){_0x53e577[_0xf44c('0xac')]=_0x1204c4;return _0x53e577;});}})[_0xf44c('0x2c')](respondWithFilteredResult(_0x569415,_0xb58270))[_0xf44c('0x38')](handleError(_0x569415,null));};exports[_0xf44c('0xbe')]=function(_0x59e0d9,_0xf35ec8,_0x576e34){return db[_0xf44c('0x3a')]['find']({'where':{'id':_0x59e0d9[_0xf44c('0xb3')]['id']}})[_0xf44c('0x2c')](handleEntityNotFound(_0xf35ec8,null))[_0xf44c('0x2c')](function(_0x2ad493){if(_0x2ad493){return _0x2ad493[_0xf44c('0xbf')](_0x59e0d9[_0xf44c('0x71')][_0xf44c('0xb6')],_[_0xf44c('0xb7')](_0x59e0d9[_0xf44c('0x71')],[_0xf44c('0xb6'),'id'])||{})[_0xf44c('0xc0')](function(){return db[_0xf44c('0x6b')][_0xf44c('0xbd')]({'attributes':['id',_0xf44c('0x2f'),_0xf44c('0x4b')],'where':{'id':_0x59e0d9[_0xf44c('0x71')][_0xf44c('0xb6')]}});})[_0xf44c('0x2c')](function(_0x16fe2c){socket[_0xf44c('0xc1')](_0xf44c('0xc2'),{'id':Number(_0x59e0d9[_0xf44c('0xb3')]['id']),'tags':_0x16fe2c||[]});return{'id':Number(_0x59e0d9[_0xf44c('0xb3')]['id']),'tags':_0x16fe2c||[]};});}})[_0xf44c('0x2c')](respondWithResult(_0xf35ec8,null))[_0xf44c('0x38')](handleError(_0xf35ec8,null));};exports[_0xf44c('0xc3')]=function(_0x5c5ddd,_0x4a8ad8,_0x364b48){return db['FaxInteraction'][_0xf44c('0x67')]({'where':{'id':_0x5c5ddd['params']['id']}})['then'](handleEntityNotFound(_0x4a8ad8,null))[_0xf44c('0x2c')](function(_0x2cbef1){if(_0x2cbef1){return _0x2cbef1[_0xf44c('0xc3')](_0x5c5ddd[_0xf44c('0x3f')][_0xf44c('0xb6')]);}})[_0xf44c('0x2c')](respondWithStatusCode(_0x4a8ad8,null))['catch'](handleError(_0x4a8ad8,null));};exports[_0xf44c('0xc4')]=function(_0x548b23,_0x4e8110){var _0x6bf317=moment()[_0xf44c('0xc5')]()['toString']();var _0x3e890b=path['join'](config['root'],_0xf44c('0xc6'),'files',_0xf44c('0xc7'));var _0x36fde5=path['join'](config[_0xf44c('0xc8')],_0xf44c('0xc6'),'files',_0xf44c('0xc9'));var _0x31d40f=path['join'](_0x3e890b,_0x6bf317);var _0x576983=util[_0xf44c('0xbc')](_0xf44c('0xca'),_0x548b23[_0xf44c('0xb3')]['id'],_0x6bf317);var _0x4939f4=path['join'](_0x3e890b,_0x576983);var _0x1808c1=[];_0x1808c1['push']({'model':db[_0xf44c('0xcb')],'as':_0xf44c('0xcb'),'raw':!![]});var _0x28aa13=[{'model':db[_0xf44c('0xba')],'as':_0xf44c('0xcc'),'attributes':['id',_0xf44c('0x71'),_0xf44c('0x77')],'include':_0x1808c1}];return db[_0xf44c('0x3a')][_0xf44c('0x67')]({'where':{'id':_0x548b23[_0xf44c('0xb3')]['id']},'include':_0x28aa13})[_0xf44c('0x2c')](handleEntityNotFound(_0x4e8110,null))['then'](function(_0x470f18){if(_0x470f18&&_0x470f18[_0xf44c('0xcc')]){var _0x95d65d=_0x470f18['get']({'plain':!![]});fs[_0xf44c('0xcd')](_0x31d40f);for(var _0x157d59=0x0;_0x157d59<_0x95d65d['Messages'][_0xf44c('0x44')];_0x157d59++){var _0x2256bd=_0x95d65d[_0xf44c('0xcc')][_0x157d59]['Attachment'];if(_0x2256bd){var _0x67f2de=path[_0xf44c('0xce')](_0x36fde5,_0x2256bd['basename']);if(fs[_0xf44c('0xcf')](_0x67f2de)){fs['createReadStream'](_0x67f2de)[_0xf44c('0xd0')](fs[_0xf44c('0xd1')](path[_0xf44c('0xce')](_0x31d40f,_0x2256bd[_0xf44c('0xd2')])));}}}return BPromise[_0xf44c('0x90')]()[_0xf44c('0x2c')](function(){return new BPromise(function(_0x33e7ae,_0x4882de){zipdir(_0x31d40f,{'saveTo':_0x4939f4},function(_0x296bd6,_0x626576){if(_0x296bd6)return _0x4882de(_0x296bd6);return _0x33e7ae(_0x626576);});})[_0xf44c('0x2c')](function(){return new BPromise(function(_0x87db24,_0x4cf253){rimraf(_0x31d40f,function(_0x5891a3){if(_0x5891a3)_0x4cf253(_0x5891a3);return _0x87db24();});});})[_0xf44c('0x2c')](function(){return _0x4e8110[_0xf44c('0xc4')](_0x4939f4,_0x576983,function(_0x5664dc){if(_0x5664dc){console[_0xf44c('0xd3')]('err',_0x5664dc);}else{fs[_0xf44c('0xd4')](_0x4939f4);}});});});}else{return _0x4e8110[_0xf44c('0x21')](0xc8);}})[_0xf44c('0x38')](handleError(_0x4e8110,null));}; \ No newline at end of file +var _0x3327=['read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','sequelize','keyBy','FaxInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','params','include','merge','create','destroy','describe','addMessage','FaxMessage','omit','format','findAll','ids','spread','Tag','emit','faxInteractionTags:save','removeTags','download','join','server','files','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','error','stack','name','send','fullname','Tags','TagIds','split','forEach','push','catch','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','users','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_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','User','operator','UserId','body','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x3327,0x117));var _0x7332=function(_0x1672c1,_0x531c4b){_0x1672c1=_0x1672c1-0x0;var _0x18032c=_0x3327[_0x1672c1];return _0x18032c;};'use strict';var emlformat=require(_0x7332('0x0'));var rimraf=require(_0x7332('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7332('0x2'));var rp=require(_0x7332('0x3'));var moment=require(_0x7332('0x4'));var BPromise=require(_0x7332('0x5'));var Mustache=require(_0x7332('0x6'));var util=require('util');var path=require(_0x7332('0x7'));var sox=require(_0x7332('0x8'));var csv=require('to-csv');var ejs=require(_0x7332('0x9'));var fs=require('fs');var fs_extra=require(_0x7332('0xa'));var _=require(_0x7332('0xb'));var squel=require('squel');var crypto=require(_0x7332('0xc'));var jsforce=require(_0x7332('0xd'));var deskjs=require(_0x7332('0xe'));var toCsv=require(_0x7332('0xf'));var querystring=require(_0x7332('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7332('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7332('0x12'));var logger=require(_0x7332('0x13'))(_0x7332('0x14'));var utils=require(_0x7332('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7332('0x16'));var db=require(_0x7332('0x17'))['db'];config[_0x7332('0x18')]=_[_0x7332('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7332('0x1a'))(new Redis(config['redis']));require(_0x7332('0x1b'))[_0x7332('0x1c')](socket);function respondWithStatusCode(_0x2711c3,_0x354335){_0x354335=_0x354335||0xcc;return function(_0xa8129a){if(_0xa8129a){return _0x2711c3[_0x7332('0x1d')](_0x354335);}return _0x2711c3['status'](_0x354335)[_0x7332('0x1e')]();};}function respondWithResult(_0x4baaca,_0x3781b6){_0x3781b6=_0x3781b6||0xc8;return function(_0x1a91f3){if(_0x1a91f3){return _0x4baaca[_0x7332('0x1f')](_0x3781b6)[_0x7332('0x20')](_0x1a91f3);}};}function respondWithFilteredResult(_0x382819,_0x33ae86){return function(_0x47f23c){if(_0x47f23c){var _0x980d83=typeof _0x33ae86[_0x7332('0x21')]==='undefined'&&typeof _0x33ae86[_0x7332('0x22')]===_0x7332('0x23');var _0x3fb9ac=_0x47f23c[_0x7332('0x24')];var _0x4afec5=_0x980d83?0x0:_0x33ae86[_0x7332('0x21')];var _0x1b06f7=_0x980d83?_0x47f23c[_0x7332('0x24')]:_0x33ae86[_0x7332('0x21')]+_0x33ae86[_0x7332('0x22')];var _0x378a5e;if(_0x1b06f7>=_0x3fb9ac){_0x1b06f7=_0x3fb9ac;_0x378a5e=0xc8;}else{_0x378a5e=0xce;}_0x382819[_0x7332('0x1f')](_0x378a5e);return _0x382819['set'](_0x7332('0x25'),_0x4afec5+'-'+_0x1b06f7+'/'+_0x3fb9ac)[_0x7332('0x20')](_0x47f23c);}return null;};}function patchUpdates(_0x25ec53){return function(_0xcb1a94){try{jsonpatch[_0x7332('0x26')](_0xcb1a94,_0x25ec53,!![]);}catch(_0xac573b){return BPromise[_0x7332('0x27')](_0xac573b);}return _0xcb1a94[_0x7332('0x28')]();};}function saveUpdates(_0x4bee5c,_0x1cb18c){return function(_0x147e42){if(_0x147e42){return _0x147e42['update'](_0x4bee5c)[_0x7332('0x29')](function(_0x438f68){return _0x438f68;});}return null;};}function removeEntity(_0x5c808c,_0x574150){return function(_0x41181d){if(_0x41181d){return _0x41181d['destroy']()['then'](function(){_0x5c808c[_0x7332('0x1f')](0xcc)[_0x7332('0x1e')]();});}};}function handleEntityNotFound(_0xf0ed41,_0x2786c1){return function(_0x2b68a5){if(!_0x2b68a5){_0xf0ed41[_0x7332('0x1d')](0x194);}return _0x2b68a5;};}function handleError(_0x4a1b89,_0x1dd96f){_0x1dd96f=_0x1dd96f||0x1f4;return function(_0x44f1cb){logger[_0x7332('0x2a')](_0x44f1cb[_0x7332('0x2b')]);if(_0x44f1cb[_0x7332('0x2c')]){delete _0x44f1cb[_0x7332('0x2c')];}_0x4a1b89['status'](_0x1dd96f)[_0x7332('0x2d')](_0x44f1cb);};}function getInteractionUsers(_0x3d7e8f,_0xa7b562){return new BPromise(function(_0x5b797c,_0x4b7384){try{if(_0xa7b562[_0x3d7e8f['id']]){_0x3d7e8f['Users']=_['map'](_0xa7b562[_0x3d7e8f['id']],function(_0x2dc94c){return{'id':_0x2dc94c['id'],'fullname':_0x2dc94c[_0x7332('0x2e')]};});}}catch(_0x54e2a1){_0x4b7384(_0x54e2a1);}_0x5b797c(_0x3d7e8f);});}function getInteractionTags(_0x509124,_0xe21441){return new BPromise(function(_0x39e2d5,_0x22da70){try{if(_0x509124['TagIds']){_0x509124[_0x7332('0x2f')]=[];_0x509124[_0x7332('0x30')][_0x7332('0x31')](',')[_0x7332('0x32')](function(_0x2578e7){_0x509124[_0x7332('0x2f')][_0x7332('0x33')](_0xe21441[_0x2578e7]);});}delete _0x509124[_0x7332('0x30')];}catch(_0x192763){_0x22da70(_0x192763);}_0x39e2d5(_0x509124);});}function updateFaxInteraction(_0x424923,_0x1f2aab,_0x40bf00){return new BPromise(function(_0x5071e7,_0x4036fb){return getInteractionUsers(_0x424923,_0x40bf00)['then'](function(_0x4649bd){return getInteractionTags(_0x4649bd,_0x1f2aab);})['then'](function(_0x11188f){_0x5071e7(_0x11188f);})[_0x7332('0x34')](function(_0x1b2ed7){_0x4036fb(_0x1b2ed7);});});}exports['index']=function(_0x1b2254,_0x5eec51){var _0x4709ca={},_0x1213fc={},_0x18fc65={'count':0x0,'rows':[]};var _0x3d4df0=_[_0x7332('0x35')](db['FaxInteraction'][_0x7332('0x36')],function(_0x1f638c){return{'name':_0x1f638c[_0x7332('0x37')],'type':_0x1f638c[_0x7332('0x38')]['key']};});_0x1213fc[_0x7332('0x39')]=_['map'](_0x3d4df0,'name');_0x1213fc['query']=_[_0x7332('0x3a')](_0x1b2254['query']);_0x1213fc[_0x7332('0x3b')]=_[_0x7332('0x3c')](_0x1213fc['model'],_0x1213fc[_0x7332('0x3d')]);_0x4709ca[_0x7332('0x3e')]=_[_0x7332('0x3c')](_0x1213fc[_0x7332('0x39')],qs[_0x7332('0x3f')](_0x1b2254[_0x7332('0x3d')][_0x7332('0x3f')]));_0x4709ca['attributes']=_0x4709ca[_0x7332('0x3e')][_0x7332('0x40')]?_0x4709ca[_0x7332('0x3e')]:_0x1213fc['model'];if(!_0x1b2254['query'][_0x7332('0x41')](_0x7332('0x42'))){_0x4709ca[_0x7332('0x22')]=qs['limit'](_0x1b2254[_0x7332('0x3d')][_0x7332('0x22')]);_0x4709ca[_0x7332('0x21')]=qs[_0x7332('0x21')](_0x1b2254[_0x7332('0x3d')]['offset']);}_0x4709ca[_0x7332('0x43')]=qs[_0x7332('0x44')](_0x1b2254[_0x7332('0x3d')][_0x7332('0x44')]);_0x4709ca[_0x7332('0x45')]=qs[_0x7332('0x3b')](_[_0x7332('0x46')](_0x1b2254[_0x7332('0x3d')],_0x1213fc[_0x7332('0x3b')]),_0x3d4df0);var _0x65b996=[];var _0x4c7a40=squel[_0x7332('0x47')]()[_0x7332('0x48')]('id')[_0x7332('0x48')](_0x7332('0x2c'))[_0x7332('0x48')]('color')[_0x7332('0x49')](_0x7332('0x4a'));var _0x4095d8=squel[_0x7332('0x47')]()[_0x7332('0x48')](_0x7332('0x4b'))['field'](_0x7332('0x4c'))[_0x7332('0x48')](_0x7332('0x4d'))['from']('user_has_fax_interactions','ui')[_0x7332('0x4e')](_0x7332('0x4f'),'u',_0x7332('0x50'));var _0x4127bb=squel[_0x7332('0x47')]()[_0x7332('0x49')](_0x7332('0x51'),'i')[_0x7332('0x4e')](_0x7332('0x52'),'c',_0x7332('0x53'))[_0x7332('0x4e')](_0x7332('0x4f'),'o',_0x7332('0x54'))[_0x7332('0x4e')](_0x7332('0x55'),'a','a.id\x20=\x20i.FaxAccountId')[_0x7332('0x4e')](_0x7332('0x56'),'me',_0x7332('0x57'))['left_join']('fax_interaction_has_tags','it',_0x7332('0x58'))['left_join'](_0x7332('0x4a'),'t',_0x7332('0x59'));var _0x4bb80d=squel['expr']();var _0x3cab42=[];var _0x1a46ca=squel[_0x7332('0x5a')]();var _0x2d6ef4;if(_0x1b2254['query'][_0x7332('0x5b')]){_0x2d6ef4=as[_0x7332('0x5c')](_0x1b2254[_0x7332('0x3d')][_0x7332('0x5b')]);var _0x3dc10d=_0x2d6ef4[_0x7332('0x5d')];for(var _0x1228f8=0x0;_0x1228f8<_0x2d6ef4['conditions']['length'];_0x1228f8++){var _0x4bc7a7=_0x2d6ef4[_0x7332('0x5e')][_0x1228f8];var _0x3c745f='i';var _0x310e68=_[_0x7332('0x5f')](_0x3d4df0,['name',_0x4bc7a7['field']]);if(!_0x310e68){switch(_0x4bc7a7[_0x7332('0x48')]){case _0x7332('0x60'):if(_0x4bc7a7[_0x7332('0x61')]==0x1){_0x4127bb[_0x7332('0x62')]('`'+_0x4bc7a7['field']+'`\x20=\x200');}else{_0x4127bb['having']('`'+_0x4bc7a7[_0x7332('0x48')]+'`\x20>\x200');}break;case'Contact':if(_0x4bc7a7['operator']===_0x7332('0x63')){if(_0x4bc7a7['value'][_0x7332('0x31')]('\x20')[_0x7332('0x40')]>0x1){_0x4bb80d[_0x3dc10d](_0x7332('0x64'),qs[_0x7332('0x65')](_0x4bc7a7['value']),null);}else{var _0x1723ff='%'+_0x4bc7a7[_0x7332('0x61')]+'%';_0x4bb80d[_0x3dc10d](_0x7332('0x66'),_0x1723ff,_0x1723ff,_0x1723ff);}}else{_0x310e68=_[_0x7332('0x5f')](_0x3d4df0,[_0x7332('0x2c'),_0x7332('0x67')]);_0x4bc7a7['field']='ContactId';_0x552818=as[_0x7332('0x68')](_0x3c745f,_0x310e68['type'],_0x4bc7a7);_0x4bb80d[_0x3dc10d](_0x552818[_0x7332('0x69')],_0x552818[_0x7332('0x61')][_0x7332('0x6a')],_0x552818['value'][_0x7332('0x1e')]);}break;case'Tag':var _0x3aa004=_0x4bc7a7[_0x7332('0x61')]['split'](',')['map'](function(_0x3c2488){return Number(_0x3c2488);});_0x3aa004[_0x7332('0x32')](function(_0xa22626){_0x1a46ca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa22626+',%');});_0x3cab42=_['union'](_0x3cab42,_0x3aa004);break;case _0x7332('0x6b'):if(_0x4bc7a7[_0x7332('0x6c')]==='$substring'){_0x4bb80d[_0x3dc10d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4bc7a7['value']+'%',null);}else{_0x310e68=_[_0x7332('0x5f')](_0x3d4df0,[_0x7332('0x2c'),'UserId']);_0x4bc7a7[_0x7332('0x48')]=_0x7332('0x6d');_0x552818=as[_0x7332('0x68')](_0x3c745f,_0x310e68[_0x7332('0x38')],_0x4bc7a7);_0x4bb80d[_0x3dc10d](_0x552818[_0x7332('0x69')],_0x552818['value']['start'],_0x552818[_0x7332('0x61')][_0x7332('0x1e')]);}break;case _0x7332('0x6e'):_0x552818=as[_0x7332('0x68')]('me',null,_0x4bc7a7);_0x4bb80d[_0x3dc10d](_0x552818[_0x7332('0x69')],_0x552818['value'][_0x7332('0x6a')],_0x552818[_0x7332('0x61')][_0x7332('0x1e')]);break;}}else{var _0x552818=as[_0x7332('0x68')](_0x3c745f,_0x310e68['type'],_0x4bc7a7);_0x4bb80d[_0x3dc10d](_0x552818['text'],_0x552818[_0x7332('0x61')][_0x7332('0x6a')],_0x552818[_0x7332('0x61')]['end']);}}}else{var _0x437e55=_(_0x1b2254['query'])['keys']()[_0x7332('0x35')](function(_0x436df8){return _['some'](_0x3d4df0,[_0x7332('0x2c'),_0x436df8])?_0x436df8:undefined;})['compact']()[_0x7332('0x61')]();if(!_[_0x7332('0x6f')](_0x437e55)){_0x437e55['forEach'](function(_0x4b185e){if(_0x4b185e===_0x7332('0x70')){_0x4127bb[_0x7332('0x45')](_0x7332('0x71'),[][_0x7332('0x72')](_0x1b2254[_0x7332('0x3d')][_0x4b185e]));}else if(_0x4b185e===_0x7332('0x73')){var _0x18e44d=JSON[_0x7332('0x74')](_0x1b2254[_0x7332('0x3d')][_0x4b185e])[_0x7332('0x75')];var _0x2cdfb6=JSON[_0x7332('0x74')](_0x1b2254[_0x7332('0x3d')][_0x4b185e])[_0x7332('0x76')];_0x4127bb[_0x7332('0x45')](_0x7332('0x77'),_0x18e44d,_0x2cdfb6);}else{if(_0x1b2254[_0x7332('0x3d')][_0x4b185e]===_0x7332('0x78')){_0x4127bb[_0x7332('0x45')]('i.'+_0x4b185e+_0x7332('0x79'));}else{_0x4127bb[_0x7332('0x45')]('i.'+_0x4b185e+_0x7332('0x7a'),_0x1b2254[_0x7332('0x3d')][_0x4b185e]);}}});}if(_0x1b2254['query'][_0x7332('0x7b')]){if(_0x1b2254[_0x7332('0x3d')][_0x7332('0x7b')]==0x1){_0x4127bb[_0x7332('0x62')]('`unreadMessages`\x20=\x200');}else{_0x4127bb[_0x7332('0x62')](_0x7332('0x7c'));}}if(_0x1b2254['query'][_0x7332('0x7d')]){_0x3cab42=_['isArray'](_0x1b2254[_0x7332('0x3d')][_0x7332('0x7d')])?_0x1b2254['query']['tag']:new Array(_0x1b2254[_0x7332('0x3d')][_0x7332('0x7d')]);_0x3cab42[_0x7332('0x32')](function(_0x579ea4){_0x1a46ca['or'](_0x7332('0x7e'),'%,'+_0x579ea4+',%');});}if(_0x1b2254[_0x7332('0x3d')][_0x7332('0x7f')]){var _0x4619d5=_0x1b2254[_0x7332('0x3d')][_0x7332('0x7f')][_0x7332('0x80')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4619d5)){_0x4bb80d['or']('i.id\x20LIKE\x20?',_0x4619d5+'%')['or'](_0x7332('0x81'),_0x4619d5+'%');}_0x4bb80d['or'](_0x7332('0x82'),_0x4619d5+'%');}}_0x4127bb[_0x7332('0x45')](_0x4bb80d);_0x4127bb[_0x7332('0x83')]('i.id');var _0x31a2e5={'type':db[_0x7332('0x84')]['QueryTypes'][_0x7332('0x85')],'raw':!![]};var _0xa92f0a=_0x4127bb[_0x7332('0x86')]();_0xa92f0a['field'](_0x7332('0x87'));_0xa92f0a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7332('0x60'));if(_0x4709ca[_0x7332('0x43')]){_0x4709ca[_0x7332('0x43')][_0x7332('0x32')](function(_0x1a9671){var _0x25ae2f=_0x1a9671[0x0]===_0x7332('0x88')?_0x1a9671[0x0]:'i.'+_0x1a9671[0x0];_0x4127bb['order'](_0x25ae2f,_0x1a9671[0x1]===_0x7332('0x89')?![]:!![]);});}if(!_[_0x7332('0x6f')](_0x3cab42)){_0x4127bb[_0x7332('0x62')](_0x1a46ca);_0xa92f0a[_0x7332('0x45')]('t.id\x20IN\x20?',_0x3cab42);}BPromise[_0x7332('0x8a')]()[_0x7332('0x29')](function(){if(!_0x2d6ef4){if(_0x1b2254[_0x7332('0x3d')][_0x7332('0x70')])return;_0xa92f0a[_0x7332('0x45')](_0x7332('0x8b'));_0x4127bb[_0x7332('0x45')](_0x7332('0x8b'));return;}if(_0x1b2254['user']['role']!==_0x7332('0x8c'))return;return _0x1b2254[_0x7332('0x8d')][_0x7332('0x8e')]({'attributes':['id'],'raw':!![]})[_0x7332('0x29')](function(_0x493100){if(_['isEmpty'](_0x493100)){_0xa92f0a['where'](_0x7332('0x8f'));_0x4127bb[_0x7332('0x45')](_0x7332('0x8f'));}else{_0xa92f0a['where'](_0x7332('0x71'),_[_0x7332('0x35')](_0x493100,'id'));_0x4127bb[_0x7332('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0x7332('0x35')](_0x493100,'id'));}});})[_0x7332('0x29')](function(){if(_0x1b2254[_0x7332('0x8d')][_0x7332('0x90')]===_0x7332('0x8c')&&!_0x2d6ef4&&!_0x1b2254['query'][_0x7332('0x70')])return[];return db[_0x7332('0x91')][_0x7332('0x3d')](_0xa92f0a['toString'](),_0x31a2e5);})[_0x7332('0x29')](function(_0x1fc80b){_0x18fc65[_0x7332('0x24')]=_0x1fc80b['length'];if(_0x18fc65[_0x7332('0x24')]===0x0)return[];return db[_0x7332('0x91')][_0x7332('0x3d')](_0x4c7a40['toString'](),_0x31a2e5)[_0x7332('0x29')](function(_0x5d125d){_0x65b996=_[_0x7332('0x92')](_0x5d125d,'id');_0x31a2e5=_['merge'](_0x31a2e5,{'model':db[_0x7332('0x93')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b2254[_0x7332('0x3d')][_0x7332('0x3f')]){_0x4709ca[_0x7332('0x3e')][_0x7332('0x32')](function(_0x4aa9ad){_0x4127bb[_0x7332('0x48')]('i.'+_0x4aa9ad);});}else{_0x4127bb[_0x7332('0x48')](_0x7332('0x94'),'unreadMessages');_0x4127bb[_0x7332('0x48')](_0x7332('0x95'),'Account.key');_0x4127bb[_0x7332('0x48')]('a.mandatoryDisposition',_0x7332('0x96'));_0x4127bb[_0x7332('0x48')]('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','contactName');_0x4127bb[_0x7332('0x48')](_0x7332('0x97'));_0x4127bb['field'](_0x7332('0x98'),_0x7332('0x99'));_0x4127bb['field']('c.lastName','Contact.lastName');_0x4127bb[_0x7332('0x48')](_0x7332('0x9a'),_0x7332('0x9b'));_0x4127bb[_0x7332('0x48')]('c.phone','Contact.phone');_0x4127bb[_0x7332('0x48')](_0x7332('0x9c'),_0x7332('0x9d'));_0x4127bb[_0x7332('0x48')]('c.fax',_0x7332('0x9e'));_0x4127bb[_0x7332('0x48')](_0x7332('0x9f'),_0x7332('0xa0'));_0x4127bb[_0x7332('0x48')](_0x7332('0xa1'),_0x7332('0xa2'));_0x4127bb[_0x7332('0x48')](_0x7332('0xa3'),_0x7332('0x30'));}if(_0x4709ca[_0x7332('0x22')])_0x4127bb[_0x7332('0x22')](_0x4709ca[_0x7332('0x22')]);if(_0x4709ca[_0x7332('0x21')])_0x4127bb['offset'](_0x4709ca[_0x7332('0x21')]);return db[_0x7332('0x91')][_0x7332('0x3d')](_0x4127bb[_0x7332('0xa4')](),_0x31a2e5);})['then'](function(_0x4931b6){if(_0x4931b6['length']>0x0)_0x4095d8['where'](_0x7332('0xa5'),_[_0x7332('0x35')](_0x4931b6,'id'));return db[_0x7332('0x91')][_0x7332('0x3d')](_0x4095d8[_0x7332('0xa4')](),_0x31a2e5)[_0x7332('0x29')](function(_0x5d6939){var _0x17f094=_['groupBy'](_0x5d6939,_0x7332('0xa6'));var _0x331726=[];_0x4931b6['forEach'](function(_0x13d316){_0x331726[_0x7332('0x33')](updateFaxInteraction(_0x13d316,_0x65b996,_0x17f094));});return BPromise[_0x7332('0xa7')](_0x331726);});});})[_0x7332('0x29')](function(_0x186b24){_0x18fc65[_0x7332('0xa8')]=_0x186b24;return _0x18fc65;})['then'](respondWithFilteredResult(_0x5eec51,_0x4709ca))[_0x7332('0x34')](handleError(_0x5eec51,null));};exports['show']=function(_0x168f71,_0xb1bee9){var _0x4bf4d1={'raw':![],'where':{'id':_0x168f71[_0x7332('0xa9')]['id']}},_0x3662f3={};_0x3662f3[_0x7332('0x39')]=_[_0x7332('0x3a')](db['FaxInteraction'][_0x7332('0x36')]);_0x3662f3[_0x7332('0x3d')]=_[_0x7332('0x3a')](_0x168f71[_0x7332('0x3d')]);_0x3662f3[_0x7332('0x3b')]=_[_0x7332('0x3c')](_0x3662f3[_0x7332('0x39')],_0x3662f3['query']);_0x4bf4d1[_0x7332('0x3e')]=_[_0x7332('0x3c')](_0x3662f3[_0x7332('0x39')],qs[_0x7332('0x3f')](_0x168f71[_0x7332('0x3d')][_0x7332('0x3f')]));_0x4bf4d1[_0x7332('0x3e')]=_0x4bf4d1[_0x7332('0x3e')][_0x7332('0x40')]?_0x4bf4d1[_0x7332('0x3e')]:_0x3662f3['model'];if(_0x168f71['query']['includeAll']){_0x4bf4d1[_0x7332('0xaa')]=[{'all':!![]}];}_0x4bf4d1=_[_0x7332('0xab')]({},_0x4bf4d1,_0x168f71['options']);return db[_0x7332('0x93')][_0x7332('0x5f')](_0x4bf4d1)['then'](handleEntityNotFound(_0xb1bee9,null))[_0x7332('0x29')](respondWithResult(_0xb1bee9,null))['catch'](handleError(_0xb1bee9,null));};exports[_0x7332('0xac')]=function(_0x900e06,_0x47ea58){return db['FaxInteraction'][_0x7332('0xac')](_0x900e06['body'],{})[_0x7332('0x29')](respondWithResult(_0x47ea58,0xc9))[_0x7332('0x34')](handleError(_0x47ea58,null));};exports['update']=function(_0x5ea53a,_0x333f11){if(_0x5ea53a[_0x7332('0x6e')]['id']){delete _0x5ea53a['body']['id'];}return db[_0x7332('0x93')][_0x7332('0x5f')]({'where':{'id':_0x5ea53a['params']['id']}})[_0x7332('0x29')](handleEntityNotFound(_0x333f11,null))[_0x7332('0x29')](saveUpdates(_0x5ea53a[_0x7332('0x6e')],null))[_0x7332('0x29')](respondWithResult(_0x333f11,null))[_0x7332('0x34')](handleError(_0x333f11,null));};exports[_0x7332('0xad')]=function(_0x87efa2,_0x589991){return db[_0x7332('0x93')][_0x7332('0x5f')]({'where':{'id':_0x87efa2['params']['id']}})['then'](handleEntityNotFound(_0x589991,null))[_0x7332('0x29')](removeEntity(_0x589991,null))[_0x7332('0x34')](handleError(_0x589991,null));};exports['describe']=function(_0x412437,_0x39644b){return db[_0x7332('0x93')][_0x7332('0xae')]()['then'](respondWithResult(_0x39644b,null))['catch'](handleError(_0x39644b,null));};exports[_0x7332('0xaf')]=function(_0x72f51d,_0x2c196a,_0xad97f){return db[_0x7332('0xb0')][_0x7332('0x5f')]({'where':{'id':_0x72f51d[_0x7332('0xa9')]['id']}})[_0x7332('0x29')](handleEntityNotFound(_0x2c196a,null))['then'](function(_0x36f066){if(_0x36f066){return _0x36f066[_0x7332('0xaf')](_0x72f51d[_0x7332('0x6e')]['ids'],_[_0x7332('0xb1')](_0x72f51d[_0x7332('0x6e')],['ids','id'])||{});}})['then'](respondWithResult(_0x2c196a,null))[_0x7332('0x34')](handleError(_0x2c196a,null));};exports['getMessages']=function(_0x297e14,_0x3bc2ea,_0xf524fa){var _0xdf3371={'raw':![],'where':{}};var _0x55b746={};var _0x26299b={'count':0x0,'rows':[]};return db[_0x7332('0x93')]['findOne']({'where':{'id':_0x297e14['params']['id']}})['then'](handleEntityNotFound(_0x3bc2ea,null))[_0x7332('0x29')](function(_0x50abd3){if(_0x50abd3){_0x55b746[_0x7332('0x39')]=_[_0x7332('0x3a')](db['FaxMessage']['rawAttributes']);_0x55b746[_0x7332('0x3d')]=_['keys'](_0x297e14[_0x7332('0x3d')]);_0x55b746[_0x7332('0x3b')]=_[_0x7332('0x3c')](_0x55b746[_0x7332('0x39')],_0x55b746['query']);_0xdf3371['attributes']=_['intersection'](_0x55b746[_0x7332('0x39')],qs[_0x7332('0x3f')](_0x297e14[_0x7332('0x3d')]['fields']));_0xdf3371[_0x7332('0x3e')]=_0xdf3371[_0x7332('0x3e')][_0x7332('0x40')]?_0xdf3371[_0x7332('0x3e')]:_0x55b746[_0x7332('0x39')];if(!_0x297e14[_0x7332('0x3d')][_0x7332('0x41')](_0x7332('0x42'))){_0xdf3371[_0x7332('0x22')]=qs[_0x7332('0x22')](_0x297e14[_0x7332('0x3d')][_0x7332('0x22')]);_0xdf3371[_0x7332('0x21')]=qs[_0x7332('0x21')](_0x297e14[_0x7332('0x3d')][_0x7332('0x21')]);}_0xdf3371['order']=qs[_0x7332('0x44')](_0x297e14[_0x7332('0x3d')][_0x7332('0x44')]);_0xdf3371[_0x7332('0x45')]=qs[_0x7332('0x3b')](_[_0x7332('0x46')](_0x297e14[_0x7332('0x3d')],_0x55b746[_0x7332('0x3b')]));_0xdf3371[_0x7332('0x45')][_0x7332('0xa6')]=_0x50abd3['id'];if(_0x297e14[_0x7332('0x3d')][_0x7332('0x7f')]){_0xdf3371['where']=_[_0x7332('0xab')](_0xdf3371[_0x7332('0x45')],{'$or':_['map'](_0xdf3371[_0x7332('0x3e')],function(_0x44a6a2){var _0x358753={};_0x358753[_0x44a6a2]={'$like':'%'+_0x297e14[_0x7332('0x3d')][_0x7332('0x7f')]+'%'};return _0x358753;})});}if(_0x297e14[_0x7332('0x3d')][_0x7332('0x75')]){var _0x5d7c5f=_0x297e14[_0x7332('0x3d')][_0x7332('0x75')][_0x7332('0x31')](',');var _0x36ce7c={};_0x36ce7c[_0x5d7c5f[0x0]]={'$gte':moment(_0x5d7c5f[0x1])[_0x7332('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')};_0xdf3371[_0x7332('0x45')]=_[_0x7332('0xab')](_0xdf3371[_0x7332('0x45')],_0x36ce7c);}_0xdf3371=_[_0x7332('0xab')]({},_0xdf3371,_0x297e14['options']);return db[_0x7332('0xb0')][_0x7332('0x24')]({'where':_0xdf3371['where']})[_0x7332('0x29')](function(_0x3a78dc){_0x26299b[_0x7332('0x24')]=_0x3a78dc;if(_0x297e14['query']['includeAll']){_0xdf3371[_0x7332('0xaa')]=[{'all':!![]}];}return db[_0x7332('0xb0')][_0x7332('0xb3')](_0xdf3371);})[_0x7332('0x29')](function(_0x15736d){_0x26299b[_0x7332('0xa8')]=_0x15736d;return _0x26299b;});}})[_0x7332('0x29')](respondWithFilteredResult(_0x3bc2ea,_0xdf3371))['catch'](handleError(_0x3bc2ea,null));};exports['addTags']=function(_0x16a6ff,_0x2ad6c1,_0xae5e1f){return db['FaxInteraction'][_0x7332('0x5f')]({'where':{'id':_0x16a6ff[_0x7332('0xa9')]['id']}})[_0x7332('0x29')](handleEntityNotFound(_0x2ad6c1,null))[_0x7332('0x29')](function(_0x1a3b47){if(_0x1a3b47){return _0x1a3b47['setTags'](_0x16a6ff[_0x7332('0x6e')]['ids'],_['omit'](_0x16a6ff[_0x7332('0x6e')],[_0x7332('0xb4'),'id'])||{})[_0x7332('0xb5')](function(){return db[_0x7332('0xb6')][_0x7332('0xb3')]({'attributes':['id',_0x7332('0x2c'),'color'],'where':{'id':_0x16a6ff['body'][_0x7332('0xb4')]}});})[_0x7332('0x29')](function(_0xb827a2){socket[_0x7332('0xb7')](_0x7332('0xb8'),{'id':Number(_0x16a6ff[_0x7332('0xa9')]['id']),'tags':_0xb827a2||[]});return{'id':Number(_0x16a6ff[_0x7332('0xa9')]['id']),'tags':_0xb827a2||[]};});}})[_0x7332('0x29')](respondWithResult(_0x2ad6c1,null))[_0x7332('0x34')](handleError(_0x2ad6c1,null));};exports[_0x7332('0xb9')]=function(_0x470f08,_0x22845d,_0x134c61){return db[_0x7332('0x93')][_0x7332('0x5f')]({'where':{'id':_0x470f08['params']['id']}})[_0x7332('0x29')](handleEntityNotFound(_0x22845d,null))[_0x7332('0x29')](function(_0xcbed37){if(_0xcbed37){return _0xcbed37[_0x7332('0xb9')](_0x470f08[_0x7332('0x3d')][_0x7332('0xb4')]);}})['then'](respondWithStatusCode(_0x22845d,null))['catch'](handleError(_0x22845d,null));};exports[_0x7332('0xba')]=function(_0xecfca8,_0x19e676){var _0x5e59c4=moment()['unix']()[_0x7332('0xa4')]();var _0x58263d=path[_0x7332('0xbb')](config['root'],_0x7332('0xbc'),_0x7332('0xbd'),'tmp');var _0x52d88e=path[_0x7332('0xbb')](config['root'],_0x7332('0xbc'),_0x7332('0xbd'),'attachments');var _0x31ebe3=path[_0x7332('0xbb')](_0x58263d,_0x5e59c4);var _0x192dec=util[_0x7332('0xb2')](_0x7332('0xbe'),_0xecfca8['params']['id'],_0x5e59c4);var _0x4d45b6=path['join'](_0x58263d,_0x192dec);var _0x56b67f=[];_0x56b67f[_0x7332('0x33')]({'model':db[_0x7332('0xbf')],'as':'Attachment','raw':!![]});var _0x51a1e0=[{'model':db[_0x7332('0xb0')],'as':_0x7332('0xc0'),'attributes':['id','body',_0x7332('0x73')],'include':_0x56b67f}];return db['FaxInteraction']['find']({'where':{'id':_0xecfca8[_0x7332('0xa9')]['id']},'include':_0x51a1e0})[_0x7332('0x29')](handleEntityNotFound(_0x19e676,null))[_0x7332('0x29')](function(_0x3ae962){if(_0x3ae962&&_0x3ae962[_0x7332('0xc0')]){var _0x2e111e=_0x3ae962[_0x7332('0xc1')]({'plain':!![]});fs[_0x7332('0xc2')](_0x31ebe3);for(var _0x46e67f=0x0;_0x46e67f<_0x2e111e['Messages'][_0x7332('0x40')];_0x46e67f++){var _0x3e181b=_0x2e111e[_0x7332('0xc0')][_0x46e67f][_0x7332('0xbf')];if(_0x3e181b){var _0x583703=path[_0x7332('0xbb')](_0x52d88e,_0x3e181b[_0x7332('0xc3')]);if(fs[_0x7332('0xc4')](_0x583703)){fs[_0x7332('0xc5')](_0x583703)[_0x7332('0xc6')](fs[_0x7332('0xc7')](path[_0x7332('0xbb')](_0x31ebe3,_0x3e181b['basename'])));}}}return BPromise[_0x7332('0x8a')]()[_0x7332('0x29')](function(){return new BPromise(function(_0xc35fbd,_0x40d3ae){zipdir(_0x31ebe3,{'saveTo':_0x4d45b6},function(_0x288a19,_0x4ea667){if(_0x288a19)return _0x40d3ae(_0x288a19);return _0xc35fbd(_0x4ea667);});})['then'](function(){return new BPromise(function(_0x26e02e,_0x530c71){rimraf(_0x31ebe3,function(_0x26f28d){if(_0x26f28d)_0x530c71(_0x26f28d);return _0x26e02e();});});})[_0x7332('0x29')](function(){return _0x19e676['download'](_0x4d45b6,_0x192dec,function(_0x5c551f){if(_0x5c551f){console[_0x7332('0xc8')]('err',_0x5c551f);}else{fs['unlinkSync'](_0x4d45b6);}});});});}else{return _0x19e676[_0x7332('0x1d')](0xc8);}})[_0x7332('0x34')](handleError(_0x19e676,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 653863e..21e97e9 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 _0x5a0b=['getUsers','setDataValue','Users','map','findAll','unreadMessages','length','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x3bc906,_0x10a7be){var _0x2fb32d=function(_0x1df86f){while(--_0x1df86f){_0x3bc906['push'](_0x3bc906['shift']());}};_0x2fb32d(++_0x10a7be);}(_0x5a0b,0x1c4));var _0xb5a0=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x5a0b[_0x4b2863];return _0x567d67;};'use strict';var EventEmitter=require(_0xb5a0('0x0'));var FaxInteraction=require(_0xb5a0('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0xb5a0('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb5a0('0x3')](0x0);var events={'afterCreate':_0xb5a0('0x4'),'afterUpdate':_0xb5a0('0x5'),'afterDestroy':_0xb5a0('0x6')};function emitEvent(_0x2a7820){return function(_0xb21ef1,_0x22cd47,_0x5f4c4e){_0xb21ef1[_0xb5a0('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59d212){_0xb21ef1[_0xb5a0('0x8')](_0xb5a0('0x9'),_0x59d212[_0xb5a0('0xa')](function(_0x1cf9fa){return{'id':_0x1cf9fa['id']};}));return FaxMessage[_0xb5a0('0xb')]({'where':{'FaxInteractionId':_0xb21ef1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfa6386){_0xb21ef1['setDataValue'](_0xb5a0('0xc'),_0xfa6386[_0xb5a0('0xd')]);FaxInteractionEvents['emit'](_0x2a7820+':'+_0xb21ef1['id'],_0xb21ef1);FaxInteractionEvents['emit'](_0x2a7820,_0xb21ef1);_0x5f4c4e(null);})['catch'](_0x5f4c4e(null));};}for(var e in events){if(events[_0xb5a0('0xe')](e)){var event=events[e];FaxInteraction[_0xb5a0('0xf')](e,emitEvent(event));}}module[_0xb5a0('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x51ae=['setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x56e4b7,_0x4c0b79){var _0x463c26=function(_0x2894e6){while(--_0x2894e6){_0x56e4b7['push'](_0x56e4b7['shift']());}};_0x463c26(++_0x4c0b79);}(_0x51ae,0x172));var _0xe51a=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x51ae[_0x3899d1];return _0xeb4a7d;};'use strict';var EventEmitter=require(_0xe51a('0x0'));var FaxInteraction=require(_0xe51a('0x1'))['db'][_0xe51a('0x2')];var FaxMessage=require(_0xe51a('0x1'))['db'][_0xe51a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe51a('0x4')](0x0);var events={'afterCreate':_0xe51a('0x5'),'afterUpdate':_0xe51a('0x6'),'afterDestroy':_0xe51a('0x7')};function emitEvent(_0x2d1359){return function(_0x10ca32,_0x5511c1,_0x3106fe){_0x10ca32[_0xe51a('0x8')]({'attributes':['id'],'raw':!![]})[_0xe51a('0x9')](function(_0x1c39f9){_0x10ca32[_0xe51a('0xa')](_0xe51a('0xb'),_0x1c39f9[_0xe51a('0xc')](function(_0xee386f){return{'id':_0xee386f['id']};}));return FaxMessage[_0xe51a('0xd')]({'where':{'FaxInteractionId':_0x10ca32['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe51a('0x9')](function(_0x1fe5f3){_0x10ca32[_0xe51a('0xa')](_0xe51a('0xe'),_0x1fe5f3[_0xe51a('0xf')]);FaxInteractionEvents['emit'](_0x2d1359+':'+_0x10ca32['id'],_0x10ca32);FaxInteractionEvents[_0xe51a('0x10')](_0x2d1359,_0x10ca32);_0x3106fe(null);})['catch'](_0x3106fe(null));};}for(var e in events){if(events[_0xe51a('0x11')](e)){var event=events[e];FaxInteraction[_0xe51a('0x12')](e,emitEvent(event));}}module[_0xe51a('0x13')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index d522e1f..bbb4770 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 _0x2eb4=['FaxInteraction','fax_interactions','changed','closed','closedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes'];(function(_0x3b87ca,_0x36fe6c){var _0x5e075a=function(_0x5e973b){while(--_0x5e973b){_0x3b87ca['push'](_0x3b87ca['shift']());}};_0x5e075a(++_0x36fe6c);}(_0x2eb4,0x17f));var _0x42eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2eb4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x42eb('0x0'));var util=require('util');var logger=require(_0x42eb('0x1'))(_0x42eb('0x2'));var moment=require(_0x42eb('0x3'));var BPromise=require(_0x42eb('0x4'));var rp=require(_0x42eb('0x5'));var fs=require('fs');var path=require(_0x42eb('0x6'));var rimraf=require(_0x42eb('0x7'));var config=require('../../config/environment');var attributes=require(_0x42eb('0x8'));module['exports']=function(_0x398892,_0x168e79){return _0x398892['define'](_0x42eb('0x9'),attributes,{'tableName':_0x42eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x270770,_0x4c72c3,_0x24ec9d){if(_0x270770[_0x42eb('0xb')](_0x42eb('0xc'))){_0x270770[_0x42eb('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x24ec9d(null,_0x270770);}}});}; \ No newline at end of file +var _0xa6f4=['lodash','../../config/logger','api','request-promise','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','format'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0xa6f4,0x144));var _0x4a6f=function(_0x54ae30,_0x57d6b1){_0x54ae30=_0x54ae30-0x0;var _0x4ddc1c=_0xa6f4[_0x54ae30];return _0x4ddc1c;};'use strict';var _=require(_0x4a6f('0x0'));var util=require('util');var logger=require(_0x4a6f('0x1'))(_0x4a6f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4a6f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a6f('0x4'));var config=require('../../config/environment');var attributes=require(_0x4a6f('0x5'));module['exports']=function(_0x1eeba6,_0x2c3365){return _0x1eeba6[_0x4a6f('0x6')](_0x4a6f('0x7'),attributes,{'tableName':_0x4a6f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x557c3c,_0x43361e,_0x2be29f){if(_0x557c3c[_0x4a6f('0x9')](_0x4a6f('0xa'))){_0x557c3c['closedAt']=moment()[_0x4a6f('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2be29f(null,_0x557c3c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6b09e42..0608bab 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 _0xde80=['../../mysqldb','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','ids','spread','AddTags','lodash','util','moment','randomstring'];(function(_0x1f2e24,_0x5a3f7f){var _0x13387f=function(_0xb2b75e){while(--_0xb2b75e){_0x1f2e24['push'](_0x1f2e24['shift']());}};_0x13387f(++_0x5a3f7f);}(_0xde80,0x182));var _0x0de8=function(_0x4db9ed,_0x1e1a7e){_0x4db9ed=_0x4db9ed-0x0;var _0x218dab=_0xde80[_0x4db9ed];return _0x218dab;};'use strict';var _=require(_0x0de8('0x0'));var util=require(_0x0de8('0x1'));var moment=require(_0x0de8('0x2'));var BPromise=require('bluebird');var rs=require(_0x0de8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0de8('0x4'))['db'];var utils=require(_0x0de8('0x5'));var logger=require('../../config/logger')(_0x0de8('0x6'));var config=require('../../config/environment');var jayson=require(_0x0de8('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x0de8('0x8')]=_[_0x0de8('0x9')](config[_0x0de8('0x8')],{'host':_0x0de8('0xa'),'port':0x18eb});var socket=require(_0x0de8('0xb'))(new Redis(config[_0x0de8('0x8')]));require(_0x0de8('0xc'))[_0x0de8('0xd')](socket);function respondWithRpcPromise(_0x25ab8d,_0x481262,_0x575174){return new BPromise(function(_0x4b44e0,_0x44ff24){return client[_0x0de8('0xe')](_0x25ab8d,_0x575174)[_0x0de8('0xf')](function(_0x35c276){logger[_0x0de8('0x10')](_0x0de8('0x11'),_0x481262,_0x0de8('0x12'));logger['debug'](_0x0de8('0x13'),_0x481262,_0x0de8('0x12'),JSON[_0x0de8('0x14')](_0x35c276));if(_0x35c276[_0x0de8('0x15')]){if(_0x35c276[_0x0de8('0x15')][_0x0de8('0x16')]===0x1f4){logger[_0x0de8('0x15')](_0x0de8('0x11'),_0x481262,_0x35c276['error']['message']);return _0x44ff24(_0x35c276[_0x0de8('0x15')][_0x0de8('0x17')]);}logger[_0x0de8('0x15')](_0x0de8('0x11'),_0x481262,_0x35c276[_0x0de8('0x15')]['message']);return _0x4b44e0(_0x35c276[_0x0de8('0x15')][_0x0de8('0x17')]);}else{logger[_0x0de8('0x10')](_0x0de8('0x11'),_0x481262,_0x0de8('0x12'));_0x4b44e0(_0x35c276[_0x0de8('0x18')][_0x0de8('0x17')]);}})[_0x0de8('0x19')](function(_0x29fb07){logger[_0x0de8('0x15')](_0x0de8('0x11'),_0x481262,_0x29fb07);_0x44ff24(_0x29fb07);});});}exports[_0x0de8('0x1a')]=function(_0x267712){var _0x3c105b=this;return new Promise(function(_0x1015f4,_0x337ac9){return db[_0x0de8('0x1b')][_0x0de8('0x1c')](_0x267712[_0x0de8('0x1d')],{'raw':_0x267712[_0x0de8('0x1e')]?_0x267712[_0x0de8('0x1e')][_0x0de8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x267712[_0x0de8('0x1e')]?_0x267712[_0x0de8('0x1e')][_0x0de8('0x20')]||null:null,'attributes':_0x267712['options']?_0x267712[_0x0de8('0x1e')][_0x0de8('0x21')]||null:null,'limit':_0x267712[_0x0de8('0x1e')]?_0x267712[_0x0de8('0x1e')][_0x0de8('0x22')]||null:null})[_0x0de8('0xf')](function(_0x13b117){logger[_0x0de8('0x10')](_0x0de8('0x1a'),_0x267712);logger[_0x0de8('0x23')]('UpdateFaxInteraction',_0x267712,JSON[_0x0de8('0x14')](_0x13b117));_0x1015f4(_0x13b117);})[_0x0de8('0x19')](function(_0x4c202d){logger[_0x0de8('0x15')](_0x0de8('0x1a'),_0x4c202d['message'],_0x267712);_0x337ac9(_0x3c105b[_0x0de8('0x15')](0x1f4,_0x4c202d[_0x0de8('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x36bc9e){return new Promise(function(_0xba3753,_0x919480){return db[_0x0de8('0x1b')]['find']({'where':_0x36bc9e['options']?_0x36bc9e[_0x0de8('0x1e')][_0x0de8('0x20')]||null:null})[_0x0de8('0xf')](function(_0x380ef2){if(_0x380ef2){return _0x380ef2['addTags'](_0x36bc9e[_0x0de8('0x1d')][_0x0de8('0x24')],_['omit'](_0x36bc9e[_0x0de8('0x1d')],[_0x0de8('0x24'),'id'])||{});}})[_0x0de8('0x25')](function(_0x2b3819){logger['info'](_0x0de8('0x26'),_0x36bc9e);logger[_0x0de8('0x23')]('AddTags',_0x36bc9e,JSON[_0x0de8('0x14')](_0x2b3819));_0xba3753(_0x2b3819);})['catch'](function(_0x270735){logger[_0x0de8('0x15')](_0x0de8('0x26'),_0x270735[_0x0de8('0x17')],_0x36bc9e);_0x919480(_this[_0x0de8('0x15')](0x1f4,_0x270735[_0x0de8('0x17')]));});});}; \ No newline at end of file +var _0x3fbe=['update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','addTags','omit','ids','AddTags','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','FaxInteraction'];(function(_0x19803c,_0x155764){var _0x4145c1=function(_0x50526e){while(--_0x50526e){_0x19803c['push'](_0x19803c['shift']());}};_0x4145c1(++_0x155764);}(_0x3fbe,0x1ba));var _0xe3fb=function(_0x46f886,_0x2f8f17){_0x46f886=_0x46f886-0x0;var _0x4eca8b=_0x3fbe[_0x46f886];return _0x4eca8b;};'use strict';var _=require('lodash');var util=require(_0xe3fb('0x0'));var moment=require(_0xe3fb('0x1'));var BPromise=require(_0xe3fb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe3fb('0x4'));var logger=require('../../config/logger')(_0xe3fb('0x5'));var config=require(_0xe3fb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe3fb('0x7')]['http']({'port':0x232a});config['redis']=_[_0xe3fb('0x8')](config[_0xe3fb('0x9')],{'host':_0xe3fb('0xa'),'port':0x18eb});var socket=require(_0xe3fb('0xb'))(new Redis(config[_0xe3fb('0x9')]));require(_0xe3fb('0xc'))['register'](socket);function respondWithRpcPromise(_0x2ad2ac,_0xa0fd2b,_0x3c6066){return new BPromise(function(_0x5e69c7,_0x11f49a){return client[_0xe3fb('0xd')](_0x2ad2ac,_0x3c6066)[_0xe3fb('0xe')](function(_0x237d0e){logger['info'](_0xe3fb('0xf'),_0xa0fd2b,'request\x20sent');logger[_0xe3fb('0x10')](_0xe3fb('0x11'),_0xa0fd2b,_0xe3fb('0x12'),JSON[_0xe3fb('0x13')](_0x237d0e));if(_0x237d0e[_0xe3fb('0x14')]){if(_0x237d0e[_0xe3fb('0x14')]['code']===0x1f4){logger[_0xe3fb('0x14')](_0xe3fb('0xf'),_0xa0fd2b,_0x237d0e['error'][_0xe3fb('0x15')]);return _0x11f49a(_0x237d0e[_0xe3fb('0x14')][_0xe3fb('0x15')]);}logger[_0xe3fb('0x14')](_0xe3fb('0xf'),_0xa0fd2b,_0x237d0e[_0xe3fb('0x14')][_0xe3fb('0x15')]);return _0x5e69c7(_0x237d0e['error']['message']);}else{logger[_0xe3fb('0x16')](_0xe3fb('0xf'),_0xa0fd2b,_0xe3fb('0x12'));_0x5e69c7(_0x237d0e[_0xe3fb('0x17')][_0xe3fb('0x15')]);}})[_0xe3fb('0x18')](function(_0x810f26){logger[_0xe3fb('0x14')]('FaxInteraction,\x20%s,\x20%s',_0xa0fd2b,_0x810f26);_0x11f49a(_0x810f26);});});}exports['UpdateFaxInteraction']=function(_0x572bc8){var _0x3c56cb=this;return new Promise(function(_0x542c6a,_0x28446a){return db[_0xe3fb('0x19')][_0xe3fb('0x1a')](_0x572bc8[_0xe3fb('0x1b')],{'raw':_0x572bc8['options']?_0x572bc8[_0xe3fb('0x1c')][_0xe3fb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x572bc8[_0xe3fb('0x1c')]?_0x572bc8['options'][_0xe3fb('0x1e')]||null:null,'attributes':_0x572bc8['options']?_0x572bc8[_0xe3fb('0x1c')][_0xe3fb('0x1f')]||null:null,'limit':_0x572bc8['options']?_0x572bc8[_0xe3fb('0x1c')][_0xe3fb('0x20')]||null:null})[_0xe3fb('0xe')](function(_0x6ad3d1){logger['info'](_0xe3fb('0x21'),_0x572bc8);logger[_0xe3fb('0x10')](_0xe3fb('0x21'),_0x572bc8,JSON[_0xe3fb('0x13')](_0x6ad3d1));_0x542c6a(_0x6ad3d1);})[_0xe3fb('0x18')](function(_0x1b9bdb){logger[_0xe3fb('0x14')](_0xe3fb('0x21'),_0x1b9bdb[_0xe3fb('0x15')],_0x572bc8);_0x28446a(_0x3c56cb[_0xe3fb('0x14')](0x1f4,_0x1b9bdb[_0xe3fb('0x15')]));});});};exports[_0xe3fb('0x22')]=function(_0x428b0f){return new Promise(function(_0x25b644,_0x285501){return db[_0xe3fb('0x19')]['find']({'where':_0x428b0f[_0xe3fb('0x1c')]?_0x428b0f[_0xe3fb('0x1c')][_0xe3fb('0x1e')]||null:null})[_0xe3fb('0xe')](function(_0x13b989){if(_0x13b989){return _0x13b989[_0xe3fb('0x23')](_0x428b0f['body']['ids'],_[_0xe3fb('0x24')](_0x428b0f[_0xe3fb('0x1b')],[_0xe3fb('0x25'),'id'])||{});}})['spread'](function(_0x547f34){logger['info'](_0xe3fb('0x26'),_0x428b0f);logger[_0xe3fb('0x10')](_0xe3fb('0x26'),_0x428b0f,JSON[_0xe3fb('0x13')](_0x547f34));_0x25b644(_0x547f34);})[_0xe3fb('0x18')](function(_0x5de7c7){logger[_0xe3fb('0x14')]('AddTags',_0x5de7c7['message'],_0x428b0f);_0x285501(_this[_0xe3fb('0x14')](0x1f4,_0x5de7c7[_0xe3fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index b389eb6..07eeed0 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 _0xcfd9=['./faxInteraction.events','save','remove','update','emit','removeListener','register','faxInteraction:'];(function(_0x2108a5,_0x2f2d61){var _0x3ef402=function(_0x398f6a){while(--_0x398f6a){_0x2108a5['push'](_0x2108a5['shift']());}};_0x3ef402(++_0x2f2d61);}(_0xcfd9,0x90));var _0x9cfd=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xcfd9[_0x42bc91];return _0x3f5507;};'use strict';var FaxInteractionEvents=require(_0x9cfd('0x0'));var events=[_0x9cfd('0x1'),_0x9cfd('0x2'),_0x9cfd('0x3')];function createListener(_0x1e4f28,_0x114b41){return function(_0x473277){_0x114b41[_0x9cfd('0x4')](_0x1e4f28,_0x473277);};}function removeListener(_0x439f0a,_0x7acf4d){return function(){FaxInteractionEvents[_0x9cfd('0x5')](_0x439f0a,_0x7acf4d);};}exports[_0x9cfd('0x6')]=function(_0x3d406b){for(var _0x3903e8=0x0,_0xb5e8ed=events['length'];_0x3903e8<_0xb5e8ed;_0x3903e8++){var _0x56590a=events[_0x3903e8];var _0x3c73d2=createListener(_0x9cfd('0x7')+_0x56590a,_0x3d406b);FaxInteractionEvents['on'](_0x56590a,_0x3c73d2);}}; \ No newline at end of file +var _0xff00=['length','faxInteraction:','./faxInteraction.events','remove','update','emit','register'];(function(_0x145c99,_0x3fdb01){var _0x52a05f=function(_0x36feb0){while(--_0x36feb0){_0x145c99['push'](_0x145c99['shift']());}};_0x52a05f(++_0x3fdb01);}(_0xff00,0x136));var _0x0ff0=function(_0x212823,_0x28e6f8){_0x212823=_0x212823-0x0;var _0x249d4f=_0xff00[_0x212823];return _0x249d4f;};'use strict';var FaxInteractionEvents=require(_0x0ff0('0x0'));var events=['save',_0x0ff0('0x1'),_0x0ff0('0x2')];function createListener(_0x359c3d,_0x1abca9){return function(_0x51e83f){_0x1abca9[_0x0ff0('0x3')](_0x359c3d,_0x51e83f);};}function removeListener(_0x19cb4b,_0x412e7a){return function(){FaxInteractionEvents['removeListener'](_0x19cb4b,_0x412e7a);};}exports[_0x0ff0('0x4')]=function(_0x3c9d2d){for(var _0x5b732f=0x0,_0x183c49=events[_0x0ff0('0x5')];_0x5b732f<_0x183c49;_0x5b732f++){var _0x4b88d8=events[_0x5b732f];var _0x4c9541=createListener(_0x0ff0('0x6')+_0x4b88d8,_0x3c9d2d);FaxInteractionEvents['on'](_0x4b88d8,_0x4c9541);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 3beb645..4a3d5fe 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 _0xb894=['/describe','describe','/:id','show','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','put','faxinteraction:update','update','delete','destroy','removeTags','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x5d3219,_0x33a3d5){var _0x5b63b7=function(_0x41620f){while(--_0x41620f){_0x5d3219['push'](_0x5d3219['shift']());}};_0x5b63b7(++_0x33a3d5);}(_0xb894,0x171));var _0x4b89=function(_0x46876e,_0x2a5bab){_0x46876e=_0x46876e-0x0;var _0x27b7b5=_0xb894[_0x46876e];return _0x27b7b5;};'use strict';var multer=require(_0x4b89('0x0'));var util=require(_0x4b89('0x1'));var path=require('path');var timeout=require(_0x4b89('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4b89('0x3'));var interaction=require(_0x4b89('0x4'));var config=require(_0x4b89('0x5'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0x4b89('0x6')](),controller[_0x4b89('0x7')]);router[_0x4b89('0x8')](_0x4b89('0x9'),auth['isAuthenticated'](),controller[_0x4b89('0xa')]);router[_0x4b89('0x8')](_0x4b89('0xb'),auth[_0x4b89('0x6')](),controller[_0x4b89('0xc')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x4b89('0x8')](_0x4b89('0xd'),auth[_0x4b89('0x6')](),controller['download']);router[_0x4b89('0xe')]('/',auth[_0x4b89('0x6')](),controller[_0x4b89('0xf')]);router[_0x4b89('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4b89('0x10')]);router[_0x4b89('0xe')](_0x4b89('0x11'),auth['isAuthenticated'](),interaction[_0x4b89('0x12')](_0x4b89('0x13'),'faxinteraction:addtags'),controller['addTags']);router[_0x4b89('0x14')](_0x4b89('0xb'),auth[_0x4b89('0x6')](),interaction['tracked'](_0x4b89('0x13'),_0x4b89('0x15')),controller[_0x4b89('0x16')]);router[_0x4b89('0x17')](_0x4b89('0xb'),auth[_0x4b89('0x6')](),interaction['tracked']('fax','faxinteraction:destroy'),controller[_0x4b89('0x18')]);router[_0x4b89('0x17')](_0x4b89('0x11'),auth[_0x4b89('0x6')](),controller[_0x4b89('0x19')]);module[_0x4b89('0x1a')]=router; \ No newline at end of file +var _0x771a=['index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','removeTags','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated'];(function(_0x5725bd,_0x599ce0){var _0x26caf3=function(_0x574a67){while(--_0x574a67){_0x5725bd['push'](_0x5725bd['shift']());}};_0x26caf3(++_0x599ce0);}(_0x771a,0x1e2));var _0xa771=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x771a[_0x256b72];return _0x2183e3;};'use strict';var multer=require(_0xa771('0x0'));var util=require(_0xa771('0x1'));var path=require(_0xa771('0x2'));var timeout=require('connect-timeout');var express=require(_0xa771('0x3'));var router=express['Router']();var fs_extra=require(_0xa771('0x4'));var auth=require(_0xa771('0x5'));var interaction=require(_0xa771('0x6'));var config=require(_0xa771('0x7'));var controller=require(_0xa771('0x8'));router[_0xa771('0x9')]('/',auth[_0xa771('0xa')](),controller[_0xa771('0xb')]);router['get'](_0xa771('0xc'),auth['isAuthenticated'](),controller[_0xa771('0xd')]);router[_0xa771('0x9')](_0xa771('0xe'),auth[_0xa771('0xa')](),controller[_0xa771('0xf')]);router[_0xa771('0x9')](_0xa771('0x10'),auth['isAuthenticated'](),controller[_0xa771('0x11')]);router[_0xa771('0x9')](_0xa771('0x12'),auth[_0xa771('0xa')](),controller[_0xa771('0x13')]);router[_0xa771('0x14')]('/',auth[_0xa771('0xa')](),controller[_0xa771('0x15')]);router[_0xa771('0x14')](_0xa771('0x10'),auth[_0xa771('0xa')](),controller[_0xa771('0x16')]);router[_0xa771('0x14')](_0xa771('0x17'),auth[_0xa771('0xa')](),interaction[_0xa771('0x18')](_0xa771('0x19'),_0xa771('0x1a')),controller[_0xa771('0x1b')]);router['put']('/:id',auth[_0xa771('0xa')](),interaction[_0xa771('0x18')](_0xa771('0x19'),'faxinteraction:update'),controller['update']);router['delete'](_0xa771('0xe'),auth[_0xa771('0xa')](),interaction[_0xa771('0x18')](_0xa771('0x19'),'faxinteraction:destroy'),controller['destroy']);router['delete'](_0xa771('0x17'),auth[_0xa771('0xa')](),controller[_0xa771('0x1c')]);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 cac6e74..44cc024 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 _0xf874=['ENUM','out','DATE','TEXT','medium','BOOLEAN'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xf874,0xed));var _0x4f87=function(_0x462195,_0x48fe97){_0x462195=_0x462195-0x0;var _0x83d089=_0xf874[_0x462195];return _0x83d089;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x4f87('0x0')](_0x4f87('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x4f87('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f87('0x3')]('in',_0x4f87('0x4')),'defaultValue':_0x4f87('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x4f87('0x5')]}}; \ No newline at end of file +var _0x8cfd=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x44b54f,_0xe07a57){var _0x396a5c=function(_0x3c866d){while(--_0x3c866d){_0x44b54f['push'](_0x44b54f['shift']());}};_0x396a5c(++_0xe07a57);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x4557dc,_0x3687b2){_0x4557dc=_0x4557dc-0x0;var _0x1377aa=_0x8cfd[_0x4557dc];return _0x1377aa;};'use strict';var Sequelize=require(_0xd8cf('0x0'));module[_0xd8cf('0x1')]={'body':{'type':Sequelize[_0xd8cf('0x2')](_0xd8cf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd8cf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd8cf('0x5')]('in','out'),'defaultValue':_0xd8cf('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xd8cf('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd8cf('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 7b02d22..3d49ddd 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 _0x9114=['fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','rows','show','params','length','find','body','describe','accept','fax','read','readAt','format','UserId','user','FaxInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','fullname','event','EventManager','rejectmessage','create','CmContact','findOne','SendFax','FaxAccountId','basename','AttachmentId','download','join','root','Attachment','rimraf','fast-json-patch','path','sox','to-csv'];(function(_0x47d0d4,_0x53ff49){var _0x37719f=function(_0x5058e7){while(--_0x5058e7){_0x47d0d4['push'](_0x47d0d4['shift']());}};_0x37719f(++_0x53ff49);}(_0x9114,0x196));var _0x4911=function(_0x480cff,_0x3ec854){_0x480cff=_0x480cff-0x0;var _0x5cdf08=_0x9114[_0x480cff];return _0x5cdf08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4911('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4911('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(_0x4911('0x2'));var sox=require(_0x4911('0x3'));var csv=require(_0x4911('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4911('0x5'));var _=require(_0x4911('0x6'));var squel=require(_0x4911('0x7'));var crypto=require(_0x4911('0x8'));var jsforce=require(_0x4911('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4911('0x4'));var querystring=require(_0x4911('0xa'));var Papa=require('papaparse');var Redis=require(_0x4911('0xb'));var authService=require(_0x4911('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x4911('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4911('0xe'))(_0x4911('0xf'));var utils=require(_0x4911('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4911('0x11'))['db'];config[_0x4911('0x12')]=_['defaults'](config[_0x4911('0x12')],{'host':_0x4911('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4911('0x14'))[_0x4911('0x15')](socket);var jayson=require(_0x4911('0x16'));var client=jayson[_0x4911('0x17')][_0x4911('0x18')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xccb333,_0x3cbfe3,_0x4e765b,_0x4b48f1){return new BPromise(function(_0xfb2330,_0x462a1e){var _0x2b1c5e=_0x4b48f1||client;return _0x2b1c5e[_0x4911('0x19')](_0xccb333,_0x4e765b)[_0x4911('0x1a')](function(_0xf5e47c){logger[_0x4911('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x3cbfe3,_0x4911('0x1c'));logger['debug'](_0x4911('0x1d'),_0x3cbfe3,_0x4911('0x1c'),JSON[_0x4911('0x1e')](_0xf5e47c));if(_0xf5e47c['error']){if(_0xf5e47c[_0x4911('0x1f')][_0x4911('0x20')]===0x1f4){logger['error'](_0x4911('0x21'),_0x3cbfe3,_0xf5e47c['error'][_0x4911('0x22')]);return _0x462a1e(_0xf5e47c[_0x4911('0x1f')][_0x4911('0x22')]);}logger[_0x4911('0x1f')](_0x4911('0x21'),_0x3cbfe3,_0xf5e47c[_0x4911('0x1f')]['message']);return _0xfb2330(_0xf5e47c['error']['message']);}else{logger['info'](_0x4911('0x21'),_0x3cbfe3,_0x4911('0x1c'));_0xfb2330(_0xf5e47c['result'][_0x4911('0x22')]);}})[_0x4911('0x23')](function(_0x5348e7){logger[_0x4911('0x1f')](_0x4911('0x21'),_0x3cbfe3,_0x5348e7);_0x462a1e(_0x5348e7);});});}function respondWithStatusCode(_0x3e8a5c,_0x18f89a){_0x18f89a=_0x18f89a||0xcc;return function(_0xc4586e){if(_0xc4586e){return _0x3e8a5c[_0x4911('0x24')](_0x18f89a);}return _0x3e8a5c[_0x4911('0x25')](_0x18f89a)['end']();};}function respondWithResult(_0xd2b5f2,_0x4d355f){_0x4d355f=_0x4d355f||0xc8;return function(_0x3b8cb0){if(_0x3b8cb0){return _0xd2b5f2[_0x4911('0x25')](_0x4d355f)[_0x4911('0x26')](_0x3b8cb0);}};}function respondWithFilteredResult(_0x58cf48,_0x58ec26){return function(_0x14b0f8){if(_0x14b0f8){var _0x360a26=typeof _0x58ec26[_0x4911('0x27')]==='undefined'&&typeof _0x58ec26[_0x4911('0x28')]===_0x4911('0x29');var _0x4a66b2=_0x14b0f8[_0x4911('0x2a')];var _0x3e94c0=_0x360a26?0x0:_0x58ec26[_0x4911('0x27')];var _0x36fc66=_0x360a26?_0x14b0f8['count']:_0x58ec26[_0x4911('0x27')]+_0x58ec26['limit'];var _0x30aa5a;if(_0x36fc66>=_0x4a66b2){_0x36fc66=_0x4a66b2;_0x30aa5a=0xc8;}else{_0x30aa5a=0xce;}_0x58cf48[_0x4911('0x25')](_0x30aa5a);return _0x58cf48[_0x4911('0x2b')](_0x4911('0x2c'),_0x3e94c0+'-'+_0x36fc66+'/'+_0x4a66b2)[_0x4911('0x26')](_0x14b0f8);}return null;};}function patchUpdates(_0x39c0f6){return function(_0x46e847){try{jsonpatch[_0x4911('0x2d')](_0x46e847,_0x39c0f6,!![]);}catch(_0x4939f0){return BPromise['reject'](_0x4939f0);}return _0x46e847[_0x4911('0x2e')]();};}function saveUpdates(_0x23a1c9,_0x99cba8){return function(_0x286a7e){if(_0x286a7e){return _0x286a7e[_0x4911('0x2f')](_0x23a1c9)[_0x4911('0x1a')](function(_0x79823a){return _0x79823a;});}return null;};}function removeEntity(_0x3ab33a,_0x1a1367){return function(_0x35a01a){if(_0x35a01a){return _0x35a01a[_0x4911('0x30')]()['then'](function(){_0x3ab33a['status'](0xcc)[_0x4911('0x31')]();});}};}function handleEntityNotFound(_0xc179a6,_0x26fb7a){return function(_0x569b44){if(!_0x569b44){_0xc179a6[_0x4911('0x24')](0x194);}return _0x569b44;};}function handleError(_0x4f6667,_0x40b473){_0x40b473=_0x40b473||0x1f4;return function(_0xa05a5a){logger[_0x4911('0x1f')](_0xa05a5a[_0x4911('0x32')]);if(_0xa05a5a[_0x4911('0x33')]){delete _0xa05a5a['name'];}_0x4f6667[_0x4911('0x25')](_0x40b473)[_0x4911('0x34')](_0xa05a5a);};}exports[_0x4911('0x35')]=function(_0xdd6932,_0x109ed3){var _0x54da98={},_0x29470d={},_0x572bed={'count':0x0,'rows':[]};var _0x2c4458=_[_0x4911('0x36')](db['FaxMessage'][_0x4911('0x37')],function(_0x5e88b9){return{'name':_0x5e88b9[_0x4911('0x38')],'type':_0x5e88b9[_0x4911('0x39')][_0x4911('0x3a')]};});_0x29470d['model']=_[_0x4911('0x36')](_0x2c4458,'name');_0x29470d[_0x4911('0x3b')]=_[_0x4911('0x3c')](_0xdd6932[_0x4911('0x3b')]);_0x29470d['filters']=_[_0x4911('0x3d')](_0x29470d[_0x4911('0x3e')],_0x29470d['query']);_0x54da98[_0x4911('0x3f')]=_[_0x4911('0x3d')](_0x29470d[_0x4911('0x3e')],qs[_0x4911('0x40')](_0xdd6932[_0x4911('0x3b')][_0x4911('0x40')]));_0x54da98[_0x4911('0x3f')]=_0x54da98['attributes']['length']?_0x54da98[_0x4911('0x3f')]:_0x29470d['model'];if(!_0xdd6932[_0x4911('0x3b')][_0x4911('0x41')]('nolimit')){_0x54da98[_0x4911('0x28')]=qs[_0x4911('0x28')](_0xdd6932[_0x4911('0x3b')]['limit']);_0x54da98[_0x4911('0x27')]=qs['offset'](_0xdd6932[_0x4911('0x3b')]['offset']);}_0x54da98[_0x4911('0x42')]=qs['sort'](_0xdd6932[_0x4911('0x3b')][_0x4911('0x43')]);_0x54da98[_0x4911('0x44')]=qs[_0x4911('0x45')](_[_0x4911('0x46')](_0xdd6932[_0x4911('0x3b')],_0x29470d[_0x4911('0x45')]),_0x2c4458);if(_0xdd6932['query'][_0x4911('0x47')]){_0x54da98[_0x4911('0x44')]=_[_0x4911('0x48')](_0x54da98[_0x4911('0x44')],{'$or':_['map'](_0x2c4458,function(_0x56dfd8){if(_0x56dfd8[_0x4911('0x39')]!==_0x4911('0x49')){var _0x2ea637={};_0x2ea637[_0x56dfd8[_0x4911('0x33')]]={'$like':'%'+_0xdd6932[_0x4911('0x3b')][_0x4911('0x47')]+'%'};return _0x2ea637;}})});}_0x54da98=_[_0x4911('0x48')]({},_0x54da98,_0xdd6932[_0x4911('0x4a')]);var _0x37105e={'where':_0x54da98[_0x4911('0x44')]};return db[_0x4911('0x4b')][_0x4911('0x2a')](_0x37105e)[_0x4911('0x1a')](function(_0x2303f6){_0x572bed[_0x4911('0x2a')]=_0x2303f6;if(_0xdd6932['query'][_0x4911('0x4c')]){_0x54da98[_0x4911('0x4d')]=[{'all':!![]}];}return db[_0x4911('0x4b')][_0x4911('0x4e')](_0x54da98);})[_0x4911('0x1a')](function(_0x227ba8){_0x572bed[_0x4911('0x4f')]=_0x227ba8;return _0x572bed;})[_0x4911('0x1a')](respondWithFilteredResult(_0x109ed3,_0x54da98))[_0x4911('0x23')](handleError(_0x109ed3,null));};exports[_0x4911('0x50')]=function(_0x12e8c2,_0x41ef64){var _0x18bd76={'raw':!![],'where':{'id':_0x12e8c2[_0x4911('0x51')]['id']}},_0x581ae4={};_0x581ae4[_0x4911('0x3e')]=_[_0x4911('0x3c')](db[_0x4911('0x4b')][_0x4911('0x37')]);_0x581ae4[_0x4911('0x3b')]=_[_0x4911('0x3c')](_0x12e8c2[_0x4911('0x3b')]);_0x581ae4['filters']=_[_0x4911('0x3d')](_0x581ae4[_0x4911('0x3e')],_0x581ae4[_0x4911('0x3b')]);_0x18bd76[_0x4911('0x3f')]=_[_0x4911('0x3d')](_0x581ae4[_0x4911('0x3e')],qs[_0x4911('0x40')](_0x12e8c2[_0x4911('0x3b')][_0x4911('0x40')]));_0x18bd76[_0x4911('0x3f')]=_0x18bd76[_0x4911('0x3f')][_0x4911('0x52')]?_0x18bd76['attributes']:_0x581ae4[_0x4911('0x3e')];if(_0x12e8c2['query'][_0x4911('0x4c')]){_0x18bd76[_0x4911('0x4d')]=[{'all':!![]}];}_0x18bd76=_['merge']({},_0x18bd76,_0x12e8c2[_0x4911('0x4a')]);return db[_0x4911('0x4b')][_0x4911('0x53')](_0x18bd76)['then'](handleEntityNotFound(_0x41ef64,null))[_0x4911('0x1a')](respondWithResult(_0x41ef64,null))[_0x4911('0x23')](handleError(_0x41ef64,null));};exports[_0x4911('0x2f')]=function(_0x84d05f,_0x500062){if(_0x84d05f['body']['id']){delete _0x84d05f[_0x4911('0x54')]['id'];}return db[_0x4911('0x4b')][_0x4911('0x53')]({'where':{'id':_0x84d05f[_0x4911('0x51')]['id']}})[_0x4911('0x1a')](handleEntityNotFound(_0x500062,null))['then'](saveUpdates(_0x84d05f[_0x4911('0x54')],null))[_0x4911('0x1a')](respondWithResult(_0x500062,null))[_0x4911('0x23')](handleError(_0x500062,null));};exports['destroy']=function(_0x5cd70d,_0x2d669a){return db[_0x4911('0x4b')]['find']({'where':{'id':_0x5cd70d[_0x4911('0x51')]['id']}})[_0x4911('0x1a')](handleEntityNotFound(_0x2d669a,null))[_0x4911('0x1a')](removeEntity(_0x2d669a,null))['catch'](handleError(_0x2d669a,null));};exports['describe']=function(_0x271814,_0x2cdc9c){return db[_0x4911('0x4b')][_0x4911('0x55')]()[_0x4911('0x1a')](respondWithResult(_0x2cdc9c,null))[_0x4911('0x23')](handleError(_0x2cdc9c,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x4911('0x56')]=function(_0x1ea589,_0xe7dd2f,_0x55529a){var _0x30329d={'agent':{},'channel':_0x4911('0x57')};if(_0x1ea589[_0x4911('0x54')]['id']){delete _0x1ea589[_0x4911('0x54')]['id'];}_0x1ea589[_0x4911('0x54')][_0x4911('0x58')]=!![];_0x1ea589['body'][_0x4911('0x59')]=moment()[_0x4911('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ea589[_0x4911('0x54')][_0x4911('0x5b')]=_0x1ea589[_0x4911('0x54')][_0x4911('0x5b')]||_0x1ea589[_0x4911('0x5c')]['id'];_0x30329d['agent']['id']=_0x1ea589[_0x4911('0x54')]['UserId'];return db[_0x4911('0x4b')][_0x4911('0x53')]({'where':{'id':_0x1ea589[_0x4911('0x51')]['id'],'UserId':null}})[_0x4911('0x1a')](handleEntityNotFound(_0xe7dd2f,null))[_0x4911('0x1a')](saveUpdates(_0x1ea589[_0x4911('0x54')],null))[_0x4911('0x1a')](function(_0x5202b9){if(_0x5202b9){_0x30329d[_0x4911('0x22')]=_0x5202b9['get']({'plain':!![]});return db[_0x4911('0x5d')]['find']({'where':{'id':_0x5202b9['FaxInteractionId']}});}return null;})[_0x4911('0x1a')](handleEntityNotFound(_0xe7dd2f,null))[_0x4911('0x1a')](function(_0x464525){if(_0x464525){return _0x464525[_0x4911('0x2f')]({'UserId':_0x1ea589[_0x4911('0x54')][_0x4911('0x5b')],'read1stAt':_[_0x4911('0x5e')](_0x464525[_0x4911('0x5f')])?moment()[_0x4911('0x5a')](_0x4911('0x60')):undefined});}return null;})[_0x4911('0x1a')](function(_0x52b953){if(_0x52b953){_0x30329d[_0x4911('0x61')]=_0x52b953[_0x4911('0x62')]({'plain':!![]});interaction_log[_0x4911('0x1b')](_0x4911('0x63'),_0x1ea589[_0x4911('0x5c')]['id'],_0x1ea589[_0x4911('0x5c')][_0x4911('0x33')],_0x1ea589[_0x4911('0x5c')]['role'],_0x30329d[_0x4911('0x61')]['id'],_0x1ea589['body']?JSON[_0x4911('0x1e')](_0x1ea589[_0x4911('0x54')]):'null');return respondWithRpcPromise(_0x4911('0x64'),_0x4911('0x65'),_0x30329d);}return null;})['then'](function(_0x41dca0){var _0x578a06=_0x4911('0x66')+_0x41dca0[_0x4911('0x22')][_0x4911('0x67')];return db['sequelize'][_0x4911('0x3b')](_0x578a06,{'type':db[_0x4911('0x68')]['QueryTypes'][_0x4911('0x69')],'raw':!![]})['then'](function(_0x2ef522){return _0x2ef522;});})[_0x4911('0x1a')](function(_0x18a652){if(_0x18a652){_0x30329d[_0x4911('0x22')][_0x4911('0x6a')]=_0x18a652[0x0];if(!_0x1ea589[_0x4911('0x54')][_0x4911('0x5b')])return;return db[_0x4911('0x6b')][_0x4911('0x53')]({'where':{'id':_0x1ea589['body'][_0x4911('0x5b')],'role':_0x4911('0x6c')},'attributes':['id','name','fullname',_0x4911('0x6d'),_0x4911('0x6e')],'raw':!![]});}return null;})[_0x4911('0x1a')](function(_0x1ad935){if(!_0x1ad935)return null;_0x30329d[_0x4911('0x22')][_0x4911('0x6c')]=_0x1ad935;return _0x30329d;})[_0x4911('0x1a')](function(_0x59aea1){if(_0x59aea1){if(_0x1ea589['body'][_0x4911('0x6f')]){_0x30329d[_0x4911('0x22')][_0x4911('0x70')]=util[_0x4911('0x5a')](_0x4911('0x71'),_0x1ea589[_0x4911('0x5c')][_0x4911('0x33')]);_0x30329d[_0x4911('0x22')][_0x4911('0x72')]=_0x30329d[_0x4911('0x72')];_0x30329d[_0x4911('0x22')]['event']='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x4911('0x73'),'message':_0x30329d[_0x4911('0x22')]},client9002)['then'](function(){return _0x30329d;});}return _0x30329d;}return null;})[_0x4911('0x1a')](respondWithResult(_0xe7dd2f,null))[_0x4911('0x23')](handleError(_0xe7dd2f,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x4911('0x74')]=function(_0x3bf98e,_0x264b3b,_0x3c7de2){var _0x1b8afb={'agent':{},'channel':_0x4911('0x57')};if(_0x3bf98e[_0x4911('0x54')]['id']){delete _0x3bf98e[_0x4911('0x54')]['id'];}_0x3bf98e[_0x4911('0x54')][_0x4911('0x5b')]=_0x3bf98e[_0x4911('0x54')][_0x4911('0x5b')]||_0x3bf98e['user']['id'];_0x1b8afb[_0x4911('0x6c')]['id']=_0x3bf98e[_0x4911('0x54')][_0x4911('0x5b')];return db[_0x4911('0x4b')][_0x4911('0x53')]({'where':{'id':_0x3bf98e['params']['id'],'UserId':null}})[_0x4911('0x1a')](handleEntityNotFound(_0x264b3b,null))[_0x4911('0x1a')](function(_0x382484){if(_0x382484){_0x1b8afb['message']=_0x382484[_0x4911('0x62')]({'plain':!![]});return db[_0x4911('0x5d')][_0x4911('0x53')]({'where':{'id':_0x382484['FaxInteractionId']}});}return null;})[_0x4911('0x1a')](handleEntityNotFound(_0x264b3b,null))[_0x4911('0x1a')](function(_0x2e2d9f){if(_0x2e2d9f){_0x1b8afb['interaction']=_0x2e2d9f[_0x4911('0x62')]({'plain':!![]});interaction_log[_0x4911('0x1b')](_0x4911('0x75'),_0x3bf98e[_0x4911('0x5c')]['id'],_0x3bf98e['user'][_0x4911('0x33')],_0x3bf98e[_0x4911('0x5c')]['role'],_0x1b8afb[_0x4911('0x61')]['id'],_0x3bf98e[_0x4911('0x54')]?JSON['stringify'](_0x3bf98e[_0x4911('0x54')]):_0x4911('0x76'));return respondWithRpcPromise(_0x4911('0x77'),_0x4911('0x78'),_0x1b8afb);}return null;})[_0x4911('0x1a')](function(_0x31e724){var _0x51e927=_0x4911('0x66')+_0x31e724['message'][_0x4911('0x67')];return db[_0x4911('0x79')][_0x4911('0x3b')](_0x51e927,{'type':db[_0x4911('0x68')]['QueryTypes'][_0x4911('0x69')],'raw':!![]})[_0x4911('0x1a')](function(_0x5ac815){return _0x5ac815;});})['then'](function(_0x1e9686){if(_0x1e9686){_0x1b8afb['message']['contact']=_0x1e9686[0x0];if(!_0x3bf98e[_0x4911('0x54')][_0x4911('0x5b')])return;return db[_0x4911('0x6b')][_0x4911('0x53')]({'where':{'id':_0x3bf98e[_0x4911('0x54')][_0x4911('0x5b')],'role':_0x4911('0x6c')},'attributes':['id',_0x4911('0x33'),_0x4911('0x7a'),_0x4911('0x6d'),_0x4911('0x6e')],'raw':!![]});}return null;})[_0x4911('0x1a')](function(_0x221b09){if(!_0x221b09)return null;_0x1b8afb[_0x4911('0x22')]['agent']=_0x221b09;return _0x1b8afb;})[_0x4911('0x1a')](function(_0xeb0482){if(_0xeb0482){_0xeb0482[_0x4911('0x22')][_0x4911('0x70')]=util[_0x4911('0x5a')](_0x4911('0x71'),_0x3bf98e[_0x4911('0x5c')][_0x4911('0x33')]);_0xeb0482[_0x4911('0x22')][_0x4911('0x72')]=_0x1b8afb['channel'];_0xeb0482[_0x4911('0x22')][_0x4911('0x7b')]=_0x4911('0x74');respondWithRpcPromise(_0x4911('0x7c'),_0x4911('0x7c'),{'event':_0x4911('0x7d'),'message':_0xeb0482[_0x4911('0x22')]},client9002);return _0x1b8afb;}return null;})['then'](respondWithResult(_0x264b3b,null))['catch'](handleError(_0x264b3b,null));};exports[_0x4911('0x7e')]=function(_0x143e51,_0x3f2d98){var _0x27ec3c;return db[_0x4911('0x4b')][_0x4911('0x7e')](_0x143e51[_0x4911('0x54')],{})[_0x4911('0x1a')](function(_0x4f68fd){_0x27ec3c=_0x4f68fd;return db[_0x4911('0x7f')][_0x4911('0x80')]({'where':{'id':_0x27ec3c[_0x4911('0x67')]}});})[_0x4911('0x1a')](function(_0x256ace){if(_[_0x4911('0x5e')](_0x256ace)){return;}else{_0x27ec3c[_0x4911('0x57')]=_0x256ace['fax'];return db['Attachment']['findOne']({'where':{'id':_0x27ec3c['AttachmentId']}});}})['then'](function(_0x1ba0b3){return respondWithRpcPromise(_0x4911('0x81'),_0x4911('0x81'),{'FaxAccountId':_['isNil'](_0x143e51[_0x4911('0x54')])?undefined:_0x143e51[_0x4911('0x54')][_0x4911('0x82')],'path':_[_0x4911('0x5e')](_0x1ba0b3)?undefined:util[_0x4911('0x5a')]('/var/opt/motion2/server/files/attachments/%s',_0x1ba0b3[_0x4911('0x83')]),'fax':_[_0x4911('0x5e')](_0x27ec3c[_0x4911('0x57')])?undefined:_0x27ec3c[_0x4911('0x57')],'AttachmentId':_0x27ec3c[_0x4911('0x84')]},client9002);})[_0x4911('0x1a')](respondWithResult(_0x3f2d98,0xc9))[_0x4911('0x23')](handleError(_0x3f2d98,null));};exports[_0x4911('0x85')]=function(_0xb83382,_0x3d0062){var _0x3b4e6a=path[_0x4911('0x86')](config[_0x4911('0x87')],'server','files','attachments');return db[_0x4911('0x4b')][_0x4911('0x53')]({'where':{'id':_0xb83382[_0x4911('0x51')]['id']},'include':[{'model':db[_0x4911('0x88')],'as':_0x4911('0x88')}]})['then'](handleEntityNotFound(_0x3d0062,null))['then'](function(_0x39a1a4){if(_0x39a1a4){return _0x3d0062[_0x4911('0x85')](path[_0x4911('0x86')](_0x3b4e6a,_0x39a1a4[_0x4911('0x88')][_0x4911('0x83')]));}})[_0x4911('0x23')](handleError(_0x3d0062,null));}; \ No newline at end of file +var _0x7d33=['fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','internal','SIP/%s','channel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','SELECT','email','interface','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','attachments','Attachment','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','http','client','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','body','fax-interactions','accept'];(function(_0x1a5ab8,_0x27f3bb){var _0x2d6c68=function(_0x329288){while(--_0x329288){_0x1a5ab8['push'](_0x1a5ab8['shift']());}};_0x2d6c68(++_0x27f3bb);}(_0x7d33,0xc2));var _0x37d3=function(_0x30f951,_0x3ba029){_0x30f951=_0x30f951-0x0;var _0x17cce0=_0x7d33[_0x30f951];return _0x17cce0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37d3('0x0'));var zipdir=require(_0x37d3('0x1'));var jsonpatch=require(_0x37d3('0x2'));var rp=require('request-promise');var moment=require(_0x37d3('0x3'));var BPromise=require(_0x37d3('0x4'));var Mustache=require('mustache');var util=require(_0x37d3('0x5'));var path=require('path');var sox=require(_0x37d3('0x6'));var csv=require(_0x37d3('0x7'));var ejs=require(_0x37d3('0x8'));var fs=require('fs');var fs_extra=require(_0x37d3('0x9'));var _=require(_0x37d3('0xa'));var squel=require(_0x37d3('0xb'));var crypto=require(_0x37d3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x37d3('0x7'));var querystring=require(_0x37d3('0xd'));var Papa=require(_0x37d3('0xe'));var Redis=require('ioredis');var authService=require(_0x37d3('0xf'));var qs=require(_0x37d3('0x10'));var as=require(_0x37d3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37d3('0x12'))(_0x37d3('0x13'));var utils=require('../../config/utils');var config=require(_0x37d3('0x14'));var licenseUtil=require(_0x37d3('0x15'));var db=require(_0x37d3('0x16'))['db'];config['redis']=_[_0x37d3('0x17')](config[_0x37d3('0x18')],{'host':_0x37d3('0x19'),'port':0x18eb});var socket=require(_0x37d3('0x1a'))(new Redis(config['redis']));require(_0x37d3('0x1b'))['register'](socket);var jayson=require(_0x37d3('0x1c'));var client=jayson['client'][_0x37d3('0x1d')]({'port':0x232c});var client9002=jayson[_0x37d3('0x1e')][_0x37d3('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5c3f73,_0x3a3c8c,_0x1a0209,_0x1387df){return new BPromise(function(_0xc6f31d,_0x282ea0){var _0x3f522a=_0x1387df||client;return _0x3f522a['request'](_0x5c3f73,_0x1a0209)[_0x37d3('0x1f')](function(_0x47246f){logger[_0x37d3('0x20')](_0x37d3('0x21'),_0x3a3c8c,_0x37d3('0x22'));logger[_0x37d3('0x23')](_0x37d3('0x24'),_0x3a3c8c,_0x37d3('0x22'),JSON['stringify'](_0x47246f));if(_0x47246f[_0x37d3('0x25')]){if(_0x47246f[_0x37d3('0x25')][_0x37d3('0x26')]===0x1f4){logger[_0x37d3('0x25')](_0x37d3('0x21'),_0x3a3c8c,_0x47246f['error'][_0x37d3('0x27')]);return _0x282ea0(_0x47246f[_0x37d3('0x25')][_0x37d3('0x27')]);}logger[_0x37d3('0x25')](_0x37d3('0x21'),_0x3a3c8c,_0x47246f[_0x37d3('0x25')][_0x37d3('0x27')]);return _0xc6f31d(_0x47246f[_0x37d3('0x25')][_0x37d3('0x27')]);}else{logger['info'](_0x37d3('0x21'),_0x3a3c8c,'request\x20sent');_0xc6f31d(_0x47246f[_0x37d3('0x28')][_0x37d3('0x27')]);}})[_0x37d3('0x29')](function(_0x3bc4d0){logger[_0x37d3('0x25')](_0x37d3('0x21'),_0x3a3c8c,_0x3bc4d0);_0x282ea0(_0x3bc4d0);});});}function respondWithStatusCode(_0x4b364b,_0x7d239d){_0x7d239d=_0x7d239d||0xcc;return function(_0x5d22b5){if(_0x5d22b5){return _0x4b364b[_0x37d3('0x2a')](_0x7d239d);}return _0x4b364b[_0x37d3('0x2b')](_0x7d239d)[_0x37d3('0x2c')]();};}function respondWithResult(_0x19aa15,_0x2560d8){_0x2560d8=_0x2560d8||0xc8;return function(_0x1e4818){if(_0x1e4818){return _0x19aa15[_0x37d3('0x2b')](_0x2560d8)['json'](_0x1e4818);}};}function respondWithFilteredResult(_0x4fc378,_0x150f0e){return function(_0x45e4d7){if(_0x45e4d7){var _0x4df9bc=typeof _0x150f0e[_0x37d3('0x2d')]===_0x37d3('0x2e')&&typeof _0x150f0e[_0x37d3('0x2f')]==='undefined';var _0x188554=_0x45e4d7[_0x37d3('0x30')];var _0x40a12f=_0x4df9bc?0x0:_0x150f0e[_0x37d3('0x2d')];var _0x2582a1=_0x4df9bc?_0x45e4d7[_0x37d3('0x30')]:_0x150f0e[_0x37d3('0x2d')]+_0x150f0e[_0x37d3('0x2f')];var _0xae1a1d;if(_0x2582a1>=_0x188554){_0x2582a1=_0x188554;_0xae1a1d=0xc8;}else{_0xae1a1d=0xce;}_0x4fc378[_0x37d3('0x2b')](_0xae1a1d);return _0x4fc378[_0x37d3('0x31')](_0x37d3('0x32'),_0x40a12f+'-'+_0x2582a1+'/'+_0x188554)[_0x37d3('0x33')](_0x45e4d7);}return null;};}function patchUpdates(_0x53dffe){return function(_0x187ac8){try{jsonpatch[_0x37d3('0x34')](_0x187ac8,_0x53dffe,!![]);}catch(_0x9d7c6e){return BPromise[_0x37d3('0x35')](_0x9d7c6e);}return _0x187ac8['save']();};}function saveUpdates(_0x1f694a,_0x166c23){return function(_0x52d561){if(_0x52d561){return _0x52d561[_0x37d3('0x36')](_0x1f694a)[_0x37d3('0x1f')](function(_0x6ce2e9){return _0x6ce2e9;});}return null;};}function removeEntity(_0x4bf3f0,_0x574048){return function(_0xfee6cc){if(_0xfee6cc){return _0xfee6cc[_0x37d3('0x37')]()[_0x37d3('0x1f')](function(){_0x4bf3f0[_0x37d3('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f4fe,_0xe3618a){return function(_0x13e7ea){if(!_0x13e7ea){_0x29f4fe[_0x37d3('0x2a')](0x194);}return _0x13e7ea;};}function handleError(_0x3ff738,_0x28e42c){_0x28e42c=_0x28e42c||0x1f4;return function(_0x2c0d87){logger[_0x37d3('0x25')](_0x2c0d87[_0x37d3('0x38')]);if(_0x2c0d87[_0x37d3('0x39')]){delete _0x2c0d87[_0x37d3('0x39')];}_0x3ff738[_0x37d3('0x2b')](_0x28e42c)[_0x37d3('0x3a')](_0x2c0d87);};}exports[_0x37d3('0x3b')]=function(_0x465236,_0x1794f9){var _0x49b78c={},_0x38c82b={},_0x5980c5={'count':0x0,'rows':[]};var _0x3822b6=_[_0x37d3('0x3c')](db[_0x37d3('0x3d')][_0x37d3('0x3e')],function(_0x1fc6a4){return{'name':_0x1fc6a4[_0x37d3('0x3f')],'type':_0x1fc6a4[_0x37d3('0x40')]['key']};});_0x38c82b[_0x37d3('0x41')]=_[_0x37d3('0x3c')](_0x3822b6,_0x37d3('0x39'));_0x38c82b[_0x37d3('0x42')]=_[_0x37d3('0x43')](_0x465236['query']);_0x38c82b[_0x37d3('0x44')]=_[_0x37d3('0x45')](_0x38c82b[_0x37d3('0x41')],_0x38c82b[_0x37d3('0x42')]);_0x49b78c[_0x37d3('0x46')]=_['intersection'](_0x38c82b[_0x37d3('0x41')],qs[_0x37d3('0x47')](_0x465236['query']['fields']));_0x49b78c['attributes']=_0x49b78c[_0x37d3('0x46')][_0x37d3('0x48')]?_0x49b78c[_0x37d3('0x46')]:_0x38c82b[_0x37d3('0x41')];if(!_0x465236[_0x37d3('0x42')][_0x37d3('0x49')](_0x37d3('0x4a'))){_0x49b78c[_0x37d3('0x2f')]=qs[_0x37d3('0x2f')](_0x465236[_0x37d3('0x42')][_0x37d3('0x2f')]);_0x49b78c['offset']=qs['offset'](_0x465236['query'][_0x37d3('0x2d')]);}_0x49b78c[_0x37d3('0x4b')]=qs[_0x37d3('0x4c')](_0x465236['query'][_0x37d3('0x4c')]);_0x49b78c[_0x37d3('0x4d')]=qs[_0x37d3('0x44')](_['pick'](_0x465236['query'],_0x38c82b['filters']),_0x3822b6);if(_0x465236['query'][_0x37d3('0x4e')]){_0x49b78c[_0x37d3('0x4d')]=_[_0x37d3('0x4f')](_0x49b78c['where'],{'$or':_[_0x37d3('0x3c')](_0x3822b6,function(_0x4938a2){if(_0x4938a2['type']!==_0x37d3('0x50')){var _0x56c658={};_0x56c658[_0x4938a2[_0x37d3('0x39')]]={'$like':'%'+_0x465236['query']['filter']+'%'};return _0x56c658;}})});}_0x49b78c=_[_0x37d3('0x4f')]({},_0x49b78c,_0x465236['options']);var _0x40abbe={'where':_0x49b78c[_0x37d3('0x4d')]};return db[_0x37d3('0x3d')]['count'](_0x40abbe)[_0x37d3('0x1f')](function(_0x1e6762){_0x5980c5[_0x37d3('0x30')]=_0x1e6762;if(_0x465236[_0x37d3('0x42')][_0x37d3('0x51')]){_0x49b78c[_0x37d3('0x52')]=[{'all':!![]}];}return db[_0x37d3('0x3d')][_0x37d3('0x53')](_0x49b78c);})[_0x37d3('0x1f')](function(_0x5b325f){_0x5980c5[_0x37d3('0x54')]=_0x5b325f;return _0x5980c5;})[_0x37d3('0x1f')](respondWithFilteredResult(_0x1794f9,_0x49b78c))[_0x37d3('0x29')](handleError(_0x1794f9,null));};exports[_0x37d3('0x55')]=function(_0x3b8481,_0x16d8d6){var _0xc89bb5={'raw':!![],'where':{'id':_0x3b8481[_0x37d3('0x56')]['id']}},_0x33384e={};_0x33384e['model']=_['keys'](db[_0x37d3('0x3d')][_0x37d3('0x3e')]);_0x33384e[_0x37d3('0x42')]=_[_0x37d3('0x43')](_0x3b8481[_0x37d3('0x42')]);_0x33384e[_0x37d3('0x44')]=_[_0x37d3('0x45')](_0x33384e[_0x37d3('0x41')],_0x33384e['query']);_0xc89bb5[_0x37d3('0x46')]=_[_0x37d3('0x45')](_0x33384e['model'],qs[_0x37d3('0x47')](_0x3b8481[_0x37d3('0x42')][_0x37d3('0x47')]));_0xc89bb5[_0x37d3('0x46')]=_0xc89bb5['attributes'][_0x37d3('0x48')]?_0xc89bb5['attributes']:_0x33384e[_0x37d3('0x41')];if(_0x3b8481[_0x37d3('0x42')][_0x37d3('0x51')]){_0xc89bb5['include']=[{'all':!![]}];}_0xc89bb5=_['merge']({},_0xc89bb5,_0x3b8481[_0x37d3('0x57')]);return db[_0x37d3('0x3d')][_0x37d3('0x58')](_0xc89bb5)[_0x37d3('0x1f')](handleEntityNotFound(_0x16d8d6,null))['then'](respondWithResult(_0x16d8d6,null))['catch'](handleError(_0x16d8d6,null));};exports['update']=function(_0x598e4b,_0x13e9f9){if(_0x598e4b[_0x37d3('0x59')]['id']){delete _0x598e4b['body']['id'];}return db[_0x37d3('0x3d')][_0x37d3('0x58')]({'where':{'id':_0x598e4b[_0x37d3('0x56')]['id']}})[_0x37d3('0x1f')](handleEntityNotFound(_0x13e9f9,null))['then'](saveUpdates(_0x598e4b[_0x37d3('0x59')],null))[_0x37d3('0x1f')](respondWithResult(_0x13e9f9,null))['catch'](handleError(_0x13e9f9,null));};exports[_0x37d3('0x37')]=function(_0x57fde1,_0x49e35e){return db[_0x37d3('0x3d')][_0x37d3('0x58')]({'where':{'id':_0x57fde1[_0x37d3('0x56')]['id']}})[_0x37d3('0x1f')](handleEntityNotFound(_0x49e35e,null))[_0x37d3('0x1f')](removeEntity(_0x49e35e,null))[_0x37d3('0x29')](handleError(_0x49e35e,null));};exports['describe']=function(_0x88724e,_0x421543){return db[_0x37d3('0x3d')]['describe']()[_0x37d3('0x1f')](respondWithResult(_0x421543,null))[_0x37d3('0x29')](handleError(_0x421543,null));};var interaction_log=require('../../config/logger')(_0x37d3('0x5a'));exports[_0x37d3('0x5b')]=function(_0x4d7b97,_0x2659ce,_0x3c8861){var _0x4860b8={'agent':{},'channel':_0x37d3('0x5c')};if(_0x4d7b97[_0x37d3('0x59')]['id']){delete _0x4d7b97[_0x37d3('0x59')]['id'];}_0x4d7b97['body']['read']=!![];_0x4d7b97[_0x37d3('0x59')][_0x37d3('0x5d')]=moment()[_0x37d3('0x5e')](_0x37d3('0x5f'));_0x4d7b97[_0x37d3('0x59')][_0x37d3('0x60')]=_0x4d7b97[_0x37d3('0x59')][_0x37d3('0x60')]||_0x4d7b97[_0x37d3('0x61')]['id'];_0x4860b8[_0x37d3('0x62')]['id']=_0x4d7b97[_0x37d3('0x59')][_0x37d3('0x60')];return db['FaxMessage'][_0x37d3('0x58')]({'where':{'id':_0x4d7b97[_0x37d3('0x56')]['id'],'UserId':null}})[_0x37d3('0x1f')](handleEntityNotFound(_0x2659ce,null))[_0x37d3('0x1f')](saveUpdates(_0x4d7b97[_0x37d3('0x59')],null))['then'](function(_0x90d178){if(_0x90d178){_0x4860b8[_0x37d3('0x27')]=_0x90d178[_0x37d3('0x63')]({'plain':!![]});return db[_0x37d3('0x64')][_0x37d3('0x58')]({'where':{'id':_0x90d178[_0x37d3('0x65')]}});}return null;})[_0x37d3('0x1f')](handleEntityNotFound(_0x2659ce,null))[_0x37d3('0x1f')](function(_0x5ef3c4){if(_0x5ef3c4){return _0x5ef3c4[_0x37d3('0x36')]({'UserId':_0x4d7b97[_0x37d3('0x59')][_0x37d3('0x60')],'read1stAt':_[_0x37d3('0x66')](_0x5ef3c4[_0x37d3('0x67')])?moment()[_0x37d3('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x37d3('0x1f')](function(_0x51bf97){if(_0x51bf97){_0x4860b8[_0x37d3('0x68')]=_0x51bf97['get']({'plain':!![]});interaction_log[_0x37d3('0x20')](_0x37d3('0x69'),_0x4d7b97[_0x37d3('0x61')]['id'],_0x4d7b97[_0x37d3('0x61')][_0x37d3('0x39')],_0x4d7b97[_0x37d3('0x61')][_0x37d3('0x6a')],_0x4860b8[_0x37d3('0x68')]['id'],_0x4d7b97[_0x37d3('0x59')]?JSON[_0x37d3('0x6b')](_0x4d7b97[_0x37d3('0x59')]):_0x37d3('0x6c'));return respondWithRpcPromise(_0x37d3('0x6d'),_0x37d3('0x6e'),_0x4860b8);}return null;})[_0x37d3('0x1f')](function(_0x2c3fa2){var _0x130654=_0x37d3('0x6f')+_0x2c3fa2['message'][_0x37d3('0x70')];return db[_0x37d3('0x71')][_0x37d3('0x42')](_0x130654,{'type':db['Sequelize'][_0x37d3('0x72')]['SELECT'],'raw':!![]})['then'](function(_0x5deaec){return _0x5deaec;});})[_0x37d3('0x1f')](function(_0x28a25b){if(_0x28a25b){_0x4860b8[_0x37d3('0x27')][_0x37d3('0x73')]=_0x28a25b[0x0];if(!_0x4d7b97['body'][_0x37d3('0x60')])return;return db[_0x37d3('0x74')][_0x37d3('0x58')]({'where':{'id':_0x4d7b97[_0x37d3('0x59')][_0x37d3('0x60')],'role':'agent'},'attributes':['id',_0x37d3('0x39'),_0x37d3('0x75'),'email',_0x37d3('0x76')],'raw':!![]});}return null;})[_0x37d3('0x1f')](function(_0x107bde){if(!_0x107bde)return null;_0x4860b8[_0x37d3('0x27')][_0x37d3('0x62')]=_0x107bde;return _0x4860b8;})[_0x37d3('0x1f')](function(_0x10f8ba){if(_0x10f8ba){if(_0x4d7b97[_0x37d3('0x59')]['manual']){_0x4860b8[_0x37d3('0x27')]['interface']=util['format'](_0x37d3('0x77'),_0x4d7b97['user']['name']);_0x4860b8[_0x37d3('0x27')][_0x37d3('0x78')]=_0x4860b8[_0x37d3('0x78')];_0x4860b8[_0x37d3('0x27')][_0x37d3('0x79')]='accept';return respondWithRpcPromise('EventManager',_0x37d3('0x7a'),{'event':_0x37d3('0x7b'),'message':_0x4860b8[_0x37d3('0x27')]},client9002)[_0x37d3('0x1f')](function(){return _0x4860b8;});}return _0x4860b8;}return null;})['then'](respondWithResult(_0x2659ce,null))[_0x37d3('0x29')](handleError(_0x2659ce,null));};var interaction_log=require(_0x37d3('0x12'))(_0x37d3('0x5a'));exports[_0x37d3('0x35')]=function(_0x4ddd87,_0x18dc6a,_0x3b75e7){var _0x39e1db={'agent':{},'channel':_0x37d3('0x5c')};if(_0x4ddd87[_0x37d3('0x59')]['id']){delete _0x4ddd87[_0x37d3('0x59')]['id'];}_0x4ddd87['body'][_0x37d3('0x60')]=_0x4ddd87[_0x37d3('0x59')][_0x37d3('0x60')]||_0x4ddd87[_0x37d3('0x61')]['id'];_0x39e1db[_0x37d3('0x62')]['id']=_0x4ddd87[_0x37d3('0x59')][_0x37d3('0x60')];return db[_0x37d3('0x3d')]['find']({'where':{'id':_0x4ddd87['params']['id'],'UserId':null}})[_0x37d3('0x1f')](handleEntityNotFound(_0x18dc6a,null))[_0x37d3('0x1f')](function(_0x31a07e){if(_0x31a07e){_0x39e1db['message']=_0x31a07e['get']({'plain':!![]});return db[_0x37d3('0x64')]['find']({'where':{'id':_0x31a07e[_0x37d3('0x65')]}});}return null;})[_0x37d3('0x1f')](handleEntityNotFound(_0x18dc6a,null))[_0x37d3('0x1f')](function(_0x13c84d){if(_0x13c84d){_0x39e1db['interaction']=_0x13c84d['get']({'plain':!![]});interaction_log[_0x37d3('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ddd87[_0x37d3('0x61')]['id'],_0x4ddd87[_0x37d3('0x61')][_0x37d3('0x39')],_0x4ddd87['user']['role'],_0x39e1db['interaction']['id'],_0x4ddd87['body']?JSON[_0x37d3('0x6b')](_0x4ddd87[_0x37d3('0x59')]):_0x37d3('0x6c'));return respondWithRpcPromise(_0x37d3('0x7c'),_0x37d3('0x7d'),_0x39e1db);}return null;})[_0x37d3('0x1f')](function(_0x5cff8f){var _0x2a8972=_0x37d3('0x6f')+_0x5cff8f['message'][_0x37d3('0x70')];return db[_0x37d3('0x71')]['query'](_0x2a8972,{'type':db['Sequelize'][_0x37d3('0x72')][_0x37d3('0x7e')],'raw':!![]})[_0x37d3('0x1f')](function(_0x4f9bd0){return _0x4f9bd0;});})[_0x37d3('0x1f')](function(_0xadcd92){if(_0xadcd92){_0x39e1db['message'][_0x37d3('0x73')]=_0xadcd92[0x0];if(!_0x4ddd87['body'][_0x37d3('0x60')])return;return db[_0x37d3('0x74')][_0x37d3('0x58')]({'where':{'id':_0x4ddd87[_0x37d3('0x59')][_0x37d3('0x60')],'role':'agent'},'attributes':['id',_0x37d3('0x39'),_0x37d3('0x75'),_0x37d3('0x7f'),_0x37d3('0x76')],'raw':!![]});}return null;})['then'](function(_0x42302c){if(!_0x42302c)return null;_0x39e1db[_0x37d3('0x27')][_0x37d3('0x62')]=_0x42302c;return _0x39e1db;})['then'](function(_0x54c106){if(_0x54c106){_0x54c106['message'][_0x37d3('0x80')]=util[_0x37d3('0x5e')](_0x37d3('0x77'),_0x4ddd87[_0x37d3('0x61')][_0x37d3('0x39')]);_0x54c106[_0x37d3('0x27')][_0x37d3('0x78')]=_0x39e1db[_0x37d3('0x78')];_0x54c106[_0x37d3('0x27')]['event']='reject';respondWithRpcPromise(_0x37d3('0x7a'),_0x37d3('0x7a'),{'event':_0x37d3('0x81'),'message':_0x54c106['message']},client9002);return _0x39e1db;}return null;})[_0x37d3('0x1f')](respondWithResult(_0x18dc6a,null))[_0x37d3('0x29')](handleError(_0x18dc6a,null));};exports[_0x37d3('0x82')]=function(_0x156fe3,_0x4561ef){var _0x240288;return db[_0x37d3('0x3d')][_0x37d3('0x82')](_0x156fe3[_0x37d3('0x59')],{})[_0x37d3('0x1f')](function(_0x173eaf){_0x240288=_0x173eaf;return db[_0x37d3('0x83')][_0x37d3('0x84')]({'where':{'id':_0x240288[_0x37d3('0x70')]}});})[_0x37d3('0x1f')](function(_0x2952dd){if(_[_0x37d3('0x66')](_0x2952dd)){return;}else{_0x240288[_0x37d3('0x5c')]=_0x2952dd[_0x37d3('0x5c')];return db['Attachment'][_0x37d3('0x84')]({'where':{'id':_0x240288[_0x37d3('0x85')]}});}})['then'](function(_0x2371a0){return respondWithRpcPromise('SendFax',_0x37d3('0x86'),{'FaxAccountId':_['isNil'](_0x156fe3[_0x37d3('0x59')])?undefined:_0x156fe3[_0x37d3('0x59')][_0x37d3('0x87')],'path':_[_0x37d3('0x66')](_0x2371a0)?undefined:util[_0x37d3('0x5e')]('/var/opt/motion2/server/files/attachments/%s',_0x2371a0[_0x37d3('0x88')]),'fax':_[_0x37d3('0x66')](_0x240288['fax'])?undefined:_0x240288[_0x37d3('0x5c')],'AttachmentId':_0x240288['AttachmentId']},client9002);})['then'](respondWithResult(_0x4561ef,0xc9))[_0x37d3('0x29')](handleError(_0x4561ef,null));};exports[_0x37d3('0x89')]=function(_0x4cee4f,_0x16b2ae){var _0x2938be=path[_0x37d3('0x8a')](config[_0x37d3('0x8b')],_0x37d3('0x8c'),'files',_0x37d3('0x8d'));return db[_0x37d3('0x3d')][_0x37d3('0x58')]({'where':{'id':_0x4cee4f[_0x37d3('0x56')]['id']},'include':[{'model':db[_0x37d3('0x8e')],'as':_0x37d3('0x8e')}]})[_0x37d3('0x1f')](handleEntityNotFound(_0x16b2ae,null))['then'](function(_0x34310d){if(_0x34310d){return _0x16b2ae[_0x37d3('0x89')](path[_0x37d3('0x8a')](_0x2938be,_0x34310d[_0x37d3('0x8e')][_0x37d3('0x88')]));}})[_0x37d3('0x29')](handleError(_0x16b2ae,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 068790d..881086f 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 _0x647c=['FaxMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x44240c,_0x147c6c){var _0x2b500f=function(_0x378435){while(--_0x378435){_0x44240c['push'](_0x44240c['shift']());}};_0x2b500f(++_0x147c6c);}(_0x647c,0x1d3));var _0xc647=function(_0x1aeb39,_0x2e8404){_0x1aeb39=_0x1aeb39-0x0;var _0x439790=_0x647c[_0x1aeb39];return _0x439790;};'use strict';var EventEmitter=require(_0xc647('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xc647('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc647('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc647('0x3'),'afterDestroy':_0xc647('0x4')};function emitEvent(_0x12bd28){return function(_0x339174,_0x2719dc,_0x535407){FaxMessageEvents[_0xc647('0x5')](_0x12bd28+':'+_0x339174['id'],_0x339174);FaxMessageEvents[_0xc647('0x5')](_0x12bd28,_0x339174);_0x535407(null);};}for(var e in events){if(events[_0xc647('0x6')](e)){var event=events[e];FaxMessage[_0xc647('0x7')](e,emitEvent(event));}}module[_0xc647('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xe062=['remove','emit','events','../../mysqldb','save','update'];(function(_0x49481d,_0xd95b74){var _0x27dd6e=function(_0xee3740){while(--_0xee3740){_0x49481d['push'](_0x49481d['shift']());}};_0x27dd6e(++_0xd95b74);}(_0xe062,0x1b8));var _0x2e06=function(_0x3451d2,_0x42ee59){_0x3451d2=_0x3451d2-0x0;var _0x5ae189=_0xe062[_0x3451d2];return _0x5ae189;};'use strict';var EventEmitter=require(_0x2e06('0x0'));var FaxMessage=require(_0x2e06('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e06('0x2'),'afterUpdate':_0x2e06('0x3'),'afterDestroy':_0x2e06('0x4')};function emitEvent(_0x304308){return function(_0x361a02,_0x28e970,_0x22aacc){FaxMessageEvents[_0x2e06('0x5')](_0x304308+':'+_0x361a02['id'],_0x361a02);FaxMessageEvents[_0x2e06('0x5')](_0x304308,_0x361a02);_0x22aacc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 9800249..6bc7350 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 _0x5204=['moment','request-promise','rimraf','../../config/environment','exports','define','FaxMessage','body','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x43c8ea,_0x1a9f13){var _0x26f063=function(_0x562380){while(--_0x562380){_0x43c8ea['push'](_0x43c8ea['shift']());}};_0x26f063(++_0x1a9f13);}(_0x5204,0x18b));var _0x4520=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0x5204[_0x53c4f8];return _0x416458;};'use strict';var _=require('lodash');var util=require(_0x4520('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4520('0x1'));var BPromise=require('bluebird');var rp=require(_0x4520('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4520('0x3'));var config=require(_0x4520('0x4'));var attributes=require('./faxMessage.attributes');module[_0x4520('0x5')]=function(_0x4b68e8,_0x23b64a){return _0x4b68e8[_0x4520('0x6')](_0x4520('0x7'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x4520('0x8')],'type':_0x4520('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c2c7b,_0x41b928,_0x3b1592){var _0x31b607=_0x4b68e8['models'];var _0x256f4f=_0x1c2c7b[_0x4520('0xa')]({'plain':!![]});if(_0x256f4f['direction'][_0x4520('0xb')]()==='in'||_0x256f4f[_0x4520('0xc')][_0x4520('0xb')]()===_0x4520('0xd')&&!_0x256f4f[_0x4520('0xe')]&&!_[_0x4520('0xf')](_0x256f4f['UserId'])){_0x31b607['FaxInteraction']['findOne']({'where':{'id':_0x256f4f['FaxInteractionId']}})[_0x4520('0x10')](function(_0x22654c){if(_0x22654c){_0x22654c[_0x4520('0x11')]({'lastMsgAt':_0x256f4f[_0x4520('0x12')],'lastMsgDirection':_0x256f4f[_0x4520('0xc')]['toLowerCase']()});}})[_0x4520('0x13')](function(_0x2933de){console['error'](_0x2933de);});}_0x3b1592();}},'charset':_0x4520('0x14'),'collate':_0x4520('0x15')});}; \ No newline at end of file +var _0xc469=['models','get','direction','toLowerCase','out','secret','UserId','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','body','FULLTEXT'];(function(_0x2d90cc,_0x45bb4e){var _0x227a99=function(_0x3bab2c){while(--_0x3bab2c){_0x2d90cc['push'](_0x2d90cc['shift']());}};_0x227a99(++_0x45bb4e);}(_0xc469,0x9a));var _0x9c46=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xc469[_0x58c20f];return _0x3b0318;};'use strict';var _=require(_0x9c46('0x0'));var util=require(_0x9c46('0x1'));var logger=require(_0x9c46('0x2'))(_0x9c46('0x3'));var moment=require('moment');var BPromise=require(_0x9c46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c46('0x5'));var rimraf=require(_0x9c46('0x6'));var config=require(_0x9c46('0x7'));var attributes=require(_0x9c46('0x8'));module[_0x9c46('0x9')]=function(_0x916dd,_0x1c6b2a){return _0x916dd[_0x9c46('0xa')](_0x9c46('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x9c46('0xc')],'type':_0x9c46('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25a700,_0x5e507d,_0x579e0b){var _0x413251=_0x916dd[_0x9c46('0xe')];var _0x3ae848=_0x25a700[_0x9c46('0xf')]({'plain':!![]});if(_0x3ae848[_0x9c46('0x10')]['toLowerCase']()==='in'||_0x3ae848[_0x9c46('0x10')][_0x9c46('0x11')]()===_0x9c46('0x12')&&!_0x3ae848[_0x9c46('0x13')]&&!_['isNil'](_0x3ae848[_0x9c46('0x14')])){_0x413251['FaxInteraction'][_0x9c46('0x15')]({'where':{'id':_0x3ae848[_0x9c46('0x16')]}})[_0x9c46('0x17')](function(_0x4deea1){if(_0x4deea1){_0x4deea1[_0x9c46('0x18')]({'lastMsgAt':_0x3ae848[_0x9c46('0x19')],'lastMsgDirection':_0x3ae848['direction']['toLowerCase']()});}})['catch'](function(_0x1003d9){console[_0x9c46('0x1a')](_0x1003d9);});}_0x579e0b();}},'charset':_0x9c46('0x1b'),'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 39eeb77..201d265 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 _0x17ba=['CreateFaxMessage','FaxMessage','create','options','raw','info','UpdateFaxMessage','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0xfb8f04,_0x224147){var _0x4cff81=function(_0x458858){while(--_0x458858){_0xfb8f04['push'](_0xfb8f04['shift']());}};_0x4cff81(++_0x224147);}(_0x17ba,0xab));var _0xa17b=function(_0x1cd03b,_0x84600){_0x1cd03b=_0x1cd03b-0x0;var _0xdbf048=_0x17ba[_0x1cd03b];return _0xdbf048;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});config[_0xa17b('0xd')]=_[_0xa17b('0xe')](config[_0xa17b('0xd')],{'host':_0xa17b('0xf'),'port':0x18eb});var socket=require(_0xa17b('0x10'))(new Redis(config[_0xa17b('0xd')]));require(_0xa17b('0x11'))[_0xa17b('0x12')](socket);function respondWithRpcPromise(_0x578799,_0x2556c4,_0x38b8f1){return new BPromise(function(_0x322dc0,_0x1e799a){return client[_0xa17b('0x13')](_0x578799,_0x38b8f1)[_0xa17b('0x14')](function(_0xc5ef2e){logger['info'](_0xa17b('0x15'),_0x2556c4,_0xa17b('0x16'));logger[_0xa17b('0x17')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'),JSON[_0xa17b('0x18')](_0xc5ef2e));if(_0xc5ef2e[_0xa17b('0x19')]){if(_0xc5ef2e[_0xa17b('0x19')]['code']===0x1f4){logger[_0xa17b('0x19')]('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xc5ef2e[_0xa17b('0x19')][_0xa17b('0x1a')]);return _0x1e799a(_0xc5ef2e['error'][_0xa17b('0x1a')]);}logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0xc5ef2e[_0xa17b('0x19')]['message']);return _0x322dc0(_0xc5ef2e[_0xa17b('0x19')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'));_0x322dc0(_0xc5ef2e[_0xa17b('0x1b')]['message']);}})[_0xa17b('0x1c')](function(_0x166d44){logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0x166d44);_0x1e799a(_0x166d44);});});}exports[_0xa17b('0x1d')]=function(_0x1ecaa2){var _0x24afc2=this;return new Promise(function(_0x584a0a,_0x610c2b){return db[_0xa17b('0x1e')][_0xa17b('0x1f')](_0x1ecaa2['body'],{'raw':_0x1ecaa2[_0xa17b('0x20')]?_0x1ecaa2[_0xa17b('0x20')][_0xa17b('0x21')]===undefined?!![]:![]:!![]})[_0xa17b('0x14')](function(_0x3c7ec2){logger[_0xa17b('0x22')]('CreateFaxMessage',_0x1ecaa2);logger[_0xa17b('0x17')]('CreateFaxMessage',_0x1ecaa2,JSON[_0xa17b('0x18')](_0x3c7ec2));_0x584a0a(_0x3c7ec2);})[_0xa17b('0x1c')](function(_0x4ba608){logger['error'](_0xa17b('0x1d'),_0x4ba608[_0xa17b('0x1a')],_0x1ecaa2);_0x610c2b(_0x24afc2[_0xa17b('0x19')](0x1f4,_0x4ba608[_0xa17b('0x1a')]));});});};exports[_0xa17b('0x23')]=function(_0x3a64f5){var _0x4cd38e=this;return new Promise(function(_0x47aff8,_0x5c98fe){return db['FaxMessage'][_0xa17b('0x24')](_0x3a64f5['body'],{'raw':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5['options'][_0xa17b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x25')]||null:null,'attributes':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x26')]||null:null,'limit':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x27')]||null:null})[_0xa17b('0x14')](function(_0x573585){logger['info']('UpdateFaxMessage',_0x3a64f5);logger[_0xa17b('0x17')](_0xa17b('0x23'),_0x3a64f5,JSON[_0xa17b('0x18')](_0x573585));_0x47aff8(_0x573585);})[_0xa17b('0x1c')](function(_0x16dd1f){logger[_0xa17b('0x19')](_0xa17b('0x23'),_0x16dd1f[_0xa17b('0x1a')],_0x3a64f5);_0x5c98fe(_0x4cd38e['error'](0x1f4,_0x16dd1f[_0xa17b('0x1a')]));});});}; \ No newline at end of file +var _0x55ca=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','code','error','message','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','ioredis'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x55ca,0x126));var _0xa55c=function(_0x11b3f4,_0x371c17){_0x11b3f4=_0x11b3f4-0x0;var _0x47af1d=_0x55ca[_0x11b3f4];return _0x47af1d;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});config[_0xa55c('0xa')]=_['defaults'](config[_0xa55c('0xa')],{'host':_0xa55c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0xa')]));require(_0xa55c('0xc'))['register'](socket);function respondWithRpcPromise(_0x5849ad,_0x473d0e,_0x20c76a){return new BPromise(function(_0x381d07,_0x5d8e5a){return client[_0xa55c('0xd')](_0x5849ad,_0x20c76a)[_0xa55c('0xe')](function(_0x508342){logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x473d0e,_0xa55c('0x11'),JSON['stringify'](_0x508342));if(_0x508342['error']){if(_0x508342['error'][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x5d8e5a(_0x508342[_0xa55c('0x13')]['message']);}logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x381d07(_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);}else{logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));_0x381d07(_0x508342['result'][_0xa55c('0x14')]);}})[_0xa55c('0x15')](function(_0x461284){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x461284);_0x5d8e5a(_0x461284);});});}exports[_0xa55c('0x16')]=function(_0x4c0daf){var _0x5f5158=this;return new Promise(function(_0xd643cc,_0x3776ac){return db[_0xa55c('0x17')]['create'](_0x4c0daf[_0xa55c('0x18')],{'raw':_0x4c0daf[_0xa55c('0x19')]?_0x4c0daf['options'][_0xa55c('0x1a')]===undefined?!![]:![]:!![]})[_0xa55c('0xe')](function(_0x940f28){logger[_0xa55c('0xf')](_0xa55c('0x16'),_0x4c0daf);logger['debug'](_0xa55c('0x16'),_0x4c0daf,JSON['stringify'](_0x940f28));_0xd643cc(_0x940f28);})['catch'](function(_0x59d89a){logger[_0xa55c('0x13')]('CreateFaxMessage',_0x59d89a[_0xa55c('0x14')],_0x4c0daf);_0x3776ac(_0x5f5158[_0xa55c('0x13')](0x1f4,_0x59d89a[_0xa55c('0x14')]));});});};exports[_0xa55c('0x1b')]=function(_0x2313a9){var _0x170ba4=this;return new Promise(function(_0x1da633,_0x11e7f7){return db[_0xa55c('0x17')][_0xa55c('0x1c')](_0x2313a9[_0xa55c('0x18')],{'raw':_0x2313a9['options']?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')]['where']||null:null,'attributes':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1d')]||null:null,'limit':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1e')]||null:null})['then'](function(_0x23e698){logger['info'](_0xa55c('0x1b'),_0x2313a9);logger[_0xa55c('0x1f')](_0xa55c('0x1b'),_0x2313a9,JSON[_0xa55c('0x20')](_0x23e698));_0x1da633(_0x23e698);})['catch'](function(_0x3d28fb){logger[_0xa55c('0x13')](_0xa55c('0x1b'),_0x3d28fb[_0xa55c('0x14')],_0x2313a9);_0x11e7f7(_0x170ba4[_0xa55c('0x13')](0x1f4,_0x3d28fb[_0xa55c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 48517e6..593a1de 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 _0x0e88=['./faxMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x591fe5,_0x9d84e3){var _0xd5d738=function(_0x2029e7){while(--_0x2029e7){_0x591fe5['push'](_0x591fe5['shift']());}};_0xd5d738(++_0x9d84e3);}(_0x0e88,0x134));var _0x80e8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0e88[_0xa464c9];return _0x3d73c4;};'use strict';var FaxMessageEvents=require(_0x80e8('0x0'));var events=[_0x80e8('0x1'),_0x80e8('0x2'),_0x80e8('0x3')];function createListener(_0x61b62e,_0x3eb9cc){return function(_0x4bac8f){_0x3eb9cc[_0x80e8('0x4')](_0x61b62e,_0x4bac8f);};}function removeListener(_0x52a859,_0x478bb4){return function(){FaxMessageEvents[_0x80e8('0x5')](_0x52a859,_0x478bb4);};}exports['register']=function(_0x3f8428){for(var _0x1cf21d=0x0,_0x20740f=events[_0x80e8('0x6')];_0x1cf21d<_0x20740f;_0x1cf21d++){var _0x50913f=events[_0x1cf21d];var _0x4ec8a4=createListener('faxMessage:'+_0x50913f,_0x3f8428);FaxMessageEvents['on'](_0x50913f,_0x4ec8a4);}}; \ No newline at end of file +var _0x4eaf=['emit','removeListener','register','./faxMessage.events','remove'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0x4eaf,0x11b));var _0xf4ea=function(_0x42c9f4,_0x59c356){_0x42c9f4=_0x42c9f4-0x0;var _0x11d3c5=_0x4eaf[_0x42c9f4];return _0x11d3c5;};'use strict';var FaxMessageEvents=require(_0xf4ea('0x0'));var events=['save',_0xf4ea('0x1'),'update'];function createListener(_0x12b49e,_0x8a5c9){return function(_0x22f028){_0x8a5c9[_0xf4ea('0x2')](_0x12b49e,_0x22f028);};}function removeListener(_0x3c8de9,_0x986efc){return function(){FaxMessageEvents[_0xf4ea('0x3')](_0x3c8de9,_0x986efc);};}exports[_0xf4ea('0x4')]=function(_0x195265){for(var _0x457b7c=0x0,_0x27efd8=events['length'];_0x457b7c<_0x27efd8;_0x457b7c++){var _0x43ab3f=events[_0x457b7c];var _0x3ede17=createListener('faxMessage:'+_0x43ab3f,_0x195265);FaxMessageEvents['on'](_0x43ab3f,_0x3ede17);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index d3bc321..973a529 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 _0x22fb=['destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','update','put','/:id/accept','accept','delete'];(function(_0x89cb3a,_0x385fd1){var _0x407cf1=function(_0x61fa77){while(--_0x61fa77){_0x89cb3a['push'](_0x89cb3a['shift']());}};_0x407cf1(++_0x385fd1);}(_0x22fb,0x192));var _0xb22f=function(_0x467454,_0x3b2932){_0x467454=_0x467454-0x0;var _0x33ebdc=_0x22fb[_0x467454];return _0x33ebdc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0x7')](_0xb22f('0xe'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')]('/',auth[_0xb22f('0x8')](),interaction['tracked']('fax','faxmessage:create'),controller[_0xb22f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb22f('0x12')]);router[_0xb22f('0x13')](_0xb22f('0x14'),auth[_0xb22f('0x8')](),controller[_0xb22f('0x15')]);router[_0xb22f('0x13')]('/:id/reject',auth[_0xb22f('0x8')](),controller['reject']);router[_0xb22f('0x16')]('/:id',auth[_0xb22f('0x8')](),controller[_0xb22f('0x17')]);module[_0xb22f('0x18')]=router; \ No newline at end of file +var _0xb4e6=['/:id/download','download','post','tracked','fax','create','put','/:id','update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','show'];(function(_0x3dae3c,_0x3d61c3){var _0x326b20=function(_0xa4ec0d){while(--_0xa4ec0d){_0x3dae3c['push'](_0x3dae3c['shift']());}};_0x326b20(++_0x3d61c3);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xb4e6[_0x254d9f];return _0x1eedb9;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router['get']('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x9')](_0x6b4e('0xd'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')]('/',auth['isAuthenticated'](),interaction[_0x6b4e('0x10')](_0x6b4e('0x11'),'faxmessage:create'),controller[_0x6b4e('0x12')]);router[_0x6b4e('0x13')](_0x6b4e('0x14'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x15')]);router[_0x6b4e('0x13')](_0x6b4e('0x16'),auth['isAuthenticated'](),controller[_0x6b4e('0x17')]);router[_0x6b4e('0x13')]('/:id/reject',auth[_0x6b4e('0xa')](),controller['reject']);router[_0x6b4e('0x18')](_0x6b4e('0x14'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x19')]);module[_0x6b4e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index c2a1490..c0595c6 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 _0xc9b0=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x462567,_0x4fac65){var _0x5f77=function(_0x33aeb4){while(--_0x33aeb4){_0x462567['push'](_0x462567['shift']());}};_0x5f77(++_0x4fac65);}(_0xc9b0,0x14c));var _0x0c9b=function(_0x866420,_0x202648){_0x866420=_0x866420-0x0;var _0x20b90f=_0xc9b0[_0x866420];return _0x20b90f;};'use strict';var Sequelize=require(_0x0c9b('0x0'));module[_0x0c9b('0x1')]={'name':{'type':Sequelize[_0x0c9b('0x2')],'unique':_0x0c9b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0c9b('0x2')]},'timeout':{'type':Sequelize[_0x0c9b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0c9b('0x5')](_0x0c9b('0x6'),_0x0c9b('0x7'),_0x0c9b('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0c9b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x556a=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x556a,0x1dd));var _0xa556=function(_0x40e246,_0xa5d7be){_0x40e246=_0x40e246-0x0;var _0x260d76=_0x556a[_0x40e246];return _0x260d76;};'use strict';var Sequelize=require(_0xa556('0x0'));module[_0xa556('0x1')]={'name':{'type':Sequelize[_0xa556('0x2')],'unique':_0xa556('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa556('0x2')]},'timeout':{'type':Sequelize[_0xa556('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa556('0x5')](_0xa556('0x6'),_0xa556('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa556('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 2c8939d..b4ee409 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 _0x2ed6=['limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','FaxQueues','UserProfileResource','sendStatus','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','user','get','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','pick','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','addTeams','Agents','online','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','field','tq.TeamId','from','join','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','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','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset'];(function(_0x1284d5,_0x5ef7eb){var _0x4e1972=function(_0x3ed82c){while(--_0x3ed82c){_0x1284d5['push'](_0x1284d5['shift']());}};_0x4e1972(++_0x5ef7eb);}(_0x2ed6,0x6a));var _0x62ed=function(_0x1126e3,_0x2299b5){_0x1126e3=_0x1126e3-0x0;var _0x424a76=_0x2ed6[_0x1126e3];return _0x424a76;};'use strict';var emlformat=require(_0x62ed('0x0'));var rimraf=require(_0x62ed('0x1'));var zipdir=require(_0x62ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x62ed('0x3'));var BPromise=require(_0x62ed('0x4'));var Mustache=require(_0x62ed('0x5'));var util=require('util');var path=require(_0x62ed('0x6'));var sox=require(_0x62ed('0x7'));var csv=require(_0x62ed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62ed('0x9'));var _=require(_0x62ed('0xa'));var squel=require(_0x62ed('0xb'));var crypto=require('crypto');var jsforce=require(_0x62ed('0xc'));var deskjs=require(_0x62ed('0xd'));var toCsv=require(_0x62ed('0x8'));var querystring=require(_0x62ed('0xe'));var Papa=require('papaparse');var Redis=require(_0x62ed('0xf'));var authService=require(_0x62ed('0x10'));var qs=require(_0x62ed('0x11'));var as=require(_0x62ed('0x12'));var hardwareService=require(_0x62ed('0x13'));var logger=require(_0x62ed('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x62ed('0x15'));var licenseUtil=require(_0x62ed('0x16'));var db=require(_0x62ed('0x17'))['db'];config[_0x62ed('0x18')]=_[_0x62ed('0x19')](config[_0x62ed('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x62ed('0x1a'))(new Redis(config[_0x62ed('0x18')]));require(_0x62ed('0x1b'))[_0x62ed('0x1c')](socket);function respondWithStatusCode(_0x33af02,_0x4b1dc0){_0x4b1dc0=_0x4b1dc0||0xcc;return function(_0x3c51c4){if(_0x3c51c4){return _0x33af02['sendStatus'](_0x4b1dc0);}return _0x33af02[_0x62ed('0x1d')](_0x4b1dc0)[_0x62ed('0x1e')]();};}function respondWithResult(_0x57b3ee,_0x308e6d){_0x308e6d=_0x308e6d||0xc8;return function(_0x229d9f){if(_0x229d9f){return _0x57b3ee[_0x62ed('0x1d')](_0x308e6d)[_0x62ed('0x1f')](_0x229d9f);}};}function respondWithFilteredResult(_0x2c05ae,_0x1c1444){return function(_0xbc634f){if(_0xbc634f){var _0x4cafb3=typeof _0x1c1444[_0x62ed('0x20')]==='undefined'&&typeof _0x1c1444[_0x62ed('0x21')]===_0x62ed('0x22');var _0x519f6e=_0xbc634f[_0x62ed('0x23')];var _0x13b316=_0x4cafb3?0x0:_0x1c1444['offset'];var _0x5bf32e=_0x4cafb3?_0xbc634f[_0x62ed('0x23')]:_0x1c1444[_0x62ed('0x20')]+_0x1c1444['limit'];var _0x373a39;if(_0x5bf32e>=_0x519f6e){_0x5bf32e=_0x519f6e;_0x373a39=0xc8;}else{_0x373a39=0xce;}_0x2c05ae[_0x62ed('0x1d')](_0x373a39);return _0x2c05ae[_0x62ed('0x24')](_0x62ed('0x25'),_0x13b316+'-'+_0x5bf32e+'/'+_0x519f6e)[_0x62ed('0x1f')](_0xbc634f);}return null;};}function patchUpdates(_0x2c9217){return function(_0x1b955b){try{jsonpatch[_0x62ed('0x26')](_0x1b955b,_0x2c9217,!![]);}catch(_0x2713c9){return BPromise[_0x62ed('0x27')](_0x2713c9);}return _0x1b955b['save']();};}function saveUpdates(_0x154bc6,_0x262f85){return function(_0x39f8cf){if(_0x39f8cf){return _0x39f8cf[_0x62ed('0x28')](_0x154bc6)[_0x62ed('0x29')](function(_0xc08eed){return _0xc08eed;});}return null;};}function removeEntity(_0x2fe5fa,_0x33e1e9){return function(_0x432fb1){if(_0x432fb1){return _0x432fb1[_0x62ed('0x2a')]()[_0x62ed('0x29')](function(){var _0x3b8b27=_0x432fb1['get']({'plain':!![]});var _0x53c326=_0x62ed('0x2b');return db[_0x62ed('0x2c')][_0x62ed('0x2a')]({'where':{'type':_0x53c326,'resourceId':_0x3b8b27['id']}})[_0x62ed('0x29')](function(){return _0x432fb1;});})['then'](function(){_0x2fe5fa['status'](0xcc)[_0x62ed('0x1e')]();});}};}function handleEntityNotFound(_0x17ce77,_0x169087){return function(_0x3114b6){if(!_0x3114b6){_0x17ce77[_0x62ed('0x2d')](0x194);}return _0x3114b6;};}function handleError(_0x46a37d,_0x49859a){_0x49859a=_0x49859a||0x1f4;return function(_0x224497){logger['error'](_0x224497[_0x62ed('0x2e')]);if(_0x224497[_0x62ed('0x2f')]){delete _0x224497[_0x62ed('0x2f')];}_0x46a37d[_0x62ed('0x1d')](_0x49859a)[_0x62ed('0x30')](_0x224497);};}exports[_0x62ed('0x31')]=function(_0x475a79,_0x23d095){var _0x2bf042={},_0x3f39ca={},_0x4f0e87={'count':0x0,'rows':[]};var _0x2da0e4=_[_0x62ed('0x32')](db[_0x62ed('0x33')][_0x62ed('0x34')],function(_0x134d9e){return{'name':_0x134d9e[_0x62ed('0x35')],'type':_0x134d9e[_0x62ed('0x36')][_0x62ed('0x37')]};});_0x3f39ca['model']=_[_0x62ed('0x32')](_0x2da0e4,_0x62ed('0x2f'));_0x3f39ca['query']=_['keys'](_0x475a79[_0x62ed('0x38')]);_0x3f39ca['filters']=_[_0x62ed('0x39')](_0x3f39ca[_0x62ed('0x3a')],_0x3f39ca[_0x62ed('0x38')]);_0x2bf042[_0x62ed('0x3b')]=_[_0x62ed('0x39')](_0x3f39ca[_0x62ed('0x3a')],qs['fields'](_0x475a79['query'][_0x62ed('0x3c')]));_0x2bf042['attributes']=_0x2bf042[_0x62ed('0x3b')][_0x62ed('0x3d')]?_0x2bf042[_0x62ed('0x3b')]:_0x3f39ca[_0x62ed('0x3a')];if(!_0x475a79[_0x62ed('0x38')][_0x62ed('0x3e')](_0x62ed('0x3f'))){_0x2bf042[_0x62ed('0x21')]=qs[_0x62ed('0x21')](_0x475a79[_0x62ed('0x38')][_0x62ed('0x21')]);_0x2bf042[_0x62ed('0x20')]=qs[_0x62ed('0x20')](_0x475a79[_0x62ed('0x38')]['offset']);}_0x2bf042[_0x62ed('0x40')]=qs[_0x62ed('0x41')](_0x475a79[_0x62ed('0x38')]['sort']);_0x2bf042[_0x62ed('0x42')]=qs[_0x62ed('0x43')](_['pick'](_0x475a79[_0x62ed('0x38')],_0x3f39ca[_0x62ed('0x43')]),_0x2da0e4);if(_0x475a79[_0x62ed('0x38')][_0x62ed('0x44')]){_0x2bf042[_0x62ed('0x42')]=_[_0x62ed('0x45')](_0x2bf042['where'],{'$or':_['map'](_0x2da0e4,function(_0x20a4bf){if(_0x20a4bf[_0x62ed('0x36')]!==_0x62ed('0x46')){var _0x94d81e={};_0x94d81e[_0x20a4bf['name']]={'$like':'%'+_0x475a79[_0x62ed('0x38')][_0x62ed('0x44')]+'%'};return _0x94d81e;}})});}_0x2bf042=_['merge']({},_0x2bf042,_0x475a79[_0x62ed('0x47')]);var _0x3db384={'where':_0x2bf042[_0x62ed('0x42')]};return db['FaxQueue'][_0x62ed('0x23')](_0x3db384)[_0x62ed('0x29')](function(_0x2add5e){_0x4f0e87['count']=_0x2add5e;if(_0x475a79[_0x62ed('0x38')][_0x62ed('0x48')]){_0x2bf042['include']=[{'all':!![]}];}return db['FaxQueue'][_0x62ed('0x49')](_0x2bf042);})['then'](function(_0x2e3a86){_0x4f0e87[_0x62ed('0x4a')]=_0x2e3a86;return _0x4f0e87;})[_0x62ed('0x29')](respondWithFilteredResult(_0x23d095,_0x2bf042))[_0x62ed('0x4b')](handleError(_0x23d095,null));};exports[_0x62ed('0x4c')]=function(_0x3c4f11,_0x358f6e){var _0x335993={'raw':!![],'where':{'id':_0x3c4f11[_0x62ed('0x4d')]['id']}},_0x2a34ee={};_0x2a34ee[_0x62ed('0x3a')]=_[_0x62ed('0x4e')](db[_0x62ed('0x33')]['rawAttributes']);_0x2a34ee[_0x62ed('0x38')]=_['keys'](_0x3c4f11[_0x62ed('0x38')]);_0x2a34ee['filters']=_[_0x62ed('0x39')](_0x2a34ee[_0x62ed('0x3a')],_0x2a34ee['query']);_0x335993[_0x62ed('0x3b')]=_[_0x62ed('0x39')](_0x2a34ee[_0x62ed('0x3a')],qs[_0x62ed('0x3c')](_0x3c4f11['query'][_0x62ed('0x3c')]));_0x335993[_0x62ed('0x3b')]=_0x335993[_0x62ed('0x3b')][_0x62ed('0x3d')]?_0x335993[_0x62ed('0x3b')]:_0x2a34ee['model'];if(_0x3c4f11[_0x62ed('0x38')][_0x62ed('0x48')]){_0x335993['include']=[{'all':!![]}];}_0x335993=_[_0x62ed('0x45')]({},_0x335993,_0x3c4f11[_0x62ed('0x47')]);return db[_0x62ed('0x33')][_0x62ed('0x4f')](_0x335993)['then'](handleEntityNotFound(_0x358f6e,null))[_0x62ed('0x29')](respondWithResult(_0x358f6e,null))[_0x62ed('0x4b')](handleError(_0x358f6e,null));};exports[_0x62ed('0x50')]=function(_0x2420ee,_0x4cb50e){return db[_0x62ed('0x33')]['create'](_0x2420ee[_0x62ed('0x51')],{})[_0x62ed('0x29')](function(_0x3fbb7e){var _0x5c3df5=_0x2420ee[_0x62ed('0x52')][_0x62ed('0x53')]({'plain':!![]});if(!_0x5c3df5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c3df5[_0x62ed('0x54')]===_0x62ed('0x52')){var _0x2b9e24=_0x3fbb7e[_0x62ed('0x53')]({'plain':!![]});var _0x1a1945='FaxQueues';return db[_0x62ed('0x55')][_0x62ed('0x4f')]({'where':{'name':_0x1a1945,'userProfileId':_0x5c3df5[_0x62ed('0x56')]},'raw':!![]})[_0x62ed('0x29')](function(_0x36ce29){if(_0x36ce29&&_0x36ce29['autoAssociation']===0x0){return db[_0x62ed('0x2c')][_0x62ed('0x50')]({'name':_0x2b9e24['name'],'resourceId':_0x2b9e24['id'],'type':_0x36ce29['name'],'sectionId':_0x36ce29['id']},{})[_0x62ed('0x29')](function(){return _0x3fbb7e;});}else{return _0x3fbb7e;}})[_0x62ed('0x4b')](function(_0x443f37){logger[_0x62ed('0x57')](_0x62ed('0x58'),_0x443f37);throw _0x443f37;});}return _0x3fbb7e;})[_0x62ed('0x29')](respondWithResult(_0x4cb50e,0xc9))[_0x62ed('0x4b')](handleError(_0x4cb50e,null));};exports[_0x62ed('0x28')]=function(_0x4d4c9c,_0x52d362){if(_0x4d4c9c[_0x62ed('0x51')]['id']){delete _0x4d4c9c['body']['id'];}return db[_0x62ed('0x33')][_0x62ed('0x4f')]({'where':{'id':_0x4d4c9c['params']['id']}})[_0x62ed('0x29')](handleEntityNotFound(_0x52d362,null))[_0x62ed('0x29')](saveUpdates(_0x4d4c9c[_0x62ed('0x51')],null))[_0x62ed('0x29')](respondWithResult(_0x52d362,null))['catch'](handleError(_0x52d362,null));};exports[_0x62ed('0x2a')]=function(_0x1c32c7,_0x59a682){return db[_0x62ed('0x33')][_0x62ed('0x4f')]({'where':{'id':_0x1c32c7['params']['id']}})[_0x62ed('0x29')](handleEntityNotFound(_0x59a682,null))['then'](removeEntity(_0x59a682,null))[_0x62ed('0x4b')](handleError(_0x59a682,null));};exports[_0x62ed('0x59')]=function(_0x38c831,_0x3663c4){return db[_0x62ed('0x33')][_0x62ed('0x59')]()[_0x62ed('0x29')](respondWithResult(_0x3663c4,null))[_0x62ed('0x4b')](handleError(_0x3663c4,null));};exports['getMembers']=function(_0x1a5c83,_0x59f62f,_0x115734){var _0x4b9b25={'raw':!![],'where':{}},_0x2fc17d={},_0x593e68;return db[_0x62ed('0x33')][_0x62ed('0x5a')]({'where':{'id':_0x1a5c83[_0x62ed('0x4d')]['id']}})[_0x62ed('0x29')](handleEntityNotFound(_0x59f62f,null))[_0x62ed('0x29')](function(_0x1c3ca6){if(_0x1c3ca6){_0x593e68=_0x1c3ca6['get']({'plain':!![]});_0x2fc17d[_0x62ed('0x3a')]=_['keys'](db[_0x62ed('0x5b')][_0x62ed('0x34')]);_0x2fc17d[_0x62ed('0x38')]=_[_0x62ed('0x4e')](_0x1a5c83[_0x62ed('0x38')]);_0x2fc17d['filters']=_[_0x62ed('0x39')](_0x2fc17d['model'],_0x2fc17d[_0x62ed('0x38')]);_0x4b9b25['attributes']=_['intersection'](_0x2fc17d['model'],qs[_0x62ed('0x3c')](_0x1a5c83['query']['fields']));_0x4b9b25['attributes']=_0x4b9b25['attributes'][_0x62ed('0x3d')]?_0x4b9b25[_0x62ed('0x3b')]:_0x2fc17d['model'];if(!_0x1a5c83[_0x62ed('0x38')]['hasOwnProperty']('nolimit')){_0x4b9b25[_0x62ed('0x21')]=qs[_0x62ed('0x21')](_0x1a5c83['query'][_0x62ed('0x21')]);_0x4b9b25[_0x62ed('0x20')]=qs[_0x62ed('0x20')](_0x1a5c83[_0x62ed('0x38')][_0x62ed('0x20')]);}_0x4b9b25[_0x62ed('0x40')]=qs['sort'](_0x1a5c83[_0x62ed('0x38')][_0x62ed('0x41')]);_0x4b9b25['where']=qs[_0x62ed('0x43')](_[_0x62ed('0x5c')](_0x1a5c83['query'],_0x2fc17d[_0x62ed('0x43')]));_0x4b9b25[_0x62ed('0x42')][_0x62ed('0x5d')]=_0x1c3ca6['id'];if(_0x1a5c83[_0x62ed('0x38')][_0x62ed('0x44')]){_0x4b9b25[_0x62ed('0x42')]=_['merge'](_0x4b9b25[_0x62ed('0x42')],{'$or':_[_0x62ed('0x32')](_0x4b9b25[_0x62ed('0x3b')],function(_0x5e4807){var _0xbb7ffb={};_0xbb7ffb[_0x5e4807]={'$like':'%'+_0x1a5c83[_0x62ed('0x38')][_0x62ed('0x44')]+'%'};return _0xbb7ffb;})});}_0x4b9b25=_[_0x62ed('0x45')]({},_0x4b9b25,_0x1a5c83[_0x62ed('0x47')]);return db[_0x62ed('0x5b')][_0x62ed('0x49')](_0x4b9b25);}})[_0x62ed('0x29')](function(_0x32aac0){if(_0x32aac0){return db[_0x62ed('0x5e')][_0x62ed('0x5f')]({'where':{'id':_['map'](_0x32aac0,_0x62ed('0x60')),'role':'agent'},'attributes':['id','name',_0x62ed('0x61'),_0x62ed('0x62'),_0x62ed('0x63')]});}})[_0x62ed('0x29')](function(_0x353e09){if(_0x353e09){return{'count':_0x353e09[_0x62ed('0x23')],'rows':_['map'](_0x353e09[_0x62ed('0x4a')],function(_0x553bd9){return{'membername':_0x553bd9[_0x62ed('0x2f')],'UserId':_0x553bd9['id'],'queue_name':_0x593e68[_0x62ed('0x2f')],'FaxQueueId':_0x593e68['id'],'interface':util['format'](_0x62ed('0x64'),_0x62ed('0x65'),_0x553bd9[_0x62ed('0x2f')]),'penalty':0x0,'paused':_0x553bd9[_0x62ed('0x61')],'createdAt':_0x553bd9[_0x62ed('0x63')],'updatedAt':_0x553bd9[_0x62ed('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x62ed('0x29')](respondWithFilteredResult(_0x59f62f,_0x4b9b25))[_0x62ed('0x4b')](handleError(_0x59f62f,null));};exports['getTeams']=function(_0x2cb04c,_0x33f147,_0x111e3c){var _0x36f1a2={};var _0x8ab322={};var _0x2c2c19;var _0xe03b8d;return db['FaxQueue'][_0x62ed('0x5a')]({'where':{'id':_0x2cb04c[_0x62ed('0x4d')]['id']}})[_0x62ed('0x29')](handleEntityNotFound(_0x33f147,null))[_0x62ed('0x29')](function(_0x5ebbbd){if(_0x5ebbbd){_0x2c2c19=_0x5ebbbd;_0x8ab322[_0x62ed('0x3a')]=_[_0x62ed('0x4e')](db[_0x62ed('0x66')]['rawAttributes']);_0x8ab322['query']=_[_0x62ed('0x4e')](_0x2cb04c[_0x62ed('0x38')]);_0x8ab322[_0x62ed('0x43')]=_[_0x62ed('0x39')](_0x8ab322[_0x62ed('0x3a')],_0x8ab322[_0x62ed('0x38')]);_0x36f1a2[_0x62ed('0x3b')]=_[_0x62ed('0x39')](_0x8ab322['model'],qs['fields'](_0x2cb04c[_0x62ed('0x38')][_0x62ed('0x3c')]));_0x36f1a2['attributes']=_0x36f1a2[_0x62ed('0x3b')][_0x62ed('0x3d')]?_0x36f1a2[_0x62ed('0x3b')]:_0x8ab322['model'];_0x36f1a2['order']=qs[_0x62ed('0x41')](_0x2cb04c[_0x62ed('0x38')][_0x62ed('0x41')]);_0x36f1a2['where']=qs[_0x62ed('0x43')](_[_0x62ed('0x5c')](_0x2cb04c[_0x62ed('0x38')],_0x8ab322[_0x62ed('0x43')]));if(_0x2cb04c[_0x62ed('0x38')][_0x62ed('0x44')]){_0x36f1a2[_0x62ed('0x42')]=_['merge'](_0x36f1a2[_0x62ed('0x42')],{'$or':_[_0x62ed('0x32')](_0x36f1a2['attributes'],function(_0x440e99){var _0x437a53={};_0x437a53[_0x440e99]={'$like':'%'+_0x2cb04c[_0x62ed('0x38')][_0x62ed('0x44')]+'%'};return _0x437a53;})});}_0x36f1a2=_['merge']({},_0x36f1a2,_0x2cb04c[_0x62ed('0x47')]);return _0x2c2c19[_0x62ed('0x67')](_0x36f1a2);}})['then'](function(_0x4f15ef){if(_0x4f15ef){_0xe03b8d=_0x4f15ef['length'];if(!_0x2cb04c['query'][_0x62ed('0x3e')](_0x62ed('0x3f'))){_0x36f1a2[_0x62ed('0x21')]=qs[_0x62ed('0x21')](_0x2cb04c['query']['limit']);_0x36f1a2[_0x62ed('0x20')]=qs[_0x62ed('0x20')](_0x2cb04c['query'][_0x62ed('0x20')]);}return _0x2c2c19[_0x62ed('0x67')](_0x36f1a2);}})[_0x62ed('0x29')](function(_0x3b40e2){if(_0x3b40e2){return _0x3b40e2?{'count':_0xe03b8d,'rows':_0x3b40e2}:null;}})['then'](respondWithResult(_0x33f147,null))[_0x62ed('0x4b')](handleError(_0x33f147,null));};exports[_0x62ed('0x68')]=function(_0x4d896b,_0x58ef3f,_0x1a4681){var _0x41dd25=_0x4d896b[_0x62ed('0x51')]['ids'];return db[_0x62ed('0x66')][_0x62ed('0x49')]({'where':{'id':_0x41dd25},'attributes':['id'],'include':[{'model':db[_0x62ed('0x5e')],'as':_0x62ed('0x69'),'attributes':['id','name',_0x62ed('0x6a'),'voicePause',_0x62ed('0x6b')],'raw':!![]}]})[_0x62ed('0x29')](function(_0x180ed7){if(_0x180ed7){var _0x27d013=_['flatMap'](_0x180ed7,function(_0x3d418c){var _0x48fb04=_0x3d418c[_0x62ed('0x53')]({'plain':!![]});return _0x48fb04[_0x62ed('0x69')];});return db['FaxQueue'][_0x62ed('0x4f')]({'where':{'id':_0x4d896b['params']['id']}})[_0x62ed('0x29')](function(_0x193ebb){return db[_0x62ed('0x6c')][_0x62ed('0x6d')](function(_0x11106d){return _0x193ebb[_0x62ed('0x68')](_0x41dd25,{'transaction':_0x11106d})[_0x62ed('0x29')](function(){return BPromise[_0x62ed('0x6e')](_0x27d013,function(_0x583cf1){return db[_0x62ed('0x5b')][_0x62ed('0x6f')]({'where':{'UserId':_0x583cf1['id'],'FaxQueueId':_0x4d896b[_0x62ed('0x4d')]['id']},'transaction':_0x11106d});});})[_0x62ed('0x29')](function(){_0x27d013[_0x62ed('0x70')](function(_0xca3a12){socket[_0x62ed('0x71')](_0x62ed('0x72'),{'UserId':_0xca3a12['id'],'FaxQueueId':_0x193ebb['id']});});});});});}})[_0x62ed('0x29')](respondWithStatusCode(_0x58ef3f,null))[_0x62ed('0x4b')](handleError(_0x58ef3f,null));};exports[_0x62ed('0x73')]=function(_0x3079c1,_0x521d91,_0x40bfbf){return db['Team']['findAll']({'where':{'id':_0x3079c1[_0x62ed('0x38')][_0x62ed('0x74')]},'attributes':['id'],'include':[{'model':db[_0x62ed('0x5e')],'as':_0x62ed('0x69'),'attributes':['id'],'raw':!![]}]})[_0x62ed('0x29')](handleEntityNotFound(_0x521d91,null))[_0x62ed('0x29')](function(_0x36aba8){var _0x47b9d1=_[_0x62ed('0x32')](_0x36aba8,'id');var _0x529e95=[];var _0x23daae=[];var _0x3c6ceb=squel['select']();_0x3c6ceb[_0x62ed('0x75')](_0x62ed('0x76'))[_0x62ed('0x77')]('team_has_fax_queues','tq')[_0x62ed('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x62ed('0x42')](_0x62ed('0x79'),_0x3079c1[_0x62ed('0x4d')]['id']);for(var _0x259ee4=0x0;_0x259ee4<_0x36aba8['length'];_0x259ee4+=0x1){let _0x350047=_0x36aba8[_0x259ee4];for(var _0x5aee0e=0x0;_0x5aee0e<_0x350047[_0x62ed('0x69')]['length'];_0x5aee0e+=0x1){let _0x423c01=_0x350047[_0x62ed('0x69')][_0x5aee0e];var _0x1e2e98=_0x3c6ceb['clone']();_0x1e2e98['where'](_0x62ed('0x7a'),_0x423c01['id']);_0x23daae[_0x62ed('0x7b')](db[_0x62ed('0x6c')][_0x62ed('0x38')](_0x1e2e98[_0x62ed('0x7c')](),{'type':db[_0x62ed('0x6c')][_0x62ed('0x7d')][_0x62ed('0x7e')]})[_0x62ed('0x29')](function(_0x280bdd){if(_0x280bdd[_0x62ed('0x3d')]===0x1){return _0x423c01['id'];}else{var _0x1d838a=_[_0x62ed('0x7f')](_['map'](_0x280bdd,_0x62ed('0x80')),function(_0x4e6eff){return _[_0x62ed('0x81')](_0x47b9d1,_0x4e6eff);});if(_0x1d838a){return _0x423c01['id'];}}}));}}return BPromise[_0x62ed('0x82')](_0x23daae)[_0x62ed('0x29')](function(_0x36c67b){_0x529e95=_(_0x529e95)['union'](_0x36c67b)[_0x62ed('0x83')]()['value']();return db[_0x62ed('0x33')]['find']({'where':{'id':_0x3079c1[_0x62ed('0x4d')]['id']}})[_0x62ed('0x29')](function(_0x4806c1){return db[_0x62ed('0x6c')]['transaction'](function(_0x5852cd){return _0x4806c1[_0x62ed('0x73')](_0x3079c1['query']['ids'],{'transaction':_0x5852cd})['then'](function(){if(!_[_0x62ed('0x84')](_0x529e95)){return _0x4806c1[_0x62ed('0x85')](_0x529e95,{'transaction':_0x5852cd});}})[_0x62ed('0x29')](function(){_0x529e95[_0x62ed('0x70')](function(_0x1894fb){socket['emit'](_0x62ed('0x86'),{'UserId':_0x1894fb,'FaxQueueId':_0x4806c1['id']});});});});});});})[_0x62ed('0x29')](respondWithStatusCode(_0x521d91,null))[_0x62ed('0x4b')](handleError(_0x521d91,null));};exports[_0x62ed('0x87')]=function(_0x2cd430,_0x5c53bf,_0x29a574){return db['FaxQueue'][_0x62ed('0x4f')]({'where':{'id':_0x2cd430[_0x62ed('0x4d')]['id']}})[_0x62ed('0x29')](handleEntityNotFound(_0x5c53bf,null))[_0x62ed('0x29')](function(_0x3a79bc){if(_0x3a79bc){return _0x3a79bc[_0x62ed('0x87')](_0x2cd430[_0x62ed('0x51')][_0x62ed('0x74')],_[_0x62ed('0x88')](_0x2cd430[_0x62ed('0x51')],[_0x62ed('0x74'),'id'])||{})[_0x62ed('0x89')](function(_0x41cfac){for(var _0x5a4536=0x0;_0x5a4536<_0x2cd430['body']['ids'][_0x62ed('0x3d')];_0x5a4536+=0x1){socket[_0x62ed('0x71')]('userFaxQueue:save',{'UserId':Number(_0x2cd430[_0x62ed('0x51')][_0x62ed('0x74')][_0x5a4536]),'FaxQueueId':Number(_0x2cd430[_0x62ed('0x4d')]['id'])});}return _0x41cfac;});}})[_0x62ed('0x29')](respondWithResult(_0x5c53bf,null))[_0x62ed('0x4b')](handleError(_0x5c53bf,null));};exports[_0x62ed('0x85')]=function(_0x5e22e3,_0x652426,_0x3558ec){return db[_0x62ed('0x33')][_0x62ed('0x4f')]({'where':{'id':_0x5e22e3[_0x62ed('0x4d')]['id']}})[_0x62ed('0x29')](handleEntityNotFound(_0x652426,null))[_0x62ed('0x29')](function(_0xe71015){if(_0xe71015){return _0xe71015[_0x62ed('0x85')](_0x5e22e3[_0x62ed('0x38')][_0x62ed('0x74')])[_0x62ed('0x29')](function(){if(_['isArray'](_0x5e22e3[_0x62ed('0x38')][_0x62ed('0x74')])){for(var _0x1039b3=0x0;_0x1039b3<_0x5e22e3['query'][_0x62ed('0x74')][_0x62ed('0x3d')];_0x1039b3+=0x1){socket['emit'](_0x62ed('0x86'),{'UserId':Number(_0x5e22e3[_0x62ed('0x38')][_0x62ed('0x74')][_0x1039b3]),'FaxQueueId':Number(_0x5e22e3[_0x62ed('0x4d')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x5e22e3[_0x62ed('0x38')][_0x62ed('0x74')]),'FaxQueueId':Number(_0x5e22e3[_0x62ed('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x652426,null))[_0x62ed('0x4b')](handleError(_0x652426,null));};exports[_0x62ed('0x8a')]=function(_0x463cab,_0xfeb26b,_0x515c37){var _0x444be4={};var _0x1ef96a={};var _0x7dcba9;var _0x6e5468;return db['FaxQueue'][_0x62ed('0x5a')]({'where':{'id':_0x463cab[_0x62ed('0x4d')]['id']}})[_0x62ed('0x29')](handleEntityNotFound(_0xfeb26b,null))[_0x62ed('0x29')](function(_0x51955c){if(_0x51955c){_0x7dcba9=_0x51955c;_0x1ef96a[_0x62ed('0x3a')]=_[_0x62ed('0x4e')](db[_0x62ed('0x5e')][_0x62ed('0x34')]);_0x1ef96a[_0x62ed('0x38')]=_[_0x62ed('0x4e')](_0x463cab['query']);_0x1ef96a['filters']=_[_0x62ed('0x39')](_0x1ef96a[_0x62ed('0x3a')],_0x1ef96a[_0x62ed('0x38')]);_0x444be4[_0x62ed('0x3b')]=_[_0x62ed('0x39')](_0x1ef96a[_0x62ed('0x3a')],qs[_0x62ed('0x3c')](_0x463cab[_0x62ed('0x38')]['fields']));_0x444be4['attributes']=_0x444be4['attributes']['length']?_0x444be4[_0x62ed('0x3b')]:_0x1ef96a[_0x62ed('0x3a')];_0x444be4[_0x62ed('0x40')]=qs[_0x62ed('0x41')](_0x463cab[_0x62ed('0x38')][_0x62ed('0x41')]);_0x444be4[_0x62ed('0x42')]=qs[_0x62ed('0x43')](_[_0x62ed('0x5c')](_0x463cab[_0x62ed('0x38')],_0x1ef96a[_0x62ed('0x43')]));if(_0x463cab[_0x62ed('0x38')][_0x62ed('0x44')]){_0x444be4[_0x62ed('0x42')]=_[_0x62ed('0x45')](_0x444be4[_0x62ed('0x42')],{'$or':_[_0x62ed('0x32')](_0x444be4[_0x62ed('0x3b')],function(_0x1bd235){var _0x3bf799={};_0x3bf799[_0x1bd235]={'$like':'%'+_0x463cab[_0x62ed('0x38')][_0x62ed('0x44')]+'%'};return _0x3bf799;})});}_0x444be4=_[_0x62ed('0x45')]({},_0x444be4,_0x463cab[_0x62ed('0x47')]);return _0x7dcba9[_0x62ed('0x8a')](_0x444be4);}})[_0x62ed('0x29')](function(_0x3c3f97){if(_0x3c3f97){_0x6e5468=_0x3c3f97[_0x62ed('0x3d')];if(!_0x463cab[_0x62ed('0x38')][_0x62ed('0x3e')](_0x62ed('0x3f'))){_0x444be4[_0x62ed('0x21')]=qs[_0x62ed('0x21')](_0x463cab[_0x62ed('0x38')][_0x62ed('0x21')]);_0x444be4[_0x62ed('0x20')]=qs['offset'](_0x463cab[_0x62ed('0x38')]['offset']);}return _0x7dcba9['getAgents'](_0x444be4);}})[_0x62ed('0x29')](function(_0x4bdd00){if(_0x4bdd00){return _0x4bdd00?{'count':_0x6e5468,'rows':_0x4bdd00}:null;}})[_0x62ed('0x29')](respondWithResult(_0xfeb26b,null))[_0x62ed('0x4b')](handleError(_0xfeb26b,null));}; \ No newline at end of file +var _0x54bf=['fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','params','describe','getMembers','findOne','pick','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','%s/%s','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','transaction','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','error','stack','name','send','map','FaxQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x35c2cc,_0x278a6f){var _0x2ed902=function(_0x157ee2){while(--_0x157ee2){_0x35c2cc['push'](_0x35c2cc['shift']());}};_0x2ed902(++_0x278a6f);}(_0x54bf,0xdf));var _0xf54b=function(_0x4b3322,_0xc91806){_0x4b3322=_0x4b3322-0x0;var _0x4e0afd=_0x54bf[_0x4b3322];return _0x4e0afd;};'use strict';var emlformat=require(_0xf54b('0x0'));var rimraf=require(_0xf54b('0x1'));var zipdir=require(_0xf54b('0x2'));var jsonpatch=require(_0xf54b('0x3'));var rp=require(_0xf54b('0x4'));var moment=require(_0xf54b('0x5'));var BPromise=require(_0xf54b('0x6'));var Mustache=require(_0xf54b('0x7'));var util=require(_0xf54b('0x8'));var path=require(_0xf54b('0x9'));var sox=require(_0xf54b('0xa'));var csv=require(_0xf54b('0xb'));var ejs=require(_0xf54b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf54b('0xd'));var crypto=require(_0xf54b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf54b('0xb'));var querystring=require('querystring');var Papa=require(_0xf54b('0xf'));var Redis=require('ioredis');var authService=require(_0xf54b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf54b('0x11'));var logger=require(_0xf54b('0x12'))('api');var utils=require(_0xf54b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf54b('0x14'))['db'];config['redis']=_[_0xf54b('0x15')](config[_0xf54b('0x16')],{'host':_0xf54b('0x17'),'port':0x18eb});var socket=require(_0xf54b('0x18'))(new Redis(config['redis']));require(_0xf54b('0x19'))['register'](socket);function respondWithStatusCode(_0x27a864,_0x28e348){_0x28e348=_0x28e348||0xcc;return function(_0x598ae2){if(_0x598ae2){return _0x27a864[_0xf54b('0x1a')](_0x28e348);}return _0x27a864['status'](_0x28e348)[_0xf54b('0x1b')]();};}function respondWithResult(_0x21a8a9,_0x1d088f){_0x1d088f=_0x1d088f||0xc8;return function(_0x129276){if(_0x129276){return _0x21a8a9['status'](_0x1d088f)[_0xf54b('0x1c')](_0x129276);}};}function respondWithFilteredResult(_0x117b8f,_0xdd2864){return function(_0x2c5a42){if(_0x2c5a42){var _0x5da0c0=typeof _0xdd2864[_0xf54b('0x1d')]===_0xf54b('0x1e')&&typeof _0xdd2864[_0xf54b('0x1f')]==='undefined';var _0x586a33=_0x2c5a42[_0xf54b('0x20')];var _0x218cfe=_0x5da0c0?0x0:_0xdd2864[_0xf54b('0x1d')];var _0x132d92=_0x5da0c0?_0x2c5a42[_0xf54b('0x20')]:_0xdd2864['offset']+_0xdd2864[_0xf54b('0x1f')];var _0x4d7ea1;if(_0x132d92>=_0x586a33){_0x132d92=_0x586a33;_0x4d7ea1=0xc8;}else{_0x4d7ea1=0xce;}_0x117b8f[_0xf54b('0x21')](_0x4d7ea1);return _0x117b8f[_0xf54b('0x22')](_0xf54b('0x23'),_0x218cfe+'-'+_0x132d92+'/'+_0x586a33)[_0xf54b('0x1c')](_0x2c5a42);}return null;};}function patchUpdates(_0x5a6447){return function(_0x3f87c2){try{jsonpatch[_0xf54b('0x24')](_0x3f87c2,_0x5a6447,!![]);}catch(_0x2681a0){return BPromise[_0xf54b('0x25')](_0x2681a0);}return _0x3f87c2[_0xf54b('0x26')]();};}function saveUpdates(_0x44d13a,_0x2a1863){return function(_0x38d942){if(_0x38d942){return _0x38d942[_0xf54b('0x27')](_0x44d13a)[_0xf54b('0x28')](function(_0x4ae2d3){return _0x4ae2d3;});}return null;};}function removeEntity(_0x2a3562,_0x5389bb){return function(_0x50b967){if(_0x50b967){return _0x50b967[_0xf54b('0x29')]()[_0xf54b('0x28')](function(){var _0x579e29=_0x50b967[_0xf54b('0x2a')]({'plain':!![]});var _0x2a3c=_0xf54b('0x2b');return db['UserProfileResource'][_0xf54b('0x29')]({'where':{'type':_0x2a3c,'resourceId':_0x579e29['id']}})[_0xf54b('0x28')](function(){return _0x50b967;});})[_0xf54b('0x28')](function(){_0x2a3562[_0xf54b('0x21')](0xcc)[_0xf54b('0x1b')]();});}};}function handleEntityNotFound(_0x108911,_0xeac7e3){return function(_0x533a66){if(!_0x533a66){_0x108911[_0xf54b('0x1a')](0x194);}return _0x533a66;};}function handleError(_0x98bcd6,_0x4bdda7){_0x4bdda7=_0x4bdda7||0x1f4;return function(_0x268364){logger[_0xf54b('0x2c')](_0x268364[_0xf54b('0x2d')]);if(_0x268364[_0xf54b('0x2e')]){delete _0x268364[_0xf54b('0x2e')];}_0x98bcd6['status'](_0x4bdda7)[_0xf54b('0x2f')](_0x268364);};}exports['index']=function(_0x3aec23,_0x1395be){var _0x234b9d={},_0x14b841={},_0xf146a1={'count':0x0,'rows':[]};var _0x43ccf4=_[_0xf54b('0x30')](db[_0xf54b('0x31')]['rawAttributes'],function(_0x541e25){return{'name':_0x541e25[_0xf54b('0x32')],'type':_0x541e25[_0xf54b('0x33')][_0xf54b('0x34')]};});_0x14b841[_0xf54b('0x35')]=_[_0xf54b('0x30')](_0x43ccf4,'name');_0x14b841[_0xf54b('0x36')]=_[_0xf54b('0x37')](_0x3aec23['query']);_0x14b841[_0xf54b('0x38')]=_[_0xf54b('0x39')](_0x14b841['model'],_0x14b841[_0xf54b('0x36')]);_0x234b9d[_0xf54b('0x3a')]=_[_0xf54b('0x39')](_0x14b841[_0xf54b('0x35')],qs[_0xf54b('0x3b')](_0x3aec23[_0xf54b('0x36')][_0xf54b('0x3b')]));_0x234b9d[_0xf54b('0x3a')]=_0x234b9d[_0xf54b('0x3a')]['length']?_0x234b9d[_0xf54b('0x3a')]:_0x14b841[_0xf54b('0x35')];if(!_0x3aec23[_0xf54b('0x36')][_0xf54b('0x3c')](_0xf54b('0x3d'))){_0x234b9d[_0xf54b('0x1f')]=qs[_0xf54b('0x1f')](_0x3aec23[_0xf54b('0x36')][_0xf54b('0x1f')]);_0x234b9d[_0xf54b('0x1d')]=qs['offset'](_0x3aec23['query'][_0xf54b('0x1d')]);}_0x234b9d[_0xf54b('0x3e')]=qs[_0xf54b('0x3f')](_0x3aec23[_0xf54b('0x36')][_0xf54b('0x3f')]);_0x234b9d[_0xf54b('0x40')]=qs[_0xf54b('0x38')](_['pick'](_0x3aec23['query'],_0x14b841[_0xf54b('0x38')]),_0x43ccf4);if(_0x3aec23[_0xf54b('0x36')][_0xf54b('0x41')]){_0x234b9d[_0xf54b('0x40')]=_['merge'](_0x234b9d[_0xf54b('0x40')],{'$or':_[_0xf54b('0x30')](_0x43ccf4,function(_0x1b0794){if(_0x1b0794['type']!==_0xf54b('0x42')){var _0x26f5b6={};_0x26f5b6[_0x1b0794[_0xf54b('0x2e')]]={'$like':'%'+_0x3aec23['query'][_0xf54b('0x41')]+'%'};return _0x26f5b6;}})});}_0x234b9d=_[_0xf54b('0x43')]({},_0x234b9d,_0x3aec23[_0xf54b('0x44')]);var _0x4c594c={'where':_0x234b9d['where']};return db[_0xf54b('0x31')]['count'](_0x4c594c)[_0xf54b('0x28')](function(_0x24c3bd){_0xf146a1['count']=_0x24c3bd;if(_0x3aec23[_0xf54b('0x36')][_0xf54b('0x45')]){_0x234b9d[_0xf54b('0x46')]=[{'all':!![]}];}return db[_0xf54b('0x31')][_0xf54b('0x47')](_0x234b9d);})[_0xf54b('0x28')](function(_0x40e550){_0xf146a1['rows']=_0x40e550;return _0xf146a1;})[_0xf54b('0x28')](respondWithFilteredResult(_0x1395be,_0x234b9d))[_0xf54b('0x48')](handleError(_0x1395be,null));};exports[_0xf54b('0x49')]=function(_0x3d2cee,_0xf2a498){var _0x3b8812={'raw':!![],'where':{'id':_0x3d2cee['params']['id']}},_0x340b3b={};_0x340b3b[_0xf54b('0x35')]=_[_0xf54b('0x37')](db[_0xf54b('0x31')][_0xf54b('0x4a')]);_0x340b3b['query']=_[_0xf54b('0x37')](_0x3d2cee['query']);_0x340b3b['filters']=_['intersection'](_0x340b3b[_0xf54b('0x35')],_0x340b3b['query']);_0x3b8812[_0xf54b('0x3a')]=_[_0xf54b('0x39')](_0x340b3b[_0xf54b('0x35')],qs[_0xf54b('0x3b')](_0x3d2cee['query'][_0xf54b('0x3b')]));_0x3b8812[_0xf54b('0x3a')]=_0x3b8812[_0xf54b('0x3a')][_0xf54b('0x4b')]?_0x3b8812['attributes']:_0x340b3b[_0xf54b('0x35')];if(_0x3d2cee[_0xf54b('0x36')][_0xf54b('0x45')]){_0x3b8812[_0xf54b('0x46')]=[{'all':!![]}];}_0x3b8812=_['merge']({},_0x3b8812,_0x3d2cee[_0xf54b('0x44')]);return db[_0xf54b('0x31')][_0xf54b('0x4c')](_0x3b8812)[_0xf54b('0x28')](handleEntityNotFound(_0xf2a498,null))['then'](respondWithResult(_0xf2a498,null))['catch'](handleError(_0xf2a498,null));};exports[_0xf54b('0x4d')]=function(_0x1adf36,_0x9e24cc){return db[_0xf54b('0x31')][_0xf54b('0x4d')](_0x1adf36[_0xf54b('0x4e')],{})[_0xf54b('0x28')](function(_0x22cfb1){var _0x33f516=_0x1adf36['user'][_0xf54b('0x2a')]({'plain':!![]});if(!_0x33f516)throw new Error(_0xf54b('0x4f'));if(_0x33f516['role']===_0xf54b('0x50')){var _0x522ae8=_0x22cfb1[_0xf54b('0x2a')]({'plain':!![]});var _0x469c90='FaxQueues';return db['UserProfileSection'][_0xf54b('0x4c')]({'where':{'name':_0x469c90,'userProfileId':_0x33f516[_0xf54b('0x51')]},'raw':!![]})[_0xf54b('0x28')](function(_0x3437c3){if(_0x3437c3&&_0x3437c3[_0xf54b('0x52')]===0x0){return db[_0xf54b('0x53')]['create']({'name':_0x522ae8['name'],'resourceId':_0x522ae8['id'],'type':_0x3437c3[_0xf54b('0x2e')],'sectionId':_0x3437c3['id']},{})[_0xf54b('0x28')](function(){return _0x22cfb1;});}else{return _0x22cfb1;}})[_0xf54b('0x48')](function(_0x4f6c13){logger[_0xf54b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f6c13);throw _0x4f6c13;});}return _0x22cfb1;})[_0xf54b('0x28')](respondWithResult(_0x9e24cc,0xc9))[_0xf54b('0x48')](handleError(_0x9e24cc,null));};exports[_0xf54b('0x27')]=function(_0x117ad9,_0x2c33a7){if(_0x117ad9[_0xf54b('0x4e')]['id']){delete _0x117ad9[_0xf54b('0x4e')]['id'];}return db[_0xf54b('0x31')][_0xf54b('0x4c')]({'where':{'id':_0x117ad9[_0xf54b('0x54')]['id']}})[_0xf54b('0x28')](handleEntityNotFound(_0x2c33a7,null))['then'](saveUpdates(_0x117ad9['body'],null))[_0xf54b('0x28')](respondWithResult(_0x2c33a7,null))['catch'](handleError(_0x2c33a7,null));};exports[_0xf54b('0x29')]=function(_0x1c60e8,_0x37c09f){return db['FaxQueue'][_0xf54b('0x4c')]({'where':{'id':_0x1c60e8[_0xf54b('0x54')]['id']}})[_0xf54b('0x28')](handleEntityNotFound(_0x37c09f,null))[_0xf54b('0x28')](removeEntity(_0x37c09f,null))[_0xf54b('0x48')](handleError(_0x37c09f,null));};exports[_0xf54b('0x55')]=function(_0x27660b,_0x430554){return db[_0xf54b('0x31')][_0xf54b('0x55')]()[_0xf54b('0x28')](respondWithResult(_0x430554,null))[_0xf54b('0x48')](handleError(_0x430554,null));};exports[_0xf54b('0x56')]=function(_0x590f48,_0x59a0e4,_0x20d8fd){var _0x5ef8fd={'raw':!![],'where':{}},_0x366dd6={},_0x2fcc94;return db[_0xf54b('0x31')][_0xf54b('0x57')]({'where':{'id':_0x590f48['params']['id']}})[_0xf54b('0x28')](handleEntityNotFound(_0x59a0e4,null))[_0xf54b('0x28')](function(_0x555d38){if(_0x555d38){_0x2fcc94=_0x555d38[_0xf54b('0x2a')]({'plain':!![]});_0x366dd6[_0xf54b('0x35')]=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x366dd6[_0xf54b('0x36')]=_[_0xf54b('0x37')](_0x590f48[_0xf54b('0x36')]);_0x366dd6[_0xf54b('0x38')]=_['intersection'](_0x366dd6['model'],_0x366dd6[_0xf54b('0x36')]);_0x5ef8fd['attributes']=_['intersection'](_0x366dd6[_0xf54b('0x35')],qs[_0xf54b('0x3b')](_0x590f48[_0xf54b('0x36')][_0xf54b('0x3b')]));_0x5ef8fd[_0xf54b('0x3a')]=_0x5ef8fd[_0xf54b('0x3a')]['length']?_0x5ef8fd[_0xf54b('0x3a')]:_0x366dd6[_0xf54b('0x35')];if(!_0x590f48[_0xf54b('0x36')][_0xf54b('0x3c')](_0xf54b('0x3d'))){_0x5ef8fd[_0xf54b('0x1f')]=qs[_0xf54b('0x1f')](_0x590f48[_0xf54b('0x36')]['limit']);_0x5ef8fd[_0xf54b('0x1d')]=qs[_0xf54b('0x1d')](_0x590f48[_0xf54b('0x36')][_0xf54b('0x1d')]);}_0x5ef8fd['order']=qs[_0xf54b('0x3f')](_0x590f48[_0xf54b('0x36')]['sort']);_0x5ef8fd[_0xf54b('0x40')]=qs['filters'](_[_0xf54b('0x58')](_0x590f48[_0xf54b('0x36')],_0x366dd6[_0xf54b('0x38')]));_0x5ef8fd[_0xf54b('0x40')][_0xf54b('0x59')]=_0x555d38['id'];if(_0x590f48[_0xf54b('0x36')][_0xf54b('0x41')]){_0x5ef8fd['where']=_[_0xf54b('0x43')](_0x5ef8fd[_0xf54b('0x40')],{'$or':_['map'](_0x5ef8fd[_0xf54b('0x3a')],function(_0x202009){var _0x56294b={};_0x56294b[_0x202009]={'$like':'%'+_0x590f48['query'][_0xf54b('0x41')]+'%'};return _0x56294b;})});}_0x5ef8fd=_[_0xf54b('0x43')]({},_0x5ef8fd,_0x590f48[_0xf54b('0x44')]);return db[_0xf54b('0x5a')][_0xf54b('0x47')](_0x5ef8fd);}})['then'](function(_0x55c75c){if(_0x55c75c){return db[_0xf54b('0x5b')][_0xf54b('0x5c')]({'where':{'id':_[_0xf54b('0x30')](_0x55c75c,_0xf54b('0x5d')),'role':_0xf54b('0x5e')},'attributes':['id',_0xf54b('0x2e'),_0xf54b('0x5f'),_0xf54b('0x60'),_0xf54b('0x61')]});}})[_0xf54b('0x28')](function(_0x521504){if(_0x521504){return{'count':_0x521504['count'],'rows':_[_0xf54b('0x30')](_0x521504[_0xf54b('0x62')],function(_0x46fd53){return{'membername':_0x46fd53[_0xf54b('0x2e')],'UserId':_0x46fd53['id'],'queue_name':_0x2fcc94[_0xf54b('0x2e')],'FaxQueueId':_0x2fcc94['id'],'interface':util['format'](_0xf54b('0x63'),_0xf54b('0x64'),_0x46fd53[_0xf54b('0x2e')]),'penalty':0x0,'paused':_0x46fd53['faxPause'],'createdAt':_0x46fd53[_0xf54b('0x61')],'updatedAt':_0x46fd53[_0xf54b('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf54b('0x28')](respondWithFilteredResult(_0x59a0e4,_0x5ef8fd))['catch'](handleError(_0x59a0e4,null));};exports['getTeams']=function(_0x1cc416,_0x5daa31,_0x398181){var _0x592311={};var _0x4f8132={};var _0x375756;var _0x390a63;return db['FaxQueue']['findOne']({'where':{'id':_0x1cc416[_0xf54b('0x54')]['id']}})[_0xf54b('0x28')](handleEntityNotFound(_0x5daa31,null))[_0xf54b('0x28')](function(_0x2933c7){if(_0x2933c7){_0x375756=_0x2933c7;_0x4f8132['model']=_[_0xf54b('0x37')](db[_0xf54b('0x65')][_0xf54b('0x4a')]);_0x4f8132['query']=_[_0xf54b('0x37')](_0x1cc416['query']);_0x4f8132['filters']=_[_0xf54b('0x39')](_0x4f8132[_0xf54b('0x35')],_0x4f8132[_0xf54b('0x36')]);_0x592311[_0xf54b('0x3a')]=_[_0xf54b('0x39')](_0x4f8132[_0xf54b('0x35')],qs['fields'](_0x1cc416['query'][_0xf54b('0x3b')]));_0x592311['attributes']=_0x592311[_0xf54b('0x3a')][_0xf54b('0x4b')]?_0x592311[_0xf54b('0x3a')]:_0x4f8132[_0xf54b('0x35')];_0x592311[_0xf54b('0x3e')]=qs[_0xf54b('0x3f')](_0x1cc416[_0xf54b('0x36')]['sort']);_0x592311[_0xf54b('0x40')]=qs[_0xf54b('0x38')](_[_0xf54b('0x58')](_0x1cc416[_0xf54b('0x36')],_0x4f8132[_0xf54b('0x38')]));if(_0x1cc416[_0xf54b('0x36')][_0xf54b('0x41')]){_0x592311[_0xf54b('0x40')]=_[_0xf54b('0x43')](_0x592311[_0xf54b('0x40')],{'$or':_[_0xf54b('0x30')](_0x592311['attributes'],function(_0x196bc2){var _0x3c2f98={};_0x3c2f98[_0x196bc2]={'$like':'%'+_0x1cc416[_0xf54b('0x36')][_0xf54b('0x41')]+'%'};return _0x3c2f98;})});}_0x592311=_['merge']({},_0x592311,_0x1cc416[_0xf54b('0x44')]);return _0x375756[_0xf54b('0x66')](_0x592311);}})[_0xf54b('0x28')](function(_0x3fd01f){if(_0x3fd01f){_0x390a63=_0x3fd01f['length'];if(!_0x1cc416[_0xf54b('0x36')]['hasOwnProperty']('nolimit')){_0x592311['limit']=qs[_0xf54b('0x1f')](_0x1cc416[_0xf54b('0x36')][_0xf54b('0x1f')]);_0x592311[_0xf54b('0x1d')]=qs['offset'](_0x1cc416[_0xf54b('0x36')][_0xf54b('0x1d')]);}return _0x375756[_0xf54b('0x66')](_0x592311);}})['then'](function(_0x598b1f){if(_0x598b1f){return _0x598b1f?{'count':_0x390a63,'rows':_0x598b1f}:null;}})[_0xf54b('0x28')](respondWithResult(_0x5daa31,null))['catch'](handleError(_0x5daa31,null));};exports[_0xf54b('0x67')]=function(_0x20cd14,_0x1b11a5,_0xfdab3d){var _0x2a3ac2=_0x20cd14[_0xf54b('0x4e')][_0xf54b('0x68')];return db[_0xf54b('0x65')][_0xf54b('0x47')]({'where':{'id':_0x2a3ac2},'attributes':['id'],'include':[{'model':db[_0xf54b('0x5b')],'as':'Agents','attributes':['id',_0xf54b('0x2e'),_0xf54b('0x69'),_0xf54b('0x6a'),_0xf54b('0x6b')],'raw':!![]}]})['then'](function(_0x5215fe){if(_0x5215fe){var _0x2fc8cc=_[_0xf54b('0x6c')](_0x5215fe,function(_0x1fa5b8){var _0x47195f=_0x1fa5b8[_0xf54b('0x2a')]({'plain':!![]});return _0x47195f[_0xf54b('0x6d')];});return db[_0xf54b('0x31')]['find']({'where':{'id':_0x20cd14['params']['id']}})[_0xf54b('0x28')](function(_0x172dd6){return db[_0xf54b('0x6e')]['transaction'](function(_0x49731e){return _0x172dd6[_0xf54b('0x67')](_0x2a3ac2,{'transaction':_0x49731e})[_0xf54b('0x28')](function(){return BPromise[_0xf54b('0x6f')](_0x2fc8cc,function(_0x124792){return db['UserFaxQueue'][_0xf54b('0x70')]({'where':{'UserId':_0x124792['id'],'FaxQueueId':_0x20cd14[_0xf54b('0x54')]['id']},'transaction':_0x49731e});});})['then'](function(){_0x2fc8cc[_0xf54b('0x71')](function(_0x521efe){socket[_0xf54b('0x72')]('userFaxQueue:save',{'UserId':_0x521efe['id'],'FaxQueueId':_0x172dd6['id']});});});});});}})[_0xf54b('0x28')](respondWithStatusCode(_0x1b11a5,null))[_0xf54b('0x48')](handleError(_0x1b11a5,null));};exports[_0xf54b('0x73')]=function(_0x50a0d1,_0x4ab38c,_0x2de268){return db['Team'][_0xf54b('0x47')]({'where':{'id':_0x50a0d1[_0xf54b('0x36')][_0xf54b('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf54b('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xf54b('0x28')](handleEntityNotFound(_0x4ab38c,null))[_0xf54b('0x28')](function(_0x2891f9){var _0x6f35ef=_[_0xf54b('0x30')](_0x2891f9,'id');var _0x5d2b6e=[];var _0x2eb7fe=[];var _0x12fb73=squel[_0xf54b('0x74')]();_0x12fb73['field'](_0xf54b('0x75'))['from'](_0xf54b('0x76'),'tq')[_0xf54b('0x77')](_0xf54b('0x78'),'ut',_0xf54b('0x79'))[_0xf54b('0x40')]('FaxQueueId\x20=\x20?',_0x50a0d1[_0xf54b('0x54')]['id']);for(var _0x293120=0x0;_0x293120<_0x2891f9['length'];_0x293120+=0x1){let _0x47e3c5=_0x2891f9[_0x293120];for(var _0x50f285=0x0;_0x50f285<_0x47e3c5[_0xf54b('0x6d')][_0xf54b('0x4b')];_0x50f285+=0x1){let _0x4117f6=_0x47e3c5[_0xf54b('0x6d')][_0x50f285];var _0xdfbd6f=_0x12fb73[_0xf54b('0x7a')]();_0xdfbd6f[_0xf54b('0x40')](_0xf54b('0x7b'),_0x4117f6['id']);_0x2eb7fe[_0xf54b('0x7c')](db[_0xf54b('0x6e')][_0xf54b('0x36')](_0xdfbd6f[_0xf54b('0x7d')](),{'type':db[_0xf54b('0x6e')][_0xf54b('0x7e')][_0xf54b('0x7f')]})[_0xf54b('0x28')](function(_0x14c566){if(_0x14c566[_0xf54b('0x4b')]===0x1){return _0x4117f6['id'];}else{var _0x583e6a=_[_0xf54b('0x80')](_[_0xf54b('0x30')](_0x14c566,_0xf54b('0x81')),function(_0x169a7f){return _[_0xf54b('0x82')](_0x6f35ef,_0x169a7f);});if(_0x583e6a){return _0x4117f6['id'];}}}));}}return BPromise[_0xf54b('0x83')](_0x2eb7fe)[_0xf54b('0x28')](function(_0x1d3a0d){_0x5d2b6e=_(_0x5d2b6e)['union'](_0x1d3a0d)[_0xf54b('0x84')]()['value']();return db[_0xf54b('0x31')][_0xf54b('0x4c')]({'where':{'id':_0x50a0d1['params']['id']}})[_0xf54b('0x28')](function(_0xdd102){return db[_0xf54b('0x6e')][_0xf54b('0x85')](function(_0x720647){return _0xdd102[_0xf54b('0x73')](_0x50a0d1[_0xf54b('0x36')][_0xf54b('0x68')],{'transaction':_0x720647})['then'](function(){if(!_['isEmpty'](_0x5d2b6e)){return _0xdd102['removeAgents'](_0x5d2b6e,{'transaction':_0x720647});}})[_0xf54b('0x28')](function(){_0x5d2b6e[_0xf54b('0x71')](function(_0x145117){socket[_0xf54b('0x72')](_0xf54b('0x86'),{'UserId':_0x145117,'FaxQueueId':_0xdd102['id']});});});});});});})['then'](respondWithStatusCode(_0x4ab38c,null))[_0xf54b('0x48')](handleError(_0x4ab38c,null));};exports[_0xf54b('0x87')]=function(_0x296dd6,_0x1f688b,_0x47a8f4){return db[_0xf54b('0x31')]['find']({'where':{'id':_0x296dd6[_0xf54b('0x54')]['id']}})[_0xf54b('0x28')](handleEntityNotFound(_0x1f688b,null))[_0xf54b('0x28')](function(_0x58fac5){if(_0x58fac5){return _0x58fac5[_0xf54b('0x87')](_0x296dd6['body']['ids'],_[_0xf54b('0x88')](_0x296dd6[_0xf54b('0x4e')],[_0xf54b('0x68'),'id'])||{})[_0xf54b('0x89')](function(_0x7910fb){for(var _0x81a5d0=0x0;_0x81a5d0<_0x296dd6[_0xf54b('0x4e')][_0xf54b('0x68')][_0xf54b('0x4b')];_0x81a5d0+=0x1){socket[_0xf54b('0x72')](_0xf54b('0x8a'),{'UserId':Number(_0x296dd6[_0xf54b('0x4e')][_0xf54b('0x68')][_0x81a5d0]),'FaxQueueId':Number(_0x296dd6[_0xf54b('0x54')]['id'])});}return _0x7910fb;});}})[_0xf54b('0x28')](respondWithResult(_0x1f688b,null))[_0xf54b('0x48')](handleError(_0x1f688b,null));};exports['removeAgents']=function(_0x25c770,_0x51f6c1,_0x27344f){return db[_0xf54b('0x31')][_0xf54b('0x4c')]({'where':{'id':_0x25c770[_0xf54b('0x54')]['id']}})['then'](handleEntityNotFound(_0x51f6c1,null))[_0xf54b('0x28')](function(_0x4e0063){if(_0x4e0063){return _0x4e0063[_0xf54b('0x8b')](_0x25c770[_0xf54b('0x36')][_0xf54b('0x68')])[_0xf54b('0x28')](function(){if(_['isArray'](_0x25c770[_0xf54b('0x36')][_0xf54b('0x68')])){for(var _0x14cd6a=0x0;_0x14cd6a<_0x25c770[_0xf54b('0x36')]['ids'][_0xf54b('0x4b')];_0x14cd6a+=0x1){socket[_0xf54b('0x72')](_0xf54b('0x86'),{'UserId':Number(_0x25c770[_0xf54b('0x36')][_0xf54b('0x68')][_0x14cd6a]),'FaxQueueId':Number(_0x25c770[_0xf54b('0x54')]['id'])});}}else{socket[_0xf54b('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x25c770[_0xf54b('0x36')][_0xf54b('0x68')]),'FaxQueueId':Number(_0x25c770[_0xf54b('0x54')]['id'])});}});}})[_0xf54b('0x28')](respondWithStatusCode(_0x51f6c1,null))[_0xf54b('0x48')](handleError(_0x51f6c1,null));};exports['getAgents']=function(_0x21de36,_0x4f0d9a,_0x5edcfd){var _0x2fa251={};var _0x1e9607={};var _0x574bdd;var _0x1afcd3;return db[_0xf54b('0x31')]['findOne']({'where':{'id':_0x21de36['params']['id']}})['then'](handleEntityNotFound(_0x4f0d9a,null))['then'](function(_0x54ce72){if(_0x54ce72){_0x574bdd=_0x54ce72;_0x1e9607[_0xf54b('0x35')]=_[_0xf54b('0x37')](db[_0xf54b('0x5b')]['rawAttributes']);_0x1e9607[_0xf54b('0x36')]=_[_0xf54b('0x37')](_0x21de36[_0xf54b('0x36')]);_0x1e9607[_0xf54b('0x38')]=_['intersection'](_0x1e9607['model'],_0x1e9607[_0xf54b('0x36')]);_0x2fa251[_0xf54b('0x3a')]=_['intersection'](_0x1e9607['model'],qs['fields'](_0x21de36['query'][_0xf54b('0x3b')]));_0x2fa251[_0xf54b('0x3a')]=_0x2fa251['attributes'][_0xf54b('0x4b')]?_0x2fa251['attributes']:_0x1e9607[_0xf54b('0x35')];_0x2fa251['order']=qs[_0xf54b('0x3f')](_0x21de36[_0xf54b('0x36')]['sort']);_0x2fa251[_0xf54b('0x40')]=qs[_0xf54b('0x38')](_['pick'](_0x21de36['query'],_0x1e9607[_0xf54b('0x38')]));if(_0x21de36[_0xf54b('0x36')][_0xf54b('0x41')]){_0x2fa251[_0xf54b('0x40')]=_['merge'](_0x2fa251['where'],{'$or':_['map'](_0x2fa251['attributes'],function(_0xa7ac5){var _0x50f132={};_0x50f132[_0xa7ac5]={'$like':'%'+_0x21de36[_0xf54b('0x36')][_0xf54b('0x41')]+'%'};return _0x50f132;})});}_0x2fa251=_[_0xf54b('0x43')]({},_0x2fa251,_0x21de36[_0xf54b('0x44')]);return _0x574bdd[_0xf54b('0x8c')](_0x2fa251);}})[_0xf54b('0x28')](function(_0x4e10d8){if(_0x4e10d8){_0x1afcd3=_0x4e10d8['length'];if(!_0x21de36[_0xf54b('0x36')]['hasOwnProperty'](_0xf54b('0x3d'))){_0x2fa251[_0xf54b('0x1f')]=qs[_0xf54b('0x1f')](_0x21de36[_0xf54b('0x36')][_0xf54b('0x1f')]);_0x2fa251[_0xf54b('0x1d')]=qs[_0xf54b('0x1d')](_0x21de36['query']['offset']);}return _0x574bdd[_0xf54b('0x8c')](_0x2fa251);}})[_0xf54b('0x28')](function(_0x250c73){if(_0x250c73){return _0x250c73?{'count':_0x1afcd3,'rows':_0x250c73}:null;}})[_0xf54b('0x28')](respondWithResult(_0x4f0d9a,null))[_0xf54b('0x48')](handleError(_0x4f0d9a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e76302d..50c1369 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 _0x0612=['events','FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x5431fd,_0x249c12){var _0x43c000=function(_0x42361b){while(--_0x42361b){_0x5431fd['push'](_0x5431fd['shift']());}};_0x43c000(++_0x249c12);}(_0x0612,0x190));var _0x2061=function(_0x5ed3d5,_0x5a3035){_0x5ed3d5=_0x5ed3d5-0x0;var _0x4cfb74=_0x0612[_0x5ed3d5];return _0x4cfb74;};'use strict';var EventEmitter=require(_0x2061('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x2061('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2061('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2061('0x3'),'afterDestroy':_0x2061('0x4')};function emitEvent(_0x1348cb){return function(_0x3599b3,_0x21ab09,_0x159267){FaxQueueEvents[_0x2061('0x5')](_0x1348cb+':'+_0x3599b3['id'],_0x3599b3);FaxQueueEvents[_0x2061('0x5')](_0x1348cb,_0x3599b3);_0x159267(null);};}for(var e in events){if(events[_0x2061('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x2061('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xd0ad=['remove','emit','hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners','save','update'];(function(_0x53bf41,_0x113712){var _0x217844=function(_0xe02a2d){while(--_0xe02a2d){_0x53bf41['push'](_0x53bf41['shift']());}};_0x217844(++_0x113712);}(_0xd0ad,0x13b));var _0xdd0a=function(_0x2ac0a5,_0xd1614d){_0x2ac0a5=_0x2ac0a5-0x0;var _0x46cef5=_0xd0ad[_0x2ac0a5];return _0x46cef5;};'use strict';var EventEmitter=require(_0xdd0a('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xdd0a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xdd0a('0x2')](0x0);var events={'afterCreate':_0xdd0a('0x3'),'afterUpdate':_0xdd0a('0x4'),'afterDestroy':_0xdd0a('0x5')};function emitEvent(_0x5b949e){return function(_0x442182,_0x30a406,_0xecb3a7){FaxQueueEvents[_0xdd0a('0x6')](_0x5b949e+':'+_0x442182['id'],_0x442182);FaxQueueEvents['emit'](_0x5b949e,_0x442182);_0xecb3a7(null);};}for(var e in events){if(events[_0xdd0a('0x7')](e)){var event=events[e];FaxQueue[_0xdd0a('0x8')](e,emitEvent(event));}}module[_0xdd0a('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 67cc057..a67db30 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 _0x6e0e=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','define','FaxQueue'];(function(_0x39cc09,_0x500de7){var _0x10eadd=function(_0x553c0d){while(--_0x553c0d){_0x39cc09['push'](_0x39cc09['shift']());}};_0x10eadd(++_0x500de7);}(_0x6e0e,0x10e));var _0xe6e0=function(_0x240cc0,_0x49b079){_0x240cc0=_0x240cc0-0x0;var _0x5515e5=_0x6e0e[_0x240cc0];return _0x5515e5;};'use strict';var _=require(_0xe6e0('0x0'));var util=require(_0xe6e0('0x1'));var logger=require(_0xe6e0('0x2'))('api');var moment=require(_0xe6e0('0x3'));var BPromise=require(_0xe6e0('0x4'));var rp=require(_0xe6e0('0x5'));var fs=require('fs');var path=require(_0xe6e0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xe6e0('0x7')]=function(_0x4294fe,_0x5c981d){return _0x4294fe[_0xe6e0('0x8')](_0xe6e0('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9b1=['request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','moment'];(function(_0x5b02ff,_0x4ce260){var _0xfe3187=function(_0x2aae48){while(--_0x2aae48){_0x5b02ff['push'](_0x5b02ff['shift']());}};_0xfe3187(++_0x4ce260);}(_0xc9b1,0xf9));var _0x1c9b=function(_0x383c46,_0x3bc15d){_0x383c46=_0x383c46-0x0;var _0x15dd8d=_0xc9b1[_0x383c46];return _0x15dd8d;};'use strict';var _=require(_0x1c9b('0x0'));var util=require(_0x1c9b('0x1'));var logger=require(_0x1c9b('0x2'))('api');var moment=require(_0x1c9b('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c9b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c9b('0x5'));var config=require(_0x1c9b('0x6'));var attributes=require(_0x1c9b('0x7'));module[_0x1c9b('0x8')]=function(_0x33e757,_0x10780a){return _0x33e757[_0x1c9b('0x9')]('FaxQueue',attributes,{'tableName':_0x1c9b('0xa'),'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 acdc251..89f4d82 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 _0xea39=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetFaxQueue','FaxQueue','findAll','where','attributes','options','include','map','model','find','raw','catch','ShowFaxQueue','lodash','bluebird'];(function(_0x5bdb9f,_0x1c21be){var _0x5c8139=function(_0x385f0b){while(--_0x385f0b){_0x5bdb9f['push'](_0x5bdb9f['shift']());}};_0x5c8139(++_0x1c21be);}(_0xea39,0x12e));var _0x9ea3=function(_0x17621d,_0xe33293){_0x17621d=_0x17621d-0x0;var _0x42a26e=_0xea39[_0x17621d];return _0x42a26e;};'use strict';var _=require(_0x9ea3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9ea3('0x1'));var rs=require(_0x9ea3('0x2'));var fs=require('fs');var Redis=require(_0x9ea3('0x3'));var db=require(_0x9ea3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ea3('0x5'))(_0x9ea3('0x6'));var config=require(_0x9ea3('0x7'));var jayson=require(_0x9ea3('0x8'));var client=jayson['client'][_0x9ea3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9ea3('0xa')],{'host':_0x9ea3('0xb'),'port':0x18eb});var socket=require(_0x9ea3('0xc'))(new Redis(config[_0x9ea3('0xa')]));require('./faxQueue.socket')[_0x9ea3('0xd')](socket);function respondWithRpcPromise(_0x5297e8,_0x57964b,_0x35c7c7){return new BPromise(function(_0x21915d,_0x46f03b){return client[_0x9ea3('0xe')](_0x5297e8,_0x35c7c7)[_0x9ea3('0xf')](function(_0x8a01d4){logger['info'](_0x9ea3('0x10'),_0x57964b,_0x9ea3('0x11'));logger[_0x9ea3('0x12')](_0x9ea3('0x13'),_0x57964b,_0x9ea3('0x11'),JSON[_0x9ea3('0x14')](_0x8a01d4));if(_0x8a01d4[_0x9ea3('0x15')]){if(_0x8a01d4[_0x9ea3('0x15')]['code']===0x1f4){logger[_0x9ea3('0x15')](_0x9ea3('0x10'),_0x57964b,_0x8a01d4[_0x9ea3('0x15')]['message']);return _0x46f03b(_0x8a01d4[_0x9ea3('0x15')]['message']);}logger[_0x9ea3('0x15')](_0x9ea3('0x10'),_0x57964b,_0x8a01d4['error'][_0x9ea3('0x16')]);return _0x21915d(_0x8a01d4['error']['message']);}else{logger[_0x9ea3('0x17')](_0x9ea3('0x10'),_0x57964b,_0x9ea3('0x11'));_0x21915d(_0x8a01d4[_0x9ea3('0x18')][_0x9ea3('0x16')]);}})['catch'](function(_0x315a3c){logger[_0x9ea3('0x15')](_0x9ea3('0x10'),_0x57964b,_0x315a3c);_0x46f03b(_0x315a3c);});});}exports[_0x9ea3('0x19')]=function(_0x3aa48f){var _0x377bbe=this;return new Promise(function(_0x20b308,_0xf9ff51){return db[_0x9ea3('0x1a')][_0x9ea3('0x1b')]({'raw':_0x3aa48f['options']?_0x3aa48f['options']['raw']===undefined?!![]:![]:!![],'where':_0x3aa48f['options']?_0x3aa48f['options'][_0x9ea3('0x1c')]||null:null,'attributes':_0x3aa48f['options']?_0x3aa48f['options'][_0x9ea3('0x1d')]||null:null,'limit':_0x3aa48f['options']?_0x3aa48f[_0x9ea3('0x1e')]['limit']||null:null,'include':_0x3aa48f[_0x9ea3('0x1e')]?_0x3aa48f['options'][_0x9ea3('0x1f')]?_[_0x9ea3('0x20')](_0x3aa48f[_0x9ea3('0x1e')][_0x9ea3('0x1f')],function(_0x11ad3e){return{'model':db[_0x11ad3e[_0x9ea3('0x21')]],'as':_0x11ad3e['as'],'attributes':_0x11ad3e[_0x9ea3('0x1d')],'include':_0x11ad3e[_0x9ea3('0x1f')]?_[_0x9ea3('0x20')](_0x11ad3e[_0x9ea3('0x1f')],function(_0x15aafb){return{'model':db[_0x15aafb[_0x9ea3('0x21')]],'as':_0x15aafb['as'],'attributes':_0x15aafb[_0x9ea3('0x1d')],'include':_0x15aafb[_0x9ea3('0x1f')]?_[_0x9ea3('0x20')](_0x15aafb[_0x9ea3('0x1f')],function(_0x5c273d){return{'model':db[_0x5c273d[_0x9ea3('0x21')]],'as':_0x5c273d['as'],'attributes':_0x5c273d['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ea3('0xf')](function(_0x587c08){logger[_0x9ea3('0x17')](_0x9ea3('0x19'),_0x3aa48f);logger[_0x9ea3('0x12')]('GetFaxQueue',_0x3aa48f,JSON[_0x9ea3('0x14')](_0x587c08));_0x20b308(_0x587c08);})['catch'](function(_0x466a45){logger[_0x9ea3('0x15')](_0x9ea3('0x19'),_0x466a45[_0x9ea3('0x16')],_0x3aa48f);_0xf9ff51(_0x377bbe[_0x9ea3('0x15')](0x1f4,_0x466a45[_0x9ea3('0x16')]));});});};exports['ShowFaxQueue']=function(_0x5a7514){var _0x4e472f=this;return new Promise(function(_0x47e35f,_0x55b712){return db['FaxQueue'][_0x9ea3('0x22')]({'raw':_0x5a7514[_0x9ea3('0x1e')]?_0x5a7514[_0x9ea3('0x1e')][_0x9ea3('0x23')]===undefined?!![]:![]:!![],'where':_0x5a7514[_0x9ea3('0x1e')]?_0x5a7514[_0x9ea3('0x1e')][_0x9ea3('0x1c')]||null:null,'attributes':_0x5a7514[_0x9ea3('0x1e')]?_0x5a7514[_0x9ea3('0x1e')][_0x9ea3('0x1d')]||null:null,'include':_0x5a7514[_0x9ea3('0x1e')]?_0x5a7514['options'][_0x9ea3('0x1f')]?_[_0x9ea3('0x20')](_0x5a7514[_0x9ea3('0x1e')][_0x9ea3('0x1f')],function(_0x350357){return{'model':db[_0x350357[_0x9ea3('0x21')]],'as':_0x350357['as'],'attributes':_0x350357[_0x9ea3('0x1d')],'include':_0x350357[_0x9ea3('0x1f')]?_[_0x9ea3('0x20')](_0x350357['include'],function(_0x146f8f){return{'model':db[_0x146f8f[_0x9ea3('0x21')]],'as':_0x146f8f['as'],'attributes':_0x146f8f[_0x9ea3('0x1d')],'include':_0x146f8f['include']?_[_0x9ea3('0x20')](_0x146f8f[_0x9ea3('0x1f')],function(_0x22d02a){return{'model':db[_0x22d02a[_0x9ea3('0x21')]],'as':_0x22d02a['as'],'attributes':_0x22d02a[_0x9ea3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9ea3('0xf')](function(_0x257461){logger['info']('ShowFaxQueue',_0x5a7514);logger['debug']('ShowFaxQueue',_0x5a7514,JSON[_0x9ea3('0x14')](_0x257461));_0x47e35f(_0x257461);})[_0x9ea3('0x24')](function(_0x515e1d){logger[_0x9ea3('0x15')](_0x9ea3('0x25'),_0x515e1d['message'],_0x5a7514);_0x55b712(_0x4e472f[_0x9ea3('0x15')](0x1f4,_0x515e1d[_0x9ea3('0x16')]));});});}; \ No newline at end of file +var _0x3ebe=['localhost','socket.io-emitter','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x19983e,_0x1ccc39){var _0x233d7c=function(_0x479d57){while(--_0x479d57){_0x19983e['push'](_0x19983e['shift']());}};_0x233d7c(++_0x1ccc39);}(_0x3ebe,0x93));var _0xe3eb=function(_0x4c1d1a,_0x10f494){_0x4c1d1a=_0x4c1d1a-0x0;var _0xac7254=_0x3ebe[_0x4c1d1a];return _0xac7254;};'use strict';var _=require(_0xe3eb('0x0'));var util=require(_0xe3eb('0x1'));var moment=require(_0xe3eb('0x2'));var BPromise=require(_0xe3eb('0x3'));var rs=require(_0xe3eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe3eb('0x5'));var logger=require(_0xe3eb('0x6'))(_0xe3eb('0x7'));var config=require(_0xe3eb('0x8'));var jayson=require(_0xe3eb('0x9'));var client=jayson[_0xe3eb('0xa')][_0xe3eb('0xb')]({'port':0x232a});config[_0xe3eb('0xc')]=_['defaults'](config[_0xe3eb('0xc')],{'host':_0xe3eb('0xd'),'port':0x18eb});var socket=require(_0xe3eb('0xe'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3a4ec0,_0x3e8589,_0x358946){return new BPromise(function(_0x43ce84,_0x4ee7f4){return client[_0xe3eb('0xf')](_0x3a4ec0,_0x358946)[_0xe3eb('0x10')](function(_0x5c2634){logger[_0xe3eb('0x11')](_0xe3eb('0x12'),_0x3e8589,_0xe3eb('0x13'));logger[_0xe3eb('0x14')](_0xe3eb('0x15'),_0x3e8589,'request\x20sent',JSON[_0xe3eb('0x16')](_0x5c2634));if(_0x5c2634[_0xe3eb('0x17')]){if(_0x5c2634['error']['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x3e8589,_0x5c2634['error'][_0xe3eb('0x18')]);return _0x4ee7f4(_0x5c2634['error'][_0xe3eb('0x18')]);}logger[_0xe3eb('0x17')]('FaxQueue,\x20%s,\x20%s',_0x3e8589,_0x5c2634['error'][_0xe3eb('0x18')]);return _0x43ce84(_0x5c2634[_0xe3eb('0x17')]['message']);}else{logger[_0xe3eb('0x11')](_0xe3eb('0x12'),_0x3e8589,_0xe3eb('0x13'));_0x43ce84(_0x5c2634[_0xe3eb('0x19')][_0xe3eb('0x18')]);}})[_0xe3eb('0x1a')](function(_0x2488d5){logger[_0xe3eb('0x17')](_0xe3eb('0x12'),_0x3e8589,_0x2488d5);_0x4ee7f4(_0x2488d5);});});}exports[_0xe3eb('0x1b')]=function(_0x3ef8ce){var _0x3218bb=this;return new Promise(function(_0x52fc64,_0x582d2a){return db[_0xe3eb('0x1c')][_0xe3eb('0x1d')]({'raw':_0x3ef8ce['options']?_0x3ef8ce[_0xe3eb('0x1e')][_0xe3eb('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ef8ce[_0xe3eb('0x1e')]?_0x3ef8ce[_0xe3eb('0x1e')][_0xe3eb('0x20')]||null:null,'attributes':_0x3ef8ce[_0xe3eb('0x1e')]?_0x3ef8ce['options'][_0xe3eb('0x21')]||null:null,'limit':_0x3ef8ce[_0xe3eb('0x1e')]?_0x3ef8ce['options'][_0xe3eb('0x22')]||null:null,'include':_0x3ef8ce[_0xe3eb('0x1e')]?_0x3ef8ce[_0xe3eb('0x1e')]['include']?_[_0xe3eb('0x23')](_0x3ef8ce['options'][_0xe3eb('0x24')],function(_0x48f176){return{'model':db[_0x48f176[_0xe3eb('0x25')]],'as':_0x48f176['as'],'attributes':_0x48f176[_0xe3eb('0x21')],'include':_0x48f176[_0xe3eb('0x24')]?_[_0xe3eb('0x23')](_0x48f176['include'],function(_0x21fcec){return{'model':db[_0x21fcec[_0xe3eb('0x25')]],'as':_0x21fcec['as'],'attributes':_0x21fcec[_0xe3eb('0x21')],'include':_0x21fcec[_0xe3eb('0x24')]?_[_0xe3eb('0x23')](_0x21fcec['include'],function(_0x212bb8){return{'model':db[_0x212bb8[_0xe3eb('0x25')]],'as':_0x212bb8['as'],'attributes':_0x212bb8[_0xe3eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe3eb('0x10')](function(_0x6a00c8){logger[_0xe3eb('0x11')](_0xe3eb('0x1b'),_0x3ef8ce);logger[_0xe3eb('0x14')](_0xe3eb('0x1b'),_0x3ef8ce,JSON[_0xe3eb('0x16')](_0x6a00c8));_0x52fc64(_0x6a00c8);})[_0xe3eb('0x1a')](function(_0x725493){logger[_0xe3eb('0x17')](_0xe3eb('0x1b'),_0x725493[_0xe3eb('0x18')],_0x3ef8ce);_0x582d2a(_0x3218bb[_0xe3eb('0x17')](0x1f4,_0x725493[_0xe3eb('0x18')]));});});};exports[_0xe3eb('0x26')]=function(_0x414d12){var _0xd7ae31=this;return new Promise(function(_0x33ebb2,_0x6c52aa){return db['FaxQueue'][_0xe3eb('0x27')]({'raw':_0x414d12[_0xe3eb('0x1e')]?_0x414d12[_0xe3eb('0x1e')][_0xe3eb('0x1f')]===undefined?!![]:![]:!![],'where':_0x414d12[_0xe3eb('0x1e')]?_0x414d12[_0xe3eb('0x1e')][_0xe3eb('0x20')]||null:null,'attributes':_0x414d12[_0xe3eb('0x1e')]?_0x414d12['options'][_0xe3eb('0x21')]||null:null,'include':_0x414d12['options']?_0x414d12[_0xe3eb('0x1e')][_0xe3eb('0x24')]?_['map'](_0x414d12['options'][_0xe3eb('0x24')],function(_0x3dfecd){return{'model':db[_0x3dfecd['model']],'as':_0x3dfecd['as'],'attributes':_0x3dfecd[_0xe3eb('0x21')],'include':_0x3dfecd[_0xe3eb('0x24')]?_['map'](_0x3dfecd[_0xe3eb('0x24')],function(_0x19026d){return{'model':db[_0x19026d[_0xe3eb('0x25')]],'as':_0x19026d['as'],'attributes':_0x19026d['attributes'],'include':_0x19026d[_0xe3eb('0x24')]?_[_0xe3eb('0x23')](_0x19026d['include'],function(_0x1fd431){return{'model':db[_0x1fd431['model']],'as':_0x1fd431['as'],'attributes':_0x1fd431[_0xe3eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe3eb('0x10')](function(_0x5a64fa){logger[_0xe3eb('0x11')](_0xe3eb('0x26'),_0x414d12);logger[_0xe3eb('0x14')]('ShowFaxQueue',_0x414d12,JSON['stringify'](_0x5a64fa));_0x33ebb2(_0x5a64fa);})[_0xe3eb('0x1a')](function(_0x43f704){logger['error'](_0xe3eb('0x26'),_0x43f704[_0xe3eb('0x18')],_0x414d12);_0x6c52aa(_0xd7ae31[_0xe3eb('0x17')](0x1f4,_0x43f704[_0xe3eb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d2fd30b..e27707b 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 _0x4e7b=['./faxQueue.events','save','remove','update','emit','removeListener','faxQueue:'];(function(_0x581e7a,_0x46c0ad){var _0x29361b=function(_0x2908c4){while(--_0x2908c4){_0x581e7a['push'](_0x581e7a['shift']());}};_0x29361b(++_0x46c0ad);}(_0x4e7b,0xe7));var _0xb4e7=function(_0x2dfad5,_0x2abaca){_0x2dfad5=_0x2dfad5-0x0;var _0x373c6d=_0x4e7b[_0x2dfad5];return _0x373c6d;};'use strict';var FaxQueueEvents=require(_0xb4e7('0x0'));var events=[_0xb4e7('0x1'),_0xb4e7('0x2'),_0xb4e7('0x3')];function createListener(_0x528c2b,_0x1040cd){return function(_0x3d7d6e){_0x1040cd[_0xb4e7('0x4')](_0x528c2b,_0x3d7d6e);};}function removeListener(_0x378a1b,_0x2d3b28){return function(){FaxQueueEvents[_0xb4e7('0x5')](_0x378a1b,_0x2d3b28);};}exports['register']=function(_0x149a0a){for(var _0x56d877=0x0,_0x4e5b7b=events['length'];_0x56d877<_0x4e5b7b;_0x56d877++){var _0x3f8512=events[_0x56d877];var _0x3d4e5c=createListener(_0xb4e7('0x6')+_0x3f8512,_0x149a0a);FaxQueueEvents['on'](_0x3f8512,_0x3d4e5c);}}; \ No newline at end of file +var _0x7604=['register','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x2aad02,_0x556ae7){var _0x546e5b=function(_0x129356){while(--_0x129356){_0x2aad02['push'](_0x2aad02['shift']());}};_0x546e5b(++_0x556ae7);}(_0x7604,0xd2));var _0x4760=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7604[_0x2c91e9];return _0x13f0ff;};'use strict';var FaxQueueEvents=require(_0x4760('0x0'));var events=[_0x4760('0x1'),_0x4760('0x2'),_0x4760('0x3')];function createListener(_0x4be602,_0x49c9cd){return function(_0xfa7b99){_0x49c9cd[_0x4760('0x4')](_0x4be602,_0xfa7b99);};}function removeListener(_0x18d2bf,_0x4a09ce){return function(){FaxQueueEvents[_0x4760('0x5')](_0x18d2bf,_0x4a09ce);};}exports[_0x4760('0x6')]=function(_0x4b0681){for(var _0x3d707b=0x0,_0x27df02=events['length'];_0x3d707b<_0x27df02;_0x3d707b++){var _0xb54ca1=events[_0x3d707b];var _0xc10f20=createListener(_0x4760('0x7')+_0xb54ca1,_0x4b0681);FaxQueueEvents['on'](_0xb54ca1,_0xc10f20);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 03a49eb..ed0156b 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 _0xe3da=['/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','/:id','update','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers'];(function(_0x5928a9,_0x199526){var _0x439fc6=function(_0x31db53){while(--_0x31db53){_0x5928a9['push'](_0x5928a9['shift']());}};_0x439fc6(++_0x199526);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0xb')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0xb')]('/:id/teams',auth[_0xae3d('0xc')](),controller['getTeams']);router[_0xae3d('0xb')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x14')]);router['post']('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x15')]);router[_0xae3d('0x16')](_0xae3d('0x17'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x18')]);router[_0xae3d('0x16')]('/:id/users',auth[_0xae3d('0xc')](),controller[_0xae3d('0x19')]);router[_0xae3d('0x1a')](_0xae3d('0x1b'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1c')]);router['delete'](_0xae3d('0x1b'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1d')]);router['delete'](_0xae3d('0x17'),auth[_0xae3d('0xc')](),controller['removeTeams']);router['delete'](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1e')]);module[_0xae3d('0x1f')]=router; \ No newline at end of file +var _0x6363=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x46a3e8,_0x2e1b35){var _0xf1442e=function(_0x37b5d4){while(--_0x37b5d4){_0x46a3e8['push'](_0x46a3e8['shift']());}};_0xf1442e(++_0x2e1b35);}(_0x6363,0x13a));var _0x3636=function(_0x1627ca,_0x563c14){_0x1627ca=_0x1627ca-0x0;var _0x4b828f=_0x6363[_0x1627ca];return _0x4b828f;};'use strict';var multer=require(_0x3636('0x0'));var util=require('util');var path=require(_0x3636('0x1'));var timeout=require(_0x3636('0x2'));var express=require(_0x3636('0x3'));var router=express[_0x3636('0x4')]();var fs_extra=require(_0x3636('0x5'));var auth=require(_0x3636('0x6'));var interaction=require(_0x3636('0x7'));var config=require(_0x3636('0x8'));var controller=require(_0x3636('0x9'));router[_0x3636('0xa')]('/',auth[_0x3636('0xb')](),controller[_0x3636('0xc')]);router[_0x3636('0xa')](_0x3636('0xd'),auth['isAuthenticated'](),controller[_0x3636('0xe')]);router['get'](_0x3636('0xf'),auth[_0x3636('0xb')](),controller[_0x3636('0x10')]);router[_0x3636('0xa')](_0x3636('0x11'),auth[_0x3636('0xb')](),controller[_0x3636('0x12')]);router[_0x3636('0xa')](_0x3636('0x13'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3636('0xa')]('/:id/users',auth[_0x3636('0xb')](),controller[_0x3636('0x14')]);router[_0x3636('0x15')]('/',auth[_0x3636('0xb')](),controller[_0x3636('0x16')]);router[_0x3636('0x15')](_0x3636('0x13'),auth[_0x3636('0xb')](),controller[_0x3636('0x17')]);router[_0x3636('0x15')](_0x3636('0x18'),auth[_0x3636('0xb')](),controller[_0x3636('0x19')]);router[_0x3636('0x1a')](_0x3636('0xf'),auth[_0x3636('0xb')](),controller[_0x3636('0x1b')]);router['delete'](_0x3636('0xf'),auth[_0x3636('0xb')](),controller['destroy']);router[_0x3636('0x1c')]('/:id/teams',auth['isAuthenticated'](),controller[_0x3636('0x1d')]);router[_0x3636('0x1c')](_0x3636('0x18'),auth[_0x3636('0xb')](),controller[_0x3636('0x1e')]);module[_0x3636('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 946657c..3f73859 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 _0x74c3=['moment','sequelize','STRING','DATE'];(function(_0x40e304,_0xafe056){var _0x355d35=function(_0x3f20ac){while(--_0x3f20ac){_0x40e304['push'](_0x40e304['shift']());}};_0x355d35(++_0xafe056);}(_0x74c3,0x16c));var _0x374c=function(_0x42cc7a,_0x5b4f33){_0x42cc7a=_0x42cc7a-0x0;var _0x2025fc=_0x74c3[_0x42cc7a];return _0x2025fc;};'use strict';var moment=require(_0x374c('0x0'));var Sequelize=require(_0x374c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x374c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x374c('0x3')]},'exitAt':{'type':Sequelize[_0x374c('0x3')]},'reason':{'type':Sequelize[_0x374c('0x2')]}}; \ No newline at end of file +var _0x8cd9=['sequelize','exports','STRING','DATE','moment'];(function(_0x5567dd,_0x35d872){var _0x11f96c=function(_0x5ba6ed){while(--_0x5ba6ed){_0x5567dd['push'](_0x5567dd['shift']());}};_0x11f96c(++_0x35d872);}(_0x8cd9,0xea));var _0x98cd=function(_0x197974,_0xe9c65c){_0x197974=_0x197974-0x0;var _0x2f95a6=_0x8cd9[_0x197974];return _0x2f95a6;};'use strict';var moment=require(_0x98cd('0x0'));var Sequelize=require(_0x98cd('0x1'));module[_0x98cd('0x2')]={'uniqueid':{'type':Sequelize[_0x98cd('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x98cd('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x98cd('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x98cd('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 4253ff8..cda84d0 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 _0xe644=['status','end','offset','undefined','limit','count','set','apply','reject','then','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','length','hasOwnProperty','nolimit','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4e64('0x0'));var rimraf=require(_0x4e64('0x1'));var zipdir=require(_0x4e64('0x2'));var jsonpatch=require(_0x4e64('0x3'));var rp=require(_0x4e64('0x4'));var moment=require(_0x4e64('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4e64('0x6'));var util=require(_0x4e64('0x7'));var path=require(_0x4e64('0x8'));var sox=require(_0x4e64('0x9'));var csv=require(_0x4e64('0xa'));var ejs=require(_0x4e64('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e64('0xc'));var squel=require(_0x4e64('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4e64('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e64('0xf'));var Redis=require(_0x4e64('0x10'));var authService=require(_0x4e64('0x11'));var qs=require(_0x4e64('0x12'));var as=require(_0x4e64('0x13'));var hardwareService=require(_0x4e64('0x14'));var logger=require('../../config/logger')(_0x4e64('0x15'));var utils=require(_0x4e64('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4e64('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7ce0,_0x573e67){_0x573e67=_0x573e67||0xcc;return function(_0x4c1cf3){if(_0x4c1cf3){return _0x4c7ce0[_0x4e64('0x18')](_0x573e67);}return _0x4c7ce0[_0x4e64('0x19')](_0x573e67)[_0x4e64('0x1a')]();};}function respondWithResult(_0x2aa800,_0x352eca){_0x352eca=_0x352eca||0xc8;return function(_0xb36502){if(_0xb36502){return _0x2aa800[_0x4e64('0x19')](_0x352eca)['json'](_0xb36502);}};}function respondWithFilteredResult(_0x1d274c,_0x5573af){return function(_0x78cdc6){if(_0x78cdc6){var _0x5b35b0=typeof _0x5573af[_0x4e64('0x1b')]===_0x4e64('0x1c')&&typeof _0x5573af[_0x4e64('0x1d')]===_0x4e64('0x1c');var _0x2bbaaa=_0x78cdc6[_0x4e64('0x1e')];var _0x135ffb=_0x5b35b0?0x0:_0x5573af[_0x4e64('0x1b')];var _0x1be196=_0x5b35b0?_0x78cdc6[_0x4e64('0x1e')]:_0x5573af['offset']+_0x5573af[_0x4e64('0x1d')];var _0x112797;if(_0x1be196>=_0x2bbaaa){_0x1be196=_0x2bbaaa;_0x112797=0xc8;}else{_0x112797=0xce;}_0x1d274c['status'](_0x112797);return _0x1d274c[_0x4e64('0x1f')]('Content-Range',_0x135ffb+'-'+_0x1be196+'/'+_0x2bbaaa)['json'](_0x78cdc6);}return null;};}function patchUpdates(_0x18a1d3){return function(_0x120f14){try{jsonpatch[_0x4e64('0x20')](_0x120f14,_0x18a1d3,!![]);}catch(_0x4a97a4){return BPromise[_0x4e64('0x21')](_0x4a97a4);}return _0x120f14['save']();};}function saveUpdates(_0x30e356,_0x336c53){return function(_0x2df7a0){if(_0x2df7a0){return _0x2df7a0['update'](_0x30e356)[_0x4e64('0x22')](function(_0x58ea85){return _0x58ea85;});}return null;};}function removeEntity(_0x2431eb,_0x27d33e){return function(_0x445864){if(_0x445864){return _0x445864[_0x4e64('0x23')]()[_0x4e64('0x22')](function(){_0x2431eb['status'](0xcc)[_0x4e64('0x1a')]();});}};}function handleEntityNotFound(_0x29b4f8,_0x394a80){return function(_0x4afb9c){if(!_0x4afb9c){_0x29b4f8[_0x4e64('0x18')](0x194);}return _0x4afb9c;};}function handleError(_0x2f9637,_0x3a39ab){_0x3a39ab=_0x3a39ab||0x1f4;return function(_0x457023){logger[_0x4e64('0x24')](_0x457023['stack']);if(_0x457023[_0x4e64('0x25')]){delete _0x457023[_0x4e64('0x25')];}_0x2f9637[_0x4e64('0x19')](_0x3a39ab)[_0x4e64('0x26')](_0x457023);};}exports[_0x4e64('0x27')]=function(_0x1057d0,_0x3bac8c){var _0x14e389={},_0x5467a5={},_0x371035={'count':0x0,'rows':[]};var _0xb17ca7=_[_0x4e64('0x28')](db[_0x4e64('0x29')][_0x4e64('0x2a')],function(_0x3b1f16){return{'name':_0x3b1f16[_0x4e64('0x2b')],'type':_0x3b1f16['type'][_0x4e64('0x2c')]};});_0x5467a5[_0x4e64('0x2d')]=_[_0x4e64('0x28')](_0xb17ca7,_0x4e64('0x25'));_0x5467a5[_0x4e64('0x2e')]=_[_0x4e64('0x2f')](_0x1057d0[_0x4e64('0x2e')]);_0x5467a5['filters']=_[_0x4e64('0x30')](_0x5467a5[_0x4e64('0x2d')],_0x5467a5[_0x4e64('0x2e')]);_0x14e389['attributes']=_[_0x4e64('0x30')](_0x5467a5['model'],qs[_0x4e64('0x31')](_0x1057d0[_0x4e64('0x2e')]['fields']));_0x14e389['attributes']=_0x14e389['attributes'][_0x4e64('0x32')]?_0x14e389['attributes']:_0x5467a5[_0x4e64('0x2d')];if(!_0x1057d0[_0x4e64('0x2e')][_0x4e64('0x33')](_0x4e64('0x34'))){_0x14e389[_0x4e64('0x1d')]=qs[_0x4e64('0x1d')](_0x1057d0[_0x4e64('0x2e')]['limit']);_0x14e389[_0x4e64('0x1b')]=qs['offset'](_0x1057d0[_0x4e64('0x2e')]['offset']);}_0x14e389['order']=qs['sort'](_0x1057d0[_0x4e64('0x2e')]['sort']);_0x14e389['where']=qs[_0x4e64('0x35')](_[_0x4e64('0x36')](_0x1057d0[_0x4e64('0x2e')],_0x5467a5[_0x4e64('0x35')]),_0xb17ca7);if(_0x1057d0[_0x4e64('0x2e')][_0x4e64('0x37')]){_0x14e389[_0x4e64('0x38')]=_['merge'](_0x14e389['where'],{'$or':_['map'](_0xb17ca7,function(_0x33d426){if(_0x33d426[_0x4e64('0x39')]!==_0x4e64('0x3a')){var _0x422b81={};_0x422b81[_0x33d426['name']]={'$like':'%'+_0x1057d0[_0x4e64('0x2e')][_0x4e64('0x37')]+'%'};return _0x422b81;}})});}_0x14e389=_[_0x4e64('0x3b')]({},_0x14e389,_0x1057d0[_0x4e64('0x3c')]);var _0x289901={'where':_0x14e389['where']};return db['FaxQueueReport'][_0x4e64('0x1e')](_0x289901)['then'](function(_0x44e640){_0x371035[_0x4e64('0x1e')]=_0x44e640;if(_0x1057d0[_0x4e64('0x2e')][_0x4e64('0x3d')]){_0x14e389[_0x4e64('0x3e')]=[{'all':!![]}];}return db[_0x4e64('0x29')][_0x4e64('0x3f')](_0x14e389);})['then'](function(_0x15ca67){_0x371035[_0x4e64('0x40')]=_0x15ca67;return _0x371035;})[_0x4e64('0x22')](respondWithFilteredResult(_0x3bac8c,_0x14e389))[_0x4e64('0x41')](handleError(_0x3bac8c,null));};exports[_0x4e64('0x42')]=function(_0x2b60fb,_0x42b8a8){var _0x21e835={'raw':!![],'where':{'id':_0x2b60fb[_0x4e64('0x43')]['id']}},_0x496e6f={};_0x496e6f[_0x4e64('0x2d')]=_['keys'](db[_0x4e64('0x29')][_0x4e64('0x2a')]);_0x496e6f['query']=_[_0x4e64('0x2f')](_0x2b60fb[_0x4e64('0x2e')]);_0x496e6f[_0x4e64('0x35')]=_[_0x4e64('0x30')](_0x496e6f[_0x4e64('0x2d')],_0x496e6f['query']);_0x21e835[_0x4e64('0x44')]=_[_0x4e64('0x30')](_0x496e6f[_0x4e64('0x2d')],qs[_0x4e64('0x31')](_0x2b60fb[_0x4e64('0x2e')][_0x4e64('0x31')]));_0x21e835[_0x4e64('0x44')]=_0x21e835[_0x4e64('0x44')]['length']?_0x21e835['attributes']:_0x496e6f[_0x4e64('0x2d')];if(_0x2b60fb[_0x4e64('0x2e')][_0x4e64('0x3d')]){_0x21e835['include']=[{'all':!![]}];}_0x21e835=_[_0x4e64('0x3b')]({},_0x21e835,_0x2b60fb[_0x4e64('0x3c')]);return db[_0x4e64('0x29')][_0x4e64('0x45')](_0x21e835)[_0x4e64('0x22')](handleEntityNotFound(_0x42b8a8,null))['then'](respondWithResult(_0x42b8a8,null))[_0x4e64('0x41')](handleError(_0x42b8a8,null));};exports['create']=function(_0x32906d,_0x3a5fad){return db[_0x4e64('0x29')][_0x4e64('0x46')](_0x32906d['body'],{})[_0x4e64('0x22')](respondWithResult(_0x3a5fad,0xc9))[_0x4e64('0x41')](handleError(_0x3a5fad,null));};exports[_0x4e64('0x47')]=function(_0x38a885,_0x32db0b){if(_0x38a885['body']['id']){delete _0x38a885[_0x4e64('0x48')]['id'];}return db[_0x4e64('0x29')][_0x4e64('0x45')]({'where':{'id':_0x38a885[_0x4e64('0x43')]['id']}})[_0x4e64('0x22')](handleEntityNotFound(_0x32db0b,null))[_0x4e64('0x22')](saveUpdates(_0x38a885['body'],null))[_0x4e64('0x22')](respondWithResult(_0x32db0b,null))[_0x4e64('0x41')](handleError(_0x32db0b,null));};exports[_0x4e64('0x23')]=function(_0x4c2948,_0x44946b){return db[_0x4e64('0x29')]['find']({'where':{'id':_0x4c2948[_0x4e64('0x43')]['id']}})['then'](handleEntityNotFound(_0x44946b,null))[_0x4e64('0x22')](removeEntity(_0x44946b,null))['catch'](handleError(_0x44946b,null));};exports[_0x4e64('0x49')]=function(_0x589a76,_0x599c9){return db[_0x4e64('0x29')][_0x4e64('0x49')]()[_0x4e64('0x22')](respondWithResult(_0x599c9,null))[_0x4e64('0x41')](handleError(_0x599c9,null));}; \ No newline at end of file +var _0x0439=['intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x5c183a,_0x52306a){var _0x1808ad=function(_0x4c25ce){while(--_0x4c25ce){_0x5c183a['push'](_0x5c183a['shift']());}};_0x1808ad(++_0x52306a);}(_0x0439,0xdd));var _0x9043=function(_0x236eee,_0x32421f){_0x236eee=_0x236eee-0x0;var _0x1dd280=_0x0439[_0x236eee];return _0x1dd280;};'use strict';var emlformat=require(_0x9043('0x0'));var rimraf=require(_0x9043('0x1'));var zipdir=require(_0x9043('0x2'));var jsonpatch=require(_0x9043('0x3'));var rp=require(_0x9043('0x4'));var moment=require(_0x9043('0x5'));var BPromise=require(_0x9043('0x6'));var Mustache=require('mustache');var util=require(_0x9043('0x7'));var path=require(_0x9043('0x8'));var sox=require(_0x9043('0x9'));var csv=require('to-csv');var ejs=require(_0x9043('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9043('0xb'));var crypto=require(_0x9043('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9043('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9043('0xe'));var Papa=require(_0x9043('0xf'));var Redis=require('ioredis');var authService=require(_0x9043('0x10'));var qs=require(_0x9043('0x11'));var as=require(_0x9043('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9043('0x13'));var utils=require(_0x9043('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9043('0x15'));var db=require(_0x9043('0x16'))['db'];function respondWithStatusCode(_0x3d8d67,_0x2bf58d){_0x2bf58d=_0x2bf58d||0xcc;return function(_0xcd2bf1){if(_0xcd2bf1){return _0x3d8d67[_0x9043('0x17')](_0x2bf58d);}return _0x3d8d67['status'](_0x2bf58d)[_0x9043('0x18')]();};}function respondWithResult(_0xf3f958,_0x48b142){_0x48b142=_0x48b142||0xc8;return function(_0x18f916){if(_0x18f916){return _0xf3f958[_0x9043('0x19')](_0x48b142)['json'](_0x18f916);}};}function respondWithFilteredResult(_0x37eca8,_0x1c2473){return function(_0x3aaee1){if(_0x3aaee1){var _0x2b3c2d=typeof _0x1c2473[_0x9043('0x1a')]===_0x9043('0x1b')&&typeof _0x1c2473[_0x9043('0x1c')]===_0x9043('0x1b');var _0x21f330=_0x3aaee1[_0x9043('0x1d')];var _0x51823a=_0x2b3c2d?0x0:_0x1c2473['offset'];var _0x47fbdc=_0x2b3c2d?_0x3aaee1[_0x9043('0x1d')]:_0x1c2473[_0x9043('0x1a')]+_0x1c2473[_0x9043('0x1c')];var _0x43bbd4;if(_0x47fbdc>=_0x21f330){_0x47fbdc=_0x21f330;_0x43bbd4=0xc8;}else{_0x43bbd4=0xce;}_0x37eca8['status'](_0x43bbd4);return _0x37eca8[_0x9043('0x1e')]('Content-Range',_0x51823a+'-'+_0x47fbdc+'/'+_0x21f330)['json'](_0x3aaee1);}return null;};}function patchUpdates(_0x161511){return function(_0x3572d5){try{jsonpatch[_0x9043('0x1f')](_0x3572d5,_0x161511,!![]);}catch(_0x820f8c){return BPromise[_0x9043('0x20')](_0x820f8c);}return _0x3572d5[_0x9043('0x21')]();};}function saveUpdates(_0x3a82b4,_0x366695){return function(_0x5a3f7a){if(_0x5a3f7a){return _0x5a3f7a[_0x9043('0x22')](_0x3a82b4)[_0x9043('0x23')](function(_0x30930c){return _0x30930c;});}return null;};}function removeEntity(_0x5506bf,_0x18727f){return function(_0x3c4fa4){if(_0x3c4fa4){return _0x3c4fa4[_0x9043('0x24')]()[_0x9043('0x23')](function(){_0x5506bf[_0x9043('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16caf2,_0xca0bb1){return function(_0x6d23af){if(!_0x6d23af){_0x16caf2[_0x9043('0x17')](0x194);}return _0x6d23af;};}function handleError(_0x2003c3,_0x13e8dd){_0x13e8dd=_0x13e8dd||0x1f4;return function(_0x5f4975){logger[_0x9043('0x25')](_0x5f4975['stack']);if(_0x5f4975[_0x9043('0x26')]){delete _0x5f4975[_0x9043('0x26')];}_0x2003c3[_0x9043('0x19')](_0x13e8dd)[_0x9043('0x27')](_0x5f4975);};}exports['index']=function(_0xc92d75,_0x2e12b1){var _0x14cf80={},_0x228d7f={},_0x37ecc2={'count':0x0,'rows':[]};var _0x590357=_[_0x9043('0x28')](db[_0x9043('0x29')][_0x9043('0x2a')],function(_0x4e4363){return{'name':_0x4e4363[_0x9043('0x2b')],'type':_0x4e4363[_0x9043('0x2c')]['key']};});_0x228d7f[_0x9043('0x2d')]=_[_0x9043('0x28')](_0x590357,'name');_0x228d7f[_0x9043('0x2e')]=_[_0x9043('0x2f')](_0xc92d75[_0x9043('0x2e')]);_0x228d7f[_0x9043('0x30')]=_['intersection'](_0x228d7f[_0x9043('0x2d')],_0x228d7f[_0x9043('0x2e')]);_0x14cf80['attributes']=_['intersection'](_0x228d7f[_0x9043('0x2d')],qs[_0x9043('0x31')](_0xc92d75[_0x9043('0x2e')][_0x9043('0x31')]));_0x14cf80[_0x9043('0x32')]=_0x14cf80[_0x9043('0x32')]['length']?_0x14cf80['attributes']:_0x228d7f[_0x9043('0x2d')];if(!_0xc92d75[_0x9043('0x2e')][_0x9043('0x33')](_0x9043('0x34'))){_0x14cf80[_0x9043('0x1c')]=qs[_0x9043('0x1c')](_0xc92d75[_0x9043('0x2e')]['limit']);_0x14cf80[_0x9043('0x1a')]=qs['offset'](_0xc92d75[_0x9043('0x2e')]['offset']);}_0x14cf80[_0x9043('0x35')]=qs[_0x9043('0x36')](_0xc92d75['query']['sort']);_0x14cf80[_0x9043('0x37')]=qs[_0x9043('0x30')](_[_0x9043('0x38')](_0xc92d75[_0x9043('0x2e')],_0x228d7f[_0x9043('0x30')]),_0x590357);if(_0xc92d75[_0x9043('0x2e')][_0x9043('0x39')]){_0x14cf80[_0x9043('0x37')]=_[_0x9043('0x3a')](_0x14cf80[_0x9043('0x37')],{'$or':_[_0x9043('0x28')](_0x590357,function(_0x19b858){if(_0x19b858['type']!==_0x9043('0x3b')){var _0x5187bf={};_0x5187bf[_0x19b858[_0x9043('0x26')]]={'$like':'%'+_0xc92d75[_0x9043('0x2e')]['filter']+'%'};return _0x5187bf;}})});}_0x14cf80=_[_0x9043('0x3a')]({},_0x14cf80,_0xc92d75[_0x9043('0x3c')]);var _0x1dc9cf={'where':_0x14cf80['where']};return db[_0x9043('0x29')][_0x9043('0x1d')](_0x1dc9cf)[_0x9043('0x23')](function(_0x3cdaf9){_0x37ecc2[_0x9043('0x1d')]=_0x3cdaf9;if(_0xc92d75[_0x9043('0x2e')][_0x9043('0x3d')]){_0x14cf80[_0x9043('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x9043('0x3f')](_0x14cf80);})['then'](function(_0x56a084){_0x37ecc2[_0x9043('0x40')]=_0x56a084;return _0x37ecc2;})['then'](respondWithFilteredResult(_0x2e12b1,_0x14cf80))[_0x9043('0x41')](handleError(_0x2e12b1,null));};exports['show']=function(_0x392551,_0x3a75e0){var _0x2c479d={'raw':!![],'where':{'id':_0x392551[_0x9043('0x42')]['id']}},_0x38028b={};_0x38028b[_0x9043('0x2d')]=_['keys'](db[_0x9043('0x29')][_0x9043('0x2a')]);_0x38028b[_0x9043('0x2e')]=_['keys'](_0x392551[_0x9043('0x2e')]);_0x38028b[_0x9043('0x30')]=_['intersection'](_0x38028b[_0x9043('0x2d')],_0x38028b['query']);_0x2c479d[_0x9043('0x32')]=_[_0x9043('0x43')](_0x38028b['model'],qs['fields'](_0x392551[_0x9043('0x2e')][_0x9043('0x31')]));_0x2c479d[_0x9043('0x32')]=_0x2c479d[_0x9043('0x32')]['length']?_0x2c479d[_0x9043('0x32')]:_0x38028b[_0x9043('0x2d')];if(_0x392551['query']['includeAll']){_0x2c479d[_0x9043('0x3e')]=[{'all':!![]}];}_0x2c479d=_[_0x9043('0x3a')]({},_0x2c479d,_0x392551['options']);return db[_0x9043('0x29')][_0x9043('0x44')](_0x2c479d)[_0x9043('0x23')](handleEntityNotFound(_0x3a75e0,null))[_0x9043('0x23')](respondWithResult(_0x3a75e0,null))['catch'](handleError(_0x3a75e0,null));};exports[_0x9043('0x45')]=function(_0x172872,_0x5d7e24){return db[_0x9043('0x29')][_0x9043('0x45')](_0x172872[_0x9043('0x46')],{})[_0x9043('0x23')](respondWithResult(_0x5d7e24,0xc9))[_0x9043('0x41')](handleError(_0x5d7e24,null));};exports[_0x9043('0x22')]=function(_0x6f909a,_0x370821){if(_0x6f909a[_0x9043('0x46')]['id']){delete _0x6f909a[_0x9043('0x46')]['id'];}return db[_0x9043('0x29')][_0x9043('0x44')]({'where':{'id':_0x6f909a[_0x9043('0x42')]['id']}})[_0x9043('0x23')](handleEntityNotFound(_0x370821,null))['then'](saveUpdates(_0x6f909a[_0x9043('0x46')],null))[_0x9043('0x23')](respondWithResult(_0x370821,null))['catch'](handleError(_0x370821,null));};exports[_0x9043('0x24')]=function(_0x188695,_0x385fb6){return db['FaxQueueReport']['find']({'where':{'id':_0x188695[_0x9043('0x42')]['id']}})[_0x9043('0x23')](handleEntityNotFound(_0x385fb6,null))[_0x9043('0x23')](removeEntity(_0x385fb6,null))[_0x9043('0x41')](handleError(_0x385fb6,null));};exports['describe']=function(_0x13127e,_0x425205){return db[_0x9043('0x29')][_0x9043('0x47')]()['then'](respondWithResult(_0x425205,null))[_0x9043('0x41')](handleError(_0x425205,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 00fbdc1..337e7e4 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x55554a,_0x5be9c8){var _0x5886dd=function(_0x37aa82){while(--_0x37aa82){_0x55554a['push'](_0x55554a['shift']());}};_0x5886dd(++_0x5be9c8);}(_0x326f,0xd1));var _0xf326=function(_0x3d07be,_0x1ca822){_0x3d07be=_0x3d07be-0x0;var _0x4f5c6f=_0x326f[_0x3d07be];return _0x4f5c6f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash','api','request-promise','path'];(function(_0x358e18,_0x1ea02c){var _0x3bcf07=function(_0x531efd){while(--_0x531efd){_0x358e18['push'](_0x358e18['shift']());}};_0x3bcf07(++_0x1ea02c);}(_0x0295,0x1f0));var _0x5029=function(_0x451539,_0x4ddef2){_0x451539=_0x451539-0x0;var _0x290fd9=_0x0295[_0x451539];return _0x290fd9;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5029('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8390573..4a31257 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 _0x8789=['jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','debug','where','attributes','UpdateFaxQueueReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xb8bf45,_0x125781){var _0x1ddda9=function(_0x37f1e3){while(--_0x37f1e3){_0xb8bf45['push'](_0xb8bf45['shift']());}};_0x1ddda9(++_0x125781);}(_0x8789,0x6c));var _0x9878=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8789[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9878('0x0'));var BPromise=require(_0x9878('0x1'));var rs=require(_0x9878('0x2'));var fs=require('fs');var Redis=require(_0x9878('0x3'));var db=require(_0x9878('0x4'))['db'];var utils=require(_0x9878('0x5'));var logger=require(_0x9878('0x6'))(_0x9878('0x7'));var config=require('../../config/environment');var jayson=require(_0x9878('0x8'));var client=jayson['client'][_0x9878('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3aec08,_0x5ec74c,_0x1cdc71){return new BPromise(function(_0x39ba70,_0xe94d67){return client['request'](_0x3aec08,_0x1cdc71)[_0x9878('0xa')](function(_0x40ea62){logger[_0x9878('0xb')](_0x9878('0xc'),_0x5ec74c,_0x9878('0xd'));logger['debug'](_0x9878('0xe'),_0x5ec74c,_0x9878('0xd'),JSON[_0x9878('0xf')](_0x40ea62));if(_0x40ea62[_0x9878('0x10')]){if(_0x40ea62[_0x9878('0x10')]['code']===0x1f4){logger[_0x9878('0x10')](_0x9878('0xc'),_0x5ec74c,_0x40ea62[_0x9878('0x10')][_0x9878('0x11')]);return _0xe94d67(_0x40ea62[_0x9878('0x10')]['message']);}logger[_0x9878('0x10')](_0x9878('0xc'),_0x5ec74c,_0x40ea62[_0x9878('0x10')][_0x9878('0x11')]);return _0x39ba70(_0x40ea62[_0x9878('0x10')][_0x9878('0x11')]);}else{logger[_0x9878('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x5ec74c,_0x9878('0xd'));_0x39ba70(_0x40ea62[_0x9878('0x12')][_0x9878('0x11')]);}})[_0x9878('0x13')](function(_0x595495){logger[_0x9878('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x5ec74c,_0x595495);_0xe94d67(_0x595495);});});}exports[_0x9878('0x14')]=function(_0x21d51b){var _0xa0e733=this;return new Promise(function(_0x4e8099,_0x20c7c6){return db[_0x9878('0x15')][_0x9878('0x16')](_0x21d51b[_0x9878('0x17')],{'raw':_0x21d51b[_0x9878('0x18')]?_0x21d51b['options']['raw']===undefined?!![]:![]:!![]})[_0x9878('0xa')](function(_0x3d4f8d){logger['info']('CreateFaxQueueReport',_0x21d51b);logger[_0x9878('0x19')](_0x9878('0x14'),_0x21d51b,JSON['stringify'](_0x3d4f8d));_0x4e8099(_0x3d4f8d);})[_0x9878('0x13')](function(_0x18d986){logger[_0x9878('0x10')]('CreateFaxQueueReport',_0x18d986['message'],_0x21d51b);_0x20c7c6(_0xa0e733['error'](0x1f4,_0x18d986[_0x9878('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x59ce0c){var _0x3c53cd=this;return new Promise(function(_0x578058,_0x1ad7b7){return db[_0x9878('0x15')]['update'](_0x59ce0c[_0x9878('0x17')],{'raw':_0x59ce0c[_0x9878('0x18')]?_0x59ce0c[_0x9878('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ce0c[_0x9878('0x18')]?_0x59ce0c[_0x9878('0x18')][_0x9878('0x1a')]||null:null,'attributes':_0x59ce0c['options']?_0x59ce0c['options'][_0x9878('0x1b')]||null:null,'limit':_0x59ce0c[_0x9878('0x18')]?_0x59ce0c[_0x9878('0x18')]['limit']||null:null})[_0x9878('0xa')](function(_0x6293ed){logger[_0x9878('0xb')](_0x9878('0x1c'),_0x59ce0c);logger['debug'](_0x9878('0x1c'),_0x59ce0c,JSON[_0x9878('0xf')](_0x6293ed));_0x578058(_0x6293ed);})[_0x9878('0x13')](function(_0x47cd6d){logger['error'](_0x9878('0x1c'),_0x47cd6d[_0x9878('0x11')],_0x59ce0c);_0x1ad7b7(_0x3c53cd[_0x9878('0x10')](0x1f4,_0x47cd6d[_0x9878('0x11')]));});});}; \ No newline at end of file +var _0x741f=['then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug','update','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x741f,0x105));var _0xf741=function(_0x323a22,_0x2a3468){_0x323a22=_0x323a22-0x0;var _0xf3df94=_0x741f[_0x323a22];return _0xf3df94;};'use strict';var _=require(_0xf741('0x0'));var util=require(_0xf741('0x1'));var moment=require(_0xf741('0x2'));var BPromise=require(_0xf741('0x3'));var rs=require(_0xf741('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf741('0x5'))['db'];var utils=require(_0xf741('0x6'));var logger=require(_0xf741('0x7'))(_0xf741('0x8'));var config=require(_0xf741('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf741('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a7400,_0x24e394,_0xd1e0f5){return new BPromise(function(_0x5e9157,_0x502b38){return client['request'](_0x1a7400,_0xd1e0f5)[_0xf741('0xb')](function(_0xd71ca0){logger[_0xf741('0xc')](_0xf741('0xd'),_0x24e394,_0xf741('0xe'));logger['debug'](_0xf741('0xf'),_0x24e394,_0xf741('0xe'),JSON[_0xf741('0x10')](_0xd71ca0));if(_0xd71ca0[_0xf741('0x11')]){if(_0xd71ca0[_0xf741('0x11')][_0xf741('0x12')]===0x1f4){logger[_0xf741('0x11')](_0xf741('0xd'),_0x24e394,_0xd71ca0['error'][_0xf741('0x13')]);return _0x502b38(_0xd71ca0[_0xf741('0x11')]['message']);}logger['error'](_0xf741('0xd'),_0x24e394,_0xd71ca0[_0xf741('0x11')][_0xf741('0x13')]);return _0x5e9157(_0xd71ca0['error'][_0xf741('0x13')]);}else{logger[_0xf741('0xc')](_0xf741('0xd'),_0x24e394,_0xf741('0xe'));_0x5e9157(_0xd71ca0[_0xf741('0x14')]['message']);}})[_0xf741('0x15')](function(_0x3cb8c6){logger['error'](_0xf741('0xd'),_0x24e394,_0x3cb8c6);_0x502b38(_0x3cb8c6);});});}exports[_0xf741('0x16')]=function(_0x3e2f2b){var _0x2a7dac=this;return new Promise(function(_0x4b604d,_0x2bc4c1){return db[_0xf741('0x17')][_0xf741('0x18')](_0x3e2f2b[_0xf741('0x19')],{'raw':_0x3e2f2b[_0xf741('0x1a')]?_0x3e2f2b[_0xf741('0x1a')][_0xf741('0x1b')]===undefined?!![]:![]:!![]})[_0xf741('0xb')](function(_0x2bd9e3){logger[_0xf741('0xc')](_0xf741('0x16'),_0x3e2f2b);logger[_0xf741('0x1c')]('CreateFaxQueueReport',_0x3e2f2b,JSON[_0xf741('0x10')](_0x2bd9e3));_0x4b604d(_0x2bd9e3);})[_0xf741('0x15')](function(_0xa6a5fb){logger[_0xf741('0x11')]('CreateFaxQueueReport',_0xa6a5fb['message'],_0x3e2f2b);_0x2bc4c1(_0x2a7dac[_0xf741('0x11')](0x1f4,_0xa6a5fb['message']));});});};exports['UpdateFaxQueueReport']=function(_0x43789a){var _0x1e0ecb=this;return new Promise(function(_0x70f9b4,_0x505659){return db[_0xf741('0x17')][_0xf741('0x1d')](_0x43789a[_0xf741('0x19')],{'raw':_0x43789a[_0xf741('0x1a')]?_0x43789a[_0xf741('0x1a')][_0xf741('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43789a[_0xf741('0x1a')]?_0x43789a[_0xf741('0x1a')][_0xf741('0x1e')]||null:null,'attributes':_0x43789a[_0xf741('0x1a')]?_0x43789a[_0xf741('0x1a')][_0xf741('0x1f')]||null:null,'limit':_0x43789a[_0xf741('0x1a')]?_0x43789a[_0xf741('0x1a')][_0xf741('0x20')]||null:null})[_0xf741('0xb')](function(_0x5849e0){logger[_0xf741('0xc')](_0xf741('0x21'),_0x43789a);logger['debug'](_0xf741('0x21'),_0x43789a,JSON[_0xf741('0x10')](_0x5849e0));_0x70f9b4(_0x5849e0);})[_0xf741('0x15')](function(_0x499cb6){logger[_0xf741('0x11')](_0xf741('0x21'),_0x499cb6['message'],_0x43789a);_0x505659(_0x1e0ecb[_0xf741('0x11')](0x1f4,_0x499cb6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 93f24b5..5f88cb3 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 _0xbc24=['put','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','post','create'];(function(_0x1ac6af,_0x9ee48f){var _0x21f6ef=function(_0x27c5a2){while(--_0x27c5a2){_0x1ac6af['push'](_0x1ac6af['shift']());}};_0x21f6ef(++_0x9ee48f);}(_0xbc24,0x1dd));var _0x4bc2=function(_0x590a6e,_0xa8f72a){_0x590a6e=_0x590a6e-0x0;var _0x189524=_0xbc24[_0x590a6e];return _0x189524;};'use strict';var multer=require(_0x4bc2('0x0'));var util=require(_0x4bc2('0x1'));var path=require(_0x4bc2('0x2'));var timeout=require(_0x4bc2('0x3'));var express=require('express');var router=express[_0x4bc2('0x4')]();var fs_extra=require(_0x4bc2('0x5'));var auth=require(_0x4bc2('0x6'));var interaction=require(_0x4bc2('0x7'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x4bc2('0x8')](),controller[_0x4bc2('0x9')]);router[_0x4bc2('0xa')](_0x4bc2('0xb'),auth[_0x4bc2('0x8')](),controller[_0x4bc2('0xc')]);router['get'](_0x4bc2('0xd'),auth[_0x4bc2('0x8')](),controller['show']);router[_0x4bc2('0xe')]('/',auth[_0x4bc2('0x8')](),controller[_0x4bc2('0xf')]);router[_0x4bc2('0x10')](_0x4bc2('0xd'),auth[_0x4bc2('0x8')](),controller['update']);router['delete']('/:id',auth[_0x4bc2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf442=['fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','util','path','connect-timeout','express','Router'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0xf442,0x8b));var _0x2f44=function(_0x25f0e3,_0x162c81){_0x25f0e3=_0x25f0e3-0x0;var _0x41096f=_0xf442[_0x25f0e3];return _0x41096f;};'use strict';var multer=require('multer');var util=require(_0x2f44('0x0'));var path=require(_0x2f44('0x1'));var timeout=require(_0x2f44('0x2'));var express=require(_0x2f44('0x3'));var router=express[_0x2f44('0x4')]();var fs_extra=require(_0x2f44('0x5'));var auth=require(_0x2f44('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2f44('0x7'));var controller=require(_0x2f44('0x8'));router[_0x2f44('0x9')]('/',auth[_0x2f44('0xa')](),controller['index']);router[_0x2f44('0x9')](_0x2f44('0xb'),auth[_0x2f44('0xa')](),controller[_0x2f44('0xc')]);router[_0x2f44('0x9')](_0x2f44('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x2f44('0xe')]('/',auth['isAuthenticated'](),controller[_0x2f44('0xf')]);router['put'](_0x2f44('0xd'),auth[_0x2f44('0xa')](),controller[_0x2f44('0x10')]);router[_0x2f44('0x11')](_0x2f44('0xd'),auth[_0x2f44('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index b3e5332..afa1a1a 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x008c,0x188));var _0xc008=function(_0x4b281a,_0x1733de){_0x4b281a=_0x4b281a-0x0;var _0x3149a7=_0x008c[_0x4b281a];return _0x3149a7;};'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 +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5eee13,_0xad555d){_0x5eee13=_0x5eee13-0x0;var _0xbcb071=_0x9bde[_0x5eee13];return _0xbcb071;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5820e05..36e2b29 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 _0x70be=['describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','show','params','keys','find','catch','create','body'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x70be,0x1db));var _0xe70b=function(_0x263a3f,_0xc7e756){_0x263a3f=_0x263a3f-0x0;var _0x411c=_0x70be[_0x263a3f];return _0x411c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe70b('0x0'));var jsonpatch=require(_0xe70b('0x1'));var rp=require(_0xe70b('0x2'));var moment=require(_0xe70b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe70b('0x4'));var util=require(_0xe70b('0x5'));var path=require(_0xe70b('0x6'));var sox=require(_0xe70b('0x7'));var csv=require(_0xe70b('0x8'));var ejs=require(_0xe70b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe70b('0xa'));var squel=require(_0xe70b('0xb'));var crypto=require(_0xe70b('0xc'));var jsforce=require(_0xe70b('0xd'));var deskjs=require(_0xe70b('0xe'));var toCsv=require(_0xe70b('0x8'));var querystring=require(_0xe70b('0xf'));var Papa=require(_0xe70b('0x10'));var Redis=require(_0xe70b('0x11'));var authService=require(_0xe70b('0x12'));var qs=require(_0xe70b('0x13'));var as=require(_0xe70b('0x14'));var hardwareService=require(_0xe70b('0x15'));var logger=require(_0xe70b('0x16'))(_0xe70b('0x17'));var utils=require('../../config/utils');var config=require(_0xe70b('0x18'));var licenseUtil=require(_0xe70b('0x19'));var db=require(_0xe70b('0x1a'))['db'];function respondWithStatusCode(_0x5901cb,_0x281d8d){_0x281d8d=_0x281d8d||0xcc;return function(_0x52953d){if(_0x52953d){return _0x5901cb[_0xe70b('0x1b')](_0x281d8d);}return _0x5901cb[_0xe70b('0x1c')](_0x281d8d)[_0xe70b('0x1d')]();};}function respondWithResult(_0x4f0dad,_0x59011e){_0x59011e=_0x59011e||0xc8;return function(_0x329e14){if(_0x329e14){return _0x4f0dad[_0xe70b('0x1c')](_0x59011e)[_0xe70b('0x1e')](_0x329e14);}};}function respondWithFilteredResult(_0x3fedcd,_0x458bc8){return function(_0x695483){if(_0x695483){var _0x55ed86=typeof _0x458bc8[_0xe70b('0x1f')]===_0xe70b('0x20')&&typeof _0x458bc8[_0xe70b('0x21')]===_0xe70b('0x20');var _0x211a43=_0x695483[_0xe70b('0x22')];var _0x106c8f=_0x55ed86?0x0:_0x458bc8['offset'];var _0x4dd98b=_0x55ed86?_0x695483[_0xe70b('0x22')]:_0x458bc8[_0xe70b('0x1f')]+_0x458bc8[_0xe70b('0x21')];var _0x4a48a2;if(_0x4dd98b>=_0x211a43){_0x4dd98b=_0x211a43;_0x4a48a2=0xc8;}else{_0x4a48a2=0xce;}_0x3fedcd[_0xe70b('0x1c')](_0x4a48a2);return _0x3fedcd[_0xe70b('0x23')](_0xe70b('0x24'),_0x106c8f+'-'+_0x4dd98b+'/'+_0x211a43)[_0xe70b('0x1e')](_0x695483);}return null;};}function patchUpdates(_0x130f1c){return function(_0x5394ed){try{jsonpatch[_0xe70b('0x25')](_0x5394ed,_0x130f1c,!![]);}catch(_0x486ec3){return BPromise['reject'](_0x486ec3);}return _0x5394ed[_0xe70b('0x26')]();};}function saveUpdates(_0x568ae2,_0x3f8134){return function(_0x157986){if(_0x157986){return _0x157986[_0xe70b('0x27')](_0x568ae2)[_0xe70b('0x28')](function(_0x412b30){return _0x412b30;});}return null;};}function removeEntity(_0x3a9ab2,_0x468b72){return function(_0x3eced0){if(_0x3eced0){return _0x3eced0[_0xe70b('0x29')]()[_0xe70b('0x28')](function(){_0x3a9ab2[_0xe70b('0x1c')](0xcc)[_0xe70b('0x1d')]();});}};}function handleEntityNotFound(_0x501426,_0x3dffa8){return function(_0x47300e){if(!_0x47300e){_0x501426[_0xe70b('0x1b')](0x194);}return _0x47300e;};}function handleError(_0x45b3ec,_0x256cd9){_0x256cd9=_0x256cd9||0x1f4;return function(_0x397ffe){logger[_0xe70b('0x2a')](_0x397ffe[_0xe70b('0x2b')]);if(_0x397ffe[_0xe70b('0x2c')]){delete _0x397ffe[_0xe70b('0x2c')];}_0x45b3ec['status'](_0x256cd9)[_0xe70b('0x2d')](_0x397ffe);};}exports[_0xe70b('0x2e')]=function(_0x3df422,_0x695300){var _0x316004={},_0x2c7a35={},_0x1ac263={'count':0x0,'rows':[]};var _0x2770cb=_[_0xe70b('0x2f')](db['FaxTransferReport'][_0xe70b('0x30')],function(_0x3e9825){return{'name':_0x3e9825[_0xe70b('0x31')],'type':_0x3e9825[_0xe70b('0x32')]['key']};});_0x2c7a35[_0xe70b('0x33')]=_[_0xe70b('0x2f')](_0x2770cb,_0xe70b('0x2c'));_0x2c7a35['query']=_['keys'](_0x3df422['query']);_0x2c7a35[_0xe70b('0x34')]=_[_0xe70b('0x35')](_0x2c7a35[_0xe70b('0x33')],_0x2c7a35[_0xe70b('0x36')]);_0x316004[_0xe70b('0x37')]=_[_0xe70b('0x35')](_0x2c7a35[_0xe70b('0x33')],qs[_0xe70b('0x38')](_0x3df422[_0xe70b('0x36')]['fields']));_0x316004[_0xe70b('0x37')]=_0x316004[_0xe70b('0x37')][_0xe70b('0x39')]?_0x316004[_0xe70b('0x37')]:_0x2c7a35[_0xe70b('0x33')];if(!_0x3df422['query'][_0xe70b('0x3a')](_0xe70b('0x3b'))){_0x316004[_0xe70b('0x21')]=qs['limit'](_0x3df422[_0xe70b('0x36')][_0xe70b('0x21')]);_0x316004[_0xe70b('0x1f')]=qs[_0xe70b('0x1f')](_0x3df422[_0xe70b('0x36')][_0xe70b('0x1f')]);}_0x316004[_0xe70b('0x3c')]=qs['sort'](_0x3df422[_0xe70b('0x36')][_0xe70b('0x3d')]);_0x316004[_0xe70b('0x3e')]=qs[_0xe70b('0x34')](_['pick'](_0x3df422[_0xe70b('0x36')],_0x2c7a35[_0xe70b('0x34')]),_0x2770cb);if(_0x3df422[_0xe70b('0x36')][_0xe70b('0x3f')]){_0x316004['where']=_[_0xe70b('0x40')](_0x316004[_0xe70b('0x3e')],{'$or':_[_0xe70b('0x2f')](_0x2770cb,function(_0x217baf){if(_0x217baf['type']!==_0xe70b('0x41')){var _0x55063d={};_0x55063d[_0x217baf[_0xe70b('0x2c')]]={'$like':'%'+_0x3df422[_0xe70b('0x36')][_0xe70b('0x3f')]+'%'};return _0x55063d;}})});}_0x316004=_[_0xe70b('0x40')]({},_0x316004,_0x3df422[_0xe70b('0x42')]);var _0x14bc5b={'where':_0x316004['where']};return db[_0xe70b('0x43')][_0xe70b('0x22')](_0x14bc5b)[_0xe70b('0x28')](function(_0x1740f3){_0x1ac263[_0xe70b('0x22')]=_0x1740f3;if(_0x3df422[_0xe70b('0x36')][_0xe70b('0x44')]){_0x316004[_0xe70b('0x45')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xe70b('0x46')](_0x316004);})['then'](function(_0x24ce20){_0x1ac263['rows']=_0x24ce20;return _0x1ac263;})[_0xe70b('0x28')](respondWithFilteredResult(_0x695300,_0x316004))['catch'](handleError(_0x695300,null));};exports[_0xe70b('0x47')]=function(_0x6bc451,_0x53da43){var _0x3a9266={'raw':!![],'where':{'id':_0x6bc451[_0xe70b('0x48')]['id']}},_0x5ee82a={};_0x5ee82a['model']=_['keys'](db[_0xe70b('0x43')][_0xe70b('0x30')]);_0x5ee82a[_0xe70b('0x36')]=_[_0xe70b('0x49')](_0x6bc451[_0xe70b('0x36')]);_0x5ee82a[_0xe70b('0x34')]=_[_0xe70b('0x35')](_0x5ee82a[_0xe70b('0x33')],_0x5ee82a['query']);_0x3a9266[_0xe70b('0x37')]=_[_0xe70b('0x35')](_0x5ee82a[_0xe70b('0x33')],qs[_0xe70b('0x38')](_0x6bc451[_0xe70b('0x36')][_0xe70b('0x38')]));_0x3a9266['attributes']=_0x3a9266[_0xe70b('0x37')][_0xe70b('0x39')]?_0x3a9266[_0xe70b('0x37')]:_0x5ee82a[_0xe70b('0x33')];if(_0x6bc451[_0xe70b('0x36')][_0xe70b('0x44')]){_0x3a9266['include']=[{'all':!![]}];}_0x3a9266=_[_0xe70b('0x40')]({},_0x3a9266,_0x6bc451[_0xe70b('0x42')]);return db['FaxTransferReport'][_0xe70b('0x4a')](_0x3a9266)[_0xe70b('0x28')](handleEntityNotFound(_0x53da43,null))[_0xe70b('0x28')](respondWithResult(_0x53da43,null))[_0xe70b('0x4b')](handleError(_0x53da43,null));};exports[_0xe70b('0x4c')]=function(_0x49cb41,_0x2c4878){return db[_0xe70b('0x43')][_0xe70b('0x4c')](_0x49cb41[_0xe70b('0x4d')],{})[_0xe70b('0x28')](respondWithResult(_0x2c4878,0xc9))[_0xe70b('0x4b')](handleError(_0x2c4878,null));};exports[_0xe70b('0x27')]=function(_0xc8ad4b,_0x164ec9){if(_0xc8ad4b[_0xe70b('0x4d')]['id']){delete _0xc8ad4b[_0xe70b('0x4d')]['id'];}return db[_0xe70b('0x43')][_0xe70b('0x4a')]({'where':{'id':_0xc8ad4b[_0xe70b('0x48')]['id']}})[_0xe70b('0x28')](handleEntityNotFound(_0x164ec9,null))['then'](saveUpdates(_0xc8ad4b['body'],null))[_0xe70b('0x28')](respondWithResult(_0x164ec9,null))['catch'](handleError(_0x164ec9,null));};exports[_0xe70b('0x29')]=function(_0x598c34,_0x4f4f74){return db['FaxTransferReport'][_0xe70b('0x4a')]({'where':{'id':_0x598c34[_0xe70b('0x48')]['id']}})[_0xe70b('0x28')](handleEntityNotFound(_0x4f4f74,null))[_0xe70b('0x28')](removeEntity(_0x4f4f74,null))[_0xe70b('0x4b')](handleError(_0x4f4f74,null));};exports['describe']=function(_0x12a637,_0x5025d6){return db['FaxTransferReport'][_0xe70b('0x4e')]()[_0xe70b('0x28')](respondWithResult(_0x5025d6,null))[_0xe70b('0x4b')](handleError(_0x5025d6,null));}; \ No newline at end of file +var _0x6bad=['include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll'];(function(_0x23a7de,_0x5d4b79){var _0x4eb0bd=function(_0x15bc3e){while(--_0x15bc3e){_0x23a7de['push'](_0x23a7de['shift']());}};_0x4eb0bd(++_0x5d4b79);}(_0x6bad,0x12d));var _0xd6ba=function(_0x206831,_0x9fb896){_0x206831=_0x206831-0x0;var _0x475f48=_0x6bad[_0x206831];return _0x475f48;};'use strict';var emlformat=require(_0xd6ba('0x0'));var rimraf=require(_0xd6ba('0x1'));var zipdir=require(_0xd6ba('0x2'));var jsonpatch=require(_0xd6ba('0x3'));var rp=require(_0xd6ba('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd6ba('0x5'));var path=require('path');var sox=require(_0xd6ba('0x6'));var csv=require('to-csv');var ejs=require(_0xd6ba('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6ba('0x8'));var squel=require(_0xd6ba('0x9'));var crypto=require(_0xd6ba('0xa'));var jsforce=require(_0xd6ba('0xb'));var deskjs=require(_0xd6ba('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd6ba('0xd'));var Papa=require(_0xd6ba('0xe'));var Redis=require(_0xd6ba('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6ba('0x10'));var logger=require(_0xd6ba('0x11'))(_0xd6ba('0x12'));var utils=require(_0xd6ba('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd6ba('0x14'));var db=require(_0xd6ba('0x15'))['db'];function respondWithStatusCode(_0x20d0e7,_0x38caaa){_0x38caaa=_0x38caaa||0xcc;return function(_0x2888cd){if(_0x2888cd){return _0x20d0e7[_0xd6ba('0x16')](_0x38caaa);}return _0x20d0e7[_0xd6ba('0x17')](_0x38caaa)[_0xd6ba('0x18')]();};}function respondWithResult(_0x66aca1,_0x4e199b){_0x4e199b=_0x4e199b||0xc8;return function(_0x322fe6){if(_0x322fe6){return _0x66aca1[_0xd6ba('0x17')](_0x4e199b)[_0xd6ba('0x19')](_0x322fe6);}};}function respondWithFilteredResult(_0x409eb8,_0x504fe8){return function(_0x2e0ed0){if(_0x2e0ed0){var _0x213c1b=typeof _0x504fe8[_0xd6ba('0x1a')]===_0xd6ba('0x1b')&&typeof _0x504fe8[_0xd6ba('0x1c')]==='undefined';var _0x55b1d6=_0x2e0ed0[_0xd6ba('0x1d')];var _0x776cb5=_0x213c1b?0x0:_0x504fe8[_0xd6ba('0x1a')];var _0x23dd96=_0x213c1b?_0x2e0ed0[_0xd6ba('0x1d')]:_0x504fe8['offset']+_0x504fe8['limit'];var _0x2e51fd;if(_0x23dd96>=_0x55b1d6){_0x23dd96=_0x55b1d6;_0x2e51fd=0xc8;}else{_0x2e51fd=0xce;}_0x409eb8[_0xd6ba('0x17')](_0x2e51fd);return _0x409eb8[_0xd6ba('0x1e')]('Content-Range',_0x776cb5+'-'+_0x23dd96+'/'+_0x55b1d6)[_0xd6ba('0x19')](_0x2e0ed0);}return null;};}function patchUpdates(_0x4f74ab){return function(_0x5c5ee8){try{jsonpatch[_0xd6ba('0x1f')](_0x5c5ee8,_0x4f74ab,!![]);}catch(_0x4108e0){return BPromise['reject'](_0x4108e0);}return _0x5c5ee8[_0xd6ba('0x20')]();};}function saveUpdates(_0x3cb80c,_0x1f608c){return function(_0x1adf9b){if(_0x1adf9b){return _0x1adf9b[_0xd6ba('0x21')](_0x3cb80c)[_0xd6ba('0x22')](function(_0x596727){return _0x596727;});}return null;};}function removeEntity(_0x5a4ac1,_0x4ee00a){return function(_0x2b380c){if(_0x2b380c){return _0x2b380c[_0xd6ba('0x23')]()[_0xd6ba('0x22')](function(){_0x5a4ac1[_0xd6ba('0x17')](0xcc)[_0xd6ba('0x18')]();});}};}function handleEntityNotFound(_0x3cb8b3,_0x3fdb02){return function(_0xf9d9a0){if(!_0xf9d9a0){_0x3cb8b3[_0xd6ba('0x16')](0x194);}return _0xf9d9a0;};}function handleError(_0x4498f1,_0x1431e6){_0x1431e6=_0x1431e6||0x1f4;return function(_0x1f5a30){logger['error'](_0x1f5a30[_0xd6ba('0x24')]);if(_0x1f5a30[_0xd6ba('0x25')]){delete _0x1f5a30['name'];}_0x4498f1[_0xd6ba('0x17')](_0x1431e6)[_0xd6ba('0x26')](_0x1f5a30);};}exports[_0xd6ba('0x27')]=function(_0x4e13f,_0x3df5e7){var _0x28bde5={},_0x3343e5={},_0x7e9fc0={'count':0x0,'rows':[]};var _0x5612b7=_[_0xd6ba('0x28')](db[_0xd6ba('0x29')][_0xd6ba('0x2a')],function(_0x1d176a){return{'name':_0x1d176a[_0xd6ba('0x2b')],'type':_0x1d176a[_0xd6ba('0x2c')][_0xd6ba('0x2d')]};});_0x3343e5[_0xd6ba('0x2e')]=_[_0xd6ba('0x28')](_0x5612b7,_0xd6ba('0x25'));_0x3343e5['query']=_[_0xd6ba('0x2f')](_0x4e13f['query']);_0x3343e5['filters']=_[_0xd6ba('0x30')](_0x3343e5[_0xd6ba('0x2e')],_0x3343e5[_0xd6ba('0x31')]);_0x28bde5['attributes']=_[_0xd6ba('0x30')](_0x3343e5[_0xd6ba('0x2e')],qs[_0xd6ba('0x32')](_0x4e13f[_0xd6ba('0x31')][_0xd6ba('0x32')]));_0x28bde5[_0xd6ba('0x33')]=_0x28bde5[_0xd6ba('0x33')][_0xd6ba('0x34')]?_0x28bde5[_0xd6ba('0x33')]:_0x3343e5[_0xd6ba('0x2e')];if(!_0x4e13f[_0xd6ba('0x31')][_0xd6ba('0x35')](_0xd6ba('0x36'))){_0x28bde5[_0xd6ba('0x1c')]=qs[_0xd6ba('0x1c')](_0x4e13f[_0xd6ba('0x31')][_0xd6ba('0x1c')]);_0x28bde5[_0xd6ba('0x1a')]=qs['offset'](_0x4e13f[_0xd6ba('0x31')][_0xd6ba('0x1a')]);}_0x28bde5[_0xd6ba('0x37')]=qs[_0xd6ba('0x38')](_0x4e13f['query'][_0xd6ba('0x38')]);_0x28bde5[_0xd6ba('0x39')]=qs['filters'](_['pick'](_0x4e13f['query'],_0x3343e5[_0xd6ba('0x3a')]),_0x5612b7);if(_0x4e13f['query'][_0xd6ba('0x3b')]){_0x28bde5[_0xd6ba('0x39')]=_[_0xd6ba('0x3c')](_0x28bde5[_0xd6ba('0x39')],{'$or':_[_0xd6ba('0x28')](_0x5612b7,function(_0x2ed352){if(_0x2ed352[_0xd6ba('0x2c')]!==_0xd6ba('0x3d')){var _0x162596={};_0x162596[_0x2ed352[_0xd6ba('0x25')]]={'$like':'%'+_0x4e13f['query'][_0xd6ba('0x3b')]+'%'};return _0x162596;}})});}_0x28bde5=_[_0xd6ba('0x3c')]({},_0x28bde5,_0x4e13f[_0xd6ba('0x3e')]);var _0x4a0a69={'where':_0x28bde5[_0xd6ba('0x39')]};return db['FaxTransferReport'][_0xd6ba('0x1d')](_0x4a0a69)[_0xd6ba('0x22')](function(_0x5d8691){_0x7e9fc0['count']=_0x5d8691;if(_0x4e13f[_0xd6ba('0x31')][_0xd6ba('0x3f')]){_0x28bde5[_0xd6ba('0x40')]=[{'all':!![]}];}return db[_0xd6ba('0x29')][_0xd6ba('0x41')](_0x28bde5);})[_0xd6ba('0x22')](function(_0x298116){_0x7e9fc0[_0xd6ba('0x42')]=_0x298116;return _0x7e9fc0;})[_0xd6ba('0x22')](respondWithFilteredResult(_0x3df5e7,_0x28bde5))[_0xd6ba('0x43')](handleError(_0x3df5e7,null));};exports['show']=function(_0xe38e7d,_0x2dc2d4){var _0x1e5d8a={'raw':!![],'where':{'id':_0xe38e7d[_0xd6ba('0x44')]['id']}},_0x231038={};_0x231038[_0xd6ba('0x2e')]=_[_0xd6ba('0x2f')](db[_0xd6ba('0x29')][_0xd6ba('0x2a')]);_0x231038['query']=_[_0xd6ba('0x2f')](_0xe38e7d[_0xd6ba('0x31')]);_0x231038[_0xd6ba('0x3a')]=_[_0xd6ba('0x30')](_0x231038[_0xd6ba('0x2e')],_0x231038['query']);_0x1e5d8a[_0xd6ba('0x33')]=_[_0xd6ba('0x30')](_0x231038[_0xd6ba('0x2e')],qs[_0xd6ba('0x32')](_0xe38e7d['query'][_0xd6ba('0x32')]));_0x1e5d8a['attributes']=_0x1e5d8a[_0xd6ba('0x33')][_0xd6ba('0x34')]?_0x1e5d8a[_0xd6ba('0x33')]:_0x231038[_0xd6ba('0x2e')];if(_0xe38e7d['query'][_0xd6ba('0x3f')]){_0x1e5d8a[_0xd6ba('0x40')]=[{'all':!![]}];}_0x1e5d8a=_[_0xd6ba('0x3c')]({},_0x1e5d8a,_0xe38e7d['options']);return db[_0xd6ba('0x29')][_0xd6ba('0x45')](_0x1e5d8a)['then'](handleEntityNotFound(_0x2dc2d4,null))[_0xd6ba('0x22')](respondWithResult(_0x2dc2d4,null))[_0xd6ba('0x43')](handleError(_0x2dc2d4,null));};exports[_0xd6ba('0x46')]=function(_0x3cb71a,_0x30c88d){return db[_0xd6ba('0x29')]['create'](_0x3cb71a[_0xd6ba('0x47')],{})['then'](respondWithResult(_0x30c88d,0xc9))[_0xd6ba('0x43')](handleError(_0x30c88d,null));};exports[_0xd6ba('0x21')]=function(_0x228873,_0x50f515){if(_0x228873[_0xd6ba('0x47')]['id']){delete _0x228873[_0xd6ba('0x47')]['id'];}return db[_0xd6ba('0x29')][_0xd6ba('0x45')]({'where':{'id':_0x228873[_0xd6ba('0x44')]['id']}})[_0xd6ba('0x22')](handleEntityNotFound(_0x50f515,null))[_0xd6ba('0x22')](saveUpdates(_0x228873[_0xd6ba('0x47')],null))['then'](respondWithResult(_0x50f515,null))[_0xd6ba('0x43')](handleError(_0x50f515,null));};exports[_0xd6ba('0x23')]=function(_0xcffc93,_0x3daf3b){return db[_0xd6ba('0x29')][_0xd6ba('0x45')]({'where':{'id':_0xcffc93['params']['id']}})['then'](handleEntityNotFound(_0x3daf3b,null))[_0xd6ba('0x22')](removeEntity(_0x3daf3b,null))['catch'](handleError(_0x3daf3b,null));};exports['describe']=function(_0x4e8e9a,_0x33ea16){return db[_0xd6ba('0x29')][_0xd6ba('0x48')]()['then'](respondWithResult(_0x33ea16,null))[_0xd6ba('0x43')](handleError(_0x33ea16,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1b2568c..b6359b2 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 _0x35d2=['./faxTransferReport.attributes','FaxTransferReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35d2,0xd4));var _0x235d=function(_0x5e3095,_0x63ca04){_0x5e3095=_0x5e3095-0x0;var _0x516fd5=_0x35d2[_0x5e3095];return _0x516fd5;};'use strict';var _=require(_0x235d('0x0'));var util=require('util');var logger=require(_0x235d('0x1'))(_0x235d('0x2'));var moment=require(_0x235d('0x3'));var BPromise=require(_0x235d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x235d('0x5'));var rimraf=require(_0x235d('0x6'));var config=require(_0x235d('0x7'));var attributes=require(_0x235d('0x8'));module['exports']=function(_0x2cb51b,_0x30575a){return _0x2cb51b['define'](_0x235d('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x235d('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x25a9=['uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x378880,_0x227237){var _0x323a55=function(_0x17ff4b){while(--_0x17ff4b){_0x378880['push'](_0x378880['shift']());}};_0x323a55(++_0x227237);}(_0x25a9,0xf1));var _0x925a=function(_0x109c40,_0x3463fa){_0x109c40=_0x109c40-0x0;var _0x3d5aed=_0x25a9[_0x109c40];return _0x3d5aed;};'use strict';var _=require('lodash');var util=require(_0x925a('0x0'));var logger=require(_0x925a('0x1'))(_0x925a('0x2'));var moment=require(_0x925a('0x3'));var BPromise=require(_0x925a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x925a('0x5'));var rimraf=require(_0x925a('0x6'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x925a('0x7')]=function(_0x5271bc,_0x436db7){return _0x5271bc[_0x925a('0x8')](_0x925a('0x9'),attributes,{'tableName':_0x925a('0xa'),'paranoid':![],'indexes':[{'name':_0x925a('0xb'),'fields':[_0x925a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index d793265..65f66dd 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 _0x70fc=['util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash'];(function(_0x59adc9,_0x55995c){var _0x3fdfca=function(_0x58e7d5){while(--_0x58e7d5){_0x59adc9['push'](_0x59adc9['shift']());}};_0x3fdfca(++_0x55995c);}(_0x70fc,0x1b7));var _0xc70f=function(_0x3eae4f,_0x3cbd42){_0x3eae4f=_0x3eae4f-0x0;var _0x232e93=_0x70fc[_0x3eae4f];return _0x232e93;};'use strict';var _=require(_0xc70f('0x0'));var util=require(_0xc70f('0x1'));var moment=require(_0xc70f('0x2'));var BPromise=require(_0xc70f('0x3'));var rs=require(_0xc70f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc70f('0x5'))(_0xc70f('0x6'));var config=require('../../config/environment');var jayson=require(_0xc70f('0x7'));var client=jayson[_0xc70f('0x8')][_0xc70f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4be7c5,_0x51a243,_0x2c9928){return new BPromise(function(_0x49fe2b,_0x3f7028){return client[_0xc70f('0xa')](_0x4be7c5,_0x2c9928)[_0xc70f('0xb')](function(_0x5efce0){logger[_0xc70f('0xc')](_0xc70f('0xd'),_0x51a243,_0xc70f('0xe'));logger[_0xc70f('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x51a243,'request\x20sent',JSON[_0xc70f('0x10')](_0x5efce0));if(_0x5efce0[_0xc70f('0x11')]){if(_0x5efce0[_0xc70f('0x11')]['code']===0x1f4){logger[_0xc70f('0x11')](_0xc70f('0xd'),_0x51a243,_0x5efce0[_0xc70f('0x11')][_0xc70f('0x12')]);return _0x3f7028(_0x5efce0[_0xc70f('0x11')]['message']);}logger[_0xc70f('0x11')](_0xc70f('0xd'),_0x51a243,_0x5efce0['error'][_0xc70f('0x12')]);return _0x49fe2b(_0x5efce0[_0xc70f('0x11')][_0xc70f('0x12')]);}else{logger['info'](_0xc70f('0xd'),_0x51a243,_0xc70f('0xe'));_0x49fe2b(_0x5efce0[_0xc70f('0x13')][_0xc70f('0x12')]);}})['catch'](function(_0x123b35){logger[_0xc70f('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x51a243,_0x123b35);_0x3f7028(_0x123b35);});});} \ No newline at end of file +var _0xaac5=['debug','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xaac5,0x196));var _0x5aac=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xaac5[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x5aac('0x0'));var util=require('util');var moment=require(_0x5aac('0x1'));var BPromise=require(_0x5aac('0x2'));var rs=require(_0x5aac('0x3'));var fs=require('fs');var Redis=require(_0x5aac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5aac('0x5'))(_0x5aac('0x6'));var config=require(_0x5aac('0x7'));var jayson=require(_0x5aac('0x8'));var client=jayson[_0x5aac('0x9')][_0x5aac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f1b1d,_0x406262,_0x1a5e5c){return new BPromise(function(_0x3e4f49,_0x257c6d){return client['request'](_0x2f1b1d,_0x1a5e5c)[_0x5aac('0xb')](function(_0x14cf61){logger[_0x5aac('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x406262,_0x5aac('0xd'));logger[_0x5aac('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x406262,'request\x20sent',JSON[_0x5aac('0xf')](_0x14cf61));if(_0x14cf61[_0x5aac('0x10')]){if(_0x14cf61[_0x5aac('0x10')][_0x5aac('0x11')]===0x1f4){logger[_0x5aac('0x10')](_0x5aac('0x12'),_0x406262,_0x14cf61[_0x5aac('0x10')]['message']);return _0x257c6d(_0x14cf61[_0x5aac('0x10')][_0x5aac('0x13')]);}logger[_0x5aac('0x10')](_0x5aac('0x12'),_0x406262,_0x14cf61[_0x5aac('0x10')][_0x5aac('0x13')]);return _0x3e4f49(_0x14cf61[_0x5aac('0x10')]['message']);}else{logger['info'](_0x5aac('0x12'),_0x406262,'request\x20sent');_0x3e4f49(_0x14cf61[_0x5aac('0x14')]['message']);}})['catch'](function(_0x2e18ca){logger[_0x5aac('0x10')](_0x5aac('0x12'),_0x406262,_0x2e18ca);_0x257c6d(_0x2e18ca);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 5f94829..652ea57 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 _0x365e=['create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','/:id'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0x365e,0x135));var _0xe365=function(_0x147521,_0xdf93ce){_0x147521=_0x147521-0x0;var _0x24384b=_0x365e[_0x147521];return _0x24384b;};'use strict';var multer=require(_0xe365('0x0'));var util=require(_0xe365('0x1'));var path=require(_0xe365('0x2'));var timeout=require(_0xe365('0x3'));var express=require('express');var router=express[_0xe365('0x4')]();var fs_extra=require(_0xe365('0x5'));var auth=require(_0xe365('0x6'));var interaction=require(_0xe365('0x7'));var config=require(_0xe365('0x8'));var controller=require(_0xe365('0x9'));router[_0xe365('0xa')]('/',auth[_0xe365('0xb')](),controller['index']);router[_0xe365('0xa')](_0xe365('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe365('0xa')](_0xe365('0xd'),auth[_0xe365('0xb')](),controller['show']);router['post']('/',auth[_0xe365('0xb')](),controller[_0xe365('0xe')]);router[_0xe365('0xf')](_0xe365('0xd'),auth[_0xe365('0xb')](),controller[_0xe365('0x10')]);router[_0xe365('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe365('0x12')]=router; \ No newline at end of file +var _0x5e87=['put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post'];(function(_0x54d2bd,_0x57c539){var _0x34f0d4=function(_0x2e8bba){while(--_0x2e8bba){_0x54d2bd['push'](_0x54d2bd['shift']());}};_0x34f0d4(++_0x57c539);}(_0x5e87,0x16c));var _0x75e8=function(_0x4b13ee,_0x587562){_0x4b13ee=_0x4b13ee-0x0;var _0x190d07=_0x5e87[_0x4b13ee];return _0x190d07;};'use strict';var multer=require(_0x75e8('0x0'));var util=require(_0x75e8('0x1'));var path=require('path');var timeout=require(_0x75e8('0x2'));var express=require(_0x75e8('0x3'));var router=express[_0x75e8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x75e8('0x5'));var interaction=require(_0x75e8('0x6'));var config=require(_0x75e8('0x7'));var controller=require(_0x75e8('0x8'));router['get']('/',auth[_0x75e8('0x9')](),controller[_0x75e8('0xa')]);router[_0x75e8('0xb')](_0x75e8('0xc'),auth['isAuthenticated'](),controller[_0x75e8('0xd')]);router[_0x75e8('0xb')]('/:id',auth[_0x75e8('0x9')](),controller[_0x75e8('0xe')]);router[_0x75e8('0xf')]('/',auth[_0x75e8('0x9')](),controller['create']);router[_0x75e8('0x10')](_0x75e8('0x11'),auth[_0x75e8('0x9')](),controller['update']);router['delete'](_0x75e8('0x11'),auth[_0x75e8('0x9')](),controller[_0x75e8('0x12')]);module[_0x75e8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index b5c2921..34ce9a1 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 _0x864d=['post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x864d,0x1c1));var _0xd864=function(_0x18de96,_0x5bc530){_0x18de96=_0x18de96-0x0;var _0x145d76=_0x864d[_0x18de96];return _0x145d76;};'use strict';var multer=require(_0xd864('0x0'));var util=require(_0xd864('0x1'));var path=require(_0xd864('0x2'));var timeout=require('connect-timeout');var express=require(_0xd864('0x3'));var router=express[_0xd864('0x4')]();var fs_extra=require(_0xd864('0x5'));var auth=require(_0xd864('0x6'));var interaction=require(_0xd864('0x7'));var config=require(_0xd864('0x8'));var controller=require(_0xd864('0x9'));router[_0xd864('0xa')]('/',auth[_0xd864('0xb')](),controller[_0xd864('0xc')]);router[_0xd864('0xa')](_0xd864('0xd'),auth['isAuthenticated'](),controller[_0xd864('0xe')]);router[_0xd864('0xa')](_0xd864('0xf'),auth[_0xd864('0xb')](),controller[_0xd864('0x10')]);router[_0xd864('0xa')](_0xd864('0x11'),auth[_0xd864('0xb')](),controller[_0xd864('0x12')]);router[_0xd864('0x13')]('/',auth[_0xd864('0xb')](),controller[_0xd864('0x14')]);router[_0xd864('0x13')](_0xd864('0xf'),auth[_0xd864('0xb')](),controller[_0xd864('0x15')]);router[_0xd864('0x16')]('/:id',auth[_0xd864('0xb')](),controller[_0xd864('0x17')]);router[_0xd864('0x18')]('/:id',auth[_0xd864('0xb')](),controller[_0xd864('0x19')]);module['exports']=router; \ No newline at end of file +var _0xe48d=['Router','../../config/environment','./intDeskAccount.controller','get','/:id','getConfigurations','/:id/fields','isAuthenticated','post','put','update','delete','exports','multer','path','express'];(function(_0x46b458,_0x206806){var _0x10f016=function(_0xf31fb8){while(--_0xf31fb8){_0x46b458['push'](_0x46b458['shift']());}};_0x10f016(++_0x206806);}(_0xe48d,0x18d));var _0xde48=function(_0x3fd0e3,_0x48d51a){_0x3fd0e3=_0x3fd0e3-0x0;var _0x25c1cc=_0xe48d[_0x3fd0e3];return _0x25c1cc;};'use strict';var multer=require(_0xde48('0x0'));var util=require('util');var path=require(_0xde48('0x1'));var timeout=require('connect-timeout');var express=require(_0xde48('0x2'));var router=express[_0xde48('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xde48('0x4'));var controller=require(_0xde48('0x5'));router[_0xde48('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xde48('0x6')](_0xde48('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xde48('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xde48('0x8')]);router[_0xde48('0x6')](_0xde48('0x9'),auth[_0xde48('0xa')](),controller['getFields']);router[_0xde48('0xb')]('/',auth[_0xde48('0xa')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xde48('0xc')](_0xde48('0x7'),auth[_0xde48('0xa')](),controller[_0xde48('0xd')]);router[_0xde48('0xe')](_0xde48('0x7'),auth[_0xde48('0xa')](),controller['destroy']);module[_0xde48('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index adf430c..1416018 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 _0x69d7=['ENUM','basic','integrationTab','sequelize','exports','STRING'];(function(_0x5fe69a,_0x5484f5){var _0x3f1aee=function(_0x54387f){while(--_0x54387f){_0x5fe69a['push'](_0x5fe69a['shift']());}};_0x3f1aee(++_0x5484f5);}(_0x69d7,0xff));var _0x769d=function(_0x80994b,_0x455992){_0x80994b=_0x80994b-0x0;var _0x495681=_0x69d7[_0x80994b];return _0x495681;};'use strict';var Sequelize=require(_0x769d('0x0'));module[_0x769d('0x1')]={'name':{'type':Sequelize[_0x769d('0x2')]},'description':{'type':Sequelize[_0x769d('0x2')]},'username':{'type':Sequelize[_0x769d('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x769d('0x3')](_0x769d('0x4')),'defaultValue':_0x769d('0x4')},'password':{'type':Sequelize[_0x769d('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x769d('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x769d('0x2')]},'serverUrl':{'type':Sequelize[_0x769d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x769d('0x3')](_0x769d('0x5'),'newTab'),'defaultValue':_0x769d('0x5')}}; \ No newline at end of file +var _0x1313=['basic','integrationTab','newTab','STRING'];(function(_0x45dabf,_0x4e6bfe){var _0xa83e3d=function(_0x269115){while(--_0x269115){_0x45dabf['push'](_0x45dabf['shift']());}};_0xa83e3d(++_0x4e6bfe);}(_0x1313,0xaf));var _0x3131=function(_0x2b6f4c,_0x18e0af){_0x2b6f4c=_0x2b6f4c-0x0;var _0x3b8a18=_0x1313[_0x2b6f4c];return _0x3b8a18;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3131('0x0')]},'remoteUri':{'type':Sequelize[_0x3131('0x0')]},'authType':{'type':Sequelize['ENUM'](_0x3131('0x1')),'defaultValue':_0x3131('0x1')},'password':{'type':Sequelize[_0x3131('0x0')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x3131('0x0')]},'token':{'type':Sequelize[_0x3131('0x0')]},'tokenSecret':{'type':Sequelize[_0x3131('0x0')]},'serverUrl':{'type':Sequelize[_0x3131('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3131('0x2'),_0x3131('0x3')),'defaultValue':_0x3131('0x2')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b4044e8..e01ebe1 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 _0xc7f8=['include','findAll','rows','catch','params','keys','DeskAccount','length','includeAll','options','create','body','find','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x22e505,_0x5670e8){var _0x3406df=function(_0x31c190){while(--_0x31c190){_0x22e505['push'](_0x22e505['shift']());}};_0x3406df(++_0x5670e8);}(_0xc7f8,0x183));var _0x8c7f=function(_0x6161c4,_0x584508){_0x6161c4=_0x6161c4-0x0;var _0x5da018=_0xc7f8[_0x6161c4];return _0x5da018;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c7f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c7f('0x1'));var rp=require(_0x8c7f('0x2'));var moment=require(_0x8c7f('0x3'));var BPromise=require(_0x8c7f('0x4'));var Mustache=require(_0x8c7f('0x5'));var util=require(_0x8c7f('0x6'));var path=require('path');var sox=require(_0x8c7f('0x7'));var csv=require('to-csv');var ejs=require(_0x8c7f('0x8'));var fs=require('fs');var fs_extra=require(_0x8c7f('0x9'));var _=require(_0x8c7f('0xa'));var squel=require('squel');var crypto=require(_0x8c7f('0xb'));var jsforce=require(_0x8c7f('0xc'));var deskjs=require(_0x8c7f('0xd'));var toCsv=require(_0x8c7f('0xe'));var querystring=require(_0x8c7f('0xf'));var Papa=require('papaparse');var Redis=require(_0x8c7f('0x10'));var authService=require(_0x8c7f('0x11'));var qs=require(_0x8c7f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8c7f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8c7f('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8c7f('0x15'));function respondWithStatusCode(_0x25006d,_0x252ebd){_0x252ebd=_0x252ebd||0xcc;return function(_0x34024b){if(_0x34024b){return _0x25006d[_0x8c7f('0x16')](_0x252ebd);}return _0x25006d[_0x8c7f('0x17')](_0x252ebd)[_0x8c7f('0x18')]();};}function respondWithResult(_0x4606b8,_0x1a21a9){_0x1a21a9=_0x1a21a9||0xc8;return function(_0x5e2a4a){if(_0x5e2a4a){return _0x4606b8[_0x8c7f('0x17')](_0x1a21a9)['json'](_0x5e2a4a);}};}function respondWithFilteredResult(_0x6a8ab8,_0x3bc901){return function(_0xbb57bf){if(_0xbb57bf){var _0x5e8c91=typeof _0x3bc901[_0x8c7f('0x19')]===_0x8c7f('0x1a')&&typeof _0x3bc901[_0x8c7f('0x1b')]===_0x8c7f('0x1a');var _0x1a7546=_0xbb57bf[_0x8c7f('0x1c')];var _0x5dee0a=_0x5e8c91?0x0:_0x3bc901['offset'];var _0xf9a638=_0x5e8c91?_0xbb57bf[_0x8c7f('0x1c')]:_0x3bc901['offset']+_0x3bc901[_0x8c7f('0x1b')];var _0x154a5a;if(_0xf9a638>=_0x1a7546){_0xf9a638=_0x1a7546;_0x154a5a=0xc8;}else{_0x154a5a=0xce;}_0x6a8ab8[_0x8c7f('0x17')](_0x154a5a);return _0x6a8ab8[_0x8c7f('0x1d')]('Content-Range',_0x5dee0a+'-'+_0xf9a638+'/'+_0x1a7546)[_0x8c7f('0x1e')](_0xbb57bf);}return null;};}function patchUpdates(_0x26b8f1){return function(_0x4f3a6d){try{jsonpatch[_0x8c7f('0x1f')](_0x4f3a6d,_0x26b8f1,!![]);}catch(_0x2073f8){return BPromise['reject'](_0x2073f8);}return _0x4f3a6d[_0x8c7f('0x20')]();};}function saveUpdates(_0x43ee80,_0x4a5135){return function(_0x3da6ce){if(_0x3da6ce){return _0x3da6ce[_0x8c7f('0x21')](_0x43ee80)[_0x8c7f('0x22')](function(_0x1bf926){return _0x1bf926;});}return null;};}function removeEntity(_0x478048,_0x1f8455){return function(_0x465cc4){if(_0x465cc4){return _0x465cc4[_0x8c7f('0x23')]()['then'](function(){_0x478048[_0x8c7f('0x17')](0xcc)[_0x8c7f('0x18')]();});}};}function handleEntityNotFound(_0x37adef,_0x4e7c66){return function(_0xd22649){if(!_0xd22649){_0x37adef[_0x8c7f('0x16')](0x194);}return _0xd22649;};}function handleError(_0xba4342,_0x3afe94){_0x3afe94=_0x3afe94||0x1f4;return function(_0x1a3ee6){logger[_0x8c7f('0x24')](_0x1a3ee6[_0x8c7f('0x25')]);if(_0x1a3ee6[_0x8c7f('0x26')]){delete _0x1a3ee6[_0x8c7f('0x26')];}_0xba4342['status'](_0x3afe94)['send'](_0x1a3ee6);};}exports[_0x8c7f('0x27')]=function(_0x9cb28e,_0x2602a6){var _0x4907e4={},_0x2fbc1c={},_0x36bf2a={'count':0x0,'rows':[]};var _0xeffd3a=_[_0x8c7f('0x28')](db['DeskAccount'][_0x8c7f('0x29')],function(_0x551171){return{'name':_0x551171['fieldName'],'type':_0x551171[_0x8c7f('0x2a')]['key']};});_0x2fbc1c[_0x8c7f('0x2b')]=_['map'](_0xeffd3a,_0x8c7f('0x26'));_0x2fbc1c[_0x8c7f('0x2c')]=_['keys'](_0x9cb28e[_0x8c7f('0x2c')]);_0x2fbc1c[_0x8c7f('0x2d')]=_[_0x8c7f('0x2e')](_0x2fbc1c[_0x8c7f('0x2b')],_0x2fbc1c[_0x8c7f('0x2c')]);_0x4907e4[_0x8c7f('0x2f')]=_['intersection'](_0x2fbc1c['model'],qs[_0x8c7f('0x30')](_0x9cb28e['query'][_0x8c7f('0x30')]));_0x4907e4[_0x8c7f('0x2f')]=_0x4907e4['attributes']['length']?_0x4907e4['attributes']:_0x2fbc1c[_0x8c7f('0x2b')];if(!_0x9cb28e['query']['hasOwnProperty'](_0x8c7f('0x31'))){_0x4907e4['limit']=qs[_0x8c7f('0x1b')](_0x9cb28e[_0x8c7f('0x2c')]['limit']);_0x4907e4['offset']=qs['offset'](_0x9cb28e['query'][_0x8c7f('0x19')]);}_0x4907e4[_0x8c7f('0x32')]=qs[_0x8c7f('0x33')](_0x9cb28e[_0x8c7f('0x2c')][_0x8c7f('0x33')]);_0x4907e4[_0x8c7f('0x34')]=qs[_0x8c7f('0x2d')](_[_0x8c7f('0x35')](_0x9cb28e[_0x8c7f('0x2c')],_0x2fbc1c[_0x8c7f('0x2d')]),_0xeffd3a);if(_0x9cb28e[_0x8c7f('0x2c')]['filter']){_0x4907e4[_0x8c7f('0x34')]=_[_0x8c7f('0x36')](_0x4907e4['where'],{'$or':_[_0x8c7f('0x28')](_0xeffd3a,function(_0x5cfafc){if(_0x5cfafc[_0x8c7f('0x2a')]!==_0x8c7f('0x37')){var _0x4675b5={};_0x4675b5[_0x5cfafc[_0x8c7f('0x26')]]={'$like':'%'+_0x9cb28e[_0x8c7f('0x2c')][_0x8c7f('0x38')]+'%'};return _0x4675b5;}})});}_0x4907e4=_['merge']({},_0x4907e4,_0x9cb28e['options']);var _0x2a6de9={'where':_0x4907e4[_0x8c7f('0x34')]};return db['DeskAccount'][_0x8c7f('0x1c')](_0x2a6de9)[_0x8c7f('0x22')](function(_0x3ed11c){_0x36bf2a[_0x8c7f('0x1c')]=_0x3ed11c;if(_0x9cb28e['query']['includeAll']){_0x4907e4[_0x8c7f('0x39')]=[{'all':!![]}];}return db['DeskAccount'][_0x8c7f('0x3a')](_0x4907e4);})[_0x8c7f('0x22')](function(_0x10f4a4){_0x36bf2a[_0x8c7f('0x3b')]=_0x10f4a4;return _0x36bf2a;})[_0x8c7f('0x22')](respondWithFilteredResult(_0x2602a6,_0x4907e4))[_0x8c7f('0x3c')](handleError(_0x2602a6,null));};exports['show']=function(_0x18335d,_0x59927b){var _0x248c17={'raw':![],'where':{'id':_0x18335d[_0x8c7f('0x3d')]['id']}},_0x2d37b2={};_0x2d37b2[_0x8c7f('0x2b')]=_[_0x8c7f('0x3e')](db[_0x8c7f('0x3f')][_0x8c7f('0x29')]);_0x2d37b2['query']=_[_0x8c7f('0x3e')](_0x18335d['query']);_0x2d37b2['filters']=_[_0x8c7f('0x2e')](_0x2d37b2['model'],_0x2d37b2['query']);_0x248c17[_0x8c7f('0x2f')]=_[_0x8c7f('0x2e')](_0x2d37b2['model'],qs['fields'](_0x18335d['query'][_0x8c7f('0x30')]));_0x248c17['attributes']=_0x248c17['attributes'][_0x8c7f('0x40')]?_0x248c17[_0x8c7f('0x2f')]:_0x2d37b2['model'];if(_0x18335d[_0x8c7f('0x2c')][_0x8c7f('0x41')]){_0x248c17[_0x8c7f('0x39')]=[{'all':!![]}];}_0x248c17=_[_0x8c7f('0x36')]({},_0x248c17,_0x18335d[_0x8c7f('0x42')]);return db['DeskAccount']['find'](_0x248c17)[_0x8c7f('0x22')](handleEntityNotFound(_0x59927b,null))[_0x8c7f('0x22')](respondWithResult(_0x59927b,null))[_0x8c7f('0x3c')](handleError(_0x59927b,null));};exports['create']=function(_0x55cca1,_0x4fb812){return db[_0x8c7f('0x3f')][_0x8c7f('0x43')](_0x55cca1[_0x8c7f('0x44')],{})[_0x8c7f('0x22')](respondWithResult(_0x4fb812,0xc9))[_0x8c7f('0x3c')](handleError(_0x4fb812,null));};exports['update']=function(_0x146f42,_0x148d3d){if(_0x146f42[_0x8c7f('0x44')]['id']){delete _0x146f42[_0x8c7f('0x44')]['id'];}return db['DeskAccount'][_0x8c7f('0x45')]({'where':{'id':_0x146f42['params']['id']}})[_0x8c7f('0x22')](handleEntityNotFound(_0x148d3d,null))['then'](saveUpdates(_0x146f42[_0x8c7f('0x44')],null))[_0x8c7f('0x22')](respondWithResult(_0x148d3d,null))[_0x8c7f('0x3c')](handleError(_0x148d3d,null));};exports['destroy']=function(_0x481d02,_0x621e2e){return db[_0x8c7f('0x3f')][_0x8c7f('0x45')]({'where':{'id':_0x481d02[_0x8c7f('0x3d')]['id']}})[_0x8c7f('0x22')](handleEntityNotFound(_0x621e2e,null))['then'](removeEntity(_0x621e2e,null))[_0x8c7f('0x3c')](handleError(_0x621e2e,null));};exports[_0x8c7f('0x46')]=function(_0x1203b0,_0x4f5883,_0x498c6f){var _0x579be8={};var _0x14e5a6={};var _0x46dbaa;var _0x3f575d;return db[_0x8c7f('0x3f')]['findOne']({'where':{'id':_0x1203b0[_0x8c7f('0x3d')]['id']}})[_0x8c7f('0x22')](handleEntityNotFound(_0x4f5883,null))[_0x8c7f('0x22')](function(_0x2bbe78){if(_0x2bbe78){_0x46dbaa=_0x2bbe78;_0x14e5a6[_0x8c7f('0x2b')]=_[_0x8c7f('0x3e')](db['DeskConfiguration'][_0x8c7f('0x29')]);_0x14e5a6['query']=_[_0x8c7f('0x3e')](_0x1203b0[_0x8c7f('0x2c')]);_0x14e5a6[_0x8c7f('0x2d')]=_[_0x8c7f('0x2e')](_0x14e5a6[_0x8c7f('0x2b')],_0x14e5a6[_0x8c7f('0x2c')]);_0x579be8[_0x8c7f('0x2f')]=_[_0x8c7f('0x2e')](_0x14e5a6[_0x8c7f('0x2b')],qs['fields'](_0x1203b0['query'][_0x8c7f('0x30')]));_0x579be8[_0x8c7f('0x2f')]=_0x579be8['attributes'][_0x8c7f('0x40')]?_0x579be8[_0x8c7f('0x2f')]:_0x14e5a6[_0x8c7f('0x2b')];_0x579be8[_0x8c7f('0x32')]=qs[_0x8c7f('0x33')](_0x1203b0[_0x8c7f('0x2c')]['sort']);_0x579be8[_0x8c7f('0x34')]=qs[_0x8c7f('0x2d')](_[_0x8c7f('0x35')](_0x1203b0[_0x8c7f('0x2c')],_0x14e5a6[_0x8c7f('0x2d')]));if(_0x1203b0['query'][_0x8c7f('0x38')]){_0x579be8[_0x8c7f('0x34')]=_[_0x8c7f('0x36')](_0x579be8['where'],{'$or':_[_0x8c7f('0x28')](_0x579be8[_0x8c7f('0x2f')],function(_0x1bc69c){var _0x88ec6d={};_0x88ec6d[_0x1bc69c]={'$like':'%'+_0x1203b0['query'][_0x8c7f('0x38')]+'%'};return _0x88ec6d;})});}_0x579be8=_[_0x8c7f('0x36')]({},_0x579be8,_0x1203b0[_0x8c7f('0x42')]);return _0x46dbaa[_0x8c7f('0x46')](_0x579be8);}})[_0x8c7f('0x22')](function(_0x11edca){if(_0x11edca){_0x3f575d=_0x11edca['length'];if(!_0x1203b0[_0x8c7f('0x2c')]['hasOwnProperty'](_0x8c7f('0x31'))){_0x579be8[_0x8c7f('0x1b')]=qs[_0x8c7f('0x1b')](_0x1203b0['query'][_0x8c7f('0x1b')]);_0x579be8['offset']=qs['offset'](_0x1203b0[_0x8c7f('0x2c')][_0x8c7f('0x19')]);}return _0x46dbaa[_0x8c7f('0x46')](_0x579be8);}})[_0x8c7f('0x22')](function(_0x4fa061){if(_0x4fa061){return _0x4fa061?{'count':_0x3f575d,'rows':_0x4fa061}:null;}})[_0x8c7f('0x22')](respondWithResult(_0x4f5883,null))[_0x8c7f('0x3c')](handleError(_0x4f5883,null));};exports[_0x8c7f('0x47')]=function(_0x4257eb,_0xb0738e,_0x514b42){if(_0x4257eb[_0x8c7f('0x44')]['id']){delete _0x4257eb[_0x8c7f('0x44')]['id'];}return db['DeskAccount'][_0x8c7f('0x48')]({'where':{'id':_0x4257eb['params']['id']}})[_0x8c7f('0x22')](handleEntityNotFound(_0xb0738e,null))[_0x8c7f('0x22')](function(_0x260c6e){if(_0x260c6e){_0x4257eb[_0x8c7f('0x44')][_0x8c7f('0x49')]=_0x260c6e['id'];_0x4257eb[_0x8c7f('0x44')][_0x8c7f('0x4a')]=integrations[_0x8c7f('0x4b')](_0x4257eb['body'][_0x8c7f('0x4c')],_0x4257eb[_0x8c7f('0x44')]['type']);_0x4257eb[_0x8c7f('0x44')][_0x8c7f('0x4d')]=integrations[_0x8c7f('0x4e')](_0x4257eb[_0x8c7f('0x44')][_0x8c7f('0x4c')],_0x4257eb[_0x8c7f('0x44')][_0x8c7f('0x2a')]);return db[_0x8c7f('0x4f')][_0x8c7f('0x43')](_0x4257eb[_0x8c7f('0x44')],{'include':[{'model':db['DeskField'],'as':_0x8c7f('0x4a')},{'model':db[_0x8c7f('0x50')],'as':_0x8c7f('0x4d')}]});}return null;})[_0x8c7f('0x22')](respondWithResult(_0xb0738e,null))[_0x8c7f('0x3c')](handleError(_0xb0738e,null));};exports[_0x8c7f('0x51')]=function(_0x3442a3,_0xa92558,_0x37c7cc){var _0x2c42f0=[{'name':_0x8c7f('0x52'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x53e137='';return db[_0x8c7f('0x3f')][_0x8c7f('0x48')]({'where':{'id':_0x3442a3[_0x8c7f('0x3d')]['id']},'attributes':['id',_0x8c7f('0x53'),'authType',_0x8c7f('0x54'),_0x8c7f('0x55'),_0x8c7f('0x56'),'consumerSecret',_0x8c7f('0x57'),_0x8c7f('0x58')]})[_0x8c7f('0x22')](handleEntityNotFound(_0xa92558,null))['then'](function(_0x53280f){if(_0x53280f){_0x53e137=_0x53280f[_0x8c7f('0x53')];var _0x301f7f=_0x53e137[_0x8c7f('0x59')](-0x1);if(_0x301f7f==='/'){_0x53e137=_0x53e137[_0x8c7f('0x5a')](0x0,_0x53e137[_0x8c7f('0x5b')](_0x301f7f));}var _0x1e1676={'method':_0x8c7f('0x5c'),'uri':util[_0x8c7f('0x5d')](_0x8c7f('0x5e'),_0x53e137),'headers':{'Content-Type':_0x8c7f('0x5f'),'Accept':'application/json'},'json':!![]};if(_0x53280f[_0x8c7f('0x60')]===_0x8c7f('0x61')){_0x1e1676[_0x8c7f('0x62')][_0x8c7f('0x63')]=util['format'](_0x8c7f('0x64'),new Buffer(util[_0x8c7f('0x5d')]('%s:%s',_0x53280f[_0x8c7f('0x54')],_0x53280f[_0x8c7f('0x55')]))[_0x8c7f('0x65')](_0x8c7f('0x66')));}return rp(_0x1e1676)[_0x8c7f('0x22')](function(_0x5b3fee){return _0x2c42f0['concat'](_[_0x8c7f('0x28')](_0x5b3fee[_0x8c7f('0x67')][_0x8c7f('0x68')],function(_0x5660dc){return{'id':_0x5660dc[_0x8c7f('0x26')],'name':_0x5660dc[_0x8c7f('0x26')],'type':_0x5660dc[_0x8c7f('0x2a')],'active':_0x5660dc[_0x8c7f('0x69')],'label':_0x5660dc[_0x8c7f('0x6a')],'custom':!![]};}));});}})[_0x8c7f('0x22')](function(_0x1527d6){return{'count':_0x1527d6['length'],'rows':_0x1527d6};})[_0x8c7f('0x22')](respondWithResult(_0xa92558,null))[_0x8c7f('0x3c')](function(_0x20c26c){var _0x421607=_0x3442a3[_0x8c7f('0x2c')][_0x8c7f('0x6b')]?0x1f4:_0x20c26c[_0x8c7f('0x6c')]||0x1f4;logger[_0x8c7f('0x24')](_0x8c7f('0x6d'),_0x8c7f('0x51'),_0x421607,JSON[_0x8c7f('0x6e')](_0x20c26c));delete _0x20c26c[_0x8c7f('0x26')];if(_0x421607===0x191){_0x421607=0x190;}_0xa92558[_0x8c7f('0x17')](_0x421607)['send'](_0x3442a3[_0x8c7f('0x2c')][_0x8c7f('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x20c26c['statusCode']}:_0x20c26c);});}; \ No newline at end of file +var _0x0545=['DeskAccount','fieldName','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','merge','map','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','rawAttributes','length','include','find','body','getConfigurations','findOne','DeskConfiguration','pick','getSubjects','Descriptions','getDescriptions','channel','create','DeskField','Subjects','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','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','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index'];(function(_0xfeaf58,_0x12bc64){var _0x294a8e=function(_0x235e33){while(--_0x235e33){_0xfeaf58['push'](_0xfeaf58['shift']());}};_0x294a8e(++_0x12bc64);}(_0x0545,0x1ac));var _0x5054=function(_0x1e7d12,_0x134bed){_0x1e7d12=_0x1e7d12-0x0;var _0x5a1bac=_0x0545[_0x1e7d12];return _0x5a1bac;};'use strict';var emlformat=require(_0x5054('0x0'));var rimraf=require(_0x5054('0x1'));var zipdir=require(_0x5054('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5054('0x3'));var moment=require(_0x5054('0x4'));var BPromise=require(_0x5054('0x5'));var Mustache=require(_0x5054('0x6'));var util=require(_0x5054('0x7'));var path=require('path');var sox=require(_0x5054('0x8'));var csv=require(_0x5054('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5054('0xa'));var _=require(_0x5054('0xb'));var squel=require(_0x5054('0xc'));var crypto=require(_0x5054('0xd'));var jsforce=require(_0x5054('0xe'));var deskjs=require(_0x5054('0xf'));var toCsv=require(_0x5054('0x9'));var querystring=require(_0x5054('0x10'));var Papa=require(_0x5054('0x11'));var Redis=require(_0x5054('0x12'));var authService=require(_0x5054('0x13'));var qs=require(_0x5054('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5054('0x15'));var logger=require('../../config/logger')(_0x5054('0x16'));var utils=require(_0x5054('0x17'));var config=require(_0x5054('0x18'));var licenseUtil=require(_0x5054('0x19'));var db=require(_0x5054('0x1a'))['db'];var integrations=require(_0x5054('0x1b'));function respondWithStatusCode(_0x269354,_0x126f8e){_0x126f8e=_0x126f8e||0xcc;return function(_0x10c88d){if(_0x10c88d){return _0x269354[_0x5054('0x1c')](_0x126f8e);}return _0x269354[_0x5054('0x1d')](_0x126f8e)[_0x5054('0x1e')]();};}function respondWithResult(_0xdd0298,_0x2f3c7a){_0x2f3c7a=_0x2f3c7a||0xc8;return function(_0x1f54a9){if(_0x1f54a9){return _0xdd0298['status'](_0x2f3c7a)[_0x5054('0x1f')](_0x1f54a9);}};}function respondWithFilteredResult(_0x3174ca,_0x168c50){return function(_0x5e4981){if(_0x5e4981){var _0xe03da0=typeof _0x168c50[_0x5054('0x20')]===_0x5054('0x21')&&typeof _0x168c50[_0x5054('0x22')]===_0x5054('0x21');var _0x579ef9=_0x5e4981[_0x5054('0x23')];var _0x58af10=_0xe03da0?0x0:_0x168c50[_0x5054('0x20')];var _0x2417eb=_0xe03da0?_0x5e4981[_0x5054('0x23')]:_0x168c50[_0x5054('0x20')]+_0x168c50['limit'];var _0x562455;if(_0x2417eb>=_0x579ef9){_0x2417eb=_0x579ef9;_0x562455=0xc8;}else{_0x562455=0xce;}_0x3174ca['status'](_0x562455);return _0x3174ca[_0x5054('0x24')](_0x5054('0x25'),_0x58af10+'-'+_0x2417eb+'/'+_0x579ef9)[_0x5054('0x1f')](_0x5e4981);}return null;};}function patchUpdates(_0x4dc1b3){return function(_0x1d4fc8){try{jsonpatch[_0x5054('0x26')](_0x1d4fc8,_0x4dc1b3,!![]);}catch(_0x1ec0bd){return BPromise[_0x5054('0x27')](_0x1ec0bd);}return _0x1d4fc8['save']();};}function saveUpdates(_0x360a9e,_0x7f71ff){return function(_0x30921a){if(_0x30921a){return _0x30921a[_0x5054('0x28')](_0x360a9e)['then'](function(_0x2f6f4a){return _0x2f6f4a;});}return null;};}function removeEntity(_0x18cd5f,_0x51835a){return function(_0x4ffac0){if(_0x4ffac0){return _0x4ffac0[_0x5054('0x29')]()[_0x5054('0x2a')](function(){_0x18cd5f[_0x5054('0x1d')](0xcc)[_0x5054('0x1e')]();});}};}function handleEntityNotFound(_0x364e1b,_0x2ee766){return function(_0x1815cc){if(!_0x1815cc){_0x364e1b[_0x5054('0x1c')](0x194);}return _0x1815cc;};}function handleError(_0xa43ddb,_0x4ce702){_0x4ce702=_0x4ce702||0x1f4;return function(_0x37124e){logger[_0x5054('0x2b')](_0x37124e[_0x5054('0x2c')]);if(_0x37124e[_0x5054('0x2d')]){delete _0x37124e['name'];}_0xa43ddb[_0x5054('0x1d')](_0x4ce702)[_0x5054('0x2e')](_0x37124e);};}exports[_0x5054('0x2f')]=function(_0x1f33a0,_0x16bf3d){var _0x343d74={},_0x2c5d0f={},_0x2dbbfc={'count':0x0,'rows':[]};var _0x1c3902=_['map'](db[_0x5054('0x30')]['rawAttributes'],function(_0x392fdc){return{'name':_0x392fdc[_0x5054('0x31')],'type':_0x392fdc['type'][_0x5054('0x32')]};});_0x2c5d0f[_0x5054('0x33')]=_['map'](_0x1c3902,_0x5054('0x2d'));_0x2c5d0f['query']=_[_0x5054('0x34')](_0x1f33a0[_0x5054('0x35')]);_0x2c5d0f[_0x5054('0x36')]=_[_0x5054('0x37')](_0x2c5d0f[_0x5054('0x33')],_0x2c5d0f[_0x5054('0x35')]);_0x343d74[_0x5054('0x38')]=_[_0x5054('0x37')](_0x2c5d0f[_0x5054('0x33')],qs['fields'](_0x1f33a0[_0x5054('0x35')][_0x5054('0x39')]));_0x343d74[_0x5054('0x38')]=_0x343d74[_0x5054('0x38')]['length']?_0x343d74[_0x5054('0x38')]:_0x2c5d0f['model'];if(!_0x1f33a0[_0x5054('0x35')]['hasOwnProperty']('nolimit')){_0x343d74[_0x5054('0x22')]=qs[_0x5054('0x22')](_0x1f33a0[_0x5054('0x35')][_0x5054('0x22')]);_0x343d74['offset']=qs[_0x5054('0x20')](_0x1f33a0[_0x5054('0x35')][_0x5054('0x20')]);}_0x343d74[_0x5054('0x3a')]=qs[_0x5054('0x3b')](_0x1f33a0[_0x5054('0x35')][_0x5054('0x3b')]);_0x343d74[_0x5054('0x3c')]=qs[_0x5054('0x36')](_['pick'](_0x1f33a0[_0x5054('0x35')],_0x2c5d0f[_0x5054('0x36')]),_0x1c3902);if(_0x1f33a0[_0x5054('0x35')]['filter']){_0x343d74[_0x5054('0x3c')]=_[_0x5054('0x3d')](_0x343d74['where'],{'$or':_[_0x5054('0x3e')](_0x1c3902,function(_0x112cee){if(_0x112cee[_0x5054('0x3f')]!==_0x5054('0x40')){var _0x45c7df={};_0x45c7df[_0x112cee['name']]={'$like':'%'+_0x1f33a0[_0x5054('0x35')][_0x5054('0x41')]+'%'};return _0x45c7df;}})});}_0x343d74=_[_0x5054('0x3d')]({},_0x343d74,_0x1f33a0[_0x5054('0x42')]);var _0x5839be={'where':_0x343d74['where']};return db[_0x5054('0x30')][_0x5054('0x23')](_0x5839be)[_0x5054('0x2a')](function(_0x347fce){_0x2dbbfc[_0x5054('0x23')]=_0x347fce;if(_0x1f33a0['query'][_0x5054('0x43')]){_0x343d74['include']=[{'all':!![]}];}return db[_0x5054('0x30')][_0x5054('0x44')](_0x343d74);})['then'](function(_0x30b41c){_0x2dbbfc[_0x5054('0x45')]=_0x30b41c;return _0x2dbbfc;})[_0x5054('0x2a')](respondWithFilteredResult(_0x16bf3d,_0x343d74))[_0x5054('0x46')](handleError(_0x16bf3d,null));};exports['show']=function(_0x12034d,_0x2c8c4d){var _0x357821={'raw':![],'where':{'id':_0x12034d[_0x5054('0x47')]['id']}},_0x1be0c5={};_0x1be0c5[_0x5054('0x33')]=_[_0x5054('0x34')](db['DeskAccount'][_0x5054('0x48')]);_0x1be0c5[_0x5054('0x35')]=_[_0x5054('0x34')](_0x12034d[_0x5054('0x35')]);_0x1be0c5[_0x5054('0x36')]=_[_0x5054('0x37')](_0x1be0c5[_0x5054('0x33')],_0x1be0c5['query']);_0x357821[_0x5054('0x38')]=_[_0x5054('0x37')](_0x1be0c5[_0x5054('0x33')],qs[_0x5054('0x39')](_0x12034d[_0x5054('0x35')]['fields']));_0x357821[_0x5054('0x38')]=_0x357821['attributes'][_0x5054('0x49')]?_0x357821['attributes']:_0x1be0c5[_0x5054('0x33')];if(_0x12034d['query'][_0x5054('0x43')]){_0x357821[_0x5054('0x4a')]=[{'all':!![]}];}_0x357821=_['merge']({},_0x357821,_0x12034d[_0x5054('0x42')]);return db[_0x5054('0x30')][_0x5054('0x4b')](_0x357821)[_0x5054('0x2a')](handleEntityNotFound(_0x2c8c4d,null))['then'](respondWithResult(_0x2c8c4d,null))[_0x5054('0x46')](handleError(_0x2c8c4d,null));};exports['create']=function(_0x61137b,_0x1b32bc){return db[_0x5054('0x30')]['create'](_0x61137b[_0x5054('0x4c')],{})['then'](respondWithResult(_0x1b32bc,0xc9))['catch'](handleError(_0x1b32bc,null));};exports[_0x5054('0x28')]=function(_0x3387f6,_0x327ee4){if(_0x3387f6['body']['id']){delete _0x3387f6[_0x5054('0x4c')]['id'];}return db[_0x5054('0x30')][_0x5054('0x4b')]({'where':{'id':_0x3387f6[_0x5054('0x47')]['id']}})[_0x5054('0x2a')](handleEntityNotFound(_0x327ee4,null))['then'](saveUpdates(_0x3387f6[_0x5054('0x4c')],null))[_0x5054('0x2a')](respondWithResult(_0x327ee4,null))[_0x5054('0x46')](handleError(_0x327ee4,null));};exports['destroy']=function(_0x10caa5,_0x3162a1){return db[_0x5054('0x30')][_0x5054('0x4b')]({'where':{'id':_0x10caa5[_0x5054('0x47')]['id']}})[_0x5054('0x2a')](handleEntityNotFound(_0x3162a1,null))[_0x5054('0x2a')](removeEntity(_0x3162a1,null))[_0x5054('0x46')](handleError(_0x3162a1,null));};exports[_0x5054('0x4d')]=function(_0x2959c8,_0x496939,_0x347e53){var _0x501ffe={};var _0x4ba459={};var _0x4d4a42;var _0x1caa96;return db[_0x5054('0x30')][_0x5054('0x4e')]({'where':{'id':_0x2959c8[_0x5054('0x47')]['id']}})['then'](handleEntityNotFound(_0x496939,null))[_0x5054('0x2a')](function(_0x918d75){if(_0x918d75){_0x4d4a42=_0x918d75;_0x4ba459[_0x5054('0x33')]=_[_0x5054('0x34')](db[_0x5054('0x4f')]['rawAttributes']);_0x4ba459['query']=_['keys'](_0x2959c8[_0x5054('0x35')]);_0x4ba459[_0x5054('0x36')]=_['intersection'](_0x4ba459['model'],_0x4ba459[_0x5054('0x35')]);_0x501ffe[_0x5054('0x38')]=_[_0x5054('0x37')](_0x4ba459[_0x5054('0x33')],qs[_0x5054('0x39')](_0x2959c8[_0x5054('0x35')][_0x5054('0x39')]));_0x501ffe[_0x5054('0x38')]=_0x501ffe['attributes'][_0x5054('0x49')]?_0x501ffe[_0x5054('0x38')]:_0x4ba459[_0x5054('0x33')];_0x501ffe[_0x5054('0x3a')]=qs[_0x5054('0x3b')](_0x2959c8['query'][_0x5054('0x3b')]);_0x501ffe[_0x5054('0x3c')]=qs[_0x5054('0x36')](_[_0x5054('0x50')](_0x2959c8[_0x5054('0x35')],_0x4ba459[_0x5054('0x36')]));if(_0x2959c8['query']['filter']){_0x501ffe[_0x5054('0x3c')]=_[_0x5054('0x3d')](_0x501ffe[_0x5054('0x3c')],{'$or':_['map'](_0x501ffe[_0x5054('0x38')],function(_0x199d37){var _0x4a2d46={};_0x4a2d46[_0x199d37]={'$like':'%'+_0x2959c8[_0x5054('0x35')][_0x5054('0x41')]+'%'};return _0x4a2d46;})});}_0x501ffe=_['merge']({},_0x501ffe,_0x2959c8[_0x5054('0x42')]);return _0x4d4a42['getConfigurations'](_0x501ffe);}})['then'](function(_0x558196){if(_0x558196){_0x1caa96=_0x558196[_0x5054('0x49')];if(!_0x2959c8['query']['hasOwnProperty']('nolimit')){_0x501ffe['limit']=qs[_0x5054('0x22')](_0x2959c8[_0x5054('0x35')][_0x5054('0x22')]);_0x501ffe[_0x5054('0x20')]=qs[_0x5054('0x20')](_0x2959c8[_0x5054('0x35')][_0x5054('0x20')]);}return _0x4d4a42[_0x5054('0x4d')](_0x501ffe);}})[_0x5054('0x2a')](function(_0x25528f){if(_0x25528f){return _0x25528f?{'count':_0x1caa96,'rows':_0x25528f}:null;}})[_0x5054('0x2a')](respondWithResult(_0x496939,null))[_0x5054('0x46')](handleError(_0x496939,null));};exports['addConfiguration']=function(_0x548b2d,_0x53a133,_0x5e25c5){if(_0x548b2d[_0x5054('0x4c')]['id']){delete _0x548b2d[_0x5054('0x4c')]['id'];}return db[_0x5054('0x30')][_0x5054('0x4e')]({'where':{'id':_0x548b2d[_0x5054('0x47')]['id']}})[_0x5054('0x2a')](handleEntityNotFound(_0x53a133,null))[_0x5054('0x2a')](function(_0x53d991){if(_0x53d991){_0x548b2d[_0x5054('0x4c')]['AccountId']=_0x53d991['id'];_0x548b2d[_0x5054('0x4c')]['Subjects']=integrations[_0x5054('0x51')](_0x548b2d['body']['channel'],_0x548b2d[_0x5054('0x4c')]['type']);_0x548b2d[_0x5054('0x4c')][_0x5054('0x52')]=integrations[_0x5054('0x53')](_0x548b2d[_0x5054('0x4c')][_0x5054('0x54')],_0x548b2d[_0x5054('0x4c')][_0x5054('0x3f')]);return db[_0x5054('0x4f')][_0x5054('0x55')](_0x548b2d['body'],{'include':[{'model':db[_0x5054('0x56')],'as':_0x5054('0x57')},{'model':db[_0x5054('0x56')],'as':_0x5054('0x52')}]});}return null;})[_0x5054('0x2a')](respondWithResult(_0x53a133,null))['catch'](handleError(_0x53a133,null));};exports['getFields']=function(_0x5e5a4f,_0x5ef693,_0x21f782){var _0x55d3cf=[{'name':_0x5054('0x58'),'label':_0x5054('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 _0x367681='';return db['DeskAccount'][_0x5054('0x4e')]({'where':{'id':_0x5e5a4f[_0x5054('0x47')]['id']},'attributes':['id','remoteUri',_0x5054('0x59'),_0x5054('0x5a'),_0x5054('0x5b'),_0x5054('0x5c'),_0x5054('0x5d'),_0x5054('0x5e'),_0x5054('0x5f')]})[_0x5054('0x2a')](handleEntityNotFound(_0x5ef693,null))[_0x5054('0x2a')](function(_0x45776f){if(_0x45776f){_0x367681=_0x45776f[_0x5054('0x60')];var _0x225f5f=_0x367681[_0x5054('0x61')](-0x1);if(_0x225f5f==='/'){_0x367681=_0x367681[_0x5054('0x62')](0x0,_0x367681['lastIndexOf'](_0x225f5f));}var _0x4452ac={'method':_0x5054('0x63'),'uri':util[_0x5054('0x64')](_0x5054('0x65'),_0x367681),'headers':{'Content-Type':_0x5054('0x66'),'Accept':_0x5054('0x66')},'json':!![]};if(_0x45776f[_0x5054('0x59')]===_0x5054('0x67')){_0x4452ac[_0x5054('0x68')][_0x5054('0x69')]=util['format'](_0x5054('0x6a'),new Buffer(util['format'](_0x5054('0x6b'),_0x45776f['username'],_0x45776f[_0x5054('0x5b')]))[_0x5054('0x6c')](_0x5054('0x6d')));}return rp(_0x4452ac)[_0x5054('0x2a')](function(_0x114ad4){return _0x55d3cf[_0x5054('0x6e')](_[_0x5054('0x3e')](_0x114ad4[_0x5054('0x6f')][_0x5054('0x70')],function(_0x7d240){return{'id':_0x7d240[_0x5054('0x2d')],'name':_0x7d240[_0x5054('0x2d')],'type':_0x7d240[_0x5054('0x3f')],'active':_0x7d240[_0x5054('0x71')],'label':_0x7d240[_0x5054('0x72')],'custom':!![]};}));});}})[_0x5054('0x2a')](function(_0xb8ee6d){return{'count':_0xb8ee6d['length'],'rows':_0xb8ee6d};})[_0x5054('0x2a')](respondWithResult(_0x5ef693,null))[_0x5054('0x46')](function(_0x33bed7){var _0x2a6036=_0x5e5a4f['query']['test']?0x1f4:_0x33bed7[_0x5054('0x73')]||0x1f4;logger[_0x5054('0x2b')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2a6036,JSON[_0x5054('0x74')](_0x33bed7));delete _0x33bed7[_0x5054('0x2d')];if(_0x2a6036===0x191){_0x2a6036=0x190;}_0x5ef693[_0x5054('0x1d')](_0x2a6036)[_0x5054('0x2e')](_0x5e5a4f['query'][_0x5054('0x75')]?{'message':_0x5054('0x76'),'statusCode':_0x33bed7[_0x5054('0x73')]}:_0x33bed7);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 74d9ddb..8b18e3d 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 _0x1c8b=['request-promise','path','rimraf','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment'];(function(_0x2e5243,_0x3c082c){var _0x183bf9=function(_0x32b958){while(--_0x32b958){_0x2e5243['push'](_0x2e5243['shift']());}};_0x183bf9(++_0x3c082c);}(_0x1c8b,0x188));var _0xb1c8=function(_0x5ab331,_0x255a09){_0x5ab331=_0x5ab331-0x0;var _0x141f3=_0x1c8b[_0x5ab331];return _0x141f3;};'use strict';var _=require(_0xb1c8('0x0'));var util=require('util');var logger=require(_0xb1c8('0x1'))(_0xb1c8('0x2'));var moment=require(_0xb1c8('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1c8('0x4'));var fs=require('fs');var path=require(_0xb1c8('0x5'));var rimraf=require(_0xb1c8('0x6'));var config=require('../../config/environment');var attributes=require(_0xb1c8('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xb1c8('0x8')]=function(_0x383ea9,_0x26f8d6){return _0x383ea9[_0xb1c8('0x9')](_0xb1c8('0xa'),attributes,{'tableName':_0xb1c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cbf=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x48146e,_0x3c18c1){var _0x603d01=function(_0x2c20cc){while(--_0x2c20cc){_0x48146e['push'](_0x48146e['shift']());}};_0x603d01(++_0x3c18c1);}(_0x8cbf,0xe8));var _0xf8cb=function(_0x504792,_0x2c25fb){_0x504792=_0x504792-0x0;var _0x1e1cc5=_0x8cbf[_0x504792];return _0x1e1cc5;};'use strict';var _=require(_0xf8cb('0x0'));var util=require(_0xf8cb('0x1'));var logger=require(_0xf8cb('0x2'))(_0xf8cb('0x3'));var moment=require('moment');var BPromise=require(_0xf8cb('0x4'));var rp=require(_0xf8cb('0x5'));var fs=require('fs');var path=require(_0xf8cb('0x6'));var rimraf=require(_0xf8cb('0x7'));var config=require(_0xf8cb('0x8'));var attributes=require(_0xf8cb('0x9'));var integrations=require(_0xf8cb('0xa'));module['exports']=function(_0x1c6b90,_0x63b4b1){return _0x1c6b90[_0xf8cb('0xb')](_0xf8cb('0xc'),attributes,{'tableName':_0xf8cb('0xd'),'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 dbad26e..6f7948e 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 _0x07aa=['request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','DeskAccount','findAll','options','where','limit','include','model','attributes','map','GetDeskAccount','stringify','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x07aa,0x65));var _0xa07a=function(_0x33a187,_0x50efbb){_0x33a187=_0x33a187-0x0;var _0x134ec6=_0x07aa[_0x33a187];return _0x134ec6;};'use strict';var _=require(_0xa07a('0x0'));var util=require(_0xa07a('0x1'));var moment=require(_0xa07a('0x2'));var BPromise=require(_0xa07a('0x3'));var rs=require(_0xa07a('0x4'));var fs=require('fs');var Redis=require(_0xa07a('0x5'));var db=require(_0xa07a('0x6'))['db'];var utils=require(_0xa07a('0x7'));var logger=require(_0xa07a('0x8'))(_0xa07a('0x9'));var config=require(_0xa07a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa07a('0xb')][_0xa07a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24c547,_0x358708,_0x4f7899){return new BPromise(function(_0x5183f3,_0x2c8eb2){return client[_0xa07a('0xd')](_0x24c547,_0x4f7899)[_0xa07a('0xe')](function(_0x1e4725){logger[_0xa07a('0xf')](_0xa07a('0x10'),_0x358708,_0xa07a('0x11'));logger[_0xa07a('0x12')](_0xa07a('0x13'),_0x358708,_0xa07a('0x11'),JSON['stringify'](_0x1e4725));if(_0x1e4725['error']){if(_0x1e4725[_0xa07a('0x14')][_0xa07a('0x15')]===0x1f4){logger[_0xa07a('0x14')]('DeskAccount,\x20%s,\x20%s',_0x358708,_0x1e4725[_0xa07a('0x14')]['message']);return _0x2c8eb2(_0x1e4725[_0xa07a('0x14')][_0xa07a('0x16')]);}logger[_0xa07a('0x14')](_0xa07a('0x10'),_0x358708,_0x1e4725[_0xa07a('0x14')][_0xa07a('0x16')]);return _0x5183f3(_0x1e4725[_0xa07a('0x14')][_0xa07a('0x16')]);}else{logger[_0xa07a('0xf')](_0xa07a('0x10'),_0x358708,_0xa07a('0x11'));_0x5183f3(_0x1e4725[_0xa07a('0x17')][_0xa07a('0x16')]);}})[_0xa07a('0x18')](function(_0x1f3252){logger[_0xa07a('0x14')](_0xa07a('0x10'),_0x358708,_0x1f3252);_0x2c8eb2(_0x1f3252);});});}exports['GetDeskAccount']=function(_0x3a726b){var _0x4de658=this;return new Promise(function(_0xdeda9a,_0x41bbab){return db[_0xa07a('0x19')][_0xa07a('0x1a')]({'raw':_0x3a726b[_0xa07a('0x1b')]?_0x3a726b[_0xa07a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3a726b[_0xa07a('0x1b')]?_0x3a726b[_0xa07a('0x1b')][_0xa07a('0x1c')]||null:null,'attributes':_0x3a726b[_0xa07a('0x1b')]?_0x3a726b[_0xa07a('0x1b')]['attributes']||null:null,'limit':_0x3a726b['options']?_0x3a726b['options'][_0xa07a('0x1d')]||null:null,'include':_0x3a726b[_0xa07a('0x1b')]?_0x3a726b[_0xa07a('0x1b')][_0xa07a('0x1e')]?_['map'](_0x3a726b[_0xa07a('0x1b')][_0xa07a('0x1e')],function(_0xba963e){return{'model':db[_0xba963e[_0xa07a('0x1f')]],'as':_0xba963e['as'],'attributes':_0xba963e[_0xa07a('0x20')],'include':_0xba963e['include']?_[_0xa07a('0x21')](_0xba963e[_0xa07a('0x1e')],function(_0x1b0c49){return{'model':db[_0x1b0c49['model']],'as':_0x1b0c49['as'],'attributes':_0x1b0c49[_0xa07a('0x20')],'include':_0x1b0c49[_0xa07a('0x1e')]?_[_0xa07a('0x21')](_0x1b0c49[_0xa07a('0x1e')],function(_0x59dc3b){return{'model':db[_0x59dc3b[_0xa07a('0x1f')]],'as':_0x59dc3b['as'],'attributes':_0x59dc3b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x30456e){logger[_0xa07a('0xf')](_0xa07a('0x22'),_0x3a726b);logger[_0xa07a('0x12')](_0xa07a('0x22'),_0x3a726b,JSON[_0xa07a('0x23')](_0x30456e));_0xdeda9a(_0x30456e);})[_0xa07a('0x18')](function(_0x4c2699){logger[_0xa07a('0x14')]('GetDeskAccount',_0x4c2699['message'],_0x3a726b);_0x41bbab(_0x4de658[_0xa07a('0x14')](0x1f4,_0x4c2699[_0xa07a('0x16')]));});});};exports[_0xa07a('0x24')]=function(_0x300eaf){var _0x1bc188=this;return new Promise(function(_0xd42b9e,_0x5c1745){return db['DeskAccount'][_0xa07a('0x25')]({'raw':_0x300eaf['options']?_0x300eaf[_0xa07a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x300eaf['options']?_0x300eaf[_0xa07a('0x1b')][_0xa07a('0x1c')]||null:null,'attributes':_0x300eaf[_0xa07a('0x1b')]?_0x300eaf[_0xa07a('0x1b')]['attributes']||null:null,'include':_0x300eaf[_0xa07a('0x1b')]?_0x300eaf[_0xa07a('0x1b')][_0xa07a('0x1e')]?_[_0xa07a('0x21')](_0x300eaf[_0xa07a('0x1b')][_0xa07a('0x1e')],function(_0x39c6e7){return{'model':db[_0x39c6e7['model']],'as':_0x39c6e7['as'],'attributes':_0x39c6e7[_0xa07a('0x20')],'include':_0x39c6e7[_0xa07a('0x1e')]?_['map'](_0x39c6e7[_0xa07a('0x1e')],function(_0x4685e2){return{'model':db[_0x4685e2['model']],'as':_0x4685e2['as'],'attributes':_0x4685e2['attributes'],'include':_0x4685e2[_0xa07a('0x1e')]?_[_0xa07a('0x21')](_0x4685e2[_0xa07a('0x1e')],function(_0x574609){return{'model':db[_0x574609[_0xa07a('0x1f')]],'as':_0x574609['as'],'attributes':_0x574609[_0xa07a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x318da7){logger[_0xa07a('0xf')](_0xa07a('0x24'),_0x300eaf);logger[_0xa07a('0x12')](_0xa07a('0x24'),_0x300eaf,JSON[_0xa07a('0x23')](_0x318da7));_0xd42b9e(_0x318da7);})['catch'](function(_0x89a2dd){logger[_0xa07a('0x14')](_0xa07a('0x24'),_0x89a2dd['message'],_0x300eaf);_0x5c1745(_0x1bc188[_0xa07a('0x14')](0x1f4,_0x89a2dd['message']));});});}; \ No newline at end of file +var _0x9d05=['code','message','result','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetDeskAccount','catch','ShowDeskAccount','find','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x5b0754,_0x1e2e36){var _0x54a895=function(_0x571a1e){while(--_0x571a1e){_0x5b0754['push'](_0x5b0754['shift']());}};_0x54a895(++_0x1e2e36);}(_0x9d05,0xcb));var _0x59d0=function(_0x1edd2f,_0x14f97f){_0x1edd2f=_0x1edd2f-0x0;var _0x2f5d1c=_0x9d05[_0x1edd2f];return _0x2f5d1c;};'use strict';var _=require(_0x59d0('0x0'));var util=require(_0x59d0('0x1'));var moment=require('moment');var BPromise=require(_0x59d0('0x2'));var rs=require(_0x59d0('0x3'));var fs=require('fs');var Redis=require(_0x59d0('0x4'));var db=require(_0x59d0('0x5'))['db'];var utils=require(_0x59d0('0x6'));var logger=require('../../config/logger')(_0x59d0('0x7'));var config=require(_0x59d0('0x8'));var jayson=require(_0x59d0('0x9'));var client=jayson[_0x59d0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d9ff8,_0x534231,_0x1113c3){return new BPromise(function(_0x57c51b,_0x53fdb4){return client[_0x59d0('0xb')](_0x2d9ff8,_0x1113c3)[_0x59d0('0xc')](function(_0x21d5c3){logger[_0x59d0('0xd')](_0x59d0('0xe'),_0x534231,_0x59d0('0xf'));logger[_0x59d0('0x10')](_0x59d0('0x11'),_0x534231,'request\x20sent',JSON['stringify'](_0x21d5c3));if(_0x21d5c3['error']){if(_0x21d5c3[_0x59d0('0x12')][_0x59d0('0x13')]===0x1f4){logger[_0x59d0('0x12')](_0x59d0('0xe'),_0x534231,_0x21d5c3[_0x59d0('0x12')]['message']);return _0x53fdb4(_0x21d5c3['error'][_0x59d0('0x14')]);}logger['error'](_0x59d0('0xe'),_0x534231,_0x21d5c3[_0x59d0('0x12')]['message']);return _0x57c51b(_0x21d5c3[_0x59d0('0x12')][_0x59d0('0x14')]);}else{logger[_0x59d0('0xd')]('DeskAccount,\x20%s,\x20%s',_0x534231,_0x59d0('0xf'));_0x57c51b(_0x21d5c3[_0x59d0('0x15')][_0x59d0('0x14')]);}})['catch'](function(_0x20be1c){logger[_0x59d0('0x12')](_0x59d0('0xe'),_0x534231,_0x20be1c);_0x53fdb4(_0x20be1c);});});}exports['GetDeskAccount']=function(_0x504d8a){var _0x18b361=this;return new Promise(function(_0x510d6c,_0x1cdf33){return db[_0x59d0('0x16')][_0x59d0('0x17')]({'raw':_0x504d8a[_0x59d0('0x18')]?_0x504d8a[_0x59d0('0x18')][_0x59d0('0x19')]===undefined?!![]:![]:!![],'where':_0x504d8a[_0x59d0('0x18')]?_0x504d8a[_0x59d0('0x18')][_0x59d0('0x1a')]||null:null,'attributes':_0x504d8a['options']?_0x504d8a[_0x59d0('0x18')][_0x59d0('0x1b')]||null:null,'limit':_0x504d8a[_0x59d0('0x18')]?_0x504d8a[_0x59d0('0x18')][_0x59d0('0x1c')]||null:null,'include':_0x504d8a[_0x59d0('0x18')]?_0x504d8a['options']['include']?_[_0x59d0('0x1d')](_0x504d8a[_0x59d0('0x18')][_0x59d0('0x1e')],function(_0x428e87){return{'model':db[_0x428e87[_0x59d0('0x1f')]],'as':_0x428e87['as'],'attributes':_0x428e87[_0x59d0('0x1b')],'include':_0x428e87[_0x59d0('0x1e')]?_[_0x59d0('0x1d')](_0x428e87['include'],function(_0xafacd4){return{'model':db[_0xafacd4[_0x59d0('0x1f')]],'as':_0xafacd4['as'],'attributes':_0xafacd4[_0x59d0('0x1b')],'include':_0xafacd4[_0x59d0('0x1e')]?_[_0x59d0('0x1d')](_0xafacd4[_0x59d0('0x1e')],function(_0xc9145f){return{'model':db[_0xc9145f[_0x59d0('0x1f')]],'as':_0xc9145f['as'],'attributes':_0xc9145f[_0x59d0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x59d0('0xc')](function(_0x195b5e){logger[_0x59d0('0xd')]('GetDeskAccount',_0x504d8a);logger['debug'](_0x59d0('0x20'),_0x504d8a,JSON['stringify'](_0x195b5e));_0x510d6c(_0x195b5e);})[_0x59d0('0x21')](function(_0x20f470){logger[_0x59d0('0x12')](_0x59d0('0x20'),_0x20f470['message'],_0x504d8a);_0x1cdf33(_0x18b361[_0x59d0('0x12')](0x1f4,_0x20f470['message']));});});};exports[_0x59d0('0x22')]=function(_0x4409dd){var _0x101339=this;return new Promise(function(_0x315ca1,_0x161bac){return db[_0x59d0('0x16')][_0x59d0('0x23')]({'raw':_0x4409dd[_0x59d0('0x18')]?_0x4409dd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4409dd[_0x59d0('0x18')]?_0x4409dd['options'][_0x59d0('0x1a')]||null:null,'attributes':_0x4409dd[_0x59d0('0x18')]?_0x4409dd[_0x59d0('0x18')]['attributes']||null:null,'include':_0x4409dd[_0x59d0('0x18')]?_0x4409dd[_0x59d0('0x18')][_0x59d0('0x1e')]?_[_0x59d0('0x1d')](_0x4409dd[_0x59d0('0x18')][_0x59d0('0x1e')],function(_0x45f12b){return{'model':db[_0x45f12b[_0x59d0('0x1f')]],'as':_0x45f12b['as'],'attributes':_0x45f12b['attributes'],'include':_0x45f12b[_0x59d0('0x1e')]?_[_0x59d0('0x1d')](_0x45f12b[_0x59d0('0x1e')],function(_0x5c70d9){return{'model':db[_0x5c70d9[_0x59d0('0x1f')]],'as':_0x5c70d9['as'],'attributes':_0x5c70d9[_0x59d0('0x1b')],'include':_0x5c70d9[_0x59d0('0x1e')]?_[_0x59d0('0x1d')](_0x5c70d9[_0x59d0('0x1e')],function(_0x583ce0){return{'model':db[_0x583ce0[_0x59d0('0x1f')]],'as':_0x583ce0['as'],'attributes':_0x583ce0[_0x59d0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x59d0('0xc')](function(_0x31065f){logger[_0x59d0('0xd')]('ShowDeskAccount',_0x4409dd);logger[_0x59d0('0x10')](_0x59d0('0x22'),_0x4409dd,JSON[_0x59d0('0x24')](_0x31065f));_0x315ca1(_0x31065f);})['catch'](function(_0x3ff43a){logger[_0x59d0('0x12')](_0x59d0('0x22'),_0x3ff43a[_0x59d0('0x14')],_0x4409dd);_0x161bac(_0x101339[_0x59d0('0x12')](0x1f4,_0x3ff43a[_0x59d0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c9e0f6b..6bbf416 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x4ed37d,_0x1a84c9){var _0x4fb2c5=function(_0x5c9013){while(--_0x5c9013){_0x4ed37d['push'](_0x4ed37d['shift']());}};_0x4fb2c5(++_0x1a84c9);}(_0x55ca,0x126));var _0xa55c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x55ca[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +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(_0x4349d2,_0x39e225){var _0x56f6b1=function(_0x183e3d){while(--_0x183e3d){_0x4349d2['push'](_0x4349d2['shift']());}};_0x56f6b1(++_0x39e225);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'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 f5bf011..5bdf014 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 _0x56ab=['STRING','sequelize'];(function(_0xc7e7af,_0xf753ba){var _0x5d5d8e=function(_0x59d55d){while(--_0x59d55d){_0xc7e7af['push'](_0xc7e7af['shift']());}};_0x5d5d8e(++_0xf753ba);}(_0x56ab,0xb7));var _0xb56a=function(_0x3e5393,_0x5db5e2){_0x3e5393=_0x3e5393-0x0;var _0x342cb3=_0x56ab[_0x3e5393];return _0x342cb3;};'use strict';var Sequelize=require(_0xb56a('0x0'));module['exports']={'name':{'type':Sequelize[_0xb56a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfdd3=['exports','STRING'];(function(_0x31f907,_0x2b7c5f){var _0x4ede02=function(_0x50ac98){while(--_0x50ac98){_0x31f907['push'](_0x31f907['shift']());}};_0x4ede02(++_0x2b7c5f);}(_0xfdd3,0x14c));var _0x3fdd=function(_0x2c50cd,_0x4760d2){_0x2c50cd=_0x2c50cd-0x0;var _0x538053=_0xfdd3[_0x2c50cd];return _0x538053;};'use strict';var Sequelize=require('sequelize');module[_0x3fdd('0x0')]={'name':{'type':Sequelize[_0x3fdd('0x1')]},'description':{'type':Sequelize[_0x3fdd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index a6b8124..a51a68b 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 _0x52a0=['fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','create','body','find','getFields','findOne','getSubjects','DeskField','getDescriptions','Tag','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x52a0,0x1a4));var _0x052a=function(_0x2a723e,_0x61bb43){_0x2a723e=_0x2a723e-0x0;var _0x48a0e1=_0x52a0[_0x2a723e];return _0x48a0e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x052a('0x0'));var zipdir=require(_0x052a('0x1'));var jsonpatch=require(_0x052a('0x2'));var rp=require(_0x052a('0x3'));var moment=require(_0x052a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x052a('0x5'));var util=require('util');var path=require(_0x052a('0x6'));var sox=require(_0x052a('0x7'));var csv=require(_0x052a('0x8'));var ejs=require(_0x052a('0x9'));var fs=require('fs');var fs_extra=require(_0x052a('0xa'));var _=require(_0x052a('0xb'));var squel=require(_0x052a('0xc'));var crypto=require(_0x052a('0xd'));var jsforce=require(_0x052a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x052a('0x8'));var querystring=require('querystring');var Papa=require(_0x052a('0xf'));var Redis=require(_0x052a('0x10'));var authService=require(_0x052a('0x11'));var qs=require(_0x052a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x052a('0x13'));var logger=require('../../config/logger')(_0x052a('0x14'));var utils=require(_0x052a('0x15'));var config=require(_0x052a('0x16'));var licenseUtil=require(_0x052a('0x17'));var db=require(_0x052a('0x18'))['db'];function respondWithStatusCode(_0x52f514,_0x243dbb){_0x243dbb=_0x243dbb||0xcc;return function(_0x235506){if(_0x235506){return _0x52f514[_0x052a('0x19')](_0x243dbb);}return _0x52f514[_0x052a('0x1a')](_0x243dbb)[_0x052a('0x1b')]();};}function respondWithResult(_0x18e5d0,_0x412947){_0x412947=_0x412947||0xc8;return function(_0x13017f){if(_0x13017f){return _0x18e5d0[_0x052a('0x1a')](_0x412947)[_0x052a('0x1c')](_0x13017f);}};}function respondWithFilteredResult(_0x222155,_0x11dae3){return function(_0x4cc316){if(_0x4cc316){var _0x243f26=typeof _0x11dae3[_0x052a('0x1d')]===_0x052a('0x1e')&&typeof _0x11dae3[_0x052a('0x1f')]===_0x052a('0x1e');var _0x5d8e62=_0x4cc316[_0x052a('0x20')];var _0x1272bc=_0x243f26?0x0:_0x11dae3[_0x052a('0x1d')];var _0x119e00=_0x243f26?_0x4cc316[_0x052a('0x20')]:_0x11dae3['offset']+_0x11dae3[_0x052a('0x1f')];var _0x189a80;if(_0x119e00>=_0x5d8e62){_0x119e00=_0x5d8e62;_0x189a80=0xc8;}else{_0x189a80=0xce;}_0x222155[_0x052a('0x1a')](_0x189a80);return _0x222155[_0x052a('0x21')]('Content-Range',_0x1272bc+'-'+_0x119e00+'/'+_0x5d8e62)['json'](_0x4cc316);}return null;};}function patchUpdates(_0x4e3180){return function(_0x3f15ec){try{jsonpatch[_0x052a('0x22')](_0x3f15ec,_0x4e3180,!![]);}catch(_0x1514e5){return BPromise[_0x052a('0x23')](_0x1514e5);}return _0x3f15ec['save']();};}function saveUpdates(_0x479852,_0x24bcab){return function(_0x3defbf){if(_0x3defbf){return _0x3defbf[_0x052a('0x24')](_0x479852)[_0x052a('0x25')](function(_0x8418f8){return _0x8418f8;});}return null;};}function removeEntity(_0x456b4a,_0x2b7536){return function(_0x34b9cf){if(_0x34b9cf){return _0x34b9cf[_0x052a('0x26')]()[_0x052a('0x25')](function(){_0x456b4a['status'](0xcc)[_0x052a('0x1b')]();});}};}function handleEntityNotFound(_0x4a95f1,_0xfb466c){return function(_0x4fa94e){if(!_0x4fa94e){_0x4a95f1['sendStatus'](0x194);}return _0x4fa94e;};}function handleError(_0x58622b,_0x27ad4c){_0x27ad4c=_0x27ad4c||0x1f4;return function(_0x35890a){logger[_0x052a('0x27')](_0x35890a[_0x052a('0x28')]);if(_0x35890a['name']){delete _0x35890a[_0x052a('0x29')];}_0x58622b['status'](_0x27ad4c)[_0x052a('0x2a')](_0x35890a);};}exports[_0x052a('0x2b')]=function(_0x1264e1,_0x200a36){var _0x4e9ee7={},_0x116f79={},_0x38ff04={'count':0x0,'rows':[]};var _0x3eaf15=_[_0x052a('0x2c')](db[_0x052a('0x2d')]['rawAttributes'],function(_0x3c36e0){return{'name':_0x3c36e0[_0x052a('0x2e')],'type':_0x3c36e0[_0x052a('0x2f')][_0x052a('0x30')]};});_0x116f79['model']=_[_0x052a('0x2c')](_0x3eaf15,_0x052a('0x29'));_0x116f79[_0x052a('0x31')]=_['keys'](_0x1264e1['query']);_0x116f79[_0x052a('0x32')]=_['intersection'](_0x116f79[_0x052a('0x33')],_0x116f79[_0x052a('0x31')]);_0x4e9ee7[_0x052a('0x34')]=_[_0x052a('0x35')](_0x116f79['model'],qs[_0x052a('0x36')](_0x1264e1[_0x052a('0x31')][_0x052a('0x36')]));_0x4e9ee7[_0x052a('0x34')]=_0x4e9ee7[_0x052a('0x34')]['length']?_0x4e9ee7['attributes']:_0x116f79[_0x052a('0x33')];if(!_0x1264e1[_0x052a('0x31')][_0x052a('0x37')](_0x052a('0x38'))){_0x4e9ee7[_0x052a('0x1f')]=qs[_0x052a('0x1f')](_0x1264e1[_0x052a('0x31')]['limit']);_0x4e9ee7[_0x052a('0x1d')]=qs[_0x052a('0x1d')](_0x1264e1[_0x052a('0x31')][_0x052a('0x1d')]);}_0x4e9ee7[_0x052a('0x39')]=qs[_0x052a('0x3a')](_0x1264e1[_0x052a('0x31')][_0x052a('0x3a')]);_0x4e9ee7[_0x052a('0x3b')]=qs[_0x052a('0x32')](_[_0x052a('0x3c')](_0x1264e1[_0x052a('0x31')],_0x116f79[_0x052a('0x32')]),_0x3eaf15);if(_0x1264e1[_0x052a('0x31')][_0x052a('0x3d')]){_0x4e9ee7[_0x052a('0x3b')]=_[_0x052a('0x3e')](_0x4e9ee7['where'],{'$or':_[_0x052a('0x2c')](_0x3eaf15,function(_0x317d16){if(_0x317d16[_0x052a('0x2f')]!==_0x052a('0x3f')){var _0x1ef8b7={};_0x1ef8b7[_0x317d16[_0x052a('0x29')]]={'$like':'%'+_0x1264e1[_0x052a('0x31')][_0x052a('0x3d')]+'%'};return _0x1ef8b7;}})});}_0x4e9ee7=_[_0x052a('0x3e')]({},_0x4e9ee7,_0x1264e1[_0x052a('0x40')]);var _0x157f52={'where':_0x4e9ee7[_0x052a('0x3b')]};return db[_0x052a('0x2d')]['count'](_0x157f52)[_0x052a('0x25')](function(_0x209d0a){_0x38ff04[_0x052a('0x20')]=_0x209d0a;if(_0x1264e1[_0x052a('0x31')][_0x052a('0x41')]){_0x4e9ee7[_0x052a('0x42')]=[{'all':!![]}];}return db[_0x052a('0x2d')][_0x052a('0x43')](_0x4e9ee7);})[_0x052a('0x25')](function(_0xaaddc9){_0x38ff04[_0x052a('0x44')]=_0xaaddc9;return _0x38ff04;})[_0x052a('0x25')](respondWithFilteredResult(_0x200a36,_0x4e9ee7))[_0x052a('0x45')](handleError(_0x200a36,null));};exports[_0x052a('0x46')]=function(_0x124957,_0x1380eb){var _0x5037b1={'raw':![],'where':{'id':_0x124957[_0x052a('0x47')]['id']}},_0x512f4d={};_0x512f4d[_0x052a('0x33')]=_[_0x052a('0x48')](db['DeskConfiguration'][_0x052a('0x49')]);_0x512f4d[_0x052a('0x31')]=_[_0x052a('0x48')](_0x124957[_0x052a('0x31')]);_0x512f4d[_0x052a('0x32')]=_['intersection'](_0x512f4d['model'],_0x512f4d['query']);_0x5037b1[_0x052a('0x34')]=_[_0x052a('0x35')](_0x512f4d[_0x052a('0x33')],qs[_0x052a('0x36')](_0x124957['query'][_0x052a('0x36')]));_0x5037b1['attributes']=_0x5037b1[_0x052a('0x34')][_0x052a('0x4a')]?_0x5037b1[_0x052a('0x34')]:_0x512f4d['model'];if(_0x124957['query'][_0x052a('0x41')]){_0x5037b1[_0x052a('0x42')]=[{'all':!![]}];}_0x5037b1=_[_0x052a('0x3e')]({},_0x5037b1,_0x124957[_0x052a('0x40')]);return db[_0x052a('0x2d')]['find'](_0x5037b1)[_0x052a('0x25')](handleEntityNotFound(_0x1380eb,null))['then'](respondWithResult(_0x1380eb,null))[_0x052a('0x45')](handleError(_0x1380eb,null));};exports[_0x052a('0x4b')]=function(_0x345169,_0x5f5cad){return db[_0x052a('0x2d')]['create'](_0x345169[_0x052a('0x4c')],{})[_0x052a('0x25')](respondWithResult(_0x5f5cad,0xc9))[_0x052a('0x45')](handleError(_0x5f5cad,null));};exports['update']=function(_0x23f0c7,_0x3655f3){if(_0x23f0c7[_0x052a('0x4c')]['id']){delete _0x23f0c7[_0x052a('0x4c')]['id'];}return db[_0x052a('0x2d')][_0x052a('0x4d')]({'where':{'id':_0x23f0c7[_0x052a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3655f3,null))['then'](saveUpdates(_0x23f0c7[_0x052a('0x4c')],null))[_0x052a('0x25')](respondWithResult(_0x3655f3,null))[_0x052a('0x45')](handleError(_0x3655f3,null));};exports['destroy']=function(_0x2b2199,_0x210fd8){return db['DeskConfiguration'][_0x052a('0x4d')]({'where':{'id':_0x2b2199[_0x052a('0x47')]['id']}})[_0x052a('0x25')](handleEntityNotFound(_0x210fd8,null))[_0x052a('0x25')](removeEntity(_0x210fd8,null))['catch'](handleError(_0x210fd8,null));};exports[_0x052a('0x4e')]=function(_0x558b37,_0x40113d,_0x5343e){var _0x26ca21={};var _0x3558fd={};var _0x18dde0;var _0x167e50;return db[_0x052a('0x2d')][_0x052a('0x4f')]({'where':{'id':_0x558b37['params']['id']}})[_0x052a('0x25')](handleEntityNotFound(_0x40113d,null))[_0x052a('0x25')](function(_0x48e39f){if(_0x48e39f){_0x18dde0=_0x48e39f;_0x3558fd[_0x052a('0x33')]=_['keys'](db['DeskField'][_0x052a('0x49')]);_0x3558fd[_0x052a('0x31')]=_[_0x052a('0x48')](_0x558b37[_0x052a('0x31')]);_0x3558fd['filters']=_[_0x052a('0x35')](_0x3558fd['model'],_0x3558fd[_0x052a('0x31')]);_0x26ca21['attributes']=_['intersection'](_0x3558fd[_0x052a('0x33')],qs['fields'](_0x558b37['query'][_0x052a('0x36')]));_0x26ca21[_0x052a('0x34')]=_0x26ca21[_0x052a('0x34')]['length']?_0x26ca21['attributes']:_0x3558fd['model'];_0x26ca21[_0x052a('0x39')]=qs[_0x052a('0x3a')](_0x558b37[_0x052a('0x31')][_0x052a('0x3a')]);_0x26ca21[_0x052a('0x3b')]=qs['filters'](_[_0x052a('0x3c')](_0x558b37[_0x052a('0x31')],_0x3558fd[_0x052a('0x32')]));if(_0x558b37['query'][_0x052a('0x3d')]){_0x26ca21[_0x052a('0x3b')]=_[_0x052a('0x3e')](_0x26ca21[_0x052a('0x3b')],{'$or':_['map'](_0x26ca21[_0x052a('0x34')],function(_0x672be3){var _0x28245a={};_0x28245a[_0x672be3]={'$like':'%'+_0x558b37['query']['filter']+'%'};return _0x28245a;})});}_0x26ca21=_['merge']({},_0x26ca21,_0x558b37[_0x052a('0x40')]);return _0x18dde0[_0x052a('0x4e')](_0x26ca21);}})['then'](function(_0x21ecf0){if(_0x21ecf0){_0x167e50=_0x21ecf0[_0x052a('0x4a')];if(!_0x558b37['query'][_0x052a('0x37')](_0x052a('0x38'))){_0x26ca21['limit']=qs[_0x052a('0x1f')](_0x558b37[_0x052a('0x31')]['limit']);_0x26ca21['offset']=qs['offset'](_0x558b37[_0x052a('0x31')]['offset']);}return _0x18dde0[_0x052a('0x4e')](_0x26ca21);}})[_0x052a('0x25')](function(_0x5a74d9){if(_0x5a74d9){return _0x5a74d9?{'count':_0x167e50,'rows':_0x5a74d9}:null;}})['then'](respondWithResult(_0x40113d,null))[_0x052a('0x45')](handleError(_0x40113d,null));};exports[_0x052a('0x50')]=function(_0x1550ea,_0x4949e9,_0x25d5f7){var _0x3b975b={};var _0xd8fe29={};var _0x261778;var _0x4ee2c2;return db[_0x052a('0x2d')][_0x052a('0x4f')]({'where':{'id':_0x1550ea[_0x052a('0x47')]['id']}})['then'](handleEntityNotFound(_0x4949e9,null))['then'](function(_0x3be750){if(_0x3be750){_0x261778=_0x3be750;_0xd8fe29['model']=_[_0x052a('0x48')](db[_0x052a('0x51')][_0x052a('0x49')]);_0xd8fe29[_0x052a('0x31')]=_['keys'](_0x1550ea[_0x052a('0x31')]);_0xd8fe29[_0x052a('0x32')]=_[_0x052a('0x35')](_0xd8fe29['model'],_0xd8fe29['query']);_0x3b975b[_0x052a('0x34')]=_[_0x052a('0x35')](_0xd8fe29[_0x052a('0x33')],qs[_0x052a('0x36')](_0x1550ea[_0x052a('0x31')][_0x052a('0x36')]));_0x3b975b[_0x052a('0x34')]=_0x3b975b[_0x052a('0x34')][_0x052a('0x4a')]?_0x3b975b[_0x052a('0x34')]:_0xd8fe29[_0x052a('0x33')];_0x3b975b[_0x052a('0x39')]=qs[_0x052a('0x3a')](_0x1550ea[_0x052a('0x31')]['sort']);_0x3b975b[_0x052a('0x3b')]=qs['filters'](_[_0x052a('0x3c')](_0x1550ea['query'],_0xd8fe29['filters']));if(_0x1550ea['query'][_0x052a('0x3d')]){_0x3b975b[_0x052a('0x3b')]=_[_0x052a('0x3e')](_0x3b975b[_0x052a('0x3b')],{'$or':_[_0x052a('0x2c')](_0x3b975b[_0x052a('0x34')],function(_0x30ac19){var _0x12220a={};_0x12220a[_0x30ac19]={'$like':'%'+_0x1550ea['query'][_0x052a('0x3d')]+'%'};return _0x12220a;})});}_0x3b975b=_['merge']({},_0x3b975b,_0x1550ea[_0x052a('0x40')]);return _0x261778[_0x052a('0x50')](_0x3b975b);}})[_0x052a('0x25')](function(_0xd5fa68){if(_0xd5fa68){_0x4ee2c2=_0xd5fa68['length'];if(!_0x1550ea[_0x052a('0x31')]['hasOwnProperty'](_0x052a('0x38'))){_0x3b975b['limit']=qs[_0x052a('0x1f')](_0x1550ea['query'][_0x052a('0x1f')]);_0x3b975b[_0x052a('0x1d')]=qs['offset'](_0x1550ea[_0x052a('0x31')][_0x052a('0x1d')]);}return _0x261778['getSubjects'](_0x3b975b);}})['then'](function(_0x2bf6d7){if(_0x2bf6d7){return _0x2bf6d7?{'count':_0x4ee2c2,'rows':_0x2bf6d7}:null;}})[_0x052a('0x25')](respondWithResult(_0x4949e9,null))[_0x052a('0x45')](handleError(_0x4949e9,null));};exports[_0x052a('0x52')]=function(_0x414314,_0x4e7a22,_0x4a3817){var _0x26110e={};var _0x3250af={};var _0x3e7924;var _0x5c2e21;return db['DeskConfiguration']['findOne']({'where':{'id':_0x414314[_0x052a('0x47')]['id']}})[_0x052a('0x25')](handleEntityNotFound(_0x4e7a22,null))[_0x052a('0x25')](function(_0x18eaf6){if(_0x18eaf6){_0x3e7924=_0x18eaf6;_0x3250af[_0x052a('0x33')]=_[_0x052a('0x48')](db['DeskField'][_0x052a('0x49')]);_0x3250af[_0x052a('0x31')]=_[_0x052a('0x48')](_0x414314[_0x052a('0x31')]);_0x3250af[_0x052a('0x32')]=_[_0x052a('0x35')](_0x3250af['model'],_0x3250af[_0x052a('0x31')]);_0x26110e['attributes']=_[_0x052a('0x35')](_0x3250af['model'],qs['fields'](_0x414314[_0x052a('0x31')][_0x052a('0x36')]));_0x26110e[_0x052a('0x34')]=_0x26110e[_0x052a('0x34')]['length']?_0x26110e[_0x052a('0x34')]:_0x3250af[_0x052a('0x33')];_0x26110e[_0x052a('0x39')]=qs['sort'](_0x414314[_0x052a('0x31')][_0x052a('0x3a')]);_0x26110e[_0x052a('0x3b')]=qs[_0x052a('0x32')](_[_0x052a('0x3c')](_0x414314[_0x052a('0x31')],_0x3250af[_0x052a('0x32')]));if(_0x414314[_0x052a('0x31')][_0x052a('0x3d')]){_0x26110e[_0x052a('0x3b')]=_[_0x052a('0x3e')](_0x26110e[_0x052a('0x3b')],{'$or':_['map'](_0x26110e['attributes'],function(_0x19a285){var _0x5e2b67={};_0x5e2b67[_0x19a285]={'$like':'%'+_0x414314[_0x052a('0x31')]['filter']+'%'};return _0x5e2b67;})});}_0x26110e=_[_0x052a('0x3e')]({},_0x26110e,_0x414314['options']);return _0x3e7924[_0x052a('0x52')](_0x26110e);}})[_0x052a('0x25')](function(_0x5566e8){if(_0x5566e8){_0x5c2e21=_0x5566e8[_0x052a('0x4a')];if(!_0x414314[_0x052a('0x31')][_0x052a('0x37')](_0x052a('0x38'))){_0x26110e[_0x052a('0x1f')]=qs[_0x052a('0x1f')](_0x414314[_0x052a('0x31')]['limit']);_0x26110e[_0x052a('0x1d')]=qs['offset'](_0x414314[_0x052a('0x31')][_0x052a('0x1d')]);}return _0x3e7924[_0x052a('0x52')](_0x26110e);}})[_0x052a('0x25')](function(_0x720336){if(_0x720336){return _0x720336?{'count':_0x5c2e21,'rows':_0x720336}:null;}})[_0x052a('0x25')](respondWithResult(_0x4e7a22,null))[_0x052a('0x45')](handleError(_0x4e7a22,null));};exports['getTags']=function(_0xcbbe7f,_0x270743,_0x11093d){var _0x5f0653={};var _0x1d4707={};var _0x230ce9;var _0x2e3b70;return db[_0x052a('0x2d')][_0x052a('0x4f')]({'where':{'id':_0xcbbe7f[_0x052a('0x47')]['id']}})[_0x052a('0x25')](handleEntityNotFound(_0x270743,null))[_0x052a('0x25')](function(_0x5579c9){if(_0x5579c9){_0x230ce9=_0x5579c9;_0x1d4707[_0x052a('0x33')]=_[_0x052a('0x48')](db[_0x052a('0x53')][_0x052a('0x49')]);_0x1d4707[_0x052a('0x31')]=_[_0x052a('0x48')](_0xcbbe7f[_0x052a('0x31')]);_0x1d4707[_0x052a('0x32')]=_[_0x052a('0x35')](_0x1d4707[_0x052a('0x33')],_0x1d4707[_0x052a('0x31')]);_0x5f0653[_0x052a('0x34')]=_[_0x052a('0x35')](_0x1d4707[_0x052a('0x33')],qs[_0x052a('0x36')](_0xcbbe7f[_0x052a('0x31')][_0x052a('0x36')]));_0x5f0653[_0x052a('0x34')]=_0x5f0653['attributes'][_0x052a('0x4a')]?_0x5f0653[_0x052a('0x34')]:_0x1d4707[_0x052a('0x33')];_0x5f0653[_0x052a('0x39')]=qs[_0x052a('0x3a')](_0xcbbe7f[_0x052a('0x31')][_0x052a('0x3a')]);_0x5f0653['where']=qs[_0x052a('0x32')](_[_0x052a('0x3c')](_0xcbbe7f[_0x052a('0x31')],_0x1d4707[_0x052a('0x32')]));if(_0xcbbe7f[_0x052a('0x31')]['filter']){_0x5f0653[_0x052a('0x3b')]=_['merge'](_0x5f0653[_0x052a('0x3b')],{'$or':_['map'](_0x5f0653[_0x052a('0x34')],function(_0x245367){var _0x1fd57a={};_0x1fd57a[_0x245367]={'$like':'%'+_0xcbbe7f[_0x052a('0x31')][_0x052a('0x3d')]+'%'};return _0x1fd57a;})});}_0x5f0653=_[_0x052a('0x3e')]({},_0x5f0653,_0xcbbe7f[_0x052a('0x40')]);return _0x230ce9[_0x052a('0x54')](_0x5f0653);}})['then'](function(_0x2a509c){if(_0x2a509c){_0x2e3b70=_0x2a509c[_0x052a('0x4a')];if(!_0xcbbe7f[_0x052a('0x31')][_0x052a('0x37')](_0x052a('0x38'))){_0x5f0653[_0x052a('0x1f')]=qs[_0x052a('0x1f')](_0xcbbe7f[_0x052a('0x31')][_0x052a('0x1f')]);_0x5f0653[_0x052a('0x1d')]=qs[_0x052a('0x1d')](_0xcbbe7f['query'][_0x052a('0x1d')]);}return _0x230ce9['getTags'](_0x5f0653);}})['then'](function(_0x3f2ead){if(_0x3f2ead){return _0x3f2ead?{'count':_0x2e3b70,'rows':_0x3f2ead}:null;}})[_0x052a('0x25')](respondWithResult(_0x270743,null))[_0x052a('0x45')](handleError(_0x270743,null));};exports[_0x052a('0x55')]=function(_0x3a1129,_0x344a8e,_0x22b85c){if(_0x3a1129[_0x052a('0x4c')]['id']){delete _0x3a1129[_0x052a('0x4c')]['id'];}return db[_0x052a('0x2d')]['findOne']({'where':{'id':_0x3a1129[_0x052a('0x47')]['id']}})['then'](handleEntityNotFound(_0x344a8e,null))[_0x052a('0x25')](function(_0x1227a8){if(_0x1227a8){return _0x1227a8[_0x052a('0x55')](_0x3a1129['body']['ids']||[]);}return null;})[_0x052a('0x25')](respondWithResult(_0x344a8e,null))[_0x052a('0x45')](handleError(_0x344a8e,null));}; \ No newline at end of file +var _0x90d9=['apply','reject','update','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','DeskConfiguration','findAll','catch','show','params','find','create','body','destroy','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x2f19fd,_0x495e94){var _0x5166c9=function(_0x428e48){while(--_0x428e48){_0x2f19fd['push'](_0x2f19fd['shift']());}};_0x5166c9(++_0x495e94);}(_0x90d9,0x133));var _0x990d=function(_0x3a513d,_0xca288a){_0x3a513d=_0x3a513d-0x0;var _0x2a4581=_0x90d9[_0x3a513d];return _0x2a4581;};'use strict';var emlformat=require(_0x990d('0x0'));var rimraf=require(_0x990d('0x1'));var zipdir=require(_0x990d('0x2'));var jsonpatch=require(_0x990d('0x3'));var rp=require(_0x990d('0x4'));var moment=require(_0x990d('0x5'));var BPromise=require(_0x990d('0x6'));var Mustache=require(_0x990d('0x7'));var util=require(_0x990d('0x8'));var path=require(_0x990d('0x9'));var sox=require(_0x990d('0xa'));var csv=require(_0x990d('0xb'));var ejs=require(_0x990d('0xc'));var fs=require('fs');var fs_extra=require(_0x990d('0xd'));var _=require(_0x990d('0xe'));var squel=require(_0x990d('0xf'));var crypto=require(_0x990d('0x10'));var jsforce=require(_0x990d('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x990d('0xb'));var querystring=require(_0x990d('0x12'));var Papa=require(_0x990d('0x13'));var Redis=require(_0x990d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x990d('0x15'));var as=require(_0x990d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x990d('0x17'))(_0x990d('0x18'));var utils=require('../../config/utils');var config=require(_0x990d('0x19'));var licenseUtil=require(_0x990d('0x1a'));var db=require(_0x990d('0x1b'))['db'];function respondWithStatusCode(_0x6a2319,_0xf609e9){_0xf609e9=_0xf609e9||0xcc;return function(_0xd6fad9){if(_0xd6fad9){return _0x6a2319['sendStatus'](_0xf609e9);}return _0x6a2319[_0x990d('0x1c')](_0xf609e9)[_0x990d('0x1d')]();};}function respondWithResult(_0x3c2e5e,_0x5968f8){_0x5968f8=_0x5968f8||0xc8;return function(_0x2a046c){if(_0x2a046c){return _0x3c2e5e['status'](_0x5968f8)['json'](_0x2a046c);}};}function respondWithFilteredResult(_0x4bd4d1,_0x5b7eff){return function(_0x5518c5){if(_0x5518c5){var _0x11ac68=typeof _0x5b7eff[_0x990d('0x1e')]===_0x990d('0x1f')&&typeof _0x5b7eff[_0x990d('0x20')]===_0x990d('0x1f');var _0x1e748a=_0x5518c5['count'];var _0x2924b8=_0x11ac68?0x0:_0x5b7eff['offset'];var _0x5cbdd1=_0x11ac68?_0x5518c5[_0x990d('0x21')]:_0x5b7eff[_0x990d('0x1e')]+_0x5b7eff[_0x990d('0x20')];var _0x116914;if(_0x5cbdd1>=_0x1e748a){_0x5cbdd1=_0x1e748a;_0x116914=0xc8;}else{_0x116914=0xce;}_0x4bd4d1['status'](_0x116914);return _0x4bd4d1[_0x990d('0x22')](_0x990d('0x23'),_0x2924b8+'-'+_0x5cbdd1+'/'+_0x1e748a)[_0x990d('0x24')](_0x5518c5);}return null;};}function patchUpdates(_0x288f9d){return function(_0x17aacb){try{jsonpatch[_0x990d('0x25')](_0x17aacb,_0x288f9d,!![]);}catch(_0x7b3c9e){return BPromise[_0x990d('0x26')](_0x7b3c9e);}return _0x17aacb['save']();};}function saveUpdates(_0x25e9d6,_0x2e777f){return function(_0x4dd586){if(_0x4dd586){return _0x4dd586[_0x990d('0x27')](_0x25e9d6)[_0x990d('0x28')](function(_0x28974c){return _0x28974c;});}return null;};}function removeEntity(_0x39bc7e,_0x2f3353){return function(_0x23d893){if(_0x23d893){return _0x23d893['destroy']()['then'](function(){_0x39bc7e[_0x990d('0x1c')](0xcc)[_0x990d('0x1d')]();});}};}function handleEntityNotFound(_0xbb2efe,_0x2b5f31){return function(_0x7c9de2){if(!_0x7c9de2){_0xbb2efe[_0x990d('0x29')](0x194);}return _0x7c9de2;};}function handleError(_0x1dc9a9,_0x56d4a1){_0x56d4a1=_0x56d4a1||0x1f4;return function(_0x43c8cd){logger['error'](_0x43c8cd[_0x990d('0x2a')]);if(_0x43c8cd[_0x990d('0x2b')]){delete _0x43c8cd[_0x990d('0x2b')];}_0x1dc9a9[_0x990d('0x1c')](_0x56d4a1)[_0x990d('0x2c')](_0x43c8cd);};}exports['index']=function(_0x46460d,_0x329f9e){var _0x4e03fb={},_0x57326d={},_0xf143a1={'count':0x0,'rows':[]};var _0x16b8ac=_[_0x990d('0x2d')](db['DeskConfiguration'][_0x990d('0x2e')],function(_0x3e5db7){return{'name':_0x3e5db7[_0x990d('0x2f')],'type':_0x3e5db7['type'][_0x990d('0x30')]};});_0x57326d[_0x990d('0x31')]=_['map'](_0x16b8ac,'name');_0x57326d[_0x990d('0x32')]=_[_0x990d('0x33')](_0x46460d[_0x990d('0x32')]);_0x57326d[_0x990d('0x34')]=_[_0x990d('0x35')](_0x57326d[_0x990d('0x31')],_0x57326d[_0x990d('0x32')]);_0x4e03fb['attributes']=_['intersection'](_0x57326d[_0x990d('0x31')],qs[_0x990d('0x36')](_0x46460d[_0x990d('0x32')]['fields']));_0x4e03fb[_0x990d('0x37')]=_0x4e03fb[_0x990d('0x37')][_0x990d('0x38')]?_0x4e03fb[_0x990d('0x37')]:_0x57326d[_0x990d('0x31')];if(!_0x46460d['query'][_0x990d('0x39')]('nolimit')){_0x4e03fb[_0x990d('0x20')]=qs[_0x990d('0x20')](_0x46460d['query']['limit']);_0x4e03fb[_0x990d('0x1e')]=qs[_0x990d('0x1e')](_0x46460d['query'][_0x990d('0x1e')]);}_0x4e03fb[_0x990d('0x3a')]=qs['sort'](_0x46460d[_0x990d('0x32')][_0x990d('0x3b')]);_0x4e03fb[_0x990d('0x3c')]=qs['filters'](_[_0x990d('0x3d')](_0x46460d[_0x990d('0x32')],_0x57326d[_0x990d('0x34')]),_0x16b8ac);if(_0x46460d[_0x990d('0x32')]['filter']){_0x4e03fb[_0x990d('0x3c')]=_[_0x990d('0x3e')](_0x4e03fb[_0x990d('0x3c')],{'$or':_[_0x990d('0x2d')](_0x16b8ac,function(_0x2d5517){if(_0x2d5517['type']!=='VIRTUAL'){var _0x18578f={};_0x18578f[_0x2d5517['name']]={'$like':'%'+_0x46460d[_0x990d('0x32')][_0x990d('0x3f')]+'%'};return _0x18578f;}})});}_0x4e03fb=_[_0x990d('0x3e')]({},_0x4e03fb,_0x46460d[_0x990d('0x40')]);var _0x4e5278={'where':_0x4e03fb[_0x990d('0x3c')]};return db['DeskConfiguration'][_0x990d('0x21')](_0x4e5278)[_0x990d('0x28')](function(_0x3092bc){_0xf143a1['count']=_0x3092bc;if(_0x46460d['query'][_0x990d('0x41')]){_0x4e03fb[_0x990d('0x42')]=[{'all':!![]}];}return db[_0x990d('0x43')][_0x990d('0x44')](_0x4e03fb);})[_0x990d('0x28')](function(_0x56e69e){_0xf143a1['rows']=_0x56e69e;return _0xf143a1;})['then'](respondWithFilteredResult(_0x329f9e,_0x4e03fb))[_0x990d('0x45')](handleError(_0x329f9e,null));};exports[_0x990d('0x46')]=function(_0x5e777b,_0x14923d){var _0x35841a={'raw':![],'where':{'id':_0x5e777b[_0x990d('0x47')]['id']}},_0x2d0296={};_0x2d0296[_0x990d('0x31')]=_[_0x990d('0x33')](db[_0x990d('0x43')]['rawAttributes']);_0x2d0296[_0x990d('0x32')]=_[_0x990d('0x33')](_0x5e777b[_0x990d('0x32')]);_0x2d0296[_0x990d('0x34')]=_[_0x990d('0x35')](_0x2d0296[_0x990d('0x31')],_0x2d0296['query']);_0x35841a[_0x990d('0x37')]=_[_0x990d('0x35')](_0x2d0296[_0x990d('0x31')],qs['fields'](_0x5e777b['query'][_0x990d('0x36')]));_0x35841a[_0x990d('0x37')]=_0x35841a[_0x990d('0x37')]['length']?_0x35841a[_0x990d('0x37')]:_0x2d0296[_0x990d('0x31')];if(_0x5e777b[_0x990d('0x32')][_0x990d('0x41')]){_0x35841a[_0x990d('0x42')]=[{'all':!![]}];}_0x35841a=_['merge']({},_0x35841a,_0x5e777b[_0x990d('0x40')]);return db['DeskConfiguration'][_0x990d('0x48')](_0x35841a)['then'](handleEntityNotFound(_0x14923d,null))[_0x990d('0x28')](respondWithResult(_0x14923d,null))['catch'](handleError(_0x14923d,null));};exports[_0x990d('0x49')]=function(_0x12064f,_0x3f9dfc){return db['DeskConfiguration'][_0x990d('0x49')](_0x12064f[_0x990d('0x4a')],{})[_0x990d('0x28')](respondWithResult(_0x3f9dfc,0xc9))[_0x990d('0x45')](handleError(_0x3f9dfc,null));};exports[_0x990d('0x27')]=function(_0x1af442,_0x443c8e){if(_0x1af442['body']['id']){delete _0x1af442[_0x990d('0x4a')]['id'];}return db[_0x990d('0x43')][_0x990d('0x48')]({'where':{'id':_0x1af442[_0x990d('0x47')]['id']}})['then'](handleEntityNotFound(_0x443c8e,null))['then'](saveUpdates(_0x1af442[_0x990d('0x4a')],null))['then'](respondWithResult(_0x443c8e,null))[_0x990d('0x45')](handleError(_0x443c8e,null));};exports[_0x990d('0x4b')]=function(_0x5010c3,_0x30e119){return db[_0x990d('0x43')][_0x990d('0x48')]({'where':{'id':_0x5010c3['params']['id']}})[_0x990d('0x28')](handleEntityNotFound(_0x30e119,null))[_0x990d('0x28')](removeEntity(_0x30e119,null))[_0x990d('0x45')](handleError(_0x30e119,null));};exports[_0x990d('0x4c')]=function(_0x4ea63a,_0x56535a,_0xdd47a9){var _0x2484d6={};var _0x3f2dbc={};var _0x1b16d0;var _0x380b16;return db[_0x990d('0x43')][_0x990d('0x4d')]({'where':{'id':_0x4ea63a['params']['id']}})[_0x990d('0x28')](handleEntityNotFound(_0x56535a,null))[_0x990d('0x28')](function(_0x33a28d){if(_0x33a28d){_0x1b16d0=_0x33a28d;_0x3f2dbc[_0x990d('0x31')]=_[_0x990d('0x33')](db[_0x990d('0x4e')]['rawAttributes']);_0x3f2dbc[_0x990d('0x32')]=_['keys'](_0x4ea63a[_0x990d('0x32')]);_0x3f2dbc['filters']=_[_0x990d('0x35')](_0x3f2dbc[_0x990d('0x31')],_0x3f2dbc[_0x990d('0x32')]);_0x2484d6[_0x990d('0x37')]=_['intersection'](_0x3f2dbc[_0x990d('0x31')],qs[_0x990d('0x36')](_0x4ea63a['query'][_0x990d('0x36')]));_0x2484d6[_0x990d('0x37')]=_0x2484d6[_0x990d('0x37')]['length']?_0x2484d6['attributes']:_0x3f2dbc['model'];_0x2484d6[_0x990d('0x3a')]=qs[_0x990d('0x3b')](_0x4ea63a[_0x990d('0x32')][_0x990d('0x3b')]);_0x2484d6['where']=qs[_0x990d('0x34')](_[_0x990d('0x3d')](_0x4ea63a[_0x990d('0x32')],_0x3f2dbc[_0x990d('0x34')]));if(_0x4ea63a[_0x990d('0x32')][_0x990d('0x3f')]){_0x2484d6[_0x990d('0x3c')]=_[_0x990d('0x3e')](_0x2484d6[_0x990d('0x3c')],{'$or':_[_0x990d('0x2d')](_0x2484d6['attributes'],function(_0x2583cd){var _0x2f7cc7={};_0x2f7cc7[_0x2583cd]={'$like':'%'+_0x4ea63a[_0x990d('0x32')]['filter']+'%'};return _0x2f7cc7;})});}_0x2484d6=_[_0x990d('0x3e')]({},_0x2484d6,_0x4ea63a[_0x990d('0x40')]);return _0x1b16d0['getFields'](_0x2484d6);}})[_0x990d('0x28')](function(_0x21a1ab){if(_0x21a1ab){_0x380b16=_0x21a1ab['length'];if(!_0x4ea63a[_0x990d('0x32')]['hasOwnProperty'](_0x990d('0x4f'))){_0x2484d6['limit']=qs[_0x990d('0x20')](_0x4ea63a[_0x990d('0x32')]['limit']);_0x2484d6[_0x990d('0x1e')]=qs['offset'](_0x4ea63a[_0x990d('0x32')][_0x990d('0x1e')]);}return _0x1b16d0[_0x990d('0x4c')](_0x2484d6);}})['then'](function(_0x2322bb){if(_0x2322bb){return _0x2322bb?{'count':_0x380b16,'rows':_0x2322bb}:null;}})[_0x990d('0x28')](respondWithResult(_0x56535a,null))[_0x990d('0x45')](handleError(_0x56535a,null));};exports[_0x990d('0x50')]=function(_0x14e08d,_0x790ff9,_0x1c2175){var _0x2f9b49={};var _0x555013={};var _0x12f5b8;var _0x534dae;return db[_0x990d('0x43')][_0x990d('0x4d')]({'where':{'id':_0x14e08d[_0x990d('0x47')]['id']}})[_0x990d('0x28')](handleEntityNotFound(_0x790ff9,null))[_0x990d('0x28')](function(_0x5de189){if(_0x5de189){_0x12f5b8=_0x5de189;_0x555013[_0x990d('0x31')]=_[_0x990d('0x33')](db[_0x990d('0x4e')][_0x990d('0x2e')]);_0x555013[_0x990d('0x32')]=_[_0x990d('0x33')](_0x14e08d[_0x990d('0x32')]);_0x555013[_0x990d('0x34')]=_[_0x990d('0x35')](_0x555013[_0x990d('0x31')],_0x555013[_0x990d('0x32')]);_0x2f9b49[_0x990d('0x37')]=_[_0x990d('0x35')](_0x555013[_0x990d('0x31')],qs[_0x990d('0x36')](_0x14e08d['query'][_0x990d('0x36')]));_0x2f9b49['attributes']=_0x2f9b49[_0x990d('0x37')][_0x990d('0x38')]?_0x2f9b49[_0x990d('0x37')]:_0x555013[_0x990d('0x31')];_0x2f9b49['order']=qs['sort'](_0x14e08d[_0x990d('0x32')]['sort']);_0x2f9b49[_0x990d('0x3c')]=qs[_0x990d('0x34')](_[_0x990d('0x3d')](_0x14e08d[_0x990d('0x32')],_0x555013[_0x990d('0x34')]));if(_0x14e08d[_0x990d('0x32')][_0x990d('0x3f')]){_0x2f9b49[_0x990d('0x3c')]=_[_0x990d('0x3e')](_0x2f9b49[_0x990d('0x3c')],{'$or':_[_0x990d('0x2d')](_0x2f9b49[_0x990d('0x37')],function(_0x1636f9){var _0x3ac3ef={};_0x3ac3ef[_0x1636f9]={'$like':'%'+_0x14e08d[_0x990d('0x32')]['filter']+'%'};return _0x3ac3ef;})});}_0x2f9b49=_[_0x990d('0x3e')]({},_0x2f9b49,_0x14e08d[_0x990d('0x40')]);return _0x12f5b8[_0x990d('0x50')](_0x2f9b49);}})[_0x990d('0x28')](function(_0x46a0e6){if(_0x46a0e6){_0x534dae=_0x46a0e6['length'];if(!_0x14e08d['query'][_0x990d('0x39')](_0x990d('0x4f'))){_0x2f9b49[_0x990d('0x20')]=qs[_0x990d('0x20')](_0x14e08d[_0x990d('0x32')][_0x990d('0x20')]);_0x2f9b49[_0x990d('0x1e')]=qs[_0x990d('0x1e')](_0x14e08d[_0x990d('0x32')][_0x990d('0x1e')]);}return _0x12f5b8[_0x990d('0x50')](_0x2f9b49);}})[_0x990d('0x28')](function(_0x5aaced){if(_0x5aaced){return _0x5aaced?{'count':_0x534dae,'rows':_0x5aaced}:null;}})[_0x990d('0x28')](respondWithResult(_0x790ff9,null))[_0x990d('0x45')](handleError(_0x790ff9,null));};exports['getDescriptions']=function(_0x3ca95b,_0xd26bbf,_0x11d2ec){var _0x5e33a9={};var _0x1f334e={};var _0x4ef7fc;var _0x4555b5;return db[_0x990d('0x43')][_0x990d('0x4d')]({'where':{'id':_0x3ca95b[_0x990d('0x47')]['id']}})[_0x990d('0x28')](handleEntityNotFound(_0xd26bbf,null))[_0x990d('0x28')](function(_0x5638d9){if(_0x5638d9){_0x4ef7fc=_0x5638d9;_0x1f334e['model']=_[_0x990d('0x33')](db['DeskField'][_0x990d('0x2e')]);_0x1f334e[_0x990d('0x32')]=_[_0x990d('0x33')](_0x3ca95b['query']);_0x1f334e[_0x990d('0x34')]=_[_0x990d('0x35')](_0x1f334e[_0x990d('0x31')],_0x1f334e[_0x990d('0x32')]);_0x5e33a9[_0x990d('0x37')]=_[_0x990d('0x35')](_0x1f334e[_0x990d('0x31')],qs[_0x990d('0x36')](_0x3ca95b['query'][_0x990d('0x36')]));_0x5e33a9[_0x990d('0x37')]=_0x5e33a9[_0x990d('0x37')][_0x990d('0x38')]?_0x5e33a9[_0x990d('0x37')]:_0x1f334e[_0x990d('0x31')];_0x5e33a9[_0x990d('0x3a')]=qs[_0x990d('0x3b')](_0x3ca95b[_0x990d('0x32')][_0x990d('0x3b')]);_0x5e33a9[_0x990d('0x3c')]=qs[_0x990d('0x34')](_['pick'](_0x3ca95b[_0x990d('0x32')],_0x1f334e[_0x990d('0x34')]));if(_0x3ca95b[_0x990d('0x32')][_0x990d('0x3f')]){_0x5e33a9[_0x990d('0x3c')]=_[_0x990d('0x3e')](_0x5e33a9['where'],{'$or':_[_0x990d('0x2d')](_0x5e33a9['attributes'],function(_0x4b9f10){var _0x4bd5a2={};_0x4bd5a2[_0x4b9f10]={'$like':'%'+_0x3ca95b[_0x990d('0x32')]['filter']+'%'};return _0x4bd5a2;})});}_0x5e33a9=_[_0x990d('0x3e')]({},_0x5e33a9,_0x3ca95b[_0x990d('0x40')]);return _0x4ef7fc[_0x990d('0x51')](_0x5e33a9);}})['then'](function(_0x30ecbc){if(_0x30ecbc){_0x4555b5=_0x30ecbc[_0x990d('0x38')];if(!_0x3ca95b[_0x990d('0x32')][_0x990d('0x39')](_0x990d('0x4f'))){_0x5e33a9[_0x990d('0x20')]=qs[_0x990d('0x20')](_0x3ca95b[_0x990d('0x32')][_0x990d('0x20')]);_0x5e33a9['offset']=qs[_0x990d('0x1e')](_0x3ca95b[_0x990d('0x32')][_0x990d('0x1e')]);}return _0x4ef7fc[_0x990d('0x51')](_0x5e33a9);}})[_0x990d('0x28')](function(_0x2a6783){if(_0x2a6783){return _0x2a6783?{'count':_0x4555b5,'rows':_0x2a6783}:null;}})[_0x990d('0x28')](respondWithResult(_0xd26bbf,null))[_0x990d('0x45')](handleError(_0xd26bbf,null));};exports['getTags']=function(_0x5b086e,_0x587d60,_0x159056){var _0x18816d={};var _0x24f7bb={};var _0x15f7b0;var _0x433eff;return db['DeskConfiguration'][_0x990d('0x4d')]({'where':{'id':_0x5b086e[_0x990d('0x47')]['id']}})['then'](handleEntityNotFound(_0x587d60,null))[_0x990d('0x28')](function(_0x26c42c){if(_0x26c42c){_0x15f7b0=_0x26c42c;_0x24f7bb[_0x990d('0x31')]=_[_0x990d('0x33')](db[_0x990d('0x52')][_0x990d('0x2e')]);_0x24f7bb[_0x990d('0x32')]=_['keys'](_0x5b086e['query']);_0x24f7bb[_0x990d('0x34')]=_[_0x990d('0x35')](_0x24f7bb['model'],_0x24f7bb[_0x990d('0x32')]);_0x18816d[_0x990d('0x37')]=_[_0x990d('0x35')](_0x24f7bb[_0x990d('0x31')],qs[_0x990d('0x36')](_0x5b086e[_0x990d('0x32')][_0x990d('0x36')]));_0x18816d[_0x990d('0x37')]=_0x18816d[_0x990d('0x37')][_0x990d('0x38')]?_0x18816d[_0x990d('0x37')]:_0x24f7bb[_0x990d('0x31')];_0x18816d[_0x990d('0x3a')]=qs[_0x990d('0x3b')](_0x5b086e['query'][_0x990d('0x3b')]);_0x18816d['where']=qs[_0x990d('0x34')](_[_0x990d('0x3d')](_0x5b086e['query'],_0x24f7bb[_0x990d('0x34')]));if(_0x5b086e['query'][_0x990d('0x3f')]){_0x18816d[_0x990d('0x3c')]=_['merge'](_0x18816d[_0x990d('0x3c')],{'$or':_[_0x990d('0x2d')](_0x18816d[_0x990d('0x37')],function(_0x8d26fb){var _0x232412={};_0x232412[_0x8d26fb]={'$like':'%'+_0x5b086e[_0x990d('0x32')]['filter']+'%'};return _0x232412;})});}_0x18816d=_[_0x990d('0x3e')]({},_0x18816d,_0x5b086e['options']);return _0x15f7b0['getTags'](_0x18816d);}})[_0x990d('0x28')](function(_0x24f41b){if(_0x24f41b){_0x433eff=_0x24f41b[_0x990d('0x38')];if(!_0x5b086e[_0x990d('0x32')][_0x990d('0x39')](_0x990d('0x4f'))){_0x18816d['limit']=qs[_0x990d('0x20')](_0x5b086e[_0x990d('0x32')][_0x990d('0x20')]);_0x18816d[_0x990d('0x1e')]=qs[_0x990d('0x1e')](_0x5b086e['query'][_0x990d('0x1e')]);}return _0x15f7b0[_0x990d('0x53')](_0x18816d);}})[_0x990d('0x28')](function(_0x180cf8){if(_0x180cf8){return _0x180cf8?{'count':_0x433eff,'rows':_0x180cf8}:null;}})[_0x990d('0x28')](respondWithResult(_0x587d60,null))[_0x990d('0x45')](handleError(_0x587d60,null));};exports[_0x990d('0x54')]=function(_0x19a3b8,_0x17e643,_0x7f30cd){if(_0x19a3b8[_0x990d('0x4a')]['id']){delete _0x19a3b8['body']['id'];}return db[_0x990d('0x43')]['findOne']({'where':{'id':_0x19a3b8[_0x990d('0x47')]['id']}})[_0x990d('0x28')](handleEntityNotFound(_0x17e643,null))['then'](function(_0x226b9e){if(_0x226b9e){return _0x226b9e['setTags'](_0x19a3b8[_0x990d('0x4a')][_0x990d('0x55')]||[]);}return null;})[_0x990d('0x28')](respondWithResult(_0x17e643,null))[_0x990d('0x45')](handleError(_0x17e643,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index d0b59d4..0218f7f 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 _0x8f07=['exports','define','int_desk_configurations','util','api','moment','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x3ba670,_0x406dbe){var _0x32c222=function(_0x324545){while(--_0x324545){_0x3ba670['push'](_0x3ba670['shift']());}};_0x32c222(++_0x406dbe);}(_0x8f07,0x161));var _0x78f0=function(_0x5ea658,_0x39e6cb){_0x5ea658=_0x5ea658-0x0;var _0x4f3e45=_0x8f07[_0x5ea658];return _0x4f3e45;};'use strict';var _=require('lodash');var util=require(_0x78f0('0x0'));var logger=require('../../config/logger')(_0x78f0('0x1'));var moment=require(_0x78f0('0x2'));var BPromise=require('bluebird');var rp=require(_0x78f0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x78f0('0x4'));var config=require(_0x78f0('0x5'));var attributes=require(_0x78f0('0x6'));module[_0x78f0('0x7')]=function(_0x5237a0,_0x3805d8){return _0x5237a0[_0x78f0('0x8')]('DeskConfiguration',attributes,{'tableName':_0x78f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4458=['rimraf','../../config/environment','./intDeskConfiguration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x35b8ea,_0x360bf5){var _0x266705=function(_0x55ec5a){while(--_0x55ec5a){_0x35b8ea['push'](_0x35b8ea['shift']());}};_0x266705(++_0x360bf5);}(_0x4458,0x1e4));var _0x8445=function(_0x554274,_0x1187d7){_0x554274=_0x554274-0x0;var _0x213f90=_0x4458[_0x554274];return _0x213f90;};'use strict';var _=require(_0x8445('0x0'));var util=require(_0x8445('0x1'));var logger=require(_0x8445('0x2'))(_0x8445('0x3'));var moment=require(_0x8445('0x4'));var BPromise=require(_0x8445('0x5'));var rp=require(_0x8445('0x6'));var fs=require('fs');var path=require(_0x8445('0x7'));var rimraf=require(_0x8445('0x8'));var config=require(_0x8445('0x9'));var attributes=require(_0x8445('0xa'));module['exports']=function(_0x103e14,_0x1706bf){return _0x103e14[_0x8445('0xb')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 25e94f2..1a4135e 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 _0xc0a4=['stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x296d1b,_0x1f0bf0){_0x296d1b=_0x296d1b-0x0;var _0x3c747f=_0xc0a4[_0x296d1b];return _0x3c747f;};'use strict';var _=require(_0x4c0a('0x0'));var util=require(_0x4c0a('0x1'));var moment=require('moment');var BPromise=require(_0x4c0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c0a('0x3'));var db=require(_0x4c0a('0x4'))['db'];var utils=require(_0x4c0a('0x5'));var logger=require(_0x4c0a('0x6'))(_0x4c0a('0x7'));var config=require(_0x4c0a('0x8'));var jayson=require(_0x4c0a('0x9'));var client=jayson[_0x4c0a('0xa')][_0x4c0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1515ef,_0x53e005,_0x33fc7d){return new BPromise(function(_0x45b174,_0x50aa90){return client[_0x4c0a('0xc')](_0x1515ef,_0x33fc7d)[_0x4c0a('0xd')](function(_0x493120){logger[_0x4c0a('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x53e005,_0x4c0a('0xf'));logger[_0x4c0a('0x10')](_0x4c0a('0x11'),_0x53e005,_0x4c0a('0xf'),JSON[_0x4c0a('0x12')](_0x493120));if(_0x493120[_0x4c0a('0x13')]){if(_0x493120[_0x4c0a('0x13')]['code']===0x1f4){logger[_0x4c0a('0x13')](_0x4c0a('0x14'),_0x53e005,_0x493120['error'][_0x4c0a('0x15')]);return _0x50aa90(_0x493120['error']['message']);}logger['error'](_0x4c0a('0x14'),_0x53e005,_0x493120[_0x4c0a('0x13')][_0x4c0a('0x15')]);return _0x45b174(_0x493120[_0x4c0a('0x13')]['message']);}else{logger[_0x4c0a('0xe')](_0x4c0a('0x14'),_0x53e005,'request\x20sent');_0x45b174(_0x493120[_0x4c0a('0x16')]['message']);}})[_0x4c0a('0x17')](function(_0x60e374){logger['error'](_0x4c0a('0x14'),_0x53e005,_0x60e374);_0x50aa90(_0x60e374);});});} \ No newline at end of file +var _0xa2c6=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x204aa7,_0x1038f1){var _0x2ce14d=function(_0xdb5bca){while(--_0xdb5bca){_0x204aa7['push'](_0x204aa7['shift']());}};_0x2ce14d(++_0x1038f1);}(_0xa2c6,0x1bb));var _0x6a2c=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0xa2c6[_0x30bd4d];return _0x306915;};'use strict';var _=require(_0x6a2c('0x0'));var util=require('util');var moment=require(_0x6a2c('0x1'));var BPromise=require(_0x6a2c('0x2'));var rs=require(_0x6a2c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a2c('0x4'));var logger=require(_0x6a2c('0x5'))(_0x6a2c('0x6'));var config=require(_0x6a2c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x249a70,_0x10f543,_0x135701){return new BPromise(function(_0x105944,_0x44a130){return client['request'](_0x249a70,_0x135701)[_0x6a2c('0x8')](function(_0x4c943a){logger[_0x6a2c('0x9')](_0x6a2c('0xa'),_0x10f543,'request\x20sent');logger['debug'](_0x6a2c('0xb'),_0x10f543,_0x6a2c('0xc'),JSON[_0x6a2c('0xd')](_0x4c943a));if(_0x4c943a[_0x6a2c('0xe')]){if(_0x4c943a['error'][_0x6a2c('0xf')]===0x1f4){logger['error'](_0x6a2c('0xa'),_0x10f543,_0x4c943a[_0x6a2c('0xe')][_0x6a2c('0x10')]);return _0x44a130(_0x4c943a[_0x6a2c('0xe')][_0x6a2c('0x10')]);}logger[_0x6a2c('0xe')](_0x6a2c('0xa'),_0x10f543,_0x4c943a['error'][_0x6a2c('0x10')]);return _0x105944(_0x4c943a[_0x6a2c('0xe')][_0x6a2c('0x10')]);}else{logger[_0x6a2c('0x9')](_0x6a2c('0xa'),_0x10f543,_0x6a2c('0xc'));_0x105944(_0x4c943a[_0x6a2c('0x11')]['message']);}})[_0x6a2c('0x12')](function(_0x456a62){logger[_0x6a2c('0xe')](_0x6a2c('0xa'),_0x10f543,_0x456a62);_0x44a130(_0x456a62);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f092b33..3a89547 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 _0xc11e=['./intDeskField.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xdbd1cf,_0x8d319d){var _0x3668c4=function(_0x1e1823){while(--_0x1e1823){_0xdbd1cf['push'](_0xdbd1cf['shift']());}};_0x3668c4(++_0x8d319d);}(_0xc11e,0xf8));var _0xec11=function(_0xba53e0,_0x5032a2){_0xba53e0=_0xba53e0-0x0;var _0x3d113a=_0xc11e[_0xba53e0];return _0x3d113a;};'use strict';var multer=require(_0xec11('0x0'));var util=require('util');var path=require(_0xec11('0x1'));var timeout=require('connect-timeout');var express=require(_0xec11('0x2'));var router=express['Router']();var fs_extra=require(_0xec11('0x3'));var auth=require(_0xec11('0x4'));var interaction=require(_0xec11('0x5'));var config=require(_0xec11('0x6'));var controller=require(_0xec11('0x7'));router[_0xec11('0x8')]('/',auth['isAuthenticated'](),controller[_0xec11('0x9')]);router[_0xec11('0x8')](_0xec11('0xa'),auth[_0xec11('0xb')](),controller[_0xec11('0xc')]);router[_0xec11('0xd')]('/',auth[_0xec11('0xb')](),controller['create']);router[_0xec11('0xe')]('/:id',auth[_0xec11('0xb')](),controller[_0xec11('0xf')]);router['delete'](_0xec11('0xa'),auth[_0xec11('0xb')](),controller[_0xec11('0x10')]);module['exports']=router; \ No newline at end of file +var _0xacb5=['../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3920ad,_0x1e4f62){var _0x156442=function(_0x38e823){while(--_0x38e823){_0x3920ad['push'](_0x3920ad['shift']());}};_0x156442(++_0x1e4f62);}(_0xacb5,0xe0));var _0x5acb=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0xacb5[_0x41d432];return _0x1650f9;};'use strict';var multer=require(_0x5acb('0x0'));var util=require('util');var path=require(_0x5acb('0x1'));var timeout=require(_0x5acb('0x2'));var express=require(_0x5acb('0x3'));var router=express[_0x5acb('0x4')]();var fs_extra=require(_0x5acb('0x5'));var auth=require(_0x5acb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5acb('0x7'));var controller=require(_0x5acb('0x8'));router[_0x5acb('0x9')]('/',auth[_0x5acb('0xa')](),controller[_0x5acb('0xb')]);router[_0x5acb('0x9')]('/:id',auth[_0x5acb('0xa')](),controller[_0x5acb('0xc')]);router[_0x5acb('0xd')]('/',auth['isAuthenticated'](),controller[_0x5acb('0xe')]);router[_0x5acb('0xf')](_0x5acb('0x10'),auth[_0x5acb('0xa')](),controller[_0x5acb('0x11')]);router[_0x5acb('0x12')](_0x5acb('0x10'),auth[_0x5acb('0xa')](),controller[_0x5acb('0x13')]);module[_0x5acb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index c8c202b..dadc381 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 _0xd19c=['sequelize','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x5c14ec,_0x3d3b4c){var _0x488321=function(_0x2629c5){while(--_0x2629c5){_0x5c14ec['push'](_0x5c14ec['shift']());}};_0x488321(++_0x3d3b4c);}(_0xd19c,0xa8));var _0xcd19=function(_0x422463,_0x1bf030){_0x422463=_0x422463-0x0;var _0x30eca2=_0xd19c[_0x422463];return _0x30eca2;};'use strict';var Sequelize=require(_0xcd19('0x0'));module['exports']={'type':{'type':Sequelize[_0xcd19('0x1')](_0xcd19('0x2'),'variable',_0xcd19('0x3'),_0xcd19('0x4'),'picklist'),'defaultValue':_0xcd19('0x2')},'content':{'type':Sequelize[_0xcd19('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcd19('0x1')]('string',_0xcd19('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xcd19('0x5')]},'nameField':{'type':Sequelize[_0xcd19('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcd19('0x5')]}}; \ No newline at end of file +var _0x8ac1=['customVariable','keyValue','STRING','variable','sequelize','exports','ENUM','string'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8ac1,0x7c));var _0x18ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8ac1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x18ac('0x0'));module[_0x18ac('0x1')]={'type':{'type':Sequelize[_0x18ac('0x2')](_0x18ac('0x3'),'variable',_0x18ac('0x4'),_0x18ac('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x18ac('0x6')]},'key':{'type':Sequelize[_0x18ac('0x6')]},'keyType':{'type':Sequelize[_0x18ac('0x2')](_0x18ac('0x3'),_0x18ac('0x7'),_0x18ac('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x18ac('0x6')]},'nameField':{'type':Sequelize[_0x18ac('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18ac('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1a35cfc..114289d 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 _0xa6c6=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','DeskField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','rawAttributes','include','create','body','find','params','eml-format','rimraf'];(function(_0x5053d3,_0x29f36c){var _0x552db5=function(_0x2223f9){while(--_0x2223f9){_0x5053d3['push'](_0x5053d3['shift']());}};_0x552db5(++_0x29f36c);}(_0xa6c6,0x12e));var _0x6a6c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa6c6[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x6a6c('0x0'));var rimraf=require(_0x6a6c('0x1'));var zipdir=require(_0x6a6c('0x2'));var jsonpatch=require(_0x6a6c('0x3'));var rp=require(_0x6a6c('0x4'));var moment=require(_0x6a6c('0x5'));var BPromise=require(_0x6a6c('0x6'));var Mustache=require(_0x6a6c('0x7'));var util=require(_0x6a6c('0x8'));var path=require(_0x6a6c('0x9'));var sox=require(_0x6a6c('0xa'));var csv=require(_0x6a6c('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a6c('0xc'));var _=require(_0x6a6c('0xd'));var squel=require(_0x6a6c('0xe'));var crypto=require('crypto');var jsforce=require(_0x6a6c('0xf'));var deskjs=require(_0x6a6c('0x10'));var toCsv=require(_0x6a6c('0xb'));var querystring=require('querystring');var Papa=require(_0x6a6c('0x11'));var Redis=require(_0x6a6c('0x12'));var authService=require(_0x6a6c('0x13'));var qs=require(_0x6a6c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a6c('0x15'))(_0x6a6c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6a6c('0x17'));var db=require(_0x6a6c('0x18'))['db'];function respondWithStatusCode(_0xa7b681,_0x41b08e){_0x41b08e=_0x41b08e||0xcc;return function(_0x343acb){if(_0x343acb){return _0xa7b681[_0x6a6c('0x19')](_0x41b08e);}return _0xa7b681[_0x6a6c('0x1a')](_0x41b08e)[_0x6a6c('0x1b')]();};}function respondWithResult(_0x2a9d83,_0x1535cd){_0x1535cd=_0x1535cd||0xc8;return function(_0x286ef2){if(_0x286ef2){return _0x2a9d83[_0x6a6c('0x1a')](_0x1535cd)[_0x6a6c('0x1c')](_0x286ef2);}};}function respondWithFilteredResult(_0x110c4d,_0x4eddb5){return function(_0x36a719){if(_0x36a719){var _0x387521=typeof _0x4eddb5[_0x6a6c('0x1d')]==='undefined'&&typeof _0x4eddb5[_0x6a6c('0x1e')]===_0x6a6c('0x1f');var _0x271009=_0x36a719[_0x6a6c('0x20')];var _0x41b93c=_0x387521?0x0:_0x4eddb5[_0x6a6c('0x1d')];var _0x2d412e=_0x387521?_0x36a719[_0x6a6c('0x20')]:_0x4eddb5[_0x6a6c('0x1d')]+_0x4eddb5[_0x6a6c('0x1e')];var _0x5800c2;if(_0x2d412e>=_0x271009){_0x2d412e=_0x271009;_0x5800c2=0xc8;}else{_0x5800c2=0xce;}_0x110c4d[_0x6a6c('0x1a')](_0x5800c2);return _0x110c4d[_0x6a6c('0x21')](_0x6a6c('0x22'),_0x41b93c+'-'+_0x2d412e+'/'+_0x271009)[_0x6a6c('0x1c')](_0x36a719);}return null;};}function patchUpdates(_0x51f9c5){return function(_0x192f72){try{jsonpatch[_0x6a6c('0x23')](_0x192f72,_0x51f9c5,!![]);}catch(_0x16751d){return BPromise[_0x6a6c('0x24')](_0x16751d);}return _0x192f72[_0x6a6c('0x25')]();};}function saveUpdates(_0x25a991,_0x1b1b78){return function(_0x910d27){if(_0x910d27){return _0x910d27[_0x6a6c('0x26')](_0x25a991)[_0x6a6c('0x27')](function(_0x4be258){return _0x4be258;});}return null;};}function removeEntity(_0x239b0c,_0x3d0521){return function(_0x40da5d){if(_0x40da5d){return _0x40da5d[_0x6a6c('0x28')]()[_0x6a6c('0x27')](function(){_0x239b0c[_0x6a6c('0x1a')](0xcc)[_0x6a6c('0x1b')]();});}};}function handleEntityNotFound(_0x518587,_0x42ba61){return function(_0x1db965){if(!_0x1db965){_0x518587[_0x6a6c('0x19')](0x194);}return _0x1db965;};}function handleError(_0x33c57f,_0x4a9e2a){_0x4a9e2a=_0x4a9e2a||0x1f4;return function(_0x40f1c6){logger[_0x6a6c('0x29')](_0x40f1c6[_0x6a6c('0x2a')]);if(_0x40f1c6['name']){delete _0x40f1c6[_0x6a6c('0x2b')];}_0x33c57f['status'](_0x4a9e2a)['send'](_0x40f1c6);};}exports['index']=function(_0xc7ffa4,_0x437170){var _0x300e0f={},_0x267ca1={},_0x14efc0={'count':0x0,'rows':[]};var _0x35312e=_[_0x6a6c('0x2c')](db[_0x6a6c('0x2d')]['rawAttributes'],function(_0x164818){return{'name':_0x164818[_0x6a6c('0x2e')],'type':_0x164818['type'][_0x6a6c('0x2f')]};});_0x267ca1[_0x6a6c('0x30')]=_[_0x6a6c('0x2c')](_0x35312e,_0x6a6c('0x2b'));_0x267ca1[_0x6a6c('0x31')]=_[_0x6a6c('0x32')](_0xc7ffa4['query']);_0x267ca1[_0x6a6c('0x33')]=_[_0x6a6c('0x34')](_0x267ca1[_0x6a6c('0x30')],_0x267ca1['query']);_0x300e0f[_0x6a6c('0x35')]=_[_0x6a6c('0x34')](_0x267ca1[_0x6a6c('0x30')],qs['fields'](_0xc7ffa4[_0x6a6c('0x31')][_0x6a6c('0x36')]));_0x300e0f[_0x6a6c('0x35')]=_0x300e0f[_0x6a6c('0x35')][_0x6a6c('0x37')]?_0x300e0f[_0x6a6c('0x35')]:_0x267ca1[_0x6a6c('0x30')];if(!_0xc7ffa4[_0x6a6c('0x31')][_0x6a6c('0x38')](_0x6a6c('0x39'))){_0x300e0f[_0x6a6c('0x1e')]=qs[_0x6a6c('0x1e')](_0xc7ffa4[_0x6a6c('0x31')]['limit']);_0x300e0f[_0x6a6c('0x1d')]=qs[_0x6a6c('0x1d')](_0xc7ffa4[_0x6a6c('0x31')][_0x6a6c('0x1d')]);}_0x300e0f[_0x6a6c('0x3a')]=qs[_0x6a6c('0x3b')](_0xc7ffa4['query']['sort']);_0x300e0f[_0x6a6c('0x3c')]=qs[_0x6a6c('0x33')](_[_0x6a6c('0x3d')](_0xc7ffa4[_0x6a6c('0x31')],_0x267ca1[_0x6a6c('0x33')]),_0x35312e);if(_0xc7ffa4[_0x6a6c('0x31')]['filter']){_0x300e0f[_0x6a6c('0x3c')]=_[_0x6a6c('0x3e')](_0x300e0f[_0x6a6c('0x3c')],{'$or':_['map'](_0x35312e,function(_0x1bd6f6){if(_0x1bd6f6['type']!==_0x6a6c('0x3f')){var _0x2975c5={};_0x2975c5[_0x1bd6f6[_0x6a6c('0x2b')]]={'$like':'%'+_0xc7ffa4[_0x6a6c('0x31')][_0x6a6c('0x40')]+'%'};return _0x2975c5;}})});}_0x300e0f=_[_0x6a6c('0x3e')]({},_0x300e0f,_0xc7ffa4[_0x6a6c('0x41')]);var _0x586dd2={'where':_0x300e0f['where']};return db[_0x6a6c('0x2d')][_0x6a6c('0x20')](_0x586dd2)[_0x6a6c('0x27')](function(_0x2cbb5b){_0x14efc0[_0x6a6c('0x20')]=_0x2cbb5b;if(_0xc7ffa4[_0x6a6c('0x31')][_0x6a6c('0x42')]){_0x300e0f['include']=[{'all':!![]}];}return db[_0x6a6c('0x2d')][_0x6a6c('0x43')](_0x300e0f);})['then'](function(_0xcadb83){_0x14efc0['rows']=_0xcadb83;return _0x14efc0;})[_0x6a6c('0x27')](respondWithFilteredResult(_0x437170,_0x300e0f))[_0x6a6c('0x44')](handleError(_0x437170,null));};exports[_0x6a6c('0x45')]=function(_0x2a000d,_0x2c71bb){var _0x18b717={'raw':!![],'where':{'id':_0x2a000d['params']['id']}},_0x3abc99={};_0x3abc99[_0x6a6c('0x30')]=_[_0x6a6c('0x32')](db['DeskField'][_0x6a6c('0x46')]);_0x3abc99[_0x6a6c('0x31')]=_[_0x6a6c('0x32')](_0x2a000d[_0x6a6c('0x31')]);_0x3abc99[_0x6a6c('0x33')]=_[_0x6a6c('0x34')](_0x3abc99[_0x6a6c('0x30')],_0x3abc99['query']);_0x18b717[_0x6a6c('0x35')]=_['intersection'](_0x3abc99[_0x6a6c('0x30')],qs[_0x6a6c('0x36')](_0x2a000d[_0x6a6c('0x31')]['fields']));_0x18b717[_0x6a6c('0x35')]=_0x18b717[_0x6a6c('0x35')][_0x6a6c('0x37')]?_0x18b717[_0x6a6c('0x35')]:_0x3abc99[_0x6a6c('0x30')];if(_0x2a000d['query'][_0x6a6c('0x42')]){_0x18b717[_0x6a6c('0x47')]=[{'all':!![]}];}_0x18b717=_['merge']({},_0x18b717,_0x2a000d['options']);return db['DeskField']['find'](_0x18b717)['then'](handleEntityNotFound(_0x2c71bb,null))[_0x6a6c('0x27')](respondWithResult(_0x2c71bb,null))[_0x6a6c('0x44')](handleError(_0x2c71bb,null));};exports[_0x6a6c('0x48')]=function(_0x5fa2e2,_0x56296b){return db[_0x6a6c('0x2d')][_0x6a6c('0x48')](_0x5fa2e2[_0x6a6c('0x49')],{})[_0x6a6c('0x27')](respondWithResult(_0x56296b,0xc9))[_0x6a6c('0x44')](handleError(_0x56296b,null));};exports['update']=function(_0x2115e9,_0x31e0dc){if(_0x2115e9[_0x6a6c('0x49')]['id']){delete _0x2115e9[_0x6a6c('0x49')]['id'];}return db[_0x6a6c('0x2d')][_0x6a6c('0x4a')]({'where':{'id':_0x2115e9[_0x6a6c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x31e0dc,null))[_0x6a6c('0x27')](saveUpdates(_0x2115e9[_0x6a6c('0x49')],null))['then'](respondWithResult(_0x31e0dc,null))['catch'](handleError(_0x31e0dc,null));};exports[_0x6a6c('0x28')]=function(_0x5750f9,_0x2fcf51){return db['DeskField'][_0x6a6c('0x4a')]({'where':{'id':_0x5750f9[_0x6a6c('0x4b')]['id']}})[_0x6a6c('0x27')](handleEntityNotFound(_0x2fcf51,null))[_0x6a6c('0x27')](removeEntity(_0x2fcf51,null))['catch'](handleError(_0x2fcf51,null));}; \ No newline at end of file +var _0x27a0=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','count','Content-Range','reject','save','update','then','destroy','error','name','index','DeskField','fieldName','key','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2a8122,_0xd957e){var _0x49a5c7=function(_0x12ab58){while(--_0x12ab58){_0x2a8122['push'](_0x2a8122['shift']());}};_0x49a5c7(++_0xd957e);}(_0x27a0,0xbf));var _0x027a=function(_0x2ff346,_0x111ae8){_0x2ff346=_0x2ff346-0x0;var _0xcd6ffb=_0x27a0[_0x2ff346];return _0xcd6ffb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x027a('0x0'));var zipdir=require(_0x027a('0x1'));var jsonpatch=require(_0x027a('0x2'));var rp=require(_0x027a('0x3'));var moment=require(_0x027a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x027a('0x5'));var csv=require(_0x027a('0x6'));var ejs=require(_0x027a('0x7'));var fs=require('fs');var fs_extra=require(_0x027a('0x8'));var _=require(_0x027a('0x9'));var squel=require(_0x027a('0xa'));var crypto=require('crypto');var jsforce=require(_0x027a('0xb'));var deskjs=require(_0x027a('0xc'));var toCsv=require(_0x027a('0x6'));var querystring=require('querystring');var Papa=require(_0x027a('0xd'));var Redis=require(_0x027a('0xe'));var authService=require(_0x027a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x027a('0x10'));var hardwareService=require(_0x027a('0x11'));var logger=require(_0x027a('0x12'))(_0x027a('0x13'));var utils=require(_0x027a('0x14'));var config=require(_0x027a('0x15'));var licenseUtil=require(_0x027a('0x16'));var db=require(_0x027a('0x17'))['db'];function respondWithStatusCode(_0x351d7e,_0x3e0c1e){_0x3e0c1e=_0x3e0c1e||0xcc;return function(_0x96a5c3){if(_0x96a5c3){return _0x351d7e['sendStatus'](_0x3e0c1e);}return _0x351d7e[_0x027a('0x18')](_0x3e0c1e)[_0x027a('0x19')]();};}function respondWithResult(_0x2d27f8,_0x21da53){_0x21da53=_0x21da53||0xc8;return function(_0x40fec0){if(_0x40fec0){return _0x2d27f8['status'](_0x21da53)['json'](_0x40fec0);}};}function respondWithFilteredResult(_0x1d680d,_0x5cfc6d){return function(_0x2b3870){if(_0x2b3870){var _0x559d13=typeof _0x5cfc6d[_0x027a('0x1a')]==='undefined'&&typeof _0x5cfc6d['limit']==='undefined';var _0x588f53=_0x2b3870[_0x027a('0x1b')];var _0x826d19=_0x559d13?0x0:_0x5cfc6d[_0x027a('0x1a')];var _0x52125e=_0x559d13?_0x2b3870[_0x027a('0x1b')]:_0x5cfc6d[_0x027a('0x1a')]+_0x5cfc6d['limit'];var _0x4f8c3d;if(_0x52125e>=_0x588f53){_0x52125e=_0x588f53;_0x4f8c3d=0xc8;}else{_0x4f8c3d=0xce;}_0x1d680d[_0x027a('0x18')](_0x4f8c3d);return _0x1d680d['set'](_0x027a('0x1c'),_0x826d19+'-'+_0x52125e+'/'+_0x588f53)['json'](_0x2b3870);}return null;};}function patchUpdates(_0x59511c){return function(_0x58b129){try{jsonpatch['apply'](_0x58b129,_0x59511c,!![]);}catch(_0x18efe7){return BPromise[_0x027a('0x1d')](_0x18efe7);}return _0x58b129[_0x027a('0x1e')]();};}function saveUpdates(_0xdf8756,_0x51b870){return function(_0x2fb1d0){if(_0x2fb1d0){return _0x2fb1d0[_0x027a('0x1f')](_0xdf8756)[_0x027a('0x20')](function(_0x3dee99){return _0x3dee99;});}return null;};}function removeEntity(_0x178ed8,_0x3bbd46){return function(_0x595f0e){if(_0x595f0e){return _0x595f0e[_0x027a('0x21')]()['then'](function(){_0x178ed8[_0x027a('0x18')](0xcc)[_0x027a('0x19')]();});}};}function handleEntityNotFound(_0x1b1a13,_0x83fe3e){return function(_0x582943){if(!_0x582943){_0x1b1a13['sendStatus'](0x194);}return _0x582943;};}function handleError(_0x18458f,_0xcc7562){_0xcc7562=_0xcc7562||0x1f4;return function(_0x338141){logger[_0x027a('0x22')](_0x338141['stack']);if(_0x338141[_0x027a('0x23')]){delete _0x338141['name'];}_0x18458f[_0x027a('0x18')](_0xcc7562)['send'](_0x338141);};}exports[_0x027a('0x24')]=function(_0x4d5a25,_0x578ea5){var _0x31385d={},_0x5782ac={},_0x47a365={'count':0x0,'rows':[]};var _0x448ba0=_['map'](db[_0x027a('0x25')]['rawAttributes'],function(_0x2640d8){return{'name':_0x2640d8[_0x027a('0x26')],'type':_0x2640d8['type'][_0x027a('0x27')]};});_0x5782ac['model']=_[_0x027a('0x28')](_0x448ba0,_0x027a('0x23'));_0x5782ac[_0x027a('0x29')]=_[_0x027a('0x2a')](_0x4d5a25[_0x027a('0x29')]);_0x5782ac[_0x027a('0x2b')]=_['intersection'](_0x5782ac[_0x027a('0x2c')],_0x5782ac['query']);_0x31385d[_0x027a('0x2d')]=_['intersection'](_0x5782ac[_0x027a('0x2c')],qs[_0x027a('0x2e')](_0x4d5a25[_0x027a('0x29')][_0x027a('0x2e')]));_0x31385d[_0x027a('0x2d')]=_0x31385d['attributes'][_0x027a('0x2f')]?_0x31385d[_0x027a('0x2d')]:_0x5782ac[_0x027a('0x2c')];if(!_0x4d5a25[_0x027a('0x29')][_0x027a('0x30')](_0x027a('0x31'))){_0x31385d[_0x027a('0x32')]=qs[_0x027a('0x32')](_0x4d5a25[_0x027a('0x29')][_0x027a('0x32')]);_0x31385d[_0x027a('0x1a')]=qs['offset'](_0x4d5a25[_0x027a('0x29')][_0x027a('0x1a')]);}_0x31385d[_0x027a('0x33')]=qs[_0x027a('0x34')](_0x4d5a25[_0x027a('0x29')][_0x027a('0x34')]);_0x31385d[_0x027a('0x35')]=qs['filters'](_[_0x027a('0x36')](_0x4d5a25[_0x027a('0x29')],_0x5782ac[_0x027a('0x2b')]),_0x448ba0);if(_0x4d5a25['query'][_0x027a('0x37')]){_0x31385d['where']=_[_0x027a('0x38')](_0x31385d[_0x027a('0x35')],{'$or':_[_0x027a('0x28')](_0x448ba0,function(_0x5a7650){if(_0x5a7650['type']!==_0x027a('0x39')){var _0x2eea3b={};_0x2eea3b[_0x5a7650['name']]={'$like':'%'+_0x4d5a25[_0x027a('0x29')][_0x027a('0x37')]+'%'};return _0x2eea3b;}})});}_0x31385d=_[_0x027a('0x38')]({},_0x31385d,_0x4d5a25[_0x027a('0x3a')]);var _0x30e5b2={'where':_0x31385d[_0x027a('0x35')]};return db[_0x027a('0x25')][_0x027a('0x1b')](_0x30e5b2)[_0x027a('0x20')](function(_0x37a0c7){_0x47a365[_0x027a('0x1b')]=_0x37a0c7;if(_0x4d5a25[_0x027a('0x29')][_0x027a('0x3b')]){_0x31385d[_0x027a('0x3c')]=[{'all':!![]}];}return db[_0x027a('0x25')][_0x027a('0x3d')](_0x31385d);})[_0x027a('0x20')](function(_0x5a3dee){_0x47a365[_0x027a('0x3e')]=_0x5a3dee;return _0x47a365;})[_0x027a('0x20')](respondWithFilteredResult(_0x578ea5,_0x31385d))[_0x027a('0x3f')](handleError(_0x578ea5,null));};exports[_0x027a('0x40')]=function(_0x17abbe,_0x24d370){var _0x4c8110={'raw':!![],'where':{'id':_0x17abbe[_0x027a('0x41')]['id']}},_0x96d3aa={};_0x96d3aa['model']=_[_0x027a('0x2a')](db['DeskField']['rawAttributes']);_0x96d3aa[_0x027a('0x29')]=_['keys'](_0x17abbe[_0x027a('0x29')]);_0x96d3aa[_0x027a('0x2b')]=_[_0x027a('0x42')](_0x96d3aa[_0x027a('0x2c')],_0x96d3aa[_0x027a('0x29')]);_0x4c8110['attributes']=_[_0x027a('0x42')](_0x96d3aa[_0x027a('0x2c')],qs[_0x027a('0x2e')](_0x17abbe['query']['fields']));_0x4c8110['attributes']=_0x4c8110['attributes'][_0x027a('0x2f')]?_0x4c8110[_0x027a('0x2d')]:_0x96d3aa[_0x027a('0x2c')];if(_0x17abbe[_0x027a('0x29')][_0x027a('0x3b')]){_0x4c8110[_0x027a('0x3c')]=[{'all':!![]}];}_0x4c8110=_['merge']({},_0x4c8110,_0x17abbe['options']);return db[_0x027a('0x25')][_0x027a('0x43')](_0x4c8110)[_0x027a('0x20')](handleEntityNotFound(_0x24d370,null))[_0x027a('0x20')](respondWithResult(_0x24d370,null))[_0x027a('0x3f')](handleError(_0x24d370,null));};exports[_0x027a('0x44')]=function(_0x235a38,_0x1bddc1){return db[_0x027a('0x25')]['create'](_0x235a38[_0x027a('0x45')],{})[_0x027a('0x20')](respondWithResult(_0x1bddc1,0xc9))[_0x027a('0x3f')](handleError(_0x1bddc1,null));};exports[_0x027a('0x1f')]=function(_0xa3a68d,_0x21c6f4){if(_0xa3a68d[_0x027a('0x45')]['id']){delete _0xa3a68d[_0x027a('0x45')]['id'];}return db['DeskField'][_0x027a('0x43')]({'where':{'id':_0xa3a68d[_0x027a('0x41')]['id']}})['then'](handleEntityNotFound(_0x21c6f4,null))[_0x027a('0x20')](saveUpdates(_0xa3a68d[_0x027a('0x45')],null))['then'](respondWithResult(_0x21c6f4,null))['catch'](handleError(_0x21c6f4,null));};exports['destroy']=function(_0x37048b,_0x5bdd44){return db[_0x027a('0x25')]['find']({'where':{'id':_0x37048b['params']['id']}})['then'](handleEntityNotFound(_0x5bdd44,null))['then'](removeEntity(_0x5bdd44,null))[_0x027a('0x3f')](handleError(_0x5bdd44,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 19c1e3a..4bb1c55 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 _0x5a7b=['define','DeskField','int_desk_fields','desk_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x2a3e94,_0x2404d9){var _0x21e606=function(_0x1a9c13){while(--_0x1a9c13){_0x2a3e94['push'](_0x2a3e94['shift']());}};_0x21e606(++_0x2404d9);}(_0x5a7b,0x122));var _0xb5a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a7b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb5a7('0x0'));var logger=require(_0xb5a7('0x1'))(_0xb5a7('0x2'));var moment=require(_0xb5a7('0x3'));var BPromise=require(_0xb5a7('0x4'));var rp=require(_0xb5a7('0x5'));var fs=require('fs');var path=require(_0xb5a7('0x6'));var rimraf=require(_0xb5a7('0x7'));var config=require(_0xb5a7('0x8'));var attributes=require(_0xb5a7('0x9'));module['exports']=function(_0x352cd5,_0x2e4016){return _0x352cd5[_0xb5a7('0xa')](_0xb5a7('0xb'),attributes,{'tableName':_0xb5a7('0xc'),'paranoid':![],'indexes':[{'name':_0xb5a7('0xd'),'fields':[_0xb5a7('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d7a=['rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x0d7a,0x1ba));var _0xa0d7=function(_0x46d8b2,_0x3829c4){_0x46d8b2=_0x46d8b2-0x0;var _0x1a351f=_0x0d7a[_0x46d8b2];return _0x1a351f;};'use strict';var _=require(_0xa0d7('0x0'));var util=require('util');var logger=require(_0xa0d7('0x1'))(_0xa0d7('0x2'));var moment=require(_0xa0d7('0x3'));var BPromise=require(_0xa0d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0d7('0x5'));var rimraf=require(_0xa0d7('0x6'));var config=require('../../config/environment');var attributes=require(_0xa0d7('0x7'));module[_0xa0d7('0x8')]=function(_0x3ac86c,_0x13754e){return _0x3ac86c[_0xa0d7('0x9')]('DeskField',attributes,{'tableName':_0xa0d7('0xa'),'paranoid':![],'indexes':[{'name':_0xa0d7('0xb'),'fields':[_0xa0d7('0xc'),_0xa0d7('0xd')],'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 516b53e..97b5451 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 _0xd84e=['info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','DeskField,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd84e,0x99));var _0xed84=function(_0x4888c3,_0x41aa58){_0x4888c3=_0x4888c3-0x0;var _0x27612b=_0xd84e[_0x4888c3];return _0x27612b;};'use strict';var _=require(_0xed84('0x0'));var util=require(_0xed84('0x1'));var moment=require(_0xed84('0x2'));var BPromise=require(_0xed84('0x3'));var rs=require(_0xed84('0x4'));var fs=require('fs');var Redis=require(_0xed84('0x5'));var db=require(_0xed84('0x6'))['db'];var utils=require(_0xed84('0x7'));var logger=require(_0xed84('0x8'))(_0xed84('0x9'));var config=require(_0xed84('0xa'));var jayson=require(_0xed84('0xb'));var client=jayson['client'][_0xed84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1087fd,_0x33252b,_0x5e3e68){return new BPromise(function(_0x210343,_0x55d4aa){return client[_0xed84('0xd')](_0x1087fd,_0x5e3e68)[_0xed84('0xe')](function(_0x55d2dc){logger[_0xed84('0xf')]('DeskField,\x20%s,\x20%s',_0x33252b,_0xed84('0x10'));logger[_0xed84('0x11')](_0xed84('0x12'),_0x33252b,_0xed84('0x10'),JSON['stringify'](_0x55d2dc));if(_0x55d2dc[_0xed84('0x13')]){if(_0x55d2dc['error'][_0xed84('0x14')]===0x1f4){logger[_0xed84('0x13')]('DeskField,\x20%s,\x20%s',_0x33252b,_0x55d2dc[_0xed84('0x13')][_0xed84('0x15')]);return _0x55d4aa(_0x55d2dc[_0xed84('0x13')]['message']);}logger[_0xed84('0x13')](_0xed84('0x16'),_0x33252b,_0x55d2dc[_0xed84('0x13')]['message']);return _0x210343(_0x55d2dc[_0xed84('0x13')][_0xed84('0x15')]);}else{logger[_0xed84('0xf')]('DeskField,\x20%s,\x20%s',_0x33252b,'request\x20sent');_0x210343(_0x55d2dc[_0xed84('0x17')][_0xed84('0x15')]);}})['catch'](function(_0x3dc489){logger['error'](_0xed84('0x16'),_0x33252b,_0x3dc489);_0x55d4aa(_0x3dc489);});});} \ No newline at end of file +var _0xb68d=['request','then','info','request\x20sent','debug','error','code','message','DeskField,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xc9864a,_0x2dab44){var _0x3cf5e8=function(_0xdf6da){while(--_0xdf6da){_0xc9864a['push'](_0xc9864a['shift']());}};_0x3cf5e8(++_0x2dab44);}(_0xb68d,0xf9));var _0xdb68=function(_0x2dcdc0,_0x46021d){_0x2dcdc0=_0x2dcdc0-0x0;var _0x40f3ff=_0xb68d[_0x2dcdc0];return _0x40f3ff;};'use strict';var _=require(_0xdb68('0x0'));var util=require(_0xdb68('0x1'));var moment=require(_0xdb68('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb68('0x3'));var fs=require('fs');var Redis=require(_0xdb68('0x4'));var db=require(_0xdb68('0x5'))['db'];var utils=require(_0xdb68('0x6'));var logger=require(_0xdb68('0x7'))(_0xdb68('0x8'));var config=require(_0xdb68('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdb68('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x98a7d,_0x236917,_0x2e9339){return new BPromise(function(_0x580af2,_0x5e729e){return client[_0xdb68('0xb')](_0x98a7d,_0x2e9339)[_0xdb68('0xc')](function(_0x1e7930){logger[_0xdb68('0xd')]('DeskField,\x20%s,\x20%s',_0x236917,_0xdb68('0xe'));logger[_0xdb68('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x236917,_0xdb68('0xe'),JSON['stringify'](_0x1e7930));if(_0x1e7930['error']){if(_0x1e7930[_0xdb68('0x10')][_0xdb68('0x11')]===0x1f4){logger[_0xdb68('0x10')]('DeskField,\x20%s,\x20%s',_0x236917,_0x1e7930[_0xdb68('0x10')][_0xdb68('0x12')]);return _0x5e729e(_0x1e7930['error']['message']);}logger[_0xdb68('0x10')]('DeskField,\x20%s,\x20%s',_0x236917,_0x1e7930[_0xdb68('0x10')][_0xdb68('0x12')]);return _0x580af2(_0x1e7930[_0xdb68('0x10')][_0xdb68('0x12')]);}else{logger[_0xdb68('0xd')](_0xdb68('0x13'),_0x236917,'request\x20sent');_0x580af2(_0x1e7930['result'][_0xdb68('0x12')]);}})['catch'](function(_0x18fd0b){logger['error'](_0xdb68('0x13'),_0x236917,_0x18fd0b);_0x5e729e(_0x18fd0b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 92ec496..f25f562 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 _0x65c7=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','/:id','delete','destroy'];(function(_0x8a3fd,_0x416e38){var _0x249b21=function(_0x28931a){while(--_0x28931a){_0x8a3fd['push'](_0x8a3fd['shift']());}};_0x249b21(++_0x416e38);}(_0x65c7,0x74));var _0x765c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x65c7[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x765c('0x0'));var path=require(_0x765c('0x1'));var timeout=require(_0x765c('0x2'));var express=require(_0x765c('0x3'));var router=express[_0x765c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x765c('0x5'));var config=require(_0x765c('0x6'));var controller=require(_0x765c('0x7'));router[_0x765c('0x8')]('/',auth[_0x765c('0x9')](),controller[_0x765c('0xa')]);router[_0x765c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x765c('0xb')]);router[_0x765c('0x8')](_0x765c('0xc'),auth[_0x765c('0x9')](),controller[_0x765c('0xd')]);router['get'](_0x765c('0xe'),auth[_0x765c('0x9')](),controller[_0x765c('0xf')]);router['post']('/',auth[_0x765c('0x9')](),controller[_0x765c('0x10')]);router[_0x765c('0x11')](_0x765c('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x765c('0x12')](_0x765c('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x765c('0x14')](_0x765c('0x13'),auth[_0x765c('0x9')](),controller[_0x765c('0x15')]);module[_0x765c('0x16')]=router; \ No newline at end of file +var _0xb53a=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb53a,0x158));var _0xab53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb53a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xab53('0x0'));var util=require(_0xab53('0x1'));var path=require(_0xab53('0x2'));var timeout=require(_0xab53('0x3'));var express=require('express');var router=express[_0xab53('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xab53('0x5'));var interaction=require(_0xab53('0x6'));var config=require(_0xab53('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xab53('0x8')]('/',auth[_0xab53('0x9')](),controller[_0xab53('0xa')]);router['get'](_0xab53('0xb'),auth[_0xab53('0x9')](),controller[_0xab53('0xc')]);router[_0xab53('0x8')]('/:id/configurations',auth[_0xab53('0x9')](),controller[_0xab53('0xd')]);router[_0xab53('0x8')](_0xab53('0xe'),auth[_0xab53('0x9')](),controller[_0xab53('0xf')]);router[_0xab53('0x10')]('/',auth[_0xab53('0x9')](),controller['create']);router[_0xab53('0x10')]('/:id/configurations',auth[_0xab53('0x9')](),controller[_0xab53('0x11')]);router[_0xab53('0x12')]('/:id',auth[_0xab53('0x9')](),controller[_0xab53('0x13')]);router[_0xab53('0x14')](_0xab53('0xb'),auth[_0xab53('0x9')](),controller[_0xab53('0x15')]);module[_0xab53('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a70d949..a139f08 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 _0x2f56=['STRING','sequelize','exports'];(function(_0x12fd05,_0x501796){var _0xbfc0d7=function(_0x213cae){while(--_0x213cae){_0x12fd05['push'](_0x12fd05['shift']());}};_0xbfc0d7(++_0x501796);}(_0x2f56,0xb5));var _0x62f5=function(_0x177679,_0x24b9ee){_0x177679=_0x177679-0x0;var _0x1f4bd4=_0x2f56[_0x177679];return _0x1f4bd4;};'use strict';var Sequelize=require(_0x62f5('0x0'));module[_0x62f5('0x1')]={'name':{'type':Sequelize[_0x62f5('0x2')]},'username':{'type':Sequelize[_0x62f5('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x62f5('0x2')]},'tenantId':{'type':Sequelize[_0x62f5('0x2')]},'clientId':{'type':Sequelize[_0x62f5('0x2')]},'clientSecret':{'type':Sequelize[_0x62f5('0x2')]},'serverUrl':{'type':Sequelize[_0x62f5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb368=['exports','STRING','sequelize'];(function(_0x9510e3,_0x51f1ed){var _0x5c1e15=function(_0x48f888){while(--_0x48f888){_0x9510e3['push'](_0x9510e3['shift']());}};_0x5c1e15(++_0x51f1ed);}(_0xb368,0x68));var _0x8b36=function(_0x486ba4,_0x10deb6){_0x486ba4=_0x486ba4-0x0;var _0x1b2502=_0xb368[_0x486ba4];return _0x1b2502;};'use strict';var Sequelize=require(_0x8b36('0x0'));module[_0x8b36('0x1')]={'name':{'type':Sequelize[_0x8b36('0x2')]},'username':{'type':Sequelize[_0x8b36('0x2')]},'password':{'type':Sequelize[_0x8b36('0x2')]},'remoteUri':{'type':Sequelize[_0x8b36('0x2')]},'tenantId':{'type':Sequelize[_0x8b36('0x2')]},'clientId':{'type':Sequelize[_0x8b36('0x2')]},'clientSecret':{'type':Sequelize[_0x8b36('0x2')]},'serverUrl':{'type':Sequelize[_0x8b36('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c7b815b..f37e474 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 _0x0eec=['count','Content-Range','apply','then','destroy','status','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','length','find','create','body','update','params','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','description','customerid','ownerid','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','slice','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','substring','lastIndexOf','PicklistAttributeMetadata','push','isNil','@odata.type','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','limit','undefined'];(function(_0x22f164,_0xaa4f80){var _0x51ab95=function(_0x190b68){while(--_0x190b68){_0x22f164['push'](_0x22f164['shift']());}};_0x51ab95(++_0xaa4f80);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xc0ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc0ee('0x1'));var rp=require(_0xc0ee('0x2'));var moment=require(_0xc0ee('0x3'));var BPromise=require(_0xc0ee('0x4'));var Mustache=require(_0xc0ee('0x5'));var util=require(_0xc0ee('0x6'));var path=require(_0xc0ee('0x7'));var sox=require('sox');var csv=require(_0xc0ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0ee('0x9'));var _=require(_0xc0ee('0xa'));var squel=require(_0xc0ee('0xb'));var crypto=require(_0xc0ee('0xc'));var jsforce=require(_0xc0ee('0xd'));var deskjs=require(_0xc0ee('0xe'));var toCsv=require(_0xc0ee('0x8'));var querystring=require('querystring');var Papa=require(_0xc0ee('0xf'));var Redis=require(_0xc0ee('0x10'));var authService=require(_0xc0ee('0x11'));var qs=require(_0xc0ee('0x12'));var as=require(_0xc0ee('0x13'));var hardwareService=require(_0xc0ee('0x14'));var logger=require(_0xc0ee('0x15'))('api');var utils=require(_0xc0ee('0x16'));var config=require(_0xc0ee('0x17'));var licenseUtil=require(_0xc0ee('0x18'));var db=require(_0xc0ee('0x19'))['db'];var integrations=require(_0xc0ee('0x1a'));function respondWithStatusCode(_0x2d4e3c,_0x454f5d){_0x454f5d=_0x454f5d||0xcc;return function(_0x2f3b49){if(_0x2f3b49){return _0x2d4e3c[_0xc0ee('0x1b')](_0x454f5d);}return _0x2d4e3c['status'](_0x454f5d)['end']();};}function respondWithResult(_0x1f3ad9,_0x325193){_0x325193=_0x325193||0xc8;return function(_0x3743c3){if(_0x3743c3){return _0x1f3ad9['status'](_0x325193)[_0xc0ee('0x1c')](_0x3743c3);}};}function respondWithFilteredResult(_0x30c324,_0x448448){return function(_0x58e1f0){if(_0x58e1f0){var _0x5124df=typeof _0x448448[_0xc0ee('0x1d')]==='undefined'&&typeof _0x448448[_0xc0ee('0x1e')]===_0xc0ee('0x1f');var _0x24672f=_0x58e1f0['count'];var _0x4e7e82=_0x5124df?0x0:_0x448448[_0xc0ee('0x1d')];var _0x276e2e=_0x5124df?_0x58e1f0[_0xc0ee('0x20')]:_0x448448['offset']+_0x448448[_0xc0ee('0x1e')];var _0xe15d59;if(_0x276e2e>=_0x24672f){_0x276e2e=_0x24672f;_0xe15d59=0xc8;}else{_0xe15d59=0xce;}_0x30c324['status'](_0xe15d59);return _0x30c324['set'](_0xc0ee('0x21'),_0x4e7e82+'-'+_0x276e2e+'/'+_0x24672f)[_0xc0ee('0x1c')](_0x58e1f0);}return null;};}function patchUpdates(_0x4dd8c9){return function(_0x2b6d6a){try{jsonpatch[_0xc0ee('0x22')](_0x2b6d6a,_0x4dd8c9,!![]);}catch(_0x92c724){return BPromise['reject'](_0x92c724);}return _0x2b6d6a['save']();};}function saveUpdates(_0x5af925,_0x7ec74){return function(_0x45d880){if(_0x45d880){return _0x45d880['update'](_0x5af925)[_0xc0ee('0x23')](function(_0x453490){return _0x453490;});}return null;};}function removeEntity(_0x20b657,_0x11b6a4){return function(_0x216e64){if(_0x216e64){return _0x216e64[_0xc0ee('0x24')]()[_0xc0ee('0x23')](function(){_0x20b657[_0xc0ee('0x25')](0xcc)[_0xc0ee('0x26')]();});}};}function handleEntityNotFound(_0x6d1087,_0x2b0584){return function(_0x25ae36){if(!_0x25ae36){_0x6d1087[_0xc0ee('0x1b')](0x194);}return _0x25ae36;};}function handleError(_0x30582e,_0x4288e1){_0x4288e1=_0x4288e1||0x1f4;return function(_0x4c6160){logger[_0xc0ee('0x27')](_0x4c6160[_0xc0ee('0x28')]);if(_0x4c6160['name']){delete _0x4c6160[_0xc0ee('0x29')];}_0x30582e['status'](_0x4288e1)[_0xc0ee('0x2a')](_0x4c6160);};}exports[_0xc0ee('0x2b')]=function(_0x44b511,_0x1d3594){var _0x46ca29={},_0x369764={},_0x24a67a={'count':0x0,'rows':[]};var _0x2cffd8=_[_0xc0ee('0x2c')](db[_0xc0ee('0x2d')][_0xc0ee('0x2e')],function(_0x3d4d82){return{'name':_0x3d4d82[_0xc0ee('0x2f')],'type':_0x3d4d82[_0xc0ee('0x30')]['key']};});_0x369764['model']=_[_0xc0ee('0x2c')](_0x2cffd8,_0xc0ee('0x29'));_0x369764[_0xc0ee('0x31')]=_[_0xc0ee('0x32')](_0x44b511[_0xc0ee('0x31')]);_0x369764[_0xc0ee('0x33')]=_[_0xc0ee('0x34')](_0x369764[_0xc0ee('0x35')],_0x369764[_0xc0ee('0x31')]);_0x46ca29[_0xc0ee('0x36')]=_[_0xc0ee('0x34')](_0x369764['model'],qs[_0xc0ee('0x37')](_0x44b511[_0xc0ee('0x31')][_0xc0ee('0x37')]));_0x46ca29[_0xc0ee('0x36')]=_0x46ca29[_0xc0ee('0x36')]['length']?_0x46ca29[_0xc0ee('0x36')]:_0x369764[_0xc0ee('0x35')];if(!_0x44b511[_0xc0ee('0x31')]['hasOwnProperty'](_0xc0ee('0x38'))){_0x46ca29[_0xc0ee('0x1e')]=qs[_0xc0ee('0x1e')](_0x44b511[_0xc0ee('0x31')]['limit']);_0x46ca29[_0xc0ee('0x1d')]=qs['offset'](_0x44b511[_0xc0ee('0x31')][_0xc0ee('0x1d')]);}_0x46ca29[_0xc0ee('0x39')]=qs[_0xc0ee('0x3a')](_0x44b511[_0xc0ee('0x31')][_0xc0ee('0x3a')]);_0x46ca29[_0xc0ee('0x3b')]=qs[_0xc0ee('0x33')](_[_0xc0ee('0x3c')](_0x44b511[_0xc0ee('0x31')],_0x369764[_0xc0ee('0x33')]),_0x2cffd8);if(_0x44b511['query'][_0xc0ee('0x3d')]){_0x46ca29[_0xc0ee('0x3b')]=_[_0xc0ee('0x3e')](_0x46ca29[_0xc0ee('0x3b')],{'$or':_[_0xc0ee('0x2c')](_0x2cffd8,function(_0x1adcc6){if(_0x1adcc6[_0xc0ee('0x30')]!==_0xc0ee('0x3f')){var _0x5b1712={};_0x5b1712[_0x1adcc6['name']]={'$like':'%'+_0x44b511[_0xc0ee('0x31')]['filter']+'%'};return _0x5b1712;}})});}_0x46ca29=_[_0xc0ee('0x3e')]({},_0x46ca29,_0x44b511[_0xc0ee('0x40')]);var _0x5c6369={'where':_0x46ca29[_0xc0ee('0x3b')]};return db['Dynamics365Account'][_0xc0ee('0x20')](_0x5c6369)['then'](function(_0x51ba66){_0x24a67a['count']=_0x51ba66;if(_0x44b511[_0xc0ee('0x31')][_0xc0ee('0x41')]){_0x46ca29[_0xc0ee('0x42')]=[{'all':!![]}];}return db[_0xc0ee('0x2d')]['findAll'](_0x46ca29);})[_0xc0ee('0x23')](function(_0x3f21e4){_0x24a67a[_0xc0ee('0x43')]=_0x3f21e4;return _0x24a67a;})[_0xc0ee('0x23')](respondWithFilteredResult(_0x1d3594,_0x46ca29))[_0xc0ee('0x44')](handleError(_0x1d3594,null));};exports['show']=function(_0x388c7b,_0x264a41){var _0x5577aa={'raw':![],'where':{'id':_0x388c7b['params']['id']}},_0x406309={};_0x406309[_0xc0ee('0x35')]=_[_0xc0ee('0x32')](db['Dynamics365Account'][_0xc0ee('0x2e')]);_0x406309[_0xc0ee('0x31')]=_['keys'](_0x388c7b[_0xc0ee('0x31')]);_0x406309[_0xc0ee('0x33')]=_['intersection'](_0x406309[_0xc0ee('0x35')],_0x406309[_0xc0ee('0x31')]);_0x5577aa[_0xc0ee('0x36')]=_[_0xc0ee('0x34')](_0x406309[_0xc0ee('0x35')],qs['fields'](_0x388c7b['query'][_0xc0ee('0x37')]));_0x5577aa[_0xc0ee('0x36')]=_0x5577aa[_0xc0ee('0x36')][_0xc0ee('0x45')]?_0x5577aa['attributes']:_0x406309['model'];if(_0x388c7b[_0xc0ee('0x31')][_0xc0ee('0x41')]){_0x5577aa[_0xc0ee('0x42')]=[{'all':!![]}];}_0x5577aa=_['merge']({},_0x5577aa,_0x388c7b['options']);return db[_0xc0ee('0x2d')][_0xc0ee('0x46')](_0x5577aa)[_0xc0ee('0x23')](handleEntityNotFound(_0x264a41,null))['then'](respondWithResult(_0x264a41,null))[_0xc0ee('0x44')](handleError(_0x264a41,null));};exports[_0xc0ee('0x47')]=function(_0x5e5f5e,_0x1130d6){return db[_0xc0ee('0x2d')][_0xc0ee('0x47')](_0x5e5f5e[_0xc0ee('0x48')],{})['then'](respondWithResult(_0x1130d6,0xc9))['catch'](handleError(_0x1130d6,null));};exports[_0xc0ee('0x49')]=function(_0x5ca93b,_0x5aa5b3){if(_0x5ca93b['body']['id']){delete _0x5ca93b[_0xc0ee('0x48')]['id'];}return db['Dynamics365Account'][_0xc0ee('0x46')]({'where':{'id':_0x5ca93b[_0xc0ee('0x4a')]['id']}})[_0xc0ee('0x23')](handleEntityNotFound(_0x5aa5b3,null))['then'](saveUpdates(_0x5ca93b[_0xc0ee('0x48')],null))['then'](respondWithResult(_0x5aa5b3,null))[_0xc0ee('0x44')](handleError(_0x5aa5b3,null));};exports['destroy']=function(_0x3bb5ae,_0x3d48a2){return db[_0xc0ee('0x2d')][_0xc0ee('0x46')]({'where':{'id':_0x3bb5ae[_0xc0ee('0x4a')]['id']}})[_0xc0ee('0x23')](handleEntityNotFound(_0x3d48a2,null))['then'](removeEntity(_0x3d48a2,null))['catch'](handleError(_0x3d48a2,null));};exports[_0xc0ee('0x4b')]=function(_0x497ed9,_0x3f03f8,_0x59f19f){var _0x348019={};var _0x3843eb={};var _0x45ac12;var _0x1915c2;return db[_0xc0ee('0x2d')][_0xc0ee('0x4c')]({'where':{'id':_0x497ed9['params']['id']}})[_0xc0ee('0x23')](handleEntityNotFound(_0x3f03f8,null))[_0xc0ee('0x23')](function(_0x55e1e4){if(_0x55e1e4){_0x45ac12=_0x55e1e4;_0x3843eb[_0xc0ee('0x35')]=_[_0xc0ee('0x32')](db[_0xc0ee('0x4d')][_0xc0ee('0x2e')]);_0x3843eb[_0xc0ee('0x31')]=_[_0xc0ee('0x32')](_0x497ed9['query']);_0x3843eb[_0xc0ee('0x33')]=_[_0xc0ee('0x34')](_0x3843eb['model'],_0x3843eb['query']);_0x348019[_0xc0ee('0x36')]=_['intersection'](_0x3843eb[_0xc0ee('0x35')],qs[_0xc0ee('0x37')](_0x497ed9[_0xc0ee('0x31')][_0xc0ee('0x37')]));_0x348019[_0xc0ee('0x36')]=_0x348019[_0xc0ee('0x36')][_0xc0ee('0x45')]?_0x348019[_0xc0ee('0x36')]:_0x3843eb[_0xc0ee('0x35')];_0x348019[_0xc0ee('0x39')]=qs[_0xc0ee('0x3a')](_0x497ed9[_0xc0ee('0x31')][_0xc0ee('0x3a')]);_0x348019['where']=qs[_0xc0ee('0x33')](_[_0xc0ee('0x3c')](_0x497ed9[_0xc0ee('0x31')],_0x3843eb[_0xc0ee('0x33')]));if(_0x497ed9[_0xc0ee('0x31')]['filter']){_0x348019[_0xc0ee('0x3b')]=_['merge'](_0x348019[_0xc0ee('0x3b')],{'$or':_[_0xc0ee('0x2c')](_0x348019[_0xc0ee('0x36')],function(_0x4277af){var _0x3acdff={};_0x3acdff[_0x4277af]={'$like':'%'+_0x497ed9[_0xc0ee('0x31')]['filter']+'%'};return _0x3acdff;})});}_0x348019=_[_0xc0ee('0x3e')]({},_0x348019,_0x497ed9['options']);return _0x45ac12[_0xc0ee('0x4b')](_0x348019);}})[_0xc0ee('0x23')](function(_0x2ca71a){if(_0x2ca71a){_0x1915c2=_0x2ca71a[_0xc0ee('0x45')];if(!_0x497ed9[_0xc0ee('0x31')][_0xc0ee('0x4e')](_0xc0ee('0x38'))){_0x348019[_0xc0ee('0x1e')]=qs[_0xc0ee('0x1e')](_0x497ed9[_0xc0ee('0x31')][_0xc0ee('0x1e')]);_0x348019[_0xc0ee('0x1d')]=qs[_0xc0ee('0x1d')](_0x497ed9[_0xc0ee('0x31')][_0xc0ee('0x1d')]);}return _0x45ac12[_0xc0ee('0x4b')](_0x348019);}})[_0xc0ee('0x23')](function(_0x58433b){if(_0x58433b){return _0x58433b?{'count':_0x1915c2,'rows':_0x58433b}:null;}})['then'](respondWithResult(_0x3f03f8,null))[_0xc0ee('0x44')](handleError(_0x3f03f8,null));};exports[_0xc0ee('0x4f')]=function(_0x506d29,_0x6252fa,_0x23a66c){if(_0x506d29['body']['id']){delete _0x506d29['body']['id'];}return db[_0xc0ee('0x2d')][_0xc0ee('0x4c')]({'where':{'id':_0x506d29[_0xc0ee('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6252fa,null))[_0xc0ee('0x23')](function(_0x1d9cec){if(_0x1d9cec){_0x506d29[_0xc0ee('0x48')]['AccountId']=_0x1d9cec['id'];_0x506d29[_0xc0ee('0x48')][_0xc0ee('0x50')]=integrations[_0xc0ee('0x51')](_0x506d29[_0xc0ee('0x48')][_0xc0ee('0x52')],_0x506d29[_0xc0ee('0x48')][_0xc0ee('0x30')]);_0x506d29['body'][_0xc0ee('0x53')]=integrations['getDescriptions'](_0x506d29[_0xc0ee('0x48')]['channel'],_0x506d29[_0xc0ee('0x48')][_0xc0ee('0x30')]);return db[_0xc0ee('0x4d')][_0xc0ee('0x47')](_0x506d29[_0xc0ee('0x48')],{'include':[{'model':db[_0xc0ee('0x54')],'as':_0xc0ee('0x50')},{'model':db[_0xc0ee('0x54')],'as':_0xc0ee('0x53')}]});}return null;})[_0xc0ee('0x23')](respondWithResult(_0x6252fa,null))['catch'](handleError(_0x6252fa,null));};exports[_0xc0ee('0x55')]=function(_0x4498df,_0xf9231b,_0x303473){var _0x4fa704=_0x4498df[_0xc0ee('0x31')][_0xc0ee('0x56')];var _0x584a76=_0x4fa704==='incident'?_0xc0ee('0x57'):_0xc0ee('0x58');var _0x39e23e='';var _0xa6202e='';var _0x657ef5='';var _0x17a0c4='';var _0x3c6aa9='';var _0x29dd28='';var _0x1b52be='';var _0x159d9a='';var _0x283641=['title',_0xc0ee('0x59'),_0xc0ee('0x5a'),_0xc0ee('0x5b'),'caseorigincode',_0xc0ee('0x5c'),_0xc0ee('0x5d'),'regardingobjectid',_0xc0ee('0x5e'),_0xc0ee('0x5f')];var _0x79e629=['accountidname',_0xc0ee('0x60'),_0xc0ee('0x61'),_0xc0ee('0x62'),'contactidname',_0xc0ee('0x63'),_0xc0ee('0x64'),_0xc0ee('0x65'),_0xc0ee('0x66'),_0xc0ee('0x67'),_0xc0ee('0x68'),_0xc0ee('0x69'),_0xc0ee('0x6a'),_0xc0ee('0x6b'),'createdonbehalfbyyominame',_0xc0ee('0x6c'),_0xc0ee('0x6d'),'customeridyominame',_0xc0ee('0x6e'),_0xc0ee('0x6f'),_0xc0ee('0x70'),'entityimage_url',_0xc0ee('0x71'),_0xc0ee('0x72'),_0xc0ee('0x73'),_0xc0ee('0x74'),_0xc0ee('0x75'),_0xc0ee('0x76'),_0xc0ee('0x77'),_0xc0ee('0x78'),_0xc0ee('0x79'),'modifiedbyexternalpartyname',_0xc0ee('0x7a'),_0xc0ee('0x7b'),'modifiedbyyominame',_0xc0ee('0x7c'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0xc0ee('0x7d'),'msdyn_iotalertname',_0xc0ee('0x7e'),_0xc0ee('0x7f'),_0xc0ee('0x80'),_0xc0ee('0x81'),_0xc0ee('0x82'),_0xc0ee('0x83'),_0xc0ee('0x84'),'primarycontactidname','primarycontactidyominame',_0xc0ee('0x85'),_0xc0ee('0x86'),_0xc0ee('0x87'),_0xc0ee('0x88'),_0xc0ee('0x89'),_0xc0ee('0x8a'),_0xc0ee('0x8b'),_0xc0ee('0x8c'),'sentimentvalue','slainvokedidname',_0xc0ee('0x8d'),'socialprofileidname',_0xc0ee('0x8e'),_0xc0ee('0x8f'),'subjectidname',_0xc0ee('0x90'),_0xc0ee('0x91'),'transactioncurrencyidname',_0xc0ee('0x92'),_0xc0ee('0x93'),_0xc0ee('0x94')];var _0x113635=_0x283641[_0xc0ee('0x95')](_0x79e629);return db[_0xc0ee('0x2d')]['findOne']({'where':{'id':_0x4498df[_0xc0ee('0x4a')]['id']},'attributes':['id',_0xc0ee('0x96'),'password',_0xc0ee('0x97'),_0xc0ee('0x98'),_0xc0ee('0x99'),_0xc0ee('0x9a')]})[_0xc0ee('0x23')](handleEntityNotFound(_0xf9231b,null))['then'](function(_0x24da6a){if(_0x24da6a){_0x159d9a=_0x24da6a[_0xc0ee('0x97')];var _0x112f74=_0x159d9a[_0xc0ee('0x9b')](-0x1);if(_0x112f74==='/'){_0x159d9a=_0x159d9a['substring'](0x0,_0x159d9a['lastIndexOf'](_0x112f74));}_0x1b52be=util['format']('%s/api/data/v9.0/',_0x159d9a);var _0xd76588={'method':'POST','uri':_0xc0ee('0x9c')+_0x24da6a['tenantId']+_0xc0ee('0x9d'),'form':{'client_id':_0x24da6a['clientId'],'resource':_0x159d9a,'username':_0x24da6a[_0xc0ee('0x96')],'password':_0x24da6a[_0xc0ee('0x9e')],'grant_type':_0xc0ee('0x9e'),'client_secret':_0x24da6a[_0xc0ee('0x9a')]},'json':!![]};return rp(_0xd76588);}})['then'](function(_0x6ac32b){_0x29dd28=_0x6ac32b[_0xc0ee('0x9f')];var _0x1e45e3={'method':_0xc0ee('0xa0'),'uri':encodeURI(_0x1b52be+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x584a76+'\x27'),'headers':{'Authorization':_0xc0ee('0xa1')+_0x29dd28,'If-None-Match':null,'OData-Version':_0xc0ee('0xa2')},'json':!![]};return rp(_0x1e45e3);})[_0xc0ee('0x23')](function(_0x362a83){var _0x30a759=_0x362a83[_0xc0ee('0xa3')][0x0];var _0x2b575d=_0x30a759[_0xc0ee('0xa4')];var _0x3998a7={'method':_0xc0ee('0xa0'),'uri':_0x1b52be+_0xc0ee('0xa5')+_0x2b575d+_0xc0ee('0xa6'),'headers':{'Authorization':_0xc0ee('0xa1')+_0x29dd28,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3998a7);})[_0xc0ee('0x23')](function(_0x5bafb4){_0x39e23e=_0x5bafb4;_0xa6202e=_0x39e23e[_0xc0ee('0xa7')];_0xa6202e=_[_0xc0ee('0xa8')](_0xa6202e,function(_0x36044c){return!_0x113635['includes'](_0x36044c[_0xc0ee('0xa9')]);});var _0x56e689=[];var _0x12fb8e=[];_0xa6202e[_0xc0ee('0xaa')](function(_0x2f804d){if(_0x2f804d['@odata.type']){var _0x1760f4=_0x2f804d['@odata.type'][_0xc0ee('0xab')](_0x2f804d['@odata.type'][_0xc0ee('0xac')]('.')+0x1);if(_0x1760f4===_0xc0ee('0xad')){_0x56e689[_0xc0ee('0xae')](getSelectList(_0x1b52be,_0x4fa704,_0x12fb8e,_0x39e23e[_0xc0ee('0xa4')],_0x2f804d[_0xc0ee('0xa4')],_0x29dd28));}}});return Promise['all'](_0x56e689);})[_0xc0ee('0x23')](function(_0x478c59){_0x657ef5=_0x478c59[0x0];var _0x132181=[];var _0x558e1d=[];_0xa6202e[_0xc0ee('0xaa')](function(_0x18eaf6){if(!_[_0xc0ee('0xaf')](_0x18eaf6[_0xc0ee('0xb0')])){var _0x10f40a=_0x18eaf6[_0xc0ee('0xb0')][_0xc0ee('0xab')](_0x18eaf6[_0xc0ee('0xb0')]['lastIndexOf']('.')+0x1);if(_0x10f40a===_0xc0ee('0xb1')){_0x132181['push'](getBooleanList(_0x1b52be,_0x4fa704,_0x558e1d,_0x39e23e['MetadataId'],_0x18eaf6[_0xc0ee('0xa4')],_0x29dd28));}}});return Promise[_0xc0ee('0xb2')](_0x132181);})[_0xc0ee('0x23')](function(_0x89daec){_0x17a0c4=_0x89daec[0x0];var _0x3c3067=[];var _0x5c9758=[];_0xa6202e[_0xc0ee('0xaa')](function(_0x25864d){if(_0x25864d['@odata.type']){var _0x24a835=_0x25864d[_0xc0ee('0xb0')][_0xc0ee('0xab')](_0x25864d[_0xc0ee('0xb0')][_0xc0ee('0xac')]('.')+0x1);if(_0x24a835===_0xc0ee('0xb3')||_0x24a835===_0xc0ee('0xb4')||_0x24a835===_0xc0ee('0xb5')||_0x24a835===_0xc0ee('0xb6')||_0x24a835===_0xc0ee('0xb7')||_0x24a835===_0xc0ee('0xb8')||_0x24a835===_0xc0ee('0xb9')||_0x24a835===_0xc0ee('0xba')||_0x24a835===_0xc0ee('0xbb')||_0x24a835===_0xc0ee('0xbc')){_0x3c3067[_0xc0ee('0xae')](getInputList(_0x1b52be,_0x4fa704,_0x24a835,_0x5c9758,_0x39e23e[_0xc0ee('0xa4')],_0x25864d[_0xc0ee('0xa4')],_0x29dd28));}}});return Promise[_0xc0ee('0xb2')](_0x3c3067);})[_0xc0ee('0x23')](function(_0x26bb59){_0x3c6aa9=_0x26bb59[0x0];var _0x40b56e=_0x657ef5['concat'](_0x17a0c4)[_0xc0ee('0x95')](_0x3c6aa9);var _0x2dec5f={'count':_0x40b56e[_0xc0ee('0x45')],'rows':_0x40b56e};return _0x2dec5f;})[_0xc0ee('0x23')](respondWithResult(_0xf9231b,null))[_0xc0ee('0x44')](function(_0x4ec635){var _0x49c9ea=_0x4498df[_0xc0ee('0x31')][_0xc0ee('0xbd')]?0x1f4:_0x4ec635[_0xc0ee('0xbe')]||0x1f4;logger[_0xc0ee('0x27')](_0x4ec635[_0xc0ee('0x28')]);delete _0x4ec635['name'];if(_0x49c9ea===0x191){_0x49c9ea=0x190;}_0xf9231b[_0xc0ee('0x25')](_0x49c9ea)[_0xc0ee('0x2a')](_0x4498df[_0xc0ee('0x31')][_0xc0ee('0xbd')]?{'message':_0xc0ee('0xbf'),'statusCode':_0x4ec635[_0xc0ee('0xbe')]}:_0x4ec635);});};function getSelectList(_0x52c020,_0x2fe755,_0x1becdf,_0x1a876d,_0x44c997,_0x3004b1){var _0x356e28={'method':_0xc0ee('0xa0'),'uri':_0x52c020+'EntityDefinitions('+_0x1a876d+_0xc0ee('0xc0')+_0x44c997+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xc0ee('0xa1')+_0x3004b1,'If-None-Match':null,'OData-Version':_0xc0ee('0xa2')},'json':!![]};return rp(_0x356e28)[_0xc0ee('0x23')](function(_0x1284e8){var _0x380fae=[];var _0x221ed5=_0x1284e8[_0xc0ee('0xc1')][_0xc0ee('0xc2')];_0x221ed5[_0xc0ee('0xaa')](function(_0x3a6390){_0x380fae[_0xc0ee('0xae')]({'name':_0x3a6390[_0xc0ee('0xc3')][_0xc0ee('0xc4')][_0xc0ee('0xc3')],'value':String(_0x3a6390[_0xc0ee('0xc5')])});});var _0x3e1dcb={'id':_0x2fe755+'_'+_0x1284e8[_0xc0ee('0xa9')],'name':_0x1284e8[_0xc0ee('0xc6')][_0xc0ee('0xc4')]['Label'],'custom':![],'options':_0x380fae};_0x1becdf['push'](_0x3e1dcb);return _0x1becdf;});}function getBooleanList(_0x253219,_0x56f000,_0x336ae2,_0x19a781,_0x12d797,_0x2ab71d){var _0x2c1db2={'method':_0xc0ee('0xa0'),'uri':_0x253219+_0xc0ee('0xa5')+_0x19a781+_0xc0ee('0xc0')+_0x12d797+_0xc0ee('0xc7'),'headers':{'Authorization':_0xc0ee('0xa1')+_0x2ab71d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2c1db2)[_0xc0ee('0x23')](function(_0x598460){var _0x792c78=[];_0x792c78[_0xc0ee('0xae')]({'name':_0x598460['OptionSet'][_0xc0ee('0xc8')][_0xc0ee('0xc3')][_0xc0ee('0xc4')][_0xc0ee('0xc3')],'value':_0xc0ee('0xc9')},{'name':_0x598460[_0xc0ee('0xc1')]['FalseOption'][_0xc0ee('0xc3')][_0xc0ee('0xc4')][_0xc0ee('0xc3')],'value':'false'});var _0x2d0a0f={'id':_0x56f000+'_'+_0x598460['LogicalName'],'name':_0x598460[_0xc0ee('0xc6')][_0xc0ee('0xc4')][_0xc0ee('0xc3')],'custom':![],'options':_0x792c78};_0x336ae2[_0xc0ee('0xae')](_0x2d0a0f);return _0x336ae2;});}function getInputList(_0x340124,_0x21cb66,_0x264939,_0x5b76fc,_0x53d197,_0x36acaa,_0x57a87e){var _0x2b4c9d={'method':_0xc0ee('0xa0'),'uri':_0x340124+_0xc0ee('0xa5')+_0x53d197+_0xc0ee('0xc0')+_0x36acaa+_0xc0ee('0xca')+_0x264939+_0xc0ee('0xcb'),'headers':{'Authorization':_0xc0ee('0xa1')+_0x57a87e,'If-None-Match':null,'OData-Version':_0xc0ee('0xa2')},'json':!![]};return rp(_0x2b4c9d)['then'](function(_0x5bf618){var _0xa9864a={'id':_0x21cb66+'_'+_0x5bf618[_0xc0ee('0xa9')],'name':_0x5bf618[_0xc0ee('0xc6')][_0xc0ee('0xc4')]?_0x5bf618[_0xc0ee('0xc6')][_0xc0ee('0xc4')][_0xc0ee('0xc3')]:_0x5bf618[_0xc0ee('0xa9')],'custom':![],'options':[]};_0x5b76fc[_0xc0ee('0xae')](_0xa9864a);return _0x5b76fc;});} \ No newline at end of file +var _0x8781=['username','remoteUri','clientId','slice','substring','format','POST','tenantId','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','lastIndexOf','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','map','options','includeAll','findAll','rows','catch','show','Dynamics365Account','filters','length','include','find','create','body','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','Descriptions','channel','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','subject','phonenumber','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat'];(function(_0x44774d,_0x27fe98){var _0x282b23=function(_0x3b05d4){while(--_0x3b05d4){_0x44774d['push'](_0x44774d['shift']());}};_0x282b23(++_0x27fe98);}(_0x8781,0x1c8));var _0x1878=function(_0x5bfd0e,_0x3f6ed0){_0x5bfd0e=_0x5bfd0e-0x0;var _0x2ef199=_0x8781[_0x5bfd0e];return _0x2ef199;};'use strict';var emlformat=require(_0x1878('0x0'));var rimraf=require(_0x1878('0x1'));var zipdir=require(_0x1878('0x2'));var jsonpatch=require(_0x1878('0x3'));var rp=require(_0x1878('0x4'));var moment=require(_0x1878('0x5'));var BPromise=require(_0x1878('0x6'));var Mustache=require('mustache');var util=require(_0x1878('0x7'));var path=require(_0x1878('0x8'));var sox=require(_0x1878('0x9'));var csv=require(_0x1878('0xa'));var ejs=require(_0x1878('0xb'));var fs=require('fs');var fs_extra=require(_0x1878('0xc'));var _=require('lodash');var squel=require(_0x1878('0xd'));var crypto=require(_0x1878('0xe'));var jsforce=require(_0x1878('0xf'));var deskjs=require(_0x1878('0x10'));var toCsv=require(_0x1878('0xa'));var querystring=require(_0x1878('0x11'));var Papa=require(_0x1878('0x12'));var Redis=require(_0x1878('0x13'));var authService=require(_0x1878('0x14'));var qs=require(_0x1878('0x15'));var as=require(_0x1878('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1878('0x17'))(_0x1878('0x18'));var utils=require(_0x1878('0x19'));var config=require(_0x1878('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1878('0x1b'));function respondWithStatusCode(_0x1ed9f0,_0x181e51){_0x181e51=_0x181e51||0xcc;return function(_0x394d1d){if(_0x394d1d){return _0x1ed9f0['sendStatus'](_0x181e51);}return _0x1ed9f0['status'](_0x181e51)[_0x1878('0x1c')]();};}function respondWithResult(_0x396f3a,_0x49d3a1){_0x49d3a1=_0x49d3a1||0xc8;return function(_0x46992e){if(_0x46992e){return _0x396f3a[_0x1878('0x1d')](_0x49d3a1)[_0x1878('0x1e')](_0x46992e);}};}function respondWithFilteredResult(_0x4a5ba9,_0x562902){return function(_0x13e16d){if(_0x13e16d){var _0x450103=typeof _0x562902[_0x1878('0x1f')]===_0x1878('0x20')&&typeof _0x562902[_0x1878('0x21')]===_0x1878('0x20');var _0x1d6d24=_0x13e16d[_0x1878('0x22')];var _0x16c6b2=_0x450103?0x0:_0x562902[_0x1878('0x1f')];var _0x26943f=_0x450103?_0x13e16d['count']:_0x562902['offset']+_0x562902[_0x1878('0x21')];var _0x29c740;if(_0x26943f>=_0x1d6d24){_0x26943f=_0x1d6d24;_0x29c740=0xc8;}else{_0x29c740=0xce;}_0x4a5ba9['status'](_0x29c740);return _0x4a5ba9[_0x1878('0x23')](_0x1878('0x24'),_0x16c6b2+'-'+_0x26943f+'/'+_0x1d6d24)[_0x1878('0x1e')](_0x13e16d);}return null;};}function patchUpdates(_0x387f5){return function(_0x383956){try{jsonpatch['apply'](_0x383956,_0x387f5,!![]);}catch(_0x1ece6a){return BPromise['reject'](_0x1ece6a);}return _0x383956[_0x1878('0x25')]();};}function saveUpdates(_0x45e2b6,_0x2bc65b){return function(_0x2e9939){if(_0x2e9939){return _0x2e9939[_0x1878('0x26')](_0x45e2b6)['then'](function(_0x461905){return _0x461905;});}return null;};}function removeEntity(_0x10ce95,_0x215e59){return function(_0x2ce343){if(_0x2ce343){return _0x2ce343[_0x1878('0x27')]()[_0x1878('0x28')](function(){_0x10ce95[_0x1878('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x122c65,_0x10ab5c){return function(_0x243329){if(!_0x243329){_0x122c65[_0x1878('0x29')](0x194);}return _0x243329;};}function handleError(_0x46f5b7,_0x57580b){_0x57580b=_0x57580b||0x1f4;return function(_0x2f7e55){logger[_0x1878('0x2a')](_0x2f7e55[_0x1878('0x2b')]);if(_0x2f7e55[_0x1878('0x2c')]){delete _0x2f7e55['name'];}_0x46f5b7[_0x1878('0x1d')](_0x57580b)[_0x1878('0x2d')](_0x2f7e55);};}exports[_0x1878('0x2e')]=function(_0x31b2ba,_0x1eda2b){var _0x45e3db={},_0x49112c={},_0x35750c={'count':0x0,'rows':[]};var _0x6ad492=_['map'](db['Dynamics365Account'][_0x1878('0x2f')],function(_0x4f92eb){return{'name':_0x4f92eb['fieldName'],'type':_0x4f92eb[_0x1878('0x30')][_0x1878('0x31')]};});_0x49112c[_0x1878('0x32')]=_['map'](_0x6ad492,_0x1878('0x2c'));_0x49112c[_0x1878('0x33')]=_[_0x1878('0x34')](_0x31b2ba[_0x1878('0x33')]);_0x49112c['filters']=_[_0x1878('0x35')](_0x49112c[_0x1878('0x32')],_0x49112c[_0x1878('0x33')]);_0x45e3db['attributes']=_['intersection'](_0x49112c[_0x1878('0x32')],qs['fields'](_0x31b2ba[_0x1878('0x33')][_0x1878('0x36')]));_0x45e3db['attributes']=_0x45e3db['attributes']['length']?_0x45e3db[_0x1878('0x37')]:_0x49112c[_0x1878('0x32')];if(!_0x31b2ba[_0x1878('0x33')][_0x1878('0x38')]('nolimit')){_0x45e3db[_0x1878('0x21')]=qs['limit'](_0x31b2ba[_0x1878('0x33')][_0x1878('0x21')]);_0x45e3db['offset']=qs[_0x1878('0x1f')](_0x31b2ba[_0x1878('0x33')]['offset']);}_0x45e3db[_0x1878('0x39')]=qs[_0x1878('0x3a')](_0x31b2ba['query'][_0x1878('0x3a')]);_0x45e3db['where']=qs['filters'](_[_0x1878('0x3b')](_0x31b2ba[_0x1878('0x33')],_0x49112c['filters']),_0x6ad492);if(_0x31b2ba[_0x1878('0x33')][_0x1878('0x3c')]){_0x45e3db[_0x1878('0x3d')]=_[_0x1878('0x3e')](_0x45e3db['where'],{'$or':_[_0x1878('0x3f')](_0x6ad492,function(_0x1b6f2d){if(_0x1b6f2d[_0x1878('0x30')]!=='VIRTUAL'){var _0x4bbb1c={};_0x4bbb1c[_0x1b6f2d[_0x1878('0x2c')]]={'$like':'%'+_0x31b2ba[_0x1878('0x33')][_0x1878('0x3c')]+'%'};return _0x4bbb1c;}})});}_0x45e3db=_['merge']({},_0x45e3db,_0x31b2ba[_0x1878('0x40')]);var _0x3099e0={'where':_0x45e3db[_0x1878('0x3d')]};return db['Dynamics365Account'][_0x1878('0x22')](_0x3099e0)['then'](function(_0x2759ec){_0x35750c['count']=_0x2759ec;if(_0x31b2ba['query'][_0x1878('0x41')]){_0x45e3db['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x1878('0x42')](_0x45e3db);})[_0x1878('0x28')](function(_0x35c38e){_0x35750c[_0x1878('0x43')]=_0x35c38e;return _0x35750c;})[_0x1878('0x28')](respondWithFilteredResult(_0x1eda2b,_0x45e3db))[_0x1878('0x44')](handleError(_0x1eda2b,null));};exports[_0x1878('0x45')]=function(_0x53941c,_0x5c646f){var _0x5ceb54={'raw':![],'where':{'id':_0x53941c['params']['id']}},_0x4722ef={};_0x4722ef[_0x1878('0x32')]=_[_0x1878('0x34')](db[_0x1878('0x46')]['rawAttributes']);_0x4722ef[_0x1878('0x33')]=_[_0x1878('0x34')](_0x53941c[_0x1878('0x33')]);_0x4722ef[_0x1878('0x47')]=_[_0x1878('0x35')](_0x4722ef['model'],_0x4722ef['query']);_0x5ceb54[_0x1878('0x37')]=_[_0x1878('0x35')](_0x4722ef[_0x1878('0x32')],qs[_0x1878('0x36')](_0x53941c[_0x1878('0x33')]['fields']));_0x5ceb54[_0x1878('0x37')]=_0x5ceb54[_0x1878('0x37')][_0x1878('0x48')]?_0x5ceb54[_0x1878('0x37')]:_0x4722ef['model'];if(_0x53941c[_0x1878('0x33')][_0x1878('0x41')]){_0x5ceb54[_0x1878('0x49')]=[{'all':!![]}];}_0x5ceb54=_[_0x1878('0x3e')]({},_0x5ceb54,_0x53941c[_0x1878('0x40')]);return db[_0x1878('0x46')][_0x1878('0x4a')](_0x5ceb54)[_0x1878('0x28')](handleEntityNotFound(_0x5c646f,null))['then'](respondWithResult(_0x5c646f,null))[_0x1878('0x44')](handleError(_0x5c646f,null));};exports[_0x1878('0x4b')]=function(_0x503e7a,_0x2cc185){return db[_0x1878('0x46')][_0x1878('0x4b')](_0x503e7a[_0x1878('0x4c')],{})[_0x1878('0x28')](respondWithResult(_0x2cc185,0xc9))['catch'](handleError(_0x2cc185,null));};exports[_0x1878('0x26')]=function(_0x4f2ac1,_0x43a32f){if(_0x4f2ac1[_0x1878('0x4c')]['id']){delete _0x4f2ac1[_0x1878('0x4c')]['id'];}return db[_0x1878('0x46')][_0x1878('0x4a')]({'where':{'id':_0x4f2ac1[_0x1878('0x4d')]['id']}})[_0x1878('0x28')](handleEntityNotFound(_0x43a32f,null))[_0x1878('0x28')](saveUpdates(_0x4f2ac1[_0x1878('0x4c')],null))[_0x1878('0x28')](respondWithResult(_0x43a32f,null))[_0x1878('0x44')](handleError(_0x43a32f,null));};exports[_0x1878('0x27')]=function(_0x4eae25,_0x2cefa6){return db[_0x1878('0x46')][_0x1878('0x4a')]({'where':{'id':_0x4eae25[_0x1878('0x4d')]['id']}})[_0x1878('0x28')](handleEntityNotFound(_0x2cefa6,null))[_0x1878('0x28')](removeEntity(_0x2cefa6,null))[_0x1878('0x44')](handleError(_0x2cefa6,null));};exports[_0x1878('0x4e')]=function(_0x1d8b91,_0x2fcbcd,_0x134878){var _0x1e5a19={};var _0x169399={};var _0x3b952f;var _0x56870c;return db[_0x1878('0x46')][_0x1878('0x4f')]({'where':{'id':_0x1d8b91['params']['id']}})[_0x1878('0x28')](handleEntityNotFound(_0x2fcbcd,null))[_0x1878('0x28')](function(_0x59864b){if(_0x59864b){_0x3b952f=_0x59864b;_0x169399[_0x1878('0x32')]=_[_0x1878('0x34')](db['Dynamics365Configuration']['rawAttributes']);_0x169399['query']=_['keys'](_0x1d8b91['query']);_0x169399[_0x1878('0x47')]=_[_0x1878('0x35')](_0x169399[_0x1878('0x32')],_0x169399[_0x1878('0x33')]);_0x1e5a19[_0x1878('0x37')]=_[_0x1878('0x35')](_0x169399[_0x1878('0x32')],qs['fields'](_0x1d8b91[_0x1878('0x33')][_0x1878('0x36')]));_0x1e5a19[_0x1878('0x37')]=_0x1e5a19[_0x1878('0x37')][_0x1878('0x48')]?_0x1e5a19['attributes']:_0x169399[_0x1878('0x32')];_0x1e5a19[_0x1878('0x39')]=qs['sort'](_0x1d8b91[_0x1878('0x33')][_0x1878('0x3a')]);_0x1e5a19[_0x1878('0x3d')]=qs[_0x1878('0x47')](_[_0x1878('0x3b')](_0x1d8b91[_0x1878('0x33')],_0x169399['filters']));if(_0x1d8b91[_0x1878('0x33')]['filter']){_0x1e5a19['where']=_[_0x1878('0x3e')](_0x1e5a19[_0x1878('0x3d')],{'$or':_[_0x1878('0x3f')](_0x1e5a19[_0x1878('0x37')],function(_0x7cbe3a){var _0x3f4181={};_0x3f4181[_0x7cbe3a]={'$like':'%'+_0x1d8b91[_0x1878('0x33')][_0x1878('0x3c')]+'%'};return _0x3f4181;})});}_0x1e5a19=_['merge']({},_0x1e5a19,_0x1d8b91['options']);return _0x3b952f['getConfigurations'](_0x1e5a19);}})[_0x1878('0x28')](function(_0x16139f){if(_0x16139f){_0x56870c=_0x16139f[_0x1878('0x48')];if(!_0x1d8b91['query']['hasOwnProperty'](_0x1878('0x50'))){_0x1e5a19['limit']=qs['limit'](_0x1d8b91[_0x1878('0x33')]['limit']);_0x1e5a19['offset']=qs[_0x1878('0x1f')](_0x1d8b91['query']['offset']);}return _0x3b952f[_0x1878('0x4e')](_0x1e5a19);}})['then'](function(_0x3ab974){if(_0x3ab974){return _0x3ab974?{'count':_0x56870c,'rows':_0x3ab974}:null;}})[_0x1878('0x28')](respondWithResult(_0x2fcbcd,null))['catch'](handleError(_0x2fcbcd,null));};exports[_0x1878('0x51')]=function(_0x196803,_0x13e658,_0xc788a7){if(_0x196803[_0x1878('0x4c')]['id']){delete _0x196803[_0x1878('0x4c')]['id'];}return db[_0x1878('0x46')][_0x1878('0x4f')]({'where':{'id':_0x196803['params']['id']}})[_0x1878('0x28')](handleEntityNotFound(_0x13e658,null))['then'](function(_0x15f18f){if(_0x15f18f){_0x196803[_0x1878('0x4c')][_0x1878('0x52')]=_0x15f18f['id'];_0x196803[_0x1878('0x4c')][_0x1878('0x53')]=integrations['getSubjects'](_0x196803[_0x1878('0x4c')]['channel'],_0x196803[_0x1878('0x4c')]['type']);_0x196803[_0x1878('0x4c')][_0x1878('0x54')]=integrations['getDescriptions'](_0x196803[_0x1878('0x4c')][_0x1878('0x55')],_0x196803[_0x1878('0x4c')][_0x1878('0x30')]);return db['Dynamics365Configuration'][_0x1878('0x4b')](_0x196803[_0x1878('0x4c')],{'include':[{'model':db[_0x1878('0x56')],'as':_0x1878('0x53')},{'model':db[_0x1878('0x56')],'as':'Descriptions'}]});}return null;})[_0x1878('0x28')](respondWithResult(_0x13e658,null))[_0x1878('0x44')](handleError(_0x13e658,null));};exports['getFields']=function(_0x4c875b,_0xd3915b,_0x50a506){var _0x356525=_0x4c875b[_0x1878('0x33')][_0x1878('0x57')];var _0x216ecd=_0x356525===_0x1878('0x58')?_0x1878('0x59'):_0x1878('0x5a');var _0x298f8e='';var _0x19061e='';var _0x71fbbf='';var _0x2ec421='';var _0x11b692='';var _0x17841b='';var _0x611ba7='';var _0x52f298='';var _0x462615=[_0x1878('0x5b'),'description',_0x1878('0x5c'),_0x1878('0x5d'),'caseorigincode',_0x1878('0x5e'),_0x1878('0x5f'),'regardingobjectid','directioncode',_0x1878('0x60')];var _0x36d8b3=['accountidname',_0x1878('0x61'),_0x1878('0x62'),'billedserviceunits',_0x1878('0x63'),_0x1878('0x64'),_0x1878('0x65'),_0x1878('0x66'),'createdbyexternalpartyname',_0x1878('0x67'),_0x1878('0x68'),_0x1878('0x69'),'createdon',_0x1878('0x6a'),'createdonbehalfbyyominame',_0x1878('0x6b'),_0x1878('0x6c'),_0x1878('0x6d'),_0x1878('0x6e'),_0x1878('0x6f'),_0x1878('0x70'),_0x1878('0x71'),_0x1878('0x72'),_0x1878('0x73'),_0x1878('0x74'),_0x1878('0x75'),_0x1878('0x76'),_0x1878('0x77'),_0x1878('0x78'),'lastonholdtime',_0x1878('0x79'),'modifiedbyexternalpartyname',_0x1878('0x7a'),'modifiedbyname',_0x1878('0x7b'),_0x1878('0x7c'),_0x1878('0x7d'),_0x1878('0x7e'),_0x1878('0x7f'),_0x1878('0x80'),_0x1878('0x81'),'onholdtime',_0x1878('0x82'),_0x1878('0x83'),_0x1878('0x84'),'owneridyominame',_0x1878('0x85'),_0x1878('0x86'),_0x1878('0x87'),_0x1878('0x88'),'productidname','productserialnumber',_0x1878('0x89'),_0x1878('0x8a'),'responseby',_0x1878('0x8b'),_0x1878('0x8c'),_0x1878('0x8d'),'slainvokedidname','slaname',_0x1878('0x8e'),_0x1878('0x8f'),_0x1878('0x90'),'subjectidname','ticketnumber',_0x1878('0x91'),'transactioncurrencyidname',_0x1878('0x92'),_0x1878('0x93'),_0x1878('0x94')];var _0x295fc7=_0x462615[_0x1878('0x95')](_0x36d8b3);return db[_0x1878('0x46')][_0x1878('0x4f')]({'where':{'id':_0x4c875b[_0x1878('0x4d')]['id']},'attributes':['id',_0x1878('0x96'),'password',_0x1878('0x97'),'tenantId',_0x1878('0x98'),'clientSecret']})[_0x1878('0x28')](handleEntityNotFound(_0xd3915b,null))['then'](function(_0x4ace88){if(_0x4ace88){_0x52f298=_0x4ace88[_0x1878('0x97')];var _0x2a525b=_0x52f298[_0x1878('0x99')](-0x1);if(_0x2a525b==='/'){_0x52f298=_0x52f298[_0x1878('0x9a')](0x0,_0x52f298['lastIndexOf'](_0x2a525b));}_0x611ba7=util[_0x1878('0x9b')]('%s/api/data/v9.0/',_0x52f298);var _0x133e40={'method':_0x1878('0x9c'),'uri':'https://login.microsoftonline.com/'+_0x4ace88[_0x1878('0x9d')]+'/oauth2/token','form':{'client_id':_0x4ace88['clientId'],'resource':_0x52f298,'username':_0x4ace88['username'],'password':_0x4ace88[_0x1878('0x9e')],'grant_type':_0x1878('0x9e'),'client_secret':_0x4ace88['clientSecret']},'json':!![]};return rp(_0x133e40);}})[_0x1878('0x28')](function(_0x3834e3){_0x17841b=_0x3834e3[_0x1878('0x9f')];var _0x518702={'method':_0x1878('0xa0'),'uri':encodeURI(_0x611ba7+_0x1878('0xa1')+_0x216ecd+'\x27'),'headers':{'Authorization':_0x1878('0xa2')+_0x17841b,'If-None-Match':null,'OData-Version':_0x1878('0xa3')},'json':!![]};return rp(_0x518702);})[_0x1878('0x28')](function(_0x2a2a08){var _0x5480ee=_0x2a2a08[_0x1878('0xa4')][0x0];var _0x73580d=_0x5480ee[_0x1878('0xa5')];var _0x2bb0d8={'method':_0x1878('0xa0'),'uri':_0x611ba7+_0x1878('0xa6')+_0x73580d+_0x1878('0xa7'),'headers':{'Authorization':_0x1878('0xa2')+_0x17841b,'If-None-Match':null,'OData-Version':_0x1878('0xa3')},'json':!![]};return rp(_0x2bb0d8);})[_0x1878('0x28')](function(_0x6a3edb){_0x298f8e=_0x6a3edb;_0x19061e=_0x298f8e[_0x1878('0xa8')];_0x19061e=_[_0x1878('0xa9')](_0x19061e,function(_0x3f23da){return!_0x295fc7['includes'](_0x3f23da['LogicalName']);});var _0xbbb72b=[];var _0x113d35=[];_0x19061e[_0x1878('0xaa')](function(_0x16feda){if(_0x16feda[_0x1878('0xab')]){var _0x4f0bbd=_0x16feda[_0x1878('0xab')][_0x1878('0x9a')](_0x16feda[_0x1878('0xab')]['lastIndexOf']('.')+0x1);if(_0x4f0bbd===_0x1878('0xac')){_0xbbb72b[_0x1878('0xad')](getSelectList(_0x611ba7,_0x356525,_0x113d35,_0x298f8e[_0x1878('0xa5')],_0x16feda[_0x1878('0xa5')],_0x17841b));}}});return Promise[_0x1878('0xae')](_0xbbb72b);})[_0x1878('0x28')](function(_0x47e793){_0x71fbbf=_0x47e793[0x0];var _0xa8b936=[];var _0x415ceb=[];_0x19061e[_0x1878('0xaa')](function(_0x65987f){if(!_[_0x1878('0xaf')](_0x65987f['@odata.type'])){var _0x3c4672=_0x65987f['@odata.type'][_0x1878('0x9a')](_0x65987f['@odata.type']['lastIndexOf']('.')+0x1);if(_0x3c4672===_0x1878('0xb0')){_0xa8b936[_0x1878('0xad')](getBooleanList(_0x611ba7,_0x356525,_0x415ceb,_0x298f8e[_0x1878('0xa5')],_0x65987f[_0x1878('0xa5')],_0x17841b));}}});return Promise[_0x1878('0xae')](_0xa8b936);})[_0x1878('0x28')](function(_0x4171cf){_0x2ec421=_0x4171cf[0x0];var _0x493cd6=[];var _0x7c5a89=[];_0x19061e[_0x1878('0xaa')](function(_0x31526c){if(_0x31526c[_0x1878('0xab')]){var _0x5cbb0c=_0x31526c[_0x1878('0xab')][_0x1878('0x9a')](_0x31526c['@odata.type'][_0x1878('0xb1')]('.')+0x1);if(_0x5cbb0c===_0x1878('0xb2')||_0x5cbb0c===_0x1878('0xb3')||_0x5cbb0c==='BigIntAttributeMetadata'||_0x5cbb0c===_0x1878('0xb4')||_0x5cbb0c==='MemoAttributeMetadata'||_0x5cbb0c===_0x1878('0xb5')||_0x5cbb0c==='StatusAttributeMetadata'||_0x5cbb0c===_0x1878('0xb6')||_0x5cbb0c===_0x1878('0xb7')||_0x5cbb0c==='DecimalAttributeMetadata'){_0x493cd6[_0x1878('0xad')](getInputList(_0x611ba7,_0x356525,_0x5cbb0c,_0x7c5a89,_0x298f8e[_0x1878('0xa5')],_0x31526c[_0x1878('0xa5')],_0x17841b));}}});return Promise[_0x1878('0xae')](_0x493cd6);})[_0x1878('0x28')](function(_0x4e8423){_0x11b692=_0x4e8423[0x0];var _0x33058d=_0x71fbbf[_0x1878('0x95')](_0x2ec421)[_0x1878('0x95')](_0x11b692);var _0x3d5e52={'count':_0x33058d[_0x1878('0x48')],'rows':_0x33058d};return _0x3d5e52;})[_0x1878('0x28')](respondWithResult(_0xd3915b,null))[_0x1878('0x44')](function(_0x5d5dea){var _0x43ed64=_0x4c875b[_0x1878('0x33')][_0x1878('0xb8')]?0x1f4:_0x5d5dea['statusCode']||0x1f4;logger[_0x1878('0x2a')](_0x5d5dea['stack']);delete _0x5d5dea[_0x1878('0x2c')];if(_0x43ed64===0x191){_0x43ed64=0x190;}_0xd3915b[_0x1878('0x1d')](_0x43ed64)['send'](_0x4c875b[_0x1878('0x33')][_0x1878('0xb8')]?{'message':'Wrong\x20credentials','statusCode':_0x5d5dea[_0x1878('0xb9')]}:_0x5d5dea);});};function getSelectList(_0x2a7299,_0x3ac0ac,_0x58da41,_0x1aeaf,_0x1d7785,_0x2fc03b){var _0x2faf19={'method':_0x1878('0xa0'),'uri':_0x2a7299+_0x1878('0xa6')+_0x1aeaf+_0x1878('0xba')+_0x1d7785+_0x1878('0xbb')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x1878('0xa2')+_0x2fc03b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2faf19)['then'](function(_0x482cdf){var _0x15209e=[];var _0x138cf0=_0x482cdf[_0x1878('0xbc')][_0x1878('0xbd')];_0x138cf0[_0x1878('0xaa')](function(_0xbb39f1){_0x15209e[_0x1878('0xad')]({'name':_0xbb39f1[_0x1878('0xbe')][_0x1878('0xbf')][_0x1878('0xbe')],'value':String(_0xbb39f1[_0x1878('0xc0')])});});var _0x1b729b={'id':_0x3ac0ac+'_'+_0x482cdf[_0x1878('0xc1')],'name':_0x482cdf['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x15209e};_0x58da41[_0x1878('0xad')](_0x1b729b);return _0x58da41;});}function getBooleanList(_0x5dacf9,_0x30e065,_0x4db6a0,_0x175584,_0x586e10,_0x56e589){var _0x1deb1c={'method':_0x1878('0xa0'),'uri':_0x5dacf9+'EntityDefinitions('+_0x175584+_0x1878('0xba')+_0x586e10+_0x1878('0xc2'),'headers':{'Authorization':_0x1878('0xa2')+_0x56e589,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1deb1c)[_0x1878('0x28')](function(_0x50cf2f){var _0xbc6118=[];_0xbc6118[_0x1878('0xad')]({'name':_0x50cf2f[_0x1878('0xbc')][_0x1878('0xc3')][_0x1878('0xbe')][_0x1878('0xbf')][_0x1878('0xbe')],'value':_0x1878('0xc4')},{'name':_0x50cf2f[_0x1878('0xbc')][_0x1878('0xc5')][_0x1878('0xbe')][_0x1878('0xbf')][_0x1878('0xbe')],'value':_0x1878('0xc6')});var _0x5a8601={'id':_0x30e065+'_'+_0x50cf2f[_0x1878('0xc1')],'name':_0x50cf2f[_0x1878('0xc7')]['UserLocalizedLabel'][_0x1878('0xbe')],'custom':![],'options':_0xbc6118};_0x4db6a0[_0x1878('0xad')](_0x5a8601);return _0x4db6a0;});}function getInputList(_0x289d98,_0x4f9d42,_0x533cff,_0xb95c3,_0x1d2f58,_0x3f2dc0,_0x3495fb){var _0x2cd5d0={'method':_0x1878('0xa0'),'uri':_0x289d98+_0x1878('0xa6')+_0x1d2f58+_0x1878('0xba')+_0x3f2dc0+_0x1878('0xc8')+_0x533cff+_0x1878('0xc9'),'headers':{'Authorization':_0x1878('0xa2')+_0x3495fb,'If-None-Match':null,'OData-Version':_0x1878('0xa3')},'json':!![]};return rp(_0x2cd5d0)[_0x1878('0x28')](function(_0x32d75b){var _0x5376f5={'id':_0x4f9d42+'_'+_0x32d75b['LogicalName'],'name':_0x32d75b['DisplayName'][_0x1878('0xbf')]?_0x32d75b[_0x1878('0xc7')][_0x1878('0xbf')][_0x1878('0xbe')]:_0x32d75b[_0x1878('0xc1')],'custom':![],'options':[]};_0xb95c3[_0x1878('0xad')](_0x5376f5);return _0xb95c3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e0dee88..c0ab34c 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 _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x3fab85,_0x265709){var _0x372561=function(_0x1aa6c1){while(--_0x1aa6c1){_0x3fab85['push'](_0x3fab85['shift']());}};_0x372561(++_0x265709);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x417b3d,_0x4eb1f5){var _0x444e60=function(_0x5cc23a){while(--_0x5cc23a){_0x417b3d['push'](_0x417b3d['shift']());}};_0x444e60(++_0x4eb1f5);}(_0x757a,0xde));var _0xa757=function(_0x5f2c09,_0x15c8d2){_0x5f2c09=_0x5f2c09-0x0;var _0x10d7b4=_0x757a[_0x5f2c09];return _0x10d7b4;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 9a0e1e4..cb3ce78 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 _0xf21c=['Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','catch','ShowDynamics365Account','find','where','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf21c,0x184));var _0xcf21=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0xf21c[_0x31c19c];return _0x1a87f7;};'use strict';var _=require(_0xcf21('0x0'));var util=require(_0xcf21('0x1'));var moment=require('moment');var BPromise=require(_0xcf21('0x2'));var rs=require(_0xcf21('0x3'));var fs=require('fs');var Redis=require(_0xcf21('0x4'));var db=require(_0xcf21('0x5'))['db'];var utils=require(_0xcf21('0x6'));var logger=require(_0xcf21('0x7'))(_0xcf21('0x8'));var config=require(_0xcf21('0x9'));var jayson=require(_0xcf21('0xa'));var client=jayson[_0xcf21('0xb')][_0xcf21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27e967,_0x52ec84,_0x2fa252){return new BPromise(function(_0x313475,_0x4ae5e2){return client[_0xcf21('0xd')](_0x27e967,_0x2fa252)[_0xcf21('0xe')](function(_0x1e4f52){logger[_0xcf21('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x52ec84,'request\x20sent');logger[_0xcf21('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x52ec84,'request\x20sent',JSON['stringify'](_0x1e4f52));if(_0x1e4f52[_0xcf21('0x11')]){if(_0x1e4f52[_0xcf21('0x11')][_0xcf21('0x12')]===0x1f4){logger[_0xcf21('0x11')](_0xcf21('0x13'),_0x52ec84,_0x1e4f52[_0xcf21('0x11')][_0xcf21('0x14')]);return _0x4ae5e2(_0x1e4f52['error'][_0xcf21('0x14')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x52ec84,_0x1e4f52[_0xcf21('0x11')][_0xcf21('0x14')]);return _0x313475(_0x1e4f52[_0xcf21('0x11')][_0xcf21('0x14')]);}else{logger['info'](_0xcf21('0x13'),_0x52ec84,'request\x20sent');_0x313475(_0x1e4f52[_0xcf21('0x15')]['message']);}})['catch'](function(_0x3c8093){logger[_0xcf21('0x11')](_0xcf21('0x13'),_0x52ec84,_0x3c8093);_0x4ae5e2(_0x3c8093);});});}exports[_0xcf21('0x16')]=function(_0x40ab50){var _0x5eba00=this;return new Promise(function(_0x44d869,_0x173e15){return db[_0xcf21('0x17')][_0xcf21('0x18')]({'raw':_0x40ab50[_0xcf21('0x19')]?_0x40ab50[_0xcf21('0x19')][_0xcf21('0x1a')]===undefined?!![]:![]:!![],'where':_0x40ab50['options']?_0x40ab50[_0xcf21('0x19')]['where']||null:null,'attributes':_0x40ab50[_0xcf21('0x19')]?_0x40ab50[_0xcf21('0x19')][_0xcf21('0x1b')]||null:null,'limit':_0x40ab50['options']?_0x40ab50[_0xcf21('0x19')][_0xcf21('0x1c')]||null:null,'include':_0x40ab50[_0xcf21('0x19')]?_0x40ab50[_0xcf21('0x19')][_0xcf21('0x1d')]?_[_0xcf21('0x1e')](_0x40ab50['options']['include'],function(_0x188b56){return{'model':db[_0x188b56[_0xcf21('0x1f')]],'as':_0x188b56['as'],'attributes':_0x188b56[_0xcf21('0x1b')],'include':_0x188b56[_0xcf21('0x1d')]?_[_0xcf21('0x1e')](_0x188b56[_0xcf21('0x1d')],function(_0x49d7e1){return{'model':db[_0x49d7e1[_0xcf21('0x1f')]],'as':_0x49d7e1['as'],'attributes':_0x49d7e1[_0xcf21('0x1b')],'include':_0x49d7e1[_0xcf21('0x1d')]?_['map'](_0x49d7e1['include'],function(_0x348d56){return{'model':db[_0x348d56[_0xcf21('0x1f')]],'as':_0x348d56['as'],'attributes':_0x348d56['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf21('0xe')](function(_0x5177c4){logger[_0xcf21('0xf')]('GetDynamics365Account',_0x40ab50);logger[_0xcf21('0x10')](_0xcf21('0x16'),_0x40ab50,JSON['stringify'](_0x5177c4));_0x44d869(_0x5177c4);})[_0xcf21('0x20')](function(_0x506974){logger['error'](_0xcf21('0x16'),_0x506974[_0xcf21('0x14')],_0x40ab50);_0x173e15(_0x5eba00[_0xcf21('0x11')](0x1f4,_0x506974[_0xcf21('0x14')]));});});};exports[_0xcf21('0x21')]=function(_0x228749){var _0x583bd4=this;return new Promise(function(_0x3ad8ff,_0x4739bd){return db['Dynamics365Account'][_0xcf21('0x22')]({'raw':_0x228749[_0xcf21('0x19')]?_0x228749[_0xcf21('0x19')][_0xcf21('0x1a')]===undefined?!![]:![]:!![],'where':_0x228749['options']?_0x228749[_0xcf21('0x19')][_0xcf21('0x23')]||null:null,'attributes':_0x228749[_0xcf21('0x19')]?_0x228749[_0xcf21('0x19')][_0xcf21('0x1b')]||null:null,'include':_0x228749[_0xcf21('0x19')]?_0x228749[_0xcf21('0x19')]['include']?_[_0xcf21('0x1e')](_0x228749[_0xcf21('0x19')][_0xcf21('0x1d')],function(_0x259ce7){return{'model':db[_0x259ce7[_0xcf21('0x1f')]],'as':_0x259ce7['as'],'attributes':_0x259ce7[_0xcf21('0x1b')],'include':_0x259ce7['include']?_[_0xcf21('0x1e')](_0x259ce7['include'],function(_0xd392d0){return{'model':db[_0xd392d0['model']],'as':_0xd392d0['as'],'attributes':_0xd392d0[_0xcf21('0x1b')],'include':_0xd392d0[_0xcf21('0x1d')]?_[_0xcf21('0x1e')](_0xd392d0[_0xcf21('0x1d')],function(_0x5a7f13){return{'model':db[_0x5a7f13['model']],'as':_0x5a7f13['as'],'attributes':_0x5a7f13[_0xcf21('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51ae34){logger['info']('ShowDynamics365Account',_0x228749);logger[_0xcf21('0x10')](_0xcf21('0x21'),_0x228749,JSON[_0xcf21('0x24')](_0x51ae34));_0x3ad8ff(_0x51ae34);})['catch'](function(_0x1b0da0){logger[_0xcf21('0x11')]('ShowDynamics365Account',_0x1b0da0[_0xcf21('0x14')],_0x228749);_0x4739bd(_0x583bd4[_0xcf21('0x11')](0x1f4,_0x1b0da0[_0xcf21('0x14')]));});});}; \ No newline at end of file +var _0xfe00=['request\x20sent','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','model','include','map','catch','ShowDynamics365Account','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Dynamics365Account,\x20%s,\x20%s','debug'];(function(_0x27c439,_0x1f5140){var _0x3b23dd=function(_0xd91cb9){while(--_0xd91cb9){_0x27c439['push'](_0x27c439['shift']());}};_0x3b23dd(++_0x1f5140);}(_0xfe00,0x17e));var _0x0fe0=function(_0x13f0c6,_0x3e1aed){_0x13f0c6=_0x13f0c6-0x0;var _0x2edd6a=_0xfe00[_0x13f0c6];return _0x2edd6a;};'use strict';var _=require(_0x0fe0('0x0'));var util=require(_0x0fe0('0x1'));var moment=require(_0x0fe0('0x2'));var BPromise=require(_0x0fe0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fe0('0x4'))['db'];var utils=require(_0x0fe0('0x5'));var logger=require(_0x0fe0('0x6'))(_0x0fe0('0x7'));var config=require(_0x0fe0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0fe0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe6403f,_0x351e95,_0xefbb8d){return new BPromise(function(_0x86d19,_0x4d97c7){return client['request'](_0xe6403f,_0xefbb8d)[_0x0fe0('0xa')](function(_0x3c918b){logger[_0x0fe0('0xb')](_0x0fe0('0xc'),_0x351e95,'request\x20sent');logger[_0x0fe0('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x351e95,_0x0fe0('0xe'),JSON[_0x0fe0('0xf')](_0x3c918b));if(_0x3c918b[_0x0fe0('0x10')]){if(_0x3c918b[_0x0fe0('0x10')][_0x0fe0('0x11')]===0x1f4){logger[_0x0fe0('0x10')](_0x0fe0('0xc'),_0x351e95,_0x3c918b[_0x0fe0('0x10')]['message']);return _0x4d97c7(_0x3c918b[_0x0fe0('0x10')][_0x0fe0('0x12')]);}logger[_0x0fe0('0x10')](_0x0fe0('0xc'),_0x351e95,_0x3c918b[_0x0fe0('0x10')][_0x0fe0('0x12')]);return _0x86d19(_0x3c918b[_0x0fe0('0x10')][_0x0fe0('0x12')]);}else{logger[_0x0fe0('0xb')](_0x0fe0('0xc'),_0x351e95,'request\x20sent');_0x86d19(_0x3c918b[_0x0fe0('0x13')][_0x0fe0('0x12')]);}})['catch'](function(_0x364102){logger['error'](_0x0fe0('0xc'),_0x351e95,_0x364102);_0x4d97c7(_0x364102);});});}exports[_0x0fe0('0x14')]=function(_0x5eade2){var _0x990fab=this;return new Promise(function(_0x571dd3,_0x29b377){return db[_0x0fe0('0x15')]['findAll']({'raw':_0x5eade2[_0x0fe0('0x16')]?_0x5eade2[_0x0fe0('0x16')][_0x0fe0('0x17')]===undefined?!![]:![]:!![],'where':_0x5eade2[_0x0fe0('0x16')]?_0x5eade2[_0x0fe0('0x16')][_0x0fe0('0x18')]||null:null,'attributes':_0x5eade2['options']?_0x5eade2[_0x0fe0('0x16')][_0x0fe0('0x19')]||null:null,'limit':_0x5eade2['options']?_0x5eade2[_0x0fe0('0x16')][_0x0fe0('0x1a')]||null:null,'include':_0x5eade2[_0x0fe0('0x16')]?_0x5eade2[_0x0fe0('0x16')]['include']?_['map'](_0x5eade2['options']['include'],function(_0xb9ab6d){return{'model':db[_0xb9ab6d[_0x0fe0('0x1b')]],'as':_0xb9ab6d['as'],'attributes':_0xb9ab6d[_0x0fe0('0x19')],'include':_0xb9ab6d[_0x0fe0('0x1c')]?_['map'](_0xb9ab6d[_0x0fe0('0x1c')],function(_0x1b3540){return{'model':db[_0x1b3540[_0x0fe0('0x1b')]],'as':_0x1b3540['as'],'attributes':_0x1b3540['attributes'],'include':_0x1b3540[_0x0fe0('0x1c')]?_[_0x0fe0('0x1d')](_0x1b3540['include'],function(_0x25fbb1){return{'model':db[_0x25fbb1[_0x0fe0('0x1b')]],'as':_0x25fbb1['as'],'attributes':_0x25fbb1[_0x0fe0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0fe0('0xa')](function(_0x53efa2){logger['info'](_0x0fe0('0x14'),_0x5eade2);logger['debug'](_0x0fe0('0x14'),_0x5eade2,JSON['stringify'](_0x53efa2));_0x571dd3(_0x53efa2);})[_0x0fe0('0x1e')](function(_0x34e055){logger[_0x0fe0('0x10')](_0x0fe0('0x14'),_0x34e055[_0x0fe0('0x12')],_0x5eade2);_0x29b377(_0x990fab[_0x0fe0('0x10')](0x1f4,_0x34e055[_0x0fe0('0x12')]));});});};exports[_0x0fe0('0x1f')]=function(_0x8f27e3){var _0x25c38c=this;return new Promise(function(_0x562483,_0x3f19ec){return db[_0x0fe0('0x15')][_0x0fe0('0x20')]({'raw':_0x8f27e3[_0x0fe0('0x16')]?_0x8f27e3[_0x0fe0('0x16')][_0x0fe0('0x17')]===undefined?!![]:![]:!![],'where':_0x8f27e3[_0x0fe0('0x16')]?_0x8f27e3[_0x0fe0('0x16')][_0x0fe0('0x18')]||null:null,'attributes':_0x8f27e3[_0x0fe0('0x16')]?_0x8f27e3[_0x0fe0('0x16')][_0x0fe0('0x19')]||null:null,'include':_0x8f27e3[_0x0fe0('0x16')]?_0x8f27e3['options']['include']?_[_0x0fe0('0x1d')](_0x8f27e3['options'][_0x0fe0('0x1c')],function(_0x27695e){return{'model':db[_0x27695e[_0x0fe0('0x1b')]],'as':_0x27695e['as'],'attributes':_0x27695e['attributes'],'include':_0x27695e[_0x0fe0('0x1c')]?_[_0x0fe0('0x1d')](_0x27695e[_0x0fe0('0x1c')],function(_0x451f58){return{'model':db[_0x451f58[_0x0fe0('0x1b')]],'as':_0x451f58['as'],'attributes':_0x451f58[_0x0fe0('0x19')],'include':_0x451f58[_0x0fe0('0x1c')]?_[_0x0fe0('0x1d')](_0x451f58['include'],function(_0x52799b){return{'model':db[_0x52799b[_0x0fe0('0x1b')]],'as':_0x52799b['as'],'attributes':_0x52799b[_0x0fe0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0fe0('0xa')](function(_0x589147){logger['info'](_0x0fe0('0x1f'),_0x8f27e3);logger[_0x0fe0('0xd')](_0x0fe0('0x1f'),_0x8f27e3,JSON[_0x0fe0('0xf')](_0x589147));_0x562483(_0x589147);})[_0x0fe0('0x1e')](function(_0x4a1931){logger[_0x0fe0('0x10')](_0x0fe0('0x1f'),_0x4a1931['message'],_0x8f27e3);_0x3f19ec(_0x25c38c[_0x0fe0('0x10')](0x1f4,_0x4a1931['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6bb0d56..5ca7394 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 _0xb12d=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getSubjects','getDescriptions','post','create','update','exports','multer','util'];(function(_0x155cbb,_0x5bff9b){var _0x266dc4=function(_0x4211b2){while(--_0x4211b2){_0x155cbb['push'](_0x155cbb['shift']());}};_0x266dc4(++_0x5bff9b);}(_0xb12d,0x124));var _0xdb12=function(_0x41bfa8,_0x2222f0){_0x41bfa8=_0x41bfa8-0x0;var _0x5a689e=_0xb12d[_0x41bfa8];return _0x5a689e;};'use strict';var multer=require(_0xdb12('0x0'));var util=require(_0xdb12('0x1'));var path=require(_0xdb12('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb12('0x3'));var router=express['Router']();var fs_extra=require(_0xdb12('0x4'));var auth=require(_0xdb12('0x5'));var interaction=require(_0xdb12('0x6'));var config=require(_0xdb12('0x7'));var controller=require(_0xdb12('0x8'));router[_0xdb12('0x9')]('/',auth['isAuthenticated'](),controller[_0xdb12('0xa')]);router[_0xdb12('0x9')](_0xdb12('0xb'),auth[_0xdb12('0xc')](),controller[_0xdb12('0xd')]);router[_0xdb12('0x9')](_0xdb12('0xe'),auth[_0xdb12('0xc')](),controller['getFields']);router[_0xdb12('0x9')]('/:id/subjects',auth[_0xdb12('0xc')](),controller[_0xdb12('0xf')]);router[_0xdb12('0x9')]('/:id/descriptions',auth[_0xdb12('0xc')](),controller[_0xdb12('0x10')]);router[_0xdb12('0x11')]('/',auth['isAuthenticated'](),controller[_0xdb12('0x12')]);router['put'](_0xdb12('0xb'),auth[_0xdb12('0xc')](),controller[_0xdb12('0x13')]);router['delete'](_0xdb12('0xb'),auth[_0xdb12('0xc')](),controller['destroy']);module[_0xdb12('0x14')]=router; \ No newline at end of file +var _0x5d72=['create','put','update','delete','multer','util','path','express','fs-extra','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post'];(function(_0x35a8e5,_0x47fb0e){var _0x1f5929=function(_0xbb0c96){while(--_0xbb0c96){_0x35a8e5['push'](_0x35a8e5['shift']());}};_0x1f5929(++_0x47fb0e);}(_0x5d72,0x7c));var _0x25d7=function(_0x1a4cac,_0x116f47){_0x1a4cac=_0x1a4cac-0x0;var _0x142f2f=_0x5d72[_0x1a4cac];return _0x142f2f;};'use strict';var multer=require(_0x25d7('0x0'));var util=require(_0x25d7('0x1'));var path=require(_0x25d7('0x2'));var timeout=require('connect-timeout');var express=require(_0x25d7('0x3'));var router=express['Router']();var fs_extra=require(_0x25d7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x25d7('0x5'));router[_0x25d7('0x6')]('/',auth[_0x25d7('0x7')](),controller[_0x25d7('0x8')]);router[_0x25d7('0x6')](_0x25d7('0x9'),auth['isAuthenticated'](),controller[_0x25d7('0xa')]);router[_0x25d7('0x6')](_0x25d7('0xb'),auth[_0x25d7('0x7')](),controller[_0x25d7('0xc')]);router['get'](_0x25d7('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x25d7('0x6')]('/:id/descriptions',auth[_0x25d7('0x7')](),controller[_0x25d7('0xe')]);router[_0x25d7('0xf')]('/',auth['isAuthenticated'](),controller[_0x25d7('0x10')]);router[_0x25d7('0x11')]('/:id',auth[_0x25d7('0x7')](),controller[_0x25d7('0x12')]);router[_0x25d7('0x13')](_0x25d7('0x9'),auth[_0x25d7('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index b02433b..3598685 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 _0xef4c=['phonecall','incident','sequelize','exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xef4c,0x151));var _0xcef4=function(_0xedf4e0,_0x2e1e43){_0xedf4e0=_0xedf4e0-0x0;var _0x4a8c57=_0xef4c[_0xedf4e0];return _0x4a8c57;};'use strict';var Sequelize=require(_0xcef4('0x0'));module[_0xcef4('0x1')]={'name':{'type':Sequelize[_0xcef4('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('incident',_0xcef4('0x3')),'defaultValue':_0xcef4('0x4')}}; \ No newline at end of file +var _0x8183=['ENUM','incident','sequelize','STRING'];(function(_0xfca46f,_0x3faa68){var _0x2ab4fe=function(_0x5591b3){while(--_0x5591b3){_0xfca46f['push'](_0xfca46f['shift']());}};_0x2ab4fe(++_0x3faa68);}(_0x8183,0x6e));var _0x3818=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x8183[_0x1bbc08];return _0x5d825b;};'use strict';var Sequelize=require(_0x3818('0x0'));module['exports']={'name':{'type':Sequelize[_0x3818('0x1')]},'description':{'type':Sequelize[_0x3818('0x1')]},'ticketType':{'type':Sequelize[_0x3818('0x2')](_0x3818('0x3'),'phonecall'),'defaultValue':_0x3818('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 89a74ac..c811400 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 _0x86aa=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','model','find','catch','create','body','destroy','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','reject','save','update','then','end','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','keys','query'];(function(_0x3c2d1f,_0x404906){var _0x412a38=function(_0x781add){while(--_0x781add){_0x3c2d1f['push'](_0x3c2d1f['shift']());}};_0x412a38(++_0x404906);}(_0x86aa,0x1b8));var _0xa86a=function(_0x412ea0,_0x2f1245){_0x412ea0=_0x412ea0-0x0;var _0x174231=_0x86aa[_0x412ea0];return _0x174231;};'use strict';var emlformat=require(_0xa86a('0x0'));var rimraf=require(_0xa86a('0x1'));var zipdir=require(_0xa86a('0x2'));var jsonpatch=require(_0xa86a('0x3'));var rp=require(_0xa86a('0x4'));var moment=require(_0xa86a('0x5'));var BPromise=require(_0xa86a('0x6'));var Mustache=require(_0xa86a('0x7'));var util=require(_0xa86a('0x8'));var path=require(_0xa86a('0x9'));var sox=require(_0xa86a('0xa'));var csv=require(_0xa86a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa86a('0xc'));var squel=require(_0xa86a('0xd'));var crypto=require(_0xa86a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa86a('0xf'));var toCsv=require(_0xa86a('0xb'));var querystring=require(_0xa86a('0x10'));var Papa=require(_0xa86a('0x11'));var Redis=require(_0xa86a('0x12'));var authService=require(_0xa86a('0x13'));var qs=require(_0xa86a('0x14'));var as=require(_0xa86a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa86a('0x16'))(_0xa86a('0x17'));var utils=require(_0xa86a('0x18'));var config=require(_0xa86a('0x19'));var licenseUtil=require(_0xa86a('0x1a'));var db=require(_0xa86a('0x1b'))['db'];function respondWithStatusCode(_0x5b7f7c,_0x4a6b97){_0x4a6b97=_0x4a6b97||0xcc;return function(_0x34c422){if(_0x34c422){return _0x5b7f7c[_0xa86a('0x1c')](_0x4a6b97);}return _0x5b7f7c[_0xa86a('0x1d')](_0x4a6b97)['end']();};}function respondWithResult(_0x43343e,_0x3a8d38){_0x3a8d38=_0x3a8d38||0xc8;return function(_0x13c8ae){if(_0x13c8ae){return _0x43343e[_0xa86a('0x1d')](_0x3a8d38)['json'](_0x13c8ae);}};}function respondWithFilteredResult(_0x27603d,_0x2af4f6){return function(_0xf1e4b3){if(_0xf1e4b3){var _0x42903d=typeof _0x2af4f6[_0xa86a('0x1e')]==='undefined'&&typeof _0x2af4f6[_0xa86a('0x1f')]===_0xa86a('0x20');var _0x232f9d=_0xf1e4b3[_0xa86a('0x21')];var _0x14de17=_0x42903d?0x0:_0x2af4f6[_0xa86a('0x1e')];var _0x2422a7=_0x42903d?_0xf1e4b3[_0xa86a('0x21')]:_0x2af4f6[_0xa86a('0x1e')]+_0x2af4f6[_0xa86a('0x1f')];var _0x33f67f;if(_0x2422a7>=_0x232f9d){_0x2422a7=_0x232f9d;_0x33f67f=0xc8;}else{_0x33f67f=0xce;}_0x27603d['status'](_0x33f67f);return _0x27603d[_0xa86a('0x22')]('Content-Range',_0x14de17+'-'+_0x2422a7+'/'+_0x232f9d)['json'](_0xf1e4b3);}return null;};}function patchUpdates(_0x10169d){return function(_0x23b4a0){try{jsonpatch['apply'](_0x23b4a0,_0x10169d,!![]);}catch(_0x39acc9){return BPromise[_0xa86a('0x23')](_0x39acc9);}return _0x23b4a0[_0xa86a('0x24')]();};}function saveUpdates(_0x1668ed,_0x357595){return function(_0x4df1f7){if(_0x4df1f7){return _0x4df1f7[_0xa86a('0x25')](_0x1668ed)[_0xa86a('0x26')](function(_0x238931){return _0x238931;});}return null;};}function removeEntity(_0x24b9e9,_0x23a56d){return function(_0xc05dc1){if(_0xc05dc1){return _0xc05dc1['destroy']()[_0xa86a('0x26')](function(){_0x24b9e9['status'](0xcc)[_0xa86a('0x27')]();});}};}function handleEntityNotFound(_0x5e4fe3,_0x57cf0c){return function(_0x5d3423){if(!_0x5d3423){_0x5e4fe3[_0xa86a('0x1c')](0x194);}return _0x5d3423;};}function handleError(_0x4f4b54,_0x342693){_0x342693=_0x342693||0x1f4;return function(_0x270576){logger[_0xa86a('0x28')](_0x270576['stack']);if(_0x270576[_0xa86a('0x29')]){delete _0x270576[_0xa86a('0x29')];}_0x4f4b54[_0xa86a('0x1d')](_0x342693)[_0xa86a('0x2a')](_0x270576);};}exports[_0xa86a('0x2b')]=function(_0x2318ec,_0x3c1bb8){var _0x514cc3={},_0x20b198={},_0x13e509={'count':0x0,'rows':[]};var _0x447b03=_[_0xa86a('0x2c')](db[_0xa86a('0x2d')][_0xa86a('0x2e')],function(_0x2f5c46){return{'name':_0x2f5c46[_0xa86a('0x2f')],'type':_0x2f5c46[_0xa86a('0x30')][_0xa86a('0x31')]};});_0x20b198['model']=_[_0xa86a('0x2c')](_0x447b03,_0xa86a('0x29'));_0x20b198['query']=_[_0xa86a('0x32')](_0x2318ec[_0xa86a('0x33')]);_0x20b198[_0xa86a('0x34')]=_['intersection'](_0x20b198['model'],_0x20b198[_0xa86a('0x33')]);_0x514cc3[_0xa86a('0x35')]=_[_0xa86a('0x36')](_0x20b198['model'],qs['fields'](_0x2318ec[_0xa86a('0x33')][_0xa86a('0x37')]));_0x514cc3[_0xa86a('0x35')]=_0x514cc3[_0xa86a('0x35')][_0xa86a('0x38')]?_0x514cc3[_0xa86a('0x35')]:_0x20b198['model'];if(!_0x2318ec[_0xa86a('0x33')][_0xa86a('0x39')](_0xa86a('0x3a'))){_0x514cc3['limit']=qs['limit'](_0x2318ec['query'][_0xa86a('0x1f')]);_0x514cc3['offset']=qs[_0xa86a('0x1e')](_0x2318ec[_0xa86a('0x33')][_0xa86a('0x1e')]);}_0x514cc3[_0xa86a('0x3b')]=qs[_0xa86a('0x3c')](_0x2318ec[_0xa86a('0x33')][_0xa86a('0x3c')]);_0x514cc3[_0xa86a('0x3d')]=qs['filters'](_[_0xa86a('0x3e')](_0x2318ec[_0xa86a('0x33')],_0x20b198[_0xa86a('0x34')]),_0x447b03);if(_0x2318ec['query'][_0xa86a('0x3f')]){_0x514cc3[_0xa86a('0x3d')]=_[_0xa86a('0x40')](_0x514cc3[_0xa86a('0x3d')],{'$or':_[_0xa86a('0x2c')](_0x447b03,function(_0x2b562b){if(_0x2b562b[_0xa86a('0x30')]!==_0xa86a('0x41')){var _0x36ca18={};_0x36ca18[_0x2b562b[_0xa86a('0x29')]]={'$like':'%'+_0x2318ec[_0xa86a('0x33')]['filter']+'%'};return _0x36ca18;}})});}_0x514cc3=_[_0xa86a('0x40')]({},_0x514cc3,_0x2318ec[_0xa86a('0x42')]);var _0x4c4aa9={'where':_0x514cc3[_0xa86a('0x3d')]};return db[_0xa86a('0x2d')]['count'](_0x4c4aa9)[_0xa86a('0x26')](function(_0x23dd2f){_0x13e509[_0xa86a('0x21')]=_0x23dd2f;if(_0x2318ec['query'][_0xa86a('0x43')]){_0x514cc3['include']=[{'all':!![]}];}return db[_0xa86a('0x2d')]['findAll'](_0x514cc3);})[_0xa86a('0x26')](function(_0x389736){_0x13e509[_0xa86a('0x44')]=_0x389736;return _0x13e509;})[_0xa86a('0x26')](respondWithFilteredResult(_0x3c1bb8,_0x514cc3))['catch'](handleError(_0x3c1bb8,null));};exports[_0xa86a('0x45')]=function(_0x44ffed,_0x1c58e0){var _0x290d8e={'raw':![],'where':{'id':_0x44ffed[_0xa86a('0x46')]['id']}},_0x3aad29={};_0x3aad29[_0xa86a('0x47')]=_['keys'](db[_0xa86a('0x2d')]['rawAttributes']);_0x3aad29['query']=_['keys'](_0x44ffed['query']);_0x3aad29[_0xa86a('0x34')]=_['intersection'](_0x3aad29[_0xa86a('0x47')],_0x3aad29[_0xa86a('0x33')]);_0x290d8e[_0xa86a('0x35')]=_['intersection'](_0x3aad29['model'],qs[_0xa86a('0x37')](_0x44ffed['query'][_0xa86a('0x37')]));_0x290d8e['attributes']=_0x290d8e['attributes'][_0xa86a('0x38')]?_0x290d8e['attributes']:_0x3aad29[_0xa86a('0x47')];if(_0x44ffed[_0xa86a('0x33')][_0xa86a('0x43')]){_0x290d8e['include']=[{'all':!![]}];}_0x290d8e=_['merge']({},_0x290d8e,_0x44ffed[_0xa86a('0x42')]);return db[_0xa86a('0x2d')][_0xa86a('0x48')](_0x290d8e)[_0xa86a('0x26')](handleEntityNotFound(_0x1c58e0,null))['then'](respondWithResult(_0x1c58e0,null))[_0xa86a('0x49')](handleError(_0x1c58e0,null));};exports[_0xa86a('0x4a')]=function(_0x592de9,_0x27ac06){return db[_0xa86a('0x2d')][_0xa86a('0x4a')](_0x592de9[_0xa86a('0x4b')],{})[_0xa86a('0x26')](respondWithResult(_0x27ac06,0xc9))['catch'](handleError(_0x27ac06,null));};exports[_0xa86a('0x25')]=function(_0x1bd6bb,_0x49943d){if(_0x1bd6bb[_0xa86a('0x4b')]['id']){delete _0x1bd6bb[_0xa86a('0x4b')]['id'];}return db[_0xa86a('0x2d')]['find']({'where':{'id':_0x1bd6bb[_0xa86a('0x46')]['id']}})[_0xa86a('0x26')](handleEntityNotFound(_0x49943d,null))['then'](saveUpdates(_0x1bd6bb[_0xa86a('0x4b')],null))[_0xa86a('0x26')](respondWithResult(_0x49943d,null))['catch'](handleError(_0x49943d,null));};exports[_0xa86a('0x4c')]=function(_0x1522f3,_0x442f05){return db[_0xa86a('0x2d')][_0xa86a('0x48')]({'where':{'id':_0x1522f3['params']['id']}})[_0xa86a('0x26')](handleEntityNotFound(_0x442f05,null))[_0xa86a('0x26')](removeEntity(_0x442f05,null))['catch'](handleError(_0x442f05,null));};exports[_0xa86a('0x4d')]=function(_0x368e96,_0x1a2b1c,_0x483d0f){var _0x1fa3b8={};var _0x3ee375={};var _0x3323f7;var _0x572b49;return db[_0xa86a('0x2d')][_0xa86a('0x4e')]({'where':{'id':_0x368e96[_0xa86a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a2b1c,null))['then'](function(_0x28b5ec){if(_0x28b5ec){_0x3323f7=_0x28b5ec;_0x3ee375[_0xa86a('0x47')]=_['keys'](db[_0xa86a('0x4f')][_0xa86a('0x2e')]);_0x3ee375['query']=_[_0xa86a('0x32')](_0x368e96[_0xa86a('0x33')]);_0x3ee375['filters']=_['intersection'](_0x3ee375[_0xa86a('0x47')],_0x3ee375['query']);_0x1fa3b8[_0xa86a('0x35')]=_[_0xa86a('0x36')](_0x3ee375[_0xa86a('0x47')],qs[_0xa86a('0x37')](_0x368e96[_0xa86a('0x33')][_0xa86a('0x37')]));_0x1fa3b8['attributes']=_0x1fa3b8[_0xa86a('0x35')][_0xa86a('0x38')]?_0x1fa3b8[_0xa86a('0x35')]:_0x3ee375[_0xa86a('0x47')];_0x1fa3b8[_0xa86a('0x3b')]=qs[_0xa86a('0x3c')](_0x368e96[_0xa86a('0x33')]['sort']);_0x1fa3b8[_0xa86a('0x3d')]=qs[_0xa86a('0x34')](_[_0xa86a('0x3e')](_0x368e96['query'],_0x3ee375[_0xa86a('0x34')]));if(_0x368e96[_0xa86a('0x33')][_0xa86a('0x3f')]){_0x1fa3b8[_0xa86a('0x3d')]=_[_0xa86a('0x40')](_0x1fa3b8[_0xa86a('0x3d')],{'$or':_['map'](_0x1fa3b8['attributes'],function(_0x46e414){var _0x3fa345={};_0x3fa345[_0x46e414]={'$like':'%'+_0x368e96[_0xa86a('0x33')]['filter']+'%'};return _0x3fa345;})});}_0x1fa3b8=_[_0xa86a('0x40')]({},_0x1fa3b8,_0x368e96[_0xa86a('0x42')]);return _0x3323f7['getFields'](_0x1fa3b8);}})[_0xa86a('0x26')](function(_0x2ce06f){if(_0x2ce06f){_0x572b49=_0x2ce06f[_0xa86a('0x38')];if(!_0x368e96[_0xa86a('0x33')][_0xa86a('0x39')](_0xa86a('0x3a'))){_0x1fa3b8['limit']=qs['limit'](_0x368e96[_0xa86a('0x33')]['limit']);_0x1fa3b8[_0xa86a('0x1e')]=qs[_0xa86a('0x1e')](_0x368e96[_0xa86a('0x33')][_0xa86a('0x1e')]);}return _0x3323f7[_0xa86a('0x4d')](_0x1fa3b8);}})[_0xa86a('0x26')](function(_0x3ccc59){if(_0x3ccc59){return _0x3ccc59?{'count':_0x572b49,'rows':_0x3ccc59}:null;}})[_0xa86a('0x26')](respondWithResult(_0x1a2b1c,null))[_0xa86a('0x49')](handleError(_0x1a2b1c,null));};exports[_0xa86a('0x50')]=function(_0xae55d4,_0x3bafde,_0x5f251e){var _0x4639a3={};var _0x2d68ec={};var _0x4864b9;var _0x38b668;return db['Dynamics365Configuration'][_0xa86a('0x4e')]({'where':{'id':_0xae55d4['params']['id']}})['then'](handleEntityNotFound(_0x3bafde,null))[_0xa86a('0x26')](function(_0x192488){if(_0x192488){_0x4864b9=_0x192488;_0x2d68ec[_0xa86a('0x47')]=_[_0xa86a('0x32')](db[_0xa86a('0x4f')][_0xa86a('0x2e')]);_0x2d68ec['query']=_[_0xa86a('0x32')](_0xae55d4[_0xa86a('0x33')]);_0x2d68ec[_0xa86a('0x34')]=_[_0xa86a('0x36')](_0x2d68ec[_0xa86a('0x47')],_0x2d68ec[_0xa86a('0x33')]);_0x4639a3[_0xa86a('0x35')]=_['intersection'](_0x2d68ec[_0xa86a('0x47')],qs[_0xa86a('0x37')](_0xae55d4['query'][_0xa86a('0x37')]));_0x4639a3['attributes']=_0x4639a3[_0xa86a('0x35')][_0xa86a('0x38')]?_0x4639a3['attributes']:_0x2d68ec['model'];_0x4639a3[_0xa86a('0x3b')]=qs['sort'](_0xae55d4[_0xa86a('0x33')][_0xa86a('0x3c')]);_0x4639a3[_0xa86a('0x3d')]=qs['filters'](_[_0xa86a('0x3e')](_0xae55d4[_0xa86a('0x33')],_0x2d68ec['filters']));if(_0xae55d4[_0xa86a('0x33')]['filter']){_0x4639a3[_0xa86a('0x3d')]=_['merge'](_0x4639a3[_0xa86a('0x3d')],{'$or':_['map'](_0x4639a3[_0xa86a('0x35')],function(_0x5a5eca){var _0x3e45a8={};_0x3e45a8[_0x5a5eca]={'$like':'%'+_0xae55d4[_0xa86a('0x33')][_0xa86a('0x3f')]+'%'};return _0x3e45a8;})});}_0x4639a3=_[_0xa86a('0x40')]({},_0x4639a3,_0xae55d4[_0xa86a('0x42')]);return _0x4864b9[_0xa86a('0x50')](_0x4639a3);}})[_0xa86a('0x26')](function(_0x461f10){if(_0x461f10){_0x38b668=_0x461f10['length'];if(!_0xae55d4[_0xa86a('0x33')][_0xa86a('0x39')](_0xa86a('0x3a'))){_0x4639a3[_0xa86a('0x1f')]=qs[_0xa86a('0x1f')](_0xae55d4[_0xa86a('0x33')][_0xa86a('0x1f')]);_0x4639a3[_0xa86a('0x1e')]=qs['offset'](_0xae55d4[_0xa86a('0x33')][_0xa86a('0x1e')]);}return _0x4864b9[_0xa86a('0x50')](_0x4639a3);}})['then'](function(_0x267ae5){if(_0x267ae5){return _0x267ae5?{'count':_0x38b668,'rows':_0x267ae5}:null;}})['then'](respondWithResult(_0x3bafde,null))[_0xa86a('0x49')](handleError(_0x3bafde,null));};exports[_0xa86a('0x51')]=function(_0x5e459e,_0x1e7ed4,_0x2e1490){var _0x555631={};var _0x370669={};var _0x1e7035;var _0x88b2cc;return db[_0xa86a('0x2d')]['findOne']({'where':{'id':_0x5e459e[_0xa86a('0x46')]['id']}})[_0xa86a('0x26')](handleEntityNotFound(_0x1e7ed4,null))[_0xa86a('0x26')](function(_0x1dd09e){if(_0x1dd09e){_0x1e7035=_0x1dd09e;_0x370669[_0xa86a('0x47')]=_['keys'](db['Dynamics365Field'][_0xa86a('0x2e')]);_0x370669[_0xa86a('0x33')]=_[_0xa86a('0x32')](_0x5e459e[_0xa86a('0x33')]);_0x370669[_0xa86a('0x34')]=_['intersection'](_0x370669[_0xa86a('0x47')],_0x370669[_0xa86a('0x33')]);_0x555631[_0xa86a('0x35')]=_['intersection'](_0x370669[_0xa86a('0x47')],qs['fields'](_0x5e459e[_0xa86a('0x33')][_0xa86a('0x37')]));_0x555631['attributes']=_0x555631[_0xa86a('0x35')][_0xa86a('0x38')]?_0x555631[_0xa86a('0x35')]:_0x370669['model'];_0x555631[_0xa86a('0x3b')]=qs['sort'](_0x5e459e[_0xa86a('0x33')][_0xa86a('0x3c')]);_0x555631[_0xa86a('0x3d')]=qs[_0xa86a('0x34')](_[_0xa86a('0x3e')](_0x5e459e[_0xa86a('0x33')],_0x370669[_0xa86a('0x34')]));if(_0x5e459e[_0xa86a('0x33')][_0xa86a('0x3f')]){_0x555631[_0xa86a('0x3d')]=_[_0xa86a('0x40')](_0x555631['where'],{'$or':_[_0xa86a('0x2c')](_0x555631[_0xa86a('0x35')],function(_0x153a88){var _0x38e03f={};_0x38e03f[_0x153a88]={'$like':'%'+_0x5e459e[_0xa86a('0x33')]['filter']+'%'};return _0x38e03f;})});}_0x555631=_[_0xa86a('0x40')]({},_0x555631,_0x5e459e[_0xa86a('0x42')]);return _0x1e7035[_0xa86a('0x51')](_0x555631);}})['then'](function(_0x4b57c2){if(_0x4b57c2){_0x88b2cc=_0x4b57c2[_0xa86a('0x38')];if(!_0x5e459e[_0xa86a('0x33')][_0xa86a('0x39')](_0xa86a('0x3a'))){_0x555631['limit']=qs[_0xa86a('0x1f')](_0x5e459e[_0xa86a('0x33')][_0xa86a('0x1f')]);_0x555631['offset']=qs['offset'](_0x5e459e[_0xa86a('0x33')]['offset']);}return _0x1e7035['getDescriptions'](_0x555631);}})[_0xa86a('0x26')](function(_0x128c41){if(_0x128c41){return _0x128c41?{'count':_0x88b2cc,'rows':_0x128c41}:null;}})[_0xa86a('0x26')](respondWithResult(_0x1e7ed4,null))[_0xa86a('0x49')](handleError(_0x1e7ed4,null));}; \ No newline at end of file +var _0xba77=['catch','getFields','sort','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','update','then','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','key','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','filters','pick','filter','where','VIRTUAL','merge','options','findAll','params','keys','includeAll','include','find','body'];(function(_0x420903,_0x2b07eb){var _0x5b4d13=function(_0x52f21c){while(--_0x52f21c){_0x420903['push'](_0x420903['shift']());}};_0x5b4d13(++_0x2b07eb);}(_0xba77,0x98));var _0x7ba7=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0xba77[_0x507ac5];return _0x12c1bc;};'use strict';var emlformat=require(_0x7ba7('0x0'));var rimraf=require(_0x7ba7('0x1'));var zipdir=require(_0x7ba7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ba7('0x3'));var moment=require(_0x7ba7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7ba7('0x5'));var util=require(_0x7ba7('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7ba7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ba7('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ba7('0x9'));var deskjs=require(_0x7ba7('0xa'));var toCsv=require(_0x7ba7('0xb'));var querystring=require(_0x7ba7('0xc'));var Papa=require(_0x7ba7('0xd'));var Redis=require('ioredis');var authService=require(_0x7ba7('0xe'));var qs=require(_0x7ba7('0xf'));var as=require(_0x7ba7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ba7('0x11'))(_0x7ba7('0x12'));var utils=require(_0x7ba7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7ba7('0x14'));var db=require(_0x7ba7('0x15'))['db'];function respondWithStatusCode(_0x4c43e4,_0xdf8255){_0xdf8255=_0xdf8255||0xcc;return function(_0x3fd7b3){if(_0x3fd7b3){return _0x4c43e4[_0x7ba7('0x16')](_0xdf8255);}return _0x4c43e4['status'](_0xdf8255)[_0x7ba7('0x17')]();};}function respondWithResult(_0x3e0f5d,_0x218e83){_0x218e83=_0x218e83||0xc8;return function(_0x47cf74){if(_0x47cf74){return _0x3e0f5d['status'](_0x218e83)[_0x7ba7('0x18')](_0x47cf74);}};}function respondWithFilteredResult(_0x280a5b,_0xcce010){return function(_0x1df006){if(_0x1df006){var _0x5064d3=typeof _0xcce010[_0x7ba7('0x19')]===_0x7ba7('0x1a')&&typeof _0xcce010[_0x7ba7('0x1b')]==='undefined';var _0x207717=_0x1df006[_0x7ba7('0x1c')];var _0x586049=_0x5064d3?0x0:_0xcce010[_0x7ba7('0x19')];var _0x2c90c8=_0x5064d3?_0x1df006['count']:_0xcce010[_0x7ba7('0x19')]+_0xcce010[_0x7ba7('0x1b')];var _0x1fd7e4;if(_0x2c90c8>=_0x207717){_0x2c90c8=_0x207717;_0x1fd7e4=0xc8;}else{_0x1fd7e4=0xce;}_0x280a5b[_0x7ba7('0x1d')](_0x1fd7e4);return _0x280a5b[_0x7ba7('0x1e')]('Content-Range',_0x586049+'-'+_0x2c90c8+'/'+_0x207717)[_0x7ba7('0x18')](_0x1df006);}return null;};}function patchUpdates(_0x24a020){return function(_0x2e4624){try{jsonpatch['apply'](_0x2e4624,_0x24a020,!![]);}catch(_0x3ae453){return BPromise[_0x7ba7('0x1f')](_0x3ae453);}return _0x2e4624['save']();};}function saveUpdates(_0x2014d4,_0x5f2ff4){return function(_0x511585){if(_0x511585){return _0x511585[_0x7ba7('0x20')](_0x2014d4)[_0x7ba7('0x21')](function(_0x8fedf0){return _0x8fedf0;});}return null;};}function removeEntity(_0x688b0c,_0x248676){return function(_0x2a03dd){if(_0x2a03dd){return _0x2a03dd[_0x7ba7('0x22')]()['then'](function(){_0x688b0c[_0x7ba7('0x1d')](0xcc)[_0x7ba7('0x17')]();});}};}function handleEntityNotFound(_0x4431a9,_0x1cbb01){return function(_0x38f562){if(!_0x38f562){_0x4431a9['sendStatus'](0x194);}return _0x38f562;};}function handleError(_0xe7f371,_0x2aa8b7){_0x2aa8b7=_0x2aa8b7||0x1f4;return function(_0x4ed73a){logger['error'](_0x4ed73a[_0x7ba7('0x23')]);if(_0x4ed73a[_0x7ba7('0x24')]){delete _0x4ed73a[_0x7ba7('0x24')];}_0xe7f371[_0x7ba7('0x1d')](_0x2aa8b7)[_0x7ba7('0x25')](_0x4ed73a);};}exports[_0x7ba7('0x26')]=function(_0x125b0a,_0x3c4f65){var _0x2d9f0b={},_0x5c7acb={},_0x2d5090={'count':0x0,'rows':[]};var _0xa5bec=_[_0x7ba7('0x27')](db[_0x7ba7('0x28')][_0x7ba7('0x29')],function(_0x410f83){return{'name':_0x410f83['fieldName'],'type':_0x410f83[_0x7ba7('0x2a')][_0x7ba7('0x2b')]};});_0x5c7acb['model']=_[_0x7ba7('0x27')](_0xa5bec,_0x7ba7('0x24'));_0x5c7acb[_0x7ba7('0x2c')]=_['keys'](_0x125b0a[_0x7ba7('0x2c')]);_0x5c7acb['filters']=_[_0x7ba7('0x2d')](_0x5c7acb['model'],_0x5c7acb[_0x7ba7('0x2c')]);_0x2d9f0b[_0x7ba7('0x2e')]=_[_0x7ba7('0x2d')](_0x5c7acb['model'],qs[_0x7ba7('0x2f')](_0x125b0a['query'][_0x7ba7('0x2f')]));_0x2d9f0b[_0x7ba7('0x2e')]=_0x2d9f0b['attributes'][_0x7ba7('0x30')]?_0x2d9f0b[_0x7ba7('0x2e')]:_0x5c7acb[_0x7ba7('0x31')];if(!_0x125b0a[_0x7ba7('0x2c')][_0x7ba7('0x32')](_0x7ba7('0x33'))){_0x2d9f0b[_0x7ba7('0x1b')]=qs['limit'](_0x125b0a['query'][_0x7ba7('0x1b')]);_0x2d9f0b[_0x7ba7('0x19')]=qs['offset'](_0x125b0a['query'][_0x7ba7('0x19')]);}_0x2d9f0b[_0x7ba7('0x34')]=qs['sort'](_0x125b0a[_0x7ba7('0x2c')]['sort']);_0x2d9f0b['where']=qs[_0x7ba7('0x35')](_[_0x7ba7('0x36')](_0x125b0a[_0x7ba7('0x2c')],_0x5c7acb[_0x7ba7('0x35')]),_0xa5bec);if(_0x125b0a[_0x7ba7('0x2c')][_0x7ba7('0x37')]){_0x2d9f0b['where']=_['merge'](_0x2d9f0b[_0x7ba7('0x38')],{'$or':_[_0x7ba7('0x27')](_0xa5bec,function(_0x534a35){if(_0x534a35[_0x7ba7('0x2a')]!==_0x7ba7('0x39')){var _0x476fe8={};_0x476fe8[_0x534a35[_0x7ba7('0x24')]]={'$like':'%'+_0x125b0a[_0x7ba7('0x2c')][_0x7ba7('0x37')]+'%'};return _0x476fe8;}})});}_0x2d9f0b=_[_0x7ba7('0x3a')]({},_0x2d9f0b,_0x125b0a[_0x7ba7('0x3b')]);var _0x585f30={'where':_0x2d9f0b[_0x7ba7('0x38')]};return db['Dynamics365Configuration'][_0x7ba7('0x1c')](_0x585f30)['then'](function(_0x54efb8){_0x2d5090[_0x7ba7('0x1c')]=_0x54efb8;if(_0x125b0a[_0x7ba7('0x2c')]['includeAll']){_0x2d9f0b['include']=[{'all':!![]}];}return db[_0x7ba7('0x28')][_0x7ba7('0x3c')](_0x2d9f0b);})[_0x7ba7('0x21')](function(_0x2a723d){_0x2d5090['rows']=_0x2a723d;return _0x2d5090;})['then'](respondWithFilteredResult(_0x3c4f65,_0x2d9f0b))['catch'](handleError(_0x3c4f65,null));};exports['show']=function(_0x133c9e,_0xdc68fe){var _0x49642={'raw':![],'where':{'id':_0x133c9e[_0x7ba7('0x3d')]['id']}},_0x1c0269={};_0x1c0269[_0x7ba7('0x31')]=_['keys'](db[_0x7ba7('0x28')][_0x7ba7('0x29')]);_0x1c0269['query']=_[_0x7ba7('0x3e')](_0x133c9e[_0x7ba7('0x2c')]);_0x1c0269[_0x7ba7('0x35')]=_[_0x7ba7('0x2d')](_0x1c0269[_0x7ba7('0x31')],_0x1c0269[_0x7ba7('0x2c')]);_0x49642[_0x7ba7('0x2e')]=_[_0x7ba7('0x2d')](_0x1c0269[_0x7ba7('0x31')],qs['fields'](_0x133c9e['query'][_0x7ba7('0x2f')]));_0x49642['attributes']=_0x49642[_0x7ba7('0x2e')][_0x7ba7('0x30')]?_0x49642[_0x7ba7('0x2e')]:_0x1c0269[_0x7ba7('0x31')];if(_0x133c9e[_0x7ba7('0x2c')][_0x7ba7('0x3f')]){_0x49642[_0x7ba7('0x40')]=[{'all':!![]}];}_0x49642=_[_0x7ba7('0x3a')]({},_0x49642,_0x133c9e[_0x7ba7('0x3b')]);return db[_0x7ba7('0x28')][_0x7ba7('0x41')](_0x49642)['then'](handleEntityNotFound(_0xdc68fe,null))[_0x7ba7('0x21')](respondWithResult(_0xdc68fe,null))['catch'](handleError(_0xdc68fe,null));};exports['create']=function(_0x4ca5d1,_0x41ccb9){return db[_0x7ba7('0x28')]['create'](_0x4ca5d1[_0x7ba7('0x42')],{})[_0x7ba7('0x21')](respondWithResult(_0x41ccb9,0xc9))[_0x7ba7('0x43')](handleError(_0x41ccb9,null));};exports[_0x7ba7('0x20')]=function(_0x9a4449,_0x394f95){if(_0x9a4449[_0x7ba7('0x42')]['id']){delete _0x9a4449[_0x7ba7('0x42')]['id'];}return db['Dynamics365Configuration'][_0x7ba7('0x41')]({'where':{'id':_0x9a4449[_0x7ba7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x394f95,null))[_0x7ba7('0x21')](saveUpdates(_0x9a4449[_0x7ba7('0x42')],null))['then'](respondWithResult(_0x394f95,null))['catch'](handleError(_0x394f95,null));};exports[_0x7ba7('0x22')]=function(_0x9f639e,_0x3fa90e){return db['Dynamics365Configuration']['find']({'where':{'id':_0x9f639e[_0x7ba7('0x3d')]['id']}})[_0x7ba7('0x21')](handleEntityNotFound(_0x3fa90e,null))[_0x7ba7('0x21')](removeEntity(_0x3fa90e,null))[_0x7ba7('0x43')](handleError(_0x3fa90e,null));};exports[_0x7ba7('0x44')]=function(_0x107bab,_0x3b77a3,_0x304716){var _0x4b9dfd={};var _0xa0f61b={};var _0x10f1c4;var _0x967912;return db[_0x7ba7('0x28')]['findOne']({'where':{'id':_0x107bab[_0x7ba7('0x3d')]['id']}})[_0x7ba7('0x21')](handleEntityNotFound(_0x3b77a3,null))[_0x7ba7('0x21')](function(_0x579164){if(_0x579164){_0x10f1c4=_0x579164;_0xa0f61b[_0x7ba7('0x31')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0xa0f61b[_0x7ba7('0x2c')]=_[_0x7ba7('0x3e')](_0x107bab[_0x7ba7('0x2c')]);_0xa0f61b['filters']=_[_0x7ba7('0x2d')](_0xa0f61b['model'],_0xa0f61b[_0x7ba7('0x2c')]);_0x4b9dfd[_0x7ba7('0x2e')]=_[_0x7ba7('0x2d')](_0xa0f61b[_0x7ba7('0x31')],qs[_0x7ba7('0x2f')](_0x107bab['query'][_0x7ba7('0x2f')]));_0x4b9dfd[_0x7ba7('0x2e')]=_0x4b9dfd[_0x7ba7('0x2e')][_0x7ba7('0x30')]?_0x4b9dfd[_0x7ba7('0x2e')]:_0xa0f61b[_0x7ba7('0x31')];_0x4b9dfd['order']=qs[_0x7ba7('0x45')](_0x107bab[_0x7ba7('0x2c')][_0x7ba7('0x45')]);_0x4b9dfd['where']=qs[_0x7ba7('0x35')](_[_0x7ba7('0x36')](_0x107bab[_0x7ba7('0x2c')],_0xa0f61b[_0x7ba7('0x35')]));if(_0x107bab[_0x7ba7('0x2c')][_0x7ba7('0x37')]){_0x4b9dfd[_0x7ba7('0x38')]=_['merge'](_0x4b9dfd[_0x7ba7('0x38')],{'$or':_[_0x7ba7('0x27')](_0x4b9dfd[_0x7ba7('0x2e')],function(_0x1cf732){var _0x1d2b8c={};_0x1d2b8c[_0x1cf732]={'$like':'%'+_0x107bab[_0x7ba7('0x2c')]['filter']+'%'};return _0x1d2b8c;})});}_0x4b9dfd=_[_0x7ba7('0x3a')]({},_0x4b9dfd,_0x107bab[_0x7ba7('0x3b')]);return _0x10f1c4[_0x7ba7('0x44')](_0x4b9dfd);}})[_0x7ba7('0x21')](function(_0x498409){if(_0x498409){_0x967912=_0x498409[_0x7ba7('0x30')];if(!_0x107bab[_0x7ba7('0x2c')][_0x7ba7('0x32')]('nolimit')){_0x4b9dfd[_0x7ba7('0x1b')]=qs[_0x7ba7('0x1b')](_0x107bab[_0x7ba7('0x2c')][_0x7ba7('0x1b')]);_0x4b9dfd[_0x7ba7('0x19')]=qs[_0x7ba7('0x19')](_0x107bab[_0x7ba7('0x2c')][_0x7ba7('0x19')]);}return _0x10f1c4[_0x7ba7('0x44')](_0x4b9dfd);}})[_0x7ba7('0x21')](function(_0x33cd0f){if(_0x33cd0f){return _0x33cd0f?{'count':_0x967912,'rows':_0x33cd0f}:null;}})[_0x7ba7('0x21')](respondWithResult(_0x3b77a3,null))['catch'](handleError(_0x3b77a3,null));};exports[_0x7ba7('0x46')]=function(_0x5855bf,_0x1f7262,_0x16bea8){var _0x16ab7e={};var _0x58acfb={};var _0x1face7;var _0x2c11d6;return db[_0x7ba7('0x28')]['findOne']({'where':{'id':_0x5855bf[_0x7ba7('0x3d')]['id']}})[_0x7ba7('0x21')](handleEntityNotFound(_0x1f7262,null))['then'](function(_0x513966){if(_0x513966){_0x1face7=_0x513966;_0x58acfb[_0x7ba7('0x31')]=_['keys'](db[_0x7ba7('0x47')][_0x7ba7('0x29')]);_0x58acfb['query']=_[_0x7ba7('0x3e')](_0x5855bf[_0x7ba7('0x2c')]);_0x58acfb[_0x7ba7('0x35')]=_[_0x7ba7('0x2d')](_0x58acfb['model'],_0x58acfb['query']);_0x16ab7e[_0x7ba7('0x2e')]=_[_0x7ba7('0x2d')](_0x58acfb['model'],qs['fields'](_0x5855bf[_0x7ba7('0x2c')][_0x7ba7('0x2f')]));_0x16ab7e[_0x7ba7('0x2e')]=_0x16ab7e[_0x7ba7('0x2e')][_0x7ba7('0x30')]?_0x16ab7e[_0x7ba7('0x2e')]:_0x58acfb[_0x7ba7('0x31')];_0x16ab7e[_0x7ba7('0x34')]=qs[_0x7ba7('0x45')](_0x5855bf['query']['sort']);_0x16ab7e[_0x7ba7('0x38')]=qs[_0x7ba7('0x35')](_[_0x7ba7('0x36')](_0x5855bf[_0x7ba7('0x2c')],_0x58acfb[_0x7ba7('0x35')]));if(_0x5855bf[_0x7ba7('0x2c')]['filter']){_0x16ab7e[_0x7ba7('0x38')]=_[_0x7ba7('0x3a')](_0x16ab7e[_0x7ba7('0x38')],{'$or':_[_0x7ba7('0x27')](_0x16ab7e[_0x7ba7('0x2e')],function(_0x42e3b5){var _0x3a6cd6={};_0x3a6cd6[_0x42e3b5]={'$like':'%'+_0x5855bf['query'][_0x7ba7('0x37')]+'%'};return _0x3a6cd6;})});}_0x16ab7e=_[_0x7ba7('0x3a')]({},_0x16ab7e,_0x5855bf['options']);return _0x1face7[_0x7ba7('0x46')](_0x16ab7e);}})['then'](function(_0x3c88c0){if(_0x3c88c0){_0x2c11d6=_0x3c88c0['length'];if(!_0x5855bf[_0x7ba7('0x2c')]['hasOwnProperty'](_0x7ba7('0x33'))){_0x16ab7e[_0x7ba7('0x1b')]=qs[_0x7ba7('0x1b')](_0x5855bf[_0x7ba7('0x2c')][_0x7ba7('0x1b')]);_0x16ab7e[_0x7ba7('0x19')]=qs['offset'](_0x5855bf['query']['offset']);}return _0x1face7[_0x7ba7('0x46')](_0x16ab7e);}})['then'](function(_0x401b6c){if(_0x401b6c){return _0x401b6c?{'count':_0x2c11d6,'rows':_0x401b6c}:null;}})[_0x7ba7('0x21')](respondWithResult(_0x1f7262,null))[_0x7ba7('0x43')](handleError(_0x1f7262,null));};exports[_0x7ba7('0x48')]=function(_0x474d9b,_0x4152c8,_0x266e54){var _0x20a231={};var _0x5b4f64={};var _0x585ccf;var _0x5cc1c9;return db[_0x7ba7('0x28')]['findOne']({'where':{'id':_0x474d9b['params']['id']}})[_0x7ba7('0x21')](handleEntityNotFound(_0x4152c8,null))[_0x7ba7('0x21')](function(_0x597297){if(_0x597297){_0x585ccf=_0x597297;_0x5b4f64[_0x7ba7('0x31')]=_[_0x7ba7('0x3e')](db[_0x7ba7('0x47')][_0x7ba7('0x29')]);_0x5b4f64[_0x7ba7('0x2c')]=_['keys'](_0x474d9b[_0x7ba7('0x2c')]);_0x5b4f64[_0x7ba7('0x35')]=_[_0x7ba7('0x2d')](_0x5b4f64[_0x7ba7('0x31')],_0x5b4f64['query']);_0x20a231[_0x7ba7('0x2e')]=_['intersection'](_0x5b4f64['model'],qs['fields'](_0x474d9b[_0x7ba7('0x2c')]['fields']));_0x20a231[_0x7ba7('0x2e')]=_0x20a231[_0x7ba7('0x2e')][_0x7ba7('0x30')]?_0x20a231[_0x7ba7('0x2e')]:_0x5b4f64[_0x7ba7('0x31')];_0x20a231[_0x7ba7('0x34')]=qs['sort'](_0x474d9b['query'][_0x7ba7('0x45')]);_0x20a231[_0x7ba7('0x38')]=qs[_0x7ba7('0x35')](_[_0x7ba7('0x36')](_0x474d9b[_0x7ba7('0x2c')],_0x5b4f64['filters']));if(_0x474d9b[_0x7ba7('0x2c')]['filter']){_0x20a231[_0x7ba7('0x38')]=_[_0x7ba7('0x3a')](_0x20a231[_0x7ba7('0x38')],{'$or':_[_0x7ba7('0x27')](_0x20a231['attributes'],function(_0x535832){var _0x24e9dd={};_0x24e9dd[_0x535832]={'$like':'%'+_0x474d9b['query'][_0x7ba7('0x37')]+'%'};return _0x24e9dd;})});}_0x20a231=_[_0x7ba7('0x3a')]({},_0x20a231,_0x474d9b['options']);return _0x585ccf['getDescriptions'](_0x20a231);}})[_0x7ba7('0x21')](function(_0x272ee9){if(_0x272ee9){_0x5cc1c9=_0x272ee9[_0x7ba7('0x30')];if(!_0x474d9b['query'][_0x7ba7('0x32')](_0x7ba7('0x33'))){_0x20a231[_0x7ba7('0x1b')]=qs['limit'](_0x474d9b['query'][_0x7ba7('0x1b')]);_0x20a231['offset']=qs[_0x7ba7('0x19')](_0x474d9b[_0x7ba7('0x2c')][_0x7ba7('0x19')]);}return _0x585ccf[_0x7ba7('0x48')](_0x20a231);}})[_0x7ba7('0x21')](function(_0x576c92){if(_0x576c92){return _0x576c92?{'count':_0x5cc1c9,'rows':_0x576c92}:null;}})[_0x7ba7('0x21')](respondWithResult(_0x4152c8,null))[_0x7ba7('0x43')](handleError(_0x4152c8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e617767..503aa95 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 _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x40e346,_0x47c903){var _0xda1d0b=function(_0x569a8a){while(--_0x569a8a){_0x40e346['push'](_0x40e346['shift']());}};_0xda1d0b(++_0x47c903);}(_0xa41a,0x6b));var _0xaa41=function(_0x116936,_0x276fbf){_0x116936=_0x116936-0x0;var _0x2a5866=_0xa41a[_0x116936];return _0x2a5866;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x3edfe3,_0x25a8ed){var _0x56de51=function(_0x11a189){while(--_0x11a189){_0x3edfe3['push'](_0x3edfe3['shift']());}};_0x56de51(++_0x25a8ed);}(_0xbec5,0xe5));var _0x5bec=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0xbec5[_0x267d8d];return _0x11a98f;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 7555261..601f56f 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 _0x9f35=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9f35,0x19d));var _0x59f3=function(_0xb333c0,_0x53529c){_0xb333c0=_0xb333c0-0x0;var _0x412fd9=_0x9f35[_0xb333c0];return _0x412fd9;};'use strict';var _=require(_0x59f3('0x0'));var util=require(_0x59f3('0x1'));var moment=require(_0x59f3('0x2'));var BPromise=require(_0x59f3('0x3'));var rs=require(_0x59f3('0x4'));var fs=require('fs');var Redis=require(_0x59f3('0x5'));var db=require(_0x59f3('0x6'))['db'];var utils=require(_0x59f3('0x7'));var logger=require(_0x59f3('0x8'))(_0x59f3('0x9'));var config=require(_0x59f3('0xa'));var jayson=require(_0x59f3('0xb'));var client=jayson[_0x59f3('0xc')][_0x59f3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x45e7c3,_0x3eebd5,_0x597bab){return new BPromise(function(_0x40ea70,_0x2ceb2e){return client[_0x59f3('0xe')](_0x45e7c3,_0x597bab)['then'](function(_0xba898c){logger[_0x59f3('0xf')](_0x59f3('0x10'),_0x3eebd5,'request\x20sent');logger[_0x59f3('0x11')](_0x59f3('0x12'),_0x3eebd5,_0x59f3('0x13'),JSON[_0x59f3('0x14')](_0xba898c));if(_0xba898c[_0x59f3('0x15')]){if(_0xba898c[_0x59f3('0x15')][_0x59f3('0x16')]===0x1f4){logger[_0x59f3('0x15')](_0x59f3('0x10'),_0x3eebd5,_0xba898c[_0x59f3('0x15')][_0x59f3('0x17')]);return _0x2ceb2e(_0xba898c[_0x59f3('0x15')]['message']);}logger[_0x59f3('0x15')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3eebd5,_0xba898c[_0x59f3('0x15')][_0x59f3('0x17')]);return _0x40ea70(_0xba898c[_0x59f3('0x15')]['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x3eebd5,_0x59f3('0x13'));_0x40ea70(_0xba898c[_0x59f3('0x18')][_0x59f3('0x17')]);}})[_0x59f3('0x19')](function(_0xd33ec2){logger[_0x59f3('0x15')](_0x59f3('0x10'),_0x3eebd5,_0xd33ec2);_0x2ceb2e(_0xd33ec2);});});} \ No newline at end of file +var _0x013b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x298b27,_0x47ab26){var _0x2074bb=function(_0x33dcbd){while(--_0x33dcbd){_0x298b27['push'](_0x298b27['shift']());}};_0x2074bb(++_0x47ab26);}(_0x013b,0x1c8));var _0xb013=function(_0x560fc6,_0x59bd68){_0x560fc6=_0x560fc6-0x0;var _0x14d08a=_0x013b[_0x560fc6];return _0x14d08a;};'use strict';var _=require(_0xb013('0x0'));var util=require(_0xb013('0x1'));var moment=require(_0xb013('0x2'));var BPromise=require(_0xb013('0x3'));var rs=require(_0xb013('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb013('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb013('0x6'))(_0xb013('0x7'));var config=require(_0xb013('0x8'));var jayson=require(_0xb013('0x9'));var client=jayson[_0xb013('0xa')][_0xb013('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b8de,_0x1046fa,_0x2277c6){return new BPromise(function(_0x4a0d70,_0x513777){return client[_0xb013('0xc')](_0x25b8de,_0x2277c6)[_0xb013('0xd')](function(_0x24ded6){logger[_0xb013('0xe')](_0xb013('0xf'),_0x1046fa,_0xb013('0x10'));logger[_0xb013('0x11')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1046fa,_0xb013('0x10'),JSON['stringify'](_0x24ded6));if(_0x24ded6[_0xb013('0x12')]){if(_0x24ded6[_0xb013('0x12')][_0xb013('0x13')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1046fa,_0x24ded6[_0xb013('0x12')]['message']);return _0x513777(_0x24ded6[_0xb013('0x12')][_0xb013('0x14')]);}logger['error'](_0xb013('0xf'),_0x1046fa,_0x24ded6['error'][_0xb013('0x14')]);return _0x4a0d70(_0x24ded6[_0xb013('0x12')]['message']);}else{logger[_0xb013('0xe')](_0xb013('0xf'),_0x1046fa,_0xb013('0x10'));_0x4a0d70(_0x24ded6[_0xb013('0x15')][_0xb013('0x14')]);}})['catch'](function(_0x134fd9){logger[_0xb013('0x12')](_0xb013('0xf'),_0x1046fa,_0x134fd9);_0x513777(_0x134fd9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index b6655a3..0d1faef 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 _0xd811=['index','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated'];(function(_0x52e5f6,_0x4c9e6f){var _0x165d0a=function(_0x4bca06){while(--_0x4bca06){_0x52e5f6['push'](_0x52e5f6['shift']());}};_0x165d0a(++_0x4c9e6f);}(_0xd811,0x1c2));var _0x1d81=function(_0xa016f6,_0x3a8863){_0xa016f6=_0xa016f6-0x0;var _0x313949=_0xd811[_0xa016f6];return _0x313949;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1d81('0x0'));var timeout=require(_0x1d81('0x1'));var express=require('express');var router=express[_0x1d81('0x2')]();var fs_extra=require(_0x1d81('0x3'));var auth=require(_0x1d81('0x4'));var interaction=require(_0x1d81('0x5'));var config=require(_0x1d81('0x6'));var controller=require(_0x1d81('0x7'));router[_0x1d81('0x8')]('/',auth[_0x1d81('0x9')](),controller[_0x1d81('0xa')]);router[_0x1d81('0x8')]('/:id',auth[_0x1d81('0x9')](),controller[_0x1d81('0xb')]);router[_0x1d81('0xc')]('/',auth['isAuthenticated'](),controller[_0x1d81('0xd')]);router[_0x1d81('0xe')](_0x1d81('0xf'),auth[_0x1d81('0x9')](),controller[_0x1d81('0x10')]);router[_0x1d81('0x11')](_0x1d81('0xf'),auth[_0x1d81('0x9')](),controller[_0x1d81('0x12')]);module[_0x1d81('0x13')]=router; \ No newline at end of file +var _0x41f5=['post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show'];(function(_0xc6c696,_0x44ad90){var _0x4ba4b3=function(_0x59c7d1){while(--_0x59c7d1){_0xc6c696['push'](_0xc6c696['shift']());}};_0x4ba4b3(++_0x44ad90);}(_0x41f5,0x1aa));var _0x541f=function(_0x8c7dcb,_0xea478d){_0x8c7dcb=_0x8c7dcb-0x0;var _0x3952e5=_0x41f5[_0x8c7dcb];return _0x3952e5;};'use strict';var multer=require(_0x541f('0x0'));var util=require('util');var path=require(_0x541f('0x1'));var timeout=require(_0x541f('0x2'));var express=require(_0x541f('0x3'));var router=express[_0x541f('0x4')]();var fs_extra=require(_0x541f('0x5'));var auth=require(_0x541f('0x6'));var interaction=require(_0x541f('0x7'));var config=require(_0x541f('0x8'));var controller=require(_0x541f('0x9'));router[_0x541f('0xa')]('/',auth[_0x541f('0xb')](),controller['index']);router['get'](_0x541f('0xc'),auth[_0x541f('0xb')](),controller[_0x541f('0xd')]);router[_0x541f('0xe')]('/',auth[_0x541f('0xb')](),controller[_0x541f('0xf')]);router[_0x541f('0x10')](_0x541f('0xc'),auth['isAuthenticated'](),controller[_0x541f('0x11')]);router[_0x541f('0x12')]('/:id',auth[_0x541f('0xb')](),controller['destroy']);module[_0x541f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a922e3a..ff660f5 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 _0x09da=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x121bb4,_0x672e51){var _0x147f90=function(_0x180224){while(--_0x180224){_0x121bb4['push'](_0x121bb4['shift']());}};_0x147f90(++_0x672e51);}(_0x09da,0xf1));var _0xa09d=function(_0x20a9f8,_0x3018b8){_0x20a9f8=_0x20a9f8-0x0;var _0x5dd685=_0x09da[_0x20a9f8];return _0x5dd685;};'use strict';var Sequelize=require(_0xa09d('0x0'));module[_0xa09d('0x1')]={'type':{'type':Sequelize[_0xa09d('0x2')](_0xa09d('0x3'),_0xa09d('0x4'),'customVariable',_0xa09d('0x5'),_0xa09d('0x6')),'defaultValue':_0xa09d('0x3')},'content':{'type':Sequelize[_0xa09d('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa09d('0x2')]('string',_0xa09d('0x4'),_0xa09d('0x8'))},'keyContent':{'type':Sequelize[_0xa09d('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa09d('0x7')]},'customField':{'type':Sequelize[_0xa09d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0cb2=['customVariable','keyValue','picklist','STRING','string','BOOLEAN','ENUM','variable'];(function(_0x32e4de,_0x7da1c5){var _0x51ba2a=function(_0x2a7322){while(--_0x2a7322){_0x32e4de['push'](_0x32e4de['shift']());}};_0x51ba2a(++_0x7da1c5);}(_0x0cb2,0x15e));var _0x20cb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0cb2[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x20cb('0x0')]('string',_0x20cb('0x1'),_0x20cb('0x2'),_0x20cb('0x3'),_0x20cb('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x20cb('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x20cb('0x0')](_0x20cb('0x6'),_0x20cb('0x1'),_0x20cb('0x2'))},'keyContent':{'type':Sequelize[_0x20cb('0x5')]},'idField':{'type':Sequelize[_0x20cb('0x5')]},'nameField':{'type':Sequelize[_0x20cb('0x5')]},'customField':{'type':Sequelize[_0x20cb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e48a6eb..3d5072d 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 _0xfb9e=['set','Content-Range','apply','update','then','error','stack','name','send','Dynamics365Field','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','where','findAll','rows','catch','params','keys','length','includeAll','include','find','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status'];(function(_0x179ad5,_0x479ede){var _0x316d17=function(_0x4c6ac2){while(--_0x4c6ac2){_0x179ad5['push'](_0x179ad5['shift']());}};_0x316d17(++_0x479ede);}(_0xfb9e,0x1cf));var _0xefb9=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0xfb9e[_0x1c7137];return _0xeb4432;};'use strict';var emlformat=require(_0xefb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefb9('0x1'));var jsonpatch=require(_0xefb9('0x2'));var rp=require('request-promise');var moment=require(_0xefb9('0x3'));var BPromise=require(_0xefb9('0x4'));var Mustache=require(_0xefb9('0x5'));var util=require(_0xefb9('0x6'));var path=require('path');var sox=require(_0xefb9('0x7'));var csv=require('to-csv');var ejs=require(_0xefb9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xefb9('0x9'));var squel=require(_0xefb9('0xa'));var crypto=require(_0xefb9('0xb'));var jsforce=require(_0xefb9('0xc'));var deskjs=require(_0xefb9('0xd'));var toCsv=require(_0xefb9('0xe'));var querystring=require(_0xefb9('0xf'));var Papa=require(_0xefb9('0x10'));var Redis=require(_0xefb9('0x11'));var authService=require(_0xefb9('0x12'));var qs=require(_0xefb9('0x13'));var as=require(_0xefb9('0x14'));var hardwareService=require(_0xefb9('0x15'));var logger=require(_0xefb9('0x16'))('api');var utils=require(_0xefb9('0x17'));var config=require(_0xefb9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xefb9('0x19'))['db'];function respondWithStatusCode(_0x416d43,_0x242194){_0x242194=_0x242194||0xcc;return function(_0x4d50a0){if(_0x4d50a0){return _0x416d43[_0xefb9('0x1a')](_0x242194);}return _0x416d43['status'](_0x242194)[_0xefb9('0x1b')]();};}function respondWithResult(_0x39d867,_0x4038bb){_0x4038bb=_0x4038bb||0xc8;return function(_0x171903){if(_0x171903){return _0x39d867['status'](_0x4038bb)[_0xefb9('0x1c')](_0x171903);}};}function respondWithFilteredResult(_0x4be253,_0x4f8d04){return function(_0x11bf73){if(_0x11bf73){var _0x2a332c=typeof _0x4f8d04[_0xefb9('0x1d')]==='undefined'&&typeof _0x4f8d04[_0xefb9('0x1e')]===_0xefb9('0x1f');var _0x1e3552=_0x11bf73[_0xefb9('0x20')];var _0x355465=_0x2a332c?0x0:_0x4f8d04[_0xefb9('0x1d')];var _0xd34673=_0x2a332c?_0x11bf73[_0xefb9('0x20')]:_0x4f8d04['offset']+_0x4f8d04[_0xefb9('0x1e')];var _0x407b53;if(_0xd34673>=_0x1e3552){_0xd34673=_0x1e3552;_0x407b53=0xc8;}else{_0x407b53=0xce;}_0x4be253[_0xefb9('0x21')](_0x407b53);return _0x4be253[_0xefb9('0x22')](_0xefb9('0x23'),_0x355465+'-'+_0xd34673+'/'+_0x1e3552)[_0xefb9('0x1c')](_0x11bf73);}return null;};}function patchUpdates(_0x4c69a9){return function(_0x113b0a){try{jsonpatch[_0xefb9('0x24')](_0x113b0a,_0x4c69a9,!![]);}catch(_0x123638){return BPromise['reject'](_0x123638);}return _0x113b0a['save']();};}function saveUpdates(_0x1f3bd0,_0x424553){return function(_0x53ad24){if(_0x53ad24){return _0x53ad24[_0xefb9('0x25')](_0x1f3bd0)[_0xefb9('0x26')](function(_0x23196d){return _0x23196d;});}return null;};}function removeEntity(_0x266ebd,_0x534561){return function(_0x8aa09b){if(_0x8aa09b){return _0x8aa09b['destroy']()[_0xefb9('0x26')](function(){_0x266ebd[_0xefb9('0x21')](0xcc)[_0xefb9('0x1b')]();});}};}function handleEntityNotFound(_0x27b7dd,_0x2b00ff){return function(_0x74fff4){if(!_0x74fff4){_0x27b7dd[_0xefb9('0x1a')](0x194);}return _0x74fff4;};}function handleError(_0x1e7cf9,_0x1114c8){_0x1114c8=_0x1114c8||0x1f4;return function(_0x348ef6){logger[_0xefb9('0x27')](_0x348ef6[_0xefb9('0x28')]);if(_0x348ef6[_0xefb9('0x29')]){delete _0x348ef6[_0xefb9('0x29')];}_0x1e7cf9[_0xefb9('0x21')](_0x1114c8)[_0xefb9('0x2a')](_0x348ef6);};}exports['index']=function(_0x47c316,_0x58585c){var _0x4dd736={},_0x2357b2={},_0x2410cc={'count':0x0,'rows':[]};var _0x1c6012=_['map'](db[_0xefb9('0x2b')][_0xefb9('0x2c')],function(_0x1c1145){return{'name':_0x1c1145[_0xefb9('0x2d')],'type':_0x1c1145[_0xefb9('0x2e')]['key']};});_0x2357b2[_0xefb9('0x2f')]=_[_0xefb9('0x30')](_0x1c6012,'name');_0x2357b2[_0xefb9('0x31')]=_['keys'](_0x47c316[_0xefb9('0x31')]);_0x2357b2[_0xefb9('0x32')]=_[_0xefb9('0x33')](_0x2357b2[_0xefb9('0x2f')],_0x2357b2[_0xefb9('0x31')]);_0x4dd736[_0xefb9('0x34')]=_[_0xefb9('0x33')](_0x2357b2[_0xefb9('0x2f')],qs['fields'](_0x47c316[_0xefb9('0x31')][_0xefb9('0x35')]));_0x4dd736[_0xefb9('0x34')]=_0x4dd736[_0xefb9('0x34')]['length']?_0x4dd736[_0xefb9('0x34')]:_0x2357b2['model'];if(!_0x47c316[_0xefb9('0x31')][_0xefb9('0x36')]('nolimit')){_0x4dd736['limit']=qs[_0xefb9('0x1e')](_0x47c316[_0xefb9('0x31')][_0xefb9('0x1e')]);_0x4dd736[_0xefb9('0x1d')]=qs['offset'](_0x47c316['query']['offset']);}_0x4dd736['order']=qs[_0xefb9('0x37')](_0x47c316[_0xefb9('0x31')][_0xefb9('0x37')]);_0x4dd736['where']=qs[_0xefb9('0x32')](_[_0xefb9('0x38')](_0x47c316[_0xefb9('0x31')],_0x2357b2[_0xefb9('0x32')]),_0x1c6012);if(_0x47c316[_0xefb9('0x31')][_0xefb9('0x39')]){_0x4dd736['where']=_[_0xefb9('0x3a')](_0x4dd736['where'],{'$or':_['map'](_0x1c6012,function(_0x2dfb54){if(_0x2dfb54[_0xefb9('0x2e')]!==_0xefb9('0x3b')){var _0x51a4da={};_0x51a4da[_0x2dfb54['name']]={'$like':'%'+_0x47c316['query'][_0xefb9('0x39')]+'%'};return _0x51a4da;}})});}_0x4dd736=_['merge']({},_0x4dd736,_0x47c316['options']);var _0x4b0923={'where':_0x4dd736[_0xefb9('0x3c')]};return db[_0xefb9('0x2b')][_0xefb9('0x20')](_0x4b0923)[_0xefb9('0x26')](function(_0x44f1db){_0x2410cc[_0xefb9('0x20')]=_0x44f1db;if(_0x47c316['query']['includeAll']){_0x4dd736['include']=[{'all':!![]}];}return db[_0xefb9('0x2b')][_0xefb9('0x3d')](_0x4dd736);})['then'](function(_0x273896){_0x2410cc[_0xefb9('0x3e')]=_0x273896;return _0x2410cc;})[_0xefb9('0x26')](respondWithFilteredResult(_0x58585c,_0x4dd736))[_0xefb9('0x3f')](handleError(_0x58585c,null));};exports['show']=function(_0x794841,_0x5c2560){var _0x38610a={'raw':!![],'where':{'id':_0x794841[_0xefb9('0x40')]['id']}},_0x526c78={};_0x526c78['model']=_[_0xefb9('0x41')](db[_0xefb9('0x2b')][_0xefb9('0x2c')]);_0x526c78[_0xefb9('0x31')]=_[_0xefb9('0x41')](_0x794841[_0xefb9('0x31')]);_0x526c78['filters']=_['intersection'](_0x526c78['model'],_0x526c78['query']);_0x38610a['attributes']=_[_0xefb9('0x33')](_0x526c78[_0xefb9('0x2f')],qs[_0xefb9('0x35')](_0x794841['query'][_0xefb9('0x35')]));_0x38610a[_0xefb9('0x34')]=_0x38610a[_0xefb9('0x34')][_0xefb9('0x42')]?_0x38610a['attributes']:_0x526c78['model'];if(_0x794841[_0xefb9('0x31')][_0xefb9('0x43')]){_0x38610a[_0xefb9('0x44')]=[{'all':!![]}];}_0x38610a=_['merge']({},_0x38610a,_0x794841['options']);return db['Dynamics365Field'][_0xefb9('0x45')](_0x38610a)[_0xefb9('0x26')](handleEntityNotFound(_0x5c2560,null))[_0xefb9('0x26')](respondWithResult(_0x5c2560,null))['catch'](handleError(_0x5c2560,null));};exports['create']=function(_0x3f25c3,_0x638519){return db['Dynamics365Field']['create'](_0x3f25c3[_0xefb9('0x46')],{})['then'](respondWithResult(_0x638519,0xc9))[_0xefb9('0x3f')](handleError(_0x638519,null));};exports[_0xefb9('0x25')]=function(_0x2740dd,_0x1e8a50){if(_0x2740dd[_0xefb9('0x46')]['id']){delete _0x2740dd[_0xefb9('0x46')]['id'];}return db[_0xefb9('0x2b')]['find']({'where':{'id':_0x2740dd[_0xefb9('0x40')]['id']}})[_0xefb9('0x26')](handleEntityNotFound(_0x1e8a50,null))[_0xefb9('0x26')](saveUpdates(_0x2740dd['body'],null))['then'](respondWithResult(_0x1e8a50,null))[_0xefb9('0x3f')](handleError(_0x1e8a50,null));};exports['destroy']=function(_0x1c32a5,_0x51f19e){return db[_0xefb9('0x2b')][_0xefb9('0x45')]({'where':{'id':_0x1c32a5[_0xefb9('0x40')]['id']}})['then'](handleEntityNotFound(_0x51f19e,null))[_0xefb9('0x26')](removeEntity(_0x51f19e,null))['catch'](handleError(_0x51f19e,null));}; \ No newline at end of file +var _0xadca=['model','keys','intersection','query','fields','attributes','length','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','Dynamics365Field','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','offset','count','limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','type','key'];(function(_0x10c8bc,_0x29a6ae){var _0x295657=function(_0x5f2053){while(--_0x5f2053){_0x10c8bc['push'](_0x10c8bc['shift']());}};_0x295657(++_0x29a6ae);}(_0xadca,0x17f));var _0xaadc=function(_0x184842,_0x522104){_0x184842=_0x184842-0x0;var _0x574731=_0xadca[_0x184842];return _0x574731;};'use strict';var emlformat=require(_0xaadc('0x0'));var rimraf=require(_0xaadc('0x1'));var zipdir=require(_0xaadc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaadc('0x3'));var moment=require(_0xaadc('0x4'));var BPromise=require(_0xaadc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaadc('0x6'));var sox=require('sox');var csv=require(_0xaadc('0x7'));var ejs=require(_0xaadc('0x8'));var fs=require('fs');var fs_extra=require(_0xaadc('0x9'));var _=require('lodash');var squel=require(_0xaadc('0xa'));var crypto=require(_0xaadc('0xb'));var jsforce=require(_0xaadc('0xc'));var deskjs=require(_0xaadc('0xd'));var toCsv=require(_0xaadc('0x7'));var querystring=require('querystring');var Papa=require(_0xaadc('0xe'));var Redis=require(_0xaadc('0xf'));var authService=require(_0xaadc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaadc('0x11'));var hardwareService=require(_0xaadc('0x12'));var logger=require(_0xaadc('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xaadc('0x14'));var licenseUtil=require(_0xaadc('0x15'));var db=require(_0xaadc('0x16'))['db'];function respondWithStatusCode(_0x474584,_0xd9e6ab){_0xd9e6ab=_0xd9e6ab||0xcc;return function(_0xc9ade1){if(_0xc9ade1){return _0x474584['sendStatus'](_0xd9e6ab);}return _0x474584['status'](_0xd9e6ab)[_0xaadc('0x17')]();};}function respondWithResult(_0x3cb6fc,_0x4e559d){_0x4e559d=_0x4e559d||0xc8;return function(_0x304cc9){if(_0x304cc9){return _0x3cb6fc[_0xaadc('0x18')](_0x4e559d)[_0xaadc('0x19')](_0x304cc9);}};}function respondWithFilteredResult(_0x30fa34,_0x5023a0){return function(_0x2cda53){if(_0x2cda53){var _0x2ede15=typeof _0x5023a0['offset']===_0xaadc('0x1a')&&typeof _0x5023a0['limit']==='undefined';var _0x21fb1a=_0x2cda53['count'];var _0xe22139=_0x2ede15?0x0:_0x5023a0[_0xaadc('0x1b')];var _0x3d0b5e=_0x2ede15?_0x2cda53[_0xaadc('0x1c')]:_0x5023a0[_0xaadc('0x1b')]+_0x5023a0[_0xaadc('0x1d')];var _0xec7b7f;if(_0x3d0b5e>=_0x21fb1a){_0x3d0b5e=_0x21fb1a;_0xec7b7f=0xc8;}else{_0xec7b7f=0xce;}_0x30fa34[_0xaadc('0x18')](_0xec7b7f);return _0x30fa34[_0xaadc('0x1e')](_0xaadc('0x1f'),_0xe22139+'-'+_0x3d0b5e+'/'+_0x21fb1a)[_0xaadc('0x19')](_0x2cda53);}return null;};}function patchUpdates(_0x167a1e){return function(_0x30684a){try{jsonpatch['apply'](_0x30684a,_0x167a1e,!![]);}catch(_0x391760){return BPromise['reject'](_0x391760);}return _0x30684a['save']();};}function saveUpdates(_0x3ccf76,_0x41cad0){return function(_0x37ad58){if(_0x37ad58){return _0x37ad58[_0xaadc('0x20')](_0x3ccf76)['then'](function(_0x59d8bb){return _0x59d8bb;});}return null;};}function removeEntity(_0x548b3d,_0x5b5709){return function(_0x5c75a9){if(_0x5c75a9){return _0x5c75a9['destroy']()[_0xaadc('0x21')](function(){_0x548b3d[_0xaadc('0x18')](0xcc)[_0xaadc('0x17')]();});}};}function handleEntityNotFound(_0x2679c3,_0x37a996){return function(_0x300acb){if(!_0x300acb){_0x2679c3[_0xaadc('0x22')](0x194);}return _0x300acb;};}function handleError(_0x16fdaf,_0x18a63b){_0x18a63b=_0x18a63b||0x1f4;return function(_0x2f3aa0){logger[_0xaadc('0x23')](_0x2f3aa0[_0xaadc('0x24')]);if(_0x2f3aa0['name']){delete _0x2f3aa0[_0xaadc('0x25')];}_0x16fdaf['status'](_0x18a63b)[_0xaadc('0x26')](_0x2f3aa0);};}exports[_0xaadc('0x27')]=function(_0x110cf7,_0x285541){var _0x3f2ff9={},_0x549d72={},_0x44701c={'count':0x0,'rows':[]};var _0x59e55a=_[_0xaadc('0x28')](db['Dynamics365Field']['rawAttributes'],function(_0x47e17b){return{'name':_0x47e17b['fieldName'],'type':_0x47e17b[_0xaadc('0x29')][_0xaadc('0x2a')]};});_0x549d72[_0xaadc('0x2b')]=_[_0xaadc('0x28')](_0x59e55a,_0xaadc('0x25'));_0x549d72['query']=_[_0xaadc('0x2c')](_0x110cf7['query']);_0x549d72['filters']=_[_0xaadc('0x2d')](_0x549d72[_0xaadc('0x2b')],_0x549d72[_0xaadc('0x2e')]);_0x3f2ff9['attributes']=_['intersection'](_0x549d72[_0xaadc('0x2b')],qs[_0xaadc('0x2f')](_0x110cf7[_0xaadc('0x2e')][_0xaadc('0x2f')]));_0x3f2ff9[_0xaadc('0x30')]=_0x3f2ff9['attributes'][_0xaadc('0x31')]?_0x3f2ff9[_0xaadc('0x30')]:_0x549d72[_0xaadc('0x2b')];if(!_0x110cf7[_0xaadc('0x2e')]['hasOwnProperty']('nolimit')){_0x3f2ff9[_0xaadc('0x1d')]=qs[_0xaadc('0x1d')](_0x110cf7[_0xaadc('0x2e')][_0xaadc('0x1d')]);_0x3f2ff9[_0xaadc('0x1b')]=qs[_0xaadc('0x1b')](_0x110cf7[_0xaadc('0x2e')]['offset']);}_0x3f2ff9[_0xaadc('0x32')]=qs[_0xaadc('0x33')](_0x110cf7['query']['sort']);_0x3f2ff9[_0xaadc('0x34')]=qs[_0xaadc('0x35')](_[_0xaadc('0x36')](_0x110cf7[_0xaadc('0x2e')],_0x549d72[_0xaadc('0x35')]),_0x59e55a);if(_0x110cf7[_0xaadc('0x2e')]['filter']){_0x3f2ff9[_0xaadc('0x34')]=_['merge'](_0x3f2ff9[_0xaadc('0x34')],{'$or':_['map'](_0x59e55a,function(_0x17186a){if(_0x17186a[_0xaadc('0x29')]!==_0xaadc('0x37')){var _0x3d8674={};_0x3d8674[_0x17186a['name']]={'$like':'%'+_0x110cf7[_0xaadc('0x2e')][_0xaadc('0x38')]+'%'};return _0x3d8674;}})});}_0x3f2ff9=_[_0xaadc('0x39')]({},_0x3f2ff9,_0x110cf7[_0xaadc('0x3a')]);var _0xebcadd={'where':_0x3f2ff9[_0xaadc('0x34')]};return db['Dynamics365Field']['count'](_0xebcadd)[_0xaadc('0x21')](function(_0x3c1c32){_0x44701c['count']=_0x3c1c32;if(_0x110cf7[_0xaadc('0x2e')]['includeAll']){_0x3f2ff9[_0xaadc('0x3b')]=[{'all':!![]}];}return db[_0xaadc('0x3c')]['findAll'](_0x3f2ff9);})[_0xaadc('0x21')](function(_0x34c263){_0x44701c[_0xaadc('0x3d')]=_0x34c263;return _0x44701c;})[_0xaadc('0x21')](respondWithFilteredResult(_0x285541,_0x3f2ff9))[_0xaadc('0x3e')](handleError(_0x285541,null));};exports[_0xaadc('0x3f')]=function(_0x328f25,_0x383d2f){var _0x41f10c={'raw':!![],'where':{'id':_0x328f25[_0xaadc('0x40')]['id']}},_0x4ad27e={};_0x4ad27e['model']=_[_0xaadc('0x2c')](db['Dynamics365Field'][_0xaadc('0x41')]);_0x4ad27e['query']=_['keys'](_0x328f25[_0xaadc('0x2e')]);_0x4ad27e['filters']=_[_0xaadc('0x2d')](_0x4ad27e[_0xaadc('0x2b')],_0x4ad27e[_0xaadc('0x2e')]);_0x41f10c[_0xaadc('0x30')]=_[_0xaadc('0x2d')](_0x4ad27e['model'],qs['fields'](_0x328f25[_0xaadc('0x2e')][_0xaadc('0x2f')]));_0x41f10c[_0xaadc('0x30')]=_0x41f10c[_0xaadc('0x30')][_0xaadc('0x31')]?_0x41f10c['attributes']:_0x4ad27e['model'];if(_0x328f25['query'][_0xaadc('0x42')]){_0x41f10c[_0xaadc('0x3b')]=[{'all':!![]}];}_0x41f10c=_[_0xaadc('0x39')]({},_0x41f10c,_0x328f25[_0xaadc('0x3a')]);return db[_0xaadc('0x3c')][_0xaadc('0x43')](_0x41f10c)[_0xaadc('0x21')](handleEntityNotFound(_0x383d2f,null))[_0xaadc('0x21')](respondWithResult(_0x383d2f,null))[_0xaadc('0x3e')](handleError(_0x383d2f,null));};exports[_0xaadc('0x44')]=function(_0x5a1d6c,_0x55dba7){return db['Dynamics365Field'][_0xaadc('0x44')](_0x5a1d6c[_0xaadc('0x45')],{})[_0xaadc('0x21')](respondWithResult(_0x55dba7,0xc9))[_0xaadc('0x3e')](handleError(_0x55dba7,null));};exports[_0xaadc('0x20')]=function(_0x5635a8,_0x26933d){if(_0x5635a8[_0xaadc('0x45')]['id']){delete _0x5635a8[_0xaadc('0x45')]['id'];}return db[_0xaadc('0x3c')][_0xaadc('0x43')]({'where':{'id':_0x5635a8[_0xaadc('0x40')]['id']}})[_0xaadc('0x21')](handleEntityNotFound(_0x26933d,null))[_0xaadc('0x21')](saveUpdates(_0x5635a8[_0xaadc('0x45')],null))[_0xaadc('0x21')](respondWithResult(_0x26933d,null))[_0xaadc('0x3e')](handleError(_0x26933d,null));};exports[_0xaadc('0x46')]=function(_0xceacb1,_0x341e6e){return db['Dynamics365Field'][_0xaadc('0x43')]({'where':{'id':_0xceacb1[_0xaadc('0x40')]['id']}})[_0xaadc('0x21')](handleEntityNotFound(_0x341e6e,null))[_0xaadc('0x21')](removeEntity(_0x341e6e,null))[_0xaadc('0x3e')](handleError(_0x341e6e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d3930d2..948756c 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 _0x0c6b=['lodash','util','../../config/logger','api','request-promise','path','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x2903bf,_0x4316b1){var _0x5c9e5e=function(_0x2b8b18){while(--_0x2b8b18){_0x2903bf['push'](_0x2903bf['shift']());}};_0x5c9e5e(++_0x4316b1);}(_0x0c6b,0x16c));var _0xb0c6=function(_0x2bf875,_0x5d646c){_0x2bf875=_0x2bf875-0x0;var _0x390588=_0x0c6b[_0x2bf875];return _0x390588;};'use strict';var _=require(_0xb0c6('0x0'));var util=require(_0xb0c6('0x1'));var logger=require(_0xb0c6('0x2'))(_0xb0c6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb0c6('0x4'));var fs=require('fs');var path=require(_0xb0c6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb0c6('0x6'));module['exports']=function(_0x44a7c8,_0x2dec40){return _0x44a7c8[_0xb0c6('0x7')](_0xb0c6('0x8'),attributes,{'tableName':_0xb0c6('0x9'),'paranoid':![],'indexes':[{'name':_0xb0c6('0xa'),'fields':[_0xb0c6('0xb'),_0xb0c6('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6cdc=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x3ac78b,_0x1c86d6){var _0x6a0a9d=function(_0x1440cd){while(--_0x1440cd){_0x3ac78b['push'](_0x3ac78b['shift']());}};_0x6a0a9d(++_0x1c86d6);}(_0x6cdc,0x174));var _0xc6cd=function(_0x31c7b6,_0x5778bb){_0x31c7b6=_0x31c7b6-0x0;var _0x5ea4cc=_0x6cdc[_0x31c7b6];return _0x5ea4cc;};'use strict';var _=require(_0xc6cd('0x0'));var util=require(_0xc6cd('0x1'));var logger=require(_0xc6cd('0x2'))(_0xc6cd('0x3'));var moment=require(_0xc6cd('0x4'));var BPromise=require(_0xc6cd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6cd('0x6'));var rimraf=require(_0xc6cd('0x7'));var config=require(_0xc6cd('0x8'));var attributes=require(_0xc6cd('0x9'));module[_0xc6cd('0xa')]=function(_0x45cce1,_0x409d8c){return _0x45cce1[_0xc6cd('0xb')](_0xc6cd('0xc'),attributes,{'tableName':_0xc6cd('0xd'),'paranoid':![],'indexes':[{'name':_0xc6cd('0xe'),'fields':['idField',_0xc6cd('0xf')],'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 b470ac2..d01d9a1 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 _0xc59e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x6c8b9b,_0xc36fb5){var _0x3c9b08=function(_0x27b754){while(--_0x27b754){_0x6c8b9b['push'](_0x6c8b9b['shift']());}};_0x3c9b08(++_0xc36fb5);}(_0xc59e,0xa7));var _0xec59=function(_0x2222e2,_0x783ed6){_0x2222e2=_0x2222e2-0x0;var _0x2f8892=_0xc59e[_0x2222e2];return _0x2f8892;};'use strict';var _=require(_0xec59('0x0'));var util=require(_0xec59('0x1'));var moment=require(_0xec59('0x2'));var BPromise=require(_0xec59('0x3'));var rs=require(_0xec59('0x4'));var fs=require('fs');var Redis=require(_0xec59('0x5'));var db=require(_0xec59('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xec59('0x7'))(_0xec59('0x8'));var config=require(_0xec59('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xec59('0xa')][_0xec59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3944ae,_0x12f9d6,_0x241069){return new BPromise(function(_0x46edfa,_0x257f97){return client[_0xec59('0xc')](_0x3944ae,_0x241069)[_0xec59('0xd')](function(_0xc9e208){logger[_0xec59('0xe')](_0xec59('0xf'),_0x12f9d6,_0xec59('0x10'));logger[_0xec59('0x11')](_0xec59('0x12'),_0x12f9d6,_0xec59('0x10'),JSON[_0xec59('0x13')](_0xc9e208));if(_0xc9e208['error']){if(_0xc9e208[_0xec59('0x14')]['code']===0x1f4){logger[_0xec59('0x14')](_0xec59('0xf'),_0x12f9d6,_0xc9e208['error'][_0xec59('0x15')]);return _0x257f97(_0xc9e208['error'][_0xec59('0x15')]);}logger[_0xec59('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x12f9d6,_0xc9e208[_0xec59('0x14')][_0xec59('0x15')]);return _0x46edfa(_0xc9e208[_0xec59('0x14')][_0xec59('0x15')]);}else{logger[_0xec59('0xe')](_0xec59('0xf'),_0x12f9d6,_0xec59('0x10'));_0x46edfa(_0xc9e208[_0xec59('0x16')]['message']);}})[_0xec59('0x17')](function(_0x41827d){logger['error'](_0xec59('0xf'),_0x12f9d6,_0x41827d);_0x257f97(_0x41827d);});});} \ No newline at end of file +var _0x1abd=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util'];(function(_0x2510ba,_0x31a470){var _0x3732b8=function(_0x5734f0){while(--_0x5734f0){_0x2510ba['push'](_0x2510ba['shift']());}};_0x3732b8(++_0x31a470);}(_0x1abd,0x12a));var _0xd1ab=function(_0x5227ab,_0x514da4){_0x5227ab=_0x5227ab-0x0;var _0x3dc702=_0x1abd[_0x5227ab];return _0x3dc702;};'use strict';var _=require('lodash');var util=require(_0xd1ab('0x0'));var moment=require(_0xd1ab('0x1'));var BPromise=require(_0xd1ab('0x2'));var rs=require(_0xd1ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1ab('0x4'))['db'];var utils=require(_0xd1ab('0x5'));var logger=require(_0xd1ab('0x6'))(_0xd1ab('0x7'));var config=require(_0xd1ab('0x8'));var jayson=require(_0xd1ab('0x9'));var client=jayson[_0xd1ab('0xa')][_0xd1ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ba0b5,_0x4dbbcb,_0xc17455){return new BPromise(function(_0xb21098,_0x5739d2){return client[_0xd1ab('0xc')](_0x2ba0b5,_0xc17455)[_0xd1ab('0xd')](function(_0x302133){logger['info'](_0xd1ab('0xe'),_0x4dbbcb,_0xd1ab('0xf'));logger['debug'](_0xd1ab('0x10'),_0x4dbbcb,_0xd1ab('0xf'),JSON[_0xd1ab('0x11')](_0x302133));if(_0x302133[_0xd1ab('0x12')]){if(_0x302133[_0xd1ab('0x12')][_0xd1ab('0x13')]===0x1f4){logger[_0xd1ab('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x4dbbcb,_0x302133[_0xd1ab('0x12')]['message']);return _0x5739d2(_0x302133[_0xd1ab('0x12')][_0xd1ab('0x14')]);}logger[_0xd1ab('0x12')](_0xd1ab('0xe'),_0x4dbbcb,_0x302133[_0xd1ab('0x12')]['message']);return _0xb21098(_0x302133[_0xd1ab('0x12')][_0xd1ab('0x14')]);}else{logger[_0xd1ab('0x15')](_0xd1ab('0xe'),_0x4dbbcb,_0xd1ab('0xf'));_0xb21098(_0x302133['result'][_0xd1ab('0x14')]);}})[_0xd1ab('0x16')](function(_0x5618e6){logger[_0xd1ab('0x12')](_0xd1ab('0xe'),_0x4dbbcb,_0x5618e6);_0x5739d2(_0x5618e6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c2533a6..0e113cd 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 _0x5e71=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer'];(function(_0xa56fd4,_0x111a54){var _0x3a3de8=function(_0xe884c){while(--_0xe884c){_0xa56fd4['push'](_0xa56fd4['shift']());}};_0x3a3de8(++_0x111a54);}(_0x5e71,0x12a));var _0x15e7=function(_0x3c382e,_0x3cae7c){_0x3c382e=_0x3c382e-0x0;var _0x15846c=_0x5e71[_0x3c382e];return _0x15846c;};'use strict';var multer=require(_0x15e7('0x0'));var util=require('util');var path=require(_0x15e7('0x1'));var timeout=require(_0x15e7('0x2'));var express=require(_0x15e7('0x3'));var router=express['Router']();var fs_extra=require(_0x15e7('0x4'));var auth=require(_0x15e7('0x5'));var interaction=require(_0x15e7('0x6'));var config=require(_0x15e7('0x7'));var controller=require(_0x15e7('0x8'));router['get']('/',auth[_0x15e7('0x9')](),controller[_0x15e7('0xa')]);router[_0x15e7('0xb')]('/:id',auth[_0x15e7('0x9')](),controller[_0x15e7('0xc')]);router['get'](_0x15e7('0xd'),auth[_0x15e7('0x9')](),controller['getConfigurations']);router[_0x15e7('0xb')]('/:id/fields',auth[_0x15e7('0x9')](),controller[_0x15e7('0xe')]);router[_0x15e7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x15e7('0xf')](_0x15e7('0xd'),auth[_0x15e7('0x9')](),controller[_0x15e7('0x10')]);router[_0x15e7('0x11')](_0x15e7('0x12'),auth[_0x15e7('0x9')](),controller[_0x15e7('0x13')]);router[_0x15e7('0x14')](_0x15e7('0x12'),auth[_0x15e7('0x9')](),controller[_0x15e7('0x15')]);module[_0x15e7('0x16')]=router; \ No newline at end of file +var _0xe867=['create','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x14f68b,_0x2b3261){var _0x54dc6e=function(_0x53bb9c){while(--_0x53bb9c){_0x14f68b['push'](_0x14f68b['shift']());}};_0x54dc6e(++_0x2b3261);}(_0xe867,0x13e));var _0x7e86=function(_0x2ad6d7,_0x3d7945){_0x2ad6d7=_0x2ad6d7-0x0;var _0x3b4109=_0xe867[_0x2ad6d7];return _0x3b4109;};'use strict';var multer=require(_0x7e86('0x0'));var util=require(_0x7e86('0x1'));var path=require('path');var timeout=require(_0x7e86('0x2'));var express=require(_0x7e86('0x3'));var router=express[_0x7e86('0x4')]();var fs_extra=require(_0x7e86('0x5'));var auth=require(_0x7e86('0x6'));var interaction=require(_0x7e86('0x7'));var config=require(_0x7e86('0x8'));var controller=require(_0x7e86('0x9'));router[_0x7e86('0xa')]('/',auth[_0x7e86('0xb')](),controller[_0x7e86('0xc')]);router[_0x7e86('0xa')](_0x7e86('0xd'),auth['isAuthenticated'](),controller[_0x7e86('0xe')]);router[_0x7e86('0xa')](_0x7e86('0xf'),auth[_0x7e86('0xb')](),controller[_0x7e86('0x10')]);router['get'](_0x7e86('0x11'),auth[_0x7e86('0xb')](),controller['getFields']);router['post']('/',auth[_0x7e86('0xb')](),controller[_0x7e86('0x12')]);router[_0x7e86('0x13')](_0x7e86('0xf'),auth[_0x7e86('0xb')](),controller['addConfiguration']);router[_0x7e86('0x14')](_0x7e86('0xd'),auth['isAuthenticated'](),controller[_0x7e86('0x15')]);router['delete']('/:id',auth[_0x7e86('0xb')](),controller[_0x7e86('0x16')]);module[_0x7e86('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e52dfb8..2b885d7 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 _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x37a96e,_0x2b35fe){var _0x137b72=function(_0x4fc9f8){while(--_0x4fc9f8){_0x37a96e['push'](_0x37a96e['shift']());}};_0x137b72(++_0x2b35fe);}(_0x02ce,0x1ac));var _0xe02c=function(_0x3bd9ab,_0x390fd9){_0x3bd9ab=_0x3bd9ab-0x0;var _0x5a287a=_0x02ce[_0x3bd9ab];return _0x5a287a;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x160f=['sequelize','exports','STRING','username','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'name':{'type':Sequelize[_0xf160('0x2')]},'description':{'type':Sequelize[_0xf160('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf160('0x3')},'apiKey':{'type':Sequelize[_0xf160('0x2')]},'remoteUri':{'type':Sequelize[_0xf160('0x2')],'unique':_0xf160('0x4')},'serverUrl':{'type':Sequelize[_0xf160('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 d54417b..ead1853 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 _0xec56=['fieldName','type','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','destroy','find','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','remoteUri','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','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','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','FreshdeskAccount','rawAttributes'];(function(_0x47810f,_0xec0b0a){var _0x574821=function(_0x42569a){while(--_0x42569a){_0x47810f['push'](_0x47810f['shift']());}};_0x574821(++_0xec0b0a);}(_0xec56,0x1bd));var _0x6ec5=function(_0x11425f,_0xd91cd3){_0x11425f=_0x11425f-0x0;var _0x3a1d04=_0xec56[_0x11425f];return _0x3a1d04;};'use strict';var emlformat=require(_0x6ec5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ec5('0x1'));var rp=require(_0x6ec5('0x2'));var moment=require(_0x6ec5('0x3'));var BPromise=require(_0x6ec5('0x4'));var Mustache=require(_0x6ec5('0x5'));var util=require(_0x6ec5('0x6'));var path=require(_0x6ec5('0x7'));var sox=require(_0x6ec5('0x8'));var csv=require(_0x6ec5('0x9'));var ejs=require(_0x6ec5('0xa'));var fs=require('fs');var fs_extra=require(_0x6ec5('0xb'));var _=require(_0x6ec5('0xc'));var squel=require(_0x6ec5('0xd'));var crypto=require(_0x6ec5('0xe'));var jsforce=require(_0x6ec5('0xf'));var deskjs=require(_0x6ec5('0x10'));var toCsv=require(_0x6ec5('0x9'));var querystring=require(_0x6ec5('0x11'));var Papa=require(_0x6ec5('0x12'));var Redis=require('ioredis');var authService=require(_0x6ec5('0x13'));var qs=require(_0x6ec5('0x14'));var as=require(_0x6ec5('0x15'));var hardwareService=require(_0x6ec5('0x16'));var logger=require(_0x6ec5('0x17'))(_0x6ec5('0x18'));var utils=require(_0x6ec5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6ec5('0x1a'));var db=require(_0x6ec5('0x1b'))['db'];var integrations=require(_0x6ec5('0x1c'));function respondWithStatusCode(_0xb04ab6,_0x135aaf){_0x135aaf=_0x135aaf||0xcc;return function(_0x2890fb){if(_0x2890fb){return _0xb04ab6[_0x6ec5('0x1d')](_0x135aaf);}return _0xb04ab6[_0x6ec5('0x1e')](_0x135aaf)['end']();};}function respondWithResult(_0x3ed07a,_0x4d1510){_0x4d1510=_0x4d1510||0xc8;return function(_0x14e9dc){if(_0x14e9dc){return _0x3ed07a[_0x6ec5('0x1e')](_0x4d1510)[_0x6ec5('0x1f')](_0x14e9dc);}};}function respondWithFilteredResult(_0x9fc0e7,_0xdc0b10){return function(_0x4d09fe){if(_0x4d09fe){var _0x13b725=typeof _0xdc0b10[_0x6ec5('0x20')]===_0x6ec5('0x21')&&typeof _0xdc0b10[_0x6ec5('0x22')]===_0x6ec5('0x21');var _0x42b690=_0x4d09fe[_0x6ec5('0x23')];var _0x4237bc=_0x13b725?0x0:_0xdc0b10[_0x6ec5('0x20')];var _0x3d5d45=_0x13b725?_0x4d09fe[_0x6ec5('0x23')]:_0xdc0b10[_0x6ec5('0x20')]+_0xdc0b10[_0x6ec5('0x22')];var _0x2228dd;if(_0x3d5d45>=_0x42b690){_0x3d5d45=_0x42b690;_0x2228dd=0xc8;}else{_0x2228dd=0xce;}_0x9fc0e7[_0x6ec5('0x1e')](_0x2228dd);return _0x9fc0e7[_0x6ec5('0x24')](_0x6ec5('0x25'),_0x4237bc+'-'+_0x3d5d45+'/'+_0x42b690)['json'](_0x4d09fe);}return null;};}function patchUpdates(_0x272532){return function(_0x1b1d96){try{jsonpatch[_0x6ec5('0x26')](_0x1b1d96,_0x272532,!![]);}catch(_0x20f5a6){return BPromise[_0x6ec5('0x27')](_0x20f5a6);}return _0x1b1d96[_0x6ec5('0x28')]();};}function saveUpdates(_0x18243f,_0x48733b){return function(_0x78c52c){if(_0x78c52c){return _0x78c52c[_0x6ec5('0x29')](_0x18243f)[_0x6ec5('0x2a')](function(_0x1560c6){return _0x1560c6;});}return null;};}function removeEntity(_0x57060c,_0x27f631){return function(_0x280748){if(_0x280748){return _0x280748['destroy']()[_0x6ec5('0x2a')](function(){_0x57060c[_0x6ec5('0x1e')](0xcc)[_0x6ec5('0x2b')]();});}};}function handleEntityNotFound(_0x5078e8,_0x1b779a){return function(_0xd0e8d7){if(!_0xd0e8d7){_0x5078e8[_0x6ec5('0x1d')](0x194);}return _0xd0e8d7;};}function handleError(_0x462488,_0x425fac){_0x425fac=_0x425fac||0x1f4;return function(_0x484847){logger[_0x6ec5('0x2c')](_0x484847[_0x6ec5('0x2d')]);if(_0x484847['name']){delete _0x484847[_0x6ec5('0x2e')];}_0x462488[_0x6ec5('0x1e')](_0x425fac)['send'](_0x484847);};}exports[_0x6ec5('0x2f')]=function(_0x3229db,_0x3bbf16){var _0xa227ff={},_0x116659={},_0x5a30ba={'count':0x0,'rows':[]};var _0x2b8c99=_[_0x6ec5('0x30')](db[_0x6ec5('0x31')][_0x6ec5('0x32')],function(_0x3e6d33){return{'name':_0x3e6d33[_0x6ec5('0x33')],'type':_0x3e6d33[_0x6ec5('0x34')]['key']};});_0x116659[_0x6ec5('0x35')]=_['map'](_0x2b8c99,_0x6ec5('0x2e'));_0x116659['query']=_[_0x6ec5('0x36')](_0x3229db[_0x6ec5('0x37')]);_0x116659['filters']=_['intersection'](_0x116659[_0x6ec5('0x35')],_0x116659[_0x6ec5('0x37')]);_0xa227ff['attributes']=_[_0x6ec5('0x38')](_0x116659[_0x6ec5('0x35')],qs['fields'](_0x3229db[_0x6ec5('0x37')][_0x6ec5('0x39')]));_0xa227ff[_0x6ec5('0x3a')]=_0xa227ff[_0x6ec5('0x3a')][_0x6ec5('0x3b')]?_0xa227ff[_0x6ec5('0x3a')]:_0x116659[_0x6ec5('0x35')];if(!_0x3229db[_0x6ec5('0x37')]['hasOwnProperty'](_0x6ec5('0x3c'))){_0xa227ff['limit']=qs[_0x6ec5('0x22')](_0x3229db[_0x6ec5('0x37')][_0x6ec5('0x22')]);_0xa227ff[_0x6ec5('0x20')]=qs[_0x6ec5('0x20')](_0x3229db[_0x6ec5('0x37')][_0x6ec5('0x20')]);}_0xa227ff[_0x6ec5('0x3d')]=qs[_0x6ec5('0x3e')](_0x3229db[_0x6ec5('0x37')][_0x6ec5('0x3e')]);_0xa227ff['where']=qs['filters'](_[_0x6ec5('0x3f')](_0x3229db['query'],_0x116659[_0x6ec5('0x40')]),_0x2b8c99);if(_0x3229db[_0x6ec5('0x37')][_0x6ec5('0x41')]){_0xa227ff[_0x6ec5('0x42')]=_[_0x6ec5('0x43')](_0xa227ff[_0x6ec5('0x42')],{'$or':_[_0x6ec5('0x30')](_0x2b8c99,function(_0x5a0a8c){if(_0x5a0a8c[_0x6ec5('0x34')]!==_0x6ec5('0x44')){var _0x42b134={};_0x42b134[_0x5a0a8c[_0x6ec5('0x2e')]]={'$like':'%'+_0x3229db[_0x6ec5('0x37')][_0x6ec5('0x41')]+'%'};return _0x42b134;}})});}_0xa227ff=_[_0x6ec5('0x43')]({},_0xa227ff,_0x3229db[_0x6ec5('0x45')]);var _0x17abcb={'where':_0xa227ff['where']};return db[_0x6ec5('0x31')]['count'](_0x17abcb)[_0x6ec5('0x2a')](function(_0x58bdd0){_0x5a30ba[_0x6ec5('0x23')]=_0x58bdd0;if(_0x3229db[_0x6ec5('0x37')]['includeAll']){_0xa227ff[_0x6ec5('0x46')]=[{'all':!![]}];}return db[_0x6ec5('0x31')][_0x6ec5('0x47')](_0xa227ff);})['then'](function(_0x2ebdd7){_0x5a30ba[_0x6ec5('0x48')]=_0x2ebdd7;return _0x5a30ba;})['then'](respondWithFilteredResult(_0x3bbf16,_0xa227ff))[_0x6ec5('0x49')](handleError(_0x3bbf16,null));};exports[_0x6ec5('0x4a')]=function(_0x22e6a2,_0xb8324){var _0x43d858={'raw':![],'where':{'id':_0x22e6a2[_0x6ec5('0x4b')]['id']}},_0x3744ab={};_0x3744ab[_0x6ec5('0x35')]=_[_0x6ec5('0x36')](db[_0x6ec5('0x31')][_0x6ec5('0x32')]);_0x3744ab['query']=_[_0x6ec5('0x36')](_0x22e6a2[_0x6ec5('0x37')]);_0x3744ab[_0x6ec5('0x40')]=_[_0x6ec5('0x38')](_0x3744ab['model'],_0x3744ab[_0x6ec5('0x37')]);_0x43d858[_0x6ec5('0x3a')]=_['intersection'](_0x3744ab[_0x6ec5('0x35')],qs['fields'](_0x22e6a2[_0x6ec5('0x37')][_0x6ec5('0x39')]));_0x43d858[_0x6ec5('0x3a')]=_0x43d858[_0x6ec5('0x3a')]['length']?_0x43d858['attributes']:_0x3744ab[_0x6ec5('0x35')];if(_0x22e6a2['query'][_0x6ec5('0x4c')]){_0x43d858[_0x6ec5('0x46')]=[{'all':!![]}];}_0x43d858=_[_0x6ec5('0x43')]({},_0x43d858,_0x22e6a2[_0x6ec5('0x45')]);return db[_0x6ec5('0x31')]['find'](_0x43d858)['then'](handleEntityNotFound(_0xb8324,null))[_0x6ec5('0x2a')](respondWithResult(_0xb8324,null))[_0x6ec5('0x49')](handleError(_0xb8324,null));};exports[_0x6ec5('0x4d')]=function(_0x45972a,_0x3ec67a){return db[_0x6ec5('0x31')][_0x6ec5('0x4d')](_0x45972a[_0x6ec5('0x4e')],{})[_0x6ec5('0x2a')](respondWithResult(_0x3ec67a,0xc9))[_0x6ec5('0x49')](handleError(_0x3ec67a,null));};exports[_0x6ec5('0x29')]=function(_0x1c5e2f,_0x2a41dd){if(_0x1c5e2f[_0x6ec5('0x4e')]['id']){delete _0x1c5e2f['body']['id'];}return db[_0x6ec5('0x31')]['find']({'where':{'id':_0x1c5e2f[_0x6ec5('0x4b')]['id']}})[_0x6ec5('0x2a')](handleEntityNotFound(_0x2a41dd,null))['then'](saveUpdates(_0x1c5e2f[_0x6ec5('0x4e')],null))[_0x6ec5('0x2a')](respondWithResult(_0x2a41dd,null))['catch'](handleError(_0x2a41dd,null));};exports[_0x6ec5('0x4f')]=function(_0x21a910,_0x486552){return db['FreshdeskAccount'][_0x6ec5('0x50')]({'where':{'id':_0x21a910['params']['id']}})['then'](handleEntityNotFound(_0x486552,null))[_0x6ec5('0x2a')](removeEntity(_0x486552,null))[_0x6ec5('0x49')](handleError(_0x486552,null));};exports[_0x6ec5('0x51')]=function(_0x16ac52,_0x5aecab,_0x32b3a1){var _0x2a310f={};var _0x2bad24={};var _0x33ec4b;var _0x9bde51;return db[_0x6ec5('0x31')][_0x6ec5('0x52')]({'where':{'id':_0x16ac52[_0x6ec5('0x4b')]['id']}})[_0x6ec5('0x2a')](handleEntityNotFound(_0x5aecab,null))[_0x6ec5('0x2a')](function(_0x29317f){if(_0x29317f){_0x33ec4b=_0x29317f;_0x2bad24[_0x6ec5('0x35')]=_[_0x6ec5('0x36')](db['FreshdeskConfiguration'][_0x6ec5('0x32')]);_0x2bad24[_0x6ec5('0x37')]=_['keys'](_0x16ac52[_0x6ec5('0x37')]);_0x2bad24[_0x6ec5('0x40')]=_[_0x6ec5('0x38')](_0x2bad24[_0x6ec5('0x35')],_0x2bad24[_0x6ec5('0x37')]);_0x2a310f['attributes']=_['intersection'](_0x2bad24[_0x6ec5('0x35')],qs['fields'](_0x16ac52[_0x6ec5('0x37')][_0x6ec5('0x39')]));_0x2a310f[_0x6ec5('0x3a')]=_0x2a310f[_0x6ec5('0x3a')][_0x6ec5('0x3b')]?_0x2a310f['attributes']:_0x2bad24[_0x6ec5('0x35')];_0x2a310f['order']=qs['sort'](_0x16ac52['query'][_0x6ec5('0x3e')]);_0x2a310f[_0x6ec5('0x42')]=qs['filters'](_['pick'](_0x16ac52[_0x6ec5('0x37')],_0x2bad24[_0x6ec5('0x40')]));if(_0x16ac52[_0x6ec5('0x37')][_0x6ec5('0x41')]){_0x2a310f[_0x6ec5('0x42')]=_['merge'](_0x2a310f[_0x6ec5('0x42')],{'$or':_[_0x6ec5('0x30')](_0x2a310f[_0x6ec5('0x3a')],function(_0x394604){var _0x156964={};_0x156964[_0x394604]={'$like':'%'+_0x16ac52['query'][_0x6ec5('0x41')]+'%'};return _0x156964;})});}_0x2a310f=_[_0x6ec5('0x43')]({},_0x2a310f,_0x16ac52[_0x6ec5('0x45')]);return _0x33ec4b[_0x6ec5('0x51')](_0x2a310f);}})[_0x6ec5('0x2a')](function(_0xe8a888){if(_0xe8a888){_0x9bde51=_0xe8a888[_0x6ec5('0x3b')];if(!_0x16ac52[_0x6ec5('0x37')][_0x6ec5('0x53')](_0x6ec5('0x3c'))){_0x2a310f[_0x6ec5('0x22')]=qs[_0x6ec5('0x22')](_0x16ac52[_0x6ec5('0x37')][_0x6ec5('0x22')]);_0x2a310f[_0x6ec5('0x20')]=qs[_0x6ec5('0x20')](_0x16ac52[_0x6ec5('0x37')]['offset']);}return _0x33ec4b[_0x6ec5('0x51')](_0x2a310f);}})['then'](function(_0x34157f){if(_0x34157f){return _0x34157f?{'count':_0x9bde51,'rows':_0x34157f}:null;}})['then'](respondWithResult(_0x5aecab,null))['catch'](handleError(_0x5aecab,null));};exports[_0x6ec5('0x54')]=function(_0x3ac2f1,_0x191b1e,_0x352f55){if(_0x3ac2f1[_0x6ec5('0x4e')]['id']){delete _0x3ac2f1['body']['id'];}return db[_0x6ec5('0x31')][_0x6ec5('0x52')]({'where':{'id':_0x3ac2f1[_0x6ec5('0x4b')]['id']}})[_0x6ec5('0x2a')](handleEntityNotFound(_0x191b1e,null))[_0x6ec5('0x2a')](function(_0x5d81c8){if(_0x5d81c8){_0x3ac2f1[_0x6ec5('0x4e')][_0x6ec5('0x55')]=_0x5d81c8['id'];_0x3ac2f1[_0x6ec5('0x4e')][_0x6ec5('0x56')]=integrations['getSubjects'](_0x3ac2f1[_0x6ec5('0x4e')][_0x6ec5('0x57')],_0x3ac2f1['body']['type']);_0x3ac2f1[_0x6ec5('0x4e')][_0x6ec5('0x58')]=integrations[_0x6ec5('0x59')](_0x3ac2f1[_0x6ec5('0x4e')][_0x6ec5('0x57')],_0x3ac2f1[_0x6ec5('0x4e')][_0x6ec5('0x34')]);return db[_0x6ec5('0x5a')][_0x6ec5('0x4d')](_0x3ac2f1[_0x6ec5('0x4e')],{'include':[{'model':db[_0x6ec5('0x5b')],'as':'Subjects'},{'model':db[_0x6ec5('0x5b')],'as':_0x6ec5('0x58')}]});}return null;})[_0x6ec5('0x2a')](respondWithResult(_0x191b1e,null))[_0x6ec5('0x49')](handleError(_0x191b1e,null));};exports['getFields']=function(_0x26869d,_0x1ac8be,_0x1d5ee3){var _0x1e4b50='';return db['FreshdeskAccount'][_0x6ec5('0x52')]({'where':{'id':_0x26869d[_0x6ec5('0x4b')]['id']},'attributes':['id',_0x6ec5('0x5c'),'apiKey']})['then'](handleEntityNotFound(_0x1ac8be,null))[_0x6ec5('0x2a')](function(_0x3e251c){if(_0x3e251c){_0x1e4b50=_0x3e251c['remoteUri'];var _0x1ac5a5=_0x1e4b50[_0x6ec5('0x5d')](-0x1);if(_0x1ac5a5==='/'){_0x1e4b50=_0x1e4b50[_0x6ec5('0x5e')](0x0,_0x1e4b50[_0x6ec5('0x5f')](_0x1ac5a5));}return rp({'method':'GET','uri':util[_0x6ec5('0x60')](_0x6ec5('0x61'),_0x1e4b50,_0x6ec5('0x62')),'headers':{'Authorization':util['format'](_0x6ec5('0x63'),new Buffer(util[_0x6ec5('0x60')](_0x6ec5('0x64'),_0x3e251c[_0x6ec5('0x65')]))[_0x6ec5('0x66')](_0x6ec5('0x67')))},'json':!![]});}})[_0x6ec5('0x2a')](function(_0xf44b2b){if(_0xf44b2b){var _0x4bf096=[_0x6ec5('0x68'),_0x6ec5('0x69'),'agent','description',_0x6ec5('0x1e'),_0x6ec5('0x6a'),_0x6ec5('0x6b'),'source',_0x6ec5('0x6c'),_0x6ec5('0x6b'),_0x6ec5('0x6d')];_[_0x6ec5('0x6e')](_0xf44b2b,function(_0x55511f){return _0x4bf096[_0x6ec5('0x6f')](_0x55511f[_0x6ec5('0x2e')])||!_0x55511f[_0x6ec5('0x70')]&&_0x55511f[_0x6ec5('0x34')]!==_0x6ec5('0x71')&&_0x55511f[_0x6ec5('0x34')]!==_0x6ec5('0x72');});return{'count':_0xf44b2b[_0x6ec5('0x3b')],'rows':_[_0x6ec5('0x30')](_0xf44b2b,function(_0x5a3d2d){return{'id':_0x5a3d2d['name'],'name':_0x5a3d2d[_0x6ec5('0x73')],'custom':!_0x5a3d2d[_0x6ec5('0x70')],'options':_0x5a3d2d[_0x6ec5('0x74')]?_['map'](_0x5a3d2d[_0x6ec5('0x74')],function(_0x4e6b30){return{'name':_[_0x6ec5('0x75')](_0x4e6b30),'value':_0x4e6b30};}):[]};})};}})[_0x6ec5('0x2a')](respondWithResult(_0x1ac8be,null))['catch'](function(_0x5f5486){var _0x2574e8=_0x26869d[_0x6ec5('0x37')][_0x6ec5('0x76')]?0x1f4:_0x5f5486[_0x6ec5('0x77')]||0x1f4;logger['error'](_0x6ec5('0x78'),_0x6ec5('0x79'),_0x2574e8,JSON[_0x6ec5('0x7a')](_0x5f5486));delete _0x5f5486['name'];if(_0x2574e8===0x191){_0x2574e8=0x190;}_0x1ac8be['status'](_0x2574e8)['send'](_0x26869d[_0x6ec5('0x37')][_0x6ec5('0x76')]?{'message':_0x6ec5('0x7b'),'statusCode':_0x5f5486[_0x6ec5('0x77')]}:_0x5f5486);});}; \ No newline at end of file +var _0x30fe=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','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','end','undefined','count','offset','set','Content-Range','json','save','update','then','sendStatus','error','stack','name','index','map','FreshdeskAccount','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird'];(function(_0x2fbfdb,_0x3f5361){var _0x11059f=function(_0x484698){while(--_0x484698){_0x2fbfdb['push'](_0x2fbfdb['shift']());}};_0x11059f(++_0x3f5361);}(_0x30fe,0x149));var _0xe30f=function(_0xcc5817,_0x249f84){_0xcc5817=_0xcc5817-0x0;var _0x201651=_0x30fe[_0xcc5817];return _0x201651;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe30f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe30f('0x1'));var rp=require('request-promise');var moment=require(_0xe30f('0x2'));var BPromise=require(_0xe30f('0x3'));var Mustache=require(_0xe30f('0x4'));var util=require(_0xe30f('0x5'));var path=require(_0xe30f('0x6'));var sox=require('sox');var csv=require(_0xe30f('0x7'));var ejs=require(_0xe30f('0x8'));var fs=require('fs');var fs_extra=require(_0xe30f('0x9'));var _=require(_0xe30f('0xa'));var squel=require(_0xe30f('0xb'));var crypto=require(_0xe30f('0xc'));var jsforce=require(_0xe30f('0xd'));var deskjs=require(_0xe30f('0xe'));var toCsv=require(_0xe30f('0x7'));var querystring=require(_0xe30f('0xf'));var Papa=require('papaparse');var Redis=require(_0xe30f('0x10'));var authService=require(_0xe30f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe30f('0x12'));var hardwareService=require(_0xe30f('0x13'));var logger=require(_0xe30f('0x14'))(_0xe30f('0x15'));var utils=require('../../config/utils');var config=require(_0xe30f('0x16'));var licenseUtil=require(_0xe30f('0x17'));var db=require(_0xe30f('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3859df,_0x19970e){_0x19970e=_0x19970e||0xcc;return function(_0x14863b){if(_0x14863b){return _0x3859df['sendStatus'](_0x19970e);}return _0x3859df[_0xe30f('0x19')](_0x19970e)[_0xe30f('0x1a')]();};}function respondWithResult(_0x122e2a,_0x7d684c){_0x7d684c=_0x7d684c||0xc8;return function(_0x53c3d2){if(_0x53c3d2){return _0x122e2a['status'](_0x7d684c)['json'](_0x53c3d2);}};}function respondWithFilteredResult(_0x3c9680,_0x494ad3){return function(_0x2b6a9b){if(_0x2b6a9b){var _0x1efa22=typeof _0x494ad3['offset']===_0xe30f('0x1b')&&typeof _0x494ad3['limit']===_0xe30f('0x1b');var _0x18518b=_0x2b6a9b[_0xe30f('0x1c')];var _0x20c2a5=_0x1efa22?0x0:_0x494ad3[_0xe30f('0x1d')];var _0x5ae935=_0x1efa22?_0x2b6a9b['count']:_0x494ad3[_0xe30f('0x1d')]+_0x494ad3['limit'];var _0x391ae6;if(_0x5ae935>=_0x18518b){_0x5ae935=_0x18518b;_0x391ae6=0xc8;}else{_0x391ae6=0xce;}_0x3c9680['status'](_0x391ae6);return _0x3c9680[_0xe30f('0x1e')](_0xe30f('0x1f'),_0x20c2a5+'-'+_0x5ae935+'/'+_0x18518b)[_0xe30f('0x20')](_0x2b6a9b);}return null;};}function patchUpdates(_0x2a0432){return function(_0x1f4533){try{jsonpatch['apply'](_0x1f4533,_0x2a0432,!![]);}catch(_0x59dfbd){return BPromise['reject'](_0x59dfbd);}return _0x1f4533[_0xe30f('0x21')]();};}function saveUpdates(_0x5af7b5,_0x322ee0){return function(_0x67af81){if(_0x67af81){return _0x67af81[_0xe30f('0x22')](_0x5af7b5)[_0xe30f('0x23')](function(_0x7f7b1f){return _0x7f7b1f;});}return null;};}function removeEntity(_0x378d6f,_0x50bca4){return function(_0x2f0eef){if(_0x2f0eef){return _0x2f0eef['destroy']()[_0xe30f('0x23')](function(){_0x378d6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc220,_0x11a539){return function(_0x5c5bd4){if(!_0x5c5bd4){_0x4fc220[_0xe30f('0x24')](0x194);}return _0x5c5bd4;};}function handleError(_0x25e3cf,_0x37c716){_0x37c716=_0x37c716||0x1f4;return function(_0x15ad85){logger[_0xe30f('0x25')](_0x15ad85[_0xe30f('0x26')]);if(_0x15ad85['name']){delete _0x15ad85[_0xe30f('0x27')];}_0x25e3cf[_0xe30f('0x19')](_0x37c716)['send'](_0x15ad85);};}exports[_0xe30f('0x28')]=function(_0x2d67d4,_0x5a6cc3){var _0x500626={},_0x5ae256={},_0x44080a={'count':0x0,'rows':[]};var _0xccbdc7=_[_0xe30f('0x29')](db[_0xe30f('0x2a')][_0xe30f('0x2b')],function(_0x36f1b8){return{'name':_0x36f1b8['fieldName'],'type':_0x36f1b8[_0xe30f('0x2c')]['key']};});_0x5ae256[_0xe30f('0x2d')]=_[_0xe30f('0x29')](_0xccbdc7,_0xe30f('0x27'));_0x5ae256[_0xe30f('0x2e')]=_['keys'](_0x2d67d4[_0xe30f('0x2e')]);_0x5ae256[_0xe30f('0x2f')]=_[_0xe30f('0x30')](_0x5ae256['model'],_0x5ae256[_0xe30f('0x2e')]);_0x500626['attributes']=_[_0xe30f('0x30')](_0x5ae256[_0xe30f('0x2d')],qs[_0xe30f('0x31')](_0x2d67d4[_0xe30f('0x2e')]['fields']));_0x500626[_0xe30f('0x32')]=_0x500626[_0xe30f('0x32')][_0xe30f('0x33')]?_0x500626[_0xe30f('0x32')]:_0x5ae256[_0xe30f('0x2d')];if(!_0x2d67d4[_0xe30f('0x2e')][_0xe30f('0x34')]('nolimit')){_0x500626[_0xe30f('0x35')]=qs[_0xe30f('0x35')](_0x2d67d4[_0xe30f('0x2e')]['limit']);_0x500626[_0xe30f('0x1d')]=qs[_0xe30f('0x1d')](_0x2d67d4['query'][_0xe30f('0x1d')]);}_0x500626['order']=qs[_0xe30f('0x36')](_0x2d67d4['query']['sort']);_0x500626['where']=qs[_0xe30f('0x2f')](_[_0xe30f('0x37')](_0x2d67d4['query'],_0x5ae256[_0xe30f('0x2f')]),_0xccbdc7);if(_0x2d67d4['query'][_0xe30f('0x38')]){_0x500626[_0xe30f('0x39')]=_[_0xe30f('0x3a')](_0x500626[_0xe30f('0x39')],{'$or':_['map'](_0xccbdc7,function(_0x4ae102){if(_0x4ae102[_0xe30f('0x2c')]!==_0xe30f('0x3b')){var _0x433ad6={};_0x433ad6[_0x4ae102[_0xe30f('0x27')]]={'$like':'%'+_0x2d67d4['query'][_0xe30f('0x38')]+'%'};return _0x433ad6;}})});}_0x500626=_['merge']({},_0x500626,_0x2d67d4[_0xe30f('0x3c')]);var _0x23f766={'where':_0x500626[_0xe30f('0x39')]};return db[_0xe30f('0x2a')]['count'](_0x23f766)['then'](function(_0x22fe6e){_0x44080a['count']=_0x22fe6e;if(_0x2d67d4[_0xe30f('0x2e')][_0xe30f('0x3d')]){_0x500626[_0xe30f('0x3e')]=[{'all':!![]}];}return db[_0xe30f('0x2a')]['findAll'](_0x500626);})[_0xe30f('0x23')](function(_0x2036cf){_0x44080a[_0xe30f('0x3f')]=_0x2036cf;return _0x44080a;})[_0xe30f('0x23')](respondWithFilteredResult(_0x5a6cc3,_0x500626))[_0xe30f('0x40')](handleError(_0x5a6cc3,null));};exports[_0xe30f('0x41')]=function(_0x400966,_0x2820f9){var _0x4a2c57={'raw':![],'where':{'id':_0x400966[_0xe30f('0x42')]['id']}},_0x32f0b4={};_0x32f0b4[_0xe30f('0x2d')]=_[_0xe30f('0x43')](db['FreshdeskAccount']['rawAttributes']);_0x32f0b4[_0xe30f('0x2e')]=_['keys'](_0x400966[_0xe30f('0x2e')]);_0x32f0b4['filters']=_[_0xe30f('0x30')](_0x32f0b4[_0xe30f('0x2d')],_0x32f0b4[_0xe30f('0x2e')]);_0x4a2c57[_0xe30f('0x32')]=_[_0xe30f('0x30')](_0x32f0b4[_0xe30f('0x2d')],qs[_0xe30f('0x31')](_0x400966['query'][_0xe30f('0x31')]));_0x4a2c57[_0xe30f('0x32')]=_0x4a2c57[_0xe30f('0x32')]['length']?_0x4a2c57[_0xe30f('0x32')]:_0x32f0b4[_0xe30f('0x2d')];if(_0x400966[_0xe30f('0x2e')][_0xe30f('0x3d')]){_0x4a2c57['include']=[{'all':!![]}];}_0x4a2c57=_[_0xe30f('0x3a')]({},_0x4a2c57,_0x400966[_0xe30f('0x3c')]);return db[_0xe30f('0x2a')][_0xe30f('0x44')](_0x4a2c57)[_0xe30f('0x23')](handleEntityNotFound(_0x2820f9,null))[_0xe30f('0x23')](respondWithResult(_0x2820f9,null))['catch'](handleError(_0x2820f9,null));};exports[_0xe30f('0x45')]=function(_0x381980,_0x140a7b){return db[_0xe30f('0x2a')]['create'](_0x381980[_0xe30f('0x46')],{})['then'](respondWithResult(_0x140a7b,0xc9))[_0xe30f('0x40')](handleError(_0x140a7b,null));};exports[_0xe30f('0x22')]=function(_0x4e8afa,_0x4180c1){if(_0x4e8afa[_0xe30f('0x46')]['id']){delete _0x4e8afa[_0xe30f('0x46')]['id'];}return db['FreshdeskAccount'][_0xe30f('0x44')]({'where':{'id':_0x4e8afa[_0xe30f('0x42')]['id']}})[_0xe30f('0x23')](handleEntityNotFound(_0x4180c1,null))[_0xe30f('0x23')](saveUpdates(_0x4e8afa[_0xe30f('0x46')],null))['then'](respondWithResult(_0x4180c1,null))['catch'](handleError(_0x4180c1,null));};exports['destroy']=function(_0x35a79e,_0x20fb4c){return db[_0xe30f('0x2a')][_0xe30f('0x44')]({'where':{'id':_0x35a79e[_0xe30f('0x42')]['id']}})[_0xe30f('0x23')](handleEntityNotFound(_0x20fb4c,null))[_0xe30f('0x23')](removeEntity(_0x20fb4c,null))[_0xe30f('0x40')](handleError(_0x20fb4c,null));};exports[_0xe30f('0x47')]=function(_0x597d05,_0xab6318,_0x3bc3a5){var _0x424e0b={};var _0x272c87={};var _0x45449b;var _0x2c720d;return db['FreshdeskAccount'][_0xe30f('0x48')]({'where':{'id':_0x597d05['params']['id']}})[_0xe30f('0x23')](handleEntityNotFound(_0xab6318,null))[_0xe30f('0x23')](function(_0x5602f9){if(_0x5602f9){_0x45449b=_0x5602f9;_0x272c87[_0xe30f('0x2d')]=_['keys'](db[_0xe30f('0x49')]['rawAttributes']);_0x272c87[_0xe30f('0x2e')]=_[_0xe30f('0x43')](_0x597d05[_0xe30f('0x2e')]);_0x272c87['filters']=_[_0xe30f('0x30')](_0x272c87['model'],_0x272c87[_0xe30f('0x2e')]);_0x424e0b[_0xe30f('0x32')]=_[_0xe30f('0x30')](_0x272c87[_0xe30f('0x2d')],qs[_0xe30f('0x31')](_0x597d05['query'][_0xe30f('0x31')]));_0x424e0b[_0xe30f('0x32')]=_0x424e0b[_0xe30f('0x32')]['length']?_0x424e0b[_0xe30f('0x32')]:_0x272c87[_0xe30f('0x2d')];_0x424e0b['order']=qs[_0xe30f('0x36')](_0x597d05[_0xe30f('0x2e')]['sort']);_0x424e0b[_0xe30f('0x39')]=qs[_0xe30f('0x2f')](_[_0xe30f('0x37')](_0x597d05['query'],_0x272c87['filters']));if(_0x597d05[_0xe30f('0x2e')][_0xe30f('0x38')]){_0x424e0b['where']=_['merge'](_0x424e0b['where'],{'$or':_['map'](_0x424e0b[_0xe30f('0x32')],function(_0x3bebcd){var _0x2073e4={};_0x2073e4[_0x3bebcd]={'$like':'%'+_0x597d05[_0xe30f('0x2e')][_0xe30f('0x38')]+'%'};return _0x2073e4;})});}_0x424e0b=_[_0xe30f('0x3a')]({},_0x424e0b,_0x597d05[_0xe30f('0x3c')]);return _0x45449b[_0xe30f('0x47')](_0x424e0b);}})[_0xe30f('0x23')](function(_0x31eaa8){if(_0x31eaa8){_0x2c720d=_0x31eaa8[_0xe30f('0x33')];if(!_0x597d05[_0xe30f('0x2e')][_0xe30f('0x34')](_0xe30f('0x4a'))){_0x424e0b[_0xe30f('0x35')]=qs[_0xe30f('0x35')](_0x597d05['query'][_0xe30f('0x35')]);_0x424e0b[_0xe30f('0x1d')]=qs[_0xe30f('0x1d')](_0x597d05[_0xe30f('0x2e')]['offset']);}return _0x45449b['getConfigurations'](_0x424e0b);}})[_0xe30f('0x23')](function(_0x5b770b){if(_0x5b770b){return _0x5b770b?{'count':_0x2c720d,'rows':_0x5b770b}:null;}})[_0xe30f('0x23')](respondWithResult(_0xab6318,null))[_0xe30f('0x40')](handleError(_0xab6318,null));};exports[_0xe30f('0x4b')]=function(_0x2a1bac,_0xaf871b,_0x5c94a8){if(_0x2a1bac[_0xe30f('0x46')]['id']){delete _0x2a1bac['body']['id'];}return db['FreshdeskAccount'][_0xe30f('0x48')]({'where':{'id':_0x2a1bac['params']['id']}})[_0xe30f('0x23')](handleEntityNotFound(_0xaf871b,null))[_0xe30f('0x23')](function(_0x1ca440){if(_0x1ca440){_0x2a1bac['body'][_0xe30f('0x4c')]=_0x1ca440['id'];_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x4d')]=integrations['getSubjects'](_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x4e')],_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x2c')]);_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x4f')]=integrations['getDescriptions'](_0x2a1bac[_0xe30f('0x46')][_0xe30f('0x4e')],_0x2a1bac['body'][_0xe30f('0x2c')]);return db['FreshdeskConfiguration']['create'](_0x2a1bac['body'],{'include':[{'model':db[_0xe30f('0x50')],'as':_0xe30f('0x4d')},{'model':db[_0xe30f('0x50')],'as':_0xe30f('0x4f')}]});}return null;})[_0xe30f('0x23')](respondWithResult(_0xaf871b,null))[_0xe30f('0x40')](handleError(_0xaf871b,null));};exports[_0xe30f('0x51')]=function(_0x48a5a1,_0x25ed9e,_0x213ff4){var _0x50e693='';return db['FreshdeskAccount'][_0xe30f('0x48')]({'where':{'id':_0x48a5a1['params']['id']},'attributes':['id',_0xe30f('0x52'),'apiKey']})[_0xe30f('0x23')](handleEntityNotFound(_0x25ed9e,null))[_0xe30f('0x23')](function(_0x2bb384){if(_0x2bb384){_0x50e693=_0x2bb384[_0xe30f('0x52')];var _0x4fc345=_0x50e693[_0xe30f('0x53')](-0x1);if(_0x4fc345==='/'){_0x50e693=_0x50e693['substring'](0x0,_0x50e693[_0xe30f('0x54')](_0x4fc345));}return rp({'method':_0xe30f('0x55'),'uri':util[_0xe30f('0x56')](_0xe30f('0x57'),_0x50e693,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xe30f('0x56')]('Basic\x20%s',new Buffer(util[_0xe30f('0x56')]('%s:X',_0x2bb384[_0xe30f('0x58')]))[_0xe30f('0x59')](_0xe30f('0x5a')))},'json':!![]});}})[_0xe30f('0x23')](function(_0x503f03){if(_0x503f03){var _0x655e33=[_0xe30f('0x5b'),_0xe30f('0x5c'),_0xe30f('0x5d'),_0xe30f('0x5e'),'status',_0xe30f('0x5f'),_0xe30f('0x60'),'source',_0xe30f('0x61'),_0xe30f('0x60'),_0xe30f('0x62')];_[_0xe30f('0x63')](_0x503f03,function(_0xf6e16c){return _0x655e33[_0xe30f('0x64')](_0xf6e16c[_0xe30f('0x27')])||!_0xf6e16c[_0xe30f('0x65')]&&_0xf6e16c[_0xe30f('0x2c')]!==_0xe30f('0x66')&&_0xf6e16c[_0xe30f('0x2c')]!==_0xe30f('0x67');});return{'count':_0x503f03[_0xe30f('0x33')],'rows':_[_0xe30f('0x29')](_0x503f03,function(_0x4f4fc7){return{'id':_0x4f4fc7[_0xe30f('0x27')],'name':_0x4f4fc7[_0xe30f('0x68')],'custom':!_0x4f4fc7[_0xe30f('0x65')],'options':_0x4f4fc7[_0xe30f('0x69')]?_[_0xe30f('0x29')](_0x4f4fc7[_0xe30f('0x69')],function(_0x5001b7){return{'name':_['capitalize'](_0x5001b7),'value':_0x5001b7};}):[]};})};}})[_0xe30f('0x23')](respondWithResult(_0x25ed9e,null))[_0xe30f('0x40')](function(_0x3f8ef3){var _0x1b02a2=_0x48a5a1[_0xe30f('0x2e')][_0xe30f('0x6a')]?0x1f4:_0x3f8ef3[_0xe30f('0x6b')]||0x1f4;logger['error'](_0xe30f('0x6c'),_0xe30f('0x51'),_0x1b02a2,JSON['stringify'](_0x3f8ef3));delete _0x3f8ef3[_0xe30f('0x27')];if(_0x1b02a2===0x191){_0x1b02a2=0x190;}_0x25ed9e[_0xe30f('0x19')](_0x1b02a2)[_0xe30f('0x6d')](_0x48a5a1[_0xe30f('0x2e')][_0xe30f('0x6a')]?{'message':_0xe30f('0x6e'),'statusCode':_0x3f8ef3[_0xe30f('0x6b')]}:_0x3f8ef3);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 04b4a9f..500cf31 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 _0x23ae=['api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','util'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x23ae,0x17e));var _0xe23a=function(_0x214376,_0x1deff9){_0x214376=_0x214376-0x0;var _0x5f404c=_0x23ae[_0x214376];return _0x5f404c;};'use strict';var _=require(_0xe23a('0x0'));var util=require(_0xe23a('0x1'));var logger=require('../../config/logger')(_0xe23a('0x2'));var moment=require(_0xe23a('0x3'));var BPromise=require('bluebird');var rp=require(_0xe23a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe23a('0x5'));var config=require(_0xe23a('0x6'));var attributes=require(_0xe23a('0x7'));var integrations=require(_0xe23a('0x8'));module[_0xe23a('0x9')]=function(_0x27c78a,_0x270713){return _0x27c78a[_0xe23a('0xa')]('FreshdeskAccount',attributes,{'tableName':_0xe23a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc2=['bluebird','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fc2,0x97));var _0x25fc=function(_0x5a56cc,_0x29650c){_0x5a56cc=_0x5a56cc-0x0;var _0x589caa=_0x5fc2[_0x5a56cc];return _0x589caa;};'use strict';var _=require('lodash');var util=require(_0x25fc('0x0'));var logger=require(_0x25fc('0x1'))('api');var moment=require(_0x25fc('0x2'));var BPromise=require(_0x25fc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x25fc('0x4'));var config=require(_0x25fc('0x5'));var attributes=require(_0x25fc('0x6'));var integrations=require(_0x25fc('0x7'));module['exports']=function(_0x3e5f4a,_0x11622a){return _0x3e5f4a[_0x25fc('0x8')](_0x25fc('0x9'),attributes,{'tableName':_0x25fc('0xa'),'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 fc570fa..89b9f3e 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 _0xcf9e=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','model','map','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0xcf9e,0x83));var _0xecf9=function(_0x235423,_0x18ee60){_0x235423=_0x235423-0x0;var _0x43f4d=_0xcf9e[_0x235423];return _0x43f4d;};'use strict';var _=require(_0xecf9('0x0'));var util=require(_0xecf9('0x1'));var moment=require(_0xecf9('0x2'));var BPromise=require(_0xecf9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecf9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xecf9('0x5'));var logger=require('../../config/logger')(_0xecf9('0x6'));var config=require(_0xecf9('0x7'));var jayson=require(_0xecf9('0x8'));var client=jayson[_0xecf9('0x9')][_0xecf9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x574f85,_0x167826,_0x4265bf){return new BPromise(function(_0x59e5aa,_0x25b74e){return client[_0xecf9('0xb')](_0x574f85,_0x4265bf)[_0xecf9('0xc')](function(_0x3e4a5e){logger['info'](_0xecf9('0xd'),_0x167826,_0xecf9('0xe'));logger[_0xecf9('0xf')](_0xecf9('0x10'),_0x167826,_0xecf9('0xe'),JSON[_0xecf9('0x11')](_0x3e4a5e));if(_0x3e4a5e[_0xecf9('0x12')]){if(_0x3e4a5e[_0xecf9('0x12')][_0xecf9('0x13')]===0x1f4){logger['error'](_0xecf9('0xd'),_0x167826,_0x3e4a5e[_0xecf9('0x12')][_0xecf9('0x14')]);return _0x25b74e(_0x3e4a5e[_0xecf9('0x12')][_0xecf9('0x14')]);}logger[_0xecf9('0x12')](_0xecf9('0xd'),_0x167826,_0x3e4a5e[_0xecf9('0x12')]['message']);return _0x59e5aa(_0x3e4a5e[_0xecf9('0x12')][_0xecf9('0x14')]);}else{logger[_0xecf9('0x15')](_0xecf9('0xd'),_0x167826,'request\x20sent');_0x59e5aa(_0x3e4a5e[_0xecf9('0x16')][_0xecf9('0x14')]);}})[_0xecf9('0x17')](function(_0x179407){logger['error'](_0xecf9('0xd'),_0x167826,_0x179407);_0x25b74e(_0x179407);});});}exports[_0xecf9('0x18')]=function(_0x328d22){var _0xdd6e8d=this;return new Promise(function(_0x5f591f,_0x2be372){return db[_0xecf9('0x19')][_0xecf9('0x1a')]({'raw':_0x328d22[_0xecf9('0x1b')]?_0x328d22[_0xecf9('0x1b')][_0xecf9('0x1c')]===undefined?!![]:![]:!![],'where':_0x328d22[_0xecf9('0x1b')]?_0x328d22[_0xecf9('0x1b')][_0xecf9('0x1d')]||null:null,'attributes':_0x328d22[_0xecf9('0x1b')]?_0x328d22['options'][_0xecf9('0x1e')]||null:null,'limit':_0x328d22['options']?_0x328d22[_0xecf9('0x1b')]['limit']||null:null,'include':_0x328d22['options']?_0x328d22[_0xecf9('0x1b')][_0xecf9('0x1f')]?_['map'](_0x328d22[_0xecf9('0x1b')][_0xecf9('0x1f')],function(_0x3e8416){return{'model':db[_0x3e8416[_0xecf9('0x20')]],'as':_0x3e8416['as'],'attributes':_0x3e8416[_0xecf9('0x1e')],'include':_0x3e8416[_0xecf9('0x1f')]?_['map'](_0x3e8416[_0xecf9('0x1f')],function(_0x3becff){return{'model':db[_0x3becff[_0xecf9('0x20')]],'as':_0x3becff['as'],'attributes':_0x3becff[_0xecf9('0x1e')],'include':_0x3becff[_0xecf9('0x1f')]?_[_0xecf9('0x21')](_0x3becff[_0xecf9('0x1f')],function(_0x230410){return{'model':db[_0x230410[_0xecf9('0x20')]],'as':_0x230410['as'],'attributes':_0x230410[_0xecf9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xecf9('0xc')](function(_0xceb8c2){logger[_0xecf9('0x15')]('GetFreshdeskAccount',_0x328d22);logger['debug'](_0xecf9('0x18'),_0x328d22,JSON[_0xecf9('0x11')](_0xceb8c2));_0x5f591f(_0xceb8c2);})[_0xecf9('0x17')](function(_0x2011c5){logger['error']('GetFreshdeskAccount',_0x2011c5[_0xecf9('0x14')],_0x328d22);_0x2be372(_0xdd6e8d[_0xecf9('0x12')](0x1f4,_0x2011c5[_0xecf9('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x2d8215){var _0x45fd35=this;return new Promise(function(_0x380c59,_0x43efe2){return db[_0xecf9('0x19')][_0xecf9('0x22')]({'raw':_0x2d8215[_0xecf9('0x1b')]?_0x2d8215['options'][_0xecf9('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d8215[_0xecf9('0x1b')]?_0x2d8215[_0xecf9('0x1b')][_0xecf9('0x1d')]||null:null,'attributes':_0x2d8215[_0xecf9('0x1b')]?_0x2d8215['options'][_0xecf9('0x1e')]||null:null,'include':_0x2d8215['options']?_0x2d8215[_0xecf9('0x1b')][_0xecf9('0x1f')]?_[_0xecf9('0x21')](_0x2d8215[_0xecf9('0x1b')][_0xecf9('0x1f')],function(_0x469837){return{'model':db[_0x469837[_0xecf9('0x20')]],'as':_0x469837['as'],'attributes':_0x469837[_0xecf9('0x1e')],'include':_0x469837['include']?_['map'](_0x469837[_0xecf9('0x1f')],function(_0x45d516){return{'model':db[_0x45d516[_0xecf9('0x20')]],'as':_0x45d516['as'],'attributes':_0x45d516[_0xecf9('0x1e')],'include':_0x45d516['include']?_['map'](_0x45d516[_0xecf9('0x1f')],function(_0x10ecdc){return{'model':db[_0x10ecdc[_0xecf9('0x20')]],'as':_0x10ecdc['as'],'attributes':_0x10ecdc[_0xecf9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xecf9('0xc')](function(_0x5180d5){logger[_0xecf9('0x15')](_0xecf9('0x23'),_0x2d8215);logger[_0xecf9('0xf')](_0xecf9('0x23'),_0x2d8215,JSON[_0xecf9('0x11')](_0x5180d5));_0x380c59(_0x5180d5);})['catch'](function(_0x266120){logger[_0xecf9('0x12')]('ShowFreshdeskAccount',_0x266120[_0xecf9('0x14')],_0x2d8215);_0x43efe2(_0x45fd35[_0xecf9('0x12')](0x1f4,_0x266120['message']));});});}; \ No newline at end of file +var _0xbfd2=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','info','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','lodash','moment','bluebird','../../config/utils','rpc','../../config/environment','http','request','request\x20sent'];(function(_0x234cdb,_0x28750b){var _0x1d18bb=function(_0x42c67e){while(--_0x42c67e){_0x234cdb['push'](_0x234cdb['shift']());}};_0x1d18bb(++_0x28750b);}(_0xbfd2,0x123));var _0x2bfd=function(_0x270b7f,_0x1bbf84){_0x270b7f=_0x270b7f-0x0;var _0x3a1861=_0xbfd2[_0x270b7f];return _0x3a1861;};'use strict';var _=require(_0x2bfd('0x0'));var util=require('util');var moment=require(_0x2bfd('0x1'));var BPromise=require(_0x2bfd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2bfd('0x3'));var logger=require('../../config/logger')(_0x2bfd('0x4'));var config=require(_0x2bfd('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2bfd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46adf7,_0x536e10,_0xd016cd){return new BPromise(function(_0x34bef9,_0x43c8ed){return client[_0x2bfd('0x7')](_0x46adf7,_0xd016cd)['then'](function(_0x16ae37){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x536e10,_0x2bfd('0x8'));logger[_0x2bfd('0x9')](_0x2bfd('0xa'),_0x536e10,_0x2bfd('0x8'),JSON[_0x2bfd('0xb')](_0x16ae37));if(_0x16ae37[_0x2bfd('0xc')]){if(_0x16ae37[_0x2bfd('0xc')][_0x2bfd('0xd')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x536e10,_0x16ae37[_0x2bfd('0xc')]['message']);return _0x43c8ed(_0x16ae37[_0x2bfd('0xc')][_0x2bfd('0xe')]);}logger[_0x2bfd('0xc')](_0x2bfd('0xf'),_0x536e10,_0x16ae37[_0x2bfd('0xc')][_0x2bfd('0xe')]);return _0x34bef9(_0x16ae37['error'][_0x2bfd('0xe')]);}else{logger[_0x2bfd('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x536e10,_0x2bfd('0x8'));_0x34bef9(_0x16ae37[_0x2bfd('0x11')][_0x2bfd('0xe')]);}})[_0x2bfd('0x12')](function(_0x3619b1){logger[_0x2bfd('0xc')](_0x2bfd('0xf'),_0x536e10,_0x3619b1);_0x43c8ed(_0x3619b1);});});}exports[_0x2bfd('0x13')]=function(_0x5608b3){var _0xfe61=this;return new Promise(function(_0x8cbf1f,_0x85c9f4){return db['FreshdeskAccount'][_0x2bfd('0x14')]({'raw':_0x5608b3['options']?_0x5608b3[_0x2bfd('0x15')][_0x2bfd('0x16')]===undefined?!![]:![]:!![],'where':_0x5608b3['options']?_0x5608b3['options'][_0x2bfd('0x17')]||null:null,'attributes':_0x5608b3[_0x2bfd('0x15')]?_0x5608b3['options'][_0x2bfd('0x18')]||null:null,'limit':_0x5608b3[_0x2bfd('0x15')]?_0x5608b3[_0x2bfd('0x15')]['limit']||null:null,'include':_0x5608b3[_0x2bfd('0x15')]?_0x5608b3[_0x2bfd('0x15')][_0x2bfd('0x19')]?_[_0x2bfd('0x1a')](_0x5608b3['options'][_0x2bfd('0x19')],function(_0x272424){return{'model':db[_0x272424[_0x2bfd('0x1b')]],'as':_0x272424['as'],'attributes':_0x272424[_0x2bfd('0x18')],'include':_0x272424[_0x2bfd('0x19')]?_[_0x2bfd('0x1a')](_0x272424[_0x2bfd('0x19')],function(_0x39e1ab){return{'model':db[_0x39e1ab[_0x2bfd('0x1b')]],'as':_0x39e1ab['as'],'attributes':_0x39e1ab[_0x2bfd('0x18')],'include':_0x39e1ab['include']?_[_0x2bfd('0x1a')](_0x39e1ab['include'],function(_0x583cd3){return{'model':db[_0x583cd3['model']],'as':_0x583cd3['as'],'attributes':_0x583cd3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x348c30){logger[_0x2bfd('0x10')](_0x2bfd('0x13'),_0x5608b3);logger[_0x2bfd('0x9')]('GetFreshdeskAccount',_0x5608b3,JSON[_0x2bfd('0xb')](_0x348c30));_0x8cbf1f(_0x348c30);})[_0x2bfd('0x12')](function(_0x8e10b7){logger[_0x2bfd('0xc')]('GetFreshdeskAccount',_0x8e10b7[_0x2bfd('0xe')],_0x5608b3);_0x85c9f4(_0xfe61[_0x2bfd('0xc')](0x1f4,_0x8e10b7[_0x2bfd('0xe')]));});});};exports[_0x2bfd('0x1c')]=function(_0x3d7c18){var _0x2b72bc=this;return new Promise(function(_0x26b6ae,_0x1b7b0a){return db[_0x2bfd('0x1d')]['find']({'raw':_0x3d7c18[_0x2bfd('0x15')]?_0x3d7c18[_0x2bfd('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3d7c18['options']?_0x3d7c18[_0x2bfd('0x15')]['where']||null:null,'attributes':_0x3d7c18[_0x2bfd('0x15')]?_0x3d7c18[_0x2bfd('0x15')][_0x2bfd('0x18')]||null:null,'include':_0x3d7c18[_0x2bfd('0x15')]?_0x3d7c18['options'][_0x2bfd('0x19')]?_[_0x2bfd('0x1a')](_0x3d7c18[_0x2bfd('0x15')][_0x2bfd('0x19')],function(_0x3b0f3b){return{'model':db[_0x3b0f3b['model']],'as':_0x3b0f3b['as'],'attributes':_0x3b0f3b[_0x2bfd('0x18')],'include':_0x3b0f3b['include']?_[_0x2bfd('0x1a')](_0x3b0f3b['include'],function(_0x4720ca){return{'model':db[_0x4720ca[_0x2bfd('0x1b')]],'as':_0x4720ca['as'],'attributes':_0x4720ca[_0x2bfd('0x18')],'include':_0x4720ca[_0x2bfd('0x19')]?_['map'](_0x4720ca['include'],function(_0x4c7418){return{'model':db[_0x4c7418['model']],'as':_0x4c7418['as'],'attributes':_0x4c7418[_0x2bfd('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f98de){logger[_0x2bfd('0x10')](_0x2bfd('0x1c'),_0x3d7c18);logger['debug'](_0x2bfd('0x1c'),_0x3d7c18,JSON[_0x2bfd('0xb')](_0x1f98de));_0x26b6ae(_0x1f98de);})[_0x2bfd('0x12')](function(_0x4dc1a4){logger[_0x2bfd('0xc')](_0x2bfd('0x1c'),_0x4dc1a4['message'],_0x3d7c18);_0x1b7b0a(_0x2b72bc[_0x2bfd('0xc')](0x1f4,_0x4dc1a4[_0x2bfd('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 3f180d4..1aa4a72 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 _0x46da=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','index','get','/:id','show','getFields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','post','/:id/tags','setTags','put','update','destroy','exports','multer'];(function(_0x3f6ff4,_0xf55569){var _0x1ba6ad=function(_0x473359){while(--_0x473359){_0x3f6ff4['push'](_0x3f6ff4['shift']());}};_0x1ba6ad(++_0xf55569);}(_0x46da,0x151));var _0xa46d=function(_0x574947,_0x1687c6){_0x574947=_0x574947-0x0;var _0x388b21=_0x46da[_0x574947];return _0x388b21;};'use strict';var multer=require(_0xa46d('0x0'));var util=require(_0xa46d('0x1'));var path=require(_0xa46d('0x2'));var timeout=require(_0xa46d('0x3'));var express=require(_0xa46d('0x4'));var router=express[_0xa46d('0x5')]();var fs_extra=require(_0xa46d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa46d('0x7'));var config=require(_0xa46d('0x8'));var controller=require(_0xa46d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xa46d('0xa')]);router[_0xa46d('0xb')](_0xa46d('0xc'),auth['isAuthenticated'](),controller[_0xa46d('0xd')]);router[_0xa46d('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa46d('0xe')]);router[_0xa46d('0xb')](_0xa46d('0xf'),auth[_0xa46d('0x10')](),controller['getSubjects']);router[_0xa46d('0xb')](_0xa46d('0x11'),auth['isAuthenticated'](),controller[_0xa46d('0x12')]);router[_0xa46d('0xb')]('/:id/tags',auth[_0xa46d('0x10')](),controller['getTags']);router[_0xa46d('0x13')]('/',auth[_0xa46d('0x10')](),controller['create']);router['post'](_0xa46d('0x14'),auth['isAuthenticated'](),controller[_0xa46d('0x15')]);router[_0xa46d('0x16')](_0xa46d('0xc'),auth[_0xa46d('0x10')](),controller[_0xa46d('0x17')]);router['delete'](_0xa46d('0xc'),auth['isAuthenticated'](),controller[_0xa46d('0x18')]);module[_0xa46d('0x19')]=router; \ No newline at end of file +var _0xd46d=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','put','/:id','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd46d,0x16a));var _0xdd46=function(_0x2f1455,_0x4e9c59){_0x2f1455=_0x2f1455-0x0;var _0x711682=_0xd46d[_0x2f1455];return _0x711682;};'use strict';var multer=require(_0xdd46('0x0'));var util=require(_0xdd46('0x1'));var path=require(_0xdd46('0x2'));var timeout=require('connect-timeout');var express=require(_0xdd46('0x3'));var router=express[_0xdd46('0x4')]();var fs_extra=require(_0xdd46('0x5'));var auth=require(_0xdd46('0x6'));var interaction=require(_0xdd46('0x7'));var config=require(_0xdd46('0x8'));var controller=require(_0xdd46('0x9'));router[_0xdd46('0xa')]('/',auth[_0xdd46('0xb')](),controller['index']);router['get']('/:id',auth[_0xdd46('0xb')](),controller[_0xdd46('0xc')]);router[_0xdd46('0xa')]('/:id/fields',auth[_0xdd46('0xb')](),controller['getFields']);router[_0xdd46('0xa')](_0xdd46('0xd'),auth[_0xdd46('0xb')](),controller[_0xdd46('0xe')]);router[_0xdd46('0xa')](_0xdd46('0xf'),auth[_0xdd46('0xb')](),controller['getDescriptions']);router[_0xdd46('0xa')](_0xdd46('0x10'),auth[_0xdd46('0xb')](),controller[_0xdd46('0x11')]);router[_0xdd46('0x12')]('/',auth[_0xdd46('0xb')](),controller['create']);router[_0xdd46('0x12')]('/:id/tags',auth[_0xdd46('0xb')](),controller['setTags']);router[_0xdd46('0x13')](_0xdd46('0x14'),auth[_0xdd46('0xb')](),controller['update']);router[_0xdd46('0x15')](_0xdd46('0x14'),auth[_0xdd46('0xb')](),controller[_0xdd46('0x16')]);module[_0xdd46('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ab6ca2c..524623b 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 _0x6c59=['sequelize','exports'];(function(_0x2c6af3,_0x3ce442){var _0x4895bf=function(_0x5566cf){while(--_0x5566cf){_0x2c6af3['push'](_0x2c6af3['shift']());}};_0x4895bf(++_0x3ce442);}(_0x6c59,0x1f4));var _0x96c5=function(_0xa52034,_0x3ef4ff){_0xa52034=_0xa52034-0x0;var _0x440dd4=_0x6c59[_0xa52034];return _0x440dd4;};'use strict';var Sequelize=require(_0x96c5('0x0'));module[_0x96c5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x967e=['sequelize','exports'];(function(_0x13b193,_0x256b21){var _0x59c8fc=function(_0x2c34cd){while(--_0x2c34cd){_0x13b193['push'](_0x13b193['shift']());}};_0x59c8fc(++_0x256b21);}(_0x967e,0x10e));var _0xe967=function(_0x501b33,_0x506d80){_0x501b33=_0x501b33-0x0;var _0x1613e4=_0x967e[_0x501b33];return _0x1613e4;};'use strict';var Sequelize=require(_0xe967('0x0'));module[_0xe967('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 927c93c..370d9e5 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 _0x1c1b=['save','update','destroy','then','sendStatus','error','stack','name','send','index','map','FreshdeskConfiguration','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','findOne','FreshdeskField','length','options','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x21ffa2,_0x1406fb){var _0x4e779f=function(_0x25336a){while(--_0x25336a){_0x21ffa2['push'](_0x21ffa2['shift']());}};_0x4e779f(++_0x1406fb);}(_0x1c1b,0x132));var _0xb1c1=function(_0xb3d8c4,_0x21519e){_0xb3d8c4=_0xb3d8c4-0x0;var _0x5a420a=_0x1c1b[_0xb3d8c4];return _0x5a420a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1c1('0x1'));var rp=require(_0xb1c1('0x2'));var moment=require(_0xb1c1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb1c1('0x4'));var util=require(_0xb1c1('0x5'));var path=require('path');var sox=require(_0xb1c1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1c1('0x7'));var _=require('lodash');var squel=require(_0xb1c1('0x8'));var crypto=require(_0xb1c1('0x9'));var jsforce=require(_0xb1c1('0xa'));var deskjs=require(_0xb1c1('0xb'));var toCsv=require(_0xb1c1('0xc'));var querystring=require(_0xb1c1('0xd'));var Papa=require('papaparse');var Redis=require(_0xb1c1('0xe'));var authService=require(_0xb1c1('0xf'));var qs=require(_0xb1c1('0x10'));var as=require(_0xb1c1('0x11'));var hardwareService=require(_0xb1c1('0x12'));var logger=require(_0xb1c1('0x13'))(_0xb1c1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb1c1('0x15'));var db=require(_0xb1c1('0x16'))['db'];function respondWithStatusCode(_0x4177a3,_0x10d39f){_0x10d39f=_0x10d39f||0xcc;return function(_0x32f2a2){if(_0x32f2a2){return _0x4177a3['sendStatus'](_0x10d39f);}return _0x4177a3[_0xb1c1('0x17')](_0x10d39f)[_0xb1c1('0x18')]();};}function respondWithResult(_0x32be66,_0x19279d){_0x19279d=_0x19279d||0xc8;return function(_0x1be2e8){if(_0x1be2e8){return _0x32be66[_0xb1c1('0x17')](_0x19279d)[_0xb1c1('0x19')](_0x1be2e8);}};}function respondWithFilteredResult(_0xe444c4,_0x2109e9){return function(_0x2d8a89){if(_0x2d8a89){var _0x567d89=typeof _0x2109e9[_0xb1c1('0x1a')]===_0xb1c1('0x1b')&&typeof _0x2109e9['limit']===_0xb1c1('0x1b');var _0x1175e6=_0x2d8a89[_0xb1c1('0x1c')];var _0x153427=_0x567d89?0x0:_0x2109e9[_0xb1c1('0x1a')];var _0x21821a=_0x567d89?_0x2d8a89[_0xb1c1('0x1c')]:_0x2109e9[_0xb1c1('0x1a')]+_0x2109e9[_0xb1c1('0x1d')];var _0x4abce1;if(_0x21821a>=_0x1175e6){_0x21821a=_0x1175e6;_0x4abce1=0xc8;}else{_0x4abce1=0xce;}_0xe444c4['status'](_0x4abce1);return _0xe444c4[_0xb1c1('0x1e')](_0xb1c1('0x1f'),_0x153427+'-'+_0x21821a+'/'+_0x1175e6)[_0xb1c1('0x19')](_0x2d8a89);}return null;};}function patchUpdates(_0x1bd6d0){return function(_0x243a18){try{jsonpatch[_0xb1c1('0x20')](_0x243a18,_0x1bd6d0,!![]);}catch(_0x4299f5){return BPromise[_0xb1c1('0x21')](_0x4299f5);}return _0x243a18[_0xb1c1('0x22')]();};}function saveUpdates(_0x47434d,_0x50b549){return function(_0x570ea9){if(_0x570ea9){return _0x570ea9[_0xb1c1('0x23')](_0x47434d)['then'](function(_0x26b9bf){return _0x26b9bf;});}return null;};}function removeEntity(_0x46650b,_0xf1c6f3){return function(_0x4d7739){if(_0x4d7739){return _0x4d7739[_0xb1c1('0x24')]()[_0xb1c1('0x25')](function(){_0x46650b[_0xb1c1('0x17')](0xcc)[_0xb1c1('0x18')]();});}};}function handleEntityNotFound(_0x5278ad,_0x89098){return function(_0x4d42f5){if(!_0x4d42f5){_0x5278ad[_0xb1c1('0x26')](0x194);}return _0x4d42f5;};}function handleError(_0x7252c1,_0x1345e4){_0x1345e4=_0x1345e4||0x1f4;return function(_0x2bf6c8){logger[_0xb1c1('0x27')](_0x2bf6c8[_0xb1c1('0x28')]);if(_0x2bf6c8[_0xb1c1('0x29')]){delete _0x2bf6c8[_0xb1c1('0x29')];}_0x7252c1[_0xb1c1('0x17')](_0x1345e4)[_0xb1c1('0x2a')](_0x2bf6c8);};}exports[_0xb1c1('0x2b')]=function(_0x3e9573,_0xdb7421){var _0x16cf8a={},_0x292379={},_0x79f6f0={'count':0x0,'rows':[]};var _0xe0f901=_[_0xb1c1('0x2c')](db[_0xb1c1('0x2d')]['rawAttributes'],function(_0x1c4841){return{'name':_0x1c4841['fieldName'],'type':_0x1c4841[_0xb1c1('0x2e')][_0xb1c1('0x2f')]};});_0x292379[_0xb1c1('0x30')]=_['map'](_0xe0f901,_0xb1c1('0x29'));_0x292379['query']=_[_0xb1c1('0x31')](_0x3e9573[_0xb1c1('0x32')]);_0x292379[_0xb1c1('0x33')]=_['intersection'](_0x292379[_0xb1c1('0x30')],_0x292379['query']);_0x16cf8a['attributes']=_[_0xb1c1('0x34')](_0x292379['model'],qs[_0xb1c1('0x35')](_0x3e9573[_0xb1c1('0x32')]['fields']));_0x16cf8a[_0xb1c1('0x36')]=_0x16cf8a[_0xb1c1('0x36')]['length']?_0x16cf8a[_0xb1c1('0x36')]:_0x292379[_0xb1c1('0x30')];if(!_0x3e9573['query'][_0xb1c1('0x37')](_0xb1c1('0x38'))){_0x16cf8a[_0xb1c1('0x1d')]=qs[_0xb1c1('0x1d')](_0x3e9573['query'][_0xb1c1('0x1d')]);_0x16cf8a[_0xb1c1('0x1a')]=qs['offset'](_0x3e9573['query'][_0xb1c1('0x1a')]);}_0x16cf8a[_0xb1c1('0x39')]=qs[_0xb1c1('0x3a')](_0x3e9573[_0xb1c1('0x32')][_0xb1c1('0x3a')]);_0x16cf8a['where']=qs[_0xb1c1('0x33')](_[_0xb1c1('0x3b')](_0x3e9573['query'],_0x292379[_0xb1c1('0x33')]),_0xe0f901);if(_0x3e9573['query']['filter']){_0x16cf8a[_0xb1c1('0x3c')]=_['merge'](_0x16cf8a[_0xb1c1('0x3c')],{'$or':_[_0xb1c1('0x2c')](_0xe0f901,function(_0x5cd2e6){if(_0x5cd2e6[_0xb1c1('0x2e')]!==_0xb1c1('0x3d')){var _0x5be8e4={};_0x5be8e4[_0x5cd2e6[_0xb1c1('0x29')]]={'$like':'%'+_0x3e9573['query'][_0xb1c1('0x3e')]+'%'};return _0x5be8e4;}})});}_0x16cf8a=_[_0xb1c1('0x3f')]({},_0x16cf8a,_0x3e9573['options']);var _0x36bab8={'where':_0x16cf8a[_0xb1c1('0x3c')]};return db[_0xb1c1('0x2d')]['count'](_0x36bab8)['then'](function(_0x55193b){_0x79f6f0['count']=_0x55193b;if(_0x3e9573[_0xb1c1('0x32')]['includeAll']){_0x16cf8a[_0xb1c1('0x40')]=[{'all':!![]}];}return db[_0xb1c1('0x2d')][_0xb1c1('0x41')](_0x16cf8a);})[_0xb1c1('0x25')](function(_0x2e438e){_0x79f6f0[_0xb1c1('0x42')]=_0x2e438e;return _0x79f6f0;})['then'](respondWithFilteredResult(_0xdb7421,_0x16cf8a))[_0xb1c1('0x43')](handleError(_0xdb7421,null));};exports[_0xb1c1('0x44')]=function(_0x5ea359,_0x1e3204){var _0x1c7150={'raw':![],'where':{'id':_0x5ea359[_0xb1c1('0x45')]['id']}},_0x39654c={};_0x39654c[_0xb1c1('0x30')]=_[_0xb1c1('0x31')](db[_0xb1c1('0x2d')][_0xb1c1('0x46')]);_0x39654c[_0xb1c1('0x32')]=_[_0xb1c1('0x31')](_0x5ea359[_0xb1c1('0x32')]);_0x39654c[_0xb1c1('0x33')]=_[_0xb1c1('0x34')](_0x39654c[_0xb1c1('0x30')],_0x39654c['query']);_0x1c7150[_0xb1c1('0x36')]=_[_0xb1c1('0x34')](_0x39654c[_0xb1c1('0x30')],qs[_0xb1c1('0x35')](_0x5ea359['query'][_0xb1c1('0x35')]));_0x1c7150['attributes']=_0x1c7150[_0xb1c1('0x36')]['length']?_0x1c7150[_0xb1c1('0x36')]:_0x39654c[_0xb1c1('0x30')];if(_0x5ea359[_0xb1c1('0x32')][_0xb1c1('0x47')]){_0x1c7150[_0xb1c1('0x40')]=[{'all':!![]}];}_0x1c7150=_[_0xb1c1('0x3f')]({},_0x1c7150,_0x5ea359['options']);return db[_0xb1c1('0x2d')][_0xb1c1('0x48')](_0x1c7150)[_0xb1c1('0x25')](handleEntityNotFound(_0x1e3204,null))[_0xb1c1('0x25')](respondWithResult(_0x1e3204,null))['catch'](handleError(_0x1e3204,null));};exports['create']=function(_0x2e36b6,_0x166d96){return db[_0xb1c1('0x2d')][_0xb1c1('0x49')](_0x2e36b6[_0xb1c1('0x4a')],{})[_0xb1c1('0x25')](respondWithResult(_0x166d96,0xc9))[_0xb1c1('0x43')](handleError(_0x166d96,null));};exports[_0xb1c1('0x23')]=function(_0x30023c,_0x21ddbb){if(_0x30023c[_0xb1c1('0x4a')]['id']){delete _0x30023c[_0xb1c1('0x4a')]['id'];}return db[_0xb1c1('0x2d')][_0xb1c1('0x48')]({'where':{'id':_0x30023c[_0xb1c1('0x45')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x21ddbb,null))[_0xb1c1('0x25')](saveUpdates(_0x30023c['body'],null))['then'](respondWithResult(_0x21ddbb,null))[_0xb1c1('0x43')](handleError(_0x21ddbb,null));};exports[_0xb1c1('0x24')]=function(_0x10c256,_0x586a43){return db[_0xb1c1('0x2d')]['find']({'where':{'id':_0x10c256[_0xb1c1('0x45')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x586a43,null))[_0xb1c1('0x25')](removeEntity(_0x586a43,null))['catch'](handleError(_0x586a43,null));};exports[_0xb1c1('0x4b')]=function(_0x3db838,_0x324740,_0x568de7){var _0x4695ca={};var _0x58368a={};var _0x105edb;var _0x14750a;return db[_0xb1c1('0x2d')][_0xb1c1('0x4c')]({'where':{'id':_0x3db838[_0xb1c1('0x45')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x324740,null))[_0xb1c1('0x25')](function(_0x201dbf){if(_0x201dbf){_0x105edb=_0x201dbf;_0x58368a[_0xb1c1('0x30')]=_[_0xb1c1('0x31')](db[_0xb1c1('0x4d')][_0xb1c1('0x46')]);_0x58368a[_0xb1c1('0x32')]=_['keys'](_0x3db838[_0xb1c1('0x32')]);_0x58368a[_0xb1c1('0x33')]=_['intersection'](_0x58368a['model'],_0x58368a['query']);_0x4695ca[_0xb1c1('0x36')]=_[_0xb1c1('0x34')](_0x58368a[_0xb1c1('0x30')],qs[_0xb1c1('0x35')](_0x3db838['query'][_0xb1c1('0x35')]));_0x4695ca['attributes']=_0x4695ca[_0xb1c1('0x36')][_0xb1c1('0x4e')]?_0x4695ca[_0xb1c1('0x36')]:_0x58368a[_0xb1c1('0x30')];_0x4695ca[_0xb1c1('0x39')]=qs[_0xb1c1('0x3a')](_0x3db838[_0xb1c1('0x32')]['sort']);_0x4695ca[_0xb1c1('0x3c')]=qs[_0xb1c1('0x33')](_[_0xb1c1('0x3b')](_0x3db838[_0xb1c1('0x32')],_0x58368a[_0xb1c1('0x33')]));if(_0x3db838['query']['filter']){_0x4695ca[_0xb1c1('0x3c')]=_[_0xb1c1('0x3f')](_0x4695ca['where'],{'$or':_['map'](_0x4695ca[_0xb1c1('0x36')],function(_0x5f50f5){var _0x931412={};_0x931412[_0x5f50f5]={'$like':'%'+_0x3db838['query'][_0xb1c1('0x3e')]+'%'};return _0x931412;})});}_0x4695ca=_[_0xb1c1('0x3f')]({},_0x4695ca,_0x3db838[_0xb1c1('0x4f')]);return _0x105edb[_0xb1c1('0x4b')](_0x4695ca);}})['then'](function(_0x2d42bb){if(_0x2d42bb){_0x14750a=_0x2d42bb[_0xb1c1('0x4e')];if(!_0x3db838['query']['hasOwnProperty'](_0xb1c1('0x38'))){_0x4695ca['limit']=qs['limit'](_0x3db838['query'][_0xb1c1('0x1d')]);_0x4695ca['offset']=qs['offset'](_0x3db838[_0xb1c1('0x32')][_0xb1c1('0x1a')]);}return _0x105edb[_0xb1c1('0x4b')](_0x4695ca);}})[_0xb1c1('0x25')](function(_0x5e4325){if(_0x5e4325){return _0x5e4325?{'count':_0x14750a,'rows':_0x5e4325}:null;}})[_0xb1c1('0x25')](respondWithResult(_0x324740,null))[_0xb1c1('0x43')](handleError(_0x324740,null));};exports['getSubjects']=function(_0x282358,_0x5b1051,_0x5c6058){var _0x398b4e={};var _0x52a9b5={};var _0x449b7c;var _0x2426c9;return db[_0xb1c1('0x2d')]['findOne']({'where':{'id':_0x282358[_0xb1c1('0x45')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x5b1051,null))[_0xb1c1('0x25')](function(_0x57c059){if(_0x57c059){_0x449b7c=_0x57c059;_0x52a9b5['model']=_['keys'](db['FreshdeskField'][_0xb1c1('0x46')]);_0x52a9b5[_0xb1c1('0x32')]=_[_0xb1c1('0x31')](_0x282358['query']);_0x52a9b5[_0xb1c1('0x33')]=_[_0xb1c1('0x34')](_0x52a9b5[_0xb1c1('0x30')],_0x52a9b5['query']);_0x398b4e[_0xb1c1('0x36')]=_[_0xb1c1('0x34')](_0x52a9b5[_0xb1c1('0x30')],qs[_0xb1c1('0x35')](_0x282358[_0xb1c1('0x32')]['fields']));_0x398b4e[_0xb1c1('0x36')]=_0x398b4e[_0xb1c1('0x36')]['length']?_0x398b4e['attributes']:_0x52a9b5[_0xb1c1('0x30')];_0x398b4e[_0xb1c1('0x39')]=qs[_0xb1c1('0x3a')](_0x282358[_0xb1c1('0x32')]['sort']);_0x398b4e[_0xb1c1('0x3c')]=qs['filters'](_['pick'](_0x282358[_0xb1c1('0x32')],_0x52a9b5[_0xb1c1('0x33')]));if(_0x282358[_0xb1c1('0x32')]['filter']){_0x398b4e[_0xb1c1('0x3c')]=_[_0xb1c1('0x3f')](_0x398b4e[_0xb1c1('0x3c')],{'$or':_['map'](_0x398b4e[_0xb1c1('0x36')],function(_0x5cef0c){var _0x49f425={};_0x49f425[_0x5cef0c]={'$like':'%'+_0x282358[_0xb1c1('0x32')]['filter']+'%'};return _0x49f425;})});}_0x398b4e=_['merge']({},_0x398b4e,_0x282358['options']);return _0x449b7c[_0xb1c1('0x50')](_0x398b4e);}})[_0xb1c1('0x25')](function(_0x53b30f){if(_0x53b30f){_0x2426c9=_0x53b30f[_0xb1c1('0x4e')];if(!_0x282358['query'][_0xb1c1('0x37')](_0xb1c1('0x38'))){_0x398b4e[_0xb1c1('0x1d')]=qs[_0xb1c1('0x1d')](_0x282358[_0xb1c1('0x32')][_0xb1c1('0x1d')]);_0x398b4e[_0xb1c1('0x1a')]=qs['offset'](_0x282358['query'][_0xb1c1('0x1a')]);}return _0x449b7c[_0xb1c1('0x50')](_0x398b4e);}})[_0xb1c1('0x25')](function(_0x597548){if(_0x597548){return _0x597548?{'count':_0x2426c9,'rows':_0x597548}:null;}})['then'](respondWithResult(_0x5b1051,null))[_0xb1c1('0x43')](handleError(_0x5b1051,null));};exports[_0xb1c1('0x51')]=function(_0x5a0c78,_0x5d5051,_0x478677){var _0x2207c3={};var _0x31429c={};var _0x137569;var _0x18fc8c;return db[_0xb1c1('0x2d')][_0xb1c1('0x4c')]({'where':{'id':_0x5a0c78[_0xb1c1('0x45')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x5d5051,null))[_0xb1c1('0x25')](function(_0x1f8ab1){if(_0x1f8ab1){_0x137569=_0x1f8ab1;_0x31429c['model']=_[_0xb1c1('0x31')](db['FreshdeskField']['rawAttributes']);_0x31429c[_0xb1c1('0x32')]=_[_0xb1c1('0x31')](_0x5a0c78[_0xb1c1('0x32')]);_0x31429c[_0xb1c1('0x33')]=_[_0xb1c1('0x34')](_0x31429c['model'],_0x31429c['query']);_0x2207c3[_0xb1c1('0x36')]=_[_0xb1c1('0x34')](_0x31429c['model'],qs[_0xb1c1('0x35')](_0x5a0c78[_0xb1c1('0x32')]['fields']));_0x2207c3[_0xb1c1('0x36')]=_0x2207c3[_0xb1c1('0x36')][_0xb1c1('0x4e')]?_0x2207c3['attributes']:_0x31429c['model'];_0x2207c3[_0xb1c1('0x39')]=qs['sort'](_0x5a0c78['query']['sort']);_0x2207c3[_0xb1c1('0x3c')]=qs['filters'](_['pick'](_0x5a0c78['query'],_0x31429c[_0xb1c1('0x33')]));if(_0x5a0c78[_0xb1c1('0x32')][_0xb1c1('0x3e')]){_0x2207c3[_0xb1c1('0x3c')]=_['merge'](_0x2207c3['where'],{'$or':_['map'](_0x2207c3['attributes'],function(_0x1e0393){var _0x393c52={};_0x393c52[_0x1e0393]={'$like':'%'+_0x5a0c78[_0xb1c1('0x32')][_0xb1c1('0x3e')]+'%'};return _0x393c52;})});}_0x2207c3=_[_0xb1c1('0x3f')]({},_0x2207c3,_0x5a0c78[_0xb1c1('0x4f')]);return _0x137569[_0xb1c1('0x51')](_0x2207c3);}})[_0xb1c1('0x25')](function(_0x101f13){if(_0x101f13){_0x18fc8c=_0x101f13[_0xb1c1('0x4e')];if(!_0x5a0c78['query'][_0xb1c1('0x37')](_0xb1c1('0x38'))){_0x2207c3[_0xb1c1('0x1d')]=qs[_0xb1c1('0x1d')](_0x5a0c78[_0xb1c1('0x32')]['limit']);_0x2207c3[_0xb1c1('0x1a')]=qs['offset'](_0x5a0c78[_0xb1c1('0x32')][_0xb1c1('0x1a')]);}return _0x137569[_0xb1c1('0x51')](_0x2207c3);}})[_0xb1c1('0x25')](function(_0x254c67){if(_0x254c67){return _0x254c67?{'count':_0x18fc8c,'rows':_0x254c67}:null;}})[_0xb1c1('0x25')](respondWithResult(_0x5d5051,null))[_0xb1c1('0x43')](handleError(_0x5d5051,null));};exports[_0xb1c1('0x52')]=function(_0x5e3355,_0x218acd,_0x27ef6c){var _0x24fb31={};var _0x4297f9={};var _0x5bc4f8;var _0x23a381;return db[_0xb1c1('0x2d')][_0xb1c1('0x4c')]({'where':{'id':_0x5e3355[_0xb1c1('0x45')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x218acd,null))[_0xb1c1('0x25')](function(_0x394ec9){if(_0x394ec9){_0x5bc4f8=_0x394ec9;_0x4297f9[_0xb1c1('0x30')]=_['keys'](db['Tag'][_0xb1c1('0x46')]);_0x4297f9['query']=_[_0xb1c1('0x31')](_0x5e3355[_0xb1c1('0x32')]);_0x4297f9[_0xb1c1('0x33')]=_['intersection'](_0x4297f9[_0xb1c1('0x30')],_0x4297f9[_0xb1c1('0x32')]);_0x24fb31['attributes']=_['intersection'](_0x4297f9[_0xb1c1('0x30')],qs[_0xb1c1('0x35')](_0x5e3355['query'][_0xb1c1('0x35')]));_0x24fb31[_0xb1c1('0x36')]=_0x24fb31[_0xb1c1('0x36')][_0xb1c1('0x4e')]?_0x24fb31[_0xb1c1('0x36')]:_0x4297f9[_0xb1c1('0x30')];_0x24fb31[_0xb1c1('0x39')]=qs['sort'](_0x5e3355[_0xb1c1('0x32')][_0xb1c1('0x3a')]);_0x24fb31[_0xb1c1('0x3c')]=qs[_0xb1c1('0x33')](_['pick'](_0x5e3355['query'],_0x4297f9[_0xb1c1('0x33')]));if(_0x5e3355[_0xb1c1('0x32')][_0xb1c1('0x3e')]){_0x24fb31[_0xb1c1('0x3c')]=_[_0xb1c1('0x3f')](_0x24fb31['where'],{'$or':_[_0xb1c1('0x2c')](_0x24fb31[_0xb1c1('0x36')],function(_0x351530){var _0x4881d7={};_0x4881d7[_0x351530]={'$like':'%'+_0x5e3355['query'][_0xb1c1('0x3e')]+'%'};return _0x4881d7;})});}_0x24fb31=_[_0xb1c1('0x3f')]({},_0x24fb31,_0x5e3355['options']);return _0x5bc4f8[_0xb1c1('0x52')](_0x24fb31);}})[_0xb1c1('0x25')](function(_0x4c5efe){if(_0x4c5efe){_0x23a381=_0x4c5efe[_0xb1c1('0x4e')];if(!_0x5e3355[_0xb1c1('0x32')]['hasOwnProperty']('nolimit')){_0x24fb31['limit']=qs[_0xb1c1('0x1d')](_0x5e3355[_0xb1c1('0x32')][_0xb1c1('0x1d')]);_0x24fb31[_0xb1c1('0x1a')]=qs[_0xb1c1('0x1a')](_0x5e3355[_0xb1c1('0x32')][_0xb1c1('0x1a')]);}return _0x5bc4f8['getTags'](_0x24fb31);}})['then'](function(_0x47e71d){if(_0x47e71d){return _0x47e71d?{'count':_0x23a381,'rows':_0x47e71d}:null;}})[_0xb1c1('0x25')](respondWithResult(_0x218acd,null))[_0xb1c1('0x43')](handleError(_0x218acd,null));};exports[_0xb1c1('0x53')]=function(_0xed63ba,_0x2efe1d,_0x27c321){if(_0xed63ba['body']['id']){delete _0xed63ba[_0xb1c1('0x4a')]['id'];}return db[_0xb1c1('0x2d')][_0xb1c1('0x4c')]({'where':{'id':_0xed63ba['params']['id']}})['then'](handleEntityNotFound(_0x2efe1d,null))[_0xb1c1('0x25')](function(_0x3be3a1){if(_0x3be3a1){return _0x3be3a1[_0xb1c1('0x53')](_0xed63ba[_0xb1c1('0x4a')][_0xb1c1('0x54')]||[]);}return null;})['then'](respondWithResult(_0x2efe1d,null))[_0xb1c1('0x43')](handleError(_0x2efe1d,null));}; \ No newline at end of file +var _0x0a5b=['count','set','apply','reject','update','then','destroy','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL','filter','merge','options','FreshdeskConfiguration','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','getFields','FreshdeskField','order','map','getSubjects','findOne','pick','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x35f015,_0x412100){var _0x2177df=function(_0x472082){while(--_0x472082){_0x35f015['push'](_0x35f015['shift']());}};_0x2177df(++_0x412100);}(_0x0a5b,0xd1));var _0xb0a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a5b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb0a5('0x0'));var zipdir=require(_0xb0a5('0x1'));var jsonpatch=require(_0xb0a5('0x2'));var rp=require(_0xb0a5('0x3'));var moment=require(_0xb0a5('0x4'));var BPromise=require(_0xb0a5('0x5'));var Mustache=require('mustache');var util=require(_0xb0a5('0x6'));var path=require(_0xb0a5('0x7'));var sox=require(_0xb0a5('0x8'));var csv=require('to-csv');var ejs=require(_0xb0a5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0a5('0xa'));var squel=require('squel');var crypto=require(_0xb0a5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb0a5('0xc'));var toCsv=require(_0xb0a5('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb0a5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb0a5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0a5('0x10'))(_0xb0a5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb0a5('0x12'))['db'];function respondWithStatusCode(_0x35a654,_0x186485){_0x186485=_0x186485||0xcc;return function(_0x526dd0){if(_0x526dd0){return _0x35a654['sendStatus'](_0x186485);}return _0x35a654[_0xb0a5('0x13')](_0x186485)[_0xb0a5('0x14')]();};}function respondWithResult(_0x3e54bd,_0xdd49e3){_0xdd49e3=_0xdd49e3||0xc8;return function(_0x1c9a3c){if(_0x1c9a3c){return _0x3e54bd[_0xb0a5('0x13')](_0xdd49e3)[_0xb0a5('0x15')](_0x1c9a3c);}};}function respondWithFilteredResult(_0x44c739,_0x1b7f77){return function(_0xce298){if(_0xce298){var _0x1378d1=typeof _0x1b7f77[_0xb0a5('0x16')]===_0xb0a5('0x17')&&typeof _0x1b7f77[_0xb0a5('0x18')]===_0xb0a5('0x17');var _0x2ed012=_0xce298[_0xb0a5('0x19')];var _0x3a6fe6=_0x1378d1?0x0:_0x1b7f77[_0xb0a5('0x16')];var _0x45daa0=_0x1378d1?_0xce298[_0xb0a5('0x19')]:_0x1b7f77[_0xb0a5('0x16')]+_0x1b7f77[_0xb0a5('0x18')];var _0xb8e35;if(_0x45daa0>=_0x2ed012){_0x45daa0=_0x2ed012;_0xb8e35=0xc8;}else{_0xb8e35=0xce;}_0x44c739[_0xb0a5('0x13')](_0xb8e35);return _0x44c739[_0xb0a5('0x1a')]('Content-Range',_0x3a6fe6+'-'+_0x45daa0+'/'+_0x2ed012)[_0xb0a5('0x15')](_0xce298);}return null;};}function patchUpdates(_0x33d6c2){return function(_0x57e8f5){try{jsonpatch[_0xb0a5('0x1b')](_0x57e8f5,_0x33d6c2,!![]);}catch(_0x4fb13d){return BPromise[_0xb0a5('0x1c')](_0x4fb13d);}return _0x57e8f5['save']();};}function saveUpdates(_0x99160e,_0x468433){return function(_0x4021d5){if(_0x4021d5){return _0x4021d5[_0xb0a5('0x1d')](_0x99160e)[_0xb0a5('0x1e')](function(_0x473f88){return _0x473f88;});}return null;};}function removeEntity(_0x2c0d5f,_0x7eef2f){return function(_0x45a0a4){if(_0x45a0a4){return _0x45a0a4[_0xb0a5('0x1f')]()[_0xb0a5('0x1e')](function(){_0x2c0d5f[_0xb0a5('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ced48,_0x4d028c){return function(_0x5b5550){if(!_0x5b5550){_0x5ced48[_0xb0a5('0x20')](0x194);}return _0x5b5550;};}function handleError(_0x5a4e97,_0x40d91e){_0x40d91e=_0x40d91e||0x1f4;return function(_0xf5fc19){logger['error'](_0xf5fc19[_0xb0a5('0x21')]);if(_0xf5fc19[_0xb0a5('0x22')]){delete _0xf5fc19[_0xb0a5('0x22')];}_0x5a4e97[_0xb0a5('0x13')](_0x40d91e)[_0xb0a5('0x23')](_0xf5fc19);};}exports['index']=function(_0x2bcab7,_0x305111){var _0x4f3d6e={},_0x3237bb={},_0x46e2d7={'count':0x0,'rows':[]};var _0x34b5a1=_['map'](db['FreshdeskConfiguration'][_0xb0a5('0x24')],function(_0x42685e){return{'name':_0x42685e[_0xb0a5('0x25')],'type':_0x42685e[_0xb0a5('0x26')][_0xb0a5('0x27')]};});_0x3237bb[_0xb0a5('0x28')]=_['map'](_0x34b5a1,_0xb0a5('0x22'));_0x3237bb[_0xb0a5('0x29')]=_['keys'](_0x2bcab7[_0xb0a5('0x29')]);_0x3237bb['filters']=_[_0xb0a5('0x2a')](_0x3237bb['model'],_0x3237bb[_0xb0a5('0x29')]);_0x4f3d6e['attributes']=_[_0xb0a5('0x2a')](_0x3237bb[_0xb0a5('0x28')],qs[_0xb0a5('0x2b')](_0x2bcab7[_0xb0a5('0x29')]['fields']));_0x4f3d6e['attributes']=_0x4f3d6e[_0xb0a5('0x2c')]['length']?_0x4f3d6e[_0xb0a5('0x2c')]:_0x3237bb[_0xb0a5('0x28')];if(!_0x2bcab7[_0xb0a5('0x29')][_0xb0a5('0x2d')](_0xb0a5('0x2e'))){_0x4f3d6e['limit']=qs['limit'](_0x2bcab7['query']['limit']);_0x4f3d6e[_0xb0a5('0x16')]=qs[_0xb0a5('0x16')](_0x2bcab7[_0xb0a5('0x29')]['offset']);}_0x4f3d6e['order']=qs[_0xb0a5('0x2f')](_0x2bcab7[_0xb0a5('0x29')][_0xb0a5('0x2f')]);_0x4f3d6e[_0xb0a5('0x30')]=qs['filters'](_['pick'](_0x2bcab7[_0xb0a5('0x29')],_0x3237bb[_0xb0a5('0x31')]),_0x34b5a1);if(_0x2bcab7[_0xb0a5('0x29')]['filter']){_0x4f3d6e[_0xb0a5('0x30')]=_['merge'](_0x4f3d6e['where'],{'$or':_['map'](_0x34b5a1,function(_0x13b4b1){if(_0x13b4b1[_0xb0a5('0x26')]!==_0xb0a5('0x32')){var _0x5dfe98={};_0x5dfe98[_0x13b4b1['name']]={'$like':'%'+_0x2bcab7[_0xb0a5('0x29')][_0xb0a5('0x33')]+'%'};return _0x5dfe98;}})});}_0x4f3d6e=_[_0xb0a5('0x34')]({},_0x4f3d6e,_0x2bcab7[_0xb0a5('0x35')]);var _0x1bc42f={'where':_0x4f3d6e[_0xb0a5('0x30')]};return db[_0xb0a5('0x36')][_0xb0a5('0x19')](_0x1bc42f)['then'](function(_0x55d9a5){_0x46e2d7[_0xb0a5('0x19')]=_0x55d9a5;if(_0x2bcab7[_0xb0a5('0x29')][_0xb0a5('0x37')]){_0x4f3d6e[_0xb0a5('0x38')]=[{'all':!![]}];}return db[_0xb0a5('0x36')][_0xb0a5('0x39')](_0x4f3d6e);})[_0xb0a5('0x1e')](function(_0x1c0866){_0x46e2d7[_0xb0a5('0x3a')]=_0x1c0866;return _0x46e2d7;})['then'](respondWithFilteredResult(_0x305111,_0x4f3d6e))['catch'](handleError(_0x305111,null));};exports[_0xb0a5('0x3b')]=function(_0x331a07,_0x42dec5){var _0x3bfe92={'raw':![],'where':{'id':_0x331a07[_0xb0a5('0x3c')]['id']}},_0xf1a41f={};_0xf1a41f['model']=_[_0xb0a5('0x3d')](db[_0xb0a5('0x36')][_0xb0a5('0x24')]);_0xf1a41f['query']=_[_0xb0a5('0x3d')](_0x331a07[_0xb0a5('0x29')]);_0xf1a41f[_0xb0a5('0x31')]=_[_0xb0a5('0x2a')](_0xf1a41f['model'],_0xf1a41f['query']);_0x3bfe92[_0xb0a5('0x2c')]=_[_0xb0a5('0x2a')](_0xf1a41f[_0xb0a5('0x28')],qs[_0xb0a5('0x2b')](_0x331a07['query'][_0xb0a5('0x2b')]));_0x3bfe92[_0xb0a5('0x2c')]=_0x3bfe92['attributes'][_0xb0a5('0x3e')]?_0x3bfe92['attributes']:_0xf1a41f[_0xb0a5('0x28')];if(_0x331a07[_0xb0a5('0x29')][_0xb0a5('0x37')]){_0x3bfe92['include']=[{'all':!![]}];}_0x3bfe92=_['merge']({},_0x3bfe92,_0x331a07[_0xb0a5('0x35')]);return db['FreshdeskConfiguration'][_0xb0a5('0x3f')](_0x3bfe92)[_0xb0a5('0x1e')](handleEntityNotFound(_0x42dec5,null))[_0xb0a5('0x1e')](respondWithResult(_0x42dec5,null))[_0xb0a5('0x40')](handleError(_0x42dec5,null));};exports[_0xb0a5('0x41')]=function(_0x2f4bea,_0x109f47){return db[_0xb0a5('0x36')][_0xb0a5('0x41')](_0x2f4bea[_0xb0a5('0x42')],{})[_0xb0a5('0x1e')](respondWithResult(_0x109f47,0xc9))[_0xb0a5('0x40')](handleError(_0x109f47,null));};exports[_0xb0a5('0x1d')]=function(_0x3a67e0,_0x210461){if(_0x3a67e0['body']['id']){delete _0x3a67e0[_0xb0a5('0x42')]['id'];}return db[_0xb0a5('0x36')][_0xb0a5('0x3f')]({'where':{'id':_0x3a67e0[_0xb0a5('0x3c')]['id']}})[_0xb0a5('0x1e')](handleEntityNotFound(_0x210461,null))['then'](saveUpdates(_0x3a67e0['body'],null))[_0xb0a5('0x1e')](respondWithResult(_0x210461,null))['catch'](handleError(_0x210461,null));};exports[_0xb0a5('0x1f')]=function(_0x38caf3,_0x738646){return db[_0xb0a5('0x36')]['find']({'where':{'id':_0x38caf3[_0xb0a5('0x3c')]['id']}})[_0xb0a5('0x1e')](handleEntityNotFound(_0x738646,null))[_0xb0a5('0x1e')](removeEntity(_0x738646,null))[_0xb0a5('0x40')](handleError(_0x738646,null));};exports[_0xb0a5('0x43')]=function(_0x5cd23a,_0x275759,_0x47abb4){var _0x21e35d={};var _0x2bf397={};var _0x1a8acc;var _0x549c72;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5cd23a[_0xb0a5('0x3c')]['id']}})[_0xb0a5('0x1e')](handleEntityNotFound(_0x275759,null))[_0xb0a5('0x1e')](function(_0x52b9ab){if(_0x52b9ab){_0x1a8acc=_0x52b9ab;_0x2bf397[_0xb0a5('0x28')]=_[_0xb0a5('0x3d')](db[_0xb0a5('0x44')][_0xb0a5('0x24')]);_0x2bf397['query']=_[_0xb0a5('0x3d')](_0x5cd23a[_0xb0a5('0x29')]);_0x2bf397[_0xb0a5('0x31')]=_[_0xb0a5('0x2a')](_0x2bf397[_0xb0a5('0x28')],_0x2bf397[_0xb0a5('0x29')]);_0x21e35d[_0xb0a5('0x2c')]=_[_0xb0a5('0x2a')](_0x2bf397['model'],qs[_0xb0a5('0x2b')](_0x5cd23a['query'][_0xb0a5('0x2b')]));_0x21e35d[_0xb0a5('0x2c')]=_0x21e35d[_0xb0a5('0x2c')]['length']?_0x21e35d[_0xb0a5('0x2c')]:_0x2bf397['model'];_0x21e35d[_0xb0a5('0x45')]=qs['sort'](_0x5cd23a[_0xb0a5('0x29')][_0xb0a5('0x2f')]);_0x21e35d['where']=qs[_0xb0a5('0x31')](_['pick'](_0x5cd23a[_0xb0a5('0x29')],_0x2bf397[_0xb0a5('0x31')]));if(_0x5cd23a[_0xb0a5('0x29')][_0xb0a5('0x33')]){_0x21e35d[_0xb0a5('0x30')]=_[_0xb0a5('0x34')](_0x21e35d[_0xb0a5('0x30')],{'$or':_[_0xb0a5('0x46')](_0x21e35d[_0xb0a5('0x2c')],function(_0x27b9db){var _0x5cb358={};_0x5cb358[_0x27b9db]={'$like':'%'+_0x5cd23a[_0xb0a5('0x29')][_0xb0a5('0x33')]+'%'};return _0x5cb358;})});}_0x21e35d=_[_0xb0a5('0x34')]({},_0x21e35d,_0x5cd23a[_0xb0a5('0x35')]);return _0x1a8acc[_0xb0a5('0x43')](_0x21e35d);}})[_0xb0a5('0x1e')](function(_0x34562b){if(_0x34562b){_0x549c72=_0x34562b[_0xb0a5('0x3e')];if(!_0x5cd23a[_0xb0a5('0x29')][_0xb0a5('0x2d')](_0xb0a5('0x2e'))){_0x21e35d[_0xb0a5('0x18')]=qs[_0xb0a5('0x18')](_0x5cd23a['query'][_0xb0a5('0x18')]);_0x21e35d['offset']=qs[_0xb0a5('0x16')](_0x5cd23a['query']['offset']);}return _0x1a8acc[_0xb0a5('0x43')](_0x21e35d);}})['then'](function(_0x36aeb4){if(_0x36aeb4){return _0x36aeb4?{'count':_0x549c72,'rows':_0x36aeb4}:null;}})['then'](respondWithResult(_0x275759,null))[_0xb0a5('0x40')](handleError(_0x275759,null));};exports[_0xb0a5('0x47')]=function(_0x3b2d1c,_0x309ff1,_0x30e1f4){var _0x1557c4={};var _0x59211b={};var _0x436c45;var _0x2fc675;return db[_0xb0a5('0x36')][_0xb0a5('0x48')]({'where':{'id':_0x3b2d1c['params']['id']}})[_0xb0a5('0x1e')](handleEntityNotFound(_0x309ff1,null))[_0xb0a5('0x1e')](function(_0x2b4ac4){if(_0x2b4ac4){_0x436c45=_0x2b4ac4;_0x59211b[_0xb0a5('0x28')]=_['keys'](db['FreshdeskField'][_0xb0a5('0x24')]);_0x59211b[_0xb0a5('0x29')]=_[_0xb0a5('0x3d')](_0x3b2d1c['query']);_0x59211b[_0xb0a5('0x31')]=_[_0xb0a5('0x2a')](_0x59211b[_0xb0a5('0x28')],_0x59211b[_0xb0a5('0x29')]);_0x1557c4['attributes']=_[_0xb0a5('0x2a')](_0x59211b[_0xb0a5('0x28')],qs['fields'](_0x3b2d1c['query']['fields']));_0x1557c4[_0xb0a5('0x2c')]=_0x1557c4[_0xb0a5('0x2c')]['length']?_0x1557c4[_0xb0a5('0x2c')]:_0x59211b[_0xb0a5('0x28')];_0x1557c4[_0xb0a5('0x45')]=qs[_0xb0a5('0x2f')](_0x3b2d1c[_0xb0a5('0x29')][_0xb0a5('0x2f')]);_0x1557c4['where']=qs[_0xb0a5('0x31')](_[_0xb0a5('0x49')](_0x3b2d1c['query'],_0x59211b[_0xb0a5('0x31')]));if(_0x3b2d1c['query'][_0xb0a5('0x33')]){_0x1557c4[_0xb0a5('0x30')]=_[_0xb0a5('0x34')](_0x1557c4[_0xb0a5('0x30')],{'$or':_[_0xb0a5('0x46')](_0x1557c4[_0xb0a5('0x2c')],function(_0x335c87){var _0x3c46cd={};_0x3c46cd[_0x335c87]={'$like':'%'+_0x3b2d1c[_0xb0a5('0x29')][_0xb0a5('0x33')]+'%'};return _0x3c46cd;})});}_0x1557c4=_[_0xb0a5('0x34')]({},_0x1557c4,_0x3b2d1c[_0xb0a5('0x35')]);return _0x436c45[_0xb0a5('0x47')](_0x1557c4);}})['then'](function(_0x4c8d26){if(_0x4c8d26){_0x2fc675=_0x4c8d26[_0xb0a5('0x3e')];if(!_0x3b2d1c['query'][_0xb0a5('0x2d')](_0xb0a5('0x2e'))){_0x1557c4[_0xb0a5('0x18')]=qs[_0xb0a5('0x18')](_0x3b2d1c[_0xb0a5('0x29')][_0xb0a5('0x18')]);_0x1557c4[_0xb0a5('0x16')]=qs[_0xb0a5('0x16')](_0x3b2d1c[_0xb0a5('0x29')][_0xb0a5('0x16')]);}return _0x436c45[_0xb0a5('0x47')](_0x1557c4);}})[_0xb0a5('0x1e')](function(_0x313bec){if(_0x313bec){return _0x313bec?{'count':_0x2fc675,'rows':_0x313bec}:null;}})['then'](respondWithResult(_0x309ff1,null))[_0xb0a5('0x40')](handleError(_0x309ff1,null));};exports[_0xb0a5('0x4a')]=function(_0x4b6cbd,_0x25224c,_0x36bf46){var _0x1824bc={};var _0x5f0c30={};var _0x4507a3;var _0x5bb3e9;return db[_0xb0a5('0x36')][_0xb0a5('0x48')]({'where':{'id':_0x4b6cbd[_0xb0a5('0x3c')]['id']}})[_0xb0a5('0x1e')](handleEntityNotFound(_0x25224c,null))[_0xb0a5('0x1e')](function(_0x28d87b){if(_0x28d87b){_0x4507a3=_0x28d87b;_0x5f0c30[_0xb0a5('0x28')]=_[_0xb0a5('0x3d')](db[_0xb0a5('0x44')][_0xb0a5('0x24')]);_0x5f0c30[_0xb0a5('0x29')]=_[_0xb0a5('0x3d')](_0x4b6cbd[_0xb0a5('0x29')]);_0x5f0c30['filters']=_[_0xb0a5('0x2a')](_0x5f0c30['model'],_0x5f0c30[_0xb0a5('0x29')]);_0x1824bc[_0xb0a5('0x2c')]=_[_0xb0a5('0x2a')](_0x5f0c30[_0xb0a5('0x28')],qs[_0xb0a5('0x2b')](_0x4b6cbd[_0xb0a5('0x29')][_0xb0a5('0x2b')]));_0x1824bc[_0xb0a5('0x2c')]=_0x1824bc[_0xb0a5('0x2c')][_0xb0a5('0x3e')]?_0x1824bc[_0xb0a5('0x2c')]:_0x5f0c30[_0xb0a5('0x28')];_0x1824bc[_0xb0a5('0x45')]=qs[_0xb0a5('0x2f')](_0x4b6cbd[_0xb0a5('0x29')][_0xb0a5('0x2f')]);_0x1824bc['where']=qs[_0xb0a5('0x31')](_[_0xb0a5('0x49')](_0x4b6cbd['query'],_0x5f0c30[_0xb0a5('0x31')]));if(_0x4b6cbd['query'][_0xb0a5('0x33')]){_0x1824bc[_0xb0a5('0x30')]=_['merge'](_0x1824bc[_0xb0a5('0x30')],{'$or':_[_0xb0a5('0x46')](_0x1824bc[_0xb0a5('0x2c')],function(_0x56b8ab){var _0x17a132={};_0x17a132[_0x56b8ab]={'$like':'%'+_0x4b6cbd[_0xb0a5('0x29')][_0xb0a5('0x33')]+'%'};return _0x17a132;})});}_0x1824bc=_['merge']({},_0x1824bc,_0x4b6cbd[_0xb0a5('0x35')]);return _0x4507a3['getDescriptions'](_0x1824bc);}})[_0xb0a5('0x1e')](function(_0x3d42db){if(_0x3d42db){_0x5bb3e9=_0x3d42db['length'];if(!_0x4b6cbd[_0xb0a5('0x29')][_0xb0a5('0x2d')]('nolimit')){_0x1824bc['limit']=qs[_0xb0a5('0x18')](_0x4b6cbd[_0xb0a5('0x29')][_0xb0a5('0x18')]);_0x1824bc[_0xb0a5('0x16')]=qs[_0xb0a5('0x16')](_0x4b6cbd[_0xb0a5('0x29')][_0xb0a5('0x16')]);}return _0x4507a3[_0xb0a5('0x4a')](_0x1824bc);}})[_0xb0a5('0x1e')](function(_0x6a670d){if(_0x6a670d){return _0x6a670d?{'count':_0x5bb3e9,'rows':_0x6a670d}:null;}})['then'](respondWithResult(_0x25224c,null))[_0xb0a5('0x40')](handleError(_0x25224c,null));};exports[_0xb0a5('0x4b')]=function(_0x5bb6c4,_0x20294d,_0x25fe82){var _0x2f91ed={};var _0x3d38c5={};var _0x1f3ca6;var _0x475e83;return db['FreshdeskConfiguration'][_0xb0a5('0x48')]({'where':{'id':_0x5bb6c4[_0xb0a5('0x3c')]['id']}})[_0xb0a5('0x1e')](handleEntityNotFound(_0x20294d,null))['then'](function(_0x5ea77e){if(_0x5ea77e){_0x1f3ca6=_0x5ea77e;_0x3d38c5[_0xb0a5('0x28')]=_[_0xb0a5('0x3d')](db['Tag']['rawAttributes']);_0x3d38c5[_0xb0a5('0x29')]=_[_0xb0a5('0x3d')](_0x5bb6c4['query']);_0x3d38c5['filters']=_['intersection'](_0x3d38c5[_0xb0a5('0x28')],_0x3d38c5[_0xb0a5('0x29')]);_0x2f91ed['attributes']=_[_0xb0a5('0x2a')](_0x3d38c5[_0xb0a5('0x28')],qs[_0xb0a5('0x2b')](_0x5bb6c4['query'][_0xb0a5('0x2b')]));_0x2f91ed[_0xb0a5('0x2c')]=_0x2f91ed[_0xb0a5('0x2c')][_0xb0a5('0x3e')]?_0x2f91ed[_0xb0a5('0x2c')]:_0x3d38c5[_0xb0a5('0x28')];_0x2f91ed[_0xb0a5('0x45')]=qs[_0xb0a5('0x2f')](_0x5bb6c4[_0xb0a5('0x29')][_0xb0a5('0x2f')]);_0x2f91ed[_0xb0a5('0x30')]=qs['filters'](_[_0xb0a5('0x49')](_0x5bb6c4[_0xb0a5('0x29')],_0x3d38c5['filters']));if(_0x5bb6c4[_0xb0a5('0x29')][_0xb0a5('0x33')]){_0x2f91ed[_0xb0a5('0x30')]=_[_0xb0a5('0x34')](_0x2f91ed[_0xb0a5('0x30')],{'$or':_[_0xb0a5('0x46')](_0x2f91ed[_0xb0a5('0x2c')],function(_0x28c399){var _0x2e4dcd={};_0x2e4dcd[_0x28c399]={'$like':'%'+_0x5bb6c4[_0xb0a5('0x29')][_0xb0a5('0x33')]+'%'};return _0x2e4dcd;})});}_0x2f91ed=_[_0xb0a5('0x34')]({},_0x2f91ed,_0x5bb6c4[_0xb0a5('0x35')]);return _0x1f3ca6[_0xb0a5('0x4b')](_0x2f91ed);}})[_0xb0a5('0x1e')](function(_0x2bac12){if(_0x2bac12){_0x475e83=_0x2bac12[_0xb0a5('0x3e')];if(!_0x5bb6c4[_0xb0a5('0x29')][_0xb0a5('0x2d')]('nolimit')){_0x2f91ed['limit']=qs[_0xb0a5('0x18')](_0x5bb6c4[_0xb0a5('0x29')][_0xb0a5('0x18')]);_0x2f91ed[_0xb0a5('0x16')]=qs['offset'](_0x5bb6c4[_0xb0a5('0x29')][_0xb0a5('0x16')]);}return _0x1f3ca6[_0xb0a5('0x4b')](_0x2f91ed);}})[_0xb0a5('0x1e')](function(_0x4cddd8){if(_0x4cddd8){return _0x4cddd8?{'count':_0x475e83,'rows':_0x4cddd8}:null;}})[_0xb0a5('0x1e')](respondWithResult(_0x20294d,null))[_0xb0a5('0x40')](handleError(_0x20294d,null));};exports[_0xb0a5('0x4c')]=function(_0x38a411,_0xcc8072,_0x55676a){if(_0x38a411[_0xb0a5('0x42')]['id']){delete _0x38a411[_0xb0a5('0x42')]['id'];}return db[_0xb0a5('0x36')][_0xb0a5('0x48')]({'where':{'id':_0x38a411[_0xb0a5('0x3c')]['id']}})[_0xb0a5('0x1e')](handleEntityNotFound(_0xcc8072,null))[_0xb0a5('0x1e')](function(_0x43e05a){if(_0x43e05a){return _0x43e05a['setTags'](_0x38a411[_0xb0a5('0x42')][_0xb0a5('0x4d')]||[]);}return null;})[_0xb0a5('0x1e')](respondWithResult(_0xcc8072,null))[_0xb0a5('0x40')](handleError(_0xcc8072,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5da3dcf..b9c19f9 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 _0x2a15=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x26d061,_0xbb9a8b){var _0x2d2085=function(_0x16fa11){while(--_0x16fa11){_0x26d061['push'](_0x26d061['shift']());}};_0x2d2085(++_0xbb9a8b);}(_0x2a15,0x16b));var _0x52a1=function(_0x4e87f1,_0x411dc6){_0x4e87f1=_0x4e87f1-0x0;var _0x2609d3=_0x2a15[_0x4e87f1];return _0x2609d3;};'use strict';var _=require(_0x52a1('0x0'));var util=require(_0x52a1('0x1'));var logger=require(_0x52a1('0x2'))(_0x52a1('0x3'));var moment=require(_0x52a1('0x4'));var BPromise=require(_0x52a1('0x5'));var rp=require(_0x52a1('0x6'));var fs=require('fs');var path=require(_0x52a1('0x7'));var rimraf=require('rimraf');var config=require(_0x52a1('0x8'));var attributes=require(_0x52a1('0x9'));module[_0x52a1('0xa')]=function(_0x2ee79f,_0x45f458){return _0x2ee79f[_0x52a1('0xb')](_0x52a1('0xc'),attributes,{'tableName':_0x52a1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3946=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3946,0xb9));var _0x6394=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x3946[_0xd09668];return _0x68726;};'use strict';var _=require(_0x6394('0x0'));var util=require(_0x6394('0x1'));var logger=require(_0x6394('0x2'))(_0x6394('0x3'));var moment=require(_0x6394('0x4'));var BPromise=require('bluebird');var rp=require(_0x6394('0x5'));var fs=require('fs');var path=require(_0x6394('0x6'));var rimraf=require('rimraf');var config=require(_0x6394('0x7'));var attributes=require(_0x6394('0x8'));module[_0x6394('0x9')]=function(_0x3b88c6,_0x480d14){return _0x3b88c6[_0x6394('0xa')](_0x6394('0xb'),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 c53d094..4fb3e62 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 _0x0ccd=['rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1ac88c,_0x98d675){var _0x409cc4=function(_0x157d97){while(--_0x157d97){_0x1ac88c['push'](_0x1ac88c['shift']());}};_0x409cc4(++_0x98d675);}(_0x0ccd,0x19c));var _0xd0cc=function(_0x2cbd58,_0x278e75){_0x2cbd58=_0x2cbd58-0x0;var _0x42ef2a=_0x0ccd[_0x2cbd58];return _0x42ef2a;};'use strict';var _=require('lodash');var util=require(_0xd0cc('0x0'));var moment=require(_0xd0cc('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0cc('0x2'));var fs=require('fs');var Redis=require(_0xd0cc('0x3'));var db=require(_0xd0cc('0x4'))['db'];var utils=require(_0xd0cc('0x5'));var logger=require('../../config/logger')(_0xd0cc('0x6'));var config=require('../../config/environment');var jayson=require(_0xd0cc('0x7'));var client=jayson[_0xd0cc('0x8')][_0xd0cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3568f1,_0x406b04,_0x22984c){return new BPromise(function(_0x585501,_0x3822ab){return client[_0xd0cc('0xa')](_0x3568f1,_0x22984c)[_0xd0cc('0xb')](function(_0x488d5c){logger[_0xd0cc('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x406b04,_0xd0cc('0xd'));logger[_0xd0cc('0xe')](_0xd0cc('0xf'),_0x406b04,_0xd0cc('0xd'),JSON[_0xd0cc('0x10')](_0x488d5c));if(_0x488d5c[_0xd0cc('0x11')]){if(_0x488d5c[_0xd0cc('0x11')][_0xd0cc('0x12')]===0x1f4){logger[_0xd0cc('0x11')](_0xd0cc('0x13'),_0x406b04,_0x488d5c[_0xd0cc('0x11')]['message']);return _0x3822ab(_0x488d5c[_0xd0cc('0x11')][_0xd0cc('0x14')]);}logger['error'](_0xd0cc('0x13'),_0x406b04,_0x488d5c[_0xd0cc('0x11')][_0xd0cc('0x14')]);return _0x585501(_0x488d5c[_0xd0cc('0x11')]['message']);}else{logger[_0xd0cc('0xc')](_0xd0cc('0x13'),_0x406b04,_0xd0cc('0xd'));_0x585501(_0x488d5c[_0xd0cc('0x15')][_0xd0cc('0x14')]);}})['catch'](function(_0x10b4a8){logger['error'](_0xd0cc('0x13'),_0x406b04,_0x10b4a8);_0x3822ab(_0x10b4a8);});});} \ No newline at end of file +var _0x218e=['../../config/logger','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0x218e,0xc2));var _0xe218=function(_0x2e17f3,_0xa1f21a){_0x2e17f3=_0x2e17f3-0x0;var _0x44c057=_0x218e[_0x2e17f3];return _0x44c057;};'use strict';var _=require(_0xe218('0x0'));var util=require(_0xe218('0x1'));var moment=require('moment');var BPromise=require(_0xe218('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe218('0x3'));var db=require(_0xe218('0x4'))['db'];var utils=require(_0xe218('0x5'));var logger=require(_0xe218('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe218('0x7'));var client=jayson[_0xe218('0x8')][_0xe218('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x84c1ce,_0x20d806,_0x391406){return new BPromise(function(_0xe987bc,_0x137c03){return client[_0xe218('0xa')](_0x84c1ce,_0x391406)['then'](function(_0x4908d7){logger[_0xe218('0xb')](_0xe218('0xc'),_0x20d806,_0xe218('0xd'));logger[_0xe218('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x20d806,_0xe218('0xd'),JSON[_0xe218('0xf')](_0x4908d7));if(_0x4908d7[_0xe218('0x10')]){if(_0x4908d7['error'][_0xe218('0x11')]===0x1f4){logger['error'](_0xe218('0xc'),_0x20d806,_0x4908d7[_0xe218('0x10')][_0xe218('0x12')]);return _0x137c03(_0x4908d7[_0xe218('0x10')]['message']);}logger[_0xe218('0x10')](_0xe218('0xc'),_0x20d806,_0x4908d7['error']['message']);return _0xe987bc(_0x4908d7[_0xe218('0x10')][_0xe218('0x12')]);}else{logger['info'](_0xe218('0xc'),_0x20d806,_0xe218('0xd'));_0xe987bc(_0x4908d7['result'][_0xe218('0x12')]);}})[_0xe218('0x13')](function(_0x5b4cd2){logger[_0xe218('0x10')](_0xe218('0xc'),_0x20d806,_0x5b4cd2);_0x137c03(_0x5b4cd2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index bb356f3..15f934c 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 _0xe0d6=['multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xe0d6,0x143));var _0x6e0d=function(_0x323e0f,_0x5489bd){_0x323e0f=_0x323e0f-0x0;var _0x4e213e=_0xe0d6[_0x323e0f];return _0x4e213e;};'use strict';var multer=require(_0x6e0d('0x0'));var util=require(_0x6e0d('0x1'));var path=require(_0x6e0d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e0d('0x3'));var interaction=require(_0x6e0d('0x4'));var config=require(_0x6e0d('0x5'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x6e0d('0x6')](),controller[_0x6e0d('0x7')]);router[_0x6e0d('0x8')](_0x6e0d('0x9'),auth[_0x6e0d('0x6')](),controller[_0x6e0d('0xa')]);router[_0x6e0d('0xb')]('/',auth[_0x6e0d('0x6')](),controller['create']);router[_0x6e0d('0xc')](_0x6e0d('0x9'),auth[_0x6e0d('0x6')](),controller[_0x6e0d('0xd')]);router[_0x6e0d('0xe')](_0x6e0d('0x9'),auth[_0x6e0d('0x6')](),controller[_0x6e0d('0xf')]);module[_0x6e0d('0x10')]=router; \ No newline at end of file +var _0x5fd6=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','put','update','delete','destroy'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x5fd6,0x91));var _0x65fd=function(_0x268e94,_0x931933){_0x268e94=_0x268e94-0x0;var _0x3d5fbc=_0x5fd6[_0x268e94];return _0x3d5fbc;};'use strict';var multer=require(_0x65fd('0x0'));var util=require(_0x65fd('0x1'));var path=require(_0x65fd('0x2'));var timeout=require(_0x65fd('0x3'));var express=require(_0x65fd('0x4'));var router=express[_0x65fd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x65fd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x65fd('0x7'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x65fd('0x8')](),controller[_0x65fd('0x9')]);router[_0x65fd('0xa')](_0x65fd('0xb'),auth[_0x65fd('0x8')](),controller[_0x65fd('0xc')]);router['post']('/',auth[_0x65fd('0x8')](),controller['create']);router[_0x65fd('0xd')]('/:id',auth[_0x65fd('0x8')](),controller[_0x65fd('0xe')]);router[_0x65fd('0xf')](_0x65fd('0xb'),auth[_0x65fd('0x8')](),controller[_0x65fd('0x10')]);module[_0x65fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4527f39..aa0c2d9 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 _0xbe68=['customVariable','sequelize','exports','ENUM','keyValue','picklist','STRING','string','variable'];(function(_0xedf56d,_0x1f6912){var _0x401f4f=function(_0x456c7d){while(--_0x456c7d){_0xedf56d['push'](_0xedf56d['shift']());}};_0x401f4f(++_0x1f6912);}(_0xbe68,0x1e7));var _0x8be6=function(_0x47d172,_0x2837e9){_0x47d172=_0x47d172-0x0;var _0x4beac0=_0xbe68[_0x47d172];return _0x4beac0;};'use strict';var Sequelize=require(_0x8be6('0x0'));module[_0x8be6('0x1')]={'type':{'type':Sequelize[_0x8be6('0x2')]('string','variable','customVariable',_0x8be6('0x3'),_0x8be6('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8be6('0x5')]},'key':{'type':Sequelize[_0x8be6('0x5')]},'keyType':{'type':Sequelize[_0x8be6('0x2')](_0x8be6('0x6'),_0x8be6('0x7'),_0x8be6('0x8'))},'keyContent':{'type':Sequelize[_0x8be6('0x5')]},'idField':{'type':Sequelize[_0x8be6('0x5')]},'nameField':{'type':Sequelize[_0x8be6('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8be6('0x5')]}}; \ No newline at end of file +var _0xb433=['variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x42aa8f,_0x2244a2){var _0x5b3d40=function(_0x323b93){while(--_0x323b93){_0x42aa8f['push'](_0x42aa8f['shift']());}};_0x5b3d40(++_0x2244a2);}(_0xb433,0x8c));var _0x3b43=function(_0x197d72,_0x19b07b){_0x197d72=_0x197d72-0x0;var _0x1e3507=_0xb433[_0x197d72];return _0x1e3507;};'use strict';var Sequelize=require(_0x3b43('0x0'));module[_0x3b43('0x1')]={'type':{'type':Sequelize[_0x3b43('0x2')](_0x3b43('0x3'),_0x3b43('0x4'),'customVariable',_0x3b43('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3b43('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x3b43('0x7'))},'keyContent':{'type':Sequelize[_0x3b43('0x6')]},'idField':{'type':Sequelize[_0x3b43('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3b43('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b43('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 634def2..46572c5 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 _0xa0bc=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskField','findAll','rows','show','create','catch','body','find','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x437aa0,_0x5deb38){var _0xdfcfa=function(_0x5901fc){while(--_0x5901fc){_0x437aa0['push'](_0x437aa0['shift']());}};_0xdfcfa(++_0x5deb38);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca0b('0x0'));var zipdir=require(_0xca0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca0b('0x2'));var moment=require(_0xca0b('0x3'));var BPromise=require(_0xca0b('0x4'));var Mustache=require(_0xca0b('0x5'));var util=require(_0xca0b('0x6'));var path=require(_0xca0b('0x7'));var sox=require(_0xca0b('0x8'));var csv=require(_0xca0b('0x9'));var ejs=require(_0xca0b('0xa'));var fs=require('fs');var fs_extra=require(_0xca0b('0xb'));var _=require(_0xca0b('0xc'));var squel=require(_0xca0b('0xd'));var crypto=require(_0xca0b('0xe'));var jsforce=require(_0xca0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xca0b('0x9'));var querystring=require(_0xca0b('0x10'));var Papa=require(_0xca0b('0x11'));var Redis=require(_0xca0b('0x12'));var authService=require(_0xca0b('0x13'));var qs=require(_0xca0b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca0b('0x15'));var logger=require(_0xca0b('0x16'))(_0xca0b('0x17'));var utils=require(_0xca0b('0x18'));var config=require(_0xca0b('0x19'));var licenseUtil=require(_0xca0b('0x1a'));var db=require(_0xca0b('0x1b'))['db'];function respondWithStatusCode(_0x3a2e25,_0x22ca9d){_0x22ca9d=_0x22ca9d||0xcc;return function(_0x2ce366){if(_0x2ce366){return _0x3a2e25['sendStatus'](_0x22ca9d);}return _0x3a2e25[_0xca0b('0x1c')](_0x22ca9d)[_0xca0b('0x1d')]();};}function respondWithResult(_0x358972,_0x5da205){_0x5da205=_0x5da205||0xc8;return function(_0x106ed6){if(_0x106ed6){return _0x358972[_0xca0b('0x1c')](_0x5da205)[_0xca0b('0x1e')](_0x106ed6);}};}function respondWithFilteredResult(_0x2beba9,_0x42b68e){return function(_0x404c6d){if(_0x404c6d){var _0x4d7620=typeof _0x42b68e[_0xca0b('0x1f')]===_0xca0b('0x20')&&typeof _0x42b68e['limit']===_0xca0b('0x20');var _0x5db810=_0x404c6d[_0xca0b('0x21')];var _0x5050b7=_0x4d7620?0x0:_0x42b68e[_0xca0b('0x1f')];var _0x32eff7=_0x4d7620?_0x404c6d[_0xca0b('0x21')]:_0x42b68e['offset']+_0x42b68e[_0xca0b('0x22')];var _0x2c0c53;if(_0x32eff7>=_0x5db810){_0x32eff7=_0x5db810;_0x2c0c53=0xc8;}else{_0x2c0c53=0xce;}_0x2beba9['status'](_0x2c0c53);return _0x2beba9[_0xca0b('0x23')](_0xca0b('0x24'),_0x5050b7+'-'+_0x32eff7+'/'+_0x5db810)[_0xca0b('0x1e')](_0x404c6d);}return null;};}function patchUpdates(_0x59bda9){return function(_0x865393){try{jsonpatch[_0xca0b('0x25')](_0x865393,_0x59bda9,!![]);}catch(_0x484e26){return BPromise[_0xca0b('0x26')](_0x484e26);}return _0x865393[_0xca0b('0x27')]();};}function saveUpdates(_0x2ae93b,_0x49e695){return function(_0x119589){if(_0x119589){return _0x119589[_0xca0b('0x28')](_0x2ae93b)[_0xca0b('0x29')](function(_0x504d91){return _0x504d91;});}return null;};}function removeEntity(_0x54fb03,_0x11f5c3){return function(_0x428459){if(_0x428459){return _0x428459[_0xca0b('0x2a')]()[_0xca0b('0x29')](function(){_0x54fb03[_0xca0b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe122e8,_0x10b5f3){return function(_0x131c0e){if(!_0x131c0e){_0xe122e8[_0xca0b('0x2b')](0x194);}return _0x131c0e;};}function handleError(_0x15478d,_0x48e172){_0x48e172=_0x48e172||0x1f4;return function(_0x4d2d1a){logger['error'](_0x4d2d1a[_0xca0b('0x2c')]);if(_0x4d2d1a[_0xca0b('0x2d')]){delete _0x4d2d1a[_0xca0b('0x2d')];}_0x15478d[_0xca0b('0x1c')](_0x48e172)[_0xca0b('0x2e')](_0x4d2d1a);};}exports['index']=function(_0x23af62,_0xbfcb5f){var _0x3b73ff={},_0x20f0d5={},_0x227cdc={'count':0x0,'rows':[]};var _0x449a3a=_[_0xca0b('0x2f')](db['FreshdeskField'][_0xca0b('0x30')],function(_0x17a365){return{'name':_0x17a365[_0xca0b('0x31')],'type':_0x17a365[_0xca0b('0x32')]['key']};});_0x20f0d5[_0xca0b('0x33')]=_[_0xca0b('0x2f')](_0x449a3a,_0xca0b('0x2d'));_0x20f0d5[_0xca0b('0x34')]=_[_0xca0b('0x35')](_0x23af62[_0xca0b('0x34')]);_0x20f0d5[_0xca0b('0x36')]=_[_0xca0b('0x37')](_0x20f0d5[_0xca0b('0x33')],_0x20f0d5[_0xca0b('0x34')]);_0x3b73ff[_0xca0b('0x38')]=_[_0xca0b('0x37')](_0x20f0d5[_0xca0b('0x33')],qs[_0xca0b('0x39')](_0x23af62[_0xca0b('0x34')]['fields']));_0x3b73ff[_0xca0b('0x38')]=_0x3b73ff[_0xca0b('0x38')][_0xca0b('0x3a')]?_0x3b73ff[_0xca0b('0x38')]:_0x20f0d5['model'];if(!_0x23af62[_0xca0b('0x34')][_0xca0b('0x3b')]('nolimit')){_0x3b73ff[_0xca0b('0x22')]=qs[_0xca0b('0x22')](_0x23af62[_0xca0b('0x34')][_0xca0b('0x22')]);_0x3b73ff[_0xca0b('0x1f')]=qs[_0xca0b('0x1f')](_0x23af62[_0xca0b('0x34')][_0xca0b('0x1f')]);}_0x3b73ff['order']=qs['sort'](_0x23af62[_0xca0b('0x34')][_0xca0b('0x3c')]);_0x3b73ff[_0xca0b('0x3d')]=qs[_0xca0b('0x36')](_[_0xca0b('0x3e')](_0x23af62[_0xca0b('0x34')],_0x20f0d5[_0xca0b('0x36')]),_0x449a3a);if(_0x23af62[_0xca0b('0x34')][_0xca0b('0x3f')]){_0x3b73ff[_0xca0b('0x3d')]=_[_0xca0b('0x40')](_0x3b73ff[_0xca0b('0x3d')],{'$or':_[_0xca0b('0x2f')](_0x449a3a,function(_0x236edc){if(_0x236edc[_0xca0b('0x32')]!==_0xca0b('0x41')){var _0xdce72f={};_0xdce72f[_0x236edc[_0xca0b('0x2d')]]={'$like':'%'+_0x23af62[_0xca0b('0x34')][_0xca0b('0x3f')]+'%'};return _0xdce72f;}})});}_0x3b73ff=_[_0xca0b('0x40')]({},_0x3b73ff,_0x23af62[_0xca0b('0x42')]);var _0x1757f0={'where':_0x3b73ff[_0xca0b('0x3d')]};return db[_0xca0b('0x43')]['count'](_0x1757f0)['then'](function(_0x1e62f5){_0x227cdc[_0xca0b('0x21')]=_0x1e62f5;if(_0x23af62['query']['includeAll']){_0x3b73ff['include']=[{'all':!![]}];}return db[_0xca0b('0x43')][_0xca0b('0x44')](_0x3b73ff);})[_0xca0b('0x29')](function(_0xf9e175){_0x227cdc[_0xca0b('0x45')]=_0xf9e175;return _0x227cdc;})['then'](respondWithFilteredResult(_0xbfcb5f,_0x3b73ff))['catch'](handleError(_0xbfcb5f,null));};exports[_0xca0b('0x46')]=function(_0x543bf8,_0x170d76){var _0x4eca5d={'raw':!![],'where':{'id':_0x543bf8['params']['id']}},_0x57bab3={};_0x57bab3[_0xca0b('0x33')]=_[_0xca0b('0x35')](db[_0xca0b('0x43')][_0xca0b('0x30')]);_0x57bab3[_0xca0b('0x34')]=_[_0xca0b('0x35')](_0x543bf8['query']);_0x57bab3[_0xca0b('0x36')]=_[_0xca0b('0x37')](_0x57bab3[_0xca0b('0x33')],_0x57bab3[_0xca0b('0x34')]);_0x4eca5d[_0xca0b('0x38')]=_['intersection'](_0x57bab3['model'],qs[_0xca0b('0x39')](_0x543bf8[_0xca0b('0x34')][_0xca0b('0x39')]));_0x4eca5d[_0xca0b('0x38')]=_0x4eca5d['attributes'][_0xca0b('0x3a')]?_0x4eca5d[_0xca0b('0x38')]:_0x57bab3[_0xca0b('0x33')];if(_0x543bf8[_0xca0b('0x34')]['includeAll']){_0x4eca5d['include']=[{'all':!![]}];}_0x4eca5d=_[_0xca0b('0x40')]({},_0x4eca5d,_0x543bf8[_0xca0b('0x42')]);return db[_0xca0b('0x43')]['find'](_0x4eca5d)[_0xca0b('0x29')](handleEntityNotFound(_0x170d76,null))[_0xca0b('0x29')](respondWithResult(_0x170d76,null))['catch'](handleError(_0x170d76,null));};exports['create']=function(_0x4f531c,_0x379a06){return db[_0xca0b('0x43')][_0xca0b('0x47')](_0x4f531c['body'],{})['then'](respondWithResult(_0x379a06,0xc9))[_0xca0b('0x48')](handleError(_0x379a06,null));};exports[_0xca0b('0x28')]=function(_0x250288,_0x174e81){if(_0x250288[_0xca0b('0x49')]['id']){delete _0x250288[_0xca0b('0x49')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x250288['params']['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0x174e81,null))[_0xca0b('0x29')](saveUpdates(_0x250288['body'],null))[_0xca0b('0x29')](respondWithResult(_0x174e81,null))[_0xca0b('0x48')](handleError(_0x174e81,null));};exports[_0xca0b('0x2a')]=function(_0x535cce,_0x251820){return db['FreshdeskField'][_0xca0b('0x4a')]({'where':{'id':_0x535cce[_0xca0b('0x4b')]['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0x251820,null))[_0xca0b('0x29')](removeEntity(_0x251820,null))[_0xca0b('0x48')](handleError(_0x251820,null));}; \ No newline at end of file +var _0xca66=['ejs','fs-extra','lodash','squel','crypto','jsforce','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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','name','send','FreshdeskField','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','merge','includeAll','include','rows','catch','params','find','create','body','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv'];(function(_0x1f1e6f,_0xad6cbd){var _0x48cb49=function(_0x51996f){while(--_0x51996f){_0x1f1e6f['push'](_0x1f1e6f['shift']());}};_0x48cb49(++_0xad6cbd);}(_0xca66,0x8b));var _0x6ca6=function(_0x62341b,_0x47dde0){_0x62341b=_0x62341b-0x0;var _0xe5379a=_0xca66[_0x62341b];return _0xe5379a;};'use strict';var emlformat=require(_0x6ca6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca6('0x1'));var rp=require(_0x6ca6('0x2'));var moment=require(_0x6ca6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ca6('0x4'));var util=require('util');var path=require(_0x6ca6('0x5'));var sox=require('sox');var csv=require(_0x6ca6('0x6'));var ejs=require(_0x6ca6('0x7'));var fs=require('fs');var fs_extra=require(_0x6ca6('0x8'));var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x6'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=typeof _0x5785b1[_0x6ca6('0x1b')]===_0x6ca6('0x1c')&&typeof _0x5785b1[_0x6ca6('0x1d')]===_0x6ca6('0x1c');var _0x25dc6c=_0x36ff3e['count'];var _0x2391ce=_0x19e94f?0x0:_0x5785b1[_0x6ca6('0x1b')];var _0xc97f0=_0x19e94f?_0x36ff3e[_0x6ca6('0x1e')]:_0x5785b1[_0x6ca6('0x1b')]+_0x5785b1[_0x6ca6('0x1d')];var _0x16a3d7;if(_0xc97f0>=_0x25dc6c){_0xc97f0=_0x25dc6c;_0x16a3d7=0xc8;}else{_0x16a3d7=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x16a3d7);return _0x52c59a[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x2391ce+'-'+_0xc97f0+'/'+_0x25dc6c)[_0x6ca6('0x21')](_0x36ff3e);}return null;};}function patchUpdates(_0x4c3be9){return function(_0x28a982){try{jsonpatch[_0x6ca6('0x22')](_0x28a982,_0x4c3be9,!![]);}catch(_0x38cad4){return BPromise[_0x6ca6('0x23')](_0x38cad4);}return _0x28a982[_0x6ca6('0x24')]();};}function saveUpdates(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x25')](_0x438694)['then'](function(_0x4927c1){return _0x4927c1;});}return null;};}function removeEntity(_0xfbf496,_0x216701){return function(_0xfe0760){if(_0xfe0760){return _0xfe0760[_0x6ca6('0x26')]()[_0x6ca6('0x27')](function(){_0xfbf496['status'](0xcc)[_0x6ca6('0x1a')]();});}};}function handleEntityNotFound(_0x1d6caa,_0x1c43ee){return function(_0x2d8c64){if(!_0x2d8c64){_0x1d6caa[_0x6ca6('0x28')](0x194);}return _0x2d8c64;};}function handleError(_0x29f37e,_0x3c32ae){_0x3c32ae=_0x3c32ae||0x1f4;return function(_0x2a1e2d){logger['error'](_0x2a1e2d['stack']);if(_0x2a1e2d[_0x6ca6('0x29')]){delete _0x2a1e2d[_0x6ca6('0x29')];}_0x29f37e[_0x6ca6('0x19')](_0x3c32ae)[_0x6ca6('0x2a')](_0x2a1e2d);};}exports['index']=function(_0x5ea6f7,_0x306583){var _0x47cf48={},_0x4ab84c={},_0x141e78={'count':0x0,'rows':[]};var _0xefd407=_['map'](db[_0x6ca6('0x2b')][_0x6ca6('0x2c')],function(_0xac50e8){return{'name':_0xac50e8[_0x6ca6('0x2d')],'type':_0xac50e8['type'][_0x6ca6('0x2e')]};});_0x4ab84c[_0x6ca6('0x2f')]=_[_0x6ca6('0x30')](_0xefd407,_0x6ca6('0x29'));_0x4ab84c['query']=_[_0x6ca6('0x31')](_0x5ea6f7[_0x6ca6('0x32')]);_0x4ab84c[_0x6ca6('0x33')]=_[_0x6ca6('0x34')](_0x4ab84c['model'],_0x4ab84c['query']);_0x47cf48['attributes']=_['intersection'](_0x4ab84c['model'],qs[_0x6ca6('0x35')](_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x35')]));_0x47cf48['attributes']=_0x47cf48[_0x6ca6('0x36')][_0x6ca6('0x37')]?_0x47cf48[_0x6ca6('0x36')]:_0x4ab84c[_0x6ca6('0x2f')];if(!_0x5ea6f7['query'][_0x6ca6('0x38')](_0x6ca6('0x39'))){_0x47cf48[_0x6ca6('0x1d')]=qs[_0x6ca6('0x1d')](_0x5ea6f7['query'][_0x6ca6('0x1d')]);_0x47cf48['offset']=qs[_0x6ca6('0x1b')](_0x5ea6f7['query']['offset']);}_0x47cf48[_0x6ca6('0x3a')]=qs[_0x6ca6('0x3b')](_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x3b')]);_0x47cf48['where']=qs['filters'](_[_0x6ca6('0x3c')](_0x5ea6f7[_0x6ca6('0x32')],_0x4ab84c['filters']),_0xefd407);if(_0x5ea6f7[_0x6ca6('0x32')]['filter']){_0x47cf48[_0x6ca6('0x3d')]=_['merge'](_0x47cf48[_0x6ca6('0x3d')],{'$or':_[_0x6ca6('0x30')](_0xefd407,function(_0x254733){if(_0x254733[_0x6ca6('0x3e')]!==_0x6ca6('0x3f')){var _0x3ca258={};_0x3ca258[_0x254733[_0x6ca6('0x29')]]={'$like':'%'+_0x5ea6f7[_0x6ca6('0x32')]['filter']+'%'};return _0x3ca258;}})});}_0x47cf48=_[_0x6ca6('0x40')]({},_0x47cf48,_0x5ea6f7['options']);var _0x57186c={'where':_0x47cf48[_0x6ca6('0x3d')]};return db[_0x6ca6('0x2b')]['count'](_0x57186c)[_0x6ca6('0x27')](function(_0x500ed4){_0x141e78[_0x6ca6('0x1e')]=_0x500ed4;if(_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x41')]){_0x47cf48[_0x6ca6('0x42')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x47cf48);})[_0x6ca6('0x27')](function(_0x3813d6){_0x141e78[_0x6ca6('0x43')]=_0x3813d6;return _0x141e78;})[_0x6ca6('0x27')](respondWithFilteredResult(_0x306583,_0x47cf48))[_0x6ca6('0x44')](handleError(_0x306583,null));};exports['show']=function(_0x76db8d,_0x2ffdfc){var _0x5bed6e={'raw':!![],'where':{'id':_0x76db8d[_0x6ca6('0x45')]['id']}},_0x317b5e={};_0x317b5e[_0x6ca6('0x2f')]=_[_0x6ca6('0x31')](db[_0x6ca6('0x2b')][_0x6ca6('0x2c')]);_0x317b5e[_0x6ca6('0x32')]=_[_0x6ca6('0x31')](_0x76db8d[_0x6ca6('0x32')]);_0x317b5e['filters']=_[_0x6ca6('0x34')](_0x317b5e[_0x6ca6('0x2f')],_0x317b5e[_0x6ca6('0x32')]);_0x5bed6e[_0x6ca6('0x36')]=_[_0x6ca6('0x34')](_0x317b5e[_0x6ca6('0x2f')],qs[_0x6ca6('0x35')](_0x76db8d[_0x6ca6('0x32')]['fields']));_0x5bed6e['attributes']=_0x5bed6e[_0x6ca6('0x36')][_0x6ca6('0x37')]?_0x5bed6e[_0x6ca6('0x36')]:_0x317b5e[_0x6ca6('0x2f')];if(_0x76db8d[_0x6ca6('0x32')][_0x6ca6('0x41')]){_0x5bed6e[_0x6ca6('0x42')]=[{'all':!![]}];}_0x5bed6e=_['merge']({},_0x5bed6e,_0x76db8d['options']);return db[_0x6ca6('0x2b')][_0x6ca6('0x46')](_0x5bed6e)['then'](handleEntityNotFound(_0x2ffdfc,null))[_0x6ca6('0x27')](respondWithResult(_0x2ffdfc,null))[_0x6ca6('0x44')](handleError(_0x2ffdfc,null));};exports[_0x6ca6('0x47')]=function(_0x34a388,_0xc1928f){return db[_0x6ca6('0x2b')][_0x6ca6('0x47')](_0x34a388['body'],{})[_0x6ca6('0x27')](respondWithResult(_0xc1928f,0xc9))[_0x6ca6('0x44')](handleError(_0xc1928f,null));};exports[_0x6ca6('0x25')]=function(_0x4fde51,_0x408df3){if(_0x4fde51['body']['id']){delete _0x4fde51[_0x6ca6('0x48')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x4fde51['params']['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x408df3,null))[_0x6ca6('0x27')](saveUpdates(_0x4fde51[_0x6ca6('0x48')],null))['then'](respondWithResult(_0x408df3,null))[_0x6ca6('0x44')](handleError(_0x408df3,null));};exports['destroy']=function(_0x1f552d,_0x1010a6){return db[_0x6ca6('0x2b')][_0x6ca6('0x46')]({'where':{'id':_0x1f552d[_0x6ca6('0x45')]['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x1010a6,null))[_0x6ca6('0x27')](removeEntity(_0x1010a6,null))[_0x6ca6('0x44')](handleError(_0x1010a6,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 21437e9..7bfe886 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 _0xbd33=['moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x3ef70c,_0x73d40e){var _0x36e5a8=function(_0x4020fe){while(--_0x4020fe){_0x3ef70c['push'](_0x3ef70c['shift']());}};_0x36e5a8(++_0x73d40e);}(_0xbd33,0x1dd));var _0x3bd3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd33[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3bd3('0x0'));var logger=require(_0x3bd3('0x1'))(_0x3bd3('0x2'));var moment=require(_0x3bd3('0x3'));var BPromise=require(_0x3bd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bd3('0x5'));var rimraf=require(_0x3bd3('0x6'));var config=require(_0x3bd3('0x7'));var attributes=require(_0x3bd3('0x8'));module[_0x3bd3('0x9')]=function(_0x2615ca,_0x4531df){return _0x2615ca['define'](_0x3bd3('0xa'),attributes,{'tableName':_0x3bd3('0xb'),'paranoid':![],'indexes':[{'name':_0x3bd3('0xc'),'fields':[_0x3bd3('0xd'),_0x3bd3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb85=['../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0xbb85,0x92));var _0x5bb8=function(_0x106811,_0x230c3a){_0x106811=_0x106811-0x0;var _0x4fec4a=_0xbb85[_0x106811];return _0x4fec4a;};'use strict';var _=require(_0x5bb8('0x0'));var util=require(_0x5bb8('0x1'));var logger=require(_0x5bb8('0x2'))(_0x5bb8('0x3'));var moment=require('moment');var BPromise=require(_0x5bb8('0x4'));var rp=require(_0x5bb8('0x5'));var fs=require('fs');var path=require(_0x5bb8('0x6'));var rimraf=require(_0x5bb8('0x7'));var config=require(_0x5bb8('0x8'));var attributes=require(_0x5bb8('0x9'));module[_0x5bb8('0xa')]=function(_0x48ad61,_0x4d208a){return _0x48ad61['define'](_0x5bb8('0xb'),attributes,{'tableName':_0x5bb8('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x5bb8('0xd')],'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 aff055b..2ef882e 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 _0x95a9=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x95a9,0x10b));var _0x995a=function(_0x21713d,_0x278400){_0x21713d=_0x21713d-0x0;var _0x91bc26=_0x95a9[_0x21713d];return _0x91bc26;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x995a('0x0'));var BPromise=require(_0x995a('0x1'));var rs=require(_0x995a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x995a('0x3'));var logger=require(_0x995a('0x4'))(_0x995a('0x5'));var config=require(_0x995a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x995a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x572282,_0x26d553,_0x368b77){return new BPromise(function(_0x5b4a60,_0x35327a){return client[_0x995a('0x8')](_0x572282,_0x368b77)[_0x995a('0x9')](function(_0x5ef9bc){logger[_0x995a('0xa')](_0x995a('0xb'),_0x26d553,_0x995a('0xc'));logger[_0x995a('0xd')](_0x995a('0xe'),_0x26d553,_0x995a('0xc'),JSON[_0x995a('0xf')](_0x5ef9bc));if(_0x5ef9bc[_0x995a('0x10')]){if(_0x5ef9bc[_0x995a('0x10')][_0x995a('0x11')]===0x1f4){logger[_0x995a('0x10')](_0x995a('0xb'),_0x26d553,_0x5ef9bc['error'][_0x995a('0x12')]);return _0x35327a(_0x5ef9bc[_0x995a('0x10')][_0x995a('0x12')]);}logger['error'](_0x995a('0xb'),_0x26d553,_0x5ef9bc[_0x995a('0x10')][_0x995a('0x12')]);return _0x5b4a60(_0x5ef9bc[_0x995a('0x10')][_0x995a('0x12')]);}else{logger[_0x995a('0xa')](_0x995a('0xb'),_0x26d553,_0x995a('0xc'));_0x5b4a60(_0x5ef9bc['result'][_0x995a('0x12')]);}})[_0x995a('0x13')](function(_0x3fe4f2){logger[_0x995a('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x26d553,_0x3fe4f2);_0x35327a(_0x3fe4f2);});});} \ No newline at end of file +var _0xec85=['then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2dc54e,_0x52abe5){var _0x1f41ca=function(_0x3b2c67){while(--_0x3b2c67){_0x2dc54e['push'](_0x2dc54e['shift']());}};_0x1f41ca(++_0x52abe5);}(_0xec85,0x94));var _0x5ec8=function(_0x134e59,_0x4a08c8){_0x134e59=_0x134e59-0x0;var _0xb05715=_0xec85[_0x134e59];return _0xb05715;};'use strict';var _=require('lodash');var util=require(_0x5ec8('0x0'));var moment=require(_0x5ec8('0x1'));var BPromise=require(_0x5ec8('0x2'));var rs=require(_0x5ec8('0x3'));var fs=require('fs');var Redis=require(_0x5ec8('0x4'));var db=require(_0x5ec8('0x5'))['db'];var utils=require(_0x5ec8('0x6'));var logger=require(_0x5ec8('0x7'))(_0x5ec8('0x8'));var config=require(_0x5ec8('0x9'));var jayson=require(_0x5ec8('0xa'));var client=jayson[_0x5ec8('0xb')][_0x5ec8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x144b4a,_0x3d9a1f,_0x2a65d8){return new BPromise(function(_0x3cd198,_0x237ca6){return client['request'](_0x144b4a,_0x2a65d8)[_0x5ec8('0xd')](function(_0x238d60){logger['info'](_0x5ec8('0xe'),_0x3d9a1f,_0x5ec8('0xf'));logger[_0x5ec8('0x10')](_0x5ec8('0x11'),_0x3d9a1f,_0x5ec8('0xf'),JSON['stringify'](_0x238d60));if(_0x238d60[_0x5ec8('0x12')]){if(_0x238d60['error']['code']===0x1f4){logger[_0x5ec8('0x12')](_0x5ec8('0xe'),_0x3d9a1f,_0x238d60[_0x5ec8('0x12')]['message']);return _0x237ca6(_0x238d60[_0x5ec8('0x12')][_0x5ec8('0x13')]);}logger[_0x5ec8('0x12')](_0x5ec8('0xe'),_0x3d9a1f,_0x238d60[_0x5ec8('0x12')][_0x5ec8('0x13')]);return _0x3cd198(_0x238d60[_0x5ec8('0x12')][_0x5ec8('0x13')]);}else{logger[_0x5ec8('0x14')](_0x5ec8('0xe'),_0x3d9a1f,_0x5ec8('0xf'));_0x3cd198(_0x238d60[_0x5ec8('0x15')]['message']);}})[_0x5ec8('0x16')](function(_0x2c881c){logger['error'](_0x5ec8('0xe'),_0x3d9a1f,_0x2c881c);_0x237ca6(_0x2c881c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9d45f46..25e746e 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 _0xdb94=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','index','/:id','show','get','/:id/configurations'];(function(_0x1a4acb,_0x1c24c4){var _0x5d35a5=function(_0x36e757){while(--_0x36e757){_0x1a4acb['push'](_0x1a4acb['shift']());}};_0x5d35a5(++_0x1c24c4);}(_0xdb94,0xab));var _0x4db9=function(_0xddbeb7,_0x1a61ab){_0xddbeb7=_0xddbeb7-0x0;var _0x41ce59=_0xdb94[_0xddbeb7];return _0x41ce59;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),controller['create']);router[_0x4db9('0x11')](_0x4db9('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4db9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4db9('0x13')]);router[_0x4db9('0x14')]('/:id',auth[_0x4db9('0xd')](),controller[_0x4db9('0x15')]);module[_0x4db9('0x16')]=router; \ No newline at end of file +var _0xb688=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0xfd09c4,_0x3f3363){var _0xce3863=function(_0x10c48e){while(--_0x10c48e){_0xfd09c4['push'](_0xfd09c4['shift']());}};_0xce3863(++_0x3f3363);}(_0xb688,0xcf));var _0x8b68=function(_0x29e6fe,_0xd2db3a){_0x29e6fe=_0x29e6fe-0x0;var _0x5c9b14=_0xb688[_0x29e6fe];return _0x5c9b14;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')]('/',auth[_0x8b68('0xc')](),controller['create']);router[_0x8b68('0x12')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x13')]);router[_0x8b68('0x14')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 25fd378..ed247fb 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 _0x0598=['exports','STRING','sequelize'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0x0598,0x92));var _0x8059=function(_0x4cc5dc,_0x189004){_0x4cc5dc=_0x4cc5dc-0x0;var _0x547dd6=_0x0598[_0x4cc5dc];return _0x547dd6;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8059('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x8059('0x2')]},'remoteUri':{'type':Sequelize[_0x8059('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0120=['remoteUri','sequelize','exports','STRING','username'];(function(_0x33bfed,_0xe4f92a){var _0x8e4835=function(_0x2fd9e1){while(--_0x2fd9e1){_0x33bfed['push'](_0x33bfed['shift']());}};_0x8e4835(++_0xe4f92a);}(_0x0120,0x6f));var _0x0012=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x0120[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'apiKey':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'serverUrl':{'type':Sequelize[_0x0012('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 21252c4..5a6c312 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 _0xf436=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','json','apply','reject','save','destroy','then','error','name','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','findOne','FreshsalesConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','FreshsalesField','Descriptions','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','getFields','send','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3ef869,_0x512093){var _0x2f867b=function(_0x2b1ed2){while(--_0x2b1ed2){_0x3ef869['push'](_0x3ef869['shift']());}};_0x2f867b(++_0x512093);}(_0xf436,0x18e));var _0x6f43=function(_0x4bafb7,_0x3e13d8){_0x4bafb7=_0x4bafb7-0x0;var _0x2fba7b=_0xf436[_0x4bafb7];return _0x2fba7b;};'use strict';var emlformat=require(_0x6f43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f43('0x1'));var jsonpatch=require(_0x6f43('0x2'));var rp=require(_0x6f43('0x3'));var moment=require(_0x6f43('0x4'));var BPromise=require(_0x6f43('0x5'));var Mustache=require(_0x6f43('0x6'));var util=require(_0x6f43('0x7'));var path=require(_0x6f43('0x8'));var sox=require(_0x6f43('0x9'));var csv=require(_0x6f43('0xa'));var ejs=require(_0x6f43('0xb'));var fs=require('fs');var fs_extra=require(_0x6f43('0xc'));var _=require(_0x6f43('0xd'));var squel=require(_0x6f43('0xe'));var crypto=require(_0x6f43('0xf'));var jsforce=require(_0x6f43('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6f43('0x11'));var Redis=require('ioredis');var authService=require(_0x6f43('0x12'));var qs=require(_0x6f43('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f43('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6f43('0x15'));var config=require(_0x6f43('0x16'));var licenseUtil=require(_0x6f43('0x17'));var db=require(_0x6f43('0x18'))['db'];var integrations=require(_0x6f43('0x19'));function respondWithStatusCode(_0x2489b9,_0x1576d4){_0x1576d4=_0x1576d4||0xcc;return function(_0x267658){if(_0x267658){return _0x2489b9['sendStatus'](_0x1576d4);}return _0x2489b9[_0x6f43('0x1a')](_0x1576d4)[_0x6f43('0x1b')]();};}function respondWithResult(_0x2ccc90,_0x5e57a0){_0x5e57a0=_0x5e57a0||0xc8;return function(_0x57c0e5){if(_0x57c0e5){return _0x2ccc90[_0x6f43('0x1a')](_0x5e57a0)['json'](_0x57c0e5);}};}function respondWithFilteredResult(_0x49fabe,_0xdbbad9){return function(_0x2c14f8){if(_0x2c14f8){var _0x54608b=typeof _0xdbbad9[_0x6f43('0x1c')]===_0x6f43('0x1d')&&typeof _0xdbbad9[_0x6f43('0x1e')]===_0x6f43('0x1d');var _0x3c9f12=_0x2c14f8[_0x6f43('0x1f')];var _0x548536=_0x54608b?0x0:_0xdbbad9[_0x6f43('0x1c')];var _0x10bb16=_0x54608b?_0x2c14f8[_0x6f43('0x1f')]:_0xdbbad9[_0x6f43('0x1c')]+_0xdbbad9[_0x6f43('0x1e')];var _0x40822a;if(_0x10bb16>=_0x3c9f12){_0x10bb16=_0x3c9f12;_0x40822a=0xc8;}else{_0x40822a=0xce;}_0x49fabe[_0x6f43('0x1a')](_0x40822a);return _0x49fabe[_0x6f43('0x20')]('Content-Range',_0x548536+'-'+_0x10bb16+'/'+_0x3c9f12)[_0x6f43('0x21')](_0x2c14f8);}return null;};}function patchUpdates(_0x3795c9){return function(_0x1d77fd){try{jsonpatch[_0x6f43('0x22')](_0x1d77fd,_0x3795c9,!![]);}catch(_0x1f4baa){return BPromise[_0x6f43('0x23')](_0x1f4baa);}return _0x1d77fd[_0x6f43('0x24')]();};}function saveUpdates(_0x561014,_0x4f303f){return function(_0x4f047b){if(_0x4f047b){return _0x4f047b['update'](_0x561014)['then'](function(_0x58abce){return _0x58abce;});}return null;};}function removeEntity(_0x46adff,_0x30deba){return function(_0x19aaa2){if(_0x19aaa2){return _0x19aaa2[_0x6f43('0x25')]()[_0x6f43('0x26')](function(){_0x46adff['status'](0xcc)[_0x6f43('0x1b')]();});}};}function handleEntityNotFound(_0x2f290b,_0x49bf42){return function(_0x1deb31){if(!_0x1deb31){_0x2f290b['sendStatus'](0x194);}return _0x1deb31;};}function handleError(_0x2baac8,_0x556fc8){_0x556fc8=_0x556fc8||0x1f4;return function(_0x36cedf){logger[_0x6f43('0x27')](_0x36cedf['stack']);if(_0x36cedf[_0x6f43('0x28')]){delete _0x36cedf[_0x6f43('0x28')];}_0x2baac8[_0x6f43('0x1a')](_0x556fc8)['send'](_0x36cedf);};}exports[_0x6f43('0x29')]=function(_0x53195d,_0xf4eaef){var _0x54de45={},_0x1c4335={},_0x20b06f={'count':0x0,'rows':[]};var _0x1e2b9e=_[_0x6f43('0x2a')](db['FreshsalesAccount']['rawAttributes'],function(_0x5f48c7){return{'name':_0x5f48c7[_0x6f43('0x2b')],'type':_0x5f48c7[_0x6f43('0x2c')][_0x6f43('0x2d')]};});_0x1c4335[_0x6f43('0x2e')]=_[_0x6f43('0x2a')](_0x1e2b9e,_0x6f43('0x28'));_0x1c4335[_0x6f43('0x2f')]=_['keys'](_0x53195d[_0x6f43('0x2f')]);_0x1c4335['filters']=_[_0x6f43('0x30')](_0x1c4335[_0x6f43('0x2e')],_0x1c4335[_0x6f43('0x2f')]);_0x54de45[_0x6f43('0x31')]=_[_0x6f43('0x30')](_0x1c4335[_0x6f43('0x2e')],qs[_0x6f43('0x32')](_0x53195d[_0x6f43('0x2f')][_0x6f43('0x32')]));_0x54de45[_0x6f43('0x31')]=_0x54de45[_0x6f43('0x31')][_0x6f43('0x33')]?_0x54de45[_0x6f43('0x31')]:_0x1c4335[_0x6f43('0x2e')];if(!_0x53195d[_0x6f43('0x2f')][_0x6f43('0x34')](_0x6f43('0x35'))){_0x54de45[_0x6f43('0x1e')]=qs['limit'](_0x53195d['query']['limit']);_0x54de45[_0x6f43('0x1c')]=qs[_0x6f43('0x1c')](_0x53195d[_0x6f43('0x2f')][_0x6f43('0x1c')]);}_0x54de45[_0x6f43('0x36')]=qs['sort'](_0x53195d[_0x6f43('0x2f')][_0x6f43('0x37')]);_0x54de45[_0x6f43('0x38')]=qs[_0x6f43('0x39')](_[_0x6f43('0x3a')](_0x53195d[_0x6f43('0x2f')],_0x1c4335[_0x6f43('0x39')]),_0x1e2b9e);if(_0x53195d[_0x6f43('0x2f')]['filter']){_0x54de45['where']=_[_0x6f43('0x3b')](_0x54de45[_0x6f43('0x38')],{'$or':_['map'](_0x1e2b9e,function(_0x4cc9cb){if(_0x4cc9cb[_0x6f43('0x2c')]!==_0x6f43('0x3c')){var _0x53f387={};_0x53f387[_0x4cc9cb[_0x6f43('0x28')]]={'$like':'%'+_0x53195d['query']['filter']+'%'};return _0x53f387;}})});}_0x54de45=_[_0x6f43('0x3b')]({},_0x54de45,_0x53195d[_0x6f43('0x3d')]);var _0x441d6c={'where':_0x54de45[_0x6f43('0x38')]};return db[_0x6f43('0x3e')]['count'](_0x441d6c)['then'](function(_0x550e7d){_0x20b06f[_0x6f43('0x1f')]=_0x550e7d;if(_0x53195d[_0x6f43('0x2f')][_0x6f43('0x3f')]){_0x54de45[_0x6f43('0x40')]=[{'all':!![]}];}return db[_0x6f43('0x3e')][_0x6f43('0x41')](_0x54de45);})[_0x6f43('0x26')](function(_0x562332){_0x20b06f[_0x6f43('0x42')]=_0x562332;return _0x20b06f;})['then'](respondWithFilteredResult(_0xf4eaef,_0x54de45))[_0x6f43('0x43')](handleError(_0xf4eaef,null));};exports[_0x6f43('0x44')]=function(_0x33fcb4,_0x6fb4a9){var _0x2f9fbe={'raw':![],'where':{'id':_0x33fcb4[_0x6f43('0x45')]['id']}},_0x561222={};_0x561222[_0x6f43('0x2e')]=_[_0x6f43('0x46')](db[_0x6f43('0x3e')]['rawAttributes']);_0x561222[_0x6f43('0x2f')]=_[_0x6f43('0x46')](_0x33fcb4[_0x6f43('0x2f')]);_0x561222['filters']=_[_0x6f43('0x30')](_0x561222[_0x6f43('0x2e')],_0x561222[_0x6f43('0x2f')]);_0x2f9fbe[_0x6f43('0x31')]=_[_0x6f43('0x30')](_0x561222[_0x6f43('0x2e')],qs[_0x6f43('0x32')](_0x33fcb4['query'][_0x6f43('0x32')]));_0x2f9fbe[_0x6f43('0x31')]=_0x2f9fbe['attributes'][_0x6f43('0x33')]?_0x2f9fbe[_0x6f43('0x31')]:_0x561222['model'];if(_0x33fcb4[_0x6f43('0x2f')][_0x6f43('0x3f')]){_0x2f9fbe[_0x6f43('0x40')]=[{'all':!![]}];}_0x2f9fbe=_[_0x6f43('0x3b')]({},_0x2f9fbe,_0x33fcb4[_0x6f43('0x3d')]);return db[_0x6f43('0x3e')][_0x6f43('0x47')](_0x2f9fbe)['then'](handleEntityNotFound(_0x6fb4a9,null))[_0x6f43('0x26')](respondWithResult(_0x6fb4a9,null))[_0x6f43('0x43')](handleError(_0x6fb4a9,null));};exports[_0x6f43('0x48')]=function(_0x1b85cd,_0x322c5a){return db[_0x6f43('0x3e')][_0x6f43('0x48')](_0x1b85cd[_0x6f43('0x49')],{})[_0x6f43('0x26')](respondWithResult(_0x322c5a,0xc9))[_0x6f43('0x43')](handleError(_0x322c5a,null));};exports[_0x6f43('0x4a')]=function(_0x345add,_0x4735f7){if(_0x345add['body']['id']){delete _0x345add['body']['id'];}return db[_0x6f43('0x3e')][_0x6f43('0x47')]({'where':{'id':_0x345add[_0x6f43('0x45')]['id']}})[_0x6f43('0x26')](handleEntityNotFound(_0x4735f7,null))[_0x6f43('0x26')](saveUpdates(_0x345add[_0x6f43('0x49')],null))[_0x6f43('0x26')](respondWithResult(_0x4735f7,null))[_0x6f43('0x43')](handleError(_0x4735f7,null));};exports[_0x6f43('0x25')]=function(_0xf80662,_0x4ace41){return db[_0x6f43('0x3e')][_0x6f43('0x47')]({'where':{'id':_0xf80662['params']['id']}})[_0x6f43('0x26')](handleEntityNotFound(_0x4ace41,null))['then'](removeEntity(_0x4ace41,null))[_0x6f43('0x43')](handleError(_0x4ace41,null));};exports['getConfigurations']=function(_0x2845be,_0x128746,_0x18ef04){var _0x3f5afe={};var _0x32dab5={};var _0x2fa5d7;var _0x22f9bb;return db[_0x6f43('0x3e')][_0x6f43('0x4b')]({'where':{'id':_0x2845be[_0x6f43('0x45')]['id']}})[_0x6f43('0x26')](handleEntityNotFound(_0x128746,null))[_0x6f43('0x26')](function(_0x3376d5){if(_0x3376d5){_0x2fa5d7=_0x3376d5;_0x32dab5[_0x6f43('0x2e')]=_[_0x6f43('0x46')](db[_0x6f43('0x4c')][_0x6f43('0x4d')]);_0x32dab5[_0x6f43('0x2f')]=_[_0x6f43('0x46')](_0x2845be[_0x6f43('0x2f')]);_0x32dab5['filters']=_[_0x6f43('0x30')](_0x32dab5[_0x6f43('0x2e')],_0x32dab5[_0x6f43('0x2f')]);_0x3f5afe['attributes']=_[_0x6f43('0x30')](_0x32dab5['model'],qs['fields'](_0x2845be[_0x6f43('0x2f')][_0x6f43('0x32')]));_0x3f5afe[_0x6f43('0x31')]=_0x3f5afe[_0x6f43('0x31')][_0x6f43('0x33')]?_0x3f5afe[_0x6f43('0x31')]:_0x32dab5['model'];_0x3f5afe[_0x6f43('0x36')]=qs[_0x6f43('0x37')](_0x2845be[_0x6f43('0x2f')]['sort']);_0x3f5afe[_0x6f43('0x38')]=qs[_0x6f43('0x39')](_[_0x6f43('0x3a')](_0x2845be['query'],_0x32dab5[_0x6f43('0x39')]));if(_0x2845be[_0x6f43('0x2f')]['filter']){_0x3f5afe[_0x6f43('0x38')]=_[_0x6f43('0x3b')](_0x3f5afe[_0x6f43('0x38')],{'$or':_[_0x6f43('0x2a')](_0x3f5afe[_0x6f43('0x31')],function(_0x3b59da){var _0x311202={};_0x311202[_0x3b59da]={'$like':'%'+_0x2845be[_0x6f43('0x2f')]['filter']+'%'};return _0x311202;})});}_0x3f5afe=_[_0x6f43('0x3b')]({},_0x3f5afe,_0x2845be['options']);return _0x2fa5d7['getConfigurations'](_0x3f5afe);}})[_0x6f43('0x26')](function(_0x3d5c95){if(_0x3d5c95){_0x22f9bb=_0x3d5c95[_0x6f43('0x33')];if(!_0x2845be[_0x6f43('0x2f')]['hasOwnProperty'](_0x6f43('0x35'))){_0x3f5afe[_0x6f43('0x1e')]=qs['limit'](_0x2845be['query'][_0x6f43('0x1e')]);_0x3f5afe[_0x6f43('0x1c')]=qs[_0x6f43('0x1c')](_0x2845be[_0x6f43('0x2f')][_0x6f43('0x1c')]);}return _0x2fa5d7['getConfigurations'](_0x3f5afe);}})[_0x6f43('0x26')](function(_0x40c897){if(_0x40c897){return _0x40c897?{'count':_0x22f9bb,'rows':_0x40c897}:null;}})['then'](respondWithResult(_0x128746,null))['catch'](handleError(_0x128746,null));};exports[_0x6f43('0x4e')]=function(_0x161005,_0x2b6bac,_0x55f576){if(_0x161005[_0x6f43('0x49')]['id']){delete _0x161005['body']['id'];}return db['FreshsalesAccount'][_0x6f43('0x4b')]({'where':{'id':_0x161005[_0x6f43('0x45')]['id']}})[_0x6f43('0x26')](handleEntityNotFound(_0x2b6bac,null))['then'](function(_0x139a71){if(_0x139a71){_0x161005[_0x6f43('0x49')][_0x6f43('0x4f')]=_0x139a71['id'];_0x161005[_0x6f43('0x49')][_0x6f43('0x50')]=integrations[_0x6f43('0x51')](_0x161005[_0x6f43('0x49')]['channel'],_0x161005['body'][_0x6f43('0x2c')]);_0x161005[_0x6f43('0x49')]['Descriptions']=integrations[_0x6f43('0x52')](_0x161005['body']['channel'],_0x161005[_0x6f43('0x49')][_0x6f43('0x2c')]);return db[_0x6f43('0x4c')][_0x6f43('0x48')](_0x161005[_0x6f43('0x49')],{'include':[{'model':db[_0x6f43('0x53')],'as':_0x6f43('0x50')},{'model':db[_0x6f43('0x53')],'as':_0x6f43('0x54')}]});}return null;})['then'](respondWithResult(_0x2b6bac,null))['catch'](handleError(_0x2b6bac,null));};exports['getFields']=function(_0x29af45,_0x5ac985,_0x57dded){var _0x41d382='';var _0x43bccc='';return db[_0x6f43('0x3e')]['findOne']({'where':{'id':_0x29af45['params']['id']},'attributes':['id',_0x6f43('0x55'),_0x6f43('0x56'),_0x6f43('0x57')]})[_0x6f43('0x26')](handleEntityNotFound(_0x5ac985,null))[_0x6f43('0x26')](function(_0x265def){if(_0x265def){_0x43bccc=_0x265def[_0x6f43('0x55')];_0x41d382=_0x265def[_0x6f43('0x56')];var _0x3c08c8=_0x265def[_0x6f43('0x56')]['slice'](-0x1);if(_0x3c08c8==='/'){_0x41d382=_0x41d382[_0x6f43('0x58')](0x0,_0x41d382[_0x6f43('0x59')](_0x3c08c8));}return rp({'method':_0x6f43('0x5a'),'uri':util[_0x6f43('0x5b')]('%s%s',_0x41d382,_0x6f43('0x5c')),'headers':{'Authorization':_0x6f43('0x5d')+_0x265def['apiKey']},'json':!![]});}})[_0x6f43('0x26')](function(_0x431cd2){if(_0x431cd2){var _0x1bca2e=_0x431cd2[_0x6f43('0x5e')];var _0x3e4673=![];var _0x28a4cb=null;for(_0x28a4cb=0x0;_0x28a4cb<_0x1bca2e[_0x6f43('0x33')];_0x28a4cb++){if(_0x1bca2e[_0x28a4cb][_0x6f43('0x5f')]===_0x43bccc){_0x3e4673=!![];}}if(_0x3e4673){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6f43('0x60')});}}})[_0x6f43('0x26')](respondWithResult(_0x5ac985,null))[_0x6f43('0x43')](function(_0xd4ce4d){var _0x564af8=_0x29af45[_0x6f43('0x2f')][_0x6f43('0x61')]?0x1f4:_0xd4ce4d['statusCode']||0x1f4;logger[_0x6f43('0x27')](_0x6f43('0x62'),_0x6f43('0x63'),_0x564af8,JSON['stringify'](_0xd4ce4d));delete _0xd4ce4d[_0x6f43('0x28')];if(_0x564af8===0x191){_0x564af8=0x190;}_0x5ac985['status'](_0x564af8)[_0x6f43('0x64')](_0x29af45[_0x6f43('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xd4ce4d[_0x6f43('0x65')]}:_0xd4ce4d);});}; \ No newline at end of file +var _0xf972=['FreshsalesAccount','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','FreshsalesConfiguration','rawAttributes','order','pick','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','users','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf972,0x108));var _0x2f97=function(_0x5befb3,_0x43f26f){_0x5befb3=_0x5befb3-0x0;var _0x202787=_0xf972[_0x5befb3];return _0x202787;};'use strict';var emlformat=require(_0x2f97('0x0'));var rimraf=require(_0x2f97('0x1'));var zipdir=require(_0x2f97('0x2'));var jsonpatch=require(_0x2f97('0x3'));var rp=require('request-promise');var moment=require(_0x2f97('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2f97('0x5'));var path=require(_0x2f97('0x6'));var sox=require(_0x2f97('0x7'));var csv=require(_0x2f97('0x8'));var ejs=require(_0x2f97('0x9'));var fs=require('fs');var fs_extra=require(_0x2f97('0xa'));var _=require(_0x2f97('0xb'));var squel=require(_0x2f97('0xc'));var crypto=require('crypto');var jsforce=require(_0x2f97('0xd'));var deskjs=require(_0x2f97('0xe'));var toCsv=require(_0x2f97('0x8'));var querystring=require(_0x2f97('0xf'));var Papa=require(_0x2f97('0x10'));var Redis=require(_0x2f97('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2f97('0x12'));var as=require(_0x2f97('0x13'));var hardwareService=require(_0x2f97('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2f97('0x15'));var config=require(_0x2f97('0x16'));var licenseUtil=require(_0x2f97('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2f97('0x18'));function respondWithStatusCode(_0x46b333,_0x11b0a2){_0x11b0a2=_0x11b0a2||0xcc;return function(_0x1466d1){if(_0x1466d1){return _0x46b333[_0x2f97('0x19')](_0x11b0a2);}return _0x46b333['status'](_0x11b0a2)[_0x2f97('0x1a')]();};}function respondWithResult(_0x428c6c,_0x23b5d4){_0x23b5d4=_0x23b5d4||0xc8;return function(_0x1df79a){if(_0x1df79a){return _0x428c6c['status'](_0x23b5d4)[_0x2f97('0x1b')](_0x1df79a);}};}function respondWithFilteredResult(_0x1bce9d,_0x599932){return function(_0x181785){if(_0x181785){var _0x279664=typeof _0x599932[_0x2f97('0x1c')]===_0x2f97('0x1d')&&typeof _0x599932['limit']===_0x2f97('0x1d');var _0x16e03b=_0x181785[_0x2f97('0x1e')];var _0x2206cf=_0x279664?0x0:_0x599932[_0x2f97('0x1c')];var _0x4978f5=_0x279664?_0x181785[_0x2f97('0x1e')]:_0x599932['offset']+_0x599932[_0x2f97('0x1f')];var _0x37ce80;if(_0x4978f5>=_0x16e03b){_0x4978f5=_0x16e03b;_0x37ce80=0xc8;}else{_0x37ce80=0xce;}_0x1bce9d[_0x2f97('0x20')](_0x37ce80);return _0x1bce9d['set'](_0x2f97('0x21'),_0x2206cf+'-'+_0x4978f5+'/'+_0x16e03b)[_0x2f97('0x1b')](_0x181785);}return null;};}function patchUpdates(_0x5b0f95){return function(_0x29bf53){try{jsonpatch['apply'](_0x29bf53,_0x5b0f95,!![]);}catch(_0x4aee45){return BPromise[_0x2f97('0x22')](_0x4aee45);}return _0x29bf53[_0x2f97('0x23')]();};}function saveUpdates(_0x3b108d,_0x2ae232){return function(_0x4142d4){if(_0x4142d4){return _0x4142d4[_0x2f97('0x24')](_0x3b108d)[_0x2f97('0x25')](function(_0x5ccd65){return _0x5ccd65;});}return null;};}function removeEntity(_0x18658a,_0x5d550e){return function(_0x5d26dd){if(_0x5d26dd){return _0x5d26dd[_0x2f97('0x26')]()[_0x2f97('0x25')](function(){_0x18658a[_0x2f97('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e15c9,_0x1a16b8){return function(_0x1964be){if(!_0x1964be){_0x4e15c9['sendStatus'](0x194);}return _0x1964be;};}function handleError(_0x41565a,_0x389475){_0x389475=_0x389475||0x1f4;return function(_0x2da30c){logger[_0x2f97('0x27')](_0x2da30c[_0x2f97('0x28')]);if(_0x2da30c['name']){delete _0x2da30c[_0x2f97('0x29')];}_0x41565a['status'](_0x389475)[_0x2f97('0x2a')](_0x2da30c);};}exports[_0x2f97('0x2b')]=function(_0x1f6b06,_0xec8a18){var _0x1b4c66={},_0x2a0757={},_0x18efc7={'count':0x0,'rows':[]};var _0x5aba85=_[_0x2f97('0x2c')](db[_0x2f97('0x2d')]['rawAttributes'],function(_0x400352){return{'name':_0x400352[_0x2f97('0x2e')],'type':_0x400352['type'][_0x2f97('0x2f')]};});_0x2a0757[_0x2f97('0x30')]=_['map'](_0x5aba85,'name');_0x2a0757['query']=_[_0x2f97('0x31')](_0x1f6b06['query']);_0x2a0757[_0x2f97('0x32')]=_[_0x2f97('0x33')](_0x2a0757[_0x2f97('0x30')],_0x2a0757[_0x2f97('0x34')]);_0x1b4c66[_0x2f97('0x35')]=_[_0x2f97('0x33')](_0x2a0757[_0x2f97('0x30')],qs[_0x2f97('0x36')](_0x1f6b06[_0x2f97('0x34')][_0x2f97('0x36')]));_0x1b4c66['attributes']=_0x1b4c66['attributes'][_0x2f97('0x37')]?_0x1b4c66[_0x2f97('0x35')]:_0x2a0757[_0x2f97('0x30')];if(!_0x1f6b06[_0x2f97('0x34')][_0x2f97('0x38')]('nolimit')){_0x1b4c66[_0x2f97('0x1f')]=qs[_0x2f97('0x1f')](_0x1f6b06[_0x2f97('0x34')][_0x2f97('0x1f')]);_0x1b4c66['offset']=qs[_0x2f97('0x1c')](_0x1f6b06[_0x2f97('0x34')][_0x2f97('0x1c')]);}_0x1b4c66['order']=qs[_0x2f97('0x39')](_0x1f6b06[_0x2f97('0x34')][_0x2f97('0x39')]);_0x1b4c66[_0x2f97('0x3a')]=qs[_0x2f97('0x32')](_['pick'](_0x1f6b06[_0x2f97('0x34')],_0x2a0757['filters']),_0x5aba85);if(_0x1f6b06[_0x2f97('0x34')][_0x2f97('0x3b')]){_0x1b4c66['where']=_[_0x2f97('0x3c')](_0x1b4c66['where'],{'$or':_[_0x2f97('0x2c')](_0x5aba85,function(_0x529f67){if(_0x529f67[_0x2f97('0x3d')]!==_0x2f97('0x3e')){var _0x455e52={};_0x455e52[_0x529f67['name']]={'$like':'%'+_0x1f6b06['query'][_0x2f97('0x3b')]+'%'};return _0x455e52;}})});}_0x1b4c66=_['merge']({},_0x1b4c66,_0x1f6b06[_0x2f97('0x3f')]);var _0x28318e={'where':_0x1b4c66['where']};return db[_0x2f97('0x2d')][_0x2f97('0x1e')](_0x28318e)[_0x2f97('0x25')](function(_0x128eb0){_0x18efc7['count']=_0x128eb0;if(_0x1f6b06['query'][_0x2f97('0x40')]){_0x1b4c66[_0x2f97('0x41')]=[{'all':!![]}];}return db[_0x2f97('0x2d')]['findAll'](_0x1b4c66);})['then'](function(_0xd12920){_0x18efc7[_0x2f97('0x42')]=_0xd12920;return _0x18efc7;})[_0x2f97('0x25')](respondWithFilteredResult(_0xec8a18,_0x1b4c66))[_0x2f97('0x43')](handleError(_0xec8a18,null));};exports[_0x2f97('0x44')]=function(_0x30dd85,_0x50ade1){var _0xc2422e={'raw':![],'where':{'id':_0x30dd85[_0x2f97('0x45')]['id']}},_0x4ab104={};_0x4ab104[_0x2f97('0x30')]=_['keys'](db[_0x2f97('0x2d')]['rawAttributes']);_0x4ab104['query']=_[_0x2f97('0x31')](_0x30dd85[_0x2f97('0x34')]);_0x4ab104[_0x2f97('0x32')]=_['intersection'](_0x4ab104[_0x2f97('0x30')],_0x4ab104[_0x2f97('0x34')]);_0xc2422e[_0x2f97('0x35')]=_[_0x2f97('0x33')](_0x4ab104[_0x2f97('0x30')],qs['fields'](_0x30dd85[_0x2f97('0x34')][_0x2f97('0x36')]));_0xc2422e[_0x2f97('0x35')]=_0xc2422e[_0x2f97('0x35')][_0x2f97('0x37')]?_0xc2422e['attributes']:_0x4ab104[_0x2f97('0x30')];if(_0x30dd85['query'][_0x2f97('0x40')]){_0xc2422e['include']=[{'all':!![]}];}_0xc2422e=_[_0x2f97('0x3c')]({},_0xc2422e,_0x30dd85['options']);return db[_0x2f97('0x2d')][_0x2f97('0x46')](_0xc2422e)[_0x2f97('0x25')](handleEntityNotFound(_0x50ade1,null))[_0x2f97('0x25')](respondWithResult(_0x50ade1,null))[_0x2f97('0x43')](handleError(_0x50ade1,null));};exports[_0x2f97('0x47')]=function(_0x4611aa,_0x4ba368){return db[_0x2f97('0x2d')][_0x2f97('0x47')](_0x4611aa['body'],{})[_0x2f97('0x25')](respondWithResult(_0x4ba368,0xc9))[_0x2f97('0x43')](handleError(_0x4ba368,null));};exports[_0x2f97('0x24')]=function(_0xa08674,_0x4d4496){if(_0xa08674[_0x2f97('0x48')]['id']){delete _0xa08674[_0x2f97('0x48')]['id'];}return db[_0x2f97('0x2d')]['find']({'where':{'id':_0xa08674['params']['id']}})['then'](handleEntityNotFound(_0x4d4496,null))[_0x2f97('0x25')](saveUpdates(_0xa08674[_0x2f97('0x48')],null))[_0x2f97('0x25')](respondWithResult(_0x4d4496,null))[_0x2f97('0x43')](handleError(_0x4d4496,null));};exports[_0x2f97('0x26')]=function(_0xb733e8,_0x456a33){return db[_0x2f97('0x2d')][_0x2f97('0x46')]({'where':{'id':_0xb733e8[_0x2f97('0x45')]['id']}})[_0x2f97('0x25')](handleEntityNotFound(_0x456a33,null))[_0x2f97('0x25')](removeEntity(_0x456a33,null))[_0x2f97('0x43')](handleError(_0x456a33,null));};exports[_0x2f97('0x49')]=function(_0x2f7631,_0x2701fc,_0x3b2e44){var _0xa79b8={};var _0x3c5310={};var _0x276343;var _0x3d7514;return db[_0x2f97('0x2d')]['findOne']({'where':{'id':_0x2f7631['params']['id']}})[_0x2f97('0x25')](handleEntityNotFound(_0x2701fc,null))[_0x2f97('0x25')](function(_0x1eb030){if(_0x1eb030){_0x276343=_0x1eb030;_0x3c5310[_0x2f97('0x30')]=_['keys'](db[_0x2f97('0x4a')][_0x2f97('0x4b')]);_0x3c5310[_0x2f97('0x34')]=_['keys'](_0x2f7631[_0x2f97('0x34')]);_0x3c5310[_0x2f97('0x32')]=_[_0x2f97('0x33')](_0x3c5310['model'],_0x3c5310['query']);_0xa79b8[_0x2f97('0x35')]=_[_0x2f97('0x33')](_0x3c5310['model'],qs[_0x2f97('0x36')](_0x2f7631[_0x2f97('0x34')]['fields']));_0xa79b8[_0x2f97('0x35')]=_0xa79b8[_0x2f97('0x35')][_0x2f97('0x37')]?_0xa79b8[_0x2f97('0x35')]:_0x3c5310[_0x2f97('0x30')];_0xa79b8[_0x2f97('0x4c')]=qs['sort'](_0x2f7631['query'][_0x2f97('0x39')]);_0xa79b8[_0x2f97('0x3a')]=qs[_0x2f97('0x32')](_[_0x2f97('0x4d')](_0x2f7631['query'],_0x3c5310['filters']));if(_0x2f7631[_0x2f97('0x34')][_0x2f97('0x3b')]){_0xa79b8[_0x2f97('0x3a')]=_[_0x2f97('0x3c')](_0xa79b8[_0x2f97('0x3a')],{'$or':_[_0x2f97('0x2c')](_0xa79b8[_0x2f97('0x35')],function(_0x44a6b2){var _0x14ed25={};_0x14ed25[_0x44a6b2]={'$like':'%'+_0x2f7631[_0x2f97('0x34')][_0x2f97('0x3b')]+'%'};return _0x14ed25;})});}_0xa79b8=_['merge']({},_0xa79b8,_0x2f7631[_0x2f97('0x3f')]);return _0x276343['getConfigurations'](_0xa79b8);}})[_0x2f97('0x25')](function(_0x4ffea1){if(_0x4ffea1){_0x3d7514=_0x4ffea1[_0x2f97('0x37')];if(!_0x2f7631[_0x2f97('0x34')]['hasOwnProperty'](_0x2f97('0x4e'))){_0xa79b8['limit']=qs[_0x2f97('0x1f')](_0x2f7631[_0x2f97('0x34')][_0x2f97('0x1f')]);_0xa79b8['offset']=qs[_0x2f97('0x1c')](_0x2f7631['query']['offset']);}return _0x276343[_0x2f97('0x49')](_0xa79b8);}})['then'](function(_0x3a3f58){if(_0x3a3f58){return _0x3a3f58?{'count':_0x3d7514,'rows':_0x3a3f58}:null;}})[_0x2f97('0x25')](respondWithResult(_0x2701fc,null))[_0x2f97('0x43')](handleError(_0x2701fc,null));};exports[_0x2f97('0x4f')]=function(_0x532ec4,_0x137907,_0x4737df){if(_0x532ec4[_0x2f97('0x48')]['id']){delete _0x532ec4[_0x2f97('0x48')]['id'];}return db[_0x2f97('0x2d')][_0x2f97('0x50')]({'where':{'id':_0x532ec4[_0x2f97('0x45')]['id']}})[_0x2f97('0x25')](handleEntityNotFound(_0x137907,null))[_0x2f97('0x25')](function(_0x1729c8){if(_0x1729c8){_0x532ec4['body'][_0x2f97('0x51')]=_0x1729c8['id'];_0x532ec4[_0x2f97('0x48')][_0x2f97('0x52')]=integrations[_0x2f97('0x53')](_0x532ec4[_0x2f97('0x48')][_0x2f97('0x54')],_0x532ec4['body'][_0x2f97('0x3d')]);_0x532ec4[_0x2f97('0x48')][_0x2f97('0x55')]=integrations[_0x2f97('0x56')](_0x532ec4['body'][_0x2f97('0x54')],_0x532ec4[_0x2f97('0x48')]['type']);return db[_0x2f97('0x4a')][_0x2f97('0x47')](_0x532ec4[_0x2f97('0x48')],{'include':[{'model':db['FreshsalesField'],'as':_0x2f97('0x52')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x2f97('0x25')](respondWithResult(_0x137907,null))[_0x2f97('0x43')](handleError(_0x137907,null));};exports['getFields']=function(_0x3ac28c,_0x2edbcf,_0x1a1601){var _0x31115f='';var _0x4021a3='';return db[_0x2f97('0x2d')]['findOne']({'where':{'id':_0x3ac28c[_0x2f97('0x45')]['id']},'attributes':['id',_0x2f97('0x57'),_0x2f97('0x58'),_0x2f97('0x59')]})[_0x2f97('0x25')](handleEntityNotFound(_0x2edbcf,null))['then'](function(_0x29b3d6){if(_0x29b3d6){_0x4021a3=_0x29b3d6[_0x2f97('0x57')];_0x31115f=_0x29b3d6[_0x2f97('0x58')];var _0x38da94=_0x29b3d6[_0x2f97('0x58')]['slice'](-0x1);if(_0x38da94==='/'){_0x31115f=_0x31115f[_0x2f97('0x5a')](0x0,_0x31115f[_0x2f97('0x5b')](_0x38da94));}return rp({'method':_0x2f97('0x5c'),'uri':util[_0x2f97('0x5d')](_0x2f97('0x5e'),_0x31115f,'/api/selector/owners'),'headers':{'Authorization':_0x2f97('0x5f')+_0x29b3d6[_0x2f97('0x59')]},'json':!![]});}})[_0x2f97('0x25')](function(_0x311cb2){if(_0x311cb2){var _0x37101b=_0x311cb2[_0x2f97('0x60')];var _0x10947c=![];var _0x49ebad=null;for(_0x49ebad=0x0;_0x49ebad<_0x37101b[_0x2f97('0x37')];_0x49ebad++){if(_0x37101b[_0x49ebad]['email']===_0x4021a3){_0x10947c=!![];}}if(_0x10947c){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x2edbcf,null))[_0x2f97('0x43')](function(_0x2ee017){var _0x5d8539=_0x3ac28c['query']['test']?0x1f4:_0x2ee017[_0x2f97('0x61')]||0x1f4;logger[_0x2f97('0x27')](_0x2f97('0x62'),_0x2f97('0x63'),_0x5d8539,JSON[_0x2f97('0x64')](_0x2ee017));delete _0x2ee017['name'];if(_0x5d8539===0x191){_0x5d8539=0x190;}_0x2edbcf[_0x2f97('0x20')](_0x5d8539)[_0x2f97('0x2a')](_0x3ac28c[_0x2f97('0x34')][_0x2f97('0x65')]?{'message':_0x2f97('0x66'),'statusCode':_0x2ee017[_0x2f97('0x61')]}:_0x2ee017);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 8456b3b..40d0601 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 _0x7880=['bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment'];(function(_0xa704b9,_0x3232a0){var _0xc2f29d=function(_0x254687){while(--_0x254687){_0xa704b9['push'](_0xa704b9['shift']());}};_0xc2f29d(++_0x3232a0);}(_0x7880,0x1f4));var _0x0788=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x7880[_0x34933a];return _0x36abb4;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));var integrations=require(_0x0788('0x9'));module[_0x0788('0xa')]=function(_0x775629,_0x3f9cb8){return _0x775629[_0x0788('0xb')](_0x0788('0xc'),attributes,{'tableName':_0x0788('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','FreshsalesAccount','int_freshsales_accounts','lodash'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x5496,0x175));var _0x6549=function(_0x561cbb,_0x2ccede){_0x561cbb=_0x561cbb-0x0;var _0x1e9363=_0x5496[_0x561cbb];return _0x1e9363;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index e808648..ee58806 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 _0x82c4=['findAll','options','raw','attributes','include','map','model','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x82c4,0x1ca));var _0x482c=function(_0x11a0b0,_0x13077c){_0x11a0b0=_0x11a0b0-0x0;var _0x1382e6=_0x82c4[_0x11a0b0];return _0x1382e6;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['FreshsalesAccount'][_0x482c('0x16')]({'raw':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['where']||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x19')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['limit']||null:null,'include':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x5b6f7e['options'][_0x482c('0x1a')],function(_0x579d2f){return{'model':db[_0x579d2f[_0x482c('0x1c')]],'as':_0x579d2f['as'],'attributes':_0x579d2f[_0x482c('0x19')],'include':_0x579d2f['include']?_[_0x482c('0x1b')](_0x579d2f['include'],function(_0x589bc6){return{'model':db[_0x589bc6[_0x482c('0x1c')]],'as':_0x589bc6['as'],'attributes':_0x589bc6[_0x482c('0x19')],'include':_0x589bc6[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x589bc6[_0x482c('0x1a')],function(_0x215826){return{'model':db[_0x215826[_0x482c('0x1c')]],'as':_0x215826['as'],'attributes':_0x215826['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0xa')](function(_0x255417){logger['info'](_0x482c('0x15'),_0x5b6f7e);logger['debug']('GetFreshsalesAccount',_0x5b6f7e,JSON[_0x482c('0xf')](_0x255417));_0x258148(_0x255417);})['catch'](function(_0x1ac1c4){logger[_0x482c('0x10')](_0x482c('0x15'),_0x1ac1c4[_0x482c('0x12')],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x1ac1c4[_0x482c('0x12')]));});});};exports[_0x482c('0x1d')]=function(_0x3e9b22){var _0x24b4df=this;return new Promise(function(_0x2d3800,_0x3135a7){return db[_0x482c('0x1e')][_0x482c('0x1f')]({'raw':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')]['where']||null:null,'attributes':_0x3e9b22['options']?_0x3e9b22['options'][_0x482c('0x19')]||null:null,'include':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x1a')]?_['map'](_0x3e9b22[_0x482c('0x17')]['include'],function(_0x31428c){return{'model':db[_0x31428c[_0x482c('0x1c')]],'as':_0x31428c['as'],'attributes':_0x31428c[_0x482c('0x19')],'include':_0x31428c[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x31428c[_0x482c('0x1a')],function(_0x129a31){return{'model':db[_0x129a31[_0x482c('0x1c')]],'as':_0x129a31['as'],'attributes':_0x129a31['attributes'],'include':_0x129a31['include']?_[_0x482c('0x1b')](_0x129a31['include'],function(_0xe62a02){return{'model':db[_0xe62a02[_0x482c('0x1c')]],'as':_0xe62a02['as'],'attributes':_0xe62a02[_0x482c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cbaa){logger[_0x482c('0xb')](_0x482c('0x1d'),_0x3e9b22);logger[_0x482c('0xe')]('ShowFreshsalesAccount',_0x3e9b22,JSON[_0x482c('0xf')](_0x29cbaa));_0x2d3800(_0x29cbaa);})['catch'](function(_0x1de7f4){logger['error'](_0x482c('0x1d'),_0x1de7f4['message'],_0x3e9b22);_0x3135a7(_0x24b4df[_0x482c('0x10')](0x1f4,_0x1de7f4[_0x482c('0x12')]));});});}; \ No newline at end of file +var _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','limit','include','map','model','ShowFreshsalesAccount','find','where'];(function(_0xdcb19c,_0x3f5a20){var _0x18f681=function(_0x25ddf7){while(--_0x25ddf7){_0xdcb19c['push'](_0xdcb19c['shift']());}};_0x18f681(++_0x3f5a20);}(_0xb44a,0x1c2));var _0xab44=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xb44a[_0x10df18];return _0x1f9a1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});}exports[_0xab44('0x12')]=function(_0x354b09){var _0x44fa43=this;return new Promise(function(_0x310b15,_0xc4b3dc){return db[_0xab44('0x13')]['findAll']({'raw':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')]['where']||null:null,'attributes':_0x354b09[_0xab44('0x14')]?_0x354b09['options'][_0xab44('0x16')]||null:null,'limit':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x17')]||null:null,'include':_0x354b09['options']?_0x354b09[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x354b09[_0xab44('0x14')][_0xab44('0x18')],function(_0x402950){return{'model':db[_0x402950[_0xab44('0x1a')]],'as':_0x402950['as'],'attributes':_0x402950['attributes'],'include':_0x402950['include']?_[_0xab44('0x19')](_0x402950['include'],function(_0x2439f3){return{'model':db[_0x2439f3['model']],'as':_0x2439f3['as'],'attributes':_0x2439f3[_0xab44('0x16')],'include':_0x2439f3['include']?_['map'](_0x2439f3[_0xab44('0x18')],function(_0x25287b){return{'model':db[_0x25287b[_0xab44('0x1a')]],'as':_0x25287b['as'],'attributes':_0x25287b[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x4e820c){logger[_0xab44('0x10')](_0xab44('0x12'),_0x354b09);logger['debug'](_0xab44('0x12'),_0x354b09,JSON[_0xab44('0xc')](_0x4e820c));_0x310b15(_0x4e820c);})[_0xab44('0x11')](function(_0x1cd486){logger[_0xab44('0xd')](_0xab44('0x12'),_0x1cd486['message'],_0x354b09);_0xc4b3dc(_0x44fa43[_0xab44('0xd')](0x1f4,_0x1cd486[_0xab44('0xf')]));});});};exports[_0xab44('0x1b')]=function(_0x47e1be){var _0x54cac8=this;return new Promise(function(_0x106d3a,_0x5082e4){return db['FreshsalesAccount'][_0xab44('0x1c')]({'raw':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x1d')]||null:null,'attributes':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x16')]||null:null,'include':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x47e1be['options']['include'],function(_0x27e318){return{'model':db[_0x27e318[_0xab44('0x1a')]],'as':_0x27e318['as'],'attributes':_0x27e318['attributes'],'include':_0x27e318[_0xab44('0x18')]?_[_0xab44('0x19')](_0x27e318[_0xab44('0x18')],function(_0x1e0be7){return{'model':db[_0x1e0be7[_0xab44('0x1a')]],'as':_0x1e0be7['as'],'attributes':_0x1e0be7[_0xab44('0x16')],'include':_0x1e0be7[_0xab44('0x18')]?_[_0xab44('0x19')](_0x1e0be7[_0xab44('0x18')],function(_0xe26f9f){return{'model':db[_0xe26f9f[_0xab44('0x1a')]],'as':_0xe26f9f['as'],'attributes':_0xe26f9f[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x532aad){logger[_0xab44('0x10')](_0xab44('0x1b'),_0x47e1be);logger[_0xab44('0xb')](_0xab44('0x1b'),_0x47e1be,JSON['stringify'](_0x532aad));_0x106d3a(_0x532aad);})[_0xab44('0x11')](function(_0x31b599){logger[_0xab44('0xd')](_0xab44('0x1b'),_0x31b599['message'],_0x47e1be);_0x5082e4(_0x54cac8[_0xab44('0xd')](0x1f4,_0x31b599[_0xab44('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 5406dc3..e3d8aca 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 _0xf674=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','index','/:id','isAuthenticated','get','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','put','update'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf674,0x75));var _0x4f67=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0xf674[_0x1057a3];return _0x131cdb;};'use strict';var multer=require(_0x4f67('0x0'));var util=require(_0x4f67('0x1'));var path=require(_0x4f67('0x2'));var timeout=require(_0x4f67('0x3'));var express=require(_0x4f67('0x4'));var router=express[_0x4f67('0x5')]();var fs_extra=require(_0x4f67('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4f67('0x7'));var config=require(_0x4f67('0x8'));var controller=require(_0x4f67('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4f67('0xa')]);router['get'](_0x4f67('0xb'),auth[_0x4f67('0xc')](),controller['show']);router[_0x4f67('0xd')](_0x4f67('0xe'),auth[_0x4f67('0xc')](),controller[_0x4f67('0xf')]);router[_0x4f67('0xd')](_0x4f67('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x4f67('0xd')](_0x4f67('0x11'),auth[_0x4f67('0xc')](),controller[_0x4f67('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4f67('0x13')](_0x4f67('0xb'),auth['isAuthenticated'](),controller[_0x4f67('0x14')]);router['delete']('/:id',auth[_0x4f67('0xc')](),controller[_0x4f67('0x15')]);module[_0x4f67('0x16')]=router; \ No newline at end of file +var _0xd193=['/:id/subjects','getDescriptions','/:id/fields','getFields','create','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','/:id','isAuthenticated'];(function(_0x3a6938,_0x51047d){var _0x49b2cd=function(_0x38fca7){while(--_0x38fca7){_0x3a6938['push'](_0x3a6938['shift']());}};_0x49b2cd(++_0x51047d);}(_0xd193,0x133));var _0x3d19=function(_0x10b840,_0x47cefb){_0x10b840=_0x10b840-0x0;var _0x1d4ca5=_0xd193[_0x10b840];return _0x1d4ca5;};'use strict';var multer=require(_0x3d19('0x0'));var util=require('util');var path=require(_0x3d19('0x1'));var timeout=require(_0x3d19('0x2'));var express=require(_0x3d19('0x3'));var router=express[_0x3d19('0x4')]();var fs_extra=require(_0x3d19('0x5'));var auth=require(_0x3d19('0x6'));var interaction=require(_0x3d19('0x7'));var config=require(_0x3d19('0x8'));var controller=require(_0x3d19('0x9'));router[_0x3d19('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3d19('0xa')](_0x3d19('0xb'),auth[_0x3d19('0xc')](),controller['show']);router['get'](_0x3d19('0xd'),auth[_0x3d19('0xc')](),controller['getSubjects']);router[_0x3d19('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x3d19('0xe')]);router[_0x3d19('0xa')](_0x3d19('0xf'),auth['isAuthenticated'](),controller[_0x3d19('0x10')]);router['post']('/',auth[_0x3d19('0xc')](),controller[_0x3d19('0x11')]);router['put'](_0x3d19('0xb'),auth[_0x3d19('0xc')](),controller[_0x3d19('0x12')]);router[_0x3d19('0x13')](_0x3d19('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index d20202c..c894647 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 _0xad27=['exports','STRING','sequelize'];(function(_0x341a01,_0x5dbc7d){var _0x2c0865=function(_0x4d5aeb){while(--_0x4d5aeb){_0x341a01['push'](_0x341a01['shift']());}};_0x2c0865(++_0x5dbc7d);}(_0xad27,0x6b));var _0x7ad2=function(_0x46dc44,_0x3afb52){_0x46dc44=_0x46dc44-0x0;var _0x28e52b=_0xad27[_0x46dc44];return _0x28e52b;};'use strict';var Sequelize=require(_0x7ad2('0x0'));module[_0x7ad2('0x1')]={'name':{'type':Sequelize[_0x7ad2('0x2')]},'description':{'type':Sequelize[_0x7ad2('0x2')]}}; \ No newline at end of file +var _0xf19e=['STRING','sequelize','exports'];(function(_0x342046,_0x8aceed){var _0x422c32=function(_0x28dc0e){while(--_0x28dc0e){_0x342046['push'](_0x342046['shift']());}};_0x422c32(++_0x8aceed);}(_0xf19e,0x145));var _0xef19=function(_0x1936ea,_0x27029e){_0x1936ea=_0x1936ea-0x0;var _0x4f32af=_0xf19e[_0x1936ea];return _0x4f32af;};'use strict';var Sequelize=require(_0xef19('0x0'));module[_0xef19('0x1')]={'name':{'type':Sequelize[_0xef19('0x2')]},'description':{'type':Sequelize[_0xef19('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b19307c..ec25d04 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 _0x4718=['type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','FreshsalesConfiguration','includeAll','findAll','rows','catch','params','include','options','find','create','body','findOne','FreshsalesField','getSubjects','hasOwnProperty','getDescriptions','nolimit','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes'];(function(_0x24e8ae,_0x558fa8){var _0x4473a5=function(_0x4f6895){while(--_0x4f6895){_0x24e8ae['push'](_0x24e8ae['shift']());}};_0x4473a5(++_0x558fa8);}(_0x4718,0x70));var _0x8471=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x4718[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x8471('0x0'));var rimraf=require(_0x8471('0x1'));var zipdir=require(_0x8471('0x2'));var jsonpatch=require(_0x8471('0x3'));var rp=require('request-promise');var moment=require(_0x8471('0x4'));var BPromise=require(_0x8471('0x5'));var Mustache=require(_0x8471('0x6'));var util=require(_0x8471('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8471('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8471('0x9'));var squel=require(_0x8471('0xa'));var crypto=require('crypto');var jsforce=require(_0x8471('0xb'));var deskjs=require(_0x8471('0xc'));var toCsv=require(_0x8471('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8471('0xe'));var authService=require(_0x8471('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8471('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8471('0x11'))(_0x8471('0x12'));var utils=require('../../config/utils');var config=require(_0x8471('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x8471('0x14'))['db'];function respondWithStatusCode(_0x5df061,_0x1a5264){_0x1a5264=_0x1a5264||0xcc;return function(_0x25cf44){if(_0x25cf44){return _0x5df061[_0x8471('0x15')](_0x1a5264);}return _0x5df061[_0x8471('0x16')](_0x1a5264)[_0x8471('0x17')]();};}function respondWithResult(_0x5148db,_0x491ca0){_0x491ca0=_0x491ca0||0xc8;return function(_0x437062){if(_0x437062){return _0x5148db[_0x8471('0x16')](_0x491ca0)['json'](_0x437062);}};}function respondWithFilteredResult(_0x5c33d8,_0x235898){return function(_0xe74991){if(_0xe74991){var _0x5b83ab=typeof _0x235898['offset']===_0x8471('0x18')&&typeof _0x235898['limit']===_0x8471('0x18');var _0x1573ea=_0xe74991[_0x8471('0x19')];var _0x767122=_0x5b83ab?0x0:_0x235898[_0x8471('0x1a')];var _0x2c3442=_0x5b83ab?_0xe74991[_0x8471('0x19')]:_0x235898[_0x8471('0x1a')]+_0x235898[_0x8471('0x1b')];var _0x55798e;if(_0x2c3442>=_0x1573ea){_0x2c3442=_0x1573ea;_0x55798e=0xc8;}else{_0x55798e=0xce;}_0x5c33d8[_0x8471('0x16')](_0x55798e);return _0x5c33d8[_0x8471('0x1c')](_0x8471('0x1d'),_0x767122+'-'+_0x2c3442+'/'+_0x1573ea)[_0x8471('0x1e')](_0xe74991);}return null;};}function patchUpdates(_0x978dfd){return function(_0x50e20c){try{jsonpatch[_0x8471('0x1f')](_0x50e20c,_0x978dfd,!![]);}catch(_0x129508){return BPromise[_0x8471('0x20')](_0x129508);}return _0x50e20c[_0x8471('0x21')]();};}function saveUpdates(_0x871db7,_0x13cb8e){return function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x8471('0x22')](_0x871db7)[_0x8471('0x23')](function(_0x2348d0){return _0x2348d0;});}return null;};}function removeEntity(_0x3c0c07,_0xc4d6b0){return function(_0x5d9f18){if(_0x5d9f18){return _0x5d9f18[_0x8471('0x24')]()[_0x8471('0x23')](function(){_0x3c0c07[_0x8471('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f365,_0x364622){return function(_0x1d4e76){if(!_0x1d4e76){_0x13f365[_0x8471('0x15')](0x194);}return _0x1d4e76;};}function handleError(_0x49605a,_0x2c1a99){_0x2c1a99=_0x2c1a99||0x1f4;return function(_0x13b676){logger[_0x8471('0x25')](_0x13b676[_0x8471('0x26')]);if(_0x13b676[_0x8471('0x27')]){delete _0x13b676[_0x8471('0x27')];}_0x49605a[_0x8471('0x16')](_0x2c1a99)[_0x8471('0x28')](_0x13b676);};}exports[_0x8471('0x29')]=function(_0x45bb85,_0x43d629){var _0x22a790={},_0x247ed8={},_0x29d13f={'count':0x0,'rows':[]};var _0x40ae02=_[_0x8471('0x2a')](db['FreshsalesConfiguration'][_0x8471('0x2b')],function(_0x2398f1){return{'name':_0x2398f1['fieldName'],'type':_0x2398f1[_0x8471('0x2c')][_0x8471('0x2d')]};});_0x247ed8[_0x8471('0x2e')]=_[_0x8471('0x2a')](_0x40ae02,_0x8471('0x27'));_0x247ed8[_0x8471('0x2f')]=_[_0x8471('0x30')](_0x45bb85[_0x8471('0x2f')]);_0x247ed8[_0x8471('0x31')]=_[_0x8471('0x32')](_0x247ed8[_0x8471('0x2e')],_0x247ed8['query']);_0x22a790[_0x8471('0x33')]=_[_0x8471('0x32')](_0x247ed8[_0x8471('0x2e')],qs['fields'](_0x45bb85[_0x8471('0x2f')][_0x8471('0x34')]));_0x22a790['attributes']=_0x22a790['attributes'][_0x8471('0x35')]?_0x22a790[_0x8471('0x33')]:_0x247ed8[_0x8471('0x2e')];if(!_0x45bb85[_0x8471('0x2f')]['hasOwnProperty']('nolimit')){_0x22a790[_0x8471('0x1b')]=qs[_0x8471('0x1b')](_0x45bb85[_0x8471('0x2f')][_0x8471('0x1b')]);_0x22a790[_0x8471('0x1a')]=qs[_0x8471('0x1a')](_0x45bb85['query'][_0x8471('0x1a')]);}_0x22a790[_0x8471('0x36')]=qs[_0x8471('0x37')](_0x45bb85[_0x8471('0x2f')]['sort']);_0x22a790[_0x8471('0x38')]=qs[_0x8471('0x31')](_[_0x8471('0x39')](_0x45bb85[_0x8471('0x2f')],_0x247ed8[_0x8471('0x31')]),_0x40ae02);if(_0x45bb85[_0x8471('0x2f')][_0x8471('0x3a')]){_0x22a790[_0x8471('0x38')]=_[_0x8471('0x3b')](_0x22a790[_0x8471('0x38')],{'$or':_[_0x8471('0x2a')](_0x40ae02,function(_0x2e28e3){if(_0x2e28e3[_0x8471('0x2c')]!=='VIRTUAL'){var _0x256c42={};_0x256c42[_0x2e28e3[_0x8471('0x27')]]={'$like':'%'+_0x45bb85[_0x8471('0x2f')]['filter']+'%'};return _0x256c42;}})});}_0x22a790=_[_0x8471('0x3b')]({},_0x22a790,_0x45bb85['options']);var _0xf93499={'where':_0x22a790[_0x8471('0x38')]};return db[_0x8471('0x3c')]['count'](_0xf93499)[_0x8471('0x23')](function(_0x4f8dd1){_0x29d13f[_0x8471('0x19')]=_0x4f8dd1;if(_0x45bb85[_0x8471('0x2f')][_0x8471('0x3d')]){_0x22a790['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x8471('0x3e')](_0x22a790);})[_0x8471('0x23')](function(_0x19b623){_0x29d13f[_0x8471('0x3f')]=_0x19b623;return _0x29d13f;})[_0x8471('0x23')](respondWithFilteredResult(_0x43d629,_0x22a790))[_0x8471('0x40')](handleError(_0x43d629,null));};exports['show']=function(_0x322f88,_0x4862bc){var _0x1233eb={'raw':![],'where':{'id':_0x322f88[_0x8471('0x41')]['id']}},_0x1b935b={};_0x1b935b['model']=_[_0x8471('0x30')](db['FreshsalesConfiguration']['rawAttributes']);_0x1b935b[_0x8471('0x2f')]=_[_0x8471('0x30')](_0x322f88[_0x8471('0x2f')]);_0x1b935b['filters']=_[_0x8471('0x32')](_0x1b935b[_0x8471('0x2e')],_0x1b935b[_0x8471('0x2f')]);_0x1233eb[_0x8471('0x33')]=_['intersection'](_0x1b935b[_0x8471('0x2e')],qs[_0x8471('0x34')](_0x322f88['query'][_0x8471('0x34')]));_0x1233eb[_0x8471('0x33')]=_0x1233eb[_0x8471('0x33')][_0x8471('0x35')]?_0x1233eb[_0x8471('0x33')]:_0x1b935b['model'];if(_0x322f88[_0x8471('0x2f')][_0x8471('0x3d')]){_0x1233eb[_0x8471('0x42')]=[{'all':!![]}];}_0x1233eb=_[_0x8471('0x3b')]({},_0x1233eb,_0x322f88[_0x8471('0x43')]);return db['FreshsalesConfiguration'][_0x8471('0x44')](_0x1233eb)[_0x8471('0x23')](handleEntityNotFound(_0x4862bc,null))[_0x8471('0x23')](respondWithResult(_0x4862bc,null))[_0x8471('0x40')](handleError(_0x4862bc,null));};exports[_0x8471('0x45')]=function(_0x50456d,_0xb662dd){return db['FreshsalesConfiguration'][_0x8471('0x45')](_0x50456d[_0x8471('0x46')],{})[_0x8471('0x23')](respondWithResult(_0xb662dd,0xc9))[_0x8471('0x40')](handleError(_0xb662dd,null));};exports['update']=function(_0x5983c6,_0x3f19d6){if(_0x5983c6[_0x8471('0x46')]['id']){delete _0x5983c6[_0x8471('0x46')]['id'];}return db[_0x8471('0x3c')][_0x8471('0x44')]({'where':{'id':_0x5983c6[_0x8471('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f19d6,null))[_0x8471('0x23')](saveUpdates(_0x5983c6[_0x8471('0x46')],null))[_0x8471('0x23')](respondWithResult(_0x3f19d6,null))['catch'](handleError(_0x3f19d6,null));};exports['destroy']=function(_0x47ae7c,_0x5ad159){return db[_0x8471('0x3c')][_0x8471('0x44')]({'where':{'id':_0x47ae7c[_0x8471('0x41')]['id']}})[_0x8471('0x23')](handleEntityNotFound(_0x5ad159,null))[_0x8471('0x23')](removeEntity(_0x5ad159,null))[_0x8471('0x40')](handleError(_0x5ad159,null));};exports['getSubjects']=function(_0x23178b,_0x28c9d4,_0x44aa69){var _0x51e119={};var _0x21324d={};var _0x34a9ee;var _0x3f213f;return db[_0x8471('0x3c')][_0x8471('0x47')]({'where':{'id':_0x23178b[_0x8471('0x41')]['id']}})['then'](handleEntityNotFound(_0x28c9d4,null))[_0x8471('0x23')](function(_0x31a2fe){if(_0x31a2fe){_0x34a9ee=_0x31a2fe;_0x21324d[_0x8471('0x2e')]=_[_0x8471('0x30')](db[_0x8471('0x48')][_0x8471('0x2b')]);_0x21324d[_0x8471('0x2f')]=_[_0x8471('0x30')](_0x23178b['query']);_0x21324d['filters']=_[_0x8471('0x32')](_0x21324d[_0x8471('0x2e')],_0x21324d[_0x8471('0x2f')]);_0x51e119[_0x8471('0x33')]=_['intersection'](_0x21324d[_0x8471('0x2e')],qs[_0x8471('0x34')](_0x23178b[_0x8471('0x2f')][_0x8471('0x34')]));_0x51e119[_0x8471('0x33')]=_0x51e119[_0x8471('0x33')][_0x8471('0x35')]?_0x51e119[_0x8471('0x33')]:_0x21324d[_0x8471('0x2e')];_0x51e119[_0x8471('0x36')]=qs[_0x8471('0x37')](_0x23178b['query'][_0x8471('0x37')]);_0x51e119[_0x8471('0x38')]=qs['filters'](_[_0x8471('0x39')](_0x23178b[_0x8471('0x2f')],_0x21324d[_0x8471('0x31')]));if(_0x23178b[_0x8471('0x2f')][_0x8471('0x3a')]){_0x51e119[_0x8471('0x38')]=_['merge'](_0x51e119[_0x8471('0x38')],{'$or':_[_0x8471('0x2a')](_0x51e119['attributes'],function(_0x5827ce){var _0x1cc3c5={};_0x1cc3c5[_0x5827ce]={'$like':'%'+_0x23178b[_0x8471('0x2f')][_0x8471('0x3a')]+'%'};return _0x1cc3c5;})});}_0x51e119=_[_0x8471('0x3b')]({},_0x51e119,_0x23178b[_0x8471('0x43')]);return _0x34a9ee[_0x8471('0x49')](_0x51e119);}})['then'](function(_0x15c288){if(_0x15c288){_0x3f213f=_0x15c288[_0x8471('0x35')];if(!_0x23178b['query'][_0x8471('0x4a')]('nolimit')){_0x51e119[_0x8471('0x1b')]=qs[_0x8471('0x1b')](_0x23178b[_0x8471('0x2f')]['limit']);_0x51e119[_0x8471('0x1a')]=qs[_0x8471('0x1a')](_0x23178b[_0x8471('0x2f')][_0x8471('0x1a')]);}return _0x34a9ee['getSubjects'](_0x51e119);}})['then'](function(_0x5020db){if(_0x5020db){return _0x5020db?{'count':_0x3f213f,'rows':_0x5020db}:null;}})[_0x8471('0x23')](respondWithResult(_0x28c9d4,null))[_0x8471('0x40')](handleError(_0x28c9d4,null));};exports['getDescriptions']=function(_0x26954d,_0x21fc16,_0x5d86f3){var _0x12dc8f={};var _0x5b9b3f={};var _0x2ff000;var _0x2731fa;return db['FreshsalesConfiguration'][_0x8471('0x47')]({'where':{'id':_0x26954d['params']['id']}})['then'](handleEntityNotFound(_0x21fc16,null))[_0x8471('0x23')](function(_0x59089a){if(_0x59089a){_0x2ff000=_0x59089a;_0x5b9b3f['model']=_['keys'](db['FreshsalesField']['rawAttributes']);_0x5b9b3f[_0x8471('0x2f')]=_['keys'](_0x26954d[_0x8471('0x2f')]);_0x5b9b3f[_0x8471('0x31')]=_[_0x8471('0x32')](_0x5b9b3f[_0x8471('0x2e')],_0x5b9b3f[_0x8471('0x2f')]);_0x12dc8f[_0x8471('0x33')]=_[_0x8471('0x32')](_0x5b9b3f['model'],qs[_0x8471('0x34')](_0x26954d['query'][_0x8471('0x34')]));_0x12dc8f[_0x8471('0x33')]=_0x12dc8f[_0x8471('0x33')][_0x8471('0x35')]?_0x12dc8f[_0x8471('0x33')]:_0x5b9b3f[_0x8471('0x2e')];_0x12dc8f['order']=qs[_0x8471('0x37')](_0x26954d['query']['sort']);_0x12dc8f['where']=qs[_0x8471('0x31')](_[_0x8471('0x39')](_0x26954d[_0x8471('0x2f')],_0x5b9b3f[_0x8471('0x31')]));if(_0x26954d['query'][_0x8471('0x3a')]){_0x12dc8f[_0x8471('0x38')]=_[_0x8471('0x3b')](_0x12dc8f['where'],{'$or':_['map'](_0x12dc8f['attributes'],function(_0x326bc2){var _0x14a23d={};_0x14a23d[_0x326bc2]={'$like':'%'+_0x26954d[_0x8471('0x2f')][_0x8471('0x3a')]+'%'};return _0x14a23d;})});}_0x12dc8f=_[_0x8471('0x3b')]({},_0x12dc8f,_0x26954d[_0x8471('0x43')]);return _0x2ff000[_0x8471('0x4b')](_0x12dc8f);}})[_0x8471('0x23')](function(_0x367c41){if(_0x367c41){_0x2731fa=_0x367c41['length'];if(!_0x26954d[_0x8471('0x2f')][_0x8471('0x4a')](_0x8471('0x4c'))){_0x12dc8f[_0x8471('0x1b')]=qs[_0x8471('0x1b')](_0x26954d['query'][_0x8471('0x1b')]);_0x12dc8f[_0x8471('0x1a')]=qs['offset'](_0x26954d['query'][_0x8471('0x1a')]);}return _0x2ff000[_0x8471('0x4b')](_0x12dc8f);}})[_0x8471('0x23')](function(_0x2df405){if(_0x2df405){return _0x2df405?{'count':_0x2731fa,'rows':_0x2df405}:null;}})['then'](respondWithResult(_0x21fc16,null))[_0x8471('0x40')](handleError(_0x21fc16,null));};exports[_0x8471('0x4d')]=function(_0x123872,_0x66fe40,_0x3dd2c1){var _0x554b04={};var _0x7813ca={};var _0x451a6b;var _0x4d8c9c;return db[_0x8471('0x3c')][_0x8471('0x47')]({'where':{'id':_0x123872[_0x8471('0x41')]['id']}})[_0x8471('0x23')](handleEntityNotFound(_0x66fe40,null))['then'](function(_0x373887){if(_0x373887){_0x451a6b=_0x373887;_0x7813ca[_0x8471('0x2e')]=_['keys'](db[_0x8471('0x48')]['rawAttributes']);_0x7813ca[_0x8471('0x2f')]=_['keys'](_0x123872['query']);_0x7813ca[_0x8471('0x31')]=_[_0x8471('0x32')](_0x7813ca[_0x8471('0x2e')],_0x7813ca['query']);_0x554b04['attributes']=_[_0x8471('0x32')](_0x7813ca[_0x8471('0x2e')],qs[_0x8471('0x34')](_0x123872[_0x8471('0x2f')]['fields']));_0x554b04[_0x8471('0x33')]=_0x554b04[_0x8471('0x33')][_0x8471('0x35')]?_0x554b04['attributes']:_0x7813ca[_0x8471('0x2e')];_0x554b04[_0x8471('0x36')]=qs[_0x8471('0x37')](_0x123872[_0x8471('0x2f')][_0x8471('0x37')]);_0x554b04['where']=qs[_0x8471('0x31')](_[_0x8471('0x39')](_0x123872['query'],_0x7813ca['filters']));if(_0x123872['query']['filter']){_0x554b04[_0x8471('0x38')]=_[_0x8471('0x3b')](_0x554b04[_0x8471('0x38')],{'$or':_[_0x8471('0x2a')](_0x554b04[_0x8471('0x33')],function(_0x3f8d1a){var _0x5d10ec={};_0x5d10ec[_0x3f8d1a]={'$like':'%'+_0x123872['query'][_0x8471('0x3a')]+'%'};return _0x5d10ec;})});}_0x554b04=_[_0x8471('0x3b')]({},_0x554b04,_0x123872[_0x8471('0x43')]);return _0x451a6b[_0x8471('0x4d')](_0x554b04);}})[_0x8471('0x23')](function(_0x436c68){if(_0x436c68){_0x4d8c9c=_0x436c68[_0x8471('0x35')];if(!_0x123872[_0x8471('0x2f')]['hasOwnProperty'](_0x8471('0x4c'))){_0x554b04[_0x8471('0x1b')]=qs[_0x8471('0x1b')](_0x123872[_0x8471('0x2f')][_0x8471('0x1b')]);_0x554b04[_0x8471('0x1a')]=qs[_0x8471('0x1a')](_0x123872[_0x8471('0x2f')]['offset']);}return _0x451a6b[_0x8471('0x4d')](_0x554b04);}})[_0x8471('0x23')](function(_0x3979a1){if(_0x3979a1){return _0x3979a1?{'count':_0x4d8c9c,'rows':_0x3979a1}:null;}})[_0x8471('0x23')](respondWithResult(_0x66fe40,null))['catch'](handleError(_0x66fe40,null));}; \ No newline at end of file +var _0x3776=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','FreshsalesConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','include','findAll','rows','show','params','includeAll','catch','create','body','find','getSubjects','findOne','FreshsalesField','map','getDescriptions','pick','getFields','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv'];(function(_0x49f30e,_0xf28439){var _0x2cafd5=function(_0x581d4c){while(--_0x581d4c){_0x49f30e['push'](_0x49f30e['shift']());}};_0x2cafd5(++_0xf28439);}(_0x3776,0x1ae));var _0x6377=function(_0xafceaf,_0x5c65ad){_0xafceaf=_0xafceaf-0x0;var _0x3684e4=_0x3776[_0xafceaf];return _0x3684e4;};'use strict';var emlformat=require(_0x6377('0x0'));var rimraf=require(_0x6377('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6377('0x2'));var rp=require(_0x6377('0x3'));var moment=require('moment');var BPromise=require(_0x6377('0x4'));var Mustache=require(_0x6377('0x5'));var util=require('util');var path=require(_0x6377('0x6'));var sox=require(_0x6377('0x7'));var csv=require('to-csv');var ejs=require(_0x6377('0x8'));var fs=require('fs');var fs_extra=require(_0x6377('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6377('0xa'));var jsforce=require(_0x6377('0xb'));var deskjs=require(_0x6377('0xc'));var toCsv=require(_0x6377('0xd'));var querystring=require(_0x6377('0xe'));var Papa=require(_0x6377('0xf'));var Redis=require(_0x6377('0x10'));var authService=require(_0x6377('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6377('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6377('0x13'));var licenseUtil=require(_0x6377('0x14'));var db=require(_0x6377('0x15'))['db'];function respondWithStatusCode(_0x154ac5,_0x510a8b){_0x510a8b=_0x510a8b||0xcc;return function(_0x50e425){if(_0x50e425){return _0x154ac5[_0x6377('0x16')](_0x510a8b);}return _0x154ac5[_0x6377('0x17')](_0x510a8b)[_0x6377('0x18')]();};}function respondWithResult(_0x3eaae8,_0x1f1663){_0x1f1663=_0x1f1663||0xc8;return function(_0x4c277e){if(_0x4c277e){return _0x3eaae8[_0x6377('0x17')](_0x1f1663)['json'](_0x4c277e);}};}function respondWithFilteredResult(_0x5bacee,_0x43c92d){return function(_0x21f9fa){if(_0x21f9fa){var _0x2ecd9d=typeof _0x43c92d[_0x6377('0x19')]===_0x6377('0x1a')&&typeof _0x43c92d[_0x6377('0x1b')]===_0x6377('0x1a');var _0x39ad93=_0x21f9fa[_0x6377('0x1c')];var _0x50ae8d=_0x2ecd9d?0x0:_0x43c92d[_0x6377('0x19')];var _0xd9d10a=_0x2ecd9d?_0x21f9fa[_0x6377('0x1c')]:_0x43c92d[_0x6377('0x19')]+_0x43c92d[_0x6377('0x1b')];var _0x10aed6;if(_0xd9d10a>=_0x39ad93){_0xd9d10a=_0x39ad93;_0x10aed6=0xc8;}else{_0x10aed6=0xce;}_0x5bacee[_0x6377('0x17')](_0x10aed6);return _0x5bacee[_0x6377('0x1d')](_0x6377('0x1e'),_0x50ae8d+'-'+_0xd9d10a+'/'+_0x39ad93)['json'](_0x21f9fa);}return null;};}function patchUpdates(_0x44dd8b){return function(_0x14d389){try{jsonpatch['apply'](_0x14d389,_0x44dd8b,!![]);}catch(_0x4b86de){return BPromise['reject'](_0x4b86de);}return _0x14d389['save']();};}function saveUpdates(_0x2c26d7,_0x4aba1a){return function(_0x175113){if(_0x175113){return _0x175113[_0x6377('0x1f')](_0x2c26d7)[_0x6377('0x20')](function(_0x1bcfca){return _0x1bcfca;});}return null;};}function removeEntity(_0xaf598,_0xc348ff){return function(_0x24ab8a){if(_0x24ab8a){return _0x24ab8a[_0x6377('0x21')]()['then'](function(){_0xaf598['status'](0xcc)[_0x6377('0x18')]();});}};}function handleEntityNotFound(_0x14937d,_0x1677e1){return function(_0x3ab0b7){if(!_0x3ab0b7){_0x14937d[_0x6377('0x16')](0x194);}return _0x3ab0b7;};}function handleError(_0x4e5bfa,_0x5322c9){_0x5322c9=_0x5322c9||0x1f4;return function(_0x11d01a){logger[_0x6377('0x22')](_0x11d01a[_0x6377('0x23')]);if(_0x11d01a[_0x6377('0x24')]){delete _0x11d01a[_0x6377('0x24')];}_0x4e5bfa[_0x6377('0x17')](_0x5322c9)['send'](_0x11d01a);};}exports['index']=function(_0x5e8baf,_0x113bd0){var _0x272f01={},_0x574d55={},_0x340bc6={'count':0x0,'rows':[]};var _0x2a7bbb=_['map'](db[_0x6377('0x25')][_0x6377('0x26')],function(_0x4cc131){return{'name':_0x4cc131[_0x6377('0x27')],'type':_0x4cc131[_0x6377('0x28')]['key']};});_0x574d55['model']=_['map'](_0x2a7bbb,_0x6377('0x24'));_0x574d55[_0x6377('0x29')]=_[_0x6377('0x2a')](_0x5e8baf[_0x6377('0x29')]);_0x574d55[_0x6377('0x2b')]=_[_0x6377('0x2c')](_0x574d55[_0x6377('0x2d')],_0x574d55[_0x6377('0x29')]);_0x272f01['attributes']=_[_0x6377('0x2c')](_0x574d55[_0x6377('0x2d')],qs[_0x6377('0x2e')](_0x5e8baf[_0x6377('0x29')][_0x6377('0x2e')]));_0x272f01[_0x6377('0x2f')]=_0x272f01[_0x6377('0x2f')][_0x6377('0x30')]?_0x272f01[_0x6377('0x2f')]:_0x574d55[_0x6377('0x2d')];if(!_0x5e8baf[_0x6377('0x29')][_0x6377('0x31')](_0x6377('0x32'))){_0x272f01[_0x6377('0x1b')]=qs[_0x6377('0x1b')](_0x5e8baf[_0x6377('0x29')]['limit']);_0x272f01['offset']=qs[_0x6377('0x19')](_0x5e8baf[_0x6377('0x29')][_0x6377('0x19')]);}_0x272f01[_0x6377('0x33')]=qs[_0x6377('0x34')](_0x5e8baf[_0x6377('0x29')][_0x6377('0x34')]);_0x272f01[_0x6377('0x35')]=qs[_0x6377('0x2b')](_['pick'](_0x5e8baf[_0x6377('0x29')],_0x574d55[_0x6377('0x2b')]),_0x2a7bbb);if(_0x5e8baf[_0x6377('0x29')]['filter']){_0x272f01[_0x6377('0x35')]=_[_0x6377('0x36')](_0x272f01['where'],{'$or':_['map'](_0x2a7bbb,function(_0x1019c4){if(_0x1019c4['type']!=='VIRTUAL'){var _0x8aeae9={};_0x8aeae9[_0x1019c4['name']]={'$like':'%'+_0x5e8baf[_0x6377('0x29')][_0x6377('0x37')]+'%'};return _0x8aeae9;}})});}_0x272f01=_[_0x6377('0x36')]({},_0x272f01,_0x5e8baf[_0x6377('0x38')]);var _0x15280d={'where':_0x272f01[_0x6377('0x35')]};return db[_0x6377('0x25')][_0x6377('0x1c')](_0x15280d)[_0x6377('0x20')](function(_0x405e70){_0x340bc6[_0x6377('0x1c')]=_0x405e70;if(_0x5e8baf[_0x6377('0x29')]['includeAll']){_0x272f01[_0x6377('0x39')]=[{'all':!![]}];}return db[_0x6377('0x25')][_0x6377('0x3a')](_0x272f01);})[_0x6377('0x20')](function(_0x468f8d){_0x340bc6[_0x6377('0x3b')]=_0x468f8d;return _0x340bc6;})['then'](respondWithFilteredResult(_0x113bd0,_0x272f01))['catch'](handleError(_0x113bd0,null));};exports[_0x6377('0x3c')]=function(_0x434ddd,_0x635dd1){var _0x24c238={'raw':![],'where':{'id':_0x434ddd[_0x6377('0x3d')]['id']}},_0x31eee4={};_0x31eee4['model']=_['keys'](db[_0x6377('0x25')][_0x6377('0x26')]);_0x31eee4[_0x6377('0x29')]=_[_0x6377('0x2a')](_0x434ddd[_0x6377('0x29')]);_0x31eee4[_0x6377('0x2b')]=_[_0x6377('0x2c')](_0x31eee4[_0x6377('0x2d')],_0x31eee4['query']);_0x24c238['attributes']=_['intersection'](_0x31eee4[_0x6377('0x2d')],qs[_0x6377('0x2e')](_0x434ddd[_0x6377('0x29')]['fields']));_0x24c238[_0x6377('0x2f')]=_0x24c238[_0x6377('0x2f')][_0x6377('0x30')]?_0x24c238[_0x6377('0x2f')]:_0x31eee4['model'];if(_0x434ddd[_0x6377('0x29')][_0x6377('0x3e')]){_0x24c238[_0x6377('0x39')]=[{'all':!![]}];}_0x24c238=_[_0x6377('0x36')]({},_0x24c238,_0x434ddd['options']);return db['FreshsalesConfiguration']['find'](_0x24c238)[_0x6377('0x20')](handleEntityNotFound(_0x635dd1,null))[_0x6377('0x20')](respondWithResult(_0x635dd1,null))[_0x6377('0x3f')](handleError(_0x635dd1,null));};exports['create']=function(_0x406445,_0x59b222){return db['FreshsalesConfiguration'][_0x6377('0x40')](_0x406445[_0x6377('0x41')],{})[_0x6377('0x20')](respondWithResult(_0x59b222,0xc9))[_0x6377('0x3f')](handleError(_0x59b222,null));};exports['update']=function(_0x431f7c,_0x4dabc7){if(_0x431f7c['body']['id']){delete _0x431f7c[_0x6377('0x41')]['id'];}return db[_0x6377('0x25')][_0x6377('0x42')]({'where':{'id':_0x431f7c['params']['id']}})['then'](handleEntityNotFound(_0x4dabc7,null))['then'](saveUpdates(_0x431f7c['body'],null))[_0x6377('0x20')](respondWithResult(_0x4dabc7,null))[_0x6377('0x3f')](handleError(_0x4dabc7,null));};exports[_0x6377('0x21')]=function(_0x4e24ba,_0x1734e1){return db[_0x6377('0x25')][_0x6377('0x42')]({'where':{'id':_0x4e24ba[_0x6377('0x3d')]['id']}})[_0x6377('0x20')](handleEntityNotFound(_0x1734e1,null))['then'](removeEntity(_0x1734e1,null))[_0x6377('0x3f')](handleError(_0x1734e1,null));};exports[_0x6377('0x43')]=function(_0x4d7374,_0x589079,_0x2bff53){var _0x4e12ee={};var _0x59cb1c={};var _0x5b082f;var _0x99fbc;return db[_0x6377('0x25')][_0x6377('0x44')]({'where':{'id':_0x4d7374[_0x6377('0x3d')]['id']}})[_0x6377('0x20')](handleEntityNotFound(_0x589079,null))['then'](function(_0x231b8f){if(_0x231b8f){_0x5b082f=_0x231b8f;_0x59cb1c[_0x6377('0x2d')]=_[_0x6377('0x2a')](db[_0x6377('0x45')][_0x6377('0x26')]);_0x59cb1c[_0x6377('0x29')]=_[_0x6377('0x2a')](_0x4d7374[_0x6377('0x29')]);_0x59cb1c[_0x6377('0x2b')]=_[_0x6377('0x2c')](_0x59cb1c['model'],_0x59cb1c['query']);_0x4e12ee[_0x6377('0x2f')]=_['intersection'](_0x59cb1c['model'],qs[_0x6377('0x2e')](_0x4d7374[_0x6377('0x29')][_0x6377('0x2e')]));_0x4e12ee[_0x6377('0x2f')]=_0x4e12ee[_0x6377('0x2f')][_0x6377('0x30')]?_0x4e12ee[_0x6377('0x2f')]:_0x59cb1c[_0x6377('0x2d')];_0x4e12ee[_0x6377('0x33')]=qs[_0x6377('0x34')](_0x4d7374[_0x6377('0x29')][_0x6377('0x34')]);_0x4e12ee[_0x6377('0x35')]=qs[_0x6377('0x2b')](_['pick'](_0x4d7374[_0x6377('0x29')],_0x59cb1c[_0x6377('0x2b')]));if(_0x4d7374['query']['filter']){_0x4e12ee[_0x6377('0x35')]=_[_0x6377('0x36')](_0x4e12ee[_0x6377('0x35')],{'$or':_[_0x6377('0x46')](_0x4e12ee[_0x6377('0x2f')],function(_0x18fa4c){var _0xb19026={};_0xb19026[_0x18fa4c]={'$like':'%'+_0x4d7374[_0x6377('0x29')][_0x6377('0x37')]+'%'};return _0xb19026;})});}_0x4e12ee=_[_0x6377('0x36')]({},_0x4e12ee,_0x4d7374[_0x6377('0x38')]);return _0x5b082f['getSubjects'](_0x4e12ee);}})[_0x6377('0x20')](function(_0x1b0a4c){if(_0x1b0a4c){_0x99fbc=_0x1b0a4c['length'];if(!_0x4d7374['query'][_0x6377('0x31')](_0x6377('0x32'))){_0x4e12ee['limit']=qs['limit'](_0x4d7374[_0x6377('0x29')][_0x6377('0x1b')]);_0x4e12ee[_0x6377('0x19')]=qs['offset'](_0x4d7374['query'][_0x6377('0x19')]);}return _0x5b082f[_0x6377('0x43')](_0x4e12ee);}})[_0x6377('0x20')](function(_0x1a5cbe){if(_0x1a5cbe){return _0x1a5cbe?{'count':_0x99fbc,'rows':_0x1a5cbe}:null;}})['then'](respondWithResult(_0x589079,null))[_0x6377('0x3f')](handleError(_0x589079,null));};exports[_0x6377('0x47')]=function(_0x3e9dc8,_0x346c65,_0x2e378d){var _0x3ad2e8={};var _0x483139={};var _0x1830ea;var _0xde165d;return db[_0x6377('0x25')][_0x6377('0x44')]({'where':{'id':_0x3e9dc8[_0x6377('0x3d')]['id']}})[_0x6377('0x20')](handleEntityNotFound(_0x346c65,null))[_0x6377('0x20')](function(_0x3f8565){if(_0x3f8565){_0x1830ea=_0x3f8565;_0x483139[_0x6377('0x2d')]=_[_0x6377('0x2a')](db[_0x6377('0x45')][_0x6377('0x26')]);_0x483139[_0x6377('0x29')]=_['keys'](_0x3e9dc8[_0x6377('0x29')]);_0x483139[_0x6377('0x2b')]=_[_0x6377('0x2c')](_0x483139[_0x6377('0x2d')],_0x483139[_0x6377('0x29')]);_0x3ad2e8['attributes']=_[_0x6377('0x2c')](_0x483139[_0x6377('0x2d')],qs['fields'](_0x3e9dc8[_0x6377('0x29')][_0x6377('0x2e')]));_0x3ad2e8[_0x6377('0x2f')]=_0x3ad2e8[_0x6377('0x2f')][_0x6377('0x30')]?_0x3ad2e8[_0x6377('0x2f')]:_0x483139[_0x6377('0x2d')];_0x3ad2e8[_0x6377('0x33')]=qs[_0x6377('0x34')](_0x3e9dc8[_0x6377('0x29')][_0x6377('0x34')]);_0x3ad2e8['where']=qs['filters'](_[_0x6377('0x48')](_0x3e9dc8[_0x6377('0x29')],_0x483139[_0x6377('0x2b')]));if(_0x3e9dc8[_0x6377('0x29')]['filter']){_0x3ad2e8[_0x6377('0x35')]=_[_0x6377('0x36')](_0x3ad2e8[_0x6377('0x35')],{'$or':_[_0x6377('0x46')](_0x3ad2e8[_0x6377('0x2f')],function(_0x501141){var _0x2c1249={};_0x2c1249[_0x501141]={'$like':'%'+_0x3e9dc8[_0x6377('0x29')]['filter']+'%'};return _0x2c1249;})});}_0x3ad2e8=_[_0x6377('0x36')]({},_0x3ad2e8,_0x3e9dc8[_0x6377('0x38')]);return _0x1830ea['getDescriptions'](_0x3ad2e8);}})[_0x6377('0x20')](function(_0x452780){if(_0x452780){_0xde165d=_0x452780[_0x6377('0x30')];if(!_0x3e9dc8[_0x6377('0x29')][_0x6377('0x31')]('nolimit')){_0x3ad2e8[_0x6377('0x1b')]=qs[_0x6377('0x1b')](_0x3e9dc8[_0x6377('0x29')][_0x6377('0x1b')]);_0x3ad2e8[_0x6377('0x19')]=qs[_0x6377('0x19')](_0x3e9dc8['query']['offset']);}return _0x1830ea[_0x6377('0x47')](_0x3ad2e8);}})['then'](function(_0x4cd718){if(_0x4cd718){return _0x4cd718?{'count':_0xde165d,'rows':_0x4cd718}:null;}})[_0x6377('0x20')](respondWithResult(_0x346c65,null))[_0x6377('0x3f')](handleError(_0x346c65,null));};exports[_0x6377('0x49')]=function(_0x38bd88,_0x131fd3,_0x4544a1){var _0x51eeb5={};var _0xb4b8a1={};var _0x52895a;var _0x3853c4;return db[_0x6377('0x25')]['findOne']({'where':{'id':_0x38bd88['params']['id']}})['then'](handleEntityNotFound(_0x131fd3,null))[_0x6377('0x20')](function(_0x477445){if(_0x477445){_0x52895a=_0x477445;_0xb4b8a1[_0x6377('0x2d')]=_[_0x6377('0x2a')](db['FreshsalesField']['rawAttributes']);_0xb4b8a1[_0x6377('0x29')]=_[_0x6377('0x2a')](_0x38bd88[_0x6377('0x29')]);_0xb4b8a1['filters']=_[_0x6377('0x2c')](_0xb4b8a1[_0x6377('0x2d')],_0xb4b8a1[_0x6377('0x29')]);_0x51eeb5['attributes']=_[_0x6377('0x2c')](_0xb4b8a1[_0x6377('0x2d')],qs['fields'](_0x38bd88[_0x6377('0x29')][_0x6377('0x2e')]));_0x51eeb5['attributes']=_0x51eeb5[_0x6377('0x2f')][_0x6377('0x30')]?_0x51eeb5[_0x6377('0x2f')]:_0xb4b8a1[_0x6377('0x2d')];_0x51eeb5[_0x6377('0x33')]=qs[_0x6377('0x34')](_0x38bd88[_0x6377('0x29')][_0x6377('0x34')]);_0x51eeb5['where']=qs[_0x6377('0x2b')](_[_0x6377('0x48')](_0x38bd88[_0x6377('0x29')],_0xb4b8a1[_0x6377('0x2b')]));if(_0x38bd88[_0x6377('0x29')][_0x6377('0x37')]){_0x51eeb5[_0x6377('0x35')]=_['merge'](_0x51eeb5[_0x6377('0x35')],{'$or':_[_0x6377('0x46')](_0x51eeb5[_0x6377('0x2f')],function(_0x4b43d7){var _0x46b6ee={};_0x46b6ee[_0x4b43d7]={'$like':'%'+_0x38bd88[_0x6377('0x29')]['filter']+'%'};return _0x46b6ee;})});}_0x51eeb5=_[_0x6377('0x36')]({},_0x51eeb5,_0x38bd88[_0x6377('0x38')]);return _0x52895a[_0x6377('0x49')](_0x51eeb5);}})[_0x6377('0x20')](function(_0x13be0c){if(_0x13be0c){_0x3853c4=_0x13be0c[_0x6377('0x30')];if(!_0x38bd88[_0x6377('0x29')]['hasOwnProperty'](_0x6377('0x32'))){_0x51eeb5[_0x6377('0x1b')]=qs[_0x6377('0x1b')](_0x38bd88[_0x6377('0x29')][_0x6377('0x1b')]);_0x51eeb5[_0x6377('0x19')]=qs[_0x6377('0x19')](_0x38bd88[_0x6377('0x29')][_0x6377('0x19')]);}return _0x52895a['getFields'](_0x51eeb5);}})[_0x6377('0x20')](function(_0x44f9d5){if(_0x44f9d5){return _0x44f9d5?{'count':_0x3853c4,'rows':_0x44f9d5}:null;}})[_0x6377('0x20')](respondWithResult(_0x131fd3,null))[_0x6377('0x3f')](handleError(_0x131fd3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9a35a52..219d492 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 _0x3058=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x3590a4,_0x2eea94){var _0x17a579=function(_0x185371){while(--_0x185371){_0x3590a4['push'](_0x3590a4['shift']());}};_0x17a579(++_0x2eea94);}(_0x3058,0x137));var _0x8305=function(_0x484f7f,_0x2ff515){_0x484f7f=_0x484f7f-0x0;var _0x3b64f1=_0x3058[_0x484f7f];return _0x3b64f1;};'use strict';var _=require(_0x8305('0x0'));var util=require(_0x8305('0x1'));var logger=require(_0x8305('0x2'))(_0x8305('0x3'));var moment=require(_0x8305('0x4'));var BPromise=require(_0x8305('0x5'));var rp=require(_0x8305('0x6'));var fs=require('fs');var path=require(_0x8305('0x7'));var rimraf=require('rimraf');var config=require(_0x8305('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x1b28d2,_0x711ef3){return _0x1b28d2[_0x8305('0x9')](_0x8305('0xa'),attributes,{'tableName':_0x8305('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6f6=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','util','moment','request-promise','path'];(function(_0x354a05,_0x17c82f){var _0x2749d9=function(_0xf89523){while(--_0xf89523){_0x354a05['push'](_0x354a05['shift']());}};_0x2749d9(++_0x17c82f);}(_0xc6f6,0x132));var _0x6c6f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc6f6[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x6c6f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6c6f('0x1'));var BPromise=require('bluebird');var rp=require(_0x6c6f('0x2'));var fs=require('fs');var path=require(_0x6c6f('0x3'));var rimraf=require(_0x6c6f('0x4'));var config=require(_0x6c6f('0x5'));var attributes=require(_0x6c6f('0x6'));module[_0x6c6f('0x7')]=function(_0x407532,_0x1ceeb8){return _0x407532[_0x6c6f('0x8')](_0x6c6f('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 422b838..a2e914a 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 _0x946e=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x143a56,_0x46bcc8){var _0x15761f=function(_0x2dd259){while(--_0x2dd259){_0x143a56['push'](_0x143a56['shift']());}};_0x15761f(++_0x46bcc8);}(_0x946e,0x6a));var _0xe946=function(_0x3d86f4,_0x2a9220){_0x3d86f4=_0x3d86f4-0x0;var _0x5d8e87=_0x946e[_0x3d86f4];return _0x5d8e87;};'use strict';var _=require(_0xe946('0x0'));var util=require(_0xe946('0x1'));var moment=require(_0xe946('0x2'));var BPromise=require(_0xe946('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe946('0x4'));var db=require(_0xe946('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe946('0x6'));var config=require(_0xe946('0x7'));var jayson=require(_0xe946('0x8'));var client=jayson['client'][_0xe946('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe03607,_0x156753,_0x527626){return new BPromise(function(_0x5ed175,_0x4e6b63){return client[_0xe946('0xa')](_0xe03607,_0x527626)['then'](function(_0x204c23){logger[_0xe946('0xb')](_0xe946('0xc'),_0x156753,_0xe946('0xd'));logger[_0xe946('0xe')](_0xe946('0xf'),_0x156753,'request\x20sent',JSON[_0xe946('0x10')](_0x204c23));if(_0x204c23[_0xe946('0x11')]){if(_0x204c23[_0xe946('0x11')][_0xe946('0x12')]===0x1f4){logger[_0xe946('0x11')](_0xe946('0xc'),_0x156753,_0x204c23[_0xe946('0x11')][_0xe946('0x13')]);return _0x4e6b63(_0x204c23[_0xe946('0x11')][_0xe946('0x13')]);}logger[_0xe946('0x11')](_0xe946('0xc'),_0x156753,_0x204c23[_0xe946('0x11')][_0xe946('0x13')]);return _0x5ed175(_0x204c23[_0xe946('0x11')][_0xe946('0x13')]);}else{logger[_0xe946('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x156753,_0xe946('0xd'));_0x5ed175(_0x204c23[_0xe946('0x14')][_0xe946('0x13')]);}})[_0xe946('0x15')](function(_0x2f54c6){logger[_0xe946('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x156753,_0x2f54c6);_0x4e6b63(_0x2f54c6);});});} \ No newline at end of file +var _0xddb6=['jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1ad07b,_0x551d55){var _0x2c447f=function(_0x43340b){while(--_0x43340b){_0x1ad07b['push'](_0x1ad07b['shift']());}};_0x2c447f(++_0x551d55);}(_0xddb6,0xf3));var _0x6ddb=function(_0x15e6c9,_0x486d59){_0x15e6c9=_0x15e6c9-0x0;var _0x506466=_0xddb6[_0x15e6c9];return _0x506466;};'use strict';var _=require(_0x6ddb('0x0'));var util=require(_0x6ddb('0x1'));var moment=require(_0x6ddb('0x2'));var BPromise=require(_0x6ddb('0x3'));var rs=require(_0x6ddb('0x4'));var fs=require('fs');var Redis=require(_0x6ddb('0x5'));var db=require(_0x6ddb('0x6'))['db'];var utils=require(_0x6ddb('0x7'));var logger=require('../../config/logger')(_0x6ddb('0x8'));var config=require(_0x6ddb('0x9'));var jayson=require(_0x6ddb('0xa'));var client=jayson[_0x6ddb('0xb')][_0x6ddb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fbcf7,_0xbc5939,_0x5ae0a6){return new BPromise(function(_0x9f9f9b,_0x49cc55){return client[_0x6ddb('0xd')](_0x1fbcf7,_0x5ae0a6)[_0x6ddb('0xe')](function(_0x28f70d){logger['info'](_0x6ddb('0xf'),_0xbc5939,'request\x20sent');logger[_0x6ddb('0x10')](_0x6ddb('0x11'),_0xbc5939,_0x6ddb('0x12'),JSON['stringify'](_0x28f70d));if(_0x28f70d[_0x6ddb('0x13')]){if(_0x28f70d[_0x6ddb('0x13')]['code']===0x1f4){logger[_0x6ddb('0x13')](_0x6ddb('0xf'),_0xbc5939,_0x28f70d[_0x6ddb('0x13')][_0x6ddb('0x14')]);return _0x49cc55(_0x28f70d[_0x6ddb('0x13')][_0x6ddb('0x14')]);}logger[_0x6ddb('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xbc5939,_0x28f70d[_0x6ddb('0x13')][_0x6ddb('0x14')]);return _0x9f9f9b(_0x28f70d[_0x6ddb('0x13')][_0x6ddb('0x14')]);}else{logger['info'](_0x6ddb('0xf'),_0xbc5939,_0x6ddb('0x12'));_0x9f9f9b(_0x28f70d[_0x6ddb('0x15')][_0x6ddb('0x14')]);}})[_0x6ddb('0x16')](function(_0x3d014a){logger[_0x6ddb('0x13')](_0x6ddb('0xf'),_0xbc5939,_0x3d014a);_0x49cc55(_0x3d014a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f931751..f60d937 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 _0xe13a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x3f690b,_0x38abd5){var _0x1f8b57=function(_0x463433){while(--_0x463433){_0x3f690b['push'](_0x3f690b['shift']());}};_0x1f8b57(++_0x38abd5);}(_0xe13a,0x178));var _0xae13=function(_0x1c958a,_0x5561e1){_0x1c958a=_0x1c958a-0x0;var _0x3ec68c=_0xe13a[_0x1c958a];return _0x3ec68c;};'use strict';var multer=require('multer');var util=require(_0xae13('0x0'));var path=require(_0xae13('0x1'));var timeout=require(_0xae13('0x2'));var express=require(_0xae13('0x3'));var router=express['Router']();var fs_extra=require(_0xae13('0x4'));var auth=require(_0xae13('0x5'));var interaction=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var controller=require(_0xae13('0x8'));router[_0xae13('0x9')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0xb')]);router[_0xae13('0x9')]('/:id',auth[_0xae13('0xa')](),controller[_0xae13('0xc')]);router[_0xae13('0xd')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0xe')]);router[_0xae13('0xf')](_0xae13('0x10'),auth[_0xae13('0xa')](),controller[_0xae13('0x11')]);router['delete'](_0xae13('0x10'),auth[_0xae13('0xa')](),controller[_0xae13('0x12')]);module[_0xae13('0x13')]=router; \ No newline at end of file +var _0x12c9=['get','/:id','isAuthenticated','show','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','index'];(function(_0x4c920a,_0x2e8b52){var _0xf1b9ad=function(_0x2b1bad){while(--_0x2b1bad){_0x4c920a['push'](_0x4c920a['shift']());}};_0xf1b9ad(++_0x2e8b52);}(_0x12c9,0x1c9));var _0x912c=function(_0x12f427,_0x2c1e27){_0x12f427=_0x12f427-0x0;var _0x174883=_0x12c9[_0x12f427];return _0x174883;};'use strict';var multer=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var path=require(_0x912c('0x2'));var timeout=require(_0x912c('0x3'));var express=require(_0x912c('0x4'));var router=express['Router']();var fs_extra=require(_0x912c('0x5'));var auth=require(_0x912c('0x6'));var interaction=require(_0x912c('0x7'));var config=require(_0x912c('0x8'));var controller=require(_0x912c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x912c('0xa')]);router[_0x912c('0xb')](_0x912c('0xc'),auth[_0x912c('0xd')](),controller[_0x912c('0xe')]);router['post']('/',auth[_0x912c('0xd')](),controller['create']);router[_0x912c('0xf')]('/:id',auth[_0x912c('0xd')](),controller['update']);router[_0x912c('0x10')]('/:id',auth[_0x912c('0xd')](),controller[_0x912c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9f587be..1a0850f 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 _0xfc60=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM'];(function(_0x52ece1,_0x425dc5){var _0x329205=function(_0xf76c47){while(--_0xf76c47){_0x52ece1['push'](_0x52ece1['shift']());}};_0x329205(++_0x425dc5);}(_0xfc60,0x154));var _0x0fc6=function(_0x5cc30e,_0x2646b6){_0x5cc30e=_0x5cc30e-0x0;var _0x208c6d=_0xfc60[_0x5cc30e];return _0x208c6d;};'use strict';var Sequelize=require('sequelize');module[_0x0fc6('0x0')]={'type':{'type':Sequelize[_0x0fc6('0x1')]('string',_0x0fc6('0x2'),_0x0fc6('0x3'),_0x0fc6('0x4'),_0x0fc6('0x5')),'defaultValue':_0x0fc6('0x6')},'content':{'type':Sequelize[_0x0fc6('0x7')]},'key':{'type':Sequelize[_0x0fc6('0x7')]},'keyType':{'type':Sequelize[_0x0fc6('0x1')]('string','variable',_0x0fc6('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0fc6('0x7')]},'nameField':{'type':Sequelize[_0x0fc6('0x7')]},'customField':{'type':Sequelize[_0x0fc6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0fc6('0x7')]}}; \ No newline at end of file +var _0x04ed=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x2e5431,_0x1a1fdd){var _0xff49a8=function(_0x338e7d){while(--_0x338e7d){_0x2e5431['push'](_0x2e5431['shift']());}};_0xff49a8(++_0x1a1fdd);}(_0x04ed,0x9f));var _0xd04e=function(_0x4dd1b3,_0x4ec057){_0x4dd1b3=_0x4dd1b3-0x0;var _0x3495af=_0x04ed[_0x4dd1b3];return _0x3495af;};'use strict';var Sequelize=require(_0xd04e('0x0'));module[_0xd04e('0x1')]={'type':{'type':Sequelize[_0xd04e('0x2')](_0xd04e('0x3'),_0xd04e('0x4'),_0xd04e('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd04e('0x2')](_0xd04e('0x3'),_0xd04e('0x4'),_0xd04e('0x5'))},'keyContent':{'type':Sequelize[_0xd04e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd04e('0x6')]},'customField':{'type':Sequelize[_0xd04e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd04e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 788af87..cf672c9 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 _0xb2cb=['fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','FreshsalesField','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','fieldName','type','key','model','keys','filters','intersection','query'];(function(_0x4536d7,_0x2c14bd){var _0x268280=function(_0x36b137){while(--_0x36b137){_0x4536d7['push'](_0x4536d7['shift']());}};_0x268280(++_0x2c14bd);}(_0xb2cb,0x141));var _0xbb2c=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xb2cb[_0x4c445a];return _0x2f611c;};'use strict';var emlformat=require(_0xbb2c('0x0'));var rimraf=require(_0xbb2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb2c('0x2'));var rp=require(_0xbb2c('0x3'));var moment=require(_0xbb2c('0x4'));var BPromise=require(_0xbb2c('0x5'));var Mustache=require('mustache');var util=require(_0xbb2c('0x6'));var path=require('path');var sox=require(_0xbb2c('0x7'));var csv=require(_0xbb2c('0x8'));var ejs=require(_0xbb2c('0x9'));var fs=require('fs');var fs_extra=require(_0xbb2c('0xa'));var _=require(_0xbb2c('0xb'));var squel=require(_0xbb2c('0xc'));var crypto=require(_0xbb2c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbb2c('0xe'));var toCsv=require(_0xbb2c('0x8'));var querystring=require('querystring');var Papa=require(_0xbb2c('0xf'));var Redis=require(_0xbb2c('0x10'));var authService=require(_0xbb2c('0x11'));var qs=require(_0xbb2c('0x12'));var as=require(_0xbb2c('0x13'));var hardwareService=require(_0xbb2c('0x14'));var logger=require(_0xbb2c('0x15'))(_0xbb2c('0x16'));var utils=require(_0xbb2c('0x17'));var config=require(_0xbb2c('0x18'));var licenseUtil=require(_0xbb2c('0x19'));var db=require(_0xbb2c('0x1a'))['db'];function respondWithStatusCode(_0x1f39ef,_0x312d04){_0x312d04=_0x312d04||0xcc;return function(_0x35adfd){if(_0x35adfd){return _0x1f39ef['sendStatus'](_0x312d04);}return _0x1f39ef[_0xbb2c('0x1b')](_0x312d04)[_0xbb2c('0x1c')]();};}function respondWithResult(_0x3b4b48,_0x418f98){_0x418f98=_0x418f98||0xc8;return function(_0x597a25){if(_0x597a25){return _0x3b4b48[_0xbb2c('0x1b')](_0x418f98)[_0xbb2c('0x1d')](_0x597a25);}};}function respondWithFilteredResult(_0x2a3424,_0x28769b){return function(_0x456847){if(_0x456847){var _0x53a4a7=typeof _0x28769b[_0xbb2c('0x1e')]===_0xbb2c('0x1f')&&typeof _0x28769b[_0xbb2c('0x20')]===_0xbb2c('0x1f');var _0x1e87d5=_0x456847['count'];var _0x52d3a9=_0x53a4a7?0x0:_0x28769b[_0xbb2c('0x1e')];var _0x126a77=_0x53a4a7?_0x456847[_0xbb2c('0x21')]:_0x28769b[_0xbb2c('0x1e')]+_0x28769b[_0xbb2c('0x20')];var _0xf6b210;if(_0x126a77>=_0x1e87d5){_0x126a77=_0x1e87d5;_0xf6b210=0xc8;}else{_0xf6b210=0xce;}_0x2a3424[_0xbb2c('0x1b')](_0xf6b210);return _0x2a3424[_0xbb2c('0x22')](_0xbb2c('0x23'),_0x52d3a9+'-'+_0x126a77+'/'+_0x1e87d5)[_0xbb2c('0x1d')](_0x456847);}return null;};}function patchUpdates(_0x394250){return function(_0x3fbe04){try{jsonpatch[_0xbb2c('0x24')](_0x3fbe04,_0x394250,!![]);}catch(_0x4c90d2){return BPromise[_0xbb2c('0x25')](_0x4c90d2);}return _0x3fbe04[_0xbb2c('0x26')]();};}function saveUpdates(_0x1c52e6,_0x11d2d7){return function(_0x1c2539){if(_0x1c2539){return _0x1c2539[_0xbb2c('0x27')](_0x1c52e6)['then'](function(_0x5da14e){return _0x5da14e;});}return null;};}function removeEntity(_0x82efb2,_0x2cc92a){return function(_0x5b71b4){if(_0x5b71b4){return _0x5b71b4[_0xbb2c('0x28')]()[_0xbb2c('0x29')](function(){_0x82efb2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3651e8,_0x25d9fa){return function(_0x572faa){if(!_0x572faa){_0x3651e8['sendStatus'](0x194);}return _0x572faa;};}function handleError(_0x2126d5,_0x5128dc){_0x5128dc=_0x5128dc||0x1f4;return function(_0x15ce19){logger[_0xbb2c('0x2a')](_0x15ce19['stack']);if(_0x15ce19[_0xbb2c('0x2b')]){delete _0x15ce19[_0xbb2c('0x2b')];}_0x2126d5['status'](_0x5128dc)['send'](_0x15ce19);};}exports[_0xbb2c('0x2c')]=function(_0x2084ff,_0x257348){var _0x3c2650={},_0x3e79e5={},_0x204331={'count':0x0,'rows':[]};var _0x4917b5=_[_0xbb2c('0x2d')](db['FreshsalesField']['rawAttributes'],function(_0x21e99d){return{'name':_0x21e99d[_0xbb2c('0x2e')],'type':_0x21e99d[_0xbb2c('0x2f')][_0xbb2c('0x30')]};});_0x3e79e5[_0xbb2c('0x31')]=_[_0xbb2c('0x2d')](_0x4917b5,_0xbb2c('0x2b'));_0x3e79e5['query']=_[_0xbb2c('0x32')](_0x2084ff['query']);_0x3e79e5[_0xbb2c('0x33')]=_[_0xbb2c('0x34')](_0x3e79e5[_0xbb2c('0x31')],_0x3e79e5[_0xbb2c('0x35')]);_0x3c2650['attributes']=_['intersection'](_0x3e79e5[_0xbb2c('0x31')],qs[_0xbb2c('0x36')](_0x2084ff[_0xbb2c('0x35')]['fields']));_0x3c2650[_0xbb2c('0x37')]=_0x3c2650[_0xbb2c('0x37')][_0xbb2c('0x38')]?_0x3c2650[_0xbb2c('0x37')]:_0x3e79e5[_0xbb2c('0x31')];if(!_0x2084ff[_0xbb2c('0x35')][_0xbb2c('0x39')](_0xbb2c('0x3a'))){_0x3c2650[_0xbb2c('0x20')]=qs[_0xbb2c('0x20')](_0x2084ff['query'][_0xbb2c('0x20')]);_0x3c2650[_0xbb2c('0x1e')]=qs[_0xbb2c('0x1e')](_0x2084ff[_0xbb2c('0x35')][_0xbb2c('0x1e')]);}_0x3c2650['order']=qs[_0xbb2c('0x3b')](_0x2084ff['query'][_0xbb2c('0x3b')]);_0x3c2650[_0xbb2c('0x3c')]=qs['filters'](_[_0xbb2c('0x3d')](_0x2084ff['query'],_0x3e79e5['filters']),_0x4917b5);if(_0x2084ff[_0xbb2c('0x35')]['filter']){_0x3c2650[_0xbb2c('0x3c')]=_[_0xbb2c('0x3e')](_0x3c2650[_0xbb2c('0x3c')],{'$or':_[_0xbb2c('0x2d')](_0x4917b5,function(_0x382a41){if(_0x382a41[_0xbb2c('0x2f')]!=='VIRTUAL'){var _0x3e6c5e={};_0x3e6c5e[_0x382a41[_0xbb2c('0x2b')]]={'$like':'%'+_0x2084ff[_0xbb2c('0x35')][_0xbb2c('0x3f')]+'%'};return _0x3e6c5e;}})});}_0x3c2650=_[_0xbb2c('0x3e')]({},_0x3c2650,_0x2084ff[_0xbb2c('0x40')]);var _0x175e95={'where':_0x3c2650[_0xbb2c('0x3c')]};return db['FreshsalesField']['count'](_0x175e95)[_0xbb2c('0x29')](function(_0x3ed640){_0x204331['count']=_0x3ed640;if(_0x2084ff[_0xbb2c('0x35')][_0xbb2c('0x41')]){_0x3c2650['include']=[{'all':!![]}];}return db[_0xbb2c('0x42')]['findAll'](_0x3c2650);})[_0xbb2c('0x29')](function(_0x1aa4f8){_0x204331[_0xbb2c('0x43')]=_0x1aa4f8;return _0x204331;})[_0xbb2c('0x29')](respondWithFilteredResult(_0x257348,_0x3c2650))[_0xbb2c('0x44')](handleError(_0x257348,null));};exports[_0xbb2c('0x45')]=function(_0x18b613,_0x13a7cc){var _0x502799={'raw':!![],'where':{'id':_0x18b613[_0xbb2c('0x46')]['id']}},_0x462be1={};_0x462be1[_0xbb2c('0x31')]=_[_0xbb2c('0x32')](db[_0xbb2c('0x42')][_0xbb2c('0x47')]);_0x462be1[_0xbb2c('0x35')]=_[_0xbb2c('0x32')](_0x18b613[_0xbb2c('0x35')]);_0x462be1[_0xbb2c('0x33')]=_[_0xbb2c('0x34')](_0x462be1[_0xbb2c('0x31')],_0x462be1[_0xbb2c('0x35')]);_0x502799[_0xbb2c('0x37')]=_[_0xbb2c('0x34')](_0x462be1['model'],qs[_0xbb2c('0x36')](_0x18b613[_0xbb2c('0x35')][_0xbb2c('0x36')]));_0x502799[_0xbb2c('0x37')]=_0x502799[_0xbb2c('0x37')][_0xbb2c('0x38')]?_0x502799[_0xbb2c('0x37')]:_0x462be1[_0xbb2c('0x31')];if(_0x18b613[_0xbb2c('0x35')][_0xbb2c('0x41')]){_0x502799['include']=[{'all':!![]}];}_0x502799=_[_0xbb2c('0x3e')]({},_0x502799,_0x18b613[_0xbb2c('0x40')]);return db['FreshsalesField'][_0xbb2c('0x48')](_0x502799)[_0xbb2c('0x29')](handleEntityNotFound(_0x13a7cc,null))[_0xbb2c('0x29')](respondWithResult(_0x13a7cc,null))[_0xbb2c('0x44')](handleError(_0x13a7cc,null));};exports[_0xbb2c('0x49')]=function(_0x123c82,_0x593527){return db['FreshsalesField'][_0xbb2c('0x49')](_0x123c82[_0xbb2c('0x4a')],{})[_0xbb2c('0x29')](respondWithResult(_0x593527,0xc9))[_0xbb2c('0x44')](handleError(_0x593527,null));};exports[_0xbb2c('0x27')]=function(_0x55a13f,_0x1fbedd){if(_0x55a13f[_0xbb2c('0x4a')]['id']){delete _0x55a13f[_0xbb2c('0x4a')]['id'];}return db[_0xbb2c('0x42')][_0xbb2c('0x48')]({'where':{'id':_0x55a13f['params']['id']}})[_0xbb2c('0x29')](handleEntityNotFound(_0x1fbedd,null))['then'](saveUpdates(_0x55a13f[_0xbb2c('0x4a')],null))[_0xbb2c('0x29')](respondWithResult(_0x1fbedd,null))[_0xbb2c('0x44')](handleError(_0x1fbedd,null));};exports[_0xbb2c('0x28')]=function(_0x2140ed,_0x7b2ee){return db[_0xbb2c('0x42')][_0xbb2c('0x48')]({'where':{'id':_0x2140ed[_0xbb2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x7b2ee,null))['then'](removeEntity(_0x7b2ee,null))[_0xbb2c('0x44')](handleError(_0x7b2ee,null));}; \ No newline at end of file +var _0x556f=['includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','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','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','map','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options'];(function(_0x15a340,_0x4a4b49){var _0x376ff3=function(_0x5ddcc2){while(--_0x5ddcc2){_0x15a340['push'](_0x15a340['shift']());}};_0x376ff3(++_0x4a4b49);}(_0x556f,0xa5));var _0xf556=function(_0x32ceaf,_0x10a169){_0x32ceaf=_0x32ceaf-0x0;var _0xe2cd91=_0x556f[_0x32ceaf];return _0xe2cd91;};'use strict';var emlformat=require(_0xf556('0x0'));var rimraf=require(_0xf556('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf556('0x2'));var rp=require(_0xf556('0x3'));var moment=require(_0xf556('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf556('0x5'));var util=require(_0xf556('0x6'));var path=require(_0xf556('0x7'));var sox=require('sox');var csv=require(_0xf556('0x8'));var ejs=require(_0xf556('0x9'));var fs=require('fs');var fs_extra=require(_0xf556('0xa'));var _=require(_0xf556('0xb'));var squel=require(_0xf556('0xc'));var crypto=require('crypto');var jsforce=require(_0xf556('0xd'));var deskjs=require(_0xf556('0xe'));var toCsv=require(_0xf556('0x8'));var querystring=require(_0xf556('0xf'));var Papa=require(_0xf556('0x10'));var Redis=require(_0xf556('0x11'));var authService=require(_0xf556('0x12'));var qs=require(_0xf556('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf556('0x14'));var logger=require(_0xf556('0x15'))('api');var utils=require(_0xf556('0x16'));var config=require(_0xf556('0x17'));var licenseUtil=require(_0xf556('0x18'));var db=require(_0xf556('0x19'))['db'];function respondWithStatusCode(_0x1c6ddd,_0x221eb6){_0x221eb6=_0x221eb6||0xcc;return function(_0x2a974b){if(_0x2a974b){return _0x1c6ddd[_0xf556('0x1a')](_0x221eb6);}return _0x1c6ddd[_0xf556('0x1b')](_0x221eb6)[_0xf556('0x1c')]();};}function respondWithResult(_0x5e7366,_0x2c8d65){_0x2c8d65=_0x2c8d65||0xc8;return function(_0x216ef3){if(_0x216ef3){return _0x5e7366[_0xf556('0x1b')](_0x2c8d65)[_0xf556('0x1d')](_0x216ef3);}};}function respondWithFilteredResult(_0x267185,_0xa80501){return function(_0x66abf5){if(_0x66abf5){var _0x1c7a5f=typeof _0xa80501[_0xf556('0x1e')]===_0xf556('0x1f')&&typeof _0xa80501['limit']===_0xf556('0x1f');var _0x9f8dff=_0x66abf5['count'];var _0x433c69=_0x1c7a5f?0x0:_0xa80501[_0xf556('0x1e')];var _0x3ded08=_0x1c7a5f?_0x66abf5[_0xf556('0x20')]:_0xa80501['offset']+_0xa80501[_0xf556('0x21')];var _0x2dd938;if(_0x3ded08>=_0x9f8dff){_0x3ded08=_0x9f8dff;_0x2dd938=0xc8;}else{_0x2dd938=0xce;}_0x267185[_0xf556('0x1b')](_0x2dd938);return _0x267185[_0xf556('0x22')]('Content-Range',_0x433c69+'-'+_0x3ded08+'/'+_0x9f8dff)[_0xf556('0x1d')](_0x66abf5);}return null;};}function patchUpdates(_0x31df7c){return function(_0x618be4){try{jsonpatch[_0xf556('0x23')](_0x618be4,_0x31df7c,!![]);}catch(_0x1862d6){return BPromise['reject'](_0x1862d6);}return _0x618be4[_0xf556('0x24')]();};}function saveUpdates(_0x262423,_0x4a105b){return function(_0x142e43){if(_0x142e43){return _0x142e43[_0xf556('0x25')](_0x262423)[_0xf556('0x26')](function(_0x44576d){return _0x44576d;});}return null;};}function removeEntity(_0x270f86,_0x3f39fa){return function(_0x3fe261){if(_0x3fe261){return _0x3fe261[_0xf556('0x27')]()['then'](function(){_0x270f86[_0xf556('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45449f,_0x25ecbd){return function(_0x1e9383){if(!_0x1e9383){_0x45449f[_0xf556('0x1a')](0x194);}return _0x1e9383;};}function handleError(_0x45c4ea,_0x34c5b6){_0x34c5b6=_0x34c5b6||0x1f4;return function(_0x49affa){logger[_0xf556('0x28')](_0x49affa[_0xf556('0x29')]);if(_0x49affa['name']){delete _0x49affa[_0xf556('0x2a')];}_0x45c4ea[_0xf556('0x1b')](_0x34c5b6)[_0xf556('0x2b')](_0x49affa);};}exports[_0xf556('0x2c')]=function(_0x4d9705,_0x56b5bc){var _0x3478f2={},_0x399c51={},_0x2d9728={'count':0x0,'rows':[]};var _0x45bf50=_['map'](db[_0xf556('0x2d')][_0xf556('0x2e')],function(_0x4b45d1){return{'name':_0x4b45d1[_0xf556('0x2f')],'type':_0x4b45d1[_0xf556('0x30')]['key']};});_0x399c51['model']=_[_0xf556('0x31')](_0x45bf50,_0xf556('0x2a'));_0x399c51[_0xf556('0x32')]=_['keys'](_0x4d9705[_0xf556('0x32')]);_0x399c51['filters']=_[_0xf556('0x33')](_0x399c51['model'],_0x399c51[_0xf556('0x32')]);_0x3478f2[_0xf556('0x34')]=_[_0xf556('0x33')](_0x399c51[_0xf556('0x35')],qs['fields'](_0x4d9705[_0xf556('0x32')][_0xf556('0x36')]));_0x3478f2['attributes']=_0x3478f2[_0xf556('0x34')][_0xf556('0x37')]?_0x3478f2[_0xf556('0x34')]:_0x399c51['model'];if(!_0x4d9705[_0xf556('0x32')][_0xf556('0x38')]('nolimit')){_0x3478f2[_0xf556('0x21')]=qs[_0xf556('0x21')](_0x4d9705[_0xf556('0x32')]['limit']);_0x3478f2[_0xf556('0x1e')]=qs[_0xf556('0x1e')](_0x4d9705[_0xf556('0x32')][_0xf556('0x1e')]);}_0x3478f2[_0xf556('0x39')]=qs[_0xf556('0x3a')](_0x4d9705[_0xf556('0x32')][_0xf556('0x3a')]);_0x3478f2[_0xf556('0x3b')]=qs[_0xf556('0x3c')](_[_0xf556('0x3d')](_0x4d9705[_0xf556('0x32')],_0x399c51['filters']),_0x45bf50);if(_0x4d9705[_0xf556('0x32')][_0xf556('0x3e')]){_0x3478f2[_0xf556('0x3b')]=_[_0xf556('0x3f')](_0x3478f2[_0xf556('0x3b')],{'$or':_[_0xf556('0x31')](_0x45bf50,function(_0x5e3108){if(_0x5e3108[_0xf556('0x30')]!==_0xf556('0x40')){var _0x511e2d={};_0x511e2d[_0x5e3108['name']]={'$like':'%'+_0x4d9705[_0xf556('0x32')][_0xf556('0x3e')]+'%'};return _0x511e2d;}})});}_0x3478f2=_[_0xf556('0x3f')]({},_0x3478f2,_0x4d9705[_0xf556('0x41')]);var _0x39bfea={'where':_0x3478f2[_0xf556('0x3b')]};return db[_0xf556('0x2d')][_0xf556('0x20')](_0x39bfea)[_0xf556('0x26')](function(_0x2385c2){_0x2d9728[_0xf556('0x20')]=_0x2385c2;if(_0x4d9705[_0xf556('0x32')][_0xf556('0x42')]){_0x3478f2[_0xf556('0x43')]=[{'all':!![]}];}return db[_0xf556('0x2d')][_0xf556('0x44')](_0x3478f2);})[_0xf556('0x26')](function(_0x4eb5ef){_0x2d9728[_0xf556('0x45')]=_0x4eb5ef;return _0x2d9728;})[_0xf556('0x26')](respondWithFilteredResult(_0x56b5bc,_0x3478f2))['catch'](handleError(_0x56b5bc,null));};exports[_0xf556('0x46')]=function(_0x11359e,_0x532288){var _0x17e5ed={'raw':!![],'where':{'id':_0x11359e[_0xf556('0x47')]['id']}},_0x1ae7aa={};_0x1ae7aa[_0xf556('0x35')]=_[_0xf556('0x48')](db[_0xf556('0x2d')]['rawAttributes']);_0x1ae7aa[_0xf556('0x32')]=_[_0xf556('0x48')](_0x11359e[_0xf556('0x32')]);_0x1ae7aa['filters']=_['intersection'](_0x1ae7aa[_0xf556('0x35')],_0x1ae7aa[_0xf556('0x32')]);_0x17e5ed[_0xf556('0x34')]=_[_0xf556('0x33')](_0x1ae7aa[_0xf556('0x35')],qs[_0xf556('0x36')](_0x11359e[_0xf556('0x32')][_0xf556('0x36')]));_0x17e5ed[_0xf556('0x34')]=_0x17e5ed[_0xf556('0x34')]['length']?_0x17e5ed[_0xf556('0x34')]:_0x1ae7aa[_0xf556('0x35')];if(_0x11359e[_0xf556('0x32')][_0xf556('0x42')]){_0x17e5ed[_0xf556('0x43')]=[{'all':!![]}];}_0x17e5ed=_[_0xf556('0x3f')]({},_0x17e5ed,_0x11359e[_0xf556('0x41')]);return db[_0xf556('0x2d')][_0xf556('0x49')](_0x17e5ed)[_0xf556('0x26')](handleEntityNotFound(_0x532288,null))[_0xf556('0x26')](respondWithResult(_0x532288,null))[_0xf556('0x4a')](handleError(_0x532288,null));};exports[_0xf556('0x4b')]=function(_0x13fca8,_0x2ca0d5){return db[_0xf556('0x2d')]['create'](_0x13fca8[_0xf556('0x4c')],{})[_0xf556('0x26')](respondWithResult(_0x2ca0d5,0xc9))[_0xf556('0x4a')](handleError(_0x2ca0d5,null));};exports['update']=function(_0xc880ce,_0x55315e){if(_0xc880ce['body']['id']){delete _0xc880ce[_0xf556('0x4c')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0xc880ce[_0xf556('0x47')]['id']}})['then'](handleEntityNotFound(_0x55315e,null))[_0xf556('0x26')](saveUpdates(_0xc880ce[_0xf556('0x4c')],null))[_0xf556('0x26')](respondWithResult(_0x55315e,null))[_0xf556('0x4a')](handleError(_0x55315e,null));};exports[_0xf556('0x27')]=function(_0xcfbb75,_0x31366e){return db['FreshsalesField'][_0xf556('0x49')]({'where':{'id':_0xcfbb75[_0xf556('0x47')]['id']}})[_0xf556('0x26')](handleEntityNotFound(_0x31366e,null))[_0xf556('0x26')](removeEntity(_0x31366e,null))['catch'](handleError(_0x31366e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0530909..4e7e745 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 _0xd48a=['path','../../config/environment','./intFreshsalesField.attributes','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x219671,_0x2621c5){var _0x4e1086=function(_0xd33f35){while(--_0xd33f35){_0x219671['push'](_0x219671['shift']());}};_0x4e1086(++_0x2621c5);}(_0xd48a,0x96));var _0xad48=function(_0x638520,_0x102c6f){_0x638520=_0x638520-0x0;var _0x44d8f1=_0xd48a[_0x638520];return _0x44d8f1;};'use strict';var _=require(_0xad48('0x0'));var util=require('util');var logger=require(_0xad48('0x1'))(_0xad48('0x2'));var moment=require(_0xad48('0x3'));var BPromise=require(_0xad48('0x4'));var rp=require(_0xad48('0x5'));var fs=require('fs');var path=require(_0xad48('0x6'));var rimraf=require('rimraf');var config=require(_0xad48('0x7'));var attributes=require(_0xad48('0x8'));module['exports']=function(_0x143780,_0x584cf0){return _0x143780['define']('FreshsalesField',attributes,{'tableName':_0xad48('0x9'),'paranoid':![],'indexes':[{'name':_0xad48('0xa'),'fields':[_0xad48('0xb'),_0xad48('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x161a=['FieldId','../../config/logger','api','bluebird','path','rimraf','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x4548de,_0x4ff220){var _0x40dcfd=function(_0x5bcc64){while(--_0x5bcc64){_0x4548de['push'](_0x4548de['shift']());}};_0x40dcfd(++_0x4ff220);}(_0x161a,0x140));var _0xa161=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x161a[_0x1bb58c];return _0x277586;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa161('0x0'))(_0xa161('0x1'));var moment=require('moment');var BPromise=require(_0xa161('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa161('0x3'));var rimraf=require(_0xa161('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0xa161('0x5')]=function(_0x1705ab,_0x12d54c){return _0x1705ab[_0xa161('0x6')](_0xa161('0x7'),attributes,{'tableName':_0xa161('0x8'),'paranoid':![],'indexes':[{'name':_0xa161('0x9'),'fields':['idField',_0xa161('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index ea4e29c..8dfb762 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 _0x6f47=['request\x20sent','debug','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x6f47,0xc7));var _0x76f4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6f47[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){return client[_0x76f4('0x9')](_0xfc2405,_0x497f99)[_0x76f4('0xa')](function(_0x101f55){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2176a7,_0x76f4('0xb'));logger[_0x76f4('0xc')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2176a7,'request\x20sent',JSON[_0x76f4('0xd')](_0x101f55));if(_0x101f55[_0x76f4('0xe')]){if(_0x101f55[_0x76f4('0xe')][_0x76f4('0xf')]===0x1f4){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55[_0x76f4('0xe')][_0x76f4('0x11')]);return _0x25656d(_0x101f55[_0x76f4('0xe')]['message']);}logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55['error']['message']);return _0x1a3172(_0x101f55['error'][_0x76f4('0x11')]);}else{logger[_0x76f4('0x12')](_0x76f4('0x10'),_0x2176a7,_0x76f4('0xb'));_0x1a3172(_0x101f55[_0x76f4('0x13')][_0x76f4('0x11')]);}})[_0x76f4('0x14')](function(_0x981a87){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x981a87);_0x25656d(_0x981a87);});});} \ No newline at end of file +var _0xb4c7=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1b4982,_0x2aa183){var _0xcb2d4=function(_0x501c1d){while(--_0x501c1d){_0x1b4982['push'](_0x1b4982['shift']());}};_0xcb2d4(++_0x2aa183);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x9b54b5,_0x499ffd){_0x9b54b5=_0x9b54b5-0x0;var _0x2130c5=_0xb4c7[_0x9b54b5];return _0x2130c5;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 31617bb..9196ef5 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(_0x366927,_0x589f51){var _0x4e6791=function(_0x3aa1eb){while(--_0x3aa1eb){_0x366927['push'](_0x366927['shift']());}};_0x4e6791(++_0x589f51);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1ca1bd,_0x3a5f09){var _0x5b7db6=function(_0x7b9d2){while(--_0x7b9d2){_0x1ca1bd['push'](_0x1ca1bd['shift']());}};_0x5b7db6(++_0x3a5f09);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8141f6a..1c95c3f 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 _0x6515=['newTab','integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x592cbc,_0x5ec030){var _0x39b8d9=function(_0x39055c){while(--_0x39055c){_0x592cbc['push'](_0x592cbc['shift']());}};_0x39b8d9(++_0x5ec030);}(_0x6515,0x1e5));var _0x5651=function(_0x5a0357,_0x25b3fb){_0x5a0357=_0x5a0357-0x0;var _0x280907=_0x6515[_0x5a0357];return _0x280907;};'use strict';var Sequelize=require(_0x5651('0x0'));module[_0x5651('0x1')]={'name':{'type':Sequelize[_0x5651('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5651('0x2')],'unique':_0x5651('0x3')},'remoteUri':{'type':Sequelize[_0x5651('0x2')]},'password':{'type':Sequelize[_0x5651('0x2')]},'clientId':{'type':Sequelize[_0x5651('0x2')]},'clientSecret':{'type':Sequelize[_0x5651('0x2')]},'securityToken':{'type':Sequelize[_0x5651('0x2')]},'serverUrl':{'type':Sequelize[_0x5651('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5651('0x4')]('integrationTab',_0x5651('0x5')),'defaultValue':_0x5651('0x6')}}; \ No newline at end of file +var _0xd0da=['STRING','newTab','integrationTab','sequelize','exports'];(function(_0x16742d,_0x5f213d){var _0x35d984=function(_0x515b32){while(--_0x515b32){_0x16742d['push'](_0x16742d['shift']());}};_0x35d984(++_0x5f213d);}(_0xd0da,0x1b1));var _0xad0d=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xd0da[_0x57e00e];return _0x415e60;};'use strict';var Sequelize=require(_0xad0d('0x0'));module[_0xad0d('0x1')]={'name':{'type':Sequelize[_0xad0d('0x2')]},'description':{'type':Sequelize[_0xad0d('0x2')]},'username':{'type':Sequelize[_0xad0d('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xad0d('0x2')]},'password':{'type':Sequelize[_0xad0d('0x2')]},'clientId':{'type':Sequelize[_0xad0d('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xad0d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xad0d('0x3')),'defaultValue':_0xad0d('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 37b2fea..78676db 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 _0x27ad=['statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','stack','name','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceAccount','includeAll','include','rows','params','length','find','catch','create','body','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','lastIndexOf','username','concat','isNil','ticketType','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','boolean','email','textarea','remove','includes','custom','picklistValues','value','True','False','test','error','stringify','Wrong\x20credentials'];(function(_0x346053,_0x76d5fe){var _0x49170f=function(_0x5f0db6){while(--_0x5f0db6){_0x346053['push'](_0x346053['shift']());}};_0x49170f(++_0x76d5fe);}(_0x27ad,0x1c1));var _0xd27a=function(_0x2256e3,_0x3583d7){_0x2256e3=_0x2256e3-0x0;var _0x33f551=_0x27ad[_0x2256e3];return _0x33f551;};'use strict';var emlformat=require(_0xd27a('0x0'));var rimraf=require(_0xd27a('0x1'));var zipdir=require(_0xd27a('0x2'));var jsonpatch=require(_0xd27a('0x3'));var rp=require(_0xd27a('0x4'));var moment=require(_0xd27a('0x5'));var BPromise=require(_0xd27a('0x6'));var Mustache=require(_0xd27a('0x7'));var util=require(_0xd27a('0x8'));var path=require(_0xd27a('0x9'));var sox=require(_0xd27a('0xa'));var csv=require(_0xd27a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd27a('0xc'));var jsforce=require(_0xd27a('0xd'));var deskjs=require(_0xd27a('0xe'));var toCsv=require(_0xd27a('0xb'));var querystring=require('querystring');var Papa=require(_0xd27a('0xf'));var Redis=require(_0xd27a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd27a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd27a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd27a('0x13'));var config=require(_0xd27a('0x14'));var licenseUtil=require(_0xd27a('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x107b11,_0x19f150){_0x19f150=_0x19f150||0xcc;return function(_0x3033ff){if(_0x3033ff){return _0x107b11['sendStatus'](_0x19f150);}return _0x107b11[_0xd27a('0x16')](_0x19f150)[_0xd27a('0x17')]();};}function respondWithResult(_0x1815ec,_0x242eef){_0x242eef=_0x242eef||0xc8;return function(_0x30ba6d){if(_0x30ba6d){return _0x1815ec['status'](_0x242eef)[_0xd27a('0x18')](_0x30ba6d);}};}function respondWithFilteredResult(_0x5e01c9,_0x3beda7){return function(_0x578fa6){if(_0x578fa6){var _0x4e89bd=typeof _0x3beda7[_0xd27a('0x19')]==='undefined'&&typeof _0x3beda7[_0xd27a('0x1a')]===_0xd27a('0x1b');var _0x1923b1=_0x578fa6[_0xd27a('0x1c')];var _0x1c809e=_0x4e89bd?0x0:_0x3beda7[_0xd27a('0x19')];var _0x35b75c=_0x4e89bd?_0x578fa6[_0xd27a('0x1c')]:_0x3beda7[_0xd27a('0x19')]+_0x3beda7['limit'];var _0x44c763;if(_0x35b75c>=_0x1923b1){_0x35b75c=_0x1923b1;_0x44c763=0xc8;}else{_0x44c763=0xce;}_0x5e01c9[_0xd27a('0x16')](_0x44c763);return _0x5e01c9['set'](_0xd27a('0x1d'),_0x1c809e+'-'+_0x35b75c+'/'+_0x1923b1)[_0xd27a('0x18')](_0x578fa6);}return null;};}function patchUpdates(_0x513fce){return function(_0x3f3286){try{jsonpatch['apply'](_0x3f3286,_0x513fce,!![]);}catch(_0x4987e7){return BPromise[_0xd27a('0x1e')](_0x4987e7);}return _0x3f3286[_0xd27a('0x1f')]();};}function saveUpdates(_0x17412f,_0x4a09b2){return function(_0x250e10){if(_0x250e10){return _0x250e10[_0xd27a('0x20')](_0x17412f)[_0xd27a('0x21')](function(_0x941adf){return _0x941adf;});}return null;};}function removeEntity(_0x3ba9a1,_0x1e4ab4){return function(_0x5714f){if(_0x5714f){return _0x5714f['destroy']()[_0xd27a('0x21')](function(){_0x3ba9a1['status'](0xcc)[_0xd27a('0x17')]();});}};}function handleEntityNotFound(_0x4556bd,_0x1b749a){return function(_0x148583){if(!_0x148583){_0x4556bd['sendStatus'](0x194);}return _0x148583;};}function handleError(_0x7096da,_0x45f344){_0x45f344=_0x45f344||0x1f4;return function(_0x434626){logger['error'](_0x434626[_0xd27a('0x22')]);if(_0x434626[_0xd27a('0x23')]){delete _0x434626[_0xd27a('0x23')];}_0x7096da[_0xd27a('0x16')](_0x45f344)['send'](_0x434626);};}exports['index']=function(_0x235291,_0x23871b){var _0x2155c4={},_0x2a84d8={},_0x4c3f76={'count':0x0,'rows':[]};var _0x23d2f6=_['map'](db['SalesforceAccount'][_0xd27a('0x24')],function(_0x1e48f6){return{'name':_0x1e48f6['fieldName'],'type':_0x1e48f6[_0xd27a('0x25')][_0xd27a('0x26')]};});_0x2a84d8[_0xd27a('0x27')]=_[_0xd27a('0x28')](_0x23d2f6,_0xd27a('0x23'));_0x2a84d8['query']=_[_0xd27a('0x29')](_0x235291[_0xd27a('0x2a')]);_0x2a84d8[_0xd27a('0x2b')]=_[_0xd27a('0x2c')](_0x2a84d8[_0xd27a('0x27')],_0x2a84d8[_0xd27a('0x2a')]);_0x2155c4[_0xd27a('0x2d')]=_[_0xd27a('0x2c')](_0x2a84d8[_0xd27a('0x27')],qs[_0xd27a('0x2e')](_0x235291[_0xd27a('0x2a')][_0xd27a('0x2e')]));_0x2155c4['attributes']=_0x2155c4[_0xd27a('0x2d')]['length']?_0x2155c4[_0xd27a('0x2d')]:_0x2a84d8['model'];if(!_0x235291['query'][_0xd27a('0x2f')](_0xd27a('0x30'))){_0x2155c4[_0xd27a('0x1a')]=qs[_0xd27a('0x1a')](_0x235291[_0xd27a('0x2a')][_0xd27a('0x1a')]);_0x2155c4[_0xd27a('0x19')]=qs[_0xd27a('0x19')](_0x235291[_0xd27a('0x2a')]['offset']);}_0x2155c4[_0xd27a('0x31')]=qs[_0xd27a('0x32')](_0x235291[_0xd27a('0x2a')][_0xd27a('0x32')]);_0x2155c4[_0xd27a('0x33')]=qs[_0xd27a('0x2b')](_[_0xd27a('0x34')](_0x235291['query'],_0x2a84d8[_0xd27a('0x2b')]),_0x23d2f6);if(_0x235291['query']['filter']){_0x2155c4['where']=_[_0xd27a('0x35')](_0x2155c4[_0xd27a('0x33')],{'$or':_[_0xd27a('0x28')](_0x23d2f6,function(_0x52cefb){if(_0x52cefb[_0xd27a('0x25')]!==_0xd27a('0x36')){var _0x55c5c3={};_0x55c5c3[_0x52cefb['name']]={'$like':'%'+_0x235291['query'][_0xd27a('0x37')]+'%'};return _0x55c5c3;}})});}_0x2155c4=_[_0xd27a('0x35')]({},_0x2155c4,_0x235291[_0xd27a('0x38')]);var _0x14535b={'where':_0x2155c4[_0xd27a('0x33')]};return db[_0xd27a('0x39')][_0xd27a('0x1c')](_0x14535b)[_0xd27a('0x21')](function(_0x5637a4){_0x4c3f76['count']=_0x5637a4;if(_0x235291[_0xd27a('0x2a')][_0xd27a('0x3a')]){_0x2155c4[_0xd27a('0x3b')]=[{'all':!![]}];}return db[_0xd27a('0x39')]['findAll'](_0x2155c4);})[_0xd27a('0x21')](function(_0x4659c1){_0x4c3f76[_0xd27a('0x3c')]=_0x4659c1;return _0x4c3f76;})['then'](respondWithFilteredResult(_0x23871b,_0x2155c4))['catch'](handleError(_0x23871b,null));};exports['show']=function(_0xa02270,_0x306395){var _0x3f5ad1={'raw':![],'where':{'id':_0xa02270[_0xd27a('0x3d')]['id']}},_0x5609ab={};_0x5609ab[_0xd27a('0x27')]=_[_0xd27a('0x29')](db[_0xd27a('0x39')][_0xd27a('0x24')]);_0x5609ab[_0xd27a('0x2a')]=_[_0xd27a('0x29')](_0xa02270[_0xd27a('0x2a')]);_0x5609ab[_0xd27a('0x2b')]=_[_0xd27a('0x2c')](_0x5609ab[_0xd27a('0x27')],_0x5609ab['query']);_0x3f5ad1['attributes']=_[_0xd27a('0x2c')](_0x5609ab[_0xd27a('0x27')],qs['fields'](_0xa02270[_0xd27a('0x2a')][_0xd27a('0x2e')]));_0x3f5ad1[_0xd27a('0x2d')]=_0x3f5ad1['attributes'][_0xd27a('0x3e')]?_0x3f5ad1[_0xd27a('0x2d')]:_0x5609ab[_0xd27a('0x27')];if(_0xa02270['query'][_0xd27a('0x3a')]){_0x3f5ad1[_0xd27a('0x3b')]=[{'all':!![]}];}_0x3f5ad1=_[_0xd27a('0x35')]({},_0x3f5ad1,_0xa02270[_0xd27a('0x38')]);return db[_0xd27a('0x39')][_0xd27a('0x3f')](_0x3f5ad1)[_0xd27a('0x21')](handleEntityNotFound(_0x306395,null))[_0xd27a('0x21')](respondWithResult(_0x306395,null))[_0xd27a('0x40')](handleError(_0x306395,null));};exports[_0xd27a('0x41')]=function(_0x4c62b4,_0x358e30){return db[_0xd27a('0x39')][_0xd27a('0x41')](_0x4c62b4[_0xd27a('0x42')],{})[_0xd27a('0x21')](respondWithResult(_0x358e30,0xc9))[_0xd27a('0x40')](handleError(_0x358e30,null));};exports[_0xd27a('0x20')]=function(_0x173c24,_0x520f8c){if(_0x173c24[_0xd27a('0x42')]['id']){delete _0x173c24[_0xd27a('0x42')]['id'];}return db[_0xd27a('0x39')][_0xd27a('0x3f')]({'where':{'id':_0x173c24['params']['id']}})[_0xd27a('0x21')](handleEntityNotFound(_0x520f8c,null))[_0xd27a('0x21')](saveUpdates(_0x173c24['body'],null))[_0xd27a('0x21')](respondWithResult(_0x520f8c,null))[_0xd27a('0x40')](handleError(_0x520f8c,null));};exports['destroy']=function(_0x2fdfe2,_0x3c8e3b){return db['SalesforceAccount'][_0xd27a('0x3f')]({'where':{'id':_0x2fdfe2['params']['id']}})[_0xd27a('0x21')](handleEntityNotFound(_0x3c8e3b,null))[_0xd27a('0x21')](removeEntity(_0x3c8e3b,null))[_0xd27a('0x40')](handleError(_0x3c8e3b,null));};exports[_0xd27a('0x43')]=function(_0x3ab9af,_0x31708c,_0xc2a316){var _0x23f534={};var _0x1b07b6={};var _0x4c6d53;var _0x5b737c;return db[_0xd27a('0x39')]['findOne']({'where':{'id':_0x3ab9af[_0xd27a('0x3d')]['id']}})[_0xd27a('0x21')](handleEntityNotFound(_0x31708c,null))[_0xd27a('0x21')](function(_0x2e2343){if(_0x2e2343){_0x4c6d53=_0x2e2343;_0x1b07b6['model']=_['keys'](db[_0xd27a('0x44')][_0xd27a('0x24')]);_0x1b07b6[_0xd27a('0x2a')]=_[_0xd27a('0x29')](_0x3ab9af[_0xd27a('0x2a')]);_0x1b07b6[_0xd27a('0x2b')]=_['intersection'](_0x1b07b6[_0xd27a('0x27')],_0x1b07b6['query']);_0x23f534[_0xd27a('0x2d')]=_[_0xd27a('0x2c')](_0x1b07b6['model'],qs[_0xd27a('0x2e')](_0x3ab9af['query'][_0xd27a('0x2e')]));_0x23f534[_0xd27a('0x2d')]=_0x23f534['attributes'][_0xd27a('0x3e')]?_0x23f534[_0xd27a('0x2d')]:_0x1b07b6[_0xd27a('0x27')];_0x23f534[_0xd27a('0x31')]=qs[_0xd27a('0x32')](_0x3ab9af[_0xd27a('0x2a')][_0xd27a('0x32')]);_0x23f534[_0xd27a('0x33')]=qs[_0xd27a('0x2b')](_[_0xd27a('0x34')](_0x3ab9af[_0xd27a('0x2a')],_0x1b07b6[_0xd27a('0x2b')]));if(_0x3ab9af[_0xd27a('0x2a')][_0xd27a('0x37')]){_0x23f534[_0xd27a('0x33')]=_['merge'](_0x23f534[_0xd27a('0x33')],{'$or':_[_0xd27a('0x28')](_0x23f534[_0xd27a('0x2d')],function(_0x284f1b){var _0x4df07a={};_0x4df07a[_0x284f1b]={'$like':'%'+_0x3ab9af[_0xd27a('0x2a')][_0xd27a('0x37')]+'%'};return _0x4df07a;})});}_0x23f534=_[_0xd27a('0x35')]({},_0x23f534,_0x3ab9af[_0xd27a('0x38')]);return _0x4c6d53[_0xd27a('0x43')](_0x23f534);}})[_0xd27a('0x21')](function(_0xb20ea8){if(_0xb20ea8){_0x5b737c=_0xb20ea8[_0xd27a('0x3e')];if(!_0x3ab9af[_0xd27a('0x2a')][_0xd27a('0x2f')](_0xd27a('0x30'))){_0x23f534[_0xd27a('0x1a')]=qs[_0xd27a('0x1a')](_0x3ab9af['query'][_0xd27a('0x1a')]);_0x23f534[_0xd27a('0x19')]=qs[_0xd27a('0x19')](_0x3ab9af[_0xd27a('0x2a')]['offset']);}return _0x4c6d53[_0xd27a('0x43')](_0x23f534);}})[_0xd27a('0x21')](function(_0x1303b0){if(_0x1303b0){return _0x1303b0?{'count':_0x5b737c,'rows':_0x1303b0}:null;}})['then'](respondWithResult(_0x31708c,null))[_0xd27a('0x40')](handleError(_0x31708c,null));};exports[_0xd27a('0x45')]=function(_0x29009d,_0x52aecb,_0x2ad4d9){if(_0x29009d[_0xd27a('0x42')]['id']){delete _0x29009d[_0xd27a('0x42')]['id'];}return db[_0xd27a('0x39')][_0xd27a('0x46')]({'where':{'id':_0x29009d[_0xd27a('0x3d')]['id']}})[_0xd27a('0x21')](handleEntityNotFound(_0x52aecb,null))[_0xd27a('0x21')](function(_0x470b8f){if(_0x470b8f){_0x29009d[_0xd27a('0x42')][_0xd27a('0x47')]=_0x470b8f['id'];_0x29009d[_0xd27a('0x42')][_0xd27a('0x48')]=integrations[_0xd27a('0x49')](_0x29009d[_0xd27a('0x42')][_0xd27a('0x4a')],_0x29009d['body'][_0xd27a('0x25')]);_0x29009d[_0xd27a('0x42')][_0xd27a('0x4b')]=integrations[_0xd27a('0x4c')](_0x29009d['body'][_0xd27a('0x4a')],_0x29009d['body'][_0xd27a('0x25')]);return db[_0xd27a('0x44')]['create'](_0x29009d['body'],{'include':[{'model':db[_0xd27a('0x4d')],'as':_0xd27a('0x48')},{'model':db[_0xd27a('0x4d')],'as':_0xd27a('0x4b')}]});}return null;})[_0xd27a('0x21')](respondWithResult(_0x52aecb,null))[_0xd27a('0x40')](handleError(_0x52aecb,null));};exports[_0xd27a('0x4e')]=function(_0x1dd335,_0x5bbd8e,_0x4184c0){var _0x5186bb;var _0x2ea0f0='';var _0x1fefb4=_0xd27a('0x4f');return db[_0xd27a('0x39')][_0xd27a('0x46')]({'where':{'id':_0x1dd335[_0xd27a('0x3d')]['id']},'attributes':['id',_0xd27a('0x50'),_0xd27a('0x51'),_0xd27a('0x52'),'username',_0xd27a('0x53'),_0xd27a('0x54')]})[_0xd27a('0x21')](handleEntityNotFound(_0x5bbd8e,null))[_0xd27a('0x21')](function(_0x3c3014){if(_0x3c3014){_0x2ea0f0=_0x3c3014[_0xd27a('0x50')];var _0x52f1dc=_0x2ea0f0['slice'](-0x1);if(_0x52f1dc==='/'){_0x2ea0f0=_0x2ea0f0['substring'](0x0,_0x2ea0f0[_0xd27a('0x55')](_0x52f1dc));}_0x5186bb=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2ea0f0,'clientId':_0x3c3014[_0xd27a('0x51')],'clientSecret':_0x3c3014['clientSecret']}});return _0x5186bb['login'](_0x3c3014[_0xd27a('0x56')],_0x3c3014['password'][_0xd27a('0x57')](_0x3c3014[_0xd27a('0x54')]));}})[_0xd27a('0x21')](function(_0x2e071c){if(_0x2e071c){if(!_[_0xd27a('0x58')](_0x1dd335[_0xd27a('0x2a')][_0xd27a('0x59')])){_0x1fefb4=_0x1dd335[_0xd27a('0x2a')]['ticketType'];}return _0x5186bb['sobject'](_0x1fefb4)[_0xd27a('0x5a')]();}})[_0xd27a('0x21')](function(_0x3090ee){var _0x744a24=['OwnerId',_0xd27a('0x5b'),_0xd27a('0x5c'),_0xd27a('0x5d'),_0xd27a('0x5e'),_0xd27a('0x5f')];var _0x3856af=[_0xd27a('0x60'),'int','picklist',_0xd27a('0x61'),_0xd27a('0x62'),_0xd27a('0x63'),'phone'];if(_0x3090ee){_[_0xd27a('0x64')](_0x3090ee[_0xd27a('0x2e')],function(_0x5550df){return _0x744a24[_0xd27a('0x65')](_0x5550df[_0xd27a('0x23')])||!_0x3856af[_0xd27a('0x65')](_0x5550df['type']);});return{'count':_0x3090ee['fields']['length'],'rows':_['map'](_0x3090ee[_0xd27a('0x2e')],function(_0x69ac16){return{'id':_0x69ac16[_0xd27a('0x23')],'name':_0x69ac16['label'],'custom':_0x69ac16[_0xd27a('0x66')],'options':_0x69ac16[_0xd27a('0x67')][_0xd27a('0x3e')]>0x0?_[_0xd27a('0x28')](_0x69ac16[_0xd27a('0x67')],function(_0x60ec9e){return{'name':_0x60ec9e['label'],'value':_0x60ec9e[_0xd27a('0x68')]};}):_0x69ac16[_0xd27a('0x25')]==_0xd27a('0x61')?[{'name':_0xd27a('0x69'),'value':'true'},{'name':_0xd27a('0x6a'),'value':'false'}]:[]};})};}})[_0xd27a('0x21')](respondWithResult(_0x5bbd8e,null))[_0xd27a('0x40')](function(_0x4a44c7){var _0x37cf1e=_0x1dd335[_0xd27a('0x2a')][_0xd27a('0x6b')]?0x1f4:_0x4a44c7['statusCode']||0x1f4;logger[_0xd27a('0x6c')]('getFields,\x20%s,\x20%s,\x20%s',_0xd27a('0x4e'),_0x37cf1e,JSON[_0xd27a('0x6d')](_0x4a44c7));delete _0x4a44c7[_0xd27a('0x23')];if(_0x37cf1e===0x191){_0x37cf1e=0x190;}_0x5bbd8e[_0xd27a('0x16')](_0x37cf1e)['send'](_0x1dd335[_0xd27a('0x2a')][_0xd27a('0x6b')]?{'message':_0xd27a('0x6e'),'statusCode':_0x4a44c7[_0xd27a('0x6f')]}:_0x4a44c7);});}; \ No newline at end of file +var _0x4e6e=['key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','destroy','getConfigurations','SalesforceConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','phone','remove','label','custom','picklistValues','value','True','true','False','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type'];(function(_0x1094d7,_0x20bb00){var _0x469a3b=function(_0x3165f1){while(--_0x3165f1){_0x1094d7['push'](_0x1094d7['shift']());}};_0x469a3b(++_0x20bb00);}(_0x4e6e,0x1d9));var _0xe4e6=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x4e6e[_0x68ee8b];return _0x5148f7;};'use strict';var emlformat=require(_0xe4e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4e6('0x1'));var jsonpatch=require(_0xe4e6('0x2'));var rp=require(_0xe4e6('0x3'));var moment=require('moment');var BPromise=require(_0xe4e6('0x4'));var Mustache=require(_0xe4e6('0x5'));var util=require(_0xe4e6('0x6'));var path=require(_0xe4e6('0x7'));var sox=require(_0xe4e6('0x8'));var csv=require(_0xe4e6('0x9'));var ejs=require(_0xe4e6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4e6('0xb'));var squel=require(_0xe4e6('0xc'));var crypto=require(_0xe4e6('0xd'));var jsforce=require(_0xe4e6('0xe'));var deskjs=require(_0xe4e6('0xf'));var toCsv=require(_0xe4e6('0x9'));var querystring=require(_0xe4e6('0x10'));var Papa=require(_0xe4e6('0x11'));var Redis=require(_0xe4e6('0x12'));var authService=require(_0xe4e6('0x13'));var qs=require(_0xe4e6('0x14'));var as=require(_0xe4e6('0x15'));var hardwareService=require(_0xe4e6('0x16'));var logger=require(_0xe4e6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4e6('0x18'));var licenseUtil=require(_0xe4e6('0x19'));var db=require(_0xe4e6('0x1a'))['db'];var integrations=require(_0xe4e6('0x1b'));function respondWithStatusCode(_0xd84985,_0x5efbc8){_0x5efbc8=_0x5efbc8||0xcc;return function(_0x3799b6){if(_0x3799b6){return _0xd84985['sendStatus'](_0x5efbc8);}return _0xd84985[_0xe4e6('0x1c')](_0x5efbc8)[_0xe4e6('0x1d')]();};}function respondWithResult(_0x1c62a4,_0x2f19cb){_0x2f19cb=_0x2f19cb||0xc8;return function(_0x29ab58){if(_0x29ab58){return _0x1c62a4['status'](_0x2f19cb)[_0xe4e6('0x1e')](_0x29ab58);}};}function respondWithFilteredResult(_0x4fe228,_0x23a984){return function(_0x20ea75){if(_0x20ea75){var _0x2c51ea=typeof _0x23a984[_0xe4e6('0x1f')]==='undefined'&&typeof _0x23a984[_0xe4e6('0x20')]===_0xe4e6('0x21');var _0xf5743d=_0x20ea75[_0xe4e6('0x22')];var _0x5f0051=_0x2c51ea?0x0:_0x23a984[_0xe4e6('0x1f')];var _0x245a2e=_0x2c51ea?_0x20ea75[_0xe4e6('0x22')]:_0x23a984[_0xe4e6('0x1f')]+_0x23a984['limit'];var _0x3b8fe2;if(_0x245a2e>=_0xf5743d){_0x245a2e=_0xf5743d;_0x3b8fe2=0xc8;}else{_0x3b8fe2=0xce;}_0x4fe228['status'](_0x3b8fe2);return _0x4fe228['set'](_0xe4e6('0x23'),_0x5f0051+'-'+_0x245a2e+'/'+_0xf5743d)[_0xe4e6('0x1e')](_0x20ea75);}return null;};}function patchUpdates(_0x6715ba){return function(_0x4791a0){try{jsonpatch[_0xe4e6('0x24')](_0x4791a0,_0x6715ba,!![]);}catch(_0x81aca0){return BPromise[_0xe4e6('0x25')](_0x81aca0);}return _0x4791a0[_0xe4e6('0x26')]();};}function saveUpdates(_0x429e83,_0x33207f){return function(_0x30c93f){if(_0x30c93f){return _0x30c93f[_0xe4e6('0x27')](_0x429e83)[_0xe4e6('0x28')](function(_0x427cd2){return _0x427cd2;});}return null;};}function removeEntity(_0x5524a7,_0x3a201a){return function(_0x4a9cf7){if(_0x4a9cf7){return _0x4a9cf7['destroy']()[_0xe4e6('0x28')](function(){_0x5524a7[_0xe4e6('0x1c')](0xcc)[_0xe4e6('0x1d')]();});}};}function handleEntityNotFound(_0x2d2bac,_0x2febb6){return function(_0x450916){if(!_0x450916){_0x2d2bac[_0xe4e6('0x29')](0x194);}return _0x450916;};}function handleError(_0x427d71,_0x5107cc){_0x5107cc=_0x5107cc||0x1f4;return function(_0x5a5f2a){logger['error'](_0x5a5f2a[_0xe4e6('0x2a')]);if(_0x5a5f2a['name']){delete _0x5a5f2a[_0xe4e6('0x2b')];}_0x427d71['status'](_0x5107cc)[_0xe4e6('0x2c')](_0x5a5f2a);};}exports[_0xe4e6('0x2d')]=function(_0x39d6f1,_0x135a5c){var _0x9a52ff={},_0x55f199={},_0x5a60fc={'count':0x0,'rows':[]};var _0xef0fc7=_[_0xe4e6('0x2e')](db[_0xe4e6('0x2f')][_0xe4e6('0x30')],function(_0xeb17f5){return{'name':_0xeb17f5[_0xe4e6('0x31')],'type':_0xeb17f5[_0xe4e6('0x32')][_0xe4e6('0x33')]};});_0x55f199[_0xe4e6('0x34')]=_[_0xe4e6('0x2e')](_0xef0fc7,'name');_0x55f199[_0xe4e6('0x35')]=_['keys'](_0x39d6f1[_0xe4e6('0x35')]);_0x55f199[_0xe4e6('0x36')]=_[_0xe4e6('0x37')](_0x55f199['model'],_0x55f199[_0xe4e6('0x35')]);_0x9a52ff[_0xe4e6('0x38')]=_[_0xe4e6('0x37')](_0x55f199['model'],qs[_0xe4e6('0x39')](_0x39d6f1[_0xe4e6('0x35')][_0xe4e6('0x39')]));_0x9a52ff[_0xe4e6('0x38')]=_0x9a52ff[_0xe4e6('0x38')]['length']?_0x9a52ff[_0xe4e6('0x38')]:_0x55f199[_0xe4e6('0x34')];if(!_0x39d6f1[_0xe4e6('0x35')]['hasOwnProperty']('nolimit')){_0x9a52ff[_0xe4e6('0x20')]=qs[_0xe4e6('0x20')](_0x39d6f1[_0xe4e6('0x35')]['limit']);_0x9a52ff['offset']=qs['offset'](_0x39d6f1[_0xe4e6('0x35')][_0xe4e6('0x1f')]);}_0x9a52ff[_0xe4e6('0x3a')]=qs[_0xe4e6('0x3b')](_0x39d6f1[_0xe4e6('0x35')][_0xe4e6('0x3b')]);_0x9a52ff[_0xe4e6('0x3c')]=qs[_0xe4e6('0x36')](_[_0xe4e6('0x3d')](_0x39d6f1[_0xe4e6('0x35')],_0x55f199[_0xe4e6('0x36')]),_0xef0fc7);if(_0x39d6f1[_0xe4e6('0x35')][_0xe4e6('0x3e')]){_0x9a52ff['where']=_[_0xe4e6('0x3f')](_0x9a52ff[_0xe4e6('0x3c')],{'$or':_[_0xe4e6('0x2e')](_0xef0fc7,function(_0x30a470){if(_0x30a470[_0xe4e6('0x32')]!=='VIRTUAL'){var _0x5f0be0={};_0x5f0be0[_0x30a470['name']]={'$like':'%'+_0x39d6f1['query']['filter']+'%'};return _0x5f0be0;}})});}_0x9a52ff=_[_0xe4e6('0x3f')]({},_0x9a52ff,_0x39d6f1[_0xe4e6('0x40')]);var _0x29b28a={'where':_0x9a52ff[_0xe4e6('0x3c')]};return db[_0xe4e6('0x2f')][_0xe4e6('0x22')](_0x29b28a)[_0xe4e6('0x28')](function(_0x306666){_0x5a60fc[_0xe4e6('0x22')]=_0x306666;if(_0x39d6f1[_0xe4e6('0x35')]['includeAll']){_0x9a52ff[_0xe4e6('0x41')]=[{'all':!![]}];}return db[_0xe4e6('0x2f')][_0xe4e6('0x42')](_0x9a52ff);})[_0xe4e6('0x28')](function(_0x52f255){_0x5a60fc[_0xe4e6('0x43')]=_0x52f255;return _0x5a60fc;})[_0xe4e6('0x28')](respondWithFilteredResult(_0x135a5c,_0x9a52ff))[_0xe4e6('0x44')](handleError(_0x135a5c,null));};exports[_0xe4e6('0x45')]=function(_0x1f2a49,_0x36ea80){var _0x37fa2a={'raw':![],'where':{'id':_0x1f2a49[_0xe4e6('0x46')]['id']}},_0x418170={};_0x418170[_0xe4e6('0x34')]=_['keys'](db[_0xe4e6('0x2f')][_0xe4e6('0x30')]);_0x418170['query']=_[_0xe4e6('0x47')](_0x1f2a49['query']);_0x418170[_0xe4e6('0x36')]=_[_0xe4e6('0x37')](_0x418170[_0xe4e6('0x34')],_0x418170['query']);_0x37fa2a['attributes']=_[_0xe4e6('0x37')](_0x418170[_0xe4e6('0x34')],qs[_0xe4e6('0x39')](_0x1f2a49[_0xe4e6('0x35')][_0xe4e6('0x39')]));_0x37fa2a['attributes']=_0x37fa2a['attributes'][_0xe4e6('0x48')]?_0x37fa2a['attributes']:_0x418170[_0xe4e6('0x34')];if(_0x1f2a49['query'][_0xe4e6('0x49')]){_0x37fa2a[_0xe4e6('0x41')]=[{'all':!![]}];}_0x37fa2a=_[_0xe4e6('0x3f')]({},_0x37fa2a,_0x1f2a49[_0xe4e6('0x40')]);return db[_0xe4e6('0x2f')][_0xe4e6('0x4a')](_0x37fa2a)[_0xe4e6('0x28')](handleEntityNotFound(_0x36ea80,null))[_0xe4e6('0x28')](respondWithResult(_0x36ea80,null))['catch'](handleError(_0x36ea80,null));};exports[_0xe4e6('0x4b')]=function(_0x4b02e1,_0x443469){return db[_0xe4e6('0x2f')][_0xe4e6('0x4b')](_0x4b02e1[_0xe4e6('0x4c')],{})[_0xe4e6('0x28')](respondWithResult(_0x443469,0xc9))[_0xe4e6('0x44')](handleError(_0x443469,null));};exports['update']=function(_0xe4a9bd,_0x4a7e89){if(_0xe4a9bd['body']['id']){delete _0xe4a9bd[_0xe4e6('0x4c')]['id'];}return db[_0xe4e6('0x2f')][_0xe4e6('0x4a')]({'where':{'id':_0xe4a9bd[_0xe4e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a7e89,null))[_0xe4e6('0x28')](saveUpdates(_0xe4a9bd[_0xe4e6('0x4c')],null))[_0xe4e6('0x28')](respondWithResult(_0x4a7e89,null))[_0xe4e6('0x44')](handleError(_0x4a7e89,null));};exports[_0xe4e6('0x4d')]=function(_0x1e74d1,_0x5cd020){return db[_0xe4e6('0x2f')]['find']({'where':{'id':_0x1e74d1[_0xe4e6('0x46')]['id']}})[_0xe4e6('0x28')](handleEntityNotFound(_0x5cd020,null))['then'](removeEntity(_0x5cd020,null))[_0xe4e6('0x44')](handleError(_0x5cd020,null));};exports[_0xe4e6('0x4e')]=function(_0x262441,_0x58f9e4,_0x1b3b18){var _0xc03988={};var _0xa71dde={};var _0x2a9ea0;var _0x4c6b59;return db[_0xe4e6('0x2f')]['findOne']({'where':{'id':_0x262441[_0xe4e6('0x46')]['id']}})[_0xe4e6('0x28')](handleEntityNotFound(_0x58f9e4,null))[_0xe4e6('0x28')](function(_0xc6a7ef){if(_0xc6a7ef){_0x2a9ea0=_0xc6a7ef;_0xa71dde['model']=_[_0xe4e6('0x47')](db[_0xe4e6('0x4f')][_0xe4e6('0x30')]);_0xa71dde[_0xe4e6('0x35')]=_[_0xe4e6('0x47')](_0x262441[_0xe4e6('0x35')]);_0xa71dde[_0xe4e6('0x36')]=_[_0xe4e6('0x37')](_0xa71dde['model'],_0xa71dde[_0xe4e6('0x35')]);_0xc03988[_0xe4e6('0x38')]=_[_0xe4e6('0x37')](_0xa71dde[_0xe4e6('0x34')],qs['fields'](_0x262441['query'][_0xe4e6('0x39')]));_0xc03988[_0xe4e6('0x38')]=_0xc03988[_0xe4e6('0x38')][_0xe4e6('0x48')]?_0xc03988[_0xe4e6('0x38')]:_0xa71dde[_0xe4e6('0x34')];_0xc03988[_0xe4e6('0x3a')]=qs['sort'](_0x262441[_0xe4e6('0x35')][_0xe4e6('0x3b')]);_0xc03988[_0xe4e6('0x3c')]=qs[_0xe4e6('0x36')](_[_0xe4e6('0x3d')](_0x262441[_0xe4e6('0x35')],_0xa71dde[_0xe4e6('0x36')]));if(_0x262441[_0xe4e6('0x35')][_0xe4e6('0x3e')]){_0xc03988[_0xe4e6('0x3c')]=_[_0xe4e6('0x3f')](_0xc03988['where'],{'$or':_[_0xe4e6('0x2e')](_0xc03988['attributes'],function(_0x381cee){var _0x9a5d={};_0x9a5d[_0x381cee]={'$like':'%'+_0x262441[_0xe4e6('0x35')][_0xe4e6('0x3e')]+'%'};return _0x9a5d;})});}_0xc03988=_[_0xe4e6('0x3f')]({},_0xc03988,_0x262441[_0xe4e6('0x40')]);return _0x2a9ea0['getConfigurations'](_0xc03988);}})[_0xe4e6('0x28')](function(_0x16087a){if(_0x16087a){_0x4c6b59=_0x16087a[_0xe4e6('0x48')];if(!_0x262441[_0xe4e6('0x35')][_0xe4e6('0x50')](_0xe4e6('0x51'))){_0xc03988[_0xe4e6('0x20')]=qs['limit'](_0x262441[_0xe4e6('0x35')][_0xe4e6('0x20')]);_0xc03988[_0xe4e6('0x1f')]=qs[_0xe4e6('0x1f')](_0x262441['query'][_0xe4e6('0x1f')]);}return _0x2a9ea0['getConfigurations'](_0xc03988);}})[_0xe4e6('0x28')](function(_0x5e4114){if(_0x5e4114){return _0x5e4114?{'count':_0x4c6b59,'rows':_0x5e4114}:null;}})[_0xe4e6('0x28')](respondWithResult(_0x58f9e4,null))[_0xe4e6('0x44')](handleError(_0x58f9e4,null));};exports[_0xe4e6('0x52')]=function(_0x31c54e,_0x37ba21,_0xd7e2b){if(_0x31c54e[_0xe4e6('0x4c')]['id']){delete _0x31c54e[_0xe4e6('0x4c')]['id'];}return db[_0xe4e6('0x2f')]['findOne']({'where':{'id':_0x31c54e[_0xe4e6('0x46')]['id']}})[_0xe4e6('0x28')](handleEntityNotFound(_0x37ba21,null))[_0xe4e6('0x28')](function(_0x113a40){if(_0x113a40){_0x31c54e['body'][_0xe4e6('0x53')]=_0x113a40['id'];_0x31c54e[_0xe4e6('0x4c')][_0xe4e6('0x54')]=integrations[_0xe4e6('0x55')](_0x31c54e['body'][_0xe4e6('0x56')],_0x31c54e[_0xe4e6('0x4c')][_0xe4e6('0x32')]);_0x31c54e[_0xe4e6('0x4c')][_0xe4e6('0x57')]=integrations[_0xe4e6('0x58')](_0x31c54e[_0xe4e6('0x4c')][_0xe4e6('0x56')],_0x31c54e[_0xe4e6('0x4c')]['type']);return db[_0xe4e6('0x4f')][_0xe4e6('0x4b')](_0x31c54e[_0xe4e6('0x4c')],{'include':[{'model':db['SalesforceField'],'as':_0xe4e6('0x54')},{'model':db[_0xe4e6('0x59')],'as':_0xe4e6('0x57')}]});}return null;})[_0xe4e6('0x28')](respondWithResult(_0x37ba21,null))['catch'](handleError(_0x37ba21,null));};exports[_0xe4e6('0x5a')]=function(_0x561878,_0x42377c,_0x3478a1){var _0x3effdf;var _0x4ec69a='';var _0x31a9ab=_0xe4e6('0x5b');return db[_0xe4e6('0x2f')]['findOne']({'where':{'id':_0x561878['params']['id']},'attributes':['id',_0xe4e6('0x5c'),_0xe4e6('0x5d'),_0xe4e6('0x5e'),_0xe4e6('0x5f'),_0xe4e6('0x60'),_0xe4e6('0x61')]})[_0xe4e6('0x28')](handleEntityNotFound(_0x42377c,null))['then'](function(_0x1c877f){if(_0x1c877f){_0x4ec69a=_0x1c877f['remoteUri'];var _0x266789=_0x4ec69a[_0xe4e6('0x62')](-0x1);if(_0x266789==='/'){_0x4ec69a=_0x4ec69a[_0xe4e6('0x63')](0x0,_0x4ec69a[_0xe4e6('0x64')](_0x266789));}_0x3effdf=new jsforce[(_0xe4e6('0x65'))]({'oauth2':{'loginUrl':_0x4ec69a,'clientId':_0x1c877f['clientId'],'clientSecret':_0x1c877f[_0xe4e6('0x5e')]}});return _0x3effdf['login'](_0x1c877f[_0xe4e6('0x5f')],_0x1c877f['password'][_0xe4e6('0x66')](_0x1c877f[_0xe4e6('0x61')]));}})[_0xe4e6('0x28')](function(_0xd7bb6f){if(_0xd7bb6f){if(!_[_0xe4e6('0x67')](_0x561878[_0xe4e6('0x35')][_0xe4e6('0x68')])){_0x31a9ab=_0x561878[_0xe4e6('0x35')][_0xe4e6('0x68')];}return _0x3effdf[_0xe4e6('0x69')](_0x31a9ab)[_0xe4e6('0x6a')]();}})[_0xe4e6('0x28')](function(_0x2b18cd){var _0x6e2acc=[_0xe4e6('0x6b'),_0xe4e6('0x6c'),_0xe4e6('0x6d'),_0xe4e6('0x6e'),_0xe4e6('0x6f'),_0xe4e6('0x70')];var _0x1722cd=[_0xe4e6('0x71'),'int',_0xe4e6('0x72'),_0xe4e6('0x73'),_0xe4e6('0x74'),'textarea',_0xe4e6('0x75')];if(_0x2b18cd){_[_0xe4e6('0x76')](_0x2b18cd[_0xe4e6('0x39')],function(_0x3cfb35){return _0x6e2acc['includes'](_0x3cfb35[_0xe4e6('0x2b')])||!_0x1722cd['includes'](_0x3cfb35[_0xe4e6('0x32')]);});return{'count':_0x2b18cd[_0xe4e6('0x39')]['length'],'rows':_[_0xe4e6('0x2e')](_0x2b18cd[_0xe4e6('0x39')],function(_0xab8a77){return{'id':_0xab8a77[_0xe4e6('0x2b')],'name':_0xab8a77[_0xe4e6('0x77')],'custom':_0xab8a77[_0xe4e6('0x78')],'options':_0xab8a77[_0xe4e6('0x79')]['length']>0x0?_[_0xe4e6('0x2e')](_0xab8a77['picklistValues'],function(_0x389210){return{'name':_0x389210[_0xe4e6('0x77')],'value':_0x389210[_0xe4e6('0x7a')]};}):_0xab8a77[_0xe4e6('0x32')]==_0xe4e6('0x73')?[{'name':_0xe4e6('0x7b'),'value':_0xe4e6('0x7c')},{'name':_0xe4e6('0x7d'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x42377c,null))[_0xe4e6('0x44')](function(_0x30e9d6){var _0x5159a2=_0x561878['query'][_0xe4e6('0x7e')]?0x1f4:_0x30e9d6[_0xe4e6('0x7f')]||0x1f4;logger[_0xe4e6('0x80')](_0xe4e6('0x81'),'getFields',_0x5159a2,JSON[_0xe4e6('0x82')](_0x30e9d6));delete _0x30e9d6[_0xe4e6('0x2b')];if(_0x5159a2===0x191){_0x5159a2=0x190;}_0x42377c[_0xe4e6('0x1c')](_0x5159a2)['send'](_0x561878[_0xe4e6('0x35')][_0xe4e6('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x30e9d6[_0xe4e6('0x7f')]}:_0x30e9d6);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 0501e71..2a56a56 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 _0x27c5=['bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x27c5,0xf7));var _0x527c=function(_0x1f063b,_0x321a3c){_0x1f063b=_0x1f063b-0x0;var _0x4d864b=_0x27c5[_0x1f063b];return _0x4d864b;};'use strict';var _=require(_0x527c('0x0'));var util=require(_0x527c('0x1'));var logger=require(_0x527c('0x2'))(_0x527c('0x3'));var moment=require(_0x527c('0x4'));var BPromise=require(_0x527c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x527c('0x6'));var config=require(_0x527c('0x7'));var attributes=require(_0x527c('0x8'));var integrations=require(_0x527c('0x9'));module[_0x527c('0xa')]=function(_0x616d04,_0x402993){return _0x616d04[_0x527c('0xb')](_0x527c('0xc'),attributes,{'tableName':_0x527c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed4b=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0xed4b,0x96));var _0xbed4=function(_0x36c6cc,_0x24e0ea){_0x36c6cc=_0x36c6cc-0x0;var _0x2dbc6f=_0xed4b[_0x36c6cc];return _0x2dbc6f;};'use strict';var _=require(_0xbed4('0x0'));var util=require(_0xbed4('0x1'));var logger=require(_0xbed4('0x2'))('api');var moment=require(_0xbed4('0x3'));var BPromise=require(_0xbed4('0x4'));var rp=require(_0xbed4('0x5'));var fs=require('fs');var path=require(_0xbed4('0x6'));var rimraf=require(_0xbed4('0x7'));var config=require(_0xbed4('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xbed4('0x9'));module[_0xbed4('0xa')]=function(_0x403756,_0x272560){return _0x403756[_0xbed4('0xb')](_0xbed4('0xc'),attributes,{'tableName':_0xbed4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index ea8dcf6..c54c3f9 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 _0x14ae=['client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','include','model','attributes','map','debug','ShowSalesforceAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x555328,_0x3c72db){var _0x325b4a=function(_0x166b1b){while(--_0x166b1b){_0x555328['push'](_0x555328['shift']());}};_0x325b4a(++_0x3c72db);}(_0x14ae,0x1b0));var _0xe14a=function(_0x14e6ed,_0x5d5d02){_0x14e6ed=_0x14e6ed-0x0;var _0x260347=_0x14ae[_0x14e6ed];return _0x260347;};'use strict';var _=require(_0xe14a('0x0'));var util=require(_0xe14a('0x1'));var moment=require('moment');var BPromise=require(_0xe14a('0x2'));var rs=require(_0xe14a('0x3'));var fs=require('fs');var Redis=require(_0xe14a('0x4'));var db=require(_0xe14a('0x5'))['db'];var utils=require(_0xe14a('0x6'));var logger=require('../../config/logger')(_0xe14a('0x7'));var config=require(_0xe14a('0x8'));var jayson=require(_0xe14a('0x9'));var client=jayson[_0xe14a('0xa')][_0xe14a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x549598,_0x4b7cb8,_0x46deae){return new BPromise(function(_0x1d5514,_0x4f3148){return client['request'](_0x549598,_0x46deae)[_0xe14a('0xc')](function(_0x152539){logger[_0xe14a('0xd')](_0xe14a('0xe'),_0x4b7cb8,_0xe14a('0xf'));logger['debug'](_0xe14a('0x10'),_0x4b7cb8,_0xe14a('0xf'),JSON[_0xe14a('0x11')](_0x152539));if(_0x152539[_0xe14a('0x12')]){if(_0x152539[_0xe14a('0x12')][_0xe14a('0x13')]===0x1f4){logger[_0xe14a('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x4b7cb8,_0x152539['error']['message']);return _0x4f3148(_0x152539[_0xe14a('0x12')][_0xe14a('0x14')]);}logger[_0xe14a('0x12')](_0xe14a('0xe'),_0x4b7cb8,_0x152539[_0xe14a('0x12')][_0xe14a('0x14')]);return _0x1d5514(_0x152539[_0xe14a('0x12')]['message']);}else{logger[_0xe14a('0xd')](_0xe14a('0xe'),_0x4b7cb8,_0xe14a('0xf'));_0x1d5514(_0x152539[_0xe14a('0x15')][_0xe14a('0x14')]);}})[_0xe14a('0x16')](function(_0x33e91b){logger[_0xe14a('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x4b7cb8,_0x33e91b);_0x4f3148(_0x33e91b);});});}exports[_0xe14a('0x17')]=function(_0x337fbb){var _0x45a8bf=this;return new Promise(function(_0x2f2a5e,_0x3b035d){return db[_0xe14a('0x18')]['findAll']({'raw':_0x337fbb['options']?_0x337fbb[_0xe14a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x337fbb[_0xe14a('0x19')]?_0x337fbb['options']['where']||null:null,'attributes':_0x337fbb[_0xe14a('0x19')]?_0x337fbb[_0xe14a('0x19')]['attributes']||null:null,'limit':_0x337fbb[_0xe14a('0x19')]?_0x337fbb[_0xe14a('0x19')]['limit']||null:null,'include':_0x337fbb['options']?_0x337fbb[_0xe14a('0x19')][_0xe14a('0x1a')]?_['map'](_0x337fbb[_0xe14a('0x19')][_0xe14a('0x1a')],function(_0x4a55fb){return{'model':db[_0x4a55fb[_0xe14a('0x1b')]],'as':_0x4a55fb['as'],'attributes':_0x4a55fb[_0xe14a('0x1c')],'include':_0x4a55fb[_0xe14a('0x1a')]?_[_0xe14a('0x1d')](_0x4a55fb['include'],function(_0x527a69){return{'model':db[_0x527a69[_0xe14a('0x1b')]],'as':_0x527a69['as'],'attributes':_0x527a69[_0xe14a('0x1c')],'include':_0x527a69['include']?_[_0xe14a('0x1d')](_0x527a69['include'],function(_0x2ff7e1){return{'model':db[_0x2ff7e1['model']],'as':_0x2ff7e1['as'],'attributes':_0x2ff7e1[_0xe14a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe14a('0xc')](function(_0x4029df){logger[_0xe14a('0xd')](_0xe14a('0x17'),_0x337fbb);logger[_0xe14a('0x1e')](_0xe14a('0x17'),_0x337fbb,JSON[_0xe14a('0x11')](_0x4029df));_0x2f2a5e(_0x4029df);})[_0xe14a('0x16')](function(_0x2f34d3){logger[_0xe14a('0x12')](_0xe14a('0x17'),_0x2f34d3['message'],_0x337fbb);_0x3b035d(_0x45a8bf['error'](0x1f4,_0x2f34d3['message']));});});};exports[_0xe14a('0x1f')]=function(_0x3668ac){var _0x4055ae=this;return new Promise(function(_0x21090b,_0x5e548d){return db[_0xe14a('0x18')][_0xe14a('0x20')]({'raw':_0x3668ac[_0xe14a('0x19')]?_0x3668ac[_0xe14a('0x19')][_0xe14a('0x21')]===undefined?!![]:![]:!![],'where':_0x3668ac['options']?_0x3668ac[_0xe14a('0x19')]['where']||null:null,'attributes':_0x3668ac[_0xe14a('0x19')]?_0x3668ac[_0xe14a('0x19')]['attributes']||null:null,'include':_0x3668ac[_0xe14a('0x19')]?_0x3668ac[_0xe14a('0x19')][_0xe14a('0x1a')]?_[_0xe14a('0x1d')](_0x3668ac[_0xe14a('0x19')]['include'],function(_0x2af5a6){return{'model':db[_0x2af5a6[_0xe14a('0x1b')]],'as':_0x2af5a6['as'],'attributes':_0x2af5a6['attributes'],'include':_0x2af5a6[_0xe14a('0x1a')]?_[_0xe14a('0x1d')](_0x2af5a6['include'],function(_0x472245){return{'model':db[_0x472245['model']],'as':_0x472245['as'],'attributes':_0x472245[_0xe14a('0x1c')],'include':_0x472245[_0xe14a('0x1a')]?_[_0xe14a('0x1d')](_0x472245[_0xe14a('0x1a')],function(_0x2b8d7c){return{'model':db[_0x2b8d7c[_0xe14a('0x1b')]],'as':_0x2b8d7c['as'],'attributes':_0x2b8d7c[_0xe14a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x373610){logger['info'](_0xe14a('0x1f'),_0x3668ac);logger[_0xe14a('0x1e')]('ShowSalesforceAccount',_0x3668ac,JSON['stringify'](_0x373610));_0x21090b(_0x373610);})['catch'](function(_0x4530e7){logger['error'](_0xe14a('0x1f'),_0x4530e7['message'],_0x3668ac);_0x5e548d(_0x4055ae[_0xe14a('0x12')](0x1f4,_0x4530e7[_0xe14a('0x14')]));});});}; \ No newline at end of file +var _0x5120=['http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSalesforceAccount','options','where','attributes','limit','include','map','model','stringify','catch','ShowSalesforceAccount','SalesforceAccount','find','lodash','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x365950,_0x3f41e6){var _0xc258b7=function(_0xba9e87){while(--_0xba9e87){_0x365950['push'](_0x365950['shift']());}};_0xc258b7(++_0x3f41e6);}(_0x5120,0xdf));var _0x0512=function(_0x4c6bca,_0x3de390){_0x4c6bca=_0x4c6bca-0x0;var _0x29d58e=_0x5120[_0x4c6bca];return _0x29d58e;};'use strict';var _=require(_0x0512('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0512('0x1'));var rs=require(_0x0512('0x2'));var fs=require('fs');var Redis=require(_0x0512('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0512('0x4'))('rpc');var config=require(_0x0512('0x5'));var jayson=require(_0x0512('0x6'));var client=jayson[_0x0512('0x7')][_0x0512('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xafc18e,_0x5d54e0,_0x5492a6){return new BPromise(function(_0x2a3e64,_0x189739){return client[_0x0512('0x9')](_0xafc18e,_0x5492a6)[_0x0512('0xa')](function(_0x4bcf40){logger[_0x0512('0xb')](_0x0512('0xc'),_0x5d54e0,_0x0512('0xd'));logger[_0x0512('0xe')](_0x0512('0xf'),_0x5d54e0,_0x0512('0xd'),JSON['stringify'](_0x4bcf40));if(_0x4bcf40[_0x0512('0x10')]){if(_0x4bcf40[_0x0512('0x10')][_0x0512('0x11')]===0x1f4){logger[_0x0512('0x10')](_0x0512('0xc'),_0x5d54e0,_0x4bcf40['error'][_0x0512('0x12')]);return _0x189739(_0x4bcf40[_0x0512('0x10')][_0x0512('0x12')]);}logger[_0x0512('0x10')](_0x0512('0xc'),_0x5d54e0,_0x4bcf40[_0x0512('0x10')][_0x0512('0x12')]);return _0x2a3e64(_0x4bcf40[_0x0512('0x10')]['message']);}else{logger[_0x0512('0xb')](_0x0512('0xc'),_0x5d54e0,_0x0512('0xd'));_0x2a3e64(_0x4bcf40[_0x0512('0x13')][_0x0512('0x12')]);}})['catch'](function(_0x1d28c9){logger[_0x0512('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x5d54e0,_0x1d28c9);_0x189739(_0x1d28c9);});});}exports[_0x0512('0x14')]=function(_0x478f85){var _0x2523ca=this;return new Promise(function(_0x236ea9,_0x37eac0){return db['SalesforceAccount']['findAll']({'raw':_0x478f85[_0x0512('0x15')]?_0x478f85[_0x0512('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x478f85['options']?_0x478f85[_0x0512('0x15')][_0x0512('0x16')]||null:null,'attributes':_0x478f85[_0x0512('0x15')]?_0x478f85[_0x0512('0x15')][_0x0512('0x17')]||null:null,'limit':_0x478f85[_0x0512('0x15')]?_0x478f85[_0x0512('0x15')][_0x0512('0x18')]||null:null,'include':_0x478f85[_0x0512('0x15')]?_0x478f85[_0x0512('0x15')][_0x0512('0x19')]?_[_0x0512('0x1a')](_0x478f85[_0x0512('0x15')][_0x0512('0x19')],function(_0x56a9be){return{'model':db[_0x56a9be[_0x0512('0x1b')]],'as':_0x56a9be['as'],'attributes':_0x56a9be[_0x0512('0x17')],'include':_0x56a9be[_0x0512('0x19')]?_['map'](_0x56a9be[_0x0512('0x19')],function(_0x3e229e){return{'model':db[_0x3e229e[_0x0512('0x1b')]],'as':_0x3e229e['as'],'attributes':_0x3e229e['attributes'],'include':_0x3e229e[_0x0512('0x19')]?_[_0x0512('0x1a')](_0x3e229e[_0x0512('0x19')],function(_0xb784f5){return{'model':db[_0xb784f5[_0x0512('0x1b')]],'as':_0xb784f5['as'],'attributes':_0xb784f5[_0x0512('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0512('0xa')](function(_0x45130a){logger[_0x0512('0xb')](_0x0512('0x14'),_0x478f85);logger[_0x0512('0xe')](_0x0512('0x14'),_0x478f85,JSON[_0x0512('0x1c')](_0x45130a));_0x236ea9(_0x45130a);})[_0x0512('0x1d')](function(_0x4578a2){logger[_0x0512('0x10')]('GetSalesforceAccount',_0x4578a2[_0x0512('0x12')],_0x478f85);_0x37eac0(_0x2523ca[_0x0512('0x10')](0x1f4,_0x4578a2[_0x0512('0x12')]));});});};exports[_0x0512('0x1e')]=function(_0x1c9ef7){var _0xbdb841=this;return new Promise(function(_0x536aaa,_0xe31514){return db[_0x0512('0x1f')][_0x0512('0x20')]({'raw':_0x1c9ef7[_0x0512('0x15')]?_0x1c9ef7[_0x0512('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1c9ef7['options']?_0x1c9ef7[_0x0512('0x15')]['where']||null:null,'attributes':_0x1c9ef7[_0x0512('0x15')]?_0x1c9ef7['options']['attributes']||null:null,'include':_0x1c9ef7[_0x0512('0x15')]?_0x1c9ef7[_0x0512('0x15')][_0x0512('0x19')]?_[_0x0512('0x1a')](_0x1c9ef7[_0x0512('0x15')]['include'],function(_0x4ad08a){return{'model':db[_0x4ad08a[_0x0512('0x1b')]],'as':_0x4ad08a['as'],'attributes':_0x4ad08a[_0x0512('0x17')],'include':_0x4ad08a[_0x0512('0x19')]?_['map'](_0x4ad08a[_0x0512('0x19')],function(_0x23647a){return{'model':db[_0x23647a[_0x0512('0x1b')]],'as':_0x23647a['as'],'attributes':_0x23647a[_0x0512('0x17')],'include':_0x23647a[_0x0512('0x19')]?_['map'](_0x23647a['include'],function(_0x5d7b6e){return{'model':db[_0x5d7b6e[_0x0512('0x1b')]],'as':_0x5d7b6e['as'],'attributes':_0x5d7b6e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x612848){logger[_0x0512('0xb')](_0x0512('0x1e'),_0x1c9ef7);logger[_0x0512('0xe')](_0x0512('0x1e'),_0x1c9ef7,JSON[_0x0512('0x1c')](_0x612848));_0x536aaa(_0x612848);})[_0x0512('0x1d')](function(_0x7052ab){logger[_0x0512('0x10')](_0x0512('0x1e'),_0x7052ab[_0x0512('0x12')],_0x1c9ef7);_0xe31514(_0xbdb841[_0x0512('0x10')](0x1f4,_0x7052ab['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 294fe37..f7ad1cf 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x313699,_0x1f5682){var _0x3e2622=function(_0x4140eb){while(--_0x4140eb){_0x313699['push'](_0x313699['shift']());}};_0x3e2622(++_0x1f5682);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x5151bb,_0x37d8df){var _0x4ea1c3=function(_0x5c1351){while(--_0x5c1351){_0x5151bb['push'](_0x5151bb['shift']());}};_0x4ea1c3(++_0x37d8df);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e7571,_0x29f411){_0x5e7571=_0x5e7571-0x0;var _0x20f4c4=_0x2ef3[_0x5e7571];return _0x20f4c4;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index fce58d4..53ead92 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 _0xcefc=['Case','Task','contact_lead','contact','lead','account_contact_lead','account','STRING','sequelize','ENUM'];(function(_0x23af01,_0xd7ef42){var _0x485dfc=function(_0x345dd4){while(--_0x345dd4){_0x23af01['push'](_0x23af01['shift']());}};_0x485dfc(++_0xd7ef42);}(_0xcefc,0x1f2));var _0xccef=function(_0x25eff5,_0x52c112){_0x25eff5=_0x25eff5-0x0;var _0x309e8b=_0xcefc[_0x25eff5];return _0x309e8b;};'use strict';var Sequelize=require(_0xccef('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xccef('0x1')]('Task',_0xccef('0x2')),'defaultValue':_0xccef('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xccef('0x4'),_0xccef('0x5'),_0xccef('0x6'),_0xccef('0x7'),_0xccef('0x8')),'defaultValue':_0xccef('0x4')},'moduleCreate':{'type':Sequelize[_0xccef('0x1')]('nothing',_0xccef('0x5'),'lead','account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xccef('0x9')]},'additionalSearchAccount':{'type':Sequelize[_0xccef('0x9')]},'additionalSearchContact':{'type':Sequelize[_0xccef('0x9')]},'additionalSearchLead':{'type':Sequelize[_0xccef('0x9')]}}; \ No newline at end of file +var _0x0cde=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account','nothing'];(function(_0x29a839,_0xde707){var _0x422d6c=function(_0x38fc3e){while(--_0x38fc3e){_0x29a839['push'](_0x29a839['shift']());}};_0x422d6c(++_0xde707);}(_0x0cde,0x181));var _0xe0cd=function(_0x4a1b43,_0x3462d2){_0x4a1b43=_0x4a1b43-0x0;var _0x3c11d7=_0x0cde[_0x4a1b43];return _0x3c11d7;};'use strict';var Sequelize=require(_0xe0cd('0x0'));module[_0xe0cd('0x1')]={'name':{'type':Sequelize[_0xe0cd('0x2')]},'description':{'type':Sequelize[_0xe0cd('0x2')]},'ticketType':{'type':Sequelize[_0xe0cd('0x3')](_0xe0cd('0x4'),_0xe0cd('0x5')),'defaultValue':_0xe0cd('0x4')},'moduleSearch':{'type':Sequelize[_0xe0cd('0x3')](_0xe0cd('0x6'),_0xe0cd('0x7'),_0xe0cd('0x8'),'account_contact_lead',_0xe0cd('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xe0cd('0x3')](_0xe0cd('0xa'),_0xe0cd('0x7'),'lead','account'),'defaultValue':_0xe0cd('0x8')},'leadId':{'type':Sequelize[_0xe0cd('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xe0cd('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xe0cd('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xe0cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index aacd323..1de726e 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 _0x02ed=['options','includeAll','findAll','rows','catch','show','include','create','body','find','params','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','sort','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','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','end','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','VIRTUAL','merge'];(function(_0x21c222,_0x406d0a){var _0x5ec82a=function(_0x11084a){while(--_0x11084a){_0x21c222['push'](_0x21c222['shift']());}};_0x5ec82a(++_0x406d0a);}(_0x02ed,0x152));var _0xd02e=function(_0x50f158,_0x1b49ef){_0x50f158=_0x50f158-0x0;var _0x380590=_0x02ed[_0x50f158];return _0x380590;};'use strict';var emlformat=require(_0xd02e('0x0'));var rimraf=require(_0xd02e('0x1'));var zipdir=require(_0xd02e('0x2'));var jsonpatch=require(_0xd02e('0x3'));var rp=require(_0xd02e('0x4'));var moment=require(_0xd02e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd02e('0x6'));var util=require(_0xd02e('0x7'));var path=require(_0xd02e('0x8'));var sox=require(_0xd02e('0x9'));var csv=require(_0xd02e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd02e('0xb'));var crypto=require('crypto');var jsforce=require(_0xd02e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd02e('0xa'));var querystring=require('querystring');var Papa=require(_0xd02e('0xd'));var Redis=require(_0xd02e('0xe'));var authService=require(_0xd02e('0xf'));var qs=require(_0xd02e('0x10'));var as=require(_0xd02e('0x11'));var hardwareService=require(_0xd02e('0x12'));var logger=require(_0xd02e('0x13'))(_0xd02e('0x14'));var utils=require('../../config/utils');var config=require(_0xd02e('0x15'));var licenseUtil=require(_0xd02e('0x16'));var db=require(_0xd02e('0x17'))['db'];function respondWithStatusCode(_0x4fb3aa,_0x3b8252){_0x3b8252=_0x3b8252||0xcc;return function(_0x4937ad){if(_0x4937ad){return _0x4fb3aa[_0xd02e('0x18')](_0x3b8252);}return _0x4fb3aa['status'](_0x3b8252)[_0xd02e('0x19')]();};}function respondWithResult(_0x59ed45,_0x19f54c){_0x19f54c=_0x19f54c||0xc8;return function(_0x167e1e){if(_0x167e1e){return _0x59ed45[_0xd02e('0x1a')](_0x19f54c)['json'](_0x167e1e);}};}function respondWithFilteredResult(_0x19d327,_0x15c74b){return function(_0x6a5805){if(_0x6a5805){var _0x2e5b8d=typeof _0x15c74b[_0xd02e('0x1b')]===_0xd02e('0x1c')&&typeof _0x15c74b[_0xd02e('0x1d')]==='undefined';var _0x393a62=_0x6a5805[_0xd02e('0x1e')];var _0x2fbfa1=_0x2e5b8d?0x0:_0x15c74b['offset'];var _0x3ea12f=_0x2e5b8d?_0x6a5805['count']:_0x15c74b[_0xd02e('0x1b')]+_0x15c74b[_0xd02e('0x1d')];var _0x1f8f12;if(_0x3ea12f>=_0x393a62){_0x3ea12f=_0x393a62;_0x1f8f12=0xc8;}else{_0x1f8f12=0xce;}_0x19d327[_0xd02e('0x1a')](_0x1f8f12);return _0x19d327[_0xd02e('0x1f')]('Content-Range',_0x2fbfa1+'-'+_0x3ea12f+'/'+_0x393a62)['json'](_0x6a5805);}return null;};}function patchUpdates(_0x20532b){return function(_0x1e5b76){try{jsonpatch[_0xd02e('0x20')](_0x1e5b76,_0x20532b,!![]);}catch(_0x44037d){return BPromise[_0xd02e('0x21')](_0x44037d);}return _0x1e5b76[_0xd02e('0x22')]();};}function saveUpdates(_0x2ac040,_0x27a26a){return function(_0x172cb9){if(_0x172cb9){return _0x172cb9[_0xd02e('0x23')](_0x2ac040)[_0xd02e('0x24')](function(_0x54b022){return _0x54b022;});}return null;};}function removeEntity(_0x3ca0b4,_0x2c7187){return function(_0x569a4d){if(_0x569a4d){return _0x569a4d[_0xd02e('0x25')]()[_0xd02e('0x24')](function(){_0x3ca0b4[_0xd02e('0x1a')](0xcc)[_0xd02e('0x19')]();});}};}function handleEntityNotFound(_0x59b744,_0x462d1f){return function(_0x293620){if(!_0x293620){_0x59b744[_0xd02e('0x18')](0x194);}return _0x293620;};}function handleError(_0x52c192,_0x36d7d3){_0x36d7d3=_0x36d7d3||0x1f4;return function(_0x3c7bf4){logger[_0xd02e('0x26')](_0x3c7bf4[_0xd02e('0x27')]);if(_0x3c7bf4[_0xd02e('0x28')]){delete _0x3c7bf4[_0xd02e('0x28')];}_0x52c192[_0xd02e('0x1a')](_0x36d7d3)[_0xd02e('0x29')](_0x3c7bf4);};}exports[_0xd02e('0x2a')]=function(_0x125feb,_0x442886){var _0x2cf3e1={},_0x2a2edb={},_0x44590b={'count':0x0,'rows':[]};var _0x3a6adb=_[_0xd02e('0x2b')](db[_0xd02e('0x2c')][_0xd02e('0x2d')],function(_0xb9aa70){return{'name':_0xb9aa70['fieldName'],'type':_0xb9aa70['type'][_0xd02e('0x2e')]};});_0x2a2edb[_0xd02e('0x2f')]=_['map'](_0x3a6adb,_0xd02e('0x28'));_0x2a2edb[_0xd02e('0x30')]=_[_0xd02e('0x31')](_0x125feb['query']);_0x2a2edb[_0xd02e('0x32')]=_[_0xd02e('0x33')](_0x2a2edb[_0xd02e('0x2f')],_0x2a2edb[_0xd02e('0x30')]);_0x2cf3e1[_0xd02e('0x34')]=_['intersection'](_0x2a2edb[_0xd02e('0x2f')],qs[_0xd02e('0x35')](_0x125feb[_0xd02e('0x30')]['fields']));_0x2cf3e1[_0xd02e('0x34')]=_0x2cf3e1[_0xd02e('0x34')][_0xd02e('0x36')]?_0x2cf3e1[_0xd02e('0x34')]:_0x2a2edb[_0xd02e('0x2f')];if(!_0x125feb[_0xd02e('0x30')]['hasOwnProperty'](_0xd02e('0x37'))){_0x2cf3e1['limit']=qs['limit'](_0x125feb['query']['limit']);_0x2cf3e1[_0xd02e('0x1b')]=qs[_0xd02e('0x1b')](_0x125feb[_0xd02e('0x30')][_0xd02e('0x1b')]);}_0x2cf3e1[_0xd02e('0x38')]=qs['sort'](_0x125feb[_0xd02e('0x30')]['sort']);_0x2cf3e1['where']=qs[_0xd02e('0x32')](_[_0xd02e('0x39')](_0x125feb[_0xd02e('0x30')],_0x2a2edb['filters']),_0x3a6adb);if(_0x125feb[_0xd02e('0x30')][_0xd02e('0x3a')]){_0x2cf3e1[_0xd02e('0x3b')]=_['merge'](_0x2cf3e1[_0xd02e('0x3b')],{'$or':_[_0xd02e('0x2b')](_0x3a6adb,function(_0x14da03){if(_0x14da03['type']!==_0xd02e('0x3c')){var _0x18b964={};_0x18b964[_0x14da03[_0xd02e('0x28')]]={'$like':'%'+_0x125feb[_0xd02e('0x30')]['filter']+'%'};return _0x18b964;}})});}_0x2cf3e1=_[_0xd02e('0x3d')]({},_0x2cf3e1,_0x125feb[_0xd02e('0x3e')]);var _0x49585f={'where':_0x2cf3e1[_0xd02e('0x3b')]};return db[_0xd02e('0x2c')][_0xd02e('0x1e')](_0x49585f)['then'](function(_0x37716c){_0x44590b[_0xd02e('0x1e')]=_0x37716c;if(_0x125feb[_0xd02e('0x30')][_0xd02e('0x3f')]){_0x2cf3e1['include']=[{'all':!![]}];}return db[_0xd02e('0x2c')][_0xd02e('0x40')](_0x2cf3e1);})['then'](function(_0x1dd8d3){_0x44590b[_0xd02e('0x41')]=_0x1dd8d3;return _0x44590b;})['then'](respondWithFilteredResult(_0x442886,_0x2cf3e1))[_0xd02e('0x42')](handleError(_0x442886,null));};exports[_0xd02e('0x43')]=function(_0x40601c,_0x7d9f15){var _0x1890ba={'raw':![],'where':{'id':_0x40601c['params']['id']}},_0x23d9e1={};_0x23d9e1[_0xd02e('0x2f')]=_[_0xd02e('0x31')](db['SalesforceConfiguration'][_0xd02e('0x2d')]);_0x23d9e1[_0xd02e('0x30')]=_['keys'](_0x40601c['query']);_0x23d9e1[_0xd02e('0x32')]=_[_0xd02e('0x33')](_0x23d9e1['model'],_0x23d9e1[_0xd02e('0x30')]);_0x1890ba['attributes']=_[_0xd02e('0x33')](_0x23d9e1[_0xd02e('0x2f')],qs[_0xd02e('0x35')](_0x40601c[_0xd02e('0x30')][_0xd02e('0x35')]));_0x1890ba[_0xd02e('0x34')]=_0x1890ba[_0xd02e('0x34')]['length']?_0x1890ba[_0xd02e('0x34')]:_0x23d9e1[_0xd02e('0x2f')];if(_0x40601c['query']['includeAll']){_0x1890ba[_0xd02e('0x44')]=[{'all':!![]}];}_0x1890ba=_[_0xd02e('0x3d')]({},_0x1890ba,_0x40601c[_0xd02e('0x3e')]);return db[_0xd02e('0x2c')]['find'](_0x1890ba)[_0xd02e('0x24')](handleEntityNotFound(_0x7d9f15,null))['then'](respondWithResult(_0x7d9f15,null))[_0xd02e('0x42')](handleError(_0x7d9f15,null));};exports[_0xd02e('0x45')]=function(_0x3c0585,_0x4451f0){return db[_0xd02e('0x2c')]['create'](_0x3c0585[_0xd02e('0x46')],{})[_0xd02e('0x24')](respondWithResult(_0x4451f0,0xc9))[_0xd02e('0x42')](handleError(_0x4451f0,null));};exports[_0xd02e('0x23')]=function(_0xa09546,_0x16bce0){if(_0xa09546['body']['id']){delete _0xa09546[_0xd02e('0x46')]['id'];}return db[_0xd02e('0x2c')][_0xd02e('0x47')]({'where':{'id':_0xa09546[_0xd02e('0x48')]['id']}})[_0xd02e('0x24')](handleEntityNotFound(_0x16bce0,null))['then'](saveUpdates(_0xa09546[_0xd02e('0x46')],null))[_0xd02e('0x24')](respondWithResult(_0x16bce0,null))[_0xd02e('0x42')](handleError(_0x16bce0,null));};exports[_0xd02e('0x25')]=function(_0x5801fc,_0x183ac7){return db['SalesforceConfiguration'][_0xd02e('0x47')]({'where':{'id':_0x5801fc[_0xd02e('0x48')]['id']}})[_0xd02e('0x24')](handleEntityNotFound(_0x183ac7,null))['then'](removeEntity(_0x183ac7,null))[_0xd02e('0x42')](handleError(_0x183ac7,null));};exports[_0xd02e('0x49')]=function(_0x230fe4,_0x49c049,_0x4368ff){var _0x426465={};var _0x567684={};var _0x4e02eb;var _0x48d4b7;return db[_0xd02e('0x2c')][_0xd02e('0x4a')]({'where':{'id':_0x230fe4[_0xd02e('0x48')]['id']}})[_0xd02e('0x24')](handleEntityNotFound(_0x49c049,null))[_0xd02e('0x24')](function(_0x358829){if(_0x358829){_0x4e02eb=_0x358829;_0x567684[_0xd02e('0x2f')]=_[_0xd02e('0x31')](db[_0xd02e('0x4b')][_0xd02e('0x2d')]);_0x567684[_0xd02e('0x30')]=_[_0xd02e('0x31')](_0x230fe4[_0xd02e('0x30')]);_0x567684[_0xd02e('0x32')]=_[_0xd02e('0x33')](_0x567684['model'],_0x567684[_0xd02e('0x30')]);_0x426465[_0xd02e('0x34')]=_[_0xd02e('0x33')](_0x567684[_0xd02e('0x2f')],qs['fields'](_0x230fe4[_0xd02e('0x30')][_0xd02e('0x35')]));_0x426465[_0xd02e('0x34')]=_0x426465[_0xd02e('0x34')][_0xd02e('0x36')]?_0x426465[_0xd02e('0x34')]:_0x567684[_0xd02e('0x2f')];_0x426465[_0xd02e('0x38')]=qs['sort'](_0x230fe4[_0xd02e('0x30')]['sort']);_0x426465[_0xd02e('0x3b')]=qs[_0xd02e('0x32')](_[_0xd02e('0x39')](_0x230fe4[_0xd02e('0x30')],_0x567684[_0xd02e('0x32')]));if(_0x230fe4['query']['filter']){_0x426465['where']=_['merge'](_0x426465['where'],{'$or':_[_0xd02e('0x2b')](_0x426465[_0xd02e('0x34')],function(_0x48b3ce){var _0x2aa146={};_0x2aa146[_0x48b3ce]={'$like':'%'+_0x230fe4['query'][_0xd02e('0x3a')]+'%'};return _0x2aa146;})});}_0x426465=_['merge']({},_0x426465,_0x230fe4[_0xd02e('0x3e')]);return _0x4e02eb['getFields'](_0x426465);}})[_0xd02e('0x24')](function(_0x10dcac){if(_0x10dcac){_0x48d4b7=_0x10dcac['length'];if(!_0x230fe4[_0xd02e('0x30')][_0xd02e('0x4c')](_0xd02e('0x37'))){_0x426465['limit']=qs[_0xd02e('0x1d')](_0x230fe4[_0xd02e('0x30')][_0xd02e('0x1d')]);_0x426465[_0xd02e('0x1b')]=qs[_0xd02e('0x1b')](_0x230fe4[_0xd02e('0x30')][_0xd02e('0x1b')]);}return _0x4e02eb[_0xd02e('0x49')](_0x426465);}})['then'](function(_0x2d8f5d){if(_0x2d8f5d){return _0x2d8f5d?{'count':_0x48d4b7,'rows':_0x2d8f5d}:null;}})['then'](respondWithResult(_0x49c049,null))[_0xd02e('0x42')](handleError(_0x49c049,null));};exports[_0xd02e('0x4d')]=function(_0x2d461f,_0x100d32,_0xf17b8){var _0x29da35={};var _0x3d029e={};var _0x5dfcad;var _0x1ac076;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x2d461f[_0xd02e('0x48')]['id']}})[_0xd02e('0x24')](handleEntityNotFound(_0x100d32,null))[_0xd02e('0x24')](function(_0x28ef31){if(_0x28ef31){_0x5dfcad=_0x28ef31;_0x3d029e[_0xd02e('0x2f')]=_['keys'](db[_0xd02e('0x4b')][_0xd02e('0x2d')]);_0x3d029e[_0xd02e('0x30')]=_[_0xd02e('0x31')](_0x2d461f[_0xd02e('0x30')]);_0x3d029e[_0xd02e('0x32')]=_[_0xd02e('0x33')](_0x3d029e[_0xd02e('0x2f')],_0x3d029e[_0xd02e('0x30')]);_0x29da35['attributes']=_[_0xd02e('0x33')](_0x3d029e[_0xd02e('0x2f')],qs['fields'](_0x2d461f[_0xd02e('0x30')][_0xd02e('0x35')]));_0x29da35['attributes']=_0x29da35['attributes']['length']?_0x29da35[_0xd02e('0x34')]:_0x3d029e[_0xd02e('0x2f')];_0x29da35[_0xd02e('0x38')]=qs[_0xd02e('0x4e')](_0x2d461f['query'][_0xd02e('0x4e')]);_0x29da35[_0xd02e('0x3b')]=qs[_0xd02e('0x32')](_['pick'](_0x2d461f[_0xd02e('0x30')],_0x3d029e[_0xd02e('0x32')]));if(_0x2d461f[_0xd02e('0x30')][_0xd02e('0x3a')]){_0x29da35['where']=_[_0xd02e('0x3d')](_0x29da35[_0xd02e('0x3b')],{'$or':_[_0xd02e('0x2b')](_0x29da35[_0xd02e('0x34')],function(_0x3355bb){var _0x4a8017={};_0x4a8017[_0x3355bb]={'$like':'%'+_0x2d461f['query'][_0xd02e('0x3a')]+'%'};return _0x4a8017;})});}_0x29da35=_['merge']({},_0x29da35,_0x2d461f[_0xd02e('0x3e')]);return _0x5dfcad[_0xd02e('0x4d')](_0x29da35);}})['then'](function(_0xd38599){if(_0xd38599){_0x1ac076=_0xd38599[_0xd02e('0x36')];if(!_0x2d461f['query'][_0xd02e('0x4c')]('nolimit')){_0x29da35[_0xd02e('0x1d')]=qs[_0xd02e('0x1d')](_0x2d461f[_0xd02e('0x30')][_0xd02e('0x1d')]);_0x29da35[_0xd02e('0x1b')]=qs['offset'](_0x2d461f[_0xd02e('0x30')]['offset']);}return _0x5dfcad[_0xd02e('0x4d')](_0x29da35);}})[_0xd02e('0x24')](function(_0x430c4a){if(_0x430c4a){return _0x430c4a?{'count':_0x1ac076,'rows':_0x430c4a}:null;}})[_0xd02e('0x24')](respondWithResult(_0x100d32,null))[_0xd02e('0x42')](handleError(_0x100d32,null));};exports['getDescriptions']=function(_0x3fe52d,_0x13c341,_0x30f705){var _0x42e5a3={};var _0x370556={};var _0x1efbae;var _0x9caa3d;return db[_0xd02e('0x2c')]['findOne']({'where':{'id':_0x3fe52d[_0xd02e('0x48')]['id']}})[_0xd02e('0x24')](handleEntityNotFound(_0x13c341,null))['then'](function(_0x329dcf){if(_0x329dcf){_0x1efbae=_0x329dcf;_0x370556[_0xd02e('0x2f')]=_[_0xd02e('0x31')](db[_0xd02e('0x4b')][_0xd02e('0x2d')]);_0x370556['query']=_[_0xd02e('0x31')](_0x3fe52d[_0xd02e('0x30')]);_0x370556[_0xd02e('0x32')]=_['intersection'](_0x370556['model'],_0x370556['query']);_0x42e5a3[_0xd02e('0x34')]=_[_0xd02e('0x33')](_0x370556[_0xd02e('0x2f')],qs[_0xd02e('0x35')](_0x3fe52d[_0xd02e('0x30')][_0xd02e('0x35')]));_0x42e5a3[_0xd02e('0x34')]=_0x42e5a3[_0xd02e('0x34')][_0xd02e('0x36')]?_0x42e5a3[_0xd02e('0x34')]:_0x370556[_0xd02e('0x2f')];_0x42e5a3[_0xd02e('0x38')]=qs['sort'](_0x3fe52d[_0xd02e('0x30')][_0xd02e('0x4e')]);_0x42e5a3[_0xd02e('0x3b')]=qs[_0xd02e('0x32')](_[_0xd02e('0x39')](_0x3fe52d[_0xd02e('0x30')],_0x370556['filters']));if(_0x3fe52d[_0xd02e('0x30')][_0xd02e('0x3a')]){_0x42e5a3[_0xd02e('0x3b')]=_['merge'](_0x42e5a3[_0xd02e('0x3b')],{'$or':_[_0xd02e('0x2b')](_0x42e5a3[_0xd02e('0x34')],function(_0x1ba5b9){var _0x569ae1={};_0x569ae1[_0x1ba5b9]={'$like':'%'+_0x3fe52d[_0xd02e('0x30')][_0xd02e('0x3a')]+'%'};return _0x569ae1;})});}_0x42e5a3=_[_0xd02e('0x3d')]({},_0x42e5a3,_0x3fe52d[_0xd02e('0x3e')]);return _0x1efbae[_0xd02e('0x4f')](_0x42e5a3);}})[_0xd02e('0x24')](function(_0x44b685){if(_0x44b685){_0x9caa3d=_0x44b685[_0xd02e('0x36')];if(!_0x3fe52d[_0xd02e('0x30')][_0xd02e('0x4c')](_0xd02e('0x37'))){_0x42e5a3['limit']=qs[_0xd02e('0x1d')](_0x3fe52d[_0xd02e('0x30')][_0xd02e('0x1d')]);_0x42e5a3[_0xd02e('0x1b')]=qs[_0xd02e('0x1b')](_0x3fe52d[_0xd02e('0x30')]['offset']);}return _0x1efbae[_0xd02e('0x4f')](_0x42e5a3);}})['then'](function(_0x4e684c){if(_0x4e684c){return _0x4e684c?{'count':_0x9caa3d,'rows':_0x4e684c}:null;}})[_0xd02e('0x24')](respondWithResult(_0x13c341,null))['catch'](handleError(_0x13c341,null));}; \ No newline at end of file +var _0x6e34=['params','keys','length','find','create','body','update','getFields','SalesforceField','sort','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show'];(function(_0x245cb3,_0xcc77d4){var _0x98946b=function(_0x18b9da){while(--_0x18b9da){_0x245cb3['push'](_0x245cb3['shift']());}};_0x98946b(++_0xcc77d4);}(_0x6e34,0x159));var _0x46e3=function(_0x25d01d,_0x2b0b44){_0x25d01d=_0x25d01d-0x0;var _0x5c741d=_0x6e34[_0x25d01d];return _0x5c741d;};'use strict';var emlformat=require(_0x46e3('0x0'));var rimraf=require(_0x46e3('0x1'));var zipdir=require(_0x46e3('0x2'));var jsonpatch=require(_0x46e3('0x3'));var rp=require('request-promise');var moment=require(_0x46e3('0x4'));var BPromise=require(_0x46e3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x46e3('0x6'));var sox=require('sox');var csv=require(_0x46e3('0x7'));var ejs=require(_0x46e3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46e3('0x9'));var squel=require(_0x46e3('0xa'));var crypto=require(_0x46e3('0xb'));var jsforce=require(_0x46e3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x46e3('0x7'));var querystring=require(_0x46e3('0xd'));var Papa=require(_0x46e3('0xe'));var Redis=require(_0x46e3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x46e3('0x10'));var as=require(_0x46e3('0x11'));var hardwareService=require(_0x46e3('0x12'));var logger=require(_0x46e3('0x13'))(_0x46e3('0x14'));var utils=require(_0x46e3('0x15'));var config=require(_0x46e3('0x16'));var licenseUtil=require(_0x46e3('0x17'));var db=require(_0x46e3('0x18'))['db'];function respondWithStatusCode(_0x2ad7d4,_0x5374de){_0x5374de=_0x5374de||0xcc;return function(_0x30b37a){if(_0x30b37a){return _0x2ad7d4[_0x46e3('0x19')](_0x5374de);}return _0x2ad7d4['status'](_0x5374de)[_0x46e3('0x1a')]();};}function respondWithResult(_0x2393e0,_0x27fc34){_0x27fc34=_0x27fc34||0xc8;return function(_0x3607e1){if(_0x3607e1){return _0x2393e0[_0x46e3('0x1b')](_0x27fc34)[_0x46e3('0x1c')](_0x3607e1);}};}function respondWithFilteredResult(_0x3fad45,_0x283eb7){return function(_0x4a78e7){if(_0x4a78e7){var _0x244d3d=typeof _0x283eb7[_0x46e3('0x1d')]===_0x46e3('0x1e')&&typeof _0x283eb7[_0x46e3('0x1f')]===_0x46e3('0x1e');var _0x47ae2f=_0x4a78e7[_0x46e3('0x20')];var _0x259c3f=_0x244d3d?0x0:_0x283eb7[_0x46e3('0x1d')];var _0x45eafe=_0x244d3d?_0x4a78e7['count']:_0x283eb7[_0x46e3('0x1d')]+_0x283eb7[_0x46e3('0x1f')];var _0x4ab44d;if(_0x45eafe>=_0x47ae2f){_0x45eafe=_0x47ae2f;_0x4ab44d=0xc8;}else{_0x4ab44d=0xce;}_0x3fad45['status'](_0x4ab44d);return _0x3fad45[_0x46e3('0x21')](_0x46e3('0x22'),_0x259c3f+'-'+_0x45eafe+'/'+_0x47ae2f)[_0x46e3('0x1c')](_0x4a78e7);}return null;};}function patchUpdates(_0x3de053){return function(_0x44fb95){try{jsonpatch[_0x46e3('0x23')](_0x44fb95,_0x3de053,!![]);}catch(_0x55d733){return BPromise[_0x46e3('0x24')](_0x55d733);}return _0x44fb95[_0x46e3('0x25')]();};}function saveUpdates(_0x2e219f,_0x2f817a){return function(_0x16c4b7){if(_0x16c4b7){return _0x16c4b7['update'](_0x2e219f)[_0x46e3('0x26')](function(_0x29d713){return _0x29d713;});}return null;};}function removeEntity(_0x251a1f,_0x53ccc4){return function(_0x3d3190){if(_0x3d3190){return _0x3d3190[_0x46e3('0x27')]()[_0x46e3('0x26')](function(){_0x251a1f[_0x46e3('0x1b')](0xcc)[_0x46e3('0x1a')]();});}};}function handleEntityNotFound(_0x5c8d4e,_0x2d2816){return function(_0x16c777){if(!_0x16c777){_0x5c8d4e[_0x46e3('0x19')](0x194);}return _0x16c777;};}function handleError(_0x564e12,_0x427ca3){_0x427ca3=_0x427ca3||0x1f4;return function(_0x2a1726){logger[_0x46e3('0x28')](_0x2a1726[_0x46e3('0x29')]);if(_0x2a1726[_0x46e3('0x2a')]){delete _0x2a1726[_0x46e3('0x2a')];}_0x564e12[_0x46e3('0x1b')](_0x427ca3)[_0x46e3('0x2b')](_0x2a1726);};}exports[_0x46e3('0x2c')]=function(_0x287e11,_0x31e91a){var _0xd15ad5={},_0x1c8b1c={},_0x86b742={'count':0x0,'rows':[]};var _0x5a8e99=_[_0x46e3('0x2d')](db[_0x46e3('0x2e')][_0x46e3('0x2f')],function(_0x141993){return{'name':_0x141993[_0x46e3('0x30')],'type':_0x141993[_0x46e3('0x31')][_0x46e3('0x32')]};});_0x1c8b1c[_0x46e3('0x33')]=_[_0x46e3('0x2d')](_0x5a8e99,'name');_0x1c8b1c[_0x46e3('0x34')]=_['keys'](_0x287e11[_0x46e3('0x34')]);_0x1c8b1c[_0x46e3('0x35')]=_['intersection'](_0x1c8b1c[_0x46e3('0x33')],_0x1c8b1c['query']);_0xd15ad5['attributes']=_[_0x46e3('0x36')](_0x1c8b1c['model'],qs[_0x46e3('0x37')](_0x287e11[_0x46e3('0x34')][_0x46e3('0x37')]));_0xd15ad5[_0x46e3('0x38')]=_0xd15ad5[_0x46e3('0x38')]['length']?_0xd15ad5[_0x46e3('0x38')]:_0x1c8b1c[_0x46e3('0x33')];if(!_0x287e11[_0x46e3('0x34')][_0x46e3('0x39')](_0x46e3('0x3a'))){_0xd15ad5[_0x46e3('0x1f')]=qs[_0x46e3('0x1f')](_0x287e11[_0x46e3('0x34')]['limit']);_0xd15ad5[_0x46e3('0x1d')]=qs[_0x46e3('0x1d')](_0x287e11[_0x46e3('0x34')][_0x46e3('0x1d')]);}_0xd15ad5[_0x46e3('0x3b')]=qs['sort'](_0x287e11[_0x46e3('0x34')]['sort']);_0xd15ad5[_0x46e3('0x3c')]=qs[_0x46e3('0x35')](_[_0x46e3('0x3d')](_0x287e11[_0x46e3('0x34')],_0x1c8b1c[_0x46e3('0x35')]),_0x5a8e99);if(_0x287e11[_0x46e3('0x34')]['filter']){_0xd15ad5[_0x46e3('0x3c')]=_[_0x46e3('0x3e')](_0xd15ad5['where'],{'$or':_['map'](_0x5a8e99,function(_0x266b00){if(_0x266b00[_0x46e3('0x31')]!==_0x46e3('0x3f')){var _0x3263d6={};_0x3263d6[_0x266b00['name']]={'$like':'%'+_0x287e11['query'][_0x46e3('0x40')]+'%'};return _0x3263d6;}})});}_0xd15ad5=_['merge']({},_0xd15ad5,_0x287e11[_0x46e3('0x41')]);var _0x2a21b7={'where':_0xd15ad5[_0x46e3('0x3c')]};return db[_0x46e3('0x2e')][_0x46e3('0x20')](_0x2a21b7)[_0x46e3('0x26')](function(_0x3685f4){_0x86b742['count']=_0x3685f4;if(_0x287e11['query'][_0x46e3('0x42')]){_0xd15ad5['include']=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0xd15ad5);})[_0x46e3('0x26')](function(_0x58595e){_0x86b742[_0x46e3('0x43')]=_0x58595e;return _0x86b742;})['then'](respondWithFilteredResult(_0x31e91a,_0xd15ad5))[_0x46e3('0x44')](handleError(_0x31e91a,null));};exports[_0x46e3('0x45')]=function(_0x4c437a,_0x1eda35){var _0x1f8d33={'raw':![],'where':{'id':_0x4c437a[_0x46e3('0x46')]['id']}},_0x2a3bf2={};_0x2a3bf2[_0x46e3('0x33')]=_[_0x46e3('0x47')](db[_0x46e3('0x2e')]['rawAttributes']);_0x2a3bf2[_0x46e3('0x34')]=_[_0x46e3('0x47')](_0x4c437a[_0x46e3('0x34')]);_0x2a3bf2['filters']=_['intersection'](_0x2a3bf2['model'],_0x2a3bf2[_0x46e3('0x34')]);_0x1f8d33[_0x46e3('0x38')]=_[_0x46e3('0x36')](_0x2a3bf2[_0x46e3('0x33')],qs[_0x46e3('0x37')](_0x4c437a[_0x46e3('0x34')][_0x46e3('0x37')]));_0x1f8d33['attributes']=_0x1f8d33[_0x46e3('0x38')][_0x46e3('0x48')]?_0x1f8d33[_0x46e3('0x38')]:_0x2a3bf2[_0x46e3('0x33')];if(_0x4c437a['query'][_0x46e3('0x42')]){_0x1f8d33['include']=[{'all':!![]}];}_0x1f8d33=_[_0x46e3('0x3e')]({},_0x1f8d33,_0x4c437a[_0x46e3('0x41')]);return db[_0x46e3('0x2e')][_0x46e3('0x49')](_0x1f8d33)['then'](handleEntityNotFound(_0x1eda35,null))[_0x46e3('0x26')](respondWithResult(_0x1eda35,null))[_0x46e3('0x44')](handleError(_0x1eda35,null));};exports[_0x46e3('0x4a')]=function(_0x3e2d95,_0x3f334b){return db[_0x46e3('0x2e')][_0x46e3('0x4a')](_0x3e2d95[_0x46e3('0x4b')],{})[_0x46e3('0x26')](respondWithResult(_0x3f334b,0xc9))[_0x46e3('0x44')](handleError(_0x3f334b,null));};exports[_0x46e3('0x4c')]=function(_0x31c68f,_0x37fcaf){if(_0x31c68f['body']['id']){delete _0x31c68f[_0x46e3('0x4b')]['id'];}return db[_0x46e3('0x2e')][_0x46e3('0x49')]({'where':{'id':_0x31c68f[_0x46e3('0x46')]['id']}})[_0x46e3('0x26')](handleEntityNotFound(_0x37fcaf,null))[_0x46e3('0x26')](saveUpdates(_0x31c68f['body'],null))[_0x46e3('0x26')](respondWithResult(_0x37fcaf,null))['catch'](handleError(_0x37fcaf,null));};exports[_0x46e3('0x27')]=function(_0x434d7b,_0x471786){return db['SalesforceConfiguration'][_0x46e3('0x49')]({'where':{'id':_0x434d7b[_0x46e3('0x46')]['id']}})[_0x46e3('0x26')](handleEntityNotFound(_0x471786,null))[_0x46e3('0x26')](removeEntity(_0x471786,null))[_0x46e3('0x44')](handleError(_0x471786,null));};exports[_0x46e3('0x4d')]=function(_0x58b581,_0x50743c,_0x319b6a){var _0x5a27aa={};var _0x2c03cc={};var _0x486c04;var _0x15d696;return db[_0x46e3('0x2e')]['findOne']({'where':{'id':_0x58b581[_0x46e3('0x46')]['id']}})['then'](handleEntityNotFound(_0x50743c,null))['then'](function(_0x59a7ec){if(_0x59a7ec){_0x486c04=_0x59a7ec;_0x2c03cc[_0x46e3('0x33')]=_[_0x46e3('0x47')](db[_0x46e3('0x4e')]['rawAttributes']);_0x2c03cc[_0x46e3('0x34')]=_[_0x46e3('0x47')](_0x58b581[_0x46e3('0x34')]);_0x2c03cc['filters']=_[_0x46e3('0x36')](_0x2c03cc[_0x46e3('0x33')],_0x2c03cc['query']);_0x5a27aa['attributes']=_['intersection'](_0x2c03cc[_0x46e3('0x33')],qs['fields'](_0x58b581[_0x46e3('0x34')][_0x46e3('0x37')]));_0x5a27aa[_0x46e3('0x38')]=_0x5a27aa[_0x46e3('0x38')][_0x46e3('0x48')]?_0x5a27aa[_0x46e3('0x38')]:_0x2c03cc[_0x46e3('0x33')];_0x5a27aa['order']=qs[_0x46e3('0x4f')](_0x58b581[_0x46e3('0x34')][_0x46e3('0x4f')]);_0x5a27aa[_0x46e3('0x3c')]=qs[_0x46e3('0x35')](_[_0x46e3('0x3d')](_0x58b581[_0x46e3('0x34')],_0x2c03cc[_0x46e3('0x35')]));if(_0x58b581[_0x46e3('0x34')][_0x46e3('0x40')]){_0x5a27aa['where']=_['merge'](_0x5a27aa[_0x46e3('0x3c')],{'$or':_['map'](_0x5a27aa[_0x46e3('0x38')],function(_0x597e4f){var _0x39be49={};_0x39be49[_0x597e4f]={'$like':'%'+_0x58b581[_0x46e3('0x34')][_0x46e3('0x40')]+'%'};return _0x39be49;})});}_0x5a27aa=_['merge']({},_0x5a27aa,_0x58b581[_0x46e3('0x41')]);return _0x486c04[_0x46e3('0x4d')](_0x5a27aa);}})[_0x46e3('0x26')](function(_0x3ab960){if(_0x3ab960){_0x15d696=_0x3ab960[_0x46e3('0x48')];if(!_0x58b581[_0x46e3('0x34')][_0x46e3('0x39')](_0x46e3('0x3a'))){_0x5a27aa[_0x46e3('0x1f')]=qs['limit'](_0x58b581[_0x46e3('0x34')]['limit']);_0x5a27aa['offset']=qs[_0x46e3('0x1d')](_0x58b581[_0x46e3('0x34')]['offset']);}return _0x486c04['getFields'](_0x5a27aa);}})['then'](function(_0x38be24){if(_0x38be24){return _0x38be24?{'count':_0x15d696,'rows':_0x38be24}:null;}})['then'](respondWithResult(_0x50743c,null))['catch'](handleError(_0x50743c,null));};exports['getSubjects']=function(_0x5ad43d,_0x13c882,_0x446e89){var _0x15eef7={};var _0x196e83={};var _0x18c8c4;var _0x1c4307;return db[_0x46e3('0x2e')][_0x46e3('0x50')]({'where':{'id':_0x5ad43d[_0x46e3('0x46')]['id']}})['then'](handleEntityNotFound(_0x13c882,null))[_0x46e3('0x26')](function(_0x37d6b1){if(_0x37d6b1){_0x18c8c4=_0x37d6b1;_0x196e83[_0x46e3('0x33')]=_[_0x46e3('0x47')](db['SalesforceField'][_0x46e3('0x2f')]);_0x196e83['query']=_[_0x46e3('0x47')](_0x5ad43d['query']);_0x196e83[_0x46e3('0x35')]=_[_0x46e3('0x36')](_0x196e83['model'],_0x196e83[_0x46e3('0x34')]);_0x15eef7[_0x46e3('0x38')]=_[_0x46e3('0x36')](_0x196e83['model'],qs[_0x46e3('0x37')](_0x5ad43d[_0x46e3('0x34')][_0x46e3('0x37')]));_0x15eef7[_0x46e3('0x38')]=_0x15eef7[_0x46e3('0x38')][_0x46e3('0x48')]?_0x15eef7[_0x46e3('0x38')]:_0x196e83['model'];_0x15eef7['order']=qs[_0x46e3('0x4f')](_0x5ad43d[_0x46e3('0x34')]['sort']);_0x15eef7['where']=qs['filters'](_[_0x46e3('0x3d')](_0x5ad43d[_0x46e3('0x34')],_0x196e83['filters']));if(_0x5ad43d[_0x46e3('0x34')][_0x46e3('0x40')]){_0x15eef7['where']=_[_0x46e3('0x3e')](_0x15eef7[_0x46e3('0x3c')],{'$or':_[_0x46e3('0x2d')](_0x15eef7[_0x46e3('0x38')],function(_0x56105a){var _0x13d968={};_0x13d968[_0x56105a]={'$like':'%'+_0x5ad43d[_0x46e3('0x34')][_0x46e3('0x40')]+'%'};return _0x13d968;})});}_0x15eef7=_[_0x46e3('0x3e')]({},_0x15eef7,_0x5ad43d[_0x46e3('0x41')]);return _0x18c8c4[_0x46e3('0x51')](_0x15eef7);}})['then'](function(_0x415c24){if(_0x415c24){_0x1c4307=_0x415c24[_0x46e3('0x48')];if(!_0x5ad43d[_0x46e3('0x34')]['hasOwnProperty'](_0x46e3('0x3a'))){_0x15eef7[_0x46e3('0x1f')]=qs[_0x46e3('0x1f')](_0x5ad43d[_0x46e3('0x34')]['limit']);_0x15eef7['offset']=qs[_0x46e3('0x1d')](_0x5ad43d[_0x46e3('0x34')][_0x46e3('0x1d')]);}return _0x18c8c4['getSubjects'](_0x15eef7);}})[_0x46e3('0x26')](function(_0x3b2bec){if(_0x3b2bec){return _0x3b2bec?{'count':_0x1c4307,'rows':_0x3b2bec}:null;}})[_0x46e3('0x26')](respondWithResult(_0x13c882,null))[_0x46e3('0x44')](handleError(_0x13c882,null));};exports[_0x46e3('0x52')]=function(_0x521d14,_0x104cbf,_0x1e03c1){var _0x38e069={};var _0x43712f={};var _0x3fd280;var _0x1cf68d;return db[_0x46e3('0x2e')][_0x46e3('0x50')]({'where':{'id':_0x521d14[_0x46e3('0x46')]['id']}})[_0x46e3('0x26')](handleEntityNotFound(_0x104cbf,null))[_0x46e3('0x26')](function(_0x1482c3){if(_0x1482c3){_0x3fd280=_0x1482c3;_0x43712f['model']=_['keys'](db['SalesforceField'][_0x46e3('0x2f')]);_0x43712f['query']=_[_0x46e3('0x47')](_0x521d14[_0x46e3('0x34')]);_0x43712f[_0x46e3('0x35')]=_[_0x46e3('0x36')](_0x43712f[_0x46e3('0x33')],_0x43712f[_0x46e3('0x34')]);_0x38e069[_0x46e3('0x38')]=_['intersection'](_0x43712f['model'],qs[_0x46e3('0x37')](_0x521d14[_0x46e3('0x34')][_0x46e3('0x37')]));_0x38e069[_0x46e3('0x38')]=_0x38e069['attributes'][_0x46e3('0x48')]?_0x38e069[_0x46e3('0x38')]:_0x43712f[_0x46e3('0x33')];_0x38e069[_0x46e3('0x3b')]=qs['sort'](_0x521d14[_0x46e3('0x34')][_0x46e3('0x4f')]);_0x38e069[_0x46e3('0x3c')]=qs['filters'](_['pick'](_0x521d14[_0x46e3('0x34')],_0x43712f[_0x46e3('0x35')]));if(_0x521d14[_0x46e3('0x34')][_0x46e3('0x40')]){_0x38e069[_0x46e3('0x3c')]=_[_0x46e3('0x3e')](_0x38e069['where'],{'$or':_[_0x46e3('0x2d')](_0x38e069[_0x46e3('0x38')],function(_0x3ef96d){var _0x364daf={};_0x364daf[_0x3ef96d]={'$like':'%'+_0x521d14[_0x46e3('0x34')][_0x46e3('0x40')]+'%'};return _0x364daf;})});}_0x38e069=_['merge']({},_0x38e069,_0x521d14[_0x46e3('0x41')]);return _0x3fd280['getDescriptions'](_0x38e069);}})[_0x46e3('0x26')](function(_0x4dd609){if(_0x4dd609){_0x1cf68d=_0x4dd609['length'];if(!_0x521d14[_0x46e3('0x34')][_0x46e3('0x39')](_0x46e3('0x3a'))){_0x38e069[_0x46e3('0x1f')]=qs[_0x46e3('0x1f')](_0x521d14['query']['limit']);_0x38e069[_0x46e3('0x1d')]=qs[_0x46e3('0x1d')](_0x521d14[_0x46e3('0x34')]['offset']);}return _0x3fd280[_0x46e3('0x52')](_0x38e069);}})[_0x46e3('0x26')](function(_0x22702){if(_0x22702){return _0x22702?{'count':_0x1cf68d,'rows':_0x22702}:null;}})['then'](respondWithResult(_0x104cbf,null))[_0x46e3('0x44')](handleError(_0x104cbf,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index c7b1d2a..b54b998 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 _0xfe17=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports'];(function(_0x4b8a48,_0x4f4938){var _0x2c6b7c=function(_0x487309){while(--_0x487309){_0x4b8a48['push'](_0x4b8a48['shift']());}};_0x2c6b7c(++_0x4f4938);}(_0xfe17,0x183));var _0x7fe1=function(_0x106eb0,_0x5cbbaa){_0x106eb0=_0x106eb0-0x0;var _0x10d739=_0xfe17[_0x106eb0];return _0x10d739;};'use strict';var _=require(_0x7fe1('0x0'));var util=require(_0x7fe1('0x1'));var logger=require(_0x7fe1('0x2'))('api');var moment=require(_0x7fe1('0x3'));var BPromise=require('bluebird');var rp=require(_0x7fe1('0x4'));var fs=require('fs');var path=require(_0x7fe1('0x5'));var rimraf=require(_0x7fe1('0x6'));var config=require('../../config/environment');var attributes=require(_0x7fe1('0x7'));module[_0x7fe1('0x8')]=function(_0x51d1be,_0x36b7df){return _0x51d1be[_0x7fe1('0x9')](_0x7fe1('0xa'),attributes,{'tableName':_0x7fe1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75cd=['rimraf','./intSalesforceConfiguration.attributes','exports','lodash','../../config/logger','moment'];(function(_0x3325ab,_0x51f4b1){var _0x2c8dfd=function(_0x2d0c68){while(--_0x2d0c68){_0x3325ab['push'](_0x3325ab['shift']());}};_0x2c8dfd(++_0x51f4b1);}(_0x75cd,0x1d7));var _0xd75c=function(_0x5ae325,_0x1652b4){_0x5ae325=_0x5ae325-0x0;var _0x542ffe=_0x75cd[_0x5ae325];return _0x542ffe;};'use strict';var _=require(_0xd75c('0x0'));var util=require('util');var logger=require(_0xd75c('0x1'))('api');var moment=require(_0xd75c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd75c('0x3'));var config=require('../../config/environment');var attributes=require(_0xd75c('0x4'));module[_0xd75c('0x5')]=function(_0x355b01,_0x21e512){return _0x355b01['define']('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index efa8ddc..af53941 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 _0xe68b=['code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1f23b0,_0x41b85d){var _0x5e6fa1=function(_0x1b21b3){while(--_0x1b21b3){_0x1f23b0['push'](_0x1f23b0['shift']());}};_0x5e6fa1(++_0x41b85d);}(_0xe68b,0x191));var _0xbe68=function(_0xa134e6,_0x3395d1){_0xa134e6=_0xa134e6-0x0;var _0x42405a=_0xe68b[_0xa134e6];return _0x42405a;};'use strict';var _=require(_0xbe68('0x0'));var util=require(_0xbe68('0x1'));var moment=require(_0xbe68('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbe68('0x4'));var config=require(_0xbe68('0x5'));var jayson=require(_0xbe68('0x6'));var client=jayson[_0xbe68('0x7')][_0xbe68('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2984cd,_0x9aa030,_0x5d53c3){return new BPromise(function(_0x44874f,_0xd4fafd){return client[_0xbe68('0x9')](_0x2984cd,_0x5d53c3)[_0xbe68('0xa')](function(_0xd94b59){logger[_0xbe68('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x9aa030,'request\x20sent');logger[_0xbe68('0xc')](_0xbe68('0xd'),_0x9aa030,_0xbe68('0xe'),JSON[_0xbe68('0xf')](_0xd94b59));if(_0xd94b59[_0xbe68('0x10')]){if(_0xd94b59['error'][_0xbe68('0x11')]===0x1f4){logger[_0xbe68('0x10')](_0xbe68('0x12'),_0x9aa030,_0xd94b59[_0xbe68('0x10')]['message']);return _0xd4fafd(_0xd94b59[_0xbe68('0x10')]['message']);}logger[_0xbe68('0x10')](_0xbe68('0x12'),_0x9aa030,_0xd94b59[_0xbe68('0x10')][_0xbe68('0x13')]);return _0x44874f(_0xd94b59[_0xbe68('0x10')][_0xbe68('0x13')]);}else{logger[_0xbe68('0xb')](_0xbe68('0x12'),_0x9aa030,'request\x20sent');_0x44874f(_0xd94b59[_0xbe68('0x14')][_0xbe68('0x13')]);}})[_0xbe68('0x15')](function(_0x4d51f2){logger['error'](_0xbe68('0x12'),_0x9aa030,_0x4d51f2);_0xd4fafd(_0x4d51f2);});});} \ No newline at end of file +var _0xc4d6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','bluebird','ioredis','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc4d6,0x7a));var _0x6c4d=function(_0x5b1aed,_0x322c17){_0x5b1aed=_0x5b1aed-0x0;var _0x26add8=_0xc4d6[_0x5b1aed];return _0x26add8;};'use strict';var _=require(_0x6c4d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6c4d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c4d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c4d('0x3'));var logger=require(_0x6c4d('0x4'))(_0x6c4d('0x5'));var config=require(_0x6c4d('0x6'));var jayson=require(_0x6c4d('0x7'));var client=jayson[_0x6c4d('0x8')][_0x6c4d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x524a7d,_0x41dd50,_0x1fd305){return new BPromise(function(_0x5ae766,_0x24c702){return client[_0x6c4d('0xa')](_0x524a7d,_0x1fd305)[_0x6c4d('0xb')](function(_0x56379e){logger[_0x6c4d('0xc')](_0x6c4d('0xd'),_0x41dd50,'request\x20sent');logger[_0x6c4d('0xe')](_0x6c4d('0xf'),_0x41dd50,_0x6c4d('0x10'),JSON[_0x6c4d('0x11')](_0x56379e));if(_0x56379e[_0x6c4d('0x12')]){if(_0x56379e[_0x6c4d('0x12')]['code']===0x1f4){logger[_0x6c4d('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x41dd50,_0x56379e[_0x6c4d('0x12')]['message']);return _0x24c702(_0x56379e[_0x6c4d('0x12')]['message']);}logger[_0x6c4d('0x12')](_0x6c4d('0xd'),_0x41dd50,_0x56379e[_0x6c4d('0x12')][_0x6c4d('0x13')]);return _0x5ae766(_0x56379e[_0x6c4d('0x12')][_0x6c4d('0x13')]);}else{logger[_0x6c4d('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x41dd50,_0x6c4d('0x10'));_0x5ae766(_0x56379e['result']['message']);}})[_0x6c4d('0x14')](function(_0x36b43a){logger[_0x6c4d('0x12')](_0x6c4d('0xd'),_0x41dd50,_0x36b43a);_0x24c702(_0x36b43a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d20ff5c..8033c43 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 _0x0e35=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3668ad,_0x1086fe){var _0x43ce80=function(_0x144c40){while(--_0x144c40){_0x3668ad['push'](_0x3668ad['shift']());}};_0x43ce80(++_0x1086fe);}(_0x0e35,0x169));var _0x50e3=function(_0x2f8b4f,_0x4ec9e6){_0x2f8b4f=_0x2f8b4f-0x0;var _0x44b2ce=_0x0e35[_0x2f8b4f];return _0x44b2ce;};'use strict';var multer=require(_0x50e3('0x0'));var util=require('util');var path=require(_0x50e3('0x1'));var timeout=require(_0x50e3('0x2'));var express=require(_0x50e3('0x3'));var router=express[_0x50e3('0x4')]();var fs_extra=require(_0x50e3('0x5'));var auth=require(_0x50e3('0x6'));var interaction=require(_0x50e3('0x7'));var config=require(_0x50e3('0x8'));var controller=require(_0x50e3('0x9'));router[_0x50e3('0xa')]('/',auth[_0x50e3('0xb')](),controller[_0x50e3('0xc')]);router[_0x50e3('0xa')](_0x50e3('0xd'),auth[_0x50e3('0xb')](),controller[_0x50e3('0xe')]);router[_0x50e3('0xf')]('/',auth['isAuthenticated'](),controller[_0x50e3('0x10')]);router[_0x50e3('0x11')](_0x50e3('0xd'),auth[_0x50e3('0xb')](),controller[_0x50e3('0x12')]);router[_0x50e3('0x13')]('/:id',auth[_0x50e3('0xb')](),controller[_0x50e3('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3ef6=['Router','fs-extra','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4fe558,_0x1d1494){var _0x5994db=function(_0x497885){while(--_0x497885){_0x4fe558['push'](_0x4fe558['shift']());}};_0x5994db(++_0x1d1494);}(_0x3ef6,0x18b));var _0x63ef=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x3ef6[_0x424501];return _0xb719af;};'use strict';var multer=require(_0x63ef('0x0'));var util=require(_0x63ef('0x1'));var path=require(_0x63ef('0x2'));var timeout=require(_0x63ef('0x3'));var express=require(_0x63ef('0x4'));var router=express[_0x63ef('0x5')]();var fs_extra=require(_0x63ef('0x6'));var auth=require(_0x63ef('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x63ef('0x8'));router[_0x63ef('0x9')]('/',auth[_0x63ef('0xa')](),controller[_0x63ef('0xb')]);router['get']('/:id',auth[_0x63ef('0xa')](),controller['show']);router[_0x63ef('0xc')]('/',auth['isAuthenticated'](),controller[_0x63ef('0xd')]);router[_0x63ef('0xe')](_0x63ef('0xf'),auth[_0x63ef('0xa')](),controller[_0x63ef('0x10')]);router[_0x63ef('0x11')](_0x63ef('0xf'),auth[_0x63ef('0xa')](),controller[_0x63ef('0x12')]);module[_0x63ef('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 50ef27e..cfc6561 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 _0x4709=['exports','string','keyValue','picklist','STRING','ENUM','variable','customVariable'];(function(_0x530c34,_0x276750){var _0x2ec14f=function(_0x4a4573){while(--_0x4a4573){_0x530c34['push'](_0x530c34['shift']());}};_0x2ec14f(++_0x276750);}(_0x4709,0x138));var _0x9470=function(_0x7abbde,_0x549f08){_0x7abbde=_0x7abbde-0x0;var _0x5e7081=_0x4709[_0x7abbde];return _0x5e7081;};'use strict';var Sequelize=require('sequelize');module[_0x9470('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9470('0x1'),'variable','customVariable',_0x9470('0x2'),_0x9470('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9470('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9470('0x5')]('string',_0x9470('0x6'),_0x9470('0x7'))},'keyContent':{'type':Sequelize[_0x9470('0x4')]},'idField':{'type':Sequelize[_0x9470('0x4')]},'variableName':{'type':Sequelize[_0x9470('0x4')]}}; \ No newline at end of file +var _0x5c1f=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x5a8c4f,_0x57073c){var _0x1541e0=function(_0x2d2dc8){while(--_0x2d2dc8){_0x5a8c4f['push'](_0x5a8c4f['shift']());}};_0x1541e0(++_0x57073c);}(_0x5c1f,0xac));var _0xf5c1=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x5c1f[_0x1d7037];return _0x4d6568;};'use strict';var Sequelize=require(_0xf5c1('0x0'));module[_0xf5c1('0x1')]={'type':{'type':Sequelize[_0xf5c1('0x2')](_0xf5c1('0x3'),_0xf5c1('0x4'),_0xf5c1('0x5'),'keyValue',_0xf5c1('0x6')),'defaultValue':_0xf5c1('0x3')},'content':{'type':Sequelize[_0xf5c1('0x7')]},'key':{'type':Sequelize[_0xf5c1('0x7')]},'keyType':{'type':Sequelize[_0xf5c1('0x2')](_0xf5c1('0x3'),'variable',_0xf5c1('0x5'))},'keyContent':{'type':Sequelize[_0xf5c1('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xf5c1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 4a3c65f..316c7da 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 _0x9ff6=['../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','include','rows','catch','show','keys','options','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x14be12,_0x6f0e11){var _0x30baab=function(_0x46eb84){while(--_0x46eb84){_0x14be12['push'](_0x14be12['shift']());}};_0x30baab(++_0x6f0e11);}(_0x9ff6,0x7b));var _0x69ff=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x9ff6[_0x18cd5b];return _0x5eaa52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69ff('0x0'));var zipdir=require(_0x69ff('0x1'));var jsonpatch=require(_0x69ff('0x2'));var rp=require(_0x69ff('0x3'));var moment=require('moment');var BPromise=require(_0x69ff('0x4'));var Mustache=require(_0x69ff('0x5'));var util=require(_0x69ff('0x6'));var path=require('path');var sox=require(_0x69ff('0x7'));var csv=require(_0x69ff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x69ff('0x9'));var _=require(_0x69ff('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x69ff('0xb'));var deskjs=require(_0x69ff('0xc'));var toCsv=require(_0x69ff('0x8'));var querystring=require(_0x69ff('0xd'));var Papa=require(_0x69ff('0xe'));var Redis=require(_0x69ff('0xf'));var authService=require(_0x69ff('0x10'));var qs=require(_0x69ff('0x11'));var as=require(_0x69ff('0x12'));var hardwareService=require(_0x69ff('0x13'));var logger=require(_0x69ff('0x14'))(_0x69ff('0x15'));var utils=require(_0x69ff('0x16'));var config=require(_0x69ff('0x17'));var licenseUtil=require(_0x69ff('0x18'));var db=require(_0x69ff('0x19'))['db'];function respondWithStatusCode(_0x5e0d3e,_0x4ffeb8){_0x4ffeb8=_0x4ffeb8||0xcc;return function(_0x74a5d1){if(_0x74a5d1){return _0x5e0d3e[_0x69ff('0x1a')](_0x4ffeb8);}return _0x5e0d3e[_0x69ff('0x1b')](_0x4ffeb8)[_0x69ff('0x1c')]();};}function respondWithResult(_0x254ed2,_0x29d569){_0x29d569=_0x29d569||0xc8;return function(_0x17372d){if(_0x17372d){return _0x254ed2[_0x69ff('0x1b')](_0x29d569)['json'](_0x17372d);}};}function respondWithFilteredResult(_0x69e82e,_0x56301d){return function(_0x3615d4){if(_0x3615d4){var _0x1f55ae=typeof _0x56301d['offset']===_0x69ff('0x1d')&&typeof _0x56301d[_0x69ff('0x1e')]===_0x69ff('0x1d');var _0x3b680a=_0x3615d4['count'];var _0x3fcab8=_0x1f55ae?0x0:_0x56301d[_0x69ff('0x1f')];var _0x27ff18=_0x1f55ae?_0x3615d4[_0x69ff('0x20')]:_0x56301d[_0x69ff('0x1f')]+_0x56301d[_0x69ff('0x1e')];var _0x3e7351;if(_0x27ff18>=_0x3b680a){_0x27ff18=_0x3b680a;_0x3e7351=0xc8;}else{_0x3e7351=0xce;}_0x69e82e[_0x69ff('0x1b')](_0x3e7351);return _0x69e82e[_0x69ff('0x21')](_0x69ff('0x22'),_0x3fcab8+'-'+_0x27ff18+'/'+_0x3b680a)[_0x69ff('0x23')](_0x3615d4);}return null;};}function patchUpdates(_0x52473c){return function(_0x17c539){try{jsonpatch[_0x69ff('0x24')](_0x17c539,_0x52473c,!![]);}catch(_0x3843fc){return BPromise[_0x69ff('0x25')](_0x3843fc);}return _0x17c539[_0x69ff('0x26')]();};}function saveUpdates(_0x5d217c,_0x3e4d6c){return function(_0x57d759){if(_0x57d759){return _0x57d759[_0x69ff('0x27')](_0x5d217c)['then'](function(_0xcbe351){return _0xcbe351;});}return null;};}function removeEntity(_0x3b5fd4,_0x2aa7ad){return function(_0x3ed2c8){if(_0x3ed2c8){return _0x3ed2c8['destroy']()[_0x69ff('0x28')](function(){_0x3b5fd4[_0x69ff('0x1b')](0xcc)[_0x69ff('0x1c')]();});}};}function handleEntityNotFound(_0x4b07b0,_0x513477){return function(_0x609593){if(!_0x609593){_0x4b07b0['sendStatus'](0x194);}return _0x609593;};}function handleError(_0x11c4b1,_0x2c467a){_0x2c467a=_0x2c467a||0x1f4;return function(_0x524805){logger[_0x69ff('0x29')](_0x524805[_0x69ff('0x2a')]);if(_0x524805[_0x69ff('0x2b')]){delete _0x524805[_0x69ff('0x2b')];}_0x11c4b1[_0x69ff('0x1b')](_0x2c467a)['send'](_0x524805);};}exports['index']=function(_0x485eb7,_0xc5b363){var _0x44a59f={},_0x237f4d={},_0x1f1a07={'count':0x0,'rows':[]};var _0x4a4de3=_[_0x69ff('0x2c')](db[_0x69ff('0x2d')][_0x69ff('0x2e')],function(_0x141625){return{'name':_0x141625[_0x69ff('0x2f')],'type':_0x141625[_0x69ff('0x30')][_0x69ff('0x31')]};});_0x237f4d[_0x69ff('0x32')]=_[_0x69ff('0x2c')](_0x4a4de3,'name');_0x237f4d[_0x69ff('0x33')]=_['keys'](_0x485eb7['query']);_0x237f4d[_0x69ff('0x34')]=_[_0x69ff('0x35')](_0x237f4d[_0x69ff('0x32')],_0x237f4d[_0x69ff('0x33')]);_0x44a59f[_0x69ff('0x36')]=_[_0x69ff('0x35')](_0x237f4d[_0x69ff('0x32')],qs[_0x69ff('0x37')](_0x485eb7['query']['fields']));_0x44a59f[_0x69ff('0x36')]=_0x44a59f[_0x69ff('0x36')][_0x69ff('0x38')]?_0x44a59f['attributes']:_0x237f4d[_0x69ff('0x32')];if(!_0x485eb7[_0x69ff('0x33')][_0x69ff('0x39')](_0x69ff('0x3a'))){_0x44a59f[_0x69ff('0x1e')]=qs[_0x69ff('0x1e')](_0x485eb7[_0x69ff('0x33')]['limit']);_0x44a59f[_0x69ff('0x1f')]=qs[_0x69ff('0x1f')](_0x485eb7[_0x69ff('0x33')][_0x69ff('0x1f')]);}_0x44a59f['order']=qs[_0x69ff('0x3b')](_0x485eb7[_0x69ff('0x33')][_0x69ff('0x3b')]);_0x44a59f['where']=qs[_0x69ff('0x34')](_[_0x69ff('0x3c')](_0x485eb7[_0x69ff('0x33')],_0x237f4d['filters']),_0x4a4de3);if(_0x485eb7['query'][_0x69ff('0x3d')]){_0x44a59f['where']=_[_0x69ff('0x3e')](_0x44a59f[_0x69ff('0x3f')],{'$or':_['map'](_0x4a4de3,function(_0x49fd41){if(_0x49fd41['type']!==_0x69ff('0x40')){var _0x5a23a5={};_0x5a23a5[_0x49fd41[_0x69ff('0x2b')]]={'$like':'%'+_0x485eb7[_0x69ff('0x33')][_0x69ff('0x3d')]+'%'};return _0x5a23a5;}})});}_0x44a59f=_[_0x69ff('0x3e')]({},_0x44a59f,_0x485eb7['options']);var _0x331e67={'where':_0x44a59f[_0x69ff('0x3f')]};return db[_0x69ff('0x2d')][_0x69ff('0x20')](_0x331e67)[_0x69ff('0x28')](function(_0x5902d8){_0x1f1a07[_0x69ff('0x20')]=_0x5902d8;if(_0x485eb7['query']['includeAll']){_0x44a59f[_0x69ff('0x41')]=[{'all':!![]}];}return db[_0x69ff('0x2d')]['findAll'](_0x44a59f);})[_0x69ff('0x28')](function(_0xad1c7d){_0x1f1a07[_0x69ff('0x42')]=_0xad1c7d;return _0x1f1a07;})[_0x69ff('0x28')](respondWithFilteredResult(_0xc5b363,_0x44a59f))[_0x69ff('0x43')](handleError(_0xc5b363,null));};exports[_0x69ff('0x44')]=function(_0x5687a2,_0x249346){var _0x4c1682={'raw':!![],'where':{'id':_0x5687a2['params']['id']}},_0x4945fe={};_0x4945fe['model']=_[_0x69ff('0x45')](db[_0x69ff('0x2d')][_0x69ff('0x2e')]);_0x4945fe[_0x69ff('0x33')]=_['keys'](_0x5687a2[_0x69ff('0x33')]);_0x4945fe[_0x69ff('0x34')]=_['intersection'](_0x4945fe[_0x69ff('0x32')],_0x4945fe[_0x69ff('0x33')]);_0x4c1682[_0x69ff('0x36')]=_[_0x69ff('0x35')](_0x4945fe[_0x69ff('0x32')],qs[_0x69ff('0x37')](_0x5687a2['query'][_0x69ff('0x37')]));_0x4c1682[_0x69ff('0x36')]=_0x4c1682[_0x69ff('0x36')][_0x69ff('0x38')]?_0x4c1682['attributes']:_0x4945fe[_0x69ff('0x32')];if(_0x5687a2[_0x69ff('0x33')]['includeAll']){_0x4c1682[_0x69ff('0x41')]=[{'all':!![]}];}_0x4c1682=_[_0x69ff('0x3e')]({},_0x4c1682,_0x5687a2[_0x69ff('0x46')]);return db[_0x69ff('0x2d')]['find'](_0x4c1682)[_0x69ff('0x28')](handleEntityNotFound(_0x249346,null))[_0x69ff('0x28')](respondWithResult(_0x249346,null))[_0x69ff('0x43')](handleError(_0x249346,null));};exports['create']=function(_0x2018a1,_0x430974){return db[_0x69ff('0x2d')]['create'](_0x2018a1[_0x69ff('0x47')],{})['then'](respondWithResult(_0x430974,0xc9))['catch'](handleError(_0x430974,null));};exports[_0x69ff('0x27')]=function(_0x22eb3c,_0x5b8513){if(_0x22eb3c[_0x69ff('0x47')]['id']){delete _0x22eb3c['body']['id'];}return db[_0x69ff('0x2d')][_0x69ff('0x48')]({'where':{'id':_0x22eb3c[_0x69ff('0x49')]['id']}})[_0x69ff('0x28')](handleEntityNotFound(_0x5b8513,null))[_0x69ff('0x28')](saveUpdates(_0x22eb3c[_0x69ff('0x47')],null))[_0x69ff('0x28')](respondWithResult(_0x5b8513,null))[_0x69ff('0x43')](handleError(_0x5b8513,null));};exports['destroy']=function(_0x1f4d21,_0x50a509){return db[_0x69ff('0x2d')][_0x69ff('0x48')]({'where':{'id':_0x1f4d21['params']['id']}})[_0x69ff('0x28')](handleEntityNotFound(_0x50a509,null))[_0x69ff('0x28')](removeEntity(_0x50a509,null))[_0x69ff('0x43')](handleError(_0x50a509,null));}; \ No newline at end of file +var _0x4e8a=['name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SalesforceField','include','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','error','stack'];(function(_0x31bca3,_0x209a1e){var _0x2f10ea=function(_0x248a36){while(--_0x248a36){_0x31bca3['push'](_0x31bca3['shift']());}};_0x2f10ea(++_0x209a1e);}(_0x4e8a,0xa8));var _0xa4e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e8a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa4e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4e8('0x1'));var jsonpatch=require(_0xa4e8('0x2'));var rp=require(_0xa4e8('0x3'));var moment=require(_0xa4e8('0x4'));var BPromise=require(_0xa4e8('0x5'));var Mustache=require('mustache');var util=require(_0xa4e8('0x6'));var path=require(_0xa4e8('0x7'));var sox=require('sox');var csv=require(_0xa4e8('0x8'));var ejs=require(_0xa4e8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa4e8('0x8'));var querystring=require(_0xa4e8('0xa'));var Papa=require(_0xa4e8('0xb'));var Redis=require(_0xa4e8('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xa4e8('0xd'));var as=require(_0xa4e8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4e8('0xf'))(_0xa4e8('0x10'));var utils=require('../../config/utils');var config=require(_0xa4e8('0x11'));var licenseUtil=require(_0xa4e8('0x12'));var db=require(_0xa4e8('0x13'))['db'];function respondWithStatusCode(_0x1a009f,_0x3b9a40){_0x3b9a40=_0x3b9a40||0xcc;return function(_0x50c372){if(_0x50c372){return _0x1a009f[_0xa4e8('0x14')](_0x3b9a40);}return _0x1a009f[_0xa4e8('0x15')](_0x3b9a40)['end']();};}function respondWithResult(_0x22c26e,_0x4ec231){_0x4ec231=_0x4ec231||0xc8;return function(_0x300b1b){if(_0x300b1b){return _0x22c26e[_0xa4e8('0x15')](_0x4ec231)[_0xa4e8('0x16')](_0x300b1b);}};}function respondWithFilteredResult(_0x5da3f8,_0x1bca19){return function(_0x20a5d6){if(_0x20a5d6){var _0xa8f722=typeof _0x1bca19[_0xa4e8('0x17')]===_0xa4e8('0x18')&&typeof _0x1bca19[_0xa4e8('0x19')]==='undefined';var _0x466eb4=_0x20a5d6[_0xa4e8('0x1a')];var _0x502049=_0xa8f722?0x0:_0x1bca19['offset'];var _0x2889b5=_0xa8f722?_0x20a5d6[_0xa4e8('0x1a')]:_0x1bca19[_0xa4e8('0x17')]+_0x1bca19[_0xa4e8('0x19')];var _0x4fc1e2;if(_0x2889b5>=_0x466eb4){_0x2889b5=_0x466eb4;_0x4fc1e2=0xc8;}else{_0x4fc1e2=0xce;}_0x5da3f8[_0xa4e8('0x15')](_0x4fc1e2);return _0x5da3f8[_0xa4e8('0x1b')](_0xa4e8('0x1c'),_0x502049+'-'+_0x2889b5+'/'+_0x466eb4)[_0xa4e8('0x16')](_0x20a5d6);}return null;};}function patchUpdates(_0x5d66ad){return function(_0x5cea78){try{jsonpatch[_0xa4e8('0x1d')](_0x5cea78,_0x5d66ad,!![]);}catch(_0x3eac99){return BPromise['reject'](_0x3eac99);}return _0x5cea78['save']();};}function saveUpdates(_0x50740a,_0x46bd8e){return function(_0x10e256){if(_0x10e256){return _0x10e256[_0xa4e8('0x1e')](_0x50740a)[_0xa4e8('0x1f')](function(_0x5e2936){return _0x5e2936;});}return null;};}function removeEntity(_0x538294,_0x1a5db2){return function(_0x2b6cb3){if(_0x2b6cb3){return _0x2b6cb3[_0xa4e8('0x20')]()[_0xa4e8('0x1f')](function(){_0x538294[_0xa4e8('0x15')](0xcc)[_0xa4e8('0x21')]();});}};}function handleEntityNotFound(_0x2eb6d3,_0x422a65){return function(_0x2799ef){if(!_0x2799ef){_0x2eb6d3[_0xa4e8('0x14')](0x194);}return _0x2799ef;};}function handleError(_0x4d160d,_0x45ae87){_0x45ae87=_0x45ae87||0x1f4;return function(_0x3a2b95){logger[_0xa4e8('0x22')](_0x3a2b95[_0xa4e8('0x23')]);if(_0x3a2b95[_0xa4e8('0x24')]){delete _0x3a2b95[_0xa4e8('0x24')];}_0x4d160d[_0xa4e8('0x15')](_0x45ae87)[_0xa4e8('0x25')](_0x3a2b95);};}exports[_0xa4e8('0x26')]=function(_0x555ac1,_0x1743e2){var _0x5308f8={},_0x2cfcd6={},_0x445177={'count':0x0,'rows':[]};var _0x255c87=_[_0xa4e8('0x27')](db['SalesforceField'][_0xa4e8('0x28')],function(_0x5c6588){return{'name':_0x5c6588[_0xa4e8('0x29')],'type':_0x5c6588[_0xa4e8('0x2a')]['key']};});_0x2cfcd6[_0xa4e8('0x2b')]=_['map'](_0x255c87,_0xa4e8('0x24'));_0x2cfcd6[_0xa4e8('0x2c')]=_[_0xa4e8('0x2d')](_0x555ac1['query']);_0x2cfcd6[_0xa4e8('0x2e')]=_[_0xa4e8('0x2f')](_0x2cfcd6[_0xa4e8('0x2b')],_0x2cfcd6[_0xa4e8('0x2c')]);_0x5308f8['attributes']=_[_0xa4e8('0x2f')](_0x2cfcd6[_0xa4e8('0x2b')],qs[_0xa4e8('0x30')](_0x555ac1[_0xa4e8('0x2c')][_0xa4e8('0x30')]));_0x5308f8[_0xa4e8('0x31')]=_0x5308f8[_0xa4e8('0x31')][_0xa4e8('0x32')]?_0x5308f8[_0xa4e8('0x31')]:_0x2cfcd6[_0xa4e8('0x2b')];if(!_0x555ac1[_0xa4e8('0x2c')][_0xa4e8('0x33')](_0xa4e8('0x34'))){_0x5308f8[_0xa4e8('0x19')]=qs[_0xa4e8('0x19')](_0x555ac1[_0xa4e8('0x2c')][_0xa4e8('0x19')]);_0x5308f8[_0xa4e8('0x17')]=qs['offset'](_0x555ac1[_0xa4e8('0x2c')]['offset']);}_0x5308f8['order']=qs[_0xa4e8('0x35')](_0x555ac1['query'][_0xa4e8('0x35')]);_0x5308f8[_0xa4e8('0x36')]=qs[_0xa4e8('0x2e')](_['pick'](_0x555ac1['query'],_0x2cfcd6[_0xa4e8('0x2e')]),_0x255c87);if(_0x555ac1[_0xa4e8('0x2c')][_0xa4e8('0x37')]){_0x5308f8[_0xa4e8('0x36')]=_[_0xa4e8('0x38')](_0x5308f8['where'],{'$or':_[_0xa4e8('0x27')](_0x255c87,function(_0x2adc33){if(_0x2adc33[_0xa4e8('0x2a')]!==_0xa4e8('0x39')){var _0x3aee3d={};_0x3aee3d[_0x2adc33[_0xa4e8('0x24')]]={'$like':'%'+_0x555ac1[_0xa4e8('0x2c')]['filter']+'%'};return _0x3aee3d;}})});}_0x5308f8=_[_0xa4e8('0x38')]({},_0x5308f8,_0x555ac1[_0xa4e8('0x3a')]);var _0x3613f7={'where':_0x5308f8[_0xa4e8('0x36')]};return db[_0xa4e8('0x3b')]['count'](_0x3613f7)['then'](function(_0x5580c0){_0x445177[_0xa4e8('0x1a')]=_0x5580c0;if(_0x555ac1[_0xa4e8('0x2c')]['includeAll']){_0x5308f8[_0xa4e8('0x3c')]=[{'all':!![]}];}return db[_0xa4e8('0x3b')]['findAll'](_0x5308f8);})[_0xa4e8('0x1f')](function(_0x32e1af){_0x445177['rows']=_0x32e1af;return _0x445177;})[_0xa4e8('0x1f')](respondWithFilteredResult(_0x1743e2,_0x5308f8))[_0xa4e8('0x3d')](handleError(_0x1743e2,null));};exports[_0xa4e8('0x3e')]=function(_0x393ac0,_0x48b306){var _0x57bdc8={'raw':!![],'where':{'id':_0x393ac0[_0xa4e8('0x3f')]['id']}},_0x3a849d={};_0x3a849d[_0xa4e8('0x2b')]=_[_0xa4e8('0x2d')](db[_0xa4e8('0x3b')][_0xa4e8('0x28')]);_0x3a849d[_0xa4e8('0x2c')]=_['keys'](_0x393ac0[_0xa4e8('0x2c')]);_0x3a849d[_0xa4e8('0x2e')]=_[_0xa4e8('0x2f')](_0x3a849d['model'],_0x3a849d[_0xa4e8('0x2c')]);_0x57bdc8[_0xa4e8('0x31')]=_[_0xa4e8('0x2f')](_0x3a849d[_0xa4e8('0x2b')],qs['fields'](_0x393ac0[_0xa4e8('0x2c')]['fields']));_0x57bdc8[_0xa4e8('0x31')]=_0x57bdc8['attributes'][_0xa4e8('0x32')]?_0x57bdc8[_0xa4e8('0x31')]:_0x3a849d[_0xa4e8('0x2b')];if(_0x393ac0[_0xa4e8('0x2c')][_0xa4e8('0x40')]){_0x57bdc8[_0xa4e8('0x3c')]=[{'all':!![]}];}_0x57bdc8=_['merge']({},_0x57bdc8,_0x393ac0[_0xa4e8('0x3a')]);return db['SalesforceField'][_0xa4e8('0x41')](_0x57bdc8)[_0xa4e8('0x1f')](handleEntityNotFound(_0x48b306,null))['then'](respondWithResult(_0x48b306,null))[_0xa4e8('0x3d')](handleError(_0x48b306,null));};exports[_0xa4e8('0x42')]=function(_0x4efe7c,_0x430a8a){return db[_0xa4e8('0x3b')][_0xa4e8('0x42')](_0x4efe7c[_0xa4e8('0x43')],{})['then'](respondWithResult(_0x430a8a,0xc9))[_0xa4e8('0x3d')](handleError(_0x430a8a,null));};exports[_0xa4e8('0x1e')]=function(_0x242067,_0x13bb1f){if(_0x242067[_0xa4e8('0x43')]['id']){delete _0x242067[_0xa4e8('0x43')]['id'];}return db[_0xa4e8('0x3b')][_0xa4e8('0x41')]({'where':{'id':_0x242067[_0xa4e8('0x3f')]['id']}})[_0xa4e8('0x1f')](handleEntityNotFound(_0x13bb1f,null))[_0xa4e8('0x1f')](saveUpdates(_0x242067[_0xa4e8('0x43')],null))[_0xa4e8('0x1f')](respondWithResult(_0x13bb1f,null))[_0xa4e8('0x3d')](handleError(_0x13bb1f,null));};exports[_0xa4e8('0x20')]=function(_0x592a54,_0x10707d){return db[_0xa4e8('0x3b')][_0xa4e8('0x41')]({'where':{'id':_0x592a54[_0xa4e8('0x3f')]['id']}})[_0xa4e8('0x1f')](handleEntityNotFound(_0x10707d,null))[_0xa4e8('0x1f')](removeEntity(_0x10707d,null))[_0xa4e8('0x3d')](handleError(_0x10707d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0b30577..abeaa69 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 _0x6efc=['bluebird','request-promise','path','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x258095,_0x4fee5f){var _0x45a4af=function(_0x396545){while(--_0x396545){_0x258095['push'](_0x258095['shift']());}};_0x45a4af(++_0x4fee5f);}(_0x6efc,0x165));var _0xc6ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6efc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc6ef('0x0'));var util=require('util');var logger=require(_0xc6ef('0x1'))('api');var moment=require(_0xc6ef('0x2'));var BPromise=require(_0xc6ef('0x3'));var rp=require(_0xc6ef('0x4'));var fs=require('fs');var path=require(_0xc6ef('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xc6ef('0x6')]=function(_0x560da0,_0x1237ac){return _0x560da0['define'](_0xc6ef('0x7'),attributes,{'tableName':_0xc6ef('0x8'),'paranoid':![],'indexes':[{'name':_0xc6ef('0x9'),'fields':[_0xc6ef('0xa'),_0xc6ef('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2404=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','define'];(function(_0x780ea3,_0x208c35){var _0x17dea9=function(_0x50f640){while(--_0x50f640){_0x780ea3['push'](_0x780ea3['shift']());}};_0x17dea9(++_0x208c35);}(_0x2404,0xca));var _0x4240=function(_0x890d17,_0x77c1c9){_0x890d17=_0x890d17-0x0;var _0x25072f=_0x2404[_0x890d17];return _0x25072f;};'use strict';var _=require(_0x4240('0x0'));var util=require('util');var logger=require(_0x4240('0x1'))(_0x4240('0x2'));var moment=require('moment');var BPromise=require(_0x4240('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4240('0x4'));var config=require(_0x4240('0x5'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x5a2d9f,_0x52991c){return _0x5a2d9f[_0x4240('0x6')]('SalesforceField',attributes,{'tableName':_0x4240('0x7'),'paranoid':![],'indexes':[{'name':_0x4240('0x8'),'fields':[_0x4240('0x9'),_0x4240('0xa')],'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 eb1aac4..508497e 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 _0xa4be=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xa4be,0x1e0));var _0xea4b=function(_0x34b47f,_0x1f015b){_0x34b47f=_0x34b47f-0x0;var _0x26d94f=_0xa4be[_0x34b47f];return _0x26d94f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xea4b('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea4b('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xea4b('0x2'));var logger=require(_0xea4b('0x3'))(_0xea4b('0x4'));var config=require(_0xea4b('0x5'));var jayson=require(_0xea4b('0x6'));var client=jayson[_0xea4b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1524a7,_0x75deae,_0x19d23d){return new BPromise(function(_0x274ddc,_0x3bd438){return client[_0xea4b('0x8')](_0x1524a7,_0x19d23d)[_0xea4b('0x9')](function(_0x44adf5){logger[_0xea4b('0xa')](_0xea4b('0xb'),_0x75deae,_0xea4b('0xc'));logger[_0xea4b('0xd')](_0xea4b('0xe'),_0x75deae,'request\x20sent',JSON[_0xea4b('0xf')](_0x44adf5));if(_0x44adf5[_0xea4b('0x10')]){if(_0x44adf5[_0xea4b('0x10')]['code']===0x1f4){logger[_0xea4b('0x10')](_0xea4b('0xb'),_0x75deae,_0x44adf5[_0xea4b('0x10')][_0xea4b('0x11')]);return _0x3bd438(_0x44adf5[_0xea4b('0x10')]['message']);}logger[_0xea4b('0x10')](_0xea4b('0xb'),_0x75deae,_0x44adf5[_0xea4b('0x10')][_0xea4b('0x11')]);return _0x274ddc(_0x44adf5['error'][_0xea4b('0x11')]);}else{logger[_0xea4b('0xa')]('SalesforceField,\x20%s,\x20%s',_0x75deae,_0xea4b('0xc'));_0x274ddc(_0x44adf5[_0xea4b('0x12')][_0xea4b('0x11')]);}})[_0xea4b('0x13')](function(_0x4ea36c){logger['error']('SalesforceField,\x20%s,\x20%s',_0x75deae,_0x4ea36c);_0x3bd438(_0x4ea36c);});});} \ No newline at end of file +var _0x7ef8=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x5bb7ba,_0x330a53){var _0x1f3daa=function(_0x19479e){while(--_0x19479e){_0x5bb7ba['push'](_0x5bb7ba['shift']());}};_0x1f3daa(++_0x330a53);}(_0x7ef8,0x154));var _0x87ef=function(_0x56c758,_0x540591){_0x56c758=_0x56c758-0x0;var _0x9bb0db=_0x7ef8[_0x56c758];return _0x9bb0db;};'use strict';var _=require('lodash');var util=require(_0x87ef('0x0'));var moment=require('moment');var BPromise=require(_0x87ef('0x1'));var rs=require(_0x87ef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87ef('0x3'))['db'];var utils=require(_0x87ef('0x4'));var logger=require(_0x87ef('0x5'))(_0x87ef('0x6'));var config=require(_0x87ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x87ef('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x304ac7,_0x4ff993,_0x59083a){return new BPromise(function(_0xe0f7aa,_0x351049){return client[_0x87ef('0x9')](_0x304ac7,_0x59083a)[_0x87ef('0xa')](function(_0x184dc2){logger[_0x87ef('0xb')](_0x87ef('0xc'),_0x4ff993,_0x87ef('0xd'));logger[_0x87ef('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4ff993,_0x87ef('0xd'),JSON[_0x87ef('0xf')](_0x184dc2));if(_0x184dc2[_0x87ef('0x10')]){if(_0x184dc2[_0x87ef('0x10')][_0x87ef('0x11')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x4ff993,_0x184dc2[_0x87ef('0x10')][_0x87ef('0x12')]);return _0x351049(_0x184dc2[_0x87ef('0x10')]['message']);}logger[_0x87ef('0x10')](_0x87ef('0xc'),_0x4ff993,_0x184dc2['error'][_0x87ef('0x12')]);return _0xe0f7aa(_0x184dc2[_0x87ef('0x10')][_0x87ef('0x12')]);}else{logger[_0x87ef('0xb')]('SalesforceField,\x20%s,\x20%s',_0x4ff993,_0x87ef('0xd'));_0xe0f7aa(_0x184dc2['result']['message']);}})[_0x87ef('0x13')](function(_0x2501ba){logger[_0x87ef('0x10')](_0x87ef('0xc'),_0x4ff993,_0x2501ba);_0x351049(_0x2501ba);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a42d884..ef56c77 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 _0xec56=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0xec56,0x1bd));var _0x6ec5=function(_0x4458aa,_0x4dfb6a){_0x4458aa=_0x4458aa-0x0;var _0x271d6e=_0xec56[_0x4458aa];return _0x271d6e;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['get'](_0x6ec5('0x10'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x12')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x13')]);router[_0x6ec5('0x12')]('/:id/configurations',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x14')]);router[_0x6ec5('0x15')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x16')]);router[_0x6ec5('0x17')](_0x6ec5('0xc'),auth['isAuthenticated'](),controller[_0x6ec5('0x18')]);module['exports']=router; \ No newline at end of file +var _0x7d71=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','/:id'];(function(_0x1ec350,_0x380f86){var _0x3aa563=function(_0x3c88e2){while(--_0x3c88e2){_0x1ec350['push'](_0x1ec350['shift']());}};_0x3aa563(++_0x380f86);}(_0x7d71,0x192));var _0x17d7=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x7d71[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0x17d7('0x0'));var util=require(_0x17d7('0x1'));var path=require(_0x17d7('0x2'));var timeout=require(_0x17d7('0x3'));var express=require('express');var router=express[_0x17d7('0x4')]();var fs_extra=require(_0x17d7('0x5'));var auth=require(_0x17d7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x17d7('0x7'));var controller=require(_0x17d7('0x8'));router['get']('/',auth[_0x17d7('0x9')](),controller[_0x17d7('0xa')]);router['get']('/:id',auth[_0x17d7('0x9')](),controller['show']);router[_0x17d7('0xb')](_0x17d7('0xc'),auth[_0x17d7('0x9')](),controller[_0x17d7('0xd')]);router[_0x17d7('0xb')](_0x17d7('0xe'),auth[_0x17d7('0x9')](),controller[_0x17d7('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x17d7('0x10')]);router['post'](_0x17d7('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x17d7('0x11'),auth[_0x17d7('0x9')](),controller['update']);router[_0x17d7('0x12')](_0x17d7('0x11'),auth['isAuthenticated'](),controller[_0x17d7('0x13')]);module[_0x17d7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 29fb4fc..b7abe5a 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 _0x7aa5=['STRING','username','remoteUri','sequelize'];(function(_0x54013d,_0x34d5fc){var _0xedb7c5=function(_0xfdf0ed){while(--_0xfdf0ed){_0x54013d['push'](_0x54013d['shift']());}};_0xedb7c5(++_0x34d5fc);}(_0x7aa5,0x147));var _0x57aa=function(_0x17582f,_0x54d18e){_0x17582f=_0x17582f-0x0;var _0x5a0fee=_0x7aa5[_0x17582f];return _0x5a0fee;};'use strict';var Sequelize=require(_0x57aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x57aa('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x57aa('0x1')],'unique':_0x57aa('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x57aa('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x57aa('0x3')},'serverUrl':{'type':Sequelize[_0x57aa('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x787e=['remoteUri','sequelize','exports','STRING'];(function(_0x70e53e,_0x1a64d9){var _0x57b200=function(_0x1f20ce){while(--_0x1f20ce){_0x70e53e['push'](_0x70e53e['shift']());}};_0x57b200(++_0x1a64d9);}(_0x787e,0xd5));var _0xe787=function(_0x14ef90,_0x4a9221){_0x14ef90=_0x14ef90-0x0;var _0x440069=_0x787e[_0x14ef90];return _0x440069;};'use strict';var Sequelize=require(_0xe787('0x0'));module[_0xe787('0x1')]={'name':{'type':Sequelize[_0xe787('0x2')]},'description':{'type':Sequelize[_0xe787('0x2')]},'username':{'type':Sequelize[_0xe787('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xe787('0x2')]},'email':{'type':Sequelize[_0xe787('0x2')]},'remoteUri':{'type':Sequelize[_0xe787('0x2')],'unique':_0xe787('0x3')},'serverUrl':{'type':Sequelize[_0xe787('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d79447a..7dd285d 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 _0x6602=['includes','forEach','internalType','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','true','False','false','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','include','find','catch','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','getSubjects','getDescriptions','channel','create','Subjects','Descriptions','getFields','made_sla','hold_reason','knowledge','close_code','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','rfc','opened_at','group_list','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove'];(function(_0x543ebe,_0x56b946){var _0x203209=function(_0x4096ab){while(--_0x4096ab){_0x543ebe['push'](_0x543ebe['shift']());}};_0x203209(++_0x56b946);}(_0x6602,0x172));var _0x2660=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x6602[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0x2660('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2660('0x1'));var jsonpatch=require(_0x2660('0x2'));var rp=require(_0x2660('0x3'));var moment=require('moment');var BPromise=require(_0x2660('0x4'));var Mustache=require('mustache');var util=require(_0x2660('0x5'));var path=require(_0x2660('0x6'));var sox=require(_0x2660('0x7'));var csv=require('to-csv');var ejs=require(_0x2660('0x8'));var fs=require('fs');var fs_extra=require(_0x2660('0x9'));var _=require(_0x2660('0xa'));var squel=require(_0x2660('0xb'));var crypto=require(_0x2660('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2660('0xd'));var toCsv=require(_0x2660('0xe'));var querystring=require('querystring');var Papa=require(_0x2660('0xf'));var Redis=require('ioredis');var authService=require(_0x2660('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2660('0x11'))(_0x2660('0x12'));var utils=require(_0x2660('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2660('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2660('0x15'));function respondWithStatusCode(_0x55c068,_0x39bc8f){_0x39bc8f=_0x39bc8f||0xcc;return function(_0x4835b){if(_0x4835b){return _0x55c068[_0x2660('0x16')](_0x39bc8f);}return _0x55c068[_0x2660('0x17')](_0x39bc8f)[_0x2660('0x18')]();};}function respondWithResult(_0x39d1b2,_0x22efd1){_0x22efd1=_0x22efd1||0xc8;return function(_0x437d9a){if(_0x437d9a){return _0x39d1b2[_0x2660('0x17')](_0x22efd1)[_0x2660('0x19')](_0x437d9a);}};}function respondWithFilteredResult(_0x14cb5a,_0x407e54){return function(_0x304b85){if(_0x304b85){var _0x4f9564=typeof _0x407e54[_0x2660('0x1a')]==='undefined'&&typeof _0x407e54[_0x2660('0x1b')]==='undefined';var _0x3c7a19=_0x304b85['count'];var _0x4fde7b=_0x4f9564?0x0:_0x407e54[_0x2660('0x1a')];var _0x2d56cd=_0x4f9564?_0x304b85[_0x2660('0x1c')]:_0x407e54[_0x2660('0x1a')]+_0x407e54['limit'];var _0xc21c3b;if(_0x2d56cd>=_0x3c7a19){_0x2d56cd=_0x3c7a19;_0xc21c3b=0xc8;}else{_0xc21c3b=0xce;}_0x14cb5a[_0x2660('0x17')](_0xc21c3b);return _0x14cb5a[_0x2660('0x1d')](_0x2660('0x1e'),_0x4fde7b+'-'+_0x2d56cd+'/'+_0x3c7a19)[_0x2660('0x19')](_0x304b85);}return null;};}function patchUpdates(_0x239029){return function(_0x103c09){try{jsonpatch[_0x2660('0x1f')](_0x103c09,_0x239029,!![]);}catch(_0x4b7290){return BPromise[_0x2660('0x20')](_0x4b7290);}return _0x103c09[_0x2660('0x21')]();};}function saveUpdates(_0xe866f5,_0x4c5d78){return function(_0x2056f7){if(_0x2056f7){return _0x2056f7[_0x2660('0x22')](_0xe866f5)[_0x2660('0x23')](function(_0x12e6cd){return _0x12e6cd;});}return null;};}function removeEntity(_0x57ec8e,_0x70942e){return function(_0x31e808){if(_0x31e808){return _0x31e808[_0x2660('0x24')]()[_0x2660('0x23')](function(){_0x57ec8e[_0x2660('0x17')](0xcc)[_0x2660('0x18')]();});}};}function handleEntityNotFound(_0x363f7b,_0x173881){return function(_0x38efe7){if(!_0x38efe7){_0x363f7b[_0x2660('0x16')](0x194);}return _0x38efe7;};}function handleError(_0x5e8b81,_0x5effc0){_0x5effc0=_0x5effc0||0x1f4;return function(_0x59bb19){logger[_0x2660('0x25')](_0x59bb19[_0x2660('0x26')]);if(_0x59bb19['name']){delete _0x59bb19[_0x2660('0x27')];}_0x5e8b81[_0x2660('0x17')](_0x5effc0)[_0x2660('0x28')](_0x59bb19);};}exports[_0x2660('0x29')]=function(_0x1f2fff,_0x1bd414){var _0x8bfb16={},_0x406980={},_0x53cc78={'count':0x0,'rows':[]};var _0x1a2c00=_[_0x2660('0x2a')](db[_0x2660('0x2b')][_0x2660('0x2c')],function(_0x42a0ab){return{'name':_0x42a0ab[_0x2660('0x2d')],'type':_0x42a0ab[_0x2660('0x2e')]['key']};});_0x406980[_0x2660('0x2f')]=_[_0x2660('0x2a')](_0x1a2c00,_0x2660('0x27'));_0x406980[_0x2660('0x30')]=_[_0x2660('0x31')](_0x1f2fff['query']);_0x406980[_0x2660('0x32')]=_[_0x2660('0x33')](_0x406980[_0x2660('0x2f')],_0x406980[_0x2660('0x30')]);_0x8bfb16[_0x2660('0x34')]=_[_0x2660('0x33')](_0x406980[_0x2660('0x2f')],qs[_0x2660('0x35')](_0x1f2fff[_0x2660('0x30')]['fields']));_0x8bfb16[_0x2660('0x34')]=_0x8bfb16[_0x2660('0x34')][_0x2660('0x36')]?_0x8bfb16[_0x2660('0x34')]:_0x406980[_0x2660('0x2f')];if(!_0x1f2fff['query'][_0x2660('0x37')](_0x2660('0x38'))){_0x8bfb16[_0x2660('0x1b')]=qs[_0x2660('0x1b')](_0x1f2fff[_0x2660('0x30')][_0x2660('0x1b')]);_0x8bfb16[_0x2660('0x1a')]=qs[_0x2660('0x1a')](_0x1f2fff[_0x2660('0x30')][_0x2660('0x1a')]);}_0x8bfb16[_0x2660('0x39')]=qs[_0x2660('0x3a')](_0x1f2fff['query']['sort']);_0x8bfb16[_0x2660('0x3b')]=qs['filters'](_[_0x2660('0x3c')](_0x1f2fff[_0x2660('0x30')],_0x406980['filters']),_0x1a2c00);if(_0x1f2fff[_0x2660('0x30')]['filter']){_0x8bfb16['where']=_[_0x2660('0x3d')](_0x8bfb16['where'],{'$or':_[_0x2660('0x2a')](_0x1a2c00,function(_0x48664a){if(_0x48664a['type']!=='VIRTUAL'){var _0x23b377={};_0x23b377[_0x48664a[_0x2660('0x27')]]={'$like':'%'+_0x1f2fff[_0x2660('0x30')][_0x2660('0x3e')]+'%'};return _0x23b377;}})});}_0x8bfb16=_[_0x2660('0x3d')]({},_0x8bfb16,_0x1f2fff[_0x2660('0x3f')]);var _0x488701={'where':_0x8bfb16['where']};return db[_0x2660('0x2b')]['count'](_0x488701)[_0x2660('0x23')](function(_0x43082e){_0x53cc78[_0x2660('0x1c')]=_0x43082e;if(_0x1f2fff[_0x2660('0x30')][_0x2660('0x40')]){_0x8bfb16['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0x2660('0x41')](_0x8bfb16);})[_0x2660('0x23')](function(_0x3ea425){_0x53cc78[_0x2660('0x42')]=_0x3ea425;return _0x53cc78;})[_0x2660('0x23')](respondWithFilteredResult(_0x1bd414,_0x8bfb16))['catch'](handleError(_0x1bd414,null));};exports[_0x2660('0x43')]=function(_0xce57f1,_0x224ebe){var _0x281b8b={'raw':![],'where':{'id':_0xce57f1[_0x2660('0x44')]['id']}},_0x14fff8={};_0x14fff8[_0x2660('0x2f')]=_[_0x2660('0x31')](db[_0x2660('0x2b')][_0x2660('0x2c')]);_0x14fff8[_0x2660('0x30')]=_[_0x2660('0x31')](_0xce57f1['query']);_0x14fff8[_0x2660('0x32')]=_[_0x2660('0x33')](_0x14fff8[_0x2660('0x2f')],_0x14fff8['query']);_0x281b8b[_0x2660('0x34')]=_[_0x2660('0x33')](_0x14fff8[_0x2660('0x2f')],qs[_0x2660('0x35')](_0xce57f1[_0x2660('0x30')]['fields']));_0x281b8b['attributes']=_0x281b8b['attributes'][_0x2660('0x36')]?_0x281b8b[_0x2660('0x34')]:_0x14fff8[_0x2660('0x2f')];if(_0xce57f1[_0x2660('0x30')][_0x2660('0x40')]){_0x281b8b[_0x2660('0x45')]=[{'all':!![]}];}_0x281b8b=_[_0x2660('0x3d')]({},_0x281b8b,_0xce57f1['options']);return db[_0x2660('0x2b')][_0x2660('0x46')](_0x281b8b)[_0x2660('0x23')](handleEntityNotFound(_0x224ebe,null))[_0x2660('0x23')](respondWithResult(_0x224ebe,null))[_0x2660('0x47')](handleError(_0x224ebe,null));};exports['create']=function(_0x368202,_0x113de5){return db['ServicenowAccount']['create'](_0x368202[_0x2660('0x48')],{})['then'](respondWithResult(_0x113de5,0xc9))[_0x2660('0x47')](handleError(_0x113de5,null));};exports[_0x2660('0x22')]=function(_0x47dfa,_0x43bdb2){if(_0x47dfa[_0x2660('0x48')]['id']){delete _0x47dfa[_0x2660('0x48')]['id'];}return db[_0x2660('0x2b')][_0x2660('0x46')]({'where':{'id':_0x47dfa[_0x2660('0x44')]['id']}})[_0x2660('0x23')](handleEntityNotFound(_0x43bdb2,null))['then'](saveUpdates(_0x47dfa[_0x2660('0x48')],null))[_0x2660('0x23')](respondWithResult(_0x43bdb2,null))[_0x2660('0x47')](handleError(_0x43bdb2,null));};exports[_0x2660('0x24')]=function(_0x996663,_0x162c41){return db[_0x2660('0x2b')][_0x2660('0x46')]({'where':{'id':_0x996663[_0x2660('0x44')]['id']}})[_0x2660('0x23')](handleEntityNotFound(_0x162c41,null))['then'](removeEntity(_0x162c41,null))[_0x2660('0x47')](handleError(_0x162c41,null));};exports[_0x2660('0x49')]=function(_0x1e27b4,_0x469746,_0x2bd55b){var _0x4af0cf={};var _0x29c016={};var _0x436a4f;var _0x4432e0;return db['ServicenowAccount'][_0x2660('0x4a')]({'where':{'id':_0x1e27b4[_0x2660('0x44')]['id']}})[_0x2660('0x23')](handleEntityNotFound(_0x469746,null))[_0x2660('0x23')](function(_0x48da15){if(_0x48da15){_0x436a4f=_0x48da15;_0x29c016['model']=_[_0x2660('0x31')](db[_0x2660('0x4b')]['rawAttributes']);_0x29c016[_0x2660('0x30')]=_[_0x2660('0x31')](_0x1e27b4['query']);_0x29c016[_0x2660('0x32')]=_[_0x2660('0x33')](_0x29c016['model'],_0x29c016['query']);_0x4af0cf['attributes']=_['intersection'](_0x29c016[_0x2660('0x2f')],qs[_0x2660('0x35')](_0x1e27b4[_0x2660('0x30')][_0x2660('0x35')]));_0x4af0cf[_0x2660('0x34')]=_0x4af0cf[_0x2660('0x34')][_0x2660('0x36')]?_0x4af0cf[_0x2660('0x34')]:_0x29c016[_0x2660('0x2f')];_0x4af0cf[_0x2660('0x39')]=qs['sort'](_0x1e27b4[_0x2660('0x30')][_0x2660('0x3a')]);_0x4af0cf['where']=qs[_0x2660('0x32')](_[_0x2660('0x3c')](_0x1e27b4[_0x2660('0x30')],_0x29c016[_0x2660('0x32')]));if(_0x1e27b4[_0x2660('0x30')]['filter']){_0x4af0cf[_0x2660('0x3b')]=_[_0x2660('0x3d')](_0x4af0cf['where'],{'$or':_[_0x2660('0x2a')](_0x4af0cf[_0x2660('0x34')],function(_0x44d6cd){var _0x399eb2={};_0x399eb2[_0x44d6cd]={'$like':'%'+_0x1e27b4[_0x2660('0x30')][_0x2660('0x3e')]+'%'};return _0x399eb2;})});}_0x4af0cf=_[_0x2660('0x3d')]({},_0x4af0cf,_0x1e27b4[_0x2660('0x3f')]);return _0x436a4f[_0x2660('0x49')](_0x4af0cf);}})[_0x2660('0x23')](function(_0x5d7f64){if(_0x5d7f64){_0x4432e0=_0x5d7f64[_0x2660('0x36')];if(!_0x1e27b4['query'][_0x2660('0x37')](_0x2660('0x38'))){_0x4af0cf[_0x2660('0x1b')]=qs[_0x2660('0x1b')](_0x1e27b4[_0x2660('0x30')][_0x2660('0x1b')]);_0x4af0cf[_0x2660('0x1a')]=qs[_0x2660('0x1a')](_0x1e27b4[_0x2660('0x30')][_0x2660('0x1a')]);}return _0x436a4f['getConfigurations'](_0x4af0cf);}})['then'](function(_0x11e544){if(_0x11e544){return _0x11e544?{'count':_0x4432e0,'rows':_0x11e544}:null;}})['then'](respondWithResult(_0x469746,null))[_0x2660('0x47')](handleError(_0x469746,null));};exports[_0x2660('0x4c')]=function(_0x2c4ce0,_0x47d115,_0x2fc82a){if(_0x2c4ce0[_0x2660('0x48')]['id']){delete _0x2c4ce0[_0x2660('0x48')]['id'];}return db[_0x2660('0x2b')][_0x2660('0x4a')]({'where':{'id':_0x2c4ce0['params']['id']}})[_0x2660('0x23')](handleEntityNotFound(_0x47d115,null))[_0x2660('0x23')](function(_0x3512bc){if(_0x3512bc){_0x2c4ce0[_0x2660('0x48')]['AccountId']=_0x3512bc['id'];_0x2c4ce0[_0x2660('0x48')]['Subjects']=integrations[_0x2660('0x4d')](_0x2c4ce0['body']['channel'],_0x2c4ce0[_0x2660('0x48')][_0x2660('0x2e')]);_0x2c4ce0['body']['Descriptions']=integrations[_0x2660('0x4e')](_0x2c4ce0['body'][_0x2660('0x4f')],_0x2c4ce0[_0x2660('0x48')]['type']);return db[_0x2660('0x4b')][_0x2660('0x50')](_0x2c4ce0[_0x2660('0x48')],{'include':[{'model':db['ServicenowField'],'as':_0x2660('0x51')},{'model':db['ServicenowField'],'as':_0x2660('0x52')}]});}return null;})[_0x2660('0x23')](respondWithResult(_0x47d115,null))[_0x2660('0x47')](handleError(_0x47d115,null));};exports[_0x2660('0x53')]=function(_0x5d9377,_0x2037be,_0x448c44){var _0xa0e8c5=[_0x2660('0x54'),_0x2660('0x55'),_0x2660('0x56'),'subcategory',_0x2660('0x57'),_0x2660('0x58'),'incident_state',_0x2660('0x59'),_0x2660('0x5a')];var _0x2c4990=[_0x2660('0x5b'),_0x2660('0x54'),_0x2660('0x5c'),_0x2660('0x5d'),_0x2660('0x5e'),_0x2660('0x5f'),_0x2660('0x60'),_0x2660('0x55'),'approval_history','number',_0x2660('0x61'),'sys_updated_by',_0x2660('0x62'),_0x2660('0x63'),_0x2660('0x64'),_0x2660('0x65'),_0x2660('0x66'),_0x2660('0x67'),'knowledge','order','calendar_stc',_0x2660('0x68'),_0x2660('0x69'),_0x2660('0x6a'),'impact',_0x2660('0x6b'),_0x2660('0x6c'),_0x2660('0x6d'),_0x2660('0x6e'),'sys_domain_path',_0x2660('0x6f'),'time_worked','expected_start',_0x2660('0x70'),'business_duration',_0x2660('0x71'),'work_end','reopened_time',_0x2660('0x72'),_0x2660('0x73'),_0x2660('0x74'),_0x2660('0x75'),_0x2660('0x76'),_0x2660('0x77'),_0x2660('0x57'),_0x2660('0x78'),'delivery_task',_0x2660('0x79'),_0x2660('0x7a'),_0x2660('0x7b'),'additional_assignee_list','description',_0x2660('0x7c'),'notify',_0x2660('0x7d'),_0x2660('0x7e'),_0x2660('0x7f'),_0x2660('0x80'),'parent_incident','sys_id','contact_type',_0x2660('0x81'),'incident_state',_0x2660('0x82'),_0x2660('0x83'),_0x2660('0x84'),_0x2660('0x85'),'activity_due',_0x2660('0x86'),_0x2660('0x59'),_0x2660('0x87'),_0x2660('0x88'),_0x2660('0x89'),_0x2660('0x8a'),_0x2660('0x8b'),_0x2660('0x8c'),_0x2660('0x8d'),_0x2660('0x8e'),_0x2660('0x8f'),'upon_approval','correlation_id',_0x2660('0x90'),'category'];var _0x4e61a4='';var _0x3771da='';var _0x3f6532=[];var _0x2a0af7='';var _0x36f139='';var _0x20e3af=[];var _0x5c25b4='';var _0x1d25aa='';var _0x405f8d={};var _0x24fe42='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x5d9377[_0x2660('0x44')]['id']},'attributes':['id','username','password','email',_0x2660('0x91'),_0x2660('0x92')]})['then'](handleEntityNotFound(_0x2037be,null))['then'](function(_0x28ddf7){if(_0x28ddf7){_0x24fe42=_0x28ddf7[_0x2660('0x91')];var _0x19c0a1=_0x24fe42[_0x2660('0x93')](-0x1);if(_0x19c0a1==='/'){_0x24fe42=_0x24fe42[_0x2660('0x94')](0x0,_0x24fe42[_0x2660('0x95')](_0x19c0a1));}_0x1d25aa=util[_0x2660('0x96')](_0x2660('0x97'),_0x24fe42);_0x5c25b4=util[_0x2660('0x96')](_0x2660('0x98'),_0x24fe42);_0x405f8d={'user':_0x28ddf7[_0x2660('0x99')],'pass':_0x28ddf7['password']};var _0x5ae2c7={'method':_0x2660('0x9a'),'uri':_0x1d25aa+_0x2660('0x9b'),'auth':_0x405f8d,'json':!![]};return rp(_0x5ae2c7);}})[_0x2660('0x23')](function(_0x217a83){if(_0x217a83[_0x2660('0x9c')][_0x2660('0x36')]>0x0){_0x4e61a4=_0x217a83[_0x2660('0x9c')];}console[_0x2660('0x9d')](_0x2660('0x9e'),_0x4e61a4);_0x20e3af=[];_0x3771da=Object[_0x2660('0x9f')]([],_0x4e61a4);_[_0x2660('0xa0')](_0x3771da,function(_0x359101){return!_0xa0e8c5[_0x2660('0xa1')](_0x359101[_0x2660('0x27')]);});_0x3771da[_0x2660('0xa2')](function(_0xdce227){var _0x3b229a=createFieldObject(_0x5c25b4,_0x405f8d,_0xdce227[_0x2660('0xa3')],_0xdce227[_0x2660('0x27')],_0xdce227['label'],![]);_0x20e3af['push'](_0x3b229a);});return Promise[_0x2660('0xa4')](_0x20e3af);})[_0x2660('0x23')](function(_0x34ffd7){_0x3f6532=_0x34ffd7;_0x2a0af7=Object[_0x2660('0x9f')]([],_0x4e61a4);console[_0x2660('0x9d')](_0x2660('0xa5'),_0x4e61a4);_[_0x2660('0xa0')](_0x2a0af7,function(_0xa75c60){return _0x2c4990[_0x2660('0xa1')](_0xa75c60['name']);});console['log'](_0x2660('0xa6'),_0x2a0af7);_0x20e3af=[];_0x2a0af7[_0x2660('0xa2')](function(_0x1ef486){var _0x194517=createFieldObject(_0x5c25b4,_0x405f8d,_0x1ef486[_0x2660('0xa3')],_0x1ef486[_0x2660('0x27')],_0x1ef486[_0x2660('0xa7')],!![]);_0x20e3af[_0x2660('0xa8')](_0x194517);});return Promise[_0x2660('0xa4')](_0x20e3af);})[_0x2660('0x23')](function(_0x21f0d6){_0x36f139=_0x21f0d6;var _0x263509=_0x3f6532[_0x2660('0xa9')](_0x36f139);return{'count':_0x263509[_0x2660('0x36')],'rows':_0x263509};})['then'](respondWithResult(_0x2037be,null))[_0x2660('0x47')](function(_0x163357){console[_0x2660('0x9d')](_0x2660('0xaa')+_0x163357);var _0x3db4d8=_0x5d9377[_0x2660('0x30')]['test']?0x1f4:_0x163357[_0x2660('0xab')]||0x1f4;logger['error'](_0x163357[_0x2660('0x26')]);delete _0x163357[_0x2660('0x27')];if(_0x3db4d8===0x191){_0x3db4d8=0x190;}_0x2037be[_0x2660('0x17')](_0x3db4d8)[_0x2660('0x28')](_0x5d9377[_0x2660('0x30')][_0x2660('0xac')]?{'message':_0x2660('0xad'),'statusCode':_0x163357[_0x2660('0xab')]}:_0x163357);});};function createFieldObject(_0x3720a3,_0x31f309,_0xd488f8,_0x2f2b88,_0x34bd7c,_0x5df1bf){return new Promise(function(_0x23223c,_0x303e53){var _0x173981={'id':_0x2f2b88,'name':_0x34bd7c,'custom':_0x5df1bf};if(_0xd488f8==='boolean'){_0x173981[_0x2660('0x3f')]=[{'name':'True','value':_0x2660('0xae')},{'name':_0x2660('0xaf'),'value':_0x2660('0xb0')}];_0x23223c(_0x173981);}else{var _0x54212e={'method':_0x2660('0x9a'),'uri':_0x3720a3+'sys_choice?sysparm_query=name=incident^element='+_0x2f2b88,'auth':_0x31f309,'json':!![]};return rp(_0x54212e)['then'](function(_0x2cd390){var _0x5f4922=[];if(_0x2cd390['result'][_0x2660('0x36')]>0x0){_0x2cd390[_0x2660('0x9c')][_0x2660('0xa2')](function(_0x5acd3b){if(_0x5acd3b['inactive']===_0x2660('0xb0')){var _0x43b42c={'name':_0x5acd3b[_0x2660('0xa7')],'value':_0x5acd3b['value']};_0x5f4922[_0x2660('0xa8')](_0x43b42c);}});}_0x173981['options']=_0x5f4922;if(_0x173981['options']['length']>0x0){_0x23223c(_0x173981);}else{if(_0x5df1bf==![]){_0x23223c();}else{_0x23223c(_0x173981);}}});}});} \ No newline at end of file +var _0xc559=['show','params','keys','rawAttributes','length','create','body','find','destroy','getConfigurations','findOne','sort','AccountId','Subjects','ServicenowConfiguration','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','rfc','time_worked','opened_at','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','sla_due','approval','due_date','sys_mod_count','sys_tags','escalation','upon_approval','username','password','email','remoteUri','serverUrl','substring','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','push','all','TCL:\x20_object','forEach','internalType','label','test','statusCode','Wrong\x20credentials','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x278aed,_0x310dab){var _0x2009b3=function(_0x5489d0){while(--_0x5489d0){_0x278aed['push'](_0x278aed['shift']());}};_0x2009b3(++_0x310dab);}(_0xc559,0x121));var _0x9c55=function(_0x498519,_0x260740){_0x498519=_0x498519-0x0;var _0x1771da=_0xc559[_0x498519];return _0x1771da;};'use strict';var emlformat=require(_0x9c55('0x0'));var rimraf=require(_0x9c55('0x1'));var zipdir=require(_0x9c55('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c55('0x3'));var moment=require('moment');var BPromise=require(_0x9c55('0x4'));var Mustache=require(_0x9c55('0x5'));var util=require(_0x9c55('0x6'));var path=require(_0x9c55('0x7'));var sox=require(_0x9c55('0x8'));var csv=require(_0x9c55('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c55('0xa'));var _=require(_0x9c55('0xb'));var squel=require(_0x9c55('0xc'));var crypto=require(_0x9c55('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9c55('0xe'));var toCsv=require(_0x9c55('0x9'));var querystring=require('querystring');var Papa=require(_0x9c55('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9c55('0x10'));var as=require(_0x9c55('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c55('0x12'));var utils=require(_0x9c55('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9c55('0x14'));var db=require(_0x9c55('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2d159d,_0x11988e){_0x11988e=_0x11988e||0xcc;return function(_0x546c96){if(_0x546c96){return _0x2d159d[_0x9c55('0x16')](_0x11988e);}return _0x2d159d[_0x9c55('0x17')](_0x11988e)['end']();};}function respondWithResult(_0x345426,_0x199655){_0x199655=_0x199655||0xc8;return function(_0x31bcab){if(_0x31bcab){return _0x345426['status'](_0x199655)[_0x9c55('0x18')](_0x31bcab);}};}function respondWithFilteredResult(_0x2a0d49,_0x570239){return function(_0x201451){if(_0x201451){var _0x4a8e11=typeof _0x570239[_0x9c55('0x19')]===_0x9c55('0x1a')&&typeof _0x570239[_0x9c55('0x1b')]===_0x9c55('0x1a');var _0x5381b8=_0x201451[_0x9c55('0x1c')];var _0x1ef781=_0x4a8e11?0x0:_0x570239[_0x9c55('0x19')];var _0x24fd2b=_0x4a8e11?_0x201451['count']:_0x570239[_0x9c55('0x19')]+_0x570239[_0x9c55('0x1b')];var _0x6302c8;if(_0x24fd2b>=_0x5381b8){_0x24fd2b=_0x5381b8;_0x6302c8=0xc8;}else{_0x6302c8=0xce;}_0x2a0d49[_0x9c55('0x17')](_0x6302c8);return _0x2a0d49[_0x9c55('0x1d')](_0x9c55('0x1e'),_0x1ef781+'-'+_0x24fd2b+'/'+_0x5381b8)[_0x9c55('0x18')](_0x201451);}return null;};}function patchUpdates(_0x4eb9e6){return function(_0x45a402){try{jsonpatch[_0x9c55('0x1f')](_0x45a402,_0x4eb9e6,!![]);}catch(_0x1d3d33){return BPromise[_0x9c55('0x20')](_0x1d3d33);}return _0x45a402[_0x9c55('0x21')]();};}function saveUpdates(_0x28b075,_0x4e604f){return function(_0x10b736){if(_0x10b736){return _0x10b736[_0x9c55('0x22')](_0x28b075)['then'](function(_0x31047e){return _0x31047e;});}return null;};}function removeEntity(_0x1da3e7,_0x331145){return function(_0x2000f2){if(_0x2000f2){return _0x2000f2['destroy']()[_0x9c55('0x23')](function(){_0x1da3e7[_0x9c55('0x17')](0xcc)[_0x9c55('0x24')]();});}};}function handleEntityNotFound(_0x3b30b7,_0x106872){return function(_0x4c2acc){if(!_0x4c2acc){_0x3b30b7[_0x9c55('0x16')](0x194);}return _0x4c2acc;};}function handleError(_0x149580,_0x5f4d0d){_0x5f4d0d=_0x5f4d0d||0x1f4;return function(_0x3c80d6){logger[_0x9c55('0x25')](_0x3c80d6[_0x9c55('0x26')]);if(_0x3c80d6['name']){delete _0x3c80d6[_0x9c55('0x27')];}_0x149580[_0x9c55('0x17')](_0x5f4d0d)[_0x9c55('0x28')](_0x3c80d6);};}exports[_0x9c55('0x29')]=function(_0x5d50e7,_0x14e5d1){var _0x36d235={},_0x285379={},_0x352ee5={'count':0x0,'rows':[]};var _0x256fa8=_[_0x9c55('0x2a')](db[_0x9c55('0x2b')]['rawAttributes'],function(_0x25db48){return{'name':_0x25db48[_0x9c55('0x2c')],'type':_0x25db48[_0x9c55('0x2d')][_0x9c55('0x2e')]};});_0x285379[_0x9c55('0x2f')]=_[_0x9c55('0x2a')](_0x256fa8,_0x9c55('0x27'));_0x285379[_0x9c55('0x30')]=_['keys'](_0x5d50e7[_0x9c55('0x30')]);_0x285379[_0x9c55('0x31')]=_[_0x9c55('0x32')](_0x285379['model'],_0x285379[_0x9c55('0x30')]);_0x36d235[_0x9c55('0x33')]=_[_0x9c55('0x32')](_0x285379[_0x9c55('0x2f')],qs['fields'](_0x5d50e7[_0x9c55('0x30')][_0x9c55('0x34')]));_0x36d235['attributes']=_0x36d235[_0x9c55('0x33')]['length']?_0x36d235[_0x9c55('0x33')]:_0x285379[_0x9c55('0x2f')];if(!_0x5d50e7[_0x9c55('0x30')][_0x9c55('0x35')](_0x9c55('0x36'))){_0x36d235[_0x9c55('0x1b')]=qs['limit'](_0x5d50e7[_0x9c55('0x30')][_0x9c55('0x1b')]);_0x36d235[_0x9c55('0x19')]=qs[_0x9c55('0x19')](_0x5d50e7[_0x9c55('0x30')][_0x9c55('0x19')]);}_0x36d235[_0x9c55('0x37')]=qs['sort'](_0x5d50e7[_0x9c55('0x30')]['sort']);_0x36d235[_0x9c55('0x38')]=qs['filters'](_[_0x9c55('0x39')](_0x5d50e7[_0x9c55('0x30')],_0x285379[_0x9c55('0x31')]),_0x256fa8);if(_0x5d50e7[_0x9c55('0x30')][_0x9c55('0x3a')]){_0x36d235['where']=_[_0x9c55('0x3b')](_0x36d235[_0x9c55('0x38')],{'$or':_[_0x9c55('0x2a')](_0x256fa8,function(_0x2a7542){if(_0x2a7542[_0x9c55('0x2d')]!==_0x9c55('0x3c')){var _0x5a3770={};_0x5a3770[_0x2a7542[_0x9c55('0x27')]]={'$like':'%'+_0x5d50e7['query'][_0x9c55('0x3a')]+'%'};return _0x5a3770;}})});}_0x36d235=_[_0x9c55('0x3b')]({},_0x36d235,_0x5d50e7[_0x9c55('0x3d')]);var _0xdb24c8={'where':_0x36d235['where']};return db[_0x9c55('0x2b')][_0x9c55('0x1c')](_0xdb24c8)['then'](function(_0x316ef0){_0x352ee5[_0x9c55('0x1c')]=_0x316ef0;if(_0x5d50e7[_0x9c55('0x30')][_0x9c55('0x3e')]){_0x36d235[_0x9c55('0x3f')]=[{'all':!![]}];}return db[_0x9c55('0x2b')][_0x9c55('0x40')](_0x36d235);})[_0x9c55('0x23')](function(_0xc357c6){_0x352ee5[_0x9c55('0x41')]=_0xc357c6;return _0x352ee5;})[_0x9c55('0x23')](respondWithFilteredResult(_0x14e5d1,_0x36d235))[_0x9c55('0x42')](handleError(_0x14e5d1,null));};exports[_0x9c55('0x43')]=function(_0x59629e,_0x112a90){var _0x33a5fa={'raw':![],'where':{'id':_0x59629e[_0x9c55('0x44')]['id']}},_0x5a8167={};_0x5a8167['model']=_[_0x9c55('0x45')](db['ServicenowAccount'][_0x9c55('0x46')]);_0x5a8167[_0x9c55('0x30')]=_['keys'](_0x59629e[_0x9c55('0x30')]);_0x5a8167[_0x9c55('0x31')]=_[_0x9c55('0x32')](_0x5a8167[_0x9c55('0x2f')],_0x5a8167[_0x9c55('0x30')]);_0x33a5fa[_0x9c55('0x33')]=_['intersection'](_0x5a8167[_0x9c55('0x2f')],qs[_0x9c55('0x34')](_0x59629e['query']['fields']));_0x33a5fa[_0x9c55('0x33')]=_0x33a5fa[_0x9c55('0x33')][_0x9c55('0x47')]?_0x33a5fa['attributes']:_0x5a8167['model'];if(_0x59629e['query'][_0x9c55('0x3e')]){_0x33a5fa[_0x9c55('0x3f')]=[{'all':!![]}];}_0x33a5fa=_[_0x9c55('0x3b')]({},_0x33a5fa,_0x59629e[_0x9c55('0x3d')]);return db[_0x9c55('0x2b')]['find'](_0x33a5fa)[_0x9c55('0x23')](handleEntityNotFound(_0x112a90,null))['then'](respondWithResult(_0x112a90,null))[_0x9c55('0x42')](handleError(_0x112a90,null));};exports[_0x9c55('0x48')]=function(_0x56c53b,_0x2faac8){return db[_0x9c55('0x2b')][_0x9c55('0x48')](_0x56c53b[_0x9c55('0x49')],{})['then'](respondWithResult(_0x2faac8,0xc9))[_0x9c55('0x42')](handleError(_0x2faac8,null));};exports[_0x9c55('0x22')]=function(_0x3cfab4,_0x5e5c52){if(_0x3cfab4[_0x9c55('0x49')]['id']){delete _0x3cfab4[_0x9c55('0x49')]['id'];}return db[_0x9c55('0x2b')][_0x9c55('0x4a')]({'where':{'id':_0x3cfab4[_0x9c55('0x44')]['id']}})[_0x9c55('0x23')](handleEntityNotFound(_0x5e5c52,null))[_0x9c55('0x23')](saveUpdates(_0x3cfab4[_0x9c55('0x49')],null))[_0x9c55('0x23')](respondWithResult(_0x5e5c52,null))[_0x9c55('0x42')](handleError(_0x5e5c52,null));};exports[_0x9c55('0x4b')]=function(_0x387eeb,_0x531b98){return db[_0x9c55('0x2b')][_0x9c55('0x4a')]({'where':{'id':_0x387eeb[_0x9c55('0x44')]['id']}})['then'](handleEntityNotFound(_0x531b98,null))[_0x9c55('0x23')](removeEntity(_0x531b98,null))['catch'](handleError(_0x531b98,null));};exports[_0x9c55('0x4c')]=function(_0x4f63c4,_0x302cd9,_0x11d923){var _0x1a1855={};var _0x3e6452={};var _0x3c93c5;var _0x41384b;return db[_0x9c55('0x2b')][_0x9c55('0x4d')]({'where':{'id':_0x4f63c4[_0x9c55('0x44')]['id']}})[_0x9c55('0x23')](handleEntityNotFound(_0x302cd9,null))[_0x9c55('0x23')](function(_0x13c530){if(_0x13c530){_0x3c93c5=_0x13c530;_0x3e6452['model']=_[_0x9c55('0x45')](db['ServicenowConfiguration']['rawAttributes']);_0x3e6452[_0x9c55('0x30')]=_[_0x9c55('0x45')](_0x4f63c4[_0x9c55('0x30')]);_0x3e6452['filters']=_[_0x9c55('0x32')](_0x3e6452['model'],_0x3e6452['query']);_0x1a1855[_0x9c55('0x33')]=_[_0x9c55('0x32')](_0x3e6452[_0x9c55('0x2f')],qs[_0x9c55('0x34')](_0x4f63c4[_0x9c55('0x30')][_0x9c55('0x34')]));_0x1a1855[_0x9c55('0x33')]=_0x1a1855[_0x9c55('0x33')]['length']?_0x1a1855['attributes']:_0x3e6452['model'];_0x1a1855[_0x9c55('0x37')]=qs[_0x9c55('0x4e')](_0x4f63c4['query'][_0x9c55('0x4e')]);_0x1a1855[_0x9c55('0x38')]=qs[_0x9c55('0x31')](_[_0x9c55('0x39')](_0x4f63c4['query'],_0x3e6452[_0x9c55('0x31')]));if(_0x4f63c4[_0x9c55('0x30')][_0x9c55('0x3a')]){_0x1a1855[_0x9c55('0x38')]=_[_0x9c55('0x3b')](_0x1a1855[_0x9c55('0x38')],{'$or':_[_0x9c55('0x2a')](_0x1a1855[_0x9c55('0x33')],function(_0x3d262f){var _0x1ffb63={};_0x1ffb63[_0x3d262f]={'$like':'%'+_0x4f63c4[_0x9c55('0x30')]['filter']+'%'};return _0x1ffb63;})});}_0x1a1855=_[_0x9c55('0x3b')]({},_0x1a1855,_0x4f63c4[_0x9c55('0x3d')]);return _0x3c93c5[_0x9c55('0x4c')](_0x1a1855);}})[_0x9c55('0x23')](function(_0x2387e6){if(_0x2387e6){_0x41384b=_0x2387e6[_0x9c55('0x47')];if(!_0x4f63c4[_0x9c55('0x30')]['hasOwnProperty'](_0x9c55('0x36'))){_0x1a1855[_0x9c55('0x1b')]=qs['limit'](_0x4f63c4[_0x9c55('0x30')][_0x9c55('0x1b')]);_0x1a1855[_0x9c55('0x19')]=qs[_0x9c55('0x19')](_0x4f63c4[_0x9c55('0x30')]['offset']);}return _0x3c93c5['getConfigurations'](_0x1a1855);}})[_0x9c55('0x23')](function(_0x2a0749){if(_0x2a0749){return _0x2a0749?{'count':_0x41384b,'rows':_0x2a0749}:null;}})[_0x9c55('0x23')](respondWithResult(_0x302cd9,null))[_0x9c55('0x42')](handleError(_0x302cd9,null));};exports['addConfiguration']=function(_0x2c946f,_0x3c6636,_0x217429){if(_0x2c946f[_0x9c55('0x49')]['id']){delete _0x2c946f[_0x9c55('0x49')]['id'];}return db['ServicenowAccount'][_0x9c55('0x4d')]({'where':{'id':_0x2c946f[_0x9c55('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c6636,null))[_0x9c55('0x23')](function(_0x347f41){if(_0x347f41){_0x2c946f[_0x9c55('0x49')][_0x9c55('0x4f')]=_0x347f41['id'];_0x2c946f[_0x9c55('0x49')][_0x9c55('0x50')]=integrations['getSubjects'](_0x2c946f[_0x9c55('0x49')]['channel'],_0x2c946f[_0x9c55('0x49')][_0x9c55('0x2d')]);_0x2c946f[_0x9c55('0x49')]['Descriptions']=integrations['getDescriptions'](_0x2c946f[_0x9c55('0x49')]['channel'],_0x2c946f[_0x9c55('0x49')][_0x9c55('0x2d')]);return db[_0x9c55('0x51')][_0x9c55('0x48')](_0x2c946f[_0x9c55('0x49')],{'include':[{'model':db[_0x9c55('0x52')],'as':_0x9c55('0x50')},{'model':db['ServicenowField'],'as':_0x9c55('0x53')}]});}return null;})[_0x9c55('0x23')](respondWithResult(_0x3c6636,null))[_0x9c55('0x42')](handleError(_0x3c6636,null));};exports['getFields']=function(_0x510ca8,_0x2abd0e,_0x31d48c){var _0x190c90=[_0x9c55('0x54'),_0x9c55('0x55'),_0x9c55('0x56'),_0x9c55('0x57'),_0x9c55('0x58'),_0x9c55('0x59'),_0x9c55('0x5a'),_0x9c55('0x5b'),_0x9c55('0x5c')];var _0x55ea12=['parent','made_sla',_0x9c55('0x5d'),_0x9c55('0x5e'),_0x9c55('0x5f'),_0x9c55('0x60'),'child_incidents',_0x9c55('0x55'),'approval_history',_0x9c55('0x61'),_0x9c55('0x62'),_0x9c55('0x63'),'opened_by',_0x9c55('0x64'),_0x9c55('0x65'),'sys_domain',_0x9c55('0x66'),_0x9c55('0x67'),_0x9c55('0x56'),'order',_0x9c55('0x68'),_0x9c55('0x69'),_0x9c55('0x6a'),_0x9c55('0x6b'),_0x9c55('0x6c'),_0x9c55('0x6d'),'work_notes_list',_0x9c55('0x6e'),_0x9c55('0x6f'),'sys_domain_path',_0x9c55('0x70'),_0x9c55('0x71'),'expected_start',_0x9c55('0x72'),'business_duration','group_list',_0x9c55('0x73'),_0x9c55('0x74'),'resolved_at',_0x9c55('0x75'),_0x9c55('0x76'),_0x9c55('0x57'),_0x9c55('0x77'),_0x9c55('0x78'),_0x9c55('0x58'),'correlation_display',_0x9c55('0x79'),_0x9c55('0x7a'),_0x9c55('0x7b'),_0x9c55('0x7c'),_0x9c55('0x7d'),_0x9c55('0x7e'),_0x9c55('0x7f'),_0x9c55('0x59'),_0x9c55('0x80'),'close_notes',_0x9c55('0x81'),_0x9c55('0x82'),_0x9c55('0x83'),_0x9c55('0x84'),_0x9c55('0x85'),_0x9c55('0x86'),_0x9c55('0x5a'),_0x9c55('0x87'),_0x9c55('0x88'),_0x9c55('0x89'),_0x9c55('0x8a'),'activity_due',_0x9c55('0x8b'),_0x9c55('0x5b'),'comments',_0x9c55('0x8c'),_0x9c55('0x8d'),'comments_and_work_notes',_0x9c55('0x8e'),_0x9c55('0x8f'),'reopen_count',_0x9c55('0x90'),_0x9c55('0x91'),_0x9c55('0x92'),'correlation_id','location',_0x9c55('0x5c')];var _0x1ba161='';var _0x1de654='';var _0x3632a0=[];var _0x5f461d='';var _0x3cb455='';var _0x29f71a=[];var _0xb640f2='';var _0x2d3b83='';var _0x4b8aa6={};var _0x4207b5='';return db['ServicenowAccount'][_0x9c55('0x4d')]({'where':{'id':_0x510ca8[_0x9c55('0x44')]['id']},'attributes':['id',_0x9c55('0x93'),_0x9c55('0x94'),_0x9c55('0x95'),_0x9c55('0x96'),_0x9c55('0x97')]})[_0x9c55('0x23')](handleEntityNotFound(_0x2abd0e,null))[_0x9c55('0x23')](function(_0x4f9b70){if(_0x4f9b70){_0x4207b5=_0x4f9b70[_0x9c55('0x96')];var _0x298458=_0x4207b5['slice'](-0x1);if(_0x298458==='/'){_0x4207b5=_0x4207b5[_0x9c55('0x98')](0x0,_0x4207b5['lastIndexOf'](_0x298458));}_0x2d3b83=util['format'](_0x9c55('0x99'),_0x4207b5);_0xb640f2=util['format'](_0x9c55('0x9a'),_0x4207b5);_0x4b8aa6={'user':_0x4f9b70['username'],'pass':_0x4f9b70['password']};var _0x56a8c1={'method':_0x9c55('0x9b'),'uri':_0x2d3b83+_0x9c55('0x9c'),'auth':_0x4b8aa6,'json':!![]};return rp(_0x56a8c1);}})[_0x9c55('0x23')](function(_0xffe5d9){if(_0xffe5d9[_0x9c55('0x9d')][_0x9c55('0x47')]>0x0){_0x1ba161=_0xffe5d9[_0x9c55('0x9d')];}console[_0x9c55('0x9e')]('incident\x20table\x20objects',_0x1ba161);_0x29f71a=[];_0x1de654=Object[_0x9c55('0x9f')]([],_0x1ba161);_[_0x9c55('0xa0')](_0x1de654,function(_0x8a255b){return!_0x190c90[_0x9c55('0xa1')](_0x8a255b[_0x9c55('0x27')]);});_0x1de654['forEach'](function(_0x4ecbc3){var _0x5acef1=createFieldObject(_0xb640f2,_0x4b8aa6,_0x4ecbc3['internalType'],_0x4ecbc3[_0x9c55('0x27')],_0x4ecbc3['label'],![]);_0x29f71a[_0x9c55('0xa2')](_0x5acef1);});return Promise[_0x9c55('0xa3')](_0x29f71a);})[_0x9c55('0x23')](function(_0x37b771){_0x3632a0=_0x37b771;_0x5f461d=Object[_0x9c55('0x9f')]([],_0x1ba161);console[_0x9c55('0x9e')](_0x9c55('0xa4'),_0x1ba161);_[_0x9c55('0xa0')](_0x5f461d,function(_0xcbac6a){return _0x55ea12[_0x9c55('0xa1')](_0xcbac6a[_0x9c55('0x27')]);});console[_0x9c55('0x9e')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5f461d);_0x29f71a=[];_0x5f461d[_0x9c55('0xa5')](function(_0x1e73e8){var _0x3c285e=createFieldObject(_0xb640f2,_0x4b8aa6,_0x1e73e8[_0x9c55('0xa6')],_0x1e73e8[_0x9c55('0x27')],_0x1e73e8[_0x9c55('0xa7')],!![]);_0x29f71a[_0x9c55('0xa2')](_0x3c285e);});return Promise[_0x9c55('0xa3')](_0x29f71a);})[_0x9c55('0x23')](function(_0x572943){_0x3cb455=_0x572943;var _0x4b622f=_0x3632a0['concat'](_0x3cb455);return{'count':_0x4b622f[_0x9c55('0x47')],'rows':_0x4b622f};})[_0x9c55('0x23')](respondWithResult(_0x2abd0e,null))['catch'](function(_0x5c5ab5){console['log']('ServiceNow\x20error:\x20'+_0x5c5ab5);var _0x172a2=_0x510ca8[_0x9c55('0x30')][_0x9c55('0xa8')]?0x1f4:_0x5c5ab5[_0x9c55('0xa9')]||0x1f4;logger[_0x9c55('0x25')](_0x5c5ab5[_0x9c55('0x26')]);delete _0x5c5ab5[_0x9c55('0x27')];if(_0x172a2===0x191){_0x172a2=0x190;}_0x2abd0e[_0x9c55('0x17')](_0x172a2)[_0x9c55('0x28')](_0x510ca8[_0x9c55('0x30')]['test']?{'message':_0x9c55('0xaa'),'statusCode':_0x5c5ab5['statusCode']}:_0x5c5ab5);});};function createFieldObject(_0x222944,_0x5f3e9b,_0x3212d8,_0x49b840,_0x5e9358,_0x4bfca6){return new Promise(function(_0x801188,_0x51b194){var _0x3ad3a9={'id':_0x49b840,'name':_0x5e9358,'custom':_0x4bfca6};if(_0x3212d8==='boolean'){_0x3ad3a9[_0x9c55('0x3d')]=[{'name':_0x9c55('0xab'),'value':_0x9c55('0xac')},{'name':_0x9c55('0xad'),'value':'false'}];_0x801188(_0x3ad3a9);}else{var _0x524932={'method':'GET','uri':_0x222944+_0x9c55('0xae')+_0x49b840,'auth':_0x5f3e9b,'json':!![]};return rp(_0x524932)[_0x9c55('0x23')](function(_0x29fe64){var _0x1d5a40=[];if(_0x29fe64['result']['length']>0x0){_0x29fe64[_0x9c55('0x9d')][_0x9c55('0xa5')](function(_0x47dcf8){if(_0x47dcf8[_0x9c55('0xaf')]===_0x9c55('0xb0')){var _0xb6f51a={'name':_0x47dcf8[_0x9c55('0xa7')],'value':_0x47dcf8[_0x9c55('0xb1')]};_0x1d5a40[_0x9c55('0xa2')](_0xb6f51a);}});}_0x3ad3a9[_0x9c55('0x3d')]=_0x1d5a40;if(_0x3ad3a9[_0x9c55('0x3d')][_0x9c55('0x47')]>0x0){_0x801188(_0x3ad3a9);}else{if(_0x4bfca6==![]){_0x801188();}else{_0x801188(_0x3ad3a9);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 870aef2..6117feb 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 _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x16504d,_0x39fa9c){var _0x54160c=function(_0xe0d6fe){while(--_0xe0d6fe){_0x16504d['push'](_0x16504d['shift']());}};_0x54160c(++_0x39fa9c);}(_0x8958,0x93));var _0x8895=function(_0x4be206,_0x290f63){_0x4be206=_0x4be206-0x0;var _0x1d95e6=_0x8958[_0x4be206];return _0x1d95e6;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount'];(function(_0x44e574,_0x484a6d){var _0x1319b0=function(_0x37a4f0){while(--_0x37a4f0){_0x44e574['push'](_0x44e574['shift']());}};_0x1319b0(++_0x484a6d);}(_0xb138,0x1dd));var _0x8b13=function(_0x38bffd,_0x3ecb9c){_0x38bffd=_0x38bffd-0x0;var _0x4e0013=_0xb138[_0x38bffd];return _0x4e0013;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x8b13('0xa')]=function(_0x13f7bd,_0x5d51b1){return _0x13f7bd[_0x8b13('0xb')](_0x8b13('0xc'),attributes,{'tableName':_0x8b13('0xd'),'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 17568dd..7d10b95 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 _0x97aa=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','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','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','util','moment','bluebird','randomstring'];(function(_0x25d4ab,_0x307164){var _0x3b31f3=function(_0x12f56c){while(--_0x12f56c){_0x25d4ab['push'](_0x25d4ab['shift']());}};_0x3b31f3(++_0x307164);}(_0x97aa,0x124));var _0xa97a=function(_0x561612,_0x162362){_0x561612=_0x561612-0x0;var _0x1a430d=_0x97aa[_0x561612];return _0x1a430d;};'use strict';var _=require('lodash');var util=require(_0xa97a('0x0'));var moment=require(_0xa97a('0x1'));var BPromise=require(_0xa97a('0x2'));var rs=require(_0xa97a('0x3'));var fs=require('fs');var Redis=require(_0xa97a('0x4'));var db=require(_0xa97a('0x5'))['db'];var utils=require(_0xa97a('0x6'));var logger=require(_0xa97a('0x7'))('rpc');var config=require(_0xa97a('0x8'));var jayson=require(_0xa97a('0x9'));var client=jayson[_0xa97a('0xa')][_0xa97a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52c35b,_0x3eec48,_0x1b7ca2){return new BPromise(function(_0x27b7ad,_0x5649a4){return client[_0xa97a('0xc')](_0x52c35b,_0x1b7ca2)[_0xa97a('0xd')](function(_0x4e547f){logger[_0xa97a('0xe')](_0xa97a('0xf'),_0x3eec48,_0xa97a('0x10'));logger[_0xa97a('0x11')](_0xa97a('0x12'),_0x3eec48,'request\x20sent',JSON[_0xa97a('0x13')](_0x4e547f));if(_0x4e547f['error']){if(_0x4e547f[_0xa97a('0x14')][_0xa97a('0x15')]===0x1f4){logger[_0xa97a('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x3eec48,_0x4e547f[_0xa97a('0x14')]['message']);return _0x5649a4(_0x4e547f[_0xa97a('0x14')][_0xa97a('0x16')]);}logger[_0xa97a('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x3eec48,_0x4e547f[_0xa97a('0x14')][_0xa97a('0x16')]);return _0x27b7ad(_0x4e547f['error']['message']);}else{logger['info'](_0xa97a('0xf'),_0x3eec48,_0xa97a('0x10'));_0x27b7ad(_0x4e547f[_0xa97a('0x17')][_0xa97a('0x16')]);}})[_0xa97a('0x18')](function(_0x1f5c1e){logger[_0xa97a('0x14')](_0xa97a('0xf'),_0x3eec48,_0x1f5c1e);_0x5649a4(_0x1f5c1e);});});}exports[_0xa97a('0x19')]=function(_0x3ed879){var _0x1bd663=this;return new Promise(function(_0x2d95ee,_0x1c1473){return db[_0xa97a('0x1a')][_0xa97a('0x1b')]({'raw':_0x3ed879[_0xa97a('0x1c')]?_0x3ed879['options'][_0xa97a('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ed879['options']?_0x3ed879[_0xa97a('0x1c')][_0xa97a('0x1e')]||null:null,'attributes':_0x3ed879[_0xa97a('0x1c')]?_0x3ed879[_0xa97a('0x1c')][_0xa97a('0x1f')]||null:null,'limit':_0x3ed879['options']?_0x3ed879[_0xa97a('0x1c')][_0xa97a('0x20')]||null:null,'include':_0x3ed879['options']?_0x3ed879[_0xa97a('0x1c')][_0xa97a('0x21')]?_[_0xa97a('0x22')](_0x3ed879[_0xa97a('0x1c')][_0xa97a('0x21')],function(_0x49dabf){return{'model':db[_0x49dabf[_0xa97a('0x23')]],'as':_0x49dabf['as'],'attributes':_0x49dabf[_0xa97a('0x1f')],'include':_0x49dabf[_0xa97a('0x21')]?_[_0xa97a('0x22')](_0x49dabf[_0xa97a('0x21')],function(_0x2e5229){return{'model':db[_0x2e5229[_0xa97a('0x23')]],'as':_0x2e5229['as'],'attributes':_0x2e5229['attributes'],'include':_0x2e5229['include']?_['map'](_0x2e5229['include'],function(_0x1f9bd1){return{'model':db[_0x1f9bd1[_0xa97a('0x23')]],'as':_0x1f9bd1['as'],'attributes':_0x1f9bd1[_0xa97a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa97a('0xd')](function(_0x3a4f6d){logger[_0xa97a('0xe')]('GetServicenowAccount',_0x3ed879);logger[_0xa97a('0x11')](_0xa97a('0x19'),_0x3ed879,JSON['stringify'](_0x3a4f6d));_0x2d95ee(_0x3a4f6d);})[_0xa97a('0x18')](function(_0x1feb13){logger[_0xa97a('0x14')](_0xa97a('0x19'),_0x1feb13['message'],_0x3ed879);_0x1c1473(_0x1bd663[_0xa97a('0x14')](0x1f4,_0x1feb13[_0xa97a('0x16')]));});});};exports['ShowServicenowAccount']=function(_0xac0650){var _0x449a58=this;return new Promise(function(_0x68dc16,_0x5e8bf7){return db[_0xa97a('0x1a')]['find']({'raw':_0xac0650[_0xa97a('0x1c')]?_0xac0650['options'][_0xa97a('0x1d')]===undefined?!![]:![]:!![],'where':_0xac0650[_0xa97a('0x1c')]?_0xac0650['options']['where']||null:null,'attributes':_0xac0650['options']?_0xac0650[_0xa97a('0x1c')][_0xa97a('0x1f')]||null:null,'include':_0xac0650[_0xa97a('0x1c')]?_0xac0650[_0xa97a('0x1c')][_0xa97a('0x21')]?_[_0xa97a('0x22')](_0xac0650[_0xa97a('0x1c')][_0xa97a('0x21')],function(_0x12b4e4){return{'model':db[_0x12b4e4[_0xa97a('0x23')]],'as':_0x12b4e4['as'],'attributes':_0x12b4e4[_0xa97a('0x1f')],'include':_0x12b4e4['include']?_['map'](_0x12b4e4[_0xa97a('0x21')],function(_0x4fe356){return{'model':db[_0x4fe356[_0xa97a('0x23')]],'as':_0x4fe356['as'],'attributes':_0x4fe356[_0xa97a('0x1f')],'include':_0x4fe356[_0xa97a('0x21')]?_['map'](_0x4fe356[_0xa97a('0x21')],function(_0x453004){return{'model':db[_0x453004['model']],'as':_0x453004['as'],'attributes':_0x453004['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x324015){logger[_0xa97a('0xe')](_0xa97a('0x24'),_0xac0650);logger['debug'](_0xa97a('0x24'),_0xac0650,JSON['stringify'](_0x324015));_0x68dc16(_0x324015);})[_0xa97a('0x18')](function(_0x494efd){logger['error'](_0xa97a('0x24'),_0x494efd[_0xa97a('0x16')],_0xac0650);_0x5e8bf7(_0x449a58[_0xa97a('0x14')](0x1f4,_0x494efd[_0xa97a('0x16')]));});});}; \ No newline at end of file +var _0xc308=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','ShowServicenowAccount','find','lodash','randomstring'];(function(_0x262c6f,_0x100803){var _0x1b9a8f=function(_0x133ce3){while(--_0x133ce3){_0x262c6f['push'](_0x262c6f['shift']());}};_0x1b9a8f(++_0x100803);}(_0xc308,0x115));var _0x8c30=function(_0x21b293,_0x352a44){_0x21b293=_0x21b293-0x0;var _0xd73e84=_0xc308[_0x21b293];return _0xd73e84;};'use strict';var _=require(_0x8c30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c30('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c30('0x2'));var logger=require(_0x8c30('0x3'))(_0x8c30('0x4'));var config=require(_0x8c30('0x5'));var jayson=require(_0x8c30('0x6'));var client=jayson[_0x8c30('0x7')][_0x8c30('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e14fe,_0x23d379,_0x50fe32){return new BPromise(function(_0x1d59c6,_0x59a9e6){return client['request'](_0x2e14fe,_0x50fe32)[_0x8c30('0x9')](function(_0x2a5eae){logger[_0x8c30('0xa')](_0x8c30('0xb'),_0x23d379,_0x8c30('0xc'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x23d379,_0x8c30('0xc'),JSON['stringify'](_0x2a5eae));if(_0x2a5eae[_0x8c30('0xd')]){if(_0x2a5eae[_0x8c30('0xd')][_0x8c30('0xe')]===0x1f4){logger[_0x8c30('0xd')](_0x8c30('0xb'),_0x23d379,_0x2a5eae[_0x8c30('0xd')][_0x8c30('0xf')]);return _0x59a9e6(_0x2a5eae[_0x8c30('0xd')][_0x8c30('0xf')]);}logger[_0x8c30('0xd')](_0x8c30('0xb'),_0x23d379,_0x2a5eae[_0x8c30('0xd')]['message']);return _0x1d59c6(_0x2a5eae[_0x8c30('0xd')][_0x8c30('0xf')]);}else{logger[_0x8c30('0xa')](_0x8c30('0xb'),_0x23d379,_0x8c30('0xc'));_0x1d59c6(_0x2a5eae['result'][_0x8c30('0xf')]);}})[_0x8c30('0x10')](function(_0x1a353f){logger[_0x8c30('0xd')](_0x8c30('0xb'),_0x23d379,_0x1a353f);_0x59a9e6(_0x1a353f);});});}exports[_0x8c30('0x11')]=function(_0x1d6944){var _0x489804=this;return new Promise(function(_0x192006,_0x1f892f){return db[_0x8c30('0x12')][_0x8c30('0x13')]({'raw':_0x1d6944[_0x8c30('0x14')]?_0x1d6944[_0x8c30('0x14')][_0x8c30('0x15')]===undefined?!![]:![]:!![],'where':_0x1d6944[_0x8c30('0x14')]?_0x1d6944['options']['where']||null:null,'attributes':_0x1d6944[_0x8c30('0x14')]?_0x1d6944[_0x8c30('0x14')][_0x8c30('0x16')]||null:null,'limit':_0x1d6944[_0x8c30('0x14')]?_0x1d6944[_0x8c30('0x14')][_0x8c30('0x17')]||null:null,'include':_0x1d6944[_0x8c30('0x14')]?_0x1d6944[_0x8c30('0x14')][_0x8c30('0x18')]?_[_0x8c30('0x19')](_0x1d6944[_0x8c30('0x14')][_0x8c30('0x18')],function(_0x5b1353){return{'model':db[_0x5b1353[_0x8c30('0x1a')]],'as':_0x5b1353['as'],'attributes':_0x5b1353[_0x8c30('0x16')],'include':_0x5b1353[_0x8c30('0x18')]?_['map'](_0x5b1353[_0x8c30('0x18')],function(_0x316f98){return{'model':db[_0x316f98['model']],'as':_0x316f98['as'],'attributes':_0x316f98[_0x8c30('0x16')],'include':_0x316f98[_0x8c30('0x18')]?_[_0x8c30('0x19')](_0x316f98[_0x8c30('0x18')],function(_0x41289d){return{'model':db[_0x41289d[_0x8c30('0x1a')]],'as':_0x41289d['as'],'attributes':_0x41289d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c30('0x9')](function(_0xd33a09){logger['info'](_0x8c30('0x11'),_0x1d6944);logger[_0x8c30('0x1b')](_0x8c30('0x11'),_0x1d6944,JSON[_0x8c30('0x1c')](_0xd33a09));_0x192006(_0xd33a09);})[_0x8c30('0x10')](function(_0x4408bf){logger['error'](_0x8c30('0x11'),_0x4408bf[_0x8c30('0xf')],_0x1d6944);_0x1f892f(_0x489804[_0x8c30('0xd')](0x1f4,_0x4408bf['message']));});});};exports[_0x8c30('0x1d')]=function(_0x4411df){var _0x31ca91=this;return new Promise(function(_0x50bafd,_0x123d7e){return db[_0x8c30('0x12')][_0x8c30('0x1e')]({'raw':_0x4411df[_0x8c30('0x14')]?_0x4411df['options']['raw']===undefined?!![]:![]:!![],'where':_0x4411df[_0x8c30('0x14')]?_0x4411df[_0x8c30('0x14')]['where']||null:null,'attributes':_0x4411df['options']?_0x4411df[_0x8c30('0x14')][_0x8c30('0x16')]||null:null,'include':_0x4411df[_0x8c30('0x14')]?_0x4411df[_0x8c30('0x14')][_0x8c30('0x18')]?_[_0x8c30('0x19')](_0x4411df[_0x8c30('0x14')][_0x8c30('0x18')],function(_0x267728){return{'model':db[_0x267728[_0x8c30('0x1a')]],'as':_0x267728['as'],'attributes':_0x267728[_0x8c30('0x16')],'include':_0x267728[_0x8c30('0x18')]?_[_0x8c30('0x19')](_0x267728[_0x8c30('0x18')],function(_0x4e2e8b){return{'model':db[_0x4e2e8b[_0x8c30('0x1a')]],'as':_0x4e2e8b['as'],'attributes':_0x4e2e8b[_0x8c30('0x16')],'include':_0x4e2e8b[_0x8c30('0x18')]?_[_0x8c30('0x19')](_0x4e2e8b[_0x8c30('0x18')],function(_0x1cde61){return{'model':db[_0x1cde61[_0x8c30('0x1a')]],'as':_0x1cde61['as'],'attributes':_0x1cde61[_0x8c30('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8c30('0x9')](function(_0x396548){logger['info'](_0x8c30('0x1d'),_0x4411df);logger[_0x8c30('0x1b')](_0x8c30('0x1d'),_0x4411df,JSON[_0x8c30('0x1c')](_0x396548));_0x50bafd(_0x396548);})[_0x8c30('0x10')](function(_0x352d5d){logger['error'](_0x8c30('0x1d'),_0x352d5d['message'],_0x4411df);_0x123d7e(_0x31ca91['error'](0x1f4,_0x352d5d[_0x8c30('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 41b6018..1b944d1 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 _0xc32f=['/:id/descriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x1e8db2,_0xa9c7aa){var _0x247392=function(_0x54c55b){while(--_0x54c55b){_0x1e8db2['push'](_0x1e8db2['shift']());}};_0x247392(++_0xa9c7aa);}(_0xc32f,0x98));var _0xfc32=function(_0x54cc49,_0x56b6a5){_0x54cc49=_0x54cc49-0x0;var _0x2a13b0=_0xc32f[_0x54cc49];return _0x2a13b0;};'use strict';var multer=require('multer');var util=require(_0xfc32('0x0'));var path=require(_0xfc32('0x1'));var timeout=require(_0xfc32('0x2'));var express=require('express');var router=express[_0xfc32('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfc32('0x4'));var interaction=require(_0xfc32('0x5'));var config=require('../../config/environment');var controller=require(_0xfc32('0x6'));router[_0xfc32('0x7')]('/',auth[_0xfc32('0x8')](),controller[_0xfc32('0x9')]);router[_0xfc32('0x7')](_0xfc32('0xa'),auth[_0xfc32('0x8')](),controller[_0xfc32('0xb')]);router[_0xfc32('0x7')](_0xfc32('0xc'),auth['isAuthenticated'](),controller[_0xfc32('0xd')]);router[_0xfc32('0x7')](_0xfc32('0xe'),auth[_0xfc32('0x8')](),controller[_0xfc32('0xf')]);router[_0xfc32('0x7')](_0xfc32('0x10'),auth[_0xfc32('0x8')](),controller['getDescriptions']);router[_0xfc32('0x11')]('/',auth['isAuthenticated'](),controller[_0xfc32('0x12')]);router[_0xfc32('0x13')](_0xfc32('0xa'),auth[_0xfc32('0x8')](),controller[_0xfc32('0x14')]);router[_0xfc32('0x15')]('/:id',auth[_0xfc32('0x8')](),controller[_0xfc32('0x16')]);module[_0xfc32('0x17')]=router; \ No newline at end of file +var _0xf046=['create','put','update','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x5a347a,_0x1b503b){var _0xd30911=function(_0x1b7284){while(--_0x1b7284){_0x5a347a['push'](_0x5a347a['shift']());}};_0xd30911(++_0x1b503b);}(_0xf046,0x164));var _0x6f04=function(_0x26bfb0,_0x5b0ffc){_0x26bfb0=_0x26bfb0-0x0;var _0x4454b3=_0xf046[_0x26bfb0];return _0x4454b3;};'use strict';var multer=require(_0x6f04('0x0'));var util=require(_0x6f04('0x1'));var path=require('path');var timeout=require(_0x6f04('0x2'));var express=require(_0x6f04('0x3'));var router=express['Router']();var fs_extra=require(_0x6f04('0x4'));var auth=require(_0x6f04('0x5'));var interaction=require(_0x6f04('0x6'));var config=require(_0x6f04('0x7'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x6f04('0x8')](),controller[_0x6f04('0x9')]);router[_0x6f04('0xa')](_0x6f04('0xb'),auth[_0x6f04('0x8')](),controller[_0x6f04('0xc')]);router[_0x6f04('0xa')]('/:id/fields',auth[_0x6f04('0x8')](),controller[_0x6f04('0xd')]);router['get'](_0x6f04('0xe'),auth[_0x6f04('0x8')](),controller[_0x6f04('0xf')]);router[_0x6f04('0xa')](_0x6f04('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6f04('0x11')]('/',auth[_0x6f04('0x8')](),controller[_0x6f04('0x12')]);router[_0x6f04('0x13')](_0x6f04('0xb'),auth[_0x6f04('0x8')](),controller[_0x6f04('0x14')]);router['delete']('/:id',auth[_0x6f04('0x8')](),controller[_0x6f04('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7e0d43b..d006d7d 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 _0x13ed=['sequelize','exports','STRING'];(function(_0x28f5c6,_0x3f8641){var _0x504663=function(_0x82b0a0){while(--_0x82b0a0){_0x28f5c6['push'](_0x28f5c6['shift']());}};_0x504663(++_0x3f8641);}(_0x13ed,0x1b3));var _0xd13e=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x13ed[_0x58a4fe];return _0x697de2;};'use strict';var Sequelize=require(_0xd13e('0x0'));module[_0xd13e('0x1')]={'name':{'type':Sequelize[_0xd13e('0x2')]},'description':{'type':Sequelize[_0xd13e('0x2')]}}; \ No newline at end of file +var _0x7fe8=['sequelize','exports','STRING'];(function(_0x5d1b9b,_0x325160){var _0xc1a0c5=function(_0x3d9131){while(--_0x3d9131){_0x5d1b9b['push'](_0x5d1b9b['shift']());}};_0xc1a0c5(++_0x325160);}(_0x7fe8,0x123));var _0x87fe=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x7fe8[_0x2ed8f3];return _0x525a55;};'use strict';var Sequelize=require(_0x87fe('0x0'));module[_0x87fe('0x1')]={'name':{'type':Sequelize[_0x87fe('0x2')]},'description':{'type':Sequelize[_0x87fe('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d1e71d4..eb1699a 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 _0xac13=['limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','where','pick','merge','VIRTUAL','filter','options','ServicenowConfiguration','includeAll','include','rows','catch','show','params','find','create','body','update','getFields','findOne','ServicenowField','sort','hasOwnProperty','rawAttributes','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x4dabec,_0xa7e49d){var _0x58178c=function(_0x47072a){while(--_0x47072a){_0x4dabec['push'](_0x4dabec['shift']());}};_0x58178c(++_0xa7e49d);}(_0xac13,0x1c8));var _0x3ac1=function(_0x3216e3,_0x357f9f){_0x3216e3=_0x3216e3-0x0;var _0x2b1e63=_0xac13[_0x3216e3];return _0x2b1e63;};'use strict';var emlformat=require(_0x3ac1('0x0'));var rimraf=require(_0x3ac1('0x1'));var zipdir=require(_0x3ac1('0x2'));var jsonpatch=require(_0x3ac1('0x3'));var rp=require(_0x3ac1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3ac1('0x5'));var path=require(_0x3ac1('0x6'));var sox=require(_0x3ac1('0x7'));var csv=require(_0x3ac1('0x8'));var ejs=require(_0x3ac1('0x9'));var fs=require('fs');var fs_extra=require(_0x3ac1('0xa'));var _=require(_0x3ac1('0xb'));var squel=require(_0x3ac1('0xc'));var crypto=require(_0x3ac1('0xd'));var jsforce=require(_0x3ac1('0xe'));var deskjs=require(_0x3ac1('0xf'));var toCsv=require(_0x3ac1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3ac1('0x10'));var authService=require(_0x3ac1('0x11'));var qs=require(_0x3ac1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ac1('0x13'));var logger=require('../../config/logger')(_0x3ac1('0x14'));var utils=require(_0x3ac1('0x15'));var config=require(_0x3ac1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ac1('0x17'))['db'];function respondWithStatusCode(_0x85a1e3,_0x27d55f){_0x27d55f=_0x27d55f||0xcc;return function(_0xd19027){if(_0xd19027){return _0x85a1e3[_0x3ac1('0x18')](_0x27d55f);}return _0x85a1e3[_0x3ac1('0x19')](_0x27d55f)[_0x3ac1('0x1a')]();};}function respondWithResult(_0x236204,_0x31aa07){_0x31aa07=_0x31aa07||0xc8;return function(_0x5a529c){if(_0x5a529c){return _0x236204[_0x3ac1('0x19')](_0x31aa07)[_0x3ac1('0x1b')](_0x5a529c);}};}function respondWithFilteredResult(_0x5b3dcb,_0x1dacf6){return function(_0x209471){if(_0x209471){var _0xca0160=typeof _0x1dacf6[_0x3ac1('0x1c')]===_0x3ac1('0x1d')&&typeof _0x1dacf6[_0x3ac1('0x1e')]===_0x3ac1('0x1d');var _0x1ad0f4=_0x209471[_0x3ac1('0x1f')];var _0x43b989=_0xca0160?0x0:_0x1dacf6[_0x3ac1('0x1c')];var _0x345424=_0xca0160?_0x209471[_0x3ac1('0x1f')]:_0x1dacf6[_0x3ac1('0x1c')]+_0x1dacf6[_0x3ac1('0x1e')];var _0x1ad1fa;if(_0x345424>=_0x1ad0f4){_0x345424=_0x1ad0f4;_0x1ad1fa=0xc8;}else{_0x1ad1fa=0xce;}_0x5b3dcb[_0x3ac1('0x19')](_0x1ad1fa);return _0x5b3dcb[_0x3ac1('0x20')](_0x3ac1('0x21'),_0x43b989+'-'+_0x345424+'/'+_0x1ad0f4)[_0x3ac1('0x1b')](_0x209471);}return null;};}function patchUpdates(_0x2a73ee){return function(_0x4a6bf){try{jsonpatch[_0x3ac1('0x22')](_0x4a6bf,_0x2a73ee,!![]);}catch(_0x26b2d3){return BPromise[_0x3ac1('0x23')](_0x26b2d3);}return _0x4a6bf[_0x3ac1('0x24')]();};}function saveUpdates(_0x3a2380,_0x32f287){return function(_0x18169e){if(_0x18169e){return _0x18169e['update'](_0x3a2380)[_0x3ac1('0x25')](function(_0x3c9537){return _0x3c9537;});}return null;};}function removeEntity(_0x4d2f26,_0x403da7){return function(_0x493bee){if(_0x493bee){return _0x493bee[_0x3ac1('0x26')]()['then'](function(){_0x4d2f26[_0x3ac1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2332d8,_0x432e1d){return function(_0x9537f){if(!_0x9537f){_0x2332d8[_0x3ac1('0x18')](0x194);}return _0x9537f;};}function handleError(_0x437561,_0x25b36c){_0x25b36c=_0x25b36c||0x1f4;return function(_0x3eb54a){logger['error'](_0x3eb54a['stack']);if(_0x3eb54a[_0x3ac1('0x27')]){delete _0x3eb54a[_0x3ac1('0x27')];}_0x437561[_0x3ac1('0x19')](_0x25b36c)[_0x3ac1('0x28')](_0x3eb54a);};}exports[_0x3ac1('0x29')]=function(_0x1fcd9c,_0x53d847){var _0x273b85={},_0x397b06={},_0x548690={'count':0x0,'rows':[]};var _0x1b7d7b=_[_0x3ac1('0x2a')](db['ServicenowConfiguration']['rawAttributes'],function(_0x26356c){return{'name':_0x26356c[_0x3ac1('0x2b')],'type':_0x26356c[_0x3ac1('0x2c')][_0x3ac1('0x2d')]};});_0x397b06['model']=_[_0x3ac1('0x2a')](_0x1b7d7b,_0x3ac1('0x27'));_0x397b06[_0x3ac1('0x2e')]=_[_0x3ac1('0x2f')](_0x1fcd9c[_0x3ac1('0x2e')]);_0x397b06[_0x3ac1('0x30')]=_[_0x3ac1('0x31')](_0x397b06[_0x3ac1('0x32')],_0x397b06[_0x3ac1('0x2e')]);_0x273b85[_0x3ac1('0x33')]=_[_0x3ac1('0x31')](_0x397b06[_0x3ac1('0x32')],qs['fields'](_0x1fcd9c[_0x3ac1('0x2e')][_0x3ac1('0x34')]));_0x273b85[_0x3ac1('0x33')]=_0x273b85['attributes'][_0x3ac1('0x35')]?_0x273b85[_0x3ac1('0x33')]:_0x397b06['model'];if(!_0x1fcd9c['query']['hasOwnProperty'](_0x3ac1('0x36'))){_0x273b85['limit']=qs[_0x3ac1('0x1e')](_0x1fcd9c[_0x3ac1('0x2e')][_0x3ac1('0x1e')]);_0x273b85[_0x3ac1('0x1c')]=qs[_0x3ac1('0x1c')](_0x1fcd9c[_0x3ac1('0x2e')][_0x3ac1('0x1c')]);}_0x273b85['order']=qs['sort'](_0x1fcd9c[_0x3ac1('0x2e')]['sort']);_0x273b85[_0x3ac1('0x37')]=qs[_0x3ac1('0x30')](_[_0x3ac1('0x38')](_0x1fcd9c['query'],_0x397b06[_0x3ac1('0x30')]),_0x1b7d7b);if(_0x1fcd9c[_0x3ac1('0x2e')]['filter']){_0x273b85[_0x3ac1('0x37')]=_[_0x3ac1('0x39')](_0x273b85[_0x3ac1('0x37')],{'$or':_[_0x3ac1('0x2a')](_0x1b7d7b,function(_0x56c0e1){if(_0x56c0e1[_0x3ac1('0x2c')]!==_0x3ac1('0x3a')){var _0x3ddeb8={};_0x3ddeb8[_0x56c0e1['name']]={'$like':'%'+_0x1fcd9c[_0x3ac1('0x2e')][_0x3ac1('0x3b')]+'%'};return _0x3ddeb8;}})});}_0x273b85=_[_0x3ac1('0x39')]({},_0x273b85,_0x1fcd9c[_0x3ac1('0x3c')]);var _0x12a780={'where':_0x273b85[_0x3ac1('0x37')]};return db[_0x3ac1('0x3d')][_0x3ac1('0x1f')](_0x12a780)['then'](function(_0x3110c2){_0x548690[_0x3ac1('0x1f')]=_0x3110c2;if(_0x1fcd9c[_0x3ac1('0x2e')][_0x3ac1('0x3e')]){_0x273b85[_0x3ac1('0x3f')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x273b85);})['then'](function(_0xcf2c3a){_0x548690[_0x3ac1('0x40')]=_0xcf2c3a;return _0x548690;})[_0x3ac1('0x25')](respondWithFilteredResult(_0x53d847,_0x273b85))[_0x3ac1('0x41')](handleError(_0x53d847,null));};exports[_0x3ac1('0x42')]=function(_0x46e88d,_0x1469a7){var _0x18e2c4={'raw':![],'where':{'id':_0x46e88d[_0x3ac1('0x43')]['id']}},_0x2913e1={};_0x2913e1['model']=_[_0x3ac1('0x2f')](db['ServicenowConfiguration']['rawAttributes']);_0x2913e1[_0x3ac1('0x2e')]=_[_0x3ac1('0x2f')](_0x46e88d[_0x3ac1('0x2e')]);_0x2913e1['filters']=_['intersection'](_0x2913e1[_0x3ac1('0x32')],_0x2913e1['query']);_0x18e2c4[_0x3ac1('0x33')]=_[_0x3ac1('0x31')](_0x2913e1['model'],qs[_0x3ac1('0x34')](_0x46e88d['query']['fields']));_0x18e2c4[_0x3ac1('0x33')]=_0x18e2c4['attributes'][_0x3ac1('0x35')]?_0x18e2c4[_0x3ac1('0x33')]:_0x2913e1['model'];if(_0x46e88d[_0x3ac1('0x2e')][_0x3ac1('0x3e')]){_0x18e2c4['include']=[{'all':!![]}];}_0x18e2c4=_[_0x3ac1('0x39')]({},_0x18e2c4,_0x46e88d[_0x3ac1('0x3c')]);return db[_0x3ac1('0x3d')][_0x3ac1('0x44')](_0x18e2c4)[_0x3ac1('0x25')](handleEntityNotFound(_0x1469a7,null))[_0x3ac1('0x25')](respondWithResult(_0x1469a7,null))[_0x3ac1('0x41')](handleError(_0x1469a7,null));};exports[_0x3ac1('0x45')]=function(_0x3d6d73,_0x542748){return db[_0x3ac1('0x3d')][_0x3ac1('0x45')](_0x3d6d73[_0x3ac1('0x46')],{})[_0x3ac1('0x25')](respondWithResult(_0x542748,0xc9))[_0x3ac1('0x41')](handleError(_0x542748,null));};exports[_0x3ac1('0x47')]=function(_0xd3c457,_0x15717d){if(_0xd3c457[_0x3ac1('0x46')]['id']){delete _0xd3c457[_0x3ac1('0x46')]['id'];}return db[_0x3ac1('0x3d')][_0x3ac1('0x44')]({'where':{'id':_0xd3c457['params']['id']}})[_0x3ac1('0x25')](handleEntityNotFound(_0x15717d,null))[_0x3ac1('0x25')](saveUpdates(_0xd3c457[_0x3ac1('0x46')],null))[_0x3ac1('0x25')](respondWithResult(_0x15717d,null))[_0x3ac1('0x41')](handleError(_0x15717d,null));};exports[_0x3ac1('0x26')]=function(_0xf7cfe5,_0x3882d7){return db[_0x3ac1('0x3d')][_0x3ac1('0x44')]({'where':{'id':_0xf7cfe5[_0x3ac1('0x43')]['id']}})[_0x3ac1('0x25')](handleEntityNotFound(_0x3882d7,null))['then'](removeEntity(_0x3882d7,null))[_0x3ac1('0x41')](handleError(_0x3882d7,null));};exports[_0x3ac1('0x48')]=function(_0xf95863,_0x4001ae,_0x346330){var _0x23a00d={};var _0x3f0aeb={};var _0x4ce39e;var _0x4afe08;return db['ServicenowConfiguration'][_0x3ac1('0x49')]({'where':{'id':_0xf95863[_0x3ac1('0x43')]['id']}})[_0x3ac1('0x25')](handleEntityNotFound(_0x4001ae,null))['then'](function(_0x4e5a7e){if(_0x4e5a7e){_0x4ce39e=_0x4e5a7e;_0x3f0aeb[_0x3ac1('0x32')]=_[_0x3ac1('0x2f')](db[_0x3ac1('0x4a')]['rawAttributes']);_0x3f0aeb[_0x3ac1('0x2e')]=_['keys'](_0xf95863[_0x3ac1('0x2e')]);_0x3f0aeb[_0x3ac1('0x30')]=_['intersection'](_0x3f0aeb[_0x3ac1('0x32')],_0x3f0aeb['query']);_0x23a00d[_0x3ac1('0x33')]=_[_0x3ac1('0x31')](_0x3f0aeb[_0x3ac1('0x32')],qs[_0x3ac1('0x34')](_0xf95863[_0x3ac1('0x2e')][_0x3ac1('0x34')]));_0x23a00d[_0x3ac1('0x33')]=_0x23a00d[_0x3ac1('0x33')][_0x3ac1('0x35')]?_0x23a00d[_0x3ac1('0x33')]:_0x3f0aeb[_0x3ac1('0x32')];_0x23a00d['order']=qs[_0x3ac1('0x4b')](_0xf95863['query'][_0x3ac1('0x4b')]);_0x23a00d[_0x3ac1('0x37')]=qs[_0x3ac1('0x30')](_[_0x3ac1('0x38')](_0xf95863[_0x3ac1('0x2e')],_0x3f0aeb['filters']));if(_0xf95863['query'][_0x3ac1('0x3b')]){_0x23a00d[_0x3ac1('0x37')]=_[_0x3ac1('0x39')](_0x23a00d[_0x3ac1('0x37')],{'$or':_[_0x3ac1('0x2a')](_0x23a00d[_0x3ac1('0x33')],function(_0x48171c){var _0x17248a={};_0x17248a[_0x48171c]={'$like':'%'+_0xf95863[_0x3ac1('0x2e')][_0x3ac1('0x3b')]+'%'};return _0x17248a;})});}_0x23a00d=_[_0x3ac1('0x39')]({},_0x23a00d,_0xf95863[_0x3ac1('0x3c')]);return _0x4ce39e[_0x3ac1('0x48')](_0x23a00d);}})[_0x3ac1('0x25')](function(_0x5c4775){if(_0x5c4775){_0x4afe08=_0x5c4775[_0x3ac1('0x35')];if(!_0xf95863[_0x3ac1('0x2e')][_0x3ac1('0x4c')]('nolimit')){_0x23a00d[_0x3ac1('0x1e')]=qs[_0x3ac1('0x1e')](_0xf95863['query'][_0x3ac1('0x1e')]);_0x23a00d['offset']=qs[_0x3ac1('0x1c')](_0xf95863[_0x3ac1('0x2e')][_0x3ac1('0x1c')]);}return _0x4ce39e['getFields'](_0x23a00d);}})[_0x3ac1('0x25')](function(_0x3b8b0a){if(_0x3b8b0a){return _0x3b8b0a?{'count':_0x4afe08,'rows':_0x3b8b0a}:null;}})[_0x3ac1('0x25')](respondWithResult(_0x4001ae,null))[_0x3ac1('0x41')](handleError(_0x4001ae,null));};exports['getSubjects']=function(_0x3fc972,_0x4e8527,_0x42c1e6){var _0x73eaea={};var _0x3d6bed={};var _0x2a5d88;var _0x3ca8ec;return db[_0x3ac1('0x3d')][_0x3ac1('0x49')]({'where':{'id':_0x3fc972[_0x3ac1('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e8527,null))[_0x3ac1('0x25')](function(_0x50801a){if(_0x50801a){_0x2a5d88=_0x50801a;_0x3d6bed['model']=_[_0x3ac1('0x2f')](db['ServicenowField'][_0x3ac1('0x4d')]);_0x3d6bed[_0x3ac1('0x2e')]=_['keys'](_0x3fc972['query']);_0x3d6bed[_0x3ac1('0x30')]=_[_0x3ac1('0x31')](_0x3d6bed[_0x3ac1('0x32')],_0x3d6bed['query']);_0x73eaea[_0x3ac1('0x33')]=_[_0x3ac1('0x31')](_0x3d6bed[_0x3ac1('0x32')],qs[_0x3ac1('0x34')](_0x3fc972[_0x3ac1('0x2e')][_0x3ac1('0x34')]));_0x73eaea[_0x3ac1('0x33')]=_0x73eaea[_0x3ac1('0x33')][_0x3ac1('0x35')]?_0x73eaea[_0x3ac1('0x33')]:_0x3d6bed['model'];_0x73eaea[_0x3ac1('0x4e')]=qs[_0x3ac1('0x4b')](_0x3fc972['query'][_0x3ac1('0x4b')]);_0x73eaea[_0x3ac1('0x37')]=qs[_0x3ac1('0x30')](_[_0x3ac1('0x38')](_0x3fc972[_0x3ac1('0x2e')],_0x3d6bed['filters']));if(_0x3fc972[_0x3ac1('0x2e')][_0x3ac1('0x3b')]){_0x73eaea[_0x3ac1('0x37')]=_[_0x3ac1('0x39')](_0x73eaea[_0x3ac1('0x37')],{'$or':_[_0x3ac1('0x2a')](_0x73eaea[_0x3ac1('0x33')],function(_0x1d88ad){var _0x4e990c={};_0x4e990c[_0x1d88ad]={'$like':'%'+_0x3fc972[_0x3ac1('0x2e')][_0x3ac1('0x3b')]+'%'};return _0x4e990c;})});}_0x73eaea=_[_0x3ac1('0x39')]({},_0x73eaea,_0x3fc972[_0x3ac1('0x3c')]);return _0x2a5d88['getSubjects'](_0x73eaea);}})[_0x3ac1('0x25')](function(_0x1dcd1b){if(_0x1dcd1b){_0x3ca8ec=_0x1dcd1b['length'];if(!_0x3fc972[_0x3ac1('0x2e')][_0x3ac1('0x4c')]('nolimit')){_0x73eaea['limit']=qs[_0x3ac1('0x1e')](_0x3fc972['query']['limit']);_0x73eaea[_0x3ac1('0x1c')]=qs[_0x3ac1('0x1c')](_0x3fc972[_0x3ac1('0x2e')][_0x3ac1('0x1c')]);}return _0x2a5d88[_0x3ac1('0x4f')](_0x73eaea);}})[_0x3ac1('0x25')](function(_0x463c90){if(_0x463c90){return _0x463c90?{'count':_0x3ca8ec,'rows':_0x463c90}:null;}})[_0x3ac1('0x25')](respondWithResult(_0x4e8527,null))['catch'](handleError(_0x4e8527,null));};exports[_0x3ac1('0x50')]=function(_0x201ee9,_0x13686a,_0x16a0ef){var _0x568c0d={};var _0x9d360a={};var _0x1f986e;var _0x427f5e;return db[_0x3ac1('0x3d')][_0x3ac1('0x49')]({'where':{'id':_0x201ee9[_0x3ac1('0x43')]['id']}})['then'](handleEntityNotFound(_0x13686a,null))[_0x3ac1('0x25')](function(_0x310e89){if(_0x310e89){_0x1f986e=_0x310e89;_0x9d360a[_0x3ac1('0x32')]=_['keys'](db[_0x3ac1('0x4a')][_0x3ac1('0x4d')]);_0x9d360a[_0x3ac1('0x2e')]=_[_0x3ac1('0x2f')](_0x201ee9['query']);_0x9d360a['filters']=_[_0x3ac1('0x31')](_0x9d360a[_0x3ac1('0x32')],_0x9d360a['query']);_0x568c0d[_0x3ac1('0x33')]=_['intersection'](_0x9d360a[_0x3ac1('0x32')],qs[_0x3ac1('0x34')](_0x201ee9[_0x3ac1('0x2e')][_0x3ac1('0x34')]));_0x568c0d[_0x3ac1('0x33')]=_0x568c0d[_0x3ac1('0x33')]['length']?_0x568c0d['attributes']:_0x9d360a['model'];_0x568c0d['order']=qs[_0x3ac1('0x4b')](_0x201ee9[_0x3ac1('0x2e')][_0x3ac1('0x4b')]);_0x568c0d[_0x3ac1('0x37')]=qs[_0x3ac1('0x30')](_['pick'](_0x201ee9[_0x3ac1('0x2e')],_0x9d360a[_0x3ac1('0x30')]));if(_0x201ee9[_0x3ac1('0x2e')][_0x3ac1('0x3b')]){_0x568c0d['where']=_[_0x3ac1('0x39')](_0x568c0d[_0x3ac1('0x37')],{'$or':_[_0x3ac1('0x2a')](_0x568c0d[_0x3ac1('0x33')],function(_0x3a191a){var _0x353f7e={};_0x353f7e[_0x3a191a]={'$like':'%'+_0x201ee9[_0x3ac1('0x2e')][_0x3ac1('0x3b')]+'%'};return _0x353f7e;})});}_0x568c0d=_[_0x3ac1('0x39')]({},_0x568c0d,_0x201ee9[_0x3ac1('0x3c')]);return _0x1f986e[_0x3ac1('0x50')](_0x568c0d);}})[_0x3ac1('0x25')](function(_0x59d0de){if(_0x59d0de){_0x427f5e=_0x59d0de[_0x3ac1('0x35')];if(!_0x201ee9[_0x3ac1('0x2e')]['hasOwnProperty']('nolimit')){_0x568c0d['limit']=qs[_0x3ac1('0x1e')](_0x201ee9[_0x3ac1('0x2e')][_0x3ac1('0x1e')]);_0x568c0d[_0x3ac1('0x1c')]=qs[_0x3ac1('0x1c')](_0x201ee9[_0x3ac1('0x2e')]['offset']);}return _0x1f986e[_0x3ac1('0x50')](_0x568c0d);}})[_0x3ac1('0x25')](function(_0x2a7217){if(_0x2a7217){return _0x2a7217?{'count':_0x427f5e,'rows':_0x2a7217}:null;}})['then'](respondWithResult(_0x13686a,null))[_0x3ac1('0x41')](handleError(_0x13686a,null));}; \ No newline at end of file +var _0xdcf1=['lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ServicenowConfiguration','includeAll','findAll','rows','catch','show','params','include','find','create','findOne','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x24d0a2,_0x3d3ff3){var _0x10e950=function(_0xff96e2){while(--_0xff96e2){_0x24d0a2['push'](_0x24d0a2['shift']());}};_0x10e950(++_0x3d3ff3);}(_0xdcf1,0x14b));var _0x1dcf=function(_0x18ce30,_0x437d06){_0x18ce30=_0x18ce30-0x0;var _0x4471a3=_0xdcf1[_0x18ce30];return _0x4471a3;};'use strict';var emlformat=require(_0x1dcf('0x0'));var rimraf=require(_0x1dcf('0x1'));var zipdir=require(_0x1dcf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1dcf('0x3'));var moment=require(_0x1dcf('0x4'));var BPromise=require(_0x1dcf('0x5'));var Mustache=require(_0x1dcf('0x6'));var util=require(_0x1dcf('0x7'));var path=require(_0x1dcf('0x8'));var sox=require(_0x1dcf('0x9'));var csv=require(_0x1dcf('0xa'));var ejs=require(_0x1dcf('0xb'));var fs=require('fs');var fs_extra=require(_0x1dcf('0xc'));var _=require(_0x1dcf('0xd'));var squel=require(_0x1dcf('0xe'));var crypto=require(_0x1dcf('0xf'));var jsforce=require(_0x1dcf('0x10'));var deskjs=require(_0x1dcf('0x11'));var toCsv=require(_0x1dcf('0xa'));var querystring=require('querystring');var Papa=require(_0x1dcf('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1dcf('0x13'));var as=require(_0x1dcf('0x14'));var hardwareService=require(_0x1dcf('0x15'));var logger=require(_0x1dcf('0x16'))(_0x1dcf('0x17'));var utils=require(_0x1dcf('0x18'));var config=require(_0x1dcf('0x19'));var licenseUtil=require(_0x1dcf('0x1a'));var db=require(_0x1dcf('0x1b'))['db'];function respondWithStatusCode(_0x36d490,_0x49bb4e){_0x49bb4e=_0x49bb4e||0xcc;return function(_0x4f82e6){if(_0x4f82e6){return _0x36d490[_0x1dcf('0x1c')](_0x49bb4e);}return _0x36d490[_0x1dcf('0x1d')](_0x49bb4e)[_0x1dcf('0x1e')]();};}function respondWithResult(_0x323ff5,_0x4357b5){_0x4357b5=_0x4357b5||0xc8;return function(_0x2b2e70){if(_0x2b2e70){return _0x323ff5['status'](_0x4357b5)[_0x1dcf('0x1f')](_0x2b2e70);}};}function respondWithFilteredResult(_0x2763f4,_0x3990e5){return function(_0x5ef70a){if(_0x5ef70a){var _0xa725af=typeof _0x3990e5[_0x1dcf('0x20')]==='undefined'&&typeof _0x3990e5[_0x1dcf('0x21')]===_0x1dcf('0x22');var _0x4328b7=_0x5ef70a[_0x1dcf('0x23')];var _0x456498=_0xa725af?0x0:_0x3990e5[_0x1dcf('0x20')];var _0x31a677=_0xa725af?_0x5ef70a[_0x1dcf('0x23')]:_0x3990e5['offset']+_0x3990e5[_0x1dcf('0x21')];var _0x180f5e;if(_0x31a677>=_0x4328b7){_0x31a677=_0x4328b7;_0x180f5e=0xc8;}else{_0x180f5e=0xce;}_0x2763f4[_0x1dcf('0x1d')](_0x180f5e);return _0x2763f4[_0x1dcf('0x24')](_0x1dcf('0x25'),_0x456498+'-'+_0x31a677+'/'+_0x4328b7)['json'](_0x5ef70a);}return null;};}function patchUpdates(_0x998cbe){return function(_0x319951){try{jsonpatch[_0x1dcf('0x26')](_0x319951,_0x998cbe,!![]);}catch(_0x3fb236){return BPromise[_0x1dcf('0x27')](_0x3fb236);}return _0x319951[_0x1dcf('0x28')]();};}function saveUpdates(_0x4e048e,_0x50e3bc){return function(_0x31c216){if(_0x31c216){return _0x31c216[_0x1dcf('0x29')](_0x4e048e)[_0x1dcf('0x2a')](function(_0x167acc){return _0x167acc;});}return null;};}function removeEntity(_0x1d8563,_0x2a4b37){return function(_0x103771){if(_0x103771){return _0x103771[_0x1dcf('0x2b')]()[_0x1dcf('0x2a')](function(){_0x1d8563['status'](0xcc)[_0x1dcf('0x1e')]();});}};}function handleEntityNotFound(_0x15941f,_0x192ed6){return function(_0x4bcd11){if(!_0x4bcd11){_0x15941f[_0x1dcf('0x1c')](0x194);}return _0x4bcd11;};}function handleError(_0x2de23f,_0x40dd55){_0x40dd55=_0x40dd55||0x1f4;return function(_0x4aedaa){logger[_0x1dcf('0x2c')](_0x4aedaa[_0x1dcf('0x2d')]);if(_0x4aedaa[_0x1dcf('0x2e')]){delete _0x4aedaa[_0x1dcf('0x2e')];}_0x2de23f['status'](_0x40dd55)[_0x1dcf('0x2f')](_0x4aedaa);};}exports[_0x1dcf('0x30')]=function(_0x114051,_0x295d6a){var _0x3f5d5e={},_0x967243={},_0x8549ad={'count':0x0,'rows':[]};var _0x5af4c4=_['map'](db['ServicenowConfiguration'][_0x1dcf('0x31')],function(_0x30e356){return{'name':_0x30e356['fieldName'],'type':_0x30e356[_0x1dcf('0x32')][_0x1dcf('0x33')]};});_0x967243[_0x1dcf('0x34')]=_[_0x1dcf('0x35')](_0x5af4c4,_0x1dcf('0x2e'));_0x967243[_0x1dcf('0x36')]=_[_0x1dcf('0x37')](_0x114051['query']);_0x967243[_0x1dcf('0x38')]=_[_0x1dcf('0x39')](_0x967243[_0x1dcf('0x34')],_0x967243[_0x1dcf('0x36')]);_0x3f5d5e[_0x1dcf('0x3a')]=_[_0x1dcf('0x39')](_0x967243[_0x1dcf('0x34')],qs['fields'](_0x114051[_0x1dcf('0x36')][_0x1dcf('0x3b')]));_0x3f5d5e[_0x1dcf('0x3a')]=_0x3f5d5e[_0x1dcf('0x3a')][_0x1dcf('0x3c')]?_0x3f5d5e[_0x1dcf('0x3a')]:_0x967243[_0x1dcf('0x34')];if(!_0x114051[_0x1dcf('0x36')][_0x1dcf('0x3d')](_0x1dcf('0x3e'))){_0x3f5d5e[_0x1dcf('0x21')]=qs[_0x1dcf('0x21')](_0x114051[_0x1dcf('0x36')]['limit']);_0x3f5d5e[_0x1dcf('0x20')]=qs[_0x1dcf('0x20')](_0x114051[_0x1dcf('0x36')][_0x1dcf('0x20')]);}_0x3f5d5e[_0x1dcf('0x3f')]=qs[_0x1dcf('0x40')](_0x114051[_0x1dcf('0x36')]['sort']);_0x3f5d5e[_0x1dcf('0x41')]=qs['filters'](_[_0x1dcf('0x42')](_0x114051['query'],_0x967243[_0x1dcf('0x38')]),_0x5af4c4);if(_0x114051[_0x1dcf('0x36')]['filter']){_0x3f5d5e['where']=_[_0x1dcf('0x43')](_0x3f5d5e['where'],{'$or':_[_0x1dcf('0x35')](_0x5af4c4,function(_0x234156){if(_0x234156[_0x1dcf('0x32')]!==_0x1dcf('0x44')){var _0x485134={};_0x485134[_0x234156[_0x1dcf('0x2e')]]={'$like':'%'+_0x114051[_0x1dcf('0x36')][_0x1dcf('0x45')]+'%'};return _0x485134;}})});}_0x3f5d5e=_[_0x1dcf('0x43')]({},_0x3f5d5e,_0x114051[_0x1dcf('0x46')]);var _0x402989={'where':_0x3f5d5e[_0x1dcf('0x41')]};return db[_0x1dcf('0x47')][_0x1dcf('0x23')](_0x402989)[_0x1dcf('0x2a')](function(_0x59bd1e){_0x8549ad[_0x1dcf('0x23')]=_0x59bd1e;if(_0x114051[_0x1dcf('0x36')][_0x1dcf('0x48')]){_0x3f5d5e['include']=[{'all':!![]}];}return db[_0x1dcf('0x47')][_0x1dcf('0x49')](_0x3f5d5e);})[_0x1dcf('0x2a')](function(_0x459dc7){_0x8549ad[_0x1dcf('0x4a')]=_0x459dc7;return _0x8549ad;})[_0x1dcf('0x2a')](respondWithFilteredResult(_0x295d6a,_0x3f5d5e))[_0x1dcf('0x4b')](handleError(_0x295d6a,null));};exports[_0x1dcf('0x4c')]=function(_0x35f3f8,_0x1c2a81){var _0x5cfc8d={'raw':![],'where':{'id':_0x35f3f8[_0x1dcf('0x4d')]['id']}},_0x1faa31={};_0x1faa31[_0x1dcf('0x34')]=_[_0x1dcf('0x37')](db[_0x1dcf('0x47')]['rawAttributes']);_0x1faa31[_0x1dcf('0x36')]=_['keys'](_0x35f3f8[_0x1dcf('0x36')]);_0x1faa31[_0x1dcf('0x38')]=_[_0x1dcf('0x39')](_0x1faa31['model'],_0x1faa31['query']);_0x5cfc8d[_0x1dcf('0x3a')]=_[_0x1dcf('0x39')](_0x1faa31[_0x1dcf('0x34')],qs[_0x1dcf('0x3b')](_0x35f3f8[_0x1dcf('0x36')][_0x1dcf('0x3b')]));_0x5cfc8d['attributes']=_0x5cfc8d[_0x1dcf('0x3a')][_0x1dcf('0x3c')]?_0x5cfc8d[_0x1dcf('0x3a')]:_0x1faa31['model'];if(_0x35f3f8[_0x1dcf('0x36')]['includeAll']){_0x5cfc8d[_0x1dcf('0x4e')]=[{'all':!![]}];}_0x5cfc8d=_[_0x1dcf('0x43')]({},_0x5cfc8d,_0x35f3f8[_0x1dcf('0x46')]);return db[_0x1dcf('0x47')][_0x1dcf('0x4f')](_0x5cfc8d)[_0x1dcf('0x2a')](handleEntityNotFound(_0x1c2a81,null))['then'](respondWithResult(_0x1c2a81,null))['catch'](handleError(_0x1c2a81,null));};exports['create']=function(_0x45958a,_0x5d7c25){return db[_0x1dcf('0x47')][_0x1dcf('0x50')](_0x45958a['body'],{})[_0x1dcf('0x2a')](respondWithResult(_0x5d7c25,0xc9))['catch'](handleError(_0x5d7c25,null));};exports[_0x1dcf('0x29')]=function(_0x26a849,_0x132705){if(_0x26a849['body']['id']){delete _0x26a849['body']['id'];}return db[_0x1dcf('0x47')][_0x1dcf('0x4f')]({'where':{'id':_0x26a849['params']['id']}})[_0x1dcf('0x2a')](handleEntityNotFound(_0x132705,null))[_0x1dcf('0x2a')](saveUpdates(_0x26a849['body'],null))[_0x1dcf('0x2a')](respondWithResult(_0x132705,null))[_0x1dcf('0x4b')](handleError(_0x132705,null));};exports['destroy']=function(_0x27e991,_0x4836e8){return db[_0x1dcf('0x47')]['find']({'where':{'id':_0x27e991[_0x1dcf('0x4d')]['id']}})[_0x1dcf('0x2a')](handleEntityNotFound(_0x4836e8,null))[_0x1dcf('0x2a')](removeEntity(_0x4836e8,null))[_0x1dcf('0x4b')](handleError(_0x4836e8,null));};exports['getFields']=function(_0x483e57,_0x326bd7,_0xa6d7dd){var _0x5f0535={};var _0x1971b5={};var _0xc68688;var _0x2d74cb;return db[_0x1dcf('0x47')][_0x1dcf('0x51')]({'where':{'id':_0x483e57[_0x1dcf('0x4d')]['id']}})[_0x1dcf('0x2a')](handleEntityNotFound(_0x326bd7,null))[_0x1dcf('0x2a')](function(_0x31a706){if(_0x31a706){_0xc68688=_0x31a706;_0x1971b5[_0x1dcf('0x34')]=_['keys'](db['ServicenowField'][_0x1dcf('0x31')]);_0x1971b5[_0x1dcf('0x36')]=_[_0x1dcf('0x37')](_0x483e57[_0x1dcf('0x36')]);_0x1971b5[_0x1dcf('0x38')]=_[_0x1dcf('0x39')](_0x1971b5[_0x1dcf('0x34')],_0x1971b5['query']);_0x5f0535[_0x1dcf('0x3a')]=_[_0x1dcf('0x39')](_0x1971b5[_0x1dcf('0x34')],qs[_0x1dcf('0x3b')](_0x483e57[_0x1dcf('0x36')][_0x1dcf('0x3b')]));_0x5f0535[_0x1dcf('0x3a')]=_0x5f0535[_0x1dcf('0x3a')][_0x1dcf('0x3c')]?_0x5f0535[_0x1dcf('0x3a')]:_0x1971b5['model'];_0x5f0535[_0x1dcf('0x3f')]=qs['sort'](_0x483e57[_0x1dcf('0x36')][_0x1dcf('0x40')]);_0x5f0535['where']=qs[_0x1dcf('0x38')](_['pick'](_0x483e57[_0x1dcf('0x36')],_0x1971b5[_0x1dcf('0x38')]));if(_0x483e57[_0x1dcf('0x36')][_0x1dcf('0x45')]){_0x5f0535[_0x1dcf('0x41')]=_[_0x1dcf('0x43')](_0x5f0535[_0x1dcf('0x41')],{'$or':_[_0x1dcf('0x35')](_0x5f0535['attributes'],function(_0x5c8007){var _0x51f732={};_0x51f732[_0x5c8007]={'$like':'%'+_0x483e57[_0x1dcf('0x36')][_0x1dcf('0x45')]+'%'};return _0x51f732;})});}_0x5f0535=_[_0x1dcf('0x43')]({},_0x5f0535,_0x483e57[_0x1dcf('0x46')]);return _0xc68688[_0x1dcf('0x52')](_0x5f0535);}})[_0x1dcf('0x2a')](function(_0x44d724){if(_0x44d724){_0x2d74cb=_0x44d724[_0x1dcf('0x3c')];if(!_0x483e57[_0x1dcf('0x36')]['hasOwnProperty']('nolimit')){_0x5f0535[_0x1dcf('0x21')]=qs[_0x1dcf('0x21')](_0x483e57[_0x1dcf('0x36')]['limit']);_0x5f0535[_0x1dcf('0x20')]=qs[_0x1dcf('0x20')](_0x483e57['query'][_0x1dcf('0x20')]);}return _0xc68688[_0x1dcf('0x52')](_0x5f0535);}})[_0x1dcf('0x2a')](function(_0x4625d7){if(_0x4625d7){return _0x4625d7?{'count':_0x2d74cb,'rows':_0x4625d7}:null;}})['then'](respondWithResult(_0x326bd7,null))['catch'](handleError(_0x326bd7,null));};exports[_0x1dcf('0x53')]=function(_0x4bec27,_0x4d7334,_0x48180f){var _0x217245={};var _0x7dc4d4={};var _0x2bd95e;var _0x1a1c5a;return db[_0x1dcf('0x47')][_0x1dcf('0x51')]({'where':{'id':_0x4bec27[_0x1dcf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4d7334,null))[_0x1dcf('0x2a')](function(_0x2e347c){if(_0x2e347c){_0x2bd95e=_0x2e347c;_0x7dc4d4[_0x1dcf('0x34')]=_['keys'](db[_0x1dcf('0x54')]['rawAttributes']);_0x7dc4d4[_0x1dcf('0x36')]=_[_0x1dcf('0x37')](_0x4bec27[_0x1dcf('0x36')]);_0x7dc4d4[_0x1dcf('0x38')]=_[_0x1dcf('0x39')](_0x7dc4d4[_0x1dcf('0x34')],_0x7dc4d4[_0x1dcf('0x36')]);_0x217245[_0x1dcf('0x3a')]=_[_0x1dcf('0x39')](_0x7dc4d4[_0x1dcf('0x34')],qs['fields'](_0x4bec27[_0x1dcf('0x36')][_0x1dcf('0x3b')]));_0x217245[_0x1dcf('0x3a')]=_0x217245[_0x1dcf('0x3a')][_0x1dcf('0x3c')]?_0x217245[_0x1dcf('0x3a')]:_0x7dc4d4[_0x1dcf('0x34')];_0x217245[_0x1dcf('0x3f')]=qs[_0x1dcf('0x40')](_0x4bec27['query'][_0x1dcf('0x40')]);_0x217245['where']=qs[_0x1dcf('0x38')](_[_0x1dcf('0x42')](_0x4bec27[_0x1dcf('0x36')],_0x7dc4d4[_0x1dcf('0x38')]));if(_0x4bec27[_0x1dcf('0x36')][_0x1dcf('0x45')]){_0x217245[_0x1dcf('0x41')]=_[_0x1dcf('0x43')](_0x217245[_0x1dcf('0x41')],{'$or':_['map'](_0x217245[_0x1dcf('0x3a')],function(_0x551511){var _0x515ced={};_0x515ced[_0x551511]={'$like':'%'+_0x4bec27[_0x1dcf('0x36')][_0x1dcf('0x45')]+'%'};return _0x515ced;})});}_0x217245=_['merge']({},_0x217245,_0x4bec27['options']);return _0x2bd95e[_0x1dcf('0x53')](_0x217245);}})['then'](function(_0x29e86b){if(_0x29e86b){_0x1a1c5a=_0x29e86b['length'];if(!_0x4bec27['query'][_0x1dcf('0x3d')](_0x1dcf('0x3e'))){_0x217245[_0x1dcf('0x21')]=qs[_0x1dcf('0x21')](_0x4bec27[_0x1dcf('0x36')][_0x1dcf('0x21')]);_0x217245[_0x1dcf('0x20')]=qs['offset'](_0x4bec27[_0x1dcf('0x36')][_0x1dcf('0x20')]);}return _0x2bd95e[_0x1dcf('0x53')](_0x217245);}})[_0x1dcf('0x2a')](function(_0xcbd5aa){if(_0xcbd5aa){return _0xcbd5aa?{'count':_0x1a1c5a,'rows':_0xcbd5aa}:null;}})[_0x1dcf('0x2a')](respondWithResult(_0x4d7334,null))[_0x1dcf('0x4b')](handleError(_0x4d7334,null));};exports[_0x1dcf('0x55')]=function(_0x5726fd,_0x1aed12,_0x3bd2a0){var _0x84e8ab={};var _0x5a8e5f={};var _0x12f3ed;var _0x2ba9cd;return db[_0x1dcf('0x47')]['findOne']({'where':{'id':_0x5726fd[_0x1dcf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1aed12,null))[_0x1dcf('0x2a')](function(_0x51f240){if(_0x51f240){_0x12f3ed=_0x51f240;_0x5a8e5f[_0x1dcf('0x34')]=_[_0x1dcf('0x37')](db[_0x1dcf('0x54')][_0x1dcf('0x31')]);_0x5a8e5f[_0x1dcf('0x36')]=_['keys'](_0x5726fd[_0x1dcf('0x36')]);_0x5a8e5f['filters']=_[_0x1dcf('0x39')](_0x5a8e5f[_0x1dcf('0x34')],_0x5a8e5f[_0x1dcf('0x36')]);_0x84e8ab['attributes']=_[_0x1dcf('0x39')](_0x5a8e5f[_0x1dcf('0x34')],qs[_0x1dcf('0x3b')](_0x5726fd[_0x1dcf('0x36')]['fields']));_0x84e8ab[_0x1dcf('0x3a')]=_0x84e8ab[_0x1dcf('0x3a')][_0x1dcf('0x3c')]?_0x84e8ab[_0x1dcf('0x3a')]:_0x5a8e5f[_0x1dcf('0x34')];_0x84e8ab['order']=qs[_0x1dcf('0x40')](_0x5726fd['query'][_0x1dcf('0x40')]);_0x84e8ab[_0x1dcf('0x41')]=qs[_0x1dcf('0x38')](_[_0x1dcf('0x42')](_0x5726fd[_0x1dcf('0x36')],_0x5a8e5f['filters']));if(_0x5726fd['query'][_0x1dcf('0x45')]){_0x84e8ab[_0x1dcf('0x41')]=_['merge'](_0x84e8ab['where'],{'$or':_[_0x1dcf('0x35')](_0x84e8ab['attributes'],function(_0x543691){var _0x4ef7df={};_0x4ef7df[_0x543691]={'$like':'%'+_0x5726fd[_0x1dcf('0x36')]['filter']+'%'};return _0x4ef7df;})});}_0x84e8ab=_[_0x1dcf('0x43')]({},_0x84e8ab,_0x5726fd['options']);return _0x12f3ed[_0x1dcf('0x55')](_0x84e8ab);}})['then'](function(_0x4edb94){if(_0x4edb94){_0x2ba9cd=_0x4edb94[_0x1dcf('0x3c')];if(!_0x5726fd['query']['hasOwnProperty'](_0x1dcf('0x3e'))){_0x84e8ab[_0x1dcf('0x21')]=qs['limit'](_0x5726fd[_0x1dcf('0x36')][_0x1dcf('0x21')]);_0x84e8ab[_0x1dcf('0x20')]=qs[_0x1dcf('0x20')](_0x5726fd['query'][_0x1dcf('0x20')]);}return _0x12f3ed[_0x1dcf('0x55')](_0x84e8ab);}})[_0x1dcf('0x2a')](function(_0x58a7a4){if(_0x58a7a4){return _0x58a7a4?{'count':_0x2ba9cd,'rows':_0x58a7a4}:null;}})['then'](respondWithResult(_0x1aed12,null))[_0x1dcf('0x4b')](handleError(_0x1aed12,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 8d324e8..e09d299 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 _0x58d6=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','moment'];(function(_0x5435af,_0x5e55b2){var _0x2a7b2d=function(_0x1da9f5){while(--_0x1da9f5){_0x5435af['push'](_0x5435af['shift']());}};_0x2a7b2d(++_0x5e55b2);}(_0x58d6,0x1d3));var _0x658d=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0x58d6[_0x5817e6];return _0x51916a;};'use strict';var _=require('lodash');var util=require(_0x658d('0x0'));var logger=require(_0x658d('0x1'))('api');var moment=require(_0x658d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x658d('0x3'));var rimraf=require(_0x658d('0x4'));var config=require(_0x658d('0x5'));var attributes=require(_0x658d('0x6'));module['exports']=function(_0x513562,_0x48f5e3){return _0x513562[_0x658d('0x7')](_0x658d('0x8'),attributes,{'tableName':_0x658d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaebd=['moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','../../config/logger','api'];(function(_0x16eabf,_0x23b900){var _0x1fdb56=function(_0x5aa705){while(--_0x5aa705){_0x16eabf['push'](_0x16eabf['shift']());}};_0x1fdb56(++_0x23b900);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x2515f8,_0x38e831){_0x2515f8=_0x2515f8-0x0;var _0xccb0d6=_0xaebd[_0x2515f8];return _0xccb0d6;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),attributes,{'tableName':'int_servicenow_configurations','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 7261708..4557240 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 _0x2297=['then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x363e77,_0x247fda){var _0x4cad92=function(_0x2e6bc5){while(--_0x2e6bc5){_0x363e77['push'](_0x363e77['shift']());}};_0x4cad92(++_0x247fda);}(_0x2297,0x186));var _0x7229=function(_0x9da28a,_0x304136){_0x9da28a=_0x9da28a-0x0;var _0x207793=_0x2297[_0x9da28a];return _0x207793;};'use strict';var _=require('lodash');var util=require(_0x7229('0x0'));var moment=require(_0x7229('0x1'));var BPromise=require(_0x7229('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7229('0x3'));var db=require(_0x7229('0x4'))['db'];var utils=require(_0x7229('0x5'));var logger=require('../../config/logger')(_0x7229('0x6'));var config=require('../../config/environment');var jayson=require(_0x7229('0x7'));var client=jayson['client'][_0x7229('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46f6bd,_0xf1a0a2,_0x260f1d){return new BPromise(function(_0x21e9d0,_0x3100bf){return client[_0x7229('0x9')](_0x46f6bd,_0x260f1d)[_0x7229('0xa')](function(_0x3c8a2f){logger[_0x7229('0xb')](_0x7229('0xc'),_0xf1a0a2,'request\x20sent');logger[_0x7229('0xd')](_0x7229('0xe'),_0xf1a0a2,_0x7229('0xf'),JSON[_0x7229('0x10')](_0x3c8a2f));if(_0x3c8a2f[_0x7229('0x11')]){if(_0x3c8a2f['error']['code']===0x1f4){logger[_0x7229('0x11')](_0x7229('0xc'),_0xf1a0a2,_0x3c8a2f[_0x7229('0x11')]['message']);return _0x3100bf(_0x3c8a2f[_0x7229('0x11')][_0x7229('0x12')]);}logger[_0x7229('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xf1a0a2,_0x3c8a2f['error'][_0x7229('0x12')]);return _0x21e9d0(_0x3c8a2f[_0x7229('0x11')][_0x7229('0x12')]);}else{logger['info'](_0x7229('0xc'),_0xf1a0a2,_0x7229('0xf'));_0x21e9d0(_0x3c8a2f[_0x7229('0x13')][_0x7229('0x12')]);}})['catch'](function(_0x42b9c1){logger[_0x7229('0x11')](_0x7229('0xc'),_0xf1a0a2,_0x42b9c1);_0x3100bf(_0x42b9c1);});});} \ No newline at end of file +var _0x849d=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x549dd8,_0x26c531){var _0x5d772f=function(_0x234b15){while(--_0x234b15){_0x549dd8['push'](_0x549dd8['shift']());}};_0x5d772f(++_0x26c531);}(_0x849d,0x181));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd849('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd849('0x1'));var rs=require(_0xd849('0x2'));var fs=require('fs');var Redis=require(_0xd849('0x3'));var db=require(_0xd849('0x4'))['db'];var utils=require(_0xd849('0x5'));var logger=require(_0xd849('0x6'))('rpc');var config=require(_0xd849('0x7'));var jayson=require(_0xd849('0x8'));var client=jayson[_0xd849('0x9')][_0xd849('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x464f3c,_0x6524bc,_0x2ca92d){return new BPromise(function(_0x2423a8,_0x45338f){return client[_0xd849('0xb')](_0x464f3c,_0x2ca92d)[_0xd849('0xc')](function(_0x4a65b9){logger[_0xd849('0xd')](_0xd849('0xe'),_0x6524bc,_0xd849('0xf'));logger[_0xd849('0x10')](_0xd849('0x11'),_0x6524bc,_0xd849('0xf'),JSON[_0xd849('0x12')](_0x4a65b9));if(_0x4a65b9[_0xd849('0x13')]){if(_0x4a65b9[_0xd849('0x13')][_0xd849('0x14')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x6524bc,_0x4a65b9[_0xd849('0x13')][_0xd849('0x15')]);return _0x45338f(_0x4a65b9[_0xd849('0x13')][_0xd849('0x15')]);}logger[_0xd849('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x6524bc,_0x4a65b9[_0xd849('0x13')][_0xd849('0x15')]);return _0x2423a8(_0x4a65b9['error'][_0xd849('0x15')]);}else{logger[_0xd849('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x6524bc,_0xd849('0xf'));_0x2423a8(_0x4a65b9['result'][_0xd849('0x15')]);}})[_0xd849('0x16')](function(_0x1e2fac){logger[_0xd849('0x13')](_0xd849('0xe'),_0x6524bc,_0x1e2fac);_0x45338f(_0x1e2fac);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 1c899ed..ebd3d2d 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 _0x0b62=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','index','/:id','isAuthenticated','post','create','update','delete','exports','multer','connect-timeout','express'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x0b62,0x173));var _0x20b6=function(_0x1d38be,_0x5a9cc6){_0x1d38be=_0x1d38be-0x0;var _0x254ab4=_0x0b62[_0x1d38be];return _0x254ab4;};'use strict';var multer=require(_0x20b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x20b6('0x1'));var express=require(_0x20b6('0x2'));var router=express[_0x20b6('0x3')]();var fs_extra=require(_0x20b6('0x4'));var auth=require(_0x20b6('0x5'));var interaction=require(_0x20b6('0x6'));var config=require('../../config/environment');var controller=require(_0x20b6('0x7'));router[_0x20b6('0x8')]('/',auth['isAuthenticated'](),controller[_0x20b6('0x9')]);router[_0x20b6('0x8')](_0x20b6('0xa'),auth[_0x20b6('0xb')](),controller['show']);router[_0x20b6('0xc')]('/',auth['isAuthenticated'](),controller[_0x20b6('0xd')]);router['put'](_0x20b6('0xa'),auth['isAuthenticated'](),controller[_0x20b6('0xe')]);router[_0x20b6('0xf')](_0x20b6('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x20b6('0x10')]=router; \ No newline at end of file +var _0x904a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','/:id','show','create','update','delete','destroy','util','path'];(function(_0x116c04,_0x4963da){var _0x9e011d=function(_0x143880){while(--_0x143880){_0x116c04['push'](_0x116c04['shift']());}};_0x9e011d(++_0x4963da);}(_0x904a,0x13e));var _0xa904=function(_0xb42fec,_0x109269){_0xb42fec=_0xb42fec-0x0;var _0x256cf6=_0x904a[_0xb42fec];return _0x256cf6;};'use strict';var multer=require('multer');var util=require(_0xa904('0x0'));var path=require(_0xa904('0x1'));var timeout=require(_0xa904('0x2'));var express=require(_0xa904('0x3'));var router=express[_0xa904('0x4')]();var fs_extra=require(_0xa904('0x5'));var auth=require(_0xa904('0x6'));var interaction=require(_0xa904('0x7'));var config=require('../../config/environment');var controller=require(_0xa904('0x8'));router['get']('/',auth[_0xa904('0x9')](),controller['index']);router['get'](_0xa904('0xa'),auth[_0xa904('0x9')](),controller[_0xa904('0xb')]);router['post']('/',auth[_0xa904('0x9')](),controller[_0xa904('0xc')]);router['put']('/:id',auth[_0xa904('0x9')](),controller[_0xa904('0xd')]);router[_0xa904('0xe')](_0xa904('0xa'),auth[_0xa904('0x9')](),controller[_0xa904('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 52e9ef6..56d2fe3 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 _0x7a8f=['string','STRING','BOOLEAN','exports','ENUM','variable','customVariable'];(function(_0x9f26b5,_0x44edbd){var _0x1e5a5f=function(_0x21399f){while(--_0x21399f){_0x9f26b5['push'](_0x9f26b5['shift']());}};_0x1e5a5f(++_0x44edbd);}(_0x7a8f,0x199));var _0xf7a8=function(_0x2cad07,_0x504e26){_0x2cad07=_0x2cad07-0x0;var _0x344219=_0x7a8f[_0x2cad07];return _0x344219;};'use strict';var Sequelize=require('sequelize');module[_0xf7a8('0x0')]={'type':{'type':Sequelize[_0xf7a8('0x1')]('string',_0xf7a8('0x2'),_0xf7a8('0x3'),'keyValue','picklist'),'defaultValue':_0xf7a8('0x4')},'content':{'type':Sequelize[_0xf7a8('0x5')]},'key':{'type':Sequelize[_0xf7a8('0x5')]},'keyType':{'type':Sequelize[_0xf7a8('0x1')](_0xf7a8('0x4'),_0xf7a8('0x2'),_0xf7a8('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf7a8('0x5')]},'customField':{'type':Sequelize[_0xf7a8('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf7a8('0x5')]}}; \ No newline at end of file +var _0x1699=['customVariable','sequelize','exports','ENUM','string','picklist','STRING'];(function(_0x40de66,_0x1fdeb5){var _0xd40446=function(_0x546789){while(--_0x546789){_0x40de66['push'](_0x40de66['shift']());}};_0xd40446(++_0x1fdeb5);}(_0x1699,0x1b3));var _0x9169=function(_0x545e41,_0x55830d){_0x545e41=_0x545e41-0x0;var _0x20ee17=_0x1699[_0x545e41];return _0x20ee17;};'use strict';var Sequelize=require(_0x9169('0x0'));module[_0x9169('0x1')]={'type':{'type':Sequelize[_0x9169('0x2')](_0x9169('0x3'),'variable','customVariable','keyValue',_0x9169('0x4')),'defaultValue':_0x9169('0x3')},'content':{'type':Sequelize[_0x9169('0x5')]},'key':{'type':Sequelize[_0x9169('0x5')]},'keyType':{'type':Sequelize[_0x9169('0x2')]('string','variable',_0x9169('0x6'))},'keyContent':{'type':Sequelize[_0x9169('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9169('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 12beeb7..00dfc5d 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 _0x5e6b=['ServicenowField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','options','includeAll','findAll','catch','keys','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','save','then','destroy','end','error','stack','name'];(function(_0x21cf34,_0x121e4c){var _0x4981db=function(_0x4ba210){while(--_0x4ba210){_0x21cf34['push'](_0x21cf34['shift']());}};_0x4981db(++_0x121e4c);}(_0x5e6b,0x13b));var _0xb5e6=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x5e6b[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0xb5e6('0x0'));var rimraf=require(_0xb5e6('0x1'));var zipdir=require(_0xb5e6('0x2'));var jsonpatch=require(_0xb5e6('0x3'));var rp=require(_0xb5e6('0x4'));var moment=require(_0xb5e6('0x5'));var BPromise=require(_0xb5e6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb5e6('0x7'));var sox=require(_0xb5e6('0x8'));var csv=require(_0xb5e6('0x9'));var ejs=require(_0xb5e6('0xa'));var fs=require('fs');var fs_extra=require(_0xb5e6('0xb'));var _=require(_0xb5e6('0xc'));var squel=require(_0xb5e6('0xd'));var crypto=require(_0xb5e6('0xe'));var jsforce=require(_0xb5e6('0xf'));var deskjs=require(_0xb5e6('0x10'));var toCsv=require(_0xb5e6('0x9'));var querystring=require('querystring');var Papa=require(_0xb5e6('0x11'));var Redis=require(_0xb5e6('0x12'));var authService=require(_0xb5e6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb5e6('0x14'));var hardwareService=require(_0xb5e6('0x15'));var logger=require(_0xb5e6('0x16'))(_0xb5e6('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb5e6('0x18'));var db=require(_0xb5e6('0x19'))['db'];function respondWithStatusCode(_0x4f6f56,_0x57aa87){_0x57aa87=_0x57aa87||0xcc;return function(_0x5ad457){if(_0x5ad457){return _0x4f6f56[_0xb5e6('0x1a')](_0x57aa87);}return _0x4f6f56[_0xb5e6('0x1b')](_0x57aa87)['end']();};}function respondWithResult(_0x505671,_0x27003c){_0x27003c=_0x27003c||0xc8;return function(_0x41cd8e){if(_0x41cd8e){return _0x505671['status'](_0x27003c)[_0xb5e6('0x1c')](_0x41cd8e);}};}function respondWithFilteredResult(_0x4636bb,_0x27e569){return function(_0x36cd60){if(_0x36cd60){var _0x5a389f=typeof _0x27e569[_0xb5e6('0x1d')]==='undefined'&&typeof _0x27e569[_0xb5e6('0x1e')]===_0xb5e6('0x1f');var _0xd9f066=_0x36cd60[_0xb5e6('0x20')];var _0x103f85=_0x5a389f?0x0:_0x27e569[_0xb5e6('0x1d')];var _0x4ea347=_0x5a389f?_0x36cd60[_0xb5e6('0x20')]:_0x27e569[_0xb5e6('0x1d')]+_0x27e569[_0xb5e6('0x1e')];var _0x2a902b;if(_0x4ea347>=_0xd9f066){_0x4ea347=_0xd9f066;_0x2a902b=0xc8;}else{_0x2a902b=0xce;}_0x4636bb[_0xb5e6('0x1b')](_0x2a902b);return _0x4636bb['set']('Content-Range',_0x103f85+'-'+_0x4ea347+'/'+_0xd9f066)[_0xb5e6('0x1c')](_0x36cd60);}return null;};}function patchUpdates(_0x415bee){return function(_0x59ddde){try{jsonpatch['apply'](_0x59ddde,_0x415bee,!![]);}catch(_0x28f6b2){return BPromise['reject'](_0x28f6b2);}return _0x59ddde[_0xb5e6('0x21')]();};}function saveUpdates(_0xbe131,_0x15c505){return function(_0x5cec73){if(_0x5cec73){return _0x5cec73['update'](_0xbe131)[_0xb5e6('0x22')](function(_0x1ec527){return _0x1ec527;});}return null;};}function removeEntity(_0x97e552,_0x21e9a1){return function(_0x25135b){if(_0x25135b){return _0x25135b[_0xb5e6('0x23')]()[_0xb5e6('0x22')](function(){_0x97e552[_0xb5e6('0x1b')](0xcc)[_0xb5e6('0x24')]();});}};}function handleEntityNotFound(_0x4176d9,_0xa65abc){return function(_0x504b58){if(!_0x504b58){_0x4176d9[_0xb5e6('0x1a')](0x194);}return _0x504b58;};}function handleError(_0x29bc2a,_0x984bd){_0x984bd=_0x984bd||0x1f4;return function(_0x186bff){logger[_0xb5e6('0x25')](_0x186bff[_0xb5e6('0x26')]);if(_0x186bff[_0xb5e6('0x27')]){delete _0x186bff['name'];}_0x29bc2a['status'](_0x984bd)['send'](_0x186bff);};}exports['index']=function(_0x487aee,_0x30a2cb){var _0x1abaff={},_0x3cc92c={},_0x4e55e8={'count':0x0,'rows':[]};var _0x27ae64=_['map'](db[_0xb5e6('0x28')][_0xb5e6('0x29')],function(_0x2707d5){return{'name':_0x2707d5[_0xb5e6('0x2a')],'type':_0x2707d5['type'][_0xb5e6('0x2b')]};});_0x3cc92c[_0xb5e6('0x2c')]=_['map'](_0x27ae64,_0xb5e6('0x27'));_0x3cc92c[_0xb5e6('0x2d')]=_['keys'](_0x487aee[_0xb5e6('0x2d')]);_0x3cc92c[_0xb5e6('0x2e')]=_[_0xb5e6('0x2f')](_0x3cc92c[_0xb5e6('0x2c')],_0x3cc92c[_0xb5e6('0x2d')]);_0x1abaff['attributes']=_['intersection'](_0x3cc92c['model'],qs[_0xb5e6('0x30')](_0x487aee['query'][_0xb5e6('0x30')]));_0x1abaff[_0xb5e6('0x31')]=_0x1abaff[_0xb5e6('0x31')][_0xb5e6('0x32')]?_0x1abaff['attributes']:_0x3cc92c[_0xb5e6('0x2c')];if(!_0x487aee[_0xb5e6('0x2d')][_0xb5e6('0x33')](_0xb5e6('0x34'))){_0x1abaff[_0xb5e6('0x1e')]=qs[_0xb5e6('0x1e')](_0x487aee[_0xb5e6('0x2d')][_0xb5e6('0x1e')]);_0x1abaff[_0xb5e6('0x1d')]=qs[_0xb5e6('0x1d')](_0x487aee['query'][_0xb5e6('0x1d')]);}_0x1abaff[_0xb5e6('0x35')]=qs[_0xb5e6('0x36')](_0x487aee[_0xb5e6('0x2d')][_0xb5e6('0x36')]);_0x1abaff['where']=qs[_0xb5e6('0x2e')](_[_0xb5e6('0x37')](_0x487aee[_0xb5e6('0x2d')],_0x3cc92c['filters']),_0x27ae64);if(_0x487aee['query'][_0xb5e6('0x38')]){_0x1abaff[_0xb5e6('0x39')]=_[_0xb5e6('0x3a')](_0x1abaff[_0xb5e6('0x39')],{'$or':_[_0xb5e6('0x3b')](_0x27ae64,function(_0x4d053f){if(_0x4d053f[_0xb5e6('0x3c')]!=='VIRTUAL'){var _0x2d2a9b={};_0x2d2a9b[_0x4d053f[_0xb5e6('0x27')]]={'$like':'%'+_0x487aee[_0xb5e6('0x2d')][_0xb5e6('0x38')]+'%'};return _0x2d2a9b;}})});}_0x1abaff=_[_0xb5e6('0x3a')]({},_0x1abaff,_0x487aee[_0xb5e6('0x3d')]);var _0x2f163c={'where':_0x1abaff[_0xb5e6('0x39')]};return db[_0xb5e6('0x28')]['count'](_0x2f163c)['then'](function(_0x1ee8f9){_0x4e55e8[_0xb5e6('0x20')]=_0x1ee8f9;if(_0x487aee[_0xb5e6('0x2d')][_0xb5e6('0x3e')]){_0x1abaff['include']=[{'all':!![]}];}return db['ServicenowField'][_0xb5e6('0x3f')](_0x1abaff);})['then'](function(_0x52cb95){_0x4e55e8['rows']=_0x52cb95;return _0x4e55e8;})[_0xb5e6('0x22')](respondWithFilteredResult(_0x30a2cb,_0x1abaff))[_0xb5e6('0x40')](handleError(_0x30a2cb,null));};exports['show']=function(_0x1bc882,_0xea9a3){var _0x3bb582={'raw':!![],'where':{'id':_0x1bc882['params']['id']}},_0xa90884={};_0xa90884['model']=_[_0xb5e6('0x41')](db[_0xb5e6('0x28')]['rawAttributes']);_0xa90884[_0xb5e6('0x2d')]=_[_0xb5e6('0x41')](_0x1bc882['query']);_0xa90884[_0xb5e6('0x2e')]=_[_0xb5e6('0x2f')](_0xa90884[_0xb5e6('0x2c')],_0xa90884[_0xb5e6('0x2d')]);_0x3bb582[_0xb5e6('0x31')]=_['intersection'](_0xa90884['model'],qs['fields'](_0x1bc882[_0xb5e6('0x2d')][_0xb5e6('0x30')]));_0x3bb582[_0xb5e6('0x31')]=_0x3bb582[_0xb5e6('0x31')][_0xb5e6('0x32')]?_0x3bb582[_0xb5e6('0x31')]:_0xa90884[_0xb5e6('0x2c')];if(_0x1bc882[_0xb5e6('0x2d')][_0xb5e6('0x3e')]){_0x3bb582['include']=[{'all':!![]}];}_0x3bb582=_[_0xb5e6('0x3a')]({},_0x3bb582,_0x1bc882[_0xb5e6('0x3d')]);return db[_0xb5e6('0x28')][_0xb5e6('0x42')](_0x3bb582)[_0xb5e6('0x22')](handleEntityNotFound(_0xea9a3,null))[_0xb5e6('0x22')](respondWithResult(_0xea9a3,null))['catch'](handleError(_0xea9a3,null));};exports[_0xb5e6('0x43')]=function(_0x32f3dc,_0x100e90){return db[_0xb5e6('0x28')][_0xb5e6('0x43')](_0x32f3dc[_0xb5e6('0x44')],{})[_0xb5e6('0x22')](respondWithResult(_0x100e90,0xc9))[_0xb5e6('0x40')](handleError(_0x100e90,null));};exports[_0xb5e6('0x45')]=function(_0x579d76,_0x1f39d1){if(_0x579d76[_0xb5e6('0x44')]['id']){delete _0x579d76[_0xb5e6('0x44')]['id'];}return db[_0xb5e6('0x28')]['find']({'where':{'id':_0x579d76['params']['id']}})['then'](handleEntityNotFound(_0x1f39d1,null))[_0xb5e6('0x22')](saveUpdates(_0x579d76[_0xb5e6('0x44')],null))[_0xb5e6('0x22')](respondWithResult(_0x1f39d1,null))[_0xb5e6('0x40')](handleError(_0x1f39d1,null));};exports['destroy']=function(_0x8483c4,_0x196974){return db['ServicenowField']['find']({'where':{'id':_0x8483c4[_0xb5e6('0x46')]['id']}})[_0xb5e6('0x22')](handleEntityNotFound(_0x196974,null))[_0xb5e6('0x22')](removeEntity(_0x196974,null))[_0xb5e6('0x40')](handleError(_0x196974,null));}; \ No newline at end of file +var _0x4506=['json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','ServicenowField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x4506,0x7b));var _0x6450=function(_0x51544f,_0x1b9431){_0x51544f=_0x51544f-0x0;var _0x3fca88=_0x4506[_0x51544f];return _0x3fca88;};'use strict';var emlformat=require(_0x6450('0x0'));var rimraf=require(_0x6450('0x1'));var zipdir=require(_0x6450('0x2'));var jsonpatch=require(_0x6450('0x3'));var rp=require(_0x6450('0x4'));var moment=require(_0x6450('0x5'));var BPromise=require(_0x6450('0x6'));var Mustache=require(_0x6450('0x7'));var util=require(_0x6450('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6450('0x9'));var ejs=require(_0x6450('0xa'));var fs=require('fs');var fs_extra=require(_0x6450('0xb'));var _=require(_0x6450('0xc'));var squel=require(_0x6450('0xd'));var crypto=require('crypto');var jsforce=require(_0x6450('0xe'));var deskjs=require(_0x6450('0xf'));var toCsv=require(_0x6450('0x9'));var querystring=require('querystring');var Papa=require(_0x6450('0x10'));var Redis=require(_0x6450('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6450('0x12'));var as=require(_0x6450('0x13'));var hardwareService=require(_0x6450('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6450('0x15'));var config=require(_0x6450('0x16'));var licenseUtil=require(_0x6450('0x17'));var db=require(_0x6450('0x18'))['db'];function respondWithStatusCode(_0x548dd1,_0x9d086a){_0x9d086a=_0x9d086a||0xcc;return function(_0x1b13dd){if(_0x1b13dd){return _0x548dd1[_0x6450('0x19')](_0x9d086a);}return _0x548dd1['status'](_0x9d086a)[_0x6450('0x1a')]();};}function respondWithResult(_0x4eaecd,_0x351633){_0x351633=_0x351633||0xc8;return function(_0x508eca){if(_0x508eca){return _0x4eaecd['status'](_0x351633)[_0x6450('0x1b')](_0x508eca);}};}function respondWithFilteredResult(_0x1b74ce,_0x49b6fd){return function(_0x424c9c){if(_0x424c9c){var _0x47d4dd=typeof _0x49b6fd[_0x6450('0x1c')]===_0x6450('0x1d')&&typeof _0x49b6fd[_0x6450('0x1e')]===_0x6450('0x1d');var _0x33106f=_0x424c9c[_0x6450('0x1f')];var _0x50b87a=_0x47d4dd?0x0:_0x49b6fd[_0x6450('0x1c')];var _0x3afa45=_0x47d4dd?_0x424c9c[_0x6450('0x1f')]:_0x49b6fd[_0x6450('0x1c')]+_0x49b6fd[_0x6450('0x1e')];var _0x2395b8;if(_0x3afa45>=_0x33106f){_0x3afa45=_0x33106f;_0x2395b8=0xc8;}else{_0x2395b8=0xce;}_0x1b74ce[_0x6450('0x20')](_0x2395b8);return _0x1b74ce['set'](_0x6450('0x21'),_0x50b87a+'-'+_0x3afa45+'/'+_0x33106f)[_0x6450('0x1b')](_0x424c9c);}return null;};}function patchUpdates(_0x45bde4){return function(_0xad8a7d){try{jsonpatch[_0x6450('0x22')](_0xad8a7d,_0x45bde4,!![]);}catch(_0x309f39){return BPromise[_0x6450('0x23')](_0x309f39);}return _0xad8a7d[_0x6450('0x24')]();};}function saveUpdates(_0x533c0e,_0x51332f){return function(_0x32b648){if(_0x32b648){return _0x32b648[_0x6450('0x25')](_0x533c0e)['then'](function(_0x20641d){return _0x20641d;});}return null;};}function removeEntity(_0x3eda2b,_0x1273e7){return function(_0x1f3372){if(_0x1f3372){return _0x1f3372[_0x6450('0x26')]()[_0x6450('0x27')](function(){_0x3eda2b[_0x6450('0x20')](0xcc)[_0x6450('0x1a')]();});}};}function handleEntityNotFound(_0x4b5dad,_0x372481){return function(_0x13bcb9){if(!_0x13bcb9){_0x4b5dad[_0x6450('0x19')](0x194);}return _0x13bcb9;};}function handleError(_0x18995a,_0xc57b80){_0xc57b80=_0xc57b80||0x1f4;return function(_0x5f1de6){logger['error'](_0x5f1de6[_0x6450('0x28')]);if(_0x5f1de6['name']){delete _0x5f1de6[_0x6450('0x29')];}_0x18995a[_0x6450('0x20')](_0xc57b80)[_0x6450('0x2a')](_0x5f1de6);};}exports[_0x6450('0x2b')]=function(_0x2858db,_0x41daff){var _0x522de9={},_0x2eb7a6={},_0x3acf0e={'count':0x0,'rows':[]};var _0x350491=_['map'](db[_0x6450('0x2c')][_0x6450('0x2d')],function(_0x3e201a){return{'name':_0x3e201a[_0x6450('0x2e')],'type':_0x3e201a[_0x6450('0x2f')][_0x6450('0x30')]};});_0x2eb7a6['model']=_[_0x6450('0x31')](_0x350491,_0x6450('0x29'));_0x2eb7a6[_0x6450('0x32')]=_[_0x6450('0x33')](_0x2858db['query']);_0x2eb7a6[_0x6450('0x34')]=_[_0x6450('0x35')](_0x2eb7a6[_0x6450('0x36')],_0x2eb7a6[_0x6450('0x32')]);_0x522de9[_0x6450('0x37')]=_[_0x6450('0x35')](_0x2eb7a6[_0x6450('0x36')],qs[_0x6450('0x38')](_0x2858db[_0x6450('0x32')]['fields']));_0x522de9[_0x6450('0x37')]=_0x522de9[_0x6450('0x37')][_0x6450('0x39')]?_0x522de9[_0x6450('0x37')]:_0x2eb7a6[_0x6450('0x36')];if(!_0x2858db['query'][_0x6450('0x3a')](_0x6450('0x3b'))){_0x522de9[_0x6450('0x1e')]=qs[_0x6450('0x1e')](_0x2858db[_0x6450('0x32')][_0x6450('0x1e')]);_0x522de9[_0x6450('0x1c')]=qs[_0x6450('0x1c')](_0x2858db[_0x6450('0x32')][_0x6450('0x1c')]);}_0x522de9[_0x6450('0x3c')]=qs[_0x6450('0x3d')](_0x2858db[_0x6450('0x32')]['sort']);_0x522de9[_0x6450('0x3e')]=qs['filters'](_[_0x6450('0x3f')](_0x2858db[_0x6450('0x32')],_0x2eb7a6[_0x6450('0x34')]),_0x350491);if(_0x2858db['query'][_0x6450('0x40')]){_0x522de9['where']=_[_0x6450('0x41')](_0x522de9[_0x6450('0x3e')],{'$or':_[_0x6450('0x31')](_0x350491,function(_0x50e0ab){if(_0x50e0ab['type']!=='VIRTUAL'){var _0xda4d50={};_0xda4d50[_0x50e0ab[_0x6450('0x29')]]={'$like':'%'+_0x2858db[_0x6450('0x32')][_0x6450('0x40')]+'%'};return _0xda4d50;}})});}_0x522de9=_[_0x6450('0x41')]({},_0x522de9,_0x2858db[_0x6450('0x42')]);var _0x3b3fdb={'where':_0x522de9['where']};return db[_0x6450('0x2c')][_0x6450('0x1f')](_0x3b3fdb)['then'](function(_0x5657f0){_0x3acf0e['count']=_0x5657f0;if(_0x2858db[_0x6450('0x32')][_0x6450('0x43')]){_0x522de9['include']=[{'all':!![]}];}return db[_0x6450('0x2c')][_0x6450('0x44')](_0x522de9);})['then'](function(_0x5e12ee){_0x3acf0e['rows']=_0x5e12ee;return _0x3acf0e;})['then'](respondWithFilteredResult(_0x41daff,_0x522de9))['catch'](handleError(_0x41daff,null));};exports['show']=function(_0x454f98,_0xdd9015){var _0x6bb036={'raw':!![],'where':{'id':_0x454f98[_0x6450('0x45')]['id']}},_0x33de51={};_0x33de51[_0x6450('0x36')]=_[_0x6450('0x33')](db[_0x6450('0x2c')][_0x6450('0x2d')]);_0x33de51[_0x6450('0x32')]=_[_0x6450('0x33')](_0x454f98['query']);_0x33de51['filters']=_['intersection'](_0x33de51[_0x6450('0x36')],_0x33de51[_0x6450('0x32')]);_0x6bb036['attributes']=_[_0x6450('0x35')](_0x33de51['model'],qs[_0x6450('0x38')](_0x454f98['query'][_0x6450('0x38')]));_0x6bb036[_0x6450('0x37')]=_0x6bb036[_0x6450('0x37')]['length']?_0x6bb036['attributes']:_0x33de51['model'];if(_0x454f98[_0x6450('0x32')][_0x6450('0x43')]){_0x6bb036[_0x6450('0x46')]=[{'all':!![]}];}_0x6bb036=_[_0x6450('0x41')]({},_0x6bb036,_0x454f98[_0x6450('0x42')]);return db[_0x6450('0x2c')][_0x6450('0x47')](_0x6bb036)['then'](handleEntityNotFound(_0xdd9015,null))['then'](respondWithResult(_0xdd9015,null))[_0x6450('0x48')](handleError(_0xdd9015,null));};exports[_0x6450('0x49')]=function(_0x27156e,_0x2efeab){return db[_0x6450('0x2c')][_0x6450('0x49')](_0x27156e['body'],{})['then'](respondWithResult(_0x2efeab,0xc9))[_0x6450('0x48')](handleError(_0x2efeab,null));};exports[_0x6450('0x25')]=function(_0x34a415,_0x213bd2){if(_0x34a415['body']['id']){delete _0x34a415[_0x6450('0x4a')]['id'];}return db[_0x6450('0x2c')][_0x6450('0x47')]({'where':{'id':_0x34a415[_0x6450('0x45')]['id']}})[_0x6450('0x27')](handleEntityNotFound(_0x213bd2,null))[_0x6450('0x27')](saveUpdates(_0x34a415['body'],null))[_0x6450('0x27')](respondWithResult(_0x213bd2,null))[_0x6450('0x48')](handleError(_0x213bd2,null));};exports[_0x6450('0x26')]=function(_0x2946f0,_0x2543bb){return db[_0x6450('0x2c')][_0x6450('0x47')]({'where':{'id':_0x2946f0[_0x6450('0x45')]['id']}})['then'](handleEntityNotFound(_0x2543bb,null))[_0x6450('0x27')](removeEntity(_0x2543bb,null))[_0x6450('0x48')](handleError(_0x2543bb,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c89d723..9178d33 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 _0x351b=['exports','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4530d8,_0x4969ce){var _0x49cd95=function(_0x4a7dcb){while(--_0x4a7dcb){_0x4530d8['push'](_0x4530d8['shift']());}};_0x49cd95(++_0x4969ce);}(_0x351b,0xbb));var _0xb351=function(_0x4a0d26,_0x471062){_0x4a0d26=_0x4a0d26-0x0;var _0x1fedc5=_0x351b[_0x4a0d26];return _0x1fedc5;};'use strict';var _=require(_0xb351('0x0'));var util=require(_0xb351('0x1'));var logger=require('../../config/logger')(_0xb351('0x2'));var moment=require(_0xb351('0x3'));var BPromise=require(_0xb351('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb351('0x5'));var rimraf=require(_0xb351('0x6'));var config=require(_0xb351('0x7'));var attributes=require('./intServicenowField.attributes');module[_0xb351('0x8')]=function(_0x526f9b,_0x56f7db){return _0x526f9b['define'](_0xb351('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xb351('0xa'),'fields':[_0xb351('0xb'),_0xb351('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfed3=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x2e0851,_0x4bcf4c){var _0xb79e84=function(_0x5c4770){while(--_0x5c4770){_0x2e0851['push'](_0x2e0851['shift']());}};_0xb79e84(++_0x4bcf4c);}(_0xfed3,0x18f));var _0x3fed=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xfed3[_0x2d4421];return _0x2d3b01;};'use strict';var _=require(_0x3fed('0x0'));var util=require('util');var logger=require(_0x3fed('0x1'))(_0x3fed('0x2'));var moment=require(_0x3fed('0x3'));var BPromise=require(_0x3fed('0x4'));var rp=require(_0x3fed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3fed('0x6'));var attributes=require(_0x3fed('0x7'));module[_0x3fed('0x8')]=function(_0x3ea9cb,_0x5f0c85){return _0x3ea9cb[_0x3fed('0x9')](_0x3fed('0xa'),attributes,{'tableName':_0x3fed('0xb'),'paranoid':![],'indexes':[{'name':_0x3fed('0xc'),'fields':['idField',_0x3fed('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index f343ca0..c0b0ef0 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 _0x9bde=['code','message','ServicenowField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1beaf7,_0x176f28){var _0x43a50d=function(_0x120be5){while(--_0x120be5){_0x1beaf7['push'](_0x1beaf7['shift']());}};_0x43a50d(++_0x176f28);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3c04ba,_0x2d8e53){_0x3c04ba=_0x3c04ba-0x0;var _0x17ca58=_0x9bde[_0x3c04ba];return _0x17ca58;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +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(_0xf1ba70,_0x22937c){var _0x2263aa=function(_0x3bd5fd){while(--_0x3bd5fd){_0xf1ba70['push'](_0xf1ba70['shift']());}};_0x2263aa(++_0x22937c);}(_0x70e0,0x17b));var _0x070e=function(_0x5b676b,_0x4e6055){_0x5b676b=_0x5b676b-0x0;var _0x3ab0d5=_0x70e0[_0x5b676b];return _0x3ab0d5;};'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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 3b298ee..8ee01b8 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(_0x5064c8,_0x4e67c6){var _0x525ef6=function(_0x45fdd9){while(--_0x45fdd9){_0x5064c8['push'](_0x5064c8['shift']());}};_0x525ef6(++_0x4e67c6);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0xa45b0e,_0x5f5473){var _0x3f4afa=function(_0x5c57e0){while(--_0x5c57e0){_0xa45b0e['push'](_0xa45b0e['shift']());}};_0x3f4afa(++_0x5f5473);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 a91a877..74654ec 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(_0x38bd1d,_0x64497){var _0x78592a=function(_0x1ce7e1){while(--_0x1ce7e1){_0x38bd1d['push'](_0x38bd1d['shift']());}};_0x78592a(++_0x64497);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x4b66dc,_0x3fb9f0){var _0x558da7=function(_0x5406f7){while(--_0x5406f7){_0x4b66dc['push'](_0x4b66dc['shift']());}};_0x558da7(++_0x3fb9f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 3582e9f..0dec408 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 _0xc1a9=['key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','findAll','show','params','rawAttributes','fields','length','includeAll','include','options','find','catch','create','body','update','findOne','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','index','map','SugarcrmAccount','fieldName','type'];(function(_0x415230,_0x145f63){var _0xebee54=function(_0x4259e4){while(--_0x4259e4){_0x415230['push'](_0x415230['shift']());}};_0xebee54(++_0x145f63);}(_0xc1a9,0x149));var _0x9c1a=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0xc1a9[_0x51b1a5];return _0x15c738;};'use strict';var emlformat=require(_0x9c1a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c1a('0x1'));var jsonpatch=require(_0x9c1a('0x2'));var rp=require(_0x9c1a('0x3'));var moment=require(_0x9c1a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c1a('0x5'));var util=require(_0x9c1a('0x6'));var path=require(_0x9c1a('0x7'));var sox=require(_0x9c1a('0x8'));var csv=require(_0x9c1a('0x9'));var ejs=require(_0x9c1a('0xa'));var fs=require('fs');var fs_extra=require(_0x9c1a('0xb'));var _=require('lodash');var squel=require(_0x9c1a('0xc'));var crypto=require(_0x9c1a('0xd'));var jsforce=require(_0x9c1a('0xe'));var deskjs=require(_0x9c1a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9c1a('0x10'));var Papa=require(_0x9c1a('0x11'));var Redis=require('ioredis');var authService=require(_0x9c1a('0x12'));var qs=require(_0x9c1a('0x13'));var as=require(_0x9c1a('0x14'));var hardwareService=require(_0x9c1a('0x15'));var logger=require('../../config/logger')(_0x9c1a('0x16'));var utils=require('../../config/utils');var config=require(_0x9c1a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c1a('0x18'))['db'];var integrations=require(_0x9c1a('0x19'));function respondWithStatusCode(_0x3a1ffd,_0x875b1d){_0x875b1d=_0x875b1d||0xcc;return function(_0x1fe920){if(_0x1fe920){return _0x3a1ffd['sendStatus'](_0x875b1d);}return _0x3a1ffd[_0x9c1a('0x1a')](_0x875b1d)['end']();};}function respondWithResult(_0x34a820,_0x322544){_0x322544=_0x322544||0xc8;return function(_0x260aca){if(_0x260aca){return _0x34a820[_0x9c1a('0x1a')](_0x322544)['json'](_0x260aca);}};}function respondWithFilteredResult(_0x4418f4,_0xa633f6){return function(_0xbb6090){if(_0xbb6090){var _0x1a969b=typeof _0xa633f6[_0x9c1a('0x1b')]===_0x9c1a('0x1c')&&typeof _0xa633f6[_0x9c1a('0x1d')]===_0x9c1a('0x1c');var _0x5d837f=_0xbb6090[_0x9c1a('0x1e')];var _0x31380a=_0x1a969b?0x0:_0xa633f6['offset'];var _0x4000be=_0x1a969b?_0xbb6090[_0x9c1a('0x1e')]:_0xa633f6[_0x9c1a('0x1b')]+_0xa633f6[_0x9c1a('0x1d')];var _0x39258d;if(_0x4000be>=_0x5d837f){_0x4000be=_0x5d837f;_0x39258d=0xc8;}else{_0x39258d=0xce;}_0x4418f4['status'](_0x39258d);return _0x4418f4[_0x9c1a('0x1f')](_0x9c1a('0x20'),_0x31380a+'-'+_0x4000be+'/'+_0x5d837f)[_0x9c1a('0x21')](_0xbb6090);}return null;};}function patchUpdates(_0x53207b){return function(_0x440deb){try{jsonpatch[_0x9c1a('0x22')](_0x440deb,_0x53207b,!![]);}catch(_0x1d0041){return BPromise[_0x9c1a('0x23')](_0x1d0041);}return _0x440deb[_0x9c1a('0x24')]();};}function saveUpdates(_0x132158,_0xa9cb0e){return function(_0x47bcc0){if(_0x47bcc0){return _0x47bcc0['update'](_0x132158)[_0x9c1a('0x25')](function(_0x190b96){return _0x190b96;});}return null;};}function removeEntity(_0x3f7f35,_0x399261){return function(_0x20c008){if(_0x20c008){return _0x20c008[_0x9c1a('0x26')]()[_0x9c1a('0x25')](function(){_0x3f7f35[_0x9c1a('0x1a')](0xcc)[_0x9c1a('0x27')]();});}};}function handleEntityNotFound(_0x18636f,_0x394dd8){return function(_0x29d3b4){if(!_0x29d3b4){_0x18636f[_0x9c1a('0x28')](0x194);}return _0x29d3b4;};}function handleError(_0x393a41,_0xa44969){_0xa44969=_0xa44969||0x1f4;return function(_0x320679){logger[_0x9c1a('0x29')](_0x320679[_0x9c1a('0x2a')]);if(_0x320679[_0x9c1a('0x2b')]){delete _0x320679[_0x9c1a('0x2b')];}_0x393a41[_0x9c1a('0x1a')](_0xa44969)['send'](_0x320679);};}exports[_0x9c1a('0x2c')]=function(_0x16aeb5,_0x2cc22e){var _0x14c407={},_0xdc7fa7={},_0x3a5e85={'count':0x0,'rows':[]};var _0x160300=_[_0x9c1a('0x2d')](db[_0x9c1a('0x2e')]['rawAttributes'],function(_0x57ef4a){return{'name':_0x57ef4a[_0x9c1a('0x2f')],'type':_0x57ef4a[_0x9c1a('0x30')][_0x9c1a('0x31')]};});_0xdc7fa7[_0x9c1a('0x32')]=_[_0x9c1a('0x2d')](_0x160300,_0x9c1a('0x2b'));_0xdc7fa7[_0x9c1a('0x33')]=_[_0x9c1a('0x34')](_0x16aeb5[_0x9c1a('0x33')]);_0xdc7fa7[_0x9c1a('0x35')]=_[_0x9c1a('0x36')](_0xdc7fa7[_0x9c1a('0x32')],_0xdc7fa7['query']);_0x14c407[_0x9c1a('0x37')]=_['intersection'](_0xdc7fa7['model'],qs['fields'](_0x16aeb5[_0x9c1a('0x33')]['fields']));_0x14c407['attributes']=_0x14c407[_0x9c1a('0x37')]['length']?_0x14c407[_0x9c1a('0x37')]:_0xdc7fa7['model'];if(!_0x16aeb5['query'][_0x9c1a('0x38')]('nolimit')){_0x14c407[_0x9c1a('0x1d')]=qs['limit'](_0x16aeb5['query'][_0x9c1a('0x1d')]);_0x14c407['offset']=qs[_0x9c1a('0x1b')](_0x16aeb5[_0x9c1a('0x33')][_0x9c1a('0x1b')]);}_0x14c407[_0x9c1a('0x39')]=qs[_0x9c1a('0x3a')](_0x16aeb5['query'][_0x9c1a('0x3a')]);_0x14c407[_0x9c1a('0x3b')]=qs[_0x9c1a('0x35')](_[_0x9c1a('0x3c')](_0x16aeb5[_0x9c1a('0x33')],_0xdc7fa7['filters']),_0x160300);if(_0x16aeb5['query'][_0x9c1a('0x3d')]){_0x14c407[_0x9c1a('0x3b')]=_[_0x9c1a('0x3e')](_0x14c407[_0x9c1a('0x3b')],{'$or':_[_0x9c1a('0x2d')](_0x160300,function(_0x59c4fd){if(_0x59c4fd[_0x9c1a('0x30')]!=='VIRTUAL'){var _0x5eb2d4={};_0x5eb2d4[_0x59c4fd[_0x9c1a('0x2b')]]={'$like':'%'+_0x16aeb5[_0x9c1a('0x33')][_0x9c1a('0x3d')]+'%'};return _0x5eb2d4;}})});}_0x14c407=_[_0x9c1a('0x3e')]({},_0x14c407,_0x16aeb5['options']);var _0x339e89={'where':_0x14c407['where']};return db[_0x9c1a('0x2e')][_0x9c1a('0x1e')](_0x339e89)[_0x9c1a('0x25')](function(_0x1f0d0c){_0x3a5e85[_0x9c1a('0x1e')]=_0x1f0d0c;if(_0x16aeb5[_0x9c1a('0x33')]['includeAll']){_0x14c407['include']=[{'all':!![]}];}return db[_0x9c1a('0x2e')][_0x9c1a('0x3f')](_0x14c407);})[_0x9c1a('0x25')](function(_0x2902ac){_0x3a5e85['rows']=_0x2902ac;return _0x3a5e85;})[_0x9c1a('0x25')](respondWithFilteredResult(_0x2cc22e,_0x14c407))['catch'](handleError(_0x2cc22e,null));};exports[_0x9c1a('0x40')]=function(_0x283b65,_0x4fd434){var _0x1bad70={'raw':![],'where':{'id':_0x283b65[_0x9c1a('0x41')]['id']}},_0x1baff1={};_0x1baff1[_0x9c1a('0x32')]=_['keys'](db['SugarcrmAccount'][_0x9c1a('0x42')]);_0x1baff1[_0x9c1a('0x33')]=_[_0x9c1a('0x34')](_0x283b65[_0x9c1a('0x33')]);_0x1baff1['filters']=_[_0x9c1a('0x36')](_0x1baff1['model'],_0x1baff1[_0x9c1a('0x33')]);_0x1bad70[_0x9c1a('0x37')]=_[_0x9c1a('0x36')](_0x1baff1[_0x9c1a('0x32')],qs[_0x9c1a('0x43')](_0x283b65[_0x9c1a('0x33')][_0x9c1a('0x43')]));_0x1bad70[_0x9c1a('0x37')]=_0x1bad70[_0x9c1a('0x37')][_0x9c1a('0x44')]?_0x1bad70[_0x9c1a('0x37')]:_0x1baff1[_0x9c1a('0x32')];if(_0x283b65['query'][_0x9c1a('0x45')]){_0x1bad70[_0x9c1a('0x46')]=[{'all':!![]}];}_0x1bad70=_['merge']({},_0x1bad70,_0x283b65[_0x9c1a('0x47')]);return db[_0x9c1a('0x2e')][_0x9c1a('0x48')](_0x1bad70)[_0x9c1a('0x25')](handleEntityNotFound(_0x4fd434,null))[_0x9c1a('0x25')](respondWithResult(_0x4fd434,null))[_0x9c1a('0x49')](handleError(_0x4fd434,null));};exports[_0x9c1a('0x4a')]=function(_0x624751,_0x2e11ab){return db[_0x9c1a('0x2e')]['create'](_0x624751[_0x9c1a('0x4b')],{})[_0x9c1a('0x25')](respondWithResult(_0x2e11ab,0xc9))[_0x9c1a('0x49')](handleError(_0x2e11ab,null));};exports[_0x9c1a('0x4c')]=function(_0x40807f,_0x329b0a){if(_0x40807f[_0x9c1a('0x4b')]['id']){delete _0x40807f[_0x9c1a('0x4b')]['id'];}return db[_0x9c1a('0x2e')][_0x9c1a('0x48')]({'where':{'id':_0x40807f[_0x9c1a('0x41')]['id']}})[_0x9c1a('0x25')](handleEntityNotFound(_0x329b0a,null))[_0x9c1a('0x25')](saveUpdates(_0x40807f[_0x9c1a('0x4b')],null))[_0x9c1a('0x25')](respondWithResult(_0x329b0a,null))[_0x9c1a('0x49')](handleError(_0x329b0a,null));};exports[_0x9c1a('0x26')]=function(_0x1d71ca,_0xbb9944){return db['SugarcrmAccount']['find']({'where':{'id':_0x1d71ca[_0x9c1a('0x41')]['id']}})[_0x9c1a('0x25')](handleEntityNotFound(_0xbb9944,null))[_0x9c1a('0x25')](removeEntity(_0xbb9944,null))[_0x9c1a('0x49')](handleError(_0xbb9944,null));};exports['getConfigurations']=function(_0x533c66,_0x2061d7,_0xbbe223){var _0x2ae0c1={};var _0x243a02={};var _0x13c0f5;var _0x178802;return db[_0x9c1a('0x2e')][_0x9c1a('0x4d')]({'where':{'id':_0x533c66[_0x9c1a('0x41')]['id']}})[_0x9c1a('0x25')](handleEntityNotFound(_0x2061d7,null))[_0x9c1a('0x25')](function(_0x423d46){if(_0x423d46){_0x13c0f5=_0x423d46;_0x243a02['model']=_[_0x9c1a('0x34')](db['SugarcrmConfiguration'][_0x9c1a('0x42')]);_0x243a02['query']=_['keys'](_0x533c66['query']);_0x243a02[_0x9c1a('0x35')]=_[_0x9c1a('0x36')](_0x243a02['model'],_0x243a02[_0x9c1a('0x33')]);_0x2ae0c1[_0x9c1a('0x37')]=_[_0x9c1a('0x36')](_0x243a02[_0x9c1a('0x32')],qs[_0x9c1a('0x43')](_0x533c66['query'][_0x9c1a('0x43')]));_0x2ae0c1[_0x9c1a('0x37')]=_0x2ae0c1['attributes'][_0x9c1a('0x44')]?_0x2ae0c1['attributes']:_0x243a02[_0x9c1a('0x32')];_0x2ae0c1['order']=qs[_0x9c1a('0x3a')](_0x533c66[_0x9c1a('0x33')][_0x9c1a('0x3a')]);_0x2ae0c1[_0x9c1a('0x3b')]=qs[_0x9c1a('0x35')](_[_0x9c1a('0x3c')](_0x533c66[_0x9c1a('0x33')],_0x243a02[_0x9c1a('0x35')]));if(_0x533c66['query'][_0x9c1a('0x3d')]){_0x2ae0c1[_0x9c1a('0x3b')]=_[_0x9c1a('0x3e')](_0x2ae0c1[_0x9c1a('0x3b')],{'$or':_[_0x9c1a('0x2d')](_0x2ae0c1[_0x9c1a('0x37')],function(_0x15c751){var _0x489713={};_0x489713[_0x15c751]={'$like':'%'+_0x533c66[_0x9c1a('0x33')]['filter']+'%'};return _0x489713;})});}_0x2ae0c1=_[_0x9c1a('0x3e')]({},_0x2ae0c1,_0x533c66['options']);return _0x13c0f5[_0x9c1a('0x4e')](_0x2ae0c1);}})['then'](function(_0x575630){if(_0x575630){_0x178802=_0x575630['length'];if(!_0x533c66['query'][_0x9c1a('0x38')]('nolimit')){_0x2ae0c1[_0x9c1a('0x1d')]=qs[_0x9c1a('0x1d')](_0x533c66[_0x9c1a('0x33')][_0x9c1a('0x1d')]);_0x2ae0c1[_0x9c1a('0x1b')]=qs[_0x9c1a('0x1b')](_0x533c66['query'][_0x9c1a('0x1b')]);}return _0x13c0f5[_0x9c1a('0x4e')](_0x2ae0c1);}})[_0x9c1a('0x25')](function(_0x3e27e0){if(_0x3e27e0){return _0x3e27e0?{'count':_0x178802,'rows':_0x3e27e0}:null;}})[_0x9c1a('0x25')](respondWithResult(_0x2061d7,null))[_0x9c1a('0x49')](handleError(_0x2061d7,null));};exports[_0x9c1a('0x4f')]=function(_0x2b0f03,_0x10a35e,_0x5674db){if(_0x2b0f03[_0x9c1a('0x4b')]['id']){delete _0x2b0f03[_0x9c1a('0x4b')]['id'];}return db['SugarcrmAccount'][_0x9c1a('0x4d')]({'where':{'id':_0x2b0f03[_0x9c1a('0x41')]['id']}})['then'](handleEntityNotFound(_0x10a35e,null))['then'](function(_0x479433){if(_0x479433){_0x2b0f03[_0x9c1a('0x4b')]['AccountId']=_0x479433['id'];_0x2b0f03[_0x9c1a('0x4b')][_0x9c1a('0x50')]=integrations[_0x9c1a('0x51')](_0x2b0f03['body'][_0x9c1a('0x52')],_0x2b0f03[_0x9c1a('0x4b')][_0x9c1a('0x30')]);_0x2b0f03[_0x9c1a('0x4b')][_0x9c1a('0x53')]=integrations[_0x9c1a('0x54')](_0x2b0f03['body']['channel'],_0x2b0f03[_0x9c1a('0x4b')][_0x9c1a('0x30')]);return db[_0x9c1a('0x55')][_0x9c1a('0x4a')](_0x2b0f03['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x9c1a('0x50')},{'model':db[_0x9c1a('0x56')],'as':_0x9c1a('0x53')}]});}return null;})[_0x9c1a('0x25')](respondWithResult(_0x10a35e,null))['catch'](handleError(_0x10a35e,null));};exports[_0x9c1a('0x57')]=function(_0x4be818,_0x48ccc8,_0x3d1891){var _0x326116='';var _0x3e8c49=['id',_0x9c1a('0x2b'),_0x9c1a('0x58'),_0x9c1a('0x59'),_0x9c1a('0x5a'),_0x9c1a('0x5b'),_0x9c1a('0x5c'),_0x9c1a('0x5d'),_0x9c1a('0x5e'),_0x9c1a('0x5f'),_0x9c1a('0x60'),_0x9c1a('0x61')];return db[_0x9c1a('0x2e')][_0x9c1a('0x4d')]({'where':{'id':_0x4be818[_0x9c1a('0x41')]['id']},'attributes':['id',_0x9c1a('0x62'),'password','remoteUri']})[_0x9c1a('0x25')](handleEntityNotFound(_0x48ccc8,null))[_0x9c1a('0x25')](function(_0xf3c5aa){if(_0xf3c5aa){_0x326116=_0xf3c5aa[_0x9c1a('0x63')];var _0xa5a3d0=_0x326116[_0x9c1a('0x64')](-0x1);if(_0xa5a3d0==='/'){_0x326116=_0x326116[_0x9c1a('0x65')](0x0,_0x326116[_0x9c1a('0x66')](_0xa5a3d0));}return rp({'method':_0x9c1a('0x67'),'uri':util[_0x9c1a('0x68')]('%s%s',_0x326116,_0x9c1a('0x69')),'json':!![],'form':{'method':_0x9c1a('0x6a'),'input_type':_0x9c1a('0x6b'),'response_type':_0x9c1a('0x6b'),'rest_data':JSON[_0x9c1a('0x6c')]({'user_auth':{'user_name':_0xf3c5aa[_0x9c1a('0x62')],'password':_0xf3c5aa['password'],'encryption':'PLAIN'},'application':_0x9c1a('0x6d')})}});}})[_0x9c1a('0x25')](function(_0x2f25af){if(_0x2f25af&&_0x2f25af[_0x9c1a('0x2b')]!==_0x9c1a('0x6e')&&_0x2f25af[_0x9c1a('0x2b')]!==_0x9c1a('0x6f')){return rp({'method':_0x9c1a('0x67'),'uri':util[_0x9c1a('0x68')](_0x9c1a('0x70'),_0x326116,_0x9c1a('0x69')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x9c1a('0x6b'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2f25af['id'],'module_name':_0x9c1a('0x71')})}})[_0x9c1a('0x25')](function(_0x36809a){if(_0x36809a){var _0x464973=_[_0x9c1a('0x72')](_0x36809a[_0x9c1a('0x73')]);_[_0x9c1a('0x74')](_0x464973,function(_0x4061b1){return _0x3e8c49[_0x9c1a('0x75')](_0x4061b1[_0x9c1a('0x2b')]);});return{'count':_0x464973['length'],'rows':_[_0x9c1a('0x2d')](_0x464973,function(_0x197907){return{'id':_0x197907[_0x9c1a('0x2b')],'name':_0x197907[_0x9c1a('0x76')],'custom':_[_0x9c1a('0x77')](_0x197907[_0x9c1a('0x2b')],'_c')?!![]:![],'options':_0x197907[_0x9c1a('0x47')]?_['map'](_['values'](_0x197907['options']),function(_0x584bb5){return{'name':_0x584bb5[_0x9c1a('0x78')],'value':_0x584bb5[_0x9c1a('0x2b')]};}):[]};})};}})[_0x9c1a('0x25')](respondWithResult(_0x48ccc8,null))[_0x9c1a('0x49')](function(_0x4ca2e6){var _0x208510=_0x4be818['query'][_0x9c1a('0x79')]?0x1f4:_0x4ca2e6[_0x9c1a('0x7a')]||0x1f4;logger[_0x9c1a('0x29')](_0x9c1a('0x7b'),_0x9c1a('0x57'),_0x208510,JSON[_0x9c1a('0x6c')](_0x4ca2e6));delete _0x4ca2e6[_0x9c1a('0x2b')];if(_0x208510===0x191){_0x208510=0x190;}_0x48ccc8[_0x9c1a('0x1a')](_0x208510)[_0x9c1a('0x7c')](_0x4be818[_0x9c1a('0x33')]['test']?{'message':_0x9c1a('0x7d'),'statusCode':_0x4ca2e6['statusCode']}:_0x4ca2e6);});}else{var _0x3bb6ce=0x1f4;_0x48ccc8[_0x9c1a('0x1a')](_0x3bb6ce)[_0x9c1a('0x7c')]({'message':_0x9c1a('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xfdd7=['order','options','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','POST','format','get_module_fields','stringify','Calls','values','remove','includes','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','create','body','params','find','getConfigurations','findOne','keys','SugarcrmConfiguration'];(function(_0x4f0f8c,_0x3564b2){var _0x341332=function(_0x4b96c0){while(--_0x4b96c0){_0x4f0f8c['push'](_0x4f0f8c['shift']());}};_0x341332(++_0x3564b2);}(_0xfdd7,0xa3));var _0x7fdd=function(_0x31f05e,_0x1dfa00){_0x31f05e=_0x31f05e-0x0;var _0x27ae4a=_0xfdd7[_0x31f05e];return _0x27ae4a;};'use strict';var emlformat=require(_0x7fdd('0x0'));var rimraf=require(_0x7fdd('0x1'));var zipdir=require(_0x7fdd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fdd('0x3'));var moment=require(_0x7fdd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7fdd('0x5'));var util=require(_0x7fdd('0x6'));var path=require(_0x7fdd('0x7'));var sox=require(_0x7fdd('0x8'));var csv=require(_0x7fdd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fdd('0xa'));var _=require(_0x7fdd('0xb'));var squel=require(_0x7fdd('0xc'));var crypto=require('crypto');var jsforce=require(_0x7fdd('0xd'));var deskjs=require(_0x7fdd('0xe'));var toCsv=require(_0x7fdd('0x9'));var querystring=require(_0x7fdd('0xf'));var Papa=require(_0x7fdd('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fdd('0x11'));var as=require(_0x7fdd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fdd('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x7fdd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fdd('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xddbda6,_0x17a502){_0x17a502=_0x17a502||0xcc;return function(_0x5142ef){if(_0x5142ef){return _0xddbda6[_0x7fdd('0x16')](_0x17a502);}return _0xddbda6[_0x7fdd('0x17')](_0x17a502)[_0x7fdd('0x18')]();};}function respondWithResult(_0x1f5dc7,_0xf6c166){_0xf6c166=_0xf6c166||0xc8;return function(_0x3cf7da){if(_0x3cf7da){return _0x1f5dc7[_0x7fdd('0x17')](_0xf6c166)[_0x7fdd('0x19')](_0x3cf7da);}};}function respondWithFilteredResult(_0x4db9cb,_0x552a8f){return function(_0x455ae5){if(_0x455ae5){var _0x50c7a2=typeof _0x552a8f[_0x7fdd('0x1a')]===_0x7fdd('0x1b')&&typeof _0x552a8f['limit']===_0x7fdd('0x1b');var _0x59d9c2=_0x455ae5[_0x7fdd('0x1c')];var _0x3f1d12=_0x50c7a2?0x0:_0x552a8f[_0x7fdd('0x1a')];var _0x316f11=_0x50c7a2?_0x455ae5[_0x7fdd('0x1c')]:_0x552a8f[_0x7fdd('0x1a')]+_0x552a8f[_0x7fdd('0x1d')];var _0x4b39d9;if(_0x316f11>=_0x59d9c2){_0x316f11=_0x59d9c2;_0x4b39d9=0xc8;}else{_0x4b39d9=0xce;}_0x4db9cb[_0x7fdd('0x17')](_0x4b39d9);return _0x4db9cb['set'](_0x7fdd('0x1e'),_0x3f1d12+'-'+_0x316f11+'/'+_0x59d9c2)[_0x7fdd('0x19')](_0x455ae5);}return null;};}function patchUpdates(_0xb369b5){return function(_0x424563){try{jsonpatch[_0x7fdd('0x1f')](_0x424563,_0xb369b5,!![]);}catch(_0x551e4d){return BPromise[_0x7fdd('0x20')](_0x551e4d);}return _0x424563[_0x7fdd('0x21')]();};}function saveUpdates(_0x19bfd6,_0x576cae){return function(_0x3ee708){if(_0x3ee708){return _0x3ee708[_0x7fdd('0x22')](_0x19bfd6)[_0x7fdd('0x23')](function(_0x3c2f9c){return _0x3c2f9c;});}return null;};}function removeEntity(_0x40fd43,_0x137b23){return function(_0xa9ee88){if(_0xa9ee88){return _0xa9ee88[_0x7fdd('0x24')]()[_0x7fdd('0x23')](function(){_0x40fd43[_0x7fdd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d601f,_0x3b4fbc){return function(_0x526ac0){if(!_0x526ac0){_0x2d601f['sendStatus'](0x194);}return _0x526ac0;};}function handleError(_0x1ebcfb,_0x26f1bb){_0x26f1bb=_0x26f1bb||0x1f4;return function(_0xf6cbc5){logger['error'](_0xf6cbc5[_0x7fdd('0x25')]);if(_0xf6cbc5[_0x7fdd('0x26')]){delete _0xf6cbc5[_0x7fdd('0x26')];}_0x1ebcfb['status'](_0x26f1bb)[_0x7fdd('0x27')](_0xf6cbc5);};}exports[_0x7fdd('0x28')]=function(_0x4a1f52,_0x5f2b2b){var _0x1a3292={},_0x10d29d={},_0x109f02={'count':0x0,'rows':[]};var _0x4c8ecc=_[_0x7fdd('0x29')](db[_0x7fdd('0x2a')][_0x7fdd('0x2b')],function(_0x311bc7){return{'name':_0x311bc7['fieldName'],'type':_0x311bc7[_0x7fdd('0x2c')][_0x7fdd('0x2d')]};});_0x10d29d[_0x7fdd('0x2e')]=_[_0x7fdd('0x29')](_0x4c8ecc,_0x7fdd('0x26'));_0x10d29d[_0x7fdd('0x2f')]=_['keys'](_0x4a1f52[_0x7fdd('0x2f')]);_0x10d29d[_0x7fdd('0x30')]=_[_0x7fdd('0x31')](_0x10d29d[_0x7fdd('0x2e')],_0x10d29d[_0x7fdd('0x2f')]);_0x1a3292[_0x7fdd('0x32')]=_[_0x7fdd('0x31')](_0x10d29d[_0x7fdd('0x2e')],qs['fields'](_0x4a1f52[_0x7fdd('0x2f')][_0x7fdd('0x33')]));_0x1a3292[_0x7fdd('0x32')]=_0x1a3292[_0x7fdd('0x32')][_0x7fdd('0x34')]?_0x1a3292['attributes']:_0x10d29d[_0x7fdd('0x2e')];if(!_0x4a1f52['query'][_0x7fdd('0x35')](_0x7fdd('0x36'))){_0x1a3292['limit']=qs['limit'](_0x4a1f52[_0x7fdd('0x2f')][_0x7fdd('0x1d')]);_0x1a3292['offset']=qs['offset'](_0x4a1f52[_0x7fdd('0x2f')]['offset']);}_0x1a3292['order']=qs[_0x7fdd('0x37')](_0x4a1f52[_0x7fdd('0x2f')][_0x7fdd('0x37')]);_0x1a3292['where']=qs['filters'](_[_0x7fdd('0x38')](_0x4a1f52[_0x7fdd('0x2f')],_0x10d29d[_0x7fdd('0x30')]),_0x4c8ecc);if(_0x4a1f52[_0x7fdd('0x2f')][_0x7fdd('0x39')]){_0x1a3292[_0x7fdd('0x3a')]=_[_0x7fdd('0x3b')](_0x1a3292[_0x7fdd('0x3a')],{'$or':_[_0x7fdd('0x29')](_0x4c8ecc,function(_0x35d1f1){if(_0x35d1f1[_0x7fdd('0x2c')]!==_0x7fdd('0x3c')){var _0x5da227={};_0x5da227[_0x35d1f1['name']]={'$like':'%'+_0x4a1f52['query']['filter']+'%'};return _0x5da227;}})});}_0x1a3292=_['merge']({},_0x1a3292,_0x4a1f52['options']);var _0x227bbc={'where':_0x1a3292['where']};return db[_0x7fdd('0x2a')]['count'](_0x227bbc)[_0x7fdd('0x23')](function(_0x39c584){_0x109f02['count']=_0x39c584;if(_0x4a1f52[_0x7fdd('0x2f')][_0x7fdd('0x3d')]){_0x1a3292[_0x7fdd('0x3e')]=[{'all':!![]}];}return db[_0x7fdd('0x2a')][_0x7fdd('0x3f')](_0x1a3292);})['then'](function(_0x598698){_0x109f02[_0x7fdd('0x40')]=_0x598698;return _0x109f02;})[_0x7fdd('0x23')](respondWithFilteredResult(_0x5f2b2b,_0x1a3292))[_0x7fdd('0x41')](handleError(_0x5f2b2b,null));};exports[_0x7fdd('0x42')]=function(_0x50f5fa,_0xe17ba8){var _0x472653={'raw':![],'where':{'id':_0x50f5fa['params']['id']}},_0x6b1acd={};_0x6b1acd[_0x7fdd('0x2e')]=_['keys'](db['SugarcrmAccount'][_0x7fdd('0x2b')]);_0x6b1acd[_0x7fdd('0x2f')]=_['keys'](_0x50f5fa['query']);_0x6b1acd['filters']=_[_0x7fdd('0x31')](_0x6b1acd[_0x7fdd('0x2e')],_0x6b1acd['query']);_0x472653[_0x7fdd('0x32')]=_['intersection'](_0x6b1acd[_0x7fdd('0x2e')],qs[_0x7fdd('0x33')](_0x50f5fa['query'][_0x7fdd('0x33')]));_0x472653[_0x7fdd('0x32')]=_0x472653['attributes']['length']?_0x472653[_0x7fdd('0x32')]:_0x6b1acd[_0x7fdd('0x2e')];if(_0x50f5fa['query']['includeAll']){_0x472653[_0x7fdd('0x3e')]=[{'all':!![]}];}_0x472653=_['merge']({},_0x472653,_0x50f5fa['options']);return db[_0x7fdd('0x2a')]['find'](_0x472653)[_0x7fdd('0x23')](handleEntityNotFound(_0xe17ba8,null))[_0x7fdd('0x23')](respondWithResult(_0xe17ba8,null))[_0x7fdd('0x41')](handleError(_0xe17ba8,null));};exports[_0x7fdd('0x43')]=function(_0x4f81fc,_0x17fe4a){return db['SugarcrmAccount'][_0x7fdd('0x43')](_0x4f81fc[_0x7fdd('0x44')],{})[_0x7fdd('0x23')](respondWithResult(_0x17fe4a,0xc9))[_0x7fdd('0x41')](handleError(_0x17fe4a,null));};exports[_0x7fdd('0x22')]=function(_0x2f061d,_0x2bc9be){if(_0x2f061d[_0x7fdd('0x44')]['id']){delete _0x2f061d['body']['id'];}return db[_0x7fdd('0x2a')]['find']({'where':{'id':_0x2f061d[_0x7fdd('0x45')]['id']}})[_0x7fdd('0x23')](handleEntityNotFound(_0x2bc9be,null))[_0x7fdd('0x23')](saveUpdates(_0x2f061d[_0x7fdd('0x44')],null))[_0x7fdd('0x23')](respondWithResult(_0x2bc9be,null))[_0x7fdd('0x41')](handleError(_0x2bc9be,null));};exports['destroy']=function(_0x25d9da,_0xd4b65){return db[_0x7fdd('0x2a')][_0x7fdd('0x46')]({'where':{'id':_0x25d9da[_0x7fdd('0x45')]['id']}})[_0x7fdd('0x23')](handleEntityNotFound(_0xd4b65,null))[_0x7fdd('0x23')](removeEntity(_0xd4b65,null))[_0x7fdd('0x41')](handleError(_0xd4b65,null));};exports[_0x7fdd('0x47')]=function(_0xac7c59,_0x17a4d7,_0x5579ef){var _0xb5b71={};var _0xd0fe4e={};var _0x3240f2;var _0x20c062;return db[_0x7fdd('0x2a')][_0x7fdd('0x48')]({'where':{'id':_0xac7c59[_0x7fdd('0x45')]['id']}})['then'](handleEntityNotFound(_0x17a4d7,null))['then'](function(_0x4af316){if(_0x4af316){_0x3240f2=_0x4af316;_0xd0fe4e[_0x7fdd('0x2e')]=_[_0x7fdd('0x49')](db[_0x7fdd('0x4a')][_0x7fdd('0x2b')]);_0xd0fe4e[_0x7fdd('0x2f')]=_[_0x7fdd('0x49')](_0xac7c59['query']);_0xd0fe4e['filters']=_[_0x7fdd('0x31')](_0xd0fe4e[_0x7fdd('0x2e')],_0xd0fe4e['query']);_0xb5b71['attributes']=_[_0x7fdd('0x31')](_0xd0fe4e[_0x7fdd('0x2e')],qs[_0x7fdd('0x33')](_0xac7c59[_0x7fdd('0x2f')]['fields']));_0xb5b71['attributes']=_0xb5b71['attributes'][_0x7fdd('0x34')]?_0xb5b71[_0x7fdd('0x32')]:_0xd0fe4e[_0x7fdd('0x2e')];_0xb5b71[_0x7fdd('0x4b')]=qs[_0x7fdd('0x37')](_0xac7c59[_0x7fdd('0x2f')][_0x7fdd('0x37')]);_0xb5b71[_0x7fdd('0x3a')]=qs[_0x7fdd('0x30')](_[_0x7fdd('0x38')](_0xac7c59[_0x7fdd('0x2f')],_0xd0fe4e[_0x7fdd('0x30')]));if(_0xac7c59['query'][_0x7fdd('0x39')]){_0xb5b71['where']=_['merge'](_0xb5b71[_0x7fdd('0x3a')],{'$or':_[_0x7fdd('0x29')](_0xb5b71['attributes'],function(_0x48df25){var _0x43d76d={};_0x43d76d[_0x48df25]={'$like':'%'+_0xac7c59[_0x7fdd('0x2f')]['filter']+'%'};return _0x43d76d;})});}_0xb5b71=_[_0x7fdd('0x3b')]({},_0xb5b71,_0xac7c59[_0x7fdd('0x4c')]);return _0x3240f2[_0x7fdd('0x47')](_0xb5b71);}})[_0x7fdd('0x23')](function(_0x57817b){if(_0x57817b){_0x20c062=_0x57817b[_0x7fdd('0x34')];if(!_0xac7c59[_0x7fdd('0x2f')][_0x7fdd('0x35')](_0x7fdd('0x36'))){_0xb5b71[_0x7fdd('0x1d')]=qs[_0x7fdd('0x1d')](_0xac7c59[_0x7fdd('0x2f')]['limit']);_0xb5b71['offset']=qs[_0x7fdd('0x1a')](_0xac7c59[_0x7fdd('0x2f')][_0x7fdd('0x1a')]);}return _0x3240f2[_0x7fdd('0x47')](_0xb5b71);}})[_0x7fdd('0x23')](function(_0x17b88d){if(_0x17b88d){return _0x17b88d?{'count':_0x20c062,'rows':_0x17b88d}:null;}})[_0x7fdd('0x23')](respondWithResult(_0x17a4d7,null))[_0x7fdd('0x41')](handleError(_0x17a4d7,null));};exports[_0x7fdd('0x4d')]=function(_0x1eef6e,_0x4739d9,_0x439fe9){if(_0x1eef6e['body']['id']){delete _0x1eef6e[_0x7fdd('0x44')]['id'];}return db[_0x7fdd('0x2a')][_0x7fdd('0x48')]({'where':{'id':_0x1eef6e[_0x7fdd('0x45')]['id']}})[_0x7fdd('0x23')](handleEntityNotFound(_0x4739d9,null))[_0x7fdd('0x23')](function(_0x3339ca){if(_0x3339ca){_0x1eef6e[_0x7fdd('0x44')][_0x7fdd('0x4e')]=_0x3339ca['id'];_0x1eef6e[_0x7fdd('0x44')][_0x7fdd('0x4f')]=integrations['getSubjects'](_0x1eef6e[_0x7fdd('0x44')][_0x7fdd('0x50')],_0x1eef6e[_0x7fdd('0x44')][_0x7fdd('0x2c')]);_0x1eef6e['body'][_0x7fdd('0x51')]=integrations[_0x7fdd('0x52')](_0x1eef6e[_0x7fdd('0x44')][_0x7fdd('0x50')],_0x1eef6e[_0x7fdd('0x44')][_0x7fdd('0x2c')]);return db['SugarcrmConfiguration'][_0x7fdd('0x43')](_0x1eef6e[_0x7fdd('0x44')],{'include':[{'model':db[_0x7fdd('0x53')],'as':_0x7fdd('0x4f')},{'model':db['SugarcrmField'],'as':_0x7fdd('0x51')}]});}return null;})[_0x7fdd('0x23')](respondWithResult(_0x4739d9,null))[_0x7fdd('0x41')](handleError(_0x4739d9,null));};exports[_0x7fdd('0x54')]=function(_0x3e6dfb,_0x3099cc,_0x21eb6f){var _0x163e07='';var _0x463c41=['id',_0x7fdd('0x26'),'assigned_user_id',_0x7fdd('0x55'),_0x7fdd('0x56'),'date_start',_0x7fdd('0x57'),_0x7fdd('0x58'),_0x7fdd('0x59'),'parent_type',_0x7fdd('0x5a'),_0x7fdd('0x5b')];return db[_0x7fdd('0x2a')]['findOne']({'where':{'id':_0x3e6dfb[_0x7fdd('0x45')]['id']},'attributes':['id',_0x7fdd('0x5c'),_0x7fdd('0x5d'),_0x7fdd('0x5e')]})[_0x7fdd('0x23')](handleEntityNotFound(_0x3099cc,null))[_0x7fdd('0x23')](function(_0x502027){if(_0x502027){_0x163e07=_0x502027[_0x7fdd('0x5e')];var _0x4cc57d=_0x163e07[_0x7fdd('0x5f')](-0x1);if(_0x4cc57d==='/'){_0x163e07=_0x163e07[_0x7fdd('0x60')](0x0,_0x163e07[_0x7fdd('0x61')](_0x4cc57d));}return rp({'method':'POST','uri':util['format'](_0x7fdd('0x62'),_0x163e07,_0x7fdd('0x63')),'json':!![],'form':{'method':_0x7fdd('0x64'),'input_type':_0x7fdd('0x65'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x502027[_0x7fdd('0x5c')],'password':_0x502027[_0x7fdd('0x5d')],'encryption':_0x7fdd('0x66')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x24a120){if(_0x24a120&&_0x24a120['name']!==_0x7fdd('0x67')&&_0x24a120['name']!==_0x7fdd('0x68')){return rp({'method':_0x7fdd('0x69'),'uri':util[_0x7fdd('0x6a')]('%s%s',_0x163e07,_0x7fdd('0x63')),'json':!![],'form':{'method':_0x7fdd('0x6b'),'input_type':_0x7fdd('0x65'),'response_type':_0x7fdd('0x65'),'rest_data':JSON[_0x7fdd('0x6c')]({'session':_0x24a120['id'],'module_name':_0x7fdd('0x6d')})}})[_0x7fdd('0x23')](function(_0x2181ca){if(_0x2181ca){var _0x4fdda1=_[_0x7fdd('0x6e')](_0x2181ca['module_fields']);_[_0x7fdd('0x6f')](_0x4fdda1,function(_0x2dcb15){return _0x463c41[_0x7fdd('0x70')](_0x2dcb15[_0x7fdd('0x26')]);});return{'count':_0x4fdda1[_0x7fdd('0x34')],'rows':_[_0x7fdd('0x29')](_0x4fdda1,function(_0x4d9e48){return{'id':_0x4d9e48[_0x7fdd('0x26')],'name':_0x4d9e48[_0x7fdd('0x71')],'custom':_['endsWith'](_0x4d9e48[_0x7fdd('0x26')],'_c')?!![]:![],'options':_0x4d9e48[_0x7fdd('0x4c')]?_[_0x7fdd('0x29')](_[_0x7fdd('0x6e')](_0x4d9e48['options']),function(_0x3b2069){return{'name':_0x3b2069['value'],'value':_0x3b2069[_0x7fdd('0x26')]};}):[]};})};}})[_0x7fdd('0x23')](respondWithResult(_0x3099cc,null))[_0x7fdd('0x41')](function(_0xaa2e1f){var _0x4c0973=_0x3e6dfb[_0x7fdd('0x2f')][_0x7fdd('0x72')]?0x1f4:_0xaa2e1f[_0x7fdd('0x73')]||0x1f4;logger[_0x7fdd('0x74')](_0x7fdd('0x75'),_0x7fdd('0x54'),_0x4c0973,JSON[_0x7fdd('0x6c')](_0xaa2e1f));delete _0xaa2e1f[_0x7fdd('0x26')];if(_0x4c0973===0x191){_0x4c0973=0x190;}_0x3099cc['status'](_0x4c0973)[_0x7fdd('0x27')](_0x3e6dfb[_0x7fdd('0x2f')][_0x7fdd('0x72')]?{'message':_0x7fdd('0x76'),'statusCode':_0xaa2e1f[_0x7fdd('0x73')]}:_0xaa2e1f);});}else{var _0x1481db=0x1f4;_0x3099cc[_0x7fdd('0x17')](_0x1481db)[_0x7fdd('0x27')]({'message':_0x7fdd('0x76'),'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 ee24e1d..65e7e3c 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 _0x06e6=['util','../../config/logger','api','bluebird','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x3116d6,_0x2d574f){var _0x18729d=function(_0x1945a0){while(--_0x1945a0){_0x3116d6['push'](_0x3116d6['shift']());}};_0x18729d(++_0x2d574f);}(_0x06e6,0x167));var _0x606e=function(_0x1bff41,_0x386880){_0x1bff41=_0x1bff41-0x0;var _0x4db66b=_0x06e6[_0x1bff41];return _0x4db66b;};'use strict';var _=require(_0x606e('0x0'));var util=require(_0x606e('0x1'));var logger=require(_0x606e('0x2'))(_0x606e('0x3'));var moment=require('moment');var BPromise=require(_0x606e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x606e('0x5'));var config=require('../../config/environment');var attributes=require(_0x606e('0x6'));var integrations=require(_0x606e('0x7'));module[_0x606e('0x8')]=function(_0x58176a,_0x3e5bf6){return _0x58176a[_0x606e('0x9')](_0x606e('0xa'),attributes,{'tableName':_0x606e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1ad=['../../config/logger','api','moment','bluebird','request-promise','../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util'];(function(_0x36c166,_0x2ce3b0){var _0x22b6d2=function(_0x20842e){while(--_0x20842e){_0x36c166['push'](_0x36c166['shift']());}};_0x22b6d2(++_0x2ce3b0);}(_0xe1ad,0x13d));var _0xde1a=function(_0x3cc59e,_0x1942a4){_0x3cc59e=_0x3cc59e-0x0;var _0x2e03db=_0xe1ad[_0x3cc59e];return _0x2e03db;};'use strict';var _=require(_0xde1a('0x0'));var util=require(_0xde1a('0x1'));var logger=require(_0xde1a('0x2'))(_0xde1a('0x3'));var moment=require(_0xde1a('0x4'));var BPromise=require(_0xde1a('0x5'));var rp=require(_0xde1a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xde1a('0x7'));module[_0xde1a('0x8')]=function(_0x167470,_0x55bf0b){return _0x167470[_0xde1a('0x9')](_0xde1a('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','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 a8ad851..021d9dd 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 _0xb201=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','util','bluebird'];(function(_0x1f6db9,_0x5753d4){var _0x12f7d9=function(_0x1db1dc){while(--_0x1db1dc){_0x1f6db9['push'](_0x1f6db9['shift']());}};_0x12f7d9(++_0x5753d4);}(_0xb201,0x1aa));var _0x1b20=function(_0x40862f,_0x167e34){_0x40862f=_0x40862f-0x0;var _0x5efc00=_0xb201[_0x40862f];return _0x5efc00;};'use strict';var _=require(_0x1b20('0x0'));var util=require(_0x1b20('0x1'));var moment=require('moment');var BPromise=require(_0x1b20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b20('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b20('0x4'));var logger=require(_0x1b20('0x5'))(_0x1b20('0x6'));var config=require(_0x1b20('0x7'));var jayson=require(_0x1b20('0x8'));var client=jayson[_0x1b20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x374c35,_0x50417a,_0x5ef38a){return new BPromise(function(_0x51ceb3,_0x5b984a){return client['request'](_0x374c35,_0x5ef38a)[_0x1b20('0xa')](function(_0x57cf3e){logger[_0x1b20('0xb')](_0x1b20('0xc'),_0x50417a,_0x1b20('0xd'));logger[_0x1b20('0xe')](_0x1b20('0xf'),_0x50417a,_0x1b20('0xd'),JSON[_0x1b20('0x10')](_0x57cf3e));if(_0x57cf3e['error']){if(_0x57cf3e['error']['code']===0x1f4){logger[_0x1b20('0x11')](_0x1b20('0xc'),_0x50417a,_0x57cf3e[_0x1b20('0x11')][_0x1b20('0x12')]);return _0x5b984a(_0x57cf3e[_0x1b20('0x11')]['message']);}logger[_0x1b20('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x50417a,_0x57cf3e[_0x1b20('0x11')]['message']);return _0x51ceb3(_0x57cf3e['error'][_0x1b20('0x12')]);}else{logger['info'](_0x1b20('0xc'),_0x50417a,'request\x20sent');_0x51ceb3(_0x57cf3e[_0x1b20('0x13')][_0x1b20('0x12')]);}})[_0x1b20('0x14')](function(_0x5a96b8){logger[_0x1b20('0x11')](_0x1b20('0xc'),_0x50417a,_0x5a96b8);_0x5b984a(_0x5a96b8);});});}exports[_0x1b20('0x15')]=function(_0x3a651c){var _0x53145e=this;return new Promise(function(_0xccbb99,_0x3f2948){return db[_0x1b20('0x16')][_0x1b20('0x17')]({'raw':_0x3a651c[_0x1b20('0x18')]?_0x3a651c[_0x1b20('0x18')][_0x1b20('0x19')]===undefined?!![]:![]:!![],'where':_0x3a651c[_0x1b20('0x18')]?_0x3a651c['options']['where']||null:null,'attributes':_0x3a651c[_0x1b20('0x18')]?_0x3a651c[_0x1b20('0x18')][_0x1b20('0x1a')]||null:null,'limit':_0x3a651c[_0x1b20('0x18')]?_0x3a651c[_0x1b20('0x18')][_0x1b20('0x1b')]||null:null,'include':_0x3a651c['options']?_0x3a651c['options'][_0x1b20('0x1c')]?_[_0x1b20('0x1d')](_0x3a651c['options']['include'],function(_0xe9127b){return{'model':db[_0xe9127b[_0x1b20('0x1e')]],'as':_0xe9127b['as'],'attributes':_0xe9127b[_0x1b20('0x1a')],'include':_0xe9127b['include']?_[_0x1b20('0x1d')](_0xe9127b['include'],function(_0xe0490f){return{'model':db[_0xe0490f[_0x1b20('0x1e')]],'as':_0xe0490f['as'],'attributes':_0xe0490f['attributes'],'include':_0xe0490f[_0x1b20('0x1c')]?_[_0x1b20('0x1d')](_0xe0490f[_0x1b20('0x1c')],function(_0x22a3e3){return{'model':db[_0x22a3e3['model']],'as':_0x22a3e3['as'],'attributes':_0x22a3e3[_0x1b20('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1b20('0xa')](function(_0x5da57f){logger[_0x1b20('0xb')]('GetSugarcrmAccount',_0x3a651c);logger['debug']('GetSugarcrmAccount',_0x3a651c,JSON[_0x1b20('0x10')](_0x5da57f));_0xccbb99(_0x5da57f);})['catch'](function(_0x14def3){logger[_0x1b20('0x11')](_0x1b20('0x15'),_0x14def3[_0x1b20('0x12')],_0x3a651c);_0x3f2948(_0x53145e['error'](0x1f4,_0x14def3[_0x1b20('0x12')]));});});};exports[_0x1b20('0x1f')]=function(_0x500c3b){var _0x3e152e=this;return new Promise(function(_0x51ead7,_0x3404eb){return db[_0x1b20('0x16')][_0x1b20('0x20')]({'raw':_0x500c3b['options']?_0x500c3b[_0x1b20('0x18')][_0x1b20('0x19')]===undefined?!![]:![]:!![],'where':_0x500c3b[_0x1b20('0x18')]?_0x500c3b[_0x1b20('0x18')]['where']||null:null,'attributes':_0x500c3b[_0x1b20('0x18')]?_0x500c3b[_0x1b20('0x18')][_0x1b20('0x1a')]||null:null,'include':_0x500c3b[_0x1b20('0x18')]?_0x500c3b[_0x1b20('0x18')][_0x1b20('0x1c')]?_[_0x1b20('0x1d')](_0x500c3b[_0x1b20('0x18')][_0x1b20('0x1c')],function(_0xbfe715){return{'model':db[_0xbfe715[_0x1b20('0x1e')]],'as':_0xbfe715['as'],'attributes':_0xbfe715[_0x1b20('0x1a')],'include':_0xbfe715[_0x1b20('0x1c')]?_[_0x1b20('0x1d')](_0xbfe715[_0x1b20('0x1c')],function(_0x3e14e8){return{'model':db[_0x3e14e8['model']],'as':_0x3e14e8['as'],'attributes':_0x3e14e8[_0x1b20('0x1a')],'include':_0x3e14e8[_0x1b20('0x1c')]?_[_0x1b20('0x1d')](_0x3e14e8[_0x1b20('0x1c')],function(_0x2c824f){return{'model':db[_0x2c824f[_0x1b20('0x1e')]],'as':_0x2c824f['as'],'attributes':_0x2c824f[_0x1b20('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1b20('0xa')](function(_0x42d1e7){logger[_0x1b20('0xb')]('ShowSugarcrmAccount',_0x500c3b);logger[_0x1b20('0xe')](_0x1b20('0x1f'),_0x500c3b,JSON['stringify'](_0x42d1e7));_0x51ead7(_0x42d1e7);})[_0x1b20('0x14')](function(_0x206086){logger[_0x1b20('0x11')]('ShowSugarcrmAccount',_0x206086['message'],_0x500c3b);_0x3404eb(_0x3e152e[_0x1b20('0x11')](0x1f4,_0x206086[_0x1b20('0x12')]));});});}; \ No newline at end of file +var _0x2854=['client','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SugarcrmAccount,\x20%s,\x20%s','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowSugarcrmAccount','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x515da8,_0x3b69d2){var _0x10da36=function(_0x50e50b){while(--_0x50e50b){_0x515da8['push'](_0x515da8['shift']());}};_0x10da36(++_0x3b69d2);}(_0x2854,0xc3));var _0x4285=function(_0x152743,_0x4aa448){_0x152743=_0x152743-0x0;var _0x4febb7=_0x2854[_0x152743];return _0x4febb7;};'use strict';var _=require('lodash');var util=require(_0x4285('0x0'));var moment=require(_0x4285('0x1'));var BPromise=require(_0x4285('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4285('0x3'));var db=require(_0x4285('0x4'))['db'];var utils=require(_0x4285('0x5'));var logger=require(_0x4285('0x6'))('rpc');var config=require(_0x4285('0x7'));var jayson=require(_0x4285('0x8'));var client=jayson[_0x4285('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4659b8,_0x5ea88f,_0x392ffd){return new BPromise(function(_0x3c3576,_0x56f707){return client[_0x4285('0xa')](_0x4659b8,_0x392ffd)[_0x4285('0xb')](function(_0x12fce7){logger[_0x4285('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x5ea88f,_0x4285('0xd'));logger[_0x4285('0xe')](_0x4285('0xf'),_0x5ea88f,_0x4285('0xd'),JSON[_0x4285('0x10')](_0x12fce7));if(_0x12fce7['error']){if(_0x12fce7['error']['code']===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5ea88f,_0x12fce7[_0x4285('0x11')][_0x4285('0x12')]);return _0x56f707(_0x12fce7[_0x4285('0x11')][_0x4285('0x12')]);}logger[_0x4285('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x5ea88f,_0x12fce7[_0x4285('0x11')][_0x4285('0x12')]);return _0x3c3576(_0x12fce7[_0x4285('0x11')]['message']);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5ea88f,_0x4285('0xd'));_0x3c3576(_0x12fce7[_0x4285('0x13')]['message']);}})[_0x4285('0x14')](function(_0x292a06){logger[_0x4285('0x11')](_0x4285('0x15'),_0x5ea88f,_0x292a06);_0x56f707(_0x292a06);});});}exports[_0x4285('0x16')]=function(_0x175e37){var _0x2e0fec=this;return new Promise(function(_0xb87156,_0x58045c){return db['SugarcrmAccount'][_0x4285('0x17')]({'raw':_0x175e37[_0x4285('0x18')]?_0x175e37[_0x4285('0x18')][_0x4285('0x19')]===undefined?!![]:![]:!![],'where':_0x175e37[_0x4285('0x18')]?_0x175e37[_0x4285('0x18')][_0x4285('0x1a')]||null:null,'attributes':_0x175e37[_0x4285('0x18')]?_0x175e37[_0x4285('0x18')][_0x4285('0x1b')]||null:null,'limit':_0x175e37[_0x4285('0x18')]?_0x175e37[_0x4285('0x18')][_0x4285('0x1c')]||null:null,'include':_0x175e37[_0x4285('0x18')]?_0x175e37[_0x4285('0x18')][_0x4285('0x1d')]?_['map'](_0x175e37[_0x4285('0x18')][_0x4285('0x1d')],function(_0x1756ae){return{'model':db[_0x1756ae[_0x4285('0x1e')]],'as':_0x1756ae['as'],'attributes':_0x1756ae[_0x4285('0x1b')],'include':_0x1756ae[_0x4285('0x1d')]?_[_0x4285('0x1f')](_0x1756ae['include'],function(_0x48555e){return{'model':db[_0x48555e['model']],'as':_0x48555e['as'],'attributes':_0x48555e[_0x4285('0x1b')],'include':_0x48555e[_0x4285('0x1d')]?_[_0x4285('0x1f')](_0x48555e['include'],function(_0x4d2c0e){return{'model':db[_0x4d2c0e[_0x4285('0x1e')]],'as':_0x4d2c0e['as'],'attributes':_0x4d2c0e['attributes']};}):[]};}):[]};}):[]:[]})[_0x4285('0xb')](function(_0x4d1f3d){logger[_0x4285('0xc')](_0x4285('0x16'),_0x175e37);logger[_0x4285('0xe')](_0x4285('0x16'),_0x175e37,JSON['stringify'](_0x4d1f3d));_0xb87156(_0x4d1f3d);})[_0x4285('0x14')](function(_0x59d8f5){logger[_0x4285('0x11')](_0x4285('0x16'),_0x59d8f5['message'],_0x175e37);_0x58045c(_0x2e0fec[_0x4285('0x11')](0x1f4,_0x59d8f5[_0x4285('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x34e149){var _0x375935=this;return new Promise(function(_0x4f719f,_0xbba8c9){return db['SugarcrmAccount'][_0x4285('0x20')]({'raw':_0x34e149[_0x4285('0x18')]?_0x34e149['options'][_0x4285('0x19')]===undefined?!![]:![]:!![],'where':_0x34e149[_0x4285('0x18')]?_0x34e149[_0x4285('0x18')][_0x4285('0x1a')]||null:null,'attributes':_0x34e149[_0x4285('0x18')]?_0x34e149[_0x4285('0x18')]['attributes']||null:null,'include':_0x34e149[_0x4285('0x18')]?_0x34e149['options'][_0x4285('0x1d')]?_['map'](_0x34e149[_0x4285('0x18')]['include'],function(_0x51ea11){return{'model':db[_0x51ea11[_0x4285('0x1e')]],'as':_0x51ea11['as'],'attributes':_0x51ea11[_0x4285('0x1b')],'include':_0x51ea11[_0x4285('0x1d')]?_['map'](_0x51ea11[_0x4285('0x1d')],function(_0x3b2cd8){return{'model':db[_0x3b2cd8['model']],'as':_0x3b2cd8['as'],'attributes':_0x3b2cd8['attributes'],'include':_0x3b2cd8[_0x4285('0x1d')]?_[_0x4285('0x1f')](_0x3b2cd8[_0x4285('0x1d')],function(_0x138d98){return{'model':db[_0x138d98[_0x4285('0x1e')]],'as':_0x138d98['as'],'attributes':_0x138d98[_0x4285('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4285('0xb')](function(_0x3206aa){logger[_0x4285('0xc')](_0x4285('0x21'),_0x34e149);logger[_0x4285('0xe')](_0x4285('0x21'),_0x34e149,JSON[_0x4285('0x10')](_0x3206aa));_0x4f719f(_0x3206aa);})['catch'](function(_0x120dcd){logger[_0x4285('0x11')]('ShowSugarcrmAccount',_0x120dcd[_0x4285('0x12')],_0x34e149);_0xbba8c9(_0x375935['error'](0x1f4,_0x120dcd['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5d3f0a0..0c7e439 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 _0x602d=['getSubjects','/:id/descriptions','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/subjects'];(function(_0x59c294,_0x546ef3){var _0x330ccf=function(_0xe41bd6){while(--_0xe41bd6){_0x59c294['push'](_0x59c294['shift']());}};_0x330ccf(++_0x546ef3);}(_0x602d,0xc3));var _0xd602=function(_0x41a9f5,_0x270018){_0x41a9f5=_0x41a9f5-0x0;var _0x3f1ce8=_0x602d[_0x41a9f5];return _0x3f1ce8;};'use strict';var multer=require(_0xd602('0x0'));var util=require(_0xd602('0x1'));var path=require(_0xd602('0x2'));var timeout=require(_0xd602('0x3'));var express=require(_0xd602('0x4'));var router=express[_0xd602('0x5')]();var fs_extra=require(_0xd602('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd602('0x7'));var config=require(_0xd602('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xd602('0x9')]('/',auth['isAuthenticated'](),controller[_0xd602('0xa')]);router[_0xd602('0x9')](_0xd602('0xb'),auth[_0xd602('0xc')](),controller[_0xd602('0xd')]);router['get']('/:id/fields',auth[_0xd602('0xc')](),controller['getFields']);router['get'](_0xd602('0xe'),auth[_0xd602('0xc')](),controller[_0xd602('0xf')]);router['get'](_0xd602('0x10'),auth[_0xd602('0xc')](),controller['getDescriptions']);router[_0xd602('0x11')]('/',auth[_0xd602('0xc')](),controller['create']);router['put'](_0xd602('0xb'),auth['isAuthenticated'](),controller[_0xd602('0x12')]);router['delete'](_0xd602('0xb'),auth[_0xd602('0xc')](),controller[_0xd602('0x13')]);module[_0xd602('0x14')]=router; \ No newline at end of file +var _0x8580=['../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','exports','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x5738c2,_0x25021f){var _0xc9b259=function(_0x3cb728){while(--_0x3cb728){_0x5738c2['push'](_0x5738c2['shift']());}};_0xc9b259(++_0x25021f);}(_0x8580,0x1c7));var _0x0858=function(_0x53a377,_0x38675b){_0x53a377=_0x53a377-0x0;var _0x4013af=_0x8580[_0x53a377];return _0x4013af;};'use strict';var multer=require('multer');var util=require(_0x0858('0x0'));var path=require('path');var timeout=require(_0x0858('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0858('0x2'));var auth=require(_0x0858('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0858('0x4'));var controller=require(_0x0858('0x5'));router['get']('/',auth[_0x0858('0x6')](),controller[_0x0858('0x7')]);router[_0x0858('0x8')](_0x0858('0x9'),auth['isAuthenticated'](),controller[_0x0858('0xa')]);router[_0x0858('0x8')](_0x0858('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x0858('0x8')]('/:id/subjects',auth[_0x0858('0x6')](),controller[_0x0858('0xc')]);router[_0x0858('0x8')](_0x0858('0xd'),auth[_0x0858('0x6')](),controller[_0x0858('0xe')]);router[_0x0858('0xf')]('/',auth[_0x0858('0x6')](),controller['create']);router['put'](_0x0858('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0858('0x9'),auth[_0x0858('0x6')](),controller['destroy']);module[_0x0858('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 450476d..5a1af3c 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 _0x5359=['sequelize','STRING'];(function(_0x5e87e7,_0x40a96a){var _0x54b69f=function(_0x3bb667){while(--_0x3bb667){_0x5e87e7['push'](_0x5e87e7['shift']());}};_0x54b69f(++_0x40a96a);}(_0x5359,0x12e));var _0x9535=function(_0x382a5b,_0x50eea5){_0x382a5b=_0x382a5b-0x0;var _0x4dcfd3=_0x5359[_0x382a5b];return _0x4dcfd3;};'use strict';var Sequelize=require(_0x9535('0x0'));module['exports']={'name':{'type':Sequelize[_0x9535('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbfc8=['STRING','exports'];(function(_0x39a553,_0x135fc1){var _0x311887=function(_0x45bd88){while(--_0x45bd88){_0x39a553['push'](_0x39a553['shift']());}};_0x311887(++_0x135fc1);}(_0xbfc8,0x14d));var _0x8bfc=function(_0x41ef1f,_0x1e5641){_0x41ef1f=_0x41ef1f-0x0;var _0x8dea59=_0xbfc8[_0x41ef1f];return _0x8dea59;};'use strict';var Sequelize=require('sequelize');module[_0x8bfc('0x0')]={'name':{'type':Sequelize[_0x8bfc('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 0713622..39a3c2d 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 _0x58c5=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','rawAttributes','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','SugarcrmConfiguration','findAll','rows','catch','show','params','keys','find','create','body','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x58c5,0x134));var _0x558c=function(_0x24be78,_0x28ecf3){_0x24be78=_0x24be78-0x0;var _0x4f72be=_0x58c5[_0x24be78];return _0x4f72be;};'use strict';var emlformat=require(_0x558c('0x0'));var rimraf=require(_0x558c('0x1'));var zipdir=require(_0x558c('0x2'));var jsonpatch=require(_0x558c('0x3'));var rp=require('request-promise');var moment=require(_0x558c('0x4'));var BPromise=require(_0x558c('0x5'));var Mustache=require('mustache');var util=require(_0x558c('0x6'));var path=require(_0x558c('0x7'));var sox=require(_0x558c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x558c('0x9'));var _=require('lodash');var squel=require(_0x558c('0xa'));var crypto=require(_0x558c('0xb'));var jsforce=require(_0x558c('0xc'));var deskjs=require(_0x558c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x558c('0xe'));var Papa=require(_0x558c('0xf'));var Redis=require(_0x558c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x558c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x558c('0x12'));var logger=require(_0x558c('0x13'))(_0x558c('0x14'));var utils=require('../../config/utils');var config=require(_0x558c('0x15'));var licenseUtil=require(_0x558c('0x16'));var db=require(_0x558c('0x17'))['db'];function respondWithStatusCode(_0x350f21,_0x54cf91){_0x54cf91=_0x54cf91||0xcc;return function(_0x3b9bea){if(_0x3b9bea){return _0x350f21[_0x558c('0x18')](_0x54cf91);}return _0x350f21[_0x558c('0x19')](_0x54cf91)[_0x558c('0x1a')]();};}function respondWithResult(_0xa39f8,_0x33a232){_0x33a232=_0x33a232||0xc8;return function(_0x2f7119){if(_0x2f7119){return _0xa39f8['status'](_0x33a232)['json'](_0x2f7119);}};}function respondWithFilteredResult(_0x7c9fe,_0x454580){return function(_0x3a4942){if(_0x3a4942){var _0x2c99e9=typeof _0x454580[_0x558c('0x1b')]==='undefined'&&typeof _0x454580[_0x558c('0x1c')]==='undefined';var _0x8ec679=_0x3a4942['count'];var _0x29c8d4=_0x2c99e9?0x0:_0x454580[_0x558c('0x1b')];var _0x1487e9=_0x2c99e9?_0x3a4942[_0x558c('0x1d')]:_0x454580['offset']+_0x454580['limit'];var _0x55c0e6;if(_0x1487e9>=_0x8ec679){_0x1487e9=_0x8ec679;_0x55c0e6=0xc8;}else{_0x55c0e6=0xce;}_0x7c9fe[_0x558c('0x19')](_0x55c0e6);return _0x7c9fe[_0x558c('0x1e')](_0x558c('0x1f'),_0x29c8d4+'-'+_0x1487e9+'/'+_0x8ec679)[_0x558c('0x20')](_0x3a4942);}return null;};}function patchUpdates(_0x49aa6a){return function(_0x745d73){try{jsonpatch[_0x558c('0x21')](_0x745d73,_0x49aa6a,!![]);}catch(_0x5c3dca){return BPromise[_0x558c('0x22')](_0x5c3dca);}return _0x745d73['save']();};}function saveUpdates(_0x6886a6,_0x2acce6){return function(_0x559038){if(_0x559038){return _0x559038[_0x558c('0x23')](_0x6886a6)[_0x558c('0x24')](function(_0x3bf587){return _0x3bf587;});}return null;};}function removeEntity(_0x3460b7,_0x226d6a){return function(_0x489c78){if(_0x489c78){return _0x489c78[_0x558c('0x25')]()[_0x558c('0x24')](function(){_0x3460b7[_0x558c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36f260,_0x55ee8f){return function(_0x5f551f){if(!_0x5f551f){_0x36f260[_0x558c('0x18')](0x194);}return _0x5f551f;};}function handleError(_0x2cb86b,_0x30b8e1){_0x30b8e1=_0x30b8e1||0x1f4;return function(_0x4a09ec){logger[_0x558c('0x26')](_0x4a09ec[_0x558c('0x27')]);if(_0x4a09ec[_0x558c('0x28')]){delete _0x4a09ec['name'];}_0x2cb86b[_0x558c('0x19')](_0x30b8e1)['send'](_0x4a09ec);};}exports[_0x558c('0x29')]=function(_0x37b1f6,_0x39d570){var _0x1a987d={},_0x1311fd={},_0x58f8f8={'count':0x0,'rows':[]};var _0x5ac71e=_['map'](db['SugarcrmConfiguration'][_0x558c('0x2a')],function(_0xa708f1){return{'name':_0xa708f1['fieldName'],'type':_0xa708f1[_0x558c('0x2b')][_0x558c('0x2c')]};});_0x1311fd[_0x558c('0x2d')]=_[_0x558c('0x2e')](_0x5ac71e,_0x558c('0x28'));_0x1311fd[_0x558c('0x2f')]=_['keys'](_0x37b1f6[_0x558c('0x2f')]);_0x1311fd['filters']=_['intersection'](_0x1311fd[_0x558c('0x2d')],_0x1311fd[_0x558c('0x2f')]);_0x1a987d[_0x558c('0x30')]=_[_0x558c('0x31')](_0x1311fd[_0x558c('0x2d')],qs[_0x558c('0x32')](_0x37b1f6['query'][_0x558c('0x32')]));_0x1a987d['attributes']=_0x1a987d[_0x558c('0x30')][_0x558c('0x33')]?_0x1a987d[_0x558c('0x30')]:_0x1311fd[_0x558c('0x2d')];if(!_0x37b1f6[_0x558c('0x2f')][_0x558c('0x34')](_0x558c('0x35'))){_0x1a987d[_0x558c('0x1c')]=qs[_0x558c('0x1c')](_0x37b1f6[_0x558c('0x2f')]['limit']);_0x1a987d[_0x558c('0x1b')]=qs[_0x558c('0x1b')](_0x37b1f6['query'][_0x558c('0x1b')]);}_0x1a987d['order']=qs[_0x558c('0x36')](_0x37b1f6[_0x558c('0x2f')]['sort']);_0x1a987d[_0x558c('0x37')]=qs[_0x558c('0x38')](_[_0x558c('0x39')](_0x37b1f6[_0x558c('0x2f')],_0x1311fd['filters']),_0x5ac71e);if(_0x37b1f6['query'][_0x558c('0x3a')]){_0x1a987d[_0x558c('0x37')]=_[_0x558c('0x3b')](_0x1a987d['where'],{'$or':_[_0x558c('0x2e')](_0x5ac71e,function(_0x2e1b0b){if(_0x2e1b0b[_0x558c('0x2b')]!=='VIRTUAL'){var _0x5dfe3f={};_0x5dfe3f[_0x2e1b0b[_0x558c('0x28')]]={'$like':'%'+_0x37b1f6[_0x558c('0x2f')][_0x558c('0x3a')]+'%'};return _0x5dfe3f;}})});}_0x1a987d=_[_0x558c('0x3b')]({},_0x1a987d,_0x37b1f6[_0x558c('0x3c')]);var _0x3ba67e={'where':_0x1a987d['where']};return db['SugarcrmConfiguration'][_0x558c('0x1d')](_0x3ba67e)[_0x558c('0x24')](function(_0x3d2d79){_0x58f8f8['count']=_0x3d2d79;if(_0x37b1f6[_0x558c('0x2f')]['includeAll']){_0x1a987d['include']=[{'all':!![]}];}return db[_0x558c('0x3d')][_0x558c('0x3e')](_0x1a987d);})['then'](function(_0x2700cf){_0x58f8f8[_0x558c('0x3f')]=_0x2700cf;return _0x58f8f8;})['then'](respondWithFilteredResult(_0x39d570,_0x1a987d))[_0x558c('0x40')](handleError(_0x39d570,null));};exports[_0x558c('0x41')]=function(_0x47651e,_0x4b8130){var _0x1b00f0={'raw':![],'where':{'id':_0x47651e[_0x558c('0x42')]['id']}},_0x4296ba={};_0x4296ba[_0x558c('0x2d')]=_[_0x558c('0x43')](db['SugarcrmConfiguration'][_0x558c('0x2a')]);_0x4296ba['query']=_['keys'](_0x47651e['query']);_0x4296ba['filters']=_['intersection'](_0x4296ba[_0x558c('0x2d')],_0x4296ba[_0x558c('0x2f')]);_0x1b00f0[_0x558c('0x30')]=_[_0x558c('0x31')](_0x4296ba[_0x558c('0x2d')],qs[_0x558c('0x32')](_0x47651e[_0x558c('0x2f')]['fields']));_0x1b00f0[_0x558c('0x30')]=_0x1b00f0[_0x558c('0x30')][_0x558c('0x33')]?_0x1b00f0[_0x558c('0x30')]:_0x4296ba[_0x558c('0x2d')];if(_0x47651e[_0x558c('0x2f')]['includeAll']){_0x1b00f0['include']=[{'all':!![]}];}_0x1b00f0=_['merge']({},_0x1b00f0,_0x47651e[_0x558c('0x3c')]);return db[_0x558c('0x3d')][_0x558c('0x44')](_0x1b00f0)[_0x558c('0x24')](handleEntityNotFound(_0x4b8130,null))['then'](respondWithResult(_0x4b8130,null))[_0x558c('0x40')](handleError(_0x4b8130,null));};exports['create']=function(_0x528252,_0x46d10c){return db[_0x558c('0x3d')][_0x558c('0x45')](_0x528252[_0x558c('0x46')],{})[_0x558c('0x24')](respondWithResult(_0x46d10c,0xc9))[_0x558c('0x40')](handleError(_0x46d10c,null));};exports[_0x558c('0x23')]=function(_0x427bf9,_0x4ac525){if(_0x427bf9['body']['id']){delete _0x427bf9[_0x558c('0x46')]['id'];}return db['SugarcrmConfiguration'][_0x558c('0x44')]({'where':{'id':_0x427bf9['params']['id']}})[_0x558c('0x24')](handleEntityNotFound(_0x4ac525,null))[_0x558c('0x24')](saveUpdates(_0x427bf9[_0x558c('0x46')],null))[_0x558c('0x24')](respondWithResult(_0x4ac525,null))['catch'](handleError(_0x4ac525,null));};exports[_0x558c('0x25')]=function(_0x4d27cb,_0x53c966){return db[_0x558c('0x3d')]['find']({'where':{'id':_0x4d27cb['params']['id']}})[_0x558c('0x24')](handleEntityNotFound(_0x53c966,null))[_0x558c('0x24')](removeEntity(_0x53c966,null))['catch'](handleError(_0x53c966,null));};exports[_0x558c('0x47')]=function(_0x921c15,_0x4b51e6,_0x4a2cc7){var _0xbc51a1={};var _0x86904f={};var _0xa5973f;var _0x236fa9;return db[_0x558c('0x3d')][_0x558c('0x48')]({'where':{'id':_0x921c15[_0x558c('0x42')]['id']}})[_0x558c('0x24')](handleEntityNotFound(_0x4b51e6,null))['then'](function(_0x2e50fb){if(_0x2e50fb){_0xa5973f=_0x2e50fb;_0x86904f['model']=_[_0x558c('0x43')](db['SugarcrmField'][_0x558c('0x2a')]);_0x86904f[_0x558c('0x2f')]=_[_0x558c('0x43')](_0x921c15[_0x558c('0x2f')]);_0x86904f[_0x558c('0x38')]=_[_0x558c('0x31')](_0x86904f[_0x558c('0x2d')],_0x86904f[_0x558c('0x2f')]);_0xbc51a1[_0x558c('0x30')]=_['intersection'](_0x86904f[_0x558c('0x2d')],qs[_0x558c('0x32')](_0x921c15['query']['fields']));_0xbc51a1['attributes']=_0xbc51a1['attributes'][_0x558c('0x33')]?_0xbc51a1[_0x558c('0x30')]:_0x86904f[_0x558c('0x2d')];_0xbc51a1['order']=qs[_0x558c('0x36')](_0x921c15[_0x558c('0x2f')][_0x558c('0x36')]);_0xbc51a1[_0x558c('0x37')]=qs[_0x558c('0x38')](_['pick'](_0x921c15[_0x558c('0x2f')],_0x86904f[_0x558c('0x38')]));if(_0x921c15[_0x558c('0x2f')][_0x558c('0x3a')]){_0xbc51a1[_0x558c('0x37')]=_[_0x558c('0x3b')](_0xbc51a1[_0x558c('0x37')],{'$or':_[_0x558c('0x2e')](_0xbc51a1['attributes'],function(_0x58b4bf){var _0x17680a={};_0x17680a[_0x58b4bf]={'$like':'%'+_0x921c15[_0x558c('0x2f')][_0x558c('0x3a')]+'%'};return _0x17680a;})});}_0xbc51a1=_['merge']({},_0xbc51a1,_0x921c15['options']);return _0xa5973f[_0x558c('0x47')](_0xbc51a1);}})[_0x558c('0x24')](function(_0x3df580){if(_0x3df580){_0x236fa9=_0x3df580[_0x558c('0x33')];if(!_0x921c15[_0x558c('0x2f')][_0x558c('0x34')](_0x558c('0x35'))){_0xbc51a1[_0x558c('0x1c')]=qs[_0x558c('0x1c')](_0x921c15[_0x558c('0x2f')][_0x558c('0x1c')]);_0xbc51a1['offset']=qs['offset'](_0x921c15['query'][_0x558c('0x1b')]);}return _0xa5973f['getFields'](_0xbc51a1);}})[_0x558c('0x24')](function(_0x1dbfbe){if(_0x1dbfbe){return _0x1dbfbe?{'count':_0x236fa9,'rows':_0x1dbfbe}:null;}})['then'](respondWithResult(_0x4b51e6,null))['catch'](handleError(_0x4b51e6,null));};exports['getSubjects']=function(_0x4069b5,_0x271a69,_0x2964b4){var _0x2777f1={};var _0x9af1ee={};var _0x4d58e4;var _0x2719b5;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x4069b5[_0x558c('0x42')]['id']}})[_0x558c('0x24')](handleEntityNotFound(_0x271a69,null))[_0x558c('0x24')](function(_0x4e3a5c){if(_0x4e3a5c){_0x4d58e4=_0x4e3a5c;_0x9af1ee[_0x558c('0x2d')]=_['keys'](db[_0x558c('0x49')][_0x558c('0x2a')]);_0x9af1ee[_0x558c('0x2f')]=_['keys'](_0x4069b5[_0x558c('0x2f')]);_0x9af1ee[_0x558c('0x38')]=_['intersection'](_0x9af1ee[_0x558c('0x2d')],_0x9af1ee['query']);_0x2777f1[_0x558c('0x30')]=_['intersection'](_0x9af1ee[_0x558c('0x2d')],qs[_0x558c('0x32')](_0x4069b5[_0x558c('0x2f')][_0x558c('0x32')]));_0x2777f1[_0x558c('0x30')]=_0x2777f1['attributes']['length']?_0x2777f1[_0x558c('0x30')]:_0x9af1ee[_0x558c('0x2d')];_0x2777f1[_0x558c('0x4a')]=qs[_0x558c('0x36')](_0x4069b5[_0x558c('0x2f')]['sort']);_0x2777f1[_0x558c('0x37')]=qs[_0x558c('0x38')](_[_0x558c('0x39')](_0x4069b5[_0x558c('0x2f')],_0x9af1ee[_0x558c('0x38')]));if(_0x4069b5['query']['filter']){_0x2777f1['where']=_['merge'](_0x2777f1[_0x558c('0x37')],{'$or':_[_0x558c('0x2e')](_0x2777f1[_0x558c('0x30')],function(_0x41b630){var _0x25dea4={};_0x25dea4[_0x41b630]={'$like':'%'+_0x4069b5[_0x558c('0x2f')][_0x558c('0x3a')]+'%'};return _0x25dea4;})});}_0x2777f1=_[_0x558c('0x3b')]({},_0x2777f1,_0x4069b5[_0x558c('0x3c')]);return _0x4d58e4[_0x558c('0x4b')](_0x2777f1);}})[_0x558c('0x24')](function(_0x3edd83){if(_0x3edd83){_0x2719b5=_0x3edd83[_0x558c('0x33')];if(!_0x4069b5[_0x558c('0x2f')]['hasOwnProperty'](_0x558c('0x35'))){_0x2777f1[_0x558c('0x1c')]=qs[_0x558c('0x1c')](_0x4069b5[_0x558c('0x2f')][_0x558c('0x1c')]);_0x2777f1['offset']=qs[_0x558c('0x1b')](_0x4069b5['query'][_0x558c('0x1b')]);}return _0x4d58e4[_0x558c('0x4b')](_0x2777f1);}})[_0x558c('0x24')](function(_0x3a5946){if(_0x3a5946){return _0x3a5946?{'count':_0x2719b5,'rows':_0x3a5946}:null;}})[_0x558c('0x24')](respondWithResult(_0x271a69,null))['catch'](handleError(_0x271a69,null));};exports[_0x558c('0x4c')]=function(_0x79af83,_0xfe07d2,_0x3a4b73){var _0x34f8ae={};var _0xf60774={};var _0x285d46;var _0x47680a;return db[_0x558c('0x3d')][_0x558c('0x48')]({'where':{'id':_0x79af83[_0x558c('0x42')]['id']}})[_0x558c('0x24')](handleEntityNotFound(_0xfe07d2,null))[_0x558c('0x24')](function(_0x2d63de){if(_0x2d63de){_0x285d46=_0x2d63de;_0xf60774[_0x558c('0x2d')]=_[_0x558c('0x43')](db[_0x558c('0x49')]['rawAttributes']);_0xf60774[_0x558c('0x2f')]=_[_0x558c('0x43')](_0x79af83[_0x558c('0x2f')]);_0xf60774[_0x558c('0x38')]=_['intersection'](_0xf60774[_0x558c('0x2d')],_0xf60774[_0x558c('0x2f')]);_0x34f8ae[_0x558c('0x30')]=_[_0x558c('0x31')](_0xf60774[_0x558c('0x2d')],qs[_0x558c('0x32')](_0x79af83[_0x558c('0x2f')][_0x558c('0x32')]));_0x34f8ae[_0x558c('0x30')]=_0x34f8ae[_0x558c('0x30')][_0x558c('0x33')]?_0x34f8ae[_0x558c('0x30')]:_0xf60774[_0x558c('0x2d')];_0x34f8ae['order']=qs[_0x558c('0x36')](_0x79af83[_0x558c('0x2f')][_0x558c('0x36')]);_0x34f8ae[_0x558c('0x37')]=qs[_0x558c('0x38')](_[_0x558c('0x39')](_0x79af83[_0x558c('0x2f')],_0xf60774['filters']));if(_0x79af83['query'][_0x558c('0x3a')]){_0x34f8ae['where']=_[_0x558c('0x3b')](_0x34f8ae['where'],{'$or':_['map'](_0x34f8ae[_0x558c('0x30')],function(_0x2e840e){var _0x44ce0d={};_0x44ce0d[_0x2e840e]={'$like':'%'+_0x79af83[_0x558c('0x2f')]['filter']+'%'};return _0x44ce0d;})});}_0x34f8ae=_['merge']({},_0x34f8ae,_0x79af83[_0x558c('0x3c')]);return _0x285d46[_0x558c('0x4c')](_0x34f8ae);}})[_0x558c('0x24')](function(_0x56168f){if(_0x56168f){_0x47680a=_0x56168f[_0x558c('0x33')];if(!_0x79af83[_0x558c('0x2f')]['hasOwnProperty'](_0x558c('0x35'))){_0x34f8ae[_0x558c('0x1c')]=qs[_0x558c('0x1c')](_0x79af83[_0x558c('0x2f')][_0x558c('0x1c')]);_0x34f8ae[_0x558c('0x1b')]=qs[_0x558c('0x1b')](_0x79af83['query'][_0x558c('0x1b')]);}return _0x285d46[_0x558c('0x4c')](_0x34f8ae);}})[_0x558c('0x24')](function(_0x23f84b){if(_0x23f84b){return _0x23f84b?{'count':_0x47680a,'rows':_0x23f84b}:null;}})[_0x558c('0x24')](respondWithResult(_0xfe07d2,null))[_0x558c('0x40')](handleError(_0xfe07d2,null));}; \ No newline at end of file +var _0x2e49=['send','index','SugarcrmConfiguration','rawAttributes','model','map','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getFields','findOne','SugarcrmField','filter','hasOwnProperty','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus'];(function(_0x10a7f2,_0x24d4b8){var _0x25b668=function(_0x121deb){while(--_0x121deb){_0x10a7f2['push'](_0x10a7f2['shift']());}};_0x25b668(++_0x24d4b8);}(_0x2e49,0x15f));var _0x92e4=function(_0x36b39a,_0x24ae1c){_0x36b39a=_0x36b39a-0x0;var _0x5effc9=_0x2e49[_0x36b39a];return _0x5effc9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92e4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92e4('0x1'));var rp=require(_0x92e4('0x2'));var moment=require(_0x92e4('0x3'));var BPromise=require(_0x92e4('0x4'));var Mustache=require(_0x92e4('0x5'));var util=require(_0x92e4('0x6'));var path=require('path');var sox=require(_0x92e4('0x7'));var csv=require(_0x92e4('0x8'));var ejs=require(_0x92e4('0x9'));var fs=require('fs');var fs_extra=require(_0x92e4('0xa'));var _=require(_0x92e4('0xb'));var squel=require('squel');var crypto=require(_0x92e4('0xc'));var jsforce=require(_0x92e4('0xd'));var deskjs=require(_0x92e4('0xe'));var toCsv=require(_0x92e4('0x8'));var querystring=require('querystring');var Papa=require(_0x92e4('0xf'));var Redis=require(_0x92e4('0x10'));var authService=require(_0x92e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x92e4('0x12'));var hardwareService=require(_0x92e4('0x13'));var logger=require(_0x92e4('0x14'))(_0x92e4('0x15'));var utils=require(_0x92e4('0x16'));var config=require(_0x92e4('0x17'));var licenseUtil=require(_0x92e4('0x18'));var db=require(_0x92e4('0x19'))['db'];function respondWithStatusCode(_0x11f2b3,_0x1d194b){_0x1d194b=_0x1d194b||0xcc;return function(_0x4e66b8){if(_0x4e66b8){return _0x11f2b3['sendStatus'](_0x1d194b);}return _0x11f2b3['status'](_0x1d194b)['end']();};}function respondWithResult(_0x244f5e,_0x36745b){_0x36745b=_0x36745b||0xc8;return function(_0x8e34f4){if(_0x8e34f4){return _0x244f5e[_0x92e4('0x1a')](_0x36745b)[_0x92e4('0x1b')](_0x8e34f4);}};}function respondWithFilteredResult(_0x267a1b,_0x235b4e){return function(_0x2bc419){if(_0x2bc419){var _0x194909=typeof _0x235b4e[_0x92e4('0x1c')]===_0x92e4('0x1d')&&typeof _0x235b4e['limit']===_0x92e4('0x1d');var _0x58ac61=_0x2bc419[_0x92e4('0x1e')];var _0x1c4e2c=_0x194909?0x0:_0x235b4e[_0x92e4('0x1c')];var _0xe68885=_0x194909?_0x2bc419[_0x92e4('0x1e')]:_0x235b4e[_0x92e4('0x1c')]+_0x235b4e[_0x92e4('0x1f')];var _0x5bafcb;if(_0xe68885>=_0x58ac61){_0xe68885=_0x58ac61;_0x5bafcb=0xc8;}else{_0x5bafcb=0xce;}_0x267a1b[_0x92e4('0x1a')](_0x5bafcb);return _0x267a1b[_0x92e4('0x20')](_0x92e4('0x21'),_0x1c4e2c+'-'+_0xe68885+'/'+_0x58ac61)['json'](_0x2bc419);}return null;};}function patchUpdates(_0x2e03e6){return function(_0x4ce827){try{jsonpatch[_0x92e4('0x22')](_0x4ce827,_0x2e03e6,!![]);}catch(_0x18a981){return BPromise['reject'](_0x18a981);}return _0x4ce827['save']();};}function saveUpdates(_0x37ed8c,_0xb96dbe){return function(_0x5240d1){if(_0x5240d1){return _0x5240d1[_0x92e4('0x23')](_0x37ed8c)[_0x92e4('0x24')](function(_0x5d3e89){return _0x5d3e89;});}return null;};}function removeEntity(_0x55d013,_0x5969af){return function(_0x5d4f17){if(_0x5d4f17){return _0x5d4f17[_0x92e4('0x25')]()[_0x92e4('0x24')](function(){_0x55d013[_0x92e4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252460,_0x4a3451){return function(_0x5e1aee){if(!_0x5e1aee){_0x252460[_0x92e4('0x26')](0x194);}return _0x5e1aee;};}function handleError(_0x5404e7,_0x219c39){_0x219c39=_0x219c39||0x1f4;return function(_0x1e2dac){logger['error'](_0x1e2dac['stack']);if(_0x1e2dac['name']){delete _0x1e2dac['name'];}_0x5404e7[_0x92e4('0x1a')](_0x219c39)[_0x92e4('0x27')](_0x1e2dac);};}exports[_0x92e4('0x28')]=function(_0x5aa1dd,_0x151b32){var _0x28106b={},_0x22cf11={},_0x32ab0c={'count':0x0,'rows':[]};var _0x17675a=_['map'](db[_0x92e4('0x29')][_0x92e4('0x2a')],function(_0x52ad28){return{'name':_0x52ad28['fieldName'],'type':_0x52ad28['type']['key']};});_0x22cf11[_0x92e4('0x2b')]=_[_0x92e4('0x2c')](_0x17675a,_0x92e4('0x2d'));_0x22cf11['query']=_['keys'](_0x5aa1dd[_0x92e4('0x2e')]);_0x22cf11[_0x92e4('0x2f')]=_[_0x92e4('0x30')](_0x22cf11[_0x92e4('0x2b')],_0x22cf11[_0x92e4('0x2e')]);_0x28106b[_0x92e4('0x31')]=_[_0x92e4('0x30')](_0x22cf11[_0x92e4('0x2b')],qs['fields'](_0x5aa1dd[_0x92e4('0x2e')][_0x92e4('0x32')]));_0x28106b['attributes']=_0x28106b[_0x92e4('0x31')][_0x92e4('0x33')]?_0x28106b[_0x92e4('0x31')]:_0x22cf11['model'];if(!_0x5aa1dd[_0x92e4('0x2e')]['hasOwnProperty'](_0x92e4('0x34'))){_0x28106b[_0x92e4('0x1f')]=qs[_0x92e4('0x1f')](_0x5aa1dd['query'][_0x92e4('0x1f')]);_0x28106b['offset']=qs[_0x92e4('0x1c')](_0x5aa1dd[_0x92e4('0x2e')][_0x92e4('0x1c')]);}_0x28106b[_0x92e4('0x35')]=qs[_0x92e4('0x36')](_0x5aa1dd[_0x92e4('0x2e')][_0x92e4('0x36')]);_0x28106b[_0x92e4('0x37')]=qs['filters'](_[_0x92e4('0x38')](_0x5aa1dd[_0x92e4('0x2e')],_0x22cf11['filters']),_0x17675a);if(_0x5aa1dd[_0x92e4('0x2e')]['filter']){_0x28106b[_0x92e4('0x37')]=_[_0x92e4('0x39')](_0x28106b[_0x92e4('0x37')],{'$or':_[_0x92e4('0x2c')](_0x17675a,function(_0x215fc4){if(_0x215fc4[_0x92e4('0x3a')]!=='VIRTUAL'){var _0x2c1a46={};_0x2c1a46[_0x215fc4[_0x92e4('0x2d')]]={'$like':'%'+_0x5aa1dd['query']['filter']+'%'};return _0x2c1a46;}})});}_0x28106b=_[_0x92e4('0x39')]({},_0x28106b,_0x5aa1dd[_0x92e4('0x3b')]);var _0x4fe327={'where':_0x28106b['where']};return db[_0x92e4('0x29')][_0x92e4('0x1e')](_0x4fe327)[_0x92e4('0x24')](function(_0x153a4f){_0x32ab0c[_0x92e4('0x1e')]=_0x153a4f;if(_0x5aa1dd[_0x92e4('0x2e')][_0x92e4('0x3c')]){_0x28106b[_0x92e4('0x3d')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x92e4('0x3e')](_0x28106b);})[_0x92e4('0x24')](function(_0x3cc6aa){_0x32ab0c[_0x92e4('0x3f')]=_0x3cc6aa;return _0x32ab0c;})['then'](respondWithFilteredResult(_0x151b32,_0x28106b))[_0x92e4('0x40')](handleError(_0x151b32,null));};exports[_0x92e4('0x41')]=function(_0x9e4fa5,_0x1b9a0d){var _0x545181={'raw':![],'where':{'id':_0x9e4fa5[_0x92e4('0x42')]['id']}},_0x5d423d={};_0x5d423d[_0x92e4('0x2b')]=_[_0x92e4('0x43')](db[_0x92e4('0x29')][_0x92e4('0x2a')]);_0x5d423d[_0x92e4('0x2e')]=_['keys'](_0x9e4fa5['query']);_0x5d423d[_0x92e4('0x2f')]=_[_0x92e4('0x30')](_0x5d423d[_0x92e4('0x2b')],_0x5d423d['query']);_0x545181[_0x92e4('0x31')]=_[_0x92e4('0x30')](_0x5d423d[_0x92e4('0x2b')],qs[_0x92e4('0x32')](_0x9e4fa5[_0x92e4('0x2e')][_0x92e4('0x32')]));_0x545181[_0x92e4('0x31')]=_0x545181[_0x92e4('0x31')][_0x92e4('0x33')]?_0x545181[_0x92e4('0x31')]:_0x5d423d[_0x92e4('0x2b')];if(_0x9e4fa5[_0x92e4('0x2e')]['includeAll']){_0x545181['include']=[{'all':!![]}];}_0x545181=_[_0x92e4('0x39')]({},_0x545181,_0x9e4fa5[_0x92e4('0x3b')]);return db[_0x92e4('0x29')][_0x92e4('0x44')](_0x545181)[_0x92e4('0x24')](handleEntityNotFound(_0x1b9a0d,null))['then'](respondWithResult(_0x1b9a0d,null))[_0x92e4('0x40')](handleError(_0x1b9a0d,null));};exports[_0x92e4('0x45')]=function(_0x44efee,_0x4a2b8f){return db['SugarcrmConfiguration'][_0x92e4('0x45')](_0x44efee['body'],{})[_0x92e4('0x24')](respondWithResult(_0x4a2b8f,0xc9))[_0x92e4('0x40')](handleError(_0x4a2b8f,null));};exports[_0x92e4('0x23')]=function(_0x5c4b52,_0x121562){if(_0x5c4b52[_0x92e4('0x46')]['id']){delete _0x5c4b52['body']['id'];}return db[_0x92e4('0x29')][_0x92e4('0x44')]({'where':{'id':_0x5c4b52['params']['id']}})['then'](handleEntityNotFound(_0x121562,null))['then'](saveUpdates(_0x5c4b52['body'],null))[_0x92e4('0x24')](respondWithResult(_0x121562,null))[_0x92e4('0x40')](handleError(_0x121562,null));};exports[_0x92e4('0x25')]=function(_0x465397,_0x74ec4){return db['SugarcrmConfiguration'][_0x92e4('0x44')]({'where':{'id':_0x465397[_0x92e4('0x42')]['id']}})[_0x92e4('0x24')](handleEntityNotFound(_0x74ec4,null))['then'](removeEntity(_0x74ec4,null))[_0x92e4('0x40')](handleError(_0x74ec4,null));};exports[_0x92e4('0x47')]=function(_0x1f18fc,_0x4893ae,_0x90bf){var _0x5d4fab={};var _0x3fdf05={};var _0x165636;var _0x280406;return db[_0x92e4('0x29')][_0x92e4('0x48')]({'where':{'id':_0x1f18fc[_0x92e4('0x42')]['id']}})['then'](handleEntityNotFound(_0x4893ae,null))[_0x92e4('0x24')](function(_0x454ce6){if(_0x454ce6){_0x165636=_0x454ce6;_0x3fdf05['model']=_[_0x92e4('0x43')](db[_0x92e4('0x49')]['rawAttributes']);_0x3fdf05[_0x92e4('0x2e')]=_[_0x92e4('0x43')](_0x1f18fc[_0x92e4('0x2e')]);_0x3fdf05[_0x92e4('0x2f')]=_[_0x92e4('0x30')](_0x3fdf05[_0x92e4('0x2b')],_0x3fdf05['query']);_0x5d4fab['attributes']=_[_0x92e4('0x30')](_0x3fdf05['model'],qs[_0x92e4('0x32')](_0x1f18fc[_0x92e4('0x2e')][_0x92e4('0x32')]));_0x5d4fab[_0x92e4('0x31')]=_0x5d4fab['attributes'][_0x92e4('0x33')]?_0x5d4fab[_0x92e4('0x31')]:_0x3fdf05[_0x92e4('0x2b')];_0x5d4fab[_0x92e4('0x35')]=qs[_0x92e4('0x36')](_0x1f18fc[_0x92e4('0x2e')]['sort']);_0x5d4fab[_0x92e4('0x37')]=qs['filters'](_['pick'](_0x1f18fc['query'],_0x3fdf05['filters']));if(_0x1f18fc[_0x92e4('0x2e')][_0x92e4('0x4a')]){_0x5d4fab[_0x92e4('0x37')]=_['merge'](_0x5d4fab[_0x92e4('0x37')],{'$or':_[_0x92e4('0x2c')](_0x5d4fab[_0x92e4('0x31')],function(_0x1ba58d){var _0x52e3c2={};_0x52e3c2[_0x1ba58d]={'$like':'%'+_0x1f18fc['query']['filter']+'%'};return _0x52e3c2;})});}_0x5d4fab=_[_0x92e4('0x39')]({},_0x5d4fab,_0x1f18fc[_0x92e4('0x3b')]);return _0x165636[_0x92e4('0x47')](_0x5d4fab);}})[_0x92e4('0x24')](function(_0x45dd70){if(_0x45dd70){_0x280406=_0x45dd70['length'];if(!_0x1f18fc[_0x92e4('0x2e')][_0x92e4('0x4b')]('nolimit')){_0x5d4fab[_0x92e4('0x1f')]=qs[_0x92e4('0x1f')](_0x1f18fc[_0x92e4('0x2e')][_0x92e4('0x1f')]);_0x5d4fab[_0x92e4('0x1c')]=qs[_0x92e4('0x1c')](_0x1f18fc[_0x92e4('0x2e')][_0x92e4('0x1c')]);}return _0x165636[_0x92e4('0x47')](_0x5d4fab);}})[_0x92e4('0x24')](function(_0x169752){if(_0x169752){return _0x169752?{'count':_0x280406,'rows':_0x169752}:null;}})[_0x92e4('0x24')](respondWithResult(_0x4893ae,null))[_0x92e4('0x40')](handleError(_0x4893ae,null));};exports[_0x92e4('0x4c')]=function(_0x49afcf,_0xce0be,_0x1aa615){var _0x19be6d={};var _0x5e0f44={};var _0x163033;var _0xf5881;return db[_0x92e4('0x29')]['findOne']({'where':{'id':_0x49afcf[_0x92e4('0x42')]['id']}})[_0x92e4('0x24')](handleEntityNotFound(_0xce0be,null))[_0x92e4('0x24')](function(_0x4f1909){if(_0x4f1909){_0x163033=_0x4f1909;_0x5e0f44[_0x92e4('0x2b')]=_[_0x92e4('0x43')](db['SugarcrmField'][_0x92e4('0x2a')]);_0x5e0f44[_0x92e4('0x2e')]=_['keys'](_0x49afcf[_0x92e4('0x2e')]);_0x5e0f44[_0x92e4('0x2f')]=_[_0x92e4('0x30')](_0x5e0f44[_0x92e4('0x2b')],_0x5e0f44['query']);_0x19be6d[_0x92e4('0x31')]=_[_0x92e4('0x30')](_0x5e0f44[_0x92e4('0x2b')],qs[_0x92e4('0x32')](_0x49afcf['query'][_0x92e4('0x32')]));_0x19be6d[_0x92e4('0x31')]=_0x19be6d[_0x92e4('0x31')][_0x92e4('0x33')]?_0x19be6d[_0x92e4('0x31')]:_0x5e0f44[_0x92e4('0x2b')];_0x19be6d[_0x92e4('0x35')]=qs[_0x92e4('0x36')](_0x49afcf['query'][_0x92e4('0x36')]);_0x19be6d['where']=qs[_0x92e4('0x2f')](_[_0x92e4('0x38')](_0x49afcf[_0x92e4('0x2e')],_0x5e0f44[_0x92e4('0x2f')]));if(_0x49afcf['query'][_0x92e4('0x4a')]){_0x19be6d[_0x92e4('0x37')]=_[_0x92e4('0x39')](_0x19be6d['where'],{'$or':_['map'](_0x19be6d[_0x92e4('0x31')],function(_0x2dc836){var _0x52f71f={};_0x52f71f[_0x2dc836]={'$like':'%'+_0x49afcf['query'][_0x92e4('0x4a')]+'%'};return _0x52f71f;})});}_0x19be6d=_[_0x92e4('0x39')]({},_0x19be6d,_0x49afcf[_0x92e4('0x3b')]);return _0x163033[_0x92e4('0x4c')](_0x19be6d);}})['then'](function(_0x21e941){if(_0x21e941){_0xf5881=_0x21e941['length'];if(!_0x49afcf[_0x92e4('0x2e')][_0x92e4('0x4b')](_0x92e4('0x34'))){_0x19be6d[_0x92e4('0x1f')]=qs[_0x92e4('0x1f')](_0x49afcf['query'][_0x92e4('0x1f')]);_0x19be6d['offset']=qs['offset'](_0x49afcf[_0x92e4('0x2e')][_0x92e4('0x1c')]);}return _0x163033[_0x92e4('0x4c')](_0x19be6d);}})['then'](function(_0x570517){if(_0x570517){return _0x570517?{'count':_0xf5881,'rows':_0x570517}:null;}})['then'](respondWithResult(_0xce0be,null))[_0x92e4('0x40')](handleError(_0xce0be,null));};exports[_0x92e4('0x4d')]=function(_0xc50e1e,_0x490788,_0x2362c2){var _0xdc3de7={};var _0x4cc4fd={};var _0x3f60b5;var _0x30df97;return db['SugarcrmConfiguration'][_0x92e4('0x48')]({'where':{'id':_0xc50e1e[_0x92e4('0x42')]['id']}})[_0x92e4('0x24')](handleEntityNotFound(_0x490788,null))[_0x92e4('0x24')](function(_0x4edfc7){if(_0x4edfc7){_0x3f60b5=_0x4edfc7;_0x4cc4fd[_0x92e4('0x2b')]=_[_0x92e4('0x43')](db[_0x92e4('0x49')][_0x92e4('0x2a')]);_0x4cc4fd['query']=_['keys'](_0xc50e1e[_0x92e4('0x2e')]);_0x4cc4fd[_0x92e4('0x2f')]=_['intersection'](_0x4cc4fd['model'],_0x4cc4fd[_0x92e4('0x2e')]);_0xdc3de7[_0x92e4('0x31')]=_[_0x92e4('0x30')](_0x4cc4fd[_0x92e4('0x2b')],qs[_0x92e4('0x32')](_0xc50e1e[_0x92e4('0x2e')][_0x92e4('0x32')]));_0xdc3de7[_0x92e4('0x31')]=_0xdc3de7[_0x92e4('0x31')][_0x92e4('0x33')]?_0xdc3de7[_0x92e4('0x31')]:_0x4cc4fd[_0x92e4('0x2b')];_0xdc3de7[_0x92e4('0x35')]=qs[_0x92e4('0x36')](_0xc50e1e[_0x92e4('0x2e')][_0x92e4('0x36')]);_0xdc3de7[_0x92e4('0x37')]=qs[_0x92e4('0x2f')](_[_0x92e4('0x38')](_0xc50e1e[_0x92e4('0x2e')],_0x4cc4fd['filters']));if(_0xc50e1e[_0x92e4('0x2e')]['filter']){_0xdc3de7[_0x92e4('0x37')]=_[_0x92e4('0x39')](_0xdc3de7[_0x92e4('0x37')],{'$or':_['map'](_0xdc3de7[_0x92e4('0x31')],function(_0x2a2778){var _0x22a85e={};_0x22a85e[_0x2a2778]={'$like':'%'+_0xc50e1e[_0x92e4('0x2e')][_0x92e4('0x4a')]+'%'};return _0x22a85e;})});}_0xdc3de7=_[_0x92e4('0x39')]({},_0xdc3de7,_0xc50e1e['options']);return _0x3f60b5[_0x92e4('0x4d')](_0xdc3de7);}})['then'](function(_0x579c1a){if(_0x579c1a){_0x30df97=_0x579c1a[_0x92e4('0x33')];if(!_0xc50e1e[_0x92e4('0x2e')][_0x92e4('0x4b')](_0x92e4('0x34'))){_0xdc3de7[_0x92e4('0x1f')]=qs['limit'](_0xc50e1e[_0x92e4('0x2e')][_0x92e4('0x1f')]);_0xdc3de7['offset']=qs[_0x92e4('0x1c')](_0xc50e1e[_0x92e4('0x2e')][_0x92e4('0x1c')]);}return _0x3f60b5[_0x92e4('0x4d')](_0xdc3de7);}})[_0x92e4('0x24')](function(_0x3af825){if(_0x3af825){return _0x3af825?{'count':_0x30df97,'rows':_0x3af825}:null;}})[_0x92e4('0x24')](respondWithResult(_0x490788,null))[_0x92e4('0x40')](handleError(_0x490788,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 90cd248..57bac46 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 _0xb261=['define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x491ddb,_0x25845d){var _0x394c6a=function(_0x50e732){while(--_0x50e732){_0x491ddb['push'](_0x491ddb['shift']());}};_0x394c6a(++_0x25845d);}(_0xb261,0x85));var _0x1b26=function(_0xe01a2,_0xfd91e){_0xe01a2=_0xe01a2-0x0;var _0x1e8116=_0xb261[_0xe01a2];return _0x1e8116;};'use strict';var _=require(_0x1b26('0x0'));var util=require(_0x1b26('0x1'));var logger=require(_0x1b26('0x2'))(_0x1b26('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b26('0x4'));var fs=require('fs');var path=require(_0x1b26('0x5'));var rimraf=require(_0x1b26('0x6'));var config=require(_0x1b26('0x7'));var attributes=require(_0x1b26('0x8'));module[_0x1b26('0x9')]=function(_0x5d468b,_0x5e7dcd){return _0x5d468b[_0x1b26('0xa')](_0x1b26('0xb'),attributes,{'tableName':_0x1b26('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c0c=['../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2dc5b7,_0x3837ba){var _0x4edb5b=function(_0x3ed644){while(--_0x3ed644){_0x2dc5b7['push'](_0x2dc5b7['shift']());}};_0x4edb5b(++_0x3837ba);}(_0x9c0c,0xba));var _0xc9c0=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x9c0c[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0xc9c0('0x0'));var util=require(_0xc9c0('0x1'));var logger=require(_0xc9c0('0x2'))(_0xc9c0('0x3'));var moment=require(_0xc9c0('0x4'));var BPromise=require(_0xc9c0('0x5'));var rp=require(_0xc9c0('0x6'));var fs=require('fs');var path=require(_0xc9c0('0x7'));var rimraf=require(_0xc9c0('0x8'));var config=require(_0xc9c0('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xc9c0('0xa')]=function(_0x288fa6,_0x5dab5a){return _0x288fa6['define'](_0xc9c0('0xb'),attributes,{'tableName':_0xc9c0('0xc'),'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 cded458..6e912bb 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 _0xb784=['http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xb784,0x13f));var _0x4b78=function(_0x16d8b6,_0x8a970){_0x16d8b6=_0x16d8b6-0x0;var _0x845c4e=_0xb784[_0x16d8b6];return _0x845c4e;};'use strict';var _=require(_0x4b78('0x0'));var util=require(_0x4b78('0x1'));var moment=require(_0x4b78('0x2'));var BPromise=require(_0x4b78('0x3'));var rs=require(_0x4b78('0x4'));var fs=require('fs');var Redis=require(_0x4b78('0x5'));var db=require(_0x4b78('0x6'))['db'];var utils=require(_0x4b78('0x7'));var logger=require('../../config/logger')(_0x4b78('0x8'));var config=require('../../config/environment');var jayson=require(_0x4b78('0x9'));var client=jayson[_0x4b78('0xa')][_0x4b78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34f6e7,_0x5ca615,_0x534b1e){return new BPromise(function(_0x2c7ce9,_0x57a046){return client[_0x4b78('0xc')](_0x34f6e7,_0x534b1e)[_0x4b78('0xd')](function(_0x163b19){logger['info'](_0x4b78('0xe'),_0x5ca615,_0x4b78('0xf'));logger[_0x4b78('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5ca615,_0x4b78('0xf'),JSON['stringify'](_0x163b19));if(_0x163b19[_0x4b78('0x11')]){if(_0x163b19[_0x4b78('0x11')]['code']===0x1f4){logger[_0x4b78('0x11')](_0x4b78('0xe'),_0x5ca615,_0x163b19[_0x4b78('0x11')][_0x4b78('0x12')]);return _0x57a046(_0x163b19['error']['message']);}logger[_0x4b78('0x11')](_0x4b78('0xe'),_0x5ca615,_0x163b19[_0x4b78('0x11')]['message']);return _0x2c7ce9(_0x163b19[_0x4b78('0x11')][_0x4b78('0x12')]);}else{logger[_0x4b78('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5ca615,_0x4b78('0xf'));_0x2c7ce9(_0x163b19[_0x4b78('0x14')]['message']);}})[_0x4b78('0x15')](function(_0x59d912){logger[_0x4b78('0x11')](_0x4b78('0xe'),_0x5ca615,_0x59d912);_0x57a046(_0x59d912);});});} \ No newline at end of file +var _0x230c=['http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x230c,0xa7));var _0xc230=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x230c[_0x1ebce2];return _0x4a330c;};'use strict';var _=require(_0xc230('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc230('0x1'));var rs=require(_0xc230('0x2'));var fs=require('fs');var Redis=require(_0xc230('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc230('0x4'));var logger=require(_0xc230('0x5'))(_0xc230('0x6'));var config=require('../../config/environment');var jayson=require(_0xc230('0x7'));var client=jayson[_0xc230('0x8')][_0xc230('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x86dd25,_0x1ab7e8,_0xb2ebf7){return new BPromise(function(_0x466b59,_0x3478f7){return client[_0xc230('0xa')](_0x86dd25,_0xb2ebf7)[_0xc230('0xb')](function(_0xd2cf8e){logger['info'](_0xc230('0xc'),_0x1ab7e8,_0xc230('0xd'));logger[_0xc230('0xe')](_0xc230('0xf'),_0x1ab7e8,_0xc230('0xd'),JSON[_0xc230('0x10')](_0xd2cf8e));if(_0xd2cf8e[_0xc230('0x11')]){if(_0xd2cf8e[_0xc230('0x11')]['code']===0x1f4){logger['error'](_0xc230('0xc'),_0x1ab7e8,_0xd2cf8e[_0xc230('0x11')][_0xc230('0x12')]);return _0x3478f7(_0xd2cf8e[_0xc230('0x11')][_0xc230('0x12')]);}logger[_0xc230('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1ab7e8,_0xd2cf8e[_0xc230('0x11')][_0xc230('0x12')]);return _0x466b59(_0xd2cf8e[_0xc230('0x11')]['message']);}else{logger[_0xc230('0x13')](_0xc230('0xc'),_0x1ab7e8,'request\x20sent');_0x466b59(_0xd2cf8e[_0xc230('0x14')]['message']);}})[_0xc230('0x15')](function(_0x1a4990){logger[_0xc230('0x11')](_0xc230('0xc'),_0x1ab7e8,_0x1a4990);_0x3478f7(_0x1a4990);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 02b3775..1a81d6e 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 _0x02f5=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x3092f9,_0x4336a7){var _0x48c3e1=function(_0x479546){while(--_0x479546){_0x3092f9['push'](_0x3092f9['shift']());}};_0x48c3e1(++_0x4336a7);}(_0x02f5,0x1de));var _0x502f=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x02f5[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0x502f('0x0'));var util=require(_0x502f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x502f('0x2'));var router=express[_0x502f('0x3')]();var fs_extra=require(_0x502f('0x4'));var auth=require(_0x502f('0x5'));var interaction=require(_0x502f('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x502f('0x7')]);router[_0x502f('0x8')](_0x502f('0x9'),auth[_0x502f('0xa')](),controller[_0x502f('0xb')]);router[_0x502f('0xc')]('/',auth[_0x502f('0xa')](),controller[_0x502f('0xd')]);router[_0x502f('0xe')](_0x502f('0x9'),auth[_0x502f('0xa')](),controller[_0x502f('0xf')]);router[_0x502f('0x10')](_0x502f('0x9'),auth['isAuthenticated'](),controller[_0x502f('0x11')]);module[_0x502f('0x12')]=router; \ No newline at end of file +var _0xa7a0=['put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show'];(function(_0x25a33c,_0xa49c28){var _0x51fe9b=function(_0x3f1405){while(--_0x3f1405){_0x25a33c['push'](_0x25a33c['shift']());}};_0x51fe9b(++_0xa49c28);}(_0xa7a0,0x7a));var _0x0a7a=function(_0x2d33a8,_0x467975){_0x2d33a8=_0x2d33a8-0x0;var _0x5d62d0=_0xa7a0[_0x2d33a8];return _0x5d62d0;};'use strict';var multer=require(_0x0a7a('0x0'));var util=require(_0x0a7a('0x1'));var path=require('path');var timeout=require(_0x0a7a('0x2'));var express=require(_0x0a7a('0x3'));var router=express[_0x0a7a('0x4')]();var fs_extra=require(_0x0a7a('0x5'));var auth=require(_0x0a7a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0a7a('0x7'));var controller=require(_0x0a7a('0x8'));router[_0x0a7a('0x9')]('/',auth[_0x0a7a('0xa')](),controller['index']);router[_0x0a7a('0x9')](_0x0a7a('0xb'),auth[_0x0a7a('0xa')](),controller[_0x0a7a('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0a7a('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0a7a('0xe')]('/:id',auth[_0x0a7a('0xa')](),controller['destroy']);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 c7ccfec..feed01e 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 _0x4d31=['BOOLEAN','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x4d31,0x1e9));var _0x14d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4d31[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x14d3('0x0')]={'type':{'type':Sequelize[_0x14d3('0x1')](_0x14d3('0x2'),'variable',_0x14d3('0x3'),_0x14d3('0x4'),_0x14d3('0x5')),'defaultValue':_0x14d3('0x2')},'content':{'type':Sequelize[_0x14d3('0x6')]},'key':{'type':Sequelize[_0x14d3('0x6')]},'keyType':{'type':Sequelize[_0x14d3('0x1')](_0x14d3('0x2'),'variable',_0x14d3('0x3'))},'keyContent':{'type':Sequelize[_0x14d3('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x14d3('0x6')]},'customField':{'type':Sequelize[_0x14d3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcc05=['exports','string','variable','keyValue','picklist','STRING','ENUM','customVariable','sequelize'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0xcc05,0x15e));var _0x5cc0=function(_0x8b8f41,_0x56e288){_0x8b8f41=_0x8b8f41-0x0;var _0xe6645f=_0xcc05[_0x8b8f41];return _0xe6645f;};'use strict';var Sequelize=require(_0x5cc0('0x0'));module[_0x5cc0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5cc0('0x2'),_0x5cc0('0x3'),'customVariable',_0x5cc0('0x4'),_0x5cc0('0x5')),'defaultValue':_0x5cc0('0x2')},'content':{'type':Sequelize[_0x5cc0('0x6')]},'key':{'type':Sequelize[_0x5cc0('0x6')]},'keyType':{'type':Sequelize[_0x5cc0('0x7')]('string','variable',_0x5cc0('0x8'))},'keyContent':{'type':Sequelize[_0x5cc0('0x6')]},'idField':{'type':Sequelize[_0x5cc0('0x6')]},'nameField':{'type':Sequelize[_0x5cc0('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5cc0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 2c4e1af..36fb2f4 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 _0x8ffd=['reject','save','update','then','end','error','stack','name','index','SugarcrmField','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x2b4675,_0x1e1138){var _0x336451=function(_0x3ee85d){while(--_0x3ee85d){_0x2b4675['push'](_0x2b4675['shift']());}};_0x336451(++_0x1e1138);}(_0x8ffd,0x1e5));var _0xd8ff=function(_0x48deac,_0x4d8ab8){_0x48deac=_0x48deac-0x0;var _0x3b5eaa=_0x8ffd[_0x48deac];return _0x3b5eaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd8ff('0x0'));var zipdir=require(_0xd8ff('0x1'));var jsonpatch=require(_0xd8ff('0x2'));var rp=require(_0xd8ff('0x3'));var moment=require(_0xd8ff('0x4'));var BPromise=require(_0xd8ff('0x5'));var Mustache=require(_0xd8ff('0x6'));var util=require(_0xd8ff('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd8ff('0x8'));var ejs=require(_0xd8ff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd8ff('0xa'));var squel=require(_0xd8ff('0xb'));var crypto=require(_0xd8ff('0xc'));var jsforce=require(_0xd8ff('0xd'));var deskjs=require(_0xd8ff('0xe'));var toCsv=require(_0xd8ff('0x8'));var querystring=require('querystring');var Papa=require(_0xd8ff('0xf'));var Redis=require(_0xd8ff('0x10'));var authService=require(_0xd8ff('0x11'));var qs=require(_0xd8ff('0x12'));var as=require(_0xd8ff('0x13'));var hardwareService=require(_0xd8ff('0x14'));var logger=require(_0xd8ff('0x15'))(_0xd8ff('0x16'));var utils=require(_0xd8ff('0x17'));var config=require(_0xd8ff('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8ff('0x19'))['db'];function respondWithStatusCode(_0xa2cfb8,_0x5e21f5){_0x5e21f5=_0x5e21f5||0xcc;return function(_0x383be4){if(_0x383be4){return _0xa2cfb8['sendStatus'](_0x5e21f5);}return _0xa2cfb8[_0xd8ff('0x1a')](_0x5e21f5)['end']();};}function respondWithResult(_0x147b80,_0x51f437){_0x51f437=_0x51f437||0xc8;return function(_0xc20cfd){if(_0xc20cfd){return _0x147b80['status'](_0x51f437)['json'](_0xc20cfd);}};}function respondWithFilteredResult(_0x58c904,_0x4bd716){return function(_0x1567ee){if(_0x1567ee){var _0x4a2bf4=typeof _0x4bd716[_0xd8ff('0x1b')]===_0xd8ff('0x1c')&&typeof _0x4bd716[_0xd8ff('0x1d')]==='undefined';var _0x455f6e=_0x1567ee['count'];var _0x51b1a7=_0x4a2bf4?0x0:_0x4bd716['offset'];var _0x3025e7=_0x4a2bf4?_0x1567ee[_0xd8ff('0x1e')]:_0x4bd716[_0xd8ff('0x1b')]+_0x4bd716[_0xd8ff('0x1d')];var _0x4e6bfb;if(_0x3025e7>=_0x455f6e){_0x3025e7=_0x455f6e;_0x4e6bfb=0xc8;}else{_0x4e6bfb=0xce;}_0x58c904[_0xd8ff('0x1a')](_0x4e6bfb);return _0x58c904[_0xd8ff('0x1f')](_0xd8ff('0x20'),_0x51b1a7+'-'+_0x3025e7+'/'+_0x455f6e)['json'](_0x1567ee);}return null;};}function patchUpdates(_0x388e9f){return function(_0x1fcbe5){try{jsonpatch['apply'](_0x1fcbe5,_0x388e9f,!![]);}catch(_0x497483){return BPromise[_0xd8ff('0x21')](_0x497483);}return _0x1fcbe5[_0xd8ff('0x22')]();};}function saveUpdates(_0x5a386f,_0x4dd0b1){return function(_0x264f49){if(_0x264f49){return _0x264f49[_0xd8ff('0x23')](_0x5a386f)[_0xd8ff('0x24')](function(_0x515237){return _0x515237;});}return null;};}function removeEntity(_0x400006,_0x27099d){return function(_0x4fb54d){if(_0x4fb54d){return _0x4fb54d['destroy']()[_0xd8ff('0x24')](function(){_0x400006[_0xd8ff('0x1a')](0xcc)[_0xd8ff('0x25')]();});}};}function handleEntityNotFound(_0x41c01b,_0x45e17f){return function(_0x480e3f){if(!_0x480e3f){_0x41c01b['sendStatus'](0x194);}return _0x480e3f;};}function handleError(_0x34c06f,_0x47b025){_0x47b025=_0x47b025||0x1f4;return function(_0x1cc5b8){logger[_0xd8ff('0x26')](_0x1cc5b8[_0xd8ff('0x27')]);if(_0x1cc5b8['name']){delete _0x1cc5b8[_0xd8ff('0x28')];}_0x34c06f[_0xd8ff('0x1a')](_0x47b025)['send'](_0x1cc5b8);};}exports[_0xd8ff('0x29')]=function(_0x11c1ca,_0x3ce21b){var _0x190556={},_0x4797ed={},_0x4fc064={'count':0x0,'rows':[]};var _0x3088cf=_['map'](db[_0xd8ff('0x2a')]['rawAttributes'],function(_0x5773c8){return{'name':_0x5773c8[_0xd8ff('0x2b')],'type':_0x5773c8['type'][_0xd8ff('0x2c')]};});_0x4797ed['model']=_[_0xd8ff('0x2d')](_0x3088cf,_0xd8ff('0x28'));_0x4797ed[_0xd8ff('0x2e')]=_[_0xd8ff('0x2f')](_0x11c1ca[_0xd8ff('0x2e')]);_0x4797ed[_0xd8ff('0x30')]=_[_0xd8ff('0x31')](_0x4797ed[_0xd8ff('0x32')],_0x4797ed['query']);_0x190556[_0xd8ff('0x33')]=_[_0xd8ff('0x31')](_0x4797ed[_0xd8ff('0x32')],qs[_0xd8ff('0x34')](_0x11c1ca[_0xd8ff('0x2e')][_0xd8ff('0x34')]));_0x190556[_0xd8ff('0x33')]=_0x190556[_0xd8ff('0x33')][_0xd8ff('0x35')]?_0x190556[_0xd8ff('0x33')]:_0x4797ed[_0xd8ff('0x32')];if(!_0x11c1ca[_0xd8ff('0x2e')][_0xd8ff('0x36')](_0xd8ff('0x37'))){_0x190556['limit']=qs[_0xd8ff('0x1d')](_0x11c1ca[_0xd8ff('0x2e')][_0xd8ff('0x1d')]);_0x190556['offset']=qs[_0xd8ff('0x1b')](_0x11c1ca['query'][_0xd8ff('0x1b')]);}_0x190556[_0xd8ff('0x38')]=qs[_0xd8ff('0x39')](_0x11c1ca[_0xd8ff('0x2e')][_0xd8ff('0x39')]);_0x190556[_0xd8ff('0x3a')]=qs[_0xd8ff('0x30')](_[_0xd8ff('0x3b')](_0x11c1ca[_0xd8ff('0x2e')],_0x4797ed[_0xd8ff('0x30')]),_0x3088cf);if(_0x11c1ca[_0xd8ff('0x2e')][_0xd8ff('0x3c')]){_0x190556[_0xd8ff('0x3a')]=_[_0xd8ff('0x3d')](_0x190556[_0xd8ff('0x3a')],{'$or':_[_0xd8ff('0x2d')](_0x3088cf,function(_0x2d32c2){if(_0x2d32c2['type']!=='VIRTUAL'){var _0x555bf3={};_0x555bf3[_0x2d32c2[_0xd8ff('0x28')]]={'$like':'%'+_0x11c1ca[_0xd8ff('0x2e')]['filter']+'%'};return _0x555bf3;}})});}_0x190556=_[_0xd8ff('0x3d')]({},_0x190556,_0x11c1ca[_0xd8ff('0x3e')]);var _0x27c25a={'where':_0x190556[_0xd8ff('0x3a')]};return db[_0xd8ff('0x2a')][_0xd8ff('0x1e')](_0x27c25a)[_0xd8ff('0x24')](function(_0xcf3ee){_0x4fc064['count']=_0xcf3ee;if(_0x11c1ca['query'][_0xd8ff('0x3f')]){_0x190556[_0xd8ff('0x40')]=[{'all':!![]}];}return db[_0xd8ff('0x2a')][_0xd8ff('0x41')](_0x190556);})['then'](function(_0x394ff6){_0x4fc064[_0xd8ff('0x42')]=_0x394ff6;return _0x4fc064;})[_0xd8ff('0x24')](respondWithFilteredResult(_0x3ce21b,_0x190556))['catch'](handleError(_0x3ce21b,null));};exports[_0xd8ff('0x43')]=function(_0x5f4996,_0x395097){var _0x5837d1={'raw':!![],'where':{'id':_0x5f4996['params']['id']}},_0x2d4e19={};_0x2d4e19[_0xd8ff('0x32')]=_[_0xd8ff('0x2f')](db['SugarcrmField'][_0xd8ff('0x44')]);_0x2d4e19[_0xd8ff('0x2e')]=_[_0xd8ff('0x2f')](_0x5f4996[_0xd8ff('0x2e')]);_0x2d4e19[_0xd8ff('0x30')]=_['intersection'](_0x2d4e19[_0xd8ff('0x32')],_0x2d4e19[_0xd8ff('0x2e')]);_0x5837d1[_0xd8ff('0x33')]=_['intersection'](_0x2d4e19[_0xd8ff('0x32')],qs[_0xd8ff('0x34')](_0x5f4996['query'][_0xd8ff('0x34')]));_0x5837d1[_0xd8ff('0x33')]=_0x5837d1[_0xd8ff('0x33')][_0xd8ff('0x35')]?_0x5837d1[_0xd8ff('0x33')]:_0x2d4e19[_0xd8ff('0x32')];if(_0x5f4996[_0xd8ff('0x2e')][_0xd8ff('0x3f')]){_0x5837d1['include']=[{'all':!![]}];}_0x5837d1=_[_0xd8ff('0x3d')]({},_0x5837d1,_0x5f4996[_0xd8ff('0x3e')]);return db[_0xd8ff('0x2a')][_0xd8ff('0x45')](_0x5837d1)[_0xd8ff('0x24')](handleEntityNotFound(_0x395097,null))['then'](respondWithResult(_0x395097,null))[_0xd8ff('0x46')](handleError(_0x395097,null));};exports['create']=function(_0x4c7b0d,_0x3648a1){return db[_0xd8ff('0x2a')][_0xd8ff('0x47')](_0x4c7b0d[_0xd8ff('0x48')],{})[_0xd8ff('0x24')](respondWithResult(_0x3648a1,0xc9))[_0xd8ff('0x46')](handleError(_0x3648a1,null));};exports['update']=function(_0x3615ad,_0x38cbb9){if(_0x3615ad['body']['id']){delete _0x3615ad[_0xd8ff('0x48')]['id'];}return db[_0xd8ff('0x2a')][_0xd8ff('0x45')]({'where':{'id':_0x3615ad[_0xd8ff('0x49')]['id']}})[_0xd8ff('0x24')](handleEntityNotFound(_0x38cbb9,null))['then'](saveUpdates(_0x3615ad[_0xd8ff('0x48')],null))[_0xd8ff('0x24')](respondWithResult(_0x38cbb9,null))['catch'](handleError(_0x38cbb9,null));};exports['destroy']=function(_0x1ecc28,_0x5091cd){return db[_0xd8ff('0x2a')][_0xd8ff('0x45')]({'where':{'id':_0x1ecc28[_0xd8ff('0x49')]['id']}})[_0xd8ff('0x24')](handleEntityNotFound(_0x5091cd,null))[_0xd8ff('0x24')](removeEntity(_0x5091cd,null))['catch'](handleError(_0x5091cd,null));}; \ No newline at end of file +var _0x1bd7=['filter','merge','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','SugarcrmField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x594670,_0x4b9fdd){var _0x36a5b7=function(_0x45471e){while(--_0x45471e){_0x594670['push'](_0x594670['shift']());}};_0x36a5b7(++_0x4b9fdd);}(_0x1bd7,0x9f));var _0x71bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bd7[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x71bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x71bd('0x1'));var jsonpatch=require(_0x71bd('0x2'));var rp=require('request-promise');var moment=require(_0x71bd('0x3'));var BPromise=require(_0x71bd('0x4'));var Mustache=require(_0x71bd('0x5'));var util=require(_0x71bd('0x6'));var path=require(_0x71bd('0x7'));var sox=require(_0x71bd('0x8'));var csv=require('to-csv');var ejs=require(_0x71bd('0x9'));var fs=require('fs');var fs_extra=require(_0x71bd('0xa'));var _=require(_0x71bd('0xb'));var squel=require(_0x71bd('0xc'));var crypto=require('crypto');var jsforce=require(_0x71bd('0xd'));var deskjs=require(_0x71bd('0xe'));var toCsv=require(_0x71bd('0xf'));var querystring=require(_0x71bd('0x10'));var Papa=require(_0x71bd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x71bd('0x12'));var hardwareService=require(_0x71bd('0x13'));var logger=require(_0x71bd('0x14'))(_0x71bd('0x15'));var utils=require(_0x71bd('0x16'));var config=require(_0x71bd('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x209d98,_0x2b392d){_0x2b392d=_0x2b392d||0xcc;return function(_0x451ce4){if(_0x451ce4){return _0x209d98['sendStatus'](_0x2b392d);}return _0x209d98[_0x71bd('0x18')](_0x2b392d)[_0x71bd('0x19')]();};}function respondWithResult(_0x582b06,_0x9483ab){_0x9483ab=_0x9483ab||0xc8;return function(_0x2321f0){if(_0x2321f0){return _0x582b06[_0x71bd('0x18')](_0x9483ab)['json'](_0x2321f0);}};}function respondWithFilteredResult(_0x212b32,_0xfbc402){return function(_0x79adde){if(_0x79adde){var _0x1f2cd6=typeof _0xfbc402[_0x71bd('0x1a')]===_0x71bd('0x1b')&&typeof _0xfbc402['limit']===_0x71bd('0x1b');var _0x5b15ed=_0x79adde[_0x71bd('0x1c')];var _0x274edf=_0x1f2cd6?0x0:_0xfbc402[_0x71bd('0x1a')];var _0x2875f9=_0x1f2cd6?_0x79adde[_0x71bd('0x1c')]:_0xfbc402['offset']+_0xfbc402[_0x71bd('0x1d')];var _0x3866d7;if(_0x2875f9>=_0x5b15ed){_0x2875f9=_0x5b15ed;_0x3866d7=0xc8;}else{_0x3866d7=0xce;}_0x212b32['status'](_0x3866d7);return _0x212b32[_0x71bd('0x1e')](_0x71bd('0x1f'),_0x274edf+'-'+_0x2875f9+'/'+_0x5b15ed)[_0x71bd('0x20')](_0x79adde);}return null;};}function patchUpdates(_0xa99c49){return function(_0x866b7d){try{jsonpatch['apply'](_0x866b7d,_0xa99c49,!![]);}catch(_0x45c249){return BPromise['reject'](_0x45c249);}return _0x866b7d[_0x71bd('0x21')]();};}function saveUpdates(_0x117ab3,_0x513e13){return function(_0x20d6d8){if(_0x20d6d8){return _0x20d6d8[_0x71bd('0x22')](_0x117ab3)[_0x71bd('0x23')](function(_0x2e02bc){return _0x2e02bc;});}return null;};}function removeEntity(_0x22f46c,_0x8ebfed){return function(_0x378107){if(_0x378107){return _0x378107[_0x71bd('0x24')]()[_0x71bd('0x23')](function(){_0x22f46c[_0x71bd('0x18')](0xcc)[_0x71bd('0x19')]();});}};}function handleEntityNotFound(_0x6c34cc,_0x26d7a4){return function(_0x4c4069){if(!_0x4c4069){_0x6c34cc['sendStatus'](0x194);}return _0x4c4069;};}function handleError(_0x5d8e5b,_0x1ce8ed){_0x1ce8ed=_0x1ce8ed||0x1f4;return function(_0x9aed2){logger[_0x71bd('0x25')](_0x9aed2[_0x71bd('0x26')]);if(_0x9aed2['name']){delete _0x9aed2[_0x71bd('0x27')];}_0x5d8e5b['status'](_0x1ce8ed)[_0x71bd('0x28')](_0x9aed2);};}exports['index']=function(_0x425c0d,_0xa7ffad){var _0x5b92a2={},_0x2932de={},_0x27ca7c={'count':0x0,'rows':[]};var _0x2967ec=_['map'](db[_0x71bd('0x29')]['rawAttributes'],function(_0x537226){return{'name':_0x537226[_0x71bd('0x2a')],'type':_0x537226[_0x71bd('0x2b')][_0x71bd('0x2c')]};});_0x2932de[_0x71bd('0x2d')]=_[_0x71bd('0x2e')](_0x2967ec,_0x71bd('0x27'));_0x2932de[_0x71bd('0x2f')]=_[_0x71bd('0x30')](_0x425c0d[_0x71bd('0x2f')]);_0x2932de[_0x71bd('0x31')]=_[_0x71bd('0x32')](_0x2932de[_0x71bd('0x2d')],_0x2932de[_0x71bd('0x2f')]);_0x5b92a2[_0x71bd('0x33')]=_[_0x71bd('0x32')](_0x2932de[_0x71bd('0x2d')],qs[_0x71bd('0x34')](_0x425c0d[_0x71bd('0x2f')]['fields']));_0x5b92a2[_0x71bd('0x33')]=_0x5b92a2['attributes'][_0x71bd('0x35')]?_0x5b92a2[_0x71bd('0x33')]:_0x2932de[_0x71bd('0x2d')];if(!_0x425c0d['query'][_0x71bd('0x36')](_0x71bd('0x37'))){_0x5b92a2[_0x71bd('0x1d')]=qs[_0x71bd('0x1d')](_0x425c0d[_0x71bd('0x2f')][_0x71bd('0x1d')]);_0x5b92a2[_0x71bd('0x1a')]=qs['offset'](_0x425c0d[_0x71bd('0x2f')]['offset']);}_0x5b92a2[_0x71bd('0x38')]=qs[_0x71bd('0x39')](_0x425c0d[_0x71bd('0x2f')][_0x71bd('0x39')]);_0x5b92a2[_0x71bd('0x3a')]=qs[_0x71bd('0x31')](_[_0x71bd('0x3b')](_0x425c0d['query'],_0x2932de[_0x71bd('0x31')]),_0x2967ec);if(_0x425c0d['query'][_0x71bd('0x3c')]){_0x5b92a2['where']=_[_0x71bd('0x3d')](_0x5b92a2['where'],{'$or':_[_0x71bd('0x2e')](_0x2967ec,function(_0x4783c2){if(_0x4783c2[_0x71bd('0x2b')]!=='VIRTUAL'){var _0x2606ad={};_0x2606ad[_0x4783c2[_0x71bd('0x27')]]={'$like':'%'+_0x425c0d[_0x71bd('0x2f')][_0x71bd('0x3c')]+'%'};return _0x2606ad;}})});}_0x5b92a2=_['merge']({},_0x5b92a2,_0x425c0d[_0x71bd('0x3e')]);var _0x62bc63={'where':_0x5b92a2[_0x71bd('0x3a')]};return db[_0x71bd('0x29')]['count'](_0x62bc63)[_0x71bd('0x23')](function(_0x16eae2){_0x27ca7c['count']=_0x16eae2;if(_0x425c0d['query']['includeAll']){_0x5b92a2[_0x71bd('0x3f')]=[{'all':!![]}];}return db[_0x71bd('0x29')][_0x71bd('0x40')](_0x5b92a2);})[_0x71bd('0x23')](function(_0x3c8fbe){_0x27ca7c[_0x71bd('0x41')]=_0x3c8fbe;return _0x27ca7c;})['then'](respondWithFilteredResult(_0xa7ffad,_0x5b92a2))[_0x71bd('0x42')](handleError(_0xa7ffad,null));};exports['show']=function(_0x28663d,_0x4b4ce7){var _0x36c7af={'raw':!![],'where':{'id':_0x28663d[_0x71bd('0x43')]['id']}},_0xba252e={};_0xba252e[_0x71bd('0x2d')]=_[_0x71bd('0x30')](db[_0x71bd('0x29')][_0x71bd('0x44')]);_0xba252e[_0x71bd('0x2f')]=_[_0x71bd('0x30')](_0x28663d[_0x71bd('0x2f')]);_0xba252e[_0x71bd('0x31')]=_[_0x71bd('0x32')](_0xba252e['model'],_0xba252e[_0x71bd('0x2f')]);_0x36c7af[_0x71bd('0x33')]=_['intersection'](_0xba252e[_0x71bd('0x2d')],qs[_0x71bd('0x34')](_0x28663d['query'][_0x71bd('0x34')]));_0x36c7af['attributes']=_0x36c7af[_0x71bd('0x33')][_0x71bd('0x35')]?_0x36c7af['attributes']:_0xba252e[_0x71bd('0x2d')];if(_0x28663d[_0x71bd('0x2f')][_0x71bd('0x45')]){_0x36c7af['include']=[{'all':!![]}];}_0x36c7af=_['merge']({},_0x36c7af,_0x28663d['options']);return db[_0x71bd('0x29')][_0x71bd('0x46')](_0x36c7af)[_0x71bd('0x23')](handleEntityNotFound(_0x4b4ce7,null))[_0x71bd('0x23')](respondWithResult(_0x4b4ce7,null))[_0x71bd('0x42')](handleError(_0x4b4ce7,null));};exports['create']=function(_0x1f01ac,_0x2ca169){return db['SugarcrmField'][_0x71bd('0x47')](_0x1f01ac[_0x71bd('0x48')],{})[_0x71bd('0x23')](respondWithResult(_0x2ca169,0xc9))[_0x71bd('0x42')](handleError(_0x2ca169,null));};exports[_0x71bd('0x22')]=function(_0x26c263,_0x22452a){if(_0x26c263[_0x71bd('0x48')]['id']){delete _0x26c263[_0x71bd('0x48')]['id'];}return db['SugarcrmField'][_0x71bd('0x46')]({'where':{'id':_0x26c263[_0x71bd('0x43')]['id']}})[_0x71bd('0x23')](handleEntityNotFound(_0x22452a,null))[_0x71bd('0x23')](saveUpdates(_0x26c263[_0x71bd('0x48')],null))[_0x71bd('0x23')](respondWithResult(_0x22452a,null))[_0x71bd('0x42')](handleError(_0x22452a,null));};exports[_0x71bd('0x24')]=function(_0x4a82e9,_0x5a7afb){return db[_0x71bd('0x29')][_0x71bd('0x46')]({'where':{'id':_0x4a82e9[_0x71bd('0x43')]['id']}})[_0x71bd('0x23')](handleEntityNotFound(_0x5a7afb,null))[_0x71bd('0x23')](removeEntity(_0x5a7afb,null))[_0x71bd('0x42')](handleError(_0x5a7afb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 278e2a0..681fea3 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 _0x3db4=['int_sugarcrm_fields','sugarcrm_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x32ef1e,_0x2dc4c6){var _0x29bb67=function(_0x3c8841){while(--_0x3c8841){_0x32ef1e['push'](_0x32ef1e['shift']());}};_0x29bb67(++_0x2dc4c6);}(_0x3db4,0x85));var _0x43db=function(_0x3b452f,_0x3b86f6){_0x3b452f=_0x3b452f-0x0;var _0x5ca922=_0x3db4[_0x3b452f];return _0x5ca922;};'use strict';var _=require('lodash');var util=require(_0x43db('0x0'));var logger=require(_0x43db('0x1'))(_0x43db('0x2'));var moment=require(_0x43db('0x3'));var BPromise=require(_0x43db('0x4'));var rp=require(_0x43db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43db('0x6'));var config=require(_0x43db('0x7'));var attributes=require(_0x43db('0x8'));module[_0x43db('0x9')]=function(_0x27c6e2,_0x5a2711){return _0x27c6e2['define']('SugarcrmField',attributes,{'tableName':_0x43db('0xa'),'paranoid':![],'indexes':[{'name':_0x43db('0xb'),'fields':[_0x43db('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3238=['moment','request-promise','path','../../config/environment','FieldId','../../config/logger','api'];(function(_0x163459,_0x265db5){var _0x21198b=function(_0x58c70d){while(--_0x58c70d){_0x163459['push'](_0x163459['shift']());}};_0x21198b(++_0x265db5);}(_0x3238,0x1e8));var _0x8323=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3238[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8323('0x0'))(_0x8323('0x1'));var moment=require(_0x8323('0x2'));var BPromise=require('bluebird');var rp=require(_0x8323('0x3'));var fs=require('fs');var path=require(_0x8323('0x4'));var rimraf=require('rimraf');var config=require(_0x8323('0x5'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x4d660e,_0x108963){return _0x4d660e['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x8323('0x6')],'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 f6fb98e..2fb1308 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 _0x81bc=['info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3bea4,_0x56a1a5){var _0xf8e956=function(_0x489bd7){while(--_0x489bd7){_0x3bea4['push'](_0x3bea4['shift']());}};_0xf8e956(++_0x56a1a5);}(_0x81bc,0x1ba));var _0xc81b=function(_0x331615,_0x13aebd){_0x331615=_0x331615-0x0;var _0x4ba773=_0x81bc[_0x331615];return _0x4ba773;};'use strict';var _=require(_0xc81b('0x0'));var util=require(_0xc81b('0x1'));var moment=require(_0xc81b('0x2'));var BPromise=require(_0xc81b('0x3'));var rs=require(_0xc81b('0x4'));var fs=require('fs');var Redis=require(_0xc81b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc81b('0x6'));var logger=require('../../config/logger')(_0xc81b('0x7'));var config=require(_0xc81b('0x8'));var jayson=require(_0xc81b('0x9'));var client=jayson[_0xc81b('0xa')][_0xc81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x393929,_0x20d6d3,_0x57b8b5){return new BPromise(function(_0x299256,_0x4137cd){return client['request'](_0x393929,_0x57b8b5)[_0xc81b('0xc')](function(_0xd2ffa7){logger['info'](_0xc81b('0xd'),_0x20d6d3,_0xc81b('0xe'));logger[_0xc81b('0xf')](_0xc81b('0x10'),_0x20d6d3,_0xc81b('0xe'),JSON[_0xc81b('0x11')](_0xd2ffa7));if(_0xd2ffa7['error']){if(_0xd2ffa7[_0xc81b('0x12')]['code']===0x1f4){logger['error'](_0xc81b('0xd'),_0x20d6d3,_0xd2ffa7[_0xc81b('0x12')]['message']);return _0x4137cd(_0xd2ffa7[_0xc81b('0x12')][_0xc81b('0x13')]);}logger[_0xc81b('0x12')](_0xc81b('0xd'),_0x20d6d3,_0xd2ffa7[_0xc81b('0x12')][_0xc81b('0x13')]);return _0x299256(_0xd2ffa7['error'][_0xc81b('0x13')]);}else{logger[_0xc81b('0x14')](_0xc81b('0xd'),_0x20d6d3,_0xc81b('0xe'));_0x299256(_0xd2ffa7['result'][_0xc81b('0x13')]);}})['catch'](function(_0x295f6e){logger[_0xc81b('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x20d6d3,_0x295f6e);_0x4137cd(_0x295f6e);});});} \ No newline at end of file +var _0xb84f=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird'];(function(_0x463447,_0x504bb4){var _0x4adb6b=function(_0x27348e){while(--_0x27348e){_0x463447['push'](_0x463447['shift']());}};_0x4adb6b(++_0x504bb4);}(_0xb84f,0x164));var _0xfb84=function(_0x2eb2f7,_0x2b85c6){_0x2eb2f7=_0x2eb2f7-0x0;var _0x5b00f7=_0xb84f[_0x2eb2f7];return _0x5b00f7;};'use strict';var _=require(_0xfb84('0x0'));var util=require(_0xfb84('0x1'));var moment=require(_0xfb84('0x2'));var BPromise=require(_0xfb84('0x3'));var rs=require(_0xfb84('0x4'));var fs=require('fs');var Redis=require(_0xfb84('0x5'));var db=require(_0xfb84('0x6'))['db'];var utils=require(_0xfb84('0x7'));var logger=require('../../config/logger')(_0xfb84('0x8'));var config=require(_0xfb84('0x9'));var jayson=require(_0xfb84('0xa'));var client=jayson[_0xfb84('0xb')][_0xfb84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d57db,_0x445e4e,_0x53d78d){return new BPromise(function(_0x1d24f1,_0x1d18f9){return client[_0xfb84('0xd')](_0x1d57db,_0x53d78d)[_0xfb84('0xe')](function(_0x1e1c54){logger['info'](_0xfb84('0xf'),_0x445e4e,_0xfb84('0x10'));logger[_0xfb84('0x11')](_0xfb84('0x12'),_0x445e4e,_0xfb84('0x10'),JSON[_0xfb84('0x13')](_0x1e1c54));if(_0x1e1c54['error']){if(_0x1e1c54[_0xfb84('0x14')][_0xfb84('0x15')]===0x1f4){logger['error'](_0xfb84('0xf'),_0x445e4e,_0x1e1c54[_0xfb84('0x14')][_0xfb84('0x16')]);return _0x1d18f9(_0x1e1c54[_0xfb84('0x14')][_0xfb84('0x16')]);}logger['error'](_0xfb84('0xf'),_0x445e4e,_0x1e1c54[_0xfb84('0x14')][_0xfb84('0x16')]);return _0x1d24f1(_0x1e1c54['error'][_0xfb84('0x16')]);}else{logger[_0xfb84('0x17')]('SugarcrmField,\x20%s,\x20%s',_0x445e4e,_0xfb84('0x10'));_0x1d24f1(_0x1e1c54['result'][_0xfb84('0x16')]);}})['catch'](function(_0x2b8177){logger[_0xfb84('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x445e4e,_0x2b8177);_0x1d18f9(_0x2b8177);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6ddd336..5a4d12c 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 _0xa0bc=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete'];(function(_0x4992a5,_0x1db7c8){var _0x293301=function(_0x250779){while(--_0x250779){_0x4992a5['push'](_0x4992a5['shift']());}};_0x293301(++_0x1db7c8);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xca0b('0x0'));var path=require(_0xca0b('0x1'));var timeout=require('connect-timeout');var express=require(_0xca0b('0x2'));var router=express[_0xca0b('0x3')]();var fs_extra=require(_0xca0b('0x4'));var auth=require(_0xca0b('0x5'));var interaction=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var controller=require(_0xca0b('0x8'));router[_0xca0b('0x9')]('/',auth[_0xca0b('0xa')](),controller[_0xca0b('0xb')]);router[_0xca0b('0x9')](_0xca0b('0xc'),auth[_0xca0b('0xa')](),controller[_0xca0b('0xd')]);router['get'](_0xca0b('0xe'),auth[_0xca0b('0xa')](),controller[_0xca0b('0xf')]);router[_0xca0b('0x9')](_0xca0b('0x10'),auth[_0xca0b('0xa')](),controller['getFields']);router[_0xca0b('0x11')]('/',auth[_0xca0b('0xa')](),controller[_0xca0b('0x12')]);router[_0xca0b('0x11')](_0xca0b('0xe'),auth[_0xca0b('0xa')](),controller[_0xca0b('0x13')]);router[_0xca0b('0x14')](_0xca0b('0xc'),auth[_0xca0b('0xa')](),controller['update']);router[_0xca0b('0x15')](_0xca0b('0xc'),auth[_0xca0b('0xa')](),controller['destroy']);module[_0xca0b('0x16')]=router; \ No newline at end of file +var _0x65f4=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x1e9eab,_0x1bfd13){var _0x1c101d=function(_0x3807ae){while(--_0x3807ae){_0x1e9eab['push'](_0x1e9eab['shift']());}};_0x1c101d(++_0x1bfd13);}(_0x65f4,0x19a));var _0x465f=function(_0x539b89,_0x3220de){_0x539b89=_0x539b89-0x0;var _0x12cd4d=_0x65f4[_0x539b89];return _0x12cd4d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x465f('0x0'));var timeout=require(_0x465f('0x1'));var express=require(_0x465f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x465f('0x3'));var interaction=require(_0x465f('0x4'));var config=require(_0x465f('0x5'));var controller=require('./intVtigerAccount.controller');router[_0x465f('0x6')]('/',auth[_0x465f('0x7')](),controller[_0x465f('0x8')]);router['get'](_0x465f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x465f('0x6')](_0x465f('0xa'),auth[_0x465f('0x7')](),controller[_0x465f('0xb')]);router[_0x465f('0x6')](_0x465f('0xc'),auth[_0x465f('0x7')](),controller[_0x465f('0xd')]);router['post']('/',auth[_0x465f('0x7')](),controller[_0x465f('0xe')]);router[_0x465f('0xf')](_0x465f('0xa'),auth[_0x465f('0x7')](),controller[_0x465f('0x10')]);router[_0x465f('0x11')](_0x465f('0x9'),auth[_0x465f('0x7')](),controller['update']);router['delete'](_0x465f('0x9'),auth[_0x465f('0x7')](),controller[_0x465f('0x12')]);module[_0x465f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 76bb1a7..46d9e65 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 _0x4d4c=['STRING','HelpDesk','sequelize','exports'];(function(_0x418330,_0x4c8c2d){var _0x503c9a=function(_0x33ce45){while(--_0x33ce45){_0x418330['push'](_0x418330['shift']());}};_0x503c9a(++_0x4c8c2d);}(_0x4d4c,0x1e2));var _0xc4d4=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0x4d4c[_0x1667df];return _0x341abf;};'use strict';var Sequelize=require(_0xc4d4('0x0'));module[_0xc4d4('0x1')]={'name':{'type':Sequelize[_0xc4d4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc4d4('0x2')]},'username':{'type':Sequelize[_0xc4d4('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc4d4('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc4d4('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc4d4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x480d=['STRING','sequelize'];(function(_0x44c471,_0x2da701){var _0x4d499b=function(_0x1342d4){while(--_0x1342d4){_0x44c471['push'](_0x44c471['shift']());}};_0x4d499b(++_0x2da701);}(_0x480d,0x183));var _0xd480=function(_0x5ad41b,_0x2a42e6){_0x5ad41b=_0x5ad41b-0x0;var _0x5c12ef=_0x480d[_0x5ad41b];return _0x5c12ef;};'use strict';var Sequelize=require(_0xd480('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd480('0x1')]},'username':{'type':Sequelize[_0xd480('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd480('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xd480('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd480('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd480('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 55c0291..5301830 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 _0xe1bb=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','GET','getchallenge','success','result','token','describe','sessionName','owner','includes','editable','false','label','cf_','picklistValues','value','vTiger\x20error:\x20','stringify','test','Wrong\x20credentials','rimraf','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0xe1bb,0x141));var _0xbe1b=function(_0x570143,_0x2620f1){_0x570143=_0x570143-0x0;var _0x38a856=_0xe1bb[_0x570143];return _0x38a856;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe1b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe1b('0x1'));var rp=require('request-promise');var moment=require(_0xbe1b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbe1b('0x3'));var path=require(_0xbe1b('0x4'));var sox=require(_0xbe1b('0x5'));var csv=require(_0xbe1b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe1b('0x7'));var _=require(_0xbe1b('0x8'));var squel=require(_0xbe1b('0x9'));var crypto=require(_0xbe1b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbe1b('0xb'));var toCsv=require(_0xbe1b('0x6'));var querystring=require(_0xbe1b('0xc'));var Papa=require(_0xbe1b('0xd'));var Redis=require(_0xbe1b('0xe'));var authService=require(_0xbe1b('0xf'));var qs=require(_0xbe1b('0x10'));var as=require(_0xbe1b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe1b('0x12'))(_0xbe1b('0x13'));var utils=require(_0xbe1b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbe1b('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1cb990,_0x230bf1){_0x230bf1=_0x230bf1||0xcc;return function(_0x42a59d){if(_0x42a59d){return _0x1cb990[_0xbe1b('0x16')](_0x230bf1);}return _0x1cb990[_0xbe1b('0x17')](_0x230bf1)[_0xbe1b('0x18')]();};}function respondWithResult(_0x139b86,_0x2aef0b){_0x2aef0b=_0x2aef0b||0xc8;return function(_0x3ab2a5){if(_0x3ab2a5){return _0x139b86['status'](_0x2aef0b)[_0xbe1b('0x19')](_0x3ab2a5);}};}function respondWithFilteredResult(_0x39b651,_0x5fff6f){return function(_0x5dc4a1){if(_0x5dc4a1){var _0x17329b=typeof _0x5fff6f['offset']===_0xbe1b('0x1a')&&typeof _0x5fff6f[_0xbe1b('0x1b')]===_0xbe1b('0x1a');var _0x59ce63=_0x5dc4a1[_0xbe1b('0x1c')];var _0x40e427=_0x17329b?0x0:_0x5fff6f[_0xbe1b('0x1d')];var _0x4e0b93=_0x17329b?_0x5dc4a1[_0xbe1b('0x1c')]:_0x5fff6f[_0xbe1b('0x1d')]+_0x5fff6f[_0xbe1b('0x1b')];var _0x26d1ad;if(_0x4e0b93>=_0x59ce63){_0x4e0b93=_0x59ce63;_0x26d1ad=0xc8;}else{_0x26d1ad=0xce;}_0x39b651[_0xbe1b('0x17')](_0x26d1ad);return _0x39b651[_0xbe1b('0x1e')](_0xbe1b('0x1f'),_0x40e427+'-'+_0x4e0b93+'/'+_0x59ce63)[_0xbe1b('0x19')](_0x5dc4a1);}return null;};}function patchUpdates(_0x140c54){return function(_0x1b15c6){try{jsonpatch[_0xbe1b('0x20')](_0x1b15c6,_0x140c54,!![]);}catch(_0x398c81){return BPromise['reject'](_0x398c81);}return _0x1b15c6[_0xbe1b('0x21')]();};}function saveUpdates(_0x1d34f0,_0x2ee472){return function(_0xec9dad){if(_0xec9dad){return _0xec9dad[_0xbe1b('0x22')](_0x1d34f0)[_0xbe1b('0x23')](function(_0x5e5569){return _0x5e5569;});}return null;};}function removeEntity(_0x569ea0,_0x92b1fe){return function(_0xfe04b0){if(_0xfe04b0){return _0xfe04b0[_0xbe1b('0x24')]()['then'](function(){_0x569ea0[_0xbe1b('0x17')](0xcc)[_0xbe1b('0x18')]();});}};}function handleEntityNotFound(_0x16aa6c,_0x2a6d79){return function(_0x2df449){if(!_0x2df449){_0x16aa6c[_0xbe1b('0x16')](0x194);}return _0x2df449;};}function handleError(_0xfd71e4,_0x2bb24e){_0x2bb24e=_0x2bb24e||0x1f4;return function(_0x3d5aaa){logger[_0xbe1b('0x25')](_0x3d5aaa[_0xbe1b('0x26')]);if(_0x3d5aaa[_0xbe1b('0x27')]){delete _0x3d5aaa[_0xbe1b('0x27')];}_0xfd71e4[_0xbe1b('0x17')](_0x2bb24e)[_0xbe1b('0x28')](_0x3d5aaa);};}exports[_0xbe1b('0x29')]=function(_0xa1bdfd,_0x5993c0){var _0x25221a={},_0x15ca77={},_0x3d8067={'count':0x0,'rows':[]};var _0x2eb3b6=_[_0xbe1b('0x2a')](db[_0xbe1b('0x2b')]['rawAttributes'],function(_0x1493d6){return{'name':_0x1493d6[_0xbe1b('0x2c')],'type':_0x1493d6[_0xbe1b('0x2d')]['key']};});_0x15ca77[_0xbe1b('0x2e')]=_[_0xbe1b('0x2a')](_0x2eb3b6,_0xbe1b('0x27'));_0x15ca77[_0xbe1b('0x2f')]=_[_0xbe1b('0x30')](_0xa1bdfd['query']);_0x15ca77[_0xbe1b('0x31')]=_['intersection'](_0x15ca77[_0xbe1b('0x2e')],_0x15ca77[_0xbe1b('0x2f')]);_0x25221a[_0xbe1b('0x32')]=_[_0xbe1b('0x33')](_0x15ca77['model'],qs[_0xbe1b('0x34')](_0xa1bdfd[_0xbe1b('0x2f')][_0xbe1b('0x34')]));_0x25221a[_0xbe1b('0x32')]=_0x25221a[_0xbe1b('0x32')][_0xbe1b('0x35')]?_0x25221a['attributes']:_0x15ca77[_0xbe1b('0x2e')];if(!_0xa1bdfd[_0xbe1b('0x2f')]['hasOwnProperty'](_0xbe1b('0x36'))){_0x25221a['limit']=qs[_0xbe1b('0x1b')](_0xa1bdfd[_0xbe1b('0x2f')][_0xbe1b('0x1b')]);_0x25221a['offset']=qs[_0xbe1b('0x1d')](_0xa1bdfd['query'][_0xbe1b('0x1d')]);}_0x25221a[_0xbe1b('0x37')]=qs[_0xbe1b('0x38')](_0xa1bdfd['query'][_0xbe1b('0x38')]);_0x25221a['where']=qs[_0xbe1b('0x31')](_[_0xbe1b('0x39')](_0xa1bdfd[_0xbe1b('0x2f')],_0x15ca77[_0xbe1b('0x31')]),_0x2eb3b6);if(_0xa1bdfd[_0xbe1b('0x2f')]['filter']){_0x25221a['where']=_[_0xbe1b('0x3a')](_0x25221a[_0xbe1b('0x3b')],{'$or':_['map'](_0x2eb3b6,function(_0x530e66){if(_0x530e66[_0xbe1b('0x2d')]!==_0xbe1b('0x3c')){var _0x2d929f={};_0x2d929f[_0x530e66[_0xbe1b('0x27')]]={'$like':'%'+_0xa1bdfd[_0xbe1b('0x2f')][_0xbe1b('0x3d')]+'%'};return _0x2d929f;}})});}_0x25221a=_[_0xbe1b('0x3a')]({},_0x25221a,_0xa1bdfd[_0xbe1b('0x3e')]);var _0x11e32b={'where':_0x25221a[_0xbe1b('0x3b')]};return db['VtigerAccount'][_0xbe1b('0x1c')](_0x11e32b)[_0xbe1b('0x23')](function(_0x60a5c8){_0x3d8067[_0xbe1b('0x1c')]=_0x60a5c8;if(_0xa1bdfd[_0xbe1b('0x2f')][_0xbe1b('0x3f')]){_0x25221a[_0xbe1b('0x40')]=[{'all':!![]}];}return db[_0xbe1b('0x2b')][_0xbe1b('0x41')](_0x25221a);})[_0xbe1b('0x23')](function(_0x2747c0){_0x3d8067[_0xbe1b('0x42')]=_0x2747c0;return _0x3d8067;})['then'](respondWithFilteredResult(_0x5993c0,_0x25221a))['catch'](handleError(_0x5993c0,null));};exports[_0xbe1b('0x43')]=function(_0x1e6fda,_0x25b9b1){var _0x13ec3c={'raw':![],'where':{'id':_0x1e6fda[_0xbe1b('0x44')]['id']}},_0x4660fd={};_0x4660fd[_0xbe1b('0x2e')]=_[_0xbe1b('0x30')](db[_0xbe1b('0x2b')][_0xbe1b('0x45')]);_0x4660fd[_0xbe1b('0x2f')]=_[_0xbe1b('0x30')](_0x1e6fda[_0xbe1b('0x2f')]);_0x4660fd[_0xbe1b('0x31')]=_['intersection'](_0x4660fd[_0xbe1b('0x2e')],_0x4660fd['query']);_0x13ec3c[_0xbe1b('0x32')]=_['intersection'](_0x4660fd['model'],qs[_0xbe1b('0x34')](_0x1e6fda[_0xbe1b('0x2f')][_0xbe1b('0x34')]));_0x13ec3c[_0xbe1b('0x32')]=_0x13ec3c['attributes'][_0xbe1b('0x35')]?_0x13ec3c[_0xbe1b('0x32')]:_0x4660fd[_0xbe1b('0x2e')];if(_0x1e6fda[_0xbe1b('0x2f')][_0xbe1b('0x3f')]){_0x13ec3c[_0xbe1b('0x40')]=[{'all':!![]}];}_0x13ec3c=_['merge']({},_0x13ec3c,_0x1e6fda[_0xbe1b('0x3e')]);return db[_0xbe1b('0x2b')][_0xbe1b('0x46')](_0x13ec3c)[_0xbe1b('0x23')](handleEntityNotFound(_0x25b9b1,null))[_0xbe1b('0x23')](respondWithResult(_0x25b9b1,null))[_0xbe1b('0x47')](handleError(_0x25b9b1,null));};exports[_0xbe1b('0x48')]=function(_0x422f7f,_0xda0700){return db['VtigerAccount'][_0xbe1b('0x48')](_0x422f7f[_0xbe1b('0x49')],{})['then'](respondWithResult(_0xda0700,0xc9))[_0xbe1b('0x47')](handleError(_0xda0700,null));};exports[_0xbe1b('0x22')]=function(_0x5e627d,_0x28be1b){if(_0x5e627d['body']['id']){delete _0x5e627d[_0xbe1b('0x49')]['id'];}return db[_0xbe1b('0x2b')]['find']({'where':{'id':_0x5e627d[_0xbe1b('0x44')]['id']}})['then'](handleEntityNotFound(_0x28be1b,null))[_0xbe1b('0x23')](saveUpdates(_0x5e627d[_0xbe1b('0x49')],null))['then'](respondWithResult(_0x28be1b,null))[_0xbe1b('0x47')](handleError(_0x28be1b,null));};exports[_0xbe1b('0x24')]=function(_0x1beecc,_0x23ff6b){return db['VtigerAccount'][_0xbe1b('0x46')]({'where':{'id':_0x1beecc[_0xbe1b('0x44')]['id']}})[_0xbe1b('0x23')](handleEntityNotFound(_0x23ff6b,null))[_0xbe1b('0x23')](removeEntity(_0x23ff6b,null))[_0xbe1b('0x47')](handleError(_0x23ff6b,null));};exports[_0xbe1b('0x4a')]=function(_0x547a12,_0x1a8eb9,_0x3ae98e){var _0x5d7fde={};var _0x218b74={};var _0x552ddb;var _0x3fe066;return db['VtigerAccount'][_0xbe1b('0x4b')]({'where':{'id':_0x547a12[_0xbe1b('0x44')]['id']}})[_0xbe1b('0x23')](handleEntityNotFound(_0x1a8eb9,null))[_0xbe1b('0x23')](function(_0x597e72){if(_0x597e72){_0x552ddb=_0x597e72;_0x218b74['model']=_[_0xbe1b('0x30')](db['VtigerConfiguration'][_0xbe1b('0x45')]);_0x218b74['query']=_[_0xbe1b('0x30')](_0x547a12[_0xbe1b('0x2f')]);_0x218b74[_0xbe1b('0x31')]=_[_0xbe1b('0x33')](_0x218b74[_0xbe1b('0x2e')],_0x218b74[_0xbe1b('0x2f')]);_0x5d7fde['attributes']=_[_0xbe1b('0x33')](_0x218b74[_0xbe1b('0x2e')],qs[_0xbe1b('0x34')](_0x547a12[_0xbe1b('0x2f')]['fields']));_0x5d7fde[_0xbe1b('0x32')]=_0x5d7fde[_0xbe1b('0x32')][_0xbe1b('0x35')]?_0x5d7fde[_0xbe1b('0x32')]:_0x218b74['model'];_0x5d7fde[_0xbe1b('0x37')]=qs[_0xbe1b('0x38')](_0x547a12[_0xbe1b('0x2f')][_0xbe1b('0x38')]);_0x5d7fde[_0xbe1b('0x3b')]=qs['filters'](_[_0xbe1b('0x39')](_0x547a12[_0xbe1b('0x2f')],_0x218b74['filters']));if(_0x547a12[_0xbe1b('0x2f')][_0xbe1b('0x3d')]){_0x5d7fde['where']=_[_0xbe1b('0x3a')](_0x5d7fde['where'],{'$or':_[_0xbe1b('0x2a')](_0x5d7fde['attributes'],function(_0x52565e){var _0x2f4ded={};_0x2f4ded[_0x52565e]={'$like':'%'+_0x547a12['query'][_0xbe1b('0x3d')]+'%'};return _0x2f4ded;})});}_0x5d7fde=_[_0xbe1b('0x3a')]({},_0x5d7fde,_0x547a12[_0xbe1b('0x3e')]);return _0x552ddb['getConfigurations'](_0x5d7fde);}})['then'](function(_0x5e836d){if(_0x5e836d){_0x3fe066=_0x5e836d['length'];if(!_0x547a12[_0xbe1b('0x2f')]['hasOwnProperty'](_0xbe1b('0x36'))){_0x5d7fde[_0xbe1b('0x1b')]=qs['limit'](_0x547a12[_0xbe1b('0x2f')][_0xbe1b('0x1b')]);_0x5d7fde['offset']=qs[_0xbe1b('0x1d')](_0x547a12[_0xbe1b('0x2f')]['offset']);}return _0x552ddb['getConfigurations'](_0x5d7fde);}})[_0xbe1b('0x23')](function(_0x435d9d){if(_0x435d9d){return _0x435d9d?{'count':_0x3fe066,'rows':_0x435d9d}:null;}})[_0xbe1b('0x23')](respondWithResult(_0x1a8eb9,null))[_0xbe1b('0x47')](handleError(_0x1a8eb9,null));};exports[_0xbe1b('0x4c')]=function(_0xaea3c,_0x205626,_0x1203dc){if(_0xaea3c[_0xbe1b('0x49')]['id']){delete _0xaea3c[_0xbe1b('0x49')]['id'];}return db['VtigerAccount'][_0xbe1b('0x4b')]({'where':{'id':_0xaea3c[_0xbe1b('0x44')]['id']}})['then'](handleEntityNotFound(_0x205626,null))[_0xbe1b('0x23')](function(_0x59964a){if(_0x59964a){_0xaea3c[_0xbe1b('0x49')][_0xbe1b('0x4d')]=_0x59964a['id'];_0xaea3c[_0xbe1b('0x49')][_0xbe1b('0x4e')]=integrations[_0xbe1b('0x4f')](_0xaea3c[_0xbe1b('0x49')][_0xbe1b('0x50')],_0xaea3c[_0xbe1b('0x49')][_0xbe1b('0x2d')]);_0xaea3c[_0xbe1b('0x49')][_0xbe1b('0x51')]=integrations[_0xbe1b('0x52')](_0xaea3c[_0xbe1b('0x49')]['channel'],_0xaea3c[_0xbe1b('0x49')]['type']);return db['VtigerConfiguration'][_0xbe1b('0x48')](_0xaea3c['body'],{'include':[{'model':db[_0xbe1b('0x53')],'as':_0xbe1b('0x4e')},{'model':db[_0xbe1b('0x53')],'as':_0xbe1b('0x51')}]});}return null;})['then'](respondWithResult(_0x205626,null))[_0xbe1b('0x47')](handleError(_0x205626,null));};var md5=require(_0xbe1b('0x54'));exports[_0xbe1b('0x55')]=function(_0x31bf0a,_0x436afe,_0x404a66){var _0x40080b=null;var _0x3767f3=null;var _0x66d725=null;var _0xca08af=null;var _0x457588='';return db[_0xbe1b('0x2b')]['findOne']({'where':{'id':_0x31bf0a['params']['id']},'attributes':['id','name',_0xbe1b('0x56'),_0xbe1b('0x57'),_0xbe1b('0x58'),_0xbe1b('0x59'),_0xbe1b('0x5a'),'accessKey']})[_0xbe1b('0x23')](handleEntityNotFound(_0x436afe,null))[_0xbe1b('0x23')](function(_0x16f18a){if(_0x16f18a){_0x40080b=_0x16f18a['username'];_0x3767f3=_0x16f18a[_0xbe1b('0x5b')];_0x66d725=_0x16f18a[_0xbe1b('0x58')];_0x457588=_0x16f18a[_0xbe1b('0x59')];var _0x8e11ad=_0x457588[_0xbe1b('0x5c')](-0x1);if(_0x8e11ad==='/'){_0x457588=_0x457588['substring'](0x0,_0x457588[_0xbe1b('0x5d')](_0x8e11ad));}_0xca08af=util[_0xbe1b('0x5e')]('%s/webservice.php',_0x457588);var _0x58b59c={'method':_0xbe1b('0x5f'),'uri':_0xca08af,'qs':{'operation':_0xbe1b('0x60'),'username':_0x16f18a[_0xbe1b('0x56')]},'json':!![]};return rp(_0x58b59c);}})[_0xbe1b('0x23')](function(_0x32c7f3){if(_0x32c7f3[_0xbe1b('0x61')]){var _0x551e79={'method':'POST','uri':_0xca08af,'form':{'operation':'login','username':_0x40080b,'accessKey':md5(_0x32c7f3[_0xbe1b('0x62')][_0xbe1b('0x63')]+_0x3767f3)},'json':!![]};return rp(_0x551e79);}})[_0xbe1b('0x23')](function(_0x38721f){if(_0x38721f[_0xbe1b('0x61')]){var _0x1a17b9={'method':_0xbe1b('0x5f'),'uri':_0xca08af,'qs':{'operation':_0xbe1b('0x64'),'username':_0x40080b,'sessionName':_0x38721f[_0xbe1b('0x62')][_0xbe1b('0x65')],'elementType':_0x66d725},'json':!![]};return rp(_0x1a17b9);}})[_0xbe1b('0x23')](function(_0x58a91b){if(_0x58a91b[_0xbe1b('0x61')]){var _0x4d1dc6=['autogenerated','reference',_0xbe1b('0x66')];_['remove'](_0x58a91b[_0xbe1b('0x62')][_0xbe1b('0x34')],function(_0x22713b){return _0x4d1dc6[_0xbe1b('0x67')](_0x22713b[_0xbe1b('0x2d')][_0xbe1b('0x27')]);});_['remove'](_0x58a91b[_0xbe1b('0x62')][_0xbe1b('0x34')],function(_0x2c3903){return _0x2c3903[_0xbe1b('0x68')]===_0xbe1b('0x69');});return{'count':_0x58a91b[_0xbe1b('0x62')][_0xbe1b('0x34')][_0xbe1b('0x35')],'rows':_[_0xbe1b('0x2a')](_0x58a91b['result']['fields'],function(_0x510ce5){return{'id':_0x510ce5[_0xbe1b('0x27')],'name':_0x510ce5[_0xbe1b('0x6a')],'custom':_['startsWith'](_0x510ce5[_0xbe1b('0x27')],_0xbe1b('0x6b'))?!![]:![],'options':_0x510ce5[_0xbe1b('0x2d')][_0xbe1b('0x27')]==='picklist'&&_0x510ce5[_0xbe1b('0x2d')][_0xbe1b('0x6c')][_0xbe1b('0x35')]>0x0?_[_0xbe1b('0x2a')](_0x510ce5[_0xbe1b('0x2d')][_0xbe1b('0x6c')],function(_0x13a75f){return{'name':_0x13a75f[_0xbe1b('0x6a')],'value':_0x13a75f[_0xbe1b('0x6d')]};}):[]};})};}})['then'](respondWithResult(_0x436afe,null))[_0xbe1b('0x47')](function(_0x1c9a1d){console['log'](_0xbe1b('0x6e')+_0x1c9a1d);var _0x53b5ba=_0x31bf0a[_0xbe1b('0x2f')]['test']?0x1f4:_0x1c9a1d['statusCode']||0x1f4;logger[_0xbe1b('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x53b5ba,JSON[_0xbe1b('0x6f')](_0x1c9a1d));delete _0x1c9a1d[_0xbe1b('0x27')];if(_0x53b5ba===0x191){_0x53b5ba=0x190;}_0x436afe[_0xbe1b('0x17')](_0x53b5ba)[_0xbe1b('0x28')](_0x31bf0a[_0xbe1b('0x2f')][_0xbe1b('0x70')]?{'message':_0xbe1b('0x71'),'statusCode':_0x1c9a1d['statusCode']}:_0x1c9a1d);});}; \ No newline at end of file +var _0x8db4=['getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','send','index','VtigerAccount','rawAttributes','type','key','name','keys','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filters','find','catch','body','getConfigurations','findOne','VtigerConfiguration','order','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','description','remoteUri','serverUrl','accessKey','username','moduleName','slice','substring','format','GET','success','POST','login','result','token','describe','sessionName','reference','owner','includes','remove','editable','false','startsWith','cf_','picklist','picklistValues','vTiger\x20error:\x20','test','statusCode'];(function(_0x233d8f,_0x147d6a){var _0x4428ec=function(_0x53526c){while(--_0x53526c){_0x233d8f['push'](_0x233d8f['shift']());}};_0x4428ec(++_0x147d6a);}(_0x8db4,0x165));var _0x48db=function(_0x14ba9f,_0x15ccec){_0x14ba9f=_0x14ba9f-0x0;var _0x5f33bb=_0x8db4[_0x14ba9f];return _0x5f33bb;};'use strict';var emlformat=require(_0x48db('0x0'));var rimraf=require(_0x48db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48db('0x2'));var rp=require(_0x48db('0x3'));var moment=require(_0x48db('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x48db('0x5'));var path=require(_0x48db('0x6'));var sox=require(_0x48db('0x7'));var csv=require(_0x48db('0x8'));var ejs=require(_0x48db('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48db('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x48db('0xb'));var deskjs=require(_0x48db('0xc'));var toCsv=require(_0x48db('0x8'));var querystring=require('querystring');var Papa=require(_0x48db('0xd'));var Redis=require(_0x48db('0xe'));var authService=require(_0x48db('0xf'));var qs=require(_0x48db('0x10'));var as=require(_0x48db('0x11'));var hardwareService=require(_0x48db('0x12'));var logger=require(_0x48db('0x13'))(_0x48db('0x14'));var utils=require(_0x48db('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x48db('0x16'));var db=require(_0x48db('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5041c2,_0x32aa30){_0x32aa30=_0x32aa30||0xcc;return function(_0x4e3da2){if(_0x4e3da2){return _0x5041c2['sendStatus'](_0x32aa30);}return _0x5041c2[_0x48db('0x18')](_0x32aa30)['end']();};}function respondWithResult(_0x11c920,_0x183e1b){_0x183e1b=_0x183e1b||0xc8;return function(_0x55b246){if(_0x55b246){return _0x11c920[_0x48db('0x18')](_0x183e1b)[_0x48db('0x19')](_0x55b246);}};}function respondWithFilteredResult(_0x4420ee,_0x5a18b0){return function(_0x490e05){if(_0x490e05){var _0x19d5eb=typeof _0x5a18b0[_0x48db('0x1a')]==='undefined'&&typeof _0x5a18b0[_0x48db('0x1b')]==='undefined';var _0x15d484=_0x490e05[_0x48db('0x1c')];var _0x2749a9=_0x19d5eb?0x0:_0x5a18b0[_0x48db('0x1a')];var _0xce120e=_0x19d5eb?_0x490e05[_0x48db('0x1c')]:_0x5a18b0[_0x48db('0x1a')]+_0x5a18b0[_0x48db('0x1b')];var _0x2156e0;if(_0xce120e>=_0x15d484){_0xce120e=_0x15d484;_0x2156e0=0xc8;}else{_0x2156e0=0xce;}_0x4420ee[_0x48db('0x18')](_0x2156e0);return _0x4420ee[_0x48db('0x1d')](_0x48db('0x1e'),_0x2749a9+'-'+_0xce120e+'/'+_0x15d484)['json'](_0x490e05);}return null;};}function patchUpdates(_0x9c9b2){return function(_0x42bcc9){try{jsonpatch[_0x48db('0x1f')](_0x42bcc9,_0x9c9b2,!![]);}catch(_0x380304){return BPromise[_0x48db('0x20')](_0x380304);}return _0x42bcc9['save']();};}function saveUpdates(_0x4d0b38,_0x3e633c){return function(_0x3596e0){if(_0x3596e0){return _0x3596e0[_0x48db('0x21')](_0x4d0b38)['then'](function(_0x172572){return _0x172572;});}return null;};}function removeEntity(_0x118b30,_0x1236df){return function(_0x389bc1){if(_0x389bc1){return _0x389bc1[_0x48db('0x22')]()[_0x48db('0x23')](function(){_0x118b30['status'](0xcc)[_0x48db('0x24')]();});}};}function handleEntityNotFound(_0x1df60e,_0x2f8e9d){return function(_0x43e185){if(!_0x43e185){_0x1df60e['sendStatus'](0x194);}return _0x43e185;};}function handleError(_0x12217d,_0xdc3a71){_0xdc3a71=_0xdc3a71||0x1f4;return function(_0x7d2252){logger[_0x48db('0x25')](_0x7d2252[_0x48db('0x26')]);if(_0x7d2252['name']){delete _0x7d2252['name'];}_0x12217d['status'](_0xdc3a71)[_0x48db('0x27')](_0x7d2252);};}exports[_0x48db('0x28')]=function(_0x325d7a,_0x4a1188){var _0x199661={},_0x30a838={},_0x5846e8={'count':0x0,'rows':[]};var _0x2c7993=_['map'](db[_0x48db('0x29')][_0x48db('0x2a')],function(_0x2fe687){return{'name':_0x2fe687['fieldName'],'type':_0x2fe687[_0x48db('0x2b')][_0x48db('0x2c')]};});_0x30a838['model']=_['map'](_0x2c7993,_0x48db('0x2d'));_0x30a838['query']=_[_0x48db('0x2e')](_0x325d7a['query']);_0x30a838['filters']=_[_0x48db('0x2f')](_0x30a838[_0x48db('0x30')],_0x30a838['query']);_0x199661[_0x48db('0x31')]=_[_0x48db('0x2f')](_0x30a838[_0x48db('0x30')],qs[_0x48db('0x32')](_0x325d7a[_0x48db('0x33')]['fields']));_0x199661[_0x48db('0x31')]=_0x199661['attributes'][_0x48db('0x34')]?_0x199661['attributes']:_0x30a838['model'];if(!_0x325d7a['query'][_0x48db('0x35')](_0x48db('0x36'))){_0x199661[_0x48db('0x1b')]=qs['limit'](_0x325d7a['query']['limit']);_0x199661[_0x48db('0x1a')]=qs[_0x48db('0x1a')](_0x325d7a['query'][_0x48db('0x1a')]);}_0x199661['order']=qs[_0x48db('0x37')](_0x325d7a['query'][_0x48db('0x37')]);_0x199661['where']=qs['filters'](_[_0x48db('0x38')](_0x325d7a[_0x48db('0x33')],_0x30a838['filters']),_0x2c7993);if(_0x325d7a[_0x48db('0x33')][_0x48db('0x39')]){_0x199661['where']=_[_0x48db('0x3a')](_0x199661[_0x48db('0x3b')],{'$or':_[_0x48db('0x3c')](_0x2c7993,function(_0x56e95b){if(_0x56e95b['type']!==_0x48db('0x3d')){var _0x3d0039={};_0x3d0039[_0x56e95b['name']]={'$like':'%'+_0x325d7a[_0x48db('0x33')][_0x48db('0x39')]+'%'};return _0x3d0039;}})});}_0x199661=_[_0x48db('0x3a')]({},_0x199661,_0x325d7a[_0x48db('0x3e')]);var _0x3f19f7={'where':_0x199661['where']};return db[_0x48db('0x29')][_0x48db('0x1c')](_0x3f19f7)['then'](function(_0x40d983){_0x5846e8['count']=_0x40d983;if(_0x325d7a[_0x48db('0x33')][_0x48db('0x3f')]){_0x199661[_0x48db('0x40')]=[{'all':!![]}];}return db[_0x48db('0x29')][_0x48db('0x41')](_0x199661);})[_0x48db('0x23')](function(_0x23d4c6){_0x5846e8[_0x48db('0x42')]=_0x23d4c6;return _0x5846e8;})[_0x48db('0x23')](respondWithFilteredResult(_0x4a1188,_0x199661))['catch'](handleError(_0x4a1188,null));};exports[_0x48db('0x43')]=function(_0x8b3136,_0x23e0c4){var _0x514d57={'raw':![],'where':{'id':_0x8b3136[_0x48db('0x44')]['id']}},_0x3c7341={};_0x3c7341[_0x48db('0x30')]=_[_0x48db('0x2e')](db['VtigerAccount'][_0x48db('0x2a')]);_0x3c7341[_0x48db('0x33')]=_[_0x48db('0x2e')](_0x8b3136[_0x48db('0x33')]);_0x3c7341[_0x48db('0x45')]=_['intersection'](_0x3c7341[_0x48db('0x30')],_0x3c7341['query']);_0x514d57['attributes']=_[_0x48db('0x2f')](_0x3c7341[_0x48db('0x30')],qs['fields'](_0x8b3136['query'][_0x48db('0x32')]));_0x514d57[_0x48db('0x31')]=_0x514d57['attributes'][_0x48db('0x34')]?_0x514d57[_0x48db('0x31')]:_0x3c7341[_0x48db('0x30')];if(_0x8b3136['query'][_0x48db('0x3f')]){_0x514d57[_0x48db('0x40')]=[{'all':!![]}];}_0x514d57=_[_0x48db('0x3a')]({},_0x514d57,_0x8b3136['options']);return db['VtigerAccount'][_0x48db('0x46')](_0x514d57)['then'](handleEntityNotFound(_0x23e0c4,null))[_0x48db('0x23')](respondWithResult(_0x23e0c4,null))[_0x48db('0x47')](handleError(_0x23e0c4,null));};exports['create']=function(_0x22fb09,_0x169cba){return db[_0x48db('0x29')]['create'](_0x22fb09['body'],{})[_0x48db('0x23')](respondWithResult(_0x169cba,0xc9))[_0x48db('0x47')](handleError(_0x169cba,null));};exports[_0x48db('0x21')]=function(_0x7c1a17,_0x254ecb){if(_0x7c1a17[_0x48db('0x48')]['id']){delete _0x7c1a17[_0x48db('0x48')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x7c1a17['params']['id']}})['then'](handleEntityNotFound(_0x254ecb,null))['then'](saveUpdates(_0x7c1a17[_0x48db('0x48')],null))['then'](respondWithResult(_0x254ecb,null))[_0x48db('0x47')](handleError(_0x254ecb,null));};exports['destroy']=function(_0x13afa3,_0x28fe51){return db[_0x48db('0x29')][_0x48db('0x46')]({'where':{'id':_0x13afa3[_0x48db('0x44')]['id']}})[_0x48db('0x23')](handleEntityNotFound(_0x28fe51,null))[_0x48db('0x23')](removeEntity(_0x28fe51,null))[_0x48db('0x47')](handleError(_0x28fe51,null));};exports[_0x48db('0x49')]=function(_0x26cc3b,_0x3bba98,_0x42c6e9){var _0x1dd2d0={};var _0x8480a={};var _0x2213c3;var _0x22a2e8;return db['VtigerAccount'][_0x48db('0x4a')]({'where':{'id':_0x26cc3b['params']['id']}})[_0x48db('0x23')](handleEntityNotFound(_0x3bba98,null))[_0x48db('0x23')](function(_0x2834d9){if(_0x2834d9){_0x2213c3=_0x2834d9;_0x8480a[_0x48db('0x30')]=_[_0x48db('0x2e')](db[_0x48db('0x4b')][_0x48db('0x2a')]);_0x8480a[_0x48db('0x33')]=_[_0x48db('0x2e')](_0x26cc3b[_0x48db('0x33')]);_0x8480a[_0x48db('0x45')]=_[_0x48db('0x2f')](_0x8480a['model'],_0x8480a['query']);_0x1dd2d0[_0x48db('0x31')]=_[_0x48db('0x2f')](_0x8480a[_0x48db('0x30')],qs[_0x48db('0x32')](_0x26cc3b['query'][_0x48db('0x32')]));_0x1dd2d0[_0x48db('0x31')]=_0x1dd2d0[_0x48db('0x31')][_0x48db('0x34')]?_0x1dd2d0[_0x48db('0x31')]:_0x8480a[_0x48db('0x30')];_0x1dd2d0[_0x48db('0x4c')]=qs['sort'](_0x26cc3b[_0x48db('0x33')][_0x48db('0x37')]);_0x1dd2d0[_0x48db('0x3b')]=qs[_0x48db('0x45')](_[_0x48db('0x38')](_0x26cc3b[_0x48db('0x33')],_0x8480a['filters']));if(_0x26cc3b[_0x48db('0x33')][_0x48db('0x39')]){_0x1dd2d0[_0x48db('0x3b')]=_[_0x48db('0x3a')](_0x1dd2d0[_0x48db('0x3b')],{'$or':_[_0x48db('0x3c')](_0x1dd2d0[_0x48db('0x31')],function(_0x13e585){var _0x5e98e8={};_0x5e98e8[_0x13e585]={'$like':'%'+_0x26cc3b[_0x48db('0x33')]['filter']+'%'};return _0x5e98e8;})});}_0x1dd2d0=_[_0x48db('0x3a')]({},_0x1dd2d0,_0x26cc3b['options']);return _0x2213c3[_0x48db('0x49')](_0x1dd2d0);}})[_0x48db('0x23')](function(_0x155391){if(_0x155391){_0x22a2e8=_0x155391['length'];if(!_0x26cc3b['query'][_0x48db('0x35')]('nolimit')){_0x1dd2d0[_0x48db('0x1b')]=qs[_0x48db('0x1b')](_0x26cc3b[_0x48db('0x33')][_0x48db('0x1b')]);_0x1dd2d0[_0x48db('0x1a')]=qs['offset'](_0x26cc3b['query'][_0x48db('0x1a')]);}return _0x2213c3['getConfigurations'](_0x1dd2d0);}})['then'](function(_0x2428b7){if(_0x2428b7){return _0x2428b7?{'count':_0x22a2e8,'rows':_0x2428b7}:null;}})[_0x48db('0x23')](respondWithResult(_0x3bba98,null))[_0x48db('0x47')](handleError(_0x3bba98,null));};exports['addConfiguration']=function(_0x24064e,_0xbdb7e5,_0x5063fc){if(_0x24064e[_0x48db('0x48')]['id']){delete _0x24064e[_0x48db('0x48')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x24064e[_0x48db('0x44')]['id']}})[_0x48db('0x23')](handleEntityNotFound(_0xbdb7e5,null))['then'](function(_0x1817a4){if(_0x1817a4){_0x24064e['body'][_0x48db('0x4d')]=_0x1817a4['id'];_0x24064e[_0x48db('0x48')][_0x48db('0x4e')]=integrations[_0x48db('0x4f')](_0x24064e[_0x48db('0x48')][_0x48db('0x50')],_0x24064e[_0x48db('0x48')][_0x48db('0x2b')]);_0x24064e[_0x48db('0x48')][_0x48db('0x51')]=integrations['getDescriptions'](_0x24064e['body']['channel'],_0x24064e[_0x48db('0x48')][_0x48db('0x2b')]);return db[_0x48db('0x4b')]['create'](_0x24064e[_0x48db('0x48')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x48db('0x52')],'as':'Descriptions'}]});}return null;})[_0x48db('0x23')](respondWithResult(_0xbdb7e5,null))[_0x48db('0x47')](handleError(_0xbdb7e5,null));};var md5=require(_0x48db('0x53'));exports[_0x48db('0x54')]=function(_0xcd0eaf,_0x3594c9,_0x40d480){var _0xe6b72e=null;var _0x2d51bb=null;var _0xdb11a6=null;var _0x595151=null;var _0x36eeff='';return db[_0x48db('0x29')][_0x48db('0x4a')]({'where':{'id':_0xcd0eaf[_0x48db('0x44')]['id']},'attributes':['id',_0x48db('0x2d'),'username',_0x48db('0x55'),'moduleName',_0x48db('0x56'),_0x48db('0x57'),_0x48db('0x58')]})[_0x48db('0x23')](handleEntityNotFound(_0x3594c9,null))[_0x48db('0x23')](function(_0x2cdd68){if(_0x2cdd68){_0xe6b72e=_0x2cdd68[_0x48db('0x59')];_0x2d51bb=_0x2cdd68[_0x48db('0x58')];_0xdb11a6=_0x2cdd68[_0x48db('0x5a')];_0x36eeff=_0x2cdd68['remoteUri'];var _0x1cbe26=_0x36eeff[_0x48db('0x5b')](-0x1);if(_0x1cbe26==='/'){_0x36eeff=_0x36eeff[_0x48db('0x5c')](0x0,_0x36eeff['lastIndexOf'](_0x1cbe26));}_0x595151=util[_0x48db('0x5d')]('%s/webservice.php',_0x36eeff);var _0x1379f0={'method':_0x48db('0x5e'),'uri':_0x595151,'qs':{'operation':'getchallenge','username':_0x2cdd68[_0x48db('0x59')]},'json':!![]};return rp(_0x1379f0);}})['then'](function(_0x355f9e){if(_0x355f9e[_0x48db('0x5f')]){var _0x3a196e={'method':_0x48db('0x60'),'uri':_0x595151,'form':{'operation':_0x48db('0x61'),'username':_0xe6b72e,'accessKey':md5(_0x355f9e[_0x48db('0x62')][_0x48db('0x63')]+_0x2d51bb)},'json':!![]};return rp(_0x3a196e);}})['then'](function(_0x16d74a){if(_0x16d74a[_0x48db('0x5f')]){var _0x45c91f={'method':_0x48db('0x5e'),'uri':_0x595151,'qs':{'operation':_0x48db('0x64'),'username':_0xe6b72e,'sessionName':_0x16d74a[_0x48db('0x62')][_0x48db('0x65')],'elementType':_0xdb11a6},'json':!![]};return rp(_0x45c91f);}})['then'](function(_0x47a5b3){if(_0x47a5b3[_0x48db('0x5f')]){var _0x5caa67=['autogenerated',_0x48db('0x66'),_0x48db('0x67')];_['remove'](_0x47a5b3['result'][_0x48db('0x32')],function(_0x283a09){return _0x5caa67[_0x48db('0x68')](_0x283a09['type'][_0x48db('0x2d')]);});_[_0x48db('0x69')](_0x47a5b3[_0x48db('0x62')][_0x48db('0x32')],function(_0x31e768){return _0x31e768[_0x48db('0x6a')]===_0x48db('0x6b');});return{'count':_0x47a5b3['result'][_0x48db('0x32')][_0x48db('0x34')],'rows':_[_0x48db('0x3c')](_0x47a5b3['result'][_0x48db('0x32')],function(_0x2b9821){return{'id':_0x2b9821[_0x48db('0x2d')],'name':_0x2b9821['label'],'custom':_[_0x48db('0x6c')](_0x2b9821['name'],_0x48db('0x6d'))?!![]:![],'options':_0x2b9821[_0x48db('0x2b')][_0x48db('0x2d')]===_0x48db('0x6e')&&_0x2b9821[_0x48db('0x2b')]['picklistValues'][_0x48db('0x34')]>0x0?_[_0x48db('0x3c')](_0x2b9821[_0x48db('0x2b')][_0x48db('0x6f')],function(_0x349751){return{'name':_0x349751['label'],'value':_0x349751['value']};}):[]};})};}})[_0x48db('0x23')](respondWithResult(_0x3594c9,null))['catch'](function(_0x48d9cb){console['log'](_0x48db('0x70')+_0x48d9cb);var _0x2e7db4=_0xcd0eaf[_0x48db('0x33')][_0x48db('0x71')]?0x1f4:_0x48d9cb[_0x48db('0x72')]||0x1f4;logger[_0x48db('0x25')](_0x48db('0x73'),_0x48db('0x54'),_0x2e7db4,JSON[_0x48db('0x74')](_0x48d9cb));delete _0x48d9cb[_0x48db('0x2d')];if(_0x2e7db4===0x191){_0x2e7db4=0x190;}_0x3594c9[_0x48db('0x18')](_0x2e7db4)[_0x48db('0x27')](_0xcd0eaf[_0x48db('0x33')][_0x48db('0x71')]?{'message':_0x48db('0x75'),'statusCode':_0x48d9cb[_0x48db('0x72')]}:_0x48d9cb);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index c8d6024..a7917e5 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 _0x8ea5=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x32f431,_0x12f4f0){var _0x3c3449=function(_0x12b65f){while(--_0x12b65f){_0x32f431['push'](_0x32f431['shift']());}};_0x3c3449(++_0x12f4f0);}(_0x8ea5,0xf6));var _0x58ea=function(_0x3a24bb,_0x3f7ce9){_0x3a24bb=_0x3a24bb-0x0;var _0x4218ef=_0x8ea5[_0x3a24bb];return _0x4218ef;};'use strict';var _=require(_0x58ea('0x0'));var util=require(_0x58ea('0x1'));var logger=require(_0x58ea('0x2'))(_0x58ea('0x3'));var moment=require(_0x58ea('0x4'));var BPromise=require(_0x58ea('0x5'));var rp=require(_0x58ea('0x6'));var fs=require('fs');var path=require(_0x58ea('0x7'));var rimraf=require(_0x58ea('0x8'));var config=require(_0x58ea('0x9'));var attributes=require(_0x58ea('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1fbb6a,_0x3212f6){return _0x1fbb6a['define']('VtigerAccount',attributes,{'tableName':_0x58ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5e1=['int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x13b8ad,_0x59cb47){var _0x4da238=function(_0xf47525){while(--_0xf47525){_0x13b8ad['push'](_0x13b8ad['shift']());}};_0x4da238(++_0x59cb47);}(_0xa5e1,0x1dd));var _0x1a5e=function(_0x16de43,_0x2bb75f){_0x16de43=_0x16de43-0x0;var _0x2aaa5d=_0xa5e1[_0x16de43];return _0x2aaa5d;};'use strict';var _=require('lodash');var util=require(_0x1a5e('0x0'));var logger=require(_0x1a5e('0x1'))(_0x1a5e('0x2'));var moment=require(_0x1a5e('0x3'));var BPromise=require(_0x1a5e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a5e('0x5'));var rimraf=require(_0x1a5e('0x6'));var config=require(_0x1a5e('0x7'));var attributes=require(_0x1a5e('0x8'));var integrations=require(_0x1a5e('0x9'));module[_0x1a5e('0xa')]=function(_0x2b5785,_0x413ef6){return _0x2b5785[_0x1a5e('0xb')](_0x1a5e('0xc'),attributes,{'tableName':_0x1a5e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 46563c2..cc15579 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 _0x41bb=['../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowVtigerAccount','VtigerAccount','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b3c6f,_0x962d15){var _0x5222d5=function(_0x5bca08){while(--_0x5bca08){_0x2b3c6f['push'](_0x2b3c6f['shift']());}};_0x5222d5(++_0x962d15);}(_0x41bb,0xc5));var _0xb41b=function(_0x5de5f1,_0x59f49a){_0x5de5f1=_0x5de5f1-0x0;var _0x303549=_0x41bb[_0x5de5f1];return _0x303549;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});}exports[_0xb41b('0x15')]=function(_0x47154d){var _0x198783=this;return new Promise(function(_0x5df8c2,_0x4b3580){return db['VtigerAccount'][_0xb41b('0x16')]({'raw':_0x47154d['options']?_0x47154d[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x47154d[_0xb41b('0x17')]?_0x47154d['options']['where']||null:null,'attributes':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'limit':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x1a')]||null:null,'include':_0x47154d['options']?_0x47154d['options'][_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x47154d[_0xb41b('0x17')]['include'],function(_0x14e9c8){return{'model':db[_0x14e9c8[_0xb41b('0x1d')]],'as':_0x14e9c8['as'],'attributes':_0x14e9c8['attributes'],'include':_0x14e9c8[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x14e9c8['include'],function(_0xed3c7e){return{'model':db[_0xed3c7e['model']],'as':_0xed3c7e['as'],'attributes':_0xed3c7e[_0xb41b('0x19')],'include':_0xed3c7e[_0xb41b('0x1b')]?_['map'](_0xed3c7e[_0xb41b('0x1b')],function(_0x4265b8){return{'model':db[_0x4265b8['model']],'as':_0x4265b8['as'],'attributes':_0x4265b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x46aecf){logger[_0xb41b('0xc')](_0xb41b('0x15'),_0x47154d);logger[_0xb41b('0xf')](_0xb41b('0x15'),_0x47154d,JSON[_0xb41b('0x1e')](_0x46aecf));_0x5df8c2(_0x46aecf);})['catch'](function(_0x26ef96){logger[_0xb41b('0x10')]('GetVtigerAccount',_0x26ef96[_0xb41b('0x12')],_0x47154d);_0x4b3580(_0x198783['error'](0x1f4,_0x26ef96[_0xb41b('0x12')]));});});};exports[_0xb41b('0x1f')]=function(_0x597a35){var _0x23a6ed=this;return new Promise(function(_0x4a95e7,_0x29da9f){return db[_0xb41b('0x20')]['find']({'raw':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x21')]||null:null,'attributes':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'include':_0x597a35[_0xb41b('0x17')]?_0x597a35['options'][_0xb41b('0x1b')]?_['map'](_0x597a35['options'][_0xb41b('0x1b')],function(_0x192ceb){return{'model':db[_0x192ceb[_0xb41b('0x1d')]],'as':_0x192ceb['as'],'attributes':_0x192ceb[_0xb41b('0x19')],'include':_0x192ceb[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x192ceb[_0xb41b('0x1b')],function(_0x197197){return{'model':db[_0x197197[_0xb41b('0x1d')]],'as':_0x197197['as'],'attributes':_0x197197[_0xb41b('0x19')],'include':_0x197197[_0xb41b('0x1b')]?_['map'](_0x197197[_0xb41b('0x1b')],function(_0x27990d){return{'model':db[_0x27990d[_0xb41b('0x1d')]],'as':_0x27990d['as'],'attributes':_0x27990d[_0xb41b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x10b3f6){logger['info']('ShowVtigerAccount',_0x597a35);logger[_0xb41b('0xf')](_0xb41b('0x1f'),_0x597a35,JSON['stringify'](_0x10b3f6));_0x4a95e7(_0x10b3f6);})[_0xb41b('0x14')](function(_0x47363e){logger[_0xb41b('0x10')](_0xb41b('0x1f'),_0x47363e[_0xb41b('0x12')],_0x597a35);_0x29da9f(_0x23a6ed['error'](0x1f4,_0x47363e[_0xb41b('0x12')]));});});}; \ No newline at end of file +var _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','catch','VtigerAccount','findAll','options','raw','limit','include','model','attributes','map','then','GetVtigerAccount','stringify','ShowVtigerAccount'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0x5eb8[_0x3daa8c];return _0x2b1bd7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetVtigerAccount']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetVtigerAccount',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowVtigerAccount',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index bd1179e..9331919 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 _0x0745=['/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get'];(function(_0x138b2c,_0x142181){var _0xa8b921=function(_0xc1799e){while(--_0xc1799e){_0x138b2c['push'](_0x138b2c['shift']());}};_0xa8b921(++_0x142181);}(_0x0745,0xd3));var _0x5074=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0745[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5074('0x0'));var timeout=require(_0x5074('0x1'));var express=require(_0x5074('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5074('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5074('0x4'));var controller=require(_0x5074('0x5'));router['get']('/',auth[_0x5074('0x6')](),controller[_0x5074('0x7')]);router[_0x5074('0x8')](_0x5074('0x9'),auth[_0x5074('0x6')](),controller[_0x5074('0xa')]);router[_0x5074('0x8')]('/:id/fields',auth[_0x5074('0x6')](),controller['getFields']);router[_0x5074('0x8')](_0x5074('0xb'),auth[_0x5074('0x6')](),controller[_0x5074('0xc')]);router['get'](_0x5074('0xd'),auth['isAuthenticated'](),controller[_0x5074('0xe')]);router[_0x5074('0xf')]('/',auth[_0x5074('0x6')](),controller[_0x5074('0x10')]);router['put'](_0x5074('0x9'),auth['isAuthenticated'](),controller[_0x5074('0x11')]);router['delete']('/:id',auth[_0x5074('0x6')](),controller[_0x5074('0x12')]);module[_0x5074('0x13')]=router; \ No newline at end of file +var _0x38ca=['fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','connect-timeout','Router'];(function(_0x567d9f,_0x44354c){var _0x28ab37=function(_0x1870ad){while(--_0x1870ad){_0x567d9f['push'](_0x567d9f['shift']());}};_0x28ab37(++_0x44354c);}(_0x38ca,0x1f2));var _0xa38c=function(_0x32cf96,_0x7502d5){_0x32cf96=_0x32cf96-0x0;var _0x125cc1=_0x38ca[_0x32cf96];return _0x125cc1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa38c('0x0'));var express=require('express');var router=express[_0xa38c('0x1')]();var fs_extra=require(_0xa38c('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa38c('0x3'));var controller=require(_0xa38c('0x4'));router[_0xa38c('0x5')]('/',auth[_0xa38c('0x6')](),controller[_0xa38c('0x7')]);router[_0xa38c('0x5')](_0xa38c('0x8'),auth[_0xa38c('0x6')](),controller[_0xa38c('0x9')]);router[_0xa38c('0x5')](_0xa38c('0xa'),auth[_0xa38c('0x6')](),controller['getFields']);router[_0xa38c('0x5')](_0xa38c('0xb'),auth[_0xa38c('0x6')](),controller[_0xa38c('0xc')]);router['get'](_0xa38c('0xd'),auth[_0xa38c('0x6')](),controller['getDescriptions']);router[_0xa38c('0xe')]('/',auth[_0xa38c('0x6')](),controller[_0xa38c('0xf')]);router[_0xa38c('0x10')]('/:id',auth[_0xa38c('0x6')](),controller['update']);router[_0xa38c('0x11')](_0xa38c('0x8'),auth['isAuthenticated'](),controller[_0xa38c('0x12')]);module[_0xa38c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 9a485af..2335e02 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 _0x7cdd=['STRING','exports'];(function(_0x1d22f1,_0x294910){var _0x3e1d58=function(_0x1e14ba){while(--_0x1e14ba){_0x1d22f1['push'](_0x1d22f1['shift']());}};_0x3e1d58(++_0x294910);}(_0x7cdd,0x1e7));var _0xd7cd=function(_0x2de9f1,_0x5ce468){_0x2de9f1=_0x2de9f1-0x0;var _0x1a5a2a=_0x7cdd[_0x2de9f1];return _0x1a5a2a;};'use strict';var Sequelize=require('sequelize');module[_0xd7cd('0x0')]={'name':{'type':Sequelize[_0xd7cd('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5749=['sequelize','exports','STRING'];(function(_0x3ae3bf,_0x2c3a77){var _0x4fa308=function(_0x290e50){while(--_0x290e50){_0x3ae3bf['push'](_0x3ae3bf['shift']());}};_0x4fa308(++_0x2c3a77);}(_0x5749,0xde));var _0x9574=function(_0x1fc8cd,_0x405ddf){_0x1fc8cd=_0x1fc8cd-0x0;var _0x2fd158=_0x5749[_0x1fc8cd];return _0x2fd158;};'use strict';var Sequelize=require(_0x9574('0x0'));module[_0x9574('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9574('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 935eff1..1418ceb 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 _0x68ef=['catch','update','body','findOne','order','getFields','nolimit','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','then','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','filters','find'];(function(_0xde3c67,_0x3b05bf){var _0x104b85=function(_0x5e2f14){while(--_0x5e2f14){_0xde3c67['push'](_0xde3c67['shift']());}};_0x104b85(++_0x3b05bf);}(_0x68ef,0x9e));var _0xf68e=function(_0x7b879b,_0x484731){_0x7b879b=_0x7b879b-0x0;var _0x23916a=_0x68ef[_0x7b879b];return _0x23916a;};'use strict';var emlformat=require(_0xf68e('0x0'));var rimraf=require(_0xf68e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf68e('0x2'));var rp=require(_0xf68e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf68e('0x4'));var util=require(_0xf68e('0x5'));var path=require(_0xf68e('0x6'));var sox=require(_0xf68e('0x7'));var csv=require(_0xf68e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf68e('0x9'));var squel=require(_0xf68e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf68e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf68e('0xc'));var Papa=require(_0xf68e('0xd'));var Redis=require(_0xf68e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf68e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf68e('0x10'));var logger=require(_0xf68e('0x11'))(_0xf68e('0x12'));var utils=require(_0xf68e('0x13'));var config=require(_0xf68e('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35506b,_0x5c99da){_0x5c99da=_0x5c99da||0xcc;return function(_0x1f4aaa){if(_0x1f4aaa){return _0x35506b[_0xf68e('0x15')](_0x5c99da);}return _0x35506b[_0xf68e('0x16')](_0x5c99da)['end']();};}function respondWithResult(_0x5f381a,_0x4af727){_0x4af727=_0x4af727||0xc8;return function(_0x5a473c){if(_0x5a473c){return _0x5f381a[_0xf68e('0x16')](_0x4af727)[_0xf68e('0x17')](_0x5a473c);}};}function respondWithFilteredResult(_0x1b9b6c,_0x4bb810){return function(_0x514262){if(_0x514262){var _0x12d605=typeof _0x4bb810['offset']===_0xf68e('0x18')&&typeof _0x4bb810[_0xf68e('0x19')]===_0xf68e('0x18');var _0x25a259=_0x514262[_0xf68e('0x1a')];var _0x3c8f8a=_0x12d605?0x0:_0x4bb810[_0xf68e('0x1b')];var _0x123a43=_0x12d605?_0x514262[_0xf68e('0x1a')]:_0x4bb810[_0xf68e('0x1b')]+_0x4bb810[_0xf68e('0x19')];var _0xffbad2;if(_0x123a43>=_0x25a259){_0x123a43=_0x25a259;_0xffbad2=0xc8;}else{_0xffbad2=0xce;}_0x1b9b6c[_0xf68e('0x16')](_0xffbad2);return _0x1b9b6c[_0xf68e('0x1c')](_0xf68e('0x1d'),_0x3c8f8a+'-'+_0x123a43+'/'+_0x25a259)[_0xf68e('0x17')](_0x514262);}return null;};}function patchUpdates(_0x2df1bf){return function(_0x582e4c){try{jsonpatch[_0xf68e('0x1e')](_0x582e4c,_0x2df1bf,!![]);}catch(_0x99d31c){return BPromise['reject'](_0x99d31c);}return _0x582e4c[_0xf68e('0x1f')]();};}function saveUpdates(_0x36eeac,_0x1ac9f7){return function(_0x196c41){if(_0x196c41){return _0x196c41['update'](_0x36eeac)['then'](function(_0x5a9103){return _0x5a9103;});}return null;};}function removeEntity(_0x2f365b,_0x5cba9b){return function(_0x45b7c1){if(_0x45b7c1){return _0x45b7c1[_0xf68e('0x20')]()[_0xf68e('0x21')](function(){_0x2f365b[_0xf68e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43394c,_0x1f7d04){return function(_0x570c32){if(!_0x570c32){_0x43394c[_0xf68e('0x15')](0x194);}return _0x570c32;};}function handleError(_0x532776,_0x36ca64){_0x36ca64=_0x36ca64||0x1f4;return function(_0x5e1f16){logger['error'](_0x5e1f16[_0xf68e('0x22')]);if(_0x5e1f16[_0xf68e('0x23')]){delete _0x5e1f16['name'];}_0x532776[_0xf68e('0x16')](_0x36ca64)[_0xf68e('0x24')](_0x5e1f16);};}exports[_0xf68e('0x25')]=function(_0xb8aa,_0x4530ad){var _0x572a85={},_0x79fa88={},_0x424cc6={'count':0x0,'rows':[]};var _0x34dce5=_['map'](db[_0xf68e('0x26')][_0xf68e('0x27')],function(_0x3d956f){return{'name':_0x3d956f[_0xf68e('0x28')],'type':_0x3d956f[_0xf68e('0x29')]['key']};});_0x79fa88['model']=_[_0xf68e('0x2a')](_0x34dce5,'name');_0x79fa88[_0xf68e('0x2b')]=_[_0xf68e('0x2c')](_0xb8aa[_0xf68e('0x2b')]);_0x79fa88['filters']=_[_0xf68e('0x2d')](_0x79fa88[_0xf68e('0x2e')],_0x79fa88[_0xf68e('0x2b')]);_0x572a85[_0xf68e('0x2f')]=_['intersection'](_0x79fa88[_0xf68e('0x2e')],qs[_0xf68e('0x30')](_0xb8aa['query']['fields']));_0x572a85['attributes']=_0x572a85[_0xf68e('0x2f')][_0xf68e('0x31')]?_0x572a85[_0xf68e('0x2f')]:_0x79fa88['model'];if(!_0xb8aa['query'][_0xf68e('0x32')]('nolimit')){_0x572a85[_0xf68e('0x19')]=qs['limit'](_0xb8aa['query'][_0xf68e('0x19')]);_0x572a85[_0xf68e('0x1b')]=qs[_0xf68e('0x1b')](_0xb8aa['query'][_0xf68e('0x1b')]);}_0x572a85['order']=qs['sort'](_0xb8aa['query'][_0xf68e('0x33')]);_0x572a85[_0xf68e('0x34')]=qs['filters'](_[_0xf68e('0x35')](_0xb8aa[_0xf68e('0x2b')],_0x79fa88['filters']),_0x34dce5);if(_0xb8aa['query'][_0xf68e('0x36')]){_0x572a85['where']=_['merge'](_0x572a85[_0xf68e('0x34')],{'$or':_[_0xf68e('0x2a')](_0x34dce5,function(_0x46749f){if(_0x46749f['type']!=='VIRTUAL'){var _0x1c70f2={};_0x1c70f2[_0x46749f[_0xf68e('0x23')]]={'$like':'%'+_0xb8aa['query'][_0xf68e('0x36')]+'%'};return _0x1c70f2;}})});}_0x572a85=_[_0xf68e('0x37')]({},_0x572a85,_0xb8aa[_0xf68e('0x38')]);var _0x11621d={'where':_0x572a85[_0xf68e('0x34')]};return db['VtigerConfiguration']['count'](_0x11621d)['then'](function(_0x5249d9){_0x424cc6[_0xf68e('0x1a')]=_0x5249d9;if(_0xb8aa[_0xf68e('0x2b')][_0xf68e('0x39')]){_0x572a85[_0xf68e('0x3a')]=[{'all':!![]}];}return db[_0xf68e('0x26')][_0xf68e('0x3b')](_0x572a85);})[_0xf68e('0x21')](function(_0x12a58c){_0x424cc6['rows']=_0x12a58c;return _0x424cc6;})[_0xf68e('0x21')](respondWithFilteredResult(_0x4530ad,_0x572a85))['catch'](handleError(_0x4530ad,null));};exports[_0xf68e('0x3c')]=function(_0x329726,_0x520380){var _0x27fcf0={'raw':![],'where':{'id':_0x329726[_0xf68e('0x3d')]['id']}},_0xef52bc={};_0xef52bc[_0xf68e('0x2e')]=_[_0xf68e('0x2c')](db[_0xf68e('0x26')][_0xf68e('0x27')]);_0xef52bc[_0xf68e('0x2b')]=_[_0xf68e('0x2c')](_0x329726[_0xf68e('0x2b')]);_0xef52bc[_0xf68e('0x3e')]=_[_0xf68e('0x2d')](_0xef52bc[_0xf68e('0x2e')],_0xef52bc[_0xf68e('0x2b')]);_0x27fcf0[_0xf68e('0x2f')]=_[_0xf68e('0x2d')](_0xef52bc[_0xf68e('0x2e')],qs['fields'](_0x329726[_0xf68e('0x2b')]['fields']));_0x27fcf0[_0xf68e('0x2f')]=_0x27fcf0[_0xf68e('0x2f')][_0xf68e('0x31')]?_0x27fcf0[_0xf68e('0x2f')]:_0xef52bc['model'];if(_0x329726[_0xf68e('0x2b')][_0xf68e('0x39')]){_0x27fcf0[_0xf68e('0x3a')]=[{'all':!![]}];}_0x27fcf0=_['merge']({},_0x27fcf0,_0x329726[_0xf68e('0x38')]);return db[_0xf68e('0x26')][_0xf68e('0x3f')](_0x27fcf0)[_0xf68e('0x21')](handleEntityNotFound(_0x520380,null))[_0xf68e('0x21')](respondWithResult(_0x520380,null))[_0xf68e('0x40')](handleError(_0x520380,null));};exports['create']=function(_0x2c9e06,_0xa050ed){return db[_0xf68e('0x26')]['create'](_0x2c9e06['body'],{})[_0xf68e('0x21')](respondWithResult(_0xa050ed,0xc9))[_0xf68e('0x40')](handleError(_0xa050ed,null));};exports[_0xf68e('0x41')]=function(_0x45e475,_0x2a92af){if(_0x45e475[_0xf68e('0x42')]['id']){delete _0x45e475[_0xf68e('0x42')]['id'];}return db[_0xf68e('0x26')][_0xf68e('0x3f')]({'where':{'id':_0x45e475['params']['id']}})[_0xf68e('0x21')](handleEntityNotFound(_0x2a92af,null))['then'](saveUpdates(_0x45e475[_0xf68e('0x42')],null))['then'](respondWithResult(_0x2a92af,null))['catch'](handleError(_0x2a92af,null));};exports[_0xf68e('0x20')]=function(_0x5e7588,_0x37a63c){return db[_0xf68e('0x26')]['find']({'where':{'id':_0x5e7588[_0xf68e('0x3d')]['id']}})[_0xf68e('0x21')](handleEntityNotFound(_0x37a63c,null))[_0xf68e('0x21')](removeEntity(_0x37a63c,null))[_0xf68e('0x40')](handleError(_0x37a63c,null));};exports['getFields']=function(_0x52fe7f,_0xd21bbf,_0x145da8){var _0x332f68={};var _0x579cb9={};var _0x408159;var _0x13a043;return db['VtigerConfiguration'][_0xf68e('0x43')]({'where':{'id':_0x52fe7f[_0xf68e('0x3d')]['id']}})[_0xf68e('0x21')](handleEntityNotFound(_0xd21bbf,null))['then'](function(_0x874b3d){if(_0x874b3d){_0x408159=_0x874b3d;_0x579cb9[_0xf68e('0x2e')]=_[_0xf68e('0x2c')](db['VtigerField'][_0xf68e('0x27')]);_0x579cb9[_0xf68e('0x2b')]=_[_0xf68e('0x2c')](_0x52fe7f[_0xf68e('0x2b')]);_0x579cb9[_0xf68e('0x3e')]=_[_0xf68e('0x2d')](_0x579cb9['model'],_0x579cb9[_0xf68e('0x2b')]);_0x332f68[_0xf68e('0x2f')]=_['intersection'](_0x579cb9[_0xf68e('0x2e')],qs[_0xf68e('0x30')](_0x52fe7f[_0xf68e('0x2b')][_0xf68e('0x30')]));_0x332f68['attributes']=_0x332f68[_0xf68e('0x2f')]['length']?_0x332f68[_0xf68e('0x2f')]:_0x579cb9[_0xf68e('0x2e')];_0x332f68[_0xf68e('0x44')]=qs[_0xf68e('0x33')](_0x52fe7f[_0xf68e('0x2b')][_0xf68e('0x33')]);_0x332f68[_0xf68e('0x34')]=qs['filters'](_[_0xf68e('0x35')](_0x52fe7f['query'],_0x579cb9[_0xf68e('0x3e')]));if(_0x52fe7f['query'][_0xf68e('0x36')]){_0x332f68[_0xf68e('0x34')]=_[_0xf68e('0x37')](_0x332f68['where'],{'$or':_[_0xf68e('0x2a')](_0x332f68[_0xf68e('0x2f')],function(_0x59011b){var _0x40bca3={};_0x40bca3[_0x59011b]={'$like':'%'+_0x52fe7f[_0xf68e('0x2b')]['filter']+'%'};return _0x40bca3;})});}_0x332f68=_['merge']({},_0x332f68,_0x52fe7f[_0xf68e('0x38')]);return _0x408159[_0xf68e('0x45')](_0x332f68);}})[_0xf68e('0x21')](function(_0xda5e4b){if(_0xda5e4b){_0x13a043=_0xda5e4b[_0xf68e('0x31')];if(!_0x52fe7f[_0xf68e('0x2b')][_0xf68e('0x32')](_0xf68e('0x46'))){_0x332f68['limit']=qs[_0xf68e('0x19')](_0x52fe7f['query'][_0xf68e('0x19')]);_0x332f68['offset']=qs[_0xf68e('0x1b')](_0x52fe7f[_0xf68e('0x2b')][_0xf68e('0x1b')]);}return _0x408159[_0xf68e('0x45')](_0x332f68);}})[_0xf68e('0x21')](function(_0x2ebbe1){if(_0x2ebbe1){return _0x2ebbe1?{'count':_0x13a043,'rows':_0x2ebbe1}:null;}})['then'](respondWithResult(_0xd21bbf,null))['catch'](handleError(_0xd21bbf,null));};exports[_0xf68e('0x47')]=function(_0x451d56,_0x4f8a3d,_0x67ed62){var _0x4efe5b={};var _0x5ea527={};var _0x1ca7ae;var _0x18964f;return db[_0xf68e('0x26')][_0xf68e('0x43')]({'where':{'id':_0x451d56[_0xf68e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4f8a3d,null))[_0xf68e('0x21')](function(_0x746f96){if(_0x746f96){_0x1ca7ae=_0x746f96;_0x5ea527['model']=_[_0xf68e('0x2c')](db[_0xf68e('0x48')][_0xf68e('0x27')]);_0x5ea527[_0xf68e('0x2b')]=_['keys'](_0x451d56['query']);_0x5ea527[_0xf68e('0x3e')]=_['intersection'](_0x5ea527[_0xf68e('0x2e')],_0x5ea527[_0xf68e('0x2b')]);_0x4efe5b[_0xf68e('0x2f')]=_[_0xf68e('0x2d')](_0x5ea527['model'],qs[_0xf68e('0x30')](_0x451d56[_0xf68e('0x2b')][_0xf68e('0x30')]));_0x4efe5b[_0xf68e('0x2f')]=_0x4efe5b[_0xf68e('0x2f')]['length']?_0x4efe5b['attributes']:_0x5ea527[_0xf68e('0x2e')];_0x4efe5b[_0xf68e('0x44')]=qs[_0xf68e('0x33')](_0x451d56[_0xf68e('0x2b')][_0xf68e('0x33')]);_0x4efe5b[_0xf68e('0x34')]=qs['filters'](_[_0xf68e('0x35')](_0x451d56['query'],_0x5ea527['filters']));if(_0x451d56[_0xf68e('0x2b')][_0xf68e('0x36')]){_0x4efe5b[_0xf68e('0x34')]=_[_0xf68e('0x37')](_0x4efe5b[_0xf68e('0x34')],{'$or':_[_0xf68e('0x2a')](_0x4efe5b[_0xf68e('0x2f')],function(_0x5940ce){var _0x472e7e={};_0x472e7e[_0x5940ce]={'$like':'%'+_0x451d56['query']['filter']+'%'};return _0x472e7e;})});}_0x4efe5b=_[_0xf68e('0x37')]({},_0x4efe5b,_0x451d56[_0xf68e('0x38')]);return _0x1ca7ae[_0xf68e('0x47')](_0x4efe5b);}})['then'](function(_0x3f9c6d){if(_0x3f9c6d){_0x18964f=_0x3f9c6d[_0xf68e('0x31')];if(!_0x451d56['query'][_0xf68e('0x32')]('nolimit')){_0x4efe5b[_0xf68e('0x19')]=qs['limit'](_0x451d56['query'][_0xf68e('0x19')]);_0x4efe5b['offset']=qs[_0xf68e('0x1b')](_0x451d56[_0xf68e('0x2b')][_0xf68e('0x1b')]);}return _0x1ca7ae[_0xf68e('0x47')](_0x4efe5b);}})['then'](function(_0x3e89dd){if(_0x3e89dd){return _0x3e89dd?{'count':_0x18964f,'rows':_0x3e89dd}:null;}})[_0xf68e('0x21')](respondWithResult(_0x4f8a3d,null))[_0xf68e('0x40')](handleError(_0x4f8a3d,null));};exports[_0xf68e('0x49')]=function(_0x519cad,_0x4eec4d,_0x3fb5ff){var _0x5a3cfa={};var _0x3509d6={};var _0x59f5ed;var _0x5814c6;return db['VtigerConfiguration'][_0xf68e('0x43')]({'where':{'id':_0x519cad[_0xf68e('0x3d')]['id']}})[_0xf68e('0x21')](handleEntityNotFound(_0x4eec4d,null))['then'](function(_0x1b75ab){if(_0x1b75ab){_0x59f5ed=_0x1b75ab;_0x3509d6['model']=_[_0xf68e('0x2c')](db[_0xf68e('0x48')][_0xf68e('0x27')]);_0x3509d6['query']=_[_0xf68e('0x2c')](_0x519cad[_0xf68e('0x2b')]);_0x3509d6[_0xf68e('0x3e')]=_[_0xf68e('0x2d')](_0x3509d6[_0xf68e('0x2e')],_0x3509d6[_0xf68e('0x2b')]);_0x5a3cfa[_0xf68e('0x2f')]=_[_0xf68e('0x2d')](_0x3509d6[_0xf68e('0x2e')],qs[_0xf68e('0x30')](_0x519cad[_0xf68e('0x2b')][_0xf68e('0x30')]));_0x5a3cfa['attributes']=_0x5a3cfa[_0xf68e('0x2f')][_0xf68e('0x31')]?_0x5a3cfa[_0xf68e('0x2f')]:_0x3509d6[_0xf68e('0x2e')];_0x5a3cfa[_0xf68e('0x44')]=qs[_0xf68e('0x33')](_0x519cad[_0xf68e('0x2b')][_0xf68e('0x33')]);_0x5a3cfa[_0xf68e('0x34')]=qs[_0xf68e('0x3e')](_[_0xf68e('0x35')](_0x519cad['query'],_0x3509d6[_0xf68e('0x3e')]));if(_0x519cad[_0xf68e('0x2b')][_0xf68e('0x36')]){_0x5a3cfa[_0xf68e('0x34')]=_[_0xf68e('0x37')](_0x5a3cfa[_0xf68e('0x34')],{'$or':_[_0xf68e('0x2a')](_0x5a3cfa[_0xf68e('0x2f')],function(_0x22026b){var _0x22e49a={};_0x22e49a[_0x22026b]={'$like':'%'+_0x519cad[_0xf68e('0x2b')]['filter']+'%'};return _0x22e49a;})});}_0x5a3cfa=_[_0xf68e('0x37')]({},_0x5a3cfa,_0x519cad[_0xf68e('0x38')]);return _0x59f5ed[_0xf68e('0x49')](_0x5a3cfa);}})['then'](function(_0x199586){if(_0x199586){_0x5814c6=_0x199586[_0xf68e('0x31')];if(!_0x519cad[_0xf68e('0x2b')]['hasOwnProperty']('nolimit')){_0x5a3cfa['limit']=qs[_0xf68e('0x19')](_0x519cad[_0xf68e('0x2b')][_0xf68e('0x19')]);_0x5a3cfa[_0xf68e('0x1b')]=qs['offset'](_0x519cad[_0xf68e('0x2b')][_0xf68e('0x1b')]);}return _0x59f5ed[_0xf68e('0x49')](_0x5a3cfa);}})[_0xf68e('0x21')](function(_0x3d0ad2){if(_0x3d0ad2){return _0x3d0ad2?{'count':_0x5814c6,'rows':_0x3d0ad2}:null;}})[_0xf68e('0x21')](respondWithResult(_0x4eec4d,null))['catch'](handleError(_0x4eec4d,null));}; \ No newline at end of file +var _0x3e0f=['catch','show','params','find','create','body','update','destroy','getFields','findOne','VtigerField','rawAttributes','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0x3e0f,0xfc));var _0xf3e0=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x3e0f[_0x4aa4e6];return _0x322588;};'use strict';var emlformat=require(_0xf3e0('0x0'));var rimraf=require(_0xf3e0('0x1'));var zipdir=require(_0xf3e0('0x2'));var jsonpatch=require(_0xf3e0('0x3'));var rp=require('request-promise');var moment=require(_0xf3e0('0x4'));var BPromise=require(_0xf3e0('0x5'));var Mustache=require('mustache');var util=require(_0xf3e0('0x6'));var path=require(_0xf3e0('0x7'));var sox=require(_0xf3e0('0x8'));var csv=require(_0xf3e0('0x9'));var ejs=require(_0xf3e0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf3e0('0xb'));var crypto=require(_0xf3e0('0xc'));var jsforce=require(_0xf3e0('0xd'));var deskjs=require(_0xf3e0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf3e0('0xf'));var Papa=require(_0xf3e0('0x10'));var Redis=require(_0xf3e0('0x11'));var authService=require(_0xf3e0('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3e0('0x13'));var logger=require('../../config/logger')(_0xf3e0('0x14'));var utils=require(_0xf3e0('0x15'));var config=require(_0xf3e0('0x16'));var licenseUtil=require(_0xf3e0('0x17'));var db=require(_0xf3e0('0x18'))['db'];function respondWithStatusCode(_0x526a5a,_0x18245b){_0x18245b=_0x18245b||0xcc;return function(_0x3089ce){if(_0x3089ce){return _0x526a5a['sendStatus'](_0x18245b);}return _0x526a5a[_0xf3e0('0x19')](_0x18245b)[_0xf3e0('0x1a')]();};}function respondWithResult(_0x432d67,_0x3b33d9){_0x3b33d9=_0x3b33d9||0xc8;return function(_0x6636d2){if(_0x6636d2){return _0x432d67[_0xf3e0('0x19')](_0x3b33d9)[_0xf3e0('0x1b')](_0x6636d2);}};}function respondWithFilteredResult(_0x3daa67,_0x64d4e4){return function(_0x1a3321){if(_0x1a3321){var _0x124acf=typeof _0x64d4e4[_0xf3e0('0x1c')]===_0xf3e0('0x1d')&&typeof _0x64d4e4[_0xf3e0('0x1e')]===_0xf3e0('0x1d');var _0x277264=_0x1a3321[_0xf3e0('0x1f')];var _0x53348d=_0x124acf?0x0:_0x64d4e4[_0xf3e0('0x1c')];var _0x3c26d6=_0x124acf?_0x1a3321['count']:_0x64d4e4['offset']+_0x64d4e4[_0xf3e0('0x1e')];var _0x4f4e9d;if(_0x3c26d6>=_0x277264){_0x3c26d6=_0x277264;_0x4f4e9d=0xc8;}else{_0x4f4e9d=0xce;}_0x3daa67[_0xf3e0('0x19')](_0x4f4e9d);return _0x3daa67['set'](_0xf3e0('0x20'),_0x53348d+'-'+_0x3c26d6+'/'+_0x277264)[_0xf3e0('0x1b')](_0x1a3321);}return null;};}function patchUpdates(_0x20350e){return function(_0x3a1fba){try{jsonpatch['apply'](_0x3a1fba,_0x20350e,!![]);}catch(_0x2ba33a){return BPromise[_0xf3e0('0x21')](_0x2ba33a);}return _0x3a1fba['save']();};}function saveUpdates(_0x12bd9e,_0x7a9393){return function(_0x5bee36){if(_0x5bee36){return _0x5bee36['update'](_0x12bd9e)[_0xf3e0('0x22')](function(_0x38bfe1){return _0x38bfe1;});}return null;};}function removeEntity(_0x2f8141,_0x7ec83){return function(_0x12080f){if(_0x12080f){return _0x12080f['destroy']()[_0xf3e0('0x22')](function(){_0x2f8141[_0xf3e0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e81af,_0x1800bf){return function(_0x35c413){if(!_0x35c413){_0x2e81af[_0xf3e0('0x23')](0x194);}return _0x35c413;};}function handleError(_0x5311a9,_0x48297e){_0x48297e=_0x48297e||0x1f4;return function(_0xa082aa){logger[_0xf3e0('0x24')](_0xa082aa[_0xf3e0('0x25')]);if(_0xa082aa[_0xf3e0('0x26')]){delete _0xa082aa[_0xf3e0('0x26')];}_0x5311a9[_0xf3e0('0x19')](_0x48297e)[_0xf3e0('0x27')](_0xa082aa);};}exports[_0xf3e0('0x28')]=function(_0x3b6980,_0x7e8a60){var _0x39c8ab={},_0x58fad7={},_0x4f8d43={'count':0x0,'rows':[]};var _0xf08903=_[_0xf3e0('0x29')](db[_0xf3e0('0x2a')]['rawAttributes'],function(_0x436dc6){return{'name':_0x436dc6['fieldName'],'type':_0x436dc6[_0xf3e0('0x2b')]['key']};});_0x58fad7[_0xf3e0('0x2c')]=_[_0xf3e0('0x29')](_0xf08903,_0xf3e0('0x26'));_0x58fad7[_0xf3e0('0x2d')]=_[_0xf3e0('0x2e')](_0x3b6980[_0xf3e0('0x2d')]);_0x58fad7[_0xf3e0('0x2f')]=_[_0xf3e0('0x30')](_0x58fad7['model'],_0x58fad7['query']);_0x39c8ab[_0xf3e0('0x31')]=_[_0xf3e0('0x30')](_0x58fad7[_0xf3e0('0x2c')],qs['fields'](_0x3b6980[_0xf3e0('0x2d')][_0xf3e0('0x32')]));_0x39c8ab[_0xf3e0('0x31')]=_0x39c8ab[_0xf3e0('0x31')][_0xf3e0('0x33')]?_0x39c8ab['attributes']:_0x58fad7[_0xf3e0('0x2c')];if(!_0x3b6980[_0xf3e0('0x2d')][_0xf3e0('0x34')]('nolimit')){_0x39c8ab[_0xf3e0('0x1e')]=qs[_0xf3e0('0x1e')](_0x3b6980[_0xf3e0('0x2d')][_0xf3e0('0x1e')]);_0x39c8ab[_0xf3e0('0x1c')]=qs['offset'](_0x3b6980[_0xf3e0('0x2d')][_0xf3e0('0x1c')]);}_0x39c8ab[_0xf3e0('0x35')]=qs['sort'](_0x3b6980['query'][_0xf3e0('0x36')]);_0x39c8ab[_0xf3e0('0x37')]=qs[_0xf3e0('0x2f')](_[_0xf3e0('0x38')](_0x3b6980[_0xf3e0('0x2d')],_0x58fad7[_0xf3e0('0x2f')]),_0xf08903);if(_0x3b6980[_0xf3e0('0x2d')][_0xf3e0('0x39')]){_0x39c8ab[_0xf3e0('0x37')]=_[_0xf3e0('0x3a')](_0x39c8ab['where'],{'$or':_[_0xf3e0('0x29')](_0xf08903,function(_0x28dbe4){if(_0x28dbe4['type']!==_0xf3e0('0x3b')){var _0x4046ef={};_0x4046ef[_0x28dbe4['name']]={'$like':'%'+_0x3b6980['query'][_0xf3e0('0x39')]+'%'};return _0x4046ef;}})});}_0x39c8ab=_[_0xf3e0('0x3a')]({},_0x39c8ab,_0x3b6980[_0xf3e0('0x3c')]);var _0x2d5876={'where':_0x39c8ab[_0xf3e0('0x37')]};return db['VtigerConfiguration'][_0xf3e0('0x1f')](_0x2d5876)[_0xf3e0('0x22')](function(_0x5a97df){_0x4f8d43[_0xf3e0('0x1f')]=_0x5a97df;if(_0x3b6980[_0xf3e0('0x2d')][_0xf3e0('0x3d')]){_0x39c8ab[_0xf3e0('0x3e')]=[{'all':!![]}];}return db[_0xf3e0('0x2a')]['findAll'](_0x39c8ab);})[_0xf3e0('0x22')](function(_0x58076c){_0x4f8d43[_0xf3e0('0x3f')]=_0x58076c;return _0x4f8d43;})[_0xf3e0('0x22')](respondWithFilteredResult(_0x7e8a60,_0x39c8ab))[_0xf3e0('0x40')](handleError(_0x7e8a60,null));};exports[_0xf3e0('0x41')]=function(_0x514531,_0x8a84fc){var _0x5b4371={'raw':![],'where':{'id':_0x514531[_0xf3e0('0x42')]['id']}},_0x5641f9={};_0x5641f9[_0xf3e0('0x2c')]=_[_0xf3e0('0x2e')](db[_0xf3e0('0x2a')]['rawAttributes']);_0x5641f9[_0xf3e0('0x2d')]=_['keys'](_0x514531[_0xf3e0('0x2d')]);_0x5641f9[_0xf3e0('0x2f')]=_[_0xf3e0('0x30')](_0x5641f9['model'],_0x5641f9[_0xf3e0('0x2d')]);_0x5b4371[_0xf3e0('0x31')]=_['intersection'](_0x5641f9[_0xf3e0('0x2c')],qs[_0xf3e0('0x32')](_0x514531[_0xf3e0('0x2d')][_0xf3e0('0x32')]));_0x5b4371[_0xf3e0('0x31')]=_0x5b4371['attributes'][_0xf3e0('0x33')]?_0x5b4371[_0xf3e0('0x31')]:_0x5641f9[_0xf3e0('0x2c')];if(_0x514531[_0xf3e0('0x2d')][_0xf3e0('0x3d')]){_0x5b4371[_0xf3e0('0x3e')]=[{'all':!![]}];}_0x5b4371=_[_0xf3e0('0x3a')]({},_0x5b4371,_0x514531[_0xf3e0('0x3c')]);return db['VtigerConfiguration'][_0xf3e0('0x43')](_0x5b4371)[_0xf3e0('0x22')](handleEntityNotFound(_0x8a84fc,null))['then'](respondWithResult(_0x8a84fc,null))['catch'](handleError(_0x8a84fc,null));};exports[_0xf3e0('0x44')]=function(_0x1d15d6,_0x1ea8ed){return db[_0xf3e0('0x2a')][_0xf3e0('0x44')](_0x1d15d6[_0xf3e0('0x45')],{})[_0xf3e0('0x22')](respondWithResult(_0x1ea8ed,0xc9))['catch'](handleError(_0x1ea8ed,null));};exports[_0xf3e0('0x46')]=function(_0x2addaf,_0xc37c85){if(_0x2addaf[_0xf3e0('0x45')]['id']){delete _0x2addaf['body']['id'];}return db[_0xf3e0('0x2a')][_0xf3e0('0x43')]({'where':{'id':_0x2addaf[_0xf3e0('0x42')]['id']}})[_0xf3e0('0x22')](handleEntityNotFound(_0xc37c85,null))['then'](saveUpdates(_0x2addaf[_0xf3e0('0x45')],null))[_0xf3e0('0x22')](respondWithResult(_0xc37c85,null))[_0xf3e0('0x40')](handleError(_0xc37c85,null));};exports[_0xf3e0('0x47')]=function(_0x117625,_0x3b3957){return db[_0xf3e0('0x2a')][_0xf3e0('0x43')]({'where':{'id':_0x117625[_0xf3e0('0x42')]['id']}})[_0xf3e0('0x22')](handleEntityNotFound(_0x3b3957,null))['then'](removeEntity(_0x3b3957,null))[_0xf3e0('0x40')](handleError(_0x3b3957,null));};exports[_0xf3e0('0x48')]=function(_0x27e7ff,_0x5853bc,_0x4a0ff2){var _0x5d9bed={};var _0x53225a={};var _0x720ec1;var _0xb25243;return db[_0xf3e0('0x2a')][_0xf3e0('0x49')]({'where':{'id':_0x27e7ff[_0xf3e0('0x42')]['id']}})[_0xf3e0('0x22')](handleEntityNotFound(_0x5853bc,null))[_0xf3e0('0x22')](function(_0x45ba97){if(_0x45ba97){_0x720ec1=_0x45ba97;_0x53225a[_0xf3e0('0x2c')]=_[_0xf3e0('0x2e')](db[_0xf3e0('0x4a')][_0xf3e0('0x4b')]);_0x53225a[_0xf3e0('0x2d')]=_[_0xf3e0('0x2e')](_0x27e7ff[_0xf3e0('0x2d')]);_0x53225a[_0xf3e0('0x2f')]=_[_0xf3e0('0x30')](_0x53225a['model'],_0x53225a[_0xf3e0('0x2d')]);_0x5d9bed[_0xf3e0('0x31')]=_[_0xf3e0('0x30')](_0x53225a[_0xf3e0('0x2c')],qs[_0xf3e0('0x32')](_0x27e7ff['query']['fields']));_0x5d9bed['attributes']=_0x5d9bed[_0xf3e0('0x31')][_0xf3e0('0x33')]?_0x5d9bed['attributes']:_0x53225a[_0xf3e0('0x2c')];_0x5d9bed['order']=qs[_0xf3e0('0x36')](_0x27e7ff[_0xf3e0('0x2d')][_0xf3e0('0x36')]);_0x5d9bed[_0xf3e0('0x37')]=qs[_0xf3e0('0x2f')](_[_0xf3e0('0x38')](_0x27e7ff[_0xf3e0('0x2d')],_0x53225a[_0xf3e0('0x2f')]));if(_0x27e7ff[_0xf3e0('0x2d')][_0xf3e0('0x39')]){_0x5d9bed['where']=_['merge'](_0x5d9bed[_0xf3e0('0x37')],{'$or':_[_0xf3e0('0x29')](_0x5d9bed[_0xf3e0('0x31')],function(_0x36c65a){var _0x277613={};_0x277613[_0x36c65a]={'$like':'%'+_0x27e7ff[_0xf3e0('0x2d')][_0xf3e0('0x39')]+'%'};return _0x277613;})});}_0x5d9bed=_[_0xf3e0('0x3a')]({},_0x5d9bed,_0x27e7ff[_0xf3e0('0x3c')]);return _0x720ec1['getFields'](_0x5d9bed);}})[_0xf3e0('0x22')](function(_0x280045){if(_0x280045){_0xb25243=_0x280045[_0xf3e0('0x33')];if(!_0x27e7ff['query'][_0xf3e0('0x34')](_0xf3e0('0x4c'))){_0x5d9bed['limit']=qs[_0xf3e0('0x1e')](_0x27e7ff[_0xf3e0('0x2d')][_0xf3e0('0x1e')]);_0x5d9bed[_0xf3e0('0x1c')]=qs['offset'](_0x27e7ff[_0xf3e0('0x2d')][_0xf3e0('0x1c')]);}return _0x720ec1[_0xf3e0('0x48')](_0x5d9bed);}})['then'](function(_0x511674){if(_0x511674){return _0x511674?{'count':_0xb25243,'rows':_0x511674}:null;}})['then'](respondWithResult(_0x5853bc,null))[_0xf3e0('0x40')](handleError(_0x5853bc,null));};exports[_0xf3e0('0x4d')]=function(_0x46eadd,_0x3d4595,_0x1fc140){var _0x564ce5={};var _0x255665={};var _0x19c7f0;var _0xd4dbb2;return db['VtigerConfiguration'][_0xf3e0('0x49')]({'where':{'id':_0x46eadd[_0xf3e0('0x42')]['id']}})[_0xf3e0('0x22')](handleEntityNotFound(_0x3d4595,null))[_0xf3e0('0x22')](function(_0x1f0112){if(_0x1f0112){_0x19c7f0=_0x1f0112;_0x255665[_0xf3e0('0x2c')]=_[_0xf3e0('0x2e')](db[_0xf3e0('0x4a')]['rawAttributes']);_0x255665[_0xf3e0('0x2d')]=_[_0xf3e0('0x2e')](_0x46eadd['query']);_0x255665[_0xf3e0('0x2f')]=_['intersection'](_0x255665[_0xf3e0('0x2c')],_0x255665[_0xf3e0('0x2d')]);_0x564ce5[_0xf3e0('0x31')]=_['intersection'](_0x255665[_0xf3e0('0x2c')],qs[_0xf3e0('0x32')](_0x46eadd[_0xf3e0('0x2d')]['fields']));_0x564ce5[_0xf3e0('0x31')]=_0x564ce5['attributes'][_0xf3e0('0x33')]?_0x564ce5['attributes']:_0x255665[_0xf3e0('0x2c')];_0x564ce5[_0xf3e0('0x35')]=qs['sort'](_0x46eadd[_0xf3e0('0x2d')][_0xf3e0('0x36')]);_0x564ce5['where']=qs['filters'](_[_0xf3e0('0x38')](_0x46eadd[_0xf3e0('0x2d')],_0x255665[_0xf3e0('0x2f')]));if(_0x46eadd[_0xf3e0('0x2d')][_0xf3e0('0x39')]){_0x564ce5[_0xf3e0('0x37')]=_[_0xf3e0('0x3a')](_0x564ce5[_0xf3e0('0x37')],{'$or':_[_0xf3e0('0x29')](_0x564ce5[_0xf3e0('0x31')],function(_0x50a91b){var _0x52e39b={};_0x52e39b[_0x50a91b]={'$like':'%'+_0x46eadd['query'][_0xf3e0('0x39')]+'%'};return _0x52e39b;})});}_0x564ce5=_[_0xf3e0('0x3a')]({},_0x564ce5,_0x46eadd[_0xf3e0('0x3c')]);return _0x19c7f0['getSubjects'](_0x564ce5);}})['then'](function(_0x50ae81){if(_0x50ae81){_0xd4dbb2=_0x50ae81[_0xf3e0('0x33')];if(!_0x46eadd[_0xf3e0('0x2d')][_0xf3e0('0x34')]('nolimit')){_0x564ce5[_0xf3e0('0x1e')]=qs[_0xf3e0('0x1e')](_0x46eadd[_0xf3e0('0x2d')][_0xf3e0('0x1e')]);_0x564ce5[_0xf3e0('0x1c')]=qs[_0xf3e0('0x1c')](_0x46eadd[_0xf3e0('0x2d')]['offset']);}return _0x19c7f0[_0xf3e0('0x4d')](_0x564ce5);}})['then'](function(_0x637675){if(_0x637675){return _0x637675?{'count':_0xd4dbb2,'rows':_0x637675}:null;}})[_0xf3e0('0x22')](respondWithResult(_0x3d4595,null))['catch'](handleError(_0x3d4595,null));};exports[_0xf3e0('0x4e')]=function(_0x51e00e,_0x2d02ab,_0x39506d){var _0xe1b760={};var _0x411026={};var _0x53ca82;var _0x59ae7e;return db[_0xf3e0('0x2a')][_0xf3e0('0x49')]({'where':{'id':_0x51e00e['params']['id']}})[_0xf3e0('0x22')](handleEntityNotFound(_0x2d02ab,null))[_0xf3e0('0x22')](function(_0x1ec84c){if(_0x1ec84c){_0x53ca82=_0x1ec84c;_0x411026[_0xf3e0('0x2c')]=_[_0xf3e0('0x2e')](db[_0xf3e0('0x4a')][_0xf3e0('0x4b')]);_0x411026[_0xf3e0('0x2d')]=_[_0xf3e0('0x2e')](_0x51e00e[_0xf3e0('0x2d')]);_0x411026[_0xf3e0('0x2f')]=_['intersection'](_0x411026[_0xf3e0('0x2c')],_0x411026[_0xf3e0('0x2d')]);_0xe1b760[_0xf3e0('0x31')]=_[_0xf3e0('0x30')](_0x411026[_0xf3e0('0x2c')],qs[_0xf3e0('0x32')](_0x51e00e[_0xf3e0('0x2d')][_0xf3e0('0x32')]));_0xe1b760[_0xf3e0('0x31')]=_0xe1b760[_0xf3e0('0x31')]['length']?_0xe1b760[_0xf3e0('0x31')]:_0x411026['model'];_0xe1b760['order']=qs[_0xf3e0('0x36')](_0x51e00e[_0xf3e0('0x2d')]['sort']);_0xe1b760['where']=qs[_0xf3e0('0x2f')](_['pick'](_0x51e00e[_0xf3e0('0x2d')],_0x411026[_0xf3e0('0x2f')]));if(_0x51e00e[_0xf3e0('0x2d')][_0xf3e0('0x39')]){_0xe1b760['where']=_['merge'](_0xe1b760['where'],{'$or':_[_0xf3e0('0x29')](_0xe1b760[_0xf3e0('0x31')],function(_0x79bff0){var _0x4c55ab={};_0x4c55ab[_0x79bff0]={'$like':'%'+_0x51e00e[_0xf3e0('0x2d')][_0xf3e0('0x39')]+'%'};return _0x4c55ab;})});}_0xe1b760=_['merge']({},_0xe1b760,_0x51e00e[_0xf3e0('0x3c')]);return _0x53ca82[_0xf3e0('0x4e')](_0xe1b760);}})[_0xf3e0('0x22')](function(_0xe5b54d){if(_0xe5b54d){_0x59ae7e=_0xe5b54d[_0xf3e0('0x33')];if(!_0x51e00e[_0xf3e0('0x2d')][_0xf3e0('0x34')](_0xf3e0('0x4c'))){_0xe1b760[_0xf3e0('0x1e')]=qs[_0xf3e0('0x1e')](_0x51e00e[_0xf3e0('0x2d')]['limit']);_0xe1b760['offset']=qs[_0xf3e0('0x1c')](_0x51e00e[_0xf3e0('0x2d')][_0xf3e0('0x1c')]);}return _0x53ca82[_0xf3e0('0x4e')](_0xe1b760);}})[_0xf3e0('0x22')](function(_0x5a8c41){if(_0x5a8c41){return _0x5a8c41?{'count':_0x59ae7e,'rows':_0x5a8c41}:null;}})[_0xf3e0('0x22')](respondWithResult(_0x2d02ab,null))[_0xf3e0('0x40')](handleError(_0x2d02ab,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2bc7519..f85bdc9 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 _0x08ec=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x2e542b,_0xfd7e95){var _0x453bf1=function(_0x203f20){while(--_0x203f20){_0x2e542b['push'](_0x2e542b['shift']());}};_0x453bf1(++_0xfd7e95);}(_0x08ec,0x141));var _0xc08e=function(_0x2ea05b,_0x515e3e){_0x2ea05b=_0x2ea05b-0x0;var _0x12c50c=_0x08ec[_0x2ea05b];return _0x12c50c;};'use strict';var _=require(_0xc08e('0x0'));var util=require('util');var logger=require(_0xc08e('0x1'))(_0xc08e('0x2'));var moment=require(_0xc08e('0x3'));var BPromise=require(_0xc08e('0x4'));var rp=require(_0xc08e('0x5'));var fs=require('fs');var path=require(_0xc08e('0x6'));var rimraf=require(_0xc08e('0x7'));var config=require(_0xc08e('0x8'));var attributes=require(_0xc08e('0x9'));module[_0xc08e('0xa')]=function(_0x28f980,_0x38c0e5){return _0x28f980[_0xc08e('0xb')](_0xc08e('0xc'),attributes,{'tableName':_0xc08e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e4f=['api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6e4f,0x15b));var _0xf6e4=function(_0x4f7cac,_0x458a03){_0x4f7cac=_0x4f7cac-0x0;var _0x30b5e9=_0x6e4f[_0x4f7cac];return _0x30b5e9;};'use strict';var _=require('lodash');var util=require(_0xf6e4('0x0'));var logger=require('../../config/logger')(_0xf6e4('0x1'));var moment=require(_0xf6e4('0x2'));var BPromise=require(_0xf6e4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6e4('0x4'));var rimraf=require(_0xf6e4('0x5'));var config=require(_0xf6e4('0x6'));var attributes=require(_0xf6e4('0x7'));module[_0xf6e4('0x8')]=function(_0x1b4f2d,_0x384114){return _0x1b4f2d[_0xf6e4('0x9')](_0xf6e4('0xa'),attributes,{'tableName':_0xf6e4('0xb'),'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 bda6b0b..5ed2d02 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 _0xb4ad=['http','request','then','info','debug','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','request\x20sent','catch','util','moment','randomstring','../../mysqldb','../../config/logger','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4ad,0x13d));var _0xdb4a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb4ad[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xdb4a('0x0'));var moment=require(_0xdb4a('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb4a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb4a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb4a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb4a('0x5')][_0xdb4a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2ac81a,_0x3825ee,_0x33adec){return new BPromise(function(_0x809ace,_0x5363b7){return client[_0xdb4a('0x7')](_0x2ac81a,_0x33adec)[_0xdb4a('0x8')](function(_0xd5d3be){logger[_0xdb4a('0x9')]('VtigerConfiguration,\x20%s,\x20%s',_0x3825ee,'request\x20sent');logger[_0xdb4a('0xa')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3825ee,'request\x20sent',JSON[_0xdb4a('0xb')](_0xd5d3be));if(_0xd5d3be[_0xdb4a('0xc')]){if(_0xd5d3be[_0xdb4a('0xc')]['code']===0x1f4){logger[_0xdb4a('0xc')](_0xdb4a('0xd'),_0x3825ee,_0xd5d3be[_0xdb4a('0xc')][_0xdb4a('0xe')]);return _0x5363b7(_0xd5d3be[_0xdb4a('0xc')][_0xdb4a('0xe')]);}logger[_0xdb4a('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x3825ee,_0xd5d3be['error'][_0xdb4a('0xe')]);return _0x809ace(_0xd5d3be['error']['message']);}else{logger[_0xdb4a('0x9')](_0xdb4a('0xd'),_0x3825ee,_0xdb4a('0xf'));_0x809ace(_0xd5d3be['result']['message']);}})[_0xdb4a('0x10')](function(_0x4b2a24){logger[_0xdb4a('0xc')](_0xdb4a('0xd'),_0x3825ee,_0x4b2a24);_0x5363b7(_0x4b2a24);});});} \ No newline at end of file +var _0xc9db=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','moment'];(function(_0x30ac6b,_0x4d914c){var _0x38ea8c=function(_0x42ee31){while(--_0x42ee31){_0x30ac6b['push'](_0x30ac6b['shift']());}};_0x38ea8c(++_0x4d914c);}(_0xc9db,0x15e));var _0xbc9d=function(_0x10369e,_0x4b9ef8){_0x10369e=_0x10369e-0x0;var _0x32a79e=_0xc9db[_0x10369e];return _0x32a79e;};'use strict';var _=require(_0xbc9d('0x0'));var util=require('util');var moment=require(_0xbc9d('0x1'));var BPromise=require(_0xbc9d('0x2'));var rs=require(_0xbc9d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc9d('0x4'))['db'];var utils=require(_0xbc9d('0x5'));var logger=require(_0xbc9d('0x6'))(_0xbc9d('0x7'));var config=require(_0xbc9d('0x8'));var jayson=require(_0xbc9d('0x9'));var client=jayson[_0xbc9d('0xa')][_0xbc9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x645b41,_0x2db632,_0x4a3f63){return new BPromise(function(_0x57d2b6,_0x3e8cb2){return client[_0xbc9d('0xc')](_0x645b41,_0x4a3f63)[_0xbc9d('0xd')](function(_0x1824c3){logger['info'](_0xbc9d('0xe'),_0x2db632,_0xbc9d('0xf'));logger[_0xbc9d('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2db632,_0xbc9d('0xf'),JSON[_0xbc9d('0x11')](_0x1824c3));if(_0x1824c3[_0xbc9d('0x12')]){if(_0x1824c3[_0xbc9d('0x12')][_0xbc9d('0x13')]===0x1f4){logger[_0xbc9d('0x12')](_0xbc9d('0xe'),_0x2db632,_0x1824c3[_0xbc9d('0x12')]['message']);return _0x3e8cb2(_0x1824c3[_0xbc9d('0x12')][_0xbc9d('0x14')]);}logger['error'](_0xbc9d('0xe'),_0x2db632,_0x1824c3[_0xbc9d('0x12')][_0xbc9d('0x14')]);return _0x57d2b6(_0x1824c3['error'][_0xbc9d('0x14')]);}else{logger[_0xbc9d('0x15')](_0xbc9d('0xe'),_0x2db632,_0xbc9d('0xf'));_0x57d2b6(_0x1824c3['result']['message']);}})['catch'](function(_0x1cd513){logger[_0xbc9d('0x12')](_0xbc9d('0xe'),_0x2db632,_0x1cd513);_0x3e8cb2(_0x1cd513);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index d39365f..121303e 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 _0x7aae=['connect-timeout','express','fs-extra','../../components/auth/service','index','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x369890,_0x332ed2){var _0x210ff3=function(_0x2d53da){while(--_0x2d53da){_0x369890['push'](_0x369890['shift']());}};_0x210ff3(++_0x332ed2);}(_0x7aae,0x189));var _0xe7aa=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7aae[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xe7aa('0x0'));var util=require(_0xe7aa('0x1'));var path=require(_0xe7aa('0x2'));var timeout=require(_0xe7aa('0x3'));var express=require(_0xe7aa('0x4'));var router=express['Router']();var fs_extra=require(_0xe7aa('0x5'));var auth=require(_0xe7aa('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe7aa('0x7')]);router[_0xe7aa('0x8')](_0xe7aa('0x9'),auth[_0xe7aa('0xa')](),controller[_0xe7aa('0xb')]);router[_0xe7aa('0xc')]('/',auth[_0xe7aa('0xa')](),controller[_0xe7aa('0xd')]);router[_0xe7aa('0xe')](_0xe7aa('0x9'),auth[_0xe7aa('0xa')](),controller['update']);router[_0xe7aa('0xf')](_0xe7aa('0x9'),auth[_0xe7aa('0xa')](),controller[_0xe7aa('0x10')]);module[_0xe7aa('0x11')]=router; \ No newline at end of file +var _0xd6c2=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy'];(function(_0x442556,_0xb32e25){var _0x4dcc8c=function(_0x3dfeae){while(--_0x3dfeae){_0x442556['push'](_0x442556['shift']());}};_0x4dcc8c(++_0xb32e25);}(_0xd6c2,0xd2));var _0x2d6c=function(_0x313e4c,_0x5c14e2){_0x313e4c=_0x313e4c-0x0;var _0x10169c=_0xd6c2[_0x313e4c];return _0x10169c;};'use strict';var multer=require(_0x2d6c('0x0'));var util=require(_0x2d6c('0x1'));var path=require(_0x2d6c('0x2'));var timeout=require(_0x2d6c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2d6c('0x4'));var auth=require(_0x2d6c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2d6c('0x6'));var controller=require(_0x2d6c('0x7'));router['get']('/',auth[_0x2d6c('0x8')](),controller[_0x2d6c('0x9')]);router[_0x2d6c('0xa')](_0x2d6c('0xb'),auth[_0x2d6c('0x8')](),controller[_0x2d6c('0xc')]);router['post']('/',auth[_0x2d6c('0x8')](),controller[_0x2d6c('0xd')]);router[_0x2d6c('0xe')](_0x2d6c('0xb'),auth[_0x2d6c('0x8')](),controller[_0x2d6c('0xf')]);router[_0x2d6c('0x10')]('/:id',auth[_0x2d6c('0x8')](),controller[_0x2d6c('0x11')]);module[_0x2d6c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c1b5578..c981b75 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 _0xbb1a=['sequelize','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x18551d,_0x209929){var _0x533122=function(_0x57ec2d){while(--_0x57ec2d){_0x18551d['push'](_0x18551d['shift']());}};_0x533122(++_0x209929);}(_0xbb1a,0xd2));var _0xabb1=function(_0x3af60d,_0x20d250){_0x3af60d=_0x3af60d-0x0;var _0x1f8767=_0xbb1a[_0x3af60d];return _0x1f8767;};'use strict';var Sequelize=require(_0xabb1('0x0'));module['exports']={'type':{'type':Sequelize[_0xabb1('0x1')](_0xabb1('0x2'),_0xabb1('0x3'),_0xabb1('0x4'),'keyValue','picklist'),'defaultValue':_0xabb1('0x2')},'content':{'type':Sequelize[_0xabb1('0x5')]},'key':{'type':Sequelize[_0xabb1('0x5')]},'keyType':{'type':Sequelize[_0xabb1('0x1')]('string',_0xabb1('0x3'),_0xabb1('0x4'))},'keyContent':{'type':Sequelize[_0xabb1('0x5')]},'idField':{'type':Sequelize[_0xabb1('0x5')]},'nameField':{'type':Sequelize[_0xabb1('0x5')]},'customField':{'type':Sequelize[_0xabb1('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5188=['sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x365bfc,_0x4491e4){var _0x323af1=function(_0x8e62a5){while(--_0x8e62a5){_0x365bfc['push'](_0x365bfc['shift']());}};_0x323af1(++_0x4491e4);}(_0x5188,0xb6));var _0x8518=function(_0x30809a,_0x186fd8){_0x30809a=_0x30809a-0x0;var _0x4feaf6=_0x5188[_0x30809a];return _0x4feaf6;};'use strict';var Sequelize=require(_0x8518('0x0'));module['exports']={'type':{'type':Sequelize[_0x8518('0x1')](_0x8518('0x2'),_0x8518('0x3'),_0x8518('0x4'),'keyValue',_0x8518('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8518('0x6')]},'key':{'type':Sequelize[_0x8518('0x6')]},'keyType':{'type':Sequelize[_0x8518('0x1')](_0x8518('0x2'),_0x8518('0x3'),_0x8518('0x4'))},'keyContent':{'type':Sequelize[_0x8518('0x6')]},'idField':{'type':Sequelize[_0x8518('0x6')]},'nameField':{'type':Sequelize[_0x8518('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8518('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 94a0821..c85ae7e 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 _0x5a60=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x860ac4,_0x569dba){var _0x16ee1d=function(_0x16da0d){while(--_0x16da0d){_0x860ac4['push'](_0x860ac4['shift']());}};_0x16ee1d(++_0x569dba);}(_0x5a60,0xc3));var _0x05a6=function(_0x3ad88a,_0x486645){_0x3ad88a=_0x3ad88a-0x0;var _0x26490f=_0x5a60[_0x3ad88a];return _0x26490f;};'use strict';var emlformat=require(_0x05a6('0x0'));var rimraf=require(_0x05a6('0x1'));var zipdir=require(_0x05a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05a6('0x3'));var moment=require(_0x05a6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x05a6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x05a6('0x6'));var ejs=require(_0x05a6('0x7'));var fs=require('fs');var fs_extra=require(_0x05a6('0x8'));var _=require(_0x05a6('0x9'));var squel=require(_0x05a6('0xa'));var crypto=require(_0x05a6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x05a6('0x6'));var querystring=require(_0x05a6('0xc'));var Papa=require('papaparse');var Redis=require(_0x05a6('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x05a6('0xe'));var as=require(_0x05a6('0xf'));var hardwareService=require(_0x05a6('0x10'));var logger=require(_0x05a6('0x11'))(_0x05a6('0x12'));var utils=require('../../config/utils');var config=require(_0x05a6('0x13'));var licenseUtil=require(_0x05a6('0x14'));var db=require(_0x05a6('0x15'))['db'];function respondWithStatusCode(_0x59bc21,_0x2fe267){_0x2fe267=_0x2fe267||0xcc;return function(_0x2009d7){if(_0x2009d7){return _0x59bc21[_0x05a6('0x16')](_0x2fe267);}return _0x59bc21[_0x05a6('0x17')](_0x2fe267)['end']();};}function respondWithResult(_0x550109,_0x340899){_0x340899=_0x340899||0xc8;return function(_0x55e0d4){if(_0x55e0d4){return _0x550109['status'](_0x340899)[_0x05a6('0x18')](_0x55e0d4);}};}function respondWithFilteredResult(_0x493eac,_0x5dc778){return function(_0x10ad05){if(_0x10ad05){var _0x4b912f=typeof _0x5dc778[_0x05a6('0x19')]===_0x05a6('0x1a')&&typeof _0x5dc778[_0x05a6('0x1b')]===_0x05a6('0x1a');var _0x157acb=_0x10ad05['count'];var _0x11f322=_0x4b912f?0x0:_0x5dc778['offset'];var _0x142fc9=_0x4b912f?_0x10ad05[_0x05a6('0x1c')]:_0x5dc778[_0x05a6('0x19')]+_0x5dc778[_0x05a6('0x1b')];var _0x727b45;if(_0x142fc9>=_0x157acb){_0x142fc9=_0x157acb;_0x727b45=0xc8;}else{_0x727b45=0xce;}_0x493eac[_0x05a6('0x17')](_0x727b45);return _0x493eac[_0x05a6('0x1d')](_0x05a6('0x1e'),_0x11f322+'-'+_0x142fc9+'/'+_0x157acb)[_0x05a6('0x18')](_0x10ad05);}return null;};}function patchUpdates(_0x4a2112){return function(_0x4c0fba){try{jsonpatch[_0x05a6('0x1f')](_0x4c0fba,_0x4a2112,!![]);}catch(_0x387e04){return BPromise['reject'](_0x387e04);}return _0x4c0fba[_0x05a6('0x20')]();};}function saveUpdates(_0x5ed5a8,_0xd5047f){return function(_0x5b9d7a){if(_0x5b9d7a){return _0x5b9d7a[_0x05a6('0x21')](_0x5ed5a8)[_0x05a6('0x22')](function(_0x159e5b){return _0x159e5b;});}return null;};}function removeEntity(_0x66ff22,_0xb41c4c){return function(_0x568211){if(_0x568211){return _0x568211[_0x05a6('0x23')]()[_0x05a6('0x22')](function(){_0x66ff22[_0x05a6('0x17')](0xcc)[_0x05a6('0x24')]();});}};}function handleEntityNotFound(_0x1c06df,_0x2fe724){return function(_0x1eed63){if(!_0x1eed63){_0x1c06df[_0x05a6('0x16')](0x194);}return _0x1eed63;};}function handleError(_0x531632,_0x1586e8){_0x1586e8=_0x1586e8||0x1f4;return function(_0x2c14af){logger['error'](_0x2c14af['stack']);if(_0x2c14af['name']){delete _0x2c14af[_0x05a6('0x25')];}_0x531632[_0x05a6('0x17')](_0x1586e8)[_0x05a6('0x26')](_0x2c14af);};}exports[_0x05a6('0x27')]=function(_0x2b7796,_0x2d7f7f){var _0x5b23dd={},_0x5b9254={},_0x5efc25={'count':0x0,'rows':[]};var _0x5080a1=_[_0x05a6('0x28')](db[_0x05a6('0x29')][_0x05a6('0x2a')],function(_0x41b634){return{'name':_0x41b634[_0x05a6('0x2b')],'type':_0x41b634[_0x05a6('0x2c')][_0x05a6('0x2d')]};});_0x5b9254[_0x05a6('0x2e')]=_['map'](_0x5080a1,_0x05a6('0x25'));_0x5b9254[_0x05a6('0x2f')]=_[_0x05a6('0x30')](_0x2b7796[_0x05a6('0x2f')]);_0x5b9254[_0x05a6('0x31')]=_[_0x05a6('0x32')](_0x5b9254[_0x05a6('0x2e')],_0x5b9254[_0x05a6('0x2f')]);_0x5b23dd['attributes']=_[_0x05a6('0x32')](_0x5b9254['model'],qs[_0x05a6('0x33')](_0x2b7796[_0x05a6('0x2f')]['fields']));_0x5b23dd[_0x05a6('0x34')]=_0x5b23dd[_0x05a6('0x34')][_0x05a6('0x35')]?_0x5b23dd[_0x05a6('0x34')]:_0x5b9254[_0x05a6('0x2e')];if(!_0x2b7796[_0x05a6('0x2f')][_0x05a6('0x36')](_0x05a6('0x37'))){_0x5b23dd[_0x05a6('0x1b')]=qs[_0x05a6('0x1b')](_0x2b7796[_0x05a6('0x2f')][_0x05a6('0x1b')]);_0x5b23dd[_0x05a6('0x19')]=qs[_0x05a6('0x19')](_0x2b7796['query'][_0x05a6('0x19')]);}_0x5b23dd[_0x05a6('0x38')]=qs[_0x05a6('0x39')](_0x2b7796[_0x05a6('0x2f')][_0x05a6('0x39')]);_0x5b23dd[_0x05a6('0x3a')]=qs['filters'](_[_0x05a6('0x3b')](_0x2b7796[_0x05a6('0x2f')],_0x5b9254[_0x05a6('0x31')]),_0x5080a1);if(_0x2b7796[_0x05a6('0x2f')][_0x05a6('0x3c')]){_0x5b23dd[_0x05a6('0x3a')]=_[_0x05a6('0x3d')](_0x5b23dd['where'],{'$or':_[_0x05a6('0x28')](_0x5080a1,function(_0x32fa54){if(_0x32fa54[_0x05a6('0x2c')]!==_0x05a6('0x3e')){var _0x1eda33={};_0x1eda33[_0x32fa54['name']]={'$like':'%'+_0x2b7796['query'][_0x05a6('0x3c')]+'%'};return _0x1eda33;}})});}_0x5b23dd=_[_0x05a6('0x3d')]({},_0x5b23dd,_0x2b7796['options']);var _0x378750={'where':_0x5b23dd[_0x05a6('0x3a')]};return db[_0x05a6('0x29')][_0x05a6('0x1c')](_0x378750)['then'](function(_0x8e57d7){_0x5efc25[_0x05a6('0x1c')]=_0x8e57d7;if(_0x2b7796[_0x05a6('0x2f')][_0x05a6('0x3f')]){_0x5b23dd['include']=[{'all':!![]}];}return db[_0x05a6('0x29')]['findAll'](_0x5b23dd);})[_0x05a6('0x22')](function(_0xd4c298){_0x5efc25[_0x05a6('0x40')]=_0xd4c298;return _0x5efc25;})[_0x05a6('0x22')](respondWithFilteredResult(_0x2d7f7f,_0x5b23dd))['catch'](handleError(_0x2d7f7f,null));};exports[_0x05a6('0x41')]=function(_0x3ce9be,_0x27b064){var _0x4be7a5={'raw':!![],'where':{'id':_0x3ce9be[_0x05a6('0x42')]['id']}},_0x4d6578={};_0x4d6578[_0x05a6('0x2e')]=_[_0x05a6('0x30')](db['VtigerField']['rawAttributes']);_0x4d6578[_0x05a6('0x2f')]=_[_0x05a6('0x30')](_0x3ce9be[_0x05a6('0x2f')]);_0x4d6578['filters']=_['intersection'](_0x4d6578[_0x05a6('0x2e')],_0x4d6578[_0x05a6('0x2f')]);_0x4be7a5[_0x05a6('0x34')]=_[_0x05a6('0x32')](_0x4d6578['model'],qs[_0x05a6('0x33')](_0x3ce9be[_0x05a6('0x2f')][_0x05a6('0x33')]));_0x4be7a5[_0x05a6('0x34')]=_0x4be7a5[_0x05a6('0x34')][_0x05a6('0x35')]?_0x4be7a5[_0x05a6('0x34')]:_0x4d6578[_0x05a6('0x2e')];if(_0x3ce9be[_0x05a6('0x2f')][_0x05a6('0x3f')]){_0x4be7a5[_0x05a6('0x43')]=[{'all':!![]}];}_0x4be7a5=_[_0x05a6('0x3d')]({},_0x4be7a5,_0x3ce9be[_0x05a6('0x44')]);return db[_0x05a6('0x29')][_0x05a6('0x45')](_0x4be7a5)[_0x05a6('0x22')](handleEntityNotFound(_0x27b064,null))[_0x05a6('0x22')](respondWithResult(_0x27b064,null))[_0x05a6('0x46')](handleError(_0x27b064,null));};exports['create']=function(_0x1a7876,_0xb545f7){return db[_0x05a6('0x29')][_0x05a6('0x47')](_0x1a7876[_0x05a6('0x48')],{})[_0x05a6('0x22')](respondWithResult(_0xb545f7,0xc9))[_0x05a6('0x46')](handleError(_0xb545f7,null));};exports[_0x05a6('0x21')]=function(_0x4f5bac,_0x268fed){if(_0x4f5bac['body']['id']){delete _0x4f5bac[_0x05a6('0x48')]['id'];}return db[_0x05a6('0x29')]['find']({'where':{'id':_0x4f5bac['params']['id']}})[_0x05a6('0x22')](handleEntityNotFound(_0x268fed,null))['then'](saveUpdates(_0x4f5bac[_0x05a6('0x48')],null))[_0x05a6('0x22')](respondWithResult(_0x268fed,null))[_0x05a6('0x46')](handleError(_0x268fed,null));};exports[_0x05a6('0x23')]=function(_0x329002,_0x4f98a7){return db[_0x05a6('0x29')][_0x05a6('0x45')]({'where':{'id':_0x329002[_0x05a6('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f98a7,null))[_0x05a6('0x22')](removeEntity(_0x4f98a7,null))[_0x05a6('0x46')](handleError(_0x4f98a7,null));}; \ No newline at end of file +var _0x6242=['nolimit','order','sort','filters','filter','where','merge','options','VtigerField','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','intersection','query','attributes','fields','length'];(function(_0x556406,_0x3ff527){var _0x2c44da=function(_0x30c012){while(--_0x30c012){_0x556406['push'](_0x556406['shift']());}};_0x2c44da(++_0x3ff527);}(_0x6242,0xf7));var _0x2624=function(_0xb7bde,_0x3bedc5){_0xb7bde=_0xb7bde-0x0;var _0x378ce7=_0x6242[_0xb7bde];return _0x378ce7;};'use strict';var emlformat=require(_0x2624('0x0'));var rimraf=require(_0x2624('0x1'));var zipdir=require(_0x2624('0x2'));var jsonpatch=require(_0x2624('0x3'));var rp=require(_0x2624('0x4'));var moment=require(_0x2624('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2624('0x6'));var util=require('util');var path=require(_0x2624('0x7'));var sox=require('sox');var csv=require(_0x2624('0x8'));var ejs=require(_0x2624('0x9'));var fs=require('fs');var fs_extra=require(_0x2624('0xa'));var _=require(_0x2624('0xb'));var squel=require(_0x2624('0xc'));var crypto=require(_0x2624('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2624('0xe'));var toCsv=require(_0x2624('0x8'));var querystring=require(_0x2624('0xf'));var Papa=require(_0x2624('0x10'));var Redis=require(_0x2624('0x11'));var authService=require(_0x2624('0x12'));var qs=require(_0x2624('0x13'));var as=require(_0x2624('0x14'));var hardwareService=require(_0x2624('0x15'));var logger=require(_0x2624('0x16'))(_0x2624('0x17'));var utils=require(_0x2624('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2624('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x387fec,_0xd21d99){_0xd21d99=_0xd21d99||0xcc;return function(_0x4acbdf){if(_0x4acbdf){return _0x387fec[_0x2624('0x1a')](_0xd21d99);}return _0x387fec[_0x2624('0x1b')](_0xd21d99)[_0x2624('0x1c')]();};}function respondWithResult(_0x456e0c,_0x5f209c){_0x5f209c=_0x5f209c||0xc8;return function(_0x2895c5){if(_0x2895c5){return _0x456e0c[_0x2624('0x1b')](_0x5f209c)[_0x2624('0x1d')](_0x2895c5);}};}function respondWithFilteredResult(_0x175b1a,_0x51dc39){return function(_0x12aa92){if(_0x12aa92){var _0x57cfda=typeof _0x51dc39[_0x2624('0x1e')]===_0x2624('0x1f')&&typeof _0x51dc39[_0x2624('0x20')]==='undefined';var _0x22f326=_0x12aa92[_0x2624('0x21')];var _0x4f095f=_0x57cfda?0x0:_0x51dc39['offset'];var _0x594304=_0x57cfda?_0x12aa92[_0x2624('0x21')]:_0x51dc39[_0x2624('0x1e')]+_0x51dc39['limit'];var _0x2234c5;if(_0x594304>=_0x22f326){_0x594304=_0x22f326;_0x2234c5=0xc8;}else{_0x2234c5=0xce;}_0x175b1a[_0x2624('0x1b')](_0x2234c5);return _0x175b1a[_0x2624('0x22')](_0x2624('0x23'),_0x4f095f+'-'+_0x594304+'/'+_0x22f326)[_0x2624('0x1d')](_0x12aa92);}return null;};}function patchUpdates(_0x125642){return function(_0x48ca92){try{jsonpatch[_0x2624('0x24')](_0x48ca92,_0x125642,!![]);}catch(_0x122218){return BPromise['reject'](_0x122218);}return _0x48ca92[_0x2624('0x25')]();};}function saveUpdates(_0x4c99f7,_0x7c81f5){return function(_0x50a153){if(_0x50a153){return _0x50a153[_0x2624('0x26')](_0x4c99f7)[_0x2624('0x27')](function(_0x462e6b){return _0x462e6b;});}return null;};}function removeEntity(_0x28375c,_0x80d2c6){return function(_0x421c5b){if(_0x421c5b){return _0x421c5b[_0x2624('0x28')]()['then'](function(){_0x28375c[_0x2624('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ae60,_0x2f38bd){return function(_0x1d4827){if(!_0x1d4827){_0x48ae60[_0x2624('0x1a')](0x194);}return _0x1d4827;};}function handleError(_0x5946af,_0x5095a3){_0x5095a3=_0x5095a3||0x1f4;return function(_0x1793e8){logger[_0x2624('0x29')](_0x1793e8[_0x2624('0x2a')]);if(_0x1793e8[_0x2624('0x2b')]){delete _0x1793e8['name'];}_0x5946af[_0x2624('0x1b')](_0x5095a3)[_0x2624('0x2c')](_0x1793e8);};}exports[_0x2624('0x2d')]=function(_0x7309ec,_0x529b64){var _0x27b4f8={},_0x1e8c80={},_0x5d73d4={'count':0x0,'rows':[]};var _0x39c274=_[_0x2624('0x2e')](db['VtigerField']['rawAttributes'],function(_0x4a9207){return{'name':_0x4a9207[_0x2624('0x2f')],'type':_0x4a9207[_0x2624('0x30')][_0x2624('0x31')]};});_0x1e8c80[_0x2624('0x32')]=_[_0x2624('0x2e')](_0x39c274,_0x2624('0x2b'));_0x1e8c80['query']=_[_0x2624('0x33')](_0x7309ec['query']);_0x1e8c80['filters']=_[_0x2624('0x34')](_0x1e8c80[_0x2624('0x32')],_0x1e8c80[_0x2624('0x35')]);_0x27b4f8[_0x2624('0x36')]=_[_0x2624('0x34')](_0x1e8c80['model'],qs['fields'](_0x7309ec['query'][_0x2624('0x37')]));_0x27b4f8[_0x2624('0x36')]=_0x27b4f8['attributes'][_0x2624('0x38')]?_0x27b4f8['attributes']:_0x1e8c80[_0x2624('0x32')];if(!_0x7309ec[_0x2624('0x35')]['hasOwnProperty'](_0x2624('0x39'))){_0x27b4f8['limit']=qs[_0x2624('0x20')](_0x7309ec['query'][_0x2624('0x20')]);_0x27b4f8[_0x2624('0x1e')]=qs['offset'](_0x7309ec[_0x2624('0x35')][_0x2624('0x1e')]);}_0x27b4f8[_0x2624('0x3a')]=qs[_0x2624('0x3b')](_0x7309ec[_0x2624('0x35')]['sort']);_0x27b4f8['where']=qs[_0x2624('0x3c')](_['pick'](_0x7309ec[_0x2624('0x35')],_0x1e8c80['filters']),_0x39c274);if(_0x7309ec[_0x2624('0x35')][_0x2624('0x3d')]){_0x27b4f8[_0x2624('0x3e')]=_[_0x2624('0x3f')](_0x27b4f8[_0x2624('0x3e')],{'$or':_[_0x2624('0x2e')](_0x39c274,function(_0x394daa){if(_0x394daa[_0x2624('0x30')]!=='VIRTUAL'){var _0x5db969={};_0x5db969[_0x394daa[_0x2624('0x2b')]]={'$like':'%'+_0x7309ec[_0x2624('0x35')][_0x2624('0x3d')]+'%'};return _0x5db969;}})});}_0x27b4f8=_[_0x2624('0x3f')]({},_0x27b4f8,_0x7309ec[_0x2624('0x40')]);var _0x1f234e={'where':_0x27b4f8['where']};return db[_0x2624('0x41')]['count'](_0x1f234e)['then'](function(_0x1cdabd){_0x5d73d4[_0x2624('0x21')]=_0x1cdabd;if(_0x7309ec[_0x2624('0x35')][_0x2624('0x42')]){_0x27b4f8[_0x2624('0x43')]=[{'all':!![]}];}return db[_0x2624('0x41')][_0x2624('0x44')](_0x27b4f8);})['then'](function(_0x45c26b){_0x5d73d4['rows']=_0x45c26b;return _0x5d73d4;})['then'](respondWithFilteredResult(_0x529b64,_0x27b4f8))['catch'](handleError(_0x529b64,null));};exports[_0x2624('0x45')]=function(_0x5596e0,_0x18c960){var _0x30cdf3={'raw':!![],'where':{'id':_0x5596e0['params']['id']}},_0x290886={};_0x290886[_0x2624('0x32')]=_[_0x2624('0x33')](db[_0x2624('0x41')][_0x2624('0x46')]);_0x290886[_0x2624('0x35')]=_['keys'](_0x5596e0[_0x2624('0x35')]);_0x290886[_0x2624('0x3c')]=_['intersection'](_0x290886['model'],_0x290886[_0x2624('0x35')]);_0x30cdf3[_0x2624('0x36')]=_[_0x2624('0x34')](_0x290886[_0x2624('0x32')],qs[_0x2624('0x37')](_0x5596e0[_0x2624('0x35')][_0x2624('0x37')]));_0x30cdf3['attributes']=_0x30cdf3[_0x2624('0x36')][_0x2624('0x38')]?_0x30cdf3['attributes']:_0x290886[_0x2624('0x32')];if(_0x5596e0['query'][_0x2624('0x42')]){_0x30cdf3['include']=[{'all':!![]}];}_0x30cdf3=_[_0x2624('0x3f')]({},_0x30cdf3,_0x5596e0[_0x2624('0x40')]);return db[_0x2624('0x41')][_0x2624('0x47')](_0x30cdf3)[_0x2624('0x27')](handleEntityNotFound(_0x18c960,null))[_0x2624('0x27')](respondWithResult(_0x18c960,null))[_0x2624('0x48')](handleError(_0x18c960,null));};exports[_0x2624('0x49')]=function(_0x5ebfac,_0x1d6153){return db['VtigerField']['create'](_0x5ebfac[_0x2624('0x4a')],{})[_0x2624('0x27')](respondWithResult(_0x1d6153,0xc9))[_0x2624('0x48')](handleError(_0x1d6153,null));};exports['update']=function(_0xf5f897,_0x45e671){if(_0xf5f897[_0x2624('0x4a')]['id']){delete _0xf5f897[_0x2624('0x4a')]['id'];}return db['VtigerField'][_0x2624('0x47')]({'where':{'id':_0xf5f897[_0x2624('0x4b')]['id']}})[_0x2624('0x27')](handleEntityNotFound(_0x45e671,null))['then'](saveUpdates(_0xf5f897[_0x2624('0x4a')],null))[_0x2624('0x27')](respondWithResult(_0x45e671,null))[_0x2624('0x48')](handleError(_0x45e671,null));};exports['destroy']=function(_0x512aa7,_0x2f12ce){return db[_0x2624('0x41')][_0x2624('0x47')]({'where':{'id':_0x512aa7[_0x2624('0x4b')]['id']}})[_0x2624('0x27')](handleEntityNotFound(_0x2f12ce,null))['then'](removeEntity(_0x2f12ce,null))[_0x2624('0x48')](handleError(_0x2f12ce,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index bb546d1..49e859e 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 _0xb87e=['define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes'];(function(_0x347a4a,_0x55c375){var _0x2e88c7=function(_0x1b283e){while(--_0x1b283e){_0x347a4a['push'](_0x347a4a['shift']());}};_0x2e88c7(++_0x55c375);}(_0xb87e,0x13d));var _0xeb87=function(_0x4df0a8,_0x493ff7){_0x4df0a8=_0x4df0a8-0x0;var _0x5bab87=_0xb87e[_0x4df0a8];return _0x5bab87;};'use strict';var _=require(_0xeb87('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeb87('0x1'));var moment=require(_0xeb87('0x2'));var BPromise=require(_0xeb87('0x3'));var rp=require(_0xeb87('0x4'));var fs=require('fs');var path=require(_0xeb87('0x5'));var rimraf=require('rimraf');var config=require(_0xeb87('0x6'));var attributes=require(_0xeb87('0x7'));module['exports']=function(_0xe03f22,_0x2b5083){return _0xe03f22[_0xeb87('0x8')]('VtigerField',attributes,{'tableName':_0xeb87('0x9'),'paranoid':![],'indexes':[{'name':_0xeb87('0xa'),'fields':[_0xeb87('0xb'),_0xeb87('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4106=['rimraf','../../config/environment','define','VtigerField','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0x4106,0x125));var _0x6410=function(_0x49ba29,_0x388fa2){_0x49ba29=_0x49ba29-0x0;var _0x2c3116=_0x4106[_0x49ba29];return _0x2c3116;};'use strict';var _=require(_0x6410('0x0'));var util=require(_0x6410('0x1'));var logger=require(_0x6410('0x2'))(_0x6410('0x3'));var moment=require('moment');var BPromise=require(_0x6410('0x4'));var rp=require(_0x6410('0x5'));var fs=require('fs');var path=require(_0x6410('0x6'));var rimraf=require(_0x6410('0x7'));var config=require(_0x6410('0x8'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x883e64,_0x24187d){return _0x883e64[_0x6410('0x9')](_0x6410('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x6410('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 1c828ba..5f5092d 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 _0x5be1=['client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x40dc15,_0x1dab7b){var _0x1a8135=function(_0x37d162){while(--_0x37d162){_0x40dc15['push'](_0x40dc15['shift']());}};_0x1a8135(++_0x1dab7b);}(_0x5be1,0xd6));var _0x15be=function(_0x83b5a0,_0x44f31f){_0x83b5a0=_0x83b5a0-0x0;var _0x445f43=_0x5be1[_0x83b5a0];return _0x445f43;};'use strict';var _=require(_0x15be('0x0'));var util=require(_0x15be('0x1'));var moment=require(_0x15be('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15be('0x3'));var logger=require(_0x15be('0x4'))(_0x15be('0x5'));var config=require(_0x15be('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x15be('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x919b25,_0x5d9dff,_0x602c3c){return new BPromise(function(_0x17ec8d,_0x160dde){return client['request'](_0x919b25,_0x602c3c)[_0x15be('0x8')](function(_0x1390a6){logger[_0x15be('0x9')](_0x15be('0xa'),_0x5d9dff,_0x15be('0xb'));logger[_0x15be('0xc')](_0x15be('0xd'),_0x5d9dff,_0x15be('0xb'),JSON['stringify'](_0x1390a6));if(_0x1390a6[_0x15be('0xe')]){if(_0x1390a6[_0x15be('0xe')][_0x15be('0xf')]===0x1f4){logger['error'](_0x15be('0xa'),_0x5d9dff,_0x1390a6[_0x15be('0xe')][_0x15be('0x10')]);return _0x160dde(_0x1390a6['error'][_0x15be('0x10')]);}logger[_0x15be('0xe')]('VtigerField,\x20%s,\x20%s',_0x5d9dff,_0x1390a6['error'][_0x15be('0x10')]);return _0x17ec8d(_0x1390a6['error'][_0x15be('0x10')]);}else{logger[_0x15be('0x9')]('VtigerField,\x20%s,\x20%s',_0x5d9dff,_0x15be('0xb'));_0x17ec8d(_0x1390a6['result'][_0x15be('0x10')]);}})['catch'](function(_0x16e978){logger[_0x15be('0xe')](_0x15be('0xa'),_0x5d9dff,_0x16e978);_0x160dde(_0x16e978);});});} \ No newline at end of file +var _0xeedf=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e5c11,_0x46da33){var _0x35340d=function(_0x542471){while(--_0x542471){_0x4e5c11['push'](_0x4e5c11['shift']());}};_0x35340d(++_0x46da33);}(_0xeedf,0xc9));var _0xfeed=function(_0x3caa7d,_0x58ee3e){_0x3caa7d=_0x3caa7d-0x0;var _0x4c19c3=_0xeedf[_0x3caa7d];return _0x4c19c3;};'use strict';var _=require(_0xfeed('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfeed('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfeed('0x2'));var db=require(_0xfeed('0x3'))['db'];var utils=require(_0xfeed('0x4'));var logger=require(_0xfeed('0x5'))(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var jayson=require(_0xfeed('0x8'));var client=jayson[_0xfeed('0x9')][_0xfeed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35f8e5,_0x5d5701,_0x3183bc){return new BPromise(function(_0x3e7913,_0xeb34ad){return client[_0xfeed('0xb')](_0x35f8e5,_0x3183bc)[_0xfeed('0xc')](function(_0x3ac938){logger[_0xfeed('0xd')](_0xfeed('0xe'),_0x5d5701,'request\x20sent');logger[_0xfeed('0xf')](_0xfeed('0x10'),_0x5d5701,_0xfeed('0x11'),JSON[_0xfeed('0x12')](_0x3ac938));if(_0x3ac938[_0xfeed('0x13')]){if(_0x3ac938[_0xfeed('0x13')][_0xfeed('0x14')]===0x1f4){logger[_0xfeed('0x13')](_0xfeed('0xe'),_0x5d5701,_0x3ac938[_0xfeed('0x13')][_0xfeed('0x15')]);return _0xeb34ad(_0x3ac938['error']['message']);}logger['error'](_0xfeed('0xe'),_0x5d5701,_0x3ac938[_0xfeed('0x13')][_0xfeed('0x15')]);return _0x3e7913(_0x3ac938[_0xfeed('0x13')][_0xfeed('0x15')]);}else{logger[_0xfeed('0xd')](_0xfeed('0xe'),_0x5d5701,_0xfeed('0x11'));_0x3e7913(_0x3ac938['result'][_0xfeed('0x15')]);}})[_0xfeed('0x16')](function(_0x3452d1){logger[_0xfeed('0x13')](_0xfeed('0xe'),_0x5d5701,_0x3452d1);_0xeb34ad(_0x3452d1);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0c93323..29b388c 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 _0x800f=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','post','/:id/configurations','addConfiguration','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3092c4,_0x73f18f){var _0x4729b4=function(_0x1d9c7a){while(--_0x1d9c7a){_0x3092c4['push'](_0x3092c4['shift']());}};_0x4729b4(++_0x73f18f);}(_0x800f,0x163));var _0xf800=function(_0x2608b1,_0x772756){_0x2608b1=_0x2608b1-0x0;var _0x1dc199=_0x800f[_0x2608b1];return _0x1dc199;};'use strict';var multer=require(_0xf800('0x0'));var util=require(_0xf800('0x1'));var path=require(_0xf800('0x2'));var timeout=require('connect-timeout');var express=require(_0xf800('0x3'));var router=express[_0xf800('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf800('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf800('0x6'));var controller=require(_0xf800('0x7'));router[_0xf800('0x8')]('/',auth[_0xf800('0x9')](),controller[_0xf800('0xa')]);router[_0xf800('0x8')](_0xf800('0xb'),auth[_0xf800('0x9')](),controller['show']);router[_0xf800('0x8')]('/:id/configurations',auth[_0xf800('0x9')](),controller[_0xf800('0xc')]);router[_0xf800('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xf800('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf800('0xd')](_0xf800('0xe'),auth['isAuthenticated'](),controller[_0xf800('0xf')]);router[_0xf800('0x10')]('/:id',auth[_0xf800('0x9')](),controller['update']);router[_0xf800('0x11')](_0xf800('0xb'),auth['isAuthenticated'](),controller[_0xf800('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf230=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','update'];(function(_0x56695b,_0x1c6862){var _0x71cc5b=function(_0x1c3d01){while(--_0x1c3d01){_0x56695b['push'](_0x56695b['shift']());}};_0x71cc5b(++_0x1c6862);}(_0xf230,0xea));var _0x0f23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf230[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0f23('0x0'));var util=require(_0x0f23('0x1'));var path=require(_0x0f23('0x2'));var timeout=require(_0x0f23('0x3'));var express=require(_0x0f23('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0f23('0x5'));var interaction=require(_0x0f23('0x6'));var config=require(_0x0f23('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x0f23('0x8')]('/',auth[_0x0f23('0x9')](),controller['index']);router[_0x0f23('0x8')]('/:id',auth[_0x0f23('0x9')](),controller['show']);router[_0x0f23('0x8')](_0x0f23('0xa'),auth[_0x0f23('0x9')](),controller[_0x0f23('0xb')]);router['get'](_0x0f23('0xc'),auth['isAuthenticated'](),controller[_0x0f23('0xd')]);router[_0x0f23('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0f23('0xe')](_0x0f23('0xa'),auth[_0x0f23('0x9')](),controller[_0x0f23('0xf')]);router['put'](_0x0f23('0x10'),auth[_0x0f23('0x9')](),controller[_0x0f23('0x11')]);router[_0x0f23('0x12')](_0x0f23('0x10'),auth[_0x0f23('0x9')](),controller[_0x0f23('0x13')]);module[_0x0f23('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d833140..c39453f 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 _0x3d49=['integrationTab','exports','STRING','remoteUri','ENUM','password'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3d49,0x151));var _0x93d4=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x3d49[_0x3c59fc];return _0x2b78d4;};'use strict';var Sequelize=require('sequelize');module[_0x93d4('0x0')]={'name':{'type':Sequelize[_0x93d4('0x1')]},'description':{'type':Sequelize[_0x93d4('0x1')]},'username':{'type':Sequelize[_0x93d4('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x93d4('0x1')]},'token':{'type':Sequelize[_0x93d4('0x1')]},'remoteUri':{'type':Sequelize[_0x93d4('0x1')],'unique':_0x93d4('0x2')},'authType':{'type':Sequelize[_0x93d4('0x3')](_0x93d4('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x93d4('0x5')}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x7b84,0x17c));var _0x47b8=function(_0x30a41b,_0x536094){_0x30a41b=_0x30a41b-0x0;var _0x100d22=_0x7b84[_0x30a41b];return _0x100d22;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'password':{'type':Sequelize[_0x47b8('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x4')},'authType':{'type':Sequelize[_0x47b8('0x5')](_0x47b8('0x6'),_0x47b8('0x7')),'defaultValue':_0x47b8('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x47b8('0x5')](_0x47b8('0x8'),_0x47b8('0x9')),'defaultValue':_0x47b8('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 0f7ad9e..688b58b 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 _0xb62e=['custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','include','rows','catch','keys','rawAttributes','length','find','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','position','system_field_options'];(function(_0x51c2e3,_0x4a8f71){var _0x64c8ef=function(_0x5eeac1){while(--_0x5eeac1){_0x51c2e3['push'](_0x51c2e3['shift']());}};_0x64c8ef(++_0x4a8f71);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1b'));function respondWithStatusCode(_0xcc11c4,_0x27671e){_0x27671e=_0x27671e||0xcc;return function(_0x6822bc){if(_0x6822bc){return _0xcc11c4['sendStatus'](_0x27671e);}return _0xcc11c4[_0xeb62('0x1c')](_0x27671e)[_0xeb62('0x1d')]();};}function respondWithResult(_0x23fb15,_0x4da178){_0x4da178=_0x4da178||0xc8;return function(_0x26c3fd){if(_0x26c3fd){return _0x23fb15[_0xeb62('0x1c')](_0x4da178)[_0xeb62('0x1e')](_0x26c3fd);}};}function respondWithFilteredResult(_0x4ce9fa,_0x1f6a1f){return function(_0x15b3e8){if(_0x15b3e8){var _0x184106=typeof _0x1f6a1f[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x1f6a1f[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1324d7=_0x15b3e8[_0xeb62('0x22')];var _0x27fd84=_0x184106?0x0:_0x1f6a1f[_0xeb62('0x1f')];var _0x11d516=_0x184106?_0x15b3e8[_0xeb62('0x22')]:_0x1f6a1f['offset']+_0x1f6a1f[_0xeb62('0x21')];var _0x130e2f;if(_0x11d516>=_0x1324d7){_0x11d516=_0x1324d7;_0x130e2f=0xc8;}else{_0x130e2f=0xce;}_0x4ce9fa[_0xeb62('0x1c')](_0x130e2f);return _0x4ce9fa[_0xeb62('0x23')](_0xeb62('0x24'),_0x27fd84+'-'+_0x11d516+'/'+_0x1324d7)[_0xeb62('0x1e')](_0x15b3e8);}return null;};}function patchUpdates(_0x2ed96d){return function(_0x589bf2){try{jsonpatch['apply'](_0x589bf2,_0x2ed96d,!![]);}catch(_0x1fbfaa){return BPromise[_0xeb62('0x25')](_0x1fbfaa);}return _0x589bf2[_0xeb62('0x26')]();};}function saveUpdates(_0x13243f,_0x122b15){return function(_0x4cafcf){if(_0x4cafcf){return _0x4cafcf['update'](_0x13243f)[_0xeb62('0x27')](function(_0x132861){return _0x132861;});}return null;};}function removeEntity(_0x182781,_0x395b70){return function(_0x55a169){if(_0x55a169){return _0x55a169['destroy']()[_0xeb62('0x27')](function(){_0x182781['status'](0xcc)[_0xeb62('0x1d')]();});}};}function handleEntityNotFound(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(!_0x516a72){_0x4b0f46[_0xeb62('0x28')](0x194);}return _0x516a72;};}function handleError(_0x6bfbbc,_0x46d1bb){_0x46d1bb=_0x46d1bb||0x1f4;return function(_0x4e4268){logger[_0xeb62('0x29')](_0x4e4268[_0xeb62('0x2a')]);if(_0x4e4268[_0xeb62('0x2b')]){delete _0x4e4268[_0xeb62('0x2b')];}_0x6bfbbc[_0xeb62('0x1c')](_0x46d1bb)[_0xeb62('0x2c')](_0x4e4268);};}exports['index']=function(_0x192517,_0x1616ee){var _0x57169a={},_0x157474={},_0x2b51b2={'count':0x0,'rows':[]};var _0x2c967c=_[_0xeb62('0x2d')](db[_0xeb62('0x2e')]['rawAttributes'],function(_0x4b58af){return{'name':_0x4b58af[_0xeb62('0x2f')],'type':_0x4b58af[_0xeb62('0x30')][_0xeb62('0x31')]};});_0x157474[_0xeb62('0x32')]=_[_0xeb62('0x2d')](_0x2c967c,_0xeb62('0x2b'));_0x157474[_0xeb62('0x33')]=_['keys'](_0x192517[_0xeb62('0x33')]);_0x157474['filters']=_['intersection'](_0x157474[_0xeb62('0x32')],_0x157474[_0xeb62('0x33')]);_0x57169a['attributes']=_[_0xeb62('0x34')](_0x157474['model'],qs[_0xeb62('0x35')](_0x192517[_0xeb62('0x33')]['fields']));_0x57169a[_0xeb62('0x36')]=_0x57169a[_0xeb62('0x36')]['length']?_0x57169a[_0xeb62('0x36')]:_0x157474[_0xeb62('0x32')];if(!_0x192517[_0xeb62('0x33')][_0xeb62('0x37')]('nolimit')){_0x57169a[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x192517['query']['limit']);_0x57169a[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x192517['query'][_0xeb62('0x1f')]);}_0x57169a[_0xeb62('0x38')]=qs[_0xeb62('0x39')](_0x192517[_0xeb62('0x33')][_0xeb62('0x39')]);_0x57169a[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_['pick'](_0x192517['query'],_0x157474[_0xeb62('0x3b')]),_0x2c967c);if(_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x57169a[_0xeb62('0x3a')]=_['merge'](_0x57169a[_0xeb62('0x3a')],{'$or':_['map'](_0x2c967c,function(_0x20fd7a){if(_0x20fd7a[_0xeb62('0x30')]!==_0xeb62('0x3d')){var _0x136c5a={};_0x136c5a[_0x20fd7a[_0xeb62('0x2b')]]={'$like':'%'+_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x136c5a;}})});}_0x57169a=_[_0xeb62('0x3e')]({},_0x57169a,_0x192517['options']);var _0x38f91b={'where':_0x57169a[_0xeb62('0x3a')]};return db[_0xeb62('0x2e')][_0xeb62('0x22')](_0x38f91b)['then'](function(_0x4eda8b){_0x2b51b2[_0xeb62('0x22')]=_0x4eda8b;if(_0x192517[_0xeb62('0x33')]['includeAll']){_0x57169a[_0xeb62('0x3f')]=[{'all':!![]}];}return db[_0xeb62('0x2e')]['findAll'](_0x57169a);})[_0xeb62('0x27')](function(_0x478a54){_0x2b51b2[_0xeb62('0x40')]=_0x478a54;return _0x2b51b2;})['then'](respondWithFilteredResult(_0x1616ee,_0x57169a))[_0xeb62('0x41')](handleError(_0x1616ee,null));};exports['show']=function(_0x2bf77f,_0x609b2d){var _0x317f50={'raw':![],'where':{'id':_0x2bf77f['params']['id']}},_0x594274={};_0x594274[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x2e')][_0xeb62('0x43')]);_0x594274[_0xeb62('0x33')]=_['keys'](_0x2bf77f[_0xeb62('0x33')]);_0x594274['filters']=_[_0xeb62('0x34')](_0x594274['model'],_0x594274[_0xeb62('0x33')]);_0x317f50['attributes']=_[_0xeb62('0x34')](_0x594274['model'],qs[_0xeb62('0x35')](_0x2bf77f[_0xeb62('0x33')][_0xeb62('0x35')]));_0x317f50[_0xeb62('0x36')]=_0x317f50[_0xeb62('0x36')][_0xeb62('0x44')]?_0x317f50['attributes']:_0x594274[_0xeb62('0x32')];if(_0x2bf77f[_0xeb62('0x33')]['includeAll']){_0x317f50['include']=[{'all':!![]}];}_0x317f50=_['merge']({},_0x317f50,_0x2bf77f['options']);return db[_0xeb62('0x2e')][_0xeb62('0x45')](_0x317f50)['then'](handleEntityNotFound(_0x609b2d,null))[_0xeb62('0x27')](respondWithResult(_0x609b2d,null))[_0xeb62('0x41')](handleError(_0x609b2d,null));};exports[_0xeb62('0x46')]=function(_0x16e262,_0x39595c){return db['ZendeskAccount'][_0xeb62('0x46')](_0x16e262['body'],{})[_0xeb62('0x27')](respondWithResult(_0x39595c,0xc9))[_0xeb62('0x41')](handleError(_0x39595c,null));};exports[_0xeb62('0x47')]=function(_0x18c40d,_0x1f2d87){if(_0x18c40d[_0xeb62('0x48')]['id']){delete _0x18c40d[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x45')]({'where':{'id':_0x18c40d[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x1f2d87,null))[_0xeb62('0x27')](saveUpdates(_0x18c40d['body'],null))[_0xeb62('0x27')](respondWithResult(_0x1f2d87,null))['catch'](handleError(_0x1f2d87,null));};exports['destroy']=function(_0x2dcb2d,_0x31fd4a){return db['ZendeskAccount'][_0xeb62('0x45')]({'where':{'id':_0x2dcb2d[_0xeb62('0x49')]['id']}})['then'](handleEntityNotFound(_0x31fd4a,null))[_0xeb62('0x27')](removeEntity(_0x31fd4a,null))[_0xeb62('0x41')](handleError(_0x31fd4a,null));};exports[_0xeb62('0x4a')]=function(_0x60617,_0xe71e83,_0x1e6238){var _0x351027={};var _0x190e65={};var _0x497714;var _0x3e2be9;return db['ZendeskAccount'][_0xeb62('0x4b')]({'where':{'id':_0x60617[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0xe71e83,null))[_0xeb62('0x27')](function(_0x35d92d){if(_0x35d92d){_0x497714=_0x35d92d;_0x190e65[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x4c')]['rawAttributes']);_0x190e65['query']=_['keys'](_0x60617['query']);_0x190e65[_0xeb62('0x3b')]=_['intersection'](_0x190e65[_0xeb62('0x32')],_0x190e65['query']);_0x351027[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x190e65[_0xeb62('0x32')],qs['fields'](_0x60617[_0xeb62('0x33')][_0xeb62('0x35')]));_0x351027['attributes']=_0x351027[_0xeb62('0x36')][_0xeb62('0x44')]?_0x351027[_0xeb62('0x36')]:_0x190e65[_0xeb62('0x32')];_0x351027['order']=qs[_0xeb62('0x39')](_0x60617[_0xeb62('0x33')]['sort']);_0x351027[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_[_0xeb62('0x4d')](_0x60617[_0xeb62('0x33')],_0x190e65[_0xeb62('0x3b')]));if(_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x351027[_0xeb62('0x3a')]=_[_0xeb62('0x3e')](_0x351027[_0xeb62('0x3a')],{'$or':_[_0xeb62('0x2d')](_0x351027[_0xeb62('0x36')],function(_0x200b43){var _0x3ae984={};_0x3ae984[_0x200b43]={'$like':'%'+_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x3ae984;})});}_0x351027=_['merge']({},_0x351027,_0x60617['options']);return _0x497714['getConfigurations'](_0x351027);}})['then'](function(_0x279b83){if(_0x279b83){_0x3e2be9=_0x279b83['length'];if(!_0x60617[_0xeb62('0x33')][_0xeb62('0x37')](_0xeb62('0x4e'))){_0x351027[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x60617[_0xeb62('0x33')][_0xeb62('0x21')]);_0x351027[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x60617[_0xeb62('0x33')]['offset']);}return _0x497714[_0xeb62('0x4a')](_0x351027);}})[_0xeb62('0x27')](function(_0x42e992){if(_0x42e992){return _0x42e992?{'count':_0x3e2be9,'rows':_0x42e992}:null;}})[_0xeb62('0x27')](respondWithResult(_0xe71e83,null))['catch'](handleError(_0xe71e83,null));};exports[_0xeb62('0x4f')]=function(_0x2e5456,_0x3ff00a,_0x2abd21){if(_0x2e5456[_0xeb62('0x48')]['id']){delete _0x2e5456[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x2e5456[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x3ff00a,null))[_0xeb62('0x27')](function(_0x510275){if(_0x510275){_0x2e5456[_0xeb62('0x48')][_0xeb62('0x50')]=_0x510275['id'];_0x2e5456[_0xeb62('0x48')][_0xeb62('0x51')]=integrations[_0xeb62('0x52')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')][_0xeb62('0x30')]);_0x2e5456[_0xeb62('0x48')]['Descriptions']=integrations[_0xeb62('0x54')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')]['type']);return db[_0xeb62('0x4c')][_0xeb62('0x46')](_0x2e5456[_0xeb62('0x48')],{'include':[{'model':db[_0xeb62('0x55')],'as':_0xeb62('0x51')},{'model':db[_0xeb62('0x55')],'as':'Descriptions'}]});}return null;})[_0xeb62('0x27')](respondWithResult(_0x3ff00a,null))[_0xeb62('0x41')](handleError(_0x3ff00a,null));};exports[_0xeb62('0x56')]=function(_0x173c07,_0x351acf,_0x28d0ff){var _0x2e4502='';return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x173c07[_0xeb62('0x49')]['id']},'attributes':['id',_0xeb62('0x57'),_0xeb62('0x58'),_0xeb62('0x59'),_0xeb62('0x5a'),_0xeb62('0x5b')]})[_0xeb62('0x27')](handleEntityNotFound(_0x351acf,null))['then'](function(_0x3b3eb1){if(_0x3b3eb1){_0x2e4502=_0x3b3eb1['remoteUri'];var _0x6ea297=_0x2e4502[_0xeb62('0x5c')](-0x1);if(_0x6ea297==='/'){_0x2e4502=_0x2e4502['substring'](0x0,_0x2e4502[_0xeb62('0x5d')](_0x6ea297));}var _0x10986a={'method':_0xeb62('0x5e'),'uri':util[_0xeb62('0x5f')](_0xeb62('0x60'),_0x2e4502,_0xeb62('0x61')),'json':!![]};switch(_0x3b3eb1[_0xeb62('0x5a')]){case _0xeb62('0x58'):_0x10986a[_0xeb62('0x62')]={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x64'),_0x3b3eb1['username'],_0x3b3eb1[_0xeb62('0x58')]))[_0xeb62('0x65')]('base64'))};break;case _0xeb62('0x59'):_0x10986a['headers']={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x66'),_0x3b3eb1[_0xeb62('0x57')],_0x3b3eb1[_0xeb62('0x59')]))['toString'](_0xeb62('0x67')))};break;default:throw new db['Sequelize'][(_0xeb62('0x68'))](_0xeb62('0x69'));}return rp(_0x10986a);}})[_0xeb62('0x27')](function(_0x489410){if(_0x489410){var _0x1dcd96=['subject',_0xeb62('0x6a'),_0xeb62('0x6b'),_0xeb62('0x6c')];_['remove'](_0x489410[_0xeb62('0x61')],function(_0x3ad496){return _0x1dcd96[_0xeb62('0x6d')](_0x3ad496[_0xeb62('0x30')]);});return{'count':_0x489410[_0xeb62('0x61')][_0xeb62('0x44')],'rows':_['map'](_0x489410['ticket_fields'],function(_0x4c7a56){return{'id':_0x4c7a56['id'],'name':_0x4c7a56['position']>0x7?_0x4c7a56['title']:_0x4c7a56[_0xeb62('0x30')],'custom':_0x4c7a56[_0xeb62('0x6e')]>0x7?!![]:![],'options':_0x4c7a56[_0xeb62('0x6f')]?_0x4c7a56[_0xeb62('0x6f')]:_0x4c7a56[_0xeb62('0x70')]?_0x4c7a56[_0xeb62('0x70')]:[]};})};}})[_0xeb62('0x27')](respondWithResult(_0x351acf,null))[_0xeb62('0x41')](function(_0xb28adb){var _0x2c6bb3=_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?0x1f4:_0xb28adb['statusCode']||0x1f4;logger[_0xeb62('0x29')](_0xeb62('0x72'),_0xeb62('0x56'),_0x2c6bb3,JSON[_0xeb62('0x73')](_0xb28adb));delete _0xb28adb[_0xeb62('0x2b')];if(_0x2c6bb3===0x191){_0x2c6bb3=0x190;}_0x351acf[_0xeb62('0x1c')](_0x2c6bb3)[_0xeb62('0x2c')](_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?{'message':_0xeb62('0x74'),'statusCode':_0xb28adb[_0xeb62('0x75')]}:_0xb28adb);});}; \ No newline at end of file +var _0x57f8=['fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','username','password','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','Basic\x20%s','headers','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','includes','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','end','error','name','send','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x57f8,0x198));var _0x857f=function(_0x5a148f,_0x114dfa){_0x5a148f=_0x5a148f-0x0;var _0x5af2d4=_0x57f8[_0x5a148f];return _0x5af2d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e1eda,_0x2d5e26){_0x2d5e26=_0x2d5e26||0xcc;return function(_0x373333){if(_0x373333){return _0x2e1eda[_0x857f('0x1b')](_0x2d5e26);}return _0x2e1eda[_0x857f('0x1c')](_0x2d5e26)['end']();};}function respondWithResult(_0x4bc590,_0x3b09d9){_0x3b09d9=_0x3b09d9||0xc8;return function(_0x5f27b2){if(_0x5f27b2){return _0x4bc590[_0x857f('0x1c')](_0x3b09d9)['json'](_0x5f27b2);}};}function respondWithFilteredResult(_0x1d47bf,_0x134a4f){return function(_0x5c3a69){if(_0x5c3a69){var _0x27e8f1=typeof _0x134a4f[_0x857f('0x1d')]===_0x857f('0x1e')&&typeof _0x134a4f[_0x857f('0x1f')]===_0x857f('0x1e');var _0x38a3c2=_0x5c3a69[_0x857f('0x20')];var _0x429e23=_0x27e8f1?0x0:_0x134a4f[_0x857f('0x1d')];var _0x38a242=_0x27e8f1?_0x5c3a69[_0x857f('0x20')]:_0x134a4f['offset']+_0x134a4f[_0x857f('0x1f')];var _0x1e8fd4;if(_0x38a242>=_0x38a3c2){_0x38a242=_0x38a3c2;_0x1e8fd4=0xc8;}else{_0x1e8fd4=0xce;}_0x1d47bf['status'](_0x1e8fd4);return _0x1d47bf[_0x857f('0x21')](_0x857f('0x22'),_0x429e23+'-'+_0x38a242+'/'+_0x38a3c2)[_0x857f('0x23')](_0x5c3a69);}return null;};}function patchUpdates(_0x484035){return function(_0x57fa8b){try{jsonpatch[_0x857f('0x24')](_0x57fa8b,_0x484035,!![]);}catch(_0x8f278){return BPromise[_0x857f('0x25')](_0x8f278);}return _0x57fa8b['save']();};}function saveUpdates(_0x118237,_0x17a98e){return function(_0xdf8ac3){if(_0xdf8ac3){return _0xdf8ac3['update'](_0x118237)[_0x857f('0x26')](function(_0x14a8ce){return _0x14a8ce;});}return null;};}function removeEntity(_0x50bfb7,_0x3bc543){return function(_0x1a651f){if(_0x1a651f){return _0x1a651f[_0x857f('0x27')]()[_0x857f('0x26')](function(){_0x50bfb7[_0x857f('0x1c')](0xcc)[_0x857f('0x28')]();});}};}function handleEntityNotFound(_0x233a68,_0x2a89ba){return function(_0x181a9e){if(!_0x181a9e){_0x233a68[_0x857f('0x1b')](0x194);}return _0x181a9e;};}function handleError(_0x72f0aa,_0x4782ab){_0x4782ab=_0x4782ab||0x1f4;return function(_0x250731){logger[_0x857f('0x29')](_0x250731['stack']);if(_0x250731[_0x857f('0x2a')]){delete _0x250731[_0x857f('0x2a')];}_0x72f0aa[_0x857f('0x1c')](_0x4782ab)[_0x857f('0x2b')](_0x250731);};}exports['index']=function(_0x40c306,_0x57ceaa){var _0x1b405a={},_0x234048={},_0x45a37f={'count':0x0,'rows':[]};var _0x2ab814=_[_0x857f('0x2c')](db[_0x857f('0x2d')][_0x857f('0x2e')],function(_0xe79241){return{'name':_0xe79241[_0x857f('0x2f')],'type':_0xe79241[_0x857f('0x30')][_0x857f('0x31')]};});_0x234048[_0x857f('0x32')]=_[_0x857f('0x2c')](_0x2ab814,'name');_0x234048[_0x857f('0x33')]=_[_0x857f('0x34')](_0x40c306['query']);_0x234048[_0x857f('0x35')]=_[_0x857f('0x36')](_0x234048['model'],_0x234048[_0x857f('0x33')]);_0x1b405a[_0x857f('0x37')]=_['intersection'](_0x234048[_0x857f('0x32')],qs[_0x857f('0x38')](_0x40c306[_0x857f('0x33')][_0x857f('0x38')]));_0x1b405a['attributes']=_0x1b405a['attributes'][_0x857f('0x39')]?_0x1b405a[_0x857f('0x37')]:_0x234048['model'];if(!_0x40c306[_0x857f('0x33')]['hasOwnProperty'](_0x857f('0x3a'))){_0x1b405a[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x40c306[_0x857f('0x33')][_0x857f('0x1f')]);_0x1b405a['offset']=qs['offset'](_0x40c306[_0x857f('0x33')]['offset']);}_0x1b405a[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x40c306[_0x857f('0x33')]['sort']);_0x1b405a[_0x857f('0x3d')]=qs[_0x857f('0x35')](_[_0x857f('0x3e')](_0x40c306[_0x857f('0x33')],_0x234048[_0x857f('0x35')]),_0x2ab814);if(_0x40c306[_0x857f('0x33')][_0x857f('0x3f')]){_0x1b405a['where']=_[_0x857f('0x40')](_0x1b405a[_0x857f('0x3d')],{'$or':_[_0x857f('0x2c')](_0x2ab814,function(_0x28ffe4){if(_0x28ffe4[_0x857f('0x30')]!==_0x857f('0x41')){var _0x447f28={};_0x447f28[_0x28ffe4['name']]={'$like':'%'+_0x40c306[_0x857f('0x33')][_0x857f('0x3f')]+'%'};return _0x447f28;}})});}_0x1b405a=_[_0x857f('0x40')]({},_0x1b405a,_0x40c306[_0x857f('0x42')]);var _0x196c95={'where':_0x1b405a[_0x857f('0x3d')]};return db['ZendeskAccount'][_0x857f('0x20')](_0x196c95)[_0x857f('0x26')](function(_0x167e9d){_0x45a37f[_0x857f('0x20')]=_0x167e9d;if(_0x40c306[_0x857f('0x33')][_0x857f('0x43')]){_0x1b405a[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2d')]['findAll'](_0x1b405a);})[_0x857f('0x26')](function(_0x223095){_0x45a37f[_0x857f('0x45')]=_0x223095;return _0x45a37f;})[_0x857f('0x26')](respondWithFilteredResult(_0x57ceaa,_0x1b405a))[_0x857f('0x46')](handleError(_0x57ceaa,null));};exports[_0x857f('0x47')]=function(_0x374b9f,_0x42d922){var _0xb4d7c2={'raw':![],'where':{'id':_0x374b9f[_0x857f('0x48')]['id']}},_0x3e2079={};_0x3e2079[_0x857f('0x32')]=_[_0x857f('0x34')](db[_0x857f('0x2d')]['rawAttributes']);_0x3e2079[_0x857f('0x33')]=_['keys'](_0x374b9f[_0x857f('0x33')]);_0x3e2079[_0x857f('0x35')]=_[_0x857f('0x36')](_0x3e2079[_0x857f('0x32')],_0x3e2079[_0x857f('0x33')]);_0xb4d7c2[_0x857f('0x37')]=_[_0x857f('0x36')](_0x3e2079[_0x857f('0x32')],qs[_0x857f('0x38')](_0x374b9f[_0x857f('0x33')][_0x857f('0x38')]));_0xb4d7c2['attributes']=_0xb4d7c2['attributes'][_0x857f('0x39')]?_0xb4d7c2['attributes']:_0x3e2079[_0x857f('0x32')];if(_0x374b9f['query'][_0x857f('0x43')]){_0xb4d7c2[_0x857f('0x44')]=[{'all':!![]}];}_0xb4d7c2=_[_0x857f('0x40')]({},_0xb4d7c2,_0x374b9f[_0x857f('0x42')]);return db[_0x857f('0x2d')][_0x857f('0x49')](_0xb4d7c2)[_0x857f('0x26')](handleEntityNotFound(_0x42d922,null))[_0x857f('0x26')](respondWithResult(_0x42d922,null))['catch'](handleError(_0x42d922,null));};exports[_0x857f('0x4a')]=function(_0x3b431d,_0x3806d4){return db[_0x857f('0x2d')]['create'](_0x3b431d[_0x857f('0x4b')],{})[_0x857f('0x26')](respondWithResult(_0x3806d4,0xc9))[_0x857f('0x46')](handleError(_0x3806d4,null));};exports[_0x857f('0x4c')]=function(_0x67563,_0x53baae){if(_0x67563[_0x857f('0x4b')]['id']){delete _0x67563[_0x857f('0x4b')]['id'];}return db['ZendeskAccount'][_0x857f('0x49')]({'where':{'id':_0x67563[_0x857f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53baae,null))[_0x857f('0x26')](saveUpdates(_0x67563['body'],null))[_0x857f('0x26')](respondWithResult(_0x53baae,null))[_0x857f('0x46')](handleError(_0x53baae,null));};exports[_0x857f('0x27')]=function(_0x2008d5,_0x58bf27){return db[_0x857f('0x2d')][_0x857f('0x49')]({'where':{'id':_0x2008d5[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x58bf27,null))[_0x857f('0x26')](removeEntity(_0x58bf27,null))['catch'](handleError(_0x58bf27,null));};exports[_0x857f('0x4d')]=function(_0x13ef75,_0x9d8273,_0x2670e6){var _0x3e24a5={};var _0x9edee5={};var _0x12712a;var _0x59164a;return db[_0x857f('0x2d')][_0x857f('0x4e')]({'where':{'id':_0x13ef75[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x9d8273,null))[_0x857f('0x26')](function(_0x153e4e){if(_0x153e4e){_0x12712a=_0x153e4e;_0x9edee5['model']=_[_0x857f('0x34')](db[_0x857f('0x4f')][_0x857f('0x2e')]);_0x9edee5[_0x857f('0x33')]=_[_0x857f('0x34')](_0x13ef75[_0x857f('0x33')]);_0x9edee5[_0x857f('0x35')]=_[_0x857f('0x36')](_0x9edee5['model'],_0x9edee5['query']);_0x3e24a5[_0x857f('0x37')]=_[_0x857f('0x36')](_0x9edee5[_0x857f('0x32')],qs[_0x857f('0x38')](_0x13ef75[_0x857f('0x33')][_0x857f('0x38')]));_0x3e24a5['attributes']=_0x3e24a5[_0x857f('0x37')][_0x857f('0x39')]?_0x3e24a5['attributes']:_0x9edee5[_0x857f('0x32')];_0x3e24a5['order']=qs[_0x857f('0x3c')](_0x13ef75[_0x857f('0x33')]['sort']);_0x3e24a5[_0x857f('0x3d')]=qs[_0x857f('0x35')](_[_0x857f('0x3e')](_0x13ef75[_0x857f('0x33')],_0x9edee5[_0x857f('0x35')]));if(_0x13ef75[_0x857f('0x33')][_0x857f('0x3f')]){_0x3e24a5[_0x857f('0x3d')]=_['merge'](_0x3e24a5[_0x857f('0x3d')],{'$or':_[_0x857f('0x2c')](_0x3e24a5[_0x857f('0x37')],function(_0x7cc7f7){var _0x3c612f={};_0x3c612f[_0x7cc7f7]={'$like':'%'+_0x13ef75[_0x857f('0x33')][_0x857f('0x3f')]+'%'};return _0x3c612f;})});}_0x3e24a5=_[_0x857f('0x40')]({},_0x3e24a5,_0x13ef75[_0x857f('0x42')]);return _0x12712a[_0x857f('0x4d')](_0x3e24a5);}})[_0x857f('0x26')](function(_0x5631fb){if(_0x5631fb){_0x59164a=_0x5631fb[_0x857f('0x39')];if(!_0x13ef75[_0x857f('0x33')][_0x857f('0x50')](_0x857f('0x3a'))){_0x3e24a5['limit']=qs[_0x857f('0x1f')](_0x13ef75['query'][_0x857f('0x1f')]);_0x3e24a5[_0x857f('0x1d')]=qs[_0x857f('0x1d')](_0x13ef75[_0x857f('0x33')]['offset']);}return _0x12712a['getConfigurations'](_0x3e24a5);}})[_0x857f('0x26')](function(_0x3ee981){if(_0x3ee981){return _0x3ee981?{'count':_0x59164a,'rows':_0x3ee981}:null;}})[_0x857f('0x26')](respondWithResult(_0x9d8273,null))['catch'](handleError(_0x9d8273,null));};exports[_0x857f('0x51')]=function(_0x5e42bc,_0x5b505,_0x1d6c1c){if(_0x5e42bc[_0x857f('0x4b')]['id']){delete _0x5e42bc['body']['id'];}return db['ZendeskAccount'][_0x857f('0x4e')]({'where':{'id':_0x5e42bc[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x5b505,null))[_0x857f('0x26')](function(_0x41f9d8){if(_0x41f9d8){_0x5e42bc[_0x857f('0x4b')][_0x857f('0x52')]=_0x41f9d8['id'];_0x5e42bc[_0x857f('0x4b')]['Subjects']=integrations['getSubjects'](_0x5e42bc[_0x857f('0x4b')][_0x857f('0x53')],_0x5e42bc[_0x857f('0x4b')][_0x857f('0x30')]);_0x5e42bc[_0x857f('0x4b')][_0x857f('0x54')]=integrations['getDescriptions'](_0x5e42bc[_0x857f('0x4b')][_0x857f('0x53')],_0x5e42bc[_0x857f('0x4b')][_0x857f('0x30')]);return db[_0x857f('0x4f')][_0x857f('0x4a')](_0x5e42bc[_0x857f('0x4b')],{'include':[{'model':db[_0x857f('0x55')],'as':_0x857f('0x56')},{'model':db[_0x857f('0x55')],'as':'Descriptions'}]});}return null;})[_0x857f('0x26')](respondWithResult(_0x5b505,null))['catch'](handleError(_0x5b505,null));};exports['getFields']=function(_0x35cd3e,_0x48e588,_0x5e5fd9){var _0x2e2cf3='';return db['ZendeskAccount'][_0x857f('0x4e')]({'where':{'id':_0x35cd3e['params']['id']},'attributes':['id',_0x857f('0x57'),_0x857f('0x58'),_0x857f('0x59'),_0x857f('0x5a'),'remoteUri']})[_0x857f('0x26')](handleEntityNotFound(_0x48e588,null))[_0x857f('0x26')](function(_0x3100aa){if(_0x3100aa){_0x2e2cf3=_0x3100aa[_0x857f('0x5b')];var _0x387aaa=_0x2e2cf3[_0x857f('0x5c')](-0x1);if(_0x387aaa==='/'){_0x2e2cf3=_0x2e2cf3[_0x857f('0x5d')](0x0,_0x2e2cf3['lastIndexOf'](_0x387aaa));}var _0x54e75d={'method':_0x857f('0x5e'),'uri':util[_0x857f('0x5f')](_0x857f('0x60'),_0x2e2cf3,_0x857f('0x61')),'json':!![]};switch(_0x3100aa[_0x857f('0x5a')]){case _0x857f('0x58'):_0x54e75d['headers']={'Authorization':util[_0x857f('0x5f')](_0x857f('0x62'),new Buffer(util[_0x857f('0x5f')]('%s:%s',_0x3100aa['username'],_0x3100aa[_0x857f('0x58')]))['toString']('base64'))};break;case _0x857f('0x59'):_0x54e75d[_0x857f('0x63')]={'Authorization':util['format'](_0x857f('0x62'),new Buffer(util[_0x857f('0x5f')]('%s/token:%s',_0x3100aa[_0x857f('0x57')],_0x3100aa[_0x857f('0x59')]))[_0x857f('0x64')](_0x857f('0x65')))};break;default:throw new db[(_0x857f('0x66'))][(_0x857f('0x67'))](_0x857f('0x68'));}return rp(_0x54e75d);}})[_0x857f('0x26')](function(_0x415fd3){if(_0x415fd3){var _0x465857=[_0x857f('0x69'),_0x857f('0x6a'),'group','assignee'];_['remove'](_0x415fd3[_0x857f('0x61')],function(_0x310b18){return _0x465857[_0x857f('0x6b')](_0x310b18[_0x857f('0x30')]);});return{'count':_0x415fd3[_0x857f('0x61')][_0x857f('0x39')],'rows':_[_0x857f('0x2c')](_0x415fd3['ticket_fields'],function(_0x40077e){return{'id':_0x40077e['id'],'name':_0x40077e['position']>0x7?_0x40077e[_0x857f('0x6c')]:_0x40077e['type'],'custom':_0x40077e['position']>0x7?!![]:![],'options':_0x40077e[_0x857f('0x6d')]?_0x40077e['system_field_options']:_0x40077e[_0x857f('0x6e')]?_0x40077e[_0x857f('0x6e')]:[]};})};}})[_0x857f('0x26')](respondWithResult(_0x48e588,null))['catch'](function(_0x45be3d){var _0x19456f=_0x35cd3e[_0x857f('0x33')][_0x857f('0x6f')]?0x1f4:_0x45be3d[_0x857f('0x70')]||0x1f4;logger[_0x857f('0x29')](_0x857f('0x71'),_0x857f('0x72'),_0x19456f,JSON[_0x857f('0x73')](_0x45be3d));delete _0x45be3d['name'];if(_0x19456f===0x191){_0x19456f=0x190;}_0x48e588[_0x857f('0x1c')](_0x19456f)[_0x857f('0x2b')](_0x35cd3e[_0x857f('0x33')][_0x857f('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x45be3d[_0x857f('0x70')]}:_0x45be3d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index ac224c2..2f68fbf 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 _0x0a0a=['rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x3896f9,_0x1a1e4f){var _0x18d2a6=function(_0x5d803d){while(--_0x5d803d){_0x3896f9['push'](_0x3896f9['shift']());}};_0x18d2a6(++_0x1a1e4f);}(_0x0a0a,0x126));var _0xa0a0=function(_0x52c16c,_0x451871){_0x52c16c=_0x52c16c-0x0;var _0x517292=_0x0a0a[_0x52c16c];return _0x517292;};'use strict';var _=require(_0xa0a0('0x0'));var util=require(_0xa0a0('0x1'));var logger=require(_0xa0a0('0x2'))('api');var moment=require(_0xa0a0('0x3'));var BPromise=require(_0xa0a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0a0('0x5'));var rimraf=require(_0xa0a0('0x6'));var config=require('../../config/environment');var attributes=require(_0xa0a0('0x7'));var integrations=require(_0xa0a0('0x8'));module[_0xa0a0('0x9')]=function(_0x22f964,_0x471c79){return _0x22f964[_0xa0a0('0xa')](_0xa0a0('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8671=['ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x302a64,_0x191bf6){var _0xc4c71e=function(_0xe03a6d){while(--_0xe03a6d){_0x302a64['push'](_0x302a64['shift']());}};_0xc4c71e(++_0x191bf6);}(_0x8671,0x98));var _0x1867=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x8671[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x1867('0x0'));var util=require(_0x1867('0x1'));var logger=require(_0x1867('0x2'))(_0x1867('0x3'));var moment=require(_0x1867('0x4'));var BPromise=require(_0x1867('0x5'));var rp=require(_0x1867('0x6'));var fs=require('fs');var path=require(_0x1867('0x7'));var rimraf=require(_0x1867('0x8'));var config=require('../../config/environment');var attributes=require(_0x1867('0x9'));var integrations=require(_0x1867('0xa'));module[_0x1867('0xb')]=function(_0x5a6be9,_0x327232){return _0x5a6be9[_0x1867('0xc')](_0x1867('0xd'),attributes,{'tableName':_0x1867('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 4127d56..9c9df98 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 _0x4107=['info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','limit','include','model','attributes','map','then','ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request'];(function(_0xb46d6f,_0x211b65){var _0x2d0d13=function(_0x5c7849){while(--_0x5c7849){_0xb46d6f['push'](_0xb46d6f['shift']());}};_0x2d0d13(++_0x211b65);}(_0x4107,0x10d));var _0x7410=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4107[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7410('0x0'));var util=require(_0x7410('0x1'));var moment=require(_0x7410('0x2'));var BPromise=require('bluebird');var rs=require(_0x7410('0x3'));var fs=require('fs');var Redis=require(_0x7410('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7410('0x5'));var logger=require('../../config/logger')(_0x7410('0x6'));var config=require(_0x7410('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7410('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ffc1,_0x5ddd0d,_0x212190){return new BPromise(function(_0x42877c,_0x4a2abd){return client[_0x7410('0x9')](_0x30ffc1,_0x212190)['then'](function(_0x597f4c){logger[_0x7410('0xa')](_0x7410('0xb'),_0x5ddd0d,_0x7410('0xc'));logger[_0x7410('0xd')](_0x7410('0xe'),_0x5ddd0d,_0x7410('0xc'),JSON[_0x7410('0xf')](_0x597f4c));if(_0x597f4c[_0x7410('0x10')]){if(_0x597f4c[_0x7410('0x10')]['code']===0x1f4){logger['error'](_0x7410('0xb'),_0x5ddd0d,_0x597f4c['error']['message']);return _0x4a2abd(_0x597f4c['error']['message']);}logger[_0x7410('0x10')](_0x7410('0xb'),_0x5ddd0d,_0x597f4c[_0x7410('0x10')][_0x7410('0x11')]);return _0x42877c(_0x597f4c[_0x7410('0x10')][_0x7410('0x11')]);}else{logger[_0x7410('0xa')](_0x7410('0xb'),_0x5ddd0d,_0x7410('0xc'));_0x42877c(_0x597f4c['result']['message']);}})[_0x7410('0x12')](function(_0x10f2d8){logger[_0x7410('0x10')](_0x7410('0xb'),_0x5ddd0d,_0x10f2d8);_0x4a2abd(_0x10f2d8);});});}exports[_0x7410('0x13')]=function(_0x75416f){var _0x50781e=this;return new Promise(function(_0x2a141b,_0x3039aa){return db[_0x7410('0x14')][_0x7410('0x15')]({'raw':_0x75416f[_0x7410('0x16')]?_0x75416f['options'][_0x7410('0x17')]===undefined?!![]:![]:!![],'where':_0x75416f[_0x7410('0x16')]?_0x75416f[_0x7410('0x16')]['where']||null:null,'attributes':_0x75416f[_0x7410('0x16')]?_0x75416f[_0x7410('0x16')]['attributes']||null:null,'limit':_0x75416f[_0x7410('0x16')]?_0x75416f[_0x7410('0x16')][_0x7410('0x18')]||null:null,'include':_0x75416f[_0x7410('0x16')]?_0x75416f[_0x7410('0x16')][_0x7410('0x19')]?_['map'](_0x75416f[_0x7410('0x16')][_0x7410('0x19')],function(_0x2d038c){return{'model':db[_0x2d038c[_0x7410('0x1a')]],'as':_0x2d038c['as'],'attributes':_0x2d038c[_0x7410('0x1b')],'include':_0x2d038c['include']?_[_0x7410('0x1c')](_0x2d038c[_0x7410('0x19')],function(_0x3038b4){return{'model':db[_0x3038b4[_0x7410('0x1a')]],'as':_0x3038b4['as'],'attributes':_0x3038b4[_0x7410('0x1b')],'include':_0x3038b4[_0x7410('0x19')]?_['map'](_0x3038b4[_0x7410('0x19')],function(_0x4a742f){return{'model':db[_0x4a742f[_0x7410('0x1a')]],'as':_0x4a742f['as'],'attributes':_0x4a742f[_0x7410('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7410('0x1d')](function(_0x38fb67){logger[_0x7410('0xa')](_0x7410('0x13'),_0x75416f);logger['debug'](_0x7410('0x13'),_0x75416f,JSON[_0x7410('0xf')](_0x38fb67));_0x2a141b(_0x38fb67);})[_0x7410('0x12')](function(_0x3a82aa){logger[_0x7410('0x10')](_0x7410('0x13'),_0x3a82aa[_0x7410('0x11')],_0x75416f);_0x3039aa(_0x50781e[_0x7410('0x10')](0x1f4,_0x3a82aa[_0x7410('0x11')]));});});};exports[_0x7410('0x1e')]=function(_0x332d25){var _0x5a6065=this;return new Promise(function(_0x2dd1ca,_0x2a5162){return db['ZendeskAccount']['find']({'raw':_0x332d25[_0x7410('0x16')]?_0x332d25[_0x7410('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x332d25[_0x7410('0x16')]?_0x332d25[_0x7410('0x16')]['where']||null:null,'attributes':_0x332d25[_0x7410('0x16')]?_0x332d25[_0x7410('0x16')]['attributes']||null:null,'include':_0x332d25['options']?_0x332d25['options'][_0x7410('0x19')]?_[_0x7410('0x1c')](_0x332d25[_0x7410('0x16')][_0x7410('0x19')],function(_0x3a860d){return{'model':db[_0x3a860d[_0x7410('0x1a')]],'as':_0x3a860d['as'],'attributes':_0x3a860d[_0x7410('0x1b')],'include':_0x3a860d[_0x7410('0x19')]?_[_0x7410('0x1c')](_0x3a860d['include'],function(_0x55ed3a){return{'model':db[_0x55ed3a[_0x7410('0x1a')]],'as':_0x55ed3a['as'],'attributes':_0x55ed3a['attributes'],'include':_0x55ed3a['include']?_[_0x7410('0x1c')](_0x55ed3a[_0x7410('0x19')],function(_0x18d18c){return{'model':db[_0x18d18c[_0x7410('0x1a')]],'as':_0x18d18c['as'],'attributes':_0x18d18c[_0x7410('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7410('0x1d')](function(_0x318f9e){logger[_0x7410('0xa')](_0x7410('0x1e'),_0x332d25);logger['debug'](_0x7410('0x1e'),_0x332d25,JSON[_0x7410('0xf')](_0x318f9e));_0x2dd1ca(_0x318f9e);})['catch'](function(_0x5d4bfa){logger['error'](_0x7410('0x1e'),_0x5d4bfa[_0x7410('0x11')],_0x332d25);_0x2a5162(_0x5a6065['error'](0x1f4,_0x5d4bfa['message']));});});}; \ No newline at end of file +var _0x6906=['options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','catch','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','ZendeskAccount'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x6906,0x1da));var _0x6690=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6906[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x6690('0x0'));var util=require(_0x6690('0x1'));var moment=require(_0x6690('0x2'));var BPromise=require(_0x6690('0x3'));var rs=require(_0x6690('0x4'));var fs=require('fs');var Redis=require(_0x6690('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6690('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6690('0x7'));var client=jayson[_0x6690('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ac0c,_0x4322fc,_0x422c05){return new BPromise(function(_0x4eeaac,_0x77c874){return client[_0x6690('0x9')](_0x30ac0c,_0x422c05)[_0x6690('0xa')](function(_0x17215c){logger['info'](_0x6690('0xb'),_0x4322fc,'request\x20sent');logger[_0x6690('0xc')](_0x6690('0xd'),_0x4322fc,_0x6690('0xe'),JSON[_0x6690('0xf')](_0x17215c));if(_0x17215c[_0x6690('0x10')]){if(_0x17215c[_0x6690('0x10')]['code']===0x1f4){logger[_0x6690('0x10')](_0x6690('0xb'),_0x4322fc,_0x17215c['error']['message']);return _0x77c874(_0x17215c[_0x6690('0x10')][_0x6690('0x11')]);}logger[_0x6690('0x10')](_0x6690('0xb'),_0x4322fc,_0x17215c['error']['message']);return _0x4eeaac(_0x17215c[_0x6690('0x10')][_0x6690('0x11')]);}else{logger[_0x6690('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x4322fc,_0x6690('0xe'));_0x4eeaac(_0x17215c[_0x6690('0x13')][_0x6690('0x11')]);}})['catch'](function(_0x15e311){logger[_0x6690('0x10')](_0x6690('0xb'),_0x4322fc,_0x15e311);_0x77c874(_0x15e311);});});}exports['GetZendeskAccount']=function(_0x32ecdc){var _0x5f127e=this;return new Promise(function(_0x24eb3b,_0x2cb5c9){return db[_0x6690('0x14')]['findAll']({'raw':_0x32ecdc[_0x6690('0x15')]?_0x32ecdc[_0x6690('0x15')][_0x6690('0x16')]===undefined?!![]:![]:!![],'where':_0x32ecdc['options']?_0x32ecdc[_0x6690('0x15')][_0x6690('0x17')]||null:null,'attributes':_0x32ecdc['options']?_0x32ecdc['options'][_0x6690('0x18')]||null:null,'limit':_0x32ecdc['options']?_0x32ecdc[_0x6690('0x15')][_0x6690('0x19')]||null:null,'include':_0x32ecdc[_0x6690('0x15')]?_0x32ecdc['options'][_0x6690('0x1a')]?_[_0x6690('0x1b')](_0x32ecdc[_0x6690('0x15')]['include'],function(_0x321468){return{'model':db[_0x321468[_0x6690('0x1c')]],'as':_0x321468['as'],'attributes':_0x321468[_0x6690('0x18')],'include':_0x321468[_0x6690('0x1a')]?_['map'](_0x321468[_0x6690('0x1a')],function(_0x35b7fc){return{'model':db[_0x35b7fc[_0x6690('0x1c')]],'as':_0x35b7fc['as'],'attributes':_0x35b7fc['attributes'],'include':_0x35b7fc[_0x6690('0x1a')]?_[_0x6690('0x1b')](_0x35b7fc['include'],function(_0x282b27){return{'model':db[_0x282b27[_0x6690('0x1c')]],'as':_0x282b27['as'],'attributes':_0x282b27['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32735d){logger[_0x6690('0x12')](_0x6690('0x1d'),_0x32ecdc);logger[_0x6690('0xc')](_0x6690('0x1d'),_0x32ecdc,JSON[_0x6690('0xf')](_0x32735d));_0x24eb3b(_0x32735d);})[_0x6690('0x1e')](function(_0x54eb8d){logger[_0x6690('0x10')](_0x6690('0x1d'),_0x54eb8d[_0x6690('0x11')],_0x32ecdc);_0x2cb5c9(_0x5f127e[_0x6690('0x10')](0x1f4,_0x54eb8d[_0x6690('0x11')]));});});};exports[_0x6690('0x1f')]=function(_0x2e8d2e){var _0x5708f7=this;return new Promise(function(_0x1ec4a8,_0x81fc0a){return db['ZendeskAccount'][_0x6690('0x20')]({'raw':_0x2e8d2e[_0x6690('0x15')]?_0x2e8d2e['options'][_0x6690('0x16')]===undefined?!![]:![]:!![],'where':_0x2e8d2e['options']?_0x2e8d2e['options']['where']||null:null,'attributes':_0x2e8d2e[_0x6690('0x15')]?_0x2e8d2e[_0x6690('0x15')][_0x6690('0x18')]||null:null,'include':_0x2e8d2e[_0x6690('0x15')]?_0x2e8d2e['options'][_0x6690('0x1a')]?_[_0x6690('0x1b')](_0x2e8d2e[_0x6690('0x15')][_0x6690('0x1a')],function(_0x509f7b){return{'model':db[_0x509f7b['model']],'as':_0x509f7b['as'],'attributes':_0x509f7b[_0x6690('0x18')],'include':_0x509f7b[_0x6690('0x1a')]?_[_0x6690('0x1b')](_0x509f7b[_0x6690('0x1a')],function(_0x4f26f5){return{'model':db[_0x4f26f5[_0x6690('0x1c')]],'as':_0x4f26f5['as'],'attributes':_0x4f26f5[_0x6690('0x18')],'include':_0x4f26f5[_0x6690('0x1a')]?_[_0x6690('0x1b')](_0x4f26f5[_0x6690('0x1a')],function(_0x4b142c){return{'model':db[_0x4b142c[_0x6690('0x1c')]],'as':_0x4b142c['as'],'attributes':_0x4b142c[_0x6690('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32ac47){logger[_0x6690('0x12')](_0x6690('0x1f'),_0x2e8d2e);logger['debug'](_0x6690('0x1f'),_0x2e8d2e,JSON[_0x6690('0xf')](_0x32ac47));_0x1ec4a8(_0x32ac47);})[_0x6690('0x1e')](function(_0x4a06cd){logger['error']('ShowZendeskAccount',_0x4a06cd[_0x6690('0x11')],_0x2e8d2e);_0x81fc0a(_0x5708f7[_0x6690('0x10')](0x1f4,_0x4a06cd['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 4615739..2b68b4d 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 _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0abf[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x1ff647,_0x247a62){var _0x1ff002=function(_0x71e6c1){while(--_0x71e6c1){_0x1ff647['push'](_0x1ff647['shift']());}};_0x1ff002(++_0x247a62);}(_0x0bb5,0x148));var _0x50bb=function(_0x9a0cc,_0x43107b){_0x9a0cc=_0x9a0cc-0x0;var _0x3acc26=_0x0bb5[_0x9a0cc];return _0x3acc26;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b81597f..b4ed993 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 _0x6399=['STRING','sequelize'];(function(_0x3fa631,_0x24392c){var _0x5c9dec=function(_0x36d01a){while(--_0x36d01a){_0x3fa631['push'](_0x3fa631['shift']());}};_0x5c9dec(++_0x24392c);}(_0x6399,0x157));var _0x9639=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6399[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x9639('0x0'));module['exports']={'name':{'type':Sequelize[_0x9639('0x1')]},'description':{'type':Sequelize[_0x9639('0x1')]}}; \ No newline at end of file +var _0xbf4b=['STRING','exports'];(function(_0x20296a,_0x55056a){var _0x51c005=function(_0x248bd9){while(--_0x248bd9){_0x20296a['push'](_0x20296a['shift']());}};_0x51c005(++_0x55056a);}(_0xbf4b,0x16d));var _0xbbf4=function(_0x3a83c8,_0x489ffd){_0x3a83c8=_0x3a83c8-0x0;var _0x5c89db=_0xbf4b[_0x3a83c8];return _0x5c89db;};'use strict';var Sequelize=require('sequelize');module[_0xbbf4('0x0')]={'name':{'type':Sequelize[_0xbbf4('0x1')]},'description':{'type':Sequelize[_0xbbf4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index f9a79f3..17f420e 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 _0xd3bb=['set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','map','ZendeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','then','includeAll','include','rows','catch','show','fields','find','create','body','params','findOne','ZendeskField','length','getFields','getSubjects','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd3bb,0xd3));var _0xbd3b=function(_0x1a7b98,_0x4dcb5e){_0x1a7b98=_0x1a7b98-0x0;var _0x260768=_0xd3bb[_0x1a7b98];return _0x260768;};'use strict';var emlformat=require(_0xbd3b('0x0'));var rimraf=require(_0xbd3b('0x1'));var zipdir=require(_0xbd3b('0x2'));var jsonpatch=require(_0xbd3b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd3b('0x4'));var util=require(_0xbd3b('0x5'));var path=require('path');var sox=require(_0xbd3b('0x6'));var csv=require(_0xbd3b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd3b('0x8'));var _=require(_0xbd3b('0x9'));var squel=require(_0xbd3b('0xa'));var crypto=require(_0xbd3b('0xb'));var jsforce=require(_0xbd3b('0xc'));var deskjs=require(_0xbd3b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbd3b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd3b('0xf'));var as=require(_0xbd3b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd3b('0x11'))(_0xbd3b('0x12'));var utils=require(_0xbd3b('0x13'));var config=require(_0xbd3b('0x14'));var licenseUtil=require(_0xbd3b('0x15'));var db=require(_0xbd3b('0x16'))['db'];function respondWithStatusCode(_0x4e79d4,_0x2200a5){_0x2200a5=_0x2200a5||0xcc;return function(_0xac2c59){if(_0xac2c59){return _0x4e79d4['sendStatus'](_0x2200a5);}return _0x4e79d4[_0xbd3b('0x17')](_0x2200a5)['end']();};}function respondWithResult(_0x383f71,_0x525033){_0x525033=_0x525033||0xc8;return function(_0x547882){if(_0x547882){return _0x383f71[_0xbd3b('0x17')](_0x525033)[_0xbd3b('0x18')](_0x547882);}};}function respondWithFilteredResult(_0x37e2f1,_0x483534){return function(_0x2c1840){if(_0x2c1840){var _0x1ede98=typeof _0x483534[_0xbd3b('0x19')]===_0xbd3b('0x1a')&&typeof _0x483534[_0xbd3b('0x1b')]==='undefined';var _0xd20fdd=_0x2c1840['count'];var _0x24f7b4=_0x1ede98?0x0:_0x483534[_0xbd3b('0x19')];var _0x217488=_0x1ede98?_0x2c1840[_0xbd3b('0x1c')]:_0x483534['offset']+_0x483534[_0xbd3b('0x1b')];var _0x40573c;if(_0x217488>=_0xd20fdd){_0x217488=_0xd20fdd;_0x40573c=0xc8;}else{_0x40573c=0xce;}_0x37e2f1[_0xbd3b('0x17')](_0x40573c);return _0x37e2f1[_0xbd3b('0x1d')](_0xbd3b('0x1e'),_0x24f7b4+'-'+_0x217488+'/'+_0xd20fdd)[_0xbd3b('0x18')](_0x2c1840);}return null;};}function patchUpdates(_0x287adb){return function(_0xd1da26){try{jsonpatch[_0xbd3b('0x1f')](_0xd1da26,_0x287adb,!![]);}catch(_0x54bec1){return BPromise[_0xbd3b('0x20')](_0x54bec1);}return _0xd1da26[_0xbd3b('0x21')]();};}function saveUpdates(_0x526a96,_0x32d39d){return function(_0xcc1714){if(_0xcc1714){return _0xcc1714[_0xbd3b('0x22')](_0x526a96)['then'](function(_0x45dc84){return _0x45dc84;});}return null;};}function removeEntity(_0x33dbbc,_0x6e64f1){return function(_0x1500bb){if(_0x1500bb){return _0x1500bb[_0xbd3b('0x23')]()['then'](function(){_0x33dbbc[_0xbd3b('0x17')](0xcc)[_0xbd3b('0x24')]();});}};}function handleEntityNotFound(_0x5c989c,_0x4c9a35){return function(_0xa9d363){if(!_0xa9d363){_0x5c989c[_0xbd3b('0x25')](0x194);}return _0xa9d363;};}function handleError(_0x57ede9,_0x52f3bd){_0x52f3bd=_0x52f3bd||0x1f4;return function(_0x325407){logger[_0xbd3b('0x26')](_0x325407[_0xbd3b('0x27')]);if(_0x325407[_0xbd3b('0x28')]){delete _0x325407['name'];}_0x57ede9[_0xbd3b('0x17')](_0x52f3bd)['send'](_0x325407);};}exports['index']=function(_0x2bec8f,_0x29b631){var _0x5a7c20={},_0x534ceb={},_0x3d78dc={'count':0x0,'rows':[]};var _0x2fc9a3=_[_0xbd3b('0x29')](db[_0xbd3b('0x2a')][_0xbd3b('0x2b')],function(_0x430f59){return{'name':_0x430f59['fieldName'],'type':_0x430f59['type'][_0xbd3b('0x2c')]};});_0x534ceb[_0xbd3b('0x2d')]=_[_0xbd3b('0x29')](_0x2fc9a3,'name');_0x534ceb[_0xbd3b('0x2e')]=_[_0xbd3b('0x2f')](_0x2bec8f[_0xbd3b('0x2e')]);_0x534ceb[_0xbd3b('0x30')]=_[_0xbd3b('0x31')](_0x534ceb[_0xbd3b('0x2d')],_0x534ceb[_0xbd3b('0x2e')]);_0x5a7c20[_0xbd3b('0x32')]=_[_0xbd3b('0x31')](_0x534ceb[_0xbd3b('0x2d')],qs['fields'](_0x2bec8f[_0xbd3b('0x2e')]['fields']));_0x5a7c20[_0xbd3b('0x32')]=_0x5a7c20['attributes']['length']?_0x5a7c20[_0xbd3b('0x32')]:_0x534ceb[_0xbd3b('0x2d')];if(!_0x2bec8f['query'][_0xbd3b('0x33')](_0xbd3b('0x34'))){_0x5a7c20['limit']=qs[_0xbd3b('0x1b')](_0x2bec8f[_0xbd3b('0x2e')]['limit']);_0x5a7c20['offset']=qs[_0xbd3b('0x19')](_0x2bec8f[_0xbd3b('0x2e')][_0xbd3b('0x19')]);}_0x5a7c20[_0xbd3b('0x35')]=qs[_0xbd3b('0x36')](_0x2bec8f[_0xbd3b('0x2e')]['sort']);_0x5a7c20[_0xbd3b('0x37')]=qs['filters'](_[_0xbd3b('0x38')](_0x2bec8f[_0xbd3b('0x2e')],_0x534ceb[_0xbd3b('0x30')]),_0x2fc9a3);if(_0x2bec8f[_0xbd3b('0x2e')]['filter']){_0x5a7c20['where']=_[_0xbd3b('0x39')](_0x5a7c20[_0xbd3b('0x37')],{'$or':_[_0xbd3b('0x29')](_0x2fc9a3,function(_0x14f0ce){if(_0x14f0ce['type']!=='VIRTUAL'){var _0x2a9a0c={};_0x2a9a0c[_0x14f0ce['name']]={'$like':'%'+_0x2bec8f[_0xbd3b('0x2e')][_0xbd3b('0x3a')]+'%'};return _0x2a9a0c;}})});}_0x5a7c20=_[_0xbd3b('0x39')]({},_0x5a7c20,_0x2bec8f[_0xbd3b('0x3b')]);var _0x5ece19={'where':_0x5a7c20[_0xbd3b('0x37')]};return db[_0xbd3b('0x2a')]['count'](_0x5ece19)[_0xbd3b('0x3c')](function(_0x586d96){_0x3d78dc[_0xbd3b('0x1c')]=_0x586d96;if(_0x2bec8f[_0xbd3b('0x2e')][_0xbd3b('0x3d')]){_0x5a7c20[_0xbd3b('0x3e')]=[{'all':!![]}];}return db[_0xbd3b('0x2a')]['findAll'](_0x5a7c20);})['then'](function(_0x37593d){_0x3d78dc[_0xbd3b('0x3f')]=_0x37593d;return _0x3d78dc;})[_0xbd3b('0x3c')](respondWithFilteredResult(_0x29b631,_0x5a7c20))[_0xbd3b('0x40')](handleError(_0x29b631,null));};exports[_0xbd3b('0x41')]=function(_0x2a2b8f,_0x11e731){var _0x6bdad2={'raw':![],'where':{'id':_0x2a2b8f['params']['id']}},_0x522ba2={};_0x522ba2[_0xbd3b('0x2d')]=_[_0xbd3b('0x2f')](db['ZendeskConfiguration'][_0xbd3b('0x2b')]);_0x522ba2[_0xbd3b('0x2e')]=_[_0xbd3b('0x2f')](_0x2a2b8f[_0xbd3b('0x2e')]);_0x522ba2['filters']=_[_0xbd3b('0x31')](_0x522ba2[_0xbd3b('0x2d')],_0x522ba2[_0xbd3b('0x2e')]);_0x6bdad2[_0xbd3b('0x32')]=_[_0xbd3b('0x31')](_0x522ba2[_0xbd3b('0x2d')],qs[_0xbd3b('0x42')](_0x2a2b8f['query']['fields']));_0x6bdad2[_0xbd3b('0x32')]=_0x6bdad2[_0xbd3b('0x32')]['length']?_0x6bdad2[_0xbd3b('0x32')]:_0x522ba2[_0xbd3b('0x2d')];if(_0x2a2b8f[_0xbd3b('0x2e')]['includeAll']){_0x6bdad2[_0xbd3b('0x3e')]=[{'all':!![]}];}_0x6bdad2=_[_0xbd3b('0x39')]({},_0x6bdad2,_0x2a2b8f[_0xbd3b('0x3b')]);return db[_0xbd3b('0x2a')][_0xbd3b('0x43')](_0x6bdad2)['then'](handleEntityNotFound(_0x11e731,null))[_0xbd3b('0x3c')](respondWithResult(_0x11e731,null))['catch'](handleError(_0x11e731,null));};exports[_0xbd3b('0x44')]=function(_0x16809b,_0x34c5b8){return db['ZendeskConfiguration'][_0xbd3b('0x44')](_0x16809b[_0xbd3b('0x45')],{})[_0xbd3b('0x3c')](respondWithResult(_0x34c5b8,0xc9))[_0xbd3b('0x40')](handleError(_0x34c5b8,null));};exports['update']=function(_0x54206d,_0x128f97){if(_0x54206d['body']['id']){delete _0x54206d[_0xbd3b('0x45')]['id'];}return db[_0xbd3b('0x2a')]['find']({'where':{'id':_0x54206d['params']['id']}})[_0xbd3b('0x3c')](handleEntityNotFound(_0x128f97,null))[_0xbd3b('0x3c')](saveUpdates(_0x54206d[_0xbd3b('0x45')],null))[_0xbd3b('0x3c')](respondWithResult(_0x128f97,null))['catch'](handleError(_0x128f97,null));};exports['destroy']=function(_0x5b1a81,_0x500b1e){return db['ZendeskConfiguration'][_0xbd3b('0x43')]({'where':{'id':_0x5b1a81[_0xbd3b('0x46')]['id']}})[_0xbd3b('0x3c')](handleEntityNotFound(_0x500b1e,null))[_0xbd3b('0x3c')](removeEntity(_0x500b1e,null))[_0xbd3b('0x40')](handleError(_0x500b1e,null));};exports['getFields']=function(_0x334438,_0xc03a09,_0x795df3){var _0x222232={};var _0x3dbdc7={};var _0x43bdbb;var _0x151750;return db[_0xbd3b('0x2a')][_0xbd3b('0x47')]({'where':{'id':_0x334438['params']['id']}})[_0xbd3b('0x3c')](handleEntityNotFound(_0xc03a09,null))[_0xbd3b('0x3c')](function(_0x412def){if(_0x412def){_0x43bdbb=_0x412def;_0x3dbdc7[_0xbd3b('0x2d')]=_[_0xbd3b('0x2f')](db[_0xbd3b('0x48')][_0xbd3b('0x2b')]);_0x3dbdc7['query']=_[_0xbd3b('0x2f')](_0x334438[_0xbd3b('0x2e')]);_0x3dbdc7[_0xbd3b('0x30')]=_[_0xbd3b('0x31')](_0x3dbdc7[_0xbd3b('0x2d')],_0x3dbdc7['query']);_0x222232['attributes']=_[_0xbd3b('0x31')](_0x3dbdc7[_0xbd3b('0x2d')],qs[_0xbd3b('0x42')](_0x334438[_0xbd3b('0x2e')][_0xbd3b('0x42')]));_0x222232[_0xbd3b('0x32')]=_0x222232[_0xbd3b('0x32')][_0xbd3b('0x49')]?_0x222232[_0xbd3b('0x32')]:_0x3dbdc7[_0xbd3b('0x2d')];_0x222232[_0xbd3b('0x35')]=qs['sort'](_0x334438['query'][_0xbd3b('0x36')]);_0x222232[_0xbd3b('0x37')]=qs['filters'](_[_0xbd3b('0x38')](_0x334438[_0xbd3b('0x2e')],_0x3dbdc7[_0xbd3b('0x30')]));if(_0x334438[_0xbd3b('0x2e')][_0xbd3b('0x3a')]){_0x222232['where']=_[_0xbd3b('0x39')](_0x222232['where'],{'$or':_[_0xbd3b('0x29')](_0x222232[_0xbd3b('0x32')],function(_0x3248c5){var _0x3febe3={};_0x3febe3[_0x3248c5]={'$like':'%'+_0x334438[_0xbd3b('0x2e')][_0xbd3b('0x3a')]+'%'};return _0x3febe3;})});}_0x222232=_[_0xbd3b('0x39')]({},_0x222232,_0x334438['options']);return _0x43bdbb[_0xbd3b('0x4a')](_0x222232);}})['then'](function(_0x162e44){if(_0x162e44){_0x151750=_0x162e44[_0xbd3b('0x49')];if(!_0x334438[_0xbd3b('0x2e')]['hasOwnProperty']('nolimit')){_0x222232['limit']=qs[_0xbd3b('0x1b')](_0x334438['query']['limit']);_0x222232[_0xbd3b('0x19')]=qs[_0xbd3b('0x19')](_0x334438[_0xbd3b('0x2e')]['offset']);}return _0x43bdbb[_0xbd3b('0x4a')](_0x222232);}})[_0xbd3b('0x3c')](function(_0x26e897){if(_0x26e897){return _0x26e897?{'count':_0x151750,'rows':_0x26e897}:null;}})[_0xbd3b('0x3c')](respondWithResult(_0xc03a09,null))[_0xbd3b('0x40')](handleError(_0xc03a09,null));};exports[_0xbd3b('0x4b')]=function(_0x5a4f0e,_0x118934,_0x2c5ae5){var _0x2aae66={};var _0x24ee46={};var _0x508762;var _0x6381d9;return db[_0xbd3b('0x2a')][_0xbd3b('0x47')]({'where':{'id':_0x5a4f0e['params']['id']}})[_0xbd3b('0x3c')](handleEntityNotFound(_0x118934,null))['then'](function(_0x463254){if(_0x463254){_0x508762=_0x463254;_0x24ee46[_0xbd3b('0x2d')]=_['keys'](db[_0xbd3b('0x48')]['rawAttributes']);_0x24ee46[_0xbd3b('0x2e')]=_[_0xbd3b('0x2f')](_0x5a4f0e[_0xbd3b('0x2e')]);_0x24ee46[_0xbd3b('0x30')]=_[_0xbd3b('0x31')](_0x24ee46['model'],_0x24ee46[_0xbd3b('0x2e')]);_0x2aae66[_0xbd3b('0x32')]=_[_0xbd3b('0x31')](_0x24ee46['model'],qs[_0xbd3b('0x42')](_0x5a4f0e[_0xbd3b('0x2e')][_0xbd3b('0x42')]));_0x2aae66['attributes']=_0x2aae66['attributes']['length']?_0x2aae66[_0xbd3b('0x32')]:_0x24ee46[_0xbd3b('0x2d')];_0x2aae66[_0xbd3b('0x35')]=qs['sort'](_0x5a4f0e[_0xbd3b('0x2e')][_0xbd3b('0x36')]);_0x2aae66[_0xbd3b('0x37')]=qs[_0xbd3b('0x30')](_[_0xbd3b('0x38')](_0x5a4f0e[_0xbd3b('0x2e')],_0x24ee46[_0xbd3b('0x30')]));if(_0x5a4f0e[_0xbd3b('0x2e')][_0xbd3b('0x3a')]){_0x2aae66[_0xbd3b('0x37')]=_[_0xbd3b('0x39')](_0x2aae66['where'],{'$or':_[_0xbd3b('0x29')](_0x2aae66['attributes'],function(_0x2c83d4){var _0x4fcbe7={};_0x4fcbe7[_0x2c83d4]={'$like':'%'+_0x5a4f0e[_0xbd3b('0x2e')][_0xbd3b('0x3a')]+'%'};return _0x4fcbe7;})});}_0x2aae66=_[_0xbd3b('0x39')]({},_0x2aae66,_0x5a4f0e[_0xbd3b('0x3b')]);return _0x508762[_0xbd3b('0x4b')](_0x2aae66);}})['then'](function(_0x3f0990){if(_0x3f0990){_0x6381d9=_0x3f0990[_0xbd3b('0x49')];if(!_0x5a4f0e[_0xbd3b('0x2e')][_0xbd3b('0x33')](_0xbd3b('0x34'))){_0x2aae66[_0xbd3b('0x1b')]=qs['limit'](_0x5a4f0e[_0xbd3b('0x2e')][_0xbd3b('0x1b')]);_0x2aae66[_0xbd3b('0x19')]=qs['offset'](_0x5a4f0e[_0xbd3b('0x2e')][_0xbd3b('0x19')]);}return _0x508762[_0xbd3b('0x4b')](_0x2aae66);}})[_0xbd3b('0x3c')](function(_0x1772e2){if(_0x1772e2){return _0x1772e2?{'count':_0x6381d9,'rows':_0x1772e2}:null;}})['then'](respondWithResult(_0x118934,null))['catch'](handleError(_0x118934,null));};exports['getDescriptions']=function(_0x2f745c,_0x20170d,_0x248d96){var _0x3c0c67={};var _0x261ff4={};var _0x2a1503;var _0x39441d;return db['ZendeskConfiguration'][_0xbd3b('0x47')]({'where':{'id':_0x2f745c['params']['id']}})[_0xbd3b('0x3c')](handleEntityNotFound(_0x20170d,null))[_0xbd3b('0x3c')](function(_0x4822fc){if(_0x4822fc){_0x2a1503=_0x4822fc;_0x261ff4[_0xbd3b('0x2d')]=_[_0xbd3b('0x2f')](db[_0xbd3b('0x48')][_0xbd3b('0x2b')]);_0x261ff4[_0xbd3b('0x2e')]=_[_0xbd3b('0x2f')](_0x2f745c['query']);_0x261ff4[_0xbd3b('0x30')]=_[_0xbd3b('0x31')](_0x261ff4[_0xbd3b('0x2d')],_0x261ff4[_0xbd3b('0x2e')]);_0x3c0c67[_0xbd3b('0x32')]=_['intersection'](_0x261ff4['model'],qs[_0xbd3b('0x42')](_0x2f745c[_0xbd3b('0x2e')]['fields']));_0x3c0c67[_0xbd3b('0x32')]=_0x3c0c67[_0xbd3b('0x32')][_0xbd3b('0x49')]?_0x3c0c67[_0xbd3b('0x32')]:_0x261ff4[_0xbd3b('0x2d')];_0x3c0c67['order']=qs['sort'](_0x2f745c[_0xbd3b('0x2e')][_0xbd3b('0x36')]);_0x3c0c67[_0xbd3b('0x37')]=qs['filters'](_[_0xbd3b('0x38')](_0x2f745c[_0xbd3b('0x2e')],_0x261ff4[_0xbd3b('0x30')]));if(_0x2f745c['query'][_0xbd3b('0x3a')]){_0x3c0c67[_0xbd3b('0x37')]=_['merge'](_0x3c0c67[_0xbd3b('0x37')],{'$or':_[_0xbd3b('0x29')](_0x3c0c67[_0xbd3b('0x32')],function(_0x507eab){var _0x46a931={};_0x46a931[_0x507eab]={'$like':'%'+_0x2f745c[_0xbd3b('0x2e')][_0xbd3b('0x3a')]+'%'};return _0x46a931;})});}_0x3c0c67=_['merge']({},_0x3c0c67,_0x2f745c['options']);return _0x2a1503['getDescriptions'](_0x3c0c67);}})[_0xbd3b('0x3c')](function(_0x3f9e91){if(_0x3f9e91){_0x39441d=_0x3f9e91[_0xbd3b('0x49')];if(!_0x2f745c[_0xbd3b('0x2e')]['hasOwnProperty']('nolimit')){_0x3c0c67['limit']=qs['limit'](_0x2f745c['query'][_0xbd3b('0x1b')]);_0x3c0c67['offset']=qs[_0xbd3b('0x19')](_0x2f745c[_0xbd3b('0x2e')][_0xbd3b('0x19')]);}return _0x2a1503['getDescriptions'](_0x3c0c67);}})[_0xbd3b('0x3c')](function(_0x2fca7e){if(_0x2fca7e){return _0x2fca7e?{'count':_0x39441d,'rows':_0x2fca7e}:null;}})['then'](respondWithResult(_0x20170d,null))['catch'](handleError(_0x20170d,null));};exports[_0xbd3b('0x4c')]=function(_0xd5618a,_0x37ae4f,_0xc7c03b){var _0x35bd63={};var _0x3694b8={};var _0x4d5c21;var _0x59e4cd;return db[_0xbd3b('0x2a')][_0xbd3b('0x47')]({'where':{'id':_0xd5618a[_0xbd3b('0x46')]['id']}})[_0xbd3b('0x3c')](handleEntityNotFound(_0x37ae4f,null))[_0xbd3b('0x3c')](function(_0x558f90){if(_0x558f90){_0x4d5c21=_0x558f90;_0x3694b8[_0xbd3b('0x2d')]=_[_0xbd3b('0x2f')](db[_0xbd3b('0x4d')][_0xbd3b('0x2b')]);_0x3694b8[_0xbd3b('0x2e')]=_['keys'](_0xd5618a[_0xbd3b('0x2e')]);_0x3694b8['filters']=_['intersection'](_0x3694b8[_0xbd3b('0x2d')],_0x3694b8['query']);_0x35bd63[_0xbd3b('0x32')]=_[_0xbd3b('0x31')](_0x3694b8[_0xbd3b('0x2d')],qs[_0xbd3b('0x42')](_0xd5618a[_0xbd3b('0x2e')][_0xbd3b('0x42')]));_0x35bd63[_0xbd3b('0x32')]=_0x35bd63[_0xbd3b('0x32')][_0xbd3b('0x49')]?_0x35bd63[_0xbd3b('0x32')]:_0x3694b8[_0xbd3b('0x2d')];_0x35bd63[_0xbd3b('0x35')]=qs[_0xbd3b('0x36')](_0xd5618a[_0xbd3b('0x2e')][_0xbd3b('0x36')]);_0x35bd63[_0xbd3b('0x37')]=qs[_0xbd3b('0x30')](_[_0xbd3b('0x38')](_0xd5618a[_0xbd3b('0x2e')],_0x3694b8[_0xbd3b('0x30')]));if(_0xd5618a['query'][_0xbd3b('0x3a')]){_0x35bd63[_0xbd3b('0x37')]=_[_0xbd3b('0x39')](_0x35bd63['where'],{'$or':_[_0xbd3b('0x29')](_0x35bd63[_0xbd3b('0x32')],function(_0x5d4b51){var _0x2a3c78={};_0x2a3c78[_0x5d4b51]={'$like':'%'+_0xd5618a[_0xbd3b('0x2e')][_0xbd3b('0x3a')]+'%'};return _0x2a3c78;})});}_0x35bd63=_['merge']({},_0x35bd63,_0xd5618a['options']);return _0x4d5c21[_0xbd3b('0x4c')](_0x35bd63);}})[_0xbd3b('0x3c')](function(_0x384aad){if(_0x384aad){_0x59e4cd=_0x384aad['length'];if(!_0xd5618a['query'][_0xbd3b('0x33')](_0xbd3b('0x34'))){_0x35bd63[_0xbd3b('0x1b')]=qs[_0xbd3b('0x1b')](_0xd5618a['query']['limit']);_0x35bd63['offset']=qs[_0xbd3b('0x19')](_0xd5618a[_0xbd3b('0x2e')][_0xbd3b('0x19')]);}return _0x4d5c21[_0xbd3b('0x4c')](_0x35bd63);}})['then'](function(_0x23a2a4){if(_0x23a2a4){return _0x23a2a4?{'count':_0x59e4cd,'rows':_0x23a2a4}:null;}})[_0xbd3b('0x3c')](respondWithResult(_0x37ae4f,null))[_0xbd3b('0x40')](handleError(_0x37ae4f,null));};exports['setTags']=function(_0xad7eb6,_0x29a949,_0x5890f4){if(_0xad7eb6[_0xbd3b('0x45')]['id']){delete _0xad7eb6[_0xbd3b('0x45')]['id'];}return db['ZendeskConfiguration'][_0xbd3b('0x47')]({'where':{'id':_0xad7eb6[_0xbd3b('0x46')]['id']}})[_0xbd3b('0x3c')](handleEntityNotFound(_0x29a949,null))[_0xbd3b('0x3c')](function(_0xf39163){if(_0xf39163){return _0xf39163[_0xbd3b('0x4e')](_0xad7eb6['body'][_0xbd3b('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x29a949,null))[_0xbd3b('0x40')](handleError(_0x29a949,null));}; \ No newline at end of file +var _0x6f55=['setTags','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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/environment','status','end','json','count','offset','limit','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getFields','findOne','ZendeskField','length','pick','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag'];(function(_0x54e060,_0x4e9d1b){var _0x3c6b13=function(_0x57ee95){while(--_0x57ee95){_0x54e060['push'](_0x54e060['shift']());}};_0x3c6b13(++_0x4e9d1b);}(_0x6f55,0xa3));var _0x56f5=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x6f55[_0x34bc30];return _0x5706de;};'use strict';var emlformat=require(_0x56f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56f5('0x1'));var jsonpatch=require(_0x56f5('0x2'));var rp=require('request-promise');var moment=require(_0x56f5('0x3'));var BPromise=require(_0x56f5('0x4'));var Mustache=require(_0x56f5('0x5'));var util=require(_0x56f5('0x6'));var path=require(_0x56f5('0x7'));var sox=require('sox');var csv=require(_0x56f5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56f5('0x9'));var _=require(_0x56f5('0xa'));var squel=require(_0x56f5('0xb'));var crypto=require('crypto');var jsforce=require(_0x56f5('0xc'));var deskjs=require(_0x56f5('0xd'));var toCsv=require(_0x56f5('0x8'));var querystring=require(_0x56f5('0xe'));var Papa=require(_0x56f5('0xf'));var Redis=require(_0x56f5('0x10'));var authService=require(_0x56f5('0x11'));var qs=require(_0x56f5('0x12'));var as=require(_0x56f5('0x13'));var hardwareService=require(_0x56f5('0x14'));var logger=require(_0x56f5('0x15'))(_0x56f5('0x16'));var utils=require(_0x56f5('0x17'));var config=require(_0x56f5('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3185ef,_0x47143f){_0x47143f=_0x47143f||0xcc;return function(_0x24556f){if(_0x24556f){return _0x3185ef['sendStatus'](_0x47143f);}return _0x3185ef[_0x56f5('0x19')](_0x47143f)[_0x56f5('0x1a')]();};}function respondWithResult(_0x370836,_0x469f48){_0x469f48=_0x469f48||0xc8;return function(_0x430867){if(_0x430867){return _0x370836['status'](_0x469f48)[_0x56f5('0x1b')](_0x430867);}};}function respondWithFilteredResult(_0x3a8ffa,_0x1a2f99){return function(_0x1cd32b){if(_0x1cd32b){var _0x4032e7=typeof _0x1a2f99['offset']==='undefined'&&typeof _0x1a2f99['limit']==='undefined';var _0x5f0d0d=_0x1cd32b[_0x56f5('0x1c')];var _0x4db4b8=_0x4032e7?0x0:_0x1a2f99[_0x56f5('0x1d')];var _0x43e339=_0x4032e7?_0x1cd32b['count']:_0x1a2f99['offset']+_0x1a2f99[_0x56f5('0x1e')];var _0x43c4fd;if(_0x43e339>=_0x5f0d0d){_0x43e339=_0x5f0d0d;_0x43c4fd=0xc8;}else{_0x43c4fd=0xce;}_0x3a8ffa[_0x56f5('0x19')](_0x43c4fd);return _0x3a8ffa['set']('Content-Range',_0x4db4b8+'-'+_0x43e339+'/'+_0x5f0d0d)['json'](_0x1cd32b);}return null;};}function patchUpdates(_0x36a344){return function(_0x3a6296){try{jsonpatch[_0x56f5('0x1f')](_0x3a6296,_0x36a344,!![]);}catch(_0x3a65ca){return BPromise[_0x56f5('0x20')](_0x3a65ca);}return _0x3a6296['save']();};}function saveUpdates(_0x319c93,_0x5725e9){return function(_0x480176){if(_0x480176){return _0x480176[_0x56f5('0x21')](_0x319c93)['then'](function(_0x32cefe){return _0x32cefe;});}return null;};}function removeEntity(_0x271b89,_0x11f59a){return function(_0x5e0b6a){if(_0x5e0b6a){return _0x5e0b6a[_0x56f5('0x22')]()[_0x56f5('0x23')](function(){_0x271b89['status'](0xcc)[_0x56f5('0x1a')]();});}};}function handleEntityNotFound(_0x4da71a,_0x241ab9){return function(_0x3d9a97){if(!_0x3d9a97){_0x4da71a[_0x56f5('0x24')](0x194);}return _0x3d9a97;};}function handleError(_0x305825,_0x38a91a){_0x38a91a=_0x38a91a||0x1f4;return function(_0x515915){logger[_0x56f5('0x25')](_0x515915[_0x56f5('0x26')]);if(_0x515915[_0x56f5('0x27')]){delete _0x515915[_0x56f5('0x27')];}_0x305825[_0x56f5('0x19')](_0x38a91a)[_0x56f5('0x28')](_0x515915);};}exports[_0x56f5('0x29')]=function(_0xa125c7,_0x5b0221){var _0x571a41={},_0x3a1973={},_0x52fbef={'count':0x0,'rows':[]};var _0x250208=_[_0x56f5('0x2a')](db[_0x56f5('0x2b')][_0x56f5('0x2c')],function(_0x31b055){return{'name':_0x31b055['fieldName'],'type':_0x31b055[_0x56f5('0x2d')]['key']};});_0x3a1973[_0x56f5('0x2e')]=_[_0x56f5('0x2a')](_0x250208,_0x56f5('0x27'));_0x3a1973[_0x56f5('0x2f')]=_[_0x56f5('0x30')](_0xa125c7['query']);_0x3a1973[_0x56f5('0x31')]=_[_0x56f5('0x32')](_0x3a1973[_0x56f5('0x2e')],_0x3a1973[_0x56f5('0x2f')]);_0x571a41['attributes']=_['intersection'](_0x3a1973[_0x56f5('0x2e')],qs[_0x56f5('0x33')](_0xa125c7['query']['fields']));_0x571a41[_0x56f5('0x34')]=_0x571a41[_0x56f5('0x34')]['length']?_0x571a41[_0x56f5('0x34')]:_0x3a1973[_0x56f5('0x2e')];if(!_0xa125c7[_0x56f5('0x2f')]['hasOwnProperty'](_0x56f5('0x35'))){_0x571a41[_0x56f5('0x1e')]=qs[_0x56f5('0x1e')](_0xa125c7[_0x56f5('0x2f')][_0x56f5('0x1e')]);_0x571a41['offset']=qs[_0x56f5('0x1d')](_0xa125c7[_0x56f5('0x2f')][_0x56f5('0x1d')]);}_0x571a41[_0x56f5('0x36')]=qs['sort'](_0xa125c7[_0x56f5('0x2f')][_0x56f5('0x37')]);_0x571a41[_0x56f5('0x38')]=qs[_0x56f5('0x31')](_['pick'](_0xa125c7[_0x56f5('0x2f')],_0x3a1973[_0x56f5('0x31')]),_0x250208);if(_0xa125c7[_0x56f5('0x2f')][_0x56f5('0x39')]){_0x571a41[_0x56f5('0x38')]=_[_0x56f5('0x3a')](_0x571a41[_0x56f5('0x38')],{'$or':_['map'](_0x250208,function(_0x5aa716){if(_0x5aa716[_0x56f5('0x2d')]!==_0x56f5('0x3b')){var _0x38d4f5={};_0x38d4f5[_0x5aa716['name']]={'$like':'%'+_0xa125c7[_0x56f5('0x2f')][_0x56f5('0x39')]+'%'};return _0x38d4f5;}})});}_0x571a41=_[_0x56f5('0x3a')]({},_0x571a41,_0xa125c7[_0x56f5('0x3c')]);var _0xea78b0={'where':_0x571a41[_0x56f5('0x38')]};return db[_0x56f5('0x2b')][_0x56f5('0x1c')](_0xea78b0)[_0x56f5('0x23')](function(_0xd090df){_0x52fbef[_0x56f5('0x1c')]=_0xd090df;if(_0xa125c7['query'][_0x56f5('0x3d')]){_0x571a41[_0x56f5('0x3e')]=[{'all':!![]}];}return db[_0x56f5('0x2b')][_0x56f5('0x3f')](_0x571a41);})[_0x56f5('0x23')](function(_0x5c79e5){_0x52fbef['rows']=_0x5c79e5;return _0x52fbef;})[_0x56f5('0x23')](respondWithFilteredResult(_0x5b0221,_0x571a41))[_0x56f5('0x40')](handleError(_0x5b0221,null));};exports[_0x56f5('0x41')]=function(_0x3c38b4,_0x4b1b35){var _0x39d911={'raw':![],'where':{'id':_0x3c38b4[_0x56f5('0x42')]['id']}},_0x2eb470={};_0x2eb470['model']=_['keys'](db['ZendeskConfiguration'][_0x56f5('0x2c')]);_0x2eb470[_0x56f5('0x2f')]=_[_0x56f5('0x30')](_0x3c38b4[_0x56f5('0x2f')]);_0x2eb470[_0x56f5('0x31')]=_[_0x56f5('0x32')](_0x2eb470[_0x56f5('0x2e')],_0x2eb470[_0x56f5('0x2f')]);_0x39d911[_0x56f5('0x34')]=_['intersection'](_0x2eb470[_0x56f5('0x2e')],qs[_0x56f5('0x33')](_0x3c38b4['query']['fields']));_0x39d911[_0x56f5('0x34')]=_0x39d911['attributes']['length']?_0x39d911[_0x56f5('0x34')]:_0x2eb470[_0x56f5('0x2e')];if(_0x3c38b4[_0x56f5('0x2f')][_0x56f5('0x3d')]){_0x39d911[_0x56f5('0x3e')]=[{'all':!![]}];}_0x39d911=_[_0x56f5('0x3a')]({},_0x39d911,_0x3c38b4[_0x56f5('0x3c')]);return db['ZendeskConfiguration'][_0x56f5('0x43')](_0x39d911)[_0x56f5('0x23')](handleEntityNotFound(_0x4b1b35,null))['then'](respondWithResult(_0x4b1b35,null))[_0x56f5('0x40')](handleError(_0x4b1b35,null));};exports[_0x56f5('0x44')]=function(_0x8da87c,_0x107762){return db[_0x56f5('0x2b')]['create'](_0x8da87c['body'],{})['then'](respondWithResult(_0x107762,0xc9))['catch'](handleError(_0x107762,null));};exports[_0x56f5('0x21')]=function(_0x521fa9,_0x27b7f1){if(_0x521fa9[_0x56f5('0x45')]['id']){delete _0x521fa9[_0x56f5('0x45')]['id'];}return db[_0x56f5('0x2b')][_0x56f5('0x43')]({'where':{'id':_0x521fa9[_0x56f5('0x42')]['id']}})[_0x56f5('0x23')](handleEntityNotFound(_0x27b7f1,null))[_0x56f5('0x23')](saveUpdates(_0x521fa9[_0x56f5('0x45')],null))[_0x56f5('0x23')](respondWithResult(_0x27b7f1,null))[_0x56f5('0x40')](handleError(_0x27b7f1,null));};exports['destroy']=function(_0x1097d0,_0x24ae44){return db[_0x56f5('0x2b')][_0x56f5('0x43')]({'where':{'id':_0x1097d0[_0x56f5('0x42')]['id']}})[_0x56f5('0x23')](handleEntityNotFound(_0x24ae44,null))[_0x56f5('0x23')](removeEntity(_0x24ae44,null))[_0x56f5('0x40')](handleError(_0x24ae44,null));};exports[_0x56f5('0x46')]=function(_0x3918dc,_0x1c50ef,_0x2ae9f0){var _0x2a1ec3={};var _0x2eb943={};var _0x1088ec;var _0x686923;return db['ZendeskConfiguration'][_0x56f5('0x47')]({'where':{'id':_0x3918dc[_0x56f5('0x42')]['id']}})[_0x56f5('0x23')](handleEntityNotFound(_0x1c50ef,null))[_0x56f5('0x23')](function(_0x278117){if(_0x278117){_0x1088ec=_0x278117;_0x2eb943[_0x56f5('0x2e')]=_[_0x56f5('0x30')](db[_0x56f5('0x48')][_0x56f5('0x2c')]);_0x2eb943[_0x56f5('0x2f')]=_[_0x56f5('0x30')](_0x3918dc[_0x56f5('0x2f')]);_0x2eb943[_0x56f5('0x31')]=_[_0x56f5('0x32')](_0x2eb943[_0x56f5('0x2e')],_0x2eb943[_0x56f5('0x2f')]);_0x2a1ec3[_0x56f5('0x34')]=_[_0x56f5('0x32')](_0x2eb943[_0x56f5('0x2e')],qs[_0x56f5('0x33')](_0x3918dc['query'][_0x56f5('0x33')]));_0x2a1ec3[_0x56f5('0x34')]=_0x2a1ec3[_0x56f5('0x34')][_0x56f5('0x49')]?_0x2a1ec3[_0x56f5('0x34')]:_0x2eb943[_0x56f5('0x2e')];_0x2a1ec3[_0x56f5('0x36')]=qs[_0x56f5('0x37')](_0x3918dc['query'][_0x56f5('0x37')]);_0x2a1ec3[_0x56f5('0x38')]=qs[_0x56f5('0x31')](_[_0x56f5('0x4a')](_0x3918dc[_0x56f5('0x2f')],_0x2eb943[_0x56f5('0x31')]));if(_0x3918dc[_0x56f5('0x2f')][_0x56f5('0x39')]){_0x2a1ec3[_0x56f5('0x38')]=_[_0x56f5('0x3a')](_0x2a1ec3[_0x56f5('0x38')],{'$or':_[_0x56f5('0x2a')](_0x2a1ec3[_0x56f5('0x34')],function(_0x26c2a4){var _0x3fdfb8={};_0x3fdfb8[_0x26c2a4]={'$like':'%'+_0x3918dc['query'][_0x56f5('0x39')]+'%'};return _0x3fdfb8;})});}_0x2a1ec3=_[_0x56f5('0x3a')]({},_0x2a1ec3,_0x3918dc['options']);return _0x1088ec[_0x56f5('0x46')](_0x2a1ec3);}})[_0x56f5('0x23')](function(_0x274dd7){if(_0x274dd7){_0x686923=_0x274dd7[_0x56f5('0x49')];if(!_0x3918dc[_0x56f5('0x2f')]['hasOwnProperty']('nolimit')){_0x2a1ec3['limit']=qs[_0x56f5('0x1e')](_0x3918dc[_0x56f5('0x2f')][_0x56f5('0x1e')]);_0x2a1ec3[_0x56f5('0x1d')]=qs[_0x56f5('0x1d')](_0x3918dc[_0x56f5('0x2f')][_0x56f5('0x1d')]);}return _0x1088ec[_0x56f5('0x46')](_0x2a1ec3);}})[_0x56f5('0x23')](function(_0x28f36b){if(_0x28f36b){return _0x28f36b?{'count':_0x686923,'rows':_0x28f36b}:null;}})[_0x56f5('0x23')](respondWithResult(_0x1c50ef,null))[_0x56f5('0x40')](handleError(_0x1c50ef,null));};exports['getSubjects']=function(_0x23a6cb,_0x58d58c,_0x3b4632){var _0x17eef3={};var _0x371dd2={};var _0x6ed033;var _0x2e5b2b;return db[_0x56f5('0x2b')][_0x56f5('0x47')]({'where':{'id':_0x23a6cb[_0x56f5('0x42')]['id']}})['then'](handleEntityNotFound(_0x58d58c,null))[_0x56f5('0x23')](function(_0x57a3a8){if(_0x57a3a8){_0x6ed033=_0x57a3a8;_0x371dd2[_0x56f5('0x2e')]=_[_0x56f5('0x30')](db[_0x56f5('0x48')][_0x56f5('0x2c')]);_0x371dd2[_0x56f5('0x2f')]=_[_0x56f5('0x30')](_0x23a6cb[_0x56f5('0x2f')]);_0x371dd2[_0x56f5('0x31')]=_[_0x56f5('0x32')](_0x371dd2[_0x56f5('0x2e')],_0x371dd2[_0x56f5('0x2f')]);_0x17eef3[_0x56f5('0x34')]=_['intersection'](_0x371dd2[_0x56f5('0x2e')],qs['fields'](_0x23a6cb[_0x56f5('0x2f')][_0x56f5('0x33')]));_0x17eef3[_0x56f5('0x34')]=_0x17eef3[_0x56f5('0x34')][_0x56f5('0x49')]?_0x17eef3[_0x56f5('0x34')]:_0x371dd2[_0x56f5('0x2e')];_0x17eef3[_0x56f5('0x36')]=qs[_0x56f5('0x37')](_0x23a6cb['query'][_0x56f5('0x37')]);_0x17eef3[_0x56f5('0x38')]=qs['filters'](_[_0x56f5('0x4a')](_0x23a6cb['query'],_0x371dd2['filters']));if(_0x23a6cb[_0x56f5('0x2f')][_0x56f5('0x39')]){_0x17eef3['where']=_[_0x56f5('0x3a')](_0x17eef3[_0x56f5('0x38')],{'$or':_['map'](_0x17eef3[_0x56f5('0x34')],function(_0x58913a){var _0xbb9d29={};_0xbb9d29[_0x58913a]={'$like':'%'+_0x23a6cb[_0x56f5('0x2f')][_0x56f5('0x39')]+'%'};return _0xbb9d29;})});}_0x17eef3=_['merge']({},_0x17eef3,_0x23a6cb[_0x56f5('0x3c')]);return _0x6ed033[_0x56f5('0x4b')](_0x17eef3);}})[_0x56f5('0x23')](function(_0x53acff){if(_0x53acff){_0x2e5b2b=_0x53acff['length'];if(!_0x23a6cb['query'][_0x56f5('0x4c')]('nolimit')){_0x17eef3[_0x56f5('0x1e')]=qs['limit'](_0x23a6cb['query'][_0x56f5('0x1e')]);_0x17eef3[_0x56f5('0x1d')]=qs[_0x56f5('0x1d')](_0x23a6cb[_0x56f5('0x2f')][_0x56f5('0x1d')]);}return _0x6ed033[_0x56f5('0x4b')](_0x17eef3);}})[_0x56f5('0x23')](function(_0x2b14ce){if(_0x2b14ce){return _0x2b14ce?{'count':_0x2e5b2b,'rows':_0x2b14ce}:null;}})[_0x56f5('0x23')](respondWithResult(_0x58d58c,null))[_0x56f5('0x40')](handleError(_0x58d58c,null));};exports[_0x56f5('0x4d')]=function(_0x1a7f10,_0x364783,_0x17a382){var _0x290c8d={};var _0xeaeba6={};var _0x7fbb92;var _0x13cd08;return db['ZendeskConfiguration'][_0x56f5('0x47')]({'where':{'id':_0x1a7f10[_0x56f5('0x42')]['id']}})['then'](handleEntityNotFound(_0x364783,null))[_0x56f5('0x23')](function(_0x28042f){if(_0x28042f){_0x7fbb92=_0x28042f;_0xeaeba6[_0x56f5('0x2e')]=_[_0x56f5('0x30')](db[_0x56f5('0x48')][_0x56f5('0x2c')]);_0xeaeba6['query']=_[_0x56f5('0x30')](_0x1a7f10[_0x56f5('0x2f')]);_0xeaeba6[_0x56f5('0x31')]=_[_0x56f5('0x32')](_0xeaeba6['model'],_0xeaeba6[_0x56f5('0x2f')]);_0x290c8d[_0x56f5('0x34')]=_['intersection'](_0xeaeba6[_0x56f5('0x2e')],qs['fields'](_0x1a7f10[_0x56f5('0x2f')][_0x56f5('0x33')]));_0x290c8d[_0x56f5('0x34')]=_0x290c8d['attributes'][_0x56f5('0x49')]?_0x290c8d[_0x56f5('0x34')]:_0xeaeba6[_0x56f5('0x2e')];_0x290c8d[_0x56f5('0x36')]=qs[_0x56f5('0x37')](_0x1a7f10[_0x56f5('0x2f')][_0x56f5('0x37')]);_0x290c8d[_0x56f5('0x38')]=qs[_0x56f5('0x31')](_[_0x56f5('0x4a')](_0x1a7f10[_0x56f5('0x2f')],_0xeaeba6['filters']));if(_0x1a7f10[_0x56f5('0x2f')][_0x56f5('0x39')]){_0x290c8d['where']=_[_0x56f5('0x3a')](_0x290c8d['where'],{'$or':_[_0x56f5('0x2a')](_0x290c8d[_0x56f5('0x34')],function(_0x5dda6d){var _0x18cf52={};_0x18cf52[_0x5dda6d]={'$like':'%'+_0x1a7f10[_0x56f5('0x2f')][_0x56f5('0x39')]+'%'};return _0x18cf52;})});}_0x290c8d=_[_0x56f5('0x3a')]({},_0x290c8d,_0x1a7f10[_0x56f5('0x3c')]);return _0x7fbb92[_0x56f5('0x4d')](_0x290c8d);}})['then'](function(_0x2a3431){if(_0x2a3431){_0x13cd08=_0x2a3431[_0x56f5('0x49')];if(!_0x1a7f10[_0x56f5('0x2f')][_0x56f5('0x4c')](_0x56f5('0x35'))){_0x290c8d[_0x56f5('0x1e')]=qs[_0x56f5('0x1e')](_0x1a7f10['query'][_0x56f5('0x1e')]);_0x290c8d[_0x56f5('0x1d')]=qs[_0x56f5('0x1d')](_0x1a7f10['query'][_0x56f5('0x1d')]);}return _0x7fbb92[_0x56f5('0x4d')](_0x290c8d);}})[_0x56f5('0x23')](function(_0x2848e9){if(_0x2848e9){return _0x2848e9?{'count':_0x13cd08,'rows':_0x2848e9}:null;}})[_0x56f5('0x23')](respondWithResult(_0x364783,null))[_0x56f5('0x40')](handleError(_0x364783,null));};exports[_0x56f5('0x4e')]=function(_0x3b1bd3,_0x416f40,_0xcd622e){var _0x52e3f4={};var _0x418ae0={};var _0x1766a1;var _0xe06d26;return db[_0x56f5('0x2b')][_0x56f5('0x47')]({'where':{'id':_0x3b1bd3[_0x56f5('0x42')]['id']}})[_0x56f5('0x23')](handleEntityNotFound(_0x416f40,null))[_0x56f5('0x23')](function(_0x5abc1c){if(_0x5abc1c){_0x1766a1=_0x5abc1c;_0x418ae0[_0x56f5('0x2e')]=_[_0x56f5('0x30')](db[_0x56f5('0x4f')][_0x56f5('0x2c')]);_0x418ae0[_0x56f5('0x2f')]=_[_0x56f5('0x30')](_0x3b1bd3[_0x56f5('0x2f')]);_0x418ae0[_0x56f5('0x31')]=_[_0x56f5('0x32')](_0x418ae0[_0x56f5('0x2e')],_0x418ae0['query']);_0x52e3f4['attributes']=_['intersection'](_0x418ae0['model'],qs[_0x56f5('0x33')](_0x3b1bd3[_0x56f5('0x2f')][_0x56f5('0x33')]));_0x52e3f4[_0x56f5('0x34')]=_0x52e3f4[_0x56f5('0x34')][_0x56f5('0x49')]?_0x52e3f4[_0x56f5('0x34')]:_0x418ae0['model'];_0x52e3f4['order']=qs[_0x56f5('0x37')](_0x3b1bd3[_0x56f5('0x2f')][_0x56f5('0x37')]);_0x52e3f4['where']=qs[_0x56f5('0x31')](_['pick'](_0x3b1bd3[_0x56f5('0x2f')],_0x418ae0[_0x56f5('0x31')]));if(_0x3b1bd3[_0x56f5('0x2f')][_0x56f5('0x39')]){_0x52e3f4[_0x56f5('0x38')]=_['merge'](_0x52e3f4[_0x56f5('0x38')],{'$or':_[_0x56f5('0x2a')](_0x52e3f4[_0x56f5('0x34')],function(_0x4cf689){var _0x570588={};_0x570588[_0x4cf689]={'$like':'%'+_0x3b1bd3[_0x56f5('0x2f')][_0x56f5('0x39')]+'%'};return _0x570588;})});}_0x52e3f4=_[_0x56f5('0x3a')]({},_0x52e3f4,_0x3b1bd3[_0x56f5('0x3c')]);return _0x1766a1[_0x56f5('0x4e')](_0x52e3f4);}})[_0x56f5('0x23')](function(_0x33c08a){if(_0x33c08a){_0xe06d26=_0x33c08a[_0x56f5('0x49')];if(!_0x3b1bd3[_0x56f5('0x2f')][_0x56f5('0x4c')](_0x56f5('0x35'))){_0x52e3f4['limit']=qs[_0x56f5('0x1e')](_0x3b1bd3[_0x56f5('0x2f')][_0x56f5('0x1e')]);_0x52e3f4[_0x56f5('0x1d')]=qs['offset'](_0x3b1bd3[_0x56f5('0x2f')][_0x56f5('0x1d')]);}return _0x1766a1[_0x56f5('0x4e')](_0x52e3f4);}})['then'](function(_0x465463){if(_0x465463){return _0x465463?{'count':_0xe06d26,'rows':_0x465463}:null;}})[_0x56f5('0x23')](respondWithResult(_0x416f40,null))['catch'](handleError(_0x416f40,null));};exports[_0x56f5('0x50')]=function(_0x16772c,_0x4c45a6,_0x4b3e84){if(_0x16772c['body']['id']){delete _0x16772c[_0x56f5('0x45')]['id'];}return db[_0x56f5('0x2b')]['findOne']({'where':{'id':_0x16772c[_0x56f5('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c45a6,null))[_0x56f5('0x23')](function(_0x44d90f){if(_0x44d90f){return _0x44d90f[_0x56f5('0x50')](_0x16772c[_0x56f5('0x45')]['ids']||[]);}return null;})[_0x56f5('0x23')](respondWithResult(_0x4c45a6,null))[_0x56f5('0x40')](handleError(_0x4c45a6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 006c217..8e69ccf 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 _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util'];(function(_0x5a45b4,_0x220d69){var _0x58e14f=function(_0x4f80f4){while(--_0x4f80f4){_0x5a45b4['push'](_0x5a45b4['shift']());}};_0x58e14f(++_0x220d69);}(_0x3266,0x6a));var _0x6326=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x3266[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x404303,_0xcf6dee){var _0x2bb9e5=function(_0x3a2e12){while(--_0x3a2e12){_0x404303['push'](_0x404303['shift']());}};_0x2bb9e5(++_0xcf6dee);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x2ddedd,_0x1148af){_0x2ddedd=_0x2ddedd-0x0;var _0x5055ea=_0xe1e3[_0x2ddedd];return _0x5055ea;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 545b89b..caa3ef8 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 _0x4d9f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x4d9f,0x1bb));var _0xf4d9=function(_0x2d71fb,_0x2299bf){_0x2d71fb=_0x2d71fb-0x0;var _0x43aa4f=_0x4d9f[_0x2d71fb];return _0x43aa4f;};'use strict';var _=require(_0xf4d9('0x0'));var util=require(_0xf4d9('0x1'));var moment=require(_0xf4d9('0x2'));var BPromise=require(_0xf4d9('0x3'));var rs=require(_0xf4d9('0x4'));var fs=require('fs');var Redis=require(_0xf4d9('0x5'));var db=require(_0xf4d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf4d9('0x7'));var config=require(_0xf4d9('0x8'));var jayson=require(_0xf4d9('0x9'));var client=jayson[_0xf4d9('0xa')][_0xf4d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5155f4,_0x22441e,_0x45be9b){return new BPromise(function(_0x3dacec,_0x4ac939){return client[_0xf4d9('0xc')](_0x5155f4,_0x45be9b)[_0xf4d9('0xd')](function(_0xd4d4a7){logger[_0xf4d9('0xe')](_0xf4d9('0xf'),_0x22441e,_0xf4d9('0x10'));logger[_0xf4d9('0x11')](_0xf4d9('0x12'),_0x22441e,_0xf4d9('0x10'),JSON[_0xf4d9('0x13')](_0xd4d4a7));if(_0xd4d4a7[_0xf4d9('0x14')]){if(_0xd4d4a7['error'][_0xf4d9('0x15')]===0x1f4){logger[_0xf4d9('0x14')](_0xf4d9('0xf'),_0x22441e,_0xd4d4a7[_0xf4d9('0x14')][_0xf4d9('0x16')]);return _0x4ac939(_0xd4d4a7['error']['message']);}logger['error'](_0xf4d9('0xf'),_0x22441e,_0xd4d4a7['error'][_0xf4d9('0x16')]);return _0x3dacec(_0xd4d4a7[_0xf4d9('0x14')][_0xf4d9('0x16')]);}else{logger[_0xf4d9('0xe')](_0xf4d9('0xf'),_0x22441e,_0xf4d9('0x10'));_0x3dacec(_0xd4d4a7[_0xf4d9('0x17')][_0xf4d9('0x16')]);}})[_0xf4d9('0x18')](function(_0xbb0231){logger['error'](_0xf4d9('0xf'),_0x22441e,_0xbb0231);_0x4ac939(_0xbb0231);});});} \ No newline at end of file +var _0x0957=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2515db,_0x3dc4b4){var _0x277268=function(_0x58dbea){while(--_0x58dbea){_0x2515db['push'](_0x2515db['shift']());}};_0x277268(++_0x3dc4b4);}(_0x0957,0x102));var _0x7095=function(_0x5de283,_0x2072cf){_0x5de283=_0x5de283-0x0;var _0x4437dd=_0x0957[_0x5de283];return _0x4437dd;};'use strict';var _=require(_0x7095('0x0'));var util=require(_0x7095('0x1'));var moment=require(_0x7095('0x2'));var BPromise=require(_0x7095('0x3'));var rs=require(_0x7095('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7095('0x5'))['db'];var utils=require(_0x7095('0x6'));var logger=require(_0x7095('0x7'))(_0x7095('0x8'));var config=require('../../config/environment');var jayson=require(_0x7095('0x9'));var client=jayson[_0x7095('0xa')][_0x7095('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x266677,_0x124008,_0x327477){return new BPromise(function(_0x52d034,_0x5148dd){return client[_0x7095('0xc')](_0x266677,_0x327477)[_0x7095('0xd')](function(_0x528447){logger['info'](_0x7095('0xe'),_0x124008,_0x7095('0xf'));logger['debug'](_0x7095('0x10'),_0x124008,_0x7095('0xf'),JSON[_0x7095('0x11')](_0x528447));if(_0x528447[_0x7095('0x12')]){if(_0x528447[_0x7095('0x12')][_0x7095('0x13')]===0x1f4){logger[_0x7095('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x124008,_0x528447[_0x7095('0x12')]['message']);return _0x5148dd(_0x528447[_0x7095('0x12')][_0x7095('0x14')]);}logger[_0x7095('0x12')](_0x7095('0xe'),_0x124008,_0x528447['error'][_0x7095('0x14')]);return _0x52d034(_0x528447['error'][_0x7095('0x14')]);}else{logger[_0x7095('0x15')](_0x7095('0xe'),_0x124008,_0x7095('0xf'));_0x52d034(_0x528447[_0x7095('0x16')]['message']);}})['catch'](function(_0x54fa0b){logger['error'](_0x7095('0xe'),_0x124008,_0x54fa0b);_0x5148dd(_0x54fa0b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 6c8b817..adb41f2 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 _0xbdeb=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','exports'];(function(_0x302ef1,_0x15f0fb){var _0x339229=function(_0x5f5917){while(--_0x5f5917){_0x302ef1['push'](_0x302ef1['shift']());}};_0x339229(++_0x15f0fb);}(_0xbdeb,0xcc));var _0xbbde=function(_0x4c79f4,_0x1a9829){_0x4c79f4=_0x4c79f4-0x0;var _0x1a705b=_0xbdeb[_0x4c79f4];return _0x1a705b;};'use strict';var multer=require('multer');var util=require(_0xbbde('0x0'));var path=require(_0xbbde('0x1'));var timeout=require(_0xbbde('0x2'));var express=require('express');var router=express[_0xbbde('0x3')]();var fs_extra=require(_0xbbde('0x4'));var auth=require(_0xbbde('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbbde('0x6'));var controller=require('./intZendeskField.controller');router[_0xbbde('0x7')]('/',auth['isAuthenticated'](),controller[_0xbbde('0x8')]);router[_0xbbde('0x7')](_0xbbde('0x9'),auth[_0xbbde('0xa')](),controller['show']);router[_0xbbde('0xb')]('/',auth[_0xbbde('0xa')](),controller[_0xbbde('0xc')]);router[_0xbbde('0xd')](_0xbbde('0x9'),auth[_0xbbde('0xa')](),controller['update']);router[_0xbbde('0xe')](_0xbbde('0x9'),auth['isAuthenticated'](),controller[_0xbbde('0xf')]);module[_0xbbde('0x10')]=router; \ No newline at end of file +var _0xafa0=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x2b59e5,_0x104bf9){var _0x41aab2=function(_0x4da655){while(--_0x4da655){_0x2b59e5['push'](_0x2b59e5['shift']());}};_0x41aab2(++_0x104bf9);}(_0xafa0,0x186));var _0x0afa=function(_0x31fe4d,_0x17cea7){_0x31fe4d=_0x31fe4d-0x0;var _0x312f1b=_0xafa0[_0x31fe4d];return _0x312f1b;};'use strict';var multer=require(_0x0afa('0x0'));var util=require(_0x0afa('0x1'));var path=require(_0x0afa('0x2'));var timeout=require(_0x0afa('0x3'));var express=require(_0x0afa('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0afa('0x5'));var interaction=require(_0x0afa('0x6'));var config=require(_0x0afa('0x7'));var controller=require(_0x0afa('0x8'));router[_0x0afa('0x9')]('/',auth[_0x0afa('0xa')](),controller[_0x0afa('0xb')]);router['get'](_0x0afa('0xc'),auth['isAuthenticated'](),controller[_0x0afa('0xd')]);router[_0x0afa('0xe')]('/',auth[_0x0afa('0xa')](),controller[_0x0afa('0xf')]);router[_0x0afa('0x10')](_0x0afa('0xc'),auth[_0x0afa('0xa')](),controller[_0x0afa('0x11')]);router[_0x0afa('0x12')](_0x0afa('0xc'),auth[_0x0afa('0xa')](),controller[_0x0afa('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 3ee9217..27a15c4 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 _0x183a=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','variable'];(function(_0x38f76e,_0x3fab3b){var _0xe46e7d=function(_0x5ad872){while(--_0x5ad872){_0x38f76e['push'](_0x38f76e['shift']());}};_0xe46e7d(++_0x3fab3b);}(_0x183a,0xe6));var _0xa183=function(_0x15c58b,_0x467359){_0x15c58b=_0x15c58b-0x0;var _0x24abc6=_0x183a[_0x15c58b];return _0x24abc6;};'use strict';var Sequelize=require(_0xa183('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xa183('0x1'),_0xa183('0x2'),_0xa183('0x3'),_0xa183('0x4')),'defaultValue':_0xa183('0x5')},'content':{'type':Sequelize[_0xa183('0x6')]},'key':{'type':Sequelize[_0xa183('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xa183('0x1'),_0xa183('0x2'))},'keyContent':{'type':Sequelize[_0xa183('0x6')]},'idField':{'type':Sequelize[_0xa183('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa183('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa183('0x6')]}}; \ No newline at end of file +var _0x1aa2=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4453bf,_0x103276){var _0xfdf8f9=function(_0x5074d3){while(--_0x5074d3){_0x4453bf['push'](_0x4453bf['shift']());}};_0xfdf8f9(++_0x103276);}(_0x1aa2,0x1db));var _0x21aa=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x1aa2[_0x2c0be1];return _0x3d4bd2;};'use strict';var Sequelize=require(_0x21aa('0x0'));module[_0x21aa('0x1')]={'type':{'type':Sequelize[_0x21aa('0x2')](_0x21aa('0x3'),_0x21aa('0x4'),_0x21aa('0x5'),_0x21aa('0x6'),_0x21aa('0x7')),'defaultValue':_0x21aa('0x3')},'content':{'type':Sequelize[_0x21aa('0x8')]},'key':{'type':Sequelize[_0x21aa('0x8')]},'keyType':{'type':Sequelize[_0x21aa('0x2')](_0x21aa('0x3'),_0x21aa('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x21aa('0x8')]},'idField':{'type':Sequelize[_0x21aa('0x8')]},'nameField':{'type':Sequelize[_0x21aa('0x8')]},'customField':{'type':Sequelize[_0x21aa('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x21aa('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d960931..eedbf0b 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 _0xd807=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','apply','reject','update','then','end','sendStatus','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x598a3b,_0x1b69de){var _0x3e41ad=function(_0x54882d){while(--_0x54882d){_0x598a3b['push'](_0x598a3b['shift']());}};_0x3e41ad(++_0x1b69de);}(_0xd807,0x90));var _0x7d80=function(_0x106071,_0x579c7f){_0x106071=_0x106071-0x0;var _0x119527=_0xd807[_0x106071];return _0x119527;};'use strict';var emlformat=require(_0x7d80('0x0'));var rimraf=require(_0x7d80('0x1'));var zipdir=require(_0x7d80('0x2'));var jsonpatch=require(_0x7d80('0x3'));var rp=require(_0x7d80('0x4'));var moment=require(_0x7d80('0x5'));var BPromise=require(_0x7d80('0x6'));var Mustache=require(_0x7d80('0x7'));var util=require(_0x7d80('0x8'));var path=require(_0x7d80('0x9'));var sox=require(_0x7d80('0xa'));var csv=require(_0x7d80('0xb'));var ejs=require(_0x7d80('0xc'));var fs=require('fs');var fs_extra=require(_0x7d80('0xd'));var _=require(_0x7d80('0xe'));var squel=require(_0x7d80('0xf'));var crypto=require(_0x7d80('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7d80('0xb'));var querystring=require(_0x7d80('0x11'));var Papa=require(_0x7d80('0x12'));var Redis=require('ioredis');var authService=require(_0x7d80('0x13'));var qs=require(_0x7d80('0x14'));var as=require(_0x7d80('0x15'));var hardwareService=require(_0x7d80('0x16'));var logger=require(_0x7d80('0x17'))(_0x7d80('0x18'));var utils=require('../../config/utils');var config=require(_0x7d80('0x19'));var licenseUtil=require(_0x7d80('0x1a'));var db=require(_0x7d80('0x1b'))['db'];function respondWithStatusCode(_0x3accb9,_0x23bbeb){_0x23bbeb=_0x23bbeb||0xcc;return function(_0x23b1e6){if(_0x23b1e6){return _0x3accb9['sendStatus'](_0x23bbeb);}return _0x3accb9[_0x7d80('0x1c')](_0x23bbeb)['end']();};}function respondWithResult(_0x4bfb5c,_0x355355){_0x355355=_0x355355||0xc8;return function(_0x4968f5){if(_0x4968f5){return _0x4bfb5c[_0x7d80('0x1c')](_0x355355)[_0x7d80('0x1d')](_0x4968f5);}};}function respondWithFilteredResult(_0x1ecf34,_0x35950d){return function(_0x12b9f7){if(_0x12b9f7){var _0x54f395=typeof _0x35950d['offset']===_0x7d80('0x1e')&&typeof _0x35950d[_0x7d80('0x1f')]===_0x7d80('0x1e');var _0xcb0da6=_0x12b9f7['count'];var _0x1b426e=_0x54f395?0x0:_0x35950d[_0x7d80('0x20')];var _0x5357c0=_0x54f395?_0x12b9f7[_0x7d80('0x21')]:_0x35950d[_0x7d80('0x20')]+_0x35950d[_0x7d80('0x1f')];var _0x76c53d;if(_0x5357c0>=_0xcb0da6){_0x5357c0=_0xcb0da6;_0x76c53d=0xc8;}else{_0x76c53d=0xce;}_0x1ecf34[_0x7d80('0x1c')](_0x76c53d);return _0x1ecf34['set']('Content-Range',_0x1b426e+'-'+_0x5357c0+'/'+_0xcb0da6)[_0x7d80('0x1d')](_0x12b9f7);}return null;};}function patchUpdates(_0x239400){return function(_0x20f235){try{jsonpatch[_0x7d80('0x22')](_0x20f235,_0x239400,!![]);}catch(_0x4b0c6e){return BPromise[_0x7d80('0x23')](_0x4b0c6e);}return _0x20f235['save']();};}function saveUpdates(_0x13ae1e,_0x11fb81){return function(_0x3c9ed6){if(_0x3c9ed6){return _0x3c9ed6[_0x7d80('0x24')](_0x13ae1e)[_0x7d80('0x25')](function(_0x4477a2){return _0x4477a2;});}return null;};}function removeEntity(_0x4d499b,_0x2495e8){return function(_0x17bc06){if(_0x17bc06){return _0x17bc06['destroy']()[_0x7d80('0x25')](function(){_0x4d499b[_0x7d80('0x1c')](0xcc)[_0x7d80('0x26')]();});}};}function handleEntityNotFound(_0x276da1,_0x4b2e1){return function(_0x14f6d4){if(!_0x14f6d4){_0x276da1[_0x7d80('0x27')](0x194);}return _0x14f6d4;};}function handleError(_0x3785eb,_0x1c5a3f){_0x1c5a3f=_0x1c5a3f||0x1f4;return function(_0x1095d6){logger[_0x7d80('0x28')](_0x1095d6[_0x7d80('0x29')]);if(_0x1095d6[_0x7d80('0x2a')]){delete _0x1095d6[_0x7d80('0x2a')];}_0x3785eb['status'](_0x1c5a3f)['send'](_0x1095d6);};}exports[_0x7d80('0x2b')]=function(_0x52dec0,_0x233359){var _0x2455e9={},_0x47d564={},_0x44bc99={'count':0x0,'rows':[]};var _0x200281=_[_0x7d80('0x2c')](db[_0x7d80('0x2d')][_0x7d80('0x2e')],function(_0x4db185){return{'name':_0x4db185[_0x7d80('0x2f')],'type':_0x4db185[_0x7d80('0x30')][_0x7d80('0x31')]};});_0x47d564[_0x7d80('0x32')]=_[_0x7d80('0x2c')](_0x200281,_0x7d80('0x2a'));_0x47d564[_0x7d80('0x33')]=_['keys'](_0x52dec0['query']);_0x47d564[_0x7d80('0x34')]=_[_0x7d80('0x35')](_0x47d564[_0x7d80('0x32')],_0x47d564[_0x7d80('0x33')]);_0x2455e9[_0x7d80('0x36')]=_['intersection'](_0x47d564[_0x7d80('0x32')],qs[_0x7d80('0x37')](_0x52dec0['query'][_0x7d80('0x37')]));_0x2455e9[_0x7d80('0x36')]=_0x2455e9[_0x7d80('0x36')][_0x7d80('0x38')]?_0x2455e9[_0x7d80('0x36')]:_0x47d564['model'];if(!_0x52dec0['query'][_0x7d80('0x39')](_0x7d80('0x3a'))){_0x2455e9[_0x7d80('0x1f')]=qs['limit'](_0x52dec0[_0x7d80('0x33')][_0x7d80('0x1f')]);_0x2455e9[_0x7d80('0x20')]=qs[_0x7d80('0x20')](_0x52dec0[_0x7d80('0x33')][_0x7d80('0x20')]);}_0x2455e9[_0x7d80('0x3b')]=qs[_0x7d80('0x3c')](_0x52dec0[_0x7d80('0x33')]['sort']);_0x2455e9[_0x7d80('0x3d')]=qs[_0x7d80('0x34')](_[_0x7d80('0x3e')](_0x52dec0[_0x7d80('0x33')],_0x47d564[_0x7d80('0x34')]),_0x200281);if(_0x52dec0[_0x7d80('0x33')][_0x7d80('0x3f')]){_0x2455e9[_0x7d80('0x3d')]=_[_0x7d80('0x40')](_0x2455e9[_0x7d80('0x3d')],{'$or':_[_0x7d80('0x2c')](_0x200281,function(_0x316c91){if(_0x316c91[_0x7d80('0x30')]!=='VIRTUAL'){var _0x42564a={};_0x42564a[_0x316c91[_0x7d80('0x2a')]]={'$like':'%'+_0x52dec0[_0x7d80('0x33')][_0x7d80('0x3f')]+'%'};return _0x42564a;}})});}_0x2455e9=_[_0x7d80('0x40')]({},_0x2455e9,_0x52dec0[_0x7d80('0x41')]);var _0xf343d6={'where':_0x2455e9[_0x7d80('0x3d')]};return db['ZendeskField'][_0x7d80('0x21')](_0xf343d6)[_0x7d80('0x25')](function(_0x24c14b){_0x44bc99[_0x7d80('0x21')]=_0x24c14b;if(_0x52dec0[_0x7d80('0x33')][_0x7d80('0x42')]){_0x2455e9[_0x7d80('0x43')]=[{'all':!![]}];}return db[_0x7d80('0x2d')][_0x7d80('0x44')](_0x2455e9);})[_0x7d80('0x25')](function(_0xba910a){_0x44bc99['rows']=_0xba910a;return _0x44bc99;})['then'](respondWithFilteredResult(_0x233359,_0x2455e9))[_0x7d80('0x45')](handleError(_0x233359,null));};exports[_0x7d80('0x46')]=function(_0x493f49,_0xe93a8e){var _0x1701d1={'raw':!![],'where':{'id':_0x493f49[_0x7d80('0x47')]['id']}},_0x2dd6c0={};_0x2dd6c0['model']=_['keys'](db[_0x7d80('0x2d')][_0x7d80('0x2e')]);_0x2dd6c0['query']=_[_0x7d80('0x48')](_0x493f49[_0x7d80('0x33')]);_0x2dd6c0[_0x7d80('0x34')]=_['intersection'](_0x2dd6c0[_0x7d80('0x32')],_0x2dd6c0[_0x7d80('0x33')]);_0x1701d1[_0x7d80('0x36')]=_[_0x7d80('0x35')](_0x2dd6c0[_0x7d80('0x32')],qs[_0x7d80('0x37')](_0x493f49[_0x7d80('0x33')][_0x7d80('0x37')]));_0x1701d1[_0x7d80('0x36')]=_0x1701d1['attributes'][_0x7d80('0x38')]?_0x1701d1[_0x7d80('0x36')]:_0x2dd6c0[_0x7d80('0x32')];if(_0x493f49['query'][_0x7d80('0x42')]){_0x1701d1[_0x7d80('0x43')]=[{'all':!![]}];}_0x1701d1=_[_0x7d80('0x40')]({},_0x1701d1,_0x493f49[_0x7d80('0x41')]);return db[_0x7d80('0x2d')]['find'](_0x1701d1)['then'](handleEntityNotFound(_0xe93a8e,null))[_0x7d80('0x25')](respondWithResult(_0xe93a8e,null))['catch'](handleError(_0xe93a8e,null));};exports[_0x7d80('0x49')]=function(_0x5f140d,_0x54e1de){return db[_0x7d80('0x2d')][_0x7d80('0x49')](_0x5f140d[_0x7d80('0x4a')],{})[_0x7d80('0x25')](respondWithResult(_0x54e1de,0xc9))[_0x7d80('0x45')](handleError(_0x54e1de,null));};exports['update']=function(_0xfdaf13,_0x1bbb53){if(_0xfdaf13['body']['id']){delete _0xfdaf13[_0x7d80('0x4a')]['id'];}return db[_0x7d80('0x2d')]['find']({'where':{'id':_0xfdaf13[_0x7d80('0x47')]['id']}})[_0x7d80('0x25')](handleEntityNotFound(_0x1bbb53,null))['then'](saveUpdates(_0xfdaf13[_0x7d80('0x4a')],null))[_0x7d80('0x25')](respondWithResult(_0x1bbb53,null))[_0x7d80('0x45')](handleError(_0x1bbb53,null));};exports[_0x7d80('0x4b')]=function(_0x17f6b3,_0x2c1639){return db[_0x7d80('0x2d')][_0x7d80('0x4c')]({'where':{'id':_0x17f6b3[_0x7d80('0x47')]['id']}})[_0x7d80('0x25')](handleEntityNotFound(_0x2c1639,null))[_0x7d80('0x25')](removeEntity(_0x2c1639,null))[_0x7d80('0x45')](handleError(_0x2c1639,null));}; \ No newline at end of file +var _0xc5ab=['undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','length','find','create','body','catch','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc5ab,0x19b));var _0xbc5a=function(_0x37944d,_0x4ac112){_0x37944d=_0x37944d-0x0;var _0x5192d5=_0xc5ab[_0x37944d];return _0x5192d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc5a('0x0'));var zipdir=require(_0xbc5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc5a('0x2'));var moment=require(_0xbc5a('0x3'));var BPromise=require(_0xbc5a('0x4'));var Mustache=require('mustache');var util=require(_0xbc5a('0x5'));var path=require(_0xbc5a('0x6'));var sox=require(_0xbc5a('0x7'));var csv=require(_0xbc5a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc5a('0x9'));var _=require(_0xbc5a('0xa'));var squel=require(_0xbc5a('0xb'));var crypto=require('crypto');var jsforce=require(_0xbc5a('0xc'));var deskjs=require(_0xbc5a('0xd'));var toCsv=require(_0xbc5a('0x8'));var querystring=require(_0xbc5a('0xe'));var Papa=require(_0xbc5a('0xf'));var Redis=require(_0xbc5a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbc5a('0x11'));var hardwareService=require(_0xbc5a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbc5a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbc5a('0x14'));var db=require(_0xbc5a('0x15'))['db'];function respondWithStatusCode(_0x34194d,_0x2a2364){_0x2a2364=_0x2a2364||0xcc;return function(_0x4560ff){if(_0x4560ff){return _0x34194d[_0xbc5a('0x16')](_0x2a2364);}return _0x34194d[_0xbc5a('0x17')](_0x2a2364)[_0xbc5a('0x18')]();};}function respondWithResult(_0x45850d,_0x13ef0c){_0x13ef0c=_0x13ef0c||0xc8;return function(_0x5f3afe){if(_0x5f3afe){return _0x45850d[_0xbc5a('0x17')](_0x13ef0c)[_0xbc5a('0x19')](_0x5f3afe);}};}function respondWithFilteredResult(_0x58d65e,_0x4b62da){return function(_0x30efed){if(_0x30efed){var _0x331e8e=typeof _0x4b62da[_0xbc5a('0x1a')]===_0xbc5a('0x1b')&&typeof _0x4b62da[_0xbc5a('0x1c')]===_0xbc5a('0x1b');var _0x1d94bb=_0x30efed[_0xbc5a('0x1d')];var _0x38ace4=_0x331e8e?0x0:_0x4b62da['offset'];var _0x58c6b2=_0x331e8e?_0x30efed[_0xbc5a('0x1d')]:_0x4b62da[_0xbc5a('0x1a')]+_0x4b62da['limit'];var _0x2be95c;if(_0x58c6b2>=_0x1d94bb){_0x58c6b2=_0x1d94bb;_0x2be95c=0xc8;}else{_0x2be95c=0xce;}_0x58d65e[_0xbc5a('0x17')](_0x2be95c);return _0x58d65e['set'](_0xbc5a('0x1e'),_0x38ace4+'-'+_0x58c6b2+'/'+_0x1d94bb)[_0xbc5a('0x19')](_0x30efed);}return null;};}function patchUpdates(_0x5db1bd){return function(_0x5d51d8){try{jsonpatch[_0xbc5a('0x1f')](_0x5d51d8,_0x5db1bd,!![]);}catch(_0x4e2a25){return BPromise[_0xbc5a('0x20')](_0x4e2a25);}return _0x5d51d8[_0xbc5a('0x21')]();};}function saveUpdates(_0x2c5f73,_0x4a4632){return function(_0x250f9c){if(_0x250f9c){return _0x250f9c[_0xbc5a('0x22')](_0x2c5f73)['then'](function(_0x175841){return _0x175841;});}return null;};}function removeEntity(_0xc32733,_0xda4ae1){return function(_0x181547){if(_0x181547){return _0x181547[_0xbc5a('0x23')]()[_0xbc5a('0x24')](function(){_0xc32733[_0xbc5a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39201c,_0x1dde73){return function(_0x2a5672){if(!_0x2a5672){_0x39201c[_0xbc5a('0x16')](0x194);}return _0x2a5672;};}function handleError(_0x2ebcc8,_0x42e2e0){_0x42e2e0=_0x42e2e0||0x1f4;return function(_0x512c4a){logger['error'](_0x512c4a[_0xbc5a('0x25')]);if(_0x512c4a[_0xbc5a('0x26')]){delete _0x512c4a[_0xbc5a('0x26')];}_0x2ebcc8[_0xbc5a('0x17')](_0x42e2e0)[_0xbc5a('0x27')](_0x512c4a);};}exports[_0xbc5a('0x28')]=function(_0x5467fa,_0xb2a53a){var _0xe8f451={},_0x2ebf9c={},_0x47347d={'count':0x0,'rows':[]};var _0x4f98ae=_[_0xbc5a('0x29')](db[_0xbc5a('0x2a')][_0xbc5a('0x2b')],function(_0x42e203){return{'name':_0x42e203[_0xbc5a('0x2c')],'type':_0x42e203[_0xbc5a('0x2d')][_0xbc5a('0x2e')]};});_0x2ebf9c[_0xbc5a('0x2f')]=_[_0xbc5a('0x29')](_0x4f98ae,_0xbc5a('0x26'));_0x2ebf9c[_0xbc5a('0x30')]=_['keys'](_0x5467fa[_0xbc5a('0x30')]);_0x2ebf9c[_0xbc5a('0x31')]=_[_0xbc5a('0x32')](_0x2ebf9c[_0xbc5a('0x2f')],_0x2ebf9c[_0xbc5a('0x30')]);_0xe8f451['attributes']=_['intersection'](_0x2ebf9c['model'],qs[_0xbc5a('0x33')](_0x5467fa[_0xbc5a('0x30')][_0xbc5a('0x33')]));_0xe8f451['attributes']=_0xe8f451[_0xbc5a('0x34')]['length']?_0xe8f451[_0xbc5a('0x34')]:_0x2ebf9c[_0xbc5a('0x2f')];if(!_0x5467fa[_0xbc5a('0x30')][_0xbc5a('0x35')](_0xbc5a('0x36'))){_0xe8f451['limit']=qs[_0xbc5a('0x1c')](_0x5467fa[_0xbc5a('0x30')][_0xbc5a('0x1c')]);_0xe8f451['offset']=qs[_0xbc5a('0x1a')](_0x5467fa[_0xbc5a('0x30')]['offset']);}_0xe8f451[_0xbc5a('0x37')]=qs['sort'](_0x5467fa['query'][_0xbc5a('0x38')]);_0xe8f451[_0xbc5a('0x39')]=qs[_0xbc5a('0x31')](_[_0xbc5a('0x3a')](_0x5467fa[_0xbc5a('0x30')],_0x2ebf9c['filters']),_0x4f98ae);if(_0x5467fa['query'][_0xbc5a('0x3b')]){_0xe8f451[_0xbc5a('0x39')]=_[_0xbc5a('0x3c')](_0xe8f451[_0xbc5a('0x39')],{'$or':_[_0xbc5a('0x29')](_0x4f98ae,function(_0x2cbcba){if(_0x2cbcba['type']!==_0xbc5a('0x3d')){var _0x2e3c49={};_0x2e3c49[_0x2cbcba['name']]={'$like':'%'+_0x5467fa[_0xbc5a('0x30')][_0xbc5a('0x3b')]+'%'};return _0x2e3c49;}})});}_0xe8f451=_[_0xbc5a('0x3c')]({},_0xe8f451,_0x5467fa[_0xbc5a('0x3e')]);var _0x35f91a={'where':_0xe8f451[_0xbc5a('0x39')]};return db[_0xbc5a('0x2a')]['count'](_0x35f91a)['then'](function(_0x28d131){_0x47347d[_0xbc5a('0x1d')]=_0x28d131;if(_0x5467fa['query'][_0xbc5a('0x3f')]){_0xe8f451[_0xbc5a('0x40')]=[{'all':!![]}];}return db[_0xbc5a('0x2a')][_0xbc5a('0x41')](_0xe8f451);})['then'](function(_0x1b48e7){_0x47347d['rows']=_0x1b48e7;return _0x47347d;})[_0xbc5a('0x24')](respondWithFilteredResult(_0xb2a53a,_0xe8f451))['catch'](handleError(_0xb2a53a,null));};exports['show']=function(_0x548a32,_0x2ba5b0){var _0x4533e5={'raw':!![],'where':{'id':_0x548a32[_0xbc5a('0x42')]['id']}},_0x3b9723={};_0x3b9723[_0xbc5a('0x2f')]=_[_0xbc5a('0x43')](db[_0xbc5a('0x2a')][_0xbc5a('0x2b')]);_0x3b9723[_0xbc5a('0x30')]=_['keys'](_0x548a32['query']);_0x3b9723['filters']=_[_0xbc5a('0x32')](_0x3b9723[_0xbc5a('0x2f')],_0x3b9723[_0xbc5a('0x30')]);_0x4533e5[_0xbc5a('0x34')]=_[_0xbc5a('0x32')](_0x3b9723[_0xbc5a('0x2f')],qs[_0xbc5a('0x33')](_0x548a32[_0xbc5a('0x30')][_0xbc5a('0x33')]));_0x4533e5[_0xbc5a('0x34')]=_0x4533e5[_0xbc5a('0x34')][_0xbc5a('0x44')]?_0x4533e5[_0xbc5a('0x34')]:_0x3b9723[_0xbc5a('0x2f')];if(_0x548a32['query'][_0xbc5a('0x3f')]){_0x4533e5[_0xbc5a('0x40')]=[{'all':!![]}];}_0x4533e5=_[_0xbc5a('0x3c')]({},_0x4533e5,_0x548a32[_0xbc5a('0x3e')]);return db['ZendeskField'][_0xbc5a('0x45')](_0x4533e5)[_0xbc5a('0x24')](handleEntityNotFound(_0x2ba5b0,null))[_0xbc5a('0x24')](respondWithResult(_0x2ba5b0,null))['catch'](handleError(_0x2ba5b0,null));};exports['create']=function(_0x4afb55,_0x417d76){return db[_0xbc5a('0x2a')][_0xbc5a('0x46')](_0x4afb55[_0xbc5a('0x47')],{})[_0xbc5a('0x24')](respondWithResult(_0x417d76,0xc9))[_0xbc5a('0x48')](handleError(_0x417d76,null));};exports[_0xbc5a('0x22')]=function(_0x1de3a2,_0x4fb045){if(_0x1de3a2[_0xbc5a('0x47')]['id']){delete _0x1de3a2[_0xbc5a('0x47')]['id'];}return db[_0xbc5a('0x2a')][_0xbc5a('0x45')]({'where':{'id':_0x1de3a2[_0xbc5a('0x42')]['id']}})['then'](handleEntityNotFound(_0x4fb045,null))['then'](saveUpdates(_0x1de3a2['body'],null))[_0xbc5a('0x24')](respondWithResult(_0x4fb045,null))[_0xbc5a('0x48')](handleError(_0x4fb045,null));};exports['destroy']=function(_0x1f6dfb,_0x4bbad5){return db[_0xbc5a('0x2a')][_0xbc5a('0x45')]({'where':{'id':_0x1f6dfb[_0xbc5a('0x42')]['id']}})['then'](handleEntityNotFound(_0x4bbad5,null))[_0xbc5a('0x24')](removeEntity(_0x4bbad5,null))[_0xbc5a('0x48')](handleError(_0x4bbad5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 203835f..cc9bcee 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 _0xf518=['request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa391b1,_0x20e74f){var _0x55d5ed=function(_0x3e447a){while(--_0x3e447a){_0xa391b1['push'](_0xa391b1['shift']());}};_0x55d5ed(++_0x20e74f);}(_0xf518,0x1ba));var _0x8f51=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xf518[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0x8f51('0x0'));var util=require(_0x8f51('0x1'));var logger=require(_0x8f51('0x2'))(_0x8f51('0x3'));var moment=require(_0x8f51('0x4'));var BPromise=require(_0x8f51('0x5'));var rp=require(_0x8f51('0x6'));var fs=require('fs');var path=require(_0x8f51('0x7'));var rimraf=require(_0x8f51('0x8'));var config=require(_0x8f51('0x9'));var attributes=require(_0x8f51('0xa'));module[_0x8f51('0xb')]=function(_0x37312c,_0x47ac77){return _0x37312c[_0x8f51('0xc')](_0x8f51('0xd'),attributes,{'tableName':_0x8f51('0xe'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x8f51('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21ec=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','../../config/logger','api'];(function(_0xdabb59,_0x551bf6){var _0x38bb96=function(_0xc3195d){while(--_0xc3195d){_0xdabb59['push'](_0xdabb59['shift']());}};_0x38bb96(++_0x551bf6);}(_0x21ec,0x1b0));var _0xc21e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x21ec[_0x1b7368];return _0x25d54c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc21e('0x0'))(_0xc21e('0x1'));var moment=require(_0xc21e('0x2'));var BPromise=require(_0xc21e('0x3'));var rp=require(_0xc21e('0x4'));var fs=require('fs');var path=require(_0xc21e('0x5'));var rimraf=require(_0xc21e('0x6'));var config=require(_0xc21e('0x7'));var attributes=require(_0xc21e('0x8'));module[_0xc21e('0x9')]=function(_0x516727,_0x1d93cf){return _0x516727[_0xc21e('0xa')](_0xc21e('0xb'),attributes,{'tableName':_0xc21e('0xc'),'paranoid':![],'indexes':[{'name':_0xc21e('0xd'),'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 c21ee64..3ff264e 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 _0x6ec2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6ec2,0x105));var _0x26ec=function(_0x2ccb81,_0x33260e){_0x2ccb81=_0x2ccb81-0x0;var _0x43d847=_0x6ec2[_0x2ccb81];return _0x43d847;};'use strict';var _=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var moment=require(_0x26ec('0x2'));var BPromise=require(_0x26ec('0x3'));var rs=require(_0x26ec('0x4'));var fs=require('fs');var Redis=require(_0x26ec('0x5'));var db=require(_0x26ec('0x6'))['db'];var utils=require(_0x26ec('0x7'));var logger=require(_0x26ec('0x8'))(_0x26ec('0x9'));var config=require('../../config/environment');var jayson=require(_0x26ec('0xa'));var client=jayson[_0x26ec('0xb')][_0x26ec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x275729,_0x19e163,_0x233ebc){return new BPromise(function(_0x192212,_0x3962bc){return client['request'](_0x275729,_0x233ebc)[_0x26ec('0xd')](function(_0x2b11b5){logger[_0x26ec('0xe')]('ZendeskField,\x20%s,\x20%s',_0x19e163,_0x26ec('0xf'));logger[_0x26ec('0x10')](_0x26ec('0x11'),_0x19e163,_0x26ec('0xf'),JSON[_0x26ec('0x12')](_0x2b11b5));if(_0x2b11b5[_0x26ec('0x13')]){if(_0x2b11b5[_0x26ec('0x13')][_0x26ec('0x14')]===0x1f4){logger[_0x26ec('0x13')](_0x26ec('0x15'),_0x19e163,_0x2b11b5['error'][_0x26ec('0x16')]);return _0x3962bc(_0x2b11b5[_0x26ec('0x13')][_0x26ec('0x16')]);}logger[_0x26ec('0x13')]('ZendeskField,\x20%s,\x20%s',_0x19e163,_0x2b11b5[_0x26ec('0x13')]['message']);return _0x192212(_0x2b11b5[_0x26ec('0x13')][_0x26ec('0x16')]);}else{logger[_0x26ec('0xe')]('ZendeskField,\x20%s,\x20%s',_0x19e163,_0x26ec('0xf'));_0x192212(_0x2b11b5[_0x26ec('0x17')][_0x26ec('0x16')]);}})['catch'](function(_0x1515e3){logger[_0x26ec('0x13')](_0x26ec('0x15'),_0x19e163,_0x1515e3);_0x3962bc(_0x1515e3);});});} \ No newline at end of file +var _0x9808=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment'];(function(_0x5e34c6,_0x431682){var _0x301b18=function(_0x8337b4){while(--_0x8337b4){_0x5e34c6['push'](_0x5e34c6['shift']());}};_0x301b18(++_0x431682);}(_0x9808,0x9e));var _0x8980=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x9808[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x8980('0x0'));var util=require(_0x8980('0x1'));var moment=require(_0x8980('0x2'));var BPromise=require(_0x8980('0x3'));var rs=require(_0x8980('0x4'));var fs=require('fs');var Redis=require(_0x8980('0x5'));var db=require(_0x8980('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8980('0x7'))(_0x8980('0x8'));var config=require(_0x8980('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8980('0xa')][_0x8980('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c0bd9,_0xbcda13,_0x20e573){return new BPromise(function(_0x389605,_0x14c456){return client[_0x8980('0xc')](_0x5c0bd9,_0x20e573)[_0x8980('0xd')](function(_0x56ae49){logger['info'](_0x8980('0xe'),_0xbcda13,_0x8980('0xf'));logger[_0x8980('0x10')](_0x8980('0x11'),_0xbcda13,'request\x20sent',JSON[_0x8980('0x12')](_0x56ae49));if(_0x56ae49[_0x8980('0x13')]){if(_0x56ae49[_0x8980('0x13')]['code']===0x1f4){logger[_0x8980('0x13')]('ZendeskField,\x20%s,\x20%s',_0xbcda13,_0x56ae49['error'][_0x8980('0x14')]);return _0x14c456(_0x56ae49['error'][_0x8980('0x14')]);}logger[_0x8980('0x13')](_0x8980('0xe'),_0xbcda13,_0x56ae49['error']['message']);return _0x389605(_0x56ae49['error'][_0x8980('0x14')]);}else{logger[_0x8980('0x15')]('ZendeskField,\x20%s,\x20%s',_0xbcda13,'request\x20sent');_0x389605(_0x56ae49['result']['message']);}})[_0x8980('0x16')](function(_0x82b38d){logger[_0x8980('0x13')](_0x8980('0xe'),_0xbcda13,_0x82b38d);_0x14c456(_0x82b38d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e6fc0fc..5693866 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 _0xdfbe=['create','/:id','update','destroy','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getFields','post'];(function(_0x46cb0c,_0x348623){var _0x799911=function(_0x9a7593){while(--_0x9a7593){_0x46cb0c['push'](_0x46cb0c['shift']());}};_0x799911(++_0x348623);}(_0xdfbe,0x9d));var _0xedfb=function(_0x3d4fa0,_0x2b44f2){_0x3d4fa0=_0x3d4fa0-0x0;var _0x5bcf05=_0xdfbe[_0x3d4fa0];return _0x5bcf05;};'use strict';var multer=require('multer');var util=require(_0xedfb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xedfb('0x1')]();var fs_extra=require(_0xedfb('0x2'));var auth=require(_0xedfb('0x3'));var interaction=require(_0xedfb('0x4'));var config=require('../../config/environment');var controller=require(_0xedfb('0x5'));router[_0xedfb('0x6')]('/',auth['isAuthenticated'](),controller[_0xedfb('0x7')]);router[_0xedfb('0x6')]('/:id',auth[_0xedfb('0x8')](),controller[_0xedfb('0x9')]);router[_0xedfb('0x6')](_0xedfb('0xa'),auth[_0xedfb('0x8')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xedfb('0xb')]);router[_0xedfb('0xc')]('/',auth[_0xedfb('0x8')](),controller[_0xedfb('0xd')]);router[_0xedfb('0xc')](_0xedfb('0xa'),auth[_0xedfb('0x8')](),controller['addConfiguration']);router['put'](_0xedfb('0xe'),auth[_0xedfb('0x8')](),controller[_0xedfb('0xf')]);router['delete']('/:id',auth[_0xedfb('0x8')](),controller[_0xedfb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x182a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','express'];(function(_0x1bbc0d,_0x318e30){var _0x5c9bc8=function(_0x3d9540){while(--_0x3d9540){_0x1bbc0d['push'](_0x1bbc0d['shift']());}};_0x5c9bc8(++_0x318e30);}(_0x182a,0x1e0));var _0xa182=function(_0x3aae2a,_0x2d7717){_0x3aae2a=_0x3aae2a-0x0;var _0x52045a=_0x182a[_0x3aae2a];return _0x52045a;};'use strict';var multer=require(_0xa182('0x0'));var util=require(_0xa182('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa182('0x2'));var router=express[_0xa182('0x3')]();var fs_extra=require(_0xa182('0x4'));var auth=require(_0xa182('0x5'));var interaction=require(_0xa182('0x6'));var config=require(_0xa182('0x7'));var controller=require(_0xa182('0x8'));router[_0xa182('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa182('0x9')](_0xa182('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa182('0x9')]('/:id/configurations',auth[_0xa182('0xb')](),controller[_0xa182('0xc')]);router[_0xa182('0x9')](_0xa182('0xd'),auth['isAuthenticated'](),controller[_0xa182('0xe')]);router[_0xa182('0xf')]('/',auth[_0xa182('0xb')](),controller[_0xa182('0x10')]);router[_0xa182('0xf')](_0xa182('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xa182('0x12')]('/:id',auth[_0xa182('0xb')](),controller[_0xa182('0x13')]);router[_0xa182('0x14')](_0xa182('0xa'),auth['isAuthenticated'](),controller[_0xa182('0x15')]);module[_0xa182('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1018e9d..00353bd 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 _0x4522=['STRING'];(function(_0x5ee3e1,_0x3ab732){var _0x57d201=function(_0xe2fa3d){while(--_0xe2fa3d){_0x5ee3e1['push'](_0x5ee3e1['shift']());}};_0x57d201(++_0x3ab732);}(_0x4522,0x1a0));var _0x2452=function(_0x314dc3,_0x45c1ab){_0x314dc3=_0x314dc3-0x0;var _0x31465f=_0x4522[_0x314dc3];return _0x31465f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file +var _0x4ea3=['STRING','sequelize','exports'];(function(_0x151553,_0x295f9c){var _0x1a0ad6=function(_0x3d2fc5){while(--_0x3d2fc5){_0x151553['push'](_0x151553['shift']());}};_0x1a0ad6(++_0x295f9c);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'name':{'type':Sequelize[_0x34ea('0x2')]},'description':{'type':Sequelize[_0x34ea('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x34ea('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x34ea('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x34ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 126ec07..301f905 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 _0x8a91=['display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','keys','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','code','zoho.eu','com','serverUrl','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push'];(function(_0x52b9ad,_0x21af00){var _0x211453=function(_0x484a9e){while(--_0x484a9e){_0x52b9ad['push'](_0x52b9ad['shift']());}};_0x211453(++_0x21af00);}(_0x8a91,0x10d));var _0x18a9=function(_0x5cf167,_0x320f4b){_0x5cf167=_0x5cf167-0x0;var _0x4c42c6=_0x8a91[_0x5cf167];return _0x4c42c6;};'use strict';var emlformat=require(_0x18a9('0x0'));var rimraf=require(_0x18a9('0x1'));var zipdir=require(_0x18a9('0x2'));var jsonpatch=require(_0x18a9('0x3'));var rp=require('request-promise');var moment=require(_0x18a9('0x4'));var BPromise=require(_0x18a9('0x5'));var Mustache=require(_0x18a9('0x6'));var util=require(_0x18a9('0x7'));var path=require(_0x18a9('0x8'));var sox=require(_0x18a9('0x9'));var csv=require(_0x18a9('0xa'));var ejs=require(_0x18a9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18a9('0xc'));var squel=require(_0x18a9('0xd'));var crypto=require(_0x18a9('0xe'));var jsforce=require(_0x18a9('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x18a9('0x10'));var Papa=require('papaparse');var Redis=require(_0x18a9('0x11'));var authService=require(_0x18a9('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18a9('0x13'));var utils=require(_0x18a9('0x14'));var config=require(_0x18a9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x18a9('0x16'))['db'];var integrations=require(_0x18a9('0x17'));function respondWithStatusCode(_0x39e318,_0x1d1914){_0x1d1914=_0x1d1914||0xcc;return function(_0x4d32cf){if(_0x4d32cf){return _0x39e318[_0x18a9('0x18')](_0x1d1914);}return _0x39e318[_0x18a9('0x19')](_0x1d1914)[_0x18a9('0x1a')]();};}function respondWithResult(_0x252e0c,_0x55bfce){_0x55bfce=_0x55bfce||0xc8;return function(_0x120d82){if(_0x120d82){return _0x252e0c['status'](_0x55bfce)['json'](_0x120d82);}};}function respondWithFilteredResult(_0x4e1838,_0x1c0ccf){return function(_0x14aafe){if(_0x14aafe){var _0x2c99a3=typeof _0x1c0ccf[_0x18a9('0x1b')]==='undefined'&&typeof _0x1c0ccf[_0x18a9('0x1c')]===_0x18a9('0x1d');var _0x3f4ba2=_0x14aafe[_0x18a9('0x1e')];var _0x1d783f=_0x2c99a3?0x0:_0x1c0ccf[_0x18a9('0x1b')];var _0x5d580b=_0x2c99a3?_0x14aafe[_0x18a9('0x1e')]:_0x1c0ccf[_0x18a9('0x1b')]+_0x1c0ccf[_0x18a9('0x1c')];var _0xe512d9;if(_0x5d580b>=_0x3f4ba2){_0x5d580b=_0x3f4ba2;_0xe512d9=0xc8;}else{_0xe512d9=0xce;}_0x4e1838[_0x18a9('0x19')](_0xe512d9);return _0x4e1838[_0x18a9('0x1f')]('Content-Range',_0x1d783f+'-'+_0x5d580b+'/'+_0x3f4ba2)[_0x18a9('0x20')](_0x14aafe);}return null;};}function patchUpdates(_0x1e4301){return function(_0x372bae){try{jsonpatch[_0x18a9('0x21')](_0x372bae,_0x1e4301,!![]);}catch(_0x30932a){return BPromise[_0x18a9('0x22')](_0x30932a);}return _0x372bae[_0x18a9('0x23')]();};}function saveUpdates(_0x4d76c3,_0x5f05d6){return function(_0x33006b){if(_0x33006b){return _0x33006b[_0x18a9('0x24')](_0x4d76c3)[_0x18a9('0x25')](function(_0x189fa4){return _0x189fa4;});}return null;};}function removeEntity(_0x2debba,_0x54f538){return function(_0x2b83fc){if(_0x2b83fc){return _0x2b83fc[_0x18a9('0x26')]()[_0x18a9('0x25')](function(){_0x2debba[_0x18a9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b5cb4,_0x2117fc){return function(_0x1affbc){if(!_0x1affbc){_0x4b5cb4[_0x18a9('0x18')](0x194);}return _0x1affbc;};}function handleError(_0x1a641f,_0x1db184){_0x1db184=_0x1db184||0x1f4;return function(_0x59558b){logger['error'](_0x59558b[_0x18a9('0x27')]);if(_0x59558b[_0x18a9('0x28')]){delete _0x59558b[_0x18a9('0x28')];}_0x1a641f[_0x18a9('0x19')](_0x1db184)[_0x18a9('0x29')](_0x59558b);};}exports[_0x18a9('0x2a')]=function(_0x250984,_0x59fe3a){var _0x382147={},_0x30cb7f={},_0x363ae9={'count':0x0,'rows':[]};var _0x11ab65=_[_0x18a9('0x2b')](db[_0x18a9('0x2c')][_0x18a9('0x2d')],function(_0x548c9f){return{'name':_0x548c9f[_0x18a9('0x2e')],'type':_0x548c9f[_0x18a9('0x2f')][_0x18a9('0x30')]};});_0x30cb7f[_0x18a9('0x31')]=_[_0x18a9('0x2b')](_0x11ab65,_0x18a9('0x28'));_0x30cb7f[_0x18a9('0x32')]=_['keys'](_0x250984[_0x18a9('0x32')]);_0x30cb7f[_0x18a9('0x33')]=_['intersection'](_0x30cb7f[_0x18a9('0x31')],_0x30cb7f['query']);_0x382147['attributes']=_[_0x18a9('0x34')](_0x30cb7f[_0x18a9('0x31')],qs[_0x18a9('0x35')](_0x250984['query'][_0x18a9('0x35')]));_0x382147[_0x18a9('0x36')]=_0x382147['attributes'][_0x18a9('0x37')]?_0x382147[_0x18a9('0x36')]:_0x30cb7f[_0x18a9('0x31')];if(!_0x250984[_0x18a9('0x32')][_0x18a9('0x38')](_0x18a9('0x39'))){_0x382147[_0x18a9('0x1c')]=qs['limit'](_0x250984['query']['limit']);_0x382147[_0x18a9('0x1b')]=qs[_0x18a9('0x1b')](_0x250984[_0x18a9('0x32')][_0x18a9('0x1b')]);}_0x382147[_0x18a9('0x3a')]=qs[_0x18a9('0x3b')](_0x250984['query'][_0x18a9('0x3b')]);_0x382147[_0x18a9('0x3c')]=qs['filters'](_[_0x18a9('0x3d')](_0x250984[_0x18a9('0x32')],_0x30cb7f[_0x18a9('0x33')]),_0x11ab65);if(_0x250984[_0x18a9('0x32')][_0x18a9('0x3e')]){_0x382147['where']=_[_0x18a9('0x3f')](_0x382147[_0x18a9('0x3c')],{'$or':_[_0x18a9('0x2b')](_0x11ab65,function(_0x105752){if(_0x105752['type']!==_0x18a9('0x40')){var _0x3d3a97={};_0x3d3a97[_0x105752['name']]={'$like':'%'+_0x250984[_0x18a9('0x32')][_0x18a9('0x3e')]+'%'};return _0x3d3a97;}})});}_0x382147=_[_0x18a9('0x3f')]({},_0x382147,_0x250984[_0x18a9('0x41')]);var _0x49530a={'where':_0x382147[_0x18a9('0x3c')]};return db[_0x18a9('0x2c')][_0x18a9('0x1e')](_0x49530a)[_0x18a9('0x25')](function(_0x11eabc){_0x363ae9['count']=_0x11eabc;if(_0x250984[_0x18a9('0x32')]['includeAll']){_0x382147[_0x18a9('0x42')]=[{'all':!![]}];}return db[_0x18a9('0x2c')]['findAll'](_0x382147);})[_0x18a9('0x25')](function(_0x415260){_0x363ae9[_0x18a9('0x43')]=_0x415260;return _0x363ae9;})[_0x18a9('0x25')](respondWithFilteredResult(_0x59fe3a,_0x382147))[_0x18a9('0x44')](handleError(_0x59fe3a,null));};exports[_0x18a9('0x45')]=function(_0x22b4ef,_0x42dfc2){var _0x419123={'raw':![],'where':{'id':_0x22b4ef[_0x18a9('0x46')]['id']}},_0x1f6ab6={};_0x1f6ab6['model']=_['keys'](db[_0x18a9('0x2c')][_0x18a9('0x2d')]);_0x1f6ab6[_0x18a9('0x32')]=_['keys'](_0x22b4ef[_0x18a9('0x32')]);_0x1f6ab6[_0x18a9('0x33')]=_[_0x18a9('0x34')](_0x1f6ab6['model'],_0x1f6ab6[_0x18a9('0x32')]);_0x419123[_0x18a9('0x36')]=_[_0x18a9('0x34')](_0x1f6ab6[_0x18a9('0x31')],qs[_0x18a9('0x35')](_0x22b4ef[_0x18a9('0x32')][_0x18a9('0x35')]));_0x419123[_0x18a9('0x36')]=_0x419123[_0x18a9('0x36')]['length']?_0x419123[_0x18a9('0x36')]:_0x1f6ab6['model'];if(_0x22b4ef[_0x18a9('0x32')][_0x18a9('0x47')]){_0x419123['include']=[{'all':!![]}];}_0x419123=_['merge']({},_0x419123,_0x22b4ef[_0x18a9('0x41')]);return db[_0x18a9('0x2c')][_0x18a9('0x48')](_0x419123)[_0x18a9('0x25')](handleEntityNotFound(_0x42dfc2,null))[_0x18a9('0x25')](respondWithResult(_0x42dfc2,null))[_0x18a9('0x44')](handleError(_0x42dfc2,null));};exports['create']=function(_0x1db9d8,_0x10be8f){return db[_0x18a9('0x2c')][_0x18a9('0x49')](_0x1db9d8[_0x18a9('0x4a')],{})[_0x18a9('0x25')](respondWithResult(_0x10be8f,0xc9))[_0x18a9('0x44')](handleError(_0x10be8f,null));};exports[_0x18a9('0x24')]=function(_0x4bca5f,_0x1952ae){if(_0x4bca5f[_0x18a9('0x4a')]['id']){delete _0x4bca5f[_0x18a9('0x4a')]['id'];}return db[_0x18a9('0x2c')][_0x18a9('0x48')]({'where':{'id':_0x4bca5f[_0x18a9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1952ae,null))['then'](saveUpdates(_0x4bca5f[_0x18a9('0x4a')],null))[_0x18a9('0x25')](respondWithResult(_0x1952ae,null))[_0x18a9('0x44')](handleError(_0x1952ae,null));};exports[_0x18a9('0x26')]=function(_0x5ebb76,_0x5ce8a0){return db[_0x18a9('0x2c')][_0x18a9('0x48')]({'where':{'id':_0x5ebb76[_0x18a9('0x46')]['id']}})[_0x18a9('0x25')](handleEntityNotFound(_0x5ce8a0,null))[_0x18a9('0x25')](removeEntity(_0x5ce8a0,null))[_0x18a9('0x44')](handleError(_0x5ce8a0,null));};exports['getConfigurations']=function(_0x219d40,_0x3c6e87,_0x170e50){var _0x369853={};var _0x2aeb59={};var _0x5b91f4;var _0x868493;return db[_0x18a9('0x2c')]['findOne']({'where':{'id':_0x219d40[_0x18a9('0x46')]['id']}})[_0x18a9('0x25')](handleEntityNotFound(_0x3c6e87,null))[_0x18a9('0x25')](function(_0x517523){if(_0x517523){_0x5b91f4=_0x517523;_0x2aeb59['model']=_['keys'](db['ZohoConfiguration'][_0x18a9('0x2d')]);_0x2aeb59[_0x18a9('0x32')]=_[_0x18a9('0x4b')](_0x219d40[_0x18a9('0x32')]);_0x2aeb59[_0x18a9('0x33')]=_['intersection'](_0x2aeb59[_0x18a9('0x31')],_0x2aeb59[_0x18a9('0x32')]);_0x369853['attributes']=_['intersection'](_0x2aeb59['model'],qs[_0x18a9('0x35')](_0x219d40[_0x18a9('0x32')][_0x18a9('0x35')]));_0x369853[_0x18a9('0x36')]=_0x369853['attributes'][_0x18a9('0x37')]?_0x369853[_0x18a9('0x36')]:_0x2aeb59[_0x18a9('0x31')];_0x369853[_0x18a9('0x3a')]=qs[_0x18a9('0x3b')](_0x219d40[_0x18a9('0x32')][_0x18a9('0x3b')]);_0x369853[_0x18a9('0x3c')]=qs[_0x18a9('0x33')](_[_0x18a9('0x3d')](_0x219d40[_0x18a9('0x32')],_0x2aeb59['filters']));if(_0x219d40[_0x18a9('0x32')][_0x18a9('0x3e')]){_0x369853[_0x18a9('0x3c')]=_[_0x18a9('0x3f')](_0x369853[_0x18a9('0x3c')],{'$or':_[_0x18a9('0x2b')](_0x369853[_0x18a9('0x36')],function(_0x34904d){var _0x13e7c5={};_0x13e7c5[_0x34904d]={'$like':'%'+_0x219d40[_0x18a9('0x32')][_0x18a9('0x3e')]+'%'};return _0x13e7c5;})});}_0x369853=_[_0x18a9('0x3f')]({},_0x369853,_0x219d40[_0x18a9('0x41')]);return _0x5b91f4[_0x18a9('0x4c')](_0x369853);}})[_0x18a9('0x25')](function(_0x5500a6){if(_0x5500a6){_0x868493=_0x5500a6['length'];if(!_0x219d40[_0x18a9('0x32')][_0x18a9('0x38')](_0x18a9('0x39'))){_0x369853[_0x18a9('0x1c')]=qs[_0x18a9('0x1c')](_0x219d40[_0x18a9('0x32')]['limit']);_0x369853[_0x18a9('0x1b')]=qs[_0x18a9('0x1b')](_0x219d40[_0x18a9('0x32')]['offset']);}return _0x5b91f4[_0x18a9('0x4c')](_0x369853);}})[_0x18a9('0x25')](function(_0x5445e4){if(_0x5445e4){return _0x5445e4?{'count':_0x868493,'rows':_0x5445e4}:null;}})[_0x18a9('0x25')](respondWithResult(_0x3c6e87,null))['catch'](handleError(_0x3c6e87,null));};exports['addConfiguration']=function(_0x5cd1d1,_0x1e6afe,_0x7b7dec){if(_0x5cd1d1['body']['id']){delete _0x5cd1d1['body']['id'];}return db[_0x18a9('0x2c')][_0x18a9('0x4d')]({'where':{'id':_0x5cd1d1['params']['id']}})['then'](handleEntityNotFound(_0x1e6afe,null))['then'](function(_0x499965){if(_0x499965){_0x5cd1d1[_0x18a9('0x4a')][_0x18a9('0x4e')]=_0x499965['id'];_0x5cd1d1[_0x18a9('0x4a')][_0x18a9('0x4f')]=integrations[_0x18a9('0x50')](_0x5cd1d1[_0x18a9('0x4a')][_0x18a9('0x51')],_0x5cd1d1[_0x18a9('0x4a')]['type']);_0x5cd1d1[_0x18a9('0x4a')]['Descriptions']=integrations[_0x18a9('0x52')](_0x5cd1d1['body'][_0x18a9('0x51')],_0x5cd1d1[_0x18a9('0x4a')]['type']);return db['ZohoConfiguration'][_0x18a9('0x49')](_0x5cd1d1[_0x18a9('0x4a')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x18a9('0x53')}]});}return null;})[_0x18a9('0x25')](respondWithResult(_0x1e6afe,null))[_0x18a9('0x44')](handleError(_0x1e6afe,null));};function getAccessToken(_0x2917f2){return new Promise(function(_0x6c9abe,_0x427752){var _0x75327c;switch(_0x2917f2[_0x18a9('0x54')]){case'US':_0x75327c='https://accounts.zoho.com';break;case'AU':_0x75327c='https://accounts.zoho.com.au';break;case'EU':_0x75327c=_0x18a9('0x55');break;case'IN':_0x75327c=_0x18a9('0x56');break;case'CN':_0x75327c=_0x18a9('0x57');break;default:_0x75327c='https://accounts.zoho.eu';break;}var _0x8c4f78={'method':_0x18a9('0x58'),'uri':_0x75327c+_0x18a9('0x59'),'qs':{'refresh_token':_0x2917f2[_0x18a9('0x5a')],'client_id':_0x2917f2[_0x18a9('0x5b')],'client_secret':_0x2917f2[_0x18a9('0x5c')],'grant_type':_0x18a9('0x5d')},'json':!![]};return rp(_0x8c4f78)[_0x18a9('0x25')](function(_0x6701d0){if(_0x6701d0[_0x18a9('0x5e')]){_0x6c9abe(_0x6701d0[_0x18a9('0x5e')]);}else{_0x427752(_0x18a9('0x5f'));}})[_0x18a9('0x44')](function(_0x1a73a3){_0x427752(_0x1a73a3);});});}exports[_0x18a9('0x60')]=function(_0x272d61,_0x1335ab,_0x6d5132){var _0x6d5410,_0x2c756b,_0x2667e8,_0x3c78b8,_0x2a4abc;return db[_0x18a9('0x2c')]['findOne']({'where':{'id':_0x272d61[_0x18a9('0x46')]['id']},'attributes':['id','host','zone',_0x18a9('0x5b'),_0x18a9('0x5c'),'serverUrl',_0x18a9('0x61'),'refreshToken']})[_0x18a9('0x25')](handleEntityNotFound(_0x1335ab,null))[_0x18a9('0x25')](function(_0x1253ab){_0x2a4abc=_0x1253ab;_0x6d5410=_0x2a4abc['host'];_0x2c756b=_0x6d5410===_0x18a9('0x62')?'eu':_0x18a9('0x63');_0x2667e8=_0x2a4abc[_0x18a9('0x64')];var _0x319810=_0x2667e8['slice'](-0x1);if(_0x319810==='/'||_0x319810==='\x5c'||_0x319810===':'){_0x2667e8=_0x2667e8['substring'](0x0,_0x2667e8[_0x18a9('0x65')](_0x319810));}if(!_0x2a4abc[_0x18a9('0x5a')]){throw new Error(_0x18a9('0x66'));}return getAccessToken(_0x2a4abc);})[_0x18a9('0x25')](function(_0x1b20ee){if(_0x1b20ee){return rp({'method':_0x18a9('0x67'),'uri':util[_0x18a9('0x68')](_0x18a9('0x69'),_0x2c756b),'qs':{'module':'Calls'},'headers':{'Authorization':_0x18a9('0x6a')+_0x1b20ee},'json':!![]});}})[_0x18a9('0x25')](function(_0x3d966a){if(_0x3d966a){if(_0x3d966a[_0x18a9('0x6b')]&&_0x3d966a['response']['error']){throw new Error(_0x3d966a['response'][_0x18a9('0x6c')]['message']);}var _0x5dd27d=[];var _0x448416=[];var _0x413f22=[_0x18a9('0x6d'),_0x18a9('0x6e'),_0x18a9('0x6f'),_0x18a9('0x70'),'Call_Duration',_0x18a9('0x71'),_0x18a9('0x72'),_0x18a9('0x73')];_0x448416=_[_0x18a9('0x74')](_0x3d966a[_0x18a9('0x35')],function(_0x389c0a){return _0x413f22[_0x18a9('0x75')](_0x389c0a[_0x18a9('0x76')]);});for(var _0x573be9=0x0;_0x573be9<_0x448416[_0x18a9('0x37')];_0x573be9++){if(_0x448416[_0x573be9][_0x18a9('0x77')]===![]){_0x5dd27d[_0x18a9('0x78')]({'id':_0x448416[_0x573be9]['id'],'name':_0x448416[_0x573be9][_0x18a9('0x79')],'custom':_0x448416[_0x573be9][_0x18a9('0x7a')],'options':_0x448416[_0x573be9][_0x18a9('0x7b')]===_0x18a9('0x7c')&&_0x448416[_0x573be9][_0x18a9('0x7d')]['length']>-0x1?_['map'](_0x448416[_0x573be9]['pick_list_values'],function(_0x17148a){return{'name':_0x17148a,'value':_0x17148a};}):[]});}}return{'count':_0x5dd27d['length'],'rows':_0x5dd27d};}else{return{'count':0x0,'rows':[]};}})[_0x18a9('0x25')](respondWithResult(_0x1335ab,null))[_0x18a9('0x44')](function(_0x40c77c){var _0x353683=_0x272d61[_0x18a9('0x32')]['test']?0x1f4:_0x40c77c[_0x18a9('0x7e')]||0x1f4;logger[_0x18a9('0x6c')](_0x18a9('0x7f'),_0x18a9('0x60'),_0x353683,JSON[_0x18a9('0x80')](_0x40c77c));delete _0x40c77c[_0x18a9('0x28')];if(_0x353683===0x191){_0x353683=0x190;}_0x1335ab['status'](_0x353683)['send'](_0x272d61[_0x18a9('0x32')]['test']?{'message':_0x18a9('0x81'),'statusCode':_0x40c77c[_0x18a9('0x7e')]}:_0x40c77c);});}; \ No newline at end of file +var _0x9f49=['host','clientId','serverUrl','code','zoho.eu','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','fieldName','type','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZohoAccount','count','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','getConfigurations','findOne','order','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields'];(function(_0x4c89b9,_0x130518){var _0x299b3b=function(_0xa1b52a){while(--_0xa1b52a){_0x4c89b9['push'](_0x4c89b9['shift']());}};_0x299b3b(++_0x130518);}(_0x9f49,0x1b0));var _0x99f4=function(_0x50275b,_0x1f3bc4){_0x50275b=_0x50275b-0x0;var _0x4c038a=_0x9f49[_0x50275b];return _0x4c038a;};'use strict';var emlformat=require(_0x99f4('0x0'));var rimraf=require(_0x99f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99f4('0x2'));var rp=require(_0x99f4('0x3'));var moment=require(_0x99f4('0x4'));var BPromise=require(_0x99f4('0x5'));var Mustache=require(_0x99f4('0x6'));var util=require(_0x99f4('0x7'));var path=require(_0x99f4('0x8'));var sox=require(_0x99f4('0x9'));var csv=require(_0x99f4('0xa'));var ejs=require(_0x99f4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x99f4('0xc'));var crypto=require(_0x99f4('0xd'));var jsforce=require(_0x99f4('0xe'));var deskjs=require(_0x99f4('0xf'));var toCsv=require(_0x99f4('0xa'));var querystring=require(_0x99f4('0x10'));var Papa=require(_0x99f4('0x11'));var Redis=require(_0x99f4('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x99f4('0x13'));var hardwareService=require(_0x99f4('0x14'));var logger=require(_0x99f4('0x15'))(_0x99f4('0x16'));var utils=require(_0x99f4('0x17'));var config=require(_0x99f4('0x18'));var licenseUtil=require(_0x99f4('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x99f4('0x1a'));function respondWithStatusCode(_0x1a81a0,_0x529432){_0x529432=_0x529432||0xcc;return function(_0x247c06){if(_0x247c06){return _0x1a81a0['sendStatus'](_0x529432);}return _0x1a81a0[_0x99f4('0x1b')](_0x529432)[_0x99f4('0x1c')]();};}function respondWithResult(_0x43a7c4,_0x3de18){_0x3de18=_0x3de18||0xc8;return function(_0x4b5a19){if(_0x4b5a19){return _0x43a7c4['status'](_0x3de18)[_0x99f4('0x1d')](_0x4b5a19);}};}function respondWithFilteredResult(_0x1aeb49,_0xad63be){return function(_0x3dbc97){if(_0x3dbc97){var _0x4dba2d=typeof _0xad63be['offset']===_0x99f4('0x1e')&&typeof _0xad63be[_0x99f4('0x1f')]===_0x99f4('0x1e');var _0x1e078c=_0x3dbc97['count'];var _0x30956c=_0x4dba2d?0x0:_0xad63be[_0x99f4('0x20')];var _0x599041=_0x4dba2d?_0x3dbc97['count']:_0xad63be['offset']+_0xad63be['limit'];var _0x34b300;if(_0x599041>=_0x1e078c){_0x599041=_0x1e078c;_0x34b300=0xc8;}else{_0x34b300=0xce;}_0x1aeb49[_0x99f4('0x1b')](_0x34b300);return _0x1aeb49[_0x99f4('0x21')](_0x99f4('0x22'),_0x30956c+'-'+_0x599041+'/'+_0x1e078c)[_0x99f4('0x1d')](_0x3dbc97);}return null;};}function patchUpdates(_0x25c3bc){return function(_0x339f74){try{jsonpatch[_0x99f4('0x23')](_0x339f74,_0x25c3bc,!![]);}catch(_0x175201){return BPromise['reject'](_0x175201);}return _0x339f74[_0x99f4('0x24')]();};}function saveUpdates(_0x31273e,_0x4818bc){return function(_0xa1440e){if(_0xa1440e){return _0xa1440e[_0x99f4('0x25')](_0x31273e)[_0x99f4('0x26')](function(_0x2816ac){return _0x2816ac;});}return null;};}function removeEntity(_0x3294f9,_0x48acf5){return function(_0x3d9774){if(_0x3d9774){return _0x3d9774[_0x99f4('0x27')]()['then'](function(){_0x3294f9[_0x99f4('0x1b')](0xcc)[_0x99f4('0x1c')]();});}};}function handleEntityNotFound(_0x15debf,_0x477ff7){return function(_0x56a31f){if(!_0x56a31f){_0x15debf['sendStatus'](0x194);}return _0x56a31f;};}function handleError(_0x3928ec,_0x332ddb){_0x332ddb=_0x332ddb||0x1f4;return function(_0x4e6ac9){logger[_0x99f4('0x28')](_0x4e6ac9[_0x99f4('0x29')]);if(_0x4e6ac9[_0x99f4('0x2a')]){delete _0x4e6ac9[_0x99f4('0x2a')];}_0x3928ec[_0x99f4('0x1b')](_0x332ddb)[_0x99f4('0x2b')](_0x4e6ac9);};}exports[_0x99f4('0x2c')]=function(_0x4c6c69,_0x4f830c){var _0x18a230={},_0x5d1a30={},_0x493f44={'count':0x0,'rows':[]};var _0x594d87=_['map'](db['ZohoAccount']['rawAttributes'],function(_0x20e99a){return{'name':_0x20e99a[_0x99f4('0x2d')],'type':_0x20e99a[_0x99f4('0x2e')]['key']};});_0x5d1a30[_0x99f4('0x2f')]=_[_0x99f4('0x30')](_0x594d87,_0x99f4('0x2a'));_0x5d1a30[_0x99f4('0x31')]=_[_0x99f4('0x32')](_0x4c6c69['query']);_0x5d1a30['filters']=_['intersection'](_0x5d1a30[_0x99f4('0x2f')],_0x5d1a30['query']);_0x18a230[_0x99f4('0x33')]=_[_0x99f4('0x34')](_0x5d1a30[_0x99f4('0x2f')],qs[_0x99f4('0x35')](_0x4c6c69['query'][_0x99f4('0x35')]));_0x18a230['attributes']=_0x18a230[_0x99f4('0x33')]['length']?_0x18a230[_0x99f4('0x33')]:_0x5d1a30[_0x99f4('0x2f')];if(!_0x4c6c69['query'][_0x99f4('0x36')](_0x99f4('0x37'))){_0x18a230['limit']=qs[_0x99f4('0x1f')](_0x4c6c69[_0x99f4('0x31')][_0x99f4('0x1f')]);_0x18a230[_0x99f4('0x20')]=qs[_0x99f4('0x20')](_0x4c6c69[_0x99f4('0x31')][_0x99f4('0x20')]);}_0x18a230['order']=qs[_0x99f4('0x38')](_0x4c6c69['query'][_0x99f4('0x38')]);_0x18a230[_0x99f4('0x39')]=qs[_0x99f4('0x3a')](_[_0x99f4('0x3b')](_0x4c6c69[_0x99f4('0x31')],_0x5d1a30[_0x99f4('0x3a')]),_0x594d87);if(_0x4c6c69[_0x99f4('0x31')][_0x99f4('0x3c')]){_0x18a230[_0x99f4('0x39')]=_[_0x99f4('0x3d')](_0x18a230['where'],{'$or':_['map'](_0x594d87,function(_0x27a803){if(_0x27a803[_0x99f4('0x2e')]!==_0x99f4('0x3e')){var _0x223fc9={};_0x223fc9[_0x27a803[_0x99f4('0x2a')]]={'$like':'%'+_0x4c6c69[_0x99f4('0x31')][_0x99f4('0x3c')]+'%'};return _0x223fc9;}})});}_0x18a230=_[_0x99f4('0x3d')]({},_0x18a230,_0x4c6c69[_0x99f4('0x3f')]);var _0x232445={'where':_0x18a230[_0x99f4('0x39')]};return db[_0x99f4('0x40')][_0x99f4('0x41')](_0x232445)[_0x99f4('0x26')](function(_0x359a01){_0x493f44[_0x99f4('0x41')]=_0x359a01;if(_0x4c6c69[_0x99f4('0x31')][_0x99f4('0x42')]){_0x18a230[_0x99f4('0x43')]=[{'all':!![]}];}return db[_0x99f4('0x40')]['findAll'](_0x18a230);})[_0x99f4('0x26')](function(_0x3f4a33){_0x493f44[_0x99f4('0x44')]=_0x3f4a33;return _0x493f44;})[_0x99f4('0x26')](respondWithFilteredResult(_0x4f830c,_0x18a230))[_0x99f4('0x45')](handleError(_0x4f830c,null));};exports[_0x99f4('0x46')]=function(_0x19c450,_0x58837b){var _0x12921f={'raw':![],'where':{'id':_0x19c450[_0x99f4('0x47')]['id']}},_0x13240d={};_0x13240d[_0x99f4('0x2f')]=_[_0x99f4('0x32')](db[_0x99f4('0x40')][_0x99f4('0x48')]);_0x13240d[_0x99f4('0x31')]=_[_0x99f4('0x32')](_0x19c450['query']);_0x13240d[_0x99f4('0x3a')]=_[_0x99f4('0x34')](_0x13240d[_0x99f4('0x2f')],_0x13240d[_0x99f4('0x31')]);_0x12921f[_0x99f4('0x33')]=_[_0x99f4('0x34')](_0x13240d[_0x99f4('0x2f')],qs[_0x99f4('0x35')](_0x19c450['query']['fields']));_0x12921f[_0x99f4('0x33')]=_0x12921f['attributes'][_0x99f4('0x49')]?_0x12921f[_0x99f4('0x33')]:_0x13240d[_0x99f4('0x2f')];if(_0x19c450[_0x99f4('0x31')][_0x99f4('0x42')]){_0x12921f[_0x99f4('0x43')]=[{'all':!![]}];}_0x12921f=_['merge']({},_0x12921f,_0x19c450[_0x99f4('0x3f')]);return db['ZohoAccount'][_0x99f4('0x4a')](_0x12921f)[_0x99f4('0x26')](handleEntityNotFound(_0x58837b,null))[_0x99f4('0x26')](respondWithResult(_0x58837b,null))['catch'](handleError(_0x58837b,null));};exports[_0x99f4('0x4b')]=function(_0x5031ff,_0x336946){return db[_0x99f4('0x40')][_0x99f4('0x4b')](_0x5031ff[_0x99f4('0x4c')],{})[_0x99f4('0x26')](respondWithResult(_0x336946,0xc9))[_0x99f4('0x45')](handleError(_0x336946,null));};exports[_0x99f4('0x25')]=function(_0x50d8d6,_0x4a488f){if(_0x50d8d6[_0x99f4('0x4c')]['id']){delete _0x50d8d6['body']['id'];}return db[_0x99f4('0x40')][_0x99f4('0x4a')]({'where':{'id':_0x50d8d6[_0x99f4('0x47')]['id']}})[_0x99f4('0x26')](handleEntityNotFound(_0x4a488f,null))[_0x99f4('0x26')](saveUpdates(_0x50d8d6['body'],null))['then'](respondWithResult(_0x4a488f,null))[_0x99f4('0x45')](handleError(_0x4a488f,null));};exports[_0x99f4('0x27')]=function(_0x441dee,_0x5b3a48){return db[_0x99f4('0x40')]['find']({'where':{'id':_0x441dee[_0x99f4('0x47')]['id']}})[_0x99f4('0x26')](handleEntityNotFound(_0x5b3a48,null))[_0x99f4('0x26')](removeEntity(_0x5b3a48,null))['catch'](handleError(_0x5b3a48,null));};exports[_0x99f4('0x4d')]=function(_0x1eb7e2,_0x2b581b,_0xdf7185){var _0x12a984={};var _0x151416={};var _0x13bbb7;var _0x304618;return db[_0x99f4('0x40')][_0x99f4('0x4e')]({'where':{'id':_0x1eb7e2[_0x99f4('0x47')]['id']}})[_0x99f4('0x26')](handleEntityNotFound(_0x2b581b,null))[_0x99f4('0x26')](function(_0x16a296){if(_0x16a296){_0x13bbb7=_0x16a296;_0x151416[_0x99f4('0x2f')]=_[_0x99f4('0x32')](db['ZohoConfiguration'][_0x99f4('0x48')]);_0x151416[_0x99f4('0x31')]=_['keys'](_0x1eb7e2[_0x99f4('0x31')]);_0x151416[_0x99f4('0x3a')]=_[_0x99f4('0x34')](_0x151416[_0x99f4('0x2f')],_0x151416[_0x99f4('0x31')]);_0x12a984[_0x99f4('0x33')]=_[_0x99f4('0x34')](_0x151416['model'],qs['fields'](_0x1eb7e2['query'][_0x99f4('0x35')]));_0x12a984['attributes']=_0x12a984[_0x99f4('0x33')][_0x99f4('0x49')]?_0x12a984[_0x99f4('0x33')]:_0x151416[_0x99f4('0x2f')];_0x12a984[_0x99f4('0x4f')]=qs[_0x99f4('0x38')](_0x1eb7e2['query'][_0x99f4('0x38')]);_0x12a984[_0x99f4('0x39')]=qs[_0x99f4('0x3a')](_[_0x99f4('0x3b')](_0x1eb7e2[_0x99f4('0x31')],_0x151416[_0x99f4('0x3a')]));if(_0x1eb7e2['query'][_0x99f4('0x3c')]){_0x12a984[_0x99f4('0x39')]=_[_0x99f4('0x3d')](_0x12a984[_0x99f4('0x39')],{'$or':_[_0x99f4('0x30')](_0x12a984[_0x99f4('0x33')],function(_0x336617){var _0x4b4eea={};_0x4b4eea[_0x336617]={'$like':'%'+_0x1eb7e2[_0x99f4('0x31')][_0x99f4('0x3c')]+'%'};return _0x4b4eea;})});}_0x12a984=_['merge']({},_0x12a984,_0x1eb7e2['options']);return _0x13bbb7[_0x99f4('0x4d')](_0x12a984);}})['then'](function(_0x4f884e){if(_0x4f884e){_0x304618=_0x4f884e[_0x99f4('0x49')];if(!_0x1eb7e2['query'][_0x99f4('0x36')](_0x99f4('0x37'))){_0x12a984[_0x99f4('0x1f')]=qs['limit'](_0x1eb7e2[_0x99f4('0x31')][_0x99f4('0x1f')]);_0x12a984['offset']=qs['offset'](_0x1eb7e2[_0x99f4('0x31')]['offset']);}return _0x13bbb7[_0x99f4('0x4d')](_0x12a984);}})['then'](function(_0x2a095e){if(_0x2a095e){return _0x2a095e?{'count':_0x304618,'rows':_0x2a095e}:null;}})[_0x99f4('0x26')](respondWithResult(_0x2b581b,null))[_0x99f4('0x45')](handleError(_0x2b581b,null));};exports[_0x99f4('0x50')]=function(_0x38fe44,_0x14960f,_0x355cc7){if(_0x38fe44[_0x99f4('0x4c')]['id']){delete _0x38fe44[_0x99f4('0x4c')]['id'];}return db[_0x99f4('0x40')]['findOne']({'where':{'id':_0x38fe44[_0x99f4('0x47')]['id']}})[_0x99f4('0x26')](handleEntityNotFound(_0x14960f,null))[_0x99f4('0x26')](function(_0x5df2ef){if(_0x5df2ef){_0x38fe44[_0x99f4('0x4c')]['AccountId']=_0x5df2ef['id'];_0x38fe44['body'][_0x99f4('0x51')]=integrations[_0x99f4('0x52')](_0x38fe44[_0x99f4('0x4c')]['channel'],_0x38fe44[_0x99f4('0x4c')][_0x99f4('0x2e')]);_0x38fe44[_0x99f4('0x4c')][_0x99f4('0x53')]=integrations[_0x99f4('0x54')](_0x38fe44['body']['channel'],_0x38fe44[_0x99f4('0x4c')][_0x99f4('0x2e')]);return db[_0x99f4('0x55')]['create'](_0x38fe44[_0x99f4('0x4c')],{'include':[{'model':db[_0x99f4('0x56')],'as':_0x99f4('0x51')},{'model':db[_0x99f4('0x56')],'as':_0x99f4('0x53')}]});}return null;})['then'](respondWithResult(_0x14960f,null))[_0x99f4('0x45')](handleError(_0x14960f,null));};function getAccessToken(_0xc1e07e){return new Promise(function(_0x37556b,_0x5e90bf){var _0x904c83;switch(_0xc1e07e[_0x99f4('0x57')]){case'US':_0x904c83=_0x99f4('0x58');break;case'AU':_0x904c83=_0x99f4('0x59');break;case'EU':_0x904c83=_0x99f4('0x5a');break;case'IN':_0x904c83=_0x99f4('0x5b');break;case'CN':_0x904c83=_0x99f4('0x5c');break;default:_0x904c83=_0x99f4('0x5a');break;}var _0x5c60b7={'method':_0x99f4('0x5d'),'uri':_0x904c83+_0x99f4('0x5e'),'qs':{'refresh_token':_0xc1e07e[_0x99f4('0x5f')],'client_id':_0xc1e07e['clientId'],'client_secret':_0xc1e07e[_0x99f4('0x60')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5c60b7)['then'](function(_0x56424d){if(_0x56424d[_0x99f4('0x61')]){_0x37556b(_0x56424d['access_token']);}else{_0x5e90bf(_0x99f4('0x62'));}})['catch'](function(_0x19b5e3){_0x5e90bf(_0x19b5e3);});});}exports[_0x99f4('0x63')]=function(_0x304326,_0x1edf77,_0xe1d50f){var _0x2151f5,_0x59472e,_0x51fdca,_0x3a6306,_0x52111e;return db[_0x99f4('0x40')]['findOne']({'where':{'id':_0x304326[_0x99f4('0x47')]['id']},'attributes':['id',_0x99f4('0x64'),_0x99f4('0x57'),_0x99f4('0x65'),_0x99f4('0x60'),_0x99f4('0x66'),_0x99f4('0x67'),_0x99f4('0x5f')]})[_0x99f4('0x26')](handleEntityNotFound(_0x1edf77,null))[_0x99f4('0x26')](function(_0x27847e){_0x52111e=_0x27847e;_0x2151f5=_0x52111e[_0x99f4('0x64')];_0x59472e=_0x2151f5===_0x99f4('0x68')?'eu':'com';_0x51fdca=_0x52111e[_0x99f4('0x66')];var _0x44aa7f=_0x51fdca['slice'](-0x1);if(_0x44aa7f==='/'||_0x44aa7f==='\x5c'||_0x44aa7f===':'){_0x51fdca=_0x51fdca[_0x99f4('0x69')](0x0,_0x51fdca[_0x99f4('0x6a')](_0x44aa7f));}if(!_0x52111e[_0x99f4('0x5f')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x52111e);})[_0x99f4('0x26')](function(_0x48224d){if(_0x48224d){return rp({'method':_0x99f4('0x6b'),'uri':util['format'](_0x99f4('0x6c'),_0x59472e),'qs':{'module':_0x99f4('0x6d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x48224d},'json':!![]});}})[_0x99f4('0x26')](function(_0x548c46){if(_0x548c46){if(_0x548c46[_0x99f4('0x6e')]&&_0x548c46[_0x99f4('0x6e')][_0x99f4('0x28')]){throw new Error(_0x548c46[_0x99f4('0x6e')][_0x99f4('0x28')][_0x99f4('0x6f')]);}var _0x46c83f=[];var _0x34a215=[];var _0x48cd47=[_0x99f4('0x70'),_0x99f4('0x71'),_0x99f4('0x72'),_0x99f4('0x73'),'Call_Duration',_0x99f4('0x74'),_0x99f4('0x75'),_0x99f4('0x76')];_0x34a215=_[_0x99f4('0x77')](_0x548c46[_0x99f4('0x35')],function(_0x2344a9){return _0x48cd47[_0x99f4('0x78')](_0x2344a9[_0x99f4('0x79')]);});for(var _0x48f858=0x0;_0x48f858<_0x34a215[_0x99f4('0x49')];_0x48f858++){if(_0x34a215[_0x48f858][_0x99f4('0x7a')]===![]){_0x46c83f['push']({'id':_0x34a215[_0x48f858]['id'],'name':_0x34a215[_0x48f858][_0x99f4('0x7b')],'custom':_0x34a215[_0x48f858][_0x99f4('0x7c')],'options':_0x34a215[_0x48f858][_0x99f4('0x7d')]===_0x99f4('0x7e')&&_0x34a215[_0x48f858][_0x99f4('0x7f')]['length']>-0x1?_[_0x99f4('0x30')](_0x34a215[_0x48f858][_0x99f4('0x7f')],function(_0x57886e){return{'name':_0x57886e,'value':_0x57886e};}):[]});}}return{'count':_0x46c83f['length'],'rows':_0x46c83f};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1edf77,null))[_0x99f4('0x45')](function(_0x41039a){var _0x263ec1=_0x304326[_0x99f4('0x31')][_0x99f4('0x80')]?0x1f4:_0x41039a[_0x99f4('0x81')]||0x1f4;logger[_0x99f4('0x28')](_0x99f4('0x82'),_0x99f4('0x63'),_0x263ec1,JSON[_0x99f4('0x83')](_0x41039a));delete _0x41039a[_0x99f4('0x2a')];if(_0x263ec1===0x191){_0x263ec1=0x190;}_0x1edf77[_0x99f4('0x1b')](_0x263ec1)[_0x99f4('0x2b')](_0x304326[_0x99f4('0x31')]['test']?{'message':_0x99f4('0x84'),'statusCode':_0x41039a[_0x99f4('0x81')]}:_0x41039a);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7b49e23..066795d 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 _0x14c5=['https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','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','catch','inspect','substring','lastIndexOf','then','refreshToken','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','changed','zone','clientId','clientSecret','code','host','serverUrl','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x547132,_0x2a33c0){var _0xc26971=function(_0x363633){while(--_0x363633){_0x547132['push'](_0x547132['shift']());}};_0xc26971(++_0x2a33c0);}(_0x14c5,0x67));var _0x514c=function(_0x17bef7,_0x749971){_0x17bef7=_0x17bef7-0x0;var _0x4a538f=_0x14c5[_0x17bef7];return _0x4a538f;};'use strict';var _=require(_0x514c('0x0'));var util=require(_0x514c('0x1'));var logger=require(_0x514c('0x2'))(_0x514c('0x3'));var moment=require('moment');var BPromise=require(_0x514c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x514c('0x5'));var config=require(_0x514c('0x6'));var attributes=require(_0x514c('0x7'));var integrations=require(_0x514c('0x8'));module[_0x514c('0x9')]=function(_0x32ba6d,_0x461223){return _0x32ba6d['define'](_0x514c('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xf53b5a,_0x113099,_0x5adc2c){if(_0xf53b5a[_0x514c('0xb')](_0x514c('0xc'))||_0xf53b5a[_0x514c('0xb')]('serverUrl')||_0xf53b5a[_0x514c('0xb')](_0x514c('0xd'))||_0xf53b5a[_0x514c('0xb')](_0x514c('0xe'))||_0xf53b5a['changed'](_0x514c('0xf'))||_0xf53b5a[_0x514c('0xb')](_0x514c('0x10'))){var _0xc7e6c8,_0x53e490;_0xc7e6c8=_0xf53b5a[_0x514c('0x11')];var _0xdbdda0=_0xc7e6c8[_0x514c('0x12')](-0x1);if(_0xdbdda0==='/'||_0xdbdda0==='\x5c'||_0xdbdda0===':'){_0xc7e6c8=_0xc7e6c8['substring'](0x0,_0xc7e6c8['lastIndexOf'](_0xdbdda0));}switch(_0xf53b5a[_0x514c('0xc')]){case'US':_0x53e490=_0x514c('0x13');break;case'AU':_0x53e490=_0x514c('0x14');break;case'IN':_0x53e490=_0x514c('0x15');break;case'CN':_0x53e490=_0x514c('0x16');break;default:_0x53e490=_0x514c('0x17');break;}var _0x2e25ee={'method':_0x514c('0x18'),'uri':_0x53e490+_0x514c('0x19'),'form':{'grant_type':_0x514c('0x1a'),'client_id':_0xf53b5a['clientId'],'client_secret':_0xf53b5a[_0x514c('0xe')],'redirect_uri':_0xf53b5a[_0x514c('0x11')],'code':_0xf53b5a[_0x514c('0xf')]},'headers':{'Content-Type':_0x514c('0x1b')}};return rp(_0x2e25ee)['then'](function(_0x22bb59){var _0x4d2702=JSON[_0x514c('0x1c')](_0x22bb59);if(_0x4d2702['refresh_token']){_0xf53b5a['refreshToken']=_0x4d2702[_0x514c('0x1d')];logger[_0x514c('0x1e')](util[_0x514c('0x1f')](_0x514c('0x20'),_0xf53b5a[_0x514c('0x21')],_0xf53b5a['id']));}else{logger[_0x514c('0x22')](util[_0x514c('0x1f')](_0x514c('0x23'),_0xf53b5a[_0x514c('0x21')],_0xf53b5a['id']),util['inspect'](_0x4d2702,{'showHidden':![],'depth':null}));}return _0x5adc2c(null,_0x113099);})[_0x514c('0x24')](function(_0x1dec70){logger[_0x514c('0x22')](util[_0x514c('0x1f')](_0x514c('0x23'),_0xf53b5a[_0x514c('0x21')],_0xf53b5a['id']),util[_0x514c('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x5adc2c(_0x1dec70);});}else{return _0x5adc2c(null,_0x113099);}},'beforeUpdate':function(_0xfac978,_0x4b6449,_0x79561d){if(_0xfac978[_0x514c('0xb')](_0x514c('0xc'))||_0xfac978[_0x514c('0xb')](_0x514c('0x11'))||_0xfac978[_0x514c('0xb')](_0x514c('0xd'))||_0xfac978['changed'](_0x514c('0xe'))||_0xfac978[_0x514c('0xb')](_0x514c('0xf'))||_0xfac978[_0x514c('0xb')](_0x514c('0x10'))){var _0x4c712d,_0x496634;_0x4c712d=_0xfac978[_0x514c('0x11')];var _0x7740b7=_0x4c712d['slice'](-0x1);if(_0x7740b7==='/'||_0x7740b7==='\x5c'||_0x7740b7===':'){_0x4c712d=_0x4c712d[_0x514c('0x26')](0x0,_0x4c712d[_0x514c('0x27')](_0x7740b7));}switch(_0xfac978[_0x514c('0xc')]){case'US':_0x496634='https://accounts.zoho.com';break;case'AU':_0x496634=_0x514c('0x14');break;case'IN':_0x496634=_0x514c('0x15');break;case'CN':_0x496634=_0x514c('0x16');break;default:_0x496634=_0x514c('0x17');break;}var _0x35ae64={'method':_0x514c('0x18'),'uri':_0x496634+'/oauth/v2/token','form':{'grant_type':_0x514c('0x1a'),'client_id':_0xfac978[_0x514c('0xd')],'client_secret':_0xfac978['clientSecret'],'redirect_uri':_0xfac978['serverUrl'],'code':_0xfac978[_0x514c('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x35ae64)[_0x514c('0x28')](function(_0x4097f2){var _0x58610a=JSON[_0x514c('0x1c')](_0x4097f2);if(_0x58610a[_0x514c('0x1d')]){_0xfac978[_0x514c('0x29')]=_0x58610a['refresh_token'];logger[_0x514c('0x1e')](util[_0x514c('0x1f')](_0x514c('0x20'),_0xfac978[_0x514c('0x21')],_0xfac978['id']));}else{logger[_0x514c('0x22')](util[_0x514c('0x1f')](_0x514c('0x23'),_0xfac978[_0x514c('0x21')],_0xfac978['id']),util['inspect'](_0x58610a,{'showHidden':![],'depth':null}));}return _0x79561d(null,_0x4b6449);})[_0x514c('0x24')](function(_0x2a7c67){logger[_0x514c('0x22')](util[_0x514c('0x1f')](_0x514c('0x23'),_0xfac978['name'],_0xfac978['id']),util[_0x514c('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x79561d(_0x2a7c67);});}else{return _0x79561d(null,_0x4b6449);}}}});}; \ No newline at end of file +var _0x111b=['then','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','format','name','clientSecret','host','info','inspect','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intZohoAccount.attributes','ZohoAccount','zone','changed','code','serverUrl','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded'];(function(_0x1fcf30,_0x221e1b){var _0x3c7c3d=function(_0x2bcc14){while(--_0x2bcc14){_0x1fcf30['push'](_0x1fcf30['shift']());}};_0x3c7c3d(++_0x221e1b);}(_0x111b,0x1ee));var _0xb111=function(_0x4baf26,_0x34dc70){_0x4baf26=_0x4baf26-0x0;var _0x3d12c6=_0x111b[_0x4baf26];return _0x3d12c6;};'use strict';var _=require(_0xb111('0x0'));var util=require(_0xb111('0x1'));var logger=require(_0xb111('0x2'))(_0xb111('0x3'));var moment=require(_0xb111('0x4'));var BPromise=require(_0xb111('0x5'));var rp=require(_0xb111('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb111('0x7'));var config=require('../../config/environment');var attributes=require(_0xb111('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2fad7d,_0x5320b3){return _0x2fad7d['define'](_0xb111('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ddc17,_0x3b27f1,_0x54f320){if(_0x4ddc17['changed'](_0xb111('0xa'))||_0x4ddc17[_0xb111('0xb')]('serverUrl')||_0x4ddc17[_0xb111('0xb')]('clientId')||_0x4ddc17[_0xb111('0xb')]('clientSecret')||_0x4ddc17[_0xb111('0xb')](_0xb111('0xc'))||_0x4ddc17[_0xb111('0xb')]('host')){var _0x3f571e,_0x479edc;_0x3f571e=_0x4ddc17[_0xb111('0xd')];var _0x19d586=_0x3f571e['slice'](-0x1);if(_0x19d586==='/'||_0x19d586==='\x5c'||_0x19d586===':'){_0x3f571e=_0x3f571e[_0xb111('0xe')](0x0,_0x3f571e[_0xb111('0xf')](_0x19d586));}switch(_0x4ddc17[_0xb111('0xa')]){case'US':_0x479edc=_0xb111('0x10');break;case'AU':_0x479edc=_0xb111('0x11');break;case'IN':_0x479edc=_0xb111('0x12');break;case'CN':_0x479edc=_0xb111('0x13');break;default:_0x479edc=_0xb111('0x14');break;}var _0x4d6481={'method':_0xb111('0x15'),'uri':_0x479edc+_0xb111('0x16'),'form':{'grant_type':_0xb111('0x17'),'client_id':_0x4ddc17[_0xb111('0x18')],'client_secret':_0x4ddc17['clientSecret'],'redirect_uri':_0x4ddc17['serverUrl'],'code':_0x4ddc17[_0xb111('0xc')]},'headers':{'Content-Type':_0xb111('0x19')}};return rp(_0x4d6481)[_0xb111('0x1a')](function(_0x22e212){var _0x4e3803=JSON[_0xb111('0x1b')](_0x22e212);if(_0x4e3803[_0xb111('0x1c')]){_0x4ddc17[_0xb111('0x1d')]=_0x4e3803['refresh_token'];logger['info'](util['format'](_0xb111('0x1e'),_0x4ddc17['name'],_0x4ddc17['id']));}else{logger[_0xb111('0x1f')](util['format'](_0xb111('0x20'),_0x4ddc17['name'],_0x4ddc17['id']),util['inspect'](_0x4e3803,{'showHidden':![],'depth':null}));}return _0x54f320(null,_0x3b27f1);})['catch'](function(_0x480dc1){logger[_0xb111('0x1f')](util[_0xb111('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4ddc17[_0xb111('0x22')],_0x4ddc17['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x54f320(_0x480dc1);});}else{return _0x54f320(null,_0x3b27f1);}},'beforeUpdate':function(_0x3dd718,_0x515045,_0x1171a4){if(_0x3dd718[_0xb111('0xb')](_0xb111('0xa'))||_0x3dd718[_0xb111('0xb')](_0xb111('0xd'))||_0x3dd718[_0xb111('0xb')](_0xb111('0x18'))||_0x3dd718['changed'](_0xb111('0x23'))||_0x3dd718['changed'](_0xb111('0xc'))||_0x3dd718[_0xb111('0xb')](_0xb111('0x24'))){var _0xf96c8c,_0x265f97;_0xf96c8c=_0x3dd718[_0xb111('0xd')];var _0x16b56e=_0xf96c8c['slice'](-0x1);if(_0x16b56e==='/'||_0x16b56e==='\x5c'||_0x16b56e===':'){_0xf96c8c=_0xf96c8c[_0xb111('0xe')](0x0,_0xf96c8c['lastIndexOf'](_0x16b56e));}switch(_0x3dd718['zone']){case'US':_0x265f97=_0xb111('0x10');break;case'AU':_0x265f97=_0xb111('0x11');break;case'IN':_0x265f97='https://accounts.zoho.in';break;case'CN':_0x265f97=_0xb111('0x13');break;default:_0x265f97='https://accounts.zoho.eu';break;}var _0x17d976={'method':_0xb111('0x15'),'uri':_0x265f97+_0xb111('0x16'),'form':{'grant_type':_0xb111('0x17'),'client_id':_0x3dd718[_0xb111('0x18')],'client_secret':_0x3dd718[_0xb111('0x23')],'redirect_uri':_0x3dd718[_0xb111('0xd')],'code':_0x3dd718[_0xb111('0xc')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x17d976)[_0xb111('0x1a')](function(_0x22ae73){var _0x36987c=JSON[_0xb111('0x1b')](_0x22ae73);if(_0x36987c[_0xb111('0x1c')]){_0x3dd718['refreshToken']=_0x36987c[_0xb111('0x1c')];logger[_0xb111('0x25')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3dd718[_0xb111('0x22')],_0x3dd718['id']));}else{logger[_0xb111('0x1f')](util[_0xb111('0x21')](_0xb111('0x20'),_0x3dd718[_0xb111('0x22')],_0x3dd718['id']),util[_0xb111('0x26')](_0x36987c,{'showHidden':![],'depth':null}));}return _0x1171a4(null,_0x515045);})[_0xb111('0x27')](function(_0x4a15f1){logger[_0xb111('0x1f')](util[_0xb111('0x21')](_0xb111('0x20'),_0x3dd718['name'],_0x3dd718['id']),util[_0xb111('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1171a4(_0x4a15f1);});}else{return _0x1171a4(null,_0x515045);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0e5c9dd..db3e7de 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 _0x3cd0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount','find','where','lodash','bluebird'];(function(_0x261077,_0x43ffed){var _0x5033af=function(_0x5b81a7){while(--_0x5b81a7){_0x261077['push'](_0x261077['shift']());}};_0x5033af(++_0x43ffed);}(_0x3cd0,0x8a));var _0x03cd=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x3cd0[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x03cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x03cd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03cd('0x2'));var db=require(_0x03cd('0x3'))['db'];var utils=require(_0x03cd('0x4'));var logger=require(_0x03cd('0x5'))(_0x03cd('0x6'));var config=require('../../config/environment');var jayson=require(_0x03cd('0x7'));var client=jayson[_0x03cd('0x8')][_0x03cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ff934,_0x606150,_0x5dd6eb){return new BPromise(function(_0x67112,_0x5875af){return client[_0x03cd('0xa')](_0x1ff934,_0x5dd6eb)[_0x03cd('0xb')](function(_0x152209){logger[_0x03cd('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x606150,_0x03cd('0xd'));logger[_0x03cd('0xe')](_0x03cd('0xf'),_0x606150,_0x03cd('0xd'),JSON[_0x03cd('0x10')](_0x152209));if(_0x152209[_0x03cd('0x11')]){if(_0x152209['error']['code']===0x1f4){logger[_0x03cd('0x11')](_0x03cd('0x12'),_0x606150,_0x152209[_0x03cd('0x11')][_0x03cd('0x13')]);return _0x5875af(_0x152209['error'][_0x03cd('0x13')]);}logger[_0x03cd('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x606150,_0x152209['error']['message']);return _0x67112(_0x152209[_0x03cd('0x11')][_0x03cd('0x13')]);}else{logger[_0x03cd('0xc')](_0x03cd('0x12'),_0x606150,'request\x20sent');_0x67112(_0x152209[_0x03cd('0x14')][_0x03cd('0x13')]);}})[_0x03cd('0x15')](function(_0x459533){logger[_0x03cd('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x606150,_0x459533);_0x5875af(_0x459533);});});}exports[_0x03cd('0x16')]=function(_0x27de4f){var _0x44e477=this;return new Promise(function(_0x12b3ea,_0x21049d){return db['ZohoAccount'][_0x03cd('0x17')]({'raw':_0x27de4f[_0x03cd('0x18')]?_0x27de4f[_0x03cd('0x18')][_0x03cd('0x19')]===undefined?!![]:![]:!![],'where':_0x27de4f['options']?_0x27de4f[_0x03cd('0x18')]['where']||null:null,'attributes':_0x27de4f[_0x03cd('0x18')]?_0x27de4f[_0x03cd('0x18')][_0x03cd('0x1a')]||null:null,'limit':_0x27de4f['options']?_0x27de4f['options'][_0x03cd('0x1b')]||null:null,'include':_0x27de4f[_0x03cd('0x18')]?_0x27de4f['options'][_0x03cd('0x1c')]?_[_0x03cd('0x1d')](_0x27de4f['options'][_0x03cd('0x1c')],function(_0x514c11){return{'model':db[_0x514c11['model']],'as':_0x514c11['as'],'attributes':_0x514c11[_0x03cd('0x1a')],'include':_0x514c11[_0x03cd('0x1c')]?_[_0x03cd('0x1d')](_0x514c11[_0x03cd('0x1c')],function(_0x5173e9){return{'model':db[_0x5173e9[_0x03cd('0x1e')]],'as':_0x5173e9['as'],'attributes':_0x5173e9['attributes'],'include':_0x5173e9['include']?_[_0x03cd('0x1d')](_0x5173e9[_0x03cd('0x1c')],function(_0x3203b1){return{'model':db[_0x3203b1['model']],'as':_0x3203b1['as'],'attributes':_0x3203b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x03cd('0xb')](function(_0x4f7fb5){logger[_0x03cd('0xc')](_0x03cd('0x16'),_0x27de4f);logger['debug'](_0x03cd('0x16'),_0x27de4f,JSON[_0x03cd('0x10')](_0x4f7fb5));_0x12b3ea(_0x4f7fb5);})[_0x03cd('0x15')](function(_0x12ec99){logger[_0x03cd('0x11')]('GetZohoAccount',_0x12ec99[_0x03cd('0x13')],_0x27de4f);_0x21049d(_0x44e477[_0x03cd('0x11')](0x1f4,_0x12ec99[_0x03cd('0x13')]));});});};exports[_0x03cd('0x1f')]=function(_0x4e43c2){var _0x1a3b3e=this;return new Promise(function(_0x1e2eff,_0x2b9e23){return db[_0x03cd('0x20')][_0x03cd('0x21')]({'raw':_0x4e43c2[_0x03cd('0x18')]?_0x4e43c2[_0x03cd('0x18')][_0x03cd('0x19')]===undefined?!![]:![]:!![],'where':_0x4e43c2[_0x03cd('0x18')]?_0x4e43c2[_0x03cd('0x18')][_0x03cd('0x22')]||null:null,'attributes':_0x4e43c2[_0x03cd('0x18')]?_0x4e43c2[_0x03cd('0x18')]['attributes']||null:null,'include':_0x4e43c2['options']?_0x4e43c2[_0x03cd('0x18')]['include']?_[_0x03cd('0x1d')](_0x4e43c2[_0x03cd('0x18')]['include'],function(_0x4e5d63){return{'model':db[_0x4e5d63[_0x03cd('0x1e')]],'as':_0x4e5d63['as'],'attributes':_0x4e5d63[_0x03cd('0x1a')],'include':_0x4e5d63[_0x03cd('0x1c')]?_[_0x03cd('0x1d')](_0x4e5d63['include'],function(_0x3ad6f1){return{'model':db[_0x3ad6f1[_0x03cd('0x1e')]],'as':_0x3ad6f1['as'],'attributes':_0x3ad6f1[_0x03cd('0x1a')],'include':_0x3ad6f1[_0x03cd('0x1c')]?_[_0x03cd('0x1d')](_0x3ad6f1[_0x03cd('0x1c')],function(_0x533751){return{'model':db[_0x533751[_0x03cd('0x1e')]],'as':_0x533751['as'],'attributes':_0x533751[_0x03cd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x03cd('0xb')](function(_0x53a7ea){logger[_0x03cd('0xc')](_0x03cd('0x1f'),_0x4e43c2);logger[_0x03cd('0xe')](_0x03cd('0x1f'),_0x4e43c2,JSON[_0x03cd('0x10')](_0x53a7ea));_0x1e2eff(_0x53a7ea);})[_0x03cd('0x15')](function(_0x3396d0){logger['error'](_0x03cd('0x1f'),_0x3396d0[_0x03cd('0x13')],_0x4e43c2);_0x2b9e23(_0x1a3b3e['error'](0x1f4,_0x3396d0[_0x03cd('0x13')]));});});}; \ No newline at end of file +var _0x81b7=['debug','ShowZohoAccount','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ZohoAccount','raw','options','where','limit','include','map','model','attributes','GetZohoAccount'];(function(_0x156489,_0x2bbaf2){var _0x4d2814=function(_0x405381){while(--_0x405381){_0x156489['push'](_0x156489['shift']());}};_0x4d2814(++_0x2bbaf2);}(_0x81b7,0x1f2));var _0x781b=function(_0x1d5e5e,_0x3730d9){_0x1d5e5e=_0x1d5e5e-0x0;var _0x44981a=_0x81b7[_0x1d5e5e];return _0x44981a;};'use strict';var _=require('lodash');var util=require(_0x781b('0x0'));var moment=require(_0x781b('0x1'));var BPromise=require(_0x781b('0x2'));var rs=require(_0x781b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x781b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x781b('0x5'))(_0x781b('0x6'));var config=require(_0x781b('0x7'));var jayson=require(_0x781b('0x8'));var client=jayson['client'][_0x781b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd9d633,_0x482803,_0x4aa451){return new BPromise(function(_0x3de3cd,_0x33c04b){return client[_0x781b('0xa')](_0xd9d633,_0x4aa451)[_0x781b('0xb')](function(_0x5591d9){logger[_0x781b('0xc')](_0x781b('0xd'),_0x482803,'request\x20sent');logger['debug'](_0x781b('0xe'),_0x482803,'request\x20sent',JSON[_0x781b('0xf')](_0x5591d9));if(_0x5591d9['error']){if(_0x5591d9[_0x781b('0x10')]['code']===0x1f4){logger[_0x781b('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x482803,_0x5591d9[_0x781b('0x10')][_0x781b('0x11')]);return _0x33c04b(_0x5591d9[_0x781b('0x10')][_0x781b('0x11')]);}logger[_0x781b('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x482803,_0x5591d9[_0x781b('0x10')][_0x781b('0x11')]);return _0x3de3cd(_0x5591d9[_0x781b('0x10')][_0x781b('0x11')]);}else{logger['info'](_0x781b('0xd'),_0x482803,'request\x20sent');_0x3de3cd(_0x5591d9[_0x781b('0x12')][_0x781b('0x11')]);}})[_0x781b('0x13')](function(_0x4ac48a){logger[_0x781b('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x482803,_0x4ac48a);_0x33c04b(_0x4ac48a);});});}exports['GetZohoAccount']=function(_0x2c62e5){var _0x177e18=this;return new Promise(function(_0x22d0da,_0x20585e){return db[_0x781b('0x14')]['findAll']({'raw':_0x2c62e5['options']?_0x2c62e5['options'][_0x781b('0x15')]===undefined?!![]:![]:!![],'where':_0x2c62e5[_0x781b('0x16')]?_0x2c62e5[_0x781b('0x16')][_0x781b('0x17')]||null:null,'attributes':_0x2c62e5[_0x781b('0x16')]?_0x2c62e5[_0x781b('0x16')]['attributes']||null:null,'limit':_0x2c62e5[_0x781b('0x16')]?_0x2c62e5[_0x781b('0x16')][_0x781b('0x18')]||null:null,'include':_0x2c62e5['options']?_0x2c62e5[_0x781b('0x16')][_0x781b('0x19')]?_[_0x781b('0x1a')](_0x2c62e5[_0x781b('0x16')]['include'],function(_0x28dcfc){return{'model':db[_0x28dcfc[_0x781b('0x1b')]],'as':_0x28dcfc['as'],'attributes':_0x28dcfc[_0x781b('0x1c')],'include':_0x28dcfc[_0x781b('0x19')]?_[_0x781b('0x1a')](_0x28dcfc['include'],function(_0x226d68){return{'model':db[_0x226d68[_0x781b('0x1b')]],'as':_0x226d68['as'],'attributes':_0x226d68[_0x781b('0x1c')],'include':_0x226d68[_0x781b('0x19')]?_[_0x781b('0x1a')](_0x226d68[_0x781b('0x19')],function(_0x48624d){return{'model':db[_0x48624d['model']],'as':_0x48624d['as'],'attributes':_0x48624d[_0x781b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x781b('0xb')](function(_0x560449){logger[_0x781b('0xc')](_0x781b('0x1d'),_0x2c62e5);logger[_0x781b('0x1e')](_0x781b('0x1d'),_0x2c62e5,JSON[_0x781b('0xf')](_0x560449));_0x22d0da(_0x560449);})[_0x781b('0x13')](function(_0x1957c4){logger[_0x781b('0x10')](_0x781b('0x1d'),_0x1957c4[_0x781b('0x11')],_0x2c62e5);_0x20585e(_0x177e18[_0x781b('0x10')](0x1f4,_0x1957c4['message']));});});};exports[_0x781b('0x1f')]=function(_0x286a73){var _0x588f91=this;return new Promise(function(_0x536be8,_0xdfe3d4){return db[_0x781b('0x14')][_0x781b('0x20')]({'raw':_0x286a73[_0x781b('0x16')]?_0x286a73[_0x781b('0x16')][_0x781b('0x15')]===undefined?!![]:![]:!![],'where':_0x286a73[_0x781b('0x16')]?_0x286a73[_0x781b('0x16')]['where']||null:null,'attributes':_0x286a73[_0x781b('0x16')]?_0x286a73['options'][_0x781b('0x1c')]||null:null,'include':_0x286a73['options']?_0x286a73[_0x781b('0x16')][_0x781b('0x19')]?_['map'](_0x286a73[_0x781b('0x16')][_0x781b('0x19')],function(_0x1f6838){return{'model':db[_0x1f6838[_0x781b('0x1b')]],'as':_0x1f6838['as'],'attributes':_0x1f6838[_0x781b('0x1c')],'include':_0x1f6838[_0x781b('0x19')]?_['map'](_0x1f6838[_0x781b('0x19')],function(_0x4b62b3){return{'model':db[_0x4b62b3[_0x781b('0x1b')]],'as':_0x4b62b3['as'],'attributes':_0x4b62b3[_0x781b('0x1c')],'include':_0x4b62b3[_0x781b('0x19')]?_[_0x781b('0x1a')](_0x4b62b3[_0x781b('0x19')],function(_0x1ad7d2){return{'model':db[_0x1ad7d2[_0x781b('0x1b')]],'as':_0x1ad7d2['as'],'attributes':_0x1ad7d2[_0x781b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x781b('0xb')](function(_0x23dad5){logger['info'](_0x781b('0x1f'),_0x286a73);logger[_0x781b('0x1e')](_0x781b('0x1f'),_0x286a73,JSON['stringify'](_0x23dad5));_0x536be8(_0x23dad5);})[_0x781b('0x13')](function(_0x521dc2){logger['error'](_0x781b('0x1f'),_0x521dc2[_0x781b('0x11')],_0x286a73);_0xdfe3d4(_0x588f91[_0x781b('0x10')](0x1f4,_0x521dc2['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 06844bc..11ae155 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 _0x3d14=['show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2d73da,_0x4e9643){var _0x2d06af=function(_0x2f5810){while(--_0x2f5810){_0x2d73da['push'](_0x2d73da['shift']());}};_0x2d06af(++_0x4e9643);}(_0x3d14,0x109));var _0x43d1=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x3d14[_0x3ce2c4];return _0x4047c1;};'use strict';var multer=require(_0x43d1('0x0'));var util=require(_0x43d1('0x1'));var path=require(_0x43d1('0x2'));var timeout=require(_0x43d1('0x3'));var express=require(_0x43d1('0x4'));var router=express[_0x43d1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x43d1('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x43d1('0x7')]('/',auth[_0x43d1('0x8')](),controller[_0x43d1('0x9')]);router[_0x43d1('0x7')](_0x43d1('0xa'),auth['isAuthenticated'](),controller[_0x43d1('0xb')]);router[_0x43d1('0x7')]('/:id/fields',auth[_0x43d1('0x8')](),controller[_0x43d1('0xc')]);router['get'](_0x43d1('0xd'),auth[_0x43d1('0x8')](),controller[_0x43d1('0xe')]);router[_0x43d1('0x7')]('/:id/descriptions',auth[_0x43d1('0x8')](),controller[_0x43d1('0xf')]);router[_0x43d1('0x10')]('/',auth[_0x43d1('0x8')](),controller[_0x43d1('0x11')]);router[_0x43d1('0x12')](_0x43d1('0xa'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x13')]);router[_0x43d1('0x14')](_0x43d1('0xa'),auth[_0x43d1('0x8')](),controller[_0x43d1('0x15')]);module[_0x43d1('0x16')]=router; \ No newline at end of file +var _0xfaee=['../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id/fields','/:id/subjects','/:id/descriptions','create','put','/:id','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2d4019,_0x346026){var _0x186e5e=function(_0x2b9b8b){while(--_0x2b9b8b){_0x2d4019['push'](_0x2d4019['shift']());}};_0x186e5e(++_0x346026);}(_0xfaee,0x6d));var _0xefae=function(_0x147656,_0x205a15){_0x147656=_0x147656-0x0;var _0x37e1e9=_0xfaee[_0x147656];return _0x37e1e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xefae('0x0'));var timeout=require('connect-timeout');var express=require(_0xefae('0x1'));var router=express[_0xefae('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xefae('0x3'));var interaction=require(_0xefae('0x4'));var config=require(_0xefae('0x5'));var controller=require(_0xefae('0x6'));router['get']('/',auth[_0xefae('0x7')](),controller[_0xefae('0x8')]);router[_0xefae('0x9')]('/:id',auth[_0xefae('0x7')](),controller['show']);router[_0xefae('0x9')](_0xefae('0xa'),auth[_0xefae('0x7')](),controller['getFields']);router['get'](_0xefae('0xb'),auth[_0xefae('0x7')](),controller['getSubjects']);router[_0xefae('0x9')](_0xefae('0xc'),auth[_0xefae('0x7')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xefae('0xd')]);router[_0xefae('0xe')](_0xefae('0xf'),auth[_0xefae('0x7')](),controller['update']);router[_0xefae('0x10')]('/:id',auth[_0xefae('0x7')](),controller[_0xefae('0x11')]);module[_0xefae('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 3067fd7..d881b6c 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 _0x5080=['exports','ENUM','contact','nothing','lead','contact_lead'];(function(_0x16803d,_0x168f18){var _0x4b4e29=function(_0xdced2b){while(--_0xdced2b){_0x16803d['push'](_0x16803d['shift']());}};_0x4b4e29(++_0x168f18);}(_0x5080,0x66));var _0x0508=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5080[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x0508('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x0508('0x1')]('lead',_0x0508('0x2'),_0x0508('0x3')),'defaultValue':_0x0508('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x0508('0x5'),'contact','lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfecb=['lead','nothing','contact_lead','contact','sequelize','exports','STRING','ENUM'];(function(_0x4cb0d6,_0x5ed0a7){var _0x364d0b=function(_0x38a9df){while(--_0x38a9df){_0x4cb0d6['push'](_0x4cb0d6['shift']());}};_0x364d0b(++_0x5ed0a7);}(_0xfecb,0x1dc));var _0xbfec=function(_0x5b5222,_0x28d298){_0x5b5222=_0x5b5222-0x0;var _0x4eb0d8=_0xfecb[_0x5b5222];return _0x4eb0d8;};'use strict';var Sequelize=require(_0xbfec('0x0'));module[_0xbfec('0x1')]={'name':{'type':Sequelize[_0xbfec('0x2')]},'moduleCreate':{'type':Sequelize[_0xbfec('0x3')](_0xbfec('0x4'),'contact',_0xbfec('0x5')),'defaultValue':_0xbfec('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xbfec('0x6'),_0xbfec('0x7'),_0xbfec('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 63f0e84..3c719ea 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 _0x3c54=['filter','getSubjects','getDescriptions','pick','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','options','includeAll','rows','show','params','include','catch','create','body','find','getFields','findOne','ZohoField'];(function(_0x4aea61,_0xde25cf){var _0x208024=function(_0x5694a7){while(--_0x5694a7){_0x4aea61['push'](_0x4aea61['shift']());}};_0x208024(++_0xde25cf);}(_0x3c54,0x1a3));var _0x43c5=function(_0x1e8f59,_0x23339f){_0x1e8f59=_0x1e8f59-0x0;var _0x382f35=_0x3c54[_0x1e8f59];return _0x382f35;};'use strict';var emlformat=require(_0x43c5('0x0'));var rimraf=require(_0x43c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x43c5('0x2'));var BPromise=require(_0x43c5('0x3'));var Mustache=require(_0x43c5('0x4'));var util=require('util');var path=require(_0x43c5('0x5'));var sox=require(_0x43c5('0x6'));var csv=require(_0x43c5('0x7'));var ejs=require(_0x43c5('0x8'));var fs=require('fs');var fs_extra=require(_0x43c5('0x9'));var _=require(_0x43c5('0xa'));var squel=require(_0x43c5('0xb'));var crypto=require(_0x43c5('0xc'));var jsforce=require(_0x43c5('0xd'));var deskjs=require(_0x43c5('0xe'));var toCsv=require(_0x43c5('0x7'));var querystring=require(_0x43c5('0xf'));var Papa=require(_0x43c5('0x10'));var Redis=require(_0x43c5('0x11'));var authService=require(_0x43c5('0x12'));var qs=require(_0x43c5('0x13'));var as=require(_0x43c5('0x14'));var hardwareService=require(_0x43c5('0x15'));var logger=require(_0x43c5('0x16'))(_0x43c5('0x17'));var utils=require(_0x43c5('0x18'));var config=require(_0x43c5('0x19'));var licenseUtil=require(_0x43c5('0x1a'));var db=require(_0x43c5('0x1b'))['db'];function respondWithStatusCode(_0x1661a9,_0x2efd2a){_0x2efd2a=_0x2efd2a||0xcc;return function(_0x5b1e26){if(_0x5b1e26){return _0x1661a9[_0x43c5('0x1c')](_0x2efd2a);}return _0x1661a9['status'](_0x2efd2a)[_0x43c5('0x1d')]();};}function respondWithResult(_0x32a8d7,_0x50b465){_0x50b465=_0x50b465||0xc8;return function(_0x3c4916){if(_0x3c4916){return _0x32a8d7[_0x43c5('0x1e')](_0x50b465)[_0x43c5('0x1f')](_0x3c4916);}};}function respondWithFilteredResult(_0x427118,_0xaf0f63){return function(_0x3fc141){if(_0x3fc141){var _0x5d7565=typeof _0xaf0f63['offset']===_0x43c5('0x20')&&typeof _0xaf0f63[_0x43c5('0x21')]===_0x43c5('0x20');var _0x2dfd67=_0x3fc141[_0x43c5('0x22')];var _0x9a1b3e=_0x5d7565?0x0:_0xaf0f63[_0x43c5('0x23')];var _0x1796e5=_0x5d7565?_0x3fc141[_0x43c5('0x22')]:_0xaf0f63[_0x43c5('0x23')]+_0xaf0f63['limit'];var _0x4f3c32;if(_0x1796e5>=_0x2dfd67){_0x1796e5=_0x2dfd67;_0x4f3c32=0xc8;}else{_0x4f3c32=0xce;}_0x427118[_0x43c5('0x1e')](_0x4f3c32);return _0x427118['set'](_0x43c5('0x24'),_0x9a1b3e+'-'+_0x1796e5+'/'+_0x2dfd67)['json'](_0x3fc141);}return null;};}function patchUpdates(_0x5bdbea){return function(_0x554403){try{jsonpatch[_0x43c5('0x25')](_0x554403,_0x5bdbea,!![]);}catch(_0xd9d5d4){return BPromise[_0x43c5('0x26')](_0xd9d5d4);}return _0x554403[_0x43c5('0x27')]();};}function saveUpdates(_0x487a1a,_0x45c872){return function(_0x3cd4a5){if(_0x3cd4a5){return _0x3cd4a5[_0x43c5('0x28')](_0x487a1a)[_0x43c5('0x29')](function(_0x2870c7){return _0x2870c7;});}return null;};}function removeEntity(_0x40c3f8,_0x32a8e6){return function(_0x5e7dd7){if(_0x5e7dd7){return _0x5e7dd7[_0x43c5('0x2a')]()['then'](function(){_0x40c3f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x552437,_0x3d1527){return function(_0x44c3fe){if(!_0x44c3fe){_0x552437['sendStatus'](0x194);}return _0x44c3fe;};}function handleError(_0x2a509c,_0x246bda){_0x246bda=_0x246bda||0x1f4;return function(_0x1aee47){logger[_0x43c5('0x2b')](_0x1aee47[_0x43c5('0x2c')]);if(_0x1aee47[_0x43c5('0x2d')]){delete _0x1aee47[_0x43c5('0x2d')];}_0x2a509c[_0x43c5('0x1e')](_0x246bda)[_0x43c5('0x2e')](_0x1aee47);};}exports['index']=function(_0x25574e,_0x5d1330){var _0x1cf6bb={},_0x5e3dac={},_0x8af5de={'count':0x0,'rows':[]};var _0x2426d2=_[_0x43c5('0x2f')](db[_0x43c5('0x30')][_0x43c5('0x31')],function(_0x306548){return{'name':_0x306548[_0x43c5('0x32')],'type':_0x306548[_0x43c5('0x33')]['key']};});_0x5e3dac[_0x43c5('0x34')]=_[_0x43c5('0x2f')](_0x2426d2,_0x43c5('0x2d'));_0x5e3dac['query']=_[_0x43c5('0x35')](_0x25574e[_0x43c5('0x36')]);_0x5e3dac['filters']=_['intersection'](_0x5e3dac[_0x43c5('0x34')],_0x5e3dac['query']);_0x1cf6bb[_0x43c5('0x37')]=_[_0x43c5('0x38')](_0x5e3dac['model'],qs[_0x43c5('0x39')](_0x25574e[_0x43c5('0x36')][_0x43c5('0x39')]));_0x1cf6bb[_0x43c5('0x37')]=_0x1cf6bb[_0x43c5('0x37')][_0x43c5('0x3a')]?_0x1cf6bb[_0x43c5('0x37')]:_0x5e3dac[_0x43c5('0x34')];if(!_0x25574e[_0x43c5('0x36')][_0x43c5('0x3b')](_0x43c5('0x3c'))){_0x1cf6bb['limit']=qs['limit'](_0x25574e[_0x43c5('0x36')][_0x43c5('0x21')]);_0x1cf6bb[_0x43c5('0x23')]=qs['offset'](_0x25574e[_0x43c5('0x36')][_0x43c5('0x23')]);}_0x1cf6bb[_0x43c5('0x3d')]=qs[_0x43c5('0x3e')](_0x25574e[_0x43c5('0x36')][_0x43c5('0x3e')]);_0x1cf6bb['where']=qs['filters'](_['pick'](_0x25574e[_0x43c5('0x36')],_0x5e3dac[_0x43c5('0x3f')]),_0x2426d2);if(_0x25574e[_0x43c5('0x36')]['filter']){_0x1cf6bb[_0x43c5('0x40')]=_[_0x43c5('0x41')](_0x1cf6bb['where'],{'$or':_[_0x43c5('0x2f')](_0x2426d2,function(_0x195107){if(_0x195107[_0x43c5('0x33')]!=='VIRTUAL'){var _0x4ea7a7={};_0x4ea7a7[_0x195107[_0x43c5('0x2d')]]={'$like':'%'+_0x25574e[_0x43c5('0x36')]['filter']+'%'};return _0x4ea7a7;}})});}_0x1cf6bb=_[_0x43c5('0x41')]({},_0x1cf6bb,_0x25574e[_0x43c5('0x42')]);var _0x6120d2={'where':_0x1cf6bb[_0x43c5('0x40')]};return db[_0x43c5('0x30')][_0x43c5('0x22')](_0x6120d2)[_0x43c5('0x29')](function(_0x489e66){_0x8af5de[_0x43c5('0x22')]=_0x489e66;if(_0x25574e[_0x43c5('0x36')][_0x43c5('0x43')]){_0x1cf6bb['include']=[{'all':!![]}];}return db[_0x43c5('0x30')]['findAll'](_0x1cf6bb);})[_0x43c5('0x29')](function(_0x419b19){_0x8af5de[_0x43c5('0x44')]=_0x419b19;return _0x8af5de;})['then'](respondWithFilteredResult(_0x5d1330,_0x1cf6bb))['catch'](handleError(_0x5d1330,null));};exports[_0x43c5('0x45')]=function(_0x3864dd,_0x4b5927){var _0x3ed31f={'raw':![],'where':{'id':_0x3864dd[_0x43c5('0x46')]['id']}},_0x446462={};_0x446462['model']=_[_0x43c5('0x35')](db['ZohoConfiguration'][_0x43c5('0x31')]);_0x446462[_0x43c5('0x36')]=_[_0x43c5('0x35')](_0x3864dd[_0x43c5('0x36')]);_0x446462[_0x43c5('0x3f')]=_[_0x43c5('0x38')](_0x446462[_0x43c5('0x34')],_0x446462['query']);_0x3ed31f[_0x43c5('0x37')]=_[_0x43c5('0x38')](_0x446462[_0x43c5('0x34')],qs[_0x43c5('0x39')](_0x3864dd[_0x43c5('0x36')][_0x43c5('0x39')]));_0x3ed31f[_0x43c5('0x37')]=_0x3ed31f['attributes'][_0x43c5('0x3a')]?_0x3ed31f[_0x43c5('0x37')]:_0x446462[_0x43c5('0x34')];if(_0x3864dd['query'][_0x43c5('0x43')]){_0x3ed31f[_0x43c5('0x47')]=[{'all':!![]}];}_0x3ed31f=_[_0x43c5('0x41')]({},_0x3ed31f,_0x3864dd[_0x43c5('0x42')]);return db[_0x43c5('0x30')]['find'](_0x3ed31f)[_0x43c5('0x29')](handleEntityNotFound(_0x4b5927,null))[_0x43c5('0x29')](respondWithResult(_0x4b5927,null))[_0x43c5('0x48')](handleError(_0x4b5927,null));};exports[_0x43c5('0x49')]=function(_0x17530a,_0x19068b){return db[_0x43c5('0x30')]['create'](_0x17530a[_0x43c5('0x4a')],{})[_0x43c5('0x29')](respondWithResult(_0x19068b,0xc9))['catch'](handleError(_0x19068b,null));};exports[_0x43c5('0x28')]=function(_0x51704f,_0x3a51d0){if(_0x51704f[_0x43c5('0x4a')]['id']){delete _0x51704f[_0x43c5('0x4a')]['id'];}return db[_0x43c5('0x30')][_0x43c5('0x4b')]({'where':{'id':_0x51704f[_0x43c5('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a51d0,null))[_0x43c5('0x29')](saveUpdates(_0x51704f[_0x43c5('0x4a')],null))[_0x43c5('0x29')](respondWithResult(_0x3a51d0,null))[_0x43c5('0x48')](handleError(_0x3a51d0,null));};exports[_0x43c5('0x2a')]=function(_0x4131fe,_0x2fbd81){return db[_0x43c5('0x30')][_0x43c5('0x4b')]({'where':{'id':_0x4131fe[_0x43c5('0x46')]['id']}})[_0x43c5('0x29')](handleEntityNotFound(_0x2fbd81,null))[_0x43c5('0x29')](removeEntity(_0x2fbd81,null))[_0x43c5('0x48')](handleError(_0x2fbd81,null));};exports[_0x43c5('0x4c')]=function(_0x2a1810,_0xe5a975,_0x44c303){var _0x337a41={};var _0xa2d6c0={};var _0x72129d;var _0x174662;return db[_0x43c5('0x30')][_0x43c5('0x4d')]({'where':{'id':_0x2a1810[_0x43c5('0x46')]['id']}})[_0x43c5('0x29')](handleEntityNotFound(_0xe5a975,null))[_0x43c5('0x29')](function(_0x1cdf7e){if(_0x1cdf7e){_0x72129d=_0x1cdf7e;_0xa2d6c0[_0x43c5('0x34')]=_[_0x43c5('0x35')](db[_0x43c5('0x4e')][_0x43c5('0x31')]);_0xa2d6c0[_0x43c5('0x36')]=_[_0x43c5('0x35')](_0x2a1810['query']);_0xa2d6c0[_0x43c5('0x3f')]=_[_0x43c5('0x38')](_0xa2d6c0['model'],_0xa2d6c0[_0x43c5('0x36')]);_0x337a41[_0x43c5('0x37')]=_[_0x43c5('0x38')](_0xa2d6c0[_0x43c5('0x34')],qs['fields'](_0x2a1810[_0x43c5('0x36')][_0x43c5('0x39')]));_0x337a41[_0x43c5('0x37')]=_0x337a41[_0x43c5('0x37')][_0x43c5('0x3a')]?_0x337a41[_0x43c5('0x37')]:_0xa2d6c0[_0x43c5('0x34')];_0x337a41[_0x43c5('0x3d')]=qs[_0x43c5('0x3e')](_0x2a1810[_0x43c5('0x36')]['sort']);_0x337a41[_0x43c5('0x40')]=qs[_0x43c5('0x3f')](_['pick'](_0x2a1810[_0x43c5('0x36')],_0xa2d6c0[_0x43c5('0x3f')]));if(_0x2a1810[_0x43c5('0x36')][_0x43c5('0x4f')]){_0x337a41[_0x43c5('0x40')]=_[_0x43c5('0x41')](_0x337a41[_0x43c5('0x40')],{'$or':_[_0x43c5('0x2f')](_0x337a41[_0x43c5('0x37')],function(_0x26b583){var _0x502714={};_0x502714[_0x26b583]={'$like':'%'+_0x2a1810[_0x43c5('0x36')][_0x43c5('0x4f')]+'%'};return _0x502714;})});}_0x337a41=_[_0x43c5('0x41')]({},_0x337a41,_0x2a1810[_0x43c5('0x42')]);return _0x72129d['getFields'](_0x337a41);}})[_0x43c5('0x29')](function(_0x16a8bd){if(_0x16a8bd){_0x174662=_0x16a8bd[_0x43c5('0x3a')];if(!_0x2a1810[_0x43c5('0x36')][_0x43c5('0x3b')](_0x43c5('0x3c'))){_0x337a41[_0x43c5('0x21')]=qs[_0x43c5('0x21')](_0x2a1810[_0x43c5('0x36')][_0x43c5('0x21')]);_0x337a41[_0x43c5('0x23')]=qs['offset'](_0x2a1810[_0x43c5('0x36')]['offset']);}return _0x72129d[_0x43c5('0x4c')](_0x337a41);}})[_0x43c5('0x29')](function(_0x451e99){if(_0x451e99){return _0x451e99?{'count':_0x174662,'rows':_0x451e99}:null;}})[_0x43c5('0x29')](respondWithResult(_0xe5a975,null))[_0x43c5('0x48')](handleError(_0xe5a975,null));};exports[_0x43c5('0x50')]=function(_0x1126be,_0x505eb3,_0x1a7d4a){var _0x36eb3e={};var _0x38c083={};var _0x1bfcd7;var _0x31d258;return db[_0x43c5('0x30')]['findOne']({'where':{'id':_0x1126be[_0x43c5('0x46')]['id']}})[_0x43c5('0x29')](handleEntityNotFound(_0x505eb3,null))[_0x43c5('0x29')](function(_0x41569c){if(_0x41569c){_0x1bfcd7=_0x41569c;_0x38c083[_0x43c5('0x34')]=_[_0x43c5('0x35')](db[_0x43c5('0x4e')][_0x43c5('0x31')]);_0x38c083[_0x43c5('0x36')]=_[_0x43c5('0x35')](_0x1126be['query']);_0x38c083[_0x43c5('0x3f')]=_[_0x43c5('0x38')](_0x38c083[_0x43c5('0x34')],_0x38c083[_0x43c5('0x36')]);_0x36eb3e[_0x43c5('0x37')]=_['intersection'](_0x38c083[_0x43c5('0x34')],qs[_0x43c5('0x39')](_0x1126be[_0x43c5('0x36')]['fields']));_0x36eb3e[_0x43c5('0x37')]=_0x36eb3e['attributes'][_0x43c5('0x3a')]?_0x36eb3e[_0x43c5('0x37')]:_0x38c083[_0x43c5('0x34')];_0x36eb3e[_0x43c5('0x3d')]=qs['sort'](_0x1126be['query']['sort']);_0x36eb3e[_0x43c5('0x40')]=qs[_0x43c5('0x3f')](_['pick'](_0x1126be[_0x43c5('0x36')],_0x38c083[_0x43c5('0x3f')]));if(_0x1126be[_0x43c5('0x36')][_0x43c5('0x4f')]){_0x36eb3e[_0x43c5('0x40')]=_[_0x43c5('0x41')](_0x36eb3e[_0x43c5('0x40')],{'$or':_[_0x43c5('0x2f')](_0x36eb3e['attributes'],function(_0x2a7f37){var _0x527bfb={};_0x527bfb[_0x2a7f37]={'$like':'%'+_0x1126be[_0x43c5('0x36')][_0x43c5('0x4f')]+'%'};return _0x527bfb;})});}_0x36eb3e=_['merge']({},_0x36eb3e,_0x1126be[_0x43c5('0x42')]);return _0x1bfcd7[_0x43c5('0x50')](_0x36eb3e);}})[_0x43c5('0x29')](function(_0x2eb679){if(_0x2eb679){_0x31d258=_0x2eb679['length'];if(!_0x1126be[_0x43c5('0x36')]['hasOwnProperty'](_0x43c5('0x3c'))){_0x36eb3e[_0x43c5('0x21')]=qs['limit'](_0x1126be[_0x43c5('0x36')][_0x43c5('0x21')]);_0x36eb3e[_0x43c5('0x23')]=qs[_0x43c5('0x23')](_0x1126be[_0x43c5('0x36')][_0x43c5('0x23')]);}return _0x1bfcd7[_0x43c5('0x50')](_0x36eb3e);}})[_0x43c5('0x29')](function(_0x549b6a){if(_0x549b6a){return _0x549b6a?{'count':_0x31d258,'rows':_0x549b6a}:null;}})[_0x43c5('0x29')](respondWithResult(_0x505eb3,null))[_0x43c5('0x48')](handleError(_0x505eb3,null));};exports[_0x43c5('0x51')]=function(_0x3c7f72,_0x6d13dc,_0x3f3e74){var _0x246e52={};var _0x48c363={};var _0x85052f;var _0x3571c6;return db[_0x43c5('0x30')][_0x43c5('0x4d')]({'where':{'id':_0x3c7f72[_0x43c5('0x46')]['id']}})[_0x43c5('0x29')](handleEntityNotFound(_0x6d13dc,null))[_0x43c5('0x29')](function(_0x37c0d8){if(_0x37c0d8){_0x85052f=_0x37c0d8;_0x48c363['model']=_[_0x43c5('0x35')](db[_0x43c5('0x4e')][_0x43c5('0x31')]);_0x48c363[_0x43c5('0x36')]=_['keys'](_0x3c7f72[_0x43c5('0x36')]);_0x48c363[_0x43c5('0x3f')]=_[_0x43c5('0x38')](_0x48c363['model'],_0x48c363[_0x43c5('0x36')]);_0x246e52[_0x43c5('0x37')]=_[_0x43c5('0x38')](_0x48c363['model'],qs['fields'](_0x3c7f72[_0x43c5('0x36')][_0x43c5('0x39')]));_0x246e52[_0x43c5('0x37')]=_0x246e52[_0x43c5('0x37')][_0x43c5('0x3a')]?_0x246e52[_0x43c5('0x37')]:_0x48c363[_0x43c5('0x34')];_0x246e52['order']=qs[_0x43c5('0x3e')](_0x3c7f72[_0x43c5('0x36')][_0x43c5('0x3e')]);_0x246e52['where']=qs[_0x43c5('0x3f')](_[_0x43c5('0x52')](_0x3c7f72[_0x43c5('0x36')],_0x48c363[_0x43c5('0x3f')]));if(_0x3c7f72[_0x43c5('0x36')]['filter']){_0x246e52[_0x43c5('0x40')]=_['merge'](_0x246e52[_0x43c5('0x40')],{'$or':_[_0x43c5('0x2f')](_0x246e52['attributes'],function(_0x2b9cc2){var _0x27b8ad={};_0x27b8ad[_0x2b9cc2]={'$like':'%'+_0x3c7f72[_0x43c5('0x36')][_0x43c5('0x4f')]+'%'};return _0x27b8ad;})});}_0x246e52=_[_0x43c5('0x41')]({},_0x246e52,_0x3c7f72[_0x43c5('0x42')]);return _0x85052f[_0x43c5('0x51')](_0x246e52);}})[_0x43c5('0x29')](function(_0x2440eb){if(_0x2440eb){_0x3571c6=_0x2440eb[_0x43c5('0x3a')];if(!_0x3c7f72[_0x43c5('0x36')][_0x43c5('0x3b')](_0x43c5('0x3c'))){_0x246e52[_0x43c5('0x21')]=qs['limit'](_0x3c7f72[_0x43c5('0x36')][_0x43c5('0x21')]);_0x246e52[_0x43c5('0x23')]=qs[_0x43c5('0x23')](_0x3c7f72['query'][_0x43c5('0x23')]);}return _0x85052f[_0x43c5('0x51')](_0x246e52);}})[_0x43c5('0x29')](function(_0x241b5f){if(_0x241b5f){return _0x241b5f?{'count':_0x3571c6,'rows':_0x241b5f}:null;}})[_0x43c5('0x29')](respondWithResult(_0x6d13dc,null))['catch'](handleError(_0x6d13dc,null));}; \ No newline at end of file +var _0x5fb3=['query','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','fields','includeAll','find','catch','create','body','findOne','ZohoField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','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','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','keys','intersection','model'];(function(_0x198eb0,_0x49c509){var _0x9598cb=function(_0x41571a){while(--_0x41571a){_0x198eb0['push'](_0x198eb0['shift']());}};_0x9598cb(++_0x49c509);}(_0x5fb3,0xbf));var _0x35fb=function(_0x32c227,_0x2d7383){_0x32c227=_0x32c227-0x0;var _0x2fb856=_0x5fb3[_0x32c227];return _0x2fb856;};'use strict';var emlformat=require(_0x35fb('0x0'));var rimraf=require(_0x35fb('0x1'));var zipdir=require(_0x35fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x35fb('0x3'));var BPromise=require(_0x35fb('0x4'));var Mustache=require(_0x35fb('0x5'));var util=require(_0x35fb('0x6'));var path=require(_0x35fb('0x7'));var sox=require(_0x35fb('0x8'));var csv=require(_0x35fb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fb('0xa'));var squel=require(_0x35fb('0xb'));var crypto=require(_0x35fb('0xc'));var jsforce=require(_0x35fb('0xd'));var deskjs=require(_0x35fb('0xe'));var toCsv=require(_0x35fb('0x9'));var querystring=require(_0x35fb('0xf'));var Papa=require(_0x35fb('0x10'));var Redis=require(_0x35fb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35fb('0x13'));var logger=require('../../config/logger')(_0x35fb('0x14'));var utils=require(_0x35fb('0x15'));var config=require(_0x35fb('0x16'));var licenseUtil=require(_0x35fb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b88da,_0x38e2c6){_0x38e2c6=_0x38e2c6||0xcc;return function(_0x223f93){if(_0x223f93){return _0x4b88da[_0x35fb('0x18')](_0x38e2c6);}return _0x4b88da['status'](_0x38e2c6)[_0x35fb('0x19')]();};}function respondWithResult(_0x2a6c51,_0x49ddaf){_0x49ddaf=_0x49ddaf||0xc8;return function(_0x2b10f3){if(_0x2b10f3){return _0x2a6c51[_0x35fb('0x1a')](_0x49ddaf)[_0x35fb('0x1b')](_0x2b10f3);}};}function respondWithFilteredResult(_0x2490fe,_0x32bba2){return function(_0x5a9d78){if(_0x5a9d78){var _0x1e6999=typeof _0x32bba2[_0x35fb('0x1c')]===_0x35fb('0x1d')&&typeof _0x32bba2[_0x35fb('0x1e')]===_0x35fb('0x1d');var _0x1f9d03=_0x5a9d78[_0x35fb('0x1f')];var _0x338602=_0x1e6999?0x0:_0x32bba2[_0x35fb('0x1c')];var _0x3848a6=_0x1e6999?_0x5a9d78['count']:_0x32bba2['offset']+_0x32bba2['limit'];var _0x101b93;if(_0x3848a6>=_0x1f9d03){_0x3848a6=_0x1f9d03;_0x101b93=0xc8;}else{_0x101b93=0xce;}_0x2490fe['status'](_0x101b93);return _0x2490fe['set'](_0x35fb('0x20'),_0x338602+'-'+_0x3848a6+'/'+_0x1f9d03)[_0x35fb('0x1b')](_0x5a9d78);}return null;};}function patchUpdates(_0x33dca3){return function(_0x2270bc){try{jsonpatch[_0x35fb('0x21')](_0x2270bc,_0x33dca3,!![]);}catch(_0x376e28){return BPromise[_0x35fb('0x22')](_0x376e28);}return _0x2270bc[_0x35fb('0x23')]();};}function saveUpdates(_0x2b167e,_0x2e7e68){return function(_0x4090ad){if(_0x4090ad){return _0x4090ad[_0x35fb('0x24')](_0x2b167e)[_0x35fb('0x25')](function(_0x553fdd){return _0x553fdd;});}return null;};}function removeEntity(_0x26078b,_0x40b309){return function(_0x59e67d){if(_0x59e67d){return _0x59e67d[_0x35fb('0x26')]()[_0x35fb('0x25')](function(){_0x26078b['status'](0xcc)[_0x35fb('0x19')]();});}};}function handleEntityNotFound(_0x4fe8c4,_0x52afb2){return function(_0x4b0bb7){if(!_0x4b0bb7){_0x4fe8c4[_0x35fb('0x18')](0x194);}return _0x4b0bb7;};}function handleError(_0x5f4fdc,_0x3b9684){_0x3b9684=_0x3b9684||0x1f4;return function(_0x5c67b5){logger[_0x35fb('0x27')](_0x5c67b5[_0x35fb('0x28')]);if(_0x5c67b5[_0x35fb('0x29')]){delete _0x5c67b5[_0x35fb('0x29')];}_0x5f4fdc['status'](_0x3b9684)[_0x35fb('0x2a')](_0x5c67b5);};}exports[_0x35fb('0x2b')]=function(_0x1cea44,_0x301207){var _0x416590={},_0x412c53={},_0x5ba459={'count':0x0,'rows':[]};var _0x5a8aba=_[_0x35fb('0x2c')](db[_0x35fb('0x2d')][_0x35fb('0x2e')],function(_0x10807a){return{'name':_0x10807a[_0x35fb('0x2f')],'type':_0x10807a[_0x35fb('0x30')]['key']};});_0x412c53['model']=_['map'](_0x5a8aba,'name');_0x412c53['query']=_[_0x35fb('0x31')](_0x1cea44['query']);_0x412c53['filters']=_[_0x35fb('0x32')](_0x412c53[_0x35fb('0x33')],_0x412c53['query']);_0x416590['attributes']=_['intersection'](_0x412c53[_0x35fb('0x33')],qs['fields'](_0x1cea44[_0x35fb('0x34')]['fields']));_0x416590[_0x35fb('0x35')]=_0x416590['attributes'][_0x35fb('0x36')]?_0x416590[_0x35fb('0x35')]:_0x412c53[_0x35fb('0x33')];if(!_0x1cea44[_0x35fb('0x34')][_0x35fb('0x37')]('nolimit')){_0x416590[_0x35fb('0x1e')]=qs['limit'](_0x1cea44['query'][_0x35fb('0x1e')]);_0x416590[_0x35fb('0x1c')]=qs[_0x35fb('0x1c')](_0x1cea44[_0x35fb('0x34')][_0x35fb('0x1c')]);}_0x416590[_0x35fb('0x38')]=qs[_0x35fb('0x39')](_0x1cea44[_0x35fb('0x34')][_0x35fb('0x39')]);_0x416590[_0x35fb('0x3a')]=qs[_0x35fb('0x3b')](_[_0x35fb('0x3c')](_0x1cea44[_0x35fb('0x34')],_0x412c53['filters']),_0x5a8aba);if(_0x1cea44[_0x35fb('0x34')][_0x35fb('0x3d')]){_0x416590['where']=_[_0x35fb('0x3e')](_0x416590[_0x35fb('0x3a')],{'$or':_[_0x35fb('0x2c')](_0x5a8aba,function(_0x5a2978){if(_0x5a2978['type']!==_0x35fb('0x3f')){var _0x5a3df1={};_0x5a3df1[_0x5a2978[_0x35fb('0x29')]]={'$like':'%'+_0x1cea44['query'][_0x35fb('0x3d')]+'%'};return _0x5a3df1;}})});}_0x416590=_['merge']({},_0x416590,_0x1cea44[_0x35fb('0x40')]);var _0x2c3586={'where':_0x416590[_0x35fb('0x3a')]};return db[_0x35fb('0x2d')]['count'](_0x2c3586)[_0x35fb('0x25')](function(_0x4c8abd){_0x5ba459[_0x35fb('0x1f')]=_0x4c8abd;if(_0x1cea44[_0x35fb('0x34')]['includeAll']){_0x416590['include']=[{'all':!![]}];}return db[_0x35fb('0x2d')][_0x35fb('0x41')](_0x416590);})[_0x35fb('0x25')](function(_0x427725){_0x5ba459[_0x35fb('0x42')]=_0x427725;return _0x5ba459;})[_0x35fb('0x25')](respondWithFilteredResult(_0x301207,_0x416590))['catch'](handleError(_0x301207,null));};exports[_0x35fb('0x43')]=function(_0x2d4b0f,_0x52c1c5){var _0x34d0fa={'raw':![],'where':{'id':_0x2d4b0f[_0x35fb('0x44')]['id']}},_0x5d55fc={};_0x5d55fc[_0x35fb('0x33')]=_[_0x35fb('0x31')](db[_0x35fb('0x2d')][_0x35fb('0x2e')]);_0x5d55fc['query']=_[_0x35fb('0x31')](_0x2d4b0f[_0x35fb('0x34')]);_0x5d55fc['filters']=_[_0x35fb('0x32')](_0x5d55fc['model'],_0x5d55fc['query']);_0x34d0fa[_0x35fb('0x35')]=_[_0x35fb('0x32')](_0x5d55fc['model'],qs[_0x35fb('0x45')](_0x2d4b0f[_0x35fb('0x34')][_0x35fb('0x45')]));_0x34d0fa[_0x35fb('0x35')]=_0x34d0fa[_0x35fb('0x35')][_0x35fb('0x36')]?_0x34d0fa['attributes']:_0x5d55fc['model'];if(_0x2d4b0f[_0x35fb('0x34')][_0x35fb('0x46')]){_0x34d0fa['include']=[{'all':!![]}];}_0x34d0fa=_[_0x35fb('0x3e')]({},_0x34d0fa,_0x2d4b0f[_0x35fb('0x40')]);return db[_0x35fb('0x2d')][_0x35fb('0x47')](_0x34d0fa)[_0x35fb('0x25')](handleEntityNotFound(_0x52c1c5,null))[_0x35fb('0x25')](respondWithResult(_0x52c1c5,null))[_0x35fb('0x48')](handleError(_0x52c1c5,null));};exports[_0x35fb('0x49')]=function(_0x2cefb6,_0x449527){return db[_0x35fb('0x2d')][_0x35fb('0x49')](_0x2cefb6[_0x35fb('0x4a')],{})[_0x35fb('0x25')](respondWithResult(_0x449527,0xc9))[_0x35fb('0x48')](handleError(_0x449527,null));};exports['update']=function(_0x38eeab,_0x1aaae7){if(_0x38eeab[_0x35fb('0x4a')]['id']){delete _0x38eeab[_0x35fb('0x4a')]['id'];}return db['ZohoConfiguration'][_0x35fb('0x47')]({'where':{'id':_0x38eeab[_0x35fb('0x44')]['id']}})[_0x35fb('0x25')](handleEntityNotFound(_0x1aaae7,null))['then'](saveUpdates(_0x38eeab[_0x35fb('0x4a')],null))[_0x35fb('0x25')](respondWithResult(_0x1aaae7,null))['catch'](handleError(_0x1aaae7,null));};exports[_0x35fb('0x26')]=function(_0x47accf,_0x29cdcf){return db[_0x35fb('0x2d')][_0x35fb('0x47')]({'where':{'id':_0x47accf[_0x35fb('0x44')]['id']}})[_0x35fb('0x25')](handleEntityNotFound(_0x29cdcf,null))[_0x35fb('0x25')](removeEntity(_0x29cdcf,null))[_0x35fb('0x48')](handleError(_0x29cdcf,null));};exports['getFields']=function(_0x43744d,_0x56b442,_0x23cc6f){var _0x5ab031={};var _0x1c05d9={};var _0x444bd3;var _0x1d93c8;return db[_0x35fb('0x2d')][_0x35fb('0x4b')]({'where':{'id':_0x43744d[_0x35fb('0x44')]['id']}})[_0x35fb('0x25')](handleEntityNotFound(_0x56b442,null))[_0x35fb('0x25')](function(_0x179ade){if(_0x179ade){_0x444bd3=_0x179ade;_0x1c05d9[_0x35fb('0x33')]=_[_0x35fb('0x31')](db[_0x35fb('0x4c')][_0x35fb('0x2e')]);_0x1c05d9['query']=_[_0x35fb('0x31')](_0x43744d[_0x35fb('0x34')]);_0x1c05d9[_0x35fb('0x3b')]=_[_0x35fb('0x32')](_0x1c05d9[_0x35fb('0x33')],_0x1c05d9[_0x35fb('0x34')]);_0x5ab031[_0x35fb('0x35')]=_[_0x35fb('0x32')](_0x1c05d9[_0x35fb('0x33')],qs['fields'](_0x43744d[_0x35fb('0x34')][_0x35fb('0x45')]));_0x5ab031[_0x35fb('0x35')]=_0x5ab031[_0x35fb('0x35')]['length']?_0x5ab031[_0x35fb('0x35')]:_0x1c05d9[_0x35fb('0x33')];_0x5ab031[_0x35fb('0x38')]=qs['sort'](_0x43744d[_0x35fb('0x34')][_0x35fb('0x39')]);_0x5ab031[_0x35fb('0x3a')]=qs['filters'](_[_0x35fb('0x3c')](_0x43744d[_0x35fb('0x34')],_0x1c05d9['filters']));if(_0x43744d['query'][_0x35fb('0x3d')]){_0x5ab031[_0x35fb('0x3a')]=_[_0x35fb('0x3e')](_0x5ab031['where'],{'$or':_[_0x35fb('0x2c')](_0x5ab031['attributes'],function(_0x18b838){var _0x39c899={};_0x39c899[_0x18b838]={'$like':'%'+_0x43744d[_0x35fb('0x34')]['filter']+'%'};return _0x39c899;})});}_0x5ab031=_[_0x35fb('0x3e')]({},_0x5ab031,_0x43744d['options']);return _0x444bd3[_0x35fb('0x4d')](_0x5ab031);}})[_0x35fb('0x25')](function(_0x555e3d){if(_0x555e3d){_0x1d93c8=_0x555e3d['length'];if(!_0x43744d['query']['hasOwnProperty'](_0x35fb('0x4e'))){_0x5ab031[_0x35fb('0x1e')]=qs['limit'](_0x43744d[_0x35fb('0x34')]['limit']);_0x5ab031[_0x35fb('0x1c')]=qs[_0x35fb('0x1c')](_0x43744d[_0x35fb('0x34')][_0x35fb('0x1c')]);}return _0x444bd3[_0x35fb('0x4d')](_0x5ab031);}})[_0x35fb('0x25')](function(_0x337f2a){if(_0x337f2a){return _0x337f2a?{'count':_0x1d93c8,'rows':_0x337f2a}:null;}})[_0x35fb('0x25')](respondWithResult(_0x56b442,null))['catch'](handleError(_0x56b442,null));};exports[_0x35fb('0x4f')]=function(_0x397478,_0x2ef13f,_0x3830ae){var _0x17cead={};var _0xe14b34={};var _0x437d07;var _0x5d6e1f;return db[_0x35fb('0x2d')]['findOne']({'where':{'id':_0x397478[_0x35fb('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ef13f,null))[_0x35fb('0x25')](function(_0x2a59a0){if(_0x2a59a0){_0x437d07=_0x2a59a0;_0xe14b34[_0x35fb('0x33')]=_[_0x35fb('0x31')](db['ZohoField']['rawAttributes']);_0xe14b34[_0x35fb('0x34')]=_['keys'](_0x397478[_0x35fb('0x34')]);_0xe14b34['filters']=_[_0x35fb('0x32')](_0xe14b34['model'],_0xe14b34[_0x35fb('0x34')]);_0x17cead[_0x35fb('0x35')]=_[_0x35fb('0x32')](_0xe14b34[_0x35fb('0x33')],qs[_0x35fb('0x45')](_0x397478['query'][_0x35fb('0x45')]));_0x17cead[_0x35fb('0x35')]=_0x17cead[_0x35fb('0x35')][_0x35fb('0x36')]?_0x17cead[_0x35fb('0x35')]:_0xe14b34[_0x35fb('0x33')];_0x17cead[_0x35fb('0x38')]=qs[_0x35fb('0x39')](_0x397478[_0x35fb('0x34')]['sort']);_0x17cead[_0x35fb('0x3a')]=qs['filters'](_['pick'](_0x397478['query'],_0xe14b34['filters']));if(_0x397478[_0x35fb('0x34')][_0x35fb('0x3d')]){_0x17cead[_0x35fb('0x3a')]=_[_0x35fb('0x3e')](_0x17cead[_0x35fb('0x3a')],{'$or':_[_0x35fb('0x2c')](_0x17cead['attributes'],function(_0x52534e){var _0x4b7f2c={};_0x4b7f2c[_0x52534e]={'$like':'%'+_0x397478[_0x35fb('0x34')]['filter']+'%'};return _0x4b7f2c;})});}_0x17cead=_[_0x35fb('0x3e')]({},_0x17cead,_0x397478[_0x35fb('0x40')]);return _0x437d07[_0x35fb('0x4f')](_0x17cead);}})[_0x35fb('0x25')](function(_0x3fcc00){if(_0x3fcc00){_0x5d6e1f=_0x3fcc00[_0x35fb('0x36')];if(!_0x397478['query'][_0x35fb('0x37')]('nolimit')){_0x17cead[_0x35fb('0x1e')]=qs[_0x35fb('0x1e')](_0x397478[_0x35fb('0x34')][_0x35fb('0x1e')]);_0x17cead[_0x35fb('0x1c')]=qs[_0x35fb('0x1c')](_0x397478[_0x35fb('0x34')][_0x35fb('0x1c')]);}return _0x437d07[_0x35fb('0x4f')](_0x17cead);}})[_0x35fb('0x25')](function(_0x4ba636){if(_0x4ba636){return _0x4ba636?{'count':_0x5d6e1f,'rows':_0x4ba636}:null;}})['then'](respondWithResult(_0x2ef13f,null))[_0x35fb('0x48')](handleError(_0x2ef13f,null));};exports['getDescriptions']=function(_0x2e4cbe,_0x42cc4f,_0x2786e7){var _0x15d6bc={};var _0x573011={};var _0x2c73d8;var _0x297a31;return db[_0x35fb('0x2d')][_0x35fb('0x4b')]({'where':{'id':_0x2e4cbe[_0x35fb('0x44')]['id']}})[_0x35fb('0x25')](handleEntityNotFound(_0x42cc4f,null))['then'](function(_0x459763){if(_0x459763){_0x2c73d8=_0x459763;_0x573011[_0x35fb('0x33')]=_[_0x35fb('0x31')](db[_0x35fb('0x4c')][_0x35fb('0x2e')]);_0x573011[_0x35fb('0x34')]=_[_0x35fb('0x31')](_0x2e4cbe['query']);_0x573011[_0x35fb('0x3b')]=_['intersection'](_0x573011[_0x35fb('0x33')],_0x573011[_0x35fb('0x34')]);_0x15d6bc['attributes']=_[_0x35fb('0x32')](_0x573011[_0x35fb('0x33')],qs[_0x35fb('0x45')](_0x2e4cbe[_0x35fb('0x34')][_0x35fb('0x45')]));_0x15d6bc[_0x35fb('0x35')]=_0x15d6bc[_0x35fb('0x35')][_0x35fb('0x36')]?_0x15d6bc[_0x35fb('0x35')]:_0x573011[_0x35fb('0x33')];_0x15d6bc[_0x35fb('0x38')]=qs[_0x35fb('0x39')](_0x2e4cbe['query'][_0x35fb('0x39')]);_0x15d6bc[_0x35fb('0x3a')]=qs['filters'](_[_0x35fb('0x3c')](_0x2e4cbe[_0x35fb('0x34')],_0x573011[_0x35fb('0x3b')]));if(_0x2e4cbe[_0x35fb('0x34')][_0x35fb('0x3d')]){_0x15d6bc['where']=_[_0x35fb('0x3e')](_0x15d6bc['where'],{'$or':_[_0x35fb('0x2c')](_0x15d6bc['attributes'],function(_0x29b092){var _0xd15970={};_0xd15970[_0x29b092]={'$like':'%'+_0x2e4cbe[_0x35fb('0x34')]['filter']+'%'};return _0xd15970;})});}_0x15d6bc=_['merge']({},_0x15d6bc,_0x2e4cbe[_0x35fb('0x40')]);return _0x2c73d8['getDescriptions'](_0x15d6bc);}})['then'](function(_0x268a86){if(_0x268a86){_0x297a31=_0x268a86[_0x35fb('0x36')];if(!_0x2e4cbe[_0x35fb('0x34')][_0x35fb('0x37')](_0x35fb('0x4e'))){_0x15d6bc[_0x35fb('0x1e')]=qs['limit'](_0x2e4cbe['query'][_0x35fb('0x1e')]);_0x15d6bc[_0x35fb('0x1c')]=qs[_0x35fb('0x1c')](_0x2e4cbe[_0x35fb('0x34')][_0x35fb('0x1c')]);}return _0x2c73d8[_0x35fb('0x50')](_0x15d6bc);}})[_0x35fb('0x25')](function(_0x5aaac6){if(_0x5aaac6){return _0x5aaac6?{'count':_0x297a31,'rows':_0x5aaac6}:null;}})['then'](respondWithResult(_0x42cc4f,null))[_0x35fb('0x48')](handleError(_0x42cc4f,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 5684132..84fe691 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 _0x3a7f=['lodash','util','../../config/logger','api','bluebird','rimraf','exports','ZohoConfiguration'];(function(_0x2b52c8,_0x4d7793){var _0x321f1a=function(_0x45bf8e){while(--_0x45bf8e){_0x2b52c8['push'](_0x2b52c8['shift']());}};_0x321f1a(++_0x4d7793);}(_0x3a7f,0x70));var _0xf3a7=function(_0x5b56d9,_0x3f7536){_0x5b56d9=_0x5b56d9-0x0;var _0x2c2fef=_0x3a7f[_0x5b56d9];return _0x2c2fef;};'use strict';var _=require(_0xf3a7('0x0'));var util=require(_0xf3a7('0x1'));var logger=require(_0xf3a7('0x2'))(_0xf3a7('0x3'));var moment=require('moment');var BPromise=require(_0xf3a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf3a7('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xf3a7('0x6')]=function(_0x3a6dd2,_0x5a4dd0){return _0x3a6dd2['define'](_0xf3a7('0x7'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3d4=['int_zoho_configurations','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x51c067,_0x18987e){var _0x3d5044=function(_0x35f619){while(--_0x35f619){_0x51c067['push'](_0x51c067['shift']());}};_0x3d5044(++_0x18987e);}(_0xb3d4,0x1cf));var _0x4b3d=function(_0x4f50aa,_0x3c19b1){_0x4f50aa=_0x4f50aa-0x0;var _0x406ba1=_0xb3d4[_0x4f50aa];return _0x406ba1;};'use strict';var _=require(_0x4b3d('0x0'));var util=require(_0x4b3d('0x1'));var logger=require(_0x4b3d('0x2'))(_0x4b3d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b3d('0x4'));var rimraf=require(_0x4b3d('0x5'));var config=require(_0x4b3d('0x6'));var attributes=require(_0x4b3d('0x7'));module['exports']=function(_0x4c0461,_0x38c497){return _0x4c0461[_0x4b3d('0x8')](_0x4b3d('0x9'),attributes,{'tableName':_0x4b3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 6865e5d..de8c9ab 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 _0x4900=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','info'];(function(_0x1d7ae7,_0x4cd6a8){var _0x278b9a=function(_0x4b6977){while(--_0x4b6977){_0x1d7ae7['push'](_0x1d7ae7['shift']());}};_0x278b9a(++_0x4cd6a8);}(_0x4900,0x125));var _0x0490=function(_0x9beb21,_0x437def){_0x9beb21=_0x9beb21-0x0;var _0x1ddc49=_0x4900[_0x9beb21];return _0x1ddc49;};'use strict';var _=require(_0x0490('0x0'));var util=require(_0x0490('0x1'));var moment=require(_0x0490('0x2'));var BPromise=require(_0x0490('0x3'));var rs=require(_0x0490('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0490('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0490('0x6'));var config=require(_0x0490('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0490('0x8')][_0x0490('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x251d68,_0x1545f8,_0x5a26ec){return new BPromise(function(_0xebdc21,_0x274006){return client['request'](_0x251d68,_0x5a26ec)['then'](function(_0x176ddb){logger[_0x0490('0xa')](_0x0490('0xb'),_0x1545f8,_0x0490('0xc'));logger[_0x0490('0xd')](_0x0490('0xe'),_0x1545f8,_0x0490('0xc'),JSON[_0x0490('0xf')](_0x176ddb));if(_0x176ddb[_0x0490('0x10')]){if(_0x176ddb[_0x0490('0x10')]['code']===0x1f4){logger[_0x0490('0x10')](_0x0490('0xb'),_0x1545f8,_0x176ddb['error']['message']);return _0x274006(_0x176ddb[_0x0490('0x10')][_0x0490('0x11')]);}logger[_0x0490('0x10')](_0x0490('0xb'),_0x1545f8,_0x176ddb[_0x0490('0x10')][_0x0490('0x11')]);return _0xebdc21(_0x176ddb['error'][_0x0490('0x11')]);}else{logger[_0x0490('0xa')](_0x0490('0xb'),_0x1545f8,'request\x20sent');_0xebdc21(_0x176ddb[_0x0490('0x12')]['message']);}})['catch'](function(_0x404c64){logger[_0x0490('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x1545f8,_0x404c64);_0x274006(_0x404c64);});});} \ No newline at end of file +var _0xf0e3=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x44d869,_0x49425f){var _0x1ed521=function(_0x2c2968){while(--_0x2c2968){_0x44d869['push'](_0x44d869['shift']());}};_0x1ed521(++_0x49425f);}(_0xf0e3,0x1a6));var _0x3f0e=function(_0x45b025,_0x206952){_0x45b025=_0x45b025-0x0;var _0x5538d0=_0xf0e3[_0x45b025];return _0x5538d0;};'use strict';var _=require(_0x3f0e('0x0'));var util=require(_0x3f0e('0x1'));var moment=require(_0x3f0e('0x2'));var BPromise=require(_0x3f0e('0x3'));var rs=require(_0x3f0e('0x4'));var fs=require('fs');var Redis=require(_0x3f0e('0x5'));var db=require(_0x3f0e('0x6'))['db'];var utils=require(_0x3f0e('0x7'));var logger=require('../../config/logger')(_0x3f0e('0x8'));var config=require(_0x3f0e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3f0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49ad0e,_0x2f7964,_0x2cd7a3){return new BPromise(function(_0xc678a3,_0x16aa21){return client[_0x3f0e('0xb')](_0x49ad0e,_0x2cd7a3)['then'](function(_0x49779e){logger['info'](_0x3f0e('0xc'),_0x2f7964,_0x3f0e('0xd'));logger[_0x3f0e('0xe')](_0x3f0e('0xf'),_0x2f7964,_0x3f0e('0xd'),JSON[_0x3f0e('0x10')](_0x49779e));if(_0x49779e[_0x3f0e('0x11')]){if(_0x49779e[_0x3f0e('0x11')][_0x3f0e('0x12')]===0x1f4){logger[_0x3f0e('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x2f7964,_0x49779e[_0x3f0e('0x11')][_0x3f0e('0x13')]);return _0x16aa21(_0x49779e[_0x3f0e('0x11')]['message']);}logger[_0x3f0e('0x11')](_0x3f0e('0xc'),_0x2f7964,_0x49779e['error'][_0x3f0e('0x13')]);return _0xc678a3(_0x49779e[_0x3f0e('0x11')][_0x3f0e('0x13')]);}else{logger['info'](_0x3f0e('0xc'),_0x2f7964,_0x3f0e('0xd'));_0xc678a3(_0x49779e['result'][_0x3f0e('0x13')]);}})['catch'](function(_0x445b83){logger[_0x3f0e('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x2f7964,_0x445b83);_0x16aa21(_0x445b83);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index dbabb32..77082df 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 _0xd8e5=['post','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','index','show'];(function(_0x39447b,_0x395654){var _0x1a73a1=function(_0x4594da){while(--_0x4594da){_0x39447b['push'](_0x39447b['shift']());}};_0x1a73a1(++_0x395654);}(_0xd8e5,0x1a6));var _0x5d8e=function(_0x3a096b,_0x3a7cc0){_0x3a096b=_0x3a096b-0x0;var _0x19c753=_0xd8e5[_0x3a096b];return _0x19c753;};'use strict';var multer=require('multer');var util=require(_0x5d8e('0x0'));var path=require(_0x5d8e('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d8e('0x2'));var router=express[_0x5d8e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5d8e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5d8e('0x5'));router[_0x5d8e('0x6')]('/',auth[_0x5d8e('0x7')](),controller[_0x5d8e('0x8')]);router[_0x5d8e('0x6')]('/:id',auth[_0x5d8e('0x7')](),controller[_0x5d8e('0x9')]);router[_0x5d8e('0xa')]('/',auth['isAuthenticated'](),controller[_0x5d8e('0xb')]);router[_0x5d8e('0xc')](_0x5d8e('0xd'),auth[_0x5d8e('0x7')](),controller[_0x5d8e('0xe')]);router[_0x5d8e('0xf')](_0x5d8e('0xd'),auth[_0x5d8e('0x7')](),controller[_0x5d8e('0x10')]);module[_0x5d8e('0x11')]=router; \ No newline at end of file +var _0xf090=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4e780b,_0x34ca5f){var _0xc8e910=function(_0x3321b3){while(--_0x3321b3){_0x4e780b['push'](_0x4e780b['shift']());}};_0xc8e910(++_0x34ca5f);}(_0xf090,0x14b));var _0x0f09=function(_0x3373ce,_0x25d2a7){_0x3373ce=_0x3373ce-0x0;var _0x932f0f=_0xf090[_0x3373ce];return _0x932f0f;};'use strict';var multer=require(_0x0f09('0x0'));var util=require(_0x0f09('0x1'));var path=require(_0x0f09('0x2'));var timeout=require(_0x0f09('0x3'));var express=require(_0x0f09('0x4'));var router=express[_0x0f09('0x5')]();var fs_extra=require(_0x0f09('0x6'));var auth=require(_0x0f09('0x7'));var interaction=require(_0x0f09('0x8'));var config=require(_0x0f09('0x9'));var controller=require('./intZohoField.controller');router[_0x0f09('0xa')]('/',auth['isAuthenticated'](),controller[_0x0f09('0xb')]);router['get']('/:id',auth[_0x0f09('0xc')](),controller['show']);router[_0x0f09('0xd')]('/',auth[_0x0f09('0xc')](),controller[_0x0f09('0xe')]);router[_0x0f09('0xf')](_0x0f09('0x10'),auth[_0x0f09('0xc')](),controller[_0x0f09('0x11')]);router[_0x0f09('0x12')]('/:id',auth[_0x0f09('0xc')](),controller[_0x0f09('0x13')]);module[_0x0f09('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 964dc43..f675b2c 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 _0xe053=['keyValue','picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xe053,0x18b));var _0x3e05=function(_0x2ac71a,_0x1d2a02){_0x2ac71a=_0x2ac71a-0x0;var _0x3ee904=_0xe053[_0x2ac71a];return _0x3ee904;};'use strict';var Sequelize=require(_0x3e05('0x0'));module['exports']={'type':{'type':Sequelize[_0x3e05('0x1')](_0x3e05('0x2'),_0x3e05('0x3'),_0x3e05('0x4'),_0x3e05('0x5'),_0x3e05('0x6')),'defaultValue':_0x3e05('0x2')},'content':{'type':Sequelize[_0x3e05('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3e05('0x1')](_0x3e05('0x2'),'variable',_0x3e05('0x4'))},'keyContent':{'type':Sequelize[_0x3e05('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3e05('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3e05('0x7')]}}; \ No newline at end of file +var _0xe9bb=['keyValue','picklist','STRING','string','exports','ENUM','variable'];(function(_0x2f231f,_0x3298d6){var _0x189514=function(_0x39c424){while(--_0x39c424){_0x2f231f['push'](_0x2f231f['shift']());}};_0x189514(++_0x3298d6);}(_0xe9bb,0x146));var _0xbe9b=function(_0x2a0f88,_0x43a5fa){_0x2a0f88=_0x2a0f88-0x0;var _0x39ce06=_0xe9bb[_0x2a0f88];return _0x39ce06;};'use strict';var Sequelize=require('sequelize');module[_0xbe9b('0x0')]={'type':{'type':Sequelize[_0xbe9b('0x1')]('string',_0xbe9b('0x2'),'customVariable',_0xbe9b('0x3'),_0xbe9b('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbe9b('0x5')]},'keyType':{'type':Sequelize[_0xbe9b('0x1')](_0xbe9b('0x6'),_0xbe9b('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xbe9b('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbe9b('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbe9b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8e952f2..31ddaf8 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 _0xba2f=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','apply','reject','save','update','then','error','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','options','ZohoField','includeAll','findAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv'];(function(_0x1876c7,_0x379202){var _0x2b9572=function(_0x9bf2ff){while(--_0x9bf2ff){_0x1876c7['push'](_0x1876c7['shift']());}};_0x2b9572(++_0x379202);}(_0xba2f,0x151));var _0xfba2=function(_0xf21aa7,_0x351b7b){_0xf21aa7=_0xf21aa7-0x0;var _0x29fe44=_0xba2f[_0xf21aa7];return _0x29fe44;};'use strict';var emlformat=require(_0xfba2('0x0'));var rimraf=require(_0xfba2('0x1'));var zipdir=require(_0xfba2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfba2('0x3'));var Mustache=require(_0xfba2('0x4'));var util=require('util');var path=require(_0xfba2('0x5'));var sox=require(_0xfba2('0x6'));var csv=require(_0xfba2('0x7'));var ejs=require(_0xfba2('0x8'));var fs=require('fs');var fs_extra=require(_0xfba2('0x9'));var _=require(_0xfba2('0xa'));var squel=require('squel');var crypto=require(_0xfba2('0xb'));var jsforce=require(_0xfba2('0xc'));var deskjs=require(_0xfba2('0xd'));var toCsv=require(_0xfba2('0x7'));var querystring=require(_0xfba2('0xe'));var Papa=require(_0xfba2('0xf'));var Redis=require('ioredis');var authService=require(_0xfba2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfba2('0x11'));var utils=require('../../config/utils');var config=require(_0xfba2('0x12'));var licenseUtil=require(_0xfba2('0x13'));var db=require(_0xfba2('0x14'))['db'];function respondWithStatusCode(_0x4dd427,_0x5a07e8){_0x5a07e8=_0x5a07e8||0xcc;return function(_0x53ebca){if(_0x53ebca){return _0x4dd427[_0xfba2('0x15')](_0x5a07e8);}return _0x4dd427['status'](_0x5a07e8)[_0xfba2('0x16')]();};}function respondWithResult(_0xb351f5,_0x37320e){_0x37320e=_0x37320e||0xc8;return function(_0x2a6e16){if(_0x2a6e16){return _0xb351f5['status'](_0x37320e)[_0xfba2('0x17')](_0x2a6e16);}};}function respondWithFilteredResult(_0x2a7a48,_0x25851d){return function(_0x41a4cb){if(_0x41a4cb){var _0x7a9fd8=typeof _0x25851d[_0xfba2('0x18')]==='undefined'&&typeof _0x25851d[_0xfba2('0x19')]==='undefined';var _0x3dc3b2=_0x41a4cb['count'];var _0x163d0a=_0x7a9fd8?0x0:_0x25851d[_0xfba2('0x18')];var _0x43f90a=_0x7a9fd8?_0x41a4cb[_0xfba2('0x1a')]:_0x25851d[_0xfba2('0x18')]+_0x25851d[_0xfba2('0x19')];var _0x472bb1;if(_0x43f90a>=_0x3dc3b2){_0x43f90a=_0x3dc3b2;_0x472bb1=0xc8;}else{_0x472bb1=0xce;}_0x2a7a48[_0xfba2('0x1b')](_0x472bb1);return _0x2a7a48[_0xfba2('0x1c')]('Content-Range',_0x163d0a+'-'+_0x43f90a+'/'+_0x3dc3b2)[_0xfba2('0x17')](_0x41a4cb);}return null;};}function patchUpdates(_0x2a6253){return function(_0x4847e5){try{jsonpatch[_0xfba2('0x1d')](_0x4847e5,_0x2a6253,!![]);}catch(_0x2be949){return BPromise[_0xfba2('0x1e')](_0x2be949);}return _0x4847e5[_0xfba2('0x1f')]();};}function saveUpdates(_0x1df011,_0x54d680){return function(_0x486474){if(_0x486474){return _0x486474[_0xfba2('0x20')](_0x1df011)[_0xfba2('0x21')](function(_0x103839){return _0x103839;});}return null;};}function removeEntity(_0x33c28e,_0xd27cb9){return function(_0x2c3826){if(_0x2c3826){return _0x2c3826['destroy']()[_0xfba2('0x21')](function(){_0x33c28e['status'](0xcc)[_0xfba2('0x16')]();});}};}function handleEntityNotFound(_0x1c6b71,_0x4a2bfe){return function(_0x462b3c){if(!_0x462b3c){_0x1c6b71['sendStatus'](0x194);}return _0x462b3c;};}function handleError(_0x249aa0,_0x42d735){_0x42d735=_0x42d735||0x1f4;return function(_0x43fa86){logger[_0xfba2('0x22')](_0x43fa86['stack']);if(_0x43fa86['name']){delete _0x43fa86['name'];}_0x249aa0[_0xfba2('0x1b')](_0x42d735)[_0xfba2('0x23')](_0x43fa86);};}exports[_0xfba2('0x24')]=function(_0x2b78d6,_0x13a30f){var _0x4c3efb={},_0x53c979={},_0x49bb5a={'count':0x0,'rows':[]};var _0x19b448=_[_0xfba2('0x25')](db['ZohoField'][_0xfba2('0x26')],function(_0x23238c){return{'name':_0x23238c[_0xfba2('0x27')],'type':_0x23238c['type'][_0xfba2('0x28')]};});_0x53c979['model']=_[_0xfba2('0x25')](_0x19b448,'name');_0x53c979['query']=_[_0xfba2('0x29')](_0x2b78d6[_0xfba2('0x2a')]);_0x53c979[_0xfba2('0x2b')]=_[_0xfba2('0x2c')](_0x53c979[_0xfba2('0x2d')],_0x53c979[_0xfba2('0x2a')]);_0x4c3efb[_0xfba2('0x2e')]=_[_0xfba2('0x2c')](_0x53c979['model'],qs[_0xfba2('0x2f')](_0x2b78d6[_0xfba2('0x2a')][_0xfba2('0x2f')]));_0x4c3efb['attributes']=_0x4c3efb[_0xfba2('0x2e')][_0xfba2('0x30')]?_0x4c3efb[_0xfba2('0x2e')]:_0x53c979[_0xfba2('0x2d')];if(!_0x2b78d6[_0xfba2('0x2a')][_0xfba2('0x31')]('nolimit')){_0x4c3efb[_0xfba2('0x19')]=qs['limit'](_0x2b78d6[_0xfba2('0x2a')][_0xfba2('0x19')]);_0x4c3efb[_0xfba2('0x18')]=qs['offset'](_0x2b78d6[_0xfba2('0x2a')][_0xfba2('0x18')]);}_0x4c3efb[_0xfba2('0x32')]=qs['sort'](_0x2b78d6[_0xfba2('0x2a')][_0xfba2('0x33')]);_0x4c3efb['where']=qs[_0xfba2('0x2b')](_[_0xfba2('0x34')](_0x2b78d6[_0xfba2('0x2a')],_0x53c979[_0xfba2('0x2b')]),_0x19b448);if(_0x2b78d6[_0xfba2('0x2a')]['filter']){_0x4c3efb[_0xfba2('0x35')]=_[_0xfba2('0x36')](_0x4c3efb[_0xfba2('0x35')],{'$or':_[_0xfba2('0x25')](_0x19b448,function(_0x3d53e2){if(_0x3d53e2[_0xfba2('0x37')]!==_0xfba2('0x38')){var _0x489b30={};_0x489b30[_0x3d53e2['name']]={'$like':'%'+_0x2b78d6[_0xfba2('0x2a')]['filter']+'%'};return _0x489b30;}})});}_0x4c3efb=_['merge']({},_0x4c3efb,_0x2b78d6[_0xfba2('0x39')]);var _0xa69147={'where':_0x4c3efb[_0xfba2('0x35')]};return db[_0xfba2('0x3a')][_0xfba2('0x1a')](_0xa69147)[_0xfba2('0x21')](function(_0x27b91d){_0x49bb5a['count']=_0x27b91d;if(_0x2b78d6[_0xfba2('0x2a')][_0xfba2('0x3b')]){_0x4c3efb['include']=[{'all':!![]}];}return db['ZohoField'][_0xfba2('0x3c')](_0x4c3efb);})[_0xfba2('0x21')](function(_0x293dd9){_0x49bb5a[_0xfba2('0x3d')]=_0x293dd9;return _0x49bb5a;})[_0xfba2('0x21')](respondWithFilteredResult(_0x13a30f,_0x4c3efb))['catch'](handleError(_0x13a30f,null));};exports[_0xfba2('0x3e')]=function(_0x5e04ac,_0x3456b8){var _0x4c7cb5={'raw':!![],'where':{'id':_0x5e04ac[_0xfba2('0x3f')]['id']}},_0x248ee6={};_0x248ee6[_0xfba2('0x2d')]=_['keys'](db[_0xfba2('0x3a')][_0xfba2('0x26')]);_0x248ee6[_0xfba2('0x2a')]=_[_0xfba2('0x29')](_0x5e04ac[_0xfba2('0x2a')]);_0x248ee6[_0xfba2('0x2b')]=_['intersection'](_0x248ee6[_0xfba2('0x2d')],_0x248ee6[_0xfba2('0x2a')]);_0x4c7cb5[_0xfba2('0x2e')]=_[_0xfba2('0x2c')](_0x248ee6[_0xfba2('0x2d')],qs[_0xfba2('0x2f')](_0x5e04ac[_0xfba2('0x2a')][_0xfba2('0x2f')]));_0x4c7cb5[_0xfba2('0x2e')]=_0x4c7cb5['attributes'][_0xfba2('0x30')]?_0x4c7cb5[_0xfba2('0x2e')]:_0x248ee6[_0xfba2('0x2d')];if(_0x5e04ac[_0xfba2('0x2a')][_0xfba2('0x3b')]){_0x4c7cb5[_0xfba2('0x40')]=[{'all':!![]}];}_0x4c7cb5=_[_0xfba2('0x36')]({},_0x4c7cb5,_0x5e04ac[_0xfba2('0x39')]);return db[_0xfba2('0x3a')]['find'](_0x4c7cb5)[_0xfba2('0x21')](handleEntityNotFound(_0x3456b8,null))[_0xfba2('0x21')](respondWithResult(_0x3456b8,null))[_0xfba2('0x41')](handleError(_0x3456b8,null));};exports[_0xfba2('0x42')]=function(_0x1d6415,_0xdf5b50){return db[_0xfba2('0x3a')][_0xfba2('0x42')](_0x1d6415['body'],{})['then'](respondWithResult(_0xdf5b50,0xc9))[_0xfba2('0x41')](handleError(_0xdf5b50,null));};exports[_0xfba2('0x20')]=function(_0x152d53,_0x37c3ba){if(_0x152d53[_0xfba2('0x43')]['id']){delete _0x152d53[_0xfba2('0x43')]['id'];}return db[_0xfba2('0x3a')][_0xfba2('0x44')]({'where':{'id':_0x152d53['params']['id']}})[_0xfba2('0x21')](handleEntityNotFound(_0x37c3ba,null))[_0xfba2('0x21')](saveUpdates(_0x152d53[_0xfba2('0x43')],null))['then'](respondWithResult(_0x37c3ba,null))[_0xfba2('0x41')](handleError(_0x37c3ba,null));};exports['destroy']=function(_0x41459c,_0x3a483b){return db[_0xfba2('0x3a')]['find']({'where':{'id':_0x41459c['params']['id']}})['then'](handleEntityNotFound(_0x3a483b,null))[_0xfba2('0x21')](removeEntity(_0x3a483b,null))[_0xfba2('0x41')](handleError(_0x3a483b,null));}; \ No newline at end of file +var _0xb7ad=['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','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv'];(function(_0x472d63,_0x2458fa){var _0x1134d1=function(_0x313754){while(--_0x313754){_0x472d63['push'](_0x472d63['shift']());}};_0x1134d1(++_0x2458fa);}(_0xb7ad,0x1be));var _0xdb7a=function(_0x32133e,_0x28adef){_0x32133e=_0x32133e-0x0;var _0x31e5d3=_0xb7ad[_0x32133e];return _0x31e5d3;};'use strict';var emlformat=require(_0xdb7a('0x0'));var rimraf=require(_0xdb7a('0x1'));var zipdir=require(_0xdb7a('0x2'));var jsonpatch=require(_0xdb7a('0x3'));var rp=require(_0xdb7a('0x4'));var moment=require('moment');var BPromise=require(_0xdb7a('0x5'));var Mustache=require('mustache');var util=require(_0xdb7a('0x6'));var path=require(_0xdb7a('0x7'));var sox=require(_0xdb7a('0x8'));var csv=require(_0xdb7a('0x9'));var ejs=require(_0xdb7a('0xa'));var fs=require('fs');var fs_extra=require(_0xdb7a('0xb'));var _=require(_0xdb7a('0xc'));var squel=require(_0xdb7a('0xd'));var crypto=require(_0xdb7a('0xe'));var jsforce=require(_0xdb7a('0xf'));var deskjs=require(_0xdb7a('0x10'));var toCsv=require(_0xdb7a('0x9'));var querystring=require(_0xdb7a('0x11'));var Papa=require(_0xdb7a('0x12'));var Redis=require(_0xdb7a('0x13'));var authService=require(_0xdb7a('0x14'));var qs=require(_0xdb7a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb7a('0x16'));var logger=require(_0xdb7a('0x17'))(_0xdb7a('0x18'));var utils=require(_0xdb7a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xdb7a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d1ea5,_0x1675cd){_0x1675cd=_0x1675cd||0xcc;return function(_0x38b8a0){if(_0x38b8a0){return _0x5d1ea5[_0xdb7a('0x1b')](_0x1675cd);}return _0x5d1ea5[_0xdb7a('0x1c')](_0x1675cd)[_0xdb7a('0x1d')]();};}function respondWithResult(_0x59f70e,_0x3c60e4){_0x3c60e4=_0x3c60e4||0xc8;return function(_0xf5750d){if(_0xf5750d){return _0x59f70e[_0xdb7a('0x1c')](_0x3c60e4)[_0xdb7a('0x1e')](_0xf5750d);}};}function respondWithFilteredResult(_0x25b81b,_0x23d489){return function(_0x2b9f6c){if(_0x2b9f6c){var _0x2e01a6=typeof _0x23d489['offset']==='undefined'&&typeof _0x23d489[_0xdb7a('0x1f')]===_0xdb7a('0x20');var _0xf39932=_0x2b9f6c['count'];var _0xa1015=_0x2e01a6?0x0:_0x23d489[_0xdb7a('0x21')];var _0x130cd2=_0x2e01a6?_0x2b9f6c[_0xdb7a('0x22')]:_0x23d489[_0xdb7a('0x21')]+_0x23d489[_0xdb7a('0x1f')];var _0x2bd447;if(_0x130cd2>=_0xf39932){_0x130cd2=_0xf39932;_0x2bd447=0xc8;}else{_0x2bd447=0xce;}_0x25b81b[_0xdb7a('0x1c')](_0x2bd447);return _0x25b81b['set'](_0xdb7a('0x23'),_0xa1015+'-'+_0x130cd2+'/'+_0xf39932)[_0xdb7a('0x1e')](_0x2b9f6c);}return null;};}function patchUpdates(_0x4ae5f1){return function(_0x5ec09f){try{jsonpatch[_0xdb7a('0x24')](_0x5ec09f,_0x4ae5f1,!![]);}catch(_0x4548f2){return BPromise[_0xdb7a('0x25')](_0x4548f2);}return _0x5ec09f[_0xdb7a('0x26')]();};}function saveUpdates(_0x325231,_0x3b6ab0){return function(_0x426396){if(_0x426396){return _0x426396['update'](_0x325231)[_0xdb7a('0x27')](function(_0xff0676){return _0xff0676;});}return null;};}function removeEntity(_0x451d28,_0xf651d0){return function(_0x1f7054){if(_0x1f7054){return _0x1f7054[_0xdb7a('0x28')]()[_0xdb7a('0x27')](function(){_0x451d28[_0xdb7a('0x1c')](0xcc)[_0xdb7a('0x1d')]();});}};}function handleEntityNotFound(_0x2f432e,_0x59ac36){return function(_0x3ab219){if(!_0x3ab219){_0x2f432e[_0xdb7a('0x1b')](0x194);}return _0x3ab219;};}function handleError(_0x29d785,_0x2c4bed){_0x2c4bed=_0x2c4bed||0x1f4;return function(_0x305613){logger['error'](_0x305613[_0xdb7a('0x29')]);if(_0x305613[_0xdb7a('0x2a')]){delete _0x305613[_0xdb7a('0x2a')];}_0x29d785[_0xdb7a('0x1c')](_0x2c4bed)[_0xdb7a('0x2b')](_0x305613);};}exports[_0xdb7a('0x2c')]=function(_0x36a278,_0x3a2635){var _0x257f25={},_0x34cef5={},_0x3689b5={'count':0x0,'rows':[]};var _0x3820c1=_[_0xdb7a('0x2d')](db[_0xdb7a('0x2e')][_0xdb7a('0x2f')],function(_0x58d59e){return{'name':_0x58d59e['fieldName'],'type':_0x58d59e[_0xdb7a('0x30')][_0xdb7a('0x31')]};});_0x34cef5[_0xdb7a('0x32')]=_[_0xdb7a('0x2d')](_0x3820c1,_0xdb7a('0x2a'));_0x34cef5['query']=_['keys'](_0x36a278['query']);_0x34cef5[_0xdb7a('0x33')]=_['intersection'](_0x34cef5[_0xdb7a('0x32')],_0x34cef5[_0xdb7a('0x34')]);_0x257f25[_0xdb7a('0x35')]=_[_0xdb7a('0x36')](_0x34cef5['model'],qs[_0xdb7a('0x37')](_0x36a278[_0xdb7a('0x34')][_0xdb7a('0x37')]));_0x257f25[_0xdb7a('0x35')]=_0x257f25['attributes'][_0xdb7a('0x38')]?_0x257f25[_0xdb7a('0x35')]:_0x34cef5['model'];if(!_0x36a278[_0xdb7a('0x34')][_0xdb7a('0x39')](_0xdb7a('0x3a'))){_0x257f25[_0xdb7a('0x1f')]=qs[_0xdb7a('0x1f')](_0x36a278[_0xdb7a('0x34')][_0xdb7a('0x1f')]);_0x257f25[_0xdb7a('0x21')]=qs['offset'](_0x36a278[_0xdb7a('0x34')][_0xdb7a('0x21')]);}_0x257f25[_0xdb7a('0x3b')]=qs['sort'](_0x36a278[_0xdb7a('0x34')][_0xdb7a('0x3c')]);_0x257f25[_0xdb7a('0x3d')]=qs[_0xdb7a('0x33')](_['pick'](_0x36a278[_0xdb7a('0x34')],_0x34cef5[_0xdb7a('0x33')]),_0x3820c1);if(_0x36a278[_0xdb7a('0x34')][_0xdb7a('0x3e')]){_0x257f25[_0xdb7a('0x3d')]=_[_0xdb7a('0x3f')](_0x257f25[_0xdb7a('0x3d')],{'$or':_[_0xdb7a('0x2d')](_0x3820c1,function(_0x266e2d){if(_0x266e2d[_0xdb7a('0x30')]!==_0xdb7a('0x40')){var _0x468532={};_0x468532[_0x266e2d[_0xdb7a('0x2a')]]={'$like':'%'+_0x36a278['query'][_0xdb7a('0x3e')]+'%'};return _0x468532;}})});}_0x257f25=_[_0xdb7a('0x3f')]({},_0x257f25,_0x36a278[_0xdb7a('0x41')]);var _0x451a3f={'where':_0x257f25[_0xdb7a('0x3d')]};return db[_0xdb7a('0x2e')][_0xdb7a('0x22')](_0x451a3f)[_0xdb7a('0x27')](function(_0x3424f0){_0x3689b5[_0xdb7a('0x22')]=_0x3424f0;if(_0x36a278[_0xdb7a('0x34')][_0xdb7a('0x42')]){_0x257f25[_0xdb7a('0x43')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x257f25);})[_0xdb7a('0x27')](function(_0x4cd4bd){_0x3689b5[_0xdb7a('0x44')]=_0x4cd4bd;return _0x3689b5;})['then'](respondWithFilteredResult(_0x3a2635,_0x257f25))[_0xdb7a('0x45')](handleError(_0x3a2635,null));};exports[_0xdb7a('0x46')]=function(_0x20e519,_0x17d59a){var _0x23179b={'raw':!![],'where':{'id':_0x20e519['params']['id']}},_0x3e95b6={};_0x3e95b6[_0xdb7a('0x32')]=_[_0xdb7a('0x47')](db[_0xdb7a('0x2e')]['rawAttributes']);_0x3e95b6[_0xdb7a('0x34')]=_[_0xdb7a('0x47')](_0x20e519[_0xdb7a('0x34')]);_0x3e95b6['filters']=_['intersection'](_0x3e95b6[_0xdb7a('0x32')],_0x3e95b6[_0xdb7a('0x34')]);_0x23179b[_0xdb7a('0x35')]=_['intersection'](_0x3e95b6[_0xdb7a('0x32')],qs[_0xdb7a('0x37')](_0x20e519[_0xdb7a('0x34')]['fields']));_0x23179b[_0xdb7a('0x35')]=_0x23179b[_0xdb7a('0x35')][_0xdb7a('0x38')]?_0x23179b[_0xdb7a('0x35')]:_0x3e95b6[_0xdb7a('0x32')];if(_0x20e519[_0xdb7a('0x34')]['includeAll']){_0x23179b['include']=[{'all':!![]}];}_0x23179b=_['merge']({},_0x23179b,_0x20e519[_0xdb7a('0x41')]);return db['ZohoField'][_0xdb7a('0x48')](_0x23179b)['then'](handleEntityNotFound(_0x17d59a,null))[_0xdb7a('0x27')](respondWithResult(_0x17d59a,null))[_0xdb7a('0x45')](handleError(_0x17d59a,null));};exports[_0xdb7a('0x49')]=function(_0x2e8655,_0x5a569b){return db['ZohoField'][_0xdb7a('0x49')](_0x2e8655[_0xdb7a('0x4a')],{})[_0xdb7a('0x27')](respondWithResult(_0x5a569b,0xc9))[_0xdb7a('0x45')](handleError(_0x5a569b,null));};exports['update']=function(_0x226b50,_0x52a72d){if(_0x226b50[_0xdb7a('0x4a')]['id']){delete _0x226b50[_0xdb7a('0x4a')]['id'];}return db[_0xdb7a('0x2e')][_0xdb7a('0x48')]({'where':{'id':_0x226b50[_0xdb7a('0x4b')]['id']}})[_0xdb7a('0x27')](handleEntityNotFound(_0x52a72d,null))[_0xdb7a('0x27')](saveUpdates(_0x226b50[_0xdb7a('0x4a')],null))[_0xdb7a('0x27')](respondWithResult(_0x52a72d,null))[_0xdb7a('0x45')](handleError(_0x52a72d,null));};exports[_0xdb7a('0x28')]=function(_0x594206,_0x4cbc20){return db['ZohoField']['find']({'where':{'id':_0x594206['params']['id']}})[_0xdb7a('0x27')](handleEntityNotFound(_0x4cbc20,null))['then'](removeEntity(_0x4cbc20,null))['catch'](handleError(_0x4cbc20,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4da8e6d..209bd6e 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 _0x5fdc=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0x5fdc,0x127));var _0xc5fd=function(_0xabaf4d,_0x2cdc57){_0xabaf4d=_0xabaf4d-0x0;var _0xb556fc=_0x5fdc[_0xabaf4d];return _0xb556fc;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var logger=require(_0xc5fd('0x2'))(_0xc5fd('0x3'));var moment=require(_0xc5fd('0x4'));var BPromise=require(_0xc5fd('0x5'));var rp=require(_0xc5fd('0x6'));var fs=require('fs');var path=require(_0xc5fd('0x7'));var rimraf=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var attributes=require(_0xc5fd('0xa'));module[_0xc5fd('0xb')]=function(_0x44722b,_0x216902){return _0x44722b[_0xc5fd('0xc')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xc5fd('0xd'),_0xc5fd('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x45290b,_0x21a2b4){var _0x50c093=function(_0x527785){while(--_0x527785){_0x45290b['push'](_0x45290b['shift']());}};_0x50c093(++_0x21a2b4);}(_0x187d,0x93));var _0xd187=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x187d[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xd'),_0xd187('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 22601f2..9e8f968 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 _0x1155=['client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x464fd9,_0x53f763){var _0x14c4d8=function(_0x1e2900){while(--_0x1e2900){_0x464fd9['push'](_0x464fd9['shift']());}};_0x14c4d8(++_0x53f763);}(_0x1155,0x1af));var _0x5115=function(_0x2fa1e8,_0x497167){_0x2fa1e8=_0x2fa1e8-0x0;var _0x10bccf=_0x1155[_0x2fa1e8];return _0x10bccf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5115('0x0'));var BPromise=require(_0x5115('0x1'));var rs=require(_0x5115('0x2'));var fs=require('fs');var Redis=require(_0x5115('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5115('0x4'));var logger=require(_0x5115('0x5'))(_0x5115('0x6'));var config=require(_0x5115('0x7'));var jayson=require(_0x5115('0x8'));var client=jayson[_0x5115('0x9')][_0x5115('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e022d,_0x216e42,_0x5dfc1a){return new BPromise(function(_0x5afcfb,_0x5e1cc5){return client[_0x5115('0xb')](_0x4e022d,_0x5dfc1a)['then'](function(_0x27b810){logger[_0x5115('0xc')](_0x5115('0xd'),_0x216e42,_0x5115('0xe'));logger[_0x5115('0xf')](_0x5115('0x10'),_0x216e42,_0x5115('0xe'),JSON[_0x5115('0x11')](_0x27b810));if(_0x27b810[_0x5115('0x12')]){if(_0x27b810[_0x5115('0x12')][_0x5115('0x13')]===0x1f4){logger[_0x5115('0x12')](_0x5115('0xd'),_0x216e42,_0x27b810[_0x5115('0x12')][_0x5115('0x14')]);return _0x5e1cc5(_0x27b810[_0x5115('0x12')][_0x5115('0x14')]);}logger['error'](_0x5115('0xd'),_0x216e42,_0x27b810['error'][_0x5115('0x14')]);return _0x5afcfb(_0x27b810[_0x5115('0x12')]['message']);}else{logger[_0x5115('0xc')](_0x5115('0xd'),_0x216e42,'request\x20sent');_0x5afcfb(_0x27b810['result'][_0x5115('0x14')]);}})[_0x5115('0x15')](function(_0x5258c3){logger[_0x5115('0x12')](_0x5115('0xd'),_0x216e42,_0x5258c3);_0x5e1cc5(_0x5258c3);});});} \ No newline at end of file +var _0x6762=['ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','request','info'];(function(_0x298b62,_0xf11a71){var _0x45bf16=function(_0x4386ca){while(--_0x4386ca){_0x298b62['push'](_0x298b62['shift']());}};_0x45bf16(++_0xf11a71);}(_0x6762,0x161));var _0x2676=function(_0xcbf7a7,_0x30e8f6){_0xcbf7a7=_0xcbf7a7-0x0;var _0x18f7ef=_0x6762[_0xcbf7a7];return _0x18f7ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2676('0x0'));var BPromise=require(_0x2676('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2676('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2676('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2676('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x232381,_0x1e65c3,_0x13e60a){return new BPromise(function(_0x4075ae,_0x45dbd4){return client[_0x2676('0x5')](_0x232381,_0x13e60a)['then'](function(_0x47e0ba){logger[_0x2676('0x6')](_0x2676('0x7'),_0x1e65c3,_0x2676('0x8'));logger[_0x2676('0x9')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1e65c3,_0x2676('0x8'),JSON[_0x2676('0xa')](_0x47e0ba));if(_0x47e0ba['error']){if(_0x47e0ba[_0x2676('0xb')][_0x2676('0xc')]===0x1f4){logger[_0x2676('0xb')](_0x2676('0x7'),_0x1e65c3,_0x47e0ba[_0x2676('0xb')][_0x2676('0xd')]);return _0x45dbd4(_0x47e0ba['error'][_0x2676('0xd')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x1e65c3,_0x47e0ba[_0x2676('0xb')]['message']);return _0x4075ae(_0x47e0ba['error'][_0x2676('0xd')]);}else{logger['info'](_0x2676('0x7'),_0x1e65c3,'request\x20sent');_0x4075ae(_0x47e0ba[_0x2676('0xe')][_0x2676('0xd')]);}})['catch'](function(_0x8007cf){logger['error'](_0x2676('0x7'),_0x1e65c3,_0x8007cf);_0x45dbd4(_0x8007cf);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 64b31a6..d979f2d 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1c413e,_0x51788b){var _0x1d8309=function(_0x335195){while(--_0x335195){_0x1c413e['push'](_0x1c413e['shift']());}};_0x1d8309(++_0x51788b);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2079b7,_0x1a6623){var _0x2bbfeb=function(_0x5af029){while(--_0x5af029){_0x2079b7['push'](_0x2079b7['shift']());}};_0x2bbfeb(++_0x1a6623);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c2901a7..659fb5d 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 _0x1a9c=['INTEGER','BOOLEAN','state','STRING','unique_name_and_version','app.js'];(function(_0x421ac6,_0x3f4043){var _0x510542=function(_0x2f434a){while(--_0x2f434a){_0x421ac6['push'](_0x421ac6['shift']());}};_0x510542(++_0x3f4043);}(_0x1a9c,0xff));var _0xc1a9=function(_0x4f45e9,_0x10b726){_0x4f45e9=_0x4f45e9-0x0;var _0x28750=_0x1a9c[_0x4f45e9];return _0x28750;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc1a9('0x0')],'allowNull':![],'unique':_0xc1a9('0x1')},'version':{'type':Sequelize[_0xc1a9('0x0')],'allowNull':![],'unique':_0xc1a9('0x1')},'main':{'type':Sequelize[_0xc1a9('0x0')],'defaultValue':_0xc1a9('0x2')},'filename':{'type':Sequelize[_0xc1a9('0x0')]},'path':{'type':Sequelize[_0xc1a9('0x0')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xc1a9('0x3')]},'active':{'type':Sequelize[_0xc1a9('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xc1a9('0x0')]},'state':{'type':Sequelize[_0xc1a9('0x0')],'unique':_0xc1a9('0x5')},'description':{'type':Sequelize[_0xc1a9('0x0')]},'title':{'type':Sequelize[_0xc1a9('0x0')]},'remoteUri':{'type':Sequelize[_0xc1a9('0x0')]},'link':{'type':Sequelize[_0xc1a9('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0xd5c5=['BOOLEAN','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x4d385f,_0x255aa0){var _0x288718=function(_0x33ca56){while(--_0x33ca56){_0x4d385f['push'](_0x4d385f['shift']());}};_0x288718(++_0x255aa0);}(_0xd5c5,0x6d));var _0x5d5c=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xd5c5[_0x1b3564];return _0x504069;};'use strict';var Sequelize=require('sequelize');module[_0x5d5c('0x0')]={'name':{'type':Sequelize[_0x5d5c('0x1')],'allowNull':![],'unique':_0x5d5c('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5d5c('0x2')},'main':{'type':Sequelize[_0x5d5c('0x1')],'defaultValue':_0x5d5c('0x3')},'filename':{'type':Sequelize[_0x5d5c('0x1')]},'path':{'type':Sequelize[_0x5d5c('0x1')]},'type':{'type':Sequelize[_0x5d5c('0x1')]},'size':{'type':Sequelize[_0x5d5c('0x4')]},'active':{'type':Sequelize[_0x5d5c('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x5d5c('0x1')]},'logo':{'type':Sequelize[_0x5d5c('0x1')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x5d5c('0x1')]},'title':{'type':Sequelize[_0x5d5c('0x1')]},'remoteUri':{'type':Sequelize[_0x5d5c('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 6b4b486..d98dcde 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 _0x1a85=['includeAll','find','create','body','params','destroy','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields'];(function(_0x378295,_0x119ff9){var _0x482bd8=function(_0x277430){while(--_0x277430){_0x378295['push'](_0x378295['shift']());}};_0x482bd8(++_0x119ff9);}(_0x1a85,0x178));var _0x51a8=function(_0x246a98,_0xdf59a8){_0x246a98=_0x246a98-0x0;var _0x3b8b79=_0x1a85[_0x246a98];return _0x3b8b79;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['Integration'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));}; \ No newline at end of file +var _0x33af=['merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where'];(function(_0x312f4b,_0x18425d){var _0x197c95=function(_0xfc6179){while(--_0xfc6179){_0x312f4b['push'](_0x312f4b['shift']());}};_0x197c95(++_0x18425d);}(_0x33af,0xec));var _0xf33a=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x33af[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['Integration'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index cbf9906..7b66dcc 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 _0xea05=['exports','define','integrations','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./integration.attributes'];(function(_0x22408d,_0x520d47){var _0x2922c4=function(_0x338326){while(--_0x338326){_0x22408d['push'](_0x22408d['shift']());}};_0x2922c4(++_0x520d47);}(_0xea05,0xf5));var _0x5ea0=function(_0x37cca0,_0x3b84b7){_0x37cca0=_0x37cca0-0x0;var _0x368c45=_0xea05[_0x37cca0];return _0x368c45;};'use strict';var _=require(_0x5ea0('0x0'));var util=require(_0x5ea0('0x1'));var logger=require(_0x5ea0('0x2'))('api');var moment=require(_0x5ea0('0x3'));var BPromise=require('bluebird');var rp=require(_0x5ea0('0x4'));var fs=require('fs');var path=require(_0x5ea0('0x5'));var rimraf=require('rimraf');var config=require(_0x5ea0('0x6'));var attributes=require(_0x5ea0('0x7'));module[_0x5ea0('0x8')]=function(_0x34abda,_0x62c801){return _0x34abda[_0x5ea0('0x9')]('Integration',attributes,{'tableName':_0x5ea0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb22=['integrations','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','Integration'];(function(_0x2e691d,_0x419e8c){var _0x397307=function(_0x505223){while(--_0x505223){_0x2e691d['push'](_0x2e691d['shift']());}};_0x397307(++_0x419e8c);}(_0xfb22,0x1b9));var _0x2fb2=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0xfb22[_0x3cb6dc];return _0x47ec89;};'use strict';var _=require(_0x2fb2('0x0'));var util=require('util');var logger=require(_0x2fb2('0x1'))(_0x2fb2('0x2'));var moment=require('moment');var BPromise=require(_0x2fb2('0x3'));var rp=require(_0x2fb2('0x4'));var fs=require('fs');var path=require(_0x2fb2('0x5'));var rimraf=require('rimraf');var config=require(_0x2fb2('0x6'));var attributes=require(_0x2fb2('0x7'));module[_0x2fb2('0x8')]=function(_0x46c42f,_0x14f54f){return _0x46c42f['define'](_0x2fb2('0x9'),attributes,{'tableName':_0x2fb2('0xa'),'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 11d55af..9e6c6ab 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x14d26e,_0x8da3fb){var _0x4579f0=function(_0x5eba40){while(--_0x5eba40){_0x14d26e['push'](_0x14d26e['shift']());}};_0x4579f0(++_0x8da3fb);}(_0x14a0,0x8e));var _0x014a=function(_0x29542a,_0x484491){_0x29542a=_0x29542a-0x0;var _0x580180=_0x14a0[_0x29542a];return _0x580180;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x32c6e7,_0x540b99){var _0x26b6f4=function(_0x4ec13b){while(--_0x4ec13b){_0x32c6e7['push'](_0x32c6e7['shift']());}};_0x26b6f4(++_0x540b99);}(_0x2ef3,0xba));var _0x32ef=function(_0x337270,_0x1b6d36){_0x337270=_0x337270-0x0;var _0x403603=_0x2ef3[_0x337270];return _0x403603;};'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')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index bd98476..06db2aa 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x3c8b4f,_0x798b26){var _0x50a80d=function(_0x358952){while(--_0x358952){_0x3c8b4f['push'](_0x3c8b4f['shift']());}};_0x50a80d(++_0x798b26);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 0da07bf..26b2d5a 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 _0xded6=['TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x5d95f8,_0x15784a){var _0x48a826=function(_0xf30ddb){while(--_0xf30ddb){_0x5d95f8['push'](_0x5d95f8['shift']());}};_0x48a826(++_0x15784a);}(_0xded6,0xcb));var _0x6ded=function(_0x5bf9bb,_0x261c1c){_0x5bf9bb=_0x5bf9bb-0x0;var _0x51c87c=_0xded6[_0x5bf9bb];return _0x51c87c;};'use strict';var Sequelize=require(_0x6ded('0x0'));module[_0x6ded('0x1')]={'integration':{'type':Sequelize[_0x6ded('0x2')]},'eventChannel':{'type':Sequelize[_0x6ded('0x2')]},'exitStatus':{'type':Sequelize[_0x6ded('0x2')]},'ticketId':{'type':Sequelize[_0x6ded('0x2')]},'integrationId':{'type':Sequelize[_0x6ded('0x3')]},'contacts':{'type':Sequelize[_0x6ded('0x2')]},'uniqueid':{'type':Sequelize[_0x6ded('0x2')]},'calleridnum':{'type':Sequelize[_0x6ded('0x2')]},'calleridname':{'type':Sequelize[_0x6ded('0x2')]},'queue':{'type':Sequelize[_0x6ded('0x2')]},'interface':{'type':Sequelize[_0x6ded('0x2')]},'membername':{'type':Sequelize[_0x6ded('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6ded('0x4')]},'agentconnectAt':{'type':Sequelize[_0x6ded('0x4')]},'holdtime':{'type':Sequelize[_0x6ded('0x3')]},'agentcomplete':{'type':Sequelize[_0x6ded('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6ded('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6ded('0x3')]},'reason':{'type':Sequelize[_0x6ded('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x6ded('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x6ded('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6ded('0x4')]},'lastevent':{'type':Sequelize[_0x6ded('0x2')]},'channel':{'type':Sequelize[_0x6ded('0x2')]},'channelstate':{'type':Sequelize[_0x6ded('0x3')]},'channelstatedesc':{'type':Sequelize[_0x6ded('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6ded('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6ded('0x2')]},'accountcode':{'type':Sequelize[_0x6ded('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6ded('0x2')]},'priority':{'type':Sequelize[_0x6ded('0x2')]},'destchannel':{'type':Sequelize[_0x6ded('0x2')]},'destchannelstate':{'type':Sequelize[_0x6ded('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x6ded('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x6ded('0x2')]},'destaccountcode':{'type':Sequelize[_0x6ded('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x6ded('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x6ded('0x2')]},'messageId':{'type':Sequelize[_0x6ded('0x2')]},'inReplyTo':{'type':Sequelize[_0x6ded('0x2')]},'subject':{'type':Sequelize[_0x6ded('0x2')]},'from':{'type':Sequelize[_0x6ded('0x2')]},'to':{'type':Sequelize[_0x6ded('0x2')]},'cc':{'type':Sequelize[_0x6ded('0x2')]},'attachment':{'type':Sequelize[_0x6ded('0x6')]},'html':{'type':Sequelize[_0x6ded('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x6ded('0x7'),_0x6ded('0x8'),_0x6ded('0x9'),_0x6ded('0xa'))},'url':{'type':Sequelize[_0x6ded('0x2')]},'app':{'type':Sequelize[_0x6ded('0x2')]},'appdata':{'type':Sequelize[_0x6ded('0x2')]},'projectId':{'type':Sequelize[_0x6ded('0x3')]}}; \ No newline at end of file +var _0x0db8=['SENT','SENDING','RECEIVED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0db8,0x1c5));var _0x80db=function(_0x355082,_0x2ef631){_0x355082=_0x355082-0x0;var _0x4517d6=_0x0db8[_0x355082];return _0x4517d6;};'use strict';var Sequelize=require(_0x80db('0x0'));module[_0x80db('0x1')]={'integration':{'type':Sequelize[_0x80db('0x2')]},'eventChannel':{'type':Sequelize[_0x80db('0x2')]},'exitStatus':{'type':Sequelize[_0x80db('0x2')]},'ticketId':{'type':Sequelize[_0x80db('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x80db('0x2')]},'uniqueid':{'type':Sequelize[_0x80db('0x2')]},'calleridnum':{'type':Sequelize[_0x80db('0x2')]},'calleridname':{'type':Sequelize[_0x80db('0x2')]},'queue':{'type':Sequelize[_0x80db('0x2')]},'interface':{'type':Sequelize[_0x80db('0x2')]},'membername':{'type':Sequelize[_0x80db('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x80db('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x80db('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x80db('0x3')]},'talktime':{'type':Sequelize[_0x80db('0x5')]},'agentacw':{'type':Sequelize[_0x80db('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x80db('0x5')]},'reason':{'type':Sequelize[_0x80db('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x80db('0x3')]},'agentdump':{'type':Sequelize[_0x80db('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x80db('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x80db('0x2')]},'connectedlinename':{'type':Sequelize[_0x80db('0x2')]},'language':{'type':Sequelize[_0x80db('0x2')]},'accountcode':{'type':Sequelize[_0x80db('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x80db('0x2')]},'priority':{'type':Sequelize[_0x80db('0x2')]},'destchannel':{'type':Sequelize[_0x80db('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x80db('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x80db('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x80db('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x80db('0x2')]},'destpriority':{'type':Sequelize[_0x80db('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x80db('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x80db('0x2')]},'cc':{'type':Sequelize[_0x80db('0x2')]},'attachment':{'type':Sequelize[_0x80db('0x6')]},'html':{'type':Sequelize[_0x80db('0x6')]},'text':{'type':Sequelize[_0x80db('0x6')]},'status':{'type':Sequelize['ENUM'](_0x80db('0x7'),_0x80db('0x8'),_0x80db('0x9'),'FAILED')},'url':{'type':Sequelize[_0x80db('0x2')]},'app':{'type':Sequelize[_0x80db('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x80db('0x5')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 3a294ff..a1b4491 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 _0xcdcd=['VIRTUAL','includeAll','rows','show','params','IntegrationReport','include','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge'];(function(_0x1f46e2,_0x38ec90){var _0x24e31c=function(_0x13f8b4){while(--_0x13f8b4){_0x1f46e2['push'](_0x1f46e2['shift']());}};_0x24e31c(++_0x38ec90);}(_0xcdcd,0x189));var _0xdcdc=function(_0x412dd8,_0x355780){_0x412dd8=_0x412dd8-0x0;var _0x47b96=_0xcdcd[_0x412dd8];return _0x47b96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdcdc('0x0'));var zipdir=require(_0xdcdc('0x1'));var jsonpatch=require(_0xdcdc('0x2'));var rp=require(_0xdcdc('0x3'));var moment=require(_0xdcdc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcdc('0x5'));var util=require(_0xdcdc('0x6'));var path=require(_0xdcdc('0x7'));var sox=require(_0xdcdc('0x8'));var csv=require(_0xdcdc('0x9'));var ejs=require(_0xdcdc('0xa'));var fs=require('fs');var fs_extra=require(_0xdcdc('0xb'));var _=require(_0xdcdc('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdcdc('0xd'));var deskjs=require(_0xdcdc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdcdc('0xf'));var Papa=require(_0xdcdc('0x10'));var Redis=require(_0xdcdc('0x11'));var authService=require(_0xdcdc('0x12'));var qs=require(_0xdcdc('0x13'));var as=require(_0xdcdc('0x14'));var hardwareService=require(_0xdcdc('0x15'));var logger=require(_0xdcdc('0x16'))(_0xdcdc('0x17'));var utils=require('../../config/utils');var config=require(_0xdcdc('0x18'));var licenseUtil=require(_0xdcdc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10945c,_0x381e04){_0x381e04=_0x381e04||0xcc;return function(_0x10e532){if(_0x10e532){return _0x10945c['sendStatus'](_0x381e04);}return _0x10945c[_0xdcdc('0x1a')](_0x381e04)[_0xdcdc('0x1b')]();};}function respondWithResult(_0x5c446c,_0x5b262b){_0x5b262b=_0x5b262b||0xc8;return function(_0x52c9f9){if(_0x52c9f9){return _0x5c446c[_0xdcdc('0x1a')](_0x5b262b)[_0xdcdc('0x1c')](_0x52c9f9);}};}function respondWithFilteredResult(_0x129e0b,_0x518cb2){return function(_0x570609){if(_0x570609){var _0x19a0db=typeof _0x518cb2[_0xdcdc('0x1d')]===_0xdcdc('0x1e')&&typeof _0x518cb2['limit']===_0xdcdc('0x1e');var _0x1e276b=_0x570609[_0xdcdc('0x1f')];var _0x32a122=_0x19a0db?0x0:_0x518cb2[_0xdcdc('0x1d')];var _0xbf8153=_0x19a0db?_0x570609[_0xdcdc('0x1f')]:_0x518cb2[_0xdcdc('0x1d')]+_0x518cb2['limit'];var _0x3415e9;if(_0xbf8153>=_0x1e276b){_0xbf8153=_0x1e276b;_0x3415e9=0xc8;}else{_0x3415e9=0xce;}_0x129e0b[_0xdcdc('0x1a')](_0x3415e9);return _0x129e0b[_0xdcdc('0x20')]('Content-Range',_0x32a122+'-'+_0xbf8153+'/'+_0x1e276b)[_0xdcdc('0x1c')](_0x570609);}return null;};}function patchUpdates(_0x2655ff){return function(_0x1156c8){try{jsonpatch[_0xdcdc('0x21')](_0x1156c8,_0x2655ff,!![]);}catch(_0x1adf74){return BPromise[_0xdcdc('0x22')](_0x1adf74);}return _0x1156c8['save']();};}function saveUpdates(_0x11311a,_0x2305d3){return function(_0x499d0f){if(_0x499d0f){return _0x499d0f[_0xdcdc('0x23')](_0x11311a)[_0xdcdc('0x24')](function(_0x1d024f){return _0x1d024f;});}return null;};}function removeEntity(_0x3bc69d,_0x1cb4a4){return function(_0x178c19){if(_0x178c19){return _0x178c19[_0xdcdc('0x25')]()[_0xdcdc('0x24')](function(){_0x3bc69d[_0xdcdc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x187d67,_0x549d84){return function(_0x28b690){if(!_0x28b690){_0x187d67[_0xdcdc('0x26')](0x194);}return _0x28b690;};}function handleError(_0x2ebe28,_0x500696){_0x500696=_0x500696||0x1f4;return function(_0x5e2069){logger['error'](_0x5e2069[_0xdcdc('0x27')]);if(_0x5e2069[_0xdcdc('0x28')]){delete _0x5e2069[_0xdcdc('0x28')];}_0x2ebe28['status'](_0x500696)[_0xdcdc('0x29')](_0x5e2069);};}exports[_0xdcdc('0x2a')]=function(_0x4d8c17,_0x1b0a6a){var _0x177d30={},_0x557573={},_0x32029b={'count':0x0,'rows':[]};var _0x47ef08=_[_0xdcdc('0x2b')](db['IntegrationReport'][_0xdcdc('0x2c')],function(_0x3b3f9c){return{'name':_0x3b3f9c[_0xdcdc('0x2d')],'type':_0x3b3f9c[_0xdcdc('0x2e')]['key']};});_0x557573['model']=_[_0xdcdc('0x2b')](_0x47ef08,_0xdcdc('0x28'));_0x557573[_0xdcdc('0x2f')]=_[_0xdcdc('0x30')](_0x4d8c17['query']);_0x557573[_0xdcdc('0x31')]=_[_0xdcdc('0x32')](_0x557573[_0xdcdc('0x33')],_0x557573[_0xdcdc('0x2f')]);_0x177d30[_0xdcdc('0x34')]=_[_0xdcdc('0x32')](_0x557573[_0xdcdc('0x33')],qs['fields'](_0x4d8c17[_0xdcdc('0x2f')][_0xdcdc('0x35')]));_0x177d30['attributes']=_0x177d30[_0xdcdc('0x34')][_0xdcdc('0x36')]?_0x177d30['attributes']:_0x557573['model'];if(!_0x4d8c17[_0xdcdc('0x2f')][_0xdcdc('0x37')](_0xdcdc('0x38'))){_0x177d30[_0xdcdc('0x39')]=qs[_0xdcdc('0x39')](_0x4d8c17[_0xdcdc('0x2f')][_0xdcdc('0x39')]);_0x177d30['offset']=qs[_0xdcdc('0x1d')](_0x4d8c17['query'][_0xdcdc('0x1d')]);}_0x177d30[_0xdcdc('0x3a')]=qs[_0xdcdc('0x3b')](_0x4d8c17[_0xdcdc('0x2f')][_0xdcdc('0x3b')]);_0x177d30['where']=qs[_0xdcdc('0x31')](_['pick'](_0x4d8c17[_0xdcdc('0x2f')],_0x557573[_0xdcdc('0x31')]),_0x47ef08);if(_0x4d8c17[_0xdcdc('0x2f')][_0xdcdc('0x3c')]){_0x177d30[_0xdcdc('0x3d')]=_[_0xdcdc('0x3e')](_0x177d30['where'],{'$or':_[_0xdcdc('0x2b')](_0x47ef08,function(_0x3a536b){if(_0x3a536b[_0xdcdc('0x2e')]!==_0xdcdc('0x3f')){var _0x2eef15={};_0x2eef15[_0x3a536b[_0xdcdc('0x28')]]={'$like':'%'+_0x4d8c17[_0xdcdc('0x2f')][_0xdcdc('0x3c')]+'%'};return _0x2eef15;}})});}_0x177d30=_[_0xdcdc('0x3e')]({},_0x177d30,_0x4d8c17['options']);var _0x548f16={'where':_0x177d30[_0xdcdc('0x3d')]};return db['IntegrationReport'][_0xdcdc('0x1f')](_0x548f16)[_0xdcdc('0x24')](function(_0x488c04){_0x32029b['count']=_0x488c04;if(_0x4d8c17[_0xdcdc('0x2f')][_0xdcdc('0x40')]){_0x177d30['include']=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x177d30);})[_0xdcdc('0x24')](function(_0x1f69d7){_0x32029b[_0xdcdc('0x41')]=_0x1f69d7;return _0x32029b;})['then'](respondWithFilteredResult(_0x1b0a6a,_0x177d30))['catch'](handleError(_0x1b0a6a,null));};exports[_0xdcdc('0x42')]=function(_0x39a41e,_0x3978af){var _0xead877={'raw':![],'where':{'id':_0x39a41e[_0xdcdc('0x43')]['id']}},_0x398b58={};_0x398b58[_0xdcdc('0x33')]=_['keys'](db[_0xdcdc('0x44')]['rawAttributes']);_0x398b58['query']=_[_0xdcdc('0x30')](_0x39a41e['query']);_0x398b58[_0xdcdc('0x31')]=_[_0xdcdc('0x32')](_0x398b58[_0xdcdc('0x33')],_0x398b58[_0xdcdc('0x2f')]);_0xead877['attributes']=_[_0xdcdc('0x32')](_0x398b58[_0xdcdc('0x33')],qs[_0xdcdc('0x35')](_0x39a41e['query'][_0xdcdc('0x35')]));_0xead877[_0xdcdc('0x34')]=_0xead877[_0xdcdc('0x34')][_0xdcdc('0x36')]?_0xead877[_0xdcdc('0x34')]:_0x398b58[_0xdcdc('0x33')];if(_0x39a41e[_0xdcdc('0x2f')][_0xdcdc('0x40')]){_0xead877[_0xdcdc('0x45')]=[{'all':!![]}];}_0xead877=_[_0xdcdc('0x3e')]({},_0xead877,_0x39a41e[_0xdcdc('0x46')]);return db[_0xdcdc('0x44')][_0xdcdc('0x47')](_0xead877)['then'](handleEntityNotFound(_0x3978af,null))[_0xdcdc('0x24')](respondWithResult(_0x3978af,null))[_0xdcdc('0x48')](handleError(_0x3978af,null));};exports[_0xdcdc('0x49')]=function(_0x4c0a7f,_0x121dca){return db['IntegrationReport'][_0xdcdc('0x49')](_0x4c0a7f[_0xdcdc('0x4a')],{})[_0xdcdc('0x24')](respondWithResult(_0x121dca,0xc9))['catch'](handleError(_0x121dca,null));};exports[_0xdcdc('0x23')]=function(_0x5e7c2d,_0x5d4548){if(_0x5e7c2d['body']['id']){delete _0x5e7c2d[_0xdcdc('0x4a')]['id'];}return db[_0xdcdc('0x44')]['find']({'where':{'id':_0x5e7c2d[_0xdcdc('0x43')]['id']}})[_0xdcdc('0x24')](handleEntityNotFound(_0x5d4548,null))['then'](saveUpdates(_0x5e7c2d['body'],null))[_0xdcdc('0x24')](respondWithResult(_0x5d4548,null))[_0xdcdc('0x48')](handleError(_0x5d4548,null));};exports[_0xdcdc('0x25')]=function(_0x5690e6,_0x123efd){return db['IntegrationReport']['find']({'where':{'id':_0x5690e6[_0xdcdc('0x43')]['id']}})['then'](handleEntityNotFound(_0x123efd,null))[_0xdcdc('0x24')](removeEntity(_0x123efd,null))['catch'](handleError(_0x123efd,null));};exports[_0xdcdc('0x4b')]=function(_0x47b748,_0x252c93){return db[_0xdcdc('0x44')]['describe']()[_0xdcdc('0x24')](respondWithResult(_0x252c93,null))[_0xdcdc('0x48')](handleError(_0x252c93,null));}; \ No newline at end of file +var _0x08bc=['limit','count','offset','set','Content-Range','apply','save','update','then','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x585b3f,_0x3e2d2b){var _0x20c3cc=function(_0x40d561){while(--_0x40d561){_0x585b3f['push'](_0x585b3f['shift']());}};_0x20c3cc(++_0x3e2d2b);}(_0x08bc,0x116));var _0xc08b=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x08bc[_0x491cbe];return _0x59449d;};'use strict';var emlformat=require(_0xc08b('0x0'));var rimraf=require(_0xc08b('0x1'));var zipdir=require(_0xc08b('0x2'));var jsonpatch=require(_0xc08b('0x3'));var rp=require(_0xc08b('0x4'));var moment=require(_0xc08b('0x5'));var BPromise=require(_0xc08b('0x6'));var Mustache=require(_0xc08b('0x7'));var util=require(_0xc08b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc08b('0x9'));var ejs=require(_0xc08b('0xa'));var fs=require('fs');var fs_extra=require(_0xc08b('0xb'));var _=require(_0xc08b('0xc'));var squel=require(_0xc08b('0xd'));var crypto=require(_0xc08b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc08b('0xf'));var Papa=require('papaparse');var Redis=require(_0xc08b('0x10'));var authService=require(_0xc08b('0x11'));var qs=require(_0xc08b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc08b('0x13'));var logger=require(_0xc08b('0x14'))('api');var utils=require(_0xc08b('0x15'));var config=require(_0xc08b('0x16'));var licenseUtil=require(_0xc08b('0x17'));var db=require(_0xc08b('0x18'))['db'];function respondWithStatusCode(_0x2780a8,_0x2b1045){_0x2b1045=_0x2b1045||0xcc;return function(_0x2eabf8){if(_0x2eabf8){return _0x2780a8[_0xc08b('0x19')](_0x2b1045);}return _0x2780a8[_0xc08b('0x1a')](_0x2b1045)[_0xc08b('0x1b')]();};}function respondWithResult(_0x5dadc0,_0xee0b84){_0xee0b84=_0xee0b84||0xc8;return function(_0x1f684d){if(_0x1f684d){return _0x5dadc0[_0xc08b('0x1a')](_0xee0b84)[_0xc08b('0x1c')](_0x1f684d);}};}function respondWithFilteredResult(_0x205227,_0x31bbb9){return function(_0x35b111){if(_0x35b111){var _0x132422=typeof _0x31bbb9['offset']===_0xc08b('0x1d')&&typeof _0x31bbb9[_0xc08b('0x1e')]===_0xc08b('0x1d');var _0x41b3bf=_0x35b111[_0xc08b('0x1f')];var _0x5b0eaf=_0x132422?0x0:_0x31bbb9[_0xc08b('0x20')];var _0x4d0c65=_0x132422?_0x35b111[_0xc08b('0x1f')]:_0x31bbb9[_0xc08b('0x20')]+_0x31bbb9[_0xc08b('0x1e')];var _0x2ab98d;if(_0x4d0c65>=_0x41b3bf){_0x4d0c65=_0x41b3bf;_0x2ab98d=0xc8;}else{_0x2ab98d=0xce;}_0x205227['status'](_0x2ab98d);return _0x205227[_0xc08b('0x21')](_0xc08b('0x22'),_0x5b0eaf+'-'+_0x4d0c65+'/'+_0x41b3bf)[_0xc08b('0x1c')](_0x35b111);}return null;};}function patchUpdates(_0x55908b){return function(_0x4e5ef3){try{jsonpatch[_0xc08b('0x23')](_0x4e5ef3,_0x55908b,!![]);}catch(_0x69930d){return BPromise['reject'](_0x69930d);}return _0x4e5ef3[_0xc08b('0x24')]();};}function saveUpdates(_0x209947,_0x16b0ab){return function(_0xb42fbf){if(_0xb42fbf){return _0xb42fbf[_0xc08b('0x25')](_0x209947)[_0xc08b('0x26')](function(_0x5945ab){return _0x5945ab;});}return null;};}function removeEntity(_0x29b5c,_0x2bdb8a){return function(_0x3bdefc){if(_0x3bdefc){return _0x3bdefc['destroy']()['then'](function(){_0x29b5c[_0xc08b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x205da7,_0x38f8ee){return function(_0x491a5f){if(!_0x491a5f){_0x205da7['sendStatus'](0x194);}return _0x491a5f;};}function handleError(_0x29b0fc,_0x2da9be){_0x2da9be=_0x2da9be||0x1f4;return function(_0x2e060c){logger[_0xc08b('0x27')](_0x2e060c['stack']);if(_0x2e060c[_0xc08b('0x28')]){delete _0x2e060c[_0xc08b('0x28')];}_0x29b0fc[_0xc08b('0x1a')](_0x2da9be)[_0xc08b('0x29')](_0x2e060c);};}exports[_0xc08b('0x2a')]=function(_0x35b8cd,_0xfabdd2){var _0x2b18df={},_0x481fa8={},_0x1efda4={'count':0x0,'rows':[]};var _0x5231c5=_[_0xc08b('0x2b')](db[_0xc08b('0x2c')][_0xc08b('0x2d')],function(_0x1c307d){return{'name':_0x1c307d[_0xc08b('0x2e')],'type':_0x1c307d[_0xc08b('0x2f')]['key']};});_0x481fa8[_0xc08b('0x30')]=_['map'](_0x5231c5,'name');_0x481fa8['query']=_[_0xc08b('0x31')](_0x35b8cd[_0xc08b('0x32')]);_0x481fa8[_0xc08b('0x33')]=_[_0xc08b('0x34')](_0x481fa8['model'],_0x481fa8[_0xc08b('0x32')]);_0x2b18df['attributes']=_['intersection'](_0x481fa8[_0xc08b('0x30')],qs[_0xc08b('0x35')](_0x35b8cd[_0xc08b('0x32')]['fields']));_0x2b18df[_0xc08b('0x36')]=_0x2b18df[_0xc08b('0x36')][_0xc08b('0x37')]?_0x2b18df[_0xc08b('0x36')]:_0x481fa8['model'];if(!_0x35b8cd[_0xc08b('0x32')][_0xc08b('0x38')](_0xc08b('0x39'))){_0x2b18df[_0xc08b('0x1e')]=qs[_0xc08b('0x1e')](_0x35b8cd[_0xc08b('0x32')][_0xc08b('0x1e')]);_0x2b18df[_0xc08b('0x20')]=qs[_0xc08b('0x20')](_0x35b8cd[_0xc08b('0x32')]['offset']);}_0x2b18df[_0xc08b('0x3a')]=qs['sort'](_0x35b8cd[_0xc08b('0x32')][_0xc08b('0x3b')]);_0x2b18df[_0xc08b('0x3c')]=qs[_0xc08b('0x33')](_[_0xc08b('0x3d')](_0x35b8cd[_0xc08b('0x32')],_0x481fa8[_0xc08b('0x33')]),_0x5231c5);if(_0x35b8cd[_0xc08b('0x32')][_0xc08b('0x3e')]){_0x2b18df[_0xc08b('0x3c')]=_[_0xc08b('0x3f')](_0x2b18df[_0xc08b('0x3c')],{'$or':_[_0xc08b('0x2b')](_0x5231c5,function(_0x1dde53){if(_0x1dde53[_0xc08b('0x2f')]!==_0xc08b('0x40')){var _0x222285={};_0x222285[_0x1dde53[_0xc08b('0x28')]]={'$like':'%'+_0x35b8cd[_0xc08b('0x32')][_0xc08b('0x3e')]+'%'};return _0x222285;}})});}_0x2b18df=_[_0xc08b('0x3f')]({},_0x2b18df,_0x35b8cd['options']);var _0x4a6786={'where':_0x2b18df[_0xc08b('0x3c')]};return db[_0xc08b('0x2c')][_0xc08b('0x1f')](_0x4a6786)[_0xc08b('0x26')](function(_0x372804){_0x1efda4[_0xc08b('0x1f')]=_0x372804;if(_0x35b8cd[_0xc08b('0x32')][_0xc08b('0x41')]){_0x2b18df[_0xc08b('0x42')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x2b18df);})[_0xc08b('0x26')](function(_0x33146e){_0x1efda4[_0xc08b('0x43')]=_0x33146e;return _0x1efda4;})[_0xc08b('0x26')](respondWithFilteredResult(_0xfabdd2,_0x2b18df))[_0xc08b('0x44')](handleError(_0xfabdd2,null));};exports[_0xc08b('0x45')]=function(_0x5e693c,_0x7481f1){var _0x384b9b={'raw':![],'where':{'id':_0x5e693c[_0xc08b('0x46')]['id']}},_0x1bc17a={};_0x1bc17a[_0xc08b('0x30')]=_['keys'](db['IntegrationReport'][_0xc08b('0x2d')]);_0x1bc17a[_0xc08b('0x32')]=_[_0xc08b('0x31')](_0x5e693c['query']);_0x1bc17a[_0xc08b('0x33')]=_['intersection'](_0x1bc17a[_0xc08b('0x30')],_0x1bc17a['query']);_0x384b9b[_0xc08b('0x36')]=_[_0xc08b('0x34')](_0x1bc17a[_0xc08b('0x30')],qs[_0xc08b('0x35')](_0x5e693c['query'][_0xc08b('0x35')]));_0x384b9b['attributes']=_0x384b9b['attributes']['length']?_0x384b9b[_0xc08b('0x36')]:_0x1bc17a[_0xc08b('0x30')];if(_0x5e693c[_0xc08b('0x32')][_0xc08b('0x41')]){_0x384b9b[_0xc08b('0x42')]=[{'all':!![]}];}_0x384b9b=_[_0xc08b('0x3f')]({},_0x384b9b,_0x5e693c[_0xc08b('0x47')]);return db[_0xc08b('0x2c')][_0xc08b('0x48')](_0x384b9b)[_0xc08b('0x26')](handleEntityNotFound(_0x7481f1,null))['then'](respondWithResult(_0x7481f1,null))[_0xc08b('0x44')](handleError(_0x7481f1,null));};exports['create']=function(_0x15022e,_0x26e8bf){return db[_0xc08b('0x2c')][_0xc08b('0x49')](_0x15022e['body'],{})[_0xc08b('0x26')](respondWithResult(_0x26e8bf,0xc9))[_0xc08b('0x44')](handleError(_0x26e8bf,null));};exports[_0xc08b('0x25')]=function(_0x3ec174,_0x393e78){if(_0x3ec174[_0xc08b('0x4a')]['id']){delete _0x3ec174['body']['id'];}return db[_0xc08b('0x2c')][_0xc08b('0x48')]({'where':{'id':_0x3ec174[_0xc08b('0x46')]['id']}})[_0xc08b('0x26')](handleEntityNotFound(_0x393e78,null))[_0xc08b('0x26')](saveUpdates(_0x3ec174[_0xc08b('0x4a')],null))[_0xc08b('0x26')](respondWithResult(_0x393e78,null))['catch'](handleError(_0x393e78,null));};exports[_0xc08b('0x4b')]=function(_0x5141f2,_0x251b9f){return db['IntegrationReport'][_0xc08b('0x48')]({'where':{'id':_0x5141f2['params']['id']}})[_0xc08b('0x26')](handleEntityNotFound(_0x251b9f,null))[_0xc08b('0x26')](removeEntity(_0x251b9f,null))[_0xc08b('0x44')](handleError(_0x251b9f,null));};exports['describe']=function(_0x16b67b,_0x309a28){return db[_0xc08b('0x2c')][_0xc08b('0x4c')]()['then'](respondWithResult(_0x309a28,null))[_0xc08b('0x44')](handleError(_0x309a28,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d2a7457..ff61d57 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 _0x27fb=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1fc663,_0x4ae2c8){var _0x38069b=function(_0x789c9f){while(--_0x789c9f){_0x1fc663['push'](_0x1fc663['shift']());}};_0x38069b(++_0x4ae2c8);}(_0x27fb,0x10e));var _0xb27f=function(_0x101317,_0x162be8){_0x101317=_0x101317-0x0;var _0x481e49=_0x27fb[_0x101317];return _0x481e49;};'use strict';var _=require(_0xb27f('0x0'));var util=require(_0xb27f('0x1'));var logger=require(_0xb27f('0x2'))(_0xb27f('0x3'));var moment=require(_0xb27f('0x4'));var BPromise=require(_0xb27f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb27f('0x6'));var rimraf=require(_0xb27f('0x7'));var config=require(_0xb27f('0x8'));var attributes=require(_0xb27f('0x9'));module[_0xb27f('0xa')]=function(_0x2f480c,_0x132951){return _0x2f480c['define'](_0xb27f('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4243=['exports','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4243,0x17b));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3424('0x0'));var util=require(_0x3424('0x1'));var logger=require(_0x3424('0x2'))(_0x3424('0x3'));var moment=require(_0x3424('0x4'));var BPromise=require(_0x3424('0x5'));var rp=require(_0x3424('0x6'));var fs=require('fs');var path=require(_0x3424('0x7'));var rimraf=require(_0x3424('0x8'));var config=require(_0x3424('0x9'));var attributes=require(_0x3424('0xa'));module[_0x3424('0xb')]=function(_0x5bf941,_0x36baad){return _0x5bf941['define']('IntegrationReport',attributes,{'tableName':_0x3424('0xc'),'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 c833dbb..e8c9b9e 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 _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0xfbcf09,_0x1289a4){var _0x4b3146=function(_0x11d337){while(--_0x11d337){_0xfbcf09['push'](_0xfbcf09['shift']());}};_0x4b3146(++_0x1289a4);}(_0x2675,0x75));var _0x5267=function(_0x55a611,_0x16b06b){_0x55a611=_0x55a611-0x0;var _0x90295e=_0x2675[_0x55a611];return _0x90295e;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file +var _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5f5175,_0x3d25d8){var _0x1af827=function(_0x54b17e){while(--_0x54b17e){_0x5f5175['push'](_0x5f5175['shift']());}};_0x1af827(++_0x3d25d8);}(_0xda19,0xd5));var _0x9da1=function(_0x11b1f5,_0x14a5e0){_0x11b1f5=_0x11b1f5-0x0;var _0x54ff40=_0xda19[_0x11b1f5];return _0x54ff40;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index b1e24f3..97c1588 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 _0x7ae8=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy'];(function(_0x176763,_0x38735a){var _0xcd889b=function(_0x3d95a8){while(--_0x3d95a8){_0x176763['push'](_0x176763['shift']());}};_0xcd889b(++_0x38735a);}(_0x7ae8,0x142));var _0x87ae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ae8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x87ae('0x0'));var path=require('path');var timeout=require(_0x87ae('0x1'));var express=require(_0x87ae('0x2'));var router=express[_0x87ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x87ae('0x4'));var interaction=require(_0x87ae('0x5'));var config=require(_0x87ae('0x6'));var controller=require(_0x87ae('0x7'));router[_0x87ae('0x8')]('/',auth[_0x87ae('0x9')](),controller[_0x87ae('0xa')]);router[_0x87ae('0x8')](_0x87ae('0xb'),auth['isAuthenticated'](),controller[_0x87ae('0xc')]);router['get'](_0x87ae('0xd'),auth[_0x87ae('0x9')](),controller[_0x87ae('0xe')]);router[_0x87ae('0xf')]('/',auth[_0x87ae('0x9')](),controller['create']);router[_0x87ae('0xf')]('/:id/sub_intervals',auth[_0x87ae('0x9')](),controller[_0x87ae('0x10')]);router['post'](_0x87ae('0x11'),auth['isAuthenticated'](),controller[_0x87ae('0x12')]);router[_0x87ae('0x13')](_0x87ae('0xb'),auth[_0x87ae('0x9')](),controller[_0x87ae('0x14')]);router[_0x87ae('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x87ae('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1c90=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','create'];(function(_0x4ef639,_0xe3c056){var _0x22ccd3=function(_0x48628d){while(--_0x48628d){_0x4ef639['push'](_0x4ef639['shift']());}};_0x22ccd3(++_0xe3c056);}(_0x1c90,0x104));var _0x01c9=function(_0x30d7bc,_0x7c8d91){_0x30d7bc=_0x30d7bc-0x0;var _0x59efa8=_0x1c90[_0x30d7bc];return _0x59efa8;};'use strict';var multer=require('multer');var util=require(_0x01c9('0x0'));var path=require(_0x01c9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01c9('0x2')]();var fs_extra=require(_0x01c9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x01c9('0x4'));var config=require(_0x01c9('0x5'));var controller=require(_0x01c9('0x6'));router['get']('/',auth[_0x01c9('0x7')](),controller[_0x01c9('0x8')]);router[_0x01c9('0x9')](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller[_0x01c9('0xb')]);router[_0x01c9('0x9')](_0x01c9('0xc'),auth['isAuthenticated'](),controller[_0x01c9('0xd')]);router[_0x01c9('0xe')]('/',auth[_0x01c9('0x7')](),controller[_0x01c9('0xf')]);router[_0x01c9('0xe')](_0x01c9('0xc'),auth['isAuthenticated'](),controller[_0x01c9('0x10')]);router[_0x01c9('0xe')](_0x01c9('0x11'),auth['isAuthenticated'](),controller[_0x01c9('0x12')]);router[_0x01c9('0x13')](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x14')]);router[_0x01c9('0x15')](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 155ba42..b7e2d92 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 _0x8aa2=['sequelize','exports','STRING'];(function(_0x8472fe,_0x4c0476){var _0xccb121=function(_0x7eae51){while(--_0x7eae51){_0x8472fe['push'](_0x8472fe['shift']());}};_0xccb121(++_0x4c0476);}(_0x8aa2,0x18c));var _0x28aa=function(_0x1aa51d,_0x496951){_0x1aa51d=_0x1aa51d-0x0;var _0x54da50=_0x8aa2[_0x1aa51d];return _0x54da50;};'use strict';var Sequelize=require(_0x28aa('0x0'));module[_0x28aa('0x1')]={'name':{'type':Sequelize[_0x28aa('0x2')]},'description':{'type':Sequelize[_0x28aa('0x2')]},'interval':{'type':Sequelize[_0x28aa('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb846=['sequelize','STRING'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xb846,0x17c));var _0x6b84=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb846[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0x6b84('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b84('0x1')]},'description':{'type':Sequelize[_0x6b84('0x1')]},'interval':{'type':Sequelize[_0x6b84('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 2a94f74..644350a 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 _0xe2eb=['limit','count','status','set','json','apply','save','then','destroy','get','Intervals','UserProfileResource','name','Interval','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined'];(function(_0x418320,_0x1481d7){var _0x17b65d=function(_0x4c9d78){while(--_0x4c9d78){_0x418320['push'](_0x418320['shift']());}};_0x17b65d(++_0x1481d7);}(_0xe2eb,0x8d));var _0xbe2e=function(_0x11e1a0,_0x14c858){_0x11e1a0=_0x11e1a0-0x0;var _0x584e19=_0xe2eb[_0x11e1a0];return _0x584e19;};'use strict';var emlformat=require(_0xbe2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe2e('0x1'));var jsonpatch=require(_0xbe2e('0x2'));var rp=require('request-promise');var moment=require(_0xbe2e('0x3'));var BPromise=require(_0xbe2e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe2e('0x5'));var sox=require(_0xbe2e('0x6'));var csv=require(_0xbe2e('0x7'));var ejs=require(_0xbe2e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbe2e('0x9'));var crypto=require(_0xbe2e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbe2e('0x7'));var querystring=require('querystring');var Papa=require(_0xbe2e('0xb'));var Redis=require(_0xbe2e('0xc'));var authService=require(_0xbe2e('0xd'));var qs=require(_0xbe2e('0xe'));var as=require(_0xbe2e('0xf'));var hardwareService=require(_0xbe2e('0x10'));var logger=require(_0xbe2e('0x11'))('api');var utils=require(_0xbe2e('0x12'));var config=require(_0xbe2e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe2e('0x14'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x4cf635,_0x27eca8){_0x27eca8=_0x27eca8||0xcc;return function(_0x2a05c9){if(_0x2a05c9){return _0x4cf635[_0xbe2e('0x15')](_0x27eca8);}return _0x4cf635['status'](_0x27eca8)[_0xbe2e('0x16')]();};}function respondWithResult(_0x2b8cb6,_0x4e0318){_0x4e0318=_0x4e0318||0xc8;return function(_0x5e9134){if(_0x5e9134){return _0x2b8cb6['status'](_0x4e0318)['json'](_0x5e9134);}};}function respondWithFilteredResult(_0x2fdf11,_0x2d4e53){return function(_0x3a92d4){if(_0x3a92d4){var _0x15ea4b=typeof _0x2d4e53[_0xbe2e('0x17')]===_0xbe2e('0x18')&&typeof _0x2d4e53[_0xbe2e('0x19')]==='undefined';var _0x1d43ac=_0x3a92d4['count'];var _0x44da31=_0x15ea4b?0x0:_0x2d4e53[_0xbe2e('0x17')];var _0x5811fd=_0x15ea4b?_0x3a92d4[_0xbe2e('0x1a')]:_0x2d4e53[_0xbe2e('0x17')]+_0x2d4e53[_0xbe2e('0x19')];var _0x2f577b;if(_0x5811fd>=_0x1d43ac){_0x5811fd=_0x1d43ac;_0x2f577b=0xc8;}else{_0x2f577b=0xce;}_0x2fdf11[_0xbe2e('0x1b')](_0x2f577b);return _0x2fdf11[_0xbe2e('0x1c')]('Content-Range',_0x44da31+'-'+_0x5811fd+'/'+_0x1d43ac)[_0xbe2e('0x1d')](_0x3a92d4);}return null;};}function patchUpdates(_0x5ea810){return function(_0x3b1412){try{jsonpatch[_0xbe2e('0x1e')](_0x3b1412,_0x5ea810,!![]);}catch(_0x3fd17b){return BPromise['reject'](_0x3fd17b);}return _0x3b1412[_0xbe2e('0x1f')]();};}function saveUpdates(_0x590ea,_0x44239a){return function(_0xc5b98){if(_0xc5b98){return _0xc5b98['update'](_0x590ea)[_0xbe2e('0x20')](function(_0x3ba751){return _0x3ba751;});}return null;};}function removeEntity(_0x3cd299,_0x5bdf66){return function(_0x224961){if(_0x224961){return _0x224961[_0xbe2e('0x21')]()['then'](function(){var _0x18b313=_0x224961[_0xbe2e('0x22')]({'plain':!![]});var _0x448e6f=_0xbe2e('0x23');return db[_0xbe2e('0x24')]['destroy']({'where':{'type':_0x448e6f,'resourceId':_0x18b313['id']}})[_0xbe2e('0x20')](function(){return _0x224961;});})['then'](function(){_0x3cd299[_0xbe2e('0x1b')](0xcc)[_0xbe2e('0x16')]();});}};}function handleEntityNotFound(_0x5fd355,_0x171b92){return function(_0x1804bf){if(!_0x1804bf){_0x5fd355[_0xbe2e('0x15')](0x194);}return _0x1804bf;};}function handleError(_0x2d76ec,_0x400c55){_0x400c55=_0x400c55||0x1f4;return function(_0x36f8e9){logger['error'](_0x36f8e9['stack']);if(_0x36f8e9[_0xbe2e('0x25')]){delete _0x36f8e9['name'];}_0x2d76ec[_0xbe2e('0x1b')](_0x400c55)['send'](_0x36f8e9);};}exports['index']=function(_0x2c10ab,_0x428730){var _0x517735={},_0x281fd0={},_0x6f36e4={'count':0x0,'rows':[]};var _0x501f02=_['map'](db[_0xbe2e('0x26')][_0xbe2e('0x27')],function(_0x1e01be){return{'name':_0x1e01be[_0xbe2e('0x28')],'type':_0x1e01be[_0xbe2e('0x29')][_0xbe2e('0x2a')]};});_0x281fd0[_0xbe2e('0x2b')]=_[_0xbe2e('0x2c')](_0x501f02,_0xbe2e('0x25'));_0x281fd0[_0xbe2e('0x2d')]=_['keys'](_0x2c10ab[_0xbe2e('0x2d')]);_0x281fd0['filters']=_['intersection'](_0x281fd0['model'],_0x281fd0[_0xbe2e('0x2d')]);_0x517735[_0xbe2e('0x2e')]=_[_0xbe2e('0x2f')](_0x281fd0[_0xbe2e('0x2b')],qs[_0xbe2e('0x30')](_0x2c10ab[_0xbe2e('0x2d')][_0xbe2e('0x30')]));_0x517735[_0xbe2e('0x2e')]=_0x517735[_0xbe2e('0x2e')][_0xbe2e('0x31')]?_0x517735[_0xbe2e('0x2e')]:_0x281fd0[_0xbe2e('0x2b')];if(!_0x2c10ab[_0xbe2e('0x2d')][_0xbe2e('0x32')]('nolimit')){_0x517735[_0xbe2e('0x19')]=qs[_0xbe2e('0x19')](_0x2c10ab[_0xbe2e('0x2d')][_0xbe2e('0x19')]);_0x517735[_0xbe2e('0x17')]=qs[_0xbe2e('0x17')](_0x2c10ab[_0xbe2e('0x2d')][_0xbe2e('0x17')]);}_0x517735[_0xbe2e('0x33')]=qs[_0xbe2e('0x34')](_0x2c10ab['query'][_0xbe2e('0x34')]);_0x517735[_0xbe2e('0x35')]=qs[_0xbe2e('0x36')](_[_0xbe2e('0x37')](_0x2c10ab[_0xbe2e('0x2d')],_0x281fd0[_0xbe2e('0x36')]),_0x501f02);if(_0x2c10ab[_0xbe2e('0x2d')]['filter']){_0x517735[_0xbe2e('0x35')]=_[_0xbe2e('0x38')](_0x517735[_0xbe2e('0x35')],{'$or':_[_0xbe2e('0x2c')](_0x501f02,function(_0x3f4a21){if(_0x3f4a21['type']!==_0xbe2e('0x39')){var _0x20e567={};_0x20e567[_0x3f4a21[_0xbe2e('0x25')]]={'$like':'%'+_0x2c10ab['query'][_0xbe2e('0x3a')]+'%'};return _0x20e567;}})});}_0x517735=_[_0xbe2e('0x38')]({},_0x517735,_0x2c10ab[_0xbe2e('0x3b')]);var _0x273c65={'where':_0x517735[_0xbe2e('0x35')]};return db[_0xbe2e('0x26')][_0xbe2e('0x1a')](_0x273c65)[_0xbe2e('0x20')](function(_0x54f9c5){_0x6f36e4[_0xbe2e('0x1a')]=_0x54f9c5;if(_0x2c10ab['query'][_0xbe2e('0x3c')]){_0x517735['include']=[{'all':!![]}];}return db[_0xbe2e('0x26')][_0xbe2e('0x3d')](_0x517735);})[_0xbe2e('0x20')](function(_0x196db9){_0x6f36e4[_0xbe2e('0x3e')]=_0x196db9;return _0x6f36e4;})['then'](respondWithFilteredResult(_0x428730,_0x517735))['catch'](handleError(_0x428730,null));};exports[_0xbe2e('0x3f')]=function(_0x2fa498,_0x17e671){var _0x4972ff={'raw':!![],'where':{'id':_0x2fa498[_0xbe2e('0x40')]['id']}},_0x588a4b={};_0x588a4b['model']=_[_0xbe2e('0x41')](db['Interval'][_0xbe2e('0x27')]);_0x588a4b[_0xbe2e('0x2d')]=_['keys'](_0x2fa498['query']);_0x588a4b[_0xbe2e('0x36')]=_[_0xbe2e('0x2f')](_0x588a4b[_0xbe2e('0x2b')],_0x588a4b[_0xbe2e('0x2d')]);_0x4972ff[_0xbe2e('0x2e')]=_[_0xbe2e('0x2f')](_0x588a4b[_0xbe2e('0x2b')],qs[_0xbe2e('0x30')](_0x2fa498[_0xbe2e('0x2d')][_0xbe2e('0x30')]));_0x4972ff[_0xbe2e('0x2e')]=_0x4972ff['attributes']['length']?_0x4972ff[_0xbe2e('0x2e')]:_0x588a4b[_0xbe2e('0x2b')];if(_0x2fa498['query'][_0xbe2e('0x3c')]){_0x4972ff[_0xbe2e('0x42')]=[{'all':!![]}];}_0x4972ff=_[_0xbe2e('0x38')]({},_0x4972ff,_0x2fa498['options']);return db[_0xbe2e('0x26')][_0xbe2e('0x43')](_0x4972ff)[_0xbe2e('0x20')](handleEntityNotFound(_0x17e671,null))[_0xbe2e('0x20')](respondWithResult(_0x17e671,null))['catch'](handleError(_0x17e671,null));};exports['create']=function(_0x600a96,_0x3568b0){return db[_0xbe2e('0x26')][_0xbe2e('0x44')](_0x600a96[_0xbe2e('0x45')],{})[_0xbe2e('0x20')](function(_0x3f4248){var _0x27719a=_0x600a96['user'][_0xbe2e('0x22')]({'plain':!![]});if(!_0x27719a)throw new Error(_0xbe2e('0x46'));if(_0x27719a[_0xbe2e('0x47')]==='user'){var _0x47aff4=_0x3f4248['get']({'plain':!![]});var _0x3c7d94=_0xbe2e('0x23');return db['UserProfileSection'][_0xbe2e('0x43')]({'where':{'name':_0x3c7d94,'userProfileId':_0x27719a['userProfileId']},'raw':!![]})[_0xbe2e('0x20')](function(_0x2d01da){if(_0x2d01da&&_0x2d01da[_0xbe2e('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x47aff4['name'],'resourceId':_0x47aff4['id'],'type':_0x2d01da[_0xbe2e('0x25')],'sectionId':_0x2d01da['id']},{})[_0xbe2e('0x20')](function(){return _0x3f4248;});}else{return _0x3f4248;}})['catch'](function(_0x2b265f){logger[_0xbe2e('0x49')](_0xbe2e('0x4a'),_0x2b265f);throw _0x2b265f;});}return _0x3f4248;})['then'](respondWithResult(_0x3568b0,0xc9))[_0xbe2e('0x4b')](handleError(_0x3568b0,null));};exports[_0xbe2e('0x4c')]=function(_0x3eaa81,_0x2f4c48){if(_0x3eaa81[_0xbe2e('0x45')]['id']){delete _0x3eaa81[_0xbe2e('0x45')]['id'];}return db['Interval']['find']({'where':{'id':_0x3eaa81['params']['id']}})[_0xbe2e('0x20')](handleEntityNotFound(_0x2f4c48,null))[_0xbe2e('0x20')](saveUpdates(_0x3eaa81[_0xbe2e('0x45')],null))['then'](respondWithResult(_0x2f4c48,null))['catch'](handleError(_0x2f4c48,null));};exports[_0xbe2e('0x21')]=function(_0x2c864c,_0x387e53){return db[_0xbe2e('0x26')]['find']({'where':{'id':_0x2c864c[_0xbe2e('0x40')]['id']}})[_0xbe2e('0x20')](handleEntityNotFound(_0x387e53,null))['then'](removeEntity(_0x387e53,null))[_0xbe2e('0x4b')](handleError(_0x387e53,null));};exports[_0xbe2e('0x4d')]=function(_0x17c163,_0x4b1590,_0x3bd3c5){if(_0x17c163['body']['id']){delete _0x17c163['body']['id'];}return db[_0xbe2e('0x26')][_0xbe2e('0x43')]({'where':{'id':_0x17c163['params']['id']}})[_0xbe2e('0x20')](handleEntityNotFound(_0x4b1590,null))[_0xbe2e('0x20')](function(_0x3f0204){if(_0x3f0204){_0x17c163[_0xbe2e('0x45')][_0xbe2e('0x4e')]=_0x3f0204['id'];return db[_0xbe2e('0x26')]['create'](_0x17c163['body']);}})[_0xbe2e('0x20')](respondWithResult(_0x4b1590,null))[_0xbe2e('0x4b')](handleError(_0x4b1590,null));};exports['getIntervals']=function(_0x49cd48,_0x62fcaa,_0x48acf4){var _0x1d782f={};var _0x52f409={};var _0x4f47c7;var _0x379f31;return db[_0xbe2e('0x26')]['findOne']({'where':{'id':_0x49cd48['params']['id']}})[_0xbe2e('0x20')](handleEntityNotFound(_0x62fcaa,null))['then'](function(_0xbdfaa0){if(_0xbdfaa0){_0x4f47c7=_0xbdfaa0;_0x52f409['model']=_[_0xbe2e('0x41')](db[_0xbe2e('0x26')][_0xbe2e('0x27')]);_0x52f409['query']=_['keys'](_0x49cd48[_0xbe2e('0x2d')]);_0x52f409[_0xbe2e('0x36')]=_[_0xbe2e('0x2f')](_0x52f409[_0xbe2e('0x2b')],_0x52f409['query']);_0x1d782f[_0xbe2e('0x2e')]=_[_0xbe2e('0x2f')](_0x52f409[_0xbe2e('0x2b')],qs[_0xbe2e('0x30')](_0x49cd48[_0xbe2e('0x2d')][_0xbe2e('0x30')]));_0x1d782f['attributes']=_0x1d782f[_0xbe2e('0x2e')]['length']?_0x1d782f[_0xbe2e('0x2e')]:_0x52f409['model'];_0x1d782f['order']=qs[_0xbe2e('0x34')](_0x49cd48[_0xbe2e('0x2d')][_0xbe2e('0x34')]);_0x1d782f[_0xbe2e('0x35')]=qs['filters'](_[_0xbe2e('0x37')](_0x49cd48['query'],_0x52f409[_0xbe2e('0x36')]));if(_0x49cd48[_0xbe2e('0x2d')][_0xbe2e('0x3a')]){_0x1d782f[_0xbe2e('0x35')]=_[_0xbe2e('0x38')](_0x1d782f['where'],{'$or':_[_0xbe2e('0x2c')](_0x1d782f[_0xbe2e('0x2e')],function(_0x2eb4f1){var _0x4e6917={};_0x4e6917[_0x2eb4f1]={'$like':'%'+_0x49cd48[_0xbe2e('0x2d')][_0xbe2e('0x3a')]+'%'};return _0x4e6917;})});}_0x1d782f=_[_0xbe2e('0x38')]({},_0x1d782f,_0x49cd48[_0xbe2e('0x3b')]);return _0x4f47c7[_0xbe2e('0x4f')](_0x1d782f);}})[_0xbe2e('0x20')](function(_0x35cb42){if(_0x35cb42){_0x379f31=_0x35cb42[_0xbe2e('0x31')];if(!_0x49cd48[_0xbe2e('0x2d')][_0xbe2e('0x32')]('nolimit')){_0x1d782f[_0xbe2e('0x19')]=qs[_0xbe2e('0x19')](_0x49cd48[_0xbe2e('0x2d')][_0xbe2e('0x19')]);_0x1d782f[_0xbe2e('0x17')]=qs['offset'](_0x49cd48[_0xbe2e('0x2d')][_0xbe2e('0x17')]);}return _0x4f47c7[_0xbe2e('0x4f')](_0x1d782f);}})['then'](function(_0x1d4c7a){if(_0x1d4c7a){return _0x1d4c7a?{'count':_0x379f31,'rows':_0x1d4c7a}:null;}})['then'](respondWithResult(_0x62fcaa,null))[_0xbe2e('0x4b')](handleError(_0x62fcaa,null));};exports['addIntervals']=function(_0x274d38,_0x2ec378,_0x47980f){return db[_0xbe2e('0x26')][_0xbe2e('0x50')]({'where':{'id':_0x274d38[_0xbe2e('0x40')]['id']}})[_0xbe2e('0x20')](handleEntityNotFound(_0x2ec378,null))[_0xbe2e('0x20')](function(_0x90c0f){if(_0x90c0f){return db[_0xbe2e('0x51')][_0xbe2e('0x52')](function(_0x3fa2a9){return db[_0xbe2e('0x26')][_0xbe2e('0x21')]({'where':{'IntervalId':_0x274d38[_0xbe2e('0x40')]['id']},'transaction':_0x3fa2a9})[_0xbe2e('0x20')](function(_0x562ea8){var _0x13b0f0=_[_0xbe2e('0x2c')](_0x274d38['body'],function(_0x5ad0e5){delete _0x5ad0e5['id'];_0x5ad0e5[_0xbe2e('0x4e')]=_0x274d38[_0xbe2e('0x40')]['id'];return _0x5ad0e5;});return db[_0xbe2e('0x26')]['bulkCreate'](_0x13b0f0,{'transaction':_0x3fa2a9});});})[_0xbe2e('0x20')](function(){return db[_0xbe2e('0x26')][_0xbe2e('0x3d')]({'where':{'IntervalId':_0x274d38[_0xbe2e('0x40')]['id']}});});}})[_0xbe2e('0x20')](respondWithResult(_0x2ec378,null))[_0xbe2e('0x4b')](handleError(_0x2ec378,null));}; \ No newline at end of file +var _0xf863=['filter','where','merge','VIRTUAL','options','Interval','include','find','catch','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','params','addInterval','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','then','get','Intervals','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0xa4e494,_0x43ed19){var _0x258bb8=function(_0xdcb7b6){while(--_0xdcb7b6){_0xa4e494['push'](_0xa4e494['shift']());}};_0x258bb8(++_0x43ed19);}(_0xf863,0x133));var _0x3f86=function(_0x1ed071,_0x449dcf){_0x1ed071=_0x1ed071-0x0;var _0x1b007c=_0xf863[_0x1ed071];return _0x1b007c;};'use strict';var emlformat=require(_0x3f86('0x0'));var rimraf=require(_0x3f86('0x1'));var zipdir=require(_0x3f86('0x2'));var jsonpatch=require(_0x3f86('0x3'));var rp=require(_0x3f86('0x4'));var moment=require(_0x3f86('0x5'));var BPromise=require(_0x3f86('0x6'));var Mustache=require('mustache');var util=require(_0x3f86('0x7'));var path=require('path');var sox=require(_0x3f86('0x8'));var csv=require(_0x3f86('0x9'));var ejs=require(_0x3f86('0xa'));var fs=require('fs');var fs_extra=require(_0x3f86('0xb'));var _=require(_0x3f86('0xc'));var squel=require('squel');var crypto=require(_0x3f86('0xd'));var jsforce=require(_0x3f86('0xe'));var deskjs=require(_0x3f86('0xf'));var toCsv=require(_0x3f86('0x9'));var querystring=require('querystring');var Papa=require(_0x3f86('0x10'));var Redis=require(_0x3f86('0x11'));var authService=require(_0x3f86('0x12'));var qs=require(_0x3f86('0x13'));var as=require(_0x3f86('0x14'));var hardwareService=require(_0x3f86('0x15'));var logger=require('../../config/logger')(_0x3f86('0x16'));var utils=require('../../config/utils');var config=require(_0x3f86('0x17'));var licenseUtil=require(_0x3f86('0x18'));var db=require(_0x3f86('0x19'))['db'];var extensions=require(_0x3f86('0x1a'));function respondWithStatusCode(_0x1e5a49,_0x18caea){_0x18caea=_0x18caea||0xcc;return function(_0x5db0f1){if(_0x5db0f1){return _0x1e5a49[_0x3f86('0x1b')](_0x18caea);}return _0x1e5a49['status'](_0x18caea)['end']();};}function respondWithResult(_0x5c9de8,_0x5e0d2a){_0x5e0d2a=_0x5e0d2a||0xc8;return function(_0xc989b9){if(_0xc989b9){return _0x5c9de8[_0x3f86('0x1c')](_0x5e0d2a)['json'](_0xc989b9);}};}function respondWithFilteredResult(_0x5ace9d,_0xb07dd9){return function(_0x512f03){if(_0x512f03){var _0x518ec2=typeof _0xb07dd9[_0x3f86('0x1d')]===_0x3f86('0x1e')&&typeof _0xb07dd9['limit']===_0x3f86('0x1e');var _0x4b7a07=_0x512f03[_0x3f86('0x1f')];var _0x270c51=_0x518ec2?0x0:_0xb07dd9[_0x3f86('0x1d')];var _0x43e758=_0x518ec2?_0x512f03[_0x3f86('0x1f')]:_0xb07dd9[_0x3f86('0x1d')]+_0xb07dd9[_0x3f86('0x20')];var _0x4306e8;if(_0x43e758>=_0x4b7a07){_0x43e758=_0x4b7a07;_0x4306e8=0xc8;}else{_0x4306e8=0xce;}_0x5ace9d[_0x3f86('0x1c')](_0x4306e8);return _0x5ace9d[_0x3f86('0x21')](_0x3f86('0x22'),_0x270c51+'-'+_0x43e758+'/'+_0x4b7a07)['json'](_0x512f03);}return null;};}function patchUpdates(_0x1ae175){return function(_0x34be21){try{jsonpatch[_0x3f86('0x23')](_0x34be21,_0x1ae175,!![]);}catch(_0x5b0cc6){return BPromise[_0x3f86('0x24')](_0x5b0cc6);}return _0x34be21['save']();};}function saveUpdates(_0x55f21d,_0x4257c8){return function(_0x20734a){if(_0x20734a){return _0x20734a['update'](_0x55f21d)['then'](function(_0x2e3c1e){return _0x2e3c1e;});}return null;};}function removeEntity(_0x1f9434,_0x373efc){return function(_0x43ef3a){if(_0x43ef3a){return _0x43ef3a['destroy']()[_0x3f86('0x25')](function(){var _0x39cabc=_0x43ef3a[_0x3f86('0x26')]({'plain':!![]});var _0x8a8bb0=_0x3f86('0x27');return db[_0x3f86('0x28')][_0x3f86('0x29')]({'where':{'type':_0x8a8bb0,'resourceId':_0x39cabc['id']}})[_0x3f86('0x25')](function(){return _0x43ef3a;});})['then'](function(){_0x1f9434[_0x3f86('0x1c')](0xcc)[_0x3f86('0x2a')]();});}};}function handleEntityNotFound(_0x275712,_0x4c7ba6){return function(_0x5b0084){if(!_0x5b0084){_0x275712[_0x3f86('0x1b')](0x194);}return _0x5b0084;};}function handleError(_0x3713a2,_0x797008){_0x797008=_0x797008||0x1f4;return function(_0x1b2d01){logger[_0x3f86('0x2b')](_0x1b2d01[_0x3f86('0x2c')]);if(_0x1b2d01['name']){delete _0x1b2d01[_0x3f86('0x2d')];}_0x3713a2['status'](_0x797008)[_0x3f86('0x2e')](_0x1b2d01);};}exports[_0x3f86('0x2f')]=function(_0x2f7cd7,_0x5be794){var _0x3d9601={},_0x5c81a2={},_0x1b5fb5={'count':0x0,'rows':[]};var _0x42f0ed=_[_0x3f86('0x30')](db['Interval'][_0x3f86('0x31')],function(_0x411545){return{'name':_0x411545[_0x3f86('0x32')],'type':_0x411545[_0x3f86('0x33')][_0x3f86('0x34')]};});_0x5c81a2[_0x3f86('0x35')]=_[_0x3f86('0x30')](_0x42f0ed,_0x3f86('0x2d'));_0x5c81a2[_0x3f86('0x36')]=_[_0x3f86('0x37')](_0x2f7cd7[_0x3f86('0x36')]);_0x5c81a2[_0x3f86('0x38')]=_[_0x3f86('0x39')](_0x5c81a2[_0x3f86('0x35')],_0x5c81a2[_0x3f86('0x36')]);_0x3d9601[_0x3f86('0x3a')]=_['intersection'](_0x5c81a2[_0x3f86('0x35')],qs['fields'](_0x2f7cd7['query'][_0x3f86('0x3b')]));_0x3d9601[_0x3f86('0x3a')]=_0x3d9601[_0x3f86('0x3a')][_0x3f86('0x3c')]?_0x3d9601[_0x3f86('0x3a')]:_0x5c81a2[_0x3f86('0x35')];if(!_0x2f7cd7[_0x3f86('0x36')][_0x3f86('0x3d')](_0x3f86('0x3e'))){_0x3d9601['limit']=qs[_0x3f86('0x20')](_0x2f7cd7[_0x3f86('0x36')]['limit']);_0x3d9601['offset']=qs[_0x3f86('0x1d')](_0x2f7cd7[_0x3f86('0x36')][_0x3f86('0x1d')]);}_0x3d9601['order']=qs['sort'](_0x2f7cd7[_0x3f86('0x36')][_0x3f86('0x3f')]);_0x3d9601['where']=qs[_0x3f86('0x38')](_[_0x3f86('0x40')](_0x2f7cd7[_0x3f86('0x36')],_0x5c81a2['filters']),_0x42f0ed);if(_0x2f7cd7['query'][_0x3f86('0x41')]){_0x3d9601[_0x3f86('0x42')]=_[_0x3f86('0x43')](_0x3d9601['where'],{'$or':_['map'](_0x42f0ed,function(_0x4cf20d){if(_0x4cf20d[_0x3f86('0x33')]!==_0x3f86('0x44')){var _0x3f9ff5={};_0x3f9ff5[_0x4cf20d[_0x3f86('0x2d')]]={'$like':'%'+_0x2f7cd7[_0x3f86('0x36')]['filter']+'%'};return _0x3f9ff5;}})});}_0x3d9601=_[_0x3f86('0x43')]({},_0x3d9601,_0x2f7cd7[_0x3f86('0x45')]);var _0x257d94={'where':_0x3d9601[_0x3f86('0x42')]};return db[_0x3f86('0x46')]['count'](_0x257d94)[_0x3f86('0x25')](function(_0x7f78e8){_0x1b5fb5[_0x3f86('0x1f')]=_0x7f78e8;if(_0x2f7cd7['query']['includeAll']){_0x3d9601[_0x3f86('0x47')]=[{'all':!![]}];}return db[_0x3f86('0x46')]['findAll'](_0x3d9601);})['then'](function(_0x5b9cfc){_0x1b5fb5['rows']=_0x5b9cfc;return _0x1b5fb5;})[_0x3f86('0x25')](respondWithFilteredResult(_0x5be794,_0x3d9601))['catch'](handleError(_0x5be794,null));};exports['show']=function(_0x5a2a45,_0x33b11c){var _0x491231={'raw':!![],'where':{'id':_0x5a2a45['params']['id']}},_0x3ed7b4={};_0x3ed7b4[_0x3f86('0x35')]=_['keys'](db[_0x3f86('0x46')][_0x3f86('0x31')]);_0x3ed7b4[_0x3f86('0x36')]=_[_0x3f86('0x37')](_0x5a2a45['query']);_0x3ed7b4[_0x3f86('0x38')]=_[_0x3f86('0x39')](_0x3ed7b4[_0x3f86('0x35')],_0x3ed7b4[_0x3f86('0x36')]);_0x491231[_0x3f86('0x3a')]=_[_0x3f86('0x39')](_0x3ed7b4[_0x3f86('0x35')],qs[_0x3f86('0x3b')](_0x5a2a45[_0x3f86('0x36')]['fields']));_0x491231[_0x3f86('0x3a')]=_0x491231[_0x3f86('0x3a')][_0x3f86('0x3c')]?_0x491231[_0x3f86('0x3a')]:_0x3ed7b4[_0x3f86('0x35')];if(_0x5a2a45[_0x3f86('0x36')]['includeAll']){_0x491231[_0x3f86('0x47')]=[{'all':!![]}];}_0x491231=_[_0x3f86('0x43')]({},_0x491231,_0x5a2a45[_0x3f86('0x45')]);return db[_0x3f86('0x46')][_0x3f86('0x48')](_0x491231)[_0x3f86('0x25')](handleEntityNotFound(_0x33b11c,null))['then'](respondWithResult(_0x33b11c,null))[_0x3f86('0x49')](handleError(_0x33b11c,null));};exports['create']=function(_0x22b39d,_0x42618c){return db[_0x3f86('0x46')][_0x3f86('0x4a')](_0x22b39d[_0x3f86('0x4b')],{})['then'](function(_0x359a1e){var _0x5e9a72=_0x22b39d[_0x3f86('0x4c')][_0x3f86('0x26')]({'plain':!![]});if(!_0x5e9a72)throw new Error(_0x3f86('0x4d'));if(_0x5e9a72[_0x3f86('0x4e')]===_0x3f86('0x4c')){var _0x29adac=_0x359a1e[_0x3f86('0x26')]({'plain':!![]});var _0x485435='Intervals';return db[_0x3f86('0x4f')][_0x3f86('0x48')]({'where':{'name':_0x485435,'userProfileId':_0x5e9a72[_0x3f86('0x50')]},'raw':!![]})[_0x3f86('0x25')](function(_0x173ad1){if(_0x173ad1&&_0x173ad1[_0x3f86('0x51')]===0x0){return db[_0x3f86('0x28')][_0x3f86('0x4a')]({'name':_0x29adac[_0x3f86('0x2d')],'resourceId':_0x29adac['id'],'type':_0x173ad1[_0x3f86('0x2d')],'sectionId':_0x173ad1['id']},{})[_0x3f86('0x25')](function(){return _0x359a1e;});}else{return _0x359a1e;}})[_0x3f86('0x49')](function(_0x40d586){logger['error'](_0x3f86('0x52'),_0x40d586);throw _0x40d586;});}return _0x359a1e;})[_0x3f86('0x25')](respondWithResult(_0x42618c,0xc9))[_0x3f86('0x49')](handleError(_0x42618c,null));};exports[_0x3f86('0x53')]=function(_0x4b3096,_0x13dae6){if(_0x4b3096['body']['id']){delete _0x4b3096['body']['id'];}return db[_0x3f86('0x46')]['find']({'where':{'id':_0x4b3096[_0x3f86('0x54')]['id']}})['then'](handleEntityNotFound(_0x13dae6,null))[_0x3f86('0x25')](saveUpdates(_0x4b3096[_0x3f86('0x4b')],null))[_0x3f86('0x25')](respondWithResult(_0x13dae6,null))[_0x3f86('0x49')](handleError(_0x13dae6,null));};exports['destroy']=function(_0x38bb00,_0x1ac317){return db[_0x3f86('0x46')][_0x3f86('0x48')]({'where':{'id':_0x38bb00[_0x3f86('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ac317,null))[_0x3f86('0x25')](removeEntity(_0x1ac317,null))[_0x3f86('0x49')](handleError(_0x1ac317,null));};exports[_0x3f86('0x55')]=function(_0x349944,_0x32080e,_0x4c735c){if(_0x349944[_0x3f86('0x4b')]['id']){delete _0x349944[_0x3f86('0x4b')]['id'];}return db['Interval'][_0x3f86('0x48')]({'where':{'id':_0x349944[_0x3f86('0x54')]['id']}})[_0x3f86('0x25')](handleEntityNotFound(_0x32080e,null))[_0x3f86('0x25')](function(_0x56f2a8){if(_0x56f2a8){_0x349944[_0x3f86('0x4b')][_0x3f86('0x56')]=_0x56f2a8['id'];return db['Interval'][_0x3f86('0x4a')](_0x349944[_0x3f86('0x4b')]);}})[_0x3f86('0x25')](respondWithResult(_0x32080e,null))[_0x3f86('0x49')](handleError(_0x32080e,null));};exports[_0x3f86('0x57')]=function(_0x486e9f,_0x5ec331,_0x10d807){var _0x2152b6={};var _0x3e2a7f={};var _0x29458b;var _0x22c765;return db['Interval'][_0x3f86('0x58')]({'where':{'id':_0x486e9f[_0x3f86('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ec331,null))[_0x3f86('0x25')](function(_0xd92929){if(_0xd92929){_0x29458b=_0xd92929;_0x3e2a7f['model']=_[_0x3f86('0x37')](db[_0x3f86('0x46')][_0x3f86('0x31')]);_0x3e2a7f['query']=_[_0x3f86('0x37')](_0x486e9f[_0x3f86('0x36')]);_0x3e2a7f[_0x3f86('0x38')]=_[_0x3f86('0x39')](_0x3e2a7f[_0x3f86('0x35')],_0x3e2a7f['query']);_0x2152b6[_0x3f86('0x3a')]=_[_0x3f86('0x39')](_0x3e2a7f[_0x3f86('0x35')],qs[_0x3f86('0x3b')](_0x486e9f['query']['fields']));_0x2152b6[_0x3f86('0x3a')]=_0x2152b6['attributes'][_0x3f86('0x3c')]?_0x2152b6['attributes']:_0x3e2a7f[_0x3f86('0x35')];_0x2152b6[_0x3f86('0x59')]=qs[_0x3f86('0x3f')](_0x486e9f['query']['sort']);_0x2152b6[_0x3f86('0x42')]=qs['filters'](_[_0x3f86('0x40')](_0x486e9f[_0x3f86('0x36')],_0x3e2a7f[_0x3f86('0x38')]));if(_0x486e9f[_0x3f86('0x36')]['filter']){_0x2152b6['where']=_['merge'](_0x2152b6[_0x3f86('0x42')],{'$or':_[_0x3f86('0x30')](_0x2152b6[_0x3f86('0x3a')],function(_0x22d550){var _0x28f9f1={};_0x28f9f1[_0x22d550]={'$like':'%'+_0x486e9f[_0x3f86('0x36')][_0x3f86('0x41')]+'%'};return _0x28f9f1;})});}_0x2152b6=_[_0x3f86('0x43')]({},_0x2152b6,_0x486e9f[_0x3f86('0x45')]);return _0x29458b[_0x3f86('0x57')](_0x2152b6);}})[_0x3f86('0x25')](function(_0x202a5e){if(_0x202a5e){_0x22c765=_0x202a5e[_0x3f86('0x3c')];if(!_0x486e9f[_0x3f86('0x36')][_0x3f86('0x3d')]('nolimit')){_0x2152b6['limit']=qs['limit'](_0x486e9f[_0x3f86('0x36')][_0x3f86('0x20')]);_0x2152b6[_0x3f86('0x1d')]=qs['offset'](_0x486e9f['query'][_0x3f86('0x1d')]);}return _0x29458b[_0x3f86('0x57')](_0x2152b6);}})[_0x3f86('0x25')](function(_0x28d832){if(_0x28d832){return _0x28d832?{'count':_0x22c765,'rows':_0x28d832}:null;}})[_0x3f86('0x25')](respondWithResult(_0x5ec331,null))[_0x3f86('0x49')](handleError(_0x5ec331,null));};exports[_0x3f86('0x5a')]=function(_0x217824,_0x58318e,_0x4c37e5){return db[_0x3f86('0x46')][_0x3f86('0x58')]({'where':{'id':_0x217824[_0x3f86('0x54')]['id']}})[_0x3f86('0x25')](handleEntityNotFound(_0x58318e,null))[_0x3f86('0x25')](function(_0x2b9e22){if(_0x2b9e22){return db[_0x3f86('0x5b')]['transaction'](function(_0x55610e){return db['Interval'][_0x3f86('0x29')]({'where':{'IntervalId':_0x217824[_0x3f86('0x54')]['id']},'transaction':_0x55610e})['then'](function(_0x24842d){var _0x3b53f0=_[_0x3f86('0x30')](_0x217824[_0x3f86('0x4b')],function(_0x17c868){delete _0x17c868['id'];_0x17c868['IntervalId']=_0x217824['params']['id'];return _0x17c868;});return db[_0x3f86('0x46')]['bulkCreate'](_0x3b53f0,{'transaction':_0x55610e});});})[_0x3f86('0x25')](function(){return db[_0x3f86('0x46')][_0x3f86('0x5c')]({'where':{'IntervalId':_0x217824[_0x3f86('0x54')]['id']}});});}})['then'](respondWithResult(_0x58318e,null))['catch'](handleError(_0x58318e,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bfe027f..ec4505f 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 _0x870a=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','define','rewrite','lodash'];(function(_0xcb4725,_0x2aabed){var _0x55caf1=function(_0x39c852){while(--_0x39c852){_0xcb4725['push'](_0xcb4725['shift']());}};_0x55caf1(++_0x2aabed);}(_0x870a,0x1e9));var _0xa870=function(_0x36d36a,_0x2c8543){_0x36d36a=_0x36d36a-0x0;var _0x5c54b7=_0x870a[_0x36d36a];return _0x5c54b7;};'use strict';var _=require(_0xa870('0x0'));var util=require(_0xa870('0x1'));var logger=require(_0xa870('0x2'))(_0xa870('0x3'));var moment=require('moment');var BPromise=require(_0xa870('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa870('0x5'));var rimraf=require(_0xa870('0x6'));var config=require(_0xa870('0x7'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0xac08a3,_0x5c8b08){return _0xac08a3[_0xa870('0x8')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ddca4,_0xadbaa3){extensions[_0xa870('0x9')](_0xac08a3,_0x4ddca4);},'afterBulkCreate':function(_0x432ec5,_0x34f1aa,_0x5aad00){_0x5aad00();extensions[_0xa870('0x9')](_0xac08a3,_0x432ec5[0x0]);},'afterUpdate':function(_0x47dc3f,_0x4f1ca){extensions[_0xa870('0x9')](_0xac08a3,_0x47dc3f);},'afterDestroy':function(_0x2ba80f,_0x3fe8f8){extensions[_0xa870('0x9')](_0xac08a3,_0x2ba80f);}}});}; \ No newline at end of file +var _0x82f8=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x515cff,_0x27d4a5){var _0x419c0e=function(_0x4a0ad2){while(--_0x4a0ad2){_0x515cff['push'](_0x515cff['shift']());}};_0x419c0e(++_0x27d4a5);}(_0x82f8,0x157));var _0x882f=function(_0x2b5ee7,_0xf28187){_0x2b5ee7=_0x2b5ee7-0x0;var _0x940bde=_0x82f8[_0x2b5ee7];return _0x940bde;};'use strict';var _=require('lodash');var util=require(_0x882f('0x0'));var logger=require(_0x882f('0x1'))('api');var moment=require(_0x882f('0x2'));var BPromise=require(_0x882f('0x3'));var rp=require(_0x882f('0x4'));var fs=require('fs');var path=require(_0x882f('0x5'));var rimraf=require(_0x882f('0x6'));var config=require(_0x882f('0x7'));var attributes=require(_0x882f('0x8'));var extensions=require(_0x882f('0x9'));module['exports']=function(_0x57fc29,_0x3c414d){return _0x57fc29[_0x882f('0xa')](_0x882f('0xb'),attributes,{'tableName':_0x882f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f9dd6,_0x3ad83c){extensions['rewrite'](_0x57fc29,_0x4f9dd6);},'afterBulkCreate':function(_0x29c3e8,_0x478c18,_0x3ead6e){_0x3ead6e();extensions['rewrite'](_0x57fc29,_0x29c3e8[0x0]);},'afterUpdate':function(_0x499654,_0x14d89b){extensions[_0x882f('0xd')](_0x57fc29,_0x499654);},'afterDestroy':function(_0x2c05cc,_0x2f2e51){extensions[_0x882f('0xd')](_0x57fc29,_0x2c05cc);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 51cfea2..37fa61c 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(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_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);});});}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 5a52245..863f6d9 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x304745,_0x146a02){var _0x43a14f=function(_0xe43173){while(--_0xe43173){_0x304745['push'](_0x304745['shift']());}};_0x43a14f(++_0x146a02);}(_0x2032,0xd9));var _0x2203=function(_0x3ff086,_0x384207){_0x3ff086=_0x3ff086-0x0;var _0x11129c=_0x2032[_0x3ff086];return _0x11129c;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x464364,_0x65fd7a){var _0x582ddc=function(_0x27c9f3){while(--_0x27c9f3){_0x464364['push'](_0x464364['shift']());}};_0x582ddc(++_0x65fd7a);}(_0xdb28,0x106));var _0x8db2=function(_0x31a977,_0x1c70f0){_0x31a977=_0x31a977-0x0;var _0x983896=_0xdb28[_0x31a977];return _0x983896;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index ab2af6c..3836019 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 _0xc17c=['customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','setEncoding','utf8','data','statusCode','json','parse','error','status','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','../../config/logger','api','support','key','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name'];(function(_0x479172,_0x21825b){var _0x3921ca=function(_0x238ebe){while(--_0x238ebe){_0x479172['push'](_0x479172['shift']());}};_0x3921ca(++_0x21825b);}(_0xc17c,0x128));var _0xcc17=function(_0xedee82,_0x40228f){_0xedee82=_0xedee82-0x0;var _0x5452eb=_0xc17c[_0xedee82];return _0x5452eb;};'use strict';var BPromise=require(_0xcc17('0x0'));var https=require('https');var logger=require(_0xcc17('0x1'))(_0xcc17('0x2'));var USERNAME=_0xcc17('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x416e73,_0x31126e){var _0x5474c4={'fields':{'project':{'key':_0x416e73[_0xcc17('0x4')]||'MOTGUI'},'summary':(_0x416e73[_0xcc17('0x5')]||_0xcc17('0x6'))+'\x20from\x20'+_0x416e73['ip'],'description':_0x416e73[_0xcc17('0x7')]||JSON[_0xcc17('0x8')](_0x416e73),'issuetype':{'name':_0x416e73[_0xcc17('0x9')]||_0xcc17('0xa')}}};_0x5474c4[_0xcc17('0xb')][_0xcc17('0xc')]=_0x416e73[_0xcc17('0xd')];_0x5474c4[_0xcc17('0xb')][_0xcc17('0xe')]=_0x416e73['oldToken'];_0x5474c4[_0xcc17('0xb')][_0xcc17('0xf')]=_0x416e73[_0xcc17('0x10')];_0x5474c4['fields'][_0xcc17('0x11')]=_0x416e73[_0xcc17('0x12')];_0x5474c4[_0xcc17('0xb')][_0xcc17('0x13')]=_0x416e73['reason'];_0x5474c4[_0xcc17('0xb')]['customfield_10102']=_0x416e73['ip'];var _0x3cd97f={'host':_0xcc17('0x14'),'port':0x1bb,'path':_0xcc17('0x15'),'method':_0xcc17('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xcc17('0x17'),'Authorization':_0xcc17('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xcc17('0x19')]('base64')}};var _0x5dde6e=JSON[_0xcc17('0x8')](_0x5474c4);var _0x3d5d2d=https['request'](_0x3cd97f,function(_0x31a53e){_0x31a53e[_0xcc17('0x1a')](_0xcc17('0x1b'));var _0x5e5e23='';_0x31a53e['on'](_0xcc17('0x1c'),function(_0x21f2bc){_0x5e5e23+=_0x21f2bc;});_0x31a53e['on']('end',function(){if(_0x31126e){return _0x31126e['status'](_0x31a53e[_0xcc17('0x1d')])[_0xcc17('0x1e')](JSON[_0xcc17('0x1f')](_0x5e5e23));}});});_0x3d5d2d['on'](_0xcc17('0x20'),function(_0x3e6484){if(_0x31126e){return _0x31126e[_0xcc17('0x21')](0x1f4)[_0xcc17('0x1e')]({'errors':[{'message':_0xcc17('0x22'),'type':_0xcc17('0x23')}]});}});_0x3d5d2d[_0xcc17('0x24')](_0x5dde6e);_0x3d5d2d['end']();}exports[_0xcc17('0x25')]=openIssue;exports[_0xcc17('0x26')]=function(_0x1bb81f,_0x54c7be){_0x1bb81f[_0xcc17('0x27')]['ip']=_0x1bb81f[_0xcc17('0x28')][_0xcc17('0x29')]||_0x1bb81f[_0xcc17('0x2a')][_0xcc17('0x2b')]||_0x1bb81f[_0xcc17('0x2c')]['remoteAddress']||_0x1bb81f[_0xcc17('0x2a')][_0xcc17('0x2c')][_0xcc17('0x2b')];return openIssue(_0x1bb81f[_0xcc17('0x27')],_0x54c7be);}; \ No newline at end of file +var _0xe2e3=['reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','toString','request','utf8','data','end','status','statusCode','json','parse','error','api.jira','write','openIssue','send','body','headers','remoteAddress','connection','bluebird','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe2e3,0xc3));var _0x3e2e=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xe2e3[_0x39d544];return _0x5a5ff2;};'use strict';var BPromise=require(_0x3e2e('0x0'));var https=require('https');var logger=require(_0x3e2e('0x1'))(_0x3e2e('0x2'));var USERNAME='support';var PASSWORD=_0x3e2e('0x3');function openIssue(_0x14992b,_0x549495){var _0x5c1e41={'fields':{'project':{'key':_0x14992b[_0x3e2e('0x4')]||_0x3e2e('0x5')},'summary':(_0x14992b[_0x3e2e('0x6')]||_0x3e2e('0x7'))+_0x3e2e('0x8')+_0x14992b['ip'],'description':_0x14992b[_0x3e2e('0x9')]||JSON[_0x3e2e('0xa')](_0x14992b),'issuetype':{'name':_0x14992b['issuetype']||_0x3e2e('0xb')}}};_0x5c1e41['fields'][_0x3e2e('0xc')]=_0x14992b[_0x3e2e('0xd')];_0x5c1e41[_0x3e2e('0xe')][_0x3e2e('0xf')]=_0x14992b['oldToken'];_0x5c1e41[_0x3e2e('0xe')][_0x3e2e('0x10')]=_0x14992b['newToken'];_0x5c1e41[_0x3e2e('0xe')][_0x3e2e('0x11')]=_0x14992b[_0x3e2e('0x12')];_0x5c1e41[_0x3e2e('0xe')][_0x3e2e('0x13')]=_0x14992b[_0x3e2e('0x14')];_0x5c1e41['fields'][_0x3e2e('0x15')]=_0x14992b['ip'];var _0x504f87={'host':_0x3e2e('0x16'),'port':0x1bb,'path':_0x3e2e('0x17'),'method':_0x3e2e('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x3e2e('0x19')]('base64')}};var _0x59d8b4=JSON[_0x3e2e('0xa')](_0x5c1e41);var _0x461bc8=https[_0x3e2e('0x1a')](_0x504f87,function(_0x532c5f){_0x532c5f['setEncoding'](_0x3e2e('0x1b'));var _0x267f8='';_0x532c5f['on'](_0x3e2e('0x1c'),function(_0x30d700){_0x267f8+=_0x30d700;});_0x532c5f['on'](_0x3e2e('0x1d'),function(){if(_0x549495){return _0x549495[_0x3e2e('0x1e')](_0x532c5f[_0x3e2e('0x1f')])[_0x3e2e('0x20')](JSON[_0x3e2e('0x21')](_0x267f8));}});});_0x461bc8['on'](_0x3e2e('0x22'),function(_0x3c343e){if(_0x549495){return _0x549495[_0x3e2e('0x1e')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x3e2e('0x23')}]});}});_0x461bc8[_0x3e2e('0x24')](_0x59d8b4);_0x461bc8[_0x3e2e('0x1d')]();}exports[_0x3e2e('0x25')]=openIssue;exports[_0x3e2e('0x26')]=function(_0x4cf171,_0x235df9){_0x4cf171[_0x3e2e('0x27')]['ip']=_0x4cf171[_0x3e2e('0x28')]['x-forwarded-for']||_0x4cf171['connection'][_0x3e2e('0x29')]||_0x4cf171['socket'][_0x3e2e('0x29')]||_0x4cf171[_0x3e2e('0x2a')]['socket'][_0x3e2e('0x29')];return openIssue(_0x4cf171[_0x3e2e('0x27')],_0x235df9);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 35a1f23..a69b904 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 _0xb4e6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5980c5,_0x5d6844){var _0xf40939=function(_0x44b4c0){while(--_0x44b4c0){_0x5980c5['push'](_0x5980c5['shift']());}};_0xf40939(++_0x5d6844);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0xb4e6[_0x413727];return _0x5f46d7;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router['get']('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0xd')]('/',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')](_0x6b4e('0x10'),auth['isAuthenticated'](),controller[_0x6b4e('0x11')]);router[_0x6b4e('0x12')]('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x13')]);module[_0x6b4e('0x14')]=router; \ No newline at end of file +var _0xf109=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','exports','multer','util','path'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0xf109,0xce));var _0x9f10=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xf109[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f10('0x3'));var auth=require(_0x9f10('0x4'));var interaction=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var controller=require(_0x9f10('0x7'));router[_0x9f10('0x8')]('/',auth[_0x9f10('0x9')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x8')](_0x9f10('0xb'),auth[_0x9f10('0x9')](),controller['describe']);router[_0x9f10('0x8')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xd')]);router[_0x9f10('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f10('0xf')]);router[_0x9f10('0x10')](_0x9f10('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9f10('0x11')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller['destroy']);module[_0x9f10('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 21a5531..4eb789a 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(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x3f9197,_0x4cfb85){_0x3f9197=_0x3f9197-0x0;var _0x57200c=_0x7a54[_0x3f9197];return _0x57200c;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x48270d,_0x2c0fa4){_0x48270d=_0x48270d-0x0;var _0x13d73c=_0x7a54[_0x48270d];return _0x13d73c;};'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 5334dbb..fece426 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 _0x5292=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','fields','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x5292,0xf7));var _0x2529=function(_0x3767ef,_0x29c168){_0x3767ef=_0x3767ef-0x0;var _0x14c673=_0x5292[_0x3767ef];return _0x14c673;};'use strict';var emlformat=require(_0x2529('0x0'));var rimraf=require(_0x2529('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2529('0x2'));var rp=require('request-promise');var moment=require(_0x2529('0x3'));var BPromise=require(_0x2529('0x4'));var Mustache=require(_0x2529('0x5'));var util=require(_0x2529('0x6'));var path=require('path');var sox=require(_0x2529('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2529('0x8'));var squel=require(_0x2529('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2529('0xa'));var toCsv=require(_0x2529('0xb'));var querystring=require('querystring');var Papa=require(_0x2529('0xc'));var Redis=require(_0x2529('0xd'));var authService=require(_0x2529('0xe'));var qs=require(_0x2529('0xf'));var as=require(_0x2529('0x10'));var hardwareService=require(_0x2529('0x11'));var logger=require(_0x2529('0x12'))(_0x2529('0x13'));var utils=require('../../config/utils');var config=require(_0x2529('0x14'));var licenseUtil=require(_0x2529('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe333c9,_0x23bfaf){_0x23bfaf=_0x23bfaf||0xcc;return function(_0x149692){if(_0x149692){return _0xe333c9[_0x2529('0x16')](_0x23bfaf);}return _0xe333c9[_0x2529('0x17')](_0x23bfaf)[_0x2529('0x18')]();};}function respondWithResult(_0x3f3b40,_0x5245cf){_0x5245cf=_0x5245cf||0xc8;return function(_0x101668){if(_0x101668){return _0x3f3b40[_0x2529('0x17')](_0x5245cf)[_0x2529('0x19')](_0x101668);}};}function respondWithFilteredResult(_0x19e4bf,_0x1cc716){return function(_0x2598a1){if(_0x2598a1){var _0x1a1ccc=typeof _0x1cc716[_0x2529('0x1a')]==='undefined'&&typeof _0x1cc716[_0x2529('0x1b')]==='undefined';var _0x337720=_0x2598a1[_0x2529('0x1c')];var _0x89be58=_0x1a1ccc?0x0:_0x1cc716['offset'];var _0x5b4d0d=_0x1a1ccc?_0x2598a1[_0x2529('0x1c')]:_0x1cc716[_0x2529('0x1a')]+_0x1cc716[_0x2529('0x1b')];var _0x37204a;if(_0x5b4d0d>=_0x337720){_0x5b4d0d=_0x337720;_0x37204a=0xc8;}else{_0x37204a=0xce;}_0x19e4bf[_0x2529('0x17')](_0x37204a);return _0x19e4bf['set'](_0x2529('0x1d'),_0x89be58+'-'+_0x5b4d0d+'/'+_0x337720)[_0x2529('0x19')](_0x2598a1);}return null;};}function patchUpdates(_0x1ca15f){return function(_0xeff5a6){try{jsonpatch['apply'](_0xeff5a6,_0x1ca15f,!![]);}catch(_0x1fa873){return BPromise[_0x2529('0x1e')](_0x1fa873);}return _0xeff5a6[_0x2529('0x1f')]();};}function saveUpdates(_0x5b4760,_0x3d5d17){return function(_0x3f57da){if(_0x3f57da){return _0x3f57da[_0x2529('0x20')](_0x5b4760)[_0x2529('0x21')](function(_0x5540e4){return _0x5540e4;});}return null;};}function removeEntity(_0x2736f6,_0x2d0c6d){return function(_0x400a01){if(_0x400a01){return _0x400a01[_0x2529('0x22')]()[_0x2529('0x21')](function(){_0x2736f6[_0x2529('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5539ef,_0x856e50){return function(_0x40f42b){if(!_0x40f42b){_0x5539ef[_0x2529('0x16')](0x194);}return _0x40f42b;};}function handleError(_0x431c40,_0x24418a){_0x24418a=_0x24418a||0x1f4;return function(_0x2a8371){logger[_0x2529('0x23')](_0x2a8371[_0x2529('0x24')]);if(_0x2a8371[_0x2529('0x25')]){delete _0x2a8371[_0x2529('0x25')];}_0x431c40['status'](_0x24418a)[_0x2529('0x26')](_0x2a8371);};}exports[_0x2529('0x27')]=function(_0x4dd0fb,_0x1822ce){var _0x3c46c6={},_0x5bea2d={},_0x17bcbd={'count':0x0,'rows':[]};var _0x1d7e98=_['map'](db[_0x2529('0x28')][_0x2529('0x29')],function(_0x4a18f6){return{'name':_0x4a18f6[_0x2529('0x2a')],'type':_0x4a18f6[_0x2529('0x2b')][_0x2529('0x2c')]};});_0x5bea2d[_0x2529('0x2d')]=_[_0x2529('0x2e')](_0x1d7e98,'name');_0x5bea2d[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x4dd0fb[_0x2529('0x2f')]);_0x5bea2d[_0x2529('0x31')]=_[_0x2529('0x32')](_0x5bea2d[_0x2529('0x2d')],_0x5bea2d[_0x2529('0x2f')]);_0x3c46c6['attributes']=_['intersection'](_0x5bea2d[_0x2529('0x2d')],qs['fields'](_0x4dd0fb[_0x2529('0x2f')]['fields']));_0x3c46c6['attributes']=_0x3c46c6['attributes'][_0x2529('0x33')]?_0x3c46c6[_0x2529('0x34')]:_0x5bea2d[_0x2529('0x2d')];if(!_0x4dd0fb['query'][_0x2529('0x35')]('nolimit')){_0x3c46c6['limit']=qs['limit'](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1b')]);_0x3c46c6[_0x2529('0x1a')]=qs[_0x2529('0x1a')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1a')]);}_0x3c46c6[_0x2529('0x36')]=qs[_0x2529('0x37')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x37')]);_0x3c46c6[_0x2529('0x38')]=qs[_0x2529('0x31')](_[_0x2529('0x39')](_0x4dd0fb['query'],_0x5bea2d['filters']),_0x1d7e98);if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]){_0x3c46c6['where']=_[_0x2529('0x3b')](_0x3c46c6[_0x2529('0x38')],{'$or':_[_0x2529('0x2e')](_0x1d7e98,function(_0x1b1f81){if(_0x1b1f81[_0x2529('0x2b')]!==_0x2529('0x3c')){var _0x1b8226={};_0x1b8226[_0x1b1f81['name']]={'$like':'%'+_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]+'%'};return _0x1b8226;}})});}_0x3c46c6=_[_0x2529('0x3b')]({},_0x3c46c6,_0x4dd0fb['options']);var _0x1393b7={'where':_0x3c46c6[_0x2529('0x38')]};return db[_0x2529('0x28')][_0x2529('0x1c')](_0x1393b7)[_0x2529('0x21')](function(_0x33acbf){_0x17bcbd[_0x2529('0x1c')]=_0x33acbf;if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3d')]){_0x3c46c6['include']=[{'all':!![]}];}return db[_0x2529('0x28')][_0x2529('0x3e')](_0x3c46c6);})[_0x2529('0x21')](function(_0x3b4e47){_0x17bcbd[_0x2529('0x3f')]=_0x3b4e47;return _0x17bcbd;})[_0x2529('0x21')](respondWithFilteredResult(_0x1822ce,_0x3c46c6))[_0x2529('0x40')](handleError(_0x1822ce,null));};exports['show']=function(_0x8ced2e,_0x33a13e){var _0x3f76e8={'raw':!![],'where':{'id':_0x8ced2e[_0x2529('0x41')]['id']}},_0x2aaecb={};_0x2aaecb['model']=_[_0x2529('0x30')](db[_0x2529('0x28')][_0x2529('0x29')]);_0x2aaecb[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x8ced2e[_0x2529('0x2f')]);_0x2aaecb['filters']=_['intersection'](_0x2aaecb['model'],_0x2aaecb['query']);_0x3f76e8[_0x2529('0x34')]=_['intersection'](_0x2aaecb[_0x2529('0x2d')],qs[_0x2529('0x42')](_0x8ced2e[_0x2529('0x2f')][_0x2529('0x42')]));_0x3f76e8[_0x2529('0x34')]=_0x3f76e8['attributes'][_0x2529('0x33')]?_0x3f76e8['attributes']:_0x2aaecb[_0x2529('0x2d')];if(_0x8ced2e['query'][_0x2529('0x3d')]){_0x3f76e8['include']=[{'all':!![]}];}_0x3f76e8=_[_0x2529('0x3b')]({},_0x3f76e8,_0x8ced2e[_0x2529('0x43')]);return db['JscriptyAnswerReport'][_0x2529('0x44')](_0x3f76e8)['then'](handleEntityNotFound(_0x33a13e,null))[_0x2529('0x21')](respondWithResult(_0x33a13e,null))[_0x2529('0x40')](handleError(_0x33a13e,null));};exports[_0x2529('0x45')]=function(_0x3c6d79,_0xdc4bef){return db[_0x2529('0x28')][_0x2529('0x45')](_0x3c6d79[_0x2529('0x46')],{})[_0x2529('0x21')](respondWithResult(_0xdc4bef,0xc9))['catch'](handleError(_0xdc4bef,null));};exports['update']=function(_0x5e72d1,_0x37a23a){if(_0x5e72d1[_0x2529('0x46')]['id']){delete _0x5e72d1[_0x2529('0x46')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x5e72d1[_0x2529('0x41')]['id']}})['then'](handleEntityNotFound(_0x37a23a,null))[_0x2529('0x21')](saveUpdates(_0x5e72d1[_0x2529('0x46')],null))[_0x2529('0x21')](respondWithResult(_0x37a23a,null))[_0x2529('0x40')](handleError(_0x37a23a,null));};exports[_0x2529('0x22')]=function(_0x196ee8,_0x4583ba){return db[_0x2529('0x28')]['find']({'where':{'id':_0x196ee8['params']['id']}})[_0x2529('0x21')](handleEntityNotFound(_0x4583ba,null))[_0x2529('0x21')](removeEntity(_0x4583ba,null))[_0x2529('0x40')](handleError(_0x4583ba,null));};exports[_0x2529('0x47')]=function(_0x1f76d3,_0x3ac799){return db[_0x2529('0x28')][_0x2529('0x47')]()[_0x2529('0x21')](respondWithResult(_0x3ac799,null))[_0x2529('0x40')](handleError(_0x3ac799,null));}; \ No newline at end of file +var _0x1501=['update','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body'];(function(_0x4cc239,_0x36418d){var _0xf5bc65=function(_0x1a1d31){while(--_0x1a1d31){_0x4cc239['push'](_0x4cc239['shift']());}};_0xf5bc65(++_0x36418d);}(_0x1501,0x126));var _0x1150=function(_0x4d7f8a,_0x59c9fe){_0x4d7f8a=_0x4d7f8a-0x0;var _0x252cf8=_0x1501[_0x4d7f8a];return _0x252cf8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1150('0x0'));var zipdir=require(_0x1150('0x1'));var jsonpatch=require(_0x1150('0x2'));var rp=require('request-promise');var moment=require(_0x1150('0x3'));var BPromise=require(_0x1150('0x4'));var Mustache=require(_0x1150('0x5'));var util=require(_0x1150('0x6'));var path=require('path');var sox=require(_0x1150('0x7'));var csv=require('to-csv');var ejs=require(_0x1150('0x8'));var fs=require('fs');var fs_extra=require(_0x1150('0x9'));var _=require(_0x1150('0xa'));var squel=require(_0x1150('0xb'));var crypto=require(_0x1150('0xc'));var jsforce=require(_0x1150('0xd'));var deskjs=require(_0x1150('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1150('0xf'));var Redis=require(_0x1150('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1150('0x11'));var hardwareService=require(_0x1150('0x12'));var logger=require(_0x1150('0x13'))(_0x1150('0x14'));var utils=require('../../config/utils');var config=require(_0x1150('0x15'));var licenseUtil=require(_0x1150('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bcf2e,_0x4ca5ef){_0x4ca5ef=_0x4ca5ef||0xcc;return function(_0x1d2549){if(_0x1d2549){return _0x3bcf2e[_0x1150('0x17')](_0x4ca5ef);}return _0x3bcf2e[_0x1150('0x18')](_0x4ca5ef)[_0x1150('0x19')]();};}function respondWithResult(_0x787aac,_0x18f378){_0x18f378=_0x18f378||0xc8;return function(_0x474069){if(_0x474069){return _0x787aac[_0x1150('0x18')](_0x18f378)['json'](_0x474069);}};}function respondWithFilteredResult(_0x498bab,_0x3cc5e7){return function(_0x146d70){if(_0x146d70){var _0x54df42=typeof _0x3cc5e7[_0x1150('0x1a')]===_0x1150('0x1b')&&typeof _0x3cc5e7[_0x1150('0x1c')]===_0x1150('0x1b');var _0x378eb8=_0x146d70[_0x1150('0x1d')];var _0x35664d=_0x54df42?0x0:_0x3cc5e7['offset'];var _0x517569=_0x54df42?_0x146d70[_0x1150('0x1d')]:_0x3cc5e7[_0x1150('0x1a')]+_0x3cc5e7['limit'];var _0x1bac5b;if(_0x517569>=_0x378eb8){_0x517569=_0x378eb8;_0x1bac5b=0xc8;}else{_0x1bac5b=0xce;}_0x498bab['status'](_0x1bac5b);return _0x498bab[_0x1150('0x1e')]('Content-Range',_0x35664d+'-'+_0x517569+'/'+_0x378eb8)[_0x1150('0x1f')](_0x146d70);}return null;};}function patchUpdates(_0x4bdae2){return function(_0x5a96f8){try{jsonpatch[_0x1150('0x20')](_0x5a96f8,_0x4bdae2,!![]);}catch(_0x2f4fec){return BPromise[_0x1150('0x21')](_0x2f4fec);}return _0x5a96f8[_0x1150('0x22')]();};}function saveUpdates(_0xd10701,_0x3e25da){return function(_0x3f5fcf){if(_0x3f5fcf){return _0x3f5fcf['update'](_0xd10701)['then'](function(_0x30ca9c){return _0x30ca9c;});}return null;};}function removeEntity(_0x28b396,_0x37da51){return function(_0x440b93){if(_0x440b93){return _0x440b93['destroy']()[_0x1150('0x23')](function(){_0x28b396[_0x1150('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b82ba,_0x497ef2){return function(_0x39b1bd){if(!_0x39b1bd){_0x4b82ba[_0x1150('0x17')](0x194);}return _0x39b1bd;};}function handleError(_0x5707ce,_0x2fbda8){_0x2fbda8=_0x2fbda8||0x1f4;return function(_0x1ebf83){logger['error'](_0x1ebf83[_0x1150('0x24')]);if(_0x1ebf83[_0x1150('0x25')]){delete _0x1ebf83[_0x1150('0x25')];}_0x5707ce[_0x1150('0x18')](_0x2fbda8)[_0x1150('0x26')](_0x1ebf83);};}exports[_0x1150('0x27')]=function(_0x213e81,_0x3a88df){var _0x4ad8f3={},_0x32c245={},_0x3b67f9={'count':0x0,'rows':[]};var _0x26f6dd=_[_0x1150('0x28')](db[_0x1150('0x29')]['rawAttributes'],function(_0x1e3691){return{'name':_0x1e3691[_0x1150('0x2a')],'type':_0x1e3691[_0x1150('0x2b')]['key']};});_0x32c245['model']=_[_0x1150('0x28')](_0x26f6dd,_0x1150('0x25'));_0x32c245[_0x1150('0x2c')]=_[_0x1150('0x2d')](_0x213e81[_0x1150('0x2c')]);_0x32c245[_0x1150('0x2e')]=_[_0x1150('0x2f')](_0x32c245['model'],_0x32c245[_0x1150('0x2c')]);_0x4ad8f3[_0x1150('0x30')]=_['intersection'](_0x32c245[_0x1150('0x31')],qs['fields'](_0x213e81['query'][_0x1150('0x32')]));_0x4ad8f3[_0x1150('0x30')]=_0x4ad8f3[_0x1150('0x30')][_0x1150('0x33')]?_0x4ad8f3['attributes']:_0x32c245[_0x1150('0x31')];if(!_0x213e81[_0x1150('0x2c')][_0x1150('0x34')](_0x1150('0x35'))){_0x4ad8f3[_0x1150('0x1c')]=qs[_0x1150('0x1c')](_0x213e81[_0x1150('0x2c')]['limit']);_0x4ad8f3[_0x1150('0x1a')]=qs[_0x1150('0x1a')](_0x213e81[_0x1150('0x2c')]['offset']);}_0x4ad8f3[_0x1150('0x36')]=qs[_0x1150('0x37')](_0x213e81[_0x1150('0x2c')]['sort']);_0x4ad8f3['where']=qs[_0x1150('0x2e')](_[_0x1150('0x38')](_0x213e81[_0x1150('0x2c')],_0x32c245['filters']),_0x26f6dd);if(_0x213e81['query'][_0x1150('0x39')]){_0x4ad8f3[_0x1150('0x3a')]=_['merge'](_0x4ad8f3[_0x1150('0x3a')],{'$or':_[_0x1150('0x28')](_0x26f6dd,function(_0x1435d3){if(_0x1435d3['type']!=='VIRTUAL'){var _0x10572e={};_0x10572e[_0x1435d3[_0x1150('0x25')]]={'$like':'%'+_0x213e81['query'][_0x1150('0x39')]+'%'};return _0x10572e;}})});}_0x4ad8f3=_[_0x1150('0x3b')]({},_0x4ad8f3,_0x213e81[_0x1150('0x3c')]);var _0x51e2cf={'where':_0x4ad8f3[_0x1150('0x3a')]};return db[_0x1150('0x29')][_0x1150('0x1d')](_0x51e2cf)[_0x1150('0x23')](function(_0x10429c){_0x3b67f9[_0x1150('0x1d')]=_0x10429c;if(_0x213e81[_0x1150('0x2c')][_0x1150('0x3d')]){_0x4ad8f3['include']=[{'all':!![]}];}return db[_0x1150('0x29')][_0x1150('0x3e')](_0x4ad8f3);})['then'](function(_0x3e56b6){_0x3b67f9[_0x1150('0x3f')]=_0x3e56b6;return _0x3b67f9;})[_0x1150('0x23')](respondWithFilteredResult(_0x3a88df,_0x4ad8f3))[_0x1150('0x40')](handleError(_0x3a88df,null));};exports[_0x1150('0x41')]=function(_0x15e483,_0x539cff){var _0x11a7ed={'raw':!![],'where':{'id':_0x15e483[_0x1150('0x42')]['id']}},_0x4db1cf={};_0x4db1cf['model']=_[_0x1150('0x2d')](db['JscriptyAnswerReport'][_0x1150('0x43')]);_0x4db1cf[_0x1150('0x2c')]=_[_0x1150('0x2d')](_0x15e483['query']);_0x4db1cf['filters']=_[_0x1150('0x2f')](_0x4db1cf[_0x1150('0x31')],_0x4db1cf['query']);_0x11a7ed[_0x1150('0x30')]=_[_0x1150('0x2f')](_0x4db1cf[_0x1150('0x31')],qs[_0x1150('0x32')](_0x15e483[_0x1150('0x2c')][_0x1150('0x32')]));_0x11a7ed[_0x1150('0x30')]=_0x11a7ed['attributes'][_0x1150('0x33')]?_0x11a7ed[_0x1150('0x30')]:_0x4db1cf[_0x1150('0x31')];if(_0x15e483['query'][_0x1150('0x3d')]){_0x11a7ed[_0x1150('0x44')]=[{'all':!![]}];}_0x11a7ed=_['merge']({},_0x11a7ed,_0x15e483['options']);return db[_0x1150('0x29')]['find'](_0x11a7ed)[_0x1150('0x23')](handleEntityNotFound(_0x539cff,null))[_0x1150('0x23')](respondWithResult(_0x539cff,null))[_0x1150('0x40')](handleError(_0x539cff,null));};exports['create']=function(_0x2160a0,_0x41f1eb){return db[_0x1150('0x29')][_0x1150('0x45')](_0x2160a0[_0x1150('0x46')],{})[_0x1150('0x23')](respondWithResult(_0x41f1eb,0xc9))[_0x1150('0x40')](handleError(_0x41f1eb,null));};exports[_0x1150('0x47')]=function(_0xedd0b7,_0x4f10a1){if(_0xedd0b7[_0x1150('0x46')]['id']){delete _0xedd0b7[_0x1150('0x46')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0xedd0b7[_0x1150('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f10a1,null))['then'](saveUpdates(_0xedd0b7['body'],null))[_0x1150('0x23')](respondWithResult(_0x4f10a1,null))[_0x1150('0x40')](handleError(_0x4f10a1,null));};exports['destroy']=function(_0x18bf8b,_0x3e77f1){return db[_0x1150('0x29')]['find']({'where':{'id':_0x18bf8b[_0x1150('0x42')]['id']}})[_0x1150('0x23')](handleEntityNotFound(_0x3e77f1,null))['then'](removeEntity(_0x3e77f1,null))[_0x1150('0x40')](handleError(_0x3e77f1,null));};exports[_0x1150('0x48')]=function(_0x1f9062,_0x357854){return db[_0x1150('0x29')]['describe']()['then'](respondWithResult(_0x357854,null))[_0x1150('0x40')](handleError(_0x357854,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index fd224ad..1b40c61 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 _0x9bd6=['JscriptyAnswerReport','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x9bd6,0x199));var _0x69bd=function(_0x35c7cd,_0x38cd17){_0x35c7cd=_0x35c7cd-0x0;var _0x59ac70=_0x9bd6[_0x35c7cd];return _0x59ac70;};'use strict';var _=require(_0x69bd('0x0'));var util=require(_0x69bd('0x1'));var logger=require('../../config/logger')(_0x69bd('0x2'));var moment=require(_0x69bd('0x3'));var BPromise=require(_0x69bd('0x4'));var rp=require(_0x69bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69bd('0x6'));var config=require(_0x69bd('0x7'));var attributes=require(_0x69bd('0x8'));module[_0x69bd('0x9')]=function(_0x2367b9,_0x58263f){return _0x2367b9[_0x69bd('0xa')](_0x69bd('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56dd=['JscriptyAnswerReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x5d4baa,_0x3d641f){var _0x19743b=function(_0x41d2ba){while(--_0x41d2ba){_0x5d4baa['push'](_0x5d4baa['shift']());}};_0x19743b(++_0x3d641f);}(_0x56dd,0x139));var _0xd56d=function(_0x41ac36,_0x3feb46){_0x41ac36=_0x41ac36-0x0;var _0x3dfb50=_0x56dd[_0x41ac36];return _0x3dfb50;};'use strict';var _=require(_0xd56d('0x0'));var util=require('util');var logger=require(_0xd56d('0x1'))(_0xd56d('0x2'));var moment=require(_0xd56d('0x3'));var BPromise=require(_0xd56d('0x4'));var rp=require(_0xd56d('0x5'));var fs=require('fs');var path=require(_0xd56d('0x6'));var rimraf=require(_0xd56d('0x7'));var config=require('../../config/environment');var attributes=require(_0xd56d('0x8'));module[_0xd56d('0x9')]=function(_0x1cc04d,_0x5d46cb){return _0x1cc04d[_0xd56d('0xa')](_0xd56d('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index e5872e8..985a271 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 _0xa320=['../../config/environment','jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1df742,_0x3bc9e3){var _0x5ca1db=function(_0x473842){while(--_0x473842){_0x1df742['push'](_0x1df742['shift']());}};_0x5ca1db(++_0x3bc9e3);}(_0xa320,0x1df));var _0x0a32=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xa320[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x0a32('0x0'));var util=require(_0x0a32('0x1'));var moment=require(_0x0a32('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a32('0x3'));var db=require(_0x0a32('0x4'))['db'];var utils=require(_0x0a32('0x5'));var logger=require('../../config/logger')(_0x0a32('0x6'));var config=require(_0x0a32('0x7'));var jayson=require(_0x0a32('0x8'));var client=jayson['client'][_0x0a32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x681322,_0x501d13,_0x3181aa){return new BPromise(function(_0x315683,_0x185774){return client['request'](_0x681322,_0x3181aa)[_0x0a32('0xa')](function(_0x45217a){logger[_0x0a32('0xb')](_0x0a32('0xc'),_0x501d13,'request\x20sent');logger[_0x0a32('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x501d13,_0x0a32('0xe'),JSON['stringify'](_0x45217a));if(_0x45217a[_0x0a32('0xf')]){if(_0x45217a['error']['code']===0x1f4){logger['error'](_0x0a32('0xc'),_0x501d13,_0x45217a[_0x0a32('0xf')]['message']);return _0x185774(_0x45217a['error'][_0x0a32('0x10')]);}logger[_0x0a32('0xf')](_0x0a32('0xc'),_0x501d13,_0x45217a['error'][_0x0a32('0x10')]);return _0x315683(_0x45217a[_0x0a32('0xf')][_0x0a32('0x10')]);}else{logger[_0x0a32('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x501d13,'request\x20sent');_0x315683(_0x45217a[_0x0a32('0x11')][_0x0a32('0x10')]);}})['catch'](function(_0x4571d4){logger['error'](_0x0a32('0xc'),_0x501d13,_0x4571d4);_0x185774(_0x4571d4);});});} \ No newline at end of file +var _0x0b23=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0xf56197,_0x3da8f3){var _0x3dd377=function(_0x3fca02){while(--_0x3fca02){_0xf56197['push'](_0xf56197['shift']());}};_0x3dd377(++_0x3da8f3);}(_0x0b23,0x14d));var _0x30b2=function(_0x4694dd,_0x58a6c1){_0x4694dd=_0x4694dd-0x0;var _0xa2fbbc=_0x0b23[_0x4694dd];return _0xa2fbbc;};'use strict';var _=require(_0x30b2('0x0'));var util=require(_0x30b2('0x1'));var moment=require(_0x30b2('0x2'));var BPromise=require(_0x30b2('0x3'));var rs=require(_0x30b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30b2('0x5'))['db'];var utils=require(_0x30b2('0x6'));var logger=require('../../config/logger')(_0x30b2('0x7'));var config=require(_0x30b2('0x8'));var jayson=require(_0x30b2('0x9'));var client=jayson[_0x30b2('0xa')][_0x30b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a49c4,_0x1ae1d6,_0xd6dade){return new BPromise(function(_0x12288c,_0x42bc83){return client['request'](_0x2a49c4,_0xd6dade)[_0x30b2('0xc')](function(_0x4d246e){logger[_0x30b2('0xd')](_0x30b2('0xe'),_0x1ae1d6,'request\x20sent');logger[_0x30b2('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1ae1d6,_0x30b2('0x10'),JSON[_0x30b2('0x11')](_0x4d246e));if(_0x4d246e['error']){if(_0x4d246e[_0x30b2('0x12')]['code']===0x1f4){logger[_0x30b2('0x12')](_0x30b2('0xe'),_0x1ae1d6,_0x4d246e[_0x30b2('0x12')][_0x30b2('0x13')]);return _0x42bc83(_0x4d246e[_0x30b2('0x12')][_0x30b2('0x13')]);}logger[_0x30b2('0x12')](_0x30b2('0xe'),_0x1ae1d6,_0x4d246e[_0x30b2('0x12')][_0x30b2('0x13')]);return _0x12288c(_0x4d246e['error'][_0x30b2('0x13')]);}else{logger['info'](_0x30b2('0xe'),_0x1ae1d6,_0x30b2('0x10'));_0x12288c(_0x4d246e[_0x30b2('0x14')][_0x30b2('0x13')]);}})[_0x30b2('0x15')](function(_0x5e9e41){logger[_0x30b2('0x12')](_0x30b2('0xe'),_0x1ae1d6,_0x5e9e41);_0x42bc83(_0x5e9e41);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 262e037..c314a23 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 _0x0675=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','getSessions','/:id/answers','isAuthenticated','getAnswers','30s','getSummary','post','create','/:id/clone','clone','update','delete','destroy'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0675,0xd0));var _0x5067=function(_0x337d6a,_0x2e2c12){_0x337d6a=_0x337d6a-0x0;var _0x58d299=_0x0675[_0x337d6a];return _0x58d299;};'use strict';var multer=require(_0x5067('0x0'));var util=require(_0x5067('0x1'));var path=require(_0x5067('0x2'));var timeout=require(_0x5067('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5067('0x4'));var auth=require(_0x5067('0x5'));var interaction=require(_0x5067('0x6'));var config=require('../../config/environment');var controller=require(_0x5067('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5067('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5067('0x8')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x5067('0x9')]);router[_0x5067('0x8')](_0x5067('0xa'),auth[_0x5067('0xb')](),controller[_0x5067('0xc')]);router[_0x5067('0x8')]('/:id/summary',auth[_0x5067('0xb')](),timeout(_0x5067('0xd')),controller[_0x5067('0xe')]);router[_0x5067('0xf')]('/',auth[_0x5067('0xb')](),controller[_0x5067('0x10')]);router[_0x5067('0xf')](_0x5067('0x11'),auth[_0x5067('0xb')](),controller[_0x5067('0x12')]);router['put']('/:id',auth[_0x5067('0xb')](),controller[_0x5067('0x13')]);router[_0x5067('0x14')]('/:id',auth[_0x5067('0xb')](),controller[_0x5067('0x15')]);module[_0x5067('0x16')]=router; \ No newline at end of file +var _0xebeb=['getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions'];(function(_0x26eb78,_0x571a8c){var _0xfbe852=function(_0x4fdb5b){while(--_0x4fdb5b){_0x26eb78['push'](_0x26eb78['shift']());}};_0xfbe852(++_0x571a8c);}(_0xebeb,0x131));var _0xbebe=function(_0xdcdce9,_0x210041){_0xdcdce9=_0xdcdce9-0x0;var _0x2f8997=_0xebeb[_0xdcdce9];return _0x2f8997;};'use strict';var multer=require('multer');var util=require(_0xbebe('0x0'));var path=require(_0xbebe('0x1'));var timeout=require(_0xbebe('0x2'));var express=require(_0xbebe('0x3'));var router=express[_0xbebe('0x4')]();var fs_extra=require(_0xbebe('0x5'));var auth=require(_0xbebe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbebe('0x7'));var controller=require(_0xbebe('0x8'));router[_0xbebe('0x9')]('/',auth[_0xbebe('0xa')](),controller[_0xbebe('0xb')]);router[_0xbebe('0x9')]('/:id',auth[_0xbebe('0xa')](),controller[_0xbebe('0xc')]);router['get'](_0xbebe('0xd'),auth[_0xbebe('0xa')](),controller[_0xbebe('0xe')]);router[_0xbebe('0x9')](_0xbebe('0xf'),auth[_0xbebe('0xa')](),controller[_0xbebe('0x10')]);router['get'](_0xbebe('0x11'),auth[_0xbebe('0xa')](),timeout(_0xbebe('0x12')),controller[_0xbebe('0x13')]);router['post']('/',auth[_0xbebe('0xa')](),controller['create']);router[_0xbebe('0x14')](_0xbebe('0x15'),auth[_0xbebe('0xa')](),controller[_0xbebe('0x16')]);router[_0xbebe('0x17')](_0xbebe('0x18'),auth[_0xbebe('0xa')](),controller[_0xbebe('0x19')]);router[_0xbebe('0x1a')](_0xbebe('0x18'),auth[_0xbebe('0xa')](),controller[_0xbebe('0x1b')]);module[_0xbebe('0x1c')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index d74b4b8..638c83e 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 _0xf392=['description','BOOLEAN','lodash','util','exports','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xf392,0xd4));var _0x2f39=function(_0x34be1d,_0x55d221){_0x34be1d=_0x34be1d-0x0;var _0x4682e9=_0xf392[_0x34be1d];return _0x4682e9;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2f39('0x0'));var util=require(_0x2f39('0x1'));module[_0x2f39('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x2f39('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2f39('0x4')](_0x2f39('0x5')),'set':function(_0x315b2a){if(_[_0x2f39('0x6')](_0x315b2a)){this[_0x2f39('0x7')](_0x2f39('0x8'),JSON[_0x2f39('0x9')](_0x315b2a));}else if(_[_0x2f39('0xa')](_0x315b2a)){this[_0x2f39('0x7')]('formData',_0x315b2a);}else{this['setDataValue']('formData',util['format'](_0x2f39('0xb'),this[_0x2f39('0xc')]('name')||'',this[_0x2f39('0xc')](_0x2f39('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2f39('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2f39('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x4825=['isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description','BOOLEAN','sequelize','lodash','exports','name','STRING','TEXT','long'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x4825,0xf9));var _0x5482=function(_0x1cceb6,_0x123dfb){_0x1cceb6=_0x1cceb6-0x0;var _0x431a22=_0x4825[_0x1cceb6];return _0x431a22;};'use strict';var Sequelize=require(_0x5482('0x0'));var _=require(_0x5482('0x1'));var util=require('util');module[_0x5482('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x5482('0x3')},'description':{'type':Sequelize[_0x5482('0x4')]},'formData':{'type':Sequelize[_0x5482('0x5')](_0x5482('0x6')),'set':function(_0x597296){if(_[_0x5482('0x7')](_0x597296)){this[_0x5482('0x8')](_0x5482('0x9'),JSON[_0x5482('0xa')](_0x597296));}else if(_[_0x5482('0xb')](_0x597296)){this[_0x5482('0x8')]('formData',_0x597296);}else{this[_0x5482('0x8')]('formData',util[_0x5482('0xc')](_0x5482('0xd'),this['getDataValue'](_0x5482('0x3'))||'',this['getDataValue'](_0x5482('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5482('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c34de25..3a848ad 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 _0xaebd=['indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','setHeader','Content-disposition','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Projects','destroy','stack','name','send','map','JscriptyProject','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','keys','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','userProfileId','UserProfileResource','params','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','findAll','number','toString'];(function(_0x170016,_0xc2693c){var _0x406a91=function(_0x14ebd5){while(--_0x14ebd5){_0x170016['push'](_0x170016['shift']());}};_0x406a91(++_0xc2693c);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x109682,_0x2b5344){_0x109682=_0x109682-0x0;var _0x7b8ed0=_0xaebd[_0x109682];return _0x7b8ed0;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){var _0x398616=_0x254c3b[_0xdaeb('0x24')]({'plain':!![]});var _0x3b0770=_0xdaeb('0x25');return db['UserProfileResource'][_0xdaeb('0x26')]({'where':{'type':_0x3b0770,'resourceId':_0x398616['id']}})[_0xdaeb('0x23')](function(){return _0x254c3b;});})[_0xdaeb('0x23')](function(){_0x39dfae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43095f,_0x4e7f44){return function(_0x5045f8){if(!_0x5045f8){_0x43095f[_0xdaeb('0x15')](0x194);}return _0x5045f8;};}function handleError(_0x1ff9af,_0x3e2b8c){_0x3e2b8c=_0x3e2b8c||0x1f4;return function(_0x5eb7b5){logger['error'](_0x5eb7b5[_0xdaeb('0x27')]);if(_0x5eb7b5[_0xdaeb('0x28')]){delete _0x5eb7b5[_0xdaeb('0x28')];}_0x1ff9af['status'](_0x3e2b8c)[_0xdaeb('0x29')](_0x5eb7b5);};}exports['index']=function(_0x4da82d,_0x28812c){var _0x21f6cf={},_0x2fb019={},_0x28c15c={'count':0x0,'rows':[]};var _0x3276c2=_[_0xdaeb('0x2a')](db[_0xdaeb('0x2b')]['rawAttributes'],function(_0x1c1c7c){return{'name':_0x1c1c7c[_0xdaeb('0x2c')],'type':_0x1c1c7c[_0xdaeb('0x2d')][_0xdaeb('0x2e')]};});_0x2fb019[_0xdaeb('0x2f')]=_['map'](_0x3276c2,_0xdaeb('0x28'));_0x2fb019[_0xdaeb('0x30')]=_['keys'](_0x4da82d[_0xdaeb('0x30')]);_0x2fb019[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],_0x2fb019[_0xdaeb('0x30')]);_0x21f6cf[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x4da82d[_0xdaeb('0x30')]['fields']));_0x21f6cf['attributes']=_0x21f6cf[_0xdaeb('0x33')]['length']?_0x21f6cf[_0xdaeb('0x33')]:_0x2fb019[_0xdaeb('0x2f')];if(!_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x35')](_0xdaeb('0x36'))){_0x21f6cf[_0xdaeb('0x1c')]=qs['limit'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x21f6cf[_0xdaeb('0x1b')]=qs['offset'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0x21f6cf[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x21f6cf[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x4da82d[_0xdaeb('0x30')],_0x2fb019['filters']),_0x3276c2);if(_0x4da82d['query'][_0xdaeb('0x3b')]){_0x21f6cf[_0xdaeb('0x39')]=_['merge'](_0x21f6cf[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x3276c2,function(_0x5a4de2){if(_0x5a4de2[_0xdaeb('0x2d')]!==_0xdaeb('0x3c')){var _0x4ecba7={};_0x4ecba7[_0x5a4de2['name']]={'$like':'%'+_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x4ecba7;}})});}_0x21f6cf=_[_0xdaeb('0x3d')]({},_0x21f6cf,_0x4da82d[_0xdaeb('0x3e')]);var _0x2ea883={'where':_0x21f6cf[_0xdaeb('0x39')]};return db['JscriptyProject'][_0xdaeb('0x1a')](_0x2ea883)['then'](function(_0x46aa44){_0x28c15c['count']=_0x46aa44;if(_0x4da82d['query'][_0xdaeb('0x3f')]){_0x21f6cf['include']=[{'all':!![]}];}return db[_0xdaeb('0x2b')]['findAll'](_0x21f6cf);})[_0xdaeb('0x23')](function(_0x244369){_0x28c15c[_0xdaeb('0x40')]=_0x244369;return _0x28c15c;})[_0xdaeb('0x23')](respondWithFilteredResult(_0x28812c,_0x21f6cf))['catch'](handleError(_0x28812c,null));};exports[_0xdaeb('0x41')]=function(_0x5a4b41,_0x3cc6a4){var _0xfb250e={'raw':![],'where':{'id':_0x5a4b41['params']['id']}},_0x447ef0={};_0x447ef0[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x447ef0[_0xdaeb('0x30')]=_[_0xdaeb('0x42')](_0x5a4b41[_0xdaeb('0x30')]);_0x447ef0[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x447ef0[_0xdaeb('0x2f')],_0x447ef0[_0xdaeb('0x30')]);_0xfb250e[_0xdaeb('0x33')]=_['intersection'](_0x447ef0[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x5a4b41['query']['fields']));_0xfb250e[_0xdaeb('0x33')]=_0xfb250e[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xfb250e['attributes']:_0x447ef0[_0xdaeb('0x2f')];if(_0x5a4b41[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xfb250e[_0xdaeb('0x45')]=[{'all':!![]}];}_0xfb250e=_[_0xdaeb('0x3d')]({},_0xfb250e,_0x5a4b41[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')][_0xdaeb('0x46')](_0xfb250e)['then'](handleEntityNotFound(_0x3cc6a4,null))[_0xdaeb('0x23')](respondWithResult(_0x3cc6a4,null))[_0xdaeb('0x47')](handleError(_0x3cc6a4,null));};exports['create']=function(_0x38d2ee,_0x4dd70c){return db[_0xdaeb('0x2b')][_0xdaeb('0x48')](_0x38d2ee[_0xdaeb('0x49')],{})[_0xdaeb('0x23')](function(_0x5df403){var _0x449f64=_0x38d2ee[_0xdaeb('0x4a')][_0xdaeb('0x24')]({'plain':!![]});if(!_0x449f64)throw new Error(_0xdaeb('0x4b'));if(_0x449f64['role']==='user'){var _0x1403c8=_0x5df403[_0xdaeb('0x24')]({'plain':!![]});var _0x311219=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x311219,'userProfileId':_0x449f64['userProfileId']},'raw':!![]})[_0xdaeb('0x23')](function(_0x42af1a){if(_0x42af1a&&_0x42af1a[_0xdaeb('0x4d')]===0x0){return db['UserProfileResource'][_0xdaeb('0x48')]({'name':_0x1403c8['name'],'resourceId':_0x1403c8['id'],'type':_0x42af1a[_0xdaeb('0x28')],'sectionId':_0x42af1a['id']},{})[_0xdaeb('0x23')](function(){return _0x5df403;});}else{return _0x5df403;}})[_0xdaeb('0x47')](function(_0x395e2c){logger[_0xdaeb('0x4e')](_0xdaeb('0x4f'),_0x395e2c);throw _0x395e2c;});}return _0x5df403;})['then'](respondWithResult(_0x4dd70c,0xc9))['catch'](handleError(_0x4dd70c,null));};exports['clone']=function(_0x2260c5,_0x10287e){var _0x4dbcb5={'where':{'id':_0x2260c5['params']['id']}},_0x4faf72={};_0x4faf72[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x4dbcb5[_0xdaeb('0x33')]=_['intersection'](_0x4faf72[_0xdaeb('0x2f')],qs['fields'](_0x2260c5[_0xdaeb('0x30')][_0xdaeb('0x34')]));_0x4dbcb5[_0xdaeb('0x33')]=_0x4dbcb5[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0x4dbcb5[_0xdaeb('0x33')]:_0x4faf72['model'];if(_0x2260c5['query'][_0xdaeb('0x3f')]){_0x4dbcb5['include']=[{'all':!![]}];}_0x4dbcb5=_[_0xdaeb('0x3d')]({},_0x4dbcb5,_0x2260c5[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')]['find'](_0x4dbcb5)[_0xdaeb('0x23')](handleEntityNotFound(_0x10287e,null))[_0xdaeb('0x23')](function(_0x2432ef){if(_0x2432ef){var _0x1b8729=_0x2432ef[_0xdaeb('0x24')]({'plain':!![]});_0x1b8729=qs[_0xdaeb('0x50')](_0x1b8729,['id',_0xdaeb('0x51'),_0xdaeb('0x52')]);_0x2260c5[_0xdaeb('0x49')]=_['omit'](_0x2260c5[_0xdaeb('0x49')],['id',_0xdaeb('0x51'),_0xdaeb('0x52')]);return db[_0xdaeb('0x2b')]['create'](_['merge'](_0x1b8729,_0x2260c5[_0xdaeb('0x49')]),{'include':_0x2260c5[_0xdaeb('0x30')][_0xdaeb('0x3f')]?[{'all':!![]}]:undefined})[_0xdaeb('0x23')](function(_0x4c734e){var _0x3147ec=_0x2260c5['user'][_0xdaeb('0x24')]({'plain':!![]});if(!_0x3147ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3147ec[_0xdaeb('0x53')]==='user'){var _0x240701=_0x4c734e[_0xdaeb('0x24')]({'plain':!![]});var _0x11d066=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x11d066,'userProfileId':_0x3147ec[_0xdaeb('0x54')]},'raw':!![]})[_0xdaeb('0x23')](function(_0x40aec7){if(_0x40aec7&&_0x40aec7[_0xdaeb('0x4d')]===0x0){return db[_0xdaeb('0x55')][_0xdaeb('0x48')]({'name':_0x240701['name'],'resourceId':_0x240701['id'],'type':_0x40aec7[_0xdaeb('0x28')],'sectionId':_0x40aec7['id']},{})[_0xdaeb('0x23')](function(){return _0x4c734e;});}else{return _0x4c734e;}})['catch'](function(_0x469781){logger['error'](_0xdaeb('0x4f'),_0x469781);throw _0x469781;});}return _0x4c734e;});}})[_0xdaeb('0x23')](respondWithResult(_0x10287e,0xc9))['catch'](handleError(_0x10287e,null));};exports[_0xdaeb('0x22')]=function(_0x3f86f4,_0x22981f){if(_0x3f86f4[_0xdaeb('0x49')]['id']){delete _0x3f86f4[_0xdaeb('0x49')]['id'];}return db[_0xdaeb('0x2b')]['find']({'where':{'id':_0x3f86f4[_0xdaeb('0x56')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x22981f,null))[_0xdaeb('0x23')](saveUpdates(_0x3f86f4[_0xdaeb('0x49')],null))[_0xdaeb('0x23')](respondWithResult(_0x22981f,null))[_0xdaeb('0x47')](handleError(_0x22981f,null));};exports[_0xdaeb('0x26')]=function(_0x4dc2d0,_0x333954){return db[_0xdaeb('0x2b')][_0xdaeb('0x46')]({'where':{'id':_0x4dc2d0[_0xdaeb('0x56')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x333954,null))['then'](removeEntity(_0x333954,null))[_0xdaeb('0x47')](handleError(_0x333954,null));};exports[_0xdaeb('0x57')]=function(_0x29a06f,_0x2d4d57,_0x4e8b64){var _0xc0c7ad={'raw':!![],'where':{}};var _0x1e2e56={};var _0x3a7af9={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xdaeb('0x58')]({'where':{'id':_0x29a06f[_0xdaeb('0x56')]['id']}})['then'](handleEntityNotFound(_0x2d4d57,null))[_0xdaeb('0x23')](function(_0x36a54e){if(_0x36a54e){_0x1e2e56[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db['JscriptySessionReport'][_0xdaeb('0x43')]);_0x1e2e56['query']=_[_0xdaeb('0x42')](_0x29a06f[_0xdaeb('0x30')]);_0x1e2e56[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x1e2e56[_0xdaeb('0x2f')],_0x1e2e56[_0xdaeb('0x30')]);_0xc0c7ad[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x1e2e56['model'],qs[_0xdaeb('0x34')](_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x34')]));_0xc0c7ad[_0xdaeb('0x33')]=_0xc0c7ad[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xc0c7ad[_0xdaeb('0x33')]:_0x1e2e56[_0xdaeb('0x2f')];if(!_0x29a06f['query']['hasOwnProperty'](_0xdaeb('0x36'))){_0xc0c7ad[_0xdaeb('0x1c')]=qs[_0xdaeb('0x1c')](_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0xc0c7ad[_0xdaeb('0x1b')]=qs['offset'](_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0xc0c7ad[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x29a06f[_0xdaeb('0x30')]['sort']);_0xc0c7ad['where']=qs[_0xdaeb('0x31')](_[_0xdaeb('0x3a')](_0x29a06f[_0xdaeb('0x30')],_0x1e2e56['filters']));_0xc0c7ad[_0xdaeb('0x39')][_0xdaeb('0x59')]=_0x36a54e['id'];if(_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x3b')]){_0xc0c7ad[_0xdaeb('0x39')]=_[_0xdaeb('0x3d')](_0xc0c7ad['where'],{'$or':_[_0xdaeb('0x2a')](_0xc0c7ad['attributes'],function(_0x3b41bb){var _0x34bbc2={};_0x34bbc2[_0x3b41bb]={'$like':'%'+_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x34bbc2;})});}_0xc0c7ad=_['merge']({},_0xc0c7ad,_0x29a06f[_0xdaeb('0x3e')]);return db[_0xdaeb('0x5a')][_0xdaeb('0x1a')]({'where':_0xc0c7ad['where']})[_0xdaeb('0x23')](function(_0x2ec82c){_0x3a7af9[_0xdaeb('0x1a')]=_0x2ec82c;if(_0x29a06f[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xc0c7ad['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xc0c7ad);})[_0xdaeb('0x23')](function(_0x590319){_0x3a7af9[_0xdaeb('0x40')]=_0x590319;return _0x3a7af9;});}})[_0xdaeb('0x23')](respondWithFilteredResult(_0x2d4d57,_0xc0c7ad))['catch'](handleError(_0x2d4d57,null));};exports[_0xdaeb('0x5b')]=function(_0x5ebfb8,_0x2a2b73,_0x40e630){var _0x7420cc={'raw':!![],'where':{}};var _0x33c455={};var _0x3f0162={'count':0x0,'rows':[]};return db[_0xdaeb('0x2b')]['findOne']({'where':{'id':_0x5ebfb8[_0xdaeb('0x56')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x2a2b73,null))[_0xdaeb('0x23')](function(_0x52c908){if(_0x52c908){_0x33c455[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x5c')]['rawAttributes']);_0x33c455[_0xdaeb('0x30')]=_['keys'](_0x5ebfb8[_0xdaeb('0x30')]);_0x33c455[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x33c455[_0xdaeb('0x2f')],_0x33c455['query']);_0x7420cc['attributes']=_[_0xdaeb('0x32')](_0x33c455[_0xdaeb('0x2f')],qs['fields'](_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x34')]));_0x7420cc[_0xdaeb('0x33')]=_0x7420cc[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0x7420cc[_0xdaeb('0x33')]:_0x33c455[_0xdaeb('0x2f')];if(!_0x5ebfb8[_0xdaeb('0x30')]['hasOwnProperty'](_0xdaeb('0x36'))){_0x7420cc[_0xdaeb('0x1c')]=qs[_0xdaeb('0x1c')](_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x7420cc[_0xdaeb('0x1b')]=qs[_0xdaeb('0x1b')](_0x5ebfb8['query'][_0xdaeb('0x1b')]);}_0x7420cc[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x7420cc[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x5ebfb8[_0xdaeb('0x30')],_0x33c455['filters']));_0x7420cc['where'][_0xdaeb('0x59')]=_0x52c908['id'];if(_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x3b')]){_0x7420cc['where']=_[_0xdaeb('0x3d')](_0x7420cc[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x7420cc[_0xdaeb('0x33')],function(_0x38171d){var _0x5774c1={};_0x5774c1[_0x38171d]={'$like':'%'+_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x5774c1;})});}_0x7420cc=_['merge']({},_0x7420cc,_0x5ebfb8[_0xdaeb('0x3e')]);return db[_0xdaeb('0x5c')]['count']({'where':_0x7420cc['where']})[_0xdaeb('0x23')](function(_0x1850a3){_0x3f0162[_0xdaeb('0x1a')]=_0x1850a3;if(_0x5ebfb8[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0x7420cc[_0xdaeb('0x45')]=[{'all':!![]}];}return db[_0xdaeb('0x5c')][_0xdaeb('0x5d')](_0x7420cc);})[_0xdaeb('0x23')](function(_0x1c9ff7){_0x3f0162[_0xdaeb('0x40')]=_0x1c9ff7;return _0x3f0162;});}})[_0xdaeb('0x23')](respondWithFilteredResult(_0x2a2b73,_0x7420cc))['catch'](handleError(_0x2a2b73,null));};function char(_0x2d5152){return _0xdaeb('0x5e')===typeof _0x2d5152?String['fromCharCode']['apply'](null,arguments):_0x2d5152;}function needsEncapsulation(_0x332b3a){return!!_0x332b3a&&(_0x332b3a[_0xdaeb('0x5f')]()[_0xdaeb('0x60')](char(0xd))>=0x0||_0x332b3a[_0xdaeb('0x5f')]()['indexOf'](char(0xa))>=0x0||_0x332b3a[_0xdaeb('0x5f')]()[_0xdaeb('0x60')](char(0x2c))>=0x0||_0x332b3a[_0xdaeb('0x5f')]()[_0xdaeb('0x60')](char(0x22))>=0x0);}function encapsulate(_0x3c1237){var _0x5676d3=char(0x22),_0x52d225='\x5c'+char(0x22),_0x20cc70=_0x3c1237[_0xdaeb('0x5f')]()[_0xdaeb('0x61')](new RegExp(_0x5676d3,'g'),_0x52d225);return _0x5676d3+_0x20cc70+_0x5676d3;}exports[_0xdaeb('0x62')]=function(_0x2c56e2,_0x407c42,_0x440798){var _0x4a2a7d,_0x4ca39d;var _0x5f471c={'where':{'ProjectId':_0x2c56e2[_0xdaeb('0x56')]['id']}};if(_0x2c56e2['query'][_0xdaeb('0x63')]){_0x5f471c['where']['starttime']=JSON[_0xdaeb('0x64')](_0x2c56e2['query'][_0xdaeb('0x63')]);}return db[_0xdaeb('0x5a')][_0xdaeb('0x5d')](_0x5f471c)[_0xdaeb('0x23')](handleEntityNotFound(_0x407c42,null))[_0xdaeb('0x23')](function(_0x154187){if(_0x154187){_0x4a2a7d=_0x154187;return db[_0xdaeb('0x65')][_0xdaeb('0x5d')]({'where':{'SessionId':{'$in':_[_0xdaeb('0x2a')](_0x4a2a7d,'id')},'ProjectId':_0x2c56e2[_0xdaeb('0x56')]['id']},'order':_0xdaeb('0x66')});}})['then'](handleEntityNotFound(_0x407c42,null))[_0xdaeb('0x23')](function(_0x5cedea){if(_0x5cedea){_0x4ca39d=_0x5cedea;var _0x34ca2d={};for(var _0x5660c6=0x0,_0x5af1ef=_0x4ca39d[_0xdaeb('0x44')];_0x5660c6<_0x5af1ef;_0x5660c6++){if(!_0x34ca2d[_0xdaeb('0x35')](_0x4ca39d[_0x5660c6][_0xdaeb('0x67')])){_0x34ca2d[_0x4ca39d[_0x5660c6][_0xdaeb('0x67')]]=needsEncapsulation(_0x4ca39d[_0x5660c6][_0xdaeb('0x68')])?encapsulate(_0x4ca39d[_0x5660c6][_0xdaeb('0x68')]):_0x4ca39d[_0x5660c6][_0xdaeb('0x68')];}}var _0x393d47=[],_0x40c3c4={};for(var _0x264bc6=0x0,_0x2f8e60=_0x4a2a7d[_0xdaeb('0x44')];_0x264bc6<_0x2f8e60;_0x264bc6++){_0x40c3c4={'ProjectId':_0x2c56e2[_0xdaeb('0x56')]['id'],'SessionId':_0x4a2a7d[_0x264bc6]['id'],'StartTime':moment(_0x4a2a7d[_0x264bc6][_0xdaeb('0x69')])[_0xdaeb('0x6a')](_0xdaeb('0x6b'))};for(var _0x13b074=0x0,_0x1f8666=_0x4ca39d['length'];_0x13b074<_0x1f8666;_0x13b074++){if(_0x4ca39d[_0x13b074][_0xdaeb('0x6c')]==_0x4a2a7d[_0x264bc6]['id']&&_0x34ca2d[_0xdaeb('0x35')](_0x4ca39d[_0x13b074][_0xdaeb('0x67')])){_0x40c3c4[_0x34ca2d[_0x4ca39d[_0x13b074]['questionId']]]=_0x4ca39d[_0x13b074][_0xdaeb('0x6d')];}}for(var _0x504dc3 in _0x34ca2d){if(!_0x40c3c4[_0xdaeb('0x35')](_0x34ca2d[_0x504dc3])){_0x40c3c4[_0x34ca2d[_0x504dc3]]=null;}}_0x393d47['push'](_0x40c3c4);}return _0x393d47;}})[_0xdaeb('0x23')](function(_0x397580){if(!_['isEmpty'](_0x397580)){var _0x450e95=toCsv(_0x397580);var _0x4ce598=Date[_0xdaeb('0x6e')]();fs['writeFileSync'](util[_0xdaeb('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2c56e2[_0xdaeb('0x56')]['id'],_0x4ce598),_0x450e95);_0x407c42[_0xdaeb('0x6f')](_0xdaeb('0x70'),'attachment;\x20filename='+util[_0xdaeb('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x2c56e2[_0xdaeb('0x56')]['id'],_0x4ce598));_0x407c42[_0xdaeb('0x6f')](_0xdaeb('0x71'),_0xdaeb('0x72'));return _0x407c42[_0xdaeb('0x73')](util['format'](_0xdaeb('0x74'),_0x2c56e2[_0xdaeb('0x56')]['id'],_0x4ce598));}else{return _0x407c42[_0xdaeb('0x15')](0xcc);}})['catch'](handleError(_0x407c42,null));}; \ No newline at end of file +var _0x8ce3=['destroy','then','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','JscriptySessionReport','ProjectId','findAll','getAnswers','findOne','JscriptyAnswerReport','sort','number','toString','indexOf','replace','getSummary','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','sendStatus','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','json','apply','reject','update'];(function(_0x5a6e58,_0x1e52a7){var _0x33e3d3=function(_0x1db2c6){while(--_0x1db2c6){_0x5a6e58['push'](_0x5a6e58['shift']());}};_0x33e3d3(++_0x1e52a7);}(_0x8ce3,0x1b9));var _0x38ce=function(_0x1c4b8d,_0x146a41){_0x1c4b8d=_0x1c4b8d-0x0;var _0x203346=_0x8ce3[_0x1c4b8d];return _0x203346;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38ce('0x0'));var zipdir=require(_0x38ce('0x1'));var jsonpatch=require(_0x38ce('0x2'));var rp=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var BPromise=require(_0x38ce('0x5'));var Mustache=require('mustache');var util=require(_0x38ce('0x6'));var path=require(_0x38ce('0x7'));var sox=require(_0x38ce('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38ce('0x9'));var squel=require(_0x38ce('0xa'));var crypto=require(_0x38ce('0xb'));var jsforce=require(_0x38ce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xd'));var querystring=require(_0x38ce('0xe'));var Papa=require(_0x38ce('0xf'));var Redis=require(_0x38ce('0x10'));var authService=require(_0x38ce('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x38ce('0x12'));var hardwareService=require(_0x38ce('0x13'));var logger=require(_0x38ce('0x14'))(_0x38ce('0x15'));var utils=require(_0x38ce('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x38ce('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e116b,_0x1fb8db){_0x1fb8db=_0x1fb8db||0xcc;return function(_0x4fa946){if(_0x4fa946){return _0x1e116b['sendStatus'](_0x1fb8db);}return _0x1e116b[_0x38ce('0x18')](_0x1fb8db)[_0x38ce('0x19')]();};}function respondWithResult(_0x1db4fa,_0x2ee659){_0x2ee659=_0x2ee659||0xc8;return function(_0x3fc044){if(_0x3fc044){return _0x1db4fa[_0x38ce('0x18')](_0x2ee659)['json'](_0x3fc044);}};}function respondWithFilteredResult(_0x40cef4,_0x143578){return function(_0x2d4333){if(_0x2d4333){var _0x13b7a2=typeof _0x143578[_0x38ce('0x1a')]===_0x38ce('0x1b')&&typeof _0x143578[_0x38ce('0x1c')]===_0x38ce('0x1b');var _0x5c11bd=_0x2d4333[_0x38ce('0x1d')];var _0x4cc437=_0x13b7a2?0x0:_0x143578[_0x38ce('0x1a')];var _0x4dff53=_0x13b7a2?_0x2d4333[_0x38ce('0x1d')]:_0x143578[_0x38ce('0x1a')]+_0x143578['limit'];var _0x2c07fe;if(_0x4dff53>=_0x5c11bd){_0x4dff53=_0x5c11bd;_0x2c07fe=0xc8;}else{_0x2c07fe=0xce;}_0x40cef4['status'](_0x2c07fe);return _0x40cef4[_0x38ce('0x1e')]('Content-Range',_0x4cc437+'-'+_0x4dff53+'/'+_0x5c11bd)[_0x38ce('0x1f')](_0x2d4333);}return null;};}function patchUpdates(_0x239870){return function(_0x31d72e){try{jsonpatch[_0x38ce('0x20')](_0x31d72e,_0x239870,!![]);}catch(_0xf1c9dc){return BPromise[_0x38ce('0x21')](_0xf1c9dc);}return _0x31d72e['save']();};}function saveUpdates(_0x15b1a7,_0x3d691e){return function(_0x250502){if(_0x250502){return _0x250502[_0x38ce('0x22')](_0x15b1a7)['then'](function(_0x3bde0d){return _0x3bde0d;});}return null;};}function removeEntity(_0x248491,_0x59d51c){return function(_0x360299){if(_0x360299){return _0x360299[_0x38ce('0x23')]()[_0x38ce('0x24')](function(){var _0x4d0adf=_0x360299[_0x38ce('0x25')]({'plain':!![]});var _0x5a5564=_0x38ce('0x26');return db[_0x38ce('0x27')][_0x38ce('0x23')]({'where':{'type':_0x5a5564,'resourceId':_0x4d0adf['id']}})[_0x38ce('0x24')](function(){return _0x360299;});})[_0x38ce('0x24')](function(){_0x248491[_0x38ce('0x18')](0xcc)[_0x38ce('0x19')]();});}};}function handleEntityNotFound(_0x4bf539,_0x19edf6){return function(_0x2202dd){if(!_0x2202dd){_0x4bf539['sendStatus'](0x194);}return _0x2202dd;};}function handleError(_0x53d4fe,_0x35a5fb){_0x35a5fb=_0x35a5fb||0x1f4;return function(_0xf29eb2){logger[_0x38ce('0x28')](_0xf29eb2[_0x38ce('0x29')]);if(_0xf29eb2[_0x38ce('0x2a')]){delete _0xf29eb2[_0x38ce('0x2a')];}_0x53d4fe[_0x38ce('0x18')](_0x35a5fb)[_0x38ce('0x2b')](_0xf29eb2);};}exports[_0x38ce('0x2c')]=function(_0x26eefa,_0x2941bc){var _0x536577={},_0x1156fc={},_0x588f05={'count':0x0,'rows':[]};var _0x38cd52=_[_0x38ce('0x2d')](db[_0x38ce('0x2e')]['rawAttributes'],function(_0x210bed){return{'name':_0x210bed[_0x38ce('0x2f')],'type':_0x210bed[_0x38ce('0x30')][_0x38ce('0x31')]};});_0x1156fc['model']=_[_0x38ce('0x2d')](_0x38cd52,_0x38ce('0x2a'));_0x1156fc[_0x38ce('0x32')]=_[_0x38ce('0x33')](_0x26eefa[_0x38ce('0x32')]);_0x1156fc[_0x38ce('0x34')]=_[_0x38ce('0x35')](_0x1156fc[_0x38ce('0x36')],_0x1156fc[_0x38ce('0x32')]);_0x536577[_0x38ce('0x37')]=_[_0x38ce('0x35')](_0x1156fc[_0x38ce('0x36')],qs[_0x38ce('0x38')](_0x26eefa[_0x38ce('0x32')][_0x38ce('0x38')]));_0x536577[_0x38ce('0x37')]=_0x536577['attributes'][_0x38ce('0x39')]?_0x536577['attributes']:_0x1156fc['model'];if(!_0x26eefa['query'][_0x38ce('0x3a')](_0x38ce('0x3b'))){_0x536577[_0x38ce('0x1c')]=qs['limit'](_0x26eefa['query'][_0x38ce('0x1c')]);_0x536577[_0x38ce('0x1a')]=qs[_0x38ce('0x1a')](_0x26eefa[_0x38ce('0x32')][_0x38ce('0x1a')]);}_0x536577[_0x38ce('0x3c')]=qs['sort'](_0x26eefa[_0x38ce('0x32')]['sort']);_0x536577[_0x38ce('0x3d')]=qs[_0x38ce('0x34')](_[_0x38ce('0x3e')](_0x26eefa[_0x38ce('0x32')],_0x1156fc[_0x38ce('0x34')]),_0x38cd52);if(_0x26eefa['query']['filter']){_0x536577[_0x38ce('0x3d')]=_[_0x38ce('0x3f')](_0x536577['where'],{'$or':_[_0x38ce('0x2d')](_0x38cd52,function(_0x22dce3){if(_0x22dce3[_0x38ce('0x30')]!==_0x38ce('0x40')){var _0x8bb4f7={};_0x8bb4f7[_0x22dce3[_0x38ce('0x2a')]]={'$like':'%'+_0x26eefa[_0x38ce('0x32')][_0x38ce('0x41')]+'%'};return _0x8bb4f7;}})});}_0x536577=_[_0x38ce('0x3f')]({},_0x536577,_0x26eefa[_0x38ce('0x42')]);var _0x648c04={'where':_0x536577[_0x38ce('0x3d')]};return db[_0x38ce('0x2e')][_0x38ce('0x1d')](_0x648c04)[_0x38ce('0x24')](function(_0x3f8d66){_0x588f05[_0x38ce('0x1d')]=_0x3f8d66;if(_0x26eefa[_0x38ce('0x32')][_0x38ce('0x43')]){_0x536577['include']=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x536577);})[_0x38ce('0x24')](function(_0x2005fd){_0x588f05[_0x38ce('0x44')]=_0x2005fd;return _0x588f05;})['then'](respondWithFilteredResult(_0x2941bc,_0x536577))[_0x38ce('0x45')](handleError(_0x2941bc,null));};exports['show']=function(_0x4c16f4,_0x3ce828){var _0x52be9c={'raw':![],'where':{'id':_0x4c16f4[_0x38ce('0x46')]['id']}},_0x36360d={};_0x36360d[_0x38ce('0x36')]=_[_0x38ce('0x33')](db[_0x38ce('0x2e')][_0x38ce('0x47')]);_0x36360d[_0x38ce('0x32')]=_[_0x38ce('0x33')](_0x4c16f4['query']);_0x36360d[_0x38ce('0x34')]=_[_0x38ce('0x35')](_0x36360d[_0x38ce('0x36')],_0x36360d[_0x38ce('0x32')]);_0x52be9c[_0x38ce('0x37')]=_[_0x38ce('0x35')](_0x36360d[_0x38ce('0x36')],qs[_0x38ce('0x38')](_0x4c16f4[_0x38ce('0x32')][_0x38ce('0x38')]));_0x52be9c[_0x38ce('0x37')]=_0x52be9c[_0x38ce('0x37')][_0x38ce('0x39')]?_0x52be9c[_0x38ce('0x37')]:_0x36360d[_0x38ce('0x36')];if(_0x4c16f4[_0x38ce('0x32')][_0x38ce('0x43')]){_0x52be9c[_0x38ce('0x48')]=[{'all':!![]}];}_0x52be9c=_['merge']({},_0x52be9c,_0x4c16f4[_0x38ce('0x42')]);return db['JscriptyProject'][_0x38ce('0x49')](_0x52be9c)[_0x38ce('0x24')](handleEntityNotFound(_0x3ce828,null))['then'](respondWithResult(_0x3ce828,null))[_0x38ce('0x45')](handleError(_0x3ce828,null));};exports[_0x38ce('0x4a')]=function(_0x5d9179,_0x86d1c3){return db['JscriptyProject'][_0x38ce('0x4a')](_0x5d9179[_0x38ce('0x4b')],{})['then'](function(_0x2b50e5){var _0x5556e1=_0x5d9179[_0x38ce('0x4c')][_0x38ce('0x25')]({'plain':!![]});if(!_0x5556e1)throw new Error(_0x38ce('0x4d'));if(_0x5556e1[_0x38ce('0x4e')]===_0x38ce('0x4c')){var _0x1ba657=_0x2b50e5[_0x38ce('0x25')]({'plain':!![]});var _0x11541a=_0x38ce('0x26');return db[_0x38ce('0x4f')]['find']({'where':{'name':_0x11541a,'userProfileId':_0x5556e1[_0x38ce('0x50')]},'raw':!![]})[_0x38ce('0x24')](function(_0xd12a5){if(_0xd12a5&&_0xd12a5[_0x38ce('0x51')]===0x0){return db[_0x38ce('0x27')][_0x38ce('0x4a')]({'name':_0x1ba657['name'],'resourceId':_0x1ba657['id'],'type':_0xd12a5['name'],'sectionId':_0xd12a5['id']},{})[_0x38ce('0x24')](function(){return _0x2b50e5;});}else{return _0x2b50e5;}})[_0x38ce('0x45')](function(_0x1ebe26){logger[_0x38ce('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ebe26);throw _0x1ebe26;});}return _0x2b50e5;})[_0x38ce('0x24')](respondWithResult(_0x86d1c3,0xc9))['catch'](handleError(_0x86d1c3,null));};exports[_0x38ce('0x52')]=function(_0x1cfc14,_0x4f28ed){var _0xe02dff={'where':{'id':_0x1cfc14[_0x38ce('0x46')]['id']}},_0x4b8b5e={};_0x4b8b5e[_0x38ce('0x36')]=_['keys'](db[_0x38ce('0x2e')][_0x38ce('0x47')]);_0xe02dff[_0x38ce('0x37')]=_['intersection'](_0x4b8b5e['model'],qs['fields'](_0x1cfc14['query'][_0x38ce('0x38')]));_0xe02dff[_0x38ce('0x37')]=_0xe02dff[_0x38ce('0x37')][_0x38ce('0x39')]?_0xe02dff[_0x38ce('0x37')]:_0x4b8b5e['model'];if(_0x1cfc14['query']['includeAll']){_0xe02dff[_0x38ce('0x48')]=[{'all':!![]}];}_0xe02dff=_[_0x38ce('0x3f')]({},_0xe02dff,_0x1cfc14[_0x38ce('0x42')]);return db[_0x38ce('0x2e')][_0x38ce('0x49')](_0xe02dff)['then'](handleEntityNotFound(_0x4f28ed,null))['then'](function(_0x2a42b6){if(_0x2a42b6){var _0x23d4d8=_0x2a42b6[_0x38ce('0x25')]({'plain':!![]});_0x23d4d8=qs['omit'](_0x23d4d8,['id',_0x38ce('0x53'),_0x38ce('0x54')]);_0x1cfc14['body']=_[_0x38ce('0x55')](_0x1cfc14['body'],['id',_0x38ce('0x53'),'updatedAt']);return db[_0x38ce('0x2e')][_0x38ce('0x4a')](_['merge'](_0x23d4d8,_0x1cfc14[_0x38ce('0x4b')]),{'include':_0x1cfc14[_0x38ce('0x32')][_0x38ce('0x43')]?[{'all':!![]}]:undefined})[_0x38ce('0x24')](function(_0x516535){var _0x3a7475=_0x1cfc14['user'][_0x38ce('0x25')]({'plain':!![]});if(!_0x3a7475)throw new Error(_0x38ce('0x4d'));if(_0x3a7475[_0x38ce('0x4e')]===_0x38ce('0x4c')){var _0x53719e=_0x516535[_0x38ce('0x25')]({'plain':!![]});var _0x323db2='Projects';return db['UserProfileSection'][_0x38ce('0x49')]({'where':{'name':_0x323db2,'userProfileId':_0x3a7475[_0x38ce('0x50')]},'raw':!![]})[_0x38ce('0x24')](function(_0x2ed32f){if(_0x2ed32f&&_0x2ed32f[_0x38ce('0x51')]===0x0){return db[_0x38ce('0x27')][_0x38ce('0x4a')]({'name':_0x53719e['name'],'resourceId':_0x53719e['id'],'type':_0x2ed32f['name'],'sectionId':_0x2ed32f['id']},{})[_0x38ce('0x24')](function(){return _0x516535;});}else{return _0x516535;}})[_0x38ce('0x45')](function(_0x5ed12f){logger[_0x38ce('0x28')](_0x38ce('0x56'),_0x5ed12f);throw _0x5ed12f;});}return _0x516535;});}})[_0x38ce('0x24')](respondWithResult(_0x4f28ed,0xc9))[_0x38ce('0x45')](handleError(_0x4f28ed,null));};exports[_0x38ce('0x22')]=function(_0x24ebd2,_0x3250f0){if(_0x24ebd2[_0x38ce('0x4b')]['id']){delete _0x24ebd2[_0x38ce('0x4b')]['id'];}return db[_0x38ce('0x2e')]['find']({'where':{'id':_0x24ebd2['params']['id']}})[_0x38ce('0x24')](handleEntityNotFound(_0x3250f0,null))[_0x38ce('0x24')](saveUpdates(_0x24ebd2[_0x38ce('0x4b')],null))[_0x38ce('0x24')](respondWithResult(_0x3250f0,null))['catch'](handleError(_0x3250f0,null));};exports[_0x38ce('0x23')]=function(_0x4392dc,_0x15c671){return db[_0x38ce('0x2e')]['find']({'where':{'id':_0x4392dc[_0x38ce('0x46')]['id']}})['then'](handleEntityNotFound(_0x15c671,null))[_0x38ce('0x24')](removeEntity(_0x15c671,null))['catch'](handleError(_0x15c671,null));};exports['getSessions']=function(_0x50d2ec,_0x57526e,_0x441d2f){var _0x110aa3={'raw':!![],'where':{}};var _0x25d6ec={};var _0x1f173f={'count':0x0,'rows':[]};return db[_0x38ce('0x2e')]['findOne']({'where':{'id':_0x50d2ec[_0x38ce('0x46')]['id']}})[_0x38ce('0x24')](handleEntityNotFound(_0x57526e,null))['then'](function(_0xd7e25e){if(_0xd7e25e){_0x25d6ec['model']=_['keys'](db[_0x38ce('0x57')]['rawAttributes']);_0x25d6ec['query']=_[_0x38ce('0x33')](_0x50d2ec[_0x38ce('0x32')]);_0x25d6ec['filters']=_[_0x38ce('0x35')](_0x25d6ec['model'],_0x25d6ec[_0x38ce('0x32')]);_0x110aa3[_0x38ce('0x37')]=_[_0x38ce('0x35')](_0x25d6ec[_0x38ce('0x36')],qs[_0x38ce('0x38')](_0x50d2ec[_0x38ce('0x32')][_0x38ce('0x38')]));_0x110aa3[_0x38ce('0x37')]=_0x110aa3[_0x38ce('0x37')][_0x38ce('0x39')]?_0x110aa3[_0x38ce('0x37')]:_0x25d6ec[_0x38ce('0x36')];if(!_0x50d2ec[_0x38ce('0x32')][_0x38ce('0x3a')](_0x38ce('0x3b'))){_0x110aa3[_0x38ce('0x1c')]=qs['limit'](_0x50d2ec[_0x38ce('0x32')]['limit']);_0x110aa3['offset']=qs[_0x38ce('0x1a')](_0x50d2ec[_0x38ce('0x32')]['offset']);}_0x110aa3['order']=qs['sort'](_0x50d2ec[_0x38ce('0x32')]['sort']);_0x110aa3[_0x38ce('0x3d')]=qs['filters'](_['pick'](_0x50d2ec['query'],_0x25d6ec[_0x38ce('0x34')]));_0x110aa3[_0x38ce('0x3d')][_0x38ce('0x58')]=_0xd7e25e['id'];if(_0x50d2ec['query'][_0x38ce('0x41')]){_0x110aa3[_0x38ce('0x3d')]=_[_0x38ce('0x3f')](_0x110aa3[_0x38ce('0x3d')],{'$or':_[_0x38ce('0x2d')](_0x110aa3[_0x38ce('0x37')],function(_0xbc13f4){var _0x3a58ff={};_0x3a58ff[_0xbc13f4]={'$like':'%'+_0x50d2ec['query'][_0x38ce('0x41')]+'%'};return _0x3a58ff;})});}_0x110aa3=_[_0x38ce('0x3f')]({},_0x110aa3,_0x50d2ec['options']);return db['JscriptySessionReport'][_0x38ce('0x1d')]({'where':_0x110aa3[_0x38ce('0x3d')]})[_0x38ce('0x24')](function(_0x533166){_0x1f173f[_0x38ce('0x1d')]=_0x533166;if(_0x50d2ec[_0x38ce('0x32')][_0x38ce('0x43')]){_0x110aa3[_0x38ce('0x48')]=[{'all':!![]}];}return db[_0x38ce('0x57')][_0x38ce('0x59')](_0x110aa3);})[_0x38ce('0x24')](function(_0x4617c3){_0x1f173f[_0x38ce('0x44')]=_0x4617c3;return _0x1f173f;});}})['then'](respondWithFilteredResult(_0x57526e,_0x110aa3))[_0x38ce('0x45')](handleError(_0x57526e,null));};exports[_0x38ce('0x5a')]=function(_0x255c4c,_0x3de561,_0x489630){var _0x47e078={'raw':!![],'where':{}};var _0x5783c5={};var _0x51036d={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x38ce('0x5b')]({'where':{'id':_0x255c4c[_0x38ce('0x46')]['id']}})[_0x38ce('0x24')](handleEntityNotFound(_0x3de561,null))[_0x38ce('0x24')](function(_0x3b99ed){if(_0x3b99ed){_0x5783c5['model']=_['keys'](db[_0x38ce('0x5c')][_0x38ce('0x47')]);_0x5783c5['query']=_[_0x38ce('0x33')](_0x255c4c['query']);_0x5783c5[_0x38ce('0x34')]=_[_0x38ce('0x35')](_0x5783c5[_0x38ce('0x36')],_0x5783c5[_0x38ce('0x32')]);_0x47e078[_0x38ce('0x37')]=_[_0x38ce('0x35')](_0x5783c5[_0x38ce('0x36')],qs[_0x38ce('0x38')](_0x255c4c[_0x38ce('0x32')][_0x38ce('0x38')]));_0x47e078[_0x38ce('0x37')]=_0x47e078[_0x38ce('0x37')][_0x38ce('0x39')]?_0x47e078[_0x38ce('0x37')]:_0x5783c5[_0x38ce('0x36')];if(!_0x255c4c['query'][_0x38ce('0x3a')](_0x38ce('0x3b'))){_0x47e078[_0x38ce('0x1c')]=qs[_0x38ce('0x1c')](_0x255c4c[_0x38ce('0x32')][_0x38ce('0x1c')]);_0x47e078['offset']=qs[_0x38ce('0x1a')](_0x255c4c['query'][_0x38ce('0x1a')]);}_0x47e078[_0x38ce('0x3c')]=qs[_0x38ce('0x5d')](_0x255c4c[_0x38ce('0x32')][_0x38ce('0x5d')]);_0x47e078[_0x38ce('0x3d')]=qs['filters'](_[_0x38ce('0x3e')](_0x255c4c['query'],_0x5783c5[_0x38ce('0x34')]));_0x47e078[_0x38ce('0x3d')][_0x38ce('0x58')]=_0x3b99ed['id'];if(_0x255c4c[_0x38ce('0x32')]['filter']){_0x47e078[_0x38ce('0x3d')]=_[_0x38ce('0x3f')](_0x47e078['where'],{'$or':_['map'](_0x47e078[_0x38ce('0x37')],function(_0x348413){var _0x308baa={};_0x308baa[_0x348413]={'$like':'%'+_0x255c4c[_0x38ce('0x32')]['filter']+'%'};return _0x308baa;})});}_0x47e078=_[_0x38ce('0x3f')]({},_0x47e078,_0x255c4c[_0x38ce('0x42')]);return db[_0x38ce('0x5c')]['count']({'where':_0x47e078[_0x38ce('0x3d')]})[_0x38ce('0x24')](function(_0x4fc597){_0x51036d[_0x38ce('0x1d')]=_0x4fc597;if(_0x255c4c[_0x38ce('0x32')]['includeAll']){_0x47e078[_0x38ce('0x48')]=[{'all':!![]}];}return db[_0x38ce('0x5c')][_0x38ce('0x59')](_0x47e078);})[_0x38ce('0x24')](function(_0x707373){_0x51036d['rows']=_0x707373;return _0x51036d;});}})[_0x38ce('0x24')](respondWithFilteredResult(_0x3de561,_0x47e078))[_0x38ce('0x45')](handleError(_0x3de561,null));};function char(_0x1b9566){return _0x38ce('0x5e')===typeof _0x1b9566?String['fromCharCode'][_0x38ce('0x20')](null,arguments):_0x1b9566;}function needsEncapsulation(_0x37e19d){return!!_0x37e19d&&(_0x37e19d[_0x38ce('0x5f')]()[_0x38ce('0x60')](char(0xd))>=0x0||_0x37e19d[_0x38ce('0x5f')]()['indexOf'](char(0xa))>=0x0||_0x37e19d['toString']()[_0x38ce('0x60')](char(0x2c))>=0x0||_0x37e19d[_0x38ce('0x5f')]()[_0x38ce('0x60')](char(0x22))>=0x0);}function encapsulate(_0x40a20b){var _0x5a51b9=char(0x22),_0x59ade5='\x5c'+char(0x22),_0x1af22c=_0x40a20b[_0x38ce('0x5f')]()[_0x38ce('0x61')](new RegExp(_0x5a51b9,'g'),_0x59ade5);return _0x5a51b9+_0x1af22c+_0x5a51b9;}exports[_0x38ce('0x62')]=function(_0x516f37,_0x39763b,_0x2f84a3){var _0x4a92b8,_0x5f494d;var _0x4ed35b={'where':{'ProjectId':_0x516f37[_0x38ce('0x46')]['id']}};if(_0x516f37[_0x38ce('0x32')]['startTime']){_0x4ed35b[_0x38ce('0x3d')]['starttime']=JSON[_0x38ce('0x63')](_0x516f37['query'][_0x38ce('0x64')]);}return db['JscriptySessionReport'][_0x38ce('0x59')](_0x4ed35b)[_0x38ce('0x24')](handleEntityNotFound(_0x39763b,null))[_0x38ce('0x24')](function(_0x4db79c){if(_0x4db79c){_0x4a92b8=_0x4db79c;return db[_0x38ce('0x65')]['findAll']({'where':{'SessionId':{'$in':_[_0x38ce('0x2d')](_0x4a92b8,'id')},'ProjectId':_0x516f37[_0x38ce('0x46')]['id']},'order':_0x38ce('0x66')});}})[_0x38ce('0x24')](handleEntityNotFound(_0x39763b,null))[_0x38ce('0x24')](function(_0x3214c1){if(_0x3214c1){_0x5f494d=_0x3214c1;var _0x2e0391={};for(var _0x8efb21=0x0,_0xe9537d=_0x5f494d[_0x38ce('0x39')];_0x8efb21<_0xe9537d;_0x8efb21++){if(!_0x2e0391['hasOwnProperty'](_0x5f494d[_0x8efb21][_0x38ce('0x67')])){_0x2e0391[_0x5f494d[_0x8efb21][_0x38ce('0x67')]]=needsEncapsulation(_0x5f494d[_0x8efb21][_0x38ce('0x68')])?encapsulate(_0x5f494d[_0x8efb21][_0x38ce('0x68')]):_0x5f494d[_0x8efb21][_0x38ce('0x68')];}}var _0x44d6f4=[],_0x556acc={};for(var _0x576c1e=0x0,_0x302db5=_0x4a92b8['length'];_0x576c1e<_0x302db5;_0x576c1e++){_0x556acc={'ProjectId':_0x516f37[_0x38ce('0x46')]['id'],'SessionId':_0x4a92b8[_0x576c1e]['id'],'StartTime':moment(_0x4a92b8[_0x576c1e]['starttime'])['format'](_0x38ce('0x69'))};for(var _0x330f04=0x0,_0xb6b824=_0x5f494d['length'];_0x330f04<_0xb6b824;_0x330f04++){if(_0x5f494d[_0x330f04][_0x38ce('0x6a')]==_0x4a92b8[_0x576c1e]['id']&&_0x2e0391[_0x38ce('0x3a')](_0x5f494d[_0x330f04]['questionId'])){_0x556acc[_0x2e0391[_0x5f494d[_0x330f04][_0x38ce('0x67')]]]=_0x5f494d[_0x330f04]['answer'];}}for(var _0x1e201d in _0x2e0391){if(!_0x556acc['hasOwnProperty'](_0x2e0391[_0x1e201d])){_0x556acc[_0x2e0391[_0x1e201d]]=null;}}_0x44d6f4[_0x38ce('0x6b')](_0x556acc);}return _0x44d6f4;}})[_0x38ce('0x24')](function(_0x197f39){if(!_['isEmpty'](_0x197f39)){var _0x1e27ee=toCsv(_0x197f39);var _0x58d5a7=Date[_0x38ce('0x6c')]();fs[_0x38ce('0x6d')](util[_0x38ce('0x6e')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x516f37[_0x38ce('0x46')]['id'],_0x58d5a7),_0x1e27ee);_0x39763b[_0x38ce('0x6f')](_0x38ce('0x70'),_0x38ce('0x71')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x516f37['params']['id'],_0x58d5a7));_0x39763b[_0x38ce('0x6f')](_0x38ce('0x72'),_0x38ce('0x73'));return _0x39763b[_0x38ce('0x74')](util[_0x38ce('0x6e')](_0x38ce('0x75'),_0x516f37[_0x38ce('0x46')]['id'],_0x58d5a7));}else{return _0x39763b[_0x38ce('0x76')](0xcc);}})[_0x38ce('0x45')](handleError(_0x39763b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0e76182..9c22fb5 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 _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','jscripty_projects','lodash'];(function(_0xbfc400,_0x3e9dfe){var _0xc97588=function(_0xb96b18){while(--_0xb96b18){_0xbfc400['push'](_0xbfc400['shift']());}};_0xc97588(++_0x3e9dfe);}(_0x7da7,0x10d));var _0x77da=function(_0x22093a,_0xa7acf1){_0x22093a=_0x22093a-0x0;var _0x2f4989=_0x7da7[_0x22093a];return _0x2f4989;};'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('./jscriptyProject.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('JscriptyProject',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56da=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5ab662,_0x13836c){var _0x5ac38f=function(_0x2f7fc1){while(--_0x2f7fc1){_0x5ab662['push'](_0x5ab662['shift']());}};_0x5ac38f(++_0x13836c);}(_0x56da,0x119));var _0xa56d=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0x56da[_0xa4928c];return _0x27cc29;};'use strict';var _=require(_0xa56d('0x0'));var util=require('util');var logger=require(_0xa56d('0x1'))(_0xa56d('0x2'));var moment=require('moment');var BPromise=require(_0xa56d('0x3'));var rp=require(_0xa56d('0x4'));var fs=require('fs');var path=require(_0xa56d('0x5'));var rimraf=require(_0xa56d('0x6'));var config=require(_0xa56d('0x7'));var attributes=require(_0xa56d('0x8'));module[_0xa56d('0x9')]=function(_0x14a16e,_0x4751ee){return _0x14a16e[_0xa56d('0xa')](_0xa56d('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 8266f37..f975671 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x2f79e9,_0x4d7fe3){var _0x567a9d=function(_0x1f6d97){while(--_0x1f6d97){_0x2f79e9['push'](_0x2f79e9['shift']());}};_0x567a9d(++_0x4d7fe3);}(_0x54ef,0x112));var _0xf54e=function(_0x54cb81,_0x4f392c){_0x54cb81=_0x54cb81-0x0;var _0x3cfc23=_0x54ef[_0x54cb81];return _0x3cfc23;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x32ecb5,_0x3c7aa1){var _0x493a12=function(_0x2377ef){while(--_0x2377ef){_0x32ecb5['push'](_0x32ecb5['shift']());}};_0x493a12(++_0x3c7aa1);}(_0x70e0,0x17b));var _0x070e=function(_0x564886,_0x192301){_0x564886=_0x564886-0x0;var _0x359459=_0x70e0[_0x564886];return _0x359459;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f8d2ce3..c531356 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 _0x9bbd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','multer','util'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x9bbd,0x70));var _0xd9bb=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9bbd[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xd9bb('0x0'));var util=require(_0xd9bb('0x1'));var path=require(_0xd9bb('0x2'));var timeout=require(_0xd9bb('0x3'));var express=require(_0xd9bb('0x4'));var router=express[_0xd9bb('0x5')]();var fs_extra=require(_0xd9bb('0x6'));var auth=require(_0xd9bb('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xd9bb('0x8')]('/',auth[_0xd9bb('0x9')](),controller[_0xd9bb('0xa')]);router[_0xd9bb('0x8')](_0xd9bb('0xb'),auth['isAuthenticated'](),controller[_0xd9bb('0xc')]);router[_0xd9bb('0x8')](_0xd9bb('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xd9bb('0xe')]('/',auth[_0xd9bb('0x9')](),controller[_0xd9bb('0xf')]);router[_0xd9bb('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9bb('0x11')]('/:id',auth[_0xd9bb('0x9')](),controller[_0xd9bb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x052d=['put','/:id','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','/describe','isAuthenticated','describe','show','post','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x052d,0xa6));var _0xd052=function(_0x645acc,_0x16b8a2){_0x645acc=_0x645acc-0x0;var _0x3a2c8d=_0x052d[_0x645acc];return _0x3a2c8d;};'use strict';var multer=require(_0xd052('0x0'));var util=require('util');var path=require(_0xd052('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd052('0x2')]();var fs_extra=require(_0xd052('0x3'));var auth=require(_0xd052('0x4'));var interaction=require(_0xd052('0x5'));var config=require(_0xd052('0x6'));var controller=require(_0xd052('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd052('0x8'),auth[_0xd052('0x9')](),controller[_0xd052('0xa')]);router['get']('/:id',auth[_0xd052('0x9')](),controller[_0xd052('0xb')]);router[_0xd052('0xc')]('/',auth[_0xd052('0x9')](),controller[_0xd052('0xd')]);router[_0xd052('0xe')](_0xd052('0xf'),auth[_0xd052('0x9')](),controller[_0xd052('0x10')]);router[_0xd052('0x11')](_0xd052('0xf'),auth[_0xd052('0x9')](),controller[_0xd052('0x12')]);module[_0xd052('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 686260d..bde0ff5 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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7a54,0x106));var _0x47a5=function(_0x23ddd7,_0x59d58b){_0x23ddd7=_0x23ddd7-0x0;var _0x4f8a06=_0x7a54[_0x23ddd7];return _0x4f8a06;};'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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x2fadd3,_0x3c47ac){_0x2fadd3=_0x2fadd3-0x0;var _0x2333c6=_0x7a54[_0x2fadd3];return _0x2333c6;};'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 92c1827..c1f62fc 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 _0x4f9e=['fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','stack','name','index','JscriptyQuestionReport','rawAttributes'];(function(_0x299f09,_0x3bc9dc){var _0x3c8beb=function(_0x456b83){while(--_0x456b83){_0x299f09['push'](_0x299f09['shift']());}};_0x3c8beb(++_0x3bc9dc);}(_0x4f9e,0x12b));var _0xe4f9=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x4f9e[_0x5b740b];return _0x6f8f4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4f9('0x1'));var rp=require(_0xe4f9('0x2'));var moment=require(_0xe4f9('0x3'));var BPromise=require(_0xe4f9('0x4'));var Mustache=require('mustache');var util=require(_0xe4f9('0x5'));var path=require(_0xe4f9('0x6'));var sox=require(_0xe4f9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4f9('0x8'));var _=require(_0xe4f9('0x9'));var squel=require('squel');var crypto=require(_0xe4f9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe4f9('0xb'));var toCsv=require(_0xe4f9('0xc'));var querystring=require(_0xe4f9('0xd'));var Papa=require('papaparse');var Redis=require(_0xe4f9('0xe'));var authService=require(_0xe4f9('0xf'));var qs=require(_0xe4f9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4f9('0x11'));var logger=require(_0xe4f9('0x12'))(_0xe4f9('0x13'));var utils=require(_0xe4f9('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe4f9('0x15'))['db'];function respondWithStatusCode(_0x414590,_0x139564){_0x139564=_0x139564||0xcc;return function(_0x221078){if(_0x221078){return _0x414590[_0xe4f9('0x16')](_0x139564);}return _0x414590[_0xe4f9('0x17')](_0x139564)[_0xe4f9('0x18')]();};}function respondWithResult(_0x53bdc3,_0x3e1283){_0x3e1283=_0x3e1283||0xc8;return function(_0x3e6b94){if(_0x3e6b94){return _0x53bdc3[_0xe4f9('0x17')](_0x3e1283)[_0xe4f9('0x19')](_0x3e6b94);}};}function respondWithFilteredResult(_0x2ac601,_0x12eedb){return function(_0xc826e8){if(_0xc826e8){var _0x38f597=typeof _0x12eedb[_0xe4f9('0x1a')]==='undefined'&&typeof _0x12eedb['limit']===_0xe4f9('0x1b');var _0x374b4e=_0xc826e8[_0xe4f9('0x1c')];var _0x337a11=_0x38f597?0x0:_0x12eedb['offset'];var _0x389456=_0x38f597?_0xc826e8[_0xe4f9('0x1c')]:_0x12eedb['offset']+_0x12eedb[_0xe4f9('0x1d')];var _0x5b643f;if(_0x389456>=_0x374b4e){_0x389456=_0x374b4e;_0x5b643f=0xc8;}else{_0x5b643f=0xce;}_0x2ac601['status'](_0x5b643f);return _0x2ac601[_0xe4f9('0x1e')](_0xe4f9('0x1f'),_0x337a11+'-'+_0x389456+'/'+_0x374b4e)['json'](_0xc826e8);}return null;};}function patchUpdates(_0x4e3037){return function(_0x59003c){try{jsonpatch[_0xe4f9('0x20')](_0x59003c,_0x4e3037,!![]);}catch(_0x85afcf){return BPromise['reject'](_0x85afcf);}return _0x59003c['save']();};}function saveUpdates(_0x1ce4ce,_0x28d495){return function(_0x7736c2){if(_0x7736c2){return _0x7736c2[_0xe4f9('0x21')](_0x1ce4ce)[_0xe4f9('0x22')](function(_0x312800){return _0x312800;});}return null;};}function removeEntity(_0x370582,_0x22ae3a){return function(_0x83486c){if(_0x83486c){return _0x83486c[_0xe4f9('0x23')]()[_0xe4f9('0x22')](function(){_0x370582[_0xe4f9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x142100,_0x331796){return function(_0x2ebded){if(!_0x2ebded){_0x142100[_0xe4f9('0x16')](0x194);}return _0x2ebded;};}function handleError(_0x3ca852,_0x426813){_0x426813=_0x426813||0x1f4;return function(_0x52da2f){logger['error'](_0x52da2f[_0xe4f9('0x24')]);if(_0x52da2f[_0xe4f9('0x25')]){delete _0x52da2f[_0xe4f9('0x25')];}_0x3ca852['status'](_0x426813)['send'](_0x52da2f);};}exports[_0xe4f9('0x26')]=function(_0x4b4e05,_0x289060){var _0x1e766d={},_0x4899bf={},_0x41aba4={'count':0x0,'rows':[]};var _0x392cd0=_['map'](db[_0xe4f9('0x27')][_0xe4f9('0x28')],function(_0x13f403){return{'name':_0x13f403[_0xe4f9('0x29')],'type':_0x13f403[_0xe4f9('0x2a')]['key']};});_0x4899bf[_0xe4f9('0x2b')]=_[_0xe4f9('0x2c')](_0x392cd0,_0xe4f9('0x25'));_0x4899bf['query']=_[_0xe4f9('0x2d')](_0x4b4e05[_0xe4f9('0x2e')]);_0x4899bf[_0xe4f9('0x2f')]=_[_0xe4f9('0x30')](_0x4899bf[_0xe4f9('0x2b')],_0x4899bf[_0xe4f9('0x2e')]);_0x1e766d[_0xe4f9('0x31')]=_[_0xe4f9('0x30')](_0x4899bf['model'],qs[_0xe4f9('0x32')](_0x4b4e05[_0xe4f9('0x2e')]['fields']));_0x1e766d[_0xe4f9('0x31')]=_0x1e766d['attributes'][_0xe4f9('0x33')]?_0x1e766d[_0xe4f9('0x31')]:_0x4899bf[_0xe4f9('0x2b')];if(!_0x4b4e05[_0xe4f9('0x2e')]['hasOwnProperty']('nolimit')){_0x1e766d[_0xe4f9('0x1d')]=qs['limit'](_0x4b4e05[_0xe4f9('0x2e')]['limit']);_0x1e766d[_0xe4f9('0x1a')]=qs[_0xe4f9('0x1a')](_0x4b4e05['query'][_0xe4f9('0x1a')]);}_0x1e766d[_0xe4f9('0x34')]=qs[_0xe4f9('0x35')](_0x4b4e05[_0xe4f9('0x2e')]['sort']);_0x1e766d['where']=qs[_0xe4f9('0x2f')](_['pick'](_0x4b4e05[_0xe4f9('0x2e')],_0x4899bf[_0xe4f9('0x2f')]),_0x392cd0);if(_0x4b4e05[_0xe4f9('0x2e')][_0xe4f9('0x36')]){_0x1e766d[_0xe4f9('0x37')]=_[_0xe4f9('0x38')](_0x1e766d[_0xe4f9('0x37')],{'$or':_[_0xe4f9('0x2c')](_0x392cd0,function(_0x4969fc){if(_0x4969fc[_0xe4f9('0x2a')]!==_0xe4f9('0x39')){var _0x31d010={};_0x31d010[_0x4969fc[_0xe4f9('0x25')]]={'$like':'%'+_0x4b4e05[_0xe4f9('0x2e')][_0xe4f9('0x36')]+'%'};return _0x31d010;}})});}_0x1e766d=_[_0xe4f9('0x38')]({},_0x1e766d,_0x4b4e05[_0xe4f9('0x3a')]);var _0x37d39b={'where':_0x1e766d[_0xe4f9('0x37')]};return db[_0xe4f9('0x27')][_0xe4f9('0x1c')](_0x37d39b)['then'](function(_0x2d0306){_0x41aba4[_0xe4f9('0x1c')]=_0x2d0306;if(_0x4b4e05[_0xe4f9('0x2e')]['includeAll']){_0x1e766d[_0xe4f9('0x3b')]=[{'all':!![]}];}return db[_0xe4f9('0x27')]['findAll'](_0x1e766d);})['then'](function(_0xe1487){_0x41aba4[_0xe4f9('0x3c')]=_0xe1487;return _0x41aba4;})['then'](respondWithFilteredResult(_0x289060,_0x1e766d))[_0xe4f9('0x3d')](handleError(_0x289060,null));};exports[_0xe4f9('0x3e')]=function(_0x292cb8,_0x17d6fc){var _0x16773b={'raw':!![],'where':{'id':_0x292cb8[_0xe4f9('0x3f')]['id']}},_0x426d91={};_0x426d91[_0xe4f9('0x2b')]=_[_0xe4f9('0x2d')](db[_0xe4f9('0x27')][_0xe4f9('0x28')]);_0x426d91[_0xe4f9('0x2e')]=_[_0xe4f9('0x2d')](_0x292cb8[_0xe4f9('0x2e')]);_0x426d91[_0xe4f9('0x2f')]=_[_0xe4f9('0x30')](_0x426d91[_0xe4f9('0x2b')],_0x426d91[_0xe4f9('0x2e')]);_0x16773b[_0xe4f9('0x31')]=_[_0xe4f9('0x30')](_0x426d91['model'],qs[_0xe4f9('0x32')](_0x292cb8[_0xe4f9('0x2e')][_0xe4f9('0x32')]));_0x16773b[_0xe4f9('0x31')]=_0x16773b['attributes'][_0xe4f9('0x33')]?_0x16773b[_0xe4f9('0x31')]:_0x426d91[_0xe4f9('0x2b')];if(_0x292cb8[_0xe4f9('0x2e')]['includeAll']){_0x16773b[_0xe4f9('0x3b')]=[{'all':!![]}];}_0x16773b=_[_0xe4f9('0x38')]({},_0x16773b,_0x292cb8['options']);return db[_0xe4f9('0x27')][_0xe4f9('0x40')](_0x16773b)['then'](handleEntityNotFound(_0x17d6fc,null))['then'](respondWithResult(_0x17d6fc,null))['catch'](handleError(_0x17d6fc,null));};exports[_0xe4f9('0x41')]=function(_0x2cb219,_0x44653b){return db[_0xe4f9('0x27')]['create'](_0x2cb219[_0xe4f9('0x42')],{})[_0xe4f9('0x22')](respondWithResult(_0x44653b,0xc9))[_0xe4f9('0x3d')](handleError(_0x44653b,null));};exports[_0xe4f9('0x21')]=function(_0x183b87,_0x5b9b2b){if(_0x183b87[_0xe4f9('0x42')]['id']){delete _0x183b87['body']['id'];}return db['JscriptyQuestionReport'][_0xe4f9('0x40')]({'where':{'id':_0x183b87[_0xe4f9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5b9b2b,null))['then'](saveUpdates(_0x183b87[_0xe4f9('0x42')],null))[_0xe4f9('0x22')](respondWithResult(_0x5b9b2b,null))[_0xe4f9('0x3d')](handleError(_0x5b9b2b,null));};exports[_0xe4f9('0x23')]=function(_0x5c429c,_0x27ff74){return db[_0xe4f9('0x27')][_0xe4f9('0x40')]({'where':{'id':_0x5c429c['params']['id']}})[_0xe4f9('0x22')](handleEntityNotFound(_0x27ff74,null))[_0xe4f9('0x22')](removeEntity(_0x27ff74,null))[_0xe4f9('0x3d')](handleError(_0x27ff74,null));};exports[_0xe4f9('0x43')]=function(_0x492b08,_0x1085b6){return db['JscriptyQuestionReport'][_0xe4f9('0x43')]()[_0xe4f9('0x22')](respondWithResult(_0x1085b6,null))['catch'](handleError(_0x1085b6,null));}; \ No newline at end of file +var _0xfb44=['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','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','type','options','includeAll','include','findAll','rows','show','params','find','body','catch','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x629225,_0x116f71){var _0x317d0f=function(_0x336a4f){while(--_0x336a4f){_0x629225['push'](_0x629225['shift']());}};_0x317d0f(++_0x116f71);}(_0xfb44,0x8d));var _0x4fb4=function(_0x2679ff,_0x4cdb65){_0x2679ff=_0x2679ff-0x0;var _0x1c2939=_0xfb44[_0x2679ff];return _0x1c2939;};'use strict';var emlformat=require(_0x4fb4('0x0'));var rimraf=require(_0x4fb4('0x1'));var zipdir=require(_0x4fb4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4fb4('0x3'));var BPromise=require(_0x4fb4('0x4'));var Mustache=require(_0x4fb4('0x5'));var util=require(_0x4fb4('0x6'));var path=require('path');var sox=require(_0x4fb4('0x7'));var csv=require(_0x4fb4('0x8'));var ejs=require(_0x4fb4('0x9'));var fs=require('fs');var fs_extra=require(_0x4fb4('0xa'));var _=require(_0x4fb4('0xb'));var squel=require(_0x4fb4('0xc'));var crypto=require('crypto');var jsforce=require(_0x4fb4('0xd'));var deskjs=require(_0x4fb4('0xe'));var toCsv=require(_0x4fb4('0x8'));var querystring=require(_0x4fb4('0xf'));var Papa=require(_0x4fb4('0x10'));var Redis=require(_0x4fb4('0x11'));var authService=require(_0x4fb4('0x12'));var qs=require(_0x4fb4('0x13'));var as=require(_0x4fb4('0x14'));var hardwareService=require(_0x4fb4('0x15'));var logger=require(_0x4fb4('0x16'))(_0x4fb4('0x17'));var utils=require(_0x4fb4('0x18'));var config=require(_0x4fb4('0x19'));var licenseUtil=require(_0x4fb4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23dc86,_0x355e9e){_0x355e9e=_0x355e9e||0xcc;return function(_0x5651ca){if(_0x5651ca){return _0x23dc86[_0x4fb4('0x1b')](_0x355e9e);}return _0x23dc86['status'](_0x355e9e)[_0x4fb4('0x1c')]();};}function respondWithResult(_0xc6097c,_0x2217fc){_0x2217fc=_0x2217fc||0xc8;return function(_0x3d2af9){if(_0x3d2af9){return _0xc6097c[_0x4fb4('0x1d')](_0x2217fc)[_0x4fb4('0x1e')](_0x3d2af9);}};}function respondWithFilteredResult(_0x39d84e,_0x5bdff1){return function(_0x410ad3){if(_0x410ad3){var _0x4710ee=typeof _0x5bdff1[_0x4fb4('0x1f')]===_0x4fb4('0x20')&&typeof _0x5bdff1[_0x4fb4('0x21')]===_0x4fb4('0x20');var _0x519e9c=_0x410ad3['count'];var _0x2c8fcd=_0x4710ee?0x0:_0x5bdff1['offset'];var _0x2bd35b=_0x4710ee?_0x410ad3[_0x4fb4('0x22')]:_0x5bdff1[_0x4fb4('0x1f')]+_0x5bdff1[_0x4fb4('0x21')];var _0xb6639e;if(_0x2bd35b>=_0x519e9c){_0x2bd35b=_0x519e9c;_0xb6639e=0xc8;}else{_0xb6639e=0xce;}_0x39d84e[_0x4fb4('0x1d')](_0xb6639e);return _0x39d84e[_0x4fb4('0x23')]('Content-Range',_0x2c8fcd+'-'+_0x2bd35b+'/'+_0x519e9c)['json'](_0x410ad3);}return null;};}function patchUpdates(_0x5e5e7f){return function(_0x533cfb){try{jsonpatch[_0x4fb4('0x24')](_0x533cfb,_0x5e5e7f,!![]);}catch(_0x206508){return BPromise[_0x4fb4('0x25')](_0x206508);}return _0x533cfb['save']();};}function saveUpdates(_0x22b8b5,_0x583155){return function(_0x1dfeec){if(_0x1dfeec){return _0x1dfeec[_0x4fb4('0x26')](_0x22b8b5)[_0x4fb4('0x27')](function(_0x118d3c){return _0x118d3c;});}return null;};}function removeEntity(_0x1c0ed8,_0x3bfcaf){return function(_0x24ee67){if(_0x24ee67){return _0x24ee67[_0x4fb4('0x28')]()[_0x4fb4('0x27')](function(){_0x1c0ed8[_0x4fb4('0x1d')](0xcc)[_0x4fb4('0x1c')]();});}};}function handleEntityNotFound(_0x20a3b0,_0x4c73ea){return function(_0x2cf1b7){if(!_0x2cf1b7){_0x20a3b0[_0x4fb4('0x1b')](0x194);}return _0x2cf1b7;};}function handleError(_0x228c33,_0x5ea141){_0x5ea141=_0x5ea141||0x1f4;return function(_0x3b4848){logger['error'](_0x3b4848[_0x4fb4('0x29')]);if(_0x3b4848[_0x4fb4('0x2a')]){delete _0x3b4848[_0x4fb4('0x2a')];}_0x228c33[_0x4fb4('0x1d')](_0x5ea141)[_0x4fb4('0x2b')](_0x3b4848);};}exports[_0x4fb4('0x2c')]=function(_0xa51d84,_0xa186b2){var _0x352c55={},_0x170bee={},_0x48e815={'count':0x0,'rows':[]};var _0x2cf3b6=_['map'](db[_0x4fb4('0x2d')][_0x4fb4('0x2e')],function(_0x38cd06){return{'name':_0x38cd06[_0x4fb4('0x2f')],'type':_0x38cd06['type'][_0x4fb4('0x30')]};});_0x170bee[_0x4fb4('0x31')]=_[_0x4fb4('0x32')](_0x2cf3b6,_0x4fb4('0x2a'));_0x170bee[_0x4fb4('0x33')]=_[_0x4fb4('0x34')](_0xa51d84[_0x4fb4('0x33')]);_0x170bee[_0x4fb4('0x35')]=_[_0x4fb4('0x36')](_0x170bee[_0x4fb4('0x31')],_0x170bee['query']);_0x352c55['attributes']=_[_0x4fb4('0x36')](_0x170bee[_0x4fb4('0x31')],qs[_0x4fb4('0x37')](_0xa51d84['query'][_0x4fb4('0x37')]));_0x352c55[_0x4fb4('0x38')]=_0x352c55[_0x4fb4('0x38')][_0x4fb4('0x39')]?_0x352c55[_0x4fb4('0x38')]:_0x170bee[_0x4fb4('0x31')];if(!_0xa51d84[_0x4fb4('0x33')][_0x4fb4('0x3a')](_0x4fb4('0x3b'))){_0x352c55['limit']=qs[_0x4fb4('0x21')](_0xa51d84['query'][_0x4fb4('0x21')]);_0x352c55[_0x4fb4('0x1f')]=qs['offset'](_0xa51d84[_0x4fb4('0x33')][_0x4fb4('0x1f')]);}_0x352c55['order']=qs[_0x4fb4('0x3c')](_0xa51d84['query'][_0x4fb4('0x3c')]);_0x352c55['where']=qs[_0x4fb4('0x35')](_[_0x4fb4('0x3d')](_0xa51d84[_0x4fb4('0x33')],_0x170bee['filters']),_0x2cf3b6);if(_0xa51d84[_0x4fb4('0x33')]['filter']){_0x352c55['where']=_[_0x4fb4('0x3e')](_0x352c55[_0x4fb4('0x3f')],{'$or':_[_0x4fb4('0x32')](_0x2cf3b6,function(_0x5e212e){if(_0x5e212e[_0x4fb4('0x40')]!=='VIRTUAL'){var _0x2c4593={};_0x2c4593[_0x5e212e[_0x4fb4('0x2a')]]={'$like':'%'+_0xa51d84['query']['filter']+'%'};return _0x2c4593;}})});}_0x352c55=_[_0x4fb4('0x3e')]({},_0x352c55,_0xa51d84[_0x4fb4('0x41')]);var _0x834754={'where':_0x352c55[_0x4fb4('0x3f')]};return db['JscriptyQuestionReport'][_0x4fb4('0x22')](_0x834754)['then'](function(_0x49d93b){_0x48e815[_0x4fb4('0x22')]=_0x49d93b;if(_0xa51d84[_0x4fb4('0x33')][_0x4fb4('0x42')]){_0x352c55[_0x4fb4('0x43')]=[{'all':!![]}];}return db[_0x4fb4('0x2d')][_0x4fb4('0x44')](_0x352c55);})[_0x4fb4('0x27')](function(_0x5e51c8){_0x48e815[_0x4fb4('0x45')]=_0x5e51c8;return _0x48e815;})['then'](respondWithFilteredResult(_0xa186b2,_0x352c55))['catch'](handleError(_0xa186b2,null));};exports[_0x4fb4('0x46')]=function(_0x103eab,_0x4f749f){var _0x576c02={'raw':!![],'where':{'id':_0x103eab[_0x4fb4('0x47')]['id']}},_0x390815={};_0x390815[_0x4fb4('0x31')]=_['keys'](db['JscriptyQuestionReport'][_0x4fb4('0x2e')]);_0x390815[_0x4fb4('0x33')]=_[_0x4fb4('0x34')](_0x103eab[_0x4fb4('0x33')]);_0x390815[_0x4fb4('0x35')]=_[_0x4fb4('0x36')](_0x390815['model'],_0x390815[_0x4fb4('0x33')]);_0x576c02[_0x4fb4('0x38')]=_['intersection'](_0x390815[_0x4fb4('0x31')],qs[_0x4fb4('0x37')](_0x103eab[_0x4fb4('0x33')][_0x4fb4('0x37')]));_0x576c02[_0x4fb4('0x38')]=_0x576c02['attributes'][_0x4fb4('0x39')]?_0x576c02[_0x4fb4('0x38')]:_0x390815[_0x4fb4('0x31')];if(_0x103eab['query']['includeAll']){_0x576c02[_0x4fb4('0x43')]=[{'all':!![]}];}_0x576c02=_['merge']({},_0x576c02,_0x103eab['options']);return db[_0x4fb4('0x2d')][_0x4fb4('0x48')](_0x576c02)['then'](handleEntityNotFound(_0x4f749f,null))[_0x4fb4('0x27')](respondWithResult(_0x4f749f,null))['catch'](handleError(_0x4f749f,null));};exports['create']=function(_0xbb8d32,_0xb53c78){return db[_0x4fb4('0x2d')]['create'](_0xbb8d32[_0x4fb4('0x49')],{})['then'](respondWithResult(_0xb53c78,0xc9))['catch'](handleError(_0xb53c78,null));};exports[_0x4fb4('0x26')]=function(_0x4ac303,_0x34ccaa){if(_0x4ac303[_0x4fb4('0x49')]['id']){delete _0x4ac303[_0x4fb4('0x49')]['id'];}return db['JscriptyQuestionReport'][_0x4fb4('0x48')]({'where':{'id':_0x4ac303['params']['id']}})[_0x4fb4('0x27')](handleEntityNotFound(_0x34ccaa,null))[_0x4fb4('0x27')](saveUpdates(_0x4ac303[_0x4fb4('0x49')],null))[_0x4fb4('0x27')](respondWithResult(_0x34ccaa,null))[_0x4fb4('0x4a')](handleError(_0x34ccaa,null));};exports[_0x4fb4('0x28')]=function(_0x31f966,_0x453ca7){return db[_0x4fb4('0x2d')][_0x4fb4('0x48')]({'where':{'id':_0x31f966[_0x4fb4('0x47')]['id']}})['then'](handleEntityNotFound(_0x453ca7,null))[_0x4fb4('0x27')](removeEntity(_0x453ca7,null))[_0x4fb4('0x4a')](handleError(_0x453ca7,null));};exports[_0x4fb4('0x4b')]=function(_0x243051,_0x371d2e){return db[_0x4fb4('0x2d')][_0x4fb4('0x4b')]()['then'](respondWithResult(_0x371d2e,null))['catch'](handleError(_0x371d2e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 88ff872..8436d41 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 _0x556b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x523116,_0xa4ca5b){var _0x2eda47=function(_0x2bc58b){while(--_0x2bc58b){_0x523116['push'](_0x523116['shift']());}};_0x2eda47(++_0xa4ca5b);}(_0x556b,0x19d));var _0xb556=function(_0x1461dc,_0x382be8){_0x1461dc=_0x1461dc-0x0;var _0x15662b=_0x556b[_0x1461dc];return _0x15662b;};'use strict';var _=require(_0xb556('0x0'));var util=require(_0xb556('0x1'));var logger=require(_0xb556('0x2'))(_0xb556('0x3'));var moment=require(_0xb556('0x4'));var BPromise=require(_0xb556('0x5'));var rp=require(_0xb556('0x6'));var fs=require('fs');var path=require(_0xb556('0x7'));var rimraf=require(_0xb556('0x8'));var config=require(_0xb556('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x585800,_0x5671b6){return _0x585800[_0xb556('0xa')](_0xb556('0xb'),attributes,{'tableName':_0xb556('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd300=['request-promise','path','rimraf','../../config/environment','define','util','api','moment'];(function(_0x57a985,_0x130a49){var _0x1b151b=function(_0x5e172a){while(--_0x5e172a){_0x57a985['push'](_0x57a985['shift']());}};_0x1b151b(++_0x130a49);}(_0xd300,0x135));var _0x0d30=function(_0x894278,_0x260254){_0x894278=_0x894278-0x0;var _0x4086fd=_0xd300[_0x894278];return _0x4086fd;};'use strict';var _=require('lodash');var util=require(_0x0d30('0x0'));var logger=require('../../config/logger')(_0x0d30('0x1'));var moment=require(_0x0d30('0x2'));var BPromise=require('bluebird');var rp=require(_0x0d30('0x3'));var fs=require('fs');var path=require(_0x0d30('0x4'));var rimraf=require(_0x0d30('0x5'));var config=require(_0x0d30('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x48e6b0,_0x24adf4){return _0x48e6b0[_0x0d30('0x7')]('JscriptyQuestionReport',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 8b4a657..43043c7 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 _0xa5eb=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa5eb,0x18a));var _0xba5e=function(_0x3a0790,_0x2fadbd){_0x3a0790=_0x3a0790-0x0;var _0x50df7a=_0xa5eb[_0x3a0790];return _0x50df7a;};'use strict';var _=require(_0xba5e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba5e('0x1'));var rs=require(_0xba5e('0x2'));var fs=require('fs');var Redis=require(_0xba5e('0x3'));var db=require(_0xba5e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba5e('0x5'))('rpc');var config=require(_0xba5e('0x6'));var jayson=require(_0xba5e('0x7'));var client=jayson[_0xba5e('0x8')][_0xba5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bfef5,_0x4968b9,_0x369a2c){return new BPromise(function(_0xf0dcb0,_0x545c2b){return client[_0xba5e('0xa')](_0x3bfef5,_0x369a2c)[_0xba5e('0xb')](function(_0x545bbd){logger[_0xba5e('0xc')](_0xba5e('0xd'),_0x4968b9,_0xba5e('0xe'));logger[_0xba5e('0xf')](_0xba5e('0x10'),_0x4968b9,_0xba5e('0xe'),JSON[_0xba5e('0x11')](_0x545bbd));if(_0x545bbd[_0xba5e('0x12')]){if(_0x545bbd[_0xba5e('0x12')]['code']===0x1f4){logger['error'](_0xba5e('0xd'),_0x4968b9,_0x545bbd[_0xba5e('0x12')][_0xba5e('0x13')]);return _0x545c2b(_0x545bbd[_0xba5e('0x12')][_0xba5e('0x13')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x4968b9,_0x545bbd[_0xba5e('0x12')][_0xba5e('0x13')]);return _0xf0dcb0(_0x545bbd[_0xba5e('0x12')]['message']);}else{logger[_0xba5e('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4968b9,_0xba5e('0xe'));_0xf0dcb0(_0x545bbd[_0xba5e('0x14')][_0xba5e('0x13')]);}})[_0xba5e('0x15')](function(_0x41e1f9){logger[_0xba5e('0x12')](_0xba5e('0xd'),_0x4968b9,_0x41e1f9);_0x545c2b(_0x41e1f9);});});} \ No newline at end of file +var _0xc6ec=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3958fe,_0x3c6605){var _0x1f27d6=function(_0x2bfb4a){while(--_0x2bfb4a){_0x3958fe['push'](_0x3958fe['shift']());}};_0x1f27d6(++_0x3c6605);}(_0xc6ec,0x1ca));var _0xcc6e=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0xc6ec[_0x11e03f];return _0x5666fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc6e('0x0'));var BPromise=require(_0xcc6e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc6e('0x2'));var db=require(_0xcc6e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc6e('0x4'))(_0xcc6e('0x5'));var config=require(_0xcc6e('0x6'));var jayson=require(_0xcc6e('0x7'));var client=jayson[_0xcc6e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e4df,_0x1c1723,_0x312184){return new BPromise(function(_0x3f2796,_0xb0e5bf){return client[_0xcc6e('0x9')](_0x22e4df,_0x312184)[_0xcc6e('0xa')](function(_0x55a0ea){logger[_0xcc6e('0xb')](_0xcc6e('0xc'),_0x1c1723,_0xcc6e('0xd'));logger[_0xcc6e('0xe')](_0xcc6e('0xf'),_0x1c1723,'request\x20sent',JSON[_0xcc6e('0x10')](_0x55a0ea));if(_0x55a0ea[_0xcc6e('0x11')]){if(_0x55a0ea[_0xcc6e('0x11')][_0xcc6e('0x12')]===0x1f4){logger[_0xcc6e('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1c1723,_0x55a0ea[_0xcc6e('0x11')]['message']);return _0xb0e5bf(_0x55a0ea[_0xcc6e('0x11')]['message']);}logger['error'](_0xcc6e('0xc'),_0x1c1723,_0x55a0ea[_0xcc6e('0x11')]['message']);return _0x3f2796(_0x55a0ea[_0xcc6e('0x11')]['message']);}else{logger[_0xcc6e('0xb')](_0xcc6e('0xc'),_0x1c1723,_0xcc6e('0xd'));_0x3f2796(_0x55a0ea[_0xcc6e('0x13')][_0xcc6e('0x14')]);}})[_0xcc6e('0x15')](function(_0x4ae5ac){logger[_0xcc6e('0x11')](_0xcc6e('0xc'),_0x1c1723,_0x4ae5ac);_0xb0e5bf(_0x4ae5ac);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e4f32ef..b8b0875 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 _0x6b5c=['post','create','put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/questions'];(function(_0x30ba09,_0x252c3b){var _0x58a0f9=function(_0x592f07){while(--_0x592f07){_0x30ba09['push'](_0x30ba09['shift']());}};_0x58a0f9(++_0x252c3b);}(_0x6b5c,0x1bf));var _0xc6b5=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x6b5c[_0x5db657];return _0x2d6e70;};'use strict';var multer=require(_0xc6b5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc6b5('0x1'));var express=require('express');var router=express[_0xc6b5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc6b5('0x3'));var interaction=require(_0xc6b5('0x4'));var config=require(_0xc6b5('0x5'));var controller=require(_0xc6b5('0x6'));router['get']('/',auth[_0xc6b5('0x7')](),controller[_0xc6b5('0x8')]);router[_0xc6b5('0x9')](_0xc6b5('0xa'),auth['isAuthenticated'](),controller[_0xc6b5('0xb')]);router['get'](_0xc6b5('0xc'),auth[_0xc6b5('0x7')](),controller[_0xc6b5('0xd')]);router['get'](_0xc6b5('0xe'),auth[_0xc6b5('0x7')](),controller['getQuestions']);router[_0xc6b5('0xf')]('/',auth['isAuthenticated'](),controller[_0xc6b5('0x10')]);router[_0xc6b5('0x11')](_0xc6b5('0xc'),auth['isAuthenticated'](),controller[_0xc6b5('0x12')]);router[_0xc6b5('0x13')](_0xc6b5('0xc'),auth[_0xc6b5('0x7')](),controller['destroy']);module[_0xc6b5('0x14')]=router; \ No newline at end of file +var _0x6a0a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy'];(function(_0x4858b6,_0x4d4c3f){var _0x187975=function(_0x1a9bcd){while(--_0x1a9bcd){_0x4858b6['push'](_0x4858b6['shift']());}};_0x187975(++_0x4d4c3f);}(_0x6a0a,0x151));var _0xa6a0=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0x6a0a[_0x52a6e3];return _0x8910d0;};'use strict';var multer=require(_0xa6a0('0x0'));var util=require(_0xa6a0('0x1'));var path=require(_0xa6a0('0x2'));var timeout=require(_0xa6a0('0x3'));var express=require(_0xa6a0('0x4'));var router=express[_0xa6a0('0x5')]();var fs_extra=require(_0xa6a0('0x6'));var auth=require(_0xa6a0('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa6a0('0x8'));router[_0xa6a0('0x9')]('/',auth[_0xa6a0('0xa')](),controller[_0xa6a0('0xb')]);router['get'](_0xa6a0('0xc'),auth[_0xa6a0('0xa')](),controller[_0xa6a0('0xd')]);router['get'](_0xa6a0('0xe'),auth[_0xa6a0('0xa')](),controller['show']);router['get']('/:id/questions',auth[_0xa6a0('0xa')](),controller['getQuestions']);router[_0xa6a0('0xf')]('/',auth['isAuthenticated'](),controller[_0xa6a0('0x10')]);router[_0xa6a0('0x11')](_0xa6a0('0xe'),auth[_0xa6a0('0xa')](),controller['update']);router[_0xa6a0('0x12')](_0xa6a0('0xe'),auth[_0xa6a0('0xa')](),controller[_0xa6a0('0x13')]);module[_0xa6a0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index bf3a484..dd54165 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 _0x7d26=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','exports','DATE','setDataValue','starttime'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7d26,0x19b));var _0x67d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d26[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x67d2('0x0'));var Sequelize=require('sequelize');module[_0x67d2('0x1')]={'starttime':{'type':Sequelize[_0x67d2('0x2')],'set':function(_0x46e707){this[_0x67d2('0x3')](_0x67d2('0x4'),_0x46e707);this[_0x67d2('0x3')]('endtime',moment()[_0x67d2('0x5')](_0x67d2('0x6')));}},'endtime':{'type':Sequelize[_0x67d2('0x2')]},'membername':{'type':Sequelize[_0x67d2('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x67d2('0x7')]},'uniqueid':{'type':Sequelize[_0x67d2('0x7')]},'calleridname':{'type':Sequelize[_0x67d2('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9bdb=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x19112d,_0x7b5e2){var _0x4d7457=function(_0x135310){while(--_0x135310){_0x19112d['push'](_0x19112d['shift']());}};_0x4d7457(++_0x7b5e2);}(_0x9bdb,0x13c));var _0xb9bd=function(_0x10f602,_0x1279c5){_0x10f602=_0x10f602-0x0;var _0x1d5b87=_0x9bdb[_0x10f602];return _0x1d5b87;};'use strict';var moment=require(_0xb9bd('0x0'));var Sequelize=require(_0xb9bd('0x1'));module[_0xb9bd('0x2')]={'starttime':{'type':Sequelize[_0xb9bd('0x3')],'set':function(_0x55ece7){this[_0xb9bd('0x4')](_0xb9bd('0x5'),_0x55ece7);this[_0xb9bd('0x4')](_0xb9bd('0x6'),moment()[_0xb9bd('0x7')](_0xb9bd('0x8')));}},'endtime':{'type':Sequelize[_0xb9bd('0x3')]},'membername':{'type':Sequelize[_0xb9bd('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb9bd('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb9bd('0x9')]},'completed':{'type':Sequelize[_0xb9bd('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index e70101a..898e131 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 _0x87c0=['name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','JscriptySessionReport','length','create','body','find','params','describe','getQuestions','nolimit','SessionId','JscriptyQuestionReport','eml-format','fast-json-patch','request-promise','path','sox','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','destroy','stack'];(function(_0x17b39c,_0x4d030b){var _0x171c0e=function(_0x599145){while(--_0x599145){_0x17b39c['push'](_0x17b39c['shift']());}};_0x171c0e(++_0x4d030b);}(_0x87c0,0x6c));var _0x087c=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x87c0[_0x35885a];return _0xe86249;};'use strict';var emlformat=require(_0x087c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x087c('0x1'));var rp=require(_0x087c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x087c('0x3'));var sox=require(_0x087c('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x087c('0x5'));var squel=require('squel');var crypto=require(_0x087c('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x087c('0x7'));var toCsv=require(_0x087c('0x8'));var querystring=require('querystring');var Papa=require(_0x087c('0x9'));var Redis=require(_0x087c('0xa'));var authService=require(_0x087c('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x087c('0xc'))(_0x087c('0xd'));var utils=require('../../config/utils');var config=require(_0x087c('0xe'));var licenseUtil=require('../../config/license/util');var db=require(_0x087c('0xf'))['db'];function respondWithStatusCode(_0x5b2a4e,_0x5ee85b){_0x5ee85b=_0x5ee85b||0xcc;return function(_0x247694){if(_0x247694){return _0x5b2a4e[_0x087c('0x10')](_0x5ee85b);}return _0x5b2a4e['status'](_0x5ee85b)[_0x087c('0x11')]();};}function respondWithResult(_0x267fc1,_0x541dde){_0x541dde=_0x541dde||0xc8;return function(_0x4270e0){if(_0x4270e0){return _0x267fc1['status'](_0x541dde)['json'](_0x4270e0);}};}function respondWithFilteredResult(_0x3a8bd0,_0x272fd5){return function(_0x5afdf4){if(_0x5afdf4){var _0x2c8a12=typeof _0x272fd5['offset']===_0x087c('0x12')&&typeof _0x272fd5['limit']===_0x087c('0x12');var _0x36683f=_0x5afdf4[_0x087c('0x13')];var _0x157d48=_0x2c8a12?0x0:_0x272fd5[_0x087c('0x14')];var _0x4351fc=_0x2c8a12?_0x5afdf4[_0x087c('0x13')]:_0x272fd5['offset']+_0x272fd5[_0x087c('0x15')];var _0x963360;if(_0x4351fc>=_0x36683f){_0x4351fc=_0x36683f;_0x963360=0xc8;}else{_0x963360=0xce;}_0x3a8bd0[_0x087c('0x16')](_0x963360);return _0x3a8bd0[_0x087c('0x17')](_0x087c('0x18'),_0x157d48+'-'+_0x4351fc+'/'+_0x36683f)[_0x087c('0x19')](_0x5afdf4);}return null;};}function patchUpdates(_0x56ada1){return function(_0x4e9e00){try{jsonpatch['apply'](_0x4e9e00,_0x56ada1,!![]);}catch(_0x31dfa8){return BPromise[_0x087c('0x1a')](_0x31dfa8);}return _0x4e9e00[_0x087c('0x1b')]();};}function saveUpdates(_0x3d79de,_0x2b1096){return function(_0x2f16c1){if(_0x2f16c1){return _0x2f16c1[_0x087c('0x1c')](_0x3d79de)[_0x087c('0x1d')](function(_0x2a63b0){return _0x2a63b0;});}return null;};}function removeEntity(_0x53ae23,_0x361f44){return function(_0x3693b9){if(_0x3693b9){return _0x3693b9[_0x087c('0x1e')]()['then'](function(){_0x53ae23[_0x087c('0x16')](0xcc)[_0x087c('0x11')]();});}};}function handleEntityNotFound(_0x21331d,_0x267985){return function(_0x344b9b){if(!_0x344b9b){_0x21331d[_0x087c('0x10')](0x194);}return _0x344b9b;};}function handleError(_0x49e378,_0x4fc00c){_0x4fc00c=_0x4fc00c||0x1f4;return function(_0x15bd2e){logger['error'](_0x15bd2e[_0x087c('0x1f')]);if(_0x15bd2e[_0x087c('0x20')]){delete _0x15bd2e[_0x087c('0x20')];}_0x49e378[_0x087c('0x16')](_0x4fc00c)[_0x087c('0x21')](_0x15bd2e);};}exports[_0x087c('0x22')]=function(_0xcc093f,_0x2cd0c8){var _0x52da9e={},_0x358cfe={},_0x4811d8={'count':0x0,'rows':[]};var _0x3a6701=_[_0x087c('0x23')](db['JscriptySessionReport'][_0x087c('0x24')],function(_0x351c95){return{'name':_0x351c95[_0x087c('0x25')],'type':_0x351c95[_0x087c('0x26')]['key']};});_0x358cfe['model']=_[_0x087c('0x23')](_0x3a6701,_0x087c('0x20'));_0x358cfe[_0x087c('0x27')]=_[_0x087c('0x28')](_0xcc093f['query']);_0x358cfe[_0x087c('0x29')]=_[_0x087c('0x2a')](_0x358cfe[_0x087c('0x2b')],_0x358cfe[_0x087c('0x27')]);_0x52da9e['attributes']=_[_0x087c('0x2a')](_0x358cfe[_0x087c('0x2b')],qs[_0x087c('0x2c')](_0xcc093f[_0x087c('0x27')][_0x087c('0x2c')]));_0x52da9e[_0x087c('0x2d')]=_0x52da9e[_0x087c('0x2d')]['length']?_0x52da9e[_0x087c('0x2d')]:_0x358cfe[_0x087c('0x2b')];if(!_0xcc093f[_0x087c('0x27')][_0x087c('0x2e')]('nolimit')){_0x52da9e[_0x087c('0x15')]=qs[_0x087c('0x15')](_0xcc093f['query'][_0x087c('0x15')]);_0x52da9e['offset']=qs[_0x087c('0x14')](_0xcc093f['query'][_0x087c('0x14')]);}_0x52da9e[_0x087c('0x2f')]=qs[_0x087c('0x30')](_0xcc093f[_0x087c('0x27')][_0x087c('0x30')]);_0x52da9e[_0x087c('0x31')]=qs[_0x087c('0x29')](_[_0x087c('0x32')](_0xcc093f[_0x087c('0x27')],_0x358cfe[_0x087c('0x29')]),_0x3a6701);if(_0xcc093f['query'][_0x087c('0x33')]){_0x52da9e[_0x087c('0x31')]=_[_0x087c('0x34')](_0x52da9e[_0x087c('0x31')],{'$or':_[_0x087c('0x23')](_0x3a6701,function(_0x452f69){if(_0x452f69['type']!=='VIRTUAL'){var _0x2ceb8b={};_0x2ceb8b[_0x452f69[_0x087c('0x20')]]={'$like':'%'+_0xcc093f[_0x087c('0x27')]['filter']+'%'};return _0x2ceb8b;}})});}_0x52da9e=_[_0x087c('0x34')]({},_0x52da9e,_0xcc093f[_0x087c('0x35')]);var _0xdc1da1={'where':_0x52da9e[_0x087c('0x31')]};return db['JscriptySessionReport'][_0x087c('0x13')](_0xdc1da1)[_0x087c('0x1d')](function(_0x48af05){_0x4811d8[_0x087c('0x13')]=_0x48af05;if(_0xcc093f[_0x087c('0x27')][_0x087c('0x36')]){_0x52da9e[_0x087c('0x37')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x087c('0x38')](_0x52da9e);})[_0x087c('0x1d')](function(_0x11b9ac){_0x4811d8[_0x087c('0x39')]=_0x11b9ac;return _0x4811d8;})[_0x087c('0x1d')](respondWithFilteredResult(_0x2cd0c8,_0x52da9e))[_0x087c('0x3a')](handleError(_0x2cd0c8,null));};exports['show']=function(_0x58f6c5,_0x111b4a){var _0x56cb6a={'raw':!![],'where':{'id':_0x58f6c5['params']['id']}},_0x53d192={};_0x53d192[_0x087c('0x2b')]=_['keys'](db[_0x087c('0x3b')][_0x087c('0x24')]);_0x53d192[_0x087c('0x27')]=_[_0x087c('0x28')](_0x58f6c5['query']);_0x53d192[_0x087c('0x29')]=_[_0x087c('0x2a')](_0x53d192['model'],_0x53d192[_0x087c('0x27')]);_0x56cb6a[_0x087c('0x2d')]=_[_0x087c('0x2a')](_0x53d192[_0x087c('0x2b')],qs['fields'](_0x58f6c5['query']['fields']));_0x56cb6a['attributes']=_0x56cb6a['attributes'][_0x087c('0x3c')]?_0x56cb6a[_0x087c('0x2d')]:_0x53d192[_0x087c('0x2b')];if(_0x58f6c5[_0x087c('0x27')][_0x087c('0x36')]){_0x56cb6a['include']=[{'all':!![]}];}_0x56cb6a=_['merge']({},_0x56cb6a,_0x58f6c5['options']);return db[_0x087c('0x3b')]['find'](_0x56cb6a)[_0x087c('0x1d')](handleEntityNotFound(_0x111b4a,null))[_0x087c('0x1d')](respondWithResult(_0x111b4a,null))[_0x087c('0x3a')](handleError(_0x111b4a,null));};exports[_0x087c('0x3d')]=function(_0x23fce9,_0x122412){return db[_0x087c('0x3b')][_0x087c('0x3d')](_0x23fce9['body'],{})[_0x087c('0x1d')](respondWithResult(_0x122412,0xc9))[_0x087c('0x3a')](handleError(_0x122412,null));};exports[_0x087c('0x1c')]=function(_0x339dd3,_0x32cd6d){if(_0x339dd3[_0x087c('0x3e')]['id']){delete _0x339dd3['body']['id'];}return db[_0x087c('0x3b')][_0x087c('0x3f')]({'where':{'id':_0x339dd3[_0x087c('0x40')]['id']}})[_0x087c('0x1d')](handleEntityNotFound(_0x32cd6d,null))[_0x087c('0x1d')](saveUpdates(_0x339dd3[_0x087c('0x3e')],null))[_0x087c('0x1d')](respondWithResult(_0x32cd6d,null))[_0x087c('0x3a')](handleError(_0x32cd6d,null));};exports[_0x087c('0x1e')]=function(_0x5f4b80,_0x3a40f9){return db[_0x087c('0x3b')][_0x087c('0x3f')]({'where':{'id':_0x5f4b80[_0x087c('0x40')]['id']}})[_0x087c('0x1d')](handleEntityNotFound(_0x3a40f9,null))['then'](removeEntity(_0x3a40f9,null))['catch'](handleError(_0x3a40f9,null));};exports[_0x087c('0x41')]=function(_0x318afb,_0x2725f0){return db[_0x087c('0x3b')][_0x087c('0x41')]()[_0x087c('0x1d')](respondWithResult(_0x2725f0,null))['catch'](handleError(_0x2725f0,null));};exports[_0x087c('0x42')]=function(_0x59744d,_0x54d674,_0x3607bf){var _0x2f0fe5={'raw':!![],'where':{}};var _0x48ef97={};var _0x2d379b={'count':0x0,'rows':[]};return db[_0x087c('0x3b')]['findOne']({'where':{'id':_0x59744d[_0x087c('0x40')]['id']}})[_0x087c('0x1d')](handleEntityNotFound(_0x54d674,null))[_0x087c('0x1d')](function(_0x2bb704){if(_0x2bb704){_0x48ef97[_0x087c('0x2b')]=_[_0x087c('0x28')](db['JscriptyQuestionReport'][_0x087c('0x24')]);_0x48ef97[_0x087c('0x27')]=_['keys'](_0x59744d['query']);_0x48ef97[_0x087c('0x29')]=_[_0x087c('0x2a')](_0x48ef97[_0x087c('0x2b')],_0x48ef97[_0x087c('0x27')]);_0x2f0fe5['attributes']=_[_0x087c('0x2a')](_0x48ef97[_0x087c('0x2b')],qs[_0x087c('0x2c')](_0x59744d[_0x087c('0x27')][_0x087c('0x2c')]));_0x2f0fe5[_0x087c('0x2d')]=_0x2f0fe5['attributes']['length']?_0x2f0fe5['attributes']:_0x48ef97[_0x087c('0x2b')];if(!_0x59744d['query'][_0x087c('0x2e')](_0x087c('0x43'))){_0x2f0fe5['limit']=qs[_0x087c('0x15')](_0x59744d[_0x087c('0x27')][_0x087c('0x15')]);_0x2f0fe5[_0x087c('0x14')]=qs[_0x087c('0x14')](_0x59744d[_0x087c('0x27')][_0x087c('0x14')]);}_0x2f0fe5['order']=qs[_0x087c('0x30')](_0x59744d[_0x087c('0x27')][_0x087c('0x30')]);_0x2f0fe5[_0x087c('0x31')]=qs['filters'](_['pick'](_0x59744d[_0x087c('0x27')],_0x48ef97[_0x087c('0x29')]));_0x2f0fe5[_0x087c('0x31')][_0x087c('0x44')]=_0x2bb704['id'];if(_0x59744d[_0x087c('0x27')]['filter']){_0x2f0fe5['where']=_[_0x087c('0x34')](_0x2f0fe5[_0x087c('0x31')],{'$or':_[_0x087c('0x23')](_0x2f0fe5[_0x087c('0x2d')],function(_0x5e812b){var _0x2e5d05={};_0x2e5d05[_0x5e812b]={'$like':'%'+_0x59744d[_0x087c('0x27')]['filter']+'%'};return _0x2e5d05;})});}_0x2f0fe5=_['merge']({},_0x2f0fe5,_0x59744d[_0x087c('0x35')]);return db[_0x087c('0x45')][_0x087c('0x13')]({'where':_0x2f0fe5[_0x087c('0x31')]})[_0x087c('0x1d')](function(_0x470497){_0x2d379b[_0x087c('0x13')]=_0x470497;if(_0x59744d[_0x087c('0x27')][_0x087c('0x36')]){_0x2f0fe5[_0x087c('0x37')]=[{'all':!![]}];}return db[_0x087c('0x45')][_0x087c('0x38')](_0x2f0fe5);})['then'](function(_0x125f7b){_0x2d379b['rows']=_0x125f7b;return _0x2d379b;});}})[_0x087c('0x1d')](respondWithFilteredResult(_0x54d674,_0x2f0fe5))['catch'](handleError(_0x54d674,null));}; \ No newline at end of file +var _0x28e6=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','fields','include','body','find','describe','JscriptyQuestionReport','rawAttributes','hasOwnProperty','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','JscriptySessionReport','type','key','model','query','filters','intersection','attributes','length'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x28e6,0x64));var _0x628e=function(_0xfbc650,_0x4121aa){_0xfbc650=_0xfbc650-0x0;var _0x155e66=_0x28e6[_0xfbc650];return _0x155e66;};'use strict';var emlformat=require(_0x628e('0x0'));var rimraf=require(_0x628e('0x1'));var zipdir=require(_0x628e('0x2'));var jsonpatch=require(_0x628e('0x3'));var rp=require('request-promise');var moment=require(_0x628e('0x4'));var BPromise=require(_0x628e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x628e('0x6'));var sox=require(_0x628e('0x7'));var csv=require(_0x628e('0x8'));var ejs=require(_0x628e('0x9'));var fs=require('fs');var fs_extra=require(_0x628e('0xa'));var _=require('lodash');var squel=require(_0x628e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x628e('0xc'));var toCsv=require(_0x628e('0x8'));var querystring=require(_0x628e('0xd'));var Papa=require(_0x628e('0xe'));var Redis=require(_0x628e('0xf'));var authService=require(_0x628e('0x10'));var qs=require(_0x628e('0x11'));var as=require(_0x628e('0x12'));var hardwareService=require(_0x628e('0x13'));var logger=require('../../config/logger')(_0x628e('0x14'));var utils=require(_0x628e('0x15'));var config=require(_0x628e('0x16'));var licenseUtil=require(_0x628e('0x17'));var db=require(_0x628e('0x18'))['db'];function respondWithStatusCode(_0x597fbb,_0x3aaed3){_0x3aaed3=_0x3aaed3||0xcc;return function(_0x42ef80){if(_0x42ef80){return _0x597fbb[_0x628e('0x19')](_0x3aaed3);}return _0x597fbb['status'](_0x3aaed3)['end']();};}function respondWithResult(_0x49b848,_0x5df318){_0x5df318=_0x5df318||0xc8;return function(_0x2e68ce){if(_0x2e68ce){return _0x49b848[_0x628e('0x1a')](_0x5df318)['json'](_0x2e68ce);}};}function respondWithFilteredResult(_0x5dcac0,_0x11336a){return function(_0x1a3a4f){if(_0x1a3a4f){var _0xffd6ff=typeof _0x11336a[_0x628e('0x1b')]===_0x628e('0x1c')&&typeof _0x11336a['limit']==='undefined';var _0x26b783=_0x1a3a4f[_0x628e('0x1d')];var _0x55b588=_0xffd6ff?0x0:_0x11336a[_0x628e('0x1b')];var _0x35e95f=_0xffd6ff?_0x1a3a4f[_0x628e('0x1d')]:_0x11336a[_0x628e('0x1b')]+_0x11336a[_0x628e('0x1e')];var _0x12d843;if(_0x35e95f>=_0x26b783){_0x35e95f=_0x26b783;_0x12d843=0xc8;}else{_0x12d843=0xce;}_0x5dcac0[_0x628e('0x1a')](_0x12d843);return _0x5dcac0['set'](_0x628e('0x1f'),_0x55b588+'-'+_0x35e95f+'/'+_0x26b783)['json'](_0x1a3a4f);}return null;};}function patchUpdates(_0x3d6568){return function(_0x2e6961){try{jsonpatch['apply'](_0x2e6961,_0x3d6568,!![]);}catch(_0x45ae3d){return BPromise[_0x628e('0x20')](_0x45ae3d);}return _0x2e6961[_0x628e('0x21')]();};}function saveUpdates(_0x54c401,_0x3ecace){return function(_0x5b7d9a){if(_0x5b7d9a){return _0x5b7d9a[_0x628e('0x22')](_0x54c401)[_0x628e('0x23')](function(_0x3774bf){return _0x3774bf;});}return null;};}function removeEntity(_0x5351d2,_0x5a57f5){return function(_0x496199){if(_0x496199){return _0x496199[_0x628e('0x24')]()['then'](function(){_0x5351d2[_0x628e('0x1a')](0xcc)[_0x628e('0x25')]();});}};}function handleEntityNotFound(_0x5b01dc,_0xbd0e58){return function(_0x1fef7a){if(!_0x1fef7a){_0x5b01dc[_0x628e('0x19')](0x194);}return _0x1fef7a;};}function handleError(_0x239434,_0x3d9f45){_0x3d9f45=_0x3d9f45||0x1f4;return function(_0x19bbde){logger['error'](_0x19bbde[_0x628e('0x26')]);if(_0x19bbde[_0x628e('0x27')]){delete _0x19bbde[_0x628e('0x27')];}_0x239434[_0x628e('0x1a')](_0x3d9f45)[_0x628e('0x28')](_0x19bbde);};}exports[_0x628e('0x29')]=function(_0x27c805,_0x4c6490){var _0x189228={},_0x5c4479={},_0xa1128b={'count':0x0,'rows':[]};var _0x25025a=_[_0x628e('0x2a')](db[_0x628e('0x2b')]['rawAttributes'],function(_0x1003ad){return{'name':_0x1003ad['fieldName'],'type':_0x1003ad[_0x628e('0x2c')][_0x628e('0x2d')]};});_0x5c4479[_0x628e('0x2e')]=_[_0x628e('0x2a')](_0x25025a,_0x628e('0x27'));_0x5c4479[_0x628e('0x2f')]=_['keys'](_0x27c805['query']);_0x5c4479[_0x628e('0x30')]=_[_0x628e('0x31')](_0x5c4479[_0x628e('0x2e')],_0x5c4479['query']);_0x189228[_0x628e('0x32')]=_['intersection'](_0x5c4479[_0x628e('0x2e')],qs['fields'](_0x27c805[_0x628e('0x2f')]['fields']));_0x189228[_0x628e('0x32')]=_0x189228['attributes'][_0x628e('0x33')]?_0x189228[_0x628e('0x32')]:_0x5c4479[_0x628e('0x2e')];if(!_0x27c805[_0x628e('0x2f')]['hasOwnProperty'](_0x628e('0x34'))){_0x189228['limit']=qs[_0x628e('0x1e')](_0x27c805[_0x628e('0x2f')][_0x628e('0x1e')]);_0x189228[_0x628e('0x1b')]=qs['offset'](_0x27c805[_0x628e('0x2f')]['offset']);}_0x189228[_0x628e('0x35')]=qs[_0x628e('0x36')](_0x27c805[_0x628e('0x2f')][_0x628e('0x36')]);_0x189228[_0x628e('0x37')]=qs[_0x628e('0x30')](_[_0x628e('0x38')](_0x27c805[_0x628e('0x2f')],_0x5c4479['filters']),_0x25025a);if(_0x27c805[_0x628e('0x2f')][_0x628e('0x39')]){_0x189228['where']=_[_0x628e('0x3a')](_0x189228[_0x628e('0x37')],{'$or':_[_0x628e('0x2a')](_0x25025a,function(_0x193834){if(_0x193834[_0x628e('0x2c')]!==_0x628e('0x3b')){var _0x16ac6b={};_0x16ac6b[_0x193834[_0x628e('0x27')]]={'$like':'%'+_0x27c805['query'][_0x628e('0x39')]+'%'};return _0x16ac6b;}})});}_0x189228=_[_0x628e('0x3a')]({},_0x189228,_0x27c805[_0x628e('0x3c')]);var _0x1bafc0={'where':_0x189228[_0x628e('0x37')]};return db[_0x628e('0x2b')]['count'](_0x1bafc0)[_0x628e('0x23')](function(_0x45d7ae){_0xa1128b[_0x628e('0x1d')]=_0x45d7ae;if(_0x27c805[_0x628e('0x2f')][_0x628e('0x3d')]){_0x189228['include']=[{'all':!![]}];}return db[_0x628e('0x2b')][_0x628e('0x3e')](_0x189228);})[_0x628e('0x23')](function(_0x1ab528){_0xa1128b[_0x628e('0x3f')]=_0x1ab528;return _0xa1128b;})[_0x628e('0x23')](respondWithFilteredResult(_0x4c6490,_0x189228))[_0x628e('0x40')](handleError(_0x4c6490,null));};exports['show']=function(_0x34db70,_0x53fc6b){var _0x2cf7b9={'raw':!![],'where':{'id':_0x34db70[_0x628e('0x41')]['id']}},_0x87e4a={};_0x87e4a[_0x628e('0x2e')]=_[_0x628e('0x42')](db[_0x628e('0x2b')]['rawAttributes']);_0x87e4a['query']=_['keys'](_0x34db70[_0x628e('0x2f')]);_0x87e4a[_0x628e('0x30')]=_['intersection'](_0x87e4a['model'],_0x87e4a['query']);_0x2cf7b9[_0x628e('0x32')]=_[_0x628e('0x31')](_0x87e4a[_0x628e('0x2e')],qs['fields'](_0x34db70[_0x628e('0x2f')][_0x628e('0x43')]));_0x2cf7b9[_0x628e('0x32')]=_0x2cf7b9[_0x628e('0x32')][_0x628e('0x33')]?_0x2cf7b9['attributes']:_0x87e4a[_0x628e('0x2e')];if(_0x34db70['query'][_0x628e('0x3d')]){_0x2cf7b9[_0x628e('0x44')]=[{'all':!![]}];}_0x2cf7b9=_['merge']({},_0x2cf7b9,_0x34db70[_0x628e('0x3c')]);return db[_0x628e('0x2b')]['find'](_0x2cf7b9)[_0x628e('0x23')](handleEntityNotFound(_0x53fc6b,null))['then'](respondWithResult(_0x53fc6b,null))[_0x628e('0x40')](handleError(_0x53fc6b,null));};exports['create']=function(_0x3aaddf,_0x2e0134){return db[_0x628e('0x2b')]['create'](_0x3aaddf[_0x628e('0x45')],{})['then'](respondWithResult(_0x2e0134,0xc9))['catch'](handleError(_0x2e0134,null));};exports[_0x628e('0x22')]=function(_0x5474f0,_0x25285c){if(_0x5474f0[_0x628e('0x45')]['id']){delete _0x5474f0[_0x628e('0x45')]['id'];}return db[_0x628e('0x2b')][_0x628e('0x46')]({'where':{'id':_0x5474f0[_0x628e('0x41')]['id']}})['then'](handleEntityNotFound(_0x25285c,null))[_0x628e('0x23')](saveUpdates(_0x5474f0[_0x628e('0x45')],null))[_0x628e('0x23')](respondWithResult(_0x25285c,null))[_0x628e('0x40')](handleError(_0x25285c,null));};exports[_0x628e('0x24')]=function(_0x1cf3e2,_0x257347){return db[_0x628e('0x2b')][_0x628e('0x46')]({'where':{'id':_0x1cf3e2['params']['id']}})['then'](handleEntityNotFound(_0x257347,null))[_0x628e('0x23')](removeEntity(_0x257347,null))[_0x628e('0x40')](handleError(_0x257347,null));};exports[_0x628e('0x47')]=function(_0x19c6e9,_0x4e657b){return db[_0x628e('0x2b')][_0x628e('0x47')]()[_0x628e('0x23')](respondWithResult(_0x4e657b,null))[_0x628e('0x40')](handleError(_0x4e657b,null));};exports['getQuestions']=function(_0x2602b5,_0x2a3e0b,_0x228961){var _0x3cf745={'raw':!![],'where':{}};var _0xd9602e={};var _0xb2a38d={'count':0x0,'rows':[]};return db[_0x628e('0x2b')]['findOne']({'where':{'id':_0x2602b5[_0x628e('0x41')]['id']}})[_0x628e('0x23')](handleEntityNotFound(_0x2a3e0b,null))['then'](function(_0x5df8a7){if(_0x5df8a7){_0xd9602e['model']=_[_0x628e('0x42')](db[_0x628e('0x48')][_0x628e('0x49')]);_0xd9602e[_0x628e('0x2f')]=_[_0x628e('0x42')](_0x2602b5[_0x628e('0x2f')]);_0xd9602e['filters']=_[_0x628e('0x31')](_0xd9602e['model'],_0xd9602e[_0x628e('0x2f')]);_0x3cf745['attributes']=_['intersection'](_0xd9602e[_0x628e('0x2e')],qs[_0x628e('0x43')](_0x2602b5[_0x628e('0x2f')]['fields']));_0x3cf745[_0x628e('0x32')]=_0x3cf745['attributes'][_0x628e('0x33')]?_0x3cf745[_0x628e('0x32')]:_0xd9602e[_0x628e('0x2e')];if(!_0x2602b5['query'][_0x628e('0x4a')](_0x628e('0x34'))){_0x3cf745[_0x628e('0x1e')]=qs['limit'](_0x2602b5[_0x628e('0x2f')][_0x628e('0x1e')]);_0x3cf745[_0x628e('0x1b')]=qs[_0x628e('0x1b')](_0x2602b5[_0x628e('0x2f')][_0x628e('0x1b')]);}_0x3cf745['order']=qs[_0x628e('0x36')](_0x2602b5[_0x628e('0x2f')][_0x628e('0x36')]);_0x3cf745[_0x628e('0x37')]=qs['filters'](_[_0x628e('0x38')](_0x2602b5[_0x628e('0x2f')],_0xd9602e['filters']));_0x3cf745[_0x628e('0x37')][_0x628e('0x4b')]=_0x5df8a7['id'];if(_0x2602b5[_0x628e('0x2f')][_0x628e('0x39')]){_0x3cf745[_0x628e('0x37')]=_[_0x628e('0x3a')](_0x3cf745['where'],{'$or':_['map'](_0x3cf745[_0x628e('0x32')],function(_0x227c27){var _0xe60daf={};_0xe60daf[_0x227c27]={'$like':'%'+_0x2602b5[_0x628e('0x2f')][_0x628e('0x39')]+'%'};return _0xe60daf;})});}_0x3cf745=_[_0x628e('0x3a')]({},_0x3cf745,_0x2602b5['options']);return db[_0x628e('0x48')]['count']({'where':_0x3cf745[_0x628e('0x37')]})[_0x628e('0x23')](function(_0x58907c){_0xb2a38d['count']=_0x58907c;if(_0x2602b5[_0x628e('0x2f')][_0x628e('0x3d')]){_0x3cf745[_0x628e('0x44')]=[{'all':!![]}];}return db[_0x628e('0x48')]['findAll'](_0x3cf745);})[_0x628e('0x23')](function(_0x3ea476){_0xb2a38d[_0x628e('0x3f')]=_0x3ea476;return _0xb2a38d;});}})[_0x628e('0x23')](respondWithFilteredResult(_0x2a3e0b,_0x3cf745))[_0x628e('0x40')](handleError(_0x2a3e0b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 745b5f3..3e5d83c 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 _0xed1c=['exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','request-promise','path','rimraf','./jscriptySessionReport.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xed1c,0xe4));var _0xced1=function(_0x1b5277,_0x8fc24e){_0x1b5277=_0x1b5277-0x0;var _0x4fac23=_0xed1c[_0x1b5277];return _0x4fac23;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));module[_0xced1('0x6')]=function(_0x466657,_0x37b22b){return _0x466657['define'](_0xced1('0x7'),attributes,{'tableName':_0xced1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6050=['../../config/environment','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1511b9,_0x5f0d30){var _0x1cd71a=function(_0x1e35b3){while(--_0x1e35b3){_0x1511b9['push'](_0x1511b9['shift']());}};_0x1cd71a(++_0x5f0d30);}(_0x6050,0x196));var _0x0605=function(_0x4fa791,_0x913983){_0x4fa791=_0x4fa791-0x0;var _0x3f684e=_0x6050[_0x4fa791];return _0x3f684e;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index b73976f..9c1526a 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 _0x77d4=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x77d4,0x108));var _0x477d=function(_0x4d77a4,_0x3be85a){_0x4d77a4=_0x4d77a4-0x0;var _0x15a00e=_0x77d4[_0x4d77a4];return _0x15a00e;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x309dea,_0x59f1e2){var _0x6e7f1b=function(_0x385a66){while(--_0x385a66){_0x309dea['push'](_0x309dea['shift']());}};_0x6e7f1b(++_0x59f1e2);}(_0x0295,0x1f0));var _0x5029=function(_0x40d5cc,_0xf9d2c7){_0x40d5cc=_0x40d5cc-0x0;var _0x6950af=_0x0295[_0x40d5cc];return _0x6950af;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 43fce7e..06b5fd0 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 _0xc8e9=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','put','/:id','isAuthenticated','update','exports','util','path','connect-timeout','fs-extra'];(function(_0x2ec40b,_0x59a29c){var _0x28ba77=function(_0x7e5046){while(--_0x7e5046){_0x2ec40b['push'](_0x2ec40b['shift']());}};_0x28ba77(++_0x59a29c);}(_0xc8e9,0x1f4));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9c8e('0x0'));var path=require(_0x9c8e('0x1'));var timeout=require(_0x9c8e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9c8e('0x3'));var auth=require(_0x9c8e('0x4'));var interaction=require(_0x9c8e('0x5'));var config=require(_0x9c8e('0x6'));var controller=require('./license.controller');router[_0x9c8e('0x7')]('/',controller[_0x9c8e('0x8')]);router[_0x9c8e('0x9')](_0x9c8e('0xa'),auth[_0x9c8e('0xb')](),controller[_0x9c8e('0xc')]);module[_0x9c8e('0xd')]=router; \ No newline at end of file +var _0x59cf=['/:id','update','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','put'];(function(_0x4e608f,_0x810614){var _0x3292c3=function(_0x4302e4){while(--_0x4302e4){_0x4e608f['push'](_0x4e608f['shift']());}};_0x3292c3(++_0x810614);}(_0x59cf,0x158));var _0xf59c=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0x59cf[_0x46a3e8];return _0xf1442e;};'use strict';var multer=require(_0xf59c('0x0'));var util=require(_0xf59c('0x1'));var path=require(_0xf59c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf59c('0x3'));var interaction=require(_0xf59c('0x4'));var config=require(_0xf59c('0x5'));var controller=require('./license.controller');router[_0xf59c('0x6')]('/',controller['index']);router[_0xf59c('0x7')](_0xf59c('0x8'),auth['isAuthenticated'](),controller[_0xf59c('0x9')]);module[_0xf59c('0xa')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index ddccca4..0e89131 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 _0xe606=['TEXT','STRING','sequelize'];(function(_0x5b8a99,_0x2e0c12){var _0x31fa01=function(_0x21396c){while(--_0x21396c){_0x5b8a99['push'](_0x5b8a99['shift']());}};_0x31fa01(++_0x2e0c12);}(_0xe606,0x131));var _0x6e60=function(_0x4394bf,_0x40622a){_0x4394bf=_0x4394bf-0x0;var _0x404cd3=_0xe606[_0x4394bf];return _0x404cd3;};'use strict';var Sequelize=require(_0x6e60('0x0'));module['exports']={'license':{'type':Sequelize[_0x6e60('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x6e60('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe096=['INTEGER','exports','TEXT','STRING'];(function(_0x21e6f1,_0x4d5eb5){var _0x44a394=function(_0x2d0e0e){while(--_0x2d0e0e){_0x21e6f1['push'](_0x21e6f1['shift']());}};_0x44a394(++_0x4d5eb5);}(_0xe096,0x1b5));var _0x6e09=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0xe096[_0x2e655a];return _0x26f13b;};'use strict';var Sequelize=require('sequelize');module[_0x6e09('0x0')]={'license':{'type':Sequelize[_0x6e09('0x1')]},'data1':{'type':Sequelize[_0x6e09('0x2')]},'data2':{'type':Sequelize[_0x6e09('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x6e09('0x3')],'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 e07c023..b39e736 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 _0xadb5=['query','filters','intersection','attributes','merge','getLicense','body','find','params','key','catch','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','model','keys','License'];(function(_0x1176b2,_0x39c5d9){var _0x22beb6=function(_0x349129){while(--_0x349129){_0x1176b2['push'](_0x1176b2['shift']());}};_0x22beb6(++_0x39c5d9);}(_0xadb5,0xad));var _0x5adb=function(_0x20bdae,_0x456958){_0x20bdae=_0x20bdae-0x0;var _0x328fd5=_0xadb5[_0x20bdae];return _0x328fd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}var utilLicense=require(_0x5adb('0x17'));exports['index']=function(_0x49992e,_0x5d457e){var _0x39bddd={'raw':!![],'where':{'id':0x1}},_0x1eac55={};_0x1eac55[_0x5adb('0x28')]=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes']);_0x1eac55[_0x5adb('0x2b')]=_[_0x5adb('0x29')](_0x49992e[_0x5adb('0x2b')]);_0x1eac55[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0x1eac55[_0x5adb('0x28')],_0x1eac55[_0x5adb('0x2b')]);_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x2d')](_0x1eac55[_0x5adb('0x28')],qs['fields'](_0x49992e[_0x5adb('0x2b')]['fields']));_0x39bddd[_0x5adb('0x2e')]=_0x39bddd[_0x5adb('0x2e')]['length']?_0x39bddd[_0x5adb('0x2e')]:_0x1eac55[_0x5adb('0x28')];_0x39bddd=_[_0x5adb('0x2f')]({},_0x39bddd,_0x49992e['options']);return utilLicense[_0x5adb('0x30')](_0x39bddd)[_0x5adb('0x22')](respondWithResult(_0x5d457e,null))['catch'](handleError(_0x5d457e,null));};exports['update']=function(_0x1ed9ea,_0x49dd03){if(_0x1ed9ea[_0x5adb('0x31')]['id']){delete _0x1ed9ea[_0x5adb('0x31')]['id'];}return db[_0x5adb('0x2a')][_0x5adb('0x32')]({'where':{'id':_0x1ed9ea[_0x5adb('0x33')]['id']}})['then'](handleEntityNotFound(_0x49dd03,null))[_0x5adb('0x22')](function(_0x215b88){var _0x1c3a5c=_0x215b88['get']({'plain':!![]});return utilLicense['checkLicense'](_0x1c3a5c,_0x1ed9ea[_0x5adb('0x31')][_0x5adb('0x34')]);})['then'](function(_0x2355bc){if(!_0x2355bc['demo']){return saveUpdates(_0x1ed9ea[_0x5adb('0x31')],null);}return _0x2355bc;})['then'](respondWithResult(_0x49dd03,null))[_0x5adb('0x35')](handleError(_0x49dd03,null));}; \ No newline at end of file +var _0xabce=['status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','getLicense','catch','find','get','body','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x111d37,_0x2cd552){var _0x43a789=function(_0x2c99c4){while(--_0x2c99c4){_0x111d37['push'](_0x111d37['shift']());}};_0x43a789(++_0x2cd552);}(_0xabce,0x103));var _0xeabc=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xabce[_0x173d7e];return _0x2220d6;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}var utilLicense=require(_0xeabc('0x18'));exports['index']=function(_0x2163e6,_0x38572d){var _0x2b568f={'raw':!![],'where':{'id':0x1}},_0x2f8633={};_0x2f8633[_0xeabc('0x2a')]=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x2f8633[_0xeabc('0x2e')]=_['keys'](_0x2163e6[_0xeabc('0x2e')]);_0x2f8633['filters']=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],_0x2f8633[_0xeabc('0x2e')]);_0x2b568f[_0xeabc('0x30')]=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],qs[_0xeabc('0x31')](_0x2163e6['query'][_0xeabc('0x31')]));_0x2b568f[_0xeabc('0x30')]=_0x2b568f[_0xeabc('0x30')]['length']?_0x2b568f[_0xeabc('0x30')]:_0x2f8633[_0xeabc('0x2a')];_0x2b568f=_[_0xeabc('0x32')]({},_0x2b568f,_0x2163e6['options']);return utilLicense[_0xeabc('0x33')](_0x2b568f)[_0xeabc('0x25')](respondWithResult(_0x38572d,null))[_0xeabc('0x34')](handleError(_0x38572d,null));};exports['update']=function(_0xf98c7c,_0x286203){if(_0xf98c7c['body']['id']){delete _0xf98c7c['body']['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x35')]({'where':{'id':_0xf98c7c['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x286203,null))[_0xeabc('0x25')](function(_0x3edee7){var _0x10434e=_0x3edee7[_0xeabc('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x10434e,_0xf98c7c[_0xeabc('0x37')]['key']);})[_0xeabc('0x25')](function(_0x2bda29){if(!_0x2bda29[_0xeabc('0x38')]){return saveUpdates(_0xf98c7c['body'],null);}return _0x2bda29;})['then'](respondWithResult(_0x286203,null))[_0xeabc('0x34')](handleError(_0x286203,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d67c656..4af89e4 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 _0x9486=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9486,0x10a));var _0x6948=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9486[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x6948('0x0'));var util=require(_0x6948('0x1'));var logger=require(_0x6948('0x2'))(_0x6948('0x3'));var moment=require(_0x6948('0x4'));var BPromise=require(_0x6948('0x5'));var rp=require(_0x6948('0x6'));var fs=require('fs');var path=require(_0x6948('0x7'));var rimraf=require(_0x6948('0x8'));var config=require(_0x6948('0x9'));var attributes=require(_0x6948('0xa'));module[_0x6948('0xb')]=function(_0xd09f56,_0x9885e9){return _0xd09f56[_0x6948('0xc')](_0x6948('0xd'),attributes,{'tableName':_0x6948('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9571=['path','rimraf','../../config/environment','./license.attributes','exports','define','License','util','../../config/logger','api','bluebird','request-promise'];(function(_0x14d968,_0x3c23e8){var _0x381c9f=function(_0x1e9dfe){while(--_0x1e9dfe){_0x14d968['push'](_0x14d968['shift']());}};_0x381c9f(++_0x3c23e8);}(_0x9571,0x11b));var _0x1957=function(_0x1064b8,_0x32e8ac){_0x1064b8=_0x1064b8-0x0;var _0x4a53bd=_0x9571[_0x1064b8];return _0x4a53bd;};'use strict';var _=require('lodash');var util=require(_0x1957('0x0'));var logger=require(_0x1957('0x1'))(_0x1957('0x2'));var moment=require('moment');var BPromise=require(_0x1957('0x3'));var rp=require(_0x1957('0x4'));var fs=require('fs');var path=require(_0x1957('0x5'));var rimraf=require(_0x1957('0x6'));var config=require(_0x1957('0x7'));var attributes=require(_0x1957('0x8'));module[_0x1957('0x9')]=function(_0x5503a1,_0x2ccdec){return _0x5503a1[_0x1957('0xa')](_0x1957('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 e7e22b6..a301f9a 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 _0xfa62=['util','bluebird','../../mysqldb','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x2cac2e,_0x59d4c3){var _0x19ffe8=function(_0x5c52b1){while(--_0x5c52b1){_0x2cac2e['push'](_0x2cac2e['shift']());}};_0x19ffe8(++_0x59d4c3);}(_0xfa62,0x7d));var _0x2fa6=function(_0x386b0a,_0xf06c52){_0x386b0a=_0x386b0a-0x0;var _0x3c374d=_0xfa62[_0x386b0a];return _0x3c374d;};'use strict';var _=require(_0x2fa6('0x0'));var util=require(_0x2fa6('0x1'));var moment=require('moment');var BPromise=require(_0x2fa6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fa6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2fa6('0x4'));var client=jayson[_0x2fa6('0x5')][_0x2fa6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x178400,_0x3c4c37,_0x5937be){return new BPromise(function(_0xdbb888,_0x25899){return client[_0x2fa6('0x7')](_0x178400,_0x5937be)[_0x2fa6('0x8')](function(_0x15aac4){logger[_0x2fa6('0x9')](_0x2fa6('0xa'),_0x3c4c37,_0x2fa6('0xb'));logger['debug'](_0x2fa6('0xc'),_0x3c4c37,_0x2fa6('0xb'),JSON[_0x2fa6('0xd')](_0x15aac4));if(_0x15aac4[_0x2fa6('0xe')]){if(_0x15aac4['error'][_0x2fa6('0xf')]===0x1f4){logger[_0x2fa6('0xe')](_0x2fa6('0xa'),_0x3c4c37,_0x15aac4['error'][_0x2fa6('0x10')]);return _0x25899(_0x15aac4['error'][_0x2fa6('0x10')]);}logger[_0x2fa6('0xe')]('License,\x20%s,\x20%s',_0x3c4c37,_0x15aac4[_0x2fa6('0xe')][_0x2fa6('0x10')]);return _0xdbb888(_0x15aac4[_0x2fa6('0xe')][_0x2fa6('0x10')]);}else{logger['info'](_0x2fa6('0xa'),_0x3c4c37,_0x2fa6('0xb'));_0xdbb888(_0x15aac4[_0x2fa6('0x11')]['message']);}})['catch'](function(_0x3c7948){logger[_0x2fa6('0xe')](_0x2fa6('0xa'),_0x3c4c37,_0x3c7948);_0x25899(_0x3c7948);});});} \ No newline at end of file +var _0x4119=['License,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x39804e,_0x5d5530){var _0x32a258=function(_0x5e9378){while(--_0x5e9378){_0x39804e['push'](_0x39804e['shift']());}};_0x32a258(++_0x5d5530);}(_0x4119,0x118));var _0x9411=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x4119[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require('lodash');var util=require(_0x9411('0x0'));var moment=require(_0x9411('0x1'));var BPromise=require(_0x9411('0x2'));var rs=require(_0x9411('0x3'));var fs=require('fs');var Redis=require(_0x9411('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9411('0x5'));var logger=require(_0x9411('0x6'))(_0x9411('0x7'));var config=require(_0x9411('0x8'));var jayson=require(_0x9411('0x9'));var client=jayson[_0x9411('0xa')][_0x9411('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15dbb7,_0x2eeba1,_0x54648f){return new BPromise(function(_0xb2e119,_0x3512b8){return client[_0x9411('0xc')](_0x15dbb7,_0x54648f)['then'](function(_0x47e300){logger[_0x9411('0xd')]('License,\x20%s,\x20%s',_0x2eeba1,_0x9411('0xe'));logger[_0x9411('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x2eeba1,_0x9411('0xe'),JSON[_0x9411('0x10')](_0x47e300));if(_0x47e300[_0x9411('0x11')]){if(_0x47e300[_0x9411('0x11')][_0x9411('0x12')]===0x1f4){logger[_0x9411('0x11')](_0x9411('0x13'),_0x2eeba1,_0x47e300[_0x9411('0x11')][_0x9411('0x14')]);return _0x3512b8(_0x47e300[_0x9411('0x11')]['message']);}logger[_0x9411('0x11')]('License,\x20%s,\x20%s',_0x2eeba1,_0x47e300[_0x9411('0x11')][_0x9411('0x14')]);return _0xb2e119(_0x47e300['error'][_0x9411('0x14')]);}else{logger[_0x9411('0xd')]('License,\x20%s,\x20%s',_0x2eeba1,_0x9411('0xe'));_0xb2e119(_0x47e300[_0x9411('0x15')]['message']);}})[_0x9411('0x16')](function(_0x2c47cb){logger['error'](_0x9411('0x13'),_0x2eeba1,_0x2c47cb);_0x3512b8(_0x2c47cb);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c5310db..9568368 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 _0xfbb6=['addImap','addSmtp','addInteraction','addApplications','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','multer','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xfbb6,0x167));var _0x6fbb=function(_0x3bc44d,_0x47f40a){_0x3bc44d=_0x3bc44d-0x0;var _0x5e9b5b=_0xfbb6[_0x3bc44d];return _0x5e9b5b;};'use strict';var multer=require(_0x6fbb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6fbb('0x1'));var express=require(_0x6fbb('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6fbb('0x3'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x6fbb('0x4')]('/',auth[_0x6fbb('0x5')](),controller['index']);router[_0x6fbb('0x4')]('/describe',auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x6')]);router['get'](_0x6fbb('0x7'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x8')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x6fbb('0x9'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0xa')]);router[_0x6fbb('0x4')]('/:id/in_servers',auth[_0x6fbb('0x5')](),controller[_0x6fbb('0xb')]);router[_0x6fbb('0x4')](_0x6fbb('0xc'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0xd')]);router[_0x6fbb('0x4')](_0x6fbb('0xe'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0xf')]);router[_0x6fbb('0x4')](_0x6fbb('0x10'),auth['isAuthenticated'](),controller[_0x6fbb('0x11')]);router[_0x6fbb('0x4')](_0x6fbb('0x12'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x13')]);router['get']('/:id/verify',auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x14')]);router[_0x6fbb('0x4')](_0x6fbb('0x15'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x16')]);router[_0x6fbb('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x6fbb('0x18')]);router[_0x6fbb('0x17')](_0x6fbb('0x9'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x19')]);router[_0x6fbb('0x17')]('/',auth['isAuthenticated'](),controller[_0x6fbb('0x1a')]);router[_0x6fbb('0x17')](_0x6fbb('0x1b'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x1c')]);router['post'](_0x6fbb('0xc'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x1d')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x6fbb('0x1e')]);router[_0x6fbb('0x17')]('/:id/applications',auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x1f')]);router[_0x6fbb('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0x6fbb('0x20')]);router[_0x6fbb('0x17')]('/:id/users',auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x21')]);router[_0x6fbb('0x22')](_0x6fbb('0x7'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x23')]);router[_0x6fbb('0x24')]('/:id/dispositions',auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x25')]);router['delete'](_0x6fbb('0x9'),auth[_0x6fbb('0x5')](),controller['removeAnswers']);router[_0x6fbb('0x24')](_0x6fbb('0x1b'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x26')]);router[_0x6fbb('0x24')](_0x6fbb('0xc'),auth['isAuthenticated'](),controller[_0x6fbb('0x27')]);router[_0x6fbb('0x24')]('/:id',auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x28')]);router[_0x6fbb('0x24')](_0x6fbb('0x15'),auth[_0x6fbb('0x5')](),controller[_0x6fbb('0x29')]);module[_0x6fbb('0x2a')]=router; \ No newline at end of file +var _0xe81d=['getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','/:id','delete','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xe81d,0x170));var _0xde81=function(_0x2933bd,_0x4ca964){_0x2933bd=_0x2933bd-0x0;var _0xe34777=_0xe81d[_0x2933bd];return _0xe34777;};'use strict';var multer=require(_0xde81('0x0'));var util=require(_0xde81('0x1'));var path=require(_0xde81('0x2'));var timeout=require(_0xde81('0x3'));var express=require(_0xde81('0x4'));var router=express[_0xde81('0x5')]();var fs_extra=require(_0xde81('0x6'));var auth=require(_0xde81('0x7'));var interaction=require(_0xde81('0x8'));var config=require(_0xde81('0x9'));var controller=require(_0xde81('0xa'));router[_0xde81('0xb')]('/',auth[_0xde81('0xc')](),controller[_0xde81('0xd')]);router['get'](_0xde81('0xe'),auth[_0xde81('0xc')](),controller[_0xde81('0xf')]);router[_0xde81('0xb')]('/:id',auth[_0xde81('0xc')](),controller['show']);router['get'](_0xde81('0x10'),auth[_0xde81('0xc')](),controller[_0xde81('0x11')]);router[_0xde81('0xb')](_0xde81('0x12'),auth[_0xde81('0xc')](),controller[_0xde81('0x13')]);router[_0xde81('0xb')](_0xde81('0x14'),auth['isAuthenticated'](),controller[_0xde81('0x15')]);router[_0xde81('0xb')](_0xde81('0x16'),auth['isAuthenticated'](),controller[_0xde81('0x17')]);router[_0xde81('0xb')]('/:id/interactions',auth[_0xde81('0xc')](),controller[_0xde81('0x18')]);router['get'](_0xde81('0x19'),auth[_0xde81('0xc')](),controller[_0xde81('0x1a')]);router['get'](_0xde81('0x1b'),auth[_0xde81('0xc')](),controller[_0xde81('0x1c')]);router[_0xde81('0xb')](_0xde81('0x1d'),auth[_0xde81('0xc')](),controller[_0xde81('0x1e')]);router[_0xde81('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xde81('0x1f')](_0xde81('0x10'),auth[_0xde81('0xc')](),controller[_0xde81('0x20')]);router['post'](_0xde81('0x12'),auth[_0xde81('0xc')](),controller[_0xde81('0x21')]);router[_0xde81('0x1f')]('/',auth[_0xde81('0xc')](),controller[_0xde81('0x22')]);router[_0xde81('0x1f')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xde81('0x23')]);router['post'](_0xde81('0x16'),auth[_0xde81('0xc')](),controller[_0xde81('0x24')]);router[_0xde81('0x1f')](_0xde81('0x25'),auth[_0xde81('0xc')](),controller[_0xde81('0x26')]);router[_0xde81('0x1f')](_0xde81('0x19'),auth[_0xde81('0xc')](),controller[_0xde81('0x27')]);router['post'](_0xde81('0x28'),auth[_0xde81('0xc')](),controller[_0xde81('0x29')]);router[_0xde81('0x1f')](_0xde81('0x2a'),auth['isAuthenticated'](),controller[_0xde81('0x2b')]);router[_0xde81('0x2c')](_0xde81('0x2d'),auth[_0xde81('0xc')](),controller['update']);router[_0xde81('0x2e')](_0xde81('0x10'),auth[_0xde81('0xc')](),controller[_0xde81('0x2f')]);router[_0xde81('0x2e')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0xde81('0x2e')](_0xde81('0x14'),auth[_0xde81('0xc')](),controller['removeImap']);router[_0xde81('0x2e')](_0xde81('0x16'),auth[_0xde81('0xc')](),controller['removeSmtp']);router[_0xde81('0x2e')](_0xde81('0x2d'),auth[_0xde81('0xc')](),controller['destroy']);router['delete'](_0xde81('0x2a'),auth[_0xde81('0xc')](),controller[_0xde81('0x30')]);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 1fc8b8c..edc5381 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 _0x2e8a=['STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','exports'];(function(_0x242c75,_0x13becc){var _0xcb2e4b=function(_0x1d6ff6){while(--_0x1d6ff6){_0x242c75['push'](_0x242c75['shift']());}};_0xcb2e4b(++_0x13becc);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0x2e8a[_0x12254f];return _0x3a4fa2;};'use strict';var Sequelize=require('sequelize');module[_0xa2e8('0x0')]={'description':{'type':Sequelize[_0xa2e8('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xa2e8('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa2e8('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xa2e8('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xa2e8('0x3')](0x2)[_0xa2e8('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa2e8('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xa2e8('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa2e8('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa2e8('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa2e8('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa2e8('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa2e8('0x3')],'allowNull':!![],'defaultValue':null,'comment':_0xa2e8('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xa2e8('0x2')],'defaultValue':![],'comment':_0xa2e8('0x7'),'set':function(_0x1d8b32){if(!_0x1d8b32)this['setDataValue'](_0xa2e8('0x8'),null);this[_0xa2e8('0x9')]('mandatoryDisposition',_0x1d8b32);}}}; \ No newline at end of file +var _0xc3a8=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x533daf,_0x19a7bf){var _0x3c161f=function(_0x521824){while(--_0x521824){_0x533daf['push'](_0x533daf['shift']());}};_0x3c161f(++_0x19a7bf);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x5bc95c,_0xfed759){_0x5bc95c=_0x5bc95c-0x0;var _0x3721fc=_0xc3a8[_0x5bc95c];return _0x3721fc;};'use strict';var Sequelize=require(_0x8c3a('0x0'));module[_0x8c3a('0x1')]={'description':{'type':Sequelize[_0x8c3a('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x8c3a('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8c3a('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x8c3a('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x8c3a('0x4')]},'markAsUnread':{'type':Sequelize[_0x8c3a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8c3a('0x5')},'fontSize':{'type':Sequelize[_0x8c3a('0x6')](0x2)[_0x8c3a('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8c3a('0x4')],'defaultValue':function(){return _0x8c3a('0x8');}},'notificationSound':{'type':Sequelize[_0x8c3a('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8c3a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8c3a('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8c3a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8c3a('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8c3a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8c3a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x8c3a('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x451726){if(!_0x451726)this[_0x8c3a('0xa')](_0x8c3a('0xb'),null);this[_0x8c3a('0xa')](_0x8c3a('0xc'),_0x451726);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0a39b62..2d2cc45 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 _0x4397=['mandatoryDispositionPause','MailAccount','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','Imap','MailServerOut','rawAttributes','include','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','ListId','active','description','cauthentication','user','authentication','host','port','service','cuser','password','pass','cpassword','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','getInteractions','CmContact','Contact','User','Tag','Tags','color','tag','addApplications','sequelize','destroy','bulkCreate','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','send','CmList','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','removeAgents','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','reject','save','update','then','get','MailAccounts','UserProfileResource','status','stack','index','MailServerIn','Smtp','Pause'];(function(_0x16e5dc,_0x87644c){var _0x59c19d=function(_0x4a801e){while(--_0x4a801e){_0x16e5dc['push'](_0x16e5dc['shift']());}};_0x59c19d(++_0x87644c);}(_0x4397,0x140));var _0x7439=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x4397[_0x3b594b];return _0x1ea5f8;};'use strict';var emlformat=require(_0x7439('0x0'));var rimraf=require(_0x7439('0x1'));var zipdir=require(_0x7439('0x2'));var jsonpatch=require(_0x7439('0x3'));var rp=require(_0x7439('0x4'));var moment=require(_0x7439('0x5'));var BPromise=require(_0x7439('0x6'));var Mustache=require(_0x7439('0x7'));var util=require(_0x7439('0x8'));var path=require(_0x7439('0x9'));var sox=require(_0x7439('0xa'));var csv=require(_0x7439('0xb'));var ejs=require(_0x7439('0xc'));var fs=require('fs');var fs_extra=require(_0x7439('0xd'));var _=require('lodash');var squel=require(_0x7439('0xe'));var crypto=require(_0x7439('0xf'));var jsforce=require(_0x7439('0x10'));var deskjs=require(_0x7439('0x11'));var toCsv=require(_0x7439('0xb'));var querystring=require(_0x7439('0x12'));var Papa=require(_0x7439('0x13'));var htmlToText=require(_0x7439('0x14'));var juice=require(_0x7439('0x15'));var Redis=require(_0x7439('0x16'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7439('0x17'));var hardwareService=require(_0x7439('0x18'));var logger=require(_0x7439('0x19'))(_0x7439('0x1a'));var utils=require(_0x7439('0x1b'));var config=require(_0x7439('0x1c'));var licenseUtil=require(_0x7439('0x1d'));var db=require(_0x7439('0x1e'))['db'];config[_0x7439('0x1f')]=_[_0x7439('0x20')](config[_0x7439('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0x7439('0x21'))(new Redis(config[_0x7439('0x1f')]));require(_0x7439('0x22'))[_0x7439('0x23')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7439('0x24')][_0x7439('0x25')]({'port':0x232b});function respondWithRpcPromise(_0x158bf4,_0x34961e,_0x11be33,_0x2f485a){return new BPromise(function(_0x32816d,_0x4591d7){var _0x18095d=_0x2f485a||client;return _0x18095d['request'](_0x158bf4,_0x11be33)['then'](function(_0x314f4b){logger[_0x7439('0x26')](_0x7439('0x27'),_0x34961e,_0x7439('0x28'));logger['debug'](_0x7439('0x29'),_0x34961e,_0x7439('0x28'),JSON['stringify'](_0x314f4b));if(_0x314f4b['error']){if(_0x314f4b[_0x7439('0x2a')][_0x7439('0x2b')]===0x1f4){logger[_0x7439('0x2a')](_0x7439('0x27'),_0x34961e,_0x314f4b[_0x7439('0x2a')][_0x7439('0x2c')]);return _0x4591d7(_0x314f4b[_0x7439('0x2a')][_0x7439('0x2c')]);}logger[_0x7439('0x2a')](_0x7439('0x27'),_0x34961e,_0x314f4b[_0x7439('0x2a')][_0x7439('0x2c')]);return _0x32816d(_0x314f4b[_0x7439('0x2a')][_0x7439('0x2c')]);}else{logger[_0x7439('0x26')](_0x7439('0x27'),_0x34961e,_0x7439('0x28'));_0x32816d(_0x314f4b[_0x7439('0x2d')]['message']);}})[_0x7439('0x2e')](function(_0x16c349){logger[_0x7439('0x2a')](_0x7439('0x27'),_0x34961e,_0x16c349);_0x4591d7(_0x16c349);});});}function respondWithStatusCode(_0x24cb55,_0x469cd5){_0x469cd5=_0x469cd5||0xcc;return function(_0x10ccc6){if(_0x10ccc6){return _0x24cb55[_0x7439('0x2f')](_0x469cd5);}return _0x24cb55['status'](_0x469cd5)[_0x7439('0x30')]();};}function respondWithResult(_0x31bea6,_0x1b5a79){_0x1b5a79=_0x1b5a79||0xc8;return function(_0x5f10bb){if(_0x5f10bb){return _0x31bea6['status'](_0x1b5a79)[_0x7439('0x31')](_0x5f10bb);}};}function respondWithFilteredResult(_0x2d4349,_0x1f099c){return function(_0x3cdf14){if(_0x3cdf14){var _0x2a5ed7=typeof _0x1f099c[_0x7439('0x32')]===_0x7439('0x33')&&typeof _0x1f099c[_0x7439('0x34')]===_0x7439('0x33');var _0x35db4a=_0x3cdf14[_0x7439('0x35')];var _0x56186a=_0x2a5ed7?0x0:_0x1f099c[_0x7439('0x32')];var _0x2a52f1=_0x2a5ed7?_0x3cdf14[_0x7439('0x35')]:_0x1f099c[_0x7439('0x32')]+_0x1f099c[_0x7439('0x34')];var _0x20fcbb;if(_0x2a52f1>=_0x35db4a){_0x2a52f1=_0x35db4a;_0x20fcbb=0xc8;}else{_0x20fcbb=0xce;}_0x2d4349['status'](_0x20fcbb);return _0x2d4349[_0x7439('0x36')]('Content-Range',_0x56186a+'-'+_0x2a52f1+'/'+_0x35db4a)[_0x7439('0x31')](_0x3cdf14);}return null;};}function patchUpdates(_0x3c35c5){return function(_0x83fa27){try{jsonpatch['apply'](_0x83fa27,_0x3c35c5,!![]);}catch(_0x1827fa){return BPromise[_0x7439('0x37')](_0x1827fa);}return _0x83fa27[_0x7439('0x38')]();};}function saveUpdates(_0x1762c9,_0x1583ca){return function(_0x28587e){if(_0x28587e){return _0x28587e[_0x7439('0x39')](_0x1762c9)[_0x7439('0x3a')](function(_0x2bbe28){return _0x2bbe28;});}return null;};}function removeEntity(_0x5b7d77,_0x949eab){return function(_0x526484){if(_0x526484){return _0x526484['destroy']()[_0x7439('0x3a')](function(){var _0x3f27c6=_0x526484[_0x7439('0x3b')]({'plain':!![]});var _0x38e521=_0x7439('0x3c');return db[_0x7439('0x3d')]['destroy']({'where':{'type':_0x38e521,'resourceId':_0x3f27c6['id']}})[_0x7439('0x3a')](function(){return _0x526484;});})[_0x7439('0x3a')](function(){_0x5b7d77[_0x7439('0x3e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x564bd0,_0x410eef){return function(_0x41741d){if(!_0x41741d){_0x564bd0[_0x7439('0x2f')](0x194);}return _0x41741d;};}function handleError(_0x1b4698,_0x44e928){_0x44e928=_0x44e928||0x1f4;return function(_0x90c330){logger[_0x7439('0x2a')](_0x90c330[_0x7439('0x3f')]);if(_0x90c330['name']){delete _0x90c330['name'];}_0x1b4698['status'](_0x44e928)['send'](_0x90c330);};}exports[_0x7439('0x40')]=function(_0x576cc7,_0x248864){var _0x271da9={'include':[{'model':db[_0x7439('0x41')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x7439('0x42')},{'model':db[_0x7439('0x43')],'as':_0x7439('0x44')}]},_0x375b6f={},_0x1d4683={'count':0x0,'rows':[]};var _0x20fed7=_['map'](db[_0x7439('0x45')]['rawAttributes'],function(_0xbdee58){return{'name':_0xbdee58['fieldName'],'type':_0xbdee58['type'][_0x7439('0x46')]};});_0x375b6f[_0x7439('0x47')]=_[_0x7439('0x48')](_0x20fed7,_0x7439('0x49'));_0x375b6f[_0x7439('0x4a')]=_[_0x7439('0x4b')](_0x576cc7['query']);_0x375b6f[_0x7439('0x4c')]=_['intersection'](_0x375b6f[_0x7439('0x47')],_0x375b6f[_0x7439('0x4a')]);_0x271da9['attributes']=_[_0x7439('0x4d')](_0x375b6f['model'],qs[_0x7439('0x4e')](_0x576cc7[_0x7439('0x4a')][_0x7439('0x4e')]));_0x271da9[_0x7439('0x4f')]=_0x271da9[_0x7439('0x4f')][_0x7439('0x50')]?_0x271da9['attributes']:_0x375b6f[_0x7439('0x47')];if(!_0x576cc7[_0x7439('0x4a')][_0x7439('0x51')](_0x7439('0x52'))){_0x271da9[_0x7439('0x34')]=qs[_0x7439('0x34')](_0x576cc7[_0x7439('0x4a')][_0x7439('0x34')]);_0x271da9[_0x7439('0x32')]=qs[_0x7439('0x32')](_0x576cc7[_0x7439('0x4a')][_0x7439('0x32')]);}_0x271da9[_0x7439('0x53')]=qs[_0x7439('0x54')](_0x576cc7[_0x7439('0x4a')]['sort']);_0x271da9['where']=qs['filters'](_[_0x7439('0x55')](_0x576cc7[_0x7439('0x4a')],_0x375b6f[_0x7439('0x4c')]),_0x20fed7);if(_0x576cc7[_0x7439('0x4a')][_0x7439('0x56')]){_0x271da9[_0x7439('0x57')]=_['merge'](_0x271da9[_0x7439('0x57')],{'$or':_[_0x7439('0x48')](_0x20fed7,function(_0x69f6da){if(_0x69f6da[_0x7439('0x58')]!==_0x7439('0x59')){var _0x589e3c={};_0x589e3c[_0x69f6da[_0x7439('0x49')]]={'$like':'%'+_0x576cc7[_0x7439('0x4a')][_0x7439('0x56')]+'%'};return _0x589e3c;}})});}_0x271da9=_[_0x7439('0x5a')]({},_0x271da9,_0x576cc7[_0x7439('0x5b')]);var _0x3ec99c={'where':_0x271da9['where']};return db[_0x7439('0x45')]['count'](_0x3ec99c)[_0x7439('0x3a')](function(_0x56049e){_0x1d4683['count']=_0x56049e;if(_0x576cc7['query'][_0x7439('0x5c')]){_0x271da9['include']=[{'all':!![]}];}return db[_0x7439('0x45')][_0x7439('0x5d')](_0x271da9);})[_0x7439('0x3a')](function(_0x11b9bf){_0x1d4683[_0x7439('0x5e')]=_0x11b9bf;return _0x1d4683;})['then'](respondWithFilteredResult(_0x248864,_0x271da9))[_0x7439('0x2e')](handleError(_0x248864,null));};exports[_0x7439('0x5f')]=function(_0x1f506a,_0x14988d){var _0x64002b={'raw':![],'where':{'id':_0x1f506a[_0x7439('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x7439('0x61')},{'model':db[_0x7439('0x62')],'as':_0x7439('0x42')},{'model':db[_0x7439('0x43')],'as':_0x7439('0x44')}]},_0x340161={};_0x340161['model']=_[_0x7439('0x4b')](db[_0x7439('0x45')][_0x7439('0x63')]);_0x340161['query']=_[_0x7439('0x4b')](_0x1f506a[_0x7439('0x4a')]);_0x340161[_0x7439('0x4c')]=_[_0x7439('0x4d')](_0x340161[_0x7439('0x47')],_0x340161[_0x7439('0x4a')]);_0x64002b[_0x7439('0x4f')]=_[_0x7439('0x4d')](_0x340161['model'],qs[_0x7439('0x4e')](_0x1f506a[_0x7439('0x4a')][_0x7439('0x4e')]));_0x64002b['attributes']=_0x64002b[_0x7439('0x4f')][_0x7439('0x50')]?_0x64002b[_0x7439('0x4f')]:_0x340161['model'];if(_0x1f506a[_0x7439('0x4a')]['includeAll']){_0x64002b[_0x7439('0x64')]=[{'all':!![]}];}_0x64002b=_[_0x7439('0x5a')]({},_0x64002b,_0x1f506a[_0x7439('0x5b')]);return db[_0x7439('0x45')][_0x7439('0x65')](_0x64002b)[_0x7439('0x3a')](handleEntityNotFound(_0x14988d,null))['then'](respondWithResult(_0x14988d,null))[_0x7439('0x2e')](handleError(_0x14988d,null));};exports[_0x7439('0x39')]=function(_0x5408c7,_0x3a19e2){if(_0x5408c7[_0x7439('0x66')]['id']){delete _0x5408c7[_0x7439('0x66')]['id'];}return db['MailAccount'][_0x7439('0x65')]({'where':{'id':_0x5408c7['params']['id']},'include':[{'model':db[_0x7439('0x41')],'as':_0x7439('0x61')},{'model':db['MailServerOut'],'as':_0x7439('0x42')},{'model':db[_0x7439('0x43')],'as':'mandatoryDispositionPause'}]})[_0x7439('0x3a')](handleEntityNotFound(_0x3a19e2,null))[_0x7439('0x3a')](saveUpdates(_0x5408c7[_0x7439('0x66')],null))['then'](function(_0x11c99c){if(_0x11c99c&&_0x5408c7[_0x7439('0x66')][_0x7439('0x61')]){return db[_0x7439('0x41')]['update'](_0x5408c7['body']['Imap'],{'where':{'MailAccountId':_0x11c99c['id']}})[_0x7439('0x3a')](function(){return _0x11c99c;});}return _0x11c99c;})[_0x7439('0x3a')](function(_0x3b238c){if(_0x3b238c&&_0x5408c7['body'][_0x7439('0x42')]){return db['MailServerOut'][_0x7439('0x39')](_0x5408c7[_0x7439('0x66')][_0x7439('0x42')],{'where':{'MailAccountId':_0x3b238c['id']}})[_0x7439('0x3a')](function(){return _0x3b238c;});}return _0x3b238c;})['then'](respondWithResult(_0x3a19e2,null))['catch'](handleError(_0x3a19e2,null));};exports[_0x7439('0x67')]=function(_0xca864a,_0x33b5e0){return db[_0x7439('0x45')][_0x7439('0x67')]()[_0x7439('0x3a')](respondWithResult(_0x33b5e0,null))[_0x7439('0x2e')](handleError(_0x33b5e0,null));};exports[_0x7439('0x68')]=function(_0xc83d3c,_0x3714f3,_0x1f8176){if(_0xc83d3c['body']['id']){delete _0xc83d3c[_0x7439('0x66')]['id'];}return db[_0x7439('0x45')][_0x7439('0x65')]({'where':{'id':_0xc83d3c[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x3714f3,null))[_0x7439('0x3a')](function(_0x3f0218){if(_0x3f0218){_0xc83d3c[_0x7439('0x66')][_0x7439('0x69')]=_0x3f0218['id'];return db[_0x7439('0x6a')][_0x7439('0x6b')](_0xc83d3c[_0x7439('0x66')]);}})[_0x7439('0x3a')](respondWithResult(_0x3714f3,null))[_0x7439('0x2e')](handleError(_0x3714f3,null));};exports[_0x7439('0x6c')]=function(_0x23522e,_0x1c03c3,_0xe2889f){var _0x5ad8f4={'raw':![],'where':{}};var _0x377001={};var _0x385a9f={'count':0x0,'rows':[]};return db[_0x7439('0x45')][_0x7439('0x6d')]({'where':{'id':_0x23522e[_0x7439('0x60')]['id']}})['then'](handleEntityNotFound(_0x1c03c3,null))[_0x7439('0x3a')](function(_0x6c4eac){if(_0x6c4eac){_0x377001[_0x7439('0x47')]=_[_0x7439('0x4b')](db['Disposition']['rawAttributes']);_0x377001['query']=_[_0x7439('0x4b')](_0x23522e[_0x7439('0x4a')]);_0x377001[_0x7439('0x4c')]=_['intersection'](_0x377001[_0x7439('0x47')],_0x377001[_0x7439('0x4a')]);_0x5ad8f4[_0x7439('0x4f')]=_[_0x7439('0x4d')](_0x377001['model'],qs[_0x7439('0x4e')](_0x23522e[_0x7439('0x4a')][_0x7439('0x4e')]));_0x5ad8f4['attributes']=_0x5ad8f4[_0x7439('0x4f')][_0x7439('0x50')]?_0x5ad8f4[_0x7439('0x4f')]:_0x377001[_0x7439('0x47')];if(!_0x23522e[_0x7439('0x4a')]['hasOwnProperty']('nolimit')){_0x5ad8f4[_0x7439('0x34')]=qs[_0x7439('0x34')](_0x23522e[_0x7439('0x4a')][_0x7439('0x34')]);_0x5ad8f4[_0x7439('0x32')]=qs['offset'](_0x23522e['query']['offset']);}_0x5ad8f4[_0x7439('0x53')]=qs[_0x7439('0x54')](_0x23522e[_0x7439('0x4a')]['sort']);_0x5ad8f4[_0x7439('0x57')]=qs[_0x7439('0x4c')](_[_0x7439('0x55')](_0x23522e['query'],_0x377001[_0x7439('0x4c')]));_0x5ad8f4[_0x7439('0x57')][_0x7439('0x69')]=_0x6c4eac['id'];if(_0x23522e[_0x7439('0x4a')][_0x7439('0x56')]){_0x5ad8f4['where']=_['merge'](_0x5ad8f4['where'],{'$or':_[_0x7439('0x48')](_0x5ad8f4[_0x7439('0x4f')],function(_0x2293ca){var _0x5ddaf1={};_0x5ddaf1[_0x2293ca]={'$like':'%'+_0x23522e[_0x7439('0x4a')][_0x7439('0x56')]+'%'};return _0x5ddaf1;})});}_0x5ad8f4=_[_0x7439('0x5a')]({},_0x5ad8f4,_0x23522e['options']);return db[_0x7439('0x6a')][_0x7439('0x35')]({'where':_0x5ad8f4[_0x7439('0x57')]})[_0x7439('0x3a')](function(_0x12eba1){_0x385a9f[_0x7439('0x35')]=_0x12eba1;if(_0x23522e['query']['includeAll']){_0x5ad8f4[_0x7439('0x64')]=[{'all':!![]}];}return db[_0x7439('0x6a')][_0x7439('0x5d')](_0x5ad8f4);})[_0x7439('0x3a')](function(_0x125e51){_0x385a9f[_0x7439('0x5e')]=_0x125e51;return _0x385a9f;});}})[_0x7439('0x3a')](respondWithFilteredResult(_0x1c03c3,_0x5ad8f4))[_0x7439('0x2e')](handleError(_0x1c03c3,null));};exports['removeDispositions']=function(_0x528c94,_0x21df29,_0x26f658){return db['MailAccount'][_0x7439('0x65')]({'where':{'id':_0x528c94[_0x7439('0x60')]['id']}})['then'](handleEntityNotFound(_0x21df29,null))['then'](function(_0x28da3c){if(_0x28da3c){return _0x28da3c[_0x7439('0x6e')](_0x528c94[_0x7439('0x4a')][_0x7439('0x6f')]);}})[_0x7439('0x3a')](respondWithStatusCode(_0x21df29,null))[_0x7439('0x2e')](handleError(_0x21df29,null));};exports[_0x7439('0x70')]=function(_0x3cda78,_0x3e9d85,_0x16c395){if(_0x3cda78[_0x7439('0x66')]['id']){delete _0x3cda78['body']['id'];}return db[_0x7439('0x45')][_0x7439('0x65')]({'where':{'id':_0x3cda78['params']['id']}})['then'](handleEntityNotFound(_0x3e9d85,null))[_0x7439('0x3a')](function(_0x264a29){if(_0x264a29){_0x3cda78[_0x7439('0x66')][_0x7439('0x69')]=_0x264a29['id'];return db['CannedAnswer'][_0x7439('0x6b')](_0x3cda78[_0x7439('0x66')]);}})['then'](respondWithResult(_0x3e9d85,null))[_0x7439('0x2e')](handleError(_0x3e9d85,null));};exports['getAnswers']=function(_0xc235c2,_0x2c27bf,_0x1a319a){var _0x244f2a={'raw':![],'where':{}};var _0x526a88={};var _0x48eb13={'count':0x0,'rows':[]};return db[_0x7439('0x45')][_0x7439('0x6d')]({'where':{'id':_0xc235c2['params']['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x2c27bf,null))[_0x7439('0x3a')](function(_0x10a8ea){if(_0x10a8ea){_0x526a88[_0x7439('0x47')]=_[_0x7439('0x4b')](db[_0x7439('0x71')][_0x7439('0x63')]);_0x526a88['query']=_[_0x7439('0x4b')](_0xc235c2['query']);_0x526a88['filters']=_[_0x7439('0x4d')](_0x526a88[_0x7439('0x47')],_0x526a88[_0x7439('0x4a')]);_0x244f2a[_0x7439('0x4f')]=_[_0x7439('0x4d')](_0x526a88['model'],qs[_0x7439('0x4e')](_0xc235c2[_0x7439('0x4a')]['fields']));_0x244f2a[_0x7439('0x4f')]=_0x244f2a['attributes'][_0x7439('0x50')]?_0x244f2a['attributes']:_0x526a88['model'];if(!_0xc235c2[_0x7439('0x4a')][_0x7439('0x51')]('nolimit')){_0x244f2a[_0x7439('0x34')]=qs[_0x7439('0x34')](_0xc235c2['query'][_0x7439('0x34')]);_0x244f2a[_0x7439('0x32')]=qs[_0x7439('0x32')](_0xc235c2['query'][_0x7439('0x32')]);}_0x244f2a[_0x7439('0x53')]=qs[_0x7439('0x54')](_0xc235c2[_0x7439('0x4a')][_0x7439('0x54')]);_0x244f2a['where']=qs[_0x7439('0x4c')](_['pick'](_0xc235c2[_0x7439('0x4a')],_0x526a88[_0x7439('0x4c')]));_0x244f2a[_0x7439('0x57')][_0x7439('0x69')]=_0x10a8ea['id'];if(_0xc235c2[_0x7439('0x4a')][_0x7439('0x56')]){_0x244f2a[_0x7439('0x57')]=_[_0x7439('0x5a')](_0x244f2a[_0x7439('0x57')],{'$or':_[_0x7439('0x48')](_0x244f2a[_0x7439('0x4f')],function(_0x3cf74b){var _0x34ed50={};_0x34ed50[_0x3cf74b]={'$like':'%'+_0xc235c2[_0x7439('0x4a')]['filter']+'%'};return _0x34ed50;})});}_0x244f2a=_[_0x7439('0x5a')]({},_0x244f2a,_0xc235c2[_0x7439('0x5b')]);return db[_0x7439('0x71')][_0x7439('0x35')]({'where':_0x244f2a['where']})[_0x7439('0x3a')](function(_0x2b79f0){_0x48eb13[_0x7439('0x35')]=_0x2b79f0;if(_0xc235c2[_0x7439('0x4a')][_0x7439('0x5c')]){_0x244f2a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x7439('0x5d')](_0x244f2a);})[_0x7439('0x3a')](function(_0xdeb04d){_0x48eb13[_0x7439('0x5e')]=_0xdeb04d;return _0x48eb13;});}})[_0x7439('0x3a')](respondWithFilteredResult(_0x2c27bf,_0x244f2a))[_0x7439('0x2e')](handleError(_0x2c27bf,null));};exports['removeAnswers']=function(_0x9eb49f,_0x249892,_0x500d0e){return db[_0x7439('0x45')][_0x7439('0x65')]({'where':{'id':_0x9eb49f[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x249892,null))[_0x7439('0x3a')](function(_0x5e0367){if(_0x5e0367){return _0x5e0367[_0x7439('0x72')](_0x9eb49f[_0x7439('0x4a')][_0x7439('0x6f')]);}})['then'](respondWithStatusCode(_0x249892,null))['catch'](handleError(_0x249892,null));};exports[_0x7439('0x6b')]=function(_0x1b6add,_0x4fff03){var _0x537eed={'name':_0x1b6add[_0x7439('0x66')][_0x7439('0x49')],'key':_0x1b6add[_0x7439('0x66')][_0x7439('0x46')],'email':_0x1b6add['body']['email'],'ListId':_0x1b6add[_0x7439('0x66')][_0x7439('0x73')],'active':!_['isNil'](_0x1b6add[_0x7439('0x66')][_0x7439('0x74')])?_0x1b6add['body'][_0x7439('0x74')]:!![],'description':_0x1b6add['body'][_0x7439('0x75')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x1b6add[_0x7439('0x66')]['cservice'])){if(_0x1b6add[_0x7439('0x66')][_0x7439('0x76')]){_0x537eed[_0x7439('0x61')]['user']=_0x537eed['Smtp'][_0x7439('0x77')]=_0x1b6add[_0x7439('0x66')]['cuser'];_0x537eed['Imap']['password']=_0x537eed[_0x7439('0x42')]['pass']=_0x1b6add[_0x7439('0x66')]['cpassword'];}else{_0x537eed[_0x7439('0x61')][_0x7439('0x78')]=_0x537eed[_0x7439('0x42')][_0x7439('0x78')]=![];}_0x537eed[_0x7439('0x61')][_0x7439('0x79')]=_0x1b6add[_0x7439('0x66')][_0x7439('0x61')][_0x7439('0x79')];_0x537eed[_0x7439('0x61')]['port']=_0x1b6add[_0x7439('0x66')][_0x7439('0x61')][_0x7439('0x7a')];_0x537eed['Smtp'][_0x7439('0x79')]=_0x1b6add[_0x7439('0x66')][_0x7439('0x42')][_0x7439('0x79')];_0x537eed[_0x7439('0x42')]['port']=_0x1b6add[_0x7439('0x66')]['Smtp'][_0x7439('0x7a')];}else{_0x537eed[_0x7439('0x61')][_0x7439('0x7b')]=_0x537eed[_0x7439('0x42')][_0x7439('0x7b')]=_0x1b6add[_0x7439('0x66')]['cservice'];_0x537eed['Imap'][_0x7439('0x77')]=_0x537eed[_0x7439('0x42')][_0x7439('0x77')]=_0x1b6add['body'][_0x7439('0x7c')];_0x537eed[_0x7439('0x61')][_0x7439('0x7d')]=_0x537eed[_0x7439('0x42')][_0x7439('0x7e')]=_0x1b6add[_0x7439('0x66')][_0x7439('0x7f')];}return db['MailAccount'][_0x7439('0x6b')](_0x537eed,{'include':[{'model':db['MailServerOut'],'as':_0x7439('0x42')},{'model':db[_0x7439('0x41')],'as':_0x7439('0x61')}]})[_0x7439('0x3a')](function(_0x10656c){var _0x2bae60=_0x1b6add[_0x7439('0x77')][_0x7439('0x3b')]({'plain':!![]});if(!_0x2bae60)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bae60[_0x7439('0x80')]===_0x7439('0x77')){var _0x352752=_0x10656c[_0x7439('0x3b')]({'plain':!![]});return db['UserProfileSection'][_0x7439('0x65')]({'where':{'name':_0x7439('0x3c'),'userProfileId':_0x2bae60[_0x7439('0x81')]},'raw':!![]})[_0x7439('0x3a')](function(_0x3a2863){if(_0x3a2863&&_0x3a2863['autoAssociation']===0x0){return db[_0x7439('0x3d')]['create']({'name':_0x352752['name'],'resourceId':_0x352752['id'],'type':_0x3a2863[_0x7439('0x49')],'sectionId':_0x3a2863['id']},{})['then'](function(){return _0x10656c;});}else{return _0x10656c;}})[_0x7439('0x2e')](function(_0x5e7aae){logger[_0x7439('0x2a')](_0x7439('0x82'),_0x5e7aae);throw _0x5e7aae;});}return _0x10656c;})[_0x7439('0x3a')](respondWithResult(_0x4fff03,0xc9))[_0x7439('0x2e')](handleError(_0x4fff03,null));};exports[_0x7439('0x83')]=function(_0x35d415,_0x3096ca,_0x54148c){return db[_0x7439('0x45')][_0x7439('0x6d')]({'where':{'id':_0x35d415[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x3096ca,null))['then'](function(_0x4b2164){if(_0x4b2164){return _0x4b2164[_0x7439('0x83')]();}return null;})[_0x7439('0x3a')](respondWithResult(_0x3096ca,null))[_0x7439('0x2e')](handleError(_0x3096ca,null));};exports[_0x7439('0x84')]=function(_0x35a6e7,_0x49564b,_0x7d3173){if(_0x35a6e7[_0x7439('0x66')]['id']){delete _0x35a6e7['body']['id'];}return db['MailAccount'][_0x7439('0x65')]({'where':{'id':_0x35a6e7[_0x7439('0x60')]['id']}})['then'](handleEntityNotFound(_0x49564b,null))[_0x7439('0x3a')](function(_0x56349f){if(_0x56349f){_0x35a6e7[_0x7439('0x66')][_0x7439('0x69')]=_0x56349f['id'];return db['MailServerIn'][_0x7439('0x6b')](_0x35a6e7['body']);}})[_0x7439('0x3a')](respondWithResult(_0x49564b,null))[_0x7439('0x2e')](handleError(_0x49564b,null));};exports['removeImap']=function(_0x20920b,_0xae79b4,_0x2cebb0){return db['MailAccount']['findOne']({'where':{'id':_0x20920b[_0x7439('0x60')]['id']}})['then'](handleEntityNotFound(_0xae79b4,null))[_0x7439('0x3a')](function(_0x255b49){if(_0x255b49){return _0x255b49[_0x7439('0x85')](null);}return null;})[_0x7439('0x3a')](respondWithStatusCode(_0xae79b4,null))['catch'](handleError(_0xae79b4,null));};exports[_0x7439('0x86')]=function(_0x37363a,_0x5b904a,_0xb1b424){return db[_0x7439('0x45')][_0x7439('0x6d')]({'where':{'id':_0x37363a[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x5b904a,null))[_0x7439('0x3a')](function(_0x1ef91e){if(_0x1ef91e){return _0x1ef91e[_0x7439('0x86')]();}return null;})[_0x7439('0x3a')](respondWithResult(_0x5b904a,null))['catch'](handleError(_0x5b904a,null));};exports[_0x7439('0x87')]=function(_0x64e0c4,_0x33b4f4,_0x41ee26){if(_0x64e0c4[_0x7439('0x66')]['id']){delete _0x64e0c4[_0x7439('0x66')]['id'];}return db[_0x7439('0x45')][_0x7439('0x65')]({'where':{'id':_0x64e0c4[_0x7439('0x60')]['id']}})['then'](handleEntityNotFound(_0x33b4f4,null))['then'](function(_0x50c3b9){if(_0x50c3b9){_0x64e0c4[_0x7439('0x66')][_0x7439('0x69')]=_0x50c3b9['id'];return db['MailServerOut'][_0x7439('0x6b')](_0x64e0c4['body']);}})['then'](respondWithResult(_0x33b4f4,null))['catch'](handleError(_0x33b4f4,null));};exports[_0x7439('0x88')]=function(_0x44c24d,_0x20ebd8,_0x496560){return db['MailAccount']['findOne']({'where':{'id':_0x44c24d[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x20ebd8,null))[_0x7439('0x3a')](function(_0x76bf11){if(_0x76bf11){return _0x76bf11[_0x7439('0x89')](null);}return null;})[_0x7439('0x3a')](respondWithStatusCode(_0x20ebd8,null))['catch'](handleError(_0x20ebd8,null));};exports['addInteraction']=function(_0x498133,_0x4a1b40,_0x2520ce){return db[_0x7439('0x8a')][_0x7439('0x65')]({'where':{'id':_0x498133[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x4a1b40,null))[_0x7439('0x3a')](function(_0x4494d1){if(_0x4494d1){return _0x4494d1[_0x7439('0x8b')](_0x498133[_0x7439('0x66')][_0x7439('0x6f')],_['omit'](_0x498133[_0x7439('0x66')],['ids','id'])||{});}})['then'](respondWithResult(_0x4a1b40,null))[_0x7439('0x2e')](handleError(_0x4a1b40,null));};exports[_0x7439('0x8c')]=function(_0x15d7e9,_0x30666f,_0x1d0040){var _0x5ba56f={'raw':![],'where':{}};var _0x30c39c={};var _0x45ae62={'count':0x0,'rows':[]};return db[_0x7439('0x45')]['findOne']({'where':{'id':_0x15d7e9[_0x7439('0x60')]['id']}})['then'](handleEntityNotFound(_0x30666f,null))[_0x7439('0x3a')](function(_0x12d764){if(_0x12d764){_0x30c39c[_0x7439('0x47')]=_[_0x7439('0x4b')](db['MailInteraction'][_0x7439('0x63')]);_0x30c39c[_0x7439('0x4a')]=_[_0x7439('0x4b')](_0x15d7e9[_0x7439('0x4a')]);_0x30c39c[_0x7439('0x4c')]=_[_0x7439('0x4d')](_0x30c39c[_0x7439('0x47')],_0x30c39c[_0x7439('0x4a')]);_0x5ba56f[_0x7439('0x4f')]=_[_0x7439('0x4d')](_0x30c39c[_0x7439('0x47')],qs[_0x7439('0x4e')](_0x15d7e9[_0x7439('0x4a')][_0x7439('0x4e')]));_0x5ba56f[_0x7439('0x4f')]=_0x5ba56f[_0x7439('0x4f')][_0x7439('0x50')]?_0x5ba56f[_0x7439('0x4f')]:_0x30c39c[_0x7439('0x47')];if(!_0x15d7e9['query'][_0x7439('0x51')](_0x7439('0x52'))){_0x5ba56f[_0x7439('0x34')]=qs[_0x7439('0x34')](_0x15d7e9[_0x7439('0x4a')][_0x7439('0x34')]);_0x5ba56f[_0x7439('0x32')]=qs[_0x7439('0x32')](_0x15d7e9[_0x7439('0x4a')][_0x7439('0x32')]);}_0x5ba56f[_0x7439('0x53')]=qs[_0x7439('0x54')](_0x15d7e9[_0x7439('0x4a')][_0x7439('0x54')]);_0x5ba56f[_0x7439('0x57')]=qs[_0x7439('0x4c')](_['pick'](_0x15d7e9['query'],_0x30c39c[_0x7439('0x4c')]));_0x5ba56f['where'][_0x7439('0x69')]=_0x12d764['id'];if(_0x15d7e9['query'][_0x7439('0x56')]){_0x5ba56f[_0x7439('0x57')]=_[_0x7439('0x5a')](_0x5ba56f[_0x7439('0x57')],{'$or':_[_0x7439('0x48')](_0x5ba56f['attributes'],function(_0xf27d11){var _0x3262af={};_0x3262af[_0xf27d11]={'$like':'%'+_0x15d7e9[_0x7439('0x4a')]['filter']+'%'};return _0x3262af;})});}_0x5ba56f=_[_0x7439('0x5a')]({},_0x5ba56f,_0x15d7e9[_0x7439('0x5b')]);return db[_0x7439('0x8a')][_0x7439('0x35')]({'where':_0x5ba56f['where']})[_0x7439('0x3a')](function(_0x47909f){_0x45ae62['count']=_0x47909f;if(_0x15d7e9[_0x7439('0x4a')]['includeAll']){_0x5ba56f[_0x7439('0x64')]=[{'model':db[_0x7439('0x8d')],'as':_0x7439('0x8e'),'required':![]},{'model':db[_0x7439('0x8f')],'as':'Owner','attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x7439('0x90')],'as':_0x7439('0x91'),'attributes':['id',_0x7439('0x49'),_0x7439('0x92')],'where':_0x15d7e9['query']['tag']?{'id':_0x15d7e9['query']['tag']}:undefined,'required':_0x15d7e9[_0x7439('0x4a')][_0x7439('0x93')]?!![]:![]}];}return db['MailInteraction'][_0x7439('0x5d')](_0x5ba56f);})['then'](function(_0xe02518){_0x45ae62[_0x7439('0x5e')]=_0xe02518;return _0x45ae62;});}})[_0x7439('0x3a')](respondWithFilteredResult(_0x30666f,_0x5ba56f))['catch'](handleError(_0x30666f,null));};exports[_0x7439('0x94')]=function(_0x54f451,_0x4d2e99,_0x6c1fe8){return db[_0x7439('0x45')][_0x7439('0x6d')]({'where':{'id':_0x54f451[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x4d2e99,null))['then'](function(_0x991b5e){if(_0x991b5e){return db[_0x7439('0x95')]['transaction'](function(_0x174b85){return db['MailApplication'][_0x7439('0x96')]({'where':{'MailAccountId':_0x54f451[_0x7439('0x60')]['id']},'transaction':_0x174b85})[_0x7439('0x3a')](function(_0x5a08d3){var _0x2b4d3f=_[_0x7439('0x48')](_0x54f451[_0x7439('0x66')],function(_0x2b5d29){_0x2b5d29[_0x7439('0x69')]=_0x54f451[_0x7439('0x60')]['id'];return _0x2b5d29;});return db['MailApplication'][_0x7439('0x97')](_0x2b4d3f,{'transaction':_0x174b85});});})[_0x7439('0x3a')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x54f451[_0x7439('0x60')]['id']},'order':'priority'});});}})[_0x7439('0x3a')](respondWithResult(_0x4d2e99,null))[_0x7439('0x2e')](handleError(_0x4d2e99,null));};exports[_0x7439('0x98')]=function(_0x2da4f7,_0x31fcf7,_0x5adb72){var _0x169a95={};var _0x3b43ba={};var _0x449eb7;var _0x1a0ac2;return db[_0x7439('0x45')][_0x7439('0x6d')]({'where':{'id':_0x2da4f7[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x31fcf7,null))[_0x7439('0x3a')](function(_0x868ac2){if(_0x868ac2){_0x449eb7=_0x868ac2;_0x3b43ba['model']=_[_0x7439('0x4b')](db['MailApplication']['rawAttributes']);_0x3b43ba[_0x7439('0x4a')]=_[_0x7439('0x4b')](_0x2da4f7[_0x7439('0x4a')]);_0x3b43ba[_0x7439('0x4c')]=_[_0x7439('0x4d')](_0x3b43ba['model'],_0x3b43ba[_0x7439('0x4a')]);_0x169a95['attributes']=_[_0x7439('0x4d')](_0x3b43ba[_0x7439('0x47')],qs[_0x7439('0x4e')](_0x2da4f7[_0x7439('0x4a')][_0x7439('0x4e')]));_0x169a95['attributes']=_0x169a95['attributes'][_0x7439('0x50')]?_0x169a95['attributes']:_0x3b43ba['model'];_0x169a95[_0x7439('0x53')]=qs[_0x7439('0x54')](_0x2da4f7[_0x7439('0x4a')]['sort']);_0x169a95[_0x7439('0x57')]=qs[_0x7439('0x4c')](_[_0x7439('0x55')](_0x2da4f7[_0x7439('0x4a')],_0x3b43ba[_0x7439('0x4c')]));if(_0x2da4f7[_0x7439('0x4a')][_0x7439('0x56')]){_0x169a95['where']=_['merge'](_0x169a95[_0x7439('0x57')],{'$or':_[_0x7439('0x48')](_0x169a95['attributes'],function(_0x3ab26e){var _0x558a3d={};_0x558a3d[_0x3ab26e]={'$like':'%'+_0x2da4f7['query']['filter']+'%'};return _0x558a3d;})});}_0x169a95=_['merge']({},_0x169a95,_0x2da4f7[_0x7439('0x5b')]);return _0x449eb7['getApplications'](_0x169a95);}})[_0x7439('0x3a')](function(_0x558e64){if(_0x558e64){_0x1a0ac2=_0x558e64[_0x7439('0x50')];if(!_0x2da4f7[_0x7439('0x4a')][_0x7439('0x51')](_0x7439('0x52'))){_0x169a95[_0x7439('0x34')]=qs[_0x7439('0x34')](_0x2da4f7['query'][_0x7439('0x34')]);_0x169a95[_0x7439('0x32')]=qs[_0x7439('0x32')](_0x2da4f7[_0x7439('0x4a')]['offset']);}return _0x449eb7[_0x7439('0x98')](_0x169a95);}})['then'](function(_0x12a10f){if(_0x12a10f){return _0x12a10f?{'count':_0x1a0ac2,'rows':_0x12a10f}:null;}})[_0x7439('0x3a')](respondWithResult(_0x31fcf7,null))[_0x7439('0x2e')](handleError(_0x31fcf7,null));};exports['getMessages']=function(_0x25bedd,_0x4c1e7c,_0x1e6f0a){var _0x3ff174={'raw':!![],'where':{}};var _0x5827d0={};var _0x170e95={'count':0x0,'rows':[]};return db['MailAccount'][_0x7439('0x6d')]({'where':{'id':_0x25bedd['params']['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x4c1e7c,null))['then'](function(_0x380c19){if(_0x380c19){_0x5827d0[_0x7439('0x47')]=_['keys'](db[_0x7439('0x99')][_0x7439('0x63')]);_0x5827d0[_0x7439('0x4a')]=_[_0x7439('0x4b')](_0x25bedd[_0x7439('0x4a')]);_0x5827d0['filters']=_[_0x7439('0x4d')](_0x5827d0[_0x7439('0x47')],_0x5827d0[_0x7439('0x4a')]);_0x3ff174['attributes']=_['intersection'](_0x5827d0[_0x7439('0x47')],qs['fields'](_0x25bedd[_0x7439('0x4a')][_0x7439('0x4e')]));_0x3ff174[_0x7439('0x4f')]=_0x3ff174[_0x7439('0x4f')][_0x7439('0x50')]?_0x3ff174[_0x7439('0x4f')]:_0x5827d0[_0x7439('0x47')];if(!_0x25bedd[_0x7439('0x4a')][_0x7439('0x51')](_0x7439('0x52'))){_0x3ff174[_0x7439('0x34')]=qs[_0x7439('0x34')](_0x25bedd[_0x7439('0x4a')][_0x7439('0x34')]);_0x3ff174[_0x7439('0x32')]=qs[_0x7439('0x32')](_0x25bedd['query'][_0x7439('0x32')]);}_0x3ff174[_0x7439('0x53')]=qs[_0x7439('0x54')](_0x25bedd['query'][_0x7439('0x54')]);_0x3ff174[_0x7439('0x57')]=qs[_0x7439('0x4c')](_[_0x7439('0x55')](_0x25bedd[_0x7439('0x4a')],_0x5827d0['filters']));_0x3ff174[_0x7439('0x57')][_0x7439('0x69')]=_0x380c19['id'];if(_0x25bedd['query'][_0x7439('0x56')]){_0x3ff174[_0x7439('0x57')]=_['merge'](_0x3ff174[_0x7439('0x57')],{'$or':_[_0x7439('0x48')](_0x3ff174[_0x7439('0x4f')],function(_0x438f36){var _0x1e7cb5={};_0x1e7cb5[_0x438f36]={'$like':'%'+_0x25bedd[_0x7439('0x4a')][_0x7439('0x56')]+'%'};return _0x1e7cb5;})});}if(_0x25bedd['query']['$gte']){var _0xaf3f40=_0x25bedd['query'][_0x7439('0x9a')][_0x7439('0x9b')](',');var _0x16ee5e={};_0x16ee5e[_0xaf3f40[0x0]]={'$gte':moment(_0xaf3f40[0x1])[_0x7439('0x9c')](_0x7439('0x9d'))};_0x3ff174['where']=_['merge'](_0x3ff174[_0x7439('0x57')],_0x16ee5e);}_0x3ff174=_[_0x7439('0x5a')]({},_0x3ff174,_0x25bedd['options']);return db[_0x7439('0x99')][_0x7439('0x35')]({'where':_0x3ff174['where']})[_0x7439('0x3a')](function(_0xe3554d){_0x170e95['count']=_0xe3554d;if(_0x25bedd[_0x7439('0x4a')][_0x7439('0x5c')]){_0x3ff174[_0x7439('0x64')]=[{'all':!![]}];}return db[_0x7439('0x99')][_0x7439('0x5d')](_0x3ff174);})[_0x7439('0x3a')](function(_0x4ddc76){if(_0x25bedd['query'][_0x7439('0x9e')]==='true'){for(var _0x16af4b=0x0;_0x16af4b<_0x4ddc76['length'];_0x16af4b++){_0x4ddc76[_0x16af4b][_0x7439('0x66')]=juice(_0x4ddc76[_0x16af4b][_0x7439('0x66')]);}}_0x170e95[_0x7439('0x5e')]=_0x4ddc76;return _0x170e95;});}})[_0x7439('0x3a')](respondWithFilteredResult(_0x4c1e7c,_0x3ff174))[_0x7439('0x2e')](handleError(_0x4c1e7c,null));};exports[_0x7439('0x9f')]=function(_0x3ec2bd,_0x56fd99,_0x1bf53b){var _0x472b32,_0x567a21={},_0x3e6c12;if(_0x3ec2bd[_0x7439('0x66')]['to']){_0x3e6c12=_0x3ec2bd[_0x7439('0x66')]['to'][_0x7439('0x9b')](',')[0x0];}return db['MailAccount'][_0x7439('0x65')]({'where':{'id':_0x3ec2bd[_0x7439('0x60')]['id']},'include':[{'model':db[_0x7439('0xa0')],'as':'List','include':[{'model':db[_0x7439('0x8d')],'as':_0x7439('0xa1'),'where':{'email':_0x3e6c12},'limit':0x1,'order':[[_0x7439('0xa2'),_0x7439('0xa3')]]}]},{'model':db[_0x7439('0x62')],'as':_0x7439('0x42'),'raw':!![]}]})[_0x7439('0x3a')](handleEntityNotFound(_0x56fd99,null))[_0x7439('0x3a')](function(_0x23113e){if(_0x23113e){_0x472b32=_0x23113e;if(_0x23113e[_0x7439('0x42')]){if(_['isNil'](_0x3ec2bd[_0x7439('0x66')]['from'])){_0x3ec2bd[_0x7439('0x66')][_0x7439('0xa4')]=util[_0x7439('0x9c')](_0x7439('0xa5'),_0x23113e['name'],_0x23113e[_0x7439('0xa6')]||_0x23113e['Smtp'][_0x7439('0x77')]);}if(_0x3ec2bd[_0x7439('0x66')]['attachments']&&_0x3ec2bd[_0x7439('0x66')]['attachments'][_0x7439('0x50')]){for(var _0x2ef392=0x0;_0x2ef392<_0x3ec2bd[_0x7439('0x66')][_0x7439('0xa7')][_0x7439('0x50')];_0x2ef392+=0x1){_0x3ec2bd['body'][_0x7439('0xa7')][_0x2ef392]={'filename':_0x3ec2bd[_0x7439('0x66')][_0x7439('0xa7')][_0x2ef392][_0x7439('0x49')],'path':path[_0x7439('0xa8')](config['root'],_0x7439('0xa9'),_0x3ec2bd['body']['attachments'][_0x2ef392][_0x7439('0xaa')])};}}var _0x5c3067={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x23113e[_0x7439('0x42')][_0x7439('0x7b')])){if(_0x23113e[_0x7439('0x42')][_0x7439('0x78')]){_0x5c3067[_0x7439('0xab')]={'user':_0x23113e[_0x7439('0x42')][_0x7439('0x77')],'pass':_0x23113e[_0x7439('0x42')][_0x7439('0x7e')]};}_0x5c3067[_0x7439('0x79')]=_0x23113e[_0x7439('0x42')][_0x7439('0x79')];_0x5c3067[_0x7439('0x7a')]=_0x23113e['Smtp'][_0x7439('0x7a')];_0x5c3067[_0x7439('0xac')]=_0x23113e[_0x7439('0x42')][_0x7439('0xac')];}else{_0x5c3067['service']=_0x23113e['Smtp'][_0x7439('0x7b')];_0x5c3067[_0x7439('0xab')]={'user':_0x23113e[_0x7439('0x42')][_0x7439('0x77')],'pass':_0x23113e[_0x7439('0x42')][_0x7439('0x7e')]};}return respondWithRpcPromise(_0x7439('0xad'),_0x7439('0xae'),{'account':_0x5c3067,'message':_0x3ec2bd[_0x7439('0x66')]});}else{throw new Error(_0x7439('0xaf'));}}})['then'](function(_0x2809fc){if(_0x2809fc){_0x567a21=_0x2809fc;if(_0x472b32[_0x7439('0xb0')]){if(_0x472b32[_0x7439('0xb0')][_0x7439('0xa1')]['length']){return _0x472b32[_0x7439('0xb0')][_0x7439('0xa1')][0x0];}else{return db[_0x7439('0x8d')][_0x7439('0x6b')](_[_0x7439('0x20')](_0x3ec2bd['body'],{'firstName':_0x3ec2bd['body']['to'],'email':_0x3ec2bd[_0x7439('0x66')]['to'],'phone':_0x3ec2bd[_0x7439('0x66')]['to'],'ListId':_0x472b32[_0x7439('0x73')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x7439('0x3a')](function(_0x3e4774){if(_0x3e4774){var _0x572a2a={'UserId':_0x3ec2bd['user']['id'],'ContactId':_0x3e4774['id'],'MailAccountId':_0x472b32['id'],'inReplyTo':_0x567a21[_0x7439('0xb1')],'to':_0x3ec2bd[_0x7439('0x66')]['from'],'cc':_0x3ec2bd[_0x7439('0x66')]['cc'],'subject':_0x3ec2bd[_0x7439('0x66')][_0x7439('0xb2')],'attach':_0x3ec2bd[_0x7439('0x66')][_0x7439('0xb3')],'firstMsgDirection':_0x7439('0xb4'),'lastMsgAt':moment()['format'](_0x7439('0x9d')),'lastMsgDirection':_0x7439('0xb4'),'Messages':[_[_0x7439('0x5a')](_0x3ec2bd['body'],{'messageId':_0x567a21['messageId'],'sentAt':moment()[_0x7439('0x9c')](_0x7439('0x9d')),'read':!![],'MailAccountId':_0x472b32['id'],'UserId':_0x3ec2bd['user']['id'],'ContactId':_0x3e4774['id']})]};if(_0x3ec2bd[_0x7439('0x66')][_0x7439('0xb5')]){_0x572a2a=_[_0x7439('0x5a')](_0x572a2a,_0x3ec2bd[_0x7439('0x66')][_0x7439('0xb5')]);}return db['MailInteraction'][_0x7439('0x6b')](_0x572a2a,{'include':[{'model':db[_0x7439('0x99')],'as':'Messages'}]});}})['then'](respondWithResult(_0x56fd99,null))[_0x7439('0x2e')](handleError(_0x56fd99,null));};exports[_0x7439('0xb6')]=function(_0x98d6c1,_0xe99c60,_0x3ef8a4){return db[_0x7439('0x45')][_0x7439('0x65')]({'where':{'id':_0x98d6c1['params']['id']},'include':[{'model':db[_0x7439('0x62')],'as':_0x7439('0x42'),'raw':!![]}]})['then'](handleEntityNotFound(_0xe99c60,null))[_0x7439('0x3a')](function(_0x5c9200){if(_0x5c9200&&_0x5c9200[_0x7439('0x42')]){var _0x4c8289={'id':_0x5c9200['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5c9200[_0x7439('0x42')][_0x7439('0x7b')]){_0x4c8289[_0x7439('0x7b')]=_0x5c9200[_0x7439('0x42')][_0x7439('0x7b')];}else{_0x4c8289[_0x7439('0x79')]=_0x5c9200[_0x7439('0x42')][_0x7439('0x79')];_0x4c8289['port']=_0x5c9200[_0x7439('0x42')][_0x7439('0x7a')];_0x4c8289[_0x7439('0xac')]=_0x5c9200[_0x7439('0x42')]['secure'];}if(_0x5c9200[_0x7439('0x42')][_0x7439('0x78')]){_0x4c8289[_0x7439('0xab')]={'user':_0x5c9200[_0x7439('0x42')]['user'],'pass':_0x5c9200['Smtp'][_0x7439('0x7e')]};}return respondWithRpcPromise(_0x7439('0xb7'),_0x7439('0xb6'),{'account':_0x4c8289});}})['then'](respondWithResult(_0xe99c60,null))['catch'](handleError(_0xe99c60,null));};exports[_0x7439('0x96')]=function(_0x359cfa,_0x3dc368){return db[_0x7439('0x45')]['find']({'where':{'id':_0x359cfa[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x3dc368,null))['then'](function(_0x1a943a){if(_0x1a943a&&_0x1a943a[_0x7439('0x7b')]){throw new db[(_0x7439('0xb8'))][(_0x7439('0xb9'))](_0x7439('0xba'));}return _0x1a943a;})[_0x7439('0x3a')](removeEntity(_0x3dc368,null))[_0x7439('0x2e')](handleError(_0x3dc368,null));};exports[_0x7439('0xbb')]=function(_0x4eaaa1,_0x9c09f0,_0x44ee53){return db[_0x7439('0x45')][_0x7439('0x65')]({'where':{'id':_0x4eaaa1[_0x7439('0x60')]['id']}})['then'](handleEntityNotFound(_0x9c09f0,null))[_0x7439('0x3a')](function(_0x3a6734){if(_0x3a6734){return _0x3a6734[_0x7439('0xbb')](_0x4eaaa1[_0x7439('0x66')][_0x7439('0x6f')],_[_0x7439('0xbc')](_0x4eaaa1[_0x7439('0x66')],['ids','id'])||{})[_0x7439('0xbd')](function(_0x5cbb8d){for(var _0x4c8631=0x0;_0x4c8631<_0x4eaaa1[_0x7439('0x66')][_0x7439('0x6f')][_0x7439('0x50')];_0x4c8631+=0x1){socket[_0x7439('0xbe')]('userMailAccount:save',{'UserId':Number(_0x4eaaa1[_0x7439('0x66')][_0x7439('0x6f')][_0x4c8631]),'MailAccountId':Number(_0x4eaaa1[_0x7439('0x60')]['id'])});}return _0x5cbb8d;});}})['then'](respondWithResult(_0x9c09f0,null))['catch'](handleError(_0x9c09f0,null));};exports[_0x7439('0xbf')]=function(_0x34345f,_0x313b71,_0x55b09d){return db['MailAccount']['find']({'where':{'id':_0x34345f[_0x7439('0x60')]['id']}})[_0x7439('0x3a')](handleEntityNotFound(_0x313b71,null))[_0x7439('0x3a')](function(_0x271c5c){if(_0x271c5c){return _0x271c5c[_0x7439('0xbf')](_0x34345f[_0x7439('0x4a')][_0x7439('0x6f')])[_0x7439('0x3a')](function(){if(_['isArray'](_0x34345f[_0x7439('0x4a')]['ids'])){for(var _0x1abec5=0x0;_0x1abec5<_0x34345f[_0x7439('0x4a')]['ids']['length'];_0x1abec5+=0x1){socket[_0x7439('0xbe')](_0x7439('0xc0'),{'UserId':Number(_0x34345f[_0x7439('0x4a')][_0x7439('0x6f')][_0x1abec5]),'MailAccountId':Number(_0x34345f[_0x7439('0x60')]['id'])});}}else{socket['emit'](_0x7439('0xc0'),{'UserId':Number(_0x34345f['query'][_0x7439('0x6f')]),'MailAccountId':Number(_0x34345f[_0x7439('0x60')]['id'])});}});}})[_0x7439('0x3a')](respondWithStatusCode(_0x313b71,null))[_0x7439('0x2e')](handleError(_0x313b71,null));};exports['getAgents']=function(_0x38c6f5,_0x227894,_0x49d6d2){var _0x167fdb={};var _0x588565={};var _0x508a63;var _0x220e9d;return db[_0x7439('0x45')]['findOne']({'where':{'id':_0x38c6f5[_0x7439('0x60')]['id']}})['then'](handleEntityNotFound(_0x227894,null))[_0x7439('0x3a')](function(_0x359f17){if(_0x359f17){_0x508a63=_0x359f17;_0x588565[_0x7439('0x47')]=_[_0x7439('0x4b')](db[_0x7439('0x8f')][_0x7439('0x63')]);_0x588565['query']=_['keys'](_0x38c6f5[_0x7439('0x4a')]);_0x588565[_0x7439('0x4c')]=_['intersection'](_0x588565[_0x7439('0x47')],_0x588565['query']);_0x167fdb[_0x7439('0x4f')]=_[_0x7439('0x4d')](_0x588565[_0x7439('0x47')],qs[_0x7439('0x4e')](_0x38c6f5[_0x7439('0x4a')][_0x7439('0x4e')]));_0x167fdb['attributes']=_0x167fdb[_0x7439('0x4f')]['length']?_0x167fdb[_0x7439('0x4f')]:_0x588565[_0x7439('0x47')];_0x167fdb[_0x7439('0x53')]=qs['sort'](_0x38c6f5[_0x7439('0x4a')]['sort']);_0x167fdb['where']=qs[_0x7439('0x4c')](_[_0x7439('0x55')](_0x38c6f5['query'],_0x588565[_0x7439('0x4c')]));if(_0x38c6f5['query'][_0x7439('0x56')]){_0x167fdb[_0x7439('0x57')]=_['merge'](_0x167fdb[_0x7439('0x57')],{'$or':_[_0x7439('0x48')](_0x167fdb[_0x7439('0x4f')],function(_0x2ceec5){var _0x363e72={};_0x363e72[_0x2ceec5]={'$like':'%'+_0x38c6f5['query'][_0x7439('0x56')]+'%'};return _0x363e72;})});}_0x167fdb=_['merge']({},_0x167fdb,_0x38c6f5[_0x7439('0x5b')]);return _0x508a63[_0x7439('0xc1')](_0x167fdb);}})[_0x7439('0x3a')](function(_0x147f1d){if(_0x147f1d){_0x220e9d=_0x147f1d[_0x7439('0x50')];if(!_0x38c6f5[_0x7439('0x4a')][_0x7439('0x51')](_0x7439('0x52'))){_0x167fdb[_0x7439('0x34')]=qs[_0x7439('0x34')](_0x38c6f5[_0x7439('0x4a')][_0x7439('0x34')]);_0x167fdb[_0x7439('0x32')]=qs[_0x7439('0x32')](_0x38c6f5['query']['offset']);}return _0x508a63[_0x7439('0xc1')](_0x167fdb);}})[_0x7439('0x3a')](function(_0x40999a){if(_0x40999a){return _0x40999a?{'count':_0x220e9d,'rows':_0x40999a}:null;}})['then'](respondWithResult(_0x227894,null))[_0x7439('0x2e')](handleError(_0x227894,null));}; \ No newline at end of file +var _0x198a=['setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','MailMessage','inlineCss','true','CmList','List','CmContact','updatedAt','format','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','from','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','destroy','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','limit','count','offset','set','json','apply','reject','save','update','get','MailAccounts','stack','name','send','index','MailServerIn','Imap','Smtp','MailAccount','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','Pause','mandatoryDispositionPause','rawAttributes','includeAll','body','find','MailServerOut','describe','addDisposition','params','MailAccountId','create','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','getImap','addImap','removeImap'];(function(_0x45f07d,_0x113bc9){var _0x6337e=function(_0x28f93c){while(--_0x28f93c){_0x45f07d['push'](_0x45f07d['shift']());}};_0x6337e(++_0x113bc9);}(_0x198a,0x1d5));var _0xa198=function(_0x44cf2e,_0x438308){_0x44cf2e=_0x44cf2e-0x0;var _0x33da7c=_0x198a[_0x44cf2e];return _0x33da7c;};'use strict';var emlformat=require(_0xa198('0x0'));var rimraf=require(_0xa198('0x1'));var zipdir=require(_0xa198('0x2'));var jsonpatch=require(_0xa198('0x3'));var rp=require(_0xa198('0x4'));var moment=require('moment');var BPromise=require(_0xa198('0x5'));var Mustache=require(_0xa198('0x6'));var util=require(_0xa198('0x7'));var path=require(_0xa198('0x8'));var sox=require(_0xa198('0x9'));var csv=require(_0xa198('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa198('0xb'));var _=require(_0xa198('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa198('0xd'));var deskjs=require(_0xa198('0xe'));var toCsv=require(_0xa198('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require('html-to-text');var juice=require('juice');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa198('0xf'));var as=require(_0xa198('0x10'));var hardwareService=require(_0xa198('0x11'));var logger=require(_0xa198('0x12'))(_0xa198('0x13'));var utils=require('../../config/utils');var config=require(_0xa198('0x14'));var licenseUtil=require(_0xa198('0x15'));var db=require('../../mysqldb')['db'];config[_0xa198('0x16')]=_[_0xa198('0x17')](config[_0xa198('0x16')],{'host':_0xa198('0x18'),'port':0x18eb});var socket=require(_0xa198('0x19'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xa198('0x1a')](socket);var jayson=require(_0xa198('0x1b'));var client=jayson[_0xa198('0x1c')]['http']({'port':0x232b});function respondWithRpcPromise(_0x36d7e0,_0x50bdb6,_0x40b9d6,_0x393c13){return new BPromise(function(_0x55d6f3,_0x34ece5){var _0x5c05f9=_0x393c13||client;return _0x5c05f9[_0xa198('0x1d')](_0x36d7e0,_0x40b9d6)[_0xa198('0x1e')](function(_0x554208){logger[_0xa198('0x1f')](_0xa198('0x20'),_0x50bdb6,_0xa198('0x21'));logger[_0xa198('0x22')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x50bdb6,_0xa198('0x21'),JSON[_0xa198('0x23')](_0x554208));if(_0x554208['error']){if(_0x554208['error'][_0xa198('0x24')]===0x1f4){logger[_0xa198('0x25')]('MailAccount,\x20%s,\x20%s',_0x50bdb6,_0x554208[_0xa198('0x25')][_0xa198('0x26')]);return _0x34ece5(_0x554208['error'][_0xa198('0x26')]);}logger[_0xa198('0x25')](_0xa198('0x20'),_0x50bdb6,_0x554208[_0xa198('0x25')][_0xa198('0x26')]);return _0x55d6f3(_0x554208[_0xa198('0x25')][_0xa198('0x26')]);}else{logger[_0xa198('0x1f')](_0xa198('0x20'),_0x50bdb6,'request\x20sent');_0x55d6f3(_0x554208[_0xa198('0x27')][_0xa198('0x26')]);}})[_0xa198('0x28')](function(_0x1348a1){logger[_0xa198('0x25')](_0xa198('0x20'),_0x50bdb6,_0x1348a1);_0x34ece5(_0x1348a1);});});}function respondWithStatusCode(_0x343a88,_0x3b81f3){_0x3b81f3=_0x3b81f3||0xcc;return function(_0x426690){if(_0x426690){return _0x343a88[_0xa198('0x29')](_0x3b81f3);}return _0x343a88[_0xa198('0x2a')](_0x3b81f3)[_0xa198('0x2b')]();};}function respondWithResult(_0x1c9a21,_0x6ab39){_0x6ab39=_0x6ab39||0xc8;return function(_0x209bbe){if(_0x209bbe){return _0x1c9a21['status'](_0x6ab39)['json'](_0x209bbe);}};}function respondWithFilteredResult(_0x9b7bba,_0x26cc3b){return function(_0x4b5e56){if(_0x4b5e56){var _0x22bb1d=typeof _0x26cc3b['offset']==='undefined'&&typeof _0x26cc3b[_0xa198('0x2c')]==='undefined';var _0x285274=_0x4b5e56[_0xa198('0x2d')];var _0x159a18=_0x22bb1d?0x0:_0x26cc3b[_0xa198('0x2e')];var _0x3d7ef0=_0x22bb1d?_0x4b5e56[_0xa198('0x2d')]:_0x26cc3b[_0xa198('0x2e')]+_0x26cc3b[_0xa198('0x2c')];var _0x50042c;if(_0x3d7ef0>=_0x285274){_0x3d7ef0=_0x285274;_0x50042c=0xc8;}else{_0x50042c=0xce;}_0x9b7bba[_0xa198('0x2a')](_0x50042c);return _0x9b7bba[_0xa198('0x2f')]('Content-Range',_0x159a18+'-'+_0x3d7ef0+'/'+_0x285274)[_0xa198('0x30')](_0x4b5e56);}return null;};}function patchUpdates(_0x4212c1){return function(_0x5f5198){try{jsonpatch[_0xa198('0x31')](_0x5f5198,_0x4212c1,!![]);}catch(_0x647845){return BPromise[_0xa198('0x32')](_0x647845);}return _0x5f5198[_0xa198('0x33')]();};}function saveUpdates(_0x55cab8,_0xc1b5f1){return function(_0x1c6118){if(_0x1c6118){return _0x1c6118[_0xa198('0x34')](_0x55cab8)['then'](function(_0x6354aa){return _0x6354aa;});}return null;};}function removeEntity(_0x333e2b,_0x19b290){return function(_0x2892f4){if(_0x2892f4){return _0x2892f4['destroy']()['then'](function(){var _0x60d59b=_0x2892f4[_0xa198('0x35')]({'plain':!![]});var _0x533c3b=_0xa198('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x533c3b,'resourceId':_0x60d59b['id']}})[_0xa198('0x1e')](function(){return _0x2892f4;});})[_0xa198('0x1e')](function(){_0x333e2b[_0xa198('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dfc37,_0x48ce2d){return function(_0x4ae291){if(!_0x4ae291){_0x3dfc37[_0xa198('0x29')](0x194);}return _0x4ae291;};}function handleError(_0x36050d,_0x50b00b){_0x50b00b=_0x50b00b||0x1f4;return function(_0x1c4df4){logger[_0xa198('0x25')](_0x1c4df4[_0xa198('0x37')]);if(_0x1c4df4[_0xa198('0x38')]){delete _0x1c4df4['name'];}_0x36050d[_0xa198('0x2a')](_0x50b00b)[_0xa198('0x39')](_0x1c4df4);};}exports[_0xa198('0x3a')]=function(_0x136aba,_0x4fb074){var _0x31f243={'include':[{'model':db[_0xa198('0x3b')],'as':_0xa198('0x3c')},{'model':db['MailServerOut'],'as':_0xa198('0x3d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1b977f={},_0x100c52={'count':0x0,'rows':[]};var _0x11838b=_['map'](db[_0xa198('0x3e')]['rawAttributes'],function(_0x243268){return{'name':_0x243268['fieldName'],'type':_0x243268['type'][_0xa198('0x3f')]};});_0x1b977f[_0xa198('0x40')]=_[_0xa198('0x41')](_0x11838b,_0xa198('0x38'));_0x1b977f[_0xa198('0x42')]=_[_0xa198('0x43')](_0x136aba['query']);_0x1b977f[_0xa198('0x44')]=_[_0xa198('0x45')](_0x1b977f[_0xa198('0x40')],_0x1b977f[_0xa198('0x42')]);_0x31f243[_0xa198('0x46')]=_[_0xa198('0x45')](_0x1b977f[_0xa198('0x40')],qs[_0xa198('0x47')](_0x136aba['query'][_0xa198('0x47')]));_0x31f243['attributes']=_0x31f243[_0xa198('0x46')][_0xa198('0x48')]?_0x31f243['attributes']:_0x1b977f[_0xa198('0x40')];if(!_0x136aba[_0xa198('0x42')]['hasOwnProperty'](_0xa198('0x49'))){_0x31f243['limit']=qs[_0xa198('0x2c')](_0x136aba[_0xa198('0x42')][_0xa198('0x2c')]);_0x31f243[_0xa198('0x2e')]=qs[_0xa198('0x2e')](_0x136aba['query'][_0xa198('0x2e')]);}_0x31f243[_0xa198('0x4a')]=qs[_0xa198('0x4b')](_0x136aba['query'][_0xa198('0x4b')]);_0x31f243[_0xa198('0x4c')]=qs[_0xa198('0x44')](_[_0xa198('0x4d')](_0x136aba[_0xa198('0x42')],_0x1b977f[_0xa198('0x44')]),_0x11838b);if(_0x136aba[_0xa198('0x42')][_0xa198('0x4e')]){_0x31f243['where']=_[_0xa198('0x4f')](_0x31f243[_0xa198('0x4c')],{'$or':_[_0xa198('0x41')](_0x11838b,function(_0x286bbf){if(_0x286bbf[_0xa198('0x50')]!==_0xa198('0x51')){var _0x8f2983={};_0x8f2983[_0x286bbf['name']]={'$like':'%'+_0x136aba['query']['filter']+'%'};return _0x8f2983;}})});}_0x31f243=_['merge']({},_0x31f243,_0x136aba[_0xa198('0x52')]);var _0x5c61c8={'where':_0x31f243[_0xa198('0x4c')]};return db[_0xa198('0x3e')][_0xa198('0x2d')](_0x5c61c8)[_0xa198('0x1e')](function(_0x553ccc){_0x100c52[_0xa198('0x2d')]=_0x553ccc;if(_0x136aba[_0xa198('0x42')]['includeAll']){_0x31f243[_0xa198('0x53')]=[{'all':!![]}];}return db[_0xa198('0x3e')][_0xa198('0x54')](_0x31f243);})[_0xa198('0x1e')](function(_0x1da31e){_0x100c52[_0xa198('0x55')]=_0x1da31e;return _0x100c52;})[_0xa198('0x1e')](respondWithFilteredResult(_0x4fb074,_0x31f243))[_0xa198('0x28')](handleError(_0x4fb074,null));};exports[_0xa198('0x56')]=function(_0x5af4c1,_0x3cefca){var _0x1dc2b={'raw':![],'where':{'id':_0x5af4c1['params']['id']},'include':[{'model':db[_0xa198('0x3b')],'as':_0xa198('0x3c')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xa198('0x57')],'as':_0xa198('0x58')}]},_0x54fba6={};_0x54fba6[_0xa198('0x40')]=_['keys'](db[_0xa198('0x3e')][_0xa198('0x59')]);_0x54fba6[_0xa198('0x42')]=_['keys'](_0x5af4c1[_0xa198('0x42')]);_0x54fba6['filters']=_[_0xa198('0x45')](_0x54fba6[_0xa198('0x40')],_0x54fba6[_0xa198('0x42')]);_0x1dc2b[_0xa198('0x46')]=_[_0xa198('0x45')](_0x54fba6['model'],qs[_0xa198('0x47')](_0x5af4c1['query'][_0xa198('0x47')]));_0x1dc2b[_0xa198('0x46')]=_0x1dc2b[_0xa198('0x46')][_0xa198('0x48')]?_0x1dc2b[_0xa198('0x46')]:_0x54fba6[_0xa198('0x40')];if(_0x5af4c1['query'][_0xa198('0x5a')]){_0x1dc2b[_0xa198('0x53')]=[{'all':!![]}];}_0x1dc2b=_[_0xa198('0x4f')]({},_0x1dc2b,_0x5af4c1[_0xa198('0x52')]);return db['MailAccount']['find'](_0x1dc2b)['then'](handleEntityNotFound(_0x3cefca,null))[_0xa198('0x1e')](respondWithResult(_0x3cefca,null))[_0xa198('0x28')](handleError(_0x3cefca,null));};exports[_0xa198('0x34')]=function(_0x5d7f5d,_0x1c58f4){if(_0x5d7f5d[_0xa198('0x5b')]['id']){delete _0x5d7f5d[_0xa198('0x5b')]['id'];}return db[_0xa198('0x3e')][_0xa198('0x5c')]({'where':{'id':_0x5d7f5d['params']['id']},'include':[{'model':db[_0xa198('0x3b')],'as':_0xa198('0x3c')},{'model':db[_0xa198('0x5d')],'as':_0xa198('0x3d')},{'model':db[_0xa198('0x57')],'as':'mandatoryDispositionPause'}]})[_0xa198('0x1e')](handleEntityNotFound(_0x1c58f4,null))[_0xa198('0x1e')](saveUpdates(_0x5d7f5d[_0xa198('0x5b')],null))[_0xa198('0x1e')](function(_0x47ea7b){if(_0x47ea7b&&_0x5d7f5d['body'][_0xa198('0x3c')]){return db[_0xa198('0x3b')][_0xa198('0x34')](_0x5d7f5d['body']['Imap'],{'where':{'MailAccountId':_0x47ea7b['id']}})[_0xa198('0x1e')](function(){return _0x47ea7b;});}return _0x47ea7b;})[_0xa198('0x1e')](function(_0x3214b7){if(_0x3214b7&&_0x5d7f5d[_0xa198('0x5b')][_0xa198('0x3d')]){return db['MailServerOut'][_0xa198('0x34')](_0x5d7f5d[_0xa198('0x5b')][_0xa198('0x3d')],{'where':{'MailAccountId':_0x3214b7['id']}})[_0xa198('0x1e')](function(){return _0x3214b7;});}return _0x3214b7;})[_0xa198('0x1e')](respondWithResult(_0x1c58f4,null))['catch'](handleError(_0x1c58f4,null));};exports[_0xa198('0x5e')]=function(_0x4587dd,_0x48c8ef){return db[_0xa198('0x3e')][_0xa198('0x5e')]()['then'](respondWithResult(_0x48c8ef,null))[_0xa198('0x28')](handleError(_0x48c8ef,null));};exports[_0xa198('0x5f')]=function(_0x3c6e02,_0xb38e11,_0x359620){if(_0x3c6e02[_0xa198('0x5b')]['id']){delete _0x3c6e02[_0xa198('0x5b')]['id'];}return db[_0xa198('0x3e')][_0xa198('0x5c')]({'where':{'id':_0x3c6e02[_0xa198('0x60')]['id']}})['then'](handleEntityNotFound(_0xb38e11,null))[_0xa198('0x1e')](function(_0x1384e2){if(_0x1384e2){_0x3c6e02['body'][_0xa198('0x61')]=_0x1384e2['id'];return db['Disposition'][_0xa198('0x62')](_0x3c6e02[_0xa198('0x5b')]);}})['then'](respondWithResult(_0xb38e11,null))['catch'](handleError(_0xb38e11,null));};exports[_0xa198('0x63')]=function(_0x2760dc,_0x4920fd,_0x29d06e){var _0x195f65={'raw':![],'where':{}};var _0x486a75={};var _0x1a1b15={'count':0x0,'rows':[]};return db[_0xa198('0x3e')][_0xa198('0x64')]({'where':{'id':_0x2760dc[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x4920fd,null))['then'](function(_0x58c8c7){if(_0x58c8c7){_0x486a75[_0xa198('0x40')]=_['keys'](db[_0xa198('0x65')][_0xa198('0x59')]);_0x486a75['query']=_[_0xa198('0x43')](_0x2760dc[_0xa198('0x42')]);_0x486a75[_0xa198('0x44')]=_[_0xa198('0x45')](_0x486a75['model'],_0x486a75['query']);_0x195f65[_0xa198('0x46')]=_[_0xa198('0x45')](_0x486a75[_0xa198('0x40')],qs['fields'](_0x2760dc[_0xa198('0x42')]['fields']));_0x195f65[_0xa198('0x46')]=_0x195f65['attributes'][_0xa198('0x48')]?_0x195f65['attributes']:_0x486a75[_0xa198('0x40')];if(!_0x2760dc['query'][_0xa198('0x66')](_0xa198('0x49'))){_0x195f65[_0xa198('0x2c')]=qs[_0xa198('0x2c')](_0x2760dc[_0xa198('0x42')]['limit']);_0x195f65['offset']=qs[_0xa198('0x2e')](_0x2760dc[_0xa198('0x42')][_0xa198('0x2e')]);}_0x195f65[_0xa198('0x4a')]=qs['sort'](_0x2760dc[_0xa198('0x42')][_0xa198('0x4b')]);_0x195f65[_0xa198('0x4c')]=qs[_0xa198('0x44')](_[_0xa198('0x4d')](_0x2760dc[_0xa198('0x42')],_0x486a75[_0xa198('0x44')]));_0x195f65[_0xa198('0x4c')]['MailAccountId']=_0x58c8c7['id'];if(_0x2760dc[_0xa198('0x42')][_0xa198('0x4e')]){_0x195f65[_0xa198('0x4c')]=_[_0xa198('0x4f')](_0x195f65[_0xa198('0x4c')],{'$or':_[_0xa198('0x41')](_0x195f65[_0xa198('0x46')],function(_0xdcbbf3){var _0x4ba36c={};_0x4ba36c[_0xdcbbf3]={'$like':'%'+_0x2760dc[_0xa198('0x42')][_0xa198('0x4e')]+'%'};return _0x4ba36c;})});}_0x195f65=_[_0xa198('0x4f')]({},_0x195f65,_0x2760dc[_0xa198('0x52')]);return db[_0xa198('0x65')][_0xa198('0x2d')]({'where':_0x195f65[_0xa198('0x4c')]})[_0xa198('0x1e')](function(_0x1870ec){_0x1a1b15[_0xa198('0x2d')]=_0x1870ec;if(_0x2760dc[_0xa198('0x42')][_0xa198('0x5a')]){_0x195f65[_0xa198('0x53')]=[{'all':!![]}];}return db[_0xa198('0x65')][_0xa198('0x54')](_0x195f65);})[_0xa198('0x1e')](function(_0x318a35){_0x1a1b15['rows']=_0x318a35;return _0x1a1b15;});}})[_0xa198('0x1e')](respondWithFilteredResult(_0x4920fd,_0x195f65))[_0xa198('0x28')](handleError(_0x4920fd,null));};exports[_0xa198('0x67')]=function(_0x1b34fa,_0x3e14c7,_0x4e5187){return db[_0xa198('0x3e')][_0xa198('0x5c')]({'where':{'id':_0x1b34fa['params']['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x3e14c7,null))[_0xa198('0x1e')](function(_0x5af80d){if(_0x5af80d){return _0x5af80d['removeDispositions'](_0x1b34fa['query'][_0xa198('0x68')]);}})['then'](respondWithStatusCode(_0x3e14c7,null))['catch'](handleError(_0x3e14c7,null));};exports['addAnswer']=function(_0x45edd2,_0x26d41a,_0x4f7f81){if(_0x45edd2[_0xa198('0x5b')]['id']){delete _0x45edd2[_0xa198('0x5b')]['id'];}return db[_0xa198('0x3e')][_0xa198('0x5c')]({'where':{'id':_0x45edd2[_0xa198('0x60')]['id']}})['then'](handleEntityNotFound(_0x26d41a,null))[_0xa198('0x1e')](function(_0x2736e1){if(_0x2736e1){_0x45edd2[_0xa198('0x5b')]['MailAccountId']=_0x2736e1['id'];return db[_0xa198('0x69')]['create'](_0x45edd2[_0xa198('0x5b')]);}})[_0xa198('0x1e')](respondWithResult(_0x26d41a,null))[_0xa198('0x28')](handleError(_0x26d41a,null));};exports[_0xa198('0x6a')]=function(_0x4ccc9e,_0x1186ce,_0xeaa16c){var _0x50e992={'raw':![],'where':{}};var _0x5e1dfb={};var _0x278fb7={'count':0x0,'rows':[]};return db[_0xa198('0x3e')][_0xa198('0x64')]({'where':{'id':_0x4ccc9e['params']['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x1186ce,null))[_0xa198('0x1e')](function(_0x30a082){if(_0x30a082){_0x5e1dfb[_0xa198('0x40')]=_[_0xa198('0x43')](db['CannedAnswer'][_0xa198('0x59')]);_0x5e1dfb[_0xa198('0x42')]=_[_0xa198('0x43')](_0x4ccc9e['query']);_0x5e1dfb[_0xa198('0x44')]=_[_0xa198('0x45')](_0x5e1dfb[_0xa198('0x40')],_0x5e1dfb['query']);_0x50e992[_0xa198('0x46')]=_[_0xa198('0x45')](_0x5e1dfb[_0xa198('0x40')],qs['fields'](_0x4ccc9e[_0xa198('0x42')][_0xa198('0x47')]));_0x50e992[_0xa198('0x46')]=_0x50e992[_0xa198('0x46')][_0xa198('0x48')]?_0x50e992['attributes']:_0x5e1dfb['model'];if(!_0x4ccc9e[_0xa198('0x42')][_0xa198('0x66')](_0xa198('0x49'))){_0x50e992['limit']=qs['limit'](_0x4ccc9e[_0xa198('0x42')]['limit']);_0x50e992['offset']=qs[_0xa198('0x2e')](_0x4ccc9e['query'][_0xa198('0x2e')]);}_0x50e992[_0xa198('0x4a')]=qs[_0xa198('0x4b')](_0x4ccc9e[_0xa198('0x42')][_0xa198('0x4b')]);_0x50e992[_0xa198('0x4c')]=qs['filters'](_[_0xa198('0x4d')](_0x4ccc9e[_0xa198('0x42')],_0x5e1dfb[_0xa198('0x44')]));_0x50e992[_0xa198('0x4c')][_0xa198('0x61')]=_0x30a082['id'];if(_0x4ccc9e['query'][_0xa198('0x4e')]){_0x50e992[_0xa198('0x4c')]=_['merge'](_0x50e992[_0xa198('0x4c')],{'$or':_['map'](_0x50e992['attributes'],function(_0x208709){var _0x23ccbf={};_0x23ccbf[_0x208709]={'$like':'%'+_0x4ccc9e[_0xa198('0x42')]['filter']+'%'};return _0x23ccbf;})});}_0x50e992=_[_0xa198('0x4f')]({},_0x50e992,_0x4ccc9e['options']);return db[_0xa198('0x69')][_0xa198('0x2d')]({'where':_0x50e992[_0xa198('0x4c')]})[_0xa198('0x1e')](function(_0x168c8e){_0x278fb7['count']=_0x168c8e;if(_0x4ccc9e['query'][_0xa198('0x5a')]){_0x50e992[_0xa198('0x53')]=[{'all':!![]}];}return db[_0xa198('0x69')][_0xa198('0x54')](_0x50e992);})[_0xa198('0x1e')](function(_0x5df6cc){_0x278fb7['rows']=_0x5df6cc;return _0x278fb7;});}})[_0xa198('0x1e')](respondWithFilteredResult(_0x1186ce,_0x50e992))[_0xa198('0x28')](handleError(_0x1186ce,null));};exports[_0xa198('0x6b')]=function(_0x384058,_0x1575b6,_0x16ccc4){return db[_0xa198('0x3e')][_0xa198('0x5c')]({'where':{'id':_0x384058[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x1575b6,null))[_0xa198('0x1e')](function(_0x317b2b){if(_0x317b2b){return _0x317b2b[_0xa198('0x6b')](_0x384058[_0xa198('0x42')][_0xa198('0x68')]);}})[_0xa198('0x1e')](respondWithStatusCode(_0x1575b6,null))['catch'](handleError(_0x1575b6,null));};exports[_0xa198('0x62')]=function(_0x6e10d5,_0x3fd83f){var _0xd6cae5={'name':_0x6e10d5['body']['name'],'key':_0x6e10d5['body'][_0xa198('0x3f')],'email':_0x6e10d5[_0xa198('0x5b')]['email'],'ListId':_0x6e10d5[_0xa198('0x5b')][_0xa198('0x6c')],'active':!_[_0xa198('0x6d')](_0x6e10d5[_0xa198('0x5b')]['active'])?_0x6e10d5['body'][_0xa198('0x6e')]:!![],'description':_0x6e10d5[_0xa198('0x5b')][_0xa198('0x6f')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x6e10d5[_0xa198('0x5b')][_0xa198('0x70')])){if(_0x6e10d5['body'][_0xa198('0x71')]){_0xd6cae5[_0xa198('0x3c')][_0xa198('0x72')]=_0xd6cae5[_0xa198('0x3d')]['user']=_0x6e10d5[_0xa198('0x5b')][_0xa198('0x73')];_0xd6cae5[_0xa198('0x3c')][_0xa198('0x74')]=_0xd6cae5[_0xa198('0x3d')][_0xa198('0x75')]=_0x6e10d5[_0xa198('0x5b')]['cpassword'];}else{_0xd6cae5[_0xa198('0x3c')][_0xa198('0x76')]=_0xd6cae5[_0xa198('0x3d')][_0xa198('0x76')]=![];}_0xd6cae5[_0xa198('0x3c')][_0xa198('0x77')]=_0x6e10d5[_0xa198('0x5b')][_0xa198('0x3c')][_0xa198('0x77')];_0xd6cae5[_0xa198('0x3c')]['port']=_0x6e10d5[_0xa198('0x5b')][_0xa198('0x3c')][_0xa198('0x78')];_0xd6cae5[_0xa198('0x3d')]['host']=_0x6e10d5[_0xa198('0x5b')]['Smtp'][_0xa198('0x77')];_0xd6cae5[_0xa198('0x3d')][_0xa198('0x78')]=_0x6e10d5[_0xa198('0x5b')][_0xa198('0x3d')]['port'];}else{_0xd6cae5['Imap']['service']=_0xd6cae5[_0xa198('0x3d')][_0xa198('0x79')]=_0x6e10d5['body'][_0xa198('0x70')];_0xd6cae5['Imap'][_0xa198('0x72')]=_0xd6cae5[_0xa198('0x3d')][_0xa198('0x72')]=_0x6e10d5[_0xa198('0x5b')]['cuser'];_0xd6cae5['Imap'][_0xa198('0x74')]=_0xd6cae5[_0xa198('0x3d')]['pass']=_0x6e10d5[_0xa198('0x5b')][_0xa198('0x7a')];}return db[_0xa198('0x3e')][_0xa198('0x62')](_0xd6cae5,{'include':[{'model':db[_0xa198('0x5d')],'as':_0xa198('0x3d')},{'model':db[_0xa198('0x3b')],'as':_0xa198('0x3c')}]})['then'](function(_0x5e3b6e){var _0x3bf82e=_0x6e10d5[_0xa198('0x72')]['get']({'plain':!![]});if(!_0x3bf82e)throw new Error(_0xa198('0x7b'));if(_0x3bf82e[_0xa198('0x7c')]===_0xa198('0x72')){var _0x57abe2=_0x5e3b6e['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xa198('0x36'),'userProfileId':_0x3bf82e[_0xa198('0x7d')]},'raw':!![]})['then'](function(_0x528a88){if(_0x528a88&&_0x528a88[_0xa198('0x7e')]===0x0){return db[_0xa198('0x7f')]['create']({'name':_0x57abe2['name'],'resourceId':_0x57abe2['id'],'type':_0x528a88['name'],'sectionId':_0x528a88['id']},{})[_0xa198('0x1e')](function(){return _0x5e3b6e;});}else{return _0x5e3b6e;}})[_0xa198('0x28')](function(_0x52ddd6){logger[_0xa198('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52ddd6);throw _0x52ddd6;});}return _0x5e3b6e;})[_0xa198('0x1e')](respondWithResult(_0x3fd83f,0xc9))[_0xa198('0x28')](handleError(_0x3fd83f,null));};exports['getImap']=function(_0x1b6dce,_0xcc0b,_0x478658){return db[_0xa198('0x3e')][_0xa198('0x64')]({'where':{'id':_0x1b6dce[_0xa198('0x60')]['id']}})['then'](handleEntityNotFound(_0xcc0b,null))['then'](function(_0x387a3d){if(_0x387a3d){return _0x387a3d[_0xa198('0x80')]();}return null;})[_0xa198('0x1e')](respondWithResult(_0xcc0b,null))[_0xa198('0x28')](handleError(_0xcc0b,null));};exports[_0xa198('0x81')]=function(_0x1f0af3,_0x5ca7cf,_0x19155b){if(_0x1f0af3['body']['id']){delete _0x1f0af3['body']['id'];}return db[_0xa198('0x3e')][_0xa198('0x5c')]({'where':{'id':_0x1f0af3[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x5ca7cf,null))[_0xa198('0x1e')](function(_0x4147e1){if(_0x4147e1){_0x1f0af3['body']['MailAccountId']=_0x4147e1['id'];return db[_0xa198('0x3b')]['create'](_0x1f0af3[_0xa198('0x5b')]);}})[_0xa198('0x1e')](respondWithResult(_0x5ca7cf,null))['catch'](handleError(_0x5ca7cf,null));};exports[_0xa198('0x82')]=function(_0x18dc3f,_0x16782e,_0x514c3b){return db[_0xa198('0x3e')][_0xa198('0x64')]({'where':{'id':_0x18dc3f[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x16782e,null))[_0xa198('0x1e')](function(_0x43d8d7){if(_0x43d8d7){return _0x43d8d7[_0xa198('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x16782e,null))[_0xa198('0x28')](handleError(_0x16782e,null));};exports[_0xa198('0x84')]=function(_0x506d3b,_0x20b7c5,_0x4bdd84){return db[_0xa198('0x3e')]['findOne']({'where':{'id':_0x506d3b[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x20b7c5,null))[_0xa198('0x1e')](function(_0x3acae5){if(_0x3acae5){return _0x3acae5[_0xa198('0x84')]();}return null;})[_0xa198('0x1e')](respondWithResult(_0x20b7c5,null))[_0xa198('0x28')](handleError(_0x20b7c5,null));};exports[_0xa198('0x85')]=function(_0x2bc792,_0x4ae06d,_0x5f0466){if(_0x2bc792['body']['id']){delete _0x2bc792['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x2bc792[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x4ae06d,null))[_0xa198('0x1e')](function(_0x2241d0){if(_0x2241d0){_0x2bc792[_0xa198('0x5b')][_0xa198('0x61')]=_0x2241d0['id'];return db[_0xa198('0x5d')]['create'](_0x2bc792[_0xa198('0x5b')]);}})['then'](respondWithResult(_0x4ae06d,null))[_0xa198('0x28')](handleError(_0x4ae06d,null));};exports[_0xa198('0x86')]=function(_0x4a9b1a,_0x592b80,_0x4c4a1b){return db[_0xa198('0x3e')][_0xa198('0x64')]({'where':{'id':_0x4a9b1a['params']['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x592b80,null))[_0xa198('0x1e')](function(_0x52637c){if(_0x52637c){return _0x52637c['setSmtp'](null);}return null;})[_0xa198('0x1e')](respondWithStatusCode(_0x592b80,null))[_0xa198('0x28')](handleError(_0x592b80,null));};exports['addInteraction']=function(_0x27b23e,_0x2509ba,_0x233f0a){return db[_0xa198('0x87')][_0xa198('0x5c')]({'where':{'id':_0x27b23e[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x2509ba,null))[_0xa198('0x1e')](function(_0x300bcb){if(_0x300bcb){return _0x300bcb[_0xa198('0x88')](_0x27b23e[_0xa198('0x5b')]['ids'],_[_0xa198('0x89')](_0x27b23e[_0xa198('0x5b')],[_0xa198('0x68'),'id'])||{});}})[_0xa198('0x1e')](respondWithResult(_0x2509ba,null))['catch'](handleError(_0x2509ba,null));};exports[_0xa198('0x8a')]=function(_0x414456,_0x1fd186,_0x34e2ce){var _0x1995a2={'raw':![],'where':{}};var _0x5d3a13={};var _0x5a6972={'count':0x0,'rows':[]};return db[_0xa198('0x3e')][_0xa198('0x64')]({'where':{'id':_0x414456['params']['id']}})['then'](handleEntityNotFound(_0x1fd186,null))['then'](function(_0x134779){if(_0x134779){_0x5d3a13[_0xa198('0x40')]=_[_0xa198('0x43')](db['MailInteraction'][_0xa198('0x59')]);_0x5d3a13[_0xa198('0x42')]=_['keys'](_0x414456['query']);_0x5d3a13['filters']=_[_0xa198('0x45')](_0x5d3a13['model'],_0x5d3a13[_0xa198('0x42')]);_0x1995a2[_0xa198('0x46')]=_['intersection'](_0x5d3a13[_0xa198('0x40')],qs[_0xa198('0x47')](_0x414456['query']['fields']));_0x1995a2[_0xa198('0x46')]=_0x1995a2['attributes'][_0xa198('0x48')]?_0x1995a2['attributes']:_0x5d3a13['model'];if(!_0x414456[_0xa198('0x42')]['hasOwnProperty'](_0xa198('0x49'))){_0x1995a2[_0xa198('0x2c')]=qs[_0xa198('0x2c')](_0x414456[_0xa198('0x42')]['limit']);_0x1995a2[_0xa198('0x2e')]=qs[_0xa198('0x2e')](_0x414456[_0xa198('0x42')][_0xa198('0x2e')]);}_0x1995a2[_0xa198('0x4a')]=qs[_0xa198('0x4b')](_0x414456['query']['sort']);_0x1995a2[_0xa198('0x4c')]=qs[_0xa198('0x44')](_['pick'](_0x414456[_0xa198('0x42')],_0x5d3a13['filters']));_0x1995a2[_0xa198('0x4c')][_0xa198('0x61')]=_0x134779['id'];if(_0x414456[_0xa198('0x42')][_0xa198('0x4e')]){_0x1995a2[_0xa198('0x4c')]=_[_0xa198('0x4f')](_0x1995a2[_0xa198('0x4c')],{'$or':_[_0xa198('0x41')](_0x1995a2[_0xa198('0x46')],function(_0x566cb9){var _0x167ff3={};_0x167ff3[_0x566cb9]={'$like':'%'+_0x414456[_0xa198('0x42')]['filter']+'%'};return _0x167ff3;})});}_0x1995a2=_[_0xa198('0x4f')]({},_0x1995a2,_0x414456['options']);return db[_0xa198('0x87')]['count']({'where':_0x1995a2[_0xa198('0x4c')]})['then'](function(_0x303119){_0x5a6972['count']=_0x303119;if(_0x414456[_0xa198('0x42')][_0xa198('0x5a')]){_0x1995a2['include']=[{'model':db['CmContact'],'as':_0xa198('0x8b'),'required':![]},{'model':db[_0xa198('0x8c')],'as':_0xa198('0x8d'),'attributes':[_0xa198('0x38'),_0xa198('0x8e'),_0xa198('0x8f')],'required':![]},{'model':db[_0xa198('0x90')],'as':_0xa198('0x91'),'attributes':['id',_0xa198('0x38'),_0xa198('0x92')],'where':_0x414456[_0xa198('0x42')][_0xa198('0x93')]?{'id':_0x414456[_0xa198('0x42')][_0xa198('0x93')]}:undefined,'required':_0x414456[_0xa198('0x42')][_0xa198('0x93')]?!![]:![]}];}return db[_0xa198('0x87')]['findAll'](_0x1995a2);})['then'](function(_0x4488b7){_0x5a6972['rows']=_0x4488b7;return _0x5a6972;});}})[_0xa198('0x1e')](respondWithFilteredResult(_0x1fd186,_0x1995a2))[_0xa198('0x28')](handleError(_0x1fd186,null));};exports[_0xa198('0x94')]=function(_0x2efffb,_0x91e63c,_0x5c29f5){return db[_0xa198('0x3e')]['findOne']({'where':{'id':_0x2efffb['params']['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x91e63c,null))[_0xa198('0x1e')](function(_0x303446){if(_0x303446){return db[_0xa198('0x95')][_0xa198('0x96')](function(_0xed1ab0){return db[_0xa198('0x97')]['destroy']({'where':{'MailAccountId':_0x2efffb['params']['id']},'transaction':_0xed1ab0})[_0xa198('0x1e')](function(_0x438d26){var _0x492721=_[_0xa198('0x41')](_0x2efffb[_0xa198('0x5b')],function(_0x3e46c9){_0x3e46c9[_0xa198('0x61')]=_0x2efffb[_0xa198('0x60')]['id'];return _0x3e46c9;});return db['MailApplication'][_0xa198('0x98')](_0x492721,{'transaction':_0xed1ab0});});})[_0xa198('0x1e')](function(){return db[_0xa198('0x97')][_0xa198('0x99')]({'where':{'MailAccountId':_0x2efffb['params']['id']},'order':_0xa198('0x9a')});});}})[_0xa198('0x1e')](respondWithResult(_0x91e63c,null))[_0xa198('0x28')](handleError(_0x91e63c,null));};exports[_0xa198('0x9b')]=function(_0x1c491a,_0x49ae4a,_0x2d7cb1){var _0x2c4523={};var _0x1399c9={};var _0x3ef579;var _0x14ef3b;return db['MailAccount']['findOne']({'where':{'id':_0x1c491a[_0xa198('0x60')]['id']}})['then'](handleEntityNotFound(_0x49ae4a,null))[_0xa198('0x1e')](function(_0x535a69){if(_0x535a69){_0x3ef579=_0x535a69;_0x1399c9[_0xa198('0x40')]=_[_0xa198('0x43')](db[_0xa198('0x97')][_0xa198('0x59')]);_0x1399c9[_0xa198('0x42')]=_[_0xa198('0x43')](_0x1c491a[_0xa198('0x42')]);_0x1399c9[_0xa198('0x44')]=_[_0xa198('0x45')](_0x1399c9['model'],_0x1399c9[_0xa198('0x42')]);_0x2c4523[_0xa198('0x46')]=_[_0xa198('0x45')](_0x1399c9['model'],qs['fields'](_0x1c491a[_0xa198('0x42')]['fields']));_0x2c4523[_0xa198('0x46')]=_0x2c4523[_0xa198('0x46')][_0xa198('0x48')]?_0x2c4523[_0xa198('0x46')]:_0x1399c9[_0xa198('0x40')];_0x2c4523[_0xa198('0x4a')]=qs[_0xa198('0x4b')](_0x1c491a[_0xa198('0x42')][_0xa198('0x4b')]);_0x2c4523[_0xa198('0x4c')]=qs[_0xa198('0x44')](_[_0xa198('0x4d')](_0x1c491a[_0xa198('0x42')],_0x1399c9[_0xa198('0x44')]));if(_0x1c491a[_0xa198('0x42')][_0xa198('0x4e')]){_0x2c4523[_0xa198('0x4c')]=_['merge'](_0x2c4523[_0xa198('0x4c')],{'$or':_['map'](_0x2c4523[_0xa198('0x46')],function(_0x221742){var _0x23e0e9={};_0x23e0e9[_0x221742]={'$like':'%'+_0x1c491a[_0xa198('0x42')][_0xa198('0x4e')]+'%'};return _0x23e0e9;})});}_0x2c4523=_['merge']({},_0x2c4523,_0x1c491a[_0xa198('0x52')]);return _0x3ef579[_0xa198('0x9b')](_0x2c4523);}})['then'](function(_0x5bda51){if(_0x5bda51){_0x14ef3b=_0x5bda51[_0xa198('0x48')];if(!_0x1c491a[_0xa198('0x42')]['hasOwnProperty']('nolimit')){_0x2c4523['limit']=qs[_0xa198('0x2c')](_0x1c491a[_0xa198('0x42')][_0xa198('0x2c')]);_0x2c4523[_0xa198('0x2e')]=qs[_0xa198('0x2e')](_0x1c491a[_0xa198('0x42')][_0xa198('0x2e')]);}return _0x3ef579[_0xa198('0x9b')](_0x2c4523);}})[_0xa198('0x1e')](function(_0x2f7d87){if(_0x2f7d87){return _0x2f7d87?{'count':_0x14ef3b,'rows':_0x2f7d87}:null;}})[_0xa198('0x1e')](respondWithResult(_0x49ae4a,null))[_0xa198('0x28')](handleError(_0x49ae4a,null));};exports[_0xa198('0x9c')]=function(_0x3be10d,_0x3746e3,_0x22ba95){var _0x16bde4={'raw':!![],'where':{}};var _0x53aa58={};var _0x94a7d={'count':0x0,'rows':[]};return db['MailAccount'][_0xa198('0x64')]({'where':{'id':_0x3be10d[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x3746e3,null))['then'](function(_0x5e3cdf){if(_0x5e3cdf){_0x53aa58['model']=_[_0xa198('0x43')](db['MailMessage'][_0xa198('0x59')]);_0x53aa58[_0xa198('0x42')]=_[_0xa198('0x43')](_0x3be10d[_0xa198('0x42')]);_0x53aa58['filters']=_[_0xa198('0x45')](_0x53aa58['model'],_0x53aa58[_0xa198('0x42')]);_0x16bde4['attributes']=_[_0xa198('0x45')](_0x53aa58[_0xa198('0x40')],qs[_0xa198('0x47')](_0x3be10d[_0xa198('0x42')][_0xa198('0x47')]));_0x16bde4[_0xa198('0x46')]=_0x16bde4['attributes']['length']?_0x16bde4[_0xa198('0x46')]:_0x53aa58[_0xa198('0x40')];if(!_0x3be10d[_0xa198('0x42')]['hasOwnProperty'](_0xa198('0x49'))){_0x16bde4[_0xa198('0x2c')]=qs[_0xa198('0x2c')](_0x3be10d[_0xa198('0x42')][_0xa198('0x2c')]);_0x16bde4[_0xa198('0x2e')]=qs[_0xa198('0x2e')](_0x3be10d[_0xa198('0x42')][_0xa198('0x2e')]);}_0x16bde4[_0xa198('0x4a')]=qs[_0xa198('0x4b')](_0x3be10d[_0xa198('0x42')][_0xa198('0x4b')]);_0x16bde4[_0xa198('0x4c')]=qs[_0xa198('0x44')](_[_0xa198('0x4d')](_0x3be10d[_0xa198('0x42')],_0x53aa58[_0xa198('0x44')]));_0x16bde4[_0xa198('0x4c')][_0xa198('0x61')]=_0x5e3cdf['id'];if(_0x3be10d[_0xa198('0x42')][_0xa198('0x4e')]){_0x16bde4[_0xa198('0x4c')]=_['merge'](_0x16bde4['where'],{'$or':_['map'](_0x16bde4[_0xa198('0x46')],function(_0x57442d){var _0x3eb3b2={};_0x3eb3b2[_0x57442d]={'$like':'%'+_0x3be10d['query'][_0xa198('0x4e')]+'%'};return _0x3eb3b2;})});}if(_0x3be10d[_0xa198('0x42')][_0xa198('0x9d')]){var _0x2b080b=_0x3be10d[_0xa198('0x42')][_0xa198('0x9d')][_0xa198('0x9e')](',');var _0x3e8e25={};_0x3e8e25[_0x2b080b[0x0]]={'$gte':moment(_0x2b080b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x16bde4['where']=_[_0xa198('0x4f')](_0x16bde4[_0xa198('0x4c')],_0x3e8e25);}_0x16bde4=_[_0xa198('0x4f')]({},_0x16bde4,_0x3be10d[_0xa198('0x52')]);return db[_0xa198('0x9f')]['count']({'where':_0x16bde4[_0xa198('0x4c')]})[_0xa198('0x1e')](function(_0x1f5c60){_0x94a7d[_0xa198('0x2d')]=_0x1f5c60;if(_0x3be10d[_0xa198('0x42')][_0xa198('0x5a')]){_0x16bde4[_0xa198('0x53')]=[{'all':!![]}];}return db['MailMessage'][_0xa198('0x54')](_0x16bde4);})[_0xa198('0x1e')](function(_0x43f3f4){if(_0x3be10d[_0xa198('0x42')][_0xa198('0xa0')]===_0xa198('0xa1')){for(var _0x1a7b3f=0x0;_0x1a7b3f<_0x43f3f4['length'];_0x1a7b3f++){_0x43f3f4[_0x1a7b3f][_0xa198('0x5b')]=juice(_0x43f3f4[_0x1a7b3f]['body']);}}_0x94a7d[_0xa198('0x55')]=_0x43f3f4;return _0x94a7d;});}})[_0xa198('0x1e')](respondWithFilteredResult(_0x3746e3,_0x16bde4))[_0xa198('0x28')](handleError(_0x3746e3,null));};exports[_0xa198('0x39')]=function(_0x49bc29,_0x321026,_0x2f9f86){var _0x3fc878,_0x4acdda={},_0x49d57d;if(_0x49bc29[_0xa198('0x5b')]['to']){_0x49d57d=_0x49bc29[_0xa198('0x5b')]['to']['split'](',')[0x0];}return db[_0xa198('0x3e')][_0xa198('0x5c')]({'where':{'id':_0x49bc29[_0xa198('0x60')]['id']},'include':[{'model':db[_0xa198('0xa2')],'as':_0xa198('0xa3'),'include':[{'model':db[_0xa198('0xa4')],'as':'Contacts','where':{'email':_0x49d57d},'limit':0x1,'order':[[_0xa198('0xa5'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xa198('0x3d'),'raw':!![]}]})[_0xa198('0x1e')](handleEntityNotFound(_0x321026,null))['then'](function(_0x20c2ee){if(_0x20c2ee){_0x3fc878=_0x20c2ee;if(_0x20c2ee[_0xa198('0x3d')]){if(_[_0xa198('0x6d')](_0x49bc29[_0xa198('0x5b')]['from'])){_0x49bc29[_0xa198('0x5b')]['from']=util[_0xa198('0xa6')](_0xa198('0xa7'),_0x20c2ee[_0xa198('0x38')],_0x20c2ee[_0xa198('0xa8')]||_0x20c2ee['Smtp']['user']);}if(_0x49bc29['body'][_0xa198('0xa9')]&&_0x49bc29[_0xa198('0x5b')][_0xa198('0xa9')]['length']){for(var _0x40cdec=0x0;_0x40cdec<_0x49bc29[_0xa198('0x5b')][_0xa198('0xa9')][_0xa198('0x48')];_0x40cdec+=0x1){_0x49bc29[_0xa198('0x5b')][_0xa198('0xa9')][_0x40cdec]={'filename':_0x49bc29[_0xa198('0x5b')]['attachments'][_0x40cdec][_0xa198('0x38')],'path':path[_0xa198('0xaa')](config[_0xa198('0xab')],_0xa198('0xac'),_0x49bc29[_0xa198('0x5b')][_0xa198('0xa9')][_0x40cdec][_0xa198('0xad')])};}}var _0xd82ac5={'tls':{'rejectUnauthorized':![]}};if(_[_0xa198('0x6d')](_0x20c2ee[_0xa198('0x3d')][_0xa198('0x79')])){if(_0x20c2ee[_0xa198('0x3d')][_0xa198('0x76')]){_0xd82ac5[_0xa198('0xae')]={'user':_0x20c2ee[_0xa198('0x3d')][_0xa198('0x72')],'pass':_0x20c2ee[_0xa198('0x3d')][_0xa198('0x75')]};}_0xd82ac5[_0xa198('0x77')]=_0x20c2ee['Smtp'][_0xa198('0x77')];_0xd82ac5[_0xa198('0x78')]=_0x20c2ee[_0xa198('0x3d')][_0xa198('0x78')];_0xd82ac5['secure']=_0x20c2ee[_0xa198('0x3d')][_0xa198('0xaf')];}else{_0xd82ac5[_0xa198('0x79')]=_0x20c2ee[_0xa198('0x3d')][_0xa198('0x79')];_0xd82ac5[_0xa198('0xae')]={'user':_0x20c2ee[_0xa198('0x3d')][_0xa198('0x72')],'pass':_0x20c2ee[_0xa198('0x3d')][_0xa198('0x75')]};}return respondWithRpcPromise(_0xa198('0xb0'),_0xa198('0xb1'),{'account':_0xd82ac5,'message':_0x49bc29[_0xa198('0x5b')]});}else{throw new Error(_0xa198('0xb2'));}}})['then'](function(_0x5a0eaf){if(_0x5a0eaf){_0x4acdda=_0x5a0eaf;if(_0x3fc878[_0xa198('0xa3')]){if(_0x3fc878['List'][_0xa198('0xb3')][_0xa198('0x48')]){return _0x3fc878[_0xa198('0xa3')][_0xa198('0xb3')][0x0];}else{return db[_0xa198('0xa4')]['create'](_['defaults'](_0x49bc29['body'],{'firstName':_0x49bc29[_0xa198('0x5b')]['to'],'email':_0x49bc29['body']['to'],'phone':_0x49bc29[_0xa198('0x5b')]['to'],'ListId':_0x3fc878[_0xa198('0x6c')]}));}}else{throw new Error(_0xa198('0xb2'));}}})[_0xa198('0x1e')](function(_0x31587e){if(_0x31587e){var _0x24f3c5={'UserId':_0x49bc29[_0xa198('0x72')]['id'],'ContactId':_0x31587e['id'],'MailAccountId':_0x3fc878['id'],'inReplyTo':_0x4acdda[_0xa198('0xb4')],'to':_0x49bc29[_0xa198('0x5b')][_0xa198('0xb5')],'cc':_0x49bc29[_0xa198('0x5b')]['cc'],'subject':_0x49bc29['body'][_0xa198('0xb6')],'attach':_0x49bc29['body'][_0xa198('0xb7')],'firstMsgDirection':_0xa198('0xb8'),'lastMsgAt':moment()[_0xa198('0xa6')](_0xa198('0xb9')),'lastMsgDirection':_0xa198('0xb8'),'Messages':[_[_0xa198('0x4f')](_0x49bc29['body'],{'messageId':_0x4acdda[_0xa198('0xb4')],'sentAt':moment()[_0xa198('0xa6')](_0xa198('0xb9')),'read':!![],'MailAccountId':_0x3fc878['id'],'UserId':_0x49bc29[_0xa198('0x72')]['id'],'ContactId':_0x31587e['id']})]};if(_0x49bc29[_0xa198('0x5b')][_0xa198('0xba')]){_0x24f3c5=_['merge'](_0x24f3c5,_0x49bc29[_0xa198('0x5b')][_0xa198('0xba')]);}return db[_0xa198('0x87')][_0xa198('0x62')](_0x24f3c5,{'include':[{'model':db['MailMessage'],'as':_0xa198('0xbb')}]});}})[_0xa198('0x1e')](respondWithResult(_0x321026,null))['catch'](handleError(_0x321026,null));};exports[_0xa198('0xbc')]=function(_0x3e5ba3,_0x26c052,_0xa1e5bb){return db[_0xa198('0x3e')]['find']({'where':{'id':_0x3e5ba3[_0xa198('0x60')]['id']},'include':[{'model':db[_0xa198('0x5d')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x26c052,null))[_0xa198('0x1e')](function(_0x63c521){if(_0x63c521&&_0x63c521[_0xa198('0x3d')]){var _0x108d11={'id':_0x63c521['id'],'tls':{'rejectUnauthorized':![]}};if(_0x63c521[_0xa198('0x3d')][_0xa198('0x79')]){_0x108d11[_0xa198('0x79')]=_0x63c521[_0xa198('0x3d')][_0xa198('0x79')];}else{_0x108d11[_0xa198('0x77')]=_0x63c521[_0xa198('0x3d')]['host'];_0x108d11[_0xa198('0x78')]=_0x63c521[_0xa198('0x3d')]['port'];_0x108d11['secure']=_0x63c521[_0xa198('0x3d')][_0xa198('0xaf')];}if(_0x63c521[_0xa198('0x3d')][_0xa198('0x76')]){_0x108d11[_0xa198('0xae')]={'user':_0x63c521[_0xa198('0x3d')]['user'],'pass':_0x63c521[_0xa198('0x3d')][_0xa198('0x75')]};}return respondWithRpcPromise(_0xa198('0xbd'),_0xa198('0xbc'),{'account':_0x108d11});}})['then'](respondWithResult(_0x26c052,null))[_0xa198('0x28')](handleError(_0x26c052,null));};exports[_0xa198('0xbe')]=function(_0x4e767a,_0x3086f0){return db['MailAccount'][_0xa198('0x5c')]({'where':{'id':_0x4e767a[_0xa198('0x60')]['id']}})['then'](handleEntityNotFound(_0x3086f0,null))[_0xa198('0x1e')](function(_0x25d5f2){if(_0x25d5f2&&_0x25d5f2[_0xa198('0x79')]){throw new db['Sequelize'][(_0xa198('0xbf'))](_0xa198('0xc0'));}return _0x25d5f2;})[_0xa198('0x1e')](removeEntity(_0x3086f0,null))[_0xa198('0x28')](handleError(_0x3086f0,null));};exports['addAgents']=function(_0x547a8,_0x543106,_0x15232d){return db[_0xa198('0x3e')][_0xa198('0x5c')]({'where':{'id':_0x547a8[_0xa198('0x60')]['id']}})['then'](handleEntityNotFound(_0x543106,null))[_0xa198('0x1e')](function(_0xb3ef86){if(_0xb3ef86){return _0xb3ef86[_0xa198('0xc1')](_0x547a8[_0xa198('0x5b')][_0xa198('0x68')],_[_0xa198('0x89')](_0x547a8['body'],[_0xa198('0x68'),'id'])||{})[_0xa198('0xc2')](function(_0x16a4cd){for(var _0x124a4a=0x0;_0x124a4a<_0x547a8[_0xa198('0x5b')][_0xa198('0x68')]['length'];_0x124a4a+=0x1){socket[_0xa198('0xc3')]('userMailAccount:save',{'UserId':Number(_0x547a8['body'][_0xa198('0x68')][_0x124a4a]),'MailAccountId':Number(_0x547a8['params']['id'])});}return _0x16a4cd;});}})[_0xa198('0x1e')](respondWithResult(_0x543106,null))['catch'](handleError(_0x543106,null));};exports[_0xa198('0xc4')]=function(_0x5541a9,_0x18ea6f,_0x5daa2f){return db['MailAccount']['find']({'where':{'id':_0x5541a9[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x18ea6f,null))[_0xa198('0x1e')](function(_0x2eb645){if(_0x2eb645){return _0x2eb645[_0xa198('0xc4')](_0x5541a9[_0xa198('0x42')][_0xa198('0x68')])[_0xa198('0x1e')](function(){if(_[_0xa198('0xc5')](_0x5541a9[_0xa198('0x42')]['ids'])){for(var _0x386bd1=0x0;_0x386bd1<_0x5541a9[_0xa198('0x42')]['ids'][_0xa198('0x48')];_0x386bd1+=0x1){socket[_0xa198('0xc3')](_0xa198('0xc6'),{'UserId':Number(_0x5541a9[_0xa198('0x42')]['ids'][_0x386bd1]),'MailAccountId':Number(_0x5541a9[_0xa198('0x60')]['id'])});}}else{socket[_0xa198('0xc3')](_0xa198('0xc6'),{'UserId':Number(_0x5541a9[_0xa198('0x42')][_0xa198('0x68')]),'MailAccountId':Number(_0x5541a9[_0xa198('0x60')]['id'])});}});}})[_0xa198('0x1e')](respondWithStatusCode(_0x18ea6f,null))[_0xa198('0x28')](handleError(_0x18ea6f,null));};exports[_0xa198('0xc7')]=function(_0x269fe7,_0x186acf,_0x40f0ab){var _0x1f0aef={};var _0x3507de={};var _0x1bb038;var _0x37ca36;return db[_0xa198('0x3e')][_0xa198('0x64')]({'where':{'id':_0x269fe7[_0xa198('0x60')]['id']}})[_0xa198('0x1e')](handleEntityNotFound(_0x186acf,null))[_0xa198('0x1e')](function(_0x2ac359){if(_0x2ac359){_0x1bb038=_0x2ac359;_0x3507de[_0xa198('0x40')]=_[_0xa198('0x43')](db['User']['rawAttributes']);_0x3507de[_0xa198('0x42')]=_['keys'](_0x269fe7[_0xa198('0x42')]);_0x3507de[_0xa198('0x44')]=_[_0xa198('0x45')](_0x3507de[_0xa198('0x40')],_0x3507de[_0xa198('0x42')]);_0x1f0aef[_0xa198('0x46')]=_[_0xa198('0x45')](_0x3507de[_0xa198('0x40')],qs[_0xa198('0x47')](_0x269fe7[_0xa198('0x42')][_0xa198('0x47')]));_0x1f0aef[_0xa198('0x46')]=_0x1f0aef[_0xa198('0x46')]['length']?_0x1f0aef[_0xa198('0x46')]:_0x3507de[_0xa198('0x40')];_0x1f0aef[_0xa198('0x4a')]=qs[_0xa198('0x4b')](_0x269fe7[_0xa198('0x42')][_0xa198('0x4b')]);_0x1f0aef[_0xa198('0x4c')]=qs[_0xa198('0x44')](_[_0xa198('0x4d')](_0x269fe7['query'],_0x3507de[_0xa198('0x44')]));if(_0x269fe7[_0xa198('0x42')][_0xa198('0x4e')]){_0x1f0aef[_0xa198('0x4c')]=_[_0xa198('0x4f')](_0x1f0aef[_0xa198('0x4c')],{'$or':_[_0xa198('0x41')](_0x1f0aef['attributes'],function(_0x5eba93){var _0x4353f1={};_0x4353f1[_0x5eba93]={'$like':'%'+_0x269fe7[_0xa198('0x42')][_0xa198('0x4e')]+'%'};return _0x4353f1;})});}_0x1f0aef=_[_0xa198('0x4f')]({},_0x1f0aef,_0x269fe7[_0xa198('0x52')]);return _0x1bb038[_0xa198('0xc7')](_0x1f0aef);}})[_0xa198('0x1e')](function(_0x1ec70c){if(_0x1ec70c){_0x37ca36=_0x1ec70c[_0xa198('0x48')];if(!_0x269fe7[_0xa198('0x42')][_0xa198('0x66')](_0xa198('0x49'))){_0x1f0aef['limit']=qs[_0xa198('0x2c')](_0x269fe7[_0xa198('0x42')][_0xa198('0x2c')]);_0x1f0aef[_0xa198('0x2e')]=qs[_0xa198('0x2e')](_0x269fe7[_0xa198('0x42')]['offset']);}return _0x1bb038[_0xa198('0xc7')](_0x1f0aef);}})[_0xa198('0x1e')](function(_0x5d71fe){if(_0x5d71fe){return _0x5d71fe?{'count':_0x37ca36,'rows':_0x5d71fe}:null;}})[_0xa198('0x1e')](respondWithResult(_0x186acf,null))[_0xa198('0x28')](handleError(_0x186acf,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 122b760..4be5d33 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 _0x2484=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x274509,_0x1353f7){var _0x47298c=function(_0x514eaf){while(--_0x514eaf){_0x274509['push'](_0x274509['shift']());}};_0x47298c(++_0x1353f7);}(_0x2484,0x1b9));var _0x4248=function(_0x5998d0,_0x24ad81){_0x5998d0=_0x5998d0-0x0;var _0x47149d=_0x2484[_0x5998d0];return _0x47149d;};'use strict';var EventEmitter=require(_0x4248('0x0'));var MailAccount=require(_0x4248('0x1'))['db'][_0x4248('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4248('0x3')](0x0);var events={'afterCreate':_0x4248('0x4'),'afterUpdate':'update','afterDestroy':_0x4248('0x5')};function emitEvent(_0x133fe1){return function(_0x1b3da0,_0x382a3a,_0x1c99d7){MailAccountEvents[_0x4248('0x6')](_0x133fe1+':'+_0x1b3da0['id'],_0x1b3da0);MailAccountEvents['emit'](_0x133fe1,_0x1b3da0);_0x1c99d7(null);};}for(var e in events){if(events[_0x4248('0x7')](e)){var event=events[e];MailAccount[_0x4248('0x8')](e,emitEvent(event));}}module[_0x4248('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x3c54=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0x3c54,0x14d));var _0x43c5=function(_0x28ca77,_0x4fd794){_0x28ca77=_0x28ca77-0x0;var _0x30f74f=_0x3c54[_0x28ca77];return _0x30f74f;};'use strict';var EventEmitter=require(_0x43c5('0x0'));var MailAccount=require(_0x43c5('0x1'))['db'][_0x43c5('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x43c5('0x3')](0x0);var events={'afterCreate':_0x43c5('0x4'),'afterUpdate':_0x43c5('0x5'),'afterDestroy':_0x43c5('0x6')};function emitEvent(_0x4317f9){return function(_0xe50b04,_0x5cc703,_0x564843){MailAccountEvents[_0x43c5('0x7')](_0x4317f9+':'+_0xe50b04['id'],_0xe50b04);MailAccountEvents['emit'](_0x4317f9,_0xe50b04);_0x564843(null);};}for(var e in events){if(events[_0x43c5('0x8')](e)){var event=events[e];MailAccount['hook'](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 d1e7546..fdafe6b 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 _0xd966=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','lodash'];(function(_0x2f7a96,_0x2b116c){var _0x460743=function(_0x4e7d2d){while(--_0x4e7d2d){_0x2f7a96['push'](_0x2f7a96['shift']());}};_0x460743(++_0x2b116c);}(_0xd966,0x16b));var _0x6d96=function(_0x5d1c0a,_0x39b381){_0x5d1c0a=_0x5d1c0a-0x0;var _0x6ba1b=_0xd966[_0x5d1c0a];return _0x6ba1b;};'use strict';var _=require(_0x6d96('0x0'));var util=require(_0x6d96('0x1'));var logger=require(_0x6d96('0x2'))(_0x6d96('0x3'));var moment=require(_0x6d96('0x4'));var BPromise=require(_0x6d96('0x5'));var rp=require(_0x6d96('0x6'));var fs=require('fs');var path=require(_0x6d96('0x7'));var rimraf=require(_0x6d96('0x8'));var config=require(_0x6d96('0x9'));var attributes=require(_0x6d96('0xa'));module[_0x6d96('0xb')]=function(_0x8a8467,_0x37d571){return _0x8a8467[_0x6d96('0xc')](_0x6d96('0xd'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc86f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','mail_accounts','util','api'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0xc86f,0x82));var _0xfc86=function(_0x4c8fa9,_0x2a1337){_0x4c8fa9=_0x4c8fa9-0x0;var _0x192648=_0xc86f[_0x4c8fa9];return _0x192648;};'use strict';var _=require('lodash');var util=require(_0xfc86('0x0'));var logger=require('../../config/logger')(_0xfc86('0x1'));var moment=require(_0xfc86('0x2'));var BPromise=require(_0xfc86('0x3'));var rp=require(_0xfc86('0x4'));var fs=require('fs');var path=require(_0xfc86('0x5'));var rimraf=require(_0xfc86('0x6'));var config=require(_0xfc86('0x7'));var attributes=require(_0xfc86('0x8'));module[_0xfc86('0x9')]=function(_0x251f89,_0x54f30a){return _0x251f89['define']('MailAccount',attributes,{'tableName':_0xfc86('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f27be53..0c36144 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 _0xe382=['GetMailAccount','MailAccount','findAll','options','where','limit','map','include','model','attributes','ShowMailAccount','raw','body','mail','difference','CmContact','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','updatedAt','DESC','MailApplication','MailServerOut','Smtp','get','account','omit','Applications','applications','orderBy','asc','autoclose','length','close','*,*,*,*','Contacts','defaults','List\x20not\x20found','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','then','MailInteraction','create','Contact\x20not\x20found','spread','update','subject','interaction','created','attachments','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','agent','name','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x1ed638,_0x38615b){var _0x3dfd30=function(_0x5d8bbe){while(--_0x5d8bbe){_0x1ed638['push'](_0x1ed638['shift']());}};_0x3dfd30(++_0x38615b);}(_0xe382,0x17d));var _0x2e38=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0xe382[_0x737a1f];return _0x16eba1;};'use strict';var _=require(_0x2e38('0x0'));var util=require('util');var moment=require(_0x2e38('0x1'));var BPromise=require(_0x2e38('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e38('0x3'));var db=require(_0x2e38('0x4'))['db'];var utils=require(_0x2e38('0x5'));var logger=require('../../config/logger')(_0x2e38('0x6'));var config=require(_0x2e38('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});config[_0x2e38('0x8')]=_['defaults'](config[_0x2e38('0x8')],{'host':_0x2e38('0x9'),'port':0x18eb});var socket=require(_0x2e38('0xa'))(new Redis(config[_0x2e38('0x8')]));require(_0x2e38('0xb'))[_0x2e38('0xc')](socket);function respondWithRpcPromise(_0x420fe6,_0x4c0941,_0x38131a){return new BPromise(function(_0x27372f,_0xd92ad6){return client[_0x2e38('0xd')](_0x420fe6,_0x38131a)['then'](function(_0x328f14){logger['info'](_0x2e38('0xe'),_0x4c0941,_0x2e38('0xf'));logger[_0x2e38('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4c0941,_0x2e38('0xf'),JSON[_0x2e38('0x11')](_0x328f14));if(_0x328f14[_0x2e38('0x12')]){if(_0x328f14[_0x2e38('0x12')][_0x2e38('0x13')]===0x1f4){logger[_0x2e38('0x12')](_0x2e38('0xe'),_0x4c0941,_0x328f14[_0x2e38('0x12')]['message']);return _0xd92ad6(_0x328f14['error'][_0x2e38('0x14')]);}logger[_0x2e38('0x12')](_0x2e38('0xe'),_0x4c0941,_0x328f14[_0x2e38('0x12')][_0x2e38('0x14')]);return _0x27372f(_0x328f14[_0x2e38('0x12')][_0x2e38('0x14')]);}else{logger['info'](_0x2e38('0xe'),_0x4c0941,_0x2e38('0xf'));_0x27372f(_0x328f14[_0x2e38('0x15')][_0x2e38('0x14')]);}})[_0x2e38('0x16')](function(_0x1dc01c){logger[_0x2e38('0x12')](_0x2e38('0xe'),_0x4c0941,_0x1dc01c);_0xd92ad6(_0x1dc01c);});});}exports[_0x2e38('0x17')]=function(_0x51a611){var _0x380589=this;return new Promise(function(_0x50ec7e,_0x848208){return db[_0x2e38('0x18')][_0x2e38('0x19')]({'raw':_0x51a611[_0x2e38('0x1a')]?_0x51a611[_0x2e38('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x51a611[_0x2e38('0x1a')]?_0x51a611[_0x2e38('0x1a')][_0x2e38('0x1b')]||null:null,'attributes':_0x51a611[_0x2e38('0x1a')]?_0x51a611[_0x2e38('0x1a')]['attributes']||null:null,'limit':_0x51a611[_0x2e38('0x1a')]?_0x51a611[_0x2e38('0x1a')][_0x2e38('0x1c')]||null:null,'include':_0x51a611[_0x2e38('0x1a')]?_0x51a611[_0x2e38('0x1a')]['include']?_[_0x2e38('0x1d')](_0x51a611[_0x2e38('0x1a')][_0x2e38('0x1e')],function(_0x1034e3){return{'model':db[_0x1034e3[_0x2e38('0x1f')]],'as':_0x1034e3['as'],'attributes':_0x1034e3[_0x2e38('0x20')],'include':_0x1034e3[_0x2e38('0x1e')]?_['map'](_0x1034e3['include'],function(_0x2ee853){return{'model':db[_0x2ee853['model']],'as':_0x2ee853['as'],'attributes':_0x2ee853[_0x2e38('0x20')],'include':_0x2ee853['include']?_[_0x2e38('0x1d')](_0x2ee853[_0x2e38('0x1e')],function(_0x33a3e6){return{'model':db[_0x33a3e6[_0x2e38('0x1f')]],'as':_0x33a3e6['as'],'attributes':_0x33a3e6[_0x2e38('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bd482){logger['info'](_0x2e38('0x17'),_0x51a611);logger[_0x2e38('0x10')]('GetMailAccount',_0x51a611,JSON['stringify'](_0x1bd482));_0x50ec7e(_0x1bd482);})[_0x2e38('0x16')](function(_0x5dc98b){logger[_0x2e38('0x12')](_0x2e38('0x17'),_0x5dc98b[_0x2e38('0x14')],_0x51a611);_0x848208(_0x380589[_0x2e38('0x12')](0x1f4,_0x5dc98b[_0x2e38('0x14')]));});});};exports[_0x2e38('0x21')]=function(_0x18b6f5){var _0x4cef7c=this;return new Promise(function(_0x2b383c,_0x54d271){return db['MailAccount']['find']({'raw':_0x18b6f5['options']?_0x18b6f5[_0x2e38('0x1a')][_0x2e38('0x22')]===undefined?!![]:![]:!![],'where':_0x18b6f5[_0x2e38('0x1a')]?_0x18b6f5[_0x2e38('0x1a')][_0x2e38('0x1b')]||null:null,'attributes':_0x18b6f5[_0x2e38('0x1a')]?_0x18b6f5[_0x2e38('0x1a')][_0x2e38('0x20')]||null:null,'include':_0x18b6f5['options']?_0x18b6f5[_0x2e38('0x1a')][_0x2e38('0x1e')]?_[_0x2e38('0x1d')](_0x18b6f5[_0x2e38('0x1a')][_0x2e38('0x1e')],function(_0x5302ca){return{'model':db[_0x5302ca['model']],'as':_0x5302ca['as'],'attributes':_0x5302ca['attributes'],'include':_0x5302ca[_0x2e38('0x1e')]?_[_0x2e38('0x1d')](_0x5302ca['include'],function(_0x16849b){return{'model':db[_0x16849b[_0x2e38('0x1f')]],'as':_0x16849b['as'],'attributes':_0x16849b['attributes'],'include':_0x16849b[_0x2e38('0x1e')]?_['map'](_0x16849b[_0x2e38('0x1e')],function(_0xdea787){return{'model':db[_0xdea787[_0x2e38('0x1f')]],'as':_0xdea787['as'],'attributes':_0xdea787['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2adf){logger['info']('ShowMailAccount',_0x18b6f5);logger[_0x2e38('0x10')](_0x2e38('0x21'),_0x18b6f5,JSON[_0x2e38('0x11')](_0x2d2adf));_0x2b383c(_0x2d2adf);})[_0x2e38('0x16')](function(_0x2b68b1){logger[_0x2e38('0x12')]('ShowMailAccount',_0x2b68b1[_0x2e38('0x14')],_0x18b6f5);_0x54d271(_0x4cef7c['error'](0x1f4,_0x2b68b1[_0x2e38('0x14')]));});});};exports['NotifyMailAccount']=function(_0x3e8063){var _0x3bc322=this;return new Promise(function(_0x2a5ca2,_0x5648ab){var _0xb4b9ce={'body':_0x3e8063[_0x2e38('0x23')],'channel':_0x2e38('0x24')};var _0x1eb6f1=_[_0x2e38('0x25')](_['keys'](db[_0x2e38('0x26')]['rawAttributes']),[_0x2e38('0x27'),'updatedAt',_0x2e38('0x28'),_0x2e38('0x29')]);var _0x19082f=![];if(_0x3e8063['body']['id']){delete _0x3e8063['body']['id'];}if(_[_0x2e38('0x2a')](_0x3e8063['body'][_0x2e38('0x2b')])){return _0x5648ab(_0x3bc322[_0x2e38('0x12')](0x1f4,_0x2e38('0x2c')));}if(_[_0x2e38('0x2a')](_0x3e8063[_0x2e38('0x23')]['body'])||_0x3e8063[_0x2e38('0x23')]['body']===''){return _0x5648ab(_0x3bc322[_0x2e38('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x2e38('0x2a')](_0x3e8063['body'][_0x2e38('0x2d')])){return _0x5648ab(_0x3bc322[_0x2e38('0x12')](0x1f4,_0x2e38('0x2e')+_0x1eb6f1));}if(!_[_0x2e38('0x2f')](_0x1eb6f1,_0x3e8063[_0x2e38('0x23')][_0x2e38('0x2d')])){return _0x5648ab(_0x3bc322[_0x2e38('0x12')](0x1f4,_0x2e38('0x30')+_0x1eb6f1));}var _0x35ffb8={};_0x35ffb8[_0x3e8063[_0x2e38('0x23')]['mapKey']]=_0x3e8063['body']['from'];return db['MailAccount'][_0x2e38('0x31')]({'where':{'id':_0x3e8063['account']['id']},'include':[{'model':db[_0x2e38('0x32')],'as':_0x2e38('0x33'),'include':[{'model':db[_0x2e38('0x26')],'as':'Contacts','where':_0x35ffb8,'limit':0x1,'order':[[_0x2e38('0x34'),_0x2e38('0x35')]]}]},{'model':db[_0x2e38('0x36')],'as':'Applications'},{'model':db[_0x2e38('0x37')],'as':_0x2e38('0x38')}]})['then'](function(_0x380ead){if(_0x380ead&&_0x380ead[_0x2e38('0x33')]){var _0x5de70a=_0x380ead[_0x2e38('0x39')]({'plain':!![]});_0xb4b9ce[_0x2e38('0x3a')]=_[_0x2e38('0x3b')](_0x5de70a,[_0x2e38('0x3c'),_0x2e38('0x33')]);_0xb4b9ce['applications']=_0x5de70a['Applications'];_0xb4b9ce['list']=_0x5de70a[_0x2e38('0x33')];_0xb4b9ce[_0x2e38('0x3d')]=_[_0x2e38('0x3e')](_0xb4b9ce[_0x2e38('0x3d')],['priority'],[_0x2e38('0x3f')]);if(_0xb4b9ce[_0x2e38('0x3a')]&&_0xb4b9ce[_0x2e38('0x3a')][_0x2e38('0x40')]){_0xb4b9ce[_0x2e38('0x3d')]['push']({'id':0x0,'priority':_0xb4b9ce[_0x2e38('0x3d')][_0x2e38('0x41')]+0x1,'app':_0x2e38('0x42'),'appdata':'autoclose','interval':_0x2e38('0x43')});}if(_0xb4b9ce[_0x2e38('0x3a')]['Applications']){delete _0xb4b9ce[_0x2e38('0x3a')][_0x2e38('0x3c')];}if(_0xb4b9ce[_0x2e38('0x3a')][_0x2e38('0x33')]){delete _0xb4b9ce[_0x2e38('0x3a')][_0x2e38('0x33')];}if(_0x5de70a['List'][_0x2e38('0x44')][_0x2e38('0x41')]){return _0x5de70a[_0x2e38('0x33')][_0x2e38('0x44')][0x0];}var _0x1c4118=_[_0x2e38('0x45')](_0x3e8063['body'],{'firstName':_0x3e8063['body'][_0x2e38('0x2b')],'ListId':_0x5de70a['ListId']});_0x1c4118[_0x3e8063[_0x2e38('0x23')][_0x2e38('0x2d')]]=_0x3e8063[_0x2e38('0x23')][_0x2e38('0x2b')];return db['CmContact']['create'](_0x1c4118);}else{throw new Error(_0x2e38('0x46'));}})['then'](function(_0x2c3398){_0xb4b9ce[_0x2e38('0x47')]=_0x2c3398;if(_0x2c3398){if(!_0x3e8063['body'][_0x2e38('0x14')]['messageId']){_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x48')]=rs['generate']()+'\x20'+_0x3e8063['body'][_0x2e38('0x14')][_0x2e38('0x2b')];}var _0x2f3de8={'ContactId':_0x2c3398['id'],'MailAccountId':_0x3e8063['account']['id'],'inReplyTo':_0x3e8063[_0x2e38('0x23')]['message']['messageId'],'to':_0x3e8063[_0x2e38('0x23')]['message']['from'],'cc':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')]['cc'],'subject':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')]['subject'],'attach':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x49')],'lastMsgAt':moment()[_0x2e38('0x4a')](_0x2e38('0x4b')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x2e38('0x31')]({'where':{'closed':![],'MailAccountId':_0x3e8063[_0x2e38('0x3a')]['id']},'include':[{'model':db[_0x2e38('0x4c')],'as':_0x2e38('0x4d'),'attributes':[_0x2e38('0x48')],'where':{'messageId':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x4e')]}}]})[_0x2e38('0x4f')](function(_0x4bfefd){if(_0x4bfefd){return[_0x4bfefd,![]];}return db[_0x2e38('0x50')][_0x2e38('0x51')](_0x2f3de8)[_0x2e38('0x4f')](function(_0x112816){return[_0x112816,!![]];});});}else{throw new Error(_0x2e38('0x52'));}})[_0x2e38('0x53')](function(_0x3826d4,_0x9fb992){if(_0x3826d4){_0x19082f=_0x9fb992;if(!_0x9fb992){return _0x3826d4[_0x2e38('0x54')]({'inReplyTo':_0x3e8063['body']['message'][_0x2e38('0x48')],'to':_0x3e8063['body'][_0x2e38('0x14')]['from'],'cc':_0x3e8063['body'][_0x2e38('0x14')]['cc'],'subject':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x55')],'attach':_0x3826d4['attach']?_0x3826d4[_0x2e38('0x49')]:_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x49')],'substatus':null,'substatusAt':moment()['format'](_0x2e38('0x4b')),'lastMsgAt':moment()[_0x2e38('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x3826d4;}}})[_0x2e38('0x4f')](function(_0x32a725){_0xb4b9ce['interaction']=_0x32a725['get']({'plain':!![]});_0xb4b9ce[_0x2e38('0x56')][_0x2e38('0x57')]=_0x19082f;return db[_0x2e38('0x4c')]['create']({'body':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x23')],'MailAccountId':_0x3e8063[_0x2e38('0x3a')]['id'],'MailInteractionId':_0x32a725['id'],'direction':'in','ContactId':_0xb4b9ce[_0x2e38('0x47')]['id'],'messageId':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x48')],'from':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x2b')],'to':_0x3e8063[_0x2e38('0x23')]['message']['to'],'cc':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')]['cc'],'subject':_0x3e8063[_0x2e38('0x23')]['message']['subject'],'attach':_0x3e8063[_0x2e38('0x23')]['message']['attach'],'Attachments':_0x3e8063[_0x2e38('0x23')]['message'][_0x2e38('0x58')],'originTo':_0x3e8063['body'][_0x2e38('0x14')][_0x2e38('0x59')],'originCc':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x5a')],'bcc':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x5b')],'ChatWebsiteId':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')]['ChatWebsiteId']||null,'originChannel':_0x3e8063[_0x2e38('0x23')]['message'][_0x2e38('0x5c')]||'Email','ChatOfflineMessageId':_0x3e8063[_0x2e38('0x23')][_0x2e38('0x14')][_0x2e38('0x5d')]||null},{'include':[{'model':db[_0x2e38('0x5e')],'as':_0x2e38('0x5f')}]});})['then'](function(_0x3744b1){_0xb4b9ce['message']=_0x3744b1;if(_0xb4b9ce[_0x2e38('0x56')]['UserId']){return db['User'][_0x2e38('0x31')]({'attributes':['id','name'],'where':{'id':_0xb4b9ce['interaction'][_0x2e38('0x60')]}})['then'](function(_0x20e5dc){if(_0x20e5dc){_0xb4b9ce[_0x2e38('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2e38('0x61'),'appdata':_0x20e5dc[_0x2e38('0x62')]+','+(_0xb4b9ce[_0x2e38('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2e38('0x63'),'startRouting',_0xb4b9ce);});}return respondWithRpcPromise(_0x2e38('0x63'),_0x2e38('0x64'),_0xb4b9ce);})[_0x2e38('0x4f')](function(_0x5a68e6){_0x2a5ca2(_0x5a68e6);})[_0x2e38('0x16')](function(_0x562b34){_0x5648ab(_0x3bc322[_0x2e38('0x12')](0x1f4,_0x562b34[_0x2e38('0x14')]));});});}; \ No newline at end of file +var _0x1e09=['options','attributes','limit','include','model','map','then','GetMailAccount','stringify','ShowMailAccount','raw','where','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','includes','find','account','CmList','List','updatedAt','DESC','MailApplication','Smtp','Applications','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','Contacts','defaults','create','List\x20not\x20found','contact','messageId','generate','attach','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','MailAccount','findAll'];(function(_0x4d67b0,_0x52d61c){var _0x2e485c=function(_0x5a865f){while(--_0x5a865f){_0x4d67b0['push'](_0x4d67b0['shift']());}};_0x2e485c(++_0x52d61c);}(_0x1e09,0xbb));var _0x91e0=function(_0x4ad4da,_0x36f574){_0x4ad4da=_0x4ad4da-0x0;var _0x4dc8ad=_0x1e09[_0x4ad4da];return _0x4dc8ad;};'use strict';var _=require(_0x91e0('0x0'));var util=require(_0x91e0('0x1'));var moment=require('moment');var BPromise=require(_0x91e0('0x2'));var rs=require(_0x91e0('0x3'));var fs=require('fs');var Redis=require(_0x91e0('0x4'));var db=require(_0x91e0('0x5'))['db'];var utils=require(_0x91e0('0x6'));var logger=require(_0x91e0('0x7'))(_0x91e0('0x8'));var config=require(_0x91e0('0x9'));var jayson=require(_0x91e0('0xa'));var client=jayson['client'][_0x91e0('0xb')]({'port':0x232c});config[_0x91e0('0xc')]=_['defaults'](config[_0x91e0('0xc')],{'host':_0x91e0('0xd'),'port':0x18eb});var socket=require(_0x91e0('0xe'))(new Redis(config[_0x91e0('0xc')]));require(_0x91e0('0xf'))[_0x91e0('0x10')](socket);function respondWithRpcPromise(_0x5044d5,_0x29d662,_0xe5a86c){return new BPromise(function(_0x671bef,_0x2bda3d){return client[_0x91e0('0x11')](_0x5044d5,_0xe5a86c)['then'](function(_0x51f4b2){logger[_0x91e0('0x12')](_0x91e0('0x13'),_0x29d662,'request\x20sent');logger[_0x91e0('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x29d662,_0x91e0('0x15'),JSON['stringify'](_0x51f4b2));if(_0x51f4b2[_0x91e0('0x16')]){if(_0x51f4b2[_0x91e0('0x16')][_0x91e0('0x17')]===0x1f4){logger[_0x91e0('0x16')](_0x91e0('0x13'),_0x29d662,_0x51f4b2[_0x91e0('0x16')][_0x91e0('0x18')]);return _0x2bda3d(_0x51f4b2[_0x91e0('0x16')][_0x91e0('0x18')]);}logger[_0x91e0('0x16')](_0x91e0('0x13'),_0x29d662,_0x51f4b2[_0x91e0('0x16')][_0x91e0('0x18')]);return _0x671bef(_0x51f4b2['error'][_0x91e0('0x18')]);}else{logger[_0x91e0('0x12')](_0x91e0('0x13'),_0x29d662,_0x91e0('0x15'));_0x671bef(_0x51f4b2[_0x91e0('0x19')][_0x91e0('0x18')]);}})[_0x91e0('0x1a')](function(_0x4cd09f){logger[_0x91e0('0x16')](_0x91e0('0x13'),_0x29d662,_0x4cd09f);_0x2bda3d(_0x4cd09f);});});}exports['GetMailAccount']=function(_0x1fc924){var _0x52eb1f=this;return new Promise(function(_0x76759a,_0x3aa3b4){return db[_0x91e0('0x1b')][_0x91e0('0x1c')]({'raw':_0x1fc924['options']?_0x1fc924[_0x91e0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1fc924[_0x91e0('0x1d')]?_0x1fc924[_0x91e0('0x1d')]['where']||null:null,'attributes':_0x1fc924['options']?_0x1fc924[_0x91e0('0x1d')][_0x91e0('0x1e')]||null:null,'limit':_0x1fc924[_0x91e0('0x1d')]?_0x1fc924[_0x91e0('0x1d')][_0x91e0('0x1f')]||null:null,'include':_0x1fc924[_0x91e0('0x1d')]?_0x1fc924[_0x91e0('0x1d')][_0x91e0('0x20')]?_['map'](_0x1fc924[_0x91e0('0x1d')]['include'],function(_0x1275d2){return{'model':db[_0x1275d2[_0x91e0('0x21')]],'as':_0x1275d2['as'],'attributes':_0x1275d2[_0x91e0('0x1e')],'include':_0x1275d2[_0x91e0('0x20')]?_['map'](_0x1275d2['include'],function(_0x17add9){return{'model':db[_0x17add9[_0x91e0('0x21')]],'as':_0x17add9['as'],'attributes':_0x17add9['attributes'],'include':_0x17add9['include']?_[_0x91e0('0x22')](_0x17add9['include'],function(_0x44c7e6){return{'model':db[_0x44c7e6[_0x91e0('0x21')]],'as':_0x44c7e6['as'],'attributes':_0x44c7e6[_0x91e0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x91e0('0x23')](function(_0x3e3c7b){logger[_0x91e0('0x12')](_0x91e0('0x24'),_0x1fc924);logger[_0x91e0('0x14')](_0x91e0('0x24'),_0x1fc924,JSON[_0x91e0('0x25')](_0x3e3c7b));_0x76759a(_0x3e3c7b);})['catch'](function(_0x7405ab){logger[_0x91e0('0x16')]('GetMailAccount',_0x7405ab[_0x91e0('0x18')],_0x1fc924);_0x3aa3b4(_0x52eb1f['error'](0x1f4,_0x7405ab[_0x91e0('0x18')]));});});};exports[_0x91e0('0x26')]=function(_0x4048ea){var _0x6a8d52=this;return new Promise(function(_0x3b4796,_0x1a60ea){return db[_0x91e0('0x1b')]['find']({'raw':_0x4048ea[_0x91e0('0x1d')]?_0x4048ea[_0x91e0('0x1d')][_0x91e0('0x27')]===undefined?!![]:![]:!![],'where':_0x4048ea[_0x91e0('0x1d')]?_0x4048ea[_0x91e0('0x1d')][_0x91e0('0x28')]||null:null,'attributes':_0x4048ea['options']?_0x4048ea['options'][_0x91e0('0x1e')]||null:null,'include':_0x4048ea[_0x91e0('0x1d')]?_0x4048ea['options'][_0x91e0('0x20')]?_[_0x91e0('0x22')](_0x4048ea[_0x91e0('0x1d')][_0x91e0('0x20')],function(_0x6416ad){return{'model':db[_0x6416ad[_0x91e0('0x21')]],'as':_0x6416ad['as'],'attributes':_0x6416ad[_0x91e0('0x1e')],'include':_0x6416ad[_0x91e0('0x20')]?_[_0x91e0('0x22')](_0x6416ad[_0x91e0('0x20')],function(_0x379918){return{'model':db[_0x379918['model']],'as':_0x379918['as'],'attributes':_0x379918[_0x91e0('0x1e')],'include':_0x379918[_0x91e0('0x20')]?_[_0x91e0('0x22')](_0x379918[_0x91e0('0x20')],function(_0x18270e){return{'model':db[_0x18270e[_0x91e0('0x21')]],'as':_0x18270e['as'],'attributes':_0x18270e[_0x91e0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x91e0('0x23')](function(_0xd84e17){logger[_0x91e0('0x12')](_0x91e0('0x26'),_0x4048ea);logger[_0x91e0('0x14')](_0x91e0('0x26'),_0x4048ea,JSON['stringify'](_0xd84e17));_0x3b4796(_0xd84e17);})[_0x91e0('0x1a')](function(_0x2ff276){logger[_0x91e0('0x16')](_0x91e0('0x26'),_0x2ff276[_0x91e0('0x18')],_0x4048ea);_0x1a60ea(_0x6a8d52['error'](0x1f4,_0x2ff276[_0x91e0('0x18')]));});});};exports[_0x91e0('0x29')]=function(_0x25b134){var _0x307a43=this;return new Promise(function(_0x242d0a,_0xb463f2){var _0x1ad0e4={'body':_0x25b134[_0x91e0('0x2a')],'channel':_0x91e0('0x2b')};var _0x20168f=_[_0x91e0('0x2c')](_[_0x91e0('0x2d')](db[_0x91e0('0x2e')][_0x91e0('0x2f')]),[_0x91e0('0x30'),'updatedAt',_0x91e0('0x31'),_0x91e0('0x32')]);var _0x5ad083=![];if(_0x25b134[_0x91e0('0x2a')]['id']){delete _0x25b134[_0x91e0('0x2a')]['id'];}if(_['isNil'](_0x25b134['body'][_0x91e0('0x33')])){return _0xb463f2(_0x307a43[_0x91e0('0x16')](0x1f4,_0x91e0('0x34')));}if(_[_0x91e0('0x35')](_0x25b134[_0x91e0('0x2a')]['body'])||_0x25b134['body'][_0x91e0('0x2a')]===''){return _0xb463f2(_0x307a43[_0x91e0('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x25b134['body'][_0x91e0('0x36')])){return _0xb463f2(_0x307a43[_0x91e0('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x20168f));}if(!_[_0x91e0('0x37')](_0x20168f,_0x25b134[_0x91e0('0x2a')][_0x91e0('0x36')])){return _0xb463f2(_0x307a43[_0x91e0('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x20168f));}var _0x1a4d50={};_0x1a4d50[_0x25b134[_0x91e0('0x2a')][_0x91e0('0x36')]]=_0x25b134[_0x91e0('0x2a')][_0x91e0('0x33')];return db[_0x91e0('0x1b')][_0x91e0('0x38')]({'where':{'id':_0x25b134[_0x91e0('0x39')]['id']},'include':[{'model':db[_0x91e0('0x3a')],'as':_0x91e0('0x3b'),'include':[{'model':db[_0x91e0('0x2e')],'as':'Contacts','where':_0x1a4d50,'limit':0x1,'order':[[_0x91e0('0x3c'),_0x91e0('0x3d')]]}]},{'model':db[_0x91e0('0x3e')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x91e0('0x3f')}]})['then'](function(_0x51e1ab){if(_0x51e1ab&&_0x51e1ab['List']){var _0x30c1c4=_0x51e1ab['get']({'plain':!![]});_0x1ad0e4[_0x91e0('0x39')]=_['omit'](_0x30c1c4,[_0x91e0('0x40'),_0x91e0('0x3b')]);_0x1ad0e4[_0x91e0('0x41')]=_0x30c1c4[_0x91e0('0x40')];_0x1ad0e4[_0x91e0('0x42')]=_0x30c1c4[_0x91e0('0x3b')];_0x1ad0e4['applications']=_[_0x91e0('0x43')](_0x1ad0e4[_0x91e0('0x41')],[_0x91e0('0x44')],[_0x91e0('0x45')]);if(_0x1ad0e4['account']&&_0x1ad0e4['account'][_0x91e0('0x46')]){_0x1ad0e4['applications'][_0x91e0('0x47')]({'id':0x0,'priority':_0x1ad0e4[_0x91e0('0x41')]['length']+0x1,'app':_0x91e0('0x48'),'appdata':_0x91e0('0x46'),'interval':_0x91e0('0x49')});}if(_0x1ad0e4[_0x91e0('0x39')]['Applications']){delete _0x1ad0e4[_0x91e0('0x39')]['Applications'];}if(_0x1ad0e4[_0x91e0('0x39')][_0x91e0('0x3b')]){delete _0x1ad0e4[_0x91e0('0x39')]['List'];}if(_0x30c1c4['List'][_0x91e0('0x4a')]['length']){return _0x30c1c4[_0x91e0('0x3b')]['Contacts'][0x0];}var _0x107af2=_[_0x91e0('0x4b')](_0x25b134[_0x91e0('0x2a')],{'firstName':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x33')],'ListId':_0x30c1c4[_0x91e0('0x32')]});_0x107af2[_0x25b134[_0x91e0('0x2a')][_0x91e0('0x36')]]=_0x25b134[_0x91e0('0x2a')][_0x91e0('0x33')];return db[_0x91e0('0x2e')][_0x91e0('0x4c')](_0x107af2);}else{throw new Error(_0x91e0('0x4d'));}})['then'](function(_0x54ad8a){_0x1ad0e4[_0x91e0('0x4e')]=_0x54ad8a;if(_0x54ad8a){if(!_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')][_0x91e0('0x4f')]){_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')]['messageId']=rs[_0x91e0('0x50')]()+'\x20'+_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')][_0x91e0('0x33')];}var _0x260655={'ContactId':_0x54ad8a['id'],'MailAccountId':_0x25b134[_0x91e0('0x39')]['id'],'inReplyTo':_0x25b134['body'][_0x91e0('0x18')][_0x91e0('0x4f')],'to':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')][_0x91e0('0x33')],'cc':_0x25b134['body'][_0x91e0('0x18')]['cc'],'subject':_0x25b134[_0x91e0('0x2a')]['message']['subject'],'attach':_0x25b134[_0x91e0('0x2a')]['message'][_0x91e0('0x51')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x91e0('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x25b134[_0x91e0('0x39')]['id']},'include':[{'model':db[_0x91e0('0x53')],'as':_0x91e0('0x54'),'attributes':[_0x91e0('0x4f')],'where':{'messageId':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')][_0x91e0('0x55')]}}]})['then'](function(_0x18afe0){if(_0x18afe0){return[_0x18afe0,![]];}return db[_0x91e0('0x52')][_0x91e0('0x4c')](_0x260655)[_0x91e0('0x23')](function(_0x17560b){return[_0x17560b,!![]];});});}else{throw new Error(_0x91e0('0x56'));}})['spread'](function(_0x2e6fe4,_0x19d854){if(_0x2e6fe4){_0x5ad083=_0x19d854;if(!_0x19d854){return _0x2e6fe4[_0x91e0('0x57')]({'inReplyTo':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')][_0x91e0('0x4f')],'to':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')]['from'],'cc':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')]['cc'],'subject':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')][_0x91e0('0x58')],'attach':_0x2e6fe4[_0x91e0('0x51')]?_0x2e6fe4['attach']:_0x25b134['body'][_0x91e0('0x18')][_0x91e0('0x51')],'substatus':null,'substatusAt':moment()[_0x91e0('0x59')](_0x91e0('0x5a')),'lastMsgAt':moment()[_0x91e0('0x59')](_0x91e0('0x5a')),'lastMsgDirection':'in'});}else{return _0x2e6fe4;}}})['then'](function(_0x152936){_0x1ad0e4[_0x91e0('0x5b')]=_0x152936['get']({'plain':!![]});_0x1ad0e4[_0x91e0('0x5b')][_0x91e0('0x5c')]=_0x5ad083;return db['MailMessage'][_0x91e0('0x4c')]({'body':_0x25b134[_0x91e0('0x2a')]['body'],'MailAccountId':_0x25b134['account']['id'],'MailInteractionId':_0x152936['id'],'direction':'in','ContactId':_0x1ad0e4[_0x91e0('0x4e')]['id'],'messageId':_0x25b134['body'][_0x91e0('0x18')]['messageId'],'from':_0x25b134['body'][_0x91e0('0x18')][_0x91e0('0x33')],'to':_0x25b134[_0x91e0('0x2a')]['message']['to'],'cc':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')]['cc'],'subject':_0x25b134['body'][_0x91e0('0x18')][_0x91e0('0x58')],'attach':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')]['attach'],'Attachments':_0x25b134['body'][_0x91e0('0x18')]['attachments'],'originTo':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')][_0x91e0('0x5d')],'originCc':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')][_0x91e0('0x5e')],'bcc':_0x25b134['body'][_0x91e0('0x18')][_0x91e0('0x5f')],'ChatWebsiteId':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')]['ChatWebsiteId']||null,'originChannel':_0x25b134[_0x91e0('0x2a')][_0x91e0('0x18')][_0x91e0('0x60')]||_0x91e0('0x61'),'ChatOfflineMessageId':_0x25b134['body'][_0x91e0('0x18')][_0x91e0('0x62')]||null},{'include':[{'model':db[_0x91e0('0x63')],'as':_0x91e0('0x64')}]});})[_0x91e0('0x23')](function(_0x39f9f4){_0x1ad0e4[_0x91e0('0x18')]=_0x39f9f4;if(_0x1ad0e4[_0x91e0('0x5b')][_0x91e0('0x65')]){return db[_0x91e0('0x66')][_0x91e0('0x38')]({'attributes':['id',_0x91e0('0x67')],'where':{'id':_0x1ad0e4[_0x91e0('0x5b')][_0x91e0('0x65')]}})[_0x91e0('0x23')](function(_0xaca13f){if(_0xaca13f){_0x1ad0e4[_0x91e0('0x41')][_0x91e0('0x68')]({'id':0x0,'priority':0x0,'app':_0x91e0('0x69'),'appdata':_0xaca13f[_0x91e0('0x67')]+','+(_0x1ad0e4['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x91e0('0x6a'),_0x91e0('0x6b'),_0x1ad0e4);});}return respondWithRpcPromise(_0x91e0('0x6a'),_0x91e0('0x6b'),_0x1ad0e4);})[_0x91e0('0x23')](function(_0x4f0fd0){_0x242d0a(_0x4f0fd0);})[_0x91e0('0x1a')](function(_0x335084){_0xb463f2(_0x307a43[_0x91e0('0x16')](0x1f4,_0x335084[_0x91e0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 967fb71..3d7363e 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 _0x4e4c=['remove','update','emit','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x4d1101,_0x415b12){var _0x4fe135=function(_0x2266c1){while(--_0x2266c1){_0x4d1101['push'](_0x4d1101['shift']());}};_0x4fe135(++_0x415b12);}(_0x4e4c,0x176));var _0xc4e4=function(_0x4929cf,_0x310d7b){_0x4929cf=_0x4929cf-0x0;var _0x41f6a8=_0x4e4c[_0x4929cf];return _0x41f6a8;};'use strict';var MailAccountEvents=require(_0xc4e4('0x0'));var events=[_0xc4e4('0x1'),_0xc4e4('0x2'),_0xc4e4('0x3')];function createListener(_0x55da26,_0x239624){return function(_0x1b613d){_0x239624[_0xc4e4('0x4')](_0x55da26,_0x1b613d);};}function removeListener(_0x544e91,_0x28fd96){return function(){MailAccountEvents['removeListener'](_0x544e91,_0x28fd96);};}exports[_0xc4e4('0x5')]=function(_0x1a1e9a){for(var _0x4af822=0x0,_0x15383d=events[_0xc4e4('0x6')];_0x4af822<_0x15383d;_0x4af822++){var _0x38dc97=events[_0x4af822];var _0x581cd6=createListener(_0xc4e4('0x7')+_0x38dc97,_0x1a1e9a);MailAccountEvents['on'](_0x38dc97,_0x581cd6);}}; \ No newline at end of file +var _0x9be2=['./mailAccount.events','save','remove','emit','removeListener','register','length'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x9be2,0x85));var _0x29be=function(_0x311e6a,_0x26ec4a){_0x311e6a=_0x311e6a-0x0;var _0x51ca4f=_0x9be2[_0x311e6a];return _0x51ca4f;};'use strict';var MailAccountEvents=require(_0x29be('0x0'));var events=[_0x29be('0x1'),_0x29be('0x2'),'update'];function createListener(_0x4526cf,_0x1b30bc){return function(_0xbf2f62){_0x1b30bc[_0x29be('0x3')](_0x4526cf,_0xbf2f62);};}function removeListener(_0x3f4f2b,_0x2cbc7d){return function(){MailAccountEvents[_0x29be('0x4')](_0x3f4f2b,_0x2cbc7d);};}exports[_0x29be('0x5')]=function(_0x259217){for(var _0x29c580=0x0,_0x2e7936=events[_0x29be('0x6')];_0x29c580<_0x2e7936;_0x29c580++){var _0x4ea096=events[_0x29c580];var _0x40b061=createListener('mailAccount:'+_0x4ea096,_0x259217);MailAccountEvents['on'](_0x4ea096,_0x40b061);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 7b85c96..cfda80b 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 _0xc184=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','put','/:id','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x1ecbf1,_0x2cfdec){var _0x4f11a0=function(_0x56368e){while(--_0x56368e){_0x1ecbf1['push'](_0x1ecbf1['shift']());}};_0x4f11a0(++_0x2cfdec);}(_0xc184,0x1c8));var _0x4c18=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xc184[_0x2f87cd];return _0x5d7eda;};'use strict';var multer=require(_0x4c18('0x0'));var util=require(_0x4c18('0x1'));var path=require('path');var timeout=require(_0x4c18('0x2'));var express=require(_0x4c18('0x3'));var router=express[_0x4c18('0x4')]();var fs_extra=require(_0x4c18('0x5'));var auth=require(_0x4c18('0x6'));var interaction=require(_0x4c18('0x7'));var config=require(_0x4c18('0x8'));var controller=require(_0x4c18('0x9'));router[_0x4c18('0xa')]('/:id',auth[_0x4c18('0xb')](),controller['show']);router[_0x4c18('0xc')](_0x4c18('0xd'),auth[_0x4c18('0xb')](),controller['update']);router[_0x4c18('0xe')](_0x4c18('0xd'),auth[_0x4c18('0xb')](),controller[_0x4c18('0xf')]);module[_0x4c18('0x10')]=router; \ No newline at end of file +var _0x8809=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','exports','util','path','connect-timeout','express'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8809,0x1cc));var _0x9880=function(_0x72193d,_0x330a80){_0x72193d=_0x72193d-0x0;var _0x455d4f=_0x8809[_0x72193d];return _0x455d4f;};'use strict';var multer=require('multer');var util=require(_0x9880('0x0'));var path=require(_0x9880('0x1'));var timeout=require(_0x9880('0x2'));var express=require(_0x9880('0x3'));var router=express['Router']();var fs_extra=require(_0x9880('0x4'));var auth=require(_0x9880('0x5'));var interaction=require(_0x9880('0x6'));var config=require(_0x9880('0x7'));var controller=require(_0x9880('0x8'));router[_0x9880('0x9')](_0x9880('0xa'),auth['isAuthenticated'](),controller[_0x9880('0xb')]);router['put'](_0x9880('0xa'),auth[_0x9880('0xc')](),controller[_0x9880('0xd')]);router[_0x9880('0xe')](_0x9880('0xa'),auth[_0x9880('0xc')](),controller['destroy']);module[_0x9880('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 40bf0e6..eca02b4 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 _0x99e1=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x500439,_0x24b02e){var _0x476501=function(_0x1b92ca){while(--_0x1b92ca){_0x500439['push'](_0x500439['shift']());}};_0x476501(++_0x24b02e);}(_0x99e1,0xb7));var _0x199e=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x99e1[_0x4dcc2d];return _0x1bbd79;};'use strict';var Sequelize=require(_0x199e('0x0'));module[_0x199e('0x1')]={'priority':{'type':Sequelize[_0x199e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x199e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x199e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x199e('0x5')}}; \ No newline at end of file +var _0xc08b=['INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xc08b,0x1af));var _0xbc08=function(_0xb3b958,_0x301729){_0xb3b958=_0xb3b958-0x0;var _0x37b7d8=_0xc08b[_0xb3b958];return _0x37b7d8;};'use strict';var Sequelize=require(_0xbc08('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbc08('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbc08('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbc08('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbc08('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 1b8c6c5..480f60d 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x9844c2,_0x4a6e0a){_0x9844c2=_0x9844c2-0x0;var _0x425407=_0xbdb7[_0x9844c2];return _0x425407;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x2cd12f,_0x40ce5f){var _0x5e0d8b=function(_0x1490d4){while(--_0x1490d4){_0x2cd12f['push'](_0x2cd12f['shift']());}};_0x5e0d8b(++_0x40ce5f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x223e58,_0x512434){_0x223e58=_0x223e58-0x0;var _0x1e91c7=_0xf4eb[_0x223e58];return _0x1e91c7;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 23713b9..3a90f92 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 _0x3d45=['utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','mail_applications'];(function(_0x49c54c,_0x54a647){var _0x446225=function(_0x462f62){while(--_0x462f62){_0x49c54c['push'](_0x49c54c['shift']());}};_0x446225(++_0x54a647);}(_0x3d45,0x112));var _0x53d4=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3d45[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x53d4('0x0'));var util=require(_0x53d4('0x1'));var logger=require('../../config/logger')(_0x53d4('0x2'));var moment=require(_0x53d4('0x3'));var BPromise=require(_0x53d4('0x4'));var rp=require(_0x53d4('0x5'));var fs=require('fs');var path=require(_0x53d4('0x6'));var rimraf=require(_0x53d4('0x7'));var config=require(_0x53d4('0x8'));var attributes=require(_0x53d4('0x9'));module['exports']=function(_0x214daf,_0x19bed6){return _0x214daf[_0x53d4('0xa')]('MailApplication',attributes,{'tableName':_0x53d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x53d4('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x22d0=['define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','./mailApplication.attributes','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x22d0,0x6c));var _0x022d=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0x22d0[_0x445c98];return _0x2fe913;};'use strict';var _=require(_0x022d('0x0'));var util=require(_0x022d('0x1'));var logger=require(_0x022d('0x2'))(_0x022d('0x3'));var moment=require(_0x022d('0x4'));var BPromise=require('bluebird');var rp=require(_0x022d('0x5'));var fs=require('fs');var path=require(_0x022d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x022d('0x7'));module[_0x022d('0x8')]=function(_0x34c84b,_0x129a1a){return _0x34c84b[_0x022d('0x9')](_0x022d('0xa'),attributes,{'tableName':_0x022d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x022d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 98eb355..d952019 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 _0x9a31=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','body','options','raw','where','attributes','limit','debug','lodash','util','randomstring'];(function(_0x4d7e81,_0x36b75d){var _0x13ef4a=function(_0x4585f6){while(--_0x4585f6){_0x4d7e81['push'](_0x4d7e81['shift']());}};_0x13ef4a(++_0x36b75d);}(_0x9a31,0x1a1));var _0x19a3=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9a31[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x19a3('0x0'));var util=require(_0x19a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x19a3('0x2'));var fs=require('fs');var Redis=require(_0x19a3('0x3'));var db=require(_0x19a3('0x4'))['db'];var utils=require(_0x19a3('0x5'));var logger=require('../../config/logger')(_0x19a3('0x6'));var config=require(_0x19a3('0x7'));var jayson=require(_0x19a3('0x8'));var client=jayson[_0x19a3('0x9')][_0x19a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a878,_0xef9eb1,_0x5ac212){return new BPromise(function(_0x4c0291,_0x4d3833){return client[_0x19a3('0xb')](_0x18a878,_0x5ac212)[_0x19a3('0xc')](function(_0x2a1d86){logger[_0x19a3('0xd')](_0x19a3('0xe'),_0xef9eb1,_0x19a3('0xf'));logger['debug'](_0x19a3('0x10'),_0xef9eb1,_0x19a3('0xf'),JSON[_0x19a3('0x11')](_0x2a1d86));if(_0x2a1d86[_0x19a3('0x12')]){if(_0x2a1d86[_0x19a3('0x12')]['code']===0x1f4){logger[_0x19a3('0x12')](_0x19a3('0xe'),_0xef9eb1,_0x2a1d86[_0x19a3('0x12')][_0x19a3('0x13')]);return _0x4d3833(_0x2a1d86[_0x19a3('0x12')][_0x19a3('0x13')]);}logger['error'](_0x19a3('0xe'),_0xef9eb1,_0x2a1d86[_0x19a3('0x12')][_0x19a3('0x13')]);return _0x4c0291(_0x2a1d86[_0x19a3('0x12')]['message']);}else{logger[_0x19a3('0xd')](_0x19a3('0xe'),_0xef9eb1,_0x19a3('0xf'));_0x4c0291(_0x2a1d86[_0x19a3('0x14')]['message']);}})[_0x19a3('0x15')](function(_0x2dfd18){logger[_0x19a3('0x12')](_0x19a3('0xe'),_0xef9eb1,_0x2dfd18);_0x4d3833(_0x2dfd18);});});}exports[_0x19a3('0x16')]=function(_0x1b2863){var _0x308034=this;return new Promise(function(_0xceda17,_0x5b3c2a){return db['MailApplication']['update'](_0x1b2863[_0x19a3('0x17')],{'raw':_0x1b2863[_0x19a3('0x18')]?_0x1b2863[_0x19a3('0x18')][_0x19a3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b2863[_0x19a3('0x18')]?_0x1b2863[_0x19a3('0x18')][_0x19a3('0x1a')]||null:null,'attributes':_0x1b2863['options']?_0x1b2863[_0x19a3('0x18')][_0x19a3('0x1b')]||null:null,'limit':_0x1b2863[_0x19a3('0x18')]?_0x1b2863[_0x19a3('0x18')][_0x19a3('0x1c')]||null:null})['then'](function(_0x185abd){logger[_0x19a3('0xd')](_0x19a3('0x16'),_0x1b2863);logger[_0x19a3('0x1d')]('UpdateMailApplication',_0x1b2863,JSON[_0x19a3('0x11')](_0x185abd));_0xceda17(_0x185abd);})['catch'](function(_0x2922b6){logger['error'](_0x19a3('0x16'),_0x2922b6[_0x19a3('0x13')],_0x1b2863);_0x5b3c2a(_0x308034[_0x19a3('0x12')](0x1f4,_0x2922b6[_0x19a3('0x13')]));});});}; \ No newline at end of file +var _0x8abd=['MailApplication','options','raw','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateMailApplication'];(function(_0x59fb63,_0x4cc20d){var _0x1c5076=function(_0xc1fa0){while(--_0xc1fa0){_0x59fb63['push'](_0x59fb63['shift']());}};_0x1c5076(++_0x4cc20d);}(_0x8abd,0x13c));var _0xd8ab=function(_0x2cd465,_0x363c86){_0x2cd465=_0x2cd465-0x0;var _0x4fb296=_0x8abd[_0x2cd465];return _0x4fb296;};'use strict';var _=require(_0xd8ab('0x0'));var util=require('util');var moment=require(_0xd8ab('0x1'));var BPromise=require(_0xd8ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8ab('0x3'));var db=require(_0xd8ab('0x4'))['db'];var utils=require(_0xd8ab('0x5'));var logger=require(_0xd8ab('0x6'))('rpc');var config=require(_0xd8ab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd8ab('0x8')][_0xd8ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14c8b9,_0x423553,_0x470d3f){return new BPromise(function(_0x5cfa28,_0x4297f2){return client[_0xd8ab('0xa')](_0x14c8b9,_0x470d3f)[_0xd8ab('0xb')](function(_0x3e85a4){logger[_0xd8ab('0xc')](_0xd8ab('0xd'),_0x423553,_0xd8ab('0xe'));logger[_0xd8ab('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x423553,_0xd8ab('0xe'),JSON['stringify'](_0x3e85a4));if(_0x3e85a4[_0xd8ab('0x10')]){if(_0x3e85a4['error'][_0xd8ab('0x11')]===0x1f4){logger['error'](_0xd8ab('0xd'),_0x423553,_0x3e85a4[_0xd8ab('0x10')][_0xd8ab('0x12')]);return _0x4297f2(_0x3e85a4['error'][_0xd8ab('0x12')]);}logger[_0xd8ab('0x10')](_0xd8ab('0xd'),_0x423553,_0x3e85a4[_0xd8ab('0x10')][_0xd8ab('0x12')]);return _0x5cfa28(_0x3e85a4[_0xd8ab('0x10')][_0xd8ab('0x12')]);}else{logger[_0xd8ab('0xc')](_0xd8ab('0xd'),_0x423553,_0xd8ab('0xe'));_0x5cfa28(_0x3e85a4[_0xd8ab('0x13')][_0xd8ab('0x12')]);}})[_0xd8ab('0x14')](function(_0x1e4f92){logger[_0xd8ab('0x10')](_0xd8ab('0xd'),_0x423553,_0x1e4f92);_0x4297f2(_0x1e4f92);});});}exports[_0xd8ab('0x15')]=function(_0x54a28d){var _0x558000=this;return new Promise(function(_0x41c79c,_0x119dae){return db[_0xd8ab('0x16')]['update'](_0x54a28d['body'],{'raw':_0x54a28d[_0xd8ab('0x17')]?_0x54a28d[_0xd8ab('0x17')][_0xd8ab('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a28d['options']?_0x54a28d['options']['where']||null:null,'attributes':_0x54a28d['options']?_0x54a28d[_0xd8ab('0x17')]['attributes']||null:null,'limit':_0x54a28d[_0xd8ab('0x17')]?_0x54a28d[_0xd8ab('0x17')]['limit']||null:null})['then'](function(_0x3c2b97){logger[_0xd8ab('0xc')](_0xd8ab('0x15'),_0x54a28d);logger['debug'](_0xd8ab('0x15'),_0x54a28d,JSON[_0xd8ab('0x19')](_0x3c2b97));_0x41c79c(_0x3c2b97);})[_0xd8ab('0x14')](function(_0x3d19cc){logger['error'](_0xd8ab('0x15'),_0x3d19cc['message'],_0x54a28d);_0x119dae(_0x558000['error'](0x1f4,_0x3d19cc[_0xd8ab('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index fc542fd..1187ae3 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 _0xd50e=['mailinteraction:addtags','addTags','put','update','delete','tracked','mailinteraction:destroy','destroy','/:id/tags','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','mail'];(function(_0x436425,_0xf29f20){var _0x5a2335=function(_0x40852e){while(--_0x40852e){_0x436425['push'](_0x436425['shift']());}};_0x5a2335(++_0xf29f20);}(_0xd50e,0x1ca));var _0xed50=function(_0x2bdbe8,_0x223822){_0x2bdbe8=_0x2bdbe8-0x0;var _0x341661=_0xd50e[_0x2bdbe8];return _0x341661;};'use strict';var multer=require('multer');var util=require(_0xed50('0x0'));var path=require(_0xed50('0x1'));var timeout=require(_0xed50('0x2'));var express=require(_0xed50('0x3'));var router=express[_0xed50('0x4')]();var fs_extra=require(_0xed50('0x5'));var auth=require(_0xed50('0x6'));var interaction=require(_0xed50('0x7'));var config=require(_0xed50('0x8'));var controller=require(_0xed50('0x9'));router[_0xed50('0xa')]('/',auth[_0xed50('0xb')](),controller[_0xed50('0xc')]);router[_0xed50('0xa')](_0xed50('0xd'),auth[_0xed50('0xb')](),controller['describe']);router[_0xed50('0xa')](_0xed50('0xe'),auth[_0xed50('0xb')](),controller[_0xed50('0xf')]);router['get'](_0xed50('0x10'),auth['isAuthenticated'](),controller[_0xed50('0x11')]);router[_0xed50('0xa')](_0xed50('0x12'),auth['isAuthenticated'](),controller[_0xed50('0x13')]);router['post']('/',auth[_0xed50('0xb')](),controller['create']);router[_0xed50('0x14')](_0xed50('0x10'),auth[_0xed50('0xb')](),controller['addMessage']);router[_0xed50('0x14')]('/:id/tags',auth[_0xed50('0xb')](),interaction['tracked'](_0xed50('0x15'),_0xed50('0x16')),controller[_0xed50('0x17')]);router[_0xed50('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xed50('0x15'),'mailinteraction:update'),controller[_0xed50('0x19')]);router[_0xed50('0x1a')](_0xed50('0xe'),auth[_0xed50('0xb')](),interaction[_0xed50('0x1b')](_0xed50('0x15'),_0xed50('0x1c')),controller[_0xed50('0x1d')]);router[_0xed50('0x1a')](_0xed50('0x1e'),auth[_0xed50('0xb')](),controller[_0xed50('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x742b=['getMessages','download','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages'];(function(_0x5f26e0,_0x2fb8dd){var _0x70de5a=function(_0x16ed83){while(--_0x16ed83){_0x5f26e0['push'](_0x5f26e0['shift']());}};_0x70de5a(++_0x2fb8dd);}(_0x742b,0x1bd));var _0xb742=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x742b[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xb742('0x0'));var util=require('util');var path=require(_0xb742('0x1'));var timeout=require(_0xb742('0x2'));var express=require(_0xb742('0x3'));var router=express[_0xb742('0x4')]();var fs_extra=require(_0xb742('0x5'));var auth=require(_0xb742('0x6'));var interaction=require(_0xb742('0x7'));var config=require(_0xb742('0x8'));var controller=require(_0xb742('0x9'));router[_0xb742('0xa')]('/',auth[_0xb742('0xb')](),controller[_0xb742('0xc')]);router[_0xb742('0xa')](_0xb742('0xd'),auth[_0xb742('0xb')](),controller['describe']);router[_0xb742('0xa')](_0xb742('0xe'),auth[_0xb742('0xb')](),controller[_0xb742('0xf')]);router[_0xb742('0xa')](_0xb742('0x10'),auth[_0xb742('0xb')](),controller[_0xb742('0x11')]);router['get']('/:id/download',auth[_0xb742('0xb')](),controller[_0xb742('0x12')]);router['post']('/',auth[_0xb742('0xb')](),controller['create']);router[_0xb742('0x13')](_0xb742('0x10'),auth[_0xb742('0xb')](),controller[_0xb742('0x14')]);router[_0xb742('0x13')](_0xb742('0x15'),auth[_0xb742('0xb')](),interaction[_0xb742('0x16')]('mail',_0xb742('0x17')),controller[_0xb742('0x18')]);router[_0xb742('0x19')](_0xb742('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xb742('0x1a'),'mailinteraction:update'),controller[_0xb742('0x1b')]);router[_0xb742('0x1c')](_0xb742('0xe'),auth[_0xb742('0xb')](),interaction[_0xb742('0x16')](_0xb742('0x1a'),_0xb742('0x1d')),controller[_0xb742('0x1e')]);router['delete'](_0xb742('0x15'),auth[_0xb742('0xb')](),controller[_0xb742('0x1f')]);module[_0xb742('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 0bf2bbf..ce015f4 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 _0x4e3e=['out','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','ENUM'];(function(_0x5a1290,_0x5bbe30){var _0x3d0b9d=function(_0x4a07b1){while(--_0x4a07b1){_0x5a1290['push'](_0x5a1290['shift']());}};_0x3d0b9d(++_0x5bbe30);}(_0x4e3e,0x139));var _0xe4e3=function(_0x434467,_0x2c6a75){_0x434467=_0x434467-0x0;var _0x5248ba=_0x4e3e[_0x434467];return _0x5248ba;};'use strict';var Sequelize=require(_0xe4e3('0x0'));var iconv=require('iconv');module[_0xe4e3('0x1')]={'closed':{'type':Sequelize[_0xe4e3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe4e3('0x3')]},'disposition':{'type':Sequelize[_0xe4e3('0x4')]},'secondDisposition':{'type':Sequelize[_0xe4e3('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe4e3('0x4')]},'inReplyTo':{'type':Sequelize[_0xe4e3('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xe4e3('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe4e3('0x3')]},'substatus':{'type':Sequelize[_0xe4e3('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe4e3('0x6')]('in',_0xe4e3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe4e3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe4e3('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe4e3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb589=['TEXT','out','ENUM','iconv','exports','BOOLEAN','DATE','STRING'];(function(_0x17ba7d,_0x3d1ace){var _0x8fd171=function(_0xc08d1f){while(--_0xc08d1f){_0x17ba7d['push'](_0x17ba7d['shift']());}};_0x8fd171(++_0x3d1ace);}(_0xb589,0x143));var _0x9b58=function(_0x4969d0,_0x4a5788){_0x4969d0=_0x4969d0-0x0;var _0x754944=_0xb589[_0x4969d0];return _0x754944;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x9b58('0x0'));module[_0x9b58('0x1')]={'closed':{'type':Sequelize[_0x9b58('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9b58('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9b58('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9b58('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x9b58('0x4')]},'cc':{'type':Sequelize[_0x9b58('0x5')]('long')},'subject':{'type':Sequelize[_0x9b58('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9b58('0x3')]},'substatus':{'type':Sequelize[_0x9b58('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x9b58('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9b58('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9b58('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9b58('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9b58('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index fa3a893..e7983bd 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 _0xb2ae=['MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','all','rows','show','params','MailInteraction','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','sort','pick','filter','$gte','format','findAll','inlineCss','true','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','Messages','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','readFileSync','build','message%d.eml','download','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','sendStatus','status','json','offset','count','limit','set','apply','save','update','then','end','error','name','send','Users','map','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','out','-id','plainBody','trimStart','catch','index','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','field','color','from','select','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','tools_tags','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','i.id\x20LIKE\x20?','isEmail'];(function(_0x17259f,_0x1edb90){var _0x4a63aa=function(_0x277746){while(--_0x277746){_0x17259f['push'](_0x17259f['shift']());}};_0x4a63aa(++_0x1edb90);}(_0xb2ae,0x15a));var _0xeb2a=function(_0x31f7af,_0x3bb051){_0x31f7af=_0x31f7af-0x0;var _0x1083d8=_0xb2ae[_0x31f7af];return _0x1083d8;};'use strict';var emlformat=require(_0xeb2a('0x0'));var rimraf=require(_0xeb2a('0x1'));var zipdir=require(_0xeb2a('0x2'));var jsonpatch=require(_0xeb2a('0x3'));var rp=require(_0xeb2a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb2a('0x5'));var util=require(_0xeb2a('0x6'));var path=require(_0xeb2a('0x7'));var sox=require(_0xeb2a('0x8'));var csv=require(_0xeb2a('0x9'));var ejs=require(_0xeb2a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xeb2a('0xb'));var jsforce=require(_0xeb2a('0xc'));var deskjs=require(_0xeb2a('0xd'));var toCsv=require(_0xeb2a('0x9'));var querystring=require(_0xeb2a('0xe'));var Papa=require(_0xeb2a('0xf'));var htmlToText=require(_0xeb2a('0x10'));var juice=require('juice');var Redis=require(_0xeb2a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeb2a('0x12'));var as=require(_0xeb2a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xeb2a('0x14'));var config=require(_0xeb2a('0x15'));var licenseUtil=require(_0xeb2a('0x16'));var db=require(_0xeb2a('0x17'))['db'];config[_0xeb2a('0x18')]=_[_0xeb2a('0x19')](config[_0xeb2a('0x18')],{'host':_0xeb2a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb2a('0x18')]));require(_0xeb2a('0x1b'))['register'](socket);function respondWithStatusCode(_0x4c61ac,_0x16875a){_0x16875a=_0x16875a||0xcc;return function(_0x524388){if(_0x524388){return _0x4c61ac[_0xeb2a('0x1c')](_0x16875a);}return _0x4c61ac['status'](_0x16875a)['end']();};}function respondWithResult(_0x3f3ec6,_0x5db44a){_0x5db44a=_0x5db44a||0xc8;return function(_0x4e7a1a){if(_0x4e7a1a){return _0x3f3ec6[_0xeb2a('0x1d')](_0x5db44a)[_0xeb2a('0x1e')](_0x4e7a1a);}};}function respondWithFilteredResult(_0x247946,_0x29f589){return function(_0x461049){if(_0x461049){var _0x326152=typeof _0x29f589[_0xeb2a('0x1f')]==='undefined'&&typeof _0x29f589['limit']==='undefined';var _0x55295e=_0x461049[_0xeb2a('0x20')];var _0x378bf4=_0x326152?0x0:_0x29f589[_0xeb2a('0x1f')];var _0xc91dc1=_0x326152?_0x461049[_0xeb2a('0x20')]:_0x29f589[_0xeb2a('0x1f')]+_0x29f589[_0xeb2a('0x21')];var _0x347cb0;if(_0xc91dc1>=_0x55295e){_0xc91dc1=_0x55295e;_0x347cb0=0xc8;}else{_0x347cb0=0xce;}_0x247946[_0xeb2a('0x1d')](_0x347cb0);return _0x247946[_0xeb2a('0x22')]('Content-Range',_0x378bf4+'-'+_0xc91dc1+'/'+_0x55295e)['json'](_0x461049);}return null;};}function patchUpdates(_0x25a661){return function(_0x175d71){try{jsonpatch[_0xeb2a('0x23')](_0x175d71,_0x25a661,!![]);}catch(_0x409f42){return BPromise['reject'](_0x409f42);}return _0x175d71[_0xeb2a('0x24')]();};}function saveUpdates(_0x10bffb,_0xdd815){return function(_0x50ecbd){if(_0x50ecbd){return _0x50ecbd[_0xeb2a('0x25')](_0x10bffb)[_0xeb2a('0x26')](function(_0x8ccfb2){return _0x8ccfb2;});}return null;};}function removeEntity(_0x2111b9,_0x3cf0ff){return function(_0x496861){if(_0x496861){return _0x496861['destroy']()[_0xeb2a('0x26')](function(){_0x2111b9[_0xeb2a('0x1d')](0xcc)[_0xeb2a('0x27')]();});}};}function handleEntityNotFound(_0x28ff67,_0x53410f){return function(_0x1595db){if(!_0x1595db){_0x28ff67['sendStatus'](0x194);}return _0x1595db;};}function handleError(_0x47f9c9,_0x435d9a){_0x435d9a=_0x435d9a||0x1f4;return function(_0x194b21){logger[_0xeb2a('0x28')](_0x194b21['stack']);if(_0x194b21[_0xeb2a('0x29')]){delete _0x194b21[_0xeb2a('0x29')];}_0x47f9c9['status'](_0x435d9a)[_0xeb2a('0x2a')](_0x194b21);};}function getInteractionUsers(_0x4b1a66,_0x2d4cfc){return new BPromise(function(_0x12cdf6,_0x212306){try{if(_0x2d4cfc[_0x4b1a66['id']]){_0x4b1a66[_0xeb2a('0x2b')]=_[_0xeb2a('0x2c')](_0x2d4cfc[_0x4b1a66['id']],function(_0x483502){return{'id':_0x483502['id'],'fullname':_0x483502[_0xeb2a('0x2d')]};});}}catch(_0x364877){_0x212306(_0x364877);}_0x12cdf6(_0x4b1a66);});}function getInteractionTags(_0x46bde6,_0x5d612c){return new BPromise(function(_0xdafe6e,_0x4d2f0c){try{if(_0x46bde6[_0xeb2a('0x2e')]){_0x46bde6[_0xeb2a('0x2f')]=[];_0x46bde6[_0xeb2a('0x2e')]['split'](',')[_0xeb2a('0x30')](function(_0x2eed27){_0x46bde6[_0xeb2a('0x2f')][_0xeb2a('0x31')](_0x5d612c[_0x2eed27]);});}delete _0x46bde6[_0xeb2a('0x2e')];}catch(_0x5125e3){_0x4d2f0c(_0x5125e3);}_0xdafe6e(_0x46bde6);});}function getLastMessageText(_0x2d01f8){return new BPromise(function(_0x1026c3,_0x564c43){return db[_0xeb2a('0x32')][_0xeb2a('0x33')]({'where':{'$and':[{'MailInteractionId':_0x2d01f8['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xeb2a('0x34')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xeb2a('0x35'),'raw':!![]})[_0xeb2a('0x26')](function(_0x1f1e64){if(_0x1f1e64&&_0x1f1e64[_0xeb2a('0x36')]){_0x2d01f8['lastMsgText']=_[_0xeb2a('0x37')](_0x1f1e64[_0xeb2a('0x36')]);}_0x1026c3(_0x2d01f8);})[_0xeb2a('0x38')](function(_0x2d1580){_0x564c43(_0x2d1580);});});}function updateMailInteraction(_0x5c6323,_0x4d791e,_0x5ba891,_0x291134){return new BPromise(function(_0x5da53e,_0x22fd0f){return getInteractionUsers(_0x5c6323,_0x5ba891)[_0xeb2a('0x26')](function(_0x5d88cd){return getInteractionTags(_0x5d88cd,_0x4d791e);})[_0xeb2a('0x26')](function(_0x3834ba){if(_0x291134){_0x5da53e(getLastMessageText(_0x3834ba));}else{_0x5da53e(_0x3834ba);}})[_0xeb2a('0x38')](function(_0x426e47){_0x22fd0f(_0x426e47);});});}exports[_0xeb2a('0x39')]=function(_0x58f8ff,_0x3a9db6){var _0x4afd72={},_0x335a42={},_0x4ade3e={'count':0x0,'rows':[]};var _0x34f00b=_[_0xeb2a('0x2c')](db['MailInteraction'][_0xeb2a('0x3a')],function(_0x419a2d){return{'name':_0x419a2d[_0xeb2a('0x3b')],'type':_0x419a2d[_0xeb2a('0x3c')][_0xeb2a('0x3d')]};});_0x335a42[_0xeb2a('0x3e')]=_['map'](_0x34f00b,_0xeb2a('0x29'));_0x335a42['query']=_[_0xeb2a('0x3f')](_0x58f8ff[_0xeb2a('0x40')]);_0x335a42['filters']=_[_0xeb2a('0x41')](_0x335a42['model'],_0x335a42[_0xeb2a('0x40')]);_0x4afd72[_0xeb2a('0x42')]=_[_0xeb2a('0x41')](_0x335a42[_0xeb2a('0x3e')],qs['fields'](_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x43')]));_0x4afd72[_0xeb2a('0x42')]=_0x4afd72[_0xeb2a('0x42')][_0xeb2a('0x44')]?_0x4afd72['attributes']:_0x335a42[_0xeb2a('0x3e')];if(!_0x58f8ff['query'][_0xeb2a('0x45')]('nolimit')){_0x4afd72['limit']=qs[_0xeb2a('0x21')](_0x58f8ff[_0xeb2a('0x40')]['limit']);_0x4afd72[_0xeb2a('0x1f')]=qs[_0xeb2a('0x1f')](_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x1f')]);}_0x4afd72[_0xeb2a('0x46')]=qs['sort'](_0x58f8ff[_0xeb2a('0x40')]['sort']);_0x4afd72[_0xeb2a('0x47')]=qs[_0xeb2a('0x48')](_['pick'](_0x58f8ff[_0xeb2a('0x40')],_0x335a42['filters']),_0x34f00b);var _0xa5f9f7=[];var _0x3ca991=squel['select']()[_0xeb2a('0x49')]('id')[_0xeb2a('0x49')]('name')[_0xeb2a('0x49')](_0xeb2a('0x4a'))[_0xeb2a('0x4b')]('tools_tags');var _0x1f48cf=squel[_0xeb2a('0x4c')]()[_0xeb2a('0x49')]('u.id')[_0xeb2a('0x49')](_0xeb2a('0x4d'))[_0xeb2a('0x49')](_0xeb2a('0x4e'))[_0xeb2a('0x4b')](_0xeb2a('0x4f'),'ui')[_0xeb2a('0x50')](_0xeb2a('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x4e609b=squel[_0xeb2a('0x4c')]()[_0xeb2a('0x4b')](_0xeb2a('0x52'),'i')['left_join'](_0xeb2a('0x53'),'c',_0xeb2a('0x54'))[_0xeb2a('0x50')](_0xeb2a('0x51'),'o',_0xeb2a('0x55'))['left_join']('mail_accounts','a',_0xeb2a('0x56'))[_0xeb2a('0x50')](_0xeb2a('0x57'),'me',_0xeb2a('0x58'))[_0xeb2a('0x50')](_0xeb2a('0x59'),'it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0xeb2a('0x5a'),'t','t.id\x20=\x20it.TagId');var _0x5d2d95=squel['expr']();var _0x318397=[];var _0xbf293b=squel[_0xeb2a('0x5b')]();var _0xe26915;if(_0x58f8ff[_0xeb2a('0x40')]['search']){_0xe26915=as[_0xeb2a('0x5c')](_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x5d')]);var _0x2b224a=_0xe26915[_0xeb2a('0x5e')];for(var _0x146769=0x0;_0x146769<_0xe26915[_0xeb2a('0x5f')][_0xeb2a('0x44')];_0x146769++){var _0x4bc529=_0xe26915[_0xeb2a('0x5f')][_0x146769];var _0x451ef7='i';var _0x57f1f7=_[_0xeb2a('0x60')](_0x34f00b,[_0xeb2a('0x29'),_0x4bc529[_0xeb2a('0x49')]]);if(!_0x57f1f7){switch(_0x4bc529[_0xeb2a('0x49')]){case _0xeb2a('0x61'):if(_0x4bc529[_0xeb2a('0x62')]==0x1){_0x4e609b[_0xeb2a('0x63')]('`'+_0x4bc529[_0xeb2a('0x49')]+_0xeb2a('0x64'));}else{_0x4e609b[_0xeb2a('0x63')]('`'+_0x4bc529[_0xeb2a('0x49')]+_0xeb2a('0x65'));}break;case _0xeb2a('0x66'):if(_0x4bc529[_0xeb2a('0x67')]===_0xeb2a('0x68')){if(_0x4bc529[_0xeb2a('0x62')][_0xeb2a('0x69')]('\x20')[_0xeb2a('0x44')]>0x1){_0x5d2d95[_0x2b224a](_0xeb2a('0x6a'),qs[_0xeb2a('0x6b')](_0x4bc529['value']),null);}else{var _0x478a74='%'+_0x4bc529[_0xeb2a('0x62')]+'%';_0x5d2d95[_0x2b224a](_0xeb2a('0x6c'),_0x478a74,_0x478a74,_0x478a74);}}else{_0x57f1f7=_[_0xeb2a('0x60')](_0x34f00b,[_0xeb2a('0x29'),'ContactId']);_0x4bc529[_0xeb2a('0x49')]=_0xeb2a('0x6d');_0x8c8a3a=as[_0xeb2a('0x6e')](_0x451ef7,_0x57f1f7[_0xeb2a('0x3c')],_0x4bc529);_0x5d2d95[_0x2b224a](_0x8c8a3a[_0xeb2a('0x6f')],_0x8c8a3a['value']['start'],_0x8c8a3a['value'][_0xeb2a('0x27')]);}break;case _0xeb2a('0x70'):var _0x258e9c=_0x4bc529[_0xeb2a('0x62')]['split'](',')[_0xeb2a('0x2c')](function(_0x129250){return Number(_0x129250);});_0x258e9c[_0xeb2a('0x30')](function(_0xc35471){_0xbf293b['or'](_0xeb2a('0x71'),'%,'+_0xc35471+',%');});_0x318397=_[_0xeb2a('0x72')](_0x318397,_0x258e9c);break;case _0xeb2a('0x73'):if(_0x4bc529['operator']==='$substring'){_0x5d2d95[_0x2b224a](_0xeb2a('0x74'),'%'+_0x4bc529[_0xeb2a('0x62')]+'%',null);}else{_0x57f1f7=_[_0xeb2a('0x60')](_0x34f00b,[_0xeb2a('0x29'),'UserId']);_0x4bc529[_0xeb2a('0x49')]=_0xeb2a('0x75');_0x8c8a3a=as[_0xeb2a('0x6e')](_0x451ef7,_0x57f1f7[_0xeb2a('0x3c')],_0x4bc529);_0x5d2d95[_0x2b224a](_0x8c8a3a[_0xeb2a('0x6f')],_0x8c8a3a[_0xeb2a('0x62')][_0xeb2a('0x76')],_0x8c8a3a[_0xeb2a('0x62')][_0xeb2a('0x27')]);}break;case _0xeb2a('0x36'):_0x8c8a3a=as['buildExpression']('me',null,_0x4bc529);_0x5d2d95[_0x2b224a](_0x8c8a3a['text'],_0x8c8a3a[_0xeb2a('0x62')]['start'],_0x8c8a3a[_0xeb2a('0x62')]['end']);break;}}else{var _0x8c8a3a=as[_0xeb2a('0x6e')](_0x451ef7,_0x57f1f7[_0xeb2a('0x3c')],_0x4bc529);_0x5d2d95[_0x2b224a](_0x8c8a3a[_0xeb2a('0x6f')],_0x8c8a3a[_0xeb2a('0x62')][_0xeb2a('0x76')],_0x8c8a3a[_0xeb2a('0x62')][_0xeb2a('0x27')]);}}}else{var _0x32f97f=_(_0x58f8ff[_0xeb2a('0x40')])['keys']()['map'](function(_0x3868f7){return _['some'](_0x34f00b,['name',_0x3868f7])?_0x3868f7:undefined;})[_0xeb2a('0x77')]()[_0xeb2a('0x62')]();if(!_[_0xeb2a('0x78')](_0x32f97f)){_0x32f97f[_0xeb2a('0x30')](function(_0x5d73cc){if(_0x5d73cc===_0xeb2a('0x79')){_0x4e609b[_0xeb2a('0x47')](_0xeb2a('0x7a'),[]['concat'](_0x58f8ff[_0xeb2a('0x40')][_0x5d73cc]));}else if(_0x5d73cc===_0xeb2a('0x7b')){var _0x16536d=JSON[_0xeb2a('0x7c')](_0x58f8ff[_0xeb2a('0x40')][_0x5d73cc])['$gte'];var _0x2d4949=JSON['parse'](_0x58f8ff['query'][_0x5d73cc])[_0xeb2a('0x7d')];_0x4e609b[_0xeb2a('0x47')](_0xeb2a('0x7e'),_0x16536d,_0x2d4949);}else{if(_0x58f8ff[_0xeb2a('0x40')][_0x5d73cc]===_0xeb2a('0x7f')){_0x4e609b[_0xeb2a('0x47')]('i.'+_0x5d73cc+_0xeb2a('0x80'));}else{_0x4e609b['where']('i.'+_0x5d73cc+_0xeb2a('0x81'),_0x58f8ff[_0xeb2a('0x40')][_0x5d73cc]);}}});}if(_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x82')]){if(_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x82')]==0x1){_0x4e609b[_0xeb2a('0x63')](_0xeb2a('0x83'));}else{_0x4e609b[_0xeb2a('0x63')](_0xeb2a('0x84'));}}if(_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x85')]){_0x318397=_[_0xeb2a('0x86')](_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x85')])?_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x85')]:new Array(_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x85')]);_0x318397[_0xeb2a('0x30')](function(_0xd4f762){_0xbf293b['or'](_0xeb2a('0x71'),'%,'+_0xd4f762+',%');});}if(_0x58f8ff[_0xeb2a('0x40')]['filter']){var _0x32e551=_0x58f8ff[_0xeb2a('0x40')]['filter'][_0xeb2a('0x87')]('\x5c','\x5c\x5c')[_0xeb2a('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x32e551)){_0x5d2d95['or'](_0xeb2a('0x88'),_0x32e551+'%');}else if(qs[_0xeb2a('0x89')](_0x32e551)){_0x5d2d95['or']('c.email\x20LIKE\x20?',_0x32e551+'%');}else{_0x5d2d95['or'](_0xeb2a('0x8a'),qs[_0xeb2a('0x6b')](_0x32e551))['or'](_0xeb2a('0x8b'),qs[_0xeb2a('0x6b')](_0x32e551));}}}_0x4e609b[_0xeb2a('0x47')](_0x5d2d95);_0x4e609b['group']('i.id');var _0x1a35be={'type':db[_0xeb2a('0x8c')][_0xeb2a('0x8d')][_0xeb2a('0x8e')],'raw':!![]};var _0x146a31=_0x4e609b[_0xeb2a('0x8f')]();_0x146a31['field'](_0xeb2a('0x90'));_0x146a31[_0xeb2a('0x49')](_0xeb2a('0x91'),_0xeb2a('0x61'));if(_0x4afd72['order']){_0x4afd72[_0xeb2a('0x46')][_0xeb2a('0x30')](function(_0x2d3cf3){var _0x56ee51=_0x2d3cf3[0x0]===_0xeb2a('0x92')?_0x2d3cf3[0x0]:'i.'+_0x2d3cf3[0x0];_0x4e609b[_0xeb2a('0x46')](_0x56ee51,_0x2d3cf3[0x1]==='DESC'?![]:!![]);});}if(!_[_0xeb2a('0x78')](_0x318397)){_0x4e609b['having'](_0xbf293b);_0x146a31[_0xeb2a('0x47')](_0xeb2a('0x93'),_0x318397);}BPromise['resolve']()[_0xeb2a('0x26')](function(){if(!_0xe26915){if(_0x58f8ff[_0xeb2a('0x40')][_0xeb2a('0x79')])return;_0x146a31['where'](_0xeb2a('0x94'));_0x4e609b[_0xeb2a('0x47')](_0xeb2a('0x94'));return;}if(_0x58f8ff[_0xeb2a('0x95')][_0xeb2a('0x96')]!==_0xeb2a('0x97'))return;return _0x58f8ff[_0xeb2a('0x95')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xeb2a('0x26')](function(_0x1f6f14){if(_[_0xeb2a('0x78')](_0x1f6f14)){_0x146a31[_0xeb2a('0x47')](_0xeb2a('0x98'));_0x4e609b[_0xeb2a('0x47')](_0xeb2a('0x98'));}else{_0x146a31[_0xeb2a('0x47')](_0xeb2a('0x7a'),_[_0xeb2a('0x2c')](_0x1f6f14,'id'));_0x4e609b[_0xeb2a('0x47')](_0xeb2a('0x7a'),_[_0xeb2a('0x2c')](_0x1f6f14,'id'));}});})[_0xeb2a('0x26')](function(){if(_0x58f8ff[_0xeb2a('0x95')]['role']==='agent'&&!_0xe26915&&!_0x58f8ff['query'][_0xeb2a('0x79')])return[];return db[_0xeb2a('0x99')][_0xeb2a('0x40')](_0x146a31[_0xeb2a('0x9a')](),_0x1a35be);})[_0xeb2a('0x26')](function(_0x5ab783){_0x4ade3e['count']=_0x5ab783[_0xeb2a('0x44')];if(_0x4ade3e[_0xeb2a('0x20')]===0x0)return[];return db[_0xeb2a('0x99')][_0xeb2a('0x40')](_0x3ca991['toString'](),_0x1a35be)[_0xeb2a('0x26')](function(_0x20dd6f){_0xa5f9f7=_[_0xeb2a('0x9b')](_0x20dd6f,'id');_0x1a35be=_[_0xeb2a('0x9c')](_0x1a35be,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x58f8ff['query']['fields']){_0x4afd72['attributes']['forEach'](function(_0x55161c){_0x4e609b[_0xeb2a('0x49')]('i.'+_0x55161c);});}else{_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0x91'),_0xeb2a('0x61'));_0x4e609b[_0xeb2a('0x49')]('a.key',_0xeb2a('0x9d'));_0x4e609b['field'](_0xeb2a('0x9e'),_0xeb2a('0x9f'));_0x4e609b['field']('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',_0xeb2a('0x92'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0x90'));_0x4e609b[_0xeb2a('0x49')]('i.createdAt');_0x4e609b[_0xeb2a('0x49')]('i.updatedAt');_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xa0'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xa1'));_0x4e609b['field'](_0xeb2a('0xa2'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xa3'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xa4'));_0x4e609b['field'](_0xeb2a('0xa5'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xa6'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xa7'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xa8'));_0x4e609b['field']('i.substatus');_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xa9'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xaa'));_0x4e609b['field'](_0xeb2a('0xab'));_0x4e609b[_0xeb2a('0x49')]('i.UserId');_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xac'),_0xeb2a('0xad'));_0x4e609b[_0xeb2a('0x49')]('c.lastName',_0xeb2a('0xae'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xaf'),_0xeb2a('0xb0'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xb1'),_0xeb2a('0xb2'));_0x4e609b['field']('c.mobile',_0xeb2a('0xb3'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xb4'),_0xeb2a('0xb5'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xb6'),_0xeb2a('0xb7'));_0x4e609b[_0xeb2a('0x49')](_0xeb2a('0xb8'),_0xeb2a('0xb9'));_0x4e609b['field'](_0xeb2a('0xba'),_0xeb2a('0x2e'));}if(_0x4afd72[_0xeb2a('0x21')])_0x4e609b['limit'](_0x4afd72[_0xeb2a('0x21')]);if(_0x4afd72[_0xeb2a('0x1f')])_0x4e609b[_0xeb2a('0x1f')](_0x4afd72[_0xeb2a('0x1f')]);return db[_0xeb2a('0x99')][_0xeb2a('0x40')](_0x4e609b[_0xeb2a('0x9a')](),_0x1a35be);})[_0xeb2a('0x26')](function(_0x303c9e){if(_0x303c9e[_0xeb2a('0x44')]>0x0)_0x1f48cf[_0xeb2a('0x47')](_0xeb2a('0xbb'),_[_0xeb2a('0x2c')](_0x303c9e,'id'));return db[_0xeb2a('0x99')][_0xeb2a('0x40')](_0x1f48cf['toString'](),_0x1a35be)[_0xeb2a('0x26')](function(_0x536481){var _0x20b2e2=_[_0xeb2a('0xbc')](_0x536481,'MailInteractionId');var _0x530c05=[];return db[_0xeb2a('0xbd')][_0xeb2a('0x33')]({'attributes':[_0xeb2a('0xbe')],'raw':!![]})[_0xeb2a('0x26')](function(_0x5c972e){var _0x10c82d=_0x5c972e[_0xeb2a('0xbe')];_0x303c9e[_0xeb2a('0x30')](function(_0x2a3d14){_0x530c05[_0xeb2a('0x31')](updateMailInteraction(_0x2a3d14,_0xa5f9f7,_0x20b2e2,_0x10c82d));});return BPromise[_0xeb2a('0xbf')](_0x530c05);});});});})['then'](function(_0x2e80fe){_0x4ade3e[_0xeb2a('0xc0')]=_0x2e80fe;return _0x4ade3e;})[_0xeb2a('0x26')](respondWithFilteredResult(_0x3a9db6,_0x4afd72))[_0xeb2a('0x38')](handleError(_0x3a9db6,null));};exports[_0xeb2a('0xc1')]=function(_0x598572,_0x2417fe){var _0x54b7e7={'raw':![],'where':{'id':_0x598572[_0xeb2a('0xc2')]['id']}},_0x8a8482={};_0x8a8482[_0xeb2a('0x3e')]=_[_0xeb2a('0x3f')](db[_0xeb2a('0xc3')][_0xeb2a('0x3a')]);_0x8a8482['query']=_[_0xeb2a('0x3f')](_0x598572['query']);_0x8a8482['filters']=_[_0xeb2a('0x41')](_0x8a8482[_0xeb2a('0x3e')],_0x8a8482['query']);_0x54b7e7['attributes']=_[_0xeb2a('0x41')](_0x8a8482[_0xeb2a('0x3e')],qs[_0xeb2a('0x43')](_0x598572[_0xeb2a('0x40')][_0xeb2a('0x43')]));_0x54b7e7[_0xeb2a('0x42')]=_0x54b7e7['attributes'][_0xeb2a('0x44')]?_0x54b7e7[_0xeb2a('0x42')]:_0x8a8482[_0xeb2a('0x3e')];if(_0x598572[_0xeb2a('0x40')][_0xeb2a('0xc4')]){_0x54b7e7[_0xeb2a('0xc5')]=[{'all':!![]}];}_0x54b7e7=_[_0xeb2a('0x9c')]({},_0x54b7e7,_0x598572[_0xeb2a('0xc6')]);return db[_0xeb2a('0xc3')][_0xeb2a('0x60')](_0x54b7e7)[_0xeb2a('0x26')](handleEntityNotFound(_0x2417fe,null))[_0xeb2a('0x26')](respondWithResult(_0x2417fe,null))[_0xeb2a('0x38')](handleError(_0x2417fe,null));};exports['create']=function(_0x583ce5,_0x1073b5){return db[_0xeb2a('0xc3')][_0xeb2a('0xc7')](_0x583ce5['body'],{})[_0xeb2a('0x26')](respondWithResult(_0x1073b5,0xc9))['catch'](handleError(_0x1073b5,null));};exports[_0xeb2a('0x25')]=function(_0x4112e3,_0x4b0781){if(_0x4112e3['body']['id']){delete _0x4112e3[_0xeb2a('0xc8')]['id'];}return db[_0xeb2a('0xc3')][_0xeb2a('0x60')]({'where':{'id':_0x4112e3['params']['id']}})[_0xeb2a('0x26')](handleEntityNotFound(_0x4b0781,null))['then'](saveUpdates(_0x4112e3[_0xeb2a('0xc8')],null))[_0xeb2a('0x26')](respondWithResult(_0x4b0781,null))[_0xeb2a('0x38')](handleError(_0x4b0781,null));};exports['destroy']=function(_0x3000ee,_0x38a7fc){return db[_0xeb2a('0xc3')][_0xeb2a('0x60')]({'where':{'id':_0x3000ee[_0xeb2a('0xc2')]['id']}})[_0xeb2a('0x26')](handleEntityNotFound(_0x38a7fc,null))[_0xeb2a('0x26')](removeEntity(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports['describe']=function(_0x36a74f,_0x5e3a51){return db[_0xeb2a('0xc3')]['describe']()[_0xeb2a('0x26')](respondWithResult(_0x5e3a51,null))[_0xeb2a('0x38')](handleError(_0x5e3a51,null));};exports[_0xeb2a('0xc9')]=function(_0x33f1c6,_0x2f79db,_0x1a69bb){return db[_0xeb2a('0x32')][_0xeb2a('0x60')]({'where':{'id':_0x33f1c6[_0xeb2a('0xc2')]['id']}})[_0xeb2a('0x26')](handleEntityNotFound(_0x2f79db,null))['then'](function(_0x38ccef){if(_0x38ccef){return _0x38ccef['addMessage'](_0x33f1c6[_0xeb2a('0xc8')][_0xeb2a('0xca')],_[_0xeb2a('0xcb')](_0x33f1c6[_0xeb2a('0xc8')],[_0xeb2a('0xca'),'id'])||{});}})[_0xeb2a('0x26')](respondWithResult(_0x2f79db,null))[_0xeb2a('0x38')](handleError(_0x2f79db,null));};exports[_0xeb2a('0xcc')]=function(_0x375a57,_0x14d8f5,_0x30a6f6){var _0x1f020c={'raw':![],'where':{}};var _0xe3bc97={};var _0x27b4cb={'count':0x0,'rows':[]};return db['MailInteraction'][_0xeb2a('0x33')]({'where':{'id':_0x375a57[_0xeb2a('0xc2')]['id']}})[_0xeb2a('0x26')](handleEntityNotFound(_0x14d8f5,null))[_0xeb2a('0x26')](function(_0x28f97a){if(_0x28f97a){_0xe3bc97[_0xeb2a('0x3e')]=_[_0xeb2a('0x3f')](db[_0xeb2a('0x32')][_0xeb2a('0x3a')]);_0xe3bc97[_0xeb2a('0x40')]=_[_0xeb2a('0x3f')](_0x375a57[_0xeb2a('0x40')]);_0xe3bc97[_0xeb2a('0x48')]=_[_0xeb2a('0x41')](_0xe3bc97[_0xeb2a('0x3e')],_0xe3bc97[_0xeb2a('0x40')]);_0x1f020c[_0xeb2a('0x42')]=_['intersection'](_0xe3bc97[_0xeb2a('0x3e')],qs['fields'](_0x375a57['query'][_0xeb2a('0x43')]));_0x1f020c[_0xeb2a('0x42')]=_0x1f020c['attributes'][_0xeb2a('0x44')]?_0x1f020c[_0xeb2a('0x42')]:_0xe3bc97[_0xeb2a('0x3e')];if(!_0x375a57[_0xeb2a('0x40')][_0xeb2a('0x45')](_0xeb2a('0xcd'))){_0x1f020c[_0xeb2a('0x21')]=qs[_0xeb2a('0x21')](_0x375a57[_0xeb2a('0x40')][_0xeb2a('0x21')]);_0x1f020c[_0xeb2a('0x1f')]=qs[_0xeb2a('0x1f')](_0x375a57[_0xeb2a('0x40')][_0xeb2a('0x1f')]);}_0x1f020c[_0xeb2a('0x46')]=qs['sort'](_0x375a57[_0xeb2a('0x40')][_0xeb2a('0xce')]);_0x1f020c[_0xeb2a('0x47')]=qs[_0xeb2a('0x48')](_[_0xeb2a('0xcf')](_0x375a57[_0xeb2a('0x40')],_0xe3bc97['filters']));_0x1f020c['where']['MailInteractionId']=_0x28f97a['id'];if(_0x375a57['query']['filter']){_0x1f020c[_0xeb2a('0x47')]=_['merge'](_0x1f020c[_0xeb2a('0x47')],{'$or':_[_0xeb2a('0x2c')](_0x1f020c[_0xeb2a('0x42')],function(_0x2a6438){var _0x246261={};_0x246261[_0x2a6438]={'$like':'%'+_0x375a57[_0xeb2a('0x40')][_0xeb2a('0xd0')]+'%'};return _0x246261;})});}if(_0x375a57[_0xeb2a('0x40')][_0xeb2a('0xd1')]){var _0x5f40d6=_0x375a57['query'][_0xeb2a('0xd1')][_0xeb2a('0x69')](',');var _0x4c8869={};_0x4c8869[_0x5f40d6[0x0]]={'$gte':moment(_0x5f40d6[0x1])[_0xeb2a('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f020c['where']=_[_0xeb2a('0x9c')](_0x1f020c[_0xeb2a('0x47')],_0x4c8869);}_0x1f020c=_[_0xeb2a('0x9c')]({},_0x1f020c,_0x375a57[_0xeb2a('0xc6')]);return db['MailMessage'][_0xeb2a('0x20')]({'where':_0x1f020c['where']})[_0xeb2a('0x26')](function(_0x1fd880){_0x27b4cb[_0xeb2a('0x20')]=_0x1fd880;if(_0x375a57[_0xeb2a('0x40')][_0xeb2a('0xc4')]){_0x1f020c['include']=[{'all':!![]}];}return db['MailMessage'][_0xeb2a('0xd3')](_0x1f020c);})[_0xeb2a('0x26')](function(_0x35ce71){if(_0x375a57['query'][_0xeb2a('0xd4')]===_0xeb2a('0xd5')){for(var _0x5b3481=0x0;_0x5b3481<_0x35ce71[_0xeb2a('0x44')];_0x5b3481++){_0x35ce71[_0x5b3481]['body']=juice(_0x35ce71[_0x5b3481]['body']);}}_0x27b4cb[_0xeb2a('0xc0')]=_0x35ce71;return _0x27b4cb;});}})[_0xeb2a('0x26')](respondWithFilteredResult(_0x14d8f5,_0x1f020c))['catch'](handleError(_0x14d8f5,null));};exports[_0xeb2a('0xd6')]=function(_0x48ef0b,_0x5956c1,_0x284877){return db[_0xeb2a('0xc3')]['find']({'where':{'id':_0x48ef0b[_0xeb2a('0xc2')]['id']}})[_0xeb2a('0x26')](handleEntityNotFound(_0x5956c1,null))[_0xeb2a('0x26')](function(_0x1f2124){if(_0x1f2124){return _0x1f2124[_0xeb2a('0xd7')](_0x48ef0b[_0xeb2a('0xc8')][_0xeb2a('0xca')],_['omit'](_0x48ef0b['body'],[_0xeb2a('0xca'),'id'])||{})[_0xeb2a('0xd8')](function(){return db[_0xeb2a('0x70')][_0xeb2a('0xd3')]({'attributes':['id',_0xeb2a('0x29'),_0xeb2a('0x4a')],'where':{'id':_0x48ef0b[_0xeb2a('0xc8')][_0xeb2a('0xca')]}});})['then'](function(_0x456c78){socket[_0xeb2a('0xd9')](_0xeb2a('0xda'),{'id':Number(_0x48ef0b[_0xeb2a('0xc2')]['id']),'tags':_0x456c78||[]});return{'id':Number(_0x48ef0b['params']['id']),'tags':_0x456c78||[]};});}})[_0xeb2a('0x26')](respondWithResult(_0x5956c1,null))[_0xeb2a('0x38')](handleError(_0x5956c1,null));};exports[_0xeb2a('0xdb')]=function(_0x2800a3,_0x44c34f,_0x435f35){return db[_0xeb2a('0xc3')][_0xeb2a('0x60')]({'where':{'id':_0x2800a3['params']['id']}})[_0xeb2a('0x26')](handleEntityNotFound(_0x44c34f,null))[_0xeb2a('0x26')](function(_0x529c62){if(_0x529c62){return _0x529c62[_0xeb2a('0xdb')](_0x2800a3[_0xeb2a('0x40')][_0xeb2a('0xca')]);}})['then'](respondWithStatusCode(_0x44c34f,null))[_0xeb2a('0x38')](handleError(_0x44c34f,null));};exports['download']=function(_0x1e8ea6,_0x1d20eb){var _0x4a6d72=moment()['unix']()['toString']();var _0x5d9db8=path['join'](config[_0xeb2a('0xdc')],_0xeb2a('0xdd'),_0xeb2a('0xde'),_0xeb2a('0xdf'));var _0x58a3d1=path['join'](config['root'],_0xeb2a('0xdd'),_0xeb2a('0xde'),_0xeb2a('0xe0'));var _0x301a3f=path[_0xeb2a('0xe1')](_0x5d9db8,_0x4a6d72);var _0x167e73=util['format'](_0xeb2a('0xe2'),_0x1e8ea6[_0xeb2a('0xc2')]['id'],_0x4a6d72);var _0x505e7a=path[_0xeb2a('0xe1')](_0x5d9db8,_0x167e73);var _0x4bf360=[];if(_0x1e8ea6[_0xeb2a('0x40')][_0xeb2a('0xe0')]){_0x4bf360['push']({'model':db[_0xeb2a('0xe3')],'as':_0xeb2a('0xe4'),'raw':!![]});}var _0x31fce7=[{'model':db[_0xeb2a('0x32')],'as':'Messages','attributes':['id',_0xeb2a('0xc8'),_0xeb2a('0x4b'),'to','cc',_0xeb2a('0xe5'),_0xeb2a('0xe6'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x4bf360}];return db[_0xeb2a('0xc3')][_0xeb2a('0x60')]({'where':{'id':_0x1e8ea6['params']['id']},'include':_0x31fce7})[_0xeb2a('0x26')](handleEntityNotFound(_0x1d20eb,null))[_0xeb2a('0x26')](function(_0x5ca1ff){if(_0x5ca1ff&&_0x5ca1ff[_0xeb2a('0xe7')]){var _0x337c6c=_0x5ca1ff[_0xeb2a('0xe8')]({'plain':!![]});fs[_0xeb2a('0xe9')](_0x301a3f);return BPromise['each'](_0x337c6c[_0xeb2a('0xe7')],function(_0x1185b5,_0x1f3670){var _0x2726c3={'from':_0x1185b5[_0xeb2a('0x4b')],'to':_0x1185b5['to'],'subject':_0x1185b5[_0xeb2a('0xe6')],'html':_0x1185b5[_0xeb2a('0xc8')],'headers':{'Date':moment(_0x1185b5[_0xeb2a('0x7b')])['format'](_0xeb2a('0xea'))},'attachments':[]};if(_0x1185b5['cc']){_0x2726c3['headers']['Cc']=_0x1185b5['cc'];}if(_0x1185b5[_0xeb2a('0xe5')]){_0x2726c3[_0xeb2a('0xeb')]['Bcc']=_0x1185b5['bcc'];}return new BPromise(function(_0x490e8f,_0xfeef48){if(_0x1185b5[_0xeb2a('0xe4')]){for(var _0x437d78=0x0;_0x437d78<_0x1185b5[_0xeb2a('0xe4')][_0xeb2a('0x44')];_0x437d78++){var _0x152490=_0x1185b5[_0xeb2a('0xe4')][_0x437d78];var _0x5a3a85=path[_0xeb2a('0xe1')](_0x58a3d1,_0x152490[_0xeb2a('0xec')]);if(fs['existsSync'](_0x5a3a85)){_0x2726c3['attachments'][_0xeb2a('0x31')]({'name':_0x152490['name'],'contentType':_0x152490[_0xeb2a('0x3c')],'data':fs[_0xeb2a('0xed')](_0x5a3a85)});}}}emlformat[_0xeb2a('0xee')](_0x2726c3,function(_0x4fe25e,_0x660cbc){if(_0x4fe25e)return _0xfeef48(_0x4fe25e);fs['writeFileSync'](path[_0xeb2a('0xe1')](_0x301a3f,util['format'](_0xeb2a('0xef'),_0x1f3670)),_0x660cbc);return _0x490e8f(_0x660cbc);});});})['then'](function(){return new BPromise(function(_0x1717eb,_0x59bc4e){zipdir(_0x301a3f,{'saveTo':_0x505e7a},function(_0x257de2,_0x54772d){if(_0x257de2)return _0x59bc4e(_0x257de2);return _0x1717eb(_0x54772d);});})['then'](function(){return new BPromise(function(_0x5b01c6,_0x491c96){rimraf(_0x301a3f,function(_0x571f70){if(_0x571f70)_0x491c96(_0x571f70);return _0x5b01c6();});});})[_0xeb2a('0x26')](function(){return _0x1d20eb[_0xeb2a('0xf0')](_0x505e7a,_0x167e73,function(_0x18af31){if(_0x18af31){console[_0xeb2a('0xf1')]('err',_0x18af31);}else{fs['unlinkSync'](_0x505e7a);}});});});}else{return _0x1d20eb['sendStatus'](0xc8);}})[_0xeb2a('0x38')](handleError(_0x1d20eb,null));}; \ No newline at end of file +var _0xbf13=['text','compact','isEmpty','MailAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','findOne','enableEmailPreview','push','all','rows','show','params','rawAttributes','includeAll','include','options','create','body','destroy','describe','addMessage','ids','getMessages','format','findAll','inlineCss','true','addTags','omit','spread','mailInteractionTags:save','removeTags','unix','join','root','server','files','attachments','Attachments','bcc','get','mkdirSync','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','download','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','./mailInteraction.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','sendStatus','name','send','map','TagIds','Tags','split','forEach','MailMessage','plainBody','-id','lastMsgText','trimStart','catch','index','MailInteraction','type','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','mail_accounts','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$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','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xbf13,0x173));var _0x3bf1=function(_0x1dc155,_0x3b4f48){_0x1dc155=_0x1dc155-0x0;var _0x22bee3=_0xbf13[_0x1dc155];return _0x22bee3;};'use strict';var emlformat=require(_0x3bf1('0x0'));var rimraf=require(_0x3bf1('0x1'));var zipdir=require(_0x3bf1('0x2'));var jsonpatch=require(_0x3bf1('0x3'));var rp=require(_0x3bf1('0x4'));var moment=require(_0x3bf1('0x5'));var BPromise=require(_0x3bf1('0x6'));var Mustache=require(_0x3bf1('0x7'));var util=require(_0x3bf1('0x8'));var path=require(_0x3bf1('0x9'));var sox=require(_0x3bf1('0xa'));var csv=require(_0x3bf1('0xb'));var ejs=require(_0x3bf1('0xc'));var fs=require('fs');var fs_extra=require(_0x3bf1('0xd'));var _=require('lodash');var squel=require(_0x3bf1('0xe'));var crypto=require(_0x3bf1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3bf1('0xb'));var querystring=require(_0x3bf1('0x10'));var Papa=require(_0x3bf1('0x11'));var htmlToText=require(_0x3bf1('0x12'));var juice=require(_0x3bf1('0x13'));var Redis=require(_0x3bf1('0x14'));var authService=require(_0x3bf1('0x15'));var qs=require(_0x3bf1('0x16'));var as=require(_0x3bf1('0x17'));var hardwareService=require(_0x3bf1('0x18'));var logger=require('../../config/logger')(_0x3bf1('0x19'));var utils=require(_0x3bf1('0x1a'));var config=require(_0x3bf1('0x1b'));var licenseUtil=require(_0x3bf1('0x1c'));var db=require('../../mysqldb')['db'];config[_0x3bf1('0x1d')]=_['defaults'](config[_0x3bf1('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3bf1('0x1e'))[_0x3bf1('0x1f')](socket);function respondWithStatusCode(_0x313efa,_0x9907bf){_0x9907bf=_0x9907bf||0xcc;return function(_0x37e812){if(_0x37e812){return _0x313efa['sendStatus'](_0x9907bf);}return _0x313efa[_0x3bf1('0x20')](_0x9907bf)[_0x3bf1('0x21')]();};}function respondWithResult(_0x25d554,_0x586652){_0x586652=_0x586652||0xc8;return function(_0x359435){if(_0x359435){return _0x25d554[_0x3bf1('0x20')](_0x586652)[_0x3bf1('0x22')](_0x359435);}};}function respondWithFilteredResult(_0x1771a0,_0x3a4f1d){return function(_0x3917ce){if(_0x3917ce){var _0x4b7227=typeof _0x3a4f1d[_0x3bf1('0x23')]==='undefined'&&typeof _0x3a4f1d[_0x3bf1('0x24')]===_0x3bf1('0x25');var _0x2cd190=_0x3917ce['count'];var _0x340a9a=_0x4b7227?0x0:_0x3a4f1d[_0x3bf1('0x23')];var _0x49c188=_0x4b7227?_0x3917ce[_0x3bf1('0x26')]:_0x3a4f1d[_0x3bf1('0x23')]+_0x3a4f1d['limit'];var _0x4b236d;if(_0x49c188>=_0x2cd190){_0x49c188=_0x2cd190;_0x4b236d=0xc8;}else{_0x4b236d=0xce;}_0x1771a0['status'](_0x4b236d);return _0x1771a0[_0x3bf1('0x27')](_0x3bf1('0x28'),_0x340a9a+'-'+_0x49c188+'/'+_0x2cd190)['json'](_0x3917ce);}return null;};}function patchUpdates(_0x5b36f3){return function(_0x9731d){try{jsonpatch[_0x3bf1('0x29')](_0x9731d,_0x5b36f3,!![]);}catch(_0x2c5430){return BPromise['reject'](_0x2c5430);}return _0x9731d['save']();};}function saveUpdates(_0x32f4d7,_0x5cf639){return function(_0x3c319a){if(_0x3c319a){return _0x3c319a[_0x3bf1('0x2a')](_0x32f4d7)['then'](function(_0x44597b){return _0x44597b;});}return null;};}function removeEntity(_0x387f16,_0x48783d){return function(_0x3f6177){if(_0x3f6177){return _0x3f6177['destroy']()[_0x3bf1('0x2b')](function(){_0x387f16['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3450bb,_0x3ee515){return function(_0x240bc7){if(!_0x240bc7){_0x3450bb[_0x3bf1('0x2c')](0x194);}return _0x240bc7;};}function handleError(_0x4e55fd,_0xa0f97d){_0xa0f97d=_0xa0f97d||0x1f4;return function(_0x49408d){logger['error'](_0x49408d['stack']);if(_0x49408d[_0x3bf1('0x2d')]){delete _0x49408d[_0x3bf1('0x2d')];}_0x4e55fd[_0x3bf1('0x20')](_0xa0f97d)[_0x3bf1('0x2e')](_0x49408d);};}function getInteractionUsers(_0x66462d,_0x3b5525){return new BPromise(function(_0x46875f,_0x399b81){try{if(_0x3b5525[_0x66462d['id']]){_0x66462d['Users']=_[_0x3bf1('0x2f')](_0x3b5525[_0x66462d['id']],function(_0x52ce29){return{'id':_0x52ce29['id'],'fullname':_0x52ce29['fullname']};});}}catch(_0x719872){_0x399b81(_0x719872);}_0x46875f(_0x66462d);});}function getInteractionTags(_0x3a71fd,_0x42f05a){return new BPromise(function(_0xedb020,_0x538e86){try{if(_0x3a71fd[_0x3bf1('0x30')]){_0x3a71fd[_0x3bf1('0x31')]=[];_0x3a71fd[_0x3bf1('0x30')][_0x3bf1('0x32')](',')[_0x3bf1('0x33')](function(_0xd0721){_0x3a71fd['Tags']['push'](_0x42f05a[_0xd0721]);});}delete _0x3a71fd[_0x3bf1('0x30')];}catch(_0x4fbe93){_0x538e86(_0x4fbe93);}_0xedb020(_0x3a71fd);});}function getLastMessageText(_0x481e30){return new BPromise(function(_0x50e083,_0x277c00){return db[_0x3bf1('0x34')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x481e30['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x3bf1('0x35')],'order':_0x3bf1('0x36'),'raw':!![]})[_0x3bf1('0x2b')](function(_0x3ad806){if(_0x3ad806&&_0x3ad806[_0x3bf1('0x35')]){_0x481e30[_0x3bf1('0x37')]=_[_0x3bf1('0x38')](_0x3ad806[_0x3bf1('0x35')]);}_0x50e083(_0x481e30);})['catch'](function(_0x1f8832){_0x277c00(_0x1f8832);});});}function updateMailInteraction(_0x280977,_0x457d7b,_0x489df0,_0x54fe37){return new BPromise(function(_0x2e8de3,_0x4c48f1){return getInteractionUsers(_0x280977,_0x489df0)[_0x3bf1('0x2b')](function(_0x34eeea){return getInteractionTags(_0x34eeea,_0x457d7b);})[_0x3bf1('0x2b')](function(_0x2140a4){if(_0x54fe37){_0x2e8de3(getLastMessageText(_0x2140a4));}else{_0x2e8de3(_0x2140a4);}})[_0x3bf1('0x39')](function(_0x39e732){_0x4c48f1(_0x39e732);});});}exports[_0x3bf1('0x3a')]=function(_0x1aadcc,_0x5952a9){var _0x157e5a={},_0x181616={},_0x3cb201={'count':0x0,'rows':[]};var _0x4f9a92=_['map'](db[_0x3bf1('0x3b')]['rawAttributes'],function(_0xfd61a1){return{'name':_0xfd61a1['fieldName'],'type':_0xfd61a1[_0x3bf1('0x3c')]['key']};});_0x181616[_0x3bf1('0x3d')]=_[_0x3bf1('0x2f')](_0x4f9a92,_0x3bf1('0x2d'));_0x181616['query']=_[_0x3bf1('0x3e')](_0x1aadcc['query']);_0x181616[_0x3bf1('0x3f')]=_['intersection'](_0x181616['model'],_0x181616['query']);_0x157e5a[_0x3bf1('0x40')]=_[_0x3bf1('0x41')](_0x181616['model'],qs[_0x3bf1('0x42')](_0x1aadcc[_0x3bf1('0x43')]['fields']));_0x157e5a['attributes']=_0x157e5a[_0x3bf1('0x40')][_0x3bf1('0x44')]?_0x157e5a[_0x3bf1('0x40')]:_0x181616[_0x3bf1('0x3d')];if(!_0x1aadcc[_0x3bf1('0x43')][_0x3bf1('0x45')](_0x3bf1('0x46'))){_0x157e5a[_0x3bf1('0x24')]=qs['limit'](_0x1aadcc[_0x3bf1('0x43')][_0x3bf1('0x24')]);_0x157e5a[_0x3bf1('0x23')]=qs['offset'](_0x1aadcc['query'][_0x3bf1('0x23')]);}_0x157e5a['order']=qs[_0x3bf1('0x47')](_0x1aadcc[_0x3bf1('0x43')][_0x3bf1('0x47')]);_0x157e5a[_0x3bf1('0x48')]=qs[_0x3bf1('0x3f')](_[_0x3bf1('0x49')](_0x1aadcc[_0x3bf1('0x43')],_0x181616[_0x3bf1('0x3f')]),_0x4f9a92);var _0x4122af=[];var _0x553e81=squel[_0x3bf1('0x4a')]()[_0x3bf1('0x4b')]('id')[_0x3bf1('0x4b')](_0x3bf1('0x2d'))[_0x3bf1('0x4b')](_0x3bf1('0x4c'))[_0x3bf1('0x4d')](_0x3bf1('0x4e'));var _0x211011=squel['select']()[_0x3bf1('0x4b')](_0x3bf1('0x4f'))['field'](_0x3bf1('0x50'))['field'](_0x3bf1('0x51'))['from']('user_has_mail_interactions','ui')['left_join'](_0x3bf1('0x52'),'u',_0x3bf1('0x53'));var _0x49c189=squel[_0x3bf1('0x4a')]()['from']('mail_interactions','i')['left_join'](_0x3bf1('0x54'),'c',_0x3bf1('0x55'))[_0x3bf1('0x56')]('users','o',_0x3bf1('0x57'))[_0x3bf1('0x56')](_0x3bf1('0x58'),'a','a.id\x20=\x20i.MailAccountId')[_0x3bf1('0x56')]('mail_messages','me','me.MailInteractionId\x20=\x20i.id')[_0x3bf1('0x56')]('mail_interaction_has_tags','it',_0x3bf1('0x59'))['left_join'](_0x3bf1('0x4e'),'t',_0x3bf1('0x5a'));var _0x12147f=squel['expr']();var _0x2a5183=[];var _0xe36f39=squel[_0x3bf1('0x5b')]();var _0x594de2;if(_0x1aadcc[_0x3bf1('0x43')][_0x3bf1('0x5c')]){_0x594de2=as[_0x3bf1('0x5d')](_0x1aadcc[_0x3bf1('0x43')][_0x3bf1('0x5c')]);var _0x144273=_0x594de2[_0x3bf1('0x5e')];for(var _0x47b3dd=0x0;_0x47b3dd<_0x594de2['conditions'][_0x3bf1('0x44')];_0x47b3dd++){var _0x34d5e6=_0x594de2[_0x3bf1('0x5f')][_0x47b3dd];var _0x4f0400='i';var _0x199a02=_[_0x3bf1('0x60')](_0x4f9a92,['name',_0x34d5e6['field']]);if(!_0x199a02){switch(_0x34d5e6[_0x3bf1('0x4b')]){case _0x3bf1('0x61'):if(_0x34d5e6[_0x3bf1('0x62')]==0x1){_0x49c189[_0x3bf1('0x63')]('`'+_0x34d5e6['field']+_0x3bf1('0x64'));}else{_0x49c189[_0x3bf1('0x63')]('`'+_0x34d5e6[_0x3bf1('0x4b')]+_0x3bf1('0x65'));}break;case'Contact':if(_0x34d5e6['operator']===_0x3bf1('0x66')){if(_0x34d5e6[_0x3bf1('0x62')][_0x3bf1('0x32')]('\x20')['length']>0x1){_0x12147f[_0x144273](_0x3bf1('0x67'),qs[_0x3bf1('0x68')](_0x34d5e6[_0x3bf1('0x62')]),null);}else{var _0x44e55e='%'+_0x34d5e6[_0x3bf1('0x62')]+'%';_0x12147f[_0x144273](_0x3bf1('0x69'),_0x44e55e,_0x44e55e,_0x44e55e);}}else{_0x199a02=_['find'](_0x4f9a92,[_0x3bf1('0x2d'),_0x3bf1('0x6a')]);_0x34d5e6[_0x3bf1('0x4b')]='ContactId';_0x4412df=as[_0x3bf1('0x6b')](_0x4f0400,_0x199a02['type'],_0x34d5e6);_0x12147f[_0x144273](_0x4412df['text'],_0x4412df[_0x3bf1('0x62')][_0x3bf1('0x6c')],_0x4412df[_0x3bf1('0x62')][_0x3bf1('0x21')]);}break;case _0x3bf1('0x6d'):var _0x3d28e5=_0x34d5e6[_0x3bf1('0x62')][_0x3bf1('0x32')](',')[_0x3bf1('0x2f')](function(_0x497770){return Number(_0x497770);});_0x3d28e5[_0x3bf1('0x33')](function(_0x39f0c7){_0xe36f39['or'](_0x3bf1('0x6e'),'%,'+_0x39f0c7+',%');});_0x2a5183=_[_0x3bf1('0x6f')](_0x2a5183,_0x3d28e5);break;case _0x3bf1('0x70'):if(_0x34d5e6[_0x3bf1('0x71')]===_0x3bf1('0x66')){_0x12147f[_0x144273]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x34d5e6['value']+'%',null);}else{_0x199a02=_[_0x3bf1('0x60')](_0x4f9a92,[_0x3bf1('0x2d'),_0x3bf1('0x72')]);_0x34d5e6[_0x3bf1('0x4b')]=_0x3bf1('0x72');_0x4412df=as[_0x3bf1('0x6b')](_0x4f0400,_0x199a02[_0x3bf1('0x3c')],_0x34d5e6);_0x12147f[_0x144273](_0x4412df['text'],_0x4412df[_0x3bf1('0x62')][_0x3bf1('0x6c')],_0x4412df[_0x3bf1('0x62')][_0x3bf1('0x21')]);}break;case _0x3bf1('0x35'):_0x4412df=as[_0x3bf1('0x6b')]('me',null,_0x34d5e6);_0x12147f[_0x144273](_0x4412df[_0x3bf1('0x73')],_0x4412df[_0x3bf1('0x62')][_0x3bf1('0x6c')],_0x4412df['value'][_0x3bf1('0x21')]);break;}}else{var _0x4412df=as[_0x3bf1('0x6b')](_0x4f0400,_0x199a02[_0x3bf1('0x3c')],_0x34d5e6);_0x12147f[_0x144273](_0x4412df[_0x3bf1('0x73')],_0x4412df['value']['start'],_0x4412df['value'][_0x3bf1('0x21')]);}}}else{var _0x254b0e=_(_0x1aadcc[_0x3bf1('0x43')])[_0x3bf1('0x3e')]()[_0x3bf1('0x2f')](function(_0x696aef){return _['some'](_0x4f9a92,[_0x3bf1('0x2d'),_0x696aef])?_0x696aef:undefined;})[_0x3bf1('0x74')]()['value']();if(!_[_0x3bf1('0x75')](_0x254b0e)){_0x254b0e['forEach'](function(_0x301ab4){if(_0x301ab4===_0x3bf1('0x76')){_0x49c189[_0x3bf1('0x48')]('i.MailAccountId\x20IN\x20?',[][_0x3bf1('0x77')](_0x1aadcc['query'][_0x301ab4]));}else if(_0x301ab4===_0x3bf1('0x78')){var _0x3ac14a=JSON[_0x3bf1('0x79')](_0x1aadcc[_0x3bf1('0x43')][_0x301ab4])[_0x3bf1('0x7a')];var _0x299541=JSON[_0x3bf1('0x79')](_0x1aadcc['query'][_0x301ab4])[_0x3bf1('0x7b')];_0x49c189[_0x3bf1('0x48')](_0x3bf1('0x7c'),_0x3ac14a,_0x299541);}else{if(_0x1aadcc[_0x3bf1('0x43')][_0x301ab4]===_0x3bf1('0x7d')){_0x49c189[_0x3bf1('0x48')]('i.'+_0x301ab4+_0x3bf1('0x7e'));}else{_0x49c189['where']('i.'+_0x301ab4+_0x3bf1('0x7f'),_0x1aadcc['query'][_0x301ab4]);}}});}if(_0x1aadcc['query'][_0x3bf1('0x80')]){if(_0x1aadcc['query'][_0x3bf1('0x80')]==0x1){_0x49c189['having'](_0x3bf1('0x81'));}else{_0x49c189['having'](_0x3bf1('0x82'));}}if(_0x1aadcc[_0x3bf1('0x43')]['tag']){_0x2a5183=_['isArray'](_0x1aadcc[_0x3bf1('0x43')]['tag'])?_0x1aadcc['query'][_0x3bf1('0x83')]:new Array(_0x1aadcc[_0x3bf1('0x43')][_0x3bf1('0x83')]);_0x2a5183['forEach'](function(_0x4bebcf){_0xe36f39['or'](_0x3bf1('0x6e'),'%,'+_0x4bebcf+',%');});}if(_0x1aadcc[_0x3bf1('0x43')]['filter']){var _0x1a7fb5=_0x1aadcc[_0x3bf1('0x43')][_0x3bf1('0x84')][_0x3bf1('0x85')]('\x5c','\x5c\x5c')[_0x3bf1('0x85')](/'/g,'\x27\x27');if(qs[_0x3bf1('0x86')](_0x1a7fb5)){_0x12147f['or'](_0x3bf1('0x87'),_0x1a7fb5+'%');}else if(qs[_0x3bf1('0x88')](_0x1a7fb5)){_0x12147f['or'](_0x3bf1('0x89'),_0x1a7fb5+'%');}else{_0x12147f['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3bf1('0x68')](_0x1a7fb5))['or'](_0x3bf1('0x8a'),qs[_0x3bf1('0x68')](_0x1a7fb5));}}}_0x49c189['where'](_0x12147f);_0x49c189[_0x3bf1('0x8b')](_0x3bf1('0x8c'));var _0x5d2218={'type':db[_0x3bf1('0x8d')][_0x3bf1('0x8e')][_0x3bf1('0x8f')],'raw':!![]};var _0x1c76da=_0x49c189[_0x3bf1('0x90')]();_0x1c76da['field'](_0x3bf1('0x8c'));_0x1c76da[_0x3bf1('0x4b')](_0x3bf1('0x91'),_0x3bf1('0x61'));if(_0x157e5a['order']){_0x157e5a[_0x3bf1('0x92')]['forEach'](function(_0x427266){var _0x472582=_0x427266[0x0]===_0x3bf1('0x93')?_0x427266[0x0]:'i.'+_0x427266[0x0];_0x49c189[_0x3bf1('0x92')](_0x472582,_0x427266[0x1]===_0x3bf1('0x94')?![]:!![]);});}if(!_[_0x3bf1('0x75')](_0x2a5183)){_0x49c189[_0x3bf1('0x63')](_0xe36f39);_0x1c76da[_0x3bf1('0x48')]('t.id\x20IN\x20?',_0x2a5183);}BPromise[_0x3bf1('0x95')]()[_0x3bf1('0x2b')](function(){if(!_0x594de2){if(_0x1aadcc['query'][_0x3bf1('0x76')])return;_0x1c76da[_0x3bf1('0x48')](_0x3bf1('0x96'));_0x49c189[_0x3bf1('0x48')](_0x3bf1('0x96'));return;}if(_0x1aadcc['user'][_0x3bf1('0x97')]!==_0x3bf1('0x98'))return;return _0x1aadcc[_0x3bf1('0x99')][_0x3bf1('0x9a')]({'attributes':['id'],'raw':!![]})[_0x3bf1('0x2b')](function(_0x51f9ba){if(_['isEmpty'](_0x51f9ba)){_0x1c76da['where'](_0x3bf1('0x9b'));_0x49c189[_0x3bf1('0x48')]('i.MailAccountId\x20IS\x20NULL');}else{_0x1c76da[_0x3bf1('0x48')](_0x3bf1('0x9c'),_[_0x3bf1('0x2f')](_0x51f9ba,'id'));_0x49c189[_0x3bf1('0x48')](_0x3bf1('0x9c'),_[_0x3bf1('0x2f')](_0x51f9ba,'id'));}});})[_0x3bf1('0x2b')](function(){if(_0x1aadcc[_0x3bf1('0x99')][_0x3bf1('0x97')]===_0x3bf1('0x98')&&!_0x594de2&&!_0x1aadcc[_0x3bf1('0x43')][_0x3bf1('0x76')])return[];return db[_0x3bf1('0x9d')][_0x3bf1('0x43')](_0x1c76da[_0x3bf1('0x9e')](),_0x5d2218);})[_0x3bf1('0x2b')](function(_0x255bd6){_0x3cb201[_0x3bf1('0x26')]=_0x255bd6[_0x3bf1('0x44')];if(_0x3cb201['count']===0x0)return[];return db[_0x3bf1('0x9d')]['query'](_0x553e81['toString'](),_0x5d2218)[_0x3bf1('0x2b')](function(_0x1a25bf){_0x4122af=_[_0x3bf1('0x9f')](_0x1a25bf,'id');_0x5d2218=_[_0x3bf1('0xa0')](_0x5d2218,{'model':db[_0x3bf1('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1aadcc['query'][_0x3bf1('0x42')]){_0x157e5a[_0x3bf1('0x40')][_0x3bf1('0x33')](function(_0x3bc201){_0x49c189[_0x3bf1('0x4b')]('i.'+_0x3bc201);});}else{_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0x91'),'unreadMessages');_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xa1'),'Account.key');_0x49c189['field'](_0x3bf1('0xa2'),_0x3bf1('0xa3'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xa4'),_0x3bf1('0x93'));_0x49c189[_0x3bf1('0x4b')]('i.id');_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xa5'));_0x49c189[_0x3bf1('0x4b')]('i.updatedAt');_0x49c189[_0x3bf1('0x4b')]('i.closed');_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xa6'));_0x49c189['field'](_0x3bf1('0xa7'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xa8'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xa9'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xaa'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xab'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xac'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xad'));_0x49c189[_0x3bf1('0x4b')]('i.substatus');_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xae'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xaf'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xb0'));_0x49c189['field']('i.UserId');_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xb1'),_0x3bf1('0xb2'));_0x49c189['field'](_0x3bf1('0xb3'),_0x3bf1('0xb4'));_0x49c189[_0x3bf1('0x4b')]('c.email',_0x3bf1('0xb5'));_0x49c189['field'](_0x3bf1('0xb6'),_0x3bf1('0xb7'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xb8'),_0x3bf1('0xb9'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xba'),'Contact.fax');_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xbb'),_0x3bf1('0xbc'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xbd'),_0x3bf1('0xbe'));_0x49c189[_0x3bf1('0x4b')](_0x3bf1('0xbf'),_0x3bf1('0x30'));}if(_0x157e5a['limit'])_0x49c189['limit'](_0x157e5a[_0x3bf1('0x24')]);if(_0x157e5a[_0x3bf1('0x23')])_0x49c189['offset'](_0x157e5a[_0x3bf1('0x23')]);return db[_0x3bf1('0x9d')][_0x3bf1('0x43')](_0x49c189[_0x3bf1('0x9e')](),_0x5d2218);})[_0x3bf1('0x2b')](function(_0x255f79){if(_0x255f79[_0x3bf1('0x44')]>0x0)_0x211011[_0x3bf1('0x48')]('ui.MailInteractionId\x20IN\x20?',_[_0x3bf1('0x2f')](_0x255f79,'id'));return db[_0x3bf1('0x9d')]['query'](_0x211011[_0x3bf1('0x9e')](),_0x5d2218)[_0x3bf1('0x2b')](function(_0x376542){var _0xa2b553=_[_0x3bf1('0xc0')](_0x376542,_0x3bf1('0xc1'));var _0x2e3b97=[];return db['Setting'][_0x3bf1('0xc2')]({'attributes':[_0x3bf1('0xc3')],'raw':!![]})['then'](function(_0x487d4a){var _0x29959d=_0x487d4a[_0x3bf1('0xc3')];_0x255f79['forEach'](function(_0x1d0bb2){_0x2e3b97[_0x3bf1('0xc4')](updateMailInteraction(_0x1d0bb2,_0x4122af,_0xa2b553,_0x29959d));});return BPromise[_0x3bf1('0xc5')](_0x2e3b97);});});});})[_0x3bf1('0x2b')](function(_0xbe9a38){_0x3cb201[_0x3bf1('0xc6')]=_0xbe9a38;return _0x3cb201;})[_0x3bf1('0x2b')](respondWithFilteredResult(_0x5952a9,_0x157e5a))[_0x3bf1('0x39')](handleError(_0x5952a9,null));};exports[_0x3bf1('0xc7')]=function(_0x5b66e8,_0x3fb453){var _0x156ebe={'raw':![],'where':{'id':_0x5b66e8[_0x3bf1('0xc8')]['id']}},_0x13d567={};_0x13d567[_0x3bf1('0x3d')]=_['keys'](db['MailInteraction'][_0x3bf1('0xc9')]);_0x13d567['query']=_[_0x3bf1('0x3e')](_0x5b66e8['query']);_0x13d567[_0x3bf1('0x3f')]=_['intersection'](_0x13d567[_0x3bf1('0x3d')],_0x13d567[_0x3bf1('0x43')]);_0x156ebe[_0x3bf1('0x40')]=_['intersection'](_0x13d567['model'],qs[_0x3bf1('0x42')](_0x5b66e8[_0x3bf1('0x43')][_0x3bf1('0x42')]));_0x156ebe[_0x3bf1('0x40')]=_0x156ebe['attributes'][_0x3bf1('0x44')]?_0x156ebe[_0x3bf1('0x40')]:_0x13d567[_0x3bf1('0x3d')];if(_0x5b66e8[_0x3bf1('0x43')][_0x3bf1('0xca')]){_0x156ebe[_0x3bf1('0xcb')]=[{'all':!![]}];}_0x156ebe=_[_0x3bf1('0xa0')]({},_0x156ebe,_0x5b66e8[_0x3bf1('0xcc')]);return db['MailInteraction'][_0x3bf1('0x60')](_0x156ebe)['then'](handleEntityNotFound(_0x3fb453,null))[_0x3bf1('0x2b')](respondWithResult(_0x3fb453,null))[_0x3bf1('0x39')](handleError(_0x3fb453,null));};exports[_0x3bf1('0xcd')]=function(_0x33899b,_0x50b368){return db[_0x3bf1('0x3b')][_0x3bf1('0xcd')](_0x33899b[_0x3bf1('0xce')],{})[_0x3bf1('0x2b')](respondWithResult(_0x50b368,0xc9))[_0x3bf1('0x39')](handleError(_0x50b368,null));};exports[_0x3bf1('0x2a')]=function(_0x4dac19,_0x3f8846){if(_0x4dac19[_0x3bf1('0xce')]['id']){delete _0x4dac19['body']['id'];}return db['MailInteraction']['find']({'where':{'id':_0x4dac19['params']['id']}})[_0x3bf1('0x2b')](handleEntityNotFound(_0x3f8846,null))[_0x3bf1('0x2b')](saveUpdates(_0x4dac19[_0x3bf1('0xce')],null))[_0x3bf1('0x2b')](respondWithResult(_0x3f8846,null))['catch'](handleError(_0x3f8846,null));};exports[_0x3bf1('0xcf')]=function(_0x101ef0,_0x34be3b){return db[_0x3bf1('0x3b')][_0x3bf1('0x60')]({'where':{'id':_0x101ef0[_0x3bf1('0xc8')]['id']}})[_0x3bf1('0x2b')](handleEntityNotFound(_0x34be3b,null))[_0x3bf1('0x2b')](removeEntity(_0x34be3b,null))[_0x3bf1('0x39')](handleError(_0x34be3b,null));};exports[_0x3bf1('0xd0')]=function(_0x18ae7b,_0x4611a3){return db[_0x3bf1('0x3b')][_0x3bf1('0xd0')]()[_0x3bf1('0x2b')](respondWithResult(_0x4611a3,null))[_0x3bf1('0x39')](handleError(_0x4611a3,null));};exports[_0x3bf1('0xd1')]=function(_0x167474,_0x4b4c02,_0x11bfca){return db[_0x3bf1('0x34')]['find']({'where':{'id':_0x167474[_0x3bf1('0xc8')]['id']}})[_0x3bf1('0x2b')](handleEntityNotFound(_0x4b4c02,null))[_0x3bf1('0x2b')](function(_0x24fcaf){if(_0x24fcaf){return _0x24fcaf['addMessage'](_0x167474[_0x3bf1('0xce')][_0x3bf1('0xd2')],_['omit'](_0x167474[_0x3bf1('0xce')],[_0x3bf1('0xd2'),'id'])||{});}})[_0x3bf1('0x2b')](respondWithResult(_0x4b4c02,null))[_0x3bf1('0x39')](handleError(_0x4b4c02,null));};exports[_0x3bf1('0xd3')]=function(_0x570fd2,_0x421317,_0x57c2c2){var _0x4cd28b={'raw':![],'where':{}};var _0x41d784={};var _0x2ad373={'count':0x0,'rows':[]};return db[_0x3bf1('0x3b')][_0x3bf1('0xc2')]({'where':{'id':_0x570fd2['params']['id']}})[_0x3bf1('0x2b')](handleEntityNotFound(_0x421317,null))[_0x3bf1('0x2b')](function(_0x58fd8d){if(_0x58fd8d){_0x41d784[_0x3bf1('0x3d')]=_[_0x3bf1('0x3e')](db['MailMessage'][_0x3bf1('0xc9')]);_0x41d784[_0x3bf1('0x43')]=_[_0x3bf1('0x3e')](_0x570fd2[_0x3bf1('0x43')]);_0x41d784['filters']=_[_0x3bf1('0x41')](_0x41d784[_0x3bf1('0x3d')],_0x41d784[_0x3bf1('0x43')]);_0x4cd28b[_0x3bf1('0x40')]=_[_0x3bf1('0x41')](_0x41d784[_0x3bf1('0x3d')],qs[_0x3bf1('0x42')](_0x570fd2[_0x3bf1('0x43')][_0x3bf1('0x42')]));_0x4cd28b[_0x3bf1('0x40')]=_0x4cd28b[_0x3bf1('0x40')][_0x3bf1('0x44')]?_0x4cd28b[_0x3bf1('0x40')]:_0x41d784[_0x3bf1('0x3d')];if(!_0x570fd2[_0x3bf1('0x43')][_0x3bf1('0x45')]('nolimit')){_0x4cd28b['limit']=qs[_0x3bf1('0x24')](_0x570fd2[_0x3bf1('0x43')]['limit']);_0x4cd28b[_0x3bf1('0x23')]=qs[_0x3bf1('0x23')](_0x570fd2[_0x3bf1('0x43')][_0x3bf1('0x23')]);}_0x4cd28b[_0x3bf1('0x92')]=qs['sort'](_0x570fd2[_0x3bf1('0x43')]['sort']);_0x4cd28b[_0x3bf1('0x48')]=qs[_0x3bf1('0x3f')](_[_0x3bf1('0x49')](_0x570fd2[_0x3bf1('0x43')],_0x41d784[_0x3bf1('0x3f')]));_0x4cd28b[_0x3bf1('0x48')][_0x3bf1('0xc1')]=_0x58fd8d['id'];if(_0x570fd2[_0x3bf1('0x43')][_0x3bf1('0x84')]){_0x4cd28b[_0x3bf1('0x48')]=_[_0x3bf1('0xa0')](_0x4cd28b[_0x3bf1('0x48')],{'$or':_[_0x3bf1('0x2f')](_0x4cd28b[_0x3bf1('0x40')],function(_0x4adc71){var _0x122649={};_0x122649[_0x4adc71]={'$like':'%'+_0x570fd2[_0x3bf1('0x43')][_0x3bf1('0x84')]+'%'};return _0x122649;})});}if(_0x570fd2['query'][_0x3bf1('0x7a')]){var _0x7265a=_0x570fd2['query'][_0x3bf1('0x7a')][_0x3bf1('0x32')](',');var _0x4adf95={};_0x4adf95[_0x7265a[0x0]]={'$gte':moment(_0x7265a[0x1])[_0x3bf1('0xd4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4cd28b[_0x3bf1('0x48')]=_[_0x3bf1('0xa0')](_0x4cd28b['where'],_0x4adf95);}_0x4cd28b=_[_0x3bf1('0xa0')]({},_0x4cd28b,_0x570fd2['options']);return db[_0x3bf1('0x34')][_0x3bf1('0x26')]({'where':_0x4cd28b[_0x3bf1('0x48')]})[_0x3bf1('0x2b')](function(_0x1a0084){_0x2ad373['count']=_0x1a0084;if(_0x570fd2['query'][_0x3bf1('0xca')]){_0x4cd28b[_0x3bf1('0xcb')]=[{'all':!![]}];}return db[_0x3bf1('0x34')][_0x3bf1('0xd5')](_0x4cd28b);})[_0x3bf1('0x2b')](function(_0x52bef9){if(_0x570fd2['query'][_0x3bf1('0xd6')]===_0x3bf1('0xd7')){for(var _0x7933e5=0x0;_0x7933e5<_0x52bef9[_0x3bf1('0x44')];_0x7933e5++){_0x52bef9[_0x7933e5][_0x3bf1('0xce')]=juice(_0x52bef9[_0x7933e5][_0x3bf1('0xce')]);}}_0x2ad373['rows']=_0x52bef9;return _0x2ad373;});}})[_0x3bf1('0x2b')](respondWithFilteredResult(_0x421317,_0x4cd28b))[_0x3bf1('0x39')](handleError(_0x421317,null));};exports[_0x3bf1('0xd8')]=function(_0x1068b2,_0x9ac59b,_0x4fce0c){return db['MailInteraction'][_0x3bf1('0x60')]({'where':{'id':_0x1068b2[_0x3bf1('0xc8')]['id']}})['then'](handleEntityNotFound(_0x9ac59b,null))[_0x3bf1('0x2b')](function(_0x18e70d){if(_0x18e70d){return _0x18e70d['setTags'](_0x1068b2[_0x3bf1('0xce')][_0x3bf1('0xd2')],_[_0x3bf1('0xd9')](_0x1068b2['body'],[_0x3bf1('0xd2'),'id'])||{})[_0x3bf1('0xda')](function(){return db[_0x3bf1('0x6d')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x1068b2[_0x3bf1('0xce')][_0x3bf1('0xd2')]}});})[_0x3bf1('0x2b')](function(_0x1a4efb){socket['emit'](_0x3bf1('0xdb'),{'id':Number(_0x1068b2[_0x3bf1('0xc8')]['id']),'tags':_0x1a4efb||[]});return{'id':Number(_0x1068b2[_0x3bf1('0xc8')]['id']),'tags':_0x1a4efb||[]};});}})[_0x3bf1('0x2b')](respondWithResult(_0x9ac59b,null))[_0x3bf1('0x39')](handleError(_0x9ac59b,null));};exports[_0x3bf1('0xdc')]=function(_0x464bf3,_0x41577b,_0x248e69){return db[_0x3bf1('0x3b')][_0x3bf1('0x60')]({'where':{'id':_0x464bf3[_0x3bf1('0xc8')]['id']}})[_0x3bf1('0x2b')](handleEntityNotFound(_0x41577b,null))['then'](function(_0x1c6408){if(_0x1c6408){return _0x1c6408['removeTags'](_0x464bf3[_0x3bf1('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x41577b,null))[_0x3bf1('0x39')](handleError(_0x41577b,null));};exports['download']=function(_0x5a142a,_0x5110b7){var _0x3fd134=moment()[_0x3bf1('0xdd')]()[_0x3bf1('0x9e')]();var _0x36337a=path[_0x3bf1('0xde')](config[_0x3bf1('0xdf')],_0x3bf1('0xe0'),_0x3bf1('0xe1'),'tmp');var _0xad9fed=path[_0x3bf1('0xde')](config[_0x3bf1('0xdf')],'server',_0x3bf1('0xe1'),_0x3bf1('0xe2'));var _0x445fee=path[_0x3bf1('0xde')](_0x36337a,_0x3fd134);var _0x233771=util[_0x3bf1('0xd4')]('transcript-%d-%s.zip',_0x5a142a[_0x3bf1('0xc8')]['id'],_0x3fd134);var _0x48d901=path[_0x3bf1('0xde')](_0x36337a,_0x233771);var _0x2c3977=[];if(_0x5a142a[_0x3bf1('0x43')][_0x3bf1('0xe2')]){_0x2c3977[_0x3bf1('0xc4')]({'model':db['Attachment'],'as':_0x3bf1('0xe3'),'raw':!![]});}var _0xe26ed0=[{'model':db[_0x3bf1('0x34')],'as':'Messages','attributes':['id',_0x3bf1('0xce'),'from','to','cc',_0x3bf1('0xe4'),'subject',_0x3bf1('0x78')],'where':{'secret':![]},'order':qs[_0x3bf1('0x47')]('id'),'include':_0x2c3977}];return db[_0x3bf1('0x3b')][_0x3bf1('0x60')]({'where':{'id':_0x5a142a[_0x3bf1('0xc8')]['id']},'include':_0xe26ed0})['then'](handleEntityNotFound(_0x5110b7,null))['then'](function(_0x2bf7bd){if(_0x2bf7bd&&_0x2bf7bd['Messages']){var _0x1f1f35=_0x2bf7bd[_0x3bf1('0xe5')]({'plain':!![]});fs[_0x3bf1('0xe6')](_0x445fee);return BPromise[_0x3bf1('0xe7')](_0x1f1f35['Messages'],function(_0x200e72,_0x2c6da9){var _0x3af24a={'from':_0x200e72['from'],'to':_0x200e72['to'],'subject':_0x200e72[_0x3bf1('0xe8')],'html':_0x200e72[_0x3bf1('0xce')],'headers':{'Date':moment(_0x200e72[_0x3bf1('0x78')])['format'](_0x3bf1('0xe9'))},'attachments':[]};if(_0x200e72['cc']){_0x3af24a[_0x3bf1('0xea')]['Cc']=_0x200e72['cc'];}if(_0x200e72[_0x3bf1('0xe4')]){_0x3af24a[_0x3bf1('0xea')][_0x3bf1('0xeb')]=_0x200e72[_0x3bf1('0xe4')];}return new BPromise(function(_0x4d6139,_0x592bb3){if(_0x200e72['Attachments']){for(var _0x5a780c=0x0;_0x5a780c<_0x200e72['Attachments']['length'];_0x5a780c++){var _0x160dd9=_0x200e72['Attachments'][_0x5a780c];var _0x548a62=path[_0x3bf1('0xde')](_0xad9fed,_0x160dd9['basename']);if(fs[_0x3bf1('0xec')](_0x548a62)){_0x3af24a['attachments'][_0x3bf1('0xc4')]({'name':_0x160dd9['name'],'contentType':_0x160dd9[_0x3bf1('0x3c')],'data':fs[_0x3bf1('0xed')](_0x548a62)});}}}emlformat[_0x3bf1('0xee')](_0x3af24a,function(_0x38cdb1,_0x2c210a){if(_0x38cdb1)return _0x592bb3(_0x38cdb1);fs[_0x3bf1('0xef')](path['join'](_0x445fee,util[_0x3bf1('0xd4')]('message%d.eml',_0x2c6da9)),_0x2c210a);return _0x4d6139(_0x2c210a);});});})[_0x3bf1('0x2b')](function(){return new BPromise(function(_0x39e4c6,_0x243a61){zipdir(_0x445fee,{'saveTo':_0x48d901},function(_0x10dd0c,_0x76156d){if(_0x10dd0c)return _0x243a61(_0x10dd0c);return _0x39e4c6(_0x76156d);});})[_0x3bf1('0x2b')](function(){return new BPromise(function(_0x1d7256,_0x4b912e){rimraf(_0x445fee,function(_0x1d71d5){if(_0x1d71d5)_0x4b912e(_0x1d71d5);return _0x1d7256();});});})[_0x3bf1('0x2b')](function(){return _0x5110b7[_0x3bf1('0xf0')](_0x48d901,_0x233771,function(_0x16738d){if(_0x16738d){console[_0x3bf1('0xf1')](_0x3bf1('0xf2'),_0x16738d);}else{fs['unlinkSync'](_0x48d901);}});});});}else{return _0x5110b7[_0x3bf1('0x2c')](0xc8);}})[_0x3bf1('0x39')](handleError(_0x5110b7,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c216330..6981cf0 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 _0x4a00=['remove','getUsers','setDataValue','Users','map','then','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailMessage','save','update'];(function(_0x5ac340,_0x3460e4){var _0x586ac0=function(_0x759ca9){while(--_0x759ca9){_0x5ac340['push'](_0x5ac340['shift']());}};_0x586ac0(++_0x3460e4);}(_0x4a00,0x10b));var _0x04a0=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4a00[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x04a0('0x0'));var MailInteraction=require(_0x04a0('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x04a0('0x1'))['db'][_0x04a0('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x04a0('0x3'),'afterUpdate':_0x04a0('0x4'),'afterDestroy':_0x04a0('0x5')};function emitEvent(_0x5146db){return function(_0x35d159,_0x2c7b50,_0x4802ca){_0x35d159[_0x04a0('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1d9ce1){_0x35d159[_0x04a0('0x7')](_0x04a0('0x8'),_0x1d9ce1[_0x04a0('0x9')](function(_0x447cdc){return{'id':_0x447cdc['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x35d159['id'],'direction':'in','read':![]},'raw':!![]});})[_0x04a0('0xa')](function(_0xb211dc){_0x35d159[_0x04a0('0x7')](_0x04a0('0xb'),_0xb211dc['length']);MailInteractionEvents['emit'](_0x5146db+':'+_0x35d159['id'],_0x35d159);MailInteractionEvents[_0x04a0('0xc')](_0x5146db,_0x35d159);_0x4802ca(null);})[_0x04a0('0xd')](_0x4802ca(null));};}for(var e in events){if(events[_0x04a0('0xe')](e)){var event=events[e];MailInteraction[_0x04a0('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xbb90=['MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x440bca,_0x4e468a){var _0x14f974=function(_0x36f29e){while(--_0x36f29e){_0x440bca['push'](_0x440bca['shift']());}};_0x14f974(++_0x4e468a);}(_0xbb90,0x83));var _0x0bb9=function(_0x55b506,_0x199349){_0x55b506=_0x55b506-0x0;var _0x4e7069=_0xbb90[_0x55b506];return _0x4e7069;};'use strict';var EventEmitter=require(_0x0bb9('0x0'));var MailInteraction=require(_0x0bb9('0x1'))['db'][_0x0bb9('0x2')];var MailMessage=require(_0x0bb9('0x1'))['db'][_0x0bb9('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0bb9('0x4')](0x0);var events={'afterCreate':_0x0bb9('0x5'),'afterUpdate':_0x0bb9('0x6'),'afterDestroy':_0x0bb9('0x7')};function emitEvent(_0x20564e){return function(_0x22992b,_0x12c0fb,_0x5059c1){_0x22992b[_0x0bb9('0x8')]({'attributes':['id'],'raw':!![]})[_0x0bb9('0x9')](function(_0x34b00e){_0x22992b[_0x0bb9('0xa')](_0x0bb9('0xb'),_0x34b00e[_0x0bb9('0xc')](function(_0x5687ce){return{'id':_0x5687ce['id']};}));return MailMessage[_0x0bb9('0xd')]({'where':{'MailInteractionId':_0x22992b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0bb9('0x9')](function(_0x2b3818){_0x22992b['setDataValue'](_0x0bb9('0xe'),_0x2b3818['length']);MailInteractionEvents[_0x0bb9('0xf')](_0x20564e+':'+_0x22992b['id'],_0x22992b);MailInteractionEvents[_0x0bb9('0xf')](_0x20564e,_0x22992b);_0x5059c1(null);})[_0x0bb9('0x10')](_0x5059c1(null));};}for(var e in events){if(events[_0x0bb9('0x11')](e)){var event=events[e];MailInteraction[_0x0bb9('0x12')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ebe433f..50e04d5 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 _0xf62f=['fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','substatus','changed','get','closed','update','then','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions'];(function(_0x456d98,_0x32de7d){var _0x33d143=function(_0x157e9c){while(--_0x157e9c){_0x456d98['push'](_0x456d98['shift']());}};_0x33d143(++_0x32de7d);}(_0xf62f,0x195));var _0xff62=function(_0x17270f,_0x3ce85f){_0x17270f=_0x17270f-0x0;var _0x350eb8=_0xf62f[_0x17270f];return _0x350eb8;};'use strict';var _=require('lodash');var util=require(_0xff62('0x0'));var logger=require('../../config/logger')(_0xff62('0x1'));var moment=require('moment');var BPromise=require(_0xff62('0x2'));var rp=require(_0xff62('0x3'));var fs=require('fs');var path=require(_0xff62('0x4'));var rimraf=require(_0xff62('0x5'));var config=require(_0xff62('0x6'));var attributes=require('./mailInteraction.attributes');module[_0xff62('0x7')]=function(_0x4348b9,_0x295f33){return _0x4348b9[_0xff62('0x8')](_0xff62('0x9'),attributes,{'tableName':_0xff62('0xa'),'paranoid':![],'indexes':[{'name':_0xff62('0xb'),'fields':[_0xff62('0xc'),'to'],'type':_0xff62('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5f4f83,_0x1a0f90,_0x12b5e6){if(_0x5f4f83['substatus']){_0x5f4f83[_0xff62('0xe')]=moment()[_0xff62('0xf')](_0xff62('0x10'));}if(_0x5f4f83['closed']){_0x5f4f83[_0xff62('0x11')]=moment()[_0xff62('0xf')](_0xff62('0x10'));}_0x12b5e6(null,_0x1a0f90);},'beforeUpdate':function(_0x3dc8c6,_0x49ba6d,_0x33abfc){if(_0x3dc8c6['changed']('substatus')){_0x3dc8c6[_0xff62('0xe')]=_0x3dc8c6[_0xff62('0x12')]?moment()['format'](_0xff62('0x10')):null;}if(_0x3dc8c6[_0xff62('0x13')]('closed')){_0x3dc8c6[_0xff62('0x11')]=moment()[_0xff62('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x3dc8c6['substatus']=null;_0x3dc8c6[_0xff62('0xe')]=null;}_0x33abfc(null,_0x3dc8c6);},'afterUpdate':function(_0x2f07a6,_0x12dc7c,_0x5415f4){var _0x39495d=_0x4348b9['models'];var _0x4cc3cf=_0x2f07a6[_0xff62('0x14')]({'plain':!![]});if(_0x4cc3cf[_0xff62('0x15')]){return _0x39495d['MailMessage'][_0xff62('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4cc3cf['id']}})[_0xff62('0x17')](function(){_0x5415f4();})['catch'](function(_0x1c489d){_0x5415f4(_0x1c489d);});}else{_0x5415f4();}}},'charset':_0xff62('0x18'),'collate':_0xff62('0x19')});}; \ No newline at end of file +var _0x04bf=['update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailInteraction.attributes','exports','mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','get','MailMessage'];(function(_0x527228,_0x2bf9d1){var _0x18fc82=function(_0x301e4f){while(--_0x301e4f){_0x527228['push'](_0x527228['shift']());}};_0x18fc82(++_0x2bf9d1);}(_0x04bf,0xd5));var _0xf04b=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x04bf[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xf04b('0x0'));var util=require(_0xf04b('0x1'));var logger=require(_0xf04b('0x2'))(_0xf04b('0x3'));var moment=require(_0xf04b('0x4'));var BPromise=require(_0xf04b('0x5'));var rp=require(_0xf04b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf04b('0x7'));var attributes=require(_0xf04b('0x8'));module[_0xf04b('0x9')]=function(_0x5a2b0f,_0x4ab9ab){return _0x5a2b0f['define']('MailInteraction',attributes,{'tableName':_0xf04b('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0xf04b('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2310fc,_0x32f386,_0x145742){if(_0x2310fc[_0xf04b('0xc')]){_0x2310fc[_0xf04b('0xd')]=moment()[_0xf04b('0xe')](_0xf04b('0xf'));}if(_0x2310fc['closed']){_0x2310fc[_0xf04b('0x10')]=moment()[_0xf04b('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x145742(null,_0x32f386);},'beforeUpdate':function(_0x5e9530,_0x1cc554,_0x740bad){if(_0x5e9530['changed'](_0xf04b('0xc'))){_0x5e9530[_0xf04b('0xd')]=_0x5e9530['substatus']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x5e9530[_0xf04b('0x11')](_0xf04b('0x12'))){_0x5e9530[_0xf04b('0x10')]=moment()['format'](_0xf04b('0xf'));_0x5e9530[_0xf04b('0xc')]=null;_0x5e9530[_0xf04b('0xd')]=null;}_0x740bad(null,_0x5e9530);},'afterUpdate':function(_0x510f90,_0x2cfe5d,_0x10d770){var _0x2041e1=_0x5a2b0f['models'];var _0x576a51=_0x510f90[_0xf04b('0x13')]({'plain':!![]});if(_0x576a51[_0xf04b('0x12')]){return _0x2041e1[_0xf04b('0x14')][_0xf04b('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x576a51['id']}})[_0xf04b('0x16')](function(){_0x10d770();})[_0xf04b('0x17')](function(_0x32f47b){_0x10d770(_0x32f47b);});}else{_0x10d770();}}},'charset':_0xf04b('0x18'),'collate':_0xf04b('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3239296..65747e1 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 _0xa976=['MailInteraction,\x20%s,\x20%s','UpdateMailInteraction','update','options','raw','where','attributes','AddTagsToMailInteraction','MailInteraction','addTags','ids','omit','body','debug','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0xda99d6,_0x5d0efa){var _0x4d8540=function(_0x5e2e94){while(--_0x5e2e94){_0xda99d6['push'](_0xda99d6['shift']());}};_0x4d8540(++_0x5d0efa);}(_0xa976,0xd7));var _0x6a97=function(_0x16f0e7,_0x58729d){_0x16f0e7=_0x16f0e7-0x0;var _0x200463=_0xa976[_0x16f0e7];return _0x200463;};'use strict';var _=require(_0x6a97('0x0'));var util=require(_0x6a97('0x1'));var moment=require('moment');var BPromise=require(_0x6a97('0x2'));var rs=require(_0x6a97('0x3'));var fs=require('fs');var Redis=require(_0x6a97('0x4'));var db=require(_0x6a97('0x5'))['db'];var utils=require(_0x6a97('0x6'));var logger=require(_0x6a97('0x7'))('rpc');var config=require(_0x6a97('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a97('0x9')][_0x6a97('0xa')]({'port':0x232a});config[_0x6a97('0xb')]=_['defaults'](config[_0x6a97('0xb')],{'host':_0x6a97('0xc'),'port':0x18eb});var socket=require(_0x6a97('0xd'))(new Redis(config[_0x6a97('0xb')]));require(_0x6a97('0xe'))[_0x6a97('0xf')](socket);function respondWithRpcPromise(_0x4531ec,_0x26712d,_0x538b68){return new BPromise(function(_0x118d67,_0x450bc7){return client['request'](_0x4531ec,_0x538b68)[_0x6a97('0x10')](function(_0x58c92a){logger[_0x6a97('0x11')]('MailInteraction,\x20%s,\x20%s',_0x26712d,_0x6a97('0x12'));logger['debug'](_0x6a97('0x13'),_0x26712d,_0x6a97('0x12'),JSON[_0x6a97('0x14')](_0x58c92a));if(_0x58c92a[_0x6a97('0x15')]){if(_0x58c92a[_0x6a97('0x15')]['code']===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x26712d,_0x58c92a[_0x6a97('0x15')][_0x6a97('0x16')]);return _0x450bc7(_0x58c92a[_0x6a97('0x15')][_0x6a97('0x16')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x26712d,_0x58c92a[_0x6a97('0x15')]['message']);return _0x118d67(_0x58c92a[_0x6a97('0x15')][_0x6a97('0x16')]);}else{logger[_0x6a97('0x11')]('MailInteraction,\x20%s,\x20%s',_0x26712d,'request\x20sent');_0x118d67(_0x58c92a[_0x6a97('0x17')]['message']);}})[_0x6a97('0x18')](function(_0x19e490){logger['error'](_0x6a97('0x19'),_0x26712d,_0x19e490);_0x450bc7(_0x19e490);});});}exports[_0x6a97('0x1a')]=function(_0x420caf){var _0x4c8cb1=this;return new Promise(function(_0x40756e,_0x30c1df){return db['MailInteraction'][_0x6a97('0x1b')](_0x420caf['body'],{'raw':_0x420caf[_0x6a97('0x1c')]?_0x420caf[_0x6a97('0x1c')][_0x6a97('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x420caf[_0x6a97('0x1c')]?_0x420caf[_0x6a97('0x1c')][_0x6a97('0x1e')]||null:null,'attributes':_0x420caf['options']?_0x420caf['options'][_0x6a97('0x1f')]||null:null,'limit':_0x420caf[_0x6a97('0x1c')]?_0x420caf['options']['limit']||null:null})[_0x6a97('0x10')](function(_0x1810f0){logger['info'](_0x6a97('0x1a'),_0x420caf);logger['debug'](_0x6a97('0x1a'),_0x420caf,JSON['stringify'](_0x1810f0));_0x40756e(_0x1810f0);})['catch'](function(_0x4e4078){logger[_0x6a97('0x15')]('UpdateMailInteraction',_0x4e4078[_0x6a97('0x16')],_0x420caf);_0x30c1df(_0x4c8cb1[_0x6a97('0x15')](0x1f4,_0x4e4078['message']));});});};exports[_0x6a97('0x20')]=function(_0x5ea1b8){return new Promise(function(_0x4136a5,_0x3c17d7){return db[_0x6a97('0x21')]['find']({'where':_0x5ea1b8[_0x6a97('0x1c')]?_0x5ea1b8[_0x6a97('0x1c')][_0x6a97('0x1e')]||null:null})[_0x6a97('0x10')](function(_0x10db2b){if(_0x10db2b){return _0x10db2b[_0x6a97('0x22')](_0x5ea1b8['body'][_0x6a97('0x23')],_[_0x6a97('0x24')](_0x5ea1b8[_0x6a97('0x25')],[_0x6a97('0x23'),'id'])||{});}})['spread'](function(_0x3a300b){logger[_0x6a97('0x11')]('AddTags',_0x5ea1b8);logger[_0x6a97('0x26')](_0x6a97('0x27'),_0x5ea1b8,JSON[_0x6a97('0x14')](_0x3a300b));_0x4136a5(_0x3a300b);})[_0x6a97('0x18')](function(_0x1a0488){logger['error'](_0x6a97('0x27'),_0x1a0488[_0x6a97('0x16')],_0x5ea1b8);_0x3c17d7(_this[_0x6a97('0x15')](0x1f4,_0x1a0488[_0x6a97('0x16')]));});});}; \ No newline at end of file +var _0xc492=['info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','MailInteraction','then','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request'];(function(_0xe24ea5,_0x16c9e6){var _0x2483fd=function(_0x440c56){while(--_0x440c56){_0xe24ea5['push'](_0xe24ea5['shift']());}};_0x2483fd(++_0x16c9e6);}(_0xc492,0xd7));var _0x2c49=function(_0x19a7a0,_0x22de2d){_0x19a7a0=_0x19a7a0-0x0;var _0x4fcc15=_0xc492[_0x19a7a0];return _0x4fcc15;};'use strict';var _=require(_0x2c49('0x0'));var util=require(_0x2c49('0x1'));var moment=require(_0x2c49('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c49('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2c49('0x4'))(_0x2c49('0x5'));var config=require('../../config/environment');var jayson=require(_0x2c49('0x6'));var client=jayson['client'][_0x2c49('0x7')]({'port':0x232a});config[_0x2c49('0x8')]=_['defaults'](config[_0x2c49('0x8')],{'host':_0x2c49('0x9'),'port':0x18eb});var socket=require(_0x2c49('0xa'))(new Redis(config[_0x2c49('0x8')]));require(_0x2c49('0xb'))['register'](socket);function respondWithRpcPromise(_0x3d3e2a,_0x4f64f2,_0x493cd2){return new BPromise(function(_0x4a6340,_0x57c2aa){return client[_0x2c49('0xc')](_0x3d3e2a,_0x493cd2)['then'](function(_0x4260d1){logger[_0x2c49('0xd')]('MailInteraction,\x20%s,\x20%s',_0x4f64f2,_0x2c49('0xe'));logger[_0x2c49('0xf')](_0x2c49('0x10'),_0x4f64f2,_0x2c49('0xe'),JSON[_0x2c49('0x11')](_0x4260d1));if(_0x4260d1[_0x2c49('0x12')]){if(_0x4260d1['error'][_0x2c49('0x13')]===0x1f4){logger[_0x2c49('0x12')](_0x2c49('0x14'),_0x4f64f2,_0x4260d1[_0x2c49('0x12')][_0x2c49('0x15')]);return _0x57c2aa(_0x4260d1['error'][_0x2c49('0x15')]);}logger[_0x2c49('0x12')](_0x2c49('0x14'),_0x4f64f2,_0x4260d1[_0x2c49('0x12')][_0x2c49('0x15')]);return _0x4a6340(_0x4260d1[_0x2c49('0x12')][_0x2c49('0x15')]);}else{logger[_0x2c49('0xd')](_0x2c49('0x14'),_0x4f64f2,_0x2c49('0xe'));_0x4a6340(_0x4260d1['result'][_0x2c49('0x15')]);}})[_0x2c49('0x16')](function(_0x3dfb36){logger[_0x2c49('0x12')]('MailInteraction,\x20%s,\x20%s',_0x4f64f2,_0x3dfb36);_0x57c2aa(_0x3dfb36);});});}exports[_0x2c49('0x17')]=function(_0x578c07){var _0xc7b6cc=this;return new Promise(function(_0x11de5f,_0x573157){return db['MailInteraction'][_0x2c49('0x18')](_0x578c07[_0x2c49('0x19')],{'raw':_0x578c07[_0x2c49('0x1a')]?_0x578c07[_0x2c49('0x1a')][_0x2c49('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x578c07[_0x2c49('0x1a')]?_0x578c07[_0x2c49('0x1a')][_0x2c49('0x1c')]||null:null,'attributes':_0x578c07[_0x2c49('0x1a')]?_0x578c07['options'][_0x2c49('0x1d')]||null:null,'limit':_0x578c07[_0x2c49('0x1a')]?_0x578c07[_0x2c49('0x1a')][_0x2c49('0x1e')]||null:null})['then'](function(_0x147016){logger[_0x2c49('0xd')](_0x2c49('0x17'),_0x578c07);logger[_0x2c49('0xf')]('UpdateMailInteraction',_0x578c07,JSON[_0x2c49('0x11')](_0x147016));_0x11de5f(_0x147016);})[_0x2c49('0x16')](function(_0x25bf3d){logger['error'](_0x2c49('0x17'),_0x25bf3d[_0x2c49('0x15')],_0x578c07);_0x573157(_0xc7b6cc['error'](0x1f4,_0x25bf3d[_0x2c49('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0x517085){return new Promise(function(_0x12d3c1,_0x4d2564){return db[_0x2c49('0x1f')]['find']({'where':_0x517085[_0x2c49('0x1a')]?_0x517085[_0x2c49('0x1a')][_0x2c49('0x1c')]||null:null})[_0x2c49('0x20')](function(_0x585b04){if(_0x585b04){return _0x585b04[_0x2c49('0x21')](_0x517085[_0x2c49('0x19')][_0x2c49('0x22')],_[_0x2c49('0x23')](_0x517085[_0x2c49('0x19')],['ids','id'])||{});}})[_0x2c49('0x24')](function(_0x53b2b8){logger[_0x2c49('0xd')](_0x2c49('0x25'),_0x517085);logger[_0x2c49('0xf')](_0x2c49('0x25'),_0x517085,JSON[_0x2c49('0x11')](_0x53b2b8));_0x12d3c1(_0x53b2b8);})[_0x2c49('0x16')](function(_0x397ce9){logger[_0x2c49('0x12')](_0x2c49('0x25'),_0x397ce9[_0x2c49('0x15')],_0x517085);_0x4d2564(_this[_0x2c49('0x12')](0x1f4,_0x397ce9[_0x2c49('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index e08ab88..640c0b4 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 _0x2858=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x2af75d,_0x355929){var _0x1a2871=function(_0x14b199){while(--_0x14b199){_0x2af75d['push'](_0x2af75d['shift']());}};_0x1a2871(++_0x355929);}(_0x2858,0x10d));var _0x8285=function(_0x1c0b71,_0x5a9945){_0x1c0b71=_0x1c0b71-0x0;var _0x29eddc=_0x2858[_0x1c0b71];return _0x29eddc;};'use strict';var MailInteractionEvents=require(_0x8285('0x0'));var events=[_0x8285('0x1'),_0x8285('0x2'),_0x8285('0x3')];function createListener(_0x48d4d6,_0x38ecc9){return function(_0x20cacc){_0x38ecc9[_0x8285('0x4')](_0x48d4d6,_0x20cacc);};}function removeListener(_0x2f6172,_0x2d3215){return function(){MailInteractionEvents[_0x8285('0x5')](_0x2f6172,_0x2d3215);};}exports[_0x8285('0x6')]=function(_0x225d18){for(var _0x1cb9a9=0x0,_0x5cad1b=events[_0x8285('0x7')];_0x1cb9a9<_0x5cad1b;_0x1cb9a9++){var _0x449164=events[_0x1cb9a9];var _0x1fd728=createListener(_0x8285('0x8')+_0x449164,_0x225d18);MailInteractionEvents['on'](_0x449164,_0x1fd728);}}; \ No newline at end of file +var _0xc2f3=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','register'];(function(_0x4c676a,_0x518530){var _0x2c5286=function(_0x45563e){while(--_0x45563e){_0x4c676a['push'](_0x4c676a['shift']());}};_0x2c5286(++_0x518530);}(_0xc2f3,0x1c1));var _0x3c2f=function(_0x123113,_0x59abe4){_0x123113=_0x123113-0x0;var _0x38b599=_0xc2f3[_0x123113];return _0x38b599;};'use strict';var MailInteractionEvents=require(_0x3c2f('0x0'));var events=[_0x3c2f('0x1'),_0x3c2f('0x2'),_0x3c2f('0x3')];function createListener(_0x28aaed,_0xb3d431){return function(_0x375218){_0xb3d431[_0x3c2f('0x4')](_0x28aaed,_0x375218);};}function removeListener(_0x104740,_0x312879){return function(){MailInteractionEvents['removeListener'](_0x104740,_0x312879);};}exports[_0x3c2f('0x5')]=function(_0x5c1460){for(var _0x44d224=0x0,_0x4f058e=events['length'];_0x44d224<_0x4f058e;_0x44d224++){var _0x3ab27e=events[_0x44d224];var _0x4270d5=createListener(_0x3c2f('0x6')+_0x3ab27e,_0x5c1460);MailInteractionEvents['on'](_0x3ab27e,_0x4270d5);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index abf433f..a1b8d80 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 _0x622f=['../../components/auth/service','../../config/environment','./mailMessage.controller','index','get','isAuthenticated','describe','/:id/download','download','tracked','mail','mailmessage:create','put','/:id','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x1825ca,_0x226c42){var _0x2b6413=function(_0x4c7a2d){while(--_0x4c7a2d){_0x1825ca['push'](_0x1825ca['shift']());}};_0x2b6413(++_0x226c42);}(_0x622f,0x172));var _0xf622=function(_0x4856d8,_0x42ac35){_0x4856d8=_0x4856d8-0x0;var _0x43733d=_0x622f[_0x4856d8];return _0x43733d;};'use strict';var multer=require(_0xf622('0x0'));var util=require(_0xf622('0x1'));var path=require('path');var timeout=require(_0xf622('0x2'));var express=require(_0xf622('0x3'));var router=express[_0xf622('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf622('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf622('0x6'));var controller=require(_0xf622('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf622('0x8')]);router[_0xf622('0x9')]('/describe',auth[_0xf622('0xa')](),controller[_0xf622('0xb')]);router['get']('/:id',auth[_0xf622('0xa')](),controller['show']);router[_0xf622('0x9')](_0xf622('0xc'),auth[_0xf622('0xa')](),controller[_0xf622('0xd')]);router['post']('/',auth[_0xf622('0xa')](),interaction[_0xf622('0xe')](_0xf622('0xf'),_0xf622('0x10')),controller['create']);router[_0xf622('0x11')](_0xf622('0x12'),auth[_0xf622('0xa')](),controller['update']);router[_0xf622('0x11')](_0xf622('0x13'),auth[_0xf622('0xa')](),controller[_0xf622('0x14')]);router[_0xf622('0x11')](_0xf622('0x15'),auth['isAuthenticated'](),controller[_0xf622('0x16')]);router['delete'](_0xf622('0x12'),auth['isAuthenticated'](),controller[_0xf622('0x17')]);module[_0xf622('0x18')]=router; \ No newline at end of file +var _0x7035=['/describe','describe','/:id','tracked','mail','create','update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x324c95,_0x69b68f){var _0x25f8ab=function(_0x384d5c){while(--_0x384d5c){_0x324c95['push'](_0x324c95['shift']());}};_0x25f8ab(++_0x69b68f);}(_0x7035,0x15e));var _0x5703=function(_0xf90e79,_0x5a9fd2){_0xf90e79=_0xf90e79-0x0;var _0x377513=_0x7035[_0xf90e79];return _0x377513;};'use strict';var multer=require(_0x5703('0x0'));var util=require('util');var path=require(_0x5703('0x1'));var timeout=require(_0x5703('0x2'));var express=require('express');var router=express[_0x5703('0x3')]();var fs_extra=require(_0x5703('0x4'));var auth=require(_0x5703('0x5'));var interaction=require(_0x5703('0x6'));var config=require(_0x5703('0x7'));var controller=require('./mailMessage.controller');router[_0x5703('0x8')]('/',auth[_0x5703('0x9')](),controller['index']);router[_0x5703('0x8')](_0x5703('0xa'),auth[_0x5703('0x9')](),controller[_0x5703('0xb')]);router[_0x5703('0x8')](_0x5703('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5703('0x8')]('/:id/download',auth[_0x5703('0x9')](),controller['download']);router['post']('/',auth[_0x5703('0x9')](),interaction[_0x5703('0xd')](_0x5703('0xe'),'mailmessage:create'),controller[_0x5703('0xf')]);router['put'](_0x5703('0xc'),auth[_0x5703('0x9')](),controller[_0x5703('0x10')]);router[_0x5703('0x11')](_0x5703('0x12'),auth[_0x5703('0x9')](),controller[_0x5703('0x13')]);router[_0x5703('0x11')](_0x5703('0x14'),auth[_0x5703('0x9')](),controller[_0x5703('0x15')]);router['delete'](_0x5703('0xc'),auth[_0x5703('0x9')](),controller[_0x5703('0x16')]);module[_0x5703('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 376e5b4..aa52be0 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 _0xc65a=['TEXT','medium','ENUM','out','STRING','long','DATE','INTEGER','BOOLEAN','Email','sequelize','exports'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0xc65a,0xfa));var _0xac65=function(_0x541845,_0x89d05c){_0x541845=_0x541845-0x0;var _0x387494=_0xc65a[_0x541845];return _0x387494;};'use strict';var Sequelize=require(_0xac65('0x0'));var _=require('lodash');module[_0xac65('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xac65('0x2')](_0xac65('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xac65('0x4')]('in',_0xac65('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xac65('0x6')](0x1fe)},'from':{'type':Sequelize[_0xac65('0x6')]},'to':{'type':Sequelize[_0xac65('0x2')](_0xac65('0x7'))},'cc':{'type':Sequelize['TEXT'](_0xac65('0x7'))},'bcc':{'type':Sequelize[_0xac65('0x2')](_0xac65('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xac65('0x8')]},'attach':{'type':Sequelize[_0xac65('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xac65('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xac65('0x2')](_0xac65('0x7'))},'originCc':{'type':Sequelize[_0xac65('0x2')](_0xac65('0x7'))},'originChannel':{'type':Sequelize[_0xac65('0x4')](_0xac65('0xb'),'Chat'),'defaultValue':_0xac65('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xcea5=['STRING','TEXT','DATE','Email','Chat','sequelize','exports','long','medium','BOOLEAN','ENUM','out'];(function(_0x424f90,_0x14e8fe){var _0x249124=function(_0x5e0884){while(--_0x5e0884){_0x424f90['push'](_0x424f90['shift']());}};_0x249124(++_0x14e8fe);}(_0xcea5,0x1a9));var _0x5cea=function(_0xd00585,_0x52539e){_0xd00585=_0xd00585-0x0;var _0x2ff6d3=_0xcea5[_0xd00585];return _0x2ff6d3;};'use strict';var Sequelize=require(_0x5cea('0x0'));var _=require('lodash');module[_0x5cea('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5cea('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x5cea('0x3'))},'read':{'type':Sequelize[_0x5cea('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5cea('0x5')]('in','out'),'defaultValue':_0x5cea('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5cea('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x5cea('0x2'))},'cc':{'type':Sequelize[_0x5cea('0x8')](_0x5cea('0x2'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x5cea('0x8')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5cea('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5cea('0x9')]},'originTo':{'type':Sequelize[_0x5cea('0x8')](_0x5cea('0x2'))},'originCc':{'type':Sequelize[_0x5cea('0x8')](_0x5cea('0x2'))},'originChannel':{'type':Sequelize['ENUM'](_0x5cea('0xa'),_0x5cea('0xb')),'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 04c3e6b..cbf0e86 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 _0xf962=['QueryTypes','contact','User','email','internal','interface','SIP/%s','channel','event','fromString','EventManager','acceptmessage','mail','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT','fullname','reject','download','toString','server','message-%s.eml','from','bcc','subject','Attachment','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','log','err','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','name','map','MailMessage','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','show','rawAttributes','fields','includeAll','find','params','describe','create','body','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','Contacts','updatedAt','MailServerOut','Smtp','host','port','secure','authentication','auth','pass','service','user','attachments','join','root','server/files/attachments','List','CmContact','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','accept','read','readAt','UserId','agent','get','isNil','read1stAt','interaction','[MAILMESSAGE: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'];(function(_0x313c21,_0x4b2db7){var _0x5528de=function(_0x4166af){while(--_0x4166af){_0x313c21['push'](_0x313c21['shift']());}};_0x5528de(++_0x4b2db7);}(_0xf962,0xd8));var _0x2f96=function(_0x18a066,_0x15f3a5){_0x18a066=_0x18a066-0x0;var _0x5ccbb1=_0xf962[_0x18a066];return _0x5ccbb1;};'use strict';var emlformat=require(_0x2f96('0x0'));var rimraf=require(_0x2f96('0x1'));var zipdir=require(_0x2f96('0x2'));var jsonpatch=require(_0x2f96('0x3'));var rp=require('request-promise');var moment=require(_0x2f96('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2f96('0x5'));var util=require(_0x2f96('0x6'));var path=require(_0x2f96('0x7'));var sox=require(_0x2f96('0x8'));var csv=require(_0x2f96('0x9'));var ejs=require(_0x2f96('0xa'));var fs=require('fs');var fs_extra=require(_0x2f96('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2f96('0xc'));var jsforce=require(_0x2f96('0xd'));var deskjs=require(_0x2f96('0xe'));var toCsv=require(_0x2f96('0x9'));var querystring=require('querystring');var Papa=require(_0x2f96('0xf'));var Redis=require(_0x2f96('0x10'));var authService=require(_0x2f96('0x11'));var qs=require(_0x2f96('0x12'));var as=require(_0x2f96('0x13'));var hardwareService=require(_0x2f96('0x14'));var logger=require('../../config/logger')(_0x2f96('0x15'));var utils=require(_0x2f96('0x16'));var config=require(_0x2f96('0x17'));var licenseUtil=require(_0x2f96('0x18'));var htmlToText=require('html-to-text');var db=require(_0x2f96('0x19'))['db'];config['redis']=_[_0x2f96('0x1a')](config[_0x2f96('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f96('0x1c'))(new Redis(config[_0x2f96('0x1b')]));require('./mailMessage.socket')[_0x2f96('0x1d')](socket);var jayson=require(_0x2f96('0x1e'));var client=jayson[_0x2f96('0x1f')][_0x2f96('0x20')]({'port':0x232c});var client9003=jayson['client'][_0x2f96('0x20')]({'port':0x232b});var client9002=jayson[_0x2f96('0x1f')][_0x2f96('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x433eb1,_0x4ae7be,_0x368b75,_0x3bf716){return new BPromise(function(_0x3ec881,_0x4cddc8){var _0x3387b0=_0x3bf716||client;return _0x3387b0[_0x2f96('0x21')](_0x433eb1,_0x368b75)['then'](function(_0x3142d9){logger[_0x2f96('0x22')](_0x2f96('0x23'),_0x4ae7be,_0x2f96('0x24'));logger['debug'](_0x2f96('0x25'),_0x4ae7be,_0x2f96('0x24'),JSON[_0x2f96('0x26')](_0x3142d9));if(_0x3142d9[_0x2f96('0x27')]){if(_0x3142d9[_0x2f96('0x27')][_0x2f96('0x28')]===0x1f4){logger[_0x2f96('0x27')](_0x2f96('0x23'),_0x4ae7be,_0x3142d9[_0x2f96('0x27')][_0x2f96('0x29')]);return _0x4cddc8(_0x3142d9[_0x2f96('0x27')][_0x2f96('0x29')]);}logger[_0x2f96('0x27')](_0x2f96('0x23'),_0x4ae7be,_0x3142d9[_0x2f96('0x27')]['message']);return _0x3ec881(_0x3142d9['error']['message']);}else{logger[_0x2f96('0x22')](_0x2f96('0x23'),_0x4ae7be,_0x2f96('0x24'));_0x3ec881(_0x3142d9['result']['message']);}})[_0x2f96('0x2a')](function(_0x2deea1){logger[_0x2f96('0x27')](_0x2f96('0x23'),_0x4ae7be,_0x2deea1);_0x4cddc8(_0x2deea1);});});}function respondWithStatusCode(_0x487efa,_0x1558b3){_0x1558b3=_0x1558b3||0xcc;return function(_0x33377c){if(_0x33377c){return _0x487efa[_0x2f96('0x2b')](_0x1558b3);}return _0x487efa[_0x2f96('0x2c')](_0x1558b3)['end']();};}function respondWithResult(_0x537589,_0x465ee6){_0x465ee6=_0x465ee6||0xc8;return function(_0x417a2b){if(_0x417a2b){return _0x537589[_0x2f96('0x2c')](_0x465ee6)['json'](_0x417a2b);}};}function respondWithFilteredResult(_0x468049,_0x1bcb37){return function(_0x1c3995){if(_0x1c3995){var _0x294046=typeof _0x1bcb37[_0x2f96('0x2d')]===_0x2f96('0x2e')&&typeof _0x1bcb37[_0x2f96('0x2f')]===_0x2f96('0x2e');var _0x1327cb=_0x1c3995[_0x2f96('0x30')];var _0xdb5787=_0x294046?0x0:_0x1bcb37[_0x2f96('0x2d')];var _0x51f462=_0x294046?_0x1c3995[_0x2f96('0x30')]:_0x1bcb37['offset']+_0x1bcb37[_0x2f96('0x2f')];var _0x322fb4;if(_0x51f462>=_0x1327cb){_0x51f462=_0x1327cb;_0x322fb4=0xc8;}else{_0x322fb4=0xce;}_0x468049['status'](_0x322fb4);return _0x468049[_0x2f96('0x31')](_0x2f96('0x32'),_0xdb5787+'-'+_0x51f462+'/'+_0x1327cb)['json'](_0x1c3995);}return null;};}function patchUpdates(_0x66e3bc){return function(_0xa681c1){try{jsonpatch[_0x2f96('0x33')](_0xa681c1,_0x66e3bc,!![]);}catch(_0x2aa65c){return BPromise['reject'](_0x2aa65c);}return _0xa681c1[_0x2f96('0x34')]();};}function saveUpdates(_0x185b6e,_0x312e35){return function(_0x49c61c){if(_0x49c61c){return _0x49c61c[_0x2f96('0x35')](_0x185b6e)[_0x2f96('0x36')](function(_0x627fb){return _0x627fb;});}return null;};}function removeEntity(_0x5a0053,_0x411d08){return function(_0x5e4c73){if(_0x5e4c73){return _0x5e4c73[_0x2f96('0x37')]()[_0x2f96('0x36')](function(){_0x5a0053[_0x2f96('0x2c')](0xcc)[_0x2f96('0x38')]();});}};}function handleEntityNotFound(_0x112178,_0x3066e3){return function(_0xaec159){if(!_0xaec159){_0x112178[_0x2f96('0x2b')](0x194);}return _0xaec159;};}function handleError(_0x590183,_0x53da72){_0x53da72=_0x53da72||0x1f4;return function(_0x185d69){logger[_0x2f96('0x27')](_0x185d69['stack']);if(_0x185d69[_0x2f96('0x39')]){delete _0x185d69[_0x2f96('0x39')];}_0x590183['status'](_0x53da72)['send'](_0x185d69);};}exports['index']=function(_0x2beaa6,_0xa6cba9){var _0x721b7={},_0x377dc6={},_0x4a58e8={'count':0x0,'rows':[]};var _0x2b0aa2=_[_0x2f96('0x3a')](db[_0x2f96('0x3b')]['rawAttributes'],function(_0xe4a8cd){return{'name':_0xe4a8cd['fieldName'],'type':_0xe4a8cd['type'][_0x2f96('0x3c')]};});_0x377dc6[_0x2f96('0x3d')]=_[_0x2f96('0x3a')](_0x2b0aa2,_0x2f96('0x39'));_0x377dc6[_0x2f96('0x3e')]=_[_0x2f96('0x3f')](_0x2beaa6[_0x2f96('0x3e')]);_0x377dc6[_0x2f96('0x40')]=_[_0x2f96('0x41')](_0x377dc6['model'],_0x377dc6[_0x2f96('0x3e')]);_0x721b7[_0x2f96('0x42')]=_['intersection'](_0x377dc6[_0x2f96('0x3d')],qs['fields'](_0x2beaa6[_0x2f96('0x3e')]['fields']));_0x721b7[_0x2f96('0x42')]=_0x721b7['attributes'][_0x2f96('0x43')]?_0x721b7['attributes']:_0x377dc6[_0x2f96('0x3d')];if(!_0x2beaa6[_0x2f96('0x3e')]['hasOwnProperty'](_0x2f96('0x44'))){_0x721b7[_0x2f96('0x2f')]=qs[_0x2f96('0x2f')](_0x2beaa6['query'][_0x2f96('0x2f')]);_0x721b7[_0x2f96('0x2d')]=qs[_0x2f96('0x2d')](_0x2beaa6[_0x2f96('0x3e')][_0x2f96('0x2d')]);}_0x721b7['order']=qs[_0x2f96('0x45')](_0x2beaa6[_0x2f96('0x3e')][_0x2f96('0x45')]);_0x721b7[_0x2f96('0x46')]=qs[_0x2f96('0x40')](_['pick'](_0x2beaa6[_0x2f96('0x3e')],_0x377dc6[_0x2f96('0x40')]),_0x2b0aa2);if(_0x2beaa6[_0x2f96('0x3e')][_0x2f96('0x47')]){_0x721b7[_0x2f96('0x46')]=_[_0x2f96('0x48')](_0x721b7['where'],{'$or':_['map'](_0x2b0aa2,function(_0x56b445){if(_0x56b445[_0x2f96('0x49')]!==_0x2f96('0x4a')){var _0x26d117={};_0x26d117[_0x56b445['name']]={'$like':'%'+_0x2beaa6[_0x2f96('0x3e')]['filter']+'%'};return _0x26d117;}})});}_0x721b7=_[_0x2f96('0x48')]({},_0x721b7,_0x2beaa6[_0x2f96('0x4b')]);var _0x37de9f={'where':_0x721b7[_0x2f96('0x46')]};return db['MailMessage'][_0x2f96('0x30')](_0x37de9f)[_0x2f96('0x36')](function(_0x46aaca){_0x4a58e8['count']=_0x46aaca;if(_0x2beaa6[_0x2f96('0x3e')]['includeAll']){_0x721b7[_0x2f96('0x4c')]=[{'all':!![]}];}return db[_0x2f96('0x3b')][_0x2f96('0x4d')](_0x721b7);})[_0x2f96('0x36')](function(_0x68c5f1){_0x4a58e8['rows']=_0x68c5f1;return _0x4a58e8;})[_0x2f96('0x36')](respondWithFilteredResult(_0xa6cba9,_0x721b7))['catch'](handleError(_0xa6cba9,null));};exports[_0x2f96('0x4e')]=function(_0x1b0228,_0x101e99){var _0x6dc2a2={'raw':!![],'where':{'id':_0x1b0228['params']['id']}},_0x4ded3f={};_0x4ded3f[_0x2f96('0x3d')]=_[_0x2f96('0x3f')](db[_0x2f96('0x3b')][_0x2f96('0x4f')]);_0x4ded3f[_0x2f96('0x3e')]=_[_0x2f96('0x3f')](_0x1b0228['query']);_0x4ded3f['filters']=_[_0x2f96('0x41')](_0x4ded3f['model'],_0x4ded3f[_0x2f96('0x3e')]);_0x6dc2a2[_0x2f96('0x42')]=_['intersection'](_0x4ded3f[_0x2f96('0x3d')],qs[_0x2f96('0x50')](_0x1b0228[_0x2f96('0x3e')]['fields']));_0x6dc2a2['attributes']=_0x6dc2a2[_0x2f96('0x42')][_0x2f96('0x43')]?_0x6dc2a2[_0x2f96('0x42')]:_0x4ded3f[_0x2f96('0x3d')];if(_0x1b0228[_0x2f96('0x3e')][_0x2f96('0x51')]){_0x6dc2a2[_0x2f96('0x4c')]=[{'all':!![]}];}_0x6dc2a2=_[_0x2f96('0x48')]({},_0x6dc2a2,_0x1b0228[_0x2f96('0x4b')]);return db[_0x2f96('0x3b')][_0x2f96('0x52')](_0x6dc2a2)['then'](handleEntityNotFound(_0x101e99,null))['then'](respondWithResult(_0x101e99,null))[_0x2f96('0x2a')](handleError(_0x101e99,null));};exports[_0x2f96('0x35')]=function(_0x4f0ac6,_0x5bb497){if(_0x4f0ac6['body']['id']){delete _0x4f0ac6['body']['id'];}return db[_0x2f96('0x3b')][_0x2f96('0x52')]({'where':{'id':_0x4f0ac6['params']['id']}})['then'](handleEntityNotFound(_0x5bb497,null))[_0x2f96('0x36')](saveUpdates(_0x4f0ac6['body'],null))[_0x2f96('0x36')](respondWithResult(_0x5bb497,null))[_0x2f96('0x2a')](handleError(_0x5bb497,null));};exports[_0x2f96('0x37')]=function(_0xda424f,_0x380b71){return db['MailMessage'][_0x2f96('0x52')]({'where':{'id':_0xda424f[_0x2f96('0x53')]['id']}})[_0x2f96('0x36')](handleEntityNotFound(_0x380b71,null))[_0x2f96('0x36')](removeEntity(_0x380b71,null))[_0x2f96('0x2a')](handleError(_0x380b71,null));};exports[_0x2f96('0x54')]=function(_0x1a1042,_0x3bb080){return db[_0x2f96('0x3b')][_0x2f96('0x54')]()[_0x2f96('0x36')](respondWithResult(_0x3bb080,null))[_0x2f96('0x2a')](handleError(_0x3bb080,null));};exports[_0x2f96('0x55')]=function(_0x33b91e,_0x30fd0e){return db[_0x2f96('0x3b')][_0x2f96('0x55')](_0x33b91e[_0x2f96('0x56')])[_0x2f96('0x36')](function(_0x9f5699){if(_0x9f5699){if(_0x9f5699[_0x2f96('0x57')]===_0x2f96('0x58')&&!_0x9f5699[_0x2f96('0x59')]){var _0x389251,_0x121b19,_0x25829b;if(_0x33b91e['body']['to']){_0x121b19=_0x33b91e[_0x2f96('0x56')]['to'][_0x2f96('0x5a')](',')[0x0];}return db[_0x2f96('0x5b')][_0x2f96('0x5c')]({'where':{'id':_0x9f5699[_0x2f96('0x5d')]},'include':[{'model':db[_0x2f96('0x5e')],'as':'List','include':[{'model':db['CmContact'],'as':_0x2f96('0x5f'),'where':{'email':_0x121b19},'limit':0x1,'order':[[_0x2f96('0x60'),'DESC']]}]},{'model':db[_0x2f96('0x61')],'as':_0x2f96('0x62'),'raw':!![]}]})[_0x2f96('0x36')](function(_0x2b2e2f){_0x389251=_0x2b2e2f;if(_0x389251&&_0x389251[_0x2f96('0x62')]){var _0x1a0591={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x389251[_0x2f96('0x62')]['service'])){_0x1a0591[_0x2f96('0x63')]=_0x389251[_0x2f96('0x62')][_0x2f96('0x63')];_0x1a0591['port']=_0x389251[_0x2f96('0x62')][_0x2f96('0x64')];_0x1a0591[_0x2f96('0x65')]=_0x389251[_0x2f96('0x62')][_0x2f96('0x65')];if(_0x389251[_0x2f96('0x62')][_0x2f96('0x66')]){_0x1a0591[_0x2f96('0x67')]={'user':_0x389251[_0x2f96('0x62')]['user'],'pass':_0x389251['Smtp'][_0x2f96('0x68')]};}}else{_0x1a0591[_0x2f96('0x69')]=_0x389251['Smtp'][_0x2f96('0x69')];_0x1a0591[_0x2f96('0x67')]={'user':_0x389251[_0x2f96('0x62')][_0x2f96('0x6a')],'pass':_0x389251[_0x2f96('0x62')][_0x2f96('0x68')]};_0x1a0591[_0x2f96('0x65')]=_0x389251[_0x2f96('0x62')]['secure'];}if(_0x33b91e['body']['attachments']&&_0x33b91e[_0x2f96('0x56')][_0x2f96('0x6b')][_0x2f96('0x43')]){for(var _0x11ecaf=0x0;_0x11ecaf<_0x33b91e[_0x2f96('0x56')][_0x2f96('0x6b')][_0x2f96('0x43')];_0x11ecaf+=0x1){_0x33b91e['body'][_0x2f96('0x6b')][_0x11ecaf]={'filename':_0x33b91e[_0x2f96('0x56')]['attachments'][_0x11ecaf][_0x2f96('0x39')],'path':path[_0x2f96('0x6c')](config[_0x2f96('0x6d')],_0x2f96('0x6e'),_0x33b91e[_0x2f96('0x56')][_0x2f96('0x6b')][_0x11ecaf]['basename'])};}}_0x25829b={'account':_0x1a0591,'message':_0x33b91e[_0x2f96('0x56')]};return;}})[_0x2f96('0x36')](function(){if(_0x389251['List']){if(_0x389251[_0x2f96('0x6f')]['Contacts'][_0x2f96('0x43')]){return _0x389251['List']['Contacts'][0x0];}else{return db[_0x2f96('0x70')][_0x2f96('0x55')](_[_0x2f96('0x1a')](_0x33b91e[_0x2f96('0x56')],{'firstName':_0x33b91e['body']['to'],'email':_0x33b91e[_0x2f96('0x56')]['to'],'phone':_0x33b91e[_0x2f96('0x56')]['to'],'ListId':_0x389251[_0x2f96('0x71')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x25829b){return respondWithRpcPromise(_0x2f96('0x72'),_0x2f96('0x73'),_0x25829b,client9003)['then'](function(_0x5f3b3){return _0x9f5699[_0x2f96('0x35')]({'read':!![],'messageId':_0x5f3b3[_0x2f96('0x74')],'sentAt':moment()[_0x2f96('0x75')](_0x2f96('0x76'))});})[_0x2f96('0x2a')](function(_0x29581b){logger['error']('%s',JSON[_0x2f96('0x26')](_0x29581b));return _0x9f5699;});}return _0x9f5699;});}return _0x9f5699;}})['then'](respondWithResult(_0x30fd0e,0xc9))[_0x2f96('0x2a')](handleError(_0x30fd0e,null));};var interaction_log=require(_0x2f96('0x77'))(_0x2f96('0x78'));exports[_0x2f96('0x79')]=function(_0x2bb6a8,_0x4e8914,_0x27fb72){var _0x60b21d={'agent':{},'channel':'mail'};if(_0x2bb6a8[_0x2f96('0x56')]['id']){delete _0x2bb6a8[_0x2f96('0x56')]['id'];}_0x2bb6a8[_0x2f96('0x56')][_0x2f96('0x7a')]=!![];_0x2bb6a8[_0x2f96('0x56')][_0x2f96('0x7b')]=moment()[_0x2f96('0x75')](_0x2f96('0x76'));_0x2bb6a8[_0x2f96('0x56')]['UserId']=_0x2bb6a8[_0x2f96('0x56')][_0x2f96('0x7c')]||_0x2bb6a8[_0x2f96('0x6a')]['id'];_0x60b21d[_0x2f96('0x7d')]['id']=_0x2bb6a8['body'][_0x2f96('0x7c')];return db[_0x2f96('0x3b')]['find']({'where':{'id':_0x2bb6a8[_0x2f96('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4e8914,null))[_0x2f96('0x36')](saveUpdates(_0x2bb6a8['body'],null))[_0x2f96('0x36')](function(_0xcf6843){if(_0xcf6843){_0x60b21d['message']=_0xcf6843[_0x2f96('0x7e')]({'plain':!![]});return db['MailInteraction'][_0x2f96('0x52')]({'where':{'id':_0xcf6843['MailInteractionId']}});}return null;})[_0x2f96('0x36')](handleEntityNotFound(_0x4e8914,null))['then'](function(_0x1a4700){if(_0x1a4700){return _0x1a4700[_0x2f96('0x35')]({'UserId':_0x2bb6a8[_0x2f96('0x56')][_0x2f96('0x7c')],'read1stAt':_[_0x2f96('0x7f')](_0x1a4700[_0x2f96('0x80')])?moment()['format'](_0x2f96('0x76')):undefined});}return null;})['then'](function(_0x2ea3f6){if(_0x2ea3f6){_0x60b21d[_0x2f96('0x81')]=_0x2ea3f6['get']({'plain':!![]});interaction_log[_0x2f96('0x22')](_0x2f96('0x82'),_0x2bb6a8['user']['id'],_0x2bb6a8['user']['name'],_0x2bb6a8['user'][_0x2f96('0x83')],_0x60b21d['interaction']['id'],_0x2bb6a8['body']?JSON[_0x2f96('0x26')](_0x2bb6a8[_0x2f96('0x56')]):_0x2f96('0x84'));return respondWithRpcPromise(_0x2f96('0x85'),_0x2f96('0x86'),_0x60b21d);}return null;})[_0x2f96('0x36')](function(_0x3cf948){var _0x21465c=_0x2f96('0x87')+_0x3cf948[_0x2f96('0x29')]['ContactId'];return db[_0x2f96('0x88')][_0x2f96('0x3e')](_0x21465c,{'type':db[_0x2f96('0x89')][_0x2f96('0x8a')]['SELECT'],'raw':!![]})['then'](function(_0x3a1fb3){return _0x3a1fb3;});})[_0x2f96('0x36')](function(_0x15cb89){if(_0x15cb89){_0x60b21d[_0x2f96('0x29')][_0x2f96('0x8b')]=_0x15cb89[0x0];if(!_0x2bb6a8[_0x2f96('0x56')][_0x2f96('0x7c')])return;return db[_0x2f96('0x8c')][_0x2f96('0x52')]({'where':{'id':_0x2bb6a8[_0x2f96('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x2f96('0x39'),'fullname',_0x2f96('0x8d'),_0x2f96('0x8e')],'raw':!![]});}return null;})['then'](function(_0x1d65ae){if(!_0x1d65ae)return null;_0x60b21d[_0x2f96('0x29')][_0x2f96('0x7d')]=_0x1d65ae;return _0x60b21d;})[_0x2f96('0x36')](function(_0x35d0f7){if(_0x35d0f7){if(_0x2bb6a8[_0x2f96('0x56')]['manual']){_0x60b21d[_0x2f96('0x29')][_0x2f96('0x8f')]=util[_0x2f96('0x75')](_0x2f96('0x90'),_0x2bb6a8[_0x2f96('0x6a')][_0x2f96('0x39')]);_0x60b21d[_0x2f96('0x29')][_0x2f96('0x91')]=_0x60b21d[_0x2f96('0x91')];_0x60b21d['message'][_0x2f96('0x92')]=_0x2f96('0x79');_0x60b21d[_0x2f96('0x29')][_0x2f96('0x56')]=htmlToText[_0x2f96('0x93')](_0x60b21d[_0x2f96('0x29')]['body']);return respondWithRpcPromise(_0x2f96('0x94'),_0x2f96('0x94'),{'event':_0x2f96('0x95'),'message':_0x60b21d['message']},client9002)['then'](function(){return _0x60b21d;});}return _0x60b21d;}return null;})[_0x2f96('0x36')](respondWithResult(_0x4e8914,null))[_0x2f96('0x2a')](handleError(_0x4e8914,null));};var interaction_log=require('../../config/logger')(_0x2f96('0x78'));exports['reject']=function(_0x566fca,_0x3e9f27,_0x3a761e){var _0x43b07d={'agent':{},'channel':_0x2f96('0x96')};if(_0x566fca['body']['id']){delete _0x566fca[_0x2f96('0x56')]['id'];}_0x566fca[_0x2f96('0x56')][_0x2f96('0x7c')]=_0x566fca[_0x2f96('0x56')]['UserId']||_0x566fca[_0x2f96('0x6a')]['id'];_0x43b07d[_0x2f96('0x7d')]['id']=_0x566fca['body']['UserId'];return db['MailMessage']['find']({'where':{'id':_0x566fca['params']['id'],'UserId':null}})[_0x2f96('0x36')](handleEntityNotFound(_0x3e9f27,null))['then'](function(_0x1fa084){if(_0x1fa084){_0x43b07d[_0x2f96('0x29')]=_0x1fa084[_0x2f96('0x7e')]({'plain':!![]});return db[_0x2f96('0x97')][_0x2f96('0x52')]({'where':{'id':_0x1fa084['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3e9f27,null))[_0x2f96('0x36')](function(_0x365b33){if(_0x365b33){_0x43b07d[_0x2f96('0x81')]=_0x365b33['get']({'plain':!![]});interaction_log[_0x2f96('0x22')](_0x2f96('0x98'),_0x566fca[_0x2f96('0x6a')]['id'],_0x566fca[_0x2f96('0x6a')][_0x2f96('0x39')],_0x566fca[_0x2f96('0x6a')][_0x2f96('0x83')],_0x43b07d['interaction']['id'],_0x566fca[_0x2f96('0x56')]?JSON['stringify'](_0x566fca[_0x2f96('0x56')]):_0x2f96('0x84'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x43b07d);}return null;})[_0x2f96('0x36')](function(_0x4a1462){var _0x3add6c=_0x2f96('0x87')+_0x4a1462[_0x2f96('0x29')]['ContactId'];return db[_0x2f96('0x88')]['query'](_0x3add6c,{'type':db[_0x2f96('0x89')][_0x2f96('0x8a')][_0x2f96('0x99')],'raw':!![]})['then'](function(_0x1df0d8){return _0x1df0d8;});})['then'](function(_0x276708){if(_0x276708){_0x43b07d['message'][_0x2f96('0x8b')]=_0x276708[0x0];if(!_0x566fca[_0x2f96('0x56')][_0x2f96('0x7c')])return;return db[_0x2f96('0x8c')][_0x2f96('0x52')]({'where':{'id':_0x566fca['body']['UserId'],'role':_0x2f96('0x7d')},'attributes':['id',_0x2f96('0x39'),_0x2f96('0x9a'),_0x2f96('0x8d'),'internal'],'raw':!![]});}return null;})['then'](function(_0x174d97){if(!_0x174d97)return null;_0x43b07d[_0x2f96('0x29')][_0x2f96('0x7d')]=_0x174d97;return _0x43b07d;})[_0x2f96('0x36')](function(_0x511a2f){if(_0x511a2f){_0x511a2f[_0x2f96('0x29')][_0x2f96('0x8f')]=util[_0x2f96('0x75')](_0x2f96('0x90'),_0x566fca[_0x2f96('0x6a')][_0x2f96('0x39')]);_0x511a2f[_0x2f96('0x29')][_0x2f96('0x91')]=_0x43b07d[_0x2f96('0x91')];_0x511a2f[_0x2f96('0x29')][_0x2f96('0x92')]=_0x2f96('0x9b');_0x511a2f[_0x2f96('0x29')][_0x2f96('0x56')]=htmlToText[_0x2f96('0x93')](_0x43b07d['message'][_0x2f96('0x56')]);respondWithRpcPromise(_0x2f96('0x94'),_0x2f96('0x94'),{'event':'rejectmessage','message':_0x511a2f['message']},client9002);return _0x43b07d;}return null;})['then'](respondWithResult(_0x3e9f27,null))['catch'](handleError(_0x3e9f27,null));};exports[_0x2f96('0x9c')]=function(_0x5e77f9,_0x3691e8){var _0x713ae0=moment()['unix']()[_0x2f96('0x9d')]();var _0x30135c=path[_0x2f96('0x6c')](config[_0x2f96('0x6d')],_0x2f96('0x9e'),'files','tmp');var _0x292454=path[_0x2f96('0x6c')](config[_0x2f96('0x6d')],_0x2f96('0x9e'),'files',_0x2f96('0x6b'));var _0x3a95d4=util[_0x2f96('0x75')](_0x2f96('0x9f'),_0x713ae0);return db[_0x2f96('0x3b')]['find']({'where':{'id':_0x5e77f9['params']['id']},'attributes':['id',_0x2f96('0x56'),_0x2f96('0xa0'),'to','cc',_0x2f96('0xa1'),_0x2f96('0xa2'),'createdAt'],'include':_0x5e77f9[_0x2f96('0x3e')][_0x2f96('0x6b')]?[{'model':db[_0x2f96('0xa3')],'as':_0x2f96('0xa4')}]:undefined})['then'](handleEntityNotFound(_0x3691e8,null))[_0x2f96('0x36')](function(_0x363579){if(_0x363579){var _0x3fb124=_0x363579;var _0x431905={'from':_0x3fb124['from'],'to':_0x3fb124['to'],'subject':_0x3fb124[_0x2f96('0xa2')],'html':_0x3fb124['body'],'headers':{'Date':moment(_0x3fb124[_0x2f96('0xa5')])[_0x2f96('0x75')](_0x2f96('0xa6'))},'attachments':[]};if(_0x363579['cc']){_0x431905['headers']['Cc']=_0x363579['cc'];}if(_0x363579[_0x2f96('0xa1')]){_0x431905[_0x2f96('0xa7')][_0x2f96('0xa8')]=_0x363579['bcc'];}return new BPromise(function(_0x16c4d4,_0x2f9fdb){if(_0x363579[_0x2f96('0xa4')]){for(var _0x51477c=0x0;_0x51477c<_0x363579[_0x2f96('0xa4')][_0x2f96('0x43')];_0x51477c++){var _0x5b057a=_0x363579[_0x2f96('0xa4')][_0x51477c];var _0x5009c7=path[_0x2f96('0x6c')](_0x292454,_0x5b057a[_0x2f96('0xa9')]);if(fs[_0x2f96('0xaa')](_0x5009c7)){_0x431905[_0x2f96('0x6b')][_0x2f96('0xab')]({'name':_0x5b057a[_0x2f96('0x39')],'contentType':_0x5b057a['type'],'data':fs[_0x2f96('0xac')](_0x5009c7)});}}}emlformat[_0x2f96('0xad')](_0x431905,function(_0x20a167,_0x200e49){if(_0x20a167)return _0x2f9fdb(_0x20a167);fs[_0x2f96('0xae')](path['join'](_0x30135c,_0x3a95d4),_0x200e49);return _0x16c4d4(_0x200e49);});});}})[_0x2f96('0x36')](function(_0x3dd916){if(_0x3dd916){return _0x3691e8['download'](path[_0x2f96('0x6c')](_0x30135c,_0x3a95d4),_0x3a95d4,function(_0x235d12){if(_0x235d12){console[_0x2f96('0xaf')](_0x2f96('0xb0'),_0x235d12);}else{fs['unlinkSync'](path['join'](_0x30135c,_0x3a95d4));}});}})[_0x2f96('0x2a')](handleError(_0x3691e8,null));}; \ No newline at end of file +var _0x9add=['read','format','UserId','agent','MailInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','channel','event','fromString','EventManager','acceptmessage','get','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','contact','interface','SIP/%s','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','type','readFileSync','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','html-to-text','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','status','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','find','body','describe','create','direction','out','split','MailAccount','findOne','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','length','root','server/files/attachments','basename','List','SendMail','sendMail','messageId','stringify','mail-interactions','accept','mail'];(function(_0x1d3ce2,_0x263586){var _0xe54d0=function(_0x29bcd1){while(--_0x29bcd1){_0x1d3ce2['push'](_0x1d3ce2['shift']());}};_0xe54d0(++_0x263586);}(_0x9add,0xf6));var _0xd9ad=function(_0x2c04dc,_0x5cc3e0){_0x2c04dc=_0x2c04dc-0x0;var _0x429967=_0x9add[_0x2c04dc];return _0x429967;};'use strict';var emlformat=require(_0xd9ad('0x0'));var rimraf=require(_0xd9ad('0x1'));var zipdir=require(_0xd9ad('0x2'));var jsonpatch=require(_0xd9ad('0x3'));var rp=require('request-promise');var moment=require(_0xd9ad('0x4'));var BPromise=require(_0xd9ad('0x5'));var Mustache=require(_0xd9ad('0x6'));var util=require(_0xd9ad('0x7'));var path=require(_0xd9ad('0x8'));var sox=require(_0xd9ad('0x9'));var csv=require(_0xd9ad('0xa'));var ejs=require(_0xd9ad('0xb'));var fs=require('fs');var fs_extra=require(_0xd9ad('0xc'));var _=require(_0xd9ad('0xd'));var squel=require(_0xd9ad('0xe'));var crypto=require(_0xd9ad('0xf'));var jsforce=require(_0xd9ad('0x10'));var deskjs=require(_0xd9ad('0x11'));var toCsv=require(_0xd9ad('0xa'));var querystring=require(_0xd9ad('0x12'));var Papa=require('papaparse');var Redis=require(_0xd9ad('0x13'));var authService=require(_0xd9ad('0x14'));var qs=require(_0xd9ad('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9ad('0x16'));var logger=require(_0xd9ad('0x17'))(_0xd9ad('0x18'));var utils=require(_0xd9ad('0x19'));var config=require(_0xd9ad('0x1a'));var licenseUtil=require(_0xd9ad('0x1b'));var htmlToText=require(_0xd9ad('0x1c'));var db=require(_0xd9ad('0x1d'))['db'];config[_0xd9ad('0x1e')]=_[_0xd9ad('0x1f')](config['redis'],{'host':_0xd9ad('0x20'),'port':0x18eb});var socket=require(_0xd9ad('0x21'))(new Redis(config['redis']));require('./mailMessage.socket')[_0xd9ad('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd9ad('0x23')][_0xd9ad('0x24')]({'port':0x232c});var client9003=jayson[_0xd9ad('0x23')][_0xd9ad('0x24')]({'port':0x232b});var client9002=jayson[_0xd9ad('0x23')][_0xd9ad('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x5a0477,_0x223a5e,_0x5d87f0,_0x59f2df){return new BPromise(function(_0x59fd55,_0x358535){var _0x5465df=_0x59f2df||client;return _0x5465df[_0xd9ad('0x25')](_0x5a0477,_0x5d87f0)[_0xd9ad('0x26')](function(_0x3fb256){logger[_0xd9ad('0x27')](_0xd9ad('0x28'),_0x223a5e,'request\x20sent');logger[_0xd9ad('0x29')](_0xd9ad('0x2a'),_0x223a5e,_0xd9ad('0x2b'),JSON['stringify'](_0x3fb256));if(_0x3fb256[_0xd9ad('0x2c')]){if(_0x3fb256['error'][_0xd9ad('0x2d')]===0x1f4){logger[_0xd9ad('0x2c')](_0xd9ad('0x28'),_0x223a5e,_0x3fb256[_0xd9ad('0x2c')]['message']);return _0x358535(_0x3fb256[_0xd9ad('0x2c')][_0xd9ad('0x2e')]);}logger['error'](_0xd9ad('0x28'),_0x223a5e,_0x3fb256[_0xd9ad('0x2c')][_0xd9ad('0x2e')]);return _0x59fd55(_0x3fb256[_0xd9ad('0x2c')][_0xd9ad('0x2e')]);}else{logger['info'](_0xd9ad('0x28'),_0x223a5e,'request\x20sent');_0x59fd55(_0x3fb256[_0xd9ad('0x2f')][_0xd9ad('0x2e')]);}})[_0xd9ad('0x30')](function(_0x344674){logger[_0xd9ad('0x2c')](_0xd9ad('0x28'),_0x223a5e,_0x344674);_0x358535(_0x344674);});});}function respondWithStatusCode(_0x4cdbd1,_0x470ffe){_0x470ffe=_0x470ffe||0xcc;return function(_0x4e8719){if(_0x4e8719){return _0x4cdbd1['sendStatus'](_0x470ffe);}return _0x4cdbd1['status'](_0x470ffe)['end']();};}function respondWithResult(_0x20b58a,_0x2c6c9c){_0x2c6c9c=_0x2c6c9c||0xc8;return function(_0x390b23){if(_0x390b23){return _0x20b58a['status'](_0x2c6c9c)['json'](_0x390b23);}};}function respondWithFilteredResult(_0xede398,_0xcac1e4){return function(_0x27be09){if(_0x27be09){var _0x4540d1=typeof _0xcac1e4['offset']===_0xd9ad('0x31')&&typeof _0xcac1e4[_0xd9ad('0x32')]===_0xd9ad('0x31');var _0xe8da0a=_0x27be09[_0xd9ad('0x33')];var _0x49ac2f=_0x4540d1?0x0:_0xcac1e4[_0xd9ad('0x34')];var _0x4f0191=_0x4540d1?_0x27be09['count']:_0xcac1e4['offset']+_0xcac1e4[_0xd9ad('0x32')];var _0x39b023;if(_0x4f0191>=_0xe8da0a){_0x4f0191=_0xe8da0a;_0x39b023=0xc8;}else{_0x39b023=0xce;}_0xede398['status'](_0x39b023);return _0xede398['set'](_0xd9ad('0x35'),_0x49ac2f+'-'+_0x4f0191+'/'+_0xe8da0a)['json'](_0x27be09);}return null;};}function patchUpdates(_0x52600e){return function(_0x38ece4){try{jsonpatch[_0xd9ad('0x36')](_0x38ece4,_0x52600e,!![]);}catch(_0x542e5b){return BPromise[_0xd9ad('0x37')](_0x542e5b);}return _0x38ece4[_0xd9ad('0x38')]();};}function saveUpdates(_0x457576,_0x32547){return function(_0x3fab76){if(_0x3fab76){return _0x3fab76[_0xd9ad('0x39')](_0x457576)[_0xd9ad('0x26')](function(_0x3d689f){return _0x3d689f;});}return null;};}function removeEntity(_0x12e0a3,_0x2207c9){return function(_0x3b264d){if(_0x3b264d){return _0x3b264d[_0xd9ad('0x3a')]()[_0xd9ad('0x26')](function(){_0x12e0a3[_0xd9ad('0x3b')](0xcc)[_0xd9ad('0x3c')]();});}};}function handleEntityNotFound(_0x2c19b1,_0x1308bf){return function(_0x2000ce){if(!_0x2000ce){_0x2c19b1[_0xd9ad('0x3d')](0x194);}return _0x2000ce;};}function handleError(_0x421db1,_0x3c3d7c){_0x3c3d7c=_0x3c3d7c||0x1f4;return function(_0x5530c1){logger['error'](_0x5530c1[_0xd9ad('0x3e')]);if(_0x5530c1[_0xd9ad('0x3f')]){delete _0x5530c1['name'];}_0x421db1[_0xd9ad('0x3b')](_0x3c3d7c)[_0xd9ad('0x40')](_0x5530c1);};}exports[_0xd9ad('0x41')]=function(_0x36c72f,_0x2a5028){var _0x34a268={},_0xbd72ee={},_0x1de5bd={'count':0x0,'rows':[]};var _0x1aef2e=_['map'](db[_0xd9ad('0x42')][_0xd9ad('0x43')],function(_0x1a970d){return{'name':_0x1a970d['fieldName'],'type':_0x1a970d['type'][_0xd9ad('0x44')]};});_0xbd72ee[_0xd9ad('0x45')]=_[_0xd9ad('0x46')](_0x1aef2e,'name');_0xbd72ee[_0xd9ad('0x47')]=_[_0xd9ad('0x48')](_0x36c72f[_0xd9ad('0x47')]);_0xbd72ee['filters']=_[_0xd9ad('0x49')](_0xbd72ee[_0xd9ad('0x45')],_0xbd72ee['query']);_0x34a268[_0xd9ad('0x4a')]=_[_0xd9ad('0x49')](_0xbd72ee[_0xd9ad('0x45')],qs[_0xd9ad('0x4b')](_0x36c72f[_0xd9ad('0x47')][_0xd9ad('0x4b')]));_0x34a268[_0xd9ad('0x4a')]=_0x34a268[_0xd9ad('0x4a')]['length']?_0x34a268['attributes']:_0xbd72ee[_0xd9ad('0x45')];if(!_0x36c72f[_0xd9ad('0x47')][_0xd9ad('0x4c')](_0xd9ad('0x4d'))){_0x34a268[_0xd9ad('0x32')]=qs[_0xd9ad('0x32')](_0x36c72f[_0xd9ad('0x47')][_0xd9ad('0x32')]);_0x34a268[_0xd9ad('0x34')]=qs[_0xd9ad('0x34')](_0x36c72f[_0xd9ad('0x47')][_0xd9ad('0x34')]);}_0x34a268[_0xd9ad('0x4e')]=qs[_0xd9ad('0x4f')](_0x36c72f[_0xd9ad('0x47')][_0xd9ad('0x4f')]);_0x34a268[_0xd9ad('0x50')]=qs[_0xd9ad('0x51')](_['pick'](_0x36c72f[_0xd9ad('0x47')],_0xbd72ee['filters']),_0x1aef2e);if(_0x36c72f[_0xd9ad('0x47')][_0xd9ad('0x52')]){_0x34a268[_0xd9ad('0x50')]=_[_0xd9ad('0x53')](_0x34a268[_0xd9ad('0x50')],{'$or':_[_0xd9ad('0x46')](_0x1aef2e,function(_0x56612c){if(_0x56612c['type']!==_0xd9ad('0x54')){var _0x47b9e3={};_0x47b9e3[_0x56612c['name']]={'$like':'%'+_0x36c72f[_0xd9ad('0x47')]['filter']+'%'};return _0x47b9e3;}})});}_0x34a268=_[_0xd9ad('0x53')]({},_0x34a268,_0x36c72f['options']);var _0x2033fb={'where':_0x34a268[_0xd9ad('0x50')]};return db[_0xd9ad('0x42')][_0xd9ad('0x33')](_0x2033fb)[_0xd9ad('0x26')](function(_0x3a5458){_0x1de5bd[_0xd9ad('0x33')]=_0x3a5458;if(_0x36c72f[_0xd9ad('0x47')][_0xd9ad('0x55')]){_0x34a268['include']=[{'all':!![]}];}return db[_0xd9ad('0x42')][_0xd9ad('0x56')](_0x34a268);})[_0xd9ad('0x26')](function(_0x5acd4d){_0x1de5bd[_0xd9ad('0x57')]=_0x5acd4d;return _0x1de5bd;})[_0xd9ad('0x26')](respondWithFilteredResult(_0x2a5028,_0x34a268))[_0xd9ad('0x30')](handleError(_0x2a5028,null));};exports[_0xd9ad('0x58')]=function(_0x5f4792,_0x2f9209){var _0x5b356f={'raw':!![],'where':{'id':_0x5f4792[_0xd9ad('0x59')]['id']}},_0x32febd={};_0x32febd[_0xd9ad('0x45')]=_[_0xd9ad('0x48')](db[_0xd9ad('0x42')][_0xd9ad('0x43')]);_0x32febd[_0xd9ad('0x47')]=_[_0xd9ad('0x48')](_0x5f4792['query']);_0x32febd[_0xd9ad('0x51')]=_[_0xd9ad('0x49')](_0x32febd[_0xd9ad('0x45')],_0x32febd['query']);_0x5b356f[_0xd9ad('0x4a')]=_['intersection'](_0x32febd['model'],qs['fields'](_0x5f4792[_0xd9ad('0x47')]['fields']));_0x5b356f[_0xd9ad('0x4a')]=_0x5b356f[_0xd9ad('0x4a')]['length']?_0x5b356f[_0xd9ad('0x4a')]:_0x32febd[_0xd9ad('0x45')];if(_0x5f4792[_0xd9ad('0x47')]['includeAll']){_0x5b356f['include']=[{'all':!![]}];}_0x5b356f=_[_0xd9ad('0x53')]({},_0x5b356f,_0x5f4792['options']);return db['MailMessage'][_0xd9ad('0x5a')](_0x5b356f)['then'](handleEntityNotFound(_0x2f9209,null))[_0xd9ad('0x26')](respondWithResult(_0x2f9209,null))[_0xd9ad('0x30')](handleError(_0x2f9209,null));};exports['update']=function(_0xba1c31,_0x41533d){if(_0xba1c31[_0xd9ad('0x5b')]['id']){delete _0xba1c31[_0xd9ad('0x5b')]['id'];}return db[_0xd9ad('0x42')][_0xd9ad('0x5a')]({'where':{'id':_0xba1c31[_0xd9ad('0x59')]['id']}})[_0xd9ad('0x26')](handleEntityNotFound(_0x41533d,null))[_0xd9ad('0x26')](saveUpdates(_0xba1c31[_0xd9ad('0x5b')],null))['then'](respondWithResult(_0x41533d,null))['catch'](handleError(_0x41533d,null));};exports[_0xd9ad('0x3a')]=function(_0x109887,_0xe860d){return db['MailMessage']['find']({'where':{'id':_0x109887[_0xd9ad('0x59')]['id']}})[_0xd9ad('0x26')](handleEntityNotFound(_0xe860d,null))['then'](removeEntity(_0xe860d,null))[_0xd9ad('0x30')](handleError(_0xe860d,null));};exports[_0xd9ad('0x5c')]=function(_0x3e02f7,_0x46351a){return db[_0xd9ad('0x42')][_0xd9ad('0x5c')]()['then'](respondWithResult(_0x46351a,null))[_0xd9ad('0x30')](handleError(_0x46351a,null));};exports[_0xd9ad('0x5d')]=function(_0x1f931c,_0x30d625){return db[_0xd9ad('0x42')][_0xd9ad('0x5d')](_0x1f931c['body'])[_0xd9ad('0x26')](function(_0x3851dc){if(_0x3851dc){if(_0x3851dc[_0xd9ad('0x5e')]===_0xd9ad('0x5f')&&!_0x3851dc['secret']){var _0x4b10c1,_0x71f4f1,_0x2a2870;if(_0x1f931c[_0xd9ad('0x5b')]['to']){_0x71f4f1=_0x1f931c[_0xd9ad('0x5b')]['to'][_0xd9ad('0x60')](',')[0x0];}return db[_0xd9ad('0x61')][_0xd9ad('0x62')]({'where':{'id':_0x3851dc['MailAccountId']},'include':[{'model':db[_0xd9ad('0x63')],'as':'List','include':[{'model':db[_0xd9ad('0x64')],'as':_0xd9ad('0x65'),'where':{'email':_0x71f4f1},'limit':0x1,'order':[[_0xd9ad('0x66'),_0xd9ad('0x67')]]}]},{'model':db[_0xd9ad('0x68')],'as':'Smtp','raw':!![]}]})[_0xd9ad('0x26')](function(_0x48d585){_0x4b10c1=_0x48d585;if(_0x4b10c1&&_0x4b10c1[_0xd9ad('0x69')]){var _0x48e2cc={'tls':{'rejectUnauthorized':![]}};if(_[_0xd9ad('0x6a')](_0x4b10c1[_0xd9ad('0x69')][_0xd9ad('0x6b')])){_0x48e2cc[_0xd9ad('0x6c')]=_0x4b10c1['Smtp'][_0xd9ad('0x6c')];_0x48e2cc[_0xd9ad('0x6d')]=_0x4b10c1[_0xd9ad('0x69')][_0xd9ad('0x6d')];_0x48e2cc[_0xd9ad('0x6e')]=_0x4b10c1[_0xd9ad('0x69')][_0xd9ad('0x6e')];if(_0x4b10c1['Smtp'][_0xd9ad('0x6f')]){_0x48e2cc[_0xd9ad('0x70')]={'user':_0x4b10c1[_0xd9ad('0x69')][_0xd9ad('0x71')],'pass':_0x4b10c1[_0xd9ad('0x69')][_0xd9ad('0x72')]};}}else{_0x48e2cc[_0xd9ad('0x6b')]=_0x4b10c1['Smtp']['service'];_0x48e2cc['auth']={'user':_0x4b10c1[_0xd9ad('0x69')]['user'],'pass':_0x4b10c1['Smtp'][_0xd9ad('0x72')]};_0x48e2cc[_0xd9ad('0x6e')]=_0x4b10c1[_0xd9ad('0x69')]['secure'];}if(_0x1f931c[_0xd9ad('0x5b')]['attachments']&&_0x1f931c[_0xd9ad('0x5b')][_0xd9ad('0x73')][_0xd9ad('0x74')]){for(var _0x423060=0x0;_0x423060<_0x1f931c[_0xd9ad('0x5b')][_0xd9ad('0x73')]['length'];_0x423060+=0x1){_0x1f931c[_0xd9ad('0x5b')][_0xd9ad('0x73')][_0x423060]={'filename':_0x1f931c[_0xd9ad('0x5b')][_0xd9ad('0x73')][_0x423060]['name'],'path':path['join'](config[_0xd9ad('0x75')],_0xd9ad('0x76'),_0x1f931c[_0xd9ad('0x5b')]['attachments'][_0x423060][_0xd9ad('0x77')])};}}_0x2a2870={'account':_0x48e2cc,'message':_0x1f931c[_0xd9ad('0x5b')]};return;}})[_0xd9ad('0x26')](function(){if(_0x4b10c1[_0xd9ad('0x78')]){if(_0x4b10c1[_0xd9ad('0x78')][_0xd9ad('0x65')][_0xd9ad('0x74')]){return _0x4b10c1[_0xd9ad('0x78')][_0xd9ad('0x65')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x1f931c[_0xd9ad('0x5b')],{'firstName':_0x1f931c['body']['to'],'email':_0x1f931c[_0xd9ad('0x5b')]['to'],'phone':_0x1f931c[_0xd9ad('0x5b')]['to'],'ListId':_0x4b10c1['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0xd9ad('0x26')](function(){if(_0x2a2870){return respondWithRpcPromise(_0xd9ad('0x79'),_0xd9ad('0x7a'),_0x2a2870,client9003)[_0xd9ad('0x26')](function(_0x53b106){return _0x3851dc['update']({'read':!![],'messageId':_0x53b106[_0xd9ad('0x7b')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd9ad('0x30')](function(_0x5e4fc4){logger[_0xd9ad('0x2c')]('%s',JSON[_0xd9ad('0x7c')](_0x5e4fc4));return _0x3851dc;});}return _0x3851dc;});}return _0x3851dc;}})[_0xd9ad('0x26')](respondWithResult(_0x30d625,0xc9))[_0xd9ad('0x30')](handleError(_0x30d625,null));};var interaction_log=require(_0xd9ad('0x17'))(_0xd9ad('0x7d'));exports[_0xd9ad('0x7e')]=function(_0xae9e1,_0x176d5d,_0x151847){var _0x31343c={'agent':{},'channel':_0xd9ad('0x7f')};if(_0xae9e1['body']['id']){delete _0xae9e1[_0xd9ad('0x5b')]['id'];}_0xae9e1[_0xd9ad('0x5b')][_0xd9ad('0x80')]=!![];_0xae9e1[_0xd9ad('0x5b')]['readAt']=moment()[_0xd9ad('0x81')]('YYYY-MM-DD\x20HH:mm:ss');_0xae9e1['body']['UserId']=_0xae9e1['body'][_0xd9ad('0x82')]||_0xae9e1[_0xd9ad('0x71')]['id'];_0x31343c[_0xd9ad('0x83')]['id']=_0xae9e1['body'][_0xd9ad('0x82')];return db[_0xd9ad('0x42')][_0xd9ad('0x5a')]({'where':{'id':_0xae9e1[_0xd9ad('0x59')]['id'],'UserId':null}})[_0xd9ad('0x26')](handleEntityNotFound(_0x176d5d,null))[_0xd9ad('0x26')](saveUpdates(_0xae9e1[_0xd9ad('0x5b')],null))[_0xd9ad('0x26')](function(_0x485639){if(_0x485639){_0x31343c[_0xd9ad('0x2e')]=_0x485639['get']({'plain':!![]});return db[_0xd9ad('0x84')][_0xd9ad('0x5a')]({'where':{'id':_0x485639['MailInteractionId']}});}return null;})[_0xd9ad('0x26')](handleEntityNotFound(_0x176d5d,null))['then'](function(_0xd46f2){if(_0xd46f2){return _0xd46f2[_0xd9ad('0x39')]({'UserId':_0xae9e1[_0xd9ad('0x5b')][_0xd9ad('0x82')],'read1stAt':_[_0xd9ad('0x6a')](_0xd46f2[_0xd9ad('0x85')])?moment()[_0xd9ad('0x81')](_0xd9ad('0x86')):undefined});}return null;})[_0xd9ad('0x26')](function(_0xa115c5){if(_0xa115c5){_0x31343c[_0xd9ad('0x87')]=_0xa115c5['get']({'plain':!![]});interaction_log[_0xd9ad('0x27')](_0xd9ad('0x88'),_0xae9e1[_0xd9ad('0x71')]['id'],_0xae9e1[_0xd9ad('0x71')][_0xd9ad('0x3f')],_0xae9e1[_0xd9ad('0x71')]['role'],_0x31343c[_0xd9ad('0x87')]['id'],_0xae9e1['body']?JSON['stringify'](_0xae9e1['body']):_0xd9ad('0x89'));return respondWithRpcPromise(_0xd9ad('0x8a'),_0xd9ad('0x8b'),_0x31343c);}return null;})[_0xd9ad('0x26')](function(_0x5e42f5){var _0x2326a2=_0xd9ad('0x8c')+_0x5e42f5[_0xd9ad('0x2e')][_0xd9ad('0x8d')];return db[_0xd9ad('0x8e')][_0xd9ad('0x47')](_0x2326a2,{'type':db['Sequelize'][_0xd9ad('0x8f')][_0xd9ad('0x90')],'raw':!![]})['then'](function(_0x556565){return _0x556565;});})[_0xd9ad('0x26')](function(_0xfc0616){if(_0xfc0616){_0x31343c[_0xd9ad('0x2e')]['contact']=_0xfc0616[0x0];if(!_0xae9e1['body']['UserId'])return;return db[_0xd9ad('0x91')][_0xd9ad('0x5a')]({'where':{'id':_0xae9e1['body']['UserId'],'role':_0xd9ad('0x83')},'attributes':['id',_0xd9ad('0x3f'),_0xd9ad('0x92'),_0xd9ad('0x93'),_0xd9ad('0x94')],'raw':!![]});}return null;})['then'](function(_0x38844e){if(!_0x38844e)return null;_0x31343c[_0xd9ad('0x2e')][_0xd9ad('0x83')]=_0x38844e;return _0x31343c;})['then'](function(_0x418b6f){if(_0x418b6f){if(_0xae9e1['body'][_0xd9ad('0x95')]){_0x31343c[_0xd9ad('0x2e')]['interface']=util[_0xd9ad('0x81')]('SIP/%s',_0xae9e1[_0xd9ad('0x71')][_0xd9ad('0x3f')]);_0x31343c[_0xd9ad('0x2e')][_0xd9ad('0x96')]=_0x31343c[_0xd9ad('0x96')];_0x31343c[_0xd9ad('0x2e')][_0xd9ad('0x97')]=_0xd9ad('0x7e');_0x31343c['message']['body']=htmlToText[_0xd9ad('0x98')](_0x31343c[_0xd9ad('0x2e')][_0xd9ad('0x5b')]);return respondWithRpcPromise(_0xd9ad('0x99'),'EventManager',{'event':_0xd9ad('0x9a'),'message':_0x31343c[_0xd9ad('0x2e')]},client9002)['then'](function(){return _0x31343c;});}return _0x31343c;}return null;})[_0xd9ad('0x26')](respondWithResult(_0x176d5d,null))[_0xd9ad('0x30')](handleError(_0x176d5d,null));};var interaction_log=require(_0xd9ad('0x17'))(_0xd9ad('0x7d'));exports['reject']=function(_0x516fa0,_0x356ff4,_0x225740){var _0xe7b287={'agent':{},'channel':_0xd9ad('0x7f')};if(_0x516fa0[_0xd9ad('0x5b')]['id']){delete _0x516fa0[_0xd9ad('0x5b')]['id'];}_0x516fa0[_0xd9ad('0x5b')][_0xd9ad('0x82')]=_0x516fa0[_0xd9ad('0x5b')]['UserId']||_0x516fa0['user']['id'];_0xe7b287[_0xd9ad('0x83')]['id']=_0x516fa0[_0xd9ad('0x5b')][_0xd9ad('0x82')];return db[_0xd9ad('0x42')]['find']({'where':{'id':_0x516fa0[_0xd9ad('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x356ff4,null))[_0xd9ad('0x26')](function(_0x47c2ec){if(_0x47c2ec){_0xe7b287[_0xd9ad('0x2e')]=_0x47c2ec[_0xd9ad('0x9b')]({'plain':!![]});return db[_0xd9ad('0x84')]['find']({'where':{'id':_0x47c2ec[_0xd9ad('0x9c')]}});}return null;})[_0xd9ad('0x26')](handleEntityNotFound(_0x356ff4,null))[_0xd9ad('0x26')](function(_0x223ec9){if(_0x223ec9){_0xe7b287[_0xd9ad('0x87')]=_0x223ec9[_0xd9ad('0x9b')]({'plain':!![]});interaction_log[_0xd9ad('0x27')](_0xd9ad('0x9d'),_0x516fa0[_0xd9ad('0x71')]['id'],_0x516fa0[_0xd9ad('0x71')][_0xd9ad('0x3f')],_0x516fa0[_0xd9ad('0x71')][_0xd9ad('0x9e')],_0xe7b287[_0xd9ad('0x87')]['id'],_0x516fa0[_0xd9ad('0x5b')]?JSON[_0xd9ad('0x7c')](_0x516fa0[_0xd9ad('0x5b')]):_0xd9ad('0x89'));return respondWithRpcPromise(_0xd9ad('0x9f'),_0xd9ad('0xa0'),_0xe7b287);}return null;})['then'](function(_0x42327f){var _0x1e02cf=_0xd9ad('0x8c')+_0x42327f[_0xd9ad('0x2e')][_0xd9ad('0x8d')];return db[_0xd9ad('0x8e')][_0xd9ad('0x47')](_0x1e02cf,{'type':db['Sequelize'][_0xd9ad('0x8f')][_0xd9ad('0x90')],'raw':!![]})['then'](function(_0x13c502){return _0x13c502;});})['then'](function(_0x138d17){if(_0x138d17){_0xe7b287[_0xd9ad('0x2e')][_0xd9ad('0xa1')]=_0x138d17[0x0];if(!_0x516fa0[_0xd9ad('0x5b')][_0xd9ad('0x82')])return;return db[_0xd9ad('0x91')][_0xd9ad('0x5a')]({'where':{'id':_0x516fa0[_0xd9ad('0x5b')][_0xd9ad('0x82')],'role':'agent'},'attributes':['id',_0xd9ad('0x3f'),_0xd9ad('0x92'),_0xd9ad('0x93'),_0xd9ad('0x94')],'raw':!![]});}return null;})[_0xd9ad('0x26')](function(_0x4e5c33){if(!_0x4e5c33)return null;_0xe7b287['message'][_0xd9ad('0x83')]=_0x4e5c33;return _0xe7b287;})['then'](function(_0x7258d8){if(_0x7258d8){_0x7258d8[_0xd9ad('0x2e')][_0xd9ad('0xa2')]=util[_0xd9ad('0x81')](_0xd9ad('0xa3'),_0x516fa0['user'][_0xd9ad('0x3f')]);_0x7258d8[_0xd9ad('0x2e')][_0xd9ad('0x96')]=_0xe7b287[_0xd9ad('0x96')];_0x7258d8[_0xd9ad('0x2e')][_0xd9ad('0x97')]=_0xd9ad('0x37');_0x7258d8[_0xd9ad('0x2e')][_0xd9ad('0x5b')]=htmlToText[_0xd9ad('0x98')](_0xe7b287[_0xd9ad('0x2e')][_0xd9ad('0x5b')]);respondWithRpcPromise(_0xd9ad('0x99'),_0xd9ad('0x99'),{'event':'rejectmessage','message':_0x7258d8[_0xd9ad('0x2e')]},client9002);return _0xe7b287;}return null;})[_0xd9ad('0x26')](respondWithResult(_0x356ff4,null))['catch'](handleError(_0x356ff4,null));};exports['download']=function(_0x38781a,_0x23ec87){var _0x105259=moment()[_0xd9ad('0xa4')]()[_0xd9ad('0xa5')]();var _0x1cc9fb=path[_0xd9ad('0xa6')](config[_0xd9ad('0x75')],_0xd9ad('0xa7'),_0xd9ad('0xa8'),_0xd9ad('0xa9'));var _0x44861f=path['join'](config[_0xd9ad('0x75')],'server','files',_0xd9ad('0x73'));var _0x701cb5=util[_0xd9ad('0x81')](_0xd9ad('0xaa'),_0x105259);return db[_0xd9ad('0x42')][_0xd9ad('0x5a')]({'where':{'id':_0x38781a['params']['id']},'attributes':['id','body',_0xd9ad('0xab'),'to','cc',_0xd9ad('0xac'),'subject',_0xd9ad('0xad')],'include':_0x38781a['query'][_0xd9ad('0x73')]?[{'model':db[_0xd9ad('0xae')],'as':_0xd9ad('0xaf')}]:undefined})['then'](handleEntityNotFound(_0x23ec87,null))[_0xd9ad('0x26')](function(_0x4c1898){if(_0x4c1898){var _0x342e9f=_0x4c1898;var _0x107f45={'from':_0x342e9f[_0xd9ad('0xab')],'to':_0x342e9f['to'],'subject':_0x342e9f[_0xd9ad('0xb0')],'html':_0x342e9f[_0xd9ad('0x5b')],'headers':{'Date':moment(_0x342e9f['createdAt'])[_0xd9ad('0x81')](_0xd9ad('0xb1'))},'attachments':[]};if(_0x4c1898['cc']){_0x107f45[_0xd9ad('0xb2')]['Cc']=_0x4c1898['cc'];}if(_0x4c1898[_0xd9ad('0xac')]){_0x107f45[_0xd9ad('0xb2')][_0xd9ad('0xb3')]=_0x4c1898['bcc'];}return new BPromise(function(_0x3822ed,_0x14fb89){if(_0x4c1898[_0xd9ad('0xaf')]){for(var _0x5ad64f=0x0;_0x5ad64f<_0x4c1898[_0xd9ad('0xaf')]['length'];_0x5ad64f++){var _0x4ff952=_0x4c1898[_0xd9ad('0xaf')][_0x5ad64f];var _0x43f6c2=path[_0xd9ad('0xa6')](_0x44861f,_0x4ff952[_0xd9ad('0x77')]);if(fs[_0xd9ad('0xb4')](_0x43f6c2)){_0x107f45[_0xd9ad('0x73')]['push']({'name':_0x4ff952[_0xd9ad('0x3f')],'contentType':_0x4ff952[_0xd9ad('0xb5')],'data':fs[_0xd9ad('0xb6')](_0x43f6c2)});}}}emlformat['build'](_0x107f45,function(_0x3b4609,_0x5f0ef4){if(_0x3b4609)return _0x14fb89(_0x3b4609);fs['writeFileSync'](path[_0xd9ad('0xa6')](_0x1cc9fb,_0x701cb5),_0x5f0ef4);return _0x3822ed(_0x5f0ef4);});});}})['then'](function(_0x5196e0){if(_0x5196e0){return _0x23ec87[_0xd9ad('0xb7')](path[_0xd9ad('0xa6')](_0x1cc9fb,_0x701cb5),_0x701cb5,function(_0x14f386){if(_0x14f386){console[_0xd9ad('0xb8')](_0xd9ad('0xb9'),_0x14f386);}else{fs[_0xd9ad('0xba')](path[_0xd9ad('0xa6')](_0x1cc9fb,_0x701cb5));}});}})[_0xd9ad('0x30')](handleError(_0x23ec87,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 58348a6..ca5d56d 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 _0xb9d4=['update','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb9d4,0x7c));var _0x4b9d=function(_0x42a1f3,_0x2a1ed8){_0x42a1f3=_0x42a1f3-0x0;var _0x4ccdf7=_0xb9d4[_0x42a1f3];return _0x4ccdf7;};'use strict';var EventEmitter=require(_0x4b9d('0x0'));var MailMessage=require(_0x4b9d('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4b9d('0x2')](0x0);var events={'afterCreate':_0x4b9d('0x3'),'afterUpdate':_0x4b9d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ab133){return function(_0x3f4364,_0x2719e2,_0x312ec9){MailMessageEvents[_0x4b9d('0x5')](_0x4ab133+':'+_0x3f4364['id'],_0x3f4364);MailMessageEvents[_0x4b9d('0x5')](_0x4ab133,_0x3f4364);_0x312ec9(null);};}for(var e in events){if(events[_0x4b9d('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x4b9d('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x77da=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77da,0x1bb));var _0xa77d=function(_0x32646d,_0x27846b){_0x32646d=_0x32646d-0x0;var _0x318215=_0x77da[_0x32646d];return _0x318215;};'use strict';var EventEmitter=require(_0xa77d('0x0'));var MailMessage=require(_0xa77d('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa77d('0x2')](0x0);var events={'afterCreate':_0xa77d('0x3'),'afterUpdate':_0xa77d('0x4'),'afterDestroy':_0xa77d('0x5')};function emitEvent(_0x480407){return function(_0x2eba88,_0x30f9e9,_0x8f03d5){MailMessageEvents[_0xa77d('0x6')](_0x480407+':'+_0x2eba88['id'],_0x2eba88);MailMessageEvents[_0xa77d('0x6')](_0x480407,_0x2eba88);_0x8f03d5(null);};}for(var e in events){if(events[_0xa77d('0x7')](e)){var event=events[e];MailMessage[_0xa77d('0x8')](e,emitEvent(event));}}module[_0xa77d('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 6b3d41d..e8dc24c 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 _0x3a78=['get','direction','out','UserId','MailInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models'];(function(_0x1aa9b1,_0x4720cd){var _0x42a01d=function(_0x8dd854){while(--_0x8dd854){_0x1aa9b1['push'](_0x1aa9b1['shift']());}};_0x42a01d(++_0x4720cd);}(_0x3a78,0xb2));var _0x83a7=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x3a78[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require(_0x83a7('0x0'));var util=require('util');var logger=require(_0x83a7('0x1'))(_0x83a7('0x2'));var moment=require('moment');var BPromise=require(_0x83a7('0x3'));var rp=require(_0x83a7('0x4'));var htmlToText=require(_0x83a7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83a7('0x6'));var config=require(_0x83a7('0x7'));var attributes=require(_0x83a7('0x8'));module[_0x83a7('0x9')]=function(_0x47a417,_0x572f87){return _0x47a417[_0x83a7('0xa')](_0x83a7('0xb'),attributes,{'tableName':_0x83a7('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x83a7('0xd')]},{'name':_0x83a7('0xe'),'fields':[_0x83a7('0xf'),_0x83a7('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xaede5b,_0x58b68f,_0x40e7e9){if(_0xaede5b[_0x83a7('0x11')]){_0xaede5b[_0x83a7('0xf')]=htmlToText[_0x83a7('0x12')](_0xaede5b[_0x83a7('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x40e7e9(null,_0x58b68f);},'afterCreate':function(_0x46f04c,_0x5c3d5b,_0x6be1d8){var _0x4413fc=_0x47a417[_0x83a7('0x13')];var _0x52bd9c=_0x46f04c[_0x83a7('0x14')]({'plain':!![]});if(_0x52bd9c[_0x83a7('0x15')]['toLowerCase']()==='in'||_0x52bd9c[_0x83a7('0x15')]['toLowerCase']()===_0x83a7('0x16')&&!_0x52bd9c['secret']&&!_['isNil'](_0x52bd9c[_0x83a7('0x17')])){_0x4413fc['MailInteraction']['findOne']({'where':{'id':_0x52bd9c[_0x83a7('0x18')]}})[_0x83a7('0x19')](function(_0x46136){if(_0x46136){_0x46136[_0x83a7('0x1a')]({'lastMsgAt':_0x52bd9c[_0x83a7('0x1b')],'lastMsgDirection':_0x52bd9c[_0x83a7('0x15')][_0x83a7('0x1c')]()});}})[_0x83a7('0x1d')](function(_0x444225){console[_0x83a7('0x1e')](_0x444225);});}_0x6be1d8();}},'charset':_0x83a7('0x1f'),'collate':_0x83a7('0x20')});}; \ No newline at end of file +var _0xa2fa=['isNil','UserId','MailInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','fti_mail_messages','subject','FULLTEXT','body','get','toLowerCase','secret'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xa2fa,0xc5));var _0xaa2f=function(_0x2142fa,_0x1e9945){_0x2142fa=_0x2142fa-0x0;var _0x350983=_0xa2fa[_0x2142fa];return _0x350983;};'use strict';var _=require(_0xaa2f('0x0'));var util=require(_0xaa2f('0x1'));var logger=require('../../config/logger')(_0xaa2f('0x2'));var moment=require(_0xaa2f('0x3'));var BPromise=require(_0xaa2f('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xaa2f('0x5'));var config=require(_0xaa2f('0x6'));var attributes=require(_0xaa2f('0x7'));module[_0xaa2f('0x8')]=function(_0x3ccccc,_0x361142){return _0x3ccccc[_0xaa2f('0x9')](_0xaa2f('0xa'),attributes,{'tableName':_0xaa2f('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xaa2f('0xc'),'fields':['plainBody',_0xaa2f('0xd')],'type':_0xaa2f('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e1edc,_0x4a1854,_0x2aac72){if(_0x1e1edc[_0xaa2f('0xf')]){_0x1e1edc['plainBody']=htmlToText['fromString'](_0x1e1edc[_0xaa2f('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2aac72(null,_0x4a1854);},'afterCreate':function(_0x145180,_0x1d6239,_0x4610d0){var _0x59603b=_0x3ccccc['models'];var _0x21517b=_0x145180[_0xaa2f('0x10')]({'plain':!![]});if(_0x21517b['direction'][_0xaa2f('0x11')]()==='in'||_0x21517b['direction'][_0xaa2f('0x11')]()==='out'&&!_0x21517b[_0xaa2f('0x12')]&&!_[_0xaa2f('0x13')](_0x21517b[_0xaa2f('0x14')])){_0x59603b['MailInteraction']['findOne']({'where':{'id':_0x21517b[_0xaa2f('0x15')]}})[_0xaa2f('0x16')](function(_0x4bba60){if(_0x4bba60){_0x4bba60[_0xaa2f('0x17')]({'lastMsgAt':_0x21517b[_0xaa2f('0x18')],'lastMsgDirection':_0x21517b['direction'][_0xaa2f('0x11')]()});}})['catch'](function(_0x56566e){console[_0xaa2f('0x19')](_0x56566e);});}_0x4610d0();}},'charset':_0xaa2f('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9954aa4..3450183 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 _0x7708=['info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','MailMessage','create','options','raw','catch','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7708,0x188));var _0x8770=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x7708[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var moment=require('moment');var BPromise=require(_0x8770('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8770('0x3'))(_0x8770('0x4'));var config=require('../../config/environment');var jayson=require(_0x8770('0x5'));var client=jayson['client'][_0x8770('0x6')]({'port':0x232a});config[_0x8770('0x7')]=_[_0x8770('0x8')](config[_0x8770('0x7')],{'host':_0x8770('0x9'),'port':0x18eb});var socket=require(_0x8770('0xa'))(new Redis(config[_0x8770('0x7')]));require('./mailMessage.socket')[_0x8770('0xb')](socket);function respondWithRpcPromise(_0x2ca830,_0x3f357a,_0x4e4551){return new BPromise(function(_0x390af0,_0x10e4a3){return client[_0x8770('0xc')](_0x2ca830,_0x4e4551)[_0x8770('0xd')](function(_0x4a0ca1){logger[_0x8770('0xe')](_0x8770('0xf'),_0x3f357a,_0x8770('0x10'));logger['debug'](_0x8770('0x11'),_0x3f357a,_0x8770('0x10'),JSON[_0x8770('0x12')](_0x4a0ca1));if(_0x4a0ca1[_0x8770('0x13')]){if(_0x4a0ca1[_0x8770('0x13')][_0x8770('0x14')]===0x1f4){logger[_0x8770('0x13')](_0x8770('0xf'),_0x3f357a,_0x4a0ca1['error'][_0x8770('0x15')]);return _0x10e4a3(_0x4a0ca1[_0x8770('0x13')]['message']);}logger[_0x8770('0x13')]('MailMessage,\x20%s,\x20%s',_0x3f357a,_0x4a0ca1[_0x8770('0x13')]['message']);return _0x390af0(_0x4a0ca1['error']['message']);}else{logger[_0x8770('0xe')](_0x8770('0xf'),_0x3f357a,_0x8770('0x10'));_0x390af0(_0x4a0ca1[_0x8770('0x16')]['message']);}})['catch'](function(_0x349bd4){logger[_0x8770('0x13')](_0x8770('0xf'),_0x3f357a,_0x349bd4);_0x10e4a3(_0x349bd4);});});}exports[_0x8770('0x17')]=function(_0x4d2c7e){var _0x4e1fa6=this;return new Promise(function(_0x3e1fe7,_0x1234dd){return db[_0x8770('0x18')][_0x8770('0x19')](_0x4d2c7e['body'],{'raw':_0x4d2c7e['options']?_0x4d2c7e[_0x8770('0x1a')][_0x8770('0x1b')]===undefined?!![]:![]:!![]})[_0x8770('0xd')](function(_0x2918a7){logger[_0x8770('0xe')](_0x8770('0x17'),_0x4d2c7e);logger['debug'](_0x8770('0x17'),_0x4d2c7e,JSON[_0x8770('0x12')](_0x2918a7));_0x3e1fe7(_0x2918a7);})[_0x8770('0x1c')](function(_0x2515c5){logger['error'](_0x8770('0x17'),_0x2515c5['message'],_0x4d2c7e);_0x1234dd(_0x4e1fa6[_0x8770('0x13')](0x1f4,_0x2515c5[_0x8770('0x15')]));});});}; \ No newline at end of file +var _0xd943=['CreateMailMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailMessage','options','raw'];(function(_0x305015,_0x132e80){var _0x4abf8e=function(_0x117d07){while(--_0x117d07){_0x305015['push'](_0x305015['shift']());}};_0x4abf8e(++_0x132e80);}(_0xd943,0x15d));var _0x3d94=function(_0xbcb550,_0x584a6c){_0xbcb550=_0xbcb550-0x0;var _0x132826=_0xd943[_0xbcb550];return _0x132826;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});}exports['CreateMailMessage']=function(_0x28bead){var _0x193934=this;return new Promise(function(_0x16a6d0,_0x1e9ec2){return db[_0x3d94('0x19')]['create'](_0x28bead['body'],{'raw':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x30af25){logger[_0x3d94('0xf')](_0x3d94('0x1c'),_0x28bead);logger[_0x3d94('0x12')](_0x3d94('0x1c'),_0x28bead,JSON[_0x3d94('0x13')](_0x30af25));_0x16a6d0(_0x30af25);})[_0x3d94('0x18')](function(_0x27f978){logger[_0x3d94('0x14')](_0x3d94('0x1c'),_0x27f978[_0x3d94('0x16')],_0x28bead);_0x1e9ec2(_0x193934[_0x3d94('0x14')](0x1f4,_0x27f978[_0x3d94('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index c62cfe9..e8b9c51 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 _0x24f1=['./mailMessage.events','save','remove','update','removeListener','register','length','mailMessage:'];(function(_0x41f252,_0x36bc6e){var _0x2c08e4=function(_0x8f9990){while(--_0x8f9990){_0x41f252['push'](_0x41f252['shift']());}};_0x2c08e4(++_0x36bc6e);}(_0x24f1,0xf0));var _0x124f=function(_0x3bb480,_0x1b6dd7){_0x3bb480=_0x3bb480-0x0;var _0x2cccd4=_0x24f1[_0x3bb480];return _0x2cccd4;};'use strict';var MailMessageEvents=require(_0x124f('0x0'));var events=[_0x124f('0x1'),_0x124f('0x2'),_0x124f('0x3')];function createListener(_0x359453,_0x4ccbd4){return function(_0x5ea968){_0x4ccbd4['emit'](_0x359453,_0x5ea968);};}function removeListener(_0x9bdd23,_0x513106){return function(){MailMessageEvents[_0x124f('0x4')](_0x9bdd23,_0x513106);};}exports[_0x124f('0x5')]=function(_0x347deb){for(var _0x545f15=0x0,_0x304a5e=events[_0x124f('0x6')];_0x545f15<_0x304a5e;_0x545f15++){var _0x498124=events[_0x545f15];var _0x1b2608=createListener(_0x124f('0x7')+_0x498124,_0x347deb);MailMessageEvents['on'](_0x498124,_0x1b2608);}}; \ No newline at end of file +var _0x5279=['./mailMessage.events','save','remove','update','removeListener','register','mailMessage:'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0x5279,0xa1));var _0x9527=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x5279[_0x1e4f2f];return _0xccea89;};'use strict';var MailMessageEvents=require(_0x9527('0x0'));var events=[_0x9527('0x1'),_0x9527('0x2'),_0x9527('0x3')];function createListener(_0x2ba0b6,_0x5971cc){return function(_0x4252ff){_0x5971cc['emit'](_0x2ba0b6,_0x4252ff);};}function removeListener(_0xcf35,_0x187ff2){return function(){MailMessageEvents[_0x9527('0x4')](_0xcf35,_0x187ff2);};}exports[_0x9527('0x5')]=function(_0x19bfa9){for(var _0xbaac4f=0x0,_0x2481cd=events['length'];_0xbaac4f<_0x2481cd;_0xbaac4f++){var _0x356097=events[_0xbaac4f];var _0x312358=createListener(_0x9527('0x6')+_0x356097,_0x19bfa9);MailMessageEvents['on'](_0x356097,_0x312358);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a24987c..cab7695 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 _0x9d1a=['/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','delete','/:id','removeTeams','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','getTeams'];(function(_0x48eef4,_0x54ca8f){var _0xbcb029=function(_0x19da4c){while(--_0x19da4c){_0x48eef4['push'](_0x48eef4['shift']());}};_0xbcb029(++_0x54ca8f);}(_0x9d1a,0x12f));var _0xa9d1=function(_0x1381b8,_0x150b4b){_0x1381b8=_0x1381b8-0x0;var _0x28dddb=_0x9d1a[_0x1381b8];return _0x28dddb;};'use strict';var multer=require('multer');var util=require(_0xa9d1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa9d1('0x1'));var router=express[_0xa9d1('0x2')]();var fs_extra=require(_0xa9d1('0x3'));var auth=require(_0xa9d1('0x4'));var interaction=require(_0xa9d1('0x5'));var config=require(_0xa9d1('0x6'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0xa9d1('0x7')](),controller[_0xa9d1('0x8')]);router[_0xa9d1('0x9')](_0xa9d1('0xa'),auth['isAuthenticated'](),controller[_0xa9d1('0xb')]);router[_0xa9d1('0x9')]('/:id',auth[_0xa9d1('0x7')](),controller[_0xa9d1('0xc')]);router[_0xa9d1('0x9')](_0xa9d1('0xd'),auth['isAuthenticated'](),controller[_0xa9d1('0xe')]);router['get']('/:id/teams',auth[_0xa9d1('0x7')](),controller[_0xa9d1('0xf')]);router[_0xa9d1('0x9')](_0xa9d1('0x10'),auth['isAuthenticated'](),controller[_0xa9d1('0x11')]);router[_0xa9d1('0x12')]('/',auth[_0xa9d1('0x7')](),controller[_0xa9d1('0x13')]);router['post'](_0xa9d1('0x14'),auth[_0xa9d1('0x7')](),controller[_0xa9d1('0x15')]);router['post'](_0xa9d1('0x10'),auth[_0xa9d1('0x7')](),controller[_0xa9d1('0x16')]);router['put']('/:id',auth[_0xa9d1('0x7')](),controller[_0xa9d1('0x17')]);router[_0xa9d1('0x18')](_0xa9d1('0x19'),auth[_0xa9d1('0x7')](),controller['destroy']);router[_0xa9d1('0x18')](_0xa9d1('0x14'),auth[_0xa9d1('0x7')](),controller[_0xa9d1('0x1a')]);router[_0xa9d1('0x18')](_0xa9d1('0x10'),auth[_0xa9d1('0x7')](),controller[_0xa9d1('0x1b')]);module[_0xa9d1('0x1c')]=router; \ No newline at end of file +var _0x3c1c=['../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/:id','show','getMembers','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','express','fs-extra'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x3c1c,0x15a));var _0xc3c1=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x3c1c[_0x158f01];return _0x5ef74e;};'use strict';var multer=require('multer');var util=require(_0xc3c1('0x0'));var path=require(_0xc3c1('0x1'));var timeout=require('connect-timeout');var express=require(_0xc3c1('0x2'));var router=express['Router']();var fs_extra=require(_0xc3c1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc3c1('0x4'));var config=require(_0xc3c1('0x5'));var controller=require(_0xc3c1('0x6'));router[_0xc3c1('0x7')]('/',auth[_0xc3c1('0x8')](),controller[_0xc3c1('0x9')]);router[_0xc3c1('0x7')]('/describe',auth[_0xc3c1('0x8')](),controller['describe']);router['get'](_0xc3c1('0xa'),auth[_0xc3c1('0x8')](),controller[_0xc3c1('0xb')]);router[_0xc3c1('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0xc3c1('0xc')]);router['get']('/:id/teams',auth[_0xc3c1('0x8')](),controller['getTeams']);router['get'](_0xc3c1('0xd'),auth['isAuthenticated'](),controller[_0xc3c1('0xe')]);router[_0xc3c1('0xf')]('/',auth[_0xc3c1('0x8')](),controller['create']);router[_0xc3c1('0xf')](_0xc3c1('0x10'),auth[_0xc3c1('0x8')](),controller[_0xc3c1('0x11')]);router[_0xc3c1('0xf')](_0xc3c1('0xd'),auth[_0xc3c1('0x8')](),controller[_0xc3c1('0x12')]);router[_0xc3c1('0x13')](_0xc3c1('0xa'),auth[_0xc3c1('0x8')](),controller[_0xc3c1('0x14')]);router[_0xc3c1('0x15')](_0xc3c1('0xa'),auth['isAuthenticated'](),controller[_0xc3c1('0x16')]);router[_0xc3c1('0x15')](_0xc3c1('0x10'),auth[_0xc3c1('0x8')](),controller['removeTeams']);router['delete'](_0xc3c1('0xd'),auth[_0xc3c1('0x8')](),controller[_0xc3c1('0x17')]);module[_0xc3c1('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 7c0350a..2278ae7 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 _0x9f88=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x1c144d,_0x2f0b77){var _0x43a129=function(_0x1035ef){while(--_0x1035ef){_0x1c144d['push'](_0x1c144d['shift']());}};_0x43a129(++_0x2f0b77);}(_0x9f88,0xca));var _0x89f8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9f88[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x89f8('0x0'));module[_0x89f8('0x1')]={'name':{'type':Sequelize[_0x89f8('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x89f8('0x2')]},'timeout':{'type':Sequelize[_0x89f8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x89f8('0x4')](_0x89f8('0x5'),_0x89f8('0x6'),_0x89f8('0x7'))}}; \ No newline at end of file +var _0xdaf9=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x4ea503,_0xde7a49){var _0x2d9b72=function(_0x173201){while(--_0x173201){_0x4ea503['push'](_0x4ea503['shift']());}};_0x2d9b72(++_0xde7a49);}(_0xdaf9,0x178));var _0x9daf=function(_0x28c90b,_0x480fdb){_0x28c90b=_0x28c90b-0x0;var _0x4983a8=_0xdaf9[_0x28c90b];return _0x4983a8;};'use strict';var Sequelize=require(_0x9daf('0x0'));module['exports']={'name':{'type':Sequelize[_0x9daf('0x1')],'unique':_0x9daf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9daf('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9daf('0x4'),_0x9daf('0x5'),_0x9daf('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 2909cfa..b053039 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 _0x44f2=['mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','Agents','voicePause','interface','transaction','addTeams','each','findOrCreate','forEach','ids','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','SELECT','every','includes','all','union','compact','value','sequelize','removeTeams','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','findOne','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','MailQueue','type','key','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent'];(function(_0x4d0cb6,_0x4a8741){var _0x5dd086=function(_0x420614){while(--_0x420614){_0x4d0cb6['push'](_0x4d0cb6['shift']());}};_0x5dd086(++_0x4a8741);}(_0x44f2,0x1da));var _0x244f=function(_0x3a2a74,_0x3b4775){_0x3a2a74=_0x3a2a74-0x0;var _0x5a2c55=_0x44f2[_0x3a2a74];return _0x5a2c55;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x244f('0x0'));var jsonpatch=require(_0x244f('0x1'));var rp=require('request-promise');var moment=require(_0x244f('0x2'));var BPromise=require(_0x244f('0x3'));var Mustache=require(_0x244f('0x4'));var util=require(_0x244f('0x5'));var path=require(_0x244f('0x6'));var sox=require(_0x244f('0x7'));var csv=require(_0x244f('0x8'));var ejs=require(_0x244f('0x9'));var fs=require('fs');var fs_extra=require(_0x244f('0xa'));var _=require(_0x244f('0xb'));var squel=require(_0x244f('0xc'));var crypto=require('crypto');var jsforce=require(_0x244f('0xd'));var deskjs=require(_0x244f('0xe'));var toCsv=require(_0x244f('0x8'));var querystring=require('querystring');var Papa=require(_0x244f('0xf'));var Redis=require(_0x244f('0x10'));var authService=require(_0x244f('0x11'));var qs=require(_0x244f('0x12'));var as=require(_0x244f('0x13'));var hardwareService=require(_0x244f('0x14'));var logger=require(_0x244f('0x15'))(_0x244f('0x16'));var utils=require(_0x244f('0x17'));var config=require(_0x244f('0x18'));var licenseUtil=require(_0x244f('0x19'));var db=require(_0x244f('0x1a'))['db'];config[_0x244f('0x1b')]=_['defaults'](config[_0x244f('0x1b')],{'host':_0x244f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x244f('0x1b')]));require('./mailQueue.socket')[_0x244f('0x1d')](socket);function respondWithStatusCode(_0x3861fa,_0x40b825){_0x40b825=_0x40b825||0xcc;return function(_0x30f46e){if(_0x30f46e){return _0x3861fa['sendStatus'](_0x40b825);}return _0x3861fa['status'](_0x40b825)[_0x244f('0x1e')]();};}function respondWithResult(_0x201702,_0x5d7c97){_0x5d7c97=_0x5d7c97||0xc8;return function(_0x4f8561){if(_0x4f8561){return _0x201702[_0x244f('0x1f')](_0x5d7c97)[_0x244f('0x20')](_0x4f8561);}};}function respondWithFilteredResult(_0x40e721,_0x2a7dd0){return function(_0xf71165){if(_0xf71165){var _0x321183=typeof _0x2a7dd0[_0x244f('0x21')]===_0x244f('0x22')&&typeof _0x2a7dd0[_0x244f('0x23')]==='undefined';var _0x483b8d=_0xf71165[_0x244f('0x24')];var _0x99b59a=_0x321183?0x0:_0x2a7dd0[_0x244f('0x21')];var _0x23dcc0=_0x321183?_0xf71165[_0x244f('0x24')]:_0x2a7dd0['offset']+_0x2a7dd0[_0x244f('0x23')];var _0x857540;if(_0x23dcc0>=_0x483b8d){_0x23dcc0=_0x483b8d;_0x857540=0xc8;}else{_0x857540=0xce;}_0x40e721[_0x244f('0x1f')](_0x857540);return _0x40e721[_0x244f('0x25')](_0x244f('0x26'),_0x99b59a+'-'+_0x23dcc0+'/'+_0x483b8d)[_0x244f('0x20')](_0xf71165);}return null;};}function patchUpdates(_0x349a93){return function(_0x407610){try{jsonpatch['apply'](_0x407610,_0x349a93,!![]);}catch(_0x356431){return BPromise[_0x244f('0x27')](_0x356431);}return _0x407610[_0x244f('0x28')]();};}function saveUpdates(_0x41c4fc,_0xbad82a){return function(_0x35cdde){if(_0x35cdde){return _0x35cdde[_0x244f('0x29')](_0x41c4fc)[_0x244f('0x2a')](function(_0x2450c4){return _0x2450c4;});}return null;};}function removeEntity(_0x17d07b,_0x4e377c){return function(_0x4de96c){if(_0x4de96c){return _0x4de96c[_0x244f('0x2b')]()[_0x244f('0x2a')](function(){var _0x3b5388=_0x4de96c['get']({'plain':!![]});var _0x572a19=_0x244f('0x2c');return db[_0x244f('0x2d')][_0x244f('0x2b')]({'where':{'type':_0x572a19,'resourceId':_0x3b5388['id']}})[_0x244f('0x2a')](function(){return _0x4de96c;});})[_0x244f('0x2a')](function(){_0x17d07b[_0x244f('0x1f')](0xcc)[_0x244f('0x1e')]();});}};}function handleEntityNotFound(_0x38ffda,_0x1c1af5){return function(_0x8ec84b){if(!_0x8ec84b){_0x38ffda[_0x244f('0x2e')](0x194);}return _0x8ec84b;};}function handleError(_0x4e02b8,_0x56962e){_0x56962e=_0x56962e||0x1f4;return function(_0x54910b){logger[_0x244f('0x2f')](_0x54910b[_0x244f('0x30')]);if(_0x54910b[_0x244f('0x31')]){delete _0x54910b[_0x244f('0x31')];}_0x4e02b8[_0x244f('0x1f')](_0x56962e)[_0x244f('0x32')](_0x54910b);};}exports[_0x244f('0x33')]=function(_0xa0595d,_0x5f5317){var _0xb71fad={},_0x4cda96={},_0x86b3d2={'count':0x0,'rows':[]};var _0x2cdc7d=_[_0x244f('0x34')](db[_0x244f('0x35')]['rawAttributes'],function(_0x191d4f){return{'name':_0x191d4f['fieldName'],'type':_0x191d4f[_0x244f('0x36')][_0x244f('0x37')]};});_0x4cda96[_0x244f('0x38')]=_[_0x244f('0x34')](_0x2cdc7d,_0x244f('0x31'));_0x4cda96['query']=_['keys'](_0xa0595d['query']);_0x4cda96['filters']=_[_0x244f('0x39')](_0x4cda96[_0x244f('0x38')],_0x4cda96[_0x244f('0x3a')]);_0xb71fad[_0x244f('0x3b')]=_['intersection'](_0x4cda96[_0x244f('0x38')],qs[_0x244f('0x3c')](_0xa0595d[_0x244f('0x3a')][_0x244f('0x3c')]));_0xb71fad[_0x244f('0x3b')]=_0xb71fad['attributes']['length']?_0xb71fad[_0x244f('0x3b')]:_0x4cda96[_0x244f('0x38')];if(!_0xa0595d['query'][_0x244f('0x3d')](_0x244f('0x3e'))){_0xb71fad[_0x244f('0x23')]=qs['limit'](_0xa0595d[_0x244f('0x3a')][_0x244f('0x23')]);_0xb71fad['offset']=qs['offset'](_0xa0595d[_0x244f('0x3a')][_0x244f('0x21')]);}_0xb71fad[_0x244f('0x3f')]=qs['sort'](_0xa0595d[_0x244f('0x3a')][_0x244f('0x40')]);_0xb71fad[_0x244f('0x41')]=qs[_0x244f('0x42')](_[_0x244f('0x43')](_0xa0595d[_0x244f('0x3a')],_0x4cda96[_0x244f('0x42')]),_0x2cdc7d);if(_0xa0595d['query'][_0x244f('0x44')]){_0xb71fad['where']=_[_0x244f('0x45')](_0xb71fad[_0x244f('0x41')],{'$or':_[_0x244f('0x34')](_0x2cdc7d,function(_0x9e2292){if(_0x9e2292[_0x244f('0x36')]!=='VIRTUAL'){var _0x473a68={};_0x473a68[_0x9e2292[_0x244f('0x31')]]={'$like':'%'+_0xa0595d['query']['filter']+'%'};return _0x473a68;}})});}_0xb71fad=_[_0x244f('0x45')]({},_0xb71fad,_0xa0595d[_0x244f('0x46')]);var _0x205e06={'where':_0xb71fad[_0x244f('0x41')]};return db['MailQueue'][_0x244f('0x24')](_0x205e06)['then'](function(_0xecda8a){_0x86b3d2[_0x244f('0x24')]=_0xecda8a;if(_0xa0595d[_0x244f('0x3a')][_0x244f('0x47')]){_0xb71fad['include']=[{'all':!![]}];}return db[_0x244f('0x35')][_0x244f('0x48')](_0xb71fad);})['then'](function(_0xe997ae){_0x86b3d2[_0x244f('0x49')]=_0xe997ae;return _0x86b3d2;})[_0x244f('0x2a')](respondWithFilteredResult(_0x5f5317,_0xb71fad))[_0x244f('0x4a')](handleError(_0x5f5317,null));};exports[_0x244f('0x4b')]=function(_0x1fa3d6,_0x28e331){var _0x560cd5={'raw':!![],'where':{'id':_0x1fa3d6[_0x244f('0x4c')]['id']}},_0x585d78={};_0x585d78[_0x244f('0x38')]=_[_0x244f('0x4d')](db['MailQueue'][_0x244f('0x4e')]);_0x585d78['query']=_[_0x244f('0x4d')](_0x1fa3d6[_0x244f('0x3a')]);_0x585d78['filters']=_[_0x244f('0x39')](_0x585d78[_0x244f('0x38')],_0x585d78[_0x244f('0x3a')]);_0x560cd5['attributes']=_[_0x244f('0x39')](_0x585d78[_0x244f('0x38')],qs['fields'](_0x1fa3d6[_0x244f('0x3a')][_0x244f('0x3c')]));_0x560cd5[_0x244f('0x3b')]=_0x560cd5['attributes'][_0x244f('0x4f')]?_0x560cd5['attributes']:_0x585d78[_0x244f('0x38')];if(_0x1fa3d6[_0x244f('0x3a')]['includeAll']){_0x560cd5['include']=[{'all':!![]}];}_0x560cd5=_[_0x244f('0x45')]({},_0x560cd5,_0x1fa3d6[_0x244f('0x46')]);return db['MailQueue'][_0x244f('0x50')](_0x560cd5)[_0x244f('0x2a')](handleEntityNotFound(_0x28e331,null))[_0x244f('0x2a')](respondWithResult(_0x28e331,null))[_0x244f('0x4a')](handleError(_0x28e331,null));};exports[_0x244f('0x51')]=function(_0x34429d,_0x2a0825){return db['MailQueue'][_0x244f('0x51')](_0x34429d[_0x244f('0x52')],{})[_0x244f('0x2a')](function(_0x25f0b8){var _0x30b5cc=_0x34429d[_0x244f('0x53')][_0x244f('0x54')]({'plain':!![]});if(!_0x30b5cc)throw new Error(_0x244f('0x55'));if(_0x30b5cc[_0x244f('0x56')]===_0x244f('0x53')){var _0x5c3f4e=_0x25f0b8[_0x244f('0x54')]({'plain':!![]});var _0x4854e2=_0x244f('0x2c');return db[_0x244f('0x57')][_0x244f('0x50')]({'where':{'name':_0x4854e2,'userProfileId':_0x30b5cc['userProfileId']},'raw':!![]})[_0x244f('0x2a')](function(_0x34c288){if(_0x34c288&&_0x34c288[_0x244f('0x58')]===0x0){return db[_0x244f('0x2d')][_0x244f('0x51')]({'name':_0x5c3f4e['name'],'resourceId':_0x5c3f4e['id'],'type':_0x34c288[_0x244f('0x31')],'sectionId':_0x34c288['id']},{})[_0x244f('0x2a')](function(){return _0x25f0b8;});}else{return _0x25f0b8;}})[_0x244f('0x4a')](function(_0x14edc6){logger['error'](_0x244f('0x59'),_0x14edc6);throw _0x14edc6;});}return _0x25f0b8;})[_0x244f('0x2a')](respondWithResult(_0x2a0825,0xc9))[_0x244f('0x4a')](handleError(_0x2a0825,null));};exports['update']=function(_0x5ca4bf,_0x5157fc){if(_0x5ca4bf['body']['id']){delete _0x5ca4bf[_0x244f('0x52')]['id'];}return db[_0x244f('0x35')][_0x244f('0x50')]({'where':{'id':_0x5ca4bf[_0x244f('0x4c')]['id']}})[_0x244f('0x2a')](handleEntityNotFound(_0x5157fc,null))[_0x244f('0x2a')](saveUpdates(_0x5ca4bf[_0x244f('0x52')],null))[_0x244f('0x2a')](respondWithResult(_0x5157fc,null))['catch'](handleError(_0x5157fc,null));};exports[_0x244f('0x2b')]=function(_0x55e27d,_0x29afeb){return db[_0x244f('0x35')][_0x244f('0x50')]({'where':{'id':_0x55e27d[_0x244f('0x4c')]['id']}})[_0x244f('0x2a')](handleEntityNotFound(_0x29afeb,null))[_0x244f('0x2a')](removeEntity(_0x29afeb,null))[_0x244f('0x4a')](handleError(_0x29afeb,null));};exports[_0x244f('0x5a')]=function(_0x3798e7,_0x354db9){return db[_0x244f('0x35')][_0x244f('0x5a')]()['then'](respondWithResult(_0x354db9,null))[_0x244f('0x4a')](handleError(_0x354db9,null));};exports[_0x244f('0x5b')]=function(_0x102574,_0x25e4fa,_0x2866a4){var _0x104ba3={'raw':!![],'where':{}},_0x733135={},_0x293afc;return db['MailQueue']['findOne']({'where':{'id':_0x102574[_0x244f('0x4c')]['id']}})[_0x244f('0x2a')](handleEntityNotFound(_0x25e4fa,null))['then'](function(_0x3b9bc4){if(_0x3b9bc4){_0x293afc=_0x3b9bc4[_0x244f('0x54')]({'plain':!![]});_0x733135[_0x244f('0x38')]=_['keys'](db[_0x244f('0x5c')]['rawAttributes']);_0x733135['query']=_['keys'](_0x102574['query']);_0x733135[_0x244f('0x42')]=_[_0x244f('0x39')](_0x733135[_0x244f('0x38')],_0x733135['query']);_0x104ba3[_0x244f('0x3b')]=_['intersection'](_0x733135['model'],qs['fields'](_0x102574[_0x244f('0x3a')][_0x244f('0x3c')]));_0x104ba3['attributes']=_0x104ba3['attributes'][_0x244f('0x4f')]?_0x104ba3[_0x244f('0x3b')]:_0x733135['model'];if(!_0x102574[_0x244f('0x3a')]['hasOwnProperty'](_0x244f('0x3e'))){_0x104ba3[_0x244f('0x23')]=qs[_0x244f('0x23')](_0x102574[_0x244f('0x3a')][_0x244f('0x23')]);_0x104ba3[_0x244f('0x21')]=qs[_0x244f('0x21')](_0x102574['query'][_0x244f('0x21')]);}_0x104ba3[_0x244f('0x3f')]=qs[_0x244f('0x40')](_0x102574[_0x244f('0x3a')][_0x244f('0x40')]);_0x104ba3[_0x244f('0x41')]=qs[_0x244f('0x42')](_[_0x244f('0x43')](_0x102574[_0x244f('0x3a')],_0x733135[_0x244f('0x42')]));_0x104ba3['where'][_0x244f('0x5d')]=_0x3b9bc4['id'];if(_0x102574[_0x244f('0x3a')][_0x244f('0x44')]){_0x104ba3['where']=_[_0x244f('0x45')](_0x104ba3['where'],{'$or':_[_0x244f('0x34')](_0x104ba3[_0x244f('0x3b')],function(_0x1c7ae8){var _0x4ed4ed={};_0x4ed4ed[_0x1c7ae8]={'$like':'%'+_0x102574[_0x244f('0x3a')][_0x244f('0x44')]+'%'};return _0x4ed4ed;})});}_0x104ba3=_[_0x244f('0x45')]({},_0x104ba3,_0x102574[_0x244f('0x46')]);return db[_0x244f('0x5c')][_0x244f('0x48')](_0x104ba3);}})['then'](function(_0x31da29){if(_0x31da29){return db[_0x244f('0x5e')][_0x244f('0x5f')]({'where':{'id':_['map'](_0x31da29,_0x244f('0x60')),'role':_0x244f('0x61')},'attributes':['id',_0x244f('0x31'),_0x244f('0x62'),_0x244f('0x63'),_0x244f('0x64')]});}})[_0x244f('0x2a')](function(_0x959b54){if(_0x959b54){return{'count':_0x959b54[_0x244f('0x24')],'rows':_[_0x244f('0x34')](_0x959b54['rows'],function(_0x2ce2b2){return{'membername':_0x2ce2b2[_0x244f('0x31')],'UserId':_0x2ce2b2['id'],'queue_name':_0x293afc[_0x244f('0x31')],'MailQueueId':_0x293afc['id'],'interface':util[_0x244f('0x65')]('%s/%s',_0x244f('0x66'),_0x2ce2b2[_0x244f('0x31')]),'penalty':0x0,'paused':_0x2ce2b2[_0x244f('0x62')],'createdAt':_0x2ce2b2[_0x244f('0x64')],'updatedAt':_0x2ce2b2[_0x244f('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x244f('0x2a')](respondWithFilteredResult(_0x25e4fa,_0x104ba3))[_0x244f('0x4a')](handleError(_0x25e4fa,null));};exports[_0x244f('0x67')]=function(_0x2ae409,_0x59c34e,_0xee603e){var _0x2da56b={};var _0x466b00={};var _0xc0d950;var _0x296d23;return db[_0x244f('0x35')]['findOne']({'where':{'id':_0x2ae409[_0x244f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x59c34e,null))['then'](function(_0x3fb120){if(_0x3fb120){_0xc0d950=_0x3fb120;_0x466b00['model']=_[_0x244f('0x4d')](db[_0x244f('0x68')]['rawAttributes']);_0x466b00[_0x244f('0x3a')]=_[_0x244f('0x4d')](_0x2ae409['query']);_0x466b00[_0x244f('0x42')]=_[_0x244f('0x39')](_0x466b00[_0x244f('0x38')],_0x466b00[_0x244f('0x3a')]);_0x2da56b[_0x244f('0x3b')]=_['intersection'](_0x466b00['model'],qs['fields'](_0x2ae409['query'][_0x244f('0x3c')]));_0x2da56b[_0x244f('0x3b')]=_0x2da56b[_0x244f('0x3b')][_0x244f('0x4f')]?_0x2da56b[_0x244f('0x3b')]:_0x466b00[_0x244f('0x38')];_0x2da56b['order']=qs[_0x244f('0x40')](_0x2ae409[_0x244f('0x3a')]['sort']);_0x2da56b['where']=qs[_0x244f('0x42')](_[_0x244f('0x43')](_0x2ae409[_0x244f('0x3a')],_0x466b00['filters']));if(_0x2ae409[_0x244f('0x3a')][_0x244f('0x44')]){_0x2da56b[_0x244f('0x41')]=_[_0x244f('0x45')](_0x2da56b['where'],{'$or':_[_0x244f('0x34')](_0x2da56b[_0x244f('0x3b')],function(_0x46d345){var _0x5b36cc={};_0x5b36cc[_0x46d345]={'$like':'%'+_0x2ae409[_0x244f('0x3a')]['filter']+'%'};return _0x5b36cc;})});}_0x2da56b=_['merge']({},_0x2da56b,_0x2ae409[_0x244f('0x46')]);return _0xc0d950[_0x244f('0x67')](_0x2da56b);}})[_0x244f('0x2a')](function(_0x98d1a7){if(_0x98d1a7){_0x296d23=_0x98d1a7[_0x244f('0x4f')];if(!_0x2ae409[_0x244f('0x3a')][_0x244f('0x3d')](_0x244f('0x3e'))){_0x2da56b[_0x244f('0x23')]=qs[_0x244f('0x23')](_0x2ae409[_0x244f('0x3a')][_0x244f('0x23')]);_0x2da56b['offset']=qs[_0x244f('0x21')](_0x2ae409[_0x244f('0x3a')][_0x244f('0x21')]);}return _0xc0d950[_0x244f('0x67')](_0x2da56b);}})[_0x244f('0x2a')](function(_0x1d00be){if(_0x1d00be){return _0x1d00be?{'count':_0x296d23,'rows':_0x1d00be}:null;}})[_0x244f('0x2a')](respondWithResult(_0x59c34e,null))[_0x244f('0x4a')](handleError(_0x59c34e,null));};exports['addTeams']=function(_0x2bcbdb,_0xca504,_0x839043){var _0x3f339c=_0x2bcbdb[_0x244f('0x52')]['ids'];return db[_0x244f('0x68')][_0x244f('0x48')]({'where':{'id':_0x3f339c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x244f('0x69'),'attributes':['id',_0x244f('0x31'),'online',_0x244f('0x6a'),_0x244f('0x6b')],'raw':!![]}]})[_0x244f('0x2a')](function(_0xb95f01){if(_0xb95f01){var _0x80f962=_['flatMap'](_0xb95f01,function(_0x310f0d){var _0x1c3bbc=_0x310f0d[_0x244f('0x54')]({'plain':!![]});return _0x1c3bbc[_0x244f('0x69')];});return db[_0x244f('0x35')]['find']({'where':{'id':_0x2bcbdb[_0x244f('0x4c')]['id']}})[_0x244f('0x2a')](function(_0x350d52){return db['sequelize'][_0x244f('0x6c')](function(_0x35775b){return _0x350d52[_0x244f('0x6d')](_0x3f339c,{'transaction':_0x35775b})['then'](function(){return BPromise[_0x244f('0x6e')](_0x80f962,function(_0x4de261){return db['UserMailQueue'][_0x244f('0x6f')]({'where':{'UserId':_0x4de261['id'],'MailQueueId':_0x2bcbdb['params']['id']},'transaction':_0x35775b});});})['then'](function(){_0x80f962[_0x244f('0x70')](function(_0x740acf){socket['emit']('userMailQueue:save',{'UserId':_0x740acf['id'],'MailQueueId':_0x350d52['id']});});});});});}})[_0x244f('0x2a')](respondWithStatusCode(_0xca504,null))[_0x244f('0x4a')](handleError(_0xca504,null));};exports['removeTeams']=function(_0x29b454,_0x5d7566,_0x396720){return db[_0x244f('0x68')][_0x244f('0x48')]({'where':{'id':_0x29b454[_0x244f('0x3a')][_0x244f('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x244f('0x69'),'attributes':['id'],'raw':!![]}]})[_0x244f('0x2a')](handleEntityNotFound(_0x5d7566,null))['then'](function(_0x5e1229){var _0x27de49=_[_0x244f('0x34')](_0x5e1229,'id');var _0x4a62b7=[];var _0x159719=[];var _0x53e6a7=squel[_0x244f('0x72')]();_0x53e6a7[_0x244f('0x73')]('tq.TeamId')[_0x244f('0x74')](_0x244f('0x75'),'tq')[_0x244f('0x76')](_0x244f('0x77'),'ut',_0x244f('0x78'))[_0x244f('0x41')](_0x244f('0x79'),_0x29b454[_0x244f('0x4c')]['id']);for(var _0x4676a5=0x0;_0x4676a5<_0x5e1229[_0x244f('0x4f')];_0x4676a5+=0x1){let _0x22edd9=_0x5e1229[_0x4676a5];for(var _0x2f4212=0x0;_0x2f4212<_0x22edd9[_0x244f('0x69')][_0x244f('0x4f')];_0x2f4212+=0x1){let _0x2b33b9=_0x22edd9[_0x244f('0x69')][_0x2f4212];var _0x4c9c8=_0x53e6a7[_0x244f('0x7a')]();_0x4c9c8[_0x244f('0x41')]('ut.UserId\x20=\x20?',_0x2b33b9['id']);_0x159719['push'](db['sequelize'][_0x244f('0x3a')](_0x4c9c8['toString'](),{'type':db['sequelize']['QueryTypes'][_0x244f('0x7b')]})[_0x244f('0x2a')](function(_0xb00b91){if(_0xb00b91[_0x244f('0x4f')]===0x1){return _0x2b33b9['id'];}else{var _0x2500c6=_[_0x244f('0x7c')](_['map'](_0xb00b91,'TeamId'),function(_0x1f6fd9){return _[_0x244f('0x7d')](_0x27de49,_0x1f6fd9);});if(_0x2500c6){return _0x2b33b9['id'];}}}));}}return BPromise[_0x244f('0x7e')](_0x159719)[_0x244f('0x2a')](function(_0x32cedd){_0x4a62b7=_(_0x4a62b7)[_0x244f('0x7f')](_0x32cedd)[_0x244f('0x80')]()[_0x244f('0x81')]();return db['MailQueue']['find']({'where':{'id':_0x29b454['params']['id']}})[_0x244f('0x2a')](function(_0x7f12ac){return db[_0x244f('0x82')][_0x244f('0x6c')](function(_0x559dae){return _0x7f12ac[_0x244f('0x83')](_0x29b454[_0x244f('0x3a')][_0x244f('0x71')],{'transaction':_0x559dae})[_0x244f('0x2a')](function(){if(!_[_0x244f('0x84')](_0x4a62b7)){return _0x7f12ac[_0x244f('0x85')](_0x4a62b7,{'transaction':_0x559dae});}})[_0x244f('0x2a')](function(){_0x4a62b7['forEach'](function(_0x586f11){socket[_0x244f('0x86')](_0x244f('0x87'),{'UserId':_0x586f11,'MailQueueId':_0x7f12ac['id']});});});});});});})[_0x244f('0x2a')](respondWithStatusCode(_0x5d7566,null))['catch'](handleError(_0x5d7566,null));};exports[_0x244f('0x88')]=function(_0x24cb00,_0x37463c,_0x3c92a4){return db[_0x244f('0x35')][_0x244f('0x50')]({'where':{'id':_0x24cb00['params']['id']}})[_0x244f('0x2a')](handleEntityNotFound(_0x37463c,null))['then'](function(_0x4fa8f1){if(_0x4fa8f1){return _0x4fa8f1[_0x244f('0x88')](_0x24cb00[_0x244f('0x52')][_0x244f('0x71')],_[_0x244f('0x89')](_0x24cb00[_0x244f('0x52')],[_0x244f('0x71'),'id'])||{})[_0x244f('0x8a')](function(_0x21cc25){for(var _0x120669=0x0;_0x120669<_0x24cb00[_0x244f('0x52')][_0x244f('0x71')][_0x244f('0x4f')];_0x120669+=0x1){socket[_0x244f('0x86')](_0x244f('0x8b'),{'UserId':Number(_0x24cb00[_0x244f('0x52')]['ids'][_0x120669]),'MailQueueId':Number(_0x24cb00[_0x244f('0x4c')]['id'])});}return _0x21cc25;});}})[_0x244f('0x2a')](respondWithResult(_0x37463c,null))[_0x244f('0x4a')](handleError(_0x37463c,null));};exports[_0x244f('0x85')]=function(_0x518db9,_0x54e8f6,_0x37b4d7){return db[_0x244f('0x35')][_0x244f('0x50')]({'where':{'id':_0x518db9[_0x244f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x54e8f6,null))[_0x244f('0x2a')](function(_0x4f1ce7){if(_0x4f1ce7){return _0x4f1ce7[_0x244f('0x85')](_0x518db9['query']['ids'])[_0x244f('0x2a')](function(){if(_[_0x244f('0x8c')](_0x518db9['query'][_0x244f('0x71')])){for(var _0x222cd2=0x0;_0x222cd2<_0x518db9['query'][_0x244f('0x71')][_0x244f('0x4f')];_0x222cd2+=0x1){socket[_0x244f('0x86')](_0x244f('0x87'),{'UserId':Number(_0x518db9['query']['ids'][_0x222cd2]),'MailQueueId':Number(_0x518db9[_0x244f('0x4c')]['id'])});}}else{socket['emit'](_0x244f('0x87'),{'UserId':Number(_0x518db9[_0x244f('0x3a')]['ids']),'MailQueueId':Number(_0x518db9[_0x244f('0x4c')]['id'])});}});}})[_0x244f('0x2a')](respondWithStatusCode(_0x54e8f6,null))[_0x244f('0x4a')](handleError(_0x54e8f6,null));};exports[_0x244f('0x8d')]=function(_0x1048a5,_0x11bc36,_0x48a859){var _0x297843={};var _0x18a304={};var _0x1291e4;var _0x6ef700;return db[_0x244f('0x35')][_0x244f('0x8e')]({'where':{'id':_0x1048a5[_0x244f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x11bc36,null))[_0x244f('0x2a')](function(_0x15c923){if(_0x15c923){_0x1291e4=_0x15c923;_0x18a304['model']=_[_0x244f('0x4d')](db[_0x244f('0x5e')]['rawAttributes']);_0x18a304[_0x244f('0x3a')]=_[_0x244f('0x4d')](_0x1048a5[_0x244f('0x3a')]);_0x18a304['filters']=_['intersection'](_0x18a304[_0x244f('0x38')],_0x18a304[_0x244f('0x3a')]);_0x297843['attributes']=_[_0x244f('0x39')](_0x18a304[_0x244f('0x38')],qs[_0x244f('0x3c')](_0x1048a5['query'][_0x244f('0x3c')]));_0x297843[_0x244f('0x3b')]=_0x297843[_0x244f('0x3b')]['length']?_0x297843['attributes']:_0x18a304[_0x244f('0x38')];_0x297843[_0x244f('0x3f')]=qs[_0x244f('0x40')](_0x1048a5[_0x244f('0x3a')][_0x244f('0x40')]);_0x297843[_0x244f('0x41')]=qs['filters'](_[_0x244f('0x43')](_0x1048a5[_0x244f('0x3a')],_0x18a304[_0x244f('0x42')]));if(_0x1048a5[_0x244f('0x3a')][_0x244f('0x44')]){_0x297843['where']=_[_0x244f('0x45')](_0x297843['where'],{'$or':_['map'](_0x297843[_0x244f('0x3b')],function(_0x596753){var _0x4af6d3={};_0x4af6d3[_0x596753]={'$like':'%'+_0x1048a5[_0x244f('0x3a')]['filter']+'%'};return _0x4af6d3;})});}_0x297843=_[_0x244f('0x45')]({},_0x297843,_0x1048a5[_0x244f('0x46')]);return _0x1291e4[_0x244f('0x8d')](_0x297843);}})[_0x244f('0x2a')](function(_0x166290){if(_0x166290){_0x6ef700=_0x166290[_0x244f('0x4f')];if(!_0x1048a5['query'][_0x244f('0x3d')](_0x244f('0x3e'))){_0x297843[_0x244f('0x23')]=qs[_0x244f('0x23')](_0x1048a5['query'][_0x244f('0x23')]);_0x297843['offset']=qs[_0x244f('0x21')](_0x1048a5[_0x244f('0x3a')]['offset']);}return _0x1291e4[_0x244f('0x8d')](_0x297843);}})[_0x244f('0x2a')](function(_0x2fb59c){if(_0x2fb59c){return _0x2fb59c?{'count':_0x6ef700,'rows':_0x2fb59c}:null;}})[_0x244f('0x2a')](respondWithResult(_0x11bc36,null))[_0x244f('0x4a')](handleError(_0x11bc36,null));}; \ No newline at end of file +var _0x5884=['autoAssociation','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','order','MailQueueId','findAll','User','map','UserId','mailPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','addAgents','omit','spread','emit','removeAgents','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','get','UserProfileResource','destroy','error','stack','name','send','MailQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','rows','catch','show','merge','find','create','body','user','role'];(function(_0x31a5b1,_0x19a993){var _0x1b210a=function(_0x26bf5c){while(--_0x26bf5c){_0x31a5b1['push'](_0x31a5b1['shift']());}};_0x1b210a(++_0x19a993);}(_0x5884,0x144));var _0x4588=function(_0x2f86a4,_0x1b0a63){_0x2f86a4=_0x2f86a4-0x0;var _0x4ca225=_0x5884[_0x2f86a4];return _0x4ca225;};'use strict';var emlformat=require(_0x4588('0x0'));var rimraf=require(_0x4588('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4588('0x2'));var moment=require('moment');var BPromise=require(_0x4588('0x3'));var Mustache=require(_0x4588('0x4'));var util=require(_0x4588('0x5'));var path=require(_0x4588('0x6'));var sox=require('sox');var csv=require(_0x4588('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4588('0x8'));var squel=require(_0x4588('0x9'));var crypto=require(_0x4588('0xa'));var jsforce=require(_0x4588('0xb'));var deskjs=require(_0x4588('0xc'));var toCsv=require(_0x4588('0x7'));var querystring=require(_0x4588('0xd'));var Papa=require('papaparse');var Redis=require(_0x4588('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4588('0xf'));var hardwareService=require(_0x4588('0x10'));var logger=require(_0x4588('0x11'))(_0x4588('0x12'));var utils=require(_0x4588('0x13'));var config=require(_0x4588('0x14'));var licenseUtil=require(_0x4588('0x15'));var db=require(_0x4588('0x16'))['db'];config[_0x4588('0x17')]=_[_0x4588('0x18')](config[_0x4588('0x17')],{'host':_0x4588('0x19'),'port':0x18eb});var socket=require(_0x4588('0x1a'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x4588('0x1b')](socket);function respondWithStatusCode(_0x41df3f,_0x293e4d){_0x293e4d=_0x293e4d||0xcc;return function(_0x47df0b){if(_0x47df0b){return _0x41df3f[_0x4588('0x1c')](_0x293e4d);}return _0x41df3f['status'](_0x293e4d)[_0x4588('0x1d')]();};}function respondWithResult(_0x5ee006,_0x34471e){_0x34471e=_0x34471e||0xc8;return function(_0x29559b){if(_0x29559b){return _0x5ee006[_0x4588('0x1e')](_0x34471e)[_0x4588('0x1f')](_0x29559b);}};}function respondWithFilteredResult(_0x189b14,_0x417091){return function(_0x352a4d){if(_0x352a4d){var _0x5b99ac=typeof _0x417091['offset']===_0x4588('0x20')&&typeof _0x417091[_0x4588('0x21')]===_0x4588('0x20');var _0x445460=_0x352a4d['count'];var _0x45d46e=_0x5b99ac?0x0:_0x417091['offset'];var _0x25e771=_0x5b99ac?_0x352a4d[_0x4588('0x22')]:_0x417091[_0x4588('0x23')]+_0x417091[_0x4588('0x21')];var _0x3b28eb;if(_0x25e771>=_0x445460){_0x25e771=_0x445460;_0x3b28eb=0xc8;}else{_0x3b28eb=0xce;}_0x189b14[_0x4588('0x1e')](_0x3b28eb);return _0x189b14[_0x4588('0x24')](_0x4588('0x25'),_0x45d46e+'-'+_0x25e771+'/'+_0x445460)[_0x4588('0x1f')](_0x352a4d);}return null;};}function patchUpdates(_0x5cae39){return function(_0x57f7f9){try{jsonpatch[_0x4588('0x26')](_0x57f7f9,_0x5cae39,!![]);}catch(_0x46fb5e){return BPromise['reject'](_0x46fb5e);}return _0x57f7f9['save']();};}function saveUpdates(_0x4cfede,_0x689993){return function(_0x2d853f){if(_0x2d853f){return _0x2d853f[_0x4588('0x27')](_0x4cfede)[_0x4588('0x28')](function(_0x8bb126){return _0x8bb126;});}return null;};}function removeEntity(_0x16e0d7,_0x4db688){return function(_0x3a94fe){if(_0x3a94fe){return _0x3a94fe['destroy']()[_0x4588('0x28')](function(){var _0xb2e3b9=_0x3a94fe[_0x4588('0x29')]({'plain':!![]});var _0x57a2ff='MailQueues';return db[_0x4588('0x2a')][_0x4588('0x2b')]({'where':{'type':_0x57a2ff,'resourceId':_0xb2e3b9['id']}})[_0x4588('0x28')](function(){return _0x3a94fe;});})[_0x4588('0x28')](function(){_0x16e0d7['status'](0xcc)[_0x4588('0x1d')]();});}};}function handleEntityNotFound(_0xa10b2e,_0x395f1a){return function(_0x44cc6c){if(!_0x44cc6c){_0xa10b2e['sendStatus'](0x194);}return _0x44cc6c;};}function handleError(_0x277b1f,_0x272edf){_0x272edf=_0x272edf||0x1f4;return function(_0x2b211c){logger[_0x4588('0x2c')](_0x2b211c[_0x4588('0x2d')]);if(_0x2b211c[_0x4588('0x2e')]){delete _0x2b211c[_0x4588('0x2e')];}_0x277b1f[_0x4588('0x1e')](_0x272edf)[_0x4588('0x2f')](_0x2b211c);};}exports['index']=function(_0x5a279d,_0x107862){var _0xeccd68={},_0x23e728={},_0x2f877e={'count':0x0,'rows':[]};var _0x1ca2ac=_['map'](db[_0x4588('0x30')][_0x4588('0x31')],function(_0x7aa16c){return{'name':_0x7aa16c[_0x4588('0x32')],'type':_0x7aa16c['type'][_0x4588('0x33')]};});_0x23e728[_0x4588('0x34')]=_['map'](_0x1ca2ac,'name');_0x23e728[_0x4588('0x35')]=_[_0x4588('0x36')](_0x5a279d['query']);_0x23e728[_0x4588('0x37')]=_['intersection'](_0x23e728['model'],_0x23e728['query']);_0xeccd68[_0x4588('0x38')]=_[_0x4588('0x39')](_0x23e728['model'],qs[_0x4588('0x3a')](_0x5a279d[_0x4588('0x35')][_0x4588('0x3a')]));_0xeccd68['attributes']=_0xeccd68[_0x4588('0x38')][_0x4588('0x3b')]?_0xeccd68[_0x4588('0x38')]:_0x23e728[_0x4588('0x34')];if(!_0x5a279d[_0x4588('0x35')]['hasOwnProperty']('nolimit')){_0xeccd68[_0x4588('0x21')]=qs[_0x4588('0x21')](_0x5a279d[_0x4588('0x35')][_0x4588('0x21')]);_0xeccd68[_0x4588('0x23')]=qs[_0x4588('0x23')](_0x5a279d[_0x4588('0x35')]['offset']);}_0xeccd68['order']=qs[_0x4588('0x3c')](_0x5a279d[_0x4588('0x35')][_0x4588('0x3c')]);_0xeccd68[_0x4588('0x3d')]=qs[_0x4588('0x37')](_[_0x4588('0x3e')](_0x5a279d[_0x4588('0x35')],_0x23e728[_0x4588('0x37')]),_0x1ca2ac);if(_0x5a279d[_0x4588('0x35')][_0x4588('0x3f')]){_0xeccd68['where']=_['merge'](_0xeccd68[_0x4588('0x3d')],{'$or':_['map'](_0x1ca2ac,function(_0x44b92f){if(_0x44b92f[_0x4588('0x40')]!==_0x4588('0x41')){var _0x6f571={};_0x6f571[_0x44b92f['name']]={'$like':'%'+_0x5a279d[_0x4588('0x35')]['filter']+'%'};return _0x6f571;}})});}_0xeccd68=_['merge']({},_0xeccd68,_0x5a279d[_0x4588('0x42')]);var _0x551c3c={'where':_0xeccd68['where']};return db[_0x4588('0x30')][_0x4588('0x22')](_0x551c3c)[_0x4588('0x28')](function(_0x5c71fd){_0x2f877e[_0x4588('0x22')]=_0x5c71fd;if(_0x5a279d['query'][_0x4588('0x43')]){_0xeccd68[_0x4588('0x44')]=[{'all':!![]}];}return db[_0x4588('0x30')]['findAll'](_0xeccd68);})[_0x4588('0x28')](function(_0x390050){_0x2f877e[_0x4588('0x45')]=_0x390050;return _0x2f877e;})[_0x4588('0x28')](respondWithFilteredResult(_0x107862,_0xeccd68))[_0x4588('0x46')](handleError(_0x107862,null));};exports[_0x4588('0x47')]=function(_0x325733,_0x4742b1){var _0xe51d6a={'raw':!![],'where':{'id':_0x325733['params']['id']}},_0x374ca7={};_0x374ca7[_0x4588('0x34')]=_['keys'](db[_0x4588('0x30')]['rawAttributes']);_0x374ca7[_0x4588('0x35')]=_[_0x4588('0x36')](_0x325733[_0x4588('0x35')]);_0x374ca7[_0x4588('0x37')]=_[_0x4588('0x39')](_0x374ca7[_0x4588('0x34')],_0x374ca7[_0x4588('0x35')]);_0xe51d6a[_0x4588('0x38')]=_[_0x4588('0x39')](_0x374ca7[_0x4588('0x34')],qs['fields'](_0x325733[_0x4588('0x35')]['fields']));_0xe51d6a[_0x4588('0x38')]=_0xe51d6a[_0x4588('0x38')]['length']?_0xe51d6a[_0x4588('0x38')]:_0x374ca7['model'];if(_0x325733['query'][_0x4588('0x43')]){_0xe51d6a[_0x4588('0x44')]=[{'all':!![]}];}_0xe51d6a=_[_0x4588('0x48')]({},_0xe51d6a,_0x325733[_0x4588('0x42')]);return db['MailQueue'][_0x4588('0x49')](_0xe51d6a)[_0x4588('0x28')](handleEntityNotFound(_0x4742b1,null))[_0x4588('0x28')](respondWithResult(_0x4742b1,null))['catch'](handleError(_0x4742b1,null));};exports[_0x4588('0x4a')]=function(_0x441adb,_0x47a98c){return db['MailQueue'][_0x4588('0x4a')](_0x441adb[_0x4588('0x4b')],{})['then'](function(_0x59fca3){var _0x4871e3=_0x441adb[_0x4588('0x4c')][_0x4588('0x29')]({'plain':!![]});if(!_0x4871e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4871e3[_0x4588('0x4d')]==='user'){var _0x108de7=_0x59fca3[_0x4588('0x29')]({'plain':!![]});var _0x35c5fb='MailQueues';return db['UserProfileSection'][_0x4588('0x49')]({'where':{'name':_0x35c5fb,'userProfileId':_0x4871e3['userProfileId']},'raw':!![]})[_0x4588('0x28')](function(_0xc6aefc){if(_0xc6aefc&&_0xc6aefc[_0x4588('0x4e')]===0x0){return db['UserProfileResource'][_0x4588('0x4a')]({'name':_0x108de7[_0x4588('0x2e')],'resourceId':_0x108de7['id'],'type':_0xc6aefc[_0x4588('0x2e')],'sectionId':_0xc6aefc['id']},{})[_0x4588('0x28')](function(){return _0x59fca3;});}else{return _0x59fca3;}})[_0x4588('0x46')](function(_0x2e6d3e){logger[_0x4588('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e6d3e);throw _0x2e6d3e;});}return _0x59fca3;})['then'](respondWithResult(_0x47a98c,0xc9))['catch'](handleError(_0x47a98c,null));};exports[_0x4588('0x27')]=function(_0x206ff6,_0x510948){if(_0x206ff6['body']['id']){delete _0x206ff6[_0x4588('0x4b')]['id'];}return db[_0x4588('0x30')][_0x4588('0x49')]({'where':{'id':_0x206ff6[_0x4588('0x4f')]['id']}})[_0x4588('0x28')](handleEntityNotFound(_0x510948,null))[_0x4588('0x28')](saveUpdates(_0x206ff6[_0x4588('0x4b')],null))[_0x4588('0x28')](respondWithResult(_0x510948,null))[_0x4588('0x46')](handleError(_0x510948,null));};exports[_0x4588('0x2b')]=function(_0x594483,_0x91c813){return db[_0x4588('0x30')][_0x4588('0x49')]({'where':{'id':_0x594483[_0x4588('0x4f')]['id']}})[_0x4588('0x28')](handleEntityNotFound(_0x91c813,null))[_0x4588('0x28')](removeEntity(_0x91c813,null))[_0x4588('0x46')](handleError(_0x91c813,null));};exports[_0x4588('0x50')]=function(_0x2310b7,_0x299b45){return db[_0x4588('0x30')]['describe']()[_0x4588('0x28')](respondWithResult(_0x299b45,null))['catch'](handleError(_0x299b45,null));};exports[_0x4588('0x51')]=function(_0x2f31d0,_0x2b4ba9,_0x147390){var _0x3f220e={'raw':!![],'where':{}},_0x2d1ea3={},_0x18786f;return db[_0x4588('0x30')][_0x4588('0x52')]({'where':{'id':_0x2f31d0[_0x4588('0x4f')]['id']}})[_0x4588('0x28')](handleEntityNotFound(_0x2b4ba9,null))['then'](function(_0x192d4f){if(_0x192d4f){_0x18786f=_0x192d4f['get']({'plain':!![]});_0x2d1ea3['model']=_[_0x4588('0x36')](db[_0x4588('0x53')][_0x4588('0x31')]);_0x2d1ea3['query']=_[_0x4588('0x36')](_0x2f31d0['query']);_0x2d1ea3[_0x4588('0x37')]=_[_0x4588('0x39')](_0x2d1ea3[_0x4588('0x34')],_0x2d1ea3[_0x4588('0x35')]);_0x3f220e[_0x4588('0x38')]=_[_0x4588('0x39')](_0x2d1ea3[_0x4588('0x34')],qs[_0x4588('0x3a')](_0x2f31d0[_0x4588('0x35')][_0x4588('0x3a')]));_0x3f220e[_0x4588('0x38')]=_0x3f220e[_0x4588('0x38')][_0x4588('0x3b')]?_0x3f220e['attributes']:_0x2d1ea3[_0x4588('0x34')];if(!_0x2f31d0[_0x4588('0x35')][_0x4588('0x54')](_0x4588('0x55'))){_0x3f220e[_0x4588('0x21')]=qs['limit'](_0x2f31d0[_0x4588('0x35')][_0x4588('0x21')]);_0x3f220e[_0x4588('0x23')]=qs[_0x4588('0x23')](_0x2f31d0[_0x4588('0x35')][_0x4588('0x23')]);}_0x3f220e[_0x4588('0x56')]=qs[_0x4588('0x3c')](_0x2f31d0[_0x4588('0x35')]['sort']);_0x3f220e[_0x4588('0x3d')]=qs[_0x4588('0x37')](_[_0x4588('0x3e')](_0x2f31d0['query'],_0x2d1ea3[_0x4588('0x37')]));_0x3f220e[_0x4588('0x3d')][_0x4588('0x57')]=_0x192d4f['id'];if(_0x2f31d0[_0x4588('0x35')][_0x4588('0x3f')]){_0x3f220e[_0x4588('0x3d')]=_[_0x4588('0x48')](_0x3f220e['where'],{'$or':_['map'](_0x3f220e[_0x4588('0x38')],function(_0x48be14){var _0x36108c={};_0x36108c[_0x48be14]={'$like':'%'+_0x2f31d0['query'][_0x4588('0x3f')]+'%'};return _0x36108c;})});}_0x3f220e=_[_0x4588('0x48')]({},_0x3f220e,_0x2f31d0[_0x4588('0x42')]);return db[_0x4588('0x53')][_0x4588('0x58')](_0x3f220e);}})[_0x4588('0x28')](function(_0x509284){if(_0x509284){return db[_0x4588('0x59')]['findAndCountAll']({'where':{'id':_[_0x4588('0x5a')](_0x509284,_0x4588('0x5b')),'role':'agent'},'attributes':['id',_0x4588('0x2e'),_0x4588('0x5c'),_0x4588('0x5d'),_0x4588('0x5e')]});}})['then'](function(_0x735f44){if(_0x735f44){return{'count':_0x735f44[_0x4588('0x22')],'rows':_[_0x4588('0x5a')](_0x735f44[_0x4588('0x45')],function(_0xe92b1){return{'membername':_0xe92b1[_0x4588('0x2e')],'UserId':_0xe92b1['id'],'queue_name':_0x18786f[_0x4588('0x2e')],'MailQueueId':_0x18786f['id'],'interface':util['format'](_0x4588('0x5f'),'SIP',_0xe92b1['name']),'penalty':0x0,'paused':_0xe92b1['mailPause'],'createdAt':_0xe92b1[_0x4588('0x5e')],'updatedAt':_0xe92b1[_0x4588('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4588('0x28')](respondWithFilteredResult(_0x2b4ba9,_0x3f220e))['catch'](handleError(_0x2b4ba9,null));};exports[_0x4588('0x60')]=function(_0x2a1753,_0x15e583,_0x2d4bb8){var _0x5b4275={};var _0x2d30dd={};var _0x5c6709;var _0x5a4896;return db['MailQueue']['findOne']({'where':{'id':_0x2a1753['params']['id']}})[_0x4588('0x28')](handleEntityNotFound(_0x15e583,null))[_0x4588('0x28')](function(_0x1656ef){if(_0x1656ef){_0x5c6709=_0x1656ef;_0x2d30dd['model']=_[_0x4588('0x36')](db[_0x4588('0x61')][_0x4588('0x31')]);_0x2d30dd[_0x4588('0x35')]=_['keys'](_0x2a1753[_0x4588('0x35')]);_0x2d30dd[_0x4588('0x37')]=_['intersection'](_0x2d30dd[_0x4588('0x34')],_0x2d30dd[_0x4588('0x35')]);_0x5b4275[_0x4588('0x38')]=_['intersection'](_0x2d30dd[_0x4588('0x34')],qs[_0x4588('0x3a')](_0x2a1753['query']['fields']));_0x5b4275['attributes']=_0x5b4275[_0x4588('0x38')]['length']?_0x5b4275['attributes']:_0x2d30dd[_0x4588('0x34')];_0x5b4275[_0x4588('0x56')]=qs[_0x4588('0x3c')](_0x2a1753['query'][_0x4588('0x3c')]);_0x5b4275[_0x4588('0x3d')]=qs[_0x4588('0x37')](_[_0x4588('0x3e')](_0x2a1753['query'],_0x2d30dd['filters']));if(_0x2a1753[_0x4588('0x35')]['filter']){_0x5b4275['where']=_[_0x4588('0x48')](_0x5b4275['where'],{'$or':_[_0x4588('0x5a')](_0x5b4275[_0x4588('0x38')],function(_0x28f7b){var _0x581de1={};_0x581de1[_0x28f7b]={'$like':'%'+_0x2a1753['query']['filter']+'%'};return _0x581de1;})});}_0x5b4275=_[_0x4588('0x48')]({},_0x5b4275,_0x2a1753['options']);return _0x5c6709[_0x4588('0x60')](_0x5b4275);}})[_0x4588('0x28')](function(_0x36ed81){if(_0x36ed81){_0x5a4896=_0x36ed81[_0x4588('0x3b')];if(!_0x2a1753[_0x4588('0x35')][_0x4588('0x54')](_0x4588('0x55'))){_0x5b4275[_0x4588('0x21')]=qs[_0x4588('0x21')](_0x2a1753[_0x4588('0x35')][_0x4588('0x21')]);_0x5b4275['offset']=qs[_0x4588('0x23')](_0x2a1753[_0x4588('0x35')][_0x4588('0x23')]);}return _0x5c6709['getTeams'](_0x5b4275);}})[_0x4588('0x28')](function(_0x20e83a){if(_0x20e83a){return _0x20e83a?{'count':_0x5a4896,'rows':_0x20e83a}:null;}})[_0x4588('0x28')](respondWithResult(_0x15e583,null))[_0x4588('0x46')](handleError(_0x15e583,null));};exports[_0x4588('0x62')]=function(_0x37fdd9,_0x14aa51,_0xa666db){var _0x45c88f=_0x37fdd9[_0x4588('0x4b')][_0x4588('0x63')];return db[_0x4588('0x61')][_0x4588('0x58')]({'where':{'id':_0x45c88f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4588('0x64'),'attributes':['id',_0x4588('0x2e'),'online',_0x4588('0x65'),'interface'],'raw':!![]}]})[_0x4588('0x28')](function(_0x3a076e){if(_0x3a076e){var _0x3b7d3d=_[_0x4588('0x66')](_0x3a076e,function(_0x329f02){var _0x3e5cf0=_0x329f02[_0x4588('0x29')]({'plain':!![]});return _0x3e5cf0[_0x4588('0x64')];});return db[_0x4588('0x30')][_0x4588('0x49')]({'where':{'id':_0x37fdd9['params']['id']}})[_0x4588('0x28')](function(_0xb0661c){return db[_0x4588('0x67')][_0x4588('0x68')](function(_0x3f19cd){return _0xb0661c[_0x4588('0x62')](_0x45c88f,{'transaction':_0x3f19cd})[_0x4588('0x28')](function(){return BPromise[_0x4588('0x69')](_0x3b7d3d,function(_0x274273){return db[_0x4588('0x53')][_0x4588('0x6a')]({'where':{'UserId':_0x274273['id'],'MailQueueId':_0x37fdd9['params']['id']},'transaction':_0x3f19cd});});})[_0x4588('0x28')](function(){_0x3b7d3d[_0x4588('0x6b')](function(_0x1679ee){socket['emit'](_0x4588('0x6c'),{'UserId':_0x1679ee['id'],'MailQueueId':_0xb0661c['id']});});});});});}})[_0x4588('0x28')](respondWithStatusCode(_0x14aa51,null))['catch'](handleError(_0x14aa51,null));};exports[_0x4588('0x6d')]=function(_0xa6e44,_0x1a98a1,_0xd0d200){return db[_0x4588('0x61')][_0x4588('0x58')]({'where':{'id':_0xa6e44[_0x4588('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4588('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4588('0x28')](handleEntityNotFound(_0x1a98a1,null))[_0x4588('0x28')](function(_0x4937b3){var _0x497166=_['map'](_0x4937b3,'id');var _0xa18127=[];var _0xba21e7=[];var _0x417aab=squel[_0x4588('0x6e')]();_0x417aab[_0x4588('0x6f')]('tq.TeamId')[_0x4588('0x70')]('team_has_mail_queues','tq')['join'](_0x4588('0x71'),'ut',_0x4588('0x72'))['where'](_0x4588('0x73'),_0xa6e44[_0x4588('0x4f')]['id']);for(var _0x2d618b=0x0;_0x2d618b<_0x4937b3[_0x4588('0x3b')];_0x2d618b+=0x1){let _0xccde4=_0x4937b3[_0x2d618b];for(var _0x5b4ead=0x0;_0x5b4ead<_0xccde4[_0x4588('0x64')]['length'];_0x5b4ead+=0x1){let _0x58349f=_0xccde4[_0x4588('0x64')][_0x5b4ead];var _0x57e2f4=_0x417aab['clone']();_0x57e2f4[_0x4588('0x3d')](_0x4588('0x74'),_0x58349f['id']);_0xba21e7[_0x4588('0x75')](db['sequelize'][_0x4588('0x35')](_0x57e2f4[_0x4588('0x76')](),{'type':db['sequelize'][_0x4588('0x77')][_0x4588('0x78')]})['then'](function(_0x55ad78){if(_0x55ad78[_0x4588('0x3b')]===0x1){return _0x58349f['id'];}else{var _0x39bec0=_[_0x4588('0x79')](_[_0x4588('0x5a')](_0x55ad78,_0x4588('0x7a')),function(_0x3bfc53){return _[_0x4588('0x7b')](_0x497166,_0x3bfc53);});if(_0x39bec0){return _0x58349f['id'];}}}));}}return BPromise['all'](_0xba21e7)['then'](function(_0x1391b9){_0xa18127=_(_0xa18127)['union'](_0x1391b9)[_0x4588('0x7c')]()[_0x4588('0x7d')]();return db[_0x4588('0x30')][_0x4588('0x49')]({'where':{'id':_0xa6e44[_0x4588('0x4f')]['id']}})[_0x4588('0x28')](function(_0x1e2e70){return db[_0x4588('0x67')][_0x4588('0x68')](function(_0x465527){return _0x1e2e70[_0x4588('0x6d')](_0xa6e44[_0x4588('0x35')][_0x4588('0x63')],{'transaction':_0x465527})[_0x4588('0x28')](function(){if(!_['isEmpty'](_0xa18127)){return _0x1e2e70['removeAgents'](_0xa18127,{'transaction':_0x465527});}})[_0x4588('0x28')](function(){_0xa18127[_0x4588('0x6b')](function(_0x6005ef){socket['emit']('userMailQueue:remove',{'UserId':_0x6005ef,'MailQueueId':_0x1e2e70['id']});});});});});});})['then'](respondWithStatusCode(_0x1a98a1,null))[_0x4588('0x46')](handleError(_0x1a98a1,null));};exports[_0x4588('0x7e')]=function(_0x335384,_0x1ad7b5,_0x3892fa){return db[_0x4588('0x30')]['find']({'where':{'id':_0x335384[_0x4588('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1ad7b5,null))[_0x4588('0x28')](function(_0x44faa2){if(_0x44faa2){return _0x44faa2[_0x4588('0x7e')](_0x335384['body']['ids'],_[_0x4588('0x7f')](_0x335384[_0x4588('0x4b')],[_0x4588('0x63'),'id'])||{})[_0x4588('0x80')](function(_0x3a353c){for(var _0x2bee32=0x0;_0x2bee32<_0x335384[_0x4588('0x4b')][_0x4588('0x63')][_0x4588('0x3b')];_0x2bee32+=0x1){socket[_0x4588('0x81')](_0x4588('0x6c'),{'UserId':Number(_0x335384[_0x4588('0x4b')][_0x4588('0x63')][_0x2bee32]),'MailQueueId':Number(_0x335384['params']['id'])});}return _0x3a353c;});}})[_0x4588('0x28')](respondWithResult(_0x1ad7b5,null))['catch'](handleError(_0x1ad7b5,null));};exports[_0x4588('0x82')]=function(_0x358354,_0x456356,_0x17c4b2){return db['MailQueue'][_0x4588('0x49')]({'where':{'id':_0x358354['params']['id']}})[_0x4588('0x28')](handleEntityNotFound(_0x456356,null))[_0x4588('0x28')](function(_0x1342bd){if(_0x1342bd){return _0x1342bd[_0x4588('0x82')](_0x358354['query'][_0x4588('0x63')])[_0x4588('0x28')](function(){if(_[_0x4588('0x83')](_0x358354[_0x4588('0x35')][_0x4588('0x63')])){for(var _0x5b43fa=0x0;_0x5b43fa<_0x358354[_0x4588('0x35')][_0x4588('0x63')][_0x4588('0x3b')];_0x5b43fa+=0x1){socket[_0x4588('0x81')](_0x4588('0x84'),{'UserId':Number(_0x358354[_0x4588('0x35')]['ids'][_0x5b43fa]),'MailQueueId':Number(_0x358354['params']['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x358354[_0x4588('0x35')]['ids']),'MailQueueId':Number(_0x358354[_0x4588('0x4f')]['id'])});}});}})[_0x4588('0x28')](respondWithStatusCode(_0x456356,null))[_0x4588('0x46')](handleError(_0x456356,null));};exports[_0x4588('0x85')]=function(_0x3ba5d6,_0x5b8450,_0x2ca333){var _0x4d5db4={};var _0xa2ce02={};var _0x2dd726;var _0x568761;return db[_0x4588('0x30')][_0x4588('0x52')]({'where':{'id':_0x3ba5d6[_0x4588('0x4f')]['id']}})[_0x4588('0x28')](handleEntityNotFound(_0x5b8450,null))[_0x4588('0x28')](function(_0x2b9d77){if(_0x2b9d77){_0x2dd726=_0x2b9d77;_0xa2ce02[_0x4588('0x34')]=_[_0x4588('0x36')](db[_0x4588('0x59')][_0x4588('0x31')]);_0xa2ce02['query']=_['keys'](_0x3ba5d6[_0x4588('0x35')]);_0xa2ce02['filters']=_[_0x4588('0x39')](_0xa2ce02[_0x4588('0x34')],_0xa2ce02[_0x4588('0x35')]);_0x4d5db4[_0x4588('0x38')]=_[_0x4588('0x39')](_0xa2ce02[_0x4588('0x34')],qs[_0x4588('0x3a')](_0x3ba5d6['query'][_0x4588('0x3a')]));_0x4d5db4['attributes']=_0x4d5db4[_0x4588('0x38')][_0x4588('0x3b')]?_0x4d5db4[_0x4588('0x38')]:_0xa2ce02[_0x4588('0x34')];_0x4d5db4[_0x4588('0x56')]=qs[_0x4588('0x3c')](_0x3ba5d6[_0x4588('0x35')][_0x4588('0x3c')]);_0x4d5db4[_0x4588('0x3d')]=qs[_0x4588('0x37')](_[_0x4588('0x3e')](_0x3ba5d6[_0x4588('0x35')],_0xa2ce02[_0x4588('0x37')]));if(_0x3ba5d6[_0x4588('0x35')][_0x4588('0x3f')]){_0x4d5db4['where']=_[_0x4588('0x48')](_0x4d5db4[_0x4588('0x3d')],{'$or':_['map'](_0x4d5db4[_0x4588('0x38')],function(_0x5807a3){var _0x112bef={};_0x112bef[_0x5807a3]={'$like':'%'+_0x3ba5d6[_0x4588('0x35')]['filter']+'%'};return _0x112bef;})});}_0x4d5db4=_['merge']({},_0x4d5db4,_0x3ba5d6[_0x4588('0x42')]);return _0x2dd726[_0x4588('0x85')](_0x4d5db4);}})['then'](function(_0x1d9ace){if(_0x1d9ace){_0x568761=_0x1d9ace[_0x4588('0x3b')];if(!_0x3ba5d6['query']['hasOwnProperty'](_0x4588('0x55'))){_0x4d5db4['limit']=qs['limit'](_0x3ba5d6['query']['limit']);_0x4d5db4[_0x4588('0x23')]=qs['offset'](_0x3ba5d6[_0x4588('0x35')][_0x4588('0x23')]);}return _0x2dd726[_0x4588('0x85')](_0x4d5db4);}})['then'](function(_0xf108aa){if(_0xf108aa){return _0xf108aa?{'count':_0x568761,'rows':_0xf108aa}:null;}})[_0x4588('0x28')](respondWithResult(_0x5b8450,null))[_0x4588('0x46')](handleError(_0x5b8450,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 6490603..99d4f4c 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 _0x81ef=['exports','MailQueue','update','emit'];(function(_0x49ba4b,_0x21f692){var _0x593a2d=function(_0x5739c7){while(--_0x5739c7){_0x49ba4b['push'](_0x49ba4b['shift']());}};_0x593a2d(++_0x21f692);}(_0x81ef,0x199));var _0xf81e=function(_0x408e45,_0x3a06da){_0x408e45=_0x408e45-0x0;var _0x23094f=_0x81ef[_0x408e45];return _0x23094f;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0xf81e('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf81e('0x1'),'afterDestroy':'remove'};function emitEvent(_0xde656e){return function(_0x71bde8,_0xe41ee5,_0xef2bf8){MailQueueEvents[_0xf81e('0x2')](_0xde656e+':'+_0x71bde8['id'],_0x71bde8);MailQueueEvents['emit'](_0xde656e,_0x71bde8);_0xef2bf8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xf81e('0x3')]=MailQueueEvents; \ No newline at end of file +var _0xd9ab=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0xd9ab,0x12e));var _0xbd9a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd9ab[_0x465028];return _0xb783d4;};'use strict';var EventEmitter=require(_0xbd9a('0x0'));var MailQueue=require(_0xbd9a('0x1'))['db'][_0xbd9a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbd9a('0x3')](0x0);var events={'afterCreate':_0xbd9a('0x4'),'afterUpdate':_0xbd9a('0x5'),'afterDestroy':_0xbd9a('0x6')};function emitEvent(_0x444ff5){return function(_0x1dc216,_0x11f843,_0x5dce8b){MailQueueEvents['emit'](_0x444ff5+':'+_0x1dc216['id'],_0x1dc216);MailQueueEvents['emit'](_0x444ff5,_0x1dc216);_0x5dce8b(null);};}for(var e in events){if(events[_0xbd9a('0x7')](e)){var event=events[e];MailQueue[_0xbd9a('0x8')](e,emitEvent(event));}}module[_0xbd9a('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 0921292..367e14d 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 _0x535e=['api','moment','bluebird','path','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger'];(function(_0x11dfe1,_0x1eb152){var _0x2e5988=function(_0x49bd6a){while(--_0x49bd6a){_0x11dfe1['push'](_0x11dfe1['shift']());}};_0x2e5988(++_0x1eb152);}(_0x535e,0x129));var _0xe535=function(_0x4e7b37,_0x33b1fa){_0x4e7b37=_0x4e7b37-0x0;var _0x20b707=_0x535e[_0x4e7b37];return _0x20b707;};'use strict';var _=require(_0xe535('0x0'));var util=require(_0xe535('0x1'));var logger=require(_0xe535('0x2'))(_0xe535('0x3'));var moment=require(_0xe535('0x4'));var BPromise=require(_0xe535('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe535('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe535('0x7'));module[_0xe535('0x8')]=function(_0xd0f239,_0x11046d){return _0xd0f239[_0xe535('0x9')](_0xe535('0xa'),attributes,{'tableName':_0xe535('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8ce=['mail_queues','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x4eb45f,_0x52875c){var _0x466297=function(_0x4f314){while(--_0x4f314){_0x4eb45f['push'](_0x4eb45f['shift']());}};_0x466297(++_0x52875c);}(_0xf8ce,0x85));var _0xef8c=function(_0x4024e7,_0xef7fb2){_0x4024e7=_0x4024e7-0x0;var _0x47352c=_0xf8ce[_0x4024e7];return _0x47352c;};'use strict';var _=require(_0xef8c('0x0'));var util=require(_0xef8c('0x1'));var logger=require(_0xef8c('0x2'))('api');var moment=require(_0xef8c('0x3'));var BPromise=require(_0xef8c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef8c('0x5'));var rimraf=require('rimraf');var config=require(_0xef8c('0x6'));var attributes=require(_0xef8c('0x7'));module[_0xef8c('0x8')]=function(_0x58368d,_0x39baea){return _0x58368d[_0xef8c('0x9')]('MailQueue',attributes,{'tableName':_0xef8c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 2dfb2f1..3af3297 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 _0xe148=['model','attributes','info','stringify','ShowMailQueue','MailQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMailQueue','findAll','raw','options','where','limit','include','map'];(function(_0x586998,_0xc9fd34){var _0x1c882d=function(_0x48b3e8){while(--_0x48b3e8){_0x586998['push'](_0x586998['shift']());}};_0x1c882d(++_0xc9fd34);}(_0xe148,0x109));var _0x8e14=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0xe148[_0x4f0e62];return _0x117ab8;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var moment=require(_0x8e14('0x2'));var BPromise=require(_0x8e14('0x3'));var rs=require(_0x8e14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8e14('0x5'));var logger=require(_0x8e14('0x6'))(_0x8e14('0x7'));var config=require(_0x8e14('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x8e14('0x9')]=_[_0x8e14('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8e14('0xb'))(new Redis(config['redis']));require(_0x8e14('0xc'))[_0x8e14('0xd')](socket);function respondWithRpcPromise(_0x35faf7,_0x1a1029,_0x163db3){return new BPromise(function(_0x472ee6,_0x1c1a69){return client[_0x8e14('0xe')](_0x35faf7,_0x163db3)['then'](function(_0x368d80){logger['info'](_0x8e14('0xf'),_0x1a1029,_0x8e14('0x10'));logger[_0x8e14('0x11')](_0x8e14('0x12'),_0x1a1029,_0x8e14('0x10'),JSON['stringify'](_0x368d80));if(_0x368d80[_0x8e14('0x13')]){if(_0x368d80[_0x8e14('0x13')][_0x8e14('0x14')]===0x1f4){logger[_0x8e14('0x13')]('MailQueue,\x20%s,\x20%s',_0x1a1029,_0x368d80[_0x8e14('0x13')]['message']);return _0x1c1a69(_0x368d80[_0x8e14('0x13')][_0x8e14('0x15')]);}logger[_0x8e14('0x13')](_0x8e14('0xf'),_0x1a1029,_0x368d80[_0x8e14('0x13')]['message']);return _0x472ee6(_0x368d80['error'][_0x8e14('0x15')]);}else{logger['info'](_0x8e14('0xf'),_0x1a1029,'request\x20sent');_0x472ee6(_0x368d80['result'][_0x8e14('0x15')]);}})[_0x8e14('0x16')](function(_0x3b5801){logger[_0x8e14('0x13')]('MailQueue,\x20%s,\x20%s',_0x1a1029,_0x3b5801);_0x1c1a69(_0x3b5801);});});}exports[_0x8e14('0x17')]=function(_0x3b2315){var _0x36891e=this;return new Promise(function(_0x5b3287,_0x5ea351){return db['MailQueue'][_0x8e14('0x18')]({'raw':_0x3b2315['options']?_0x3b2315['options'][_0x8e14('0x19')]===undefined?!![]:![]:!![],'where':_0x3b2315[_0x8e14('0x1a')]?_0x3b2315[_0x8e14('0x1a')][_0x8e14('0x1b')]||null:null,'attributes':_0x3b2315[_0x8e14('0x1a')]?_0x3b2315['options']['attributes']||null:null,'limit':_0x3b2315[_0x8e14('0x1a')]?_0x3b2315[_0x8e14('0x1a')][_0x8e14('0x1c')]||null:null,'include':_0x3b2315[_0x8e14('0x1a')]?_0x3b2315[_0x8e14('0x1a')][_0x8e14('0x1d')]?_[_0x8e14('0x1e')](_0x3b2315['options'][_0x8e14('0x1d')],function(_0xff90ed){return{'model':db[_0xff90ed[_0x8e14('0x1f')]],'as':_0xff90ed['as'],'attributes':_0xff90ed['attributes'],'include':_0xff90ed[_0x8e14('0x1d')]?_[_0x8e14('0x1e')](_0xff90ed[_0x8e14('0x1d')],function(_0x2aacb6){return{'model':db[_0x2aacb6[_0x8e14('0x1f')]],'as':_0x2aacb6['as'],'attributes':_0x2aacb6['attributes'],'include':_0x2aacb6['include']?_[_0x8e14('0x1e')](_0x2aacb6[_0x8e14('0x1d')],function(_0x543d6a){return{'model':db[_0x543d6a[_0x8e14('0x1f')]],'as':_0x543d6a['as'],'attributes':_0x543d6a[_0x8e14('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x563249){logger[_0x8e14('0x21')]('GetMailQueue',_0x3b2315);logger[_0x8e14('0x11')](_0x8e14('0x17'),_0x3b2315,JSON[_0x8e14('0x22')](_0x563249));_0x5b3287(_0x563249);})[_0x8e14('0x16')](function(_0x2b9ebe){logger[_0x8e14('0x13')](_0x8e14('0x17'),_0x2b9ebe[_0x8e14('0x15')],_0x3b2315);_0x5ea351(_0x36891e[_0x8e14('0x13')](0x1f4,_0x2b9ebe[_0x8e14('0x15')]));});});};exports[_0x8e14('0x23')]=function(_0xdb36d6){var _0x222544=this;return new Promise(function(_0xb4e1d1,_0x1462b8){return db[_0x8e14('0x24')]['find']({'raw':_0xdb36d6[_0x8e14('0x1a')]?_0xdb36d6[_0x8e14('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xdb36d6[_0x8e14('0x1a')]?_0xdb36d6[_0x8e14('0x1a')][_0x8e14('0x1b')]||null:null,'attributes':_0xdb36d6[_0x8e14('0x1a')]?_0xdb36d6[_0x8e14('0x1a')][_0x8e14('0x20')]||null:null,'include':_0xdb36d6[_0x8e14('0x1a')]?_0xdb36d6['options'][_0x8e14('0x1d')]?_[_0x8e14('0x1e')](_0xdb36d6['options'][_0x8e14('0x1d')],function(_0x58eca7){return{'model':db[_0x58eca7[_0x8e14('0x1f')]],'as':_0x58eca7['as'],'attributes':_0x58eca7['attributes'],'include':_0x58eca7[_0x8e14('0x1d')]?_[_0x8e14('0x1e')](_0x58eca7[_0x8e14('0x1d')],function(_0x2550dd){return{'model':db[_0x2550dd[_0x8e14('0x1f')]],'as':_0x2550dd['as'],'attributes':_0x2550dd[_0x8e14('0x20')],'include':_0x2550dd[_0x8e14('0x1d')]?_[_0x8e14('0x1e')](_0x2550dd[_0x8e14('0x1d')],function(_0x8f4afc){return{'model':db[_0x8f4afc['model']],'as':_0x8f4afc['as'],'attributes':_0x8f4afc[_0x8e14('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ad08a){logger[_0x8e14('0x21')](_0x8e14('0x23'),_0xdb36d6);logger[_0x8e14('0x11')](_0x8e14('0x23'),_0xdb36d6,JSON[_0x8e14('0x22')](_0x2ad08a));_0xb4e1d1(_0x2ad08a);})[_0x8e14('0x16')](function(_0x289dbf){logger['error'](_0x8e14('0x23'),_0x289dbf[_0x8e14('0x15')],_0xdb36d6);_0x1462b8(_0x222544[_0x8e14('0x13')](0x1f4,_0x289dbf['message']));});});}; \ No newline at end of file +var _0xeb55=['request\x20sent','stringify','error','code','message','info','catch','GetMailQueue','options','where','include','map','model','attributes','then','debug','ShowMailQueue','MailQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','localhost','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s'];(function(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0xeb55,0x1cd));var _0x5eb5=function(_0x5ab784,_0x21eced){_0x5ab784=_0x5ab784-0x0;var _0x411d65=_0xeb55[_0x5ab784];return _0x411d65;};'use strict';var _=require(_0x5eb5('0x0'));var util=require(_0x5eb5('0x1'));var moment=require(_0x5eb5('0x2'));var BPromise=require('bluebird');var rs=require(_0x5eb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5eb5('0x4'))['db'];var utils=require(_0x5eb5('0x5'));var logger=require('../../config/logger')(_0x5eb5('0x6'));var config=require('../../config/environment');var jayson=require(_0x5eb5('0x7'));var client=jayson[_0x5eb5('0x8')]['http']({'port':0x232a});config[_0x5eb5('0x9')]=_['defaults'](config[_0x5eb5('0x9')],{'host':_0x5eb5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5eb5('0x9')]));require(_0x5eb5('0xb'))[_0x5eb5('0xc')](socket);function respondWithRpcPromise(_0x2dc62c,_0x57ab7c,_0x19d07d){return new BPromise(function(_0x4a961c,_0x352730){return client[_0x5eb5('0xd')](_0x2dc62c,_0x19d07d)['then'](function(_0x3c1641){logger['info'](_0x5eb5('0xe'),_0x57ab7c,_0x5eb5('0xf'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x57ab7c,_0x5eb5('0xf'),JSON[_0x5eb5('0x10')](_0x3c1641));if(_0x3c1641[_0x5eb5('0x11')]){if(_0x3c1641[_0x5eb5('0x11')][_0x5eb5('0x12')]===0x1f4){logger[_0x5eb5('0x11')](_0x5eb5('0xe'),_0x57ab7c,_0x3c1641[_0x5eb5('0x11')][_0x5eb5('0x13')]);return _0x352730(_0x3c1641[_0x5eb5('0x11')][_0x5eb5('0x13')]);}logger[_0x5eb5('0x11')]('MailQueue,\x20%s,\x20%s',_0x57ab7c,_0x3c1641[_0x5eb5('0x11')][_0x5eb5('0x13')]);return _0x4a961c(_0x3c1641['error']['message']);}else{logger[_0x5eb5('0x14')](_0x5eb5('0xe'),_0x57ab7c,_0x5eb5('0xf'));_0x4a961c(_0x3c1641['result'][_0x5eb5('0x13')]);}})[_0x5eb5('0x15')](function(_0x30c8e5){logger[_0x5eb5('0x11')](_0x5eb5('0xe'),_0x57ab7c,_0x30c8e5);_0x352730(_0x30c8e5);});});}exports[_0x5eb5('0x16')]=function(_0x671f4d){var _0x5d3e9a=this;return new Promise(function(_0x152d5b,_0x3f01c4){return db['MailQueue']['findAll']({'raw':_0x671f4d[_0x5eb5('0x17')]?_0x671f4d['options']['raw']===undefined?!![]:![]:!![],'where':_0x671f4d['options']?_0x671f4d[_0x5eb5('0x17')][_0x5eb5('0x18')]||null:null,'attributes':_0x671f4d['options']?_0x671f4d['options']['attributes']||null:null,'limit':_0x671f4d['options']?_0x671f4d[_0x5eb5('0x17')]['limit']||null:null,'include':_0x671f4d[_0x5eb5('0x17')]?_0x671f4d[_0x5eb5('0x17')][_0x5eb5('0x19')]?_[_0x5eb5('0x1a')](_0x671f4d[_0x5eb5('0x17')][_0x5eb5('0x19')],function(_0x52e8d7){return{'model':db[_0x52e8d7[_0x5eb5('0x1b')]],'as':_0x52e8d7['as'],'attributes':_0x52e8d7[_0x5eb5('0x1c')],'include':_0x52e8d7[_0x5eb5('0x19')]?_[_0x5eb5('0x1a')](_0x52e8d7[_0x5eb5('0x19')],function(_0x4b8d8a){return{'model':db[_0x4b8d8a[_0x5eb5('0x1b')]],'as':_0x4b8d8a['as'],'attributes':_0x4b8d8a['attributes'],'include':_0x4b8d8a[_0x5eb5('0x19')]?_[_0x5eb5('0x1a')](_0x4b8d8a[_0x5eb5('0x19')],function(_0xad500c){return{'model':db[_0xad500c[_0x5eb5('0x1b')]],'as':_0xad500c['as'],'attributes':_0xad500c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5eb5('0x1d')](function(_0x8ce798){logger['info']('GetMailQueue',_0x671f4d);logger[_0x5eb5('0x1e')](_0x5eb5('0x16'),_0x671f4d,JSON[_0x5eb5('0x10')](_0x8ce798));_0x152d5b(_0x8ce798);})[_0x5eb5('0x15')](function(_0x2a5eca){logger[_0x5eb5('0x11')](_0x5eb5('0x16'),_0x2a5eca[_0x5eb5('0x13')],_0x671f4d);_0x3f01c4(_0x5d3e9a[_0x5eb5('0x11')](0x1f4,_0x2a5eca[_0x5eb5('0x13')]));});});};exports[_0x5eb5('0x1f')]=function(_0x33f86b){var _0x4ff33f=this;return new Promise(function(_0x2c9994,_0x11ca98){return db[_0x5eb5('0x20')][_0x5eb5('0x21')]({'raw':_0x33f86b[_0x5eb5('0x17')]?_0x33f86b['options']['raw']===undefined?!![]:![]:!![],'where':_0x33f86b[_0x5eb5('0x17')]?_0x33f86b[_0x5eb5('0x17')][_0x5eb5('0x18')]||null:null,'attributes':_0x33f86b[_0x5eb5('0x17')]?_0x33f86b[_0x5eb5('0x17')][_0x5eb5('0x1c')]||null:null,'include':_0x33f86b[_0x5eb5('0x17')]?_0x33f86b[_0x5eb5('0x17')][_0x5eb5('0x19')]?_[_0x5eb5('0x1a')](_0x33f86b['options'][_0x5eb5('0x19')],function(_0x48a8fb){return{'model':db[_0x48a8fb[_0x5eb5('0x1b')]],'as':_0x48a8fb['as'],'attributes':_0x48a8fb[_0x5eb5('0x1c')],'include':_0x48a8fb[_0x5eb5('0x19')]?_[_0x5eb5('0x1a')](_0x48a8fb['include'],function(_0x2ae79b){return{'model':db[_0x2ae79b[_0x5eb5('0x1b')]],'as':_0x2ae79b['as'],'attributes':_0x2ae79b[_0x5eb5('0x1c')],'include':_0x2ae79b[_0x5eb5('0x19')]?_[_0x5eb5('0x1a')](_0x2ae79b[_0x5eb5('0x19')],function(_0x30c90a){return{'model':db[_0x30c90a[_0x5eb5('0x1b')]],'as':_0x30c90a['as'],'attributes':_0x30c90a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x7e0b9b){logger[_0x5eb5('0x14')](_0x5eb5('0x1f'),_0x33f86b);logger['debug'](_0x5eb5('0x1f'),_0x33f86b,JSON[_0x5eb5('0x10')](_0x7e0b9b));_0x2c9994(_0x7e0b9b);})[_0x5eb5('0x15')](function(_0x4d96b2){logger[_0x5eb5('0x11')](_0x5eb5('0x1f'),_0x4d96b2[_0x5eb5('0x13')],_0x33f86b);_0x11ca98(_0x4ff33f[_0x5eb5('0x11')](0x1f4,_0x4d96b2[_0x5eb5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 35529f3..d3548e5 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 _0x5630=['save','remove','emit','removeListener','register','length','./mailQueue.events'];(function(_0xb285d4,_0x1c96e8){var _0x133d09=function(_0x20f049){while(--_0x20f049){_0xb285d4['push'](_0xb285d4['shift']());}};_0x133d09(++_0x1c96e8);}(_0x5630,0xc3));var _0x0563=function(_0x1cccb1,_0x1fad25){_0x1cccb1=_0x1cccb1-0x0;var _0x359a3d=_0x5630[_0x1cccb1];return _0x359a3d;};'use strict';var MailQueueEvents=require(_0x0563('0x0'));var events=[_0x0563('0x1'),_0x0563('0x2'),'update'];function createListener(_0x563eb6,_0x5ee5df){return function(_0x200b21){_0x5ee5df[_0x0563('0x3')](_0x563eb6,_0x200b21);};}function removeListener(_0xc4ca6d,_0x155679){return function(){MailQueueEvents[_0x0563('0x4')](_0xc4ca6d,_0x155679);};}exports[_0x0563('0x5')]=function(_0x4f1552){for(var _0x5712df=0x0,_0x3661bb=events[_0x0563('0x6')];_0x5712df<_0x3661bb;_0x5712df++){var _0x31159c=events[_0x5712df];var _0x85e3ed=createListener('mailQueue:'+_0x31159c,_0x4f1552);MailQueueEvents['on'](_0x31159c,_0x85e3ed);}}; \ No newline at end of file +var _0xad59=['remove','update','emit','removeListener','register','mailQueue:','./mailQueue.events'];(function(_0x4a926d,_0x2302fc){var _0x530c54=function(_0x5b4c9b){while(--_0x5b4c9b){_0x4a926d['push'](_0x4a926d['shift']());}};_0x530c54(++_0x2302fc);}(_0xad59,0x84));var _0x9ad5=function(_0x249bbe,_0x2731b7){_0x249bbe=_0x249bbe-0x0;var _0x4fbb54=_0xad59[_0x249bbe];return _0x4fbb54;};'use strict';var MailQueueEvents=require(_0x9ad5('0x0'));var events=['save',_0x9ad5('0x1'),_0x9ad5('0x2')];function createListener(_0x5c4ada,_0x623f21){return function(_0x9b3bad){_0x623f21[_0x9ad5('0x3')](_0x5c4ada,_0x9b3bad);};}function removeListener(_0x4d53c9,_0x1bb54e){return function(){MailQueueEvents[_0x9ad5('0x4')](_0x4d53c9,_0x1bb54e);};}exports[_0x9ad5('0x5')]=function(_0x3685bc){for(var _0x56d3d6=0x0,_0x7f0640=events['length'];_0x56d3d6<_0x7f0640;_0x56d3d6++){var _0x29f859=events[_0x56d3d6];var _0x21e8d5=createListener(_0x9ad5('0x6')+_0x29f859,_0x3685bc);MailQueueEvents['on'](_0x29f859,_0x21e8d5);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4a6a844..04d20c7 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 _0x02dc=['../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x645bd9,_0x35aeb4){var _0x2cdc11=function(_0x496a94){while(--_0x496a94){_0x645bd9['push'](_0x645bd9['shift']());}};_0x2cdc11(++_0x35aeb4);}(_0x02dc,0x1b1));var _0xc02d=function(_0x108374,_0x1a6483){_0x108374=_0x108374-0x0;var _0x2c00a3=_0x02dc[_0x108374];return _0x2c00a3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc02d('0x0'));var express=require('express');var router=express[_0xc02d('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xc02d('0x2'));var interaction=require(_0xc02d('0x3'));var config=require(_0xc02d('0x4'));var controller=require(_0xc02d('0x5'));router[_0xc02d('0x6')]('/',auth['isAuthenticated'](),controller[_0xc02d('0x7')]);router[_0xc02d('0x6')](_0xc02d('0x8'),auth[_0xc02d('0x9')](),controller[_0xc02d('0xa')]);router[_0xc02d('0x6')](_0xc02d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc02d('0xc')]('/',auth['isAuthenticated'](),controller[_0xc02d('0xd')]);router[_0xc02d('0xe')](_0xc02d('0xb'),auth[_0xc02d('0x9')](),controller[_0xc02d('0xf')]);router[_0xc02d('0x10')](_0xc02d('0xb'),auth['isAuthenticated'](),controller[_0xc02d('0x11')]);module[_0xc02d('0x12')]=router; \ No newline at end of file +var _0xdc0d=['path','Router','fs-extra','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x4a94cc,_0xdc1e09){var _0x2dd244=function(_0x42cde0){while(--_0x42cde0){_0x4a94cc['push'](_0x4a94cc['shift']());}};_0x2dd244(++_0xdc1e09);}(_0xdc0d,0x152));var _0xddc0=function(_0x55464c,_0x8b0ab8){_0x55464c=_0x55464c-0x0;var _0x3de12b=_0xdc0d[_0x55464c];return _0x3de12b;};'use strict';var multer=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var path=require(_0xddc0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xddc0('0x3')]();var fs_extra=require(_0xddc0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xddc0('0x5'));var controller=require(_0xddc0('0x6'));router[_0xddc0('0x7')]('/',auth[_0xddc0('0x8')](),controller['index']);router[_0xddc0('0x7')](_0xddc0('0x9'),auth[_0xddc0('0x8')](),controller['describe']);router[_0xddc0('0x7')](_0xddc0('0xa'),auth[_0xddc0('0x8')](),controller[_0xddc0('0xb')]);router[_0xddc0('0xc')]('/',auth[_0xddc0('0x8')](),controller[_0xddc0('0xd')]);router[_0xddc0('0xe')](_0xddc0('0xa'),auth[_0xddc0('0x8')](),controller[_0xddc0('0xf')]);router['delete'](_0xddc0('0xa'),auth[_0xddc0('0x8')](),controller['destroy']);module[_0xddc0('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 201f0c1..bbd7ea2 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 _0xc7d0=['sequelize','exports','STRING','DATE','moment'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0xc7d0,0x130));var _0x0c7d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc7d0[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0x0c7d('0x0'));var Sequelize=require(_0x0c7d('0x1'));module[_0x0c7d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0c7d('0x3')]},'joinAt':{'type':Sequelize[_0x0c7d('0x4')]},'leaveAt':{'type':Sequelize[_0x0c7d('0x4')]},'acceptAt':{'type':Sequelize[_0x0c7d('0x4')]},'exitAt':{'type':Sequelize[_0x0c7d('0x4')]},'reason':{'type':Sequelize[_0x0c7d('0x3')]}}; \ No newline at end of file +var _0x75eb=['moment','exports','STRING','DATE'];(function(_0x1d6a01,_0x5ca255){var _0x35cb44=function(_0x41d998){while(--_0x41d998){_0x1d6a01['push'](_0x1d6a01['shift']());}};_0x35cb44(++_0x5ca255);}(_0x75eb,0x130));var _0xb75e=function(_0x2d3aed,_0x1b36e5){_0x2d3aed=_0x2d3aed-0x0;var _0x57fb4e=_0x75eb[_0x2d3aed];return _0x57fb4e;};'use strict';var moment=require(_0xb75e('0x0'));var Sequelize=require('sequelize');module[_0xb75e('0x1')]={'uniqueid':{'type':Sequelize[_0xb75e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb75e('0x2')]},'joinAt':{'type':Sequelize[_0xb75e('0x3')]},'leaveAt':{'type':Sequelize[_0xb75e('0x3')]},'acceptAt':{'type':Sequelize[_0xb75e('0x3')]},'exitAt':{'type':Sequelize[_0xb75e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index fa120f3..930df69 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 _0xd4a2=['describe','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','MailQueueReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body'];(function(_0x29a958,_0xa6ed30){var _0x3378b1=function(_0x981ac9){while(--_0x981ac9){_0x29a958['push'](_0x29a958['shift']());}};_0x3378b1(++_0xa6ed30);}(_0xd4a2,0x173));var _0x2d4a=function(_0x419fbf,_0xd13bf3){_0x419fbf=_0x419fbf-0x0;var _0x34c1bc=_0xd4a2[_0x419fbf];return _0x34c1bc;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];function respondWithStatusCode(_0x45b9fb,_0x5ac803){_0x5ac803=_0x5ac803||0xcc;return function(_0x2f785f){if(_0x2f785f){return _0x45b9fb[_0x2d4a('0x17')](_0x5ac803);}return _0x45b9fb[_0x2d4a('0x18')](_0x5ac803)[_0x2d4a('0x19')]();};}function respondWithResult(_0x544622,_0x4be8b4){_0x4be8b4=_0x4be8b4||0xc8;return function(_0x2a1d0f){if(_0x2a1d0f){return _0x544622['status'](_0x4be8b4)[_0x2d4a('0x1a')](_0x2a1d0f);}};}function respondWithFilteredResult(_0x175bda,_0x11896d){return function(_0x3a3156){if(_0x3a3156){var _0x4c5287=typeof _0x11896d[_0x2d4a('0x1b')]==='undefined'&&typeof _0x11896d[_0x2d4a('0x1c')]==='undefined';var _0x435687=_0x3a3156[_0x2d4a('0x1d')];var _0x2188b2=_0x4c5287?0x0:_0x11896d[_0x2d4a('0x1b')];var _0x498956=_0x4c5287?_0x3a3156['count']:_0x11896d['offset']+_0x11896d[_0x2d4a('0x1c')];var _0x1966d1;if(_0x498956>=_0x435687){_0x498956=_0x435687;_0x1966d1=0xc8;}else{_0x1966d1=0xce;}_0x175bda[_0x2d4a('0x18')](_0x1966d1);return _0x175bda[_0x2d4a('0x1e')](_0x2d4a('0x1f'),_0x2188b2+'-'+_0x498956+'/'+_0x435687)[_0x2d4a('0x1a')](_0x3a3156);}return null;};}function patchUpdates(_0x56445a){return function(_0x49f378){try{jsonpatch[_0x2d4a('0x20')](_0x49f378,_0x56445a,!![]);}catch(_0x1f3e17){return BPromise[_0x2d4a('0x21')](_0x1f3e17);}return _0x49f378[_0x2d4a('0x22')]();};}function saveUpdates(_0x1a2d20,_0x2e7736){return function(_0x22dd0b){if(_0x22dd0b){return _0x22dd0b[_0x2d4a('0x23')](_0x1a2d20)['then'](function(_0x26e7b8){return _0x26e7b8;});}return null;};}function removeEntity(_0x3240a2,_0x2c3799){return function(_0x42d813){if(_0x42d813){return _0x42d813[_0x2d4a('0x24')]()[_0x2d4a('0x25')](function(){_0x3240a2[_0x2d4a('0x18')](0xcc)[_0x2d4a('0x19')]();});}};}function handleEntityNotFound(_0x54c910,_0x544b9b){return function(_0x5cc7d8){if(!_0x5cc7d8){_0x54c910[_0x2d4a('0x17')](0x194);}return _0x5cc7d8;};}function handleError(_0x5029f3,_0x410f7d){_0x410f7d=_0x410f7d||0x1f4;return function(_0x3a2fd3){logger[_0x2d4a('0x26')](_0x3a2fd3[_0x2d4a('0x27')]);if(_0x3a2fd3[_0x2d4a('0x28')]){delete _0x3a2fd3[_0x2d4a('0x28')];}_0x5029f3[_0x2d4a('0x18')](_0x410f7d)[_0x2d4a('0x29')](_0x3a2fd3);};}exports['index']=function(_0x436f53,_0x5ce262){var _0x221602={},_0x9bac28={},_0xc497ce={'count':0x0,'rows':[]};var _0x20b87d=_[_0x2d4a('0x2a')](db[_0x2d4a('0x2b')][_0x2d4a('0x2c')],function(_0x2e8063){return{'name':_0x2e8063['fieldName'],'type':_0x2e8063[_0x2d4a('0x2d')][_0x2d4a('0x2e')]};});_0x9bac28[_0x2d4a('0x2f')]=_[_0x2d4a('0x2a')](_0x20b87d,_0x2d4a('0x28'));_0x9bac28['query']=_[_0x2d4a('0x30')](_0x436f53[_0x2d4a('0x31')]);_0x9bac28[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],_0x9bac28['query']);_0x221602[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],qs[_0x2d4a('0x35')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x35')]));_0x221602['attributes']=_0x221602[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x221602[_0x2d4a('0x34')]:_0x9bac28[_0x2d4a('0x2f')];if(!_0x436f53[_0x2d4a('0x31')]['hasOwnProperty'](_0x2d4a('0x37'))){_0x221602[_0x2d4a('0x1c')]=qs['limit'](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1c')]);_0x221602[_0x2d4a('0x1b')]=qs[_0x2d4a('0x1b')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1b')]);}_0x221602['order']=qs[_0x2d4a('0x38')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x38')]);_0x221602[_0x2d4a('0x39')]=qs[_0x2d4a('0x32')](_[_0x2d4a('0x3a')](_0x436f53['query'],_0x9bac28['filters']),_0x20b87d);if(_0x436f53[_0x2d4a('0x31')]['filter']){_0x221602[_0x2d4a('0x39')]=_[_0x2d4a('0x3b')](_0x221602['where'],{'$or':_[_0x2d4a('0x2a')](_0x20b87d,function(_0x275598){if(_0x275598[_0x2d4a('0x2d')]!==_0x2d4a('0x3c')){var _0x67bce3={};_0x67bce3[_0x275598[_0x2d4a('0x28')]]={'$like':'%'+_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x3d')]+'%'};return _0x67bce3;}})});}_0x221602=_[_0x2d4a('0x3b')]({},_0x221602,_0x436f53[_0x2d4a('0x3e')]);var _0x3bb0cc={'where':_0x221602['where']};return db[_0x2d4a('0x2b')][_0x2d4a('0x1d')](_0x3bb0cc)[_0x2d4a('0x25')](function(_0x2f1635){_0xc497ce[_0x2d4a('0x1d')]=_0x2f1635;if(_0x436f53['query']['includeAll']){_0x221602['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x2d4a('0x3f')](_0x221602);})[_0x2d4a('0x25')](function(_0xf39020){_0xc497ce[_0x2d4a('0x40')]=_0xf39020;return _0xc497ce;})['then'](respondWithFilteredResult(_0x5ce262,_0x221602))[_0x2d4a('0x41')](handleError(_0x5ce262,null));};exports[_0x2d4a('0x42')]=function(_0x5e9704,_0x189d2a){var _0x13b0f0={'raw':!![],'where':{'id':_0x5e9704[_0x2d4a('0x43')]['id']}},_0x8a9375={};_0x8a9375[_0x2d4a('0x2f')]=_[_0x2d4a('0x30')](db['MailQueueReport'][_0x2d4a('0x2c')]);_0x8a9375[_0x2d4a('0x31')]=_[_0x2d4a('0x30')](_0x5e9704[_0x2d4a('0x31')]);_0x8a9375[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x8a9375['model'],_0x8a9375[_0x2d4a('0x31')]);_0x13b0f0[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x8a9375['model'],qs[_0x2d4a('0x35')](_0x5e9704['query'][_0x2d4a('0x35')]));_0x13b0f0[_0x2d4a('0x34')]=_0x13b0f0[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x13b0f0[_0x2d4a('0x34')]:_0x8a9375['model'];if(_0x5e9704['query'][_0x2d4a('0x44')]){_0x13b0f0[_0x2d4a('0x45')]=[{'all':!![]}];}_0x13b0f0=_['merge']({},_0x13b0f0,_0x5e9704[_0x2d4a('0x3e')]);return db['MailQueueReport'][_0x2d4a('0x46')](_0x13b0f0)[_0x2d4a('0x25')](handleEntityNotFound(_0x189d2a,null))[_0x2d4a('0x25')](respondWithResult(_0x189d2a,null))['catch'](handleError(_0x189d2a,null));};exports[_0x2d4a('0x47')]=function(_0x541b93,_0x3806b8){return db[_0x2d4a('0x2b')][_0x2d4a('0x47')](_0x541b93[_0x2d4a('0x48')],{})[_0x2d4a('0x25')](respondWithResult(_0x3806b8,0xc9))[_0x2d4a('0x41')](handleError(_0x3806b8,null));};exports[_0x2d4a('0x23')]=function(_0x2b2f4b,_0x1ffb96){if(_0x2b2f4b[_0x2d4a('0x48')]['id']){delete _0x2b2f4b[_0x2d4a('0x48')]['id'];}return db['MailQueueReport'][_0x2d4a('0x46')]({'where':{'id':_0x2b2f4b[_0x2d4a('0x43')]['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x1ffb96,null))[_0x2d4a('0x25')](saveUpdates(_0x2b2f4b[_0x2d4a('0x48')],null))['then'](respondWithResult(_0x1ffb96,null))[_0x2d4a('0x41')](handleError(_0x1ffb96,null));};exports[_0x2d4a('0x24')]=function(_0x2123e8,_0x440625){return db[_0x2d4a('0x2b')]['find']({'where':{'id':_0x2123e8['params']['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x440625,null))[_0x2d4a('0x25')](removeEntity(_0x440625,null))['catch'](handleError(_0x440625,null));};exports[_0x2d4a('0x49')]=function(_0x33f413,_0x7f0807){return db[_0x2d4a('0x2b')]['describe']()[_0x2d4a('0x25')](respondWithResult(_0x7f0807,null))['catch'](handleError(_0x7f0807,null));}; \ No newline at end of file +var _0x5204=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','error','stack','name','send','map','MailQueueReport','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','then','rows','params','keys','rawAttributes','catch','create','body','find','describe','eml-format','rimraf'];(function(_0x20e764,_0x19811d){var _0x4ebc22=function(_0x4d9bdf){while(--_0x4d9bdf){_0x20e764['push'](_0x20e764['shift']());}};_0x4ebc22(++_0x19811d);}(_0x5204,0xdf));var _0x4520=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0x5204[_0x27a3cb];return _0x54ff38;};'use strict';var emlformat=require(_0x4520('0x0'));var rimraf=require(_0x4520('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4520('0x2'));var rp=require(_0x4520('0x3'));var moment=require(_0x4520('0x4'));var BPromise=require(_0x4520('0x5'));var Mustache=require(_0x4520('0x6'));var util=require('util');var path=require(_0x4520('0x7'));var sox=require('sox');var csv=require(_0x4520('0x8'));var ejs=require(_0x4520('0x9'));var fs=require('fs');var fs_extra=require(_0x4520('0xa'));var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x8'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var hardwareService=require(_0x4520('0x14'));var logger=require(_0x4520('0x15'))(_0x4520('0x16'));var utils=require(_0x4520('0x17'));var config=require(_0x4520('0x18'));var licenseUtil=require(_0x4520('0x19'));var db=require(_0x4520('0x1a'))['db'];function respondWithStatusCode(_0x3c7a5d,_0x508ea6){_0x508ea6=_0x508ea6||0xcc;return function(_0x2e3c64){if(_0x2e3c64){return _0x3c7a5d[_0x4520('0x1b')](_0x508ea6);}return _0x3c7a5d[_0x4520('0x1c')](_0x508ea6)[_0x4520('0x1d')]();};}function respondWithResult(_0x426836,_0x34d383){_0x34d383=_0x34d383||0xc8;return function(_0x32950a){if(_0x32950a){return _0x426836['status'](_0x34d383)[_0x4520('0x1e')](_0x32950a);}};}function respondWithFilteredResult(_0x20de6b,_0x1ab841){return function(_0x15a31f){if(_0x15a31f){var _0x32d8aa=typeof _0x1ab841['offset']===_0x4520('0x1f')&&typeof _0x1ab841[_0x4520('0x20')]===_0x4520('0x1f');var _0x283ad4=_0x15a31f[_0x4520('0x21')];var _0x2e00f4=_0x32d8aa?0x0:_0x1ab841[_0x4520('0x22')];var _0x4ba69f=_0x32d8aa?_0x15a31f[_0x4520('0x21')]:_0x1ab841[_0x4520('0x22')]+_0x1ab841[_0x4520('0x20')];var _0x460521;if(_0x4ba69f>=_0x283ad4){_0x4ba69f=_0x283ad4;_0x460521=0xc8;}else{_0x460521=0xce;}_0x20de6b['status'](_0x460521);return _0x20de6b[_0x4520('0x23')]('Content-Range',_0x2e00f4+'-'+_0x4ba69f+'/'+_0x283ad4)['json'](_0x15a31f);}return null;};}function patchUpdates(_0x4c46c5){return function(_0x2b9456){try{jsonpatch['apply'](_0x2b9456,_0x4c46c5,!![]);}catch(_0x39e196){return BPromise[_0x4520('0x24')](_0x39e196);}return _0x2b9456[_0x4520('0x25')]();};}function saveUpdates(_0x534b15,_0x3199a9){return function(_0x4000d4){if(_0x4000d4){return _0x4000d4[_0x4520('0x26')](_0x534b15)['then'](function(_0x198c34){return _0x198c34;});}return null;};}function removeEntity(_0x847d15,_0x24eacd){return function(_0x3a4680){if(_0x3a4680){return _0x3a4680[_0x4520('0x27')]()['then'](function(){_0x847d15[_0x4520('0x1c')](0xcc)[_0x4520('0x1d')]();});}};}function handleEntityNotFound(_0x3532aa,_0x3e2906){return function(_0x57306b){if(!_0x57306b){_0x3532aa[_0x4520('0x1b')](0x194);}return _0x57306b;};}function handleError(_0x4602a4,_0x92168b){_0x92168b=_0x92168b||0x1f4;return function(_0x21e1f3){logger[_0x4520('0x28')](_0x21e1f3[_0x4520('0x29')]);if(_0x21e1f3[_0x4520('0x2a')]){delete _0x21e1f3[_0x4520('0x2a')];}_0x4602a4[_0x4520('0x1c')](_0x92168b)[_0x4520('0x2b')](_0x21e1f3);};}exports['index']=function(_0x222dbd,_0x5c1a0b){var _0x7ce8d2={},_0x14778a={},_0x43b4a2={'count':0x0,'rows':[]};var _0x157293=_[_0x4520('0x2c')](db[_0x4520('0x2d')]['rawAttributes'],function(_0x2c32ce){return{'name':_0x2c32ce['fieldName'],'type':_0x2c32ce[_0x4520('0x2e')]['key']};});_0x14778a[_0x4520('0x2f')]=_['map'](_0x157293,_0x4520('0x2a'));_0x14778a['query']=_['keys'](_0x222dbd[_0x4520('0x30')]);_0x14778a[_0x4520('0x31')]=_[_0x4520('0x32')](_0x14778a['model'],_0x14778a[_0x4520('0x30')]);_0x7ce8d2[_0x4520('0x33')]=_[_0x4520('0x32')](_0x14778a[_0x4520('0x2f')],qs['fields'](_0x222dbd['query'][_0x4520('0x34')]));_0x7ce8d2[_0x4520('0x33')]=_0x7ce8d2['attributes'][_0x4520('0x35')]?_0x7ce8d2[_0x4520('0x33')]:_0x14778a[_0x4520('0x2f')];if(!_0x222dbd[_0x4520('0x30')][_0x4520('0x36')](_0x4520('0x37'))){_0x7ce8d2['limit']=qs[_0x4520('0x20')](_0x222dbd[_0x4520('0x30')]['limit']);_0x7ce8d2[_0x4520('0x22')]=qs['offset'](_0x222dbd[_0x4520('0x30')][_0x4520('0x22')]);}_0x7ce8d2['order']=qs['sort'](_0x222dbd['query'][_0x4520('0x38')]);_0x7ce8d2[_0x4520('0x39')]=qs[_0x4520('0x31')](_[_0x4520('0x3a')](_0x222dbd[_0x4520('0x30')],_0x14778a[_0x4520('0x31')]),_0x157293);if(_0x222dbd[_0x4520('0x30')]['filter']){_0x7ce8d2[_0x4520('0x39')]=_[_0x4520('0x3b')](_0x7ce8d2[_0x4520('0x39')],{'$or':_['map'](_0x157293,function(_0x16d489){if(_0x16d489[_0x4520('0x2e')]!=='VIRTUAL'){var _0x57b155={};_0x57b155[_0x16d489[_0x4520('0x2a')]]={'$like':'%'+_0x222dbd[_0x4520('0x30')][_0x4520('0x3c')]+'%'};return _0x57b155;}})});}_0x7ce8d2=_[_0x4520('0x3b')]({},_0x7ce8d2,_0x222dbd[_0x4520('0x3d')]);var _0x5ca832={'where':_0x7ce8d2['where']};return db['MailQueueReport'][_0x4520('0x21')](_0x5ca832)['then'](function(_0x43dc36){_0x43b4a2['count']=_0x43dc36;if(_0x222dbd['query'][_0x4520('0x3e')]){_0x7ce8d2[_0x4520('0x3f')]=[{'all':!![]}];}return db[_0x4520('0x2d')][_0x4520('0x40')](_0x7ce8d2);})[_0x4520('0x41')](function(_0x59d646){_0x43b4a2[_0x4520('0x42')]=_0x59d646;return _0x43b4a2;})[_0x4520('0x41')](respondWithFilteredResult(_0x5c1a0b,_0x7ce8d2))['catch'](handleError(_0x5c1a0b,null));};exports['show']=function(_0x3780e4,_0x2ff306){var _0x500c45={'raw':!![],'where':{'id':_0x3780e4[_0x4520('0x43')]['id']}},_0x2978d5={};_0x2978d5[_0x4520('0x2f')]=_[_0x4520('0x44')](db['MailQueueReport'][_0x4520('0x45')]);_0x2978d5[_0x4520('0x30')]=_[_0x4520('0x44')](_0x3780e4[_0x4520('0x30')]);_0x2978d5[_0x4520('0x31')]=_[_0x4520('0x32')](_0x2978d5[_0x4520('0x2f')],_0x2978d5[_0x4520('0x30')]);_0x500c45[_0x4520('0x33')]=_[_0x4520('0x32')](_0x2978d5[_0x4520('0x2f')],qs[_0x4520('0x34')](_0x3780e4[_0x4520('0x30')][_0x4520('0x34')]));_0x500c45[_0x4520('0x33')]=_0x500c45[_0x4520('0x33')][_0x4520('0x35')]?_0x500c45['attributes']:_0x2978d5[_0x4520('0x2f')];if(_0x3780e4[_0x4520('0x30')]['includeAll']){_0x500c45['include']=[{'all':!![]}];}_0x500c45=_['merge']({},_0x500c45,_0x3780e4['options']);return db[_0x4520('0x2d')]['find'](_0x500c45)[_0x4520('0x41')](handleEntityNotFound(_0x2ff306,null))[_0x4520('0x41')](respondWithResult(_0x2ff306,null))[_0x4520('0x46')](handleError(_0x2ff306,null));};exports[_0x4520('0x47')]=function(_0x177c4e,_0x5e3eef){return db[_0x4520('0x2d')][_0x4520('0x47')](_0x177c4e[_0x4520('0x48')],{})[_0x4520('0x41')](respondWithResult(_0x5e3eef,0xc9))[_0x4520('0x46')](handleError(_0x5e3eef,null));};exports[_0x4520('0x26')]=function(_0x737ba4,_0x1e4821){if(_0x737ba4[_0x4520('0x48')]['id']){delete _0x737ba4[_0x4520('0x48')]['id'];}return db[_0x4520('0x2d')][_0x4520('0x49')]({'where':{'id':_0x737ba4['params']['id']}})['then'](handleEntityNotFound(_0x1e4821,null))[_0x4520('0x41')](saveUpdates(_0x737ba4[_0x4520('0x48')],null))[_0x4520('0x41')](respondWithResult(_0x1e4821,null))['catch'](handleError(_0x1e4821,null));};exports[_0x4520('0x27')]=function(_0x2288a7,_0x3f9a4c){return db['MailQueueReport'][_0x4520('0x49')]({'where':{'id':_0x2288a7[_0x4520('0x43')]['id']}})[_0x4520('0x41')](handleEntityNotFound(_0x3f9a4c,null))['then'](removeEntity(_0x3f9a4c,null))['catch'](handleError(_0x3f9a4c,null));};exports[_0x4520('0x4a')]=function(_0x24a6a4,_0x24269e){return db[_0x4520('0x2d')][_0x4520('0x4a')]()[_0x4520('0x41')](respondWithResult(_0x24269e,null))[_0x4520('0x46')](handleError(_0x24269e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 10b8452..241819e 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 _0x9cb4=['../../config/environment','exports','define','uniqueid','lodash','util','../../config/logger','path','rimraf'];(function(_0x4bdf5f,_0x4e9318){var _0x5409d6=function(_0x103352){while(--_0x103352){_0x4bdf5f['push'](_0x4bdf5f['shift']());}};_0x5409d6(++_0x4e9318);}(_0x9cb4,0x12d));var _0x49cb=function(_0x5986bc,_0x245ee7){_0x5986bc=_0x5986bc-0x0;var _0x45ef0a=_0x9cb4[_0x5986bc];return _0x45ef0a;};'use strict';var _=require(_0x49cb('0x0'));var util=require(_0x49cb('0x1'));var logger=require(_0x49cb('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x49cb('0x3'));var rimraf=require(_0x49cb('0x4'));var config=require(_0x49cb('0x5'));var attributes=require('./mailQueueReport.attributes');module[_0x49cb('0x6')]=function(_0x3dde7a,_0x1b7500){return _0x3dde7a[_0x49cb('0x7')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x49cb('0x8'),'fields':[_0x49cb('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdb5=['rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xfdb5,0x18f));var _0x5fdb=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xfdb5[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x5fdb('0x0'));var util=require('util');var logger=require(_0x5fdb('0x1'))(_0x5fdb('0x2'));var moment=require(_0x5fdb('0x3'));var BPromise=require(_0x5fdb('0x4'));var rp=require(_0x5fdb('0x5'));var fs=require('fs');var path=require(_0x5fdb('0x6'));var rimraf=require(_0x5fdb('0x7'));var config=require(_0x5fdb('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0x5fdb('0x9')]=function(_0x4b690d,_0x8195ae){return _0x4b690d[_0x5fdb('0xa')](_0x5fdb('0xb'),attributes,{'tableName':_0x5fdb('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5fdb('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 e653704..f3490e7 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x186d4c,_0x3a9854){var _0x2ffc23=function(_0xc31969){while(--_0xc31969){_0x186d4c['push'](_0x186d4c['shift']());}};_0x2ffc23(++_0x3a9854);}(_0x1261,0x144));var _0x1126=function(_0xe95af,_0x4b849b){_0xe95af=_0xe95af-0x0;var _0x16effb=_0x1261[_0xe95af];return _0x16effb;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +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(_0xc7aaa7,_0x48f5ba){var _0x4a02ae=function(_0x52f8b2){while(--_0x52f8b2){_0xc7aaa7['push'](_0xc7aaa7['shift']());}};_0x4a02ae(++_0x48f5ba);}(_0x7a54,0x106));var _0x47a5=function(_0x417c03,_0xfa4406){_0x417c03=_0x417c03-0x0;var _0xc4105c=_0x7a54[_0x417c03];return _0xc4105c;};'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 41f3818..106b2eb 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x287a7d,_0x29546c){var _0xf1cd90=function(_0x563d6d){while(--_0x563d6d){_0x287a7d['push'](_0x287a7d['shift']());}};_0xf1cd90(++_0x29546c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x997a83,_0x4e971f){var _0x58b0c4=function(_0x94ff29){while(--_0x94ff29){_0x997a83['push'](_0x997a83['shift']());}};_0x58b0c4(++_0x4e971f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 245a62d..4849832 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 _0xee5b=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x54a5cb,_0x4e5f16){var _0x168e1c=function(_0x3c97a9){while(--_0x3c97a9){_0x54a5cb['push'](_0x54a5cb['shift']());}};_0x168e1c(++_0x4e5f16);}(_0xee5b,0x1f4));var _0xbee5=function(_0x309dbb,_0x2a6d23){_0x309dbb=_0x309dbb-0x0;var _0x21cf04=_0xee5b[_0x309dbb];return _0x21cf04;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'description':{'type':Sequelize[_0xbee5('0x1')]},'host':{'type':Sequelize[_0xbee5('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xbee5('0x1')]},'password':{'type':Sequelize[_0xbee5('0x1')]},'port':{'type':Sequelize[_0xbee5('0x2')]},'tls':{'type':Sequelize[_0xbee5('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xbee5('0x1')]}}; \ No newline at end of file +var _0x407f=['INTEGER','INBOX','STRING','BOOLEAN'];(function(_0x2fbaf9,_0x7642){var _0x3249f0=function(_0x44466b){while(--_0x44466b){_0x2fbaf9['push'](_0x2fbaf9['shift']());}};_0x3249f0(++_0x7642);}(_0x407f,0xc2));var _0xf407=function(_0x1ef35d,_0x4ae9eb){_0x1ef35d=_0x1ef35d-0x0;var _0xf195f3=_0x407f[_0x1ef35d];return _0xf195f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf407('0x0')]},'authentication':{'type':Sequelize[_0xf407('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf407('0x0')]},'password':{'type':Sequelize[_0xf407('0x0')]},'port':{'type':Sequelize[_0xf407('0x2')]},'tls':{'type':Sequelize[_0xf407('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf407('0x0')],'defaultValue':_0xf407('0x3')},'connTimeout':{'type':Sequelize[_0xf407('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf407('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf407('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ffe95a6..2483ea3 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 _0xaaaa=['path','rimraf','./mailServerIn.attributes','MailServerIn','mail_servers_in','util','api','bluebird','request-promise'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xaaaa,0x152));var _0xaaaa=function(_0x185e04,_0x3fd3ef){_0x185e04=_0x185e04-0x0;var _0x40b019=_0xaaaa[_0x185e04];return _0x40b019;};'use strict';var _=require('lodash');var util=require(_0xaaaa('0x0'));var logger=require('../../config/logger')(_0xaaaa('0x1'));var moment=require('moment');var BPromise=require(_0xaaaa('0x2'));var rp=require(_0xaaaa('0x3'));var fs=require('fs');var path=require(_0xaaaa('0x4'));var rimraf=require(_0xaaaa('0x5'));var config=require('../../config/environment');var attributes=require(_0xaaaa('0x6'));module['exports']=function(_0x4c052c,_0x3bc910){return _0x4c052c['define'](_0xaaaa('0x7'),attributes,{'tableName':_0xaaaa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ec6=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','MailServerIn','lodash','util'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x7ec6,0xf8));var _0x67ec=function(_0x29e2ba,_0x1b171f){_0x29e2ba=_0x29e2ba-0x0;var _0x5c5920=_0x7ec6[_0x29e2ba];return _0x5c5920;};'use strict';var _=require(_0x67ec('0x0'));var util=require(_0x67ec('0x1'));var logger=require(_0x67ec('0x2'))('api');var moment=require('moment');var BPromise=require(_0x67ec('0x3'));var rp=require(_0x67ec('0x4'));var fs=require('fs');var path=require(_0x67ec('0x5'));var rimraf=require(_0x67ec('0x6'));var config=require(_0x67ec('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x637fb6,_0x3c07d8){return _0x637fb6[_0x67ec('0x8')](_0x67ec('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 0a81f49..a01f8b6 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 _0xa249=['randomstring','../../mysqldb','../../config/logger','client','http','request','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','limit','include','map','model','attributes','info','lodash','util','bluebird'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa249,0x183));var _0x9a24=function(_0x284263,_0x3be13d){_0x284263=_0x284263-0x0;var _0x5c52e8=_0xa249[_0x284263];return _0x5c52e8;};'use strict';var _=require(_0x9a24('0x0'));var util=require(_0x9a24('0x1'));var moment=require('moment');var BPromise=require(_0x9a24('0x2'));var rs=require(_0x9a24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a24('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a24('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9a24('0x6')][_0x9a24('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f59a1,_0x3e35b5,_0x3f2459){return new BPromise(function(_0x22f220,_0x13875f){return client[_0x9a24('0x8')](_0x3f59a1,_0x3f2459)[_0x9a24('0x9')](function(_0x1cb8aa){logger['info']('MailServerIn,\x20%s,\x20%s',_0x3e35b5,_0x9a24('0xa'));logger[_0x9a24('0xb')](_0x9a24('0xc'),_0x3e35b5,'request\x20sent',JSON[_0x9a24('0xd')](_0x1cb8aa));if(_0x1cb8aa['error']){if(_0x1cb8aa[_0x9a24('0xe')]['code']===0x1f4){logger[_0x9a24('0xe')](_0x9a24('0xf'),_0x3e35b5,_0x1cb8aa[_0x9a24('0xe')][_0x9a24('0x10')]);return _0x13875f(_0x1cb8aa[_0x9a24('0xe')]['message']);}logger[_0x9a24('0xe')](_0x9a24('0xf'),_0x3e35b5,_0x1cb8aa[_0x9a24('0xe')][_0x9a24('0x10')]);return _0x22f220(_0x1cb8aa[_0x9a24('0xe')]['message']);}else{logger['info'](_0x9a24('0xf'),_0x3e35b5,_0x9a24('0xa'));_0x22f220(_0x1cb8aa[_0x9a24('0x11')]['message']);}})[_0x9a24('0x12')](function(_0x7239eb){logger[_0x9a24('0xe')](_0x9a24('0xf'),_0x3e35b5,_0x7239eb);_0x13875f(_0x7239eb);});});}exports[_0x9a24('0x13')]=function(_0x402532){var _0x15d0c5=this;return new Promise(function(_0xa438fe,_0x1ffc6d){return db[_0x9a24('0x14')][_0x9a24('0x15')]({'raw':_0x402532[_0x9a24('0x16')]?_0x402532['options'][_0x9a24('0x17')]===undefined?!![]:![]:!![],'where':_0x402532['options']?_0x402532['options']['where']||null:null,'attributes':_0x402532[_0x9a24('0x16')]?_0x402532[_0x9a24('0x16')]['attributes']||null:null,'limit':_0x402532[_0x9a24('0x16')]?_0x402532[_0x9a24('0x16')][_0x9a24('0x18')]||null:null,'include':_0x402532[_0x9a24('0x16')]?_0x402532[_0x9a24('0x16')][_0x9a24('0x19')]?_[_0x9a24('0x1a')](_0x402532[_0x9a24('0x16')][_0x9a24('0x19')],function(_0x5ace5c){return{'model':db[_0x5ace5c[_0x9a24('0x1b')]],'as':_0x5ace5c['as'],'attributes':_0x5ace5c[_0x9a24('0x1c')],'include':_0x5ace5c[_0x9a24('0x19')]?_['map'](_0x5ace5c[_0x9a24('0x19')],function(_0x5b2469){return{'model':db[_0x5b2469[_0x9a24('0x1b')]],'as':_0x5b2469['as'],'attributes':_0x5b2469[_0x9a24('0x1c')],'include':_0x5b2469[_0x9a24('0x19')]?_['map'](_0x5b2469[_0x9a24('0x19')],function(_0x46abfa){return{'model':db[_0x46abfa[_0x9a24('0x1b')]],'as':_0x46abfa['as'],'attributes':_0x46abfa[_0x9a24('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9a24('0x9')](function(_0x5e0d10){logger[_0x9a24('0x1d')]('GetMailServerIn',_0x402532);logger[_0x9a24('0xb')](_0x9a24('0x13'),_0x402532,JSON[_0x9a24('0xd')](_0x5e0d10));_0xa438fe(_0x5e0d10);})[_0x9a24('0x12')](function(_0x2dea45){logger['error']('GetMailServerIn',_0x2dea45[_0x9a24('0x10')],_0x402532);_0x1ffc6d(_0x15d0c5[_0x9a24('0xe')](0x1f4,_0x2dea45[_0x9a24('0x10')]));});});}; \ No newline at end of file +var _0xca07=['include','model','map','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xca07,0xb1));var _0x7ca0=function(_0x2ab332,_0x509ca8){_0x2ab332=_0x2ab332-0x0;var _0x2055df=_0xca07[_0x2ab332];return _0x2055df;};'use strict';var _=require('lodash');var util=require(_0x7ca0('0x0'));var moment=require('moment');var BPromise=require(_0x7ca0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ca0('0x2'));var db=require(_0x7ca0('0x3'))['db'];var utils=require(_0x7ca0('0x4'));var logger=require('../../config/logger')(_0x7ca0('0x5'));var config=require(_0x7ca0('0x6'));var jayson=require(_0x7ca0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51a2ba,_0x3c29ad,_0x3934cd){return new BPromise(function(_0x530ce7,_0x2e7f4b){return client['request'](_0x51a2ba,_0x3934cd)[_0x7ca0('0x8')](function(_0x5d7f49){logger['info'](_0x7ca0('0x9'),_0x3c29ad,'request\x20sent');logger[_0x7ca0('0xa')](_0x7ca0('0xb'),_0x3c29ad,_0x7ca0('0xc'),JSON[_0x7ca0('0xd')](_0x5d7f49));if(_0x5d7f49[_0x7ca0('0xe')]){if(_0x5d7f49['error'][_0x7ca0('0xf')]===0x1f4){logger[_0x7ca0('0xe')](_0x7ca0('0x9'),_0x3c29ad,_0x5d7f49[_0x7ca0('0xe')][_0x7ca0('0x10')]);return _0x2e7f4b(_0x5d7f49['error'][_0x7ca0('0x10')]);}logger[_0x7ca0('0xe')](_0x7ca0('0x9'),_0x3c29ad,_0x5d7f49[_0x7ca0('0xe')][_0x7ca0('0x10')]);return _0x530ce7(_0x5d7f49[_0x7ca0('0xe')][_0x7ca0('0x10')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x3c29ad,'request\x20sent');_0x530ce7(_0x5d7f49[_0x7ca0('0x11')][_0x7ca0('0x10')]);}})[_0x7ca0('0x12')](function(_0x1cbd1d){logger[_0x7ca0('0xe')](_0x7ca0('0x9'),_0x3c29ad,_0x1cbd1d);_0x2e7f4b(_0x1cbd1d);});});}exports[_0x7ca0('0x13')]=function(_0x59e466){var _0x2da9e3=this;return new Promise(function(_0x885c54,_0x4fd71a){return db[_0x7ca0('0x14')][_0x7ca0('0x15')]({'raw':_0x59e466[_0x7ca0('0x16')]?_0x59e466[_0x7ca0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x59e466[_0x7ca0('0x16')]?_0x59e466[_0x7ca0('0x16')][_0x7ca0('0x17')]||null:null,'attributes':_0x59e466['options']?_0x59e466[_0x7ca0('0x16')][_0x7ca0('0x18')]||null:null,'limit':_0x59e466[_0x7ca0('0x16')]?_0x59e466[_0x7ca0('0x16')][_0x7ca0('0x19')]||null:null,'include':_0x59e466[_0x7ca0('0x16')]?_0x59e466['options']['include']?_['map'](_0x59e466[_0x7ca0('0x16')][_0x7ca0('0x1a')],function(_0x445ea6){return{'model':db[_0x445ea6[_0x7ca0('0x1b')]],'as':_0x445ea6['as'],'attributes':_0x445ea6[_0x7ca0('0x18')],'include':_0x445ea6[_0x7ca0('0x1a')]?_[_0x7ca0('0x1c')](_0x445ea6[_0x7ca0('0x1a')],function(_0x54e547){return{'model':db[_0x54e547['model']],'as':_0x54e547['as'],'attributes':_0x54e547[_0x7ca0('0x18')],'include':_0x54e547[_0x7ca0('0x1a')]?_[_0x7ca0('0x1c')](_0x54e547['include'],function(_0x4272ea){return{'model':db[_0x4272ea[_0x7ca0('0x1b')]],'as':_0x4272ea['as'],'attributes':_0x4272ea[_0x7ca0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7ca0('0x8')](function(_0x1958ad){logger['info'](_0x7ca0('0x13'),_0x59e466);logger[_0x7ca0('0xa')](_0x7ca0('0x13'),_0x59e466,JSON[_0x7ca0('0xd')](_0x1958ad));_0x885c54(_0x1958ad);})[_0x7ca0('0x12')](function(_0x4d487f){logger[_0x7ca0('0xe')](_0x7ca0('0x13'),_0x4d487f[_0x7ca0('0x10')],_0x59e466);_0x4fd71a(_0x2da9e3[_0x7ca0('0xe')](0x1f4,_0x4d487f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 354041d..f1e7d35 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x7a54,0x106));var _0x47a5=function(_0x1b2e8c,_0x4ce61b){_0x1b2e8c=_0x1b2e8c-0x0;var _0xb7164a=_0x7a54[_0x1b2e8c];return _0xb7164a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x258f27,_0x5a8444){_0x258f27=_0x258f27-0x0;var _0x33ab8c=_0x7a54[_0x258f27];return _0x33ab8c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 67c6ddf..e20e644 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 _0x4149=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x4b151c,_0x2567ba){var _0x49553c=function(_0x3a2172){while(--_0x3a2172){_0x4b151c['push'](_0x4b151c['shift']());}};_0x49553c(++_0x2567ba);}(_0x4149,0x10f));var _0x9414=function(_0x116b33,_0xe81ef2){_0x116b33=_0x116b33-0x0;var _0x537d30=_0x4149[_0x116b33];return _0x537d30;};'use strict';var Sequelize=require(_0x9414('0x0'));module[_0x9414('0x1')]={'description':{'type':Sequelize[_0x9414('0x2')]},'host':{'type':Sequelize[_0x9414('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x9414('0x2')]},'port':{'type':Sequelize[_0x9414('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x9414('0x2')]},'authentication':{'type':Sequelize[_0x9414('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x74cc=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x2b5b76,_0x38ce26){var _0x172d26=function(_0x5553c0){while(--_0x5553c0){_0x2b5b76['push'](_0x2b5b76['shift']());}};_0x172d26(++_0x38ce26);}(_0x74cc,0x1b4));var _0xc74c=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x74cc[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xc74c('0x0'));module[_0xc74c('0x1')]={'description':{'type':Sequelize[_0xc74c('0x2')]},'host':{'type':Sequelize[_0xc74c('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xc74c('0x2')]},'port':{'type':Sequelize[_0xc74c('0x3')]},'secure':{'type':Sequelize[_0xc74c('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xc74c('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 90cda32..8472fc8 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 _0xf9b3=['body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','send','index','map','MailServerOut','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filter','merge','where','VIRTUAL','includeAll','include','rows','catch','show','params','keys','rawAttributes'];(function(_0x5d48e8,_0x584ea){var _0x14f530=function(_0x3331d0){while(--_0x3331d0){_0x5d48e8['push'](_0x5d48e8['shift']());}};_0x14f530(++_0x584ea);}(_0xf9b3,0x136));var _0x3f9b=function(_0x202b65,_0x11a508){_0x202b65=_0x202b65-0x0;var _0xfc9446=_0xf9b3[_0x202b65];return _0xfc9446;};'use strict';var emlformat=require(_0x3f9b('0x0'));var rimraf=require(_0x3f9b('0x1'));var zipdir=require(_0x3f9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f9b('0x3'));var moment=require(_0x3f9b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f9b('0x5'));var util=require(_0x3f9b('0x6'));var path=require(_0x3f9b('0x7'));var sox=require(_0x3f9b('0x8'));var csv=require(_0x3f9b('0x9'));var ejs=require(_0x3f9b('0xa'));var fs=require('fs');var fs_extra=require(_0x3f9b('0xb'));var _=require(_0x3f9b('0xc'));var squel=require(_0x3f9b('0xd'));var crypto=require(_0x3f9b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3f9b('0xf'));var toCsv=require(_0x3f9b('0x9'));var querystring=require(_0x3f9b('0x10'));var Papa=require(_0x3f9b('0x11'));var Redis=require(_0x3f9b('0x12'));var authService=require(_0x3f9b('0x13'));var qs=require(_0x3f9b('0x14'));var as=require(_0x3f9b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f9b('0x16'))(_0x3f9b('0x17'));var utils=require(_0x3f9b('0x18'));var config=require(_0x3f9b('0x19'));var licenseUtil=require(_0x3f9b('0x1a'));var db=require(_0x3f9b('0x1b'))['db'];function respondWithStatusCode(_0x2b0e97,_0x1904ff){_0x1904ff=_0x1904ff||0xcc;return function(_0x833844){if(_0x833844){return _0x2b0e97[_0x3f9b('0x1c')](_0x1904ff);}return _0x2b0e97['status'](_0x1904ff)[_0x3f9b('0x1d')]();};}function respondWithResult(_0x144eaa,_0x6c1e2){_0x6c1e2=_0x6c1e2||0xc8;return function(_0x10fd5a){if(_0x10fd5a){return _0x144eaa[_0x3f9b('0x1e')](_0x6c1e2)['json'](_0x10fd5a);}};}function respondWithFilteredResult(_0xf1a420,_0x18d3f6){return function(_0x38407c){if(_0x38407c){var _0x4fa522=typeof _0x18d3f6[_0x3f9b('0x1f')]===_0x3f9b('0x20')&&typeof _0x18d3f6[_0x3f9b('0x21')]==='undefined';var _0x49594a=_0x38407c[_0x3f9b('0x22')];var _0x4cb162=_0x4fa522?0x0:_0x18d3f6[_0x3f9b('0x1f')];var _0x434ca8=_0x4fa522?_0x38407c[_0x3f9b('0x22')]:_0x18d3f6[_0x3f9b('0x1f')]+_0x18d3f6['limit'];var _0x15a68a;if(_0x434ca8>=_0x49594a){_0x434ca8=_0x49594a;_0x15a68a=0xc8;}else{_0x15a68a=0xce;}_0xf1a420['status'](_0x15a68a);return _0xf1a420[_0x3f9b('0x23')](_0x3f9b('0x24'),_0x4cb162+'-'+_0x434ca8+'/'+_0x49594a)[_0x3f9b('0x25')](_0x38407c);}return null;};}function patchUpdates(_0x5aa2f9){return function(_0x14b1f9){try{jsonpatch[_0x3f9b('0x26')](_0x14b1f9,_0x5aa2f9,!![]);}catch(_0x46688b){return BPromise[_0x3f9b('0x27')](_0x46688b);}return _0x14b1f9[_0x3f9b('0x28')]();};}function saveUpdates(_0x3a7bc4,_0x58b2f1){return function(_0x19be1c){if(_0x19be1c){return _0x19be1c[_0x3f9b('0x29')](_0x3a7bc4)[_0x3f9b('0x2a')](function(_0x3acbab){return _0x3acbab;});}return null;};}function removeEntity(_0xe14b46,_0x208a15){return function(_0x1eb3a4){if(_0x1eb3a4){return _0x1eb3a4[_0x3f9b('0x2b')]()[_0x3f9b('0x2a')](function(){_0xe14b46[_0x3f9b('0x1e')](0xcc)[_0x3f9b('0x1d')]();});}};}function handleEntityNotFound(_0x2dc7ae,_0x1e5e66){return function(_0x580216){if(!_0x580216){_0x2dc7ae['sendStatus'](0x194);}return _0x580216;};}function handleError(_0x4ca61c,_0xe1230d){_0xe1230d=_0xe1230d||0x1f4;return function(_0x3ef68d){logger['error'](_0x3ef68d[_0x3f9b('0x2c')]);if(_0x3ef68d['name']){delete _0x3ef68d['name'];}_0x4ca61c[_0x3f9b('0x1e')](_0xe1230d)[_0x3f9b('0x2d')](_0x3ef68d);};}exports[_0x3f9b('0x2e')]=function(_0xf330e0,_0x46d128){var _0x382635={},_0xfa4940={},_0x10bc66={'count':0x0,'rows':[]};var _0x1c7815=_[_0x3f9b('0x2f')](db[_0x3f9b('0x30')]['rawAttributes'],function(_0x1444f4){return{'name':_0x1444f4[_0x3f9b('0x31')],'type':_0x1444f4[_0x3f9b('0x32')][_0x3f9b('0x33')]};});_0xfa4940[_0x3f9b('0x34')]=_[_0x3f9b('0x2f')](_0x1c7815,_0x3f9b('0x35'));_0xfa4940[_0x3f9b('0x36')]=_['keys'](_0xf330e0[_0x3f9b('0x36')]);_0xfa4940[_0x3f9b('0x37')]=_['intersection'](_0xfa4940[_0x3f9b('0x34')],_0xfa4940[_0x3f9b('0x36')]);_0x382635['attributes']=_[_0x3f9b('0x38')](_0xfa4940[_0x3f9b('0x34')],qs[_0x3f9b('0x39')](_0xf330e0[_0x3f9b('0x36')][_0x3f9b('0x39')]));_0x382635[_0x3f9b('0x3a')]=_0x382635['attributes'][_0x3f9b('0x3b')]?_0x382635['attributes']:_0xfa4940[_0x3f9b('0x34')];if(!_0xf330e0[_0x3f9b('0x36')][_0x3f9b('0x3c')](_0x3f9b('0x3d'))){_0x382635[_0x3f9b('0x21')]=qs[_0x3f9b('0x21')](_0xf330e0[_0x3f9b('0x36')]['limit']);_0x382635['offset']=qs[_0x3f9b('0x1f')](_0xf330e0['query'][_0x3f9b('0x1f')]);}_0x382635[_0x3f9b('0x3e')]=qs['sort'](_0xf330e0['query']['sort']);_0x382635['where']=qs['filters'](_['pick'](_0xf330e0[_0x3f9b('0x36')],_0xfa4940[_0x3f9b('0x37')]),_0x1c7815);if(_0xf330e0[_0x3f9b('0x36')][_0x3f9b('0x3f')]){_0x382635['where']=_[_0x3f9b('0x40')](_0x382635[_0x3f9b('0x41')],{'$or':_[_0x3f9b('0x2f')](_0x1c7815,function(_0x285221){if(_0x285221[_0x3f9b('0x32')]!==_0x3f9b('0x42')){var _0x96e8ee={};_0x96e8ee[_0x285221['name']]={'$like':'%'+_0xf330e0[_0x3f9b('0x36')][_0x3f9b('0x3f')]+'%'};return _0x96e8ee;}})});}_0x382635=_[_0x3f9b('0x40')]({},_0x382635,_0xf330e0['options']);var _0x48107a={'where':_0x382635[_0x3f9b('0x41')]};return db[_0x3f9b('0x30')]['count'](_0x48107a)[_0x3f9b('0x2a')](function(_0x2a34bc){_0x10bc66[_0x3f9b('0x22')]=_0x2a34bc;if(_0xf330e0[_0x3f9b('0x36')][_0x3f9b('0x43')]){_0x382635[_0x3f9b('0x44')]=[{'all':!![]}];}return db[_0x3f9b('0x30')]['findAll'](_0x382635);})[_0x3f9b('0x2a')](function(_0x118d26){_0x10bc66[_0x3f9b('0x45')]=_0x118d26;return _0x10bc66;})[_0x3f9b('0x2a')](respondWithFilteredResult(_0x46d128,_0x382635))[_0x3f9b('0x46')](handleError(_0x46d128,null));};exports[_0x3f9b('0x47')]=function(_0x5ec07a,_0x1e7360){var _0x1643be={'raw':!![],'where':{'id':_0x5ec07a[_0x3f9b('0x48')]['id']}},_0xb67689={};_0xb67689[_0x3f9b('0x34')]=_[_0x3f9b('0x49')](db['MailServerOut'][_0x3f9b('0x4a')]);_0xb67689['query']=_[_0x3f9b('0x49')](_0x5ec07a[_0x3f9b('0x36')]);_0xb67689[_0x3f9b('0x37')]=_[_0x3f9b('0x38')](_0xb67689[_0x3f9b('0x34')],_0xb67689[_0x3f9b('0x36')]);_0x1643be[_0x3f9b('0x3a')]=_[_0x3f9b('0x38')](_0xb67689['model'],qs[_0x3f9b('0x39')](_0x5ec07a[_0x3f9b('0x36')][_0x3f9b('0x39')]));_0x1643be[_0x3f9b('0x3a')]=_0x1643be[_0x3f9b('0x3a')][_0x3f9b('0x3b')]?_0x1643be[_0x3f9b('0x3a')]:_0xb67689[_0x3f9b('0x34')];if(_0x5ec07a[_0x3f9b('0x36')][_0x3f9b('0x43')]){_0x1643be['include']=[{'all':!![]}];}_0x1643be=_[_0x3f9b('0x40')]({},_0x1643be,_0x5ec07a['options']);return db['MailServerOut']['find'](_0x1643be)[_0x3f9b('0x2a')](handleEntityNotFound(_0x1e7360,null))[_0x3f9b('0x2a')](respondWithResult(_0x1e7360,null))['catch'](handleError(_0x1e7360,null));};exports['create']=function(_0x399266,_0xc09241){return db[_0x3f9b('0x30')]['create'](_0x399266[_0x3f9b('0x4b')],{})[_0x3f9b('0x2a')](respondWithResult(_0xc09241,0xc9))[_0x3f9b('0x46')](handleError(_0xc09241,null));};exports[_0x3f9b('0x29')]=function(_0x22e4d2,_0x150b32){if(_0x22e4d2[_0x3f9b('0x4b')]['id']){delete _0x22e4d2[_0x3f9b('0x4b')]['id'];}return db['MailServerOut'][_0x3f9b('0x4c')]({'where':{'id':_0x22e4d2[_0x3f9b('0x48')]['id']}})[_0x3f9b('0x2a')](handleEntityNotFound(_0x150b32,null))[_0x3f9b('0x2a')](saveUpdates(_0x22e4d2[_0x3f9b('0x4b')],null))[_0x3f9b('0x2a')](respondWithResult(_0x150b32,null))[_0x3f9b('0x46')](handleError(_0x150b32,null));};exports[_0x3f9b('0x2b')]=function(_0x5f31a7,_0x26af87){return db[_0x3f9b('0x30')][_0x3f9b('0x4c')]({'where':{'id':_0x5f31a7[_0x3f9b('0x48')]['id']}})['then'](handleEntityNotFound(_0x26af87,null))[_0x3f9b('0x2a')](removeEntity(_0x26af87,null))[_0x3f9b('0x46')](handleError(_0x26af87,null));}; \ No newline at end of file +var _0x2f6f=['index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','sort','where','pick','filters','filter','merge','VIRTUAL','options','MailServerOut','include','findAll','rows','params','includeAll','find','create','body','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','send'];(function(_0x4e9192,_0x4eefef){var _0x295c41=function(_0xd5b216){while(--_0xd5b216){_0x4e9192['push'](_0x4e9192['shift']());}};_0x295c41(++_0x4eefef);}(_0x2f6f,0x64));var _0xf2f6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2f6f[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xf2f6('0x0'));var rimraf=require(_0xf2f6('0x1'));var zipdir=require(_0xf2f6('0x2'));var jsonpatch=require(_0xf2f6('0x3'));var rp=require(_0xf2f6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf2f6('0x5'));var util=require(_0xf2f6('0x6'));var path=require(_0xf2f6('0x7'));var sox=require(_0xf2f6('0x8'));var csv=require('to-csv');var ejs=require(_0xf2f6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf2f6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf2f6('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf2f6('0xc'));var qs=require(_0xf2f6('0xd'));var as=require(_0xf2f6('0xe'));var hardwareService=require(_0xf2f6('0xf'));var logger=require(_0xf2f6('0x10'))(_0xf2f6('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf2f6('0x12'));var db=require(_0xf2f6('0x13'))['db'];function respondWithStatusCode(_0x19cad2,_0xc16052){_0xc16052=_0xc16052||0xcc;return function(_0x35559c){if(_0x35559c){return _0x19cad2['sendStatus'](_0xc16052);}return _0x19cad2[_0xf2f6('0x14')](_0xc16052)[_0xf2f6('0x15')]();};}function respondWithResult(_0x206198,_0xfa190a){_0xfa190a=_0xfa190a||0xc8;return function(_0x2668ce){if(_0x2668ce){return _0x206198[_0xf2f6('0x14')](_0xfa190a)[_0xf2f6('0x16')](_0x2668ce);}};}function respondWithFilteredResult(_0x5d8293,_0xff1f35){return function(_0x3bc7f3){if(_0x3bc7f3){var _0x4b038b=typeof _0xff1f35[_0xf2f6('0x17')]===_0xf2f6('0x18')&&typeof _0xff1f35[_0xf2f6('0x19')]===_0xf2f6('0x18');var _0x202d81=_0x3bc7f3[_0xf2f6('0x1a')];var _0x1aa9d4=_0x4b038b?0x0:_0xff1f35['offset'];var _0x1cf5cb=_0x4b038b?_0x3bc7f3[_0xf2f6('0x1a')]:_0xff1f35[_0xf2f6('0x17')]+_0xff1f35[_0xf2f6('0x19')];var _0x2df166;if(_0x1cf5cb>=_0x202d81){_0x1cf5cb=_0x202d81;_0x2df166=0xc8;}else{_0x2df166=0xce;}_0x5d8293[_0xf2f6('0x14')](_0x2df166);return _0x5d8293['set'](_0xf2f6('0x1b'),_0x1aa9d4+'-'+_0x1cf5cb+'/'+_0x202d81)[_0xf2f6('0x16')](_0x3bc7f3);}return null;};}function patchUpdates(_0x57bd8c){return function(_0x42c834){try{jsonpatch[_0xf2f6('0x1c')](_0x42c834,_0x57bd8c,!![]);}catch(_0x2bf26c){return BPromise['reject'](_0x2bf26c);}return _0x42c834[_0xf2f6('0x1d')]();};}function saveUpdates(_0x4b041b,_0x1932d2){return function(_0x37b2c3){if(_0x37b2c3){return _0x37b2c3['update'](_0x4b041b)[_0xf2f6('0x1e')](function(_0x375863){return _0x375863;});}return null;};}function removeEntity(_0x36bbf5,_0x1d075a){return function(_0x2ffa2b){if(_0x2ffa2b){return _0x2ffa2b[_0xf2f6('0x1f')]()['then'](function(){_0x36bbf5['status'](0xcc)[_0xf2f6('0x15')]();});}};}function handleEntityNotFound(_0x5a5e2e,_0x463724){return function(_0x1c01ef){if(!_0x1c01ef){_0x5a5e2e['sendStatus'](0x194);}return _0x1c01ef;};}function handleError(_0x221b61,_0x267397){_0x267397=_0x267397||0x1f4;return function(_0x2bb832){logger[_0xf2f6('0x20')](_0x2bb832[_0xf2f6('0x21')]);if(_0x2bb832[_0xf2f6('0x22')]){delete _0x2bb832['name'];}_0x221b61[_0xf2f6('0x14')](_0x267397)[_0xf2f6('0x23')](_0x2bb832);};}exports[_0xf2f6('0x24')]=function(_0x1aaef6,_0x5e3f90){var _0x4f3b1f={},_0x4125da={},_0x3cf543={'count':0x0,'rows':[]};var _0x2ed741=_[_0xf2f6('0x25')](db['MailServerOut'][_0xf2f6('0x26')],function(_0x227b5a){return{'name':_0x227b5a[_0xf2f6('0x27')],'type':_0x227b5a[_0xf2f6('0x28')][_0xf2f6('0x29')]};});_0x4125da[_0xf2f6('0x2a')]=_['map'](_0x2ed741,_0xf2f6('0x22'));_0x4125da['query']=_[_0xf2f6('0x2b')](_0x1aaef6[_0xf2f6('0x2c')]);_0x4125da['filters']=_['intersection'](_0x4125da[_0xf2f6('0x2a')],_0x4125da[_0xf2f6('0x2c')]);_0x4f3b1f[_0xf2f6('0x2d')]=_[_0xf2f6('0x2e')](_0x4125da[_0xf2f6('0x2a')],qs[_0xf2f6('0x2f')](_0x1aaef6[_0xf2f6('0x2c')][_0xf2f6('0x2f')]));_0x4f3b1f[_0xf2f6('0x2d')]=_0x4f3b1f['attributes'][_0xf2f6('0x30')]?_0x4f3b1f[_0xf2f6('0x2d')]:_0x4125da[_0xf2f6('0x2a')];if(!_0x1aaef6['query']['hasOwnProperty']('nolimit')){_0x4f3b1f[_0xf2f6('0x19')]=qs[_0xf2f6('0x19')](_0x1aaef6['query'][_0xf2f6('0x19')]);_0x4f3b1f[_0xf2f6('0x17')]=qs[_0xf2f6('0x17')](_0x1aaef6[_0xf2f6('0x2c')][_0xf2f6('0x17')]);}_0x4f3b1f['order']=qs[_0xf2f6('0x31')](_0x1aaef6[_0xf2f6('0x2c')][_0xf2f6('0x31')]);_0x4f3b1f[_0xf2f6('0x32')]=qs['filters'](_[_0xf2f6('0x33')](_0x1aaef6['query'],_0x4125da[_0xf2f6('0x34')]),_0x2ed741);if(_0x1aaef6['query'][_0xf2f6('0x35')]){_0x4f3b1f[_0xf2f6('0x32')]=_[_0xf2f6('0x36')](_0x4f3b1f[_0xf2f6('0x32')],{'$or':_[_0xf2f6('0x25')](_0x2ed741,function(_0xdbc9a7){if(_0xdbc9a7[_0xf2f6('0x28')]!==_0xf2f6('0x37')){var _0x430a6e={};_0x430a6e[_0xdbc9a7[_0xf2f6('0x22')]]={'$like':'%'+_0x1aaef6[_0xf2f6('0x2c')]['filter']+'%'};return _0x430a6e;}})});}_0x4f3b1f=_[_0xf2f6('0x36')]({},_0x4f3b1f,_0x1aaef6[_0xf2f6('0x38')]);var _0x58e69e={'where':_0x4f3b1f[_0xf2f6('0x32')]};return db[_0xf2f6('0x39')][_0xf2f6('0x1a')](_0x58e69e)['then'](function(_0x2c88d4){_0x3cf543[_0xf2f6('0x1a')]=_0x2c88d4;if(_0x1aaef6[_0xf2f6('0x2c')]['includeAll']){_0x4f3b1f[_0xf2f6('0x3a')]=[{'all':!![]}];}return db[_0xf2f6('0x39')][_0xf2f6('0x3b')](_0x4f3b1f);})[_0xf2f6('0x1e')](function(_0x12a0ba){_0x3cf543[_0xf2f6('0x3c')]=_0x12a0ba;return _0x3cf543;})[_0xf2f6('0x1e')](respondWithFilteredResult(_0x5e3f90,_0x4f3b1f))['catch'](handleError(_0x5e3f90,null));};exports['show']=function(_0x4a06df,_0x213e36){var _0x3c5943={'raw':!![],'where':{'id':_0x4a06df[_0xf2f6('0x3d')]['id']}},_0x5cdde8={};_0x5cdde8[_0xf2f6('0x2a')]=_[_0xf2f6('0x2b')](db[_0xf2f6('0x39')][_0xf2f6('0x26')]);_0x5cdde8[_0xf2f6('0x2c')]=_[_0xf2f6('0x2b')](_0x4a06df[_0xf2f6('0x2c')]);_0x5cdde8[_0xf2f6('0x34')]=_[_0xf2f6('0x2e')](_0x5cdde8[_0xf2f6('0x2a')],_0x5cdde8[_0xf2f6('0x2c')]);_0x3c5943[_0xf2f6('0x2d')]=_[_0xf2f6('0x2e')](_0x5cdde8[_0xf2f6('0x2a')],qs[_0xf2f6('0x2f')](_0x4a06df[_0xf2f6('0x2c')][_0xf2f6('0x2f')]));_0x3c5943[_0xf2f6('0x2d')]=_0x3c5943[_0xf2f6('0x2d')][_0xf2f6('0x30')]?_0x3c5943[_0xf2f6('0x2d')]:_0x5cdde8['model'];if(_0x4a06df['query'][_0xf2f6('0x3e')]){_0x3c5943[_0xf2f6('0x3a')]=[{'all':!![]}];}_0x3c5943=_[_0xf2f6('0x36')]({},_0x3c5943,_0x4a06df[_0xf2f6('0x38')]);return db[_0xf2f6('0x39')][_0xf2f6('0x3f')](_0x3c5943)[_0xf2f6('0x1e')](handleEntityNotFound(_0x213e36,null))['then'](respondWithResult(_0x213e36,null))['catch'](handleError(_0x213e36,null));};exports[_0xf2f6('0x40')]=function(_0x239461,_0x37193e){return db[_0xf2f6('0x39')][_0xf2f6('0x40')](_0x239461[_0xf2f6('0x41')],{})[_0xf2f6('0x1e')](respondWithResult(_0x37193e,0xc9))[_0xf2f6('0x42')](handleError(_0x37193e,null));};exports[_0xf2f6('0x43')]=function(_0x500801,_0x3da466){if(_0x500801[_0xf2f6('0x41')]['id']){delete _0x500801['body']['id'];}return db[_0xf2f6('0x39')]['find']({'where':{'id':_0x500801[_0xf2f6('0x3d')]['id']}})[_0xf2f6('0x1e')](handleEntityNotFound(_0x3da466,null))[_0xf2f6('0x1e')](saveUpdates(_0x500801[_0xf2f6('0x41')],null))['then'](respondWithResult(_0x3da466,null))['catch'](handleError(_0x3da466,null));};exports[_0xf2f6('0x1f')]=function(_0x561cea,_0x5d2340){return db['MailServerOut'][_0xf2f6('0x3f')]({'where':{'id':_0x561cea[_0xf2f6('0x3d')]['id']}})[_0xf2f6('0x1e')](handleEntityNotFound(_0x5d2340,null))[_0xf2f6('0x1e')](removeEntity(_0x5d2340,null))[_0xf2f6('0x42')](handleError(_0x5d2340,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index d9604ba..78f1287 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 _0x779c=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','MailServerOut','mail_servers_out','../../config/logger'];(function(_0x379436,_0x15853c){var _0x367a8a=function(_0x5e3f3a){while(--_0x5e3f3a){_0x379436['push'](_0x379436['shift']());}};_0x367a8a(++_0x15853c);}(_0x779c,0x1a1));var _0xc779=function(_0x1ab030,_0x2b13be){_0x1ab030=_0x1ab030-0x0;var _0x41afb0=_0x779c[_0x1ab030];return _0x41afb0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc779('0x0'))(_0xc779('0x1'));var moment=require(_0xc779('0x2'));var BPromise=require(_0xc779('0x3'));var rp=require(_0xc779('0x4'));var fs=require('fs');var path=require(_0xc779('0x5'));var rimraf=require('rimraf');var config=require(_0xc779('0x6'));var attributes=require('./mailServerOut.attributes');module[_0xc779('0x7')]=function(_0x30e14c,_0x46ccdc){return _0x30e14c[_0xc779('0x8')](_0xc779('0x9'),attributes,{'tableName':_0xc779('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f68=['define','MailServerOut','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x416109,_0x4f8619){var _0xf9c380=function(_0x50ce89){while(--_0x50ce89){_0x416109['push'](_0x416109['shift']());}};_0xf9c380(++_0x4f8619);}(_0x4f68,0x13a));var _0x84f6=function(_0x4c3dca,_0x47f55f){_0x4c3dca=_0x4c3dca-0x0;var _0x581a1e=_0x4f68[_0x4c3dca];return _0x581a1e;};'use strict';var _=require(_0x84f6('0x0'));var util=require(_0x84f6('0x1'));var logger=require(_0x84f6('0x2'))('api');var moment=require(_0x84f6('0x3'));var BPromise=require(_0x84f6('0x4'));var rp=require(_0x84f6('0x5'));var fs=require('fs');var path=require(_0x84f6('0x6'));var rimraf=require(_0x84f6('0x7'));var config=require(_0x84f6('0x8'));var attributes=require(_0x84f6('0x9'));module[_0x84f6('0xa')]=function(_0x43ef3b,_0x3273eb){return _0x43ef3b[_0x84f6('0xb')](_0x84f6('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 25649c9..a41a33f 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x497dab,_0x206098){var _0xa857e3=function(_0x52ebdb){while(--_0x52ebdb){_0x497dab['push'](_0x497dab['shift']());}};_0xa857e3(++_0x206098);}(_0x1261,0x144));var _0x1126=function(_0xa6a23e,_0x8b657a){_0xa6a23e=_0xa6a23e-0x0;var _0x210e65=_0x1261[_0xa6a23e];return _0x210e65;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _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(_0x4114dd,_0x2ad862){var _0x26f44c=function(_0xad2246){while(--_0xad2246){_0x4114dd['push'](_0x4114dd['shift']());}};_0x26f44c(++_0x2ad862);}(_0xadb5,0xad));var _0x5adb=function(_0x259d90,_0x4259f7){_0x259d90=_0x259d90-0x0;var _0x526c4c=_0xadb5[_0x259d90];return _0x526c4c;};'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 7938bda..3ee9b01 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 _0x0350=['/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x3cc375,_0x22e6ca){var _0x4a62fe=function(_0x2ada12){while(--_0x2ada12){_0x3cc375['push'](_0x3cc375['shift']());}};_0x4a62fe(++_0x22e6ca);}(_0x0350,0x159));var _0x0035=function(_0x293c5d,_0x4a39c9){_0x293c5d=_0x293c5d-0x0;var _0x2ec650=_0x0350[_0x293c5d];return _0x2ec650;};'use strict';var multer=require(_0x0035('0x0'));var util=require(_0x0035('0x1'));var path=require('path');var timeout=require(_0x0035('0x2'));var express=require(_0x0035('0x3'));var router=express[_0x0035('0x4')]();var fs_extra=require(_0x0035('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0035('0x6'));var config=require(_0x0035('0x7'));var controller=require(_0x0035('0x8'));router[_0x0035('0x9')]('/',auth[_0x0035('0xa')](),controller[_0x0035('0xb')]);router[_0x0035('0x9')](_0x0035('0xc'),auth[_0x0035('0xa')](),controller[_0x0035('0xd')]);router[_0x0035('0x9')](_0x0035('0xe'),auth[_0x0035('0xa')](),controller[_0x0035('0xf')]);router['post']('/',auth[_0x0035('0xa')](),controller[_0x0035('0x10')]);router[_0x0035('0x11')](_0x0035('0xe'),auth[_0x0035('0xa')](),controller[_0x0035('0x12')]);router['delete'](_0x0035('0xe'),auth[_0x0035('0xa')](),controller[_0x0035('0x13')]);module[_0x0035('0x14')]=router; \ No newline at end of file +var _0x9812=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express'];(function(_0x5a34e5,_0x2aa9e9){var _0x3f98a5=function(_0x2043e5){while(--_0x2043e5){_0x5a34e5['push'](_0x5a34e5['shift']());}};_0x3f98a5(++_0x2aa9e9);}(_0x9812,0x1dd));var _0x2981=function(_0x220904,_0x5976cc){_0x220904=_0x220904-0x0;var _0x526df1=_0x9812[_0x220904];return _0x526df1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2981('0x0'));var timeout=require(_0x2981('0x1'));var express=require(_0x2981('0x2'));var router=express['Router']();var fs_extra=require(_0x2981('0x3'));var auth=require(_0x2981('0x4'));var interaction=require(_0x2981('0x5'));var config=require(_0x2981('0x6'));var controller=require(_0x2981('0x7'));router[_0x2981('0x8')]('/',auth[_0x2981('0x9')](),controller['index']);router[_0x2981('0x8')](_0x2981('0xa'),auth[_0x2981('0x9')](),controller[_0x2981('0xb')]);router[_0x2981('0x8')](_0x2981('0xc'),auth['isAuthenticated'](),controller[_0x2981('0xd')]);router[_0x2981('0xe')]('/',auth[_0x2981('0x9')](),controller[_0x2981('0xf')]);router[_0x2981('0x10')](_0x2981('0xc'),auth[_0x2981('0x9')](),controller[_0x2981('0x11')]);router[_0x2981('0x12')](_0x2981('0xc'),auth[_0x2981('0x9')](),controller[_0x2981('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 63a7332..7de2b08 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 _0xffd6=['STRING','sequelize','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xffd6,0x97));var _0x6ffd=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xffd6[_0x4bb581];return _0x316bf5;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf767=['name','exports','STRING'];(function(_0x10e988,_0x272453){var _0x37ed93=function(_0x4f40c4){while(--_0x4f40c4){_0x10e988['push'](_0x10e988['shift']());}};_0x37ed93(++_0x272453);}(_0xf767,0x76));var _0x7f76=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0xf767[_0x36fbef];return _0x45e270;};'use strict';var Sequelize=require('sequelize');module[_0x7f76('0x0')]={'name':{'type':Sequelize[_0x7f76('0x1')],'unique':_0x7f76('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7f76('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 9ba5dc6..0f5b2ae 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 _0x2e30=['map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','type','VIRTUAL','name','filter','merge','options','MailSubstatus','includeAll','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','apply','reject','update','then','sendStatus','error','stack','send','rawAttributes','fieldName','model'];(function(_0x404c61,_0x527352){var _0x5aea0d=function(_0x493c39){while(--_0x493c39){_0x404c61['push'](_0x404c61['shift']());}};_0x5aea0d(++_0x527352);}(_0x2e30,0xad));var _0x02e3=function(_0x1afa73,_0x4c9350){_0x1afa73=_0x1afa73-0x0;var _0x2b7217=_0x2e30[_0x1afa73];return _0x2b7217;};'use strict';var emlformat=require(_0x02e3('0x0'));var rimraf=require(_0x02e3('0x1'));var zipdir=require(_0x02e3('0x2'));var jsonpatch=require(_0x02e3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x02e3('0x4'));var path=require(_0x02e3('0x5'));var sox=require('sox');var csv=require(_0x02e3('0x6'));var ejs=require(_0x02e3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02e3('0x8'));var squel=require(_0x02e3('0x9'));var crypto=require(_0x02e3('0xa'));var jsforce=require(_0x02e3('0xb'));var deskjs=require(_0x02e3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x02e3('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x02e3('0xe'));var hardwareService=require(_0x02e3('0xf'));var logger=require(_0x02e3('0x10'))(_0x02e3('0x11'));var utils=require(_0x02e3('0x12'));var config=require(_0x02e3('0x13'));var licenseUtil=require(_0x02e3('0x14'));var db=require(_0x02e3('0x15'))['db'];function respondWithStatusCode(_0x1f2e08,_0x5c26f1){_0x5c26f1=_0x5c26f1||0xcc;return function(_0x4ae250){if(_0x4ae250){return _0x1f2e08['sendStatus'](_0x5c26f1);}return _0x1f2e08[_0x02e3('0x16')](_0x5c26f1)[_0x02e3('0x17')]();};}function respondWithResult(_0x38d1cc,_0x1f6329){_0x1f6329=_0x1f6329||0xc8;return function(_0x5a079f){if(_0x5a079f){return _0x38d1cc[_0x02e3('0x16')](_0x1f6329)['json'](_0x5a079f);}};}function respondWithFilteredResult(_0x369a5e,_0x24ed92){return function(_0x74977e){if(_0x74977e){var _0x2bc059=typeof _0x24ed92[_0x02e3('0x18')]===_0x02e3('0x19')&&typeof _0x24ed92[_0x02e3('0x1a')]===_0x02e3('0x19');var _0x417dbc=_0x74977e[_0x02e3('0x1b')];var _0x52e308=_0x2bc059?0x0:_0x24ed92[_0x02e3('0x18')];var _0x4c21d6=_0x2bc059?_0x74977e[_0x02e3('0x1b')]:_0x24ed92[_0x02e3('0x18')]+_0x24ed92[_0x02e3('0x1a')];var _0xeb33e0;if(_0x4c21d6>=_0x417dbc){_0x4c21d6=_0x417dbc;_0xeb33e0=0xc8;}else{_0xeb33e0=0xce;}_0x369a5e['status'](_0xeb33e0);return _0x369a5e[_0x02e3('0x1c')]('Content-Range',_0x52e308+'-'+_0x4c21d6+'/'+_0x417dbc)['json'](_0x74977e);}return null;};}function patchUpdates(_0x45f72e){return function(_0x3e65dd){try{jsonpatch[_0x02e3('0x1d')](_0x3e65dd,_0x45f72e,!![]);}catch(_0x4ba63f){return BPromise[_0x02e3('0x1e')](_0x4ba63f);}return _0x3e65dd['save']();};}function saveUpdates(_0x5631ec,_0x93d748){return function(_0x4626eb){if(_0x4626eb){return _0x4626eb[_0x02e3('0x1f')](_0x5631ec)['then'](function(_0x46fcb9){return _0x46fcb9;});}return null;};}function removeEntity(_0x44ea14,_0x1fba76){return function(_0x2cf3cb){if(_0x2cf3cb){return _0x2cf3cb['destroy']()[_0x02e3('0x20')](function(){_0x44ea14[_0x02e3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a6e1,_0xf7b4ed){return function(_0x117d48){if(!_0x117d48){_0x14a6e1[_0x02e3('0x21')](0x194);}return _0x117d48;};}function handleError(_0xa748a1,_0x3b0f78){_0x3b0f78=_0x3b0f78||0x1f4;return function(_0x4003fc){logger[_0x02e3('0x22')](_0x4003fc[_0x02e3('0x23')]);if(_0x4003fc['name']){delete _0x4003fc['name'];}_0xa748a1['status'](_0x3b0f78)[_0x02e3('0x24')](_0x4003fc);};}exports['index']=function(_0x57c0a8,_0x19566c){var _0x32a904={},_0x1e324e={},_0x3ff10f={'count':0x0,'rows':[]};var _0x1ab173=_['map'](db['MailSubstatus'][_0x02e3('0x25')],function(_0x573b98){return{'name':_0x573b98[_0x02e3('0x26')],'type':_0x573b98['type']['key']};});_0x1e324e[_0x02e3('0x27')]=_[_0x02e3('0x28')](_0x1ab173,'name');_0x1e324e[_0x02e3('0x29')]=_['keys'](_0x57c0a8[_0x02e3('0x29')]);_0x1e324e['filters']=_[_0x02e3('0x2a')](_0x1e324e[_0x02e3('0x27')],_0x1e324e[_0x02e3('0x29')]);_0x32a904[_0x02e3('0x2b')]=_[_0x02e3('0x2a')](_0x1e324e[_0x02e3('0x27')],qs[_0x02e3('0x2c')](_0x57c0a8['query'][_0x02e3('0x2c')]));_0x32a904[_0x02e3('0x2b')]=_0x32a904[_0x02e3('0x2b')][_0x02e3('0x2d')]?_0x32a904[_0x02e3('0x2b')]:_0x1e324e[_0x02e3('0x27')];if(!_0x57c0a8[_0x02e3('0x29')][_0x02e3('0x2e')](_0x02e3('0x2f'))){_0x32a904['limit']=qs[_0x02e3('0x1a')](_0x57c0a8[_0x02e3('0x29')][_0x02e3('0x1a')]);_0x32a904[_0x02e3('0x18')]=qs[_0x02e3('0x18')](_0x57c0a8[_0x02e3('0x29')]['offset']);}_0x32a904[_0x02e3('0x30')]=qs[_0x02e3('0x31')](_0x57c0a8[_0x02e3('0x29')]['sort']);_0x32a904['where']=qs[_0x02e3('0x32')](_['pick'](_0x57c0a8[_0x02e3('0x29')],_0x1e324e[_0x02e3('0x32')]),_0x1ab173);if(_0x57c0a8[_0x02e3('0x29')]['filter']){_0x32a904[_0x02e3('0x33')]=_['merge'](_0x32a904[_0x02e3('0x33')],{'$or':_[_0x02e3('0x28')](_0x1ab173,function(_0xff64b8){if(_0xff64b8[_0x02e3('0x34')]!==_0x02e3('0x35')){var _0x44dcfb={};_0x44dcfb[_0xff64b8[_0x02e3('0x36')]]={'$like':'%'+_0x57c0a8['query'][_0x02e3('0x37')]+'%'};return _0x44dcfb;}})});}_0x32a904=_[_0x02e3('0x38')]({},_0x32a904,_0x57c0a8[_0x02e3('0x39')]);var _0x3f1b23={'where':_0x32a904[_0x02e3('0x33')]};return db[_0x02e3('0x3a')]['count'](_0x3f1b23)['then'](function(_0x3f1d0e){_0x3ff10f['count']=_0x3f1d0e;if(_0x57c0a8['query'][_0x02e3('0x3b')]){_0x32a904['include']=[{'all':!![]}];}return db[_0x02e3('0x3a')][_0x02e3('0x3c')](_0x32a904);})[_0x02e3('0x20')](function(_0x5ebeb3){_0x3ff10f[_0x02e3('0x3d')]=_0x5ebeb3;return _0x3ff10f;})['then'](respondWithFilteredResult(_0x19566c,_0x32a904))[_0x02e3('0x3e')](handleError(_0x19566c,null));};exports[_0x02e3('0x3f')]=function(_0x58194a,_0x3a7fcc){var _0x166eff={'raw':!![],'where':{'id':_0x58194a[_0x02e3('0x40')]['id']}},_0x5bad84={};_0x5bad84[_0x02e3('0x27')]=_[_0x02e3('0x41')](db[_0x02e3('0x3a')][_0x02e3('0x25')]);_0x5bad84[_0x02e3('0x29')]=_[_0x02e3('0x41')](_0x58194a['query']);_0x5bad84[_0x02e3('0x32')]=_[_0x02e3('0x2a')](_0x5bad84[_0x02e3('0x27')],_0x5bad84[_0x02e3('0x29')]);_0x166eff[_0x02e3('0x2b')]=_[_0x02e3('0x2a')](_0x5bad84['model'],qs['fields'](_0x58194a['query'][_0x02e3('0x2c')]));_0x166eff[_0x02e3('0x2b')]=_0x166eff[_0x02e3('0x2b')][_0x02e3('0x2d')]?_0x166eff[_0x02e3('0x2b')]:_0x5bad84[_0x02e3('0x27')];if(_0x58194a[_0x02e3('0x29')][_0x02e3('0x3b')]){_0x166eff['include']=[{'all':!![]}];}_0x166eff=_[_0x02e3('0x38')]({},_0x166eff,_0x58194a[_0x02e3('0x39')]);return db['MailSubstatus'][_0x02e3('0x42')](_0x166eff)['then'](handleEntityNotFound(_0x3a7fcc,null))[_0x02e3('0x20')](respondWithResult(_0x3a7fcc,null))['catch'](handleError(_0x3a7fcc,null));};exports[_0x02e3('0x43')]=function(_0x45ae28,_0x46acb7){return db['MailSubstatus'][_0x02e3('0x43')](_0x45ae28[_0x02e3('0x44')],{})[_0x02e3('0x20')](respondWithResult(_0x46acb7,0xc9))[_0x02e3('0x3e')](handleError(_0x46acb7,null));};exports['update']=function(_0x2b591f,_0x5761a1){if(_0x2b591f[_0x02e3('0x44')]['id']){delete _0x2b591f[_0x02e3('0x44')]['id'];}return db[_0x02e3('0x3a')][_0x02e3('0x42')]({'where':{'id':_0x2b591f['params']['id']}})[_0x02e3('0x20')](handleEntityNotFound(_0x5761a1,null))[_0x02e3('0x20')](saveUpdates(_0x2b591f[_0x02e3('0x44')],null))[_0x02e3('0x20')](respondWithResult(_0x5761a1,null))[_0x02e3('0x3e')](handleError(_0x5761a1,null));};exports[_0x02e3('0x45')]=function(_0x1d967f,_0xcf0c96){return db[_0x02e3('0x3a')][_0x02e3('0x42')]({'where':{'id':_0x1d967f[_0x02e3('0x40')]['id']}})['then'](handleEntityNotFound(_0xcf0c96,null))[_0x02e3('0x20')](removeEntity(_0xcf0c96,null))[_0x02e3('0x3e')](handleError(_0xcf0c96,null));};exports['describe']=function(_0x10216c,_0x218661){return db['MailSubstatus'][_0x02e3('0x46')]()[_0x02e3('0x20')](respondWithResult(_0x218661,null))['catch'](handleError(_0x218661,null));}; \ No newline at end of file +var _0x3272=['set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','MailSubstatus','includeAll','include','findAll','rows','catch','show','options','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x2e504f,_0x8f3280){var _0x5c084d=function(_0x30fb67){while(--_0x30fb67){_0x2e504f['push'](_0x2e504f['shift']());}};_0x5c084d(++_0x8f3280);}(_0x3272,0x77));var _0x2327=function(_0x438d36,_0x546585){_0x438d36=_0x438d36-0x0;var _0x3bdf55=_0x3272[_0x438d36];return _0x3bdf55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2327('0x0'));var zipdir=require(_0x2327('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2327('0x2'));var moment=require(_0x2327('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2327('0x4'));var util=require(_0x2327('0x5'));var path=require('path');var sox=require(_0x2327('0x6'));var csv=require(_0x2327('0x7'));var ejs=require(_0x2327('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2327('0x9'));var squel=require('squel');var crypto=require(_0x2327('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2327('0xb'));var toCsv=require(_0x2327('0x7'));var querystring=require(_0x2327('0xc'));var Papa=require('papaparse');var Redis=require(_0x2327('0xd'));var authService=require(_0x2327('0xe'));var qs=require(_0x2327('0xf'));var as=require(_0x2327('0x10'));var hardwareService=require(_0x2327('0x11'));var logger=require('../../config/logger')(_0x2327('0x12'));var utils=require(_0x2327('0x13'));var config=require(_0x2327('0x14'));var licenseUtil=require(_0x2327('0x15'));var db=require(_0x2327('0x16'))['db'];function respondWithStatusCode(_0x573f3d,_0x6132a4){_0x6132a4=_0x6132a4||0xcc;return function(_0x4d4c76){if(_0x4d4c76){return _0x573f3d[_0x2327('0x17')](_0x6132a4);}return _0x573f3d[_0x2327('0x18')](_0x6132a4)[_0x2327('0x19')]();};}function respondWithResult(_0x4f094f,_0x42473f){_0x42473f=_0x42473f||0xc8;return function(_0x3b5fbe){if(_0x3b5fbe){return _0x4f094f[_0x2327('0x18')](_0x42473f)[_0x2327('0x1a')](_0x3b5fbe);}};}function respondWithFilteredResult(_0x5c8f90,_0x1c0993){return function(_0xef4214){if(_0xef4214){var _0x2ca458=typeof _0x1c0993[_0x2327('0x1b')]==='undefined'&&typeof _0x1c0993['limit']===_0x2327('0x1c');var _0x3d744d=_0xef4214[_0x2327('0x1d')];var _0x318a0d=_0x2ca458?0x0:_0x1c0993[_0x2327('0x1b')];var _0x50bae7=_0x2ca458?_0xef4214[_0x2327('0x1d')]:_0x1c0993[_0x2327('0x1b')]+_0x1c0993[_0x2327('0x1e')];var _0x52abae;if(_0x50bae7>=_0x3d744d){_0x50bae7=_0x3d744d;_0x52abae=0xc8;}else{_0x52abae=0xce;}_0x5c8f90[_0x2327('0x18')](_0x52abae);return _0x5c8f90[_0x2327('0x1f')]('Content-Range',_0x318a0d+'-'+_0x50bae7+'/'+_0x3d744d)[_0x2327('0x1a')](_0xef4214);}return null;};}function patchUpdates(_0x244ece){return function(_0x3b88d6){try{jsonpatch[_0x2327('0x20')](_0x3b88d6,_0x244ece,!![]);}catch(_0x289842){return BPromise[_0x2327('0x21')](_0x289842);}return _0x3b88d6[_0x2327('0x22')]();};}function saveUpdates(_0x51cdd9,_0x465eb2){return function(_0x3eef7d){if(_0x3eef7d){return _0x3eef7d[_0x2327('0x23')](_0x51cdd9)[_0x2327('0x24')](function(_0x5b2460){return _0x5b2460;});}return null;};}function removeEntity(_0x38f133,_0x1520fb){return function(_0x3669a3){if(_0x3669a3){return _0x3669a3[_0x2327('0x25')]()[_0x2327('0x24')](function(){_0x38f133[_0x2327('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a015,_0x4338df){return function(_0x34982d){if(!_0x34982d){_0x51a015['sendStatus'](0x194);}return _0x34982d;};}function handleError(_0x59e576,_0x114fb2){_0x114fb2=_0x114fb2||0x1f4;return function(_0x37e082){logger[_0x2327('0x26')](_0x37e082[_0x2327('0x27')]);if(_0x37e082['name']){delete _0x37e082[_0x2327('0x28')];}_0x59e576['status'](_0x114fb2)['send'](_0x37e082);};}exports[_0x2327('0x29')]=function(_0x18439f,_0x382557){var _0x7ae10a={},_0x323613={},_0x306831={'count':0x0,'rows':[]};var _0x2d893d=_[_0x2327('0x2a')](db['MailSubstatus'][_0x2327('0x2b')],function(_0x52ef7a){return{'name':_0x52ef7a[_0x2327('0x2c')],'type':_0x52ef7a[_0x2327('0x2d')][_0x2327('0x2e')]};});_0x323613[_0x2327('0x2f')]=_['map'](_0x2d893d,_0x2327('0x28'));_0x323613[_0x2327('0x30')]=_[_0x2327('0x31')](_0x18439f[_0x2327('0x30')]);_0x323613[_0x2327('0x32')]=_[_0x2327('0x33')](_0x323613[_0x2327('0x2f')],_0x323613[_0x2327('0x30')]);_0x7ae10a[_0x2327('0x34')]=_[_0x2327('0x33')](_0x323613['model'],qs[_0x2327('0x35')](_0x18439f[_0x2327('0x30')][_0x2327('0x35')]));_0x7ae10a[_0x2327('0x34')]=_0x7ae10a[_0x2327('0x34')][_0x2327('0x36')]?_0x7ae10a[_0x2327('0x34')]:_0x323613[_0x2327('0x2f')];if(!_0x18439f[_0x2327('0x30')][_0x2327('0x37')]('nolimit')){_0x7ae10a[_0x2327('0x1e')]=qs[_0x2327('0x1e')](_0x18439f['query'][_0x2327('0x1e')]);_0x7ae10a[_0x2327('0x1b')]=qs['offset'](_0x18439f[_0x2327('0x30')][_0x2327('0x1b')]);}_0x7ae10a[_0x2327('0x38')]=qs[_0x2327('0x39')](_0x18439f[_0x2327('0x30')][_0x2327('0x39')]);_0x7ae10a['where']=qs['filters'](_[_0x2327('0x3a')](_0x18439f['query'],_0x323613[_0x2327('0x32')]),_0x2d893d);if(_0x18439f[_0x2327('0x30')][_0x2327('0x3b')]){_0x7ae10a[_0x2327('0x3c')]=_['merge'](_0x7ae10a[_0x2327('0x3c')],{'$or':_[_0x2327('0x2a')](_0x2d893d,function(_0x590ec4){if(_0x590ec4[_0x2327('0x2d')]!==_0x2327('0x3d')){var _0x500233={};_0x500233[_0x590ec4['name']]={'$like':'%'+_0x18439f[_0x2327('0x30')]['filter']+'%'};return _0x500233;}})});}_0x7ae10a=_[_0x2327('0x3e')]({},_0x7ae10a,_0x18439f['options']);var _0x4fde16={'where':_0x7ae10a['where']};return db[_0x2327('0x3f')][_0x2327('0x1d')](_0x4fde16)['then'](function(_0xc11348){_0x306831['count']=_0xc11348;if(_0x18439f['query'][_0x2327('0x40')]){_0x7ae10a[_0x2327('0x41')]=[{'all':!![]}];}return db[_0x2327('0x3f')][_0x2327('0x42')](_0x7ae10a);})[_0x2327('0x24')](function(_0x153c91){_0x306831[_0x2327('0x43')]=_0x153c91;return _0x306831;})[_0x2327('0x24')](respondWithFilteredResult(_0x382557,_0x7ae10a))[_0x2327('0x44')](handleError(_0x382557,null));};exports[_0x2327('0x45')]=function(_0x24c60d,_0x14cdcc){var _0x2bafb4={'raw':!![],'where':{'id':_0x24c60d['params']['id']}},_0x22d160={};_0x22d160[_0x2327('0x2f')]=_['keys'](db[_0x2327('0x3f')]['rawAttributes']);_0x22d160['query']=_[_0x2327('0x31')](_0x24c60d[_0x2327('0x30')]);_0x22d160[_0x2327('0x32')]=_['intersection'](_0x22d160[_0x2327('0x2f')],_0x22d160['query']);_0x2bafb4[_0x2327('0x34')]=_[_0x2327('0x33')](_0x22d160[_0x2327('0x2f')],qs[_0x2327('0x35')](_0x24c60d[_0x2327('0x30')][_0x2327('0x35')]));_0x2bafb4['attributes']=_0x2bafb4[_0x2327('0x34')]['length']?_0x2bafb4['attributes']:_0x22d160[_0x2327('0x2f')];if(_0x24c60d[_0x2327('0x30')][_0x2327('0x40')]){_0x2bafb4[_0x2327('0x41')]=[{'all':!![]}];}_0x2bafb4=_['merge']({},_0x2bafb4,_0x24c60d[_0x2327('0x46')]);return db['MailSubstatus'][_0x2327('0x47')](_0x2bafb4)[_0x2327('0x24')](handleEntityNotFound(_0x14cdcc,null))[_0x2327('0x24')](respondWithResult(_0x14cdcc,null))[_0x2327('0x44')](handleError(_0x14cdcc,null));};exports[_0x2327('0x48')]=function(_0x3a8a20,_0x3d4845){return db[_0x2327('0x3f')][_0x2327('0x48')](_0x3a8a20[_0x2327('0x49')],{})['then'](respondWithResult(_0x3d4845,0xc9))[_0x2327('0x44')](handleError(_0x3d4845,null));};exports[_0x2327('0x23')]=function(_0x5470ba,_0x1b3fd8){if(_0x5470ba[_0x2327('0x49')]['id']){delete _0x5470ba[_0x2327('0x49')]['id'];}return db[_0x2327('0x3f')][_0x2327('0x47')]({'where':{'id':_0x5470ba['params']['id']}})[_0x2327('0x24')](handleEntityNotFound(_0x1b3fd8,null))['then'](saveUpdates(_0x5470ba['body'],null))['then'](respondWithResult(_0x1b3fd8,null))[_0x2327('0x44')](handleError(_0x1b3fd8,null));};exports[_0x2327('0x25')]=function(_0x4d1ad9,_0x4e473d){return db[_0x2327('0x3f')][_0x2327('0x47')]({'where':{'id':_0x4d1ad9['params']['id']}})[_0x2327('0x24')](handleEntityNotFound(_0x4e473d,null))[_0x2327('0x24')](removeEntity(_0x4e473d,null))[_0x2327('0x44')](handleError(_0x4e473d,null));};exports['describe']=function(_0x537538,_0x5abc30){return db['MailSubstatus'][_0x2327('0x4a')]()[_0x2327('0x24')](respondWithResult(_0x5abc30,null))['catch'](handleError(_0x5abc30,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index c9418eb..ee01cf6 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 _0x9386=['rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x9386,0x155));var _0x6938=function(_0x1b2762,_0x32a4e3){_0x1b2762=_0x1b2762-0x0;var _0x45765f=_0x9386[_0x1b2762];return _0x45765f;};'use strict';var _=require(_0x6938('0x0'));var util=require(_0x6938('0x1'));var logger=require(_0x6938('0x2'))(_0x6938('0x3'));var moment=require('moment');var BPromise=require(_0x6938('0x4'));var rp=require(_0x6938('0x5'));var fs=require('fs');var path=require(_0x6938('0x6'));var rimraf=require(_0x6938('0x7'));var config=require(_0x6938('0x8'));var attributes=require(_0x6938('0x9'));module[_0x6938('0xa')]=function(_0x304d22,_0x1fc928){return _0x304d22[_0x6938('0xb')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9d9=['mail_substatuses','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailSubstatus'];(function(_0x533f37,_0x45d65b){var _0x3cf949=function(_0x482fac){while(--_0x482fac){_0x533f37['push'](_0x533f37['shift']());}};_0x3cf949(++_0x45d65b);}(_0xb9d9,0x17a));var _0x9b9d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb9d9[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9b9d('0x0'));var util=require(_0x9b9d('0x1'));var logger=require('../../config/logger')(_0x9b9d('0x2'));var moment=require(_0x9b9d('0x3'));var BPromise=require(_0x9b9d('0x4'));var rp=require(_0x9b9d('0x5'));var fs=require('fs');var path=require(_0x9b9d('0x6'));var rimraf=require(_0x9b9d('0x7'));var config=require(_0x9b9d('0x8'));var attributes=require('./mailSubstatus.attributes');module[_0x9b9d('0x9')]=function(_0x329863,_0x26c883){return _0x329863[_0x9b9d('0xa')](_0x9b9d('0xb'),attributes,{'tableName':_0x9b9d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 0328baf..64d6827 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 _0x6f01=['http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x6f01,0x1ee));var _0x16f0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6f01[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x16f0('0x0'));var util=require(_0x16f0('0x1'));var moment=require(_0x16f0('0x2'));var BPromise=require(_0x16f0('0x3'));var rs=require(_0x16f0('0x4'));var fs=require('fs');var Redis=require(_0x16f0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x16f0('0x6'))('rpc');var config=require(_0x16f0('0x7'));var jayson=require(_0x16f0('0x8'));var client=jayson[_0x16f0('0x9')][_0x16f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2267a8,_0x57d6e8,_0x2fa3a0){return new BPromise(function(_0x32ef26,_0x6c4f82){return client[_0x16f0('0xb')](_0x2267a8,_0x2fa3a0)[_0x16f0('0xc')](function(_0x5b9191){logger['info'](_0x16f0('0xd'),_0x57d6e8,_0x16f0('0xe'));logger[_0x16f0('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x57d6e8,_0x16f0('0xe'),JSON['stringify'](_0x5b9191));if(_0x5b9191[_0x16f0('0x10')]){if(_0x5b9191[_0x16f0('0x10')][_0x16f0('0x11')]===0x1f4){logger[_0x16f0('0x10')](_0x16f0('0xd'),_0x57d6e8,_0x5b9191[_0x16f0('0x10')][_0x16f0('0x12')]);return _0x6c4f82(_0x5b9191[_0x16f0('0x10')][_0x16f0('0x12')]);}logger['error'](_0x16f0('0xd'),_0x57d6e8,_0x5b9191['error']['message']);return _0x32ef26(_0x5b9191['error'][_0x16f0('0x12')]);}else{logger['info'](_0x16f0('0xd'),_0x57d6e8,_0x16f0('0xe'));_0x32ef26(_0x5b9191[_0x16f0('0x13')][_0x16f0('0x12')]);}})[_0x16f0('0x14')](function(_0x481bd9){logger['error'](_0x16f0('0xd'),_0x57d6e8,_0x481bd9);_0x6c4f82(_0x481bd9);});});} \ No newline at end of file +var _0xb90a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0x50e0e4,_0x56cb23){var _0x4e990c=function(_0x472fff){while(--_0x472fff){_0x50e0e4['push'](_0x50e0e4['shift']());}};_0x4e990c(++_0x56cb23);}(_0xb90a,0x88));var _0xab90=function(_0x2649be,_0x3fd86a){_0x2649be=_0x2649be-0x0;var _0x1593d4=_0xb90a[_0x2649be];return _0x1593d4;};'use strict';var _=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var moment=require(_0xab90('0x2'));var BPromise=require(_0xab90('0x3'));var rs=require(_0xab90('0x4'));var fs=require('fs');var Redis=require(_0xab90('0x5'));var db=require(_0xab90('0x6'))['db'];var utils=require(_0xab90('0x7'));var logger=require(_0xab90('0x8'))('rpc');var config=require(_0xab90('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xab90('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd442fe,_0x59520c,_0x1cc04a){return new BPromise(function(_0x4be620,_0x26e36a){return client[_0xab90('0xb')](_0xd442fe,_0x1cc04a)[_0xab90('0xc')](function(_0x7ca798){logger['info'](_0xab90('0xd'),_0x59520c,_0xab90('0xe'));logger[_0xab90('0xf')](_0xab90('0x10'),_0x59520c,_0xab90('0xe'),JSON[_0xab90('0x11')](_0x7ca798));if(_0x7ca798['error']){if(_0x7ca798[_0xab90('0x12')]['code']===0x1f4){logger[_0xab90('0x12')](_0xab90('0xd'),_0x59520c,_0x7ca798[_0xab90('0x12')][_0xab90('0x13')]);return _0x26e36a(_0x7ca798[_0xab90('0x12')]['message']);}logger[_0xab90('0x12')](_0xab90('0xd'),_0x59520c,_0x7ca798[_0xab90('0x12')][_0xab90('0x13')]);return _0x4be620(_0x7ca798[_0xab90('0x12')][_0xab90('0x13')]);}else{logger[_0xab90('0x14')](_0xab90('0xd'),_0x59520c,'request\x20sent');_0x4be620(_0x7ca798[_0xab90('0x15')]['message']);}})[_0xab90('0x16')](function(_0x2dad5b){logger['error'](_0xab90('0xd'),_0x59520c,_0x2dad5b);_0x26e36a(_0x2dad5b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e557361..18f527a 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 _0x12db=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xcdf7e1,_0x393d77){var _0x36deca=function(_0x19ca9b){while(--_0x19ca9b){_0xcdf7e1['push'](_0xcdf7e1['shift']());}};_0x36deca(++_0x393d77);}(_0x12db,0x1f4));var _0xb12d=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x12db[_0x590b61];return _0x1a14dc;};'use strict';var multer=require(_0xb12d('0x0'));var util=require(_0xb12d('0x1'));var path=require(_0xb12d('0x2'));var timeout=require(_0xb12d('0x3'));var express=require('express');var router=express[_0xb12d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb12d('0x5'));var interaction=require(_0xb12d('0x6'));var config=require(_0xb12d('0x7'));var controller=require(_0xb12d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb12d('0x9')]);router['get'](_0xb12d('0xa'),auth[_0xb12d('0xb')](),controller[_0xb12d('0xc')]);router['get']('/:id',auth[_0xb12d('0xb')](),controller[_0xb12d('0xd')]);router[_0xb12d('0xe')]('/',auth[_0xb12d('0xb')](),controller[_0xb12d('0xf')]);router['put'](_0xb12d('0x10'),auth['isAuthenticated'](),controller[_0xb12d('0x11')]);router[_0xb12d('0x12')](_0xb12d('0x10'),auth[_0xb12d('0xb')](),controller[_0xb12d('0x13')]);module[_0xb12d('0x14')]=router; \ No newline at end of file +var _0x6cc1=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','delete','destroy'];(function(_0x2b8722,_0x50d540){var _0x20c180=function(_0x595b40){while(--_0x595b40){_0x2b8722['push'](_0x2b8722['shift']());}};_0x20c180(++_0x50d540);}(_0x6cc1,0x18d));var _0x16cc=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0x6cc1[_0x32729c];return _0x482cfd;};'use strict';var multer=require(_0x16cc('0x0'));var util=require(_0x16cc('0x1'));var path=require(_0x16cc('0x2'));var timeout=require(_0x16cc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x16cc('0x4'));var auth=require(_0x16cc('0x5'));var interaction=require(_0x16cc('0x6'));var config=require(_0x16cc('0x7'));var controller=require(_0x16cc('0x8'));router[_0x16cc('0x9')]('/',auth[_0x16cc('0xa')](),controller[_0x16cc('0xb')]);router[_0x16cc('0x9')](_0x16cc('0xc'),auth['isAuthenticated'](),controller[_0x16cc('0xd')]);router['get'](_0x16cc('0xe'),auth[_0x16cc('0xa')](),controller['show']);router['post']('/',auth[_0x16cc('0xa')](),controller['create']);router['put'](_0x16cc('0xe'),auth[_0x16cc('0xa')](),controller['update']);router[_0x16cc('0xf')]('/:id',auth[_0x16cc('0xa')](),controller[_0x16cc('0x10')]);module[_0x16cc('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 75c32ec..8c25a10 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x422323,_0x404ab0){var _0x176187=function(_0x5b37b8){while(--_0x5b37b8){_0x422323['push'](_0x422323['shift']());}};_0x176187(++_0x404ab0);}(_0xedd9,0xfc));var _0x9edd=function(_0x3fcb97,_0x449ef5){_0x3fcb97=_0x3fcb97-0x0;var _0x3dd6d5=_0xedd9[_0x3fcb97];return _0x3dd6d5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4d9f50,_0x4a3c90){var _0x2023d7=function(_0x15bfa2){while(--_0x15bfa2){_0x4d9f50['push'](_0x4d9f50['shift']());}};_0x2023d7(++_0x4a3c90);}(_0xaa88,0x137));var _0x8aa8=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xaa88[_0x3e69ae];return _0x3d7f42;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index c5b28d4..03cd233 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 _0x26c8=['MailTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map'];(function(_0x468805,_0x2d2050){var _0x2bd6b3=function(_0x2f2adb){while(--_0x2f2adb){_0x468805['push'](_0x468805['shift']());}};_0x2bd6b3(++_0x2d2050);}(_0x26c8,0x183));var _0x826c=function(_0x56f8cc,_0x4dd6b9){_0x56f8cc=_0x56f8cc-0x0;var _0x2075e9=_0x26c8[_0x56f8cc];return _0x2075e9;};'use strict';var emlformat=require(_0x826c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x826c('0x1'));var moment=require(_0x826c('0x2'));var BPromise=require(_0x826c('0x3'));var Mustache=require(_0x826c('0x4'));var util=require('util');var path=require(_0x826c('0x5'));var sox=require(_0x826c('0x6'));var csv=require('to-csv');var ejs=require(_0x826c('0x7'));var fs=require('fs');var fs_extra=require(_0x826c('0x8'));var _=require(_0x826c('0x9'));var squel=require(_0x826c('0xa'));var crypto=require('crypto');var jsforce=require(_0x826c('0xb'));var deskjs=require(_0x826c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x826c('0xd'));var Papa=require(_0x826c('0xe'));var Redis=require(_0x826c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x826c('0x10'));var as=require(_0x826c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x826c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x826c('0x13'))['db'];function respondWithStatusCode(_0x30c4a9,_0x36656a){_0x36656a=_0x36656a||0xcc;return function(_0x3fe544){if(_0x3fe544){return _0x30c4a9[_0x826c('0x14')](_0x36656a);}return _0x30c4a9[_0x826c('0x15')](_0x36656a)[_0x826c('0x16')]();};}function respondWithResult(_0x41f312,_0x18c20c){_0x18c20c=_0x18c20c||0xc8;return function(_0x19c0a1){if(_0x19c0a1){return _0x41f312['status'](_0x18c20c)[_0x826c('0x17')](_0x19c0a1);}};}function respondWithFilteredResult(_0x23a8dd,_0x3da89b){return function(_0x4669c4){if(_0x4669c4){var _0x22a2f4=typeof _0x3da89b[_0x826c('0x18')]==='undefined'&&typeof _0x3da89b[_0x826c('0x19')]===_0x826c('0x1a');var _0x1ddb91=_0x4669c4[_0x826c('0x1b')];var _0x229aef=_0x22a2f4?0x0:_0x3da89b[_0x826c('0x18')];var _0x5a468f=_0x22a2f4?_0x4669c4[_0x826c('0x1b')]:_0x3da89b[_0x826c('0x18')]+_0x3da89b[_0x826c('0x19')];var _0x1f5dd0;if(_0x5a468f>=_0x1ddb91){_0x5a468f=_0x1ddb91;_0x1f5dd0=0xc8;}else{_0x1f5dd0=0xce;}_0x23a8dd[_0x826c('0x15')](_0x1f5dd0);return _0x23a8dd[_0x826c('0x1c')](_0x826c('0x1d'),_0x229aef+'-'+_0x5a468f+'/'+_0x1ddb91)[_0x826c('0x17')](_0x4669c4);}return null;};}function patchUpdates(_0x51d80b){return function(_0x50e73a){try{jsonpatch[_0x826c('0x1e')](_0x50e73a,_0x51d80b,!![]);}catch(_0x22a452){return BPromise[_0x826c('0x1f')](_0x22a452);}return _0x50e73a['save']();};}function saveUpdates(_0x386e57,_0x38762f){return function(_0x2d1e32){if(_0x2d1e32){return _0x2d1e32[_0x826c('0x20')](_0x386e57)['then'](function(_0x3478c4){return _0x3478c4;});}return null;};}function removeEntity(_0x1115a7,_0x1ab90c){return function(_0x5d1ac9){if(_0x5d1ac9){return _0x5d1ac9[_0x826c('0x21')]()['then'](function(){_0x1115a7[_0x826c('0x15')](0xcc)[_0x826c('0x16')]();});}};}function handleEntityNotFound(_0x5b96ce,_0x576831){return function(_0x1f530f){if(!_0x1f530f){_0x5b96ce[_0x826c('0x14')](0x194);}return _0x1f530f;};}function handleError(_0x3dd0ed,_0x2c2ac8){_0x2c2ac8=_0x2c2ac8||0x1f4;return function(_0x5cd4c5){logger['error'](_0x5cd4c5[_0x826c('0x22')]);if(_0x5cd4c5[_0x826c('0x23')]){delete _0x5cd4c5[_0x826c('0x23')];}_0x3dd0ed[_0x826c('0x15')](_0x2c2ac8)[_0x826c('0x24')](_0x5cd4c5);};}exports[_0x826c('0x25')]=function(_0x41b9c1,_0x3b0b7b){var _0x4f22bc={},_0x47b13b={},_0x435db8={'count':0x0,'rows':[]};var _0x4c509d=_[_0x826c('0x26')](db[_0x826c('0x27')][_0x826c('0x28')],function(_0x1de339){return{'name':_0x1de339[_0x826c('0x29')],'type':_0x1de339['type']['key']};});_0x47b13b[_0x826c('0x2a')]=_['map'](_0x4c509d,_0x826c('0x23'));_0x47b13b[_0x826c('0x2b')]=_[_0x826c('0x2c')](_0x41b9c1[_0x826c('0x2b')]);_0x47b13b[_0x826c('0x2d')]=_[_0x826c('0x2e')](_0x47b13b['model'],_0x47b13b['query']);_0x4f22bc['attributes']=_[_0x826c('0x2e')](_0x47b13b['model'],qs[_0x826c('0x2f')](_0x41b9c1[_0x826c('0x2b')]['fields']));_0x4f22bc['attributes']=_0x4f22bc[_0x826c('0x30')][_0x826c('0x31')]?_0x4f22bc[_0x826c('0x30')]:_0x47b13b[_0x826c('0x2a')];if(!_0x41b9c1[_0x826c('0x2b')][_0x826c('0x32')](_0x826c('0x33'))){_0x4f22bc[_0x826c('0x19')]=qs['limit'](_0x41b9c1[_0x826c('0x2b')][_0x826c('0x19')]);_0x4f22bc[_0x826c('0x18')]=qs[_0x826c('0x18')](_0x41b9c1['query']['offset']);}_0x4f22bc[_0x826c('0x34')]=qs[_0x826c('0x35')](_0x41b9c1[_0x826c('0x2b')][_0x826c('0x35')]);_0x4f22bc['where']=qs[_0x826c('0x2d')](_[_0x826c('0x36')](_0x41b9c1[_0x826c('0x2b')],_0x47b13b[_0x826c('0x2d')]),_0x4c509d);if(_0x41b9c1[_0x826c('0x2b')]['filter']){_0x4f22bc[_0x826c('0x37')]=_[_0x826c('0x38')](_0x4f22bc['where'],{'$or':_[_0x826c('0x26')](_0x4c509d,function(_0x1d16c1){if(_0x1d16c1['type']!==_0x826c('0x39')){var _0x1ba96a={};_0x1ba96a[_0x1d16c1['name']]={'$like':'%'+_0x41b9c1['query'][_0x826c('0x3a')]+'%'};return _0x1ba96a;}})});}_0x4f22bc=_['merge']({},_0x4f22bc,_0x41b9c1[_0x826c('0x3b')]);var _0x22a61c={'where':_0x4f22bc['where']};return db[_0x826c('0x27')][_0x826c('0x1b')](_0x22a61c)[_0x826c('0x3c')](function(_0x541c18){_0x435db8[_0x826c('0x1b')]=_0x541c18;if(_0x41b9c1['query'][_0x826c('0x3d')]){_0x4f22bc[_0x826c('0x3e')]=[{'all':!![]}];}return db[_0x826c('0x27')][_0x826c('0x3f')](_0x4f22bc);})['then'](function(_0x4316c8){_0x435db8[_0x826c('0x40')]=_0x4316c8;return _0x435db8;})['then'](respondWithFilteredResult(_0x3b0b7b,_0x4f22bc))[_0x826c('0x41')](handleError(_0x3b0b7b,null));};exports['show']=function(_0x2133f5,_0x17d067){var _0x139739={'raw':!![],'where':{'id':_0x2133f5[_0x826c('0x42')]['id']}},_0xc867d0={};_0xc867d0['model']=_[_0x826c('0x2c')](db[_0x826c('0x27')][_0x826c('0x28')]);_0xc867d0['query']=_[_0x826c('0x2c')](_0x2133f5[_0x826c('0x2b')]);_0xc867d0[_0x826c('0x2d')]=_[_0x826c('0x2e')](_0xc867d0['model'],_0xc867d0[_0x826c('0x2b')]);_0x139739[_0x826c('0x30')]=_[_0x826c('0x2e')](_0xc867d0[_0x826c('0x2a')],qs['fields'](_0x2133f5[_0x826c('0x2b')][_0x826c('0x2f')]));_0x139739['attributes']=_0x139739[_0x826c('0x30')][_0x826c('0x31')]?_0x139739['attributes']:_0xc867d0[_0x826c('0x2a')];if(_0x2133f5[_0x826c('0x2b')][_0x826c('0x3d')]){_0x139739[_0x826c('0x3e')]=[{'all':!![]}];}_0x139739=_['merge']({},_0x139739,_0x2133f5[_0x826c('0x3b')]);return db[_0x826c('0x27')][_0x826c('0x43')](_0x139739)[_0x826c('0x3c')](handleEntityNotFound(_0x17d067,null))['then'](respondWithResult(_0x17d067,null))[_0x826c('0x41')](handleError(_0x17d067,null));};exports[_0x826c('0x44')]=function(_0x447b65,_0x3dab80){return db[_0x826c('0x27')]['create'](_0x447b65[_0x826c('0x45')],{})['then'](respondWithResult(_0x3dab80,0xc9))[_0x826c('0x41')](handleError(_0x3dab80,null));};exports['update']=function(_0x34ec1e,_0x20743d){if(_0x34ec1e[_0x826c('0x45')]['id']){delete _0x34ec1e[_0x826c('0x45')]['id'];}return db[_0x826c('0x27')][_0x826c('0x43')]({'where':{'id':_0x34ec1e['params']['id']}})[_0x826c('0x3c')](handleEntityNotFound(_0x20743d,null))[_0x826c('0x3c')](saveUpdates(_0x34ec1e['body'],null))[_0x826c('0x3c')](respondWithResult(_0x20743d,null))[_0x826c('0x41')](handleError(_0x20743d,null));};exports['destroy']=function(_0xcacd70,_0x5d0e61){return db[_0x826c('0x27')]['find']({'where':{'id':_0xcacd70['params']['id']}})[_0x826c('0x3c')](handleEntityNotFound(_0x5d0e61,null))['then'](removeEntity(_0x5d0e61,null))['catch'](handleError(_0x5d0e61,null));};exports[_0x826c('0x46')]=function(_0xf029b6,_0x12d0c8){return db[_0x826c('0x27')][_0x826c('0x46')]()[_0x826c('0x3c')](respondWithResult(_0x12d0c8,null))[_0x826c('0x41')](handleError(_0x12d0c8,null));}; \ No newline at end of file +var _0x546c=['index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x271f33,_0x2b5caa){var _0x220c1e=function(_0x266ae6){while(--_0x266ae6){_0x271f33['push'](_0x271f33['shift']());}};_0x220c1e(++_0x2b5caa);}(_0x546c,0x19a));var _0xc546=function(_0x21d9d6,_0x58c02f){_0x21d9d6=_0x21d9d6-0x0;var _0x36ba48=_0x546c[_0x21d9d6];return _0x36ba48;};'use strict';var emlformat=require(_0xc546('0x0'));var rimraf=require(_0xc546('0x1'));var zipdir=require(_0xc546('0x2'));var jsonpatch=require(_0xc546('0x3'));var rp=require(_0xc546('0x4'));var moment=require(_0xc546('0x5'));var BPromise=require(_0xc546('0x6'));var Mustache=require(_0xc546('0x7'));var util=require(_0xc546('0x8'));var path=require(_0xc546('0x9'));var sox=require(_0xc546('0xa'));var csv=require(_0xc546('0xb'));var ejs=require(_0xc546('0xc'));var fs=require('fs');var fs_extra=require(_0xc546('0xd'));var _=require(_0xc546('0xe'));var squel=require('squel');var crypto=require(_0xc546('0xf'));var jsforce=require(_0xc546('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc546('0xb'));var querystring=require(_0xc546('0x11'));var Papa=require(_0xc546('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc546('0x13'));var as=require(_0xc546('0x14'));var hardwareService=require(_0xc546('0x15'));var logger=require('../../config/logger')(_0xc546('0x16'));var utils=require(_0xc546('0x17'));var config=require(_0xc546('0x18'));var licenseUtil=require(_0xc546('0x19'));var db=require(_0xc546('0x1a'))['db'];function respondWithStatusCode(_0x53150a,_0x3be0e3){_0x3be0e3=_0x3be0e3||0xcc;return function(_0x1bb3e8){if(_0x1bb3e8){return _0x53150a['sendStatus'](_0x3be0e3);}return _0x53150a[_0xc546('0x1b')](_0x3be0e3)[_0xc546('0x1c')]();};}function respondWithResult(_0x48995c,_0x46bc22){_0x46bc22=_0x46bc22||0xc8;return function(_0x5b15f1){if(_0x5b15f1){return _0x48995c[_0xc546('0x1b')](_0x46bc22)[_0xc546('0x1d')](_0x5b15f1);}};}function respondWithFilteredResult(_0x1fef87,_0x85c5d2){return function(_0x565c7d){if(_0x565c7d){var _0x5ab25d=typeof _0x85c5d2[_0xc546('0x1e')]===_0xc546('0x1f')&&typeof _0x85c5d2[_0xc546('0x20')]===_0xc546('0x1f');var _0x4f1fcc=_0x565c7d['count'];var _0x4c20b8=_0x5ab25d?0x0:_0x85c5d2[_0xc546('0x1e')];var _0x37ac0b=_0x5ab25d?_0x565c7d[_0xc546('0x21')]:_0x85c5d2[_0xc546('0x1e')]+_0x85c5d2[_0xc546('0x20')];var _0x433663;if(_0x37ac0b>=_0x4f1fcc){_0x37ac0b=_0x4f1fcc;_0x433663=0xc8;}else{_0x433663=0xce;}_0x1fef87['status'](_0x433663);return _0x1fef87[_0xc546('0x22')](_0xc546('0x23'),_0x4c20b8+'-'+_0x37ac0b+'/'+_0x4f1fcc)['json'](_0x565c7d);}return null;};}function patchUpdates(_0x1a1085){return function(_0x39ab20){try{jsonpatch[_0xc546('0x24')](_0x39ab20,_0x1a1085,!![]);}catch(_0x559cb1){return BPromise[_0xc546('0x25')](_0x559cb1);}return _0x39ab20[_0xc546('0x26')]();};}function saveUpdates(_0x6c3e58,_0x1d666e){return function(_0x315695){if(_0x315695){return _0x315695[_0xc546('0x27')](_0x6c3e58)[_0xc546('0x28')](function(_0x456739){return _0x456739;});}return null;};}function removeEntity(_0xe7a78a,_0x4f8798){return function(_0x4921f8){if(_0x4921f8){return _0x4921f8[_0xc546('0x29')]()[_0xc546('0x28')](function(){_0xe7a78a[_0xc546('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c688c,_0x93d5f){return function(_0x1eaf85){if(!_0x1eaf85){_0x2c688c['sendStatus'](0x194);}return _0x1eaf85;};}function handleError(_0x142bb0,_0x33058c){_0x33058c=_0x33058c||0x1f4;return function(_0x449bfa){logger[_0xc546('0x2a')](_0x449bfa[_0xc546('0x2b')]);if(_0x449bfa['name']){delete _0x449bfa[_0xc546('0x2c')];}_0x142bb0['status'](_0x33058c)[_0xc546('0x2d')](_0x449bfa);};}exports[_0xc546('0x2e')]=function(_0x21362c,_0x2163a1){var _0x3c5199={},_0x4ff53e={},_0x91895c={'count':0x0,'rows':[]};var _0x576b64=_[_0xc546('0x2f')](db[_0xc546('0x30')][_0xc546('0x31')],function(_0x19d062){return{'name':_0x19d062[_0xc546('0x32')],'type':_0x19d062[_0xc546('0x33')]['key']};});_0x4ff53e[_0xc546('0x34')]=_[_0xc546('0x2f')](_0x576b64,_0xc546('0x2c'));_0x4ff53e[_0xc546('0x35')]=_[_0xc546('0x36')](_0x21362c[_0xc546('0x35')]);_0x4ff53e[_0xc546('0x37')]=_[_0xc546('0x38')](_0x4ff53e[_0xc546('0x34')],_0x4ff53e[_0xc546('0x35')]);_0x3c5199[_0xc546('0x39')]=_[_0xc546('0x38')](_0x4ff53e[_0xc546('0x34')],qs['fields'](_0x21362c['query'][_0xc546('0x3a')]));_0x3c5199[_0xc546('0x39')]=_0x3c5199[_0xc546('0x39')][_0xc546('0x3b')]?_0x3c5199['attributes']:_0x4ff53e[_0xc546('0x34')];if(!_0x21362c['query']['hasOwnProperty']('nolimit')){_0x3c5199[_0xc546('0x20')]=qs[_0xc546('0x20')](_0x21362c[_0xc546('0x35')][_0xc546('0x20')]);_0x3c5199[_0xc546('0x1e')]=qs[_0xc546('0x1e')](_0x21362c[_0xc546('0x35')][_0xc546('0x1e')]);}_0x3c5199['order']=qs[_0xc546('0x3c')](_0x21362c['query']['sort']);_0x3c5199['where']=qs[_0xc546('0x37')](_['pick'](_0x21362c[_0xc546('0x35')],_0x4ff53e[_0xc546('0x37')]),_0x576b64);if(_0x21362c[_0xc546('0x35')][_0xc546('0x3d')]){_0x3c5199['where']=_[_0xc546('0x3e')](_0x3c5199['where'],{'$or':_['map'](_0x576b64,function(_0x1d349a){if(_0x1d349a[_0xc546('0x33')]!==_0xc546('0x3f')){var _0x47e92e={};_0x47e92e[_0x1d349a['name']]={'$like':'%'+_0x21362c['query']['filter']+'%'};return _0x47e92e;}})});}_0x3c5199=_[_0xc546('0x3e')]({},_0x3c5199,_0x21362c['options']);var _0x43ff7f={'where':_0x3c5199['where']};return db[_0xc546('0x30')]['count'](_0x43ff7f)[_0xc546('0x28')](function(_0xc0da5d){_0x91895c[_0xc546('0x21')]=_0xc0da5d;if(_0x21362c[_0xc546('0x35')][_0xc546('0x40')]){_0x3c5199[_0xc546('0x41')]=[{'all':!![]}];}return db[_0xc546('0x30')][_0xc546('0x42')](_0x3c5199);})[_0xc546('0x28')](function(_0x25c6f3){_0x91895c[_0xc546('0x43')]=_0x25c6f3;return _0x91895c;})[_0xc546('0x28')](respondWithFilteredResult(_0x2163a1,_0x3c5199))[_0xc546('0x44')](handleError(_0x2163a1,null));};exports[_0xc546('0x45')]=function(_0x43cade,_0x127c48){var _0x3a78ff={'raw':!![],'where':{'id':_0x43cade[_0xc546('0x46')]['id']}},_0x48b557={};_0x48b557[_0xc546('0x34')]=_[_0xc546('0x36')](db['MailTransferReport']['rawAttributes']);_0x48b557[_0xc546('0x35')]=_[_0xc546('0x36')](_0x43cade[_0xc546('0x35')]);_0x48b557[_0xc546('0x37')]=_[_0xc546('0x38')](_0x48b557[_0xc546('0x34')],_0x48b557[_0xc546('0x35')]);_0x3a78ff[_0xc546('0x39')]=_[_0xc546('0x38')](_0x48b557[_0xc546('0x34')],qs['fields'](_0x43cade['query'][_0xc546('0x3a')]));_0x3a78ff[_0xc546('0x39')]=_0x3a78ff['attributes'][_0xc546('0x3b')]?_0x3a78ff[_0xc546('0x39')]:_0x48b557[_0xc546('0x34')];if(_0x43cade[_0xc546('0x35')][_0xc546('0x40')]){_0x3a78ff[_0xc546('0x41')]=[{'all':!![]}];}_0x3a78ff=_[_0xc546('0x3e')]({},_0x3a78ff,_0x43cade[_0xc546('0x47')]);return db[_0xc546('0x30')][_0xc546('0x48')](_0x3a78ff)[_0xc546('0x28')](handleEntityNotFound(_0x127c48,null))['then'](respondWithResult(_0x127c48,null))[_0xc546('0x44')](handleError(_0x127c48,null));};exports[_0xc546('0x49')]=function(_0x25ecf8,_0xe1aed4){return db[_0xc546('0x30')]['create'](_0x25ecf8[_0xc546('0x4a')],{})['then'](respondWithResult(_0xe1aed4,0xc9))[_0xc546('0x44')](handleError(_0xe1aed4,null));};exports[_0xc546('0x27')]=function(_0xa0b9fb,_0x4df065){if(_0xa0b9fb[_0xc546('0x4a')]['id']){delete _0xa0b9fb[_0xc546('0x4a')]['id'];}return db[_0xc546('0x30')][_0xc546('0x48')]({'where':{'id':_0xa0b9fb[_0xc546('0x46')]['id']}})['then'](handleEntityNotFound(_0x4df065,null))[_0xc546('0x28')](saveUpdates(_0xa0b9fb['body'],null))[_0xc546('0x28')](respondWithResult(_0x4df065,null))[_0xc546('0x44')](handleError(_0x4df065,null));};exports[_0xc546('0x29')]=function(_0x4754ed,_0x38992e){return db['MailTransferReport'][_0xc546('0x48')]({'where':{'id':_0x4754ed[_0xc546('0x46')]['id']}})['then'](handleEntityNotFound(_0x38992e,null))[_0xc546('0x28')](removeEntity(_0x38992e,null))['catch'](handleError(_0x38992e,null));};exports[_0xc546('0x4b')]=function(_0x53bb65,_0x6af8f4){return db[_0xc546('0x30')]['describe']()[_0xc546('0x28')](respondWithResult(_0x6af8f4,null))['catch'](handleError(_0x6af8f4,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 45fe9ce..9bef643 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 _0x6379=['lodash','util','../../config/logger','api','moment','request-promise','path','./mailTransferReport.attributes','exports','define','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6379,0x84));var _0x9637=function(_0x2a885a,_0x4c083d){_0x2a885a=_0x2a885a-0x0;var _0x3756f1=_0x6379[_0x2a885a];return _0x3756f1;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var logger=require(_0x9637('0x2'))(_0x9637('0x3'));var moment=require(_0x9637('0x4'));var BPromise=require('bluebird');var rp=require(_0x9637('0x5'));var fs=require('fs');var path=require(_0x9637('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9637('0x7'));module[_0x9637('0x8')]=function(_0x19f7d0,_0x25087c){return _0x19f7d0[_0x9637('0x9')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x9637('0xa'),'fields':[_0x9637('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x982c=['path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','moment','bluebird'];(function(_0x3da625,_0x4ade48){var _0x59bd9e=function(_0x20389e){while(--_0x20389e){_0x3da625['push'](_0x3da625['shift']());}};_0x59bd9e(++_0x4ade48);}(_0x982c,0xd9));var _0xc982=function(_0x6052ae,_0xac25e){_0x6052ae=_0x6052ae-0x0;var _0x104fcb=_0x982c[_0x6052ae];return _0x104fcb;};'use strict';var _=require('lodash');var util=require(_0xc982('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc982('0x1'));var BPromise=require(_0xc982('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc982('0x3'));var rimraf=require(_0xc982('0x4'));var config=require(_0xc982('0x5'));var attributes=require('./mailTransferReport.attributes');module[_0xc982('0x6')]=function(_0x56b56f,_0x5ad398){return _0x56b56f[_0xc982('0x7')](_0xc982('0x8'),attributes,{'tableName':_0xc982('0x9'),'paranoid':![],'indexes':[{'name':_0xc982('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 6bb99a7..ffe3f03 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 _0xf546=['jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x20f976,_0x1563e9){var _0x337f0a=function(_0x1d14e1){while(--_0x1d14e1){_0x20f976['push'](_0x20f976['shift']());}};_0x337f0a(++_0x1563e9);}(_0xf546,0x166));var _0x6f54=function(_0x55cadd,_0x2e4237){_0x55cadd=_0x55cadd-0x0;var _0x9738e6=_0xf546[_0x55cadd];return _0x9738e6;};'use strict';var _=require(_0x6f54('0x0'));var util=require(_0x6f54('0x1'));var moment=require(_0x6f54('0x2'));var BPromise=require(_0x6f54('0x3'));var rs=require(_0x6f54('0x4'));var fs=require('fs');var Redis=require(_0x6f54('0x5'));var db=require(_0x6f54('0x6'))['db'];var utils=require(_0x6f54('0x7'));var logger=require(_0x6f54('0x8'))('rpc');var config=require(_0x6f54('0x9'));var jayson=require(_0x6f54('0xa'));var client=jayson[_0x6f54('0xb')][_0x6f54('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7d5b95,_0x5f48fe,_0x1e67ab){return new BPromise(function(_0x2d2fb3,_0x421015){return client[_0x6f54('0xd')](_0x7d5b95,_0x1e67ab)['then'](function(_0x4183c9){logger[_0x6f54('0xe')](_0x6f54('0xf'),_0x5f48fe,_0x6f54('0x10'));logger[_0x6f54('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5f48fe,_0x6f54('0x10'),JSON['stringify'](_0x4183c9));if(_0x4183c9[_0x6f54('0x12')]){if(_0x4183c9[_0x6f54('0x12')][_0x6f54('0x13')]===0x1f4){logger[_0x6f54('0x12')](_0x6f54('0xf'),_0x5f48fe,_0x4183c9[_0x6f54('0x12')][_0x6f54('0x14')]);return _0x421015(_0x4183c9[_0x6f54('0x12')][_0x6f54('0x14')]);}logger[_0x6f54('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x5f48fe,_0x4183c9['error'][_0x6f54('0x14')]);return _0x2d2fb3(_0x4183c9[_0x6f54('0x12')][_0x6f54('0x14')]);}else{logger[_0x6f54('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x5f48fe,'request\x20sent');_0x2d2fb3(_0x4183c9[_0x6f54('0x15')]['message']);}})[_0x6f54('0x16')](function(_0x35e28d){logger['error'](_0x6f54('0xf'),_0x5f48fe,_0x35e28d);_0x421015(_0x35e28d);});});} \ No newline at end of file +var _0xcec0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x64faf7,_0x7edeca){var _0x28a7c9=function(_0x4990c1){while(--_0x4990c1){_0x64faf7['push'](_0x64faf7['shift']());}};_0x28a7c9(++_0x7edeca);}(_0xcec0,0x1ca));var _0x0cec=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xcec0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0cec('0x0'));var util=require('util');var moment=require(_0x0cec('0x1'));var BPromise=require(_0x0cec('0x2'));var rs=require(_0x0cec('0x3'));var fs=require('fs');var Redis=require(_0x0cec('0x4'));var db=require(_0x0cec('0x5'))['db'];var utils=require(_0x0cec('0x6'));var logger=require(_0x0cec('0x7'))(_0x0cec('0x8'));var config=require(_0x0cec('0x9'));var jayson=require(_0x0cec('0xa'));var client=jayson[_0x0cec('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19d028,_0x10572a,_0x4dc1a9){return new BPromise(function(_0x3186d7,_0x401179){return client[_0x0cec('0xc')](_0x19d028,_0x4dc1a9)['then'](function(_0x1f905c){logger['info'](_0x0cec('0xd'),_0x10572a,_0x0cec('0xe'));logger[_0x0cec('0xf')](_0x0cec('0x10'),_0x10572a,'request\x20sent',JSON[_0x0cec('0x11')](_0x1f905c));if(_0x1f905c[_0x0cec('0x12')]){if(_0x1f905c[_0x0cec('0x12')]['code']===0x1f4){logger[_0x0cec('0x12')](_0x0cec('0xd'),_0x10572a,_0x1f905c[_0x0cec('0x12')][_0x0cec('0x13')]);return _0x401179(_0x1f905c['error']['message']);}logger[_0x0cec('0x12')](_0x0cec('0xd'),_0x10572a,_0x1f905c['error'][_0x0cec('0x13')]);return _0x3186d7(_0x1f905c[_0x0cec('0x12')][_0x0cec('0x13')]);}else{logger[_0x0cec('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x10572a,_0x0cec('0xe'));_0x3186d7(_0x1f905c['result']['message']);}})[_0x0cec('0x15')](function(_0x2a30f7){logger[_0x0cec('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x10572a,_0x2a30f7);_0x401179(_0x2a30f7);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b223277..c86169f 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 _0x1d8c=['/describe','isAuthenticated','describe','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','./memberReport.controller','get'];(function(_0x59b8d7,_0x24cc29){var _0x394d86=function(_0x55903f){while(--_0x55903f){_0x59b8d7['push'](_0x59b8d7['shift']());}};_0x394d86(++_0x24cc29);}(_0x1d8c,0x9f));var _0xc1d8=function(_0x35a1d3,_0x3900a9){_0x35a1d3=_0x35a1d3-0x0;var _0x791a56=_0x1d8c[_0x35a1d3];return _0x791a56;};'use strict';var multer=require('multer');var util=require(_0xc1d8('0x0'));var path=require(_0xc1d8('0x1'));var timeout=require(_0xc1d8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc1d8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc1d8('0x4'));router[_0xc1d8('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc1d8('0x5')](_0xc1d8('0x6'),auth[_0xc1d8('0x7')](),controller[_0xc1d8('0x8')]);router[_0xc1d8('0x5')]('/:id',auth[_0xc1d8('0x7')](),controller['show']);router['post']('/',auth[_0xc1d8('0x7')](),controller['create']);router[_0xc1d8('0x9')](_0xc1d8('0xa'),auth['isAuthenticated'](),controller[_0xc1d8('0xb')]);router[_0xc1d8('0xc')](_0xc1d8('0xa'),auth['isAuthenticated'](),controller[_0xc1d8('0xd')]);module[_0xc1d8('0xe')]=router; \ No newline at end of file +var _0x574f=['post','put','update','delete','destroy','multer','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x229681,_0x3d7c3c){var _0x3f0544=function(_0x27193c){while(--_0x27193c){_0x229681['push'](_0x229681['shift']());}};_0x3f0544(++_0x3d7c3c);}(_0x574f,0x95));var _0xf574=function(_0xfafea,_0x66895){_0xfafea=_0xfafea-0x0;var _0x37cc09=_0x574f[_0xfafea];return _0x37cc09;};'use strict';var multer=require(_0xf574('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf574('0x1'));var express=require('express');var router=express[_0xf574('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf574('0x3'));var controller=require('./memberReport.controller');router[_0xf574('0x4')]('/',auth[_0xf574('0x5')](),controller[_0xf574('0x6')]);router[_0xf574('0x4')](_0xf574('0x7'),auth[_0xf574('0x5')](),controller[_0xf574('0x8')]);router['get'](_0xf574('0x9'),auth['isAuthenticated'](),controller[_0xf574('0xa')]);router[_0xf574('0xb')]('/',auth[_0xf574('0x5')](),controller['create']);router[_0xf574('0xc')](_0xf574('0x9'),auth[_0xf574('0x5')](),controller[_0xf574('0xd')]);router[_0xf574('0xe')]('/:id',auth[_0xf574('0x5')](),controller[_0xf574('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index d7a8ccb..60de41e 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 _0x4e83=['talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0xd37fe7,_0x4065be){var _0x21ae34=function(_0x4600e9){while(--_0x4600e9){_0xd37fe7['push'](_0xd37fe7['shift']());}};_0x21ae34(++_0x4065be);}(_0x4e83,0x88));var _0x34e8=function(_0x534a4b,_0x44c67a){_0x534a4b=_0x534a4b-0x0;var _0x311ed6=_0x4e83[_0x534a4b];return _0x311ed6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x34e8('0x0'));module[_0x34e8('0x1')]={'channel':{'type':Sequelize[_0x34e8('0x2')]},'membername':{'type':Sequelize[_0x34e8('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x34e8('0x2')],'defaultValue':_0x34e8('0x3'),'comment':_0x34e8('0x4')},'duration':{'type':Sequelize[_0x34e8('0x5')]},'enterAt':{'type':Sequelize[_0x34e8('0x6')]},'exitAt':{'type':Sequelize[_0x34e8('0x6')],'set':function(_0x1017db){var _0x38d4e0=moment(_0x1017db);var _0x320b00=moment(this[_0x34e8('0x7')](_0x34e8('0x8')));var _0x18e178=_0x38d4e0[_0x34e8('0x9')](_0x320b00,'seconds');this[_0x34e8('0xa')](_0x34e8('0xb'),_0x1017db);this[_0x34e8('0xa')]('duration',_0x18e178||null);}},'data1':{'type':Sequelize[_0x34e8('0x2')],'comment':_0x34e8('0xc')},'data2':{'type':Sequelize[_0x34e8('0x2')],'comment':_0x34e8('0xd')},'data3':{'type':Sequelize[_0x34e8('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x34e8('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x34e8('0x2')],'comment':_0x34e8('0xe')},'role':{'type':Sequelize[_0x34e8('0x2')]},'internal':{'type':Sequelize[_0x34e8('0x5')]},'uniqueid':{'type':Sequelize[_0x34e8('0x2')]}}; \ No newline at end of file +var _0xf403=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','setDataValue','exitAt'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xf403,0x1d3));var _0x3f40=function(_0x58ea15,_0x5056d4){_0x58ea15=_0x58ea15-0x0;var _0x52d2f9=_0xf403[_0x58ea15];return _0x52d2f9;};'use strict';var Sequelize=require(_0x3f40('0x0'));var moment=require('moment');module[_0x3f40('0x1')]={'channel':{'type':Sequelize[_0x3f40('0x2')]},'membername':{'type':Sequelize[_0x3f40('0x2')]},'interface':{'type':Sequelize[_0x3f40('0x2')]},'type':{'type':Sequelize[_0x3f40('0x2')],'defaultValue':_0x3f40('0x3'),'comment':_0x3f40('0x4')},'duration':{'type':Sequelize[_0x3f40('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x33f742){var _0x22d5e6=moment(_0x33f742);var _0x24fb9e=moment(this[_0x3f40('0x6')]('enterAt'));var _0x1dffe8=_0x22d5e6['diff'](_0x24fb9e,'seconds');this[_0x3f40('0x7')](_0x3f40('0x8'),_0x33f742);this[_0x3f40('0x7')]('duration',_0x1dffe8||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x3f40('0x9')},'data2':{'type':Sequelize[_0x3f40('0x2')],'comment':_0x3f40('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0x3f40('0xb')},'data4':{'type':Sequelize[_0x3f40('0x2')],'comment':_0x3f40('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0x3f40('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x3f40('0x5')]},'uniqueid':{'type':Sequelize[_0x3f40('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index eb40159..521f245 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x1c43a4,_0x260754){var _0x3ef1d2=function(_0x5abb7d){while(--_0x5abb7d){_0x1c43a4['push'](_0x1c43a4['shift']());}};_0x3ef1d2(++_0x260754);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x34e8,0x12c));var _0x834e=function(_0x52da5,_0x84abfd){_0x52da5=_0x52da5-0x0;var _0x43edbb=_0x34e8[_0x52da5];return _0x43edbb;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index f29964c..5335e96 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 _0x4b72=['request-promise','path','../../config/environment','./memberReport.attributes','MemberReport','report_member','membername_interface','membername','interface','lodash','util','moment','bluebird'];(function(_0x2a6849,_0x31e00d){var _0x3cb548=function(_0x5771a3){while(--_0x5771a3){_0x2a6849['push'](_0x2a6849['shift']());}};_0x3cb548(++_0x31e00d);}(_0x4b72,0x1ea));var _0x24b7=function(_0xc2bf,_0x2ae7a3){_0xc2bf=_0xc2bf-0x0;var _0x2f3db1=_0x4b72[_0xc2bf];return _0x2f3db1;};'use strict';var _=require(_0x24b7('0x0'));var util=require(_0x24b7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x24b7('0x2'));var BPromise=require(_0x24b7('0x3'));var rp=require(_0x24b7('0x4'));var fs=require('fs');var path=require(_0x24b7('0x5'));var rimraf=require('rimraf');var config=require(_0x24b7('0x6'));var attributes=require(_0x24b7('0x7'));module['exports']=function(_0x42d4db,_0x560aab){return _0x42d4db['define'](_0x24b7('0x8'),attributes,{'tableName':_0x24b7('0x9'),'paranoid':![],'indexes':[{'name':_0x24b7('0xa'),'fields':[_0x24b7('0xb'),_0x24b7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5914=['./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0x5914,0x198));var _0x4591=function(_0x4af898,_0x319230){_0x4af898=_0x4af898-0x0;var _0x4820b7=_0x5914[_0x4af898];return _0x4820b7;};'use strict';var _=require(_0x4591('0x0'));var util=require('util');var logger=require(_0x4591('0x1'))(_0x4591('0x2'));var moment=require(_0x4591('0x3'));var BPromise=require(_0x4591('0x4'));var rp=require(_0x4591('0x5'));var fs=require('fs');var path=require(_0x4591('0x6'));var rimraf=require(_0x4591('0x7'));var config=require('../../config/environment');var attributes=require(_0x4591('0x8'));module[_0x4591('0x9')]=function(_0x558d8d,_0x1e6bed){return _0x558d8d[_0x4591('0xa')](_0x4591('0xb'),attributes,{'tableName':_0x4591('0xc'),'paranoid':![],'indexes':[{'name':_0x4591('0xd'),'fields':[_0x4591('0xe'),_0x4591('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index a18af29..9dad0f4 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 _0xa6b0=['message','result','catch','findAll','options','raw','attributes','limit','include','map','then','GetMemberReport','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x9f9de0,_0x52b90c){var _0x298c57=function(_0xeb59db){while(--_0xeb59db){_0x9f9de0['push'](_0x9f9de0['shift']());}};_0x298c57(++_0x52b90c);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x5b7ef6,_0x4d2cf9){_0x5b7ef6=_0x5b7ef6-0x0;var _0xa3bbc8=_0xa6b0[_0x5b7ef6];return _0xa3bbc8;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5fb5,_0xa908dd,_0x26f761){return new BPromise(function(_0x340a33,_0x8e89f){return client[_0x0a6b('0xb')](_0x1b5fb5,_0x26f761)['then'](function(_0x493948){logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));logger[_0x0a6b('0xf')](_0x0a6b('0x10'),_0xa908dd,_0x0a6b('0xe'),JSON[_0x0a6b('0x11')](_0x493948));if(_0x493948[_0x0a6b('0x12')]){if(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x13')]===0x1f4){logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x8e89f(_0x493948['error']['message']);}logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x340a33(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);}else{logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));_0x340a33(_0x493948[_0x0a6b('0x15')]['message']);}})[_0x0a6b('0x16')](function(_0x1538f4){logger['error'](_0x0a6b('0xd'),_0xa908dd,_0x1538f4);_0x8e89f(_0x1538f4);});});}exports['GetMemberReport']=function(_0xcb412){var _0x31f347=this;return new Promise(function(_0x2cb10b,_0x1ad45d){return db['MemberReport'][_0x0a6b('0x17')]({'raw':_0xcb412[_0x0a6b('0x18')]?_0xcb412['options'][_0x0a6b('0x19')]===undefined?!![]:![]:!![],'where':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')]['where']||null:null,'attributes':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1a')]||null:null,'limit':_0xcb412['options']?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1b')]||null:null,'include':_0xcb412[_0x0a6b('0x18')]?_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1c')]?_['map'](_0xcb412[_0x0a6b('0x18')][_0x0a6b('0x1c')],function(_0x3d153f){return{'model':db[_0x3d153f['model']],'as':_0x3d153f['as'],'attributes':_0x3d153f[_0x0a6b('0x1a')],'include':_0x3d153f[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3d153f[_0x0a6b('0x1c')],function(_0x3b12a2){return{'model':db[_0x3b12a2['model']],'as':_0x3b12a2['as'],'attributes':_0x3b12a2[_0x0a6b('0x1a')],'include':_0x3b12a2[_0x0a6b('0x1c')]?_[_0x0a6b('0x1d')](_0x3b12a2['include'],function(_0x3a9092){return{'model':db[_0x3a9092['model']],'as':_0x3a9092['as'],'attributes':_0x3a9092[_0x0a6b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0a6b('0x1e')](function(_0x45ae97){logger['info']('GetMemberReport',_0xcb412);logger[_0x0a6b('0xf')](_0x0a6b('0x1f'),_0xcb412,JSON[_0x0a6b('0x11')](_0x45ae97));_0x2cb10b(_0x45ae97);})[_0x0a6b('0x16')](function(_0x1935a3){logger[_0x0a6b('0x12')]('GetMemberReport',_0x1935a3[_0x0a6b('0x14')],_0xcb412);_0x1ad45d(_0x31f347[_0x0a6b('0x12')](0x1f4,_0x1935a3['message']));});});};exports[_0x0a6b('0x20')]=function(_0x554145){var _0x4eb516=this;return new Promise(function(_0xbf2f1a,_0x24e96a){return db[_0x0a6b('0x21')][_0x0a6b('0x22')](_0x554145[_0x0a6b('0x23')],{'raw':_0x554145['options']?_0x554145['options'][_0x0a6b('0x19')]===undefined?!![]:![]:!![]})[_0x0a6b('0x1e')](function(_0x235cc3){logger[_0x0a6b('0xc')]('CreateMemberReport',_0x554145);logger[_0x0a6b('0xf')](_0x0a6b('0x20'),_0x554145,JSON['stringify'](_0x235cc3));_0xbf2f1a(_0x235cc3);})['catch'](function(_0x28067f){logger[_0x0a6b('0x12')]('CreateMemberReport',_0x28067f[_0x0a6b('0x14')],_0x554145);_0x24e96a(_0x4eb516[_0x0a6b('0x12')](0x1f4,_0x28067f[_0x0a6b('0x14')]));});});};exports[_0x0a6b('0x24')]=function(_0x404161){var _0x311a2d=this;return new Promise(function(_0x1f6f82,_0x17bb41){return db[_0x0a6b('0x21')][_0x0a6b('0x25')](_0x404161[_0x0a6b('0x23')],{'raw':_0x404161[_0x0a6b('0x18')]?_0x404161['options'][_0x0a6b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x404161[_0x0a6b('0x18')]?_0x404161['options'][_0x0a6b('0x26')]||null:null,'attributes':_0x404161[_0x0a6b('0x18')]?_0x404161[_0x0a6b('0x18')][_0x0a6b('0x1a')]||null:null,'limit':_0x404161[_0x0a6b('0x18')]?_0x404161[_0x0a6b('0x18')][_0x0a6b('0x1b')]||null:null})[_0x0a6b('0x1e')](function(_0x4cf002){logger['info'](_0x0a6b('0x24'),_0x404161);logger[_0x0a6b('0xf')](_0x0a6b('0x24'),_0x404161,JSON[_0x0a6b('0x11')](_0x4cf002));_0x1f6f82(_0x4cf002);})[_0x0a6b('0x16')](function(_0x3f2449){logger[_0x0a6b('0x12')](_0x0a6b('0x24'),_0x3f2449[_0x0a6b('0x14')],_0x404161);_0x17bb41(_0x311a2d['error'](0x1f4,_0x3f2449[_0x0a6b('0x14')]));});});}; \ No newline at end of file +var _0x9b8e=['create','body','UpdateMemberReport','debug','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','options','raw','attributes','include','map','model','CreateMemberReport'];(function(_0x1029da,_0x4f5487){var _0x18730e=function(_0x1e4085){while(--_0x1e4085){_0x1029da['push'](_0x1029da['shift']());}};_0x18730e(++_0x4f5487);}(_0x9b8e,0x158));var _0xe9b8=function(_0x441269,_0x5c0500){_0x441269=_0x441269-0x0;var _0x505fa7=_0x9b8e[_0x441269];return _0x505fa7;};'use strict';var _=require(_0xe9b8('0x0'));var util=require('util');var moment=require(_0xe9b8('0x1'));var BPromise=require(_0xe9b8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9b8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9b8('0x4'))(_0xe9b8('0x5'));var config=require('../../config/environment');var jayson=require(_0xe9b8('0x6'));var client=jayson[_0xe9b8('0x7')][_0xe9b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x260234,_0x4ae5fa,_0x3b67fe){return new BPromise(function(_0x4fe774,_0x536372){return client[_0xe9b8('0x9')](_0x260234,_0x3b67fe)[_0xe9b8('0xa')](function(_0x65e43c){logger[_0xe9b8('0xb')]('MemberReport,\x20%s,\x20%s',_0x4ae5fa,_0xe9b8('0xc'));logger['debug'](_0xe9b8('0xd'),_0x4ae5fa,_0xe9b8('0xc'),JSON[_0xe9b8('0xe')](_0x65e43c));if(_0x65e43c[_0xe9b8('0xf')]){if(_0x65e43c[_0xe9b8('0xf')][_0xe9b8('0x10')]===0x1f4){logger[_0xe9b8('0xf')](_0xe9b8('0x11'),_0x4ae5fa,_0x65e43c[_0xe9b8('0xf')][_0xe9b8('0x12')]);return _0x536372(_0x65e43c[_0xe9b8('0xf')][_0xe9b8('0x12')]);}logger[_0xe9b8('0xf')]('MemberReport,\x20%s,\x20%s',_0x4ae5fa,_0x65e43c['error']['message']);return _0x4fe774(_0x65e43c['error'][_0xe9b8('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x4ae5fa,_0xe9b8('0xc'));_0x4fe774(_0x65e43c[_0xe9b8('0x13')][_0xe9b8('0x12')]);}})[_0xe9b8('0x14')](function(_0x592bf3){logger[_0xe9b8('0xf')]('MemberReport,\x20%s,\x20%s',_0x4ae5fa,_0x592bf3);_0x536372(_0x592bf3);});});}exports[_0xe9b8('0x15')]=function(_0xe435b0){var _0x347214=this;return new Promise(function(_0x3e8123,_0x2c55a8){return db[_0xe9b8('0x16')]['findAll']({'raw':_0xe435b0[_0xe9b8('0x17')]?_0xe435b0['options'][_0xe9b8('0x18')]===undefined?!![]:![]:!![],'where':_0xe435b0[_0xe9b8('0x17')]?_0xe435b0[_0xe9b8('0x17')]['where']||null:null,'attributes':_0xe435b0[_0xe9b8('0x17')]?_0xe435b0[_0xe9b8('0x17')][_0xe9b8('0x19')]||null:null,'limit':_0xe435b0[_0xe9b8('0x17')]?_0xe435b0[_0xe9b8('0x17')]['limit']||null:null,'include':_0xe435b0[_0xe9b8('0x17')]?_0xe435b0['options'][_0xe9b8('0x1a')]?_[_0xe9b8('0x1b')](_0xe435b0[_0xe9b8('0x17')][_0xe9b8('0x1a')],function(_0x427570){return{'model':db[_0x427570['model']],'as':_0x427570['as'],'attributes':_0x427570['attributes'],'include':_0x427570[_0xe9b8('0x1a')]?_[_0xe9b8('0x1b')](_0x427570[_0xe9b8('0x1a')],function(_0x53e0b8){return{'model':db[_0x53e0b8['model']],'as':_0x53e0b8['as'],'attributes':_0x53e0b8[_0xe9b8('0x19')],'include':_0x53e0b8['include']?_[_0xe9b8('0x1b')](_0x53e0b8['include'],function(_0x45f2e9){return{'model':db[_0x45f2e9[_0xe9b8('0x1c')]],'as':_0x45f2e9['as'],'attributes':_0x45f2e9[_0xe9b8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x79ea75){logger['info'](_0xe9b8('0x15'),_0xe435b0);logger['debug'](_0xe9b8('0x15'),_0xe435b0,JSON[_0xe9b8('0xe')](_0x79ea75));_0x3e8123(_0x79ea75);})[_0xe9b8('0x14')](function(_0x38ba68){logger[_0xe9b8('0xf')](_0xe9b8('0x15'),_0x38ba68[_0xe9b8('0x12')],_0xe435b0);_0x2c55a8(_0x347214[_0xe9b8('0xf')](0x1f4,_0x38ba68['message']));});});};exports[_0xe9b8('0x1d')]=function(_0x4ce101){var _0x2b8fe5=this;return new Promise(function(_0x1347a5,_0x372b05){return db['MemberReport'][_0xe9b8('0x1e')](_0x4ce101[_0xe9b8('0x1f')],{'raw':_0x4ce101[_0xe9b8('0x17')]?_0x4ce101[_0xe9b8('0x17')][_0xe9b8('0x18')]===undefined?!![]:![]:!![]})[_0xe9b8('0xa')](function(_0x49af74){logger['info']('CreateMemberReport',_0x4ce101);logger['debug'](_0xe9b8('0x1d'),_0x4ce101,JSON[_0xe9b8('0xe')](_0x49af74));_0x1347a5(_0x49af74);})[_0xe9b8('0x14')](function(_0x522fa3){logger[_0xe9b8('0xf')]('CreateMemberReport',_0x522fa3['message'],_0x4ce101);_0x372b05(_0x2b8fe5[_0xe9b8('0xf')](0x1f4,_0x522fa3[_0xe9b8('0x12')]));});});};exports['UpdateMemberReport']=function(_0x356f64){var _0x40468a=this;return new Promise(function(_0x28ad0f,_0x1d8bd6){return db[_0xe9b8('0x16')]['update'](_0x356f64['body'],{'raw':_0x356f64[_0xe9b8('0x17')]?_0x356f64['options'][_0xe9b8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x356f64['options']?_0x356f64['options']['where']||null:null,'attributes':_0x356f64[_0xe9b8('0x17')]?_0x356f64['options'][_0xe9b8('0x19')]||null:null,'limit':_0x356f64['options']?_0x356f64['options']['limit']||null:null})[_0xe9b8('0xa')](function(_0x32260b){logger[_0xe9b8('0xb')](_0xe9b8('0x20'),_0x356f64);logger[_0xe9b8('0x21')](_0xe9b8('0x20'),_0x356f64,JSON[_0xe9b8('0xe')](_0x32260b));_0x28ad0f(_0x32260b);})[_0xe9b8('0x14')](function(_0x11230a){logger['error']('UpdateMemberReport',_0x11230a[_0xe9b8('0x12')],_0x356f64);_0x1d8bd6(_0x40468a['error'](0x1f4,_0x11230a[_0xe9b8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0f0ff3d..9365e27 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 _0xf404=['multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','exports'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0xf404,0x120));var _0x4f40=function(_0xc0cfda,_0x148522){_0xc0cfda=_0xc0cfda-0x0;var _0x5efbde=_0xf404[_0xc0cfda];return _0x5efbde;};'use strict';var multer=require(_0x4f40('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f40('0x1'));var express=require(_0x4f40('0x2'));var router=express[_0x4f40('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4f40('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4f40('0x5'));var controller=require('./migration.controller');router[_0x4f40('0x6')]('/',controller['index']);module[_0x4f40('0x7')]=router; \ No newline at end of file +var _0x5e61=['../../components/interaction/service','./migration.controller','get','index','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2f2089,_0x5f2982){var _0x348830=function(_0x5de729){while(--_0x5de729){_0x2f2089['push'](_0x2f2089['shift']());}};_0x348830(++_0x5f2982);}(_0x5e61,0x126));var _0x15e6=function(_0x3d4ed0,_0x1192f4){_0x3d4ed0=_0x3d4ed0-0x0;var _0x4cc0a5=_0x5e61[_0x3d4ed0];return _0x4cc0a5;};'use strict';var multer=require(_0x15e6('0x0'));var util=require('util');var path=require(_0x15e6('0x1'));var timeout=require(_0x15e6('0x2'));var express=require('express');var router=express[_0x15e6('0x3')]();var fs_extra=require(_0x15e6('0x4'));var auth=require(_0x15e6('0x5'));var interaction=require(_0x15e6('0x6'));var config=require('../../config/environment');var controller=require(_0x15e6('0x7'));router[_0x15e6('0x8')]('/',controller[_0x15e6('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 698208b..9cf4e95 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 _0xce51=['sequelize','exports','STRING','version'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xce51,0xec));var _0x1ce5=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xce51[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0x1ce5('0x0'));module[_0x1ce5('0x1')]={'version':{'type':Sequelize[_0x1ce5('0x2')],'unique':_0x1ce5('0x3')}}; \ No newline at end of file +var _0xf4c5=['version','exports'];(function(_0x434379,_0x6db607){var _0x3314f2=function(_0x3b636a){while(--_0x3b636a){_0x434379['push'](_0x434379['shift']());}};_0x3314f2(++_0x6db607);}(_0xf4c5,0x183));var _0x5f4c=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0xf4c5[_0x14490c];return _0x2f6825;};'use strict';var Sequelize=require('sequelize');module[_0x5f4c('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0x5f4c('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f6fd1b1..d25d44d 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 _0x31d8=['model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','then','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','key'];(function(_0x409ae1,_0x160648){var _0x1972a5=function(_0xfe0433){while(--_0xfe0433){_0x409ae1['push'](_0x409ae1['shift']());}};_0x1972a5(++_0x160648);}(_0x31d8,0x169));var _0x831d=function(_0x22ecf6,_0x593f90){_0x22ecf6=_0x22ecf6-0x0;var _0x51e2b3=_0x31d8[_0x22ecf6];return _0x51e2b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x831d('0x0'));var zipdir=require(_0x831d('0x1'));var jsonpatch=require(_0x831d('0x2'));var rp=require(_0x831d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x831d('0x4'));var util=require(_0x831d('0x5'));var path=require(_0x831d('0x6'));var sox=require(_0x831d('0x7'));var csv=require('to-csv');var ejs=require(_0x831d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x831d('0x9'));var squel=require(_0x831d('0xa'));var crypto=require(_0x831d('0xb'));var jsforce=require(_0x831d('0xc'));var deskjs=require(_0x831d('0xd'));var toCsv=require(_0x831d('0xe'));var querystring=require(_0x831d('0xf'));var Papa=require('papaparse');var Redis=require(_0x831d('0x10'));var authService=require(_0x831d('0x11'));var qs=require(_0x831d('0x12'));var as=require(_0x831d('0x13'));var hardwareService=require(_0x831d('0x14'));var logger=require(_0x831d('0x15'))(_0x831d('0x16'));var utils=require(_0x831d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x831d('0x18'));var db=require(_0x831d('0x19'))['db'];function respondWithStatusCode(_0x29e309,_0x3127ed){_0x3127ed=_0x3127ed||0xcc;return function(_0x3bb6cf){if(_0x3bb6cf){return _0x29e309[_0x831d('0x1a')](_0x3127ed);}return _0x29e309[_0x831d('0x1b')](_0x3127ed)[_0x831d('0x1c')]();};}function respondWithResult(_0x494632,_0x42ae41){_0x42ae41=_0x42ae41||0xc8;return function(_0x2c73ea){if(_0x2c73ea){return _0x494632[_0x831d('0x1b')](_0x42ae41)['json'](_0x2c73ea);}};}function respondWithFilteredResult(_0x4c620d,_0x4bfc9d){return function(_0x48c8cd){if(_0x48c8cd){var _0x285891=typeof _0x4bfc9d[_0x831d('0x1d')]===_0x831d('0x1e')&&typeof _0x4bfc9d[_0x831d('0x1f')]===_0x831d('0x1e');var _0x120315=_0x48c8cd['count'];var _0x324572=_0x285891?0x0:_0x4bfc9d['offset'];var _0x14f0d6=_0x285891?_0x48c8cd[_0x831d('0x20')]:_0x4bfc9d[_0x831d('0x1d')]+_0x4bfc9d[_0x831d('0x1f')];var _0x4bb15c;if(_0x14f0d6>=_0x120315){_0x14f0d6=_0x120315;_0x4bb15c=0xc8;}else{_0x4bb15c=0xce;}_0x4c620d[_0x831d('0x1b')](_0x4bb15c);return _0x4c620d['set'](_0x831d('0x21'),_0x324572+'-'+_0x14f0d6+'/'+_0x120315)[_0x831d('0x22')](_0x48c8cd);}return null;};}function patchUpdates(_0x1165eb){return function(_0x564161){try{jsonpatch['apply'](_0x564161,_0x1165eb,!![]);}catch(_0x131b8b){return BPromise['reject'](_0x131b8b);}return _0x564161[_0x831d('0x23')]();};}function saveUpdates(_0x12f3f6,_0x3dd43c){return function(_0x4b627e){if(_0x4b627e){return _0x4b627e['update'](_0x12f3f6)[_0x831d('0x24')](function(_0x5ca0b9){return _0x5ca0b9;});}return null;};}function removeEntity(_0x3a14ef,_0x566cf3){return function(_0x3666c3){if(_0x3666c3){return _0x3666c3['destroy']()[_0x831d('0x24')](function(){_0x3a14ef[_0x831d('0x1b')](0xcc)[_0x831d('0x1c')]();});}};}function handleEntityNotFound(_0x123893,_0x50f6c6){return function(_0x53b864){if(!_0x53b864){_0x123893[_0x831d('0x1a')](0x194);}return _0x53b864;};}function handleError(_0x24d602,_0x4d4207){_0x4d4207=_0x4d4207||0x1f4;return function(_0x49387a){logger[_0x831d('0x25')](_0x49387a[_0x831d('0x26')]);if(_0x49387a[_0x831d('0x27')]){delete _0x49387a[_0x831d('0x27')];}_0x24d602['status'](_0x4d4207)[_0x831d('0x28')](_0x49387a);};}exports[_0x831d('0x29')]=function(_0x5077fb,_0x5c73c2){var _0x369b0e={},_0x11f14b={},_0x4a21b6={'count':0x0,'rows':[]};var _0x5c1919=_['map'](db[_0x831d('0x2a')][_0x831d('0x2b')],function(_0x8d829b){return{'name':_0x8d829b[_0x831d('0x2c')],'type':_0x8d829b[_0x831d('0x2d')][_0x831d('0x2e')]};});_0x11f14b[_0x831d('0x2f')]=_[_0x831d('0x30')](_0x5c1919,_0x831d('0x27'));_0x11f14b[_0x831d('0x31')]=_[_0x831d('0x32')](_0x5077fb['query']);_0x11f14b[_0x831d('0x33')]=_[_0x831d('0x34')](_0x11f14b['model'],_0x11f14b[_0x831d('0x31')]);_0x369b0e[_0x831d('0x35')]=_['intersection'](_0x11f14b['model'],qs[_0x831d('0x36')](_0x5077fb['query'][_0x831d('0x36')]));_0x369b0e['attributes']=_0x369b0e['attributes']['length']?_0x369b0e['attributes']:_0x11f14b[_0x831d('0x2f')];if(!_0x5077fb['query'][_0x831d('0x37')](_0x831d('0x38'))){_0x369b0e['limit']=qs[_0x831d('0x1f')](_0x5077fb['query'][_0x831d('0x1f')]);_0x369b0e[_0x831d('0x1d')]=qs[_0x831d('0x1d')](_0x5077fb['query'][_0x831d('0x1d')]);}_0x369b0e[_0x831d('0x39')]=qs[_0x831d('0x3a')](_0x5077fb[_0x831d('0x31')][_0x831d('0x3a')]);_0x369b0e[_0x831d('0x3b')]=qs[_0x831d('0x33')](_['pick'](_0x5077fb[_0x831d('0x31')],_0x11f14b[_0x831d('0x33')]),_0x5c1919);if(_0x5077fb[_0x831d('0x31')][_0x831d('0x3c')]){_0x369b0e[_0x831d('0x3b')]=_[_0x831d('0x3d')](_0x369b0e[_0x831d('0x3b')],{'$or':_['map'](_0x5c1919,function(_0x354a9e){if(_0x354a9e[_0x831d('0x2d')]!==_0x831d('0x3e')){var _0xa49972={};_0xa49972[_0x354a9e[_0x831d('0x27')]]={'$like':'%'+_0x5077fb['query'][_0x831d('0x3c')]+'%'};return _0xa49972;}})});}_0x369b0e=_['merge']({},_0x369b0e,_0x5077fb[_0x831d('0x3f')]);var _0x49ce76={'where':_0x369b0e['where']};return db[_0x831d('0x2a')]['count'](_0x49ce76)[_0x831d('0x24')](function(_0x5e6d7f){_0x4a21b6[_0x831d('0x20')]=_0x5e6d7f;if(_0x5077fb[_0x831d('0x31')][_0x831d('0x40')]){_0x369b0e[_0x831d('0x41')]=[{'all':!![]}];}return db[_0x831d('0x2a')]['findAll'](_0x369b0e);})[_0x831d('0x24')](function(_0x4c74d){_0x4a21b6[_0x831d('0x42')]=_0x4c74d;return _0x4a21b6;})['then'](respondWithFilteredResult(_0x5c73c2,_0x369b0e))[_0x831d('0x43')](handleError(_0x5c73c2,null));}; \ No newline at end of file +var _0x3cb0=['name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','eml-format','request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x3cb0,0xde));var _0x03cb=function(_0x161f0,_0x355cc0){_0x161f0=_0x161f0-0x0;var _0x5212a8=_0x3cb0[_0x161f0];return _0x5212a8;};'use strict';var emlformat=require(_0x03cb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x03cb('0x1'));var moment=require('moment');var BPromise=require(_0x03cb('0x2'));var Mustache=require(_0x03cb('0x3'));var util=require(_0x03cb('0x4'));var path=require(_0x03cb('0x5'));var sox=require(_0x03cb('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x03cb('0x7'));var squel=require(_0x03cb('0x8'));var crypto=require('crypto');var jsforce=require(_0x03cb('0x9'));var deskjs=require(_0x03cb('0xa'));var toCsv=require(_0x03cb('0xb'));var querystring=require(_0x03cb('0xc'));var Papa=require('papaparse');var Redis=require(_0x03cb('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x03cb('0xe'));var hardwareService=require(_0x03cb('0xf'));var logger=require(_0x03cb('0x10'))('api');var utils=require(_0x03cb('0x11'));var config=require(_0x03cb('0x12'));var licenseUtil=require(_0x03cb('0x13'));var db=require(_0x03cb('0x14'))['db'];function respondWithStatusCode(_0x5cdb7e,_0x37857f){_0x37857f=_0x37857f||0xcc;return function(_0x120174){if(_0x120174){return _0x5cdb7e[_0x03cb('0x15')](_0x37857f);}return _0x5cdb7e[_0x03cb('0x16')](_0x37857f)['end']();};}function respondWithResult(_0x396670,_0xf9cf22){_0xf9cf22=_0xf9cf22||0xc8;return function(_0x8f3f77){if(_0x8f3f77){return _0x396670['status'](_0xf9cf22)[_0x03cb('0x17')](_0x8f3f77);}};}function respondWithFilteredResult(_0x266b9c,_0x38ba5c){return function(_0x1938ee){if(_0x1938ee){var _0x4452db=typeof _0x38ba5c[_0x03cb('0x18')]===_0x03cb('0x19')&&typeof _0x38ba5c[_0x03cb('0x1a')]==='undefined';var _0x89c89f=_0x1938ee['count'];var _0x38fe3e=_0x4452db?0x0:_0x38ba5c[_0x03cb('0x18')];var _0x48d4fc=_0x4452db?_0x1938ee[_0x03cb('0x1b')]:_0x38ba5c['offset']+_0x38ba5c[_0x03cb('0x1a')];var _0x5353d5;if(_0x48d4fc>=_0x89c89f){_0x48d4fc=_0x89c89f;_0x5353d5=0xc8;}else{_0x5353d5=0xce;}_0x266b9c['status'](_0x5353d5);return _0x266b9c[_0x03cb('0x1c')](_0x03cb('0x1d'),_0x38fe3e+'-'+_0x48d4fc+'/'+_0x89c89f)[_0x03cb('0x17')](_0x1938ee);}return null;};}function patchUpdates(_0x151977){return function(_0x2fa410){try{jsonpatch[_0x03cb('0x1e')](_0x2fa410,_0x151977,!![]);}catch(_0x480bbb){return BPromise[_0x03cb('0x1f')](_0x480bbb);}return _0x2fa410['save']();};}function saveUpdates(_0x5c1f12,_0x37bcbe){return function(_0x4362c6){if(_0x4362c6){return _0x4362c6[_0x03cb('0x20')](_0x5c1f12)[_0x03cb('0x21')](function(_0x101be4){return _0x101be4;});}return null;};}function removeEntity(_0x13cf65,_0xb7d858){return function(_0x3df66d){if(_0x3df66d){return _0x3df66d[_0x03cb('0x22')]()[_0x03cb('0x21')](function(){_0x13cf65['status'](0xcc)[_0x03cb('0x23')]();});}};}function handleEntityNotFound(_0x189282,_0x42581f){return function(_0x324db3){if(!_0x324db3){_0x189282['sendStatus'](0x194);}return _0x324db3;};}function handleError(_0x3efbc4,_0x409fd9){_0x409fd9=_0x409fd9||0x1f4;return function(_0x34c4bf){logger[_0x03cb('0x24')](_0x34c4bf[_0x03cb('0x25')]);if(_0x34c4bf[_0x03cb('0x26')]){delete _0x34c4bf[_0x03cb('0x26')];}_0x3efbc4[_0x03cb('0x16')](_0x409fd9)[_0x03cb('0x27')](_0x34c4bf);};}exports[_0x03cb('0x28')]=function(_0x61e8fb,_0x1fbc8e){var _0x26285a={},_0x6bb424={},_0x4067a1={'count':0x0,'rows':[]};var _0x50a451=_[_0x03cb('0x29')](db[_0x03cb('0x2a')][_0x03cb('0x2b')],function(_0x3d89d8){return{'name':_0x3d89d8[_0x03cb('0x2c')],'type':_0x3d89d8['type'][_0x03cb('0x2d')]};});_0x6bb424[_0x03cb('0x2e')]=_[_0x03cb('0x29')](_0x50a451,_0x03cb('0x26'));_0x6bb424[_0x03cb('0x2f')]=_[_0x03cb('0x30')](_0x61e8fb['query']);_0x6bb424[_0x03cb('0x31')]=_[_0x03cb('0x32')](_0x6bb424[_0x03cb('0x2e')],_0x6bb424['query']);_0x26285a['attributes']=_[_0x03cb('0x32')](_0x6bb424['model'],qs[_0x03cb('0x33')](_0x61e8fb[_0x03cb('0x2f')]['fields']));_0x26285a[_0x03cb('0x34')]=_0x26285a[_0x03cb('0x34')][_0x03cb('0x35')]?_0x26285a['attributes']:_0x6bb424[_0x03cb('0x2e')];if(!_0x61e8fb[_0x03cb('0x2f')][_0x03cb('0x36')]('nolimit')){_0x26285a[_0x03cb('0x1a')]=qs[_0x03cb('0x1a')](_0x61e8fb[_0x03cb('0x2f')]['limit']);_0x26285a['offset']=qs[_0x03cb('0x18')](_0x61e8fb[_0x03cb('0x2f')][_0x03cb('0x18')]);}_0x26285a['order']=qs[_0x03cb('0x37')](_0x61e8fb[_0x03cb('0x2f')][_0x03cb('0x37')]);_0x26285a['where']=qs[_0x03cb('0x31')](_[_0x03cb('0x38')](_0x61e8fb[_0x03cb('0x2f')],_0x6bb424['filters']),_0x50a451);if(_0x61e8fb[_0x03cb('0x2f')][_0x03cb('0x39')]){_0x26285a[_0x03cb('0x3a')]=_['merge'](_0x26285a[_0x03cb('0x3a')],{'$or':_[_0x03cb('0x29')](_0x50a451,function(_0x2b0b5b){if(_0x2b0b5b['type']!==_0x03cb('0x3b')){var _0x115a2a={};_0x115a2a[_0x2b0b5b[_0x03cb('0x26')]]={'$like':'%'+_0x61e8fb[_0x03cb('0x2f')][_0x03cb('0x39')]+'%'};return _0x115a2a;}})});}_0x26285a=_[_0x03cb('0x3c')]({},_0x26285a,_0x61e8fb[_0x03cb('0x3d')]);var _0x4c3db6={'where':_0x26285a[_0x03cb('0x3a')]};return db[_0x03cb('0x2a')][_0x03cb('0x1b')](_0x4c3db6)[_0x03cb('0x21')](function(_0x18eea4){_0x4067a1[_0x03cb('0x1b')]=_0x18eea4;if(_0x61e8fb[_0x03cb('0x2f')][_0x03cb('0x3e')]){_0x26285a[_0x03cb('0x3f')]=[{'all':!![]}];}return db[_0x03cb('0x2a')]['findAll'](_0x26285a);})[_0x03cb('0x21')](function(_0x2b5ee7){_0x4067a1[_0x03cb('0x40')]=_0x2b5ee7;return _0x4067a1;})[_0x03cb('0x21')](respondWithFilteredResult(_0x1fbc8e,_0x26285a))['catch'](handleError(_0x1fbc8e,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 1f87846..33c5f71 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 _0x8eb5=['Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./migration.attributes','exports'];(function(_0x45e313,_0xedf66b){var _0xffde2d=function(_0x490750){while(--_0x490750){_0x45e313['push'](_0x45e313['shift']());}};_0xffde2d(++_0xedf66b);}(_0x8eb5,0xe6));var _0x58eb=function(_0x2caa90,_0x1ef82e){_0x2caa90=_0x2caa90-0x0;var _0x163e6a=_0x8eb5[_0x2caa90];return _0x163e6a;};'use strict';var _=require(_0x58eb('0x0'));var util=require(_0x58eb('0x1'));var logger=require(_0x58eb('0x2'))(_0x58eb('0x3'));var moment=require(_0x58eb('0x4'));var BPromise=require('bluebird');var rp=require(_0x58eb('0x5'));var fs=require('fs');var path=require(_0x58eb('0x6'));var rimraf=require('rimraf');var config=require(_0x58eb('0x7'));var attributes=require(_0x58eb('0x8'));module[_0x58eb('0x9')]=function(_0xa838f6,_0x173a2c){return _0xa838f6['define'](_0x58eb('0xa'),attributes,{'tableName':_0x58eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x212b=['Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x212b,0x1bc));var _0xb212=function(_0x38318d,_0x55cbbc){_0x38318d=_0x38318d-0x0;var _0x5c3442=_0x212b[_0x38318d];return _0x5c3442;};'use strict';var _=require(_0xb212('0x0'));var util=require(_0xb212('0x1'));var logger=require(_0xb212('0x2'))(_0xb212('0x3'));var moment=require(_0xb212('0x4'));var BPromise=require('bluebird');var rp=require(_0xb212('0x5'));var fs=require('fs');var path=require(_0xb212('0x6'));var rimraf=require(_0xb212('0x7'));var config=require(_0xb212('0x8'));var attributes=require(_0xb212('0x9'));module['exports']=function(_0x1f446b,_0x2b9829){return _0x1f446b[_0xb212('0xa')](_0xb212('0xb'),attributes,{'tableName':_0xb212('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 397cb09..f04e4c9 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 _0xad8a=['../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x208d8e,_0x106245){var _0x209fdb=function(_0x2d1c35){while(--_0x2d1c35){_0x208d8e['push'](_0x208d8e['shift']());}};_0x209fdb(++_0x106245);}(_0xad8a,0xb0));var _0xaad8=function(_0x4e379e,_0x2a793a){_0x4e379e=_0x4e379e-0x0;var _0x10c772=_0xad8a[_0x4e379e];return _0x10c772;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var moment=require(_0xaad8('0x2'));var BPromise=require(_0xaad8('0x3'));var rs=require(_0xaad8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaad8('0x5'))['db'];var utils=require(_0xaad8('0x6'));var logger=require(_0xaad8('0x7'))('rpc');var config=require(_0xaad8('0x8'));var jayson=require(_0xaad8('0x9'));var client=jayson[_0xaad8('0xa')][_0xaad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x95aef9,_0x39c599,_0x28f3a1){return new BPromise(function(_0xf3a6c7,_0x11408a){return client[_0xaad8('0xc')](_0x95aef9,_0x28f3a1)['then'](function(_0x52477f){logger[_0xaad8('0xd')](_0xaad8('0xe'),_0x39c599,_0xaad8('0xf'));logger[_0xaad8('0x10')](_0xaad8('0x11'),_0x39c599,_0xaad8('0xf'),JSON[_0xaad8('0x12')](_0x52477f));if(_0x52477f[_0xaad8('0x13')]){if(_0x52477f[_0xaad8('0x13')]['code']===0x1f4){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0x11408a(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0xf3a6c7(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}else{logger[_0xaad8('0xd')]('Migration,\x20%s,\x20%s',_0x39c599,_0xaad8('0xf'));_0xf3a6c7(_0x52477f[_0xaad8('0x15')]['message']);}})[_0xaad8('0x16')](function(_0x2a8e12){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x2a8e12);_0x11408a(_0x2a8e12);});});} \ No newline at end of file +var _0x3b59=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x56dd58,_0xb1287d){var _0x103e75=function(_0x369507){while(--_0x369507){_0x56dd58['push'](_0x56dd58['shift']());}};_0x103e75(++_0xb1287d);}(_0x3b59,0x9c));var _0x93b5=function(_0x3e45a6,_0x576195){_0x3e45a6=_0x3e45a6-0x0;var _0x4751f7=_0x3b59[_0x3e45a6];return _0x4751f7;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var moment=require(_0x93b5('0x2'));var BPromise=require(_0x93b5('0x3'));var rs=require(_0x93b5('0x4'));var fs=require('fs');var Redis=require(_0x93b5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x93b5('0x6'));var logger=require('../../config/logger')(_0x93b5('0x7'));var config=require(_0x93b5('0x8'));var jayson=require(_0x93b5('0x9'));var client=jayson[_0x93b5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ecbe3,_0x34650d,_0x4485b6){return new BPromise(function(_0x484849,_0x8e475e){return client[_0x93b5('0xb')](_0x3ecbe3,_0x4485b6)[_0x93b5('0xc')](function(_0x176049){logger[_0x93b5('0xd')]('Migration,\x20%s,\x20%s',_0x34650d,_0x93b5('0xe'));logger[_0x93b5('0xf')](_0x93b5('0x10'),_0x34650d,_0x93b5('0xe'),JSON[_0x93b5('0x11')](_0x176049));if(_0x176049['error']){if(_0x176049[_0x93b5('0x12')][_0x93b5('0x13')]===0x1f4){logger['error'](_0x93b5('0x14'),_0x34650d,_0x176049[_0x93b5('0x12')][_0x93b5('0x15')]);return _0x8e475e(_0x176049[_0x93b5('0x12')][_0x93b5('0x15')]);}logger['error'](_0x93b5('0x14'),_0x34650d,_0x176049[_0x93b5('0x12')]['message']);return _0x484849(_0x176049[_0x93b5('0x12')][_0x93b5('0x15')]);}else{logger[_0x93b5('0xd')]('Migration,\x20%s,\x20%s',_0x34650d,_0x93b5('0xe'));_0x484849(_0x176049['result']['message']);}})[_0x93b5('0x16')](function(_0x5a12fd){logger[_0x93b5('0x12')](_0x93b5('0x14'),_0x34650d,_0x5a12fd);_0x8e475e(_0x5a12fd);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0429d6b..9ecc1ae 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 _0x8a9a=['post','create','/:id','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','show'];(function(_0x528dde,_0x14b021){var _0x5e81ad=function(_0x5889ea){while(--_0x5889ea){_0x528dde['push'](_0x528dde['shift']());}};_0x5e81ad(++_0x14b021);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8a9a[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0xa8a9('0x0'));var path=require(_0xa8a9('0x1'));var timeout=require(_0xa8a9('0x2'));var express=require(_0xa8a9('0x3'));var router=express[_0xa8a9('0x4')]();var fs_extra=require(_0xa8a9('0x5'));var auth=require(_0xa8a9('0x6'));var interaction=require(_0xa8a9('0x7'));var config=require(_0xa8a9('0x8'));var controller=require(_0xa8a9('0x9'));router[_0xa8a9('0xa')]('/',auth[_0xa8a9('0xb')](),controller['index']);router[_0xa8a9('0xa')]('/:id',auth[_0xa8a9('0xb')](),controller[_0xa8a9('0xc')]);router[_0xa8a9('0xd')]('/',auth[_0xa8a9('0xb')](),controller[_0xa8a9('0xe')]);router['put'](_0xa8a9('0xf'),auth[_0xa8a9('0xb')](),controller['update']);router[_0xa8a9('0x10')]('/:id',auth[_0xa8a9('0xb')](),controller[_0xa8a9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x22ca=['../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','index','get','/:id','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0x22ca,0x1d9));var _0xa22c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x22ca[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa22c('0x0'));var util=require(_0xa22c('0x1'));var path=require(_0xa22c('0x2'));var timeout=require(_0xa22c('0x3'));var express=require(_0xa22c('0x4'));var router=express[_0xa22c('0x5')]();var fs_extra=require(_0xa22c('0x6'));var auth=require(_0xa22c('0x7'));var interaction=require(_0xa22c('0x8'));var config=require(_0xa22c('0x9'));var controller=require(_0xa22c('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xa22c('0xb')]);router[_0xa22c('0xc')](_0xa22c('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa22c('0xe')](),controller[_0xa22c('0xf')]);router[_0xa22c('0x10')](_0xa22c('0xd'),auth[_0xa22c('0xe')](),controller['update']);router[_0xa22c('0x11')](_0xa22c('0xd'),auth['isAuthenticated'](),controller[_0xa22c('0x12')]);module[_0xa22c('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 56c8548..6fe2e4e 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 _0x9db3=['STRING','sequelize','exports','ENUM','localnet','externip','stun'];(function(_0x128945,_0x5c662d){var _0x1fd542=function(_0x3a0d0a){while(--_0x3a0d0a){_0x128945['push'](_0x128945['shift']());}};_0x1fd542(++_0x5c662d);}(_0x9db3,0x10b));var _0x39db=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9db3[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x39db('0x0'));module[_0x39db('0x1')]={'type':{'type':Sequelize[_0x39db('0x2')](_0x39db('0x3'),_0x39db('0x4'),_0x39db('0x5'),'turn')},'value':{'type':Sequelize[_0x39db('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x39db('0x6')]}}; \ No newline at end of file +var _0x35b5=['stun','turn','STRING','sequelize','exports','ENUM','externip'];(function(_0x54dcdb,_0x338da5){var _0x9ab1b2=function(_0x31d28d){while(--_0x31d28d){_0x54dcdb['push'](_0x54dcdb['shift']());}};_0x9ab1b2(++_0x338da5);}(_0x35b5,0x137));var _0x535b=function(_0x32c22d,_0x183fd1){_0x32c22d=_0x32c22d-0x0;var _0x520d93=_0x35b5[_0x32c22d];return _0x520d93;};'use strict';var Sequelize=require(_0x535b('0x0'));module[_0x535b('0x1')]={'type':{'type':Sequelize[_0x535b('0x2')]('localnet',_0x535b('0x3'),_0x535b('0x4'),_0x535b('0x5'))},'value':{'type':Sequelize[_0x535b('0x6')]},'username':{'type':Sequelize[_0x535b('0x6')]},'password':{'type':Sequelize[_0x535b('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index fb6cca5..33ba14f 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 _0xe93b=['sequelize','transaction','/etc/asterisk/turn_xcally.conf','toLowerCase','destroy','format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','request\x20sent','debug','stringify','code','error','message','Network,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','Network','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','readFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so'];(function(_0x48043c,_0x1c6a80){var _0x2c41bc=function(_0x104785){while(--_0x104785){_0x48043c['push'](_0x48043c['shift']());}};_0x2c41bc(++_0x1c6a80);}(_0xe93b,0x1c2));var _0xbe93=function(_0x1b45a1,_0x9dbb01){_0x1b45a1=_0x1b45a1-0x0;var _0x5e9b25=_0xe93b[_0x1b45a1];return _0x5e9b25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe93('0x0'));var zipdir=require(_0xbe93('0x1'));var jsonpatch=require(_0xbe93('0x2'));var rp=require('request-promise');var moment=require(_0xbe93('0x3'));var BPromise=require(_0xbe93('0x4'));var Mustache=require(_0xbe93('0x5'));var util=require(_0xbe93('0x6'));var path=require(_0xbe93('0x7'));var sox=require(_0xbe93('0x8'));var csv=require(_0xbe93('0x9'));var ejs=require(_0xbe93('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe93('0xb'));var squel=require(_0xbe93('0xc'));var crypto=require(_0xbe93('0xd'));var jsforce=require(_0xbe93('0xe'));var deskjs=require(_0xbe93('0xf'));var toCsv=require(_0xbe93('0x9'));var querystring=require(_0xbe93('0x10'));var Papa=require(_0xbe93('0x11'));var Redis=require(_0xbe93('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbe93('0x13'));var as=require(_0xbe93('0x14'));var hardwareService=require(_0xbe93('0x15'));var logger=require(_0xbe93('0x16'))(_0xbe93('0x17'));var utils=require(_0xbe93('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbe93('0x19'));var db=require(_0xbe93('0x1a'))['db'];var jayson=require(_0xbe93('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf87f23,_0x34b431,_0x26174b,_0x5c9c57){return new BPromise(function(_0x527a2f,_0x24ae1c){var _0x223a49=_0x5c9c57||client;return _0x223a49[_0xbe93('0x1c')](_0xf87f23,_0x26174b)[_0xbe93('0x1d')](function(_0x2a4f52){logger[_0xbe93('0x1e')]('Network,\x20%s,\x20%s',_0x34b431,_0xbe93('0x1f'));logger[_0xbe93('0x20')]('Network,\x20%s,\x20%s,\x20%s',_0x34b431,_0xbe93('0x1f'),JSON[_0xbe93('0x21')](_0x2a4f52));if(_0x2a4f52['error']){if(_0x2a4f52['error'][_0xbe93('0x22')]===0x1f4){logger[_0xbe93('0x23')]('Network,\x20%s,\x20%s',_0x34b431,_0x2a4f52[_0xbe93('0x23')][_0xbe93('0x24')]);return _0x24ae1c(_0x2a4f52[_0xbe93('0x23')][_0xbe93('0x24')]);}logger[_0xbe93('0x23')](_0xbe93('0x25'),_0x34b431,_0x2a4f52[_0xbe93('0x23')]['message']);return _0x527a2f(_0x2a4f52[_0xbe93('0x23')][_0xbe93('0x24')]);}else{logger[_0xbe93('0x1e')](_0xbe93('0x25'),_0x34b431,_0xbe93('0x1f'));_0x527a2f(_0x2a4f52['result'][_0xbe93('0x24')]);}})[_0xbe93('0x26')](function(_0x104f97){logger[_0xbe93('0x23')](_0xbe93('0x25'),_0x34b431,_0x104f97);_0x24ae1c(_0x104f97);});});}function respondWithStatusCode(_0x52ae45,_0x4d80ac){_0x4d80ac=_0x4d80ac||0xcc;return function(_0x14629a){if(_0x14629a){return _0x52ae45[_0xbe93('0x27')](_0x4d80ac);}return _0x52ae45[_0xbe93('0x28')](_0x4d80ac)[_0xbe93('0x29')]();};}function respondWithResult(_0x513572,_0x26470f){_0x26470f=_0x26470f||0xc8;return function(_0x171279){if(_0x171279){return _0x513572[_0xbe93('0x28')](_0x26470f)[_0xbe93('0x2a')](_0x171279);}};}function respondWithFilteredResult(_0x24e8ac,_0x153d40){return function(_0x34d124){if(_0x34d124){var _0x2d1de2=typeof _0x153d40[_0xbe93('0x2b')]===_0xbe93('0x2c')&&typeof _0x153d40[_0xbe93('0x2d')]===_0xbe93('0x2c');var _0x4c3fce=_0x34d124[_0xbe93('0x2e')];var _0x431b88=_0x2d1de2?0x0:_0x153d40[_0xbe93('0x2b')];var _0x37ef07=_0x2d1de2?_0x34d124['count']:_0x153d40[_0xbe93('0x2b')]+_0x153d40['limit'];var _0x5ec553;if(_0x37ef07>=_0x4c3fce){_0x37ef07=_0x4c3fce;_0x5ec553=0xc8;}else{_0x5ec553=0xce;}_0x24e8ac[_0xbe93('0x28')](_0x5ec553);return _0x24e8ac[_0xbe93('0x2f')](_0xbe93('0x30'),_0x431b88+'-'+_0x37ef07+'/'+_0x4c3fce)[_0xbe93('0x2a')](_0x34d124);}return null;};}function patchUpdates(_0x4fd4d1){return function(_0x50da57){try{jsonpatch[_0xbe93('0x31')](_0x50da57,_0x4fd4d1,!![]);}catch(_0x353bfe){return BPromise[_0xbe93('0x32')](_0x353bfe);}return _0x50da57[_0xbe93('0x33')]();};}function saveUpdates(_0x3c5790,_0x11ce49){return function(_0x3fb06c){if(_0x3fb06c){return _0x3fb06c[_0xbe93('0x34')](_0x3c5790)[_0xbe93('0x1d')](function(_0x42362c){return _0x42362c;});}return null;};}function removeEntity(_0x1b761f,_0xde4ff2){return function(_0x5802de){if(_0x5802de){return _0x5802de['destroy']()[_0xbe93('0x1d')](function(){_0x1b761f[_0xbe93('0x28')](0xcc)[_0xbe93('0x29')]();});}};}function handleEntityNotFound(_0xf4185b,_0x115b2b){return function(_0x5dd4ea){if(!_0x5dd4ea){_0xf4185b[_0xbe93('0x27')](0x194);}return _0x5dd4ea;};}function handleError(_0x1d5310,_0x4c62dd){_0x4c62dd=_0x4c62dd||0x1f4;return function(_0x11a166){logger[_0xbe93('0x23')](_0x11a166[_0xbe93('0x35')]);if(_0x11a166[_0xbe93('0x36')]){delete _0x11a166[_0xbe93('0x36')];}_0x1d5310[_0xbe93('0x28')](_0x4c62dd)[_0xbe93('0x37')](_0x11a166);};}exports[_0xbe93('0x38')]=function(_0x57bf56,_0x11baa2){var _0x2facf0={},_0x378edc={},_0x1ff4be={'count':0x0,'rows':[]};var _0x320cd8=_[_0xbe93('0x39')](db[_0xbe93('0x3a')]['rawAttributes'],function(_0x173b8b){return{'name':_0x173b8b[_0xbe93('0x3b')],'type':_0x173b8b[_0xbe93('0x3c')][_0xbe93('0x3d')]};});_0x378edc[_0xbe93('0x3e')]=_[_0xbe93('0x39')](_0x320cd8,_0xbe93('0x36'));_0x378edc[_0xbe93('0x3f')]=_['keys'](_0x57bf56[_0xbe93('0x3f')]);_0x378edc[_0xbe93('0x40')]=_[_0xbe93('0x41')](_0x378edc[_0xbe93('0x3e')],_0x378edc[_0xbe93('0x3f')]);_0x2facf0['attributes']=_['intersection'](_0x378edc[_0xbe93('0x3e')],qs[_0xbe93('0x42')](_0x57bf56[_0xbe93('0x3f')][_0xbe93('0x42')]));_0x2facf0[_0xbe93('0x43')]=_0x2facf0[_0xbe93('0x43')][_0xbe93('0x44')]?_0x2facf0[_0xbe93('0x43')]:_0x378edc['model'];if(!_0x57bf56[_0xbe93('0x3f')][_0xbe93('0x45')](_0xbe93('0x46'))){_0x2facf0[_0xbe93('0x2d')]=qs['limit'](_0x57bf56[_0xbe93('0x3f')][_0xbe93('0x2d')]);_0x2facf0[_0xbe93('0x2b')]=qs[_0xbe93('0x2b')](_0x57bf56['query'][_0xbe93('0x2b')]);}_0x2facf0[_0xbe93('0x47')]=qs[_0xbe93('0x48')](_0x57bf56[_0xbe93('0x3f')][_0xbe93('0x48')]);_0x2facf0[_0xbe93('0x49')]=qs[_0xbe93('0x40')](_['pick'](_0x57bf56[_0xbe93('0x3f')],_0x378edc[_0xbe93('0x40')]),_0x320cd8);if(_0x57bf56[_0xbe93('0x3f')][_0xbe93('0x4a')]){_0x2facf0[_0xbe93('0x49')]=_[_0xbe93('0x4b')](_0x2facf0[_0xbe93('0x49')],{'$or':_[_0xbe93('0x39')](_0x320cd8,function(_0x1c6f38){if(_0x1c6f38[_0xbe93('0x3c')]!==_0xbe93('0x4c')){var _0x48af0e={};_0x48af0e[_0x1c6f38[_0xbe93('0x36')]]={'$like':'%'+_0x57bf56[_0xbe93('0x3f')][_0xbe93('0x4a')]+'%'};return _0x48af0e;}})});}_0x2facf0=_[_0xbe93('0x4b')]({},_0x2facf0,_0x57bf56[_0xbe93('0x4d')]);var _0x595be3={'where':_0x2facf0[_0xbe93('0x49')]};return db[_0xbe93('0x3a')][_0xbe93('0x2e')](_0x595be3)[_0xbe93('0x1d')](function(_0x5649fd){_0x1ff4be['count']=_0x5649fd;if(_0x57bf56['query'][_0xbe93('0x4e')]){_0x2facf0['include']=[{'all':!![]}];}return db[_0xbe93('0x3a')][_0xbe93('0x4f')](_0x2facf0);})[_0xbe93('0x1d')](function(_0x532f95){_0x1ff4be[_0xbe93('0x50')]=_0x532f95;return _0x1ff4be;})['then'](respondWithFilteredResult(_0x11baa2,_0x2facf0))[_0xbe93('0x26')](handleError(_0x11baa2,null));};exports[_0xbe93('0x51')]=function(_0x351b92,_0xcad392){var _0x4bd315={'raw':!![],'where':{'id':_0x351b92[_0xbe93('0x52')]['id']}},_0x3c3bc6={};_0x3c3bc6['model']=_[_0xbe93('0x53')](db['Network']['rawAttributes']);_0x3c3bc6['query']=_[_0xbe93('0x53')](_0x351b92['query']);_0x3c3bc6[_0xbe93('0x40')]=_['intersection'](_0x3c3bc6[_0xbe93('0x3e')],_0x3c3bc6['query']);_0x4bd315['attributes']=_['intersection'](_0x3c3bc6['model'],qs[_0xbe93('0x42')](_0x351b92['query'][_0xbe93('0x42')]));_0x4bd315[_0xbe93('0x43')]=_0x4bd315[_0xbe93('0x43')]['length']?_0x4bd315[_0xbe93('0x43')]:_0x3c3bc6[_0xbe93('0x3e')];if(_0x351b92['query'][_0xbe93('0x4e')]){_0x4bd315[_0xbe93('0x54')]=[{'all':!![]}];}_0x4bd315=_['merge']({},_0x4bd315,_0x351b92[_0xbe93('0x4d')]);return db[_0xbe93('0x3a')][_0xbe93('0x55')](_0x4bd315)[_0xbe93('0x1d')](handleEntityNotFound(_0xcad392,null))[_0xbe93('0x1d')](respondWithResult(_0xcad392,null))[_0xbe93('0x26')](handleError(_0xcad392,null));};exports[_0xbe93('0x56')]=function(_0x3ccbbe,_0x44aaa2,_0x504ca7){var _0x1c90c0;return db['sequelize']['transaction'](function(_0x281126){return db['Network'][_0xbe93('0x56')](_0x3ccbbe['body'],{'raw':!![]})[_0xbe93('0x1d')](function(_0x354b7e){_0x1c90c0=_0x354b7e;return db[_0xbe93('0x3a')]['findAll']({'where':{'type':_0x3ccbbe[_0xbe93('0x57')][_0xbe93('0x3c')]},'raw':!![]});})[_0xbe93('0x1d')](function(_0x4b3b57){if(_0x1c90c0[_0xbe93('0x3c')][_0xbe93('0x58')]()==_0xbe93('0x59')){var _0xce2bf1=fs['readFileSync'](path[_0xbe93('0x5a')](config[_0xbe93('0x5b')],_0xbe93('0x5c')),_0xbe93('0x5d'));var _0xf8436d=ejs[_0xbe93('0x5e')](_0xce2bf1,{'networks':_0x4b3b57||[]});fs[_0xbe93('0x5f')](_0xbe93('0x60'),_0xf8436d);return respondWithRpcPromise(_0xbe93('0x61'),_0xbe93('0x56'),{'module':_0xbe93('0x62')});}else if(_0x1c90c0[_0xbe93('0x3c')]['toUpperCase']()==_0xbe93('0x63')){var _0x16e9f3=fs['readFileSync'](path[_0xbe93('0x5a')](config[_0xbe93('0x5b')],_0xbe93('0x64')),_0xbe93('0x5d'));var _0x4d0447=ejs[_0xbe93('0x5e')](_0x16e9f3,{'networks':_0x4b3b57||[]});fs[_0xbe93('0x5f')]('/etc/asterisk/turn_xcally.conf',_0x4d0447);return respondWithRpcPromise('Reload',_0xbe93('0x56'),{'module':_0xbe93('0x62')});}else{var _0x217509=fs[_0xbe93('0x65')](path[_0xbe93('0x5a')](config[_0xbe93('0x5b')],_0xbe93('0x66')),_0xbe93('0x5d'));var _0x3ed95=ejs['render'](_0x217509,{'networks':_0x4b3b57||[]});fs[_0xbe93('0x5f')](util['format'](_0xbe93('0x67'),_0x3ccbbe['body'][_0xbe93('0x3c')]['toLowerCase']()),_0x3ed95);return respondWithRpcPromise(_0xbe93('0x61'),_0xbe93('0x56'),{'module':_0xbe93('0x68')});}return null;})[_0xbe93('0x1d')](function(){return _0x1c90c0;});})[_0xbe93('0x1d')](respondWithResult(_0x44aaa2,0xc9))[_0xbe93('0x26')](handleError(_0x44aaa2,null));};exports['update']=function(_0x3f97a6,_0x45cc5e,_0x316698){var _0x1e5e34;return db[_0xbe93('0x69')][_0xbe93('0x6a')](function(_0x26d74c){return db[_0xbe93('0x3a')]['find']({'where':{'id':_0x3f97a6[_0xbe93('0x52')]['id']}})[_0xbe93('0x1d')](handleEntityNotFound(_0x45cc5e,null))['then'](saveUpdates(_0x3f97a6['body'],null))[_0xbe93('0x1d')](function(_0x2290e4){if(_0x2290e4){_0x1e5e34=_0x2290e4;return db[_0xbe93('0x3a')][_0xbe93('0x4f')]({'where':{'type':_0x1e5e34[_0xbe93('0x3c')]},'raw':!![]});}return null;})[_0xbe93('0x1d')](function(_0x42cb9e){if(_0x1e5e34['type'][_0xbe93('0x58')]()==_0xbe93('0x59')){var _0x124da9=fs[_0xbe93('0x65')](path[_0xbe93('0x5a')](config['root'],_0xbe93('0x5c')),'utf8');var _0x349611=ejs[_0xbe93('0x5e')](_0x124da9,{'networks':_0x42cb9e||[]});fs[_0xbe93('0x5f')](_0xbe93('0x60'),_0x349611);return respondWithRpcPromise(_0xbe93('0x61'),'update',{'module':'res_stun_monitor.so'});}else if(_0x1e5e34['type']['toUpperCase']()==_0xbe93('0x63')){var _0x4ce30f=fs[_0xbe93('0x65')](path[_0xbe93('0x5a')](config[_0xbe93('0x5b')],_0xbe93('0x64')),_0xbe93('0x5d'));var _0x3c6e49=ejs[_0xbe93('0x5e')](_0x4ce30f,{'networks':_0x42cb9e||[]});fs['writeFileSync'](_0xbe93('0x6b'),_0x3c6e49);return respondWithRpcPromise(_0xbe93('0x61'),'update',{'module':_0xbe93('0x62')});}else{var _0x326a1a=fs[_0xbe93('0x65')](path['join'](config[_0xbe93('0x5b')],_0xbe93('0x66')),_0xbe93('0x5d'));var _0x25045c=ejs[_0xbe93('0x5e')](_0x326a1a,{'networks':_0x42cb9e||[]});fs['writeFileSync'](util['format'](_0xbe93('0x67'),_0x3f97a6[_0xbe93('0x57')][_0xbe93('0x3c')][_0xbe93('0x6c')]()),_0x25045c);return respondWithRpcPromise(_0xbe93('0x61'),'update',{'module':_0xbe93('0x68')});}return null;})[_0xbe93('0x1d')](function(_0x93ab36){if(_0x93ab36){return _0x1e5e34;}return null;});})[_0xbe93('0x1d')](respondWithResult(_0x45cc5e,null))['catch'](handleError(_0x45cc5e,null));};exports[_0xbe93('0x6d')]=function(_0x593e14,_0x2bb95d,_0x57b59d){var _0x1c485b;return db['Network'][_0xbe93('0x55')]({'where':{'id':_0x593e14['params']['id']}})['then'](function(_0x7fac11){_0x1c485b=_0x7fac11;return _0x7fac11;})[_0xbe93('0x1d')](handleEntityNotFound(_0x2bb95d,null))[_0xbe93('0x1d')](removeEntity(_0x2bb95d,null))[_0xbe93('0x1d')](function(){if(_0x1c485b){return db[_0xbe93('0x3a')][_0xbe93('0x4f')]({'where':{'type':_0x1c485b[_0xbe93('0x3c')]},'raw':!![]});}})[_0xbe93('0x1d')](function(_0x446dd1){if(_0x1c485b[_0xbe93('0x3c')][_0xbe93('0x58')]()=='STUN'){var _0x26fd48=fs[_0xbe93('0x65')](path[_0xbe93('0x5a')](config[_0xbe93('0x5b')],'server/files/templates/stun_multiple.ejs'),_0xbe93('0x5d'));var _0x34e0c9=ejs[_0xbe93('0x5e')](_0x26fd48,{'networks':_0x446dd1||[]});fs[_0xbe93('0x5f')](_0xbe93('0x60'),_0x34e0c9);return respondWithRpcPromise(_0xbe93('0x61'),_0xbe93('0x6d'),{'module':'res_stun_monitor.so'});}else if(_0x1c485b['type']['toUpperCase']()=='TURN'){var _0x1644c0=fs[_0xbe93('0x65')](path[_0xbe93('0x5a')](config[_0xbe93('0x5b')],_0xbe93('0x64')),'utf8');var _0x270166=ejs['render'](_0x1644c0,{'networks':_0x446dd1||[]});fs['writeFileSync'](_0xbe93('0x6b'),_0x270166);return respondWithRpcPromise(_0xbe93('0x61'),_0xbe93('0x6d'),{'module':'res_stun_monitor.so'});}else{var _0xb70830=fs['readFileSync'](path[_0xbe93('0x5a')](config[_0xbe93('0x5b')],_0xbe93('0x66')),_0xbe93('0x5d'));var _0xa4c4c2=ejs[_0xbe93('0x5e')](_0xb70830,{'networks':_0x446dd1||[]});fs[_0xbe93('0x5f')](util[_0xbe93('0x6e')](_0xbe93('0x67'),_0x593e14[_0xbe93('0x57')][_0xbe93('0x3c')][_0xbe93('0x6c')]()),_0xa4c4c2);return respondWithRpcPromise(_0xbe93('0x61'),_0xbe93('0x6d'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x2bb95d,null));}; \ No newline at end of file +var _0xab09=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','Network,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Network','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','rawAttributes','find','create','sequelize','findAll','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','res_stun_monitor.so','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','render','format','toLowerCase','transaction','/etc/asterisk/stun_xcally.conf','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xab09,0x6a));var _0x9ab0=function(_0x1d92f8,_0xe82340){_0x1d92f8=_0x1d92f8-0x0;var _0x56dba3=_0xab09[_0x1d92f8];return _0x56dba3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ab0('0x0'));var zipdir=require(_0x9ab0('0x1'));var jsonpatch=require(_0x9ab0('0x2'));var rp=require(_0x9ab0('0x3'));var moment=require(_0x9ab0('0x4'));var BPromise=require(_0x9ab0('0x5'));var Mustache=require(_0x9ab0('0x6'));var util=require(_0x9ab0('0x7'));var path=require(_0x9ab0('0x8'));var sox=require(_0x9ab0('0x9'));var csv=require(_0x9ab0('0xa'));var ejs=require(_0x9ab0('0xb'));var fs=require('fs');var fs_extra=require(_0x9ab0('0xc'));var _=require(_0x9ab0('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ab0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9ab0('0xf'));var Papa=require(_0x9ab0('0x10'));var Redis=require(_0x9ab0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ab0('0x12'));var as=require(_0x9ab0('0x13'));var hardwareService=require(_0x9ab0('0x14'));var logger=require(_0x9ab0('0x15'))(_0x9ab0('0x16'));var utils=require('../../config/utils');var config=require(_0x9ab0('0x17'));var licenseUtil=require(_0x9ab0('0x18'));var db=require(_0x9ab0('0x19'))['db'];var jayson=require(_0x9ab0('0x1a'));var client=jayson[_0x9ab0('0x1b')][_0x9ab0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x53cc61,_0xb0e901,_0x261e6f,_0xb3d368){return new BPromise(function(_0x3a5dfd,_0x5e9b92){var _0x149165=_0xb3d368||client;return _0x149165['request'](_0x53cc61,_0x261e6f)[_0x9ab0('0x1d')](function(_0x4dcf82){logger[_0x9ab0('0x1e')]('Network,\x20%s,\x20%s',_0xb0e901,_0x9ab0('0x1f'));logger[_0x9ab0('0x20')](_0x9ab0('0x21'),_0xb0e901,_0x9ab0('0x1f'),JSON['stringify'](_0x4dcf82));if(_0x4dcf82[_0x9ab0('0x22')]){if(_0x4dcf82[_0x9ab0('0x22')][_0x9ab0('0x23')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0xb0e901,_0x4dcf82['error']['message']);return _0x5e9b92(_0x4dcf82[_0x9ab0('0x22')][_0x9ab0('0x24')]);}logger[_0x9ab0('0x22')]('Network,\x20%s,\x20%s',_0xb0e901,_0x4dcf82[_0x9ab0('0x22')][_0x9ab0('0x24')]);return _0x3a5dfd(_0x4dcf82[_0x9ab0('0x22')][_0x9ab0('0x24')]);}else{logger[_0x9ab0('0x1e')](_0x9ab0('0x25'),_0xb0e901,_0x9ab0('0x1f'));_0x3a5dfd(_0x4dcf82[_0x9ab0('0x26')]['message']);}})[_0x9ab0('0x27')](function(_0x2b7a11){logger[_0x9ab0('0x22')]('Network,\x20%s,\x20%s',_0xb0e901,_0x2b7a11);_0x5e9b92(_0x2b7a11);});});}function respondWithStatusCode(_0x172011,_0x4c5a5f){_0x4c5a5f=_0x4c5a5f||0xcc;return function(_0x46b44e){if(_0x46b44e){return _0x172011[_0x9ab0('0x28')](_0x4c5a5f);}return _0x172011[_0x9ab0('0x29')](_0x4c5a5f)['end']();};}function respondWithResult(_0x52b3e6,_0x46746d){_0x46746d=_0x46746d||0xc8;return function(_0x6ea1f1){if(_0x6ea1f1){return _0x52b3e6[_0x9ab0('0x29')](_0x46746d)[_0x9ab0('0x2a')](_0x6ea1f1);}};}function respondWithFilteredResult(_0x514afa,_0x2ab6e9){return function(_0x212b6a){if(_0x212b6a){var _0x10572d=typeof _0x2ab6e9[_0x9ab0('0x2b')]===_0x9ab0('0x2c')&&typeof _0x2ab6e9[_0x9ab0('0x2d')]===_0x9ab0('0x2c');var _0xbb29df=_0x212b6a[_0x9ab0('0x2e')];var _0x367b31=_0x10572d?0x0:_0x2ab6e9['offset'];var _0x3c3274=_0x10572d?_0x212b6a[_0x9ab0('0x2e')]:_0x2ab6e9[_0x9ab0('0x2b')]+_0x2ab6e9[_0x9ab0('0x2d')];var _0x401037;if(_0x3c3274>=_0xbb29df){_0x3c3274=_0xbb29df;_0x401037=0xc8;}else{_0x401037=0xce;}_0x514afa[_0x9ab0('0x29')](_0x401037);return _0x514afa['set'](_0x9ab0('0x2f'),_0x367b31+'-'+_0x3c3274+'/'+_0xbb29df)['json'](_0x212b6a);}return null;};}function patchUpdates(_0x2e2af8){return function(_0x4d4a52){try{jsonpatch[_0x9ab0('0x30')](_0x4d4a52,_0x2e2af8,!![]);}catch(_0x1f4521){return BPromise[_0x9ab0('0x31')](_0x1f4521);}return _0x4d4a52[_0x9ab0('0x32')]();};}function saveUpdates(_0x15d659,_0x176e07){return function(_0x51af03){if(_0x51af03){return _0x51af03[_0x9ab0('0x33')](_0x15d659)[_0x9ab0('0x1d')](function(_0x3fc23d){return _0x3fc23d;});}return null;};}function removeEntity(_0x1b297a,_0xa94eb3){return function(_0xe3f2c1){if(_0xe3f2c1){return _0xe3f2c1[_0x9ab0('0x34')]()['then'](function(){_0x1b297a[_0x9ab0('0x29')](0xcc)[_0x9ab0('0x35')]();});}};}function handleEntityNotFound(_0x3b9525,_0x4f739a){return function(_0xcac469){if(!_0xcac469){_0x3b9525[_0x9ab0('0x28')](0x194);}return _0xcac469;};}function handleError(_0x3d6f9d,_0x29039a){_0x29039a=_0x29039a||0x1f4;return function(_0x5267d1){logger[_0x9ab0('0x22')](_0x5267d1[_0x9ab0('0x36')]);if(_0x5267d1[_0x9ab0('0x37')]){delete _0x5267d1[_0x9ab0('0x37')];}_0x3d6f9d['status'](_0x29039a)[_0x9ab0('0x38')](_0x5267d1);};}exports[_0x9ab0('0x39')]=function(_0x1e17ba,_0x21d655){var _0x2434cd={},_0x2ccb6c={},_0x1b2abd={'count':0x0,'rows':[]};var _0xe4cef8=_[_0x9ab0('0x3a')](db[_0x9ab0('0x3b')]['rawAttributes'],function(_0x202999){return{'name':_0x202999[_0x9ab0('0x3c')],'type':_0x202999[_0x9ab0('0x3d')]['key']};});_0x2ccb6c[_0x9ab0('0x3e')]=_['map'](_0xe4cef8,_0x9ab0('0x37'));_0x2ccb6c[_0x9ab0('0x3f')]=_['keys'](_0x1e17ba[_0x9ab0('0x3f')]);_0x2ccb6c[_0x9ab0('0x40')]=_[_0x9ab0('0x41')](_0x2ccb6c['model'],_0x2ccb6c['query']);_0x2434cd[_0x9ab0('0x42')]=_[_0x9ab0('0x41')](_0x2ccb6c['model'],qs[_0x9ab0('0x43')](_0x1e17ba[_0x9ab0('0x3f')][_0x9ab0('0x43')]));_0x2434cd[_0x9ab0('0x42')]=_0x2434cd['attributes'][_0x9ab0('0x44')]?_0x2434cd[_0x9ab0('0x42')]:_0x2ccb6c[_0x9ab0('0x3e')];if(!_0x1e17ba[_0x9ab0('0x3f')][_0x9ab0('0x45')](_0x9ab0('0x46'))){_0x2434cd[_0x9ab0('0x2d')]=qs[_0x9ab0('0x2d')](_0x1e17ba[_0x9ab0('0x3f')][_0x9ab0('0x2d')]);_0x2434cd[_0x9ab0('0x2b')]=qs[_0x9ab0('0x2b')](_0x1e17ba[_0x9ab0('0x3f')][_0x9ab0('0x2b')]);}_0x2434cd[_0x9ab0('0x47')]=qs['sort'](_0x1e17ba[_0x9ab0('0x3f')]['sort']);_0x2434cd[_0x9ab0('0x48')]=qs[_0x9ab0('0x40')](_[_0x9ab0('0x49')](_0x1e17ba[_0x9ab0('0x3f')],_0x2ccb6c['filters']),_0xe4cef8);if(_0x1e17ba[_0x9ab0('0x3f')][_0x9ab0('0x4a')]){_0x2434cd[_0x9ab0('0x48')]=_[_0x9ab0('0x4b')](_0x2434cd[_0x9ab0('0x48')],{'$or':_[_0x9ab0('0x3a')](_0xe4cef8,function(_0x17479f){if(_0x17479f[_0x9ab0('0x3d')]!==_0x9ab0('0x4c')){var _0x4f1530={};_0x4f1530[_0x17479f[_0x9ab0('0x37')]]={'$like':'%'+_0x1e17ba['query']['filter']+'%'};return _0x4f1530;}})});}_0x2434cd=_['merge']({},_0x2434cd,_0x1e17ba[_0x9ab0('0x4d')]);var _0x34b9f4={'where':_0x2434cd['where']};return db[_0x9ab0('0x3b')][_0x9ab0('0x2e')](_0x34b9f4)[_0x9ab0('0x1d')](function(_0x19d5d2){_0x1b2abd[_0x9ab0('0x2e')]=_0x19d5d2;if(_0x1e17ba[_0x9ab0('0x3f')][_0x9ab0('0x4e')]){_0x2434cd[_0x9ab0('0x4f')]=[{'all':!![]}];}return db['Network']['findAll'](_0x2434cd);})[_0x9ab0('0x1d')](function(_0x4db354){_0x1b2abd[_0x9ab0('0x50')]=_0x4db354;return _0x1b2abd;})[_0x9ab0('0x1d')](respondWithFilteredResult(_0x21d655,_0x2434cd))[_0x9ab0('0x27')](handleError(_0x21d655,null));};exports[_0x9ab0('0x51')]=function(_0x4157cc,_0x2aa22c){var _0x58dd68={'raw':!![],'where':{'id':_0x4157cc[_0x9ab0('0x52')]['id']}},_0x25d9c1={};_0x25d9c1['model']=_[_0x9ab0('0x53')](db[_0x9ab0('0x3b')][_0x9ab0('0x54')]);_0x25d9c1['query']=_['keys'](_0x4157cc[_0x9ab0('0x3f')]);_0x25d9c1[_0x9ab0('0x40')]=_[_0x9ab0('0x41')](_0x25d9c1[_0x9ab0('0x3e')],_0x25d9c1['query']);_0x58dd68[_0x9ab0('0x42')]=_['intersection'](_0x25d9c1['model'],qs[_0x9ab0('0x43')](_0x4157cc[_0x9ab0('0x3f')]['fields']));_0x58dd68[_0x9ab0('0x42')]=_0x58dd68['attributes'][_0x9ab0('0x44')]?_0x58dd68[_0x9ab0('0x42')]:_0x25d9c1['model'];if(_0x4157cc['query'][_0x9ab0('0x4e')]){_0x58dd68['include']=[{'all':!![]}];}_0x58dd68=_[_0x9ab0('0x4b')]({},_0x58dd68,_0x4157cc['options']);return db['Network'][_0x9ab0('0x55')](_0x58dd68)[_0x9ab0('0x1d')](handleEntityNotFound(_0x2aa22c,null))[_0x9ab0('0x1d')](respondWithResult(_0x2aa22c,null))[_0x9ab0('0x27')](handleError(_0x2aa22c,null));};exports[_0x9ab0('0x56')]=function(_0x2dd7c6,_0x3baecd,_0x390b38){var _0x2c2c7d;return db[_0x9ab0('0x57')]['transaction'](function(_0x36c4cd){return db['Network'][_0x9ab0('0x56')](_0x2dd7c6['body'],{'raw':!![]})[_0x9ab0('0x1d')](function(_0x3b7e9b){_0x2c2c7d=_0x3b7e9b;return db['Network'][_0x9ab0('0x58')]({'where':{'type':_0x2dd7c6[_0x9ab0('0x59')]['type']},'raw':!![]});})[_0x9ab0('0x1d')](function(_0x2b7e50){if(_0x2c2c7d[_0x9ab0('0x3d')][_0x9ab0('0x5a')]()==_0x9ab0('0x5b')){var _0xf74c85=fs['readFileSync'](path[_0x9ab0('0x5c')](config['root'],_0x9ab0('0x5d')),_0x9ab0('0x5e'));var _0x597340=ejs['render'](_0xf74c85,{'networks':_0x2b7e50||[]});fs[_0x9ab0('0x5f')]('/etc/asterisk/stun_xcally.conf',_0x597340);return respondWithRpcPromise(_0x9ab0('0x60'),'create',{'module':_0x9ab0('0x61')});}else if(_0x2c2c7d['type'][_0x9ab0('0x5a')]()==_0x9ab0('0x62')){var _0x383161=fs[_0x9ab0('0x63')](path[_0x9ab0('0x5c')](config[_0x9ab0('0x64')],_0x9ab0('0x65')),_0x9ab0('0x5e'));var _0x133429=ejs['render'](_0x383161,{'networks':_0x2b7e50||[]});fs[_0x9ab0('0x5f')](_0x9ab0('0x66'),_0x133429);return respondWithRpcPromise('Reload',_0x9ab0('0x56'),{'module':_0x9ab0('0x61')});}else{var _0x4507f6=fs['readFileSync'](path[_0x9ab0('0x5c')](config[_0x9ab0('0x64')],_0x9ab0('0x67')),_0x9ab0('0x5e'));var _0x164cac=ejs[_0x9ab0('0x68')](_0x4507f6,{'networks':_0x2b7e50||[]});fs[_0x9ab0('0x5f')](util[_0x9ab0('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0x2dd7c6['body'][_0x9ab0('0x3d')][_0x9ab0('0x6a')]()),_0x164cac);return respondWithRpcPromise(_0x9ab0('0x60'),'create',{'module':'chan_sip.so'});}return null;})[_0x9ab0('0x1d')](function(){return _0x2c2c7d;});})[_0x9ab0('0x1d')](respondWithResult(_0x3baecd,0xc9))[_0x9ab0('0x27')](handleError(_0x3baecd,null));};exports['update']=function(_0x26cd6e,_0x1a5a1e,_0x4f0580){var _0x4e572c;return db[_0x9ab0('0x57')][_0x9ab0('0x6b')](function(_0x3a3e98){return db[_0x9ab0('0x3b')][_0x9ab0('0x55')]({'where':{'id':_0x26cd6e[_0x9ab0('0x52')]['id']}})[_0x9ab0('0x1d')](handleEntityNotFound(_0x1a5a1e,null))[_0x9ab0('0x1d')](saveUpdates(_0x26cd6e[_0x9ab0('0x59')],null))[_0x9ab0('0x1d')](function(_0x505653){if(_0x505653){_0x4e572c=_0x505653;return db[_0x9ab0('0x3b')][_0x9ab0('0x58')]({'where':{'type':_0x4e572c['type']},'raw':!![]});}return null;})['then'](function(_0x558a8e){if(_0x4e572c[_0x9ab0('0x3d')]['toUpperCase']()==_0x9ab0('0x5b')){var _0x1488e8=fs[_0x9ab0('0x63')](path[_0x9ab0('0x5c')](config[_0x9ab0('0x64')],_0x9ab0('0x5d')),_0x9ab0('0x5e'));var _0x263e32=ejs['render'](_0x1488e8,{'networks':_0x558a8e||[]});fs[_0x9ab0('0x5f')](_0x9ab0('0x6c'),_0x263e32);return respondWithRpcPromise(_0x9ab0('0x60'),_0x9ab0('0x33'),{'module':_0x9ab0('0x61')});}else if(_0x4e572c[_0x9ab0('0x3d')][_0x9ab0('0x5a')]()==_0x9ab0('0x62')){var _0x361382=fs[_0x9ab0('0x63')](path['join'](config[_0x9ab0('0x64')],'server/files/templates/turn_multiple.ejs'),_0x9ab0('0x5e'));var _0x16eabd=ejs[_0x9ab0('0x68')](_0x361382,{'networks':_0x558a8e||[]});fs['writeFileSync'](_0x9ab0('0x66'),_0x16eabd);return respondWithRpcPromise('Reload',_0x9ab0('0x33'),{'module':_0x9ab0('0x61')});}else{var _0x1becdc=fs[_0x9ab0('0x63')](path['join'](config[_0x9ab0('0x64')],_0x9ab0('0x67')),_0x9ab0('0x5e'));var _0x3e5b5a=ejs[_0x9ab0('0x68')](_0x1becdc,{'networks':_0x558a8e||[]});fs[_0x9ab0('0x5f')](util[_0x9ab0('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0x26cd6e[_0x9ab0('0x59')][_0x9ab0('0x3d')][_0x9ab0('0x6a')]()),_0x3e5b5a);return respondWithRpcPromise(_0x9ab0('0x60'),_0x9ab0('0x33'),{'module':_0x9ab0('0x6d')});}return null;})[_0x9ab0('0x1d')](function(_0x4e89b1){if(_0x4e89b1){return _0x4e572c;}return null;});})[_0x9ab0('0x1d')](respondWithResult(_0x1a5a1e,null))['catch'](handleError(_0x1a5a1e,null));};exports[_0x9ab0('0x34')]=function(_0x52656d,_0x4f2473,_0x555a2f){var _0x12cbc3;return db['Network']['find']({'where':{'id':_0x52656d['params']['id']}})['then'](function(_0x5ea873){_0x12cbc3=_0x5ea873;return _0x5ea873;})[_0x9ab0('0x1d')](handleEntityNotFound(_0x4f2473,null))['then'](removeEntity(_0x4f2473,null))[_0x9ab0('0x1d')](function(){if(_0x12cbc3){return db[_0x9ab0('0x3b')]['findAll']({'where':{'type':_0x12cbc3[_0x9ab0('0x3d')]},'raw':!![]});}})[_0x9ab0('0x1d')](function(_0x1d2309){if(_0x12cbc3[_0x9ab0('0x3d')][_0x9ab0('0x5a')]()==_0x9ab0('0x5b')){var _0x4bbee2=fs[_0x9ab0('0x63')](path[_0x9ab0('0x5c')](config[_0x9ab0('0x64')],_0x9ab0('0x5d')),_0x9ab0('0x5e'));var _0x3eb6d3=ejs[_0x9ab0('0x68')](_0x4bbee2,{'networks':_0x1d2309||[]});fs[_0x9ab0('0x5f')](_0x9ab0('0x6c'),_0x3eb6d3);return respondWithRpcPromise('Reload',_0x9ab0('0x34'),{'module':_0x9ab0('0x61')});}else if(_0x12cbc3[_0x9ab0('0x3d')][_0x9ab0('0x5a')]()==_0x9ab0('0x62')){var _0x1edd84=fs[_0x9ab0('0x63')](path[_0x9ab0('0x5c')](config[_0x9ab0('0x64')],_0x9ab0('0x65')),_0x9ab0('0x5e'));var _0x4ae435=ejs['render'](_0x1edd84,{'networks':_0x1d2309||[]});fs[_0x9ab0('0x5f')]('/etc/asterisk/turn_xcally.conf',_0x4ae435);return respondWithRpcPromise('Reload',_0x9ab0('0x34'),{'module':_0x9ab0('0x61')});}else{var _0x45762f=fs[_0x9ab0('0x63')](path[_0x9ab0('0x5c')](config[_0x9ab0('0x64')],_0x9ab0('0x67')),_0x9ab0('0x5e'));var _0x39063b=ejs['render'](_0x45762f,{'networks':_0x1d2309||[]});fs[_0x9ab0('0x5f')](util['format'](_0x9ab0('0x6e'),_0x52656d[_0x9ab0('0x59')][_0x9ab0('0x3d')][_0x9ab0('0x6a')]()),_0x39063b);return respondWithRpcPromise('Reload','destroy',{'module':_0x9ab0('0x6d')});}return null;})[_0x9ab0('0x27')](handleError(_0x4f2473,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a0aa57f..5298383 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 _0xf4eb=['./network.attributes','exports','define','network','lodash','bluebird','rimraf','../../config/environment'];(function(_0x3730b1,_0x28a04b){var _0x2a75db=function(_0x348b9b){while(--_0x348b9b){_0x3730b1['push'](_0x3730b1['shift']());}};_0x2a75db(++_0x28a04b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2da058,_0x568865){_0x2da058=_0x2da058-0x0;var _0x21f1fa=_0xf4eb[_0x2da058];return _0x21f1fa;};'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 +var _0x235a=['exports','Network','network','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./network.attributes'];(function(_0x45513e,_0x433f83){var _0x59331f=function(_0x3d2c8c){while(--_0x3d2c8c){_0x45513e['push'](_0x45513e['shift']());}};_0x59331f(++_0x433f83);}(_0x235a,0x1ef));var _0xa235=function(_0x350e23,_0x12d586){_0x350e23=_0x350e23-0x0;var _0x548ec9=_0x235a[_0x350e23];return _0x548ec9;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var logger=require(_0xa235('0x2'))('api');var moment=require(_0xa235('0x3'));var BPromise=require('bluebird');var rp=require(_0xa235('0x4'));var fs=require('fs');var path=require(_0xa235('0x5'));var rimraf=require(_0xa235('0x6'));var config=require(_0xa235('0x7'));var attributes=require(_0xa235('0x8'));module[_0xa235('0x9')]=function(_0x2961c8,_0x1707fc){return _0x2961c8['define'](_0xa235('0xa'),attributes,{'tableName':_0xa235('0xb'),'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 5bf1137..c72946c 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x2325d0,_0x49ea33){_0x2325d0=_0x2325d0-0x0;var _0x51375e=_0x7a54[_0x2325d0];return _0x51375e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x4efef2,_0x3c0640){_0x4efef2=_0x4efef2-0x0;var _0x12529b=_0x7a54[_0x4efef2];return _0x12529b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c1a9acb..cbb457f 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 _0x19b6=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer'];(function(_0x314c2a,_0xb95e2e){var _0x59763f=function(_0x2e1db3){while(--_0x2e1db3){_0x314c2a['push'](_0x314c2a['shift']());}};_0x59763f(++_0xb95e2e);}(_0x19b6,0x167));var _0x619b=function(_0x375325,_0x57a850){_0x375325=_0x375325-0x0;var _0x228f57=_0x19b6[_0x375325];return _0x228f57;};'use strict';var multer=require(_0x619b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x619b('0x1'));var express=require(_0x619b('0x2'));var router=express[_0x619b('0x3')]();var fs_extra=require(_0x619b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x619b('0x5'));var config=require(_0x619b('0x6'));var controller=require(_0x619b('0x7'));router[_0x619b('0x8')]('/',auth[_0x619b('0x9')](),controller['index']);router['get']('/describe',auth[_0x619b('0x9')](),controller[_0x619b('0xa')]);router['get']('/:id',auth[_0x619b('0x9')](),controller['show']);router[_0x619b('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x619b('0xb')]);router[_0x619b('0x8')](_0x619b('0xc'),auth[_0x619b('0x9')](),controller[_0x619b('0xd')]);router[_0x619b('0x8')](_0x619b('0xe'),auth[_0x619b('0x9')](),controller['getApplications']);router[_0x619b('0x8')](_0x619b('0xf'),auth[_0x619b('0x9')](),controller[_0x619b('0x10')]);router[_0x619b('0x8')](_0x619b('0x11'),auth[_0x619b('0x9')](),controller['getAgents']);router['post']('/',auth[_0x619b('0x9')](),controller[_0x619b('0x12')]);router[_0x619b('0x13')](_0x619b('0x14'),auth[_0x619b('0x9')](),controller[_0x619b('0x15')]);router[_0x619b('0x13')](_0x619b('0xc'),auth['isAuthenticated'](),controller[_0x619b('0x16')]);router[_0x619b('0x13')](_0x619b('0x17'),controller[_0x619b('0x18')]);router[_0x619b('0x13')]('/:id/applications',auth['isAuthenticated'](),controller[_0x619b('0x19')]);router[_0x619b('0x13')](_0x619b('0x11'),auth[_0x619b('0x9')](),controller[_0x619b('0x1a')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x619b('0x1b')]);router[_0x619b('0x1c')](_0x619b('0x1d'),auth[_0x619b('0x9')](),controller[_0x619b('0x1e')]);router[_0x619b('0x1f')](_0x619b('0x1d'),auth[_0x619b('0x9')](),controller[_0x619b('0x20')]);router[_0x619b('0x1f')](_0x619b('0x14'),auth['isAuthenticated'](),controller[_0x619b('0x21')]);router[_0x619b('0x1f')](_0x619b('0xc'),auth[_0x619b('0x9')](),controller[_0x619b('0x22')]);router[_0x619b('0x1f')](_0x619b('0x11'),auth['isAuthenticated'](),controller[_0x619b('0x23')]);module['exports']=router; \ No newline at end of file +var _0x8518=['/:id/send','send','put','update','delete','removeDispositions','removeAnswers','multer','util','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents'];(function(_0x102051,_0x3cb66d){var _0x224af2=function(_0x3ab49a){while(--_0x3ab49a){_0x102051['push'](_0x102051['shift']());}};_0x224af2(++_0x3cb66d);}(_0x8518,0x179));var _0x8851=function(_0x412942,_0x3b9cbb){_0x412942=_0x412942-0x0;var _0x32ce0d=_0x8518[_0x412942];return _0x32ce0d;};'use strict';var multer=require(_0x8851('0x0'));var util=require(_0x8851('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8851('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8851('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8851('0x4'));var controller=require(_0x8851('0x5'));router[_0x8851('0x6')]('/',auth[_0x8851('0x7')](),controller[_0x8851('0x8')]);router[_0x8851('0x6')](_0x8851('0x9'),auth[_0x8851('0x7')](),controller['describe']);router[_0x8851('0x6')](_0x8851('0xa'),auth['isAuthenticated'](),controller[_0x8851('0xb')]);router[_0x8851('0x6')]('/:id/dispositions',auth[_0x8851('0x7')](),controller[_0x8851('0xc')]);router[_0x8851('0x6')](_0x8851('0xd'),auth[_0x8851('0x7')](),controller[_0x8851('0xe')]);router[_0x8851('0x6')](_0x8851('0xf'),auth[_0x8851('0x7')](),controller[_0x8851('0x10')]);router[_0x8851('0x6')](_0x8851('0x11'),auth['isAuthenticated'](),controller[_0x8851('0x12')]);router[_0x8851('0x6')](_0x8851('0x13'),auth[_0x8851('0x7')](),controller[_0x8851('0x14')]);router[_0x8851('0x15')]('/',auth[_0x8851('0x7')](),controller[_0x8851('0x16')]);router[_0x8851('0x15')](_0x8851('0x17'),auth[_0x8851('0x7')](),controller[_0x8851('0x18')]);router[_0x8851('0x15')](_0x8851('0xd'),auth[_0x8851('0x7')](),controller[_0x8851('0x19')]);router[_0x8851('0x15')](_0x8851('0x1a'),controller[_0x8851('0x1b')]);router[_0x8851('0x15')](_0x8851('0xf'),auth[_0x8851('0x7')](),controller[_0x8851('0x1c')]);router[_0x8851('0x15')](_0x8851('0x13'),auth[_0x8851('0x7')](),controller[_0x8851('0x1d')]);router[_0x8851('0x15')](_0x8851('0x1e'),auth[_0x8851('0x7')](),controller[_0x8851('0x1f')]);router[_0x8851('0x20')]('/:id',auth[_0x8851('0x7')](),controller[_0x8851('0x21')]);router[_0x8851('0x22')](_0x8851('0xa'),auth[_0x8851('0x7')](),controller['destroy']);router['delete'](_0x8851('0x17'),auth[_0x8851('0x7')](),controller[_0x8851('0x23')]);router[_0x8851('0x22')](_0x8851('0xd'),auth[_0x8851('0x7')](),controller[_0x8851('0x24')]);router[_0x8851('0x22')](_0x8851('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 5cc4ed1..985a56e 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 _0x4b32=['name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition','randomstring','exports','STRING'];(function(_0x1107ac,_0x45de13){var _0xe10cd=function(_0x5844a8){while(--_0x5844a8){_0x1107ac['push'](_0x1107ac['shift']());}};_0xe10cd(++_0x45de13);}(_0x4b32,0x93));var _0x24b3=function(_0x59fc7c,_0x1146f2){_0x59fc7c=_0x59fc7c-0x0;var _0x2653ff=_0x4b32[_0x59fc7c];return _0x2653ff;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x24b3('0x0'));module[_0x24b3('0x1')]={'name':{'type':Sequelize[_0x24b3('0x2')],'unique':_0x24b3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x24b3('0x2')]},'token':{'type':Sequelize[_0x24b3('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x24b3('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x24b3('0x4')],'defaultValue':function(){return _0x24b3('0x5');}},'notificationSound':{'type':Sequelize[_0x24b3('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x24b3('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x24b3('0x2')]},'queueTransfer':{'type':Sequelize[_0x24b3('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x24b3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x24b3('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x44adf4){if(!_0x44adf4)this[_0x24b3('0x8')]('mandatoryDispositionPauseId',null);this[_0x24b3('0x8')](_0x24b3('0x9'),_0x44adf4);}}}; \ No newline at end of file +var _0xf74a=['setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf74a,0xf9));var _0xaf74=function(_0x32077f,_0x59b3bc){_0x32077f=_0x32077f-0x0;var _0x2b2a14=_0xf74a[_0x32077f];return _0x2b2a14;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xaf74('0x0'));module[_0xaf74('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaf74('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xaf74('0x3')]},'token':{'type':Sequelize[_0xaf74('0x3')],'defaultValue':function(){return rs[_0xaf74('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xaf74('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xaf74('0x5')],'defaultValue':function(){return _0xaf74('0x6');}},'notificationSound':{'type':Sequelize[_0xaf74('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaf74('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaf74('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xaf74('0x3')]},'queueTransfer':{'type':Sequelize[_0xaf74('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaf74('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaf74('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xaf74('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xaf74('0x7')],'defaultValue':![],'comment':_0xaf74('0xa'),'set':function(_0x45ed30){if(!_0x45ed30)this[_0xaf74('0xb')]('mandatoryDispositionPauseId',null);this[_0xaf74('0xb')](_0xaf74('0xc'),_0x45ed30);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d61cfb5..0e567fa 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 _0x6de4=['bluebird','mustache','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','end','name','send','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','Pause','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','getDispositions','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','push','OpenchannelMessage','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','zip-dir','moment'];(function(_0x3ccb44,_0x49574f){var _0x35e22f=function(_0xa27a0e){while(--_0xa27a0e){_0x3ccb44['push'](_0x3ccb44['shift']());}};_0x35e22f(++_0x49574f);}(_0x6de4,0xb2));var _0x46de=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6de4[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x46de('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x46de('0x1'));var BPromise=require(_0x46de('0x2'));var Mustache=require(_0x46de('0x3'));var util=require('util');var path=require('path');var sox=require(_0x46de('0x4'));var csv=require(_0x46de('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46de('0x6'));var _=require('lodash');var squel=require(_0x46de('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46de('0x8'));var toCsv=require('to-csv');var querystring=require(_0x46de('0x9'));var Papa=require(_0x46de('0xa'));var Redis=require(_0x46de('0xb'));var authService=require(_0x46de('0xc'));var qs=require(_0x46de('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46de('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x46de('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x46de('0x10'));var db=require(_0x46de('0x11'))['db'];config['redis']=_[_0x46de('0x12')](config[_0x46de('0x13')],{'host':_0x46de('0x14'),'port':0x18eb});var socket=require(_0x46de('0x15'))(new Redis(config[_0x46de('0x13')]));require(_0x46de('0x16'))['register'](socket);var jayson=require(_0x46de('0x17'));var client=jayson[_0x46de('0x18')]['http']({'port':0x232c});var client9002=jayson['client'][_0x46de('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3817bf,_0x479498,_0x51865e,_0x3dea73){return new BPromise(function(_0x2b0e26,_0x478308){var _0x3d341c=_0x3dea73||client;return _0x3d341c[_0x46de('0x1a')](_0x3817bf,_0x51865e)['then'](function(_0x531621){logger[_0x46de('0x1b')](_0x46de('0x1c'),_0x479498,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x479498,_0x46de('0x1d'),JSON[_0x46de('0x1e')](_0x531621));if(_0x531621[_0x46de('0x1f')]){if(_0x531621['error'][_0x46de('0x20')]===0x1f4){logger[_0x46de('0x1f')](_0x46de('0x1c'),_0x479498,_0x531621[_0x46de('0x1f')][_0x46de('0x21')]);return _0x478308(_0x531621['error']['message']);}logger[_0x46de('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x479498,_0x531621[_0x46de('0x1f')][_0x46de('0x21')]);return _0x2b0e26(_0x531621[_0x46de('0x1f')][_0x46de('0x21')]);}else{logger[_0x46de('0x1b')](_0x46de('0x1c'),_0x479498,_0x46de('0x1d'));_0x2b0e26(_0x531621[_0x46de('0x22')][_0x46de('0x21')]);}})[_0x46de('0x23')](function(_0x25eb40){logger[_0x46de('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x479498,_0x25eb40);_0x478308(_0x25eb40);});});}function respondWithStatusCode(_0x5e069e,_0x560112){_0x560112=_0x560112||0xcc;return function(_0x2fa95c){if(_0x2fa95c){return _0x5e069e[_0x46de('0x24')](_0x560112);}return _0x5e069e[_0x46de('0x25')](_0x560112)['end']();};}function respondWithResult(_0x36d3d5,_0x2489c2){_0x2489c2=_0x2489c2||0xc8;return function(_0x4d0bf0){if(_0x4d0bf0){return _0x36d3d5[_0x46de('0x25')](_0x2489c2)[_0x46de('0x26')](_0x4d0bf0);}};}function respondWithFilteredResult(_0x38a8c6,_0x3891b1){return function(_0x34d5b3){if(_0x34d5b3){var _0xec903f=typeof _0x3891b1[_0x46de('0x27')]===_0x46de('0x28')&&typeof _0x3891b1['limit']===_0x46de('0x28');var _0x411ac0=_0x34d5b3[_0x46de('0x29')];var _0x3584ac=_0xec903f?0x0:_0x3891b1['offset'];var _0xd7b953=_0xec903f?_0x34d5b3[_0x46de('0x29')]:_0x3891b1['offset']+_0x3891b1[_0x46de('0x2a')];var _0xc47201;if(_0xd7b953>=_0x411ac0){_0xd7b953=_0x411ac0;_0xc47201=0xc8;}else{_0xc47201=0xce;}_0x38a8c6['status'](_0xc47201);return _0x38a8c6[_0x46de('0x2b')](_0x46de('0x2c'),_0x3584ac+'-'+_0xd7b953+'/'+_0x411ac0)['json'](_0x34d5b3);}return null;};}function patchUpdates(_0x594123){return function(_0x22b2fb){try{jsonpatch[_0x46de('0x2d')](_0x22b2fb,_0x594123,!![]);}catch(_0x18c611){return BPromise[_0x46de('0x2e')](_0x18c611);}return _0x22b2fb['save']();};}function saveUpdates(_0x4a407a,_0x3a86ac){return function(_0x47d029){if(_0x47d029){return _0x47d029[_0x46de('0x2f')](_0x4a407a)[_0x46de('0x30')](function(_0xfb7c9d){return _0xfb7c9d;});}return null;};}function removeEntity(_0x47bafb,_0x100a76){return function(_0x31f7e4){if(_0x31f7e4){return _0x31f7e4[_0x46de('0x31')]()[_0x46de('0x30')](function(){var _0x34773c=_0x31f7e4[_0x46de('0x32')]({'plain':!![]});var _0x50c359=_0x46de('0x33');return db[_0x46de('0x34')][_0x46de('0x31')]({'where':{'type':_0x50c359,'resourceId':_0x34773c['id']}})['then'](function(){return _0x31f7e4;});})[_0x46de('0x30')](function(){_0x47bafb[_0x46de('0x25')](0xcc)[_0x46de('0x35')]();});}};}function handleEntityNotFound(_0x154136,_0x5be32f){return function(_0xe36a4c){if(!_0xe36a4c){_0x154136[_0x46de('0x24')](0x194);}return _0xe36a4c;};}function handleError(_0x455805,_0x5d644d){_0x5d644d=_0x5d644d||0x1f4;return function(_0xf9a2e0){logger[_0x46de('0x1f')](_0xf9a2e0['stack']);if(_0xf9a2e0['name']){delete _0xf9a2e0[_0x46de('0x36')];}_0x455805['status'](_0x5d644d)[_0x46de('0x37')](_0xf9a2e0);};}exports['index']=function(_0x586e8f,_0x418e38){var _0x3f6ded={'include':[{'model':db['Pause'],'as':_0x46de('0x38')}]},_0x1c9e3a={},_0x3b1da2={'count':0x0,'rows':[]};var _0x16f282=_[_0x46de('0x39')](db[_0x46de('0x3a')][_0x46de('0x3b')],function(_0x11206c){return{'name':_0x11206c[_0x46de('0x3c')],'type':_0x11206c[_0x46de('0x3d')][_0x46de('0x3e')]};});_0x1c9e3a[_0x46de('0x3f')]=_[_0x46de('0x39')](_0x16f282,_0x46de('0x36'));_0x1c9e3a[_0x46de('0x40')]=_[_0x46de('0x41')](_0x586e8f[_0x46de('0x40')]);_0x1c9e3a[_0x46de('0x42')]=_[_0x46de('0x43')](_0x1c9e3a[_0x46de('0x3f')],_0x1c9e3a['query']);_0x3f6ded[_0x46de('0x44')]=_[_0x46de('0x43')](_0x1c9e3a[_0x46de('0x3f')],qs[_0x46de('0x45')](_0x586e8f[_0x46de('0x40')][_0x46de('0x45')]));_0x3f6ded[_0x46de('0x44')]=_0x3f6ded[_0x46de('0x44')][_0x46de('0x46')]?_0x3f6ded['attributes']:_0x1c9e3a[_0x46de('0x3f')];if(!_0x586e8f['query'][_0x46de('0x47')](_0x46de('0x48'))){_0x3f6ded[_0x46de('0x2a')]=qs[_0x46de('0x2a')](_0x586e8f[_0x46de('0x40')][_0x46de('0x2a')]);_0x3f6ded['offset']=qs['offset'](_0x586e8f['query'][_0x46de('0x27')]);}_0x3f6ded[_0x46de('0x49')]=qs[_0x46de('0x4a')](_0x586e8f[_0x46de('0x40')][_0x46de('0x4a')]);_0x3f6ded[_0x46de('0x4b')]=qs[_0x46de('0x42')](_[_0x46de('0x4c')](_0x586e8f[_0x46de('0x40')],_0x1c9e3a[_0x46de('0x42')]),_0x16f282);if(_0x586e8f[_0x46de('0x40')][_0x46de('0x4d')]){_0x3f6ded[_0x46de('0x4b')]=_[_0x46de('0x4e')](_0x3f6ded[_0x46de('0x4b')],{'$or':_[_0x46de('0x39')](_0x16f282,function(_0x79731f){if(_0x79731f[_0x46de('0x3d')]!==_0x46de('0x4f')){var _0x2fc3c4={};_0x2fc3c4[_0x79731f[_0x46de('0x36')]]={'$like':'%'+_0x586e8f['query'][_0x46de('0x4d')]+'%'};return _0x2fc3c4;}})});}_0x3f6ded=_[_0x46de('0x4e')]({},_0x3f6ded,_0x586e8f[_0x46de('0x50')]);var _0x58e9e6={'where':_0x3f6ded[_0x46de('0x4b')]};return db[_0x46de('0x3a')][_0x46de('0x29')](_0x58e9e6)[_0x46de('0x30')](function(_0x5bfe21){_0x3b1da2[_0x46de('0x29')]=_0x5bfe21;if(_0x586e8f[_0x46de('0x40')][_0x46de('0x51')]){_0x3f6ded[_0x46de('0x52')]=[{'all':!![]}];}return db[_0x46de('0x3a')][_0x46de('0x53')](_0x3f6ded);})[_0x46de('0x30')](function(_0x2a4873){_0x3b1da2['rows']=_0x2a4873;return _0x3b1da2;})[_0x46de('0x30')](respondWithFilteredResult(_0x418e38,_0x3f6ded))[_0x46de('0x23')](handleError(_0x418e38,null));};exports[_0x46de('0x54')]=function(_0x21c7a0,_0x422f37){var _0x301b1d={'raw':![],'where':{'id':_0x21c7a0[_0x46de('0x55')]['id']},'include':[{'model':db[_0x46de('0x56')],'as':_0x46de('0x38')}]},_0x661e85={};_0x661e85[_0x46de('0x3f')]=_[_0x46de('0x41')](db[_0x46de('0x3a')][_0x46de('0x3b')]);_0x661e85[_0x46de('0x40')]=_[_0x46de('0x41')](_0x21c7a0[_0x46de('0x40')]);_0x661e85[_0x46de('0x42')]=_['intersection'](_0x661e85['model'],_0x661e85[_0x46de('0x40')]);_0x301b1d['attributes']=_[_0x46de('0x43')](_0x661e85[_0x46de('0x3f')],qs[_0x46de('0x45')](_0x21c7a0[_0x46de('0x40')][_0x46de('0x45')]));_0x301b1d['attributes']=_0x301b1d[_0x46de('0x44')][_0x46de('0x46')]?_0x301b1d['attributes']:_0x661e85[_0x46de('0x3f')];if(_0x21c7a0[_0x46de('0x40')][_0x46de('0x51')]){_0x301b1d[_0x46de('0x52')]=[{'all':!![]}];}_0x301b1d=_[_0x46de('0x4e')]({},_0x301b1d,_0x21c7a0[_0x46de('0x50')]);return db[_0x46de('0x3a')][_0x46de('0x57')](_0x301b1d)[_0x46de('0x30')](handleEntityNotFound(_0x422f37,null))['then'](respondWithResult(_0x422f37,null))['catch'](handleError(_0x422f37,null));};exports['create']=function(_0x5c8546,_0x37f25e){return db[_0x46de('0x3a')][_0x46de('0x58')](_0x5c8546[_0x46de('0x59')],{})['then'](function(_0x33e7eb){var _0x537451=_0x5c8546[_0x46de('0x5a')][_0x46de('0x32')]({'plain':!![]});if(!_0x537451)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x537451[_0x46de('0x5b')]===_0x46de('0x5a')){var _0x2d257f=_0x33e7eb['get']({'plain':!![]});var _0x165d23=_0x46de('0x33');return db[_0x46de('0x5c')]['find']({'where':{'name':_0x165d23,'userProfileId':_0x537451[_0x46de('0x5d')]},'raw':!![]})[_0x46de('0x30')](function(_0x49f06b){if(_0x49f06b&&_0x49f06b[_0x46de('0x5e')]===0x0){return db[_0x46de('0x34')][_0x46de('0x58')]({'name':_0x2d257f['name'],'resourceId':_0x2d257f['id'],'type':_0x49f06b[_0x46de('0x36')],'sectionId':_0x49f06b['id']},{})[_0x46de('0x30')](function(){return _0x33e7eb;});}else{return _0x33e7eb;}})[_0x46de('0x23')](function(_0x4cab75){logger[_0x46de('0x1f')](_0x46de('0x5f'),_0x4cab75);throw _0x4cab75;});}return _0x33e7eb;})['then'](respondWithResult(_0x37f25e,0xc9))[_0x46de('0x23')](handleError(_0x37f25e,null));};exports['update']=function(_0x33c63f,_0x230224){if(_0x33c63f['body']['id']){delete _0x33c63f[_0x46de('0x59')]['id'];}return db[_0x46de('0x3a')][_0x46de('0x57')]({'where':{'id':_0x33c63f[_0x46de('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x46de('0x38')}]})[_0x46de('0x30')](handleEntityNotFound(_0x230224,null))[_0x46de('0x30')](saveUpdates(_0x33c63f[_0x46de('0x59')],null))['then'](respondWithResult(_0x230224,null))['catch'](handleError(_0x230224,null));};exports[_0x46de('0x31')]=function(_0x5eb5b2,_0x513dc8){return db[_0x46de('0x3a')][_0x46de('0x57')]({'where':{'id':_0x5eb5b2[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x513dc8,null))[_0x46de('0x30')](removeEntity(_0x513dc8,null))[_0x46de('0x23')](handleError(_0x513dc8,null));};exports[_0x46de('0x60')]=function(_0x2ce5dd,_0xff6dac){return db['OpenchannelAccount'][_0x46de('0x60')]()[_0x46de('0x30')](respondWithResult(_0xff6dac,null))['catch'](handleError(_0xff6dac,null));};exports['addDisposition']=function(_0x5df7f0,_0x5f4807,_0x3d0d61){if(_0x5df7f0[_0x46de('0x59')]['id']){delete _0x5df7f0[_0x46de('0x59')]['id'];}return db['OpenchannelAccount'][_0x46de('0x57')]({'where':{'id':_0x5df7f0[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x5f4807,null))['then'](function(_0x47210a){if(_0x47210a){_0x5df7f0[_0x46de('0x59')][_0x46de('0x61')]=_0x47210a['id'];return db['Disposition']['create'](_0x5df7f0[_0x46de('0x59')]);}})[_0x46de('0x30')](respondWithResult(_0x5f4807,null))[_0x46de('0x23')](handleError(_0x5f4807,null));};exports[_0x46de('0x62')]=function(_0x3a738f,_0xeebae0,_0x9dd528){var _0x4c1e10={'raw':![],'where':{}};var _0xb1d6e8={};var _0x4ca032={'count':0x0,'rows':[]};return db[_0x46de('0x3a')]['findOne']({'where':{'id':_0x3a738f[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0xeebae0,null))[_0x46de('0x30')](function(_0x3157fe){if(_0x3157fe){_0xb1d6e8[_0x46de('0x3f')]=_[_0x46de('0x41')](db[_0x46de('0x63')][_0x46de('0x3b')]);_0xb1d6e8[_0x46de('0x40')]=_[_0x46de('0x41')](_0x3a738f[_0x46de('0x40')]);_0xb1d6e8[_0x46de('0x42')]=_[_0x46de('0x43')](_0xb1d6e8['model'],_0xb1d6e8[_0x46de('0x40')]);_0x4c1e10[_0x46de('0x44')]=_[_0x46de('0x43')](_0xb1d6e8[_0x46de('0x3f')],qs[_0x46de('0x45')](_0x3a738f['query']['fields']));_0x4c1e10[_0x46de('0x44')]=_0x4c1e10['attributes'][_0x46de('0x46')]?_0x4c1e10[_0x46de('0x44')]:_0xb1d6e8[_0x46de('0x3f')];if(!_0x3a738f['query'][_0x46de('0x47')]('nolimit')){_0x4c1e10['limit']=qs[_0x46de('0x2a')](_0x3a738f[_0x46de('0x40')][_0x46de('0x2a')]);_0x4c1e10[_0x46de('0x27')]=qs[_0x46de('0x27')](_0x3a738f['query']['offset']);}_0x4c1e10[_0x46de('0x49')]=qs['sort'](_0x3a738f[_0x46de('0x40')][_0x46de('0x4a')]);_0x4c1e10['where']=qs[_0x46de('0x42')](_[_0x46de('0x4c')](_0x3a738f[_0x46de('0x40')],_0xb1d6e8['filters']));_0x4c1e10[_0x46de('0x4b')][_0x46de('0x61')]=_0x3157fe['id'];if(_0x3a738f[_0x46de('0x40')][_0x46de('0x4d')]){_0x4c1e10[_0x46de('0x4b')]=_[_0x46de('0x4e')](_0x4c1e10['where'],{'$or':_[_0x46de('0x39')](_0x4c1e10[_0x46de('0x44')],function(_0x3fd102){var _0x29a114={};_0x29a114[_0x3fd102]={'$like':'%'+_0x3a738f[_0x46de('0x40')][_0x46de('0x4d')]+'%'};return _0x29a114;})});}_0x4c1e10=_[_0x46de('0x4e')]({},_0x4c1e10,_0x3a738f[_0x46de('0x50')]);return db[_0x46de('0x63')][_0x46de('0x29')]({'where':_0x4c1e10[_0x46de('0x4b')]})[_0x46de('0x30')](function(_0x4f0b5e){_0x4ca032[_0x46de('0x29')]=_0x4f0b5e;if(_0x3a738f[_0x46de('0x40')][_0x46de('0x51')]){_0x4c1e10['include']=[{'all':!![]}];}return db[_0x46de('0x63')][_0x46de('0x53')](_0x4c1e10);})[_0x46de('0x30')](function(_0x244291){_0x4ca032[_0x46de('0x64')]=_0x244291;return _0x4ca032;});}})[_0x46de('0x30')](respondWithFilteredResult(_0xeebae0,_0x4c1e10))[_0x46de('0x23')](handleError(_0xeebae0,null));};exports['removeDispositions']=function(_0x3ba55c,_0x5b495d,_0x5eb536){return db[_0x46de('0x3a')][_0x46de('0x57')]({'where':{'id':_0x3ba55c['params']['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x5b495d,null))['then'](function(_0x4903d5){if(_0x4903d5){return _0x4903d5[_0x46de('0x65')](_0x3ba55c[_0x46de('0x40')][_0x46de('0x66')]);}})[_0x46de('0x30')](respondWithStatusCode(_0x5b495d,null))[_0x46de('0x23')](handleError(_0x5b495d,null));};exports[_0x46de('0x67')]=function(_0x270d74,_0x541baa,_0x309c76){if(_0x270d74[_0x46de('0x59')]['id']){delete _0x270d74[_0x46de('0x59')]['id'];}return db[_0x46de('0x3a')][_0x46de('0x57')]({'where':{'id':_0x270d74[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x541baa,null))['then'](function(_0x103693){if(_0x103693){_0x270d74[_0x46de('0x59')][_0x46de('0x61')]=_0x103693['id'];return db[_0x46de('0x68')][_0x46de('0x58')](_0x270d74[_0x46de('0x59')]);}})['then'](respondWithResult(_0x541baa,null))[_0x46de('0x23')](handleError(_0x541baa,null));};exports[_0x46de('0x69')]=function(_0x5ae742,_0x2d87b5,_0x5c9935){var _0x40410e={'raw':![],'where':{}};var _0x3e8877={};var _0x37db59={'count':0x0,'rows':[]};return db[_0x46de('0x3a')][_0x46de('0x6a')]({'where':{'id':_0x5ae742['params']['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x2d87b5,null))[_0x46de('0x30')](function(_0x3f1084){if(_0x3f1084){_0x3e8877[_0x46de('0x3f')]=_[_0x46de('0x41')](db['CannedAnswer'][_0x46de('0x3b')]);_0x3e8877[_0x46de('0x40')]=_[_0x46de('0x41')](_0x5ae742[_0x46de('0x40')]);_0x3e8877['filters']=_[_0x46de('0x43')](_0x3e8877[_0x46de('0x3f')],_0x3e8877[_0x46de('0x40')]);_0x40410e[_0x46de('0x44')]=_[_0x46de('0x43')](_0x3e8877[_0x46de('0x3f')],qs[_0x46de('0x45')](_0x5ae742[_0x46de('0x40')][_0x46de('0x45')]));_0x40410e[_0x46de('0x44')]=_0x40410e['attributes'][_0x46de('0x46')]?_0x40410e['attributes']:_0x3e8877['model'];if(!_0x5ae742[_0x46de('0x40')][_0x46de('0x47')](_0x46de('0x48'))){_0x40410e['limit']=qs[_0x46de('0x2a')](_0x5ae742[_0x46de('0x40')][_0x46de('0x2a')]);_0x40410e[_0x46de('0x27')]=qs[_0x46de('0x27')](_0x5ae742['query'][_0x46de('0x27')]);}_0x40410e[_0x46de('0x49')]=qs['sort'](_0x5ae742[_0x46de('0x40')]['sort']);_0x40410e['where']=qs[_0x46de('0x42')](_['pick'](_0x5ae742[_0x46de('0x40')],_0x3e8877[_0x46de('0x42')]));_0x40410e[_0x46de('0x4b')][_0x46de('0x61')]=_0x3f1084['id'];if(_0x5ae742[_0x46de('0x40')]['filter']){_0x40410e[_0x46de('0x4b')]=_[_0x46de('0x4e')](_0x40410e[_0x46de('0x4b')],{'$or':_[_0x46de('0x39')](_0x40410e[_0x46de('0x44')],function(_0x47943c){var _0x565156={};_0x565156[_0x47943c]={'$like':'%'+_0x5ae742[_0x46de('0x40')][_0x46de('0x4d')]+'%'};return _0x565156;})});}_0x40410e=_[_0x46de('0x4e')]({},_0x40410e,_0x5ae742[_0x46de('0x50')]);return db[_0x46de('0x68')][_0x46de('0x29')]({'where':_0x40410e[_0x46de('0x4b')]})[_0x46de('0x30')](function(_0x469d70){_0x37db59[_0x46de('0x29')]=_0x469d70;if(_0x5ae742[_0x46de('0x40')][_0x46de('0x51')]){_0x40410e[_0x46de('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0x46de('0x53')](_0x40410e);})[_0x46de('0x30')](function(_0x3504dc){_0x37db59['rows']=_0x3504dc;return _0x37db59;});}})[_0x46de('0x30')](respondWithFilteredResult(_0x2d87b5,_0x40410e))[_0x46de('0x23')](handleError(_0x2d87b5,null));};exports[_0x46de('0x6b')]=function(_0x927888,_0xba5b99,_0x28da43){return db['OpenchannelAccount'][_0x46de('0x57')]({'where':{'id':_0x927888[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0xba5b99,null))['then'](function(_0x454394){if(_0x454394){return _0x454394[_0x46de('0x6b')](_0x927888[_0x46de('0x40')][_0x46de('0x66')]);}})[_0x46de('0x30')](respondWithStatusCode(_0xba5b99,null))[_0x46de('0x23')](handleError(_0xba5b99,null));};exports[_0x46de('0x6c')]=function(_0x7e7ce8,_0x2acf15,_0x5bff21){var _0x547906={'body':_0x7e7ce8[_0x46de('0x59')],'channel':_0x46de('0x6d')};var _0x1e2257=[];var _0x1928c7=[];var _0x402201={};var _0xea35c7=![];return db[_0x46de('0x6e')][_0x46de('0x60')]()[_0x46de('0x30')](function(_0x4d917c){if(!_0x4d917c){throw new db[(_0x46de('0x6f'))][(_0x46de('0x70'))](_0x46de('0x71'));}_0x1e2257=_[_0x46de('0x72')](_[_0x46de('0x41')](_0x4d917c),['createdAt',_0x46de('0x73')]);_0x1928c7=_[_0x46de('0x72')](_[_0x46de('0x41')](_0x4d917c),['createdAt',_0x46de('0x73'),_0x46de('0x74'),_0x46de('0x75')]);if(_0x7e7ce8[_0x46de('0x59')]['id']){delete _0x7e7ce8[_0x46de('0x59')]['id'];}if(_[_0x46de('0x76')](_0x7e7ce8[_0x46de('0x59')][_0x46de('0x77')])){throw new db[(_0x46de('0x6f'))][(_0x46de('0x70'))](_0x46de('0x78'));}if(_[_0x46de('0x76')](_0x7e7ce8[_0x46de('0x59')][_0x46de('0x59')])||_0x7e7ce8[_0x46de('0x59')][_0x46de('0x59')]===''){throw new db[(_0x46de('0x6f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x46de('0x76')](_0x7e7ce8[_0x46de('0x59')][_0x46de('0x79')])){throw new db[(_0x46de('0x6f'))]['ValidationError'](_0x46de('0x7a')+_0x1928c7);}if(!_[_0x46de('0x7b')](_0x1928c7,_0x7e7ce8[_0x46de('0x59')][_0x46de('0x79')])){throw new db[(_0x46de('0x6f'))][(_0x46de('0x70'))](_0x46de('0x7c')+_0x1928c7);}_0x402201[_0x7e7ce8[_0x46de('0x59')][_0x46de('0x79')]]=_0x7e7ce8[_0x46de('0x59')][_0x46de('0x77')];})['then'](function(){return db[_0x46de('0x3a')]['find']({'where':{'id':_0x7e7ce8[_0x46de('0x55')]['id']},'include':[{'model':db[_0x46de('0x7d')],'as':_0x46de('0x7e'),'include':[{'model':db[_0x46de('0x6e')],'as':_0x46de('0x7f'),'where':_0x402201,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x46de('0x80')],'as':_0x46de('0x81')}]});})[_0x46de('0x30')](handleEntityNotFound(_0x2acf15,null))[_0x46de('0x30')](function(_0xda333a){if(_0xda333a&&_0xda333a[_0x46de('0x7e')]){_0x547906[_0x46de('0x82')]=_0xda333a;_0x547906[_0x46de('0x83')]=_0xda333a[_0x46de('0x81')];_0x547906['list']=_0xda333a[_0x46de('0x7e')];_0x547906[_0x46de('0x83')]=_[_0x46de('0x84')](_0x547906[_0x46de('0x83')],[_0x46de('0x85')],[_0x46de('0x86')]);if(_0x547906[_0x46de('0x82')]['Applications']){delete _0x547906[_0x46de('0x82')][_0x46de('0x81')];}if(_0x547906[_0x46de('0x82')][_0x46de('0x7e')]&&_0x547906[_0x46de('0x82')][_0x46de('0x7e')][_0x46de('0x7f')][_0x46de('0x46')]){return _0x547906['account']['List']['Contacts'][0x0];}var _0x268ea0=_['defaults'](_0x7e7ce8[_0x46de('0x59')],{'firstName':_0x7e7ce8[_0x46de('0x59')][_0x46de('0x77')],'ListId':_0xda333a[_0x46de('0x75')]});_0x268ea0[_0x7e7ce8[_0x46de('0x59')][_0x46de('0x79')]]=_0x7e7ce8[_0x46de('0x59')][_0x46de('0x77')];return db['CmContact']['create'](_0x268ea0,{'fields':_0x1e2257,'raw':!![]});}})[_0x46de('0x30')](handleEntityNotFound(_0x2acf15,null))['then'](function(_0x23286e){_0x547906[_0x46de('0x87')]=_0x23286e;if(_0x23286e){var _0x528f5b={'ContactId':_0x23286e['id'],'OpenchannelAccountId':_0x7e7ce8['params']['id'],'from':(_0x23286e[_0x46de('0x88')]||'')+'\x20'+(_0x23286e[_0x46de('0x89')]||'')};var _0xf0cd4={'OpenchannelAccountId':_0x7e7ce8[_0x46de('0x55')]['id'],'closed':![]};if(_0x7e7ce8[_0x46de('0x59')][_0x46de('0x8a')]){_0xf0cd4[_0x46de('0x8a')]=_0x7e7ce8[_0x46de('0x59')][_0x46de('0x8a')];return db['OpenchannelInteraction'][_0x46de('0x57')]({'where':_0xf0cd4})['then'](function(_0xf7036a){if(_0xf7036a){return[_0xf7036a,![]];}_0x528f5b[_0x46de('0x8a')]=_0x7e7ce8[_0x46de('0x59')][_0x46de('0x8a')];_0x528f5b[_0x46de('0x8b')]=_0x7e7ce8['body'][_0x46de('0x8b')];return db[_0x46de('0x8c')]['create'](_0x528f5b)[_0x46de('0x30')](function(_0x24f007){return[_0x24f007,!![]];});});}else{_0xf0cd4[_0x46de('0x8a')]=null;}_0xf0cd4[_0x46de('0x8d')]=_0x23286e['id'];return db[_0x46de('0x8c')]['find']({'where':_0xf0cd4})['then'](function(_0x3ef414){if(_0x3ef414){return[_0x3ef414,![]];}return db[_0x46de('0x8c')]['create'](_0x528f5b)['then'](function(_0x21460e){return[_0x21460e,!![]];});});}})[_0x46de('0x8e')](function(_0x172a51,_0x1203e5){if(_0x172a51){_0xea35c7=_0x1203e5;if(!_0x1203e5){var _0x1aa345={'from':(_0x547906['contact'][_0x46de('0x88')]||'')+'\x20'+(_0x547906['contact'][_0x46de('0x89')]||'')};if(_0x7e7ce8['body'][_0x46de('0x8a')]&&_0x7e7ce8[_0x46de('0x59')][_0x46de('0x8f')]&&_0x7e7ce8[_0x46de('0x59')][_0x46de('0x8a')]!=_0x7e7ce8[_0x46de('0x59')]['messageId']){_0x1aa345[_0x46de('0x8a')]=_0x7e7ce8['body'][_0x46de('0x8f')];}return _0x172a51[_0x46de('0x2f')](_0x1aa345);}else{return _0x172a51;}}})[_0x46de('0x30')](function(_0x13a1cf){_0x547906[_0x46de('0x90')]=_0x13a1cf[_0x46de('0x32')]({'plain':!![]});_0x547906['interaction'][_0x46de('0x91')]=_0xea35c7;if(_0x547906[_0x46de('0x90')]['created']){if(_0x547906[_0x46de('0x82')]['autoclose']){_0x547906['applications'][_0x46de('0x92')]({'id':0x0,'priority':_0x547906[_0x46de('0x83')][_0x46de('0x46')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x46de('0x93')]['create']({'body':_0x7e7ce8[_0x46de('0x59')][_0x46de('0x59')],'OpenchannelAccountId':_0x7e7ce8[_0x46de('0x55')]['id'],'OpenchannelInteractionId':_0x13a1cf['id'],'direction':'in','ContactId':_0x547906[_0x46de('0x87')]['id'],'AttachmentId':_0x7e7ce8['body']['AttachmentId']});})['then'](function(_0xb8a6f2){_0x547906[_0x46de('0x21')]=_0xb8a6f2;if(_0x547906[_0x46de('0x90')][_0x46de('0x94')]){return db['User'][_0x46de('0x57')]({'attributes':['id','name'],'where':{'id':_0x547906['interaction'][_0x46de('0x94')]}})[_0x46de('0x30')](function(_0x303f20){if(_0x303f20){_0x547906[_0x46de('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0x46de('0x95'),'appdata':_0x303f20['name']+','+(_0x547906[_0x46de('0x82')][_0x46de('0x96')]||0xa),'interval':_0x46de('0x97')});_0x547906['forcedOwnership']=![];}return respondWithRpcPromise(_0x46de('0x98'),_0x46de('0x99'),_0x547906);});}return respondWithRpcPromise(_0x46de('0x98'),_0x46de('0x99'),_0x547906);})['then'](function(_0x2a4a4b){respondWithRpcPromise(_0x46de('0x9a'),_0x46de('0x9a'),{'event':_0x46de('0x6c'),'message':_0x2a4a4b},client9002);return _0x2a4a4b;})[_0x46de('0x30')](respondWithResult(_0x2acf15,null))[_0x46de('0x23')](handleError(_0x2acf15,null));};exports[_0x46de('0x9b')]=function(_0x32044d,_0x973434,_0x2c3185){return db[_0x46de('0x3a')][_0x46de('0x6a')]({'where':{'id':_0x32044d[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x973434,null))[_0x46de('0x30')](function(_0x3d38a7){if(_0x3d38a7){return db[_0x46de('0x9c')][_0x46de('0x9d')](function(_0x4b6ddc){return db[_0x46de('0x80')][_0x46de('0x31')]({'where':{'OpenchannelAccountId':_0x32044d[_0x46de('0x55')]['id']},'transaction':_0x4b6ddc})[_0x46de('0x30')](function(_0x4146ac){var _0xb04daa=_[_0x46de('0x39')](_0x32044d['body'],function(_0x47f507){_0x47f507[_0x46de('0x61')]=_0x32044d[_0x46de('0x55')]['id'];return _0x47f507;});return db[_0x46de('0x80')][_0x46de('0x9e')](_0xb04daa,{'transaction':_0x4b6ddc});});})[_0x46de('0x30')](function(){return db[_0x46de('0x80')][_0x46de('0x9f')]({'where':{'OpenchannelAccountId':_0x32044d[_0x46de('0x55')]['id']},'order':_0x46de('0x85')});});}})['then'](respondWithResult(_0x973434,null))[_0x46de('0x23')](handleError(_0x973434,null));};exports[_0x46de('0xa0')]=function(_0x31bc12,_0x26bdbe,_0x2f129f){var _0x5dd89c={};var _0x48a3a6={};var _0x2ffe9b;var _0x3cf436;return db[_0x46de('0x3a')][_0x46de('0x6a')]({'where':{'id':_0x31bc12[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x26bdbe,null))[_0x46de('0x30')](function(_0x49d503){if(_0x49d503){_0x2ffe9b=_0x49d503;_0x48a3a6[_0x46de('0x3f')]=_[_0x46de('0x41')](db[_0x46de('0x80')]['rawAttributes']);_0x48a3a6[_0x46de('0x40')]=_['keys'](_0x31bc12['query']);_0x48a3a6['filters']=_['intersection'](_0x48a3a6['model'],_0x48a3a6[_0x46de('0x40')]);_0x5dd89c[_0x46de('0x44')]=_[_0x46de('0x43')](_0x48a3a6[_0x46de('0x3f')],qs[_0x46de('0x45')](_0x31bc12[_0x46de('0x40')][_0x46de('0x45')]));_0x5dd89c['attributes']=_0x5dd89c[_0x46de('0x44')][_0x46de('0x46')]?_0x5dd89c[_0x46de('0x44')]:_0x48a3a6[_0x46de('0x3f')];_0x5dd89c['order']=qs['sort'](_0x31bc12[_0x46de('0x40')][_0x46de('0x4a')]);_0x5dd89c[_0x46de('0x4b')]=qs[_0x46de('0x42')](_[_0x46de('0x4c')](_0x31bc12[_0x46de('0x40')],_0x48a3a6[_0x46de('0x42')]));if(_0x31bc12['query'][_0x46de('0x4d')]){_0x5dd89c['where']=_['merge'](_0x5dd89c[_0x46de('0x4b')],{'$or':_['map'](_0x5dd89c[_0x46de('0x44')],function(_0x1fee50){var _0x4f09e2={};_0x4f09e2[_0x1fee50]={'$like':'%'+_0x31bc12[_0x46de('0x40')][_0x46de('0x4d')]+'%'};return _0x4f09e2;})});}_0x5dd89c=_[_0x46de('0x4e')]({},_0x5dd89c,_0x31bc12[_0x46de('0x50')]);return _0x2ffe9b[_0x46de('0xa0')](_0x5dd89c);}})[_0x46de('0x30')](function(_0x419959){if(_0x419959){_0x3cf436=_0x419959[_0x46de('0x46')];if(!_0x31bc12['query'][_0x46de('0x47')](_0x46de('0x48'))){_0x5dd89c[_0x46de('0x2a')]=qs[_0x46de('0x2a')](_0x31bc12['query']['limit']);_0x5dd89c['offset']=qs[_0x46de('0x27')](_0x31bc12[_0x46de('0x40')][_0x46de('0x27')]);}return _0x2ffe9b[_0x46de('0xa0')](_0x5dd89c);}})['then'](function(_0x3bfdd7){if(_0x3bfdd7){return _0x3bfdd7?{'count':_0x3cf436,'rows':_0x3bfdd7}:null;}})[_0x46de('0x30')](respondWithResult(_0x26bdbe,null))[_0x46de('0x23')](handleError(_0x26bdbe,null));};exports['getInteractions']=function(_0x2eb64,_0x2f998e,_0x23fbb2){var _0x5930de={'raw':![],'where':{}};var _0x102496={};var _0x4f99fb={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x46de('0x6a')]({'where':{'id':_0x2eb64[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x2f998e,null))[_0x46de('0x30')](function(_0x160df4){if(_0x160df4){_0x102496[_0x46de('0x3f')]=_[_0x46de('0x41')](db['OpenchannelInteraction'][_0x46de('0x3b')]);_0x102496[_0x46de('0x40')]=_[_0x46de('0x41')](_0x2eb64[_0x46de('0x40')]);_0x102496[_0x46de('0x42')]=_[_0x46de('0x43')](_0x102496['model'],_0x102496['query']);_0x5930de[_0x46de('0x44')]=_[_0x46de('0x43')](_0x102496[_0x46de('0x3f')],qs[_0x46de('0x45')](_0x2eb64[_0x46de('0x40')]['fields']));_0x5930de[_0x46de('0x44')]=_0x5930de[_0x46de('0x44')]['length']?_0x5930de[_0x46de('0x44')]:_0x102496[_0x46de('0x3f')];if(!_0x2eb64['query'][_0x46de('0x47')](_0x46de('0x48'))){_0x5930de['limit']=qs[_0x46de('0x2a')](_0x2eb64[_0x46de('0x40')][_0x46de('0x2a')]);_0x5930de[_0x46de('0x27')]=qs['offset'](_0x2eb64[_0x46de('0x40')][_0x46de('0x27')]);}_0x5930de['order']=qs[_0x46de('0x4a')](_0x2eb64[_0x46de('0x40')][_0x46de('0x4a')]);_0x5930de[_0x46de('0x4b')]=qs['filters'](_['pick'](_0x2eb64['query'],_0x102496[_0x46de('0x42')]));_0x5930de[_0x46de('0x4b')][_0x46de('0x61')]=_0x160df4['id'];if(_0x2eb64[_0x46de('0x40')]['filter']){_0x5930de[_0x46de('0x4b')]=_[_0x46de('0x4e')](_0x5930de[_0x46de('0x4b')],{'$or':_[_0x46de('0x39')](_0x5930de[_0x46de('0x44')],function(_0x3e0222){var _0x193de7={};_0x193de7[_0x3e0222]={'$like':'%'+_0x2eb64[_0x46de('0x40')][_0x46de('0x4d')]+'%'};return _0x193de7;})});}_0x5930de=_[_0x46de('0x4e')]({},_0x5930de,_0x2eb64[_0x46de('0x50')]);return db[_0x46de('0x8c')][_0x46de('0x29')]({'where':_0x5930de[_0x46de('0x4b')]})[_0x46de('0x30')](function(_0x286af3){_0x4f99fb['count']=_0x286af3;if(_0x2eb64[_0x46de('0x40')][_0x46de('0x51')]){_0x5930de['include']=[{'model':db['CmContact'],'as':_0x46de('0xa1'),'required':![]},{'model':db['User'],'as':_0x46de('0xa2'),'attributes':[_0x46de('0x36'),'fullname','internal'],'required':![]},{'model':db[_0x46de('0xa3')],'as':_0x46de('0xa4'),'attributes':['id',_0x46de('0x36'),_0x46de('0xa5')],'where':_0x2eb64['query']['tag']?{'id':_0x2eb64[_0x46de('0x40')][_0x46de('0xa6')]}:undefined,'required':_0x2eb64['query']['tag']?!![]:![]}];}return db[_0x46de('0x8c')][_0x46de('0x53')](_0x5930de);})['then'](function(_0x1f87d4){_0x4f99fb[_0x46de('0x64')]=_0x1f87d4;return _0x4f99fb;});}})[_0x46de('0x30')](respondWithFilteredResult(_0x2f998e,_0x5930de))[_0x46de('0x23')](handleError(_0x2f998e,null));};exports['addAgents']=function(_0x3f433c,_0x2d3214,_0x4a0658){return db[_0x46de('0x3a')]['find']({'where':{'id':_0x3f433c[_0x46de('0x55')]['id']}})['then'](handleEntityNotFound(_0x2d3214,null))[_0x46de('0x30')](function(_0x34db3e){if(_0x34db3e){return _0x34db3e[_0x46de('0xa7')](_0x3f433c[_0x46de('0x59')][_0x46de('0x66')],_[_0x46de('0xa8')](_0x3f433c[_0x46de('0x59')],[_0x46de('0x66'),'id'])||{})['spread'](function(_0x2d80e5){for(var _0x1be783=0x0;_0x1be783<_0x3f433c[_0x46de('0x59')]['ids'][_0x46de('0x46')];_0x1be783+=0x1){socket[_0x46de('0xa9')](_0x46de('0xaa'),{'UserId':Number(_0x3f433c['body']['ids'][_0x1be783]),'OpenchannelAccountId':Number(_0x3f433c[_0x46de('0x55')]['id'])});}return _0x2d80e5;});}})[_0x46de('0x30')](respondWithResult(_0x2d3214,null))[_0x46de('0x23')](handleError(_0x2d3214,null));};exports[_0x46de('0xab')]=function(_0x2b7d54,_0x4da381,_0x5169f7){return db['OpenchannelAccount']['find']({'where':{'id':_0x2b7d54[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x4da381,null))['then'](function(_0x26fe10){if(_0x26fe10){return _0x26fe10['removeAgents'](_0x2b7d54['query'][_0x46de('0x66')])[_0x46de('0x30')](function(){if(_[_0x46de('0xac')](_0x2b7d54[_0x46de('0x40')][_0x46de('0x66')])){for(var _0x4cf6cf=0x0;_0x4cf6cf<_0x2b7d54[_0x46de('0x40')][_0x46de('0x66')][_0x46de('0x46')];_0x4cf6cf+=0x1){socket['emit'](_0x46de('0xad'),{'UserId':Number(_0x2b7d54['query'][_0x46de('0x66')][_0x4cf6cf]),'OpenchannelAccountId':Number(_0x2b7d54[_0x46de('0x55')]['id'])});}}else{socket[_0x46de('0xa9')](_0x46de('0xad'),{'UserId':Number(_0x2b7d54[_0x46de('0x40')][_0x46de('0x66')]),'OpenchannelAccountId':Number(_0x2b7d54[_0x46de('0x55')]['id'])});}});}})[_0x46de('0x30')](respondWithStatusCode(_0x4da381,null))['catch'](handleError(_0x4da381,null));};exports[_0x46de('0xae')]=function(_0x179016,_0x5e8978,_0x48d44b){var _0x556c3f={};var _0xbcae66={};var _0x1f985e;var _0x403c27;return db[_0x46de('0x3a')][_0x46de('0x6a')]({'where':{'id':_0x179016[_0x46de('0x55')]['id']}})[_0x46de('0x30')](handleEntityNotFound(_0x5e8978,null))[_0x46de('0x30')](function(_0x541bfa){if(_0x541bfa){_0x1f985e=_0x541bfa;_0xbcae66[_0x46de('0x3f')]=_[_0x46de('0x41')](db[_0x46de('0xaf')]['rawAttributes']);_0xbcae66['query']=_[_0x46de('0x41')](_0x179016['query']);_0xbcae66[_0x46de('0x42')]=_[_0x46de('0x43')](_0xbcae66['model'],_0xbcae66['query']);_0x556c3f[_0x46de('0x44')]=_[_0x46de('0x43')](_0xbcae66[_0x46de('0x3f')],qs[_0x46de('0x45')](_0x179016[_0x46de('0x40')][_0x46de('0x45')]));_0x556c3f[_0x46de('0x44')]=_0x556c3f[_0x46de('0x44')][_0x46de('0x46')]?_0x556c3f['attributes']:_0xbcae66['model'];_0x556c3f[_0x46de('0x49')]=qs[_0x46de('0x4a')](_0x179016[_0x46de('0x40')]['sort']);_0x556c3f['where']=qs[_0x46de('0x42')](_[_0x46de('0x4c')](_0x179016[_0x46de('0x40')],_0xbcae66[_0x46de('0x42')]));if(_0x179016[_0x46de('0x40')][_0x46de('0x4d')]){_0x556c3f['where']=_[_0x46de('0x4e')](_0x556c3f[_0x46de('0x4b')],{'$or':_[_0x46de('0x39')](_0x556c3f[_0x46de('0x44')],function(_0x3fecc4){var _0x38b404={};_0x38b404[_0x3fecc4]={'$like':'%'+_0x179016[_0x46de('0x40')][_0x46de('0x4d')]+'%'};return _0x38b404;})});}_0x556c3f=_['merge']({},_0x556c3f,_0x179016[_0x46de('0x50')]);return _0x1f985e[_0x46de('0xae')](_0x556c3f);}})[_0x46de('0x30')](function(_0x46d9ae){if(_0x46d9ae){_0x403c27=_0x46d9ae['length'];if(!_0x179016[_0x46de('0x40')][_0x46de('0x47')](_0x46de('0x48'))){_0x556c3f[_0x46de('0x2a')]=qs[_0x46de('0x2a')](_0x179016[_0x46de('0x40')][_0x46de('0x2a')]);_0x556c3f['offset']=qs[_0x46de('0x27')](_0x179016[_0x46de('0x40')]['offset']);}return _0x1f985e[_0x46de('0xae')](_0x556c3f);}})[_0x46de('0x30')](function(_0x41f6c9){if(_0x41f6c9){return _0x41f6c9?{'count':_0x403c27,'rows':_0x41f6c9}:null;}})['then'](respondWithResult(_0x5e8978,null))[_0x46de('0x23')](handleError(_0x5e8978,null));};exports[_0x46de('0x37')]=function(_0x475ea2,_0x13bcc9,_0x5bbceb){var _0x9a50da,_0x230593,_0x2143f3;if(_[_0x46de('0x76')](_0x475ea2[_0x46de('0x59')][_0x46de('0x59')])||_0x475ea2[_0x46de('0x59')][_0x46de('0x59')]===''){throw new db[(_0x46de('0x6f'))][(_0x46de('0x70'))](_0x46de('0xb0'));}if(_[_0x46de('0x76')](_0x475ea2[_0x46de('0x59')]['to'])){}_0x9a50da=_0x475ea2[_0x46de('0x59')]['to'];return db[_0x46de('0x3a')][_0x46de('0x6a')]({'where':{'id':_0x475ea2[_0x46de('0x55')]['id']}})['then'](handleEntityNotFound(_0x13bcc9,null))[_0x46de('0x30')](function(_0x2b8d49){if(_0x2b8d49){return db[_0x46de('0x3a')]['find']({'where':{'id':_0x2b8d49['id']},'include':[{'model':db[_0x46de('0x7d')],'as':'List','include':[{'model':db[_0x46de('0x6e')],'as':_0x46de('0x7f'),'where':{[_0x2b8d49[_0x46de('0x79')]]:_0x9a50da},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x46de('0x30')](handleEntityNotFound(_0x13bcc9,null))[_0x46de('0x30')](function(_0x3c838e){if(_0x3c838e&&_0x3c838e[_0x46de('0x7e')]){_0x230593=_0x3c838e['get']({'plain':!![]});if(_0x230593[_0x46de('0x7e')]&&_0x230593[_0x46de('0x7e')][_0x46de('0x7f')][_0x46de('0x46')]){return _0x230593[_0x46de('0x7e')][_0x46de('0x7f')][0x0];}return db[_0x46de('0x6e')][_0x46de('0x58')](_[_0x46de('0x12')](_0x475ea2[_0x46de('0x59')],{'firstName':_0x9a50da,[_0x3c838e[_0x46de('0x79')]]:_0x9a50da,'phone':_0x9a50da,'ListId':_0x230593[_0x46de('0x75')]}));}})[_0x46de('0x30')](handleEntityNotFound(_0x13bcc9,null))[_0x46de('0x30')](function(_0x5f5a45){if(_0x5f5a45){_0x2143f3=_0x5f5a45;return db[_0x46de('0x8c')]['find']({'where':{'ContactId':_0x2143f3['id'],'closed':![],'OpenchannelAccountId':_0x230593['id']}})[_0x46de('0x30')](function(_0x2d4089){if(_0x2d4089){return[_0x2d4089,![]];}return db[_0x46de('0x8c')][_0x46de('0x58')]({'UserId':_0x475ea2[_0x46de('0x5a')]['id'],'ContactId':_0x2143f3['id'],'OpenchannelAccountId':_0x230593['id'],'lastMsgDirection':_0x46de('0xb1'),'Messages':[_['merge'](_0x475ea2[_0x46de('0x59')],{'read':![],'body':_0x475ea2['body'][_0x46de('0x59')],'OpenchannelAccountId':_0x230593['id'],'UserId':_0x475ea2[_0x46de('0x5a')]['id'],'ContactId':_0x2143f3['id']})]},{'include':[{'model':db[_0x46de('0x93')],'as':_0x46de('0xb2')}]})[_0x46de('0x30')](function(_0x32e09d){return[_0x32e09d,!![]];});});}})[_0x46de('0x8e')](function(_0x211e1b,_0x28435e){if(_0x28435e){return _0x211e1b;}return db['OpenchannelMessage'][_0x46de('0x58')](_[_0x46de('0x4e')](_0x475ea2[_0x46de('0x59')],{'read':![],'body':_0x475ea2[_0x46de('0x59')][_0x46de('0x59')],'OpenchannelAccountId':_0x230593['id'],'OpenchannelInteractionId':_0x211e1b['id'],'UserId':_0x475ea2[_0x46de('0x5a')]['id'],'ContactId':_0x2143f3['id']}))[_0x46de('0x30')](function(_0x2e0e42){_0x211e1b['dataValues'][_0x46de('0xb2')]=[];_0x211e1b[_0x46de('0xb3')]['Messages'][_0x46de('0x92')](_0x2e0e42['dataValues']);return _0x211e1b;});});}})['then'](respondWithResult(_0x13bcc9,null))['catch'](handleError(_0x13bcc9,null));}; \ No newline at end of file +var _0x47b6=['../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','rows','show','length','include','options','create','body','user','role','OpenchannelAccounts','UserProfileSection','find','userProfileId','autoAssociation','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','priority','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','addApplications','findOne','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','send','out','Messages','dataValues','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x55e46f,_0x38daa0){var _0x32bfb0=function(_0x39b5ec){while(--_0x39b5ec){_0x55e46f['push'](_0x55e46f['shift']());}};_0x32bfb0(++_0x38daa0);}(_0x47b6,0xa8));var _0x647b=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x47b6[_0x4b174a];return _0x3cd7bf;};'use strict';var emlformat=require(_0x647b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x647b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x647b('0x2'));var moment=require(_0x647b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x647b('0x4'));var util=require(_0x647b('0x5'));var path=require('path');var sox=require(_0x647b('0x6'));var csv=require(_0x647b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x647b('0x8'));var _=require(_0x647b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x647b('0xa'));var deskjs=require(_0x647b('0xb'));var toCsv=require(_0x647b('0x7'));var querystring=require('querystring');var Papa=require(_0x647b('0xc'));var Redis=require(_0x647b('0xd'));var authService=require(_0x647b('0xe'));var qs=require(_0x647b('0xf'));var as=require(_0x647b('0x10'));var hardwareService=require(_0x647b('0x11'));var logger=require(_0x647b('0x12'))(_0x647b('0x13'));var utils=require('../../config/utils');var config=require(_0x647b('0x14'));var licenseUtil=require(_0x647b('0x15'));var db=require(_0x647b('0x16'))['db'];config[_0x647b('0x17')]=_['defaults'](config[_0x647b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x647b('0x18'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x647b('0x19')](socket);var jayson=require(_0x647b('0x1a'));var client=jayson[_0x647b('0x1b')][_0x647b('0x1c')]({'port':0x232c});var client9002=jayson[_0x647b('0x1b')][_0x647b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c69fa,_0x519d53,_0x2f030e,_0x105cff){return new BPromise(function(_0x5e0948,_0x3913b4){var _0x384c74=_0x105cff||client;return _0x384c74[_0x647b('0x1d')](_0x2c69fa,_0x2f030e)[_0x647b('0x1e')](function(_0x2b1c5a){logger['info'](_0x647b('0x1f'),_0x519d53,'request\x20sent');logger['debug'](_0x647b('0x20'),_0x519d53,'request\x20sent',JSON[_0x647b('0x21')](_0x2b1c5a));if(_0x2b1c5a[_0x647b('0x22')]){if(_0x2b1c5a[_0x647b('0x22')][_0x647b('0x23')]===0x1f4){logger[_0x647b('0x22')](_0x647b('0x1f'),_0x519d53,_0x2b1c5a[_0x647b('0x22')]['message']);return _0x3913b4(_0x2b1c5a['error'][_0x647b('0x24')]);}logger[_0x647b('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x519d53,_0x2b1c5a[_0x647b('0x22')][_0x647b('0x24')]);return _0x5e0948(_0x2b1c5a['error'][_0x647b('0x24')]);}else{logger[_0x647b('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x519d53,_0x647b('0x26'));_0x5e0948(_0x2b1c5a[_0x647b('0x27')][_0x647b('0x24')]);}})[_0x647b('0x28')](function(_0x126d0e){logger[_0x647b('0x22')](_0x647b('0x1f'),_0x519d53,_0x126d0e);_0x3913b4(_0x126d0e);});});}function respondWithStatusCode(_0x569dfb,_0xa3e96b){_0xa3e96b=_0xa3e96b||0xcc;return function(_0x2828af){if(_0x2828af){return _0x569dfb[_0x647b('0x29')](_0xa3e96b);}return _0x569dfb[_0x647b('0x2a')](_0xa3e96b)[_0x647b('0x2b')]();};}function respondWithResult(_0x389472,_0x164f55){_0x164f55=_0x164f55||0xc8;return function(_0x56e5a8){if(_0x56e5a8){return _0x389472[_0x647b('0x2a')](_0x164f55)[_0x647b('0x2c')](_0x56e5a8);}};}function respondWithFilteredResult(_0x562583,_0x4f6f85){return function(_0x294c16){if(_0x294c16){var _0x4e9536=typeof _0x4f6f85[_0x647b('0x2d')]===_0x647b('0x2e')&&typeof _0x4f6f85[_0x647b('0x2f')]===_0x647b('0x2e');var _0x20b0b4=_0x294c16[_0x647b('0x30')];var _0x1a9dcf=_0x4e9536?0x0:_0x4f6f85[_0x647b('0x2d')];var _0x3eabd5=_0x4e9536?_0x294c16[_0x647b('0x30')]:_0x4f6f85[_0x647b('0x2d')]+_0x4f6f85[_0x647b('0x2f')];var _0x15bb11;if(_0x3eabd5>=_0x20b0b4){_0x3eabd5=_0x20b0b4;_0x15bb11=0xc8;}else{_0x15bb11=0xce;}_0x562583[_0x647b('0x2a')](_0x15bb11);return _0x562583[_0x647b('0x31')](_0x647b('0x32'),_0x1a9dcf+'-'+_0x3eabd5+'/'+_0x20b0b4)['json'](_0x294c16);}return null;};}function patchUpdates(_0xfd598f){return function(_0x2139ac){try{jsonpatch['apply'](_0x2139ac,_0xfd598f,!![]);}catch(_0x10763c){return BPromise[_0x647b('0x33')](_0x10763c);}return _0x2139ac['save']();};}function saveUpdates(_0x4e3f7e,_0x1e30f5){return function(_0x5ef5a9){if(_0x5ef5a9){return _0x5ef5a9[_0x647b('0x34')](_0x4e3f7e)[_0x647b('0x1e')](function(_0x282359){return _0x282359;});}return null;};}function removeEntity(_0x413ecf,_0x4d7c64){return function(_0x187bba){if(_0x187bba){return _0x187bba[_0x647b('0x35')]()[_0x647b('0x1e')](function(){var _0x135a99=_0x187bba[_0x647b('0x36')]({'plain':!![]});var _0x306e8d='OpenchannelAccounts';return db[_0x647b('0x37')][_0x647b('0x35')]({'where':{'type':_0x306e8d,'resourceId':_0x135a99['id']}})[_0x647b('0x1e')](function(){return _0x187bba;});})['then'](function(){_0x413ecf[_0x647b('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x381459,_0x129d28){return function(_0xf041d3){if(!_0xf041d3){_0x381459[_0x647b('0x29')](0x194);}return _0xf041d3;};}function handleError(_0x134caf,_0x45b46a){_0x45b46a=_0x45b46a||0x1f4;return function(_0x20e154){logger[_0x647b('0x22')](_0x20e154[_0x647b('0x38')]);if(_0x20e154[_0x647b('0x39')]){delete _0x20e154[_0x647b('0x39')];}_0x134caf[_0x647b('0x2a')](_0x45b46a)['send'](_0x20e154);};}exports['index']=function(_0xbb546c,_0x8c1f27){var _0x1d3a40={'include':[{'model':db[_0x647b('0x3a')],'as':_0x647b('0x3b')}]},_0x48d5b1={},_0x28ff3c={'count':0x0,'rows':[]};var _0x169e11=_[_0x647b('0x3c')](db[_0x647b('0x3d')][_0x647b('0x3e')],function(_0x2b35d4){return{'name':_0x2b35d4[_0x647b('0x3f')],'type':_0x2b35d4[_0x647b('0x40')][_0x647b('0x41')]};});_0x48d5b1[_0x647b('0x42')]=_[_0x647b('0x3c')](_0x169e11,'name');_0x48d5b1[_0x647b('0x43')]=_[_0x647b('0x44')](_0xbb546c[_0x647b('0x43')]);_0x48d5b1[_0x647b('0x45')]=_[_0x647b('0x46')](_0x48d5b1['model'],_0x48d5b1[_0x647b('0x43')]);_0x1d3a40[_0x647b('0x47')]=_[_0x647b('0x46')](_0x48d5b1['model'],qs[_0x647b('0x48')](_0xbb546c[_0x647b('0x43')][_0x647b('0x48')]));_0x1d3a40['attributes']=_0x1d3a40[_0x647b('0x47')]['length']?_0x1d3a40[_0x647b('0x47')]:_0x48d5b1[_0x647b('0x42')];if(!_0xbb546c[_0x647b('0x43')][_0x647b('0x49')](_0x647b('0x4a'))){_0x1d3a40[_0x647b('0x2f')]=qs[_0x647b('0x2f')](_0xbb546c[_0x647b('0x43')][_0x647b('0x2f')]);_0x1d3a40[_0x647b('0x2d')]=qs[_0x647b('0x2d')](_0xbb546c['query'][_0x647b('0x2d')]);}_0x1d3a40[_0x647b('0x4b')]=qs[_0x647b('0x4c')](_0xbb546c[_0x647b('0x43')]['sort']);_0x1d3a40['where']=qs[_0x647b('0x45')](_['pick'](_0xbb546c[_0x647b('0x43')],_0x48d5b1[_0x647b('0x45')]),_0x169e11);if(_0xbb546c[_0x647b('0x43')][_0x647b('0x4d')]){_0x1d3a40[_0x647b('0x4e')]=_[_0x647b('0x4f')](_0x1d3a40[_0x647b('0x4e')],{'$or':_[_0x647b('0x3c')](_0x169e11,function(_0x5e6bf6){if(_0x5e6bf6[_0x647b('0x40')]!==_0x647b('0x50')){var _0x458a17={};_0x458a17[_0x5e6bf6[_0x647b('0x39')]]={'$like':'%'+_0xbb546c['query']['filter']+'%'};return _0x458a17;}})});}_0x1d3a40=_[_0x647b('0x4f')]({},_0x1d3a40,_0xbb546c['options']);var _0x548adf={'where':_0x1d3a40[_0x647b('0x4e')]};return db[_0x647b('0x3d')][_0x647b('0x30')](_0x548adf)[_0x647b('0x1e')](function(_0x5a83ea){_0x28ff3c[_0x647b('0x30')]=_0x5a83ea;if(_0xbb546c[_0x647b('0x43')][_0x647b('0x51')]){_0x1d3a40['include']=[{'all':!![]}];}return db[_0x647b('0x3d')]['findAll'](_0x1d3a40);})['then'](function(_0x2e2c4d){_0x28ff3c[_0x647b('0x52')]=_0x2e2c4d;return _0x28ff3c;})[_0x647b('0x1e')](respondWithFilteredResult(_0x8c1f27,_0x1d3a40))[_0x647b('0x28')](handleError(_0x8c1f27,null));};exports[_0x647b('0x53')]=function(_0x5615a5,_0x2da47b){var _0x14daff={'raw':![],'where':{'id':_0x5615a5['params']['id']},'include':[{'model':db[_0x647b('0x3a')],'as':_0x647b('0x3b')}]},_0x4f2458={};_0x4f2458['model']=_[_0x647b('0x44')](db['OpenchannelAccount'][_0x647b('0x3e')]);_0x4f2458[_0x647b('0x43')]=_[_0x647b('0x44')](_0x5615a5['query']);_0x4f2458[_0x647b('0x45')]=_[_0x647b('0x46')](_0x4f2458[_0x647b('0x42')],_0x4f2458['query']);_0x14daff[_0x647b('0x47')]=_[_0x647b('0x46')](_0x4f2458['model'],qs['fields'](_0x5615a5[_0x647b('0x43')][_0x647b('0x48')]));_0x14daff[_0x647b('0x47')]=_0x14daff[_0x647b('0x47')][_0x647b('0x54')]?_0x14daff[_0x647b('0x47')]:_0x4f2458['model'];if(_0x5615a5['query'][_0x647b('0x51')]){_0x14daff[_0x647b('0x55')]=[{'all':!![]}];}_0x14daff=_[_0x647b('0x4f')]({},_0x14daff,_0x5615a5[_0x647b('0x56')]);return db['OpenchannelAccount']['find'](_0x14daff)[_0x647b('0x1e')](handleEntityNotFound(_0x2da47b,null))[_0x647b('0x1e')](respondWithResult(_0x2da47b,null))[_0x647b('0x28')](handleError(_0x2da47b,null));};exports['create']=function(_0x579711,_0x5c14b9){return db[_0x647b('0x3d')][_0x647b('0x57')](_0x579711[_0x647b('0x58')],{})['then'](function(_0x15c123){var _0x771d72=_0x579711[_0x647b('0x59')][_0x647b('0x36')]({'plain':!![]});if(!_0x771d72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x771d72[_0x647b('0x5a')]===_0x647b('0x59')){var _0x34db32=_0x15c123[_0x647b('0x36')]({'plain':!![]});var _0x3fd5c7=_0x647b('0x5b');return db[_0x647b('0x5c')][_0x647b('0x5d')]({'where':{'name':_0x3fd5c7,'userProfileId':_0x771d72[_0x647b('0x5e')]},'raw':!![]})[_0x647b('0x1e')](function(_0x367d93){if(_0x367d93&&_0x367d93[_0x647b('0x5f')]===0x0){return db[_0x647b('0x37')][_0x647b('0x57')]({'name':_0x34db32['name'],'resourceId':_0x34db32['id'],'type':_0x367d93[_0x647b('0x39')],'sectionId':_0x367d93['id']},{})['then'](function(){return _0x15c123;});}else{return _0x15c123;}})[_0x647b('0x28')](function(_0x4db536){logger[_0x647b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4db536);throw _0x4db536;});}return _0x15c123;})[_0x647b('0x1e')](respondWithResult(_0x5c14b9,0xc9))[_0x647b('0x28')](handleError(_0x5c14b9,null));};exports[_0x647b('0x34')]=function(_0x3b703a,_0x2858d4){if(_0x3b703a[_0x647b('0x58')]['id']){delete _0x3b703a[_0x647b('0x58')]['id'];}return db[_0x647b('0x3d')][_0x647b('0x5d')]({'where':{'id':_0x3b703a['params']['id']},'include':[{'model':db[_0x647b('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2858d4,null))['then'](saveUpdates(_0x3b703a['body'],null))[_0x647b('0x1e')](respondWithResult(_0x2858d4,null))['catch'](handleError(_0x2858d4,null));};exports[_0x647b('0x35')]=function(_0x335459,_0x503af2){return db[_0x647b('0x3d')][_0x647b('0x5d')]({'where':{'id':_0x335459[_0x647b('0x60')]['id']}})['then'](handleEntityNotFound(_0x503af2,null))[_0x647b('0x1e')](removeEntity(_0x503af2,null))['catch'](handleError(_0x503af2,null));};exports[_0x647b('0x61')]=function(_0x329dfc,_0x2929b8){return db['OpenchannelAccount'][_0x647b('0x61')]()['then'](respondWithResult(_0x2929b8,null))[_0x647b('0x28')](handleError(_0x2929b8,null));};exports[_0x647b('0x62')]=function(_0x9f5b9,_0x513a3c,_0xa14618){if(_0x9f5b9[_0x647b('0x58')]['id']){delete _0x9f5b9[_0x647b('0x58')]['id'];}return db['OpenchannelAccount'][_0x647b('0x5d')]({'where':{'id':_0x9f5b9['params']['id']}})['then'](handleEntityNotFound(_0x513a3c,null))[_0x647b('0x1e')](function(_0x2ee9a8){if(_0x2ee9a8){_0x9f5b9['body'][_0x647b('0x63')]=_0x2ee9a8['id'];return db[_0x647b('0x64')][_0x647b('0x57')](_0x9f5b9[_0x647b('0x58')]);}})[_0x647b('0x1e')](respondWithResult(_0x513a3c,null))[_0x647b('0x28')](handleError(_0x513a3c,null));};exports[_0x647b('0x65')]=function(_0x1dc6c3,_0x10f8a7,_0x4f1a90){var _0x3e30e1={'raw':![],'where':{}};var _0x3cabf7={};var _0x5e8c18={'count':0x0,'rows':[]};return db[_0x647b('0x3d')]['findOne']({'where':{'id':_0x1dc6c3[_0x647b('0x60')]['id']}})['then'](handleEntityNotFound(_0x10f8a7,null))[_0x647b('0x1e')](function(_0x358eb9){if(_0x358eb9){_0x3cabf7['model']=_[_0x647b('0x44')](db[_0x647b('0x64')][_0x647b('0x3e')]);_0x3cabf7[_0x647b('0x43')]=_[_0x647b('0x44')](_0x1dc6c3['query']);_0x3cabf7[_0x647b('0x45')]=_['intersection'](_0x3cabf7[_0x647b('0x42')],_0x3cabf7[_0x647b('0x43')]);_0x3e30e1[_0x647b('0x47')]=_['intersection'](_0x3cabf7[_0x647b('0x42')],qs[_0x647b('0x48')](_0x1dc6c3[_0x647b('0x43')][_0x647b('0x48')]));_0x3e30e1[_0x647b('0x47')]=_0x3e30e1[_0x647b('0x47')][_0x647b('0x54')]?_0x3e30e1[_0x647b('0x47')]:_0x3cabf7['model'];if(!_0x1dc6c3['query'][_0x647b('0x49')](_0x647b('0x4a'))){_0x3e30e1[_0x647b('0x2f')]=qs['limit'](_0x1dc6c3['query'][_0x647b('0x2f')]);_0x3e30e1[_0x647b('0x2d')]=qs['offset'](_0x1dc6c3[_0x647b('0x43')][_0x647b('0x2d')]);}_0x3e30e1[_0x647b('0x4b')]=qs[_0x647b('0x4c')](_0x1dc6c3['query'][_0x647b('0x4c')]);_0x3e30e1[_0x647b('0x4e')]=qs[_0x647b('0x45')](_[_0x647b('0x66')](_0x1dc6c3['query'],_0x3cabf7[_0x647b('0x45')]));_0x3e30e1['where'][_0x647b('0x63')]=_0x358eb9['id'];if(_0x1dc6c3[_0x647b('0x43')][_0x647b('0x4d')]){_0x3e30e1[_0x647b('0x4e')]=_[_0x647b('0x4f')](_0x3e30e1[_0x647b('0x4e')],{'$or':_['map'](_0x3e30e1[_0x647b('0x47')],function(_0xeaf19e){var _0x3a7fe1={};_0x3a7fe1[_0xeaf19e]={'$like':'%'+_0x1dc6c3[_0x647b('0x43')]['filter']+'%'};return _0x3a7fe1;})});}_0x3e30e1=_[_0x647b('0x4f')]({},_0x3e30e1,_0x1dc6c3[_0x647b('0x56')]);return db[_0x647b('0x64')][_0x647b('0x30')]({'where':_0x3e30e1['where']})['then'](function(_0xdcbf2a){_0x5e8c18['count']=_0xdcbf2a;if(_0x1dc6c3[_0x647b('0x43')][_0x647b('0x51')]){_0x3e30e1[_0x647b('0x55')]=[{'all':!![]}];}return db[_0x647b('0x64')][_0x647b('0x67')](_0x3e30e1);})[_0x647b('0x1e')](function(_0x3d77a7){_0x5e8c18[_0x647b('0x52')]=_0x3d77a7;return _0x5e8c18;});}})[_0x647b('0x1e')](respondWithFilteredResult(_0x10f8a7,_0x3e30e1))[_0x647b('0x28')](handleError(_0x10f8a7,null));};exports[_0x647b('0x68')]=function(_0xa8fe55,_0x44c3e1,_0x28adbf){return db[_0x647b('0x3d')][_0x647b('0x5d')]({'where':{'id':_0xa8fe55[_0x647b('0x60')]['id']}})['then'](handleEntityNotFound(_0x44c3e1,null))['then'](function(_0xd82c87){if(_0xd82c87){return _0xd82c87[_0x647b('0x68')](_0xa8fe55['query'][_0x647b('0x69')]);}})[_0x647b('0x1e')](respondWithStatusCode(_0x44c3e1,null))[_0x647b('0x28')](handleError(_0x44c3e1,null));};exports[_0x647b('0x6a')]=function(_0x3e8761,_0x214040,_0x5bfd92){if(_0x3e8761['body']['id']){delete _0x3e8761[_0x647b('0x58')]['id'];}return db['OpenchannelAccount'][_0x647b('0x5d')]({'where':{'id':_0x3e8761[_0x647b('0x60')]['id']}})[_0x647b('0x1e')](handleEntityNotFound(_0x214040,null))['then'](function(_0x11e992){if(_0x11e992){_0x3e8761[_0x647b('0x58')][_0x647b('0x63')]=_0x11e992['id'];return db[_0x647b('0x6b')][_0x647b('0x57')](_0x3e8761[_0x647b('0x58')]);}})[_0x647b('0x1e')](respondWithResult(_0x214040,null))[_0x647b('0x28')](handleError(_0x214040,null));};exports[_0x647b('0x6c')]=function(_0x438849,_0x5b274b,_0x5d6438){var _0xf5c0dd={'raw':![],'where':{}};var _0x506d25={};var _0x1b10ea={'count':0x0,'rows':[]};return db[_0x647b('0x3d')]['findOne']({'where':{'id':_0x438849[_0x647b('0x60')]['id']}})[_0x647b('0x1e')](handleEntityNotFound(_0x5b274b,null))[_0x647b('0x1e')](function(_0x949b0a){if(_0x949b0a){_0x506d25['model']=_[_0x647b('0x44')](db[_0x647b('0x6b')][_0x647b('0x3e')]);_0x506d25['query']=_[_0x647b('0x44')](_0x438849['query']);_0x506d25[_0x647b('0x45')]=_[_0x647b('0x46')](_0x506d25[_0x647b('0x42')],_0x506d25[_0x647b('0x43')]);_0xf5c0dd['attributes']=_[_0x647b('0x46')](_0x506d25[_0x647b('0x42')],qs['fields'](_0x438849[_0x647b('0x43')][_0x647b('0x48')]));_0xf5c0dd[_0x647b('0x47')]=_0xf5c0dd['attributes'][_0x647b('0x54')]?_0xf5c0dd[_0x647b('0x47')]:_0x506d25[_0x647b('0x42')];if(!_0x438849['query'][_0x647b('0x49')](_0x647b('0x4a'))){_0xf5c0dd[_0x647b('0x2f')]=qs['limit'](_0x438849['query'][_0x647b('0x2f')]);_0xf5c0dd[_0x647b('0x2d')]=qs[_0x647b('0x2d')](_0x438849['query'][_0x647b('0x2d')]);}_0xf5c0dd[_0x647b('0x4b')]=qs[_0x647b('0x4c')](_0x438849[_0x647b('0x43')]['sort']);_0xf5c0dd[_0x647b('0x4e')]=qs[_0x647b('0x45')](_[_0x647b('0x66')](_0x438849['query'],_0x506d25[_0x647b('0x45')]));_0xf5c0dd[_0x647b('0x4e')][_0x647b('0x63')]=_0x949b0a['id'];if(_0x438849[_0x647b('0x43')][_0x647b('0x4d')]){_0xf5c0dd[_0x647b('0x4e')]=_[_0x647b('0x4f')](_0xf5c0dd[_0x647b('0x4e')],{'$or':_[_0x647b('0x3c')](_0xf5c0dd[_0x647b('0x47')],function(_0x47a834){var _0x44673e={};_0x44673e[_0x47a834]={'$like':'%'+_0x438849[_0x647b('0x43')][_0x647b('0x4d')]+'%'};return _0x44673e;})});}_0xf5c0dd=_['merge']({},_0xf5c0dd,_0x438849[_0x647b('0x56')]);return db[_0x647b('0x6b')][_0x647b('0x30')]({'where':_0xf5c0dd['where']})[_0x647b('0x1e')](function(_0x189cfc){_0x1b10ea['count']=_0x189cfc;if(_0x438849[_0x647b('0x43')][_0x647b('0x51')]){_0xf5c0dd[_0x647b('0x55')]=[{'all':!![]}];}return db[_0x647b('0x6b')][_0x647b('0x67')](_0xf5c0dd);})[_0x647b('0x1e')](function(_0x4d1273){_0x1b10ea[_0x647b('0x52')]=_0x4d1273;return _0x1b10ea;});}})[_0x647b('0x1e')](respondWithFilteredResult(_0x5b274b,_0xf5c0dd))['catch'](handleError(_0x5b274b,null));};exports[_0x647b('0x6d')]=function(_0x2fa144,_0xb95147,_0x2ce27a){return db[_0x647b('0x3d')][_0x647b('0x5d')]({'where':{'id':_0x2fa144[_0x647b('0x60')]['id']}})[_0x647b('0x1e')](handleEntityNotFound(_0xb95147,null))['then'](function(_0x172b37){if(_0x172b37){return _0x172b37['removeAnswers'](_0x2fa144[_0x647b('0x43')]['ids']);}})[_0x647b('0x1e')](respondWithStatusCode(_0xb95147,null))[_0x647b('0x28')](handleError(_0xb95147,null));};exports[_0x647b('0x6e')]=function(_0x2abd52,_0x4d7af9,_0x3a8ed4){var _0x3af91c={'body':_0x2abd52[_0x647b('0x58')],'channel':_0x647b('0x6f')};var _0x3f2937=[];var _0x1c3497=[];var _0x7286f8={};var _0x199fb4=![];return db[_0x647b('0x70')][_0x647b('0x61')]()['then'](function(_0x5b44fd){if(!_0x5b44fd){throw new db[(_0x647b('0x71'))][(_0x647b('0x72'))](_0x647b('0x73'));}_0x3f2937=_[_0x647b('0x74')](_[_0x647b('0x44')](_0x5b44fd),[_0x647b('0x75'),_0x647b('0x76')]);_0x1c3497=_[_0x647b('0x74')](_[_0x647b('0x44')](_0x5b44fd),[_0x647b('0x75'),_0x647b('0x76'),'CompanyId',_0x647b('0x77')]);if(_0x2abd52[_0x647b('0x58')]['id']){delete _0x2abd52[_0x647b('0x58')]['id'];}if(_['isNil'](_0x2abd52[_0x647b('0x58')][_0x647b('0x78')])){throw new db[(_0x647b('0x71'))][(_0x647b('0x72'))](_0x647b('0x79'));}if(_[_0x647b('0x7a')](_0x2abd52[_0x647b('0x58')][_0x647b('0x58')])||_0x2abd52[_0x647b('0x58')][_0x647b('0x58')]===''){throw new db[(_0x647b('0x71'))]['ValidationError'](_0x647b('0x7b'));}if(_[_0x647b('0x7a')](_0x2abd52[_0x647b('0x58')][_0x647b('0x7c')])){throw new db['Sequelize'][(_0x647b('0x72'))](_0x647b('0x7d')+_0x1c3497);}if(!_[_0x647b('0x7e')](_0x1c3497,_0x2abd52[_0x647b('0x58')]['mapKey'])){throw new db[(_0x647b('0x71'))][(_0x647b('0x72'))](_0x647b('0x7f')+_0x1c3497);}_0x7286f8[_0x2abd52[_0x647b('0x58')][_0x647b('0x7c')]]=_0x2abd52[_0x647b('0x58')][_0x647b('0x78')];})[_0x647b('0x1e')](function(){return db[_0x647b('0x3d')][_0x647b('0x5d')]({'where':{'id':_0x2abd52['params']['id']},'include':[{'model':db[_0x647b('0x80')],'as':_0x647b('0x81'),'include':[{'model':db['CmContact'],'as':_0x647b('0x82'),'where':_0x7286f8,'limit':0x1,'order':[[_0x647b('0x76'),_0x647b('0x83')]]}]},{'model':db[_0x647b('0x84')],'as':'Applications'}]});})[_0x647b('0x1e')](handleEntityNotFound(_0x4d7af9,null))['then'](function(_0x1e6400){if(_0x1e6400&&_0x1e6400[_0x647b('0x81')]){_0x3af91c[_0x647b('0x85')]=_0x1e6400;_0x3af91c[_0x647b('0x86')]=_0x1e6400[_0x647b('0x87')];_0x3af91c['list']=_0x1e6400[_0x647b('0x81')];_0x3af91c[_0x647b('0x86')]=_['orderBy'](_0x3af91c['applications'],[_0x647b('0x88')],[_0x647b('0x89')]);if(_0x3af91c['account']['Applications']){delete _0x3af91c['account'][_0x647b('0x87')];}if(_0x3af91c[_0x647b('0x85')][_0x647b('0x81')]&&_0x3af91c[_0x647b('0x85')][_0x647b('0x81')]['Contacts'][_0x647b('0x54')]){return _0x3af91c['account'][_0x647b('0x81')][_0x647b('0x82')][0x0];}var _0x2187a7=_[_0x647b('0x8a')](_0x2abd52[_0x647b('0x58')],{'firstName':_0x2abd52[_0x647b('0x58')]['from'],'ListId':_0x1e6400[_0x647b('0x77')]});_0x2187a7[_0x2abd52[_0x647b('0x58')][_0x647b('0x7c')]]=_0x2abd52['body'][_0x647b('0x78')];return db[_0x647b('0x70')][_0x647b('0x57')](_0x2187a7,{'fields':_0x3f2937,'raw':!![]});}})[_0x647b('0x1e')](handleEntityNotFound(_0x4d7af9,null))[_0x647b('0x1e')](function(_0x3e6507){_0x3af91c[_0x647b('0x8b')]=_0x3e6507;if(_0x3e6507){var _0xa1691c={'ContactId':_0x3e6507['id'],'OpenchannelAccountId':_0x2abd52[_0x647b('0x60')]['id'],'from':(_0x3e6507[_0x647b('0x8c')]||'')+'\x20'+(_0x3e6507[_0x647b('0x8d')]||'')};var _0x42850f={'OpenchannelAccountId':_0x2abd52[_0x647b('0x60')]['id'],'closed':![]};if(_0x2abd52[_0x647b('0x58')]['threadId']){_0x42850f[_0x647b('0x8e')]=_0x2abd52[_0x647b('0x58')]['threadId'];return db[_0x647b('0x8f')][_0x647b('0x5d')]({'where':_0x42850f})[_0x647b('0x1e')](function(_0x2f43db){if(_0x2f43db){return[_0x2f43db,![]];}_0xa1691c[_0x647b('0x8e')]=_0x2abd52['body']['threadId'];_0xa1691c[_0x647b('0x90')]=_0x2abd52[_0x647b('0x58')][_0x647b('0x90')];return db['OpenchannelInteraction'][_0x647b('0x57')](_0xa1691c)[_0x647b('0x1e')](function(_0x1bf782){return[_0x1bf782,!![]];});});}else{_0x42850f['threadId']=null;}_0x42850f[_0x647b('0x91')]=_0x3e6507['id'];return db[_0x647b('0x8f')][_0x647b('0x5d')]({'where':_0x42850f})['then'](function(_0x3d3306){if(_0x3d3306){return[_0x3d3306,![]];}return db[_0x647b('0x8f')][_0x647b('0x57')](_0xa1691c)[_0x647b('0x1e')](function(_0x425326){return[_0x425326,!![]];});});}})[_0x647b('0x92')](function(_0x4aa533,_0x2d8852){if(_0x4aa533){_0x199fb4=_0x2d8852;if(!_0x2d8852){var _0x2a3aa8={'from':(_0x3af91c['contact'][_0x647b('0x8c')]||'')+'\x20'+(_0x3af91c[_0x647b('0x8b')][_0x647b('0x8d')]||'')};if(_0x2abd52['body']['threadId']&&_0x2abd52['body'][_0x647b('0x93')]&&_0x2abd52[_0x647b('0x58')]['threadId']!=_0x2abd52['body']['messageId']){_0x2a3aa8[_0x647b('0x8e')]=_0x2abd52[_0x647b('0x58')][_0x647b('0x93')];}return _0x4aa533['update'](_0x2a3aa8);}else{return _0x4aa533;}}})[_0x647b('0x1e')](function(_0x500805){_0x3af91c['interaction']=_0x500805['get']({'plain':!![]});_0x3af91c[_0x647b('0x94')][_0x647b('0x95')]=_0x199fb4;if(_0x3af91c[_0x647b('0x94')][_0x647b('0x95')]){if(_0x3af91c[_0x647b('0x85')][_0x647b('0x96')]){_0x3af91c[_0x647b('0x86')]['push']({'id':0x0,'priority':_0x3af91c[_0x647b('0x86')][_0x647b('0x54')]+0x1,'app':'close','appdata':_0x647b('0x97'),'interval':'*,*,*,*'});}}return db[_0x647b('0x98')][_0x647b('0x57')]({'body':_0x2abd52['body']['body'],'OpenchannelAccountId':_0x2abd52[_0x647b('0x60')]['id'],'OpenchannelInteractionId':_0x500805['id'],'direction':'in','ContactId':_0x3af91c[_0x647b('0x8b')]['id'],'AttachmentId':_0x2abd52[_0x647b('0x58')][_0x647b('0x99')]});})['then'](function(_0x2327d2){_0x3af91c['message']=_0x2327d2;if(_0x3af91c[_0x647b('0x94')][_0x647b('0x9a')]){return db[_0x647b('0x9b')][_0x647b('0x5d')]({'attributes':['id',_0x647b('0x39')],'where':{'id':_0x3af91c[_0x647b('0x94')]['UserId']}})['then'](function(_0x4b953e){if(_0x4b953e){_0x3af91c['applications'][_0x647b('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4b953e['name']+','+(_0x3af91c[_0x647b('0x85')][_0x647b('0x9d')]||0xa),'interval':_0x647b('0x9e')});_0x3af91c[_0x647b('0x9f')]=![];}return respondWithRpcPromise('Start',_0x647b('0xa0'),_0x3af91c);});}return respondWithRpcPromise(_0x647b('0xa1'),_0x647b('0xa0'),_0x3af91c);})['then'](function(_0x5e71d2){respondWithRpcPromise(_0x647b('0xa2'),_0x647b('0xa2'),{'event':_0x647b('0x6e'),'message':_0x5e71d2},client9002);return _0x5e71d2;})[_0x647b('0x1e')](respondWithResult(_0x4d7af9,null))['catch'](handleError(_0x4d7af9,null));};exports[_0x647b('0xa3')]=function(_0x2ac4ba,_0x13fed9,_0x14470c){return db[_0x647b('0x3d')][_0x647b('0xa4')]({'where':{'id':_0x2ac4ba['params']['id']}})[_0x647b('0x1e')](handleEntityNotFound(_0x13fed9,null))[_0x647b('0x1e')](function(_0x39979f){if(_0x39979f){return db[_0x647b('0xa5')][_0x647b('0xa6')](function(_0x55812e){return db[_0x647b('0x84')][_0x647b('0x35')]({'where':{'OpenchannelAccountId':_0x2ac4ba[_0x647b('0x60')]['id']},'transaction':_0x55812e})[_0x647b('0x1e')](function(_0x48c3e4){var _0x5ac6cb=_['map'](_0x2ac4ba[_0x647b('0x58')],function(_0x51c8aa){_0x51c8aa['OpenchannelAccountId']=_0x2ac4ba[_0x647b('0x60')]['id'];return _0x51c8aa;});return db[_0x647b('0x84')][_0x647b('0xa7')](_0x5ac6cb,{'transaction':_0x55812e});});})[_0x647b('0x1e')](function(){return db['OpenchannelApplication'][_0x647b('0xa8')]({'where':{'OpenchannelAccountId':_0x2ac4ba[_0x647b('0x60')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x13fed9,null))[_0x647b('0x28')](handleError(_0x13fed9,null));};exports[_0x647b('0xa9')]=function(_0x5c49c9,_0x498700,_0x2a0925){var _0x176aab={};var _0x45e3e5={};var _0x11801c;var _0x1cba36;return db[_0x647b('0x3d')]['findOne']({'where':{'id':_0x5c49c9[_0x647b('0x60')]['id']}})[_0x647b('0x1e')](handleEntityNotFound(_0x498700,null))[_0x647b('0x1e')](function(_0x41b6e3){if(_0x41b6e3){_0x11801c=_0x41b6e3;_0x45e3e5[_0x647b('0x42')]=_['keys'](db['OpenchannelApplication'][_0x647b('0x3e')]);_0x45e3e5[_0x647b('0x43')]=_['keys'](_0x5c49c9['query']);_0x45e3e5['filters']=_['intersection'](_0x45e3e5[_0x647b('0x42')],_0x45e3e5[_0x647b('0x43')]);_0x176aab['attributes']=_['intersection'](_0x45e3e5[_0x647b('0x42')],qs['fields'](_0x5c49c9[_0x647b('0x43')][_0x647b('0x48')]));_0x176aab[_0x647b('0x47')]=_0x176aab[_0x647b('0x47')][_0x647b('0x54')]?_0x176aab['attributes']:_0x45e3e5[_0x647b('0x42')];_0x176aab[_0x647b('0x4b')]=qs[_0x647b('0x4c')](_0x5c49c9['query'][_0x647b('0x4c')]);_0x176aab['where']=qs[_0x647b('0x45')](_['pick'](_0x5c49c9[_0x647b('0x43')],_0x45e3e5[_0x647b('0x45')]));if(_0x5c49c9[_0x647b('0x43')][_0x647b('0x4d')]){_0x176aab[_0x647b('0x4e')]=_[_0x647b('0x4f')](_0x176aab[_0x647b('0x4e')],{'$or':_[_0x647b('0x3c')](_0x176aab[_0x647b('0x47')],function(_0x1f6047){var _0x40e5a8={};_0x40e5a8[_0x1f6047]={'$like':'%'+_0x5c49c9[_0x647b('0x43')][_0x647b('0x4d')]+'%'};return _0x40e5a8;})});}_0x176aab=_[_0x647b('0x4f')]({},_0x176aab,_0x5c49c9[_0x647b('0x56')]);return _0x11801c[_0x647b('0xa9')](_0x176aab);}})[_0x647b('0x1e')](function(_0x4d8aaf){if(_0x4d8aaf){_0x1cba36=_0x4d8aaf[_0x647b('0x54')];if(!_0x5c49c9[_0x647b('0x43')][_0x647b('0x49')](_0x647b('0x4a'))){_0x176aab[_0x647b('0x2f')]=qs[_0x647b('0x2f')](_0x5c49c9[_0x647b('0x43')][_0x647b('0x2f')]);_0x176aab[_0x647b('0x2d')]=qs[_0x647b('0x2d')](_0x5c49c9[_0x647b('0x43')]['offset']);}return _0x11801c[_0x647b('0xa9')](_0x176aab);}})['then'](function(_0x6bace4){if(_0x6bace4){return _0x6bace4?{'count':_0x1cba36,'rows':_0x6bace4}:null;}})[_0x647b('0x1e')](respondWithResult(_0x498700,null))[_0x647b('0x28')](handleError(_0x498700,null));};exports['getInteractions']=function(_0x54e35b,_0x4cb82b,_0x32af66){var _0xe69453={'raw':![],'where':{}};var _0x38f107={};var _0x9cda5={'count':0x0,'rows':[]};return db[_0x647b('0x3d')][_0x647b('0xa4')]({'where':{'id':_0x54e35b[_0x647b('0x60')]['id']}})['then'](handleEntityNotFound(_0x4cb82b,null))[_0x647b('0x1e')](function(_0xd8c85d){if(_0xd8c85d){_0x38f107[_0x647b('0x42')]=_['keys'](db[_0x647b('0x8f')][_0x647b('0x3e')]);_0x38f107[_0x647b('0x43')]=_[_0x647b('0x44')](_0x54e35b[_0x647b('0x43')]);_0x38f107['filters']=_[_0x647b('0x46')](_0x38f107[_0x647b('0x42')],_0x38f107[_0x647b('0x43')]);_0xe69453['attributes']=_[_0x647b('0x46')](_0x38f107[_0x647b('0x42')],qs['fields'](_0x54e35b[_0x647b('0x43')][_0x647b('0x48')]));_0xe69453[_0x647b('0x47')]=_0xe69453[_0x647b('0x47')][_0x647b('0x54')]?_0xe69453['attributes']:_0x38f107[_0x647b('0x42')];if(!_0x54e35b['query'][_0x647b('0x49')](_0x647b('0x4a'))){_0xe69453[_0x647b('0x2f')]=qs[_0x647b('0x2f')](_0x54e35b['query']['limit']);_0xe69453[_0x647b('0x2d')]=qs[_0x647b('0x2d')](_0x54e35b[_0x647b('0x43')][_0x647b('0x2d')]);}_0xe69453[_0x647b('0x4b')]=qs[_0x647b('0x4c')](_0x54e35b[_0x647b('0x43')][_0x647b('0x4c')]);_0xe69453[_0x647b('0x4e')]=qs[_0x647b('0x45')](_[_0x647b('0x66')](_0x54e35b['query'],_0x38f107[_0x647b('0x45')]));_0xe69453[_0x647b('0x4e')]['OpenchannelAccountId']=_0xd8c85d['id'];if(_0x54e35b['query'][_0x647b('0x4d')]){_0xe69453[_0x647b('0x4e')]=_['merge'](_0xe69453[_0x647b('0x4e')],{'$or':_[_0x647b('0x3c')](_0xe69453['attributes'],function(_0x18f05e){var _0x2fa8ed={};_0x2fa8ed[_0x18f05e]={'$like':'%'+_0x54e35b[_0x647b('0x43')][_0x647b('0x4d')]+'%'};return _0x2fa8ed;})});}_0xe69453=_[_0x647b('0x4f')]({},_0xe69453,_0x54e35b[_0x647b('0x56')]);return db[_0x647b('0x8f')]['count']({'where':_0xe69453['where']})['then'](function(_0x4c4f0d){_0x9cda5['count']=_0x4c4f0d;if(_0x54e35b['query']['includeAll']){_0xe69453['include']=[{'model':db[_0x647b('0x70')],'as':'Contact','required':![]},{'model':db[_0x647b('0x9b')],'as':_0x647b('0xaa'),'attributes':['name',_0x647b('0xab'),_0x647b('0xac')],'required':![]},{'model':db[_0x647b('0xad')],'as':_0x647b('0xae'),'attributes':['id',_0x647b('0x39'),_0x647b('0xaf')],'where':_0x54e35b[_0x647b('0x43')][_0x647b('0xb0')]?{'id':_0x54e35b['query']['tag']}:undefined,'required':_0x54e35b[_0x647b('0x43')][_0x647b('0xb0')]?!![]:![]}];}return db[_0x647b('0x8f')][_0x647b('0x67')](_0xe69453);})[_0x647b('0x1e')](function(_0xe4ff99){_0x9cda5[_0x647b('0x52')]=_0xe4ff99;return _0x9cda5;});}})[_0x647b('0x1e')](respondWithFilteredResult(_0x4cb82b,_0xe69453))[_0x647b('0x28')](handleError(_0x4cb82b,null));};exports[_0x647b('0xb1')]=function(_0x2381b1,_0x4b32a6,_0x44d8fe){return db[_0x647b('0x3d')][_0x647b('0x5d')]({'where':{'id':_0x2381b1[_0x647b('0x60')]['id']}})['then'](handleEntityNotFound(_0x4b32a6,null))['then'](function(_0x1987c4){if(_0x1987c4){return _0x1987c4[_0x647b('0xb1')](_0x2381b1[_0x647b('0x58')]['ids'],_[_0x647b('0xb2')](_0x2381b1[_0x647b('0x58')],[_0x647b('0x69'),'id'])||{})['spread'](function(_0x125a30){for(var _0x49e3c6=0x0;_0x49e3c6<_0x2381b1['body']['ids']['length'];_0x49e3c6+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x2381b1[_0x647b('0x58')][_0x647b('0x69')][_0x49e3c6]),'OpenchannelAccountId':Number(_0x2381b1[_0x647b('0x60')]['id'])});}return _0x125a30;});}})[_0x647b('0x1e')](respondWithResult(_0x4b32a6,null))[_0x647b('0x28')](handleError(_0x4b32a6,null));};exports[_0x647b('0xb3')]=function(_0x3dfcad,_0x495cb4,_0x2fe9e3){return db[_0x647b('0x3d')][_0x647b('0x5d')]({'where':{'id':_0x3dfcad['params']['id']}})[_0x647b('0x1e')](handleEntityNotFound(_0x495cb4,null))[_0x647b('0x1e')](function(_0x31231d){if(_0x31231d){return _0x31231d[_0x647b('0xb3')](_0x3dfcad[_0x647b('0x43')]['ids'])[_0x647b('0x1e')](function(){if(_[_0x647b('0xb4')](_0x3dfcad[_0x647b('0x43')]['ids'])){for(var _0xe9ca08=0x0;_0xe9ca08<_0x3dfcad['query'][_0x647b('0x69')][_0x647b('0x54')];_0xe9ca08+=0x1){socket[_0x647b('0xb5')](_0x647b('0xb6'),{'UserId':Number(_0x3dfcad[_0x647b('0x43')][_0x647b('0x69')][_0xe9ca08]),'OpenchannelAccountId':Number(_0x3dfcad[_0x647b('0x60')]['id'])});}}else{socket[_0x647b('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3dfcad['query']['ids']),'OpenchannelAccountId':Number(_0x3dfcad[_0x647b('0x60')]['id'])});}});}})[_0x647b('0x1e')](respondWithStatusCode(_0x495cb4,null))[_0x647b('0x28')](handleError(_0x495cb4,null));};exports[_0x647b('0xb7')]=function(_0x5704e5,_0x3aa846,_0x3a4d3b){var _0x54d341={};var _0x4cbf53={};var _0x1cb420;var _0x75b8ad;return db[_0x647b('0x3d')][_0x647b('0xa4')]({'where':{'id':_0x5704e5['params']['id']}})['then'](handleEntityNotFound(_0x3aa846,null))[_0x647b('0x1e')](function(_0x1537c8){if(_0x1537c8){_0x1cb420=_0x1537c8;_0x4cbf53['model']=_[_0x647b('0x44')](db['User'][_0x647b('0x3e')]);_0x4cbf53['query']=_[_0x647b('0x44')](_0x5704e5[_0x647b('0x43')]);_0x4cbf53[_0x647b('0x45')]=_[_0x647b('0x46')](_0x4cbf53[_0x647b('0x42')],_0x4cbf53[_0x647b('0x43')]);_0x54d341['attributes']=_[_0x647b('0x46')](_0x4cbf53['model'],qs['fields'](_0x5704e5[_0x647b('0x43')][_0x647b('0x48')]));_0x54d341[_0x647b('0x47')]=_0x54d341[_0x647b('0x47')][_0x647b('0x54')]?_0x54d341['attributes']:_0x4cbf53[_0x647b('0x42')];_0x54d341[_0x647b('0x4b')]=qs[_0x647b('0x4c')](_0x5704e5['query'][_0x647b('0x4c')]);_0x54d341['where']=qs[_0x647b('0x45')](_[_0x647b('0x66')](_0x5704e5[_0x647b('0x43')],_0x4cbf53[_0x647b('0x45')]));if(_0x5704e5[_0x647b('0x43')][_0x647b('0x4d')]){_0x54d341[_0x647b('0x4e')]=_[_0x647b('0x4f')](_0x54d341[_0x647b('0x4e')],{'$or':_[_0x647b('0x3c')](_0x54d341[_0x647b('0x47')],function(_0x590f1d){var _0x2bfc36={};_0x2bfc36[_0x590f1d]={'$like':'%'+_0x5704e5['query'][_0x647b('0x4d')]+'%'};return _0x2bfc36;})});}_0x54d341=_[_0x647b('0x4f')]({},_0x54d341,_0x5704e5[_0x647b('0x56')]);return _0x1cb420['getAgents'](_0x54d341);}})[_0x647b('0x1e')](function(_0x201088){if(_0x201088){_0x75b8ad=_0x201088[_0x647b('0x54')];if(!_0x5704e5[_0x647b('0x43')][_0x647b('0x49')](_0x647b('0x4a'))){_0x54d341[_0x647b('0x2f')]=qs['limit'](_0x5704e5['query'][_0x647b('0x2f')]);_0x54d341[_0x647b('0x2d')]=qs[_0x647b('0x2d')](_0x5704e5[_0x647b('0x43')]['offset']);}return _0x1cb420['getAgents'](_0x54d341);}})['then'](function(_0x5114b0){if(_0x5114b0){return _0x5114b0?{'count':_0x75b8ad,'rows':_0x5114b0}:null;}})[_0x647b('0x1e')](respondWithResult(_0x3aa846,null))['catch'](handleError(_0x3aa846,null));};exports[_0x647b('0xb8')]=function(_0x2d949f,_0x39eed1,_0xe47b7c){var _0x161e7f,_0x26a1c8,_0x2e61b2;if(_['isNil'](_0x2d949f[_0x647b('0x58')][_0x647b('0x58')])||_0x2d949f['body'][_0x647b('0x58')]===''){throw new db[(_0x647b('0x71'))][(_0x647b('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x647b('0x7a')](_0x2d949f['body']['to'])){}_0x161e7f=_0x2d949f[_0x647b('0x58')]['to'];return db[_0x647b('0x3d')]['findOne']({'where':{'id':_0x2d949f[_0x647b('0x60')]['id']}})[_0x647b('0x1e')](handleEntityNotFound(_0x39eed1,null))['then'](function(_0x100e9f){if(_0x100e9f){return db['OpenchannelAccount']['find']({'where':{'id':_0x100e9f['id']},'include':[{'model':db['CmList'],'as':_0x647b('0x81'),'include':[{'model':db[_0x647b('0x70')],'as':'Contacts','where':{[_0x100e9f[_0x647b('0x7c')]]:_0x161e7f},'limit':0x1,'order':[[_0x647b('0x76'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x39eed1,null))[_0x647b('0x1e')](function(_0x3c7a3e){if(_0x3c7a3e&&_0x3c7a3e[_0x647b('0x81')]){_0x26a1c8=_0x3c7a3e[_0x647b('0x36')]({'plain':!![]});if(_0x26a1c8[_0x647b('0x81')]&&_0x26a1c8[_0x647b('0x81')][_0x647b('0x82')]['length']){return _0x26a1c8['List'][_0x647b('0x82')][0x0];}return db['CmContact']['create'](_[_0x647b('0x8a')](_0x2d949f['body'],{'firstName':_0x161e7f,[_0x3c7a3e['mapKey']]:_0x161e7f,'phone':_0x161e7f,'ListId':_0x26a1c8[_0x647b('0x77')]}));}})[_0x647b('0x1e')](handleEntityNotFound(_0x39eed1,null))[_0x647b('0x1e')](function(_0x556a0a){if(_0x556a0a){_0x2e61b2=_0x556a0a;return db[_0x647b('0x8f')][_0x647b('0x5d')]({'where':{'ContactId':_0x2e61b2['id'],'closed':![],'OpenchannelAccountId':_0x26a1c8['id']}})[_0x647b('0x1e')](function(_0x1c6032){if(_0x1c6032){return[_0x1c6032,![]];}return db[_0x647b('0x8f')][_0x647b('0x57')]({'UserId':_0x2d949f[_0x647b('0x59')]['id'],'ContactId':_0x2e61b2['id'],'OpenchannelAccountId':_0x26a1c8['id'],'lastMsgDirection':_0x647b('0xb9'),'Messages':[_[_0x647b('0x4f')](_0x2d949f[_0x647b('0x58')],{'read':![],'body':_0x2d949f[_0x647b('0x58')][_0x647b('0x58')],'OpenchannelAccountId':_0x26a1c8['id'],'UserId':_0x2d949f['user']['id'],'ContactId':_0x2e61b2['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x647b('0xba')}]})[_0x647b('0x1e')](function(_0x182031){return[_0x182031,!![]];});});}})['spread'](function(_0x474bc9,_0x26d360){if(_0x26d360){return _0x474bc9;}return db['OpenchannelMessage'][_0x647b('0x57')](_['merge'](_0x2d949f['body'],{'read':![],'body':_0x2d949f[_0x647b('0x58')][_0x647b('0x58')],'OpenchannelAccountId':_0x26a1c8['id'],'OpenchannelInteractionId':_0x474bc9['id'],'UserId':_0x2d949f['user']['id'],'ContactId':_0x2e61b2['id']}))[_0x647b('0x1e')](function(_0x36b6b7){_0x474bc9[_0x647b('0xbb')][_0x647b('0xba')]=[];_0x474bc9[_0x647b('0xbb')]['Messages']['push'](_0x36b6b7['dataValues']);return _0x474bc9;});});}})[_0x647b('0x1e')](respondWithResult(_0x39eed1,null))[_0x647b('0x28')](handleError(_0x39eed1,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index f4b8211..9c522b0 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(_0x5555eb,_0x55b908){var _0x58af93=function(_0x27efd1){while(--_0x27efd1){_0x5555eb['push'](_0x5555eb['shift']());}};_0x58af93(++_0x55b908);}(_0x4522,0x1a0));var _0x2452=function(_0x67c7e2,_0x5f02ee){_0x67c7e2=_0x67c7e2-0x0;var _0x52b665=_0x4522[_0x67c7e2];return _0x52b665;};'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 _0xa571=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa571,0x107));var _0x1a57=function(_0x13400b,_0x50bdc6){_0x13400b=_0x13400b-0x0;var _0x36c777=_0xa571[_0x13400b];return _0x36c777;};'use strict';var EventEmitter=require(_0x1a57('0x0'));var OpenchannelAccount=require(_0x1a57('0x1'))['db'][_0x1a57('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1a57('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a57('0x4'),'afterDestroy':_0x1a57('0x5')};function emitEvent(_0x4d5f7a){return function(_0x5ec815,_0x1f2c44,_0x5067fa){OpenchannelAccountEvents[_0x1a57('0x6')](_0x4d5f7a+':'+_0x5ec815['id'],_0x5ec815);OpenchannelAccountEvents[_0x1a57('0x6')](_0x4d5f7a,_0x5ec815);_0x5067fa(null);};}for(var e in events){if(events[_0x1a57('0x7')](e)){var event=events[e];OpenchannelAccount[_0x1a57('0x8')](e,emitEvent(event));}}module[_0x1a57('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index cde96a6..e47503b 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(_0x5fec78,_0x48a840){var _0x2ac973=function(_0x9e09bb){while(--_0x9e09bb){_0x5fec78['push'](_0x5fec78['shift']());}};_0x2ac973(++_0x48a840);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x4ab4c1,_0x52400d){var _0x220b4f=function(_0x547bf3){while(--_0x547bf3){_0x4ab4c1['push'](_0x4ab4c1['shift']());}};_0x220b4f(++_0x52400d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 217486e..e440e19 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 _0x6324=['bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','moment'];(function(_0x5bee28,_0x1dc7e2){var _0x395d1d=function(_0x33af90){while(--_0x33af90){_0x5bee28['push'](_0x5bee28['shift']());}};_0x395d1d(++_0x1dc7e2);}(_0x6324,0x142));var _0x4632=function(_0x32f3bc,_0x2b5218){_0x32f3bc=_0x32f3bc-0x0;var _0x3f8cc2=_0x6324[_0x32f3bc];return _0x3f8cc2;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var moment=require(_0x4632('0x2'));var BPromise=require(_0x4632('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4632('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4632('0x5'));var logger=require('../../config/logger')(_0x4632('0x6'));var config=require('../../config/environment');var jayson=require(_0x4632('0x7'));var client=jayson[_0x4632('0x8')][_0x4632('0x9')]({'port':0x232a});config[_0x4632('0xa')]=_['defaults'](config[_0x4632('0xa')],{'host':_0x4632('0xb'),'port':0x18eb});var socket=require(_0x4632('0xc'))(new Redis(config['redis']));require(_0x4632('0xd'))[_0x4632('0xe')](socket);function respondWithRpcPromise(_0x47a518,_0x556bbc,_0xcdefa2){return new BPromise(function(_0x21999d,_0x30a7cf){return client[_0x4632('0xf')](_0x47a518,_0xcdefa2)[_0x4632('0x10')](function(_0xe28f38){logger[_0x4632('0x11')](_0x4632('0x12'),_0x556bbc,'request\x20sent');logger[_0x4632('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x556bbc,_0x4632('0x14'),JSON[_0x4632('0x15')](_0xe28f38));if(_0xe28f38[_0x4632('0x16')]){if(_0xe28f38[_0x4632('0x16')]['code']===0x1f4){logger[_0x4632('0x16')](_0x4632('0x12'),_0x556bbc,_0xe28f38[_0x4632('0x16')][_0x4632('0x17')]);return _0x30a7cf(_0xe28f38[_0x4632('0x16')]['message']);}logger['error'](_0x4632('0x12'),_0x556bbc,_0xe28f38[_0x4632('0x16')][_0x4632('0x17')]);return _0x21999d(_0xe28f38[_0x4632('0x16')]['message']);}else{logger[_0x4632('0x11')](_0x4632('0x12'),_0x556bbc,_0x4632('0x14'));_0x21999d(_0xe28f38['result'][_0x4632('0x17')]);}})[_0x4632('0x18')](function(_0x58e193){logger['error'](_0x4632('0x12'),_0x556bbc,_0x58e193);_0x30a7cf(_0x58e193);});});} \ No newline at end of file +var _0x9ffd=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x17abd9,_0x5dd6c1){_0x17abd9=_0x17abd9-0x0;var _0x4be5b1=_0x9ffd[_0x17abd9];return _0x4be5b1;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});config[_0xd9ff('0xb')]=_[_0xd9ff('0xc')](config[_0xd9ff('0xb')],{'host':_0xd9ff('0xd'),'port':0x18eb});var socket=require(_0xd9ff('0xe'))(new Redis(config[_0xd9ff('0xb')]));require(_0xd9ff('0xf'))['register'](socket);function respondWithRpcPromise(_0x54a555,_0x567f79,_0x5aa954){return new BPromise(function(_0x2355ab,_0x2fd77a){return client[_0xd9ff('0x10')](_0x54a555,_0x5aa954)[_0xd9ff('0x11')](function(_0x37d2c0){logger[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x567f79,_0xd9ff('0x14'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x567f79,_0xd9ff('0x14'),JSON[_0xd9ff('0x15')](_0x37d2c0));if(_0x37d2c0[_0xd9ff('0x16')]){if(_0x37d2c0[_0xd9ff('0x16')][_0xd9ff('0x17')]===0x1f4){logger['error'](_0xd9ff('0x13'),_0x567f79,_0x37d2c0[_0xd9ff('0x16')]['message']);return _0x2fd77a(_0x37d2c0[_0xd9ff('0x16')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x567f79,_0x37d2c0['error'][_0xd9ff('0x18')]);return _0x2355ab(_0x37d2c0['error'][_0xd9ff('0x18')]);}else{logger[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x567f79,_0xd9ff('0x14'));_0x2355ab(_0x37d2c0[_0xd9ff('0x19')][_0xd9ff('0x18')]);}})[_0xd9ff('0x1a')](function(_0x128588){logger[_0xd9ff('0x16')](_0xd9ff('0x13'),_0x567f79,_0x128588);_0x2fd77a(_0x128588);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index a2442f1..e5cc6a1 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 _0x21a3=['update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','remove'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x21a3,0x66));var _0x321a=function(_0x44b249,_0x5b4811){_0x44b249=_0x44b249-0x0;var _0x23b853=_0x21a3[_0x44b249];return _0x23b853;};'use strict';var OpenchannelAccountEvents=require(_0x321a('0x0'));var events=['save',_0x321a('0x1'),_0x321a('0x2')];function createListener(_0x1070a2,_0x401ef1){return function(_0x3ad15d){_0x401ef1[_0x321a('0x3')](_0x1070a2,_0x3ad15d);};}function removeListener(_0x5df495,_0x536b51){return function(){OpenchannelAccountEvents[_0x321a('0x4')](_0x5df495,_0x536b51);};}exports[_0x321a('0x5')]=function(_0x467682){for(var _0x28e166=0x0,_0x5f3b81=events[_0x321a('0x6')];_0x28e166<_0x5f3b81;_0x28e166++){var _0x24a04c=events[_0x28e166];var _0x10c1d3=createListener(_0x321a('0x7')+_0x24a04c,_0x467682);OpenchannelAccountEvents['on'](_0x24a04c,_0x10c1d3);}}; \ No newline at end of file +var _0x028d=['register','length','openchannelAccount:','save','remove','emit'];(function(_0x54b0cc,_0x59857d){var _0x246277=function(_0x113710){while(--_0x113710){_0x54b0cc['push'](_0x54b0cc['shift']());}};_0x246277(++_0x59857d);}(_0x028d,0xff));var _0xd028=function(_0x586319,_0xf3ac9a){_0x586319=_0x586319-0x0;var _0x2127d2=_0x028d[_0x586319];return _0x2127d2;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xd028('0x0'),_0xd028('0x1'),'update'];function createListener(_0x35e90f,_0x362847){return function(_0x157cf4){_0x362847[_0xd028('0x2')](_0x35e90f,_0x157cf4);};}function removeListener(_0x2dc43c,_0x67d150){return function(){OpenchannelAccountEvents['removeListener'](_0x2dc43c,_0x67d150);};}exports[_0xd028('0x3')]=function(_0x4592fd){for(var _0x20588f=0x0,_0x35b879=events[_0xd028('0x4')];_0x20588f<_0x35b879;_0x20588f++){var _0xb35f34=events[_0x20588f];var _0xab6e68=createListener(_0xd028('0x5')+_0xb35f34,_0x4592fd);OpenchannelAccountEvents['on'](_0xb35f34,_0xab6e68);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 980cccd..57d529c 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 _0xd3cd=['isAuthenticated','index','get','show','/:id','update','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd3cd,0x1ab));var _0xdd3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3cd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xdd3c('0x0'));var path=require(_0xdd3c('0x1'));var timeout=require(_0xdd3c('0x2'));var express=require(_0xdd3c('0x3'));var router=express['Router']();var fs_extra=require(_0xdd3c('0x4'));var auth=require(_0xdd3c('0x5'));var interaction=require(_0xdd3c('0x6'));var config=require(_0xdd3c('0x7'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0xdd3c('0x8')](),controller[_0xdd3c('0x9')]);router[_0xdd3c('0xa')]('/:id',auth[_0xdd3c('0x8')](),controller[_0xdd3c('0xb')]);router['post']('/',auth[_0xdd3c('0x8')](),controller['create']);router['put'](_0xdd3c('0xc'),auth[_0xdd3c('0x8')](),controller[_0xdd3c('0xd')]);router['delete']('/:id',auth[_0xdd3c('0x8')](),controller[_0xdd3c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1eb4=['post','create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x1eb4,0x83));var _0x41eb=function(_0x288f31,_0x3b17c9){_0x288f31=_0x288f31-0x0;var _0x43974c=_0x1eb4[_0x288f31];return _0x43974c;};'use strict';var multer=require(_0x41eb('0x0'));var util=require('util');var path=require(_0x41eb('0x1'));var timeout=require(_0x41eb('0x2'));var express=require(_0x41eb('0x3'));var router=express[_0x41eb('0x4')]();var fs_extra=require(_0x41eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x41eb('0x6'));var config=require('../../config/environment');var controller=require(_0x41eb('0x7'));router[_0x41eb('0x8')]('/',auth[_0x41eb('0x9')](),controller[_0x41eb('0xa')]);router[_0x41eb('0x8')](_0x41eb('0xb'),auth['isAuthenticated'](),controller[_0x41eb('0xc')]);router[_0x41eb('0xd')]('/',auth[_0x41eb('0x9')](),controller[_0x41eb('0xe')]);router[_0x41eb('0xf')](_0x41eb('0xb'),auth[_0x41eb('0x9')](),controller['update']);router[_0x41eb('0x10')]('/:id',auth[_0x41eb('0x9')](),controller['destroy']);module[_0x41eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 0e4049c..f890f9c 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 _0x2964=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x5b387f,_0x4eee27){var _0x5bf6f1=function(_0x1a5b21){while(--_0x1a5b21){_0x5b387f['push'](_0x5b387f['shift']());}};_0x5bf6f1(++_0x4eee27);}(_0x2964,0x116));var _0x4296=function(_0x2b5e17,_0x38bc22){_0x2b5e17=_0x2b5e17-0x0;var _0x11d59=_0x2964[_0x2b5e17];return _0x11d59;};'use strict';var Sequelize=require(_0x4296('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4296('0x1')],'allowNull':![],'defaultValue':_0x4296('0x2')},'appdata':{'type':Sequelize[_0x4296('0x3')]()},'description':{'type':Sequelize[_0x4296('0x1')]},'interval':{'type':Sequelize[_0x4296('0x1')],'defaultValue':_0x4296('0x4')}}; \ No newline at end of file +var _0x49db=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x10fd35,_0x1cde71){var _0x4a5686=function(_0x42f8e6){while(--_0x42f8e6){_0x10fd35['push'](_0x10fd35['shift']());}};_0x4a5686(++_0x1cde71);}(_0x49db,0xc5));var _0xb49d=function(_0x304db2,_0x555667){_0x304db2=_0x304db2-0x0;var _0x6e8220=_0x49db[_0x304db2];return _0x6e8220;};'use strict';var Sequelize=require(_0xb49d('0x0'));module[_0xb49d('0x1')]={'priority':{'type':Sequelize[_0xb49d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb49d('0x3')],'allowNull':![],'defaultValue':_0xb49d('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb49d('0x3')]},'interval':{'type':Sequelize[_0xb49d('0x3')],'defaultValue':_0xb49d('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 9eb2da3..617df2f 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 _0x52a0=['crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','nolimit','offset','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','squel'];(function(_0x50209e,_0x2eda19){var _0x8f565f=function(_0xfc9a30){while(--_0xfc9a30){_0x50209e['push'](_0x50209e['shift']());}};_0x8f565f(++_0x2eda19);}(_0x52a0,0x1c4));var _0x052a=function(_0x53f531,_0x202e60){_0x53f531=_0x53f531-0x0;var _0x312f00=_0x52a0[_0x53f531];return _0x312f00;};'use strict';var emlformat=require(_0x052a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x052a('0x1'));var jsonpatch=require(_0x052a('0x2'));var rp=require(_0x052a('0x3'));var moment=require(_0x052a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x052a('0x5'));var sox=require(_0x052a('0x6'));var csv=require(_0x052a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x052a('0x8'));var _=require('lodash');var squel=require(_0x052a('0x9'));var crypto=require(_0x052a('0xa'));var jsforce=require(_0x052a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x052a('0x7'));var querystring=require(_0x052a('0xc'));var Papa=require('papaparse');var Redis=require(_0x052a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x052a('0xe'));var as=require(_0x052a('0xf'));var hardwareService=require(_0x052a('0x10'));var logger=require(_0x052a('0x11'))(_0x052a('0x12'));var utils=require(_0x052a('0x13'));var config=require(_0x052a('0x14'));var licenseUtil=require(_0x052a('0x15'));var db=require(_0x052a('0x16'))['db'];function respondWithStatusCode(_0x42f816,_0xf1d203){_0xf1d203=_0xf1d203||0xcc;return function(_0x1ae2ac){if(_0x1ae2ac){return _0x42f816[_0x052a('0x17')](_0xf1d203);}return _0x42f816[_0x052a('0x18')](_0xf1d203)[_0x052a('0x19')]();};}function respondWithResult(_0xaf9c47,_0x1cb6b2){_0x1cb6b2=_0x1cb6b2||0xc8;return function(_0x43302f){if(_0x43302f){return _0xaf9c47[_0x052a('0x18')](_0x1cb6b2)[_0x052a('0x1a')](_0x43302f);}};}function respondWithFilteredResult(_0x4d5ffd,_0x37e49e){return function(_0x3df6e7){if(_0x3df6e7){var _0x3bf74c=typeof _0x37e49e['offset']===_0x052a('0x1b')&&typeof _0x37e49e[_0x052a('0x1c')]===_0x052a('0x1b');var _0x1904eb=_0x3df6e7[_0x052a('0x1d')];var _0xbfd350=_0x3bf74c?0x0:_0x37e49e['offset'];var _0x3b6e84=_0x3bf74c?_0x3df6e7['count']:_0x37e49e['offset']+_0x37e49e['limit'];var _0x46adb4;if(_0x3b6e84>=_0x1904eb){_0x3b6e84=_0x1904eb;_0x46adb4=0xc8;}else{_0x46adb4=0xce;}_0x4d5ffd[_0x052a('0x18')](_0x46adb4);return _0x4d5ffd[_0x052a('0x1e')](_0x052a('0x1f'),_0xbfd350+'-'+_0x3b6e84+'/'+_0x1904eb)[_0x052a('0x1a')](_0x3df6e7);}return null;};}function patchUpdates(_0x5b937e){return function(_0x1707e9){try{jsonpatch[_0x052a('0x20')](_0x1707e9,_0x5b937e,!![]);}catch(_0x2875ff){return BPromise[_0x052a('0x21')](_0x2875ff);}return _0x1707e9[_0x052a('0x22')]();};}function saveUpdates(_0x1626d4,_0x52d826){return function(_0x1423ad){if(_0x1423ad){return _0x1423ad[_0x052a('0x23')](_0x1626d4)[_0x052a('0x24')](function(_0x1ade33){return _0x1ade33;});}return null;};}function removeEntity(_0x4b599f,_0xf9d0af){return function(_0x13bd77){if(_0x13bd77){return _0x13bd77[_0x052a('0x25')]()['then'](function(){_0x4b599f[_0x052a('0x18')](0xcc)[_0x052a('0x19')]();});}};}function handleEntityNotFound(_0x355c00,_0x1acf78){return function(_0xd8fea3){if(!_0xd8fea3){_0x355c00[_0x052a('0x17')](0x194);}return _0xd8fea3;};}function handleError(_0x1ce2cb,_0x54f3bf){_0x54f3bf=_0x54f3bf||0x1f4;return function(_0x760db7){logger[_0x052a('0x26')](_0x760db7[_0x052a('0x27')]);if(_0x760db7['name']){delete _0x760db7[_0x052a('0x28')];}_0x1ce2cb[_0x052a('0x18')](_0x54f3bf)[_0x052a('0x29')](_0x760db7);};}exports[_0x052a('0x2a')]=function(_0x5e1dda,_0x6e2575){var _0x10ef54={},_0x30744a={},_0x4244ae={'count':0x0,'rows':[]};var _0x39f6bd=_[_0x052a('0x2b')](db[_0x052a('0x2c')][_0x052a('0x2d')],function(_0x3a6387){return{'name':_0x3a6387[_0x052a('0x2e')],'type':_0x3a6387[_0x052a('0x2f')][_0x052a('0x30')]};});_0x30744a['model']=_['map'](_0x39f6bd,_0x052a('0x28'));_0x30744a[_0x052a('0x31')]=_['keys'](_0x5e1dda[_0x052a('0x31')]);_0x30744a['filters']=_[_0x052a('0x32')](_0x30744a[_0x052a('0x33')],_0x30744a[_0x052a('0x31')]);_0x10ef54['attributes']=_[_0x052a('0x32')](_0x30744a[_0x052a('0x33')],qs[_0x052a('0x34')](_0x5e1dda['query'][_0x052a('0x34')]));_0x10ef54[_0x052a('0x35')]=_0x10ef54['attributes'][_0x052a('0x36')]?_0x10ef54[_0x052a('0x35')]:_0x30744a[_0x052a('0x33')];if(!_0x5e1dda['query']['hasOwnProperty'](_0x052a('0x37'))){_0x10ef54[_0x052a('0x1c')]=qs['limit'](_0x5e1dda[_0x052a('0x31')][_0x052a('0x1c')]);_0x10ef54[_0x052a('0x38')]=qs[_0x052a('0x38')](_0x5e1dda[_0x052a('0x31')][_0x052a('0x38')]);}_0x10ef54[_0x052a('0x39')]=qs['sort'](_0x5e1dda[_0x052a('0x31')][_0x052a('0x3a')]);_0x10ef54[_0x052a('0x3b')]=qs['filters'](_[_0x052a('0x3c')](_0x5e1dda['query'],_0x30744a[_0x052a('0x3d')]),_0x39f6bd);if(_0x5e1dda['query']['filter']){_0x10ef54[_0x052a('0x3b')]=_[_0x052a('0x3e')](_0x10ef54[_0x052a('0x3b')],{'$or':_[_0x052a('0x2b')](_0x39f6bd,function(_0x1ca7e8){if(_0x1ca7e8[_0x052a('0x2f')]!==_0x052a('0x3f')){var _0x3a5fa9={};_0x3a5fa9[_0x1ca7e8[_0x052a('0x28')]]={'$like':'%'+_0x5e1dda['query'][_0x052a('0x40')]+'%'};return _0x3a5fa9;}})});}_0x10ef54=_['merge']({},_0x10ef54,_0x5e1dda['options']);var _0x13beaa={'where':_0x10ef54['where']};return db['OpenchannelApplication'][_0x052a('0x1d')](_0x13beaa)[_0x052a('0x24')](function(_0x3bf378){_0x4244ae[_0x052a('0x1d')]=_0x3bf378;if(_0x5e1dda[_0x052a('0x31')][_0x052a('0x41')]){_0x10ef54[_0x052a('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x052a('0x43')](_0x10ef54);})[_0x052a('0x24')](function(_0x258290){_0x4244ae[_0x052a('0x44')]=_0x258290;return _0x4244ae;})[_0x052a('0x24')](respondWithFilteredResult(_0x6e2575,_0x10ef54))[_0x052a('0x45')](handleError(_0x6e2575,null));};exports[_0x052a('0x46')]=function(_0x1cfef6,_0x20b9dd){var _0x573529={'raw':!![],'where':{'id':_0x1cfef6['params']['id']}},_0x5e1639={};_0x5e1639[_0x052a('0x33')]=_[_0x052a('0x47')](db[_0x052a('0x2c')]['rawAttributes']);_0x5e1639[_0x052a('0x31')]=_[_0x052a('0x47')](_0x1cfef6['query']);_0x5e1639[_0x052a('0x3d')]=_['intersection'](_0x5e1639[_0x052a('0x33')],_0x5e1639[_0x052a('0x31')]);_0x573529[_0x052a('0x35')]=_[_0x052a('0x32')](_0x5e1639[_0x052a('0x33')],qs['fields'](_0x1cfef6[_0x052a('0x31')][_0x052a('0x34')]));_0x573529['attributes']=_0x573529[_0x052a('0x35')][_0x052a('0x36')]?_0x573529['attributes']:_0x5e1639['model'];if(_0x1cfef6[_0x052a('0x31')][_0x052a('0x41')]){_0x573529[_0x052a('0x42')]=[{'all':!![]}];}_0x573529=_['merge']({},_0x573529,_0x1cfef6[_0x052a('0x48')]);return db['OpenchannelApplication'][_0x052a('0x49')](_0x573529)[_0x052a('0x24')](handleEntityNotFound(_0x20b9dd,null))[_0x052a('0x24')](respondWithResult(_0x20b9dd,null))['catch'](handleError(_0x20b9dd,null));};exports['create']=function(_0x43e1d7,_0x1b286e){return db[_0x052a('0x2c')][_0x052a('0x4a')](_0x43e1d7[_0x052a('0x4b')],{})[_0x052a('0x24')](respondWithResult(_0x1b286e,0xc9))[_0x052a('0x45')](handleError(_0x1b286e,null));};exports[_0x052a('0x23')]=function(_0x1e043c,_0x49ae71){if(_0x1e043c[_0x052a('0x4b')]['id']){delete _0x1e043c[_0x052a('0x4b')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x1e043c[_0x052a('0x4c')]['id']}})[_0x052a('0x24')](handleEntityNotFound(_0x49ae71,null))[_0x052a('0x24')](saveUpdates(_0x1e043c[_0x052a('0x4b')],null))['then'](respondWithResult(_0x49ae71,null))['catch'](handleError(_0x49ae71,null));};exports[_0x052a('0x25')]=function(_0x163ffd,_0x8247b7){return db[_0x052a('0x2c')][_0x052a('0x49')]({'where':{'id':_0x163ffd[_0x052a('0x4c')]['id']}})[_0x052a('0x24')](handleEntityNotFound(_0x8247b7,null))[_0x052a('0x24')](removeEntity(_0x8247b7,null))['catch'](handleError(_0x8247b7,null));}; \ No newline at end of file +var _0x2e50=['offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json'];(function(_0x2e3282,_0x28b367){var _0x2cc760=function(_0x35076f){while(--_0x35076f){_0x2e3282['push'](_0x2e3282['shift']());}};_0x2cc760(++_0x28b367);}(_0x2e50,0x1e6));var _0x02e5=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x2e50[_0x5d6e30];return _0x3d3f3b;};'use strict';var emlformat=require(_0x02e5('0x0'));var rimraf=require(_0x02e5('0x1'));var zipdir=require(_0x02e5('0x2'));var jsonpatch=require(_0x02e5('0x3'));var rp=require(_0x02e5('0x4'));var moment=require(_0x02e5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x02e5('0x6'));var path=require(_0x02e5('0x7'));var sox=require(_0x02e5('0x8'));var csv=require(_0x02e5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x02e5('0xa'));var _=require(_0x02e5('0xb'));var squel=require('squel');var crypto=require(_0x02e5('0xc'));var jsforce=require(_0x02e5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x02e5('0x9'));var querystring=require('querystring');var Papa=require(_0x02e5('0xe'));var Redis=require(_0x02e5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x02e5('0x10'));var as=require(_0x02e5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02e5('0x12'))(_0x02e5('0x13'));var utils=require(_0x02e5('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x02e5('0x15'))['db'];function respondWithStatusCode(_0x326a3f,_0x4753bb){_0x4753bb=_0x4753bb||0xcc;return function(_0x208201){if(_0x208201){return _0x326a3f['sendStatus'](_0x4753bb);}return _0x326a3f[_0x02e5('0x16')](_0x4753bb)[_0x02e5('0x17')]();};}function respondWithResult(_0x4523ce,_0x374529){_0x374529=_0x374529||0xc8;return function(_0x50061e){if(_0x50061e){return _0x4523ce[_0x02e5('0x16')](_0x374529)[_0x02e5('0x18')](_0x50061e);}};}function respondWithFilteredResult(_0x413891,_0x432b73){return function(_0x2e8450){if(_0x2e8450){var _0x4c8530=typeof _0x432b73[_0x02e5('0x19')]===_0x02e5('0x1a')&&typeof _0x432b73[_0x02e5('0x1b')]===_0x02e5('0x1a');var _0x3d6920=_0x2e8450['count'];var _0xf50a43=_0x4c8530?0x0:_0x432b73[_0x02e5('0x19')];var _0x3a86ca=_0x4c8530?_0x2e8450[_0x02e5('0x1c')]:_0x432b73['offset']+_0x432b73[_0x02e5('0x1b')];var _0x52f068;if(_0x3a86ca>=_0x3d6920){_0x3a86ca=_0x3d6920;_0x52f068=0xc8;}else{_0x52f068=0xce;}_0x413891['status'](_0x52f068);return _0x413891[_0x02e5('0x1d')](_0x02e5('0x1e'),_0xf50a43+'-'+_0x3a86ca+'/'+_0x3d6920)[_0x02e5('0x18')](_0x2e8450);}return null;};}function patchUpdates(_0x102f6c){return function(_0x1343c3){try{jsonpatch[_0x02e5('0x1f')](_0x1343c3,_0x102f6c,!![]);}catch(_0x48e382){return BPromise['reject'](_0x48e382);}return _0x1343c3[_0x02e5('0x20')]();};}function saveUpdates(_0x50f34a,_0xd52f02){return function(_0x459427){if(_0x459427){return _0x459427[_0x02e5('0x21')](_0x50f34a)[_0x02e5('0x22')](function(_0x5a417a){return _0x5a417a;});}return null;};}function removeEntity(_0x18fa77,_0x4fcbb0){return function(_0x4c9713){if(_0x4c9713){return _0x4c9713[_0x02e5('0x23')]()[_0x02e5('0x22')](function(){_0x18fa77[_0x02e5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b78b,_0x16fa70){return function(_0xff10d9){if(!_0xff10d9){_0x18b78b[_0x02e5('0x24')](0x194);}return _0xff10d9;};}function handleError(_0x131804,_0x417f30){_0x417f30=_0x417f30||0x1f4;return function(_0x30412d){logger[_0x02e5('0x25')](_0x30412d['stack']);if(_0x30412d[_0x02e5('0x26')]){delete _0x30412d[_0x02e5('0x26')];}_0x131804[_0x02e5('0x16')](_0x417f30)[_0x02e5('0x27')](_0x30412d);};}exports[_0x02e5('0x28')]=function(_0x4677e3,_0x1336b1){var _0x3b1aea={},_0xffee29={},_0x3cbda0={'count':0x0,'rows':[]};var _0x32de9f=_[_0x02e5('0x29')](db[_0x02e5('0x2a')][_0x02e5('0x2b')],function(_0xedbe6f){return{'name':_0xedbe6f[_0x02e5('0x2c')],'type':_0xedbe6f['type'][_0x02e5('0x2d')]};});_0xffee29[_0x02e5('0x2e')]=_[_0x02e5('0x29')](_0x32de9f,_0x02e5('0x26'));_0xffee29[_0x02e5('0x2f')]=_[_0x02e5('0x30')](_0x4677e3[_0x02e5('0x2f')]);_0xffee29['filters']=_[_0x02e5('0x31')](_0xffee29['model'],_0xffee29['query']);_0x3b1aea[_0x02e5('0x32')]=_[_0x02e5('0x31')](_0xffee29[_0x02e5('0x2e')],qs[_0x02e5('0x33')](_0x4677e3[_0x02e5('0x2f')][_0x02e5('0x33')]));_0x3b1aea['attributes']=_0x3b1aea['attributes'][_0x02e5('0x34')]?_0x3b1aea[_0x02e5('0x32')]:_0xffee29['model'];if(!_0x4677e3[_0x02e5('0x2f')][_0x02e5('0x35')](_0x02e5('0x36'))){_0x3b1aea[_0x02e5('0x1b')]=qs[_0x02e5('0x1b')](_0x4677e3[_0x02e5('0x2f')][_0x02e5('0x1b')]);_0x3b1aea['offset']=qs[_0x02e5('0x19')](_0x4677e3[_0x02e5('0x2f')][_0x02e5('0x19')]);}_0x3b1aea[_0x02e5('0x37')]=qs['sort'](_0x4677e3['query'][_0x02e5('0x38')]);_0x3b1aea[_0x02e5('0x39')]=qs[_0x02e5('0x3a')](_[_0x02e5('0x3b')](_0x4677e3[_0x02e5('0x2f')],_0xffee29[_0x02e5('0x3a')]),_0x32de9f);if(_0x4677e3[_0x02e5('0x2f')][_0x02e5('0x3c')]){_0x3b1aea['where']=_[_0x02e5('0x3d')](_0x3b1aea[_0x02e5('0x39')],{'$or':_[_0x02e5('0x29')](_0x32de9f,function(_0x495139){if(_0x495139[_0x02e5('0x3e')]!==_0x02e5('0x3f')){var _0xfb16c2={};_0xfb16c2[_0x495139[_0x02e5('0x26')]]={'$like':'%'+_0x4677e3[_0x02e5('0x2f')][_0x02e5('0x3c')]+'%'};return _0xfb16c2;}})});}_0x3b1aea=_[_0x02e5('0x3d')]({},_0x3b1aea,_0x4677e3[_0x02e5('0x40')]);var _0x21315d={'where':_0x3b1aea[_0x02e5('0x39')]};return db[_0x02e5('0x2a')][_0x02e5('0x1c')](_0x21315d)[_0x02e5('0x22')](function(_0x26e0c6){_0x3cbda0[_0x02e5('0x1c')]=_0x26e0c6;if(_0x4677e3['query'][_0x02e5('0x41')]){_0x3b1aea[_0x02e5('0x42')]=[{'all':!![]}];}return db[_0x02e5('0x2a')]['findAll'](_0x3b1aea);})[_0x02e5('0x22')](function(_0x5da697){_0x3cbda0['rows']=_0x5da697;return _0x3cbda0;})['then'](respondWithFilteredResult(_0x1336b1,_0x3b1aea))[_0x02e5('0x43')](handleError(_0x1336b1,null));};exports[_0x02e5('0x44')]=function(_0x25973a,_0x29bb2e){var _0xac902c={'raw':!![],'where':{'id':_0x25973a[_0x02e5('0x45')]['id']}},_0x1c03cb={};_0x1c03cb['model']=_[_0x02e5('0x30')](db[_0x02e5('0x2a')][_0x02e5('0x2b')]);_0x1c03cb[_0x02e5('0x2f')]=_[_0x02e5('0x30')](_0x25973a[_0x02e5('0x2f')]);_0x1c03cb[_0x02e5('0x3a')]=_['intersection'](_0x1c03cb['model'],_0x1c03cb[_0x02e5('0x2f')]);_0xac902c[_0x02e5('0x32')]=_[_0x02e5('0x31')](_0x1c03cb[_0x02e5('0x2e')],qs['fields'](_0x25973a[_0x02e5('0x2f')][_0x02e5('0x33')]));_0xac902c[_0x02e5('0x32')]=_0xac902c['attributes']['length']?_0xac902c[_0x02e5('0x32')]:_0x1c03cb['model'];if(_0x25973a['query']['includeAll']){_0xac902c['include']=[{'all':!![]}];}_0xac902c=_['merge']({},_0xac902c,_0x25973a[_0x02e5('0x40')]);return db[_0x02e5('0x2a')]['find'](_0xac902c)['then'](handleEntityNotFound(_0x29bb2e,null))[_0x02e5('0x22')](respondWithResult(_0x29bb2e,null))[_0x02e5('0x43')](handleError(_0x29bb2e,null));};exports[_0x02e5('0x46')]=function(_0x54c607,_0x5753db){return db[_0x02e5('0x2a')][_0x02e5('0x46')](_0x54c607['body'],{})[_0x02e5('0x22')](respondWithResult(_0x5753db,0xc9))['catch'](handleError(_0x5753db,null));};exports[_0x02e5('0x21')]=function(_0x3b0c5b,_0xe5f6f2){if(_0x3b0c5b['body']['id']){delete _0x3b0c5b[_0x02e5('0x47')]['id'];}return db[_0x02e5('0x2a')][_0x02e5('0x48')]({'where':{'id':_0x3b0c5b[_0x02e5('0x45')]['id']}})[_0x02e5('0x22')](handleEntityNotFound(_0xe5f6f2,null))[_0x02e5('0x22')](saveUpdates(_0x3b0c5b[_0x02e5('0x47')],null))[_0x02e5('0x22')](respondWithResult(_0xe5f6f2,null))['catch'](handleError(_0xe5f6f2,null));};exports[_0x02e5('0x23')]=function(_0x53e77f,_0x2f9cbd){return db[_0x02e5('0x2a')][_0x02e5('0x48')]({'where':{'id':_0x53e77f[_0x02e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f9cbd,null))['then'](removeEntity(_0x2f9cbd,null))[_0x02e5('0x43')](handleError(_0x2f9cbd,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0e4a8df..826af42 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 _0xfea8=['../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x2631ee,_0x56dc38){var _0x48633d=function(_0x5d3ee3){while(--_0x5d3ee3){_0x2631ee['push'](_0x2631ee['shift']());}};_0x48633d(++_0x56dc38);}(_0xfea8,0x162));var _0x8fea=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xfea8[_0x4a8bad];return _0x30cf32;};'use strict';var _=require(_0x8fea('0x0'));var util=require(_0x8fea('0x1'));var logger=require(_0x8fea('0x2'))('api');var moment=require(_0x8fea('0x3'));var BPromise=require(_0x8fea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8fea('0x5'));var config=require(_0x8fea('0x6'));var attributes=require(_0x8fea('0x7'));module[_0x8fea('0x8')]=function(_0x9971f5,_0x30025e){return _0x9971f5[_0x8fea('0x9')](_0x8fea('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8fea('0xb')});}; \ No newline at end of file +var _0xc0c6=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0xc0c6,0x139));var _0x6c0c=function(_0xaf3871,_0x4f9558){_0xaf3871=_0xaf3871-0x0;var _0xa259f5=_0xc0c6[_0xaf3871];return _0xa259f5;};'use strict';var _=require(_0x6c0c('0x0'));var util=require(_0x6c0c('0x1'));var logger=require(_0x6c0c('0x2'))(_0x6c0c('0x3'));var moment=require(_0x6c0c('0x4'));var BPromise=require(_0x6c0c('0x5'));var rp=require(_0x6c0c('0x6'));var fs=require('fs');var path=require(_0x6c0c('0x7'));var rimraf=require(_0x6c0c('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x6c0c('0x9')]=function(_0x18905c,_0x158169){return _0x18905c[_0x6c0c('0xa')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6c0c('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 3df2ec6..8a4e78c 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 _0x1ab9=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','lodash','moment'];(function(_0x26be2d,_0x413917){var _0x6a0693=function(_0x3fda50){while(--_0x3fda50){_0x26be2d['push'](_0x26be2d['shift']());}};_0x6a0693(++_0x413917);}(_0x1ab9,0x1d2));var _0x91ab=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0x1ab9[_0x86b219];return _0x1f320c;};'use strict';var _=require(_0x91ab('0x0'));var util=require('util');var moment=require(_0x91ab('0x1'));var BPromise=require('bluebird');var rs=require(_0x91ab('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91ab('0x3'))['db'];var utils=require(_0x91ab('0x4'));var logger=require('../../config/logger')(_0x91ab('0x5'));var config=require(_0x91ab('0x6'));var jayson=require(_0x91ab('0x7'));var client=jayson[_0x91ab('0x8')][_0x91ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x138b8d,_0x3f75bf,_0x2253b3){return new BPromise(function(_0x2f5585,_0x46d8ed){return client['request'](_0x138b8d,_0x2253b3)[_0x91ab('0xa')](function(_0x2ca729){logger['info'](_0x91ab('0xb'),_0x3f75bf,_0x91ab('0xc'));logger[_0x91ab('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3f75bf,'request\x20sent',JSON[_0x91ab('0xe')](_0x2ca729));if(_0x2ca729['error']){if(_0x2ca729[_0x91ab('0xf')]['code']===0x1f4){logger[_0x91ab('0xf')](_0x91ab('0xb'),_0x3f75bf,_0x2ca729[_0x91ab('0xf')][_0x91ab('0x10')]);return _0x46d8ed(_0x2ca729[_0x91ab('0xf')]['message']);}logger[_0x91ab('0xf')](_0x91ab('0xb'),_0x3f75bf,_0x2ca729['error']['message']);return _0x2f5585(_0x2ca729[_0x91ab('0xf')]['message']);}else{logger[_0x91ab('0x11')](_0x91ab('0xb'),_0x3f75bf,_0x91ab('0xc'));_0x2f5585(_0x2ca729['result']['message']);}})[_0x91ab('0x12')](function(_0x4feac5){logger[_0x91ab('0xf')](_0x91ab('0xb'),_0x3f75bf,_0x4feac5);_0x46d8ed(_0x4feac5);});});}exports[_0x91ab('0x13')]=function(_0x15b411){var _0x4c54d4=this;return new Promise(function(_0x2a2941,_0x2a6340){return db[_0x91ab('0x14')]['update'](_0x15b411[_0x91ab('0x15')],{'raw':_0x15b411[_0x91ab('0x16')]?_0x15b411['options'][_0x91ab('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15b411[_0x91ab('0x16')]?_0x15b411['options'][_0x91ab('0x18')]||null:null,'attributes':_0x15b411[_0x91ab('0x16')]?_0x15b411[_0x91ab('0x16')][_0x91ab('0x19')]||null:null,'limit':_0x15b411['options']?_0x15b411[_0x91ab('0x16')]['limit']||null:null})[_0x91ab('0xa')](function(_0x134ef7){logger[_0x91ab('0x11')](_0x91ab('0x13'),_0x15b411);logger[_0x91ab('0xd')](_0x91ab('0x13'),_0x15b411,JSON[_0x91ab('0xe')](_0x134ef7));_0x2a2941(_0x134ef7);})[_0x91ab('0x12')](function(_0x58849b){logger['error'](_0x91ab('0x13'),_0x58849b['message'],_0x15b411);_0x2a6340(_0x4c54d4[_0x91ab('0xf')](0x1f4,_0x58849b['message']));});});}; \ No newline at end of file +var _0x3a01=['UpdateOpenchannelApplication','options','where','attributes','limit','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result'];(function(_0x1bddc8,_0x31c45f){var _0x2aef3d=function(_0x151dec){while(--_0x151dec){_0x1bddc8['push'](_0x1bddc8['shift']());}};_0x2aef3d(++_0x31c45f);}(_0x3a01,0x13f));var _0x13a0=function(_0x51048f,_0xadb01d){_0x51048f=_0x51048f-0x0;var _0x480419=_0x3a01[_0x51048f];return _0x480419;};'use strict';var _=require(_0x13a0('0x0'));var util=require(_0x13a0('0x1'));var moment=require(_0x13a0('0x2'));var BPromise=require(_0x13a0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13a0('0x4'));var db=require(_0x13a0('0x5'))['db'];var utils=require(_0x13a0('0x6'));var logger=require(_0x13a0('0x7'))('rpc');var config=require(_0x13a0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31152e,_0x436be1,_0x57cb5c){return new BPromise(function(_0x3bf794,_0x4fca3c){return client['request'](_0x31152e,_0x57cb5c)['then'](function(_0x17a1a5){logger[_0x13a0('0x9')]('OpenchannelApplication,\x20%s,\x20%s',_0x436be1,_0x13a0('0xa'));logger[_0x13a0('0xb')](_0x13a0('0xc'),_0x436be1,_0x13a0('0xa'),JSON[_0x13a0('0xd')](_0x17a1a5));if(_0x17a1a5[_0x13a0('0xe')]){if(_0x17a1a5['error'][_0x13a0('0xf')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x436be1,_0x17a1a5[_0x13a0('0xe')]['message']);return _0x4fca3c(_0x17a1a5[_0x13a0('0xe')]['message']);}logger[_0x13a0('0xe')](_0x13a0('0x10'),_0x436be1,_0x17a1a5['error'][_0x13a0('0x11')]);return _0x3bf794(_0x17a1a5[_0x13a0('0xe')][_0x13a0('0x11')]);}else{logger[_0x13a0('0x9')]('OpenchannelApplication,\x20%s,\x20%s',_0x436be1,_0x13a0('0xa'));_0x3bf794(_0x17a1a5[_0x13a0('0x12')][_0x13a0('0x11')]);}})['catch'](function(_0x1dd1e2){logger[_0x13a0('0xe')](_0x13a0('0x10'),_0x436be1,_0x1dd1e2);_0x4fca3c(_0x1dd1e2);});});}exports[_0x13a0('0x13')]=function(_0x5a0930){var _0x12649b=this;return new Promise(function(_0x3f5bb7,_0x274d10){return db['OpenchannelApplication']['update'](_0x5a0930['body'],{'raw':_0x5a0930['options']?_0x5a0930[_0x13a0('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a0930[_0x13a0('0x14')]?_0x5a0930[_0x13a0('0x14')][_0x13a0('0x15')]||null:null,'attributes':_0x5a0930[_0x13a0('0x14')]?_0x5a0930[_0x13a0('0x14')][_0x13a0('0x16')]||null:null,'limit':_0x5a0930[_0x13a0('0x14')]?_0x5a0930[_0x13a0('0x14')][_0x13a0('0x17')]||null:null})[_0x13a0('0x18')](function(_0xf9ed37){logger['info']('UpdateOpenchannelApplication',_0x5a0930);logger[_0x13a0('0xb')]('UpdateOpenchannelApplication',_0x5a0930,JSON[_0x13a0('0xd')](_0xf9ed37));_0x3f5bb7(_0xf9ed37);})[_0x13a0('0x19')](function(_0x4d9175){logger[_0x13a0('0xe')](_0x13a0('0x13'),_0x4d9175['message'],_0x5a0930);_0x274d10(_0x12649b['error'](0x1f4,_0x4d9175[_0x13a0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 886b16a..1b33906 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 _0xcb5b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xcb5b,0x148));var _0xbcb5=function(_0x1ffead,_0x54fc03){_0x1ffead=_0x1ffead-0x0;var _0x50c660=_0xcb5b[_0x1ffead];return _0x50c660;};'use strict';var multer=require(_0xbcb5('0x0'));var util=require(_0xbcb5('0x1'));var path=require(_0xbcb5('0x2'));var timeout=require(_0xbcb5('0x3'));var express=require(_0xbcb5('0x4'));var router=express[_0xbcb5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbcb5('0x6'));var interaction=require(_0xbcb5('0x7'));var config=require(_0xbcb5('0x8'));var controller=require(_0xbcb5('0x9'));router[_0xbcb5('0xa')]('/',auth[_0xbcb5('0xb')](),controller['index']);router[_0xbcb5('0xa')](_0xbcb5('0xc'),auth[_0xbcb5('0xb')](),controller['describe']);router[_0xbcb5('0xa')](_0xbcb5('0xd'),auth[_0xbcb5('0xb')](),controller['show']);router['get'](_0xbcb5('0xe'),auth[_0xbcb5('0xb')](),controller[_0xbcb5('0xf')]);router[_0xbcb5('0xa')](_0xbcb5('0x10'),auth[_0xbcb5('0xb')](),controller[_0xbcb5('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbcb5('0x12')]);router[_0xbcb5('0x13')](_0xbcb5('0xe'),auth['isAuthenticated'](),controller[_0xbcb5('0x14')]);router['post'](_0xbcb5('0x15'),auth[_0xbcb5('0xb')](),interaction[_0xbcb5('0x16')](_0xbcb5('0x17'),'openchannelinteraction:addtags'),controller['addTags']);router['put'](_0xbcb5('0xd'),auth[_0xbcb5('0xb')](),interaction[_0xbcb5('0x16')](_0xbcb5('0x17'),_0xbcb5('0x18')),controller[_0xbcb5('0x19')]);router[_0xbcb5('0x1a')]('/:id',auth[_0xbcb5('0xb')](),interaction[_0xbcb5('0x16')](_0xbcb5('0x17'),_0xbcb5('0x1b')),controller[_0xbcb5('0x1c')]);router[_0xbcb5('0x1a')]('/:id/tags',auth[_0xbcb5('0xb')](),controller['removeTags']);module[_0xbcb5('0x1d')]=router; \ No newline at end of file +var _0x62df=['openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x62df,0x149));var _0xf62d=function(_0xe81aa2,_0x232cfe){_0xe81aa2=_0xe81aa2-0x0;var _0x1230fb=_0x62df[_0xe81aa2];return _0x1230fb;};'use strict';var multer=require(_0xf62d('0x0'));var util=require(_0xf62d('0x1'));var path=require('path');var timeout=require(_0xf62d('0x2'));var express=require(_0xf62d('0x3'));var router=express['Router']();var fs_extra=require(_0xf62d('0x4'));var auth=require(_0xf62d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf62d('0x6'));var controller=require(_0xf62d('0x7'));router[_0xf62d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf62d('0x9'),auth[_0xf62d('0xa')](),controller[_0xf62d('0xb')]);router[_0xf62d('0x8')](_0xf62d('0xc'),auth[_0xf62d('0xa')](),controller[_0xf62d('0xd')]);router['get'](_0xf62d('0xe'),auth[_0xf62d('0xa')](),controller['getMessages']);router[_0xf62d('0x8')](_0xf62d('0xf'),auth['isAuthenticated'](),controller[_0xf62d('0x10')]);router['post']('/',auth[_0xf62d('0xa')](),controller[_0xf62d('0x11')]);router[_0xf62d('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf62d('0x13')]);router[_0xf62d('0x12')](_0xf62d('0x14'),auth[_0xf62d('0xa')](),interaction[_0xf62d('0x15')](_0xf62d('0x16'),_0xf62d('0x17')),controller[_0xf62d('0x18')]);router[_0xf62d('0x19')](_0xf62d('0xc'),auth['isAuthenticated'](),interaction[_0xf62d('0x15')](_0xf62d('0x16'),_0xf62d('0x1a')),controller[_0xf62d('0x1b')]);router[_0xf62d('0x1c')](_0xf62d('0xc'),auth[_0xf62d('0xa')](),interaction[_0xf62d('0x15')](_0xf62d('0x16'),_0xf62d('0x1d')),controller['destroy']);router[_0xf62d('0x1c')](_0xf62d('0x14'),auth['isAuthenticated'](),controller[_0xf62d('0x1e')]);module[_0xf62d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9251c1d..b8ac8cc 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 _0x4262=['STRING','DATE','ENUM','sequelize','exports','BOOLEAN'];(function(_0x2dcafd,_0x284c8b){var _0x117a83=function(_0x109efa){while(--_0x109efa){_0x2dcafd['push'](_0x2dcafd['shift']());}};_0x117a83(++_0x284c8b);}(_0x4262,0x15f));var _0x2426=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4262[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x2426('0x0'));module[_0x2426('0x1')]={'closed':{'type':Sequelize[_0x2426('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2426('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2426('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x2426('0x3')]},'externalUrl':{'type':Sequelize[_0x2426('0x3')]},'lastMsgAt':{'type':Sequelize[_0x2426('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2426('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2426('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x2426('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1360=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x11d541,_0xc8fe9){var _0x3e612a=function(_0x4f5e9d){while(--_0x4f5e9d){_0x11d541['push'](_0x11d541['shift']());}};_0x3e612a(++_0xc8fe9);}(_0x1360,0xd6));var _0x0136=function(_0x2583a7,_0x3beef9){_0x2583a7=_0x2583a7-0x0;var _0x35de7b=_0x1360[_0x2583a7];return _0x35de7b;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x0136('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0136('0x1')]},'disposition':{'type':Sequelize[_0x0136('0x2')]},'secondDisposition':{'type':Sequelize[_0x0136('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0136('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0136('0x1')]},'threadId':{'type':Sequelize[_0x0136('0x2')]},'externalUrl':{'type':Sequelize[_0x0136('0x2')]},'lastMsgAt':{'type':Sequelize[_0x0136('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x0136('0x3')]('in',_0x0136('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 11447a7..59d3365 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 _0x7379=['all','rows','show','params','keys','includeAll','include','merge','options','create','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','tmp','server','files','transcript-%d-%s.zip','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','firstName','out','renderFile','root','downloadInteraction.ejs','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','select','field','color','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','`\x20>\x200','Contact','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','end','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','text','body','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','toString','sequelize','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId'];(function(_0x42d892,_0x28df1a){var _0x4ebd4f=function(_0x11a7e7){while(--_0x11a7e7){_0x42d892['push'](_0x42d892['shift']());}};_0x4ebd4f(++_0x28df1a);}(_0x7379,0x12d));var _0x9737=function(_0x2a6f6a,_0x3b5ec6){_0x2a6f6a=_0x2a6f6a-0x0;var _0x5e4767=_0x7379[_0x2a6f6a];return _0x5e4767;};'use strict';var emlformat=require(_0x9737('0x0'));var rimraf=require(_0x9737('0x1'));var zipdir=require(_0x9737('0x2'));var jsonpatch=require(_0x9737('0x3'));var rp=require(_0x9737('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9737('0x5'));var util=require(_0x9737('0x6'));var path=require('path');var sox=require(_0x9737('0x7'));var csv=require('to-csv');var ejs=require(_0x9737('0x8'));var fs=require('fs');var fs_extra=require(_0x9737('0x9'));var _=require(_0x9737('0xa'));var squel=require(_0x9737('0xb'));var crypto=require(_0x9737('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9737('0xd'));var Redis=require(_0x9737('0xe'));var authService=require(_0x9737('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9737('0x10'));var pdf=require(_0x9737('0x11'));var hardwareService=require(_0x9737('0x12'));var logger=require(_0x9737('0x13'))(_0x9737('0x14'));var utils=require('../../config/utils');var config=require(_0x9737('0x15'));var licenseUtil=require(_0x9737('0x16'));var db=require(_0x9737('0x17'))['db'];config['redis']=_['defaults'](config[_0x9737('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9737('0x18')]));require(_0x9737('0x19'))[_0x9737('0x1a')](socket);function respondWithStatusCode(_0x445854,_0x18ecf3){_0x18ecf3=_0x18ecf3||0xcc;return function(_0x2d9e13){if(_0x2d9e13){return _0x445854[_0x9737('0x1b')](_0x18ecf3);}return _0x445854[_0x9737('0x1c')](_0x18ecf3)['end']();};}function respondWithResult(_0x114943,_0x41e7c8){_0x41e7c8=_0x41e7c8||0xc8;return function(_0x5d083e){if(_0x5d083e){return _0x114943[_0x9737('0x1c')](_0x41e7c8)[_0x9737('0x1d')](_0x5d083e);}};}function respondWithFilteredResult(_0x33d281,_0x37293c){return function(_0x237c2e){if(_0x237c2e){var _0x4c647e=typeof _0x37293c[_0x9737('0x1e')]===_0x9737('0x1f')&&typeof _0x37293c[_0x9737('0x20')]===_0x9737('0x1f');var _0x495eb7=_0x237c2e[_0x9737('0x21')];var _0x150b25=_0x4c647e?0x0:_0x37293c['offset'];var _0x1832e3=_0x4c647e?_0x237c2e[_0x9737('0x21')]:_0x37293c[_0x9737('0x1e')]+_0x37293c[_0x9737('0x20')];var _0x22b7fa;if(_0x1832e3>=_0x495eb7){_0x1832e3=_0x495eb7;_0x22b7fa=0xc8;}else{_0x22b7fa=0xce;}_0x33d281[_0x9737('0x1c')](_0x22b7fa);return _0x33d281[_0x9737('0x22')]('Content-Range',_0x150b25+'-'+_0x1832e3+'/'+_0x495eb7)[_0x9737('0x1d')](_0x237c2e);}return null;};}function patchUpdates(_0x28eb2f){return function(_0xff38da){try{jsonpatch[_0x9737('0x23')](_0xff38da,_0x28eb2f,!![]);}catch(_0x39a48a){return BPromise[_0x9737('0x24')](_0x39a48a);}return _0xff38da[_0x9737('0x25')]();};}function saveUpdates(_0x15e74b,_0x538e5b){return function(_0x1a7f27){if(_0x1a7f27){return _0x1a7f27[_0x9737('0x26')](_0x15e74b)[_0x9737('0x27')](function(_0x3ef78b){return _0x3ef78b;});}return null;};}function removeEntity(_0x2a53d3,_0x57e0e2){return function(_0xe47839){if(_0xe47839){return _0xe47839[_0x9737('0x28')]()[_0x9737('0x27')](function(){_0x2a53d3[_0x9737('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d3386,_0x4fbebf){return function(_0x19cb80){if(!_0x19cb80){_0x1d3386[_0x9737('0x1b')](0x194);}return _0x19cb80;};}function handleError(_0x28ead9,_0x116c20){_0x116c20=_0x116c20||0x1f4;return function(_0x4af863){logger['error'](_0x4af863[_0x9737('0x29')]);if(_0x4af863[_0x9737('0x2a')]){delete _0x4af863[_0x9737('0x2a')];}_0x28ead9['status'](_0x116c20)[_0x9737('0x2b')](_0x4af863);};}function getInteractionUsers(_0xb33225,_0x38ee41){return new BPromise(function(_0x4ca524,_0x2c31cf){try{if(_0x38ee41[_0xb33225['id']]){_0xb33225[_0x9737('0x2c')]=_['map'](_0x38ee41[_0xb33225['id']],function(_0x5bd438){return{'id':_0x5bd438['id'],'fullname':_0x5bd438[_0x9737('0x2d')]};});}}catch(_0xd358b8){_0x2c31cf(_0xd358b8);}_0x4ca524(_0xb33225);});}function getInteractionTags(_0x370bef,_0x2884fa){return new BPromise(function(_0x121dd9,_0x5ca372){try{if(_0x370bef[_0x9737('0x2e')]){_0x370bef[_0x9737('0x2f')]=[];_0x370bef[_0x9737('0x2e')][_0x9737('0x30')](',')['forEach'](function(_0x1e569c){_0x370bef[_0x9737('0x2f')][_0x9737('0x31')](_0x2884fa[_0x1e569c]);});}delete _0x370bef['TagIds'];}catch(_0x38aa59){_0x5ca372(_0x38aa59);}_0x121dd9(_0x370bef);});}function updateOpenchannelInteraction(_0x36772a,_0x5309bb,_0x5785a0){return new BPromise(function(_0x48070d,_0x50f33c){return getInteractionUsers(_0x36772a,_0x5785a0)['then'](function(_0x590d2c){return getInteractionTags(_0x590d2c,_0x5309bb);})[_0x9737('0x27')](function(_0x12e011){_0x48070d(_0x12e011);})[_0x9737('0x32')](function(_0x430671){_0x50f33c(_0x430671);});});}exports[_0x9737('0x33')]=function(_0x100a05,_0x5ea8b6){var _0x4be868={},_0xb14f24={},_0x5191dd={'count':0x0,'rows':[]};var _0x41d6e6=_[_0x9737('0x34')](db[_0x9737('0x35')][_0x9737('0x36')],function(_0x2211a9){return{'name':_0x2211a9[_0x9737('0x37')],'type':_0x2211a9[_0x9737('0x38')][_0x9737('0x39')]};});_0xb14f24[_0x9737('0x3a')]=_[_0x9737('0x34')](_0x41d6e6,'name');_0xb14f24[_0x9737('0x3b')]=_['keys'](_0x100a05[_0x9737('0x3b')]);_0xb14f24['filters']=_[_0x9737('0x3c')](_0xb14f24[_0x9737('0x3a')],_0xb14f24[_0x9737('0x3b')]);_0x4be868[_0x9737('0x3d')]=_['intersection'](_0xb14f24[_0x9737('0x3a')],qs[_0x9737('0x3e')](_0x100a05['query'][_0x9737('0x3e')]));_0x4be868[_0x9737('0x3d')]=_0x4be868[_0x9737('0x3d')]['length']?_0x4be868['attributes']:_0xb14f24[_0x9737('0x3a')];if(!_0x100a05[_0x9737('0x3b')][_0x9737('0x3f')]('nolimit')){_0x4be868['limit']=qs['limit'](_0x100a05[_0x9737('0x3b')][_0x9737('0x20')]);_0x4be868[_0x9737('0x1e')]=qs['offset'](_0x100a05[_0x9737('0x3b')][_0x9737('0x1e')]);}_0x4be868[_0x9737('0x40')]=qs[_0x9737('0x41')](_0x100a05['query']['sort']);_0x4be868['where']=qs[_0x9737('0x42')](_[_0x9737('0x43')](_0x100a05[_0x9737('0x3b')],_0xb14f24['filters']),_0x41d6e6);var _0x43a1b8=[];var _0x119c6d=squel[_0x9737('0x44')]()[_0x9737('0x45')]('id')[_0x9737('0x45')]('name')[_0x9737('0x45')](_0x9737('0x46'))['from'](_0x9737('0x47'));var _0x394e0e=squel[_0x9737('0x44')]()[_0x9737('0x45')](_0x9737('0x48'))['field']('u.fullname')[_0x9737('0x45')](_0x9737('0x49'))['from'](_0x9737('0x4a'),'ui')[_0x9737('0x4b')]('users','u',_0x9737('0x4c'));var _0x4d5cc4=squel[_0x9737('0x44')]()[_0x9737('0x4d')]('openchannel_interactions','i')[_0x9737('0x4b')](_0x9737('0x4e'),'c',_0x9737('0x4f'))[_0x9737('0x4b')]('users','o',_0x9737('0x50'))[_0x9737('0x4b')]('openchannel_accounts','a',_0x9737('0x51'))[_0x9737('0x4b')](_0x9737('0x52'),'me',_0x9737('0x53'))[_0x9737('0x4b')]('openchannel_interaction_has_tags','it',_0x9737('0x54'))[_0x9737('0x4b')](_0x9737('0x47'),'t',_0x9737('0x55'));var _0x3388a8=squel[_0x9737('0x56')]();var _0x45df39=[];var _0x1c5fe5=squel[_0x9737('0x56')]();var _0x4b2a51;if(_0x100a05[_0x9737('0x3b')][_0x9737('0x57')]){_0x4b2a51=as['parseSearch'](_0x100a05['query'][_0x9737('0x57')]);var _0x540035=_0x4b2a51[_0x9737('0x58')];for(var _0x9eebf7=0x0;_0x9eebf7<_0x4b2a51[_0x9737('0x59')]['length'];_0x9eebf7++){var _0x121768=_0x4b2a51[_0x9737('0x59')][_0x9eebf7];var _0x1aa04f='i';var _0x37a0d8=_['find'](_0x41d6e6,[_0x9737('0x2a'),_0x121768[_0x9737('0x45')]]);if(!_0x37a0d8){switch(_0x121768[_0x9737('0x45')]){case _0x9737('0x5a'):if(_0x121768[_0x9737('0x5b')]==0x1){_0x4d5cc4['having']('`'+_0x121768[_0x9737('0x45')]+'`\x20=\x200');}else{_0x4d5cc4['having']('`'+_0x121768[_0x9737('0x45')]+_0x9737('0x5c'));}break;case _0x9737('0x5d'):if(_0x121768['operator']===_0x9737('0x5e')){if(_0x121768[_0x9737('0x5b')][_0x9737('0x30')]('\x20')[_0x9737('0x5f')]>0x1){_0x3388a8[_0x540035](_0x9737('0x60'),qs[_0x9737('0x61')](_0x121768[_0x9737('0x5b')]),null);}else{var _0x3f3d14='%'+_0x121768[_0x9737('0x5b')]+'%';_0x3388a8[_0x540035](_0x9737('0x62'),_0x3f3d14,_0x3f3d14,_0x3f3d14);}}else{_0x37a0d8=_[_0x9737('0x63')](_0x41d6e6,[_0x9737('0x2a'),_0x9737('0x64')]);_0x121768[_0x9737('0x45')]='ContactId';_0x58a83e=as[_0x9737('0x65')](_0x1aa04f,_0x37a0d8[_0x9737('0x38')],_0x121768);_0x3388a8[_0x540035](_0x58a83e['text'],_0x58a83e[_0x9737('0x5b')][_0x9737('0x66')],_0x58a83e[_0x9737('0x5b')][_0x9737('0x67')]);}break;case _0x9737('0x68'):var _0xb36ee5=_0x121768['value'][_0x9737('0x30')](',')[_0x9737('0x34')](function(_0x446d98){return Number(_0x446d98);});_0xb36ee5[_0x9737('0x69')](function(_0x5f0620){_0x1c5fe5['or'](_0x9737('0x6a'),'%,'+_0x5f0620+',%');});_0x45df39=_[_0x9737('0x6b')](_0x45df39,_0xb36ee5);break;case _0x9737('0x6c'):if(_0x121768[_0x9737('0x6d')]===_0x9737('0x5e')){_0x3388a8[_0x540035]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x121768['value']+'%',null);}else{_0x37a0d8=_[_0x9737('0x63')](_0x41d6e6,[_0x9737('0x2a'),_0x9737('0x6e')]);_0x121768[_0x9737('0x45')]=_0x9737('0x6e');_0x58a83e=as[_0x9737('0x65')](_0x1aa04f,_0x37a0d8[_0x9737('0x38')],_0x121768);_0x3388a8[_0x540035](_0x58a83e[_0x9737('0x6f')],_0x58a83e['value']['start'],_0x58a83e['value']['end']);}break;case _0x9737('0x70'):_0x58a83e=as[_0x9737('0x65')]('me',null,_0x121768);_0x3388a8[_0x540035](_0x58a83e['text'],_0x58a83e[_0x9737('0x5b')]['start'],_0x58a83e['value']['end']);break;}}else{var _0x58a83e=as[_0x9737('0x65')](_0x1aa04f,_0x37a0d8['type'],_0x121768);_0x3388a8[_0x540035](_0x58a83e[_0x9737('0x6f')],_0x58a83e[_0x9737('0x5b')][_0x9737('0x66')],_0x58a83e[_0x9737('0x5b')][_0x9737('0x67')]);}}}else{var _0x25df6a=_(_0x100a05[_0x9737('0x3b')])['keys']()['map'](function(_0x2878a4){return _[_0x9737('0x71')](_0x41d6e6,['name',_0x2878a4])?_0x2878a4:undefined;})[_0x9737('0x72')]()[_0x9737('0x5b')]();if(!_[_0x9737('0x73')](_0x25df6a)){_0x25df6a[_0x9737('0x69')](function(_0x1365b8){if(_0x1365b8===_0x9737('0x74')){_0x4d5cc4[_0x9737('0x75')](_0x9737('0x76'),[][_0x9737('0x77')](_0x100a05['query'][_0x1365b8]));}else if(_0x1365b8===_0x9737('0x78')){var _0x3a3ba3=JSON[_0x9737('0x79')](_0x100a05[_0x9737('0x3b')][_0x1365b8])[_0x9737('0x7a')];var _0x451eea=JSON['parse'](_0x100a05[_0x9737('0x3b')][_0x1365b8])[_0x9737('0x7b')];_0x4d5cc4[_0x9737('0x75')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3a3ba3,_0x451eea);}else{if(_0x100a05[_0x9737('0x3b')][_0x1365b8]==='null'){_0x4d5cc4[_0x9737('0x75')]('i.'+_0x1365b8+_0x9737('0x7c'));}else{_0x4d5cc4[_0x9737('0x75')]('i.'+_0x1365b8+_0x9737('0x7d'),_0x100a05[_0x9737('0x3b')][_0x1365b8]);}}});}if(_0x100a05[_0x9737('0x3b')][_0x9737('0x7e')]){if(_0x100a05['query'][_0x9737('0x7e')]==0x1){_0x4d5cc4[_0x9737('0x7f')](_0x9737('0x80'));}else{_0x4d5cc4[_0x9737('0x7f')](_0x9737('0x81'));}}if(_0x100a05[_0x9737('0x3b')]['tag']){_0x45df39=_[_0x9737('0x82')](_0x100a05[_0x9737('0x3b')][_0x9737('0x83')])?_0x100a05[_0x9737('0x3b')][_0x9737('0x83')]:new Array(_0x100a05[_0x9737('0x3b')][_0x9737('0x83')]);_0x45df39['forEach'](function(_0x17025e){_0x1c5fe5['or'](_0x9737('0x6a'),'%,'+_0x17025e+',%');});}if(_0x100a05[_0x9737('0x3b')]['filter']){var _0xc2b56=_0x100a05[_0x9737('0x3b')][_0x9737('0x84')][_0x9737('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9737('0x86')](_0xc2b56)){_0x3388a8['or'](_0x9737('0x87'),_0xc2b56+'%');}else{_0x3388a8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xc2b56))['or']('i.from\x20LIKE\x20?',_0xc2b56+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xc2b56+'%');}}}_0x4d5cc4['where'](_0x3388a8);_0x4d5cc4[_0x9737('0x88')](_0x9737('0x89'));var _0x58591f={'type':db['Sequelize'][_0x9737('0x8a')]['SELECT'],'raw':!![]};var _0xac857c=_0x4d5cc4['clone']();_0xac857c[_0x9737('0x45')]('i.id');_0xac857c[_0x9737('0x45')](_0x9737('0x8b'),_0x9737('0x5a'));if(_0x4be868[_0x9737('0x40')]){_0x4be868[_0x9737('0x40')][_0x9737('0x69')](function(_0x2e3c50){var _0xdf0f1c=_0x2e3c50[0x0]===_0x9737('0x8c')?_0x2e3c50[0x0]:'i.'+_0x2e3c50[0x0];_0x4d5cc4[_0x9737('0x40')](_0xdf0f1c,_0x2e3c50[0x1]===_0x9737('0x8d')?![]:!![]);});}if(!_[_0x9737('0x73')](_0x45df39)){_0x4d5cc4['having'](_0x1c5fe5);_0xac857c[_0x9737('0x75')](_0x9737('0x8e'),_0x45df39);}BPromise[_0x9737('0x8f')]()['then'](function(){if(!_0x4b2a51){if(_0x100a05[_0x9737('0x3b')][_0x9737('0x74')])return;_0xac857c[_0x9737('0x75')](_0x9737('0x90'));_0x4d5cc4[_0x9737('0x75')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x100a05['user']['role']!==_0x9737('0x91'))return;return _0x100a05[_0x9737('0x92')][_0x9737('0x93')]({'attributes':['id'],'raw':!![]})[_0x9737('0x27')](function(_0xb10478){if(_['isEmpty'](_0xb10478)){_0xac857c[_0x9737('0x75')](_0x9737('0x94'));_0x4d5cc4[_0x9737('0x75')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0xac857c['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x9737('0x34')](_0xb10478,'id'));_0x4d5cc4[_0x9737('0x75')](_0x9737('0x76'),_['map'](_0xb10478,'id'));}});})['then'](function(){if(_0x100a05['user'][_0x9737('0x95')]===_0x9737('0x91')&&!_0x4b2a51&&!_0x100a05[_0x9737('0x3b')][_0x9737('0x74')])return[];return db['sequelize']['query'](_0xac857c[_0x9737('0x96')](),_0x58591f);})[_0x9737('0x27')](function(_0x2741b5){_0x5191dd['count']=_0x2741b5[_0x9737('0x5f')];if(_0x5191dd[_0x9737('0x21')]===0x0)return[];return db[_0x9737('0x97')][_0x9737('0x3b')](_0x119c6d[_0x9737('0x96')](),_0x58591f)[_0x9737('0x27')](function(_0xbf209c){_0x43a1b8=_['keyBy'](_0xbf209c,'id');_0x58591f=_['merge'](_0x58591f,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x100a05[_0x9737('0x3b')]['fields']){_0x4be868['attributes']['forEach'](function(_0xf43845){_0x4d5cc4['field']('i.'+_0xf43845);});}else{_0x4d5cc4[_0x9737('0x45')](_0x9737('0x8b'),_0x9737('0x5a'));_0x4d5cc4[_0x9737('0x45')](_0x9737('0x98'),'Account.key');_0x4d5cc4[_0x9737('0x45')](_0x9737('0x99'),_0x9737('0x9a'));_0x4d5cc4['field']('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x9737('0x8c'));_0x4d5cc4[_0x9737('0x45')](_0x9737('0x9b'));_0x4d5cc4[_0x9737('0x45')](_0x9737('0x9c'),_0x9737('0x9d'));_0x4d5cc4[_0x9737('0x45')]('c.lastName',_0x9737('0x9e'));_0x4d5cc4[_0x9737('0x45')](_0x9737('0x9f'),_0x9737('0xa0'));_0x4d5cc4[_0x9737('0x45')](_0x9737('0xa1'),_0x9737('0xa2'));_0x4d5cc4[_0x9737('0x45')]('c.mobile',_0x9737('0xa3'));_0x4d5cc4['field'](_0x9737('0xa4'),'Contact.fax');_0x4d5cc4['field']('o.fullname','Owner.fullname');_0x4d5cc4[_0x9737('0x45')](_0x9737('0xa5'),_0x9737('0xa6'));_0x4d5cc4[_0x9737('0x45')](_0x9737('0xa7'),_0x9737('0x2e'));}if(_0x4be868[_0x9737('0x20')])_0x4d5cc4[_0x9737('0x20')](_0x4be868[_0x9737('0x20')]);if(_0x4be868[_0x9737('0x1e')])_0x4d5cc4[_0x9737('0x1e')](_0x4be868[_0x9737('0x1e')]);return db['sequelize'][_0x9737('0x3b')](_0x4d5cc4[_0x9737('0x96')](),_0x58591f);})[_0x9737('0x27')](function(_0x587371){if(_0x587371[_0x9737('0x5f')]>0x0)_0x394e0e['where'](_0x9737('0xa8'),_['map'](_0x587371,'id'));return db[_0x9737('0x97')]['query'](_0x394e0e[_0x9737('0x96')](),_0x58591f)[_0x9737('0x27')](function(_0x31966d){var _0x439df2=_[_0x9737('0xa9')](_0x31966d,_0x9737('0xaa'));var _0x2a98aa=[];_0x587371[_0x9737('0x69')](function(_0x51255e){_0x2a98aa[_0x9737('0x31')](updateOpenchannelInteraction(_0x51255e,_0x43a1b8,_0x439df2));});return BPromise[_0x9737('0xab')](_0x2a98aa);});});})[_0x9737('0x27')](function(_0x5a696c){_0x5191dd[_0x9737('0xac')]=_0x5a696c;return _0x5191dd;})[_0x9737('0x27')](respondWithFilteredResult(_0x5ea8b6,_0x4be868))['catch'](handleError(_0x5ea8b6,null));};exports[_0x9737('0xad')]=function(_0xbd3cd9,_0x436600){var _0x469c79={};if(_0xbd3cd9[_0x9737('0x3b')][_0x9737('0x38')]&&_0xbd3cd9['query'][_0x9737('0x38')]==='from'){_0x469c79[_0x9737('0x4d')]=_0xbd3cd9[_0x9737('0xae')]['id'];}else{_0x469c79['id']=_0xbd3cd9[_0x9737('0xae')]['id'];}var _0x1a39d4={'raw':![],'where':_0x469c79},_0x2f1ec0={};_0x2f1ec0[_0x9737('0x3a')]=_[_0x9737('0xaf')](db[_0x9737('0x35')]['rawAttributes']);_0x2f1ec0['query']=_[_0x9737('0xaf')](_0xbd3cd9[_0x9737('0x3b')]);_0x2f1ec0[_0x9737('0x42')]=_[_0x9737('0x3c')](_0x2f1ec0[_0x9737('0x3a')],_0x2f1ec0[_0x9737('0x3b')]);_0x1a39d4[_0x9737('0x3d')]=_['intersection'](_0x2f1ec0['model'],qs[_0x9737('0x3e')](_0xbd3cd9[_0x9737('0x3b')][_0x9737('0x3e')]));_0x1a39d4[_0x9737('0x3d')]=_0x1a39d4[_0x9737('0x3d')][_0x9737('0x5f')]?_0x1a39d4['attributes']:_0x2f1ec0[_0x9737('0x3a')];if(_0xbd3cd9['query'][_0x9737('0xb0')]){_0x1a39d4[_0x9737('0xb1')]=[{'all':!![]}];}_0x1a39d4=_[_0x9737('0xb2')]({},_0x1a39d4,_0xbd3cd9[_0x9737('0xb3')]);return db[_0x9737('0x35')][_0x9737('0x63')](_0x1a39d4)[_0x9737('0x27')](handleEntityNotFound(_0x436600,null))[_0x9737('0x27')](respondWithResult(_0x436600,null))['catch'](handleError(_0x436600,null));};exports[_0x9737('0xb4')]=function(_0x5afbde,_0x2674ef){return db[_0x9737('0x35')]['create'](_0x5afbde[_0x9737('0x70')],{})['then'](respondWithResult(_0x2674ef,0xc9))['catch'](handleError(_0x2674ef,null));};exports[_0x9737('0x26')]=function(_0x1e5648,_0x1d95e8){if(_0x1e5648[_0x9737('0x70')]['id']){delete _0x1e5648[_0x9737('0x70')]['id'];}return db['OpenchannelInteraction'][_0x9737('0x63')]({'where':{'id':_0x1e5648[_0x9737('0xae')]['id']}})[_0x9737('0x27')](handleEntityNotFound(_0x1d95e8,null))['then'](saveUpdates(_0x1e5648[_0x9737('0x70')],null))[_0x9737('0x27')](respondWithResult(_0x1d95e8,null))[_0x9737('0x32')](handleError(_0x1d95e8,null));};exports['destroy']=function(_0x22854e,_0x24ce7d){return db[_0x9737('0x35')][_0x9737('0x63')]({'where':{'id':_0x22854e[_0x9737('0xae')]['id']}})[_0x9737('0x27')](handleEntityNotFound(_0x24ce7d,null))[_0x9737('0x27')](removeEntity(_0x24ce7d,null))[_0x9737('0x32')](handleError(_0x24ce7d,null));};exports[_0x9737('0xb5')]=function(_0x2dc394,_0x70bc47){return db['OpenchannelInteraction'][_0x9737('0xb5')]()[_0x9737('0x27')](respondWithResult(_0x70bc47,null))[_0x9737('0x32')](handleError(_0x70bc47,null));};exports[_0x9737('0xb6')]=function(_0x496d7d,_0x13f861,_0x8ea2e5){return db[_0x9737('0xb7')][_0x9737('0x63')]({'where':{'id':_0x496d7d[_0x9737('0xae')]['id']}})['then'](handleEntityNotFound(_0x13f861,null))[_0x9737('0x27')](function(_0x336d65){if(_0x336d65){return _0x336d65['addMessage'](_0x496d7d[_0x9737('0x70')]['ids'],_[_0x9737('0xb8')](_0x496d7d[_0x9737('0x70')],[_0x9737('0xb9'),'id'])||{});}})[_0x9737('0x27')](respondWithResult(_0x13f861,null))['catch'](handleError(_0x13f861,null));};exports[_0x9737('0xba')]=function(_0x294b88,_0x1a7cd9,_0x1ef4a9){var _0x3520ff={'raw':![],'where':{}};var _0x19de3f={};var _0x29d705={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x9737('0xbb')]({'where':{'id':_0x294b88[_0x9737('0xae')]['id']}})[_0x9737('0x27')](handleEntityNotFound(_0x1a7cd9,null))[_0x9737('0x27')](function(_0x27f33d){if(_0x27f33d){_0x19de3f[_0x9737('0x3a')]=_[_0x9737('0xaf')](db['OpenchannelMessage'][_0x9737('0x36')]);_0x19de3f[_0x9737('0x3b')]=_[_0x9737('0xaf')](_0x294b88['query']);_0x19de3f[_0x9737('0x42')]=_[_0x9737('0x3c')](_0x19de3f[_0x9737('0x3a')],_0x19de3f['query']);_0x3520ff['attributes']=_['intersection'](_0x19de3f['model'],qs[_0x9737('0x3e')](_0x294b88[_0x9737('0x3b')][_0x9737('0x3e')]));_0x3520ff[_0x9737('0x3d')]=_0x3520ff['attributes'][_0x9737('0x5f')]?_0x3520ff['attributes']:_0x19de3f['model'];if(!_0x294b88[_0x9737('0x3b')][_0x9737('0x3f')](_0x9737('0xbc'))){_0x3520ff[_0x9737('0x20')]=qs[_0x9737('0x20')](_0x294b88[_0x9737('0x3b')][_0x9737('0x20')]);_0x3520ff[_0x9737('0x1e')]=qs[_0x9737('0x1e')](_0x294b88[_0x9737('0x3b')][_0x9737('0x1e')]);}_0x3520ff[_0x9737('0x40')]=qs[_0x9737('0x41')](_0x294b88[_0x9737('0x3b')]['sort']);_0x3520ff[_0x9737('0x75')]=qs[_0x9737('0x42')](_[_0x9737('0x43')](_0x294b88[_0x9737('0x3b')],_0x19de3f[_0x9737('0x42')]));_0x3520ff[_0x9737('0x75')]['OpenchannelInteractionId']=_0x27f33d['id'];if(_0x294b88[_0x9737('0x3b')]['filter']){_0x3520ff[_0x9737('0x75')]=_[_0x9737('0xb2')](_0x3520ff['where'],{'$or':_[_0x9737('0x34')](_0x3520ff['attributes'],function(_0x81a2c7){var _0x2973eb={};_0x2973eb[_0x81a2c7]={'$like':'%'+_0x294b88[_0x9737('0x3b')]['filter']+'%'};return _0x2973eb;})});}if(_0x294b88[_0x9737('0x3b')][_0x9737('0x7a')]){var _0x402ae5=_0x294b88[_0x9737('0x3b')][_0x9737('0x7a')][_0x9737('0x30')](',');var _0x3482ac={};_0x3482ac[_0x402ae5[0x0]]={'$gte':moment(_0x402ae5[0x1])[_0x9737('0xbd')](_0x9737('0xbe'))};_0x3520ff[_0x9737('0x75')]=_[_0x9737('0xb2')](_0x3520ff[_0x9737('0x75')],_0x3482ac);}_0x3520ff=_[_0x9737('0xb2')]({},_0x3520ff,_0x294b88[_0x9737('0xb3')]);return db[_0x9737('0xb7')][_0x9737('0x21')]({'where':_0x3520ff[_0x9737('0x75')]})['then'](function(_0x1e2326){_0x29d705[_0x9737('0x21')]=_0x1e2326;if(_0x294b88[_0x9737('0x3b')][_0x9737('0xb0')]){_0x3520ff['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x9737('0xbf')](_0x3520ff);})[_0x9737('0x27')](function(_0x481a9c){_0x29d705[_0x9737('0xac')]=_0x481a9c;return _0x29d705;});}})[_0x9737('0x27')](respondWithFilteredResult(_0x1a7cd9,_0x3520ff))[_0x9737('0x32')](handleError(_0x1a7cd9,null));};exports[_0x9737('0xc0')]=function(_0x206165,_0xc4450d,_0x476a3a){return db[_0x9737('0x35')][_0x9737('0x63')]({'where':{'id':_0x206165[_0x9737('0xae')]['id']}})['then'](handleEntityNotFound(_0xc4450d,null))[_0x9737('0x27')](function(_0x2567ba){if(_0x2567ba){return _0x2567ba[_0x9737('0xc1')](_0x206165[_0x9737('0x70')][_0x9737('0xb9')],_[_0x9737('0xb8')](_0x206165[_0x9737('0x70')],[_0x9737('0xb9'),'id'])||{})[_0x9737('0xc2')](function(){return db['Tag'][_0x9737('0xbf')]({'attributes':['id','name',_0x9737('0x46')],'where':{'id':_0x206165[_0x9737('0x70')][_0x9737('0xb9')]}});})[_0x9737('0x27')](function(_0x61cb9){socket[_0x9737('0xc3')](_0x9737('0xc4'),{'id':Number(_0x206165[_0x9737('0xae')]['id']),'tags':_0x61cb9||[]});return{'id':Number(_0x206165[_0x9737('0xae')]['id']),'tags':_0x61cb9||[]};});}})[_0x9737('0x27')](respondWithResult(_0xc4450d,null))[_0x9737('0x32')](handleError(_0xc4450d,null));};exports[_0x9737('0xc5')]=function(_0x94098b,_0x195fab,_0x5e635a){return db[_0x9737('0x35')]['find']({'where':{'id':_0x94098b[_0x9737('0xae')]['id']}})['then'](handleEntityNotFound(_0x195fab,null))['then'](function(_0x1531f4){if(_0x1531f4){return _0x1531f4[_0x9737('0xc5')](_0x94098b[_0x9737('0x3b')][_0x9737('0xb9')]);}})[_0x9737('0x27')](respondWithStatusCode(_0x195fab,null))[_0x9737('0x32')](handleError(_0x195fab,null));};exports[_0x9737('0xc6')]=function(_0x37f115,_0x20a903){var _0x58f4cd=moment()[_0x9737('0xc7')]()[_0x9737('0x96')]();var _0x1681ee=path[_0x9737('0xc8')](config['root'],'server','files',_0x9737('0xc9'));var _0x27d6b1=path[_0x9737('0xc8')](config['root'],_0x9737('0xca'),_0x9737('0xcb'),'attachments');var _0x216018=path[_0x9737('0xc8')](_0x1681ee,_0x58f4cd);var _0x1b883c=util['format'](_0x9737('0xcc'),_0x37f115[_0x9737('0xae')]['id'],_0x58f4cd);var _0x354c2c=path['join'](_0x1681ee,_0x1b883c);var _0xeedbbf=[];_0xeedbbf[_0x9737('0x31')]({'model':db[_0x9737('0x6c')],'as':_0x9737('0x6c'),'attributes':['id',_0x9737('0x2d')],'raw':!![]});_0xeedbbf[_0x9737('0x31')]({'model':db['CmContact'],'as':_0x9737('0x5d'),'attributes':['id','firstName',_0x9737('0xcd')],'raw':!![]});if(_0x37f115[_0x9737('0x3b')][_0x9737('0xce')]){_0xeedbbf['push']({'model':db['Attachment'],'as':_0x9737('0xcf'),'raw':!![]});}var _0x257a5b=[{'model':db[_0x9737('0xb7')],'as':_0x9737('0xd0'),'attributes':['id',_0x9737('0x70'),_0x9737('0x78'),_0x9737('0xd1'),_0x9737('0xd2'),'read'],'include':_0xeedbbf}];_0x257a5b[_0x9737('0x31')]({'model':db[_0x9737('0xd3')],'as':_0x9737('0xd4'),'attributes':['id','name']});_0x257a5b[_0x9737('0x31')]({'model':db[_0x9737('0x6c')],'as':_0x9737('0xd5'),'attributes':['id',_0x9737('0x2d')]});return db['OpenchannelInteraction'][_0x9737('0x63')]({'where':{'id':_0x37f115[_0x9737('0xae')]['id']},'include':_0x257a5b})['then'](handleEntityNotFound(_0x20a903,null))[_0x9737('0x27')](function(_0x4edeee){if(_0x4edeee){var _0x4538f2=_0x4edeee[_0x9737('0xd6')]({'plain':!![]});fs[_0x9737('0xd7')](_0x216018);var _0x228d5f={'channel':_0x9737('0xd8'),'account':_0x4538f2[_0x9737('0xd4')]['name'],'agent':_0x4538f2['Owner']?_0x4538f2[_0x9737('0xd5')][_0x9737('0x2d')]:_0x9737('0xd9'),'createdAt':moment(_0x4538f2[_0x9737('0x78')])[_0x9737('0xbd')](_0x9737('0xbe'))[_0x9737('0x96')](),'closedAt':_0x4538f2[_0x9737('0xda')]?moment(_0x4538f2[_0x9737('0xdb')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9737('0x96')]():'','disposition':_0x4538f2[_0x9737('0xdc')],'visibility':_0x4538f2[_0x9737('0xdd')]?_0x9737('0xde'):_0x9737('0xdf'),'messages':_(_0x4538f2[_0x9737('0xd0')])['filter']({'secret':![]})['map'](function(_0x2b5b6){if(_0x2b5b6['Attachment']){var _0x1e32d1=path['join'](_0x27d6b1,_0x2b5b6[_0x9737('0xcf')][_0x9737('0xe0')]);if(fs['existsSync'](_0x1e32d1)){fs[_0x9737('0xe1')](_0x1e32d1)[_0x9737('0xe2')](fs[_0x9737('0xe3')](path[_0x9737('0xc8')](_0x216018,_0x2b5b6[_0x9737('0xcf')]['basename'])));}}return{'date':moment(_0x2b5b6[_0x9737('0x78')])[_0x9737('0xbd')](_0x9737('0xbe'))[_0x9737('0x96')](),'sender':_0x2b5b6[_0x9737('0xd1')]==='out'?_0x2b5b6['User']?_0x2b5b6[_0x9737('0x6c')][_0x9737('0x2d')]:'System':_0x2b5b6[_0x9737('0x5d')][_0x9737('0xe4')]+(_0x2b5b6[_0x9737('0x5d')]['lastName']?'\x20'+_0x2b5b6[_0x9737('0x5d')][_0x9737('0xcd')]:''),'body':_0x2b5b6[_0x9737('0xcf')]?_0x2b5b6[_0x9737('0xcf')][_0x9737('0xe0')]:_0x2b5b6[_0x9737('0x70')],'direction':_0x2b5b6[_0x9737('0xd1')]===_0x9737('0xe5')?'A':'C','secret':_0x2b5b6['secret'],'read':_0x2b5b6[_0x9737('0x7e')],'attachment':_0x2b5b6[_0x9737('0xcf')]};})['value']()};return ejs[_0x9737('0xe6')](path['join'](config[_0x9737('0xe7')],_0x9737('0xca'),'views',_0x9737('0xe8')),{'interaction':_0x228d5f})[_0x9737('0x27')](function(_0x500908){var _0x4e479d=path[_0x9737('0xc8')](_0x216018,'transcript-'+_0x4538f2['id']+'-'+_0x58f4cd+'.pdf');var _0x3097f8={'path':_0x4e479d,'channel':_0x9737('0xd8'),'interactionId':_0x4538f2['id']};return pdf['createPdfFromHTML'](_0x500908,_0x3097f8);})[_0x9737('0x27')](function(){return new BPromise(function(_0x455fa3,_0x112a89){zipdir(_0x216018,{'saveTo':_0x354c2c},function(_0x7ae629,_0xf5fc85){if(_0x7ae629)return _0x112a89(_0x7ae629);return _0x455fa3(_0xf5fc85);});})[_0x9737('0x27')](function(){return new BPromise(function(_0x2b9112,_0x290ca6){rimraf(_0x216018,function(_0x1e2e79){if(_0x1e2e79)_0x290ca6(_0x1e2e79);return _0x2b9112();});});})[_0x9737('0x27')](function(){return _0x20a903[_0x9737('0xc6')](_0x354c2c,_0x1b883c,function(_0x5b68d3){if(_0x5b68d3){console[_0x9737('0xe9')](_0x9737('0xea'),_0x5b68d3);}else{fs[_0x9737('0xeb')](_0x354c2c);}});});});}else{return _0x20a903[_0x9737('0x1b')](0xc8);}})[_0x9737('0x32')](handleError(_0x20a903,null));}; \ No newline at end of file +var _0xe3c3=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','select','field','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','start','body','keys','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','getOpenchannelAccounts','toString','sequelize','keyBy','merge','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','params','includeAll','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','format','include','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Messages','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','Private','Attachment','basename','createReadStream','pipe','direction','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x53a26c,_0x2bea90){var _0x5238c5=function(_0x2a7aa){while(--_0x2a7aa){_0x53a26c['push'](_0x53a26c['shift']());}};_0x5238c5(++_0x2bea90);}(_0xe3c3,0x1b6));var _0x3e3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3c3[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e3c('0x0'));var jsonpatch=require(_0x3e3c('0x1'));var rp=require(_0x3e3c('0x2'));var moment=require(_0x3e3c('0x3'));var BPromise=require(_0x3e3c('0x4'));var Mustache=require(_0x3e3c('0x5'));var util=require('util');var path=require(_0x3e3c('0x6'));var sox=require(_0x3e3c('0x7'));var csv=require(_0x3e3c('0x8'));var ejs=require(_0x3e3c('0x9'));var fs=require('fs');var fs_extra=require(_0x3e3c('0xa'));var _=require(_0x3e3c('0xb'));var squel=require(_0x3e3c('0xc'));var crypto=require(_0x3e3c('0xd'));var jsforce=require(_0x3e3c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3e3c('0x8'));var querystring=require(_0x3e3c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e3c('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x3e3c('0x11'));var hardwareService=require(_0x3e3c('0x12'));var logger=require(_0x3e3c('0x13'))(_0x3e3c('0x14'));var utils=require(_0x3e3c('0x15'));var config=require(_0x3e3c('0x16'));var licenseUtil=require(_0x3e3c('0x17'));var db=require(_0x3e3c('0x18'))['db'];config[_0x3e3c('0x19')]=_[_0x3e3c('0x1a')](config[_0x3e3c('0x19')],{'host':_0x3e3c('0x1b'),'port':0x18eb});var socket=require(_0x3e3c('0x1c'))(new Redis(config[_0x3e3c('0x19')]));require('./openchannelInteraction.socket')[_0x3e3c('0x1d')](socket);function respondWithStatusCode(_0x4fae5b,_0x36844b){_0x36844b=_0x36844b||0xcc;return function(_0x33f635){if(_0x33f635){return _0x4fae5b[_0x3e3c('0x1e')](_0x36844b);}return _0x4fae5b[_0x3e3c('0x1f')](_0x36844b)['end']();};}function respondWithResult(_0x4451c4,_0x97c315){_0x97c315=_0x97c315||0xc8;return function(_0x5f7999){if(_0x5f7999){return _0x4451c4[_0x3e3c('0x1f')](_0x97c315)[_0x3e3c('0x20')](_0x5f7999);}};}function respondWithFilteredResult(_0xa9611d,_0x35bea0){return function(_0x4aa2b3){if(_0x4aa2b3){var _0x5d3ace=typeof _0x35bea0[_0x3e3c('0x21')]===_0x3e3c('0x22')&&typeof _0x35bea0[_0x3e3c('0x23')]===_0x3e3c('0x22');var _0x56533=_0x4aa2b3['count'];var _0x5848ab=_0x5d3ace?0x0:_0x35bea0[_0x3e3c('0x21')];var _0x33ab09=_0x5d3ace?_0x4aa2b3[_0x3e3c('0x24')]:_0x35bea0[_0x3e3c('0x21')]+_0x35bea0[_0x3e3c('0x23')];var _0x467985;if(_0x33ab09>=_0x56533){_0x33ab09=_0x56533;_0x467985=0xc8;}else{_0x467985=0xce;}_0xa9611d[_0x3e3c('0x1f')](_0x467985);return _0xa9611d[_0x3e3c('0x25')](_0x3e3c('0x26'),_0x5848ab+'-'+_0x33ab09+'/'+_0x56533)['json'](_0x4aa2b3);}return null;};}function patchUpdates(_0x2fc788){return function(_0x369671){try{jsonpatch[_0x3e3c('0x27')](_0x369671,_0x2fc788,!![]);}catch(_0x2f74ab){return BPromise[_0x3e3c('0x28')](_0x2f74ab);}return _0x369671[_0x3e3c('0x29')]();};}function saveUpdates(_0x54eabe,_0x2a2614){return function(_0x3bd85c){if(_0x3bd85c){return _0x3bd85c['update'](_0x54eabe)[_0x3e3c('0x2a')](function(_0x3fdaf1){return _0x3fdaf1;});}return null;};}function removeEntity(_0x517153,_0x485dd3){return function(_0x3ebf24){if(_0x3ebf24){return _0x3ebf24[_0x3e3c('0x2b')]()[_0x3e3c('0x2a')](function(){_0x517153[_0x3e3c('0x1f')](0xcc)[_0x3e3c('0x2c')]();});}};}function handleEntityNotFound(_0x40f6eb,_0x316035){return function(_0x5270ae){if(!_0x5270ae){_0x40f6eb['sendStatus'](0x194);}return _0x5270ae;};}function handleError(_0x472d97,_0x3459a1){_0x3459a1=_0x3459a1||0x1f4;return function(_0x481965){logger[_0x3e3c('0x2d')](_0x481965[_0x3e3c('0x2e')]);if(_0x481965[_0x3e3c('0x2f')]){delete _0x481965[_0x3e3c('0x2f')];}_0x472d97[_0x3e3c('0x1f')](_0x3459a1)['send'](_0x481965);};}function getInteractionUsers(_0x34b682,_0x267687){return new BPromise(function(_0x12d67c,_0x529324){try{if(_0x267687[_0x34b682['id']]){_0x34b682[_0x3e3c('0x30')]=_[_0x3e3c('0x31')](_0x267687[_0x34b682['id']],function(_0x1d518c){return{'id':_0x1d518c['id'],'fullname':_0x1d518c[_0x3e3c('0x32')]};});}}catch(_0x3c3932){_0x529324(_0x3c3932);}_0x12d67c(_0x34b682);});}function getInteractionTags(_0x55e47c,_0x1e78bd){return new BPromise(function(_0x2fdb42,_0x17ce5b){try{if(_0x55e47c['TagIds']){_0x55e47c[_0x3e3c('0x33')]=[];_0x55e47c[_0x3e3c('0x34')][_0x3e3c('0x35')](',')[_0x3e3c('0x36')](function(_0x88c9f7){_0x55e47c[_0x3e3c('0x33')][_0x3e3c('0x37')](_0x1e78bd[_0x88c9f7]);});}delete _0x55e47c[_0x3e3c('0x34')];}catch(_0x3e4f98){_0x17ce5b(_0x3e4f98);}_0x2fdb42(_0x55e47c);});}function updateOpenchannelInteraction(_0x1b7128,_0x16024f,_0x4c75a2){return new BPromise(function(_0x400f4a,_0x573884){return getInteractionUsers(_0x1b7128,_0x4c75a2)[_0x3e3c('0x2a')](function(_0x27c948){return getInteractionTags(_0x27c948,_0x16024f);})['then'](function(_0x10ef42){_0x400f4a(_0x10ef42);})[_0x3e3c('0x38')](function(_0x412f56){_0x573884(_0x412f56);});});}exports['index']=function(_0x5b677a,_0x3e3df7){var _0x4f39cf={},_0x14ad9e={},_0x31fc97={'count':0x0,'rows':[]};var _0x1c8dcf=_[_0x3e3c('0x31')](db[_0x3e3c('0x39')][_0x3e3c('0x3a')],function(_0x15afac){return{'name':_0x15afac[_0x3e3c('0x3b')],'type':_0x15afac[_0x3e3c('0x3c')][_0x3e3c('0x3d')]};});_0x14ad9e[_0x3e3c('0x3e')]=_['map'](_0x1c8dcf,'name');_0x14ad9e[_0x3e3c('0x3f')]=_['keys'](_0x5b677a[_0x3e3c('0x3f')]);_0x14ad9e['filters']=_[_0x3e3c('0x40')](_0x14ad9e['model'],_0x14ad9e[_0x3e3c('0x3f')]);_0x4f39cf['attributes']=_[_0x3e3c('0x40')](_0x14ad9e[_0x3e3c('0x3e')],qs['fields'](_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x41')]));_0x4f39cf[_0x3e3c('0x42')]=_0x4f39cf[_0x3e3c('0x42')][_0x3e3c('0x43')]?_0x4f39cf['attributes']:_0x14ad9e[_0x3e3c('0x3e')];if(!_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x44')]('nolimit')){_0x4f39cf[_0x3e3c('0x23')]=qs['limit'](_0x5b677a['query'][_0x3e3c('0x23')]);_0x4f39cf[_0x3e3c('0x21')]=qs[_0x3e3c('0x21')](_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x21')]);}_0x4f39cf[_0x3e3c('0x45')]=qs[_0x3e3c('0x46')](_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x46')]);_0x4f39cf[_0x3e3c('0x47')]=qs[_0x3e3c('0x48')](_[_0x3e3c('0x49')](_0x5b677a[_0x3e3c('0x3f')],_0x14ad9e['filters']),_0x1c8dcf);var _0x5e4241=[];var _0x311c13=squel[_0x3e3c('0x4a')]()[_0x3e3c('0x4b')]('id')['field'](_0x3e3c('0x2f'))[_0x3e3c('0x4b')]('color')[_0x3e3c('0x4c')](_0x3e3c('0x4d'));var _0x31d990=squel[_0x3e3c('0x4a')]()[_0x3e3c('0x4b')]('u.id')[_0x3e3c('0x4b')](_0x3e3c('0x4e'))['field'](_0x3e3c('0x4f'))[_0x3e3c('0x4c')]('user_has_openchannel_interactions','ui')[_0x3e3c('0x50')]('users','u',_0x3e3c('0x51'));var _0x494dbb=squel[_0x3e3c('0x4a')]()[_0x3e3c('0x4c')](_0x3e3c('0x52'),'i')[_0x3e3c('0x50')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x3e3c('0x53'),'o',_0x3e3c('0x54'))['left_join'](_0x3e3c('0x55'),'a',_0x3e3c('0x56'))[_0x3e3c('0x50')]('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x3e3c('0x57'),'it',_0x3e3c('0x58'))['left_join'](_0x3e3c('0x4d'),'t',_0x3e3c('0x59'));var _0xf90be3=squel[_0x3e3c('0x5a')]();var _0x1357d9=[];var _0x4bae9b=squel[_0x3e3c('0x5a')]();var _0x5316ee;if(_0x5b677a[_0x3e3c('0x3f')]['search']){_0x5316ee=as[_0x3e3c('0x5b')](_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x5c')]);var _0x233a89=_0x5316ee['sqlOperator'];for(var _0x341a8c=0x0;_0x341a8c<_0x5316ee['conditions']['length'];_0x341a8c++){var _0xad9e19=_0x5316ee['conditions'][_0x341a8c];var _0x2970ea='i';var _0x1a66ee=_['find'](_0x1c8dcf,[_0x3e3c('0x2f'),_0xad9e19['field']]);if(!_0x1a66ee){switch(_0xad9e19[_0x3e3c('0x4b')]){case _0x3e3c('0x5d'):if(_0xad9e19['value']==0x1){_0x494dbb[_0x3e3c('0x5e')]('`'+_0xad9e19[_0x3e3c('0x4b')]+_0x3e3c('0x5f'));}else{_0x494dbb['having']('`'+_0xad9e19['field']+_0x3e3c('0x60'));}break;case _0x3e3c('0x61'):if(_0xad9e19[_0x3e3c('0x62')]===_0x3e3c('0x63')){if(_0xad9e19[_0x3e3c('0x64')][_0x3e3c('0x35')]('\x20')[_0x3e3c('0x43')]>0x1){_0xf90be3[_0x233a89]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xad9e19[_0x3e3c('0x64')]),null);}else{var _0x25c9a6='%'+_0xad9e19[_0x3e3c('0x64')]+'%';_0xf90be3[_0x233a89]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x25c9a6,_0x25c9a6,_0x25c9a6);}}else{_0x1a66ee=_[_0x3e3c('0x65')](_0x1c8dcf,[_0x3e3c('0x2f'),_0x3e3c('0x66')]);_0xad9e19[_0x3e3c('0x4b')]=_0x3e3c('0x66');_0x283dd=as[_0x3e3c('0x67')](_0x2970ea,_0x1a66ee[_0x3e3c('0x3c')],_0xad9e19);_0xf90be3[_0x233a89](_0x283dd[_0x3e3c('0x68')],_0x283dd[_0x3e3c('0x64')]['start'],_0x283dd[_0x3e3c('0x64')]['end']);}break;case _0x3e3c('0x69'):var _0x4510e1=_0xad9e19['value'][_0x3e3c('0x35')](',')[_0x3e3c('0x31')](function(_0x3c7b11){return Number(_0x3c7b11);});_0x4510e1[_0x3e3c('0x36')](function(_0x33c4f7){_0x4bae9b['or'](_0x3e3c('0x6a'),'%,'+_0x33c4f7+',%');});_0x1357d9=_[_0x3e3c('0x6b')](_0x1357d9,_0x4510e1);break;case _0x3e3c('0x6c'):if(_0xad9e19['operator']===_0x3e3c('0x63')){_0xf90be3[_0x233a89]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xad9e19[_0x3e3c('0x64')]+'%',null);}else{_0x1a66ee=_['find'](_0x1c8dcf,[_0x3e3c('0x2f'),_0x3e3c('0x6d')]);_0xad9e19[_0x3e3c('0x4b')]='UserId';_0x283dd=as[_0x3e3c('0x67')](_0x2970ea,_0x1a66ee[_0x3e3c('0x3c')],_0xad9e19);_0xf90be3[_0x233a89](_0x283dd['text'],_0x283dd[_0x3e3c('0x64')][_0x3e3c('0x6e')],_0x283dd[_0x3e3c('0x64')][_0x3e3c('0x2c')]);}break;case _0x3e3c('0x6f'):_0x283dd=as[_0x3e3c('0x67')]('me',null,_0xad9e19);_0xf90be3[_0x233a89](_0x283dd[_0x3e3c('0x68')],_0x283dd[_0x3e3c('0x64')][_0x3e3c('0x6e')],_0x283dd['value'][_0x3e3c('0x2c')]);break;}}else{var _0x283dd=as[_0x3e3c('0x67')](_0x2970ea,_0x1a66ee['type'],_0xad9e19);_0xf90be3[_0x233a89](_0x283dd[_0x3e3c('0x68')],_0x283dd['value']['start'],_0x283dd[_0x3e3c('0x64')]['end']);}}}else{var _0x430062=_(_0x5b677a['query'])[_0x3e3c('0x70')]()[_0x3e3c('0x31')](function(_0x12a97c){return _[_0x3e3c('0x71')](_0x1c8dcf,[_0x3e3c('0x2f'),_0x12a97c])?_0x12a97c:undefined;})[_0x3e3c('0x72')]()[_0x3e3c('0x64')]();if(!_[_0x3e3c('0x73')](_0x430062)){_0x430062[_0x3e3c('0x36')](function(_0xe4454f){if(_0xe4454f==='OpenchannelAccountId'){_0x494dbb[_0x3e3c('0x47')](_0x3e3c('0x74'),[][_0x3e3c('0x75')](_0x5b677a['query'][_0xe4454f]));}else if(_0xe4454f===_0x3e3c('0x76')){var _0x5244d6=JSON[_0x3e3c('0x77')](_0x5b677a[_0x3e3c('0x3f')][_0xe4454f])[_0x3e3c('0x78')];var _0x4fb987=JSON[_0x3e3c('0x77')](_0x5b677a[_0x3e3c('0x3f')][_0xe4454f])['$lte'];_0x494dbb['where'](_0x3e3c('0x79'),_0x5244d6,_0x4fb987);}else{if(_0x5b677a['query'][_0xe4454f]===_0x3e3c('0x7a')){_0x494dbb[_0x3e3c('0x47')]('i.'+_0xe4454f+'\x20IS\x20NULL');}else{_0x494dbb['where']('i.'+_0xe4454f+'\x20=\x20?',_0x5b677a[_0x3e3c('0x3f')][_0xe4454f]);}}});}if(_0x5b677a[_0x3e3c('0x3f')]['read']){if(_0x5b677a['query'][_0x3e3c('0x7b')]==0x1){_0x494dbb[_0x3e3c('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x494dbb[_0x3e3c('0x5e')](_0x3e3c('0x7c'));}}if(_0x5b677a[_0x3e3c('0x3f')]['tag']){_0x1357d9=_[_0x3e3c('0x7d')](_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x7e')])?_0x5b677a[_0x3e3c('0x3f')]['tag']:new Array(_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x7e')]);_0x1357d9[_0x3e3c('0x36')](function(_0x383dab){_0x4bae9b['or'](_0x3e3c('0x6a'),'%,'+_0x383dab+',%');});}if(_0x5b677a['query'][_0x3e3c('0x7f')]){var _0x49b99c=_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x7f')][_0x3e3c('0x80')]('\x5c','\x5c\x5c')[_0x3e3c('0x80')](/'/g,'\x27\x27');if(qs[_0x3e3c('0x81')](_0x49b99c)){_0xf90be3['or'](_0x3e3c('0x82'),_0x49b99c+'%');}else{_0xf90be3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3e3c('0x83')](_0x49b99c))['or'](_0x3e3c('0x84'),_0x49b99c+'%')['or'](_0x3e3c('0x85'),_0x49b99c+'%');}}}_0x494dbb[_0x3e3c('0x47')](_0xf90be3);_0x494dbb[_0x3e3c('0x86')]('i.id');var _0x7159a3={'type':db[_0x3e3c('0x87')][_0x3e3c('0x88')][_0x3e3c('0x89')],'raw':!![]};var _0x34a08e=_0x494dbb[_0x3e3c('0x8a')]();_0x34a08e['field'](_0x3e3c('0x8b'));_0x34a08e[_0x3e3c('0x4b')](_0x3e3c('0x8c'),_0x3e3c('0x5d'));if(_0x4f39cf['order']){_0x4f39cf[_0x3e3c('0x45')][_0x3e3c('0x36')](function(_0x54a83a){var _0x35c8d0=_0x54a83a[0x0]===_0x3e3c('0x8d')?_0x54a83a[0x0]:'i.'+_0x54a83a[0x0];_0x494dbb[_0x3e3c('0x45')](_0x35c8d0,_0x54a83a[0x1]===_0x3e3c('0x8e')?![]:!![]);});}if(!_[_0x3e3c('0x73')](_0x1357d9)){_0x494dbb['having'](_0x4bae9b);_0x34a08e[_0x3e3c('0x47')](_0x3e3c('0x8f'),_0x1357d9);}BPromise[_0x3e3c('0x90')]()['then'](function(){if(!_0x5316ee){if(_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x91')])return;_0x34a08e[_0x3e3c('0x47')](_0x3e3c('0x92'));_0x494dbb[_0x3e3c('0x47')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5b677a['user'][_0x3e3c('0x93')]!=='agent')return;return _0x5b677a[_0x3e3c('0x94')][_0x3e3c('0x95')]({'attributes':['id'],'raw':!![]})[_0x3e3c('0x2a')](function(_0x46f3f8){if(_[_0x3e3c('0x73')](_0x46f3f8)){_0x34a08e[_0x3e3c('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x494dbb[_0x3e3c('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x34a08e[_0x3e3c('0x47')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x46f3f8,'id'));_0x494dbb[_0x3e3c('0x47')](_0x3e3c('0x74'),_[_0x3e3c('0x31')](_0x46f3f8,'id'));}});})[_0x3e3c('0x2a')](function(){if(_0x5b677a[_0x3e3c('0x94')][_0x3e3c('0x93')]==='agent'&&!_0x5316ee&&!_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x91')])return[];return db['sequelize'][_0x3e3c('0x3f')](_0x34a08e[_0x3e3c('0x96')](),_0x7159a3);})['then'](function(_0x212997){_0x31fc97[_0x3e3c('0x24')]=_0x212997['length'];if(_0x31fc97[_0x3e3c('0x24')]===0x0)return[];return db[_0x3e3c('0x97')]['query'](_0x311c13[_0x3e3c('0x96')](),_0x7159a3)['then'](function(_0x26b556){_0x5e4241=_[_0x3e3c('0x98')](_0x26b556,'id');_0x7159a3=_[_0x3e3c('0x99')](_0x7159a3,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b677a[_0x3e3c('0x3f')][_0x3e3c('0x41')]){_0x4f39cf[_0x3e3c('0x42')]['forEach'](function(_0x53c3ab){_0x494dbb[_0x3e3c('0x4b')]('i.'+_0x53c3ab);});}else{_0x494dbb[_0x3e3c('0x4b')](_0x3e3c('0x8c'),'unreadMessages');_0x494dbb['field']('a.key','Account.key');_0x494dbb[_0x3e3c('0x4b')]('a.mandatoryDisposition',_0x3e3c('0x9a'));_0x494dbb[_0x3e3c('0x4b')]('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',_0x3e3c('0x8d'));_0x494dbb['field'](_0x3e3c('0x9b'));_0x494dbb[_0x3e3c('0x4b')](_0x3e3c('0x9c'),'Contact.firstName');_0x494dbb[_0x3e3c('0x4b')](_0x3e3c('0x9d'),_0x3e3c('0x9e'));_0x494dbb['field'](_0x3e3c('0x9f'),'Contact.email');_0x494dbb[_0x3e3c('0x4b')]('c.phone',_0x3e3c('0xa0'));_0x494dbb['field']('c.mobile',_0x3e3c('0xa1'));_0x494dbb['field'](_0x3e3c('0xa2'),_0x3e3c('0xa3'));_0x494dbb[_0x3e3c('0x4b')](_0x3e3c('0xa4'),_0x3e3c('0xa5'));_0x494dbb[_0x3e3c('0x4b')](_0x3e3c('0xa6'),_0x3e3c('0xa7'));_0x494dbb[_0x3e3c('0x4b')](_0x3e3c('0xa8'),_0x3e3c('0x34'));}if(_0x4f39cf[_0x3e3c('0x23')])_0x494dbb['limit'](_0x4f39cf[_0x3e3c('0x23')]);if(_0x4f39cf['offset'])_0x494dbb[_0x3e3c('0x21')](_0x4f39cf[_0x3e3c('0x21')]);return db['sequelize'][_0x3e3c('0x3f')](_0x494dbb['toString'](),_0x7159a3);})['then'](function(_0x5a5580){if(_0x5a5580[_0x3e3c('0x43')]>0x0)_0x31d990[_0x3e3c('0x47')](_0x3e3c('0xa9'),_[_0x3e3c('0x31')](_0x5a5580,'id'));return db[_0x3e3c('0x97')][_0x3e3c('0x3f')](_0x31d990[_0x3e3c('0x96')](),_0x7159a3)[_0x3e3c('0x2a')](function(_0x1b1da7){var _0x3e7cde=_['groupBy'](_0x1b1da7,_0x3e3c('0xaa'));var _0x4acaf6=[];_0x5a5580[_0x3e3c('0x36')](function(_0x55ebd7){_0x4acaf6[_0x3e3c('0x37')](updateOpenchannelInteraction(_0x55ebd7,_0x5e4241,_0x3e7cde));});return BPromise[_0x3e3c('0xab')](_0x4acaf6);});});})[_0x3e3c('0x2a')](function(_0x1ec7ab){_0x31fc97[_0x3e3c('0xac')]=_0x1ec7ab;return _0x31fc97;})[_0x3e3c('0x2a')](respondWithFilteredResult(_0x3e3df7,_0x4f39cf))['catch'](handleError(_0x3e3df7,null));};exports['show']=function(_0x2cf7cb,_0x581c36){var _0x4fa4da={};if(_0x2cf7cb['query']['type']&&_0x2cf7cb[_0x3e3c('0x3f')][_0x3e3c('0x3c')]==='from'){_0x4fa4da[_0x3e3c('0x4c')]=_0x2cf7cb[_0x3e3c('0xad')]['id'];}else{_0x4fa4da['id']=_0x2cf7cb[_0x3e3c('0xad')]['id'];}var _0x382397={'raw':![],'where':_0x4fa4da},_0x37ab85={};_0x37ab85[_0x3e3c('0x3e')]=_[_0x3e3c('0x70')](db[_0x3e3c('0x39')][_0x3e3c('0x3a')]);_0x37ab85['query']=_['keys'](_0x2cf7cb[_0x3e3c('0x3f')]);_0x37ab85[_0x3e3c('0x48')]=_[_0x3e3c('0x40')](_0x37ab85[_0x3e3c('0x3e')],_0x37ab85[_0x3e3c('0x3f')]);_0x382397[_0x3e3c('0x42')]=_['intersection'](_0x37ab85[_0x3e3c('0x3e')],qs[_0x3e3c('0x41')](_0x2cf7cb['query']['fields']));_0x382397[_0x3e3c('0x42')]=_0x382397[_0x3e3c('0x42')]['length']?_0x382397[_0x3e3c('0x42')]:_0x37ab85[_0x3e3c('0x3e')];if(_0x2cf7cb['query'][_0x3e3c('0xae')]){_0x382397['include']=[{'all':!![]}];}_0x382397=_[_0x3e3c('0x99')]({},_0x382397,_0x2cf7cb['options']);return db[_0x3e3c('0x39')][_0x3e3c('0x65')](_0x382397)[_0x3e3c('0x2a')](handleEntityNotFound(_0x581c36,null))['then'](respondWithResult(_0x581c36,null))[_0x3e3c('0x38')](handleError(_0x581c36,null));};exports[_0x3e3c('0xaf')]=function(_0x2a0be4,_0x40b718){return db['OpenchannelInteraction'][_0x3e3c('0xaf')](_0x2a0be4[_0x3e3c('0x6f')],{})[_0x3e3c('0x2a')](respondWithResult(_0x40b718,0xc9))[_0x3e3c('0x38')](handleError(_0x40b718,null));};exports['update']=function(_0x593b2c,_0xcf6473){if(_0x593b2c['body']['id']){delete _0x593b2c[_0x3e3c('0x6f')]['id'];}return db[_0x3e3c('0x39')][_0x3e3c('0x65')]({'where':{'id':_0x593b2c[_0x3e3c('0xad')]['id']}})[_0x3e3c('0x2a')](handleEntityNotFound(_0xcf6473,null))[_0x3e3c('0x2a')](saveUpdates(_0x593b2c['body'],null))[_0x3e3c('0x2a')](respondWithResult(_0xcf6473,null))['catch'](handleError(_0xcf6473,null));};exports[_0x3e3c('0x2b')]=function(_0x2ab1fe,_0x221dd4){return db[_0x3e3c('0x39')][_0x3e3c('0x65')]({'where':{'id':_0x2ab1fe[_0x3e3c('0xad')]['id']}})[_0x3e3c('0x2a')](handleEntityNotFound(_0x221dd4,null))[_0x3e3c('0x2a')](removeEntity(_0x221dd4,null))[_0x3e3c('0x38')](handleError(_0x221dd4,null));};exports[_0x3e3c('0xb0')]=function(_0x237e60,_0x2860cc){return db[_0x3e3c('0x39')][_0x3e3c('0xb0')]()[_0x3e3c('0x2a')](respondWithResult(_0x2860cc,null))['catch'](handleError(_0x2860cc,null));};exports[_0x3e3c('0xb1')]=function(_0x311718,_0x3534ad,_0x3d764b){return db[_0x3e3c('0xb2')][_0x3e3c('0x65')]({'where':{'id':_0x311718[_0x3e3c('0xad')]['id']}})[_0x3e3c('0x2a')](handleEntityNotFound(_0x3534ad,null))[_0x3e3c('0x2a')](function(_0x42567f){if(_0x42567f){return _0x42567f[_0x3e3c('0xb1')](_0x311718[_0x3e3c('0x6f')][_0x3e3c('0xb3')],_[_0x3e3c('0xb4')](_0x311718[_0x3e3c('0x6f')],['ids','id'])||{});}})['then'](respondWithResult(_0x3534ad,null))['catch'](handleError(_0x3534ad,null));};exports[_0x3e3c('0xb5')]=function(_0x1ab5fa,_0x21d3d6,_0x8a2acd){var _0x57786a={'raw':![],'where':{}};var _0x33e9a5={};var _0x3b2269={'count':0x0,'rows':[]};return db[_0x3e3c('0x39')][_0x3e3c('0xb6')]({'where':{'id':_0x1ab5fa[_0x3e3c('0xad')]['id']}})[_0x3e3c('0x2a')](handleEntityNotFound(_0x21d3d6,null))['then'](function(_0x2e9b68){if(_0x2e9b68){_0x33e9a5[_0x3e3c('0x3e')]=_['keys'](db['OpenchannelMessage'][_0x3e3c('0x3a')]);_0x33e9a5[_0x3e3c('0x3f')]=_[_0x3e3c('0x70')](_0x1ab5fa[_0x3e3c('0x3f')]);_0x33e9a5[_0x3e3c('0x48')]=_[_0x3e3c('0x40')](_0x33e9a5[_0x3e3c('0x3e')],_0x33e9a5['query']);_0x57786a['attributes']=_['intersection'](_0x33e9a5[_0x3e3c('0x3e')],qs['fields'](_0x1ab5fa['query']['fields']));_0x57786a[_0x3e3c('0x42')]=_0x57786a[_0x3e3c('0x42')][_0x3e3c('0x43')]?_0x57786a[_0x3e3c('0x42')]:_0x33e9a5[_0x3e3c('0x3e')];if(!_0x1ab5fa[_0x3e3c('0x3f')]['hasOwnProperty']('nolimit')){_0x57786a[_0x3e3c('0x23')]=qs['limit'](_0x1ab5fa['query']['limit']);_0x57786a[_0x3e3c('0x21')]=qs[_0x3e3c('0x21')](_0x1ab5fa[_0x3e3c('0x3f')][_0x3e3c('0x21')]);}_0x57786a[_0x3e3c('0x45')]=qs[_0x3e3c('0x46')](_0x1ab5fa[_0x3e3c('0x3f')][_0x3e3c('0x46')]);_0x57786a[_0x3e3c('0x47')]=qs['filters'](_[_0x3e3c('0x49')](_0x1ab5fa['query'],_0x33e9a5[_0x3e3c('0x48')]));_0x57786a[_0x3e3c('0x47')][_0x3e3c('0xaa')]=_0x2e9b68['id'];if(_0x1ab5fa[_0x3e3c('0x3f')][_0x3e3c('0x7f')]){_0x57786a[_0x3e3c('0x47')]=_['merge'](_0x57786a[_0x3e3c('0x47')],{'$or':_['map'](_0x57786a[_0x3e3c('0x42')],function(_0x49c7cc){var _0x454ab1={};_0x454ab1[_0x49c7cc]={'$like':'%'+_0x1ab5fa['query'][_0x3e3c('0x7f')]+'%'};return _0x454ab1;})});}if(_0x1ab5fa[_0x3e3c('0x3f')][_0x3e3c('0x78')]){var _0xb5b35a=_0x1ab5fa[_0x3e3c('0x3f')][_0x3e3c('0x78')][_0x3e3c('0x35')](',');var _0x55a18b={};_0x55a18b[_0xb5b35a[0x0]]={'$gte':moment(_0xb5b35a[0x1])[_0x3e3c('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x57786a[_0x3e3c('0x47')]=_['merge'](_0x57786a[_0x3e3c('0x47')],_0x55a18b);}_0x57786a=_['merge']({},_0x57786a,_0x1ab5fa['options']);return db[_0x3e3c('0xb2')][_0x3e3c('0x24')]({'where':_0x57786a[_0x3e3c('0x47')]})[_0x3e3c('0x2a')](function(_0x2f1d28){_0x3b2269['count']=_0x2f1d28;if(_0x1ab5fa[_0x3e3c('0x3f')]['includeAll']){_0x57786a[_0x3e3c('0xb8')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3e3c('0xb9')](_0x57786a);})[_0x3e3c('0x2a')](function(_0x5463ad){_0x3b2269[_0x3e3c('0xac')]=_0x5463ad;return _0x3b2269;});}})[_0x3e3c('0x2a')](respondWithFilteredResult(_0x21d3d6,_0x57786a))['catch'](handleError(_0x21d3d6,null));};exports[_0x3e3c('0xba')]=function(_0x1089b3,_0x3db84b,_0x4e4f5d){return db[_0x3e3c('0x39')][_0x3e3c('0x65')]({'where':{'id':_0x1089b3[_0x3e3c('0xad')]['id']}})['then'](handleEntityNotFound(_0x3db84b,null))['then'](function(_0x42e17d){if(_0x42e17d){return _0x42e17d[_0x3e3c('0xbb')](_0x1089b3[_0x3e3c('0x6f')][_0x3e3c('0xb3')],_['omit'](_0x1089b3[_0x3e3c('0x6f')],[_0x3e3c('0xb3'),'id'])||{})[_0x3e3c('0xbc')](function(){return db[_0x3e3c('0x69')][_0x3e3c('0xb9')]({'attributes':['id',_0x3e3c('0x2f'),'color'],'where':{'id':_0x1089b3[_0x3e3c('0x6f')][_0x3e3c('0xb3')]}});})[_0x3e3c('0x2a')](function(_0x37bbd2){socket[_0x3e3c('0xbd')](_0x3e3c('0xbe'),{'id':Number(_0x1089b3[_0x3e3c('0xad')]['id']),'tags':_0x37bbd2||[]});return{'id':Number(_0x1089b3[_0x3e3c('0xad')]['id']),'tags':_0x37bbd2||[]};});}})[_0x3e3c('0x2a')](respondWithResult(_0x3db84b,null))[_0x3e3c('0x38')](handleError(_0x3db84b,null));};exports[_0x3e3c('0xbf')]=function(_0x3095a3,_0x785ebc,_0x4ac4dc){return db['OpenchannelInteraction'][_0x3e3c('0x65')]({'where':{'id':_0x3095a3[_0x3e3c('0xad')]['id']}})[_0x3e3c('0x2a')](handleEntityNotFound(_0x785ebc,null))[_0x3e3c('0x2a')](function(_0x2bd5c8){if(_0x2bd5c8){return _0x2bd5c8[_0x3e3c('0xbf')](_0x3095a3['query'][_0x3e3c('0xb3')]);}})[_0x3e3c('0x2a')](respondWithStatusCode(_0x785ebc,null))[_0x3e3c('0x38')](handleError(_0x785ebc,null));};exports[_0x3e3c('0xc0')]=function(_0x33bc2b,_0x4b7806){var _0x4f02db=moment()[_0x3e3c('0xc1')]()[_0x3e3c('0x96')]();var _0x587e52=path[_0x3e3c('0xc2')](config[_0x3e3c('0xc3')],_0x3e3c('0xc4'),_0x3e3c('0xc5'),_0x3e3c('0xc6'));var _0xcb797=path[_0x3e3c('0xc2')](config[_0x3e3c('0xc3')],_0x3e3c('0xc4'),_0x3e3c('0xc5'),_0x3e3c('0xc7'));var _0x3529d5=path['join'](_0x587e52,_0x4f02db);var _0x3802da=util[_0x3e3c('0xb7')]('transcript-%d-%s.zip',_0x33bc2b['params']['id'],_0x4f02db);var _0x6bcfad=path[_0x3e3c('0xc2')](_0x587e52,_0x3802da);var _0x35cef9=[];_0x35cef9['push']({'model':db[_0x3e3c('0x6c')],'as':_0x3e3c('0x6c'),'attributes':['id',_0x3e3c('0x32')],'raw':!![]});_0x35cef9[_0x3e3c('0x37')]({'model':db[_0x3e3c('0xc8')],'as':_0x3e3c('0x61'),'attributes':['id',_0x3e3c('0xc9'),_0x3e3c('0xca')],'raw':!![]});if(_0x33bc2b['query'][_0x3e3c('0xc7')]){_0x35cef9[_0x3e3c('0x37')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x20daa7=[{'model':db[_0x3e3c('0xb2')],'as':_0x3e3c('0xcb'),'attributes':['id',_0x3e3c('0x6f'),'createdAt','direction',_0x3e3c('0xcc'),_0x3e3c('0x7b')],'include':_0x35cef9}];_0x20daa7['push']({'model':db[_0x3e3c('0xcd')],'as':_0x3e3c('0xce'),'attributes':['id',_0x3e3c('0x2f')]});_0x20daa7[_0x3e3c('0x37')]({'model':db[_0x3e3c('0x6c')],'as':_0x3e3c('0xcf'),'attributes':['id',_0x3e3c('0x32')]});return db[_0x3e3c('0x39')][_0x3e3c('0x65')]({'where':{'id':_0x33bc2b['params']['id']},'include':_0x20daa7})[_0x3e3c('0x2a')](handleEntityNotFound(_0x4b7806,null))[_0x3e3c('0x2a')](function(_0x2c280f){if(_0x2c280f){var _0x5ca169=_0x2c280f[_0x3e3c('0xd0')]({'plain':!![]});fs[_0x3e3c('0xd1')](_0x3529d5);var _0x3d8e8b={'channel':_0x3e3c('0xd2'),'account':_0x5ca169[_0x3e3c('0xce')][_0x3e3c('0x2f')],'agent':_0x5ca169[_0x3e3c('0xcf')]?_0x5ca169[_0x3e3c('0xcf')]['fullname']:_0x3e3c('0xd3'),'createdAt':moment(_0x5ca169[_0x3e3c('0x76')])['format'](_0x3e3c('0xd4'))['toString'](),'closedAt':_0x5ca169['closed']?moment(_0x5ca169['closedAt'])['format'](_0x3e3c('0xd4'))[_0x3e3c('0x96')]():'','disposition':_0x5ca169[_0x3e3c('0xd5')],'visibility':_0x5ca169[_0x3e3c('0xd6')]?_0x3e3c('0xd7'):_0x3e3c('0xd8'),'messages':_(_0x5ca169[_0x3e3c('0xcb')])[_0x3e3c('0x7f')]({'secret':![]})[_0x3e3c('0x31')](function(_0x1b32d1){if(_0x1b32d1[_0x3e3c('0xd9')]){var _0x43f1b7=path[_0x3e3c('0xc2')](_0xcb797,_0x1b32d1[_0x3e3c('0xd9')][_0x3e3c('0xda')]);if(fs['existsSync'](_0x43f1b7)){fs[_0x3e3c('0xdb')](_0x43f1b7)[_0x3e3c('0xdc')](fs['createWriteStream'](path[_0x3e3c('0xc2')](_0x3529d5,_0x1b32d1[_0x3e3c('0xd9')][_0x3e3c('0xda')])));}}return{'date':moment(_0x1b32d1[_0x3e3c('0x76')])[_0x3e3c('0xb7')](_0x3e3c('0xd4'))[_0x3e3c('0x96')](),'sender':_0x1b32d1[_0x3e3c('0xdd')]==='out'?_0x1b32d1[_0x3e3c('0x6c')]?_0x1b32d1[_0x3e3c('0x6c')][_0x3e3c('0x32')]:_0x3e3c('0xde'):_0x1b32d1[_0x3e3c('0x61')][_0x3e3c('0xc9')]+(_0x1b32d1['Contact'][_0x3e3c('0xca')]?'\x20'+_0x1b32d1[_0x3e3c('0x61')][_0x3e3c('0xca')]:''),'body':_0x1b32d1[_0x3e3c('0xd9')]?_0x1b32d1['Attachment'][_0x3e3c('0xda')]:_0x1b32d1['body'],'direction':_0x1b32d1[_0x3e3c('0xdd')]==='out'?'A':'C','secret':_0x1b32d1[_0x3e3c('0xcc')],'read':_0x1b32d1['read'],'attachment':_0x1b32d1[_0x3e3c('0xd9')]};})[_0x3e3c('0x64')]()};return ejs[_0x3e3c('0xdf')](path[_0x3e3c('0xc2')](config[_0x3e3c('0xc3')],_0x3e3c('0xc4'),'views',_0x3e3c('0xe0')),{'interaction':_0x3d8e8b})[_0x3e3c('0x2a')](function(_0x19950a){var _0x149ca8=path[_0x3e3c('0xc2')](_0x3529d5,_0x3e3c('0xe1')+_0x5ca169['id']+'-'+_0x4f02db+_0x3e3c('0xe2'));var _0x4418e3={'path':_0x149ca8,'channel':_0x3e3c('0xd2'),'interactionId':_0x5ca169['id']};return pdf[_0x3e3c('0xe3')](_0x19950a,_0x4418e3);})[_0x3e3c('0x2a')](function(){return new BPromise(function(_0x2dc9b6,_0x28dcf8){zipdir(_0x3529d5,{'saveTo':_0x6bcfad},function(_0x4f2638,_0x2423a6){if(_0x4f2638)return _0x28dcf8(_0x4f2638);return _0x2dc9b6(_0x2423a6);});})[_0x3e3c('0x2a')](function(){return new BPromise(function(_0x340abc,_0x2ba640){rimraf(_0x3529d5,function(_0x4fc12c){if(_0x4fc12c)_0x2ba640(_0x4fc12c);return _0x340abc();});});})[_0x3e3c('0x2a')](function(){return _0x4b7806['download'](_0x6bcfad,_0x3802da,function(_0x5787fc){if(_0x5787fc){console[_0x3e3c('0xe4')](_0x3e3c('0xe5'),_0x5787fc);}else{fs[_0x3e3c('0xe6')](_0x6bcfad);}});});});}else{return _0x4b7806[_0x3e3c('0x1e')](0xc8);}})[_0x3e3c('0x38')](handleError(_0x4b7806,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index dec736f..f621848 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 _0xc3c8=['then','setDataValue','Users','map','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xc3c8,0x117));var _0x8c3c=function(_0x42a5e4,_0x2ccfb6){_0x42a5e4=_0x42a5e4-0x0;var _0xd56657=_0xc3c8[_0x42a5e4];return _0xd56657;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x8c3c('0x0'))['db'][_0x8c3c('0x1')];var OpenchannelMessage=require(_0x8c3c('0x0'))['db'][_0x8c3c('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8c3c('0x3')](0x0);var events={'afterCreate':_0x8c3c('0x4'),'afterUpdate':_0x8c3c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x448b1d){return function(_0x159681,_0x5acd87,_0x44852f){_0x159681['getUsers']({'attributes':['id'],'raw':!![]})[_0x8c3c('0x6')](function(_0x381e33){_0x159681[_0x8c3c('0x7')](_0x8c3c('0x8'),_0x381e33[_0x8c3c('0x9')](function(_0x580320){return{'id':_0x580320['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x159681['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x444d8f){_0x159681[_0x8c3c('0x7')]('unreadMessages',_0x444d8f['length']);OpenchannelInteractionEvents['emit'](_0x448b1d+':'+_0x159681['id'],_0x159681);OpenchannelInteractionEvents[_0x8c3c('0xa')](_0x448b1d,_0x159681);_0x44852f(null);})[_0x8c3c('0xb')](_0x44852f(null));};}for(var e in events){if(events[_0x8c3c('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x8c3c('0xd')](e,emitEvent(event));}}module[_0x8c3c('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x9f19=['setDataValue','Users','unreadMessages','length','emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then'];(function(_0x3b79be,_0x479546){var _0x23bf08=function(_0x537836){while(--_0x537836){_0x3b79be['push'](_0x3b79be['shift']());}};_0x23bf08(++_0x479546);}(_0x9f19,0xd9));var _0x99f1=function(_0x39a6cc,_0x5eaf32){_0x39a6cc=_0x39a6cc-0x0;var _0x2ccef8=_0x9f19[_0x39a6cc];return _0x2ccef8;};'use strict';var EventEmitter=require(_0x99f1('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x99f1('0x1'))['db'][_0x99f1('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x99f1('0x3')](0x0);var events={'afterCreate':_0x99f1('0x4'),'afterUpdate':'update','afterDestroy':_0x99f1('0x5')};function emitEvent(_0x49a3c5){return function(_0x14d32c,_0x376a6d,_0x11b75c){_0x14d32c[_0x99f1('0x6')]({'attributes':['id'],'raw':!![]})[_0x99f1('0x7')](function(_0x376150){_0x14d32c[_0x99f1('0x8')](_0x99f1('0x9'),_0x376150['map'](function(_0x21884d){return{'id':_0x21884d['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x14d32c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x99f1('0x7')](function(_0x4ed00c){_0x14d32c['setDataValue'](_0x99f1('0xa'),_0x4ed00c[_0x99f1('0xb')]);OpenchannelInteractionEvents[_0x99f1('0xc')](_0x49a3c5+':'+_0x14d32c['id'],_0x14d32c);OpenchannelInteractionEvents[_0x99f1('0xc')](_0x49a3c5,_0x14d32c);_0x11b75c(null);})['catch'](_0x11b75c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x99f1('0xd')](e,emitEvent(event));}}module[_0x99f1('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 162856e..6f9dc0e 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 _0x7a83=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x7a83,0x1ca));var _0x37a8=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x7a83[_0x242a4f];return _0x122117;};'use strict';var _=require(_0x37a8('0x0'));var util=require(_0x37a8('0x1'));var logger=require('../../config/logger')(_0x37a8('0x2'));var moment=require(_0x37a8('0x3'));var BPromise=require(_0x37a8('0x4'));var rp=require(_0x37a8('0x5'));var fs=require('fs');var path=require(_0x37a8('0x6'));var rimraf=require(_0x37a8('0x7'));var config=require(_0x37a8('0x8'));var attributes=require(_0x37a8('0x9'));module[_0x37a8('0xa')]=function(_0x457009,_0x1f64b6){return _0x457009[_0x37a8('0xb')](_0x37a8('0xc'),attributes,{'tableName':_0x37a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28e41f,_0x51a910,_0x4c3947){if(_0x28e41f['changed'](_0x37a8('0xe'))){_0x28e41f[_0x37a8('0xf')]=moment()['format'](_0x37a8('0x10'));}_0x4c3947(null,_0x28e41f);}}});}; \ No newline at end of file +var _0xa095=['openchannel_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction'];(function(_0x5ddc05,_0x34459d){var _0x6d4d55=function(_0x5031f9){while(--_0x5031f9){_0x5ddc05['push'](_0x5ddc05['shift']());}};_0x6d4d55(++_0x34459d);}(_0xa095,0x7b));var _0x5a09=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0xa095[_0x16771d];return _0x386f11;};'use strict';var _=require(_0x5a09('0x0'));var util=require(_0x5a09('0x1'));var logger=require(_0x5a09('0x2'))(_0x5a09('0x3'));var moment=require(_0x5a09('0x4'));var BPromise=require(_0x5a09('0x5'));var rp=require(_0x5a09('0x6'));var fs=require('fs');var path=require(_0x5a09('0x7'));var rimraf=require(_0x5a09('0x8'));var config=require(_0x5a09('0x9'));var attributes=require(_0x5a09('0xa'));module['exports']=function(_0xdc755d,_0x5a73e7){return _0xdc755d[_0x5a09('0xb')](_0x5a09('0xc'),attributes,{'tableName':_0x5a09('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42c7ed,_0x2a5f9d,_0x1b694b){if(_0x42c7ed['changed']('closed')){_0x42c7ed[_0x5a09('0xe')]=moment()[_0x5a09('0xf')](_0x5a09('0x10'));}_0x1b694b(null,_0x42c7ed);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index a04ff62..04c3dfb 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 _0x159b=['body','options','raw','where','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update'];(function(_0xd16df9,_0x18db96){var _0x141b04=function(_0x5f44ad){while(--_0x5f44ad){_0xd16df9['push'](_0xd16df9['shift']());}};_0x141b04(++_0x18db96);}(_0x159b,0x8a));var _0xb159=function(_0x2d82f0,_0x2d3f22){_0x2d82f0=_0x2d82f0-0x0;var _0x3042d4=_0x159b[_0x2d82f0];return _0x3042d4;};'use strict';var _=require('lodash');var util=require(_0xb159('0x0'));var moment=require(_0xb159('0x1'));var BPromise=require(_0xb159('0x2'));var rs=require(_0xb159('0x3'));var fs=require('fs');var Redis=require(_0xb159('0x4'));var db=require(_0xb159('0x5'))['db'];var utils=require(_0xb159('0x6'));var logger=require(_0xb159('0x7'))(_0xb159('0x8'));var config=require(_0xb159('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb159('0xa')]({'port':0x232a});config[_0xb159('0xb')]=_[_0xb159('0xc')](config[_0xb159('0xb')],{'host':_0xb159('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb159('0xe'))[_0xb159('0xf')](socket);function respondWithRpcPromise(_0x3a0cff,_0x49ae29,_0xf0d776){return new BPromise(function(_0x43a96d,_0x172fdd){return client[_0xb159('0x10')](_0x3a0cff,_0xf0d776)[_0xb159('0x11')](function(_0x458c59){logger[_0xb159('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x49ae29,_0xb159('0x13'));logger[_0xb159('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x49ae29,_0xb159('0x13'),JSON[_0xb159('0x15')](_0x458c59));if(_0x458c59[_0xb159('0x16')]){if(_0x458c59[_0xb159('0x16')][_0xb159('0x17')]===0x1f4){logger['error'](_0xb159('0x18'),_0x49ae29,_0x458c59[_0xb159('0x16')][_0xb159('0x19')]);return _0x172fdd(_0x458c59['error'][_0xb159('0x19')]);}logger['error'](_0xb159('0x18'),_0x49ae29,_0x458c59[_0xb159('0x16')]['message']);return _0x43a96d(_0x458c59['error'][_0xb159('0x19')]);}else{logger[_0xb159('0x12')](_0xb159('0x18'),_0x49ae29,'request\x20sent');_0x43a96d(_0x458c59[_0xb159('0x1a')][_0xb159('0x19')]);}})['catch'](function(_0x285e71){logger[_0xb159('0x16')](_0xb159('0x18'),_0x49ae29,_0x285e71);_0x172fdd(_0x285e71);});});}exports[_0xb159('0x1b')]=function(_0x3c40d3){var _0x5ab847=this;return new Promise(function(_0x2cd1cd,_0x433a97){return db[_0xb159('0x1c')][_0xb159('0x1d')](_0x3c40d3[_0xb159('0x1e')],{'raw':_0x3c40d3[_0xb159('0x1f')]?_0x3c40d3['options'][_0xb159('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c40d3['options']?_0x3c40d3[_0xb159('0x1f')][_0xb159('0x21')]||null:null,'attributes':_0x3c40d3[_0xb159('0x1f')]?_0x3c40d3[_0xb159('0x1f')]['attributes']||null:null,'limit':_0x3c40d3['options']?_0x3c40d3[_0xb159('0x1f')][_0xb159('0x22')]||null:null})['then'](function(_0x488aeb){logger[_0xb159('0x12')](_0xb159('0x1b'),_0x3c40d3);logger[_0xb159('0x14')](_0xb159('0x1b'),_0x3c40d3,JSON[_0xb159('0x15')](_0x488aeb));_0x2cd1cd(_0x488aeb);})[_0xb159('0x23')](function(_0x2d7af8){logger[_0xb159('0x16')](_0xb159('0x1b'),_0x2d7af8[_0xb159('0x19')],_0x3c40d3);_0x433a97(_0x5ab847['error'](0x1f4,_0x2d7af8[_0xb159('0x19')]));});});};exports[_0xb159('0x24')]=function(_0x2b54b7){return new Promise(function(_0x368863,_0x513153){return db[_0xb159('0x1c')][_0xb159('0x25')]({'where':_0x2b54b7[_0xb159('0x1f')]?_0x2b54b7[_0xb159('0x1f')]['where']||null:null})[_0xb159('0x11')](function(_0x115ee2){if(_0x115ee2){return _0x115ee2[_0xb159('0x26')](_0x2b54b7['body']['ids'],_['omit'](_0x2b54b7['body'],[_0xb159('0x27'),'id'])||{});}})[_0xb159('0x28')](function(_0x5a3303){logger[_0xb159('0x12')](_0xb159('0x29'),_0x2b54b7);logger['debug'](_0xb159('0x29'),_0x2b54b7,JSON['stringify'](_0x5a3303));_0x368863(_0x5a3303);})[_0xb159('0x23')](function(_0x72a586){logger[_0xb159('0x16')](_0xb159('0x29'),_0x72a586['message'],_0x2b54b7);_0x513153(_this[_0xb159('0x16')](0x1f4,_0x72a586[_0xb159('0x19')]));});});}; \ No newline at end of file +var _0x2a89=['socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x3d38bd,_0xf83b34){var _0x52edc2=function(_0x15442d){while(--_0x15442d){_0x3d38bd['push'](_0x3d38bd['shift']());}};_0x52edc2(++_0xf83b34);}(_0x2a89,0xfb));var _0x92a8=function(_0x54e80e,_0x2c4c56){_0x54e80e=_0x54e80e-0x0;var _0xbe8ce8=_0x2a89[_0x54e80e];return _0xbe8ce8;};'use strict';var _=require(_0x92a8('0x0'));var util=require(_0x92a8('0x1'));var moment=require('moment');var BPromise=require(_0x92a8('0x2'));var rs=require(_0x92a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92a8('0x4'))['db'];var utils=require(_0x92a8('0x5'));var logger=require(_0x92a8('0x6'))(_0x92a8('0x7'));var config=require('../../config/environment');var jayson=require(_0x92a8('0x8'));var client=jayson[_0x92a8('0x9')]['http']({'port':0x232a});config[_0x92a8('0xa')]=_[_0x92a8('0xb')](config[_0x92a8('0xa')],{'host':_0x92a8('0xc'),'port':0x18eb});var socket=require(_0x92a8('0xd'))(new Redis(config[_0x92a8('0xa')]));require(_0x92a8('0xe'))[_0x92a8('0xf')](socket);function respondWithRpcPromise(_0x37f7e8,_0x32f4a7,_0x8a6535){return new BPromise(function(_0x1a5e8d,_0x1fef86){return client['request'](_0x37f7e8,_0x8a6535)[_0x92a8('0x10')](function(_0x4fc5f3){logger[_0x92a8('0x11')](_0x92a8('0x12'),_0x32f4a7,'request\x20sent');logger[_0x92a8('0x13')](_0x92a8('0x14'),_0x32f4a7,'request\x20sent',JSON[_0x92a8('0x15')](_0x4fc5f3));if(_0x4fc5f3[_0x92a8('0x16')]){if(_0x4fc5f3['error'][_0x92a8('0x17')]===0x1f4){logger[_0x92a8('0x16')](_0x92a8('0x12'),_0x32f4a7,_0x4fc5f3[_0x92a8('0x16')]['message']);return _0x1fef86(_0x4fc5f3['error'][_0x92a8('0x18')]);}logger[_0x92a8('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x32f4a7,_0x4fc5f3['error'][_0x92a8('0x18')]);return _0x1a5e8d(_0x4fc5f3[_0x92a8('0x16')][_0x92a8('0x18')]);}else{logger['info'](_0x92a8('0x12'),_0x32f4a7,_0x92a8('0x19'));_0x1a5e8d(_0x4fc5f3[_0x92a8('0x1a')][_0x92a8('0x18')]);}})[_0x92a8('0x1b')](function(_0x643454){logger[_0x92a8('0x16')](_0x92a8('0x12'),_0x32f4a7,_0x643454);_0x1fef86(_0x643454);});});}exports[_0x92a8('0x1c')]=function(_0x52395c){var _0x389df4=this;return new Promise(function(_0x4fcd3f,_0xf820c1){return db[_0x92a8('0x1d')][_0x92a8('0x1e')](_0x52395c[_0x92a8('0x1f')],{'raw':_0x52395c[_0x92a8('0x20')]?_0x52395c['options'][_0x92a8('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52395c[_0x92a8('0x20')]?_0x52395c[_0x92a8('0x20')][_0x92a8('0x22')]||null:null,'attributes':_0x52395c[_0x92a8('0x20')]?_0x52395c[_0x92a8('0x20')][_0x92a8('0x23')]||null:null,'limit':_0x52395c[_0x92a8('0x20')]?_0x52395c[_0x92a8('0x20')][_0x92a8('0x24')]||null:null})[_0x92a8('0x10')](function(_0x572b4c){logger['info'](_0x92a8('0x1c'),_0x52395c);logger['debug']('UpdateOpenchannelInteraction',_0x52395c,JSON['stringify'](_0x572b4c));_0x4fcd3f(_0x572b4c);})[_0x92a8('0x1b')](function(_0x32e218){logger[_0x92a8('0x16')](_0x92a8('0x1c'),_0x32e218[_0x92a8('0x18')],_0x52395c);_0xf820c1(_0x389df4[_0x92a8('0x16')](0x1f4,_0x32e218[_0x92a8('0x18')]));});});};exports[_0x92a8('0x25')]=function(_0x325885){return new Promise(function(_0x2c242b,_0xbf8e6d){return db[_0x92a8('0x1d')][_0x92a8('0x26')]({'where':_0x325885['options']?_0x325885['options'][_0x92a8('0x22')]||null:null})[_0x92a8('0x10')](function(_0xb7ed58){if(_0xb7ed58){return _0xb7ed58[_0x92a8('0x27')](_0x325885['body'][_0x92a8('0x28')],_[_0x92a8('0x29')](_0x325885[_0x92a8('0x1f')],[_0x92a8('0x28'),'id'])||{});}})[_0x92a8('0x2a')](function(_0x4c6aed){logger[_0x92a8('0x11')](_0x92a8('0x2b'),_0x325885);logger['debug'](_0x92a8('0x2b'),_0x325885,JSON[_0x92a8('0x15')](_0x4c6aed));_0x2c242b(_0x4c6aed);})[_0x92a8('0x1b')](function(_0x23d3c3){logger[_0x92a8('0x16')]('AddTags',_0x23d3c3['message'],_0x325885);_0xbf8e6d(_this[_0x92a8('0x16')](0x1f4,_0x23d3c3[_0x92a8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index d56c3d7..c521a0d 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 _0xd58f=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x57cb43,_0x15c142){var _0x4a2d40=function(_0x51a29b){while(--_0x51a29b){_0x57cb43['push'](_0x57cb43['shift']());}};_0x4a2d40(++_0x15c142);}(_0xd58f,0x132));var _0xfd58=function(_0x1fe75e,_0xa1ea15){_0x1fe75e=_0x1fe75e-0x0;var _0xc12009=_0xd58f[_0x1fe75e];return _0xc12009;};'use strict';var OpenchannelInteractionEvents=require(_0xfd58('0x0'));var events=[_0xfd58('0x1'),_0xfd58('0x2'),_0xfd58('0x3')];function createListener(_0x42a13f,_0x247d94){return function(_0x3756c0){_0x247d94[_0xfd58('0x4')](_0x42a13f,_0x3756c0);};}function removeListener(_0x4152c8,_0x5edf56){return function(){OpenchannelInteractionEvents[_0xfd58('0x5')](_0x4152c8,_0x5edf56);};}exports[_0xfd58('0x6')]=function(_0x4c8788){for(var _0x59edff=0x0,_0x3f323a=events['length'];_0x59edff<_0x3f323a;_0x59edff++){var _0x41d82f=events[_0x59edff];var _0x1aa9fa=createListener(_0xfd58('0x7')+_0x41d82f,_0x4c8788);OpenchannelInteractionEvents['on'](_0x41d82f,_0x1aa9fa);}}; \ No newline at end of file +var _0x5014=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x5014,0x70));var _0x4501=function(_0xd703d8,_0x549fb1){_0xd703d8=_0xd703d8-0x0;var _0x5c31f0=_0x5014[_0xd703d8];return _0x5c31f0;};'use strict';var OpenchannelInteractionEvents=require(_0x4501('0x0'));var events=[_0x4501('0x1'),_0x4501('0x2'),'update'];function createListener(_0x537937,_0x1bec4f){return function(_0x3851ed){_0x1bec4f['emit'](_0x537937,_0x3851ed);};}function removeListener(_0x526f7b,_0x3240cf){return function(){OpenchannelInteractionEvents['removeListener'](_0x526f7b,_0x3240cf);};}exports[_0x4501('0x3')]=function(_0x5ef2f3){for(var _0x31a190=0x0,_0x1871b3=events['length'];_0x31a190<_0x1871b3;_0x31a190++){var _0x3028bc=events[_0x31a190];var _0x5f2d5d=createListener(_0x4501('0x4')+_0x3028bc,_0x5ef2f3);OpenchannelInteractionEvents['on'](_0x3028bc,_0x5f2d5d);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 138442e..d6639e9 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x288f9a,_0x39b966){var _0x4a0168=function(_0x296b3e){while(--_0x296b3e){_0x288f9a['push'](_0x288f9a['shift']());}};_0x4a0168(++_0x39b966);}(_0xe706,0xa3));var _0x6e70=function(_0xa417ff,_0x2ab57c){_0xa417ff=_0xa417ff-0x0;var _0x2c0a82=_0xe706[_0xa417ff];return _0x2c0a82;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x289b5d,_0x216742){var _0x56bf8b=function(_0x3f64ae){while(--_0x3f64ae){_0x289b5d['push'](_0x289b5d['shift']());}};_0x56bf8b(++_0x216742);}(_0xe706,0xa3));var _0x6e70=function(_0xe90ec9,_0x29e6cc){_0xe90ec9=_0xe90ec9-0x0;var _0x1c10fc=_0xe706[_0xe90ec9];return _0x1c10fc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 77e515e..24f739a 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 _0x8130=['BOOLEAN','ENUM','out','STRING','sequelize','exports','medium'];(function(_0x5db503,_0x774ba9){var _0x14cd05=function(_0x40f838){while(--_0x40f838){_0x5db503['push'](_0x5db503['shift']());}};_0x14cd05(++_0x774ba9);}(_0x8130,0x146));var _0x0813=function(_0x13bafa,_0xbc78b){_0x13bafa=_0x13bafa-0x0;var _0x3af0aa=_0x8130[_0x13bafa];return _0x3af0aa;};'use strict';var Sequelize=require(_0x0813('0x0'));module[_0x0813('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0813('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0813('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0813('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0813('0x4')]('in',_0x0813('0x5')),'defaultValue':_0x0813('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x0813('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4b6c=['TEXT','sequelize','exports','medium','BOOLEAN','out','DATE'];(function(_0x51cd23,_0x273cbe){var _0x22f2c8=function(_0x515cd5){while(--_0x515cd5){_0x51cd23['push'](_0x51cd23['shift']());}};_0x22f2c8(++_0x273cbe);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4b6('0x0'));module[_0xc4b6('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc4b6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc4b6('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc4b6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc4b6('0x4')),'defaultValue':_0xc4b6('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc4b6('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc4b6('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e1d74bd..b1f90f0 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 _0xcaa8=['reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','ContactId','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','defaults','socket.io-emitter','redis','register','jayson/promise','client','http','request','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','end','stack','name','send','OpenchannelMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','destroy','describe','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','../../config/logger'];(function(_0x19df32,_0x469072){var _0x75b110=function(_0x5a150a){while(--_0x5a150a){_0x19df32['push'](_0x19df32['shift']());}};_0x75b110(++_0x469072);}(_0xcaa8,0x8e));var _0x8caa=function(_0x1f1794,_0x52cfdb){_0x1f1794=_0x1f1794-0x0;var _0x5a23d3=_0xcaa8[_0x1f1794];return _0x5a23d3;};'use strict';var emlformat=require(_0x8caa('0x0'));var rimraf=require(_0x8caa('0x1'));var zipdir=require(_0x8caa('0x2'));var jsonpatch=require(_0x8caa('0x3'));var rp=require(_0x8caa('0x4'));var moment=require(_0x8caa('0x5'));var BPromise=require(_0x8caa('0x6'));var Mustache=require('mustache');var util=require(_0x8caa('0x7'));var path=require(_0x8caa('0x8'));var sox=require(_0x8caa('0x9'));var csv=require('to-csv');var ejs=require(_0x8caa('0xa'));var fs=require('fs');var fs_extra=require(_0x8caa('0xb'));var _=require(_0x8caa('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8caa('0xd'));var deskjs=require(_0x8caa('0xe'));var toCsv=require(_0x8caa('0xf'));var querystring=require(_0x8caa('0x10'));var Papa=require(_0x8caa('0x11'));var Redis=require(_0x8caa('0x12'));var authService=require(_0x8caa('0x13'));var qs=require(_0x8caa('0x14'));var as=require(_0x8caa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8caa('0x16'));var utils=require(_0x8caa('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8caa('0x18'))['db'];config['redis']=_[_0x8caa('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8caa('0x1a'))(new Redis(config[_0x8caa('0x1b')]));require('./openchannelMessage.socket')[_0x8caa('0x1c')](socket);var jayson=require(_0x8caa('0x1d'));var client=jayson[_0x8caa('0x1e')][_0x8caa('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x8caa('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2228e6,_0x4dff5d,_0x5c803d,_0x31f4c0){return new BPromise(function(_0x33bda5,_0x51c280){var _0x507c5d=_0x31f4c0||client;return _0x507c5d[_0x8caa('0x20')](_0x2228e6,_0x5c803d)['then'](function(_0x160175){logger[_0x8caa('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x4dff5d,'request\x20sent');logger[_0x8caa('0x22')](_0x8caa('0x23'),_0x4dff5d,'request\x20sent',JSON['stringify'](_0x160175));if(_0x160175['error']){if(_0x160175[_0x8caa('0x24')][_0x8caa('0x25')]===0x1f4){logger[_0x8caa('0x24')](_0x8caa('0x26'),_0x4dff5d,_0x160175[_0x8caa('0x24')]['message']);return _0x51c280(_0x160175['error'][_0x8caa('0x27')]);}logger[_0x8caa('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x4dff5d,_0x160175[_0x8caa('0x24')][_0x8caa('0x27')]);return _0x33bda5(_0x160175[_0x8caa('0x24')]['message']);}else{logger[_0x8caa('0x21')](_0x8caa('0x26'),_0x4dff5d,_0x8caa('0x28'));_0x33bda5(_0x160175[_0x8caa('0x29')]['message']);}})[_0x8caa('0x2a')](function(_0x2af017){logger[_0x8caa('0x24')](_0x8caa('0x26'),_0x4dff5d,_0x2af017);_0x51c280(_0x2af017);});});}function respondWithStatusCode(_0x1b0660,_0x5ce322){_0x5ce322=_0x5ce322||0xcc;return function(_0x3bd91a){if(_0x3bd91a){return _0x1b0660[_0x8caa('0x2b')](_0x5ce322);}return _0x1b0660[_0x8caa('0x2c')](_0x5ce322)['end']();};}function respondWithResult(_0x5dae29,_0x60a043){_0x60a043=_0x60a043||0xc8;return function(_0x413d77){if(_0x413d77){return _0x5dae29[_0x8caa('0x2c')](_0x60a043)[_0x8caa('0x2d')](_0x413d77);}};}function respondWithFilteredResult(_0x4867c6,_0xa6de33){return function(_0x3c507e){if(_0x3c507e){var _0x6791f6=typeof _0xa6de33[_0x8caa('0x2e')]===_0x8caa('0x2f')&&typeof _0xa6de33[_0x8caa('0x30')]==='undefined';var _0x22307e=_0x3c507e[_0x8caa('0x31')];var _0x2b3929=_0x6791f6?0x0:_0xa6de33['offset'];var _0x4deeba=_0x6791f6?_0x3c507e[_0x8caa('0x31')]:_0xa6de33[_0x8caa('0x2e')]+_0xa6de33[_0x8caa('0x30')];var _0x1e408a;if(_0x4deeba>=_0x22307e){_0x4deeba=_0x22307e;_0x1e408a=0xc8;}else{_0x1e408a=0xce;}_0x4867c6[_0x8caa('0x2c')](_0x1e408a);return _0x4867c6['set'](_0x8caa('0x32'),_0x2b3929+'-'+_0x4deeba+'/'+_0x22307e)[_0x8caa('0x2d')](_0x3c507e);}return null;};}function patchUpdates(_0x5693b9){return function(_0x21da82){try{jsonpatch[_0x8caa('0x33')](_0x21da82,_0x5693b9,!![]);}catch(_0x14a529){return BPromise['reject'](_0x14a529);}return _0x21da82[_0x8caa('0x34')]();};}function saveUpdates(_0x12f783,_0xd83224){return function(_0x920d74){if(_0x920d74){return _0x920d74[_0x8caa('0x35')](_0x12f783)[_0x8caa('0x36')](function(_0x26e3ea){return _0x26e3ea;});}return null;};}function removeEntity(_0x27cf55,_0x5e8512){return function(_0xe487dd){if(_0xe487dd){return _0xe487dd['destroy']()[_0x8caa('0x36')](function(){_0x27cf55[_0x8caa('0x2c')](0xcc)[_0x8caa('0x37')]();});}};}function handleEntityNotFound(_0x37fc29,_0xda0918){return function(_0xeac0a0){if(!_0xeac0a0){_0x37fc29[_0x8caa('0x2b')](0x194);}return _0xeac0a0;};}function handleError(_0xccca2b,_0x3fda66){_0x3fda66=_0x3fda66||0x1f4;return function(_0x53bbe2){logger['error'](_0x53bbe2[_0x8caa('0x38')]);if(_0x53bbe2[_0x8caa('0x39')]){delete _0x53bbe2[_0x8caa('0x39')];}_0xccca2b[_0x8caa('0x2c')](_0x3fda66)[_0x8caa('0x3a')](_0x53bbe2);};}exports['index']=function(_0x2a3c83,_0x81d84){var _0xc8c30={},_0x3b9a76={},_0x5231b2={'count':0x0,'rows':[]};var _0xbc19d1=_['map'](db[_0x8caa('0x3b')][_0x8caa('0x3c')],function(_0x2ec2c9){return{'name':_0x2ec2c9[_0x8caa('0x3d')],'type':_0x2ec2c9[_0x8caa('0x3e')]['key']};});_0x3b9a76[_0x8caa('0x3f')]=_['map'](_0xbc19d1,'name');_0x3b9a76[_0x8caa('0x40')]=_['keys'](_0x2a3c83[_0x8caa('0x40')]);_0x3b9a76[_0x8caa('0x41')]=_[_0x8caa('0x42')](_0x3b9a76[_0x8caa('0x3f')],_0x3b9a76[_0x8caa('0x40')]);_0xc8c30[_0x8caa('0x43')]=_[_0x8caa('0x42')](_0x3b9a76[_0x8caa('0x3f')],qs[_0x8caa('0x44')](_0x2a3c83[_0x8caa('0x40')][_0x8caa('0x44')]));_0xc8c30[_0x8caa('0x43')]=_0xc8c30[_0x8caa('0x43')][_0x8caa('0x45')]?_0xc8c30['attributes']:_0x3b9a76[_0x8caa('0x3f')];if(!_0x2a3c83[_0x8caa('0x40')]['hasOwnProperty'](_0x8caa('0x46'))){_0xc8c30[_0x8caa('0x30')]=qs[_0x8caa('0x30')](_0x2a3c83[_0x8caa('0x40')][_0x8caa('0x30')]);_0xc8c30[_0x8caa('0x2e')]=qs[_0x8caa('0x2e')](_0x2a3c83['query']['offset']);}_0xc8c30[_0x8caa('0x47')]=qs['sort'](_0x2a3c83[_0x8caa('0x40')][_0x8caa('0x48')]);_0xc8c30[_0x8caa('0x49')]=qs[_0x8caa('0x41')](_[_0x8caa('0x4a')](_0x2a3c83[_0x8caa('0x40')],_0x3b9a76[_0x8caa('0x41')]),_0xbc19d1);if(_0x2a3c83['query']['filter']){_0xc8c30['where']=_['merge'](_0xc8c30['where'],{'$or':_[_0x8caa('0x4b')](_0xbc19d1,function(_0x523a12){if(_0x523a12[_0x8caa('0x3e')]!==_0x8caa('0x4c')){var _0x1653e5={};_0x1653e5[_0x523a12['name']]={'$like':'%'+_0x2a3c83[_0x8caa('0x40')][_0x8caa('0x4d')]+'%'};return _0x1653e5;}})});}_0xc8c30=_[_0x8caa('0x4e')]({},_0xc8c30,_0x2a3c83[_0x8caa('0x4f')]);var _0x43d782={'where':_0xc8c30['where']};return db[_0x8caa('0x3b')][_0x8caa('0x31')](_0x43d782)[_0x8caa('0x36')](function(_0x101d4f){_0x5231b2['count']=_0x101d4f;if(_0x2a3c83[_0x8caa('0x40')][_0x8caa('0x50')]){_0xc8c30[_0x8caa('0x51')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x8caa('0x52')](_0xc8c30);})[_0x8caa('0x36')](function(_0x20c8a0){_0x5231b2[_0x8caa('0x53')]=_0x20c8a0;return _0x5231b2;})['then'](respondWithFilteredResult(_0x81d84,_0xc8c30))[_0x8caa('0x2a')](handleError(_0x81d84,null));};exports[_0x8caa('0x54')]=function(_0x239fb6,_0xf19b19){var _0x402458={'raw':!![],'where':{'id':_0x239fb6[_0x8caa('0x55')]['id']}},_0x457300={};_0x457300[_0x8caa('0x3f')]=_[_0x8caa('0x56')](db[_0x8caa('0x3b')][_0x8caa('0x3c')]);_0x457300[_0x8caa('0x40')]=_[_0x8caa('0x56')](_0x239fb6['query']);_0x457300['filters']=_[_0x8caa('0x42')](_0x457300['model'],_0x457300[_0x8caa('0x40')]);_0x402458['attributes']=_[_0x8caa('0x42')](_0x457300['model'],qs[_0x8caa('0x44')](_0x239fb6['query'][_0x8caa('0x44')]));_0x402458[_0x8caa('0x43')]=_0x402458[_0x8caa('0x43')][_0x8caa('0x45')]?_0x402458[_0x8caa('0x43')]:_0x457300[_0x8caa('0x3f')];if(_0x239fb6[_0x8caa('0x40')][_0x8caa('0x50')]){_0x402458[_0x8caa('0x51')]=[{'all':!![]}];}_0x402458=_[_0x8caa('0x4e')]({},_0x402458,_0x239fb6[_0x8caa('0x4f')]);return db['OpenchannelMessage']['find'](_0x402458)['then'](handleEntityNotFound(_0xf19b19,null))[_0x8caa('0x36')](respondWithResult(_0xf19b19,null))[_0x8caa('0x2a')](handleError(_0xf19b19,null));};exports[_0x8caa('0x57')]=function(_0xd319cc,_0x74a706){return db[_0x8caa('0x3b')][_0x8caa('0x57')](_0xd319cc['body'],{})[_0x8caa('0x36')](respondWithResult(_0x74a706,0xc9))[_0x8caa('0x2a')](handleError(_0x74a706,null));};exports[_0x8caa('0x35')]=function(_0x2dbfd5,_0xdafffa){if(_0x2dbfd5[_0x8caa('0x58')]['id']){delete _0x2dbfd5['body']['id'];}return db[_0x8caa('0x3b')][_0x8caa('0x59')]({'where':{'id':_0x2dbfd5[_0x8caa('0x55')]['id']}})['then'](handleEntityNotFound(_0xdafffa,null))['then'](saveUpdates(_0x2dbfd5[_0x8caa('0x58')],null))[_0x8caa('0x36')](respondWithResult(_0xdafffa,null))[_0x8caa('0x2a')](handleError(_0xdafffa,null));};exports[_0x8caa('0x5a')]=function(_0x43683d,_0xfebf7){return db[_0x8caa('0x3b')][_0x8caa('0x59')]({'where':{'id':_0x43683d[_0x8caa('0x55')]['id']}})[_0x8caa('0x36')](handleEntityNotFound(_0xfebf7,null))['then'](removeEntity(_0xfebf7,null))[_0x8caa('0x2a')](handleError(_0xfebf7,null));};exports['describe']=function(_0x8153de,_0x3cffb6){return db['OpenchannelMessage'][_0x8caa('0x5b')]()['then'](respondWithResult(_0x3cffb6,null))[_0x8caa('0x2a')](handleError(_0x3cffb6,null));};var interaction_log=require('../../config/logger')(_0x8caa('0x5c'));exports['accept']=function(_0x5ddf30,_0x394ab6,_0x43f1e1){var _0x12d1c5={'agent':{},'channel':_0x8caa('0x5d')};if(_0x5ddf30[_0x8caa('0x58')]['id']){delete _0x5ddf30[_0x8caa('0x58')]['id'];}_0x5ddf30[_0x8caa('0x58')]['read']=!![];_0x5ddf30['body'][_0x8caa('0x5e')]=moment()[_0x8caa('0x5f')](_0x8caa('0x60'));_0x5ddf30[_0x8caa('0x58')][_0x8caa('0x61')]=_0x5ddf30['body'][_0x8caa('0x61')]||_0x5ddf30[_0x8caa('0x62')]['id'];_0x12d1c5['agent']['id']=_0x5ddf30[_0x8caa('0x58')][_0x8caa('0x61')];return db['OpenchannelMessage'][_0x8caa('0x59')]({'where':{'id':_0x5ddf30['params']['id'],'UserId':null}})[_0x8caa('0x36')](handleEntityNotFound(_0x394ab6,null))[_0x8caa('0x36')](saveUpdates(_0x5ddf30[_0x8caa('0x58')],null))['then'](function(_0x176b1e){if(_0x176b1e){_0x12d1c5[_0x8caa('0x27')]=_0x176b1e[_0x8caa('0x63')]({'plain':!![]});return db[_0x8caa('0x64')]['find']({'where':{'id':_0x176b1e[_0x8caa('0x65')]}});}return null;})[_0x8caa('0x36')](handleEntityNotFound(_0x394ab6,null))['then'](function(_0x1162a3){if(_0x1162a3){return _0x1162a3[_0x8caa('0x35')]({'UserId':_0x5ddf30[_0x8caa('0x58')][_0x8caa('0x61')],'read1stAt':_[_0x8caa('0x66')](_0x1162a3[_0x8caa('0x67')])?moment()['format'](_0x8caa('0x60')):undefined});}return null;})[_0x8caa('0x36')](function(_0x65c87d){if(_0x65c87d){_0x12d1c5[_0x8caa('0x68')]=_0x65c87d['get']({'plain':!![]});interaction_log['info'](_0x8caa('0x69'),_0x5ddf30['user']['id'],_0x5ddf30[_0x8caa('0x62')][_0x8caa('0x39')],_0x5ddf30[_0x8caa('0x62')][_0x8caa('0x6a')],_0x12d1c5['interaction']['id'],_0x5ddf30[_0x8caa('0x58')]?JSON[_0x8caa('0x6b')](_0x5ddf30[_0x8caa('0x58')]):'null');return respondWithRpcPromise(_0x8caa('0x6c'),'acceptMessage',_0x12d1c5);}return null;})[_0x8caa('0x36')](function(_0x401b09){var _0x2c67c7=_0x8caa('0x6d')+_0x401b09['message']['ContactId'];return db[_0x8caa('0x6e')][_0x8caa('0x40')](_0x2c67c7,{'type':db[_0x8caa('0x6f')][_0x8caa('0x70')][_0x8caa('0x71')],'raw':!![]})[_0x8caa('0x36')](function(_0x50f1fc){return _0x50f1fc;});})[_0x8caa('0x36')](function(_0x31d4d0){if(_0x31d4d0){_0x12d1c5['message'][_0x8caa('0x72')]=_0x31d4d0[0x0];if(!_0x5ddf30[_0x8caa('0x58')][_0x8caa('0x61')])return;return db[_0x8caa('0x73')][_0x8caa('0x59')]({'where':{'id':_0x5ddf30[_0x8caa('0x58')][_0x8caa('0x61')],'role':_0x8caa('0x74')},'attributes':['id','name',_0x8caa('0x75'),_0x8caa('0x76'),_0x8caa('0x77')],'raw':!![]});}return null;})[_0x8caa('0x36')](function(_0x792f68){if(!_0x792f68)return null;_0x12d1c5[_0x8caa('0x27')][_0x8caa('0x74')]=_0x792f68;return _0x12d1c5;})[_0x8caa('0x36')](function(_0x318e7e){if(_0x318e7e){if(_0x5ddf30[_0x8caa('0x58')][_0x8caa('0x78')]){_0x12d1c5[_0x8caa('0x27')][_0x8caa('0x79')]=util['format'](_0x8caa('0x7a'),_0x5ddf30[_0x8caa('0x62')][_0x8caa('0x39')]);_0x12d1c5['message']['channel']=_0x12d1c5[_0x8caa('0x7b')];_0x12d1c5[_0x8caa('0x27')]['event']=_0x8caa('0x7c');return respondWithRpcPromise('EventManager',_0x8caa('0x7d'),{'event':_0x8caa('0x7e'),'message':_0x12d1c5[_0x8caa('0x27')]},client9002)[_0x8caa('0x36')](function(){return _0x12d1c5;});}return _0x12d1c5;}return null;})[_0x8caa('0x36')](respondWithResult(_0x394ab6,null))[_0x8caa('0x2a')](handleError(_0x394ab6,null));};var interaction_log=require(_0x8caa('0x7f'))(_0x8caa('0x5c'));exports[_0x8caa('0x80')]=function(_0x2d219a,_0x1b8e25,_0x5eacc7){var _0x21ad23={'agent':{},'channel':_0x8caa('0x5d')};if(_0x2d219a['body']['id']){delete _0x2d219a['body']['id'];}_0x2d219a[_0x8caa('0x58')][_0x8caa('0x61')]=_0x2d219a[_0x8caa('0x58')][_0x8caa('0x61')]||_0x2d219a['user']['id'];_0x21ad23['agent']['id']=_0x2d219a[_0x8caa('0x58')][_0x8caa('0x61')];return db[_0x8caa('0x3b')][_0x8caa('0x59')]({'where':{'id':_0x2d219a[_0x8caa('0x55')]['id'],'UserId':null}})[_0x8caa('0x36')](handleEntityNotFound(_0x1b8e25,null))[_0x8caa('0x36')](function(_0x29de4a){if(_0x29de4a){_0x21ad23[_0x8caa('0x27')]=_0x29de4a[_0x8caa('0x63')]({'plain':!![]});return db[_0x8caa('0x64')][_0x8caa('0x59')]({'where':{'id':_0x29de4a[_0x8caa('0x65')]}});}return null;})[_0x8caa('0x36')](handleEntityNotFound(_0x1b8e25,null))[_0x8caa('0x36')](function(_0x46e3d4){if(_0x46e3d4){_0x21ad23[_0x8caa('0x68')]=_0x46e3d4['get']({'plain':!![]});interaction_log[_0x8caa('0x21')](_0x8caa('0x81'),_0x2d219a['user']['id'],_0x2d219a['user'][_0x8caa('0x39')],_0x2d219a['user'][_0x8caa('0x6a')],_0x21ad23[_0x8caa('0x68')]['id'],_0x2d219a['body']?JSON[_0x8caa('0x6b')](_0x2d219a['body']):_0x8caa('0x82'));return respondWithRpcPromise('RejectMessage',_0x8caa('0x83'),_0x21ad23);}return null;})['then'](function(_0x5c8ed4){var _0x5a197d=_0x8caa('0x6d')+_0x5c8ed4[_0x8caa('0x27')][_0x8caa('0x84')];return db[_0x8caa('0x6e')][_0x8caa('0x40')](_0x5a197d,{'type':db[_0x8caa('0x6f')][_0x8caa('0x70')][_0x8caa('0x71')],'raw':!![]})[_0x8caa('0x36')](function(_0x3ab3d1){return _0x3ab3d1;});})['then'](function(_0xb0a1b5){if(_0xb0a1b5){_0x21ad23[_0x8caa('0x27')][_0x8caa('0x72')]=_0xb0a1b5[0x0];if(!_0x2d219a['body'][_0x8caa('0x61')])return;return db[_0x8caa('0x73')][_0x8caa('0x59')]({'where':{'id':_0x2d219a[_0x8caa('0x58')]['UserId'],'role':_0x8caa('0x74')},'attributes':['id',_0x8caa('0x39'),_0x8caa('0x75'),'email',_0x8caa('0x77')],'raw':!![]});}return null;})[_0x8caa('0x36')](function(_0x12929c){if(!_0x12929c)return null;_0x21ad23[_0x8caa('0x27')][_0x8caa('0x74')]=_0x12929c;return _0x21ad23;})['then'](function(_0xc1d44c){if(_0xc1d44c){_0xc1d44c[_0x8caa('0x27')][_0x8caa('0x79')]=util['format'](_0x8caa('0x7a'),_0x2d219a[_0x8caa('0x62')][_0x8caa('0x39')]);_0xc1d44c[_0x8caa('0x27')]['channel']=_0x21ad23[_0x8caa('0x7b')];_0xc1d44c[_0x8caa('0x27')][_0x8caa('0x85')]=_0x8caa('0x80');respondWithRpcPromise('EventManager',_0x8caa('0x7d'),{'event':_0x8caa('0x86'),'message':_0xc1d44c['message']},client9002);return _0x21ad23;}return null;})['then'](respondWithResult(_0x1b8e25,null))[_0x8caa('0x2a')](handleError(_0x1b8e25,null));}; \ No newline at end of file +var _0xdd03=['OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','describe','../../config/logger','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','ContactId','sequelize','QueryTypes','User','agent','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','contact','interface','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info'];(function(_0x3a0a6d,_0x5a718d){var _0x3677ac=function(_0x4a3512){while(--_0x4a3512){_0x3a0a6d['push'](_0x3a0a6d['shift']());}};_0x3677ac(++_0x5a718d);}(_0xdd03,0x165));var _0x3dd0=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdd03[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3dd0('0x0'));var jsonpatch=require(_0x3dd0('0x1'));var rp=require(_0x3dd0('0x2'));var moment=require(_0x3dd0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3dd0('0x4'));var path=require(_0x3dd0('0x5'));var sox=require(_0x3dd0('0x6'));var csv=require('to-csv');var ejs=require(_0x3dd0('0x7'));var fs=require('fs');var fs_extra=require(_0x3dd0('0x8'));var _=require(_0x3dd0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3dd0('0xa'));var deskjs=require(_0x3dd0('0xb'));var toCsv=require(_0x3dd0('0xc'));var querystring=require('querystring');var Papa=require(_0x3dd0('0xd'));var Redis=require(_0x3dd0('0xe'));var authService=require(_0x3dd0('0xf'));var qs=require(_0x3dd0('0x10'));var as=require(_0x3dd0('0x11'));var hardwareService=require(_0x3dd0('0x12'));var logger=require('../../config/logger')(_0x3dd0('0x13'));var utils=require('../../config/utils');var config=require(_0x3dd0('0x14'));var licenseUtil=require(_0x3dd0('0x15'));var db=require(_0x3dd0('0x16'))['db'];config[_0x3dd0('0x17')]=_[_0x3dd0('0x18')](config[_0x3dd0('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3dd0('0x19'))(new Redis(config[_0x3dd0('0x17')]));require(_0x3dd0('0x1a'))[_0x3dd0('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3dd0('0x1c')][_0x3dd0('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x3dd0('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3c525d,_0x814793,_0x452643,_0x17a8c5){return new BPromise(function(_0x2049b8,_0x64edcb){var _0x1be67a=_0x17a8c5||client;return _0x1be67a[_0x3dd0('0x1e')](_0x3c525d,_0x452643)[_0x3dd0('0x1f')](function(_0x5aad3d){logger[_0x3dd0('0x20')](_0x3dd0('0x21'),_0x814793,_0x3dd0('0x22'));logger['debug'](_0x3dd0('0x23'),_0x814793,_0x3dd0('0x22'),JSON[_0x3dd0('0x24')](_0x5aad3d));if(_0x5aad3d['error']){if(_0x5aad3d['error'][_0x3dd0('0x25')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x814793,_0x5aad3d['error']['message']);return _0x64edcb(_0x5aad3d[_0x3dd0('0x26')][_0x3dd0('0x27')]);}logger[_0x3dd0('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x814793,_0x5aad3d['error']['message']);return _0x2049b8(_0x5aad3d[_0x3dd0('0x26')][_0x3dd0('0x27')]);}else{logger[_0x3dd0('0x20')](_0x3dd0('0x21'),_0x814793,_0x3dd0('0x22'));_0x2049b8(_0x5aad3d[_0x3dd0('0x28')][_0x3dd0('0x27')]);}})[_0x3dd0('0x29')](function(_0x56a37c){logger['error'](_0x3dd0('0x21'),_0x814793,_0x56a37c);_0x64edcb(_0x56a37c);});});}function respondWithStatusCode(_0x519101,_0x221642){_0x221642=_0x221642||0xcc;return function(_0x3babca){if(_0x3babca){return _0x519101[_0x3dd0('0x2a')](_0x221642);}return _0x519101[_0x3dd0('0x2b')](_0x221642)['end']();};}function respondWithResult(_0x375571,_0x393050){_0x393050=_0x393050||0xc8;return function(_0x5de894){if(_0x5de894){return _0x375571['status'](_0x393050)['json'](_0x5de894);}};}function respondWithFilteredResult(_0x1554d0,_0x536747){return function(_0x1b74fe){if(_0x1b74fe){var _0x5b1741=typeof _0x536747[_0x3dd0('0x2c')]===_0x3dd0('0x2d')&&typeof _0x536747[_0x3dd0('0x2e')]===_0x3dd0('0x2d');var _0x3d0fa6=_0x1b74fe[_0x3dd0('0x2f')];var _0x452406=_0x5b1741?0x0:_0x536747['offset'];var _0x33964e=_0x5b1741?_0x1b74fe[_0x3dd0('0x2f')]:_0x536747['offset']+_0x536747[_0x3dd0('0x2e')];var _0x2abfce;if(_0x33964e>=_0x3d0fa6){_0x33964e=_0x3d0fa6;_0x2abfce=0xc8;}else{_0x2abfce=0xce;}_0x1554d0[_0x3dd0('0x2b')](_0x2abfce);return _0x1554d0[_0x3dd0('0x30')](_0x3dd0('0x31'),_0x452406+'-'+_0x33964e+'/'+_0x3d0fa6)[_0x3dd0('0x32')](_0x1b74fe);}return null;};}function patchUpdates(_0x4404c2){return function(_0x580a32){try{jsonpatch[_0x3dd0('0x33')](_0x580a32,_0x4404c2,!![]);}catch(_0x5a7007){return BPromise[_0x3dd0('0x34')](_0x5a7007);}return _0x580a32[_0x3dd0('0x35')]();};}function saveUpdates(_0x5ee68b,_0x3c400f){return function(_0x5523a1){if(_0x5523a1){return _0x5523a1[_0x3dd0('0x36')](_0x5ee68b)[_0x3dd0('0x1f')](function(_0x4da40b){return _0x4da40b;});}return null;};}function removeEntity(_0x3be65a,_0x36cf9b){return function(_0x50f1de){if(_0x50f1de){return _0x50f1de[_0x3dd0('0x37')]()[_0x3dd0('0x1f')](function(){_0x3be65a[_0x3dd0('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29cde7,_0x48e776){return function(_0x2b6b18){if(!_0x2b6b18){_0x29cde7[_0x3dd0('0x2a')](0x194);}return _0x2b6b18;};}function handleError(_0x30a973,_0x6b478f){_0x6b478f=_0x6b478f||0x1f4;return function(_0x454f2e){logger[_0x3dd0('0x26')](_0x454f2e[_0x3dd0('0x38')]);if(_0x454f2e[_0x3dd0('0x39')]){delete _0x454f2e['name'];}_0x30a973[_0x3dd0('0x2b')](_0x6b478f)[_0x3dd0('0x3a')](_0x454f2e);};}exports[_0x3dd0('0x3b')]=function(_0x5a1fb9,_0x5ae968){var _0x8be0c4={},_0x4c46df={},_0x17fa3b={'count':0x0,'rows':[]};var _0x1d6692=_[_0x3dd0('0x3c')](db[_0x3dd0('0x3d')][_0x3dd0('0x3e')],function(_0x4e818a){return{'name':_0x4e818a[_0x3dd0('0x3f')],'type':_0x4e818a[_0x3dd0('0x40')][_0x3dd0('0x41')]};});_0x4c46df[_0x3dd0('0x42')]=_['map'](_0x1d6692,_0x3dd0('0x39'));_0x4c46df[_0x3dd0('0x43')]=_[_0x3dd0('0x44')](_0x5a1fb9[_0x3dd0('0x43')]);_0x4c46df[_0x3dd0('0x45')]=_[_0x3dd0('0x46')](_0x4c46df[_0x3dd0('0x42')],_0x4c46df[_0x3dd0('0x43')]);_0x8be0c4[_0x3dd0('0x47')]=_['intersection'](_0x4c46df[_0x3dd0('0x42')],qs[_0x3dd0('0x48')](_0x5a1fb9[_0x3dd0('0x43')][_0x3dd0('0x48')]));_0x8be0c4[_0x3dd0('0x47')]=_0x8be0c4['attributes'][_0x3dd0('0x49')]?_0x8be0c4[_0x3dd0('0x47')]:_0x4c46df['model'];if(!_0x5a1fb9[_0x3dd0('0x43')][_0x3dd0('0x4a')](_0x3dd0('0x4b'))){_0x8be0c4[_0x3dd0('0x2e')]=qs[_0x3dd0('0x2e')](_0x5a1fb9[_0x3dd0('0x43')][_0x3dd0('0x2e')]);_0x8be0c4[_0x3dd0('0x2c')]=qs[_0x3dd0('0x2c')](_0x5a1fb9[_0x3dd0('0x43')][_0x3dd0('0x2c')]);}_0x8be0c4['order']=qs[_0x3dd0('0x4c')](_0x5a1fb9['query'][_0x3dd0('0x4c')]);_0x8be0c4[_0x3dd0('0x4d')]=qs['filters'](_[_0x3dd0('0x4e')](_0x5a1fb9[_0x3dd0('0x43')],_0x4c46df[_0x3dd0('0x45')]),_0x1d6692);if(_0x5a1fb9[_0x3dd0('0x43')][_0x3dd0('0x4f')]){_0x8be0c4[_0x3dd0('0x4d')]=_[_0x3dd0('0x50')](_0x8be0c4[_0x3dd0('0x4d')],{'$or':_[_0x3dd0('0x3c')](_0x1d6692,function(_0x9a7480){if(_0x9a7480[_0x3dd0('0x40')]!==_0x3dd0('0x51')){var _0x367dcd={};_0x367dcd[_0x9a7480[_0x3dd0('0x39')]]={'$like':'%'+_0x5a1fb9[_0x3dd0('0x43')][_0x3dd0('0x4f')]+'%'};return _0x367dcd;}})});}_0x8be0c4=_[_0x3dd0('0x50')]({},_0x8be0c4,_0x5a1fb9[_0x3dd0('0x52')]);var _0x12a083={'where':_0x8be0c4['where']};return db[_0x3dd0('0x3d')][_0x3dd0('0x2f')](_0x12a083)['then'](function(_0x2fdc7e){_0x17fa3b[_0x3dd0('0x2f')]=_0x2fdc7e;if(_0x5a1fb9['query'][_0x3dd0('0x53')]){_0x8be0c4[_0x3dd0('0x54')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3dd0('0x55')](_0x8be0c4);})[_0x3dd0('0x1f')](function(_0x1f5221){_0x17fa3b['rows']=_0x1f5221;return _0x17fa3b;})['then'](respondWithFilteredResult(_0x5ae968,_0x8be0c4))[_0x3dd0('0x29')](handleError(_0x5ae968,null));};exports[_0x3dd0('0x56')]=function(_0x2ae5a6,_0x3b6eea){var _0x25ab0b={'raw':!![],'where':{'id':_0x2ae5a6[_0x3dd0('0x57')]['id']}},_0x298cfc={};_0x298cfc[_0x3dd0('0x42')]=_[_0x3dd0('0x44')](db[_0x3dd0('0x3d')][_0x3dd0('0x3e')]);_0x298cfc[_0x3dd0('0x43')]=_[_0x3dd0('0x44')](_0x2ae5a6[_0x3dd0('0x43')]);_0x298cfc[_0x3dd0('0x45')]=_[_0x3dd0('0x46')](_0x298cfc['model'],_0x298cfc[_0x3dd0('0x43')]);_0x25ab0b['attributes']=_[_0x3dd0('0x46')](_0x298cfc[_0x3dd0('0x42')],qs[_0x3dd0('0x48')](_0x2ae5a6[_0x3dd0('0x43')][_0x3dd0('0x48')]));_0x25ab0b[_0x3dd0('0x47')]=_0x25ab0b['attributes']['length']?_0x25ab0b[_0x3dd0('0x47')]:_0x298cfc[_0x3dd0('0x42')];if(_0x2ae5a6[_0x3dd0('0x43')][_0x3dd0('0x53')]){_0x25ab0b['include']=[{'all':!![]}];}_0x25ab0b=_[_0x3dd0('0x50')]({},_0x25ab0b,_0x2ae5a6['options']);return db[_0x3dd0('0x3d')][_0x3dd0('0x58')](_0x25ab0b)['then'](handleEntityNotFound(_0x3b6eea,null))[_0x3dd0('0x1f')](respondWithResult(_0x3b6eea,null))[_0x3dd0('0x29')](handleError(_0x3b6eea,null));};exports['create']=function(_0xa498ed,_0x92df32){return db[_0x3dd0('0x3d')]['create'](_0xa498ed[_0x3dd0('0x59')],{})[_0x3dd0('0x1f')](respondWithResult(_0x92df32,0xc9))[_0x3dd0('0x29')](handleError(_0x92df32,null));};exports['update']=function(_0x38fab4,_0x584616){if(_0x38fab4[_0x3dd0('0x59')]['id']){delete _0x38fab4[_0x3dd0('0x59')]['id'];}return db[_0x3dd0('0x3d')][_0x3dd0('0x58')]({'where':{'id':_0x38fab4[_0x3dd0('0x57')]['id']}})[_0x3dd0('0x1f')](handleEntityNotFound(_0x584616,null))[_0x3dd0('0x1f')](saveUpdates(_0x38fab4[_0x3dd0('0x59')],null))[_0x3dd0('0x1f')](respondWithResult(_0x584616,null))[_0x3dd0('0x29')](handleError(_0x584616,null));};exports[_0x3dd0('0x37')]=function(_0x42ae13,_0x59a2d7){return db[_0x3dd0('0x3d')]['find']({'where':{'id':_0x42ae13[_0x3dd0('0x57')]['id']}})[_0x3dd0('0x1f')](handleEntityNotFound(_0x59a2d7,null))[_0x3dd0('0x1f')](removeEntity(_0x59a2d7,null))[_0x3dd0('0x29')](handleError(_0x59a2d7,null));};exports[_0x3dd0('0x5a')]=function(_0x17591f,_0x14c2fa){return db[_0x3dd0('0x3d')][_0x3dd0('0x5a')]()[_0x3dd0('0x1f')](respondWithResult(_0x14c2fa,null))[_0x3dd0('0x29')](handleError(_0x14c2fa,null));};var interaction_log=require(_0x3dd0('0x5b'))('openchannel-interactions');exports[_0x3dd0('0x5c')]=function(_0x57e14a,_0x5cd0ff,_0x166071){var _0x3c4eb6={'agent':{},'channel':'openchannel'};if(_0x57e14a[_0x3dd0('0x59')]['id']){delete _0x57e14a[_0x3dd0('0x59')]['id'];}_0x57e14a[_0x3dd0('0x59')][_0x3dd0('0x5d')]=!![];_0x57e14a[_0x3dd0('0x59')][_0x3dd0('0x5e')]=moment()[_0x3dd0('0x5f')](_0x3dd0('0x60'));_0x57e14a['body'][_0x3dd0('0x61')]=_0x57e14a[_0x3dd0('0x59')][_0x3dd0('0x61')]||_0x57e14a[_0x3dd0('0x62')]['id'];_0x3c4eb6['agent']['id']=_0x57e14a[_0x3dd0('0x59')][_0x3dd0('0x61')];return db[_0x3dd0('0x3d')]['find']({'where':{'id':_0x57e14a[_0x3dd0('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5cd0ff,null))['then'](saveUpdates(_0x57e14a['body'],null))[_0x3dd0('0x1f')](function(_0x5ce91a){if(_0x5ce91a){_0x3c4eb6['message']=_0x5ce91a[_0x3dd0('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0x3dd0('0x58')]({'where':{'id':_0x5ce91a[_0x3dd0('0x64')]}});}return null;})[_0x3dd0('0x1f')](handleEntityNotFound(_0x5cd0ff,null))[_0x3dd0('0x1f')](function(_0x55a006){if(_0x55a006){return _0x55a006[_0x3dd0('0x36')]({'UserId':_0x57e14a[_0x3dd0('0x59')][_0x3dd0('0x61')],'read1stAt':_[_0x3dd0('0x65')](_0x55a006['read1stAt'])?moment()[_0x3dd0('0x5f')](_0x3dd0('0x60')):undefined});}return null;})[_0x3dd0('0x1f')](function(_0x5d2192){if(_0x5d2192){_0x3c4eb6[_0x3dd0('0x66')]=_0x5d2192['get']({'plain':!![]});interaction_log[_0x3dd0('0x20')](_0x3dd0('0x67'),_0x57e14a[_0x3dd0('0x62')]['id'],_0x57e14a['user'][_0x3dd0('0x39')],_0x57e14a[_0x3dd0('0x62')]['role'],_0x3c4eb6[_0x3dd0('0x66')]['id'],_0x57e14a['body']?JSON['stringify'](_0x57e14a[_0x3dd0('0x59')]):_0x3dd0('0x68'));return respondWithRpcPromise('AcceptMessage',_0x3dd0('0x69'),_0x3c4eb6);}return null;})[_0x3dd0('0x1f')](function(_0x51c724){var _0x4a52ec='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x51c724[_0x3dd0('0x27')][_0x3dd0('0x6a')];return db[_0x3dd0('0x6b')]['query'](_0x4a52ec,{'type':db['Sequelize'][_0x3dd0('0x6c')]['SELECT'],'raw':!![]})[_0x3dd0('0x1f')](function(_0x3f02a5){return _0x3f02a5;});})[_0x3dd0('0x1f')](function(_0x2ea9b1){if(_0x2ea9b1){_0x3c4eb6['message']['contact']=_0x2ea9b1[0x0];if(!_0x57e14a[_0x3dd0('0x59')][_0x3dd0('0x61')])return;return db[_0x3dd0('0x6d')][_0x3dd0('0x58')]({'where':{'id':_0x57e14a[_0x3dd0('0x59')][_0x3dd0('0x61')],'role':_0x3dd0('0x6e')},'attributes':['id',_0x3dd0('0x39'),'fullname',_0x3dd0('0x6f'),_0x3dd0('0x70')],'raw':!![]});}return null;})['then'](function(_0x292201){if(!_0x292201)return null;_0x3c4eb6[_0x3dd0('0x27')][_0x3dd0('0x6e')]=_0x292201;return _0x3c4eb6;})[_0x3dd0('0x1f')](function(_0x5d49ac){if(_0x5d49ac){if(_0x57e14a[_0x3dd0('0x59')][_0x3dd0('0x71')]){_0x3c4eb6[_0x3dd0('0x27')]['interface']=util[_0x3dd0('0x5f')](_0x3dd0('0x72'),_0x57e14a[_0x3dd0('0x62')]['name']);_0x3c4eb6[_0x3dd0('0x27')]['channel']=_0x3c4eb6[_0x3dd0('0x73')];_0x3c4eb6[_0x3dd0('0x27')][_0x3dd0('0x74')]='accept';return respondWithRpcPromise(_0x3dd0('0x75'),_0x3dd0('0x75'),{'event':_0x3dd0('0x76'),'message':_0x3c4eb6[_0x3dd0('0x27')]},client9002)['then'](function(){return _0x3c4eb6;});}return _0x3c4eb6;}return null;})[_0x3dd0('0x1f')](respondWithResult(_0x5cd0ff,null))['catch'](handleError(_0x5cd0ff,null));};var interaction_log=require(_0x3dd0('0x5b'))(_0x3dd0('0x77'));exports[_0x3dd0('0x34')]=function(_0x507ed9,_0x5cea1e,_0x4eef53){var _0x1c294a={'agent':{},'channel':_0x3dd0('0x78')};if(_0x507ed9[_0x3dd0('0x59')]['id']){delete _0x507ed9[_0x3dd0('0x59')]['id'];}_0x507ed9[_0x3dd0('0x59')]['UserId']=_0x507ed9[_0x3dd0('0x59')][_0x3dd0('0x61')]||_0x507ed9[_0x3dd0('0x62')]['id'];_0x1c294a[_0x3dd0('0x6e')]['id']=_0x507ed9[_0x3dd0('0x59')][_0x3dd0('0x61')];return db[_0x3dd0('0x3d')][_0x3dd0('0x58')]({'where':{'id':_0x507ed9['params']['id'],'UserId':null}})[_0x3dd0('0x1f')](handleEntityNotFound(_0x5cea1e,null))[_0x3dd0('0x1f')](function(_0x5d96ba){if(_0x5d96ba){_0x1c294a[_0x3dd0('0x27')]=_0x5d96ba[_0x3dd0('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0x3dd0('0x58')]({'where':{'id':_0x5d96ba[_0x3dd0('0x64')]}});}return null;})[_0x3dd0('0x1f')](handleEntityNotFound(_0x5cea1e,null))[_0x3dd0('0x1f')](function(_0x467bee){if(_0x467bee){_0x1c294a[_0x3dd0('0x66')]=_0x467bee[_0x3dd0('0x63')]({'plain':!![]});interaction_log[_0x3dd0('0x20')](_0x3dd0('0x79'),_0x507ed9[_0x3dd0('0x62')]['id'],_0x507ed9[_0x3dd0('0x62')][_0x3dd0('0x39')],_0x507ed9['user']['role'],_0x1c294a[_0x3dd0('0x66')]['id'],_0x507ed9[_0x3dd0('0x59')]?JSON[_0x3dd0('0x24')](_0x507ed9[_0x3dd0('0x59')]):_0x3dd0('0x68'));return respondWithRpcPromise(_0x3dd0('0x7a'),_0x3dd0('0x7b'),_0x1c294a);}return null;})[_0x3dd0('0x1f')](function(_0x39dde7){var _0x872003=_0x3dd0('0x7c')+_0x39dde7[_0x3dd0('0x27')][_0x3dd0('0x6a')];return db[_0x3dd0('0x6b')][_0x3dd0('0x43')](_0x872003,{'type':db[_0x3dd0('0x7d')][_0x3dd0('0x6c')][_0x3dd0('0x7e')],'raw':!![]})[_0x3dd0('0x1f')](function(_0x2f1e3d){return _0x2f1e3d;});})[_0x3dd0('0x1f')](function(_0x2b2a07){if(_0x2b2a07){_0x1c294a[_0x3dd0('0x27')][_0x3dd0('0x7f')]=_0x2b2a07[0x0];if(!_0x507ed9[_0x3dd0('0x59')][_0x3dd0('0x61')])return;return db[_0x3dd0('0x6d')][_0x3dd0('0x58')]({'where':{'id':_0x507ed9[_0x3dd0('0x59')]['UserId'],'role':_0x3dd0('0x6e')},'attributes':['id',_0x3dd0('0x39'),'fullname',_0x3dd0('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x293709){if(!_0x293709)return null;_0x1c294a[_0x3dd0('0x27')][_0x3dd0('0x6e')]=_0x293709;return _0x1c294a;})[_0x3dd0('0x1f')](function(_0x7ff2fc){if(_0x7ff2fc){_0x7ff2fc[_0x3dd0('0x27')][_0x3dd0('0x80')]=util[_0x3dd0('0x5f')](_0x3dd0('0x72'),_0x507ed9[_0x3dd0('0x62')][_0x3dd0('0x39')]);_0x7ff2fc[_0x3dd0('0x27')]['channel']=_0x1c294a[_0x3dd0('0x73')];_0x7ff2fc[_0x3dd0('0x27')][_0x3dd0('0x74')]=_0x3dd0('0x34');respondWithRpcPromise('EventManager',_0x3dd0('0x75'),{'event':_0x3dd0('0x81'),'message':_0x7ff2fc['message']},client9002);return _0x1c294a;}return null;})[_0x3dd0('0x1f')](respondWithResult(_0x5cea1e,null))[_0x3dd0('0x29')](handleError(_0x5cea1e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 33d605a..4052de6 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 _0x3e14=['events','../../mysqldb','OpenchannelMessage','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2fd10b,_0x464483){var _0x576bd0=function(_0x93ce62){while(--_0x93ce62){_0x2fd10b['push'](_0x2fd10b['shift']());}};_0x576bd0(++_0x464483);}(_0x3e14,0x1a7));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x43e1('0x0'));var OpenchannelMessage=require(_0x43e1('0x1'))['db'][_0x43e1('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x43e1('0x3'),'afterUpdate':'update','afterDestroy':_0x43e1('0x4')};function emitEvent(_0x15967a){return function(_0x15d802,_0x1de22,_0xbd8210){OpenchannelMessageEvents['emit'](_0x15967a+':'+_0x15d802['id'],_0x15d802);OpenchannelMessageEvents[_0x43e1('0x5')](_0x15967a,_0x15d802);_0xbd8210(null);};}for(var e in events){if(events[_0x43e1('0x6')](e)){var event=events[e];OpenchannelMessage[_0x43e1('0x7')](e,emitEvent(event));}}module[_0x43e1('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xcd2a=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x157a8a,_0x34d072){var _0x5bf33f=function(_0x4fc182){while(--_0x4fc182){_0x157a8a['push'](_0x157a8a['shift']());}};_0x5bf33f(++_0x34d072);}(_0xcd2a,0x15c));var _0xacd2=function(_0x246f92,_0xcf7bd4){_0x246f92=_0x246f92-0x0;var _0x2b8e7d=_0xcd2a[_0x246f92];return _0x2b8e7d;};'use strict';var EventEmitter=require(_0xacd2('0x0'));var OpenchannelMessage=require(_0xacd2('0x1'))['db'][_0xacd2('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xacd2('0x3')](0x0);var events={'afterCreate':_0xacd2('0x4'),'afterUpdate':'update','afterDestroy':_0xacd2('0x5')};function emitEvent(_0x86923a){return function(_0x3fec8c,_0x456e04,_0x2d458d){OpenchannelMessageEvents[_0xacd2('0x6')](_0x86923a+':'+_0x3fec8c['id'],_0x3fec8c);OpenchannelMessageEvents[_0xacd2('0x6')](_0x86923a,_0x3fec8c);_0x2d458d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xacd2('0x7')](e,emitEvent(event));}}module[_0xacd2('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 20f0d1e..28f2e76 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 _0x1a85=['openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','OpenchannelMessage'];(function(_0x22d551,_0x295ccf){var _0xb6703b=function(_0x370b1a){while(--_0x370b1a){_0x22d551['push'](_0x22d551['shift']());}};_0xb6703b(++_0x295ccf);}(_0x1a85,0x178));var _0x51a8=function(_0x51cd34,_0x1486f7){_0x51cd34=_0x51cd34-0x0;var _0x345c33=_0x1a85[_0x51cd34];return _0x345c33;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x51a8('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e1b4,_0x39e06a,_0x2f276b){var _0x1a476d=_0x4b76a8[_0x51a8('0xa')];var _0x418f06=_0x56e1b4[_0x51a8('0xb')]({'plain':!![]});if(_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()==='in'||_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]&&!_[_0x51a8('0x10')](_0x418f06[_0x51a8('0x11')])){_0x1a476d[_0x51a8('0x12')][_0x51a8('0x13')]({'where':{'id':_0x418f06[_0x51a8('0x14')]}})['then'](function(_0x461f5c){if(_0x461f5c){_0x461f5c[_0x51a8('0x15')]({'lastMsgAt':_0x418f06[_0x51a8('0x16')],'lastMsgDirection':_0x418f06['direction'][_0x51a8('0xd')]()});}})['catch'](function(_0x10584b){console[_0x51a8('0x17')](_0x10584b);});}if(_0x418f06[_0x51a8('0xc')]===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]){var _0x3e0603;_0x1a476d[_0x51a8('0x18')]['describe']()[_0x51a8('0x19')](function(_0x45a433){return _0x1a476d[_0x51a8('0x1a')][_0x51a8('0x1b')]({'where':{'id':_0x418f06[_0x51a8('0x1c')]},'include':[{'model':_0x1a476d[_0x51a8('0x12')],'as':'Interactions','where':{'id':_0x418f06[_0x51a8('0x14')]},'limit':0x1,'include':[{'model':_0x1a476d[_0x51a8('0x18')],'as':_0x51a8('0x1d'),'attributes':_[_0x51a8('0x1e')](_0x45a433)}]}]});})[_0x51a8('0x19')](function(_0x3bc044){_0x3e0603=_0x3bc044[_0x51a8('0xb')]({'plain':!![]});if(_0x3e0603&&_0x3e0603[_0x51a8('0x1f')]){logger['info'](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x21')](_0x51a8('0x22'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0x3e0603[_0x51a8('0x23')]&&_0x3e0603['Interactions'][_0x51a8('0x24')]){_0x418f06['Interaction']=_['omit'](_0x3e0603[_0x51a8('0x23')][0x0],'Contact');_0x418f06[_0x51a8('0x1d')]=_0x3e0603[_0x51a8('0x23')][0x0][_0x51a8('0x1d')];}var _0x39e06a={'method':_0x51a8('0x25'),'uri':encodeURI(_0x3e0603[_0x51a8('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39e06a[_0x51a8('0x26')]){case _0x51a8('0x27'):_0x39e06a['qs']=_0x418f06;break;case'POST':_0x39e06a[_0x51a8('0x9')]=_0x418f06;break;}return rp(_0x39e06a)[_0x51a8('0x19')](function(_0xca5746){logger[_0x51a8('0x28')](_0x51a8('0x20'),_0x51a8('0x29'),util[_0x51a8('0x21')](_0x51a8('0x2a'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]&&_0xca5746[_0x51a8('0x9')]['threadId']!=_0x418f06[_0x51a8('0x2c')]['threadId']){return _0x1a476d[_0x51a8('0x12')][_0x51a8('0x15')]({'threadId':_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]},{'logging':!![],'where':{'id':_0x418f06[_0x51a8('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x56e1b4[_0x51a8('0x15')]({'read':!![]});})['catch'](function(_0x41c4de){logger[_0x51a8('0x17')](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x2d')](_0x41c4de,{'showHidden':![],'depth':null}));_0x2f276b();});}else{_0x2f276b();}})['finally'](function(){_0x2f276b();});}else{_0x2f276b();}}},'charset':_0x51a8('0x2e'),'collate':_0x51a8('0x2f')});}; \ No newline at end of file +var _0x0598=['util','api','request-promise','path','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','toLowerCase','direction','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','secret','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','get','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','error','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xfcb005,_0x3c6e51){var _0x3d6bc1=function(_0x38dd43){while(--_0x38dd43){_0xfcb005['push'](_0xfcb005['shift']());}};_0x3d6bc1(++_0x3c6e51);}(_0x0598,0x92));var _0x8059=function(_0x2d54c7,_0x173718){_0x2d54c7=_0x2d54c7-0x0;var _0x3c3568=_0x0598[_0x2d54c7];return _0x3c3568;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8059('0x3'));var fs=require('fs');var path=require(_0x8059('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x8059('0x5')]=function(_0xa7d7c1,_0x512c0f){return _0xa7d7c1['define'](_0x8059('0x6'),attributes,{'tableName':_0x8059('0x7'),'paranoid':![],'indexes':[{'name':_0x8059('0x8'),'fields':[_0x8059('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d1010,_0x89dda1,_0x1bf5fd){var _0x336f85=_0xa7d7c1[_0x8059('0xa')];var _0x283b63=_0x4d1010['get']({'plain':!![]});if(_0x283b63['direction'][_0x8059('0xb')]()==='in'||_0x283b63[_0x8059('0xc')]['toLowerCase']()==='out'&&!_0x283b63['secret']&&!_[_0x8059('0xd')](_0x283b63[_0x8059('0xe')])){_0x336f85[_0x8059('0xf')][_0x8059('0x10')]({'where':{'id':_0x283b63[_0x8059('0x11')]}})['then'](function(_0x11218f){if(_0x11218f){_0x11218f['update']({'lastMsgAt':_0x283b63[_0x8059('0x12')],'lastMsgDirection':_0x283b63['direction'][_0x8059('0xb')]()});}})[_0x8059('0x13')](function(_0x4810fd){console['error'](_0x4810fd);});}if(_0x283b63['direction']==='out'&&!_0x283b63[_0x8059('0x14')]){var _0x239195;_0x336f85[_0x8059('0x15')][_0x8059('0x16')]()[_0x8059('0x17')](function(_0x4b6d55){return _0x336f85[_0x8059('0x18')][_0x8059('0x19')]({'where':{'id':_0x283b63[_0x8059('0x1a')]},'include':[{'model':_0x336f85[_0x8059('0xf')],'as':'Interactions','where':{'id':_0x283b63[_0x8059('0x11')]},'limit':0x1,'include':[{'model':_0x336f85['CmContact'],'as':_0x8059('0x1b'),'attributes':_['keys'](_0x4b6d55)}]}]});})[_0x8059('0x17')](function(_0x56d794){_0x239195=_0x56d794[_0x8059('0x1c')]({'plain':!![]});if(_0x239195&&_0x239195[_0x8059('0x1d')]){logger[_0x8059('0x1e')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x8059('0x1f')](_0x8059('0x20'),_0x283b63['id'],_0x239195[_0x8059('0x1d')]));if(_0x239195[_0x8059('0x21')]&&_0x239195['Interactions'][_0x8059('0x22')]){_0x283b63[_0x8059('0x23')]=_[_0x8059('0x24')](_0x239195['Interactions'][0x0],_0x8059('0x1b'));_0x283b63[_0x8059('0x1b')]=_0x239195[_0x8059('0x21')][0x0][_0x8059('0x1b')];}var _0x89dda1={'method':_0x8059('0x25'),'uri':encodeURI(_0x239195[_0x8059('0x1d')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x89dda1[_0x8059('0x26')]){case _0x8059('0x27'):_0x89dda1['qs']=_0x283b63;break;case _0x8059('0x25'):_0x89dda1['body']=_0x283b63;break;}return rp(_0x89dda1)[_0x8059('0x17')](function(_0x19b95a){logger[_0x8059('0x1e')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x8059('0x28'),_0x283b63['id'],_0x239195[_0x8059('0x1d')]));if(_0x19b95a[_0x8059('0x9')][_0x8059('0x29')]&&_0x19b95a['body'][_0x8059('0x29')]!=_0x283b63['Interaction'][_0x8059('0x29')]){return _0x336f85[_0x8059('0xf')]['update']({'threadId':_0x19b95a[_0x8059('0x9')][_0x8059('0x29')]},{'logging':!![],'where':{'id':_0x283b63[_0x8059('0x23')]['id']}});}else{return;}})[_0x8059('0x17')](function(){return _0x4d1010[_0x8059('0x2a')]({'read':!![]});})[_0x8059('0x13')](function(_0x46b6a1){logger[_0x8059('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x8059('0x2c'),util[_0x8059('0x2d')](_0x46b6a1,{'showHidden':![],'depth':null}));_0x1bf5fd();});}else{_0x1bf5fd();}})[_0x8059('0x2e')](function(){_0x1bf5fd();});}else{_0x1bf5fd();}}},'charset':_0x8059('0x2f'),'collate':_0x8059('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 04ff764..f0851b3 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2f76d3,_0x24a0c1){var _0x1b22f3=function(_0x3768ea){while(--_0x3768ea){_0x2f76d3['push'](_0x2f76d3['shift']());}};_0x1b22f3(++_0x24a0c1);}(_0x1261,0x144));var _0x1126=function(_0x3d6bab,_0x3242db){_0x3d6bab=_0x3d6bab-0x0;var _0x348415=_0x1261[_0x3d6bab];return _0x348415;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x4d143b,_0x318dd2){var _0x4097f6=function(_0x526d6a){while(--_0x526d6a){_0x4d143b['push'](_0x4d143b['shift']());}};_0x4097f6(++_0x318dd2);}(_0xadb5,0xad));var _0x5adb=function(_0x14e666,_0x1a2561){_0x14e666=_0x14e666-0x0;var _0x3e77fd=_0xadb5[_0x14e666];return _0x3e77fd;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6e92fbc..4bab21b 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 _0x90c5=['emit','removeListener','length','openchannelMessage:','remove','update'];(function(_0x562ee4,_0x4c203d){var _0x4327ee=function(_0x2d09e7){while(--_0x2d09e7){_0x562ee4['push'](_0x562ee4['shift']());}};_0x4327ee(++_0x4c203d);}(_0x90c5,0x17e));var _0x590c=function(_0x3b9863,_0x23f807){_0x3b9863=_0x3b9863-0x0;var _0x17c270=_0x90c5[_0x3b9863];return _0x17c270;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x590c('0x0'),_0x590c('0x1')];function createListener(_0x228cf9,_0x236ee1){return function(_0x403d9e){_0x236ee1[_0x590c('0x2')](_0x228cf9,_0x403d9e);};}function removeListener(_0x25fba7,_0xb0712d){return function(){OpenchannelMessageEvents[_0x590c('0x3')](_0x25fba7,_0xb0712d);};}exports['register']=function(_0x1bbfdb){for(var _0x5c92cc=0x0,_0x1ea1a3=events[_0x590c('0x4')];_0x5c92cc<_0x1ea1a3;_0x5c92cc++){var _0x5db8d1=events[_0x5c92cc];var _0x10ee97=createListener(_0x590c('0x5')+_0x5db8d1,_0x1bbfdb);OpenchannelMessageEvents['on'](_0x5db8d1,_0x10ee97);}}; \ No newline at end of file +var _0x8958=['removeListener','length','openchannelMessage:','save'];(function(_0x180cd0,_0x386c6e){var _0x49fc32=function(_0x551c2c){while(--_0x551c2c){_0x180cd0['push'](_0x180cd0['shift']());}};_0x49fc32(++_0x386c6e);}(_0x8958,0x93));var _0x8895=function(_0x2692f1,_0xdfa6e){_0x2692f1=_0x2692f1-0x0;var _0x262a14=_0x8958[_0x2692f1];return _0x262a14;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x8895('0x0'),'remove','update'];function createListener(_0x5baab1,_0x4cea64){return function(_0x418b66){_0x4cea64['emit'](_0x5baab1,_0x418b66);};}function removeListener(_0x38d5d7,_0xce4955){return function(){OpenchannelMessageEvents[_0x8895('0x1')](_0x38d5d7,_0xce4955);};}exports['register']=function(_0x22fa52){for(var _0x2f03ad=0x0,_0x124e1e=events[_0x8895('0x2')];_0x2f03ad<_0x124e1e;_0x2f03ad++){var _0x33013a=events[_0x2f03ad];var _0x51376b=createListener(_0x8895('0x3')+_0x33013a,_0x22fa52);OpenchannelMessageEvents['on'](_0x33013a,_0x51376b);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 51895fd..0799696 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 _0xee41=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','/:id','delete','destroy','removeTeams','exports','multer'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xee41,0x95));var _0x1ee4=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0xee41[_0x413727];return _0x5f46d7;};'use strict';var multer=require(_0x1ee4('0x0'));var util=require(_0x1ee4('0x1'));var path=require(_0x1ee4('0x2'));var timeout=require(_0x1ee4('0x3'));var express=require(_0x1ee4('0x4'));var router=express[_0x1ee4('0x5')]();var fs_extra=require(_0x1ee4('0x6'));var auth=require(_0x1ee4('0x7'));var interaction=require(_0x1ee4('0x8'));var config=require(_0x1ee4('0x9'));var controller=require(_0x1ee4('0xa'));router[_0x1ee4('0xb')]('/',auth[_0x1ee4('0xc')](),controller[_0x1ee4('0xd')]);router[_0x1ee4('0xb')]('/describe',auth[_0x1ee4('0xc')](),controller[_0x1ee4('0xe')]);router[_0x1ee4('0xb')]('/:id',auth[_0x1ee4('0xc')](),controller[_0x1ee4('0xf')]);router[_0x1ee4('0xb')](_0x1ee4('0x10'),auth[_0x1ee4('0xc')](),controller['getMembers']);router[_0x1ee4('0xb')](_0x1ee4('0x11'),auth[_0x1ee4('0xc')](),controller[_0x1ee4('0x12')]);router[_0x1ee4('0xb')](_0x1ee4('0x13'),auth[_0x1ee4('0xc')](),controller[_0x1ee4('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1ee4('0x15')]);router[_0x1ee4('0x16')](_0x1ee4('0x11'),auth[_0x1ee4('0xc')](),controller['addTeams']);router[_0x1ee4('0x16')](_0x1ee4('0x13'),auth[_0x1ee4('0xc')](),controller[_0x1ee4('0x17')]);router[_0x1ee4('0x18')](_0x1ee4('0x19'),auth[_0x1ee4('0xc')](),controller['update']);router[_0x1ee4('0x1a')](_0x1ee4('0x19'),auth[_0x1ee4('0xc')](),controller[_0x1ee4('0x1b')]);router['delete']('/:id/teams',auth[_0x1ee4('0xc')](),controller[_0x1ee4('0x1c')]);router[_0x1ee4('0x1a')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x1ee4('0x1d')]=router; \ No newline at end of file +var _0x7c9b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','update','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout'];(function(_0x4ddf44,_0x2051be){var _0xc278d1=function(_0x235eb7){while(--_0x235eb7){_0x4ddf44['push'](_0x4ddf44['shift']());}};_0xc278d1(++_0x2051be);}(_0x7c9b,0x1ea));var _0xb7c9=function(_0x1494e1,_0x48675f){_0x1494e1=_0x1494e1-0x0;var _0x1482b8=_0x7c9b[_0x1494e1];return _0x1482b8;};'use strict';var multer=require(_0xb7c9('0x0'));var util=require('util');var path=require(_0xb7c9('0x1'));var timeout=require(_0xb7c9('0x2'));var express=require(_0xb7c9('0x3'));var router=express[_0xb7c9('0x4')]();var fs_extra=require(_0xb7c9('0x5'));var auth=require(_0xb7c9('0x6'));var interaction=require(_0xb7c9('0x7'));var config=require(_0xb7c9('0x8'));var controller=require(_0xb7c9('0x9'));router[_0xb7c9('0xa')]('/',auth[_0xb7c9('0xb')](),controller[_0xb7c9('0xc')]);router[_0xb7c9('0xa')](_0xb7c9('0xd'),auth['isAuthenticated'](),controller[_0xb7c9('0xe')]);router['get'](_0xb7c9('0xf'),auth[_0xb7c9('0xb')](),controller['show']);router[_0xb7c9('0xa')](_0xb7c9('0x10'),auth[_0xb7c9('0xb')](),controller['getMembers']);router[_0xb7c9('0xa')]('/:id/teams',auth[_0xb7c9('0xb')](),controller['getTeams']);router[_0xb7c9('0xa')](_0xb7c9('0x11'),auth[_0xb7c9('0xb')](),controller[_0xb7c9('0x12')]);router[_0xb7c9('0x13')]('/',auth['isAuthenticated'](),controller[_0xb7c9('0x14')]);router['post'](_0xb7c9('0x15'),auth[_0xb7c9('0xb')](),controller['addTeams']);router[_0xb7c9('0x13')](_0xb7c9('0x11'),auth[_0xb7c9('0xb')](),controller[_0xb7c9('0x16')]);router[_0xb7c9('0x17')](_0xb7c9('0xf'),auth['isAuthenticated'](),controller[_0xb7c9('0x18')]);router['delete'](_0xb7c9('0xf'),auth[_0xb7c9('0xb')](),controller[_0xb7c9('0x19')]);router['delete']('/:id/teams',auth[_0xb7c9('0xb')](),controller[_0xb7c9('0x1a')]);router['delete'](_0xb7c9('0x11'),auth[_0xb7c9('0xb')](),controller[_0xb7c9('0x1b')]);module[_0xb7c9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index c3e62f5..2615536 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 _0xbb0c=['STRING','name','ENUM','rrmemory','roundrobin'];(function(_0x4d2f57,_0x5591fd){var _0x485adc=function(_0x27ff6a){while(--_0x27ff6a){_0x4d2f57['push'](_0x4d2f57['shift']());}};_0x485adc(++_0x5591fd);}(_0xbb0c,0x64));var _0xcbb0=function(_0x3d5227,_0x5056a0){_0x3d5227=_0x3d5227-0x0;var _0x1da2ae=_0xbb0c[_0x3d5227];return _0x1da2ae;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcbb0('0x0')],'unique':_0xcbb0('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcbb0('0x2')](_0xcbb0('0x3'),'beepall',_0xcbb0('0x4'))}}; \ No newline at end of file +var _0x5cab=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0xc3790a,_0x3a8611){var _0x3380a8=function(_0x2a0a68){while(--_0x2a0a68){_0xc3790a['push'](_0xc3790a['shift']());}};_0x3380a8(++_0x3a8611);}(_0x5cab,0xf2));var _0xb5ca=function(_0x5ade66,_0x49caf6){_0x5ade66=_0x5ade66-0x0;var _0x12113f=_0x5cab[_0x5ade66];return _0x12113f;};'use strict';var Sequelize=require(_0xb5ca('0x0'));module[_0xb5ca('0x1')]={'name':{'type':Sequelize[_0xb5ca('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb5ca('0x2')]},'timeout':{'type':Sequelize[_0xb5ca('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb5ca('0x4')](_0xb5ca('0x5'),_0xb5ca('0x6'),_0xb5ca('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8759a7d..9015afc 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 _0x9645=['rows','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','nolimit','OpenchannelQueueId','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','ids','Agents','online','interface','flatMap','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','every','includes','union','compact','value','transaction','isEmpty','userOpenchannelQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','rimraf','fast-json-patch','request-promise','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','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x2d7a4b,_0xa36b04){var _0x603707=function(_0x498947){while(--_0x498947){_0x2d7a4b['push'](_0x2d7a4b['shift']());}};_0x603707(++_0xa36b04);}(_0x9645,0xd4));var _0x5964=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0x9645[_0x413b4d];return _0x8b810a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5964('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5964('0x1'));var rp=require(_0x5964('0x2'));var moment=require(_0x5964('0x3'));var BPromise=require(_0x5964('0x4'));var Mustache=require('mustache');var util=require(_0x5964('0x5'));var path=require(_0x5964('0x6'));var sox=require(_0x5964('0x7'));var csv=require(_0x5964('0x8'));var ejs=require(_0x5964('0x9'));var fs=require('fs');var fs_extra=require(_0x5964('0xa'));var _=require(_0x5964('0xb'));var squel=require(_0x5964('0xc'));var crypto=require(_0x5964('0xd'));var jsforce=require(_0x5964('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5964('0xf'));var Redis=require(_0x5964('0x10'));var authService=require(_0x5964('0x11'));var qs=require(_0x5964('0x12'));var as=require(_0x5964('0x13'));var hardwareService=require(_0x5964('0x14'));var logger=require('../../config/logger')(_0x5964('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5964('0x16'));var db=require(_0x5964('0x17'))['db'];config[_0x5964('0x18')]=_[_0x5964('0x19')](config[_0x5964('0x18')],{'host':_0x5964('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5964('0x18')]));require(_0x5964('0x1b'))['register'](socket);function respondWithStatusCode(_0x45c845,_0x556968){_0x556968=_0x556968||0xcc;return function(_0x5c10ca){if(_0x5c10ca){return _0x45c845[_0x5964('0x1c')](_0x556968);}return _0x45c845[_0x5964('0x1d')](_0x556968)[_0x5964('0x1e')]();};}function respondWithResult(_0x52805a,_0x110b33){_0x110b33=_0x110b33||0xc8;return function(_0x11f553){if(_0x11f553){return _0x52805a[_0x5964('0x1d')](_0x110b33)[_0x5964('0x1f')](_0x11f553);}};}function respondWithFilteredResult(_0x202608,_0x370873){return function(_0x18ae44){if(_0x18ae44){var _0x412835=typeof _0x370873[_0x5964('0x20')]==='undefined'&&typeof _0x370873[_0x5964('0x21')]===_0x5964('0x22');var _0x61a950=_0x18ae44[_0x5964('0x23')];var _0x314a3d=_0x412835?0x0:_0x370873[_0x5964('0x20')];var _0x16647d=_0x412835?_0x18ae44['count']:_0x370873['offset']+_0x370873[_0x5964('0x21')];var _0x300b81;if(_0x16647d>=_0x61a950){_0x16647d=_0x61a950;_0x300b81=0xc8;}else{_0x300b81=0xce;}_0x202608[_0x5964('0x1d')](_0x300b81);return _0x202608[_0x5964('0x24')]('Content-Range',_0x314a3d+'-'+_0x16647d+'/'+_0x61a950)['json'](_0x18ae44);}return null;};}function patchUpdates(_0x24ebf9){return function(_0x19aaf3){try{jsonpatch['apply'](_0x19aaf3,_0x24ebf9,!![]);}catch(_0x3dacc4){return BPromise[_0x5964('0x25')](_0x3dacc4);}return _0x19aaf3[_0x5964('0x26')]();};}function saveUpdates(_0x337b7a,_0x385333){return function(_0x45a9ac){if(_0x45a9ac){return _0x45a9ac[_0x5964('0x27')](_0x337b7a)[_0x5964('0x28')](function(_0xe8202d){return _0xe8202d;});}return null;};}function removeEntity(_0x25e01d,_0x34752f){return function(_0x396a20){if(_0x396a20){return _0x396a20[_0x5964('0x29')]()[_0x5964('0x28')](function(){var _0x125ebe=_0x396a20[_0x5964('0x2a')]({'plain':!![]});var _0xd0ba53=_0x5964('0x2b');return db[_0x5964('0x2c')][_0x5964('0x29')]({'where':{'type':_0xd0ba53,'resourceId':_0x125ebe['id']}})[_0x5964('0x28')](function(){return _0x396a20;});})[_0x5964('0x28')](function(){_0x25e01d[_0x5964('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484c90,_0x348eca){return function(_0x5c72cf){if(!_0x5c72cf){_0x484c90['sendStatus'](0x194);}return _0x5c72cf;};}function handleError(_0x159d28,_0x248d37){_0x248d37=_0x248d37||0x1f4;return function(_0x310ebe){logger[_0x5964('0x2d')](_0x310ebe['stack']);if(_0x310ebe['name']){delete _0x310ebe[_0x5964('0x2e')];}_0x159d28[_0x5964('0x1d')](_0x248d37)[_0x5964('0x2f')](_0x310ebe);};}exports[_0x5964('0x30')]=function(_0x3be377,_0xf451a){var _0x56ce8b={},_0x55a89b={},_0x3eb402={'count':0x0,'rows':[]};var _0x519d71=_[_0x5964('0x31')](db[_0x5964('0x32')]['rawAttributes'],function(_0x4afd6e){return{'name':_0x4afd6e[_0x5964('0x33')],'type':_0x4afd6e[_0x5964('0x34')]['key']};});_0x55a89b['model']=_[_0x5964('0x31')](_0x519d71,_0x5964('0x2e'));_0x55a89b['query']=_[_0x5964('0x35')](_0x3be377[_0x5964('0x36')]);_0x55a89b[_0x5964('0x37')]=_[_0x5964('0x38')](_0x55a89b[_0x5964('0x39')],_0x55a89b['query']);_0x56ce8b['attributes']=_[_0x5964('0x38')](_0x55a89b[_0x5964('0x39')],qs[_0x5964('0x3a')](_0x3be377['query'][_0x5964('0x3a')]));_0x56ce8b[_0x5964('0x3b')]=_0x56ce8b[_0x5964('0x3b')][_0x5964('0x3c')]?_0x56ce8b[_0x5964('0x3b')]:_0x55a89b['model'];if(!_0x3be377['query'][_0x5964('0x3d')]('nolimit')){_0x56ce8b['limit']=qs[_0x5964('0x21')](_0x3be377[_0x5964('0x36')][_0x5964('0x21')]);_0x56ce8b[_0x5964('0x20')]=qs[_0x5964('0x20')](_0x3be377[_0x5964('0x36')]['offset']);}_0x56ce8b[_0x5964('0x3e')]=qs[_0x5964('0x3f')](_0x3be377[_0x5964('0x36')]['sort']);_0x56ce8b[_0x5964('0x40')]=qs['filters'](_['pick'](_0x3be377[_0x5964('0x36')],_0x55a89b[_0x5964('0x37')]),_0x519d71);if(_0x3be377[_0x5964('0x36')]['filter']){_0x56ce8b[_0x5964('0x40')]=_[_0x5964('0x41')](_0x56ce8b[_0x5964('0x40')],{'$or':_[_0x5964('0x31')](_0x519d71,function(_0x5a0822){if(_0x5a0822[_0x5964('0x34')]!==_0x5964('0x42')){var _0x28eb4b={};_0x28eb4b[_0x5a0822['name']]={'$like':'%'+_0x3be377[_0x5964('0x36')][_0x5964('0x43')]+'%'};return _0x28eb4b;}})});}_0x56ce8b=_[_0x5964('0x41')]({},_0x56ce8b,_0x3be377[_0x5964('0x44')]);var _0x5cfa74={'where':_0x56ce8b[_0x5964('0x40')]};return db[_0x5964('0x32')][_0x5964('0x23')](_0x5cfa74)['then'](function(_0x13568b){_0x3eb402['count']=_0x13568b;if(_0x3be377['query'][_0x5964('0x45')]){_0x56ce8b[_0x5964('0x46')]=[{'all':!![]}];}return db[_0x5964('0x32')][_0x5964('0x47')](_0x56ce8b);})['then'](function(_0x2e13e4){_0x3eb402[_0x5964('0x48')]=_0x2e13e4;return _0x3eb402;})[_0x5964('0x28')](respondWithFilteredResult(_0xf451a,_0x56ce8b))[_0x5964('0x49')](handleError(_0xf451a,null));};exports[_0x5964('0x4a')]=function(_0x288646,_0x1c3c3e){var _0x2ccdd0={'raw':!![],'where':{'id':_0x288646[_0x5964('0x4b')]['id']}},_0x339b7b={};_0x339b7b[_0x5964('0x39')]=_[_0x5964('0x35')](db[_0x5964('0x32')]['rawAttributes']);_0x339b7b[_0x5964('0x36')]=_[_0x5964('0x35')](_0x288646[_0x5964('0x36')]);_0x339b7b[_0x5964('0x37')]=_[_0x5964('0x38')](_0x339b7b[_0x5964('0x39')],_0x339b7b[_0x5964('0x36')]);_0x2ccdd0[_0x5964('0x3b')]=_['intersection'](_0x339b7b[_0x5964('0x39')],qs['fields'](_0x288646['query'][_0x5964('0x3a')]));_0x2ccdd0[_0x5964('0x3b')]=_0x2ccdd0[_0x5964('0x3b')][_0x5964('0x3c')]?_0x2ccdd0[_0x5964('0x3b')]:_0x339b7b[_0x5964('0x39')];if(_0x288646['query']['includeAll']){_0x2ccdd0['include']=[{'all':!![]}];}_0x2ccdd0=_['merge']({},_0x2ccdd0,_0x288646[_0x5964('0x44')]);return db['OpenchannelQueue']['find'](_0x2ccdd0)[_0x5964('0x28')](handleEntityNotFound(_0x1c3c3e,null))[_0x5964('0x28')](respondWithResult(_0x1c3c3e,null))[_0x5964('0x49')](handleError(_0x1c3c3e,null));};exports[_0x5964('0x4c')]=function(_0x353d8e,_0x22a7ef){return db['OpenchannelQueue']['create'](_0x353d8e[_0x5964('0x4d')],{})[_0x5964('0x28')](function(_0x42a9a8){var _0x172b97=_0x353d8e[_0x5964('0x4e')][_0x5964('0x2a')]({'plain':!![]});if(!_0x172b97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x172b97[_0x5964('0x4f')]===_0x5964('0x4e')){var _0x1110c7=_0x42a9a8['get']({'plain':!![]});var _0x57292e=_0x5964('0x2b');return db[_0x5964('0x50')][_0x5964('0x51')]({'where':{'name':_0x57292e,'userProfileId':_0x172b97[_0x5964('0x52')]},'raw':!![]})[_0x5964('0x28')](function(_0xfea51c){if(_0xfea51c&&_0xfea51c[_0x5964('0x53')]===0x0){return db[_0x5964('0x2c')]['create']({'name':_0x1110c7[_0x5964('0x2e')],'resourceId':_0x1110c7['id'],'type':_0xfea51c[_0x5964('0x2e')],'sectionId':_0xfea51c['id']},{})[_0x5964('0x28')](function(){return _0x42a9a8;});}else{return _0x42a9a8;}})[_0x5964('0x49')](function(_0x40a409){logger[_0x5964('0x2d')](_0x5964('0x54'),_0x40a409);throw _0x40a409;});}return _0x42a9a8;})[_0x5964('0x28')](respondWithResult(_0x22a7ef,0xc9))[_0x5964('0x49')](handleError(_0x22a7ef,null));};exports[_0x5964('0x27')]=function(_0x506c02,_0x590b56){if(_0x506c02[_0x5964('0x4d')]['id']){delete _0x506c02[_0x5964('0x4d')]['id'];}return db['OpenchannelQueue'][_0x5964('0x51')]({'where':{'id':_0x506c02[_0x5964('0x4b')]['id']}})['then'](handleEntityNotFound(_0x590b56,null))['then'](saveUpdates(_0x506c02[_0x5964('0x4d')],null))[_0x5964('0x28')](respondWithResult(_0x590b56,null))['catch'](handleError(_0x590b56,null));};exports[_0x5964('0x29')]=function(_0x2ca602,_0x588da3){return db['OpenchannelQueue'][_0x5964('0x51')]({'where':{'id':_0x2ca602[_0x5964('0x4b')]['id']}})[_0x5964('0x28')](handleEntityNotFound(_0x588da3,null))[_0x5964('0x28')](removeEntity(_0x588da3,null))[_0x5964('0x49')](handleError(_0x588da3,null));};exports[_0x5964('0x55')]=function(_0x29dce8,_0x2d2ae2){return db[_0x5964('0x32')][_0x5964('0x55')]()['then'](respondWithResult(_0x2d2ae2,null))['catch'](handleError(_0x2d2ae2,null));};exports[_0x5964('0x56')]=function(_0x35dadc,_0x391af6,_0x4a9ccc){var _0x5bc502={'raw':!![],'where':{}},_0x8ba38e={},_0x5b5c09;return db[_0x5964('0x32')][_0x5964('0x57')]({'where':{'id':_0x35dadc[_0x5964('0x4b')]['id']}})['then'](handleEntityNotFound(_0x391af6,null))[_0x5964('0x28')](function(_0x42811f){if(_0x42811f){_0x5b5c09=_0x42811f['get']({'plain':!![]});_0x8ba38e[_0x5964('0x39')]=_[_0x5964('0x35')](db[_0x5964('0x58')][_0x5964('0x59')]);_0x8ba38e[_0x5964('0x36')]=_[_0x5964('0x35')](_0x35dadc[_0x5964('0x36')]);_0x8ba38e[_0x5964('0x37')]=_[_0x5964('0x38')](_0x8ba38e[_0x5964('0x39')],_0x8ba38e[_0x5964('0x36')]);_0x5bc502[_0x5964('0x3b')]=_[_0x5964('0x38')](_0x8ba38e['model'],qs[_0x5964('0x3a')](_0x35dadc['query']['fields']));_0x5bc502[_0x5964('0x3b')]=_0x5bc502[_0x5964('0x3b')][_0x5964('0x3c')]?_0x5bc502[_0x5964('0x3b')]:_0x8ba38e[_0x5964('0x39')];if(!_0x35dadc[_0x5964('0x36')][_0x5964('0x3d')](_0x5964('0x5a'))){_0x5bc502[_0x5964('0x21')]=qs['limit'](_0x35dadc[_0x5964('0x36')][_0x5964('0x21')]);_0x5bc502[_0x5964('0x20')]=qs[_0x5964('0x20')](_0x35dadc[_0x5964('0x36')][_0x5964('0x20')]);}_0x5bc502[_0x5964('0x3e')]=qs[_0x5964('0x3f')](_0x35dadc[_0x5964('0x36')][_0x5964('0x3f')]);_0x5bc502[_0x5964('0x40')]=qs[_0x5964('0x37')](_['pick'](_0x35dadc[_0x5964('0x36')],_0x8ba38e['filters']));_0x5bc502['where'][_0x5964('0x5b')]=_0x42811f['id'];if(_0x35dadc[_0x5964('0x36')][_0x5964('0x43')]){_0x5bc502[_0x5964('0x40')]=_[_0x5964('0x41')](_0x5bc502[_0x5964('0x40')],{'$or':_[_0x5964('0x31')](_0x5bc502[_0x5964('0x3b')],function(_0x3c24dd){var _0x1fc66b={};_0x1fc66b[_0x3c24dd]={'$like':'%'+_0x35dadc[_0x5964('0x36')][_0x5964('0x43')]+'%'};return _0x1fc66b;})});}_0x5bc502=_[_0x5964('0x41')]({},_0x5bc502,_0x35dadc['options']);return db[_0x5964('0x58')][_0x5964('0x47')](_0x5bc502);}})[_0x5964('0x28')](function(_0x3e1032){if(_0x3e1032){return db[_0x5964('0x5c')][_0x5964('0x5d')]({'where':{'id':_[_0x5964('0x31')](_0x3e1032,_0x5964('0x5e')),'role':'agent'},'attributes':['id',_0x5964('0x2e'),_0x5964('0x5f'),_0x5964('0x60'),_0x5964('0x61')]});}})[_0x5964('0x28')](function(_0xc27b6b){if(_0xc27b6b){return{'count':_0xc27b6b[_0x5964('0x23')],'rows':_[_0x5964('0x31')](_0xc27b6b[_0x5964('0x48')],function(_0x7bb11e){return{'membername':_0x7bb11e[_0x5964('0x2e')],'UserId':_0x7bb11e['id'],'queue_name':_0x5b5c09[_0x5964('0x2e')],'OpenchannelQueueId':_0x5b5c09['id'],'interface':util['format'](_0x5964('0x62'),_0x5964('0x63'),_0x7bb11e[_0x5964('0x2e')]),'penalty':0x0,'paused':_0x7bb11e[_0x5964('0x5f')],'createdAt':_0x7bb11e[_0x5964('0x61')],'updatedAt':_0x7bb11e[_0x5964('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5964('0x28')](respondWithFilteredResult(_0x391af6,_0x5bc502))['catch'](handleError(_0x391af6,null));};exports[_0x5964('0x64')]=function(_0x5447c8,_0x33fede,_0xcc0d96){var _0x1cf874={};var _0x2e2fce={};var _0x453429;var _0x26ad7c;return db[_0x5964('0x32')]['findOne']({'where':{'id':_0x5447c8[_0x5964('0x4b')]['id']}})[_0x5964('0x28')](handleEntityNotFound(_0x33fede,null))[_0x5964('0x28')](function(_0x46d9a4){if(_0x46d9a4){_0x453429=_0x46d9a4;_0x2e2fce[_0x5964('0x39')]=_[_0x5964('0x35')](db[_0x5964('0x65')][_0x5964('0x59')]);_0x2e2fce[_0x5964('0x36')]=_['keys'](_0x5447c8[_0x5964('0x36')]);_0x2e2fce[_0x5964('0x37')]=_[_0x5964('0x38')](_0x2e2fce[_0x5964('0x39')],_0x2e2fce['query']);_0x1cf874[_0x5964('0x3b')]=_[_0x5964('0x38')](_0x2e2fce[_0x5964('0x39')],qs[_0x5964('0x3a')](_0x5447c8[_0x5964('0x36')][_0x5964('0x3a')]));_0x1cf874[_0x5964('0x3b')]=_0x1cf874[_0x5964('0x3b')][_0x5964('0x3c')]?_0x1cf874[_0x5964('0x3b')]:_0x2e2fce['model'];_0x1cf874[_0x5964('0x3e')]=qs[_0x5964('0x3f')](_0x5447c8[_0x5964('0x36')][_0x5964('0x3f')]);_0x1cf874['where']=qs['filters'](_[_0x5964('0x66')](_0x5447c8[_0x5964('0x36')],_0x2e2fce['filters']));if(_0x5447c8[_0x5964('0x36')][_0x5964('0x43')]){_0x1cf874['where']=_['merge'](_0x1cf874['where'],{'$or':_['map'](_0x1cf874[_0x5964('0x3b')],function(_0xe3155d){var _0x1cea92={};_0x1cea92[_0xe3155d]={'$like':'%'+_0x5447c8[_0x5964('0x36')][_0x5964('0x43')]+'%'};return _0x1cea92;})});}_0x1cf874=_['merge']({},_0x1cf874,_0x5447c8[_0x5964('0x44')]);return _0x453429[_0x5964('0x64')](_0x1cf874);}})[_0x5964('0x28')](function(_0x15f10f){if(_0x15f10f){_0x26ad7c=_0x15f10f[_0x5964('0x3c')];if(!_0x5447c8[_0x5964('0x36')][_0x5964('0x3d')](_0x5964('0x5a'))){_0x1cf874[_0x5964('0x21')]=qs[_0x5964('0x21')](_0x5447c8[_0x5964('0x36')]['limit']);_0x1cf874[_0x5964('0x20')]=qs[_0x5964('0x20')](_0x5447c8[_0x5964('0x36')][_0x5964('0x20')]);}return _0x453429[_0x5964('0x64')](_0x1cf874);}})[_0x5964('0x28')](function(_0x3589fb){if(_0x3589fb){return _0x3589fb?{'count':_0x26ad7c,'rows':_0x3589fb}:null;}})[_0x5964('0x28')](respondWithResult(_0x33fede,null))[_0x5964('0x49')](handleError(_0x33fede,null));};exports['addTeams']=function(_0x55af03,_0x27613a,_0x4dd908){var _0x38d75d=_0x55af03[_0x5964('0x4d')][_0x5964('0x67')];return db['Team'][_0x5964('0x47')]({'where':{'id':_0x38d75d},'attributes':['id'],'include':[{'model':db[_0x5964('0x5c')],'as':_0x5964('0x68'),'attributes':['id',_0x5964('0x2e'),_0x5964('0x69'),'voicePause',_0x5964('0x6a')],'raw':!![]}]})[_0x5964('0x28')](function(_0x68e39e){if(_0x68e39e){var _0x3a793a=_[_0x5964('0x6b')](_0x68e39e,function(_0x3844ed){var _0x36adb4=_0x3844ed['get']({'plain':!![]});return _0x36adb4[_0x5964('0x68')];});return db[_0x5964('0x32')]['find']({'where':{'id':_0x55af03['params']['id']}})['then'](function(_0x303e1c){return db['sequelize']['transaction'](function(_0x5e288c){return _0x303e1c[_0x5964('0x6c')](_0x38d75d,{'transaction':_0x5e288c})[_0x5964('0x28')](function(){return BPromise[_0x5964('0x6d')](_0x3a793a,function(_0x40c174){return db[_0x5964('0x58')][_0x5964('0x6e')]({'where':{'UserId':_0x40c174['id'],'OpenchannelQueueId':_0x55af03[_0x5964('0x4b')]['id']},'transaction':_0x5e288c});});})[_0x5964('0x28')](function(){_0x3a793a[_0x5964('0x6f')](function(_0x3f4562){socket[_0x5964('0x70')](_0x5964('0x71'),{'UserId':_0x3f4562['id'],'OpenchannelQueueId':_0x303e1c['id']});});});});});}})[_0x5964('0x28')](respondWithStatusCode(_0x27613a,null))['catch'](handleError(_0x27613a,null));};exports[_0x5964('0x72')]=function(_0x2c4148,_0xa5197c,_0x7e94e1){return db[_0x5964('0x65')][_0x5964('0x47')]({'where':{'id':_0x2c4148[_0x5964('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5964('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa5197c,null))[_0x5964('0x28')](function(_0x297dd6){var _0x6fc8d1=_[_0x5964('0x31')](_0x297dd6,'id');var _0x1ef994=[];var _0x322680=[];var _0x46bb24=squel[_0x5964('0x73')]();_0x46bb24['field'](_0x5964('0x74'))[_0x5964('0x75')](_0x5964('0x76'),'tq')[_0x5964('0x77')](_0x5964('0x78'),'ut',_0x5964('0x79'))['where'](_0x5964('0x7a'),_0x2c4148[_0x5964('0x4b')]['id']);for(var _0x82979f=0x0;_0x82979f<_0x297dd6[_0x5964('0x3c')];_0x82979f+=0x1){let _0x2f28b3=_0x297dd6[_0x82979f];for(var _0x12d86e=0x0;_0x12d86e<_0x2f28b3[_0x5964('0x68')]['length'];_0x12d86e+=0x1){let _0x5537d1=_0x2f28b3[_0x5964('0x68')][_0x12d86e];var _0x12f9e2=_0x46bb24[_0x5964('0x7b')]();_0x12f9e2[_0x5964('0x40')]('ut.UserId\x20=\x20?',_0x5537d1['id']);_0x322680[_0x5964('0x7c')](db[_0x5964('0x7d')]['query'](_0x12f9e2[_0x5964('0x7e')](),{'type':db[_0x5964('0x7d')][_0x5964('0x7f')][_0x5964('0x80')]})['then'](function(_0x505a42){if(_0x505a42['length']===0x1){return _0x5537d1['id'];}else{var _0x4bcc35=_[_0x5964('0x81')](_[_0x5964('0x31')](_0x505a42,'TeamId'),function(_0x3212da){return _[_0x5964('0x82')](_0x6fc8d1,_0x3212da);});if(_0x4bcc35){return _0x5537d1['id'];}}}));}}return BPromise['all'](_0x322680)[_0x5964('0x28')](function(_0xe636f9){_0x1ef994=_(_0x1ef994)[_0x5964('0x83')](_0xe636f9)[_0x5964('0x84')]()[_0x5964('0x85')]();return db[_0x5964('0x32')][_0x5964('0x51')]({'where':{'id':_0x2c4148['params']['id']}})[_0x5964('0x28')](function(_0x57ed38){return db[_0x5964('0x7d')][_0x5964('0x86')](function(_0x1031d9){return _0x57ed38[_0x5964('0x72')](_0x2c4148[_0x5964('0x36')][_0x5964('0x67')],{'transaction':_0x1031d9})['then'](function(){if(!_[_0x5964('0x87')](_0x1ef994)){return _0x57ed38['removeAgents'](_0x1ef994,{'transaction':_0x1031d9});}})[_0x5964('0x28')](function(){_0x1ef994[_0x5964('0x6f')](function(_0x551bae){socket['emit'](_0x5964('0x88'),{'UserId':_0x551bae,'OpenchannelQueueId':_0x57ed38['id']});});});});});});})[_0x5964('0x28')](respondWithStatusCode(_0xa5197c,null))[_0x5964('0x49')](handleError(_0xa5197c,null));};exports['addAgents']=function(_0x5643a9,_0x787bf9,_0x101dc0){return db['OpenchannelQueue'][_0x5964('0x51')]({'where':{'id':_0x5643a9['params']['id']}})[_0x5964('0x28')](handleEntityNotFound(_0x787bf9,null))[_0x5964('0x28')](function(_0x249f3b){if(_0x249f3b){return _0x249f3b[_0x5964('0x89')](_0x5643a9['body'][_0x5964('0x67')],_[_0x5964('0x8a')](_0x5643a9[_0x5964('0x4d')],[_0x5964('0x67'),'id'])||{})['spread'](function(_0x47a5ad){for(var _0x8d69d6=0x0;_0x8d69d6<_0x5643a9[_0x5964('0x4d')][_0x5964('0x67')][_0x5964('0x3c')];_0x8d69d6+=0x1){socket[_0x5964('0x70')](_0x5964('0x71'),{'UserId':Number(_0x5643a9[_0x5964('0x4d')]['ids'][_0x8d69d6]),'OpenchannelQueueId':Number(_0x5643a9[_0x5964('0x4b')]['id'])});}return _0x47a5ad;});}})[_0x5964('0x28')](respondWithResult(_0x787bf9,null))[_0x5964('0x49')](handleError(_0x787bf9,null));};exports[_0x5964('0x8b')]=function(_0x1054d7,_0x3d21c7,_0x4a3924){return db[_0x5964('0x32')]['find']({'where':{'id':_0x1054d7[_0x5964('0x4b')]['id']}})[_0x5964('0x28')](handleEntityNotFound(_0x3d21c7,null))[_0x5964('0x28')](function(_0x491e14){if(_0x491e14){return _0x491e14['removeAgents'](_0x1054d7['query'][_0x5964('0x67')])[_0x5964('0x28')](function(){if(_[_0x5964('0x8c')](_0x1054d7[_0x5964('0x36')]['ids'])){for(var _0x4e0f95=0x0;_0x4e0f95<_0x1054d7[_0x5964('0x36')][_0x5964('0x67')][_0x5964('0x3c')];_0x4e0f95+=0x1){socket[_0x5964('0x70')](_0x5964('0x88'),{'UserId':Number(_0x1054d7[_0x5964('0x36')][_0x5964('0x67')][_0x4e0f95]),'OpenchannelQueueId':Number(_0x1054d7[_0x5964('0x4b')]['id'])});}}else{socket['emit'](_0x5964('0x88'),{'UserId':Number(_0x1054d7['query'][_0x5964('0x67')]),'OpenchannelQueueId':Number(_0x1054d7[_0x5964('0x4b')]['id'])});}});}})[_0x5964('0x28')](respondWithStatusCode(_0x3d21c7,null))[_0x5964('0x49')](handleError(_0x3d21c7,null));};exports[_0x5964('0x8d')]=function(_0x51899d,_0x51073d,_0x526a5a){var _0x455c65={};var _0x438865={};var _0x34781d;var _0x1a5f00;return db[_0x5964('0x32')][_0x5964('0x57')]({'where':{'id':_0x51899d[_0x5964('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51073d,null))['then'](function(_0x5a2868){if(_0x5a2868){_0x34781d=_0x5a2868;_0x438865[_0x5964('0x39')]=_[_0x5964('0x35')](db[_0x5964('0x5c')][_0x5964('0x59')]);_0x438865[_0x5964('0x36')]=_[_0x5964('0x35')](_0x51899d['query']);_0x438865[_0x5964('0x37')]=_[_0x5964('0x38')](_0x438865[_0x5964('0x39')],_0x438865[_0x5964('0x36')]);_0x455c65[_0x5964('0x3b')]=_[_0x5964('0x38')](_0x438865[_0x5964('0x39')],qs['fields'](_0x51899d[_0x5964('0x36')][_0x5964('0x3a')]));_0x455c65[_0x5964('0x3b')]=_0x455c65[_0x5964('0x3b')]['length']?_0x455c65[_0x5964('0x3b')]:_0x438865[_0x5964('0x39')];_0x455c65['order']=qs[_0x5964('0x3f')](_0x51899d['query'][_0x5964('0x3f')]);_0x455c65[_0x5964('0x40')]=qs['filters'](_[_0x5964('0x66')](_0x51899d[_0x5964('0x36')],_0x438865[_0x5964('0x37')]));if(_0x51899d['query']['filter']){_0x455c65[_0x5964('0x40')]=_[_0x5964('0x41')](_0x455c65[_0x5964('0x40')],{'$or':_[_0x5964('0x31')](_0x455c65[_0x5964('0x3b')],function(_0x22adf9){var _0xecb48b={};_0xecb48b[_0x22adf9]={'$like':'%'+_0x51899d[_0x5964('0x36')][_0x5964('0x43')]+'%'};return _0xecb48b;})});}_0x455c65=_[_0x5964('0x41')]({},_0x455c65,_0x51899d['options']);return _0x34781d[_0x5964('0x8d')](_0x455c65);}})[_0x5964('0x28')](function(_0x1b6da1){if(_0x1b6da1){_0x1a5f00=_0x1b6da1[_0x5964('0x3c')];if(!_0x51899d['query'][_0x5964('0x3d')](_0x5964('0x5a'))){_0x455c65[_0x5964('0x21')]=qs[_0x5964('0x21')](_0x51899d['query'][_0x5964('0x21')]);_0x455c65['offset']=qs[_0x5964('0x20')](_0x51899d[_0x5964('0x36')][_0x5964('0x20')]);}return _0x34781d[_0x5964('0x8d')](_0x455c65);}})['then'](function(_0x506aef){if(_0x506aef){return _0x506aef?{'count':_0x1a5f00,'rows':_0x506aef}:null;}})['then'](respondWithResult(_0x51073d,null))[_0x5964('0x49')](handleError(_0x51073d,null));}; \ No newline at end of file +var _0x2b12=['role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','getTeams','Team','addTeams','ids','interface','Agents','transaction','each','forEach','emit','userOpenchannelQueue:save','User','select','from','team_has_openchannel_queues','join','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','removeTeams','isEmpty','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x47a366,_0x3918c4){var _0x5dd54e=function(_0x23d473){while(--_0x23d473){_0x47a366['push'](_0x47a366['shift']());}};_0x5dd54e(++_0x3918c4);}(_0x2b12,0xb4));var _0x22b1=function(_0x159b60,_0x2997b9){_0x159b60=_0x159b60-0x0;var _0x5aa670=_0x2b12[_0x159b60];return _0x5aa670;};'use strict';var emlformat=require(_0x22b1('0x0'));var rimraf=require(_0x22b1('0x1'));var zipdir=require(_0x22b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22b1('0x3'));var moment=require(_0x22b1('0x4'));var BPromise=require(_0x22b1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x22b1('0x6'));var sox=require('sox');var csv=require(_0x22b1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22b1('0x8'));var _=require(_0x22b1('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x22b1('0xa'));var toCsv=require('to-csv');var querystring=require(_0x22b1('0xb'));var Papa=require(_0x22b1('0xc'));var Redis=require(_0x22b1('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x22b1('0xe'));var hardwareService=require(_0x22b1('0xf'));var logger=require('../../config/logger')(_0x22b1('0x10'));var utils=require(_0x22b1('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x22b1('0x12'));var db=require(_0x22b1('0x13'))['db'];config[_0x22b1('0x14')]=_[_0x22b1('0x15')](config['redis'],{'host':_0x22b1('0x16'),'port':0x18eb});var socket=require(_0x22b1('0x17'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x22b1('0x18')](socket);function respondWithStatusCode(_0x460c5c,_0x186d5e){_0x186d5e=_0x186d5e||0xcc;return function(_0x4fa823){if(_0x4fa823){return _0x460c5c[_0x22b1('0x19')](_0x186d5e);}return _0x460c5c[_0x22b1('0x1a')](_0x186d5e)[_0x22b1('0x1b')]();};}function respondWithResult(_0x4e80a0,_0x1951a9){_0x1951a9=_0x1951a9||0xc8;return function(_0xe2ef87){if(_0xe2ef87){return _0x4e80a0['status'](_0x1951a9)['json'](_0xe2ef87);}};}function respondWithFilteredResult(_0x50828b,_0x4b4e7f){return function(_0x556f65){if(_0x556f65){var _0x117055=typeof _0x4b4e7f[_0x22b1('0x1c')]===_0x22b1('0x1d')&&typeof _0x4b4e7f[_0x22b1('0x1e')]===_0x22b1('0x1d');var _0x2dc149=_0x556f65['count'];var _0x24bd66=_0x117055?0x0:_0x4b4e7f[_0x22b1('0x1c')];var _0x3fc824=_0x117055?_0x556f65[_0x22b1('0x1f')]:_0x4b4e7f['offset']+_0x4b4e7f[_0x22b1('0x1e')];var _0x4c406f;if(_0x3fc824>=_0x2dc149){_0x3fc824=_0x2dc149;_0x4c406f=0xc8;}else{_0x4c406f=0xce;}_0x50828b[_0x22b1('0x1a')](_0x4c406f);return _0x50828b['set'](_0x22b1('0x20'),_0x24bd66+'-'+_0x3fc824+'/'+_0x2dc149)['json'](_0x556f65);}return null;};}function patchUpdates(_0x5a1130){return function(_0x1d45a0){try{jsonpatch[_0x22b1('0x21')](_0x1d45a0,_0x5a1130,!![]);}catch(_0x2cd62d){return BPromise[_0x22b1('0x22')](_0x2cd62d);}return _0x1d45a0[_0x22b1('0x23')]();};}function saveUpdates(_0x1eb434,_0x372d20){return function(_0x5d901a){if(_0x5d901a){return _0x5d901a[_0x22b1('0x24')](_0x1eb434)[_0x22b1('0x25')](function(_0x509140){return _0x509140;});}return null;};}function removeEntity(_0x4e7593,_0x55221c){return function(_0x53aa91){if(_0x53aa91){return _0x53aa91[_0x22b1('0x26')]()[_0x22b1('0x25')](function(){var _0x419e39=_0x53aa91['get']({'plain':!![]});var _0xec4be6=_0x22b1('0x27');return db[_0x22b1('0x28')][_0x22b1('0x26')]({'where':{'type':_0xec4be6,'resourceId':_0x419e39['id']}})['then'](function(){return _0x53aa91;});})['then'](function(){_0x4e7593[_0x22b1('0x1a')](0xcc)[_0x22b1('0x1b')]();});}};}function handleEntityNotFound(_0x24346e,_0x47cd7c){return function(_0xb47384){if(!_0xb47384){_0x24346e[_0x22b1('0x19')](0x194);}return _0xb47384;};}function handleError(_0xab165b,_0x106a36){_0x106a36=_0x106a36||0x1f4;return function(_0xd7a981){logger[_0x22b1('0x29')](_0xd7a981[_0x22b1('0x2a')]);if(_0xd7a981[_0x22b1('0x2b')]){delete _0xd7a981[_0x22b1('0x2b')];}_0xab165b['status'](_0x106a36)[_0x22b1('0x2c')](_0xd7a981);};}exports['index']=function(_0x3b138a,_0xcfe666){var _0x23ed68={},_0x182b79={},_0x4d344a={'count':0x0,'rows':[]};var _0x4c37d3=_['map'](db[_0x22b1('0x2d')][_0x22b1('0x2e')],function(_0xaf8fe7){return{'name':_0xaf8fe7[_0x22b1('0x2f')],'type':_0xaf8fe7[_0x22b1('0x30')][_0x22b1('0x31')]};});_0x182b79[_0x22b1('0x32')]=_[_0x22b1('0x33')](_0x4c37d3,_0x22b1('0x2b'));_0x182b79[_0x22b1('0x34')]=_[_0x22b1('0x35')](_0x3b138a[_0x22b1('0x34')]);_0x182b79[_0x22b1('0x36')]=_[_0x22b1('0x37')](_0x182b79[_0x22b1('0x32')],_0x182b79['query']);_0x23ed68[_0x22b1('0x38')]=_[_0x22b1('0x37')](_0x182b79[_0x22b1('0x32')],qs['fields'](_0x3b138a[_0x22b1('0x34')][_0x22b1('0x39')]));_0x23ed68[_0x22b1('0x38')]=_0x23ed68['attributes'][_0x22b1('0x3a')]?_0x23ed68[_0x22b1('0x38')]:_0x182b79[_0x22b1('0x32')];if(!_0x3b138a[_0x22b1('0x34')][_0x22b1('0x3b')](_0x22b1('0x3c'))){_0x23ed68[_0x22b1('0x1e')]=qs[_0x22b1('0x1e')](_0x3b138a[_0x22b1('0x34')][_0x22b1('0x1e')]);_0x23ed68[_0x22b1('0x1c')]=qs['offset'](_0x3b138a[_0x22b1('0x34')]['offset']);}_0x23ed68[_0x22b1('0x3d')]=qs['sort'](_0x3b138a['query'][_0x22b1('0x3e')]);_0x23ed68[_0x22b1('0x3f')]=qs['filters'](_[_0x22b1('0x40')](_0x3b138a[_0x22b1('0x34')],_0x182b79[_0x22b1('0x36')]),_0x4c37d3);if(_0x3b138a[_0x22b1('0x34')][_0x22b1('0x41')]){_0x23ed68['where']=_[_0x22b1('0x42')](_0x23ed68['where'],{'$or':_['map'](_0x4c37d3,function(_0xa79161){if(_0xa79161['type']!=='VIRTUAL'){var _0xdcb5f={};_0xdcb5f[_0xa79161[_0x22b1('0x2b')]]={'$like':'%'+_0x3b138a[_0x22b1('0x34')][_0x22b1('0x41')]+'%'};return _0xdcb5f;}})});}_0x23ed68=_[_0x22b1('0x42')]({},_0x23ed68,_0x3b138a['options']);var _0x4567e5={'where':_0x23ed68[_0x22b1('0x3f')]};return db[_0x22b1('0x2d')][_0x22b1('0x1f')](_0x4567e5)[_0x22b1('0x25')](function(_0x1b949e){_0x4d344a[_0x22b1('0x1f')]=_0x1b949e;if(_0x3b138a[_0x22b1('0x34')]['includeAll']){_0x23ed68[_0x22b1('0x43')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x22b1('0x44')](_0x23ed68);})[_0x22b1('0x25')](function(_0x4ab328){_0x4d344a[_0x22b1('0x45')]=_0x4ab328;return _0x4d344a;})[_0x22b1('0x25')](respondWithFilteredResult(_0xcfe666,_0x23ed68))[_0x22b1('0x46')](handleError(_0xcfe666,null));};exports[_0x22b1('0x47')]=function(_0x1de787,_0x52b4ec){var _0x4f77df={'raw':!![],'where':{'id':_0x1de787[_0x22b1('0x48')]['id']}},_0x35e229={};_0x35e229[_0x22b1('0x32')]=_[_0x22b1('0x35')](db[_0x22b1('0x2d')][_0x22b1('0x2e')]);_0x35e229[_0x22b1('0x34')]=_[_0x22b1('0x35')](_0x1de787[_0x22b1('0x34')]);_0x35e229[_0x22b1('0x36')]=_[_0x22b1('0x37')](_0x35e229[_0x22b1('0x32')],_0x35e229[_0x22b1('0x34')]);_0x4f77df['attributes']=_[_0x22b1('0x37')](_0x35e229['model'],qs[_0x22b1('0x39')](_0x1de787['query'][_0x22b1('0x39')]));_0x4f77df[_0x22b1('0x38')]=_0x4f77df['attributes'][_0x22b1('0x3a')]?_0x4f77df[_0x22b1('0x38')]:_0x35e229['model'];if(_0x1de787[_0x22b1('0x34')][_0x22b1('0x49')]){_0x4f77df[_0x22b1('0x43')]=[{'all':!![]}];}_0x4f77df=_['merge']({},_0x4f77df,_0x1de787[_0x22b1('0x4a')]);return db[_0x22b1('0x2d')][_0x22b1('0x4b')](_0x4f77df)['then'](handleEntityNotFound(_0x52b4ec,null))[_0x22b1('0x25')](respondWithResult(_0x52b4ec,null))['catch'](handleError(_0x52b4ec,null));};exports[_0x22b1('0x4c')]=function(_0x508b8b,_0x1307cf){return db[_0x22b1('0x2d')][_0x22b1('0x4c')](_0x508b8b[_0x22b1('0x4d')],{})[_0x22b1('0x25')](function(_0x7878c1){var _0x373906=_0x508b8b[_0x22b1('0x4e')]['get']({'plain':!![]});if(!_0x373906)throw new Error(_0x22b1('0x4f'));if(_0x373906[_0x22b1('0x50')]==='user'){var _0x200c9b=_0x7878c1[_0x22b1('0x51')]({'plain':!![]});var _0x198318=_0x22b1('0x27');return db[_0x22b1('0x52')][_0x22b1('0x4b')]({'where':{'name':_0x198318,'userProfileId':_0x373906['userProfileId']},'raw':!![]})['then'](function(_0x15a1b2){if(_0x15a1b2&&_0x15a1b2['autoAssociation']===0x0){return db[_0x22b1('0x28')][_0x22b1('0x4c')]({'name':_0x200c9b[_0x22b1('0x2b')],'resourceId':_0x200c9b['id'],'type':_0x15a1b2[_0x22b1('0x2b')],'sectionId':_0x15a1b2['id']},{})['then'](function(){return _0x7878c1;});}else{return _0x7878c1;}})[_0x22b1('0x46')](function(_0xae3827){logger[_0x22b1('0x29')](_0x22b1('0x53'),_0xae3827);throw _0xae3827;});}return _0x7878c1;})[_0x22b1('0x25')](respondWithResult(_0x1307cf,0xc9))[_0x22b1('0x46')](handleError(_0x1307cf,null));};exports['update']=function(_0x170f91,_0x220aed){if(_0x170f91[_0x22b1('0x4d')]['id']){delete _0x170f91[_0x22b1('0x4d')]['id'];}return db[_0x22b1('0x2d')][_0x22b1('0x4b')]({'where':{'id':_0x170f91[_0x22b1('0x48')]['id']}})[_0x22b1('0x25')](handleEntityNotFound(_0x220aed,null))[_0x22b1('0x25')](saveUpdates(_0x170f91[_0x22b1('0x4d')],null))[_0x22b1('0x25')](respondWithResult(_0x220aed,null))['catch'](handleError(_0x220aed,null));};exports[_0x22b1('0x26')]=function(_0x4c378f,_0x58288c){return db['OpenchannelQueue'][_0x22b1('0x4b')]({'where':{'id':_0x4c378f[_0x22b1('0x48')]['id']}})[_0x22b1('0x25')](handleEntityNotFound(_0x58288c,null))[_0x22b1('0x25')](removeEntity(_0x58288c,null))[_0x22b1('0x46')](handleError(_0x58288c,null));};exports['describe']=function(_0x1a2ccb,_0x54597d){return db[_0x22b1('0x2d')]['describe']()[_0x22b1('0x25')](respondWithResult(_0x54597d,null))[_0x22b1('0x46')](handleError(_0x54597d,null));};exports[_0x22b1('0x54')]=function(_0x55faae,_0x244b2e,_0x264bc3){var _0x1259ab={'raw':!![],'where':{}},_0x225311={},_0x240b14;return db[_0x22b1('0x2d')][_0x22b1('0x55')]({'where':{'id':_0x55faae[_0x22b1('0x48')]['id']}})[_0x22b1('0x25')](handleEntityNotFound(_0x244b2e,null))[_0x22b1('0x25')](function(_0x4fe2e9){if(_0x4fe2e9){_0x240b14=_0x4fe2e9[_0x22b1('0x51')]({'plain':!![]});_0x225311[_0x22b1('0x32')]=_[_0x22b1('0x35')](db[_0x22b1('0x56')][_0x22b1('0x2e')]);_0x225311[_0x22b1('0x34')]=_[_0x22b1('0x35')](_0x55faae['query']);_0x225311[_0x22b1('0x36')]=_[_0x22b1('0x37')](_0x225311[_0x22b1('0x32')],_0x225311[_0x22b1('0x34')]);_0x1259ab['attributes']=_[_0x22b1('0x37')](_0x225311['model'],qs[_0x22b1('0x39')](_0x55faae['query'][_0x22b1('0x39')]));_0x1259ab[_0x22b1('0x38')]=_0x1259ab[_0x22b1('0x38')][_0x22b1('0x3a')]?_0x1259ab['attributes']:_0x225311['model'];if(!_0x55faae[_0x22b1('0x34')][_0x22b1('0x3b')](_0x22b1('0x3c'))){_0x1259ab[_0x22b1('0x1e')]=qs[_0x22b1('0x1e')](_0x55faae['query'][_0x22b1('0x1e')]);_0x1259ab[_0x22b1('0x1c')]=qs[_0x22b1('0x1c')](_0x55faae[_0x22b1('0x34')][_0x22b1('0x1c')]);}_0x1259ab['order']=qs[_0x22b1('0x3e')](_0x55faae[_0x22b1('0x34')][_0x22b1('0x3e')]);_0x1259ab[_0x22b1('0x3f')]=qs[_0x22b1('0x36')](_[_0x22b1('0x40')](_0x55faae[_0x22b1('0x34')],_0x225311[_0x22b1('0x36')]));_0x1259ab[_0x22b1('0x3f')][_0x22b1('0x57')]=_0x4fe2e9['id'];if(_0x55faae[_0x22b1('0x34')][_0x22b1('0x41')]){_0x1259ab[_0x22b1('0x3f')]=_[_0x22b1('0x42')](_0x1259ab[_0x22b1('0x3f')],{'$or':_[_0x22b1('0x33')](_0x1259ab[_0x22b1('0x38')],function(_0x489542){var _0xd92abc={};_0xd92abc[_0x489542]={'$like':'%'+_0x55faae[_0x22b1('0x34')]['filter']+'%'};return _0xd92abc;})});}_0x1259ab=_[_0x22b1('0x42')]({},_0x1259ab,_0x55faae[_0x22b1('0x4a')]);return db[_0x22b1('0x56')][_0x22b1('0x44')](_0x1259ab);}})[_0x22b1('0x25')](function(_0x193823){if(_0x193823){return db['User'][_0x22b1('0x58')]({'where':{'id':_['map'](_0x193823,'UserId'),'role':_0x22b1('0x59')},'attributes':['id',_0x22b1('0x2b'),_0x22b1('0x5a'),_0x22b1('0x5b'),_0x22b1('0x5c')]});}})[_0x22b1('0x25')](function(_0x20f867){if(_0x20f867){return{'count':_0x20f867[_0x22b1('0x1f')],'rows':_[_0x22b1('0x33')](_0x20f867[_0x22b1('0x45')],function(_0x36ee82){return{'membername':_0x36ee82[_0x22b1('0x2b')],'UserId':_0x36ee82['id'],'queue_name':_0x240b14[_0x22b1('0x2b')],'OpenchannelQueueId':_0x240b14['id'],'interface':util[_0x22b1('0x5d')]('%s/%s','SIP',_0x36ee82['name']),'penalty':0x0,'paused':_0x36ee82[_0x22b1('0x5a')],'createdAt':_0x36ee82[_0x22b1('0x5c')],'updatedAt':_0x36ee82[_0x22b1('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x22b1('0x25')](respondWithFilteredResult(_0x244b2e,_0x1259ab))['catch'](handleError(_0x244b2e,null));};exports[_0x22b1('0x5e')]=function(_0x3b0584,_0x1a4c06,_0x3a7e8f){var _0x3155e5={};var _0x2d5341={};var _0x46c8a2;var _0xd87962;return db[_0x22b1('0x2d')][_0x22b1('0x55')]({'where':{'id':_0x3b0584[_0x22b1('0x48')]['id']}})[_0x22b1('0x25')](handleEntityNotFound(_0x1a4c06,null))['then'](function(_0xf058cc){if(_0xf058cc){_0x46c8a2=_0xf058cc;_0x2d5341[_0x22b1('0x32')]=_[_0x22b1('0x35')](db[_0x22b1('0x5f')][_0x22b1('0x2e')]);_0x2d5341['query']=_[_0x22b1('0x35')](_0x3b0584['query']);_0x2d5341[_0x22b1('0x36')]=_[_0x22b1('0x37')](_0x2d5341[_0x22b1('0x32')],_0x2d5341[_0x22b1('0x34')]);_0x3155e5['attributes']=_[_0x22b1('0x37')](_0x2d5341[_0x22b1('0x32')],qs['fields'](_0x3b0584[_0x22b1('0x34')][_0x22b1('0x39')]));_0x3155e5[_0x22b1('0x38')]=_0x3155e5[_0x22b1('0x38')][_0x22b1('0x3a')]?_0x3155e5[_0x22b1('0x38')]:_0x2d5341['model'];_0x3155e5[_0x22b1('0x3d')]=qs[_0x22b1('0x3e')](_0x3b0584[_0x22b1('0x34')][_0x22b1('0x3e')]);_0x3155e5[_0x22b1('0x3f')]=qs[_0x22b1('0x36')](_['pick'](_0x3b0584[_0x22b1('0x34')],_0x2d5341[_0x22b1('0x36')]));if(_0x3b0584[_0x22b1('0x34')][_0x22b1('0x41')]){_0x3155e5['where']=_[_0x22b1('0x42')](_0x3155e5['where'],{'$or':_['map'](_0x3155e5[_0x22b1('0x38')],function(_0x1abd2c){var _0xc48d53={};_0xc48d53[_0x1abd2c]={'$like':'%'+_0x3b0584['query'][_0x22b1('0x41')]+'%'};return _0xc48d53;})});}_0x3155e5=_[_0x22b1('0x42')]({},_0x3155e5,_0x3b0584[_0x22b1('0x4a')]);return _0x46c8a2['getTeams'](_0x3155e5);}})[_0x22b1('0x25')](function(_0x355228){if(_0x355228){_0xd87962=_0x355228[_0x22b1('0x3a')];if(!_0x3b0584[_0x22b1('0x34')][_0x22b1('0x3b')](_0x22b1('0x3c'))){_0x3155e5[_0x22b1('0x1e')]=qs[_0x22b1('0x1e')](_0x3b0584[_0x22b1('0x34')]['limit']);_0x3155e5[_0x22b1('0x1c')]=qs[_0x22b1('0x1c')](_0x3b0584[_0x22b1('0x34')]['offset']);}return _0x46c8a2[_0x22b1('0x5e')](_0x3155e5);}})['then'](function(_0x566e24){if(_0x566e24){return _0x566e24?{'count':_0xd87962,'rows':_0x566e24}:null;}})[_0x22b1('0x25')](respondWithResult(_0x1a4c06,null))[_0x22b1('0x46')](handleError(_0x1a4c06,null));};exports[_0x22b1('0x60')]=function(_0x23f0e6,_0x2f610c,_0x5785a4){var _0x1ca5c5=_0x23f0e6[_0x22b1('0x4d')][_0x22b1('0x61')];return db[_0x22b1('0x5f')]['findAll']({'where':{'id':_0x1ca5c5},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x22b1('0x2b'),'online','voicePause',_0x22b1('0x62')],'raw':!![]}]})[_0x22b1('0x25')](function(_0x4a57a0){if(_0x4a57a0){var _0x13747e=_['flatMap'](_0x4a57a0,function(_0x78f8b3){var _0x146eb3=_0x78f8b3[_0x22b1('0x51')]({'plain':!![]});return _0x146eb3[_0x22b1('0x63')];});return db[_0x22b1('0x2d')][_0x22b1('0x4b')]({'where':{'id':_0x23f0e6[_0x22b1('0x48')]['id']}})[_0x22b1('0x25')](function(_0x5747f0){return db['sequelize'][_0x22b1('0x64')](function(_0x1e2b4f){return _0x5747f0[_0x22b1('0x60')](_0x1ca5c5,{'transaction':_0x1e2b4f})[_0x22b1('0x25')](function(){return BPromise[_0x22b1('0x65')](_0x13747e,function(_0x308e25){return db[_0x22b1('0x56')]['findOrCreate']({'where':{'UserId':_0x308e25['id'],'OpenchannelQueueId':_0x23f0e6['params']['id']},'transaction':_0x1e2b4f});});})[_0x22b1('0x25')](function(){_0x13747e[_0x22b1('0x66')](function(_0x3ea7e1){socket[_0x22b1('0x67')](_0x22b1('0x68'),{'UserId':_0x3ea7e1['id'],'OpenchannelQueueId':_0x5747f0['id']});});});});});}})[_0x22b1('0x25')](respondWithStatusCode(_0x2f610c,null))[_0x22b1('0x46')](handleError(_0x2f610c,null));};exports['removeTeams']=function(_0x3ce965,_0x3e9d16,_0x4b2ed8){return db[_0x22b1('0x5f')][_0x22b1('0x44')]({'where':{'id':_0x3ce965[_0x22b1('0x34')][_0x22b1('0x61')]},'attributes':['id'],'include':[{'model':db[_0x22b1('0x69')],'as':_0x22b1('0x63'),'attributes':['id'],'raw':!![]}]})[_0x22b1('0x25')](handleEntityNotFound(_0x3e9d16,null))[_0x22b1('0x25')](function(_0x4fccf0){var _0xc86e25=_['map'](_0x4fccf0,'id');var _0x421164=[];var _0xed5859=[];var _0xcfc38d=squel[_0x22b1('0x6a')]();_0xcfc38d['field']('tq.TeamId')[_0x22b1('0x6b')](_0x22b1('0x6c'),'tq')[_0x22b1('0x6d')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x22b1('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x3ce965['params']['id']);for(var _0x1708c5=0x0;_0x1708c5<_0x4fccf0[_0x22b1('0x3a')];_0x1708c5+=0x1){let _0x180d63=_0x4fccf0[_0x1708c5];for(var _0x23ddea=0x0;_0x23ddea<_0x180d63[_0x22b1('0x63')][_0x22b1('0x3a')];_0x23ddea+=0x1){let _0x355d2a=_0x180d63[_0x22b1('0x63')][_0x23ddea];var _0x33cccf=_0xcfc38d[_0x22b1('0x6e')]();_0x33cccf[_0x22b1('0x3f')](_0x22b1('0x6f'),_0x355d2a['id']);_0xed5859[_0x22b1('0x70')](db[_0x22b1('0x71')][_0x22b1('0x34')](_0x33cccf[_0x22b1('0x72')](),{'type':db[_0x22b1('0x71')][_0x22b1('0x73')][_0x22b1('0x74')]})[_0x22b1('0x25')](function(_0x374637){if(_0x374637[_0x22b1('0x3a')]===0x1){return _0x355d2a['id'];}else{var _0x3c8472=_[_0x22b1('0x75')](_[_0x22b1('0x33')](_0x374637,_0x22b1('0x76')),function(_0x237ea1){return _['includes'](_0xc86e25,_0x237ea1);});if(_0x3c8472){return _0x355d2a['id'];}}}));}}return BPromise[_0x22b1('0x77')](_0xed5859)[_0x22b1('0x25')](function(_0x4bb5c9){_0x421164=_(_0x421164)['union'](_0x4bb5c9)[_0x22b1('0x78')]()[_0x22b1('0x79')]();return db['OpenchannelQueue'][_0x22b1('0x4b')]({'where':{'id':_0x3ce965[_0x22b1('0x48')]['id']}})[_0x22b1('0x25')](function(_0xc3bc6e){return db[_0x22b1('0x71')][_0x22b1('0x64')](function(_0x5a571b){return _0xc3bc6e[_0x22b1('0x7a')](_0x3ce965[_0x22b1('0x34')][_0x22b1('0x61')],{'transaction':_0x5a571b})[_0x22b1('0x25')](function(){if(!_[_0x22b1('0x7b')](_0x421164)){return _0xc3bc6e['removeAgents'](_0x421164,{'transaction':_0x5a571b});}})[_0x22b1('0x25')](function(){_0x421164[_0x22b1('0x66')](function(_0x4dfe48){socket[_0x22b1('0x67')]('userOpenchannelQueue:remove',{'UserId':_0x4dfe48,'OpenchannelQueueId':_0xc3bc6e['id']});});});});});});})['then'](respondWithStatusCode(_0x3e9d16,null))[_0x22b1('0x46')](handleError(_0x3e9d16,null));};exports[_0x22b1('0x7c')]=function(_0x4ecff1,_0x377cd4,_0x42d5d5){return db['OpenchannelQueue'][_0x22b1('0x4b')]({'where':{'id':_0x4ecff1['params']['id']}})[_0x22b1('0x25')](handleEntityNotFound(_0x377cd4,null))[_0x22b1('0x25')](function(_0x30684b){if(_0x30684b){return _0x30684b[_0x22b1('0x7c')](_0x4ecff1[_0x22b1('0x4d')]['ids'],_[_0x22b1('0x7d')](_0x4ecff1[_0x22b1('0x4d')],['ids','id'])||{})[_0x22b1('0x7e')](function(_0x4210c5){for(var _0x1a5a23=0x0;_0x1a5a23<_0x4ecff1[_0x22b1('0x4d')][_0x22b1('0x61')]['length'];_0x1a5a23+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x4ecff1['body']['ids'][_0x1a5a23]),'OpenchannelQueueId':Number(_0x4ecff1['params']['id'])});}return _0x4210c5;});}})[_0x22b1('0x25')](respondWithResult(_0x377cd4,null))[_0x22b1('0x46')](handleError(_0x377cd4,null));};exports[_0x22b1('0x7f')]=function(_0x227041,_0x282071,_0x2606c1){return db[_0x22b1('0x2d')][_0x22b1('0x4b')]({'where':{'id':_0x227041['params']['id']}})[_0x22b1('0x25')](handleEntityNotFound(_0x282071,null))[_0x22b1('0x25')](function(_0x5ba9fc){if(_0x5ba9fc){return _0x5ba9fc['removeAgents'](_0x227041['query']['ids'])[_0x22b1('0x25')](function(){if(_[_0x22b1('0x80')](_0x227041[_0x22b1('0x34')][_0x22b1('0x61')])){for(var _0xb9adf3=0x0;_0xb9adf3<_0x227041[_0x22b1('0x34')][_0x22b1('0x61')][_0x22b1('0x3a')];_0xb9adf3+=0x1){socket[_0x22b1('0x67')]('userOpenchannelQueue:remove',{'UserId':Number(_0x227041['query'][_0x22b1('0x61')][_0xb9adf3]),'OpenchannelQueueId':Number(_0x227041[_0x22b1('0x48')]['id'])});}}else{socket[_0x22b1('0x67')]('userOpenchannelQueue:remove',{'UserId':Number(_0x227041[_0x22b1('0x34')]['ids']),'OpenchannelQueueId':Number(_0x227041['params']['id'])});}});}})[_0x22b1('0x25')](respondWithStatusCode(_0x282071,null))['catch'](handleError(_0x282071,null));};exports[_0x22b1('0x81')]=function(_0x105aa4,_0x3f2354,_0x14bb86){var _0x5bd3d9={};var _0x56c75d={};var _0xe867c6;var _0x160241;return db[_0x22b1('0x2d')][_0x22b1('0x55')]({'where':{'id':_0x105aa4[_0x22b1('0x48')]['id']}})[_0x22b1('0x25')](handleEntityNotFound(_0x3f2354,null))[_0x22b1('0x25')](function(_0xc36e13){if(_0xc36e13){_0xe867c6=_0xc36e13;_0x56c75d[_0x22b1('0x32')]=_[_0x22b1('0x35')](db[_0x22b1('0x69')][_0x22b1('0x2e')]);_0x56c75d[_0x22b1('0x34')]=_['keys'](_0x105aa4['query']);_0x56c75d[_0x22b1('0x36')]=_[_0x22b1('0x37')](_0x56c75d[_0x22b1('0x32')],_0x56c75d['query']);_0x5bd3d9[_0x22b1('0x38')]=_[_0x22b1('0x37')](_0x56c75d[_0x22b1('0x32')],qs[_0x22b1('0x39')](_0x105aa4[_0x22b1('0x34')]['fields']));_0x5bd3d9[_0x22b1('0x38')]=_0x5bd3d9[_0x22b1('0x38')]['length']?_0x5bd3d9['attributes']:_0x56c75d['model'];_0x5bd3d9[_0x22b1('0x3d')]=qs[_0x22b1('0x3e')](_0x105aa4['query'][_0x22b1('0x3e')]);_0x5bd3d9[_0x22b1('0x3f')]=qs[_0x22b1('0x36')](_[_0x22b1('0x40')](_0x105aa4[_0x22b1('0x34')],_0x56c75d['filters']));if(_0x105aa4['query']['filter']){_0x5bd3d9[_0x22b1('0x3f')]=_[_0x22b1('0x42')](_0x5bd3d9['where'],{'$or':_[_0x22b1('0x33')](_0x5bd3d9[_0x22b1('0x38')],function(_0x124dbe){var _0x2ed881={};_0x2ed881[_0x124dbe]={'$like':'%'+_0x105aa4['query'][_0x22b1('0x41')]+'%'};return _0x2ed881;})});}_0x5bd3d9=_[_0x22b1('0x42')]({},_0x5bd3d9,_0x105aa4[_0x22b1('0x4a')]);return _0xe867c6['getAgents'](_0x5bd3d9);}})[_0x22b1('0x25')](function(_0x69820c){if(_0x69820c){_0x160241=_0x69820c[_0x22b1('0x3a')];if(!_0x105aa4['query'][_0x22b1('0x3b')](_0x22b1('0x3c'))){_0x5bd3d9[_0x22b1('0x1e')]=qs[_0x22b1('0x1e')](_0x105aa4[_0x22b1('0x34')]['limit']);_0x5bd3d9[_0x22b1('0x1c')]=qs[_0x22b1('0x1c')](_0x105aa4[_0x22b1('0x34')][_0x22b1('0x1c')]);}return _0xe867c6[_0x22b1('0x81')](_0x5bd3d9);}})[_0x22b1('0x25')](function(_0x51433b){if(_0x51433b){return _0x51433b?{'count':_0x160241,'rows':_0x51433b}:null;}})[_0x22b1('0x25')](respondWithResult(_0x3f2354,null))['catch'](handleError(_0x3f2354,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f1317fe..0035cf5 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 _0x5345=['exports','events','../../mysqldb','OpenchannelQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5bef59,_0x5a122e){var _0x55210f=function(_0x123eed){while(--_0x123eed){_0x5bef59['push'](_0x5bef59['shift']());}};_0x55210f(++_0x5a122e);}(_0x5345,0x65));var _0x5534=function(_0x11642e,_0xbd5bca){_0x11642e=_0x11642e-0x0;var _0x3aca14=_0x5345[_0x11642e];return _0x3aca14;};'use strict';var EventEmitter=require(_0x5534('0x0'));var OpenchannelQueue=require(_0x5534('0x1'))['db'][_0x5534('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5534('0x3'),'afterUpdate':_0x5534('0x4'),'afterDestroy':_0x5534('0x5')};function emitEvent(_0x5615cb){return function(_0xff404a,_0x5e1bb6,_0x482990){OpenchannelQueueEvents[_0x5534('0x6')](_0x5615cb+':'+_0xff404a['id'],_0xff404a);OpenchannelQueueEvents[_0x5534('0x6')](_0x5615cb,_0xff404a);_0x482990(null);};}for(var e in events){if(events[_0x5534('0x7')](e)){var event=events[e];OpenchannelQueue[_0x5534('0x8')](e,emitEvent(event));}}module[_0x5534('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x8972=['exports','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8972,0x76));var _0x2897=function(_0x4a956f,_0x2e8d5c){_0x4a956f=_0x4a956f-0x0;var _0x48571a=_0x8972[_0x4a956f];return _0x48571a;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x2897('0x0'))['db'][_0x2897('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2897('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2897('0x3'),'afterDestroy':_0x2897('0x4')};function emitEvent(_0x4def7e){return function(_0x37f3d6,_0x1ff381,_0x39342d){OpenchannelQueueEvents[_0x2897('0x5')](_0x4def7e+':'+_0x37f3d6['id'],_0x37f3d6);OpenchannelQueueEvents['emit'](_0x4def7e,_0x37f3d6);_0x39342d(null);};}for(var e in events){if(events[_0x2897('0x6')](e)){var event=events[e];OpenchannelQueue[_0x2897('0x7')](e,emitEvent(event));}}module[_0x2897('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index dfa579e..83435ff 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 _0x7715=['OpenchannelQueue','openchannel_queues','lodash','util','api','moment','bluebird','path','rimraf','./openchannelQueue.attributes','exports','define'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x7715,0x122));var _0x5771=function(_0x18a8cd,_0xfbfa8e){_0x18a8cd=_0x18a8cd-0x0;var _0xc738a3=_0x7715[_0x18a8cd];return _0xc738a3;};'use strict';var _=require(_0x5771('0x0'));var util=require(_0x5771('0x1'));var logger=require('../../config/logger')(_0x5771('0x2'));var moment=require(_0x5771('0x3'));var BPromise=require(_0x5771('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5771('0x5'));var rimraf=require(_0x5771('0x6'));var config=require('../../config/environment');var attributes=require(_0x5771('0x7'));module[_0x5771('0x8')]=function(_0x4c214c,_0x4dd0e0){return _0x4c214c[_0x5771('0x9')](_0x5771('0xa'),attributes,{'tableName':_0x5771('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0539=['bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','lodash','util','../../config/logger','api','moment'];(function(_0x37574f,_0x55684c){var _0x6c6d03=function(_0x2e4ff5){while(--_0x2e4ff5){_0x37574f['push'](_0x37574f['shift']());}};_0x6c6d03(++_0x55684c);}(_0x0539,0x103));var _0x9053=function(_0x5846fe,_0x803adc){_0x5846fe=_0x5846fe-0x0;var _0x1ff45a=_0x0539[_0x5846fe];return _0x1ff45a;};'use strict';var _=require(_0x9053('0x0'));var util=require(_0x9053('0x1'));var logger=require(_0x9053('0x2'))(_0x9053('0x3'));var moment=require(_0x9053('0x4'));var BPromise=require(_0x9053('0x5'));var rp=require(_0x9053('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9053('0x7'));var config=require(_0x9053('0x8'));var attributes=require(_0x9053('0x9'));module[_0x9053('0xa')]=function(_0x243488,_0x3693fd){return _0x243488['define'](_0x9053('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index b2019f5..8d2a7b4 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 _0xa340=['info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','then','GetOpenchannelQueue','debug','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','request'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa340,0x137));var _0x0a34=function(_0x52fa77,_0x2b381b){_0x52fa77=_0x52fa77-0x0;var _0x477535=_0xa340[_0x52fa77];return _0x477535;};'use strict';var _=require(_0x0a34('0x0'));var util=require(_0x0a34('0x1'));var moment=require('moment');var BPromise=require(_0x0a34('0x2'));var rs=require(_0x0a34('0x3'));var fs=require('fs');var Redis=require(_0x0a34('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a34('0x5'));var logger=require('../../config/logger')(_0x0a34('0x6'));var config=require('../../config/environment');var jayson=require(_0x0a34('0x7'));var client=jayson[_0x0a34('0x8')][_0x0a34('0x9')]({'port':0x232a});config['redis']=_[_0x0a34('0xa')](config['redis'],{'host':_0x0a34('0xb'),'port':0x18eb});var socket=require(_0x0a34('0xc'))(new Redis(config[_0x0a34('0xd')]));require(_0x0a34('0xe'))[_0x0a34('0xf')](socket);function respondWithRpcPromise(_0x270553,_0x3524c2,_0xf21a7){return new BPromise(function(_0x37c0f6,_0x4ad0ba){return client[_0x0a34('0x10')](_0x270553,_0xf21a7)['then'](function(_0x4a22c3){logger[_0x0a34('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x3524c2,_0x0a34('0x12'));logger['debug'](_0x0a34('0x13'),_0x3524c2,_0x0a34('0x12'),JSON[_0x0a34('0x14')](_0x4a22c3));if(_0x4a22c3['error']){if(_0x4a22c3[_0x0a34('0x15')][_0x0a34('0x16')]===0x1f4){logger[_0x0a34('0x15')](_0x0a34('0x17'),_0x3524c2,_0x4a22c3['error'][_0x0a34('0x18')]);return _0x4ad0ba(_0x4a22c3[_0x0a34('0x15')][_0x0a34('0x18')]);}logger[_0x0a34('0x15')](_0x0a34('0x17'),_0x3524c2,_0x4a22c3[_0x0a34('0x15')][_0x0a34('0x18')]);return _0x37c0f6(_0x4a22c3[_0x0a34('0x15')][_0x0a34('0x18')]);}else{logger[_0x0a34('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x3524c2,_0x0a34('0x12'));_0x37c0f6(_0x4a22c3[_0x0a34('0x19')][_0x0a34('0x18')]);}})[_0x0a34('0x1a')](function(_0x115d79){logger[_0x0a34('0x15')](_0x0a34('0x17'),_0x3524c2,_0x115d79);_0x4ad0ba(_0x115d79);});});}exports['GetOpenchannelQueue']=function(_0x269e40){var _0x7d23b3=this;return new Promise(function(_0x3395e8,_0x56504b){return db[_0x0a34('0x1b')][_0x0a34('0x1c')]({'raw':_0x269e40[_0x0a34('0x1d')]?_0x269e40[_0x0a34('0x1d')][_0x0a34('0x1e')]===undefined?!![]:![]:!![],'where':_0x269e40[_0x0a34('0x1d')]?_0x269e40[_0x0a34('0x1d')]['where']||null:null,'attributes':_0x269e40['options']?_0x269e40[_0x0a34('0x1d')][_0x0a34('0x1f')]||null:null,'limit':_0x269e40[_0x0a34('0x1d')]?_0x269e40[_0x0a34('0x1d')][_0x0a34('0x20')]||null:null,'include':_0x269e40['options']?_0x269e40[_0x0a34('0x1d')][_0x0a34('0x21')]?_[_0x0a34('0x22')](_0x269e40[_0x0a34('0x1d')][_0x0a34('0x21')],function(_0x1a8b5d){return{'model':db[_0x1a8b5d[_0x0a34('0x23')]],'as':_0x1a8b5d['as'],'attributes':_0x1a8b5d['attributes'],'include':_0x1a8b5d['include']?_[_0x0a34('0x22')](_0x1a8b5d[_0x0a34('0x21')],function(_0x26c660){return{'model':db[_0x26c660[_0x0a34('0x23')]],'as':_0x26c660['as'],'attributes':_0x26c660[_0x0a34('0x1f')],'include':_0x26c660['include']?_['map'](_0x26c660[_0x0a34('0x21')],function(_0x377037){return{'model':db[_0x377037[_0x0a34('0x23')]],'as':_0x377037['as'],'attributes':_0x377037[_0x0a34('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0a34('0x24')](function(_0x212f36){logger[_0x0a34('0x11')](_0x0a34('0x25'),_0x269e40);logger[_0x0a34('0x26')](_0x0a34('0x25'),_0x269e40,JSON[_0x0a34('0x14')](_0x212f36));_0x3395e8(_0x212f36);})[_0x0a34('0x1a')](function(_0x2eddd1){logger[_0x0a34('0x15')]('GetOpenchannelQueue',_0x2eddd1['message'],_0x269e40);_0x56504b(_0x7d23b3[_0x0a34('0x15')](0x1f4,_0x2eddd1['message']));});});};exports[_0x0a34('0x27')]=function(_0x55a985){var _0x4ea357=this;return new Promise(function(_0x4c930c,_0x3ad460){return db[_0x0a34('0x1b')][_0x0a34('0x28')]({'raw':_0x55a985[_0x0a34('0x1d')]?_0x55a985[_0x0a34('0x1d')][_0x0a34('0x1e')]===undefined?!![]:![]:!![],'where':_0x55a985['options']?_0x55a985['options']['where']||null:null,'attributes':_0x55a985[_0x0a34('0x1d')]?_0x55a985[_0x0a34('0x1d')]['attributes']||null:null,'include':_0x55a985[_0x0a34('0x1d')]?_0x55a985[_0x0a34('0x1d')]['include']?_[_0x0a34('0x22')](_0x55a985['options'][_0x0a34('0x21')],function(_0x2c0f37){return{'model':db[_0x2c0f37[_0x0a34('0x23')]],'as':_0x2c0f37['as'],'attributes':_0x2c0f37[_0x0a34('0x1f')],'include':_0x2c0f37[_0x0a34('0x21')]?_['map'](_0x2c0f37[_0x0a34('0x21')],function(_0x40ecb6){return{'model':db[_0x40ecb6[_0x0a34('0x23')]],'as':_0x40ecb6['as'],'attributes':_0x40ecb6[_0x0a34('0x1f')],'include':_0x40ecb6[_0x0a34('0x21')]?_['map'](_0x40ecb6[_0x0a34('0x21')],function(_0xd90604){return{'model':db[_0xd90604[_0x0a34('0x23')]],'as':_0xd90604['as'],'attributes':_0xd90604['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a34('0x24')](function(_0xc0f0fe){logger[_0x0a34('0x11')](_0x0a34('0x27'),_0x55a985);logger['debug'](_0x0a34('0x27'),_0x55a985,JSON['stringify'](_0xc0f0fe));_0x4c930c(_0xc0f0fe);})[_0x0a34('0x1a')](function(_0x1cd5ae){logger[_0x0a34('0x15')](_0x0a34('0x27'),_0x1cd5ae[_0x0a34('0x18')],_0x55a985);_0x3ad460(_0x4ea357['error'](0x1f4,_0x1cd5ae[_0x0a34('0x18')]));});});}; \ No newline at end of file +var _0xad57=['then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request'];(function(_0x3719b6,_0x31f62a){var _0x599c6d=function(_0x4a0829){while(--_0x4a0829){_0x3719b6['push'](_0x3719b6['shift']());}};_0x599c6d(++_0x31f62a);}(_0xad57,0x1e5));var _0x7ad5=function(_0xb0599c,_0x91220e){_0xb0599c=_0xb0599c-0x0;var _0xd5a288=_0xad57[_0xb0599c];return _0xd5a288;};'use strict';var _=require(_0x7ad5('0x0'));var util=require(_0x7ad5('0x1'));var moment=require(_0x7ad5('0x2'));var BPromise=require(_0x7ad5('0x3'));var rs=require(_0x7ad5('0x4'));var fs=require('fs');var Redis=require(_0x7ad5('0x5'));var db=require(_0x7ad5('0x6'))['db'];var utils=require(_0x7ad5('0x7'));var logger=require(_0x7ad5('0x8'))(_0x7ad5('0x9'));var config=require(_0x7ad5('0xa'));var jayson=require(_0x7ad5('0xb'));var client=jayson[_0x7ad5('0xc')][_0x7ad5('0xd')]({'port':0x232a});config[_0x7ad5('0xe')]=_[_0x7ad5('0xf')](config[_0x7ad5('0xe')],{'host':_0x7ad5('0x10'),'port':0x18eb});var socket=require(_0x7ad5('0x11'))(new Redis(config[_0x7ad5('0xe')]));require(_0x7ad5('0x12'))[_0x7ad5('0x13')](socket);function respondWithRpcPromise(_0x433a67,_0x40a94f,_0x14972b){return new BPromise(function(_0x58b21b,_0x79d5e5){return client[_0x7ad5('0x14')](_0x433a67,_0x14972b)[_0x7ad5('0x15')](function(_0x34e0f5){logger[_0x7ad5('0x16')](_0x7ad5('0x17'),_0x40a94f,'request\x20sent');logger[_0x7ad5('0x18')](_0x7ad5('0x19'),_0x40a94f,_0x7ad5('0x1a'),JSON[_0x7ad5('0x1b')](_0x34e0f5));if(_0x34e0f5[_0x7ad5('0x1c')]){if(_0x34e0f5['error'][_0x7ad5('0x1d')]===0x1f4){logger[_0x7ad5('0x1c')]('OpenchannelQueue,\x20%s,\x20%s',_0x40a94f,_0x34e0f5[_0x7ad5('0x1c')][_0x7ad5('0x1e')]);return _0x79d5e5(_0x34e0f5[_0x7ad5('0x1c')][_0x7ad5('0x1e')]);}logger[_0x7ad5('0x1c')](_0x7ad5('0x17'),_0x40a94f,_0x34e0f5[_0x7ad5('0x1c')]['message']);return _0x58b21b(_0x34e0f5[_0x7ad5('0x1c')][_0x7ad5('0x1e')]);}else{logger['info'](_0x7ad5('0x17'),_0x40a94f,_0x7ad5('0x1a'));_0x58b21b(_0x34e0f5[_0x7ad5('0x1f')][_0x7ad5('0x1e')]);}})[_0x7ad5('0x20')](function(_0xfd6a0a){logger[_0x7ad5('0x1c')](_0x7ad5('0x17'),_0x40a94f,_0xfd6a0a);_0x79d5e5(_0xfd6a0a);});});}exports[_0x7ad5('0x21')]=function(_0x263a04){var _0x30a3af=this;return new Promise(function(_0x1dacb8,_0x4ed908){return db[_0x7ad5('0x22')][_0x7ad5('0x23')]({'raw':_0x263a04[_0x7ad5('0x24')]?_0x263a04[_0x7ad5('0x24')][_0x7ad5('0x25')]===undefined?!![]:![]:!![],'where':_0x263a04['options']?_0x263a04[_0x7ad5('0x24')][_0x7ad5('0x26')]||null:null,'attributes':_0x263a04['options']?_0x263a04[_0x7ad5('0x24')][_0x7ad5('0x27')]||null:null,'limit':_0x263a04[_0x7ad5('0x24')]?_0x263a04[_0x7ad5('0x24')][_0x7ad5('0x28')]||null:null,'include':_0x263a04[_0x7ad5('0x24')]?_0x263a04['options'][_0x7ad5('0x29')]?_[_0x7ad5('0x2a')](_0x263a04['options'][_0x7ad5('0x29')],function(_0x249d0b){return{'model':db[_0x249d0b['model']],'as':_0x249d0b['as'],'attributes':_0x249d0b[_0x7ad5('0x27')],'include':_0x249d0b[_0x7ad5('0x29')]?_[_0x7ad5('0x2a')](_0x249d0b[_0x7ad5('0x29')],function(_0x770347){return{'model':db[_0x770347[_0x7ad5('0x2b')]],'as':_0x770347['as'],'attributes':_0x770347[_0x7ad5('0x27')],'include':_0x770347[_0x7ad5('0x29')]?_[_0x7ad5('0x2a')](_0x770347[_0x7ad5('0x29')],function(_0x1b8700){return{'model':db[_0x1b8700[_0x7ad5('0x2b')]],'as':_0x1b8700['as'],'attributes':_0x1b8700[_0x7ad5('0x27')]};}):[]};}):[]};}):[]:[]})[_0x7ad5('0x15')](function(_0x40d543){logger[_0x7ad5('0x16')]('GetOpenchannelQueue',_0x263a04);logger['debug'](_0x7ad5('0x21'),_0x263a04,JSON[_0x7ad5('0x1b')](_0x40d543));_0x1dacb8(_0x40d543);})[_0x7ad5('0x20')](function(_0x4a1da5){logger[_0x7ad5('0x1c')]('GetOpenchannelQueue',_0x4a1da5[_0x7ad5('0x1e')],_0x263a04);_0x4ed908(_0x30a3af['error'](0x1f4,_0x4a1da5[_0x7ad5('0x1e')]));});});};exports[_0x7ad5('0x2c')]=function(_0x14f8ee){var _0x2d35f4=this;return new Promise(function(_0x3aa09c,_0x103230){return db[_0x7ad5('0x22')][_0x7ad5('0x2d')]({'raw':_0x14f8ee[_0x7ad5('0x24')]?_0x14f8ee[_0x7ad5('0x24')][_0x7ad5('0x25')]===undefined?!![]:![]:!![],'where':_0x14f8ee[_0x7ad5('0x24')]?_0x14f8ee[_0x7ad5('0x24')][_0x7ad5('0x26')]||null:null,'attributes':_0x14f8ee[_0x7ad5('0x24')]?_0x14f8ee[_0x7ad5('0x24')][_0x7ad5('0x27')]||null:null,'include':_0x14f8ee[_0x7ad5('0x24')]?_0x14f8ee['options'][_0x7ad5('0x29')]?_['map'](_0x14f8ee[_0x7ad5('0x24')]['include'],function(_0x44bc81){return{'model':db[_0x44bc81[_0x7ad5('0x2b')]],'as':_0x44bc81['as'],'attributes':_0x44bc81[_0x7ad5('0x27')],'include':_0x44bc81[_0x7ad5('0x29')]?_[_0x7ad5('0x2a')](_0x44bc81[_0x7ad5('0x29')],function(_0x2c5cc7){return{'model':db[_0x2c5cc7[_0x7ad5('0x2b')]],'as':_0x2c5cc7['as'],'attributes':_0x2c5cc7[_0x7ad5('0x27')],'include':_0x2c5cc7['include']?_[_0x7ad5('0x2a')](_0x2c5cc7['include'],function(_0x3f9251){return{'model':db[_0x3f9251[_0x7ad5('0x2b')]],'as':_0x3f9251['as'],'attributes':_0x3f9251['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ad5('0x15')](function(_0x13bd7f){logger[_0x7ad5('0x16')](_0x7ad5('0x2c'),_0x14f8ee);logger[_0x7ad5('0x18')]('ShowOpenchannelQueue',_0x14f8ee,JSON[_0x7ad5('0x1b')](_0x13bd7f));_0x3aa09c(_0x13bd7f);})[_0x7ad5('0x20')](function(_0x5693f0){logger['error']('ShowOpenchannelQueue',_0x5693f0[_0x7ad5('0x1e')],_0x14f8ee);_0x103230(_0x2d35f4['error'](0x1f4,_0x5693f0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 2e986fa..8a87b49 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 _0x51f2=['./openchannelQueue.events','save','remove','update','emit','removeListener','length','openchannelQueue:'];(function(_0x2bb82d,_0x42c7f8){var _0x5e0b92=function(_0x19f44b){while(--_0x19f44b){_0x2bb82d['push'](_0x2bb82d['shift']());}};_0x5e0b92(++_0x42c7f8);}(_0x51f2,0x100));var _0x251f=function(_0x3a6516,_0x5684ad){_0x3a6516=_0x3a6516-0x0;var _0x159bdd=_0x51f2[_0x3a6516];return _0x159bdd;};'use strict';var OpenchannelQueueEvents=require(_0x251f('0x0'));var events=[_0x251f('0x1'),_0x251f('0x2'),_0x251f('0x3')];function createListener(_0x4f439d,_0x43a53d){return function(_0x4f26a3){_0x43a53d[_0x251f('0x4')](_0x4f439d,_0x4f26a3);};}function removeListener(_0x436c20,_0x285f74){return function(){OpenchannelQueueEvents[_0x251f('0x5')](_0x436c20,_0x285f74);};}exports['register']=function(_0x2ac9ab){for(var _0x53ce2c=0x0,_0x23543f=events[_0x251f('0x6')];_0x53ce2c<_0x23543f;_0x53ce2c++){var _0x52e1a8=events[_0x53ce2c];var _0x52f4d8=createListener(_0x251f('0x7')+_0x52e1a8,_0x2ac9ab);OpenchannelQueueEvents['on'](_0x52e1a8,_0x52f4d8);}}; \ No newline at end of file +var _0xc7df=['update','emit','register','length','openchannelQueue:','save','remove'];(function(_0xa3ca0f,_0x456a23){var _0x529ee7=function(_0x343778){while(--_0x343778){_0xa3ca0f['push'](_0xa3ca0f['shift']());}};_0x529ee7(++_0x456a23);}(_0xc7df,0xd0));var _0xfc7d=function(_0x2780df,_0x3e9f41){_0x2780df=_0x2780df-0x0;var _0x2862a1=_0xc7df[_0x2780df];return _0x2862a1;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xfc7d('0x0'),_0xfc7d('0x1'),_0xfc7d('0x2')];function createListener(_0x2e7946,_0x2e7e7a){return function(_0x57e65c){_0x2e7e7a[_0xfc7d('0x3')](_0x2e7946,_0x57e65c);};}function removeListener(_0x2ca4d8,_0x2509e6){return function(){OpenchannelQueueEvents['removeListener'](_0x2ca4d8,_0x2509e6);};}exports[_0xfc7d('0x4')]=function(_0x12bd38){for(var _0x47da35=0x0,_0x24d2ad=events[_0xfc7d('0x5')];_0x47da35<_0x24d2ad;_0x47da35++){var _0x4fadba=events[_0x47da35];var _0x596dc9=createListener(_0xfc7d('0x6')+_0x4fadba,_0x12bd38);OpenchannelQueueEvents['on'](_0x4fadba,_0x596dc9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index a4b7684..981a47d 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 _0x83a9=['index','/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x2df0b6,_0x4865a2){var _0x4a4970=function(_0x9df29f){while(--_0x9df29f){_0x2df0b6['push'](_0x2df0b6['shift']());}};_0x4a4970(++_0x4865a2);}(_0x83a9,0x1c1));var _0x983a=function(_0x45262e,_0x1d9c0b){_0x45262e=_0x45262e-0x0;var _0x3b7f60=_0x83a9[_0x45262e];return _0x3b7f60;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x983a('0x0'));var timeout=require(_0x983a('0x1'));var express=require('express');var router=express[_0x983a('0x2')]();var fs_extra=require(_0x983a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x983a('0x4'));var config=require(_0x983a('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x983a('0x6')]('/',auth['isAuthenticated'](),controller[_0x983a('0x7')]);router[_0x983a('0x6')](_0x983a('0x8'),auth['isAuthenticated'](),controller[_0x983a('0x9')]);router['get'](_0x983a('0xa'),auth[_0x983a('0xb')](),controller['show']);router[_0x983a('0xc')]('/',auth[_0x983a('0xb')](),controller[_0x983a('0xd')]);router[_0x983a('0xe')]('/:id',auth[_0x983a('0xb')](),controller[_0x983a('0xf')]);router[_0x983a('0x10')](_0x983a('0xa'),auth['isAuthenticated'](),controller[_0x983a('0x11')]);module[_0x983a('0x12')]=router; \ No newline at end of file +var _0x378c=['describe','/:id','post','put','update','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x5d897,_0x469fee){var _0xc60754=function(_0x540ea9){while(--_0x540ea9){_0x5d897['push'](_0x5d897['shift']());}};_0xc60754(++_0x469fee);}(_0x378c,0x1c1));var _0xc378=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x378c[_0x4a53d];return _0x27410e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc378('0x0'));var express=require(_0xc378('0x1'));var router=express['Router']();var fs_extra=require(_0xc378('0x2'));var auth=require(_0xc378('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc378('0x4'));var controller=require(_0xc378('0x5'));router[_0xc378('0x6')]('/',auth[_0xc378('0x7')](),controller[_0xc378('0x8')]);router['get'](_0xc378('0x9'),auth[_0xc378('0x7')](),controller[_0xc378('0xa')]);router['get'](_0xc378('0xb'),auth[_0xc378('0x7')](),controller['show']);router[_0xc378('0xc')]('/',auth[_0xc378('0x7')](),controller['create']);router[_0xc378('0xd')]('/:id',auth[_0xc378('0x7')](),controller[_0xc378('0xe')]);router['delete'](_0xc378('0xb'),auth[_0xc378('0x7')](),controller[_0xc378('0xf')]);module[_0xc378('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 06f316c..1796c72 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 _0xb6ba=['DATE','moment','exports','STRING'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0xb6ba,0x189));var _0xab6b=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xb6ba[_0x126fb9];return _0xc8a3b1;};'use strict';var moment=require(_0xab6b('0x0'));var Sequelize=require('sequelize');module[_0xab6b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xab6b('0x2')]},'joinAt':{'type':Sequelize[_0xab6b('0x3')]},'leaveAt':{'type':Sequelize[_0xab6b('0x3')]},'acceptAt':{'type':Sequelize[_0xab6b('0x3')]},'exitAt':{'type':Sequelize[_0xab6b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb768=['DATE','moment','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb768,0x7d));var _0x8b76=function(_0x18bf20,_0x23f00d){_0x18bf20=_0x18bf20-0x0;var _0xc51620=_0xb768[_0x18bf20];return _0xc51620;};'use strict';var moment=require(_0x8b76('0x0'));var Sequelize=require('sequelize');module[_0x8b76('0x1')]={'uniqueid':{'type':Sequelize[_0x8b76('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8b76('0x3')]},'leaveAt':{'type':Sequelize[_0x8b76('0x3')]},'acceptAt':{'type':Sequelize[_0x8b76('0x3')]},'exitAt':{'type':Sequelize[_0x8b76('0x3')]},'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 bdb335b..2e83119 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 _0x0251=['fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelQueueReport','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','api','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x1d5491,_0x22de2a){var _0xe139=function(_0x8ef588){while(--_0x8ef588){_0x1d5491['push'](_0x1d5491['shift']());}};_0xe139(++_0x22de2a);}(_0x0251,0x12c));var _0x1025=function(_0xc89111,_0x21063f){_0xc89111=_0xc89111-0x0;var _0x3c1a8f=_0x0251[_0xc89111];return _0x3c1a8f;};'use strict';var emlformat=require(_0x1025('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1025('0x1'));var jsonpatch=require(_0x1025('0x2'));var rp=require('request-promise');var moment=require(_0x1025('0x3'));var BPromise=require(_0x1025('0x4'));var Mustache=require(_0x1025('0x5'));var util=require('util');var path=require(_0x1025('0x6'));var sox=require(_0x1025('0x7'));var csv=require(_0x1025('0x8'));var ejs=require(_0x1025('0x9'));var fs=require('fs');var fs_extra=require(_0x1025('0xa'));var _=require('lodash');var squel=require(_0x1025('0xb'));var crypto=require(_0x1025('0xc'));var jsforce=require(_0x1025('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1025('0x8'));var querystring=require('querystring');var Papa=require(_0x1025('0xe'));var Redis=require('ioredis');var authService=require(_0x1025('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1025('0x10'));var logger=require('../../config/logger')(_0x1025('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1025('0x12'))['db'];function respondWithStatusCode(_0xf91f08,_0xcc188c){_0xcc188c=_0xcc188c||0xcc;return function(_0x5d155b){if(_0x5d155b){return _0xf91f08['sendStatus'](_0xcc188c);}return _0xf91f08[_0x1025('0x13')](_0xcc188c)[_0x1025('0x14')]();};}function respondWithResult(_0x2b2457,_0x256f96){_0x256f96=_0x256f96||0xc8;return function(_0x322229){if(_0x322229){return _0x2b2457[_0x1025('0x13')](_0x256f96)[_0x1025('0x15')](_0x322229);}};}function respondWithFilteredResult(_0x3dc8a0,_0x563961){return function(_0x3aeef0){if(_0x3aeef0){var _0x30585b=typeof _0x563961[_0x1025('0x16')]===_0x1025('0x17')&&typeof _0x563961[_0x1025('0x18')]===_0x1025('0x17');var _0xc840d0=_0x3aeef0[_0x1025('0x19')];var _0xa61ebe=_0x30585b?0x0:_0x563961[_0x1025('0x16')];var _0x54603a=_0x30585b?_0x3aeef0[_0x1025('0x19')]:_0x563961['offset']+_0x563961[_0x1025('0x18')];var _0x512e69;if(_0x54603a>=_0xc840d0){_0x54603a=_0xc840d0;_0x512e69=0xc8;}else{_0x512e69=0xce;}_0x3dc8a0[_0x1025('0x13')](_0x512e69);return _0x3dc8a0['set'](_0x1025('0x1a'),_0xa61ebe+'-'+_0x54603a+'/'+_0xc840d0)[_0x1025('0x15')](_0x3aeef0);}return null;};}function patchUpdates(_0x492ecd){return function(_0x92c711){try{jsonpatch[_0x1025('0x1b')](_0x92c711,_0x492ecd,!![]);}catch(_0x45c623){return BPromise['reject'](_0x45c623);}return _0x92c711['save']();};}function saveUpdates(_0x4d3f19,_0x2884a1){return function(_0x4ad2d8){if(_0x4ad2d8){return _0x4ad2d8[_0x1025('0x1c')](_0x4d3f19)[_0x1025('0x1d')](function(_0x4171b3){return _0x4171b3;});}return null;};}function removeEntity(_0x313907,_0x519fd1){return function(_0x3a8161){if(_0x3a8161){return _0x3a8161[_0x1025('0x1e')]()[_0x1025('0x1d')](function(){_0x313907[_0x1025('0x13')](0xcc)[_0x1025('0x14')]();});}};}function handleEntityNotFound(_0x24b1a5,_0x149012){return function(_0xe72ad1){if(!_0xe72ad1){_0x24b1a5['sendStatus'](0x194);}return _0xe72ad1;};}function handleError(_0x31c30b,_0x1e1200){_0x1e1200=_0x1e1200||0x1f4;return function(_0x6fc814){logger[_0x1025('0x1f')](_0x6fc814[_0x1025('0x20')]);if(_0x6fc814[_0x1025('0x21')]){delete _0x6fc814['name'];}_0x31c30b[_0x1025('0x13')](_0x1e1200)[_0x1025('0x22')](_0x6fc814);};}exports['index']=function(_0x295e06,_0xbf9e4c){var _0x578ddd={},_0x4d13e8={},_0x43471e={'count':0x0,'rows':[]};var _0x5d7a8f=_[_0x1025('0x23')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x147f0f){return{'name':_0x147f0f[_0x1025('0x24')],'type':_0x147f0f[_0x1025('0x25')][_0x1025('0x26')]};});_0x4d13e8[_0x1025('0x27')]=_[_0x1025('0x23')](_0x5d7a8f,_0x1025('0x21'));_0x4d13e8[_0x1025('0x28')]=_[_0x1025('0x29')](_0x295e06[_0x1025('0x28')]);_0x4d13e8[_0x1025('0x2a')]=_['intersection'](_0x4d13e8[_0x1025('0x27')],_0x4d13e8['query']);_0x578ddd[_0x1025('0x2b')]=_[_0x1025('0x2c')](_0x4d13e8[_0x1025('0x27')],qs[_0x1025('0x2d')](_0x295e06['query'][_0x1025('0x2d')]));_0x578ddd[_0x1025('0x2b')]=_0x578ddd[_0x1025('0x2b')]['length']?_0x578ddd[_0x1025('0x2b')]:_0x4d13e8[_0x1025('0x27')];if(!_0x295e06[_0x1025('0x28')][_0x1025('0x2e')](_0x1025('0x2f'))){_0x578ddd[_0x1025('0x18')]=qs[_0x1025('0x18')](_0x295e06[_0x1025('0x28')][_0x1025('0x18')]);_0x578ddd[_0x1025('0x16')]=qs[_0x1025('0x16')](_0x295e06[_0x1025('0x28')][_0x1025('0x16')]);}_0x578ddd[_0x1025('0x30')]=qs[_0x1025('0x31')](_0x295e06[_0x1025('0x28')][_0x1025('0x31')]);_0x578ddd[_0x1025('0x32')]=qs[_0x1025('0x2a')](_['pick'](_0x295e06['query'],_0x4d13e8[_0x1025('0x2a')]),_0x5d7a8f);if(_0x295e06[_0x1025('0x28')][_0x1025('0x33')]){_0x578ddd[_0x1025('0x32')]=_[_0x1025('0x34')](_0x578ddd[_0x1025('0x32')],{'$or':_[_0x1025('0x23')](_0x5d7a8f,function(_0x1430bf){if(_0x1430bf[_0x1025('0x25')]!==_0x1025('0x35')){var _0x40e6a1={};_0x40e6a1[_0x1430bf[_0x1025('0x21')]]={'$like':'%'+_0x295e06[_0x1025('0x28')][_0x1025('0x33')]+'%'};return _0x40e6a1;}})});}_0x578ddd=_[_0x1025('0x34')]({},_0x578ddd,_0x295e06[_0x1025('0x36')]);var _0x5f1c4b={'where':_0x578ddd['where']};return db[_0x1025('0x37')][_0x1025('0x19')](_0x5f1c4b)[_0x1025('0x1d')](function(_0x426ffb){_0x43471e[_0x1025('0x19')]=_0x426ffb;if(_0x295e06[_0x1025('0x28')]['includeAll']){_0x578ddd[_0x1025('0x38')]=[{'all':!![]}];}return db[_0x1025('0x37')][_0x1025('0x39')](_0x578ddd);})[_0x1025('0x1d')](function(_0x432b44){_0x43471e[_0x1025('0x3a')]=_0x432b44;return _0x43471e;})['then'](respondWithFilteredResult(_0xbf9e4c,_0x578ddd))[_0x1025('0x3b')](handleError(_0xbf9e4c,null));};exports[_0x1025('0x3c')]=function(_0x16ce1f,_0x222518){var _0x3acaaf={'raw':!![],'where':{'id':_0x16ce1f[_0x1025('0x3d')]['id']}},_0x44599b={};_0x44599b[_0x1025('0x27')]=_['keys'](db[_0x1025('0x37')][_0x1025('0x3e')]);_0x44599b[_0x1025('0x28')]=_[_0x1025('0x29')](_0x16ce1f['query']);_0x44599b['filters']=_[_0x1025('0x2c')](_0x44599b[_0x1025('0x27')],_0x44599b['query']);_0x3acaaf[_0x1025('0x2b')]=_[_0x1025('0x2c')](_0x44599b['model'],qs[_0x1025('0x2d')](_0x16ce1f[_0x1025('0x28')][_0x1025('0x2d')]));_0x3acaaf[_0x1025('0x2b')]=_0x3acaaf[_0x1025('0x2b')][_0x1025('0x3f')]?_0x3acaaf['attributes']:_0x44599b[_0x1025('0x27')];if(_0x16ce1f[_0x1025('0x28')][_0x1025('0x40')]){_0x3acaaf[_0x1025('0x38')]=[{'all':!![]}];}_0x3acaaf=_[_0x1025('0x34')]({},_0x3acaaf,_0x16ce1f['options']);return db[_0x1025('0x37')][_0x1025('0x41')](_0x3acaaf)['then'](handleEntityNotFound(_0x222518,null))['then'](respondWithResult(_0x222518,null))[_0x1025('0x3b')](handleError(_0x222518,null));};exports[_0x1025('0x42')]=function(_0x1cc814,_0x3493c5){return db[_0x1025('0x37')]['create'](_0x1cc814['body'],{})[_0x1025('0x1d')](respondWithResult(_0x3493c5,0xc9))[_0x1025('0x3b')](handleError(_0x3493c5,null));};exports[_0x1025('0x1c')]=function(_0x1c65a3,_0x43d526){if(_0x1c65a3['body']['id']){delete _0x1c65a3['body']['id'];}return db[_0x1025('0x37')][_0x1025('0x41')]({'where':{'id':_0x1c65a3[_0x1025('0x3d')]['id']}})[_0x1025('0x1d')](handleEntityNotFound(_0x43d526,null))[_0x1025('0x1d')](saveUpdates(_0x1c65a3[_0x1025('0x43')],null))[_0x1025('0x1d')](respondWithResult(_0x43d526,null))['catch'](handleError(_0x43d526,null));};exports[_0x1025('0x1e')]=function(_0x2a10f3,_0x577dec){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x2a10f3[_0x1025('0x3d')]['id']}})[_0x1025('0x1d')](handleEntityNotFound(_0x577dec,null))[_0x1025('0x1d')](removeEntity(_0x577dec,null))[_0x1025('0x3b')](handleError(_0x577dec,null));};exports[_0x1025('0x44')]=function(_0x1c3cd6,_0x17b2c9){return db[_0x1025('0x37')][_0x1025('0x44')]()['then'](respondWithResult(_0x17b2c9,null))[_0x1025('0x3b')](handleError(_0x17b2c9,null));}; \ No newline at end of file +var _0x5381=['create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','length','merge','options','find'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x5381,0x130));var _0x1538=function(_0x3590e8,_0x27285c){_0x3590e8=_0x3590e8-0x0;var _0x125172=_0x5381[_0x3590e8];return _0x125172;};'use strict';var emlformat=require(_0x1538('0x0'));var rimraf=require(_0x1538('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1538('0x2'));var rp=require(_0x1538('0x3'));var moment=require(_0x1538('0x4'));var BPromise=require(_0x1538('0x5'));var Mustache=require(_0x1538('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1538('0x7'));var ejs=require(_0x1538('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1538('0x9'));var squel=require(_0x1538('0xa'));var crypto=require('crypto');var jsforce=require(_0x1538('0xb'));var deskjs=require(_0x1538('0xc'));var toCsv=require(_0x1538('0x7'));var querystring=require('querystring');var Papa=require(_0x1538('0xd'));var Redis=require(_0x1538('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1538('0xf'));var as=require(_0x1538('0x10'));var hardwareService=require(_0x1538('0x11'));var logger=require('../../config/logger')(_0x1538('0x12'));var utils=require(_0x1538('0x13'));var config=require(_0x1538('0x14'));var licenseUtil=require(_0x1538('0x15'));var db=require(_0x1538('0x16'))['db'];function respondWithStatusCode(_0x755e67,_0x474f99){_0x474f99=_0x474f99||0xcc;return function(_0x46f836){if(_0x46f836){return _0x755e67[_0x1538('0x17')](_0x474f99);}return _0x755e67['status'](_0x474f99)['end']();};}function respondWithResult(_0x3ce21d,_0x2908d3){_0x2908d3=_0x2908d3||0xc8;return function(_0x2d2c56){if(_0x2d2c56){return _0x3ce21d[_0x1538('0x18')](_0x2908d3)[_0x1538('0x19')](_0x2d2c56);}};}function respondWithFilteredResult(_0x11f5b9,_0xe744cd){return function(_0x46eed2){if(_0x46eed2){var _0x2a2279=typeof _0xe744cd[_0x1538('0x1a')]===_0x1538('0x1b')&&typeof _0xe744cd['limit']===_0x1538('0x1b');var _0x564229=_0x46eed2[_0x1538('0x1c')];var _0x224a61=_0x2a2279?0x0:_0xe744cd[_0x1538('0x1a')];var _0xa7db75=_0x2a2279?_0x46eed2['count']:_0xe744cd[_0x1538('0x1a')]+_0xe744cd[_0x1538('0x1d')];var _0x3d78d2;if(_0xa7db75>=_0x564229){_0xa7db75=_0x564229;_0x3d78d2=0xc8;}else{_0x3d78d2=0xce;}_0x11f5b9[_0x1538('0x18')](_0x3d78d2);return _0x11f5b9[_0x1538('0x1e')](_0x1538('0x1f'),_0x224a61+'-'+_0xa7db75+'/'+_0x564229)[_0x1538('0x19')](_0x46eed2);}return null;};}function patchUpdates(_0x2be30f){return function(_0x4b66c9){try{jsonpatch[_0x1538('0x20')](_0x4b66c9,_0x2be30f,!![]);}catch(_0x293220){return BPromise[_0x1538('0x21')](_0x293220);}return _0x4b66c9[_0x1538('0x22')]();};}function saveUpdates(_0xc5791,_0x3c501b){return function(_0x89ff3d){if(_0x89ff3d){return _0x89ff3d[_0x1538('0x23')](_0xc5791)[_0x1538('0x24')](function(_0x2e25a1){return _0x2e25a1;});}return null;};}function removeEntity(_0x51d03d,_0x373fbc){return function(_0x2fa7cf){if(_0x2fa7cf){return _0x2fa7cf[_0x1538('0x25')]()[_0x1538('0x24')](function(){_0x51d03d['status'](0xcc)[_0x1538('0x26')]();});}};}function handleEntityNotFound(_0x175b80,_0xa0ce2){return function(_0x258f6d){if(!_0x258f6d){_0x175b80[_0x1538('0x17')](0x194);}return _0x258f6d;};}function handleError(_0x4db4e0,_0x4afbcb){_0x4afbcb=_0x4afbcb||0x1f4;return function(_0x17e2ee){logger['error'](_0x17e2ee[_0x1538('0x27')]);if(_0x17e2ee[_0x1538('0x28')]){delete _0x17e2ee[_0x1538('0x28')];}_0x4db4e0['status'](_0x4afbcb)[_0x1538('0x29')](_0x17e2ee);};}exports[_0x1538('0x2a')]=function(_0x43158f,_0x16ed73){var _0xd7c1e2={},_0x25c914={},_0x5a70f7={'count':0x0,'rows':[]};var _0x200777=_[_0x1538('0x2b')](db['OpenchannelQueueReport']['rawAttributes'],function(_0xb7c1c1){return{'name':_0xb7c1c1[_0x1538('0x2c')],'type':_0xb7c1c1[_0x1538('0x2d')][_0x1538('0x2e')]};});_0x25c914[_0x1538('0x2f')]=_[_0x1538('0x2b')](_0x200777,'name');_0x25c914[_0x1538('0x30')]=_[_0x1538('0x31')](_0x43158f['query']);_0x25c914['filters']=_[_0x1538('0x32')](_0x25c914[_0x1538('0x2f')],_0x25c914[_0x1538('0x30')]);_0xd7c1e2[_0x1538('0x33')]=_[_0x1538('0x32')](_0x25c914[_0x1538('0x2f')],qs[_0x1538('0x34')](_0x43158f[_0x1538('0x30')][_0x1538('0x34')]));_0xd7c1e2[_0x1538('0x33')]=_0xd7c1e2[_0x1538('0x33')]['length']?_0xd7c1e2[_0x1538('0x33')]:_0x25c914[_0x1538('0x2f')];if(!_0x43158f[_0x1538('0x30')][_0x1538('0x35')]('nolimit')){_0xd7c1e2[_0x1538('0x1d')]=qs['limit'](_0x43158f[_0x1538('0x30')][_0x1538('0x1d')]);_0xd7c1e2[_0x1538('0x1a')]=qs[_0x1538('0x1a')](_0x43158f['query'][_0x1538('0x1a')]);}_0xd7c1e2['order']=qs[_0x1538('0x36')](_0x43158f[_0x1538('0x30')]['sort']);_0xd7c1e2[_0x1538('0x37')]=qs[_0x1538('0x38')](_[_0x1538('0x39')](_0x43158f[_0x1538('0x30')],_0x25c914[_0x1538('0x38')]),_0x200777);if(_0x43158f['query'][_0x1538('0x3a')]){_0xd7c1e2[_0x1538('0x37')]=_['merge'](_0xd7c1e2[_0x1538('0x37')],{'$or':_['map'](_0x200777,function(_0x19b572){if(_0x19b572['type']!==_0x1538('0x3b')){var _0x573d64={};_0x573d64[_0x19b572[_0x1538('0x28')]]={'$like':'%'+_0x43158f[_0x1538('0x30')][_0x1538('0x3a')]+'%'};return _0x573d64;}})});}_0xd7c1e2=_['merge']({},_0xd7c1e2,_0x43158f['options']);var _0x3cd970={'where':_0xd7c1e2[_0x1538('0x37')]};return db[_0x1538('0x3c')][_0x1538('0x1c')](_0x3cd970)[_0x1538('0x24')](function(_0x21a073){_0x5a70f7[_0x1538('0x1c')]=_0x21a073;if(_0x43158f[_0x1538('0x30')][_0x1538('0x3d')]){_0xd7c1e2[_0x1538('0x3e')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x1538('0x3f')](_0xd7c1e2);})['then'](function(_0x2332cf){_0x5a70f7[_0x1538('0x40')]=_0x2332cf;return _0x5a70f7;})[_0x1538('0x24')](respondWithFilteredResult(_0x16ed73,_0xd7c1e2))[_0x1538('0x41')](handleError(_0x16ed73,null));};exports[_0x1538('0x42')]=function(_0x10c223,_0x216f84){var _0x26c86d={'raw':!![],'where':{'id':_0x10c223['params']['id']}},_0x3e4639={};_0x3e4639[_0x1538('0x2f')]=_[_0x1538('0x31')](db['OpenchannelQueueReport']['rawAttributes']);_0x3e4639[_0x1538('0x30')]=_[_0x1538('0x31')](_0x10c223[_0x1538('0x30')]);_0x3e4639['filters']=_['intersection'](_0x3e4639[_0x1538('0x2f')],_0x3e4639[_0x1538('0x30')]);_0x26c86d[_0x1538('0x33')]=_[_0x1538('0x32')](_0x3e4639['model'],qs['fields'](_0x10c223[_0x1538('0x30')][_0x1538('0x34')]));_0x26c86d[_0x1538('0x33')]=_0x26c86d['attributes'][_0x1538('0x43')]?_0x26c86d[_0x1538('0x33')]:_0x3e4639[_0x1538('0x2f')];if(_0x10c223[_0x1538('0x30')][_0x1538('0x3d')]){_0x26c86d[_0x1538('0x3e')]=[{'all':!![]}];}_0x26c86d=_[_0x1538('0x44')]({},_0x26c86d,_0x10c223[_0x1538('0x45')]);return db['OpenchannelQueueReport'][_0x1538('0x46')](_0x26c86d)[_0x1538('0x24')](handleEntityNotFound(_0x216f84,null))[_0x1538('0x24')](respondWithResult(_0x216f84,null))[_0x1538('0x41')](handleError(_0x216f84,null));};exports[_0x1538('0x47')]=function(_0x36b161,_0x48bd70){return db[_0x1538('0x3c')][_0x1538('0x47')](_0x36b161['body'],{})[_0x1538('0x24')](respondWithResult(_0x48bd70,0xc9))[_0x1538('0x41')](handleError(_0x48bd70,null));};exports['update']=function(_0x156e2e,_0x4b388f){if(_0x156e2e[_0x1538('0x48')]['id']){delete _0x156e2e[_0x1538('0x48')]['id'];}return db[_0x1538('0x3c')]['find']({'where':{'id':_0x156e2e[_0x1538('0x49')]['id']}})[_0x1538('0x24')](handleEntityNotFound(_0x4b388f,null))[_0x1538('0x24')](saveUpdates(_0x156e2e[_0x1538('0x48')],null))[_0x1538('0x24')](respondWithResult(_0x4b388f,null))[_0x1538('0x41')](handleError(_0x4b388f,null));};exports[_0x1538('0x25')]=function(_0x5c4313,_0x62a329){return db['OpenchannelQueueReport'][_0x1538('0x46')]({'where':{'id':_0x5c4313[_0x1538('0x49')]['id']}})['then'](handleEntityNotFound(_0x62a329,null))['then'](removeEntity(_0x62a329,null))[_0x1538('0x41')](handleError(_0x62a329,null));};exports[_0x1538('0x4a')]=function(_0x477f51,_0x58200e){return db['OpenchannelQueueReport']['describe']()[_0x1538('0x24')](respondWithResult(_0x58200e,null))['catch'](handleError(_0x58200e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 820ae9b..0682012 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x814b,0x1a2));var _0xb814=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x814b[_0x5f6a8a];return _0x2cce4d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x17615d,_0x3ef58b){var _0x1f6dc8=function(_0x12b9cc){while(--_0x12b9cc){_0x17615d['push'](_0x17615d['shift']());}};_0x1f6dc8(++_0x3ef58b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'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/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d980ea6..51294af 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 _0xae60=['rpc','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xae60,0x1c7));var _0x0ae6=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xae60[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});}exports[_0x0ae6('0x17')]=function(_0xda4f01){var _0x3f5c41=this;return new Promise(function(_0x2fdf25,_0x1735ba){return db[_0x0ae6('0x18')][_0x0ae6('0x19')](_0xda4f01[_0x0ae6('0x1a')],{'raw':_0xda4f01[_0x0ae6('0x1b')]?_0xda4f01['options'][_0x0ae6('0x1c')]===undefined?!![]:![]:!![]})[_0x0ae6('0xb')](function(_0x140a3b){logger[_0x0ae6('0xc')](_0x0ae6('0x17'),_0xda4f01);logger[_0x0ae6('0xe')](_0x0ae6('0x17'),_0xda4f01,JSON[_0x0ae6('0x11')](_0x140a3b));_0x2fdf25(_0x140a3b);})['catch'](function(_0x39b22e){logger[_0x0ae6('0x12')](_0x0ae6('0x17'),_0x39b22e[_0x0ae6('0x14')],_0xda4f01);_0x1735ba(_0x3f5c41[_0x0ae6('0x12')](0x1f4,_0x39b22e['message']));});});};exports[_0x0ae6('0x1d')]=function(_0x4e1242){var _0xccd1c5=this;return new Promise(function(_0x3955d8,_0x3c43d8){return db[_0x0ae6('0x18')]['update'](_0x4e1242[_0x0ae6('0x1a')],{'raw':_0x4e1242[_0x0ae6('0x1b')]?_0x4e1242['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e1242[_0x0ae6('0x1b')]?_0x4e1242[_0x0ae6('0x1b')][_0x0ae6('0x1e')]||null:null,'attributes':_0x4e1242['options']?_0x4e1242[_0x0ae6('0x1b')][_0x0ae6('0x1f')]||null:null,'limit':_0x4e1242[_0x0ae6('0x1b')]?_0x4e1242['options'][_0x0ae6('0x20')]||null:null})[_0x0ae6('0xb')](function(_0x449c33){logger[_0x0ae6('0xc')](_0x0ae6('0x1d'),_0x4e1242);logger[_0x0ae6('0xe')]('UpdateOpenchannelQueueReport',_0x4e1242,JSON['stringify'](_0x449c33));_0x3955d8(_0x449c33);})[_0x0ae6('0x16')](function(_0x419384){logger['error']('UpdateOpenchannelQueueReport',_0x419384[_0x0ae6('0x14')],_0x4e1242);_0x3c43d8(_0xccd1c5[_0x0ae6('0x12')](0x1f4,_0x419384[_0x0ae6('0x14')]));});});}; \ No newline at end of file +var _0x96f2=['then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateOpenchannelQueueReport','create','body','options','stringify','update','raw','attributes','limit','UpdateOpenchannelQueueReport','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x1e8090,_0x382318){var _0xe5ba14=function(_0x45d697){while(--_0x45d697){_0x1e8090['push'](_0x1e8090['shift']());}};_0xe5ba14(++_0x382318);}(_0x96f2,0xb0));var _0x296f=function(_0x7d4709,_0x1e1943){_0x7d4709=_0x7d4709-0x0;var _0x3b67c1=_0x96f2[_0x7d4709];return _0x3b67c1;};'use strict';var _=require(_0x296f('0x0'));var util=require('util');var moment=require(_0x296f('0x1'));var BPromise=require(_0x296f('0x2'));var rs=require(_0x296f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x296f('0x4'))['db'];var utils=require(_0x296f('0x5'));var logger=require(_0x296f('0x6'))('rpc');var config=require(_0x296f('0x7'));var jayson=require(_0x296f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x164031,_0x1d019f,_0x2dc0ca){return new BPromise(function(_0x28f708,_0x30ed43){return client[_0x296f('0x9')](_0x164031,_0x2dc0ca)[_0x296f('0xa')](function(_0x3ea699){logger[_0x296f('0xb')](_0x296f('0xc'),_0x1d019f,'request\x20sent');logger[_0x296f('0xd')](_0x296f('0xe'),_0x1d019f,_0x296f('0xf'),JSON['stringify'](_0x3ea699));if(_0x3ea699[_0x296f('0x10')]){if(_0x3ea699[_0x296f('0x10')][_0x296f('0x11')]===0x1f4){logger[_0x296f('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1d019f,_0x3ea699['error']['message']);return _0x30ed43(_0x3ea699[_0x296f('0x10')][_0x296f('0x12')]);}logger[_0x296f('0x10')](_0x296f('0xc'),_0x1d019f,_0x3ea699['error'][_0x296f('0x12')]);return _0x28f708(_0x3ea699['error']['message']);}else{logger[_0x296f('0xb')](_0x296f('0xc'),_0x1d019f,_0x296f('0xf'));_0x28f708(_0x3ea699[_0x296f('0x13')]['message']);}})['catch'](function(_0x3e3860){logger['error'](_0x296f('0xc'),_0x1d019f,_0x3e3860);_0x30ed43(_0x3e3860);});});}exports[_0x296f('0x14')]=function(_0xfc0b87){var _0x48725e=this;return new Promise(function(_0xcc2b48,_0x3b7db8){return db['OpenchannelQueueReport'][_0x296f('0x15')](_0xfc0b87[_0x296f('0x16')],{'raw':_0xfc0b87[_0x296f('0x17')]?_0xfc0b87[_0x296f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x296f('0xa')](function(_0x474721){logger[_0x296f('0xb')]('CreateOpenchannelQueueReport',_0xfc0b87);logger[_0x296f('0xd')](_0x296f('0x14'),_0xfc0b87,JSON[_0x296f('0x18')](_0x474721));_0xcc2b48(_0x474721);})['catch'](function(_0x2a9a1c){logger[_0x296f('0x10')](_0x296f('0x14'),_0x2a9a1c['message'],_0xfc0b87);_0x3b7db8(_0x48725e['error'](0x1f4,_0x2a9a1c[_0x296f('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x54a0af){var _0xf39fb=this;return new Promise(function(_0x513d59,_0x4ab133){return db['OpenchannelQueueReport'][_0x296f('0x19')](_0x54a0af[_0x296f('0x16')],{'raw':_0x54a0af[_0x296f('0x17')]?_0x54a0af[_0x296f('0x17')][_0x296f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a0af[_0x296f('0x17')]?_0x54a0af['options']['where']||null:null,'attributes':_0x54a0af[_0x296f('0x17')]?_0x54a0af['options'][_0x296f('0x1b')]||null:null,'limit':_0x54a0af[_0x296f('0x17')]?_0x54a0af[_0x296f('0x17')][_0x296f('0x1c')]||null:null})[_0x296f('0xa')](function(_0x28d624){logger['info'](_0x296f('0x1d'),_0x54a0af);logger['debug'](_0x296f('0x1d'),_0x54a0af,JSON[_0x296f('0x18')](_0x28d624));_0x513d59(_0x28d624);})[_0x296f('0x1e')](function(_0x3aa271){logger[_0x296f('0x10')](_0x296f('0x1d'),_0x3aa271[_0x296f('0x12')],_0x54a0af);_0x4ab133(_0xf39fb[_0x296f('0x10')](0x1f4,_0x3aa271[_0x296f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8f09697..449ed5c 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 _0x8dd8=['./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','put','update','exports','multer','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4e0887,_0x5c65b2){var _0x46aad9=function(_0x280e11){while(--_0x280e11){_0x4e0887['push'](_0x4e0887['shift']());}};_0x46aad9(++_0x5c65b2);}(_0x8dd8,0xca));var _0x88dd=function(_0x2992c0,_0x3d8926){_0x2992c0=_0x2992c0-0x0;var _0x464ca4=_0x8dd8[_0x2992c0];return _0x464ca4;};'use strict';var multer=require(_0x88dd('0x0'));var util=require(_0x88dd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x88dd('0x2'));var router=express[_0x88dd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x88dd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x88dd('0x5'));var controller=require(_0x88dd('0x6'));router['get']('/',auth[_0x88dd('0x7')](),controller[_0x88dd('0x8')]);router[_0x88dd('0x9')](_0x88dd('0xa'),auth[_0x88dd('0x7')](),controller[_0x88dd('0xb')]);router[_0x88dd('0x9')](_0x88dd('0xc'),auth[_0x88dd('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x88dd('0xd')](_0x88dd('0xc'),auth[_0x88dd('0x7')](),controller[_0x88dd('0xe')]);router['delete']('/:id',auth[_0x88dd('0x7')](),controller['destroy']);module[_0x88dd('0xf')]=router; \ No newline at end of file +var _0x3a9f=['./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x47878f,_0x48d3bf){var _0x4b05b8=function(_0x3d6597){while(--_0x3d6597){_0x47878f['push'](_0x47878f['shift']());}};_0x4b05b8(++_0x48d3bf);}(_0x3a9f,0x195));var _0xf3a9=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x3a9f[_0x289891];return _0x31cf2e;};'use strict';var multer=require(_0xf3a9('0x0'));var util=require(_0xf3a9('0x1'));var path=require(_0xf3a9('0x2'));var timeout=require(_0xf3a9('0x3'));var express=require(_0xf3a9('0x4'));var router=express[_0xf3a9('0x5')]();var fs_extra=require(_0xf3a9('0x6'));var auth=require(_0xf3a9('0x7'));var interaction=require(_0xf3a9('0x8'));var config=require('../../config/environment');var controller=require(_0xf3a9('0x9'));router[_0xf3a9('0xa')]('/',auth[_0xf3a9('0xb')](),controller[_0xf3a9('0xc')]);router[_0xf3a9('0xa')](_0xf3a9('0xd'),auth[_0xf3a9('0xb')](),controller[_0xf3a9('0xe')]);router['get']('/:id',auth[_0xf3a9('0xb')](),controller[_0xf3a9('0xf')]);router[_0xf3a9('0x10')]('/',auth['isAuthenticated'](),controller[_0xf3a9('0x11')]);router[_0xf3a9('0x12')](_0xf3a9('0x13'),auth[_0xf3a9('0xb')](),controller[_0xf3a9('0x14')]);router[_0xf3a9('0x15')](_0xf3a9('0x13'),auth[_0xf3a9('0xb')](),controller[_0xf3a9('0x16')]);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 e44da4d..bd1ff9b 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3265b1,_0x39b894){_0x3265b1=_0x3265b1-0x0;var _0x3d8e43=_0x9bde[_0x3265b1];return _0x3d8e43;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x27efcf,_0x320952){var _0xdb0237=function(_0x2a7389){while(--_0x2a7389){_0x27efcf['push'](_0x27efcf['shift']());}};_0xdb0237(++_0x320952);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 12f94d2..4626a53 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 _0x153a=['crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','OpenchannelTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x2ec070,_0x4e5117){var _0x365c60=function(_0x26d544){while(--_0x26d544){_0x2ec070['push'](_0x2ec070['shift']());}};_0x365c60(++_0x4e5117);}(_0x153a,0x172));var _0xa153=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x153a[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require(_0xa153('0x0'));var rimraf=require(_0xa153('0x1'));var zipdir=require(_0xa153('0x2'));var jsonpatch=require(_0xa153('0x3'));var rp=require(_0xa153('0x4'));var moment=require(_0xa153('0x5'));var BPromise=require(_0xa153('0x6'));var Mustache=require(_0xa153('0x7'));var util=require(_0xa153('0x8'));var path=require(_0xa153('0x9'));var sox=require(_0xa153('0xa'));var csv=require(_0xa153('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa153('0xc'));var _=require(_0xa153('0xd'));var squel=require(_0xa153('0xe'));var crypto=require(_0xa153('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa153('0x10'));var Papa=require(_0xa153('0x11'));var Redis=require(_0xa153('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa153('0x13'));var as=require(_0xa153('0x14'));var hardwareService=require(_0xa153('0x15'));var logger=require(_0xa153('0x16'))(_0xa153('0x17'));var utils=require(_0xa153('0x18'));var config=require(_0xa153('0x19'));var licenseUtil=require(_0xa153('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17117a,_0x21b104){_0x21b104=_0x21b104||0xcc;return function(_0x38f7f5){if(_0x38f7f5){return _0x17117a[_0xa153('0x1b')](_0x21b104);}return _0x17117a[_0xa153('0x1c')](_0x21b104)[_0xa153('0x1d')]();};}function respondWithResult(_0x4f0408,_0x4cfe72){_0x4cfe72=_0x4cfe72||0xc8;return function(_0x147e2a){if(_0x147e2a){return _0x4f0408[_0xa153('0x1c')](_0x4cfe72)[_0xa153('0x1e')](_0x147e2a);}};}function respondWithFilteredResult(_0x1a2753,_0x169208){return function(_0x2eaac8){if(_0x2eaac8){var _0x506b52=typeof _0x169208[_0xa153('0x1f')]==='undefined'&&typeof _0x169208[_0xa153('0x20')]===_0xa153('0x21');var _0x215211=_0x2eaac8[_0xa153('0x22')];var _0x1e5cde=_0x506b52?0x0:_0x169208[_0xa153('0x1f')];var _0x1c9e0a=_0x506b52?_0x2eaac8[_0xa153('0x22')]:_0x169208[_0xa153('0x1f')]+_0x169208['limit'];var _0x906d36;if(_0x1c9e0a>=_0x215211){_0x1c9e0a=_0x215211;_0x906d36=0xc8;}else{_0x906d36=0xce;}_0x1a2753[_0xa153('0x1c')](_0x906d36);return _0x1a2753[_0xa153('0x23')](_0xa153('0x24'),_0x1e5cde+'-'+_0x1c9e0a+'/'+_0x215211)[_0xa153('0x1e')](_0x2eaac8);}return null;};}function patchUpdates(_0x413ea9){return function(_0x517c28){try{jsonpatch['apply'](_0x517c28,_0x413ea9,!![]);}catch(_0x2e13f8){return BPromise[_0xa153('0x25')](_0x2e13f8);}return _0x517c28[_0xa153('0x26')]();};}function saveUpdates(_0x525131,_0xe0d932){return function(_0x4063e6){if(_0x4063e6){return _0x4063e6[_0xa153('0x27')](_0x525131)[_0xa153('0x28')](function(_0x1c350a){return _0x1c350a;});}return null;};}function removeEntity(_0x2527d2,_0x2b65ad){return function(_0x12627a){if(_0x12627a){return _0x12627a['destroy']()[_0xa153('0x28')](function(){_0x2527d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe612,_0x3b7fe4){return function(_0x2be37f){if(!_0x2be37f){_0x4fe612[_0xa153('0x1b')](0x194);}return _0x2be37f;};}function handleError(_0x1cc5b8,_0x5b03d9){_0x5b03d9=_0x5b03d9||0x1f4;return function(_0x231508){logger[_0xa153('0x29')](_0x231508['stack']);if(_0x231508[_0xa153('0x2a')]){delete _0x231508[_0xa153('0x2a')];}_0x1cc5b8[_0xa153('0x1c')](_0x5b03d9)[_0xa153('0x2b')](_0x231508);};}exports[_0xa153('0x2c')]=function(_0x247c50,_0x5a8577){var _0x57f3f5={},_0x52c80c={},_0x311104={'count':0x0,'rows':[]};var _0x4f311d=_[_0xa153('0x2d')](db[_0xa153('0x2e')]['rawAttributes'],function(_0x4bbcbb){return{'name':_0x4bbcbb[_0xa153('0x2f')],'type':_0x4bbcbb['type'][_0xa153('0x30')]};});_0x52c80c[_0xa153('0x31')]=_[_0xa153('0x2d')](_0x4f311d,_0xa153('0x2a'));_0x52c80c[_0xa153('0x32')]=_[_0xa153('0x33')](_0x247c50[_0xa153('0x32')]);_0x52c80c[_0xa153('0x34')]=_[_0xa153('0x35')](_0x52c80c[_0xa153('0x31')],_0x52c80c['query']);_0x57f3f5[_0xa153('0x36')]=_[_0xa153('0x35')](_0x52c80c['model'],qs['fields'](_0x247c50[_0xa153('0x32')][_0xa153('0x37')]));_0x57f3f5[_0xa153('0x36')]=_0x57f3f5['attributes'][_0xa153('0x38')]?_0x57f3f5['attributes']:_0x52c80c['model'];if(!_0x247c50[_0xa153('0x32')]['hasOwnProperty'](_0xa153('0x39'))){_0x57f3f5[_0xa153('0x20')]=qs['limit'](_0x247c50[_0xa153('0x32')][_0xa153('0x20')]);_0x57f3f5[_0xa153('0x1f')]=qs[_0xa153('0x1f')](_0x247c50['query'][_0xa153('0x1f')]);}_0x57f3f5['order']=qs[_0xa153('0x3a')](_0x247c50[_0xa153('0x32')][_0xa153('0x3a')]);_0x57f3f5[_0xa153('0x3b')]=qs[_0xa153('0x34')](_[_0xa153('0x3c')](_0x247c50['query'],_0x52c80c['filters']),_0x4f311d);if(_0x247c50[_0xa153('0x32')]['filter']){_0x57f3f5['where']=_[_0xa153('0x3d')](_0x57f3f5[_0xa153('0x3b')],{'$or':_[_0xa153('0x2d')](_0x4f311d,function(_0x53fcd5){if(_0x53fcd5[_0xa153('0x3e')]!==_0xa153('0x3f')){var _0xd85528={};_0xd85528[_0x53fcd5['name']]={'$like':'%'+_0x247c50[_0xa153('0x32')]['filter']+'%'};return _0xd85528;}})});}_0x57f3f5=_['merge']({},_0x57f3f5,_0x247c50[_0xa153('0x40')]);var _0x58e2a2={'where':_0x57f3f5[_0xa153('0x3b')]};return db['OpenchannelTransferReport'][_0xa153('0x22')](_0x58e2a2)[_0xa153('0x28')](function(_0x4cfc4c){_0x311104['count']=_0x4cfc4c;if(_0x247c50[_0xa153('0x32')][_0xa153('0x41')]){_0x57f3f5['include']=[{'all':!![]}];}return db[_0xa153('0x2e')][_0xa153('0x42')](_0x57f3f5);})[_0xa153('0x28')](function(_0x4b6d09){_0x311104[_0xa153('0x43')]=_0x4b6d09;return _0x311104;})[_0xa153('0x28')](respondWithFilteredResult(_0x5a8577,_0x57f3f5))[_0xa153('0x44')](handleError(_0x5a8577,null));};exports[_0xa153('0x45')]=function(_0x5eb924,_0x2bcfc1){var _0x4e64c5={'raw':!![],'where':{'id':_0x5eb924['params']['id']}},_0x44f853={};_0x44f853['model']=_['keys'](db['OpenchannelTransferReport']['rawAttributes']);_0x44f853[_0xa153('0x32')]=_['keys'](_0x5eb924['query']);_0x44f853[_0xa153('0x34')]=_['intersection'](_0x44f853[_0xa153('0x31')],_0x44f853[_0xa153('0x32')]);_0x4e64c5[_0xa153('0x36')]=_[_0xa153('0x35')](_0x44f853[_0xa153('0x31')],qs[_0xa153('0x37')](_0x5eb924[_0xa153('0x32')]['fields']));_0x4e64c5['attributes']=_0x4e64c5[_0xa153('0x36')][_0xa153('0x38')]?_0x4e64c5[_0xa153('0x36')]:_0x44f853[_0xa153('0x31')];if(_0x5eb924['query'][_0xa153('0x41')]){_0x4e64c5[_0xa153('0x46')]=[{'all':!![]}];}_0x4e64c5=_[_0xa153('0x3d')]({},_0x4e64c5,_0x5eb924[_0xa153('0x40')]);return db[_0xa153('0x2e')][_0xa153('0x47')](_0x4e64c5)[_0xa153('0x28')](handleEntityNotFound(_0x2bcfc1,null))[_0xa153('0x28')](respondWithResult(_0x2bcfc1,null))[_0xa153('0x44')](handleError(_0x2bcfc1,null));};exports[_0xa153('0x48')]=function(_0xd69104,_0x11819f){return db['OpenchannelTransferReport']['create'](_0xd69104[_0xa153('0x49')],{})['then'](respondWithResult(_0x11819f,0xc9))[_0xa153('0x44')](handleError(_0x11819f,null));};exports['update']=function(_0x3c5508,_0x798006){if(_0x3c5508[_0xa153('0x49')]['id']){delete _0x3c5508[_0xa153('0x49')]['id'];}return db[_0xa153('0x2e')][_0xa153('0x47')]({'where':{'id':_0x3c5508['params']['id']}})[_0xa153('0x28')](handleEntityNotFound(_0x798006,null))[_0xa153('0x28')](saveUpdates(_0x3c5508[_0xa153('0x49')],null))[_0xa153('0x28')](respondWithResult(_0x798006,null))[_0xa153('0x44')](handleError(_0x798006,null));};exports[_0xa153('0x4a')]=function(_0x185993,_0x2538be){return db[_0xa153('0x2e')][_0xa153('0x47')]({'where':{'id':_0x185993[_0xa153('0x4b')]['id']}})[_0xa153('0x28')](handleEntityNotFound(_0x2538be,null))['then'](removeEntity(_0x2538be,null))['catch'](handleError(_0x2538be,null));};exports[_0xa153('0x4c')]=function(_0x3ef8db,_0x24721d){return db[_0xa153('0x2e')][_0xa153('0x4c')]()['then'](respondWithResult(_0x24721d,null))[_0xa153('0x44')](handleError(_0x24721d,null));}; \ No newline at end of file +var _0x7d6e=['status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','VIRTUAL','includeAll','include','findAll','show','params','merge','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','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'];(function(_0xbec1c3,_0x4589df){var _0x496fde=function(_0x98354a){while(--_0x98354a){_0xbec1c3['push'](_0xbec1c3['shift']());}};_0x496fde(++_0x4589df);}(_0x7d6e,0x107));var _0xe7d6=function(_0x356d1b,_0x2a9fb7){_0x356d1b=_0x356d1b-0x0;var _0x4c2ca4=_0x7d6e[_0x356d1b];return _0x4c2ca4;};'use strict';var emlformat=require(_0xe7d6('0x0'));var rimraf=require(_0xe7d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe7d6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe7d6('0x3'));var Mustache=require(_0xe7d6('0x4'));var util=require(_0xe7d6('0x5'));var path=require(_0xe7d6('0x6'));var sox=require('sox');var csv=require(_0xe7d6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe7d6('0x8'));var _=require(_0xe7d6('0x9'));var squel=require(_0xe7d6('0xa'));var crypto=require(_0xe7d6('0xb'));var jsforce=require(_0xe7d6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe7d6('0x7'));var querystring=require('querystring');var Papa=require(_0xe7d6('0xd'));var Redis=require(_0xe7d6('0xe'));var authService=require(_0xe7d6('0xf'));var qs=require(_0xe7d6('0x10'));var as=require(_0xe7d6('0x11'));var hardwareService=require(_0xe7d6('0x12'));var logger=require(_0xe7d6('0x13'))(_0xe7d6('0x14'));var utils=require('../../config/utils');var config=require(_0xe7d6('0x15'));var licenseUtil=require(_0xe7d6('0x16'));var db=require(_0xe7d6('0x17'))['db'];function respondWithStatusCode(_0x226e45,_0x33e67a){_0x33e67a=_0x33e67a||0xcc;return function(_0x3d636a){if(_0x3d636a){return _0x226e45[_0xe7d6('0x18')](_0x33e67a);}return _0x226e45[_0xe7d6('0x19')](_0x33e67a)[_0xe7d6('0x1a')]();};}function respondWithResult(_0x13ed26,_0x38f9fb){_0x38f9fb=_0x38f9fb||0xc8;return function(_0x15f23a){if(_0x15f23a){return _0x13ed26[_0xe7d6('0x19')](_0x38f9fb)[_0xe7d6('0x1b')](_0x15f23a);}};}function respondWithFilteredResult(_0x1945b7,_0x257ade){return function(_0x56f2ce){if(_0x56f2ce){var _0x3f9a3b=typeof _0x257ade[_0xe7d6('0x1c')]===_0xe7d6('0x1d')&&typeof _0x257ade[_0xe7d6('0x1e')]===_0xe7d6('0x1d');var _0x222307=_0x56f2ce[_0xe7d6('0x1f')];var _0x4ac22d=_0x3f9a3b?0x0:_0x257ade[_0xe7d6('0x1c')];var _0x2f5e5b=_0x3f9a3b?_0x56f2ce[_0xe7d6('0x1f')]:_0x257ade[_0xe7d6('0x1c')]+_0x257ade[_0xe7d6('0x1e')];var _0x1b7125;if(_0x2f5e5b>=_0x222307){_0x2f5e5b=_0x222307;_0x1b7125=0xc8;}else{_0x1b7125=0xce;}_0x1945b7[_0xe7d6('0x19')](_0x1b7125);return _0x1945b7['set'](_0xe7d6('0x20'),_0x4ac22d+'-'+_0x2f5e5b+'/'+_0x222307)['json'](_0x56f2ce);}return null;};}function patchUpdates(_0x219091){return function(_0x1e69a3){try{jsonpatch[_0xe7d6('0x21')](_0x1e69a3,_0x219091,!![]);}catch(_0x28db4e){return BPromise[_0xe7d6('0x22')](_0x28db4e);}return _0x1e69a3[_0xe7d6('0x23')]();};}function saveUpdates(_0x28b3c9,_0x5b9588){return function(_0x4824ad){if(_0x4824ad){return _0x4824ad[_0xe7d6('0x24')](_0x28b3c9)[_0xe7d6('0x25')](function(_0x533739){return _0x533739;});}return null;};}function removeEntity(_0x28f704,_0x2f54e3){return function(_0x3e4ed7){if(_0x3e4ed7){return _0x3e4ed7[_0xe7d6('0x26')]()[_0xe7d6('0x25')](function(){_0x28f704[_0xe7d6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff2d1,_0x29a617){return function(_0x5c76fb){if(!_0x5c76fb){_0x2ff2d1[_0xe7d6('0x18')](0x194);}return _0x5c76fb;};}function handleError(_0x414381,_0xe016d0){_0xe016d0=_0xe016d0||0x1f4;return function(_0x4a60b4){logger[_0xe7d6('0x27')](_0x4a60b4[_0xe7d6('0x28')]);if(_0x4a60b4[_0xe7d6('0x29')]){delete _0x4a60b4[_0xe7d6('0x29')];}_0x414381[_0xe7d6('0x19')](_0xe016d0)[_0xe7d6('0x2a')](_0x4a60b4);};}exports['index']=function(_0x88c891,_0x379684){var _0x485135={},_0x29ff51={},_0x5b10ae={'count':0x0,'rows':[]};var _0x11c585=_[_0xe7d6('0x2b')](db[_0xe7d6('0x2c')][_0xe7d6('0x2d')],function(_0xe54eda){return{'name':_0xe54eda[_0xe7d6('0x2e')],'type':_0xe54eda[_0xe7d6('0x2f')]['key']};});_0x29ff51['model']=_[_0xe7d6('0x2b')](_0x11c585,'name');_0x29ff51[_0xe7d6('0x30')]=_[_0xe7d6('0x31')](_0x88c891['query']);_0x29ff51[_0xe7d6('0x32')]=_[_0xe7d6('0x33')](_0x29ff51[_0xe7d6('0x34')],_0x29ff51['query']);_0x485135[_0xe7d6('0x35')]=_[_0xe7d6('0x33')](_0x29ff51[_0xe7d6('0x34')],qs[_0xe7d6('0x36')](_0x88c891[_0xe7d6('0x30')][_0xe7d6('0x36')]));_0x485135[_0xe7d6('0x35')]=_0x485135[_0xe7d6('0x35')]['length']?_0x485135['attributes']:_0x29ff51['model'];if(!_0x88c891[_0xe7d6('0x30')][_0xe7d6('0x37')]('nolimit')){_0x485135[_0xe7d6('0x1e')]=qs['limit'](_0x88c891[_0xe7d6('0x30')][_0xe7d6('0x1e')]);_0x485135['offset']=qs['offset'](_0x88c891['query'][_0xe7d6('0x1c')]);}_0x485135['order']=qs[_0xe7d6('0x38')](_0x88c891[_0xe7d6('0x30')]['sort']);_0x485135[_0xe7d6('0x39')]=qs[_0xe7d6('0x32')](_[_0xe7d6('0x3a')](_0x88c891[_0xe7d6('0x30')],_0x29ff51[_0xe7d6('0x32')]),_0x11c585);if(_0x88c891[_0xe7d6('0x30')]['filter']){_0x485135[_0xe7d6('0x39')]=_['merge'](_0x485135['where'],{'$or':_[_0xe7d6('0x2b')](_0x11c585,function(_0x3690ea){if(_0x3690ea[_0xe7d6('0x2f')]!==_0xe7d6('0x3b')){var _0x13d2ff={};_0x13d2ff[_0x3690ea[_0xe7d6('0x29')]]={'$like':'%'+_0x88c891[_0xe7d6('0x30')]['filter']+'%'};return _0x13d2ff;}})});}_0x485135=_['merge']({},_0x485135,_0x88c891['options']);var _0x15c2f9={'where':_0x485135[_0xe7d6('0x39')]};return db[_0xe7d6('0x2c')][_0xe7d6('0x1f')](_0x15c2f9)[_0xe7d6('0x25')](function(_0x3da24f){_0x5b10ae[_0xe7d6('0x1f')]=_0x3da24f;if(_0x88c891[_0xe7d6('0x30')][_0xe7d6('0x3c')]){_0x485135[_0xe7d6('0x3d')]=[{'all':!![]}];}return db[_0xe7d6('0x2c')][_0xe7d6('0x3e')](_0x485135);})[_0xe7d6('0x25')](function(_0xb14909){_0x5b10ae['rows']=_0xb14909;return _0x5b10ae;})['then'](respondWithFilteredResult(_0x379684,_0x485135))['catch'](handleError(_0x379684,null));};exports[_0xe7d6('0x3f')]=function(_0x28e331,_0x5967bf){var _0x382561={'raw':!![],'where':{'id':_0x28e331[_0xe7d6('0x40')]['id']}},_0x35d7e3={};_0x35d7e3[_0xe7d6('0x34')]=_[_0xe7d6('0x31')](db[_0xe7d6('0x2c')][_0xe7d6('0x2d')]);_0x35d7e3[_0xe7d6('0x30')]=_[_0xe7d6('0x31')](_0x28e331['query']);_0x35d7e3['filters']=_[_0xe7d6('0x33')](_0x35d7e3['model'],_0x35d7e3[_0xe7d6('0x30')]);_0x382561[_0xe7d6('0x35')]=_[_0xe7d6('0x33')](_0x35d7e3[_0xe7d6('0x34')],qs[_0xe7d6('0x36')](_0x28e331[_0xe7d6('0x30')]['fields']));_0x382561[_0xe7d6('0x35')]=_0x382561[_0xe7d6('0x35')]['length']?_0x382561[_0xe7d6('0x35')]:_0x35d7e3[_0xe7d6('0x34')];if(_0x28e331[_0xe7d6('0x30')][_0xe7d6('0x3c')]){_0x382561['include']=[{'all':!![]}];}_0x382561=_[_0xe7d6('0x41')]({},_0x382561,_0x28e331[_0xe7d6('0x42')]);return db[_0xe7d6('0x2c')][_0xe7d6('0x43')](_0x382561)[_0xe7d6('0x25')](handleEntityNotFound(_0x5967bf,null))[_0xe7d6('0x25')](respondWithResult(_0x5967bf,null))[_0xe7d6('0x44')](handleError(_0x5967bf,null));};exports[_0xe7d6('0x45')]=function(_0x56f15,_0x538f64){return db['OpenchannelTransferReport'][_0xe7d6('0x45')](_0x56f15[_0xe7d6('0x46')],{})[_0xe7d6('0x25')](respondWithResult(_0x538f64,0xc9))[_0xe7d6('0x44')](handleError(_0x538f64,null));};exports['update']=function(_0x400959,_0x221aa4){if(_0x400959[_0xe7d6('0x46')]['id']){delete _0x400959['body']['id'];}return db[_0xe7d6('0x2c')][_0xe7d6('0x43')]({'where':{'id':_0x400959[_0xe7d6('0x40')]['id']}})[_0xe7d6('0x25')](handleEntityNotFound(_0x221aa4,null))[_0xe7d6('0x25')](saveUpdates(_0x400959[_0xe7d6('0x46')],null))[_0xe7d6('0x25')](respondWithResult(_0x221aa4,null))[_0xe7d6('0x44')](handleError(_0x221aa4,null));};exports[_0xe7d6('0x26')]=function(_0xcd1caa,_0xc82253){return db[_0xe7d6('0x2c')][_0xe7d6('0x43')]({'where':{'id':_0xcd1caa[_0xe7d6('0x40')]['id']}})[_0xe7d6('0x25')](handleEntityNotFound(_0xc82253,null))[_0xe7d6('0x25')](removeEntity(_0xc82253,null))[_0xe7d6('0x44')](handleError(_0xc82253,null));};exports['describe']=function(_0x557eaa,_0x43f663){return db[_0xe7d6('0x2c')][_0xe7d6('0x47')]()[_0xe7d6('0x25')](respondWithResult(_0x43f663,null))[_0xe7d6('0x44')](handleError(_0x43f663,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 292dbc4..5edc44e 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 _0x69f2=['./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x50fe93,_0x2a7c6e){var _0x4b5152=function(_0x11175a){while(--_0x11175a){_0x50fe93['push'](_0x50fe93['shift']());}};_0x4b5152(++_0x2a7c6e);}(_0x69f2,0xbf));var _0x269f=function(_0x5d5df5,_0x14c078){_0x5d5df5=_0x5d5df5-0x0;var _0x4f2018=_0x69f2[_0x5d5df5];return _0x4f2018;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x269f('0x0'));var moment=require(_0x269f('0x1'));var BPromise=require(_0x269f('0x2'));var rp=require(_0x269f('0x3'));var fs=require('fs');var path=require(_0x269f('0x4'));var rimraf=require(_0x269f('0x5'));var config=require(_0x269f('0x6'));var attributes=require(_0x269f('0x7'));module[_0x269f('0x8')]=function(_0x354bfd,_0x4f30d6){return _0x354bfd['define'](_0x269f('0x9'),attributes,{'tableName':_0x269f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ee5=['api','moment','bluebird','path','rimraf','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x11ab0b,_0x4d603a){var _0x5c3c7a=function(_0x454467){while(--_0x454467){_0x11ab0b['push'](_0x11ab0b['shift']());}};_0x5c3c7a(++_0x4d603a);}(_0x2ee5,0xf7));var _0x52ee=function(_0x226f10,_0x50ffd7){_0x226f10=_0x226f10-0x0;var _0x2f280c=_0x2ee5[_0x226f10];return _0x2f280c;};'use strict';var _=require(_0x52ee('0x0'));var util=require(_0x52ee('0x1'));var logger=require(_0x52ee('0x2'))(_0x52ee('0x3'));var moment=require(_0x52ee('0x4'));var BPromise=require(_0x52ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52ee('0x6'));var rimraf=require(_0x52ee('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0xc67c8b,_0x375303){return _0xc67c8b['define'](_0x52ee('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x52ee('0x9'),'fields':[_0x52ee('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 2ea0c23..d9fdbe3 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0xf494,0x1c6));var _0x4f49=function(_0x241199,_0x2f1390){_0x241199=_0x241199-0x0;var _0x256e92=_0xf494[_0x241199];return _0x256e92;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x2494=['../../config/utils','../../config/environment','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b4586,_0x3560e0){var _0x282891=function(_0x2bf0c8){while(--_0x2bf0c8){_0x4b4586['push'](_0x4b4586['shift']());}};_0x282891(++_0x3560e0);}(_0x2494,0x82));var _0x4249=function(_0x542eb5,_0x9d713b){_0x542eb5=_0x542eb5-0x0;var _0xe8056d=_0x2494[_0x542eb5];return _0xe8056d;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var moment=require(_0x4249('0x1'));var BPromise=require(_0x4249('0x2'));var rs=require(_0x4249('0x3'));var fs=require('fs');var Redis=require(_0x4249('0x4'));var db=require(_0x4249('0x5'))['db'];var utils=require(_0x4249('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4249('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4249('0x8')][_0x4249('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed716a,_0x5b1b17,_0x326336){return new BPromise(function(_0x2b7934,_0x21060d){return client['request'](_0xed716a,_0x326336)['then'](function(_0x3efaa6){logger[_0x4249('0xa')](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));logger[_0x4249('0xd')](_0x4249('0xe'),_0x5b1b17,_0x4249('0xc'),JSON['stringify'](_0x3efaa6));if(_0x3efaa6['error']){if(_0x3efaa6[_0x4249('0xf')]['code']===0x1f4){logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6['error'][_0x4249('0x10')]);return _0x21060d(_0x3efaa6[_0x4249('0xf')]['message']);}logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);return _0x2b7934(_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);}else{logger['info'](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));_0x2b7934(_0x3efaa6['result'][_0x4249('0x10')]);}})['catch'](function(_0x501e9c){logger['error'](_0x4249('0xb'),_0x5b1b17,_0x501e9c);_0x21060d(_0x501e9c);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9ac2baf..f3393e8 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 _0xf330=['show','post','create','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xf330,0x147));var _0x0f33=function(_0x8b5787,_0x3c2a22){_0x8b5787=_0x8b5787-0x0;var _0x15422c=_0xf330[_0x8b5787];return _0x15422c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f33('0x0'));var timeout=require(_0x0f33('0x1'));var express=require(_0x0f33('0x2'));var router=express['Router']();var fs_extra=require(_0x0f33('0x3'));var auth=require(_0x0f33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0f33('0x5'));var controller=require('./pause.controller');router[_0x0f33('0x6')]('/',auth[_0x0f33('0x7')](),controller['index']);router[_0x0f33('0x6')](_0x0f33('0x8'),auth['isAuthenticated'](),controller[_0x0f33('0x9')]);router[_0x0f33('0xa')]('/',auth['isAuthenticated'](),controller[_0x0f33('0xb')]);router['put'](_0x0f33('0x8'),auth[_0x0f33('0x7')](),controller['update']);router['delete'](_0x0f33('0x8'),auth[_0x0f33('0x7')](),controller[_0x0f33('0xc')]);module[_0x0f33('0xd')]=router; \ No newline at end of file +var _0xd027=['isAuthenticated','show','post','create','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0xd027,0x197));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7d02('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7d02('0x1'));var router=express[_0x7d02('0x2')]();var fs_extra=require(_0x7d02('0x3'));var auth=require(_0x7d02('0x4'));var interaction=require(_0x7d02('0x5'));var config=require(_0x7d02('0x6'));var controller=require(_0x7d02('0x7'));router[_0x7d02('0x8')]('/',auth['isAuthenticated'](),controller[_0x7d02('0x9')]);router[_0x7d02('0x8')](_0x7d02('0xa'),auth[_0x7d02('0xb')](),controller[_0x7d02('0xc')]);router[_0x7d02('0xd')]('/',auth[_0x7d02('0xb')](),controller[_0x7d02('0xe')]);router[_0x7d02('0xf')](_0x7d02('0xa'),auth[_0x7d02('0xb')](),controller[_0x7d02('0x10')]);router[_0x7d02('0x11')]('/:id',auth[_0x7d02('0xb')](),controller[_0x7d02('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 28cfcb7..b4665ea 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 _0x96a4=['sequelize','STRING','name'];(function(_0x4ec648,_0x34f56c){var _0x543bd9=function(_0x495096){while(--_0x495096){_0x4ec648['push'](_0x4ec648['shift']());}};_0x543bd9(++_0x34f56c);}(_0x96a4,0x18f));var _0x496a=function(_0x2d3911,_0x17b93f){_0x2d3911=_0x2d3911-0x0;var _0x3667df=_0x96a4[_0x2d3911];return _0x3667df;};'use strict';var Sequelize=require(_0x496a('0x0'));module['exports']={'name':{'type':Sequelize[_0x496a('0x1')],'unique':_0x496a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x496a('0x1')]}}; \ No newline at end of file +var _0x2162=['sequelize','exports','STRING'];(function(_0xaa0d3a,_0xa4f8c9){var _0x27725b=function(_0x5c6689){while(--_0x5c6689){_0xaa0d3a['push'](_0xaa0d3a['shift']());}};_0x27725b(++_0xa4f8c9);}(_0x2162,0xfc));var _0x2216=function(_0x10a0e7,_0x5cd95d){_0x10a0e7=_0x10a0e7-0x0;var _0x293b07=_0x2162[_0x10a0e7];return _0x293b07;};'use strict';var Sequelize=require(_0x2216('0x0'));module[_0x2216('0x1')]={'name':{'type':Sequelize[_0x2216('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2216('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6f13c1b..fb22225 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 _0xdba7=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','index','map','Pause','fieldName','key','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','query','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','find','create','body','user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0xabe368,_0x3f80eb){var _0x43bce9=function(_0x2ec1c2){while(--_0x2ec1c2){_0xabe368['push'](_0xabe368['shift']());}};_0x43bce9(++_0x3f80eb);}(_0xdba7,0x13a));var _0x7dba=function(_0x5accc8,_0x378a9a){_0x5accc8=_0x5accc8-0x0;var _0x250f41=_0xdba7[_0x5accc8];return _0x250f41;};'use strict';var emlformat=require(_0x7dba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7dba('0x1'));var jsonpatch=require(_0x7dba('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7dba('0x3'));var Mustache=require(_0x7dba('0x4'));var util=require(_0x7dba('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7dba('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7dba('0x7'));var _=require(_0x7dba('0x8'));var squel=require(_0x7dba('0x9'));var crypto=require(_0x7dba('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7dba('0xb'));var toCsv=require(_0x7dba('0x6'));var querystring=require(_0x7dba('0xc'));var Papa=require(_0x7dba('0xd'));var Redis=require(_0x7dba('0xe'));var authService=require(_0x7dba('0xf'));var qs=require(_0x7dba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7dba('0x11'));var logger=require('../../config/logger')(_0x7dba('0x12'));var utils=require(_0x7dba('0x13'));var config=require(_0x7dba('0x14'));var licenseUtil=require(_0x7dba('0x15'));var db=require(_0x7dba('0x16'))['db'];function respondWithStatusCode(_0x4fe3c9,_0x20f3c6){_0x20f3c6=_0x20f3c6||0xcc;return function(_0x15c5e5){if(_0x15c5e5){return _0x4fe3c9['sendStatus'](_0x20f3c6);}return _0x4fe3c9[_0x7dba('0x17')](_0x20f3c6)[_0x7dba('0x18')]();};}function respondWithResult(_0x2350f4,_0x390ead){_0x390ead=_0x390ead||0xc8;return function(_0x150642){if(_0x150642){return _0x2350f4[_0x7dba('0x17')](_0x390ead)[_0x7dba('0x19')](_0x150642);}};}function respondWithFilteredResult(_0x5ab8c2,_0x5d47ca){return function(_0x148e9c){if(_0x148e9c){var _0x27c205=typeof _0x5d47ca[_0x7dba('0x1a')]===_0x7dba('0x1b')&&typeof _0x5d47ca['limit']===_0x7dba('0x1b');var _0x5ca985=_0x148e9c['count'];var _0x1d6f9d=_0x27c205?0x0:_0x5d47ca['offset'];var _0x1513ea=_0x27c205?_0x148e9c[_0x7dba('0x1c')]:_0x5d47ca[_0x7dba('0x1a')]+_0x5d47ca[_0x7dba('0x1d')];var _0x2bedec;if(_0x1513ea>=_0x5ca985){_0x1513ea=_0x5ca985;_0x2bedec=0xc8;}else{_0x2bedec=0xce;}_0x5ab8c2[_0x7dba('0x17')](_0x2bedec);return _0x5ab8c2['set'](_0x7dba('0x1e'),_0x1d6f9d+'-'+_0x1513ea+'/'+_0x5ca985)[_0x7dba('0x19')](_0x148e9c);}return null;};}function patchUpdates(_0x483bb1){return function(_0x5247b8){try{jsonpatch[_0x7dba('0x1f')](_0x5247b8,_0x483bb1,!![]);}catch(_0x1d918f){return BPromise[_0x7dba('0x20')](_0x1d918f);}return _0x5247b8[_0x7dba('0x21')]();};}function saveUpdates(_0x204f0d,_0xd7292d){return function(_0x1869c8){if(_0x1869c8){return _0x1869c8[_0x7dba('0x22')](_0x204f0d)[_0x7dba('0x23')](function(_0x79bb07){return _0x79bb07;});}return null;};}function removeEntity(_0x355029,_0x4bd2b9){return function(_0x398486){if(_0x398486){return _0x398486[_0x7dba('0x24')]()[_0x7dba('0x23')](function(){var _0x457bf4=_0x398486[_0x7dba('0x25')]({'plain':!![]});var _0x1cf358='Pauses';return db['UserProfileResource'][_0x7dba('0x24')]({'where':{'type':_0x1cf358,'resourceId':_0x457bf4['id']}})[_0x7dba('0x23')](function(){return _0x398486;});})[_0x7dba('0x23')](function(){_0x355029[_0x7dba('0x17')](0xcc)[_0x7dba('0x18')]();});}};}function handleEntityNotFound(_0x37b2f4,_0x2b41d2){return function(_0x405f55){if(!_0x405f55){_0x37b2f4[_0x7dba('0x26')](0x194);}return _0x405f55;};}function handleError(_0x3f28cb,_0x2ee50b){_0x2ee50b=_0x2ee50b||0x1f4;return function(_0x70aa00){logger[_0x7dba('0x27')](_0x70aa00[_0x7dba('0x28')]);if(_0x70aa00[_0x7dba('0x29')]){delete _0x70aa00['name'];}_0x3f28cb[_0x7dba('0x17')](_0x2ee50b)[_0x7dba('0x2a')](_0x70aa00);};}exports[_0x7dba('0x2b')]=function(_0x522d79,_0x1b6ca1){var _0x3c911b={},_0x2ffd0c={},_0x2d1caf={'count':0x0,'rows':[]};var _0x2dd22f=_[_0x7dba('0x2c')](db[_0x7dba('0x2d')]['rawAttributes'],function(_0x5aba81){return{'name':_0x5aba81[_0x7dba('0x2e')],'type':_0x5aba81['type'][_0x7dba('0x2f')]};});_0x2ffd0c['model']=_[_0x7dba('0x2c')](_0x2dd22f,_0x7dba('0x29'));_0x2ffd0c['query']=_[_0x7dba('0x30')](_0x522d79['query']);_0x2ffd0c[_0x7dba('0x31')]=_['intersection'](_0x2ffd0c[_0x7dba('0x32')],_0x2ffd0c['query']);_0x3c911b[_0x7dba('0x33')]=_[_0x7dba('0x34')](_0x2ffd0c[_0x7dba('0x32')],qs['fields'](_0x522d79['query'][_0x7dba('0x35')]));_0x3c911b['attributes']=_0x3c911b['attributes']['length']?_0x3c911b[_0x7dba('0x33')]:_0x2ffd0c[_0x7dba('0x32')];if(!_0x522d79['query'][_0x7dba('0x36')](_0x7dba('0x37'))){_0x3c911b[_0x7dba('0x1d')]=qs[_0x7dba('0x1d')](_0x522d79[_0x7dba('0x38')][_0x7dba('0x1d')]);_0x3c911b['offset']=qs[_0x7dba('0x1a')](_0x522d79[_0x7dba('0x38')][_0x7dba('0x1a')]);}_0x3c911b[_0x7dba('0x39')]=qs[_0x7dba('0x3a')](_0x522d79[_0x7dba('0x38')][_0x7dba('0x3a')]);_0x3c911b[_0x7dba('0x3b')]=qs[_0x7dba('0x31')](_[_0x7dba('0x3c')](_0x522d79['query'],_0x2ffd0c[_0x7dba('0x31')]),_0x2dd22f);if(_0x522d79[_0x7dba('0x38')][_0x7dba('0x3d')]){_0x3c911b[_0x7dba('0x3b')]=_[_0x7dba('0x3e')](_0x3c911b[_0x7dba('0x3b')],{'$or':_[_0x7dba('0x2c')](_0x2dd22f,function(_0x374783){if(_0x374783[_0x7dba('0x3f')]!==_0x7dba('0x40')){var _0x7fbefa={};_0x7fbefa[_0x374783[_0x7dba('0x29')]]={'$like':'%'+_0x522d79[_0x7dba('0x38')]['filter']+'%'};return _0x7fbefa;}})});}_0x3c911b=_[_0x7dba('0x3e')]({},_0x3c911b,_0x522d79[_0x7dba('0x41')]);var _0x3261ce={'where':_0x3c911b[_0x7dba('0x3b')]};return db['Pause'][_0x7dba('0x1c')](_0x3261ce)[_0x7dba('0x23')](function(_0x1ec0f7){_0x2d1caf['count']=_0x1ec0f7;if(_0x522d79['query'][_0x7dba('0x42')]){_0x3c911b['include']=[{'all':!![]}];}return db[_0x7dba('0x2d')][_0x7dba('0x43')](_0x3c911b);})[_0x7dba('0x23')](function(_0x58d44e){_0x2d1caf['rows']=_0x58d44e;return _0x2d1caf;})[_0x7dba('0x23')](respondWithFilteredResult(_0x1b6ca1,_0x3c911b))[_0x7dba('0x44')](handleError(_0x1b6ca1,null));};exports[_0x7dba('0x45')]=function(_0x2c86da,_0x235132){var _0x96a298={'raw':!![],'where':{'id':_0x2c86da[_0x7dba('0x46')]['id']}},_0x4f1c1d={};_0x4f1c1d['model']=_[_0x7dba('0x30')](db[_0x7dba('0x2d')]['rawAttributes']);_0x4f1c1d[_0x7dba('0x38')]=_[_0x7dba('0x30')](_0x2c86da[_0x7dba('0x38')]);_0x4f1c1d['filters']=_[_0x7dba('0x34')](_0x4f1c1d[_0x7dba('0x32')],_0x4f1c1d['query']);_0x96a298[_0x7dba('0x33')]=_[_0x7dba('0x34')](_0x4f1c1d[_0x7dba('0x32')],qs['fields'](_0x2c86da[_0x7dba('0x38')][_0x7dba('0x35')]));_0x96a298[_0x7dba('0x33')]=_0x96a298[_0x7dba('0x33')][_0x7dba('0x47')]?_0x96a298[_0x7dba('0x33')]:_0x4f1c1d[_0x7dba('0x32')];if(_0x2c86da['query'][_0x7dba('0x42')]){_0x96a298[_0x7dba('0x48')]=[{'all':!![]}];}_0x96a298=_[_0x7dba('0x3e')]({},_0x96a298,_0x2c86da[_0x7dba('0x41')]);return db[_0x7dba('0x2d')][_0x7dba('0x49')](_0x96a298)[_0x7dba('0x23')](handleEntityNotFound(_0x235132,null))[_0x7dba('0x23')](respondWithResult(_0x235132,null))['catch'](handleError(_0x235132,null));};exports[_0x7dba('0x4a')]=function(_0x2ebe66,_0x27f227){return db[_0x7dba('0x2d')][_0x7dba('0x4a')](_0x2ebe66[_0x7dba('0x4b')],{})[_0x7dba('0x23')](function(_0x382586){var _0x208a47=_0x2ebe66[_0x7dba('0x4c')][_0x7dba('0x25')]({'plain':!![]});if(!_0x208a47)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x208a47[_0x7dba('0x4d')]===_0x7dba('0x4c')){var _0x19f981=_0x382586['get']({'plain':!![]});var _0x55ffc1=_0x7dba('0x4e');return db[_0x7dba('0x4f')][_0x7dba('0x49')]({'where':{'name':_0x55ffc1,'userProfileId':_0x208a47[_0x7dba('0x50')]},'raw':!![]})['then'](function(_0x1419c0){if(_0x1419c0&&_0x1419c0[_0x7dba('0x51')]===0x0){return db['UserProfileResource'][_0x7dba('0x4a')]({'name':_0x19f981[_0x7dba('0x29')],'resourceId':_0x19f981['id'],'type':_0x1419c0[_0x7dba('0x29')],'sectionId':_0x1419c0['id']},{})[_0x7dba('0x23')](function(){return _0x382586;});}else{return _0x382586;}})[_0x7dba('0x44')](function(_0x27d0ac){logger['error'](_0x7dba('0x52'),_0x27d0ac);throw _0x27d0ac;});}return _0x382586;})['then'](respondWithResult(_0x27f227,0xc9))[_0x7dba('0x44')](handleError(_0x27f227,null));};exports[_0x7dba('0x22')]=function(_0x1d896f,_0x2bc668){if(_0x1d896f[_0x7dba('0x4b')]['id']){delete _0x1d896f[_0x7dba('0x4b')]['id'];}return db[_0x7dba('0x2d')]['find']({'where':{'id':_0x1d896f['params']['id']}})[_0x7dba('0x23')](handleEntityNotFound(_0x2bc668,null))[_0x7dba('0x23')](saveUpdates(_0x1d896f[_0x7dba('0x4b')],null))[_0x7dba('0x23')](respondWithResult(_0x2bc668,null))[_0x7dba('0x44')](handleError(_0x2bc668,null));};exports[_0x7dba('0x24')]=function(_0xfa3e7b,_0x1afa49){return db[_0x7dba('0x2d')][_0x7dba('0x49')]({'where':{'id':_0xfa3e7b[_0x7dba('0x46')]['id']}})[_0x7dba('0x23')](handleEntityNotFound(_0x1afa49,null))[_0x7dba('0x23')](removeEntity(_0x1afa49,null))[_0x7dba('0x44')](handleError(_0x1afa49,null));}; \ No newline at end of file +var _0xfeec=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','update','then','get','Pauses','UserProfileResource','destroy','end','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse'];(function(_0x2dd1e5,_0x305d0d){var _0x180af0=function(_0x53339b){while(--_0x53339b){_0x2dd1e5['push'](_0x2dd1e5['shift']());}};_0x180af0(++_0x305d0d);}(_0xfeec,0x8f));var _0xcfee=function(_0x4fe33b,_0x38b44f){_0x4fe33b=_0x4fe33b-0x0;var _0x28f23f=_0xfeec[_0x4fe33b];return _0x28f23f;};'use strict';var emlformat=require(_0xcfee('0x0'));var rimraf=require(_0xcfee('0x1'));var zipdir=require(_0xcfee('0x2'));var jsonpatch=require(_0xcfee('0x3'));var rp=require('request-promise');var moment=require(_0xcfee('0x4'));var BPromise=require(_0xcfee('0x5'));var Mustache=require(_0xcfee('0x6'));var util=require(_0xcfee('0x7'));var path=require('path');var sox=require(_0xcfee('0x8'));var csv=require(_0xcfee('0x9'));var ejs=require(_0xcfee('0xa'));var fs=require('fs');var fs_extra=require(_0xcfee('0xb'));var _=require(_0xcfee('0xc'));var squel=require(_0xcfee('0xd'));var crypto=require('crypto');var jsforce=require(_0xcfee('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcfee('0x9'));var querystring=require(_0xcfee('0xf'));var Papa=require(_0xcfee('0x10'));var Redis=require(_0xcfee('0x11'));var authService=require(_0xcfee('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcfee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcfee('0x14'));var config=require(_0xcfee('0x15'));var licenseUtil=require(_0xcfee('0x16'));var db=require(_0xcfee('0x17'))['db'];function respondWithStatusCode(_0xe1a65b,_0x5809f6){_0x5809f6=_0x5809f6||0xcc;return function(_0x1a2e2d){if(_0x1a2e2d){return _0xe1a65b[_0xcfee('0x18')](_0x5809f6);}return _0xe1a65b[_0xcfee('0x19')](_0x5809f6)['end']();};}function respondWithResult(_0x2b7ffb,_0x416a45){_0x416a45=_0x416a45||0xc8;return function(_0x273056){if(_0x273056){return _0x2b7ffb[_0xcfee('0x19')](_0x416a45)[_0xcfee('0x1a')](_0x273056);}};}function respondWithFilteredResult(_0x555564,_0x269aa5){return function(_0x45266a){if(_0x45266a){var _0x38054d=typeof _0x269aa5['offset']==='undefined'&&typeof _0x269aa5['limit']==='undefined';var _0x26cb51=_0x45266a[_0xcfee('0x1b')];var _0x267841=_0x38054d?0x0:_0x269aa5[_0xcfee('0x1c')];var _0x24974d=_0x38054d?_0x45266a[_0xcfee('0x1b')]:_0x269aa5['offset']+_0x269aa5['limit'];var _0x51307a;if(_0x24974d>=_0x26cb51){_0x24974d=_0x26cb51;_0x51307a=0xc8;}else{_0x51307a=0xce;}_0x555564[_0xcfee('0x19')](_0x51307a);return _0x555564[_0xcfee('0x1d')](_0xcfee('0x1e'),_0x267841+'-'+_0x24974d+'/'+_0x26cb51)[_0xcfee('0x1a')](_0x45266a);}return null;};}function patchUpdates(_0x1c73da){return function(_0x481346){try{jsonpatch['apply'](_0x481346,_0x1c73da,!![]);}catch(_0xfd7bc3){return BPromise[_0xcfee('0x1f')](_0xfd7bc3);}return _0x481346['save']();};}function saveUpdates(_0x264699,_0x4dcb90){return function(_0x5c8d7e){if(_0x5c8d7e){return _0x5c8d7e[_0xcfee('0x20')](_0x264699)['then'](function(_0x12de29){return _0x12de29;});}return null;};}function removeEntity(_0x28548e,_0x320243){return function(_0x139598){if(_0x139598){return _0x139598['destroy']()[_0xcfee('0x21')](function(){var _0x563e9c=_0x139598[_0xcfee('0x22')]({'plain':!![]});var _0x5e30b7=_0xcfee('0x23');return db[_0xcfee('0x24')][_0xcfee('0x25')]({'where':{'type':_0x5e30b7,'resourceId':_0x563e9c['id']}})[_0xcfee('0x21')](function(){return _0x139598;});})[_0xcfee('0x21')](function(){_0x28548e[_0xcfee('0x19')](0xcc)[_0xcfee('0x26')]();});}};}function handleEntityNotFound(_0x352431,_0x345f78){return function(_0x1be2e1){if(!_0x1be2e1){_0x352431[_0xcfee('0x18')](0x194);}return _0x1be2e1;};}function handleError(_0x37c2a8,_0x1781bf){_0x1781bf=_0x1781bf||0x1f4;return function(_0x17e931){logger['error'](_0x17e931[_0xcfee('0x27')]);if(_0x17e931[_0xcfee('0x28')]){delete _0x17e931[_0xcfee('0x28')];}_0x37c2a8[_0xcfee('0x19')](_0x1781bf)['send'](_0x17e931);};}exports[_0xcfee('0x29')]=function(_0xfa447e,_0x16f64c){var _0x7d268b={},_0x298d76={},_0x993b53={'count':0x0,'rows':[]};var _0x538f77=_[_0xcfee('0x2a')](db[_0xcfee('0x2b')][_0xcfee('0x2c')],function(_0x3a5082){return{'name':_0x3a5082[_0xcfee('0x2d')],'type':_0x3a5082[_0xcfee('0x2e')][_0xcfee('0x2f')]};});_0x298d76[_0xcfee('0x30')]=_[_0xcfee('0x2a')](_0x538f77,'name');_0x298d76[_0xcfee('0x31')]=_[_0xcfee('0x32')](_0xfa447e[_0xcfee('0x31')]);_0x298d76[_0xcfee('0x33')]=_[_0xcfee('0x34')](_0x298d76[_0xcfee('0x30')],_0x298d76[_0xcfee('0x31')]);_0x7d268b['attributes']=_[_0xcfee('0x34')](_0x298d76[_0xcfee('0x30')],qs[_0xcfee('0x35')](_0xfa447e[_0xcfee('0x31')][_0xcfee('0x35')]));_0x7d268b[_0xcfee('0x36')]=_0x7d268b[_0xcfee('0x36')]['length']?_0x7d268b[_0xcfee('0x36')]:_0x298d76['model'];if(!_0xfa447e[_0xcfee('0x31')][_0xcfee('0x37')](_0xcfee('0x38'))){_0x7d268b[_0xcfee('0x39')]=qs[_0xcfee('0x39')](_0xfa447e[_0xcfee('0x31')][_0xcfee('0x39')]);_0x7d268b[_0xcfee('0x1c')]=qs[_0xcfee('0x1c')](_0xfa447e[_0xcfee('0x31')][_0xcfee('0x1c')]);}_0x7d268b[_0xcfee('0x3a')]=qs[_0xcfee('0x3b')](_0xfa447e[_0xcfee('0x31')][_0xcfee('0x3b')]);_0x7d268b[_0xcfee('0x3c')]=qs['filters'](_[_0xcfee('0x3d')](_0xfa447e[_0xcfee('0x31')],_0x298d76['filters']),_0x538f77);if(_0xfa447e['query']['filter']){_0x7d268b[_0xcfee('0x3c')]=_[_0xcfee('0x3e')](_0x7d268b[_0xcfee('0x3c')],{'$or':_[_0xcfee('0x2a')](_0x538f77,function(_0x1425bb){if(_0x1425bb[_0xcfee('0x2e')]!=='VIRTUAL'){var _0x7b10b={};_0x7b10b[_0x1425bb[_0xcfee('0x28')]]={'$like':'%'+_0xfa447e[_0xcfee('0x31')]['filter']+'%'};return _0x7b10b;}})});}_0x7d268b=_['merge']({},_0x7d268b,_0xfa447e[_0xcfee('0x3f')]);var _0xdea1={'where':_0x7d268b[_0xcfee('0x3c')]};return db['Pause'][_0xcfee('0x1b')](_0xdea1)['then'](function(_0x31366e){_0x993b53[_0xcfee('0x1b')]=_0x31366e;if(_0xfa447e[_0xcfee('0x31')][_0xcfee('0x40')]){_0x7d268b['include']=[{'all':!![]}];}return db[_0xcfee('0x2b')][_0xcfee('0x41')](_0x7d268b);})[_0xcfee('0x21')](function(_0x47a9cb){_0x993b53[_0xcfee('0x42')]=_0x47a9cb;return _0x993b53;})[_0xcfee('0x21')](respondWithFilteredResult(_0x16f64c,_0x7d268b))[_0xcfee('0x43')](handleError(_0x16f64c,null));};exports[_0xcfee('0x44')]=function(_0x1c8a2e,_0x6ba1f8){var _0x247ff6={'raw':!![],'where':{'id':_0x1c8a2e['params']['id']}},_0x5623a6={};_0x5623a6[_0xcfee('0x30')]=_['keys'](db[_0xcfee('0x2b')][_0xcfee('0x2c')]);_0x5623a6[_0xcfee('0x31')]=_[_0xcfee('0x32')](_0x1c8a2e[_0xcfee('0x31')]);_0x5623a6[_0xcfee('0x33')]=_[_0xcfee('0x34')](_0x5623a6[_0xcfee('0x30')],_0x5623a6[_0xcfee('0x31')]);_0x247ff6[_0xcfee('0x36')]=_[_0xcfee('0x34')](_0x5623a6[_0xcfee('0x30')],qs['fields'](_0x1c8a2e[_0xcfee('0x31')][_0xcfee('0x35')]));_0x247ff6[_0xcfee('0x36')]=_0x247ff6[_0xcfee('0x36')][_0xcfee('0x45')]?_0x247ff6['attributes']:_0x5623a6[_0xcfee('0x30')];if(_0x1c8a2e[_0xcfee('0x31')][_0xcfee('0x40')]){_0x247ff6['include']=[{'all':!![]}];}_0x247ff6=_[_0xcfee('0x3e')]({},_0x247ff6,_0x1c8a2e[_0xcfee('0x3f')]);return db[_0xcfee('0x2b')]['find'](_0x247ff6)[_0xcfee('0x21')](handleEntityNotFound(_0x6ba1f8,null))[_0xcfee('0x21')](respondWithResult(_0x6ba1f8,null))[_0xcfee('0x43')](handleError(_0x6ba1f8,null));};exports['create']=function(_0x113274,_0x218473){return db[_0xcfee('0x2b')][_0xcfee('0x46')](_0x113274[_0xcfee('0x47')],{})['then'](function(_0x68ccf7){var _0x583d0b=_0x113274[_0xcfee('0x48')][_0xcfee('0x22')]({'plain':!![]});if(!_0x583d0b)throw new Error(_0xcfee('0x49'));if(_0x583d0b[_0xcfee('0x4a')]===_0xcfee('0x48')){var _0x137aed=_0x68ccf7[_0xcfee('0x22')]({'plain':!![]});var _0x1a6aac='Pauses';return db[_0xcfee('0x4b')][_0xcfee('0x4c')]({'where':{'name':_0x1a6aac,'userProfileId':_0x583d0b[_0xcfee('0x4d')]},'raw':!![]})[_0xcfee('0x21')](function(_0x5dc969){if(_0x5dc969&&_0x5dc969['autoAssociation']===0x0){return db[_0xcfee('0x24')][_0xcfee('0x46')]({'name':_0x137aed[_0xcfee('0x28')],'resourceId':_0x137aed['id'],'type':_0x5dc969[_0xcfee('0x28')],'sectionId':_0x5dc969['id']},{})[_0xcfee('0x21')](function(){return _0x68ccf7;});}else{return _0x68ccf7;}})[_0xcfee('0x43')](function(_0x2264f3){logger['error'](_0xcfee('0x4e'),_0x2264f3);throw _0x2264f3;});}return _0x68ccf7;})[_0xcfee('0x21')](respondWithResult(_0x218473,0xc9))[_0xcfee('0x43')](handleError(_0x218473,null));};exports[_0xcfee('0x20')]=function(_0x45d55b,_0x3f43e4){if(_0x45d55b['body']['id']){delete _0x45d55b[_0xcfee('0x47')]['id'];}return db[_0xcfee('0x2b')][_0xcfee('0x4c')]({'where':{'id':_0x45d55b[_0xcfee('0x4f')]['id']}})[_0xcfee('0x21')](handleEntityNotFound(_0x3f43e4,null))['then'](saveUpdates(_0x45d55b[_0xcfee('0x47')],null))[_0xcfee('0x21')](respondWithResult(_0x3f43e4,null))[_0xcfee('0x43')](handleError(_0x3f43e4,null));};exports[_0xcfee('0x25')]=function(_0x1abf4f,_0x59f8de){return db['Pause'][_0xcfee('0x4c')]({'where':{'id':_0x1abf4f[_0xcfee('0x4f')]['id']}})['then'](handleEntityNotFound(_0x59f8de,null))[_0xcfee('0x21')](removeEntity(_0x59f8de,null))[_0xcfee('0x43')](handleError(_0x59f8de,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 000def2..3a41b4c 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x48b8a1,_0x2021e5){var _0x5792e7=function(_0x2dada6){while(--_0x2dada6){_0x48b8a1['push'](_0x48b8a1['shift']());}};_0x5792e7(++_0x2021e5);}(_0xabce,0x103));var _0xeabc=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xabce[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./pause.attributes','exports','define','tools_pauses','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x55ca,0x126));var _0xa55c=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x55ca[_0x396466];return _0x5e9ab4;};'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')]('Pause',attributes,{'tableName':_0xa55c('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 c5887bc..9f84395 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x46f1be,_0x1e662e){var _0x2c5efe=function(_0x253ebf){while(--_0x253ebf){_0x46f1be['push'](_0x46f1be['shift']());}};_0x2c5efe(++_0x1e662e);}(_0x7a54,0x106));var _0x47a5=function(_0x5ca11b,_0xbfa388){_0x5ca11b=_0x5ca11b-0x0;var _0x4dcc29=_0x7a54[_0x5ca11b];return _0x4dcc29;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x287a62,_0x1e8043){var _0x2d04c1=function(_0x10aaae){while(--_0x10aaae){_0x287a62['push'](_0x287a62['shift']());}};_0x2d04c1(++_0x1e8043);}(_0x7a54,0x106));var _0x47a5=function(_0x1c8f48,_0x556173){_0x1c8f48=_0x1c8f48-0x0;var _0x12aeb8=_0x7a54[_0x1c8f48];return _0x12aeb8;};'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 0257541..b76c905 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 _0x04de=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','/webhook','webhookGet','get','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','webhookPost'];(function(_0x328534,_0x33b41e){var _0x2796c0=function(_0x1ba8ad){while(--_0x1ba8ad){_0x328534['push'](_0x328534['shift']());}};_0x2796c0(++_0x33b41e);}(_0x04de,0x107));var _0xe04d=function(_0x47986d,_0x534f9f){_0x47986d=_0x47986d-0x0;var _0x261d3a=_0x04de[_0x47986d];return _0x261d3a;};'use strict';var multer=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var path=require(_0xe04d('0x2'));var timeout=require(_0xe04d('0x3'));var express=require(_0xe04d('0x4'));var router=express[_0xe04d('0x5')]();var fs_extra=require(_0xe04d('0x6'));var auth=require(_0xe04d('0x7'));var interaction=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var controller=require(_0xe04d('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe04d('0xb'),controller[_0xe04d('0xc')]);router[_0xe04d('0xd')](_0xe04d('0xe'),auth[_0xe04d('0xf')](),controller[_0xe04d('0x10')]);router[_0xe04d('0xd')](_0xe04d('0x11'),auth['isAuthenticated'](),controller[_0xe04d('0x12')]);var upload=multer({'storage':multer[_0xe04d('0x13')]({'destination':function(_0x2576b2,_0x30c46b,_0xad5c34){_0xad5c34(null,path[_0xe04d('0x14')](config[_0xe04d('0x15')],_0xe04d('0x16')));},'filename':function(_0x3ccdc8,_0x53f59a,_0x8bf2d2){_0x53f59a[_0xe04d('0x17')]=_0x53f59a[_0xe04d('0x17')][_0xe04d('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x8bf2d2(null,util[_0xe04d('0x19')](_0xe04d('0x1a'),path[_0xe04d('0x1b')](_0x53f59a[_0xe04d('0x17')],path[_0xe04d('0x1c')](_0x53f59a[_0xe04d('0x17')])),Date[_0xe04d('0x1d')](),path[_0xe04d('0x1c')](_0x53f59a['originalname'])));}})});router[_0xe04d('0x1e')]('/',upload['single'](_0xe04d('0x1f')),controller['upload']);router[_0xe04d('0x1e')](_0xe04d('0xb'),controller[_0xe04d('0x20')]);router[_0xe04d('0x21')](_0xe04d('0xe'),auth[_0xe04d('0xf')](),controller[_0xe04d('0x22')]);router[_0xe04d('0x23')](_0xe04d('0xe'),auth['isAuthenticated'](),controller[_0xe04d('0x23')]);module[_0xe04d('0x24')]=router; \ No newline at end of file +var _0x6334=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','format','%s-%s%s','extname','now','originalname','post','file','upload','webhookPost','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5e65a0,_0xa32677){var _0x5ebb07=function(_0x3f87b2){while(--_0x3f87b2){_0x5e65a0['push'](_0x5e65a0['shift']());}};_0x5ebb07(++_0xa32677);}(_0x6334,0x119));var _0x4633=function(_0x1a5687,_0xc2188f){_0x1a5687=_0x1a5687-0x0;var _0x257d5c=_0x6334[_0x1a5687];return _0x257d5c;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),controller['webhookGet']);router[_0x4633('0xa')](_0x4633('0xe'),auth['isAuthenticated'](),controller[_0x4633('0xf')]);router[_0x4633('0xa')](_0x4633('0x10'),auth['isAuthenticated'](),controller[_0x4633('0x11')]);var upload=multer({'storage':multer[_0x4633('0x12')]({'destination':function(_0x5157a7,_0x6a63b,_0x3d5182){_0x3d5182(null,path[_0x4633('0x13')](config[_0x4633('0x14')],'server/files/plugins'));},'filename':function(_0x73b5e4,_0xad405,_0x438e87){_0xad405['originalname']=_0xad405['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x438e87(null,util[_0x4633('0x15')](_0x4633('0x16'),path['basename'](_0xad405['originalname'],path[_0x4633('0x17')](_0xad405['originalname'])),Date[_0x4633('0x18')](),path[_0x4633('0x17')](_0xad405[_0x4633('0x19')])));}})});router[_0x4633('0x1a')]('/',upload['single'](_0x4633('0x1b')),controller[_0x4633('0x1c')]);router[_0x4633('0x1a')]('/webhook',controller[_0x4633('0x1d')]);router[_0x4633('0x1e')](_0x4633('0xe'),auth[_0x4633('0xb')](),controller[_0x4633('0x1f')]);router['delete'](_0x4633('0xe'),auth[_0x4633('0xb')](),controller['delete']);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 e392001..9133ff4 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 _0xc240=['STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc240,0xa7));var _0x0c24=function(_0x239a0d,_0x46512d){_0x239a0d=_0x239a0d-0x0;var _0x180a49=_0xc240[_0x239a0d];return _0x180a49;};'use strict';var Sequelize=require(_0x0c24('0x0'));module[_0x0c24('0x1')]={'name':{'type':Sequelize[_0x0c24('0x2')]},'type':{'type':Sequelize[_0x0c24('0x3')](_0x0c24('0x4'),'script')},'description':{'type':Sequelize[_0x0c24('0x5')]},'version':{'type':Sequelize[_0x0c24('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x0c24('0x6')},'active':{'type':Sequelize[_0x0c24('0x7')],'defaultValue':0x0,'comment':_0x0c24('0x8')},'sidebar':{'type':Sequelize[_0x0c24('0x3')]('adminOnly',_0x0c24('0x9'),_0x0c24('0xa'),_0x0c24('0xb')),'defaultValue':_0x0c24('0xa'),'comment':_0x0c24('0xc')},'icon':{'type':Sequelize[_0x0c24('0x2')]},'adminUrl':{'type':Sequelize[_0x0c24('0x2')]},'agentUrl':{'type':Sequelize[_0x0c24('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x0c24('0x2')]}}; \ No newline at end of file +var _0x668d=['BOOLEAN','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x2a7b59,_0x2996f3){var _0x1f3a82=function(_0x38b6b4){while(--_0x38b6b4){_0x2a7b59['push'](_0x2a7b59['shift']());}};_0x1f3a82(++_0x2996f3);}(_0x668d,0x7e));var _0xd668=function(_0x149474,_0x42adca){_0x149474=_0x149474-0x0;var _0x3bb539=_0x668d[_0x149474];return _0x3bb539;};'use strict';var Sequelize=require(_0xd668('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd668('0x1')](_0xd668('0x2'),_0xd668('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xd668('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0xd668('0x5')},'active':{'type':Sequelize[_0xd668('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xd668('0x1')]('adminOnly',_0xd668('0x7'),_0xd668('0x8'),_0xd668('0x9')),'defaultValue':_0xd668('0x8'),'comment':_0xd668('0xa')},'icon':{'type':Sequelize[_0xd668('0xb')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xd668('0xb')]},'scriptName':{'type':Sequelize[_0xd668('0xb')]},'scriptPath':{'type':Sequelize[_0xd668('0xb')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 0b2507d..227c26a 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 _0x7dbe=['delete','dirname','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','limit','count','apply','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','Plugin','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','intersection','find','download','join','root','format','basename','createWriteStream','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','server/files/plugins','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','info','Download\x20completed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','scriptName','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params'];(function(_0x4ba8c3,_0x33c457){var _0xf65364=function(_0x1c5369){while(--_0x1c5369){_0x4ba8c3['push'](_0x4ba8c3['shift']());}};_0xf65364(++_0x33c457);}(_0x7dbe,0x166));var _0xe7db=function(_0x59809d,_0x4055fb){_0x59809d=_0x59809d-0x0;var _0x4c13d5=_0x7dbe[_0x59809d];return _0x4c13d5;};'use strict';var emlformat=require(_0xe7db('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe7db('0x1'));var moment=require(_0xe7db('0x2'));var BPromise=require(_0xe7db('0x3'));var Mustache=require(_0xe7db('0x4'));var util=require(_0xe7db('0x5'));var path=require(_0xe7db('0x6'));var sox=require(_0xe7db('0x7'));var csv=require(_0xe7db('0x8'));var ejs=require(_0xe7db('0x9'));var fs=require('fs');var fs_extra=require(_0xe7db('0xa'));var _=require(_0xe7db('0xb'));var squel=require(_0xe7db('0xc'));var crypto=require('crypto');var jsforce=require(_0xe7db('0xd'));var deskjs=require(_0xe7db('0xe'));var toCsv=require(_0xe7db('0x8'));var querystring=require(_0xe7db('0xf'));var Papa=require('papaparse');var extract=require(_0xe7db('0x10'));var rimraf=require(_0xe7db('0x11'));var archiver=require(_0xe7db('0x12'));var Redis=require(_0xe7db('0x13'));var authService=require(_0xe7db('0x14'));var qs=require(_0xe7db('0x15'));var as=require(_0xe7db('0x16'));var hardwareService=require(_0xe7db('0x17'));var logger=require(_0xe7db('0x18'))('api');var utils=require(_0xe7db('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe7db('0x1a'))['db'];config[_0xe7db('0x1b')]=_[_0xe7db('0x1c')](config[_0xe7db('0x1b')],{'host':_0xe7db('0x1d'),'port':0x18eb});var socket=require(_0xe7db('0x1e'))(new Redis(config['redis']));require(_0xe7db('0x1f'))[_0xe7db('0x20')](socket);function respondWithStatusCode(_0x3aa237,_0x3c96f7){_0x3c96f7=_0x3c96f7||0xcc;return function(_0x34cb90){if(_0x34cb90){return _0x3aa237[_0xe7db('0x21')](_0x3c96f7);}return _0x3aa237[_0xe7db('0x22')](_0x3c96f7)['end']();};}function respondWithResult(_0x160c60,_0x20e6aa){_0x20e6aa=_0x20e6aa||0xc8;return function(_0x57c9db){if(_0x57c9db){return _0x160c60[_0xe7db('0x22')](_0x20e6aa)['json'](_0x57c9db);}};}function respondWithFilteredResult(_0x1bcf5f,_0x57ac2a){return function(_0x142371){if(_0x142371){var _0x1197f1=typeof _0x57ac2a[_0xe7db('0x23')]===_0xe7db('0x24')&&typeof _0x57ac2a[_0xe7db('0x25')]===_0xe7db('0x24');var _0x17367c=_0x142371[_0xe7db('0x26')];var _0x322f36=_0x1197f1?0x0:_0x57ac2a[_0xe7db('0x23')];var _0x211cf2=_0x1197f1?_0x142371[_0xe7db('0x26')]:_0x57ac2a[_0xe7db('0x23')]+_0x57ac2a[_0xe7db('0x25')];var _0x8186d5;if(_0x211cf2>=_0x17367c){_0x211cf2=_0x17367c;_0x8186d5=0xc8;}else{_0x8186d5=0xce;}_0x1bcf5f[_0xe7db('0x22')](_0x8186d5);return _0x1bcf5f['set']('Content-Range',_0x322f36+'-'+_0x211cf2+'/'+_0x17367c)['json'](_0x142371);}return null;};}function patchUpdates(_0x2a996d){return function(_0x580ed0){try{jsonpatch[_0xe7db('0x27')](_0x580ed0,_0x2a996d,!![]);}catch(_0x286ea4){return BPromise['reject'](_0x286ea4);}return _0x580ed0[_0xe7db('0x28')]();};}function saveUpdates(_0x25ea44,_0x4c6635){return function(_0x3d7fb7){if(_0x3d7fb7){return _0x3d7fb7[_0xe7db('0x29')](_0x25ea44)[_0xe7db('0x2a')](function(_0x117e8e){return _0x117e8e;});}return null;};}function removeEntity(_0x33438c,_0x5d0627){return function(_0xf650b1){if(_0xf650b1){return _0xf650b1[_0xe7db('0x2b')]()['then'](function(){var _0x5f587e=_0xf650b1[_0xe7db('0x2c')]({'plain':!![]});var _0x41c5a7='Plugins';return db[_0xe7db('0x2d')][_0xe7db('0x2b')]({'where':{'type':_0x41c5a7,'resourceId':_0x5f587e['id']}})['then'](function(){return _0xf650b1;});})['then'](function(){_0x33438c['status'](0xcc)[_0xe7db('0x2e')]();});}};}function handleEntityNotFound(_0x4287c6,_0x26a8eb){return function(_0x26423d){if(!_0x26423d){_0x4287c6[_0xe7db('0x21')](0x194);}return _0x26423d;};}function handleError(_0xc00514,_0x125ec2){_0x125ec2=_0x125ec2||0x1f4;return function(_0x5c65ee){logger[_0xe7db('0x2f')](_0x5c65ee[_0xe7db('0x30')]);if(_0x5c65ee['name']){delete _0x5c65ee[_0xe7db('0x31')];}_0xc00514[_0xe7db('0x22')](_0x125ec2)[_0xe7db('0x32')](_0x5c65ee);};}exports['index']=function(_0x3eebb7,_0x251a45){var _0x292d7b={},_0x2615a1={},_0x35f771={'count':0x0,'rows':[]};var _0x2c04ea=_[_0xe7db('0x33')](db[_0xe7db('0x34')][_0xe7db('0x35')],function(_0x255666){return{'name':_0x255666['fieldName'],'type':_0x255666[_0xe7db('0x36')]['key']};});_0x2615a1[_0xe7db('0x37')]=_[_0xe7db('0x33')](_0x2c04ea,_0xe7db('0x31'));_0x2615a1[_0xe7db('0x38')]=_[_0xe7db('0x39')](_0x3eebb7[_0xe7db('0x38')]);_0x2615a1[_0xe7db('0x3a')]=_['intersection'](_0x2615a1['model'],_0x2615a1[_0xe7db('0x38')]);_0x292d7b[_0xe7db('0x3b')]=_['intersection'](_0x2615a1[_0xe7db('0x37')],qs[_0xe7db('0x3c')](_0x3eebb7[_0xe7db('0x38')][_0xe7db('0x3c')]));_0x292d7b[_0xe7db('0x3b')]=_0x292d7b[_0xe7db('0x3b')][_0xe7db('0x3d')]?_0x292d7b['attributes']:_0x2615a1['model'];if(!_0x3eebb7['query'][_0xe7db('0x3e')](_0xe7db('0x3f'))){_0x292d7b[_0xe7db('0x25')]=qs[_0xe7db('0x25')](_0x3eebb7[_0xe7db('0x38')][_0xe7db('0x25')]);_0x292d7b[_0xe7db('0x23')]=qs['offset'](_0x3eebb7[_0xe7db('0x38')][_0xe7db('0x23')]);}_0x292d7b['order']=qs[_0xe7db('0x40')](_0x3eebb7[_0xe7db('0x38')][_0xe7db('0x40')]);_0x292d7b[_0xe7db('0x41')]=qs[_0xe7db('0x3a')](_[_0xe7db('0x42')](_0x3eebb7[_0xe7db('0x38')],_0x2615a1['filters']),_0x2c04ea);if(_0x3eebb7[_0xe7db('0x38')][_0xe7db('0x43')]){_0x292d7b[_0xe7db('0x41')]=_['merge'](_0x292d7b[_0xe7db('0x41')],{'$or':_['map'](_0x2c04ea,function(_0x39052b){if(_0x39052b[_0xe7db('0x36')]!=='VIRTUAL'){var _0x17e1d0={};_0x17e1d0[_0x39052b[_0xe7db('0x31')]]={'$like':'%'+_0x3eebb7[_0xe7db('0x38')]['filter']+'%'};return _0x17e1d0;}})});}_0x292d7b=_[_0xe7db('0x44')]({},_0x292d7b,_0x3eebb7[_0xe7db('0x45')]);var _0x546609={'where':_0x292d7b[_0xe7db('0x41')]};return db[_0xe7db('0x34')]['count'](_0x546609)['then'](function(_0x15237d){_0x35f771[_0xe7db('0x26')]=_0x15237d;if(_0x3eebb7[_0xe7db('0x38')][_0xe7db('0x46')]){_0x292d7b[_0xe7db('0x47')]=[{'all':!![]}];}return db[_0xe7db('0x34')][_0xe7db('0x48')](_0x292d7b);})['then'](function(_0x3120b7){_0x35f771[_0xe7db('0x49')]=_0x3120b7;return _0x35f771;})[_0xe7db('0x2a')](respondWithFilteredResult(_0x251a45,_0x292d7b))[_0xe7db('0x4a')](handleError(_0x251a45,null));};exports[_0xe7db('0x4b')]=function(_0x14babd,_0x13e325){var _0x32b557={'raw':!![],'where':{'id':_0x14babd['params']['id']}},_0x3c15ef={};_0x3c15ef['model']=_[_0xe7db('0x39')](db['Plugin'][_0xe7db('0x35')]);_0x3c15ef[_0xe7db('0x38')]=_[_0xe7db('0x39')](_0x14babd['query']);_0x3c15ef[_0xe7db('0x3a')]=_['intersection'](_0x3c15ef[_0xe7db('0x37')],_0x3c15ef[_0xe7db('0x38')]);_0x32b557[_0xe7db('0x3b')]=_[_0xe7db('0x4c')](_0x3c15ef['model'],qs['fields'](_0x14babd[_0xe7db('0x38')][_0xe7db('0x3c')]));_0x32b557[_0xe7db('0x3b')]=_0x32b557[_0xe7db('0x3b')][_0xe7db('0x3d')]?_0x32b557[_0xe7db('0x3b')]:_0x3c15ef[_0xe7db('0x37')];if(_0x14babd[_0xe7db('0x38')][_0xe7db('0x46')]){_0x32b557[_0xe7db('0x47')]=[{'all':!![]}];}_0x32b557=_['merge']({},_0x32b557,_0x14babd[_0xe7db('0x45')]);return db[_0xe7db('0x34')][_0xe7db('0x4d')](_0x32b557)[_0xe7db('0x2a')](handleEntityNotFound(_0x13e325,null))[_0xe7db('0x2a')](respondWithResult(_0x13e325,null))[_0xe7db('0x4a')](handleError(_0x13e325,null));};exports[_0xe7db('0x4e')]=function(_0xd8f027,_0x22ae3d,_0x5e4aac){return db[_0xe7db('0x34')][_0xe7db('0x4d')]({'where':{'id':_0xd8f027['params']['id']},'attributes':[_0xe7db('0x31'),_0xe7db('0x6')],'raw':!![]})[_0xe7db('0x2a')](handleEntityNotFound(_0x22ae3d,null))[_0xe7db('0x2a')](function(_0x2d34a7){if(_0x2d34a7){var _0x8d6dbc=path[_0xe7db('0x4f')](config[_0xe7db('0x50')],'server/files/plugins',util[_0xe7db('0x51')]('%s.zip',path[_0xe7db('0x52')](_0x2d34a7[_0xe7db('0x6')])));var _0x3976aa=fs[_0xe7db('0x53')](_0x8d6dbc);var _0x1fc5c5=archiver(_0xe7db('0x54'),{'zlib':{'level':0x9}});_0x1fc5c5['on']('warning',function(_0x5ca52a){if(_0x5ca52a[_0xe7db('0x55')]==='ENOENT'){logger['error'](_0x5ca52a);}else{throw new db[(_0xe7db('0x56'))][(_0xe7db('0x57'))](_0xe7db('0x58'));}});_0x1fc5c5['on'](_0xe7db('0x2f'),function(_0x401ad6){throw new db[(_0xe7db('0x56'))][(_0xe7db('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x1fc5c5['pipe'](_0x3976aa);_0x1fc5c5['glob'](_0xe7db('0x59'),{'cwd':path[_0xe7db('0x4f')](config[_0xe7db('0x50')],_0xe7db('0x5a'),path['dirname'](_0x2d34a7[_0xe7db('0x6')])),'ignore':[path['join'](path[_0xe7db('0x52')](_0x2d34a7['path']),_0xe7db('0x5b')),path[_0xe7db('0x4f')](path[_0xe7db('0x52')](_0x2d34a7[_0xe7db('0x6')]),_0xe7db('0x5c'))],'nodir':!![]})[_0xe7db('0x5d')]();_0x3976aa['on'](_0xe7db('0x5e'),function(){if(!fs[_0xe7db('0x5f')](_0x8d6dbc)){throw new db[(_0xe7db('0x56'))][(_0xe7db('0x57'))](_0xe7db('0x60'));}return _0x22ae3d['download'](_0x8d6dbc,util[_0xe7db('0x51')](_0xe7db('0x61'),path[_0xe7db('0x52')](_0x2d34a7[_0xe7db('0x6')])),function(_0x1ae0be){if(_0x1ae0be){throw new db[(_0xe7db('0x56'))][(_0xe7db('0x57'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x8d6dbc);logger[_0xe7db('0x62')](_0xe7db('0x63'));logger[_0xe7db('0x62')]('Temporary\x20file\x20removed');});});}return null;})[_0xe7db('0x4a')](handleError(_0x22ae3d,null));};exports[_0xe7db('0x64')]=function(_0x3a7da0,_0x434928,_0x31561c){var _0x14216f=path[_0xe7db('0x52')](_0x3a7da0[_0xe7db('0x65')]['filename'],path[_0xe7db('0x66')](_0x3a7da0[_0xe7db('0x65')][_0xe7db('0x67')]));var _0x40f2d2=path[_0xe7db('0x4f')](config[_0xe7db('0x50')],_0xe7db('0x5a'),_0x3a7da0[_0xe7db('0x65')][_0xe7db('0x67')]);var _0x3000db=path[_0xe7db('0x4f')](config[_0xe7db('0x50')],'server/files/plugins',_0x14216f);logger[_0xe7db('0x62')](_0xe7db('0x68'),_0x40f2d2);logger[_0xe7db('0x62')](_0xe7db('0x69'),_0x3000db);try{fs[_0xe7db('0x6a')](_0x40f2d2,parseInt(_0xe7db('0x6b'),0x8));extract(_0x40f2d2,{'dir':_0x3000db},function(_0x5beced){if(_0x5beced){logger['error'](_0x5beced);handleError(_0x5beced,!![]);};var _0x172895=fs['readdirSync'](_0x3000db);if(_0x172895[_0xe7db('0x3d')]>0x1){removeReferences(_0x40f2d2,_0x3000db);logger[_0xe7db('0x2f')](_0xe7db('0x6c'));return _0x31561c(new Error(_0xe7db('0x6c')));}var _0x2e3cfb=fs[_0xe7db('0x6d')](path[_0xe7db('0x4f')](_0x3000db,_0x172895[0x0]));if(_0x2e3cfb[_0xe7db('0x6e')]()){removeReferences(_0x40f2d2,_0x3000db);logger[_0xe7db('0x2f')]('Invalid\x20plugin\x20structure');return _0x31561c(new Error(_0xe7db('0x6c')));}if(_0x2e3cfb[_0xe7db('0x6f')]()){var _0x55b20d=fs['readdirSync'](path[_0xe7db('0x4f')](_0x3000db,_0x172895[0x0]));if(_0x55b20d[_0xe7db('0x3d')]===0x0){removeReferences(_0x40f2d2,_0x3000db);logger['error'](_0xe7db('0x6c'));return _0x31561c(new Error('Invalid\x20plugin\x20structure'));}var _0x120bb7=_0x55b20d[_0xe7db('0x70')](function(_0x4e7deb){return _0x4e7deb===_0xe7db('0x71');});if(!_0x120bb7){return _0x31561c(new Error('Plugin\x20manifest\x20missing'));}var _0x450b01=fs[_0xe7db('0x72')](path[_0xe7db('0x4f')](_0x3000db,_0x172895[0x0],_0xe7db('0x71')));var _0x4ae736=JSON[_0xe7db('0x73')](_0x450b01);if(_0xe7db('0x24')==typeof _0x4ae736[_0xe7db('0x31')]){return _0x31561c(new Error(_0xe7db('0x74')));}if('undefined'==typeof _0x4ae736[_0xe7db('0x36')]){return _0x31561c(new Error(_0xe7db('0x75')));}if(_0xe7db('0x24')==typeof _0x4ae736[_0xe7db('0x76')]){return _0x31561c(new Error(_0xe7db('0x77')));}if(_0xe7db('0x24')==typeof _0x4ae736[_0xe7db('0x78')]){return _0x31561c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4ae736[_0xe7db('0x36')]==='html'){if('undefined'==typeof _0x4ae736[_0xe7db('0x78')][_0xe7db('0x79')]){return _0x31561c(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xe7db('0x24')==typeof _0x4ae736[_0xe7db('0x78')][_0xe7db('0x79')][_0xe7db('0x7a')]&&_0xe7db('0x24')==typeof _0x4ae736['parameters'][_0xe7db('0x79')]['agent']){return _0x31561c(new Error(_0xe7db('0x7b')));}}else if(_0x4ae736['type']===_0xe7db('0x7c')){if('undefined'==typeof _0x4ae736[_0xe7db('0x78')]['scriptName']){return _0x31561c(new Error(_0xe7db('0x7d')));}if(_0xe7db('0x24')==typeof _0x4ae736[_0xe7db('0x78')][_0xe7db('0x7e')]){return _0x31561c(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x31561c(new Error(_0xe7db('0x7f')));}var _0x4325ac=_0x4ae736[_0xe7db('0x31')];var _0x58e8ce=_0x4ae736[_0xe7db('0x80')];var _0x5d1682=_0x4ae736['type'];var _0x118e92=_0x4ae736['sidebar']?_0x4ae736[_0xe7db('0x81')]:_0xe7db('0x82');var _0x3f282b=_0x4ae736[_0xe7db('0x83')]?_0x4ae736['icon']:_0xe7db('0x84');var _0xd465d2='';var _0x397291='';var _0x19e465='';var _0x9b889c='';var _0x41d157=_0x4ae736['version'];if(_0x5d1682===_0xe7db('0x85')){if(_0xe7db('0x24')!=typeof _0x4ae736['parameters'][_0xe7db('0x79')][_0xe7db('0x7a')]){var _0x12de98=_0x4ae736['parameters'][_0xe7db('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xe7db('0x86')](_0x12de98)){_0xd465d2=path[_0xe7db('0x4f')]('plugins',_0x14216f,_0x172895[0x0],_0x12de98);}else{_0xd465d2=_0x12de98;}}else{logger['info'](_0xe7db('0x87'));}if(_0xe7db('0x24')!=typeof _0x4ae736[_0xe7db('0x78')][_0xe7db('0x79')][_0xe7db('0x88')]){var _0x9c8627=_0x4ae736[_0xe7db('0x78')][_0xe7db('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xe7db('0x86')](_0x9c8627)){_0x397291=path['join'](_0xe7db('0x89'),_0x14216f,_0x172895[0x0],_0x9c8627);}else{_0x397291=_0x9c8627;}}else{logger[_0xe7db('0x62')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5d1682==='script'){_0x19e465=_0x4ae736['parameters'][_0xe7db('0x8a')];_0x9b889c=_0x4ae736[_0xe7db('0x78')]['scriptPath'];if(_0xe7db('0x24')!=typeof _0x4ae736[_0xe7db('0x78')]['views']){if(_0xe7db('0x24')!=typeof _0x4ae736[_0xe7db('0x78')]['views'][_0xe7db('0x7a')]){var _0x12de98=_0x4ae736[_0xe7db('0x78')][_0xe7db('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xe7db('0x86')](_0x12de98)){_0xd465d2=path[_0xe7db('0x4f')]('plugins',_0x14216f,_0x172895[0x0],_0x12de98);}else{_0xd465d2=_0x12de98;}}if('undefined'!=typeof _0x4ae736[_0xe7db('0x78')][_0xe7db('0x79')][_0xe7db('0x88')]){var _0x9c8627=_0x4ae736[_0xe7db('0x78')][_0xe7db('0x79')][_0xe7db('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xe7db('0x86')](_0x9c8627)){_0x397291=path[_0xe7db('0x4f')]('plugins',_0x14216f,_0x172895[0x0],_0x9c8627);}else{_0x397291=_0x9c8627;}}}}var _0x3e7aa9={'name':_0x4325ac,'description':_0x58e8ce,'path':path[_0xe7db('0x4f')](_0x14216f,_0x172895[0x0]),'type':_0x5d1682,'sidebar':_0x118e92,'icon':_0x3f282b,'adminUrl':_0xd465d2,'agentUrl':_0x397291,'scriptName':_0x19e465,'scriptPath':_0x9b889c,'version':_0x41d157};removeReferences(_0x40f2d2,null);return db[_0xe7db('0x34')][_0xe7db('0x8b')](_0x3e7aa9)['then'](function(_0x18fcaf){var _0x1489bf={'role':_0x3a7da0[_0xe7db('0x8c')]['role'],'userProfileId':_0x3a7da0['body']['userProfileId']};if(!_0x1489bf)throw new Error(_0xe7db('0x8d'));if(_0x1489bf['role']==='user'){var _0xef6ed4=_0x18fcaf[_0xe7db('0x2c')]({'plain':!![]});return db['UserProfileSection'][_0xe7db('0x4d')]({'where':{'name':_0xe7db('0x8e'),'userProfileId':_0x1489bf['userProfileId']},'raw':!![]})['then'](function(_0x14c41d){if(_0x14c41d&&_0x14c41d[_0xe7db('0x8f')]===0x0){return db['UserProfileResource']['create']({'name':_0xef6ed4[_0xe7db('0x31')],'resourceId':_0xef6ed4['id'],'type':_0x14c41d[_0xe7db('0x31')],'sectionId':_0x14c41d['id']},{})[_0xe7db('0x2a')](function(){return _0x18fcaf;});}else{return _0x18fcaf;}})[_0xe7db('0x4a')](function(_0x2bf6cc){logger[_0xe7db('0x2f')](_0xe7db('0x90'),_0x2bf6cc);throw _0x2bf6cc;});}return _0x18fcaf;})[_0xe7db('0x2a')](respondWithResult(_0x434928,null))['catch'](handleError(_0x434928,null));}});}catch(_0x4e0fc4){_0x434928[_0xe7db('0x22')](0x1f4)['send'](_0x4e0fc4);}};function removeReferences(_0x48c032,_0x3525d3){try{if(_0x48c032){fs[_0xe7db('0x91')](_0x48c032);logger['info'](_0xe7db('0x92'));}if(_0x3525d3){rimraf(_0x3525d3,function(){});logger[_0xe7db('0x62')](_0xe7db('0x93'));}}catch(_0x1523ca){logger['error'](_0x1523ca);}}exports['update']=function(_0x4a139f,_0x5430ec,_0x34cc50){return db[_0xe7db('0x34')]['find']({'where':{'id':_0x4a139f[_0xe7db('0x94')]['id']}})[_0xe7db('0x2a')](handleEntityNotFound(_0x5430ec,null))[_0xe7db('0x2a')](saveUpdates(_0x4a139f[_0xe7db('0x8c')],null))['then'](respondWithResult(_0x5430ec,null))[_0xe7db('0x4a')](handleError(_0x5430ec,null));};exports[_0xe7db('0x95')]=function(_0x1d559c,_0x473e7a,_0x31a9bc){return db[_0xe7db('0x34')][_0xe7db('0x4d')]({'where':{'id':_0x1d559c[_0xe7db('0x94')]['id']}})['then'](function(_0x119a3d){if(_0x119a3d){return _0x119a3d['destroy']();}})[_0xe7db('0x2a')](function(_0x722a7a){rimraf(path['join'](config['root'],_0xe7db('0x5a'),path[_0xe7db('0x96')](_0x722a7a[_0xe7db('0x6')])),function(){});return _0x722a7a;})[_0xe7db('0x2a')](handleEntityNotFound(_0x473e7a,null))[_0xe7db('0x2a')](respondWithStatusCode(_0x473e7a,null))['catch'](handleError(_0x473e7a,null));};exports[_0xe7db('0x97')]=function(_0xbe5cdd,_0x16e71c,_0x50c6dc){return BPromise[_0xe7db('0x98')]()['then'](function(){if(!_0xbe5cdd['query'][_0xe7db('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xbe5cdd[_0xe7db('0x38')][_0xe7db('0x99')]){throw new Error(_0xe7db('0x9a'));}var _0x2fc54f=_0xbe5cdd[_0xe7db('0x38')][_0xe7db('0x9b')]?_0xbe5cdd['query'][_0xe7db('0x9b')]+':'+_0xbe5cdd[_0xe7db('0x38')]['port']:_0xe7db('0x9c')+_0xbe5cdd[_0xe7db('0x38')]['port'];var _0x3131f6=_0xbe5cdd[_0xe7db('0x38')][_0xe7db('0x9d')]?_0xbe5cdd[_0xe7db('0x38')]['json']:!![];var _0x92fc6=_0xbe5cdd[_0xe7db('0x38')]['encoding']?_0xbe5cdd[_0xe7db('0x38')][_0xe7db('0x9e')]:null;var _0x3e35d1={'method':_0xbe5cdd[_0xe7db('0x9f')],'uri':util['format'](_0xe7db('0xa0'),_0x2fc54f,_0xbe5cdd[_0xe7db('0x38')]['path']),'json':_0x3131f6,'resolveWithFullResponse':!![],'encoding':_0x92fc6,'qs':_0xbe5cdd[_0xe7db('0x38')]};if(_0xbe5cdd[_0xe7db('0xa1')]){_0x3e35d1[_0xe7db('0xa1')]=_0xbe5cdd[_0xe7db('0xa1')];if(_0x3e35d1[_0xe7db('0xa1')]['content-length']){delete _0x3e35d1[_0xe7db('0xa1')][_0xe7db('0xa2')];}}if(_0x3e35d1['headers']['content-type']){delete _0x3e35d1['headers'][_0xe7db('0xa3')];}return rp(_0x3e35d1);})[_0xe7db('0x2a')](function(_0xde5a7c){if(_0xde5a7c){_0x16e71c[_0xe7db('0xa4')](_0xde5a7c[_0xe7db('0xa1')]);logger[_0xe7db('0x62')](_0xde5a7c[_0xe7db('0x8c')]);if(_[_0xe7db('0xa5')](_0xbe5cdd[_0xe7db('0x38')]['path'],_0xe7db('0x4e'))&&_0xde5a7c[_0xe7db('0xa6')]==0x1f4){return _0x16e71c[_0xe7db('0x21')](_0xde5a7c[_0xe7db('0xa6')]);}else{return _0x16e71c[_0xe7db('0x22')](_0xde5a7c[_0xe7db('0xa6')])[_0xe7db('0x32')](_0xde5a7c[_0xe7db('0x8c')]);}}else{return _0x16e71c[_0xe7db('0x21')](0xc8);}})[_0xe7db('0x4a')](handleError(_0x16e71c,null));};exports[_0xe7db('0xa7')]=function(_0x5cf3cc,_0x3cd1bf,_0xa1aeb4){return BPromise[_0xe7db('0x98')]()[_0xe7db('0x2a')](function(){if(!_0x5cf3cc[_0xe7db('0x38')]['path']){throw new Error(_0xe7db('0xa8'));}if(!_0x5cf3cc[_0xe7db('0x38')][_0xe7db('0x99')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x358c39=_0x5cf3cc[_0xe7db('0x38')]['hostname']?_0x5cf3cc[_0xe7db('0x38')]['hostname']+':'+_0x5cf3cc[_0xe7db('0x38')][_0xe7db('0x99')]:_0xe7db('0x9c')+_0x5cf3cc[_0xe7db('0x38')]['port'];var _0x5353eb=_0x5cf3cc[_0xe7db('0x38')][_0xe7db('0x9d')]?_0x5cf3cc[_0xe7db('0x38')]['json']:!![];var _0x4dcea2=_0x5cf3cc['query'][_0xe7db('0x9e')]?_0x5cf3cc[_0xe7db('0x38')][_0xe7db('0x9e')]:null;var _0x36f0d4={'method':_0x5cf3cc[_0xe7db('0x9f')],'uri':util['format'](_0xe7db('0xa0'),_0x358c39,_0x5cf3cc['query']['path']),'json':_0x5353eb,'resolveWithFullResponse':!![],'encoding':_0x4dcea2,'body':_0x5cf3cc[_0xe7db('0x8c')]};if(_0x5cf3cc[_0xe7db('0xa1')]){_0x36f0d4['headers']=_0x5cf3cc[_0xe7db('0xa1')];if(_0x36f0d4['headers'][_0xe7db('0xa2')]){delete _0x36f0d4[_0xe7db('0xa1')][_0xe7db('0xa2')];}}if(_0x36f0d4[_0xe7db('0xa1')][_0xe7db('0xa3')]){delete _0x36f0d4['headers'][_0xe7db('0xa3')];}return rp(_0x36f0d4);})['then'](function(_0x36450a){if(_0x36450a){_0x3cd1bf[_0xe7db('0xa4')](_0x36450a[_0xe7db('0xa1')]);logger[_0xe7db('0x62')](_0x36450a[_0xe7db('0x8c')]);return _0x3cd1bf[_0xe7db('0x22')](_0x36450a[_0xe7db('0xa6')])['send'](_0x36450a[_0xe7db('0x8c')]);}else{return _0x3cd1bf[_0xe7db('0x21')](0xc8);}})[_0xe7db('0x4a')](handleError(_0x3cd1bf,null));}; \ No newline at end of file +var _0xd006=['headers','content-type','statusCode','content-length','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','index','Plugin','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','download','find','root','server/files/plugins','%s.zip','createWriteStream','zip','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','join','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','Sequelize','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','version','html','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s'];(function(_0x137d1d,_0x35c663){var _0x485108=function(_0x108a2a){while(--_0x108a2a){_0x137d1d['push'](_0x137d1d['shift']());}};_0x485108(++_0x35c663);}(_0xd006,0x164));var _0x6d00=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xd006[_0x1e9424];return _0x1bd96c;};'use strict';var emlformat=require(_0x6d00('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d00('0x1'));var jsonpatch=require(_0x6d00('0x2'));var rp=require(_0x6d00('0x3'));var moment=require('moment');var BPromise=require(_0x6d00('0x4'));var Mustache=require(_0x6d00('0x5'));var util=require(_0x6d00('0x6'));var path=require(_0x6d00('0x7'));var sox=require(_0x6d00('0x8'));var csv=require(_0x6d00('0x9'));var ejs=require(_0x6d00('0xa'));var fs=require('fs');var fs_extra=require(_0x6d00('0xb'));var _=require(_0x6d00('0xc'));var squel=require(_0x6d00('0xd'));var crypto=require('crypto');var jsforce=require(_0x6d00('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6d00('0x9'));var querystring=require(_0x6d00('0xf'));var Papa=require(_0x6d00('0x10'));var extract=require(_0x6d00('0x11'));var rimraf=require(_0x6d00('0x12'));var archiver=require(_0x6d00('0x13'));var Redis=require(_0x6d00('0x14'));var authService=require(_0x6d00('0x15'));var qs=require(_0x6d00('0x16'));var as=require(_0x6d00('0x17'));var hardwareService=require(_0x6d00('0x18'));var logger=require(_0x6d00('0x19'))(_0x6d00('0x1a'));var utils=require('../../config/utils');var config=require(_0x6d00('0x1b'));var licenseUtil=require(_0x6d00('0x1c'));var db=require(_0x6d00('0x1d'))['db'];config[_0x6d00('0x1e')]=_[_0x6d00('0x1f')](config[_0x6d00('0x1e')],{'host':_0x6d00('0x20'),'port':0x18eb});var socket=require(_0x6d00('0x21'))(new Redis(config[_0x6d00('0x1e')]));require(_0x6d00('0x22'))[_0x6d00('0x23')](socket);function respondWithStatusCode(_0x5d6f28,_0x4b29e1){_0x4b29e1=_0x4b29e1||0xcc;return function(_0x34656d){if(_0x34656d){return _0x5d6f28[_0x6d00('0x24')](_0x4b29e1);}return _0x5d6f28[_0x6d00('0x25')](_0x4b29e1)[_0x6d00('0x26')]();};}function respondWithResult(_0x4f4d82,_0x3cdd4f){_0x3cdd4f=_0x3cdd4f||0xc8;return function(_0x52ba46){if(_0x52ba46){return _0x4f4d82[_0x6d00('0x25')](_0x3cdd4f)[_0x6d00('0x27')](_0x52ba46);}};}function respondWithFilteredResult(_0x1c92e8,_0x12003f){return function(_0x4e86bf){if(_0x4e86bf){var _0x3e0b48=typeof _0x12003f['offset']===_0x6d00('0x28')&&typeof _0x12003f[_0x6d00('0x29')]===_0x6d00('0x28');var _0x197750=_0x4e86bf[_0x6d00('0x2a')];var _0x43c7b5=_0x3e0b48?0x0:_0x12003f[_0x6d00('0x2b')];var _0x410f43=_0x3e0b48?_0x4e86bf[_0x6d00('0x2a')]:_0x12003f[_0x6d00('0x2b')]+_0x12003f[_0x6d00('0x29')];var _0x3299ff;if(_0x410f43>=_0x197750){_0x410f43=_0x197750;_0x3299ff=0xc8;}else{_0x3299ff=0xce;}_0x1c92e8['status'](_0x3299ff);return _0x1c92e8[_0x6d00('0x2c')](_0x6d00('0x2d'),_0x43c7b5+'-'+_0x410f43+'/'+_0x197750)[_0x6d00('0x27')](_0x4e86bf);}return null;};}function patchUpdates(_0x5da2f1){return function(_0x3a1105){try{jsonpatch[_0x6d00('0x2e')](_0x3a1105,_0x5da2f1,!![]);}catch(_0x58bbb6){return BPromise['reject'](_0x58bbb6);}return _0x3a1105[_0x6d00('0x2f')]();};}function saveUpdates(_0xd620f6,_0x55fbe5){return function(_0x22b28d){if(_0x22b28d){return _0x22b28d[_0x6d00('0x30')](_0xd620f6)['then'](function(_0x40e59b){return _0x40e59b;});}return null;};}function removeEntity(_0x56631c,_0x207edd){return function(_0x20f06b){if(_0x20f06b){return _0x20f06b[_0x6d00('0x31')]()[_0x6d00('0x32')](function(){var _0x1c1bd9=_0x20f06b[_0x6d00('0x33')]({'plain':!![]});var _0x19cb9e='Plugins';return db[_0x6d00('0x34')][_0x6d00('0x31')]({'where':{'type':_0x19cb9e,'resourceId':_0x1c1bd9['id']}})[_0x6d00('0x32')](function(){return _0x20f06b;});})[_0x6d00('0x32')](function(){_0x56631c[_0x6d00('0x25')](0xcc)[_0x6d00('0x26')]();});}};}function handleEntityNotFound(_0x4465f2,_0x4201df){return function(_0x3afa0f){if(!_0x3afa0f){_0x4465f2[_0x6d00('0x24')](0x194);}return _0x3afa0f;};}function handleError(_0x59abeb,_0x4f9fc8){_0x4f9fc8=_0x4f9fc8||0x1f4;return function(_0x48eab0){logger[_0x6d00('0x35')](_0x48eab0[_0x6d00('0x36')]);if(_0x48eab0['name']){delete _0x48eab0[_0x6d00('0x37')];}_0x59abeb[_0x6d00('0x25')](_0x4f9fc8)['send'](_0x48eab0);};}exports[_0x6d00('0x38')]=function(_0x55425e,_0x4cbafa){var _0x2bcdef={},_0x38ebcb={},_0x90fca4={'count':0x0,'rows':[]};var _0x47ed01=_['map'](db[_0x6d00('0x39')][_0x6d00('0x3a')],function(_0xfdf79b){return{'name':_0xfdf79b[_0x6d00('0x3b')],'type':_0xfdf79b[_0x6d00('0x3c')][_0x6d00('0x3d')]};});_0x38ebcb['model']=_[_0x6d00('0x3e')](_0x47ed01,'name');_0x38ebcb[_0x6d00('0x3f')]=_[_0x6d00('0x40')](_0x55425e['query']);_0x38ebcb[_0x6d00('0x41')]=_[_0x6d00('0x42')](_0x38ebcb[_0x6d00('0x43')],_0x38ebcb[_0x6d00('0x3f')]);_0x2bcdef[_0x6d00('0x44')]=_[_0x6d00('0x42')](_0x38ebcb[_0x6d00('0x43')],qs[_0x6d00('0x45')](_0x55425e[_0x6d00('0x3f')][_0x6d00('0x45')]));_0x2bcdef[_0x6d00('0x44')]=_0x2bcdef[_0x6d00('0x44')][_0x6d00('0x46')]?_0x2bcdef[_0x6d00('0x44')]:_0x38ebcb[_0x6d00('0x43')];if(!_0x55425e['query'][_0x6d00('0x47')](_0x6d00('0x48'))){_0x2bcdef['limit']=qs['limit'](_0x55425e[_0x6d00('0x3f')][_0x6d00('0x29')]);_0x2bcdef[_0x6d00('0x2b')]=qs[_0x6d00('0x2b')](_0x55425e[_0x6d00('0x3f')]['offset']);}_0x2bcdef['order']=qs[_0x6d00('0x49')](_0x55425e[_0x6d00('0x3f')]['sort']);_0x2bcdef[_0x6d00('0x4a')]=qs['filters'](_[_0x6d00('0x4b')](_0x55425e[_0x6d00('0x3f')],_0x38ebcb[_0x6d00('0x41')]),_0x47ed01);if(_0x55425e['query'][_0x6d00('0x4c')]){_0x2bcdef[_0x6d00('0x4a')]=_[_0x6d00('0x4d')](_0x2bcdef[_0x6d00('0x4a')],{'$or':_[_0x6d00('0x3e')](_0x47ed01,function(_0x1950a3){if(_0x1950a3[_0x6d00('0x3c')]!==_0x6d00('0x4e')){var _0xe2f8f9={};_0xe2f8f9[_0x1950a3['name']]={'$like':'%'+_0x55425e[_0x6d00('0x3f')]['filter']+'%'};return _0xe2f8f9;}})});}_0x2bcdef=_[_0x6d00('0x4d')]({},_0x2bcdef,_0x55425e[_0x6d00('0x4f')]);var _0x1a182b={'where':_0x2bcdef[_0x6d00('0x4a')]};return db[_0x6d00('0x39')][_0x6d00('0x2a')](_0x1a182b)['then'](function(_0x4fd2aa){_0x90fca4[_0x6d00('0x2a')]=_0x4fd2aa;if(_0x55425e[_0x6d00('0x3f')]['includeAll']){_0x2bcdef[_0x6d00('0x50')]=[{'all':!![]}];}return db['Plugin'][_0x6d00('0x51')](_0x2bcdef);})[_0x6d00('0x32')](function(_0x34718c){_0x90fca4[_0x6d00('0x52')]=_0x34718c;return _0x90fca4;})[_0x6d00('0x32')](respondWithFilteredResult(_0x4cbafa,_0x2bcdef))[_0x6d00('0x53')](handleError(_0x4cbafa,null));};exports['show']=function(_0x5ddf0d,_0x28d9d5){var _0x2cdf47={'raw':!![],'where':{'id':_0x5ddf0d[_0x6d00('0x54')]['id']}},_0x19da43={};_0x19da43[_0x6d00('0x43')]=_[_0x6d00('0x40')](db[_0x6d00('0x39')]['rawAttributes']);_0x19da43[_0x6d00('0x3f')]=_['keys'](_0x5ddf0d[_0x6d00('0x3f')]);_0x19da43[_0x6d00('0x41')]=_[_0x6d00('0x42')](_0x19da43[_0x6d00('0x43')],_0x19da43['query']);_0x2cdf47[_0x6d00('0x44')]=_[_0x6d00('0x42')](_0x19da43['model'],qs['fields'](_0x5ddf0d[_0x6d00('0x3f')]['fields']));_0x2cdf47[_0x6d00('0x44')]=_0x2cdf47[_0x6d00('0x44')][_0x6d00('0x46')]?_0x2cdf47[_0x6d00('0x44')]:_0x19da43[_0x6d00('0x43')];if(_0x5ddf0d[_0x6d00('0x3f')]['includeAll']){_0x2cdf47[_0x6d00('0x50')]=[{'all':!![]}];}_0x2cdf47=_[_0x6d00('0x4d')]({},_0x2cdf47,_0x5ddf0d[_0x6d00('0x4f')]);return db[_0x6d00('0x39')]['find'](_0x2cdf47)[_0x6d00('0x32')](handleEntityNotFound(_0x28d9d5,null))[_0x6d00('0x32')](respondWithResult(_0x28d9d5,null))[_0x6d00('0x53')](handleError(_0x28d9d5,null));};exports[_0x6d00('0x55')]=function(_0x1f646b,_0x1e1ed1,_0x4d1b43){return db['Plugin'][_0x6d00('0x56')]({'where':{'id':_0x1f646b[_0x6d00('0x54')]['id']},'attributes':['name',_0x6d00('0x7')],'raw':!![]})[_0x6d00('0x32')](handleEntityNotFound(_0x1e1ed1,null))[_0x6d00('0x32')](function(_0x33102a){if(_0x33102a){var _0x302032=path['join'](config[_0x6d00('0x57')],_0x6d00('0x58'),util['format'](_0x6d00('0x59'),path['basename'](_0x33102a[_0x6d00('0x7')])));var _0x5b87ff=fs[_0x6d00('0x5a')](_0x302032);var _0x5c7e00=archiver(_0x6d00('0x5b'),{'zlib':{'level':0x9}});_0x5c7e00['on'](_0x6d00('0x5c'),function(_0x56bd3b){if(_0x56bd3b[_0x6d00('0x5d')]==='ENOENT'){logger['error'](_0x56bd3b);}else{throw new db['Sequelize'][(_0x6d00('0x5e'))](_0x6d00('0x5f'));}});_0x5c7e00['on']('error',function(_0x4acb62){throw new db['Sequelize']['Error'](_0x6d00('0x5f'));});_0x5c7e00[_0x6d00('0x60')](_0x5b87ff);_0x5c7e00[_0x6d00('0x61')](_0x6d00('0x62'),{'cwd':path['join'](config['root'],_0x6d00('0x58'),path[_0x6d00('0x63')](_0x33102a[_0x6d00('0x7')])),'ignore':[path[_0x6d00('0x64')](path[_0x6d00('0x65')](_0x33102a[_0x6d00('0x7')]),_0x6d00('0x66')),path[_0x6d00('0x64')](path[_0x6d00('0x65')](_0x33102a[_0x6d00('0x7')]),_0x6d00('0x67'))],'nodir':!![]})[_0x6d00('0x68')]();_0x5b87ff['on']('close',function(){if(!fs[_0x6d00('0x69')](_0x302032)){throw new db[(_0x6d00('0x6a'))]['Error']('Plugin\x20not\x20found');}return _0x1e1ed1[_0x6d00('0x55')](_0x302032,util[_0x6d00('0x6b')](_0x6d00('0x59'),path[_0x6d00('0x65')](_0x33102a[_0x6d00('0x7')])),function(_0x305939){if(_0x305939){throw new db['Sequelize']['Error'](_0x6d00('0x6c'));}fs[_0x6d00('0x6d')](_0x302032);logger[_0x6d00('0x6e')]('Download\x20completed');logger[_0x6d00('0x6e')](_0x6d00('0x6f'));});});}return null;})[_0x6d00('0x53')](handleError(_0x1e1ed1,null));};exports[_0x6d00('0x70')]=function(_0x5182d0,_0x27ce2c,_0x4c11ea){var _0x156929=path[_0x6d00('0x65')](_0x5182d0['file'][_0x6d00('0x71')],path[_0x6d00('0x72')](_0x5182d0['file'][_0x6d00('0x71')]));var _0x4a2347=path['join'](config[_0x6d00('0x57')],_0x6d00('0x58'),_0x5182d0[_0x6d00('0x73')][_0x6d00('0x71')]);var _0x5b5018=path[_0x6d00('0x64')](config['root'],'server/files/plugins',_0x156929);logger[_0x6d00('0x6e')]('Plugin\x20upload\x20filepath:\x20%s',_0x4a2347);logger[_0x6d00('0x6e')](_0x6d00('0x74'),_0x5b5018);try{fs[_0x6d00('0x75')](_0x4a2347,parseInt(_0x6d00('0x76'),0x8));extract(_0x4a2347,{'dir':_0x5b5018},function(_0x31f3bc){if(_0x31f3bc){logger[_0x6d00('0x35')](_0x31f3bc);handleError(_0x31f3bc,!![]);};var _0x3d4ebb=fs[_0x6d00('0x77')](_0x5b5018);if(_0x3d4ebb[_0x6d00('0x46')]>0x1){removeReferences(_0x4a2347,_0x5b5018);logger[_0x6d00('0x35')]('Invalid\x20plugin\x20structure');return _0x4c11ea(new Error(_0x6d00('0x78')));}var _0x357a87=fs[_0x6d00('0x79')](path[_0x6d00('0x64')](_0x5b5018,_0x3d4ebb[0x0]));if(_0x357a87[_0x6d00('0x7a')]()){removeReferences(_0x4a2347,_0x5b5018);logger[_0x6d00('0x35')]('Invalid\x20plugin\x20structure');return _0x4c11ea(new Error(_0x6d00('0x78')));}if(_0x357a87[_0x6d00('0x7b')]()){var _0x3f7f80=fs[_0x6d00('0x77')](path[_0x6d00('0x64')](_0x5b5018,_0x3d4ebb[0x0]));if(_0x3f7f80[_0x6d00('0x46')]===0x0){removeReferences(_0x4a2347,_0x5b5018);logger[_0x6d00('0x35')](_0x6d00('0x78'));return _0x4c11ea(new Error('Invalid\x20plugin\x20structure'));}var _0x5dd53a=_0x3f7f80[_0x6d00('0x7c')](function(_0x252aba){return _0x252aba===_0x6d00('0x7d');});if(!_0x5dd53a){return _0x4c11ea(new Error(_0x6d00('0x7e')));}var _0x4f1578=fs[_0x6d00('0x7f')](path[_0x6d00('0x64')](_0x5b5018,_0x3d4ebb[0x0],_0x6d00('0x7d')));var _0x56f87b=JSON[_0x6d00('0x80')](_0x4f1578);if('undefined'==typeof _0x56f87b[_0x6d00('0x37')]){return _0x4c11ea(new Error(_0x6d00('0x81')));}if('undefined'==typeof _0x56f87b[_0x6d00('0x3c')]){return _0x4c11ea(new Error(_0x6d00('0x82')));}if('undefined'==typeof _0x56f87b['version']){return _0x4c11ea(new Error(_0x6d00('0x83')));}if(_0x6d00('0x28')==typeof _0x56f87b[_0x6d00('0x84')]){return _0x4c11ea(new Error(_0x6d00('0x85')));}if(_0x56f87b['type']==='html'){if(_0x6d00('0x28')==typeof _0x56f87b[_0x6d00('0x84')][_0x6d00('0x86')]){return _0x4c11ea(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x6d00('0x28')==typeof _0x56f87b[_0x6d00('0x84')][_0x6d00('0x86')]['admin']&&_0x6d00('0x28')==typeof _0x56f87b['parameters'][_0x6d00('0x86')][_0x6d00('0x87')]){return _0x4c11ea(new Error(_0x6d00('0x88')));}}else if(_0x56f87b[_0x6d00('0x3c')]===_0x6d00('0x89')){if(_0x6d00('0x28')==typeof _0x56f87b[_0x6d00('0x84')][_0x6d00('0x8a')]){return _0x4c11ea(new Error(_0x6d00('0x8b')));}if(_0x6d00('0x28')==typeof _0x56f87b[_0x6d00('0x84')]['scriptPath']){return _0x4c11ea(new Error(_0x6d00('0x8c')));}}else{return _0x4c11ea(new Error(_0x6d00('0x8d')));}var _0x572fb2=_0x56f87b[_0x6d00('0x37')];var _0x42ccd6=_0x56f87b['description'];var _0x314db9=_0x56f87b['type'];var _0x4607f5=_0x56f87b[_0x6d00('0x8e')]?_0x56f87b[_0x6d00('0x8e')]:_0x6d00('0x8f');var _0xf61a07=_0x56f87b[_0x6d00('0x90')]?_0x56f87b[_0x6d00('0x90')]:'icon-apps';var _0x357123='';var _0x471d7f='';var _0x2a206f='';var _0x5b8596='';var _0x34aba5=_0x56f87b[_0x6d00('0x91')];if(_0x314db9===_0x6d00('0x92')){if('undefined'!=typeof _0x56f87b[_0x6d00('0x84')]['views'][_0x6d00('0x93')]){var _0x3159e8=_0x56f87b[_0x6d00('0x84')][_0x6d00('0x86')][_0x6d00('0x93')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3159e8)){_0x357123=path[_0x6d00('0x64')](_0x6d00('0x94'),_0x156929,_0x3d4ebb[0x0],_0x3159e8);}else{_0x357123=_0x3159e8;}}else{logger[_0x6d00('0x6e')](_0x6d00('0x95'));}if(_0x6d00('0x28')!=typeof _0x56f87b[_0x6d00('0x84')][_0x6d00('0x86')][_0x6d00('0x87')]){var _0x2146f1=_0x56f87b['parameters'][_0x6d00('0x86')][_0x6d00('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x6d00('0x96')](_0x2146f1)){_0x471d7f=path[_0x6d00('0x64')]('plugins',_0x156929,_0x3d4ebb[0x0],_0x2146f1);}else{_0x471d7f=_0x2146f1;}}else{logger['info'](_0x6d00('0x97'));}}else if(_0x314db9===_0x6d00('0x89')){_0x2a206f=_0x56f87b[_0x6d00('0x84')][_0x6d00('0x8a')];_0x5b8596=_0x56f87b[_0x6d00('0x84')]['scriptPath'];if(_0x6d00('0x28')!=typeof _0x56f87b[_0x6d00('0x84')]['views']){if(_0x6d00('0x28')!=typeof _0x56f87b[_0x6d00('0x84')][_0x6d00('0x86')][_0x6d00('0x93')]){var _0x3159e8=_0x56f87b[_0x6d00('0x84')][_0x6d00('0x86')][_0x6d00('0x93')];if(!/^(f|ht)tps?:\/\//i[_0x6d00('0x96')](_0x3159e8)){_0x357123=path[_0x6d00('0x64')]('plugins',_0x156929,_0x3d4ebb[0x0],_0x3159e8);}else{_0x357123=_0x3159e8;}}if(_0x6d00('0x28')!=typeof _0x56f87b[_0x6d00('0x84')][_0x6d00('0x86')]['agent']){var _0x2146f1=_0x56f87b[_0x6d00('0x84')][_0x6d00('0x86')][_0x6d00('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2146f1)){_0x471d7f=path['join'](_0x6d00('0x94'),_0x156929,_0x3d4ebb[0x0],_0x2146f1);}else{_0x471d7f=_0x2146f1;}}}}var _0x566191={'name':_0x572fb2,'description':_0x42ccd6,'path':path['join'](_0x156929,_0x3d4ebb[0x0]),'type':_0x314db9,'sidebar':_0x4607f5,'icon':_0xf61a07,'adminUrl':_0x357123,'agentUrl':_0x471d7f,'scriptName':_0x2a206f,'scriptPath':_0x5b8596,'version':_0x34aba5};removeReferences(_0x4a2347,null);return db[_0x6d00('0x39')][_0x6d00('0x98')](_0x566191)[_0x6d00('0x32')](function(_0x211801){var _0x578ca8={'role':_0x5182d0[_0x6d00('0x99')][_0x6d00('0x9a')],'userProfileId':_0x5182d0[_0x6d00('0x99')][_0x6d00('0x9b')]};if(!_0x578ca8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x578ca8[_0x6d00('0x9a')]===_0x6d00('0x9c')){var _0x5af6fd=_0x211801['get']({'plain':!![]});return db[_0x6d00('0x9d')][_0x6d00('0x56')]({'where':{'name':_0x6d00('0x9e'),'userProfileId':_0x578ca8['userProfileId']},'raw':!![]})['then'](function(_0x355c2e){if(_0x355c2e&&_0x355c2e[_0x6d00('0x9f')]===0x0){return db[_0x6d00('0x34')][_0x6d00('0x98')]({'name':_0x5af6fd[_0x6d00('0x37')],'resourceId':_0x5af6fd['id'],'type':_0x355c2e[_0x6d00('0x37')],'sectionId':_0x355c2e['id']},{})[_0x6d00('0x32')](function(){return _0x211801;});}else{return _0x211801;}})[_0x6d00('0x53')](function(_0x40b567){logger['error'](_0x6d00('0xa0'),_0x40b567);throw _0x40b567;});}return _0x211801;})[_0x6d00('0x32')](respondWithResult(_0x27ce2c,null))[_0x6d00('0x53')](handleError(_0x27ce2c,null));}});}catch(_0x26fb59){_0x27ce2c[_0x6d00('0x25')](0x1f4)[_0x6d00('0xa1')](_0x26fb59);}};function removeReferences(_0x656607,_0x405527){try{if(_0x656607){fs[_0x6d00('0x6d')](_0x656607);logger['info'](_0x6d00('0xa2'));}if(_0x405527){rimraf(_0x405527,function(){});logger[_0x6d00('0x6e')]('Extracted\x20folder\x20removed');}}catch(_0x2a433d){logger['error'](_0x2a433d);}}exports[_0x6d00('0x30')]=function(_0x364e9e,_0x28e885,_0x44d66e){return db['Plugin'][_0x6d00('0x56')]({'where':{'id':_0x364e9e[_0x6d00('0x54')]['id']}})[_0x6d00('0x32')](handleEntityNotFound(_0x28e885,null))['then'](saveUpdates(_0x364e9e[_0x6d00('0x99')],null))[_0x6d00('0x32')](respondWithResult(_0x28e885,null))[_0x6d00('0x53')](handleError(_0x28e885,null));};exports[_0x6d00('0xa3')]=function(_0x56fd6f,_0x27248c,_0x545256){return db[_0x6d00('0x39')][_0x6d00('0x56')]({'where':{'id':_0x56fd6f[_0x6d00('0x54')]['id']}})['then'](function(_0x1f066f){if(_0x1f066f){return _0x1f066f[_0x6d00('0x31')]();}})[_0x6d00('0x32')](function(_0xe535eb){rimraf(path['join'](config[_0x6d00('0x57')],_0x6d00('0x58'),path['dirname'](_0xe535eb[_0x6d00('0x7')])),function(){});return _0xe535eb;})[_0x6d00('0x32')](handleEntityNotFound(_0x27248c,null))['then'](respondWithStatusCode(_0x27248c,null))[_0x6d00('0x53')](handleError(_0x27248c,null));};exports[_0x6d00('0xa4')]=function(_0x97260e,_0x218e4c,_0x5cc54b){return BPromise['resolve']()[_0x6d00('0x32')](function(){if(!_0x97260e[_0x6d00('0x3f')]['path']){throw new Error(_0x6d00('0xa5'));}if(!_0x97260e[_0x6d00('0x3f')][_0x6d00('0xa6')]){throw new Error(_0x6d00('0xa7'));}var _0x552177=_0x97260e[_0x6d00('0x3f')][_0x6d00('0xa8')]?_0x97260e['query'][_0x6d00('0xa8')]+':'+_0x97260e[_0x6d00('0x3f')][_0x6d00('0xa6')]:'http://localhost:'+_0x97260e[_0x6d00('0x3f')][_0x6d00('0xa6')];var _0x254aca=_0x97260e[_0x6d00('0x3f')][_0x6d00('0x27')]?_0x97260e[_0x6d00('0x3f')][_0x6d00('0x27')]:!![];var _0xd3a1aa=_0x97260e['query']['encoding']?_0x97260e[_0x6d00('0x3f')][_0x6d00('0xa9')]:null;var _0x42fc76={'method':_0x97260e[_0x6d00('0xaa')],'uri':util[_0x6d00('0x6b')](_0x6d00('0xab'),_0x552177,_0x97260e[_0x6d00('0x3f')][_0x6d00('0x7')]),'json':_0x254aca,'resolveWithFullResponse':!![],'encoding':_0xd3a1aa,'qs':_0x97260e[_0x6d00('0x3f')]};if(_0x97260e[_0x6d00('0xac')]){_0x42fc76[_0x6d00('0xac')]=_0x97260e[_0x6d00('0xac')];if(_0x42fc76['headers']['content-length']){delete _0x42fc76['headers']['content-length'];}}if(_0x42fc76[_0x6d00('0xac')][_0x6d00('0xad')]){delete _0x42fc76[_0x6d00('0xac')][_0x6d00('0xad')];}return rp(_0x42fc76);})[_0x6d00('0x32')](function(_0x3f3ffd){if(_0x3f3ffd){_0x218e4c[_0x6d00('0x2c')](_0x3f3ffd[_0x6d00('0xac')]);logger[_0x6d00('0x6e')](_0x3f3ffd[_0x6d00('0x99')]);if(_['endsWith'](_0x97260e[_0x6d00('0x3f')][_0x6d00('0x7')],'download')&&_0x3f3ffd['statusCode']==0x1f4){return _0x218e4c[_0x6d00('0x24')](_0x3f3ffd['statusCode']);}else{return _0x218e4c[_0x6d00('0x25')](_0x3f3ffd[_0x6d00('0xae')])[_0x6d00('0xa1')](_0x3f3ffd[_0x6d00('0x99')]);}}else{return _0x218e4c[_0x6d00('0x24')](0xc8);}})[_0x6d00('0x53')](handleError(_0x218e4c,null));};exports['webhookPost']=function(_0x41c29e,_0xd86578,_0x37837d){return BPromise['resolve']()[_0x6d00('0x32')](function(){if(!_0x41c29e[_0x6d00('0x3f')][_0x6d00('0x7')]){throw new Error(_0x6d00('0xa5'));}if(!_0x41c29e[_0x6d00('0x3f')]['port']){throw new Error(_0x6d00('0xa7'));}var _0x3d3e2b=_0x41c29e[_0x6d00('0x3f')]['hostname']?_0x41c29e[_0x6d00('0x3f')][_0x6d00('0xa8')]+':'+_0x41c29e[_0x6d00('0x3f')][_0x6d00('0xa6')]:'http://localhost:'+_0x41c29e[_0x6d00('0x3f')][_0x6d00('0xa6')];var _0x6f50c3=_0x41c29e[_0x6d00('0x3f')][_0x6d00('0x27')]?_0x41c29e[_0x6d00('0x3f')][_0x6d00('0x27')]:!![];var _0x922e58=_0x41c29e[_0x6d00('0x3f')][_0x6d00('0xa9')]?_0x41c29e[_0x6d00('0x3f')][_0x6d00('0xa9')]:null;var _0x574f30={'method':_0x41c29e[_0x6d00('0xaa')],'uri':util[_0x6d00('0x6b')](_0x6d00('0xab'),_0x3d3e2b,_0x41c29e['query']['path']),'json':_0x6f50c3,'resolveWithFullResponse':!![],'encoding':_0x922e58,'body':_0x41c29e['body']};if(_0x41c29e[_0x6d00('0xac')]){_0x574f30[_0x6d00('0xac')]=_0x41c29e[_0x6d00('0xac')];if(_0x574f30['headers']['content-length']){delete _0x574f30['headers'][_0x6d00('0xaf')];}}if(_0x574f30[_0x6d00('0xac')][_0x6d00('0xad')]){delete _0x574f30[_0x6d00('0xac')]['content-type'];}return rp(_0x574f30);})[_0x6d00('0x32')](function(_0x2befa4){if(_0x2befa4){_0xd86578[_0x6d00('0x2c')](_0x2befa4[_0x6d00('0xac')]);logger[_0x6d00('0x6e')](_0x2befa4[_0x6d00('0x99')]);return _0xd86578[_0x6d00('0x25')](_0x2befa4[_0x6d00('0xae')])[_0x6d00('0xa1')](_0x2befa4[_0x6d00('0x99')]);}else{return _0xd86578[_0x6d00('0x24')](0xc8);}})[_0x6d00('0x53')](handleError(_0xd86578,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3a55f39..6c20c63 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 _0x374c=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x4440d9,_0x5b5787){var _0x16af48=function(_0x3fac4e){while(--_0x3fac4e){_0x4440d9['push'](_0x4440d9['shift']());}};_0x16af48(++_0x5b5787);}(_0x374c,0x1e3));var _0xc374=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x374c[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc374('0x0'))['db'][_0xc374('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc374('0x2')](0x0);var events={'afterCreate':_0xc374('0x3'),'afterUpdate':_0xc374('0x4'),'afterDestroy':'remove'};function emitEvent(_0x8d161e){return function(_0x534707,_0x1f68cf,_0x2561c0){PluginEvents['emit'](_0x8d161e+':'+_0x534707['id'],_0x534707);PluginEvents[_0xc374('0x5')](_0x8d161e,_0x534707);_0x2561c0(null);};}for(var e in events){if(events[_0xc374('0x6')](e)){var event=events[e];Plugin[_0xc374('0x7')](e,emitEvent(event));}}module[_0xc374('0x8')]=PluginEvents; \ No newline at end of file +var _0xef96=['emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef96,0x162));var _0x6ef9=function(_0x2b7888,_0x3c16c7){_0x2b7888=_0x2b7888-0x0;var _0x4431c7=_0xef96[_0x2b7888];return _0x4431c7;};'use strict';var EventEmitter=require(_0x6ef9('0x0'));var Plugin=require(_0x6ef9('0x1'))['db'][_0x6ef9('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6ef9('0x3')](0x0);var events={'afterCreate':_0x6ef9('0x4'),'afterUpdate':_0x6ef9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x55b811){return function(_0x1eb2c2,_0x5391ed,_0x500b0c){PluginEvents[_0x6ef9('0x6')](_0x55b811+':'+_0x1eb2c2['id'],_0x1eb2c2);PluginEvents[_0x6ef9('0x6')](_0x55b811,_0x1eb2c2);_0x500b0c(null);};}for(var e in events){if(events[_0x6ef9('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x6ef9('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 1b6f20f..2ec69a0 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 _0x4bf4=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','lodash'];(function(_0x2b077c,_0x3791ff){var _0x2499cb=function(_0x3cc50b){while(--_0x3cc50b){_0x2b077c['push'](_0x2b077c['shift']());}};_0x2499cb(++_0x3791ff);}(_0x4bf4,0xef));var _0x44bf=function(_0xfbaf14,_0x5f4cc1){_0xfbaf14=_0xfbaf14-0x0;var _0x5e00ca=_0x4bf4[_0xfbaf14];return _0x5e00ca;};'use strict';var _=require(_0x44bf('0x0'));var util=require('util');var logger=require(_0x44bf('0x1'))('api');var moment=require('moment');var BPromise=require(_0x44bf('0x2'));var rp=require(_0x44bf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44bf('0x4'));var config=require(_0x44bf('0x5'));var attributes=require(_0x44bf('0x6'));module[_0x44bf('0x7')]=function(_0x58c746,_0x33a9ba){return _0x58c746[_0x44bf('0x8')](_0x44bf('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84b8=['../../config/environment','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b8dad,_0x1b4eb3){var _0x3c719a=function(_0x31ab57){while(--_0x31ab57){_0x4b8dad['push'](_0x4b8dad['shift']());}};_0x3c719a(++_0x1b4eb3);}(_0x84b8,0x7c));var _0x884b=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x84b8[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x884b('0x0'));var util=require(_0x884b('0x1'));var logger=require(_0x884b('0x2'))('api');var moment=require(_0x884b('0x3'));var BPromise=require(_0x884b('0x4'));var rp=require(_0x884b('0x5'));var fs=require('fs');var path=require(_0x884b('0x6'));var rimraf=require(_0x884b('0x7'));var config=require(_0x884b('0x8'));var attributes=require('./plugin.attributes');module['exports']=function(_0x58c748,_0x2941b5){return _0x58c748['define'](_0x884b('0x9'),attributes,{'tableName':_0x884b('0xa'),'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 9a9d934..230390c 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 _0xc4ff=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','CreatePlugin','body','options','then','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4983ba,_0x5925d8){var _0x3a1f6a=function(_0x3ba3ca){while(--_0x3ba3ca){_0x4983ba['push'](_0x4983ba['shift']());}};_0x3a1f6a(++_0x5925d8);}(_0xc4ff,0x111));var _0xfc4f=function(_0x11b57c,_0x2ee2ca){_0x11b57c=_0x11b57c-0x0;var _0x1a1a2b=_0xc4ff[_0x11b57c];return _0x1a1a2b;};'use strict';var _=require('lodash');var util=require(_0xfc4f('0x0'));var moment=require(_0xfc4f('0x1'));var BPromise=require(_0xfc4f('0x2'));var rs=require(_0xfc4f('0x3'));var fs=require('fs');var Redis=require(_0xfc4f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc4f('0x5'));var logger=require(_0xfc4f('0x6'))(_0xfc4f('0x7'));var config=require(_0xfc4f('0x8'));var jayson=require(_0xfc4f('0x9'));var client=jayson[_0xfc4f('0xa')][_0xfc4f('0xb')]({'port':0x232a});config[_0xfc4f('0xc')]=_[_0xfc4f('0xd')](config[_0xfc4f('0xc')],{'host':_0xfc4f('0xe'),'port':0x18eb});var socket=require(_0xfc4f('0xf'))(new Redis(config[_0xfc4f('0xc')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x2236dc,_0x282f80,_0x19fa2f){return new BPromise(function(_0x3f4b00,_0x26651a){return client[_0xfc4f('0x10')](_0x2236dc,_0x19fa2f)['then'](function(_0x28d2af){logger[_0xfc4f('0x11')]('Plugin,\x20%s,\x20%s',_0x282f80,_0xfc4f('0x12'));logger[_0xfc4f('0x13')](_0xfc4f('0x14'),_0x282f80,'request\x20sent',JSON[_0xfc4f('0x15')](_0x28d2af));if(_0x28d2af['error']){if(_0x28d2af[_0xfc4f('0x16')][_0xfc4f('0x17')]===0x1f4){logger['error'](_0xfc4f('0x18'),_0x282f80,_0x28d2af[_0xfc4f('0x16')]['message']);return _0x26651a(_0x28d2af[_0xfc4f('0x16')][_0xfc4f('0x19')]);}logger[_0xfc4f('0x16')](_0xfc4f('0x18'),_0x282f80,_0x28d2af[_0xfc4f('0x16')][_0xfc4f('0x19')]);return _0x3f4b00(_0x28d2af[_0xfc4f('0x16')][_0xfc4f('0x19')]);}else{logger['info'](_0xfc4f('0x18'),_0x282f80,_0xfc4f('0x12'));_0x3f4b00(_0x28d2af[_0xfc4f('0x1a')][_0xfc4f('0x19')]);}})['catch'](function(_0x9fe6e8){logger[_0xfc4f('0x16')]('Plugin,\x20%s,\x20%s',_0x282f80,_0x9fe6e8);_0x26651a(_0x9fe6e8);});});}exports[_0xfc4f('0x1b')]=function(_0x37f9c2){var _0x136246=this;return new Promise(function(_0x3f7aca,_0x372bd1){return db['Plugin']['create'](_0x37f9c2[_0xfc4f('0x1c')],{'raw':_0x37f9c2['options']?_0x37f9c2[_0xfc4f('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xfc4f('0x1e')](function(_0x1d343f){logger[_0xfc4f('0x11')](_0xfc4f('0x1b'),_0x37f9c2);logger[_0xfc4f('0x13')](_0xfc4f('0x1b'),_0x37f9c2,JSON[_0xfc4f('0x15')](_0x1d343f));_0x3f7aca(_0x1d343f);})['catch'](function(_0x39336f){logger['error']('CreatePlugin',_0x39336f[_0xfc4f('0x19')],_0x37f9c2);_0x372bd1(_0x136246[_0xfc4f('0x16')](0x1f4,_0x39336f[_0xfc4f('0x19')]));});});}; \ No newline at end of file +var _0x0f11=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','Plugin,\x20%s,\x20%s','result','catch','CreatePlugin','Plugin','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x29c9eb,_0x3d680b){var _0x438352=function(_0x1e5198){while(--_0x1e5198){_0x29c9eb['push'](_0x29c9eb['shift']());}};_0x438352(++_0x3d680b);}(_0x0f11,0xe7));var _0x10f1=function(_0x5db43b,_0x4e8619){_0x5db43b=_0x5db43b-0x0;var _0x3eca35=_0x0f11[_0x5db43b];return _0x3eca35;};'use strict';var _=require('lodash');var util=require(_0x10f1('0x0'));var moment=require(_0x10f1('0x1'));var BPromise=require(_0x10f1('0x2'));var rs=require(_0x10f1('0x3'));var fs=require('fs');var Redis=require(_0x10f1('0x4'));var db=require(_0x10f1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x10f1('0x6'))(_0x10f1('0x7'));var config=require(_0x10f1('0x8'));var jayson=require(_0x10f1('0x9'));var client=jayson[_0x10f1('0xa')][_0x10f1('0xb')]({'port':0x232a});config[_0x10f1('0xc')]=_[_0x10f1('0xd')](config[_0x10f1('0xc')],{'host':_0x10f1('0xe'),'port':0x18eb});var socket=require(_0x10f1('0xf'))(new Redis(config[_0x10f1('0xc')]));require('./plugin.socket')[_0x10f1('0x10')](socket);function respondWithRpcPromise(_0x209c97,_0x163f6e,_0xad798){return new BPromise(function(_0x446d15,_0x1a8fc9){return client[_0x10f1('0x11')](_0x209c97,_0xad798)[_0x10f1('0x12')](function(_0x57668d){logger[_0x10f1('0x13')]('Plugin,\x20%s,\x20%s',_0x163f6e,_0x10f1('0x14'));logger[_0x10f1('0x15')](_0x10f1('0x16'),_0x163f6e,_0x10f1('0x14'),JSON[_0x10f1('0x17')](_0x57668d));if(_0x57668d[_0x10f1('0x18')]){if(_0x57668d[_0x10f1('0x18')]['code']===0x1f4){logger[_0x10f1('0x18')]('Plugin,\x20%s,\x20%s',_0x163f6e,_0x57668d[_0x10f1('0x18')]['message']);return _0x1a8fc9(_0x57668d[_0x10f1('0x18')][_0x10f1('0x19')]);}logger[_0x10f1('0x18')](_0x10f1('0x1a'),_0x163f6e,_0x57668d[_0x10f1('0x18')]['message']);return _0x446d15(_0x57668d[_0x10f1('0x18')][_0x10f1('0x19')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x163f6e,_0x10f1('0x14'));_0x446d15(_0x57668d[_0x10f1('0x1b')][_0x10f1('0x19')]);}})[_0x10f1('0x1c')](function(_0x3d6c2b){logger[_0x10f1('0x18')]('Plugin,\x20%s,\x20%s',_0x163f6e,_0x3d6c2b);_0x1a8fc9(_0x3d6c2b);});});}exports[_0x10f1('0x1d')]=function(_0x58a653){var _0x48d591=this;return new Promise(function(_0x2e7d2e,_0x171b06){return db[_0x10f1('0x1e')]['create'](_0x58a653[_0x10f1('0x1f')],{'raw':_0x58a653[_0x10f1('0x20')]?_0x58a653['options'][_0x10f1('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x4c01c3){logger['info'](_0x10f1('0x1d'),_0x58a653);logger[_0x10f1('0x15')](_0x10f1('0x1d'),_0x58a653,JSON['stringify'](_0x4c01c3));_0x2e7d2e(_0x4c01c3);})['catch'](function(_0x2d1a2a){logger['error'](_0x10f1('0x1d'),_0x2d1a2a[_0x10f1('0x19')],_0x58a653);_0x171b06(_0x48d591[_0x10f1('0x18')](0x1f4,_0x2d1a2a[_0x10f1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2c6416d..69517c6 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 _0x2d4e=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2d4e,0x122));var _0xe2d4=function(_0x3557a7,_0x13feb8){_0x3557a7=_0x3557a7-0x0;var _0x597d7b=_0x2d4e[_0x3557a7];return _0x597d7b;};'use strict';var PluginEvents=require(_0xe2d4('0x0'));var events=[_0xe2d4('0x1'),_0xe2d4('0x2'),_0xe2d4('0x3')];function createListener(_0x60003a,_0x542f90){return function(_0x4576bb){_0x542f90[_0xe2d4('0x4')](_0x60003a,_0x4576bb);};}function removeListener(_0xc7555,_0x19edea){return function(){PluginEvents[_0xe2d4('0x5')](_0xc7555,_0x19edea);};}exports['register']=function(_0xdaecb0){for(var _0x4d64aa=0x0,_0x30568d=events[_0xe2d4('0x6')];_0x4d64aa<_0x30568d;_0x4d64aa++){var _0x506581=events[_0x4d64aa];var _0x3ad70c=createListener(_0xe2d4('0x7')+_0x506581,_0xdaecb0);PluginEvents['on'](_0x506581,_0x3ad70c);}}; \ No newline at end of file +var _0xa77c=['emit','removeListener','register','length','plugin:','./plugin.events','save','update'];(function(_0x485d7b,_0x3f3b52){var _0x899877=function(_0x34639c){while(--_0x34639c){_0x485d7b['push'](_0x485d7b['shift']());}};_0x899877(++_0x3f3b52);}(_0xa77c,0x6d));var _0xca77=function(_0x4bbd78,_0x5e4b51){_0x4bbd78=_0x4bbd78-0x0;var _0x42526e=_0xa77c[_0x4bbd78];return _0x42526e;};'use strict';var PluginEvents=require(_0xca77('0x0'));var events=[_0xca77('0x1'),'remove',_0xca77('0x2')];function createListener(_0x1bb6df,_0x4535f0){return function(_0x5a2143){_0x4535f0[_0xca77('0x3')](_0x1bb6df,_0x5a2143);};}function removeListener(_0x1309d2,_0x26b3a0){return function(){PluginEvents[_0xca77('0x4')](_0x1309d2,_0x26b3a0);};}exports[_0xca77('0x5')]=function(_0x4c81db){for(var _0x576205=0x0,_0x4b34e0=events[_0xca77('0x6')];_0x576205<_0x4b34e0;_0x576205++){var _0x5e575f=events[_0x576205];var _0x46bb82=createListener(_0xca77('0x7')+_0x5e575f,_0x4c81db);PluginEvents['on'](_0x5e575f,_0x46bb82);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index fca430a..e026b5f 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(_0xe894bd,_0x43a96e){var _0x467659=function(_0x1c77f4){while(--_0x1c77f4){_0xe894bd['push'](_0xe894bd['shift']());}};_0x467659(++_0x43a96e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x2df2e6,_0xe93959){var _0x1831dc=function(_0x24a555){while(--_0x24a555){_0x2df2e6['push'](_0x2df2e6['shift']());}};_0x1831dc(++_0xe93959);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 d16906f..253dfeb 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 _0xc788=['body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','stop','hasOwnProperty','Unknown\x20status','params','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','sendStatus','status','error','stack','name','info','index','list','then','reject','motion2','catch','show','describe'];(function(_0xcdac34,_0x43f665){var _0x269d23=function(_0x3f2d6f){while(--_0x3f2d6f){_0xcdac34['push'](_0xcdac34['shift']());}};_0x269d23(++_0x43f665);}(_0xc788,0xc4));var _0x8c78=function(_0x3a6d3e,_0x4f0ac5){_0x3a6d3e=_0x3a6d3e-0x0;var _0x735896=_0xc788[_0x3a6d3e];return _0x735896;};'use strict';var _=require(_0x8c78('0x0'));var pm2=require(_0x8c78('0x1'));var logger=require(_0x8c78('0x2'))('api');var path=require('path');var exec=require(_0x8c78('0x3'))[_0x8c78('0x4')];var BPromise=require(_0x8c78('0x5'));function handleEntityNotFound(_0x1d0670,_0x386f0a){return function(_0x5498f9){if(!_0x5498f9){_0x1d0670[_0x8c78('0x6')](0x194);;}return _0x5498f9;};}function respondWithResult(_0x4555da,_0x329152){_0x329152=_0x329152||0xc8;return function(_0x1ac27f){if(_0x1ac27f){return _0x4555da[_0x8c78('0x7')](_0x329152)['json'](_0x1ac27f);}return null;};}function handleError(_0x247188,_0x299d9d){_0x299d9d=_0x299d9d||0x1f4;return function(_0x9bc075){logger[_0x8c78('0x8')](_0x9bc075[_0x8c78('0x9')]);if(_0x9bc075[_0x8c78('0xa')]){delete _0x9bc075['name'];}_0x247188[_0x8c78('0x7')](_0x299d9d)['send'](_0x9bc075);};}function execChildProcess(){return new BPromise(function(_0x3d55f0,_0x45935a){exec('npm\x20install',function(_0x1a05a7,_0x95e78e,_0x5ee642){logger[_0x8c78('0xb')](_0x95e78e);logger['info'](_0x5ee642);if(_0x1a05a7){logger['error'](_0x1a05a7);return _0x45935a(_0x1a05a7);}return _0x3d55f0(_0x95e78e);});});}exports[_0x8c78('0xc')]=function(_0x1b1d0e,_0x26178c){return pm2[_0x8c78('0xd')]()[_0x8c78('0xe')](function(_0x3d1306){if(_0x3d1306){var _0xe5f8ae=_[_0x8c78('0xf')](_0x3d1306,function(_0x2f44af){return _0x2f44af[_0x8c78('0xa')]==='express'||_0x2f44af[_0x8c78('0xa')]===_0x8c78('0x10');});return{'rows':_0xe5f8ae,'count':_0xe5f8ae['length']};}return null;})[_0x8c78('0xe')](respondWithResult(_0x26178c,null))[_0x8c78('0x11')](handleError(_0x26178c,null));};exports[_0x8c78('0x12')]=function(_0x23824e,_0x2a982c){return pm2[_0x8c78('0x13')](_0x23824e['params']['id'])['then'](respondWithResult(_0x2a982c,null))[_0x8c78('0xe')](handleEntityNotFound(_0x2a982c,null))['catch'](handleError(_0x2a982c,null));};exports['create']=function(_0xece4f0,_0x56c191){if(_0xece4f0[_0x8c78('0x14')][_0x8c78('0xa')]&&_0xece4f0['body'][_0x8c78('0x15')]){var _0x5b111b=path[_0x8c78('0x16')](__dirname,_0x8c78('0x17'),_0xece4f0['body'][_0x8c78('0x15')]);var _0x188cc3=process['cwd']();process[_0x8c78('0x18')](path[_0x8c78('0x19')](_0x5b111b));return execChildProcess()[_0x8c78('0xe')](function(_0x9581c6){process[_0x8c78('0x18')](_0x188cc3);return pm2[_0x8c78('0x1a')]({'name':_0xece4f0[_0x8c78('0x14')][_0x8c78('0xa')],'script':_0x5b111b});})[_0x8c78('0xe')](function(_0x4a7d20){pm2[_0x8c78('0x1b')]();return _0x4a7d20[0x0];})[_0x8c78('0xe')](respondWithResult(_0x56c191,0xc9))[_0x8c78('0x11')](handleError(_0x56c191,null));}else{return _0x56c191['status'](0x1f4)[_0x8c78('0x1c')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8c78('0x1d')]=function(_0x24f9a7,_0x8d9ff9){if(_0x24f9a7['body']['id']){delete _0x24f9a7[_0x8c78('0x14')]['id'];}var _0x2568d5={'online':'restart','stopped':_0x8c78('0x1e')};if(_0x2568d5[_0x8c78('0x1f')](_0x24f9a7[_0x8c78('0x14')][_0x8c78('0x7')])){return pm2[_0x2568d5[_0x24f9a7[_0x8c78('0x14')][_0x8c78('0x7')]]](_0x24f9a7['params']['id'])[_0x8c78('0xe')](respondWithResult(_0x8d9ff9,0xc8))['catch'](handleError(_0x8d9ff9,null));}else{return _0x8d9ff9[_0x8c78('0x7')](0x1f4)[_0x8c78('0x1c')]({'message':_0x8c78('0x20')});}};exports['destroy']=function(_0x1f1a0c,_0x3816d2){if(_0x1f1a0c['body']['id']){delete _0x1f1a0c[_0x8c78('0x14')]['id'];}if(_0x1f1a0c[_0x8c78('0x21')]['id']){return pm2[_0x8c78('0x22')](_0x1f1a0c['params']['id'])[_0x8c78('0xe')](function(_0x63307e){pm2[_0x8c78('0x1b')]();return _0x63307e[0x0];})['then'](respondWithResult(_0x3816d2,null))[_0x8c78('0x11')](handleError(_0x3816d2,null));}else{return _0x3816d2[_0x8c78('0x7')](0x1f4)['send']({'message':_0x8c78('0x23')});}}; \ No newline at end of file +var _0x1339=['body','params','delete','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','then','reject','motion2','catch','show','describe','create','../../files/plugins','cwd','chdir','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x1339,0x1ed));var _0x9133=function(_0x55ffe8,_0x1236df){_0x55ffe8=_0x55ffe8-0x0;var _0x289b3f=_0x1339[_0x55ffe8];return _0x289b3f;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var path=require(_0x9133('0x2'));var exec=require(_0x9133('0x3'))[_0x9133('0x4')];var BPromise=require(_0x9133('0x5'));function handleEntityNotFound(_0x176e80,_0x110c51){return function(_0x558345){if(!_0x558345){_0x176e80[_0x9133('0x6')](0x194);;}return _0x558345;};}function respondWithResult(_0x855473,_0x379915){_0x379915=_0x379915||0xc8;return function(_0x539af6){if(_0x539af6){return _0x855473[_0x9133('0x7')](_0x379915)[_0x9133('0x8')](_0x539af6);}return null;};}function handleError(_0x3059c4,_0x431a55){_0x431a55=_0x431a55||0x1f4;return function(_0x261698){logger[_0x9133('0x9')](_0x261698[_0x9133('0xa')]);if(_0x261698[_0x9133('0xb')]){delete _0x261698[_0x9133('0xb')];}_0x3059c4[_0x9133('0x7')](_0x431a55)['send'](_0x261698);};}function execChildProcess(){return new BPromise(function(_0x3f9650,_0x3533fa){exec(_0x9133('0xc'),function(_0x452481,_0x3b8f89,_0x244ced){logger['info'](_0x3b8f89);logger[_0x9133('0xd')](_0x244ced);if(_0x452481){logger[_0x9133('0x9')](_0x452481);return _0x3533fa(_0x452481);}return _0x3f9650(_0x3b8f89);});});}exports['index']=function(_0x5283a3,_0x10475c){return pm2['list']()[_0x9133('0xe')](function(_0x439e1a){if(_0x439e1a){var _0x17dfd1=_[_0x9133('0xf')](_0x439e1a,function(_0x31847a){return _0x31847a[_0x9133('0xb')]==='express'||_0x31847a[_0x9133('0xb')]===_0x9133('0x10');});return{'rows':_0x17dfd1,'count':_0x17dfd1['length']};}return null;})[_0x9133('0xe')](respondWithResult(_0x10475c,null))[_0x9133('0x11')](handleError(_0x10475c,null));};exports[_0x9133('0x12')]=function(_0x427663,_0x4a2c4f){return pm2[_0x9133('0x13')](_0x427663['params']['id'])[_0x9133('0xe')](respondWithResult(_0x4a2c4f,null))['then'](handleEntityNotFound(_0x4a2c4f,null))[_0x9133('0x11')](handleError(_0x4a2c4f,null));};exports[_0x9133('0x14')]=function(_0x5e8620,_0x38dd60){if(_0x5e8620['body'][_0x9133('0xb')]&&_0x5e8620['body']['script']){var _0x2f7354=path['join'](__dirname,_0x9133('0x15'),_0x5e8620['body']['script']);var _0x4c846e=process[_0x9133('0x16')]();process[_0x9133('0x17')](path['dirname'](_0x2f7354));return execChildProcess()[_0x9133('0xe')](function(_0x3f5d0e){process[_0x9133('0x17')](_0x4c846e);return pm2[_0x9133('0x18')]({'name':_0x5e8620['body'][_0x9133('0xb')],'script':_0x2f7354});})['then'](function(_0x187e32){pm2[_0x9133('0x19')]();return _0x187e32[0x0];})[_0x9133('0xe')](respondWithResult(_0x38dd60,0xc9))[_0x9133('0x11')](handleError(_0x38dd60,null));}else{return _0x38dd60[_0x9133('0x7')](0x1f4)[_0x9133('0x1a')]({'message':_0x9133('0x1b')});}};exports[_0x9133('0x1c')]=function(_0x1b6b3e,_0x46050b){if(_0x1b6b3e['body']['id']){delete _0x1b6b3e['body']['id'];}var _0x477bf1={'online':_0x9133('0x1d'),'stopped':_0x9133('0x1e')};if(_0x477bf1[_0x9133('0x1f')](_0x1b6b3e['body']['status'])){return pm2[_0x477bf1[_0x1b6b3e[_0x9133('0x20')][_0x9133('0x7')]]](_0x1b6b3e[_0x9133('0x21')]['id'])[_0x9133('0xe')](respondWithResult(_0x46050b,0xc8))[_0x9133('0x11')](handleError(_0x46050b,null));}else{return _0x46050b[_0x9133('0x7')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x1ad222,_0x4a4a8e){if(_0x1ad222[_0x9133('0x20')]['id']){delete _0x1ad222[_0x9133('0x20')]['id'];}if(_0x1ad222['params']['id']){return pm2[_0x9133('0x22')](_0x1ad222['params']['id'])[_0x9133('0xe')](function(_0x26ca56){pm2[_0x9133('0x19')]();return _0x26ca56[0x0];})['then'](respondWithResult(_0x4a4a8e,null))[_0x9133('0x11')](handleError(_0x4a4a8e,null));}else{return _0x4a4a8e[_0x9133('0x7')](0x1f4)[_0x9133('0x1a')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 9170f59..135bd19 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 _0xeb74=['../../components/interaction/service','../../config/environment','./realtime.controller','get','/queues','getQueues','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x17d82f,_0x5d9172){var _0x58137b=function(_0x40e198){while(--_0x40e198){_0x17d82f['push'](_0x17d82f['shift']());}};_0x58137b(++_0x5d9172);}(_0xeb74,0xe3));var _0x4eb7=function(_0x107719,_0x47f48b){_0x107719=_0x107719-0x0;var _0x1a1216=_0xeb74[_0x107719];return _0x1a1216;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var fs_extra=require(_0x4eb7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var controller=require(_0x4eb7('0x9'));router[_0x4eb7('0xa')](_0x4eb7('0xb'),auth['isAuthenticated'](),controller[_0x4eb7('0xc')]);module['exports']=router; \ No newline at end of file +var _0x280d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./realtime.controller','get','getQueues','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x280d,0x69));var _0xd280=function(_0x1fd100,_0x59a4f6){_0x1fd100=_0x1fd100-0x0;var _0x1c7399=_0x280d[_0x1fd100];return _0x1c7399;};'use strict';var multer=require(_0xd280('0x0'));var util=require(_0xd280('0x1'));var path=require(_0xd280('0x2'));var timeout=require(_0xd280('0x3'));var express=require(_0xd280('0x4'));var router=express[_0xd280('0x5')]();var fs_extra=require(_0xd280('0x6'));var auth=require(_0xd280('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd280('0x8'));router[_0xd280('0x9')]('/queues',auth['isAuthenticated'](),controller[_0xd280('0xa')]);module[_0xd280('0xb')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index b41a3c0..25e7dab 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 _0x71cb=['request','then','Realtime,\x20%s,\x20%s','request\x20sent','Realtime,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','status','end','offset','undefined','limit','count','set','json','reject','update','destroy','sendStatus','stack','name','getQueues','mail','chat','sms','openchannel','fax','whatsapp','resolve','query','channel','includes','toLowerCase','startCase','Queue','map','fieldName','type','key','getOptions','role','user','userProfileId','voice','outbound','QueueCampaigns','Queues','UserProfile','getResources','findAndCountAll','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','available','push','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','paused','waiting','talking','pTalking','originated','agents','find','merge','pick','getAgents','online','getMembers','length','loggedInDb','User','findAll','UserId','agent','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','client','http'];(function(_0x416b99,_0x2925f3){var _0x2158b9=function(_0x2a5b36){while(--_0x2a5b36){_0x416b99['push'](_0x416b99['shift']());}};_0x2158b9(++_0x2925f3);}(_0x71cb,0xd3));var _0xb71c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x71cb[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require(_0xb71c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb71c('0x1'));var jsonpatch=require(_0xb71c('0x2'));var rp=require(_0xb71c('0x3'));var moment=require(_0xb71c('0x4'));var BPromise=require(_0xb71c('0x5'));var Mustache=require(_0xb71c('0x6'));var util=require(_0xb71c('0x7'));var path=require(_0xb71c('0x8'));var sox=require(_0xb71c('0x9'));var csv=require(_0xb71c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb71c('0xb'));var squel=require('squel');var crypto=require(_0xb71c('0xc'));var jsforce=require(_0xb71c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb71c('0xe'));var Papa=require(_0xb71c('0xf'));var Redis=require(_0xb71c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb71c('0x11'));var as=require(_0xb71c('0x12'));var hardwareService=require(_0xb71c('0x13'));var logger=require(_0xb71c('0x14'))(_0xb71c('0x15'));var utils=require('../../config/utils');var config=require(_0xb71c('0x16'));var licenseUtil=require(_0xb71c('0x17'));var db=require(_0xb71c('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb71c('0x19')][_0xb71c('0x1a')]({'port':0x232a});var routingClient=jayson[_0xb71c('0x19')][_0xb71c('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x53a1d6,_0x2ef37b,_0x3f67b0,_0x121d2c){return new BPromise(function(_0x359a42,_0x59ee24){var _0x10edf5=_0x121d2c||client;return _0x10edf5[_0xb71c('0x1b')](_0x53a1d6,_0x3f67b0)[_0xb71c('0x1c')](function(_0x3611a4){logger['info'](_0xb71c('0x1d'),_0x2ef37b,_0xb71c('0x1e'));logger['debug'](_0xb71c('0x1f'),_0x2ef37b,_0xb71c('0x1e'),JSON[_0xb71c('0x20')](_0x3611a4));if(_0x3611a4[_0xb71c('0x21')]){if(_0x3611a4[_0xb71c('0x21')]['code']===0x1f4){logger['error'](_0xb71c('0x1d'),_0x2ef37b,_0x3611a4[_0xb71c('0x21')][_0xb71c('0x22')]);return _0x59ee24(_0x3611a4[_0xb71c('0x21')][_0xb71c('0x22')]);}logger[_0xb71c('0x21')](_0xb71c('0x1d'),_0x2ef37b,_0x3611a4[_0xb71c('0x21')][_0xb71c('0x22')]);return _0x359a42(_0x3611a4[_0xb71c('0x21')][_0xb71c('0x22')]);}else{logger[_0xb71c('0x23')](_0xb71c('0x1d'),_0x2ef37b,_0xb71c('0x1e'));_0x359a42(_0x3611a4[_0xb71c('0x24')][_0xb71c('0x22')]);}})['catch'](function(_0x13b900){logger['error'](_0xb71c('0x1d'),_0x2ef37b,_0x13b900);_0x59ee24(_0x13b900);});});}function respondWithStatusCode(_0x5556ed,_0x4aa38c){_0x4aa38c=_0x4aa38c||0xcc;return function(_0x1e97d6){if(_0x1e97d6){return _0x5556ed['sendStatus'](_0x4aa38c);}return _0x5556ed[_0xb71c('0x25')](_0x4aa38c)[_0xb71c('0x26')]();};}function respondWithResult(_0x4a04c6,_0x38d3cf){_0x38d3cf=_0x38d3cf||0xc8;return function(_0x35bbe8){if(_0x35bbe8){return _0x4a04c6['status'](_0x38d3cf)['json'](_0x35bbe8);}};}function respondWithFilteredResult(_0x309249,_0x2a955a){return function(_0x351508){if(_0x351508){var _0xc96869=typeof _0x2a955a[_0xb71c('0x27')]===_0xb71c('0x28')&&typeof _0x2a955a[_0xb71c('0x29')]===_0xb71c('0x28');var _0x2a676c=_0x351508[_0xb71c('0x2a')];var _0x5a35e3=_0xc96869?0x0:_0x2a955a[_0xb71c('0x27')];var _0x36a457=_0xc96869?_0x351508['count']:_0x2a955a[_0xb71c('0x27')]+_0x2a955a[_0xb71c('0x29')];var _0xf3072;if(_0x36a457>=_0x2a676c){_0x36a457=_0x2a676c;_0xf3072=0xc8;}else{_0xf3072=0xce;}_0x309249[_0xb71c('0x25')](_0xf3072);return _0x309249[_0xb71c('0x2b')]('Content-Range',_0x5a35e3+'-'+_0x36a457+'/'+_0x2a676c)[_0xb71c('0x2c')](_0x351508);}return null;};}function patchUpdates(_0x229137){return function(_0x12b672){try{jsonpatch['apply'](_0x12b672,_0x229137,!![]);}catch(_0x24917b){return BPromise[_0xb71c('0x2d')](_0x24917b);}return _0x12b672['save']();};}function saveUpdates(_0x30f3f6,_0x5332d1){return function(_0x45d5e9){if(_0x45d5e9){return _0x45d5e9[_0xb71c('0x2e')](_0x30f3f6)[_0xb71c('0x1c')](function(_0x54ba43){return _0x54ba43;});}return null;};}function removeEntity(_0x245a33,_0xe9cb2b){return function(_0x248eb8){if(_0x248eb8){return _0x248eb8[_0xb71c('0x2f')]()[_0xb71c('0x1c')](function(){_0x245a33['status'](0xcc)[_0xb71c('0x26')]();});}};}function handleEntityNotFound(_0x24456f,_0x1d1fe4){return function(_0x4ec78f){if(!_0x4ec78f){_0x24456f[_0xb71c('0x30')](0x194);}return _0x4ec78f;};}function handleError(_0x389f8f,_0x58411d){_0x58411d=_0x58411d||0x1f4;return function(_0x3763cc){logger[_0xb71c('0x21')](_0x3763cc[_0xb71c('0x31')]);if(_0x3763cc[_0xb71c('0x32')]){delete _0x3763cc[_0xb71c('0x32')];}_0x389f8f['status'](_0x58411d)['send'](_0x3763cc);};}exports[_0xb71c('0x33')]=function(_0x3d2ca9,_0x1a3577){var _0x18e9fa=[_0xb71c('0x34'),_0xb71c('0x35'),_0xb71c('0x36'),_0xb71c('0x37'),_0xb71c('0x38'),_0xb71c('0x39'),'voice'];var _0x2ded49={'count':0x0,'rows':[]},_0x19b374={},_0x143274;Promise[_0xb71c('0x3a')]()[_0xb71c('0x1c')](function(){if(_0x3d2ca9[_0xb71c('0x3b')][_0xb71c('0x3c')]){if(!_[_0xb71c('0x3d')](_0x18e9fa,_0x3d2ca9[_0xb71c('0x3b')]['channel'][_0xb71c('0x3e')]()))throw new Error('Invalid\x20channel');_0x143274=_0x3d2ca9[_0xb71c('0x3b')][_0xb71c('0x3c')][_0xb71c('0x3e')]();}var _0x117736=_[_0xb71c('0x3f')](_0x143274)+_0xb71c('0x40');var _0x4fafc3=_[_0xb71c('0x41')](db[_0x117736]['rawAttributes'],function(_0x3df1ee){return{'name':_0x3df1ee[_0xb71c('0x42')],'type':_0x3df1ee[_0xb71c('0x43')][_0xb71c('0x44')]};});_0x19b374=qs[_0xb71c('0x45')](_0x4fafc3,_0x3d2ca9);if(_0x3d2ca9['user'][_0xb71c('0x46')]===_0xb71c('0x47')){var _0x110885={'params':{'id':_0x3d2ca9[_0xb71c('0x47')][_0xb71c('0x48')]},'query':{'section':_0x143274===_0xb71c('0x49')&&_0x3d2ca9[_0xb71c('0x3b')][_0xb71c('0x43')]===_0xb71c('0x4a')?_0xb71c('0x4b'):_['startCase'](_0x143274)+_0xb71c('0x4c'),'type':_0x3d2ca9[_0xb71c('0x3b')]['type'],'nolimit':!![],'sort':'name','filter':_0x3d2ca9[_0xb71c('0x3b')]['filter']}};return db[_0xb71c('0x4d')][_0xb71c('0x4e')](_0x110885);}return db[_0x117736][_0xb71c('0x4f')](_0x19b374);})['then'](function(_0xa8e2dd){_0x2ded49[_0xb71c('0x2a')]=_0xa8e2dd['count'];var _0x2cecc2=_0x143274==='voice'?client:routingClient;return _0x2cecc2[_0xb71c('0x1b')](_['startCase'](_0x143274)+'Queues',_0x3d2ca9)[_0xb71c('0x1c')](function(_0x201dec){if(_0x201dec[_0xb71c('0x21')])throw new Error(util['format'](_0xb71c('0x50'),_0x143274));var _0x806530=_0x201dec[_0xb71c('0x24')];var _0x23aa19=[_0xb71c('0x51'),_0xb71c('0x52'),'waiting','talking','paused'];if(_0x143274===_0xb71c('0x49')&&_0x3d2ca9[_0xb71c('0x3b')]['type']===_0xb71c('0x4a')){_0x23aa19[_0xb71c('0x53')]('pTalking','originated',_0xb71c('0x22'),'dialActive','dialMethod',_0xb71c('0x54'),_0xb71c('0x55'),_0xb71c('0x56'),_0xb71c('0x57'),'erlangCallToSecond',_0xb71c('0x58'),_0xb71c('0x59'),'dialPredictiveInterval',_0xb71c('0x5a'),_0xb71c('0x5b'),_0xb71c('0x5c'),_0xb71c('0x5d'),_0xb71c('0x5e'),_0xb71c('0x5f'),'predictiveIntervalDroppedCallsCallersExit',_0xb71c('0x60'),_0xb71c('0x61'));}var _0x285576=_0xa8e2dd[_0xb71c('0x62')]['map'](function(_0x8a3c1b){var _0x145306=_0x8a3c1b[_0xb71c('0x63')]({'plain':!![]});_0x145306[_0xb71c('0x64')]=0x0;_0x145306['loggedInDb']=0x0;_0x145306['loggedIn']=0x0;_0x145306[_0xb71c('0x52')]=0x0;_0x145306[_0xb71c('0x64')]=0x0;_0x145306[_0xb71c('0x65')]=0x0;if(_0x143274===_0xb71c('0x49')){_0x145306[_0xb71c('0x66')]=0x0;if(_0x3d2ca9[_0xb71c('0x3b')][_0xb71c('0x43')]===_0xb71c('0x4a')){_0x145306[_0xb71c('0x67')]=0x0;_0x145306[_0xb71c('0x68')]=0x0;}}_0x145306[_0xb71c('0x69')]=[];var _0x1532c4=_[_0xb71c('0x6a')](_0x806530['rows'],['id',_0x145306['id']]);if(_0x1532c4)_[_0xb71c('0x6b')](_0x145306,_[_0xb71c('0x6c')](_0x1532c4,_0x23aa19));if(_0x143274==='voice'){return _0x8a3c1b[_0xb71c('0x6d')]({'attributes':['id',_0xb71c('0x32'),_0xb71c('0x6e')],'joinTableAttributes':[],'raw':!![]})[_0xb71c('0x1c')](function(_0x4457ba){return _0x8a3c1b[_0xb71c('0x6f')]({'raw':!![]})['then'](function(_0x546a11){for(var _0x554106=0x0;_0x554106<_0x4457ba[_0xb71c('0x70')];_0x554106++){var _0x30c15d=_[_0xb71c('0x6a')](_0x546a11,['UserId',_0x4457ba[_0x554106]['id']]);var _0x3f8f5a={'id':_0x4457ba[_0x554106]['id'],'name':_0x4457ba[_0x554106][_0xb71c('0x32')],'online':Boolean(_0x4457ba[_0x554106][_0xb71c('0x6e')]),'paused':_0x30c15d?Boolean(_0x30c15d['paused']):![]};if(_0x3f8f5a['online'])_0x145306[_0xb71c('0x71')]++;if(_0x3f8f5a[_0xb71c('0x64')])_0x145306[_0xb71c('0x64')]++;_0x145306[_0xb71c('0x69')][_0xb71c('0x53')](_0x3f8f5a);}return _0x145306;});});}else{var _0x4e1d2a=_0xb71c('0x72')+_[_0xb71c('0x3f')](_0x143274)+_0xb71c('0x40');var _0x2b2adf=_[_0xb71c('0x3f')](_0x143274)+'QueueId';var _0x543a00=_0x143274+'Pause';return db[_0x4e1d2a]['findAll']({'where':{['userQueueKey']:_0x8a3c1b['id']},'raw':!![]})['then'](function(_0x57653f){return db[_0xb71c('0x72')][_0xb71c('0x73')]({'attributes':['id','name',_0xb71c('0x6e'),_0x543a00],'where':{'id':_['map'](_0x57653f,_0xb71c('0x74')),'role':_0xb71c('0x75')},'raw':!![]});})[_0xb71c('0x1c')](function(_0x555a44){for(var _0x444343=0x0;_0x444343<_0x555a44[_0xb71c('0x70')];_0x444343++){var _0x2b1903={'id':_0x555a44[_0x444343]['id'],'name':_0x555a44[_0x444343][_0xb71c('0x32')],'online':Boolean(_0x555a44[_0x444343]['online']),'paused':Boolean(_0x555a44[_0x444343][_0x543a00])};if(_0x2b1903['online'])_0x145306['loggedInDb']++;if(_0x2b1903[_0xb71c('0x64')])_0x145306[_0xb71c('0x64')]++;_0x145306[_0xb71c('0x69')][_0xb71c('0x53')](_0x2b1903);}return _0x145306;});}});return Promise['all'](_0x285576);});})['then'](function(_0x3c85a2){_0x2ded49[_0xb71c('0x62')]=_0x3c85a2;return _0x2ded49;})[_0xb71c('0x1c')](respondWithFilteredResult(_0x1a3577,_0x19b374))[_0xb71c('0x76')](handleError(_0x1a3577,null));}; \ No newline at end of file +var _0x1964=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Realtime,\x20%s,\x20%s','request\x20sent','debug','Realtime,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','stack','name','send','getQueues','mail','chat','sms','openchannel','fax','whatsapp','voice','resolve','query','channel','includes','toLowerCase','Invalid\x20channel','startCase','Queue','map','rawAttributes','fieldName','type','getOptions','user','role','userProfileId','QueueCampaigns','filter','UserProfile','getResources','findAndCountAll','format','result','loggedIn','available','waiting','paused','outbound','push','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','rows','get','loggedInDb','talking','pTalking','merge','pick','getAgents','online','length','find','UserId','User','QueueId','Pause','findAll','agent','agents','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0xb38733,_0x377776){var _0x6e0a81=function(_0x5a164a){while(--_0x5a164a){_0xb38733['push'](_0xb38733['shift']());}};_0x6e0a81(++_0x377776);}(_0x1964,0x6b));var _0x4196=function(_0x5b4e46,_0xe6008d){_0x5b4e46=_0x5b4e46-0x0;var _0x5a229f=_0x1964[_0x5b4e46];return _0x5a229f;};'use strict';var emlformat=require(_0x4196('0x0'));var rimraf=require(_0x4196('0x1'));var zipdir=require(_0x4196('0x2'));var jsonpatch=require(_0x4196('0x3'));var rp=require(_0x4196('0x4'));var moment=require(_0x4196('0x5'));var BPromise=require(_0x4196('0x6'));var Mustache=require(_0x4196('0x7'));var util=require('util');var path=require(_0x4196('0x8'));var sox=require(_0x4196('0x9'));var csv=require('to-csv');var ejs=require(_0x4196('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4196('0xb'));var squel=require(_0x4196('0xc'));var crypto=require('crypto');var jsforce=require(_0x4196('0xd'));var deskjs=require(_0x4196('0xe'));var toCsv=require(_0x4196('0xf'));var querystring=require(_0x4196('0x10'));var Papa=require(_0x4196('0x11'));var Redis=require(_0x4196('0x12'));var authService=require(_0x4196('0x13'));var qs=require(_0x4196('0x14'));var as=require(_0x4196('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4196('0x16'))(_0x4196('0x17'));var utils=require(_0x4196('0x18'));var config=require(_0x4196('0x19'));var licenseUtil=require(_0x4196('0x1a'));var db=require(_0x4196('0x1b'))['db'];var jayson=require(_0x4196('0x1c'));var client=jayson[_0x4196('0x1d')][_0x4196('0x1e')]({'port':0x232a});var routingClient=jayson[_0x4196('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x6063cf,_0x1dbe57,_0x327852,_0x24a2c1){return new BPromise(function(_0x2b0211,_0x420d14){var _0x2de6a8=_0x24a2c1||client;return _0x2de6a8[_0x4196('0x1f')](_0x6063cf,_0x327852)[_0x4196('0x20')](function(_0x126471){logger[_0x4196('0x21')](_0x4196('0x22'),_0x1dbe57,_0x4196('0x23'));logger[_0x4196('0x24')](_0x4196('0x25'),_0x1dbe57,_0x4196('0x23'),JSON[_0x4196('0x26')](_0x126471));if(_0x126471['error']){if(_0x126471[_0x4196('0x27')][_0x4196('0x28')]===0x1f4){logger[_0x4196('0x27')]('Realtime,\x20%s,\x20%s',_0x1dbe57,_0x126471[_0x4196('0x27')]['message']);return _0x420d14(_0x126471[_0x4196('0x27')][_0x4196('0x29')]);}logger['error'](_0x4196('0x22'),_0x1dbe57,_0x126471['error'][_0x4196('0x29')]);return _0x2b0211(_0x126471[_0x4196('0x27')]['message']);}else{logger['info'](_0x4196('0x22'),_0x1dbe57,_0x4196('0x23'));_0x2b0211(_0x126471['result'][_0x4196('0x29')]);}})[_0x4196('0x2a')](function(_0x29b474){logger[_0x4196('0x27')]('Realtime,\x20%s,\x20%s',_0x1dbe57,_0x29b474);_0x420d14(_0x29b474);});});}function respondWithStatusCode(_0xd306f0,_0x25e8f2){_0x25e8f2=_0x25e8f2||0xcc;return function(_0x4ef624){if(_0x4ef624){return _0xd306f0[_0x4196('0x2b')](_0x25e8f2);}return _0xd306f0[_0x4196('0x2c')](_0x25e8f2)[_0x4196('0x2d')]();};}function respondWithResult(_0x210cb3,_0x9f8d90){_0x9f8d90=_0x9f8d90||0xc8;return function(_0x9a5a17){if(_0x9a5a17){return _0x210cb3[_0x4196('0x2c')](_0x9f8d90)['json'](_0x9a5a17);}};}function respondWithFilteredResult(_0x1d95f3,_0xccf26c){return function(_0x165967){if(_0x165967){var _0x3e9058=typeof _0xccf26c[_0x4196('0x2e')]==='undefined'&&typeof _0xccf26c[_0x4196('0x2f')]==='undefined';var _0x2dfd8b=_0x165967[_0x4196('0x30')];var _0x2e5eb5=_0x3e9058?0x0:_0xccf26c[_0x4196('0x2e')];var _0x15cb76=_0x3e9058?_0x165967[_0x4196('0x30')]:_0xccf26c[_0x4196('0x2e')]+_0xccf26c[_0x4196('0x2f')];var _0x55c00f;if(_0x15cb76>=_0x2dfd8b){_0x15cb76=_0x2dfd8b;_0x55c00f=0xc8;}else{_0x55c00f=0xce;}_0x1d95f3[_0x4196('0x2c')](_0x55c00f);return _0x1d95f3[_0x4196('0x31')](_0x4196('0x32'),_0x2e5eb5+'-'+_0x15cb76+'/'+_0x2dfd8b)[_0x4196('0x33')](_0x165967);}return null;};}function patchUpdates(_0xa3860a){return function(_0x515228){try{jsonpatch[_0x4196('0x34')](_0x515228,_0xa3860a,!![]);}catch(_0x21ea43){return BPromise[_0x4196('0x35')](_0x21ea43);}return _0x515228[_0x4196('0x36')]();};}function saveUpdates(_0x5aa2a4,_0x30d968){return function(_0x520362){if(_0x520362){return _0x520362[_0x4196('0x37')](_0x5aa2a4)[_0x4196('0x20')](function(_0xb21239){return _0xb21239;});}return null;};}function removeEntity(_0x1b67dd,_0x32dd5a){return function(_0x29d22d){if(_0x29d22d){return _0x29d22d['destroy']()[_0x4196('0x20')](function(){_0x1b67dd[_0x4196('0x2c')](0xcc)[_0x4196('0x2d')]();});}};}function handleEntityNotFound(_0x229776,_0x3a2328){return function(_0x1f7466){if(!_0x1f7466){_0x229776['sendStatus'](0x194);}return _0x1f7466;};}function handleError(_0x29c79d,_0x26d58d){_0x26d58d=_0x26d58d||0x1f4;return function(_0x4be2d9){logger['error'](_0x4be2d9[_0x4196('0x38')]);if(_0x4be2d9[_0x4196('0x39')]){delete _0x4be2d9[_0x4196('0x39')];}_0x29c79d[_0x4196('0x2c')](_0x26d58d)[_0x4196('0x3a')](_0x4be2d9);};}exports[_0x4196('0x3b')]=function(_0x5bd998,_0x5f1b9d){var _0x4aaa74=[_0x4196('0x3c'),_0x4196('0x3d'),_0x4196('0x3e'),_0x4196('0x3f'),_0x4196('0x40'),_0x4196('0x41'),_0x4196('0x42')];var _0x4b5b79={'count':0x0,'rows':[]},_0x4266ac={},_0x5eb7e7;Promise[_0x4196('0x43')]()['then'](function(){if(_0x5bd998[_0x4196('0x44')][_0x4196('0x45')]){if(!_[_0x4196('0x46')](_0x4aaa74,_0x5bd998[_0x4196('0x44')][_0x4196('0x45')][_0x4196('0x47')]()))throw new Error(_0x4196('0x48'));_0x5eb7e7=_0x5bd998[_0x4196('0x44')]['channel'][_0x4196('0x47')]();}var _0x36dac1=_[_0x4196('0x49')](_0x5eb7e7)+_0x4196('0x4a');var _0x3e8d4f=_[_0x4196('0x4b')](db[_0x36dac1][_0x4196('0x4c')],function(_0x570715){return{'name':_0x570715[_0x4196('0x4d')],'type':_0x570715[_0x4196('0x4e')]['key']};});_0x4266ac=qs[_0x4196('0x4f')](_0x3e8d4f,_0x5bd998);if(_0x5bd998[_0x4196('0x50')][_0x4196('0x51')]==='user'){var _0x273f2d={'params':{'id':_0x5bd998[_0x4196('0x50')][_0x4196('0x52')]},'query':{'section':_0x5eb7e7===_0x4196('0x42')&&_0x5bd998['query'][_0x4196('0x4e')]==='outbound'?_0x4196('0x53'):_[_0x4196('0x49')](_0x5eb7e7)+'Queues','type':_0x5bd998[_0x4196('0x44')][_0x4196('0x4e')],'nolimit':!![],'sort':'name','filter':_0x5bd998[_0x4196('0x44')][_0x4196('0x54')]}};return db[_0x4196('0x55')][_0x4196('0x56')](_0x273f2d);}return db[_0x36dac1][_0x4196('0x57')](_0x4266ac);})[_0x4196('0x20')](function(_0x10c4a8){_0x4b5b79[_0x4196('0x30')]=_0x10c4a8[_0x4196('0x30')];var _0x9018ab=_0x5eb7e7===_0x4196('0x42')?client:routingClient;return _0x9018ab['request'](_[_0x4196('0x49')](_0x5eb7e7)+'Queues',_0x5bd998)[_0x4196('0x20')](function(_0x238e93){if(_0x238e93['error'])throw new Error(util[_0x4196('0x58')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x5eb7e7));var _0x3bdd8a=_0x238e93[_0x4196('0x59')];var _0xd3e821=[_0x4196('0x5a'),_0x4196('0x5b'),_0x4196('0x5c'),'talking',_0x4196('0x5d')];if(_0x5eb7e7===_0x4196('0x42')&&_0x5bd998[_0x4196('0x44')][_0x4196('0x4e')]===_0x4196('0x5e')){_0xd3e821[_0x4196('0x5f')]('pTalking',_0x4196('0x60'),_0x4196('0x29'),_0x4196('0x61'),_0x4196('0x62'),_0x4196('0x63'),_0x4196('0x64'),_0x4196('0x65'),_0x4196('0x66'),_0x4196('0x67'),_0x4196('0x68'),'erlangBusyFactor',_0x4196('0x69'),_0x4196('0x6a'),_0x4196('0x6b'),_0x4196('0x6c'),_0x4196('0x6d'),_0x4196('0x6e'),'predictiveIntervalDroppedCallsTimeout',_0x4196('0x6f'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime');}var _0x9a10af=_0x10c4a8[_0x4196('0x70')][_0x4196('0x4b')](function(_0x4d42e1){var _0x2f5089=_0x4d42e1[_0x4196('0x71')]({'plain':!![]});_0x2f5089[_0x4196('0x5d')]=0x0;_0x2f5089[_0x4196('0x72')]=0x0;_0x2f5089[_0x4196('0x5a')]=0x0;_0x2f5089['available']=0x0;_0x2f5089[_0x4196('0x5d')]=0x0;_0x2f5089[_0x4196('0x5c')]=0x0;if(_0x5eb7e7===_0x4196('0x42')){_0x2f5089[_0x4196('0x73')]=0x0;if(_0x5bd998[_0x4196('0x44')]['type']===_0x4196('0x5e')){_0x2f5089[_0x4196('0x74')]=0x0;_0x2f5089['originated']=0x0;}}_0x2f5089['agents']=[];var _0x2958d1=_['find'](_0x3bdd8a[_0x4196('0x70')],['id',_0x2f5089['id']]);if(_0x2958d1)_[_0x4196('0x75')](_0x2f5089,_[_0x4196('0x76')](_0x2958d1,_0xd3e821));if(_0x5eb7e7===_0x4196('0x42')){return _0x4d42e1[_0x4196('0x77')]({'attributes':['id',_0x4196('0x39'),_0x4196('0x78')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x198dfc){return _0x4d42e1['getMembers']({'raw':!![]})[_0x4196('0x20')](function(_0x2bacaa){for(var _0x31a741=0x0;_0x31a741<_0x198dfc[_0x4196('0x79')];_0x31a741++){var _0x1876d4=_[_0x4196('0x7a')](_0x2bacaa,[_0x4196('0x7b'),_0x198dfc[_0x31a741]['id']]);var _0x495f74={'id':_0x198dfc[_0x31a741]['id'],'name':_0x198dfc[_0x31a741]['name'],'online':Boolean(_0x198dfc[_0x31a741][_0x4196('0x78')]),'paused':_0x1876d4?Boolean(_0x1876d4[_0x4196('0x5d')]):![]};if(_0x495f74[_0x4196('0x78')])_0x2f5089['loggedInDb']++;if(_0x495f74['paused'])_0x2f5089['paused']++;_0x2f5089['agents'][_0x4196('0x5f')](_0x495f74);}return _0x2f5089;});});}else{var _0x3b3293=_0x4196('0x7c')+_[_0x4196('0x49')](_0x5eb7e7)+_0x4196('0x4a');var _0x55b3c3=_['startCase'](_0x5eb7e7)+_0x4196('0x7d');var _0x427abb=_0x5eb7e7+_0x4196('0x7e');return db[_0x3b3293][_0x4196('0x7f')]({'where':{['userQueueKey']:_0x4d42e1['id']},'raw':!![]})[_0x4196('0x20')](function(_0x1eb025){return db[_0x4196('0x7c')][_0x4196('0x7f')]({'attributes':['id',_0x4196('0x39'),_0x4196('0x78'),_0x427abb],'where':{'id':_[_0x4196('0x4b')](_0x1eb025,_0x4196('0x7b')),'role':_0x4196('0x80')},'raw':!![]});})[_0x4196('0x20')](function(_0x1fdb85){for(var _0x2a777b=0x0;_0x2a777b<_0x1fdb85['length'];_0x2a777b++){var _0x25c133={'id':_0x1fdb85[_0x2a777b]['id'],'name':_0x1fdb85[_0x2a777b][_0x4196('0x39')],'online':Boolean(_0x1fdb85[_0x2a777b][_0x4196('0x78')]),'paused':Boolean(_0x1fdb85[_0x2a777b][_0x427abb])};if(_0x25c133[_0x4196('0x78')])_0x2f5089[_0x4196('0x72')]++;if(_0x25c133[_0x4196('0x5d')])_0x2f5089['paused']++;_0x2f5089[_0x4196('0x81')][_0x4196('0x5f')](_0x25c133);}return _0x2f5089;});}});return Promise[_0x4196('0x82')](_0x9a10af);});})[_0x4196('0x20')](function(_0xe81090){_0x4b5b79[_0x4196('0x70')]=_0xe81090;return _0x4b5b79;})[_0x4196('0x20')](respondWithFilteredResult(_0x5f1b9d,_0x4266ac))[_0x4196('0x2a')](handleError(_0x5f1b9d,null));}; \ No newline at end of file diff --git a/server/api/realtime/realtime.model.js b/server/api/realtime/realtime.model.js index 837cb77..f9d4e54 100644 --- a/server/api/realtime/realtime.model.js +++ b/server/api/realtime/realtime.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe63b=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','Realtime','util'];(function(_0x1a8b5c,_0x1e4052){var _0x3ae793=function(_0xc437f6){while(--_0xc437f6){_0x1a8b5c['push'](_0x1a8b5c['shift']());}};_0x3ae793(++_0x1e4052);}(_0xe63b,0xa9));var _0xbe63=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xe63b[_0x4ea413];return _0x51cf25;};'use strict';var _=require('lodash');var util=require(_0xbe63('0x0'));var logger=require(_0xbe63('0x1'))('api');var moment=require(_0xbe63('0x2'));var BPromise=require('bluebird');var rp=require(_0xbe63('0x3'));var fs=require('fs');var path=require(_0xbe63('0x4'));var rimraf=require(_0xbe63('0x5'));var config=require(_0xbe63('0x6'));;module[_0xbe63('0x7')]=function(_0x1ff776,_0x33250c){return _0x1ff776[_0xbe63('0x8')](_0xbe63('0x9'),[],{});}; \ No newline at end of file +var _0xf2a1=['exports','define','Realtime','lodash','moment','bluebird','rimraf','../../config/environment'];(function(_0x2b00d7,_0x4d9bc2){var _0xe2b296=function(_0x127148){while(--_0x127148){_0x2b00d7['push'](_0x2b00d7['shift']());}};_0xe2b296(++_0x4d9bc2);}(_0xf2a1,0xbb));var _0x1f2a=function(_0x51dc37,_0x4d4a39){_0x51dc37=_0x51dc37-0x0;var _0x1fe2b1=_0xf2a1[_0x51dc37];return _0x1fe2b1;};'use strict';var _=require(_0x1f2a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1f2a('0x1'));var BPromise=require(_0x1f2a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1f2a('0x3'));var config=require(_0x1f2a('0x4'));;module[_0x1f2a('0x5')]=function(_0x1e47e0,_0x20dc99){return _0x1e47e0[_0x1f2a('0x6')](_0x1f2a('0x7'),[],{});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a0fc8a3..20b8a73 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x81fee8,_0x32f097){var _0x2b2c4e=function(_0x20c43e){while(--_0x20c43e){_0x81fee8['push'](_0x81fee8['shift']());}};_0x2b2c4e(++_0x32f097);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3f995f,_0x27cefe){var _0x2ac1f2=function(_0x1bd60e){while(--_0x1bd60e){_0x3f995f['push'](_0x3f995f['shift']());}};_0x2ac1f2(++_0x27cefe);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0xcb91[_0x423097];return _0x3a73f1;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 7ffc86b..bd84408 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 _0x8c8b=['DATE','sequelize','STRING'];(function(_0x26bec8,_0x2cca48){var _0x4a5d80=function(_0x3f819d){while(--_0x3f819d){_0x26bec8['push'](_0x26bec8['shift']());}};_0x4a5d80(++_0x2cca48);}(_0x8c8b,0x106));var _0xb8c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c8b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb8c8('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb8c8('0x1')]},'scheduledat':{'type':Sequelize[_0xb8c8('0x2')]},'uniqueid':{'type':Sequelize[_0xb8c8('0x1')]},'starttime':{'type':Sequelize[_0xb8c8('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb8c8('0x1')]},'campaigntype':{'type':Sequelize[_0xb8c8('0x1')]},'membername':{'type':Sequelize[_0xb8c8('0x1')]}}; \ No newline at end of file +var _0x4cb5=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x4cb5,0x8f));var _0x54cb=function(_0x2dec70,_0x46171d){_0x2dec70=_0x2dec70-0x0;var _0x6cee09=_0x4cb5[_0x2dec70];return _0x6cee09;};'use strict';var Sequelize=require(_0x54cb('0x0'));module[_0x54cb('0x1')]={'state':{'type':Sequelize[_0x54cb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x54cb('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x54cb('0x3')]},'starttime':{'type':Sequelize[_0x54cb('0x4')]},'responsetime':{'type':Sequelize[_0x54cb('0x4')]},'ringtime':{'type':Sequelize[_0x54cb('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x54cb('0x3')]},'campaigntype':{'type':Sequelize[_0x54cb('0x3')]},'membername':{'type':Sequelize[_0x54cb('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 98e7874..918383a 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 _0x50de=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api'];(function(_0x808954,_0x4be282){var _0x361497=function(_0x2667b6){while(--_0x2667b6){_0x808954['push'](_0x808954['shift']());}};_0x361497(++_0x4be282);}(_0x50de,0x1ae));var _0xe50d=function(_0x2077be,_0x26136a){_0x2077be=_0x2077be-0x0;var _0x198bbf=_0x50de[_0x2077be];return _0x198bbf;};'use strict';var _=require(_0xe50d('0x0'));var util=require(_0xe50d('0x1'));var logger=require(_0xe50d('0x2'))(_0xe50d('0x3'));var moment=require('moment');var BPromise=require(_0xe50d('0x4'));var rp=require(_0xe50d('0x5'));var fs=require('fs');var path=require(_0xe50d('0x6'));var rimraf=require(_0xe50d('0x7'));var config=require(_0xe50d('0x8'));var attributes=require(_0xe50d('0x9'));module[_0xe50d('0xa')]=function(_0x33eac3,_0x2e8d3d){return _0x33eac3[_0xe50d('0xb')](_0xe50d('0xc'),attributes,{'tableName':_0xe50d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51d1=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','report_agent_preview','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x51d1,0x10f));var _0x151d=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0x51d1[_0x545a3a];return _0x5a5493;};'use strict';var _=require(_0x151d('0x0'));var util=require(_0x151d('0x1'));var logger=require(_0x151d('0x2'))(_0x151d('0x3'));var moment=require(_0x151d('0x4'));var BPromise=require('bluebird');var rp=require(_0x151d('0x5'));var fs=require('fs');var path=require(_0x151d('0x6'));var rimraf=require(_0x151d('0x7'));var config=require(_0x151d('0x8'));var attributes=require(_0x151d('0x9'));module['exports']=function(_0x326127,_0x197de9){return _0x326127[_0x151d('0xa')]('ReportAgentPreview',attributes,{'tableName':_0x151d('0xb'),'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 aece101..c1f4186 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 _0xab73=['error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','body','options','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4d0ae1,_0x46b552){var _0x5ff510=function(_0x21e839){while(--_0x21e839){_0x4d0ae1['push'](_0x4d0ae1['shift']());}};_0x5ff510(++_0x46b552);}(_0xab73,0x8b));var _0x3ab7=function(_0x17ffad,_0x168ea8){_0x17ffad=_0x17ffad-0x0;var _0x377ae0=_0xab73[_0x17ffad];return _0x377ae0;};'use strict';var _=require(_0x3ab7('0x0'));var util=require(_0x3ab7('0x1'));var moment=require('moment');var BPromise=require(_0x3ab7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ab7('0x3'));var db=require(_0x3ab7('0x4'))['db'];var utils=require(_0x3ab7('0x5'));var logger=require(_0x3ab7('0x6'))(_0x3ab7('0x7'));var config=require('../../config/environment');var jayson=require(_0x3ab7('0x8'));var client=jayson[_0x3ab7('0x9')][_0x3ab7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8b37d1,_0x1a75ba,_0x14efd5){return new BPromise(function(_0x5305ac,_0x390068){return client[_0x3ab7('0xb')](_0x8b37d1,_0x14efd5)[_0x3ab7('0xc')](function(_0x1792fa){logger[_0x3ab7('0xd')](_0x3ab7('0xe'),_0x1a75ba,'request\x20sent');logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1a75ba,_0x3ab7('0xf'),JSON[_0x3ab7('0x10')](_0x1792fa));if(_0x1792fa[_0x3ab7('0x11')]){if(_0x1792fa[_0x3ab7('0x11')][_0x3ab7('0x12')]===0x1f4){logger['error'](_0x3ab7('0xe'),_0x1a75ba,_0x1792fa[_0x3ab7('0x11')][_0x3ab7('0x13')]);return _0x390068(_0x1792fa[_0x3ab7('0x11')]['message']);}logger[_0x3ab7('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x1a75ba,_0x1792fa['error']['message']);return _0x5305ac(_0x1792fa['error'][_0x3ab7('0x13')]);}else{logger[_0x3ab7('0xd')](_0x3ab7('0xe'),_0x1a75ba,_0x3ab7('0xf'));_0x5305ac(_0x1792fa[_0x3ab7('0x14')]['message']);}})['catch'](function(_0x4e7bda){logger[_0x3ab7('0x11')](_0x3ab7('0xe'),_0x1a75ba,_0x4e7bda);_0x390068(_0x4e7bda);});});}exports[_0x3ab7('0x15')]=function(_0x3d1f32){var _0x114120=this;return new Promise(function(_0x3791b1,_0x22021c){return db[_0x3ab7('0x16')]['create'](_0x3d1f32[_0x3ab7('0x17')],{'raw':_0x3d1f32[_0x3ab7('0x18')]?_0x3d1f32[_0x3ab7('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x45e228){logger['info'](_0x3ab7('0x15'),_0x3d1f32);logger['debug'](_0x3ab7('0x15'),_0x3d1f32,JSON[_0x3ab7('0x10')](_0x45e228));_0x3791b1(_0x45e228);})[_0x3ab7('0x19')](function(_0x595e97){logger[_0x3ab7('0x11')](_0x3ab7('0x15'),_0x595e97[_0x3ab7('0x13')],_0x3d1f32);_0x22021c(_0x114120[_0x3ab7('0x11')](0x1f4,_0x595e97[_0x3ab7('0x13')]));});});}; \ No newline at end of file +var _0x1f25=['body','options','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x1f25,0xe3));var _0x51f2=function(_0x41bf82,_0xa062d6){_0x41bf82=_0x41bf82-0x0;var _0x517060=_0x1f25[_0x41bf82];return _0x517060;};'use strict';var _=require(_0x51f2('0x0'));var util=require('util');var moment=require(_0x51f2('0x1'));var BPromise=require(_0x51f2('0x2'));var rs=require(_0x51f2('0x3'));var fs=require('fs');var Redis=require(_0x51f2('0x4'));var db=require(_0x51f2('0x5'))['db'];var utils=require(_0x51f2('0x6'));var logger=require(_0x51f2('0x7'))(_0x51f2('0x8'));var config=require(_0x51f2('0x9'));var jayson=require(_0x51f2('0xa'));var client=jayson[_0x51f2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x245919,_0x38e40a,_0x202fa5){return new BPromise(function(_0x1b2d8c,_0x5056fc){return client[_0x51f2('0xc')](_0x245919,_0x202fa5)[_0x51f2('0xd')](function(_0xb86c5d){logger[_0x51f2('0xe')](_0x51f2('0xf'),_0x38e40a,_0x51f2('0x10'));logger['debug'](_0x51f2('0x11'),_0x38e40a,'request\x20sent',JSON[_0x51f2('0x12')](_0xb86c5d));if(_0xb86c5d['error']){if(_0xb86c5d[_0x51f2('0x13')][_0x51f2('0x14')]===0x1f4){logger[_0x51f2('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x38e40a,_0xb86c5d[_0x51f2('0x13')]['message']);return _0x5056fc(_0xb86c5d[_0x51f2('0x13')][_0x51f2('0x15')]);}logger[_0x51f2('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x38e40a,_0xb86c5d[_0x51f2('0x13')]['message']);return _0x1b2d8c(_0xb86c5d['error'][_0x51f2('0x15')]);}else{logger[_0x51f2('0xe')](_0x51f2('0xf'),_0x38e40a,_0x51f2('0x10'));_0x1b2d8c(_0xb86c5d['result'][_0x51f2('0x15')]);}})[_0x51f2('0x16')](function(_0x21ed2c){logger[_0x51f2('0x13')](_0x51f2('0xf'),_0x38e40a,_0x21ed2c);_0x5056fc(_0x21ed2c);});});}exports[_0x51f2('0x17')]=function(_0x4aa65d){var _0x48528c=this;return new Promise(function(_0x304b4f,_0x1f759b){return db[_0x51f2('0x18')]['create'](_0x4aa65d[_0x51f2('0x19')],{'raw':_0x4aa65d[_0x51f2('0x1a')]?_0x4aa65d[_0x51f2('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4d44ee){logger[_0x51f2('0xe')](_0x51f2('0x17'),_0x4aa65d);logger[_0x51f2('0x1b')](_0x51f2('0x17'),_0x4aa65d,JSON['stringify'](_0x4d44ee));_0x304b4f(_0x4d44ee);})[_0x51f2('0x16')](function(_0x3f2935){logger[_0x51f2('0x13')](_0x51f2('0x17'),_0x3f2935['message'],_0x4aa65d);_0x1f759b(_0x48528c[_0x51f2('0x13')](0x1f4,_0x3f2935[_0x51f2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 971b980..723c94b 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 _0xe032=['telephones','/trunks','trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','util','express','./rpc.controller','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones'];(function(_0x56a566,_0x570f99){var _0x4ac781=function(_0x253084){while(--_0x253084){_0x56a566['push'](_0x56a566['shift']());}};_0x4ac781(++_0x570f99);}(_0xe032,0x15a));var _0x2e03=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xe032[_0x96f74c];return _0x379222;};'use strict';var multer=require('multer');var util=require(_0x2e03('0x0'));var path=require('path');var express=require(_0x2e03('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x2e03('0x2'));router['get']('/voice/channels',auth[_0x2e03('0x3')](),controller[_0x2e03('0x4')]);router[_0x2e03('0x5')](_0x2e03('0x6'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x7')]);router[_0x2e03('0x5')](_0x2e03('0x8'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x9')]);router[_0x2e03('0x5')](_0x2e03('0xa'),auth['isAuthenticated'](),controller[_0x2e03('0xb')]);router[_0x2e03('0x5')](_0x2e03('0xc'),auth[_0x2e03('0x3')](),controller[_0x2e03('0xd')]);router['get']('/mail/queues',auth[_0x2e03('0x3')](),controller[_0x2e03('0xe')]);router['get'](_0x2e03('0xf'),auth['isAuthenticated'](),controller[_0x2e03('0x10')]);router['get'](_0x2e03('0x11'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x12')]);router['get'](_0x2e03('0x13'),auth['isAuthenticated'](),controller['smsQueues']);router['get'](_0x2e03('0x14'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x2e03('0x5')]('/fax/queues',auth[_0x2e03('0x3')](),controller['faxQueues']);router[_0x2e03('0x5')](_0x2e03('0x15'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x16')]);router[_0x2e03('0x5')](_0x2e03('0x17'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x18')]);router[_0x2e03('0x5')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x2e03('0x19')]);router[_0x2e03('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x2e03('0x3')](),controller['voiceQueuesChannelHangup']);router[_0x2e03('0x5')](_0x2e03('0x1a'),auth['isAuthenticated'](),controller[_0x2e03('0x1b')]);router['get']('/voice/queues/:id',auth[_0x2e03('0x3')](),controller[_0x2e03('0x1c')]);router[_0x2e03('0x1d')](_0x2e03('0x1e'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x1f')]);router[_0x2e03('0x5')](_0x2e03('0x20'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x21')]);router[_0x2e03('0x5')](_0x2e03('0x22'),auth[_0x2e03('0x3')](),controller['outboundChannels']);router[_0x2e03('0x5')](_0x2e03('0x23'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x24')]);router[_0x2e03('0x1d')](_0x2e03('0x25'),auth[_0x2e03('0x3')](),controller['agentCapacity']);router['get'](_0x2e03('0x26'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x27')]);router[_0x2e03('0x5')](_0x2e03('0x28'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x29')]);router[_0x2e03('0x5')](_0x2e03('0x2a'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x2b')]);router[_0x2e03('0x5')]('/fax/accounts',auth[_0x2e03('0x3')](),controller['faxAccounts']);router['get'](_0x2e03('0x2c'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x2d')]);router[_0x2e03('0x5')](_0x2e03('0x2e'),auth[_0x2e03('0x3')](),controller['mailQueuesWaitingInteractions']);router['get']('/openchannel/queues/waitinginteractions',auth[_0x2e03('0x3')](),controller[_0x2e03('0x2f')]);router['get'](_0x2e03('0x30'),auth[_0x2e03('0x3')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x2e03('0x5')](_0x2e03('0x31'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x2e03('0x5')](_0x2e03('0x32'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x33')]);router[_0x2e03('0x5')](_0x2e03('0x34'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x35')]);router[_0x2e03('0x36')]('/mail/queues/:id/notify',auth[_0x2e03('0x3')](),controller['queueNotify'](_0x2e03('0x37')));router[_0x2e03('0x5')](_0x2e03('0x38'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x39')]);router[_0x2e03('0x36')](_0x2e03('0x3a'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x3b')]('chat'));router[_0x2e03('0x5')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x2e03('0x3c')]);router[_0x2e03('0x36')](_0x2e03('0x3d'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x3b')](_0x2e03('0x3e')));router[_0x2e03('0x5')](_0x2e03('0x3f'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x40')]);router['post'](_0x2e03('0x41'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x3b')]('openchannel'));router[_0x2e03('0x5')](_0x2e03('0x42'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x43')]);router[_0x2e03('0x36')](_0x2e03('0x44'),auth['isAuthenticated'](),controller[_0x2e03('0x3b')](_0x2e03('0x45')));router[_0x2e03('0x36')](_0x2e03('0x46'),auth[_0x2e03('0x3')](),controller[_0x2e03('0x3b')](_0x2e03('0x47')));router[_0x2e03('0x5')](_0x2e03('0x48'),auth[_0x2e03('0x3')](),controller['showSmsQueues']);router[_0x2e03('0x5')](_0x2e03('0x49'),auth['isAuthenticated'](),controller[_0x2e03('0x4a')]);router[_0x2e03('0x36')]('/agents/:id/notify',auth[_0x2e03('0x3')](),controller[_0x2e03('0x4b')]);module[_0x2e03('0x4c')]=router; \ No newline at end of file +var _0x83d3=['/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions'];(function(_0x412376,_0x482fc2){var _0xae59bf=function(_0x6e8d7e){while(--_0x6e8d7e){_0x412376['push'](_0x412376['shift']());}};_0xae59bf(++_0x482fc2);}(_0x83d3,0x15d));var _0x383d=function(_0x15b192,_0x38c235){_0x15b192=_0x15b192-0x0;var _0x396e73=_0x83d3[_0x15b192];return _0x396e73;};'use strict';var multer=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var path=require(_0x383d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x383d('0x3'));var controller=require(_0x383d('0x4'));router['get'](_0x383d('0x5'),auth[_0x383d('0x6')](),controller[_0x383d('0x7')]);router[_0x383d('0x8')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x383d('0x6')](),controller[_0x383d('0x9')]);router[_0x383d('0x8')](_0x383d('0xa'),auth[_0x383d('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0x383d('0x8')]('/voice/queues',auth[_0x383d('0x6')](),controller[_0x383d('0xb')]);router[_0x383d('0x8')](_0x383d('0xc'),auth[_0x383d('0x6')](),controller['chatQueues']);router[_0x383d('0x8')]('/mail/queues',auth[_0x383d('0x6')](),controller[_0x383d('0xd')]);router[_0x383d('0x8')](_0x383d('0xe'),auth['isAuthenticated'](),controller[_0x383d('0xf')]);router[_0x383d('0x8')](_0x383d('0x10'),auth[_0x383d('0x6')](),controller[_0x383d('0x11')]);router[_0x383d('0x8')]('/sms/queues',auth[_0x383d('0x6')](),controller[_0x383d('0x12')]);router['get'](_0x383d('0x13'),auth['isAuthenticated'](),controller[_0x383d('0x14')]);router['get'](_0x383d('0x15'),auth[_0x383d('0x6')](),controller[_0x383d('0x16')]);router['get'](_0x383d('0x17'),auth[_0x383d('0x6')](),controller[_0x383d('0x18')]);router[_0x383d('0x8')](_0x383d('0x19'),auth[_0x383d('0x6')](),controller[_0x383d('0x1a')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x383d('0x6')](),controller[_0x383d('0x1b')]);router[_0x383d('0x8')](_0x383d('0x1c'),auth[_0x383d('0x6')](),controller[_0x383d('0x1d')]);router[_0x383d('0x8')](_0x383d('0x1e'),auth[_0x383d('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x383d('0x8')]('/voice/queues/:id',auth[_0x383d('0x6')](),controller[_0x383d('0x1f')]);router[_0x383d('0x20')](_0x383d('0x21'),auth[_0x383d('0x6')](),controller[_0x383d('0x22')]);router[_0x383d('0x8')](_0x383d('0x23'),auth[_0x383d('0x6')](),controller[_0x383d('0x24')]);router[_0x383d('0x8')]('/outbound/channels',auth[_0x383d('0x6')](),controller[_0x383d('0x25')]);router['get'](_0x383d('0x26'),auth[_0x383d('0x6')](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0x383d('0x6')](),controller[_0x383d('0x27')]);router[_0x383d('0x8')](_0x383d('0x28'),auth['isAuthenticated'](),controller[_0x383d('0x29')]);router['get'](_0x383d('0x2a'),auth['isAuthenticated'](),controller[_0x383d('0x2b')]);router['get'](_0x383d('0x2c'),auth[_0x383d('0x6')](),controller[_0x383d('0x2d')]);router[_0x383d('0x8')](_0x383d('0x2e'),auth['isAuthenticated'](),controller[_0x383d('0x2f')]);router[_0x383d('0x8')](_0x383d('0x30'),auth[_0x383d('0x6')](),controller[_0x383d('0x31')]);router[_0x383d('0x8')](_0x383d('0x32'),auth[_0x383d('0x6')](),controller[_0x383d('0x33')]);router['get'](_0x383d('0x34'),auth[_0x383d('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0x383d('0x8')](_0x383d('0x35'),auth[_0x383d('0x6')](),controller[_0x383d('0x36')]);router[_0x383d('0x8')]('/sms/queues/waitinginteractions',auth[_0x383d('0x6')](),controller[_0x383d('0x37')]);router[_0x383d('0x8')](_0x383d('0x38'),auth['isAuthenticated'](),controller[_0x383d('0x39')]);router['get'](_0x383d('0x3a'),auth['isAuthenticated'](),controller[_0x383d('0x3b')]);router[_0x383d('0x3c')](_0x383d('0x3d'),auth[_0x383d('0x6')](),controller[_0x383d('0x3e')](_0x383d('0x3f')));router[_0x383d('0x8')]('/mail/queues/:id',auth['isAuthenticated'](),controller['showMailQueues']);router[_0x383d('0x3c')](_0x383d('0x40'),auth[_0x383d('0x6')](),controller['queueNotify'](_0x383d('0x41')));router['get']('/chat/queues/:id',auth[_0x383d('0x6')](),controller[_0x383d('0x42')]);router['post']('/fax/queues/:id/notify',auth[_0x383d('0x6')](),controller[_0x383d('0x3e')]('fax'));router[_0x383d('0x8')](_0x383d('0x43'),auth[_0x383d('0x6')](),controller[_0x383d('0x44')]);router[_0x383d('0x3c')](_0x383d('0x45'),auth[_0x383d('0x6')](),controller[_0x383d('0x3e')](_0x383d('0x46')));router[_0x383d('0x8')](_0x383d('0x47'),auth[_0x383d('0x6')](),controller[_0x383d('0x48')]);router['post']('/sms/queues/:id/notify',auth[_0x383d('0x6')](),controller[_0x383d('0x3e')]('sms'));router[_0x383d('0x3c')](_0x383d('0x49'),auth['isAuthenticated'](),controller['queueNotify'](_0x383d('0x4a')));router[_0x383d('0x8')](_0x383d('0x4b'),auth['isAuthenticated'](),controller[_0x383d('0x4c')]);router[_0x383d('0x8')](_0x383d('0x4d'),auth['isAuthenticated'](),controller[_0x383d('0x4e')]);router[_0x383d('0x3c')](_0x383d('0x4f'),auth[_0x383d('0x6')](),controller[_0x383d('0x50')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 7ee256e..af41f17 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 _0x2bd8=['SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','uniq','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','Account','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','\x20Message\x20not\x20found','update','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','message','result','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','format','agent','internal','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues'];(function(_0x18536d,_0x184ba1){var _0x229931=function(_0x27c947){while(--_0x27c947){_0x18536d['push'](_0x18536d['shift']());}};_0x229931(++_0x184ba1);}(_0x2bd8,0x130));var _0x82bd=function(_0x26f3f5,_0x1ad2f1){_0x26f3f5=_0x26f3f5-0x0;var _0x36c4eb=_0x2bd8[_0x26f3f5];return _0x36c4eb;};'use strict';var BPromise=require(_0x82bd('0x0'));var moment=require('moment');var _=require(_0x82bd('0x1'));var util=require(_0x82bd('0x2'));var db=require(_0x82bd('0x3'))['db'];var logger=require(_0x82bd('0x4'))(_0x82bd('0x5'));var jayson=require(_0x82bd('0x6'));var amiClient=jayson[_0x82bd('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0x82bd('0x7')][_0x82bd('0x8')]({'port':0x232b});var routingClient=jayson[_0x82bd('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){var _0x1666cf=_0x226f60?_0x226f60:amiClient;return _0x1666cf['request'](_0x19dbb1,_0x77d7a9)['then'](function(_0x51c6ea){if(_0x51c6ea[_0x82bd('0x9')]){if(_0x51c6ea['error']['code']===0x1f4){return _0x4dc3a6(_0x51c6ea[_0x82bd('0x9')]['message']);}return _0x1f7463(_0x51c6ea['error'][_0x82bd('0xa')]);}else{_0x1f7463(_0x51c6ea[_0x82bd('0xb')]);}})['catch'](function(_0x140ad6){_0x4dc3a6(_0x140ad6);});});}function respondWithResult(_0x5f1ab9,_0xfaccf7){_0xfaccf7=_0xfaccf7||0xc8;return function(_0x51e17e){if(_0x51e17e){return _0x5f1ab9[_0x82bd('0xc')](_0xfaccf7)[_0x82bd('0xd')](_0x51e17e);}return _0x5f1ab9[_0x82bd('0xe')](0x194);};}function handleError(_0x2ca530,_0x58d82b){_0x58d82b=_0x58d82b||0x1f4;return function(_0x446ffc){logger[_0x82bd('0x9')](_0x446ffc['stack']);if(_0x446ffc[_0x82bd('0xf')]){delete _0x446ffc['name'];}_0x2ca530[_0x82bd('0xc')](_0x58d82b)[_0x82bd('0x10')](_0x446ffc);};}function findById(_0x2c5155){return function(_0x300982){if(!_[_0x82bd('0x11')](_0x2c5155)&&!_[_0x82bd('0x11')](_0x300982)&&!_[_0x82bd('0x11')](_0x300982[_0x82bd('0x12')])){return _[_0x82bd('0x13')](_0x300982[_0x82bd('0x12')],function(_0x390107){return _0x390107['id']==_0x2c5155;});}return null;};}exports[_0x82bd('0x14')]=function(_0x1c3779,_0x253741){return respondWithRpcPromise('VoiceChannels',_0x1c3779['query'])[_0x82bd('0x15')](respondWithResult(_0x253741,null))[_0x82bd('0x16')](handleError(_0x253741,null));};exports[_0x82bd('0x17')]=function(_0xc9fcdf,_0x34899b){return respondWithRpcPromise(_0x82bd('0x18'),_[_0x82bd('0x19')](_0xc9fcdf[_0x82bd('0x1a')],_0xc9fcdf[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x34899b,null))[_0x82bd('0x16')](handleError(_0x34899b,null));};exports[_0x82bd('0x1c')]=function(_0x1ca91f,_0x3260c4){return respondWithRpcPromise(_0x82bd('0x1d'),_[_0x82bd('0x19')](_0x1ca91f[_0x82bd('0x1a')],_0x1ca91f[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x3260c4,null))['catch'](handleError(_0x3260c4,null));};exports['voiceQueues']=function(_0x4248be,_0x436ecd){return respondWithRpcPromise(_0x82bd('0x1e'),_0x4248be[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x436ecd,null))[_0x82bd('0x16')](handleError(_0x436ecd,null));};exports[_0x82bd('0x1f')]=function(_0xbef23b,_0x2f0bb6){return respondWithRpcPromise(_0x82bd('0x1e'),_0xbef23b['query'])['then'](findById(_0xbef23b['params']['id']))['then'](respondWithResult(_0x2f0bb6,null))[_0x82bd('0x16')](handleError(_0x2f0bb6,null));};exports[_0x82bd('0x20')]=function(_0x351d3d,_0x190bca){return respondWithRpcPromise(_0x82bd('0x21'),_['merge'](_0x351d3d['body'],_0x351d3d['params']))[_0x82bd('0x15')](respondWithResult(_0x190bca,null))[_0x82bd('0x16')](handleError(_0x190bca,null));};exports[_0x82bd('0x22')]=function(_0x580ba8,_0x166c46){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x82bd('0x19')](_0x580ba8[_0x82bd('0x1a')],_0x580ba8[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x166c46,null))[_0x82bd('0x16')](handleError(_0x166c46,null));};exports[_0x82bd('0x23')]=function(_0x5ca7fc,_0x591b38){return respondWithRpcPromise(_0x82bd('0x24'),_0x5ca7fc[_0x82bd('0x1a')])['then'](respondWithResult(_0x591b38,null))[_0x82bd('0x16')](handleError(_0x591b38,null));};exports['voiceQueuesChannel']=function(_0x578e6e,_0x3b8015){return respondWithRpcPromise(_0x82bd('0x25'),_[_0x82bd('0x19')](_0x578e6e[_0x82bd('0x1a')],_0x578e6e[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x3b8015,null))[_0x82bd('0x16')](handleError(_0x3b8015,null));};exports[_0x82bd('0x26')]=function(_0x42dc7f,_0xefc6e4){return respondWithRpcPromise(_0x82bd('0x27'),_[_0x82bd('0x19')](_0x42dc7f[_0x82bd('0x1a')],_0x42dc7f[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0xefc6e4,null))[_0x82bd('0x16')](handleError(_0xefc6e4,null));};exports[_0x82bd('0x28')]=function(_0x4bdcae,_0x59b7ca){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x82bd('0x19')](_0x4bdcae[_0x82bd('0x1a')],_0x4bdcae['params']))[_0x82bd('0x15')](respondWithResult(_0x59b7ca,null))['catch'](handleError(_0x59b7ca,null));};exports['outbound']=function(_0x4c5f8d,_0x2b7675){return respondWithRpcPromise(_0x82bd('0x29'),_0x4c5f8d[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x2b7675,null))[_0x82bd('0x16')](handleError(_0x2b7675,null));};exports['outboundChannels']=function(_0x54e33f,_0x575c14){return respondWithRpcPromise(_0x82bd('0x2a'),_0x54e33f['query'])['then'](respondWithResult(_0x575c14,null))[_0x82bd('0x16')](handleError(_0x575c14,null));};exports[_0x82bd('0x2b')]=function(_0x3192e2,_0x2c5e7d){var _0x3ff054;return respondWithRpcPromise(_0x82bd('0x2c'),_0x3192e2[_0x82bd('0x1a')])[_0x82bd('0x15')](function(_0x18752a){_0x3ff054=_0x18752a;return respondWithRpcPromise('Agents',_0x3192e2['query'],routingClient);})[_0x82bd('0x15')](function(_0x689b3c){return _['merge']({},_0x689b3c,_0x3ff054);})['then'](respondWithResult(_0x2c5e7d,null))[_0x82bd('0x16')](handleError(_0x2c5e7d,null));};exports[_0x82bd('0x2d')]=function(_0x4d310b,_0x121f1f){if(_0x4d310b[_0x82bd('0x2e')]&&_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]&&_0x4d310b[_0x82bd('0x30')]&&_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')]){for(var _0x2c429d in _0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]){if(_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]['hasOwnProperty'](_0x2c429d)){db[_0x82bd('0x31')][_0x82bd('0x32')]({'where':{'channel':_0x2c429d,'membername':_0x4d310b['user']['name'],'type':_0x82bd('0x33'),'exitAt':null,'uniqueid':_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d]&&_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d]['length']?{'$notIn':_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d]}:{'$ne':null}}})[_0x82bd('0x15')](function(_0x4b2fb8){var _0x158957=moment()['format'](_0x82bd('0x34'));for(var _0x6d65c6=0x0,_0x587aec=_0x4b2fb8[_0x82bd('0x35')];_0x6d65c6<_0x587aec;_0x6d65c6+=0x1){_0x4b2fb8[_0x6d65c6][_0x82bd('0x36')]({'exitAt':_0x158957});}});for(var _0x54d12e=0x0;_0x54d12e<_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d]['length'];_0x54d12e+=0x1){db[_0x82bd('0x31')][_0x82bd('0x37')]({'where':{'channel':_0x2c429d,'membername':_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')],'type':'INTERACTION','uniqueid':_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d][_0x54d12e],'exitAt':null},'defaults':{'channel':_0x2c429d,'membername':_0x4d310b[_0x82bd('0x30')]['name'],'interface':_[_0x82bd('0x11')](_0x4d310b[_0x82bd('0x30')][_0x82bd('0x38')])?util['format'](_0x82bd('0x39'),_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')]):_0x4d310b[_0x82bd('0x30')][_0x82bd('0x38')],'type':_0x82bd('0x33'),'enterAt':moment()[_0x82bd('0x3a')](_0x82bd('0x34')),'role':_0x82bd('0x3b'),'internal':_0x4d310b[_0x82bd('0x30')][_0x82bd('0x3c')],'uniqueid':_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d][_0x54d12e]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x4d310b[_0x82bd('0x1b')]['id'],'capacity':_0x4d310b[_0x82bd('0x2e')]['capacity']},routingClient)[_0x82bd('0x15')](respondWithResult(_0x121f1f,null))[_0x82bd('0x16')](handleError(_0x121f1f,null));};exports[_0x82bd('0x3d')]=function(_0x4237ef,_0x55a2e6){return respondWithRpcPromise('Telephones',_0x4237ef[_0x82bd('0x1a')])['then'](respondWithResult(_0x55a2e6,null))['catch'](handleError(_0x55a2e6,null));};exports[_0x82bd('0x3e')]=function(_0x4c35dd,_0x523cbe){return respondWithRpcPromise(_0x82bd('0x3f'),_0x4c35dd[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x523cbe,null))[_0x82bd('0x16')](handleError(_0x523cbe,null));};exports[_0x82bd('0x40')]=function(_0x1a7402,_0x417c29){return respondWithRpcPromise(_0x82bd('0x41'),_0x1a7402[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x417c29,null))[_0x82bd('0x16')](handleError(_0x417c29,null));};exports[_0x82bd('0x42')]=function(_0x153fad,_0x1a1cdc){return respondWithRpcPromise(_0x82bd('0x43'),_0x153fad['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x1a1cdc,null))[_0x82bd('0x16')](handleError(_0x1a1cdc,null));};exports[_0x82bd('0x44')]=function(_0x354581,_0x9bf8fa){return respondWithRpcPromise('ChatQueues',_0x354581['query'],routingClient)['then'](findById(_0x354581['params']['id']))[_0x82bd('0x15')](respondWithResult(_0x9bf8fa,null))[_0x82bd('0x16')](handleError(_0x9bf8fa,null));};exports[_0x82bd('0x45')]=function(_0x127f8f,_0x568fc3){return respondWithRpcPromise('MailQueues',_0x127f8f[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x568fc3,null))[_0x82bd('0x16')](handleError(_0x568fc3,null));};exports['showMailQueues']=function(_0x2657bc,_0x2252ef){return respondWithRpcPromise(_0x82bd('0x46'),_0x2657bc[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x2657bc[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x2252ef,null))[_0x82bd('0x16')](handleError(_0x2252ef,null));};exports[_0x82bd('0x47')]=function(_0x20b636,_0x3ae44e){return respondWithRpcPromise(_0x82bd('0x48'),_0x20b636[_0x82bd('0x1a')],mailClient)[_0x82bd('0x15')](respondWithResult(_0x3ae44e,null))[_0x82bd('0x16')](handleError(_0x3ae44e,null));};exports[_0x82bd('0x49')]=function(_0x124ca4,_0x1fa71d){return respondWithRpcPromise('OpenchannelQueues',_0x124ca4[_0x82bd('0x1a')],routingClient)['then'](respondWithResult(_0x1fa71d,null))['catch'](handleError(_0x1fa71d,null));};exports[_0x82bd('0x4a')]=function(_0x4d2305,_0x306247){return respondWithRpcPromise(_0x82bd('0x4b'),_0x4d2305[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x4d2305[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x306247,null))[_0x82bd('0x16')](handleError(_0x306247,null));};exports[_0x82bd('0x4c')]=function(_0x40d6cf,_0x37ede1){return respondWithRpcPromise(_0x82bd('0x4d'),_0x40d6cf['query'],routingClient)['then'](respondWithResult(_0x37ede1,null))[_0x82bd('0x16')](handleError(_0x37ede1,null));};exports[_0x82bd('0x4e')]=function(_0x513e1d,_0x47d136){return respondWithRpcPromise(_0x82bd('0x4d'),_0x513e1d[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x513e1d[_0x82bd('0x1b')]['id']))['then'](respondWithResult(_0x47d136,null))[_0x82bd('0x16')](handleError(_0x47d136,null));};exports['whatsappQueues']=function(_0x1a16c1,_0x6ff77c){return respondWithRpcPromise('WhatsappQueues',_0x1a16c1[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x6ff77c,null))[_0x82bd('0x16')](handleError(_0x6ff77c,null));};exports[_0x82bd('0x4f')]=function(_0x5a5d66,_0x1b5b39){return respondWithRpcPromise(_0x82bd('0x50'),_0x5a5d66[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x5a5d66[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x1b5b39,null))[_0x82bd('0x16')](handleError(_0x1b5b39,null));};exports[_0x82bd('0x51')]=function(_0x1384b0,_0x544f10){return respondWithRpcPromise(_0x82bd('0x52'),_0x1384b0['query'],routingClient)['then'](respondWithResult(_0x544f10,null))[_0x82bd('0x16')](handleError(_0x544f10,null));};exports[_0x82bd('0x53')]=function(_0x529cb2,_0x2d2a7e){return respondWithRpcPromise('FaxQueues',_0x529cb2[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x529cb2['params']['id']))[_0x82bd('0x15')](respondWithResult(_0x2d2a7e,null))[_0x82bd('0x16')](handleError(_0x2d2a7e,null));};exports['faxAccounts']=function(_0x505032,_0x5bd3ae){return respondWithRpcPromise(_0x82bd('0x54'),_0x505032[_0x82bd('0x1a')])['then'](respondWithResult(_0x5bd3ae,null))[_0x82bd('0x16')](handleError(_0x5bd3ae,null));};exports[_0x82bd('0x55')]=function(_0x52b73f,_0x5591af){return respondWithRpcPromise(_0x82bd('0x56'),_0x52b73f['query'],routingClient)['then'](respondWithResult(_0x5591af,null))[_0x82bd('0x16')](handleError(_0x5591af,null));};exports[_0x82bd('0x57')]=function(_0x988094,_0x3d1f0d){return respondWithRpcPromise(_0x82bd('0x58'),_0x988094['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x3d1f0d,null))['catch'](handleError(_0x3d1f0d,null));};exports[_0x82bd('0x59')]=function(_0x5e25c3,_0x2fbf08){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5e25c3['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x2fbf08,null))[_0x82bd('0x16')](handleError(_0x2fbf08,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x282263,_0x15a849){return respondWithRpcPromise(_0x82bd('0x5a'),_0x282263['query'],routingClient)['then'](function(_0x197368){if(_0x282263[_0x82bd('0x1a')]['type']!==undefined){var _0x222f9d=_(_0x197368[_0x82bd('0x12')])['filter']([_0x282263[_0x82bd('0x1a')][_0x82bd('0x5b')],_0x282263[_0x82bd('0x1b')]['id']])[_0x82bd('0x5c')](_0x82bd('0x5d'))[_0x82bd('0x5e')]()['value']();return _0x197368[_0x82bd('0x12')][_0x82bd('0x5f')](function(_0x12bc87){return _0x222f9d['indexOf'](_0x12bc87[_0x82bd('0x5d')])>-0x1;});}else{return _0x197368['rows'][_0x82bd('0x5f')](function(_0x2d9bc0){return _0x2d9bc0[_0x82bd('0x5d')]===parseInt(_0x282263[_0x82bd('0x1b')]['id']);});}})[_0x82bd('0x15')](respondWithResult(_0x15a849,null))['catch'](handleError(_0x15a849,null));};exports[_0x82bd('0x60')]=function(_0x39b9d5,_0x54e547){return respondWithRpcPromise(_0x82bd('0x61'),_0x39b9d5[_0x82bd('0x1a')],routingClient)['then'](respondWithResult(_0x54e547,null))[_0x82bd('0x16')](handleError(_0x54e547,null));};exports[_0x82bd('0x62')]=function(_0x42d4c9,_0x55fe38){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x42d4c9[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x55fe38,null))[_0x82bd('0x16')](handleError(_0x55fe38,null));};exports['faxQueuesWaitingInteractions']=function(_0x465979,_0x4721c3){return respondWithRpcPromise(_0x82bd('0x63'),_0x465979['query'],routingClient)['then'](respondWithResult(_0x4721c3,null))['catch'](handleError(_0x4721c3,null));};exports['queueNotify']=function(_0x437463){return function(_0x45bbf7,_0x4b5bf4){var _0x35d111,_0x546106;var _0x1da93f=_['capitalize'](_0x437463);var _0x43d8a2=_0x437463===_0x82bd('0x64')?_0x82bd('0x65'):'Account';return db[_0x1da93f+_0x82bd('0x66')][_0x82bd('0x67')]({'raw':!![],'where':{'id':_0x45bbf7[_0x82bd('0x1b')]['id']}})[_0x82bd('0x15')](function(_0xbe937d){if(_['isNil'](_0xbe937d)){throw new Error(_0x1da93f+_0x82bd('0x68'));}_0x35d111=_0xbe937d;return db[_0x1da93f+_0x82bd('0x69')][_0x82bd('0x67')]({'where':{'id':_0x45bbf7['body']['messageId']},'include':[{'model':db[_0x1da93f+'Interaction'],'as':_0x82bd('0x6a')},{'model':db[_0x1da93f+_0x43d8a2],'as':_0x82bd('0x6b')}]});})[_0x82bd('0x15')](function(_0x1a7f98){if(_[_0x82bd('0x11')](_0x1a7f98)){throw new Error(_0x1da93f+'\x20Message\x20not\x20found');}_0x546106=_0x1a7f98;return _0x1a7f98['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5a8e7f={'uniqueid':_0x437463+'.'+_0x546106['id']+'.'+_0x546106[_0x82bd('0x6a')]['id'],'FromUserId':_0x45bbf7[_0x82bd('0x30')]['id'],'type':_0x82bd('0x6c')};_0x5a8e7f[_0x1da93f+_0x82bd('0x6d')]=_0x546106['id'];_0x5a8e7f[_0x1da93f+_0x82bd('0x6e')]=_0x546106[_0x82bd('0x6a')]['id'];_0x5a8e7f[_0x82bd('0x6f')+_0x1da93f+_0x43d8a2+'Id']=_0x546106['Account']['id'];_0x5a8e7f['To'+_0x1da93f+_0x82bd('0x70')]=_0x35d111['id'];return db[_0x1da93f+_0x82bd('0x71')][_0x82bd('0x72')](_0x5a8e7f);})[_0x82bd('0x15')](function(){return respondWithRpcPromise(_0x82bd('0x73'),{'channel':_0x437463,'interaction':_0x546106[_0x82bd('0x6a')],'message':_0x546106,'account':_0x546106[_0x82bd('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x82bd('0x6c'),'appdata':_0x35d111[_0x82bd('0xf')]+','+(_0x546106[_0x82bd('0x6b')][_0x82bd('0x74')]||0x12c),'interval':_0x82bd('0x75')}]},routingClient);})[_0x82bd('0x15')](respondWithResult(_0x4b5bf4,null))['catch'](handleError(_0x4b5bf4,null));};};exports[_0x82bd('0x76')]=function(_0x3d14c7,_0x57c71c){var _0x588d7f,_0x5ca4b5;if(_['isNil'](_0x3d14c7[_0x82bd('0x2e')][_0x82bd('0x77')])){throw new Error(_0x82bd('0x78'));}var _0x2eda47=_0x3d14c7[_0x82bd('0x2e')][_0x82bd('0x77')];var _0x17f2aa=_[_0x82bd('0x79')](_0x2eda47);var _0x534fee=_0x2eda47===_0x82bd('0x64')?'Website':_0x82bd('0x6b');return db[_0x82bd('0x7a')][_0x82bd('0x67')]({'raw':!![],'where':{'id':_0x3d14c7[_0x82bd('0x1b')]['id'],'role':'agent'}})[_0x82bd('0x15')](function(_0x2c92d8){if(_[_0x82bd('0x11')](_0x2c92d8)){throw new Error(_0x82bd('0x7b'));}_0x588d7f=_0x2c92d8;return db[_0x17f2aa+'Message'][_0x82bd('0x67')]({'where':{'id':_0x3d14c7[_0x82bd('0x2e')]['messageId']},'include':[{'model':db[_0x17f2aa+'Interaction'],'as':'Interaction'},{'model':db[_0x17f2aa+_0x534fee],'as':_0x82bd('0x6b')}]});})[_0x82bd('0x15')](function(_0x291587){if(_[_0x82bd('0x11')](_0x291587)){throw new Error(_0x17f2aa+_0x82bd('0x7c'));}_0x5ca4b5=_0x291587;return _0x291587[_0x82bd('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x82bd('0x15')](function(){var _0x8f45e2={'uniqueid':_0x2eda47+'.'+_0x5ca4b5['id']+'.'+_0x5ca4b5[_0x82bd('0x6a')]['id'],'FromUserId':_0x3d14c7[_0x82bd('0x30')]['id'],'type':_0x82bd('0x6c'),'ToUserId':_0x588d7f['id']};_0x8f45e2[_0x17f2aa+_0x82bd('0x6d')]=_0x5ca4b5['id'];_0x8f45e2[_0x17f2aa+_0x82bd('0x6e')]=_0x5ca4b5[_0x82bd('0x6a')]['id'];_0x8f45e2[_0x82bd('0x6f')+_0x17f2aa+_0x534fee+'Id']=_0x5ca4b5[_0x82bd('0x6b')]['id'];return db[_0x17f2aa+_0x82bd('0x71')][_0x82bd('0x72')](_0x8f45e2);})[_0x82bd('0x15')](function(){return respondWithRpcPromise(_0x82bd('0x73'),{'channel':_0x2eda47,'interaction':_0x5ca4b5[_0x82bd('0x6a')],'message':_0x5ca4b5,'account':_0x5ca4b5['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x588d7f[_0x82bd('0xf')]+','+(_0x5ca4b5[_0x82bd('0x6b')][_0x82bd('0x7e')]||0x12c),'interval':_0x82bd('0x75')}]},routingClient);})['then'](respondWithResult(_0x57c71c,null))['catch'](handleError(_0x57c71c,null));}; \ No newline at end of file +var _0x5fc3=['openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','\x20Message\x20not\x20found','Start','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','then','error','code','message','result','catch','status','json','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','format','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions'];(function(_0x204b0c,_0x212e5f){var _0x3832cb=function(_0x4e3558){while(--_0x4e3558){_0x204b0c['push'](_0x204b0c['shift']());}};_0x3832cb(++_0x212e5f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x5fc3[_0x8afdd0];return _0x3de7ac;};'use strict';var BPromise=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var _=require('lodash');var util=require(_0x35fc('0x2'));var db=require(_0x35fc('0x3'))['db'];var logger=require(_0x35fc('0x4'))(_0x35fc('0x5'));var jayson=require(_0x35fc('0x6'));var amiClient=jayson['client'][_0x35fc('0x7')]({'port':0x232a});var mailClient=jayson[_0x35fc('0x8')][_0x35fc('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){var _0x1e5f90=_0x16e153?_0x16e153:amiClient;return _0x1e5f90[_0x35fc('0x9')](_0x19a0d1,_0x508b32)[_0x35fc('0xa')](function(_0x2051ab){if(_0x2051ab['error']){if(_0x2051ab[_0x35fc('0xb')][_0x35fc('0xc')]===0x1f4){return _0xc72d93(_0x2051ab['error'][_0x35fc('0xd')]);}return _0x27524f(_0x2051ab[_0x35fc('0xb')]['message']);}else{_0x27524f(_0x2051ab[_0x35fc('0xe')]);}})[_0x35fc('0xf')](function(_0x5469f5){_0xc72d93(_0x5469f5);});});}function respondWithResult(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xc8;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x10')](_0x409357)[_0x35fc('0x11')](_0x5d462a);}return _0x4cbe74[_0x35fc('0x12')](0x194);};}function handleError(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0x1f4;return function(_0x5cfe94){logger['error'](_0x5cfe94['stack']);if(_0x5cfe94['name']){delete _0x5cfe94[_0x35fc('0x13')];}_0x29730f[_0x35fc('0x10')](_0x38d9f2)[_0x35fc('0x14')](_0x5cfe94);};}function findById(_0x154958){return function(_0x227a49){if(!_[_0x35fc('0x15')](_0x154958)&&!_['isNil'](_0x227a49)&&!_[_0x35fc('0x15')](_0x227a49[_0x35fc('0x16')])){return _['find'](_0x227a49[_0x35fc('0x16')],function(_0x363e47){return _0x363e47['id']==_0x154958;});}return null;};}exports[_0x35fc('0x17')]=function(_0x5f56c6,_0x1a86e9){return respondWithRpcPromise(_0x35fc('0x18'),_0x5f56c6[_0x35fc('0x19')])['then'](respondWithResult(_0x1a86e9,null))[_0x35fc('0xf')](handleError(_0x1a86e9,null));};exports[_0x35fc('0x1a')]=function(_0x3229d1,_0x251a1f){return respondWithRpcPromise(_0x35fc('0x1b'),_[_0x35fc('0x1c')](_0x3229d1[_0x35fc('0x19')],_0x3229d1[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x251a1f,null))[_0x35fc('0xf')](handleError(_0x251a1f,null));};exports['voiceChannelStopMixMonitor']=function(_0x323aee,_0xd5399f){return respondWithRpcPromise(_0x35fc('0x1e'),_[_0x35fc('0x1c')](_0x323aee[_0x35fc('0x19')],_0x323aee['params']))[_0x35fc('0xa')](respondWithResult(_0xd5399f,null))[_0x35fc('0xf')](handleError(_0xd5399f,null));};exports['voiceQueues']=function(_0x265324,_0x5a93df){return respondWithRpcPromise(_0x35fc('0x1f'),_0x265324['query'])[_0x35fc('0xa')](respondWithResult(_0x5a93df,null))['catch'](handleError(_0x5a93df,null));};exports[_0x35fc('0x20')]=function(_0xdfab9f,_0x5cb986){return respondWithRpcPromise('VoiceQueues',_0xdfab9f[_0x35fc('0x19')])['then'](findById(_0xdfab9f[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x5cb986,null))['catch'](handleError(_0x5cb986,null));};exports[_0x35fc('0x21')]=function(_0x645eac,_0x383837){return respondWithRpcPromise(_0x35fc('0x22'),_[_0x35fc('0x1c')](_0x645eac[_0x35fc('0x23')],_0x645eac[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x383837,null))['catch'](handleError(_0x383837,null));};exports[_0x35fc('0x24')]=function(_0x220931,_0x22af18){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x35fc('0x1c')](_0x220931[_0x35fc('0x19')],_0x220931[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x22af18,null))[_0x35fc('0xf')](handleError(_0x22af18,null));};exports[_0x35fc('0x25')]=function(_0x222ddb,_0x37b435){return respondWithRpcPromise(_0x35fc('0x26'),_0x222ddb[_0x35fc('0x19')])['then'](respondWithResult(_0x37b435,null))['catch'](handleError(_0x37b435,null));};exports[_0x35fc('0x27')]=function(_0x4af5fe,_0x37b394){return respondWithRpcPromise(_0x35fc('0x28'),_[_0x35fc('0x1c')](_0x4af5fe[_0x35fc('0x19')],_0x4af5fe[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x37b394,null))['catch'](handleError(_0x37b394,null));};exports[_0x35fc('0x29')]=function(_0x330a14,_0x46b9ef){return respondWithRpcPromise(_0x35fc('0x2a'),_[_0x35fc('0x1c')](_0x330a14[_0x35fc('0x19')],_0x330a14['params']))[_0x35fc('0xa')](respondWithResult(_0x46b9ef,null))[_0x35fc('0xf')](handleError(_0x46b9ef,null));};exports[_0x35fc('0x2b')]=function(_0x52f53d,_0x2c657d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x35fc('0x1c')](_0x52f53d[_0x35fc('0x19')],_0x52f53d[_0x35fc('0x1d')]))[_0x35fc('0xa')](respondWithResult(_0x2c657d,null))['catch'](handleError(_0x2c657d,null));};exports['outbound']=function(_0x59e4fb,_0x20f5fe){return respondWithRpcPromise('Outbound',_0x59e4fb[_0x35fc('0x19')])['then'](respondWithResult(_0x20f5fe,null))[_0x35fc('0xf')](handleError(_0x20f5fe,null));};exports[_0x35fc('0x2c')]=function(_0x2ca9ac,_0x22b724){return respondWithRpcPromise(_0x35fc('0x2d'),_0x2ca9ac[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x22b724,null))['catch'](handleError(_0x22b724,null));};exports[_0x35fc('0x2e')]=function(_0x16087d,_0x4e0ce3){var _0x1feda5;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d[_0x35fc('0x19')])[_0x35fc('0xa')](function(_0x813866){_0x1feda5=_0x813866;return respondWithRpcPromise(_0x35fc('0x2f'),_0x16087d['query'],routingClient);})[_0x35fc('0xa')](function(_0x267858){return _[_0x35fc('0x1c')]({},_0x267858,_0x1feda5);})['then'](respondWithResult(_0x4e0ce3,null))[_0x35fc('0xf')](handleError(_0x4e0ce3,null));};exports[_0x35fc('0x30')]=function(_0x596919,_0x237548){if(_0x596919[_0x35fc('0x23')]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]&&_0x596919[_0x35fc('0x32')]&&_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]){for(var _0x3ec51f in _0x596919['body']['interaction']){if(_0x596919[_0x35fc('0x23')][_0x35fc('0x31')]['hasOwnProperty'](_0x3ec51f)){db['MemberReport']['findAll']({'where':{'channel':_0x3ec51f,'membername':_0x596919[_0x35fc('0x32')][_0x35fc('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]&&_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length']?{'$notIn':_0x596919['body']['interaction'][_0x3ec51f]}:{'$ne':null}}})['then'](function(_0x56bdb9){var _0xb26e3f=moment()[_0x35fc('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x119925=0x0,_0x56cf1f=_0x56bdb9[_0x35fc('0x34')];_0x119925<_0x56cf1f;_0x119925+=0x1){_0x56bdb9[_0x119925][_0x35fc('0x35')]({'exitAt':_0xb26e3f});}});for(var _0x350237=0x0;_0x350237<_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f]['length'];_0x350237+=0x1){db[_0x35fc('0x36')][_0x35fc('0x37')]({'where':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'type':_0x35fc('0x38'),'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237],'exitAt':null},'defaults':{'channel':_0x3ec51f,'membername':_0x596919['user'][_0x35fc('0x13')],'interface':_['isNil'](_0x596919['user'][_0x35fc('0x39')])?util[_0x35fc('0x33')](_0x35fc('0x3a'),_0x596919[_0x35fc('0x32')][_0x35fc('0x13')]):_0x596919[_0x35fc('0x32')][_0x35fc('0x39')],'type':_0x35fc('0x38'),'enterAt':moment()['format'](_0x35fc('0x3b')),'role':_0x35fc('0x3c'),'internal':_0x596919[_0x35fc('0x32')][_0x35fc('0x3d')],'uniqueid':_0x596919[_0x35fc('0x23')][_0x35fc('0x31')][_0x3ec51f][_0x350237]}});}}}}return respondWithRpcPromise(_0x35fc('0x3e'),{'id':_0x596919[_0x35fc('0x1d')]['id'],'capacity':_0x596919[_0x35fc('0x23')][_0x35fc('0x3f')]},routingClient)[_0x35fc('0xa')](respondWithResult(_0x237548,null))[_0x35fc('0xf')](handleError(_0x237548,null));};exports[_0x35fc('0x40')]=function(_0x3146e2,_0x59c666){return respondWithRpcPromise('Telephones',_0x3146e2[_0x35fc('0x19')])[_0x35fc('0xa')](respondWithResult(_0x59c666,null))[_0x35fc('0xf')](handleError(_0x59c666,null));};exports[_0x35fc('0x41')]=function(_0x3ee296,_0x3e6494){return respondWithRpcPromise('Trunks',_0x3ee296['query'])[_0x35fc('0xa')](respondWithResult(_0x3e6494,null))[_0x35fc('0xf')](handleError(_0x3e6494,null));};exports[_0x35fc('0x42')]=function(_0x38bc78,_0x5b2595){return respondWithRpcPromise(_0x35fc('0x43'),_0x38bc78[_0x35fc('0x19')])['then'](respondWithResult(_0x5b2595,null))[_0x35fc('0xf')](handleError(_0x5b2595,null));};exports[_0x35fc('0x44')]=function(_0x590faa,_0x3e12e4){return respondWithRpcPromise(_0x35fc('0x45'),_0x590faa[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x3e12e4,null))['catch'](handleError(_0x3e12e4,null));};exports['showChatQueues']=function(_0x502a15,_0x240338){return respondWithRpcPromise(_0x35fc('0x45'),_0x502a15['query'],routingClient)[_0x35fc('0xa')](findById(_0x502a15[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x240338,null))[_0x35fc('0xf')](handleError(_0x240338,null));};exports[_0x35fc('0x46')]=function(_0x538be0,_0x2d9d45){return respondWithRpcPromise(_0x35fc('0x47'),_0x538be0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x2d9d45,null))[_0x35fc('0xf')](handleError(_0x2d9d45,null));};exports[_0x35fc('0x48')]=function(_0x47fb1a,_0x35a676){return respondWithRpcPromise(_0x35fc('0x47'),_0x47fb1a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x47fb1a[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x35a676,null))[_0x35fc('0xf')](handleError(_0x35a676,null));};exports[_0x35fc('0x49')]=function(_0x53a79d,_0x10a5b8){return respondWithRpcPromise(_0x35fc('0x4a'),_0x53a79d[_0x35fc('0x19')],mailClient)['then'](respondWithResult(_0x10a5b8,null))[_0x35fc('0xf')](handleError(_0x10a5b8,null));};exports['openchannelQueues']=function(_0x4ceacc,_0x5d4a39){return respondWithRpcPromise(_0x35fc('0x4b'),_0x4ceacc[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x5d4a39,null))[_0x35fc('0xf')](handleError(_0x5d4a39,null));};exports[_0x35fc('0x4c')]=function(_0x4bbea0,_0x579f5a){return respondWithRpcPromise('OpenchannelQueues',_0x4bbea0['query'],routingClient)['then'](findById(_0x4bbea0[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x579f5a,null))[_0x35fc('0xf')](handleError(_0x579f5a,null));};exports[_0x35fc('0x4d')]=function(_0x511e8b,_0x458eb8){return respondWithRpcPromise(_0x35fc('0x4e'),_0x511e8b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x458eb8,null))[_0x35fc('0xf')](handleError(_0x458eb8,null));};exports[_0x35fc('0x4f')]=function(_0x27071b,_0x2127e0){return respondWithRpcPromise(_0x35fc('0x4e'),_0x27071b['query'],routingClient)[_0x35fc('0xa')](findById(_0x27071b['params']['id']))[_0x35fc('0xa')](respondWithResult(_0x2127e0,null))[_0x35fc('0xf')](handleError(_0x2127e0,null));};exports[_0x35fc('0x50')]=function(_0x2bc76c,_0x4bdde7){return respondWithRpcPromise(_0x35fc('0x51'),_0x2bc76c['query'],routingClient)['then'](respondWithResult(_0x4bdde7,null))['catch'](handleError(_0x4bdde7,null));};exports[_0x35fc('0x52')]=function(_0x5dfeb7,_0x3c9027){return respondWithRpcPromise('WhatsappQueues',_0x5dfeb7[_0x35fc('0x19')],routingClient)['then'](findById(_0x5dfeb7[_0x35fc('0x1d')]['id']))[_0x35fc('0xa')](respondWithResult(_0x3c9027,null))[_0x35fc('0xf')](handleError(_0x3c9027,null));};exports[_0x35fc('0x53')]=function(_0x5c2ec0,_0x3d0ecc){return respondWithRpcPromise(_0x35fc('0x54'),_0x5c2ec0[_0x35fc('0x19')],routingClient)['then'](respondWithResult(_0x3d0ecc,null))[_0x35fc('0xf')](handleError(_0x3d0ecc,null));};exports[_0x35fc('0x55')]=function(_0x37764b,_0x3c1b56){return respondWithRpcPromise(_0x35fc('0x54'),_0x37764b[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](findById(_0x37764b[_0x35fc('0x1d')]['id']))['then'](respondWithResult(_0x3c1b56,null))[_0x35fc('0xf')](handleError(_0x3c1b56,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d){return respondWithRpcPromise(_0x35fc('0x57'),_0x2600d2[_0x35fc('0x19')])['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports[_0x35fc('0x58')]=function(_0x4835c2,_0x223ad3){return respondWithRpcPromise(_0x35fc('0x59'),_0x4835c2[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x223ad3,null))[_0x35fc('0xf')](handleError(_0x223ad3,null));};exports[_0x35fc('0x5a')]=function(_0x13f602,_0x104b1d){return respondWithRpcPromise(_0x35fc('0x5b'),_0x13f602[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x104b1d,null))[_0x35fc('0xf')](handleError(_0x104b1d,null));};exports[_0x35fc('0x5c')]=function(_0x9f034e,_0x184f28){return respondWithRpcPromise(_0x35fc('0x5d'),_0x9f034e[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x184f28,null))[_0x35fc('0xf')](handleError(_0x184f28,null));};exports[_0x35fc('0x5e')]=function(_0x4ba1b0,_0x1797d0){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4ba1b0[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](function(_0x2185ce){if(_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')]!==undefined){var _0x3f56f4=_(_0x2185ce[_0x35fc('0x16')])[_0x35fc('0x60')]([_0x4ba1b0[_0x35fc('0x19')][_0x35fc('0x5f')],_0x4ba1b0[_0x35fc('0x1d')]['id']])['map'](_0x35fc('0x61'))[_0x35fc('0x62')]()[_0x35fc('0x63')]();return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x41a6de){return _0x3f56f4['indexOf'](_0x41a6de[_0x35fc('0x61')])>-0x1;});}else{return _0x2185ce[_0x35fc('0x16')][_0x35fc('0x60')](function(_0x23206d){return _0x23206d[_0x35fc('0x61')]===parseInt(_0x4ba1b0[_0x35fc('0x1d')]['id']);});}})[_0x35fc('0xa')](respondWithResult(_0x1797d0,null))[_0x35fc('0xf')](handleError(_0x1797d0,null));};exports[_0x35fc('0x64')]=function(_0x5f23d8,_0x28f02b){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x5f23d8[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0x28f02b,null))['catch'](handleError(_0x28f02b,null));};exports[_0x35fc('0x65')]=function(_0x41002a,_0xcaa49){return respondWithRpcPromise(_0x35fc('0x66'),_0x41002a[_0x35fc('0x19')],routingClient)[_0x35fc('0xa')](respondWithResult(_0xcaa49,null))[_0x35fc('0xf')](handleError(_0xcaa49,null));};exports[_0x35fc('0x67')]=function(_0x25ee61,_0x5806bf){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x25ee61['query'],routingClient)['then'](respondWithResult(_0x5806bf,null))[_0x35fc('0xf')](handleError(_0x5806bf,null));};exports[_0x35fc('0x68')]=function(_0x8fc410){return function(_0x1f5cbc,_0x35ef53){var _0x4f535a,_0x226fdf;var _0x19682e=_[_0x35fc('0x69')](_0x8fc410);var _0x169ea2=_0x8fc410==='chat'?_0x35fc('0x6a'):_0x35fc('0x6b');return db[_0x19682e+_0x35fc('0x6c')]['findOne']({'raw':!![],'where':{'id':_0x1f5cbc[_0x35fc('0x1d')]['id']}})[_0x35fc('0xa')](function(_0x319033){if(_[_0x35fc('0x15')](_0x319033)){throw new Error(_0x19682e+_0x35fc('0x6d'));}_0x4f535a=_0x319033;return db[_0x19682e+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x1f5cbc[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x19682e+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x19682e+_0x169ea2],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x221c5b){if(_[_0x35fc('0x15')](_0x221c5b)){throw new Error(_0x19682e+'\x20Message\x20not\x20found');}_0x226fdf=_0x221c5b;return _0x221c5b[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4855ee={'uniqueid':_0x8fc410+'.'+_0x226fdf['id']+'.'+_0x226fdf[_0x35fc('0x70')]['id'],'FromUserId':_0x1f5cbc['user']['id'],'type':_0x35fc('0x72')};_0x4855ee[_0x19682e+_0x35fc('0x73')]=_0x226fdf['id'];_0x4855ee[_0x19682e+_0x35fc('0x74')]=_0x226fdf['Interaction']['id'];_0x4855ee[_0x35fc('0x75')+_0x19682e+_0x169ea2+'Id']=_0x226fdf[_0x35fc('0x6b')]['id'];_0x4855ee['To'+_0x19682e+_0x35fc('0x76')]=_0x4f535a['id'];return db[_0x19682e+_0x35fc('0x77')][_0x35fc('0x78')](_0x4855ee);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x8fc410,'interaction':_0x226fdf['Interaction'],'message':_0x226fdf,'account':_0x226fdf[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f535a[_0x35fc('0x13')]+','+(_0x226fdf[_0x35fc('0x6b')][_0x35fc('0x79')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})['then'](respondWithResult(_0x35ef53,null))[_0x35fc('0xf')](handleError(_0x35ef53,null));};};exports[_0x35fc('0x7b')]=function(_0x312827,_0x47c507){var _0x128286,_0x175cc7;if(_[_0x35fc('0x15')](_0x312827['body']['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x32b9e1=_0x312827[_0x35fc('0x23')][_0x35fc('0x7c')];var _0x3858a9=_['capitalize'](_0x32b9e1);var _0x3ead4e=_0x32b9e1===_0x35fc('0x7d')?'Website':'Account';return db[_0x35fc('0x7e')][_0x35fc('0x6f')]({'raw':!![],'where':{'id':_0x312827[_0x35fc('0x1d')]['id'],'role':'agent'}})['then'](function(_0x134e60){if(_[_0x35fc('0x15')](_0x134e60)){throw new Error('Agent\x20not\x20found');}_0x128286=_0x134e60;return db[_0x3858a9+_0x35fc('0x6e')][_0x35fc('0x6f')]({'where':{'id':_0x312827[_0x35fc('0x23')]['messageId']},'include':[{'model':db[_0x3858a9+_0x35fc('0x70')],'as':_0x35fc('0x70')},{'model':db[_0x3858a9+_0x3ead4e],'as':_0x35fc('0x6b')}]});})[_0x35fc('0xa')](function(_0x4fd676){if(_[_0x35fc('0x15')](_0x4fd676)){throw new Error(_0x3858a9+_0x35fc('0x7f'));}_0x175cc7=_0x4fd676;return _0x4fd676[_0x35fc('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x96dfc={'uniqueid':_0x32b9e1+'.'+_0x175cc7['id']+'.'+_0x175cc7[_0x35fc('0x70')]['id'],'FromUserId':_0x312827[_0x35fc('0x32')]['id'],'type':'queue','ToUserId':_0x128286['id']};_0x96dfc[_0x3858a9+_0x35fc('0x73')]=_0x175cc7['id'];_0x96dfc[_0x3858a9+_0x35fc('0x74')]=_0x175cc7['Interaction']['id'];_0x96dfc[_0x35fc('0x75')+_0x3858a9+_0x3ead4e+'Id']=_0x175cc7[_0x35fc('0x6b')]['id'];return db[_0x3858a9+_0x35fc('0x77')][_0x35fc('0x78')](_0x96dfc);})[_0x35fc('0xa')](function(){return respondWithRpcPromise(_0x35fc('0x80'),{'channel':_0x32b9e1,'interaction':_0x175cc7[_0x35fc('0x70')],'message':_0x175cc7,'account':_0x175cc7[_0x35fc('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x35fc('0x3c'),'appdata':_0x128286['name']+','+(_0x175cc7[_0x35fc('0x6b')][_0x35fc('0x81')]||0x12c),'interval':_0x35fc('0x7a')}]},routingClient);})[_0x35fc('0xa')](respondWithResult(_0x47c507,null))['catch'](handleError(_0x47c507,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8ef7963..254ac4f 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 _0x57cb=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x18ceda,_0xed46f7){var _0x51a52d=function(_0x16fd50){while(--_0x16fd50){_0x18ceda['push'](_0x18ceda['shift']());}};_0x51a52d(++_0xed46f7);}(_0x57cb,0x153));var _0xb57c=function(_0x2e579c,_0x4d1a2a){_0x2e579c=_0x2e579c-0x0;var _0x15869d=_0x57cb[_0x2e579c];return _0x15869d;};'use strict';var multer=require(_0xb57c('0x0'));var util=require(_0xb57c('0x1'));var path=require(_0xb57c('0x2'));var timeout=require(_0xb57c('0x3'));var express=require('express');var router=express[_0xb57c('0x4')]();var fs_extra=require(_0xb57c('0x5'));var auth=require(_0xb57c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb57c('0x7'));var controller=require(_0xb57c('0x8'));router[_0xb57c('0x9')]('/',auth['isAuthenticated'](),controller[_0xb57c('0xa')]);router[_0xb57c('0x9')](_0xb57c('0xb'),auth[_0xb57c('0xc')](),controller[_0xb57c('0xd')]);router[_0xb57c('0x9')]('/:id/run',auth[_0xb57c('0xc')](),controller['run']);router[_0xb57c('0xe')]('/',auth['isAuthenticated'](),controller[_0xb57c('0xf')]);router['put'](_0xb57c('0xb'),auth[_0xb57c('0xc')](),controller[_0xb57c('0x10')]);router[_0xb57c('0x11')]('/:id',auth[_0xb57c('0xc')](),controller[_0xb57c('0x12')]);module['exports']=router; \ No newline at end of file +var _0xad4d=['fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x52b504,_0x432c22){var _0xd8b964=function(_0x42432b){while(--_0x42432b){_0x52b504['push'](_0x52b504['shift']());}};_0xd8b964(++_0x432c22);}(_0xad4d,0x1b3));var _0xdad4=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xad4d[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0xdad4('0x0'));var util=require(_0xdad4('0x1'));var path=require(_0xdad4('0x2'));var timeout=require('connect-timeout');var express=require(_0xdad4('0x3'));var router=express[_0xdad4('0x4')]();var fs_extra=require(_0xdad4('0x5'));var auth=require(_0xdad4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdad4('0x7'));var controller=require(_0xdad4('0x8'));router[_0xdad4('0x9')]('/',auth[_0xdad4('0xa')](),controller[_0xdad4('0xb')]);router[_0xdad4('0x9')](_0xdad4('0xc'),auth['isAuthenticated'](),controller[_0xdad4('0xd')]);router[_0xdad4('0x9')](_0xdad4('0xe'),auth['isAuthenticated'](),controller[_0xdad4('0xf')]);router[_0xdad4('0x10')]('/',auth[_0xdad4('0xa')](),controller[_0xdad4('0x11')]);router[_0xdad4('0x12')]('/:id',auth[_0xdad4('0xa')](),controller[_0xdad4('0x13')]);router[_0xdad4('0x14')]('/:id',auth[_0xdad4('0xa')](),controller[_0xdad4('0x15')]);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 db5e437..33f7c0a 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 _0x151a=['minutes','pdf','xlsx','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x151a,0x104));var _0xa151=function(_0x56dc8c,_0x1b15ca){_0x56dc8c=_0x56dc8c-0x0;var _0x166838=_0x151a[_0x56dc8c];return _0x166838;};'use strict';var Sequelize=require('sequelize');module[_0xa151('0x0')]={'name':{'type':Sequelize[_0xa151('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa151('0x1')]},'active':{'type':Sequelize[_0xa151('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa151('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xa151('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa151('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa151('0x6')](_0xa151('0x7'),_0xa151('0x8'),_0xa151('0x9'),'weeks',_0xa151('0xa'),_0xa151('0xb'),_0xa151('0xc')),'allowNull':![],'defaultValue':_0xa151('0xa')},'output':{'type':Sequelize[_0xa151('0x6')]('csv',_0xa151('0xd'),_0xa151('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xa151('0x6')](_0xa151('0xf'),'default'),'allowNull':![],'defaultValue':_0xa151('0xf')},'sendMail':{'type':Sequelize[_0xa151('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa151('0x1')]},'cc':{'type':Sequelize[_0xa151('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0a0b=['quarters','days','hours','minutes','csv','pdf','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x7d768c,_0x1295d3){var _0x20720d=function(_0x281788){while(--_0x281788){_0x7d768c['push'](_0x7d768c['shift']());}};_0x20720d(++_0x1295d3);}(_0x0a0b,0x1cb));var _0xb0a0=function(_0x3321c1,_0x504db1){_0x3321c1=_0x3321c1-0x0;var _0x45f06b=_0x0a0b[_0x3321c1];return _0x45f06b;};'use strict';var Sequelize=require(_0xb0a0('0x0'));module[_0xb0a0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb0a0('0x2')]},'active':{'type':Sequelize[_0xb0a0('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb0a0('0x4')},'startAt':{'type':Sequelize[_0xb0a0('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb0a0('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb0a0('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb0a0('0x7')](_0xb0a0('0x8'),_0xb0a0('0x9'),'months','weeks',_0xb0a0('0xa'),_0xb0a0('0xb'),_0xb0a0('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xb0a0('0x7')](_0xb0a0('0xd'),_0xb0a0('0xe'),_0xb0a0('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xb0a0('0x7')](_0xb0a0('0x10'),'default'),'allowNull':![],'defaultValue':_0xb0a0('0x10')},'sendMail':{'type':Sequelize[_0xb0a0('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xb0a0('0x2')]},'cc':{'type':Sequelize[_0xb0a0('0x11')]},'bcc':{'type':Sequelize[_0xb0a0('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xb0a0('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 28ccef1..f1b7e09 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 _0xb303=['intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x5e66b0,_0x5bef62){var _0x9a3372=function(_0x587cba){while(--_0x587cba){_0x5e66b0['push'](_0x5e66b0['shift']());}};_0x9a3372(++_0x5bef62);}(_0xb303,0x124));var _0x3b30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb303[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b30('0x0'));var zipdir=require(_0x3b30('0x1'));var jsonpatch=require(_0x3b30('0x2'));var rp=require(_0x3b30('0x3'));var moment=require('moment');var BPromise=require(_0x3b30('0x4'));var Mustache=require(_0x3b30('0x5'));var util=require('util');var path=require(_0x3b30('0x6'));var sox=require('sox');var csv=require(_0x3b30('0x7'));var ejs=require(_0x3b30('0x8'));var fs=require('fs');var fs_extra=require(_0x3b30('0x9'));var _=require(_0x3b30('0xa'));var squel=require('squel');var crypto=require(_0x3b30('0xb'));var jsforce=require(_0x3b30('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3b30('0x7'));var querystring=require(_0x3b30('0xd'));var Papa=require(_0x3b30('0xe'));var Redis=require(_0x3b30('0xf'));var authService=require(_0x3b30('0x10'));var qs=require(_0x3b30('0x11'));var as=require(_0x3b30('0x12'));var hardwareService=require(_0x3b30('0x13'));var logger=require(_0x3b30('0x14'))(_0x3b30('0x15'));var utils=require(_0x3b30('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b30('0x17'));var db=require(_0x3b30('0x18'))['db'];function respondWithStatusCode(_0x16ed0a,_0x247e7e){_0x247e7e=_0x247e7e||0xcc;return function(_0x23c6a3){if(_0x23c6a3){return _0x16ed0a[_0x3b30('0x19')](_0x247e7e);}return _0x16ed0a['status'](_0x247e7e)[_0x3b30('0x1a')]();};}function respondWithResult(_0x2ba5cf,_0x29f996){_0x29f996=_0x29f996||0xc8;return function(_0x449c8d){if(_0x449c8d){return _0x2ba5cf[_0x3b30('0x1b')](_0x29f996)[_0x3b30('0x1c')](_0x449c8d);}};}function respondWithFilteredResult(_0x407c38,_0x2fd680){return function(_0x13bb82){if(_0x13bb82){var _0x56a457=typeof _0x2fd680[_0x3b30('0x1d')]===_0x3b30('0x1e')&&typeof _0x2fd680[_0x3b30('0x1f')]===_0x3b30('0x1e');var _0x503bc9=_0x13bb82[_0x3b30('0x20')];var _0x4c6c0b=_0x56a457?0x0:_0x2fd680[_0x3b30('0x1d')];var _0x3d11e0=_0x56a457?_0x13bb82['count']:_0x2fd680[_0x3b30('0x1d')]+_0x2fd680['limit'];var _0x1237a7;if(_0x3d11e0>=_0x503bc9){_0x3d11e0=_0x503bc9;_0x1237a7=0xc8;}else{_0x1237a7=0xce;}_0x407c38['status'](_0x1237a7);return _0x407c38[_0x3b30('0x21')](_0x3b30('0x22'),_0x4c6c0b+'-'+_0x3d11e0+'/'+_0x503bc9)[_0x3b30('0x1c')](_0x13bb82);}return null;};}function patchUpdates(_0x4ee486){return function(_0x2cc47a){try{jsonpatch[_0x3b30('0x23')](_0x2cc47a,_0x4ee486,!![]);}catch(_0x3cf600){return BPromise[_0x3b30('0x24')](_0x3cf600);}return _0x2cc47a['save']();};}function saveUpdates(_0x4aede9,_0x551bd3){return function(_0x2a3051){if(_0x2a3051){return _0x2a3051[_0x3b30('0x25')](_0x4aede9)[_0x3b30('0x26')](function(_0x329e){return _0x329e;});}return null;};}function removeEntity(_0x1413f4,_0x40835b){return function(_0x4b4602){if(_0x4b4602){return _0x4b4602[_0x3b30('0x27')]()['then'](function(){var _0x3a9d9d=_0x4b4602['get']({'plain':!![]});var _0x469b03=_0x3b30('0x28');return db[_0x3b30('0x29')][_0x3b30('0x27')]({'where':{'type':_0x469b03,'resourceId':_0x3a9d9d['id']}})['then'](function(){return _0x4b4602;});})[_0x3b30('0x26')](function(){_0x1413f4[_0x3b30('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f55f6,_0x1f4911){return function(_0x4214c2){if(!_0x4214c2){_0x5f55f6[_0x3b30('0x19')](0x194);}return _0x4214c2;};}function handleError(_0x513079,_0x1dba24){_0x1dba24=_0x1dba24||0x1f4;return function(_0x391265){logger[_0x3b30('0x2a')](_0x391265[_0x3b30('0x2b')]);if(_0x391265[_0x3b30('0x2c')]){delete _0x391265[_0x3b30('0x2c')];}_0x513079[_0x3b30('0x1b')](_0x1dba24)[_0x3b30('0x2d')](_0x391265);};}exports[_0x3b30('0x2e')]=function(_0x28e614,_0x436613){var _0x36e8f2={},_0x56b75a={},_0xa08ecd={'count':0x0,'rows':[]};var _0x123a76=_[_0x3b30('0x2f')](db[_0x3b30('0x30')][_0x3b30('0x31')],function(_0x511d29){return{'name':_0x511d29[_0x3b30('0x32')],'type':_0x511d29['type'][_0x3b30('0x33')]};});_0x56b75a[_0x3b30('0x34')]=_[_0x3b30('0x2f')](_0x123a76,'name');_0x56b75a[_0x3b30('0x35')]=_[_0x3b30('0x36')](_0x28e614['query']);_0x56b75a[_0x3b30('0x37')]=_[_0x3b30('0x38')](_0x56b75a['model'],_0x56b75a['query']);_0x36e8f2[_0x3b30('0x39')]=_['intersection'](_0x56b75a[_0x3b30('0x34')],qs[_0x3b30('0x3a')](_0x28e614['query'][_0x3b30('0x3a')]));_0x36e8f2[_0x3b30('0x39')]=_0x36e8f2['attributes'][_0x3b30('0x3b')]?_0x36e8f2[_0x3b30('0x39')]:_0x56b75a[_0x3b30('0x34')];if(!_0x28e614['query'][_0x3b30('0x3c')]('nolimit')){_0x36e8f2[_0x3b30('0x1f')]=qs[_0x3b30('0x1f')](_0x28e614['query'][_0x3b30('0x1f')]);_0x36e8f2['offset']=qs[_0x3b30('0x1d')](_0x28e614['query']['offset']);}_0x36e8f2['order']=qs['sort'](_0x28e614[_0x3b30('0x35')][_0x3b30('0x3d')]);_0x36e8f2['where']=qs[_0x3b30('0x37')](_[_0x3b30('0x3e')](_0x28e614[_0x3b30('0x35')],_0x56b75a[_0x3b30('0x37')]),_0x123a76);if(_0x28e614['query'][_0x3b30('0x3f')]){_0x36e8f2[_0x3b30('0x40')]=_[_0x3b30('0x41')](_0x36e8f2[_0x3b30('0x40')],{'$or':_['map'](_0x123a76,function(_0x583d89){if(_0x583d89[_0x3b30('0x42')]!==_0x3b30('0x43')){var _0x52afdf={};_0x52afdf[_0x583d89[_0x3b30('0x2c')]]={'$like':'%'+_0x28e614['query'][_0x3b30('0x3f')]+'%'};return _0x52afdf;}})});}_0x36e8f2=_['merge']({},_0x36e8f2,_0x28e614[_0x3b30('0x44')]);var _0x1dac24={'where':_0x36e8f2[_0x3b30('0x40')]};return db[_0x3b30('0x30')][_0x3b30('0x20')](_0x1dac24)[_0x3b30('0x26')](function(_0x42ddb4){_0xa08ecd[_0x3b30('0x20')]=_0x42ddb4;if(_0x28e614[_0x3b30('0x35')]['includeAll']){_0x36e8f2['include']=[{'all':!![]}];}return db[_0x3b30('0x30')][_0x3b30('0x45')](_0x36e8f2);})[_0x3b30('0x26')](function(_0x420888){_0xa08ecd[_0x3b30('0x46')]=_0x420888;return _0xa08ecd;})['then'](respondWithFilteredResult(_0x436613,_0x36e8f2))[_0x3b30('0x47')](handleError(_0x436613,null));};exports[_0x3b30('0x48')]=function(_0x585608,_0x4069cf){var _0x2150ef={'raw':![],'where':{'id':_0x585608[_0x3b30('0x49')]['id']}},_0x49b15b={};_0x49b15b[_0x3b30('0x34')]=_['keys'](db[_0x3b30('0x30')][_0x3b30('0x31')]);_0x49b15b[_0x3b30('0x35')]=_[_0x3b30('0x36')](_0x585608[_0x3b30('0x35')]);_0x49b15b[_0x3b30('0x37')]=_[_0x3b30('0x38')](_0x49b15b[_0x3b30('0x34')],_0x49b15b[_0x3b30('0x35')]);_0x2150ef[_0x3b30('0x39')]=_[_0x3b30('0x38')](_0x49b15b[_0x3b30('0x34')],qs['fields'](_0x585608[_0x3b30('0x35')][_0x3b30('0x3a')]));_0x2150ef[_0x3b30('0x39')]=_0x2150ef[_0x3b30('0x39')][_0x3b30('0x3b')]?_0x2150ef['attributes']:_0x49b15b[_0x3b30('0x34')];if(_0x585608['query'][_0x3b30('0x4a')]){_0x2150ef['include']=[{'all':!![]}];}_0x2150ef=_[_0x3b30('0x41')]({},_0x2150ef,_0x585608[_0x3b30('0x44')]);return db[_0x3b30('0x30')][_0x3b30('0x4b')](_0x2150ef)['then'](handleEntityNotFound(_0x4069cf,null))[_0x3b30('0x26')](respondWithResult(_0x4069cf,null))[_0x3b30('0x47')](handleError(_0x4069cf,null));};exports['create']=function(_0x21665d,_0x1197ff){return db[_0x3b30('0x30')]['create'](_0x21665d[_0x3b30('0x4c')],{})[_0x3b30('0x26')](function(_0x3d22e9){var _0x37de4a=_0x21665d[_0x3b30('0x4d')][_0x3b30('0x4e')]({'plain':!![]});if(!_0x37de4a)throw new Error(_0x3b30('0x4f'));if(_0x37de4a['role']===_0x3b30('0x4d')){var _0x1c763d=_0x3d22e9[_0x3b30('0x4e')]({'plain':!![]});var _0x48b675=_0x3b30('0x28');return db[_0x3b30('0x50')][_0x3b30('0x4b')]({'where':{'name':_0x48b675,'userProfileId':_0x37de4a[_0x3b30('0x51')]},'raw':!![]})[_0x3b30('0x26')](function(_0x4b65e5){if(_0x4b65e5&&_0x4b65e5[_0x3b30('0x52')]===0x0){return db[_0x3b30('0x29')][_0x3b30('0x53')]({'name':_0x1c763d[_0x3b30('0x2c')],'resourceId':_0x1c763d['id'],'type':_0x4b65e5[_0x3b30('0x2c')],'sectionId':_0x4b65e5['id']},{})['then'](function(){return _0x3d22e9;});}else{return _0x3d22e9;}})['catch'](function(_0x1e7870){logger[_0x3b30('0x2a')](_0x3b30('0x54'),_0x1e7870);throw _0x1e7870;});}return _0x3d22e9;})['then'](respondWithResult(_0x1197ff,0xc9))[_0x3b30('0x47')](handleError(_0x1197ff,null));};exports[_0x3b30('0x25')]=function(_0x1b877e,_0xf4784c){if(_0x1b877e[_0x3b30('0x4c')]['id']){delete _0x1b877e[_0x3b30('0x4c')]['id'];}return db['Schedule']['find']({'where':{'id':_0x1b877e['params']['id']}})[_0x3b30('0x26')](handleEntityNotFound(_0xf4784c,null))[_0x3b30('0x26')](saveUpdates(_0x1b877e[_0x3b30('0x4c')],null))[_0x3b30('0x26')](respondWithResult(_0xf4784c,null))[_0x3b30('0x47')](handleError(_0xf4784c,null));};exports[_0x3b30('0x27')]=function(_0x2f7119,_0x45581c){return db[_0x3b30('0x30')][_0x3b30('0x4b')]({'where':{'id':_0x2f7119[_0x3b30('0x49')]['id']}})[_0x3b30('0x26')](handleEntityNotFound(_0x45581c,null))['then'](removeEntity(_0x45581c,null))['catch'](handleError(_0x45581c,null));};exports['run']=function(_0x1f91e5,_0x246904,_0x3988b8){var _0x271fb2=require(_0x3b30('0x55'));return db[_0x3b30('0x30')][_0x3b30('0x4b')]({'where':{'id':_0x1f91e5[_0x3b30('0x49')]['id']},'raw':!![]})[_0x3b30('0x26')](handleEntityNotFound(_0x246904,null))[_0x3b30('0x26')](function(){_0x271fb2[_0x3b30('0x56')](_0x1f91e5['params']['id']);})[_0x3b30('0x26')](respondWithStatusCode(_0x246904,null))[_0x3b30('0x47')](handleError(_0x246904,null));}; \ No newline at end of file +var _0x327b=['query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','includeAll','include','findAll','rows','catch','params','merge','options','find','create','body','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','zip-dir','fast-json-patch','request-promise','path','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','map','Schedule','rawAttributes','fieldName','type','model'];(function(_0x14873a,_0x4fec94){var _0x34b709=function(_0x3e2487){while(--_0x3e2487){_0x14873a['push'](_0x14873a['shift']());}};_0x34b709(++_0x4fec94);}(_0x327b,0x1bc));var _0xb327=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x327b[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb327('0x0'));var jsonpatch=require(_0xb327('0x1'));var rp=require(_0xb327('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb327('0x3'));var sox=require('sox');var csv=require(_0xb327('0x4'));var ejs=require(_0xb327('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb327('0x6'));var squel=require('squel');var crypto=require(_0xb327('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xb327('0x8'));var toCsv=require(_0xb327('0x4'));var querystring=require(_0xb327('0x9'));var Papa=require('papaparse');var Redis=require(_0xb327('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xb327('0xb'));var as=require(_0xb327('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb327('0xd'))('api');var utils=require(_0xb327('0xe'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb327('0xf'))['db'];function respondWithStatusCode(_0x5d19dc,_0x1e440d){_0x1e440d=_0x1e440d||0xcc;return function(_0x316443){if(_0x316443){return _0x5d19dc['sendStatus'](_0x1e440d);}return _0x5d19dc[_0xb327('0x10')](_0x1e440d)[_0xb327('0x11')]();};}function respondWithResult(_0x2fc09f,_0x106ab3){_0x106ab3=_0x106ab3||0xc8;return function(_0x6947d8){if(_0x6947d8){return _0x2fc09f[_0xb327('0x10')](_0x106ab3)[_0xb327('0x12')](_0x6947d8);}};}function respondWithFilteredResult(_0x27a1c9,_0x491408){return function(_0x1d4bdd){if(_0x1d4bdd){var _0x796a88=typeof _0x491408[_0xb327('0x13')]===_0xb327('0x14')&&typeof _0x491408[_0xb327('0x15')]==='undefined';var _0x1125b9=_0x1d4bdd[_0xb327('0x16')];var _0x39e07f=_0x796a88?0x0:_0x491408['offset'];var _0xc9b87f=_0x796a88?_0x1d4bdd[_0xb327('0x16')]:_0x491408[_0xb327('0x13')]+_0x491408[_0xb327('0x15')];var _0x3a6be1;if(_0xc9b87f>=_0x1125b9){_0xc9b87f=_0x1125b9;_0x3a6be1=0xc8;}else{_0x3a6be1=0xce;}_0x27a1c9[_0xb327('0x10')](_0x3a6be1);return _0x27a1c9['set'](_0xb327('0x17'),_0x39e07f+'-'+_0xc9b87f+'/'+_0x1125b9)[_0xb327('0x12')](_0x1d4bdd);}return null;};}function patchUpdates(_0x4f7968){return function(_0x3a6fdb){try{jsonpatch['apply'](_0x3a6fdb,_0x4f7968,!![]);}catch(_0x4df56b){return BPromise['reject'](_0x4df56b);}return _0x3a6fdb[_0xb327('0x18')]();};}function saveUpdates(_0x3a7499,_0x276eec){return function(_0x3cd805){if(_0x3cd805){return _0x3cd805['update'](_0x3a7499)[_0xb327('0x19')](function(_0x5f203b){return _0x5f203b;});}return null;};}function removeEntity(_0xe84b71,_0x10338a){return function(_0x17c85f){if(_0x17c85f){return _0x17c85f[_0xb327('0x1a')]()[_0xb327('0x19')](function(){var _0x3d142a=_0x17c85f[_0xb327('0x1b')]({'plain':!![]});var _0x5e3184=_0xb327('0x1c');return db[_0xb327('0x1d')][_0xb327('0x1a')]({'where':{'type':_0x5e3184,'resourceId':_0x3d142a['id']}})[_0xb327('0x19')](function(){return _0x17c85f;});})[_0xb327('0x19')](function(){_0xe84b71[_0xb327('0x10')](0xcc)[_0xb327('0x11')]();});}};}function handleEntityNotFound(_0x263e3b,_0x3e7c93){return function(_0x154b67){if(!_0x154b67){_0x263e3b['sendStatus'](0x194);}return _0x154b67;};}function handleError(_0x8d72c,_0x14d26){_0x14d26=_0x14d26||0x1f4;return function(_0x7a74ed){logger['error'](_0x7a74ed[_0xb327('0x1e')]);if(_0x7a74ed['name']){delete _0x7a74ed[_0xb327('0x1f')];}_0x8d72c['status'](_0x14d26)[_0xb327('0x20')](_0x7a74ed);};}exports['index']=function(_0x350280,_0x586532){var _0x4b273a={},_0x20ab96={},_0x26cc05={'count':0x0,'rows':[]};var _0x4851e4=_[_0xb327('0x21')](db[_0xb327('0x22')][_0xb327('0x23')],function(_0x4616a7){return{'name':_0x4616a7[_0xb327('0x24')],'type':_0x4616a7[_0xb327('0x25')]['key']};});_0x20ab96[_0xb327('0x26')]=_[_0xb327('0x21')](_0x4851e4,_0xb327('0x1f'));_0x20ab96[_0xb327('0x27')]=_[_0xb327('0x28')](_0x350280[_0xb327('0x27')]);_0x20ab96['filters']=_['intersection'](_0x20ab96[_0xb327('0x26')],_0x20ab96['query']);_0x4b273a['attributes']=_[_0xb327('0x29')](_0x20ab96['model'],qs['fields'](_0x350280[_0xb327('0x27')][_0xb327('0x2a')]));_0x4b273a[_0xb327('0x2b')]=_0x4b273a['attributes'][_0xb327('0x2c')]?_0x4b273a[_0xb327('0x2b')]:_0x20ab96[_0xb327('0x26')];if(!_0x350280[_0xb327('0x27')][_0xb327('0x2d')](_0xb327('0x2e'))){_0x4b273a[_0xb327('0x15')]=qs[_0xb327('0x15')](_0x350280[_0xb327('0x27')][_0xb327('0x15')]);_0x4b273a[_0xb327('0x13')]=qs['offset'](_0x350280[_0xb327('0x27')][_0xb327('0x13')]);}_0x4b273a[_0xb327('0x2f')]=qs['sort'](_0x350280[_0xb327('0x27')][_0xb327('0x30')]);_0x4b273a[_0xb327('0x31')]=qs[_0xb327('0x32')](_[_0xb327('0x33')](_0x350280[_0xb327('0x27')],_0x20ab96[_0xb327('0x32')]),_0x4851e4);if(_0x350280[_0xb327('0x27')]['filter']){_0x4b273a[_0xb327('0x31')]=_['merge'](_0x4b273a[_0xb327('0x31')],{'$or':_[_0xb327('0x21')](_0x4851e4,function(_0x39d453){if(_0x39d453[_0xb327('0x25')]!==_0xb327('0x34')){var _0x395afe={};_0x395afe[_0x39d453[_0xb327('0x1f')]]={'$like':'%'+_0x350280[_0xb327('0x27')]['filter']+'%'};return _0x395afe;}})});}_0x4b273a=_['merge']({},_0x4b273a,_0x350280['options']);var _0x227c07={'where':_0x4b273a[_0xb327('0x31')]};return db[_0xb327('0x22')][_0xb327('0x16')](_0x227c07)['then'](function(_0x30af37){_0x26cc05[_0xb327('0x16')]=_0x30af37;if(_0x350280['query'][_0xb327('0x35')]){_0x4b273a[_0xb327('0x36')]=[{'all':!![]}];}return db[_0xb327('0x22')][_0xb327('0x37')](_0x4b273a);})[_0xb327('0x19')](function(_0x5baf70){_0x26cc05[_0xb327('0x38')]=_0x5baf70;return _0x26cc05;})['then'](respondWithFilteredResult(_0x586532,_0x4b273a))[_0xb327('0x39')](handleError(_0x586532,null));};exports['show']=function(_0x5347c7,_0x10703a){var _0x35222c={'raw':![],'where':{'id':_0x5347c7[_0xb327('0x3a')]['id']}},_0x3b4893={};_0x3b4893['model']=_['keys'](db[_0xb327('0x22')][_0xb327('0x23')]);_0x3b4893[_0xb327('0x27')]=_[_0xb327('0x28')](_0x5347c7[_0xb327('0x27')]);_0x3b4893[_0xb327('0x32')]=_[_0xb327('0x29')](_0x3b4893[_0xb327('0x26')],_0x3b4893[_0xb327('0x27')]);_0x35222c[_0xb327('0x2b')]=_[_0xb327('0x29')](_0x3b4893[_0xb327('0x26')],qs['fields'](_0x5347c7[_0xb327('0x27')][_0xb327('0x2a')]));_0x35222c[_0xb327('0x2b')]=_0x35222c[_0xb327('0x2b')]['length']?_0x35222c[_0xb327('0x2b')]:_0x3b4893[_0xb327('0x26')];if(_0x5347c7[_0xb327('0x27')][_0xb327('0x35')]){_0x35222c[_0xb327('0x36')]=[{'all':!![]}];}_0x35222c=_[_0xb327('0x3b')]({},_0x35222c,_0x5347c7[_0xb327('0x3c')]);return db['Schedule'][_0xb327('0x3d')](_0x35222c)['then'](handleEntityNotFound(_0x10703a,null))[_0xb327('0x19')](respondWithResult(_0x10703a,null))['catch'](handleError(_0x10703a,null));};exports[_0xb327('0x3e')]=function(_0xcf918e,_0x2538bd){return db[_0xb327('0x22')]['create'](_0xcf918e[_0xb327('0x3f')],{})['then'](function(_0x2761cc){var _0x52af06=_0xcf918e['user']['get']({'plain':!![]});if(!_0x52af06)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52af06['role']==='user'){var _0x235850=_0x2761cc[_0xb327('0x1b')]({'plain':!![]});var _0x408c17=_0xb327('0x1c');return db[_0xb327('0x40')][_0xb327('0x3d')]({'where':{'name':_0x408c17,'userProfileId':_0x52af06[_0xb327('0x41')]},'raw':!![]})[_0xb327('0x19')](function(_0x192806){if(_0x192806&&_0x192806['autoAssociation']===0x0){return db[_0xb327('0x1d')][_0xb327('0x3e')]({'name':_0x235850[_0xb327('0x1f')],'resourceId':_0x235850['id'],'type':_0x192806[_0xb327('0x1f')],'sectionId':_0x192806['id']},{})['then'](function(){return _0x2761cc;});}else{return _0x2761cc;}})[_0xb327('0x39')](function(_0x570bdf){logger['error'](_0xb327('0x42'),_0x570bdf);throw _0x570bdf;});}return _0x2761cc;})[_0xb327('0x19')](respondWithResult(_0x2538bd,0xc9))[_0xb327('0x39')](handleError(_0x2538bd,null));};exports['update']=function(_0x17cb7a,_0xf28897){if(_0x17cb7a[_0xb327('0x3f')]['id']){delete _0x17cb7a[_0xb327('0x3f')]['id'];}return db['Schedule'][_0xb327('0x3d')]({'where':{'id':_0x17cb7a[_0xb327('0x3a')]['id']}})['then'](handleEntityNotFound(_0xf28897,null))[_0xb327('0x19')](saveUpdates(_0x17cb7a[_0xb327('0x3f')],null))[_0xb327('0x19')](respondWithResult(_0xf28897,null))[_0xb327('0x39')](handleError(_0xf28897,null));};exports[_0xb327('0x1a')]=function(_0xda5803,_0x5a9f9e){return db['Schedule'][_0xb327('0x3d')]({'where':{'id':_0xda5803[_0xb327('0x3a')]['id']}})[_0xb327('0x19')](handleEntityNotFound(_0x5a9f9e,null))[_0xb327('0x19')](removeEntity(_0x5a9f9e,null))[_0xb327('0x39')](handleError(_0x5a9f9e,null));};exports['run']=function(_0x29ef66,_0x11da00,_0x8d7375){var _0x33e803=require(_0xb327('0x43'));return db['Schedule']['find']({'where':{'id':_0x29ef66['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x11da00,null))[_0xb327('0x19')](function(){_0x33e803[_0xb327('0x44')](_0x29ef66[_0xb327('0x3a')]['id']);})[_0xb327('0x19')](respondWithStatusCode(_0x11da00,null))[_0xb327('0x39')](handleError(_0x11da00,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3896349..234f201 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 _0xc472=['Schedule','tools_schedules','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x35cbfb,_0x25da46){var _0x112450=function(_0x45a5ad){while(--_0x45a5ad){_0x35cbfb['push'](_0x35cbfb['shift']());}};_0x112450(++_0x25da46);}(_0xc472,0x161));var _0x2c47=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0xc472[_0x5c2e5e];return _0x46a5da;};'use strict';var _=require(_0x2c47('0x0'));var util=require('util');var logger=require(_0x2c47('0x1'))(_0x2c47('0x2'));var moment=require(_0x2c47('0x3'));var BPromise=require(_0x2c47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c47('0x5'));var rimraf=require(_0x2c47('0x6'));var config=require(_0x2c47('0x7'));var attributes=require(_0x2c47('0x8'));module[_0x2c47('0x9')]=function(_0x40c80e,_0x47cc35){return _0x40c80e[_0x2c47('0xa')](_0x2c47('0xb'),attributes,{'tableName':_0x2c47('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fd6=['../../config/environment','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3d1ce2,_0x28b894){var _0x41ca30=function(_0xe82b75){while(--_0xe82b75){_0x3d1ce2['push'](_0x3d1ce2['shift']());}};_0x41ca30(++_0x28b894);}(_0x1fd6,0x1e8));var _0x61fd=function(_0x5e6573,_0x22d690){_0x5e6573=_0x5e6573-0x0;var _0x864fdb=_0x1fd6[_0x5e6573];return _0x864fdb;};'use strict';var _=require(_0x61fd('0x0'));var util=require(_0x61fd('0x1'));var logger=require(_0x61fd('0x2'))('api');var moment=require(_0x61fd('0x3'));var BPromise=require(_0x61fd('0x4'));var rp=require(_0x61fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61fd('0x6'));var config=require(_0x61fd('0x7'));var attributes=require(_0x61fd('0x8'));module[_0x61fd('0x9')]=function(_0x1331c,_0x5e3a9b){return _0x1331c['define'](_0x61fd('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 7ec5d8a..71e2468 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 _0xa381=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x566ef6,_0x3dad0f){var _0x3e162e=function(_0x37c1b8){while(--_0x37c1b8){_0x566ef6['push'](_0x566ef6['shift']());}};_0x3e162e(++_0x3dad0f);}(_0xa381,0x6b));var _0x1a38=function(_0x1cfbe5,_0x2fd9bf){_0x1cfbe5=_0x1cfbe5-0x0;var _0x48afaf=_0xa381[_0x1cfbe5];return _0x48afaf;};'use strict';var _=require(_0x1a38('0x0'));var util=require(_0x1a38('0x1'));var moment=require('moment');var BPromise=require(_0x1a38('0x2'));var rs=require(_0x1a38('0x3'));var fs=require('fs');var Redis=require(_0x1a38('0x4'));var db=require(_0x1a38('0x5'))['db'];var utils=require(_0x1a38('0x6'));var logger=require(_0x1a38('0x7'))('rpc');var config=require(_0x1a38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1a38('0x9')][_0x1a38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x247cd5,_0x3ac5eb,_0x468284){return new BPromise(function(_0x1c922e,_0x13fea8){return client[_0x1a38('0xb')](_0x247cd5,_0x468284)['then'](function(_0x3adfe8){logger[_0x1a38('0xc')](_0x1a38('0xd'),_0x3ac5eb,'request\x20sent');logger[_0x1a38('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3ac5eb,_0x1a38('0xf'),JSON[_0x1a38('0x10')](_0x3adfe8));if(_0x3adfe8[_0x1a38('0x11')]){if(_0x3adfe8['error']['code']===0x1f4){logger[_0x1a38('0x11')](_0x1a38('0xd'),_0x3ac5eb,_0x3adfe8[_0x1a38('0x11')][_0x1a38('0x12')]);return _0x13fea8(_0x3adfe8[_0x1a38('0x11')][_0x1a38('0x12')]);}logger[_0x1a38('0x11')](_0x1a38('0xd'),_0x3ac5eb,_0x3adfe8[_0x1a38('0x11')][_0x1a38('0x12')]);return _0x1c922e(_0x3adfe8[_0x1a38('0x11')][_0x1a38('0x12')]);}else{logger[_0x1a38('0xc')](_0x1a38('0xd'),_0x3ac5eb,_0x1a38('0xf'));_0x1c922e(_0x3adfe8[_0x1a38('0x13')][_0x1a38('0x12')]);}})[_0x1a38('0x14')](function(_0x184acc){logger[_0x1a38('0x11')](_0x1a38('0xd'),_0x3ac5eb,_0x184acc);_0x13fea8(_0x184acc);});});} \ No newline at end of file +var _0xd391=['debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent'];(function(_0x141749,_0x477b04){var _0x3e6932=function(_0x47b3f2){while(--_0x47b3f2){_0x141749['push'](_0x141749['shift']());}};_0x3e6932(++_0x477b04);}(_0xd391,0x81));var _0x1d39=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xd391[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x1d39('0x0'));var util=require('util');var moment=require(_0x1d39('0x1'));var BPromise=require(_0x1d39('0x2'));var rs=require(_0x1d39('0x3'));var fs=require('fs');var Redis=require(_0x1d39('0x4'));var db=require(_0x1d39('0x5'))['db'];var utils=require(_0x1d39('0x6'));var logger=require(_0x1d39('0x7'))(_0x1d39('0x8'));var config=require(_0x1d39('0x9'));var jayson=require(_0x1d39('0xa'));var client=jayson[_0x1d39('0xb')][_0x1d39('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40b09c,_0x3cc9b2,_0x2ce3eb){return new BPromise(function(_0xffab72,_0x28334f){return client['request'](_0x40b09c,_0x2ce3eb)['then'](function(_0x34d3e0){logger[_0x1d39('0xd')]('Schedule,\x20%s,\x20%s',_0x3cc9b2,_0x1d39('0xe'));logger[_0x1d39('0xf')](_0x1d39('0x10'),_0x3cc9b2,_0x1d39('0xe'),JSON[_0x1d39('0x11')](_0x34d3e0));if(_0x34d3e0['error']){if(_0x34d3e0[_0x1d39('0x12')][_0x1d39('0x13')]===0x1f4){logger[_0x1d39('0x12')]('Schedule,\x20%s,\x20%s',_0x3cc9b2,_0x34d3e0[_0x1d39('0x12')]['message']);return _0x28334f(_0x34d3e0['error'][_0x1d39('0x14')]);}logger['error'](_0x1d39('0x15'),_0x3cc9b2,_0x34d3e0[_0x1d39('0x12')][_0x1d39('0x14')]);return _0xffab72(_0x34d3e0[_0x1d39('0x12')][_0x1d39('0x14')]);}else{logger[_0x1d39('0xd')](_0x1d39('0x15'),_0x3cc9b2,_0x1d39('0xe'));_0xffab72(_0x34d3e0[_0x1d39('0x16')]['message']);}})[_0x1d39('0x17')](function(_0xe60971){logger['error']('Schedule,\x20%s,\x20%s',_0x3cc9b2,_0xe60971);_0x28334f(_0xe60971);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 588c8c6..a38c4fa 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 _0x90b2=['../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','multer','express','Router','fs-extra'];(function(_0x133e04,_0x4fb791){var _0x43c15d=function(_0x2be667){while(--_0x2be667){_0x133e04['push'](_0x133e04['shift']());}};_0x43c15d(++_0x4fb791);}(_0x90b2,0x14c));var _0x290b=function(_0x13e88b,_0xc3c62e){_0x13e88b=_0x13e88b-0x0;var _0x2b6f1e=_0x90b2[_0x13e88b];return _0x2b6f1e;};'use strict';var multer=require(_0x290b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x290b('0x1'));var router=express[_0x290b('0x2')]();var fs_extra=require(_0x290b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x290b('0x4'));var controller=require(_0x290b('0x5'));router[_0x290b('0x6')]('/',auth[_0x290b('0x7')](),controller[_0x290b('0x8')]);router[_0x290b('0x6')]('/describe',auth[_0x290b('0x7')](),controller[_0x290b('0x9')]);router[_0x290b('0x6')](_0x290b('0xa'),auth['isAuthenticated'](),controller[_0x290b('0xb')]);router[_0x290b('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x290b('0xc')]('/',auth[_0x290b('0x7')](),controller[_0x290b('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x290b('0xe')]);router[_0x290b('0xf')]('/:id',auth[_0x290b('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x395c=['exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','index','get','isAuthenticated','describe','/:id','show','/:id/download','download','put','delete','destroy'];(function(_0x3188ad,_0x52b55b){var _0x555bd5=function(_0x5df148){while(--_0x5df148){_0x3188ad['push'](_0x3188ad['shift']());}};_0x555bd5(++_0x52b55b);}(_0x395c,0xbf));var _0xc395=function(_0x465506,_0x1aff48){_0x465506=_0x465506-0x0;var _0x6c5e95=_0x395c[_0x465506];return _0x6c5e95;};'use strict';var multer=require(_0xc395('0x0'));var util=require(_0xc395('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc395('0x2'));var router=express[_0xc395('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc395('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc395('0x5'));var controller=require(_0xc395('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc395('0x7')]);router[_0xc395('0x8')]('/describe',auth[_0xc395('0x9')](),controller[_0xc395('0xa')]);router[_0xc395('0x8')](_0xc395('0xb'),auth[_0xc395('0x9')](),controller[_0xc395('0xc')]);router[_0xc395('0x8')](_0xc395('0xd'),auth[_0xc395('0x9')](),controller[_0xc395('0xe')]);router['post']('/',auth[_0xc395('0x9')](),controller['create']);router[_0xc395('0xf')]('/:id',auth[_0xc395('0x9')](),controller['update']);router[_0xc395('0x10')](_0xc395('0xb'),auth[_0xc395('0x9')](),controller[_0xc395('0x11')]);module[_0xc395('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7501c06..36af3c0 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 _0x27fb=['path','exports','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment'];(function(_0x187de9,_0x599384){var _0x5df625=function(_0x56a904){while(--_0x56a904){_0x187de9['push'](_0x187de9['shift']());}};_0x5df625(++_0x599384);}(_0x27fb,0x1de));var _0xb27f=function(_0x318d42,_0x519dc8){_0x318d42=_0x318d42-0x0;var _0x4b48c0=_0x27fb[_0x318d42];return _0x4b48c0;};'use strict';var Sequelize=require(_0xb27f('0x0'));var moment=require(_0xb27f('0x1'));var path=require(_0xb27f('0x2'));var config=require('../../config/environment');module[_0xb27f('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb27f('0x4')](_0xb27f('0x5'))?path[_0xb27f('0x6')](this['getDataValue'](_0xb27f('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb27f('0x7')]},'value':{'type':Sequelize[_0xb27f('0x7')],'set':function(_0x3cc341){var _0x1b7bd9=_0x3cc341[_0xb27f('0x8')](/\\/g,'/');this['setDataValue'](_0xb27f('0x5'),_0x1b7bd9);}},'rating':{'type':Sequelize[_0xb27f('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x338393){this[_0xb27f('0xa')](_0xb27f('0xb'),moment()[_0xb27f('0xc')](_0x338393,'ms'));this['setDataValue'](_0xb27f('0xd'),moment());this[_0xb27f('0xa')]('duration',_0x338393);}},'startedAt':{'type':Sequelize[_0xb27f('0xe')],'get':function(){return moment(this[_0xb27f('0x4')]('startedAt'))[_0xb27f('0xf')](_0xb27f('0x10'))[_0xb27f('0x11')]();}},'closedAt':{'type':Sequelize[_0xb27f('0xe')],'get':function(){return moment(this[_0xb27f('0x4')](_0xb27f('0xd')))['format'](_0xb27f('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0xb27f('0xe')],'get':function(){return moment(this['getDataValue'](_0xb27f('0x12')))[_0xb27f('0xf')](_0xb27f('0x10'))[_0xb27f('0x11')]();}},'updatedAt':{'type':Sequelize[_0xb27f('0xe')],'get':function(){return moment(this['getDataValue'](_0xb27f('0x13')))[_0xb27f('0xf')](_0xb27f('0x10'))[_0xb27f('0x11')]();}}}; \ No newline at end of file +var _0xe785=['VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','sequelize','moment','../../config/environment','exports'];(function(_0x22a13d,_0x4d686a){var _0x20b290=function(_0x100af2){while(--_0x100af2){_0x22a13d['push'](_0x22a13d['shift']());}};_0x20b290(++_0x4d686a);}(_0xe785,0x128));var _0x5e78=function(_0x4aab3b,_0x356fcc){_0x4aab3b=_0x4aab3b-0x0;var _0xe7304f=_0xe785[_0x4aab3b];return _0xe7304f;};'use strict';var Sequelize=require(_0x5e78('0x0'));var moment=require(_0x5e78('0x1'));var path=require('path');var config=require(_0x5e78('0x2'));module[_0x5e78('0x3')]={'format':{'type':Sequelize[_0x5e78('0x4')],'get':function(){return this[_0x5e78('0x5')]('value')?path['extname'](this[_0x5e78('0x5')](_0x5e78('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x5e78('0x7')]},'channel':{'type':Sequelize[_0x5e78('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x525cfa){var _0x1d32e7=_0x525cfa[_0x5e78('0x8')](/\\/g,'/');this[_0x5e78('0x9')]('value',_0x1d32e7);}},'rating':{'type':Sequelize[_0x5e78('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5de5e){this['setDataValue'](_0x5e78('0xb'),moment()[_0x5e78('0xc')](_0x5de5e,'ms'));this['setDataValue'](_0x5e78('0xd'),moment());this[_0x5e78('0x9')](_0x5e78('0xe'),_0x5de5e);}},'startedAt':{'type':Sequelize[_0x5e78('0xf')],'get':function(){return moment(this[_0x5e78('0x5')](_0x5e78('0xb')))[_0x5e78('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x5e78('0x11')]();}},'closedAt':{'type':Sequelize[_0x5e78('0xf')],'get':function(){return moment(this[_0x5e78('0x5')]('closedAt'))[_0x5e78('0x10')](_0x5e78('0x12'))[_0x5e78('0x11')]();}},'createdAt':{'type':Sequelize[_0x5e78('0xf')],'get':function(){return moment(this['getDataValue'](_0x5e78('0x13')))[_0x5e78('0x10')](_0x5e78('0x12'))[_0x5e78('0x11')]();}},'updatedAt':{'type':Sequelize[_0x5e78('0xf')],'get':function(){return moment(this[_0x5e78('0x5')]('updatedAt'))['format'](_0x5e78('0x12'))[_0x5e78('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c3efc76..51ec8df 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 _0x1cb9=['ValidationError','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','keys','length','include','options','find','create','body','duration','createdAt','value','params','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize'];(function(_0x5ac81b,_0x5b2f34){var _0x286915=function(_0x24b01e){while(--_0x24b01e){_0x5ac81b['push'](_0x5ac81b['shift']());}};_0x286915(++_0x5b2f34);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5c2311,_0x24ae77){_0x5c2311=_0x5c2311-0x0;var _0x2f0ab2=_0x1cb9[_0x5c2311];return _0x2f0ab2;};'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(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x33')](_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29')),[_0x91cb('0x34')]);_0x504275[_0x91cb('0x35')]=_['keys'](_0x3b3ee6[_0x91cb('0x35')]);_0x504275[_0x91cb('0x36')]=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x35')]);_0x468908['attributes']=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x38')]));_0x468908['attributes']=_0x468908[_0x91cb('0x39')]['length']?_0x468908['attributes']:_0x504275['model'];if(!_0x3b3ee6[_0x91cb('0x35')]['hasOwnProperty'](_0x91cb('0x3a'))){_0x468908['limit']=qs['limit'](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x1d')]);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x35')]['offset']);}_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3c')]);_0x468908['where']=qs['filters'](_[_0x91cb('0x3d')](_0x3b3ee6[_0x91cb('0x35')],_0x504275['filters']),_0x52670a);if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]){_0x468908['where']=_[_0x91cb('0x3f')](_0x468908[_0x91cb('0x40')],{'$or':_['map'](_0x52670a,function(_0x43d4fe){if(_0x43d4fe['type']!==_0x91cb('0x41')){var _0xabe6a3={};_0xabe6a3[_0x43d4fe[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]+'%'};return _0xabe6a3;}})});}_0x468908=_[_0x91cb('0x3f')]({},_0x468908,_0x3b3ee6['options']);var _0xa90111={'where':_0x468908[_0x91cb('0x40')]};return db['ScreenRecording'][_0x91cb('0x1e')](_0xa90111)['then'](function(_0x2c6102){_0x2f04a3[_0x91cb('0x1e')]=_0x2c6102;if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x42')]){_0x468908['include']=[{'all':!![]}];}return db[_0x91cb('0x2d')][_0x91cb('0x43')](_0x468908);})[_0x91cb('0x25')](function(_0x37e777){_0x2f04a3[_0x91cb('0x44')]=_0x37e777;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x45')](handleError(_0x2fb473,null));};exports[_0x91cb('0x46')]=function(_0x325dca,_0x3cc4c1){var _0x49bc42={'raw':![],'where':{'id':_0x325dca['params']['id']}},_0x16993f={};_0x16993f[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x16993f[_0x91cb('0x35')]=_[_0x91cb('0x47')](_0x325dca[_0x91cb('0x35')]);_0x16993f[_0x91cb('0x36')]=_['intersection'](_0x16993f[_0x91cb('0x32')],_0x16993f[_0x91cb('0x35')]);_0x49bc42['attributes']=_[_0x91cb('0x37')](_0x16993f[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x325dca[_0x91cb('0x35')][_0x91cb('0x38')]));_0x49bc42[_0x91cb('0x39')]=_0x49bc42[_0x91cb('0x39')][_0x91cb('0x48')]?_0x49bc42[_0x91cb('0x39')]:_0x16993f['model'];if(_0x325dca[_0x91cb('0x35')][_0x91cb('0x42')]){_0x49bc42[_0x91cb('0x49')]=[{'all':!![]}];}_0x49bc42=_[_0x91cb('0x3f')]({},_0x49bc42,_0x325dca[_0x91cb('0x4a')]);return db[_0x91cb('0x2d')][_0x91cb('0x4b')](_0x49bc42)[_0x91cb('0x25')](handleEntityNotFound(_0x3cc4c1,null))['then'](respondWithResult(_0x3cc4c1,null))[_0x91cb('0x45')](handleError(_0x3cc4c1,null));};exports[_0x91cb('0x4c')]=function(_0x2b8b7f,_0x3b8cfd){return db['ScreenRecording'][_0x91cb('0x4c')](_0x2b8b7f[_0x91cb('0x4d')],{})['then'](respondWithResult(_0x3b8cfd,0xc9))[_0x91cb('0x45')](handleError(_0x3b8cfd,null));};exports['update']=function(_0x2c419b,_0x4c0acd){if(_0x2c419b['body']['id']){delete _0x2c419b['body']['id'];}delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4e')];delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4f')];delete _0x2c419b[_0x91cb('0x4d')]['closedAt'];delete _0x2c419b['body'][_0x91cb('0x50')];return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x2c419b[_0x91cb('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c0acd,null))['then'](saveUpdates(_0x2c419b['body'],null))[_0x91cb('0x25')](respondWithResult(_0x4c0acd,null))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x52')]=function(_0x4aa670,_0x21463a){return db[_0x91cb('0x2d')][_0x91cb('0x52')]()[_0x91cb('0x25')](respondWithResult(_0x21463a,null))[_0x91cb('0x45')](handleError(_0x21463a,null));};exports[_0x91cb('0x53')]=function(_0x3ec250,_0x30fd4e,_0xff7c3f){var _0x20fc0a=require(_0x91cb('0x54'));var _0x5752ed=![];var _0x1e445a={};if(_0x3ec250[_0x91cb('0x35')]['type']&&_0x3ec250[_0x91cb('0x35')][_0x91cb('0x30')]==='uniqueid'){_0x1e445a[_0x91cb('0x55')]=_0x3ec250[_0x91cb('0x51')]['id'];}else{_0x1e445a['id']=_0x3ec250[_0x91cb('0x51')]['id'];}return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':_0x1e445a,'attributes':['id',_0x91cb('0x50')],'raw':!![]})[_0x91cb('0x25')](handleEntityNotFound(_0x30fd4e,null))[_0x91cb('0x25')](function(_0x3320bd){if(_0x3320bd){var _0x93ef52=path[_0x91cb('0x56')](config['root'],_0x91cb('0x57'),_0x3320bd['value']);var _0x37221e=util['format'](_0x91cb('0x58'),_0x93ef52);if(fs[_0x91cb('0x59')](_0x37221e)){_0x5752ed=!![];return _0x20fc0a[_0x91cb('0x5a')](_0x37221e,_0x93ef52,config['secrets'][_0x91cb('0x5b')])[_0x91cb('0x25')](function(){return _0x3320bd;});}return _0x3320bd;}})['then'](function(_0xef4754){if(_0xef4754){var _0x102025=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],'server/files/screen_recordings',_0xef4754[_0x91cb('0x50')]);if(!fs[_0x91cb('0x59')](_0x102025)){throw new db[(_0x91cb('0x5d'))][(_0x91cb('0x5e'))]('ScreenRecording\x20not\x20found');}if(_0xef4754[_0x91cb('0x5f')]){return _0x30fd4e[_0x91cb('0x53')](_0x102025,_0xef4754['filename']+path['extname'](_0x102025),function(){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}else{return _0x30fd4e['download'](_0x102025,function(_0x1180ac){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}}})['catch'](function(_0x4f19c8){if(_0x4f19c8[_0x91cb('0x61')]==='ScreenRecording\x20not\x20found'){_0x30fd4e[_0x91cb('0x1a')](0x194)[_0x91cb('0x2a')](_0x91cb('0x62'));}else{return handleError(_0x30fd4e,null);}});};exports['destroy']=function(_0x22fea8,_0x524400){return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x22fea8[_0x91cb('0x51')]['id']}})[_0x91cb('0x25')](function(_0x483172){if(_[_0x91cb('0x63')](_0x483172)){throw new ReferenceError(_0x91cb('0x64'));}return _0x483172;})[_0x91cb('0x25')](function(_0x443c72){var _0xaf70c5=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],_0x91cb('0x57'),_0x443c72[_0x91cb('0x50')]);logger[_0x91cb('0x65')](_0x91cb('0x66'),_0xaf70c5);if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger[_0x91cb('0x65')](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}_0xaf70c5=_0xaf70c5+_0x91cb('0x6a');if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger['info'](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}return _0x443c72;})[_0x91cb('0x25')](function(_0x48fcfe){if(!_0x48fcfe)throw new InternalError();return _0x48fcfe[_0x91cb('0x26')]();})[_0x91cb('0x25')](function(){_0x524400[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();})[_0x91cb('0x45')](handleError(_0x524400,null));}; \ No newline at end of file +var _0xac31=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','then','includeAll','findAll','rows','catch','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher'];(function(_0x5055f1,_0x3cbb87){var _0x28a9f0=function(_0x31433d){while(--_0x31433d){_0x5055f1['push'](_0x5055f1['shift']());}};_0x28a9f0(++_0x3cbb87);}(_0xac31,0xca));var _0x1ac3=function(_0x3ca058,_0x339ad7){_0x3ca058=_0x3ca058-0x0;var _0x5a1963=_0xac31[_0x3ca058];return _0x5a1963;};'use strict';var emlformat=require(_0x1ac3('0x0'));var rimraf=require(_0x1ac3('0x1'));var zipdir=require(_0x1ac3('0x2'));var jsonpatch=require(_0x1ac3('0x3'));var rp=require(_0x1ac3('0x4'));var moment=require(_0x1ac3('0x5'));var BPromise=require(_0x1ac3('0x6'));var Mustache=require('mustache');var util=require(_0x1ac3('0x7'));var path=require(_0x1ac3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ac3('0x9'));var fs=require('fs');var fs_extra=require(_0x1ac3('0xa'));var _=require(_0x1ac3('0xb'));var squel=require(_0x1ac3('0xc'));var crypto=require(_0x1ac3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1ac3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ac3('0xf'));var Papa=require(_0x1ac3('0x10'));var Redis=require(_0x1ac3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ac3('0x12'));var as=require(_0x1ac3('0x13'));var hardwareService=require(_0x1ac3('0x14'));var logger=require(_0x1ac3('0x15'))(_0x1ac3('0x16'));var utils=require(_0x1ac3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac3('0x18'));var db=require(_0x1ac3('0x19'))['db'];function respondWithStatusCode(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xcc;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0x1a')](_0x2338b9);}return _0x2eeabf[_0x1ac3('0x1b')](_0x2338b9)[_0x1ac3('0x1c')]();};}function respondWithResult(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0xc8;return function(_0x24bb5e){if(_0x24bb5e){return _0x2def9f[_0x1ac3('0x1b')](_0x53cc35)['json'](_0x24bb5e);}};}function respondWithFilteredResult(_0x29a7b3,_0x1f9641){return function(_0x38b52a){if(_0x38b52a){var _0x51f1e4=typeof _0x1f9641[_0x1ac3('0x1d')]===_0x1ac3('0x1e')&&typeof _0x1f9641[_0x1ac3('0x1f')]==='undefined';var _0x195683=_0x38b52a['count'];var _0x291616=_0x51f1e4?0x0:_0x1f9641[_0x1ac3('0x1d')];var _0x20091d=_0x51f1e4?_0x38b52a[_0x1ac3('0x20')]:_0x1f9641[_0x1ac3('0x1d')]+_0x1f9641['limit'];var _0x136e73;if(_0x20091d>=_0x195683){_0x20091d=_0x195683;_0x136e73=0xc8;}else{_0x136e73=0xce;}_0x29a7b3[_0x1ac3('0x1b')](_0x136e73);return _0x29a7b3[_0x1ac3('0x21')](_0x1ac3('0x22'),_0x291616+'-'+_0x20091d+'/'+_0x195683)['json'](_0x38b52a);}return null;};}function patchUpdates(_0x48d18a){return function(_0x2879d8){try{jsonpatch[_0x1ac3('0x23')](_0x2879d8,_0x48d18a,!![]);}catch(_0x14070b){return BPromise[_0x1ac3('0x24')](_0x14070b);}return _0x2879d8[_0x1ac3('0x25')]();};}function saveUpdates(_0x319988,_0x23b767){return function(_0x10912a){if(_0x10912a){return _0x10912a[_0x1ac3('0x26')](_0x319988)['then'](function(_0x1e277f){return _0x1e277f;});}return null;};}function removeEntity(_0x231b7f,_0x4b19f2){return function(_0x2b5182){if(_0x2b5182){return _0x2b5182[_0x1ac3('0x27')]()['then'](function(){_0x231b7f[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();});}};}function handleEntityNotFound(_0x145486,_0x2dfdb7){return function(_0x10db3d){if(!_0x10db3d){_0x145486['sendStatus'](0x194);}return _0x10db3d;};}function handleError(_0x5a2ab2,_0x503a64){_0x503a64=_0x503a64||0x1f4;return function(_0x528807){logger['error'](_0x528807[_0x1ac3('0x28')]);if(_0x528807['name']){delete _0x528807[_0x1ac3('0x29')];}_0x5a2ab2[_0x1ac3('0x1b')](_0x503a64)[_0x1ac3('0x2a')](_0x528807);};}exports[_0x1ac3('0x2b')]=function(_0x4b3d3c,_0x61441d){var _0x541da0={},_0x2ddd73={},_0x4000b0={'count':0x0,'rows':[]};var _0x440aed=_[_0x1ac3('0x2c')](db[_0x1ac3('0x2d')][_0x1ac3('0x2e')],function(_0x9c17c2){return{'name':_0x9c17c2['fieldName'],'type':_0x9c17c2[_0x1ac3('0x2f')][_0x1ac3('0x30')]};});_0x2ddd73[_0x1ac3('0x31')]=_[_0x1ac3('0x32')](_['map'](_0x440aed,_0x1ac3('0x29')),[_0x1ac3('0x33')]);_0x2ddd73[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4b3d3c[_0x1ac3('0x34')]);_0x2ddd73['filters']=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],_0x2ddd73[_0x1ac3('0x34')]);_0x541da0[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],qs['fields'](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x541da0[_0x1ac3('0x37')]=_0x541da0[_0x1ac3('0x37')]['length']?_0x541da0[_0x1ac3('0x37')]:_0x2ddd73[_0x1ac3('0x31')];if(!_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x39')](_0x1ac3('0x3a'))){_0x541da0[_0x1ac3('0x1f')]=qs[_0x1ac3('0x1f')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x1f')]);_0x541da0['offset']=qs[_0x1ac3('0x1d')](_0x4b3d3c[_0x1ac3('0x34')]['offset']);}_0x541da0[_0x1ac3('0x3b')]=qs[_0x1ac3('0x3c')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x3c')]);_0x541da0[_0x1ac3('0x3d')]=qs[_0x1ac3('0x3e')](_[_0x1ac3('0x3f')](_0x4b3d3c[_0x1ac3('0x34')],_0x2ddd73['filters']),_0x440aed);if(_0x4b3d3c[_0x1ac3('0x34')]['filter']){_0x541da0[_0x1ac3('0x3d')]=_[_0x1ac3('0x40')](_0x541da0[_0x1ac3('0x3d')],{'$or':_[_0x1ac3('0x2c')](_0x440aed,function(_0x3141ae){if(_0x3141ae[_0x1ac3('0x2f')]!=='VIRTUAL'){var _0x3b5c1c={};_0x3b5c1c[_0x3141ae[_0x1ac3('0x29')]]={'$like':'%'+_0x4b3d3c[_0x1ac3('0x34')]['filter']+'%'};return _0x3b5c1c;}})});}_0x541da0=_[_0x1ac3('0x40')]({},_0x541da0,_0x4b3d3c[_0x1ac3('0x41')]);var _0x5cec6b={'where':_0x541da0[_0x1ac3('0x3d')]};return db[_0x1ac3('0x2d')][_0x1ac3('0x20')](_0x5cec6b)[_0x1ac3('0x42')](function(_0x466a45){_0x4000b0[_0x1ac3('0x20')]=_0x466a45;if(_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x541da0['include']=[{'all':!![]}];}return db[_0x1ac3('0x2d')][_0x1ac3('0x44')](_0x541da0);})[_0x1ac3('0x42')](function(_0x254a77){_0x4000b0[_0x1ac3('0x45')]=_0x254a77;return _0x4000b0;})[_0x1ac3('0x42')](respondWithFilteredResult(_0x61441d,_0x541da0))[_0x1ac3('0x46')](handleError(_0x61441d,null));};exports['show']=function(_0x4edc4d,_0x2c2099){var _0x3f60ca={'raw':![],'where':{'id':_0x4edc4d[_0x1ac3('0x47')]['id']}},_0x4972d1={};_0x4972d1[_0x1ac3('0x31')]=_['keys'](db[_0x1ac3('0x2d')]['rawAttributes']);_0x4972d1[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4edc4d[_0x1ac3('0x34')]);_0x4972d1[_0x1ac3('0x3e')]=_['intersection'](_0x4972d1[_0x1ac3('0x31')],_0x4972d1[_0x1ac3('0x34')]);_0x3f60ca[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x4972d1[_0x1ac3('0x31')],qs['fields'](_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x3f60ca[_0x1ac3('0x37')]=_0x3f60ca[_0x1ac3('0x37')]['length']?_0x3f60ca[_0x1ac3('0x37')]:_0x4972d1[_0x1ac3('0x31')];if(_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x3f60ca['include']=[{'all':!![]}];}_0x3f60ca=_[_0x1ac3('0x40')]({},_0x3f60ca,_0x4edc4d[_0x1ac3('0x41')]);return db[_0x1ac3('0x2d')][_0x1ac3('0x48')](_0x3f60ca)['then'](handleEntityNotFound(_0x2c2099,null))[_0x1ac3('0x42')](respondWithResult(_0x2c2099,null))['catch'](handleError(_0x2c2099,null));};exports[_0x1ac3('0x49')]=function(_0x10bcaf,_0x2e3347){return db[_0x1ac3('0x2d')][_0x1ac3('0x49')](_0x10bcaf[_0x1ac3('0x4a')],{})[_0x1ac3('0x42')](respondWithResult(_0x2e3347,0xc9))['catch'](handleError(_0x2e3347,null));};exports['update']=function(_0xe8f33c,_0x249c2d){if(_0xe8f33c[_0x1ac3('0x4a')]['id']){delete _0xe8f33c['body']['id'];}delete _0xe8f33c['body']['duration'];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4b')];delete _0xe8f33c['body'][_0x1ac3('0x4c')];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4d')];return db[_0x1ac3('0x2d')]['find']({'where':{'id':_0xe8f33c['params']['id']}})[_0x1ac3('0x42')](handleEntityNotFound(_0x249c2d,null))[_0x1ac3('0x42')](saveUpdates(_0xe8f33c['body'],null))[_0x1ac3('0x42')](respondWithResult(_0x249c2d,null))['catch'](handleError(_0x249c2d,null));};exports['describe']=function(_0x2d628d,_0x220dd0){return db['ScreenRecording'][_0x1ac3('0x4e')]()['then'](respondWithResult(_0x220dd0,null))[_0x1ac3('0x46')](handleError(_0x220dd0,null));};exports[_0x1ac3('0x4f')]=function(_0x3586b9,_0x3a0320,_0x34ad43){var _0x40e9c7=require(_0x1ac3('0x50'));var _0x331374=![];var _0xeb7e49={};if(_0x3586b9[_0x1ac3('0x34')][_0x1ac3('0x2f')]&&_0x3586b9['query']['type']===_0x1ac3('0x51')){_0xeb7e49[_0x1ac3('0x51')]=_0x3586b9[_0x1ac3('0x47')]['id'];}else{_0xeb7e49['id']=_0x3586b9[_0x1ac3('0x47')]['id'];}return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':_0xeb7e49,'attributes':['id',_0x1ac3('0x4d')],'raw':!![]})[_0x1ac3('0x42')](handleEntityNotFound(_0x3a0320,null))[_0x1ac3('0x42')](function(_0x3149f6){if(_0x3149f6){var _0x541bba=path[_0x1ac3('0x52')](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x3149f6[_0x1ac3('0x4d')]);var _0x20c195=util['format'](_0x1ac3('0x55'),_0x541bba);if(fs[_0x1ac3('0x56')](_0x20c195)){_0x331374=!![];return _0x40e9c7['decryptFile'](_0x20c195,_0x541bba,config['secrets']['recording'])[_0x1ac3('0x42')](function(){return _0x3149f6;});}return _0x3149f6;}})[_0x1ac3('0x42')](function(_0x2a1f66){if(_0x2a1f66){var _0x5ad546=path[_0x1ac3('0x52')](config['root'],'server/files/screen_recordings',_0x2a1f66['value']);if(!fs['existsSync'](_0x5ad546)){throw new db[(_0x1ac3('0x57'))][(_0x1ac3('0x58'))](_0x1ac3('0x59'));}if(_0x2a1f66[_0x1ac3('0x5a')]){return _0x3a0320[_0x1ac3('0x4f')](_0x5ad546,_0x2a1f66['filename']+path[_0x1ac3('0x5b')](_0x5ad546),function(){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}else{return _0x3a0320['download'](_0x5ad546,function(_0x2bcb4b){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}}})[_0x1ac3('0x46')](function(_0x2e79b2){if(_0x2e79b2[_0x1ac3('0x5d')]==='ScreenRecording\x20not\x20found'){_0x3a0320[_0x1ac3('0x1b')](0x194)[_0x1ac3('0x2a')](_0x1ac3('0x5e'));}else{return handleError(_0x3a0320,null);}});};exports[_0x1ac3('0x27')]=function(_0x4cfa04,_0x19407a){return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':{'id':_0x4cfa04[_0x1ac3('0x47')]['id']}})[_0x1ac3('0x42')](function(_0x1ac283){if(_['isNil'](_0x1ac283)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1ac283;})['then'](function(_0x582fe2){var _0x3b930b=path['join'](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x582fe2[_0x1ac3('0x4d')]);logger[_0x1ac3('0x5f')](_0x1ac3('0x60'),_0x3b930b);if(!_[_0x1ac3('0x61')](_0x582fe2['value'])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')](_0x1ac3('0x62')+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}_0x3b930b=_0x3b930b+_0x1ac3('0x64');if(!_[_0x1ac3('0x61')](_0x582fe2[_0x1ac3('0x4d')])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')]('File:\x20\x22'+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}return _0x582fe2;})['then'](function(_0x402507){if(!_0x402507)throw new InternalError();return _0x402507[_0x1ac3('0x27')]();})[_0x1ac3('0x42')](function(){_0x19407a[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();})[_0x1ac3('0x46')](handleError(_0x19407a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3ecd2d4..3df241a 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 _0xf6db=['../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x13bf57,_0x518506){var _0x4ffbf9=function(_0x22d24c){while(--_0x22d24c){_0x13bf57['push'](_0x13bf57['shift']());}};_0x4ffbf9(++_0x518506);}(_0xf6db,0xea));var _0xbf6d=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0xf6db[_0x11a962];return _0x55d423;};'use strict';var _=require(_0xbf6d('0x0'));var util=require(_0xbf6d('0x1'));var logger=require(_0xbf6d('0x2'))('api');var moment=require(_0xbf6d('0x3'));var BPromise=require('bluebird');var rp=require(_0xbf6d('0x4'));var fs=require('fs');var path=require(_0xbf6d('0x5'));var rimraf=require('rimraf');var config=require(_0xbf6d('0x6'));var attributes=require('./screenRecording.attributes');module[_0xbf6d('0x7')]=function(_0x31549f,_0x3f468c){return _0x31549f[_0xbf6d('0x8')](_0xbf6d('0x9'),attributes,{'tableName':_0xbf6d('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xbf6d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f8c=['exports','define','ScreenRecording','interactionid','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x1ec98f,_0x3e0aa4){var _0x409e54=function(_0x1f8473){while(--_0x1f8473){_0x1ec98f['push'](_0x1ec98f['shift']());}};_0x409e54(++_0x3e0aa4);}(_0x4f8c,0x1e4));var _0xc4f8=function(_0x5715a5,_0x4a1eb1){_0x5715a5=_0x5715a5-0x0;var _0x3fbf05=_0x4f8c[_0x5715a5];return _0x3fbf05;};'use strict';var _=require('lodash');var util=require(_0xc4f8('0x0'));var logger=require(_0xc4f8('0x1'))(_0xc4f8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc4f8('0x3'));var fs=require('fs');var path=require(_0xc4f8('0x4'));var rimraf=require(_0xc4f8('0x5'));var config=require(_0xc4f8('0x6'));var attributes=require(_0xc4f8('0x7'));module[_0xc4f8('0x8')]=function(_0xd83fc4,_0x2b4a23){return _0xd83fc4[_0xc4f8('0x9')](_0xc4f8('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xc4f8('0xb'),'fields':[_0xc4f8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 60cd811..8535dca 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 _0x5d9f=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3800bb,_0x3143e8){var _0x4fecb6=function(_0xb6d79a){while(--_0xb6d79a){_0x3800bb['push'](_0x3800bb['shift']());}};_0x4fecb6(++_0x3143e8);}(_0x5d9f,0x130));var _0xf5d9=function(_0x1353d4,_0x25013f){_0x1353d4=_0x1353d4-0x0;var _0xf0f13c=_0x5d9f[_0x1353d4];return _0xf0f13c;};'use strict';var _=require(_0xf5d9('0x0'));var util=require(_0xf5d9('0x1'));var moment=require('moment');var BPromise=require(_0xf5d9('0x2'));var rs=require(_0xf5d9('0x3'));var fs=require('fs');var Redis=require(_0xf5d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5d9('0x5'));var logger=require(_0xf5d9('0x6'))(_0xf5d9('0x7'));var config=require('../../config/environment');var jayson=require(_0xf5d9('0x8'));var client=jayson[_0xf5d9('0x9')][_0xf5d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f2795,_0x5ac590,_0x451054){return new BPromise(function(_0x24fcba,_0x2f56da){return client[_0xf5d9('0xb')](_0x3f2795,_0x451054)[_0xf5d9('0xc')](function(_0x51bf0c){logger[_0xf5d9('0xd')](_0xf5d9('0xe'),_0x5ac590,_0xf5d9('0xf'));logger[_0xf5d9('0x10')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x5ac590,'request\x20sent',JSON[_0xf5d9('0x11')](_0x51bf0c));if(_0x51bf0c[_0xf5d9('0x12')]){if(_0x51bf0c[_0xf5d9('0x12')][_0xf5d9('0x13')]===0x1f4){logger[_0xf5d9('0x12')](_0xf5d9('0xe'),_0x5ac590,_0x51bf0c['error'][_0xf5d9('0x14')]);return _0x2f56da(_0x51bf0c[_0xf5d9('0x12')][_0xf5d9('0x14')]);}logger[_0xf5d9('0x12')](_0xf5d9('0xe'),_0x5ac590,_0x51bf0c[_0xf5d9('0x12')]['message']);return _0x24fcba(_0x51bf0c['error'][_0xf5d9('0x14')]);}else{logger[_0xf5d9('0xd')](_0xf5d9('0xe'),_0x5ac590,_0xf5d9('0xf'));_0x24fcba(_0x51bf0c[_0xf5d9('0x15')]['message']);}})[_0xf5d9('0x16')](function(_0x13d7f5){logger[_0xf5d9('0x12')](_0xf5d9('0xe'),_0x5ac590,_0x13d7f5);_0x2f56da(_0x13d7f5);});});} \ No newline at end of file +var _0xcbd0=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3ff34f,_0x4c01df){var _0x86ad1b=function(_0x91cfd6){while(--_0x91cfd6){_0x3ff34f['push'](_0x3ff34f['shift']());}};_0x86ad1b(++_0x4c01df);}(_0xcbd0,0x177));var _0x0cbd=function(_0xbb0a56,_0x55f636){_0xbb0a56=_0xbb0a56-0x0;var _0xac97cd=_0xcbd0[_0xbb0a56];return _0xac97cd;};'use strict';var _=require(_0x0cbd('0x0'));var util=require(_0x0cbd('0x1'));var moment=require(_0x0cbd('0x2'));var BPromise=require('bluebird');var rs=require(_0x0cbd('0x3'));var fs=require('fs');var Redis=require(_0x0cbd('0x4'));var db=require(_0x0cbd('0x5'))['db'];var utils=require(_0x0cbd('0x6'));var logger=require(_0x0cbd('0x7'))(_0x0cbd('0x8'));var config=require(_0x0cbd('0x9'));var jayson=require(_0x0cbd('0xa'));var client=jayson[_0x0cbd('0xb')][_0x0cbd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x980a25,_0x36e14e,_0x4f5936){return new BPromise(function(_0x37a4cb,_0x472c2a){return client[_0x0cbd('0xd')](_0x980a25,_0x4f5936)['then'](function(_0x39471d){logger[_0x0cbd('0xe')](_0x0cbd('0xf'),_0x36e14e,_0x0cbd('0x10'));logger['debug'](_0x0cbd('0x11'),_0x36e14e,_0x0cbd('0x10'),JSON['stringify'](_0x39471d));if(_0x39471d[_0x0cbd('0x12')]){if(_0x39471d[_0x0cbd('0x12')][_0x0cbd('0x13')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x36e14e,_0x39471d[_0x0cbd('0x12')][_0x0cbd('0x14')]);return _0x472c2a(_0x39471d['error'][_0x0cbd('0x14')]);}logger[_0x0cbd('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x36e14e,_0x39471d[_0x0cbd('0x12')][_0x0cbd('0x14')]);return _0x37a4cb(_0x39471d['error']['message']);}else{logger['info'](_0x0cbd('0xf'),_0x36e14e,_0x0cbd('0x10'));_0x37a4cb(_0x39471d['result']['message']);}})[_0x0cbd('0x15')](function(_0x1a6b52){logger[_0x0cbd('0x12')](_0x0cbd('0xf'),_0x36e14e,_0x1a6b52);_0x472c2a(_0x1a6b52);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 1311183..ca84dc8 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 _0xe161=['file','addLogoLogin','preferred','addPreferred','/:id/favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getFavicon','join','format','%s%s','logo','extname','originalname','post','single','addLogo','diskStorage','root','server/files/images/logos/','/:id/logo_login'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xe161,0x117));var _0x1e16=function(_0x456ab8,_0x7e0afa){_0x456ab8=_0x456ab8-0x0;var _0x5295a9=_0xe161[_0x456ab8];return _0x5295a9;};'use strict';var multer=require(_0x1e16('0x0'));var util=require(_0x1e16('0x1'));var path=require(_0x1e16('0x2'));var timeout=require(_0x1e16('0x3'));var express=require(_0x1e16('0x4'));var router=express[_0x1e16('0x5')]();var fs_extra=require(_0x1e16('0x6'));var auth=require(_0x1e16('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1e16('0x8'));var controller=require(_0x1e16('0x9'));router['get']('/',auth[_0x1e16('0xa')](),controller[_0x1e16('0xb')]);router[_0x1e16('0xc')](_0x1e16('0xd'),controller[_0x1e16('0xe')]);router['get'](_0x1e16('0xf'),controller['show']);router['get'](_0x1e16('0x10'),controller[_0x1e16('0x11')]);router[_0x1e16('0xc')]('/:id/logo_login',controller[_0x1e16('0x12')]);router[_0x1e16('0xc')](_0x1e16('0x13'),controller[_0x1e16('0x14')]);router[_0x1e16('0xc')](_0x1e16('0x15'),controller['getPreferred']);router[_0x1e16('0xc')]('/:id/favicon',controller[_0x1e16('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a74ec,_0xf7ff4,_0x272adc){_0x272adc(null,path[_0x1e16('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x4d2cbb,_0x2df979,_0x2f85e1){_0x2f85e1(null,util[_0x1e16('0x18')](_0x1e16('0x19'),_0x1e16('0x1a'),path[_0x1e16('0x1b')](_0x2df979[_0x1e16('0x1c')])));}})});router[_0x1e16('0x1d')]('/:id/logo',upload[_0x1e16('0x1e')]('file'),controller[_0x1e16('0x1f')]);var upload=multer({'storage':multer[_0x1e16('0x20')]({'destination':function(_0x537d7f,_0x20cb29,_0x3f7893){_0x3f7893(null,path[_0x1e16('0x17')](config[_0x1e16('0x21')],_0x1e16('0x22')));},'filename':function(_0x262757,_0x31f06d,_0x45a781){_0x45a781(null,util[_0x1e16('0x18')](_0x1e16('0x19'),'logologin',path[_0x1e16('0x1b')](_0x31f06d[_0x1e16('0x1c')])));}})});router[_0x1e16('0x1d')](_0x1e16('0x23'),upload[_0x1e16('0x1e')](_0x1e16('0x24')),controller[_0x1e16('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x43c663,_0x4d33c1,_0x13912d){_0x13912d(null,path[_0x1e16('0x17')](config[_0x1e16('0x21')],_0x1e16('0x22')));},'filename':function(_0x2af0cd,_0x14037f,_0x3e3008){_0x3e3008(null,util['format'](_0x1e16('0x19'),_0x1e16('0x26'),path[_0x1e16('0x1b')](_0x14037f[_0x1e16('0x1c')])));}})});router['post']('/:id/preferred',upload[_0x1e16('0x1e')](_0x1e16('0x24')),controller[_0x1e16('0x27')]);var upload=multer({'storage':multer[_0x1e16('0x20')]({'destination':function(_0x252d16,_0x49453d,_0x13f4b0){_0x13f4b0(null,path[_0x1e16('0x17')](config['root'],_0x1e16('0x22')));},'filename':function(_0x39f829,_0x35e6ef,_0x137b14){_0x137b14(null,util[_0x1e16('0x18')](_0x1e16('0x19'),'favicon',path[_0x1e16('0x1b')](_0x35e6ef[_0x1e16('0x1c')])));}})});router[_0x1e16('0x1d')](_0x1e16('0x28'),upload['single']('file'),controller[_0x1e16('0x29')]);router[_0x1e16('0x2a')]('/:id',auth[_0x1e16('0xa')](),controller[_0x1e16('0x2b')]);module[_0x1e16('0x2c')]=router; \ No newline at end of file +var _0xb40e=['logologin','single','addLogoLogin','preferred','addPreferred','favicon','isAuthenticated','exports','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','post','/:id/logo','file','addLogo','%s%s'];(function(_0x4c4d1e,_0x58efca){var _0x2141ce=function(_0x1967c1){while(--_0x1967c1){_0x4c4d1e['push'](_0x4c4d1e['shift']());}};_0x2141ce(++_0x58efca);}(_0xb40e,0x1e8));var _0xeb40=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0xb40e[_0x265aa2];return _0x447a3a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb40('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeb40('0x1')]();var fs_extra=require(_0xeb40('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xeb40('0x3'));var config=require(_0xeb40('0x4'));var controller=require(_0xeb40('0x5'));router[_0xeb40('0x6')]('/',auth['isAuthenticated'](),controller[_0xeb40('0x7')]);router[_0xeb40('0x6')](_0xeb40('0x8'),controller[_0xeb40('0x9')]);router[_0xeb40('0x6')](_0xeb40('0xa'),controller['show']);router['get']('/:id/logo',controller[_0xeb40('0xb')]);router[_0xeb40('0x6')](_0xeb40('0xc'),controller[_0xeb40('0xd')]);router['get'](_0xeb40('0xe'),controller['gdpr']);router[_0xeb40('0x6')](_0xeb40('0xf'),controller[_0xeb40('0x10')]);router[_0xeb40('0x6')](_0xeb40('0x11'),controller[_0xeb40('0x12')]);var upload=multer({'storage':multer[_0xeb40('0x13')]({'destination':function(_0x4ed7d9,_0xb7cca,_0x49e37d){_0x49e37d(null,path[_0xeb40('0x14')](config[_0xeb40('0x15')],_0xeb40('0x16')));},'filename':function(_0x3bb023,_0x21638,_0x4d2b92){_0x4d2b92(null,util[_0xeb40('0x17')]('%s%s',_0xeb40('0x18'),path[_0xeb40('0x19')](_0x21638[_0xeb40('0x1a')])));}})});router[_0xeb40('0x1b')](_0xeb40('0x1c'),upload['single'](_0xeb40('0x1d')),controller[_0xeb40('0x1e')]);var upload=multer({'storage':multer[_0xeb40('0x13')]({'destination':function(_0x1140fb,_0x50f0e7,_0xbf7371){_0xbf7371(null,path['join'](config[_0xeb40('0x15')],'server/files/images/logos/'));},'filename':function(_0x562b14,_0x51acfd,_0x1b650b){_0x1b650b(null,util[_0xeb40('0x17')](_0xeb40('0x1f'),_0xeb40('0x20'),path[_0xeb40('0x19')](_0x51acfd[_0xeb40('0x1a')])));}})});router[_0xeb40('0x1b')](_0xeb40('0xc'),upload[_0xeb40('0x21')]('file'),controller[_0xeb40('0x22')]);var upload=multer({'storage':multer[_0xeb40('0x13')]({'destination':function(_0x20ab4d,_0xc4cda,_0x27ee79){_0x27ee79(null,path[_0xeb40('0x14')](config[_0xeb40('0x15')],_0xeb40('0x16')));},'filename':function(_0x2f1bb4,_0x261b52,_0x588609){_0x588609(null,util['format'](_0xeb40('0x1f'),_0xeb40('0x23'),path[_0xeb40('0x19')](_0x261b52['originalname'])));}})});router[_0xeb40('0x1b')](_0xeb40('0xf'),upload[_0xeb40('0x21')]('file'),controller[_0xeb40('0x24')]);var upload=multer({'storage':multer[_0xeb40('0x13')]({'destination':function(_0x1a819b,_0xb63a81,_0x1845eb){_0x1845eb(null,path[_0xeb40('0x14')](config[_0xeb40('0x15')],_0xeb40('0x16')));},'filename':function(_0x5a6a83,_0x17a960,_0x3c34be){_0x3c34be(null,util[_0xeb40('0x17')]('%s%s',_0xeb40('0x25'),path[_0xeb40('0x19')](_0x17a960[_0xeb40('0x1a')])));}})});router['post'](_0xeb40('0x11'),upload[_0xeb40('0x21')](_0xeb40('0x1d')),controller['addFavicon']);router['put'](_0xeb40('0xa'),auth[_0xeb40('0x26')](),controller['update']);module[_0xeb40('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index cdc1945..36da9a3 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 _0xdb28=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdb28,0x106));var _0x8db2=function(_0xe96f84,_0xce654a){_0xe96f84=_0xe96f84-0x0;var _0x4870f0=_0xdb28[_0xe96f84];return _0x4870f0;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'min_internal':{'type':Sequelize[_0x8db2('0x2')](0xb),'unique':_0x8db2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x8db2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x8db2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x8db2('0x5')],'defaultValue':_0x8db2('0x6')},'logo':{'type':Sequelize[_0x8db2('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8db2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x8db2('0x5')]},'turnaddr':{'type':Sequelize[_0x8db2('0x5')]},'turnusername':{'type':Sequelize[_0x8db2('0x5')]},'turnpassword':{'type':Sequelize[_0x8db2('0x5')]},'pageTitle':{'type':Sequelize[_0x8db2('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x8db2('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x8db2('0x8')},'enableEmailPreview':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x8db2('0x5')],'defaultValue':_0x8db2('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x8db2('0x5')]},'defaultPreferred':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x8db2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x8db2('0x5')]},'defaultFavicon':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x8db2('0x2')]},'transcribeRegion':{'type':Sequelize[_0x8db2('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x8db2('0x2')]},'sentimentRegion':{'type':Sequelize[_0x8db2('0x5')]},'language':{'type':Sequelize[_0x8db2('0x5')]},'bucket':{'type':Sequelize[_0x8db2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x8db2('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x8db2('0x2')](0x2)[_0x8db2('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x8db2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x8db2('0x2')](0x2)[_0x8db2('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x441f45,_0x16130c){var _0x2bc267=function(_0x44f8a4){while(--_0x44f8a4){_0x441f45['push'](_0x441f45['shift']());}};_0x2bc267(++_0x16130c);}(_0x1261,0x144));var _0x1126=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x1261[_0x276468];return _0x36dc3a;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'min_internal':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x5')},'logo':{'type':Sequelize[_0x1126('0x4')]},'defaultLogo':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1126('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1126('0x4')]},'turnaddr':{'type':Sequelize[_0x1126('0x4')]},'turnusername':{'type':Sequelize[_0x1126('0x4')]},'turnpassword':{'type':Sequelize[_0x1126('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1126('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x7')},'chatTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1126('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1126('0x4')]},'defaultFavicon':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1126('0x1')]},'transcribeRegion':{'type':Sequelize[_0x1126('0x4')]},'sentiment':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1126('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1126('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1126('0x1')](0x2)[_0x1126('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1126('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 7452f60..cf59c4e 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 _0xc7e9=['gdpr','getPreferred','default_preferred.png','custom','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','Setting','includeAll','include','findAll','show','params','rawAttributes','length','find','body','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense','logo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','default_loginLogo.svg','Sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xc7e9[_0x1477ef];return _0x164acd;};'use strict';var emlformat=require(_0x9c7e('0x0'));var rimraf=require(_0x9c7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c7e('0x2'));var rp=require(_0x9c7e('0x3'));var moment=require(_0x9c7e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c7e('0x5'));var util=require(_0x9c7e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9c7e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c7e('0x8'));var _=require(_0x9c7e('0x9'));var squel=require(_0x9c7e('0xa'));var crypto=require(_0x9c7e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9c7e('0xc'));var toCsv=require(_0x9c7e('0x7'));var querystring=require(_0x9c7e('0xd'));var Papa=require(_0x9c7e('0xe'));var Redis=require('ioredis');var authService=require(_0x9c7e('0xf'));var qs=require(_0x9c7e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c7e('0x11'));var logger=require('../../config/logger')(_0x9c7e('0x12'));var utils=require(_0x9c7e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9c7e('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9c7e('0x15'));var client=jayson[_0x9c7e('0x16')][_0x9c7e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x142814,_0x116c69,_0x5b66a8,_0xd474b7){return new BPromise(function(_0x77e81c,_0x322d98){var _0x3a65a6=_0xd474b7||client;return _0x3a65a6[_0x9c7e('0x18')](_0x142814,_0x5b66a8)[_0x9c7e('0x19')](function(_0x4b26a8){logger[_0x9c7e('0x1a')](_0x9c7e('0x1b'),_0x116c69,_0x9c7e('0x1c'));logger[_0x9c7e('0x1d')](_0x9c7e('0x1e'),_0x116c69,'request\x20sent',JSON[_0x9c7e('0x1f')](_0x4b26a8));if(_0x4b26a8[_0x9c7e('0x20')]){if(_0x4b26a8['error'][_0x9c7e('0x21')]===0x1f4){logger[_0x9c7e('0x20')](_0x9c7e('0x1b'),_0x116c69,_0x4b26a8[_0x9c7e('0x20')][_0x9c7e('0x22')]);return _0x322d98(_0x4b26a8['error'][_0x9c7e('0x22')]);}logger['error'](_0x9c7e('0x1b'),_0x116c69,_0x4b26a8['error']['message']);return _0x77e81c(_0x4b26a8[_0x9c7e('0x20')][_0x9c7e('0x22')]);}else{logger[_0x9c7e('0x1a')](_0x9c7e('0x1b'),_0x116c69,_0x9c7e('0x1c'));_0x77e81c(_0x4b26a8['result'][_0x9c7e('0x22')]);}})[_0x9c7e('0x23')](function(_0x5fd78f){logger[_0x9c7e('0x20')](_0x9c7e('0x1b'),_0x116c69,_0x5fd78f);_0x322d98(_0x5fd78f);});});}function respondWithStatusCode(_0x28f031,_0x376e0c){_0x376e0c=_0x376e0c||0xcc;return function(_0x1ce4d2){if(_0x1ce4d2){return _0x28f031[_0x9c7e('0x24')](_0x376e0c);}return _0x28f031[_0x9c7e('0x25')](_0x376e0c)[_0x9c7e('0x26')]();};}function respondWithResult(_0x413542,_0x4a8a46){_0x4a8a46=_0x4a8a46||0xc8;return function(_0x9780f8){if(_0x9780f8){return _0x413542[_0x9c7e('0x25')](_0x4a8a46)[_0x9c7e('0x27')](_0x9780f8);}};}function respondWithFilteredResult(_0x467918,_0x17779b){return function(_0x224056){if(_0x224056){var _0x5d9b9d=typeof _0x17779b['offset']===_0x9c7e('0x28')&&typeof _0x17779b[_0x9c7e('0x29')]===_0x9c7e('0x28');var _0x270a03=_0x224056[_0x9c7e('0x2a')];var _0x33d696=_0x5d9b9d?0x0:_0x17779b[_0x9c7e('0x2b')];var _0xc02abf=_0x5d9b9d?_0x224056['count']:_0x17779b[_0x9c7e('0x2b')]+_0x17779b['limit'];var _0x2f5da4;if(_0xc02abf>=_0x270a03){_0xc02abf=_0x270a03;_0x2f5da4=0xc8;}else{_0x2f5da4=0xce;}_0x467918['status'](_0x2f5da4);return _0x467918['set'](_0x9c7e('0x2c'),_0x33d696+'-'+_0xc02abf+'/'+_0x270a03)[_0x9c7e('0x27')](_0x224056);}return null;};}function patchUpdates(_0x1ca8bc){return function(_0x433ff4){try{jsonpatch[_0x9c7e('0x2d')](_0x433ff4,_0x1ca8bc,!![]);}catch(_0x1cf15e){return BPromise[_0x9c7e('0x2e')](_0x1cf15e);}return _0x433ff4[_0x9c7e('0x2f')]();};}function saveUpdates(_0x2bbfe8,_0x3537b4){return function(_0x427015){if(_0x427015){return _0x427015[_0x9c7e('0x30')](_0x2bbfe8)[_0x9c7e('0x19')](function(_0x52ed0e){return _0x52ed0e;});}return null;};}function removeEntity(_0x22a9a1,_0x28f362){return function(_0x5d2518){if(_0x5d2518){return _0x5d2518[_0x9c7e('0x31')]()[_0x9c7e('0x19')](function(){_0x22a9a1['status'](0xcc)[_0x9c7e('0x26')]();});}};}function handleEntityNotFound(_0x194691,_0xf5d14f){return function(_0x4a99c1){if(!_0x4a99c1){_0x194691[_0x9c7e('0x24')](0x194);}return _0x4a99c1;};}function handleError(_0x7b9649,_0x199de1){_0x199de1=_0x199de1||0x1f4;return function(_0x4bfa6a){logger[_0x9c7e('0x20')](_0x4bfa6a[_0x9c7e('0x32')]);if(_0x4bfa6a[_0x9c7e('0x33')]){delete _0x4bfa6a['name'];}_0x7b9649[_0x9c7e('0x25')](_0x199de1)[_0x9c7e('0x34')](_0x4bfa6a);};}exports['index']=function(_0x356cc5,_0x4eb1d1){var _0x207856={},_0x2c02e8={},_0x3a52e9={'count':0x0,'rows':[]};var _0x22dab1=_[_0x9c7e('0x35')](db['Setting']['rawAttributes'],function(_0x24bd8f){return{'name':_0x24bd8f[_0x9c7e('0x36')],'type':_0x24bd8f[_0x9c7e('0x37')][_0x9c7e('0x38')]};});_0x2c02e8[_0x9c7e('0x39')]=_['map'](_0x22dab1,'name');_0x2c02e8[_0x9c7e('0x3a')]=_[_0x9c7e('0x3b')](_0x356cc5[_0x9c7e('0x3a')]);_0x2c02e8[_0x9c7e('0x3c')]=_[_0x9c7e('0x3d')](_0x2c02e8[_0x9c7e('0x39')],_0x2c02e8[_0x9c7e('0x3a')]);_0x207856['attributes']=_['intersection'](_0x2c02e8[_0x9c7e('0x39')],qs['fields'](_0x356cc5[_0x9c7e('0x3a')][_0x9c7e('0x3e')]));_0x207856[_0x9c7e('0x3f')]=_0x207856[_0x9c7e('0x3f')]['length']?_0x207856[_0x9c7e('0x3f')]:_0x2c02e8[_0x9c7e('0x39')];if(!_0x356cc5[_0x9c7e('0x3a')][_0x9c7e('0x40')](_0x9c7e('0x41'))){_0x207856[_0x9c7e('0x29')]=qs[_0x9c7e('0x29')](_0x356cc5[_0x9c7e('0x3a')]['limit']);_0x207856[_0x9c7e('0x2b')]=qs['offset'](_0x356cc5[_0x9c7e('0x3a')][_0x9c7e('0x2b')]);}_0x207856[_0x9c7e('0x42')]=qs[_0x9c7e('0x43')](_0x356cc5[_0x9c7e('0x3a')][_0x9c7e('0x43')]);_0x207856[_0x9c7e('0x44')]=qs[_0x9c7e('0x3c')](_['pick'](_0x356cc5[_0x9c7e('0x3a')],_0x2c02e8['filters']),_0x22dab1);if(_0x356cc5['query']['filter']){_0x207856[_0x9c7e('0x44')]=_['merge'](_0x207856[_0x9c7e('0x44')],{'$or':_[_0x9c7e('0x35')](_0x22dab1,function(_0x5161e2){if(_0x5161e2[_0x9c7e('0x37')]!==_0x9c7e('0x45')){var _0x548bea={};_0x548bea[_0x5161e2['name']]={'$like':'%'+_0x356cc5[_0x9c7e('0x3a')][_0x9c7e('0x46')]+'%'};return _0x548bea;}})});}_0x207856=_[_0x9c7e('0x47')]({},_0x207856,_0x356cc5[_0x9c7e('0x48')]);var _0x3422dd={'where':_0x207856[_0x9c7e('0x44')]};return db[_0x9c7e('0x49')][_0x9c7e('0x2a')](_0x3422dd)[_0x9c7e('0x19')](function(_0xe53e96){_0x3a52e9['count']=_0xe53e96;if(_0x356cc5[_0x9c7e('0x3a')][_0x9c7e('0x4a')]){_0x207856[_0x9c7e('0x4b')]=[{'all':!![]}];}return db[_0x9c7e('0x49')][_0x9c7e('0x4c')](_0x207856);})[_0x9c7e('0x19')](function(_0x2aefe4){_0x3a52e9['rows']=_0x2aefe4;return _0x3a52e9;})[_0x9c7e('0x19')](respondWithFilteredResult(_0x4eb1d1,_0x207856))[_0x9c7e('0x23')](handleError(_0x4eb1d1,null));};exports[_0x9c7e('0x4d')]=function(_0x58b2b6,_0x5a9b1a){var _0x3d9ad2={'raw':![],'where':{'id':_0x58b2b6[_0x9c7e('0x4e')]['id']}},_0x29e253={};_0x29e253['model']=_[_0x9c7e('0x3b')](db[_0x9c7e('0x49')][_0x9c7e('0x4f')]);_0x29e253[_0x9c7e('0x3a')]=_[_0x9c7e('0x3b')](_0x58b2b6['query']);_0x29e253['filters']=_['intersection'](_0x29e253[_0x9c7e('0x39')],_0x29e253[_0x9c7e('0x3a')]);_0x3d9ad2[_0x9c7e('0x3f')]=_[_0x9c7e('0x3d')](_0x29e253[_0x9c7e('0x39')],qs[_0x9c7e('0x3e')](_0x58b2b6[_0x9c7e('0x3a')][_0x9c7e('0x3e')]));_0x3d9ad2[_0x9c7e('0x3f')]=_0x3d9ad2[_0x9c7e('0x3f')][_0x9c7e('0x50')]?_0x3d9ad2[_0x9c7e('0x3f')]:_0x29e253[_0x9c7e('0x39')];if(_0x58b2b6[_0x9c7e('0x3a')][_0x9c7e('0x4a')]){_0x3d9ad2['include']=[{'all':!![]}];}_0x3d9ad2=_[_0x9c7e('0x47')]({},_0x3d9ad2,_0x58b2b6[_0x9c7e('0x48')]);return db[_0x9c7e('0x49')][_0x9c7e('0x51')](_0x3d9ad2)[_0x9c7e('0x19')](handleEntityNotFound(_0x5a9b1a,null))[_0x9c7e('0x19')](respondWithResult(_0x5a9b1a,null))[_0x9c7e('0x23')](handleError(_0x5a9b1a,null));};exports[_0x9c7e('0x30')]=function(_0x2406e0,_0x5bbee6){if(_0x2406e0[_0x9c7e('0x52')]['id']){delete _0x2406e0[_0x9c7e('0x52')]['id'];}return db[_0x9c7e('0x49')][_0x9c7e('0x51')]({'where':{'id':_0x2406e0[_0x9c7e('0x4e')]['id']}})[_0x9c7e('0x19')](handleEntityNotFound(_0x5bbee6,null))[_0x9c7e('0x19')](saveUpdates(_0x2406e0[_0x9c7e('0x52')],null))[_0x9c7e('0x19')](respondWithResult(_0x5bbee6,null))[_0x9c7e('0x23')](handleError(_0x5bbee6,null));};exports[_0x9c7e('0x53')]=function(_0x298eab,_0x4692c2,_0xf593a9){if(_0x298eab[_0x9c7e('0x54')]&&_0x298eab['file'][_0x9c7e('0x55')]){_0x298eab['body']['logo']=_0x298eab[_0x9c7e('0x54')]['filename'];}return db[_0x9c7e('0x49')][_0x9c7e('0x51')]({'where':{'id':_0x298eab[_0x9c7e('0x4e')]['id']}})[_0x9c7e('0x19')](handleEntityNotFound(_0x4692c2,null))[_0x9c7e('0x19')](saveUpdates(_0x298eab[_0x9c7e('0x52')],null))['then'](respondWithResult(_0x4692c2,null))['catch'](handleError(_0x4692c2,null));};exports['addLogoLogin']=function(_0x5ece87,_0x16fb7d,_0x2c7aff){if(_0x5ece87[_0x9c7e('0x54')]&&_0x5ece87[_0x9c7e('0x54')]['filename']){_0x5ece87[_0x9c7e('0x52')][_0x9c7e('0x56')]=_0x5ece87[_0x9c7e('0x54')][_0x9c7e('0x55')];}return db[_0x9c7e('0x49')][_0x9c7e('0x51')]({'where':{'id':_0x5ece87[_0x9c7e('0x4e')]['id']}})[_0x9c7e('0x19')](handleEntityNotFound(_0x16fb7d,null))[_0x9c7e('0x19')](saveUpdates(_0x5ece87[_0x9c7e('0x52')],null))[_0x9c7e('0x19')](respondWithResult(_0x16fb7d,null))['catch'](handleError(_0x16fb7d,null));};var utilLicense=require(_0x9c7e('0x14'));exports[_0x9c7e('0x57')]=function(_0x110c75,_0x12ed6f,_0x1dda33){var _0x4fe07c=_0x9c7e('0x58');var _0x3f1024={'custom':![]};return utilLicense[_0x9c7e('0x59')]()[_0x9c7e('0x19')](function(_0x4fa736){if(_0x4fa736){_0x3f1024=_0x4fa736;}return db['Setting'][_0x9c7e('0x51')]({'where':{'id':_0x110c75[_0x9c7e('0x4e')]['id']},'attributes':[_0x9c7e('0x5a'),'loginLogo','preferred',_0x9c7e('0x5b'),_0x9c7e('0x5c'),_0x9c7e('0x5d'),_0x9c7e('0x5e'),_0x9c7e('0x5f')],'raw':!![]});})[_0x9c7e('0x19')](handleEntityNotFound(_0x12ed6f,null))[_0x9c7e('0x19')](function(_0x299529){if(_0x299529){var _0x485d86=_0x299529[_0x9c7e('0x5a')]&&fs[_0x9c7e('0x60')](path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x4fe07c,_[_0x9c7e('0x63')](_0x299529[_0x9c7e('0x5a')])))?path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x4fe07c,_[_0x9c7e('0x63')](_0x299529[_0x9c7e('0x5a')])):path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x4fe07c,_[_0x9c7e('0x63')](_0x9c7e('0x64')));var _0x2e744d=_0x9c7e('0x65')+_[_0x9c7e('0x66')](_0x9c7e('0x5a'));if(_0x299529[_0x2e744d]||!_0x3f1024['custom']){_0x485d86=path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x4fe07c,_['toLower'](_0x9c7e('0x64')));}if(!fs[_0x9c7e('0x60')](_0x485d86)){throw new db['Sequelize'][(_0x9c7e('0x67'))](_['upperFirst'](_0x9c7e('0x5a'))+_0x9c7e('0x68'));}return _0x12ed6f[_0x9c7e('0x69')](_0x485d86);}})[_0x9c7e('0x23')](handleError(_0x12ed6f,null));};var utilLicense=require(_0x9c7e('0x14'));exports[_0x9c7e('0x6a')]=function(_0x19c9b8,_0x389ff1,_0x3892f6){var _0x12c3d0='server/files/images/logos';var _0x7b3b52={'custom':![]};return utilLicense[_0x9c7e('0x59')]()[_0x9c7e('0x19')](function(_0x32d7a1){if(_0x32d7a1){_0x7b3b52=_0x32d7a1;}return db[_0x9c7e('0x49')][_0x9c7e('0x51')]({'where':{'id':_0x19c9b8['params']['id']},'attributes':[_0x9c7e('0x5a'),_0x9c7e('0x56'),_0x9c7e('0x6b'),_0x9c7e('0x5b'),_0x9c7e('0x5c'),_0x9c7e('0x5d'),_0x9c7e('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x389ff1,null))[_0x9c7e('0x19')](function(_0x34b7cc){if(_0x34b7cc){var _0x3dca41=_0x34b7cc[_0x9c7e('0x56')]&&fs[_0x9c7e('0x60')](path['join'](config['root'],_0x12c3d0,_[_0x9c7e('0x63')](_0x34b7cc[_0x9c7e('0x56')])))?path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x12c3d0,_[_0x9c7e('0x63')](_0x34b7cc[_0x9c7e('0x56')])):path[_0x9c7e('0x61')](config['root'],_0x12c3d0,_['toLower'](_0x9c7e('0x6c')));var _0x3900e3=_0x9c7e('0x65')+_[_0x9c7e('0x66')](_0x9c7e('0x56'));if(_0x34b7cc[_0x3900e3]||!_0x7b3b52['custom']){_0x3dca41=path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x12c3d0,_[_0x9c7e('0x63')](_0x9c7e('0x6c')));}if(!fs['existsSync'](_0x3dca41)){throw new db[(_0x9c7e('0x6d'))][(_0x9c7e('0x67'))](_['upperFirst'](_0x9c7e('0x56'))+_0x9c7e('0x68'));}return _0x389ff1[_0x9c7e('0x69')](_0x3dca41);}})['catch'](handleError(_0x389ff1,null));};exports[_0x9c7e('0x6e')]=function(_0x313e96,_0x87bbc){return db[_0x9c7e('0x49')]['find']({'where':{'id':_0x313e96[_0x9c7e('0x4e')]['id']},'attributes':['securePassword']})[_0x9c7e('0x19')](respondWithResult(_0x87bbc,null))[_0x9c7e('0x23')](handleError(_0x87bbc,null));};exports['addPreferred']=function(_0x1e8345,_0x20c51b,_0x2ea72b){if(_0x1e8345[_0x9c7e('0x54')]&&_0x1e8345[_0x9c7e('0x54')]['filename']){_0x1e8345['body']['preferred']=_0x1e8345[_0x9c7e('0x54')][_0x9c7e('0x55')];}return db['Setting']['find']({'where':{'id':_0x1e8345[_0x9c7e('0x4e')]['id']}})[_0x9c7e('0x19')](handleEntityNotFound(_0x20c51b,null))[_0x9c7e('0x19')](saveUpdates(_0x1e8345['body'],null))['then'](respondWithResult(_0x20c51b,null))[_0x9c7e('0x23')](handleError(_0x20c51b,null));};var utilLicense=require(_0x9c7e('0x14'));exports[_0x9c7e('0x6f')]=function(_0x30f1c1,_0x36eed1,_0x53bc7a){var _0x199359=_0x9c7e('0x58');var _0x2cc41a={'custom':![]};return utilLicense[_0x9c7e('0x59')]()[_0x9c7e('0x19')](function(_0x5b2b1e){if(_0x5b2b1e){_0x2cc41a=_0x5b2b1e;}return db[_0x9c7e('0x49')][_0x9c7e('0x51')]({'where':{'id':_0x30f1c1['params']['id']},'attributes':['logo','loginLogo',_0x9c7e('0x6b'),_0x9c7e('0x5b'),_0x9c7e('0x5c'),_0x9c7e('0x5d'),_0x9c7e('0x5e'),_0x9c7e('0x5f')],'raw':!![]});})[_0x9c7e('0x19')](handleEntityNotFound(_0x36eed1,null))[_0x9c7e('0x19')](function(_0x1cbaa8){if(_0x1cbaa8){var _0x97a5cb=_0x1cbaa8[_0x9c7e('0x6b')]&&fs[_0x9c7e('0x60')](path[_0x9c7e('0x61')](config['root'],_0x199359,_[_0x9c7e('0x63')](_0x1cbaa8[_0x9c7e('0x6b')])))?path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x199359,_[_0x9c7e('0x63')](_0x1cbaa8[_0x9c7e('0x6b')])):path[_0x9c7e('0x61')](config['root'],_0x199359,_[_0x9c7e('0x63')](_0x9c7e('0x70')));var _0x40c8a6=_0x9c7e('0x65')+_[_0x9c7e('0x66')](_0x9c7e('0x6b'));if(_0x1cbaa8[_0x40c8a6]||!_0x2cc41a[_0x9c7e('0x71')]||!_0x2cc41a[_0x9c7e('0x6b')]){_0x97a5cb=path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x199359,_[_0x9c7e('0x63')](_0x9c7e('0x70')));}if(!fs[_0x9c7e('0x60')](_0x97a5cb)){throw new db[(_0x9c7e('0x6d'))][(_0x9c7e('0x67'))](_[_0x9c7e('0x66')](_0x9c7e('0x6b'))+'\x20not\x20found');}return _0x36eed1[_0x9c7e('0x69')](_0x97a5cb);}})[_0x9c7e('0x23')](handleError(_0x36eed1,null));};exports[_0x9c7e('0x72')]=function(_0x16f0c9,_0x48033a,_0x200ac0){if(_0x16f0c9['file']&&_0x16f0c9[_0x9c7e('0x54')][_0x9c7e('0x55')]){_0x16f0c9['body']['favicon']=_0x16f0c9[_0x9c7e('0x54')]['filename'];}return db[_0x9c7e('0x49')][_0x9c7e('0x51')]({'where':{'id':_0x16f0c9[_0x9c7e('0x4e')]['id']}})[_0x9c7e('0x19')](handleEntityNotFound(_0x48033a,null))[_0x9c7e('0x19')](saveUpdates(_0x16f0c9['body'],null))[_0x9c7e('0x19')](respondWithResult(_0x48033a,null))[_0x9c7e('0x23')](handleError(_0x48033a,null));};var utilLicense=require(_0x9c7e('0x14'));exports[_0x9c7e('0x73')]=function(_0x3d4d87,_0x2ba716,_0x405289){var _0x4bf499=_0x9c7e('0x58');var _0x4b0cbc={'custom':![]};return utilLicense[_0x9c7e('0x59')]()['then'](function(_0x319d77){if(_0x319d77){_0x4b0cbc=_0x319d77;}return db[_0x9c7e('0x49')][_0x9c7e('0x51')]({'where':{'id':_0x3d4d87[_0x9c7e('0x4e')]['id']},'attributes':['logo',_0x9c7e('0x56'),_0x9c7e('0x6b'),_0x9c7e('0x5b'),_0x9c7e('0x5c'),'defaultLoginLogo',_0x9c7e('0x5e'),_0x9c7e('0x5f')],'raw':!![]});})[_0x9c7e('0x19')](handleEntityNotFound(_0x2ba716,null))[_0x9c7e('0x19')](function(_0x463917){if(_0x463917){var _0x37171d=_0x463917[_0x9c7e('0x5b')]&&fs['existsSync'](path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x4bf499,_['toLower'](_0x463917[_0x9c7e('0x5b')])))?path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x4bf499,_[_0x9c7e('0x63')](_0x463917['favicon'])):path['join'](config[_0x9c7e('0x62')],_0x4bf499,_[_0x9c7e('0x63')]('default_favicon.ico'));var _0x32626c=_0x9c7e('0x65')+_[_0x9c7e('0x66')](_0x9c7e('0x5b'));if(_0x463917[_0x32626c]||!_0x4b0cbc['custom']){_0x37171d=path[_0x9c7e('0x61')](config[_0x9c7e('0x62')],_0x4bf499,_[_0x9c7e('0x63')](_0x9c7e('0x74')));}if(!fs[_0x9c7e('0x60')](_0x37171d)){throw new db[(_0x9c7e('0x6d'))][(_0x9c7e('0x67'))](_[_0x9c7e('0x66')]('favicon')+_0x9c7e('0x68'));}return _0x2ba716[_0x9c7e('0x69')](_0x37171d);}})['catch'](handleError(_0x2ba716,null));};exports[_0x9c7e('0x75')]=function(_0x286326,_0x5a2c23){var _0x5d4204={'offset':moment()['utcOffset']()};_0x5d4204[_0x9c7e('0x76')]=moment()[_0x9c7e('0x77')](_0x5d4204[_0x9c7e('0x2b')])['format'](_0x9c7e('0x78'));return _0x5a2c23[_0x9c7e('0x25')](0xc8)[_0x9c7e('0x34')](_0x5d4204);}; \ No newline at end of file +var _0x0f93=['../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','Setting','include','rows','params','fields','length','includeAll','options','update','body','find','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','loginLogo','defaultLogo','defaultLoginLogo','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','favicon','defaultFavicon','existsSync','default_loginLogo.svg','gdpr','securePassword','preferred','defaultPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x423adb,_0x3b93d5){var _0x214325=function(_0x3aa3e0){while(--_0x3aa3e0){_0x423adb['push'](_0x423adb['shift']());}};_0x214325(++_0x3b93d5);}(_0x0f93,0x66));var _0x30f9=function(_0x4e2cb4,_0x203c87){_0x4e2cb4=_0x4e2cb4-0x0;var _0x237b10=_0x0f93[_0x4e2cb4];return _0x237b10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30f9('0x0'));var zipdir=require(_0x30f9('0x1'));var jsonpatch=require(_0x30f9('0x2'));var rp=require(_0x30f9('0x3'));var moment=require(_0x30f9('0x4'));var BPromise=require(_0x30f9('0x5'));var Mustache=require(_0x30f9('0x6'));var util=require(_0x30f9('0x7'));var path=require(_0x30f9('0x8'));var sox=require(_0x30f9('0x9'));var csv=require(_0x30f9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30f9('0xb'));var _=require(_0x30f9('0xc'));var squel=require(_0x30f9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x30f9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x30f9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x30f9('0x10'));var as=require(_0x30f9('0x11'));var hardwareService=require(_0x30f9('0x12'));var logger=require('../../config/logger')(_0x30f9('0x13'));var utils=require(_0x30f9('0x14'));var config=require(_0x30f9('0x15'));var licenseUtil=require(_0x30f9('0x16'));var db=require(_0x30f9('0x17'))['db'];var jayson=require(_0x30f9('0x18'));var client=jayson[_0x30f9('0x19')][_0x30f9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x58fd08,_0x400415,_0xd73e00,_0x1e5143){return new BPromise(function(_0x25c44d,_0x33434a){var _0x4f0491=_0x1e5143||client;return _0x4f0491[_0x30f9('0x1b')](_0x58fd08,_0xd73e00)['then'](function(_0x10b98d){logger[_0x30f9('0x1c')](_0x30f9('0x1d'),_0x400415,'request\x20sent');logger[_0x30f9('0x1e')](_0x30f9('0x1f'),_0x400415,_0x30f9('0x20'),JSON[_0x30f9('0x21')](_0x10b98d));if(_0x10b98d['error']){if(_0x10b98d[_0x30f9('0x22')][_0x30f9('0x23')]===0x1f4){logger[_0x30f9('0x22')](_0x30f9('0x1d'),_0x400415,_0x10b98d['error']['message']);return _0x33434a(_0x10b98d['error'][_0x30f9('0x24')]);}logger[_0x30f9('0x22')]('Setting,\x20%s,\x20%s',_0x400415,_0x10b98d[_0x30f9('0x22')][_0x30f9('0x24')]);return _0x25c44d(_0x10b98d[_0x30f9('0x22')][_0x30f9('0x24')]);}else{logger['info'](_0x30f9('0x1d'),_0x400415,'request\x20sent');_0x25c44d(_0x10b98d[_0x30f9('0x25')]['message']);}})[_0x30f9('0x26')](function(_0x50fe60){logger['error']('Setting,\x20%s,\x20%s',_0x400415,_0x50fe60);_0x33434a(_0x50fe60);});});}function respondWithStatusCode(_0x225398,_0x55ab07){_0x55ab07=_0x55ab07||0xcc;return function(_0x3b20c3){if(_0x3b20c3){return _0x225398['sendStatus'](_0x55ab07);}return _0x225398[_0x30f9('0x27')](_0x55ab07)['end']();};}function respondWithResult(_0x3f9d76,_0x51b05d){_0x51b05d=_0x51b05d||0xc8;return function(_0x4ad3c5){if(_0x4ad3c5){return _0x3f9d76['status'](_0x51b05d)[_0x30f9('0x28')](_0x4ad3c5);}};}function respondWithFilteredResult(_0x396eaa,_0x3daecf){return function(_0x57bfec){if(_0x57bfec){var _0x427884=typeof _0x3daecf['offset']===_0x30f9('0x29')&&typeof _0x3daecf[_0x30f9('0x2a')]===_0x30f9('0x29');var _0x24f5fe=_0x57bfec[_0x30f9('0x2b')];var _0x534389=_0x427884?0x0:_0x3daecf[_0x30f9('0x2c')];var _0x52ee08=_0x427884?_0x57bfec['count']:_0x3daecf[_0x30f9('0x2c')]+_0x3daecf['limit'];var _0x3ec85d;if(_0x52ee08>=_0x24f5fe){_0x52ee08=_0x24f5fe;_0x3ec85d=0xc8;}else{_0x3ec85d=0xce;}_0x396eaa[_0x30f9('0x27')](_0x3ec85d);return _0x396eaa[_0x30f9('0x2d')](_0x30f9('0x2e'),_0x534389+'-'+_0x52ee08+'/'+_0x24f5fe)[_0x30f9('0x28')](_0x57bfec);}return null;};}function patchUpdates(_0x33f335){return function(_0x48e539){try{jsonpatch['apply'](_0x48e539,_0x33f335,!![]);}catch(_0x3d801c){return BPromise[_0x30f9('0x2f')](_0x3d801c);}return _0x48e539[_0x30f9('0x30')]();};}function saveUpdates(_0x4df5a2,_0x292aa9){return function(_0x2d2eaa){if(_0x2d2eaa){return _0x2d2eaa['update'](_0x4df5a2)[_0x30f9('0x31')](function(_0x12245f){return _0x12245f;});}return null;};}function removeEntity(_0x434d4e,_0x599095){return function(_0x3b9c8e){if(_0x3b9c8e){return _0x3b9c8e[_0x30f9('0x32')]()[_0x30f9('0x31')](function(){_0x434d4e[_0x30f9('0x27')](0xcc)[_0x30f9('0x33')]();});}};}function handleEntityNotFound(_0x4345d3,_0x100af6){return function(_0x4a8eec){if(!_0x4a8eec){_0x4345d3[_0x30f9('0x34')](0x194);}return _0x4a8eec;};}function handleError(_0x42bca0,_0x1a09a4){_0x1a09a4=_0x1a09a4||0x1f4;return function(_0x4003c9){logger[_0x30f9('0x22')](_0x4003c9[_0x30f9('0x35')]);if(_0x4003c9[_0x30f9('0x36')]){delete _0x4003c9[_0x30f9('0x36')];}_0x42bca0[_0x30f9('0x27')](_0x1a09a4)[_0x30f9('0x37')](_0x4003c9);};}exports[_0x30f9('0x38')]=function(_0xf9431d,_0x2ab960){var _0x15b0ec={},_0x3d7601={},_0xb0c97c={'count':0x0,'rows':[]};var _0x3d6fc0=_[_0x30f9('0x39')](db['Setting'][_0x30f9('0x3a')],function(_0x1c510d){return{'name':_0x1c510d[_0x30f9('0x3b')],'type':_0x1c510d[_0x30f9('0x3c')]['key']};});_0x3d7601['model']=_[_0x30f9('0x39')](_0x3d6fc0,'name');_0x3d7601['query']=_[_0x30f9('0x3d')](_0xf9431d[_0x30f9('0x3e')]);_0x3d7601[_0x30f9('0x3f')]=_[_0x30f9('0x40')](_0x3d7601['model'],_0x3d7601[_0x30f9('0x3e')]);_0x15b0ec[_0x30f9('0x41')]=_['intersection'](_0x3d7601['model'],qs['fields'](_0xf9431d['query']['fields']));_0x15b0ec[_0x30f9('0x41')]=_0x15b0ec['attributes']['length']?_0x15b0ec[_0x30f9('0x41')]:_0x3d7601[_0x30f9('0x42')];if(!_0xf9431d[_0x30f9('0x3e')]['hasOwnProperty'](_0x30f9('0x43'))){_0x15b0ec[_0x30f9('0x2a')]=qs[_0x30f9('0x2a')](_0xf9431d[_0x30f9('0x3e')][_0x30f9('0x2a')]);_0x15b0ec[_0x30f9('0x2c')]=qs[_0x30f9('0x2c')](_0xf9431d[_0x30f9('0x3e')][_0x30f9('0x2c')]);}_0x15b0ec[_0x30f9('0x44')]=qs[_0x30f9('0x45')](_0xf9431d[_0x30f9('0x3e')][_0x30f9('0x45')]);_0x15b0ec['where']=qs[_0x30f9('0x3f')](_[_0x30f9('0x46')](_0xf9431d[_0x30f9('0x3e')],_0x3d7601[_0x30f9('0x3f')]),_0x3d6fc0);if(_0xf9431d[_0x30f9('0x3e')]['filter']){_0x15b0ec[_0x30f9('0x47')]=_['merge'](_0x15b0ec[_0x30f9('0x47')],{'$or':_[_0x30f9('0x39')](_0x3d6fc0,function(_0x51bfc6){if(_0x51bfc6['type']!==_0x30f9('0x48')){var _0x4f6f76={};_0x4f6f76[_0x51bfc6['name']]={'$like':'%'+_0xf9431d[_0x30f9('0x3e')][_0x30f9('0x49')]+'%'};return _0x4f6f76;}})});}_0x15b0ec=_[_0x30f9('0x4a')]({},_0x15b0ec,_0xf9431d['options']);var _0x2a74d4={'where':_0x15b0ec[_0x30f9('0x47')]};return db[_0x30f9('0x4b')][_0x30f9('0x2b')](_0x2a74d4)['then'](function(_0x15ce85){_0xb0c97c['count']=_0x15ce85;if(_0xf9431d[_0x30f9('0x3e')]['includeAll']){_0x15b0ec[_0x30f9('0x4c')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x15b0ec);})[_0x30f9('0x31')](function(_0x3e2859){_0xb0c97c[_0x30f9('0x4d')]=_0x3e2859;return _0xb0c97c;})[_0x30f9('0x31')](respondWithFilteredResult(_0x2ab960,_0x15b0ec))[_0x30f9('0x26')](handleError(_0x2ab960,null));};exports['show']=function(_0x181eb3,_0x452286){var _0x445f87={'raw':![],'where':{'id':_0x181eb3[_0x30f9('0x4e')]['id']}},_0x48c9d2={};_0x48c9d2[_0x30f9('0x42')]=_['keys'](db[_0x30f9('0x4b')][_0x30f9('0x3a')]);_0x48c9d2['query']=_[_0x30f9('0x3d')](_0x181eb3[_0x30f9('0x3e')]);_0x48c9d2['filters']=_[_0x30f9('0x40')](_0x48c9d2[_0x30f9('0x42')],_0x48c9d2[_0x30f9('0x3e')]);_0x445f87[_0x30f9('0x41')]=_[_0x30f9('0x40')](_0x48c9d2[_0x30f9('0x42')],qs[_0x30f9('0x4f')](_0x181eb3['query'][_0x30f9('0x4f')]));_0x445f87['attributes']=_0x445f87[_0x30f9('0x41')][_0x30f9('0x50')]?_0x445f87[_0x30f9('0x41')]:_0x48c9d2[_0x30f9('0x42')];if(_0x181eb3[_0x30f9('0x3e')][_0x30f9('0x51')]){_0x445f87['include']=[{'all':!![]}];}_0x445f87=_[_0x30f9('0x4a')]({},_0x445f87,_0x181eb3[_0x30f9('0x52')]);return db[_0x30f9('0x4b')]['find'](_0x445f87)[_0x30f9('0x31')](handleEntityNotFound(_0x452286,null))[_0x30f9('0x31')](respondWithResult(_0x452286,null))['catch'](handleError(_0x452286,null));};exports[_0x30f9('0x53')]=function(_0x44eacd,_0xa9fba5){if(_0x44eacd[_0x30f9('0x54')]['id']){delete _0x44eacd['body']['id'];}return db['Setting'][_0x30f9('0x55')]({'where':{'id':_0x44eacd[_0x30f9('0x4e')]['id']}})['then'](handleEntityNotFound(_0xa9fba5,null))[_0x30f9('0x31')](saveUpdates(_0x44eacd['body'],null))['then'](respondWithResult(_0xa9fba5,null))[_0x30f9('0x26')](handleError(_0xa9fba5,null));};exports[_0x30f9('0x56')]=function(_0x45acad,_0x256b19,_0x3f5531){if(_0x45acad[_0x30f9('0x57')]&&_0x45acad[_0x30f9('0x57')][_0x30f9('0x58')]){_0x45acad[_0x30f9('0x54')][_0x30f9('0x59')]=_0x45acad[_0x30f9('0x57')][_0x30f9('0x58')];}return db[_0x30f9('0x4b')][_0x30f9('0x55')]({'where':{'id':_0x45acad[_0x30f9('0x4e')]['id']}})[_0x30f9('0x31')](handleEntityNotFound(_0x256b19,null))['then'](saveUpdates(_0x45acad[_0x30f9('0x54')],null))['then'](respondWithResult(_0x256b19,null))[_0x30f9('0x26')](handleError(_0x256b19,null));};exports[_0x30f9('0x5a')]=function(_0x41aebd,_0x5a6e0a,_0x4ae71d){if(_0x41aebd[_0x30f9('0x57')]&&_0x41aebd['file'][_0x30f9('0x58')]){_0x41aebd['body']['loginLogo']=_0x41aebd[_0x30f9('0x57')]['filename'];}return db[_0x30f9('0x4b')][_0x30f9('0x55')]({'where':{'id':_0x41aebd[_0x30f9('0x4e')]['id']}})[_0x30f9('0x31')](handleEntityNotFound(_0x5a6e0a,null))[_0x30f9('0x31')](saveUpdates(_0x41aebd[_0x30f9('0x54')],null))[_0x30f9('0x31')](respondWithResult(_0x5a6e0a,null))['catch'](handleError(_0x5a6e0a,null));};var utilLicense=require(_0x30f9('0x16'));exports[_0x30f9('0x5b')]=function(_0x238d23,_0x1e9c44,_0x1b62ba){var _0x4566bf=_0x30f9('0x5c');var _0x556351={'custom':![]};return utilLicense['getLicense']()[_0x30f9('0x31')](function(_0x3b20b6){if(_0x3b20b6){_0x556351=_0x3b20b6;}return db[_0x30f9('0x4b')]['find']({'where':{'id':_0x238d23['params']['id']},'attributes':[_0x30f9('0x59'),_0x30f9('0x5d'),'preferred','favicon',_0x30f9('0x5e'),_0x30f9('0x5f'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x1e9c44,null))[_0x30f9('0x31')](function(_0x44a784){if(_0x44a784){var _0x57258e=_0x44a784['logo']&&fs['existsSync'](path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x4566bf,_[_0x30f9('0x62')](_0x44a784[_0x30f9('0x59')])))?path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x4566bf,_[_0x30f9('0x62')](_0x44a784[_0x30f9('0x59')])):path[_0x30f9('0x60')](config['root'],_0x4566bf,_[_0x30f9('0x62')](_0x30f9('0x63')));var _0x378293=_0x30f9('0x64')+_[_0x30f9('0x65')](_0x30f9('0x59'));if(_0x44a784[_0x378293]||!_0x556351[_0x30f9('0x66')]){_0x57258e=path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x4566bf,_['toLower'](_0x30f9('0x63')));}if(!fs['existsSync'](_0x57258e)){throw new db[(_0x30f9('0x67'))][(_0x30f9('0x68'))](_['upperFirst']('logo')+_0x30f9('0x69'));}return _0x1e9c44[_0x30f9('0x6a')](_0x57258e);}})[_0x30f9('0x26')](handleError(_0x1e9c44,null));};var utilLicense=require('../../config/license/util');exports[_0x30f9('0x6b')]=function(_0x3d420b,_0x55fba3,_0x3b8d8a){var _0x2e8f92=_0x30f9('0x5c');var _0x3be697={'custom':![]};return utilLicense[_0x30f9('0x6c')]()['then'](function(_0x3b74b0){if(_0x3b74b0){_0x3be697=_0x3b74b0;}return db[_0x30f9('0x4b')]['find']({'where':{'id':_0x3d420b[_0x30f9('0x4e')]['id']},'attributes':['logo',_0x30f9('0x5d'),'preferred',_0x30f9('0x6d'),_0x30f9('0x5e'),_0x30f9('0x5f'),'defaultPreferred',_0x30f9('0x6e')],'raw':!![]});})[_0x30f9('0x31')](handleEntityNotFound(_0x55fba3,null))[_0x30f9('0x31')](function(_0x3a0c9d){if(_0x3a0c9d){var _0x10082a=_0x3a0c9d[_0x30f9('0x5d')]&&fs[_0x30f9('0x6f')](path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x2e8f92,_[_0x30f9('0x62')](_0x3a0c9d[_0x30f9('0x5d')])))?path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x2e8f92,_[_0x30f9('0x62')](_0x3a0c9d['loginLogo'])):path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x2e8f92,_['toLower'](_0x30f9('0x70')));var _0x113def=_0x30f9('0x64')+_[_0x30f9('0x65')]('loginLogo');if(_0x3a0c9d[_0x113def]||!_0x3be697[_0x30f9('0x66')]){_0x10082a=path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x2e8f92,_[_0x30f9('0x62')](_0x30f9('0x70')));}if(!fs['existsSync'](_0x10082a)){throw new db[(_0x30f9('0x67'))][(_0x30f9('0x68'))](_[_0x30f9('0x65')](_0x30f9('0x5d'))+_0x30f9('0x69'));}return _0x55fba3[_0x30f9('0x6a')](_0x10082a);}})[_0x30f9('0x26')](handleError(_0x55fba3,null));};exports[_0x30f9('0x71')]=function(_0x141b64,_0x5a326a){return db[_0x30f9('0x4b')]['find']({'where':{'id':_0x141b64[_0x30f9('0x4e')]['id']},'attributes':[_0x30f9('0x72')]})['then'](respondWithResult(_0x5a326a,null))[_0x30f9('0x26')](handleError(_0x5a326a,null));};exports['addPreferred']=function(_0x3feae7,_0x57fa25,_0x495602){if(_0x3feae7[_0x30f9('0x57')]&&_0x3feae7[_0x30f9('0x57')][_0x30f9('0x58')]){_0x3feae7['body'][_0x30f9('0x73')]=_0x3feae7[_0x30f9('0x57')]['filename'];}return db[_0x30f9('0x4b')][_0x30f9('0x55')]({'where':{'id':_0x3feae7[_0x30f9('0x4e')]['id']}})[_0x30f9('0x31')](handleEntityNotFound(_0x57fa25,null))['then'](saveUpdates(_0x3feae7[_0x30f9('0x54')],null))[_0x30f9('0x31')](respondWithResult(_0x57fa25,null))[_0x30f9('0x26')](handleError(_0x57fa25,null));};var utilLicense=require(_0x30f9('0x16'));exports['getPreferred']=function(_0x468675,_0x9915fd,_0x259d6a){var _0x14cef9=_0x30f9('0x5c');var _0x95f48b={'custom':![]};return utilLicense[_0x30f9('0x6c')]()[_0x30f9('0x31')](function(_0x41ede6){if(_0x41ede6){_0x95f48b=_0x41ede6;}return db[_0x30f9('0x4b')][_0x30f9('0x55')]({'where':{'id':_0x468675[_0x30f9('0x4e')]['id']},'attributes':[_0x30f9('0x59'),'loginLogo',_0x30f9('0x73'),_0x30f9('0x6d'),_0x30f9('0x5e'),_0x30f9('0x5f'),_0x30f9('0x74'),_0x30f9('0x6e')],'raw':!![]});})[_0x30f9('0x31')](handleEntityNotFound(_0x9915fd,null))[_0x30f9('0x31')](function(_0x2a508e){if(_0x2a508e){var _0x490de7=_0x2a508e[_0x30f9('0x73')]&&fs['existsSync'](path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x14cef9,_['toLower'](_0x2a508e[_0x30f9('0x73')])))?path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x14cef9,_[_0x30f9('0x62')](_0x2a508e[_0x30f9('0x73')])):path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x14cef9,_[_0x30f9('0x62')](_0x30f9('0x75')));var _0x31901d='default'+_[_0x30f9('0x65')](_0x30f9('0x73'));if(_0x2a508e[_0x31901d]||!_0x95f48b['custom']||!_0x95f48b[_0x30f9('0x73')]){_0x490de7=path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x14cef9,_[_0x30f9('0x62')](_0x30f9('0x75')));}if(!fs[_0x30f9('0x6f')](_0x490de7)){throw new db[(_0x30f9('0x67'))]['ValidationError'](_['upperFirst']('preferred')+_0x30f9('0x69'));}return _0x9915fd[_0x30f9('0x6a')](_0x490de7);}})[_0x30f9('0x26')](handleError(_0x9915fd,null));};exports[_0x30f9('0x76')]=function(_0x9c8597,_0x3b0006,_0x380417){if(_0x9c8597[_0x30f9('0x57')]&&_0x9c8597[_0x30f9('0x57')][_0x30f9('0x58')]){_0x9c8597[_0x30f9('0x54')][_0x30f9('0x6d')]=_0x9c8597['file'][_0x30f9('0x58')];}return db['Setting'][_0x30f9('0x55')]({'where':{'id':_0x9c8597[_0x30f9('0x4e')]['id']}})[_0x30f9('0x31')](handleEntityNotFound(_0x3b0006,null))[_0x30f9('0x31')](saveUpdates(_0x9c8597['body'],null))['then'](respondWithResult(_0x3b0006,null))['catch'](handleError(_0x3b0006,null));};var utilLicense=require('../../config/license/util');exports[_0x30f9('0x77')]=function(_0x4fe293,_0x197fea,_0x5dc11d){var _0x57d1fc=_0x30f9('0x5c');var _0x1ff880={'custom':![]};return utilLicense[_0x30f9('0x6c')]()['then'](function(_0x32c6e5){if(_0x32c6e5){_0x1ff880=_0x32c6e5;}return db['Setting'][_0x30f9('0x55')]({'where':{'id':_0x4fe293['params']['id']},'attributes':[_0x30f9('0x59'),_0x30f9('0x5d'),'preferred',_0x30f9('0x6d'),_0x30f9('0x5e'),'defaultLoginLogo','defaultPreferred',_0x30f9('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0x197fea,null))[_0x30f9('0x31')](function(_0x5b7b0c){if(_0x5b7b0c){var _0xdbffe3=_0x5b7b0c[_0x30f9('0x6d')]&&fs[_0x30f9('0x6f')](path['join'](config['root'],_0x57d1fc,_[_0x30f9('0x62')](_0x5b7b0c['favicon'])))?path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x57d1fc,_[_0x30f9('0x62')](_0x5b7b0c[_0x30f9('0x6d')])):path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x57d1fc,_[_0x30f9('0x62')](_0x30f9('0x78')));var _0x4797f4=_0x30f9('0x64')+_[_0x30f9('0x65')](_0x30f9('0x6d'));if(_0x5b7b0c[_0x4797f4]||!_0x1ff880[_0x30f9('0x66')]){_0xdbffe3=path[_0x30f9('0x60')](config[_0x30f9('0x61')],_0x57d1fc,_[_0x30f9('0x62')](_0x30f9('0x78')));}if(!fs['existsSync'](_0xdbffe3)){throw new db[(_0x30f9('0x67'))][(_0x30f9('0x68'))](_[_0x30f9('0x65')]('favicon')+'\x20not\x20found');}return _0x197fea['download'](_0xdbffe3);}})[_0x30f9('0x26')](handleError(_0x197fea,null));};exports['getDate']=function(_0xa97410,_0x106783){var _0x525e13={'offset':moment()[_0x30f9('0x79')]()};_0x525e13['now']=moment()[_0x30f9('0x79')](_0x525e13[_0x30f9('0x2c')])[_0x30f9('0x7a')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x106783[_0x30f9('0x27')](0xc8)[_0x30f9('0x37')](_0x525e13);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a784877..478d827 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x1a0a6e,_0x4da742){var _0x42b548=function(_0xcadf2c){while(--_0xcadf2c){_0x1a0a6e['push'](_0x1a0a6e['shift']());}};_0x42b548(++_0x4da742);}(_0xe14b,0x93));var _0xbe14=function(_0xbe84aa,_0x3bfdc2){_0xbe84aa=_0xbe84aa-0x0;var _0x1e3d84=_0xe14b[_0xbe84aa];return _0x1e3d84;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x2efd1,_0xb668c7){var _0x20ec91=function(_0x5bd040){while(--_0x5bd040){_0x2efd1['push'](_0x2efd1['shift']());}};_0x20ec91(++_0xb668c7);}(_0xedd9,0xfc));var _0x9edd=function(_0x328cf7,_0x2c7d51){_0x328cf7=_0x328cf7-0x0;var _0x9e596d=_0xedd9[_0x328cf7];return _0x9e596d;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f847231..b8dd120 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 _0x2d0c=['then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','Setting,\x20%s,\x20%s','result','ShowSetting','Setting','find','options','raw','where','attributes','map','include','model','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x4f9200,_0x19cc2a){var _0x4fea26=function(_0x7364ee){while(--_0x7364ee){_0x4f9200['push'](_0x4f9200['shift']());}};_0x4fea26(++_0x19cc2a);}(_0x2d0c,0x130));var _0xc2d0=function(_0x10a548,_0x26a534){_0x10a548=_0x10a548-0x0;var _0x2a8b3b=_0x2d0c[_0x10a548];return _0x2a8b3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc2d0('0x0'));var BPromise=require('bluebird');var rs=require(_0xc2d0('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc2d0('0x2'));var logger=require(_0xc2d0('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc2d0('0x4'));var client=jayson[_0xc2d0('0x5')][_0xc2d0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1fffeb,_0x59db47,_0xc9a724){return new BPromise(function(_0x743dd1,_0x13d6a2){return client[_0xc2d0('0x7')](_0x1fffeb,_0xc9a724)[_0xc2d0('0x8')](function(_0x119d2d){logger[_0xc2d0('0x9')]('Setting,\x20%s,\x20%s',_0x59db47,_0xc2d0('0xa'));logger['debug'](_0xc2d0('0xb'),_0x59db47,_0xc2d0('0xa'),JSON['stringify'](_0x119d2d));if(_0x119d2d['error']){if(_0x119d2d[_0xc2d0('0xc')]['code']===0x1f4){logger[_0xc2d0('0xc')]('Setting,\x20%s,\x20%s',_0x59db47,_0x119d2d[_0xc2d0('0xc')][_0xc2d0('0xd')]);return _0x13d6a2(_0x119d2d[_0xc2d0('0xc')][_0xc2d0('0xd')]);}logger[_0xc2d0('0xc')](_0xc2d0('0xe'),_0x59db47,_0x119d2d[_0xc2d0('0xc')][_0xc2d0('0xd')]);return _0x743dd1(_0x119d2d['error'][_0xc2d0('0xd')]);}else{logger[_0xc2d0('0x9')](_0xc2d0('0xe'),_0x59db47,'request\x20sent');_0x743dd1(_0x119d2d[_0xc2d0('0xf')][_0xc2d0('0xd')]);}})['catch'](function(_0x1787eb){logger[_0xc2d0('0xc')](_0xc2d0('0xe'),_0x59db47,_0x1787eb);_0x13d6a2(_0x1787eb);});});}exports[_0xc2d0('0x10')]=function(_0x471065){var _0x5f49fe=this;return new Promise(function(_0x160026,_0x228da6){return db[_0xc2d0('0x11')][_0xc2d0('0x12')]({'raw':_0x471065[_0xc2d0('0x13')]?_0x471065['options'][_0xc2d0('0x14')]===undefined?!![]:![]:!![],'where':_0x471065[_0xc2d0('0x13')]?_0x471065['options'][_0xc2d0('0x15')]||null:null,'attributes':_0x471065['options']?_0x471065[_0xc2d0('0x13')][_0xc2d0('0x16')]||null:null,'include':_0x471065[_0xc2d0('0x13')]?_0x471065[_0xc2d0('0x13')]['include']?_[_0xc2d0('0x17')](_0x471065[_0xc2d0('0x13')][_0xc2d0('0x18')],function(_0x54cc0e){return{'model':db[_0x54cc0e['model']],'as':_0x54cc0e['as'],'attributes':_0x54cc0e[_0xc2d0('0x16')],'include':_0x54cc0e[_0xc2d0('0x18')]?_[_0xc2d0('0x17')](_0x54cc0e['include'],function(_0x5af588){return{'model':db[_0x5af588['model']],'as':_0x5af588['as'],'attributes':_0x5af588['attributes'],'include':_0x5af588[_0xc2d0('0x18')]?_[_0xc2d0('0x17')](_0x5af588[_0xc2d0('0x18')],function(_0x49d322){return{'model':db[_0x49d322[_0xc2d0('0x19')]],'as':_0x49d322['as'],'attributes':_0x49d322['attributes']};}):[]};}):[]};}):[]:[]})[_0xc2d0('0x8')](function(_0x548a2c){logger['info'](_0xc2d0('0x10'),_0x471065);logger['debug']('ShowSetting',_0x471065,JSON['stringify'](_0x548a2c));_0x160026(_0x548a2c);})['catch'](function(_0x28181d){logger[_0xc2d0('0xc')](_0xc2d0('0x10'),_0x28181d[_0xc2d0('0xd')],_0x471065);_0x228da6(_0x5f49fe[_0xc2d0('0xc')](0x1f4,_0x28181d[_0xc2d0('0xd')]));});});}; \ No newline at end of file +var _0xe8cd=['error','code','Setting,\x20%s,\x20%s','message','result','catch','find','options','raw','where','include','map','model','attributes','then','ShowSetting','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x219dda,_0x5c1155){var _0x1bceb9=function(_0x1c1e20){while(--_0x1c1e20){_0x219dda['push'](_0x219dda['shift']());}};_0x1bceb9(++_0x5c1155);}(_0xe8cd,0x6d));var _0xde8c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xe8cd[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xde8c('0x0'));var util=require(_0xde8c('0x1'));var moment=require('moment');var BPromise=require(_0xde8c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde8c('0x3'));var db=require(_0xde8c('0x4'))['db'];var utils=require(_0xde8c('0x5'));var logger=require('../../config/logger')(_0xde8c('0x6'));var config=require(_0xde8c('0x7'));var jayson=require(_0xde8c('0x8'));var client=jayson['client'][_0xde8c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x520ff9,_0x51c504,_0xad7398){return new BPromise(function(_0x53e101,_0x4605c7){return client[_0xde8c('0xa')](_0x520ff9,_0xad7398)['then'](function(_0x4a8bd6){logger['info']('Setting,\x20%s,\x20%s',_0x51c504,'request\x20sent');logger[_0xde8c('0xb')](_0xde8c('0xc'),_0x51c504,_0xde8c('0xd'),JSON[_0xde8c('0xe')](_0x4a8bd6));if(_0x4a8bd6['error']){if(_0x4a8bd6[_0xde8c('0xf')][_0xde8c('0x10')]===0x1f4){logger['error'](_0xde8c('0x11'),_0x51c504,_0x4a8bd6[_0xde8c('0xf')][_0xde8c('0x12')]);return _0x4605c7(_0x4a8bd6[_0xde8c('0xf')]['message']);}logger[_0xde8c('0xf')](_0xde8c('0x11'),_0x51c504,_0x4a8bd6[_0xde8c('0xf')][_0xde8c('0x12')]);return _0x53e101(_0x4a8bd6[_0xde8c('0xf')][_0xde8c('0x12')]);}else{logger['info'](_0xde8c('0x11'),_0x51c504,'request\x20sent');_0x53e101(_0x4a8bd6[_0xde8c('0x13')][_0xde8c('0x12')]);}})[_0xde8c('0x14')](function(_0x329b4f){logger['error'](_0xde8c('0x11'),_0x51c504,_0x329b4f);_0x4605c7(_0x329b4f);});});}exports['ShowSetting']=function(_0x39cb7e){var _0x127ffa=this;return new Promise(function(_0x59df64,_0x2800fa){return db['Setting'][_0xde8c('0x15')]({'raw':_0x39cb7e[_0xde8c('0x16')]?_0x39cb7e[_0xde8c('0x16')][_0xde8c('0x17')]===undefined?!![]:![]:!![],'where':_0x39cb7e[_0xde8c('0x16')]?_0x39cb7e[_0xde8c('0x16')][_0xde8c('0x18')]||null:null,'attributes':_0x39cb7e[_0xde8c('0x16')]?_0x39cb7e['options']['attributes']||null:null,'include':_0x39cb7e['options']?_0x39cb7e[_0xde8c('0x16')][_0xde8c('0x19')]?_[_0xde8c('0x1a')](_0x39cb7e[_0xde8c('0x16')][_0xde8c('0x19')],function(_0x499483){return{'model':db[_0x499483[_0xde8c('0x1b')]],'as':_0x499483['as'],'attributes':_0x499483['attributes'],'include':_0x499483[_0xde8c('0x19')]?_[_0xde8c('0x1a')](_0x499483[_0xde8c('0x19')],function(_0x3cdf76){return{'model':db[_0x3cdf76['model']],'as':_0x3cdf76['as'],'attributes':_0x3cdf76[_0xde8c('0x1c')],'include':_0x3cdf76[_0xde8c('0x19')]?_[_0xde8c('0x1a')](_0x3cdf76[_0xde8c('0x19')],function(_0x552634){return{'model':db[_0x552634[_0xde8c('0x1b')]],'as':_0x552634['as'],'attributes':_0x552634[_0xde8c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xde8c('0x1d')](function(_0x53cf54){logger['info']('ShowSetting',_0x39cb7e);logger[_0xde8c('0xb')]('ShowSetting',_0x39cb7e,JSON['stringify'](_0x53cf54));_0x59df64(_0x53cf54);})['catch'](function(_0x49397f){logger[_0xde8c('0xf')](_0xde8c('0x1e'),_0x49397f[_0xde8c('0x12')],_0x39cb7e);_0x2800fa(_0x127ffa[_0xde8c('0xf')](0x1f4,_0x49397f[_0xde8c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 4823502..5005652 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 _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x5b7327,_0x3da7cc){var _0x1518a1=function(_0x32345a){while(--_0x32345a){_0x5b7327['push'](_0x5b7327['shift']());}};_0x1518a1(++_0x3da7cc);}(_0x326f,0xd1));var _0xf326=function(_0x1d072e,_0x1bbda3){_0x1d072e=_0x1d072e-0x0;var _0x50f08e=_0x326f[_0x1d072e];return _0x50f08e;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +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(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x814b,0x1a2));var _0xb814=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x814b[_0x406e46];return _0x4a3742;};'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 diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index db0a3d2..c31d00a 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 _0x3c0f=['csc','ENUM','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name','STRING','generate','twilio','skebby','clicksend','plivo','bandwidth'];(function(_0x12db17,_0x3ad2af){var _0x3d001d=function(_0x146598){while(--_0x146598){_0x12db17['push'](_0x12db17['shift']());}};_0x3d001d(++_0x3ad2af);}(_0x3c0f,0xa9));var _0xf3c0=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x3c0f[_0xffa198];return _0x1e4b50;};'use strict';var Sequelize=require(_0xf3c0('0x0'));var rs=require(_0xf3c0('0x1'));module[_0xf3c0('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xf3c0('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf3c0('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xf3c0('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xf3c0('0x4')],'defaultValue':function(){return rs[_0xf3c0('0x5')]();}},'phone':{'type':Sequelize[_0xf3c0('0x4')]},'type':{'type':Sequelize['ENUM'](_0xf3c0('0x6'),_0xf3c0('0x7'),'connectel',_0xf3c0('0x8'),_0xf3c0('0x9'),'clickatell',_0xf3c0('0xa'),_0xf3c0('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xf3c0('0x4')]},'authId':{'type':Sequelize[_0xf3c0('0x4')]},'authToken':{'type':Sequelize[_0xf3c0('0x4')]},'smsMethod':{'type':Sequelize[_0xf3c0('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xf3c0('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xf3c0('0x4')]},'applicationId':{'type':Sequelize[_0xf3c0('0x4')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xf3c0('0x4')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf3c0('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf3c0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf3c0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf3c0('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf3c0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf3c0('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xf3c0('0xf')],'defaultValue':![],'comment':_0xf3c0('0x11'),'set':function(_0x663b6b){if(!_0x663b6b)this[_0xf3c0('0x12')](_0xf3c0('0x13'),null);this['setDataValue']('mandatoryDisposition',_0x663b6b);}}}; \ No newline at end of file +var _0xec4f=['generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','name','STRING'];(function(_0x28dd5f,_0x58f45b){var _0x26a117=function(_0x1933e8){while(--_0x1933e8){_0x28dd5f['push'](_0x28dd5f['shift']());}};_0x26a117(++_0x58f45b);}(_0xec4f,0x18b));var _0xfec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec4f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfec4('0x0'));var rs=require(_0xfec4('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xfec4('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xfec4('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xfec4('0x3')],'defaultValue':function(){return rs[_0xfec4('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfec4('0x5')](_0xfec4('0x6'),'skebby',_0xfec4('0x7'),_0xfec4('0x8'),_0xfec4('0x9'),_0xfec4('0xa'),_0xfec4('0xb'),_0xfec4('0xc'),_0xfec4('0xd'),_0xfec4('0xe'))},'accountSid':{'type':Sequelize[_0xfec4('0x3')]},'authId':{'type':Sequelize[_0xfec4('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xfec4('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xfec4('0x3')]},'password':{'type':Sequelize[_0xfec4('0x3')]},'apiKey':{'type':Sequelize[_0xfec4('0x3')]},'applicationId':{'type':Sequelize[_0xfec4('0x3')]},'accountId':{'type':Sequelize[_0xfec4('0x3')]},'senderString':{'type':Sequelize[_0xfec4('0x3')]},'deliveryReport':{'type':Sequelize[_0xfec4('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xfec4('0x3')]},'notificationTemplate':{'type':Sequelize[_0xfec4('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfec4('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfec4('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfec4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfec4('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfec4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfec4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfec4('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfec4('0x11')],'comment':_0xfec4('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xfec4('0xf')],'defaultValue':![],'comment':_0xfec4('0x13'),'set':function(_0x15a4f8){if(!_0x15a4f8)this[_0xfec4('0x14')]('mandatoryDispositionPauseId',null);this[_0xfec4('0x14')]('mandatoryDisposition',_0x15a4f8);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a7104c9..a9fe4fd 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 _0xd77e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','connectel','clicksend','message_id','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','list','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','DESC','List','out','SmsMessage','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','omit','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf'];(function(_0x483568,_0x334484){var _0x16b377=function(_0x25342b){while(--_0x25342b){_0x483568['push'](_0x483568['shift']());}};_0x16b377(++_0x334484);}(_0xd77e,0xe2));var _0xed77=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd77e[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xed77('0x0'));var rimraf=require(_0xed77('0x1'));var zipdir=require(_0xed77('0x2'));var jsonpatch=require(_0xed77('0x3'));var rp=require(_0xed77('0x4'));var moment=require(_0xed77('0x5'));var BPromise=require(_0xed77('0x6'));var Mustache=require(_0xed77('0x7'));var util=require(_0xed77('0x8'));var path=require(_0xed77('0x9'));var sox=require('sox');var csv=require(_0xed77('0xa'));var ejs=require(_0xed77('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed77('0xc'));var squel=require(_0xed77('0xd'));var crypto=require(_0xed77('0xe'));var jsforce=require(_0xed77('0xf'));var deskjs=require(_0xed77('0x10'));var toCsv=require(_0xed77('0xa'));var querystring=require('querystring');var Papa=require(_0xed77('0x11'));var Redis=require(_0xed77('0x12'));var authService=require(_0xed77('0x13'));var qs=require(_0xed77('0x14'));var as=require(_0xed77('0x15'));var hardwareService=require(_0xed77('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xed77('0x17'));var licenseUtil=require(_0xed77('0x18'));var db=require(_0xed77('0x19'))['db'];config['redis']=_[_0xed77('0x1a')](config[_0xed77('0x1b')],{'host':_0xed77('0x1c'),'port':0x18eb});var socket=require(_0xed77('0x1d'))(new Redis(config[_0xed77('0x1b')]));require(_0xed77('0x1e'))[_0xed77('0x1f')](socket);var jayson=require(_0xed77('0x20'));var client=jayson['client'][_0xed77('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x39cdbd,_0x2cf9d1,_0x287365,_0x230f2f){return new BPromise(function(_0xea2a12,_0x484dab){var _0x58e823=_0x230f2f||client;return _0x58e823['request'](_0x39cdbd,_0x287365)[_0xed77('0x22')](function(_0x59e66e){logger[_0xed77('0x23')](_0xed77('0x24'),_0x2cf9d1,_0xed77('0x25'));logger[_0xed77('0x26')](_0xed77('0x27'),_0x2cf9d1,_0xed77('0x25'),JSON[_0xed77('0x28')](_0x59e66e));if(_0x59e66e['error']){if(_0x59e66e[_0xed77('0x29')][_0xed77('0x2a')]===0x1f4){logger[_0xed77('0x29')](_0xed77('0x24'),_0x2cf9d1,_0x59e66e['error'][_0xed77('0x2b')]);return _0x484dab(_0x59e66e[_0xed77('0x29')][_0xed77('0x2b')]);}logger[_0xed77('0x29')]('SmsAccount,\x20%s,\x20%s',_0x2cf9d1,_0x59e66e[_0xed77('0x29')][_0xed77('0x2b')]);return _0xea2a12(_0x59e66e[_0xed77('0x29')][_0xed77('0x2b')]);}else{logger[_0xed77('0x23')](_0xed77('0x24'),_0x2cf9d1,_0xed77('0x25'));_0xea2a12(_0x59e66e[_0xed77('0x2c')]['message']);}})['catch'](function(_0x3fa950){logger[_0xed77('0x29')](_0xed77('0x24'),_0x2cf9d1,_0x3fa950);_0x484dab(_0x3fa950);});});}function respondWithStatusCode(_0x266425,_0x356831){_0x356831=_0x356831||0xcc;return function(_0x2b3691){if(_0x2b3691){return _0x266425[_0xed77('0x2d')](_0x356831);}return _0x266425[_0xed77('0x2e')](_0x356831)[_0xed77('0x2f')]();};}function respondWithResult(_0x3d63e0,_0x310164){_0x310164=_0x310164||0xc8;return function(_0x51999e){if(_0x51999e){return _0x3d63e0[_0xed77('0x2e')](_0x310164)[_0xed77('0x30')](_0x51999e);}};}function respondWithFilteredResult(_0x1205bf,_0x15ab38){return function(_0x528f73){if(_0x528f73){var _0x44b96d=typeof _0x15ab38[_0xed77('0x31')]===_0xed77('0x32')&&typeof _0x15ab38['limit']===_0xed77('0x32');var _0x3be8b7=_0x528f73[_0xed77('0x33')];var _0x22e3ba=_0x44b96d?0x0:_0x15ab38[_0xed77('0x31')];var _0x3ceef=_0x44b96d?_0x528f73[_0xed77('0x33')]:_0x15ab38[_0xed77('0x31')]+_0x15ab38[_0xed77('0x34')];var _0x3b1718;if(_0x3ceef>=_0x3be8b7){_0x3ceef=_0x3be8b7;_0x3b1718=0xc8;}else{_0x3b1718=0xce;}_0x1205bf[_0xed77('0x2e')](_0x3b1718);return _0x1205bf[_0xed77('0x35')](_0xed77('0x36'),_0x22e3ba+'-'+_0x3ceef+'/'+_0x3be8b7)['json'](_0x528f73);}return null;};}function patchUpdates(_0x2c4829){return function(_0x419246){try{jsonpatch[_0xed77('0x37')](_0x419246,_0x2c4829,!![]);}catch(_0x5e3ea1){return BPromise['reject'](_0x5e3ea1);}return _0x419246[_0xed77('0x38')]();};}function saveUpdates(_0x2a0502,_0x15d29e){return function(_0x3209be){if(_0x3209be){return _0x3209be[_0xed77('0x39')](_0x2a0502)[_0xed77('0x22')](function(_0x29d1f3){return _0x29d1f3;});}return null;};}function removeEntity(_0x239e07,_0x3bbbd2){return function(_0x1e75b4){if(_0x1e75b4){return _0x1e75b4[_0xed77('0x3a')]()[_0xed77('0x22')](function(){var _0x91d3d5=_0x1e75b4[_0xed77('0x3b')]({'plain':!![]});var _0x144a52='SmsAccounts';return db['UserProfileResource'][_0xed77('0x3a')]({'where':{'type':_0x144a52,'resourceId':_0x91d3d5['id']}})[_0xed77('0x22')](function(){return _0x1e75b4;});})[_0xed77('0x22')](function(){_0x239e07[_0xed77('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3178d9,_0x3bea05){return function(_0x3875d1){if(!_0x3875d1){_0x3178d9[_0xed77('0x2d')](0x194);}return _0x3875d1;};}function handleError(_0x7e91a2,_0x4d280d){_0x4d280d=_0x4d280d||0x1f4;return function(_0x5a5aeb){logger['error'](_0x5a5aeb['stack']);if(_0x5a5aeb[_0xed77('0x3c')]){delete _0x5a5aeb[_0xed77('0x3c')];}_0x7e91a2[_0xed77('0x2e')](_0x4d280d)[_0xed77('0x3d')](_0x5a5aeb);};}exports['index']=function(_0x36bc0e,_0x4442f8){var _0x156df2={'include':[{'model':db[_0xed77('0x3e')],'as':_0xed77('0x3f')}]},_0x3a5b7f={},_0x271eb5={'count':0x0,'rows':[]};var _0x63189a=_[_0xed77('0x40')](db[_0xed77('0x41')][_0xed77('0x42')],function(_0x4d4a84){return{'name':_0x4d4a84[_0xed77('0x43')],'type':_0x4d4a84[_0xed77('0x44')]['key']};});_0x3a5b7f[_0xed77('0x45')]=_[_0xed77('0x40')](_0x63189a,'name');_0x3a5b7f[_0xed77('0x46')]=_['keys'](_0x36bc0e['query']);_0x3a5b7f['filters']=_[_0xed77('0x47')](_0x3a5b7f[_0xed77('0x45')],_0x3a5b7f['query']);_0x156df2[_0xed77('0x48')]=_[_0xed77('0x47')](_0x3a5b7f[_0xed77('0x45')],qs[_0xed77('0x49')](_0x36bc0e[_0xed77('0x46')][_0xed77('0x49')]));_0x156df2[_0xed77('0x48')]=_0x156df2[_0xed77('0x48')][_0xed77('0x4a')]?_0x156df2[_0xed77('0x48')]:_0x3a5b7f[_0xed77('0x45')];if(!_0x36bc0e[_0xed77('0x46')][_0xed77('0x4b')](_0xed77('0x4c'))){_0x156df2['limit']=qs[_0xed77('0x34')](_0x36bc0e[_0xed77('0x46')][_0xed77('0x34')]);_0x156df2[_0xed77('0x31')]=qs['offset'](_0x36bc0e[_0xed77('0x46')][_0xed77('0x31')]);}_0x156df2['order']=qs[_0xed77('0x4d')](_0x36bc0e[_0xed77('0x46')][_0xed77('0x4d')]);_0x156df2[_0xed77('0x4e')]=qs[_0xed77('0x4f')](_[_0xed77('0x50')](_0x36bc0e[_0xed77('0x46')],_0x3a5b7f[_0xed77('0x4f')]),_0x63189a);if(_0x36bc0e[_0xed77('0x46')][_0xed77('0x51')]){_0x156df2[_0xed77('0x4e')]=_[_0xed77('0x52')](_0x156df2['where'],{'$or':_['map'](_0x63189a,function(_0x550221){if(_0x550221[_0xed77('0x44')]!==_0xed77('0x53')){var _0x416d46={};_0x416d46[_0x550221[_0xed77('0x3c')]]={'$like':'%'+_0x36bc0e['query'][_0xed77('0x51')]+'%'};return _0x416d46;}})});}_0x156df2=_[_0xed77('0x52')]({},_0x156df2,_0x36bc0e[_0xed77('0x54')]);var _0x4333c4={'where':_0x156df2[_0xed77('0x4e')]};return db[_0xed77('0x41')][_0xed77('0x33')](_0x4333c4)['then'](function(_0x29a38f){_0x271eb5['count']=_0x29a38f;if(_0x36bc0e['query']['includeAll']){_0x156df2[_0xed77('0x55')]=[{'all':!![]}];}return db[_0xed77('0x41')]['findAll'](_0x156df2);})[_0xed77('0x22')](function(_0x23a574){_0x271eb5[_0xed77('0x56')]=_0x23a574;return _0x271eb5;})['then'](respondWithFilteredResult(_0x4442f8,_0x156df2))[_0xed77('0x57')](handleError(_0x4442f8,null));};exports[_0xed77('0x58')]=function(_0xa5a5ac,_0x5601eb){var _0x555ff2={'raw':![],'where':{'id':_0xa5a5ac[_0xed77('0x59')]['id']},'include':[{'model':db[_0xed77('0x3e')],'as':'mandatoryDispositionPause'}]},_0x17d0b2={};_0x17d0b2[_0xed77('0x45')]=_[_0xed77('0x5a')](db['SmsAccount'][_0xed77('0x42')]);_0x17d0b2[_0xed77('0x46')]=_[_0xed77('0x5a')](_0xa5a5ac[_0xed77('0x46')]);_0x17d0b2['filters']=_[_0xed77('0x47')](_0x17d0b2['model'],_0x17d0b2[_0xed77('0x46')]);_0x555ff2[_0xed77('0x48')]=_[_0xed77('0x47')](_0x17d0b2[_0xed77('0x45')],qs['fields'](_0xa5a5ac['query'][_0xed77('0x49')]));_0x555ff2[_0xed77('0x48')]=_0x555ff2[_0xed77('0x48')][_0xed77('0x4a')]?_0x555ff2[_0xed77('0x48')]:_0x17d0b2[_0xed77('0x45')];if(_0xa5a5ac[_0xed77('0x46')][_0xed77('0x5b')]){_0x555ff2[_0xed77('0x55')]=[{'all':!![]}];}_0x555ff2=_[_0xed77('0x52')]({},_0x555ff2,_0xa5a5ac[_0xed77('0x54')]);return db[_0xed77('0x41')][_0xed77('0x5c')](_0x555ff2)['then'](handleEntityNotFound(_0x5601eb,null))['then'](respondWithResult(_0x5601eb,null))[_0xed77('0x57')](handleError(_0x5601eb,null));};exports[_0xed77('0x5d')]=function(_0x37bce6,_0x531c0a){return db[_0xed77('0x41')][_0xed77('0x5d')](_0x37bce6[_0xed77('0x5e')],{})[_0xed77('0x22')](function(_0x2eaf4d){var _0x1bd701=_0x37bce6[_0xed77('0x5f')][_0xed77('0x3b')]({'plain':!![]});if(!_0x1bd701)throw new Error(_0xed77('0x60'));if(_0x1bd701[_0xed77('0x61')]===_0xed77('0x5f')){var _0x206018=_0x2eaf4d[_0xed77('0x3b')]({'plain':!![]});var _0x141cc3=_0xed77('0x62');return db[_0xed77('0x63')][_0xed77('0x5c')]({'where':{'name':_0x141cc3,'userProfileId':_0x1bd701['userProfileId']},'raw':!![]})[_0xed77('0x22')](function(_0x372430){if(_0x372430&&_0x372430[_0xed77('0x64')]===0x0){return db[_0xed77('0x65')]['create']({'name':_0x206018[_0xed77('0x3c')],'resourceId':_0x206018['id'],'type':_0x372430[_0xed77('0x3c')],'sectionId':_0x372430['id']},{})[_0xed77('0x22')](function(){return _0x2eaf4d;});}else{return _0x2eaf4d;}})[_0xed77('0x57')](function(_0x4e1dbd){logger[_0xed77('0x29')](_0xed77('0x66'),_0x4e1dbd);throw _0x4e1dbd;});}return _0x2eaf4d;})[_0xed77('0x22')](respondWithResult(_0x531c0a,0xc9))[_0xed77('0x57')](handleError(_0x531c0a,null));};exports[_0xed77('0x39')]=function(_0x269178,_0x224fff){if(_0x269178[_0xed77('0x5e')]['id']){delete _0x269178[_0xed77('0x5e')]['id'];}return db[_0xed77('0x41')][_0xed77('0x5c')]({'where':{'id':_0x269178[_0xed77('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xed77('0x22')](handleEntityNotFound(_0x224fff,null))[_0xed77('0x22')](saveUpdates(_0x269178[_0xed77('0x5e')],null))['then'](respondWithResult(_0x224fff,null))[_0xed77('0x57')](handleError(_0x224fff,null));};exports['destroy']=function(_0x3f7e23,_0x443499){return db['SmsAccount'][_0xed77('0x5c')]({'where':{'id':_0x3f7e23[_0xed77('0x59')]['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x443499,null))[_0xed77('0x22')](removeEntity(_0x443499,null))[_0xed77('0x57')](handleError(_0x443499,null));};exports[_0xed77('0x67')]=function(_0x1047f2,_0x359cd7){return db[_0xed77('0x41')][_0xed77('0x67')]()['then'](respondWithResult(_0x359cd7,null))[_0xed77('0x57')](handleError(_0x359cd7,null));};exports['addDisposition']=function(_0xac6b60,_0x5c1c61,_0xe3ef53){if(_0xac6b60[_0xed77('0x5e')]['id']){delete _0xac6b60[_0xed77('0x5e')]['id'];}return db[_0xed77('0x41')][_0xed77('0x5c')]({'where':{'id':_0xac6b60[_0xed77('0x59')]['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x5c1c61,null))['then'](function(_0x25b101){if(_0x25b101){_0xac6b60[_0xed77('0x5e')][_0xed77('0x68')]=_0x25b101['id'];return db[_0xed77('0x69')][_0xed77('0x5d')](_0xac6b60[_0xed77('0x5e')]);}})['then'](respondWithResult(_0x5c1c61,null))[_0xed77('0x57')](handleError(_0x5c1c61,null));};exports[_0xed77('0x6a')]=function(_0x4d9980,_0x564ff1,_0xd84794){var _0x48e1eb={'raw':![],'where':{}};var _0xdc927={};var _0x6f9ed4={'count':0x0,'rows':[]};return db[_0xed77('0x41')][_0xed77('0x6b')]({'where':{'id':_0x4d9980[_0xed77('0x59')]['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x564ff1,null))[_0xed77('0x22')](function(_0x440be5){if(_0x440be5){_0xdc927[_0xed77('0x45')]=_[_0xed77('0x5a')](db[_0xed77('0x69')][_0xed77('0x42')]);_0xdc927[_0xed77('0x46')]=_[_0xed77('0x5a')](_0x4d9980['query']);_0xdc927[_0xed77('0x4f')]=_[_0xed77('0x47')](_0xdc927[_0xed77('0x45')],_0xdc927[_0xed77('0x46')]);_0x48e1eb['attributes']=_[_0xed77('0x47')](_0xdc927[_0xed77('0x45')],qs[_0xed77('0x49')](_0x4d9980[_0xed77('0x46')]['fields']));_0x48e1eb[_0xed77('0x48')]=_0x48e1eb[_0xed77('0x48')]['length']?_0x48e1eb[_0xed77('0x48')]:_0xdc927[_0xed77('0x45')];if(!_0x4d9980['query'][_0xed77('0x4b')](_0xed77('0x4c'))){_0x48e1eb[_0xed77('0x34')]=qs['limit'](_0x4d9980[_0xed77('0x46')][_0xed77('0x34')]);_0x48e1eb[_0xed77('0x31')]=qs[_0xed77('0x31')](_0x4d9980['query'][_0xed77('0x31')]);}_0x48e1eb[_0xed77('0x6c')]=qs[_0xed77('0x4d')](_0x4d9980['query'][_0xed77('0x4d')]);_0x48e1eb['where']=qs[_0xed77('0x4f')](_[_0xed77('0x50')](_0x4d9980[_0xed77('0x46')],_0xdc927[_0xed77('0x4f')]));_0x48e1eb[_0xed77('0x4e')]['SmsAccountId']=_0x440be5['id'];if(_0x4d9980[_0xed77('0x46')][_0xed77('0x51')]){_0x48e1eb[_0xed77('0x4e')]=_['merge'](_0x48e1eb['where'],{'$or':_[_0xed77('0x40')](_0x48e1eb['attributes'],function(_0x2fd743){var _0x478c74={};_0x478c74[_0x2fd743]={'$like':'%'+_0x4d9980['query'][_0xed77('0x51')]+'%'};return _0x478c74;})});}_0x48e1eb=_[_0xed77('0x52')]({},_0x48e1eb,_0x4d9980[_0xed77('0x54')]);return db[_0xed77('0x69')][_0xed77('0x33')]({'where':_0x48e1eb[_0xed77('0x4e')]})['then'](function(_0x4aeb2a){_0x6f9ed4[_0xed77('0x33')]=_0x4aeb2a;if(_0x4d9980[_0xed77('0x46')][_0xed77('0x5b')]){_0x48e1eb[_0xed77('0x55')]=[{'all':!![]}];}return db[_0xed77('0x69')][_0xed77('0x6d')](_0x48e1eb);})['then'](function(_0x5451bf){_0x6f9ed4['rows']=_0x5451bf;return _0x6f9ed4;});}})[_0xed77('0x22')](respondWithFilteredResult(_0x564ff1,_0x48e1eb))[_0xed77('0x57')](handleError(_0x564ff1,null));};exports[_0xed77('0x6e')]=function(_0x245034,_0x4cc7c5,_0x5560ea){return db[_0xed77('0x41')][_0xed77('0x5c')]({'where':{'id':_0x245034[_0xed77('0x59')]['id']}})['then'](handleEntityNotFound(_0x4cc7c5,null))[_0xed77('0x22')](function(_0x5738c3){if(_0x5738c3){return _0x5738c3['removeDispositions'](_0x245034[_0xed77('0x46')][_0xed77('0x6f')]);}})[_0xed77('0x22')](respondWithStatusCode(_0x4cc7c5,null))['catch'](handleError(_0x4cc7c5,null));};exports[_0xed77('0x70')]=function(_0x32047d,_0x4b448a,_0x2b8ca3){if(_0x32047d[_0xed77('0x5e')]['id']){delete _0x32047d[_0xed77('0x5e')]['id'];}return db[_0xed77('0x41')][_0xed77('0x5c')]({'where':{'id':_0x32047d[_0xed77('0x59')]['id']}})['then'](handleEntityNotFound(_0x4b448a,null))[_0xed77('0x22')](function(_0x1c8208){if(_0x1c8208){_0x32047d['body']['SmsAccountId']=_0x1c8208['id'];return db[_0xed77('0x71')][_0xed77('0x5d')](_0x32047d['body']);}})[_0xed77('0x22')](respondWithResult(_0x4b448a,null))[_0xed77('0x57')](handleError(_0x4b448a,null));};exports[_0xed77('0x72')]=function(_0xf95f6b,_0x54627c,_0x5e5074){var _0x29a2a3={'raw':![],'where':{}};var _0x20b5bc={};var _0x4282e4={'count':0x0,'rows':[]};return db[_0xed77('0x41')][_0xed77('0x6b')]({'where':{'id':_0xf95f6b[_0xed77('0x59')]['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x54627c,null))['then'](function(_0x9aa2bf){if(_0x9aa2bf){_0x20b5bc[_0xed77('0x45')]=_[_0xed77('0x5a')](db['CannedAnswer'][_0xed77('0x42')]);_0x20b5bc[_0xed77('0x46')]=_['keys'](_0xf95f6b[_0xed77('0x46')]);_0x20b5bc[_0xed77('0x4f')]=_[_0xed77('0x47')](_0x20b5bc[_0xed77('0x45')],_0x20b5bc[_0xed77('0x46')]);_0x29a2a3[_0xed77('0x48')]=_[_0xed77('0x47')](_0x20b5bc[_0xed77('0x45')],qs['fields'](_0xf95f6b['query'][_0xed77('0x49')]));_0x29a2a3[_0xed77('0x48')]=_0x29a2a3[_0xed77('0x48')][_0xed77('0x4a')]?_0x29a2a3[_0xed77('0x48')]:_0x20b5bc[_0xed77('0x45')];if(!_0xf95f6b[_0xed77('0x46')][_0xed77('0x4b')](_0xed77('0x4c'))){_0x29a2a3[_0xed77('0x34')]=qs[_0xed77('0x34')](_0xf95f6b[_0xed77('0x46')][_0xed77('0x34')]);_0x29a2a3[_0xed77('0x31')]=qs[_0xed77('0x31')](_0xf95f6b[_0xed77('0x46')]['offset']);}_0x29a2a3[_0xed77('0x6c')]=qs['sort'](_0xf95f6b[_0xed77('0x46')][_0xed77('0x4d')]);_0x29a2a3[_0xed77('0x4e')]=qs[_0xed77('0x4f')](_['pick'](_0xf95f6b[_0xed77('0x46')],_0x20b5bc[_0xed77('0x4f')]));_0x29a2a3['where'][_0xed77('0x68')]=_0x9aa2bf['id'];if(_0xf95f6b[_0xed77('0x46')][_0xed77('0x51')]){_0x29a2a3['where']=_[_0xed77('0x52')](_0x29a2a3[_0xed77('0x4e')],{'$or':_[_0xed77('0x40')](_0x29a2a3[_0xed77('0x48')],function(_0x28b607){var _0x1f7e71={};_0x1f7e71[_0x28b607]={'$like':'%'+_0xf95f6b[_0xed77('0x46')][_0xed77('0x51')]+'%'};return _0x1f7e71;})});}_0x29a2a3=_['merge']({},_0x29a2a3,_0xf95f6b[_0xed77('0x54')]);return db[_0xed77('0x71')]['count']({'where':_0x29a2a3[_0xed77('0x4e')]})[_0xed77('0x22')](function(_0x4e944b){_0x4282e4[_0xed77('0x33')]=_0x4e944b;if(_0xf95f6b[_0xed77('0x46')][_0xed77('0x5b')]){_0x29a2a3[_0xed77('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xed77('0x6d')](_0x29a2a3);})['then'](function(_0x187a89){_0x4282e4[_0xed77('0x56')]=_0x187a89;return _0x4282e4;});}})[_0xed77('0x22')](respondWithFilteredResult(_0x54627c,_0x29a2a3))['catch'](handleError(_0x54627c,null));};exports[_0xed77('0x73')]=function(_0x141ad8,_0x3a19bb,_0x50134b){return db['SmsAccount']['find']({'where':{'id':_0x141ad8['params']['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x3a19bb,null))['then'](function(_0x2d8378){if(_0x2d8378){return _0x2d8378[_0xed77('0x73')](_0x141ad8[_0xed77('0x46')][_0xed77('0x6f')]);}})[_0xed77('0x22')](respondWithStatusCode(_0x3a19bb,null))['catch'](handleError(_0x3a19bb,null));};exports[_0xed77('0x74')]=function(_0x5290dd,_0x1a5b5e,_0x35c444){var _0x4bdc35={'channel':_0xed77('0x75')};var _0xacea05=[];var _0x321092=[];var _0x2a6513={};return db['SmsAccount'][_0xed77('0x5c')]({'where':{'id':_0x5290dd[_0xed77('0x59')]['id']},'include':[{'model':db[_0xed77('0x76')],'as':_0xed77('0x77')}]})[_0xed77('0x22')](handleEntityNotFound(_0x1a5b5e,null))[_0xed77('0x22')](function(_0x51e59f){_0x4bdc35[_0xed77('0x78')]=_0x51e59f;_0x4bdc35[_0xed77('0x79')]=_['orderBy'](_0x51e59f['Applications'],[_0xed77('0x7a')],['asc']);if(_0x4bdc35[_0xed77('0x78')]['Applications']){delete _0x4bdc35[_0xed77('0x78')]['Applications'];}return db[_0xed77('0x7b')][_0xed77('0x67')]();})[_0xed77('0x22')](function(_0x7e60a4){if(!_0x7e60a4){throw new db['Sequelize'][(_0xed77('0x7c'))](_0xed77('0x7d'));}_0xacea05=_[_0xed77('0x7e')](_['keys'](_0x7e60a4),['createdAt',_0xed77('0x7f')]);_0x321092=_['difference'](_[_0xed77('0x5a')](_0x7e60a4),[_0xed77('0x80'),_0xed77('0x7f'),'CompanyId',_0xed77('0x81')]);_0x4bdc35[_0xed77('0x5e')]={'mapKey':_0xed77('0x82')};if(_0x4bdc35['account'][_0xed77('0x44')]){switch(_0x4bdc35[_0xed77('0x78')][_0xed77('0x44')]){case _0xed77('0x83'):_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x85')];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x5e')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x86')];_0x4bdc35['body'][_0xed77('0x87')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x88')];break;case'skebby':_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')]='+'+_0x5290dd[_0xed77('0x5e')][_0xed77('0x89')];_0x4bdc35[_0xed77('0x5e')]['body']=_0x5290dd['body'][_0xed77('0x8a')];break;case _0xed77('0x8b'):_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x84')];_0x4bdc35[_0xed77('0x5e')]['body']=_0x5290dd[_0xed77('0x5e')][_0xed77('0x2b')];break;case _0xed77('0x8c'):_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x84')];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x5e')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x5e')];_0x4bdc35['body']['messageId']=_0x5290dd['body'][_0xed77('0x8d')];break;case'plivo':_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')]=_0x5290dd['body'][_0xed77('0x85')];_0x4bdc35[_0xed77('0x5e')]['body']=_0x5290dd[_0xed77('0x5e')][_0xed77('0x8e')];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x87')]=_0x5290dd[_0xed77('0x5e')]['MessageUUID'];break;case _0xed77('0x8f'):_0x4bdc35[_0xed77('0x5e')]['from']='+'+_0x5290dd['body'][_0xed77('0x90')][0x0]['from'];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x5e')]=_0x5290dd['body'][_0xed77('0x90')][0x0]['text'];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x87')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x90')][0x0][_0xed77('0x87')];break;case _0xed77('0x91'):_0x4bdc35[_0xed77('0x5e')]['from']=_0x5290dd['body'][_0xed77('0x92')];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x5e')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x93')][_0xed77('0x2b')];break;case _0xed77('0x94'):_0x4bdc35[_0xed77('0x5e')]['from']=_0x5290dd[_0xed77('0x5e')][_0xed77('0x95')];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x5e')]=_0x5290dd[_0xed77('0x5e')]['text'];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x87')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x96')];break;case _0xed77('0x97'):_0x4bdc35[_0xed77('0x5e')][_0xed77('0x87')]=_0x5290dd[_0xed77('0x5e')][0x0]['message']['id'];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')]=_0x5290dd[_0xed77('0x5e')][0x0][_0xed77('0x2b')][_0xed77('0x84')];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x5e')]=_0x5290dd['body'][0x0][_0xed77('0x2b')]['text'];break;case _0xed77('0x98'):_0x4bdc35[_0xed77('0x5e')]['from']=_0x5290dd[_0xed77('0x5e')]['from'];_0x4bdc35['body'][_0xed77('0x5e')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x2b')];_0x4bdc35[_0xed77('0x5e')][_0xed77('0x87')]=_0x5290dd[_0xed77('0x5e')][_0xed77('0x99')];break;}}if(_0x4bdc35[_0xed77('0x5e')]['id']){delete _0x4bdc35['body']['id'];}if(_[_0xed77('0x9a')](_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')])){throw new db[(_0xed77('0x9b'))][(_0xed77('0x7c'))](_0xed77('0x9c'));}if(_[_0xed77('0x9a')](_0x4bdc35[_0xed77('0x5e')][_0xed77('0x5e')])||_0x4bdc35[_0xed77('0x5e')][_0xed77('0x5e')]===''){throw new db['Sequelize'][(_0xed77('0x7c'))](_0xed77('0x9d'));}if(_[_0xed77('0x9a')](_0x4bdc35[_0xed77('0x5e')]['mapKey'])){throw new db[(_0xed77('0x9b'))][(_0xed77('0x7c'))](_0xed77('0x9e')+_0x321092);}if(!_[_0xed77('0x9f')](_0x321092,_0x4bdc35[_0xed77('0x5e')][_0xed77('0xa0')])){throw new db[(_0xed77('0x9b'))][(_0xed77('0x7c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x321092);}_0x2a6513[_0x4bdc35[_0xed77('0x5e')][_0xed77('0xa0')]]=_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')];return db[_0xed77('0xa1')]['find']({'where':{'id':_0x4bdc35['account']['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2a6513,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xed77('0x22')](handleEntityNotFound(_0x1a5b5e,null))[_0xed77('0x22')](function(_0x3a54d9){if(_0x3a54d9){_0x4bdc35[_0xed77('0xa2')]=_['omit'](_0x3a54d9,[_0xed77('0xa3')]);if(_0x3a54d9[_0xed77('0xa3')]['length']){return _0x3a54d9[_0xed77('0xa3')][0x0];}var _0x11674a=_[_0xed77('0x1a')](_0x4bdc35[_0xed77('0x5e')],{'firstName':_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')],'ListId':_0x3a54d9['id']});_0x11674a[_0x4bdc35['body'][_0xed77('0xa0')]]=_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')];return db[_0xed77('0x7b')][_0xed77('0x5d')](_0x11674a,{'fields':_0xacea05,'raw':!![]});}})[_0xed77('0x22')](handleEntityNotFound(_0x1a5b5e,null))[_0xed77('0x22')](function(_0x22f90f){if(_0x22f90f){_0x4bdc35[_0xed77('0xa4')]=_0x22f90f;var _0x312bb1={'ContactId':_0x22f90f['id'],'phone':_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')],'SmsAccountId':_0x5290dd[_0xed77('0x59')]['id']};var _0x38bf71={'ContactId':_0x22f90f['id'],'SmsAccountId':_0x5290dd[_0xed77('0x59')]['id'],'closed':![]};return db[_0xed77('0xa5')][_0xed77('0x5c')]({'where':_0x38bf71})[_0xed77('0x22')](function(_0x39db49){if(_0x39db49){return[_0x39db49,![]];}return db['SmsInteraction'][_0xed77('0x5d')](_0x312bb1)[_0xed77('0x22')](function(_0xeedc42){return[_0xeedc42,!![]];});});}})[_0xed77('0xa6')](function(_0x4e9819,_0x163cee){_0x4bdc35[_0xed77('0xa7')]=_0x4e9819[_0xed77('0x3b')]({'plain':!![]});_0x4bdc35[_0xed77('0xa7')][_0xed77('0xa8')]=![];if(_0x163cee){if(_0x4bdc35[_0xed77('0x78')][_0xed77('0xa9')]){_0x4bdc35['applications'][_0xed77('0xaa')]({'id':0x0,'priority':_0x4bdc35[_0xed77('0x79')][_0xed77('0x4a')]+0x1,'app':_0xed77('0xab'),'appdata':'unmanaged','interval':_0xed77('0xac')});}_0x4bdc35[_0xed77('0xa7')][_0xed77('0xa8')]=!![];}return db['SmsMessage'][_0xed77('0x5d')]({'phone':_0x4bdc35[_0xed77('0x5e')][_0xed77('0x84')],'messageId':_0x4bdc35[_0xed77('0x5e')][_0xed77('0x87')],'body':_0x4bdc35['body'][_0xed77('0x5e')],'SmsAccountId':_0x5290dd[_0xed77('0x59')]['id'],'SmsInteractionId':_0x4e9819['id'],'direction':'in','ContactId':_0x4e9819['ContactId'],'AttachmentId':_0x4bdc35[_0xed77('0x5e')][_0xed77('0xad')]});})['then'](function(_0x3c1f92){_0x4bdc35[_0xed77('0x2b')]=_0x3c1f92;if(_0x4bdc35[_0xed77('0xa7')]['UserId']){return db[_0xed77('0xae')][_0xed77('0x5c')]({'attributes':['id',_0xed77('0x3c')],'where':{'id':_0x4bdc35[_0xed77('0xa7')][_0xed77('0xaf')]}})[_0xed77('0x22')](function(_0x281b75){if(_0x281b75){_0x4bdc35['applications'][_0xed77('0xb0')]({'id':0x0,'priority':0x0,'app':_0xed77('0xb1'),'appdata':_0x281b75[_0xed77('0x3c')]+','+(_0x4bdc35['account'][_0xed77('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xed77('0xb3'),_0xed77('0xb4'),_0x4bdc35);});}return respondWithRpcPromise(_0xed77('0xb3'),_0xed77('0xb4'),_0x4bdc35);})['then'](function(_0x3db9cf){if(_0x3db9cf){var _0x265b29=0xc8;var _0xfb82aa=_0xed77('0xb5');logger[_0xed77('0x23')](_0xed77('0x27'),_0xfb82aa,_0x265b29,'entity\x20found');logger[_0xed77('0x26')](_0xed77('0xb6'),_0xfb82aa,_0x265b29,_0xed77('0xb7'),JSON[_0xed77('0x28')](_0x3db9cf));if(_0x4bdc35['account']['type']==='twilio'){return _0x1a5b5e[_0xed77('0x2e')](_0x265b29)[_0xed77('0x35')](_0xed77('0xb8'),_0xed77('0xb9'))[_0xed77('0x3d')]('\x0a');}else{return _0x1a5b5e[_0xed77('0x2e')](_0x265b29)[_0xed77('0x30')](_0x3db9cf);}}})['catch'](handleError(_0x1a5b5e,null));};exports['addApplications']=function(_0x41a22c,_0x111ed4,_0x2d3736){return db['SmsAccount'][_0xed77('0x6b')]({'where':{'id':_0x41a22c[_0xed77('0x59')]['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x111ed4,null))[_0xed77('0x22')](function(_0x484f14){if(_0x484f14){return db[_0xed77('0xba')]['transaction'](function(_0x3c8da8){return db[_0xed77('0x76')][_0xed77('0x3a')]({'where':{'SmsAccountId':_0x41a22c[_0xed77('0x59')]['id']},'transaction':_0x3c8da8})['then'](function(_0x3c7c93){var _0x137e77=_[_0xed77('0x40')](_0x41a22c['body'],function(_0x35faa6){_0x35faa6[_0xed77('0x68')]=_0x41a22c[_0xed77('0x59')]['id'];return _0x35faa6;});return db['SmsApplication'][_0xed77('0xbb')](_0x137e77,{'transaction':_0x3c8da8});});})[_0xed77('0x22')](function(){return db[_0xed77('0x76')][_0xed77('0xbc')]({'where':{'SmsAccountId':_0x41a22c[_0xed77('0x59')]['id']},'order':_0xed77('0x7a')});});}})['then'](respondWithResult(_0x111ed4,null))[_0xed77('0x57')](handleError(_0x111ed4,null));};exports[_0xed77('0xbd')]=function(_0x579644,_0xc2156b,_0x5b2c4b){var _0x3e9a6c={};var _0x3aa0a2={};var _0x303fa9;var _0x1fdca3;return db[_0xed77('0x41')][_0xed77('0x6b')]({'where':{'id':_0x579644[_0xed77('0x59')]['id']}})['then'](handleEntityNotFound(_0xc2156b,null))['then'](function(_0x406c35){if(_0x406c35){_0x303fa9=_0x406c35;_0x3aa0a2[_0xed77('0x45')]=_['keys'](db[_0xed77('0x76')]['rawAttributes']);_0x3aa0a2[_0xed77('0x46')]=_[_0xed77('0x5a')](_0x579644[_0xed77('0x46')]);_0x3aa0a2[_0xed77('0x4f')]=_['intersection'](_0x3aa0a2[_0xed77('0x45')],_0x3aa0a2[_0xed77('0x46')]);_0x3e9a6c['attributes']=_[_0xed77('0x47')](_0x3aa0a2[_0xed77('0x45')],qs[_0xed77('0x49')](_0x579644[_0xed77('0x46')][_0xed77('0x49')]));_0x3e9a6c[_0xed77('0x48')]=_0x3e9a6c[_0xed77('0x48')][_0xed77('0x4a')]?_0x3e9a6c[_0xed77('0x48')]:_0x3aa0a2[_0xed77('0x45')];_0x3e9a6c[_0xed77('0x6c')]=qs[_0xed77('0x4d')](_0x579644[_0xed77('0x46')][_0xed77('0x4d')]);_0x3e9a6c[_0xed77('0x4e')]=qs[_0xed77('0x4f')](_[_0xed77('0x50')](_0x579644[_0xed77('0x46')],_0x3aa0a2[_0xed77('0x4f')]));if(_0x579644[_0xed77('0x46')][_0xed77('0x51')]){_0x3e9a6c['where']=_['merge'](_0x3e9a6c[_0xed77('0x4e')],{'$or':_[_0xed77('0x40')](_0x3e9a6c['attributes'],function(_0x1e160c){var _0x3d8c93={};_0x3d8c93[_0x1e160c]={'$like':'%'+_0x579644[_0xed77('0x46')][_0xed77('0x51')]+'%'};return _0x3d8c93;})});}_0x3e9a6c=_[_0xed77('0x52')]({},_0x3e9a6c,_0x579644[_0xed77('0x54')]);return _0x303fa9['getApplications'](_0x3e9a6c);}})[_0xed77('0x22')](function(_0x29a471){if(_0x29a471){_0x1fdca3=_0x29a471[_0xed77('0x4a')];if(!_0x579644[_0xed77('0x46')][_0xed77('0x4b')](_0xed77('0x4c'))){_0x3e9a6c['limit']=qs[_0xed77('0x34')](_0x579644[_0xed77('0x46')]['limit']);_0x3e9a6c[_0xed77('0x31')]=qs['offset'](_0x579644[_0xed77('0x46')][_0xed77('0x31')]);}return _0x303fa9[_0xed77('0xbd')](_0x3e9a6c);}})[_0xed77('0x22')](function(_0x70324b){if(_0x70324b){return _0x70324b?{'count':_0x1fdca3,'rows':_0x70324b}:null;}})[_0xed77('0x22')](respondWithResult(_0xc2156b,null))[_0xed77('0x57')](handleError(_0xc2156b,null));};exports[_0xed77('0xbe')]=function(_0x3caffb,_0x117d54,_0x1e7dbc){var _0x43c740={'raw':![],'where':{}};var _0xa62e1c={};var _0xe0135f={'count':0x0,'rows':[]};return db['SmsAccount'][_0xed77('0x6b')]({'where':{'id':_0x3caffb[_0xed77('0x59')]['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x117d54,null))[_0xed77('0x22')](function(_0x49f5fe){if(_0x49f5fe){_0xa62e1c['model']=_[_0xed77('0x5a')](db['SmsInteraction'][_0xed77('0x42')]);_0xa62e1c[_0xed77('0x46')]=_[_0xed77('0x5a')](_0x3caffb[_0xed77('0x46')]);_0xa62e1c[_0xed77('0x4f')]=_[_0xed77('0x47')](_0xa62e1c[_0xed77('0x45')],_0xa62e1c[_0xed77('0x46')]);_0x43c740['attributes']=_[_0xed77('0x47')](_0xa62e1c[_0xed77('0x45')],qs[_0xed77('0x49')](_0x3caffb[_0xed77('0x46')][_0xed77('0x49')]));_0x43c740[_0xed77('0x48')]=_0x43c740['attributes']['length']?_0x43c740[_0xed77('0x48')]:_0xa62e1c[_0xed77('0x45')];if(!_0x3caffb['query'][_0xed77('0x4b')](_0xed77('0x4c'))){_0x43c740[_0xed77('0x34')]=qs[_0xed77('0x34')](_0x3caffb[_0xed77('0x46')][_0xed77('0x34')]);_0x43c740[_0xed77('0x31')]=qs[_0xed77('0x31')](_0x3caffb['query']['offset']);}_0x43c740[_0xed77('0x6c')]=qs[_0xed77('0x4d')](_0x3caffb[_0xed77('0x46')][_0xed77('0x4d')]);_0x43c740[_0xed77('0x4e')]=qs['filters'](_['pick'](_0x3caffb['query'],_0xa62e1c[_0xed77('0x4f')]));_0x43c740[_0xed77('0x4e')]['SmsAccountId']=_0x49f5fe['id'];if(_0x3caffb[_0xed77('0x46')]['filter']){_0x43c740[_0xed77('0x4e')]=_['merge'](_0x43c740[_0xed77('0x4e')],{'$or':_[_0xed77('0x40')](_0x43c740[_0xed77('0x48')],function(_0x251124){var _0x542fd0={};_0x542fd0[_0x251124]={'$like':'%'+_0x3caffb[_0xed77('0x46')][_0xed77('0x51')]+'%'};return _0x542fd0;})});}_0x43c740=_['merge']({},_0x43c740,_0x3caffb[_0xed77('0x54')]);return db[_0xed77('0xa5')][_0xed77('0x33')]({'where':_0x43c740['where']})[_0xed77('0x22')](function(_0x3bbc96){_0xe0135f['count']=_0x3bbc96;if(_0x3caffb[_0xed77('0x46')]['includeAll']){_0x43c740[_0xed77('0x55')]=[{'model':db['CmContact'],'as':_0xed77('0xbf'),'required':![]},{'model':db[_0xed77('0xae')],'as':_0xed77('0xc0'),'attributes':[_0xed77('0x3c'),_0xed77('0xc1'),'internal'],'required':![]},{'model':db[_0xed77('0xc2')],'as':_0xed77('0xc3'),'attributes':['id','name',_0xed77('0xc4')],'where':_0x3caffb[_0xed77('0x46')][_0xed77('0xc5')]?{'id':_0x3caffb[_0xed77('0x46')][_0xed77('0xc5')]}:undefined,'required':_0x3caffb['query']['tag']?!![]:![]}];}return db['SmsInteraction'][_0xed77('0x6d')](_0x43c740);})['then'](function(_0x2985fd){_0xe0135f[_0xed77('0x56')]=_0x2985fd;return _0xe0135f;});}})[_0xed77('0x22')](respondWithFilteredResult(_0x117d54,_0x43c740))[_0xed77('0x57')](handleError(_0x117d54,null));};exports[_0xed77('0x3d')]=function(_0x428e2a,_0x50130f,_0x1b83bc){var _0x2f08a3,_0x352c81,_0x5f12e5;if(_[_0xed77('0x9a')](_0x428e2a[_0xed77('0x5e')][_0xed77('0x5e')])||_0x428e2a[_0xed77('0x5e')][_0xed77('0x5e')]===''){throw new db[(_0xed77('0x9b'))][(_0xed77('0x7c'))](_0xed77('0x9d'));}if(_[_0xed77('0x9a')](_0x428e2a[_0xed77('0x5e')]['to'])){throw new db[(_0xed77('0x9b'))][(_0xed77('0x7c'))](_0xed77('0xc6'));}_0x2f08a3=_0x428e2a[_0xed77('0x5e')]['to'];return db[_0xed77('0x41')][_0xed77('0x5c')]({'where':{'id':_0x428e2a['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xed77('0x7b')],'as':'Contacts','where':{'mobile':_0x2f08a3},'limit':0x1,'order':[[_0xed77('0x7f'),_0xed77('0xc7')]]}]}]})[_0xed77('0x22')](handleEntityNotFound(_0x50130f,null))[_0xed77('0x22')](function(_0x5d2de5){if(_0x5d2de5&&_0x5d2de5['List']){_0x352c81=_0x5d2de5[_0xed77('0x3b')]({'plain':!![]});if(_0x352c81['List']&&_0x352c81[_0xed77('0xc8')][_0xed77('0xa3')][_0xed77('0x4a')]){return _0x352c81[_0xed77('0xc8')]['Contacts'][0x0];}return db[_0xed77('0x7b')][_0xed77('0x5d')](_[_0xed77('0x1a')](_0x428e2a['body'],{'firstName':_0x2f08a3,'mobile':_0x2f08a3,'phone':_0x2f08a3,'ListId':_0x352c81[_0xed77('0x81')]}));}})[_0xed77('0x22')](handleEntityNotFound(_0x50130f,null))['then'](function(_0x1ad6db){if(_0x1ad6db){_0x5f12e5=_0x1ad6db;return db[_0xed77('0xa5')][_0xed77('0x5c')]({'where':{'ContactId':_0x5f12e5['id'],'closed':![],'SmsAccountId':_0x352c81['id']}})[_0xed77('0x22')](function(_0x7a51f8){if(_0x7a51f8){return[_0x7a51f8,![]];}return db[_0xed77('0xa5')][_0xed77('0x5d')]({'UserId':_0x428e2a['user']['id'],'ContactId':_0x5f12e5['id'],'SmsAccountId':_0x352c81['id'],'phone':_0x2f08a3,'firstMsgDirection':_0xed77('0xc9'),'Messages':[_['merge'](_0x428e2a[_0xed77('0x5e')],{'read':![],'body':_0x428e2a[_0xed77('0x5e')][_0xed77('0x5e')],'phone':_0x2f08a3,'SmsAccountId':_0x352c81['id'],'UserId':_0x428e2a[_0xed77('0x5f')]['id'],'ContactId':_0x5f12e5['id']})]},{'include':[{'model':db[_0xed77('0xca')],'as':'Messages'}]})[_0xed77('0x22')](function(_0x4e44d2){return[_0x4e44d2,!![]];});});}})['spread'](function(_0x40aff8,_0x503234){if(_0x503234){return _0x40aff8;}return db[_0xed77('0xca')][_0xed77('0x5d')](_[_0xed77('0x52')](_0x428e2a['body'],{'read':![],'body':_0x428e2a[_0xed77('0x5e')][_0xed77('0x5e')],'phone':_0x2f08a3,'SmsAccountId':_0x352c81['id'],'SmsInteractionId':_0x40aff8['id'],'UserId':_0x428e2a[_0xed77('0x5f')]['id'],'ContactId':_0x5f12e5['id']}))[_0xed77('0x22')](function(_0x596a37){_0x40aff8[_0xed77('0xcb')][_0xed77('0xcc')]=[];_0x40aff8[_0xed77('0xcb')][_0xed77('0xcc')][_0xed77('0xaa')](_0x596a37[_0xed77('0xcb')]);return _0x40aff8;});})[_0xed77('0x22')](respondWithResult(_0x50130f,null))[_0xed77('0x57')](handleError(_0x50130f,null));};exports[_0xed77('0x2e')]=function(_0x3ec94d,_0x2634d3,_0x489f5a){if(_0x3ec94d['body']['id']){delete _0x3ec94d[_0xed77('0x5e')]['id'];}var _0x57080b,_0x3cbaa5,_0x271141;return db['SmsAccount'][_0xed77('0x5c')]({'where':{'id':_0x3ec94d[_0xed77('0x59')]['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x2634d3,null))[_0xed77('0x22')](function(_0x40937f){if(_0x40937f){_0x271141=_0x40937f;logger['debug'](_0xed77('0x27'),_0xed77('0x2e'),_0xed77('0xcd'),_0x40937f['type'],util[_0xed77('0xce')](_0x3ec94d['body'],{'showHidden':![],'depth':null}));switch(_0x40937f[_0xed77('0x44')]){case _0xed77('0xcf'):if(_0x3ec94d[_0xed77('0x5e')][_0xed77('0xd0')]&&_0x3ec94d['body'][_0xed77('0x2e')]){_0x3cbaa5=_0x3ec94d[_0xed77('0x5e')][_0xed77('0x2e')];return db[_0xed77('0xca')][_0xed77('0x5c')]({'where':{'messageId':_0x3ec94d[_0xed77('0x5e')][_0xed77('0xd0')]}});}break;case _0xed77('0x8b'):if(_0x3ec94d['body'][_0xed77('0xd1')]&&_0x3ec94d[_0xed77('0x5e')]['statusInt']){_0x3cbaa5=_0x3ec94d[_0xed77('0x5e')][_0xed77('0xd2')];return db['SmsMessage'][_0xed77('0x5c')]({'where':{'messageId':_0x3ec94d['body'][_0xed77('0xd1')]}});}break;case _0xed77('0x8c'):if(_0x3ec94d[_0xed77('0x5e')]['message_id']&&_0x3ec94d[_0xed77('0x5e')]['status_code']){_0x3cbaa5=_0x3ec94d[_0xed77('0x5e')][_0xed77('0xd3')];return db[_0xed77('0xca')][_0xed77('0x5c')]({'where':{'messageId':_0x3ec94d['body'][_0xed77('0x8d')]}});}break;case'infobip':var _0x7e5315=_0x3ec94d['body'][_0xed77('0x90')][0x0];if(_0x7e5315[_0xed77('0x87')]&&_0x7e5315[_0xed77('0x2e')][_0xed77('0xd4')]===_0xed77('0xd5')){_0x3cbaa5=_0x7e5315[_0xed77('0x2e')][_0xed77('0xd4')];return db[_0xed77('0xca')][_0xed77('0x5c')]({'where':{'messageId':_0x7e5315[_0xed77('0x87')]}});}break;case'clickatell':if(_0x3ec94d[_0xed77('0x5e')]['messageId']&&_0x3ec94d['body']['status']){_0x3cbaa5=_0x3ec94d[_0xed77('0x5e')][_0xed77('0x2e')];return db['SmsMessage'][_0xed77('0x5c')]({'where':{'messageId':_0x3ec94d[_0xed77('0x5e')]['messageId']}});}break;case'bandwidth':if(_0x3ec94d[_0xed77('0x5e')][0x0][_0xed77('0x2b')]['id']){_0x3cbaa5=_0x3ec94d[_0xed77('0x5e')][0x0][_0xed77('0x44')];return db['SmsMessage'][_0xed77('0x5c')]({'where':{'messageId':_0x3ec94d[_0xed77('0x5e')][0x0][_0xed77('0x2b')]['id']}});}break;case _0xed77('0x98'):if(_0x3ec94d[_0xed77('0x5e')]['redif']&&_0x3ec94d[_0xed77('0x5e')][_0xed77('0x2e')]){_0x3cbaa5=_0x3ec94d[_0xed77('0x5e')]['status'];return db[_0xed77('0xca')]['find']({'where':{'messageId':_0x3ec94d[_0xed77('0x5e')][_0xed77('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x2634d3,null))[_0xed77('0x22')](function(_0x49eb6a){if(_0x49eb6a){_0x57080b=_0x49eb6a;switch(_0x271141[_0xed77('0x44')]){case _0xed77('0xcf'):if(_0x3cbaa5===_0xed77('0xd5')){return _0x57080b['update']({'read':!![]});}else{logger['error'](_0xed77('0x27'),_0xed77('0x2e'),_0xed77('0xcf'),util['inspect'](_0x3ec94d[_0xed77('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xed77('0x8b'):if(_0x3cbaa5==='1'){return _0x57080b[_0xed77('0x39')]({'read':!![]});}else{logger[_0xed77('0x29')](_0xed77('0x27'),_0xed77('0x2e'),_0xed77('0xcf'),util[_0xed77('0xce')](_0x3ec94d[_0xed77('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xed77('0x8c'):if(!_0x3ec94d[_0xed77('0x5e')]['error_code']&&_0x3cbaa5>=0xc8&&_0x3cbaa5<=0xce){return _0x57080b['update']({'read':!![]});}else{logger['error'](_0xed77('0x27'),_0xed77('0x2e'),_0xed77('0x8c'),util[_0xed77('0xce')](_0x3ec94d[_0xed77('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xed77('0x8f'):var _0x1ba08f=_0x3ec94d[_0xed77('0x5e')][_0xed77('0x90')][0x0];if(_0x1ba08f[_0xed77('0x2e')][_0xed77('0xd4')]===_0xed77('0xd5')){return _0x57080b['update']({'read':!![]});}else{logger['error'](_0xed77('0x27'),_0xed77('0x2e'),_0xed77('0x8f'),util['inspect'](_0x3ec94d[_0xed77('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xed77('0x94'):if(_0x3cbaa5=='DELIVERED_TO_GATEWAY'||_0x3cbaa5==_0xed77('0xd7')){return _0x57080b[_0xed77('0x39')]({'read':!![]});}else{logger[_0xed77('0x29')](_0xed77('0x27'),_0xed77('0x2e'),_0xed77('0x94'),util[_0xed77('0xce')](_0x3ec94d[_0xed77('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xed77('0x97'):if(_0x3cbaa5=='message-delivered'){return _0x57080b[_0xed77('0x39')]({'read':!![]});}else{logger['error'](_0xed77('0x27'),'status',_0xed77('0x97'),util[_0xed77('0xce')](_0x3ec94d[_0xed77('0x5e')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3cbaa5===_0xed77('0xd8')||_0x3cbaa5===_0xed77('0xd9')){return _0x57080b[_0xed77('0x39')]({'read':!![]});}else{logger[_0xed77('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xed77('0x2e'),'intelepeer',util[_0xed77('0xce')](_0x3ec94d[_0xed77('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x57080b;}})[_0xed77('0x22')](respondWithResult(_0x2634d3,null))[_0xed77('0x57')](handleError(_0x2634d3,null));};exports[_0xed77('0xda')]=function(_0x378c99,_0x2efaae,_0x514c57){var _0xe8ec42,_0x2ce345,_0x1427d4;return db[_0xed77('0x41')][_0xed77('0x5c')]({'where':{'id':_0x378c99['params']['id']}})['then'](handleEntityNotFound(_0x2efaae,null))[_0xed77('0x22')](function(_0x3b6a11){if(_0x3b6a11){_0x1427d4=_0x3b6a11;logger[_0xed77('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xed77('0x2e'),_0xed77('0xcd'),_0x3b6a11[_0xed77('0x44')],util[_0xed77('0xce')](_0x378c99['query'],{'showHidden':![],'depth':null}));switch(_0x3b6a11[_0xed77('0x44')]){case _0xed77('0x91'):if(_0x378c99[_0xed77('0x46')]['message-id']&&_0x378c99[_0xed77('0x46')][_0xed77('0xdb')]){_0x2ce345=_0x378c99['query'][_0xed77('0xdb')];return db['SmsMessage'][_0xed77('0x5c')]({'where':{'messageId':_0x378c99[_0xed77('0x46')][_0xed77('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0x2efaae,null))[_0xed77('0x22')](function(_0x7c3e25){if(_0x7c3e25){_0xe8ec42=_0x7c3e25;switch(_0x1427d4[_0xed77('0x44')]){case _0xed77('0x91'):if(_0x2ce345==='2'||_0x2ce345==='6'){return _0xe8ec42[_0xed77('0x39')]({'read':!![]});}else{logger[_0xed77('0x29')](_0xed77('0x27'),'status',_0xed77('0x91'),util['inspect'](_0x378c99['query'],{'showHidden':![],'depth':null}));};break;}return _0xe8ec42;}})[_0xed77('0x22')](respondWithResult(_0x2efaae,null))[_0xed77('0x57')](handleError(_0x2efaae,null));};exports[_0xed77('0xdd')]=function(_0x76951a,_0x1d112d,_0x3ae9f1){return db[_0xed77('0x41')][_0xed77('0x5c')]({'where':{'id':_0x76951a[_0xed77('0x59')]['id']}})['then'](handleEntityNotFound(_0x1d112d,null))[_0xed77('0x22')](function(_0x120886){if(_0x120886){return _0x120886[_0xed77('0xdd')](_0x76951a[_0xed77('0x5e')][_0xed77('0x6f')],_[_0xed77('0xde')](_0x76951a[_0xed77('0x5e')],[_0xed77('0x6f'),'id'])||{})[_0xed77('0xa6')](function(_0xd58426){for(var _0x4aac5c=0x0;_0x4aac5c<_0x76951a[_0xed77('0x5e')][_0xed77('0x6f')]['length'];_0x4aac5c+=0x1){socket[_0xed77('0xdf')]('userSmsAccount:save',{'UserId':Number(_0x76951a[_0xed77('0x5e')][_0xed77('0x6f')][_0x4aac5c]),'SmsAccountId':Number(_0x76951a[_0xed77('0x59')]['id'])});}return _0xd58426;});}})['then'](respondWithResult(_0x1d112d,null))[_0xed77('0x57')](handleError(_0x1d112d,null));};exports[_0xed77('0xe0')]=function(_0x5a8f08,_0x177631,_0x5512cf){return db['SmsAccount'][_0xed77('0x5c')]({'where':{'id':_0x5a8f08[_0xed77('0x59')]['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x177631,null))[_0xed77('0x22')](function(_0x55f40e){if(_0x55f40e){return _0x55f40e[_0xed77('0xe0')](_0x5a8f08['query'][_0xed77('0x6f')])[_0xed77('0x22')](function(){if(_[_0xed77('0xe1')](_0x5a8f08[_0xed77('0x46')][_0xed77('0x6f')])){for(var _0x21d58c=0x0;_0x21d58c<_0x5a8f08['query']['ids'][_0xed77('0x4a')];_0x21d58c+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x5a8f08[_0xed77('0x46')][_0xed77('0x6f')][_0x21d58c]),'SmsAccountId':Number(_0x5a8f08[_0xed77('0x59')]['id'])});}}else{socket[_0xed77('0xdf')](_0xed77('0xe2'),{'UserId':Number(_0x5a8f08[_0xed77('0x46')]['ids']),'SmsAccountId':Number(_0x5a8f08['params']['id'])});}});}})[_0xed77('0x22')](respondWithStatusCode(_0x177631,null))[_0xed77('0x57')](handleError(_0x177631,null));};exports[_0xed77('0xe3')]=function(_0x1706ed,_0x34c986,_0xb7b6ab){var _0x5805e3={};var _0x4e93be={};var _0x3a7080;var _0x163458;return db[_0xed77('0x41')][_0xed77('0x6b')]({'where':{'id':_0x1706ed['params']['id']}})[_0xed77('0x22')](handleEntityNotFound(_0x34c986,null))[_0xed77('0x22')](function(_0x426979){if(_0x426979){_0x3a7080=_0x426979;_0x4e93be['model']=_[_0xed77('0x5a')](db[_0xed77('0xae')][_0xed77('0x42')]);_0x4e93be[_0xed77('0x46')]=_[_0xed77('0x5a')](_0x1706ed[_0xed77('0x46')]);_0x4e93be['filters']=_[_0xed77('0x47')](_0x4e93be[_0xed77('0x45')],_0x4e93be[_0xed77('0x46')]);_0x5805e3[_0xed77('0x48')]=_['intersection'](_0x4e93be['model'],qs['fields'](_0x1706ed[_0xed77('0x46')][_0xed77('0x49')]));_0x5805e3[_0xed77('0x48')]=_0x5805e3['attributes'][_0xed77('0x4a')]?_0x5805e3['attributes']:_0x4e93be['model'];_0x5805e3[_0xed77('0x6c')]=qs['sort'](_0x1706ed[_0xed77('0x46')][_0xed77('0x4d')]);_0x5805e3[_0xed77('0x4e')]=qs['filters'](_['pick'](_0x1706ed[_0xed77('0x46')],_0x4e93be['filters']));if(_0x1706ed[_0xed77('0x46')]['filter']){_0x5805e3[_0xed77('0x4e')]=_[_0xed77('0x52')](_0x5805e3[_0xed77('0x4e')],{'$or':_[_0xed77('0x40')](_0x5805e3[_0xed77('0x48')],function(_0x1c0247){var _0x308d8={};_0x308d8[_0x1c0247]={'$like':'%'+_0x1706ed[_0xed77('0x46')][_0xed77('0x51')]+'%'};return _0x308d8;})});}_0x5805e3=_[_0xed77('0x52')]({},_0x5805e3,_0x1706ed[_0xed77('0x54')]);return _0x3a7080['getAgents'](_0x5805e3);}})['then'](function(_0x2f5d17){if(_0x2f5d17){_0x163458=_0x2f5d17[_0xed77('0x4a')];if(!_0x1706ed['query'][_0xed77('0x4b')](_0xed77('0x4c'))){_0x5805e3[_0xed77('0x34')]=qs['limit'](_0x1706ed[_0xed77('0x46')][_0xed77('0x34')]);_0x5805e3[_0xed77('0x31')]=qs[_0xed77('0x31')](_0x1706ed[_0xed77('0x46')][_0xed77('0x31')]);}return _0x3a7080[_0xed77('0xe3')](_0x5805e3);}})[_0xed77('0x22')](function(_0x1b815c){if(_0x1b815c){return _0x1b815c?{'count':_0x163458,'rows':_0x1b815c}:null;}})[_0xed77('0x22')](respondWithResult(_0x34c986,null))[_0xed77('0x57')](handleError(_0x34c986,null));}; \ No newline at end of file +var _0x6336=['merge','VIRTUAL','options','includeAll','findAll','rows','show','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','connectel','clicksend','Text','infobip','results','csc','clickatell','text','replyMessageId','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','Contacts','contact','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','UserId','unshift','agent','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','Contact','User','Owner','internal','Tag','color','tag','to\x20is\x20mandatory','List','DESC','Messages','spread','push','received\x20delivery\x20report\x20from','inspect','statusInt','message_id','status_code','groupName','DELIVERED','redif','update','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','get','SmsAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where'];(function(_0x36b8cb,_0x57e2e1){var _0x11fdc5=function(_0x415e2c){while(--_0x415e2c){_0x36b8cb['push'](_0x36b8cb['shift']());}};_0x11fdc5(++_0x57e2e1);}(_0x6336,0x16a));var _0x6633=function(_0x20f7be,_0x32a432){_0x20f7be=_0x20f7be-0x0;var _0x46032e=_0x6336[_0x20f7be];return _0x46032e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6633('0x0'));var zipdir=require(_0x6633('0x1'));var jsonpatch=require(_0x6633('0x2'));var rp=require(_0x6633('0x3'));var moment=require(_0x6633('0x4'));var BPromise=require(_0x6633('0x5'));var Mustache=require('mustache');var util=require(_0x6633('0x6'));var path=require(_0x6633('0x7'));var sox=require(_0x6633('0x8'));var csv=require(_0x6633('0x9'));var ejs=require(_0x6633('0xa'));var fs=require('fs');var fs_extra=require(_0x6633('0xb'));var _=require(_0x6633('0xc'));var squel=require(_0x6633('0xd'));var crypto=require('crypto');var jsforce=require(_0x6633('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6633('0xf'));var Papa=require(_0x6633('0x10'));var Redis=require(_0x6633('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6633('0x12'));var as=require(_0x6633('0x13'));var hardwareService=require(_0x6633('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6633('0x15'));var config=require(_0x6633('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6633('0x17'))['db'];config['redis']=_[_0x6633('0x18')](config[_0x6633('0x19')],{'host':_0x6633('0x1a'),'port':0x18eb});var socket=require(_0x6633('0x1b'))(new Redis(config[_0x6633('0x19')]));require(_0x6633('0x1c'))['register'](socket);var jayson=require(_0x6633('0x1d'));var client=jayson[_0x6633('0x1e')][_0x6633('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x31fe5e,_0x4116ea,_0x387da0,_0x2d2750){return new BPromise(function(_0x47a352,_0x7ed4ac){var _0xa12690=_0x2d2750||client;return _0xa12690[_0x6633('0x20')](_0x31fe5e,_0x387da0)[_0x6633('0x21')](function(_0x3ee127){logger[_0x6633('0x22')](_0x6633('0x23'),_0x4116ea,_0x6633('0x24'));logger['debug'](_0x6633('0x25'),_0x4116ea,_0x6633('0x24'),JSON['stringify'](_0x3ee127));if(_0x3ee127[_0x6633('0x26')]){if(_0x3ee127['error']['code']===0x1f4){logger[_0x6633('0x26')](_0x6633('0x23'),_0x4116ea,_0x3ee127[_0x6633('0x26')][_0x6633('0x27')]);return _0x7ed4ac(_0x3ee127['error'][_0x6633('0x27')]);}logger[_0x6633('0x26')](_0x6633('0x23'),_0x4116ea,_0x3ee127[_0x6633('0x26')][_0x6633('0x27')]);return _0x47a352(_0x3ee127[_0x6633('0x26')]['message']);}else{logger[_0x6633('0x22')](_0x6633('0x23'),_0x4116ea,_0x6633('0x24'));_0x47a352(_0x3ee127['result']['message']);}})[_0x6633('0x28')](function(_0x32f765){logger[_0x6633('0x26')](_0x6633('0x23'),_0x4116ea,_0x32f765);_0x7ed4ac(_0x32f765);});});}function respondWithStatusCode(_0x116b1e,_0x32d9c7){_0x32d9c7=_0x32d9c7||0xcc;return function(_0x1215f6){if(_0x1215f6){return _0x116b1e[_0x6633('0x29')](_0x32d9c7);}return _0x116b1e['status'](_0x32d9c7)['end']();};}function respondWithResult(_0x4d00a1,_0x225b8d){_0x225b8d=_0x225b8d||0xc8;return function(_0x502bef){if(_0x502bef){return _0x4d00a1[_0x6633('0x2a')](_0x225b8d)[_0x6633('0x2b')](_0x502bef);}};}function respondWithFilteredResult(_0x421f9f,_0x4220be){return function(_0x42814c){if(_0x42814c){var _0x4a5d6d=typeof _0x4220be['offset']===_0x6633('0x2c')&&typeof _0x4220be[_0x6633('0x2d')]===_0x6633('0x2c');var _0xa8a6f1=_0x42814c[_0x6633('0x2e')];var _0x25bd5e=_0x4a5d6d?0x0:_0x4220be[_0x6633('0x2f')];var _0x11b037=_0x4a5d6d?_0x42814c['count']:_0x4220be['offset']+_0x4220be[_0x6633('0x2d')];var _0x2a051;if(_0x11b037>=_0xa8a6f1){_0x11b037=_0xa8a6f1;_0x2a051=0xc8;}else{_0x2a051=0xce;}_0x421f9f[_0x6633('0x2a')](_0x2a051);return _0x421f9f[_0x6633('0x30')](_0x6633('0x31'),_0x25bd5e+'-'+_0x11b037+'/'+_0xa8a6f1)[_0x6633('0x2b')](_0x42814c);}return null;};}function patchUpdates(_0x54c877){return function(_0x39bdca){try{jsonpatch[_0x6633('0x32')](_0x39bdca,_0x54c877,!![]);}catch(_0x50126d){return BPromise[_0x6633('0x33')](_0x50126d);}return _0x39bdca[_0x6633('0x34')]();};}function saveUpdates(_0x461ac8,_0x925af9){return function(_0xd16393){if(_0xd16393){return _0xd16393['update'](_0x461ac8)[_0x6633('0x21')](function(_0x48219a){return _0x48219a;});}return null;};}function removeEntity(_0x10f91d,_0x3152e8){return function(_0x1f32f7){if(_0x1f32f7){return _0x1f32f7['destroy']()[_0x6633('0x21')](function(){var _0x5f4b0e=_0x1f32f7[_0x6633('0x35')]({'plain':!![]});var _0x42f97b=_0x6633('0x36');return db[_0x6633('0x37')][_0x6633('0x38')]({'where':{'type':_0x42f97b,'resourceId':_0x5f4b0e['id']}})['then'](function(){return _0x1f32f7;});})[_0x6633('0x21')](function(){_0x10f91d[_0x6633('0x2a')](0xcc)[_0x6633('0x39')]();});}};}function handleEntityNotFound(_0x55785a,_0x33c2b5){return function(_0x38d214){if(!_0x38d214){_0x55785a[_0x6633('0x29')](0x194);}return _0x38d214;};}function handleError(_0x214adb,_0x4a3346){_0x4a3346=_0x4a3346||0x1f4;return function(_0x4d1fb2){logger[_0x6633('0x26')](_0x4d1fb2[_0x6633('0x3a')]);if(_0x4d1fb2[_0x6633('0x3b')]){delete _0x4d1fb2[_0x6633('0x3b')];}_0x214adb[_0x6633('0x2a')](_0x4a3346)[_0x6633('0x3c')](_0x4d1fb2);};}exports[_0x6633('0x3d')]=function(_0x22e172,_0x10eaaa){var _0x3bb7bb={'include':[{'model':db[_0x6633('0x3e')],'as':_0x6633('0x3f')}]},_0x32e2ba={},_0x49be48={'count':0x0,'rows':[]};var _0x8c4e58=_[_0x6633('0x40')](db[_0x6633('0x41')][_0x6633('0x42')],function(_0x4a93fc){return{'name':_0x4a93fc[_0x6633('0x43')],'type':_0x4a93fc[_0x6633('0x44')][_0x6633('0x45')]};});_0x32e2ba['model']=_[_0x6633('0x40')](_0x8c4e58,'name');_0x32e2ba[_0x6633('0x46')]=_[_0x6633('0x47')](_0x22e172[_0x6633('0x46')]);_0x32e2ba['filters']=_[_0x6633('0x48')](_0x32e2ba[_0x6633('0x49')],_0x32e2ba[_0x6633('0x46')]);_0x3bb7bb[_0x6633('0x4a')]=_[_0x6633('0x48')](_0x32e2ba[_0x6633('0x49')],qs[_0x6633('0x4b')](_0x22e172[_0x6633('0x46')][_0x6633('0x4b')]));_0x3bb7bb[_0x6633('0x4a')]=_0x3bb7bb['attributes']['length']?_0x3bb7bb['attributes']:_0x32e2ba['model'];if(!_0x22e172['query'][_0x6633('0x4c')](_0x6633('0x4d'))){_0x3bb7bb[_0x6633('0x2d')]=qs[_0x6633('0x2d')](_0x22e172[_0x6633('0x46')][_0x6633('0x2d')]);_0x3bb7bb[_0x6633('0x2f')]=qs[_0x6633('0x2f')](_0x22e172[_0x6633('0x46')][_0x6633('0x2f')]);}_0x3bb7bb[_0x6633('0x4e')]=qs[_0x6633('0x4f')](_0x22e172[_0x6633('0x46')][_0x6633('0x4f')]);_0x3bb7bb['where']=qs[_0x6633('0x50')](_[_0x6633('0x51')](_0x22e172[_0x6633('0x46')],_0x32e2ba['filters']),_0x8c4e58);if(_0x22e172['query'][_0x6633('0x52')]){_0x3bb7bb[_0x6633('0x53')]=_[_0x6633('0x54')](_0x3bb7bb[_0x6633('0x53')],{'$or':_[_0x6633('0x40')](_0x8c4e58,function(_0x2f6082){if(_0x2f6082[_0x6633('0x44')]!==_0x6633('0x55')){var _0x3b6e8d={};_0x3b6e8d[_0x2f6082[_0x6633('0x3b')]]={'$like':'%'+_0x22e172[_0x6633('0x46')][_0x6633('0x52')]+'%'};return _0x3b6e8d;}})});}_0x3bb7bb=_['merge']({},_0x3bb7bb,_0x22e172[_0x6633('0x56')]);var _0x2d8ac9={'where':_0x3bb7bb['where']};return db[_0x6633('0x41')]['count'](_0x2d8ac9)[_0x6633('0x21')](function(_0x4fa3b1){_0x49be48['count']=_0x4fa3b1;if(_0x22e172[_0x6633('0x46')][_0x6633('0x57')]){_0x3bb7bb['include']=[{'all':!![]}];}return db[_0x6633('0x41')][_0x6633('0x58')](_0x3bb7bb);})[_0x6633('0x21')](function(_0xb82048){_0x49be48[_0x6633('0x59')]=_0xb82048;return _0x49be48;})[_0x6633('0x21')](respondWithFilteredResult(_0x10eaaa,_0x3bb7bb))['catch'](handleError(_0x10eaaa,null));};exports[_0x6633('0x5a')]=function(_0x55301a,_0x427bc8){var _0x260a10={'raw':![],'where':{'id':_0x55301a['params']['id']},'include':[{'model':db[_0x6633('0x3e')],'as':_0x6633('0x3f')}]},_0x2b7681={};_0x2b7681[_0x6633('0x49')]=_[_0x6633('0x47')](db[_0x6633('0x41')][_0x6633('0x42')]);_0x2b7681[_0x6633('0x46')]=_[_0x6633('0x47')](_0x55301a[_0x6633('0x46')]);_0x2b7681['filters']=_['intersection'](_0x2b7681[_0x6633('0x49')],_0x2b7681[_0x6633('0x46')]);_0x260a10['attributes']=_[_0x6633('0x48')](_0x2b7681[_0x6633('0x49')],qs[_0x6633('0x4b')](_0x55301a[_0x6633('0x46')][_0x6633('0x4b')]));_0x260a10[_0x6633('0x4a')]=_0x260a10[_0x6633('0x4a')][_0x6633('0x5b')]?_0x260a10[_0x6633('0x4a')]:_0x2b7681[_0x6633('0x49')];if(_0x55301a['query'][_0x6633('0x57')]){_0x260a10[_0x6633('0x5c')]=[{'all':!![]}];}_0x260a10=_[_0x6633('0x54')]({},_0x260a10,_0x55301a[_0x6633('0x56')]);return db[_0x6633('0x41')][_0x6633('0x5d')](_0x260a10)['then'](handleEntityNotFound(_0x427bc8,null))['then'](respondWithResult(_0x427bc8,null))[_0x6633('0x28')](handleError(_0x427bc8,null));};exports[_0x6633('0x5e')]=function(_0x296fc9,_0x2e80fd){return db[_0x6633('0x41')][_0x6633('0x5e')](_0x296fc9['body'],{})[_0x6633('0x21')](function(_0x52e2f8){var _0x21384d=_0x296fc9[_0x6633('0x5f')][_0x6633('0x35')]({'plain':!![]});if(!_0x21384d)throw new Error(_0x6633('0x60'));if(_0x21384d[_0x6633('0x61')]===_0x6633('0x5f')){var _0xcd69f5=_0x52e2f8[_0x6633('0x35')]({'plain':!![]});var _0x5c150a='SmsAccounts';return db[_0x6633('0x62')][_0x6633('0x5d')]({'where':{'name':_0x5c150a,'userProfileId':_0x21384d[_0x6633('0x63')]},'raw':!![]})[_0x6633('0x21')](function(_0x1762d1){if(_0x1762d1&&_0x1762d1[_0x6633('0x64')]===0x0){return db[_0x6633('0x37')][_0x6633('0x5e')]({'name':_0xcd69f5[_0x6633('0x3b')],'resourceId':_0xcd69f5['id'],'type':_0x1762d1[_0x6633('0x3b')],'sectionId':_0x1762d1['id']},{})[_0x6633('0x21')](function(){return _0x52e2f8;});}else{return _0x52e2f8;}})['catch'](function(_0x362d4e){logger['error'](_0x6633('0x65'),_0x362d4e);throw _0x362d4e;});}return _0x52e2f8;})[_0x6633('0x21')](respondWithResult(_0x2e80fd,0xc9))[_0x6633('0x28')](handleError(_0x2e80fd,null));};exports['update']=function(_0x26d03a,_0x26b21f){if(_0x26d03a[_0x6633('0x66')]['id']){delete _0x26d03a[_0x6633('0x66')]['id'];}return db[_0x6633('0x41')]['find']({'where':{'id':_0x26d03a['params']['id']},'include':[{'model':db[_0x6633('0x3e')],'as':_0x6633('0x3f')}]})['then'](handleEntityNotFound(_0x26b21f,null))[_0x6633('0x21')](saveUpdates(_0x26d03a[_0x6633('0x66')],null))[_0x6633('0x21')](respondWithResult(_0x26b21f,null))['catch'](handleError(_0x26b21f,null));};exports[_0x6633('0x38')]=function(_0x536691,_0x3e005a){return db[_0x6633('0x41')]['find']({'where':{'id':_0x536691[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x3e005a,null))[_0x6633('0x21')](removeEntity(_0x3e005a,null))[_0x6633('0x28')](handleError(_0x3e005a,null));};exports['describe']=function(_0xcdf366,_0x36448f){return db[_0x6633('0x41')]['describe']()[_0x6633('0x21')](respondWithResult(_0x36448f,null))[_0x6633('0x28')](handleError(_0x36448f,null));};exports[_0x6633('0x68')]=function(_0x3f7c9b,_0x1fd710,_0x2561e3){if(_0x3f7c9b[_0x6633('0x66')]['id']){delete _0x3f7c9b[_0x6633('0x66')]['id'];}return db['SmsAccount'][_0x6633('0x5d')]({'where':{'id':_0x3f7c9b[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x1fd710,null))['then'](function(_0x3b2e9c){if(_0x3b2e9c){_0x3f7c9b[_0x6633('0x66')][_0x6633('0x69')]=_0x3b2e9c['id'];return db[_0x6633('0x6a')][_0x6633('0x5e')](_0x3f7c9b['body']);}})[_0x6633('0x21')](respondWithResult(_0x1fd710,null))[_0x6633('0x28')](handleError(_0x1fd710,null));};exports[_0x6633('0x6b')]=function(_0x5bb10d,_0x3c9f07,_0x2cbe65){var _0x106e99={'raw':![],'where':{}};var _0x302e3f={};var _0x44205a={'count':0x0,'rows':[]};return db[_0x6633('0x41')]['findOne']({'where':{'id':_0x5bb10d[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x3c9f07,null))[_0x6633('0x21')](function(_0x469f05){if(_0x469f05){_0x302e3f[_0x6633('0x49')]=_[_0x6633('0x47')](db[_0x6633('0x6a')][_0x6633('0x42')]);_0x302e3f[_0x6633('0x46')]=_['keys'](_0x5bb10d[_0x6633('0x46')]);_0x302e3f[_0x6633('0x50')]=_[_0x6633('0x48')](_0x302e3f[_0x6633('0x49')],_0x302e3f[_0x6633('0x46')]);_0x106e99[_0x6633('0x4a')]=_[_0x6633('0x48')](_0x302e3f['model'],qs[_0x6633('0x4b')](_0x5bb10d[_0x6633('0x46')][_0x6633('0x4b')]));_0x106e99[_0x6633('0x4a')]=_0x106e99['attributes']['length']?_0x106e99[_0x6633('0x4a')]:_0x302e3f['model'];if(!_0x5bb10d[_0x6633('0x46')][_0x6633('0x4c')](_0x6633('0x4d'))){_0x106e99[_0x6633('0x2d')]=qs[_0x6633('0x2d')](_0x5bb10d[_0x6633('0x46')][_0x6633('0x2d')]);_0x106e99['offset']=qs[_0x6633('0x2f')](_0x5bb10d['query'][_0x6633('0x2f')]);}_0x106e99[_0x6633('0x4e')]=qs[_0x6633('0x4f')](_0x5bb10d[_0x6633('0x46')][_0x6633('0x4f')]);_0x106e99[_0x6633('0x53')]=qs['filters'](_[_0x6633('0x51')](_0x5bb10d[_0x6633('0x46')],_0x302e3f['filters']));_0x106e99[_0x6633('0x53')]['SmsAccountId']=_0x469f05['id'];if(_0x5bb10d[_0x6633('0x46')][_0x6633('0x52')]){_0x106e99[_0x6633('0x53')]=_[_0x6633('0x54')](_0x106e99['where'],{'$or':_[_0x6633('0x40')](_0x106e99[_0x6633('0x4a')],function(_0x324990){var _0x179f69={};_0x179f69[_0x324990]={'$like':'%'+_0x5bb10d['query'][_0x6633('0x52')]+'%'};return _0x179f69;})});}_0x106e99=_[_0x6633('0x54')]({},_0x106e99,_0x5bb10d[_0x6633('0x56')]);return db['Disposition'][_0x6633('0x2e')]({'where':_0x106e99[_0x6633('0x53')]})[_0x6633('0x21')](function(_0x1053ac){_0x44205a[_0x6633('0x2e')]=_0x1053ac;if(_0x5bb10d[_0x6633('0x46')][_0x6633('0x57')]){_0x106e99['include']=[{'all':!![]}];}return db[_0x6633('0x6a')][_0x6633('0x58')](_0x106e99);})[_0x6633('0x21')](function(_0x327505){_0x44205a['rows']=_0x327505;return _0x44205a;});}})[_0x6633('0x21')](respondWithFilteredResult(_0x3c9f07,_0x106e99))[_0x6633('0x28')](handleError(_0x3c9f07,null));};exports[_0x6633('0x6c')]=function(_0x2e48ea,_0x3faeeb,_0x7864d4){return db['SmsAccount'][_0x6633('0x5d')]({'where':{'id':_0x2e48ea[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x3faeeb,null))['then'](function(_0x422ffb){if(_0x422ffb){return _0x422ffb[_0x6633('0x6c')](_0x2e48ea[_0x6633('0x46')][_0x6633('0x6d')]);}})[_0x6633('0x21')](respondWithStatusCode(_0x3faeeb,null))[_0x6633('0x28')](handleError(_0x3faeeb,null));};exports[_0x6633('0x6e')]=function(_0x496739,_0x3ad326,_0x9594e4){if(_0x496739[_0x6633('0x66')]['id']){delete _0x496739['body']['id'];}return db[_0x6633('0x41')]['find']({'where':{'id':_0x496739['params']['id']}})['then'](handleEntityNotFound(_0x3ad326,null))['then'](function(_0x3a9b0f){if(_0x3a9b0f){_0x496739[_0x6633('0x66')][_0x6633('0x69')]=_0x3a9b0f['id'];return db[_0x6633('0x6f')][_0x6633('0x5e')](_0x496739[_0x6633('0x66')]);}})[_0x6633('0x21')](respondWithResult(_0x3ad326,null))['catch'](handleError(_0x3ad326,null));};exports[_0x6633('0x70')]=function(_0x2a5cbe,_0x8a703,_0x3b2a59){var _0x4c3176={'raw':![],'where':{}};var _0x1caba3={};var _0x1c1598={'count':0x0,'rows':[]};return db[_0x6633('0x41')][_0x6633('0x71')]({'where':{'id':_0x2a5cbe[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x8a703,null))[_0x6633('0x21')](function(_0x139f57){if(_0x139f57){_0x1caba3[_0x6633('0x49')]=_[_0x6633('0x47')](db[_0x6633('0x6f')][_0x6633('0x42')]);_0x1caba3['query']=_[_0x6633('0x47')](_0x2a5cbe['query']);_0x1caba3[_0x6633('0x50')]=_[_0x6633('0x48')](_0x1caba3[_0x6633('0x49')],_0x1caba3['query']);_0x4c3176[_0x6633('0x4a')]=_['intersection'](_0x1caba3['model'],qs[_0x6633('0x4b')](_0x2a5cbe['query'][_0x6633('0x4b')]));_0x4c3176['attributes']=_0x4c3176[_0x6633('0x4a')][_0x6633('0x5b')]?_0x4c3176['attributes']:_0x1caba3[_0x6633('0x49')];if(!_0x2a5cbe[_0x6633('0x46')][_0x6633('0x4c')](_0x6633('0x4d'))){_0x4c3176[_0x6633('0x2d')]=qs['limit'](_0x2a5cbe[_0x6633('0x46')][_0x6633('0x2d')]);_0x4c3176[_0x6633('0x2f')]=qs[_0x6633('0x2f')](_0x2a5cbe[_0x6633('0x46')]['offset']);}_0x4c3176['order']=qs['sort'](_0x2a5cbe[_0x6633('0x46')][_0x6633('0x4f')]);_0x4c3176[_0x6633('0x53')]=qs['filters'](_[_0x6633('0x51')](_0x2a5cbe['query'],_0x1caba3[_0x6633('0x50')]));_0x4c3176[_0x6633('0x53')]['SmsAccountId']=_0x139f57['id'];if(_0x2a5cbe[_0x6633('0x46')][_0x6633('0x52')]){_0x4c3176[_0x6633('0x53')]=_[_0x6633('0x54')](_0x4c3176['where'],{'$or':_[_0x6633('0x40')](_0x4c3176['attributes'],function(_0x35d416){var _0x2f60fa={};_0x2f60fa[_0x35d416]={'$like':'%'+_0x2a5cbe[_0x6633('0x46')][_0x6633('0x52')]+'%'};return _0x2f60fa;})});}_0x4c3176=_['merge']({},_0x4c3176,_0x2a5cbe[_0x6633('0x56')]);return db['CannedAnswer'][_0x6633('0x2e')]({'where':_0x4c3176[_0x6633('0x53')]})['then'](function(_0x513ad2){_0x1c1598[_0x6633('0x2e')]=_0x513ad2;if(_0x2a5cbe[_0x6633('0x46')][_0x6633('0x57')]){_0x4c3176[_0x6633('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6633('0x58')](_0x4c3176);})[_0x6633('0x21')](function(_0x5b295f){_0x1c1598['rows']=_0x5b295f;return _0x1c1598;});}})[_0x6633('0x21')](respondWithFilteredResult(_0x8a703,_0x4c3176))[_0x6633('0x28')](handleError(_0x8a703,null));};exports[_0x6633('0x72')]=function(_0x2b985a,_0x2083c6,_0x58fb76){return db[_0x6633('0x41')][_0x6633('0x5d')]({'where':{'id':_0x2b985a['params']['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x2083c6,null))[_0x6633('0x21')](function(_0x15faad){if(_0x15faad){return _0x15faad[_0x6633('0x72')](_0x2b985a['query'][_0x6633('0x6d')]);}})[_0x6633('0x21')](respondWithStatusCode(_0x2083c6,null))['catch'](handleError(_0x2083c6,null));};exports[_0x6633('0x73')]=function(_0x50acd4,_0x591ca7,_0x5dfedd){var _0x630e9f={'channel':'sms'};var _0x44931b=[];var _0xebe5ac=[];var _0x513ed4={};return db[_0x6633('0x41')][_0x6633('0x5d')]({'where':{'id':_0x50acd4[_0x6633('0x67')]['id']},'include':[{'model':db[_0x6633('0x74')],'as':_0x6633('0x75')}]})[_0x6633('0x21')](handleEntityNotFound(_0x591ca7,null))['then'](function(_0x9bb6df){_0x630e9f[_0x6633('0x76')]=_0x9bb6df;_0x630e9f[_0x6633('0x77')]=_[_0x6633('0x78')](_0x9bb6df[_0x6633('0x75')],[_0x6633('0x79')],['asc']);if(_0x630e9f[_0x6633('0x76')][_0x6633('0x75')]){delete _0x630e9f[_0x6633('0x76')][_0x6633('0x75')];}return db[_0x6633('0x7a')][_0x6633('0x7b')]();})[_0x6633('0x21')](function(_0x2b9970){if(!_0x2b9970){throw new db[(_0x6633('0x7c'))][(_0x6633('0x7d'))](_0x6633('0x7e'));}_0x44931b=_['difference'](_['keys'](_0x2b9970),[_0x6633('0x7f'),'updatedAt']);_0xebe5ac=_[_0x6633('0x80')](_['keys'](_0x2b9970),[_0x6633('0x7f'),_0x6633('0x81'),_0x6633('0x82'),_0x6633('0x83')]);_0x630e9f['body']={'mapKey':_0x6633('0x84')};if(_0x630e9f[_0x6633('0x76')]['type']){switch(_0x630e9f['account'][_0x6633('0x44')]){case _0x6633('0x85'):_0x630e9f[_0x6633('0x66')][_0x6633('0x86')]=_0x50acd4[_0x6633('0x66')][_0x6633('0x87')];_0x630e9f['body'][_0x6633('0x66')]=_0x50acd4['body']['Body'];_0x630e9f['body'][_0x6633('0x88')]=_0x50acd4[_0x6633('0x66')][_0x6633('0x89')];break;case _0x6633('0x8a'):_0x630e9f[_0x6633('0x66')][_0x6633('0x86')]='+'+_0x50acd4['body'][_0x6633('0x8b')];_0x630e9f[_0x6633('0x66')][_0x6633('0x66')]=_0x50acd4[_0x6633('0x66')]['text'];break;case _0x6633('0x8c'):_0x630e9f[_0x6633('0x66')][_0x6633('0x86')]=_0x50acd4['body'][_0x6633('0x86')];_0x630e9f[_0x6633('0x66')]['body']=_0x50acd4['body'][_0x6633('0x27')];break;case _0x6633('0x8d'):_0x630e9f[_0x6633('0x66')][_0x6633('0x86')]=_0x50acd4[_0x6633('0x66')][_0x6633('0x86')];_0x630e9f[_0x6633('0x66')][_0x6633('0x66')]=_0x50acd4[_0x6633('0x66')][_0x6633('0x66')];_0x630e9f[_0x6633('0x66')][_0x6633('0x88')]=_0x50acd4[_0x6633('0x66')]['message_id'];break;case'plivo':_0x630e9f[_0x6633('0x66')]['from']=_0x50acd4[_0x6633('0x66')][_0x6633('0x87')];_0x630e9f[_0x6633('0x66')][_0x6633('0x66')]=_0x50acd4['body'][_0x6633('0x8e')];_0x630e9f['body'][_0x6633('0x88')]=_0x50acd4[_0x6633('0x66')]['MessageUUID'];break;case _0x6633('0x8f'):_0x630e9f[_0x6633('0x66')][_0x6633('0x86')]='+'+_0x50acd4[_0x6633('0x66')][_0x6633('0x90')][0x0][_0x6633('0x86')];_0x630e9f[_0x6633('0x66')][_0x6633('0x66')]=_0x50acd4[_0x6633('0x66')][_0x6633('0x90')][0x0]['text'];_0x630e9f[_0x6633('0x66')][_0x6633('0x88')]=_0x50acd4['body'][_0x6633('0x90')][0x0]['messageId'];break;case _0x6633('0x91'):_0x630e9f['body'][_0x6633('0x86')]=_0x50acd4['body']['originatingAddress'];_0x630e9f[_0x6633('0x66')][_0x6633('0x66')]=_0x50acd4['body']['segmentedMessage']['message'];break;case _0x6633('0x92'):_0x630e9f[_0x6633('0x66')][_0x6633('0x86')]=_0x50acd4[_0x6633('0x66')]['fromNumber'];_0x630e9f['body'][_0x6633('0x66')]=_0x50acd4['body'][_0x6633('0x93')];_0x630e9f[_0x6633('0x66')][_0x6633('0x88')]=_0x50acd4[_0x6633('0x66')][_0x6633('0x94')];break;case _0x6633('0x95'):_0x630e9f[_0x6633('0x66')][_0x6633('0x88')]=_0x50acd4[_0x6633('0x66')][0x0][_0x6633('0x27')]['id'];_0x630e9f[_0x6633('0x66')][_0x6633('0x86')]=_0x50acd4[_0x6633('0x66')][0x0][_0x6633('0x27')][_0x6633('0x86')];_0x630e9f[_0x6633('0x66')]['body']=_0x50acd4['body'][0x0][_0x6633('0x27')][_0x6633('0x93')];break;case _0x6633('0x96'):_0x630e9f['body'][_0x6633('0x86')]=_0x50acd4[_0x6633('0x66')][_0x6633('0x86')];_0x630e9f[_0x6633('0x66')][_0x6633('0x66')]=_0x50acd4[_0x6633('0x66')][_0x6633('0x27')];_0x630e9f[_0x6633('0x66')][_0x6633('0x88')]=_0x50acd4[_0x6633('0x66')]['refid'];break;}}if(_0x630e9f['body']['id']){delete _0x630e9f['body']['id'];}if(_[_0x6633('0x97')](_0x630e9f['body'][_0x6633('0x86')])){throw new db[(_0x6633('0x7c'))][(_0x6633('0x7d'))](_0x6633('0x98'));}if(_[_0x6633('0x97')](_0x630e9f['body'][_0x6633('0x66')])||_0x630e9f['body']['body']===''){throw new db['Sequelize'][(_0x6633('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6633('0x97')](_0x630e9f[_0x6633('0x66')][_0x6633('0x99')])){throw new db[(_0x6633('0x7c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xebe5ac);}if(!_[_0x6633('0x9a')](_0xebe5ac,_0x630e9f['body'][_0x6633('0x99')])){throw new db[(_0x6633('0x7c'))][(_0x6633('0x7d'))](_0x6633('0x9b')+_0xebe5ac);}_0x513ed4[_0x630e9f[_0x6633('0x66')]['mapKey']]=_0x630e9f[_0x6633('0x66')]['from'];return db[_0x6633('0x9c')][_0x6633('0x5d')]({'where':{'id':_0x630e9f[_0x6633('0x76')][_0x6633('0x83')]},'include':[{'model':db[_0x6633('0x7a')],'as':'Contacts','where':_0x513ed4,'limit':0x1,'order':[[_0x6633('0x81'),'DESC']]}]});})[_0x6633('0x21')](handleEntityNotFound(_0x591ca7,null))['then'](function(_0x300c17){if(_0x300c17){_0x630e9f[_0x6633('0x9d')]=_['omit'](_0x300c17,[_0x6633('0x9e')]);if(_0x300c17['Contacts'][_0x6633('0x5b')]){return _0x300c17[_0x6633('0x9e')][0x0];}var _0x5cd4d2=_[_0x6633('0x18')](_0x630e9f[_0x6633('0x66')],{'firstName':_0x630e9f['body']['from'],'ListId':_0x300c17['id']});_0x5cd4d2[_0x630e9f['body'][_0x6633('0x99')]]=_0x630e9f[_0x6633('0x66')][_0x6633('0x86')];return db['CmContact'][_0x6633('0x5e')](_0x5cd4d2,{'fields':_0x44931b,'raw':!![]});}})['then'](handleEntityNotFound(_0x591ca7,null))[_0x6633('0x21')](function(_0x2f0f12){if(_0x2f0f12){_0x630e9f[_0x6633('0x9f')]=_0x2f0f12;var _0x547a69={'ContactId':_0x2f0f12['id'],'phone':_0x630e9f[_0x6633('0x66')][_0x6633('0x86')],'SmsAccountId':_0x50acd4[_0x6633('0x67')]['id']};var _0xb595e4={'ContactId':_0x2f0f12['id'],'SmsAccountId':_0x50acd4[_0x6633('0x67')]['id'],'closed':![]};return db['SmsInteraction'][_0x6633('0x5d')]({'where':_0xb595e4})[_0x6633('0x21')](function(_0x2d72ae){if(_0x2d72ae){return[_0x2d72ae,![]];}return db['SmsInteraction'][_0x6633('0x5e')](_0x547a69)[_0x6633('0x21')](function(_0x3dbe61){return[_0x3dbe61,!![]];});});}})['spread'](function(_0x31e3b7,_0x4b70d4){_0x630e9f[_0x6633('0xa0')]=_0x31e3b7[_0x6633('0x35')]({'plain':!![]});_0x630e9f['interaction'][_0x6633('0xa1')]=![];if(_0x4b70d4){if(_0x630e9f[_0x6633('0x76')][_0x6633('0xa2')]){_0x630e9f['applications']['push']({'id':0x0,'priority':_0x630e9f[_0x6633('0x77')][_0x6633('0x5b')]+0x1,'app':_0x6633('0xa3'),'appdata':_0x6633('0xa4'),'interval':_0x6633('0xa5')});}_0x630e9f[_0x6633('0xa0')]['created']=!![];}return db[_0x6633('0xa6')][_0x6633('0x5e')]({'phone':_0x630e9f['body'][_0x6633('0x86')],'messageId':_0x630e9f[_0x6633('0x66')][_0x6633('0x88')],'body':_0x630e9f['body'][_0x6633('0x66')],'SmsAccountId':_0x50acd4[_0x6633('0x67')]['id'],'SmsInteractionId':_0x31e3b7['id'],'direction':'in','ContactId':_0x31e3b7['ContactId'],'AttachmentId':_0x630e9f[_0x6633('0x66')]['AttachmentId']});})[_0x6633('0x21')](function(_0x21cd90){_0x630e9f['message']=_0x21cd90;if(_0x630e9f[_0x6633('0xa0')]['UserId']){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x630e9f['interaction'][_0x6633('0xa7')]}})[_0x6633('0x21')](function(_0x5b80f6){if(_0x5b80f6){_0x630e9f[_0x6633('0x77')][_0x6633('0xa8')]({'id':0x0,'priority':0x0,'app':_0x6633('0xa9'),'appdata':_0x5b80f6['name']+','+(_0x630e9f['account']['waitForTheAssignedAgent']||0xa),'interval':_0x6633('0xa5')});}return respondWithRpcPromise(_0x6633('0xaa'),_0x6633('0xab'),_0x630e9f);});}return respondWithRpcPromise(_0x6633('0xaa'),_0x6633('0xab'),_0x630e9f);})['then'](function(_0x6ba2ea){if(_0x6ba2ea){var _0x551a1b=0xc8;var _0x29f68c=_0x6633('0xac');logger['info'](_0x6633('0x25'),_0x29f68c,_0x551a1b,'entity\x20found');logger[_0x6633('0xad')](_0x6633('0xae'),_0x29f68c,_0x551a1b,_0x6633('0xaf'),JSON[_0x6633('0xb0')](_0x6ba2ea));if(_0x630e9f[_0x6633('0x76')]['type']===_0x6633('0x85')){return _0x591ca7[_0x6633('0x2a')](_0x551a1b)['set'](_0x6633('0xb1'),_0x6633('0xb2'))['send']('\x0a');}else{return _0x591ca7[_0x6633('0x2a')](_0x551a1b)[_0x6633('0x2b')](_0x6ba2ea);}}})[_0x6633('0x28')](handleError(_0x591ca7,null));};exports['addApplications']=function(_0x500af5,_0x2a038f,_0x1fc2a8){return db[_0x6633('0x41')][_0x6633('0x71')]({'where':{'id':_0x500af5[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x2a038f,null))[_0x6633('0x21')](function(_0x4c3ecd){if(_0x4c3ecd){return db[_0x6633('0xb3')][_0x6633('0xb4')](function(_0x1ccbbb){return db[_0x6633('0x74')][_0x6633('0x38')]({'where':{'SmsAccountId':_0x500af5[_0x6633('0x67')]['id']},'transaction':_0x1ccbbb})[_0x6633('0x21')](function(_0x444211){var _0x1e41a6=_[_0x6633('0x40')](_0x500af5[_0x6633('0x66')],function(_0x128672){_0x128672[_0x6633('0x69')]=_0x500af5[_0x6633('0x67')]['id'];return _0x128672;});return db[_0x6633('0x74')][_0x6633('0xb5')](_0x1e41a6,{'transaction':_0x1ccbbb});});})[_0x6633('0x21')](function(){return db['SmsApplication'][_0x6633('0xb6')]({'where':{'SmsAccountId':_0x500af5['params']['id']},'order':_0x6633('0x79')});});}})[_0x6633('0x21')](respondWithResult(_0x2a038f,null))[_0x6633('0x28')](handleError(_0x2a038f,null));};exports[_0x6633('0xb7')]=function(_0xef24b7,_0xb1fcf2,_0x1483a1){var _0x1ea545={};var _0x595a2c={};var _0x98a63;var _0x5b9b6d;return db[_0x6633('0x41')][_0x6633('0x71')]({'where':{'id':_0xef24b7[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0xb1fcf2,null))[_0x6633('0x21')](function(_0x2eb07a){if(_0x2eb07a){_0x98a63=_0x2eb07a;_0x595a2c[_0x6633('0x49')]=_[_0x6633('0x47')](db['SmsApplication'][_0x6633('0x42')]);_0x595a2c['query']=_[_0x6633('0x47')](_0xef24b7['query']);_0x595a2c[_0x6633('0x50')]=_[_0x6633('0x48')](_0x595a2c['model'],_0x595a2c['query']);_0x1ea545['attributes']=_['intersection'](_0x595a2c[_0x6633('0x49')],qs[_0x6633('0x4b')](_0xef24b7[_0x6633('0x46')][_0x6633('0x4b')]));_0x1ea545[_0x6633('0x4a')]=_0x1ea545[_0x6633('0x4a')][_0x6633('0x5b')]?_0x1ea545[_0x6633('0x4a')]:_0x595a2c[_0x6633('0x49')];_0x1ea545[_0x6633('0x4e')]=qs[_0x6633('0x4f')](_0xef24b7[_0x6633('0x46')]['sort']);_0x1ea545[_0x6633('0x53')]=qs[_0x6633('0x50')](_['pick'](_0xef24b7[_0x6633('0x46')],_0x595a2c[_0x6633('0x50')]));if(_0xef24b7[_0x6633('0x46')][_0x6633('0x52')]){_0x1ea545[_0x6633('0x53')]=_['merge'](_0x1ea545[_0x6633('0x53')],{'$or':_[_0x6633('0x40')](_0x1ea545[_0x6633('0x4a')],function(_0x4b825e){var _0x4b7db2={};_0x4b7db2[_0x4b825e]={'$like':'%'+_0xef24b7[_0x6633('0x46')][_0x6633('0x52')]+'%'};return _0x4b7db2;})});}_0x1ea545=_[_0x6633('0x54')]({},_0x1ea545,_0xef24b7[_0x6633('0x56')]);return _0x98a63['getApplications'](_0x1ea545);}})[_0x6633('0x21')](function(_0xa0a5aa){if(_0xa0a5aa){_0x5b9b6d=_0xa0a5aa[_0x6633('0x5b')];if(!_0xef24b7[_0x6633('0x46')][_0x6633('0x4c')](_0x6633('0x4d'))){_0x1ea545[_0x6633('0x2d')]=qs['limit'](_0xef24b7['query'][_0x6633('0x2d')]);_0x1ea545[_0x6633('0x2f')]=qs['offset'](_0xef24b7[_0x6633('0x46')][_0x6633('0x2f')]);}return _0x98a63[_0x6633('0xb7')](_0x1ea545);}})[_0x6633('0x21')](function(_0x667d5d){if(_0x667d5d){return _0x667d5d?{'count':_0x5b9b6d,'rows':_0x667d5d}:null;}})['then'](respondWithResult(_0xb1fcf2,null))[_0x6633('0x28')](handleError(_0xb1fcf2,null));};exports[_0x6633('0xb8')]=function(_0x13bf23,_0x1756ae,_0x523257){var _0x9ede9e={'raw':![],'where':{}};var _0x4c07f3={};var _0x597c4e={'count':0x0,'rows':[]};return db[_0x6633('0x41')][_0x6633('0x71')]({'where':{'id':_0x13bf23[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x1756ae,null))[_0x6633('0x21')](function(_0x441fcc){if(_0x441fcc){_0x4c07f3[_0x6633('0x49')]=_['keys'](db[_0x6633('0xb9')]['rawAttributes']);_0x4c07f3[_0x6633('0x46')]=_[_0x6633('0x47')](_0x13bf23['query']);_0x4c07f3[_0x6633('0x50')]=_['intersection'](_0x4c07f3[_0x6633('0x49')],_0x4c07f3['query']);_0x9ede9e[_0x6633('0x4a')]=_[_0x6633('0x48')](_0x4c07f3['model'],qs['fields'](_0x13bf23[_0x6633('0x46')][_0x6633('0x4b')]));_0x9ede9e[_0x6633('0x4a')]=_0x9ede9e[_0x6633('0x4a')]['length']?_0x9ede9e['attributes']:_0x4c07f3['model'];if(!_0x13bf23[_0x6633('0x46')][_0x6633('0x4c')](_0x6633('0x4d'))){_0x9ede9e[_0x6633('0x2d')]=qs[_0x6633('0x2d')](_0x13bf23[_0x6633('0x46')][_0x6633('0x2d')]);_0x9ede9e[_0x6633('0x2f')]=qs['offset'](_0x13bf23[_0x6633('0x46')][_0x6633('0x2f')]);}_0x9ede9e[_0x6633('0x4e')]=qs[_0x6633('0x4f')](_0x13bf23[_0x6633('0x46')]['sort']);_0x9ede9e[_0x6633('0x53')]=qs[_0x6633('0x50')](_[_0x6633('0x51')](_0x13bf23[_0x6633('0x46')],_0x4c07f3['filters']));_0x9ede9e[_0x6633('0x53')][_0x6633('0x69')]=_0x441fcc['id'];if(_0x13bf23[_0x6633('0x46')][_0x6633('0x52')]){_0x9ede9e[_0x6633('0x53')]=_['merge'](_0x9ede9e[_0x6633('0x53')],{'$or':_[_0x6633('0x40')](_0x9ede9e[_0x6633('0x4a')],function(_0x5a6012){var _0x210993={};_0x210993[_0x5a6012]={'$like':'%'+_0x13bf23[_0x6633('0x46')]['filter']+'%'};return _0x210993;})});}_0x9ede9e=_[_0x6633('0x54')]({},_0x9ede9e,_0x13bf23[_0x6633('0x56')]);return db[_0x6633('0xb9')][_0x6633('0x2e')]({'where':_0x9ede9e[_0x6633('0x53')]})[_0x6633('0x21')](function(_0x1d0a67){_0x597c4e['count']=_0x1d0a67;if(_0x13bf23[_0x6633('0x46')][_0x6633('0x57')]){_0x9ede9e[_0x6633('0x5c')]=[{'model':db[_0x6633('0x7a')],'as':_0x6633('0xba'),'required':![]},{'model':db[_0x6633('0xbb')],'as':_0x6633('0xbc'),'attributes':[_0x6633('0x3b'),'fullname',_0x6633('0xbd')],'required':![]},{'model':db[_0x6633('0xbe')],'as':'Tags','attributes':['id','name',_0x6633('0xbf')],'where':_0x13bf23[_0x6633('0x46')][_0x6633('0xc0')]?{'id':_0x13bf23[_0x6633('0x46')]['tag']}:undefined,'required':_0x13bf23[_0x6633('0x46')][_0x6633('0xc0')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x9ede9e);})[_0x6633('0x21')](function(_0x4d373c){_0x597c4e[_0x6633('0x59')]=_0x4d373c;return _0x597c4e;});}})[_0x6633('0x21')](respondWithFilteredResult(_0x1756ae,_0x9ede9e))[_0x6633('0x28')](handleError(_0x1756ae,null));};exports[_0x6633('0x3c')]=function(_0x94ded1,_0x3d0c8e,_0xd96ff4){var _0x57806a,_0xa72029,_0x147e83;if(_[_0x6633('0x97')](_0x94ded1[_0x6633('0x66')][_0x6633('0x66')])||_0x94ded1[_0x6633('0x66')][_0x6633('0x66')]===''){throw new db[(_0x6633('0x7c'))][(_0x6633('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6633('0x97')](_0x94ded1[_0x6633('0x66')]['to'])){throw new db[(_0x6633('0x7c'))][(_0x6633('0x7d'))](_0x6633('0xc1'));}_0x57806a=_0x94ded1['body']['to'];return db['SmsAccount'][_0x6633('0x5d')]({'where':{'id':_0x94ded1[_0x6633('0x67')]['id']},'include':[{'model':db['CmList'],'as':_0x6633('0xc2'),'include':[{'model':db[_0x6633('0x7a')],'as':_0x6633('0x9e'),'where':{'mobile':_0x57806a},'limit':0x1,'order':[[_0x6633('0x81'),_0x6633('0xc3')]]}]}]})['then'](handleEntityNotFound(_0x3d0c8e,null))[_0x6633('0x21')](function(_0x381cfa){if(_0x381cfa&&_0x381cfa[_0x6633('0xc2')]){_0xa72029=_0x381cfa[_0x6633('0x35')]({'plain':!![]});if(_0xa72029[_0x6633('0xc2')]&&_0xa72029['List']['Contacts']['length']){return _0xa72029[_0x6633('0xc2')]['Contacts'][0x0];}return db[_0x6633('0x7a')][_0x6633('0x5e')](_[_0x6633('0x18')](_0x94ded1[_0x6633('0x66')],{'firstName':_0x57806a,'mobile':_0x57806a,'phone':_0x57806a,'ListId':_0xa72029[_0x6633('0x83')]}));}})[_0x6633('0x21')](handleEntityNotFound(_0x3d0c8e,null))[_0x6633('0x21')](function(_0x1f4521){if(_0x1f4521){_0x147e83=_0x1f4521;return db['SmsInteraction'][_0x6633('0x5d')]({'where':{'ContactId':_0x147e83['id'],'closed':![],'SmsAccountId':_0xa72029['id']}})[_0x6633('0x21')](function(_0x1c0cd0){if(_0x1c0cd0){return[_0x1c0cd0,![]];}return db['SmsInteraction'][_0x6633('0x5e')]({'UserId':_0x94ded1[_0x6633('0x5f')]['id'],'ContactId':_0x147e83['id'],'SmsAccountId':_0xa72029['id'],'phone':_0x57806a,'firstMsgDirection':'out','Messages':[_['merge'](_0x94ded1['body'],{'read':![],'body':_0x94ded1[_0x6633('0x66')][_0x6633('0x66')],'phone':_0x57806a,'SmsAccountId':_0xa72029['id'],'UserId':_0x94ded1[_0x6633('0x5f')]['id'],'ContactId':_0x147e83['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x6633('0xc4')}]})[_0x6633('0x21')](function(_0x10e081){return[_0x10e081,!![]];});});}})[_0x6633('0xc5')](function(_0x41e719,_0x1c6189){if(_0x1c6189){return _0x41e719;}return db[_0x6633('0xa6')][_0x6633('0x5e')](_[_0x6633('0x54')](_0x94ded1[_0x6633('0x66')],{'read':![],'body':_0x94ded1['body'][_0x6633('0x66')],'phone':_0x57806a,'SmsAccountId':_0xa72029['id'],'SmsInteractionId':_0x41e719['id'],'UserId':_0x94ded1[_0x6633('0x5f')]['id'],'ContactId':_0x147e83['id']}))[_0x6633('0x21')](function(_0x1f675c){_0x41e719['dataValues']['Messages']=[];_0x41e719['dataValues'][_0x6633('0xc4')][_0x6633('0xc6')](_0x1f675c['dataValues']);return _0x41e719;});})[_0x6633('0x21')](respondWithResult(_0x3d0c8e,null))[_0x6633('0x28')](handleError(_0x3d0c8e,null));};exports[_0x6633('0x2a')]=function(_0x2130f0,_0x541186,_0x4748bd){if(_0x2130f0[_0x6633('0x66')]['id']){delete _0x2130f0[_0x6633('0x66')]['id'];}var _0x57d284,_0x4d42fa,_0xfb130f;return db['SmsAccount'][_0x6633('0x5d')]({'where':{'id':_0x2130f0[_0x6633('0x67')]['id']}})['then'](handleEntityNotFound(_0x541186,null))[_0x6633('0x21')](function(_0xa749ba){if(_0xa749ba){_0xfb130f=_0xa749ba;logger[_0x6633('0xad')](_0x6633('0x25'),'status',_0x6633('0xc7'),_0xa749ba[_0x6633('0x44')],util[_0x6633('0xc8')](_0x2130f0[_0x6633('0x66')],{'showHidden':![],'depth':null}));switch(_0xa749ba['type']){case'skebby':if(_0x2130f0[_0x6633('0x66')]['skebby_dispatch_id']&&_0x2130f0[_0x6633('0x66')]['status']){_0x4d42fa=_0x2130f0[_0x6633('0x66')]['status'];return db[_0x6633('0xa6')][_0x6633('0x5d')]({'where':{'messageId':_0x2130f0['body']['skebby_dispatch_id']}});}break;case _0x6633('0x8c'):if(_0x2130f0[_0x6633('0x66')]['requestid']&&_0x2130f0[_0x6633('0x66')][_0x6633('0xc9')]){_0x4d42fa=_0x2130f0[_0x6633('0x66')][_0x6633('0xc9')];return db[_0x6633('0xa6')][_0x6633('0x5d')]({'where':{'messageId':_0x2130f0['body']['requestid']}});}break;case _0x6633('0x8d'):if(_0x2130f0['body'][_0x6633('0xca')]&&_0x2130f0[_0x6633('0x66')][_0x6633('0xcb')]){_0x4d42fa=_0x2130f0['body'][_0x6633('0xcb')];return db[_0x6633('0xa6')][_0x6633('0x5d')]({'where':{'messageId':_0x2130f0[_0x6633('0x66')][_0x6633('0xca')]}});}break;case'infobip':var _0x223f2e=_0x2130f0['body'][_0x6633('0x90')][0x0];if(_0x223f2e[_0x6633('0x88')]&&_0x223f2e[_0x6633('0x2a')][_0x6633('0xcc')]===_0x6633('0xcd')){_0x4d42fa=_0x223f2e[_0x6633('0x2a')][_0x6633('0xcc')];return db[_0x6633('0xa6')][_0x6633('0x5d')]({'where':{'messageId':_0x223f2e[_0x6633('0x88')]}});}break;case _0x6633('0x92'):if(_0x2130f0[_0x6633('0x66')]['messageId']&&_0x2130f0[_0x6633('0x66')][_0x6633('0x2a')]){_0x4d42fa=_0x2130f0[_0x6633('0x66')][_0x6633('0x2a')];return db[_0x6633('0xa6')][_0x6633('0x5d')]({'where':{'messageId':_0x2130f0['body']['messageId']}});}break;case _0x6633('0x95'):if(_0x2130f0[_0x6633('0x66')][0x0][_0x6633('0x27')]['id']){_0x4d42fa=_0x2130f0['body'][0x0][_0x6633('0x44')];return db[_0x6633('0xa6')]['find']({'where':{'messageId':_0x2130f0[_0x6633('0x66')][0x0][_0x6633('0x27')]['id']}});}break;case _0x6633('0x96'):if(_0x2130f0[_0x6633('0x66')]['redif']&&_0x2130f0[_0x6633('0x66')]['status']){_0x4d42fa=_0x2130f0[_0x6633('0x66')][_0x6633('0x2a')];return db['SmsMessage'][_0x6633('0x5d')]({'where':{'messageId':_0x2130f0[_0x6633('0x66')][_0x6633('0xce')]}});}break;}}})[_0x6633('0x21')](handleEntityNotFound(_0x541186,null))['then'](function(_0x32a909){if(_0x32a909){_0x57d284=_0x32a909;switch(_0xfb130f[_0x6633('0x44')]){case _0x6633('0x8a'):if(_0x4d42fa==='DELIVERED'){return _0x57d284['update']({'read':!![]});}else{logger[_0x6633('0x26')](_0x6633('0x25'),'status','skebby',util[_0x6633('0xc8')](_0x2130f0[_0x6633('0x66')],{'showHidden':![],'depth':null}));}break;case _0x6633('0x8c'):if(_0x4d42fa==='1'){return _0x57d284[_0x6633('0xcf')]({'read':!![]});}else{logger[_0x6633('0x26')](_0x6633('0x25'),_0x6633('0x2a'),_0x6633('0x8a'),util[_0x6633('0xc8')](_0x2130f0['body'],{'showHidden':![],'depth':null}));}break;case _0x6633('0x8d'):if(!_0x2130f0[_0x6633('0x66')]['error_code']&&_0x4d42fa>=0xc8&&_0x4d42fa<=0xce){return _0x57d284[_0x6633('0xcf')]({'read':!![]});}else{logger[_0x6633('0x26')](_0x6633('0x25'),_0x6633('0x2a'),_0x6633('0x8d'),util[_0x6633('0xc8')](_0x2130f0[_0x6633('0x66')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x183f78=_0x2130f0[_0x6633('0x66')]['results'][0x0];if(_0x183f78[_0x6633('0x2a')]['groupName']==='DELIVERED'){return _0x57d284[_0x6633('0xcf')]({'read':!![]});}else{logger[_0x6633('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6633('0x2a'),_0x6633('0x8f'),util['inspect'](_0x2130f0['body'],{'showHidden':![],'depth':null}));}break;case _0x6633('0x92'):if(_0x4d42fa==_0x6633('0xd0')||_0x4d42fa==_0x6633('0xd1')){return _0x57d284[_0x6633('0xcf')]({'read':!![]});}else{logger[_0x6633('0x26')](_0x6633('0x25'),'status',_0x6633('0x92'),util[_0x6633('0xc8')](_0x2130f0[_0x6633('0x66')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x4d42fa==_0x6633('0xd2')){return _0x57d284[_0x6633('0xcf')]({'read':!![]});}else{logger[_0x6633('0x26')](_0x6633('0x25'),_0x6633('0x2a'),_0x6633('0x95'),util[_0x6633('0xc8')](_0x2130f0['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4d42fa===_0x6633('0xd3')||_0x4d42fa===_0x6633('0xd4')){return _0x57d284[_0x6633('0xcf')]({'read':!![]});}else{logger[_0x6633('0x26')](_0x6633('0x25'),_0x6633('0x2a'),_0x6633('0x96'),util[_0x6633('0xc8')](_0x2130f0[_0x6633('0x66')],{'showHidden':![],'depth':null}));}break;}return _0x57d284;}})[_0x6633('0x21')](respondWithResult(_0x541186,null))[_0x6633('0x28')](handleError(_0x541186,null));};exports[_0x6633('0xd5')]=function(_0x3dffec,_0x592604,_0xf93098){var _0x1276b8,_0x329b7b,_0x21e7fa;return db[_0x6633('0x41')][_0x6633('0x5d')]({'where':{'id':_0x3dffec['params']['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x592604,null))[_0x6633('0x21')](function(_0xeaf134){if(_0xeaf134){_0x21e7fa=_0xeaf134;logger[_0x6633('0xad')](_0x6633('0x25'),_0x6633('0x2a'),_0x6633('0xc7'),_0xeaf134[_0x6633('0x44')],util[_0x6633('0xc8')](_0x3dffec['query'],{'showHidden':![],'depth':null}));switch(_0xeaf134[_0x6633('0x44')]){case _0x6633('0x91'):if(_0x3dffec[_0x6633('0x46')][_0x6633('0xd6')]&&_0x3dffec['query']['state']){_0x329b7b=_0x3dffec[_0x6633('0x46')][_0x6633('0xd7')];return db['SmsMessage'][_0x6633('0x5d')]({'where':{'messageId':_0x3dffec[_0x6633('0x46')]['message-id']}});}break;}}})[_0x6633('0x21')](handleEntityNotFound(_0x592604,null))['then'](function(_0x4824da){if(_0x4824da){_0x1276b8=_0x4824da;switch(_0x21e7fa[_0x6633('0x44')]){case _0x6633('0x91'):if(_0x329b7b==='2'||_0x329b7b==='6'){return _0x1276b8[_0x6633('0xcf')]({'read':!![]});}else{logger[_0x6633('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6633('0x2a'),_0x6633('0x91'),util[_0x6633('0xc8')](_0x3dffec['query'],{'showHidden':![],'depth':null}));};break;}return _0x1276b8;}})[_0x6633('0x21')](respondWithResult(_0x592604,null))[_0x6633('0x28')](handleError(_0x592604,null));};exports[_0x6633('0xd8')]=function(_0x48c940,_0x4079ab,_0xd74bab){return db['SmsAccount'][_0x6633('0x5d')]({'where':{'id':_0x48c940[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x4079ab,null))[_0x6633('0x21')](function(_0x3fcc86){if(_0x3fcc86){return _0x3fcc86[_0x6633('0xd8')](_0x48c940[_0x6633('0x66')][_0x6633('0x6d')],_[_0x6633('0xd9')](_0x48c940[_0x6633('0x66')],[_0x6633('0x6d'),'id'])||{})[_0x6633('0xc5')](function(_0x28a0fd){for(var _0x53dba8=0x0;_0x53dba8<_0x48c940[_0x6633('0x66')]['ids'][_0x6633('0x5b')];_0x53dba8+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x48c940['body'][_0x6633('0x6d')][_0x53dba8]),'SmsAccountId':Number(_0x48c940[_0x6633('0x67')]['id'])});}return _0x28a0fd;});}})[_0x6633('0x21')](respondWithResult(_0x4079ab,null))[_0x6633('0x28')](handleError(_0x4079ab,null));};exports[_0x6633('0xda')]=function(_0x30011f,_0x515ee5,_0x55eec2){return db['SmsAccount'][_0x6633('0x5d')]({'where':{'id':_0x30011f['params']['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x515ee5,null))[_0x6633('0x21')](function(_0x19c6d3){if(_0x19c6d3){return _0x19c6d3[_0x6633('0xda')](_0x30011f['query'][_0x6633('0x6d')])[_0x6633('0x21')](function(){if(_[_0x6633('0xdb')](_0x30011f['query']['ids'])){for(var _0x2be223=0x0;_0x2be223<_0x30011f['query'][_0x6633('0x6d')][_0x6633('0x5b')];_0x2be223+=0x1){socket[_0x6633('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x30011f[_0x6633('0x46')][_0x6633('0x6d')][_0x2be223]),'SmsAccountId':Number(_0x30011f[_0x6633('0x67')]['id'])});}}else{socket[_0x6633('0xdc')](_0x6633('0xdd'),{'UserId':Number(_0x30011f[_0x6633('0x46')][_0x6633('0x6d')]),'SmsAccountId':Number(_0x30011f[_0x6633('0x67')]['id'])});}});}})[_0x6633('0x21')](respondWithStatusCode(_0x515ee5,null))[_0x6633('0x28')](handleError(_0x515ee5,null));};exports[_0x6633('0xde')]=function(_0x5987cf,_0x5ea372,_0x1682d3){var _0x43b6bc={};var _0x1e5d14={};var _0x571980;var _0x785df1;return db['SmsAccount'][_0x6633('0x71')]({'where':{'id':_0x5987cf[_0x6633('0x67')]['id']}})[_0x6633('0x21')](handleEntityNotFound(_0x5ea372,null))[_0x6633('0x21')](function(_0x358aad){if(_0x358aad){_0x571980=_0x358aad;_0x1e5d14[_0x6633('0x49')]=_[_0x6633('0x47')](db[_0x6633('0xbb')]['rawAttributes']);_0x1e5d14[_0x6633('0x46')]=_[_0x6633('0x47')](_0x5987cf[_0x6633('0x46')]);_0x1e5d14[_0x6633('0x50')]=_[_0x6633('0x48')](_0x1e5d14['model'],_0x1e5d14[_0x6633('0x46')]);_0x43b6bc[_0x6633('0x4a')]=_['intersection'](_0x1e5d14['model'],qs['fields'](_0x5987cf[_0x6633('0x46')]['fields']));_0x43b6bc['attributes']=_0x43b6bc[_0x6633('0x4a')][_0x6633('0x5b')]?_0x43b6bc[_0x6633('0x4a')]:_0x1e5d14[_0x6633('0x49')];_0x43b6bc[_0x6633('0x4e')]=qs[_0x6633('0x4f')](_0x5987cf[_0x6633('0x46')][_0x6633('0x4f')]);_0x43b6bc['where']=qs[_0x6633('0x50')](_[_0x6633('0x51')](_0x5987cf['query'],_0x1e5d14[_0x6633('0x50')]));if(_0x5987cf['query']['filter']){_0x43b6bc['where']=_[_0x6633('0x54')](_0x43b6bc[_0x6633('0x53')],{'$or':_[_0x6633('0x40')](_0x43b6bc[_0x6633('0x4a')],function(_0x844996){var _0x54e90b={};_0x54e90b[_0x844996]={'$like':'%'+_0x5987cf[_0x6633('0x46')][_0x6633('0x52')]+'%'};return _0x54e90b;})});}_0x43b6bc=_[_0x6633('0x54')]({},_0x43b6bc,_0x5987cf[_0x6633('0x56')]);return _0x571980[_0x6633('0xde')](_0x43b6bc);}})[_0x6633('0x21')](function(_0xbcd4f2){if(_0xbcd4f2){_0x785df1=_0xbcd4f2[_0x6633('0x5b')];if(!_0x5987cf[_0x6633('0x46')][_0x6633('0x4c')](_0x6633('0x4d'))){_0x43b6bc[_0x6633('0x2d')]=qs[_0x6633('0x2d')](_0x5987cf[_0x6633('0x46')]['limit']);_0x43b6bc[_0x6633('0x2f')]=qs[_0x6633('0x2f')](_0x5987cf['query']['offset']);}return _0x571980['getAgents'](_0x43b6bc);}})['then'](function(_0x2ab8a5){if(_0x2ab8a5){return _0x2ab8a5?{'count':_0x785df1,'rows':_0x2ab8a5}:null;}})['then'](respondWithResult(_0x5ea372,null))['catch'](handleError(_0x5ea372,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5157750..67f58f9 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 _0xbbb5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount'];(function(_0x254081,_0x20731a){var _0x5d1e2a=function(_0x597854){while(--_0x597854){_0x254081['push'](_0x254081['shift']());}};_0x5d1e2a(++_0x20731a);}(_0xbbb5,0x10b));var _0x5bbb=function(_0xfeb813,_0xff4f56){_0xfeb813=_0xfeb813-0x0;var _0x45aea1=_0xbbb5[_0xfeb813];return _0x45aea1;};'use strict';var EventEmitter=require(_0x5bbb('0x0'));var SmsAccount=require(_0x5bbb('0x1'))['db'][_0x5bbb('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5bbb('0x3')](0x0);var events={'afterCreate':_0x5bbb('0x4'),'afterUpdate':_0x5bbb('0x5'),'afterDestroy':_0x5bbb('0x6')};function emitEvent(_0x32b4b5){return function(_0x5d6511,_0x37934a,_0x3915b5){SmsAccountEvents['emit'](_0x32b4b5+':'+_0x5d6511['id'],_0x5d6511);SmsAccountEvents[_0x5bbb('0x7')](_0x32b4b5,_0x5d6511);_0x3915b5(null);};}for(var e in events){if(events[_0x5bbb('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x5bbb('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x1b8f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0xf01193,_0x5f4398){var _0x3d1f8c=function(_0x4befdb){while(--_0x4befdb){_0xf01193['push'](_0xf01193['shift']());}};_0x3d1f8c(++_0x5f4398);}(_0x1b8f,0x15d));var _0xf1b8=function(_0x578264,_0x5c333d){_0x578264=_0x578264-0x0;var _0x3b1c13=_0x1b8f[_0x578264];return _0x3b1c13;};'use strict';var EventEmitter=require(_0xf1b8('0x0'));var SmsAccount=require(_0xf1b8('0x1'))['db'][_0xf1b8('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xf1b8('0x3')](0x0);var events={'afterCreate':_0xf1b8('0x4'),'afterUpdate':_0xf1b8('0x5'),'afterDestroy':_0xf1b8('0x6')};function emitEvent(_0x30ab39){return function(_0x32f97f,_0x1217f1,_0x50eb3a){SmsAccountEvents[_0xf1b8('0x7')](_0x30ab39+':'+_0x32f97f['id'],_0x32f97f);SmsAccountEvents['emit'](_0x30ab39,_0x32f97f);_0x50eb3a(null);};}for(var e in events){if(events[_0xf1b8('0x8')](e)){var event=events[e];SmsAccount[_0xf1b8('0x9')](e,emitEvent(event));}}module[_0xf1b8('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e31be42..4840b42 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 _0x9a9d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','lodash','util'];(function(_0x46fd05,_0x2a121d){var _0xdcbee=function(_0x32967f){while(--_0x32967f){_0x46fd05['push'](_0x46fd05['shift']());}};_0xdcbee(++_0x2a121d);}(_0x9a9d,0x177));var _0xd9a9=function(_0x9db6e0,_0x1b03d0){_0x9db6e0=_0x9db6e0-0x0;var _0x6222a=_0x9a9d[_0x9db6e0];return _0x6222a;};'use strict';var _=require(_0xd9a9('0x0'));var util=require(_0xd9a9('0x1'));var logger=require(_0xd9a9('0x2'))(_0xd9a9('0x3'));var moment=require(_0xd9a9('0x4'));var BPromise=require(_0xd9a9('0x5'));var rp=require(_0xd9a9('0x6'));var fs=require('fs');var path=require(_0xd9a9('0x7'));var rimraf=require(_0xd9a9('0x8'));var config=require(_0xd9a9('0x9'));var attributes=require(_0xd9a9('0xa'));module[_0xd9a9('0xb')]=function(_0x25e152,_0x1f10fa){return _0x25e152[_0xd9a9('0xc')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c99=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger'];(function(_0x4abe54,_0x50d361){var _0x3698f5=function(_0x89301d){while(--_0x89301d){_0x4abe54['push'](_0x4abe54['shift']());}};_0x3698f5(++_0x50d361);}(_0x5c99,0x97));var _0x95c9=function(_0x2bf799,_0x3d81dc){_0x2bf799=_0x2bf799-0x0;var _0x220479=_0x5c99[_0x2bf799];return _0x220479;};'use strict';var _=require(_0x95c9('0x0'));var util=require(_0x95c9('0x1'));var logger=require(_0x95c9('0x2'))(_0x95c9('0x3'));var moment=require(_0x95c9('0x4'));var BPromise=require(_0x95c9('0x5'));var rp=require(_0x95c9('0x6'));var fs=require('fs');var path=require(_0x95c9('0x7'));var rimraf=require(_0x95c9('0x8'));var config=require(_0x95c9('0x9'));var attributes=require(_0x95c9('0xa'));module[_0x95c9('0xb')]=function(_0xd9eb80,_0x20c55b){return _0xd9eb80[_0x95c9('0xc')](_0x95c9('0xd'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 01e97aa..c01eb13 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 _0xe4c7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','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','catch','ShowSmsAccount','options','include','attributes','map','model','util','moment','bluebird','randomstring'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe4c7,0x1f4));var _0x7e4c=function(_0x334d1e,_0x28a488){_0x334d1e=_0x334d1e-0x0;var _0x3b33ba=_0xe4c7[_0x334d1e];return _0x3b33ba;};'use strict';var _=require('lodash');var util=require(_0x7e4c('0x0'));var moment=require(_0x7e4c('0x1'));var BPromise=require(_0x7e4c('0x2'));var rs=require(_0x7e4c('0x3'));var fs=require('fs');var Redis=require(_0x7e4c('0x4'));var db=require(_0x7e4c('0x5'))['db'];var utils=require(_0x7e4c('0x6'));var logger=require(_0x7e4c('0x7'))(_0x7e4c('0x8'));var config=require('../../config/environment');var jayson=require(_0x7e4c('0x9'));var client=jayson[_0x7e4c('0xa')][_0x7e4c('0xb')]({'port':0x232a});config[_0x7e4c('0xc')]=_[_0x7e4c('0xd')](config[_0x7e4c('0xc')],{'host':_0x7e4c('0xe'),'port':0x18eb});var socket=require(_0x7e4c('0xf'))(new Redis(config[_0x7e4c('0xc')]));require(_0x7e4c('0x10'))[_0x7e4c('0x11')](socket);function respondWithRpcPromise(_0x53ab52,_0x37e76f,_0x5a160b){return new BPromise(function(_0x5243b1,_0x189daf){return client[_0x7e4c('0x12')](_0x53ab52,_0x5a160b)[_0x7e4c('0x13')](function(_0x117128){logger[_0x7e4c('0x14')](_0x7e4c('0x15'),_0x37e76f,_0x7e4c('0x16'));logger[_0x7e4c('0x17')](_0x7e4c('0x18'),_0x37e76f,_0x7e4c('0x16'),JSON[_0x7e4c('0x19')](_0x117128));if(_0x117128[_0x7e4c('0x1a')]){if(_0x117128[_0x7e4c('0x1a')][_0x7e4c('0x1b')]===0x1f4){logger[_0x7e4c('0x1a')](_0x7e4c('0x15'),_0x37e76f,_0x117128[_0x7e4c('0x1a')][_0x7e4c('0x1c')]);return _0x189daf(_0x117128[_0x7e4c('0x1a')]['message']);}logger['error'](_0x7e4c('0x15'),_0x37e76f,_0x117128[_0x7e4c('0x1a')][_0x7e4c('0x1c')]);return _0x5243b1(_0x117128[_0x7e4c('0x1a')][_0x7e4c('0x1c')]);}else{logger[_0x7e4c('0x14')]('SmsAccount,\x20%s,\x20%s',_0x37e76f,_0x7e4c('0x16'));_0x5243b1(_0x117128['result']['message']);}})[_0x7e4c('0x1d')](function(_0x2a0e21){logger[_0x7e4c('0x1a')](_0x7e4c('0x15'),_0x37e76f,_0x2a0e21);_0x189daf(_0x2a0e21);});});}exports[_0x7e4c('0x1e')]=function(_0x5cb3af){var _0x2680dd=this;return new Promise(function(_0x2f6c95,_0x9643c9){return db['SmsAccount']['find']({'raw':_0x5cb3af['options']?_0x5cb3af[_0x7e4c('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5cb3af['options']?_0x5cb3af[_0x7e4c('0x1f')]['where']||null:null,'attributes':_0x5cb3af[_0x7e4c('0x1f')]?_0x5cb3af[_0x7e4c('0x1f')]['attributes']||null:null,'include':_0x5cb3af['options']?_0x5cb3af['options'][_0x7e4c('0x20')]?_['map'](_0x5cb3af['options'][_0x7e4c('0x20')],function(_0x4cddd7){return{'model':db[_0x4cddd7['model']],'as':_0x4cddd7['as'],'attributes':_0x4cddd7[_0x7e4c('0x21')],'include':_0x4cddd7[_0x7e4c('0x20')]?_[_0x7e4c('0x22')](_0x4cddd7[_0x7e4c('0x20')],function(_0x50d0c2){return{'model':db[_0x50d0c2[_0x7e4c('0x23')]],'as':_0x50d0c2['as'],'attributes':_0x50d0c2[_0x7e4c('0x21')],'include':_0x50d0c2[_0x7e4c('0x20')]?_['map'](_0x50d0c2[_0x7e4c('0x20')],function(_0x126a1a){return{'model':db[_0x126a1a['model']],'as':_0x126a1a['as'],'attributes':_0x126a1a[_0x7e4c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7e4c('0x13')](function(_0x2bedee){logger[_0x7e4c('0x14')](_0x7e4c('0x1e'),_0x5cb3af);logger['debug'](_0x7e4c('0x1e'),_0x5cb3af,JSON['stringify'](_0x2bedee));_0x2f6c95(_0x2bedee);})[_0x7e4c('0x1d')](function(_0x5b1161){logger[_0x7e4c('0x1a')]('ShowSmsAccount',_0x5b1161[_0x7e4c('0x1c')],_0x5cb3af);_0x9643c9(_0x2680dd[_0x7e4c('0x1a')](0x1f4,_0x5b1161[_0x7e4c('0x1c')]));});});}; \ No newline at end of file +var _0x60fe=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./smsAccount.socket','register','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','model','map','lodash'];(function(_0x2ba150,_0x839b3e){var _0x17227a=function(_0x307f6b){while(--_0x307f6b){_0x2ba150['push'](_0x2ba150['shift']());}};_0x17227a(++_0x839b3e);}(_0x60fe,0xb3));var _0xe60f=function(_0x42e675,_0x4f24ef){_0x42e675=_0x42e675-0x0;var _0x1e18b9=_0x60fe[_0x42e675];return _0x1e18b9;};'use strict';var _=require(_0xe60f('0x0'));var util=require(_0xe60f('0x1'));var moment=require(_0xe60f('0x2'));var BPromise=require(_0xe60f('0x3'));var rs=require(_0xe60f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe60f('0x5'))['db'];var utils=require(_0xe60f('0x6'));var logger=require(_0xe60f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe60f('0x8'));var client=jayson[_0xe60f('0x9')][_0xe60f('0xa')]({'port':0x232a});config[_0xe60f('0xb')]=_[_0xe60f('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe60f('0xb')]));require(_0xe60f('0xd'))[_0xe60f('0xe')](socket);function respondWithRpcPromise(_0x223213,_0x1ccae7,_0x514337){return new BPromise(function(_0x65a642,_0x163ecd){return client[_0xe60f('0xf')](_0x223213,_0x514337)[_0xe60f('0x10')](function(_0x5cfcfb){logger['info']('SmsAccount,\x20%s,\x20%s',_0x1ccae7,_0xe60f('0x11'));logger[_0xe60f('0x12')](_0xe60f('0x13'),_0x1ccae7,'request\x20sent',JSON[_0xe60f('0x14')](_0x5cfcfb));if(_0x5cfcfb[_0xe60f('0x15')]){if(_0x5cfcfb[_0xe60f('0x15')]['code']===0x1f4){logger[_0xe60f('0x15')](_0xe60f('0x16'),_0x1ccae7,_0x5cfcfb[_0xe60f('0x15')][_0xe60f('0x17')]);return _0x163ecd(_0x5cfcfb['error'][_0xe60f('0x17')]);}logger['error'](_0xe60f('0x16'),_0x1ccae7,_0x5cfcfb[_0xe60f('0x15')][_0xe60f('0x17')]);return _0x65a642(_0x5cfcfb[_0xe60f('0x15')]['message']);}else{logger[_0xe60f('0x18')]('SmsAccount,\x20%s,\x20%s',_0x1ccae7,'request\x20sent');_0x65a642(_0x5cfcfb[_0xe60f('0x19')]['message']);}})[_0xe60f('0x1a')](function(_0x49c0f1){logger['error'](_0xe60f('0x16'),_0x1ccae7,_0x49c0f1);_0x163ecd(_0x49c0f1);});});}exports[_0xe60f('0x1b')]=function(_0x5c3b7a){var _0x1ae50c=this;return new Promise(function(_0x8a77b6,_0x29c38d){return db[_0xe60f('0x1c')][_0xe60f('0x1d')]({'raw':_0x5c3b7a[_0xe60f('0x1e')]?_0x5c3b7a[_0xe60f('0x1e')][_0xe60f('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c3b7a[_0xe60f('0x1e')]?_0x5c3b7a[_0xe60f('0x1e')]['where']||null:null,'attributes':_0x5c3b7a[_0xe60f('0x1e')]?_0x5c3b7a[_0xe60f('0x1e')][_0xe60f('0x20')]||null:null,'include':_0x5c3b7a[_0xe60f('0x1e')]?_0x5c3b7a[_0xe60f('0x1e')]['include']?_['map'](_0x5c3b7a[_0xe60f('0x1e')][_0xe60f('0x21')],function(_0x4124d2){return{'model':db[_0x4124d2['model']],'as':_0x4124d2['as'],'attributes':_0x4124d2[_0xe60f('0x20')],'include':_0x4124d2[_0xe60f('0x21')]?_['map'](_0x4124d2[_0xe60f('0x21')],function(_0x558d86){return{'model':db[_0x558d86[_0xe60f('0x22')]],'as':_0x558d86['as'],'attributes':_0x558d86[_0xe60f('0x20')],'include':_0x558d86[_0xe60f('0x21')]?_[_0xe60f('0x23')](_0x558d86[_0xe60f('0x21')],function(_0x43b96b){return{'model':db[_0x43b96b[_0xe60f('0x22')]],'as':_0x43b96b['as'],'attributes':_0x43b96b[_0xe60f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe60f('0x10')](function(_0x2df995){logger[_0xe60f('0x18')](_0xe60f('0x1b'),_0x5c3b7a);logger[_0xe60f('0x12')]('ShowSmsAccount',_0x5c3b7a,JSON[_0xe60f('0x14')](_0x2df995));_0x8a77b6(_0x2df995);})[_0xe60f('0x1a')](function(_0x2fac10){logger[_0xe60f('0x15')](_0xe60f('0x1b'),_0x2fac10[_0xe60f('0x17')],_0x5c3b7a);_0x29c38d(_0x1ae50c['error'](0x1f4,_0x2fac10['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index d7587b0..d1aa937 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 4911005..dbaf12b 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x48d16a,_0x4967ff){var _0x3eeaff=function(_0x5cc645){while(--_0x5cc645){_0x48d16a['push'](_0x48d16a['shift']());}};_0x3eeaff(++_0x4967ff);}(_0x55ca,0x126));var _0xa55c=function(_0x2383bc,_0x2d5ec9){_0x2383bc=_0x2383bc-0x0;var _0x283573=_0x55ca[_0x2383bc];return _0x283573;};'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 +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5130ba,_0x2cb7d8){var _0x3e199d=function(_0x52c2a9){while(--_0x52c2a9){_0x5130ba['push'](_0x5130ba['shift']());}};_0x3e199d(++_0x2cb7d8);}(_0x7217,0x19e));var _0x7721=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x7217[_0x139a3c];return _0x2b375b;};'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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index b833414..4cb5339 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 _0xa9e9=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xa9e9,0x1e7));var _0x9a9e=function(_0x40e8c4,_0x12d26d){_0x40e8c4=_0x40e8c4-0x0;var _0x5c058a=_0xa9e9[_0x40e8c4];return _0x5c058a;};'use strict';var Sequelize=require(_0x9a9e('0x0'));module[_0x9a9e('0x1')]={'priority':{'type':Sequelize[_0x9a9e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9a9e('0x3')},'appdata':{'type':Sequelize[_0x9a9e('0x4')]()},'description':{'type':Sequelize[_0x9a9e('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9a9e('0x6')}}; \ No newline at end of file +var _0x0824=['exports','STRING','TEXT','sequelize'];(function(_0x256452,_0x1e36a3){var _0x3bcfee=function(_0x3efd00){while(--_0x3efd00){_0x256452['push'](_0x256452['shift']());}};_0x3bcfee(++_0x1e36a3);}(_0x0824,0x1bb));var _0x4082=function(_0x42743a,_0x1cd9bd){_0x42743a=_0x42743a-0x0;var _0x4a56ae=_0x0824[_0x42743a];return _0x4a56ae;};'use strict';var Sequelize=require(_0x4082('0x0'));module[_0x4082('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4082('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4082('0x3')]()},'description':{'type':Sequelize[_0x4082('0x2')]},'interval':{'type':Sequelize[_0x4082('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5bc2576..c1784ba 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 _0xd32f=['filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x51b14d,_0x3061d0){var _0x3da234=function(_0x41f8cb){while(--_0x41f8cb){_0x51b14d['push'](_0x51b14d['shift']());}};_0x3da234(++_0x3061d0);}(_0xd32f,0xe9));var _0xfd32=function(_0xc8c73e,_0x23e2e6){_0xc8c73e=_0xc8c73e-0x0;var _0x4c59a8=_0xd32f[_0xc8c73e];return _0x4c59a8;};'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(_0xfd32('0x0'));var moment=require('moment');var BPromise=require(_0xfd32('0x1'));var Mustache=require('mustache');var util=require(_0xfd32('0x2'));var path=require(_0xfd32('0x3'));var sox=require(_0xfd32('0x4'));var csv=require(_0xfd32('0x5'));var ejs=require(_0xfd32('0x6'));var fs=require('fs');var fs_extra=require(_0xfd32('0x7'));var _=require(_0xfd32('0x8'));var squel=require(_0xfd32('0x9'));var crypto=require(_0xfd32('0xa'));var jsforce=require(_0xfd32('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfd32('0xc'));var Papa=require(_0xfd32('0xd'));var Redis=require(_0xfd32('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfd32('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd32('0x10'));var logger=require(_0xfd32('0x11'))(_0xfd32('0x12'));var utils=require(_0xfd32('0x13'));var config=require(_0xfd32('0x14'));var licenseUtil=require(_0xfd32('0x15'));var db=require(_0xfd32('0x16'))['db'];function respondWithStatusCode(_0x11e237,_0x112d7f){_0x112d7f=_0x112d7f||0xcc;return function(_0xc32eb2){if(_0xc32eb2){return _0x11e237['sendStatus'](_0x112d7f);}return _0x11e237[_0xfd32('0x17')](_0x112d7f)[_0xfd32('0x18')]();};}function respondWithResult(_0x57afff,_0x1275bf){_0x1275bf=_0x1275bf||0xc8;return function(_0x32c220){if(_0x32c220){return _0x57afff[_0xfd32('0x17')](_0x1275bf)['json'](_0x32c220);}};}function respondWithFilteredResult(_0x3e42ba,_0x16f3a1){return function(_0x4992a9){if(_0x4992a9){var _0x8315e1=typeof _0x16f3a1[_0xfd32('0x19')]===_0xfd32('0x1a')&&typeof _0x16f3a1['limit']===_0xfd32('0x1a');var _0x2adf3e=_0x4992a9[_0xfd32('0x1b')];var _0x2a9fb5=_0x8315e1?0x0:_0x16f3a1[_0xfd32('0x19')];var _0x282d89=_0x8315e1?_0x4992a9[_0xfd32('0x1b')]:_0x16f3a1[_0xfd32('0x19')]+_0x16f3a1[_0xfd32('0x1c')];var _0x3bd5bd;if(_0x282d89>=_0x2adf3e){_0x282d89=_0x2adf3e;_0x3bd5bd=0xc8;}else{_0x3bd5bd=0xce;}_0x3e42ba[_0xfd32('0x17')](_0x3bd5bd);return _0x3e42ba['set'](_0xfd32('0x1d'),_0x2a9fb5+'-'+_0x282d89+'/'+_0x2adf3e)[_0xfd32('0x1e')](_0x4992a9);}return null;};}function patchUpdates(_0x733266){return function(_0x39368a){try{jsonpatch[_0xfd32('0x1f')](_0x39368a,_0x733266,!![]);}catch(_0x4e6f85){return BPromise[_0xfd32('0x20')](_0x4e6f85);}return _0x39368a[_0xfd32('0x21')]();};}function saveUpdates(_0xb9acff,_0x455858){return function(_0x136604){if(_0x136604){return _0x136604[_0xfd32('0x22')](_0xb9acff)[_0xfd32('0x23')](function(_0x52e07b){return _0x52e07b;});}return null;};}function removeEntity(_0x1b56d9,_0xa9be9c){return function(_0x1674e5){if(_0x1674e5){return _0x1674e5['destroy']()['then'](function(){_0x1b56d9['status'](0xcc)[_0xfd32('0x18')]();});}};}function handleEntityNotFound(_0x3b1d3a,_0xc80009){return function(_0x11e1fa){if(!_0x11e1fa){_0x3b1d3a[_0xfd32('0x24')](0x194);}return _0x11e1fa;};}function handleError(_0x5ad4d7,_0x25d78e){_0x25d78e=_0x25d78e||0x1f4;return function(_0x5c4270){logger[_0xfd32('0x25')](_0x5c4270[_0xfd32('0x26')]);if(_0x5c4270[_0xfd32('0x27')]){delete _0x5c4270[_0xfd32('0x27')];}_0x5ad4d7[_0xfd32('0x17')](_0x25d78e)[_0xfd32('0x28')](_0x5c4270);};}exports[_0xfd32('0x29')]=function(_0x3c2a62,_0xfe4b28){var _0x3bc381={},_0x58ca97={},_0xb97780={'count':0x0,'rows':[]};var _0x3cd899=_['map'](db[_0xfd32('0x2a')][_0xfd32('0x2b')],function(_0x4ff689){return{'name':_0x4ff689[_0xfd32('0x2c')],'type':_0x4ff689[_0xfd32('0x2d')][_0xfd32('0x2e')]};});_0x58ca97[_0xfd32('0x2f')]=_[_0xfd32('0x30')](_0x3cd899,_0xfd32('0x27'));_0x58ca97[_0xfd32('0x31')]=_[_0xfd32('0x32')](_0x3c2a62[_0xfd32('0x31')]);_0x58ca97[_0xfd32('0x33')]=_[_0xfd32('0x34')](_0x58ca97[_0xfd32('0x2f')],_0x58ca97[_0xfd32('0x31')]);_0x3bc381[_0xfd32('0x35')]=_[_0xfd32('0x34')](_0x58ca97[_0xfd32('0x2f')],qs[_0xfd32('0x36')](_0x3c2a62[_0xfd32('0x31')][_0xfd32('0x36')]));_0x3bc381[_0xfd32('0x35')]=_0x3bc381['attributes'][_0xfd32('0x37')]?_0x3bc381[_0xfd32('0x35')]:_0x58ca97[_0xfd32('0x2f')];if(!_0x3c2a62[_0xfd32('0x31')][_0xfd32('0x38')]('nolimit')){_0x3bc381['limit']=qs[_0xfd32('0x1c')](_0x3c2a62[_0xfd32('0x31')][_0xfd32('0x1c')]);_0x3bc381[_0xfd32('0x19')]=qs[_0xfd32('0x19')](_0x3c2a62['query'][_0xfd32('0x19')]);}_0x3bc381[_0xfd32('0x39')]=qs[_0xfd32('0x3a')](_0x3c2a62[_0xfd32('0x31')][_0xfd32('0x3a')]);_0x3bc381['where']=qs[_0xfd32('0x33')](_['pick'](_0x3c2a62[_0xfd32('0x31')],_0x58ca97[_0xfd32('0x33')]),_0x3cd899);if(_0x3c2a62[_0xfd32('0x31')][_0xfd32('0x3b')]){_0x3bc381[_0xfd32('0x3c')]=_[_0xfd32('0x3d')](_0x3bc381[_0xfd32('0x3c')],{'$or':_[_0xfd32('0x30')](_0x3cd899,function(_0x47a695){if(_0x47a695[_0xfd32('0x2d')]!==_0xfd32('0x3e')){var _0x607893={};_0x607893[_0x47a695[_0xfd32('0x27')]]={'$like':'%'+_0x3c2a62[_0xfd32('0x31')][_0xfd32('0x3b')]+'%'};return _0x607893;}})});}_0x3bc381=_[_0xfd32('0x3d')]({},_0x3bc381,_0x3c2a62[_0xfd32('0x3f')]);var _0x29cdbf={'where':_0x3bc381[_0xfd32('0x3c')]};return db['SmsApplication'][_0xfd32('0x1b')](_0x29cdbf)['then'](function(_0x529318){_0xb97780['count']=_0x529318;if(_0x3c2a62[_0xfd32('0x31')][_0xfd32('0x40')]){_0x3bc381[_0xfd32('0x41')]=[{'all':!![]}];}return db[_0xfd32('0x2a')][_0xfd32('0x42')](_0x3bc381);})[_0xfd32('0x23')](function(_0x81f13d){_0xb97780[_0xfd32('0x43')]=_0x81f13d;return _0xb97780;})['then'](respondWithFilteredResult(_0xfe4b28,_0x3bc381))['catch'](handleError(_0xfe4b28,null));};exports['show']=function(_0x12c11c,_0xaadd68){var _0x1ec09c={'raw':!![],'where':{'id':_0x12c11c[_0xfd32('0x44')]['id']}},_0x490d32={};_0x490d32[_0xfd32('0x2f')]=_[_0xfd32('0x32')](db[_0xfd32('0x2a')]['rawAttributes']);_0x490d32[_0xfd32('0x31')]=_[_0xfd32('0x32')](_0x12c11c[_0xfd32('0x31')]);_0x490d32['filters']=_[_0xfd32('0x34')](_0x490d32[_0xfd32('0x2f')],_0x490d32['query']);_0x1ec09c[_0xfd32('0x35')]=_[_0xfd32('0x34')](_0x490d32[_0xfd32('0x2f')],qs['fields'](_0x12c11c[_0xfd32('0x31')][_0xfd32('0x36')]));_0x1ec09c[_0xfd32('0x35')]=_0x1ec09c[_0xfd32('0x35')][_0xfd32('0x37')]?_0x1ec09c[_0xfd32('0x35')]:_0x490d32[_0xfd32('0x2f')];if(_0x12c11c['query']['includeAll']){_0x1ec09c['include']=[{'all':!![]}];}_0x1ec09c=_['merge']({},_0x1ec09c,_0x12c11c[_0xfd32('0x3f')]);return db[_0xfd32('0x2a')][_0xfd32('0x45')](_0x1ec09c)['then'](handleEntityNotFound(_0xaadd68,null))[_0xfd32('0x23')](respondWithResult(_0xaadd68,null))[_0xfd32('0x46')](handleError(_0xaadd68,null));};exports[_0xfd32('0x47')]=function(_0x43735d,_0x1258d0){return db[_0xfd32('0x2a')][_0xfd32('0x47')](_0x43735d['body'],{})['then'](respondWithResult(_0x1258d0,0xc9))['catch'](handleError(_0x1258d0,null));};exports[_0xfd32('0x22')]=function(_0xadf313,_0x23826e){if(_0xadf313['body']['id']){delete _0xadf313[_0xfd32('0x48')]['id'];}return db[_0xfd32('0x2a')]['find']({'where':{'id':_0xadf313[_0xfd32('0x44')]['id']}})['then'](handleEntityNotFound(_0x23826e,null))[_0xfd32('0x23')](saveUpdates(_0xadf313[_0xfd32('0x48')],null))[_0xfd32('0x23')](respondWithResult(_0x23826e,null))[_0xfd32('0x46')](handleError(_0x23826e,null));};exports['destroy']=function(_0x4b7e3b,_0x3d3272){return db[_0xfd32('0x2a')][_0xfd32('0x45')]({'where':{'id':_0x4b7e3b[_0xfd32('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d3272,null))[_0xfd32('0x23')](removeEntity(_0x3d3272,null))[_0xfd32('0x46')](handleError(_0x3d3272,null));}; \ No newline at end of file +var _0x84bb=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SmsApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x84bb,0x81));var _0xb84b=function(_0x5ceb6f,_0x28522e){_0x5ceb6f=_0x5ceb6f-0x0;var _0x5aa54f=_0x84bb[_0x5ceb6f];return _0x5aa54f;};'use strict';var emlformat=require(_0xb84b('0x0'));var rimraf=require(_0xb84b('0x1'));var zipdir=require(_0xb84b('0x2'));var jsonpatch=require(_0xb84b('0x3'));var rp=require('request-promise');var moment=require(_0xb84b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb84b('0x5'));var util=require(_0xb84b('0x6'));var path=require(_0xb84b('0x7'));var sox=require(_0xb84b('0x8'));var csv=require(_0xb84b('0x9'));var ejs=require(_0xb84b('0xa'));var fs=require('fs');var fs_extra=require(_0xb84b('0xb'));var _=require('lodash');var squel=require(_0xb84b('0xc'));var crypto=require(_0xb84b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb84b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb84b('0xf'));var Papa=require(_0xb84b('0x10'));var Redis=require(_0xb84b('0x11'));var authService=require(_0xb84b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb84b('0x13'));var logger=require(_0xb84b('0x14'))(_0xb84b('0x15'));var utils=require(_0xb84b('0x16'));var config=require(_0xb84b('0x17'));var licenseUtil=require(_0xb84b('0x18'));var db=require(_0xb84b('0x19'))['db'];function respondWithStatusCode(_0x3f35bf,_0x2f814c){_0x2f814c=_0x2f814c||0xcc;return function(_0x248372){if(_0x248372){return _0x3f35bf[_0xb84b('0x1a')](_0x2f814c);}return _0x3f35bf['status'](_0x2f814c)['end']();};}function respondWithResult(_0x2d4821,_0x147d64){_0x147d64=_0x147d64||0xc8;return function(_0x2a118e){if(_0x2a118e){return _0x2d4821[_0xb84b('0x1b')](_0x147d64)['json'](_0x2a118e);}};}function respondWithFilteredResult(_0x42512f,_0x3d28c2){return function(_0x58bda1){if(_0x58bda1){var _0x42a634=typeof _0x3d28c2['offset']==='undefined'&&typeof _0x3d28c2['limit']===_0xb84b('0x1c');var _0x2f8ee9=_0x58bda1[_0xb84b('0x1d')];var _0xc83367=_0x42a634?0x0:_0x3d28c2[_0xb84b('0x1e')];var _0x3720f8=_0x42a634?_0x58bda1[_0xb84b('0x1d')]:_0x3d28c2[_0xb84b('0x1e')]+_0x3d28c2[_0xb84b('0x1f')];var _0x306405;if(_0x3720f8>=_0x2f8ee9){_0x3720f8=_0x2f8ee9;_0x306405=0xc8;}else{_0x306405=0xce;}_0x42512f[_0xb84b('0x1b')](_0x306405);return _0x42512f['set'](_0xb84b('0x20'),_0xc83367+'-'+_0x3720f8+'/'+_0x2f8ee9)[_0xb84b('0x21')](_0x58bda1);}return null;};}function patchUpdates(_0x302ffa){return function(_0x349370){try{jsonpatch[_0xb84b('0x22')](_0x349370,_0x302ffa,!![]);}catch(_0x4991e2){return BPromise[_0xb84b('0x23')](_0x4991e2);}return _0x349370[_0xb84b('0x24')]();};}function saveUpdates(_0x169421,_0x1802bf){return function(_0x43ed9b){if(_0x43ed9b){return _0x43ed9b[_0xb84b('0x25')](_0x169421)[_0xb84b('0x26')](function(_0x2be4d8){return _0x2be4d8;});}return null;};}function removeEntity(_0x125a06,_0x29fffc){return function(_0x5b7452){if(_0x5b7452){return _0x5b7452[_0xb84b('0x27')]()[_0xb84b('0x26')](function(){_0x125a06[_0xb84b('0x1b')](0xcc)[_0xb84b('0x28')]();});}};}function handleEntityNotFound(_0x4f5488,_0x5eaea8){return function(_0xe0a8dc){if(!_0xe0a8dc){_0x4f5488['sendStatus'](0x194);}return _0xe0a8dc;};}function handleError(_0x4e210b,_0x504805){_0x504805=_0x504805||0x1f4;return function(_0x6ddd5c){logger[_0xb84b('0x29')](_0x6ddd5c['stack']);if(_0x6ddd5c[_0xb84b('0x2a')]){delete _0x6ddd5c[_0xb84b('0x2a')];}_0x4e210b['status'](_0x504805)[_0xb84b('0x2b')](_0x6ddd5c);};}exports[_0xb84b('0x2c')]=function(_0x134278,_0x366dfd){var _0x10ac39={},_0x12bad5={},_0x19fa79={'count':0x0,'rows':[]};var _0x4fef95=_[_0xb84b('0x2d')](db[_0xb84b('0x2e')][_0xb84b('0x2f')],function(_0x1296de){return{'name':_0x1296de['fieldName'],'type':_0x1296de[_0xb84b('0x30')][_0xb84b('0x31')]};});_0x12bad5[_0xb84b('0x32')]=_[_0xb84b('0x2d')](_0x4fef95,_0xb84b('0x2a'));_0x12bad5[_0xb84b('0x33')]=_['keys'](_0x134278[_0xb84b('0x33')]);_0x12bad5[_0xb84b('0x34')]=_[_0xb84b('0x35')](_0x12bad5['model'],_0x12bad5[_0xb84b('0x33')]);_0x10ac39[_0xb84b('0x36')]=_['intersection'](_0x12bad5['model'],qs[_0xb84b('0x37')](_0x134278[_0xb84b('0x33')][_0xb84b('0x37')]));_0x10ac39[_0xb84b('0x36')]=_0x10ac39[_0xb84b('0x36')]['length']?_0x10ac39[_0xb84b('0x36')]:_0x12bad5[_0xb84b('0x32')];if(!_0x134278[_0xb84b('0x33')][_0xb84b('0x38')](_0xb84b('0x39'))){_0x10ac39[_0xb84b('0x1f')]=qs[_0xb84b('0x1f')](_0x134278['query'][_0xb84b('0x1f')]);_0x10ac39[_0xb84b('0x1e')]=qs[_0xb84b('0x1e')](_0x134278[_0xb84b('0x33')]['offset']);}_0x10ac39[_0xb84b('0x3a')]=qs['sort'](_0x134278[_0xb84b('0x33')]['sort']);_0x10ac39[_0xb84b('0x3b')]=qs[_0xb84b('0x34')](_[_0xb84b('0x3c')](_0x134278[_0xb84b('0x33')],_0x12bad5[_0xb84b('0x34')]),_0x4fef95);if(_0x134278['query'][_0xb84b('0x3d')]){_0x10ac39['where']=_[_0xb84b('0x3e')](_0x10ac39[_0xb84b('0x3b')],{'$or':_['map'](_0x4fef95,function(_0x450b5b){if(_0x450b5b[_0xb84b('0x30')]!=='VIRTUAL'){var _0x33de7f={};_0x33de7f[_0x450b5b[_0xb84b('0x2a')]]={'$like':'%'+_0x134278[_0xb84b('0x33')][_0xb84b('0x3d')]+'%'};return _0x33de7f;}})});}_0x10ac39=_[_0xb84b('0x3e')]({},_0x10ac39,_0x134278[_0xb84b('0x3f')]);var _0x3b568b={'where':_0x10ac39[_0xb84b('0x3b')]};return db[_0xb84b('0x2e')][_0xb84b('0x1d')](_0x3b568b)['then'](function(_0x5e77a0){_0x19fa79[_0xb84b('0x1d')]=_0x5e77a0;if(_0x134278[_0xb84b('0x33')][_0xb84b('0x40')]){_0x10ac39[_0xb84b('0x41')]=[{'all':!![]}];}return db[_0xb84b('0x2e')][_0xb84b('0x42')](_0x10ac39);})[_0xb84b('0x26')](function(_0x56e11e){_0x19fa79[_0xb84b('0x43')]=_0x56e11e;return _0x19fa79;})[_0xb84b('0x26')](respondWithFilteredResult(_0x366dfd,_0x10ac39))[_0xb84b('0x44')](handleError(_0x366dfd,null));};exports[_0xb84b('0x45')]=function(_0x3cfc22,_0x31d37c){var _0x32dffd={'raw':!![],'where':{'id':_0x3cfc22[_0xb84b('0x46')]['id']}},_0x2dae61={};_0x2dae61['model']=_['keys'](db[_0xb84b('0x2e')][_0xb84b('0x2f')]);_0x2dae61[_0xb84b('0x33')]=_['keys'](_0x3cfc22[_0xb84b('0x33')]);_0x2dae61['filters']=_[_0xb84b('0x35')](_0x2dae61['model'],_0x2dae61[_0xb84b('0x33')]);_0x32dffd[_0xb84b('0x36')]=_['intersection'](_0x2dae61[_0xb84b('0x32')],qs['fields'](_0x3cfc22[_0xb84b('0x33')][_0xb84b('0x37')]));_0x32dffd[_0xb84b('0x36')]=_0x32dffd['attributes'][_0xb84b('0x47')]?_0x32dffd[_0xb84b('0x36')]:_0x2dae61[_0xb84b('0x32')];if(_0x3cfc22[_0xb84b('0x33')]['includeAll']){_0x32dffd[_0xb84b('0x41')]=[{'all':!![]}];}_0x32dffd=_[_0xb84b('0x3e')]({},_0x32dffd,_0x3cfc22[_0xb84b('0x3f')]);return db[_0xb84b('0x2e')]['find'](_0x32dffd)[_0xb84b('0x26')](handleEntityNotFound(_0x31d37c,null))[_0xb84b('0x26')](respondWithResult(_0x31d37c,null))[_0xb84b('0x44')](handleError(_0x31d37c,null));};exports[_0xb84b('0x48')]=function(_0x339151,_0x1e368c){return db[_0xb84b('0x2e')][_0xb84b('0x48')](_0x339151[_0xb84b('0x49')],{})[_0xb84b('0x26')](respondWithResult(_0x1e368c,0xc9))['catch'](handleError(_0x1e368c,null));};exports[_0xb84b('0x25')]=function(_0x640841,_0x494344){if(_0x640841[_0xb84b('0x49')]['id']){delete _0x640841['body']['id'];}return db[_0xb84b('0x2e')][_0xb84b('0x4a')]({'where':{'id':_0x640841[_0xb84b('0x46')]['id']}})[_0xb84b('0x26')](handleEntityNotFound(_0x494344,null))['then'](saveUpdates(_0x640841[_0xb84b('0x49')],null))[_0xb84b('0x26')](respondWithResult(_0x494344,null))[_0xb84b('0x44')](handleError(_0x494344,null));};exports['destroy']=function(_0x426f7d,_0x37055f){return db[_0xb84b('0x2e')][_0xb84b('0x4a')]({'where':{'id':_0x426f7d['params']['id']}})['then'](handleEntityNotFound(_0x37055f,null))[_0xb84b('0x26')](removeEntity(_0x37055f,null))[_0xb84b('0x44')](handleError(_0x37055f,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f786562..bcbc2c5 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 _0x92d4=['../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2ee0b4,_0x387af5){var _0xf01304=function(_0x17a3e1){while(--_0x17a3e1){_0x2ee0b4['push'](_0x2ee0b4['shift']());}};_0xf01304(++_0x387af5);}(_0x92d4,0x95));var _0x492d=function(_0x1487bb,_0x8df36f){_0x1487bb=_0x1487bb-0x0;var _0x5f4e84=_0x92d4[_0x1487bb];return _0x5f4e84;};'use strict';var _=require(_0x492d('0x0'));var util=require(_0x492d('0x1'));var logger=require(_0x492d('0x2'))(_0x492d('0x3'));var moment=require('moment');var BPromise=require(_0x492d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x492d('0x5'));var rimraf=require(_0x492d('0x6'));var config=require(_0x492d('0x7'));var attributes=require('./smsApplication.attributes');module[_0x492d('0x8')]=function(_0xe795b8,_0x491c58){return _0xe795b8[_0x492d('0x9')](_0x492d('0xa'),attributes,{'tableName':_0x492d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x492d('0xc')});}; \ No newline at end of file +var _0xea15=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xea15,0x1c9));var _0x5ea1=function(_0x301bee,_0x91a563){_0x301bee=_0x301bee-0x0;var _0x3fbdbc=_0xea15[_0x301bee];return _0x3fbdbc;};'use strict';var _=require(_0x5ea1('0x0'));var util=require(_0x5ea1('0x1'));var logger=require(_0x5ea1('0x2'))(_0x5ea1('0x3'));var moment=require(_0x5ea1('0x4'));var BPromise=require(_0x5ea1('0x5'));var rp=require(_0x5ea1('0x6'));var fs=require('fs');var path=require(_0x5ea1('0x7'));var rimraf=require(_0x5ea1('0x8'));var config=require(_0x5ea1('0x9'));var attributes=require(_0x5ea1('0xa'));module[_0x5ea1('0xb')]=function(_0x5e029e,_0x5aa928){return _0x5e029e[_0x5ea1('0xc')](_0x5ea1('0xd'),attributes,{'tableName':_0x5ea1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ea1('0xf'),'collate':_0x5ea1('0x10')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 3bbe14a..d92825b 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 _0x97b2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x2ba117,_0x1cbc43){var _0x60b195=function(_0x539e43){while(--_0x539e43){_0x2ba117['push'](_0x2ba117['shift']());}};_0x60b195(++_0x1cbc43);}(_0x97b2,0x1b7));var _0x297b=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x97b2[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x297b('0x0'));var util=require(_0x297b('0x1'));var moment=require(_0x297b('0x2'));var BPromise=require(_0x297b('0x3'));var rs=require(_0x297b('0x4'));var fs=require('fs');var Redis=require(_0x297b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x297b('0x6'));var logger=require(_0x297b('0x7'))('rpc');var config=require(_0x297b('0x8'));var jayson=require(_0x297b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x541d7b,_0x2c5bf5,_0x18a663){return new BPromise(function(_0x520b38,_0x27a761){return client[_0x297b('0xa')](_0x541d7b,_0x18a663)['then'](function(_0x176f98){logger['info'](_0x297b('0xb'),_0x2c5bf5,'request\x20sent');logger[_0x297b('0xc')](_0x297b('0xd'),_0x2c5bf5,_0x297b('0xe'),JSON[_0x297b('0xf')](_0x176f98));if(_0x176f98[_0x297b('0x10')]){if(_0x176f98[_0x297b('0x10')][_0x297b('0x11')]===0x1f4){logger[_0x297b('0x10')](_0x297b('0xb'),_0x2c5bf5,_0x176f98[_0x297b('0x10')][_0x297b('0x12')]);return _0x27a761(_0x176f98[_0x297b('0x10')][_0x297b('0x12')]);}logger[_0x297b('0x10')](_0x297b('0xb'),_0x2c5bf5,_0x176f98['error'][_0x297b('0x12')]);return _0x520b38(_0x176f98[_0x297b('0x10')]['message']);}else{logger[_0x297b('0x13')](_0x297b('0xb'),_0x2c5bf5,_0x297b('0xe'));_0x520b38(_0x176f98[_0x297b('0x14')][_0x297b('0x12')]);}})[_0x297b('0x15')](function(_0x4882a4){logger[_0x297b('0x10')](_0x297b('0xb'),_0x2c5bf5,_0x4882a4);_0x27a761(_0x4882a4);});});} \ No newline at end of file +var _0xdf94=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x3705e1,_0x3beecd){var _0x393ed3=function(_0x3434ac){while(--_0x3434ac){_0x3705e1['push'](_0x3705e1['shift']());}};_0x393ed3(++_0x3beecd);}(_0xdf94,0xad));var _0x4df9=function(_0x2661d1,_0x117780){_0x2661d1=_0x2661d1-0x0;var _0x41e138=_0xdf94[_0x2661d1];return _0x41e138;};'use strict';var _=require('lodash');var util=require(_0x4df9('0x0'));var moment=require(_0x4df9('0x1'));var BPromise=require(_0x4df9('0x2'));var rs=require(_0x4df9('0x3'));var fs=require('fs');var Redis=require(_0x4df9('0x4'));var db=require(_0x4df9('0x5'))['db'];var utils=require(_0x4df9('0x6'));var logger=require(_0x4df9('0x7'))(_0x4df9('0x8'));var config=require(_0x4df9('0x9'));var jayson=require(_0x4df9('0xa'));var client=jayson[_0x4df9('0xb')][_0x4df9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f46e3,_0x34faba,_0x2fac37){return new BPromise(function(_0x39ebc3,_0xf808f0){return client['request'](_0x2f46e3,_0x2fac37)[_0x4df9('0xd')](function(_0x3eaca1){logger[_0x4df9('0xe')](_0x4df9('0xf'),_0x34faba,_0x4df9('0x10'));logger[_0x4df9('0x11')](_0x4df9('0x12'),_0x34faba,'request\x20sent',JSON['stringify'](_0x3eaca1));if(_0x3eaca1[_0x4df9('0x13')]){if(_0x3eaca1['error'][_0x4df9('0x14')]===0x1f4){logger[_0x4df9('0x13')](_0x4df9('0xf'),_0x34faba,_0x3eaca1[_0x4df9('0x13')]['message']);return _0xf808f0(_0x3eaca1[_0x4df9('0x13')][_0x4df9('0x15')]);}logger[_0x4df9('0x13')]('SmsApplication,\x20%s,\x20%s',_0x34faba,_0x3eaca1[_0x4df9('0x13')][_0x4df9('0x15')]);return _0x39ebc3(_0x3eaca1[_0x4df9('0x13')]['message']);}else{logger[_0x4df9('0xe')]('SmsApplication,\x20%s,\x20%s',_0x34faba,_0x4df9('0x10'));_0x39ebc3(_0x3eaca1[_0x4df9('0x16')][_0x4df9('0x15')]);}})[_0x4df9('0x17')](function(_0x5d2910){logger[_0x4df9('0x13')](_0x4df9('0xf'),_0x34faba,_0x5d2910);_0xf808f0(_0x5d2910);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index fe1d9e8..5f096b4 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 _0xa571=['get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa571,0x107));var _0x1a57=function(_0x535279,_0x45d3da){_0x535279=_0x535279-0x0;var _0x570da3=_0xa571[_0x535279];return _0x570da3;};'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('./smsInteraction.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['describe']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')](_0x1a57('0xc'),auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),interaction['tracked'](_0x1a57('0x13'),_0x1a57('0x14')),controller[_0x1a57('0x15')]);router[_0x1a57('0x16')]('/:id',auth[_0x1a57('0x8')](),interaction['tracked']('sms',_0x1a57('0x17')),controller[_0x1a57('0x18')]);router[_0x1a57('0x19')]('/:id',auth[_0x1a57('0x8')](),interaction[_0x1a57('0x1a')](_0x1a57('0x13'),'smsinteraction:destroy'),controller[_0x1a57('0x1b')]);router[_0x1a57('0x19')](_0x1a57('0x1c'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x4fb5e7,_0x5061fb){var _0x6e6328=function(_0x451480){while(--_0x451480){_0x4fb5e7['push'](_0x4fb5e7['shift']());}};_0x6e6328(++_0x5061fb);}(_0xb03e,0x1eb));var _0xeb03=function(_0x43c55f,_0x47900b){_0x43c55f=_0x43c55f-0x0;var _0x1c6fcc=_0xb03e[_0x43c55f];return _0x1c6fcc;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x14')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x16')]);router[_0xeb03('0x14')](_0xeb03('0x17'),auth['isAuthenticated'](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1a')),controller[_0xeb03('0x1b')]);router['put'](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')]('sms',_0xeb03('0x1c')),controller[_0xeb03('0x1d')]);router[_0xeb03('0x1e')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1f')),controller[_0xeb03('0x20')]);router[_0xeb03('0x1e')](_0xeb03('0x17'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x21')]);module[_0xeb03('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e013239..fc0f1be 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 _0xfc46=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x2dff99,_0x14cd0b){var _0x4bcd3d=function(_0xa1e78e){while(--_0xa1e78e){_0x2dff99['push'](_0x2dff99['shift']());}};_0x4bcd3d(++_0x14cd0b);}(_0xfc46,0x9a));var _0x6fc4=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0xfc46[_0x26bcec];return _0x1049dc;};'use strict';var Sequelize=require(_0x6fc4('0x0'));var moment=require('moment');module[_0x6fc4('0x1')]={'closed':{'type':Sequelize[_0x6fc4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6fc4('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6fc4('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6fc4('0x4')]},'note':{'type':Sequelize[_0x6fc4('0x4')]},'phone':{'type':Sequelize[_0x6fc4('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6fc4('0x5')]('in',_0x6fc4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6fc4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6fc4('0x5')]('in',_0x6fc4('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6fc4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8098=['STRING','ENUM','exports','BOOLEAN','DATE'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x8098,0x1ba));var _0x8809=function(_0x1096a8,_0x3e78e7){_0x1096a8=_0x1096a8-0x0;var _0x842787=_0x8098[_0x1096a8];return _0x842787;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x8809('0x0')]={'closed':{'type':Sequelize[_0x8809('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8809('0x2')]},'disposition':{'type':Sequelize[_0x8809('0x3')]},'secondDisposition':{'type':Sequelize[_0x8809('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8809('0x3')]},'phone':{'type':Sequelize[_0x8809('0x3')]},'read1stAt':{'type':Sequelize[_0x8809('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8809('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8809('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8809('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8809('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 52565ac..2433364 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 _0x17c2=['params','includeAll','options','catch','create','body','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','emit','smsInteractionTags:save','removeTags','download','unix','root','files','tmp','join','server','attachments','format','transcript-%d-%s.zip','firstName','Messages','createdAt','secret','SmsAccount','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','disposition','direction','out','System','lastName','renderFile','views','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','SmsInteraction','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','parseSearch','search','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','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)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','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','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show'];(function(_0x4422c3,_0x3d9aea){var _0x57d3f2=function(_0x91735d){while(--_0x91735d){_0x4422c3['push'](_0x4422c3['shift']());}};_0x57d3f2(++_0x3d9aea);}(_0x17c2,0x128));var _0x217c=function(_0x416959,_0x1f34e2){_0x416959=_0x416959-0x0;var _0x3c849a=_0x17c2[_0x416959];return _0x3c849a;};'use strict';var emlformat=require(_0x217c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x217c('0x1'));var jsonpatch=require(_0x217c('0x2'));var rp=require('request-promise');var moment=require(_0x217c('0x3'));var BPromise=require(_0x217c('0x4'));var Mustache=require(_0x217c('0x5'));var util=require('util');var path=require(_0x217c('0x6'));var sox=require(_0x217c('0x7'));var csv=require(_0x217c('0x8'));var ejs=require(_0x217c('0x9'));var fs=require('fs');var fs_extra=require(_0x217c('0xa'));var _=require(_0x217c('0xb'));var squel=require(_0x217c('0xc'));var crypto=require(_0x217c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x217c('0xe'));var toCsv=require(_0x217c('0x8'));var querystring=require(_0x217c('0xf'));var Papa=require(_0x217c('0x10'));var Redis=require(_0x217c('0x11'));var authService=require(_0x217c('0x12'));var qs=require(_0x217c('0x13'));var as=require(_0x217c('0x14'));var pdf=require(_0x217c('0x15'));var hardwareService=require(_0x217c('0x16'));var logger=require(_0x217c('0x17'))('api');var utils=require(_0x217c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x217c('0x19'))['db'];config[_0x217c('0x1a')]=_['defaults'](config['redis'],{'host':_0x217c('0x1b'),'port':0x18eb});var socket=require(_0x217c('0x1c'))(new Redis(config[_0x217c('0x1a')]));require('./smsInteraction.socket')[_0x217c('0x1d')](socket);function respondWithStatusCode(_0x23584d,_0x40bb1e){_0x40bb1e=_0x40bb1e||0xcc;return function(_0x71f02c){if(_0x71f02c){return _0x23584d[_0x217c('0x1e')](_0x40bb1e);}return _0x23584d['status'](_0x40bb1e)[_0x217c('0x1f')]();};}function respondWithResult(_0x268521,_0xd906f0){_0xd906f0=_0xd906f0||0xc8;return function(_0x76518a){if(_0x76518a){return _0x268521[_0x217c('0x20')](_0xd906f0)[_0x217c('0x21')](_0x76518a);}};}function respondWithFilteredResult(_0x378c09,_0xd4bdce){return function(_0x2f68ba){if(_0x2f68ba){var _0xf2cba3=typeof _0xd4bdce[_0x217c('0x22')]===_0x217c('0x23')&&typeof _0xd4bdce['limit']===_0x217c('0x23');var _0x519c00=_0x2f68ba[_0x217c('0x24')];var _0xda7b84=_0xf2cba3?0x0:_0xd4bdce[_0x217c('0x22')];var _0xe537d4=_0xf2cba3?_0x2f68ba[_0x217c('0x24')]:_0xd4bdce[_0x217c('0x22')]+_0xd4bdce[_0x217c('0x25')];var _0x55bdb3;if(_0xe537d4>=_0x519c00){_0xe537d4=_0x519c00;_0x55bdb3=0xc8;}else{_0x55bdb3=0xce;}_0x378c09[_0x217c('0x20')](_0x55bdb3);return _0x378c09['set'](_0x217c('0x26'),_0xda7b84+'-'+_0xe537d4+'/'+_0x519c00)['json'](_0x2f68ba);}return null;};}function patchUpdates(_0x3e26d4){return function(_0x4bac0e){try{jsonpatch[_0x217c('0x27')](_0x4bac0e,_0x3e26d4,!![]);}catch(_0x1049d9){return BPromise['reject'](_0x1049d9);}return _0x4bac0e[_0x217c('0x28')]();};}function saveUpdates(_0x36bd69,_0x1ecbd8){return function(_0x3c07a0){if(_0x3c07a0){return _0x3c07a0['update'](_0x36bd69)[_0x217c('0x29')](function(_0x543811){return _0x543811;});}return null;};}function removeEntity(_0x15a66f,_0x404a23){return function(_0x467158){if(_0x467158){return _0x467158[_0x217c('0x2a')]()['then'](function(){_0x15a66f['status'](0xcc)[_0x217c('0x1f')]();});}};}function handleEntityNotFound(_0x5eaa01,_0x429afe){return function(_0x4830f7){if(!_0x4830f7){_0x5eaa01[_0x217c('0x1e')](0x194);}return _0x4830f7;};}function handleError(_0x3c35a6,_0x13778c){_0x13778c=_0x13778c||0x1f4;return function(_0x52f6cd){logger[_0x217c('0x2b')](_0x52f6cd['stack']);if(_0x52f6cd[_0x217c('0x2c')]){delete _0x52f6cd[_0x217c('0x2c')];}_0x3c35a6[_0x217c('0x20')](_0x13778c)[_0x217c('0x2d')](_0x52f6cd);};}function getInteractionUsers(_0x52c11b,_0x572147){return new BPromise(function(_0x59cf3d,_0x5b5cc8){try{if(_0x572147[_0x52c11b['id']]){_0x52c11b[_0x217c('0x2e')]=_[_0x217c('0x2f')](_0x572147[_0x52c11b['id']],function(_0x23bc4b){return{'id':_0x23bc4b['id'],'fullname':_0x23bc4b[_0x217c('0x30')]};});}}catch(_0xcb9786){_0x5b5cc8(_0xcb9786);}_0x59cf3d(_0x52c11b);});}function getInteractionTags(_0x4273df,_0x221815){return new BPromise(function(_0x3f992a,_0x4718ce){try{if(_0x4273df[_0x217c('0x31')]){_0x4273df[_0x217c('0x32')]=[];_0x4273df['TagIds'][_0x217c('0x33')](',')[_0x217c('0x34')](function(_0x36e040){_0x4273df[_0x217c('0x32')][_0x217c('0x35')](_0x221815[_0x36e040]);});}delete _0x4273df[_0x217c('0x31')];}catch(_0x152181){_0x4718ce(_0x152181);}_0x3f992a(_0x4273df);});}function updateSmsInteraction(_0x400f08,_0x99df12,_0x460a3a){return new BPromise(function(_0x130155,_0x32b2b7){return getInteractionUsers(_0x400f08,_0x460a3a)[_0x217c('0x29')](function(_0x5282a1){return getInteractionTags(_0x5282a1,_0x99df12);})[_0x217c('0x29')](function(_0x3963f1){_0x130155(_0x3963f1);})['catch'](function(_0x36902b){_0x32b2b7(_0x36902b);});});}exports[_0x217c('0x36')]=function(_0x298d5a,_0xc46a46){var _0x38d138={},_0x461de8={},_0x5d5e57={'count':0x0,'rows':[]};var _0xaf53f0=_[_0x217c('0x2f')](db[_0x217c('0x37')][_0x217c('0x38')],function(_0x489a0a){return{'name':_0x489a0a[_0x217c('0x39')],'type':_0x489a0a[_0x217c('0x3a')][_0x217c('0x3b')]};});_0x461de8['model']=_[_0x217c('0x2f')](_0xaf53f0,'name');_0x461de8['query']=_[_0x217c('0x3c')](_0x298d5a['query']);_0x461de8[_0x217c('0x3d')]=_[_0x217c('0x3e')](_0x461de8[_0x217c('0x3f')],_0x461de8['query']);_0x38d138[_0x217c('0x40')]=_[_0x217c('0x3e')](_0x461de8[_0x217c('0x3f')],qs['fields'](_0x298d5a['query'][_0x217c('0x41')]));_0x38d138['attributes']=_0x38d138[_0x217c('0x40')][_0x217c('0x42')]?_0x38d138[_0x217c('0x40')]:_0x461de8['model'];if(!_0x298d5a[_0x217c('0x43')][_0x217c('0x44')](_0x217c('0x45'))){_0x38d138['limit']=qs[_0x217c('0x25')](_0x298d5a[_0x217c('0x43')]['limit']);_0x38d138[_0x217c('0x22')]=qs['offset'](_0x298d5a[_0x217c('0x43')]['offset']);}_0x38d138[_0x217c('0x46')]=qs[_0x217c('0x47')](_0x298d5a[_0x217c('0x43')]['sort']);_0x38d138[_0x217c('0x48')]=qs[_0x217c('0x3d')](_[_0x217c('0x49')](_0x298d5a['query'],_0x461de8[_0x217c('0x3d')]),_0xaf53f0);var _0x4d3dd1=[];var _0x235de6=squel[_0x217c('0x4a')]()[_0x217c('0x4b')]('id')[_0x217c('0x4b')](_0x217c('0x2c'))['field'](_0x217c('0x4c'))[_0x217c('0x4d')](_0x217c('0x4e'));var _0xb21cea=squel[_0x217c('0x4a')]()[_0x217c('0x4b')]('u.id')[_0x217c('0x4b')](_0x217c('0x4f'))['field']('ui.SmsInteractionId')[_0x217c('0x4d')]('user_has_sms_interactions','ui')[_0x217c('0x50')](_0x217c('0x51'),'u',_0x217c('0x52'));var _0x29a3da=squel[_0x217c('0x4a')]()[_0x217c('0x4d')]('sms_interactions','i')[_0x217c('0x50')](_0x217c('0x53'),'c',_0x217c('0x54'))['left_join'](_0x217c('0x51'),'o',_0x217c('0x55'))[_0x217c('0x50')](_0x217c('0x56'),'a',_0x217c('0x57'))[_0x217c('0x50')](_0x217c('0x58'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x217c('0x50')](_0x217c('0x59'),'it',_0x217c('0x5a'))[_0x217c('0x50')](_0x217c('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x104bff=squel['expr']();var _0x33ef1e=[];var _0x444af1=squel[_0x217c('0x5b')]();var _0x28d64c;if(_0x298d5a[_0x217c('0x43')]['search']){_0x28d64c=as[_0x217c('0x5c')](_0x298d5a[_0x217c('0x43')][_0x217c('0x5d')]);var _0x5c75a3=_0x28d64c['sqlOperator'];for(var _0x1ac973=0x0;_0x1ac973<_0x28d64c[_0x217c('0x5e')]['length'];_0x1ac973++){var _0xb2eac1=_0x28d64c[_0x217c('0x5e')][_0x1ac973];var _0x50906e='i';var _0x4a78f6=_[_0x217c('0x5f')](_0xaf53f0,[_0x217c('0x2c'),_0xb2eac1[_0x217c('0x4b')]]);if(!_0x4a78f6){switch(_0xb2eac1['field']){case _0x217c('0x60'):if(_0xb2eac1['value']==0x1){_0x29a3da[_0x217c('0x61')]('`'+_0xb2eac1[_0x217c('0x4b')]+_0x217c('0x62'));}else{_0x29a3da[_0x217c('0x61')]('`'+_0xb2eac1[_0x217c('0x4b')]+_0x217c('0x63'));}break;case _0x217c('0x64'):if(_0xb2eac1[_0x217c('0x65')]===_0x217c('0x66')){if(_0xb2eac1[_0x217c('0x67')][_0x217c('0x33')]('\x20')[_0x217c('0x42')]>0x1){_0x104bff[_0x5c75a3](_0x217c('0x68'),qs[_0x217c('0x69')](_0xb2eac1[_0x217c('0x67')]),null);}else{var _0x27e517='%'+_0xb2eac1[_0x217c('0x67')]+'%';_0x104bff[_0x5c75a3](_0x217c('0x6a'),_0x27e517,_0x27e517,_0x27e517);}}else{_0x4a78f6=_[_0x217c('0x5f')](_0xaf53f0,[_0x217c('0x2c'),_0x217c('0x6b')]);_0xb2eac1[_0x217c('0x4b')]=_0x217c('0x6b');_0x5da8f1=as[_0x217c('0x6c')](_0x50906e,_0x4a78f6[_0x217c('0x3a')],_0xb2eac1);_0x104bff[_0x5c75a3](_0x5da8f1[_0x217c('0x6d')],_0x5da8f1[_0x217c('0x67')][_0x217c('0x6e')],_0x5da8f1[_0x217c('0x67')][_0x217c('0x1f')]);}break;case _0x217c('0x6f'):var _0x4a2bef=_0xb2eac1[_0x217c('0x67')]['split'](',')['map'](function(_0x1801d4){return Number(_0x1801d4);});_0x4a2bef['forEach'](function(_0x4202b9){_0x444af1['or'](_0x217c('0x70'),'%,'+_0x4202b9+',%');});_0x33ef1e=_[_0x217c('0x71')](_0x33ef1e,_0x4a2bef);break;case _0x217c('0x72'):if(_0xb2eac1[_0x217c('0x65')]==='$substring'){_0x104bff[_0x5c75a3](_0x217c('0x73'),'%'+_0xb2eac1[_0x217c('0x67')]+'%',null);}else{_0x4a78f6=_[_0x217c('0x5f')](_0xaf53f0,[_0x217c('0x2c'),'UserId']);_0xb2eac1[_0x217c('0x4b')]='UserId';_0x5da8f1=as[_0x217c('0x6c')](_0x50906e,_0x4a78f6[_0x217c('0x3a')],_0xb2eac1);_0x104bff[_0x5c75a3](_0x5da8f1[_0x217c('0x6d')],_0x5da8f1[_0x217c('0x67')][_0x217c('0x6e')],_0x5da8f1['value']['end']);}break;case'body':_0x5da8f1=as[_0x217c('0x6c')]('me',null,_0xb2eac1);_0x104bff[_0x5c75a3](_0x5da8f1[_0x217c('0x6d')],_0x5da8f1[_0x217c('0x67')][_0x217c('0x6e')],_0x5da8f1[_0x217c('0x67')][_0x217c('0x1f')]);break;}}else{var _0x5da8f1=as[_0x217c('0x6c')](_0x50906e,_0x4a78f6[_0x217c('0x3a')],_0xb2eac1);_0x104bff[_0x5c75a3](_0x5da8f1[_0x217c('0x6d')],_0x5da8f1[_0x217c('0x67')]['start'],_0x5da8f1[_0x217c('0x67')][_0x217c('0x1f')]);}}}else{var _0x4a54bb=_(_0x298d5a[_0x217c('0x43')])[_0x217c('0x3c')]()[_0x217c('0x2f')](function(_0x1d74d0){return _[_0x217c('0x74')](_0xaf53f0,[_0x217c('0x2c'),_0x1d74d0])?_0x1d74d0:undefined;})[_0x217c('0x75')]()[_0x217c('0x67')]();if(!_[_0x217c('0x76')](_0x4a54bb)){_0x4a54bb['forEach'](function(_0x979b43){if(_0x979b43===_0x217c('0x77')){_0x29a3da[_0x217c('0x48')](_0x217c('0x78'),[][_0x217c('0x79')](_0x298d5a[_0x217c('0x43')][_0x979b43]));}else if(_0x979b43==='createdAt'){var _0x1d58d4=JSON[_0x217c('0x7a')](_0x298d5a[_0x217c('0x43')][_0x979b43])['$gte'];var _0x56c1e4=JSON[_0x217c('0x7a')](_0x298d5a[_0x217c('0x43')][_0x979b43])[_0x217c('0x7b')];_0x29a3da[_0x217c('0x48')](_0x217c('0x7c'),_0x1d58d4,_0x56c1e4);}else{if(_0x298d5a[_0x217c('0x43')][_0x979b43]===_0x217c('0x7d')){_0x29a3da['where']('i.'+_0x979b43+_0x217c('0x7e'));}else{_0x29a3da['where']('i.'+_0x979b43+_0x217c('0x7f'),_0x298d5a[_0x217c('0x43')][_0x979b43]);}}});}if(_0x298d5a[_0x217c('0x43')][_0x217c('0x80')]){if(_0x298d5a['query'][_0x217c('0x80')]==0x1){_0x29a3da[_0x217c('0x61')](_0x217c('0x81'));}else{_0x29a3da[_0x217c('0x61')](_0x217c('0x82'));}}if(_0x298d5a['query'][_0x217c('0x83')]){_0x33ef1e=_[_0x217c('0x84')](_0x298d5a['query']['tag'])?_0x298d5a[_0x217c('0x43')][_0x217c('0x83')]:new Array(_0x298d5a[_0x217c('0x43')]['tag']);_0x33ef1e[_0x217c('0x34')](function(_0x5a8c6a){_0x444af1['or'](_0x217c('0x70'),'%,'+_0x5a8c6a+',%');});}if(_0x298d5a['query'][_0x217c('0x85')]){var _0x1d867b=_0x298d5a[_0x217c('0x43')][_0x217c('0x85')][_0x217c('0x86')]('\x5c','\x5c\x5c')[_0x217c('0x86')](/'/g,'\x27\x27');if(qs[_0x217c('0x87')](_0x1d867b)){_0x104bff['or'](_0x217c('0x88'),_0x1d867b+'%')['or'](_0x217c('0x89'),_0x1d867b+'%');}else{_0x104bff['or'](_0x217c('0x8a'),qs[_0x217c('0x69')](_0x1d867b))['or'](_0x217c('0x8b'),_0x1d867b+'%');}}}_0x29a3da['where'](_0x104bff);_0x29a3da[_0x217c('0x8c')](_0x217c('0x8d'));var _0x36609d={'type':db[_0x217c('0x8e')][_0x217c('0x8f')][_0x217c('0x90')],'raw':!![]};var _0x2c73e8=_0x29a3da[_0x217c('0x91')]();_0x2c73e8[_0x217c('0x4b')](_0x217c('0x8d'));_0x2c73e8['field'](_0x217c('0x92'),_0x217c('0x60'));if(_0x38d138['order']){_0x38d138[_0x217c('0x46')][_0x217c('0x34')](function(_0xacfb01){var _0x449eff=_0xacfb01[0x0]===_0x217c('0x93')?_0xacfb01[0x0]:'i.'+_0xacfb01[0x0];_0x29a3da[_0x217c('0x46')](_0x449eff,_0xacfb01[0x1]===_0x217c('0x94')?![]:!![]);});}if(!_[_0x217c('0x76')](_0x33ef1e)){_0x29a3da[_0x217c('0x61')](_0x444af1);_0x2c73e8[_0x217c('0x48')](_0x217c('0x95'),_0x33ef1e);}BPromise[_0x217c('0x96')]()[_0x217c('0x29')](function(){if(!_0x28d64c){if(_0x298d5a['query'][_0x217c('0x77')])return;_0x2c73e8['where'](_0x217c('0x97'));_0x29a3da[_0x217c('0x48')](_0x217c('0x97'));return;}if(_0x298d5a[_0x217c('0x98')][_0x217c('0x99')]!==_0x217c('0x9a'))return;return _0x298d5a[_0x217c('0x98')][_0x217c('0x9b')]({'attributes':['id'],'raw':!![]})[_0x217c('0x29')](function(_0x397674){if(_['isEmpty'](_0x397674)){_0x2c73e8[_0x217c('0x48')](_0x217c('0x9c'));_0x29a3da[_0x217c('0x48')](_0x217c('0x9c'));}else{_0x2c73e8['where'](_0x217c('0x78'),_[_0x217c('0x2f')](_0x397674,'id'));_0x29a3da['where'](_0x217c('0x78'),_['map'](_0x397674,'id'));}});})[_0x217c('0x29')](function(){if(_0x298d5a[_0x217c('0x98')][_0x217c('0x99')]===_0x217c('0x9a')&&!_0x28d64c&&!_0x298d5a['query']['SmsAccountId'])return[];return db['sequelize'][_0x217c('0x43')](_0x2c73e8[_0x217c('0x9d')](),_0x36609d);})[_0x217c('0x29')](function(_0x177137){_0x5d5e57['count']=_0x177137[_0x217c('0x42')];if(_0x5d5e57[_0x217c('0x24')]===0x0)return[];return db[_0x217c('0x9e')][_0x217c('0x43')](_0x235de6[_0x217c('0x9d')](),_0x36609d)['then'](function(_0x551280){_0x4d3dd1=_[_0x217c('0x9f')](_0x551280,'id');_0x36609d=_[_0x217c('0xa0')](_0x36609d,{'model':db[_0x217c('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x298d5a[_0x217c('0x43')][_0x217c('0x41')]){_0x38d138['attributes']['forEach'](function(_0x35bf85){_0x29a3da[_0x217c('0x4b')]('i.'+_0x35bf85);});}else{_0x29a3da[_0x217c('0x4b')](_0x217c('0x92'),_0x217c('0x60'));_0x29a3da[_0x217c('0x4b')]('a.key',_0x217c('0xa1'));_0x29a3da[_0x217c('0x4b')](_0x217c('0xa2'),_0x217c('0xa3'));_0x29a3da[_0x217c('0x4b')](_0x217c('0xa4'),'contactName');_0x29a3da['field'](_0x217c('0xa5'));_0x29a3da[_0x217c('0x4b')](_0x217c('0xa6'),_0x217c('0xa7'));_0x29a3da[_0x217c('0x4b')](_0x217c('0xa8'),'Contact.lastName');_0x29a3da[_0x217c('0x4b')](_0x217c('0xa9'),'Contact.email');_0x29a3da[_0x217c('0x4b')](_0x217c('0xaa'),'Contact.phone');_0x29a3da[_0x217c('0x4b')](_0x217c('0xab'),_0x217c('0xac'));_0x29a3da[_0x217c('0x4b')](_0x217c('0xad'),_0x217c('0xae'));_0x29a3da[_0x217c('0x4b')](_0x217c('0xaf'),'Owner.fullname');_0x29a3da['field']('o.internal',_0x217c('0xb0'));_0x29a3da[_0x217c('0x4b')](_0x217c('0xb1'),_0x217c('0x31'));}if(_0x38d138['limit'])_0x29a3da[_0x217c('0x25')](_0x38d138[_0x217c('0x25')]);if(_0x38d138[_0x217c('0x22')])_0x29a3da[_0x217c('0x22')](_0x38d138[_0x217c('0x22')]);return db[_0x217c('0x9e')][_0x217c('0x43')](_0x29a3da['toString'](),_0x36609d);})[_0x217c('0x29')](function(_0x153aa1){if(_0x153aa1[_0x217c('0x42')]>0x0)_0xb21cea['where'](_0x217c('0xb2'),_[_0x217c('0x2f')](_0x153aa1,'id'));return db[_0x217c('0x9e')][_0x217c('0x43')](_0xb21cea['toString'](),_0x36609d)[_0x217c('0x29')](function(_0x2e35f2){var _0x317324=_[_0x217c('0xb3')](_0x2e35f2,_0x217c('0xb4'));var _0x2593b6=[];_0x153aa1[_0x217c('0x34')](function(_0x1bb3cc){_0x2593b6[_0x217c('0x35')](updateSmsInteraction(_0x1bb3cc,_0x4d3dd1,_0x317324));});return BPromise[_0x217c('0xb5')](_0x2593b6);});});})[_0x217c('0x29')](function(_0x2a33aa){_0x5d5e57[_0x217c('0xb6')]=_0x2a33aa;return _0x5d5e57;})['then'](respondWithFilteredResult(_0xc46a46,_0x38d138))['catch'](handleError(_0xc46a46,null));};exports[_0x217c('0xb7')]=function(_0x12291b,_0x1e0429){var _0x59832c={'raw':![],'where':{'id':_0x12291b[_0x217c('0xb8')]['id']}},_0x3dcaef={};_0x3dcaef[_0x217c('0x3f')]=_[_0x217c('0x3c')](db[_0x217c('0x37')][_0x217c('0x38')]);_0x3dcaef[_0x217c('0x43')]=_['keys'](_0x12291b['query']);_0x3dcaef['filters']=_[_0x217c('0x3e')](_0x3dcaef[_0x217c('0x3f')],_0x3dcaef[_0x217c('0x43')]);_0x59832c[_0x217c('0x40')]=_[_0x217c('0x3e')](_0x3dcaef[_0x217c('0x3f')],qs[_0x217c('0x41')](_0x12291b[_0x217c('0x43')][_0x217c('0x41')]));_0x59832c[_0x217c('0x40')]=_0x59832c['attributes'][_0x217c('0x42')]?_0x59832c['attributes']:_0x3dcaef['model'];if(_0x12291b[_0x217c('0x43')][_0x217c('0xb9')]){_0x59832c['include']=[{'all':!![]}];}_0x59832c=_[_0x217c('0xa0')]({},_0x59832c,_0x12291b[_0x217c('0xba')]);return db[_0x217c('0x37')][_0x217c('0x5f')](_0x59832c)[_0x217c('0x29')](handleEntityNotFound(_0x1e0429,null))[_0x217c('0x29')](respondWithResult(_0x1e0429,null))[_0x217c('0xbb')](handleError(_0x1e0429,null));};exports[_0x217c('0xbc')]=function(_0x1c5b91,_0x3ee760){return db[_0x217c('0x37')][_0x217c('0xbc')](_0x1c5b91[_0x217c('0xbd')],{})['then'](respondWithResult(_0x3ee760,0xc9))[_0x217c('0xbb')](handleError(_0x3ee760,null));};exports[_0x217c('0xbe')]=function(_0x470aec,_0x3d96e0){if(_0x470aec['body']['id']){delete _0x470aec[_0x217c('0xbd')]['id'];}return db[_0x217c('0x37')][_0x217c('0x5f')]({'where':{'id':_0x470aec[_0x217c('0xb8')]['id']}})[_0x217c('0x29')](handleEntityNotFound(_0x3d96e0,null))[_0x217c('0x29')](saveUpdates(_0x470aec[_0x217c('0xbd')],null))[_0x217c('0x29')](respondWithResult(_0x3d96e0,null))['catch'](handleError(_0x3d96e0,null));};exports[_0x217c('0x2a')]=function(_0x131ee6,_0x3a1429){return db[_0x217c('0x37')][_0x217c('0x5f')]({'where':{'id':_0x131ee6[_0x217c('0xb8')]['id']}})[_0x217c('0x29')](handleEntityNotFound(_0x3a1429,null))[_0x217c('0x29')](removeEntity(_0x3a1429,null))[_0x217c('0xbb')](handleError(_0x3a1429,null));};exports[_0x217c('0xbf')]=function(_0x1f749e,_0x3b06fc){return db[_0x217c('0x37')][_0x217c('0xbf')]()[_0x217c('0x29')](respondWithResult(_0x3b06fc,null))[_0x217c('0xbb')](handleError(_0x3b06fc,null));};exports[_0x217c('0xc0')]=function(_0x5553a7,_0x3d8814,_0x4194fb){return db[_0x217c('0xc1')][_0x217c('0x5f')]({'where':{'id':_0x5553a7[_0x217c('0xb8')]['id']}})['then'](handleEntityNotFound(_0x3d8814,null))[_0x217c('0x29')](function(_0x4be929){if(_0x4be929){return _0x4be929['addMessage'](_0x5553a7[_0x217c('0xbd')][_0x217c('0xc2')],_[_0x217c('0xc3')](_0x5553a7['body'],[_0x217c('0xc2'),'id'])||{});}})[_0x217c('0x29')](respondWithResult(_0x3d8814,null))[_0x217c('0xbb')](handleError(_0x3d8814,null));};exports[_0x217c('0xc4')]=function(_0x1d8273,_0x3f5f07,_0x4df7b9){var _0x2c90b1={'raw':![],'where':{}};var _0x12932b={};var _0x2e4298={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x217c('0xc5')]({'where':{'id':_0x1d8273['params']['id']}})[_0x217c('0x29')](handleEntityNotFound(_0x3f5f07,null))[_0x217c('0x29')](function(_0x6df0c8){if(_0x6df0c8){_0x12932b[_0x217c('0x3f')]=_[_0x217c('0x3c')](db['SmsMessage'][_0x217c('0x38')]);_0x12932b['query']=_[_0x217c('0x3c')](_0x1d8273[_0x217c('0x43')]);_0x12932b[_0x217c('0x3d')]=_[_0x217c('0x3e')](_0x12932b[_0x217c('0x3f')],_0x12932b[_0x217c('0x43')]);_0x2c90b1[_0x217c('0x40')]=_[_0x217c('0x3e')](_0x12932b[_0x217c('0x3f')],qs[_0x217c('0x41')](_0x1d8273[_0x217c('0x43')][_0x217c('0x41')]));_0x2c90b1[_0x217c('0x40')]=_0x2c90b1[_0x217c('0x40')][_0x217c('0x42')]?_0x2c90b1[_0x217c('0x40')]:_0x12932b[_0x217c('0x3f')];if(!_0x1d8273[_0x217c('0x43')][_0x217c('0x44')](_0x217c('0x45'))){_0x2c90b1[_0x217c('0x25')]=qs[_0x217c('0x25')](_0x1d8273['query'][_0x217c('0x25')]);_0x2c90b1['offset']=qs[_0x217c('0x22')](_0x1d8273[_0x217c('0x43')][_0x217c('0x22')]);}_0x2c90b1[_0x217c('0x46')]=qs[_0x217c('0x47')](_0x1d8273['query'][_0x217c('0x47')]);_0x2c90b1['where']=qs[_0x217c('0x3d')](_[_0x217c('0x49')](_0x1d8273['query'],_0x12932b['filters']));_0x2c90b1['where'][_0x217c('0xb4')]=_0x6df0c8['id'];if(_0x1d8273['query'][_0x217c('0x85')]){_0x2c90b1[_0x217c('0x48')]=_[_0x217c('0xa0')](_0x2c90b1[_0x217c('0x48')],{'$or':_[_0x217c('0x2f')](_0x2c90b1[_0x217c('0x40')],function(_0x4962f2){var _0x263c68={};_0x263c68[_0x4962f2]={'$like':'%'+_0x1d8273[_0x217c('0x43')][_0x217c('0x85')]+'%'};return _0x263c68;})});}if(_0x1d8273[_0x217c('0x43')][_0x217c('0xc6')]){var _0x36651d=_0x1d8273[_0x217c('0x43')][_0x217c('0xc6')]['split'](',');var _0x42562e={};_0x42562e[_0x36651d[0x0]]={'$gte':moment(_0x36651d[0x1])['format'](_0x217c('0xc7'))};_0x2c90b1[_0x217c('0x48')]=_[_0x217c('0xa0')](_0x2c90b1['where'],_0x42562e);}_0x2c90b1=_[_0x217c('0xa0')]({},_0x2c90b1,_0x1d8273[_0x217c('0xba')]);return db['SmsMessage'][_0x217c('0x24')]({'where':_0x2c90b1[_0x217c('0x48')]})[_0x217c('0x29')](function(_0x8d0e0e){_0x2e4298['count']=_0x8d0e0e;if(_0x1d8273[_0x217c('0x43')][_0x217c('0xb9')]){_0x2c90b1['include']=[{'all':!![]}];}return db[_0x217c('0xc1')][_0x217c('0xc8')](_0x2c90b1);})['then'](function(_0x4d148d){_0x2e4298[_0x217c('0xb6')]=_0x4d148d;return _0x2e4298;});}})[_0x217c('0x29')](respondWithFilteredResult(_0x3f5f07,_0x2c90b1))['catch'](handleError(_0x3f5f07,null));};exports['addTags']=function(_0x4fa9a5,_0x40364f,_0x151afc){return db[_0x217c('0x37')]['find']({'where':{'id':_0x4fa9a5[_0x217c('0xb8')]['id']}})[_0x217c('0x29')](handleEntityNotFound(_0x40364f,null))[_0x217c('0x29')](function(_0x4157b6){if(_0x4157b6){return _0x4157b6['setTags'](_0x4fa9a5[_0x217c('0xbd')][_0x217c('0xc2')],_[_0x217c('0xc3')](_0x4fa9a5[_0x217c('0xbd')],[_0x217c('0xc2'),'id'])||{})['spread'](function(){return db[_0x217c('0x6f')][_0x217c('0xc8')]({'attributes':['id',_0x217c('0x2c'),_0x217c('0x4c')],'where':{'id':_0x4fa9a5[_0x217c('0xbd')][_0x217c('0xc2')]}});})[_0x217c('0x29')](function(_0x1bcd97){socket[_0x217c('0xc9')](_0x217c('0xca'),{'id':Number(_0x4fa9a5[_0x217c('0xb8')]['id']),'tags':_0x1bcd97||[]});return{'id':Number(_0x4fa9a5[_0x217c('0xb8')]['id']),'tags':_0x1bcd97||[]};});}})[_0x217c('0x29')](respondWithResult(_0x40364f,null))[_0x217c('0xbb')](handleError(_0x40364f,null));};exports[_0x217c('0xcb')]=function(_0x4817d9,_0x2788c1,_0x8e6891){return db['SmsInteraction'][_0x217c('0x5f')]({'where':{'id':_0x4817d9[_0x217c('0xb8')]['id']}})[_0x217c('0x29')](handleEntityNotFound(_0x2788c1,null))['then'](function(_0x1bdb22){if(_0x1bdb22){return _0x1bdb22[_0x217c('0xcb')](_0x4817d9['query'][_0x217c('0xc2')]);}})['then'](respondWithStatusCode(_0x2788c1,null))[_0x217c('0xbb')](handleError(_0x2788c1,null));};exports[_0x217c('0xcc')]=function(_0x486444,_0x18a78e){var _0x459849=moment()[_0x217c('0xcd')]()[_0x217c('0x9d')]();var _0x53d063=path['join'](config[_0x217c('0xce')],'server',_0x217c('0xcf'),_0x217c('0xd0'));var _0x595df1=path[_0x217c('0xd1')](config[_0x217c('0xce')],_0x217c('0xd2'),_0x217c('0xcf'),_0x217c('0xd3'));var _0x513820=path[_0x217c('0xd1')](_0x53d063,_0x459849);var _0x427c6e=util[_0x217c('0xd4')](_0x217c('0xd5'),_0x486444[_0x217c('0xb8')]['id'],_0x459849);var _0x4e7aa4=path['join'](_0x53d063,_0x427c6e);var _0x5d2407=[];_0x5d2407[_0x217c('0x35')]({'model':db['User'],'as':_0x217c('0x72'),'attributes':['id',_0x217c('0x30')],'raw':!![]});_0x5d2407[_0x217c('0x35')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x217c('0xd6'),'lastName'],'raw':!![]});var _0x392c9f=[{'model':db[_0x217c('0xc1')],'as':_0x217c('0xd7'),'attributes':['id',_0x217c('0xbd'),_0x217c('0xd8'),'direction',_0x217c('0xd9'),_0x217c('0x80')],'include':_0x5d2407}];_0x392c9f[_0x217c('0x35')]({'model':db[_0x217c('0xda')],'as':_0x217c('0xdb'),'attributes':['id','name']});_0x392c9f['push']({'model':db[_0x217c('0x72')],'as':_0x217c('0xdc'),'attributes':['id',_0x217c('0x30')]});return db[_0x217c('0x37')][_0x217c('0x5f')]({'where':{'id':_0x486444['params']['id']},'include':_0x392c9f})[_0x217c('0x29')](handleEntityNotFound(_0x18a78e,null))[_0x217c('0x29')](function(_0x2d0657){if(_0x2d0657){var _0x29dc82=_0x2d0657[_0x217c('0xdd')]({'plain':!![]});fs[_0x217c('0xde')](_0x513820);var _0x4c6aa0={'channel':'Sms','account':_0x29dc82[_0x217c('0xdb')][_0x217c('0x2c')],'agent':_0x29dc82['Owner']?_0x29dc82[_0x217c('0xdc')][_0x217c('0x30')]:_0x217c('0xdf'),'createdAt':moment(_0x29dc82[_0x217c('0xd8')])['format'](_0x217c('0xc7'))['toString'](),'closedAt':_0x29dc82[_0x217c('0xe0')]?moment(_0x29dc82[_0x217c('0xe1')])[_0x217c('0xd4')](_0x217c('0xc7'))[_0x217c('0x9d')]():'','disposition':_0x29dc82[_0x217c('0xe2')],'messages':_(_0x29dc82[_0x217c('0xd7')])[_0x217c('0x85')]({'secret':![]})['map'](function(_0x281ef4){return{'date':moment(_0x281ef4[_0x217c('0xd8')])[_0x217c('0xd4')](_0x217c('0xc7'))[_0x217c('0x9d')](),'sender':_0x281ef4[_0x217c('0xe3')]===_0x217c('0xe4')?_0x281ef4[_0x217c('0x72')]?_0x281ef4[_0x217c('0x72')][_0x217c('0x30')]:_0x217c('0xe5'):_0x281ef4[_0x217c('0x64')][_0x217c('0xd6')]+(_0x281ef4[_0x217c('0x64')][_0x217c('0xe6')]?'\x20'+_0x281ef4[_0x217c('0x64')][_0x217c('0xe6')]:''),'body':_0x281ef4[_0x217c('0xbd')],'direction':_0x281ef4[_0x217c('0xe3')]===_0x217c('0xe4')?'A':'C','secret':_0x281ef4[_0x217c('0xd9')],'read':_0x281ef4['read']};})[_0x217c('0x67')]()};return ejs[_0x217c('0xe7')](path['join'](config['root'],'server',_0x217c('0xe8'),'downloadInteraction.ejs'),{'interaction':_0x4c6aa0})[_0x217c('0x29')](function(_0x707915){var _0x11bdca=path[_0x217c('0xd1')](_0x513820,_0x217c('0xe9')+_0x29dc82['id']+'-'+_0x459849+_0x217c('0xea'));var _0x4bbe92={'path':_0x11bdca,'channel':_0x217c('0xeb'),'interactionId':_0x29dc82['id']};return pdf[_0x217c('0xec')](_0x707915,_0x4bbe92);})[_0x217c('0x29')](function(){return new BPromise(function(_0x59e1f2,_0x289c58){zipdir(_0x513820,{'saveTo':_0x4e7aa4},function(_0x16ddee,_0x231fa5){if(_0x16ddee)return _0x289c58(_0x16ddee);return _0x59e1f2(_0x231fa5);});})[_0x217c('0x29')](function(){return new BPromise(function(_0x440697,_0x1790af){rimraf(_0x513820,function(_0x40c93a){if(_0x40c93a)_0x1790af(_0x40c93a);return _0x440697();});});})['then'](function(){return _0x18a78e['download'](_0x4e7aa4,_0x427c6e,function(_0x19a6c5){if(_0x19a6c5){console[_0x217c('0xed')](_0x217c('0xee'),_0x19a6c5);}else{fs[_0x217c('0xef')](_0x4e7aa4);}});});});}else{return _0x18a78e[_0x217c('0x1e')](0xc8);}})[_0x217c('0xbb')](handleError(_0x18a78e,null));}; \ No newline at end of file +var _0x77bb=['nolimit','order','sort','where','pick','select','field','name','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','text','body','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','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','Sequelize','QueryTypes','SELECT','i.id','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','contactName','i.*','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','catch','show','params','includeAll','include','create','describe','addMessage','SmsMessage','ids','omit','hasOwnProperty','format','findAll','addTags','setTags','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','CmContact','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','get','mkdirSync','Owner','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','out','System','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x77bb,0x194));var _0xb77b=function(_0x4cf0a9,_0x450e21){_0x4cf0a9=_0x4cf0a9-0x0;var _0x388b93=_0x77bb[_0x4cf0a9];return _0x388b93;};'use strict';var emlformat=require(_0xb77b('0x0'));var rimraf=require(_0xb77b('0x1'));var zipdir=require(_0xb77b('0x2'));var jsonpatch=require(_0xb77b('0x3'));var rp=require('request-promise');var moment=require(_0xb77b('0x4'));var BPromise=require(_0xb77b('0x5'));var Mustache=require(_0xb77b('0x6'));var util=require(_0xb77b('0x7'));var path=require(_0xb77b('0x8'));var sox=require(_0xb77b('0x9'));var csv=require(_0xb77b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb77b('0xb'));var _=require('lodash');var squel=require(_0xb77b('0xc'));var crypto=require(_0xb77b('0xd'));var jsforce=require(_0xb77b('0xe'));var deskjs=require(_0xb77b('0xf'));var toCsv=require(_0xb77b('0xa'));var querystring=require(_0xb77b('0x10'));var Papa=require(_0xb77b('0x11'));var Redis=require(_0xb77b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb77b('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xb77b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb77b('0x15'));var config=require(_0xb77b('0x16'));var licenseUtil=require(_0xb77b('0x17'));var db=require(_0xb77b('0x18'))['db'];config[_0xb77b('0x19')]=_[_0xb77b('0x1a')](config[_0xb77b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb77b('0x1b'))(new Redis(config[_0xb77b('0x19')]));require(_0xb77b('0x1c'))[_0xb77b('0x1d')](socket);function respondWithStatusCode(_0xa15e94,_0x49a9ea){_0x49a9ea=_0x49a9ea||0xcc;return function(_0x23606f){if(_0x23606f){return _0xa15e94['sendStatus'](_0x49a9ea);}return _0xa15e94[_0xb77b('0x1e')](_0x49a9ea)[_0xb77b('0x1f')]();};}function respondWithResult(_0x29457c,_0x154348){_0x154348=_0x154348||0xc8;return function(_0x18d799){if(_0x18d799){return _0x29457c['status'](_0x154348)[_0xb77b('0x20')](_0x18d799);}};}function respondWithFilteredResult(_0x4ec00f,_0x1e1a6e){return function(_0x3faef6){if(_0x3faef6){var _0xe8dd9b=typeof _0x1e1a6e[_0xb77b('0x21')]===_0xb77b('0x22')&&typeof _0x1e1a6e[_0xb77b('0x23')]===_0xb77b('0x22');var _0x2639d2=_0x3faef6[_0xb77b('0x24')];var _0x1d04f8=_0xe8dd9b?0x0:_0x1e1a6e[_0xb77b('0x21')];var _0x27b703=_0xe8dd9b?_0x3faef6[_0xb77b('0x24')]:_0x1e1a6e[_0xb77b('0x21')]+_0x1e1a6e['limit'];var _0x3c27d2;if(_0x27b703>=_0x2639d2){_0x27b703=_0x2639d2;_0x3c27d2=0xc8;}else{_0x3c27d2=0xce;}_0x4ec00f[_0xb77b('0x1e')](_0x3c27d2);return _0x4ec00f[_0xb77b('0x25')](_0xb77b('0x26'),_0x1d04f8+'-'+_0x27b703+'/'+_0x2639d2)[_0xb77b('0x20')](_0x3faef6);}return null;};}function patchUpdates(_0x4f6b43){return function(_0x183206){try{jsonpatch[_0xb77b('0x27')](_0x183206,_0x4f6b43,!![]);}catch(_0xa7f480){return BPromise[_0xb77b('0x28')](_0xa7f480);}return _0x183206[_0xb77b('0x29')]();};}function saveUpdates(_0x8f31c4,_0x1d2728){return function(_0x214bd7){if(_0x214bd7){return _0x214bd7[_0xb77b('0x2a')](_0x8f31c4)[_0xb77b('0x2b')](function(_0x3fb74f){return _0x3fb74f;});}return null;};}function removeEntity(_0x14c9cb,_0x254247){return function(_0xa385ec){if(_0xa385ec){return _0xa385ec[_0xb77b('0x2c')]()[_0xb77b('0x2b')](function(){_0x14c9cb[_0xb77b('0x1e')](0xcc)[_0xb77b('0x1f')]();});}};}function handleEntityNotFound(_0x23391c,_0x4f4d28){return function(_0x56b366){if(!_0x56b366){_0x23391c[_0xb77b('0x2d')](0x194);}return _0x56b366;};}function handleError(_0x3d1c0f,_0x148d14){_0x148d14=_0x148d14||0x1f4;return function(_0x2ccb86){logger['error'](_0x2ccb86[_0xb77b('0x2e')]);if(_0x2ccb86['name']){delete _0x2ccb86['name'];}_0x3d1c0f['status'](_0x148d14)[_0xb77b('0x2f')](_0x2ccb86);};}function getInteractionUsers(_0x11fccb,_0x185be4){return new BPromise(function(_0x4709d9,_0x389e03){try{if(_0x185be4[_0x11fccb['id']]){_0x11fccb[_0xb77b('0x30')]=_[_0xb77b('0x31')](_0x185be4[_0x11fccb['id']],function(_0x33d45d){return{'id':_0x33d45d['id'],'fullname':_0x33d45d[_0xb77b('0x32')]};});}}catch(_0x337e55){_0x389e03(_0x337e55);}_0x4709d9(_0x11fccb);});}function getInteractionTags(_0x499c80,_0x59c7de){return new BPromise(function(_0x502fd6,_0x3b3fce){try{if(_0x499c80[_0xb77b('0x33')]){_0x499c80[_0xb77b('0x34')]=[];_0x499c80[_0xb77b('0x33')][_0xb77b('0x35')](',')[_0xb77b('0x36')](function(_0x759f4b){_0x499c80[_0xb77b('0x34')][_0xb77b('0x37')](_0x59c7de[_0x759f4b]);});}delete _0x499c80[_0xb77b('0x33')];}catch(_0xee7fb5){_0x3b3fce(_0xee7fb5);}_0x502fd6(_0x499c80);});}function updateSmsInteraction(_0x4f9a7b,_0x430d35,_0x4af250){return new BPromise(function(_0x448939,_0x1d7e22){return getInteractionUsers(_0x4f9a7b,_0x4af250)['then'](function(_0x504736){return getInteractionTags(_0x504736,_0x430d35);})[_0xb77b('0x2b')](function(_0xa16c8b){_0x448939(_0xa16c8b);})['catch'](function(_0x1e9f1a){_0x1d7e22(_0x1e9f1a);});});}exports[_0xb77b('0x38')]=function(_0x2a7a58,_0x234b61){var _0x3ef217={},_0x4c03c2={},_0x24072e={'count':0x0,'rows':[]};var _0x24d0d8=_[_0xb77b('0x31')](db[_0xb77b('0x39')][_0xb77b('0x3a')],function(_0x37f6b4){return{'name':_0x37f6b4[_0xb77b('0x3b')],'type':_0x37f6b4[_0xb77b('0x3c')][_0xb77b('0x3d')]};});_0x4c03c2[_0xb77b('0x3e')]=_[_0xb77b('0x31')](_0x24d0d8,'name');_0x4c03c2[_0xb77b('0x3f')]=_[_0xb77b('0x40')](_0x2a7a58[_0xb77b('0x3f')]);_0x4c03c2[_0xb77b('0x41')]=_[_0xb77b('0x42')](_0x4c03c2['model'],_0x4c03c2[_0xb77b('0x3f')]);_0x3ef217[_0xb77b('0x43')]=_['intersection'](_0x4c03c2[_0xb77b('0x3e')],qs[_0xb77b('0x44')](_0x2a7a58[_0xb77b('0x3f')]['fields']));_0x3ef217['attributes']=_0x3ef217[_0xb77b('0x43')][_0xb77b('0x45')]?_0x3ef217[_0xb77b('0x43')]:_0x4c03c2['model'];if(!_0x2a7a58[_0xb77b('0x3f')]['hasOwnProperty'](_0xb77b('0x46'))){_0x3ef217[_0xb77b('0x23')]=qs[_0xb77b('0x23')](_0x2a7a58[_0xb77b('0x3f')]['limit']);_0x3ef217['offset']=qs[_0xb77b('0x21')](_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x21')]);}_0x3ef217[_0xb77b('0x47')]=qs[_0xb77b('0x48')](_0x2a7a58[_0xb77b('0x3f')]['sort']);_0x3ef217[_0xb77b('0x49')]=qs[_0xb77b('0x41')](_[_0xb77b('0x4a')](_0x2a7a58['query'],_0x4c03c2['filters']),_0x24d0d8);var _0x4ce077=[];var _0x202bf4=squel[_0xb77b('0x4b')]()['field']('id')[_0xb77b('0x4c')](_0xb77b('0x4d'))[_0xb77b('0x4c')](_0xb77b('0x4e'))[_0xb77b('0x4f')](_0xb77b('0x50'));var _0x54ec9e=squel[_0xb77b('0x4b')]()[_0xb77b('0x4c')](_0xb77b('0x51'))['field']('u.fullname')[_0xb77b('0x4c')](_0xb77b('0x52'))[_0xb77b('0x4f')](_0xb77b('0x53'),'ui')[_0xb77b('0x54')]('users','u',_0xb77b('0x55'));var _0x527c2d=squel['select']()[_0xb77b('0x4f')](_0xb77b('0x56'),'i')[_0xb77b('0x54')](_0xb77b('0x57'),'c',_0xb77b('0x58'))[_0xb77b('0x54')](_0xb77b('0x59'),'o',_0xb77b('0x5a'))['left_join'](_0xb77b('0x5b'),'a','a.id\x20=\x20i.SmsAccountId')[_0xb77b('0x54')](_0xb77b('0x5c'),'me',_0xb77b('0x5d'))['left_join']('sms_interaction_has_tags','it',_0xb77b('0x5e'))[_0xb77b('0x54')](_0xb77b('0x50'),'t',_0xb77b('0x5f'));var _0x5275e2=squel[_0xb77b('0x60')]();var _0x79e285=[];var _0x4eb3cc=squel['expr']();var _0x531f27;if(_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x61')]){_0x531f27=as['parseSearch'](_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x61')]);var _0x2e9469=_0x531f27[_0xb77b('0x62')];for(var _0x4dff5c=0x0;_0x4dff5c<_0x531f27[_0xb77b('0x63')][_0xb77b('0x45')];_0x4dff5c++){var _0x1a779a=_0x531f27[_0xb77b('0x63')][_0x4dff5c];var _0x4e9fd3='i';var _0x3355fb=_['find'](_0x24d0d8,[_0xb77b('0x4d'),_0x1a779a[_0xb77b('0x4c')]]);if(!_0x3355fb){switch(_0x1a779a[_0xb77b('0x4c')]){case _0xb77b('0x64'):if(_0x1a779a[_0xb77b('0x65')]==0x1){_0x527c2d['having']('`'+_0x1a779a[_0xb77b('0x4c')]+_0xb77b('0x66'));}else{_0x527c2d[_0xb77b('0x67')]('`'+_0x1a779a[_0xb77b('0x4c')]+_0xb77b('0x68'));}break;case _0xb77b('0x69'):if(_0x1a779a['operator']===_0xb77b('0x6a')){if(_0x1a779a['value'][_0xb77b('0x35')]('\x20')[_0xb77b('0x45')]>0x1){_0x5275e2[_0x2e9469]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb77b('0x6b')](_0x1a779a['value']),null);}else{var _0x1a6a9a='%'+_0x1a779a['value']+'%';_0x5275e2[_0x2e9469](_0xb77b('0x6c'),_0x1a6a9a,_0x1a6a9a,_0x1a6a9a);}}else{_0x3355fb=_[_0xb77b('0x6d')](_0x24d0d8,[_0xb77b('0x4d'),_0xb77b('0x6e')]);_0x1a779a[_0xb77b('0x4c')]=_0xb77b('0x6e');_0x4cb1a2=as[_0xb77b('0x6f')](_0x4e9fd3,_0x3355fb[_0xb77b('0x3c')],_0x1a779a);_0x5275e2[_0x2e9469](_0x4cb1a2['text'],_0x4cb1a2[_0xb77b('0x65')][_0xb77b('0x70')],_0x4cb1a2[_0xb77b('0x65')]['end']);}break;case _0xb77b('0x71'):var _0x434afa=_0x1a779a[_0xb77b('0x65')][_0xb77b('0x35')](',')[_0xb77b('0x31')](function(_0x456697){return Number(_0x456697);});_0x434afa[_0xb77b('0x36')](function(_0x552685){_0x4eb3cc['or'](_0xb77b('0x72'),'%,'+_0x552685+',%');});_0x79e285=_[_0xb77b('0x73')](_0x79e285,_0x434afa);break;case _0xb77b('0x74'):if(_0x1a779a[_0xb77b('0x75')]==='$substring'){_0x5275e2[_0x2e9469]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1a779a[_0xb77b('0x65')]+'%',null);}else{_0x3355fb=_[_0xb77b('0x6d')](_0x24d0d8,[_0xb77b('0x4d'),_0xb77b('0x76')]);_0x1a779a[_0xb77b('0x4c')]='UserId';_0x4cb1a2=as[_0xb77b('0x6f')](_0x4e9fd3,_0x3355fb[_0xb77b('0x3c')],_0x1a779a);_0x5275e2[_0x2e9469](_0x4cb1a2[_0xb77b('0x77')],_0x4cb1a2[_0xb77b('0x65')][_0xb77b('0x70')],_0x4cb1a2[_0xb77b('0x65')]['end']);}break;case _0xb77b('0x78'):_0x4cb1a2=as['buildExpression']('me',null,_0x1a779a);_0x5275e2[_0x2e9469](_0x4cb1a2[_0xb77b('0x77')],_0x4cb1a2[_0xb77b('0x65')][_0xb77b('0x70')],_0x4cb1a2[_0xb77b('0x65')]['end']);break;}}else{var _0x4cb1a2=as[_0xb77b('0x6f')](_0x4e9fd3,_0x3355fb['type'],_0x1a779a);_0x5275e2[_0x2e9469](_0x4cb1a2[_0xb77b('0x77')],_0x4cb1a2['value'][_0xb77b('0x70')],_0x4cb1a2[_0xb77b('0x65')][_0xb77b('0x1f')]);}}}else{var _0x18bc11=_(_0x2a7a58[_0xb77b('0x3f')])[_0xb77b('0x40')]()['map'](function(_0x159a59){return _[_0xb77b('0x79')](_0x24d0d8,['name',_0x159a59])?_0x159a59:undefined;})[_0xb77b('0x7a')]()['value']();if(!_['isEmpty'](_0x18bc11)){_0x18bc11[_0xb77b('0x36')](function(_0x22535c){if(_0x22535c===_0xb77b('0x7b')){_0x527c2d[_0xb77b('0x49')](_0xb77b('0x7c'),[][_0xb77b('0x7d')](_0x2a7a58[_0xb77b('0x3f')][_0x22535c]));}else if(_0x22535c==='createdAt'){var _0x11d045=JSON[_0xb77b('0x7e')](_0x2a7a58[_0xb77b('0x3f')][_0x22535c])[_0xb77b('0x7f')];var _0x552b8c=JSON['parse'](_0x2a7a58[_0xb77b('0x3f')][_0x22535c])['$lte'];_0x527c2d[_0xb77b('0x49')](_0xb77b('0x80'),_0x11d045,_0x552b8c);}else{if(_0x2a7a58[_0xb77b('0x3f')][_0x22535c]===_0xb77b('0x81')){_0x527c2d[_0xb77b('0x49')]('i.'+_0x22535c+_0xb77b('0x82'));}else{_0x527c2d[_0xb77b('0x49')]('i.'+_0x22535c+_0xb77b('0x83'),_0x2a7a58[_0xb77b('0x3f')][_0x22535c]);}}});}if(_0x2a7a58['query'][_0xb77b('0x84')]){if(_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x84')]==0x1){_0x527c2d['having']('`unreadMessages`\x20=\x200');}else{_0x527c2d['having'](_0xb77b('0x85'));}}if(_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x86')]){_0x79e285=_[_0xb77b('0x87')](_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x86')])?_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x86')]:new Array(_0x2a7a58['query']['tag']);_0x79e285['forEach'](function(_0x1955ff){_0x4eb3cc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1955ff+',%');});}if(_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x88')]){var _0x4be6d8=_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x88')][_0xb77b('0x89')]('\x5c','\x5c\x5c')[_0xb77b('0x89')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4be6d8)){_0x5275e2['or']('i.id\x20LIKE\x20?',_0x4be6d8+'%')['or'](_0xb77b('0x8a'),_0x4be6d8+'%');}else{_0x5275e2['or'](_0xb77b('0x8b'),qs['getFullTextValue'](_0x4be6d8))['or'](_0xb77b('0x8c'),_0x4be6d8+'%');}}}_0x527c2d[_0xb77b('0x49')](_0x5275e2);_0x527c2d[_0xb77b('0x8d')]('i.id');var _0x20a2a1={'type':db[_0xb77b('0x8e')][_0xb77b('0x8f')][_0xb77b('0x90')],'raw':!![]};var _0x1350ad=_0x527c2d['clone']();_0x1350ad[_0xb77b('0x4c')](_0xb77b('0x91'));_0x1350ad['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb77b('0x64'));if(_0x3ef217[_0xb77b('0x47')]){_0x3ef217[_0xb77b('0x47')][_0xb77b('0x36')](function(_0x440e32){var _0x3c6319=_0x440e32[0x0]==='contactName'?_0x440e32[0x0]:'i.'+_0x440e32[0x0];_0x527c2d['order'](_0x3c6319,_0x440e32[0x1]===_0xb77b('0x92')?![]:!![]);});}if(!_[_0xb77b('0x93')](_0x79e285)){_0x527c2d[_0xb77b('0x67')](_0x4eb3cc);_0x1350ad[_0xb77b('0x49')](_0xb77b('0x94'),_0x79e285);}BPromise[_0xb77b('0x95')]()[_0xb77b('0x2b')](function(){if(!_0x531f27){if(_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x7b')])return;_0x1350ad['where'](_0xb77b('0x96'));_0x527c2d[_0xb77b('0x49')](_0xb77b('0x96'));return;}if(_0x2a7a58[_0xb77b('0x97')]['role']!=='agent')return;return _0x2a7a58[_0xb77b('0x97')][_0xb77b('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x14983c){if(_[_0xb77b('0x93')](_0x14983c)){_0x1350ad['where'](_0xb77b('0x99'));_0x527c2d[_0xb77b('0x49')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x1350ad[_0xb77b('0x49')]('i.SmsAccountId\x20IN\x20?',_[_0xb77b('0x31')](_0x14983c,'id'));_0x527c2d[_0xb77b('0x49')](_0xb77b('0x7c'),_[_0xb77b('0x31')](_0x14983c,'id'));}});})[_0xb77b('0x2b')](function(){if(_0x2a7a58[_0xb77b('0x97')][_0xb77b('0x9a')]===_0xb77b('0x9b')&&!_0x531f27&&!_0x2a7a58[_0xb77b('0x3f')][_0xb77b('0x7b')])return[];return db[_0xb77b('0x9c')][_0xb77b('0x3f')](_0x1350ad[_0xb77b('0x9d')](),_0x20a2a1);})[_0xb77b('0x2b')](function(_0x5e8ea3){_0x24072e[_0xb77b('0x24')]=_0x5e8ea3[_0xb77b('0x45')];if(_0x24072e['count']===0x0)return[];return db[_0xb77b('0x9c')][_0xb77b('0x3f')](_0x202bf4['toString'](),_0x20a2a1)[_0xb77b('0x2b')](function(_0xb66b06){_0x4ce077=_[_0xb77b('0x9e')](_0xb66b06,'id');_0x20a2a1=_[_0xb77b('0x9f')](_0x20a2a1,{'model':db[_0xb77b('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a7a58['query'][_0xb77b('0x44')]){_0x3ef217['attributes']['forEach'](function(_0x23fbad){_0x527c2d['field']('i.'+_0x23fbad);});}else{_0x527c2d[_0xb77b('0x4c')](_0xb77b('0xa0'),_0xb77b('0x64'));_0x527c2d[_0xb77b('0x4c')](_0xb77b('0xa1'),'Account.key');_0x527c2d[_0xb77b('0x4c')](_0xb77b('0xa2'),_0xb77b('0xa3'));_0x527c2d[_0xb77b('0x4c')](_0xb77b('0xa4'),_0xb77b('0xa5'));_0x527c2d['field'](_0xb77b('0xa6'));_0x527c2d['field']('c.firstName','Contact.firstName');_0x527c2d[_0xb77b('0x4c')]('c.lastName',_0xb77b('0xa7'));_0x527c2d[_0xb77b('0x4c')](_0xb77b('0xa8'),_0xb77b('0xa9'));_0x527c2d[_0xb77b('0x4c')](_0xb77b('0xaa'),_0xb77b('0xab'));_0x527c2d[_0xb77b('0x4c')](_0xb77b('0xac'),_0xb77b('0xad'));_0x527c2d[_0xb77b('0x4c')](_0xb77b('0xae'),_0xb77b('0xaf'));_0x527c2d['field'](_0xb77b('0xb0'),_0xb77b('0xb1'));_0x527c2d['field'](_0xb77b('0xb2'),_0xb77b('0xb3'));_0x527c2d['field'](_0xb77b('0xb4'),_0xb77b('0x33'));}if(_0x3ef217[_0xb77b('0x23')])_0x527c2d[_0xb77b('0x23')](_0x3ef217[_0xb77b('0x23')]);if(_0x3ef217[_0xb77b('0x21')])_0x527c2d['offset'](_0x3ef217[_0xb77b('0x21')]);return db[_0xb77b('0x9c')][_0xb77b('0x3f')](_0x527c2d['toString'](),_0x20a2a1);})['then'](function(_0x41f247){if(_0x41f247[_0xb77b('0x45')]>0x0)_0x54ec9e['where'](_0xb77b('0xb5'),_[_0xb77b('0x31')](_0x41f247,'id'));return db['sequelize'][_0xb77b('0x3f')](_0x54ec9e[_0xb77b('0x9d')](),_0x20a2a1)[_0xb77b('0x2b')](function(_0x4f7a3f){var _0x30ed4f=_[_0xb77b('0xb6')](_0x4f7a3f,'SmsInteractionId');var _0x5cb9ee=[];_0x41f247['forEach'](function(_0x139efd){_0x5cb9ee[_0xb77b('0x37')](updateSmsInteraction(_0x139efd,_0x4ce077,_0x30ed4f));});return BPromise[_0xb77b('0xb7')](_0x5cb9ee);});});})[_0xb77b('0x2b')](function(_0x1a2088){_0x24072e[_0xb77b('0xb8')]=_0x1a2088;return _0x24072e;})[_0xb77b('0x2b')](respondWithFilteredResult(_0x234b61,_0x3ef217))[_0xb77b('0xb9')](handleError(_0x234b61,null));};exports[_0xb77b('0xba')]=function(_0x3aa5f4,_0xde004c){var _0x3cc4a4={'raw':![],'where':{'id':_0x3aa5f4[_0xb77b('0xbb')]['id']}},_0x59e228={};_0x59e228[_0xb77b('0x3e')]=_[_0xb77b('0x40')](db[_0xb77b('0x39')][_0xb77b('0x3a')]);_0x59e228['query']=_[_0xb77b('0x40')](_0x3aa5f4[_0xb77b('0x3f')]);_0x59e228[_0xb77b('0x41')]=_[_0xb77b('0x42')](_0x59e228[_0xb77b('0x3e')],_0x59e228[_0xb77b('0x3f')]);_0x3cc4a4[_0xb77b('0x43')]=_['intersection'](_0x59e228[_0xb77b('0x3e')],qs[_0xb77b('0x44')](_0x3aa5f4['query']['fields']));_0x3cc4a4['attributes']=_0x3cc4a4[_0xb77b('0x43')]['length']?_0x3cc4a4[_0xb77b('0x43')]:_0x59e228[_0xb77b('0x3e')];if(_0x3aa5f4[_0xb77b('0x3f')][_0xb77b('0xbc')]){_0x3cc4a4[_0xb77b('0xbd')]=[{'all':!![]}];}_0x3cc4a4=_[_0xb77b('0x9f')]({},_0x3cc4a4,_0x3aa5f4['options']);return db[_0xb77b('0x39')][_0xb77b('0x6d')](_0x3cc4a4)[_0xb77b('0x2b')](handleEntityNotFound(_0xde004c,null))['then'](respondWithResult(_0xde004c,null))[_0xb77b('0xb9')](handleError(_0xde004c,null));};exports[_0xb77b('0xbe')]=function(_0x3df6cd,_0x2cf93e){return db[_0xb77b('0x39')][_0xb77b('0xbe')](_0x3df6cd[_0xb77b('0x78')],{})[_0xb77b('0x2b')](respondWithResult(_0x2cf93e,0xc9))[_0xb77b('0xb9')](handleError(_0x2cf93e,null));};exports[_0xb77b('0x2a')]=function(_0x183121,_0x4cb345){if(_0x183121[_0xb77b('0x78')]['id']){delete _0x183121[_0xb77b('0x78')]['id'];}return db[_0xb77b('0x39')]['find']({'where':{'id':_0x183121[_0xb77b('0xbb')]['id']}})[_0xb77b('0x2b')](handleEntityNotFound(_0x4cb345,null))['then'](saveUpdates(_0x183121[_0xb77b('0x78')],null))[_0xb77b('0x2b')](respondWithResult(_0x4cb345,null))[_0xb77b('0xb9')](handleError(_0x4cb345,null));};exports[_0xb77b('0x2c')]=function(_0x1e51aa,_0x440509){return db[_0xb77b('0x39')]['find']({'where':{'id':_0x1e51aa[_0xb77b('0xbb')]['id']}})['then'](handleEntityNotFound(_0x440509,null))[_0xb77b('0x2b')](removeEntity(_0x440509,null))[_0xb77b('0xb9')](handleError(_0x440509,null));};exports[_0xb77b('0xbf')]=function(_0x393923,_0x4bfdb0){return db[_0xb77b('0x39')]['describe']()[_0xb77b('0x2b')](respondWithResult(_0x4bfdb0,null))['catch'](handleError(_0x4bfdb0,null));};exports[_0xb77b('0xc0')]=function(_0x1007e2,_0x21f9c3,_0x3a7109){return db[_0xb77b('0xc1')]['find']({'where':{'id':_0x1007e2['params']['id']}})[_0xb77b('0x2b')](handleEntityNotFound(_0x21f9c3,null))['then'](function(_0x1f1485){if(_0x1f1485){return _0x1f1485[_0xb77b('0xc0')](_0x1007e2[_0xb77b('0x78')][_0xb77b('0xc2')],_[_0xb77b('0xc3')](_0x1007e2[_0xb77b('0x78')],[_0xb77b('0xc2'),'id'])||{});}})[_0xb77b('0x2b')](respondWithResult(_0x21f9c3,null))[_0xb77b('0xb9')](handleError(_0x21f9c3,null));};exports['getMessages']=function(_0x1f1397,_0x51620b,_0x40ad41){var _0x243216={'raw':![],'where':{}};var _0x928d56={};var _0x2cf099={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x1f1397[_0xb77b('0xbb')]['id']}})[_0xb77b('0x2b')](handleEntityNotFound(_0x51620b,null))[_0xb77b('0x2b')](function(_0x455229){if(_0x455229){_0x928d56[_0xb77b('0x3e')]=_[_0xb77b('0x40')](db[_0xb77b('0xc1')][_0xb77b('0x3a')]);_0x928d56['query']=_[_0xb77b('0x40')](_0x1f1397[_0xb77b('0x3f')]);_0x928d56[_0xb77b('0x41')]=_[_0xb77b('0x42')](_0x928d56[_0xb77b('0x3e')],_0x928d56[_0xb77b('0x3f')]);_0x243216['attributes']=_[_0xb77b('0x42')](_0x928d56[_0xb77b('0x3e')],qs[_0xb77b('0x44')](_0x1f1397[_0xb77b('0x3f')][_0xb77b('0x44')]));_0x243216[_0xb77b('0x43')]=_0x243216['attributes'][_0xb77b('0x45')]?_0x243216[_0xb77b('0x43')]:_0x928d56[_0xb77b('0x3e')];if(!_0x1f1397['query'][_0xb77b('0xc4')](_0xb77b('0x46'))){_0x243216['limit']=qs['limit'](_0x1f1397[_0xb77b('0x3f')][_0xb77b('0x23')]);_0x243216['offset']=qs[_0xb77b('0x21')](_0x1f1397[_0xb77b('0x3f')][_0xb77b('0x21')]);}_0x243216[_0xb77b('0x47')]=qs[_0xb77b('0x48')](_0x1f1397[_0xb77b('0x3f')]['sort']);_0x243216['where']=qs['filters'](_[_0xb77b('0x4a')](_0x1f1397[_0xb77b('0x3f')],_0x928d56[_0xb77b('0x41')]));_0x243216['where']['SmsInteractionId']=_0x455229['id'];if(_0x1f1397[_0xb77b('0x3f')][_0xb77b('0x88')]){_0x243216[_0xb77b('0x49')]=_['merge'](_0x243216[_0xb77b('0x49')],{'$or':_[_0xb77b('0x31')](_0x243216[_0xb77b('0x43')],function(_0x39eabf){var _0x4df4bf={};_0x4df4bf[_0x39eabf]={'$like':'%'+_0x1f1397[_0xb77b('0x3f')][_0xb77b('0x88')]+'%'};return _0x4df4bf;})});}if(_0x1f1397[_0xb77b('0x3f')][_0xb77b('0x7f')]){var _0x16fb1a=_0x1f1397[_0xb77b('0x3f')][_0xb77b('0x7f')]['split'](',');var _0x33b3d1={};_0x33b3d1[_0x16fb1a[0x0]]={'$gte':moment(_0x16fb1a[0x1])[_0xb77b('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x243216['where']=_['merge'](_0x243216['where'],_0x33b3d1);}_0x243216=_[_0xb77b('0x9f')]({},_0x243216,_0x1f1397['options']);return db[_0xb77b('0xc1')][_0xb77b('0x24')]({'where':_0x243216[_0xb77b('0x49')]})[_0xb77b('0x2b')](function(_0x4eda70){_0x2cf099[_0xb77b('0x24')]=_0x4eda70;if(_0x1f1397[_0xb77b('0x3f')][_0xb77b('0xbc')]){_0x243216['include']=[{'all':!![]}];}return db[_0xb77b('0xc1')][_0xb77b('0xc6')](_0x243216);})[_0xb77b('0x2b')](function(_0x2bbf97){_0x2cf099[_0xb77b('0xb8')]=_0x2bbf97;return _0x2cf099;});}})['then'](respondWithFilteredResult(_0x51620b,_0x243216))['catch'](handleError(_0x51620b,null));};exports[_0xb77b('0xc7')]=function(_0x43f5bd,_0x584c25,_0x397a05){return db[_0xb77b('0x39')][_0xb77b('0x6d')]({'where':{'id':_0x43f5bd[_0xb77b('0xbb')]['id']}})[_0xb77b('0x2b')](handleEntityNotFound(_0x584c25,null))[_0xb77b('0x2b')](function(_0x5b2e32){if(_0x5b2e32){return _0x5b2e32[_0xb77b('0xc8')](_0x43f5bd[_0xb77b('0x78')][_0xb77b('0xc2')],_['omit'](_0x43f5bd[_0xb77b('0x78')],[_0xb77b('0xc2'),'id'])||{})['spread'](function(){return db[_0xb77b('0x71')][_0xb77b('0xc6')]({'attributes':['id',_0xb77b('0x4d'),'color'],'where':{'id':_0x43f5bd[_0xb77b('0x78')][_0xb77b('0xc2')]}});})['then'](function(_0x154013){socket[_0xb77b('0xc9')](_0xb77b('0xca'),{'id':Number(_0x43f5bd['params']['id']),'tags':_0x154013||[]});return{'id':Number(_0x43f5bd[_0xb77b('0xbb')]['id']),'tags':_0x154013||[]};});}})[_0xb77b('0x2b')](respondWithResult(_0x584c25,null))[_0xb77b('0xb9')](handleError(_0x584c25,null));};exports['removeTags']=function(_0x108b50,_0x21ff50,_0x5f4e7a){return db[_0xb77b('0x39')][_0xb77b('0x6d')]({'where':{'id':_0x108b50[_0xb77b('0xbb')]['id']}})[_0xb77b('0x2b')](handleEntityNotFound(_0x21ff50,null))[_0xb77b('0x2b')](function(_0x3680a0){if(_0x3680a0){return _0x3680a0[_0xb77b('0xcb')](_0x108b50['query'][_0xb77b('0xc2')]);}})[_0xb77b('0x2b')](respondWithStatusCode(_0x21ff50,null))[_0xb77b('0xb9')](handleError(_0x21ff50,null));};exports[_0xb77b('0xcc')]=function(_0x111466,_0x792b00){var _0x20e505=moment()[_0xb77b('0xcd')]()[_0xb77b('0x9d')]();var _0x25ac62=path[_0xb77b('0xce')](config[_0xb77b('0xcf')],_0xb77b('0xd0'),'files','tmp');var _0x5eb7fa=path[_0xb77b('0xce')](config[_0xb77b('0xcf')],'server',_0xb77b('0xd1'),'attachments');var _0x248525=path[_0xb77b('0xce')](_0x25ac62,_0x20e505);var _0x551dcc=util[_0xb77b('0xc5')](_0xb77b('0xd2'),_0x111466[_0xb77b('0xbb')]['id'],_0x20e505);var _0x2b6fff=path['join'](_0x25ac62,_0x551dcc);var _0x55cd8b=[];_0x55cd8b[_0xb77b('0x37')]({'model':db[_0xb77b('0x74')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x55cd8b[_0xb77b('0x37')]({'model':db[_0xb77b('0xd3')],'as':_0xb77b('0x69'),'attributes':['id','firstName',_0xb77b('0xd4')],'raw':!![]});var _0x3b861f=[{'model':db[_0xb77b('0xc1')],'as':_0xb77b('0xd5'),'attributes':['id',_0xb77b('0x78'),_0xb77b('0xd6'),_0xb77b('0xd7'),_0xb77b('0xd8'),_0xb77b('0x84')],'include':_0x55cd8b}];_0x3b861f['push']({'model':db[_0xb77b('0xd9')],'as':_0xb77b('0xda'),'attributes':['id',_0xb77b('0x4d')]});_0x3b861f['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xb77b('0x32')]});return db[_0xb77b('0x39')][_0xb77b('0x6d')]({'where':{'id':_0x111466[_0xb77b('0xbb')]['id']},'include':_0x3b861f})[_0xb77b('0x2b')](handleEntityNotFound(_0x792b00,null))[_0xb77b('0x2b')](function(_0xf318cb){if(_0xf318cb){var _0x5f10af=_0xf318cb[_0xb77b('0xdb')]({'plain':!![]});fs[_0xb77b('0xdc')](_0x248525);var _0x44a02f={'channel':'Sms','account':_0x5f10af[_0xb77b('0xda')][_0xb77b('0x4d')],'agent':_0x5f10af[_0xb77b('0xdd')]?_0x5f10af['Owner'][_0xb77b('0x32')]:'N.A.','createdAt':moment(_0x5f10af[_0xb77b('0xd6')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb77b('0x9d')](),'closedAt':_0x5f10af[_0xb77b('0xde')]?moment(_0x5f10af[_0xb77b('0xdf')])['format'](_0xb77b('0xe0'))[_0xb77b('0x9d')]():'','disposition':_0x5f10af[_0xb77b('0xe1')],'messages':_(_0x5f10af['Messages'])[_0xb77b('0x88')]({'secret':![]})[_0xb77b('0x31')](function(_0x8e3cf2){return{'date':moment(_0x8e3cf2[_0xb77b('0xd6')])[_0xb77b('0xc5')](_0xb77b('0xe0'))[_0xb77b('0x9d')](),'sender':_0x8e3cf2['direction']===_0xb77b('0xe2')?_0x8e3cf2[_0xb77b('0x74')]?_0x8e3cf2[_0xb77b('0x74')][_0xb77b('0x32')]:_0xb77b('0xe3'):_0x8e3cf2[_0xb77b('0x69')]['firstName']+(_0x8e3cf2[_0xb77b('0x69')][_0xb77b('0xd4')]?'\x20'+_0x8e3cf2[_0xb77b('0x69')]['lastName']:''),'body':_0x8e3cf2[_0xb77b('0x78')],'direction':_0x8e3cf2[_0xb77b('0xd7')]===_0xb77b('0xe2')?'A':'C','secret':_0x8e3cf2[_0xb77b('0xd8')],'read':_0x8e3cf2[_0xb77b('0x84')]};})[_0xb77b('0x65')]()};return ejs['renderFile'](path['join'](config[_0xb77b('0xcf')],_0xb77b('0xd0'),_0xb77b('0xe4'),_0xb77b('0xe5')),{'interaction':_0x44a02f})[_0xb77b('0x2b')](function(_0x1e3bf3){var _0x280d39=path[_0xb77b('0xce')](_0x248525,_0xb77b('0xe6')+_0x5f10af['id']+'-'+_0x20e505+_0xb77b('0xe7'));var _0x36a72f={'path':_0x280d39,'channel':_0xb77b('0xe8'),'interactionId':_0x5f10af['id']};return pdf[_0xb77b('0xe9')](_0x1e3bf3,_0x36a72f);})[_0xb77b('0x2b')](function(){return new BPromise(function(_0x367939,_0x5c5d8c){zipdir(_0x248525,{'saveTo':_0x2b6fff},function(_0x5e4a7b,_0x7b6b6d){if(_0x5e4a7b)return _0x5c5d8c(_0x5e4a7b);return _0x367939(_0x7b6b6d);});})['then'](function(){return new BPromise(function(_0x5aabab,_0x4ae913){rimraf(_0x248525,function(_0x14a468){if(_0x14a468)_0x4ae913(_0x14a468);return _0x5aabab();});});})[_0xb77b('0x2b')](function(){return _0x792b00[_0xb77b('0xcc')](_0x2b6fff,_0x551dcc,function(_0x88e516){if(_0x88e516){console[_0xb77b('0xea')](_0xb77b('0xeb'),_0x88e516);}else{fs[_0xb77b('0xec')](_0x2b6fff);}});});});}else{return _0x792b00[_0xb77b('0x2d')](0xc8);}})[_0xb77b('0xb9')](handleError(_0x792b00,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 4e8175f..570583b 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 _0x3d04=['SmsInteraction','SmsMessage','setMaxListeners','save','update','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x43d0('0x0'));var SmsInteraction=require(_0x43d0('0x1'))['db'][_0x43d0('0x2')];var SmsMessage=require(_0x43d0('0x1'))['db'][_0x43d0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x43d0('0x4')](0x0);var events={'afterCreate':_0x43d0('0x5'),'afterUpdate':_0x43d0('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2a4d4c){return function(_0x1a75d4,_0x746f5e,_0x617bf){_0x1a75d4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x50919e){_0x1a75d4['setDataValue'](_0x43d0('0x7'),_0x50919e[_0x43d0('0x8')](function(_0x331421){return{'id':_0x331421['id']};}));return SmsMessage[_0x43d0('0x9')]({'where':{'SmsInteractionId':_0x1a75d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x43d0('0xa')](function(_0x4d75d9){_0x1a75d4['setDataValue'](_0x43d0('0xb'),_0x4d75d9['length']);SmsInteractionEvents['emit'](_0x2a4d4c+':'+_0x1a75d4['id'],_0x1a75d4);SmsInteractionEvents[_0x43d0('0xc')](_0x2a4d4c,_0x1a75d4);_0x617bf(null);})[_0x43d0('0xd')](_0x617bf(null));};}for(var e in events){if(events[_0x43d0('0xe')](e)){var event=events[e];SmsInteraction[_0x43d0('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x430c=['setMaxListeners','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hook','events','../../mysqldb','SmsMessage'];(function(_0x3d38ae,_0x51102b){var _0x3757ee=function(_0x22bac8){while(--_0x22bac8){_0x3d38ae['push'](_0x3d38ae['shift']());}};_0x3757ee(++_0x51102b);}(_0x430c,0x1a1));var _0xc430=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0x430c[_0x523adf];return _0x283870;};'use strict';var EventEmitter=require(_0xc430('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require(_0xc430('0x1'))['db'][_0xc430('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc430('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x47d8b9){return function(_0x338a82,_0x2408f5,_0x50b256){_0x338a82[_0xc430('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x212354){_0x338a82[_0xc430('0x5')](_0xc430('0x6'),_0x212354[_0xc430('0x7')](function(_0x2e23f8){return{'id':_0x2e23f8['id']};}));return SmsMessage[_0xc430('0x8')]({'where':{'SmsInteractionId':_0x338a82['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc430('0x9')](function(_0x115814){_0x338a82[_0xc430('0x5')]('unreadMessages',_0x115814[_0xc430('0xa')]);SmsInteractionEvents[_0xc430('0xb')](_0x47d8b9+':'+_0x338a82['id'],_0x338a82);SmsInteractionEvents['emit'](_0x47d8b9,_0x338a82);_0x50b256(null);})[_0xc430('0xc')](_0x50b256(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc430('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c68dd74..cdc8b71 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 _0x5baa=['../../config/environment','exports','define','sms_interactions','changed','closedAt','format','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x520b03,_0xb55ea2){var _0x51c64e=function(_0x293ef5){while(--_0x293ef5){_0x520b03['push'](_0x520b03['shift']());}};_0x51c64e(++_0xb55ea2);}(_0x5baa,0x18f));var _0xa5ba=function(_0x35261b,_0x2c0478){_0x35261b=_0x35261b-0x0;var _0x5725d1=_0x5baa[_0x35261b];return _0x5725d1;};'use strict';var _=require(_0xa5ba('0x0'));var util=require(_0xa5ba('0x1'));var logger=require(_0xa5ba('0x2'))('api');var moment=require(_0xa5ba('0x3'));var BPromise=require(_0xa5ba('0x4'));var rp=require(_0xa5ba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5ba('0x6'));var config=require(_0xa5ba('0x7'));var attributes=require('./smsInteraction.attributes');module[_0xa5ba('0x8')]=function(_0xb9faca,_0x3a4be0){return _0xb9faca[_0xa5ba('0x9')]('SmsInteraction',attributes,{'tableName':_0xa5ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x197dfb,_0x3cf79f,_0x3db159){if(_0x197dfb[_0xa5ba('0xb')]('closed')){_0x197dfb[_0xa5ba('0xc')]=moment()[_0xa5ba('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3db159(null,_0x197dfb);}}});}; \ No newline at end of file +var _0x61a3=['request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x61a3,0x10b));var _0x361a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61a3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x361a('0x0'));var util=require(_0x361a('0x1'));var logger=require(_0x361a('0x2'))(_0x361a('0x3'));var moment=require(_0x361a('0x4'));var BPromise=require('bluebird');var rp=require(_0x361a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x361a('0x6'));var config=require(_0x361a('0x7'));var attributes=require(_0x361a('0x8'));module[_0x361a('0x9')]=function(_0x4a2056,_0x11eb50){return _0x4a2056[_0x361a('0xa')](_0x361a('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13e622,_0x2ddacf,_0x419cd0){if(_0x13e622[_0x361a('0xc')](_0x361a('0xd'))){_0x13e622['closedAt']=moment()[_0x361a('0xe')](_0x361a('0xf'));}_0x419cd0(null,_0x13e622);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b10e532..45c2203 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 _0x8bdb=['result','catch','SmsInteraction','update','body','options','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3b60d9,_0x18cfbd){var _0x2405eb=function(_0x362c7a){while(--_0x362c7a){_0x3b60d9['push'](_0x3b60d9['shift']());}};_0x2405eb(++_0x18cfbd);}(_0x8bdb,0x1c8));var _0xb8bd=function(_0x34e284,_0x5338cb){_0x34e284=_0x34e284-0x0;var _0x302cc6=_0x8bdb[_0x34e284];return _0x302cc6;};'use strict';var _=require('lodash');var util=require(_0xb8bd('0x0'));var moment=require(_0xb8bd('0x1'));var BPromise=require(_0xb8bd('0x2'));var rs=require(_0xb8bd('0x3'));var fs=require('fs');var Redis=require(_0xb8bd('0x4'));var db=require(_0xb8bd('0x5'))['db'];var utils=require(_0xb8bd('0x6'));var logger=require('../../config/logger')(_0xb8bd('0x7'));var config=require(_0xb8bd('0x8'));var jayson=require(_0xb8bd('0x9'));var client=jayson[_0xb8bd('0xa')][_0xb8bd('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb8bd('0xc')],{'host':_0xb8bd('0xd'),'port':0x18eb});var socket=require(_0xb8bd('0xe'))(new Redis(config[_0xb8bd('0xc')]));require(_0xb8bd('0xf'))[_0xb8bd('0x10')](socket);function respondWithRpcPromise(_0x1a9320,_0x3ec95c,_0x4707d1){return new BPromise(function(_0x4fc30f,_0xab225b){return client[_0xb8bd('0x11')](_0x1a9320,_0x4707d1)[_0xb8bd('0x12')](function(_0x2d69f9){logger[_0xb8bd('0x13')](_0xb8bd('0x14'),_0x3ec95c,'request\x20sent');logger[_0xb8bd('0x15')](_0xb8bd('0x16'),_0x3ec95c,_0xb8bd('0x17'),JSON[_0xb8bd('0x18')](_0x2d69f9));if(_0x2d69f9['error']){if(_0x2d69f9[_0xb8bd('0x19')][_0xb8bd('0x1a')]===0x1f4){logger['error'](_0xb8bd('0x14'),_0x3ec95c,_0x2d69f9[_0xb8bd('0x19')][_0xb8bd('0x1b')]);return _0xab225b(_0x2d69f9[_0xb8bd('0x19')][_0xb8bd('0x1b')]);}logger[_0xb8bd('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x3ec95c,_0x2d69f9[_0xb8bd('0x19')][_0xb8bd('0x1b')]);return _0x4fc30f(_0x2d69f9['error'][_0xb8bd('0x1b')]);}else{logger[_0xb8bd('0x13')](_0xb8bd('0x14'),_0x3ec95c,_0xb8bd('0x17'));_0x4fc30f(_0x2d69f9[_0xb8bd('0x1c')][_0xb8bd('0x1b')]);}})[_0xb8bd('0x1d')](function(_0x3df3fa){logger[_0xb8bd('0x19')](_0xb8bd('0x14'),_0x3ec95c,_0x3df3fa);_0xab225b(_0x3df3fa);});});}exports['UpdateSmsInteraction']=function(_0x124f39){var _0x38b4f6=this;return new Promise(function(_0x29882b,_0x58c7b7){return db[_0xb8bd('0x1e')][_0xb8bd('0x1f')](_0x124f39[_0xb8bd('0x20')],{'raw':_0x124f39[_0xb8bd('0x21')]?_0x124f39[_0xb8bd('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x124f39[_0xb8bd('0x21')]?_0x124f39[_0xb8bd('0x21')][_0xb8bd('0x22')]||null:null,'attributes':_0x124f39['options']?_0x124f39[_0xb8bd('0x21')]['attributes']||null:null,'limit':_0x124f39[_0xb8bd('0x21')]?_0x124f39[_0xb8bd('0x21')][_0xb8bd('0x23')]||null:null})[_0xb8bd('0x12')](function(_0x3d65ee){logger[_0xb8bd('0x13')]('UpdateSmsInteraction',_0x124f39);logger[_0xb8bd('0x15')]('UpdateSmsInteraction',_0x124f39,JSON['stringify'](_0x3d65ee));_0x29882b(_0x3d65ee);})[_0xb8bd('0x1d')](function(_0x4313c4){logger[_0xb8bd('0x19')](_0xb8bd('0x24'),_0x4313c4[_0xb8bd('0x1b')],_0x124f39);_0x58c7b7(_0x38b4f6['error'](0x1f4,_0x4313c4['message']));});});};exports[_0xb8bd('0x25')]=function(_0x52d30d){return new Promise(function(_0x400d52,_0x1c4dbf){return db[_0xb8bd('0x1e')][_0xb8bd('0x26')]({'where':_0x52d30d[_0xb8bd('0x21')]?_0x52d30d[_0xb8bd('0x21')][_0xb8bd('0x22')]||null:null})['then'](function(_0x39de5b){if(_0x39de5b){return _0x39de5b[_0xb8bd('0x27')](_0x52d30d['body'][_0xb8bd('0x28')],_[_0xb8bd('0x29')](_0x52d30d[_0xb8bd('0x20')],[_0xb8bd('0x28'),'id'])||{});}})[_0xb8bd('0x2a')](function(_0x3a3b10){logger[_0xb8bd('0x13')](_0xb8bd('0x2b'),_0x52d30d);logger['debug'](_0xb8bd('0x2b'),_0x52d30d,JSON[_0xb8bd('0x18')](_0x3a3b10));_0x400d52(_0x3a3b10);})[_0xb8bd('0x1d')](function(_0x626476){logger[_0xb8bd('0x19')](_0xb8bd('0x2b'),_0x626476[_0xb8bd('0x1b')],_0x52d30d);_0x1c4dbf(_this['error'](0x1f4,_0x626476[_0xb8bd('0x1b')]));});});}; \ No newline at end of file +var _0x6868=['../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','options','where','limit','catch','AddTagsToSmsInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x194353,_0x3f234a){var _0x272282=function(_0x2424bb){while(--_0x2424bb){_0x194353['push'](_0x194353['shift']());}};_0x272282(++_0x3f234a);}(_0x6868,0x148));var _0x8686=function(_0x28e89b,_0x16742d){_0x28e89b=_0x28e89b-0x0;var _0xa40968=_0x6868[_0x28e89b];return _0xa40968;};'use strict';var _=require(_0x8686('0x0'));var util=require(_0x8686('0x1'));var moment=require(_0x8686('0x2'));var BPromise=require(_0x8686('0x3'));var rs=require(_0x8686('0x4'));var fs=require('fs');var Redis=require(_0x8686('0x5'));var db=require(_0x8686('0x6'))['db'];var utils=require(_0x8686('0x7'));var logger=require(_0x8686('0x8'))(_0x8686('0x9'));var config=require(_0x8686('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8686('0xb')]({'port':0x232a});config['redis']=_[_0x8686('0xc')](config[_0x8686('0xd')],{'host':_0x8686('0xe'),'port':0x18eb});var socket=require(_0x8686('0xf'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x8686('0x10')](socket);function respondWithRpcPromise(_0x18e653,_0x27dbc6,_0x30e39c){return new BPromise(function(_0x58f439,_0xe4445d){return client[_0x8686('0x11')](_0x18e653,_0x30e39c)[_0x8686('0x12')](function(_0x83b225){logger[_0x8686('0x13')](_0x8686('0x14'),_0x27dbc6,_0x8686('0x15'));logger[_0x8686('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x27dbc6,'request\x20sent',JSON[_0x8686('0x17')](_0x83b225));if(_0x83b225[_0x8686('0x18')]){if(_0x83b225['error'][_0x8686('0x19')]===0x1f4){logger[_0x8686('0x18')](_0x8686('0x14'),_0x27dbc6,_0x83b225['error'][_0x8686('0x1a')]);return _0xe4445d(_0x83b225[_0x8686('0x18')]['message']);}logger['error'](_0x8686('0x14'),_0x27dbc6,_0x83b225[_0x8686('0x18')][_0x8686('0x1a')]);return _0x58f439(_0x83b225[_0x8686('0x18')]['message']);}else{logger[_0x8686('0x13')](_0x8686('0x14'),_0x27dbc6,_0x8686('0x15'));_0x58f439(_0x83b225[_0x8686('0x1b')][_0x8686('0x1a')]);}})['catch'](function(_0x4f1ca9){logger[_0x8686('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x27dbc6,_0x4f1ca9);_0xe4445d(_0x4f1ca9);});});}exports[_0x8686('0x1c')]=function(_0x497791){var _0x46b0b8=this;return new Promise(function(_0xff7993,_0x152b97){return db[_0x8686('0x1d')][_0x8686('0x1e')](_0x497791['body'],{'raw':_0x497791['options']?_0x497791[_0x8686('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x497791[_0x8686('0x1f')]?_0x497791[_0x8686('0x1f')][_0x8686('0x20')]||null:null,'attributes':_0x497791['options']?_0x497791[_0x8686('0x1f')]['attributes']||null:null,'limit':_0x497791['options']?_0x497791[_0x8686('0x1f')][_0x8686('0x21')]||null:null})[_0x8686('0x12')](function(_0x485653){logger[_0x8686('0x13')](_0x8686('0x1c'),_0x497791);logger['debug'](_0x8686('0x1c'),_0x497791,JSON['stringify'](_0x485653));_0xff7993(_0x485653);})[_0x8686('0x22')](function(_0x4f87e2){logger[_0x8686('0x18')](_0x8686('0x1c'),_0x4f87e2['message'],_0x497791);_0x152b97(_0x46b0b8[_0x8686('0x18')](0x1f4,_0x4f87e2[_0x8686('0x1a')]));});});};exports[_0x8686('0x23')]=function(_0x2db6b0){return new Promise(function(_0x11ec09,_0x1fde65){return db['SmsInteraction']['find']({'where':_0x2db6b0[_0x8686('0x1f')]?_0x2db6b0[_0x8686('0x1f')][_0x8686('0x20')]||null:null})['then'](function(_0x35b870){if(_0x35b870){return _0x35b870[_0x8686('0x24')](_0x2db6b0[_0x8686('0x25')][_0x8686('0x26')],_[_0x8686('0x27')](_0x2db6b0[_0x8686('0x25')],['ids','id'])||{});}})[_0x8686('0x28')](function(_0xb73cc1){logger[_0x8686('0x13')](_0x8686('0x29'),_0x2db6b0);logger[_0x8686('0x16')]('AddTags',_0x2db6b0,JSON[_0x8686('0x17')](_0xb73cc1));_0x11ec09(_0xb73cc1);})['catch'](function(_0x150e8f){logger['error']('AddTags',_0x150e8f[_0x8686('0x1a')],_0x2db6b0);_0x1fde65(_this[_0x8686('0x18')](0x1f4,_0x150e8f[_0x8686('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 37308ff..1b431fd 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 _0xa26d=['register','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener'];(function(_0x3a6ffe,_0x13a543){var _0x57ef69=function(_0x544fcc){while(--_0x544fcc){_0x3a6ffe['push'](_0x3a6ffe['shift']());}};_0x57ef69(++_0x13a543);}(_0xa26d,0x198));var _0xda26=function(_0x541607,_0x6a02fa){_0x541607=_0x541607-0x0;var _0x5dfe8f=_0xa26d[_0x541607];return _0x5dfe8f;};'use strict';var SmsInteractionEvents=require(_0xda26('0x0'));var events=[_0xda26('0x1'),_0xda26('0x2'),_0xda26('0x3')];function createListener(_0x47aff1,_0x1c0abe){return function(_0x1f758a){_0x1c0abe[_0xda26('0x4')](_0x47aff1,_0x1f758a);};}function removeListener(_0xa5b877,_0xac8024){return function(){SmsInteractionEvents[_0xda26('0x5')](_0xa5b877,_0xac8024);};}exports[_0xda26('0x6')]=function(_0x1d335b){for(var _0x5e96f8=0x0,_0xc65f95=events[_0xda26('0x7')];_0x5e96f8<_0xc65f95;_0x5e96f8++){var _0x184862=events[_0x5e96f8];var _0x582375=createListener(_0xda26('0x8')+_0x184862,_0x1d335b);SmsInteractionEvents['on'](_0x184862,_0x582375);}}; \ No newline at end of file +var _0x5eb9=['update','register','length','save','remove'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x5eb9,0x8f));var _0x95eb=function(_0x2ba054,_0x4cfa79){_0x2ba054=_0x2ba054-0x0;var _0x5d2153=_0x5eb9[_0x2ba054];return _0x5d2153;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x95eb('0x0'),_0x95eb('0x1'),_0x95eb('0x2')];function createListener(_0x537263,_0xc72d90){return function(_0x5bd20f){_0xc72d90['emit'](_0x537263,_0x5bd20f);};}function removeListener(_0x361f75,_0x4b4e0f){return function(){SmsInteractionEvents['removeListener'](_0x361f75,_0x4b4e0f);};}exports[_0x95eb('0x3')]=function(_0x2aeb90){for(var _0x20b779=0x0,_0x29ae4f=events[_0x95eb('0x4')];_0x20b779<_0x29ae4f;_0x20b779++){var _0x1f19f6=events[_0x20b779];var _0x4e04b4=createListener('smsInteraction:'+_0x1f19f6,_0x2aeb90);SmsInteractionEvents['on'](_0x1f19f6,_0x4e04b4);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 00649da..3a3b02e 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 _0xecfc=['isAuthenticated','index','/describe','describe','show','post','tracked','sms','create','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0x5d963e,_0x5edbfe){var _0x523c8e=function(_0x58d7ae){while(--_0x58d7ae){_0x5d963e['push'](_0x5d963e['shift']());}};_0x523c8e(++_0x5edbfe);}(_0xecfc,0x14a));var _0xcecf=function(_0x4a83cc,_0x205029){_0x4a83cc=_0x4a83cc-0x0;var _0x39644a=_0xecfc[_0x4a83cc];return _0x39644a;};'use strict';var multer=require('multer');var util=require(_0xcecf('0x0'));var path=require(_0xcecf('0x1'));var timeout=require(_0xcecf('0x2'));var express=require(_0xcecf('0x3'));var router=express[_0xcecf('0x4')]();var fs_extra=require(_0xcecf('0x5'));var auth=require(_0xcecf('0x6'));var interaction=require(_0xcecf('0x7'));var config=require(_0xcecf('0x8'));var controller=require(_0xcecf('0x9'));router[_0xcecf('0xa')]('/',auth[_0xcecf('0xb')](),controller[_0xcecf('0xc')]);router['get'](_0xcecf('0xd'),auth[_0xcecf('0xb')](),controller[_0xcecf('0xe')]);router[_0xcecf('0xa')]('/:id',auth[_0xcecf('0xb')](),controller[_0xcecf('0xf')]);router[_0xcecf('0x10')]('/',auth[_0xcecf('0xb')](),interaction[_0xcecf('0x11')](_0xcecf('0x12'),'smsmessage:create'),controller[_0xcecf('0x13')]);router[_0xcecf('0x10')]('/:id/status',controller[_0xcecf('0x14')]);router[_0xcecf('0x15')](_0xcecf('0x16'),auth[_0xcecf('0xb')](),controller[_0xcecf('0x17')]);router[_0xcecf('0x15')](_0xcecf('0x18'),auth[_0xcecf('0xb')](),controller[_0xcecf('0x19')]);router['put'](_0xcecf('0x1a'),auth[_0xcecf('0xb')](),controller[_0xcecf('0x1b')]);router[_0xcecf('0x1c')](_0xcecf('0x16'),auth[_0xcecf('0xb')](),controller[_0xcecf('0x1d')]);module[_0xcecf('0x1e')]=router; \ No newline at end of file +var _0xa25d=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','reject','delete','destroy'];(function(_0x3f2bac,_0x39c2a2){var _0x57db6a=function(_0x2ada9e){while(--_0x2ada9e){_0x3f2bac['push'](_0x3f2bac['shift']());}};_0x57db6a(++_0x39c2a2);}(_0xa25d,0x194));var _0xda25=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0xa25d[_0x34c4e1];return _0x5a11ef;};'use strict';var multer=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var path=require(_0xda25('0x2'));var timeout=require(_0xda25('0x3'));var express=require(_0xda25('0x4'));var router=express[_0xda25('0x5')]();var fs_extra=require(_0xda25('0x6'));var auth=require(_0xda25('0x7'));var interaction=require(_0xda25('0x8'));var config=require(_0xda25('0x9'));var controller=require(_0xda25('0xa'));router[_0xda25('0xb')]('/',auth[_0xda25('0xc')](),controller[_0xda25('0xd')]);router[_0xda25('0xb')](_0xda25('0xe'),auth[_0xda25('0xc')](),controller[_0xda25('0xf')]);router[_0xda25('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xda25('0x10')]('/',auth['isAuthenticated'](),interaction[_0xda25('0x11')](_0xda25('0x12'),_0xda25('0x13')),controller[_0xda25('0x14')]);router[_0xda25('0x10')](_0xda25('0x15'),controller[_0xda25('0x16')]);router[_0xda25('0x17')](_0xda25('0x18'),auth[_0xda25('0xc')](),controller['update']);router[_0xda25('0x17')](_0xda25('0x19'),auth[_0xda25('0xc')](),controller[_0xda25('0x1a')]);router[_0xda25('0x17')]('/:id/reject',auth[_0xda25('0xc')](),controller[_0xda25('0x1b')]);router[_0xda25('0x1c')](_0xda25('0x18'),auth['isAuthenticated'](),controller[_0xda25('0x1d')]);module[_0xda25('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 3d5bcfc..5d8d7c8 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 _0x5523=['out','STRING','DATE','BOOLEAN','TEXT','medium','ENUM'];(function(_0x1a8447,_0x36530a){var _0x395a51=function(_0x4c2d74){while(--_0x4c2d74){_0x1a8447['push'](_0x1a8447['shift']());}};_0x395a51(++_0x36530a);}(_0x5523,0x15b));var _0x3552=function(_0x137482,_0x13d5db){_0x137482=_0x137482-0x0;var _0x12c8bd=_0x5523[_0x137482];return _0x12c8bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3552('0x0')](_0x3552('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3552('0x2')]('in',_0x3552('0x3')),'defaultValue':_0x3552('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3552('0x4')]},'readAt':{'type':Sequelize[_0x3552('0x5')]},'secret':{'type':Sequelize[_0x3552('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3552('0x0')]}}; \ No newline at end of file +var _0x1ff9=['TEXT','BOOLEAN','out','DATE','STRING','sequelize','exports'];(function(_0xe49945,_0x3ee2b5){var _0x131227=function(_0x13078d){while(--_0x13078d){_0xe49945['push'](_0xe49945['shift']());}};_0x131227(++_0x3ee2b5);}(_0x1ff9,0x15c));var _0x91ff=function(_0x4e9e17,_0x213114){_0x4e9e17=_0x4e9e17-0x0;var _0x113231=_0x1ff9[_0x4e9e17];return _0x113231;};'use strict';var Sequelize=require(_0x91ff('0x0'));module[_0x91ff('0x1')]={'body':{'type':Sequelize[_0x91ff('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x91ff('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x91ff('0x4')),'defaultValue':_0x91ff('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x91ff('0x5')]},'secret':{'type':Sequelize[_0x91ff('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x91ff('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index fe3adaf..119bb45 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 _0x9f36=['reject','save','update','destroy','name','index','map','SmsMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','include','find','create','body','describe','sms-interactions','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','delivered','Status','plivio','infobip','DELIVERED','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','request','then','debug','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply'];(function(_0x7e0d18,_0xf09a8f){var _0xea4507=function(_0x14218d){while(--_0x14218d){_0x7e0d18['push'](_0x7e0d18['shift']());}};_0xea4507(++_0xf09a8f);}(_0x9f36,0x17c));var _0x69f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9f36[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69f3('0x0'));var zipdir=require(_0x69f3('0x1'));var jsonpatch=require(_0x69f3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x69f3('0x3'));var Mustache=require(_0x69f3('0x4'));var util=require(_0x69f3('0x5'));var path=require(_0x69f3('0x6'));var sox=require('sox');var csv=require(_0x69f3('0x7'));var ejs=require(_0x69f3('0x8'));var fs=require('fs');var fs_extra=require(_0x69f3('0x9'));var _=require(_0x69f3('0xa'));var squel=require(_0x69f3('0xb'));var crypto=require(_0x69f3('0xc'));var jsforce=require(_0x69f3('0xd'));var deskjs=require(_0x69f3('0xe'));var toCsv=require(_0x69f3('0x7'));var querystring=require(_0x69f3('0xf'));var Papa=require('papaparse');var Redis=require(_0x69f3('0x10'));var authService=require(_0x69f3('0x11'));var qs=require(_0x69f3('0x12'));var as=require(_0x69f3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x69f3('0x14'))('api');var utils=require(_0x69f3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x69f3('0x16'));var db=require(_0x69f3('0x17'))['db'];config[_0x69f3('0x18')]=_[_0x69f3('0x19')](config[_0x69f3('0x18')],{'host':_0x69f3('0x1a'),'port':0x18eb});var socket=require(_0x69f3('0x1b'))(new Redis(config[_0x69f3('0x18')]));require('./smsMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x69f3('0x1c')][_0x69f3('0x1d')]({'port':0x232c});var client9002=jayson[_0x69f3('0x1c')][_0x69f3('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x532a9e,_0x49793f,_0x1bc45f,_0x4c8438){return new BPromise(function(_0x2ebed2,_0x520846){var _0x103203=_0x4c8438||client;return _0x103203[_0x69f3('0x1e')](_0x532a9e,_0x1bc45f)[_0x69f3('0x1f')](function(_0xf6a758){logger['info']('SmsMessage,\x20%s,\x20%s',_0x49793f,'request\x20sent');logger[_0x69f3('0x20')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x49793f,_0x69f3('0x21'),JSON[_0x69f3('0x22')](_0xf6a758));if(_0xf6a758[_0x69f3('0x23')]){if(_0xf6a758[_0x69f3('0x23')][_0x69f3('0x24')]===0x1f4){logger[_0x69f3('0x23')](_0x69f3('0x25'),_0x49793f,_0xf6a758[_0x69f3('0x23')]['message']);return _0x520846(_0xf6a758['error'][_0x69f3('0x26')]);}logger[_0x69f3('0x23')]('SmsMessage,\x20%s,\x20%s',_0x49793f,_0xf6a758[_0x69f3('0x23')][_0x69f3('0x26')]);return _0x2ebed2(_0xf6a758[_0x69f3('0x23')]['message']);}else{logger[_0x69f3('0x27')](_0x69f3('0x25'),_0x49793f,'request\x20sent');_0x2ebed2(_0xf6a758[_0x69f3('0x28')][_0x69f3('0x26')]);}})[_0x69f3('0x29')](function(_0x2f1cb7){logger[_0x69f3('0x23')]('SmsMessage,\x20%s,\x20%s',_0x49793f,_0x2f1cb7);_0x520846(_0x2f1cb7);});});}function respondWithStatusCode(_0x19dfe1,_0x21bc15){_0x21bc15=_0x21bc15||0xcc;return function(_0x2682ad){if(_0x2682ad){return _0x19dfe1[_0x69f3('0x2a')](_0x21bc15);}return _0x19dfe1[_0x69f3('0x2b')](_0x21bc15)[_0x69f3('0x2c')]();};}function respondWithResult(_0x12fa99,_0xe8ae8b){_0xe8ae8b=_0xe8ae8b||0xc8;return function(_0x5c9397){if(_0x5c9397){return _0x12fa99[_0x69f3('0x2b')](_0xe8ae8b)[_0x69f3('0x2d')](_0x5c9397);}};}function respondWithFilteredResult(_0x1fcf27,_0x56a7d0){return function(_0x36144e){if(_0x36144e){var _0x545d76=typeof _0x56a7d0[_0x69f3('0x2e')]===_0x69f3('0x2f')&&typeof _0x56a7d0['limit']===_0x69f3('0x2f');var _0x4c3269=_0x36144e[_0x69f3('0x30')];var _0x9315b2=_0x545d76?0x0:_0x56a7d0[_0x69f3('0x2e')];var _0x1ffa44=_0x545d76?_0x36144e[_0x69f3('0x30')]:_0x56a7d0[_0x69f3('0x2e')]+_0x56a7d0[_0x69f3('0x31')];var _0x52cbaa;if(_0x1ffa44>=_0x4c3269){_0x1ffa44=_0x4c3269;_0x52cbaa=0xc8;}else{_0x52cbaa=0xce;}_0x1fcf27[_0x69f3('0x2b')](_0x52cbaa);return _0x1fcf27['set'](_0x69f3('0x32'),_0x9315b2+'-'+_0x1ffa44+'/'+_0x4c3269)['json'](_0x36144e);}return null;};}function patchUpdates(_0x1900fc){return function(_0x1ec2af){try{jsonpatch[_0x69f3('0x33')](_0x1ec2af,_0x1900fc,!![]);}catch(_0x172f06){return BPromise[_0x69f3('0x34')](_0x172f06);}return _0x1ec2af[_0x69f3('0x35')]();};}function saveUpdates(_0x374f02,_0x45efb2){return function(_0x11e509){if(_0x11e509){return _0x11e509[_0x69f3('0x36')](_0x374f02)[_0x69f3('0x1f')](function(_0x3cee7f){return _0x3cee7f;});}return null;};}function removeEntity(_0x4b8ea1,_0xa0c623){return function(_0xe6fb60){if(_0xe6fb60){return _0xe6fb60[_0x69f3('0x37')]()[_0x69f3('0x1f')](function(){_0x4b8ea1[_0x69f3('0x2b')](0xcc)[_0x69f3('0x2c')]();});}};}function handleEntityNotFound(_0x27e771,_0x27a118){return function(_0x526a71){if(!_0x526a71){_0x27e771[_0x69f3('0x2a')](0x194);}return _0x526a71;};}function handleError(_0x2df662,_0x3d9b7b){_0x3d9b7b=_0x3d9b7b||0x1f4;return function(_0x156f74){logger[_0x69f3('0x23')](_0x156f74['stack']);if(_0x156f74[_0x69f3('0x38')]){delete _0x156f74[_0x69f3('0x38')];}_0x2df662[_0x69f3('0x2b')](_0x3d9b7b)['send'](_0x156f74);};}exports[_0x69f3('0x39')]=function(_0x3121e4,_0x5e5b42){var _0x3d8f36={},_0x214ad3={},_0xc61859={'count':0x0,'rows':[]};var _0x4c5329=_[_0x69f3('0x3a')](db[_0x69f3('0x3b')][_0x69f3('0x3c')],function(_0x16b567){return{'name':_0x16b567[_0x69f3('0x3d')],'type':_0x16b567[_0x69f3('0x3e')]['key']};});_0x214ad3[_0x69f3('0x3f')]=_['map'](_0x4c5329,_0x69f3('0x38'));_0x214ad3[_0x69f3('0x40')]=_['keys'](_0x3121e4[_0x69f3('0x40')]);_0x214ad3[_0x69f3('0x41')]=_[_0x69f3('0x42')](_0x214ad3[_0x69f3('0x3f')],_0x214ad3[_0x69f3('0x40')]);_0x3d8f36[_0x69f3('0x43')]=_[_0x69f3('0x42')](_0x214ad3[_0x69f3('0x3f')],qs[_0x69f3('0x44')](_0x3121e4[_0x69f3('0x40')][_0x69f3('0x44')]));_0x3d8f36[_0x69f3('0x43')]=_0x3d8f36[_0x69f3('0x43')][_0x69f3('0x45')]?_0x3d8f36[_0x69f3('0x43')]:_0x214ad3['model'];if(!_0x3121e4[_0x69f3('0x40')][_0x69f3('0x46')]('nolimit')){_0x3d8f36[_0x69f3('0x31')]=qs['limit'](_0x3121e4[_0x69f3('0x40')][_0x69f3('0x31')]);_0x3d8f36[_0x69f3('0x2e')]=qs[_0x69f3('0x2e')](_0x3121e4[_0x69f3('0x40')][_0x69f3('0x2e')]);}_0x3d8f36[_0x69f3('0x47')]=qs['sort'](_0x3121e4['query']['sort']);_0x3d8f36[_0x69f3('0x48')]=qs[_0x69f3('0x41')](_['pick'](_0x3121e4[_0x69f3('0x40')],_0x214ad3[_0x69f3('0x41')]),_0x4c5329);if(_0x3121e4['query'][_0x69f3('0x49')]){_0x3d8f36[_0x69f3('0x48')]=_[_0x69f3('0x4a')](_0x3d8f36[_0x69f3('0x48')],{'$or':_['map'](_0x4c5329,function(_0x4a97a2){if(_0x4a97a2[_0x69f3('0x3e')]!==_0x69f3('0x4b')){var _0x57bf4c={};_0x57bf4c[_0x4a97a2[_0x69f3('0x38')]]={'$like':'%'+_0x3121e4[_0x69f3('0x40')][_0x69f3('0x49')]+'%'};return _0x57bf4c;}})});}_0x3d8f36=_['merge']({},_0x3d8f36,_0x3121e4[_0x69f3('0x4c')]);var _0x2b4d33={'where':_0x3d8f36[_0x69f3('0x48')]};return db[_0x69f3('0x3b')][_0x69f3('0x30')](_0x2b4d33)[_0x69f3('0x1f')](function(_0x51914b){_0xc61859[_0x69f3('0x30')]=_0x51914b;if(_0x3121e4[_0x69f3('0x40')]['includeAll']){_0x3d8f36['include']=[{'all':!![]}];}return db[_0x69f3('0x3b')][_0x69f3('0x4d')](_0x3d8f36);})[_0x69f3('0x1f')](function(_0x55dadc){_0xc61859[_0x69f3('0x4e')]=_0x55dadc;return _0xc61859;})[_0x69f3('0x1f')](respondWithFilteredResult(_0x5e5b42,_0x3d8f36))['catch'](handleError(_0x5e5b42,null));};exports[_0x69f3('0x4f')]=function(_0x2f6e3d,_0x14b6a9){var _0x3a61ba={'raw':!![],'where':{'id':_0x2f6e3d[_0x69f3('0x50')]['id']}},_0x3dbfb6={};_0x3dbfb6[_0x69f3('0x3f')]=_[_0x69f3('0x51')](db['SmsMessage'][_0x69f3('0x3c')]);_0x3dbfb6['query']=_[_0x69f3('0x51')](_0x2f6e3d[_0x69f3('0x40')]);_0x3dbfb6[_0x69f3('0x41')]=_['intersection'](_0x3dbfb6[_0x69f3('0x3f')],_0x3dbfb6[_0x69f3('0x40')]);_0x3a61ba[_0x69f3('0x43')]=_['intersection'](_0x3dbfb6[_0x69f3('0x3f')],qs[_0x69f3('0x44')](_0x2f6e3d[_0x69f3('0x40')]['fields']));_0x3a61ba['attributes']=_0x3a61ba[_0x69f3('0x43')][_0x69f3('0x45')]?_0x3a61ba['attributes']:_0x3dbfb6['model'];if(_0x2f6e3d['query'][_0x69f3('0x52')]){_0x3a61ba[_0x69f3('0x53')]=[{'all':!![]}];}_0x3a61ba=_[_0x69f3('0x4a')]({},_0x3a61ba,_0x2f6e3d[_0x69f3('0x4c')]);return db[_0x69f3('0x3b')][_0x69f3('0x54')](_0x3a61ba)[_0x69f3('0x1f')](handleEntityNotFound(_0x14b6a9,null))[_0x69f3('0x1f')](respondWithResult(_0x14b6a9,null))[_0x69f3('0x29')](handleError(_0x14b6a9,null));};exports['create']=function(_0x5a3ce9,_0x318b7e){return db[_0x69f3('0x3b')][_0x69f3('0x55')](_0x5a3ce9[_0x69f3('0x56')],{})[_0x69f3('0x1f')](respondWithResult(_0x318b7e,0xc9))['catch'](handleError(_0x318b7e,null));};exports[_0x69f3('0x36')]=function(_0x1d3a5e,_0x4b9928){if(_0x1d3a5e[_0x69f3('0x56')]['id']){delete _0x1d3a5e[_0x69f3('0x56')]['id'];}return db[_0x69f3('0x3b')]['find']({'where':{'id':_0x1d3a5e['params']['id']}})[_0x69f3('0x1f')](handleEntityNotFound(_0x4b9928,null))[_0x69f3('0x1f')](saveUpdates(_0x1d3a5e[_0x69f3('0x56')],null))[_0x69f3('0x1f')](respondWithResult(_0x4b9928,null))['catch'](handleError(_0x4b9928,null));};exports[_0x69f3('0x37')]=function(_0x42b6b2,_0x2d02bd){return db['SmsMessage'][_0x69f3('0x54')]({'where':{'id':_0x42b6b2['params']['id']}})[_0x69f3('0x1f')](handleEntityNotFound(_0x2d02bd,null))[_0x69f3('0x1f')](removeEntity(_0x2d02bd,null))[_0x69f3('0x29')](handleError(_0x2d02bd,null));};exports[_0x69f3('0x57')]=function(_0xdaefdb,_0x5e15ea){return db[_0x69f3('0x3b')][_0x69f3('0x57')]()[_0x69f3('0x1f')](respondWithResult(_0x5e15ea,null))[_0x69f3('0x29')](handleError(_0x5e15ea,null));};var interaction_log=require(_0x69f3('0x14'))(_0x69f3('0x58'));exports['accept']=function(_0x4b4f38,_0x3f3147,_0xc3c5a8){var _0x1301d5={'agent':{},'channel':_0x69f3('0x59')};if(_0x4b4f38[_0x69f3('0x56')]['id']){delete _0x4b4f38['body']['id'];}_0x4b4f38[_0x69f3('0x56')][_0x69f3('0x5a')]=!![];_0x4b4f38[_0x69f3('0x56')]['readAt']=moment()['format'](_0x69f3('0x5b'));_0x4b4f38[_0x69f3('0x56')][_0x69f3('0x5c')]=_0x4b4f38['body'][_0x69f3('0x5c')]||_0x4b4f38[_0x69f3('0x5d')]['id'];_0x1301d5[_0x69f3('0x5e')]['id']=_0x4b4f38[_0x69f3('0x56')][_0x69f3('0x5c')];return db[_0x69f3('0x3b')][_0x69f3('0x54')]({'where':{'id':_0x4b4f38[_0x69f3('0x50')]['id'],'UserId':null}})[_0x69f3('0x1f')](handleEntityNotFound(_0x3f3147,null))[_0x69f3('0x1f')](saveUpdates(_0x4b4f38[_0x69f3('0x56')],null))[_0x69f3('0x1f')](function(_0x393018){if(_0x393018){_0x1301d5[_0x69f3('0x26')]=_0x393018['get']({'plain':!![]});return db[_0x69f3('0x5f')][_0x69f3('0x54')]({'where':{'id':_0x393018[_0x69f3('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x3f3147,null))[_0x69f3('0x1f')](function(_0x34d06f){if(_0x34d06f){return _0x34d06f[_0x69f3('0x36')]({'UserId':_0x4b4f38[_0x69f3('0x56')][_0x69f3('0x5c')],'read1stAt':_[_0x69f3('0x61')](_0x34d06f[_0x69f3('0x62')])?moment()[_0x69f3('0x63')](_0x69f3('0x5b')):undefined});}return null;})[_0x69f3('0x1f')](function(_0x5a5866){if(_0x5a5866){_0x1301d5[_0x69f3('0x64')]=_0x5a5866[_0x69f3('0x65')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b4f38['user']['id'],_0x4b4f38[_0x69f3('0x5d')][_0x69f3('0x38')],_0x4b4f38[_0x69f3('0x5d')][_0x69f3('0x66')],_0x1301d5[_0x69f3('0x64')]['id'],_0x4b4f38['body']?JSON['stringify'](_0x4b4f38[_0x69f3('0x56')]):_0x69f3('0x67'));return respondWithRpcPromise(_0x69f3('0x68'),_0x69f3('0x69'),_0x1301d5);}return null;})[_0x69f3('0x1f')](function(_0x4d02b8){var _0xa5ebb1=_0x69f3('0x6a')+_0x4d02b8[_0x69f3('0x26')][_0x69f3('0x6b')];return db[_0x69f3('0x6c')][_0x69f3('0x40')](_0xa5ebb1,{'type':db[_0x69f3('0x6d')][_0x69f3('0x6e')][_0x69f3('0x6f')],'raw':!![]})[_0x69f3('0x1f')](function(_0x14e54a){return _0x14e54a;});})[_0x69f3('0x1f')](function(_0x4e5f5c){if(_0x4e5f5c){_0x1301d5[_0x69f3('0x26')][_0x69f3('0x70')]=_0x4e5f5c[0x0];if(!_0x4b4f38[_0x69f3('0x56')][_0x69f3('0x5c')])return;return db[_0x69f3('0x71')]['find']({'where':{'id':_0x4b4f38['body'][_0x69f3('0x5c')],'role':_0x69f3('0x5e')},'attributes':['id','name',_0x69f3('0x72'),_0x69f3('0x73'),_0x69f3('0x74')],'raw':!![]});}return null;})['then'](function(_0x4081f4){if(!_0x4081f4)return null;_0x1301d5[_0x69f3('0x26')][_0x69f3('0x5e')]=_0x4081f4;return _0x1301d5;})[_0x69f3('0x1f')](function(_0xb35f63){if(_0xb35f63){if(_0x4b4f38[_0x69f3('0x56')]['manual']){_0x1301d5['message'][_0x69f3('0x75')]=util['format'](_0x69f3('0x76'),_0x4b4f38[_0x69f3('0x5d')][_0x69f3('0x38')]);_0x1301d5['message'][_0x69f3('0x77')]=_0x1301d5[_0x69f3('0x77')];_0x1301d5[_0x69f3('0x26')][_0x69f3('0x78')]=_0x69f3('0x79');return respondWithRpcPromise(_0x69f3('0x7a'),_0x69f3('0x7a'),{'event':_0x69f3('0x7b'),'message':_0x1301d5['message']},client9002)[_0x69f3('0x1f')](function(){return _0x1301d5;});}return _0x1301d5;}return null;})[_0x69f3('0x1f')](respondWithResult(_0x3f3147,null))[_0x69f3('0x29')](handleError(_0x3f3147,null));};var interaction_log=require(_0x69f3('0x14'))(_0x69f3('0x58'));exports['reject']=function(_0x1a23bc,_0x546018,_0x2b0aed){var _0x470263={'agent':{},'channel':_0x69f3('0x59')};if(_0x1a23bc['body']['id']){delete _0x1a23bc['body']['id'];}_0x1a23bc[_0x69f3('0x56')][_0x69f3('0x5c')]=_0x1a23bc['body'][_0x69f3('0x5c')]||_0x1a23bc['user']['id'];_0x470263[_0x69f3('0x5e')]['id']=_0x1a23bc[_0x69f3('0x56')][_0x69f3('0x5c')];return db[_0x69f3('0x3b')][_0x69f3('0x54')]({'where':{'id':_0x1a23bc['params']['id'],'UserId':null}})[_0x69f3('0x1f')](handleEntityNotFound(_0x546018,null))['then'](function(_0x2f34f0){if(_0x2f34f0){_0x470263[_0x69f3('0x26')]=_0x2f34f0[_0x69f3('0x65')]({'plain':!![]});return db['SmsInteraction'][_0x69f3('0x54')]({'where':{'id':_0x2f34f0['SmsInteractionId']}});}return null;})[_0x69f3('0x1f')](handleEntityNotFound(_0x546018,null))['then'](function(_0xd5588e){if(_0xd5588e){_0x470263[_0x69f3('0x64')]=_0xd5588e['get']({'plain':!![]});interaction_log[_0x69f3('0x27')](_0x69f3('0x7c'),_0x1a23bc[_0x69f3('0x5d')]['id'],_0x1a23bc[_0x69f3('0x5d')][_0x69f3('0x38')],_0x1a23bc[_0x69f3('0x5d')][_0x69f3('0x66')],_0x470263[_0x69f3('0x64')]['id'],_0x1a23bc[_0x69f3('0x56')]?JSON[_0x69f3('0x22')](_0x1a23bc[_0x69f3('0x56')]):'null');return respondWithRpcPromise(_0x69f3('0x7d'),_0x69f3('0x7e'),_0x470263);}return null;})[_0x69f3('0x1f')](function(_0x63fbaf){var _0x58c5d8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x63fbaf[_0x69f3('0x26')]['ContactId'];return db[_0x69f3('0x6c')][_0x69f3('0x40')](_0x58c5d8,{'type':db[_0x69f3('0x6d')][_0x69f3('0x6e')][_0x69f3('0x6f')],'raw':!![]})['then'](function(_0x624227){return _0x624227;});})[_0x69f3('0x1f')](function(_0x35bdaf){if(_0x35bdaf){_0x470263[_0x69f3('0x26')][_0x69f3('0x70')]=_0x35bdaf[0x0];if(!_0x1a23bc['body']['UserId'])return;return db[_0x69f3('0x71')][_0x69f3('0x54')]({'where':{'id':_0x1a23bc[_0x69f3('0x56')][_0x69f3('0x5c')],'role':'agent'},'attributes':['id',_0x69f3('0x38'),_0x69f3('0x72'),_0x69f3('0x73'),_0x69f3('0x74')],'raw':!![]});}return null;})['then'](function(_0x2035db){if(!_0x2035db)return null;_0x470263[_0x69f3('0x26')][_0x69f3('0x5e')]=_0x2035db;return _0x470263;})[_0x69f3('0x1f')](function(_0x1e677b){if(_0x1e677b){_0x1e677b[_0x69f3('0x26')][_0x69f3('0x75')]=util[_0x69f3('0x63')](_0x69f3('0x76'),_0x1a23bc[_0x69f3('0x5d')][_0x69f3('0x38')]);_0x1e677b[_0x69f3('0x26')]['channel']=_0x470263[_0x69f3('0x77')];_0x1e677b[_0x69f3('0x26')][_0x69f3('0x78')]=_0x69f3('0x34');respondWithRpcPromise(_0x69f3('0x7a'),_0x69f3('0x7a'),{'event':_0x69f3('0x7f'),'message':_0x1e677b[_0x69f3('0x26')]},client9002);return _0x470263;}return null;})[_0x69f3('0x1f')](respondWithResult(_0x546018,null))['catch'](handleError(_0x546018,null));};exports['status']=function(_0x5af8d3,_0x2d82f3,_0x6ada7){if(_0x5af8d3[_0x69f3('0x56')]['id']){delete _0x5af8d3['body']['id'];}var _0x43a1ce;return db[_0x69f3('0x3b')]['find']({'where':{'id':_0x5af8d3[_0x69f3('0x50')]['id']}})[_0x69f3('0x1f')](handleEntityNotFound(_0x2d82f3,null))[_0x69f3('0x1f')](function(_0x3e5ce3){if(_0x3e5ce3){_0x43a1ce=_0x3e5ce3;return db[_0x69f3('0x80')][_0x69f3('0x54')]({'where':{'id':_0x3e5ce3[_0x69f3('0x81')]}});}})[_0x69f3('0x1f')](handleEntityNotFound(_0x2d82f3,null))['then'](function(_0x44c0c3){if(_0x44c0c3){logger[_0x69f3('0x20')](_0x69f3('0x82'),_0x69f3('0x2b'),_0x69f3('0x83'),_0x44c0c3['type'],util[_0x69f3('0x84')](_0x5af8d3['body'],{'showHidden':![],'depth':null}));switch(_0x44c0c3['type']){case _0x69f3('0x85'):if(_0x5af8d3[_0x69f3('0x56')]['MessageSid']&&_0x5af8d3[_0x69f3('0x56')][_0x69f3('0x86')]===_0x43a1ce[_0x69f3('0x87')]){return _0x43a1ce[_0x69f3('0x36')]({'read':!![]});}else{logger['error'](_0x69f3('0x88'),_0x69f3('0x2b'),_0x69f3('0x85'),util[_0x69f3('0x84')](_0x5af8d3[_0x69f3('0x56')],{'showHidden':![],'depth':null}));}break;case _0x69f3('0x89'):if(_0x5af8d3[_0x69f3('0x56')]['MessageUUID']&&_0x5af8d3[_0x69f3('0x56')][_0x69f3('0x8a')]===_0x43a1ce[_0x69f3('0x87')]&&_['indexOf'](['sent',_0x69f3('0x8b')],_0x5af8d3[_0x69f3('0x56')][_0x69f3('0x8c')])>=0x0){return _0x43a1ce[_0x69f3('0x36')]({'read':!![]});}else{logger[_0x69f3('0x23')](_0x69f3('0x88'),_0x69f3('0x2b'),_0x69f3('0x8d'),util[_0x69f3('0x84')](_0x5af8d3['body'],{'showHidden':![],'depth':null}));}break;case _0x69f3('0x8e'):var _0x538740=_0x5af8d3[_0x69f3('0x56')]['results'][0x0];if(_0x538740[_0x69f3('0x2b')]['groupName']===_0x69f3('0x8f')){return _0x43a1ce[_0x69f3('0x36')]({'read':!![]});}else{logger[_0x69f3('0x23')](_0x69f3('0x88'),'status',_0x69f3('0x8e'),util[_0x69f3('0x84')](_0x5af8d3[_0x69f3('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x43a1ce;}})[_0x69f3('0x1f')](respondWithResult(_0x2d82f3,null))[_0x69f3('0x29')](handleError(_0x2d82f3,null));}; \ No newline at end of file +var _0xbcf0=['order','sort','where','pick','filter','merge','count','includeAll','findAll','show','params','include','options','create','body','find','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteractionId','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms','SmsInteraction','RejectMessage','rejectMessage','Sequelize','email','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','SmsMessage','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit'];(function(_0x594da0,_0xdf95fe){var _0x38d021=function(_0x472625){while(--_0x472625){_0x594da0['push'](_0x594da0['shift']());}};_0x38d021(++_0xdf95fe);}(_0xbcf0,0xd6));var _0x0bcf=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xbcf0[_0x4914e2];return _0x2dcd07;};'use strict';var emlformat=require(_0x0bcf('0x0'));var rimraf=require(_0x0bcf('0x1'));var zipdir=require(_0x0bcf('0x2'));var jsonpatch=require(_0x0bcf('0x3'));var rp=require(_0x0bcf('0x4'));var moment=require('moment');var BPromise=require(_0x0bcf('0x5'));var Mustache=require('mustache');var util=require(_0x0bcf('0x6'));var path=require(_0x0bcf('0x7'));var sox=require(_0x0bcf('0x8'));var csv=require('to-csv');var ejs=require(_0x0bcf('0x9'));var fs=require('fs');var fs_extra=require(_0x0bcf('0xa'));var _=require(_0x0bcf('0xb'));var squel=require(_0x0bcf('0xc'));var crypto=require('crypto');var jsforce=require(_0x0bcf('0xd'));var deskjs=require(_0x0bcf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0bcf('0xf'));var Papa=require('papaparse');var Redis=require(_0x0bcf('0x10'));var authService=require(_0x0bcf('0x11'));var qs=require(_0x0bcf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bcf('0x13'))(_0x0bcf('0x14'));var utils=require(_0x0bcf('0x15'));var config=require(_0x0bcf('0x16'));var licenseUtil=require(_0x0bcf('0x17'));var db=require(_0x0bcf('0x18'))['db'];config[_0x0bcf('0x19')]=_[_0x0bcf('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0bcf('0x1b'))(new Redis(config[_0x0bcf('0x19')]));require(_0x0bcf('0x1c'))[_0x0bcf('0x1d')](socket);var jayson=require(_0x0bcf('0x1e'));var client=jayson[_0x0bcf('0x1f')][_0x0bcf('0x20')]({'port':0x232c});var client9002=jayson[_0x0bcf('0x1f')][_0x0bcf('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x288ea7,_0x14ef0a,_0x32c9c1,_0x46355f){return new BPromise(function(_0x51b838,_0x4ac56a){var _0x5b1780=_0x46355f||client;return _0x5b1780['request'](_0x288ea7,_0x32c9c1)['then'](function(_0x1ed14f){logger[_0x0bcf('0x21')](_0x0bcf('0x22'),_0x14ef0a,'request\x20sent');logger[_0x0bcf('0x23')](_0x0bcf('0x24'),_0x14ef0a,'request\x20sent',JSON[_0x0bcf('0x25')](_0x1ed14f));if(_0x1ed14f['error']){if(_0x1ed14f['error'][_0x0bcf('0x26')]===0x1f4){logger[_0x0bcf('0x27')]('SmsMessage,\x20%s,\x20%s',_0x14ef0a,_0x1ed14f['error'][_0x0bcf('0x28')]);return _0x4ac56a(_0x1ed14f['error'][_0x0bcf('0x28')]);}logger[_0x0bcf('0x27')]('SmsMessage,\x20%s,\x20%s',_0x14ef0a,_0x1ed14f[_0x0bcf('0x27')][_0x0bcf('0x28')]);return _0x51b838(_0x1ed14f['error'][_0x0bcf('0x28')]);}else{logger[_0x0bcf('0x21')]('SmsMessage,\x20%s,\x20%s',_0x14ef0a,_0x0bcf('0x29'));_0x51b838(_0x1ed14f['result'][_0x0bcf('0x28')]);}})[_0x0bcf('0x2a')](function(_0x1061a0){logger[_0x0bcf('0x27')](_0x0bcf('0x22'),_0x14ef0a,_0x1061a0);_0x4ac56a(_0x1061a0);});});}function respondWithStatusCode(_0x5dd44b,_0x5e315f){_0x5e315f=_0x5e315f||0xcc;return function(_0x23228d){if(_0x23228d){return _0x5dd44b[_0x0bcf('0x2b')](_0x5e315f);}return _0x5dd44b[_0x0bcf('0x2c')](_0x5e315f)[_0x0bcf('0x2d')]();};}function respondWithResult(_0x24eeaa,_0x3b039f){_0x3b039f=_0x3b039f||0xc8;return function(_0x3dc430){if(_0x3dc430){return _0x24eeaa[_0x0bcf('0x2c')](_0x3b039f)[_0x0bcf('0x2e')](_0x3dc430);}};}function respondWithFilteredResult(_0x1efba0,_0xb9501c){return function(_0x3a556a){if(_0x3a556a){var _0x33dd6e=typeof _0xb9501c['offset']===_0x0bcf('0x2f')&&typeof _0xb9501c[_0x0bcf('0x30')]===_0x0bcf('0x2f');var _0x2738dc=_0x3a556a['count'];var _0x220429=_0x33dd6e?0x0:_0xb9501c[_0x0bcf('0x31')];var _0xc52581=_0x33dd6e?_0x3a556a['count']:_0xb9501c[_0x0bcf('0x31')]+_0xb9501c['limit'];var _0x129ada;if(_0xc52581>=_0x2738dc){_0xc52581=_0x2738dc;_0x129ada=0xc8;}else{_0x129ada=0xce;}_0x1efba0[_0x0bcf('0x2c')](_0x129ada);return _0x1efba0[_0x0bcf('0x32')](_0x0bcf('0x33'),_0x220429+'-'+_0xc52581+'/'+_0x2738dc)['json'](_0x3a556a);}return null;};}function patchUpdates(_0x139298){return function(_0x1b66fc){try{jsonpatch[_0x0bcf('0x34')](_0x1b66fc,_0x139298,!![]);}catch(_0x17c7f4){return BPromise[_0x0bcf('0x35')](_0x17c7f4);}return _0x1b66fc[_0x0bcf('0x36')]();};}function saveUpdates(_0x59dcf8,_0x498e1f){return function(_0x46cf66){if(_0x46cf66){return _0x46cf66[_0x0bcf('0x37')](_0x59dcf8)[_0x0bcf('0x38')](function(_0x3b8585){return _0x3b8585;});}return null;};}function removeEntity(_0x548f9d,_0x445903){return function(_0x31113d){if(_0x31113d){return _0x31113d[_0x0bcf('0x39')]()['then'](function(){_0x548f9d[_0x0bcf('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b43b6,_0x74030d){return function(_0x5aee17){if(!_0x5aee17){_0x3b43b6[_0x0bcf('0x2b')](0x194);}return _0x5aee17;};}function handleError(_0x1a95af,_0x1d9db3){_0x1d9db3=_0x1d9db3||0x1f4;return function(_0x487b32){logger[_0x0bcf('0x27')](_0x487b32['stack']);if(_0x487b32[_0x0bcf('0x3a')]){delete _0x487b32[_0x0bcf('0x3a')];}_0x1a95af[_0x0bcf('0x2c')](_0x1d9db3)['send'](_0x487b32);};}exports[_0x0bcf('0x3b')]=function(_0x5e2a89,_0x5085c7){var _0x377db1={},_0x3e0e75={},_0x19a755={'count':0x0,'rows':[]};var _0x57dc64=_[_0x0bcf('0x3c')](db[_0x0bcf('0x3d')][_0x0bcf('0x3e')],function(_0x2c61da){return{'name':_0x2c61da[_0x0bcf('0x3f')],'type':_0x2c61da[_0x0bcf('0x40')]['key']};});_0x3e0e75['model']=_['map'](_0x57dc64,_0x0bcf('0x3a'));_0x3e0e75['query']=_[_0x0bcf('0x41')](_0x5e2a89[_0x0bcf('0x42')]);_0x3e0e75[_0x0bcf('0x43')]=_[_0x0bcf('0x44')](_0x3e0e75[_0x0bcf('0x45')],_0x3e0e75[_0x0bcf('0x42')]);_0x377db1[_0x0bcf('0x46')]=_[_0x0bcf('0x44')](_0x3e0e75[_0x0bcf('0x45')],qs[_0x0bcf('0x47')](_0x5e2a89[_0x0bcf('0x42')][_0x0bcf('0x47')]));_0x377db1[_0x0bcf('0x46')]=_0x377db1[_0x0bcf('0x46')][_0x0bcf('0x48')]?_0x377db1['attributes']:_0x3e0e75['model'];if(!_0x5e2a89[_0x0bcf('0x42')]['hasOwnProperty'](_0x0bcf('0x49'))){_0x377db1[_0x0bcf('0x30')]=qs[_0x0bcf('0x30')](_0x5e2a89[_0x0bcf('0x42')][_0x0bcf('0x30')]);_0x377db1[_0x0bcf('0x31')]=qs['offset'](_0x5e2a89[_0x0bcf('0x42')][_0x0bcf('0x31')]);}_0x377db1[_0x0bcf('0x4a')]=qs['sort'](_0x5e2a89['query'][_0x0bcf('0x4b')]);_0x377db1[_0x0bcf('0x4c')]=qs[_0x0bcf('0x43')](_[_0x0bcf('0x4d')](_0x5e2a89['query'],_0x3e0e75[_0x0bcf('0x43')]),_0x57dc64);if(_0x5e2a89[_0x0bcf('0x42')][_0x0bcf('0x4e')]){_0x377db1[_0x0bcf('0x4c')]=_[_0x0bcf('0x4f')](_0x377db1[_0x0bcf('0x4c')],{'$or':_[_0x0bcf('0x3c')](_0x57dc64,function(_0x435f02){if(_0x435f02[_0x0bcf('0x40')]!=='VIRTUAL'){var _0x1f4250={};_0x1f4250[_0x435f02['name']]={'$like':'%'+_0x5e2a89[_0x0bcf('0x42')][_0x0bcf('0x4e')]+'%'};return _0x1f4250;}})});}_0x377db1=_[_0x0bcf('0x4f')]({},_0x377db1,_0x5e2a89['options']);var _0x4a6f52={'where':_0x377db1[_0x0bcf('0x4c')]};return db[_0x0bcf('0x3d')][_0x0bcf('0x50')](_0x4a6f52)['then'](function(_0xd7b22a){_0x19a755[_0x0bcf('0x50')]=_0xd7b22a;if(_0x5e2a89[_0x0bcf('0x42')][_0x0bcf('0x51')]){_0x377db1['include']=[{'all':!![]}];}return db[_0x0bcf('0x3d')][_0x0bcf('0x52')](_0x377db1);})[_0x0bcf('0x38')](function(_0xb73e1f){_0x19a755['rows']=_0xb73e1f;return _0x19a755;})[_0x0bcf('0x38')](respondWithFilteredResult(_0x5085c7,_0x377db1))[_0x0bcf('0x2a')](handleError(_0x5085c7,null));};exports[_0x0bcf('0x53')]=function(_0x67216f,_0x33b057){var _0x353bd9={'raw':!![],'where':{'id':_0x67216f[_0x0bcf('0x54')]['id']}},_0x323149={};_0x323149['model']=_[_0x0bcf('0x41')](db[_0x0bcf('0x3d')][_0x0bcf('0x3e')]);_0x323149[_0x0bcf('0x42')]=_['keys'](_0x67216f[_0x0bcf('0x42')]);_0x323149['filters']=_[_0x0bcf('0x44')](_0x323149[_0x0bcf('0x45')],_0x323149[_0x0bcf('0x42')]);_0x353bd9[_0x0bcf('0x46')]=_['intersection'](_0x323149['model'],qs[_0x0bcf('0x47')](_0x67216f['query'][_0x0bcf('0x47')]));_0x353bd9[_0x0bcf('0x46')]=_0x353bd9[_0x0bcf('0x46')][_0x0bcf('0x48')]?_0x353bd9['attributes']:_0x323149[_0x0bcf('0x45')];if(_0x67216f[_0x0bcf('0x42')][_0x0bcf('0x51')]){_0x353bd9[_0x0bcf('0x55')]=[{'all':!![]}];}_0x353bd9=_['merge']({},_0x353bd9,_0x67216f[_0x0bcf('0x56')]);return db['SmsMessage']['find'](_0x353bd9)[_0x0bcf('0x38')](handleEntityNotFound(_0x33b057,null))[_0x0bcf('0x38')](respondWithResult(_0x33b057,null))[_0x0bcf('0x2a')](handleError(_0x33b057,null));};exports[_0x0bcf('0x57')]=function(_0x3365c2,_0x230626){return db['SmsMessage'][_0x0bcf('0x57')](_0x3365c2[_0x0bcf('0x58')],{})['then'](respondWithResult(_0x230626,0xc9))[_0x0bcf('0x2a')](handleError(_0x230626,null));};exports[_0x0bcf('0x37')]=function(_0x5b3ac3,_0x5a2f87){if(_0x5b3ac3['body']['id']){delete _0x5b3ac3[_0x0bcf('0x58')]['id'];}return db['SmsMessage'][_0x0bcf('0x59')]({'where':{'id':_0x5b3ac3[_0x0bcf('0x54')]['id']}})[_0x0bcf('0x38')](handleEntityNotFound(_0x5a2f87,null))[_0x0bcf('0x38')](saveUpdates(_0x5b3ac3[_0x0bcf('0x58')],null))['then'](respondWithResult(_0x5a2f87,null))[_0x0bcf('0x2a')](handleError(_0x5a2f87,null));};exports[_0x0bcf('0x39')]=function(_0x15730b,_0x38707a){return db[_0x0bcf('0x3d')][_0x0bcf('0x59')]({'where':{'id':_0x15730b['params']['id']}})['then'](handleEntityNotFound(_0x38707a,null))[_0x0bcf('0x38')](removeEntity(_0x38707a,null))[_0x0bcf('0x2a')](handleError(_0x38707a,null));};exports[_0x0bcf('0x5a')]=function(_0x4bd816,_0x3e23ed){return db[_0x0bcf('0x3d')][_0x0bcf('0x5a')]()[_0x0bcf('0x38')](respondWithResult(_0x3e23ed,null))[_0x0bcf('0x2a')](handleError(_0x3e23ed,null));};var interaction_log=require(_0x0bcf('0x13'))('sms-interactions');exports[_0x0bcf('0x5b')]=function(_0x32a0e8,_0x5431fc,_0xdb1071){var _0x22f1c8={'agent':{},'channel':'sms'};if(_0x32a0e8[_0x0bcf('0x58')]['id']){delete _0x32a0e8[_0x0bcf('0x58')]['id'];}_0x32a0e8[_0x0bcf('0x58')][_0x0bcf('0x5c')]=!![];_0x32a0e8[_0x0bcf('0x58')][_0x0bcf('0x5d')]=moment()[_0x0bcf('0x5e')](_0x0bcf('0x5f'));_0x32a0e8[_0x0bcf('0x58')][_0x0bcf('0x60')]=_0x32a0e8[_0x0bcf('0x58')]['UserId']||_0x32a0e8['user']['id'];_0x22f1c8[_0x0bcf('0x61')]['id']=_0x32a0e8[_0x0bcf('0x58')][_0x0bcf('0x60')];return db['SmsMessage'][_0x0bcf('0x59')]({'where':{'id':_0x32a0e8[_0x0bcf('0x54')]['id'],'UserId':null}})[_0x0bcf('0x38')](handleEntityNotFound(_0x5431fc,null))['then'](saveUpdates(_0x32a0e8[_0x0bcf('0x58')],null))['then'](function(_0x328ab6){if(_0x328ab6){_0x22f1c8[_0x0bcf('0x28')]=_0x328ab6[_0x0bcf('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x0bcf('0x59')]({'where':{'id':_0x328ab6[_0x0bcf('0x63')]}});}return null;})[_0x0bcf('0x38')](handleEntityNotFound(_0x5431fc,null))[_0x0bcf('0x38')](function(_0x5902ae){if(_0x5902ae){return _0x5902ae['update']({'UserId':_0x32a0e8[_0x0bcf('0x58')][_0x0bcf('0x60')],'read1stAt':_['isNil'](_0x5902ae['read1stAt'])?moment()[_0x0bcf('0x5e')](_0x0bcf('0x5f')):undefined});}return null;})['then'](function(_0xdbae30){if(_0xdbae30){_0x22f1c8[_0x0bcf('0x64')]=_0xdbae30[_0x0bcf('0x62')]({'plain':!![]});interaction_log['info'](_0x0bcf('0x65'),_0x32a0e8['user']['id'],_0x32a0e8[_0x0bcf('0x66')]['name'],_0x32a0e8[_0x0bcf('0x66')][_0x0bcf('0x67')],_0x22f1c8['interaction']['id'],_0x32a0e8[_0x0bcf('0x58')]?JSON[_0x0bcf('0x25')](_0x32a0e8[_0x0bcf('0x58')]):_0x0bcf('0x68'));return respondWithRpcPromise(_0x0bcf('0x69'),_0x0bcf('0x6a'),_0x22f1c8);}return null;})[_0x0bcf('0x38')](function(_0x4ddfbf){var _0x47ee68=_0x0bcf('0x6b')+_0x4ddfbf[_0x0bcf('0x28')][_0x0bcf('0x6c')];return db['sequelize']['query'](_0x47ee68,{'type':db['Sequelize'][_0x0bcf('0x6d')]['SELECT'],'raw':!![]})[_0x0bcf('0x38')](function(_0xefe50e){return _0xefe50e;});})[_0x0bcf('0x38')](function(_0x1644f2){if(_0x1644f2){_0x22f1c8[_0x0bcf('0x28')][_0x0bcf('0x6e')]=_0x1644f2[0x0];if(!_0x32a0e8['body'][_0x0bcf('0x60')])return;return db[_0x0bcf('0x6f')][_0x0bcf('0x59')]({'where':{'id':_0x32a0e8['body'][_0x0bcf('0x60')],'role':_0x0bcf('0x61')},'attributes':['id','name',_0x0bcf('0x70'),'email',_0x0bcf('0x71')],'raw':!![]});}return null;})[_0x0bcf('0x38')](function(_0x27399a){if(!_0x27399a)return null;_0x22f1c8['message'][_0x0bcf('0x61')]=_0x27399a;return _0x22f1c8;})[_0x0bcf('0x38')](function(_0x3c2eb6){if(_0x3c2eb6){if(_0x32a0e8[_0x0bcf('0x58')][_0x0bcf('0x72')]){_0x22f1c8['message'][_0x0bcf('0x73')]=util[_0x0bcf('0x5e')](_0x0bcf('0x74'),_0x32a0e8[_0x0bcf('0x66')][_0x0bcf('0x3a')]);_0x22f1c8[_0x0bcf('0x28')][_0x0bcf('0x75')]=_0x22f1c8[_0x0bcf('0x75')];_0x22f1c8['message'][_0x0bcf('0x76')]=_0x0bcf('0x5b');return respondWithRpcPromise(_0x0bcf('0x77'),_0x0bcf('0x77'),{'event':_0x0bcf('0x78'),'message':_0x22f1c8[_0x0bcf('0x28')]},client9002)[_0x0bcf('0x38')](function(){return _0x22f1c8;});}return _0x22f1c8;}return null;})[_0x0bcf('0x38')](respondWithResult(_0x5431fc,null))[_0x0bcf('0x2a')](handleError(_0x5431fc,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports['reject']=function(_0x41424a,_0x5cfd88,_0x3474f1){var _0xbf622b={'agent':{},'channel':_0x0bcf('0x79')};if(_0x41424a[_0x0bcf('0x58')]['id']){delete _0x41424a[_0x0bcf('0x58')]['id'];}_0x41424a[_0x0bcf('0x58')]['UserId']=_0x41424a[_0x0bcf('0x58')][_0x0bcf('0x60')]||_0x41424a[_0x0bcf('0x66')]['id'];_0xbf622b[_0x0bcf('0x61')]['id']=_0x41424a[_0x0bcf('0x58')]['UserId'];return db[_0x0bcf('0x3d')][_0x0bcf('0x59')]({'where':{'id':_0x41424a[_0x0bcf('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5cfd88,null))['then'](function(_0x5e5c47){if(_0x5e5c47){_0xbf622b[_0x0bcf('0x28')]=_0x5e5c47[_0x0bcf('0x62')]({'plain':!![]});return db[_0x0bcf('0x7a')][_0x0bcf('0x59')]({'where':{'id':_0x5e5c47[_0x0bcf('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x5cfd88,null))[_0x0bcf('0x38')](function(_0x27c7b8){if(_0x27c7b8){_0xbf622b[_0x0bcf('0x64')]=_0x27c7b8[_0x0bcf('0x62')]({'plain':!![]});interaction_log[_0x0bcf('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x41424a[_0x0bcf('0x66')]['id'],_0x41424a[_0x0bcf('0x66')][_0x0bcf('0x3a')],_0x41424a[_0x0bcf('0x66')]['role'],_0xbf622b[_0x0bcf('0x64')]['id'],_0x41424a[_0x0bcf('0x58')]?JSON[_0x0bcf('0x25')](_0x41424a[_0x0bcf('0x58')]):_0x0bcf('0x68'));return respondWithRpcPromise(_0x0bcf('0x7b'),_0x0bcf('0x7c'),_0xbf622b);}return null;})[_0x0bcf('0x38')](function(_0x3f650f){var _0x5c62c2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f650f['message'][_0x0bcf('0x6c')];return db['sequelize']['query'](_0x5c62c2,{'type':db[_0x0bcf('0x7d')][_0x0bcf('0x6d')]['SELECT'],'raw':!![]})[_0x0bcf('0x38')](function(_0x3a081a){return _0x3a081a;});})[_0x0bcf('0x38')](function(_0x3a23f0){if(_0x3a23f0){_0xbf622b[_0x0bcf('0x28')][_0x0bcf('0x6e')]=_0x3a23f0[0x0];if(!_0x41424a[_0x0bcf('0x58')][_0x0bcf('0x60')])return;return db[_0x0bcf('0x6f')][_0x0bcf('0x59')]({'where':{'id':_0x41424a[_0x0bcf('0x58')][_0x0bcf('0x60')],'role':'agent'},'attributes':['id','name',_0x0bcf('0x70'),_0x0bcf('0x7e'),_0x0bcf('0x71')],'raw':!![]});}return null;})[_0x0bcf('0x38')](function(_0x4ccf0b){if(!_0x4ccf0b)return null;_0xbf622b[_0x0bcf('0x28')]['agent']=_0x4ccf0b;return _0xbf622b;})['then'](function(_0x441872){if(_0x441872){_0x441872['message'][_0x0bcf('0x73')]=util['format']('SIP/%s',_0x41424a['user'][_0x0bcf('0x3a')]);_0x441872['message'][_0x0bcf('0x75')]=_0xbf622b[_0x0bcf('0x75')];_0x441872['message']['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x441872[_0x0bcf('0x28')]},client9002);return _0xbf622b;}return null;})[_0x0bcf('0x38')](respondWithResult(_0x5cfd88,null))['catch'](handleError(_0x5cfd88,null));};exports['status']=function(_0xe7a6e,_0x53f22e,_0x43bcf4){if(_0xe7a6e[_0x0bcf('0x58')]['id']){delete _0xe7a6e[_0x0bcf('0x58')]['id'];}var _0xe1149a;return db[_0x0bcf('0x3d')]['find']({'where':{'id':_0xe7a6e[_0x0bcf('0x54')]['id']}})[_0x0bcf('0x38')](handleEntityNotFound(_0x53f22e,null))[_0x0bcf('0x38')](function(_0x5cd94c){if(_0x5cd94c){_0xe1149a=_0x5cd94c;return db['SmsAccount']['find']({'where':{'id':_0x5cd94c[_0x0bcf('0x7f')]}});}})[_0x0bcf('0x38')](handleEntityNotFound(_0x53f22e,null))['then'](function(_0x109b7e){if(_0x109b7e){logger[_0x0bcf('0x23')](_0x0bcf('0x24'),_0x0bcf('0x2c'),_0x0bcf('0x80'),_0x109b7e['type'],util[_0x0bcf('0x81')](_0xe7a6e['body'],{'showHidden':![],'depth':null}));switch(_0x109b7e['type']){case _0x0bcf('0x82'):if(_0xe7a6e[_0x0bcf('0x58')][_0x0bcf('0x83')]&&_0xe7a6e[_0x0bcf('0x58')][_0x0bcf('0x83')]===_0xe1149a['messageId']){return _0xe1149a['update']({'read':!![]});}else{logger['error'](_0x0bcf('0x84'),_0x0bcf('0x2c'),_0x0bcf('0x82'),util[_0x0bcf('0x81')](_0xe7a6e[_0x0bcf('0x58')],{'showHidden':![],'depth':null}));}break;case _0x0bcf('0x85'):if(_0xe7a6e[_0x0bcf('0x58')][_0x0bcf('0x86')]&&_0xe7a6e[_0x0bcf('0x58')][_0x0bcf('0x86')]===_0xe1149a[_0x0bcf('0x87')]&&_[_0x0bcf('0x88')]([_0x0bcf('0x89'),_0x0bcf('0x8a')],_0xe7a6e['body']['Status'])>=0x0){return _0xe1149a['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0bcf('0x2c'),_0x0bcf('0x8b'),util[_0x0bcf('0x81')](_0xe7a6e[_0x0bcf('0x58')],{'showHidden':![],'depth':null}));}break;case _0x0bcf('0x8c'):var _0x1eac17=_0xe7a6e[_0x0bcf('0x58')][_0x0bcf('0x8d')][0x0];if(_0x1eac17[_0x0bcf('0x2c')][_0x0bcf('0x8e')]===_0x0bcf('0x8f')){return _0xe1149a['update']({'read':!![]});}else{logger[_0x0bcf('0x27')](_0x0bcf('0x84'),_0x0bcf('0x2c'),_0x0bcf('0x8c'),util[_0x0bcf('0x81')](_0xe7a6e['body'],{'showHidden':![],'depth':null}));}break;}return _0xe1149a;}})[_0x0bcf('0x38')](respondWithResult(_0x53f22e,null))[_0x0bcf('0x2a')](handleError(_0x53f22e,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index cd02ee0..a420770 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 _0x3727=['../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','events'];(function(_0x25ff63,_0x1c41f4){var _0x5e59f1=function(_0x3aebd8){while(--_0x3aebd8){_0x25ff63['push'](_0x25ff63['shift']());}};_0x5e59f1(++_0x1c41f4);}(_0x3727,0x177));var _0x7372=function(_0x5d7ab0,_0x2982f8){_0x5d7ab0=_0x5d7ab0-0x0;var _0x25c3ab=_0x3727[_0x5d7ab0];return _0x25c3ab;};'use strict';var EventEmitter=require(_0x7372('0x0'));var SmsMessage=require(_0x7372('0x1'))['db'][_0x7372('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7372('0x3')](0x0);var events={'afterCreate':_0x7372('0x4'),'afterUpdate':_0x7372('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58af5e){return function(_0x18e4b7,_0x48bcf5,_0x51654f){SmsMessageEvents['emit'](_0x58af5e+':'+_0x18e4b7['id'],_0x18e4b7);SmsMessageEvents[_0x7372('0x6')](_0x58af5e,_0x18e4b7);_0x51654f(null);};}for(var e in events){if(events[_0x7372('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xac51=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xac51,0x185));var _0x1ac5=function(_0x4a2b2c,_0x1f22e8){_0x4a2b2c=_0x4a2b2c-0x0;var _0x5a1fad=_0xac51[_0x4a2b2c];return _0x5a1fad;};'use strict';var EventEmitter=require(_0x1ac5('0x0'));var SmsMessage=require(_0x1ac5('0x1'))['db'][_0x1ac5('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1ac5('0x3')](0x0);var events={'afterCreate':_0x1ac5('0x4'),'afterUpdate':_0x1ac5('0x5'),'afterDestroy':_0x1ac5('0x6')};function emitEvent(_0x52f0db){return function(_0x12c26a,_0x1b70f0,_0x35bed3){SmsMessageEvents[_0x1ac5('0x7')](_0x52f0db+':'+_0x12c26a['id'],_0x12c26a);SmsMessageEvents[_0x1ac5('0x7')](_0x52f0db,_0x12c26a);_0x35bed3(null);};}for(var e in events){if(events[_0x1ac5('0x8')](e)){var event=events[e];SmsMessage[_0x1ac5('0x9')](e,emitEvent(event));}}module[_0x1ac5('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a574f57..31b1acc 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 _0x136c=['direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','then','out','SmsAccount','find','type','twilio','accountSid','phone','authToken','body','remote','/api/sms/messages/','/status?token=','token','sid','error','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','POST','user_key','internal_order_id','deliveryReport','read','update','catch','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','timestamp','sort','length','createHash','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get'];(function(_0x1d638a,_0x2c4d2b){var _0x59a099=function(_0x33aa18){while(--_0x33aa18){_0x1d638a['push'](_0x1d638a['shift']());}};_0x59a099(++_0x2c4d2b);}(_0x136c,0x1d2));var _0xc136=function(_0x3a8d4b,_0x5a32ee){_0x3a8d4b=_0x3a8d4b-0x0;var _0x462ec0=_0x136c[_0x3a8d4b];return _0x462ec0;};'use strict';var _=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var logger=require('../../config/logger')(_0xc136('0x2'));var moment=require(_0xc136('0x3'));var BPromise=require(_0xc136('0x4'));var rp=require(_0xc136('0x5'));var fs=require('fs');var path=require(_0xc136('0x6'));var rimraf=require(_0xc136('0x7'));var config=require(_0xc136('0x8'));var attributes=require(_0xc136('0x9'));module[_0xc136('0xa')]=function(_0x586570,_0x1ac41b){return _0x586570['define'](_0xc136('0xb'),attributes,{'tableName':_0xc136('0xc'),'paranoid':![],'indexes':[{'name':_0xc136('0xd'),'fields':['messageId']},{'name':_0xc136('0xe'),'fields':['body'],'type':_0xc136('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31f7c3,_0x181f1d,_0x230e15){var _0x1cec7b=_0x586570[_0xc136('0x10')];var _0x2af561=_0x31f7c3[_0xc136('0x11')]({'plain':!![]});if(_0x2af561[_0xc136('0x12')]['toLowerCase']()==='in'||_0x2af561['direction'][_0xc136('0x13')]()==='out'&&!_0x2af561[_0xc136('0x14')]&&!_[_0xc136('0x15')](_0x2af561[_0xc136('0x16')])){_0x1cec7b['SmsInteraction']['findOne']({'where':{'id':_0x2af561[_0xc136('0x17')]}})[_0xc136('0x18')](function(_0x4e2674){if(_0x4e2674){_0x4e2674['update']({'lastMsgAt':_0x2af561['createdAt'],'lastMsgDirection':_0x2af561[_0xc136('0x12')][_0xc136('0x13')]()});}})['catch'](function(_0x4e24fb){console['error'](_0x4e24fb);});}if(_0x2af561[_0xc136('0x12')]===_0xc136('0x19')&&!_0x2af561[_0xc136('0x14')]){var _0x155929;_0x1cec7b[_0xc136('0x1a')][_0xc136('0x1b')]({'where':{'id':_0x2af561['SmsAccountId']},'raw':!![]})['then'](function(_0x4d56cb){_0x155929=_0x4d56cb;if(_0x155929&&_0x155929[_0xc136('0x1c')]){switch(_0x155929['type']){case _0xc136('0x1d'):var _0x18de2e=require(_0xc136('0x1d'));if(_0x155929[_0xc136('0x1e')]&&_0x155929['authToken']&&_0x155929[_0xc136('0x1f')]){var _0x1f942b=new _0x18de2e(_0x155929['accountSid'],_0x155929[_0xc136('0x20')]);_0x1f942b['messages']['create']({'body':_0x2af561[_0xc136('0x21')],'to':_0x2af561[_0xc136('0x1f')],'from':_0x155929['phone'],'statusCallback':_0x155929[_0xc136('0x22')]+_0xc136('0x23')+_0x2af561['id']+_0xc136('0x24')+_0x155929[_0xc136('0x25')]})['then'](function(_0x6f0831){if(_0x6f0831[_0xc136('0x26')]){return _0x31f7c3['update']({'messageId':_0x6f0831[_0xc136('0x26')]});}})['catch'](function(_0x21a163){logger[_0xc136('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc136('0x1d'),util[_0xc136('0x28')](_0x21a163,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x1d'),_0xc136('0x2b'));}break;case _0xc136('0x2c'):var _0x1c1057=_0xc136('0x2d');if(_0x155929['username']&&_0x155929[_0xc136('0x2e')]){var _0x1e023a={'recipient':[_0x2af561[_0xc136('0x1f')]],'message':_0x2af561[_0xc136('0x21')],'message_type':_0x155929[_0xc136('0x2f')]};if(_0x155929[_0xc136('0x2f')]&&_0x155929[_0xc136('0x2f')]!=='SI'){_0x1e023a[_0xc136('0x30')]=_0x155929[_0xc136('0x1f')];}var _0xe3db05={'url':_0x1c1057+_0xc136('0x31')+_0x155929[_0xc136('0x32')]+_0xc136('0x33')+_0x155929['password'],'method':_0xc136('0x34')};rp(_0xe3db05)['then'](function(_0x4e5e09){var _0x1a29a5=_0x4e5e09[_0xc136('0x35')](';');var _0x3f5b49={'user_key':_0x1a29a5[0x0],'session_key':_0x1a29a5[0x1]};_0xe3db05={'url':_0x1c1057+'sms','method':_0xc136('0x36'),'headers':{'user_key':_0x3f5b49[_0xc136('0x37')],'Session_key':_0x3f5b49['session_key']},'json':!![],'body':_0x1e023a};return rp(_0xe3db05);})[_0xc136('0x18')](function(_0x1125e0){if(_0x1125e0['total_sent']>=0x1){var _0x1747e5={'messageId':_0x1125e0[_0xc136('0x38')]};if(_0x155929[_0xc136('0x2f')]!=='GP'||!_0x155929[_0xc136('0x39')]){_0x1747e5[_0xc136('0x3a')]=!![];}return _0x31f7c3[_0xc136('0x3b')](_0x1747e5);}else{return logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x2c'),util[_0xc136('0x28')](_0x1125e0,{'showHidden':![],'depth':null}));}})[_0xc136('0x3c')](function(_0x4f0419){return logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x2c'),util[_0xc136('0x28')](_0x4f0419,{'showHidden':![],'depth':null}));});}else{logger[_0xc136('0x27')](_0xc136('0x29'),'afterCreate',_0xc136('0x2c'),_0xc136('0x3d'));}break;case _0xc136('0x3e'):if(_0x155929[_0xc136('0x20')]){var _0x15e794={'recipient':_0x2af561[_0xc136('0x1f')],'message':_0x2af561[_0xc136('0x21')],'sender':_0x155929['senderString']||_0x155929[_0xc136('0x1f')],'authorization':_0x155929[_0xc136('0x20')]};var _0x181f1d={'method':_0xc136('0x36'),'uri':_0xc136('0x3f'),'body':_0x15e794,'json':!![]};rp(_0x181f1d)['then'](function(_0x27ac5f){var _0x39d8c9={'messageId':_0x27ac5f['requestid']};if(!_0x155929[_0xc136('0x39')]){_0x39d8c9[_0xc136('0x3a')]=!![];}return _0x31f7c3[_0xc136('0x3b')](_0x39d8c9);})[_0xc136('0x3c')](function(_0x2d85d3){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc136('0x2a'),'connectel',util[_0xc136('0x28')](_0x2d85d3,{'showHidden':![],'depth':null}));});}else{logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x3e'),_0xc136('0x40'));}break;case _0xc136('0x41'):if(_0x155929['username']&&_0x155929['password']){var _0x15e794={'messages':[{'source':'xCALLY\x20Motion','to':_0x2af561[_0xc136('0x1f')],'body':_0x2af561[_0xc136('0x21')],'from':_0x155929['senderString']||_0x155929[_0xc136('0x1f')]}]};var _0x359288=util['format']('%s:%s',_0x155929['username'],_0x155929[_0xc136('0x2e')]);var _0x181f1d={'method':'POST','uri':_0xc136('0x42'),'body':_0x15e794,'headers':{'Authorization':util[_0xc136('0x43')](_0xc136('0x44'),new Buffer(_0x359288)['toString'](_0xc136('0x45')))},'json':!![]};rp(_0x181f1d)[_0xc136('0x18')](function(_0x46c137){if(_0x46c137[_0xc136('0x46')]>=0xc8&&_0x46c137[_0xc136('0x46')]<=0xce){if(_0x46c137['data']&&_0x46c137[_0xc136('0x47')][_0xc136('0x48')]>0x0){var _0x89d1a0=_[_0xc136('0x49')](_0x46c137[_0xc136('0x47')][_0xc136('0x4a')]);var _0x323997={'messageId':_0x89d1a0[_0xc136('0x4b')]};if(!_0x155929[_0xc136('0x39')]){_0x323997[_0xc136('0x3a')]=!![];}return _0x31f7c3[_0xc136('0x3b')](_0x323997);}else{logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x4c'),util[_0xc136('0x28')](_0x46c137,{'showHidden':![],'depth':null}));}}else{logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x4c'),util['inspect'](_0x46c137,{'showHidden':![],'depth':null}));}})[_0xc136('0x3c')](function(_0x1c07a1){logger[_0xc136('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc136('0x4c'),util[_0xc136('0x28')](_0x1c07a1,{'showHidden':![],'depth':null}));});}else{logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),'clickSend',_0xc136('0x3d'));}break;case _0xc136('0x4d'):if(_0x155929[_0xc136('0x4e')]&&_0x155929[_0xc136('0x20')]){var _0x15e794={'dst':_0x2af561[_0xc136('0x1f')],'text':_0x2af561[_0xc136('0x21')],'src':_0x155929['senderString']||_0x155929[_0xc136('0x1f')],'url':_0x155929[_0xc136('0x22')]+_0xc136('0x23')+_0x2af561['id']+_0xc136('0x24')+_0x155929['token']};var _0x359288=util[_0xc136('0x43')](_0xc136('0x4f'),_0x155929['authId'],_0x155929[_0xc136('0x20')]);var _0x181f1d={'method':_0xc136('0x36'),'uri':util[_0xc136('0x43')](_0xc136('0x50'),_0x155929[_0xc136('0x4e')]),'body':_0x15e794,'headers':{'Authorization':util[_0xc136('0x43')](_0xc136('0x44'),new Buffer(_0x359288)[_0xc136('0x51')](_0xc136('0x45')))},'json':!![]};rp(_0x181f1d)['then'](function(_0x514a70){var _0x16f568={'messageId':_0x514a70[_0xc136('0x52')][0x0]};return _0x31f7c3[_0xc136('0x3b')](_0x16f568);})[_0xc136('0x3c')](function(_0x16f217){logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),'plivo',util['inspect'](_0x16f217,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc136('0x2a'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xc136('0x53'):if(_0x155929['username']&&_0x155929[_0xc136('0x2e')]){if(_0x155929[_0xc136('0x54')]){var _0x51a3e6={'method':_0xc136('0x36'),'uri':_0x155929[_0xc136('0x54')]+_0xc136('0x55'),'body':{'username':_0x155929['username'],'password':_0x155929['password']},'json':!![]};return rp(_0x51a3e6)[_0xc136('0x18')](function(_0x6b4e16){var _0x37cb21={'method':_0xc136('0x36'),'uri':_0x155929[_0xc136('0x54')]+_0xc136('0x56'),'body':{'messages':[{'from':_0x155929[_0xc136('0x1f')],'destinations':[{'to':_0x2af561[_0xc136('0x1f')]}],'text':_0x2af561[_0xc136('0x21')],'notifyUrl':_0x155929[_0xc136('0x22')]+_0xc136('0x23')+_0x2af561['id']+_0xc136('0x24')+_0x155929[_0xc136('0x25')],'notifyContentType':_0xc136('0x57'),'callbackData':_0x155929[_0xc136('0x1f')]+';'+_0x2af561[_0xc136('0x21')]}]},'headers':{'Authorization':_0xc136('0x58')+_0x6b4e16[_0xc136('0x25')]},'json':!![]};return rp(_0x37cb21)[_0xc136('0x18')](function(_0x421008){if(_0x421008[_0xc136('0x4a')]){var _0x4999a9={'messageId':_0x421008['messages'][0x0][_0xc136('0xd')]};if(!_0x155929[_0xc136('0x39')]){_0x4999a9[_0xc136('0x3a')]=!![];}return _0x31f7c3[_0xc136('0x3b')](_0x4999a9);}else{return logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x53'),util[_0xc136('0x28')](_0x421008,{'showHidden':![],'depth':null}));}});})[_0xc136('0x3c')](function(_0x46f576){return logger[_0xc136('0x27')](_0xc136('0x29'),'afterCreate',_0xc136('0x53'),util['inspect'](_0x46f576,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc136('0x29'),'afterCreate','infobip',_0xc136('0x59'));}}else{logger[_0xc136('0x27')](_0xc136('0x29'),'afterCreate',_0xc136('0x53'),_0xc136('0x3d'));}break;case _0xc136('0x5a'):var _0x3a49ca=require('crypto');if(_0x155929[_0xc136('0x5b')]){var _0x536175={};_0x536175['login']=_0x155929[_0xc136('0x32')];_0x536175[_0xc136('0x1f')]=_0x2af561[_0xc136('0x1f')];_0x536175[_0xc136('0x30')]=_0x155929['phone'];_0x536175['text']=_0x2af561[_0xc136('0x21')];_0x536175[_0xc136('0x5c')]=+new Date();var _0x2edec2='';var _0x28e7b5='';var _0xc33ae1=Object['keys'](_0x536175);_0xc33ae1[_0xc136('0x5d')]();for(var _0x42bb2e=0x0;_0x42bb2e<_0xc33ae1[_0xc136('0x5e')];_0x42bb2e++){if(_0x2edec2!=''){_0x2edec2+='&';}_0x2edec2+=_0xc33ae1[_0x42bb2e]+'='+encodeURIComponent(_0x536175[_0xc33ae1[_0x42bb2e]]);_0x28e7b5+=_0x536175[_0xc33ae1[_0x42bb2e]];}_0x28e7b5+=_0x155929['apiKey'];_0x28e7b5=_0x3a49ca[_0xc136('0x5f')]('md5')[_0xc136('0x3b')](_0x28e7b5)['digest'](_0xc136('0x60'));if(_0x2edec2!==''){_0x2edec2+='&';}_0x2edec2+=_0xc136('0x61')+_0x28e7b5;var _0xe3db05={'method':_0xc136('0x34'),'uri':_0x155929[_0xc136('0x54')]+_0xc136('0x62')+_0x2edec2,'json':!![]};return rp(_0xe3db05)[_0xc136('0x18')](function(_0x3ce848){var _0x2b68f0=Object[_0xc136('0x63')](_0x3ce848);if(_0x3ce848[_0x2b68f0[0x0]][_0xc136('0x27')]&&parseInt(_0x3ce848[_0x2b68f0[0x0]]['error'])===0x0){var _0x440606={'messageId':_0x3ce848[_0x2b68f0[0x0]][_0xc136('0x64')]};if(!_0x155929[_0xc136('0x39')]){_0x440606[_0xc136('0x3a')]=!![];}return _0x31f7c3[_0xc136('0x3b')](_0x440606);}else{return logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x5a'),util['inspect'](_0x3ce848[_0xc136('0x27')],{'showHidden':![],'depth':null}));}})[_0xc136('0x3c')](function(_0x1558ad){return logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),'csc',util['inspect'](_0x1558ad,{'showHidden':![],'depth':null}));});}else{logger[_0xc136('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc136('0x2a'),_0xc136('0x5a'),_0xc136('0x65'));}break;case'clickatell':if(_0x155929['apiKey']){var _0x53eabc={'method':_0xc136('0x36'),'uri':_0xc136('0x66'),'headers':{'Authorization':_0x155929[_0xc136('0x5b')]},'body':{'content':_0x2af561[_0xc136('0x21')],'to':[_0x2af561[_0xc136('0x1f')]],'from':_0x155929[_0xc136('0x1f')],'binary':![],'clientMessageId':_0xc136('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x53eabc)[_0xc136('0x18')](function(_0x1ed4b0){if(!_0x1ed4b0[_0xc136('0x27')]){var _0x1417d0={'messageId':_0x1ed4b0[_0xc136('0x4a')][0x0][_0xc136('0x68')]};if(!_0x155929[_0xc136('0x39')]){_0x1417d0[_0xc136('0x3a')]=!![];}return _0x31f7c3[_0xc136('0x3b')](_0x1417d0);}else{return logger[_0xc136('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xc136('0x69'),util[_0xc136('0x28')](_0x1ed4b0[_0xc136('0x27')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x555cc2){return logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x69'),util[_0xc136('0x28')](_0x555cc2,{'showHidden':![],'depth':null}));});}else{logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x69'),_0xc136('0x65'));}break;case'bandwidth':if(_0x155929[_0xc136('0x32')]&&_0x155929[_0xc136('0x2e')]){var _0x359288=util['format'](_0xc136('0x4f'),_0x155929['username'],_0x155929['password']);var _0x181f1d={'method':_0xc136('0x36'),'uri':_0xc136('0x6a')+_0x155929[_0xc136('0x6b')]+_0xc136('0x6c'),'body':{'to':[_0x2af561[_0xc136('0x1f')]],'text':_0x2af561[_0xc136('0x21')],'from':_0x155929[_0xc136('0x1f')],'applicationId':_0x155929[_0xc136('0x6d')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x359288)['toString'](_0xc136('0x45')))},'json':!![]};rp(_0x181f1d)[_0xc136('0x18')](function(_0x59d320){if(_0x59d320['id']){var _0x1ff6f4={'messageId':_0x59d320['id']};return _0x31f7c3['update'](_0x1ff6f4);}else{logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x6e'),util[_0xc136('0x28')](_0x59d320,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5ad8e3){logger[_0xc136('0x27')](_0xc136('0x29'),'afterCreate',_0xc136('0x6e'),util[_0xc136('0x28')](_0x5ad8e3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc136('0x29'),'afterCreate',_0xc136('0x6e'),_0xc136('0x3d'));}break;case _0xc136('0x6f'):if(_0x155929[_0xc136('0x5b')]){var _0x4b26ce={};var _0xe3db05={'method':_0xc136('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xc136('0x70')+_0x155929['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x155929['phone'],'to':_0x2af561['phone'],'text':_0x2af561[_0xc136('0x21')]},'json':!![]};return rp(_0xe3db05)[_0xc136('0x18')](function(_0x4e3067){if(_0x4e3067[_0xc136('0x71')]==0xca){_0x4b26ce[_0xc136('0x72')]=_0x4e3067;var _0x14fa34={'method':_0xc136('0x36'),'uri':_0xc136('0x73'),'headers':{'Authorization':_0xc136('0x70')+_0x155929[_0xc136('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x4b26ce[_0xc136('0x72')][_0xc136('0x74')]},'json':!![]};return rp(_0x14fa34)[_0xc136('0x18')](function(_0x259c4c){_0x4b26ce[_0xc136('0x75')]=_0x259c4c;var _0x28af1c={'messageId':_0x4b26ce[_0xc136('0x72')][_0xc136('0x74')],'read':!![]};return _0x31f7c3[_0xc136('0x3b')](_0x28af1c);});}else{return logger[_0xc136('0x27')](_0xc136('0x29'),_0xc136('0x2a'),_0xc136('0x6f'),util[_0xc136('0x28')](_0x4e3067,{'showHidden':![],'depth':null}));}})[_0xc136('0x3c')](function(_0xbce2a2){return logger[_0xc136('0x27')](_0xc136('0x29'),'afterCreate',_0xc136('0x6f'),util[_0xc136('0x28')](_0xbce2a2,{'showHidden':![],'depth':null}));});}else{return logger[_0xc136('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc136('0x2a'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xc136('0x76')](function(){_0x230e15();});}else{_0x230e15();}}},'charset':_0xc136('0x77'),'collate':_0xc136('0x78')});}; \ No newline at end of file +var _0xfbac=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','SmsMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','user_key','session_key','internal_order_id','deliveryReport','read','inspect','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','senderString','format','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','csc','crypto','login','text','timestamp','keys','sort','apiKey','createHash','md5','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','finally'];(function(_0xbbe2f3,_0x5ad0ef){var _0xf08a0b=function(_0x37a8ae){while(--_0x37a8ae){_0xbbe2f3['push'](_0xbbe2f3['shift']());}};_0xf08a0b(++_0x5ad0ef);}(_0xfbac,0x167));var _0xcfba=function(_0x2d9069,_0x3f26ef){_0x2d9069=_0x2d9069-0x0;var _0x65b981=_0xfbac[_0x2d9069];return _0x65b981;};'use strict';var _=require('lodash');var util=require(_0xcfba('0x0'));var logger=require(_0xcfba('0x1'))(_0xcfba('0x2'));var moment=require(_0xcfba('0x3'));var BPromise=require(_0xcfba('0x4'));var rp=require(_0xcfba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcfba('0x6'));var attributes=require(_0xcfba('0x7'));module['exports']=function(_0x4eec09,_0x3bb3af){return _0x4eec09['define'](_0xcfba('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xcfba('0x9'),'fields':[_0xcfba('0x9')]},{'name':'fti_sms_messages','fields':[_0xcfba('0xa')],'type':_0xcfba('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb47f0e,_0x460f01,_0x12d959){var _0x44af2e=_0x4eec09[_0xcfba('0xc')];var _0x4779bc=_0xb47f0e[_0xcfba('0xd')]({'plain':!![]});if(_0x4779bc[_0xcfba('0xe')][_0xcfba('0xf')]()==='in'||_0x4779bc[_0xcfba('0xe')]['toLowerCase']()==='out'&&!_0x4779bc[_0xcfba('0x10')]&&!_[_0xcfba('0x11')](_0x4779bc['UserId'])){_0x44af2e[_0xcfba('0x12')][_0xcfba('0x13')]({'where':{'id':_0x4779bc[_0xcfba('0x14')]}})[_0xcfba('0x15')](function(_0x2333ee){if(_0x2333ee){_0x2333ee[_0xcfba('0x16')]({'lastMsgAt':_0x4779bc[_0xcfba('0x17')],'lastMsgDirection':_0x4779bc[_0xcfba('0xe')][_0xcfba('0xf')]()});}})[_0xcfba('0x18')](function(_0x231192){console[_0xcfba('0x19')](_0x231192);});}if(_0x4779bc[_0xcfba('0xe')]==='out'&&!_0x4779bc[_0xcfba('0x10')]){var _0x1d7be2;_0x44af2e[_0xcfba('0x1a')][_0xcfba('0x1b')]({'where':{'id':_0x4779bc[_0xcfba('0x1c')]},'raw':!![]})[_0xcfba('0x15')](function(_0x112955){_0x1d7be2=_0x112955;if(_0x1d7be2&&_0x1d7be2['type']){switch(_0x1d7be2[_0xcfba('0x1d')]){case _0xcfba('0x1e'):var _0x35cec9=require('twilio');if(_0x1d7be2['accountSid']&&_0x1d7be2[_0xcfba('0x1f')]&&_0x1d7be2[_0xcfba('0x20')]){var _0x40a0df=new _0x35cec9(_0x1d7be2[_0xcfba('0x21')],_0x1d7be2[_0xcfba('0x1f')]);_0x40a0df[_0xcfba('0x22')]['create']({'body':_0x4779bc[_0xcfba('0xa')],'to':_0x4779bc['phone'],'from':_0x1d7be2[_0xcfba('0x20')],'statusCallback':_0x1d7be2[_0xcfba('0x23')]+'/api/sms/messages/'+_0x4779bc['id']+_0xcfba('0x24')+_0x1d7be2[_0xcfba('0x25')]})[_0xcfba('0x15')](function(_0x3fb061){if(_0x3fb061['sid']){return _0xb47f0e['update']({'messageId':_0x3fb061[_0xcfba('0x26')]});}})[_0xcfba('0x18')](function(_0x200a77){logger['error'](_0xcfba('0x27'),'afterCreate',_0xcfba('0x1e'),util['inspect'](_0x200a77,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),'twilio',_0xcfba('0x29'));}break;case _0xcfba('0x2a'):var _0x69bb2f=_0xcfba('0x2b');if(_0x1d7be2[_0xcfba('0x2c')]&&_0x1d7be2[_0xcfba('0x2d')]){var _0x2ee85c={'recipient':[_0x4779bc[_0xcfba('0x20')]],'message':_0x4779bc['body'],'message_type':_0x1d7be2[_0xcfba('0x2e')]};if(_0x1d7be2['smsMethod']&&_0x1d7be2['smsMethod']!=='SI'){_0x2ee85c[_0xcfba('0x2f')]=_0x1d7be2['phone'];}var _0x4ee341={'url':_0x69bb2f+'login?username='+_0x1d7be2[_0xcfba('0x2c')]+_0xcfba('0x30')+_0x1d7be2[_0xcfba('0x2d')],'method':_0xcfba('0x31')};rp(_0x4ee341)[_0xcfba('0x15')](function(_0x1aaf34){var _0x1a0a80=_0x1aaf34[_0xcfba('0x32')](';');var _0x5b0db9={'user_key':_0x1a0a80[0x0],'session_key':_0x1a0a80[0x1]};_0x4ee341={'url':_0x69bb2f+'sms','method':'POST','headers':{'user_key':_0x5b0db9[_0xcfba('0x33')],'Session_key':_0x5b0db9[_0xcfba('0x34')]},'json':!![],'body':_0x2ee85c};return rp(_0x4ee341);})['then'](function(_0x34f60b){if(_0x34f60b['total_sent']>=0x1){var _0x3a3366={'messageId':_0x34f60b[_0xcfba('0x35')]};if(_0x1d7be2[_0xcfba('0x2e')]!=='GP'||!_0x1d7be2[_0xcfba('0x36')]){_0x3a3366[_0xcfba('0x37')]=!![];}return _0xb47f0e[_0xcfba('0x16')](_0x3a3366);}else{return logger[_0xcfba('0x19')](_0xcfba('0x27'),'afterCreate',_0xcfba('0x2a'),util[_0xcfba('0x38')](_0x34f60b,{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x3abf9d){return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),'skebby',util[_0xcfba('0x38')](_0x3abf9d,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x2a'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x1d7be2[_0xcfba('0x1f')]){var _0x5d970f={'recipient':_0x4779bc[_0xcfba('0x20')],'message':_0x4779bc[_0xcfba('0xa')],'sender':_0x1d7be2['senderString']||_0x1d7be2[_0xcfba('0x20')],'authorization':_0x1d7be2[_0xcfba('0x1f')]};var _0x460f01={'method':'POST','uri':_0xcfba('0x39'),'body':_0x5d970f,'json':!![]};rp(_0x460f01)[_0xcfba('0x15')](function(_0x335f28){var _0x39f058={'messageId':_0x335f28[_0xcfba('0x3a')]};if(!_0x1d7be2[_0xcfba('0x36')]){_0x39f058[_0xcfba('0x37')]=!![];}return _0xb47f0e['update'](_0x39f058);})[_0xcfba('0x18')](function(_0x43c206){logger['error'](_0xcfba('0x27'),'afterCreate',_0xcfba('0x3b'),util['inspect'](_0x43c206,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x3b'),_0xcfba('0x3c'));}break;case _0xcfba('0x3d'):if(_0x1d7be2['username']&&_0x1d7be2[_0xcfba('0x2d')]){var _0x5d970f={'messages':[{'source':'xCALLY\x20Motion','to':_0x4779bc[_0xcfba('0x20')],'body':_0x4779bc[_0xcfba('0xa')],'from':_0x1d7be2[_0xcfba('0x3e')]||_0x1d7be2[_0xcfba('0x20')]}]};var _0x18d77f=util[_0xcfba('0x3f')]('%s:%s',_0x1d7be2['username'],_0x1d7be2['password']);var _0x460f01={'method':_0xcfba('0x40'),'uri':_0xcfba('0x41'),'body':_0x5d970f,'headers':{'Authorization':util[_0xcfba('0x3f')](_0xcfba('0x42'),new Buffer(_0x18d77f)[_0xcfba('0x43')](_0xcfba('0x44')))},'json':!![]};rp(_0x460f01)[_0xcfba('0x15')](function(_0x813013){if(_0x813013['http_code']>=0xc8&&_0x813013[_0xcfba('0x45')]<=0xce){if(_0x813013[_0xcfba('0x46')]&&_0x813013[_0xcfba('0x46')][_0xcfba('0x47')]>0x0){var _0x36ba07=_[_0xcfba('0x48')](_0x813013[_0xcfba('0x46')]['messages']);var _0x1c2f9b={'messageId':_0x36ba07[_0xcfba('0x49')]};if(!_0x1d7be2[_0xcfba('0x36')]){_0x1c2f9b[_0xcfba('0x37')]=!![];}return _0xb47f0e['update'](_0x1c2f9b);}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x4a'),util[_0xcfba('0x38')](_0x813013,{'showHidden':![],'depth':null}));}}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),'afterCreate','clickSend',util[_0xcfba('0x38')](_0x813013,{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x3a5b52){logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),'clickSend',util['inspect'](_0x3a5b52,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfba('0x27'),'afterCreate',_0xcfba('0x4a'),_0xcfba('0x4b'));}break;case _0xcfba('0x4c'):if(_0x1d7be2[_0xcfba('0x4d')]&&_0x1d7be2['authToken']){var _0x5d970f={'dst':_0x4779bc[_0xcfba('0x20')],'text':_0x4779bc[_0xcfba('0xa')],'src':_0x1d7be2[_0xcfba('0x3e')]||_0x1d7be2[_0xcfba('0x20')],'url':_0x1d7be2[_0xcfba('0x23')]+_0xcfba('0x4e')+_0x4779bc['id']+_0xcfba('0x24')+_0x1d7be2[_0xcfba('0x25')]};var _0x18d77f=util['format'](_0xcfba('0x4f'),_0x1d7be2[_0xcfba('0x4d')],_0x1d7be2[_0xcfba('0x1f')]);var _0x460f01={'method':_0xcfba('0x40'),'uri':util[_0xcfba('0x3f')](_0xcfba('0x50'),_0x1d7be2[_0xcfba('0x4d')]),'body':_0x5d970f,'headers':{'Authorization':util[_0xcfba('0x3f')](_0xcfba('0x42'),new Buffer(_0x18d77f)[_0xcfba('0x43')](_0xcfba('0x44')))},'json':!![]};rp(_0x460f01)[_0xcfba('0x15')](function(_0xbf1c0a){var _0x5f36ac={'messageId':_0xbf1c0a['message_uuid'][0x0]};return _0xb47f0e[_0xcfba('0x16')](_0x5f36ac);})[_0xcfba('0x18')](function(_0x28cd32){logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x4c'),util[_0xcfba('0x38')](_0x28cd32,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xcfba('0x51'):if(_0x1d7be2[_0xcfba('0x2c')]&&_0x1d7be2[_0xcfba('0x2d')]){if(_0x1d7be2[_0xcfba('0x52')]){var _0x542f71={'method':'POST','uri':_0x1d7be2[_0xcfba('0x52')]+_0xcfba('0x53'),'body':{'username':_0x1d7be2['username'],'password':_0x1d7be2['password']},'json':!![]};return rp(_0x542f71)[_0xcfba('0x15')](function(_0x4cf3ef){var _0x3e9cf7={'method':_0xcfba('0x40'),'uri':_0x1d7be2[_0xcfba('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1d7be2[_0xcfba('0x20')],'destinations':[{'to':_0x4779bc[_0xcfba('0x20')]}],'text':_0x4779bc[_0xcfba('0xa')],'notifyUrl':_0x1d7be2[_0xcfba('0x23')]+'/api/sms/messages/'+_0x4779bc['id']+_0xcfba('0x24')+_0x1d7be2[_0xcfba('0x25')],'notifyContentType':_0xcfba('0x54'),'callbackData':_0x1d7be2[_0xcfba('0x20')]+';'+_0x4779bc[_0xcfba('0xa')]}]},'headers':{'Authorization':_0xcfba('0x55')+_0x4cf3ef['token']},'json':!![]};return rp(_0x3e9cf7)[_0xcfba('0x15')](function(_0x331691){if(_0x331691[_0xcfba('0x22')]){var _0x48c81a={'messageId':_0x331691[_0xcfba('0x22')][0x0]['messageId']};if(!_0x1d7be2[_0xcfba('0x36')]){_0x48c81a[_0xcfba('0x37')]=!![];}return _0xb47f0e[_0xcfba('0x16')](_0x48c81a);}else{return logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x51'),util[_0xcfba('0x38')](_0x331691,{'showHidden':![],'depth':null}));}});})[_0xcfba('0x18')](function(_0x57fb01){return logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x51'),util[_0xcfba('0x38')](_0x57fb01,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),'afterCreate',_0xcfba('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xcfba('0x56'):var _0x5f5150=require(_0xcfba('0x57'));if(_0x1d7be2['apiKey']){var _0x453312={};_0x453312[_0xcfba('0x58')]=_0x1d7be2['username'];_0x453312['phone']=_0x4779bc[_0xcfba('0x20')];_0x453312[_0xcfba('0x2f')]=_0x1d7be2['phone'];_0x453312[_0xcfba('0x59')]=_0x4779bc[_0xcfba('0xa')];_0x453312[_0xcfba('0x5a')]=+new Date();var _0x385df0='';var _0xa554d0='';var _0x53c8f0=Object[_0xcfba('0x5b')](_0x453312);_0x53c8f0[_0xcfba('0x5c')]();for(var _0x587fe1=0x0;_0x587fe1<_0x53c8f0['length'];_0x587fe1++){if(_0x385df0!=''){_0x385df0+='&';}_0x385df0+=_0x53c8f0[_0x587fe1]+'='+encodeURIComponent(_0x453312[_0x53c8f0[_0x587fe1]]);_0xa554d0+=_0x453312[_0x53c8f0[_0x587fe1]];}_0xa554d0+=_0x1d7be2[_0xcfba('0x5d')];_0xa554d0=_0x5f5150[_0xcfba('0x5e')](_0xcfba('0x5f'))[_0xcfba('0x16')](_0xa554d0)['digest']('hex');if(_0x385df0!==''){_0x385df0+='&';}_0x385df0+='signature='+_0xa554d0;var _0x4ee341={'method':_0xcfba('0x31'),'uri':_0x1d7be2[_0xcfba('0x52')]+_0xcfba('0x60')+_0x385df0,'json':!![]};return rp(_0x4ee341)[_0xcfba('0x15')](function(_0x407012){var _0x4257c0=Object[_0xcfba('0x5b')](_0x407012);if(_0x407012[_0x4257c0[0x0]][_0xcfba('0x19')]&&parseInt(_0x407012[_0x4257c0[0x0]]['error'])===0x0){var _0xbfad3e={'messageId':_0x407012[_0x4257c0[0x0]][_0xcfba('0x61')]};if(!_0x1d7be2[_0xcfba('0x36')]){_0xbfad3e[_0xcfba('0x37')]=!![];}return _0xb47f0e[_0xcfba('0x16')](_0xbfad3e);}else{return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x56'),util[_0xcfba('0x38')](_0x407012['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x182d7d){return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x56'),util[_0xcfba('0x38')](_0x182d7d,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x56'),_0xcfba('0x62'));}break;case _0xcfba('0x63'):if(_0x1d7be2[_0xcfba('0x5d')]){var _0x59e6f9={'method':_0xcfba('0x40'),'uri':_0xcfba('0x64'),'headers':{'Authorization':_0x1d7be2[_0xcfba('0x5d')]},'body':{'content':_0x4779bc[_0xcfba('0xa')],'to':[_0x4779bc['phone']],'from':_0x1d7be2[_0xcfba('0x20')],'binary':![],'clientMessageId':_0xcfba('0x65'),'charset':_0xcfba('0x66')},'json':!![]};rp(_0x59e6f9)[_0xcfba('0x15')](function(_0x274650){if(!_0x274650['error']){var _0x152db6={'messageId':_0x274650[_0xcfba('0x22')][0x0][_0xcfba('0x67')]};if(!_0x1d7be2[_0xcfba('0x36')]){_0x152db6[_0xcfba('0x37')]=!![];}return _0xb47f0e[_0xcfba('0x16')](_0x152db6);}else{return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x63'),util[_0xcfba('0x38')](_0x274650['error'],{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x51c5d9){return logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x63'),util[_0xcfba('0x38')](_0x51c5d9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x63'),_0xcfba('0x62'));}break;case _0xcfba('0x68'):if(_0x1d7be2[_0xcfba('0x2c')]&&_0x1d7be2[_0xcfba('0x2d')]){var _0x18d77f=util[_0xcfba('0x3f')](_0xcfba('0x4f'),_0x1d7be2[_0xcfba('0x2c')],_0x1d7be2[_0xcfba('0x2d')]);var _0x460f01={'method':_0xcfba('0x40'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1d7be2[_0xcfba('0x69')]+_0xcfba('0x6a'),'body':{'to':[_0x4779bc[_0xcfba('0x20')]],'text':_0x4779bc[_0xcfba('0xa')],'from':_0x1d7be2[_0xcfba('0x20')],'applicationId':_0x1d7be2[_0xcfba('0x6b')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x18d77f)[_0xcfba('0x43')](_0xcfba('0x44')))},'json':!![]};rp(_0x460f01)[_0xcfba('0x15')](function(_0x312234){if(_0x312234['id']){var _0xc06ab3={'messageId':_0x312234['id']};return _0xb47f0e['update'](_0xc06ab3);}else{logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x68'),util['inspect'](_0x312234,{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x58c4c5){logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x68'),util[_0xcfba('0x38')](_0x58c4c5,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x68'),_0xcfba('0x4b'));}break;case _0xcfba('0x6c'):if(_0x1d7be2[_0xcfba('0x5d')]){var _0x24f36e={};var _0x4ee341={'method':'POST','uri':_0xcfba('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x1d7be2[_0xcfba('0x5d')],'Content-Type':_0xcfba('0x54')},'body':{'from':_0x1d7be2[_0xcfba('0x20')],'to':_0x4779bc[_0xcfba('0x20')],'text':_0x4779bc[_0xcfba('0xa')]},'json':!![]};return rp(_0x4ee341)[_0xcfba('0x15')](function(_0x8233f1){if(_0x8233f1['code']==0xca){_0x24f36e[_0xcfba('0x6e')]=_0x8233f1;var _0x5f3b89={'method':_0xcfba('0x40'),'uri':_0xcfba('0x6f'),'headers':{'Authorization':_0xcfba('0x70')+_0x1d7be2[_0xcfba('0x5d')],'Content-Type':_0xcfba('0x54')},'body':{'refid':_0x24f36e[_0xcfba('0x6e')][_0xcfba('0x71')]},'json':!![]};return rp(_0x5f3b89)[_0xcfba('0x15')](function(_0x204b61){_0x24f36e[_0xcfba('0x72')]=_0x204b61;var _0x1d7df9={'messageId':_0x24f36e['message']['refid'],'read':!![]};return _0xb47f0e[_0xcfba('0x16')](_0x1d7df9);});}else{return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x6c'),util[_0xcfba('0x38')](_0x8233f1,{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x4c9770){return logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xcfba('0x6c'),util['inspect'](_0x4c9770,{'showHidden':![],'depth':null}));});}else{return logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),'intelepeer',_0xcfba('0x73'));}break;}}})[_0xcfba('0x74')](function(){_0x12d959();});}else{_0x12d959();}}},'charset':_0xcfba('0x75'),'collate':_0xcfba('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 60b71e9..0ff24d7 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 _0xf9c3=['CreateSmsMessage','SmsMessage','create','body','options','raw','then','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x9db5b9,_0x4e331d){var _0x54ee93=function(_0x27af5f){while(--_0x27af5f){_0x9db5b9['push'](_0x9db5b9['shift']());}};_0x54ee93(++_0x4e331d);}(_0xf9c3,0xd5));var _0x3f9c=function(_0x2a5f37,_0x34adf4){_0x2a5f37=_0x2a5f37-0x0;var _0x37789a=_0xf9c3[_0x2a5f37];return _0x37789a;};'use strict';var _=require(_0x3f9c('0x0'));var util=require(_0x3f9c('0x1'));var moment=require(_0x3f9c('0x2'));var BPromise=require(_0x3f9c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f9c('0x4'));var db=require(_0x3f9c('0x5'))['db'];var utils=require(_0x3f9c('0x6'));var logger=require(_0x3f9c('0x7'))('rpc');var config=require(_0x3f9c('0x8'));var jayson=require(_0x3f9c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x3f9c('0xa')]=_[_0x3f9c('0xb')](config[_0x3f9c('0xa')],{'host':_0x3f9c('0xc'),'port':0x18eb});var socket=require(_0x3f9c('0xd'))(new Redis(config['redis']));require(_0x3f9c('0xe'))[_0x3f9c('0xf')](socket);function respondWithRpcPromise(_0x4239d3,_0xc97907,_0x38e42){return new BPromise(function(_0x325dad,_0xfa8b6f){return client[_0x3f9c('0x10')](_0x4239d3,_0x38e42)['then'](function(_0x2f1009){logger[_0x3f9c('0x11')]('SmsMessage,\x20%s,\x20%s',_0xc97907,_0x3f9c('0x12'));logger['debug'](_0x3f9c('0x13'),_0xc97907,_0x3f9c('0x12'),JSON['stringify'](_0x2f1009));if(_0x2f1009[_0x3f9c('0x14')]){if(_0x2f1009[_0x3f9c('0x14')]['code']===0x1f4){logger[_0x3f9c('0x14')](_0x3f9c('0x15'),_0xc97907,_0x2f1009['error'][_0x3f9c('0x16')]);return _0xfa8b6f(_0x2f1009[_0x3f9c('0x14')][_0x3f9c('0x16')]);}logger[_0x3f9c('0x14')]('SmsMessage,\x20%s,\x20%s',_0xc97907,_0x2f1009[_0x3f9c('0x14')][_0x3f9c('0x16')]);return _0x325dad(_0x2f1009['error']['message']);}else{logger[_0x3f9c('0x11')]('SmsMessage,\x20%s,\x20%s',_0xc97907,'request\x20sent');_0x325dad(_0x2f1009[_0x3f9c('0x17')][_0x3f9c('0x16')]);}})[_0x3f9c('0x18')](function(_0x500de1){logger['error']('SmsMessage,\x20%s,\x20%s',_0xc97907,_0x500de1);_0xfa8b6f(_0x500de1);});});}exports[_0x3f9c('0x19')]=function(_0x7385fd){var _0x20f298=this;return new Promise(function(_0x557110,_0x49d438){return db[_0x3f9c('0x1a')][_0x3f9c('0x1b')](_0x7385fd[_0x3f9c('0x1c')],{'raw':_0x7385fd[_0x3f9c('0x1d')]?_0x7385fd['options'][_0x3f9c('0x1e')]===undefined?!![]:![]:!![]})[_0x3f9c('0x1f')](function(_0x32b1be){logger[_0x3f9c('0x11')](_0x3f9c('0x19'),_0x7385fd);logger[_0x3f9c('0x20')](_0x3f9c('0x19'),_0x7385fd,JSON[_0x3f9c('0x21')](_0x32b1be));_0x557110(_0x32b1be);})[_0x3f9c('0x18')](function(_0x14c6ec){logger[_0x3f9c('0x14')](_0x3f9c('0x19'),_0x14c6ec[_0x3f9c('0x16')],_0x7385fd);_0x49d438(_0x20f298[_0x3f9c('0x14')](0x1f4,_0x14c6ec[_0x3f9c('0x16')]));});});}; \ No newline at end of file +var _0x1ac3=['body','options','raw','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','CreateSmsMessage','SmsMessage','create'];(function(_0xc68434,_0x619fd7){var _0x5d9f75=function(_0x3811c1){while(--_0x3811c1){_0xc68434['push'](_0xc68434['shift']());}};_0x5d9f75(++_0x619fd7);}(_0x1ac3,0xd1));var _0x31ac=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1ac3[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x31ac('0x0'));var util=require(_0x31ac('0x1'));var moment=require('moment');var BPromise=require(_0x31ac('0x2'));var rs=require(_0x31ac('0x3'));var fs=require('fs');var Redis=require(_0x31ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x31ac('0x5'))(_0x31ac('0x6'));var config=require(_0x31ac('0x7'));var jayson=require(_0x31ac('0x8'));var client=jayson[_0x31ac('0x9')][_0x31ac('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x31ac('0xb')],{'host':_0x31ac('0xc'),'port':0x18eb});var socket=require(_0x31ac('0xd'))(new Redis(config[_0x31ac('0xb')]));require(_0x31ac('0xe'))['register'](socket);function respondWithRpcPromise(_0x27cd4f,_0x5e4726,_0x58d9ce){return new BPromise(function(_0x3f6b4e,_0x306316){return client[_0x31ac('0xf')](_0x27cd4f,_0x58d9ce)['then'](function(_0xa0da75){logger['info'](_0x31ac('0x10'),_0x5e4726,'request\x20sent');logger[_0x31ac('0x11')](_0x31ac('0x12'),_0x5e4726,'request\x20sent',JSON['stringify'](_0xa0da75));if(_0xa0da75[_0x31ac('0x13')]){if(_0xa0da75[_0x31ac('0x13')][_0x31ac('0x14')]===0x1f4){logger[_0x31ac('0x13')]('SmsMessage,\x20%s,\x20%s',_0x5e4726,_0xa0da75[_0x31ac('0x13')][_0x31ac('0x15')]);return _0x306316(_0xa0da75[_0x31ac('0x13')][_0x31ac('0x15')]);}logger[_0x31ac('0x13')]('SmsMessage,\x20%s,\x20%s',_0x5e4726,_0xa0da75[_0x31ac('0x13')][_0x31ac('0x15')]);return _0x3f6b4e(_0xa0da75[_0x31ac('0x13')][_0x31ac('0x15')]);}else{logger[_0x31ac('0x16')](_0x31ac('0x10'),_0x5e4726,_0x31ac('0x17'));_0x3f6b4e(_0xa0da75[_0x31ac('0x18')][_0x31ac('0x15')]);}})[_0x31ac('0x19')](function(_0x470a2d){logger[_0x31ac('0x13')]('SmsMessage,\x20%s,\x20%s',_0x5e4726,_0x470a2d);_0x306316(_0x470a2d);});});}exports[_0x31ac('0x1a')]=function(_0x1d60ea){var _0x54aec4=this;return new Promise(function(_0x59d643,_0xe6aaa2){return db[_0x31ac('0x1b')][_0x31ac('0x1c')](_0x1d60ea[_0x31ac('0x1d')],{'raw':_0x1d60ea[_0x31ac('0x1e')]?_0x1d60ea['options'][_0x31ac('0x1f')]===undefined?!![]:![]:!![]})[_0x31ac('0x20')](function(_0x2ebb68){logger[_0x31ac('0x16')](_0x31ac('0x1a'),_0x1d60ea);logger['debug'](_0x31ac('0x1a'),_0x1d60ea,JSON[_0x31ac('0x21')](_0x2ebb68));_0x59d643(_0x2ebb68);})[_0x31ac('0x19')](function(_0x154129){logger['error']('CreateSmsMessage',_0x154129['message'],_0x1d60ea);_0xe6aaa2(_0x54aec4['error'](0x1f4,_0x154129[_0x31ac('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a9be189..3912564 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 _0x81fc=['./smsMessage.events','save','update','emit','register','length','smsMessage:'];(function(_0x3fcf30,_0xe3a49e){var _0x2ed4b0=function(_0x306e68){while(--_0x306e68){_0x3fcf30['push'](_0x3fcf30['shift']());}};_0x2ed4b0(++_0xe3a49e);}(_0x81fc,0xbd));var _0xc81f=function(_0x5983f9,_0x5f3cab){_0x5983f9=_0x5983f9-0x0;var _0x331ace=_0x81fc[_0x5983f9];return _0x331ace;};'use strict';var SmsMessageEvents=require(_0xc81f('0x0'));var events=[_0xc81f('0x1'),'remove',_0xc81f('0x2')];function createListener(_0x516ed3,_0x5b5041){return function(_0x1fdb21){_0x5b5041[_0xc81f('0x3')](_0x516ed3,_0x1fdb21);};}function removeListener(_0x308199,_0x1ef2e3){return function(){SmsMessageEvents['removeListener'](_0x308199,_0x1ef2e3);};}exports[_0xc81f('0x4')]=function(_0x191b16){for(var _0x31272a=0x0,_0x56d504=events[_0xc81f('0x5')];_0x31272a<_0x56d504;_0x31272a++){var _0x41e52b=events[_0x31272a];var _0x3fc591=createListener(_0xc81f('0x6')+_0x41e52b,_0x191b16);SmsMessageEvents['on'](_0x41e52b,_0x3fc591);}}; \ No newline at end of file +var _0x1485=['save','remove','update','emit','removeListener','./smsMessage.events'];(function(_0x8eb7f9,_0x4b6566){var _0x336ce2=function(_0x1762b3){while(--_0x1762b3){_0x8eb7f9['push'](_0x8eb7f9['shift']());}};_0x336ce2(++_0x4b6566);}(_0x1485,0x155));var _0x5148=function(_0x27c178,_0x2f2ea4){_0x27c178=_0x27c178-0x0;var _0x26c240=_0x1485[_0x27c178];return _0x26c240;};'use strict';var SmsMessageEvents=require(_0x5148('0x0'));var events=[_0x5148('0x1'),_0x5148('0x2'),_0x5148('0x3')];function createListener(_0x5236f0,_0x4288f4){return function(_0x4b7eb0){_0x4288f4[_0x5148('0x4')](_0x5236f0,_0x4b7eb0);};}function removeListener(_0x3ecc10,_0x195a83){return function(){SmsMessageEvents[_0x5148('0x5')](_0x3ecc10,_0x195a83);};}exports['register']=function(_0x24d67a){for(var _0x791f24=0x0,_0x2b81bd=events['length'];_0x791f24<_0x2b81bd;_0x791f24++){var _0x5253ac=events[_0x791f24];var _0x50acb6=createListener('smsMessage:'+_0x5253ac,_0x24d67a);SmsMessageEvents['on'](_0x5253ac,_0x50acb6);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 3940a3b..df2a243 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 _0x310e=['delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','addAgents','update'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x310e,0x1ea));var _0xe310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x310e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe310('0x0'));var util=require(_0xe310('0x1'));var path=require('path');var timeout=require(_0xe310('0x2'));var express=require(_0xe310('0x3'));var router=express[_0xe310('0x4')]();var fs_extra=require(_0xe310('0x5'));var auth=require(_0xe310('0x6'));var interaction=require(_0xe310('0x7'));var config=require(_0xe310('0x8'));var controller=require(_0xe310('0x9'));router[_0xe310('0xa')]('/',auth[_0xe310('0xb')](),controller['index']);router['get'](_0xe310('0xc'),auth[_0xe310('0xb')](),controller[_0xe310('0xd')]);router[_0xe310('0xa')](_0xe310('0xe'),auth[_0xe310('0xb')](),controller[_0xe310('0xf')]);router['get'](_0xe310('0x10'),auth[_0xe310('0xb')](),controller['getMembers']);router[_0xe310('0xa')](_0xe310('0x11'),auth[_0xe310('0xb')](),controller['getTeams']);router[_0xe310('0xa')](_0xe310('0x12'),auth[_0xe310('0xb')](),controller[_0xe310('0x13')]);router[_0xe310('0x14')]('/',auth[_0xe310('0xb')](),controller['create']);router[_0xe310('0x14')]('/:id/teams',auth[_0xe310('0xb')](),controller['addTeams']);router['post']('/:id/users',auth[_0xe310('0xb')](),controller[_0xe310('0x15')]);router['put'](_0xe310('0xe'),auth[_0xe310('0xb')](),controller[_0xe310('0x16')]);router[_0xe310('0x17')](_0xe310('0xe'),auth[_0xe310('0xb')](),controller[_0xe310('0x18')]);router[_0xe310('0x17')](_0xe310('0x11'),auth[_0xe310('0xb')](),controller[_0xe310('0x19')]);router[_0xe310('0x17')](_0xe310('0x12'),auth[_0xe310('0xb')](),controller['removeAgents']);module[_0xe310('0x1a')]=router; \ No newline at end of file +var _0x7f57=['isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get'];(function(_0x32d824,_0x5a0ac5){var _0x2e88e5=function(_0x418ed0){while(--_0x418ed0){_0x32d824['push'](_0x32d824['shift']());}};_0x2e88e5(++_0x5a0ac5);}(_0x7f57,0xc8));var _0x77f5=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x7f57[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x77f5('0x0'));var util=require(_0x77f5('0x1'));var path=require(_0x77f5('0x2'));var timeout=require(_0x77f5('0x3'));var express=require(_0x77f5('0x4'));var router=express['Router']();var fs_extra=require(_0x77f5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77f5('0x6'));var config=require(_0x77f5('0x7'));var controller=require(_0x77f5('0x8'));router[_0x77f5('0x9')]('/',auth[_0x77f5('0xa')](),controller[_0x77f5('0xb')]);router[_0x77f5('0x9')](_0x77f5('0xc'),auth['isAuthenticated'](),controller[_0x77f5('0xd')]);router['get'](_0x77f5('0xe'),auth['isAuthenticated'](),controller[_0x77f5('0xf')]);router[_0x77f5('0x9')](_0x77f5('0x10'),auth[_0x77f5('0xa')](),controller[_0x77f5('0x11')]);router[_0x77f5('0x9')](_0x77f5('0x12'),auth[_0x77f5('0xa')](),controller['getTeams']);router[_0x77f5('0x9')](_0x77f5('0x13'),auth[_0x77f5('0xa')](),controller[_0x77f5('0x14')]);router['post']('/',auth[_0x77f5('0xa')](),controller[_0x77f5('0x15')]);router[_0x77f5('0x16')](_0x77f5('0x12'),auth[_0x77f5('0xa')](),controller[_0x77f5('0x17')]);router[_0x77f5('0x16')](_0x77f5('0x13'),auth[_0x77f5('0xa')](),controller[_0x77f5('0x18')]);router[_0x77f5('0x19')]('/:id',auth[_0x77f5('0xa')](),controller[_0x77f5('0x1a')]);router[_0x77f5('0x1b')]('/:id',auth[_0x77f5('0xa')](),controller[_0x77f5('0x1c')]);router['delete'](_0x77f5('0x12'),auth[_0x77f5('0xa')](),controller[_0x77f5('0x1d')]);router[_0x77f5('0x1b')]('/:id/users',auth[_0x77f5('0xa')](),controller['removeAgents']);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 7f749b7..064f964 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 _0x91ef=['ENUM','rrmemory','beepall','STRING','INTEGER'];(function(_0x150e35,_0x21ec3b){var _0x1198f1=function(_0x3cb8c7){while(--_0x3cb8c7){_0x150e35['push'](_0x150e35['shift']());}};_0x1198f1(++_0x21ec3b);}(_0x91ef,0x80));var _0xf91e=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x91ef[_0x12f688];return _0x59c3de;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf91e('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf91e('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf91e('0x2')](_0xf91e('0x3'),_0xf91e('0x4'),'roundrobin')}}; \ No newline at end of file +var _0xc17e=['sequelize','exports','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x24ace2,_0x33c072){var _0x8cad81=function(_0x2377b7){while(--_0x2377b7){_0x24ace2['push'](_0x24ace2['shift']());}};_0x8cad81(++_0x33c072);}(_0xc17e,0xc4));var _0xec17=function(_0x4ba811,_0x4428f2){_0x4ba811=_0x4ba811-0x0;var _0x3b616f=_0xc17e[_0x4ba811];return _0x3b616f;};'use strict';var Sequelize=require(_0xec17('0x0'));module[_0xec17('0x1')]={'name':{'type':Sequelize[_0xec17('0x2')],'unique':_0xec17('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xec17('0x2')]},'timeout':{'type':Sequelize[_0xec17('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xec17('0x5')]('rrmemory','beepall',_0xec17('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e588660..14e6c6a 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 _0x0273=['sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','name','send','map','SmsQueue','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','describe','getMembers','findOne','UserSmsQueue','pick','User','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','transaction','findOrCreate','emit','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_sms_queues','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?'];(function(_0x4ae379,_0x21db70){var _0x2d54c1=function(_0x19ba61){while(--_0x19ba61){_0x4ae379['push'](_0x4ae379['shift']());}};_0x2d54c1(++_0x21db70);}(_0x0273,0x1af));var _0x3027=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0273[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3027('0x0'));var zipdir=require(_0x3027('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3027('0x2'));var moment=require(_0x3027('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3027('0x4'));var util=require(_0x3027('0x5'));var path=require(_0x3027('0x6'));var sox=require('sox');var csv=require(_0x3027('0x7'));var ejs=require(_0x3027('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3027('0x9'));var crypto=require(_0x3027('0xa'));var jsforce=require(_0x3027('0xb'));var deskjs=require(_0x3027('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3027('0xd'));var Papa=require(_0x3027('0xe'));var Redis=require(_0x3027('0xf'));var authService=require(_0x3027('0x10'));var qs=require(_0x3027('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3027('0x12'));var logger=require(_0x3027('0x13'))(_0x3027('0x14'));var utils=require(_0x3027('0x15'));var config=require(_0x3027('0x16'));var licenseUtil=require(_0x3027('0x17'));var db=require(_0x3027('0x18'))['db'];config[_0x3027('0x19')]=_[_0x3027('0x1a')](config['redis'],{'host':_0x3027('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3027('0x19')]));require(_0x3027('0x1c'))[_0x3027('0x1d')](socket);function respondWithStatusCode(_0x169ae6,_0x572fe7){_0x572fe7=_0x572fe7||0xcc;return function(_0xf22d34){if(_0xf22d34){return _0x169ae6[_0x3027('0x1e')](_0x572fe7);}return _0x169ae6['status'](_0x572fe7)[_0x3027('0x1f')]();};}function respondWithResult(_0x228aeb,_0x4c264f){_0x4c264f=_0x4c264f||0xc8;return function(_0x4db0b8){if(_0x4db0b8){return _0x228aeb[_0x3027('0x20')](_0x4c264f)[_0x3027('0x21')](_0x4db0b8);}};}function respondWithFilteredResult(_0x21e6b3,_0x466a65){return function(_0x3a9462){if(_0x3a9462){var _0x33ae3e=typeof _0x466a65[_0x3027('0x22')]==='undefined'&&typeof _0x466a65[_0x3027('0x23')]==='undefined';var _0x3f0d08=_0x3a9462['count'];var _0x2a182b=_0x33ae3e?0x0:_0x466a65['offset'];var _0x4b9107=_0x33ae3e?_0x3a9462[_0x3027('0x24')]:_0x466a65[_0x3027('0x22')]+_0x466a65['limit'];var _0x116d62;if(_0x4b9107>=_0x3f0d08){_0x4b9107=_0x3f0d08;_0x116d62=0xc8;}else{_0x116d62=0xce;}_0x21e6b3[_0x3027('0x20')](_0x116d62);return _0x21e6b3[_0x3027('0x25')](_0x3027('0x26'),_0x2a182b+'-'+_0x4b9107+'/'+_0x3f0d08)[_0x3027('0x21')](_0x3a9462);}return null;};}function patchUpdates(_0x43ba99){return function(_0x1ca40c){try{jsonpatch[_0x3027('0x27')](_0x1ca40c,_0x43ba99,!![]);}catch(_0x242d48){return BPromise[_0x3027('0x28')](_0x242d48);}return _0x1ca40c[_0x3027('0x29')]();};}function saveUpdates(_0x3c5647,_0x165ac8){return function(_0xbb39f4){if(_0xbb39f4){return _0xbb39f4[_0x3027('0x2a')](_0x3c5647)[_0x3027('0x2b')](function(_0x4c9b6d){return _0x4c9b6d;});}return null;};}function removeEntity(_0x1ab845,_0x4a5242){return function(_0x315e7c){if(_0x315e7c){return _0x315e7c[_0x3027('0x2c')]()[_0x3027('0x2b')](function(){var _0x4831da=_0x315e7c[_0x3027('0x2d')]({'plain':!![]});var _0x5462c7=_0x3027('0x2e');return db[_0x3027('0x2f')][_0x3027('0x2c')]({'where':{'type':_0x5462c7,'resourceId':_0x4831da['id']}})[_0x3027('0x2b')](function(){return _0x315e7c;});})['then'](function(){_0x1ab845[_0x3027('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc7bdac,_0x54a87e){return function(_0x5edc95){if(!_0x5edc95){_0xc7bdac['sendStatus'](0x194);}return _0x5edc95;};}function handleError(_0x1616f4,_0x5aabe7){_0x5aabe7=_0x5aabe7||0x1f4;return function(_0x5f24f4){logger[_0x3027('0x30')](_0x5f24f4['stack']);if(_0x5f24f4[_0x3027('0x31')]){delete _0x5f24f4[_0x3027('0x31')];}_0x1616f4[_0x3027('0x20')](_0x5aabe7)[_0x3027('0x32')](_0x5f24f4);};}exports['index']=function(_0x55f5af,_0x66f58f){var _0x36fadc={},_0x20d92f={},_0x536288={'count':0x0,'rows':[]};var _0x140767=_[_0x3027('0x33')](db[_0x3027('0x34')]['rawAttributes'],function(_0x2d0845){return{'name':_0x2d0845[_0x3027('0x35')],'type':_0x2d0845[_0x3027('0x36')][_0x3027('0x37')]};});_0x20d92f[_0x3027('0x38')]=_[_0x3027('0x33')](_0x140767,_0x3027('0x31'));_0x20d92f[_0x3027('0x39')]=_[_0x3027('0x3a')](_0x55f5af[_0x3027('0x39')]);_0x20d92f[_0x3027('0x3b')]=_[_0x3027('0x3c')](_0x20d92f[_0x3027('0x38')],_0x20d92f[_0x3027('0x39')]);_0x36fadc['attributes']=_[_0x3027('0x3c')](_0x20d92f[_0x3027('0x38')],qs[_0x3027('0x3d')](_0x55f5af[_0x3027('0x39')]['fields']));_0x36fadc[_0x3027('0x3e')]=_0x36fadc[_0x3027('0x3e')][_0x3027('0x3f')]?_0x36fadc[_0x3027('0x3e')]:_0x20d92f[_0x3027('0x38')];if(!_0x55f5af['query'][_0x3027('0x40')](_0x3027('0x41'))){_0x36fadc[_0x3027('0x23')]=qs[_0x3027('0x23')](_0x55f5af[_0x3027('0x39')][_0x3027('0x23')]);_0x36fadc[_0x3027('0x22')]=qs['offset'](_0x55f5af['query']['offset']);}_0x36fadc[_0x3027('0x42')]=qs[_0x3027('0x43')](_0x55f5af['query'][_0x3027('0x43')]);_0x36fadc[_0x3027('0x44')]=qs[_0x3027('0x3b')](_['pick'](_0x55f5af[_0x3027('0x39')],_0x20d92f[_0x3027('0x3b')]),_0x140767);if(_0x55f5af[_0x3027('0x39')][_0x3027('0x45')]){_0x36fadc[_0x3027('0x44')]=_[_0x3027('0x46')](_0x36fadc['where'],{'$or':_[_0x3027('0x33')](_0x140767,function(_0x1a3b36){if(_0x1a3b36['type']!==_0x3027('0x47')){var _0xbd5de3={};_0xbd5de3[_0x1a3b36[_0x3027('0x31')]]={'$like':'%'+_0x55f5af[_0x3027('0x39')][_0x3027('0x45')]+'%'};return _0xbd5de3;}})});}_0x36fadc=_[_0x3027('0x46')]({},_0x36fadc,_0x55f5af[_0x3027('0x48')]);var _0x550fb3={'where':_0x36fadc[_0x3027('0x44')]};return db[_0x3027('0x34')][_0x3027('0x24')](_0x550fb3)[_0x3027('0x2b')](function(_0x48bea8){_0x536288[_0x3027('0x24')]=_0x48bea8;if(_0x55f5af[_0x3027('0x39')][_0x3027('0x49')]){_0x36fadc[_0x3027('0x4a')]=[{'all':!![]}];}return db[_0x3027('0x34')][_0x3027('0x4b')](_0x36fadc);})[_0x3027('0x2b')](function(_0x5a6ea3){_0x536288[_0x3027('0x4c')]=_0x5a6ea3;return _0x536288;})[_0x3027('0x2b')](respondWithFilteredResult(_0x66f58f,_0x36fadc))['catch'](handleError(_0x66f58f,null));};exports['show']=function(_0x5acfd3,_0x3fb15b){var _0x1f7266={'raw':!![],'where':{'id':_0x5acfd3[_0x3027('0x4d')]['id']}},_0x2df532={};_0x2df532[_0x3027('0x38')]=_[_0x3027('0x3a')](db[_0x3027('0x34')][_0x3027('0x4e')]);_0x2df532[_0x3027('0x39')]=_[_0x3027('0x3a')](_0x5acfd3[_0x3027('0x39')]);_0x2df532[_0x3027('0x3b')]=_[_0x3027('0x3c')](_0x2df532[_0x3027('0x38')],_0x2df532[_0x3027('0x39')]);_0x1f7266['attributes']=_[_0x3027('0x3c')](_0x2df532[_0x3027('0x38')],qs[_0x3027('0x3d')](_0x5acfd3[_0x3027('0x39')]['fields']));_0x1f7266[_0x3027('0x3e')]=_0x1f7266[_0x3027('0x3e')][_0x3027('0x3f')]?_0x1f7266[_0x3027('0x3e')]:_0x2df532[_0x3027('0x38')];if(_0x5acfd3[_0x3027('0x39')][_0x3027('0x49')]){_0x1f7266[_0x3027('0x4a')]=[{'all':!![]}];}_0x1f7266=_['merge']({},_0x1f7266,_0x5acfd3[_0x3027('0x48')]);return db[_0x3027('0x34')][_0x3027('0x4f')](_0x1f7266)[_0x3027('0x2b')](handleEntityNotFound(_0x3fb15b,null))[_0x3027('0x2b')](respondWithResult(_0x3fb15b,null))[_0x3027('0x50')](handleError(_0x3fb15b,null));};exports[_0x3027('0x51')]=function(_0x28d032,_0x27e1ee){return db[_0x3027('0x34')][_0x3027('0x51')](_0x28d032[_0x3027('0x52')],{})[_0x3027('0x2b')](function(_0x30909d){var _0x331586=_0x28d032['user'][_0x3027('0x2d')]({'plain':!![]});if(!_0x331586)throw new Error(_0x3027('0x53'));if(_0x331586['role']==='user'){var _0x3b16e3=_0x30909d[_0x3027('0x2d')]({'plain':!![]});var _0x159968=_0x3027('0x2e');return db[_0x3027('0x54')][_0x3027('0x4f')]({'where':{'name':_0x159968,'userProfileId':_0x331586['userProfileId']},'raw':!![]})['then'](function(_0x4042a9){if(_0x4042a9&&_0x4042a9[_0x3027('0x55')]===0x0){return db[_0x3027('0x2f')][_0x3027('0x51')]({'name':_0x3b16e3[_0x3027('0x31')],'resourceId':_0x3b16e3['id'],'type':_0x4042a9[_0x3027('0x31')],'sectionId':_0x4042a9['id']},{})['then'](function(){return _0x30909d;});}else{return _0x30909d;}})[_0x3027('0x50')](function(_0x1fbad5){logger[_0x3027('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fbad5);throw _0x1fbad5;});}return _0x30909d;})[_0x3027('0x2b')](respondWithResult(_0x27e1ee,0xc9))[_0x3027('0x50')](handleError(_0x27e1ee,null));};exports[_0x3027('0x2a')]=function(_0xba0140,_0x5d6630){if(_0xba0140[_0x3027('0x52')]['id']){delete _0xba0140[_0x3027('0x52')]['id'];}return db[_0x3027('0x34')][_0x3027('0x4f')]({'where':{'id':_0xba0140[_0x3027('0x4d')]['id']}})[_0x3027('0x2b')](handleEntityNotFound(_0x5d6630,null))[_0x3027('0x2b')](saveUpdates(_0xba0140['body'],null))[_0x3027('0x2b')](respondWithResult(_0x5d6630,null))['catch'](handleError(_0x5d6630,null));};exports['destroy']=function(_0x14a01a,_0x237946){return db[_0x3027('0x34')][_0x3027('0x4f')]({'where':{'id':_0x14a01a['params']['id']}})[_0x3027('0x2b')](handleEntityNotFound(_0x237946,null))[_0x3027('0x2b')](removeEntity(_0x237946,null))[_0x3027('0x50')](handleError(_0x237946,null));};exports[_0x3027('0x56')]=function(_0x1e2e08,_0x444791){return db[_0x3027('0x34')][_0x3027('0x56')]()['then'](respondWithResult(_0x444791,null))[_0x3027('0x50')](handleError(_0x444791,null));};exports[_0x3027('0x57')]=function(_0x4e9b97,_0x19e943,_0xaca9fc){var _0x2ddfcc={'raw':!![],'where':{}},_0x2628e3={},_0x36d6be;return db[_0x3027('0x34')][_0x3027('0x58')]({'where':{'id':_0x4e9b97['params']['id']}})[_0x3027('0x2b')](handleEntityNotFound(_0x19e943,null))[_0x3027('0x2b')](function(_0x5c1a28){if(_0x5c1a28){_0x36d6be=_0x5c1a28['get']({'plain':!![]});_0x2628e3[_0x3027('0x38')]=_[_0x3027('0x3a')](db[_0x3027('0x59')]['rawAttributes']);_0x2628e3[_0x3027('0x39')]=_[_0x3027('0x3a')](_0x4e9b97[_0x3027('0x39')]);_0x2628e3['filters']=_[_0x3027('0x3c')](_0x2628e3[_0x3027('0x38')],_0x2628e3[_0x3027('0x39')]);_0x2ddfcc[_0x3027('0x3e')]=_[_0x3027('0x3c')](_0x2628e3[_0x3027('0x38')],qs[_0x3027('0x3d')](_0x4e9b97['query'][_0x3027('0x3d')]));_0x2ddfcc[_0x3027('0x3e')]=_0x2ddfcc['attributes']['length']?_0x2ddfcc[_0x3027('0x3e')]:_0x2628e3['model'];if(!_0x4e9b97[_0x3027('0x39')][_0x3027('0x40')]('nolimit')){_0x2ddfcc['limit']=qs[_0x3027('0x23')](_0x4e9b97['query'][_0x3027('0x23')]);_0x2ddfcc[_0x3027('0x22')]=qs[_0x3027('0x22')](_0x4e9b97['query'][_0x3027('0x22')]);}_0x2ddfcc[_0x3027('0x42')]=qs[_0x3027('0x43')](_0x4e9b97[_0x3027('0x39')]['sort']);_0x2ddfcc['where']=qs[_0x3027('0x3b')](_[_0x3027('0x5a')](_0x4e9b97[_0x3027('0x39')],_0x2628e3['filters']));_0x2ddfcc[_0x3027('0x44')]['SmsQueueId']=_0x5c1a28['id'];if(_0x4e9b97[_0x3027('0x39')][_0x3027('0x45')]){_0x2ddfcc[_0x3027('0x44')]=_[_0x3027('0x46')](_0x2ddfcc[_0x3027('0x44')],{'$or':_[_0x3027('0x33')](_0x2ddfcc[_0x3027('0x3e')],function(_0x328e51){var _0x3fd5fe={};_0x3fd5fe[_0x328e51]={'$like':'%'+_0x4e9b97['query'][_0x3027('0x45')]+'%'};return _0x3fd5fe;})});}_0x2ddfcc=_['merge']({},_0x2ddfcc,_0x4e9b97[_0x3027('0x48')]);return db[_0x3027('0x59')]['findAll'](_0x2ddfcc);}})[_0x3027('0x2b')](function(_0x5b7e4a){if(_0x5b7e4a){return db[_0x3027('0x5b')]['findAndCountAll']({'where':{'id':_[_0x3027('0x33')](_0x5b7e4a,_0x3027('0x5c')),'role':_0x3027('0x5d')},'attributes':['id','name',_0x3027('0x5e'),_0x3027('0x5f'),_0x3027('0x60')]});}})[_0x3027('0x2b')](function(_0x4fa576){if(_0x4fa576){return{'count':_0x4fa576[_0x3027('0x24')],'rows':_[_0x3027('0x33')](_0x4fa576[_0x3027('0x4c')],function(_0x5d6bb6){return{'membername':_0x5d6bb6[_0x3027('0x31')],'UserId':_0x5d6bb6['id'],'queue_name':_0x36d6be[_0x3027('0x31')],'SmsQueueId':_0x36d6be['id'],'interface':util[_0x3027('0x61')](_0x3027('0x62'),_0x3027('0x63'),_0x5d6bb6['name']),'penalty':0x0,'paused':_0x5d6bb6[_0x3027('0x5e')],'createdAt':_0x5d6bb6['createdAt'],'updatedAt':_0x5d6bb6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3027('0x2b')](respondWithFilteredResult(_0x19e943,_0x2ddfcc))['catch'](handleError(_0x19e943,null));};exports[_0x3027('0x64')]=function(_0x228fe7,_0x3e2243,_0x44d1ea){var _0x44d1a6={};var _0x37871f={};var _0x1159a1;var _0x3ba5b9;return db['SmsQueue'][_0x3027('0x58')]({'where':{'id':_0x228fe7[_0x3027('0x4d')]['id']}})[_0x3027('0x2b')](handleEntityNotFound(_0x3e2243,null))[_0x3027('0x2b')](function(_0x28f085){if(_0x28f085){_0x1159a1=_0x28f085;_0x37871f[_0x3027('0x38')]=_['keys'](db[_0x3027('0x65')][_0x3027('0x4e')]);_0x37871f[_0x3027('0x39')]=_['keys'](_0x228fe7[_0x3027('0x39')]);_0x37871f[_0x3027('0x3b')]=_[_0x3027('0x3c')](_0x37871f[_0x3027('0x38')],_0x37871f[_0x3027('0x39')]);_0x44d1a6[_0x3027('0x3e')]=_[_0x3027('0x3c')](_0x37871f['model'],qs[_0x3027('0x3d')](_0x228fe7['query'][_0x3027('0x3d')]));_0x44d1a6[_0x3027('0x3e')]=_0x44d1a6['attributes'][_0x3027('0x3f')]?_0x44d1a6[_0x3027('0x3e')]:_0x37871f[_0x3027('0x38')];_0x44d1a6[_0x3027('0x42')]=qs['sort'](_0x228fe7[_0x3027('0x39')][_0x3027('0x43')]);_0x44d1a6['where']=qs['filters'](_['pick'](_0x228fe7[_0x3027('0x39')],_0x37871f[_0x3027('0x3b')]));if(_0x228fe7[_0x3027('0x39')][_0x3027('0x45')]){_0x44d1a6[_0x3027('0x44')]=_[_0x3027('0x46')](_0x44d1a6[_0x3027('0x44')],{'$or':_['map'](_0x44d1a6[_0x3027('0x3e')],function(_0x2d8a54){var _0x5799c7={};_0x5799c7[_0x2d8a54]={'$like':'%'+_0x228fe7[_0x3027('0x39')]['filter']+'%'};return _0x5799c7;})});}_0x44d1a6=_[_0x3027('0x46')]({},_0x44d1a6,_0x228fe7['options']);return _0x1159a1[_0x3027('0x64')](_0x44d1a6);}})[_0x3027('0x2b')](function(_0x101136){if(_0x101136){_0x3ba5b9=_0x101136[_0x3027('0x3f')];if(!_0x228fe7[_0x3027('0x39')][_0x3027('0x40')]('nolimit')){_0x44d1a6[_0x3027('0x23')]=qs['limit'](_0x228fe7[_0x3027('0x39')][_0x3027('0x23')]);_0x44d1a6[_0x3027('0x22')]=qs[_0x3027('0x22')](_0x228fe7[_0x3027('0x39')][_0x3027('0x22')]);}return _0x1159a1[_0x3027('0x64')](_0x44d1a6);}})['then'](function(_0x16a13){if(_0x16a13){return _0x16a13?{'count':_0x3ba5b9,'rows':_0x16a13}:null;}})[_0x3027('0x2b')](respondWithResult(_0x3e2243,null))['catch'](handleError(_0x3e2243,null));};exports[_0x3027('0x66')]=function(_0x4a6013,_0x3edd17,_0x2b103d){var _0x38e602=_0x4a6013[_0x3027('0x52')]['ids'];return db['Team'][_0x3027('0x4b')]({'where':{'id':_0x38e602},'attributes':['id'],'include':[{'model':db[_0x3027('0x5b')],'as':_0x3027('0x67'),'attributes':['id','name',_0x3027('0x68'),_0x3027('0x69'),_0x3027('0x6a')],'raw':!![]}]})[_0x3027('0x2b')](function(_0x359dda){if(_0x359dda){var _0x36e6f8=_['flatMap'](_0x359dda,function(_0x1ac315){var _0x1174dc=_0x1ac315[_0x3027('0x2d')]({'plain':!![]});return _0x1174dc[_0x3027('0x67')];});return db[_0x3027('0x34')]['find']({'where':{'id':_0x4a6013[_0x3027('0x4d')]['id']}})['then'](function(_0x52e08b){return db['sequelize'][_0x3027('0x6b')](function(_0x102062){return _0x52e08b[_0x3027('0x66')](_0x38e602,{'transaction':_0x102062})['then'](function(){return BPromise['each'](_0x36e6f8,function(_0x447532){return db['UserSmsQueue'][_0x3027('0x6c')]({'where':{'UserId':_0x447532['id'],'SmsQueueId':_0x4a6013[_0x3027('0x4d')]['id']},'transaction':_0x102062});});})[_0x3027('0x2b')](function(){_0x36e6f8['forEach'](function(_0x17b0ba){socket[_0x3027('0x6d')](_0x3027('0x6e'),{'UserId':_0x17b0ba['id'],'SmsQueueId':_0x52e08b['id']});});});});});}})['then'](respondWithStatusCode(_0x3edd17,null))[_0x3027('0x50')](handleError(_0x3edd17,null));};exports[_0x3027('0x6f')]=function(_0x51c9ee,_0x1b0b01,_0x44735f){return db[_0x3027('0x65')][_0x3027('0x4b')]({'where':{'id':_0x51c9ee[_0x3027('0x39')][_0x3027('0x70')]},'attributes':['id'],'include':[{'model':db[_0x3027('0x5b')],'as':_0x3027('0x67'),'attributes':['id'],'raw':!![]}]})[_0x3027('0x2b')](handleEntityNotFound(_0x1b0b01,null))[_0x3027('0x2b')](function(_0x302d57){var _0x266f6c=_[_0x3027('0x33')](_0x302d57,'id');var _0x4af951=[];var _0x71caa=[];var _0x59c4b6=squel['select']();_0x59c4b6[_0x3027('0x71')](_0x3027('0x72'))[_0x3027('0x73')](_0x3027('0x74'),'tq')['join']('user_has_teams','ut',_0x3027('0x75'))[_0x3027('0x44')](_0x3027('0x76'),_0x51c9ee[_0x3027('0x4d')]['id']);for(var _0x44932a=0x0;_0x44932a<_0x302d57[_0x3027('0x3f')];_0x44932a+=0x1){let _0x5ae74d=_0x302d57[_0x44932a];for(var _0xeceb5=0x0;_0xeceb5<_0x5ae74d[_0x3027('0x67')][_0x3027('0x3f')];_0xeceb5+=0x1){let _0x43553e=_0x5ae74d[_0x3027('0x67')][_0xeceb5];var _0x538e0d=_0x59c4b6[_0x3027('0x77')]();_0x538e0d[_0x3027('0x44')](_0x3027('0x78'),_0x43553e['id']);_0x71caa['push'](db[_0x3027('0x79')][_0x3027('0x39')](_0x538e0d[_0x3027('0x7a')](),{'type':db['sequelize'][_0x3027('0x7b')][_0x3027('0x7c')]})[_0x3027('0x2b')](function(_0x250f0c){if(_0x250f0c[_0x3027('0x3f')]===0x1){return _0x43553e['id'];}else{var _0x178189=_['every'](_[_0x3027('0x33')](_0x250f0c,_0x3027('0x7d')),function(_0x516090){return _[_0x3027('0x7e')](_0x266f6c,_0x516090);});if(_0x178189){return _0x43553e['id'];}}}));}}return BPromise[_0x3027('0x7f')](_0x71caa)[_0x3027('0x2b')](function(_0x3ad906){_0x4af951=_(_0x4af951)[_0x3027('0x80')](_0x3ad906)[_0x3027('0x81')]()['value']();return db[_0x3027('0x34')][_0x3027('0x4f')]({'where':{'id':_0x51c9ee[_0x3027('0x4d')]['id']}})[_0x3027('0x2b')](function(_0x20ecba){return db[_0x3027('0x79')][_0x3027('0x6b')](function(_0x5d8c67){return _0x20ecba['removeTeams'](_0x51c9ee['query']['ids'],{'transaction':_0x5d8c67})['then'](function(){if(!_[_0x3027('0x82')](_0x4af951)){return _0x20ecba[_0x3027('0x83')](_0x4af951,{'transaction':_0x5d8c67});}})[_0x3027('0x2b')](function(){_0x4af951['forEach'](function(_0x2c976c){socket[_0x3027('0x6d')](_0x3027('0x84'),{'UserId':_0x2c976c,'SmsQueueId':_0x20ecba['id']});});});});});});})[_0x3027('0x2b')](respondWithStatusCode(_0x1b0b01,null))[_0x3027('0x50')](handleError(_0x1b0b01,null));};exports['addAgents']=function(_0x17b679,_0x5366b3,_0xb7a5b8){return db[_0x3027('0x34')]['find']({'where':{'id':_0x17b679[_0x3027('0x4d')]['id']}})[_0x3027('0x2b')](handleEntityNotFound(_0x5366b3,null))[_0x3027('0x2b')](function(_0x3780f9){if(_0x3780f9){return _0x3780f9[_0x3027('0x85')](_0x17b679[_0x3027('0x52')][_0x3027('0x70')],_[_0x3027('0x86')](_0x17b679['body'],[_0x3027('0x70'),'id'])||{})[_0x3027('0x87')](function(_0x2d2f72){for(var _0x2f18fd=0x0;_0x2f18fd<_0x17b679[_0x3027('0x52')]['ids'][_0x3027('0x3f')];_0x2f18fd+=0x1){socket[_0x3027('0x6d')](_0x3027('0x6e'),{'UserId':Number(_0x17b679[_0x3027('0x52')][_0x3027('0x70')][_0x2f18fd]),'SmsQueueId':Number(_0x17b679['params']['id'])});}return _0x2d2f72;});}})[_0x3027('0x2b')](respondWithResult(_0x5366b3,null))[_0x3027('0x50')](handleError(_0x5366b3,null));};exports[_0x3027('0x83')]=function(_0x2826b8,_0x12c071,_0x2ee4ec){return db['SmsQueue'][_0x3027('0x4f')]({'where':{'id':_0x2826b8[_0x3027('0x4d')]['id']}})[_0x3027('0x2b')](handleEntityNotFound(_0x12c071,null))['then'](function(_0xd644e9){if(_0xd644e9){return _0xd644e9[_0x3027('0x83')](_0x2826b8['query'][_0x3027('0x70')])['then'](function(){if(_[_0x3027('0x88')](_0x2826b8[_0x3027('0x39')][_0x3027('0x70')])){for(var _0x25ae7a=0x0;_0x25ae7a<_0x2826b8[_0x3027('0x39')][_0x3027('0x70')][_0x3027('0x3f')];_0x25ae7a+=0x1){socket[_0x3027('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x2826b8[_0x3027('0x39')][_0x3027('0x70')][_0x25ae7a]),'SmsQueueId':Number(_0x2826b8['params']['id'])});}}else{socket[_0x3027('0x6d')](_0x3027('0x84'),{'UserId':Number(_0x2826b8['query'][_0x3027('0x70')]),'SmsQueueId':Number(_0x2826b8[_0x3027('0x4d')]['id'])});}});}})[_0x3027('0x2b')](respondWithStatusCode(_0x12c071,null))[_0x3027('0x50')](handleError(_0x12c071,null));};exports[_0x3027('0x89')]=function(_0x4cddf3,_0x16056f,_0x463868){var _0x3abb42={};var _0x54809b={};var _0xffc550;var _0x3e8057;return db['SmsQueue'][_0x3027('0x58')]({'where':{'id':_0x4cddf3['params']['id']}})[_0x3027('0x2b')](handleEntityNotFound(_0x16056f,null))[_0x3027('0x2b')](function(_0x46e0c){if(_0x46e0c){_0xffc550=_0x46e0c;_0x54809b[_0x3027('0x38')]=_[_0x3027('0x3a')](db[_0x3027('0x5b')]['rawAttributes']);_0x54809b['query']=_[_0x3027('0x3a')](_0x4cddf3[_0x3027('0x39')]);_0x54809b[_0x3027('0x3b')]=_[_0x3027('0x3c')](_0x54809b[_0x3027('0x38')],_0x54809b[_0x3027('0x39')]);_0x3abb42['attributes']=_[_0x3027('0x3c')](_0x54809b['model'],qs[_0x3027('0x3d')](_0x4cddf3[_0x3027('0x39')][_0x3027('0x3d')]));_0x3abb42[_0x3027('0x3e')]=_0x3abb42[_0x3027('0x3e')][_0x3027('0x3f')]?_0x3abb42[_0x3027('0x3e')]:_0x54809b[_0x3027('0x38')];_0x3abb42[_0x3027('0x42')]=qs['sort'](_0x4cddf3['query'][_0x3027('0x43')]);_0x3abb42[_0x3027('0x44')]=qs[_0x3027('0x3b')](_[_0x3027('0x5a')](_0x4cddf3[_0x3027('0x39')],_0x54809b[_0x3027('0x3b')]));if(_0x4cddf3[_0x3027('0x39')][_0x3027('0x45')]){_0x3abb42[_0x3027('0x44')]=_[_0x3027('0x46')](_0x3abb42[_0x3027('0x44')],{'$or':_['map'](_0x3abb42[_0x3027('0x3e')],function(_0x258a76){var _0x9cbc08={};_0x9cbc08[_0x258a76]={'$like':'%'+_0x4cddf3[_0x3027('0x39')][_0x3027('0x45')]+'%'};return _0x9cbc08;})});}_0x3abb42=_['merge']({},_0x3abb42,_0x4cddf3[_0x3027('0x48')]);return _0xffc550[_0x3027('0x89')](_0x3abb42);}})[_0x3027('0x2b')](function(_0x1a2b09){if(_0x1a2b09){_0x3e8057=_0x1a2b09[_0x3027('0x3f')];if(!_0x4cddf3[_0x3027('0x39')]['hasOwnProperty'](_0x3027('0x41'))){_0x3abb42[_0x3027('0x23')]=qs['limit'](_0x4cddf3[_0x3027('0x39')][_0x3027('0x23')]);_0x3abb42['offset']=qs[_0x3027('0x22')](_0x4cddf3[_0x3027('0x39')][_0x3027('0x22')]);}return _0xffc550[_0x3027('0x89')](_0x3abb42);}})[_0x3027('0x2b')](function(_0x210c0b){if(_0x210c0b){return _0x210c0b?{'count':_0x3e8057,'rows':_0x210c0b}:null;}})[_0x3027('0x2b')](respondWithResult(_0x16056f,null))[_0x3027('0x50')](handleError(_0x16056f,null));}; \ No newline at end of file +var _0x1a8b=['updatedAt','createdAt','format','SIP','getTeams','ids','Agents','online','interface','flatMap','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','Team','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','removeTeams','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./smsQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','apply','update','then','destroy','get','error','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause'];(function(_0xcc0a36,_0x395550){var _0x21f53d=function(_0x32fdda){while(--_0x32fdda){_0xcc0a36['push'](_0xcc0a36['shift']());}};_0x21f53d(++_0x395550);}(_0x1a8b,0xbd));var _0xb1a8=function(_0x34f29c,_0x31063f){_0x34f29c=_0x34f29c-0x0;var _0x1ae41b=_0x1a8b[_0x34f29c];return _0x1ae41b;};'use strict';var emlformat=require(_0xb1a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1a8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1a8('0x2'));var moment=require(_0xb1a8('0x3'));var BPromise=require(_0xb1a8('0x4'));var Mustache=require(_0xb1a8('0x5'));var util=require(_0xb1a8('0x6'));var path=require(_0xb1a8('0x7'));var sox=require(_0xb1a8('0x8'));var csv=require('to-csv');var ejs=require(_0xb1a8('0x9'));var fs=require('fs');var fs_extra=require(_0xb1a8('0xa'));var _=require(_0xb1a8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb1a8('0xc'));var deskjs=require(_0xb1a8('0xd'));var toCsv=require(_0xb1a8('0xe'));var querystring=require(_0xb1a8('0xf'));var Papa=require(_0xb1a8('0x10'));var Redis=require(_0xb1a8('0x11'));var authService=require(_0xb1a8('0x12'));var qs=require(_0xb1a8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1a8('0x14'));var logger=require(_0xb1a8('0x15'))(_0xb1a8('0x16'));var utils=require(_0xb1a8('0x17'));var config=require(_0xb1a8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb1a8('0x19'))['db'];config[_0xb1a8('0x1a')]=_[_0xb1a8('0x1b')](config[_0xb1a8('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1a8('0x1a')]));require(_0xb1a8('0x1c'))[_0xb1a8('0x1d')](socket);function respondWithStatusCode(_0x465e3f,_0x2f3f16){_0x2f3f16=_0x2f3f16||0xcc;return function(_0x5034c6){if(_0x5034c6){return _0x465e3f[_0xb1a8('0x1e')](_0x2f3f16);}return _0x465e3f[_0xb1a8('0x1f')](_0x2f3f16)[_0xb1a8('0x20')]();};}function respondWithResult(_0x256569,_0x2546d9){_0x2546d9=_0x2546d9||0xc8;return function(_0x411714){if(_0x411714){return _0x256569[_0xb1a8('0x1f')](_0x2546d9)[_0xb1a8('0x21')](_0x411714);}};}function respondWithFilteredResult(_0x19388a,_0x2b07cd){return function(_0x86b495){if(_0x86b495){var _0x5a7839=typeof _0x2b07cd['offset']==='undefined'&&typeof _0x2b07cd[_0xb1a8('0x22')]===_0xb1a8('0x23');var _0x24e48a=_0x86b495[_0xb1a8('0x24')];var _0x5275b5=_0x5a7839?0x0:_0x2b07cd[_0xb1a8('0x25')];var _0x1c13d9=_0x5a7839?_0x86b495[_0xb1a8('0x24')]:_0x2b07cd[_0xb1a8('0x25')]+_0x2b07cd[_0xb1a8('0x22')];var _0x292aa3;if(_0x1c13d9>=_0x24e48a){_0x1c13d9=_0x24e48a;_0x292aa3=0xc8;}else{_0x292aa3=0xce;}_0x19388a[_0xb1a8('0x1f')](_0x292aa3);return _0x19388a['set']('Content-Range',_0x5275b5+'-'+_0x1c13d9+'/'+_0x24e48a)[_0xb1a8('0x21')](_0x86b495);}return null;};}function patchUpdates(_0x277cf9){return function(_0x3cce03){try{jsonpatch[_0xb1a8('0x26')](_0x3cce03,_0x277cf9,!![]);}catch(_0x3219ea){return BPromise['reject'](_0x3219ea);}return _0x3cce03['save']();};}function saveUpdates(_0x470aa0,_0x428508){return function(_0x17385f){if(_0x17385f){return _0x17385f[_0xb1a8('0x27')](_0x470aa0)[_0xb1a8('0x28')](function(_0xaf38ec){return _0xaf38ec;});}return null;};}function removeEntity(_0x3d28f0,_0x18a9b3){return function(_0x4a1cac){if(_0x4a1cac){return _0x4a1cac[_0xb1a8('0x29')]()[_0xb1a8('0x28')](function(){var _0x1ec294=_0x4a1cac[_0xb1a8('0x2a')]({'plain':!![]});var _0x52451c='SmsQueues';return db['UserProfileResource'][_0xb1a8('0x29')]({'where':{'type':_0x52451c,'resourceId':_0x1ec294['id']}})[_0xb1a8('0x28')](function(){return _0x4a1cac;});})[_0xb1a8('0x28')](function(){_0x3d28f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x355de1,_0x513d71){return function(_0x4f74f1){if(!_0x4f74f1){_0x355de1[_0xb1a8('0x1e')](0x194);}return _0x4f74f1;};}function handleError(_0x314edb,_0x78dbbe){_0x78dbbe=_0x78dbbe||0x1f4;return function(_0x1ff431){logger[_0xb1a8('0x2b')](_0x1ff431[_0xb1a8('0x2c')]);if(_0x1ff431[_0xb1a8('0x2d')]){delete _0x1ff431['name'];}_0x314edb[_0xb1a8('0x1f')](_0x78dbbe)[_0xb1a8('0x2e')](_0x1ff431);};}exports[_0xb1a8('0x2f')]=function(_0x25b3f0,_0x523ed1){var _0x22ae21={},_0x2f501a={},_0x59ea14={'count':0x0,'rows':[]};var _0x521a2f=_[_0xb1a8('0x30')](db[_0xb1a8('0x31')][_0xb1a8('0x32')],function(_0x25ec74){return{'name':_0x25ec74['fieldName'],'type':_0x25ec74[_0xb1a8('0x33')][_0xb1a8('0x34')]};});_0x2f501a[_0xb1a8('0x35')]=_[_0xb1a8('0x30')](_0x521a2f,_0xb1a8('0x2d'));_0x2f501a[_0xb1a8('0x36')]=_[_0xb1a8('0x37')](_0x25b3f0[_0xb1a8('0x36')]);_0x2f501a[_0xb1a8('0x38')]=_[_0xb1a8('0x39')](_0x2f501a[_0xb1a8('0x35')],_0x2f501a['query']);_0x22ae21[_0xb1a8('0x3a')]=_[_0xb1a8('0x39')](_0x2f501a[_0xb1a8('0x35')],qs['fields'](_0x25b3f0[_0xb1a8('0x36')][_0xb1a8('0x3b')]));_0x22ae21[_0xb1a8('0x3a')]=_0x22ae21[_0xb1a8('0x3a')][_0xb1a8('0x3c')]?_0x22ae21['attributes']:_0x2f501a[_0xb1a8('0x35')];if(!_0x25b3f0[_0xb1a8('0x36')][_0xb1a8('0x3d')](_0xb1a8('0x3e'))){_0x22ae21[_0xb1a8('0x22')]=qs[_0xb1a8('0x22')](_0x25b3f0['query']['limit']);_0x22ae21['offset']=qs[_0xb1a8('0x25')](_0x25b3f0[_0xb1a8('0x36')][_0xb1a8('0x25')]);}_0x22ae21[_0xb1a8('0x3f')]=qs[_0xb1a8('0x40')](_0x25b3f0[_0xb1a8('0x36')]['sort']);_0x22ae21[_0xb1a8('0x41')]=qs[_0xb1a8('0x38')](_[_0xb1a8('0x42')](_0x25b3f0['query'],_0x2f501a[_0xb1a8('0x38')]),_0x521a2f);if(_0x25b3f0['query'][_0xb1a8('0x43')]){_0x22ae21['where']=_[_0xb1a8('0x44')](_0x22ae21[_0xb1a8('0x41')],{'$or':_[_0xb1a8('0x30')](_0x521a2f,function(_0x50a6e9){if(_0x50a6e9[_0xb1a8('0x33')]!==_0xb1a8('0x45')){var _0xa063f3={};_0xa063f3[_0x50a6e9['name']]={'$like':'%'+_0x25b3f0[_0xb1a8('0x36')]['filter']+'%'};return _0xa063f3;}})});}_0x22ae21=_[_0xb1a8('0x44')]({},_0x22ae21,_0x25b3f0[_0xb1a8('0x46')]);var _0x22f629={'where':_0x22ae21[_0xb1a8('0x41')]};return db[_0xb1a8('0x31')][_0xb1a8('0x24')](_0x22f629)[_0xb1a8('0x28')](function(_0x5ae8eb){_0x59ea14[_0xb1a8('0x24')]=_0x5ae8eb;if(_0x25b3f0[_0xb1a8('0x36')]['includeAll']){_0x22ae21[_0xb1a8('0x47')]=[{'all':!![]}];}return db[_0xb1a8('0x31')][_0xb1a8('0x48')](_0x22ae21);})[_0xb1a8('0x28')](function(_0x47ffec){_0x59ea14[_0xb1a8('0x49')]=_0x47ffec;return _0x59ea14;})['then'](respondWithFilteredResult(_0x523ed1,_0x22ae21))['catch'](handleError(_0x523ed1,null));};exports[_0xb1a8('0x4a')]=function(_0x2dfee8,_0x1c0033){var _0x2150c0={'raw':!![],'where':{'id':_0x2dfee8[_0xb1a8('0x4b')]['id']}},_0xad948={};_0xad948[_0xb1a8('0x35')]=_[_0xb1a8('0x37')](db[_0xb1a8('0x31')][_0xb1a8('0x32')]);_0xad948[_0xb1a8('0x36')]=_['keys'](_0x2dfee8[_0xb1a8('0x36')]);_0xad948['filters']=_[_0xb1a8('0x39')](_0xad948['model'],_0xad948[_0xb1a8('0x36')]);_0x2150c0[_0xb1a8('0x3a')]=_[_0xb1a8('0x39')](_0xad948[_0xb1a8('0x35')],qs[_0xb1a8('0x3b')](_0x2dfee8['query']['fields']));_0x2150c0[_0xb1a8('0x3a')]=_0x2150c0[_0xb1a8('0x3a')][_0xb1a8('0x3c')]?_0x2150c0[_0xb1a8('0x3a')]:_0xad948[_0xb1a8('0x35')];if(_0x2dfee8[_0xb1a8('0x36')][_0xb1a8('0x4c')]){_0x2150c0[_0xb1a8('0x47')]=[{'all':!![]}];}_0x2150c0=_[_0xb1a8('0x44')]({},_0x2150c0,_0x2dfee8[_0xb1a8('0x46')]);return db[_0xb1a8('0x31')][_0xb1a8('0x4d')](_0x2150c0)[_0xb1a8('0x28')](handleEntityNotFound(_0x1c0033,null))[_0xb1a8('0x28')](respondWithResult(_0x1c0033,null))[_0xb1a8('0x4e')](handleError(_0x1c0033,null));};exports[_0xb1a8('0x4f')]=function(_0x99df5d,_0x37abdf){return db['SmsQueue']['create'](_0x99df5d[_0xb1a8('0x50')],{})[_0xb1a8('0x28')](function(_0x50bebd){var _0x3b3857=_0x99df5d[_0xb1a8('0x51')]['get']({'plain':!![]});if(!_0x3b3857)throw new Error(_0xb1a8('0x52'));if(_0x3b3857[_0xb1a8('0x53')]===_0xb1a8('0x51')){var _0x207780=_0x50bebd[_0xb1a8('0x2a')]({'plain':!![]});var _0x15049d='SmsQueues';return db['UserProfileSection'][_0xb1a8('0x4d')]({'where':{'name':_0x15049d,'userProfileId':_0x3b3857[_0xb1a8('0x54')]},'raw':!![]})['then'](function(_0x533a6d){if(_0x533a6d&&_0x533a6d[_0xb1a8('0x55')]===0x0){return db[_0xb1a8('0x56')][_0xb1a8('0x4f')]({'name':_0x207780['name'],'resourceId':_0x207780['id'],'type':_0x533a6d['name'],'sectionId':_0x533a6d['id']},{})['then'](function(){return _0x50bebd;});}else{return _0x50bebd;}})['catch'](function(_0x3f0be5){logger[_0xb1a8('0x2b')](_0xb1a8('0x57'),_0x3f0be5);throw _0x3f0be5;});}return _0x50bebd;})[_0xb1a8('0x28')](respondWithResult(_0x37abdf,0xc9))[_0xb1a8('0x4e')](handleError(_0x37abdf,null));};exports[_0xb1a8('0x27')]=function(_0x10656c,_0x1449a7){if(_0x10656c[_0xb1a8('0x50')]['id']){delete _0x10656c[_0xb1a8('0x50')]['id'];}return db[_0xb1a8('0x31')][_0xb1a8('0x4d')]({'where':{'id':_0x10656c[_0xb1a8('0x4b')]['id']}})[_0xb1a8('0x28')](handleEntityNotFound(_0x1449a7,null))[_0xb1a8('0x28')](saveUpdates(_0x10656c[_0xb1a8('0x50')],null))['then'](respondWithResult(_0x1449a7,null))[_0xb1a8('0x4e')](handleError(_0x1449a7,null));};exports[_0xb1a8('0x29')]=function(_0x1e255a,_0x949991){return db['SmsQueue']['find']({'where':{'id':_0x1e255a[_0xb1a8('0x4b')]['id']}})[_0xb1a8('0x28')](handleEntityNotFound(_0x949991,null))['then'](removeEntity(_0x949991,null))[_0xb1a8('0x4e')](handleError(_0x949991,null));};exports[_0xb1a8('0x58')]=function(_0x24fd1a,_0x558575){return db['SmsQueue'][_0xb1a8('0x58')]()[_0xb1a8('0x28')](respondWithResult(_0x558575,null))[_0xb1a8('0x4e')](handleError(_0x558575,null));};exports['getMembers']=function(_0x28d7ea,_0x514000,_0x2f1f41){var _0x76e3b7={'raw':!![],'where':{}},_0x1cb7df={},_0x104f4c;return db[_0xb1a8('0x31')][_0xb1a8('0x59')]({'where':{'id':_0x28d7ea[_0xb1a8('0x4b')]['id']}})[_0xb1a8('0x28')](handleEntityNotFound(_0x514000,null))[_0xb1a8('0x28')](function(_0x3a01d5){if(_0x3a01d5){_0x104f4c=_0x3a01d5[_0xb1a8('0x2a')]({'plain':!![]});_0x1cb7df[_0xb1a8('0x35')]=_['keys'](db[_0xb1a8('0x5a')]['rawAttributes']);_0x1cb7df[_0xb1a8('0x36')]=_[_0xb1a8('0x37')](_0x28d7ea[_0xb1a8('0x36')]);_0x1cb7df[_0xb1a8('0x38')]=_[_0xb1a8('0x39')](_0x1cb7df[_0xb1a8('0x35')],_0x1cb7df[_0xb1a8('0x36')]);_0x76e3b7[_0xb1a8('0x3a')]=_['intersection'](_0x1cb7df[_0xb1a8('0x35')],qs['fields'](_0x28d7ea['query'][_0xb1a8('0x3b')]));_0x76e3b7[_0xb1a8('0x3a')]=_0x76e3b7[_0xb1a8('0x3a')][_0xb1a8('0x3c')]?_0x76e3b7['attributes']:_0x1cb7df[_0xb1a8('0x35')];if(!_0x28d7ea['query'][_0xb1a8('0x3d')](_0xb1a8('0x3e'))){_0x76e3b7[_0xb1a8('0x22')]=qs[_0xb1a8('0x22')](_0x28d7ea[_0xb1a8('0x36')]['limit']);_0x76e3b7[_0xb1a8('0x25')]=qs['offset'](_0x28d7ea[_0xb1a8('0x36')][_0xb1a8('0x25')]);}_0x76e3b7[_0xb1a8('0x3f')]=qs[_0xb1a8('0x40')](_0x28d7ea[_0xb1a8('0x36')]['sort']);_0x76e3b7[_0xb1a8('0x41')]=qs[_0xb1a8('0x38')](_[_0xb1a8('0x42')](_0x28d7ea['query'],_0x1cb7df['filters']));_0x76e3b7[_0xb1a8('0x41')][_0xb1a8('0x5b')]=_0x3a01d5['id'];if(_0x28d7ea['query']['filter']){_0x76e3b7[_0xb1a8('0x41')]=_['merge'](_0x76e3b7[_0xb1a8('0x41')],{'$or':_[_0xb1a8('0x30')](_0x76e3b7['attributes'],function(_0x1d9926){var _0x550a6e={};_0x550a6e[_0x1d9926]={'$like':'%'+_0x28d7ea[_0xb1a8('0x36')][_0xb1a8('0x43')]+'%'};return _0x550a6e;})});}_0x76e3b7=_['merge']({},_0x76e3b7,_0x28d7ea[_0xb1a8('0x46')]);return db[_0xb1a8('0x5a')][_0xb1a8('0x48')](_0x76e3b7);}})[_0xb1a8('0x28')](function(_0x1af0db){if(_0x1af0db){return db[_0xb1a8('0x5c')][_0xb1a8('0x5d')]({'where':{'id':_['map'](_0x1af0db,_0xb1a8('0x5e')),'role':_0xb1a8('0x5f')},'attributes':['id',_0xb1a8('0x2d'),_0xb1a8('0x60'),_0xb1a8('0x61'),_0xb1a8('0x62')]});}})[_0xb1a8('0x28')](function(_0x5747c7){if(_0x5747c7){return{'count':_0x5747c7[_0xb1a8('0x24')],'rows':_[_0xb1a8('0x30')](_0x5747c7[_0xb1a8('0x49')],function(_0x4fb5b0){return{'membername':_0x4fb5b0[_0xb1a8('0x2d')],'UserId':_0x4fb5b0['id'],'queue_name':_0x104f4c[_0xb1a8('0x2d')],'SmsQueueId':_0x104f4c['id'],'interface':util[_0xb1a8('0x63')]('%s/%s',_0xb1a8('0x64'),_0x4fb5b0[_0xb1a8('0x2d')]),'penalty':0x0,'paused':_0x4fb5b0[_0xb1a8('0x60')],'createdAt':_0x4fb5b0[_0xb1a8('0x62')],'updatedAt':_0x4fb5b0[_0xb1a8('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb1a8('0x28')](respondWithFilteredResult(_0x514000,_0x76e3b7))[_0xb1a8('0x4e')](handleError(_0x514000,null));};exports['getTeams']=function(_0x37c8ed,_0x3bf3aa,_0x106aa7){var _0x1b1524={};var _0x335a45={};var _0x20ad32;var _0x2ffb3a;return db[_0xb1a8('0x31')][_0xb1a8('0x59')]({'where':{'id':_0x37c8ed[_0xb1a8('0x4b')]['id']}})[_0xb1a8('0x28')](handleEntityNotFound(_0x3bf3aa,null))['then'](function(_0x4d4687){if(_0x4d4687){_0x20ad32=_0x4d4687;_0x335a45[_0xb1a8('0x35')]=_[_0xb1a8('0x37')](db['Team'][_0xb1a8('0x32')]);_0x335a45[_0xb1a8('0x36')]=_[_0xb1a8('0x37')](_0x37c8ed[_0xb1a8('0x36')]);_0x335a45['filters']=_['intersection'](_0x335a45['model'],_0x335a45[_0xb1a8('0x36')]);_0x1b1524['attributes']=_['intersection'](_0x335a45[_0xb1a8('0x35')],qs[_0xb1a8('0x3b')](_0x37c8ed[_0xb1a8('0x36')]['fields']));_0x1b1524['attributes']=_0x1b1524['attributes'][_0xb1a8('0x3c')]?_0x1b1524['attributes']:_0x335a45[_0xb1a8('0x35')];_0x1b1524['order']=qs[_0xb1a8('0x40')](_0x37c8ed[_0xb1a8('0x36')][_0xb1a8('0x40')]);_0x1b1524['where']=qs['filters'](_[_0xb1a8('0x42')](_0x37c8ed[_0xb1a8('0x36')],_0x335a45['filters']));if(_0x37c8ed[_0xb1a8('0x36')][_0xb1a8('0x43')]){_0x1b1524[_0xb1a8('0x41')]=_[_0xb1a8('0x44')](_0x1b1524[_0xb1a8('0x41')],{'$or':_[_0xb1a8('0x30')](_0x1b1524['attributes'],function(_0x388c33){var _0x118008={};_0x118008[_0x388c33]={'$like':'%'+_0x37c8ed[_0xb1a8('0x36')][_0xb1a8('0x43')]+'%'};return _0x118008;})});}_0x1b1524=_['merge']({},_0x1b1524,_0x37c8ed['options']);return _0x20ad32[_0xb1a8('0x65')](_0x1b1524);}})[_0xb1a8('0x28')](function(_0x5f47aa){if(_0x5f47aa){_0x2ffb3a=_0x5f47aa[_0xb1a8('0x3c')];if(!_0x37c8ed['query']['hasOwnProperty'](_0xb1a8('0x3e'))){_0x1b1524[_0xb1a8('0x22')]=qs[_0xb1a8('0x22')](_0x37c8ed[_0xb1a8('0x36')][_0xb1a8('0x22')]);_0x1b1524[_0xb1a8('0x25')]=qs[_0xb1a8('0x25')](_0x37c8ed[_0xb1a8('0x36')][_0xb1a8('0x25')]);}return _0x20ad32[_0xb1a8('0x65')](_0x1b1524);}})[_0xb1a8('0x28')](function(_0x184b96){if(_0x184b96){return _0x184b96?{'count':_0x2ffb3a,'rows':_0x184b96}:null;}})[_0xb1a8('0x28')](respondWithResult(_0x3bf3aa,null))['catch'](handleError(_0x3bf3aa,null));};exports['addTeams']=function(_0x1aba57,_0x58f732,_0x38024b){var _0x1ffa3a=_0x1aba57[_0xb1a8('0x50')][_0xb1a8('0x66')];return db['Team'][_0xb1a8('0x48')]({'where':{'id':_0x1ffa3a},'attributes':['id'],'include':[{'model':db[_0xb1a8('0x5c')],'as':_0xb1a8('0x67'),'attributes':['id','name',_0xb1a8('0x68'),'voicePause',_0xb1a8('0x69')],'raw':!![]}]})[_0xb1a8('0x28')](function(_0x111b4f){if(_0x111b4f){var _0x5ccc23=_[_0xb1a8('0x6a')](_0x111b4f,function(_0x1ffc4c){var _0x46373f=_0x1ffc4c[_0xb1a8('0x2a')]({'plain':!![]});return _0x46373f[_0xb1a8('0x67')];});return db['SmsQueue']['find']({'where':{'id':_0x1aba57[_0xb1a8('0x4b')]['id']}})[_0xb1a8('0x28')](function(_0x5ea27b){return db['sequelize']['transaction'](function(_0x36828f){return _0x5ea27b[_0xb1a8('0x6b')](_0x1ffa3a,{'transaction':_0x36828f})['then'](function(){return BPromise[_0xb1a8('0x6c')](_0x5ccc23,function(_0x521729){return db[_0xb1a8('0x5a')][_0xb1a8('0x6d')]({'where':{'UserId':_0x521729['id'],'SmsQueueId':_0x1aba57[_0xb1a8('0x4b')]['id']},'transaction':_0x36828f});});})[_0xb1a8('0x28')](function(){_0x5ccc23[_0xb1a8('0x6e')](function(_0x558e43){socket[_0xb1a8('0x6f')](_0xb1a8('0x70'),{'UserId':_0x558e43['id'],'SmsQueueId':_0x5ea27b['id']});});});});});}})[_0xb1a8('0x28')](respondWithStatusCode(_0x58f732,null))[_0xb1a8('0x4e')](handleError(_0x58f732,null));};exports['removeTeams']=function(_0x2af17e,_0x2f57c9,_0x48d209){return db[_0xb1a8('0x71')]['findAll']({'where':{'id':_0x2af17e[_0xb1a8('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb1a8('0x5c')],'as':_0xb1a8('0x67'),'attributes':['id'],'raw':!![]}]})[_0xb1a8('0x28')](handleEntityNotFound(_0x2f57c9,null))[_0xb1a8('0x28')](function(_0x4dc288){var _0x258924=_[_0xb1a8('0x30')](_0x4dc288,'id');var _0x348a50=[];var _0x3850c1=[];var _0x196efe=squel[_0xb1a8('0x72')]();_0x196efe[_0xb1a8('0x73')](_0xb1a8('0x74'))[_0xb1a8('0x75')](_0xb1a8('0x76'),'tq')[_0xb1a8('0x77')](_0xb1a8('0x78'),'ut',_0xb1a8('0x79'))[_0xb1a8('0x41')](_0xb1a8('0x7a'),_0x2af17e[_0xb1a8('0x4b')]['id']);for(var _0x7f7efa=0x0;_0x7f7efa<_0x4dc288[_0xb1a8('0x3c')];_0x7f7efa+=0x1){let _0x479ebe=_0x4dc288[_0x7f7efa];for(var _0x2fd71c=0x0;_0x2fd71c<_0x479ebe[_0xb1a8('0x67')]['length'];_0x2fd71c+=0x1){let _0x135e11=_0x479ebe['Agents'][_0x2fd71c];var _0x60ba42=_0x196efe[_0xb1a8('0x7b')]();_0x60ba42[_0xb1a8('0x41')]('ut.UserId\x20=\x20?',_0x135e11['id']);_0x3850c1['push'](db[_0xb1a8('0x7c')][_0xb1a8('0x36')](_0x60ba42[_0xb1a8('0x7d')](),{'type':db['sequelize'][_0xb1a8('0x7e')][_0xb1a8('0x7f')]})[_0xb1a8('0x28')](function(_0x3dee55){if(_0x3dee55[_0xb1a8('0x3c')]===0x1){return _0x135e11['id'];}else{var _0xc5ca2d=_[_0xb1a8('0x80')](_[_0xb1a8('0x30')](_0x3dee55,_0xb1a8('0x81')),function(_0x4296d0){return _[_0xb1a8('0x82')](_0x258924,_0x4296d0);});if(_0xc5ca2d){return _0x135e11['id'];}}}));}}return BPromise[_0xb1a8('0x83')](_0x3850c1)['then'](function(_0x42ae88){_0x348a50=_(_0x348a50)[_0xb1a8('0x84')](_0x42ae88)[_0xb1a8('0x85')]()['value']();return db[_0xb1a8('0x31')]['find']({'where':{'id':_0x2af17e[_0xb1a8('0x4b')]['id']}})['then'](function(_0x481dc9){return db[_0xb1a8('0x7c')][_0xb1a8('0x86')](function(_0x5c0a49){return _0x481dc9[_0xb1a8('0x87')](_0x2af17e[_0xb1a8('0x36')][_0xb1a8('0x66')],{'transaction':_0x5c0a49})[_0xb1a8('0x28')](function(){if(!_['isEmpty'](_0x348a50)){return _0x481dc9[_0xb1a8('0x88')](_0x348a50,{'transaction':_0x5c0a49});}})[_0xb1a8('0x28')](function(){_0x348a50[_0xb1a8('0x6e')](function(_0x537938){socket[_0xb1a8('0x6f')]('userSmsQueue:remove',{'UserId':_0x537938,'SmsQueueId':_0x481dc9['id']});});});});});});})[_0xb1a8('0x28')](respondWithStatusCode(_0x2f57c9,null))[_0xb1a8('0x4e')](handleError(_0x2f57c9,null));};exports[_0xb1a8('0x89')]=function(_0x16e438,_0x987bf0,_0x266975){return db[_0xb1a8('0x31')][_0xb1a8('0x4d')]({'where':{'id':_0x16e438[_0xb1a8('0x4b')]['id']}})[_0xb1a8('0x28')](handleEntityNotFound(_0x987bf0,null))['then'](function(_0x3dddde){if(_0x3dddde){return _0x3dddde[_0xb1a8('0x89')](_0x16e438[_0xb1a8('0x50')][_0xb1a8('0x66')],_[_0xb1a8('0x8a')](_0x16e438[_0xb1a8('0x50')],[_0xb1a8('0x66'),'id'])||{})[_0xb1a8('0x8b')](function(_0x19bfc3){for(var _0x42dab7=0x0;_0x42dab7<_0x16e438[_0xb1a8('0x50')][_0xb1a8('0x66')][_0xb1a8('0x3c')];_0x42dab7+=0x1){socket[_0xb1a8('0x6f')](_0xb1a8('0x70'),{'UserId':Number(_0x16e438['body'][_0xb1a8('0x66')][_0x42dab7]),'SmsQueueId':Number(_0x16e438[_0xb1a8('0x4b')]['id'])});}return _0x19bfc3;});}})[_0xb1a8('0x28')](respondWithResult(_0x987bf0,null))['catch'](handleError(_0x987bf0,null));};exports['removeAgents']=function(_0x5f2897,_0x5892a8,_0xccbe0d){return db['SmsQueue'][_0xb1a8('0x4d')]({'where':{'id':_0x5f2897['params']['id']}})[_0xb1a8('0x28')](handleEntityNotFound(_0x5892a8,null))[_0xb1a8('0x28')](function(_0x2bd1ab){if(_0x2bd1ab){return _0x2bd1ab['removeAgents'](_0x5f2897[_0xb1a8('0x36')][_0xb1a8('0x66')])[_0xb1a8('0x28')](function(){if(_[_0xb1a8('0x8c')](_0x5f2897[_0xb1a8('0x36')]['ids'])){for(var _0x19f357=0x0;_0x19f357<_0x5f2897[_0xb1a8('0x36')][_0xb1a8('0x66')][_0xb1a8('0x3c')];_0x19f357+=0x1){socket[_0xb1a8('0x6f')](_0xb1a8('0x8d'),{'UserId':Number(_0x5f2897[_0xb1a8('0x36')][_0xb1a8('0x66')][_0x19f357]),'SmsQueueId':Number(_0x5f2897[_0xb1a8('0x4b')]['id'])});}}else{socket[_0xb1a8('0x6f')](_0xb1a8('0x8d'),{'UserId':Number(_0x5f2897['query']['ids']),'SmsQueueId':Number(_0x5f2897['params']['id'])});}});}})[_0xb1a8('0x28')](respondWithStatusCode(_0x5892a8,null))['catch'](handleError(_0x5892a8,null));};exports[_0xb1a8('0x8e')]=function(_0x41ba9b,_0x357368,_0x1e6cb1){var _0x2aff99={};var _0x391b67={};var _0x38c857;var _0x5019a1;return db[_0xb1a8('0x31')]['findOne']({'where':{'id':_0x41ba9b[_0xb1a8('0x4b')]['id']}})[_0xb1a8('0x28')](handleEntityNotFound(_0x357368,null))[_0xb1a8('0x28')](function(_0x5b884a){if(_0x5b884a){_0x38c857=_0x5b884a;_0x391b67[_0xb1a8('0x35')]=_[_0xb1a8('0x37')](db[_0xb1a8('0x5c')][_0xb1a8('0x32')]);_0x391b67[_0xb1a8('0x36')]=_[_0xb1a8('0x37')](_0x41ba9b[_0xb1a8('0x36')]);_0x391b67['filters']=_['intersection'](_0x391b67[_0xb1a8('0x35')],_0x391b67['query']);_0x2aff99['attributes']=_[_0xb1a8('0x39')](_0x391b67[_0xb1a8('0x35')],qs['fields'](_0x41ba9b[_0xb1a8('0x36')][_0xb1a8('0x3b')]));_0x2aff99[_0xb1a8('0x3a')]=_0x2aff99[_0xb1a8('0x3a')]['length']?_0x2aff99[_0xb1a8('0x3a')]:_0x391b67[_0xb1a8('0x35')];_0x2aff99['order']=qs[_0xb1a8('0x40')](_0x41ba9b[_0xb1a8('0x36')][_0xb1a8('0x40')]);_0x2aff99[_0xb1a8('0x41')]=qs[_0xb1a8('0x38')](_[_0xb1a8('0x42')](_0x41ba9b[_0xb1a8('0x36')],_0x391b67[_0xb1a8('0x38')]));if(_0x41ba9b[_0xb1a8('0x36')]['filter']){_0x2aff99['where']=_['merge'](_0x2aff99[_0xb1a8('0x41')],{'$or':_[_0xb1a8('0x30')](_0x2aff99['attributes'],function(_0x459de6){var _0x2717ba={};_0x2717ba[_0x459de6]={'$like':'%'+_0x41ba9b[_0xb1a8('0x36')][_0xb1a8('0x43')]+'%'};return _0x2717ba;})});}_0x2aff99=_[_0xb1a8('0x44')]({},_0x2aff99,_0x41ba9b[_0xb1a8('0x46')]);return _0x38c857[_0xb1a8('0x8e')](_0x2aff99);}})[_0xb1a8('0x28')](function(_0x3a8b83){if(_0x3a8b83){_0x5019a1=_0x3a8b83[_0xb1a8('0x3c')];if(!_0x41ba9b[_0xb1a8('0x36')][_0xb1a8('0x3d')](_0xb1a8('0x3e'))){_0x2aff99['limit']=qs[_0xb1a8('0x22')](_0x41ba9b[_0xb1a8('0x36')]['limit']);_0x2aff99[_0xb1a8('0x25')]=qs[_0xb1a8('0x25')](_0x41ba9b[_0xb1a8('0x36')][_0xb1a8('0x25')]);}return _0x38c857[_0xb1a8('0x8e')](_0x2aff99);}})[_0xb1a8('0x28')](function(_0x24834f){if(_0x24834f){return _0x24834f?{'count':_0x5019a1,'rows':_0x24834f}:null;}})[_0xb1a8('0x28')](respondWithResult(_0x357368,null))[_0xb1a8('0x4e')](handleError(_0x357368,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 03259f5..a554e5d 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 _0xf091=['events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','exports'];(function(_0x3a19d4,_0x3f19a4){var _0x5b858b=function(_0x4ddce5){while(--_0x4ddce5){_0x3a19d4['push'](_0x3a19d4['shift']());}};_0x5b858b(++_0x3f19a4);}(_0xf091,0x1c8));var _0x1f09=function(_0x4de978,_0x34a5d0){_0x4de978=_0x4de978-0x0;var _0x351742=_0xf091[_0x4de978];return _0x351742;};'use strict';var EventEmitter=require(_0x1f09('0x0'));var SmsQueue=require(_0x1f09('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1f09('0x2')](0x0);var events={'afterCreate':_0x1f09('0x3'),'afterUpdate':_0x1f09('0x4'),'afterDestroy':_0x1f09('0x5')};function emitEvent(_0x390456){return function(_0x312812,_0x585792,_0x1f444b){SmsQueueEvents['emit'](_0x390456+':'+_0x312812['id'],_0x312812);SmsQueueEvents['emit'](_0x390456,_0x312812);_0x1f444b(null);};}for(var e in events){if(events[_0x1f09('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1f09('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xc7e1=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x42d709,_0x1f5bda){var _0x41d422=function(_0x3bf560){while(--_0x3bf560){_0x42d709['push'](_0x42d709['shift']());}};_0x41d422(++_0x1f5bda);}(_0xc7e1,0x7c));var _0x1c7e=function(_0x49f740,_0x49872d){_0x49f740=_0x49f740-0x0;var _0x8d8463=_0xc7e1[_0x49f740];return _0x8d8463;};'use strict';var EventEmitter=require(_0x1c7e('0x0'));var SmsQueue=require(_0x1c7e('0x1'))['db'][_0x1c7e('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1c7e('0x3')](0x0);var events={'afterCreate':_0x1c7e('0x4'),'afterUpdate':_0x1c7e('0x5'),'afterDestroy':_0x1c7e('0x6')};function emitEvent(_0x4d3c93){return function(_0x2ad558,_0xdea7d5,_0x4c3279){SmsQueueEvents['emit'](_0x4d3c93+':'+_0x2ad558['id'],_0x2ad558);SmsQueueEvents['emit'](_0x4d3c93,_0x2ad558);_0x4c3279(null);};}for(var e in events){if(events[_0x1c7e('0x7')](e)){var event=events[e];SmsQueue[_0x1c7e('0x8')](e,emitEvent(event));}}module[_0x1c7e('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 c99a3d9..96af847 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 _0x05e6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','sms_queues','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x05e6,0x175));var _0x605e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x05e6[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x605e('0x0'));var util=require(_0x605e('0x1'));var logger=require(_0x605e('0x2'))(_0x605e('0x3'));var moment=require(_0x605e('0x4'));var BPromise=require(_0x605e('0x5'));var rp=require(_0x605e('0x6'));var fs=require('fs');var path=require(_0x605e('0x7'));var rimraf=require(_0x605e('0x8'));var config=require(_0x605e('0x9'));var attributes=require(_0x605e('0xa'));module['exports']=function(_0x522383,_0x276fb5){return _0x522383[_0x605e('0xb')]('SmsQueue',attributes,{'tableName':_0x605e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee6a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x49f1b9,_0x43b2e9){var _0x32e290=function(_0x47a92a){while(--_0x47a92a){_0x49f1b9['push'](_0x49f1b9['shift']());}};_0x32e290(++_0x43b2e9);}(_0xee6a,0x8c));var _0xaee6=function(_0x3dd5b5,_0x37b8d6){_0x3dd5b5=_0x3dd5b5-0x0;var _0xcdde1f=_0xee6a[_0x3dd5b5];return _0xcdde1f;};'use strict';var _=require(_0xaee6('0x0'));var util=require(_0xaee6('0x1'));var logger=require(_0xaee6('0x2'))(_0xaee6('0x3'));var moment=require(_0xaee6('0x4'));var BPromise=require(_0xaee6('0x5'));var rp=require(_0xaee6('0x6'));var fs=require('fs');var path=require(_0xaee6('0x7'));var rimraf=require('rimraf');var config=require(_0xaee6('0x8'));var attributes=require(_0xaee6('0x9'));module[_0xaee6('0xa')]=function(_0x57f260,_0x112a10){return _0x57f260[_0xaee6('0xb')](_0xaee6('0xc'),attributes,{'tableName':_0xaee6('0xd'),'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 ab3c60d..3d17203 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 _0xf5c8=['include','map','model','then','catch','ShowSmsQueue','find','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit'];(function(_0x38960a,_0x555254){var _0x2495e1=function(_0xc319e5){while(--_0xc319e5){_0x38960a['push'](_0x38960a['shift']());}};_0x2495e1(++_0x555254);}(_0xf5c8,0x1ca));var _0x8f5c=function(_0x401609,_0x5eb61d){_0x401609=_0x401609-0x0;var _0x35fd57=_0xf5c8[_0x401609];return _0x35fd57;};'use strict';var _=require(_0x8f5c('0x0'));var util=require(_0x8f5c('0x1'));var moment=require(_0x8f5c('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f5c('0x3'));var fs=require('fs');var Redis=require(_0x8f5c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8f5c('0x5'))('rpc');var config=require(_0x8f5c('0x6'));var jayson=require(_0x8f5c('0x7'));var client=jayson[_0x8f5c('0x8')][_0x8f5c('0x9')]({'port':0x232a});config[_0x8f5c('0xa')]=_[_0x8f5c('0xb')](config[_0x8f5c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8f5c('0xc'))(new Redis(config['redis']));require(_0x8f5c('0xd'))[_0x8f5c('0xe')](socket);function respondWithRpcPromise(_0x1e4a53,_0x1761f8,_0x598bfa){return new BPromise(function(_0xd8e9d5,_0x368238){return client[_0x8f5c('0xf')](_0x1e4a53,_0x598bfa)['then'](function(_0x2ff4ba){logger[_0x8f5c('0x10')](_0x8f5c('0x11'),_0x1761f8,_0x8f5c('0x12'));logger[_0x8f5c('0x13')](_0x8f5c('0x14'),_0x1761f8,'request\x20sent',JSON[_0x8f5c('0x15')](_0x2ff4ba));if(_0x2ff4ba[_0x8f5c('0x16')]){if(_0x2ff4ba[_0x8f5c('0x16')][_0x8f5c('0x17')]===0x1f4){logger['error'](_0x8f5c('0x11'),_0x1761f8,_0x2ff4ba[_0x8f5c('0x16')][_0x8f5c('0x18')]);return _0x368238(_0x2ff4ba[_0x8f5c('0x16')][_0x8f5c('0x18')]);}logger['error'](_0x8f5c('0x11'),_0x1761f8,_0x2ff4ba[_0x8f5c('0x16')][_0x8f5c('0x18')]);return _0xd8e9d5(_0x2ff4ba[_0x8f5c('0x16')][_0x8f5c('0x18')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x1761f8,'request\x20sent');_0xd8e9d5(_0x2ff4ba[_0x8f5c('0x19')][_0x8f5c('0x18')]);}})['catch'](function(_0x49c199){logger[_0x8f5c('0x16')]('SmsQueue,\x20%s,\x20%s',_0x1761f8,_0x49c199);_0x368238(_0x49c199);});});}exports[_0x8f5c('0x1a')]=function(_0x146d9a){var _0x1106db=this;return new Promise(function(_0x31b858,_0x4ae7eb){return db[_0x8f5c('0x1b')][_0x8f5c('0x1c')]({'raw':_0x146d9a[_0x8f5c('0x1d')]?_0x146d9a[_0x8f5c('0x1d')][_0x8f5c('0x1e')]===undefined?!![]:![]:!![],'where':_0x146d9a['options']?_0x146d9a['options'][_0x8f5c('0x1f')]||null:null,'attributes':_0x146d9a[_0x8f5c('0x1d')]?_0x146d9a[_0x8f5c('0x1d')][_0x8f5c('0x20')]||null:null,'limit':_0x146d9a[_0x8f5c('0x1d')]?_0x146d9a[_0x8f5c('0x1d')][_0x8f5c('0x21')]||null:null,'include':_0x146d9a[_0x8f5c('0x1d')]?_0x146d9a[_0x8f5c('0x1d')][_0x8f5c('0x22')]?_['map'](_0x146d9a[_0x8f5c('0x1d')]['include'],function(_0x155a94){return{'model':db[_0x155a94['model']],'as':_0x155a94['as'],'attributes':_0x155a94[_0x8f5c('0x20')],'include':_0x155a94[_0x8f5c('0x22')]?_[_0x8f5c('0x23')](_0x155a94['include'],function(_0x1a1e08){return{'model':db[_0x1a1e08[_0x8f5c('0x24')]],'as':_0x1a1e08['as'],'attributes':_0x1a1e08[_0x8f5c('0x20')],'include':_0x1a1e08[_0x8f5c('0x22')]?_[_0x8f5c('0x23')](_0x1a1e08['include'],function(_0x4f390c){return{'model':db[_0x4f390c[_0x8f5c('0x24')]],'as':_0x4f390c['as'],'attributes':_0x4f390c[_0x8f5c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8f5c('0x25')](function(_0x1477b4){logger[_0x8f5c('0x10')](_0x8f5c('0x1a'),_0x146d9a);logger[_0x8f5c('0x13')]('GetSmsQueue',_0x146d9a,JSON[_0x8f5c('0x15')](_0x1477b4));_0x31b858(_0x1477b4);})[_0x8f5c('0x26')](function(_0x480c22){logger[_0x8f5c('0x16')](_0x8f5c('0x1a'),_0x480c22[_0x8f5c('0x18')],_0x146d9a);_0x4ae7eb(_0x1106db[_0x8f5c('0x16')](0x1f4,_0x480c22[_0x8f5c('0x18')]));});});};exports[_0x8f5c('0x27')]=function(_0x3e352c){var _0x169bfc=this;return new Promise(function(_0x408dcc,_0x55d14f){return db[_0x8f5c('0x1b')][_0x8f5c('0x28')]({'raw':_0x3e352c['options']?_0x3e352c[_0x8f5c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3e352c[_0x8f5c('0x1d')]?_0x3e352c[_0x8f5c('0x1d')][_0x8f5c('0x1f')]||null:null,'attributes':_0x3e352c[_0x8f5c('0x1d')]?_0x3e352c[_0x8f5c('0x1d')][_0x8f5c('0x20')]||null:null,'include':_0x3e352c[_0x8f5c('0x1d')]?_0x3e352c[_0x8f5c('0x1d')]['include']?_['map'](_0x3e352c['options'][_0x8f5c('0x22')],function(_0x430093){return{'model':db[_0x430093[_0x8f5c('0x24')]],'as':_0x430093['as'],'attributes':_0x430093['attributes'],'include':_0x430093['include']?_[_0x8f5c('0x23')](_0x430093[_0x8f5c('0x22')],function(_0x2b7f06){return{'model':db[_0x2b7f06[_0x8f5c('0x24')]],'as':_0x2b7f06['as'],'attributes':_0x2b7f06[_0x8f5c('0x20')],'include':_0x2b7f06[_0x8f5c('0x22')]?_[_0x8f5c('0x23')](_0x2b7f06[_0x8f5c('0x22')],function(_0x330317){return{'model':db[_0x330317[_0x8f5c('0x24')]],'as':_0x330317['as'],'attributes':_0x330317['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f5c('0x25')](function(_0x48e3e4){logger[_0x8f5c('0x10')](_0x8f5c('0x27'),_0x3e352c);logger[_0x8f5c('0x13')]('ShowSmsQueue',_0x3e352c,JSON[_0x8f5c('0x15')](_0x48e3e4));_0x408dcc(_0x48e3e4);})[_0x8f5c('0x26')](function(_0x397479){logger[_0x8f5c('0x16')](_0x8f5c('0x27'),_0x397479[_0x8f5c('0x18')],_0x3e352c);_0x55d14f(_0x169bfc['error'](0x1f4,_0x397479[_0x8f5c('0x18')]));});});}; \ No newline at end of file +var _0x3f30=['where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','debug','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','request\x20sent','result','GetSmsQueue','SmsQueue','findAll','options','raw','limit','include','map','attributes','model','catch','ShowSmsQueue','find'];(function(_0x2e48b2,_0x78904e){var _0x3f05ab=function(_0x4bc3b4){while(--_0x4bc3b4){_0x2e48b2['push'](_0x2e48b2['shift']());}};_0x3f05ab(++_0x78904e);}(_0x3f30,0x1ed));var _0x03f3=function(_0x3a1d29,_0x3dc67b){_0x3a1d29=_0x3a1d29-0x0;var _0x2c9ee9=_0x3f30[_0x3a1d29];return _0x2c9ee9;};'use strict';var _=require(_0x03f3('0x0'));var util=require(_0x03f3('0x1'));var moment=require(_0x03f3('0x2'));var BPromise=require(_0x03f3('0x3'));var rs=require(_0x03f3('0x4'));var fs=require('fs');var Redis=require(_0x03f3('0x5'));var db=require(_0x03f3('0x6'))['db'];var utils=require(_0x03f3('0x7'));var logger=require('../../config/logger')(_0x03f3('0x8'));var config=require('../../config/environment');var jayson=require(_0x03f3('0x9'));var client=jayson[_0x03f3('0xa')][_0x03f3('0xb')]({'port':0x232a});config[_0x03f3('0xc')]=_[_0x03f3('0xd')](config['redis'],{'host':_0x03f3('0xe'),'port':0x18eb});var socket=require(_0x03f3('0xf'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x03f3('0x10')](socket);function respondWithRpcPromise(_0x5a74c6,_0x5b9d26,_0x5829c1){return new BPromise(function(_0x449a32,_0x420109){return client['request'](_0x5a74c6,_0x5829c1)[_0x03f3('0x11')](function(_0x221694){logger['info']('SmsQueue,\x20%s,\x20%s',_0x5b9d26,'request\x20sent');logger[_0x03f3('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5b9d26,'request\x20sent',JSON[_0x03f3('0x13')](_0x221694));if(_0x221694[_0x03f3('0x14')]){if(_0x221694[_0x03f3('0x14')][_0x03f3('0x15')]===0x1f4){logger['error'](_0x03f3('0x16'),_0x5b9d26,_0x221694[_0x03f3('0x14')]['message']);return _0x420109(_0x221694['error'][_0x03f3('0x17')]);}logger[_0x03f3('0x14')](_0x03f3('0x16'),_0x5b9d26,_0x221694[_0x03f3('0x14')][_0x03f3('0x17')]);return _0x449a32(_0x221694[_0x03f3('0x14')][_0x03f3('0x17')]);}else{logger[_0x03f3('0x18')](_0x03f3('0x16'),_0x5b9d26,_0x03f3('0x19'));_0x449a32(_0x221694[_0x03f3('0x1a')][_0x03f3('0x17')]);}})['catch'](function(_0x5d44bd){logger[_0x03f3('0x14')]('SmsQueue,\x20%s,\x20%s',_0x5b9d26,_0x5d44bd);_0x420109(_0x5d44bd);});});}exports[_0x03f3('0x1b')]=function(_0x1bd7e7){var _0x271b19=this;return new Promise(function(_0xc1254,_0x33f5ff){return db[_0x03f3('0x1c')][_0x03f3('0x1d')]({'raw':_0x1bd7e7['options']?_0x1bd7e7[_0x03f3('0x1e')][_0x03f3('0x1f')]===undefined?!![]:![]:!![],'where':_0x1bd7e7[_0x03f3('0x1e')]?_0x1bd7e7[_0x03f3('0x1e')]['where']||null:null,'attributes':_0x1bd7e7[_0x03f3('0x1e')]?_0x1bd7e7[_0x03f3('0x1e')]['attributes']||null:null,'limit':_0x1bd7e7[_0x03f3('0x1e')]?_0x1bd7e7[_0x03f3('0x1e')][_0x03f3('0x20')]||null:null,'include':_0x1bd7e7[_0x03f3('0x1e')]?_0x1bd7e7[_0x03f3('0x1e')][_0x03f3('0x21')]?_[_0x03f3('0x22')](_0x1bd7e7['options'][_0x03f3('0x21')],function(_0x352844){return{'model':db[_0x352844['model']],'as':_0x352844['as'],'attributes':_0x352844[_0x03f3('0x23')],'include':_0x352844['include']?_[_0x03f3('0x22')](_0x352844[_0x03f3('0x21')],function(_0x1cccab){return{'model':db[_0x1cccab[_0x03f3('0x24')]],'as':_0x1cccab['as'],'attributes':_0x1cccab['attributes'],'include':_0x1cccab[_0x03f3('0x21')]?_[_0x03f3('0x22')](_0x1cccab[_0x03f3('0x21')],function(_0x385e80){return{'model':db[_0x385e80[_0x03f3('0x24')]],'as':_0x385e80['as'],'attributes':_0x385e80[_0x03f3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd953be){logger['info'](_0x03f3('0x1b'),_0x1bd7e7);logger[_0x03f3('0x12')]('GetSmsQueue',_0x1bd7e7,JSON[_0x03f3('0x13')](_0xd953be));_0xc1254(_0xd953be);})[_0x03f3('0x25')](function(_0x7a058f){logger[_0x03f3('0x14')](_0x03f3('0x1b'),_0x7a058f[_0x03f3('0x17')],_0x1bd7e7);_0x33f5ff(_0x271b19[_0x03f3('0x14')](0x1f4,_0x7a058f['message']));});});};exports[_0x03f3('0x26')]=function(_0x615cac){var _0x21d373=this;return new Promise(function(_0x559017,_0x1989d6){return db[_0x03f3('0x1c')][_0x03f3('0x27')]({'raw':_0x615cac[_0x03f3('0x1e')]?_0x615cac['options'][_0x03f3('0x1f')]===undefined?!![]:![]:!![],'where':_0x615cac[_0x03f3('0x1e')]?_0x615cac[_0x03f3('0x1e')][_0x03f3('0x28')]||null:null,'attributes':_0x615cac[_0x03f3('0x1e')]?_0x615cac[_0x03f3('0x1e')][_0x03f3('0x23')]||null:null,'include':_0x615cac['options']?_0x615cac[_0x03f3('0x1e')]['include']?_[_0x03f3('0x22')](_0x615cac['options'][_0x03f3('0x21')],function(_0x7d860b){return{'model':db[_0x7d860b[_0x03f3('0x24')]],'as':_0x7d860b['as'],'attributes':_0x7d860b[_0x03f3('0x23')],'include':_0x7d860b['include']?_[_0x03f3('0x22')](_0x7d860b['include'],function(_0x3c6be6){return{'model':db[_0x3c6be6[_0x03f3('0x24')]],'as':_0x3c6be6['as'],'attributes':_0x3c6be6['attributes'],'include':_0x3c6be6[_0x03f3('0x21')]?_[_0x03f3('0x22')](_0x3c6be6[_0x03f3('0x21')],function(_0x1b816e){return{'model':db[_0x1b816e[_0x03f3('0x24')]],'as':_0x1b816e['as'],'attributes':_0x1b816e[_0x03f3('0x23')]};}):[]};}):[]};}):[]:[]})[_0x03f3('0x11')](function(_0x103117){logger[_0x03f3('0x18')](_0x03f3('0x26'),_0x615cac);logger[_0x03f3('0x12')](_0x03f3('0x26'),_0x615cac,JSON[_0x03f3('0x13')](_0x103117));_0x559017(_0x103117);})['catch'](function(_0x4f5b76){logger[_0x03f3('0x14')](_0x03f3('0x26'),_0x4f5b76[_0x03f3('0x17')],_0x615cac);_0x1989d6(_0x21d373[_0x03f3('0x14')](0x1f4,_0x4f5b76['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 7c02c45..fe8baa5 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 _0xf543=['save','emit','removeListener','length','./smsQueue.events'];(function(_0x135e73,_0x53d25e){var _0x207d86=function(_0x4803a5){while(--_0x4803a5){_0x135e73['push'](_0x135e73['shift']());}};_0x207d86(++_0x53d25e);}(_0xf543,0xa4));var _0x3f54=function(_0x25c1fd,_0x51336c){_0x25c1fd=_0x25c1fd-0x0;var _0x5036a7=_0xf543[_0x25c1fd];return _0x5036a7;};'use strict';var SmsQueueEvents=require(_0x3f54('0x0'));var events=[_0x3f54('0x1'),'remove','update'];function createListener(_0x3cdf9f,_0x226280){return function(_0x121ca3){_0x226280[_0x3f54('0x2')](_0x3cdf9f,_0x121ca3);};}function removeListener(_0x15c960,_0x319f88){return function(){SmsQueueEvents[_0x3f54('0x3')](_0x15c960,_0x319f88);};}exports['register']=function(_0xc34d89){for(var _0x15ffed=0x0,_0x244bcc=events[_0x3f54('0x4')];_0x15ffed<_0x244bcc;_0x15ffed++){var _0x381b1d=events[_0x15ffed];var _0x440fcd=createListener('smsQueue:'+_0x381b1d,_0xc34d89);SmsQueueEvents['on'](_0x381b1d,_0x440fcd);}}; \ No newline at end of file +var _0xfb05=['emit','removeListener','register','length','smsQueue:'];(function(_0xe461c4,_0x450df6){var _0x45bcae=function(_0x446424){while(--_0x446424){_0xe461c4['push'](_0xe461c4['shift']());}};_0x45bcae(++_0x450df6);}(_0xfb05,0x1ef));var _0x5fb0=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xfb05[_0x411017];return _0x2adeea;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0x14895c,_0x363ec8){return function(_0x5b8841){_0x363ec8[_0x5fb0('0x0')](_0x14895c,_0x5b8841);};}function removeListener(_0x13b2a2,_0x1d7cfd){return function(){SmsQueueEvents[_0x5fb0('0x1')](_0x13b2a2,_0x1d7cfd);};}exports[_0x5fb0('0x2')]=function(_0xe65e9c){for(var _0x22ebec=0x0,_0x3c2051=events[_0x5fb0('0x3')];_0x22ebec<_0x3c2051;_0x22ebec++){var _0x495d77=events[_0x22ebec];var _0x49bf87=createListener(_0x5fb0('0x4')+_0x495d77,_0xe65e9c);SmsQueueEvents['on'](_0x495d77,_0x49bf87);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8764e86..4532315 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 _0x4b2e=['describe','get','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','/describe'];(function(_0x1d5d94,_0x2588a8){var _0x4b7fb0=function(_0x403b70){while(--_0x403b70){_0x1d5d94['push'](_0x1d5d94['shift']());}};_0x4b7fb0(++_0x2588a8);}(_0x4b2e,0x1ec));var _0xe4b2=function(_0x89aa27,_0x48ff21){_0x89aa27=_0x89aa27-0x0;var _0x27b644=_0x4b2e[_0x89aa27];return _0x27b644;};'use strict';var multer=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var path=require(_0xe4b2('0x2'));var timeout=require(_0xe4b2('0x3'));var express=require(_0xe4b2('0x4'));var router=express[_0xe4b2('0x5')]();var fs_extra=require(_0xe4b2('0x6'));var auth=require(_0xe4b2('0x7'));var interaction=require(_0xe4b2('0x8'));var config=require(_0xe4b2('0x9'));var controller=require(_0xe4b2('0xa'));router['get']('/',auth[_0xe4b2('0xb')](),controller[_0xe4b2('0xc')]);router['get'](_0xe4b2('0xd'),auth[_0xe4b2('0xb')](),controller[_0xe4b2('0xe')]);router[_0xe4b2('0xf')](_0xe4b2('0x10'),auth[_0xe4b2('0xb')](),controller['show']);router[_0xe4b2('0x11')]('/',auth[_0xe4b2('0xb')](),controller[_0xe4b2('0x12')]);router[_0xe4b2('0x13')](_0xe4b2('0x10'),auth[_0xe4b2('0xb')](),controller[_0xe4b2('0x14')]);router[_0xe4b2('0x15')](_0xe4b2('0x10'),auth[_0xe4b2('0xb')](),controller[_0xe4b2('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8338=['get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x8338,0x140));var _0x8833=function(_0x185df,_0x3e0eda){_0x185df=_0x185df-0x0;var _0x10cc7a=_0x8338[_0x185df];return _0x10cc7a;};'use strict';var multer=require(_0x8833('0x0'));var util=require(_0x8833('0x1'));var path=require(_0x8833('0x2'));var timeout=require(_0x8833('0x3'));var express=require(_0x8833('0x4'));var router=express[_0x8833('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8833('0x6'));var interaction=require(_0x8833('0x7'));var config=require(_0x8833('0x8'));var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8833('0x9')]);router[_0x8833('0xa')](_0x8833('0xb'),auth[_0x8833('0xc')](),controller[_0x8833('0xd')]);router[_0x8833('0xa')](_0x8833('0xe'),auth['isAuthenticated'](),controller[_0x8833('0xf')]);router['post']('/',auth[_0x8833('0xc')](),controller[_0x8833('0x10')]);router[_0x8833('0x11')]('/:id',auth[_0x8833('0xc')](),controller[_0x8833('0x12')]);router[_0x8833('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8833('0x14')]);module[_0x8833('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 9d94dc6..c788341 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 _0xfde6=['sequelize','STRING','DATE','moment'];(function(_0x1c832c,_0x458392){var _0x4c31f8=function(_0x52450f){while(--_0x52450f){_0x1c832c['push'](_0x1c832c['shift']());}};_0x4c31f8(++_0x458392);}(_0xfde6,0xaf));var _0x6fde=function(_0x351560,_0x5e88b7){_0x351560=_0x351560-0x0;var _0x3a2d0a=_0xfde6[_0x351560];return _0x3a2d0a;};'use strict';var moment=require(_0x6fde('0x0'));var Sequelize=require(_0x6fde('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6fde('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6fde('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6fde('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9dbe=['STRING','DATE','moment','sequelize','exports'];(function(_0x57c3c1,_0xbb2076){var _0x3ae5da=function(_0x586f43){while(--_0x586f43){_0x57c3c1['push'](_0x57c3c1['shift']());}};_0x3ae5da(++_0xbb2076);}(_0x9dbe,0x174));var _0xe9db=function(_0xea64c3,_0x5d78e7){_0xea64c3=_0xea64c3-0x0;var _0x426a12=_0x9dbe[_0xea64c3];return _0x426a12;};'use strict';var moment=require(_0xe9db('0x0'));var Sequelize=require(_0xe9db('0x1'));module[_0xe9db('0x2')]={'uniqueid':{'type':Sequelize[_0xe9db('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe9db('0x3')]},'joinAt':{'type':Sequelize[_0xe9db('0x4')]},'leaveAt':{'type':Sequelize[_0xe9db('0x4')]},'acceptAt':{'type':Sequelize[_0xe9db('0x4')]},'exitAt':{'type':Sequelize[_0xe9db('0x4')]},'reason':{'type':Sequelize[_0xe9db('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2f1fe84..b3cd7f7 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 _0x489a=['create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','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','sendStatus','status','end','json','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x489a,0x140));var _0xa489=function(_0x32e6b9,_0x1ba001){_0x32e6b9=_0x32e6b9-0x0;var _0xd18132=_0x489a[_0x32e6b9];return _0xd18132;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa489('0x0'));var zipdir=require(_0xa489('0x1'));var jsonpatch=require(_0xa489('0x2'));var rp=require(_0xa489('0x3'));var moment=require(_0xa489('0x4'));var BPromise=require(_0xa489('0x5'));var Mustache=require(_0xa489('0x6'));var util=require(_0xa489('0x7'));var path=require(_0xa489('0x8'));var sox=require('sox');var csv=require(_0xa489('0x9'));var ejs=require(_0xa489('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa489('0xb'));var squel=require(_0xa489('0xc'));var crypto=require('crypto');var jsforce=require(_0xa489('0xd'));var deskjs=require(_0xa489('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa489('0xf'));var Papa=require(_0xa489('0x10'));var Redis=require(_0xa489('0x11'));var authService=require(_0xa489('0x12'));var qs=require(_0xa489('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa489('0x14'));var logger=require(_0xa489('0x15'))('api');var utils=require(_0xa489('0x16'));var config=require(_0xa489('0x17'));var licenseUtil=require(_0xa489('0x18'));var db=require(_0xa489('0x19'))['db'];function respondWithStatusCode(_0x45e60e,_0x4d5650){_0x4d5650=_0x4d5650||0xcc;return function(_0x22a46f){if(_0x22a46f){return _0x45e60e[_0xa489('0x1a')](_0x4d5650);}return _0x45e60e[_0xa489('0x1b')](_0x4d5650)[_0xa489('0x1c')]();};}function respondWithResult(_0x5d1fed,_0x3870d0){_0x3870d0=_0x3870d0||0xc8;return function(_0x50a2e9){if(_0x50a2e9){return _0x5d1fed[_0xa489('0x1b')](_0x3870d0)[_0xa489('0x1d')](_0x50a2e9);}};}function respondWithFilteredResult(_0x1a57b6,_0x483ae1){return function(_0x930032){if(_0x930032){var _0x201c89=typeof _0x483ae1['offset']==='undefined'&&typeof _0x483ae1['limit']==='undefined';var _0x5bea3a=_0x930032[_0xa489('0x1e')];var _0x4c83bc=_0x201c89?0x0:_0x483ae1['offset'];var _0x4ef881=_0x201c89?_0x930032[_0xa489('0x1e')]:_0x483ae1[_0xa489('0x1f')]+_0x483ae1['limit'];var _0x472828;if(_0x4ef881>=_0x5bea3a){_0x4ef881=_0x5bea3a;_0x472828=0xc8;}else{_0x472828=0xce;}_0x1a57b6[_0xa489('0x1b')](_0x472828);return _0x1a57b6[_0xa489('0x20')]('Content-Range',_0x4c83bc+'-'+_0x4ef881+'/'+_0x5bea3a)[_0xa489('0x1d')](_0x930032);}return null;};}function patchUpdates(_0x1a777e){return function(_0x63b958){try{jsonpatch[_0xa489('0x21')](_0x63b958,_0x1a777e,!![]);}catch(_0x24123e){return BPromise[_0xa489('0x22')](_0x24123e);}return _0x63b958[_0xa489('0x23')]();};}function saveUpdates(_0x576fcd,_0x5e0d3c){return function(_0x48cae6){if(_0x48cae6){return _0x48cae6['update'](_0x576fcd)[_0xa489('0x24')](function(_0x5bf95b){return _0x5bf95b;});}return null;};}function removeEntity(_0x2c18e0,_0xdcbcad){return function(_0x3bcd78){if(_0x3bcd78){return _0x3bcd78[_0xa489('0x25')]()['then'](function(){_0x2c18e0[_0xa489('0x1b')](0xcc)[_0xa489('0x1c')]();});}};}function handleEntityNotFound(_0x197b86,_0x37afb0){return function(_0x4165b0){if(!_0x4165b0){_0x197b86['sendStatus'](0x194);}return _0x4165b0;};}function handleError(_0x12cf86,_0x109750){_0x109750=_0x109750||0x1f4;return function(_0x471a74){logger[_0xa489('0x26')](_0x471a74[_0xa489('0x27')]);if(_0x471a74['name']){delete _0x471a74[_0xa489('0x28')];}_0x12cf86[_0xa489('0x1b')](_0x109750)[_0xa489('0x29')](_0x471a74);};}exports[_0xa489('0x2a')]=function(_0x3620d0,_0x14600c){var _0x40451d={},_0x12e8ed={},_0x6f92fa={'count':0x0,'rows':[]};var _0x4ef752=_[_0xa489('0x2b')](db[_0xa489('0x2c')][_0xa489('0x2d')],function(_0x3ae38e){return{'name':_0x3ae38e[_0xa489('0x2e')],'type':_0x3ae38e[_0xa489('0x2f')][_0xa489('0x30')]};});_0x12e8ed[_0xa489('0x31')]=_[_0xa489('0x2b')](_0x4ef752,'name');_0x12e8ed[_0xa489('0x32')]=_[_0xa489('0x33')](_0x3620d0[_0xa489('0x32')]);_0x12e8ed[_0xa489('0x34')]=_['intersection'](_0x12e8ed[_0xa489('0x31')],_0x12e8ed[_0xa489('0x32')]);_0x40451d[_0xa489('0x35')]=_[_0xa489('0x36')](_0x12e8ed[_0xa489('0x31')],qs[_0xa489('0x37')](_0x3620d0['query'][_0xa489('0x37')]));_0x40451d[_0xa489('0x35')]=_0x40451d[_0xa489('0x35')][_0xa489('0x38')]?_0x40451d[_0xa489('0x35')]:_0x12e8ed[_0xa489('0x31')];if(!_0x3620d0[_0xa489('0x32')][_0xa489('0x39')](_0xa489('0x3a'))){_0x40451d[_0xa489('0x3b')]=qs[_0xa489('0x3b')](_0x3620d0[_0xa489('0x32')][_0xa489('0x3b')]);_0x40451d['offset']=qs['offset'](_0x3620d0[_0xa489('0x32')]['offset']);}_0x40451d[_0xa489('0x3c')]=qs[_0xa489('0x3d')](_0x3620d0[_0xa489('0x32')][_0xa489('0x3d')]);_0x40451d[_0xa489('0x3e')]=qs[_0xa489('0x34')](_[_0xa489('0x3f')](_0x3620d0[_0xa489('0x32')],_0x12e8ed['filters']),_0x4ef752);if(_0x3620d0[_0xa489('0x32')][_0xa489('0x40')]){_0x40451d[_0xa489('0x3e')]=_[_0xa489('0x41')](_0x40451d[_0xa489('0x3e')],{'$or':_[_0xa489('0x2b')](_0x4ef752,function(_0x13759e){if(_0x13759e[_0xa489('0x2f')]!==_0xa489('0x42')){var _0x5de37d={};_0x5de37d[_0x13759e['name']]={'$like':'%'+_0x3620d0[_0xa489('0x32')][_0xa489('0x40')]+'%'};return _0x5de37d;}})});}_0x40451d=_[_0xa489('0x41')]({},_0x40451d,_0x3620d0['options']);var _0x51935f={'where':_0x40451d['where']};return db[_0xa489('0x2c')][_0xa489('0x1e')](_0x51935f)['then'](function(_0x388052){_0x6f92fa[_0xa489('0x1e')]=_0x388052;if(_0x3620d0[_0xa489('0x32')][_0xa489('0x43')]){_0x40451d[_0xa489('0x44')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xa489('0x45')](_0x40451d);})[_0xa489('0x24')](function(_0x12c44e){_0x6f92fa[_0xa489('0x46')]=_0x12c44e;return _0x6f92fa;})[_0xa489('0x24')](respondWithFilteredResult(_0x14600c,_0x40451d))[_0xa489('0x47')](handleError(_0x14600c,null));};exports[_0xa489('0x48')]=function(_0x3b5bdd,_0x4a3e82){var _0x48051f={'raw':!![],'where':{'id':_0x3b5bdd[_0xa489('0x49')]['id']}},_0x36e707={};_0x36e707[_0xa489('0x31')]=_['keys'](db[_0xa489('0x2c')]['rawAttributes']);_0x36e707[_0xa489('0x32')]=_['keys'](_0x3b5bdd['query']);_0x36e707[_0xa489('0x34')]=_['intersection'](_0x36e707[_0xa489('0x31')],_0x36e707[_0xa489('0x32')]);_0x48051f[_0xa489('0x35')]=_['intersection'](_0x36e707['model'],qs[_0xa489('0x37')](_0x3b5bdd[_0xa489('0x32')]['fields']));_0x48051f['attributes']=_0x48051f[_0xa489('0x35')]['length']?_0x48051f['attributes']:_0x36e707['model'];if(_0x3b5bdd[_0xa489('0x32')]['includeAll']){_0x48051f[_0xa489('0x44')]=[{'all':!![]}];}_0x48051f=_[_0xa489('0x41')]({},_0x48051f,_0x3b5bdd['options']);return db['SmsQueueReport'][_0xa489('0x4a')](_0x48051f)[_0xa489('0x24')](handleEntityNotFound(_0x4a3e82,null))[_0xa489('0x24')](respondWithResult(_0x4a3e82,null))['catch'](handleError(_0x4a3e82,null));};exports[_0xa489('0x4b')]=function(_0x3280d1,_0x4d59c2){return db[_0xa489('0x2c')][_0xa489('0x4b')](_0x3280d1[_0xa489('0x4c')],{})[_0xa489('0x24')](respondWithResult(_0x4d59c2,0xc9))[_0xa489('0x47')](handleError(_0x4d59c2,null));};exports[_0xa489('0x4d')]=function(_0x76fc82,_0x3b3e2c){if(_0x76fc82['body']['id']){delete _0x76fc82[_0xa489('0x4c')]['id'];}return db[_0xa489('0x2c')][_0xa489('0x4a')]({'where':{'id':_0x76fc82[_0xa489('0x49')]['id']}})[_0xa489('0x24')](handleEntityNotFound(_0x3b3e2c,null))[_0xa489('0x24')](saveUpdates(_0x76fc82[_0xa489('0x4c')],null))[_0xa489('0x24')](respondWithResult(_0x3b3e2c,null))[_0xa489('0x47')](handleError(_0x3b3e2c,null));};exports[_0xa489('0x25')]=function(_0x2591df,_0x1e676c){return db['SmsQueueReport']['find']({'where':{'id':_0x2591df['params']['id']}})[_0xa489('0x24')](handleEntityNotFound(_0x1e676c,null))[_0xa489('0x24')](removeEntity(_0x1e676c,null))[_0xa489('0x47')](handleError(_0x1e676c,null));};exports[_0xa489('0x4e')]=function(_0x4948d7,_0x153e70){return db[_0xa489('0x2c')][_0xa489('0x4e')]()[_0xa489('0x24')](respondWithResult(_0x153e70,null))[_0xa489('0x47')](handleError(_0x153e70,null));}; \ No newline at end of file +var _0x360b=['moment','bluebird','mustache','util','path','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','SmsQueueReport','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x13f6f4,_0xce8351){var _0xa72d52=function(_0x34c5d3){while(--_0x34c5d3){_0x13f6f4['push'](_0x13f6f4['shift']());}};_0xa72d52(++_0xce8351);}(_0x360b,0xdc));var _0xb360=function(_0x178b66,_0x3d4a0a){_0x178b66=_0x178b66-0x0;var _0x48bc24=_0x360b[_0x178b66];return _0x48bc24;};'use strict';var emlformat=require(_0xb360('0x0'));var rimraf=require(_0xb360('0x1'));var zipdir=require(_0xb360('0x2'));var jsonpatch=require(_0xb360('0x3'));var rp=require(_0xb360('0x4'));var moment=require(_0xb360('0x5'));var BPromise=require(_0xb360('0x6'));var Mustache=require(_0xb360('0x7'));var util=require(_0xb360('0x8'));var path=require(_0xb360('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb360('0xa'));var _=require(_0xb360('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb360('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb360('0xd'));var Redis=require(_0xb360('0xe'));var authService=require(_0xb360('0xf'));var qs=require(_0xb360('0x10'));var as=require(_0xb360('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb360('0x12'))(_0xb360('0x13'));var utils=require(_0xb360('0x14'));var config=require(_0xb360('0x15'));var licenseUtil=require(_0xb360('0x16'));var db=require(_0xb360('0x17'))['db'];function respondWithStatusCode(_0x55f3f2,_0x2e0399){_0x2e0399=_0x2e0399||0xcc;return function(_0x380fc7){if(_0x380fc7){return _0x55f3f2[_0xb360('0x18')](_0x2e0399);}return _0x55f3f2[_0xb360('0x19')](_0x2e0399)[_0xb360('0x1a')]();};}function respondWithResult(_0x2605c9,_0xee8927){_0xee8927=_0xee8927||0xc8;return function(_0x485771){if(_0x485771){return _0x2605c9[_0xb360('0x19')](_0xee8927)[_0xb360('0x1b')](_0x485771);}};}function respondWithFilteredResult(_0x1ba7ba,_0x1fa990){return function(_0x517774){if(_0x517774){var _0x524202=typeof _0x1fa990[_0xb360('0x1c')]==='undefined'&&typeof _0x1fa990[_0xb360('0x1d')]===_0xb360('0x1e');var _0x1a36ca=_0x517774[_0xb360('0x1f')];var _0x254e74=_0x524202?0x0:_0x1fa990[_0xb360('0x1c')];var _0x9a3d9b=_0x524202?_0x517774['count']:_0x1fa990['offset']+_0x1fa990[_0xb360('0x1d')];var _0x4e2f68;if(_0x9a3d9b>=_0x1a36ca){_0x9a3d9b=_0x1a36ca;_0x4e2f68=0xc8;}else{_0x4e2f68=0xce;}_0x1ba7ba[_0xb360('0x19')](_0x4e2f68);return _0x1ba7ba[_0xb360('0x20')](_0xb360('0x21'),_0x254e74+'-'+_0x9a3d9b+'/'+_0x1a36ca)['json'](_0x517774);}return null;};}function patchUpdates(_0x3ab678){return function(_0x7131c3){try{jsonpatch[_0xb360('0x22')](_0x7131c3,_0x3ab678,!![]);}catch(_0x23a713){return BPromise[_0xb360('0x23')](_0x23a713);}return _0x7131c3[_0xb360('0x24')]();};}function saveUpdates(_0xf35f19,_0xaa01ec){return function(_0xbaa6ee){if(_0xbaa6ee){return _0xbaa6ee[_0xb360('0x25')](_0xf35f19)[_0xb360('0x26')](function(_0x239ef0){return _0x239ef0;});}return null;};}function removeEntity(_0x36eab1,_0x56bf34){return function(_0xf949e5){if(_0xf949e5){return _0xf949e5[_0xb360('0x27')]()['then'](function(){_0x36eab1[_0xb360('0x19')](0xcc)[_0xb360('0x1a')]();});}};}function handleEntityNotFound(_0x109634,_0x1cddb0){return function(_0x208ae6){if(!_0x208ae6){_0x109634[_0xb360('0x18')](0x194);}return _0x208ae6;};}function handleError(_0x193bd1,_0x58d1cd){_0x58d1cd=_0x58d1cd||0x1f4;return function(_0x42abb9){logger[_0xb360('0x28')](_0x42abb9[_0xb360('0x29')]);if(_0x42abb9[_0xb360('0x2a')]){delete _0x42abb9[_0xb360('0x2a')];}_0x193bd1[_0xb360('0x19')](_0x58d1cd)['send'](_0x42abb9);};}exports['index']=function(_0x41f44d,_0x15f0e4){var _0xceb320={},_0x3160a4={},_0x90591d={'count':0x0,'rows':[]};var _0x45301b=_[_0xb360('0x2b')](db['SmsQueueReport'][_0xb360('0x2c')],function(_0x51dcd5){return{'name':_0x51dcd5[_0xb360('0x2d')],'type':_0x51dcd5[_0xb360('0x2e')]['key']};});_0x3160a4['model']=_[_0xb360('0x2b')](_0x45301b,_0xb360('0x2a'));_0x3160a4[_0xb360('0x2f')]=_['keys'](_0x41f44d[_0xb360('0x2f')]);_0x3160a4[_0xb360('0x30')]=_[_0xb360('0x31')](_0x3160a4[_0xb360('0x32')],_0x3160a4[_0xb360('0x2f')]);_0xceb320[_0xb360('0x33')]=_[_0xb360('0x31')](_0x3160a4['model'],qs['fields'](_0x41f44d[_0xb360('0x2f')][_0xb360('0x34')]));_0xceb320[_0xb360('0x33')]=_0xceb320['attributes'][_0xb360('0x35')]?_0xceb320[_0xb360('0x33')]:_0x3160a4['model'];if(!_0x41f44d[_0xb360('0x2f')][_0xb360('0x36')](_0xb360('0x37'))){_0xceb320[_0xb360('0x1d')]=qs['limit'](_0x41f44d[_0xb360('0x2f')][_0xb360('0x1d')]);_0xceb320['offset']=qs['offset'](_0x41f44d[_0xb360('0x2f')][_0xb360('0x1c')]);}_0xceb320[_0xb360('0x38')]=qs[_0xb360('0x39')](_0x41f44d[_0xb360('0x2f')]['sort']);_0xceb320[_0xb360('0x3a')]=qs['filters'](_[_0xb360('0x3b')](_0x41f44d[_0xb360('0x2f')],_0x3160a4['filters']),_0x45301b);if(_0x41f44d[_0xb360('0x2f')][_0xb360('0x3c')]){_0xceb320[_0xb360('0x3a')]=_[_0xb360('0x3d')](_0xceb320[_0xb360('0x3a')],{'$or':_[_0xb360('0x2b')](_0x45301b,function(_0xa4bf02){if(_0xa4bf02[_0xb360('0x2e')]!=='VIRTUAL'){var _0x24015d={};_0x24015d[_0xa4bf02['name']]={'$like':'%'+_0x41f44d['query'][_0xb360('0x3c')]+'%'};return _0x24015d;}})});}_0xceb320=_[_0xb360('0x3d')]({},_0xceb320,_0x41f44d[_0xb360('0x3e')]);var _0x410cc2={'where':_0xceb320[_0xb360('0x3a')]};return db['SmsQueueReport']['count'](_0x410cc2)[_0xb360('0x26')](function(_0x2784a7){_0x90591d[_0xb360('0x1f')]=_0x2784a7;if(_0x41f44d[_0xb360('0x2f')][_0xb360('0x3f')]){_0xceb320[_0xb360('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb360('0x41')](_0xceb320);})['then'](function(_0x3b9669){_0x90591d[_0xb360('0x42')]=_0x3b9669;return _0x90591d;})[_0xb360('0x26')](respondWithFilteredResult(_0x15f0e4,_0xceb320))[_0xb360('0x43')](handleError(_0x15f0e4,null));};exports[_0xb360('0x44')]=function(_0x50bff3,_0x51f162){var _0x3e6eaf={'raw':!![],'where':{'id':_0x50bff3['params']['id']}},_0x3e5f73={};_0x3e5f73['model']=_[_0xb360('0x45')](db[_0xb360('0x46')][_0xb360('0x2c')]);_0x3e5f73[_0xb360('0x2f')]=_[_0xb360('0x45')](_0x50bff3[_0xb360('0x2f')]);_0x3e5f73[_0xb360('0x30')]=_[_0xb360('0x31')](_0x3e5f73[_0xb360('0x32')],_0x3e5f73[_0xb360('0x2f')]);_0x3e6eaf[_0xb360('0x33')]=_['intersection'](_0x3e5f73['model'],qs[_0xb360('0x34')](_0x50bff3['query']['fields']));_0x3e6eaf[_0xb360('0x33')]=_0x3e6eaf['attributes'][_0xb360('0x35')]?_0x3e6eaf['attributes']:_0x3e5f73[_0xb360('0x32')];if(_0x50bff3[_0xb360('0x2f')][_0xb360('0x3f')]){_0x3e6eaf[_0xb360('0x40')]=[{'all':!![]}];}_0x3e6eaf=_[_0xb360('0x3d')]({},_0x3e6eaf,_0x50bff3[_0xb360('0x3e')]);return db[_0xb360('0x46')]['find'](_0x3e6eaf)[_0xb360('0x26')](handleEntityNotFound(_0x51f162,null))[_0xb360('0x26')](respondWithResult(_0x51f162,null))[_0xb360('0x43')](handleError(_0x51f162,null));};exports[_0xb360('0x47')]=function(_0x46cb04,_0x41368d){return db['SmsQueueReport'][_0xb360('0x47')](_0x46cb04['body'],{})['then'](respondWithResult(_0x41368d,0xc9))['catch'](handleError(_0x41368d,null));};exports[_0xb360('0x25')]=function(_0x556216,_0x307ca0){if(_0x556216[_0xb360('0x48')]['id']){delete _0x556216[_0xb360('0x48')]['id'];}return db['SmsQueueReport'][_0xb360('0x49')]({'where':{'id':_0x556216[_0xb360('0x4a')]['id']}})[_0xb360('0x26')](handleEntityNotFound(_0x307ca0,null))[_0xb360('0x26')](saveUpdates(_0x556216[_0xb360('0x48')],null))[_0xb360('0x26')](respondWithResult(_0x307ca0,null))[_0xb360('0x43')](handleError(_0x307ca0,null));};exports['destroy']=function(_0x3f4d73,_0x7787d7){return db[_0xb360('0x46')]['find']({'where':{'id':_0x3f4d73[_0xb360('0x4a')]['id']}})[_0xb360('0x26')](handleEntityNotFound(_0x7787d7,null))[_0xb360('0x26')](removeEntity(_0x7787d7,null))['catch'](handleError(_0x7787d7,null));};exports['describe']=function(_0x17bc11,_0x26f006){return db[_0xb360('0x46')]['describe']()['then'](respondWithResult(_0x26f006,null))[_0xb360('0x43')](handleError(_0x26f006,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 97dde6a..62e460d 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index cc911dd..ea8db3c 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 _0xed4f=['client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','UpdateSmsQueueReport','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2a12c7,_0xc28c23){var _0x2fcf71=function(_0x215016){while(--_0x215016){_0x2a12c7['push'](_0x2a12c7['shift']());}};_0x2fcf71(++_0xc28c23);}(_0xed4f,0x14b));var _0xfed4=function(_0x6a5d8,_0x595608){_0x6a5d8=_0x6a5d8-0x0;var _0x109736=_0xed4f[_0x6a5d8];return _0x109736;};'use strict';var _=require(_0xfed4('0x0'));var util=require(_0xfed4('0x1'));var moment=require(_0xfed4('0x2'));var BPromise=require('bluebird');var rs=require(_0xfed4('0x3'));var fs=require('fs');var Redis=require(_0xfed4('0x4'));var db=require(_0xfed4('0x5'))['db'];var utils=require(_0xfed4('0x6'));var logger=require(_0xfed4('0x7'))('rpc');var config=require(_0xfed4('0x8'));var jayson=require(_0xfed4('0x9'));var client=jayson[_0xfed4('0xa')][_0xfed4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26039f,_0x1e5679,_0x239646){return new BPromise(function(_0x4ccb14,_0x5ee05d){return client['request'](_0x26039f,_0x239646)['then'](function(_0x1c5e9b){logger[_0xfed4('0xc')](_0xfed4('0xd'),_0x1e5679,_0xfed4('0xe'));logger[_0xfed4('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1e5679,_0xfed4('0xe'),JSON[_0xfed4('0x10')](_0x1c5e9b));if(_0x1c5e9b[_0xfed4('0x11')]){if(_0x1c5e9b[_0xfed4('0x11')][_0xfed4('0x12')]===0x1f4){logger[_0xfed4('0x11')](_0xfed4('0xd'),_0x1e5679,_0x1c5e9b[_0xfed4('0x11')]['message']);return _0x5ee05d(_0x1c5e9b[_0xfed4('0x11')]['message']);}logger[_0xfed4('0x11')](_0xfed4('0xd'),_0x1e5679,_0x1c5e9b[_0xfed4('0x11')][_0xfed4('0x13')]);return _0x4ccb14(_0x1c5e9b[_0xfed4('0x11')]['message']);}else{logger[_0xfed4('0xc')](_0xfed4('0xd'),_0x1e5679,_0xfed4('0xe'));_0x4ccb14(_0x1c5e9b[_0xfed4('0x14')][_0xfed4('0x13')]);}})[_0xfed4('0x15')](function(_0x487c0f){logger[_0xfed4('0x11')](_0xfed4('0xd'),_0x1e5679,_0x487c0f);_0x5ee05d(_0x487c0f);});});}exports[_0xfed4('0x16')]=function(_0x1d6230){var _0x53f850=this;return new Promise(function(_0x54fa8f,_0x51e960){return db[_0xfed4('0x17')][_0xfed4('0x18')](_0x1d6230[_0xfed4('0x19')],{'raw':_0x1d6230[_0xfed4('0x1a')]?_0x1d6230[_0xfed4('0x1a')][_0xfed4('0x1b')]===undefined?!![]:![]:!![]})[_0xfed4('0x1c')](function(_0x25f04d){logger['info']('CreateSmsQueueReport',_0x1d6230);logger['debug'](_0xfed4('0x16'),_0x1d6230,JSON[_0xfed4('0x10')](_0x25f04d));_0x54fa8f(_0x25f04d);})[_0xfed4('0x15')](function(_0x527474){logger[_0xfed4('0x11')](_0xfed4('0x16'),_0x527474[_0xfed4('0x13')],_0x1d6230);_0x51e960(_0x53f850[_0xfed4('0x11')](0x1f4,_0x527474[_0xfed4('0x13')]));});});};exports[_0xfed4('0x1d')]=function(_0x554031){var _0x3cdba8=this;return new Promise(function(_0x22ebff,_0x3aa222){return db[_0xfed4('0x17')]['update'](_0x554031[_0xfed4('0x19')],{'raw':_0x554031[_0xfed4('0x1a')]?_0x554031[_0xfed4('0x1a')][_0xfed4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x554031[_0xfed4('0x1a')]?_0x554031[_0xfed4('0x1a')]['where']||null:null,'attributes':_0x554031['options']?_0x554031[_0xfed4('0x1a')][_0xfed4('0x1e')]||null:null,'limit':_0x554031[_0xfed4('0x1a')]?_0x554031[_0xfed4('0x1a')]['limit']||null:null})[_0xfed4('0x1c')](function(_0x2e74b0){logger[_0xfed4('0xc')](_0xfed4('0x1d'),_0x554031);logger[_0xfed4('0xf')](_0xfed4('0x1d'),_0x554031,JSON['stringify'](_0x2e74b0));_0x22ebff(_0x2e74b0);})[_0xfed4('0x15')](function(_0x13ffb0){logger['error'](_0xfed4('0x1d'),_0x13ffb0['message'],_0x554031);_0x3aa222(_0x3cdba8['error'](0x1f4,_0x13ffb0[_0xfed4('0x13')]));});});}; \ No newline at end of file +var _0xb4a8=['body','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','SmsQueueReport','create','options','raw','CreateSmsQueueReport','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb4a8,0x1f4));var _0x8b4a=function(_0x38841c,_0x1af0bf){_0x38841c=_0x38841c-0x0;var _0x500610=_0xb4a8[_0x38841c];return _0x500610;};'use strict';var _=require(_0x8b4a('0x0'));var util=require(_0x8b4a('0x1'));var moment=require(_0x8b4a('0x2'));var BPromise=require(_0x8b4a('0x3'));var rs=require(_0x8b4a('0x4'));var fs=require('fs');var Redis=require(_0x8b4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b4a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8b4a('0x7'));var jayson=require(_0x8b4a('0x8'));var client=jayson[_0x8b4a('0x9')][_0x8b4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cfc52,_0x23ab30,_0x31450f){return new BPromise(function(_0x291808,_0x499cbb){return client['request'](_0x2cfc52,_0x31450f)[_0x8b4a('0xb')](function(_0x1c7048){logger['info'](_0x8b4a('0xc'),_0x23ab30,'request\x20sent');logger[_0x8b4a('0xd')](_0x8b4a('0xe'),_0x23ab30,_0x8b4a('0xf'),JSON[_0x8b4a('0x10')](_0x1c7048));if(_0x1c7048[_0x8b4a('0x11')]){if(_0x1c7048[_0x8b4a('0x11')]['code']===0x1f4){logger[_0x8b4a('0x11')](_0x8b4a('0xc'),_0x23ab30,_0x1c7048['error'][_0x8b4a('0x12')]);return _0x499cbb(_0x1c7048['error'][_0x8b4a('0x12')]);}logger['error'](_0x8b4a('0xc'),_0x23ab30,_0x1c7048[_0x8b4a('0x11')][_0x8b4a('0x12')]);return _0x291808(_0x1c7048[_0x8b4a('0x11')][_0x8b4a('0x12')]);}else{logger[_0x8b4a('0x13')](_0x8b4a('0xc'),_0x23ab30,_0x8b4a('0xf'));_0x291808(_0x1c7048[_0x8b4a('0x14')][_0x8b4a('0x12')]);}})[_0x8b4a('0x15')](function(_0x5ac09b){logger[_0x8b4a('0x11')](_0x8b4a('0xc'),_0x23ab30,_0x5ac09b);_0x499cbb(_0x5ac09b);});});}exports['CreateSmsQueueReport']=function(_0x4eaaaa){var _0x340bce=this;return new Promise(function(_0x295153,_0x232b08){return db[_0x8b4a('0x16')][_0x8b4a('0x17')](_0x4eaaaa['body'],{'raw':_0x4eaaaa[_0x8b4a('0x18')]?_0x4eaaaa[_0x8b4a('0x18')][_0x8b4a('0x19')]===undefined?!![]:![]:!![]})[_0x8b4a('0xb')](function(_0xc30fb2){logger[_0x8b4a('0x13')](_0x8b4a('0x1a'),_0x4eaaaa);logger[_0x8b4a('0xd')](_0x8b4a('0x1a'),_0x4eaaaa,JSON[_0x8b4a('0x10')](_0xc30fb2));_0x295153(_0xc30fb2);})[_0x8b4a('0x15')](function(_0x5f2906){logger[_0x8b4a('0x11')](_0x8b4a('0x1a'),_0x5f2906[_0x8b4a('0x12')],_0x4eaaaa);_0x232b08(_0x340bce['error'](0x1f4,_0x5f2906['message']));});});};exports['UpdateSmsQueueReport']=function(_0x52dec8){var _0x330623=this;return new Promise(function(_0x1342f8,_0xa20e37){return db[_0x8b4a('0x16')][_0x8b4a('0x1b')](_0x52dec8[_0x8b4a('0x1c')],{'raw':_0x52dec8[_0x8b4a('0x18')]?_0x52dec8[_0x8b4a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52dec8['options']?_0x52dec8[_0x8b4a('0x18')][_0x8b4a('0x1d')]||null:null,'attributes':_0x52dec8['options']?_0x52dec8[_0x8b4a('0x18')][_0x8b4a('0x1e')]||null:null,'limit':_0x52dec8[_0x8b4a('0x18')]?_0x52dec8[_0x8b4a('0x18')][_0x8b4a('0x1f')]||null:null})[_0x8b4a('0xb')](function(_0x1d6630){logger['info'](_0x8b4a('0x20'),_0x52dec8);logger[_0x8b4a('0xd')](_0x8b4a('0x20'),_0x52dec8,JSON[_0x8b4a('0x10')](_0x1d6630));_0x1342f8(_0x1d6630);})[_0x8b4a('0x15')](function(_0x44c05d){logger[_0x8b4a('0x11')]('UpdateSmsQueueReport',_0x44c05d['message'],_0x52dec8);_0xa20e37(_0x330623['error'](0x1f4,_0x44c05d[_0x8b4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 13d0c1e..1d8b67a 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 _0x4873=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1a0b45,_0x8e5c15){var _0x24b4ef=function(_0x663c33){while(--_0x663c33){_0x1a0b45['push'](_0x1a0b45['shift']());}};_0x24b4ef(++_0x8e5c15);}(_0x4873,0x1df));var _0x3487=function(_0x575055,_0x13694f){_0x575055=_0x575055-0x0;var _0x2e8e35=_0x4873[_0x575055];return _0x2e8e35;};'use strict';var multer=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var path=require(_0x3487('0x2'));var timeout=require('connect-timeout');var express=require(_0x3487('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3487('0x4'));var interaction=require(_0x3487('0x5'));var config=require(_0x3487('0x6'));var controller=require(_0x3487('0x7'));router[_0x3487('0x8')]('/',auth[_0x3487('0x9')](),controller[_0x3487('0xa')]);router[_0x3487('0x8')]('/describe',auth[_0x3487('0x9')](),controller[_0x3487('0xb')]);router[_0x3487('0x8')](_0x3487('0xc'),auth[_0x3487('0x9')](),controller['show']);router[_0x3487('0xd')]('/',auth['isAuthenticated'](),controller[_0x3487('0xe')]);router[_0x3487('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3487('0x10')]);router[_0x3487('0x11')]('/:id',auth[_0x3487('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8d0e=['/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get'];(function(_0x49280e,_0x35139b){var _0x180358=function(_0x39b1dc){while(--_0x39b1dc){_0x49280e['push'](_0x49280e['shift']());}};_0x180358(++_0x35139b);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2ed312,_0x54b4c2){_0x2ed312=_0x2ed312-0x0;var _0x5d1886=_0x8d0e[_0x2ed312];return _0x5d1886;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0xe')]);router[_0xe8d0('0xb')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller['show']);router[_0xe8d0('0x10')]('/',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x11')]);router['put']('/:id',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x12')]);router[_0xe8d0('0x13')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a34f294..df4d0e7 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x4235b3,_0x4295b9){var _0x5a6cc9=function(_0x3cd80d){while(--_0x3cd80d){_0x4235b3['push'](_0x4235b3['shift']());}};_0x5a6cc9(++_0x4295b9);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x179163,_0x516295){var _0x5a2cb2=function(_0x4f503d){while(--_0x4f503d){_0x179163['push'](_0x179163['shift']());}};_0x5a2cb2(++_0x516295);}(_0x00bb,0x1d8));var _0xb00b=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x00bb[_0x491a7f];return _0x3d8f44;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index daea9b7..7868be0 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 _0x6029=['destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','SmsTransferReport','findAll','rows','catch','show','create','body','find','params','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','squel','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update'];(function(_0x9204bb,_0x1a7a1e){var _0x52de6a=function(_0x1c4c5a){while(--_0x1c4c5a){_0x9204bb['push'](_0x9204bb['shift']());}};_0x52de6a(++_0x1a7a1e);}(_0x6029,0x142));var _0x9602=function(_0x212910,_0x336e05){_0x212910=_0x212910-0x0;var _0x5344c3=_0x6029[_0x212910];return _0x5344c3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9602('0x0'));var jsonpatch=require(_0x9602('0x1'));var rp=require(_0x9602('0x2'));var moment=require(_0x9602('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9602('0x4'));var util=require(_0x9602('0x5'));var path=require('path');var sox=require(_0x9602('0x6'));var csv=require(_0x9602('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9602('0x8'));var crypto=require('crypto');var jsforce=require(_0x9602('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9602('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9602('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9602('0xc'));var logger=require(_0x9602('0xd'))(_0x9602('0xe'));var utils=require(_0x9602('0xf'));var config=require(_0x9602('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x85d2cf,_0x8e48ba){_0x8e48ba=_0x8e48ba||0xcc;return function(_0x2e5f03){if(_0x2e5f03){return _0x85d2cf['sendStatus'](_0x8e48ba);}return _0x85d2cf[_0x9602('0x11')](_0x8e48ba)['end']();};}function respondWithResult(_0x1f9a5b,_0x358111){_0x358111=_0x358111||0xc8;return function(_0x55b843){if(_0x55b843){return _0x1f9a5b['status'](_0x358111)[_0x9602('0x12')](_0x55b843);}};}function respondWithFilteredResult(_0x53a688,_0x11ea96){return function(_0x49e19){if(_0x49e19){var _0x589e79=typeof _0x11ea96['offset']===_0x9602('0x13')&&typeof _0x11ea96[_0x9602('0x14')]===_0x9602('0x13');var _0x11200f=_0x49e19[_0x9602('0x15')];var _0x2cbe8e=_0x589e79?0x0:_0x11ea96[_0x9602('0x16')];var _0x331fc6=_0x589e79?_0x49e19['count']:_0x11ea96[_0x9602('0x16')]+_0x11ea96[_0x9602('0x14')];var _0x11b778;if(_0x331fc6>=_0x11200f){_0x331fc6=_0x11200f;_0x11b778=0xc8;}else{_0x11b778=0xce;}_0x53a688['status'](_0x11b778);return _0x53a688[_0x9602('0x17')](_0x9602('0x18'),_0x2cbe8e+'-'+_0x331fc6+'/'+_0x11200f)['json'](_0x49e19);}return null;};}function patchUpdates(_0x24d5c7){return function(_0xcbae81){try{jsonpatch[_0x9602('0x19')](_0xcbae81,_0x24d5c7,!![]);}catch(_0x393658){return BPromise[_0x9602('0x1a')](_0x393658);}return _0xcbae81['save']();};}function saveUpdates(_0x1e5b2d,_0x442b13){return function(_0x21d4e1){if(_0x21d4e1){return _0x21d4e1[_0x9602('0x1b')](_0x1e5b2d)['then'](function(_0x5c08fc){return _0x5c08fc;});}return null;};}function removeEntity(_0x5539df,_0x511ffb){return function(_0x1ed9e8){if(_0x1ed9e8){return _0x1ed9e8[_0x9602('0x1c')]()[_0x9602('0x1d')](function(){_0x5539df[_0x9602('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56636c,_0x47eeb4){return function(_0x2a1ad6){if(!_0x2a1ad6){_0x56636c[_0x9602('0x1e')](0x194);}return _0x2a1ad6;};}function handleError(_0x224a42,_0x2e3563){_0x2e3563=_0x2e3563||0x1f4;return function(_0xfe86a2){logger[_0x9602('0x1f')](_0xfe86a2[_0x9602('0x20')]);if(_0xfe86a2['name']){delete _0xfe86a2[_0x9602('0x21')];}_0x224a42[_0x9602('0x11')](_0x2e3563)[_0x9602('0x22')](_0xfe86a2);};}exports[_0x9602('0x23')]=function(_0x4d8c5c,_0x5e8203){var _0x438010={},_0x18d3d2={},_0x3cdc82={'count':0x0,'rows':[]};var _0x571987=_[_0x9602('0x24')](db['SmsTransferReport'][_0x9602('0x25')],function(_0x223d8d){return{'name':_0x223d8d[_0x9602('0x26')],'type':_0x223d8d['type'][_0x9602('0x27')]};});_0x18d3d2[_0x9602('0x28')]=_[_0x9602('0x24')](_0x571987,_0x9602('0x21'));_0x18d3d2[_0x9602('0x29')]=_[_0x9602('0x2a')](_0x4d8c5c[_0x9602('0x29')]);_0x18d3d2[_0x9602('0x2b')]=_[_0x9602('0x2c')](_0x18d3d2[_0x9602('0x28')],_0x18d3d2[_0x9602('0x29')]);_0x438010[_0x9602('0x2d')]=_[_0x9602('0x2c')](_0x18d3d2[_0x9602('0x28')],qs[_0x9602('0x2e')](_0x4d8c5c[_0x9602('0x29')][_0x9602('0x2e')]));_0x438010[_0x9602('0x2d')]=_0x438010[_0x9602('0x2d')][_0x9602('0x2f')]?_0x438010[_0x9602('0x2d')]:_0x18d3d2[_0x9602('0x28')];if(!_0x4d8c5c[_0x9602('0x29')][_0x9602('0x30')](_0x9602('0x31'))){_0x438010[_0x9602('0x14')]=qs[_0x9602('0x14')](_0x4d8c5c['query']['limit']);_0x438010[_0x9602('0x16')]=qs['offset'](_0x4d8c5c['query']['offset']);}_0x438010[_0x9602('0x32')]=qs[_0x9602('0x33')](_0x4d8c5c[_0x9602('0x29')][_0x9602('0x33')]);_0x438010['where']=qs['filters'](_[_0x9602('0x34')](_0x4d8c5c[_0x9602('0x29')],_0x18d3d2[_0x9602('0x2b')]),_0x571987);if(_0x4d8c5c['query'][_0x9602('0x35')]){_0x438010[_0x9602('0x36')]=_[_0x9602('0x37')](_0x438010[_0x9602('0x36')],{'$or':_['map'](_0x571987,function(_0x53f499){if(_0x53f499[_0x9602('0x38')]!==_0x9602('0x39')){var _0x96b7ea={};_0x96b7ea[_0x53f499[_0x9602('0x21')]]={'$like':'%'+_0x4d8c5c[_0x9602('0x29')][_0x9602('0x35')]+'%'};return _0x96b7ea;}})});}_0x438010=_['merge']({},_0x438010,_0x4d8c5c[_0x9602('0x3a')]);var _0x4aec4b={'where':_0x438010['where']};return db['SmsTransferReport'][_0x9602('0x15')](_0x4aec4b)[_0x9602('0x1d')](function(_0x3e24cf){_0x3cdc82[_0x9602('0x15')]=_0x3e24cf;if(_0x4d8c5c[_0x9602('0x29')][_0x9602('0x3b')]){_0x438010['include']=[{'all':!![]}];}return db[_0x9602('0x3c')][_0x9602('0x3d')](_0x438010);})[_0x9602('0x1d')](function(_0x1d6ef2){_0x3cdc82[_0x9602('0x3e')]=_0x1d6ef2;return _0x3cdc82;})[_0x9602('0x1d')](respondWithFilteredResult(_0x5e8203,_0x438010))[_0x9602('0x3f')](handleError(_0x5e8203,null));};exports[_0x9602('0x40')]=function(_0x3c0ef8,_0x5850ef){var _0x18c92e={'raw':!![],'where':{'id':_0x3c0ef8['params']['id']}},_0x2b3461={};_0x2b3461[_0x9602('0x28')]=_['keys'](db[_0x9602('0x3c')][_0x9602('0x25')]);_0x2b3461[_0x9602('0x29')]=_['keys'](_0x3c0ef8['query']);_0x2b3461[_0x9602('0x2b')]=_[_0x9602('0x2c')](_0x2b3461[_0x9602('0x28')],_0x2b3461[_0x9602('0x29')]);_0x18c92e[_0x9602('0x2d')]=_['intersection'](_0x2b3461[_0x9602('0x28')],qs[_0x9602('0x2e')](_0x3c0ef8['query'][_0x9602('0x2e')]));_0x18c92e[_0x9602('0x2d')]=_0x18c92e[_0x9602('0x2d')][_0x9602('0x2f')]?_0x18c92e[_0x9602('0x2d')]:_0x2b3461[_0x9602('0x28')];if(_0x3c0ef8[_0x9602('0x29')]['includeAll']){_0x18c92e['include']=[{'all':!![]}];}_0x18c92e=_[_0x9602('0x37')]({},_0x18c92e,_0x3c0ef8[_0x9602('0x3a')]);return db['SmsTransferReport']['find'](_0x18c92e)[_0x9602('0x1d')](handleEntityNotFound(_0x5850ef,null))[_0x9602('0x1d')](respondWithResult(_0x5850ef,null))['catch'](handleError(_0x5850ef,null));};exports[_0x9602('0x41')]=function(_0x153195,_0x10afd0){return db['SmsTransferReport'][_0x9602('0x41')](_0x153195[_0x9602('0x42')],{})['then'](respondWithResult(_0x10afd0,0xc9))[_0x9602('0x3f')](handleError(_0x10afd0,null));};exports[_0x9602('0x1b')]=function(_0x1e98a9,_0x5431d4){if(_0x1e98a9[_0x9602('0x42')]['id']){delete _0x1e98a9[_0x9602('0x42')]['id'];}return db[_0x9602('0x3c')][_0x9602('0x43')]({'where':{'id':_0x1e98a9[_0x9602('0x44')]['id']}})[_0x9602('0x1d')](handleEntityNotFound(_0x5431d4,null))[_0x9602('0x1d')](saveUpdates(_0x1e98a9['body'],null))[_0x9602('0x1d')](respondWithResult(_0x5431d4,null))[_0x9602('0x3f')](handleError(_0x5431d4,null));};exports[_0x9602('0x1c')]=function(_0x27acc1,_0x5889a2){return db[_0x9602('0x3c')][_0x9602('0x43')]({'where':{'id':_0x27acc1[_0x9602('0x44')]['id']}})[_0x9602('0x1d')](handleEntityNotFound(_0x5889a2,null))[_0x9602('0x1d')](removeEntity(_0x5889a2,null))[_0x9602('0x3f')](handleError(_0x5889a2,null));};exports['describe']=function(_0x4e8ce3,_0x26c37b){return db['SmsTransferReport'][_0x9602('0x45')]()[_0x9602('0x1d')](respondWithResult(_0x26c37b,null))[_0x9602('0x3f')](handleError(_0x26c37b,null));}; \ No newline at end of file +var _0xfe94=['reject','save','update','then','destroy','end','error','name','send','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply'];(function(_0x59aa4f,_0x66d7c3){var _0x2c6aaf=function(_0x272140){while(--_0x272140){_0x59aa4f['push'](_0x59aa4f['shift']());}};_0x2c6aaf(++_0x66d7c3);}(_0xfe94,0x7b));var _0x4fe9=function(_0x411d08,_0x31bb00){_0x411d08=_0x411d08-0x0;var _0x45b506=_0xfe94[_0x411d08];return _0x45b506;};'use strict';var emlformat=require(_0x4fe9('0x0'));var rimraf=require(_0x4fe9('0x1'));var zipdir=require(_0x4fe9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4fe9('0x3'));var BPromise=require(_0x4fe9('0x4'));var Mustache=require(_0x4fe9('0x5'));var util=require('util');var path=require(_0x4fe9('0x6'));var sox=require(_0x4fe9('0x7'));var csv=require(_0x4fe9('0x8'));var ejs=require(_0x4fe9('0x9'));var fs=require('fs');var fs_extra=require(_0x4fe9('0xa'));var _=require(_0x4fe9('0xb'));var squel=require('squel');var crypto=require(_0x4fe9('0xc'));var jsforce=require(_0x4fe9('0xd'));var deskjs=require(_0x4fe9('0xe'));var toCsv=require(_0x4fe9('0x8'));var querystring=require(_0x4fe9('0xf'));var Papa=require(_0x4fe9('0x10'));var Redis=require(_0x4fe9('0x11'));var authService=require(_0x4fe9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4fe9('0x13'));var hardwareService=require(_0x4fe9('0x14'));var logger=require(_0x4fe9('0x15'))(_0x4fe9('0x16'));var utils=require(_0x4fe9('0x17'));var config=require(_0x4fe9('0x18'));var licenseUtil=require(_0x4fe9('0x19'));var db=require(_0x4fe9('0x1a'))['db'];function respondWithStatusCode(_0x197cdf,_0x3e599a){_0x3e599a=_0x3e599a||0xcc;return function(_0x2ad4b6){if(_0x2ad4b6){return _0x197cdf[_0x4fe9('0x1b')](_0x3e599a);}return _0x197cdf[_0x4fe9('0x1c')](_0x3e599a)['end']();};}function respondWithResult(_0x4bd263,_0x3ad92a){_0x3ad92a=_0x3ad92a||0xc8;return function(_0x31f9c1){if(_0x31f9c1){return _0x4bd263[_0x4fe9('0x1c')](_0x3ad92a)['json'](_0x31f9c1);}};}function respondWithFilteredResult(_0x575991,_0x5482a0){return function(_0x2c83f4){if(_0x2c83f4){var _0x2183b4=typeof _0x5482a0['offset']===_0x4fe9('0x1d')&&typeof _0x5482a0['limit']==='undefined';var _0xdbea8c=_0x2c83f4[_0x4fe9('0x1e')];var _0x45b40a=_0x2183b4?0x0:_0x5482a0['offset'];var _0x2896b5=_0x2183b4?_0x2c83f4[_0x4fe9('0x1e')]:_0x5482a0[_0x4fe9('0x1f')]+_0x5482a0[_0x4fe9('0x20')];var _0x315dc7;if(_0x2896b5>=_0xdbea8c){_0x2896b5=_0xdbea8c;_0x315dc7=0xc8;}else{_0x315dc7=0xce;}_0x575991['status'](_0x315dc7);return _0x575991[_0x4fe9('0x21')](_0x4fe9('0x22'),_0x45b40a+'-'+_0x2896b5+'/'+_0xdbea8c)[_0x4fe9('0x23')](_0x2c83f4);}return null;};}function patchUpdates(_0x395d20){return function(_0x28df13){try{jsonpatch[_0x4fe9('0x24')](_0x28df13,_0x395d20,!![]);}catch(_0x4046cb){return BPromise[_0x4fe9('0x25')](_0x4046cb);}return _0x28df13[_0x4fe9('0x26')]();};}function saveUpdates(_0x159e5c,_0x470216){return function(_0x4f36db){if(_0x4f36db){return _0x4f36db[_0x4fe9('0x27')](_0x159e5c)[_0x4fe9('0x28')](function(_0x3bc6fd){return _0x3bc6fd;});}return null;};}function removeEntity(_0x2286bc,_0x232aa0){return function(_0x4e63f6){if(_0x4e63f6){return _0x4e63f6[_0x4fe9('0x29')]()['then'](function(){_0x2286bc[_0x4fe9('0x1c')](0xcc)[_0x4fe9('0x2a')]();});}};}function handleEntityNotFound(_0x4f9edf,_0x37873a){return function(_0x568458){if(!_0x568458){_0x4f9edf['sendStatus'](0x194);}return _0x568458;};}function handleError(_0x4965a0,_0x1c0a6f){_0x1c0a6f=_0x1c0a6f||0x1f4;return function(_0x3efc1f){logger[_0x4fe9('0x2b')](_0x3efc1f['stack']);if(_0x3efc1f[_0x4fe9('0x2c')]){delete _0x3efc1f['name'];}_0x4965a0[_0x4fe9('0x1c')](_0x1c0a6f)[_0x4fe9('0x2d')](_0x3efc1f);};}exports['index']=function(_0x27ecdb,_0x58c056){var _0x432d85={},_0x5f094c={},_0x4e67f0={'count':0x0,'rows':[]};var _0x28418e=_['map'](db[_0x4fe9('0x2e')][_0x4fe9('0x2f')],function(_0x579191){return{'name':_0x579191[_0x4fe9('0x30')],'type':_0x579191[_0x4fe9('0x31')][_0x4fe9('0x32')]};});_0x5f094c[_0x4fe9('0x33')]=_[_0x4fe9('0x34')](_0x28418e,_0x4fe9('0x2c'));_0x5f094c['query']=_[_0x4fe9('0x35')](_0x27ecdb[_0x4fe9('0x36')]);_0x5f094c[_0x4fe9('0x37')]=_[_0x4fe9('0x38')](_0x5f094c[_0x4fe9('0x33')],_0x5f094c['query']);_0x432d85[_0x4fe9('0x39')]=_[_0x4fe9('0x38')](_0x5f094c[_0x4fe9('0x33')],qs[_0x4fe9('0x3a')](_0x27ecdb[_0x4fe9('0x36')][_0x4fe9('0x3a')]));_0x432d85[_0x4fe9('0x39')]=_0x432d85[_0x4fe9('0x39')][_0x4fe9('0x3b')]?_0x432d85[_0x4fe9('0x39')]:_0x5f094c[_0x4fe9('0x33')];if(!_0x27ecdb[_0x4fe9('0x36')][_0x4fe9('0x3c')]('nolimit')){_0x432d85[_0x4fe9('0x20')]=qs[_0x4fe9('0x20')](_0x27ecdb[_0x4fe9('0x36')][_0x4fe9('0x20')]);_0x432d85[_0x4fe9('0x1f')]=qs[_0x4fe9('0x1f')](_0x27ecdb[_0x4fe9('0x36')]['offset']);}_0x432d85[_0x4fe9('0x3d')]=qs[_0x4fe9('0x3e')](_0x27ecdb[_0x4fe9('0x36')][_0x4fe9('0x3e')]);_0x432d85[_0x4fe9('0x3f')]=qs[_0x4fe9('0x37')](_[_0x4fe9('0x40')](_0x27ecdb[_0x4fe9('0x36')],_0x5f094c['filters']),_0x28418e);if(_0x27ecdb[_0x4fe9('0x36')][_0x4fe9('0x41')]){_0x432d85[_0x4fe9('0x3f')]=_[_0x4fe9('0x42')](_0x432d85[_0x4fe9('0x3f')],{'$or':_[_0x4fe9('0x34')](_0x28418e,function(_0x1c65e7){if(_0x1c65e7[_0x4fe9('0x31')]!==_0x4fe9('0x43')){var _0x15985c={};_0x15985c[_0x1c65e7[_0x4fe9('0x2c')]]={'$like':'%'+_0x27ecdb[_0x4fe9('0x36')][_0x4fe9('0x41')]+'%'};return _0x15985c;}})});}_0x432d85=_['merge']({},_0x432d85,_0x27ecdb[_0x4fe9('0x44')]);var _0x4d6b6b={'where':_0x432d85[_0x4fe9('0x3f')]};return db[_0x4fe9('0x2e')][_0x4fe9('0x1e')](_0x4d6b6b)[_0x4fe9('0x28')](function(_0x5b049c){_0x4e67f0[_0x4fe9('0x1e')]=_0x5b049c;if(_0x27ecdb['query'][_0x4fe9('0x45')]){_0x432d85[_0x4fe9('0x46')]=[{'all':!![]}];}return db[_0x4fe9('0x2e')][_0x4fe9('0x47')](_0x432d85);})[_0x4fe9('0x28')](function(_0x275920){_0x4e67f0[_0x4fe9('0x48')]=_0x275920;return _0x4e67f0;})['then'](respondWithFilteredResult(_0x58c056,_0x432d85))[_0x4fe9('0x49')](handleError(_0x58c056,null));};exports[_0x4fe9('0x4a')]=function(_0x2ee35d,_0x35485d){var _0x4786d7={'raw':!![],'where':{'id':_0x2ee35d[_0x4fe9('0x4b')]['id']}},_0x393a8c={};_0x393a8c[_0x4fe9('0x33')]=_[_0x4fe9('0x35')](db['SmsTransferReport'][_0x4fe9('0x2f')]);_0x393a8c['query']=_[_0x4fe9('0x35')](_0x2ee35d[_0x4fe9('0x36')]);_0x393a8c['filters']=_['intersection'](_0x393a8c['model'],_0x393a8c[_0x4fe9('0x36')]);_0x4786d7[_0x4fe9('0x39')]=_[_0x4fe9('0x38')](_0x393a8c[_0x4fe9('0x33')],qs['fields'](_0x2ee35d[_0x4fe9('0x36')][_0x4fe9('0x3a')]));_0x4786d7[_0x4fe9('0x39')]=_0x4786d7[_0x4fe9('0x39')][_0x4fe9('0x3b')]?_0x4786d7[_0x4fe9('0x39')]:_0x393a8c[_0x4fe9('0x33')];if(_0x2ee35d[_0x4fe9('0x36')]['includeAll']){_0x4786d7[_0x4fe9('0x46')]=[{'all':!![]}];}_0x4786d7=_[_0x4fe9('0x42')]({},_0x4786d7,_0x2ee35d[_0x4fe9('0x44')]);return db[_0x4fe9('0x2e')]['find'](_0x4786d7)[_0x4fe9('0x28')](handleEntityNotFound(_0x35485d,null))[_0x4fe9('0x28')](respondWithResult(_0x35485d,null))[_0x4fe9('0x49')](handleError(_0x35485d,null));};exports[_0x4fe9('0x4c')]=function(_0x4b4fe5,_0x2ef56d){return db[_0x4fe9('0x2e')][_0x4fe9('0x4c')](_0x4b4fe5[_0x4fe9('0x4d')],{})[_0x4fe9('0x28')](respondWithResult(_0x2ef56d,0xc9))[_0x4fe9('0x49')](handleError(_0x2ef56d,null));};exports[_0x4fe9('0x27')]=function(_0x4f5dab,_0x1c81b2){if(_0x4f5dab[_0x4fe9('0x4d')]['id']){delete _0x4f5dab[_0x4fe9('0x4d')]['id'];}return db[_0x4fe9('0x2e')][_0x4fe9('0x4e')]({'where':{'id':_0x4f5dab['params']['id']}})[_0x4fe9('0x28')](handleEntityNotFound(_0x1c81b2,null))['then'](saveUpdates(_0x4f5dab[_0x4fe9('0x4d')],null))[_0x4fe9('0x28')](respondWithResult(_0x1c81b2,null))[_0x4fe9('0x49')](handleError(_0x1c81b2,null));};exports['destroy']=function(_0x39f432,_0x49c9d7){return db[_0x4fe9('0x2e')]['find']({'where':{'id':_0x39f432['params']['id']}})[_0x4fe9('0x28')](handleEntityNotFound(_0x49c9d7,null))[_0x4fe9('0x28')](removeEntity(_0x49c9d7,null))[_0x4fe9('0x49')](handleError(_0x49c9d7,null));};exports[_0x4fe9('0x4f')]=function(_0x49f6a5,_0x3d43e8){return db[_0x4fe9('0x2e')][_0x4fe9('0x4f')]()['then'](respondWithResult(_0x3d43e8,null))['catch'](handleError(_0x3d43e8,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 00e5b64..7a0e419 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 _0xac31=['request-promise','rimraf','../../config/environment','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x21929f,_0xb96182){var _0x1a6077=function(_0x209786){while(--_0x209786){_0x21929f['push'](_0x21929f['shift']());}};_0x1a6077(++_0xb96182);}(_0xac31,0xca));var _0x1ac3=function(_0x42d885,_0x5b6877){_0x42d885=_0x42d885-0x0;var _0x4ef8de=_0xac31[_0x42d885];return _0x4ef8de;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1ac3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24e2=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x9cb341,_0x2469a5){var _0x4f5790=function(_0x56deee){while(--_0x56deee){_0x9cb341['push'](_0x9cb341['shift']());}};_0x4f5790(++_0x2469a5);}(_0x24e2,0x1c1));var _0x224e=function(_0x55f2f4,_0x20b686){_0x55f2f4=_0x55f2f4-0x0;var _0x3bcdbb=_0x24e2[_0x55f2f4];return _0x3bcdbb;};'use strict';var _=require(_0x224e('0x0'));var util=require(_0x224e('0x1'));var logger=require('../../config/logger')(_0x224e('0x2'));var moment=require(_0x224e('0x3'));var BPromise=require(_0x224e('0x4'));var rp=require(_0x224e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x224e('0x6'));var config=require(_0x224e('0x7'));var attributes=require(_0x224e('0x8'));module[_0x224e('0x9')]=function(_0x565234,_0x2a76e8){return _0x565234[_0x224e('0xa')](_0x224e('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x224e('0xc'),'fields':[_0x224e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 1eddd55..e0c87d4 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 _0x99fb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash'];(function(_0x7909d5,_0x16901a){var _0x3e14d7=function(_0x56cec0){while(--_0x56cec0){_0x7909d5['push'](_0x7909d5['shift']());}};_0x3e14d7(++_0x16901a);}(_0x99fb,0x92));var _0xb99f=function(_0x17bff4,_0x3bbe37){_0x17bff4=_0x17bff4-0x0;var _0x1b31a3=_0x99fb[_0x17bff4];return _0x1b31a3;};'use strict';var _=require(_0xb99f('0x0'));var util=require('util');var moment=require(_0xb99f('0x1'));var BPromise=require(_0xb99f('0x2'));var rs=require(_0xb99f('0x3'));var fs=require('fs');var Redis=require(_0xb99f('0x4'));var db=require(_0xb99f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb99f('0x6'))(_0xb99f('0x7'));var config=require('../../config/environment');var jayson=require(_0xb99f('0x8'));var client=jayson[_0xb99f('0x9')][_0xb99f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f264e,_0x182c0c,_0x479d65){return new BPromise(function(_0xe317ff,_0x57b816){return client[_0xb99f('0xb')](_0x5f264e,_0x479d65)[_0xb99f('0xc')](function(_0x5e944b){logger[_0xb99f('0xd')](_0xb99f('0xe'),_0x182c0c,_0xb99f('0xf'));logger[_0xb99f('0x10')](_0xb99f('0x11'),_0x182c0c,_0xb99f('0xf'),JSON[_0xb99f('0x12')](_0x5e944b));if(_0x5e944b['error']){if(_0x5e944b[_0xb99f('0x13')]['code']===0x1f4){logger['error'](_0xb99f('0xe'),_0x182c0c,_0x5e944b[_0xb99f('0x13')][_0xb99f('0x14')]);return _0x57b816(_0x5e944b[_0xb99f('0x13')][_0xb99f('0x14')]);}logger['error'](_0xb99f('0xe'),_0x182c0c,_0x5e944b['error'][_0xb99f('0x14')]);return _0xe317ff(_0x5e944b[_0xb99f('0x13')]['message']);}else{logger[_0xb99f('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x182c0c,_0xb99f('0xf'));_0xe317ff(_0x5e944b['result'][_0xb99f('0x14')]);}})['catch'](function(_0x37a14c){logger['error'](_0xb99f('0xe'),_0x182c0c,_0x37a14c);_0x57b816(_0x37a14c);});});} \ No newline at end of file +var _0xd7ce=['message','info','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd7ce,0x16b));var _0xed7c=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0xd7ce[_0x356e8d];return _0x39e65a;};'use strict';var _=require(_0xed7c('0x0'));var util=require(_0xed7c('0x1'));var moment=require(_0xed7c('0x2'));var BPromise=require(_0xed7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed7c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xed7c('0x5'));var jayson=require(_0xed7c('0x6'));var client=jayson[_0xed7c('0x7')][_0xed7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34bbd7,_0x43a9e7,_0x41afb9){return new BPromise(function(_0x270db6,_0x190af8){return client[_0xed7c('0x9')](_0x34bbd7,_0x41afb9)[_0xed7c('0xa')](function(_0x2a2a61){logger['info'](_0xed7c('0xb'),_0x43a9e7,_0xed7c('0xc'));logger[_0xed7c('0xd')](_0xed7c('0xe'),_0x43a9e7,_0xed7c('0xc'),JSON[_0xed7c('0xf')](_0x2a2a61));if(_0x2a2a61['error']){if(_0x2a2a61[_0xed7c('0x10')]['code']===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x43a9e7,_0x2a2a61[_0xed7c('0x10')][_0xed7c('0x11')]);return _0x190af8(_0x2a2a61[_0xed7c('0x10')]['message']);}logger['error'](_0xed7c('0xb'),_0x43a9e7,_0x2a2a61['error'][_0xed7c('0x11')]);return _0x270db6(_0x2a2a61[_0xed7c('0x10')]['message']);}else{logger[_0xed7c('0x12')](_0xed7c('0xb'),_0x43a9e7,'request\x20sent');_0x270db6(_0x2a2a61['result'][_0xed7c('0x11')]);}})[_0xed7c('0x13')](function(_0x358e3b){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x43a9e7,_0x358e3b);_0x190af8(_0x358e3b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 06d9903..0887d70 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 _0x7148=['exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','root','originalname','replace','format','%s-%s%s','now','single','file','create','put','update','delete'];(function(_0x2ff74b,_0x11caec){var _0x2bc35d=function(_0x3d7e1a){while(--_0x3d7e1a){_0x2ff74b['push'](_0x2ff74b['shift']());}};_0x2bc35d(++_0x11caec);}(_0x7148,0x119));var _0x8714=function(_0x5a6848,_0x4af0ad){_0x5a6848=_0x5a6848-0x0;var _0x1954a7=_0x7148[_0x5a6848];return _0x1954a7;};'use strict';var multer=require('multer');var util=require(_0x8714('0x0'));var path=require(_0x8714('0x1'));var timeout=require(_0x8714('0x2'));var express=require(_0x8714('0x3'));var router=express['Router']();var fs_extra=require(_0x8714('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8714('0x5'));var config=require(_0x8714('0x6'));var controller=require(_0x8714('0x7'));router[_0x8714('0x8')]('/',auth[_0x8714('0x9')](),controller[_0x8714('0xa')]);router[_0x8714('0x8')](_0x8714('0xb'),auth[_0x8714('0x9')](),controller['show']);router[_0x8714('0x8')](_0x8714('0xc'),auth[_0x8714('0x9')](),controller[_0x8714('0xd')]);var upload=multer({'storage':multer[_0x8714('0xe')]({'destination':function(_0x2f54f1,_0x1a5c9c,_0x507a5b){_0x507a5b(null,path['join'](config[_0x8714('0xf')],'server/files/sounds/original/'));},'filename':function(_0x16926d,_0xfc103e,_0x5e81c2){_0xfc103e['originalname']=_0xfc103e[_0x8714('0x10')][_0x8714('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e81c2(null,util[_0x8714('0x12')](_0x8714('0x13'),path['basename'](_0xfc103e[_0x8714('0x10')],path['extname'](_0xfc103e['originalname'])),Date[_0x8714('0x14')](),path['extname'](_0xfc103e[_0x8714('0x10')])));}})});router['post']('/',upload[_0x8714('0x15')](_0x8714('0x16')),controller[_0x8714('0x17')]);router[_0x8714('0x18')](_0x8714('0xb'),auth[_0x8714('0x9')](),controller[_0x8714('0x19')]);router[_0x8714('0x1a')](_0x8714('0xb'),auth[_0x8714('0x9')](),controller[_0x8714('0x1a')]);module[_0x8714('0x1b')]=router; \ No newline at end of file +var _0xe961=['post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0xe961,0xb4));var _0x1e96=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xe961[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e96('0x0'));var timeout=require(_0x1e96('0x1'));var express=require(_0x1e96('0x2'));var router=express[_0x1e96('0x3')]();var fs_extra=require(_0x1e96('0x4'));var auth=require(_0x1e96('0x5'));var interaction=require(_0x1e96('0x6'));var config=require(_0x1e96('0x7'));var controller=require(_0x1e96('0x8'));router[_0x1e96('0x9')]('/',auth[_0x1e96('0xa')](),controller['index']);router[_0x1e96('0x9')](_0x1e96('0xb'),auth['isAuthenticated'](),controller[_0x1e96('0xc')]);router[_0x1e96('0x9')](_0x1e96('0xd'),auth[_0x1e96('0xa')](),controller[_0x1e96('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x529b26,_0x2466d1,_0x1d532a){_0x1d532a(null,path[_0x1e96('0xf')](config[_0x1e96('0x10')],_0x1e96('0x11')));},'filename':function(_0x961e45,_0x4302f2,_0x539633){_0x4302f2[_0x1e96('0x12')]=_0x4302f2[_0x1e96('0x12')][_0x1e96('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x539633(null,util['format'](_0x1e96('0x14'),path[_0x1e96('0x15')](_0x4302f2[_0x1e96('0x12')],path['extname'](_0x4302f2['originalname'])),Date[_0x1e96('0x16')](),path['extname'](_0x4302f2[_0x1e96('0x12')])));}})});router[_0x1e96('0x17')]('/',upload['single']('file'),controller[_0x1e96('0x18')]);router[_0x1e96('0x19')](_0x1e96('0xb'),auth[_0x1e96('0xa')](),controller[_0x1e96('0x1a')]);router['delete'](_0x1e96('0xb'),auth[_0x1e96('0xa')](),controller[_0x1e96('0x1b')]);module[_0x1e96('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 51289a0..388fedf 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 _0xa5f2=['name','BIGINT','INTEGER','FLOAT','STRING'];(function(_0x3d6c01,_0xf7a7d2){var _0x4c1764=function(_0x310698){while(--_0x310698){_0x3d6c01['push'](_0x3d6c01['shift']());}};_0x4c1764(++_0xf7a7d2);}(_0xa5f2,0x153));var _0x2a5f=function(_0x4dbd35,_0x47d3c0){_0x4dbd35=_0x4dbd35-0x0;var _0x8ae83b=_0xa5f2[_0x4dbd35];return _0x8ae83b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2a5f('0x0')],'unique':_0x2a5f('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2a5f('0x0')]},'display_name':{'type':Sequelize[_0x2a5f('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0x2a5f('0x0')]},'original_format':{'type':Sequelize[_0x2a5f('0x0')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x2a5f('0x2')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x2a5f('0x3')]},'converted_format':{'type':Sequelize[_0x2a5f('0x0')]},'converted_duration':{'type':Sequelize[_0x2a5f('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x2a5f('0x2')]},'converted_channelCount':{'type':Sequelize[_0x2a5f('0x3')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x2a5f('0x3')]}}; \ No newline at end of file +var _0xb8c0=['BIGINT','INTEGER','sequelize','STRING','name','FLOAT'];(function(_0x28e189,_0xcd9979){var _0x38f4f2=function(_0x39fb58){while(--_0x39fb58){_0x28e189['push'](_0x28e189['shift']());}};_0x38f4f2(++_0xcd9979);}(_0xb8c0,0x7a));var _0x0b8c=function(_0x4dfb62,_0x9a3a13){_0x4dfb62=_0x4dfb62-0x0;var _0x426b11=_0xb8c0[_0x4dfb62];return _0x426b11;};'use strict';var Sequelize=require(_0x0b8c('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b8c('0x1')],'unique':_0x0b8c('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0b8c('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x0b8c('0x1')]},'original_format':{'type':Sequelize[_0x0b8c('0x1')]},'original_duration':{'type':Sequelize[_0x0b8c('0x3')]},'original_sampleCount':{'type':Sequelize[_0x0b8c('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x0b8c('0x1')]},'converted_duration':{'type':Sequelize[_0x0b8c('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x0b8c('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x0b8c('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 6ce91a1..edbc206 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 _0x95dd=['api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','get','destroy','error','stack','name','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','Sound','includeAll','include','findAll','rows','catch','show','params','length','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','send','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Sounds','autoAssociation','UserProfileResource','start','update','description','server/files/sounds/original','original_format','unlinkSync','eml-format','zip-dir','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x37d365,_0x12e913){var _0x458ced=function(_0x32e675){while(--_0x32e675){_0x37d365['push'](_0x37d365['shift']());}};_0x458ced(++_0x12e913);}(_0x95dd,0x15b));var _0xd95d=function(_0x1b6ea7,_0x216747){_0x1b6ea7=_0x1b6ea7-0x0;var _0x3922b1=_0x95dd[_0x1b6ea7];return _0x3922b1;};'use strict';var emlformat=require(_0xd95d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd95d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd95d('0x2'));var BPromise=require(_0xd95d('0x3'));var Mustache=require(_0xd95d('0x4'));var util=require('util');var path=require(_0xd95d('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd95d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd95d('0x7'));var squel=require(_0xd95d('0x8'));var crypto=require(_0xd95d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd95d('0xa'));var toCsv=require(_0xd95d('0xb'));var querystring=require(_0xd95d('0xc'));var Papa=require(_0xd95d('0xd'));var Redis=require('ioredis');var authService=require(_0xd95d('0xe'));var qs=require(_0xd95d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd95d('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd95d('0x11'));var db=require(_0xd95d('0x12'))['db'];function respondWithStatusCode(_0x4e3635,_0x5bd346){_0x5bd346=_0x5bd346||0xcc;return function(_0x4b1082){if(_0x4b1082){return _0x4e3635[_0xd95d('0x13')](_0x5bd346);}return _0x4e3635[_0xd95d('0x14')](_0x5bd346)[_0xd95d('0x15')]();};}function respondWithResult(_0x3c0645,_0x49584f){_0x49584f=_0x49584f||0xc8;return function(_0x23fd84){if(_0x23fd84){return _0x3c0645['status'](_0x49584f)[_0xd95d('0x16')](_0x23fd84);}};}function respondWithFilteredResult(_0x3730e9,_0x1e942b){return function(_0x3e4333){if(_0x3e4333){var _0x4e6ada=typeof _0x1e942b['offset']===_0xd95d('0x17')&&typeof _0x1e942b[_0xd95d('0x18')]==='undefined';var _0x1c476c=_0x3e4333[_0xd95d('0x19')];var _0x22632b=_0x4e6ada?0x0:_0x1e942b['offset'];var _0x552c47=_0x4e6ada?_0x3e4333['count']:_0x1e942b[_0xd95d('0x1a')]+_0x1e942b[_0xd95d('0x18')];var _0x16d0f8;if(_0x552c47>=_0x1c476c){_0x552c47=_0x1c476c;_0x16d0f8=0xc8;}else{_0x16d0f8=0xce;}_0x3730e9[_0xd95d('0x14')](_0x16d0f8);return _0x3730e9[_0xd95d('0x1b')](_0xd95d('0x1c'),_0x22632b+'-'+_0x552c47+'/'+_0x1c476c)[_0xd95d('0x16')](_0x3e4333);}return null;};}function patchUpdates(_0x4b3400){return function(_0x8458bb){try{jsonpatch[_0xd95d('0x1d')](_0x8458bb,_0x4b3400,!![]);}catch(_0x50d8b5){return BPromise[_0xd95d('0x1e')](_0x50d8b5);}return _0x8458bb['save']();};}function saveUpdates(_0x4e26c9,_0x317184){return function(_0x422933){if(_0x422933){return _0x422933['update'](_0x4e26c9)[_0xd95d('0x1f')](function(_0x210ef9){return _0x210ef9;});}return null;};}function removeEntity(_0x48836b,_0x255616){return function(_0x42904a){if(_0x42904a){return _0x42904a['destroy']()[_0xd95d('0x1f')](function(){var _0x4fb52b=_0x42904a[_0xd95d('0x20')]({'plain':!![]});var _0x199093='Sounds';return db['UserProfileResource'][_0xd95d('0x21')]({'where':{'type':_0x199093,'resourceId':_0x4fb52b['id']}})[_0xd95d('0x1f')](function(){return _0x42904a;});})['then'](function(){_0x48836b[_0xd95d('0x14')](0xcc)[_0xd95d('0x15')]();});}};}function handleEntityNotFound(_0x19b345,_0x28227d){return function(_0x254e8a){if(!_0x254e8a){_0x19b345[_0xd95d('0x13')](0x194);}return _0x254e8a;};}function handleError(_0x286d86,_0x460bd9){_0x460bd9=_0x460bd9||0x1f4;return function(_0x30cf3e){logger[_0xd95d('0x22')](_0x30cf3e[_0xd95d('0x23')]);if(_0x30cf3e[_0xd95d('0x24')]){delete _0x30cf3e['name'];}_0x286d86[_0xd95d('0x14')](_0x460bd9)['send'](_0x30cf3e);};}exports['index']=function(_0xb4d7e,_0x329285){var _0x2d4599={},_0x451f1c={},_0x2d0a8a={'count':0x0,'rows':[]};var _0xf891ce=_['map'](db['Sound'][_0xd95d('0x25')],function(_0x495343){return{'name':_0x495343[_0xd95d('0x26')],'type':_0x495343[_0xd95d('0x27')][_0xd95d('0x28')]};});_0x451f1c[_0xd95d('0x29')]=_['map'](_0xf891ce,_0xd95d('0x24'));_0x451f1c['query']=_[_0xd95d('0x2a')](_0xb4d7e['query']);_0x451f1c[_0xd95d('0x2b')]=_[_0xd95d('0x2c')](_0x451f1c[_0xd95d('0x29')],_0x451f1c[_0xd95d('0x2d')]);_0x2d4599[_0xd95d('0x2e')]=_['intersection'](_0x451f1c['model'],qs[_0xd95d('0x2f')](_0xb4d7e[_0xd95d('0x2d')]['fields']));_0x2d4599[_0xd95d('0x2e')]=_0x2d4599['attributes']['length']?_0x2d4599[_0xd95d('0x2e')]:_0x451f1c['model'];if(!_0xb4d7e['query']['hasOwnProperty'](_0xd95d('0x30'))){_0x2d4599['limit']=qs[_0xd95d('0x18')](_0xb4d7e[_0xd95d('0x2d')][_0xd95d('0x18')]);_0x2d4599[_0xd95d('0x1a')]=qs['offset'](_0xb4d7e['query'][_0xd95d('0x1a')]);}_0x2d4599['order']=qs['sort'](_0xb4d7e[_0xd95d('0x2d')][_0xd95d('0x31')]);_0x2d4599[_0xd95d('0x32')]=qs['filters'](_[_0xd95d('0x33')](_0xb4d7e[_0xd95d('0x2d')],_0x451f1c['filters']),_0xf891ce);if(_0xb4d7e['query'][_0xd95d('0x34')]){_0x2d4599[_0xd95d('0x32')]=_[_0xd95d('0x35')](_0x2d4599['where'],{'$or':_[_0xd95d('0x36')](_0xf891ce,function(_0x595b06){if(_0x595b06[_0xd95d('0x27')]!==_0xd95d('0x37')){var _0x3cb05d={};_0x3cb05d[_0x595b06[_0xd95d('0x24')]]={'$like':'%'+_0xb4d7e[_0xd95d('0x2d')][_0xd95d('0x34')]+'%'};return _0x3cb05d;}})});}_0x2d4599=_['merge']({},_0x2d4599,_0xb4d7e[_0xd95d('0x38')]);var _0x561cd6={'where':_0x2d4599[_0xd95d('0x32')]};return db[_0xd95d('0x39')]['count'](_0x561cd6)[_0xd95d('0x1f')](function(_0x386005){_0x2d0a8a[_0xd95d('0x19')]=_0x386005;if(_0xb4d7e['query'][_0xd95d('0x3a')]){_0x2d4599[_0xd95d('0x3b')]=[{'all':!![]}];}return db['Sound'][_0xd95d('0x3c')](_0x2d4599);})[_0xd95d('0x1f')](function(_0x2ce509){_0x2d0a8a[_0xd95d('0x3d')]=_0x2ce509;return _0x2d0a8a;})['then'](respondWithFilteredResult(_0x329285,_0x2d4599))[_0xd95d('0x3e')](handleError(_0x329285,null));};exports[_0xd95d('0x3f')]=function(_0x141165,_0x483857){var _0x4e83bb={'raw':!![],'where':{'id':_0x141165[_0xd95d('0x40')]['id']}},_0x37e76c={};_0x37e76c[_0xd95d('0x29')]=_[_0xd95d('0x2a')](db[_0xd95d('0x39')][_0xd95d('0x25')]);_0x37e76c[_0xd95d('0x2d')]=_['keys'](_0x141165[_0xd95d('0x2d')]);_0x37e76c['filters']=_[_0xd95d('0x2c')](_0x37e76c[_0xd95d('0x29')],_0x37e76c[_0xd95d('0x2d')]);_0x4e83bb['attributes']=_[_0xd95d('0x2c')](_0x37e76c[_0xd95d('0x29')],qs['fields'](_0x141165[_0xd95d('0x2d')]['fields']));_0x4e83bb[_0xd95d('0x2e')]=_0x4e83bb[_0xd95d('0x2e')][_0xd95d('0x41')]?_0x4e83bb['attributes']:_0x37e76c[_0xd95d('0x29')];if(_0x141165[_0xd95d('0x2d')]['includeAll']){_0x4e83bb['include']=[{'all':!![]}];}_0x4e83bb=_[_0xd95d('0x35')]({},_0x4e83bb,_0x141165[_0xd95d('0x38')]);return db[_0xd95d('0x39')][_0xd95d('0x42')](_0x4e83bb)[_0xd95d('0x1f')](handleEntityNotFound(_0x483857,null))['then'](respondWithResult(_0x483857,null))['catch'](handleError(_0x483857,null));};exports[_0xd95d('0x43')]=function(_0x37a09a,_0x1c64a0,_0x527f32){return db['Sound'][_0xd95d('0x42')]({'where':{'id':_0x37a09a[_0xd95d('0x40')]['id']},'attributes':['name','save_name',_0xd95d('0x44')],'raw':!![]})[_0xd95d('0x1f')](handleEntityNotFound(_0x1c64a0,null))[_0xd95d('0x1f')](function(_0x2583a7){if(_0x2583a7){if(!fs[_0xd95d('0x45')](path[_0xd95d('0x46')](config[_0xd95d('0x47')],_0xd95d('0x48'),_0x2583a7[_0xd95d('0x49')]+'.'+_0x2583a7[_0xd95d('0x44')]))){throw new db[(_0xd95d('0x4a'))][(_0xd95d('0x4b'))](_0xd95d('0x4c'));}return _0x1c64a0['download'](path['join'](config[_0xd95d('0x47')],_0xd95d('0x48'),util[_0xd95d('0x4d')]('%s.%s',_0x2583a7[_0xd95d('0x49')],_0x2583a7[_0xd95d('0x44')])),util[_0xd95d('0x4d')](_0xd95d('0x4e'),_0x2583a7['name'],_0x2583a7[_0xd95d('0x44')]));}return null;})[_0xd95d('0x3e')](handleError(_0x1c64a0,null));};exports['create']=function(_0x4c2a76,_0x3b8be0,_0x327ef3){var _0x5b7d32={'name':path[_0xd95d('0x4f')](_0x4c2a76[_0xd95d('0x50')][_0xd95d('0x51')],path[_0xd95d('0x52')](_0x4c2a76[_0xd95d('0x50')][_0xd95d('0x51')])),'save_name':path[_0xd95d('0x4f')](_0x4c2a76[_0xd95d('0x50')][_0xd95d('0x53')],path[_0xd95d('0x52')](_0x4c2a76['file'][_0xd95d('0x53')])),'original_format':path['extname'](_0x4c2a76['file'][_0xd95d('0x51')])['substring'](0x1),'converted_format':'wav'};var _0x4e0285=path['join'](config[_0xd95d('0x47')],'server/files/sounds/original',_0x4c2a76[_0xd95d('0x50')][_0xd95d('0x53')]);var _0x565691=path[_0xd95d('0x46')](config[_0xd95d('0x47')],_0xd95d('0x48'),util[_0xd95d('0x4d')]('%s.%s',path[_0xd95d('0x4f')](_0x4c2a76[_0xd95d('0x50')]['filename'],path['extname'](_0x4c2a76[_0xd95d('0x50')]['filename'])),_0x5b7d32[_0xd95d('0x44')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x4e0285);logger[_0xd95d('0x54')](_0xd95d('0x55'),_0x565691);try{fs[_0xd95d('0x56')](_0x4e0285,parseInt(_0xd95d('0x57'),0x8));var _0x36aa66=sox[_0xd95d('0x58')](_0x4e0285,_0x565691,{'sampleRate':0x1f40,'format':_0xd95d('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36aa66['on'](_0xd95d('0x22'),function(_0x4fcfcf){fs['unlinkSync'](_0x4e0285);_0x3b8be0[_0xd95d('0x14')](0x1f4)[_0xd95d('0x5a')](_0x4fcfcf);});_0x36aa66['on']('src',function(_0x41d38e){_0x5b7d32['original_duration']=isNaN(_0x41d38e[_0xd95d('0x5b')])?null:_0x41d38e[_0xd95d('0x5b')]*0x3e8;_0x5b7d32[_0xd95d('0x5c')]=isNaN(_0x41d38e[_0xd95d('0x5d')])?null:_0x41d38e[_0xd95d('0x5d')];_0x5b7d32[_0xd95d('0x5e')]=isNaN(_0x41d38e[_0xd95d('0x5f')])?null:_0x41d38e['channelCount'];_0x5b7d32[_0xd95d('0x60')]=isNaN(_0x41d38e[_0xd95d('0x61')])?null:_0x41d38e[_0xd95d('0x61')];_0x5b7d32[_0xd95d('0x62')]=isNaN(_0x41d38e[_0xd95d('0x63')])?null:_0x41d38e[_0xd95d('0x63')];});_0x36aa66['on'](_0xd95d('0x64'),function(_0x16e58f){_0x5b7d32[_0xd95d('0x65')]=isNaN(_0x16e58f[_0xd95d('0x5b')])?null:_0x16e58f['duration']*0x3e8;_0x5b7d32[_0xd95d('0x66')]=isNaN(_0x16e58f['sampleCount'])?null:_0x16e58f[_0xd95d('0x5d')];_0x5b7d32[_0xd95d('0x67')]=isNaN(_0x16e58f[_0xd95d('0x5f')])?null:_0x16e58f[_0xd95d('0x5f')];_0x5b7d32[_0xd95d('0x68')]=isNaN(_0x16e58f[_0xd95d('0x61')])?null:_0x16e58f['bitRate'];_0x5b7d32['converted_sampleRate']=isNaN(_0x16e58f[_0xd95d('0x63')])?null:_0x16e58f['sampleRate'];});_0x36aa66['on'](_0xd95d('0x15'),function(){fs[_0xd95d('0x56')](_0x565691,parseInt(_0xd95d('0x57'),0x8));return db[_0xd95d('0x39')][_0xd95d('0x69')](_0x5b7d32)[_0xd95d('0x1f')](function(_0x4bd2a2){var _0x4f95cd={'role':_0x4c2a76[_0xd95d('0x6a')]['role'],'userProfileId':_0x4c2a76[_0xd95d('0x6a')][_0xd95d('0x6b')]};if(!_0x4f95cd)throw new Error(_0xd95d('0x6c'));if(_0x4f95cd[_0xd95d('0x6d')]===_0xd95d('0x6e')){var _0x1e3691=_0x4bd2a2[_0xd95d('0x20')]({'plain':!![]});return db[_0xd95d('0x6f')][_0xd95d('0x42')]({'where':{'name':_0xd95d('0x70'),'userProfileId':_0x4f95cd[_0xd95d('0x6b')]},'raw':!![]})[_0xd95d('0x1f')](function(_0x83beb7){if(_0x83beb7&&_0x83beb7[_0xd95d('0x71')]===0x0){return db[_0xd95d('0x72')]['create']({'name':_0x1e3691[_0xd95d('0x24')],'resourceId':_0x1e3691['id'],'type':_0x83beb7[_0xd95d('0x24')],'sectionId':_0x83beb7['id']},{})[_0xd95d('0x1f')](function(){return _0x4bd2a2;});}else{return _0x4bd2a2;}})[_0xd95d('0x3e')](function(_0x3fc365){logger[_0xd95d('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fc365);throw _0x3fc365;});}return _0x4bd2a2;})[_0xd95d('0x1f')](respondWithResult(_0x3b8be0,null))['catch'](handleError(_0x3b8be0,null));});_0x36aa66[_0xd95d('0x73')]();}catch(_0x3dd6e7){_0x3b8be0[_0xd95d('0x14')](0x1f4)['send'](_0x3dd6e7);}};exports[_0xd95d('0x74')]=function(_0x3ad504,_0x567d33,_0x5ee09b){return db[_0xd95d('0x39')][_0xd95d('0x42')]({'where':{'id':_0x3ad504[_0xd95d('0x40')]['id']}})[_0xd95d('0x1f')](handleEntityNotFound(_0x567d33,null))[_0xd95d('0x1f')](saveUpdates(_[_0xd95d('0x33')](_0x3ad504[_0xd95d('0x6a')],[_0xd95d('0x24'),_0xd95d('0x75')]),null))[_0xd95d('0x1f')](respondWithResult(_0x567d33,null))['catch'](handleError(_0x567d33,null));};exports['delete']=function(_0x5bc11b,_0x4a9156,_0x57437d){return db[_0xd95d('0x39')][_0xd95d('0x42')]({'where':{'id':_0x5bc11b[_0xd95d('0x40')]['id']}})[_0xd95d('0x1f')](function(_0x45ad85){if(_0x45ad85){return _0x45ad85[_0xd95d('0x21')]();}})[_0xd95d('0x1f')](function(_0xb2d60a){var _0x255f4f=path['join'](config['root'],_0xd95d('0x76'),util[_0xd95d('0x4d')](_0xd95d('0x4e'),_0xb2d60a[_0xd95d('0x49')],_0xb2d60a[_0xd95d('0x77')]));var _0x495d06=path[_0xd95d('0x46')](config[_0xd95d('0x47')],'server/files/sounds/converted',util[_0xd95d('0x4d')](_0xd95d('0x4e'),_0xb2d60a[_0xd95d('0x49')],_0xb2d60a[_0xd95d('0x44')]));fs[_0xd95d('0x78')](_0x255f4f);fs[_0xd95d('0x78')](_0x495d06);return _0xb2d60a;})[_0xd95d('0x1f')](function(_0xc89216){if(_0xc89216){return _0x4a9156['status'](0xcc)[_0xd95d('0x15')]();}})[_0xd95d('0x1f')](handleEntityNotFound(_0x4a9156,null))[_0xd95d('0x3e')](handleError(_0x4a9156,null));}; \ No newline at end of file +var _0xd678=['sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','UserProfileResource','error','stack','name','send','index','map','Sound','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','download','save_name','converted_format','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','originalname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','bitRate','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','pick','description','delete','destroy','server/files/sounds/original','original_format','unlinkSync','eml-format','fast-json-patch','moment','mustache','util','path'];(function(_0x3e4c83,_0x452e37){var _0x39d6d7=function(_0x814bc9){while(--_0x814bc9){_0x3e4c83['push'](_0x3e4c83['shift']());}};_0x39d6d7(++_0x452e37);}(_0xd678,0x7b));var _0x8d67=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xd678[_0x26da89];return _0xc95b7b;};'use strict';var emlformat=require(_0x8d67('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8d67('0x1'));var rp=require('request-promise');var moment=require(_0x8d67('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8d67('0x3'));var util=require(_0x8d67('0x4'));var path=require(_0x8d67('0x5'));var sox=require(_0x8d67('0x6'));var csv=require(_0x8d67('0x7'));var ejs=require(_0x8d67('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d67('0x9'));var crypto=require(_0x8d67('0xa'));var jsforce=require(_0x8d67('0xb'));var deskjs=require(_0x8d67('0xc'));var toCsv=require(_0x8d67('0x7'));var querystring=require(_0x8d67('0xd'));var Papa=require(_0x8d67('0xe'));var Redis=require(_0x8d67('0xf'));var authService=require(_0x8d67('0x10'));var qs=require(_0x8d67('0x11'));var as=require(_0x8d67('0x12'));var hardwareService=require(_0x8d67('0x13'));var logger=require(_0x8d67('0x14'))(_0x8d67('0x15'));var utils=require(_0x8d67('0x16'));var config=require(_0x8d67('0x17'));var licenseUtil=require(_0x8d67('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20b405,_0x421185){_0x421185=_0x421185||0xcc;return function(_0xd0cca){if(_0xd0cca){return _0x20b405[_0x8d67('0x19')](_0x421185);}return _0x20b405[_0x8d67('0x1a')](_0x421185)[_0x8d67('0x1b')]();};}function respondWithResult(_0x5388bc,_0x16b32e){_0x16b32e=_0x16b32e||0xc8;return function(_0x4a098c){if(_0x4a098c){return _0x5388bc['status'](_0x16b32e)[_0x8d67('0x1c')](_0x4a098c);}};}function respondWithFilteredResult(_0x3f3f76,_0xbe909e){return function(_0x29c97e){if(_0x29c97e){var _0x249cc5=typeof _0xbe909e['offset']===_0x8d67('0x1d')&&typeof _0xbe909e[_0x8d67('0x1e')]==='undefined';var _0x40f343=_0x29c97e[_0x8d67('0x1f')];var _0x131e32=_0x249cc5?0x0:_0xbe909e[_0x8d67('0x20')];var _0x37559c=_0x249cc5?_0x29c97e[_0x8d67('0x1f')]:_0xbe909e[_0x8d67('0x20')]+_0xbe909e['limit'];var _0x4e63e2;if(_0x37559c>=_0x40f343){_0x37559c=_0x40f343;_0x4e63e2=0xc8;}else{_0x4e63e2=0xce;}_0x3f3f76['status'](_0x4e63e2);return _0x3f3f76[_0x8d67('0x21')]('Content-Range',_0x131e32+'-'+_0x37559c+'/'+_0x40f343)[_0x8d67('0x1c')](_0x29c97e);}return null;};}function patchUpdates(_0x1b8cae){return function(_0x1e381a){try{jsonpatch[_0x8d67('0x22')](_0x1e381a,_0x1b8cae,!![]);}catch(_0x39c3c2){return BPromise[_0x8d67('0x23')](_0x39c3c2);}return _0x1e381a[_0x8d67('0x24')]();};}function saveUpdates(_0x16f525,_0x2446c5){return function(_0x558079){if(_0x558079){return _0x558079[_0x8d67('0x25')](_0x16f525)[_0x8d67('0x26')](function(_0x42af96){return _0x42af96;});}return null;};}function removeEntity(_0x84974e,_0x43fe83){return function(_0x5a7c2d){if(_0x5a7c2d){return _0x5a7c2d['destroy']()[_0x8d67('0x26')](function(){var _0x25762d=_0x5a7c2d[_0x8d67('0x27')]({'plain':!![]});var _0x40a9d2='Sounds';return db[_0x8d67('0x28')]['destroy']({'where':{'type':_0x40a9d2,'resourceId':_0x25762d['id']}})[_0x8d67('0x26')](function(){return _0x5a7c2d;});})[_0x8d67('0x26')](function(){_0x84974e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20dc26,_0x596175){return function(_0x51b407){if(!_0x51b407){_0x20dc26[_0x8d67('0x19')](0x194);}return _0x51b407;};}function handleError(_0x362dd4,_0x312327){_0x312327=_0x312327||0x1f4;return function(_0x15ce81){logger[_0x8d67('0x29')](_0x15ce81[_0x8d67('0x2a')]);if(_0x15ce81[_0x8d67('0x2b')]){delete _0x15ce81['name'];}_0x362dd4['status'](_0x312327)[_0x8d67('0x2c')](_0x15ce81);};}exports[_0x8d67('0x2d')]=function(_0x58c419,_0x3c7e31){var _0x4607e3={},_0x54a3e3={},_0x6ad0ad={'count':0x0,'rows':[]};var _0x5400ea=_[_0x8d67('0x2e')](db[_0x8d67('0x2f')]['rawAttributes'],function(_0x13cd77){return{'name':_0x13cd77[_0x8d67('0x30')],'type':_0x13cd77[_0x8d67('0x31')][_0x8d67('0x32')]};});_0x54a3e3[_0x8d67('0x33')]=_['map'](_0x5400ea,_0x8d67('0x2b'));_0x54a3e3[_0x8d67('0x34')]=_['keys'](_0x58c419[_0x8d67('0x34')]);_0x54a3e3[_0x8d67('0x35')]=_[_0x8d67('0x36')](_0x54a3e3[_0x8d67('0x33')],_0x54a3e3['query']);_0x4607e3['attributes']=_[_0x8d67('0x36')](_0x54a3e3[_0x8d67('0x33')],qs[_0x8d67('0x37')](_0x58c419['query'][_0x8d67('0x37')]));_0x4607e3[_0x8d67('0x38')]=_0x4607e3[_0x8d67('0x38')]['length']?_0x4607e3[_0x8d67('0x38')]:_0x54a3e3['model'];if(!_0x58c419[_0x8d67('0x34')][_0x8d67('0x39')](_0x8d67('0x3a'))){_0x4607e3[_0x8d67('0x1e')]=qs['limit'](_0x58c419['query'][_0x8d67('0x1e')]);_0x4607e3[_0x8d67('0x20')]=qs[_0x8d67('0x20')](_0x58c419[_0x8d67('0x34')]['offset']);}_0x4607e3[_0x8d67('0x3b')]=qs['sort'](_0x58c419[_0x8d67('0x34')][_0x8d67('0x3c')]);_0x4607e3['where']=qs[_0x8d67('0x35')](_['pick'](_0x58c419['query'],_0x54a3e3['filters']),_0x5400ea);if(_0x58c419['query'][_0x8d67('0x3d')]){_0x4607e3[_0x8d67('0x3e')]=_[_0x8d67('0x3f')](_0x4607e3[_0x8d67('0x3e')],{'$or':_[_0x8d67('0x2e')](_0x5400ea,function(_0x506e7e){if(_0x506e7e[_0x8d67('0x31')]!==_0x8d67('0x40')){var _0x1ec6d9={};_0x1ec6d9[_0x506e7e[_0x8d67('0x2b')]]={'$like':'%'+_0x58c419['query'][_0x8d67('0x3d')]+'%'};return _0x1ec6d9;}})});}_0x4607e3=_[_0x8d67('0x3f')]({},_0x4607e3,_0x58c419[_0x8d67('0x41')]);var _0x15e298={'where':_0x4607e3['where']};return db[_0x8d67('0x2f')]['count'](_0x15e298)['then'](function(_0x371c24){_0x6ad0ad[_0x8d67('0x1f')]=_0x371c24;if(_0x58c419[_0x8d67('0x34')][_0x8d67('0x42')]){_0x4607e3[_0x8d67('0x43')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x4607e3);})['then'](function(_0xdbc48a){_0x6ad0ad[_0x8d67('0x44')]=_0xdbc48a;return _0x6ad0ad;})['then'](respondWithFilteredResult(_0x3c7e31,_0x4607e3))[_0x8d67('0x45')](handleError(_0x3c7e31,null));};exports[_0x8d67('0x46')]=function(_0x3955dd,_0x83c822){var _0x55bb7a={'raw':!![],'where':{'id':_0x3955dd[_0x8d67('0x47')]['id']}},_0xb81da8={};_0xb81da8['model']=_[_0x8d67('0x48')](db[_0x8d67('0x2f')][_0x8d67('0x49')]);_0xb81da8[_0x8d67('0x34')]=_[_0x8d67('0x48')](_0x3955dd[_0x8d67('0x34')]);_0xb81da8[_0x8d67('0x35')]=_[_0x8d67('0x36')](_0xb81da8[_0x8d67('0x33')],_0xb81da8[_0x8d67('0x34')]);_0x55bb7a['attributes']=_[_0x8d67('0x36')](_0xb81da8[_0x8d67('0x33')],qs[_0x8d67('0x37')](_0x3955dd[_0x8d67('0x34')][_0x8d67('0x37')]));_0x55bb7a['attributes']=_0x55bb7a[_0x8d67('0x38')][_0x8d67('0x4a')]?_0x55bb7a['attributes']:_0xb81da8['model'];if(_0x3955dd[_0x8d67('0x34')][_0x8d67('0x42')]){_0x55bb7a[_0x8d67('0x43')]=[{'all':!![]}];}_0x55bb7a=_['merge']({},_0x55bb7a,_0x3955dd['options']);return db['Sound'][_0x8d67('0x4b')](_0x55bb7a)['then'](handleEntityNotFound(_0x83c822,null))['then'](respondWithResult(_0x83c822,null))[_0x8d67('0x45')](handleError(_0x83c822,null));};exports[_0x8d67('0x4c')]=function(_0x262e81,_0x5e080c,_0x26e947){return db[_0x8d67('0x2f')]['find']({'where':{'id':_0x262e81[_0x8d67('0x47')]['id']},'attributes':[_0x8d67('0x2b'),_0x8d67('0x4d'),_0x8d67('0x4e')],'raw':!![]})[_0x8d67('0x26')](handleEntityNotFound(_0x5e080c,null))['then'](function(_0x173925){if(_0x173925){if(!fs['existsSync'](path[_0x8d67('0x4f')](config[_0x8d67('0x50')],_0x8d67('0x51'),_0x173925[_0x8d67('0x4d')]+'.'+_0x173925[_0x8d67('0x4e')]))){throw new db['Sequelize'][(_0x8d67('0x52'))](_0x8d67('0x53'));}return _0x5e080c[_0x8d67('0x4c')](path[_0x8d67('0x4f')](config[_0x8d67('0x50')],_0x8d67('0x51'),util[_0x8d67('0x54')](_0x8d67('0x55'),_0x173925[_0x8d67('0x4d')],_0x173925[_0x8d67('0x4e')])),util[_0x8d67('0x54')](_0x8d67('0x55'),_0x173925['name'],_0x173925['converted_format']));}return null;})['catch'](handleError(_0x5e080c,null));};exports[_0x8d67('0x56')]=function(_0x353c74,_0x51d498,_0x24edff){var _0xc8736={'name':path[_0x8d67('0x57')](_0x353c74[_0x8d67('0x58')]['originalname'],path[_0x8d67('0x59')](_0x353c74[_0x8d67('0x58')][_0x8d67('0x5a')])),'save_name':path[_0x8d67('0x57')](_0x353c74['file'][_0x8d67('0x5b')],path[_0x8d67('0x59')](_0x353c74[_0x8d67('0x58')][_0x8d67('0x5b')])),'original_format':path[_0x8d67('0x59')](_0x353c74[_0x8d67('0x58')][_0x8d67('0x5a')])[_0x8d67('0x5c')](0x1),'converted_format':_0x8d67('0x5d')};var _0x28fdfc=path['join'](config[_0x8d67('0x50')],'server/files/sounds/original',_0x353c74[_0x8d67('0x58')][_0x8d67('0x5b')]);var _0x3898e3=path[_0x8d67('0x4f')](config[_0x8d67('0x50')],_0x8d67('0x51'),util['format'](_0x8d67('0x55'),path['basename'](_0x353c74[_0x8d67('0x58')][_0x8d67('0x5b')],path[_0x8d67('0x59')](_0x353c74[_0x8d67('0x58')][_0x8d67('0x5b')])),_0xc8736[_0x8d67('0x4e')]));logger[_0x8d67('0x5e')](_0x8d67('0x5f'),_0x28fdfc);logger[_0x8d67('0x5e')](_0x8d67('0x60'),_0x3898e3);try{fs[_0x8d67('0x61')](_0x28fdfc,parseInt(_0x8d67('0x62'),0x8));var _0x15e21b=sox[_0x8d67('0x63')](_0x28fdfc,_0x3898e3,{'sampleRate':0x1f40,'format':_0x8d67('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x15e21b['on'](_0x8d67('0x29'),function(_0x1c3084){fs['unlinkSync'](_0x28fdfc);_0x51d498[_0x8d67('0x1a')](0x1f4)['send'](_0x1c3084);});_0x15e21b['on']('src',function(_0x67c1aa){_0xc8736[_0x8d67('0x64')]=isNaN(_0x67c1aa[_0x8d67('0x65')])?null:_0x67c1aa[_0x8d67('0x65')]*0x3e8;_0xc8736[_0x8d67('0x66')]=isNaN(_0x67c1aa[_0x8d67('0x67')])?null:_0x67c1aa['sampleCount'];_0xc8736[_0x8d67('0x68')]=isNaN(_0x67c1aa[_0x8d67('0x69')])?null:_0x67c1aa[_0x8d67('0x69')];_0xc8736[_0x8d67('0x6a')]=isNaN(_0x67c1aa['bitRate'])?null:_0x67c1aa['bitRate'];_0xc8736[_0x8d67('0x6b')]=isNaN(_0x67c1aa[_0x8d67('0x6c')])?null:_0x67c1aa[_0x8d67('0x6c')];});_0x15e21b['on'](_0x8d67('0x6d'),function(_0x3c124e){_0xc8736[_0x8d67('0x6e')]=isNaN(_0x3c124e[_0x8d67('0x65')])?null:_0x3c124e[_0x8d67('0x65')]*0x3e8;_0xc8736[_0x8d67('0x6f')]=isNaN(_0x3c124e[_0x8d67('0x67')])?null:_0x3c124e[_0x8d67('0x67')];_0xc8736[_0x8d67('0x70')]=isNaN(_0x3c124e[_0x8d67('0x69')])?null:_0x3c124e[_0x8d67('0x69')];_0xc8736['converted_bitRate']=isNaN(_0x3c124e[_0x8d67('0x71')])?null:_0x3c124e[_0x8d67('0x71')];_0xc8736[_0x8d67('0x72')]=isNaN(_0x3c124e[_0x8d67('0x6c')])?null:_0x3c124e[_0x8d67('0x6c')];});_0x15e21b['on']('end',function(){fs[_0x8d67('0x61')](_0x3898e3,parseInt(_0x8d67('0x62'),0x8));return db['Sound'][_0x8d67('0x56')](_0xc8736)[_0x8d67('0x26')](function(_0x2de64b){var _0x13edec={'role':_0x353c74[_0x8d67('0x73')][_0x8d67('0x74')],'userProfileId':_0x353c74['body'][_0x8d67('0x75')]};if(!_0x13edec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13edec[_0x8d67('0x74')]===_0x8d67('0x76')){var _0x14cd4f=_0x2de64b[_0x8d67('0x27')]({'plain':!![]});return db[_0x8d67('0x77')][_0x8d67('0x4b')]({'where':{'name':_0x8d67('0x78'),'userProfileId':_0x13edec['userProfileId']},'raw':!![]})[_0x8d67('0x26')](function(_0x347546){if(_0x347546&&_0x347546[_0x8d67('0x79')]===0x0){return db[_0x8d67('0x28')]['create']({'name':_0x14cd4f['name'],'resourceId':_0x14cd4f['id'],'type':_0x347546[_0x8d67('0x2b')],'sectionId':_0x347546['id']},{})[_0x8d67('0x26')](function(){return _0x2de64b;});}else{return _0x2de64b;}})['catch'](function(_0x20e1fa){logger[_0x8d67('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20e1fa);throw _0x20e1fa;});}return _0x2de64b;})[_0x8d67('0x26')](respondWithResult(_0x51d498,null))[_0x8d67('0x45')](handleError(_0x51d498,null));});_0x15e21b['start']();}catch(_0xe0805d){_0x51d498[_0x8d67('0x1a')](0x1f4)[_0x8d67('0x2c')](_0xe0805d);}};exports[_0x8d67('0x25')]=function(_0x38aea2,_0x401b7a,_0x1ec531){return db[_0x8d67('0x2f')][_0x8d67('0x4b')]({'where':{'id':_0x38aea2[_0x8d67('0x47')]['id']}})[_0x8d67('0x26')](handleEntityNotFound(_0x401b7a,null))[_0x8d67('0x26')](saveUpdates(_[_0x8d67('0x7a')](_0x38aea2[_0x8d67('0x73')],[_0x8d67('0x2b'),_0x8d67('0x7b')]),null))[_0x8d67('0x26')](respondWithResult(_0x401b7a,null))['catch'](handleError(_0x401b7a,null));};exports[_0x8d67('0x7c')]=function(_0x5399e7,_0x4c68dc,_0x5bdaa7){return db['Sound'][_0x8d67('0x4b')]({'where':{'id':_0x5399e7[_0x8d67('0x47')]['id']}})['then'](function(_0xb702b7){if(_0xb702b7){return _0xb702b7[_0x8d67('0x7d')]();}})['then'](function(_0x45bf89){var _0x47efe1=path['join'](config[_0x8d67('0x50')],_0x8d67('0x7e'),util['format'](_0x8d67('0x55'),_0x45bf89[_0x8d67('0x4d')],_0x45bf89[_0x8d67('0x7f')]));var _0x43f903=path[_0x8d67('0x4f')](config[_0x8d67('0x50')],_0x8d67('0x51'),util['format'](_0x8d67('0x55'),_0x45bf89[_0x8d67('0x4d')],_0x45bf89['converted_format']));fs['unlinkSync'](_0x47efe1);fs[_0x8d67('0x80')](_0x43f903);return _0x45bf89;})[_0x8d67('0x26')](function(_0x2990c3){if(_0x2990c3){return _0x4c68dc[_0x8d67('0x1a')](0xcc)[_0x8d67('0x1b')]();}})[_0x8d67('0x26')](handleEntityNotFound(_0x4c68dc,null))[_0x8d67('0x45')](handleError(_0x4c68dc,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b015f0b..b6b1447 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 _0x28dc=['tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x28dc,0x16d));var _0xc28d=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0x28dc[_0x17a32f];return _0x15a293;};'use strict';var _=require(_0xc28d('0x0'));var util=require(_0xc28d('0x1'));var logger=require(_0xc28d('0x2'))(_0xc28d('0x3'));var moment=require(_0xc28d('0x4'));var BPromise=require('bluebird');var rp=require(_0xc28d('0x5'));var fs=require('fs');var path=require(_0xc28d('0x6'));var rimraf=require(_0xc28d('0x7'));var config=require(_0xc28d('0x8'));var attributes=require(_0xc28d('0x9'));module[_0xc28d('0xa')]=function(_0x439c29,_0xf41aec){return _0x439c29[_0xc28d('0xb')]('Sound',attributes,{'tableName':_0xc28d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79fc=['request-promise','path','rimraf','exports','define','Sound','tools_sounds','util','../../config/logger'];(function(_0xdd5f37,_0xf2669f){var _0xa4e92f=function(_0x494333){while(--_0x494333){_0xdd5f37['push'](_0xdd5f37['shift']());}};_0xa4e92f(++_0xf2669f);}(_0x79fc,0x1db));var _0xc79f=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x79fc[_0x55a89e];return _0x3aa2bd;};'use strict';var _=require('lodash');var util=require(_0xc79f('0x0'));var logger=require(_0xc79f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc79f('0x2'));var fs=require('fs');var path=require(_0xc79f('0x3'));var rimraf=require(_0xc79f('0x4'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0xc79f('0x5')]=function(_0x43d4f5,_0xc97a8d){return _0x43d4f5[_0xc79f('0x6')](_0xc79f('0x7'),attributes,{'tableName':_0xc79f('0x8'),'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 958a05e..19de882 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 _0xc63e=['options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0xc63e,0x151));var _0xec63=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0xc63e[_0x2e7a43];return _0x52e9e1;};'use strict';var _=require(_0xec63('0x0'));var util=require(_0xec63('0x1'));var moment=require('moment');var BPromise=require(_0xec63('0x2'));var rs=require(_0xec63('0x3'));var fs=require('fs');var Redis=require(_0xec63('0x4'));var db=require(_0xec63('0x5'))['db'];var utils=require(_0xec63('0x6'));var logger=require(_0xec63('0x7'))('rpc');var config=require(_0xec63('0x8'));var jayson=require(_0xec63('0x9'));var client=jayson[_0xec63('0xa')][_0xec63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b5130,_0x1f23d4,_0x4f0d2d){return new BPromise(function(_0x393ae9,_0x4c3f22){return client['request'](_0x1b5130,_0x4f0d2d)[_0xec63('0xc')](function(_0x20830c){logger[_0xec63('0xd')]('Sound,\x20%s,\x20%s',_0x1f23d4,_0xec63('0xe'));logger[_0xec63('0xf')](_0xec63('0x10'),_0x1f23d4,_0xec63('0xe'),JSON[_0xec63('0x11')](_0x20830c));if(_0x20830c['error']){if(_0x20830c['error']['code']===0x1f4){logger[_0xec63('0x12')](_0xec63('0x13'),_0x1f23d4,_0x20830c[_0xec63('0x12')]['message']);return _0x4c3f22(_0x20830c['error']['message']);}logger[_0xec63('0x12')](_0xec63('0x13'),_0x1f23d4,_0x20830c[_0xec63('0x12')][_0xec63('0x14')]);return _0x393ae9(_0x20830c[_0xec63('0x12')][_0xec63('0x14')]);}else{logger[_0xec63('0xd')]('Sound,\x20%s,\x20%s',_0x1f23d4,_0xec63('0xe'));_0x393ae9(_0x20830c[_0xec63('0x15')][_0xec63('0x14')]);}})[_0xec63('0x16')](function(_0x2fc87a){logger[_0xec63('0x12')]('Sound,\x20%s,\x20%s',_0x1f23d4,_0x2fc87a);_0x4c3f22(_0x2fc87a);});});}exports[_0xec63('0x17')]=function(_0x309b10){var _0x95c579=this;return new Promise(function(_0x15c838,_0xda3cd0){return db[_0xec63('0x18')][_0xec63('0x19')]({'raw':_0x309b10[_0xec63('0x1a')]?_0x309b10[_0xec63('0x1a')][_0xec63('0x1b')]===undefined?!![]:![]:!![],'where':_0x309b10[_0xec63('0x1a')]?_0x309b10[_0xec63('0x1a')][_0xec63('0x1c')]||null:null,'attributes':_0x309b10['options']?_0x309b10[_0xec63('0x1a')][_0xec63('0x1d')]||null:null,'include':_0x309b10[_0xec63('0x1a')]?_0x309b10[_0xec63('0x1a')][_0xec63('0x1e')]?_[_0xec63('0x1f')](_0x309b10[_0xec63('0x1a')][_0xec63('0x1e')],function(_0x276f58){return{'model':db[_0x276f58[_0xec63('0x20')]],'as':_0x276f58['as'],'attributes':_0x276f58['attributes'],'include':_0x276f58[_0xec63('0x1e')]?_['map'](_0x276f58[_0xec63('0x1e')],function(_0x551b1b){return{'model':db[_0x551b1b[_0xec63('0x20')]],'as':_0x551b1b['as'],'attributes':_0x551b1b['attributes'],'include':_0x551b1b[_0xec63('0x1e')]?_[_0xec63('0x1f')](_0x551b1b[_0xec63('0x1e')],function(_0x912bfa){return{'model':db[_0x912bfa['model']],'as':_0x912bfa['as'],'attributes':_0x912bfa[_0xec63('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xec63('0xc')](function(_0xa4d4ae){logger[_0xec63('0xd')](_0xec63('0x17'),_0x309b10);logger['debug'](_0xec63('0x17'),_0x309b10,JSON[_0xec63('0x11')](_0xa4d4ae));_0x15c838(_0xa4d4ae);})[_0xec63('0x16')](function(_0x99cb1e){logger[_0xec63('0x12')](_0xec63('0x17'),_0x99cb1e[_0xec63('0x14')],_0x309b10);_0xda3cd0(_0x95c579[_0xec63('0x12')](0x1f4,_0x99cb1e['message']));});});}; \ No newline at end of file +var _0x9ab3=['catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','ShowSound','find','options','where','attributes','include','model','map'];(function(_0x6ff97c,_0x5e35fe){var _0x469a87=function(_0x21c41f){while(--_0x21c41f){_0x6ff97c['push'](_0x6ff97c['shift']());}};_0x469a87(++_0x5e35fe);}(_0x9ab3,0x119));var _0x39ab=function(_0xe61fed,_0x2e25df){_0xe61fed=_0xe61fed-0x0;var _0x54d253=_0x9ab3[_0xe61fed];return _0x54d253;};'use strict';var _=require(_0x39ab('0x0'));var util=require(_0x39ab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x39ab('0x2'));var fs=require('fs');var Redis=require(_0x39ab('0x3'));var db=require(_0x39ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x39ab('0x5'));var config=require('../../config/environment');var jayson=require(_0x39ab('0x6'));var client=jayson['client'][_0x39ab('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x134855,_0x2b536f,_0x3df886){return new BPromise(function(_0x3d380d,_0x570eac){return client[_0x39ab('0x8')](_0x134855,_0x3df886)[_0x39ab('0x9')](function(_0x4ea160){logger['info'](_0x39ab('0xa'),_0x2b536f,_0x39ab('0xb'));logger[_0x39ab('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x2b536f,'request\x20sent',JSON[_0x39ab('0xd')](_0x4ea160));if(_0x4ea160[_0x39ab('0xe')]){if(_0x4ea160[_0x39ab('0xe')][_0x39ab('0xf')]===0x1f4){logger[_0x39ab('0xe')](_0x39ab('0xa'),_0x2b536f,_0x4ea160[_0x39ab('0xe')][_0x39ab('0x10')]);return _0x570eac(_0x4ea160[_0x39ab('0xe')][_0x39ab('0x10')]);}logger['error'](_0x39ab('0xa'),_0x2b536f,_0x4ea160[_0x39ab('0xe')][_0x39ab('0x10')]);return _0x3d380d(_0x4ea160[_0x39ab('0xe')][_0x39ab('0x10')]);}else{logger[_0x39ab('0x11')]('Sound,\x20%s,\x20%s',_0x2b536f,_0x39ab('0xb'));_0x3d380d(_0x4ea160[_0x39ab('0x12')][_0x39ab('0x10')]);}})['catch'](function(_0x23559b){logger[_0x39ab('0xe')](_0x39ab('0xa'),_0x2b536f,_0x23559b);_0x570eac(_0x23559b);});});}exports[_0x39ab('0x13')]=function(_0x35b07a){var _0x47ac0d=this;return new Promise(function(_0x2e25ef,_0x4bd74b){return db['Sound'][_0x39ab('0x14')]({'raw':_0x35b07a[_0x39ab('0x15')]?_0x35b07a[_0x39ab('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x35b07a['options']?_0x35b07a[_0x39ab('0x15')][_0x39ab('0x16')]||null:null,'attributes':_0x35b07a['options']?_0x35b07a[_0x39ab('0x15')][_0x39ab('0x17')]||null:null,'include':_0x35b07a[_0x39ab('0x15')]?_0x35b07a[_0x39ab('0x15')]['include']?_['map'](_0x35b07a[_0x39ab('0x15')][_0x39ab('0x18')],function(_0x5037de){return{'model':db[_0x5037de[_0x39ab('0x19')]],'as':_0x5037de['as'],'attributes':_0x5037de[_0x39ab('0x17')],'include':_0x5037de[_0x39ab('0x18')]?_['map'](_0x5037de[_0x39ab('0x18')],function(_0x5bc132){return{'model':db[_0x5bc132['model']],'as':_0x5bc132['as'],'attributes':_0x5bc132[_0x39ab('0x17')],'include':_0x5bc132[_0x39ab('0x18')]?_[_0x39ab('0x1a')](_0x5bc132[_0x39ab('0x18')],function(_0x701640){return{'model':db[_0x701640[_0x39ab('0x19')]],'as':_0x701640['as'],'attributes':_0x701640[_0x39ab('0x17')]};}):[]};}):[]};}):[]:[]})[_0x39ab('0x9')](function(_0x59e0d3){logger[_0x39ab('0x11')]('ShowSound',_0x35b07a);logger['debug'](_0x39ab('0x13'),_0x35b07a,JSON['stringify'](_0x59e0d3));_0x2e25ef(_0x59e0d3);})[_0x39ab('0x1b')](function(_0x5c4483){logger[_0x39ab('0xe')](_0x39ab('0x13'),_0x5c4483[_0x39ab('0x10')],_0x35b07a);_0x4bd74b(_0x47ac0d[_0x39ab('0xe')](0x1f4,_0x5c4483[_0x39ab('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e325074..6335ca6 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 _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3fa38d,_0x55bf3b){var _0x2af0f1=function(_0x5aa5d7){while(--_0x5aa5d7){_0x3fa38d['push'](_0x3fa38d['shift']());}};_0x2af0f1(++_0x55bf3b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0xb10b[_0x5d2ed9];return _0x4262c5;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x114d65,_0x4b15d8){var _0x482e91=function(_0x384deb){while(--_0x384deb){_0x114d65['push'](_0x114d65['shift']());}};_0x482e91(++_0x4b15d8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./squareMessage.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0xb')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router['put']('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0x9'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 4a74e9d..f777eca 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 _0x91e4=['sequelize','exports','TEXT','medium','ENUM','out','STRING'];(function(_0x1c6369,_0x2c0af7){var _0x169346=function(_0x4f98e6){while(--_0x4f98e6){_0x1c6369['push'](_0x1c6369['shift']());}};_0x169346(++_0x2c0af7);}(_0x91e4,0x1f1));var _0x491e=function(_0xfff6c9,_0xf0a141){_0xfff6c9=_0xfff6c9-0x0;var _0x213192=_0x91e4[_0xfff6c9];return _0x213192;};'use strict';var Sequelize=require(_0x491e('0x0'));module[_0x491e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x491e('0x2')](_0x491e('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x491e('0x4')]('in',_0x491e('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x491e('0x6')]},'providerResponse':{'type':Sequelize[_0x491e('0x2')]}}; \ No newline at end of file +var _0x9c88=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x9c88,0x1cc));var _0x89c8=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x9c88[_0x384231];return _0x2480bf;};'use strict';var Sequelize=require(_0x89c8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x89c8('0x1')]},'body':{'type':Sequelize[_0x89c8('0x2')](_0x89c8('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x89c8('0x4')]('in','out'),'defaultValue':_0x89c8('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x89c8('0x1')]},'providerResponse':{'type':Sequelize[_0x89c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 18b595c..1d7dcf9 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 _0xf4d6=['end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','map','SquareMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x4c9150,_0x28049b){var _0x37c3e4=function(_0x483c36){while(--_0x483c36){_0x4c9150['push'](_0x4c9150['shift']());}};_0x37c3e4(++_0x28049b);}(_0xf4d6,0xc6));var _0x6f4d=function(_0xe6dc12,_0x1cd659){_0xe6dc12=_0xe6dc12-0x0;var _0x35fab1=_0xf4d6[_0xe6dc12];return _0x35fab1;};'use strict';var emlformat=require(_0x6f4d('0x0'));var rimraf=require(_0x6f4d('0x1'));var zipdir=require(_0x6f4d('0x2'));var jsonpatch=require(_0x6f4d('0x3'));var rp=require(_0x6f4d('0x4'));var moment=require(_0x6f4d('0x5'));var BPromise=require(_0x6f4d('0x6'));var Mustache=require(_0x6f4d('0x7'));var util=require(_0x6f4d('0x8'));var path=require(_0x6f4d('0x9'));var sox=require(_0x6f4d('0xa'));var csv=require('to-csv');var ejs=require(_0x6f4d('0xb'));var fs=require('fs');var fs_extra=require(_0x6f4d('0xc'));var _=require(_0x6f4d('0xd'));var squel=require('squel');var crypto=require(_0x6f4d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6f4d('0xf'));var toCsv=require(_0x6f4d('0x10'));var querystring=require(_0x6f4d('0x11'));var Papa=require(_0x6f4d('0x12'));var Redis=require(_0x6f4d('0x13'));var authService=require(_0x6f4d('0x14'));var qs=require(_0x6f4d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f4d('0x16'));var logger=require(_0x6f4d('0x17'))(_0x6f4d('0x18'));var utils=require(_0x6f4d('0x19'));var config=require(_0x6f4d('0x1a'));var licenseUtil=require(_0x6f4d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd24d14,_0x44c298){_0x44c298=_0x44c298||0xcc;return function(_0x1050a4){if(_0x1050a4){return _0xd24d14[_0x6f4d('0x1c')](_0x44c298);}return _0xd24d14[_0x6f4d('0x1d')](_0x44c298)[_0x6f4d('0x1e')]();};}function respondWithResult(_0xf32a95,_0x4617bb){_0x4617bb=_0x4617bb||0xc8;return function(_0x1fb745){if(_0x1fb745){return _0xf32a95[_0x6f4d('0x1d')](_0x4617bb)['json'](_0x1fb745);}};}function respondWithFilteredResult(_0x430e32,_0x378b69){return function(_0x1862a4){if(_0x1862a4){var _0x44496a=typeof _0x378b69['offset']===_0x6f4d('0x1f')&&typeof _0x378b69['limit']===_0x6f4d('0x1f');var _0x538108=_0x1862a4[_0x6f4d('0x20')];var _0x58d61b=_0x44496a?0x0:_0x378b69[_0x6f4d('0x21')];var _0x2b3ad5=_0x44496a?_0x1862a4[_0x6f4d('0x20')]:_0x378b69['offset']+_0x378b69[_0x6f4d('0x22')];var _0xafa11f;if(_0x2b3ad5>=_0x538108){_0x2b3ad5=_0x538108;_0xafa11f=0xc8;}else{_0xafa11f=0xce;}_0x430e32['status'](_0xafa11f);return _0x430e32['set'](_0x6f4d('0x23'),_0x58d61b+'-'+_0x2b3ad5+'/'+_0x538108)[_0x6f4d('0x24')](_0x1862a4);}return null;};}function patchUpdates(_0x3285cd){return function(_0xb9d56){try{jsonpatch[_0x6f4d('0x25')](_0xb9d56,_0x3285cd,!![]);}catch(_0x3c74b2){return BPromise[_0x6f4d('0x26')](_0x3c74b2);}return _0xb9d56[_0x6f4d('0x27')]();};}function saveUpdates(_0x38d3ed,_0x58c02c){return function(_0x478e79){if(_0x478e79){return _0x478e79['update'](_0x38d3ed)[_0x6f4d('0x28')](function(_0x4f4418){return _0x4f4418;});}return null;};}function removeEntity(_0x571aba,_0x24a1da){return function(_0x204650){if(_0x204650){return _0x204650[_0x6f4d('0x29')]()['then'](function(){_0x571aba[_0x6f4d('0x1d')](0xcc)[_0x6f4d('0x1e')]();});}};}function handleEntityNotFound(_0x11f769,_0x2d3f7e){return function(_0x12a96f){if(!_0x12a96f){_0x11f769['sendStatus'](0x194);}return _0x12a96f;};}function handleError(_0x5921e0,_0x24157a){_0x24157a=_0x24157a||0x1f4;return function(_0x3cf9c3){logger[_0x6f4d('0x2a')](_0x3cf9c3[_0x6f4d('0x2b')]);if(_0x3cf9c3[_0x6f4d('0x2c')]){delete _0x3cf9c3[_0x6f4d('0x2c')];}_0x5921e0[_0x6f4d('0x1d')](_0x24157a)['send'](_0x3cf9c3);};}exports['index']=function(_0x3eefd3,_0xb3015b){var _0x4e6a23={},_0x6bd9f2={},_0xbb2494={'count':0x0,'rows':[]};var _0x699d33=_[_0x6f4d('0x2d')](db[_0x6f4d('0x2e')]['rawAttributes'],function(_0x765175){return{'name':_0x765175[_0x6f4d('0x2f')],'type':_0x765175[_0x6f4d('0x30')][_0x6f4d('0x31')]};});_0x6bd9f2[_0x6f4d('0x32')]=_['map'](_0x699d33,_0x6f4d('0x2c'));_0x6bd9f2[_0x6f4d('0x33')]=_['keys'](_0x3eefd3[_0x6f4d('0x33')]);_0x6bd9f2[_0x6f4d('0x34')]=_[_0x6f4d('0x35')](_0x6bd9f2['model'],_0x6bd9f2[_0x6f4d('0x33')]);_0x4e6a23[_0x6f4d('0x36')]=_[_0x6f4d('0x35')](_0x6bd9f2[_0x6f4d('0x32')],qs[_0x6f4d('0x37')](_0x3eefd3[_0x6f4d('0x33')][_0x6f4d('0x37')]));_0x4e6a23['attributes']=_0x4e6a23[_0x6f4d('0x36')][_0x6f4d('0x38')]?_0x4e6a23[_0x6f4d('0x36')]:_0x6bd9f2['model'];if(!_0x3eefd3[_0x6f4d('0x33')][_0x6f4d('0x39')](_0x6f4d('0x3a'))){_0x4e6a23[_0x6f4d('0x22')]=qs[_0x6f4d('0x22')](_0x3eefd3[_0x6f4d('0x33')]['limit']);_0x4e6a23[_0x6f4d('0x21')]=qs['offset'](_0x3eefd3[_0x6f4d('0x33')]['offset']);}_0x4e6a23['order']=qs[_0x6f4d('0x3b')](_0x3eefd3[_0x6f4d('0x33')][_0x6f4d('0x3b')]);_0x4e6a23[_0x6f4d('0x3c')]=qs['filters'](_[_0x6f4d('0x3d')](_0x3eefd3[_0x6f4d('0x33')],_0x6bd9f2[_0x6f4d('0x34')]),_0x699d33);if(_0x3eefd3[_0x6f4d('0x33')]['filter']){_0x4e6a23[_0x6f4d('0x3c')]=_[_0x6f4d('0x3e')](_0x4e6a23[_0x6f4d('0x3c')],{'$or':_[_0x6f4d('0x2d')](_0x699d33,function(_0x3aa59a){if(_0x3aa59a[_0x6f4d('0x30')]!=='VIRTUAL'){var _0x589e3f={};_0x589e3f[_0x3aa59a[_0x6f4d('0x2c')]]={'$like':'%'+_0x3eefd3[_0x6f4d('0x33')][_0x6f4d('0x3f')]+'%'};return _0x589e3f;}})});}_0x4e6a23=_[_0x6f4d('0x3e')]({},_0x4e6a23,_0x3eefd3[_0x6f4d('0x40')]);var _0x2504d4={'where':_0x4e6a23[_0x6f4d('0x3c')]};return db['SquareMessage'][_0x6f4d('0x20')](_0x2504d4)['then'](function(_0x26c7d4){_0xbb2494[_0x6f4d('0x20')]=_0x26c7d4;if(_0x3eefd3['query'][_0x6f4d('0x41')]){_0x4e6a23[_0x6f4d('0x42')]=[{'all':!![]}];}return db[_0x6f4d('0x2e')][_0x6f4d('0x43')](_0x4e6a23);})['then'](function(_0x9758ad){_0xbb2494[_0x6f4d('0x44')]=_0x9758ad;return _0xbb2494;})['then'](respondWithFilteredResult(_0xb3015b,_0x4e6a23))[_0x6f4d('0x45')](handleError(_0xb3015b,null));};exports['show']=function(_0x1c8b10,_0x3ff65b){var _0x2c79ee={'raw':!![],'where':{'id':_0x1c8b10[_0x6f4d('0x46')]['id']}},_0xa61bf3={};_0xa61bf3[_0x6f4d('0x32')]=_[_0x6f4d('0x47')](db[_0x6f4d('0x2e')]['rawAttributes']);_0xa61bf3['query']=_[_0x6f4d('0x47')](_0x1c8b10['query']);_0xa61bf3['filters']=_[_0x6f4d('0x35')](_0xa61bf3[_0x6f4d('0x32')],_0xa61bf3[_0x6f4d('0x33')]);_0x2c79ee[_0x6f4d('0x36')]=_[_0x6f4d('0x35')](_0xa61bf3[_0x6f4d('0x32')],qs[_0x6f4d('0x37')](_0x1c8b10[_0x6f4d('0x33')][_0x6f4d('0x37')]));_0x2c79ee['attributes']=_0x2c79ee[_0x6f4d('0x36')][_0x6f4d('0x38')]?_0x2c79ee['attributes']:_0xa61bf3[_0x6f4d('0x32')];if(_0x1c8b10['query']['includeAll']){_0x2c79ee[_0x6f4d('0x42')]=[{'all':!![]}];}_0x2c79ee=_['merge']({},_0x2c79ee,_0x1c8b10[_0x6f4d('0x40')]);return db[_0x6f4d('0x2e')][_0x6f4d('0x48')](_0x2c79ee)[_0x6f4d('0x28')](handleEntityNotFound(_0x3ff65b,null))[_0x6f4d('0x28')](respondWithResult(_0x3ff65b,null))[_0x6f4d('0x45')](handleError(_0x3ff65b,null));};exports[_0x6f4d('0x49')]=function(_0x5597bd,_0x3aae32){return db[_0x6f4d('0x2e')][_0x6f4d('0x49')](_0x5597bd['body'],{})['then'](respondWithResult(_0x3aae32,0xc9))[_0x6f4d('0x45')](handleError(_0x3aae32,null));};exports[_0x6f4d('0x4a')]=function(_0x5c5d11,_0x560324){if(_0x5c5d11['body']['id']){delete _0x5c5d11[_0x6f4d('0x4b')]['id'];}return db[_0x6f4d('0x2e')][_0x6f4d('0x48')]({'where':{'id':_0x5c5d11[_0x6f4d('0x46')]['id']}})[_0x6f4d('0x28')](handleEntityNotFound(_0x560324,null))[_0x6f4d('0x28')](saveUpdates(_0x5c5d11[_0x6f4d('0x4b')],null))[_0x6f4d('0x28')](respondWithResult(_0x560324,null))[_0x6f4d('0x45')](handleError(_0x560324,null));};exports[_0x6f4d('0x29')]=function(_0x3d384f,_0x25bf09){return db[_0x6f4d('0x2e')][_0x6f4d('0x48')]({'where':{'id':_0x3d384f[_0x6f4d('0x46')]['id']}})[_0x6f4d('0x28')](handleEntityNotFound(_0x25bf09,null))[_0x6f4d('0x28')](removeEntity(_0x25bf09,null))['catch'](handleError(_0x25bf09,null));}; \ No newline at end of file +var _0x42f2=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','SquareMessage','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x690ac8,_0x17a0cb){var _0x5f060b=function(_0xc86e62){while(--_0xc86e62){_0x690ac8['push'](_0x690ac8['shift']());}};_0x5f060b(++_0x17a0cb);}(_0x42f2,0x1f4));var _0x242f=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x42f2[_0x34843e];return _0x598f7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x242f('0x0'));var zipdir=require(_0x242f('0x1'));var jsonpatch=require(_0x242f('0x2'));var rp=require(_0x242f('0x3'));var moment=require('moment');var BPromise=require(_0x242f('0x4'));var Mustache=require(_0x242f('0x5'));var util=require(_0x242f('0x6'));var path=require(_0x242f('0x7'));var sox=require(_0x242f('0x8'));var csv=require(_0x242f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x242f('0xa'));var _=require(_0x242f('0xb'));var squel=require(_0x242f('0xc'));var crypto=require(_0x242f('0xd'));var jsforce=require(_0x242f('0xe'));var deskjs=require(_0x242f('0xf'));var toCsv=require(_0x242f('0x9'));var querystring=require('querystring');var Papa=require(_0x242f('0x10'));var Redis=require(_0x242f('0x11'));var authService=require(_0x242f('0x12'));var qs=require(_0x242f('0x13'));var as=require(_0x242f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x242f('0x15'))(_0x242f('0x16'));var utils=require(_0x242f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x242f('0x18'))['db'];function respondWithStatusCode(_0x1674cc,_0x444ec4){_0x444ec4=_0x444ec4||0xcc;return function(_0x370333){if(_0x370333){return _0x1674cc[_0x242f('0x19')](_0x444ec4);}return _0x1674cc[_0x242f('0x1a')](_0x444ec4)[_0x242f('0x1b')]();};}function respondWithResult(_0x427774,_0x28cbd1){_0x28cbd1=_0x28cbd1||0xc8;return function(_0x3928db){if(_0x3928db){return _0x427774[_0x242f('0x1a')](_0x28cbd1)[_0x242f('0x1c')](_0x3928db);}};}function respondWithFilteredResult(_0x38412a,_0x56249c){return function(_0xa54050){if(_0xa54050){var _0x55ed7e=typeof _0x56249c[_0x242f('0x1d')]==='undefined'&&typeof _0x56249c['limit']===_0x242f('0x1e');var _0x19d474=_0xa54050[_0x242f('0x1f')];var _0x149707=_0x55ed7e?0x0:_0x56249c['offset'];var _0x2568da=_0x55ed7e?_0xa54050[_0x242f('0x1f')]:_0x56249c['offset']+_0x56249c[_0x242f('0x20')];var _0xea0a4b;if(_0x2568da>=_0x19d474){_0x2568da=_0x19d474;_0xea0a4b=0xc8;}else{_0xea0a4b=0xce;}_0x38412a['status'](_0xea0a4b);return _0x38412a[_0x242f('0x21')](_0x242f('0x22'),_0x149707+'-'+_0x2568da+'/'+_0x19d474)[_0x242f('0x1c')](_0xa54050);}return null;};}function patchUpdates(_0x3a8d70){return function(_0x3e94fe){try{jsonpatch['apply'](_0x3e94fe,_0x3a8d70,!![]);}catch(_0x45d77f){return BPromise[_0x242f('0x23')](_0x45d77f);}return _0x3e94fe[_0x242f('0x24')]();};}function saveUpdates(_0xcc5136,_0x3a97f5){return function(_0x10d585){if(_0x10d585){return _0x10d585[_0x242f('0x25')](_0xcc5136)[_0x242f('0x26')](function(_0x1b0882){return _0x1b0882;});}return null;};}function removeEntity(_0x3b5c99,_0x37b181){return function(_0x356268){if(_0x356268){return _0x356268[_0x242f('0x27')]()[_0x242f('0x26')](function(){_0x3b5c99[_0x242f('0x1a')](0xcc)[_0x242f('0x1b')]();});}};}function handleEntityNotFound(_0x5ba8f7,_0x20a356){return function(_0x208384){if(!_0x208384){_0x5ba8f7[_0x242f('0x19')](0x194);}return _0x208384;};}function handleError(_0x3d9fa6,_0x582cfd){_0x582cfd=_0x582cfd||0x1f4;return function(_0x456e4a){logger[_0x242f('0x28')](_0x456e4a[_0x242f('0x29')]);if(_0x456e4a['name']){delete _0x456e4a[_0x242f('0x2a')];}_0x3d9fa6['status'](_0x582cfd)['send'](_0x456e4a);};}exports['index']=function(_0x884bbb,_0x58d713){var _0x229427={},_0x30e1bb={},_0x5a9b1e={'count':0x0,'rows':[]};var _0x744a=_[_0x242f('0x2b')](db[_0x242f('0x2c')][_0x242f('0x2d')],function(_0x452116){return{'name':_0x452116[_0x242f('0x2e')],'type':_0x452116[_0x242f('0x2f')]['key']};});_0x30e1bb[_0x242f('0x30')]=_[_0x242f('0x2b')](_0x744a,'name');_0x30e1bb['query']=_[_0x242f('0x31')](_0x884bbb['query']);_0x30e1bb[_0x242f('0x32')]=_[_0x242f('0x33')](_0x30e1bb['model'],_0x30e1bb['query']);_0x229427[_0x242f('0x34')]=_[_0x242f('0x33')](_0x30e1bb[_0x242f('0x30')],qs[_0x242f('0x35')](_0x884bbb[_0x242f('0x36')]['fields']));_0x229427[_0x242f('0x34')]=_0x229427[_0x242f('0x34')][_0x242f('0x37')]?_0x229427[_0x242f('0x34')]:_0x30e1bb[_0x242f('0x30')];if(!_0x884bbb[_0x242f('0x36')][_0x242f('0x38')]('nolimit')){_0x229427[_0x242f('0x20')]=qs['limit'](_0x884bbb[_0x242f('0x36')][_0x242f('0x20')]);_0x229427[_0x242f('0x1d')]=qs[_0x242f('0x1d')](_0x884bbb['query']['offset']);}_0x229427[_0x242f('0x39')]=qs[_0x242f('0x3a')](_0x884bbb['query'][_0x242f('0x3a')]);_0x229427['where']=qs['filters'](_[_0x242f('0x3b')](_0x884bbb['query'],_0x30e1bb[_0x242f('0x32')]),_0x744a);if(_0x884bbb['query'][_0x242f('0x3c')]){_0x229427['where']=_[_0x242f('0x3d')](_0x229427[_0x242f('0x3e')],{'$or':_[_0x242f('0x2b')](_0x744a,function(_0x521dee){if(_0x521dee[_0x242f('0x2f')]!==_0x242f('0x3f')){var _0x5c95e8={};_0x5c95e8[_0x521dee[_0x242f('0x2a')]]={'$like':'%'+_0x884bbb[_0x242f('0x36')]['filter']+'%'};return _0x5c95e8;}})});}_0x229427=_['merge']({},_0x229427,_0x884bbb['options']);var _0x4cb00f={'where':_0x229427[_0x242f('0x3e')]};return db['SquareMessage'][_0x242f('0x1f')](_0x4cb00f)[_0x242f('0x26')](function(_0x4e88e){_0x5a9b1e[_0x242f('0x1f')]=_0x4e88e;if(_0x884bbb[_0x242f('0x36')]['includeAll']){_0x229427[_0x242f('0x40')]=[{'all':!![]}];}return db[_0x242f('0x2c')][_0x242f('0x41')](_0x229427);})[_0x242f('0x26')](function(_0x19965e){_0x5a9b1e[_0x242f('0x42')]=_0x19965e;return _0x5a9b1e;})[_0x242f('0x26')](respondWithFilteredResult(_0x58d713,_0x229427))[_0x242f('0x43')](handleError(_0x58d713,null));};exports[_0x242f('0x44')]=function(_0x25993a,_0x57ed41){var _0x76c777={'raw':!![],'where':{'id':_0x25993a[_0x242f('0x45')]['id']}},_0x262c51={};_0x262c51[_0x242f('0x30')]=_[_0x242f('0x31')](db[_0x242f('0x2c')][_0x242f('0x2d')]);_0x262c51[_0x242f('0x36')]=_[_0x242f('0x31')](_0x25993a[_0x242f('0x36')]);_0x262c51[_0x242f('0x32')]=_[_0x242f('0x33')](_0x262c51[_0x242f('0x30')],_0x262c51[_0x242f('0x36')]);_0x76c777[_0x242f('0x34')]=_[_0x242f('0x33')](_0x262c51['model'],qs['fields'](_0x25993a[_0x242f('0x36')][_0x242f('0x35')]));_0x76c777[_0x242f('0x34')]=_0x76c777[_0x242f('0x34')][_0x242f('0x37')]?_0x76c777[_0x242f('0x34')]:_0x262c51[_0x242f('0x30')];if(_0x25993a['query']['includeAll']){_0x76c777[_0x242f('0x40')]=[{'all':!![]}];}_0x76c777=_[_0x242f('0x3d')]({},_0x76c777,_0x25993a['options']);return db[_0x242f('0x2c')][_0x242f('0x46')](_0x76c777)[_0x242f('0x26')](handleEntityNotFound(_0x57ed41,null))[_0x242f('0x26')](respondWithResult(_0x57ed41,null))[_0x242f('0x43')](handleError(_0x57ed41,null));};exports[_0x242f('0x47')]=function(_0x232953,_0x4d4b73){return db[_0x242f('0x2c')][_0x242f('0x47')](_0x232953[_0x242f('0x48')],{})['then'](respondWithResult(_0x4d4b73,0xc9))['catch'](handleError(_0x4d4b73,null));};exports[_0x242f('0x25')]=function(_0x40ef21,_0x4aedb2){if(_0x40ef21[_0x242f('0x48')]['id']){delete _0x40ef21['body']['id'];}return db[_0x242f('0x2c')][_0x242f('0x46')]({'where':{'id':_0x40ef21[_0x242f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4aedb2,null))[_0x242f('0x26')](saveUpdates(_0x40ef21['body'],null))[_0x242f('0x26')](respondWithResult(_0x4aedb2,null))[_0x242f('0x43')](handleError(_0x4aedb2,null));};exports[_0x242f('0x27')]=function(_0x49a167,_0x56389a){return db[_0x242f('0x2c')][_0x242f('0x46')]({'where':{'id':_0x49a167[_0x242f('0x45')]['id']}})[_0x242f('0x26')](handleEntityNotFound(_0x56389a,null))[_0x242f('0x26')](removeEntity(_0x56389a,null))[_0x242f('0x43')](handleError(_0x56389a,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index fac7301..06efa4a 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 _0x0d07=['define','square_messages','util','../../config/logger','moment','path','../../config/environment','./squareMessage.attributes'];(function(_0x341bae,_0x3cbf3e){var _0x429e68=function(_0x3866d5){while(--_0x3866d5){_0x341bae['push'](_0x341bae['shift']());}};_0x429e68(++_0x3cbf3e);}(_0x0d07,0x72));var _0x70d0=function(_0x15860c,_0x581326){_0x15860c=_0x15860c-0x0;var _0x99bcbe=_0x0d07[_0x15860c];return _0x99bcbe;};'use strict';var _=require('lodash');var util=require(_0x70d0('0x0'));var logger=require(_0x70d0('0x1'))('api');var moment=require(_0x70d0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x70d0('0x3'));var rimraf=require('rimraf');var config=require(_0x70d0('0x4'));var attributes=require(_0x70d0('0x5'));module['exports']=function(_0x12ff21,_0x32a331){return _0x12ff21[_0x70d0('0x6')]('SquareMessage',attributes,{'tableName':_0x70d0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6608=['../../config/logger','bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6608,0x8e));var _0x8660=function(_0x11161f,_0x557df1){_0x11161f=_0x11161f-0x0;var _0x24bddf=_0x6608[_0x11161f];return _0x24bddf;};'use strict';var _=require(_0x8660('0x0'));var util=require(_0x8660('0x1'));var logger=require(_0x8660('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8660('0x3'));var rp=require(_0x8660('0x4'));var fs=require('fs');var path=require(_0x8660('0x5'));var rimraf=require(_0x8660('0x6'));var config=require('../../config/environment');var attributes=require(_0x8660('0x7'));module[_0x8660('0x8')]=function(_0x3104ee,_0x2c8cc1){return _0x3104ee[_0x8660('0x9')](_0x8660('0xa'),attributes,{'tableName':_0x8660('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 02e3812..102c106 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 _0x041e=['SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','SquareMessage','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','SquareMessage,\x20%s,\x20%s'];(function(_0x524d7f,_0x61d98b){var _0x49514b=function(_0x36899f){while(--_0x36899f){_0x524d7f['push'](_0x524d7f['shift']());}};_0x49514b(++_0x61d98b);}(_0x041e,0x16c));var _0xe041=function(_0x5dd0a1,_0x49ecc8){_0x5dd0a1=_0x5dd0a1-0x0;var _0x32f063=_0x041e[_0x5dd0a1];return _0x32f063;};'use strict';var _=require(_0xe041('0x0'));var util=require(_0xe041('0x1'));var moment=require(_0xe041('0x2'));var BPromise=require(_0xe041('0x3'));var rs=require(_0xe041('0x4'));var fs=require('fs');var Redis=require(_0xe041('0x5'));var db=require(_0xe041('0x6'))['db'];var utils=require(_0xe041('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe041('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe041('0x9')][_0xe041('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb4c1b3,_0xcf8fd7,_0x56e86f){return new BPromise(function(_0xb14b3b,_0x34f435){return client[_0xe041('0xb')](_0xb4c1b3,_0x56e86f)['then'](function(_0x379969){logger[_0xe041('0xc')](_0xe041('0xd'),_0xcf8fd7,'request\x20sent');logger['debug'](_0xe041('0xe'),_0xcf8fd7,_0xe041('0xf'),JSON['stringify'](_0x379969));if(_0x379969[_0xe041('0x10')]){if(_0x379969[_0xe041('0x10')]['code']===0x1f4){logger[_0xe041('0x10')](_0xe041('0xd'),_0xcf8fd7,_0x379969[_0xe041('0x10')][_0xe041('0x11')]);return _0x34f435(_0x379969[_0xe041('0x10')][_0xe041('0x11')]);}logger[_0xe041('0x10')]('SquareMessage,\x20%s,\x20%s',_0xcf8fd7,_0x379969[_0xe041('0x10')]['message']);return _0xb14b3b(_0x379969[_0xe041('0x10')]['message']);}else{logger[_0xe041('0xc')](_0xe041('0xd'),_0xcf8fd7,_0xe041('0xf'));_0xb14b3b(_0x379969[_0xe041('0x12')]['message']);}})[_0xe041('0x13')](function(_0x19e863){logger[_0xe041('0x10')](_0xe041('0xd'),_0xcf8fd7,_0x19e863);_0x34f435(_0x19e863);});});}exports['CreateSquareMessage']=function(_0x7938ee){var _0x40daa8=this;return new Promise(function(_0x72705,_0x2b2e2){return db[_0xe041('0x14')]['create'](_0x7938ee[_0xe041('0x15')],{'raw':_0x7938ee[_0xe041('0x16')]?_0x7938ee[_0xe041('0x16')][_0xe041('0x17')]===undefined?!![]:![]:!![]})[_0xe041('0x18')](function(_0x3a7c91){logger['info']('CreateSquareMessage',_0x7938ee);logger['debug'](_0xe041('0x19'),_0x7938ee,JSON[_0xe041('0x1a')](_0x3a7c91));_0x72705(_0x3a7c91);})[_0xe041('0x13')](function(_0x5cd3f8){logger[_0xe041('0x10')](_0xe041('0x19'),_0x5cd3f8[_0xe041('0x11')],_0x7938ee);_0x2b2e2(_0x40daa8[_0xe041('0x10')](0x1f4,_0x5cd3f8[_0xe041('0x11')]));});});}; \ No newline at end of file +var _0x6381=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash'];(function(_0x32403a,_0x558fdf){var _0x3df4c9=function(_0x16e06c){while(--_0x16e06c){_0x32403a['push'](_0x32403a['shift']());}};_0x3df4c9(++_0x558fdf);}(_0x6381,0x1a3));var _0x1638=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6381[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1638('0x0'));var util=require('util');var moment=require(_0x1638('0x1'));var BPromise=require(_0x1638('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1638('0x3'));var db=require(_0x1638('0x4'))['db'];var utils=require(_0x1638('0x5'));var logger=require(_0x1638('0x6'))('rpc');var config=require(_0x1638('0x7'));var jayson=require(_0x1638('0x8'));var client=jayson['client'][_0x1638('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30f5f8,_0x4af8fd,_0x30f0d3){return new BPromise(function(_0x280c44,_0x3520ba){return client[_0x1638('0xa')](_0x30f5f8,_0x30f0d3)[_0x1638('0xb')](function(_0x5a8e16){logger[_0x1638('0xc')](_0x1638('0xd'),_0x4af8fd,_0x1638('0xe'));logger[_0x1638('0xf')](_0x1638('0x10'),_0x4af8fd,'request\x20sent',JSON[_0x1638('0x11')](_0x5a8e16));if(_0x5a8e16[_0x1638('0x12')]){if(_0x5a8e16['error'][_0x1638('0x13')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x4af8fd,_0x5a8e16[_0x1638('0x12')]['message']);return _0x3520ba(_0x5a8e16['error'][_0x1638('0x14')]);}logger[_0x1638('0x12')]('SquareMessage,\x20%s,\x20%s',_0x4af8fd,_0x5a8e16[_0x1638('0x12')][_0x1638('0x14')]);return _0x280c44(_0x5a8e16[_0x1638('0x12')][_0x1638('0x14')]);}else{logger[_0x1638('0xc')]('SquareMessage,\x20%s,\x20%s',_0x4af8fd,'request\x20sent');_0x280c44(_0x5a8e16['result'][_0x1638('0x14')]);}})[_0x1638('0x15')](function(_0x4508d5){logger[_0x1638('0x12')]('SquareMessage,\x20%s,\x20%s',_0x4af8fd,_0x4508d5);_0x3520ba(_0x4508d5);});});}exports[_0x1638('0x16')]=function(_0x543c6c){var _0xe6015=this;return new Promise(function(_0x6dba25,_0xd46efc){return db[_0x1638('0x17')][_0x1638('0x18')](_0x543c6c[_0x1638('0x19')],{'raw':_0x543c6c[_0x1638('0x1a')]?_0x543c6c['options'][_0x1638('0x1b')]===undefined?!![]:![]:!![]})[_0x1638('0xb')](function(_0x41c9e2){logger[_0x1638('0xc')](_0x1638('0x16'),_0x543c6c);logger[_0x1638('0xf')](_0x1638('0x16'),_0x543c6c,JSON[_0x1638('0x11')](_0x41c9e2));_0x6dba25(_0x41c9e2);})[_0x1638('0x15')](function(_0xf81ea3){logger[_0x1638('0x12')](_0x1638('0x16'),_0xf81ea3['message'],_0x543c6c);_0xd46efc(_0xe6015[_0x1638('0x12')](0x1f4,_0xf81ea3['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c1dd802..a81ca1f 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 _0x4ecf=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','post','create'];(function(_0x1c8d72,_0x544d06){var _0x17a347=function(_0x510231){while(--_0x510231){_0x1c8d72['push'](_0x1c8d72['shift']());}};_0x17a347(++_0x544d06);}(_0x4ecf,0x12e));var _0xf4ec=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4ecf[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xf4ec('0x0'));var util=require(_0xf4ec('0x1'));var path=require(_0xf4ec('0x2'));var timeout=require(_0xf4ec('0x3'));var express=require(_0xf4ec('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf4ec('0x5'));var interaction=require(_0xf4ec('0x6'));var config=require(_0xf4ec('0x7'));var controller=require(_0xf4ec('0x8'));router[_0xf4ec('0x9')]('/',auth[_0xf4ec('0xa')](),controller[_0xf4ec('0xb')]);router[_0xf4ec('0x9')](_0xf4ec('0xc'),auth[_0xf4ec('0xa')](),controller[_0xf4ec('0xd')]);router[_0xf4ec('0x9')]('/:id/test',auth['isAuthenticated'](),timeout(_0xf4ec('0xe')),controller[_0xf4ec('0xf')]);router[_0xf4ec('0x10')]('/',auth['isAuthenticated'](),controller[_0xf4ec('0x11')]);router['put'](_0xf4ec('0xc'),auth[_0xf4ec('0xa')](),controller['update']);router['delete'](_0xf4ec('0xc'),auth[_0xf4ec('0xa')](),controller[_0xf4ec('0x12')]);module[_0xf4ec('0x13')]=router; \ No newline at end of file +var _0x116d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','show','/:id/test','test','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x3b767d,_0x2d5aa7){var _0x439d41=function(_0x99fc88){while(--_0x99fc88){_0x3b767d['push'](_0x3b767d['shift']());}};_0x439d41(++_0x2d5aa7);}(_0x116d,0x79));var _0xd116=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x116d[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xd116('0x0'));var util=require(_0xd116('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd116('0x2'));var router=express[_0xd116('0x3')]();var fs_extra=require(_0xd116('0x4'));var auth=require(_0xd116('0x5'));var interaction=require(_0xd116('0x6'));var config=require(_0xd116('0x7'));var controller=require(_0xd116('0x8'));router[_0xd116('0x9')]('/',auth[_0xd116('0xa')](),controller['index']);router[_0xd116('0x9')]('/:id',auth[_0xd116('0xa')](),controller[_0xd116('0xb')]);router[_0xd116('0x9')](_0xd116('0xc'),auth[_0xd116('0xa')](),timeout('15s'),controller[_0xd116('0xd')]);router['post']('/',auth[_0xd116('0xa')](),controller[_0xd116('0xe')]);router[_0xd116('0xf')](_0xd116('0x10'),auth[_0xd116('0xa')](),controller[_0xd116('0x11')]);router[_0xd116('0x12')](_0xd116('0x10'),auth[_0xd116('0xa')](),controller[_0xd116('0x13')]);module[_0xd116('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index a16bd11..72f7b20 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 _0xe31e=['sequelize','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe31e,0x114));var _0xee31=function(_0x2ef8e8,_0x2d34e2){_0x2ef8e8=_0x2ef8e8-0x0;var _0x22b7ce=_0xe31e[_0x2ef8e8];return _0x22b7ce;};'use strict';var Sequelize=require(_0xee31('0x0'));module['exports']={'name':{'type':Sequelize[_0xee31('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xee31('0x1')]},'description':{'type':Sequelize[_0xee31('0x1')]}}; \ No newline at end of file +var _0xc722=['sequelize','exports','STRING'];(function(_0xf80a73,_0x36ab73){var _0x4ff2ca=function(_0x13dade){while(--_0x13dade){_0xf80a73['push'](_0xf80a73['shift']());}};_0x4ff2ca(++_0x36ab73);}(_0xc722,0x198));var _0x2c72=function(_0x495659,_0x1d76c2){_0x495659=_0x495659-0x0;var _0x111d16=_0xc722[_0x495659];return _0x111d16;};'use strict';var Sequelize=require(_0x2c72('0x0'));module[_0x2c72('0x1')]={'name':{'type':Sequelize[_0x2c72('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x2c72('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index d06b4b5..4b8eedc 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 _0x34bd=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','end','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','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','test','dsn','odbc','openSync','eml-format','rimraf','fast-json-patch','bluebird','mustache','util'];(function(_0x19ab5f,_0x4b445c){var _0x483ba4=function(_0x89b793){while(--_0x89b793){_0x19ab5f['push'](_0x19ab5f['shift']());}};_0x483ba4(++_0x4b445c);}(_0x34bd,0x156));var _0xd34b=function(_0x2b18d8,_0x21778e){_0x2b18d8=_0x2b18d8-0x0;var _0x2bcce2=_0x34bd[_0x2b18d8];return _0x2bcce2;};'use strict';var emlformat=require(_0xd34b('0x0'));var rimraf=require(_0xd34b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd34b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd34b('0x3'));var Mustache=require(_0xd34b('0x4'));var util=require(_0xd34b('0x5'));var path=require(_0xd34b('0x6'));var sox=require(_0xd34b('0x7'));var csv=require(_0xd34b('0x8'));var ejs=require(_0xd34b('0x9'));var fs=require('fs');var fs_extra=require(_0xd34b('0xa'));var _=require(_0xd34b('0xb'));var squel=require(_0xd34b('0xc'));var crypto=require(_0xd34b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd34b('0x8'));var querystring=require('querystring');var Papa=require(_0xd34b('0xe'));var Redis=require(_0xd34b('0xf'));var authService=require(_0xd34b('0x10'));var qs=require(_0xd34b('0x11'));var as=require(_0xd34b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd34b('0x13'))(_0xd34b('0x14'));var utils=require('../../config/utils');var config=require(_0xd34b('0x15'));var licenseUtil=require(_0xd34b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42157f,_0x21471b){_0x21471b=_0x21471b||0xcc;return function(_0x56de41){if(_0x56de41){return _0x42157f[_0xd34b('0x17')](_0x21471b);}return _0x42157f['status'](_0x21471b)['end']();};}function respondWithResult(_0x1d569b,_0x217b3d){_0x217b3d=_0x217b3d||0xc8;return function(_0x2bf226){if(_0x2bf226){return _0x1d569b[_0xd34b('0x18')](_0x217b3d)[_0xd34b('0x19')](_0x2bf226);}};}function respondWithFilteredResult(_0x54ac42,_0x484ed4){return function(_0x4aacfe){if(_0x4aacfe){var _0x181949=typeof _0x484ed4['offset']===_0xd34b('0x1a')&&typeof _0x484ed4[_0xd34b('0x1b')]===_0xd34b('0x1a');var _0x5d9474=_0x4aacfe[_0xd34b('0x1c')];var _0x3a4ae7=_0x181949?0x0:_0x484ed4['offset'];var _0x1a0775=_0x181949?_0x4aacfe[_0xd34b('0x1c')]:_0x484ed4[_0xd34b('0x1d')]+_0x484ed4[_0xd34b('0x1b')];var _0x3045e9;if(_0x1a0775>=_0x5d9474){_0x1a0775=_0x5d9474;_0x3045e9=0xc8;}else{_0x3045e9=0xce;}_0x54ac42['status'](_0x3045e9);return _0x54ac42[_0xd34b('0x1e')](_0xd34b('0x1f'),_0x3a4ae7+'-'+_0x1a0775+'/'+_0x5d9474)[_0xd34b('0x19')](_0x4aacfe);}return null;};}function patchUpdates(_0x4c41a1){return function(_0x84dca1){try{jsonpatch[_0xd34b('0x20')](_0x84dca1,_0x4c41a1,!![]);}catch(_0x407524){return BPromise[_0xd34b('0x21')](_0x407524);}return _0x84dca1[_0xd34b('0x22')]();};}function saveUpdates(_0x21232a,_0x165327){return function(_0x579185){if(_0x579185){return _0x579185[_0xd34b('0x23')](_0x21232a)[_0xd34b('0x24')](function(_0x18d73e){return _0x18d73e;});}return null;};}function removeEntity(_0x2b5f1b,_0x40718b){return function(_0x2ddc08){if(_0x2ddc08){return _0x2ddc08[_0xd34b('0x25')]()[_0xd34b('0x24')](function(){var _0x5fcee4=_0x2ddc08['get']({'plain':!![]});var _0x39a6d5=_0xd34b('0x26');return db[_0xd34b('0x27')][_0xd34b('0x25')]({'where':{'type':_0x39a6d5,'resourceId':_0x5fcee4['id']}})[_0xd34b('0x24')](function(){return _0x2ddc08;});})[_0xd34b('0x24')](function(){_0x2b5f1b[_0xd34b('0x18')](0xcc)[_0xd34b('0x28')]();});}};}function handleEntityNotFound(_0x198fba,_0x5e792d){return function(_0x36f7a2){if(!_0x36f7a2){_0x198fba[_0xd34b('0x17')](0x194);}return _0x36f7a2;};}function handleError(_0x48ece0,_0x285c5f){_0x285c5f=_0x285c5f||0x1f4;return function(_0x43727d){logger[_0xd34b('0x29')](_0x43727d['stack']);if(_0x43727d[_0xd34b('0x2a')]){delete _0x43727d[_0xd34b('0x2a')];}_0x48ece0[_0xd34b('0x18')](_0x285c5f)[_0xd34b('0x2b')](_0x43727d);};}exports[_0xd34b('0x2c')]=function(_0x2ef5f3,_0xb0c184){var _0x43bd42={},_0x4f7b73={},_0x5bfa53={'count':0x0,'rows':[]};var _0x4351c5=_[_0xd34b('0x2d')](db[_0xd34b('0x2e')][_0xd34b('0x2f')],function(_0x3ab48e){return{'name':_0x3ab48e[_0xd34b('0x30')],'type':_0x3ab48e[_0xd34b('0x31')][_0xd34b('0x32')]};});_0x4f7b73[_0xd34b('0x33')]=_['map'](_0x4351c5,_0xd34b('0x2a'));_0x4f7b73[_0xd34b('0x34')]=_[_0xd34b('0x35')](_0x2ef5f3[_0xd34b('0x34')]);_0x4f7b73['filters']=_[_0xd34b('0x36')](_0x4f7b73[_0xd34b('0x33')],_0x4f7b73[_0xd34b('0x34')]);_0x43bd42[_0xd34b('0x37')]=_[_0xd34b('0x36')](_0x4f7b73[_0xd34b('0x33')],qs[_0xd34b('0x38')](_0x2ef5f3[_0xd34b('0x34')][_0xd34b('0x38')]));_0x43bd42[_0xd34b('0x37')]=_0x43bd42[_0xd34b('0x37')][_0xd34b('0x39')]?_0x43bd42[_0xd34b('0x37')]:_0x4f7b73[_0xd34b('0x33')];if(!_0x2ef5f3['query']['hasOwnProperty']('nolimit')){_0x43bd42[_0xd34b('0x1b')]=qs[_0xd34b('0x1b')](_0x2ef5f3[_0xd34b('0x34')][_0xd34b('0x1b')]);_0x43bd42[_0xd34b('0x1d')]=qs['offset'](_0x2ef5f3['query'][_0xd34b('0x1d')]);}_0x43bd42[_0xd34b('0x3a')]=qs[_0xd34b('0x3b')](_0x2ef5f3[_0xd34b('0x34')][_0xd34b('0x3b')]);_0x43bd42[_0xd34b('0x3c')]=qs[_0xd34b('0x3d')](_[_0xd34b('0x3e')](_0x2ef5f3['query'],_0x4f7b73[_0xd34b('0x3d')]),_0x4351c5);if(_0x2ef5f3[_0xd34b('0x34')][_0xd34b('0x3f')]){_0x43bd42[_0xd34b('0x3c')]=_[_0xd34b('0x40')](_0x43bd42[_0xd34b('0x3c')],{'$or':_[_0xd34b('0x2d')](_0x4351c5,function(_0x34c424){if(_0x34c424[_0xd34b('0x31')]!==_0xd34b('0x41')){var _0x5c42de={};_0x5c42de[_0x34c424['name']]={'$like':'%'+_0x2ef5f3[_0xd34b('0x34')]['filter']+'%'};return _0x5c42de;}})});}_0x43bd42=_[_0xd34b('0x40')]({},_0x43bd42,_0x2ef5f3[_0xd34b('0x42')]);var _0x1f1266={'where':_0x43bd42['where']};return db[_0xd34b('0x2e')][_0xd34b('0x1c')](_0x1f1266)[_0xd34b('0x24')](function(_0x2ca9b2){_0x5bfa53['count']=_0x2ca9b2;if(_0x2ef5f3[_0xd34b('0x34')][_0xd34b('0x43')]){_0x43bd42['include']=[{'all':!![]}];}return db[_0xd34b('0x2e')][_0xd34b('0x44')](_0x43bd42);})[_0xd34b('0x24')](function(_0x1f4a6b){_0x5bfa53[_0xd34b('0x45')]=_0x1f4a6b;return _0x5bfa53;})['then'](respondWithFilteredResult(_0xb0c184,_0x43bd42))[_0xd34b('0x46')](handleError(_0xb0c184,null));};exports['show']=function(_0x493754,_0x295609){var _0x241f0f={'raw':!![],'where':{'id':_0x493754[_0xd34b('0x47')]['id']}},_0x43123c={};_0x43123c[_0xd34b('0x33')]=_[_0xd34b('0x35')](db[_0xd34b('0x2e')]['rawAttributes']);_0x43123c[_0xd34b('0x34')]=_[_0xd34b('0x35')](_0x493754[_0xd34b('0x34')]);_0x43123c[_0xd34b('0x3d')]=_['intersection'](_0x43123c[_0xd34b('0x33')],_0x43123c[_0xd34b('0x34')]);_0x241f0f[_0xd34b('0x37')]=_[_0xd34b('0x36')](_0x43123c['model'],qs[_0xd34b('0x38')](_0x493754[_0xd34b('0x34')][_0xd34b('0x38')]));_0x241f0f[_0xd34b('0x37')]=_0x241f0f[_0xd34b('0x37')][_0xd34b('0x39')]?_0x241f0f['attributes']:_0x43123c[_0xd34b('0x33')];if(_0x493754['query'][_0xd34b('0x43')]){_0x241f0f['include']=[{'all':!![]}];}_0x241f0f=_[_0xd34b('0x40')]({},_0x241f0f,_0x493754['options']);return db[_0xd34b('0x2e')][_0xd34b('0x48')](_0x241f0f)[_0xd34b('0x24')](handleEntityNotFound(_0x295609,null))['then'](respondWithResult(_0x295609,null))[_0xd34b('0x46')](handleError(_0x295609,null));};exports[_0xd34b('0x49')]=function(_0x1211c6,_0x5f2807){return db['SquareOdbc'][_0xd34b('0x49')](_0x1211c6[_0xd34b('0x4a')],{})['then'](function(_0x4385e9){var _0x57bd9e=_0x1211c6[_0xd34b('0x4b')][_0xd34b('0x4c')]({'plain':!![]});if(!_0x57bd9e)throw new Error(_0xd34b('0x4d'));if(_0x57bd9e[_0xd34b('0x4e')]===_0xd34b('0x4b')){var _0x160581=_0x4385e9[_0xd34b('0x4c')]({'plain':!![]});var _0x14bd8d='ODBC';return db[_0xd34b('0x4f')]['find']({'where':{'name':_0x14bd8d,'userProfileId':_0x57bd9e[_0xd34b('0x50')]},'raw':!![]})[_0xd34b('0x24')](function(_0x40f9f5){if(_0x40f9f5&&_0x40f9f5[_0xd34b('0x51')]===0x0){return db[_0xd34b('0x27')][_0xd34b('0x49')]({'name':_0x160581[_0xd34b('0x2a')],'resourceId':_0x160581['id'],'type':_0x40f9f5[_0xd34b('0x2a')],'sectionId':_0x40f9f5['id']},{})[_0xd34b('0x24')](function(){return _0x4385e9;});}else{return _0x4385e9;}})[_0xd34b('0x46')](function(_0x3d054c){logger[_0xd34b('0x29')](_0xd34b('0x52'),_0x3d054c);throw _0x3d054c;});}return _0x4385e9;})['then'](respondWithResult(_0x5f2807,0xc9))['catch'](handleError(_0x5f2807,null));};exports[_0xd34b('0x23')]=function(_0x21f4de,_0x2fcb63){if(_0x21f4de[_0xd34b('0x4a')]['id']){delete _0x21f4de['body']['id'];}return db[_0xd34b('0x2e')][_0xd34b('0x48')]({'where':{'id':_0x21f4de[_0xd34b('0x47')]['id']}})[_0xd34b('0x24')](handleEntityNotFound(_0x2fcb63,null))[_0xd34b('0x24')](saveUpdates(_0x21f4de[_0xd34b('0x4a')],null))[_0xd34b('0x24')](respondWithResult(_0x2fcb63,null))[_0xd34b('0x46')](handleError(_0x2fcb63,null));};exports[_0xd34b('0x25')]=function(_0x5e2151,_0x53c06a){return db[_0xd34b('0x2e')][_0xd34b('0x48')]({'where':{'id':_0x5e2151[_0xd34b('0x47')]['id']}})['then'](handleEntityNotFound(_0x53c06a,null))[_0xd34b('0x24')](removeEntity(_0x53c06a,null))[_0xd34b('0x46')](handleError(_0x53c06a,null));};exports[_0xd34b('0x53')]=function(_0x5525d5,_0x539e1e,_0x1fc3bd){var _0x264cf9;return db['SquareOdbc'][_0xd34b('0x48')]({'where':{'id':_0x5525d5[_0xd34b('0x47')]['id']},'attributes':['id',_0xd34b('0x54')]})[_0xd34b('0x24')](handleEntityNotFound(_0x539e1e,null))['then'](function(_0x3dc209){if(_0x3dc209){var _0xc306d3=require(_0xd34b('0x55'))();_0xc306d3[_0xd34b('0x56')](_0x3dc209['dsn']);_0xc306d3['closeSync']();return _0x3dc209;}})[_0xd34b('0x24')](respondWithResult(_0x539e1e,null))[_0xd34b('0x46')](handleError(_0x539e1e,null));}; \ No newline at end of file +var _0x3609=['sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','offset','count','limit','status','set','apply','save','update','then','get','ODBC','UserProfileResource','destroy','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x4b2975,_0x2be462){var _0x3bc9e8=function(_0x4d1a7e){while(--_0x4d1a7e){_0x4b2975['push'](_0x4b2975['shift']());}};_0x3bc9e8(++_0x2be462);}(_0x3609,0x119));var _0x9360=function(_0xa65d00,_0x54807f){_0xa65d00=_0xa65d00-0x0;var _0x5c2e44=_0x3609[_0xa65d00];return _0x5c2e44;};'use strict';var emlformat=require(_0x9360('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9360('0x1'));var jsonpatch=require(_0x9360('0x2'));var rp=require(_0x9360('0x3'));var moment=require('moment');var BPromise=require(_0x9360('0x4'));var Mustache=require(_0x9360('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9360('0x6'));var ejs=require(_0x9360('0x7'));var fs=require('fs');var fs_extra=require(_0x9360('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9360('0x9'));var jsforce=require(_0x9360('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9360('0x6'));var querystring=require(_0x9360('0xb'));var Papa=require('papaparse');var Redis=require(_0x9360('0xc'));var authService=require(_0x9360('0xd'));var qs=require(_0x9360('0xe'));var as=require(_0x9360('0xf'));var hardwareService=require(_0x9360('0x10'));var logger=require(_0x9360('0x11'))(_0x9360('0x12'));var utils=require(_0x9360('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9360('0x14'));var db=require(_0x9360('0x15'))['db'];function respondWithStatusCode(_0x3cbba9,_0x41aa54){_0x41aa54=_0x41aa54||0xcc;return function(_0x3e28ac){if(_0x3e28ac){return _0x3cbba9[_0x9360('0x16')](_0x41aa54);}return _0x3cbba9['status'](_0x41aa54)[_0x9360('0x17')]();};}function respondWithResult(_0x394110,_0x130ee0){_0x130ee0=_0x130ee0||0xc8;return function(_0x23b178){if(_0x23b178){return _0x394110['status'](_0x130ee0)[_0x9360('0x18')](_0x23b178);}};}function respondWithFilteredResult(_0x30deea,_0xda710f){return function(_0x3b11fd){if(_0x3b11fd){var _0x4a59ab=typeof _0xda710f['offset']===_0x9360('0x19')&&typeof _0xda710f['limit']===_0x9360('0x19');var _0x12989d=_0x3b11fd['count'];var _0x2c356f=_0x4a59ab?0x0:_0xda710f[_0x9360('0x1a')];var _0x57fafa=_0x4a59ab?_0x3b11fd[_0x9360('0x1b')]:_0xda710f['offset']+_0xda710f[_0x9360('0x1c')];var _0x563c5b;if(_0x57fafa>=_0x12989d){_0x57fafa=_0x12989d;_0x563c5b=0xc8;}else{_0x563c5b=0xce;}_0x30deea[_0x9360('0x1d')](_0x563c5b);return _0x30deea[_0x9360('0x1e')]('Content-Range',_0x2c356f+'-'+_0x57fafa+'/'+_0x12989d)[_0x9360('0x18')](_0x3b11fd);}return null;};}function patchUpdates(_0xead030){return function(_0x12d9b2){try{jsonpatch[_0x9360('0x1f')](_0x12d9b2,_0xead030,!![]);}catch(_0x19d15d){return BPromise['reject'](_0x19d15d);}return _0x12d9b2[_0x9360('0x20')]();};}function saveUpdates(_0x1d7b7b,_0x196b3e){return function(_0x43c464){if(_0x43c464){return _0x43c464[_0x9360('0x21')](_0x1d7b7b)[_0x9360('0x22')](function(_0x547c7b){return _0x547c7b;});}return null;};}function removeEntity(_0x31606e,_0x16c367){return function(_0x39ab2a){if(_0x39ab2a){return _0x39ab2a['destroy']()[_0x9360('0x22')](function(){var _0x1f1c2e=_0x39ab2a[_0x9360('0x23')]({'plain':!![]});var _0x339b9d=_0x9360('0x24');return db[_0x9360('0x25')][_0x9360('0x26')]({'where':{'type':_0x339b9d,'resourceId':_0x1f1c2e['id']}})[_0x9360('0x22')](function(){return _0x39ab2a;});})['then'](function(){_0x31606e[_0x9360('0x1d')](0xcc)[_0x9360('0x17')]();});}};}function handleEntityNotFound(_0x8ac592,_0x270e41){return function(_0x5d0ba4){if(!_0x5d0ba4){_0x8ac592[_0x9360('0x16')](0x194);}return _0x5d0ba4;};}function handleError(_0x455a26,_0x386473){_0x386473=_0x386473||0x1f4;return function(_0x4849e9){logger['error'](_0x4849e9[_0x9360('0x27')]);if(_0x4849e9[_0x9360('0x28')]){delete _0x4849e9['name'];}_0x455a26['status'](_0x386473)[_0x9360('0x29')](_0x4849e9);};}exports[_0x9360('0x2a')]=function(_0x342636,_0x5031a6){var _0x519f74={},_0x3cf868={},_0x11f755={'count':0x0,'rows':[]};var _0x3c8a46=_[_0x9360('0x2b')](db[_0x9360('0x2c')][_0x9360('0x2d')],function(_0x393cbd){return{'name':_0x393cbd['fieldName'],'type':_0x393cbd[_0x9360('0x2e')][_0x9360('0x2f')]};});_0x3cf868['model']=_['map'](_0x3c8a46,_0x9360('0x28'));_0x3cf868[_0x9360('0x30')]=_['keys'](_0x342636[_0x9360('0x30')]);_0x3cf868['filters']=_[_0x9360('0x31')](_0x3cf868[_0x9360('0x32')],_0x3cf868[_0x9360('0x30')]);_0x519f74[_0x9360('0x33')]=_[_0x9360('0x31')](_0x3cf868[_0x9360('0x32')],qs['fields'](_0x342636['query'][_0x9360('0x34')]));_0x519f74[_0x9360('0x33')]=_0x519f74[_0x9360('0x33')]['length']?_0x519f74['attributes']:_0x3cf868[_0x9360('0x32')];if(!_0x342636[_0x9360('0x30')][_0x9360('0x35')](_0x9360('0x36'))){_0x519f74[_0x9360('0x1c')]=qs['limit'](_0x342636[_0x9360('0x30')][_0x9360('0x1c')]);_0x519f74[_0x9360('0x1a')]=qs[_0x9360('0x1a')](_0x342636[_0x9360('0x30')][_0x9360('0x1a')]);}_0x519f74['order']=qs[_0x9360('0x37')](_0x342636[_0x9360('0x30')][_0x9360('0x37')]);_0x519f74['where']=qs[_0x9360('0x38')](_[_0x9360('0x39')](_0x342636[_0x9360('0x30')],_0x3cf868['filters']),_0x3c8a46);if(_0x342636[_0x9360('0x30')]['filter']){_0x519f74[_0x9360('0x3a')]=_[_0x9360('0x3b')](_0x519f74[_0x9360('0x3a')],{'$or':_[_0x9360('0x2b')](_0x3c8a46,function(_0x3cc556){if(_0x3cc556[_0x9360('0x2e')]!==_0x9360('0x3c')){var _0x207a8f={};_0x207a8f[_0x3cc556[_0x9360('0x28')]]={'$like':'%'+_0x342636[_0x9360('0x30')][_0x9360('0x3d')]+'%'};return _0x207a8f;}})});}_0x519f74=_['merge']({},_0x519f74,_0x342636[_0x9360('0x3e')]);var _0x29df37={'where':_0x519f74[_0x9360('0x3a')]};return db[_0x9360('0x2c')]['count'](_0x29df37)[_0x9360('0x22')](function(_0x162526){_0x11f755[_0x9360('0x1b')]=_0x162526;if(_0x342636[_0x9360('0x30')][_0x9360('0x3f')]){_0x519f74[_0x9360('0x40')]=[{'all':!![]}];}return db[_0x9360('0x2c')][_0x9360('0x41')](_0x519f74);})[_0x9360('0x22')](function(_0x1ddf8c){_0x11f755['rows']=_0x1ddf8c;return _0x11f755;})['then'](respondWithFilteredResult(_0x5031a6,_0x519f74))['catch'](handleError(_0x5031a6,null));};exports[_0x9360('0x42')]=function(_0x2d038d,_0x5f2efe){var _0x401689={'raw':!![],'where':{'id':_0x2d038d['params']['id']}},_0x4825ed={};_0x4825ed[_0x9360('0x32')]=_['keys'](db['SquareOdbc'][_0x9360('0x2d')]);_0x4825ed[_0x9360('0x30')]=_[_0x9360('0x43')](_0x2d038d[_0x9360('0x30')]);_0x4825ed[_0x9360('0x38')]=_[_0x9360('0x31')](_0x4825ed[_0x9360('0x32')],_0x4825ed['query']);_0x401689[_0x9360('0x33')]=_[_0x9360('0x31')](_0x4825ed['model'],qs['fields'](_0x2d038d[_0x9360('0x30')]['fields']));_0x401689['attributes']=_0x401689['attributes'][_0x9360('0x44')]?_0x401689[_0x9360('0x33')]:_0x4825ed[_0x9360('0x32')];if(_0x2d038d[_0x9360('0x30')][_0x9360('0x3f')]){_0x401689[_0x9360('0x40')]=[{'all':!![]}];}_0x401689=_[_0x9360('0x3b')]({},_0x401689,_0x2d038d[_0x9360('0x3e')]);return db['SquareOdbc'][_0x9360('0x45')](_0x401689)[_0x9360('0x22')](handleEntityNotFound(_0x5f2efe,null))[_0x9360('0x22')](respondWithResult(_0x5f2efe,null))[_0x9360('0x46')](handleError(_0x5f2efe,null));};exports[_0x9360('0x47')]=function(_0x281521,_0x39a481){return db[_0x9360('0x2c')][_0x9360('0x47')](_0x281521[_0x9360('0x48')],{})[_0x9360('0x22')](function(_0x5f7a27){var _0x47c9c6=_0x281521[_0x9360('0x49')][_0x9360('0x23')]({'plain':!![]});if(!_0x47c9c6)throw new Error(_0x9360('0x4a'));if(_0x47c9c6[_0x9360('0x4b')]===_0x9360('0x49')){var _0x51b870=_0x5f7a27['get']({'plain':!![]});var _0x512cc0=_0x9360('0x24');return db[_0x9360('0x4c')][_0x9360('0x45')]({'where':{'name':_0x512cc0,'userProfileId':_0x47c9c6['userProfileId']},'raw':!![]})[_0x9360('0x22')](function(_0x169fb2){if(_0x169fb2&&_0x169fb2[_0x9360('0x4d')]===0x0){return db[_0x9360('0x25')][_0x9360('0x47')]({'name':_0x51b870[_0x9360('0x28')],'resourceId':_0x51b870['id'],'type':_0x169fb2[_0x9360('0x28')],'sectionId':_0x169fb2['id']},{})[_0x9360('0x22')](function(){return _0x5f7a27;});}else{return _0x5f7a27;}})[_0x9360('0x46')](function(_0x517217){logger['error'](_0x9360('0x4e'),_0x517217);throw _0x517217;});}return _0x5f7a27;})['then'](respondWithResult(_0x39a481,0xc9))[_0x9360('0x46')](handleError(_0x39a481,null));};exports['update']=function(_0x1b81a5,_0x462c48){if(_0x1b81a5['body']['id']){delete _0x1b81a5[_0x9360('0x48')]['id'];}return db['SquareOdbc'][_0x9360('0x45')]({'where':{'id':_0x1b81a5['params']['id']}})[_0x9360('0x22')](handleEntityNotFound(_0x462c48,null))[_0x9360('0x22')](saveUpdates(_0x1b81a5[_0x9360('0x48')],null))['then'](respondWithResult(_0x462c48,null))['catch'](handleError(_0x462c48,null));};exports[_0x9360('0x26')]=function(_0x18e6ed,_0x55894c){return db['SquareOdbc'][_0x9360('0x45')]({'where':{'id':_0x18e6ed[_0x9360('0x4f')]['id']}})[_0x9360('0x22')](handleEntityNotFound(_0x55894c,null))['then'](removeEntity(_0x55894c,null))[_0x9360('0x46')](handleError(_0x55894c,null));};exports[_0x9360('0x50')]=function(_0xa37271,_0x4902af,_0x127aaf){var _0x23af10;return db[_0x9360('0x2c')][_0x9360('0x45')]({'where':{'id':_0xa37271[_0x9360('0x4f')]['id']},'attributes':['id',_0x9360('0x51')]})[_0x9360('0x22')](handleEntityNotFound(_0x4902af,null))[_0x9360('0x22')](function(_0x1c929f){if(_0x1c929f){var _0x2c9461=require(_0x9360('0x52'))();_0x2c9461[_0x9360('0x53')](_0x1c929f[_0x9360('0x51')]);_0x2c9461['closeSync']();return _0x1c929f;}})[_0x9360('0x22')](respondWithResult(_0x4902af,null))[_0x9360('0x46')](handleError(_0x4902af,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 69d82de..d460296 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 _0xa2c9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc','api'];(function(_0x22c702,_0x87cf6f){var _0x582f9b=function(_0x126453){while(--_0x126453){_0x22c702['push'](_0x22c702['shift']());}};_0x582f9b(++_0x87cf6f);}(_0xa2c9,0x1e9));var _0x9a2c=function(_0xfd4953,_0x54faa8){_0xfd4953=_0xfd4953-0x0;var _0x25e3f5=_0xa2c9[_0xfd4953];return _0x25e3f5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9a2c('0x0'));var moment=require(_0x9a2c('0x1'));var BPromise=require(_0x9a2c('0x2'));var rp=require(_0x9a2c('0x3'));var fs=require('fs');var path=require(_0x9a2c('0x4'));var rimraf=require(_0x9a2c('0x5'));var config=require(_0x9a2c('0x6'));var attributes=require(_0x9a2c('0x7'));module['exports']=function(_0x17454e,_0x370bd1){return _0x17454e['define'](_0x9a2c('0x8'),attributes,{'tableName':_0x9a2c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa79=['api','bluebird','request-promise','path','exports','define','lodash','util','../../config/logger'];(function(_0x40004e,_0x11e33d){var _0x1bf37a=function(_0x29913f){while(--_0x29913f){_0x40004e['push'](_0x40004e['shift']());}};_0x1bf37a(++_0x11e33d);}(_0xaa79,0x10b));var _0x9aa7=function(_0x447415,_0xa4b5bb){_0x447415=_0x447415-0x0;var _0x4d96d8=_0xaa79[_0x447415];return _0x4d96d8;};'use strict';var _=require(_0x9aa7('0x0'));var util=require(_0x9aa7('0x1'));var logger=require(_0x9aa7('0x2'))(_0x9aa7('0x3'));var moment=require('moment');var BPromise=require(_0x9aa7('0x4'));var rp=require(_0x9aa7('0x5'));var fs=require('fs');var path=require(_0x9aa7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x9aa7('0x7')]=function(_0x133565,_0x4f41b7){return _0x133565[_0x9aa7('0x8')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 6f683a2..c092aa3 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 _0xab2c=['rpc','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','SquareOdbc','find','options','raw','where','attributes','include','map','model','ShowSquareOdbc','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5527eb,_0x2d6f52){var _0x3d7f12=function(_0x21c48b){while(--_0x21c48b){_0x5527eb['push'](_0x5527eb['shift']());}};_0x3d7f12(++_0x2d6f52);}(_0xab2c,0x119));var _0xcab2=function(_0x13f5a2,_0x435893){_0x13f5a2=_0x13f5a2-0x0;var _0x1c2719=_0xab2c[_0x13f5a2];return _0x1c2719;};'use strict';var _=require(_0xcab2('0x0'));var util=require('util');var moment=require(_0xcab2('0x1'));var BPromise=require(_0xcab2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcab2('0x3'));var db=require(_0xcab2('0x4'))['db'];var utils=require(_0xcab2('0x5'));var logger=require(_0xcab2('0x6'))(_0xcab2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcab2('0x8')][_0xcab2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x90a87,_0x3a2e99,_0x2b8de0){return new BPromise(function(_0x53c15d,_0x51ebbf){return client[_0xcab2('0xa')](_0x90a87,_0x2b8de0)[_0xcab2('0xb')](function(_0x573454){logger[_0xcab2('0xc')](_0xcab2('0xd'),_0x3a2e99,'request\x20sent');logger[_0xcab2('0xe')](_0xcab2('0xf'),_0x3a2e99,_0xcab2('0x10'),JSON[_0xcab2('0x11')](_0x573454));if(_0x573454[_0xcab2('0x12')]){if(_0x573454[_0xcab2('0x12')][_0xcab2('0x13')]===0x1f4){logger[_0xcab2('0x12')](_0xcab2('0xd'),_0x3a2e99,_0x573454[_0xcab2('0x12')][_0xcab2('0x14')]);return _0x51ebbf(_0x573454[_0xcab2('0x12')][_0xcab2('0x14')]);}logger[_0xcab2('0x12')](_0xcab2('0xd'),_0x3a2e99,_0x573454[_0xcab2('0x12')]['message']);return _0x53c15d(_0x573454[_0xcab2('0x12')][_0xcab2('0x14')]);}else{logger[_0xcab2('0xc')](_0xcab2('0xd'),_0x3a2e99,_0xcab2('0x10'));_0x53c15d(_0x573454[_0xcab2('0x15')][_0xcab2('0x14')]);}})['catch'](function(_0x32a71b){logger[_0xcab2('0x12')](_0xcab2('0xd'),_0x3a2e99,_0x32a71b);_0x51ebbf(_0x32a71b);});});}exports['ShowSquareOdbc']=function(_0xeaef9b){var _0x44e4f6=this;return new Promise(function(_0x2c732c,_0x1a9faf){return db[_0xcab2('0x16')][_0xcab2('0x17')]({'raw':_0xeaef9b[_0xcab2('0x18')]?_0xeaef9b[_0xcab2('0x18')][_0xcab2('0x19')]===undefined?!![]:![]:!![],'where':_0xeaef9b[_0xcab2('0x18')]?_0xeaef9b[_0xcab2('0x18')][_0xcab2('0x1a')]||null:null,'attributes':_0xeaef9b[_0xcab2('0x18')]?_0xeaef9b[_0xcab2('0x18')][_0xcab2('0x1b')]||null:null,'include':_0xeaef9b[_0xcab2('0x18')]?_0xeaef9b['options'][_0xcab2('0x1c')]?_[_0xcab2('0x1d')](_0xeaef9b[_0xcab2('0x18')][_0xcab2('0x1c')],function(_0x37ec1c){return{'model':db[_0x37ec1c[_0xcab2('0x1e')]],'as':_0x37ec1c['as'],'attributes':_0x37ec1c[_0xcab2('0x1b')],'include':_0x37ec1c[_0xcab2('0x1c')]?_[_0xcab2('0x1d')](_0x37ec1c[_0xcab2('0x1c')],function(_0x75d5d0){return{'model':db[_0x75d5d0[_0xcab2('0x1e')]],'as':_0x75d5d0['as'],'attributes':_0x75d5d0['attributes'],'include':_0x75d5d0[_0xcab2('0x1c')]?_[_0xcab2('0x1d')](_0x75d5d0['include'],function(_0x5aed8b){return{'model':db[_0x5aed8b[_0xcab2('0x1e')]],'as':_0x5aed8b['as'],'attributes':_0x5aed8b[_0xcab2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d576d){logger[_0xcab2('0xc')](_0xcab2('0x1f'),_0xeaef9b);logger[_0xcab2('0xe')](_0xcab2('0x1f'),_0xeaef9b,JSON[_0xcab2('0x11')](_0x4d576d));_0x2c732c(_0x4d576d);})['catch'](function(_0x313d82){logger[_0xcab2('0x12')](_0xcab2('0x1f'),_0x313d82[_0xcab2('0x14')],_0xeaef9b);_0x1a9faf(_0x44e4f6[_0xcab2('0x12')](0x1f4,_0x313d82[_0xcab2('0x14')]));});});}; \ No newline at end of file +var _0x2130=['SquareOdbc','options','raw','attributes','include','map','model','ShowSquareOdbc','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch'];(function(_0x50667a,_0x86eb28){var _0x4987e5=function(_0x4482b1){while(--_0x4482b1){_0x50667a['push'](_0x50667a['shift']());}};_0x4987e5(++_0x86eb28);}(_0x2130,0x1b5));var _0x0213=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x2130[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x0213('0x0'));var util=require(_0x0213('0x1'));var moment=require(_0x0213('0x2'));var BPromise=require('bluebird');var rs=require(_0x0213('0x3'));var fs=require('fs');var Redis=require(_0x0213('0x4'));var db=require(_0x0213('0x5'))['db'];var utils=require(_0x0213('0x6'));var logger=require(_0x0213('0x7'))(_0x0213('0x8'));var config=require(_0x0213('0x9'));var jayson=require(_0x0213('0xa'));var client=jayson[_0x0213('0xb')][_0x0213('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a0593,_0x5c62f2,_0x14111e){return new BPromise(function(_0x218609,_0xebfd4f){return client[_0x0213('0xd')](_0x1a0593,_0x14111e)[_0x0213('0xe')](function(_0x5d4c4f){logger[_0x0213('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x5c62f2,_0x0213('0x10'));logger['debug'](_0x0213('0x11'),_0x5c62f2,_0x0213('0x10'),JSON[_0x0213('0x12')](_0x5d4c4f));if(_0x5d4c4f[_0x0213('0x13')]){if(_0x5d4c4f[_0x0213('0x13')][_0x0213('0x14')]===0x1f4){logger[_0x0213('0x13')](_0x0213('0x15'),_0x5c62f2,_0x5d4c4f['error'][_0x0213('0x16')]);return _0xebfd4f(_0x5d4c4f[_0x0213('0x13')][_0x0213('0x16')]);}logger[_0x0213('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x5c62f2,_0x5d4c4f[_0x0213('0x13')][_0x0213('0x16')]);return _0x218609(_0x5d4c4f['error'][_0x0213('0x16')]);}else{logger[_0x0213('0xf')](_0x0213('0x15'),_0x5c62f2,_0x0213('0x10'));_0x218609(_0x5d4c4f[_0x0213('0x17')]['message']);}})[_0x0213('0x18')](function(_0x3eba96){logger['error'](_0x0213('0x15'),_0x5c62f2,_0x3eba96);_0xebfd4f(_0x3eba96);});});}exports['ShowSquareOdbc']=function(_0x3ddeee){var _0x5a0cd7=this;return new Promise(function(_0x4983c9,_0x1bedac){return db[_0x0213('0x19')]['find']({'raw':_0x3ddeee[_0x0213('0x1a')]?_0x3ddeee['options'][_0x0213('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ddeee[_0x0213('0x1a')]?_0x3ddeee[_0x0213('0x1a')]['where']||null:null,'attributes':_0x3ddeee[_0x0213('0x1a')]?_0x3ddeee['options'][_0x0213('0x1c')]||null:null,'include':_0x3ddeee['options']?_0x3ddeee[_0x0213('0x1a')][_0x0213('0x1d')]?_[_0x0213('0x1e')](_0x3ddeee[_0x0213('0x1a')][_0x0213('0x1d')],function(_0x14f127){return{'model':db[_0x14f127['model']],'as':_0x14f127['as'],'attributes':_0x14f127['attributes'],'include':_0x14f127[_0x0213('0x1d')]?_['map'](_0x14f127[_0x0213('0x1d')],function(_0x5c611e){return{'model':db[_0x5c611e['model']],'as':_0x5c611e['as'],'attributes':_0x5c611e[_0x0213('0x1c')],'include':_0x5c611e[_0x0213('0x1d')]?_[_0x0213('0x1e')](_0x5c611e[_0x0213('0x1d')],function(_0x263741){return{'model':db[_0x263741[_0x0213('0x1f')]],'as':_0x263741['as'],'attributes':_0x263741[_0x0213('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0213('0xe')](function(_0xf4617){logger[_0x0213('0xf')](_0x0213('0x20'),_0x3ddeee);logger['debug'](_0x0213('0x20'),_0x3ddeee,JSON['stringify'](_0xf4617));_0x4983c9(_0xf4617);})[_0x0213('0x18')](function(_0x4f8a48){logger[_0x0213('0x13')]('ShowSquareOdbc',_0x4f8a48[_0x0213('0x16')],_0x3ddeee);_0x1bedac(_0x5a0cd7[_0x0213('0x13')](0x1f4,_0x4f8a48['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 285a711..b3db8ad 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 _0xd798=['addUsers','put','update','delete','destroy','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create'];(function(_0x37b92d,_0x120d10){var _0x53cc35=function(_0x5794d8){while(--_0x5794d8){_0x37b92d['push'](_0x37b92d['shift']());}};_0x53cc35(++_0x120d10);}(_0xd798,0x77));var _0x8d79=function(_0x512a65,_0x53d57f){_0x512a65=_0x512a65-0x0;var _0x31c28d=_0xd798[_0x512a65];return _0x31c28d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8d79('0x0'));var express=require(_0x8d79('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d79('0x2'));var interaction=require(_0x8d79('0x3'));var config=require(_0x8d79('0x4'));var controller=require('./squareProject.controller');router[_0x8d79('0x5')]('/',auth[_0x8d79('0x6')](),controller[_0x8d79('0x7')]);router[_0x8d79('0x5')](_0x8d79('0x8'),auth[_0x8d79('0x6')](),controller[_0x8d79('0x9')]);router[_0x8d79('0x5')](_0x8d79('0xa'),auth[_0x8d79('0x6')](),controller[_0x8d79('0xb')]);router[_0x8d79('0xc')]('/',auth['isAuthenticated'](),controller[_0x8d79('0xd')]);router[_0x8d79('0xc')](_0x8d79('0xa'),auth[_0x8d79('0x6')](),controller[_0x8d79('0xe')]);router[_0x8d79('0xf')](_0x8d79('0x8'),auth[_0x8d79('0x6')](),controller[_0x8d79('0x10')]);router[_0x8d79('0x11')]('/:id',auth[_0x8d79('0x6')](),controller[_0x8d79('0x12')]);router[_0x8d79('0x11')](_0x8d79('0xa'),auth[_0x8d79('0x6')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0x6888=['../../components/auth/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','create','post','addUsers','put','update','destroy','delete','removeUsers','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xcf1738,_0x3dfbad){var _0x1eded3=function(_0x38d495){while(--_0x38d495){_0xcf1738['push'](_0xcf1738['shift']());}};_0x1eded3(++_0x3dfbad);}(_0x6888,0xd2));var _0x8688=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x6888[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x8688('0x0'));var util=require('util');var path=require(_0x8688('0x1'));var timeout=require(_0x8688('0x2'));var express=require(_0x8688('0x3'));var router=express[_0x8688('0x4')]();var fs_extra=require(_0x8688('0x5'));var auth=require(_0x8688('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8688('0x7'));router[_0x8688('0x8')]('/',auth[_0x8688('0x9')](),controller[_0x8688('0xa')]);router[_0x8688('0x8')](_0x8688('0xb'),auth['isAuthenticated'](),controller[_0x8688('0xc')]);router[_0x8688('0x8')](_0x8688('0xd'),auth[_0x8688('0x9')](),controller[_0x8688('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8688('0xf')]);router[_0x8688('0x10')](_0x8688('0xd'),auth[_0x8688('0x9')](),controller[_0x8688('0x11')]);router[_0x8688('0x12')](_0x8688('0xb'),auth[_0x8688('0x9')](),controller[_0x8688('0x13')]);router['delete'](_0x8688('0xb'),auth[_0x8688('0x9')](),controller[_0x8688('0x14')]);router[_0x8688('0x15')](_0x8688('0xd'),auth[_0x8688('0x9')](),controller[_0x8688('0x16')]);module[_0x8688('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 917ffc3..c335831 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 _0x3d0f=['DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x2779f8,_0x551b6e){var _0x3ebaf1=function(_0x2c1d15){while(--_0x2c1d15){_0x2779f8['push'](_0x2779f8['shift']());}};_0x3ebaf1(++_0x551b6e);}(_0x3d0f,0x1f0));var _0xf3d0=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x3d0f[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0xf3d0('0x0'));module[_0xf3d0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xf3d0('0x2')]},'notes':{'type':Sequelize[_0xf3d0('0x3')]},'preproduction':{'type':Sequelize[_0xf3d0('0x4')](_0xf3d0('0x5')),'get':function(){if(this[_0xf3d0('0x6')](_0xf3d0('0x7'))){return this[_0xf3d0('0x6')](_0xf3d0('0x7'))[_0xf3d0('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xf3d0('0x6')](_0xf3d0('0x9'))){return this[_0xf3d0('0x6')](_0xf3d0('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xf3d0('0xa')]},'publishedAt':{'type':Sequelize[_0xf3d0('0xa')]}}; \ No newline at end of file +var _0xb6dc=['preproduction','toString','production','utf8','DATE','exports','STRING','name','TEXT','long','getDataValue'];(function(_0x2d8c3e,_0x31a977){var _0x4884c2=function(_0x3c3c13){while(--_0x3c3c13){_0x2d8c3e['push'](_0x2d8c3e['shift']());}};_0x4884c2(++_0x31a977);}(_0xb6dc,0xaa));var _0xcb6d=function(_0xbfe32b,_0x9e7ab6){_0xbfe32b=_0xbfe32b-0x0;var _0x5ac4f0=_0xb6dc[_0xbfe32b];return _0x5ac4f0;};'use strict';var Sequelize=require('sequelize');module[_0xcb6d('0x0')]={'name':{'type':Sequelize[_0xcb6d('0x1')],'unique':_0xcb6d('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xcb6d('0x1')]},'notes':{'type':Sequelize[_0xcb6d('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xcb6d('0x4')),'get':function(){if(this[_0xcb6d('0x5')](_0xcb6d('0x6'))){return this['getDataValue'](_0xcb6d('0x6'))[_0xcb6d('0x7')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xcb6d('0x4')),'get':function(){if(this[_0xcb6d('0x5')](_0xcb6d('0x8'))){return this[_0xcb6d('0x5')]('production')[_0xcb6d('0x7')](_0xcb6d('0x9'));}}},'savedAt':{'type':Sequelize[_0xcb6d('0xa')]},'publishedAt':{'type':Sequelize[_0xcb6d('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index c58def6..5a3cde7 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 _0x7b2c=['User','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','get','error','stack','name','send','index','map','SquareProject','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7b2c,0x18e));var _0xc7b2=function(_0x459ab0,_0xe33887){_0x459ab0=_0x459ab0-0x0;var _0x180df9=_0x7b2c[_0x459ab0];return _0x180df9;};'use strict';var emlformat=require(_0xc7b2('0x0'));var rimraf=require(_0xc7b2('0x1'));var zipdir=require(_0xc7b2('0x2'));var jsonpatch=require(_0xc7b2('0x3'));var rp=require(_0xc7b2('0x4'));var moment=require(_0xc7b2('0x5'));var BPromise=require(_0xc7b2('0x6'));var Mustache=require(_0xc7b2('0x7'));var util=require(_0xc7b2('0x8'));var path=require(_0xc7b2('0x9'));var sox=require(_0xc7b2('0xa'));var csv=require(_0xc7b2('0xb'));var ejs=require(_0xc7b2('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc7b2('0xd'));var squel=require(_0xc7b2('0xe'));var crypto=require(_0xc7b2('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc7b2('0xb'));var querystring=require(_0xc7b2('0x10'));var Papa=require('papaparse');var Redis=require(_0xc7b2('0x11'));var authService=require(_0xc7b2('0x12'));var qs=require(_0xc7b2('0x13'));var as=require(_0xc7b2('0x14'));var hardwareService=require(_0xc7b2('0x15'));var logger=require(_0xc7b2('0x16'))(_0xc7b2('0x17'));var utils=require('../../config/utils');var config=require(_0xc7b2('0x18'));var licenseUtil=require(_0xc7b2('0x19'));var db=require(_0xc7b2('0x1a'))['db'];config[_0xc7b2('0x1b')]=_['defaults'](config[_0xc7b2('0x1b')],{'host':_0xc7b2('0x1c'),'port':0x18eb});var socket=require(_0xc7b2('0x1d'))(new Redis(config['redis']));require(_0xc7b2('0x1e'))[_0xc7b2('0x1f')](socket);function respondWithStatusCode(_0x597ede,_0x458c6d){_0x458c6d=_0x458c6d||0xcc;return function(_0x4db477){if(_0x4db477){return _0x597ede[_0xc7b2('0x20')](_0x458c6d);}return _0x597ede['status'](_0x458c6d)[_0xc7b2('0x21')]();};}function respondWithResult(_0x5a2ebf,_0x2837f0){_0x2837f0=_0x2837f0||0xc8;return function(_0x3e6f51){if(_0x3e6f51){return _0x5a2ebf[_0xc7b2('0x22')](_0x2837f0)['json'](_0x3e6f51);}};}function respondWithFilteredResult(_0x4b8909,_0x1368c9){return function(_0x1ecd87){if(_0x1ecd87){var _0x38d371=typeof _0x1368c9[_0xc7b2('0x23')]==='undefined'&&typeof _0x1368c9[_0xc7b2('0x24')]===_0xc7b2('0x25');var _0x3d67a4=_0x1ecd87[_0xc7b2('0x26')];var _0x212c05=_0x38d371?0x0:_0x1368c9['offset'];var _0x14b9da=_0x38d371?_0x1ecd87[_0xc7b2('0x26')]:_0x1368c9[_0xc7b2('0x23')]+_0x1368c9[_0xc7b2('0x24')];var _0x217269;if(_0x14b9da>=_0x3d67a4){_0x14b9da=_0x3d67a4;_0x217269=0xc8;}else{_0x217269=0xce;}_0x4b8909[_0xc7b2('0x22')](_0x217269);return _0x4b8909[_0xc7b2('0x27')](_0xc7b2('0x28'),_0x212c05+'-'+_0x14b9da+'/'+_0x3d67a4)['json'](_0x1ecd87);}return null;};}function patchUpdates(_0x45fd70){return function(_0x553dfc){try{jsonpatch[_0xc7b2('0x29')](_0x553dfc,_0x45fd70,!![]);}catch(_0x5c2d13){return BPromise['reject'](_0x5c2d13);}return _0x553dfc[_0xc7b2('0x2a')]();};}function saveUpdates(_0x2b7677,_0x162f82){return function(_0x225cd0){if(_0x225cd0){return _0x225cd0[_0xc7b2('0x2b')](_0x2b7677)[_0xc7b2('0x2c')](function(_0x37b6b3){return _0x37b6b3;});}return null;};}function removeEntity(_0x89d6d4,_0xd1a06d){return function(_0x2c60eb){if(_0x2c60eb){return _0x2c60eb['destroy']()[_0xc7b2('0x2c')](function(){var _0x3ca49b=_0x2c60eb[_0xc7b2('0x2d')]({'plain':!![]});var _0x3bc40d='SquareProjects';return db['UserProfileResource']['destroy']({'where':{'type':_0x3bc40d,'resourceId':_0x3ca49b['id']}})['then'](function(){return _0x2c60eb;});})[_0xc7b2('0x2c')](function(){_0x89d6d4[_0xc7b2('0x22')](0xcc)[_0xc7b2('0x21')]();});}};}function handleEntityNotFound(_0x197729,_0x156fab){return function(_0xd6223c){if(!_0xd6223c){_0x197729['sendStatus'](0x194);}return _0xd6223c;};}function handleError(_0x10e996,_0x4f7d37){_0x4f7d37=_0x4f7d37||0x1f4;return function(_0x123938){logger[_0xc7b2('0x2e')](_0x123938[_0xc7b2('0x2f')]);if(_0x123938['name']){delete _0x123938[_0xc7b2('0x30')];}_0x10e996[_0xc7b2('0x22')](_0x4f7d37)[_0xc7b2('0x31')](_0x123938);};}exports[_0xc7b2('0x32')]=function(_0x4354a8,_0x243195){var _0x417ab6={},_0x295d15={},_0x450726={'count':0x0,'rows':[]};var _0x187721=_[_0xc7b2('0x33')](db[_0xc7b2('0x34')][_0xc7b2('0x35')],function(_0x384c0a){return{'name':_0x384c0a['fieldName'],'type':_0x384c0a['type'][_0xc7b2('0x36')]};});_0x295d15[_0xc7b2('0x37')]=_[_0xc7b2('0x33')](_0x187721,_0xc7b2('0x30'));_0x295d15[_0xc7b2('0x38')]=_[_0xc7b2('0x39')](_0x4354a8[_0xc7b2('0x38')]);_0x295d15[_0xc7b2('0x3a')]=_[_0xc7b2('0x3b')](_0x295d15['model'],_0x295d15[_0xc7b2('0x38')]);_0x417ab6[_0xc7b2('0x3c')]=_['intersection'](_0x295d15[_0xc7b2('0x37')],qs[_0xc7b2('0x3d')](_0x4354a8[_0xc7b2('0x38')][_0xc7b2('0x3d')]));_0x417ab6[_0xc7b2('0x3c')]=_0x417ab6[_0xc7b2('0x3c')][_0xc7b2('0x3e')]?_0x417ab6[_0xc7b2('0x3c')]:_0x295d15['model'];if(!_0x4354a8[_0xc7b2('0x38')][_0xc7b2('0x3f')](_0xc7b2('0x40'))){_0x417ab6[_0xc7b2('0x24')]=qs[_0xc7b2('0x24')](_0x4354a8['query'][_0xc7b2('0x24')]);_0x417ab6[_0xc7b2('0x23')]=qs[_0xc7b2('0x23')](_0x4354a8[_0xc7b2('0x38')][_0xc7b2('0x23')]);}_0x417ab6['order']=qs['sort'](_0x4354a8[_0xc7b2('0x38')][_0xc7b2('0x41')]);_0x417ab6[_0xc7b2('0x42')]=qs['filters'](_[_0xc7b2('0x43')](_0x4354a8[_0xc7b2('0x38')],_0x295d15[_0xc7b2('0x3a')]),_0x187721);if(_0x4354a8[_0xc7b2('0x38')][_0xc7b2('0x44')]){_0x417ab6[_0xc7b2('0x42')]=_[_0xc7b2('0x45')](_0x417ab6[_0xc7b2('0x42')],{'$or':_[_0xc7b2('0x33')](_0x187721,function(_0x27797a){if(_0x27797a[_0xc7b2('0x46')]!==_0xc7b2('0x47')){var _0x4a49ae={};_0x4a49ae[_0x27797a['name']]={'$like':'%'+_0x4354a8[_0xc7b2('0x38')]['filter']+'%'};return _0x4a49ae;}})});}_0x417ab6=_[_0xc7b2('0x45')]({},_0x417ab6,_0x4354a8[_0xc7b2('0x48')]);var _0x1a33c0={'where':_0x417ab6[_0xc7b2('0x42')]};return db[_0xc7b2('0x34')][_0xc7b2('0x26')](_0x1a33c0)[_0xc7b2('0x2c')](function(_0x29c4ad){_0x450726[_0xc7b2('0x26')]=_0x29c4ad;if(_0x4354a8[_0xc7b2('0x38')][_0xc7b2('0x49')]){_0x417ab6['include']=[{'all':!![]}];}return db[_0xc7b2('0x34')][_0xc7b2('0x4a')](_0x417ab6);})[_0xc7b2('0x2c')](function(_0x3acc94){_0x450726[_0xc7b2('0x4b')]=_0x3acc94;return _0x450726;})[_0xc7b2('0x2c')](respondWithFilteredResult(_0x243195,_0x417ab6))['catch'](handleError(_0x243195,null));};exports['show']=function(_0x24c323,_0x4a6447){var _0x5776ba={'raw':![],'where':{'id':_0x24c323['params']['id']}},_0x587d1a={};_0x587d1a['model']=_['keys'](db[_0xc7b2('0x34')][_0xc7b2('0x35')]);_0x587d1a[_0xc7b2('0x38')]=_[_0xc7b2('0x39')](_0x24c323[_0xc7b2('0x38')]);_0x587d1a[_0xc7b2('0x3a')]=_[_0xc7b2('0x3b')](_0x587d1a[_0xc7b2('0x37')],_0x587d1a[_0xc7b2('0x38')]);_0x5776ba[_0xc7b2('0x3c')]=_['intersection'](_0x587d1a['model'],qs[_0xc7b2('0x3d')](_0x24c323[_0xc7b2('0x38')]['fields']));_0x5776ba[_0xc7b2('0x3c')]=_0x5776ba[_0xc7b2('0x3c')][_0xc7b2('0x3e')]?_0x5776ba[_0xc7b2('0x3c')]:_0x587d1a['model'];if(_0x24c323['query']['includeAll']){_0x5776ba[_0xc7b2('0x4c')]=[{'all':!![]}];}_0x5776ba=_['merge']({},_0x5776ba,_0x24c323[_0xc7b2('0x48')]);return db[_0xc7b2('0x34')][_0xc7b2('0x4d')](_0x5776ba)[_0xc7b2('0x2c')](handleEntityNotFound(_0x4a6447,null))['then'](respondWithResult(_0x4a6447,null))[_0xc7b2('0x4e')](handleError(_0x4a6447,null));};exports['create']=function(_0x3b8d2c,_0x547833){return db[_0xc7b2('0x34')][_0xc7b2('0x4f')](_0x3b8d2c[_0xc7b2('0x50')],{})['then'](function(_0x3ca111){var _0x341c69=_0x3b8d2c['user']['get']({'plain':!![]});if(!_0x341c69)throw new Error(_0xc7b2('0x51'));if(_0x341c69[_0xc7b2('0x52')]==='user'){var _0x34d9b3=_0x3ca111[_0xc7b2('0x2d')]({'plain':!![]});var _0x5821be='SquareProjects';return db[_0xc7b2('0x53')][_0xc7b2('0x4d')]({'where':{'name':_0x5821be,'userProfileId':_0x341c69[_0xc7b2('0x54')]},'raw':!![]})[_0xc7b2('0x2c')](function(_0x4b14e5){if(_0x4b14e5&&_0x4b14e5[_0xc7b2('0x55')]===0x0){return db[_0xc7b2('0x56')][_0xc7b2('0x4f')]({'name':_0x34d9b3[_0xc7b2('0x30')],'resourceId':_0x34d9b3['id'],'type':_0x4b14e5[_0xc7b2('0x30')],'sectionId':_0x4b14e5['id']},{})[_0xc7b2('0x2c')](function(){return _0x3ca111;});}else{return _0x3ca111;}})[_0xc7b2('0x4e')](function(_0x59beb9){logger['error'](_0xc7b2('0x57'),_0x59beb9);throw _0x59beb9;});}return _0x3ca111;})['then'](respondWithResult(_0x547833,0xc9))['catch'](handleError(_0x547833,null));};exports[_0xc7b2('0x2b')]=function(_0x2a0e89,_0x42142b){if(_0x2a0e89['body']['id']){delete _0x2a0e89[_0xc7b2('0x50')]['id'];}return db[_0xc7b2('0x34')][_0xc7b2('0x4d')]({'where':{'id':_0x2a0e89['params']['id']}})[_0xc7b2('0x2c')](handleEntityNotFound(_0x42142b,null))[_0xc7b2('0x2c')](saveUpdates(_0x2a0e89['body'],null))[_0xc7b2('0x2c')](respondWithResult(_0x42142b,null))[_0xc7b2('0x4e')](handleError(_0x42142b,null));};exports[_0xc7b2('0x58')]=function(_0x28fe39,_0x25a0cc){return db['SquareProject'][_0xc7b2('0x4d')]({'where':{'id':_0x28fe39[_0xc7b2('0x59')]['id']}})[_0xc7b2('0x2c')](handleEntityNotFound(_0x25a0cc,null))[_0xc7b2('0x2c')](removeEntity(_0x25a0cc,null))[_0xc7b2('0x4e')](handleError(_0x25a0cc,null));};exports['addUsers']=function(_0x737134,_0x5b75cd,_0x46a02d){return db[_0xc7b2('0x34')][_0xc7b2('0x4d')]({'where':{'id':_0x737134['params']['id']}})[_0xc7b2('0x2c')](handleEntityNotFound(_0x5b75cd,null))['then'](function(_0x4e7592){if(_0x4e7592){return _0x4e7592['addUsers'](_0x737134[_0xc7b2('0x50')][_0xc7b2('0x5a')],_[_0xc7b2('0x5b')](_0x737134['body'],[_0xc7b2('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x5b75cd,null))['catch'](handleError(_0x5b75cd,null));};exports[_0xc7b2('0x5c')]=function(_0x1167a6,_0x3814d7,_0x69c5f0){return db[_0xc7b2('0x34')][_0xc7b2('0x4d')]({'where':{'id':_0x1167a6[_0xc7b2('0x59')]['id']}})[_0xc7b2('0x2c')](handleEntityNotFound(_0x3814d7,null))[_0xc7b2('0x2c')](function(_0x3eda27){if(_0x3eda27){return _0x3eda27['removeUsers'](_0x1167a6[_0xc7b2('0x38')]['ids'])['then'](function(){if(_[_0xc7b2('0x5d')](_0x1167a6[_0xc7b2('0x38')][_0xc7b2('0x5a')])){for(var _0x117bf7=0x0;_0x117bf7<_0x1167a6[_0xc7b2('0x38')][_0xc7b2('0x5a')][_0xc7b2('0x3e')];_0x117bf7+=0x1){socket[_0xc7b2('0x5e')](_0xc7b2('0x5f'),{'UserId':Number(_0x1167a6['query'][_0xc7b2('0x5a')][_0x117bf7]),'SquareProjectId':Number(_0x1167a6['params']['id'])});}}else{socket[_0xc7b2('0x5e')](_0xc7b2('0x5f'),{'UserId':Number(_0x1167a6[_0xc7b2('0x38')][_0xc7b2('0x5a')]),'SquareProjectId':Number(_0x1167a6[_0xc7b2('0x59')]['id'])});}});}})[_0xc7b2('0x2c')](respondWithStatusCode(_0x3814d7,null))[_0xc7b2('0x4e')](handleError(_0x3814d7,null));};exports[_0xc7b2('0x60')]=function(_0x198569,_0x1cac2b,_0x46f898){var _0x27b2cf={};var _0x2ac09f={};var _0x380f13;var _0x236647;return db[_0xc7b2('0x34')]['findOne']({'where':{'id':_0x198569[_0xc7b2('0x59')]['id']}})[_0xc7b2('0x2c')](handleEntityNotFound(_0x1cac2b,null))[_0xc7b2('0x2c')](function(_0x23989f){if(_0x23989f){_0x380f13=_0x23989f;_0x2ac09f['model']=_[_0xc7b2('0x39')](db[_0xc7b2('0x61')]['rawAttributes']);_0x2ac09f['query']=_[_0xc7b2('0x39')](_0x198569[_0xc7b2('0x38')]);_0x2ac09f[_0xc7b2('0x3a')]=_[_0xc7b2('0x3b')](_0x2ac09f[_0xc7b2('0x37')],_0x2ac09f[_0xc7b2('0x38')]);_0x27b2cf[_0xc7b2('0x3c')]=_[_0xc7b2('0x3b')](_0x2ac09f[_0xc7b2('0x37')],qs[_0xc7b2('0x3d')](_0x198569[_0xc7b2('0x38')][_0xc7b2('0x3d')]));_0x27b2cf[_0xc7b2('0x3c')]=_0x27b2cf[_0xc7b2('0x3c')]['length']?_0x27b2cf['attributes']:_0x2ac09f[_0xc7b2('0x37')];_0x27b2cf[_0xc7b2('0x62')]=qs[_0xc7b2('0x41')](_0x198569[_0xc7b2('0x38')][_0xc7b2('0x41')]);_0x27b2cf['where']=qs[_0xc7b2('0x3a')](_['pick'](_0x198569[_0xc7b2('0x38')],_0x2ac09f['filters']));if(_0x198569[_0xc7b2('0x38')][_0xc7b2('0x44')]){_0x27b2cf[_0xc7b2('0x42')]=_[_0xc7b2('0x45')](_0x27b2cf['where'],{'$or':_[_0xc7b2('0x33')](_0x27b2cf['attributes'],function(_0x5b9f79){var _0x4234ba={};_0x4234ba[_0x5b9f79]={'$like':'%'+_0x198569['query'][_0xc7b2('0x44')]+'%'};return _0x4234ba;})});}_0x27b2cf=_['merge']({},_0x27b2cf,_0x198569[_0xc7b2('0x48')]);return _0x380f13[_0xc7b2('0x60')](_0x27b2cf);}})[_0xc7b2('0x2c')](function(_0x704f83){if(_0x704f83){_0x236647=_0x704f83[_0xc7b2('0x3e')];if(!_0x198569[_0xc7b2('0x38')][_0xc7b2('0x3f')](_0xc7b2('0x40'))){_0x27b2cf[_0xc7b2('0x24')]=qs[_0xc7b2('0x24')](_0x198569[_0xc7b2('0x38')][_0xc7b2('0x24')]);_0x27b2cf[_0xc7b2('0x23')]=qs[_0xc7b2('0x23')](_0x198569['query'][_0xc7b2('0x23')]);}return _0x380f13['getUsers'](_0x27b2cf);}})[_0xc7b2('0x2c')](function(_0x3b1686){if(_0x3b1686){return _0x3b1686?{'count':_0x236647,'rows':_0x3b1686}:null;}})[_0xc7b2('0x2c')](respondWithResult(_0x1cac2b,null))[_0xc7b2('0x4e')](handleError(_0x1cac2b,null));}; \ No newline at end of file +var _0x839a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','SquareProjects','destroy','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','User','getUsers','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_0x839a,0xb6));var _0xa839=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x839a[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xa839('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa839('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa839('0x2'));var moment=require(_0xa839('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa839('0x4'));var util=require(_0xa839('0x5'));var path=require(_0xa839('0x6'));var sox=require(_0xa839('0x7'));var csv=require(_0xa839('0x8'));var ejs=require(_0xa839('0x9'));var fs=require('fs');var fs_extra=require(_0xa839('0xa'));var _=require(_0xa839('0xb'));var squel=require(_0xa839('0xc'));var crypto=require(_0xa839('0xd'));var jsforce=require(_0xa839('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa839('0x8'));var querystring=require(_0xa839('0xf'));var Papa=require(_0xa839('0x10'));var Redis=require(_0xa839('0x11'));var authService=require(_0xa839('0x12'));var qs=require(_0xa839('0x13'));var as=require(_0xa839('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa839('0x15'))(_0xa839('0x16'));var utils=require(_0xa839('0x17'));var config=require(_0xa839('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa839('0x19'))['db'];config['redis']=_[_0xa839('0x1a')](config[_0xa839('0x1b')],{'host':_0xa839('0x1c'),'port':0x18eb});var socket=require(_0xa839('0x1d'))(new Redis(config['redis']));require(_0xa839('0x1e'))[_0xa839('0x1f')](socket);function respondWithStatusCode(_0x2ba471,_0x129936){_0x129936=_0x129936||0xcc;return function(_0x220828){if(_0x220828){return _0x2ba471[_0xa839('0x20')](_0x129936);}return _0x2ba471[_0xa839('0x21')](_0x129936)[_0xa839('0x22')]();};}function respondWithResult(_0x48df60,_0x17b313){_0x17b313=_0x17b313||0xc8;return function(_0x1affbb){if(_0x1affbb){return _0x48df60[_0xa839('0x21')](_0x17b313)[_0xa839('0x23')](_0x1affbb);}};}function respondWithFilteredResult(_0x1c69f7,_0x2be5ef){return function(_0x5cc483){if(_0x5cc483){var _0x3c9cab=typeof _0x2be5ef[_0xa839('0x24')]==='undefined'&&typeof _0x2be5ef[_0xa839('0x25')]==='undefined';var _0x3a0675=_0x5cc483['count'];var _0x242e7e=_0x3c9cab?0x0:_0x2be5ef[_0xa839('0x24')];var _0x1a1404=_0x3c9cab?_0x5cc483[_0xa839('0x26')]:_0x2be5ef[_0xa839('0x24')]+_0x2be5ef[_0xa839('0x25')];var _0x22fba8;if(_0x1a1404>=_0x3a0675){_0x1a1404=_0x3a0675;_0x22fba8=0xc8;}else{_0x22fba8=0xce;}_0x1c69f7[_0xa839('0x21')](_0x22fba8);return _0x1c69f7[_0xa839('0x27')]('Content-Range',_0x242e7e+'-'+_0x1a1404+'/'+_0x3a0675)[_0xa839('0x23')](_0x5cc483);}return null;};}function patchUpdates(_0x37f3b6){return function(_0x5d6fd9){try{jsonpatch[_0xa839('0x28')](_0x5d6fd9,_0x37f3b6,!![]);}catch(_0x37f49c){return BPromise[_0xa839('0x29')](_0x37f49c);}return _0x5d6fd9[_0xa839('0x2a')]();};}function saveUpdates(_0x401bbe,_0x43930a){return function(_0x5b3e9e){if(_0x5b3e9e){return _0x5b3e9e[_0xa839('0x2b')](_0x401bbe)[_0xa839('0x2c')](function(_0x155f4a){return _0x155f4a;});}return null;};}function removeEntity(_0x5e1a90,_0x9c0d3e){return function(_0x1276b6){if(_0x1276b6){return _0x1276b6['destroy']()[_0xa839('0x2c')](function(){var _0xc83411=_0x1276b6['get']({'plain':!![]});var _0x4fa2b5=_0xa839('0x2d');return db['UserProfileResource'][_0xa839('0x2e')]({'where':{'type':_0x4fa2b5,'resourceId':_0xc83411['id']}})[_0xa839('0x2c')](function(){return _0x1276b6;});})[_0xa839('0x2c')](function(){_0x5e1a90[_0xa839('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x433bbd,_0x583baf){return function(_0x1a5e44){if(!_0x1a5e44){_0x433bbd[_0xa839('0x20')](0x194);}return _0x1a5e44;};}function handleError(_0x16eefc,_0x354e69){_0x354e69=_0x354e69||0x1f4;return function(_0x3c1fd2){logger[_0xa839('0x2f')](_0x3c1fd2[_0xa839('0x30')]);if(_0x3c1fd2['name']){delete _0x3c1fd2[_0xa839('0x31')];}_0x16eefc[_0xa839('0x21')](_0x354e69)[_0xa839('0x32')](_0x3c1fd2);};}exports[_0xa839('0x33')]=function(_0x388eef,_0x1b1f74){var _0x404508={},_0xb33ee0={},_0x260a89={'count':0x0,'rows':[]};var _0x4f6421=_[_0xa839('0x34')](db[_0xa839('0x35')][_0xa839('0x36')],function(_0x3ba1b6){return{'name':_0x3ba1b6[_0xa839('0x37')],'type':_0x3ba1b6[_0xa839('0x38')]['key']};});_0xb33ee0['model']=_[_0xa839('0x34')](_0x4f6421,'name');_0xb33ee0[_0xa839('0x39')]=_[_0xa839('0x3a')](_0x388eef[_0xa839('0x39')]);_0xb33ee0['filters']=_[_0xa839('0x3b')](_0xb33ee0[_0xa839('0x3c')],_0xb33ee0[_0xa839('0x39')]);_0x404508['attributes']=_[_0xa839('0x3b')](_0xb33ee0[_0xa839('0x3c')],qs[_0xa839('0x3d')](_0x388eef[_0xa839('0x39')][_0xa839('0x3d')]));_0x404508[_0xa839('0x3e')]=_0x404508['attributes']['length']?_0x404508[_0xa839('0x3e')]:_0xb33ee0[_0xa839('0x3c')];if(!_0x388eef[_0xa839('0x39')][_0xa839('0x3f')](_0xa839('0x40'))){_0x404508[_0xa839('0x25')]=qs[_0xa839('0x25')](_0x388eef[_0xa839('0x39')][_0xa839('0x25')]);_0x404508['offset']=qs[_0xa839('0x24')](_0x388eef[_0xa839('0x39')][_0xa839('0x24')]);}_0x404508[_0xa839('0x41')]=qs[_0xa839('0x42')](_0x388eef['query'][_0xa839('0x42')]);_0x404508[_0xa839('0x43')]=qs[_0xa839('0x44')](_[_0xa839('0x45')](_0x388eef[_0xa839('0x39')],_0xb33ee0[_0xa839('0x44')]),_0x4f6421);if(_0x388eef[_0xa839('0x39')]['filter']){_0x404508['where']=_[_0xa839('0x46')](_0x404508['where'],{'$or':_[_0xa839('0x34')](_0x4f6421,function(_0x378a1a){if(_0x378a1a[_0xa839('0x38')]!==_0xa839('0x47')){var _0x2e62bd={};_0x2e62bd[_0x378a1a[_0xa839('0x31')]]={'$like':'%'+_0x388eef[_0xa839('0x39')][_0xa839('0x48')]+'%'};return _0x2e62bd;}})});}_0x404508=_[_0xa839('0x46')]({},_0x404508,_0x388eef[_0xa839('0x49')]);var _0x269b63={'where':_0x404508['where']};return db[_0xa839('0x35')][_0xa839('0x26')](_0x269b63)[_0xa839('0x2c')](function(_0x45cfd0){_0x260a89['count']=_0x45cfd0;if(_0x388eef[_0xa839('0x39')]['includeAll']){_0x404508[_0xa839('0x4a')]=[{'all':!![]}];}return db[_0xa839('0x35')]['findAll'](_0x404508);})[_0xa839('0x2c')](function(_0xea7a31){_0x260a89[_0xa839('0x4b')]=_0xea7a31;return _0x260a89;})[_0xa839('0x2c')](respondWithFilteredResult(_0x1b1f74,_0x404508))[_0xa839('0x4c')](handleError(_0x1b1f74,null));};exports[_0xa839('0x4d')]=function(_0x3f9738,_0x9175b0){var _0x55b575={'raw':![],'where':{'id':_0x3f9738['params']['id']}},_0x380520={};_0x380520[_0xa839('0x3c')]=_[_0xa839('0x3a')](db['SquareProject'][_0xa839('0x36')]);_0x380520[_0xa839('0x39')]=_[_0xa839('0x3a')](_0x3f9738[_0xa839('0x39')]);_0x380520[_0xa839('0x44')]=_['intersection'](_0x380520['model'],_0x380520[_0xa839('0x39')]);_0x55b575[_0xa839('0x3e')]=_[_0xa839('0x3b')](_0x380520[_0xa839('0x3c')],qs[_0xa839('0x3d')](_0x3f9738[_0xa839('0x39')][_0xa839('0x3d')]));_0x55b575['attributes']=_0x55b575[_0xa839('0x3e')][_0xa839('0x4e')]?_0x55b575[_0xa839('0x3e')]:_0x380520['model'];if(_0x3f9738[_0xa839('0x39')]['includeAll']){_0x55b575[_0xa839('0x4a')]=[{'all':!![]}];}_0x55b575=_[_0xa839('0x46')]({},_0x55b575,_0x3f9738['options']);return db[_0xa839('0x35')][_0xa839('0x4f')](_0x55b575)[_0xa839('0x2c')](handleEntityNotFound(_0x9175b0,null))[_0xa839('0x2c')](respondWithResult(_0x9175b0,null))['catch'](handleError(_0x9175b0,null));};exports[_0xa839('0x50')]=function(_0x3a470a,_0x30670d){return db[_0xa839('0x35')]['create'](_0x3a470a[_0xa839('0x51')],{})[_0xa839('0x2c')](function(_0x59d372){var _0x462b5a=_0x3a470a[_0xa839('0x52')][_0xa839('0x53')]({'plain':!![]});if(!_0x462b5a)throw new Error(_0xa839('0x54'));if(_0x462b5a[_0xa839('0x55')]==='user'){var _0xe13084=_0x59d372[_0xa839('0x53')]({'plain':!![]});var _0x2deb13=_0xa839('0x2d');return db[_0xa839('0x56')][_0xa839('0x4f')]({'where':{'name':_0x2deb13,'userProfileId':_0x462b5a[_0xa839('0x57')]},'raw':!![]})[_0xa839('0x2c')](function(_0x147504){if(_0x147504&&_0x147504[_0xa839('0x58')]===0x0){return db[_0xa839('0x59')][_0xa839('0x50')]({'name':_0xe13084[_0xa839('0x31')],'resourceId':_0xe13084['id'],'type':_0x147504[_0xa839('0x31')],'sectionId':_0x147504['id']},{})[_0xa839('0x2c')](function(){return _0x59d372;});}else{return _0x59d372;}})['catch'](function(_0x1c2098){logger[_0xa839('0x2f')](_0xa839('0x5a'),_0x1c2098);throw _0x1c2098;});}return _0x59d372;})[_0xa839('0x2c')](respondWithResult(_0x30670d,0xc9))[_0xa839('0x4c')](handleError(_0x30670d,null));};exports[_0xa839('0x2b')]=function(_0x3600bf,_0x433d4b){if(_0x3600bf[_0xa839('0x51')]['id']){delete _0x3600bf[_0xa839('0x51')]['id'];}return db['SquareProject'][_0xa839('0x4f')]({'where':{'id':_0x3600bf[_0xa839('0x5b')]['id']}})[_0xa839('0x2c')](handleEntityNotFound(_0x433d4b,null))[_0xa839('0x2c')](saveUpdates(_0x3600bf[_0xa839('0x51')],null))[_0xa839('0x2c')](respondWithResult(_0x433d4b,null))[_0xa839('0x4c')](handleError(_0x433d4b,null));};exports[_0xa839('0x2e')]=function(_0xb128fe,_0x31712e){return db[_0xa839('0x35')][_0xa839('0x4f')]({'where':{'id':_0xb128fe[_0xa839('0x5b')]['id']}})[_0xa839('0x2c')](handleEntityNotFound(_0x31712e,null))[_0xa839('0x2c')](removeEntity(_0x31712e,null))[_0xa839('0x4c')](handleError(_0x31712e,null));};exports['addUsers']=function(_0x364cf5,_0x5a6a0a,_0x29c03b){return db['SquareProject']['find']({'where':{'id':_0x364cf5[_0xa839('0x5b')]['id']}})[_0xa839('0x2c')](handleEntityNotFound(_0x5a6a0a,null))[_0xa839('0x2c')](function(_0x9968ff){if(_0x9968ff){return _0x9968ff[_0xa839('0x5c')](_0x364cf5[_0xa839('0x51')]['ids'],_['omit'](_0x364cf5[_0xa839('0x51')],[_0xa839('0x5d'),'id'])||{});}})[_0xa839('0x2c')](respondWithResult(_0x5a6a0a,null))[_0xa839('0x4c')](handleError(_0x5a6a0a,null));};exports['removeUsers']=function(_0x44162c,_0x47a508,_0x35095b){return db['SquareProject'][_0xa839('0x4f')]({'where':{'id':_0x44162c[_0xa839('0x5b')]['id']}})['then'](handleEntityNotFound(_0x47a508,null))[_0xa839('0x2c')](function(_0x35566f){if(_0x35566f){return _0x35566f[_0xa839('0x5e')](_0x44162c['query'][_0xa839('0x5d')])[_0xa839('0x2c')](function(){if(_[_0xa839('0x5f')](_0x44162c[_0xa839('0x39')][_0xa839('0x5d')])){for(var _0x1819a5=0x0;_0x1819a5<_0x44162c[_0xa839('0x39')][_0xa839('0x5d')][_0xa839('0x4e')];_0x1819a5+=0x1){socket[_0xa839('0x60')]('userSquareProject:remove',{'UserId':Number(_0x44162c[_0xa839('0x39')][_0xa839('0x5d')][_0x1819a5]),'SquareProjectId':Number(_0x44162c['params']['id'])});}}else{socket[_0xa839('0x60')](_0xa839('0x61'),{'UserId':Number(_0x44162c[_0xa839('0x39')]['ids']),'SquareProjectId':Number(_0x44162c[_0xa839('0x5b')]['id'])});}});}})[_0xa839('0x2c')](respondWithStatusCode(_0x47a508,null))['catch'](handleError(_0x47a508,null));};exports['getUsers']=function(_0x42368e,_0x1aadca,_0x4ba2f9){var _0x4baa87={};var _0x39bf36={};var _0x7965ff;var _0x2436ec;return db[_0xa839('0x35')]['findOne']({'where':{'id':_0x42368e[_0xa839('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1aadca,null))[_0xa839('0x2c')](function(_0x1c91b1){if(_0x1c91b1){_0x7965ff=_0x1c91b1;_0x39bf36[_0xa839('0x3c')]=_[_0xa839('0x3a')](db[_0xa839('0x62')][_0xa839('0x36')]);_0x39bf36[_0xa839('0x39')]=_[_0xa839('0x3a')](_0x42368e['query']);_0x39bf36[_0xa839('0x44')]=_[_0xa839('0x3b')](_0x39bf36[_0xa839('0x3c')],_0x39bf36['query']);_0x4baa87['attributes']=_[_0xa839('0x3b')](_0x39bf36[_0xa839('0x3c')],qs['fields'](_0x42368e[_0xa839('0x39')][_0xa839('0x3d')]));_0x4baa87[_0xa839('0x3e')]=_0x4baa87[_0xa839('0x3e')][_0xa839('0x4e')]?_0x4baa87['attributes']:_0x39bf36['model'];_0x4baa87['order']=qs[_0xa839('0x42')](_0x42368e['query'][_0xa839('0x42')]);_0x4baa87[_0xa839('0x43')]=qs[_0xa839('0x44')](_[_0xa839('0x45')](_0x42368e['query'],_0x39bf36['filters']));if(_0x42368e[_0xa839('0x39')][_0xa839('0x48')]){_0x4baa87[_0xa839('0x43')]=_[_0xa839('0x46')](_0x4baa87[_0xa839('0x43')],{'$or':_[_0xa839('0x34')](_0x4baa87[_0xa839('0x3e')],function(_0x2a004a){var _0x33c42c={};_0x33c42c[_0x2a004a]={'$like':'%'+_0x42368e[_0xa839('0x39')][_0xa839('0x48')]+'%'};return _0x33c42c;})});}_0x4baa87=_['merge']({},_0x4baa87,_0x42368e[_0xa839('0x49')]);return _0x7965ff[_0xa839('0x63')](_0x4baa87);}})[_0xa839('0x2c')](function(_0x399c2c){if(_0x399c2c){_0x2436ec=_0x399c2c[_0xa839('0x4e')];if(!_0x42368e[_0xa839('0x39')][_0xa839('0x3f')](_0xa839('0x40'))){_0x4baa87[_0xa839('0x25')]=qs[_0xa839('0x25')](_0x42368e[_0xa839('0x39')][_0xa839('0x25')]);_0x4baa87[_0xa839('0x24')]=qs[_0xa839('0x24')](_0x42368e[_0xa839('0x39')][_0xa839('0x24')]);}return _0x7965ff['getUsers'](_0x4baa87);}})[_0xa839('0x2c')](function(_0x326264){if(_0x326264){return _0x326264?{'count':_0x2436ec,'rows':_0x326264}:null;}})[_0xa839('0x2c')](respondWithResult(_0x1aadca,null))[_0xa839('0x4c')](handleError(_0x1aadca,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 99d016f..0e914b8 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 _0x7d04=['emit','hook','exports','events','SquareProject','save','update','remove'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x7d04,0x183));var _0x47d0=function(_0x4039e0,_0x57c83b){_0x4039e0=_0x4039e0-0x0;var _0x3d9d6c=_0x7d04[_0x4039e0];return _0x3d9d6c;};'use strict';var EventEmitter=require(_0x47d0('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x47d0('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47d0('0x2'),'afterUpdate':_0x47d0('0x3'),'afterDestroy':_0x47d0('0x4')};function emitEvent(_0x2be85b){return function(_0xf565f2,_0x589d3a,_0x91cfcb){SquareProjectEvents[_0x47d0('0x5')](_0x2be85b+':'+_0xf565f2['id'],_0xf565f2);SquareProjectEvents[_0x47d0('0x5')](_0x2be85b,_0xf565f2);_0x91cfcb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x47d0('0x6')](e,emitEvent(event));}}module[_0x47d0('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x8e01=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x8e01,0x7b));var _0x18e0=function(_0x20121a,_0x3661e6){_0x20121a=_0x20121a-0x0;var _0x2e4151=_0x8e01[_0x20121a];return _0x2e4151;};'use strict';var EventEmitter=require(_0x18e0('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x18e0('0x1')](0x0);var events={'afterCreate':_0x18e0('0x2'),'afterUpdate':_0x18e0('0x3'),'afterDestroy':_0x18e0('0x4')};function emitEvent(_0x23e2ef){return function(_0x9628f8,_0x31484f,_0x2fe2a0){SquareProjectEvents[_0x18e0('0x5')](_0x23e2ef+':'+_0x9628f8['id'],_0x9628f8);SquareProjectEvents['emit'](_0x23e2ef,_0x9628f8);_0x2fe2a0(null);};}for(var e in events){if(events[_0x18e0('0x6')](e)){var event=events[e];SquareProject[_0x18e0('0x7')](e,emitEvent(event));}}module[_0x18e0('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 00eee2a..0c9845b 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 _0xd11d=['savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','changed','preproduction'];(function(_0x41847f,_0x107820){var _0x3ba737=function(_0x5deb12){while(--_0x5deb12){_0x41847f['push'](_0x41847f['shift']());}};_0x3ba737(++_0x107820);}(_0xd11d,0xc0));var _0xdd11=function(_0x1b142d,_0x5f0e36){_0x1b142d=_0x1b142d-0x0;var _0x212026=_0xd11d[_0x1b142d];return _0x212026;};'use strict';var _=require('lodash');var util=require(_0xdd11('0x0'));var logger=require('../../config/logger')(_0xdd11('0x1'));var moment=require(_0xdd11('0x2'));var BPromise=require(_0xdd11('0x3'));var rp=require(_0xdd11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd11('0x5'));var config=require(_0xdd11('0x6'));var attributes=require(_0xdd11('0x7'));module['exports']=function(_0x51b7bb,_0x38257c){return _0x51b7bb[_0xdd11('0x8')](_0xdd11('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b4990,_0x57f7ff,_0x243ecc){if(_0x5b4990[_0xdd11('0xa')](_0xdd11('0xb'))){_0x5b4990[_0xdd11('0xc')]=moment()['format'](_0xdd11('0xd'));}if(_0x5b4990[_0xdd11('0xa')](_0xdd11('0xe'))){_0x5b4990[_0xdd11('0xf')]=moment()[_0xdd11('0x10')](_0xdd11('0xd'));}_0x243ecc(null,_0x5b4990);}}});}; \ No newline at end of file +var _0xa876=['../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','util','../../config/logger','api','moment','bluebird','path'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0xa876,0x13d));var _0x6a87=function(_0x4a7e21,_0x324ce0){_0x4a7e21=_0x4a7e21-0x0;var _0x2b19dc=_0xa876[_0x4a7e21];return _0x2b19dc;};'use strict';var _=require('lodash');var util=require(_0x6a87('0x0'));var logger=require(_0x6a87('0x1'))(_0x6a87('0x2'));var moment=require(_0x6a87('0x3'));var BPromise=require(_0x6a87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a87('0x5'));var rimraf=require('rimraf');var config=require(_0x6a87('0x6'));var attributes=require(_0x6a87('0x7'));module[_0x6a87('0x8')]=function(_0x39bdfb,_0x5b9418){return _0x39bdfb['define'](_0x6a87('0x9'),attributes,{'tableName':_0x6a87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ece05,_0x226fdb,_0x9b49e5){if(_0x4ece05[_0x6a87('0xb')](_0x6a87('0xc'))){_0x4ece05[_0x6a87('0xd')]=moment()[_0x6a87('0xe')](_0x6a87('0xf'));}if(_0x4ece05['changed'](_0x6a87('0x10'))){_0x4ece05['publishedAt']=moment()[_0x6a87('0xe')](_0x6a87('0xf'));}_0x9b49e5(null,_0x4ece05);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f882135..e74e8b6 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 _0xfd0b=['catch','ShowSquareProject','find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareProject,\x20%s,\x20%s','result'];(function(_0x235fcc,_0x3c9b5c){var _0x3a0f9c=function(_0x4eea4c){while(--_0x4eea4c){_0x235fcc['push'](_0x235fcc['shift']());}};_0x3a0f9c(++_0x3c9b5c);}(_0xfd0b,0xcd));var _0xbfd0=function(_0x2382ed,_0x206e38){_0x2382ed=_0x2382ed-0x0;var _0x3d0ac1=_0xfd0b[_0x2382ed];return _0x3d0ac1;};'use strict';var _=require(_0xbfd0('0x0'));var util=require(_0xbfd0('0x1'));var moment=require(_0xbfd0('0x2'));var BPromise=require(_0xbfd0('0x3'));var rs=require(_0xbfd0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfd0('0x5'))['db'];var utils=require(_0xbfd0('0x6'));var logger=require(_0xbfd0('0x7'))('rpc');var config=require(_0xbfd0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbfd0('0x9')][_0xbfd0('0xa')]({'port':0x232a});config[_0xbfd0('0xb')]=_[_0xbfd0('0xc')](config['redis'],{'host':_0xbfd0('0xd'),'port':0x18eb});var socket=require(_0xbfd0('0xe'))(new Redis(config['redis']));require(_0xbfd0('0xf'))[_0xbfd0('0x10')](socket);function respondWithRpcPromise(_0x362bde,_0x36b414,_0x3b8fe8){return new BPromise(function(_0x5f51fd,_0x3f8357){return client[_0xbfd0('0x11')](_0x362bde,_0x3b8fe8)[_0xbfd0('0x12')](function(_0x3eae6d){logger[_0xbfd0('0x13')]('SquareProject,\x20%s,\x20%s',_0x36b414,_0xbfd0('0x14'));logger[_0xbfd0('0x15')](_0xbfd0('0x16'),_0x36b414,_0xbfd0('0x14'),JSON[_0xbfd0('0x17')](_0x3eae6d));if(_0x3eae6d[_0xbfd0('0x18')]){if(_0x3eae6d['error'][_0xbfd0('0x19')]===0x1f4){logger[_0xbfd0('0x18')]('SquareProject,\x20%s,\x20%s',_0x36b414,_0x3eae6d['error'][_0xbfd0('0x1a')]);return _0x3f8357(_0x3eae6d['error'][_0xbfd0('0x1a')]);}logger[_0xbfd0('0x18')](_0xbfd0('0x1b'),_0x36b414,_0x3eae6d[_0xbfd0('0x18')][_0xbfd0('0x1a')]);return _0x5f51fd(_0x3eae6d[_0xbfd0('0x18')][_0xbfd0('0x1a')]);}else{logger[_0xbfd0('0x13')](_0xbfd0('0x1b'),_0x36b414,_0xbfd0('0x14'));_0x5f51fd(_0x3eae6d[_0xbfd0('0x1c')]['message']);}})[_0xbfd0('0x1d')](function(_0x2cb2ee){logger[_0xbfd0('0x18')](_0xbfd0('0x1b'),_0x36b414,_0x2cb2ee);_0x3f8357(_0x2cb2ee);});});}exports[_0xbfd0('0x1e')]=function(_0x223b6b){var _0x2416e1=this;return new Promise(function(_0x71766f,_0x5894ed){return db['SquareProject'][_0xbfd0('0x1f')]({'raw':_0x223b6b['options']?_0x223b6b[_0xbfd0('0x20')][_0xbfd0('0x21')]===undefined?!![]:![]:!![],'where':_0x223b6b[_0xbfd0('0x20')]?_0x223b6b[_0xbfd0('0x20')][_0xbfd0('0x22')]||null:null,'attributes':_0x223b6b[_0xbfd0('0x20')]?_0x223b6b[_0xbfd0('0x20')][_0xbfd0('0x23')]||null:null,'include':_0x223b6b[_0xbfd0('0x20')]?_0x223b6b[_0xbfd0('0x20')]['include']?_[_0xbfd0('0x24')](_0x223b6b[_0xbfd0('0x20')][_0xbfd0('0x25')],function(_0x58bf72){return{'model':db[_0x58bf72[_0xbfd0('0x26')]],'as':_0x58bf72['as'],'attributes':_0x58bf72[_0xbfd0('0x23')],'include':_0x58bf72['include']?_[_0xbfd0('0x24')](_0x58bf72[_0xbfd0('0x25')],function(_0x6f0d94){return{'model':db[_0x6f0d94[_0xbfd0('0x26')]],'as':_0x6f0d94['as'],'attributes':_0x6f0d94[_0xbfd0('0x23')],'include':_0x6f0d94[_0xbfd0('0x25')]?_[_0xbfd0('0x24')](_0x6f0d94[_0xbfd0('0x25')],function(_0x142fbb){return{'model':db[_0x142fbb[_0xbfd0('0x26')]],'as':_0x142fbb['as'],'attributes':_0x142fbb[_0xbfd0('0x23')]};}):[]};}):[]};}):[]:[]})[_0xbfd0('0x12')](function(_0x114f43){logger['info'](_0xbfd0('0x1e'),_0x223b6b);logger['debug'](_0xbfd0('0x1e'),_0x223b6b,JSON[_0xbfd0('0x17')](_0x114f43));_0x71766f(_0x114f43);})[_0xbfd0('0x1d')](function(_0x521d69){logger['error'](_0xbfd0('0x1e'),_0x521d69[_0xbfd0('0x1a')],_0x223b6b);_0x5894ed(_0x2416e1[_0xbfd0('0x18')](0x1f4,_0x521d69['message']));});});}; \ No newline at end of file +var _0xa09a=['./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSquareProject','SquareProject','options','where','map','include','model','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x223726,_0x88bf53){var _0x42038e=function(_0x29ef16){while(--_0x29ef16){_0x223726['push'](_0x223726['shift']());}};_0x42038e(++_0x88bf53);}(_0xa09a,0xe6));var _0xaa09=function(_0x1a36d0,_0x11f4bd){_0x1a36d0=_0x1a36d0-0x0;var _0x36845e=_0xa09a[_0x1a36d0];return _0x36845e;};'use strict';var _=require(_0xaa09('0x0'));var util=require(_0xaa09('0x1'));var moment=require(_0xaa09('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa09('0x3'));var fs=require('fs');var Redis=require(_0xaa09('0x4'));var db=require(_0xaa09('0x5'))['db'];var utils=require(_0xaa09('0x6'));var logger=require(_0xaa09('0x7'))('rpc');var config=require(_0xaa09('0x8'));var jayson=require(_0xaa09('0x9'));var client=jayson[_0xaa09('0xa')][_0xaa09('0xb')]({'port':0x232a});config[_0xaa09('0xc')]=_['defaults'](config[_0xaa09('0xc')],{'host':_0xaa09('0xd'),'port':0x18eb});var socket=require(_0xaa09('0xe'))(new Redis(config[_0xaa09('0xc')]));require(_0xaa09('0xf'))[_0xaa09('0x10')](socket);function respondWithRpcPromise(_0x412cc9,_0x15b8d3,_0x534a4a){return new BPromise(function(_0x1ef53d,_0x858fec){return client[_0xaa09('0x11')](_0x412cc9,_0x534a4a)['then'](function(_0x57b18d){logger[_0xaa09('0x12')](_0xaa09('0x13'),_0x15b8d3,_0xaa09('0x14'));logger[_0xaa09('0x15')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x15b8d3,_0xaa09('0x14'),JSON[_0xaa09('0x16')](_0x57b18d));if(_0x57b18d[_0xaa09('0x17')]){if(_0x57b18d['error'][_0xaa09('0x18')]===0x1f4){logger[_0xaa09('0x17')](_0xaa09('0x13'),_0x15b8d3,_0x57b18d[_0xaa09('0x17')]['message']);return _0x858fec(_0x57b18d[_0xaa09('0x17')]['message']);}logger['error'](_0xaa09('0x13'),_0x15b8d3,_0x57b18d[_0xaa09('0x17')][_0xaa09('0x19')]);return _0x1ef53d(_0x57b18d['error'][_0xaa09('0x19')]);}else{logger[_0xaa09('0x12')]('SquareProject,\x20%s,\x20%s',_0x15b8d3,_0xaa09('0x14'));_0x1ef53d(_0x57b18d[_0xaa09('0x1a')]['message']);}})['catch'](function(_0x173d65){logger[_0xaa09('0x17')]('SquareProject,\x20%s,\x20%s',_0x15b8d3,_0x173d65);_0x858fec(_0x173d65);});});}exports[_0xaa09('0x1b')]=function(_0x22f3ef){var _0x1d9e2c=this;return new Promise(function(_0x3b3f31,_0x4ab186){return db[_0xaa09('0x1c')]['find']({'raw':_0x22f3ef[_0xaa09('0x1d')]?_0x22f3ef[_0xaa09('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x22f3ef['options']?_0x22f3ef[_0xaa09('0x1d')][_0xaa09('0x1e')]||null:null,'attributes':_0x22f3ef[_0xaa09('0x1d')]?_0x22f3ef[_0xaa09('0x1d')]['attributes']||null:null,'include':_0x22f3ef[_0xaa09('0x1d')]?_0x22f3ef['options']['include']?_[_0xaa09('0x1f')](_0x22f3ef[_0xaa09('0x1d')][_0xaa09('0x20')],function(_0x4fd835){return{'model':db[_0x4fd835['model']],'as':_0x4fd835['as'],'attributes':_0x4fd835['attributes'],'include':_0x4fd835[_0xaa09('0x20')]?_[_0xaa09('0x1f')](_0x4fd835[_0xaa09('0x20')],function(_0x3e237f){return{'model':db[_0x3e237f[_0xaa09('0x21')]],'as':_0x3e237f['as'],'attributes':_0x3e237f['attributes'],'include':_0x3e237f[_0xaa09('0x20')]?_[_0xaa09('0x1f')](_0x3e237f[_0xaa09('0x20')],function(_0xed1f12){return{'model':db[_0xed1f12[_0xaa09('0x21')]],'as':_0xed1f12['as'],'attributes':_0xed1f12[_0xaa09('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x264a5a){logger['info'](_0xaa09('0x1b'),_0x22f3ef);logger[_0xaa09('0x15')](_0xaa09('0x1b'),_0x22f3ef,JSON['stringify'](_0x264a5a));_0x3b3f31(_0x264a5a);})['catch'](function(_0x5724c6){logger['error'](_0xaa09('0x1b'),_0x5724c6['message'],_0x22f3ef);_0x4ab186(_0x1d9e2c[_0xaa09('0x17')](0x1f4,_0x5724c6[_0xaa09('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 997849f..c234311 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 _0x2054=['save','remove','update','emit','removeListener','squareProject:','./squareProject.events'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0x2054,0x1db));var _0x4205=function(_0x4b2dde,_0x16ab26){_0x4b2dde=_0x4b2dde-0x0;var _0x18080a=_0x2054[_0x4b2dde];return _0x18080a;};'use strict';var SquareProjectEvents=require(_0x4205('0x0'));var events=[_0x4205('0x1'),_0x4205('0x2'),_0x4205('0x3')];function createListener(_0x492fc5,_0x2a0139){return function(_0xdb012a){_0x2a0139[_0x4205('0x4')](_0x492fc5,_0xdb012a);};}function removeListener(_0x649edd,_0x5e00d9){return function(){SquareProjectEvents[_0x4205('0x5')](_0x649edd,_0x5e00d9);};}exports['register']=function(_0x2dac9d){for(var _0xc966e=0x0,_0x5cb228=events['length'];_0xc966e<_0x5cb228;_0xc966e++){var _0x2a1394=events[_0xc966e];var _0xd82123=createListener(_0x4205('0x6')+_0x2a1394,_0x2dac9d);SquareProjectEvents['on'](_0x2a1394,_0xd82123);}}; \ No newline at end of file +var _0x5caf=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4e76d5,_0x27792b){var _0x4a12aa=function(_0x575654){while(--_0x575654){_0x4e76d5['push'](_0x4e76d5['shift']());}};_0x4a12aa(++_0x27792b);}(_0x5caf,0xc7));var _0xf5ca=function(_0x1b72f8,_0x2cba5b){_0x1b72f8=_0x1b72f8-0x0;var _0x40685a=_0x5caf[_0x1b72f8];return _0x40685a;};'use strict';var SquareProjectEvents=require(_0xf5ca('0x0'));var events=[_0xf5ca('0x1'),_0xf5ca('0x2'),_0xf5ca('0x3')];function createListener(_0x278f1f,_0x4095f2){return function(_0x2fce78){_0x4095f2[_0xf5ca('0x4')](_0x278f1f,_0x2fce78);};}function removeListener(_0x4e7bf9,_0x175a64){return function(){SquareProjectEvents[_0xf5ca('0x5')](_0x4e7bf9,_0x175a64);};}exports[_0xf5ca('0x6')]=function(_0x2a7fc3){for(var _0x7b9448=0x0,_0x4a4710=events[_0xf5ca('0x7')];_0x7b9448<_0x4a4710;_0x7b9448++){var _0x6cccbe=events[_0x7b9448];var _0x2f0a95=createListener(_0xf5ca('0x8')+_0x6cccbe,_0x2a7fc3);SquareProjectEvents['on'](_0x6cccbe,_0x2f0a95);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9c2d1a7..f329c6e 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x2d286c,_0x3dca21){var _0x2688a2=function(_0x517107){while(--_0x517107){_0x2d286c['push'](_0x2d286c['shift']());}};_0x2688a2(++_0x3dca21);}(_0x1261,0x144));var _0x1126=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0x1261[_0x1c73ee];return _0x154f05;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x225194,_0x1ffe79){var _0x309bb0=function(_0x4bcba2){while(--_0x4bcba2){_0x225194['push'](_0x225194['shift']());}};_0x309bb0(++_0x1ffe79);}(_0x1cb9,0x14e));var _0x91cb=function(_0x54ddc6,_0x3207da){_0x54ddc6=_0x54ddc6-0x0;var _0x34f387=_0x1cb9[_0x54ddc6];return _0x34f387;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9cdaf9e..820b638 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 _0x33c5=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','exports'];(function(_0x33250f,_0x34b7bf){var _0x1f910c=function(_0x187ed0){while(--_0x187ed0){_0x33250f['push'](_0x33250f['shift']());}};_0x1f910c(++_0x34b7bf);}(_0x33c5,0xe6));var _0x533c=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x33c5[_0x16ea87];return _0x6e7b1c;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'uniqueid':{'type':Sequelize[_0x533c('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x533c('0x1')]},'context':{'type':Sequelize[_0x533c('0x1')]},'extension':{'type':Sequelize[_0x533c('0x1')]},'priority':{'type':Sequelize[_0x533c('0x1')]},'accountcode':{'type':Sequelize[_0x533c('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x533c('0x1')]},'saveName':{'type':Sequelize[_0x533c('0x1')]},'filename':{'type':Sequelize[_0x533c('0x1')]},'savePath':{'type':Sequelize[_0x533c('0x1')]},'format':{'type':Sequelize[_0x533c('0x2')],'get':function(){var _0x1699d5='';var _0x3a009b=this[_0x533c('0x3')](_0x533c('0x4'));if(_0x3a009b){_0x1699d5=_0x3a009b[_0x533c('0x5')](_0x3a009b[_0x533c('0x6')]('.'));}return _0x1699d5;}}}; \ No newline at end of file +var _0xb138=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x19a357,_0x5ca8b9){var _0x50b8af=function(_0x51d383){while(--_0x51d383){_0x19a357['push'](_0x19a357['shift']());}};_0x50b8af(++_0x5ca8b9);}(_0xb138,0x1dd));var _0x8b13=function(_0x5a1b44,_0x4aea7b){_0x5a1b44=_0x5a1b44-0x0;var _0x9448c6=_0xb138[_0x5a1b44];return _0x9448c6;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'callerid':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'extension':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'dnid':{'type':Sequelize[_0x8b13('0x2')]},'projectName':{'type':Sequelize[_0x8b13('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8b13('0x2')]},'savePath':{'type':Sequelize[_0x8b13('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3fdf4d='';var _0x33d1a7=this[_0x8b13('0x3')]('savePath');if(_0x33d1a7){_0x3fdf4d=_0x33d1a7[_0x8b13('0x4')](_0x33d1a7[_0x8b13('0x5')]('.'));}return _0x3fdf4d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 494bc8f..a77db59 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 _0xd95e=['uniqueid','savePath','filename','format','%s.cypher','existsSync','recording','Sequelize','SquareRecording\x20not\x20found','unlink','message','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','error','stack','send','index','map','SquareRecording','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','name','then','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','download','../../components/encryptor'];(function(_0x4b6420,_0x126201){var _0x37076f=function(_0x3ee471){while(--_0x3ee471){_0x4b6420['push'](_0x4b6420['shift']());}};_0x37076f(++_0x126201);}(_0xd95e,0x18e));var _0xed95=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd95e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xed95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed95('0x1'));var jsonpatch=require(_0xed95('0x2'));var rp=require(_0xed95('0x3'));var moment=require(_0xed95('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xed95('0x5'));var sox=require(_0xed95('0x6'));var csv=require(_0xed95('0x7'));var ejs=require(_0xed95('0x8'));var fs=require('fs');var fs_extra=require(_0xed95('0x9'));var _=require(_0xed95('0xa'));var squel=require('squel');var crypto=require(_0xed95('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xed95('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed95('0xd'));var Papa=require(_0xed95('0xe'));var Redis=require(_0xed95('0xf'));var authService=require(_0xed95('0x10'));var qs=require(_0xed95('0x11'));var as=require(_0xed95('0x12'));var hardwareService=require(_0xed95('0x13'));var logger=require(_0xed95('0x14'))(_0xed95('0x15'));var utils=require(_0xed95('0x16'));var config=require(_0xed95('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1169ae,_0x235ecd){_0x235ecd=_0x235ecd||0xcc;return function(_0x2bcb0a){if(_0x2bcb0a){return _0x1169ae['sendStatus'](_0x235ecd);}return _0x1169ae['status'](_0x235ecd)[_0xed95('0x18')]();};}function respondWithResult(_0x129882,_0x1aa65b){_0x1aa65b=_0x1aa65b||0xc8;return function(_0x39108a){if(_0x39108a){return _0x129882[_0xed95('0x19')](_0x1aa65b)['json'](_0x39108a);}};}function respondWithFilteredResult(_0x2c53a1,_0x1784fc){return function(_0x2be73f){if(_0x2be73f){var _0x56f17f=typeof _0x1784fc[_0xed95('0x1a')]===_0xed95('0x1b')&&typeof _0x1784fc['limit']===_0xed95('0x1b');var _0x3549b7=_0x2be73f[_0xed95('0x1c')];var _0x50e5a8=_0x56f17f?0x0:_0x1784fc[_0xed95('0x1a')];var _0x4c6541=_0x56f17f?_0x2be73f[_0xed95('0x1c')]:_0x1784fc[_0xed95('0x1a')]+_0x1784fc['limit'];var _0x1756fe;if(_0x4c6541>=_0x3549b7){_0x4c6541=_0x3549b7;_0x1756fe=0xc8;}else{_0x1756fe=0xce;}_0x2c53a1[_0xed95('0x19')](_0x1756fe);return _0x2c53a1[_0xed95('0x1d')](_0xed95('0x1e'),_0x50e5a8+'-'+_0x4c6541+'/'+_0x3549b7)[_0xed95('0x1f')](_0x2be73f);}return null;};}function patchUpdates(_0x1e953e){return function(_0x4b8123){try{jsonpatch[_0xed95('0x20')](_0x4b8123,_0x1e953e,!![]);}catch(_0xb9dc98){return BPromise[_0xed95('0x21')](_0xb9dc98);}return _0x4b8123[_0xed95('0x22')]();};}function saveUpdates(_0x20b391,_0x2de9a1){return function(_0x453064){if(_0x453064){return _0x453064[_0xed95('0x23')](_0x20b391)['then'](function(_0x387be5){return _0x387be5;});}return null;};}function removeEntity(_0xc9016c,_0x5cd40b){return function(_0x21d473){if(_0x21d473){return _0x21d473[_0xed95('0x24')]()['then'](function(){_0xc9016c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x73d835,_0x36d5cf){return function(_0x3068a3){if(!_0x3068a3){_0x73d835[_0xed95('0x25')](0x194);}return _0x3068a3;};}function handleError(_0x1e7741,_0x283780){_0x283780=_0x283780||0x1f4;return function(_0x2cde83){logger[_0xed95('0x26')](_0x2cde83[_0xed95('0x27')]);if(_0x2cde83['name']){delete _0x2cde83['name'];}_0x1e7741[_0xed95('0x19')](_0x283780)[_0xed95('0x28')](_0x2cde83);};}exports[_0xed95('0x29')]=function(_0x8649ab,_0x3ef6a3){var _0x43025d={},_0x572038={},_0x4f6051={'count':0x0,'rows':[]};var _0x375208=_[_0xed95('0x2a')](db[_0xed95('0x2b')]['rawAttributes'],function(_0x5f421d){return{'name':_0x5f421d[_0xed95('0x2c')],'type':_0x5f421d['type'][_0xed95('0x2d')]};});_0x572038[_0xed95('0x2e')]=_[_0xed95('0x2a')](_0x375208,'name');_0x572038[_0xed95('0x2f')]=_[_0xed95('0x30')](_0x8649ab[_0xed95('0x2f')]);_0x572038[_0xed95('0x31')]=_[_0xed95('0x32')](_0x572038[_0xed95('0x2e')],_0x572038[_0xed95('0x2f')]);_0x43025d[_0xed95('0x33')]=_['intersection'](_0x572038['model'],qs[_0xed95('0x34')](_0x8649ab[_0xed95('0x2f')][_0xed95('0x34')]));_0x43025d[_0xed95('0x33')]=_0x43025d[_0xed95('0x33')]['length']?_0x43025d[_0xed95('0x33')]:_0x572038[_0xed95('0x2e')];if(!_0x8649ab[_0xed95('0x2f')][_0xed95('0x35')](_0xed95('0x36'))){_0x43025d[_0xed95('0x37')]=qs[_0xed95('0x37')](_0x8649ab[_0xed95('0x2f')]['limit']);_0x43025d[_0xed95('0x1a')]=qs[_0xed95('0x1a')](_0x8649ab['query'][_0xed95('0x1a')]);}_0x43025d[_0xed95('0x38')]=qs[_0xed95('0x39')](_0x8649ab[_0xed95('0x2f')][_0xed95('0x39')]);_0x43025d[_0xed95('0x3a')]=qs[_0xed95('0x31')](_[_0xed95('0x3b')](_0x8649ab[_0xed95('0x2f')],_0x572038[_0xed95('0x31')]),_0x375208);if(_0x8649ab[_0xed95('0x2f')][_0xed95('0x3c')]){_0x43025d[_0xed95('0x3a')]=_[_0xed95('0x3d')](_0x43025d[_0xed95('0x3a')],{'$or':_[_0xed95('0x2a')](_0x375208,function(_0x3b53ae){if(_0x3b53ae[_0xed95('0x3e')]!=='VIRTUAL'){var _0x2abd3d={};_0x2abd3d[_0x3b53ae[_0xed95('0x3f')]]={'$like':'%'+_0x8649ab['query'][_0xed95('0x3c')]+'%'};return _0x2abd3d;}})});}_0x43025d=_[_0xed95('0x3d')]({},_0x43025d,_0x8649ab['options']);var _0x344dd3={'where':_0x43025d[_0xed95('0x3a')]};return db[_0xed95('0x2b')][_0xed95('0x1c')](_0x344dd3)[_0xed95('0x40')](function(_0x1e3bda){_0x4f6051['count']=_0x1e3bda;if(_0x8649ab[_0xed95('0x2f')]['includeAll']){_0x43025d['include']=[{'all':!![]}];}return db[_0xed95('0x2b')][_0xed95('0x41')](_0x43025d);})[_0xed95('0x40')](function(_0x1a075c){_0x4f6051[_0xed95('0x42')]=_0x1a075c;return _0x4f6051;})[_0xed95('0x40')](respondWithFilteredResult(_0x3ef6a3,_0x43025d))[_0xed95('0x43')](handleError(_0x3ef6a3,null));};exports[_0xed95('0x44')]=function(_0x2ee187,_0x507849){var _0xe8278a={'raw':!![],'where':{'id':_0x2ee187[_0xed95('0x45')]['id']}},_0x573cc5={};_0x573cc5['model']=_[_0xed95('0x30')](db[_0xed95('0x2b')][_0xed95('0x46')]);_0x573cc5[_0xed95('0x2f')]=_[_0xed95('0x30')](_0x2ee187[_0xed95('0x2f')]);_0x573cc5[_0xed95('0x31')]=_[_0xed95('0x32')](_0x573cc5[_0xed95('0x2e')],_0x573cc5[_0xed95('0x2f')]);_0xe8278a[_0xed95('0x33')]=_[_0xed95('0x32')](_0x573cc5[_0xed95('0x2e')],qs[_0xed95('0x34')](_0x2ee187['query'][_0xed95('0x34')]));_0xe8278a[_0xed95('0x33')]=_0xe8278a[_0xed95('0x33')]['length']?_0xe8278a[_0xed95('0x33')]:_0x573cc5['model'];if(_0x2ee187[_0xed95('0x2f')][_0xed95('0x47')]){_0xe8278a['include']=[{'all':!![]}];}_0xe8278a=_[_0xed95('0x3d')]({},_0xe8278a,_0x2ee187['options']);return db['SquareRecording'][_0xed95('0x48')](_0xe8278a)['then'](handleEntityNotFound(_0x507849,null))[_0xed95('0x40')](respondWithResult(_0x507849,null))[_0xed95('0x43')](handleError(_0x507849,null));};exports[_0xed95('0x49')]=function(_0x2f0b04,_0x1b9efd){return db[_0xed95('0x2b')][_0xed95('0x49')](_0x2f0b04['body'],{})[_0xed95('0x40')](respondWithResult(_0x1b9efd,0xc9))['catch'](handleError(_0x1b9efd,null));};exports[_0xed95('0x23')]=function(_0x4f2658,_0x5e7d02){if(_0x4f2658['body']['id']){delete _0x4f2658[_0xed95('0x4a')]['id'];}return db[_0xed95('0x2b')][_0xed95('0x48')]({'where':{'id':_0x4f2658[_0xed95('0x45')]['id']}})[_0xed95('0x40')](handleEntityNotFound(_0x5e7d02,null))[_0xed95('0x40')](saveUpdates(_0x4f2658['body'],null))['then'](respondWithResult(_0x5e7d02,null))[_0xed95('0x43')](handleError(_0x5e7d02,null));};exports[_0xed95('0x4b')]=function(_0x4b3f05,_0x11273c,_0x549f02){var _0x1dd296=require(_0xed95('0x4c'));var _0xc1741d=![];var _0x464b63={};if(_0x4b3f05[_0xed95('0x2f')][_0xed95('0x3e')]&&_0x4b3f05[_0xed95('0x2f')]['type']===_0xed95('0x4d')){_0x464b63[_0xed95('0x4d')]=_0x4b3f05['params']['id'];}else{_0x464b63['id']=_0x4b3f05['params']['id'];}return db[_0xed95('0x2b')][_0xed95('0x48')]({'where':_0x464b63,'attributes':['id',_0xed95('0x4e'),_0xed95('0x4f')],'raw':!![]})[_0xed95('0x40')](handleEntityNotFound(_0x11273c,null))[_0xed95('0x40')](function(_0x907f24){if(_0x907f24){var _0x22d95e=_0x907f24[_0xed95('0x4e')];var _0x14fc15=util[_0xed95('0x50')](_0xed95('0x51'),_0x22d95e);if(fs[_0xed95('0x52')](_0x14fc15)){_0xc1741d=!![];return _0x1dd296['decryptFile'](_0x14fc15,_0x22d95e,config['secrets'][_0xed95('0x53')])['then'](function(){return _0x907f24;});}return _0x907f24;}})[_0xed95('0x40')](function(_0x4c8053){if(_0x4c8053){var _0x1ff914=_0x4c8053[_0xed95('0x4e')];if(!fs[_0xed95('0x52')](_0x1ff914)){throw new db[(_0xed95('0x54'))]['ValidationError'](_0xed95('0x55'));}if(_0x4c8053[_0xed95('0x4f')]){return _0x11273c[_0xed95('0x4b')](_0x1ff914,_0x4c8053[_0xed95('0x4f')]+path['extname'](_0x1ff914),function(){if(_0xc1741d){fs[_0xed95('0x56')](_0x1ff914);}});}else{return _0x11273c[_0xed95('0x4b')](_0x1ff914,function(_0x12f963){if(_0xc1741d){fs[_0xed95('0x56')](_0x1ff914);}});}}})[_0xed95('0x43')](function(_0x1d927c){if(_0x1d927c[_0xed95('0x57')]===_0xed95('0x55')){_0x11273c[_0xed95('0x19')](0x194)[_0xed95('0x28')]('Not\x20found');}else{return handleError(_0x11273c,null);}});};exports['destroy']=function(_0xfac133,_0x5a6bea){return db[_0xed95('0x2b')][_0xed95('0x48')]({'where':{'id':_0xfac133[_0xed95('0x45')]['id']}})[_0xed95('0x40')](function(_0x108c8a){if(_[_0xed95('0x58')](_0x108c8a)){throw new ReferenceError(_0xed95('0x59'));}return _0x108c8a;})[_0xed95('0x40')](function(_0x3a92cf){var _0x1e60b2=_0x3a92cf[_0xed95('0x4e')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1e60b2);if(!_[_0xed95('0x58')](_0x3a92cf[_0xed95('0x4e')])&&fs['existsSync'](_0x1e60b2)){logger[_0xed95('0x5a')](_0xed95('0x5b')+_0x1e60b2+_0xed95('0x5c'));fs[_0xed95('0x5d')](_0x1e60b2);}_0x1e60b2=_0x1e60b2+_0xed95('0x5e');if(!_[_0xed95('0x58')](_0x3a92cf[_0xed95('0x4e')])&&fs[_0xed95('0x52')](_0x1e60b2)){logger[_0xed95('0x5a')]('File:\x20\x22'+_0x1e60b2+_0xed95('0x5c'));fs[_0xed95('0x5d')](_0x1e60b2);}return _0x3a92cf;})[_0xed95('0x40')](function(_0x1667a6){if(!_0x1667a6)throw new InternalError();return _0x1667a6[_0xed95('0x24')]();})['then'](function(){_0x5a6bea[_0xed95('0x19')](0xcc)[_0xed95('0x18')]();})[_0xed95('0x43')](handleError(_0x5a6bea,null));}; \ No newline at end of file +var _0x1eec=['create','body','download','../../components/encryptor','uniqueid','savePath','format','existsSync','decryptFile','secrets','recording','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0x1eec,0x1a5));var _0xc1ee=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x1eec[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0xc1ee('0x0'));var rimraf=require(_0xc1ee('0x1'));var zipdir=require(_0xc1ee('0x2'));var jsonpatch=require(_0xc1ee('0x3'));var rp=require('request-promise');var moment=require(_0xc1ee('0x4'));var BPromise=require(_0xc1ee('0x5'));var Mustache=require(_0xc1ee('0x6'));var util=require(_0xc1ee('0x7'));var path=require(_0xc1ee('0x8'));var sox=require(_0xc1ee('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1ee('0xa'));var _=require('lodash');var squel=require(_0xc1ee('0xb'));var crypto=require(_0xc1ee('0xc'));var jsforce=require(_0xc1ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc1ee('0xe'));var querystring=require(_0xc1ee('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc1ee('0x10'));var qs=require(_0xc1ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1ee('0x12'));var logger=require(_0xc1ee('0x13'))(_0xc1ee('0x14'));var utils=require(_0xc1ee('0x15'));var config=require(_0xc1ee('0x16'));var licenseUtil=require(_0xc1ee('0x17'));var db=require(_0xc1ee('0x18'))['db'];function respondWithStatusCode(_0x24c4bd,_0x4d7e3d){_0x4d7e3d=_0x4d7e3d||0xcc;return function(_0x2c2f6d){if(_0x2c2f6d){return _0x24c4bd[_0xc1ee('0x19')](_0x4d7e3d);}return _0x24c4bd[_0xc1ee('0x1a')](_0x4d7e3d)[_0xc1ee('0x1b')]();};}function respondWithResult(_0x40674d,_0x3a6704){_0x3a6704=_0x3a6704||0xc8;return function(_0x18b3fd){if(_0x18b3fd){return _0x40674d['status'](_0x3a6704)[_0xc1ee('0x1c')](_0x18b3fd);}};}function respondWithFilteredResult(_0x347b9c,_0xde864){return function(_0x44121c){if(_0x44121c){var _0x24c37a=typeof _0xde864[_0xc1ee('0x1d')]==='undefined'&&typeof _0xde864[_0xc1ee('0x1e')]===_0xc1ee('0x1f');var _0xc69b07=_0x44121c[_0xc1ee('0x20')];var _0x3d721b=_0x24c37a?0x0:_0xde864[_0xc1ee('0x1d')];var _0xf9a12d=_0x24c37a?_0x44121c[_0xc1ee('0x20')]:_0xde864[_0xc1ee('0x1d')]+_0xde864[_0xc1ee('0x1e')];var _0x4fb457;if(_0xf9a12d>=_0xc69b07){_0xf9a12d=_0xc69b07;_0x4fb457=0xc8;}else{_0x4fb457=0xce;}_0x347b9c[_0xc1ee('0x1a')](_0x4fb457);return _0x347b9c[_0xc1ee('0x21')](_0xc1ee('0x22'),_0x3d721b+'-'+_0xf9a12d+'/'+_0xc69b07)[_0xc1ee('0x1c')](_0x44121c);}return null;};}function patchUpdates(_0x462826){return function(_0x23be59){try{jsonpatch[_0xc1ee('0x23')](_0x23be59,_0x462826,!![]);}catch(_0x4668c4){return BPromise[_0xc1ee('0x24')](_0x4668c4);}return _0x23be59[_0xc1ee('0x25')]();};}function saveUpdates(_0x274f2d,_0x476a0f){return function(_0x574584){if(_0x574584){return _0x574584[_0xc1ee('0x26')](_0x274f2d)['then'](function(_0x3f2c5c){return _0x3f2c5c;});}return null;};}function removeEntity(_0x32243f,_0x18ea71){return function(_0x15cbcf){if(_0x15cbcf){return _0x15cbcf['destroy']()[_0xc1ee('0x27')](function(){_0x32243f[_0xc1ee('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8b49,_0x5bb5ed){return function(_0x7c913b){if(!_0x7c913b){_0x4e8b49['sendStatus'](0x194);}return _0x7c913b;};}function handleError(_0x5329fe,_0x4ea7be){_0x4ea7be=_0x4ea7be||0x1f4;return function(_0x17ef52){logger[_0xc1ee('0x28')](_0x17ef52[_0xc1ee('0x29')]);if(_0x17ef52[_0xc1ee('0x2a')]){delete _0x17ef52[_0xc1ee('0x2a')];}_0x5329fe[_0xc1ee('0x1a')](_0x4ea7be)[_0xc1ee('0x2b')](_0x17ef52);};}exports['index']=function(_0x4434c1,_0x2fcba6){var _0x5d2eb4={},_0x47dd1f={},_0x5eac22={'count':0x0,'rows':[]};var _0x18c0b8=_['map'](db['SquareRecording'][_0xc1ee('0x2c')],function(_0x257f3b){return{'name':_0x257f3b['fieldName'],'type':_0x257f3b[_0xc1ee('0x2d')][_0xc1ee('0x2e')]};});_0x47dd1f[_0xc1ee('0x2f')]=_[_0xc1ee('0x30')](_0x18c0b8,_0xc1ee('0x2a'));_0x47dd1f[_0xc1ee('0x31')]=_[_0xc1ee('0x32')](_0x4434c1[_0xc1ee('0x31')]);_0x47dd1f[_0xc1ee('0x33')]=_[_0xc1ee('0x34')](_0x47dd1f[_0xc1ee('0x2f')],_0x47dd1f[_0xc1ee('0x31')]);_0x5d2eb4[_0xc1ee('0x35')]=_[_0xc1ee('0x34')](_0x47dd1f[_0xc1ee('0x2f')],qs[_0xc1ee('0x36')](_0x4434c1[_0xc1ee('0x31')][_0xc1ee('0x36')]));_0x5d2eb4[_0xc1ee('0x35')]=_0x5d2eb4['attributes']['length']?_0x5d2eb4['attributes']:_0x47dd1f['model'];if(!_0x4434c1[_0xc1ee('0x31')][_0xc1ee('0x37')](_0xc1ee('0x38'))){_0x5d2eb4[_0xc1ee('0x1e')]=qs[_0xc1ee('0x1e')](_0x4434c1[_0xc1ee('0x31')][_0xc1ee('0x1e')]);_0x5d2eb4[_0xc1ee('0x1d')]=qs[_0xc1ee('0x1d')](_0x4434c1[_0xc1ee('0x31')]['offset']);}_0x5d2eb4[_0xc1ee('0x39')]=qs[_0xc1ee('0x3a')](_0x4434c1[_0xc1ee('0x31')]['sort']);_0x5d2eb4[_0xc1ee('0x3b')]=qs[_0xc1ee('0x33')](_[_0xc1ee('0x3c')](_0x4434c1[_0xc1ee('0x31')],_0x47dd1f['filters']),_0x18c0b8);if(_0x4434c1[_0xc1ee('0x31')][_0xc1ee('0x3d')]){_0x5d2eb4[_0xc1ee('0x3b')]=_[_0xc1ee('0x3e')](_0x5d2eb4[_0xc1ee('0x3b')],{'$or':_[_0xc1ee('0x30')](_0x18c0b8,function(_0x4ccae3){if(_0x4ccae3[_0xc1ee('0x2d')]!==_0xc1ee('0x3f')){var _0x2dbb24={};_0x2dbb24[_0x4ccae3[_0xc1ee('0x2a')]]={'$like':'%'+_0x4434c1[_0xc1ee('0x31')][_0xc1ee('0x3d')]+'%'};return _0x2dbb24;}})});}_0x5d2eb4=_['merge']({},_0x5d2eb4,_0x4434c1[_0xc1ee('0x40')]);var _0x537a60={'where':_0x5d2eb4[_0xc1ee('0x3b')]};return db[_0xc1ee('0x41')]['count'](_0x537a60)[_0xc1ee('0x27')](function(_0x5c8f5f){_0x5eac22[_0xc1ee('0x20')]=_0x5c8f5f;if(_0x4434c1[_0xc1ee('0x31')][_0xc1ee('0x42')]){_0x5d2eb4[_0xc1ee('0x43')]=[{'all':!![]}];}return db[_0xc1ee('0x41')][_0xc1ee('0x44')](_0x5d2eb4);})[_0xc1ee('0x27')](function(_0x41f008){_0x5eac22[_0xc1ee('0x45')]=_0x41f008;return _0x5eac22;})[_0xc1ee('0x27')](respondWithFilteredResult(_0x2fcba6,_0x5d2eb4))[_0xc1ee('0x46')](handleError(_0x2fcba6,null));};exports[_0xc1ee('0x47')]=function(_0x4f6883,_0x5759c7){var _0x40ac14={'raw':!![],'where':{'id':_0x4f6883[_0xc1ee('0x48')]['id']}},_0x54f839={};_0x54f839[_0xc1ee('0x2f')]=_[_0xc1ee('0x32')](db[_0xc1ee('0x41')][_0xc1ee('0x2c')]);_0x54f839[_0xc1ee('0x31')]=_[_0xc1ee('0x32')](_0x4f6883[_0xc1ee('0x31')]);_0x54f839[_0xc1ee('0x33')]=_['intersection'](_0x54f839['model'],_0x54f839[_0xc1ee('0x31')]);_0x40ac14[_0xc1ee('0x35')]=_['intersection'](_0x54f839['model'],qs[_0xc1ee('0x36')](_0x4f6883['query']['fields']));_0x40ac14[_0xc1ee('0x35')]=_0x40ac14[_0xc1ee('0x35')]['length']?_0x40ac14[_0xc1ee('0x35')]:_0x54f839['model'];if(_0x4f6883[_0xc1ee('0x31')][_0xc1ee('0x42')]){_0x40ac14['include']=[{'all':!![]}];}_0x40ac14=_[_0xc1ee('0x3e')]({},_0x40ac14,_0x4f6883[_0xc1ee('0x40')]);return db[_0xc1ee('0x41')][_0xc1ee('0x49')](_0x40ac14)[_0xc1ee('0x27')](handleEntityNotFound(_0x5759c7,null))[_0xc1ee('0x27')](respondWithResult(_0x5759c7,null))[_0xc1ee('0x46')](handleError(_0x5759c7,null));};exports[_0xc1ee('0x4a')]=function(_0x2312e4,_0x5545a){return db[_0xc1ee('0x41')]['create'](_0x2312e4[_0xc1ee('0x4b')],{})[_0xc1ee('0x27')](respondWithResult(_0x5545a,0xc9))[_0xc1ee('0x46')](handleError(_0x5545a,null));};exports[_0xc1ee('0x26')]=function(_0x48c75c,_0x1f38dd){if(_0x48c75c[_0xc1ee('0x4b')]['id']){delete _0x48c75c['body']['id'];}return db[_0xc1ee('0x41')]['find']({'where':{'id':_0x48c75c['params']['id']}})[_0xc1ee('0x27')](handleEntityNotFound(_0x1f38dd,null))['then'](saveUpdates(_0x48c75c['body'],null))[_0xc1ee('0x27')](respondWithResult(_0x1f38dd,null))[_0xc1ee('0x46')](handleError(_0x1f38dd,null));};exports[_0xc1ee('0x4c')]=function(_0x5a5696,_0x4691a4,_0x18ba20){var _0xc7ff5f=require(_0xc1ee('0x4d'));var _0x375ec3=![];var _0x58c456={};if(_0x5a5696['query']['type']&&_0x5a5696[_0xc1ee('0x31')][_0xc1ee('0x2d')]===_0xc1ee('0x4e')){_0x58c456['uniqueid']=_0x5a5696[_0xc1ee('0x48')]['id'];}else{_0x58c456['id']=_0x5a5696['params']['id'];}return db[_0xc1ee('0x41')][_0xc1ee('0x49')]({'where':_0x58c456,'attributes':['id',_0xc1ee('0x4f'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x4691a4,null))[_0xc1ee('0x27')](function(_0x160c9e){if(_0x160c9e){var _0x2fcabf=_0x160c9e[_0xc1ee('0x4f')];var _0xa1936a=util[_0xc1ee('0x50')]('%s.cypher',_0x2fcabf);if(fs[_0xc1ee('0x51')](_0xa1936a)){_0x375ec3=!![];return _0xc7ff5f[_0xc1ee('0x52')](_0xa1936a,_0x2fcabf,config[_0xc1ee('0x53')][_0xc1ee('0x54')])[_0xc1ee('0x27')](function(){return _0x160c9e;});}return _0x160c9e;}})[_0xc1ee('0x27')](function(_0x8a78c8){if(_0x8a78c8){var _0xeb746f=_0x8a78c8[_0xc1ee('0x4f')];if(!fs[_0xc1ee('0x51')](_0xeb746f)){throw new db['Sequelize']['ValidationError'](_0xc1ee('0x55'));}if(_0x8a78c8[_0xc1ee('0x56')]){return _0x4691a4[_0xc1ee('0x4c')](_0xeb746f,_0x8a78c8[_0xc1ee('0x56')]+path[_0xc1ee('0x57')](_0xeb746f),function(){if(_0x375ec3){fs['unlink'](_0xeb746f);}});}else{return _0x4691a4[_0xc1ee('0x4c')](_0xeb746f,function(_0x548c2c){if(_0x375ec3){fs[_0xc1ee('0x58')](_0xeb746f);}});}}})[_0xc1ee('0x46')](function(_0x15754a){if(_0x15754a[_0xc1ee('0x59')]==='SquareRecording\x20not\x20found'){_0x4691a4['status'](0x194)[_0xc1ee('0x2b')](_0xc1ee('0x5a'));}else{return handleError(_0x4691a4,null);}});};exports[_0xc1ee('0x5b')]=function(_0x59e3cc,_0x560e70){return db['SquareRecording'][_0xc1ee('0x49')]({'where':{'id':_0x59e3cc[_0xc1ee('0x48')]['id']}})[_0xc1ee('0x27')](function(_0x4bec53){if(_['isNil'](_0x4bec53)){throw new ReferenceError(_0xc1ee('0x5c'));}return _0x4bec53;})[_0xc1ee('0x27')](function(_0x2cdd31){var _0x2d9b4e=_0x2cdd31[_0xc1ee('0x4f')];logger[_0xc1ee('0x5d')](_0xc1ee('0x5e'),_0x2d9b4e);if(!_[_0xc1ee('0x5f')](_0x2cdd31['savePath'])&&fs[_0xc1ee('0x51')](_0x2d9b4e)){logger[_0xc1ee('0x5d')]('File:\x20\x22'+_0x2d9b4e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc1ee('0x60')](_0x2d9b4e);}_0x2d9b4e=_0x2d9b4e+_0xc1ee('0x61');if(!_[_0xc1ee('0x5f')](_0x2cdd31[_0xc1ee('0x4f')])&&fs[_0xc1ee('0x51')](_0x2d9b4e)){logger['info'](_0xc1ee('0x62')+_0x2d9b4e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2d9b4e);}return _0x2cdd31;})['then'](function(_0x2cf314){if(!_0x2cf314)throw new InternalError();return _0x2cf314[_0xc1ee('0x5b')]();})[_0xc1ee('0x27')](function(){_0x560e70[_0xc1ee('0x1a')](0xcc)[_0xc1ee('0x1b')]();})[_0xc1ee('0x46')](handleError(_0x560e70,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index dbe17c1..ec95ad0 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 _0x97ce=['bluebird','path','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x97ce,0x151));var _0xe97c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x97ce[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xe97c('0x0'));var util=require(_0xe97c('0x1'));var logger=require(_0xe97c('0x2'))(_0xe97c('0x3'));var moment=require('moment');var BPromise=require(_0xe97c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe97c('0x5'));var rimraf=require('rimraf');var config=require(_0xe97c('0x6'));var attributes=require(_0xe97c('0x7'));module[_0xe97c('0x8')]=function(_0x447030,_0x29184f){return _0x447030[_0xe97c('0x9')]('SquareRecording',attributes,{'tableName':_0xe97c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf105=['define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./squareRecording.attributes','exports'];(function(_0x3e88f0,_0x27d2b0){var _0x106a66=function(_0x4c2fab){while(--_0x4c2fab){_0x3e88f0['push'](_0x3e88f0['shift']());}};_0x106a66(++_0x27d2b0);}(_0xf105,0x1b0));var _0x5f10=function(_0x40e6f6,_0x348f3c){_0x40e6f6=_0x40e6f6-0x0;var _0x473d21=_0xf105[_0x40e6f6];return _0x473d21;};'use strict';var _=require(_0x5f10('0x0'));var util=require(_0x5f10('0x1'));var logger=require(_0x5f10('0x2'))(_0x5f10('0x3'));var moment=require(_0x5f10('0x4'));var BPromise=require(_0x5f10('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f10('0x6'));var rimraf=require('rimraf');var config=require(_0x5f10('0x7'));var attributes=require(_0x5f10('0x8'));module[_0x5f10('0x9')]=function(_0x1b7489,_0x46b6f2){return _0x1b7489[_0x5f10('0xa')](_0x5f10('0xb'),attributes,{'tableName':_0x5f10('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index e783c49..02b2c46 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 _0xb71d=['http','request','then','info','request\x20sent','debug','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2d09a0,_0x528c4d){var _0x2d157b=function(_0x2283a6){while(--_0x2283a6){_0x2d09a0['push'](_0x2d09a0['shift']());}};_0x2d157b(++_0x528c4d);}(_0xb71d,0x1f3));var _0xdb71=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb71d[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xdb71('0x0'));var util=require(_0xdb71('0x1'));var moment=require(_0xdb71('0x2'));var BPromise=require(_0xdb71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb71('0x4'));var db=require(_0xdb71('0x5'))['db'];var utils=require(_0xdb71('0x6'));var logger=require('../../config/logger')(_0xdb71('0x7'));var config=require(_0xdb71('0x8'));var jayson=require(_0xdb71('0x9'));var client=jayson[_0xdb71('0xa')][_0xdb71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b1091,_0xf90140,_0xddb33a){return new BPromise(function(_0x5708e4,_0x362e65){return client[_0xdb71('0xc')](_0x2b1091,_0xddb33a)[_0xdb71('0xd')](function(_0x22736a){logger[_0xdb71('0xe')]('SquareRecording,\x20%s,\x20%s',_0xf90140,_0xdb71('0xf'));logger[_0xdb71('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0xf90140,_0xdb71('0xf'),JSON[_0xdb71('0x11')](_0x22736a));if(_0x22736a[_0xdb71('0x12')]){if(_0x22736a['error'][_0xdb71('0x13')]===0x1f4){logger[_0xdb71('0x12')](_0xdb71('0x14'),_0xf90140,_0x22736a[_0xdb71('0x12')][_0xdb71('0x15')]);return _0x362e65(_0x22736a[_0xdb71('0x12')][_0xdb71('0x15')]);}logger[_0xdb71('0x12')]('SquareRecording,\x20%s,\x20%s',_0xf90140,_0x22736a[_0xdb71('0x12')][_0xdb71('0x15')]);return _0x5708e4(_0x22736a[_0xdb71('0x12')][_0xdb71('0x15')]);}else{logger[_0xdb71('0xe')](_0xdb71('0x14'),_0xf90140,_0xdb71('0xf'));_0x5708e4(_0x22736a[_0xdb71('0x16')][_0xdb71('0x15')]);}})[_0xdb71('0x17')](function(_0x497406){logger[_0xdb71('0x12')](_0xdb71('0x14'),_0xf90140,_0x497406);_0x362e65(_0x497406);});});}exports[_0xdb71('0x18')]=function(_0x3ea779){var _0x525c44=this;return new Promise(function(_0x2a97cd,_0x2f8de5){return db[_0xdb71('0x19')][_0xdb71('0x1a')](_0x3ea779[_0xdb71('0x1b')],{'raw':_0x3ea779[_0xdb71('0x1c')]?_0x3ea779['options'][_0xdb71('0x1d')]===undefined?!![]:![]:!![]})[_0xdb71('0xd')](function(_0x4ee2ef){logger[_0xdb71('0xe')](_0xdb71('0x18'),_0x3ea779);logger[_0xdb71('0x10')](_0xdb71('0x18'),_0x3ea779,JSON[_0xdb71('0x11')](_0x4ee2ef));_0x2a97cd(_0x4ee2ef);})['catch'](function(_0x41a164){logger[_0xdb71('0x12')](_0xdb71('0x18'),_0x41a164[_0xdb71('0x15')],_0x3ea779);_0x2f8de5(_0x525c44['error'](0x1f4,_0x41a164[_0xdb71('0x15')]));});});}; \ No newline at end of file +var _0x4b7c=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','SquareRecording,\x20%s,\x20%s','message','catch','SquareRecording','create','body','options','raw','then','CreateSquareRecording','debug','stringify','lodash','util'];(function(_0x443d97,_0x567cda){var _0x315cb1=function(_0x284e68){while(--_0x284e68){_0x443d97['push'](_0x443d97['shift']());}};_0x315cb1(++_0x567cda);}(_0x4b7c,0x14e));var _0xc4b7=function(_0x589c1c,_0xf4d1e3){_0x589c1c=_0x589c1c-0x0;var _0x125f1f=_0x4b7c[_0x589c1c];return _0x125f1f;};'use strict';var _=require(_0xc4b7('0x0'));var util=require(_0xc4b7('0x1'));var moment=require(_0xc4b7('0x2'));var BPromise=require('bluebird');var rs=require(_0xc4b7('0x3'));var fs=require('fs');var Redis=require(_0xc4b7('0x4'));var db=require(_0xc4b7('0x5'))['db'];var utils=require(_0xc4b7('0x6'));var logger=require(_0xc4b7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc4b7('0x8')][_0xc4b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x292df8,_0x4f0512,_0x2c5be8){return new BPromise(function(_0x332633,_0x1a45a9){return client[_0xc4b7('0xa')](_0x292df8,_0x2c5be8)['then'](function(_0x296738){logger[_0xc4b7('0xb')]('SquareRecording,\x20%s,\x20%s',_0x4f0512,_0xc4b7('0xc'));logger['debug'](_0xc4b7('0xd'),_0x4f0512,_0xc4b7('0xc'),JSON['stringify'](_0x296738));if(_0x296738['error']){if(_0x296738[_0xc4b7('0xe')][_0xc4b7('0xf')]===0x1f4){logger[_0xc4b7('0xe')](_0xc4b7('0x10'),_0x4f0512,_0x296738[_0xc4b7('0xe')][_0xc4b7('0x11')]);return _0x1a45a9(_0x296738[_0xc4b7('0xe')]['message']);}logger[_0xc4b7('0xe')](_0xc4b7('0x10'),_0x4f0512,_0x296738[_0xc4b7('0xe')][_0xc4b7('0x11')]);return _0x332633(_0x296738[_0xc4b7('0xe')][_0xc4b7('0x11')]);}else{logger[_0xc4b7('0xb')]('SquareRecording,\x20%s,\x20%s',_0x4f0512,_0xc4b7('0xc'));_0x332633(_0x296738['result'][_0xc4b7('0x11')]);}})[_0xc4b7('0x12')](function(_0x46f93f){logger[_0xc4b7('0xe')]('SquareRecording,\x20%s,\x20%s',_0x4f0512,_0x46f93f);_0x1a45a9(_0x46f93f);});});}exports['CreateSquareRecording']=function(_0x31e768){var _0xe3b637=this;return new Promise(function(_0x53b189,_0x1921ba){return db[_0xc4b7('0x13')][_0xc4b7('0x14')](_0x31e768[_0xc4b7('0x15')],{'raw':_0x31e768[_0xc4b7('0x16')]?_0x31e768[_0xc4b7('0x16')][_0xc4b7('0x17')]===undefined?!![]:![]:!![]})[_0xc4b7('0x18')](function(_0x58f99e){logger['info'](_0xc4b7('0x19'),_0x31e768);logger[_0xc4b7('0x1a')](_0xc4b7('0x19'),_0x31e768,JSON[_0xc4b7('0x1b')](_0x58f99e));_0x53b189(_0x58f99e);})[_0xc4b7('0x12')](function(_0x2d575c){logger['error'](_0xc4b7('0x19'),_0x2d575c[_0xc4b7('0x11')],_0x31e768);_0x1921ba(_0xe3b637[_0xc4b7('0xe')](0x1f4,_0x2d575c[_0xc4b7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index af795f5..57cd03d 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x5870e8,_0x358687){var _0x91c23c=function(_0x1fde36){while(--_0x1fde36){_0x5870e8['push'](_0x5870e8['shift']());}};_0x91c23c(++_0x358687);}(_0xe706,0xa3));var _0x6e70=function(_0x495f3c,_0x592bbe){_0x495f3c=_0x495f3c-0x0;var _0x4b97ee=_0xe706[_0x495f3c];return _0x4b97ee;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x15f6cc,_0x52b4e4){var _0xd2cb0d=function(_0xe16283){while(--_0xe16283){_0x15f6cc['push'](_0x15f6cc['shift']());}};_0xd2cb0d(++_0x52b4e4);}(_0xe706,0xa3));var _0x6e70=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xe706[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index ce8dfbe..d5da31f 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 _0x6490=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x6490,0x86));var _0x0649=function(_0x42e8f3,_0x5c8dba){_0x42e8f3=_0x42e8f3-0x0;var _0x47feab=_0x6490[_0x42e8f3];return _0x47feab;};'use strict';var Sequelize=require(_0x0649('0x0'));module['exports']={'network':{'type':Sequelize[_0x0649('0x1')]},'network_script':{'type':Sequelize[_0x0649('0x1')]},'request':{'type':Sequelize[_0x0649('0x1')]},'channel':{'type':Sequelize[_0x0649('0x1')]},'language':{'type':Sequelize[_0x0649('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0649('0x1')]},'version':{'type':Sequelize[_0x0649('0x1')]},'callerid':{'type':Sequelize[_0x0649('0x1')]},'calleridname':{'type':Sequelize[_0x0649('0x1')]},'callingpres':{'type':Sequelize[_0x0649('0x1')]},'callingani2':{'type':Sequelize[_0x0649('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x0649('0x1')]},'dnid':{'type':Sequelize[_0x0649('0x1')]},'rdnis':{'type':Sequelize[_0x0649('0x1')]},'context':{'type':Sequelize[_0x0649('0x1')]},'extension':{'type':Sequelize[_0x0649('0x1')]},'priority':{'type':Sequelize[_0x0649('0x1')]},'enhanced':{'type':Sequelize[_0x0649('0x1')]},'accountcode':{'type':Sequelize[_0x0649('0x1')]},'threadid':{'type':Sequelize[_0x0649('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0649('0x2')]},'leaveAt':{'type':Sequelize[_0x0649('0x2')]},'bot':{'type':Sequelize[_0x0649('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x8a2c=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x51995c,_0x3d4b11){var _0x118397=function(_0x71c241){while(--_0x71c241){_0x51995c['push'](_0x51995c['shift']());}};_0x118397(++_0x3d4b11);}(_0x8a2c,0xb8));var _0xc8a2=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x8a2c[_0x288f5e];return _0x476cc9;};'use strict';var Sequelize=require(_0xc8a2('0x0'));module['exports']={'network':{'type':Sequelize[_0xc8a2('0x1')]},'network_script':{'type':Sequelize[_0xc8a2('0x1')]},'request':{'type':Sequelize[_0xc8a2('0x1')]},'channel':{'type':Sequelize[_0xc8a2('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc8a2('0x1')]},'uniqueid':{'type':Sequelize[_0xc8a2('0x1')]},'version':{'type':Sequelize[_0xc8a2('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc8a2('0x1')]},'callingpres':{'type':Sequelize[_0xc8a2('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xc8a2('0x1')]},'callingtns':{'type':Sequelize[_0xc8a2('0x1')]},'dnid':{'type':Sequelize[_0xc8a2('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc8a2('0x1')]},'extension':{'type':Sequelize[_0xc8a2('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc8a2('0x1')]},'threadid':{'type':Sequelize[_0xc8a2('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc8a2('0x2')]},'leaveAt':{'type':Sequelize[_0xc8a2('0x2')]},'bot':{'type':Sequelize[_0xc8a2('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index f133762..0b6f851 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 _0x904e=['filter','options','SquareReport','include','findAll','catch','show','keys','rawAttributes','fields','includeAll','merge','create','body','find','params','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','send','index','map','fieldName','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','name'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x904e,0x18d));var _0xe904=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x904e[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require(_0xe904('0x0'));var rimraf=require(_0xe904('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe904('0x2'));var moment=require(_0xe904('0x3'));var BPromise=require(_0xe904('0x4'));var Mustache=require('mustache');var util=require(_0xe904('0x5'));var path=require(_0xe904('0x6'));var sox=require(_0xe904('0x7'));var csv=require(_0xe904('0x8'));var ejs=require(_0xe904('0x9'));var fs=require('fs');var fs_extra=require(_0xe904('0xa'));var _=require(_0xe904('0xb'));var squel=require('squel');var crypto=require(_0xe904('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe904('0x8'));var querystring=require(_0xe904('0xd'));var Papa=require(_0xe904('0xe'));var Redis=require(_0xe904('0xf'));var authService=require(_0xe904('0x10'));var qs=require(_0xe904('0x11'));var as=require(_0xe904('0x12'));var hardwareService=require(_0xe904('0x13'));var logger=require('../../config/logger')(_0xe904('0x14'));var utils=require(_0xe904('0x15'));var config=require(_0xe904('0x16'));var licenseUtil=require(_0xe904('0x17'));var db=require(_0xe904('0x18'))['db'];function respondWithStatusCode(_0x5c8972,_0x59927c){_0x59927c=_0x59927c||0xcc;return function(_0x3cd1ad){if(_0x3cd1ad){return _0x5c8972[_0xe904('0x19')](_0x59927c);}return _0x5c8972[_0xe904('0x1a')](_0x59927c)[_0xe904('0x1b')]();};}function respondWithResult(_0x47e6dd,_0x34a1fd){_0x34a1fd=_0x34a1fd||0xc8;return function(_0x4b05ae){if(_0x4b05ae){return _0x47e6dd[_0xe904('0x1a')](_0x34a1fd)[_0xe904('0x1c')](_0x4b05ae);}};}function respondWithFilteredResult(_0x1c3a1a,_0x146d38){return function(_0x31617a){if(_0x31617a){var _0x453362=typeof _0x146d38[_0xe904('0x1d')]===_0xe904('0x1e')&&typeof _0x146d38[_0xe904('0x1f')]===_0xe904('0x1e');var _0x2b9f35=_0x31617a[_0xe904('0x20')];var _0x393329=_0x453362?0x0:_0x146d38[_0xe904('0x1d')];var _0x4f4811=_0x453362?_0x31617a['count']:_0x146d38['offset']+_0x146d38[_0xe904('0x1f')];var _0x221657;if(_0x4f4811>=_0x2b9f35){_0x4f4811=_0x2b9f35;_0x221657=0xc8;}else{_0x221657=0xce;}_0x1c3a1a[_0xe904('0x1a')](_0x221657);return _0x1c3a1a[_0xe904('0x21')](_0xe904('0x22'),_0x393329+'-'+_0x4f4811+'/'+_0x2b9f35)['json'](_0x31617a);}return null;};}function patchUpdates(_0x4d6738){return function(_0x3ce4bc){try{jsonpatch[_0xe904('0x23')](_0x3ce4bc,_0x4d6738,!![]);}catch(_0x515647){return BPromise[_0xe904('0x24')](_0x515647);}return _0x3ce4bc[_0xe904('0x25')]();};}function saveUpdates(_0x1f52ca,_0x454733){return function(_0xa78133){if(_0xa78133){return _0xa78133['update'](_0x1f52ca)[_0xe904('0x26')](function(_0x28b105){return _0x28b105;});}return null;};}function removeEntity(_0x294cd6,_0x4d1d83){return function(_0x471a35){if(_0x471a35){return _0x471a35['destroy']()[_0xe904('0x26')](function(){_0x294cd6[_0xe904('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ac73c,_0x29598e){return function(_0x1e50da){if(!_0x1e50da){_0x1ac73c[_0xe904('0x19')](0x194);}return _0x1e50da;};}function handleError(_0x4cd97c,_0x5a8bdf){_0x5a8bdf=_0x5a8bdf||0x1f4;return function(_0x226690){logger[_0xe904('0x27')](_0x226690[_0xe904('0x28')]);if(_0x226690['name']){delete _0x226690['name'];}_0x4cd97c[_0xe904('0x1a')](_0x5a8bdf)[_0xe904('0x29')](_0x226690);};}exports[_0xe904('0x2a')]=function(_0x3a1c21,_0x1bfd0a){var _0x227012={},_0x1eec7f={},_0x1eefb0={'count':0x0,'rows':[]};var _0x3f37fd=_[_0xe904('0x2b')](db['SquareReport']['rawAttributes'],function(_0x520c28){return{'name':_0x520c28[_0xe904('0x2c')],'type':_0x520c28[_0xe904('0x2d')][_0xe904('0x2e')]};});_0x1eec7f[_0xe904('0x2f')]=_[_0xe904('0x2b')](_0x3f37fd,'name');_0x1eec7f['query']=_['keys'](_0x3a1c21[_0xe904('0x30')]);_0x1eec7f[_0xe904('0x31')]=_['intersection'](_0x1eec7f[_0xe904('0x2f')],_0x1eec7f[_0xe904('0x30')]);_0x227012[_0xe904('0x32')]=_[_0xe904('0x33')](_0x1eec7f[_0xe904('0x2f')],qs['fields'](_0x3a1c21[_0xe904('0x30')]['fields']));_0x227012[_0xe904('0x32')]=_0x227012['attributes'][_0xe904('0x34')]?_0x227012['attributes']:_0x1eec7f['model'];if(!_0x3a1c21[_0xe904('0x30')][_0xe904('0x35')](_0xe904('0x36'))){_0x227012['limit']=qs[_0xe904('0x1f')](_0x3a1c21['query'][_0xe904('0x1f')]);_0x227012[_0xe904('0x1d')]=qs['offset'](_0x3a1c21[_0xe904('0x30')][_0xe904('0x1d')]);}_0x227012['order']=qs[_0xe904('0x37')](_0x3a1c21[_0xe904('0x30')][_0xe904('0x37')]);_0x227012[_0xe904('0x38')]=qs['filters'](_[_0xe904('0x39')](_0x3a1c21[_0xe904('0x30')],_0x1eec7f[_0xe904('0x31')]),_0x3f37fd);if(_0x3a1c21['query']['filter']){_0x227012['where']=_['merge'](_0x227012[_0xe904('0x38')],{'$or':_['map'](_0x3f37fd,function(_0x49890d){if(_0x49890d[_0xe904('0x2d')]!=='VIRTUAL'){var _0x15a6e1={};_0x15a6e1[_0x49890d[_0xe904('0x3a')]]={'$like':'%'+_0x3a1c21[_0xe904('0x30')][_0xe904('0x3b')]+'%'};return _0x15a6e1;}})});}_0x227012=_['merge']({},_0x227012,_0x3a1c21[_0xe904('0x3c')]);var _0x4e4abc={'where':_0x227012[_0xe904('0x38')]};return db[_0xe904('0x3d')][_0xe904('0x20')](_0x4e4abc)['then'](function(_0x3d2342){_0x1eefb0['count']=_0x3d2342;if(_0x3a1c21[_0xe904('0x30')]['includeAll']){_0x227012[_0xe904('0x3e')]=[{'all':!![]}];}return db['SquareReport'][_0xe904('0x3f')](_0x227012);})[_0xe904('0x26')](function(_0x3f8c9a){_0x1eefb0['rows']=_0x3f8c9a;return _0x1eefb0;})[_0xe904('0x26')](respondWithFilteredResult(_0x1bfd0a,_0x227012))[_0xe904('0x40')](handleError(_0x1bfd0a,null));};exports[_0xe904('0x41')]=function(_0x35b785,_0x8636fc){var _0x5e6463={'raw':!![],'where':{'id':_0x35b785['params']['id']}},_0x3cbcdf={};_0x3cbcdf['model']=_[_0xe904('0x42')](db['SquareReport'][_0xe904('0x43')]);_0x3cbcdf['query']=_[_0xe904('0x42')](_0x35b785[_0xe904('0x30')]);_0x3cbcdf[_0xe904('0x31')]=_[_0xe904('0x33')](_0x3cbcdf['model'],_0x3cbcdf[_0xe904('0x30')]);_0x5e6463[_0xe904('0x32')]=_[_0xe904('0x33')](_0x3cbcdf[_0xe904('0x2f')],qs[_0xe904('0x44')](_0x35b785[_0xe904('0x30')][_0xe904('0x44')]));_0x5e6463[_0xe904('0x32')]=_0x5e6463['attributes'][_0xe904('0x34')]?_0x5e6463[_0xe904('0x32')]:_0x3cbcdf[_0xe904('0x2f')];if(_0x35b785['query'][_0xe904('0x45')]){_0x5e6463[_0xe904('0x3e')]=[{'all':!![]}];}_0x5e6463=_[_0xe904('0x46')]({},_0x5e6463,_0x35b785[_0xe904('0x3c')]);return db['SquareReport']['find'](_0x5e6463)[_0xe904('0x26')](handleEntityNotFound(_0x8636fc,null))[_0xe904('0x26')](respondWithResult(_0x8636fc,null))[_0xe904('0x40')](handleError(_0x8636fc,null));};exports['create']=function(_0x30bc4d,_0x1da33b){return db[_0xe904('0x3d')][_0xe904('0x47')](_0x30bc4d[_0xe904('0x48')],{})['then'](respondWithResult(_0x1da33b,0xc9))[_0xe904('0x40')](handleError(_0x1da33b,null));};exports['update']=function(_0x16bbb5,_0x52506c){if(_0x16bbb5[_0xe904('0x48')]['id']){delete _0x16bbb5[_0xe904('0x48')]['id'];}return db['SquareReport'][_0xe904('0x49')]({'where':{'id':_0x16bbb5[_0xe904('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52506c,null))['then'](saveUpdates(_0x16bbb5[_0xe904('0x48')],null))[_0xe904('0x26')](respondWithResult(_0x52506c,null))[_0xe904('0x40')](handleError(_0x52506c,null));};exports['destroy']=function(_0x457399,_0x305f9f){return db[_0xe904('0x3d')][_0xe904('0x49')]({'where':{'id':_0x457399[_0xe904('0x4a')]['id']}})[_0xe904('0x26')](handleEntityNotFound(_0x305f9f,null))[_0xe904('0x26')](removeEntity(_0x305f9f,null))[_0xe904('0x40')](handleError(_0x305f9f,null));};exports[_0xe904('0x4b')]=function(_0x31849c,_0x3ffcd4){return db['SquareReport'][_0xe904('0x4b')]()['then'](respondWithResult(_0x3ffcd4,null))[_0xe904('0x40')](handleError(_0x3ffcd4,null));}; \ No newline at end of file +var _0x8cc6=['sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','name','send','map','SquareReport','type','key','model','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','rawAttributes','include','options','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x26e96c,_0x4a7303){var _0x263e38=function(_0x51fa81){while(--_0x51fa81){_0x26e96c['push'](_0x26e96c['shift']());}};_0x263e38(++_0x4a7303);}(_0x8cc6,0x10d));var _0x68cc=function(_0x4c2496,_0x19d512){_0x4c2496=_0x4c2496-0x0;var _0x3e1834=_0x8cc6[_0x4c2496];return _0x3e1834;};'use strict';var emlformat=require(_0x68cc('0x0'));var rimraf=require(_0x68cc('0x1'));var zipdir=require(_0x68cc('0x2'));var jsonpatch=require(_0x68cc('0x3'));var rp=require(_0x68cc('0x4'));var moment=require(_0x68cc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x68cc('0x6'));var util=require(_0x68cc('0x7'));var path=require(_0x68cc('0x8'));var sox=require('sox');var csv=require(_0x68cc('0x9'));var ejs=require(_0x68cc('0xa'));var fs=require('fs');var fs_extra=require(_0x68cc('0xb'));var _=require(_0x68cc('0xc'));var squel=require(_0x68cc('0xd'));var crypto=require('crypto');var jsforce=require(_0x68cc('0xe'));var deskjs=require(_0x68cc('0xf'));var toCsv=require(_0x68cc('0x9'));var querystring=require(_0x68cc('0x10'));var Papa=require('papaparse');var Redis=require(_0x68cc('0x11'));var authService=require(_0x68cc('0x12'));var qs=require(_0x68cc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68cc('0x14'));var logger=require(_0x68cc('0x15'))(_0x68cc('0x16'));var utils=require(_0x68cc('0x17'));var config=require(_0x68cc('0x18'));var licenseUtil=require(_0x68cc('0x19'));var db=require(_0x68cc('0x1a'))['db'];function respondWithStatusCode(_0x2343e8,_0x3e0eb8){_0x3e0eb8=_0x3e0eb8||0xcc;return function(_0x3c3d24){if(_0x3c3d24){return _0x2343e8[_0x68cc('0x1b')](_0x3e0eb8);}return _0x2343e8[_0x68cc('0x1c')](_0x3e0eb8)[_0x68cc('0x1d')]();};}function respondWithResult(_0x50ce5b,_0x4fba45){_0x4fba45=_0x4fba45||0xc8;return function(_0x3b3e69){if(_0x3b3e69){return _0x50ce5b['status'](_0x4fba45)[_0x68cc('0x1e')](_0x3b3e69);}};}function respondWithFilteredResult(_0x4a6039,_0x3ac5ce){return function(_0x1bc07a){if(_0x1bc07a){var _0x2ba690=typeof _0x3ac5ce[_0x68cc('0x1f')]==='undefined'&&typeof _0x3ac5ce[_0x68cc('0x20')]===_0x68cc('0x21');var _0x12c9f1=_0x1bc07a[_0x68cc('0x22')];var _0x2a1bf7=_0x2ba690?0x0:_0x3ac5ce['offset'];var _0x4952ee=_0x2ba690?_0x1bc07a['count']:_0x3ac5ce[_0x68cc('0x1f')]+_0x3ac5ce[_0x68cc('0x20')];var _0x208fde;if(_0x4952ee>=_0x12c9f1){_0x4952ee=_0x12c9f1;_0x208fde=0xc8;}else{_0x208fde=0xce;}_0x4a6039['status'](_0x208fde);return _0x4a6039['set'](_0x68cc('0x23'),_0x2a1bf7+'-'+_0x4952ee+'/'+_0x12c9f1)[_0x68cc('0x1e')](_0x1bc07a);}return null;};}function patchUpdates(_0x23dcae){return function(_0x6e0cf0){try{jsonpatch[_0x68cc('0x24')](_0x6e0cf0,_0x23dcae,!![]);}catch(_0xcae2ff){return BPromise[_0x68cc('0x25')](_0xcae2ff);}return _0x6e0cf0[_0x68cc('0x26')]();};}function saveUpdates(_0x3e3e87,_0x2ed238){return function(_0x594b4b){if(_0x594b4b){return _0x594b4b['update'](_0x3e3e87)[_0x68cc('0x27')](function(_0x1e6f18){return _0x1e6f18;});}return null;};}function removeEntity(_0x342787,_0xfd7164){return function(_0x3c04be){if(_0x3c04be){return _0x3c04be[_0x68cc('0x28')]()['then'](function(){_0x342787[_0x68cc('0x1c')](0xcc)[_0x68cc('0x1d')]();});}};}function handleEntityNotFound(_0x5a0b99,_0x328786){return function(_0x408f99){if(!_0x408f99){_0x5a0b99[_0x68cc('0x1b')](0x194);}return _0x408f99;};}function handleError(_0x5235cf,_0x27edc8){_0x27edc8=_0x27edc8||0x1f4;return function(_0x4f9222){logger[_0x68cc('0x29')](_0x4f9222['stack']);if(_0x4f9222[_0x68cc('0x2a')]){delete _0x4f9222[_0x68cc('0x2a')];}_0x5235cf[_0x68cc('0x1c')](_0x27edc8)[_0x68cc('0x2b')](_0x4f9222);};}exports['index']=function(_0x20be6e,_0x265bec){var _0x117ca6={},_0x5ad3c7={},_0x237a5c={'count':0x0,'rows':[]};var _0x1ea011=_[_0x68cc('0x2c')](db[_0x68cc('0x2d')]['rawAttributes'],function(_0x511d9e){return{'name':_0x511d9e['fieldName'],'type':_0x511d9e[_0x68cc('0x2e')][_0x68cc('0x2f')]};});_0x5ad3c7[_0x68cc('0x30')]=_[_0x68cc('0x2c')](_0x1ea011,_0x68cc('0x2a'));_0x5ad3c7[_0x68cc('0x31')]=_['keys'](_0x20be6e[_0x68cc('0x31')]);_0x5ad3c7[_0x68cc('0x32')]=_[_0x68cc('0x33')](_0x5ad3c7[_0x68cc('0x30')],_0x5ad3c7['query']);_0x117ca6[_0x68cc('0x34')]=_['intersection'](_0x5ad3c7[_0x68cc('0x30')],qs[_0x68cc('0x35')](_0x20be6e[_0x68cc('0x31')]['fields']));_0x117ca6[_0x68cc('0x34')]=_0x117ca6[_0x68cc('0x34')][_0x68cc('0x36')]?_0x117ca6[_0x68cc('0x34')]:_0x5ad3c7[_0x68cc('0x30')];if(!_0x20be6e[_0x68cc('0x31')]['hasOwnProperty']('nolimit')){_0x117ca6[_0x68cc('0x20')]=qs[_0x68cc('0x20')](_0x20be6e[_0x68cc('0x31')][_0x68cc('0x20')]);_0x117ca6[_0x68cc('0x1f')]=qs[_0x68cc('0x1f')](_0x20be6e[_0x68cc('0x31')][_0x68cc('0x1f')]);}_0x117ca6['order']=qs[_0x68cc('0x37')](_0x20be6e[_0x68cc('0x31')][_0x68cc('0x37')]);_0x117ca6[_0x68cc('0x38')]=qs[_0x68cc('0x32')](_[_0x68cc('0x39')](_0x20be6e[_0x68cc('0x31')],_0x5ad3c7[_0x68cc('0x32')]),_0x1ea011);if(_0x20be6e[_0x68cc('0x31')][_0x68cc('0x3a')]){_0x117ca6['where']=_[_0x68cc('0x3b')](_0x117ca6[_0x68cc('0x38')],{'$or':_['map'](_0x1ea011,function(_0x2a0065){if(_0x2a0065['type']!==_0x68cc('0x3c')){var _0x551e52={};_0x551e52[_0x2a0065[_0x68cc('0x2a')]]={'$like':'%'+_0x20be6e['query'][_0x68cc('0x3a')]+'%'};return _0x551e52;}})});}_0x117ca6=_['merge']({},_0x117ca6,_0x20be6e['options']);var _0x588ac4={'where':_0x117ca6['where']};return db[_0x68cc('0x2d')][_0x68cc('0x22')](_0x588ac4)['then'](function(_0x28713b){_0x237a5c[_0x68cc('0x22')]=_0x28713b;if(_0x20be6e[_0x68cc('0x31')][_0x68cc('0x3d')]){_0x117ca6['include']=[{'all':!![]}];}return db[_0x68cc('0x2d')]['findAll'](_0x117ca6);})[_0x68cc('0x27')](function(_0x8ddf4f){_0x237a5c[_0x68cc('0x3e')]=_0x8ddf4f;return _0x237a5c;})[_0x68cc('0x27')](respondWithFilteredResult(_0x265bec,_0x117ca6))[_0x68cc('0x3f')](handleError(_0x265bec,null));};exports[_0x68cc('0x40')]=function(_0x469287,_0x33012c){var _0x27fd60={'raw':!![],'where':{'id':_0x469287[_0x68cc('0x41')]['id']}},_0x58b30b={};_0x58b30b[_0x68cc('0x30')]=_[_0x68cc('0x42')](db[_0x68cc('0x2d')][_0x68cc('0x43')]);_0x58b30b['query']=_[_0x68cc('0x42')](_0x469287[_0x68cc('0x31')]);_0x58b30b['filters']=_['intersection'](_0x58b30b[_0x68cc('0x30')],_0x58b30b[_0x68cc('0x31')]);_0x27fd60[_0x68cc('0x34')]=_[_0x68cc('0x33')](_0x58b30b[_0x68cc('0x30')],qs['fields'](_0x469287[_0x68cc('0x31')][_0x68cc('0x35')]));_0x27fd60[_0x68cc('0x34')]=_0x27fd60[_0x68cc('0x34')][_0x68cc('0x36')]?_0x27fd60[_0x68cc('0x34')]:_0x58b30b[_0x68cc('0x30')];if(_0x469287[_0x68cc('0x31')][_0x68cc('0x3d')]){_0x27fd60[_0x68cc('0x44')]=[{'all':!![]}];}_0x27fd60=_[_0x68cc('0x3b')]({},_0x27fd60,_0x469287[_0x68cc('0x45')]);return db[_0x68cc('0x2d')][_0x68cc('0x46')](_0x27fd60)[_0x68cc('0x27')](handleEntityNotFound(_0x33012c,null))[_0x68cc('0x27')](respondWithResult(_0x33012c,null))[_0x68cc('0x3f')](handleError(_0x33012c,null));};exports['create']=function(_0x45c234,_0x161bea){return db['SquareReport']['create'](_0x45c234[_0x68cc('0x47')],{})[_0x68cc('0x27')](respondWithResult(_0x161bea,0xc9))['catch'](handleError(_0x161bea,null));};exports[_0x68cc('0x48')]=function(_0x25078d,_0x456362){if(_0x25078d[_0x68cc('0x47')]['id']){delete _0x25078d['body']['id'];}return db[_0x68cc('0x2d')][_0x68cc('0x46')]({'where':{'id':_0x25078d[_0x68cc('0x41')]['id']}})[_0x68cc('0x27')](handleEntityNotFound(_0x456362,null))[_0x68cc('0x27')](saveUpdates(_0x25078d[_0x68cc('0x47')],null))[_0x68cc('0x27')](respondWithResult(_0x456362,null))[_0x68cc('0x3f')](handleError(_0x456362,null));};exports[_0x68cc('0x28')]=function(_0x2bb44f,_0x5852b5){return db[_0x68cc('0x2d')][_0x68cc('0x46')]({'where':{'id':_0x2bb44f[_0x68cc('0x41')]['id']}})['then'](handleEntityNotFound(_0x5852b5,null))[_0x68cc('0x27')](removeEntity(_0x5852b5,null))['catch'](handleError(_0x5852b5,null));};exports['describe']=function(_0x14cc37,_0x3296f8){return db[_0x68cc('0x2d')][_0x68cc('0x49')]()[_0x68cc('0x27')](respondWithResult(_0x3296f8,null))[_0x68cc('0x3f')](handleError(_0x3296f8,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 3b88f73..29084e8 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 _0xc9c2=['api','moment','bluebird','request-promise','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util'];(function(_0x186222,_0x3bdfb0){var _0x226a38=function(_0x3b071f){while(--_0x3b071f){_0x186222['push'](_0x186222['shift']());}};_0x226a38(++_0x3bdfb0);}(_0xc9c2,0x1ae));var _0x2c9c=function(_0x12c45d,_0x97707a){_0x12c45d=_0x12c45d-0x0;var _0x4f2a58=_0xc9c2[_0x12c45d];return _0x4f2a58;};'use strict';var _=require(_0x2c9c('0x0'));var util=require(_0x2c9c('0x1'));var logger=require('../../config/logger')(_0x2c9c('0x2'));var moment=require(_0x2c9c('0x3'));var BPromise=require(_0x2c9c('0x4'));var rp=require(_0x2c9c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c9c('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c9c('0x7'));module[_0x2c9c('0x8')]=function(_0x1abbf1,_0xd2bf79){return _0x1abbf1[_0x2c9c('0x9')](_0x2c9c('0xa'),attributes,{'tableName':_0x2c9c('0xb'),'paranoid':![],'indexes':[{'name':_0x2c9c('0xc'),'fields':[_0x2c9c('0xd'),_0x2c9c('0xe')]},{'name':_0x2c9c('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbdc1=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','api','moment'];(function(_0x5b9867,_0x5b4b22){var _0x3398ea=function(_0x3e82ce){while(--_0x3e82ce){_0x5b9867['push'](_0x5b9867['shift']());}};_0x3398ea(++_0x5b4b22);}(_0xbdc1,0x147));var _0x1bdc=function(_0x4969bf,_0x226ae8){_0x4969bf=_0x4969bf-0x0;var _0x4b0db4=_0xbdc1[_0x4969bf];return _0x4b0db4;};'use strict';var _=require('lodash');var util=require(_0x1bdc('0x0'));var logger=require('../../config/logger')(_0x1bdc('0x1'));var moment=require(_0x1bdc('0x2'));var BPromise=require(_0x1bdc('0x3'));var rp=require(_0x1bdc('0x4'));var fs=require('fs');var path=require(_0x1bdc('0x5'));var rimraf=require(_0x1bdc('0x6'));var config=require(_0x1bdc('0x7'));var attributes=require(_0x1bdc('0x8'));module['exports']=function(_0x39fe19,_0x9082e6){return _0x39fe19['define'](_0x1bdc('0x9'),attributes,{'tableName':_0x1bdc('0xa'),'paranoid':![],'indexes':[{'name':_0x1bdc('0xb'),'fields':[_0x1bdc('0xc'),_0x1bdc('0xd')]},{'name':_0x1bdc('0xe'),'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 e4c2c0a..7c8eba8 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 _0x8347=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','info','catch','SquareReport','create','body','options','raw','CreateSquareReport','update','where','attributes','limit','UpdateSquareReport','util','randomstring'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x8347,0x13e));var _0x7834=function(_0xc2617,_0x152b04){_0xc2617=_0xc2617-0x0;var _0x3c0e17=_0x8347[_0xc2617];return _0x3c0e17;};'use strict';var _=require('lodash');var util=require(_0x7834('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7834('0x1'));var fs=require('fs');var Redis=require(_0x7834('0x2'));var db=require(_0x7834('0x3'))['db'];var utils=require(_0x7834('0x4'));var logger=require(_0x7834('0x5'))(_0x7834('0x6'));var config=require(_0x7834('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7834('0x8')][_0x7834('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x272d1d,_0x32529a,_0x27b580){return new BPromise(function(_0xb8dadc,_0x2312aa){return client[_0x7834('0xa')](_0x272d1d,_0x27b580)[_0x7834('0xb')](function(_0x21b692){logger['info']('SquareReport,\x20%s,\x20%s',_0x32529a,'request\x20sent');logger[_0x7834('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x32529a,_0x7834('0xd'),JSON[_0x7834('0xe')](_0x21b692));if(_0x21b692[_0x7834('0xf')]){if(_0x21b692[_0x7834('0xf')][_0x7834('0x10')]===0x1f4){logger['error'](_0x7834('0x11'),_0x32529a,_0x21b692['error']['message']);return _0x2312aa(_0x21b692[_0x7834('0xf')]['message']);}logger['error'](_0x7834('0x11'),_0x32529a,_0x21b692['error'][_0x7834('0x12')]);return _0xb8dadc(_0x21b692['error'][_0x7834('0x12')]);}else{logger[_0x7834('0x13')](_0x7834('0x11'),_0x32529a,_0x7834('0xd'));_0xb8dadc(_0x21b692['result'][_0x7834('0x12')]);}})[_0x7834('0x14')](function(_0x1dad0e){logger[_0x7834('0xf')](_0x7834('0x11'),_0x32529a,_0x1dad0e);_0x2312aa(_0x1dad0e);});});}exports['CreateSquareReport']=function(_0x4bf0a3){var _0x182413=this;return new Promise(function(_0x1ae780,_0x396450){return db[_0x7834('0x15')][_0x7834('0x16')](_0x4bf0a3[_0x7834('0x17')],{'raw':_0x4bf0a3[_0x7834('0x18')]?_0x4bf0a3['options'][_0x7834('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x473db3){logger[_0x7834('0x13')]('CreateSquareReport',_0x4bf0a3);logger[_0x7834('0xc')](_0x7834('0x1a'),_0x4bf0a3,JSON['stringify'](_0x473db3));_0x1ae780(_0x473db3);})[_0x7834('0x14')](function(_0x2bb57e){logger[_0x7834('0xf')](_0x7834('0x1a'),_0x2bb57e['message'],_0x4bf0a3);_0x396450(_0x182413[_0x7834('0xf')](0x1f4,_0x2bb57e[_0x7834('0x12')]));});});};exports['UpdateSquareReport']=function(_0xe80617){var _0x8e56ca=this;return new Promise(function(_0x75813a,_0x3cac6b){return db[_0x7834('0x15')][_0x7834('0x1b')](_0xe80617[_0x7834('0x17')],{'raw':_0xe80617[_0x7834('0x18')]?_0xe80617[_0x7834('0x18')][_0x7834('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe80617[_0x7834('0x18')]?_0xe80617[_0x7834('0x18')][_0x7834('0x1c')]||null:null,'attributes':_0xe80617[_0x7834('0x18')]?_0xe80617[_0x7834('0x18')][_0x7834('0x1d')]||null:null,'limit':_0xe80617[_0x7834('0x18')]?_0xe80617[_0x7834('0x18')][_0x7834('0x1e')]||null:null})['then'](function(_0x366f9e){logger[_0x7834('0x13')](_0x7834('0x1f'),_0xe80617);logger[_0x7834('0xc')]('UpdateSquareReport',_0xe80617,JSON[_0x7834('0xe')](_0x366f9e));_0x75813a(_0x366f9e);})['catch'](function(_0x179b36){logger[_0x7834('0xf')](_0x7834('0x1f'),_0x179b36[_0x7834('0x12')],_0xe80617);_0x3cac6b(_0x8e56ca['error'](0x1f4,_0x179b36['message']));});});}; \ No newline at end of file +var _0x2ce7=['util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','SquareReport','create','options','raw','debug','UpdateSquareReport','update','body','where','attributes','limit','lodash'];(function(_0x20dda3,_0x5e8a1c){var _0x527d4a=function(_0xe69ed1){while(--_0xe69ed1){_0x20dda3['push'](_0x20dda3['shift']());}};_0x527d4a(++_0x5e8a1c);}(_0x2ce7,0x13f));var _0x72ce=function(_0x324738,_0x134be8){_0x324738=_0x324738-0x0;var _0x212a4d=_0x2ce7[_0x324738];return _0x212a4d;};'use strict';var _=require(_0x72ce('0x0'));var util=require(_0x72ce('0x1'));var moment=require(_0x72ce('0x2'));var BPromise=require(_0x72ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x72ce('0x4'));var logger=require(_0x72ce('0x5'))(_0x72ce('0x6'));var config=require(_0x72ce('0x7'));var jayson=require(_0x72ce('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ec74f,_0x575fe5,_0x55bd3e){return new BPromise(function(_0x280e15,_0x38426f){return client[_0x72ce('0x9')](_0x3ec74f,_0x55bd3e)[_0x72ce('0xa')](function(_0x43ee1d){logger[_0x72ce('0xb')]('SquareReport,\x20%s,\x20%s',_0x575fe5,_0x72ce('0xc'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x575fe5,_0x72ce('0xc'),JSON[_0x72ce('0xd')](_0x43ee1d));if(_0x43ee1d['error']){if(_0x43ee1d[_0x72ce('0xe')][_0x72ce('0xf')]===0x1f4){logger[_0x72ce('0xe')]('SquareReport,\x20%s,\x20%s',_0x575fe5,_0x43ee1d[_0x72ce('0xe')][_0x72ce('0x10')]);return _0x38426f(_0x43ee1d['error'][_0x72ce('0x10')]);}logger[_0x72ce('0xe')](_0x72ce('0x11'),_0x575fe5,_0x43ee1d['error'][_0x72ce('0x10')]);return _0x280e15(_0x43ee1d[_0x72ce('0xe')][_0x72ce('0x10')]);}else{logger['info'](_0x72ce('0x11'),_0x575fe5,'request\x20sent');_0x280e15(_0x43ee1d[_0x72ce('0x12')][_0x72ce('0x10')]);}})[_0x72ce('0x13')](function(_0x3f500f){logger[_0x72ce('0xe')](_0x72ce('0x11'),_0x575fe5,_0x3f500f);_0x38426f(_0x3f500f);});});}exports[_0x72ce('0x14')]=function(_0x2c1a4c){var _0x28330f=this;return new Promise(function(_0x1f6ec9,_0x54bb4c){return db[_0x72ce('0x15')][_0x72ce('0x16')](_0x2c1a4c['body'],{'raw':_0x2c1a4c[_0x72ce('0x17')]?_0x2c1a4c[_0x72ce('0x17')][_0x72ce('0x18')]===undefined?!![]:![]:!![]})[_0x72ce('0xa')](function(_0x270ad8){logger[_0x72ce('0xb')](_0x72ce('0x14'),_0x2c1a4c);logger[_0x72ce('0x19')]('CreateSquareReport',_0x2c1a4c,JSON[_0x72ce('0xd')](_0x270ad8));_0x1f6ec9(_0x270ad8);})[_0x72ce('0x13')](function(_0x22dba2){logger[_0x72ce('0xe')](_0x72ce('0x14'),_0x22dba2['message'],_0x2c1a4c);_0x54bb4c(_0x28330f[_0x72ce('0xe')](0x1f4,_0x22dba2[_0x72ce('0x10')]));});});};exports[_0x72ce('0x1a')]=function(_0xa9797a){var _0x252662=this;return new Promise(function(_0x160d8a,_0x27c5ff){return db[_0x72ce('0x15')][_0x72ce('0x1b')](_0xa9797a[_0x72ce('0x1c')],{'raw':_0xa9797a[_0x72ce('0x17')]?_0xa9797a[_0x72ce('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa9797a[_0x72ce('0x17')]?_0xa9797a[_0x72ce('0x17')][_0x72ce('0x1d')]||null:null,'attributes':_0xa9797a[_0x72ce('0x17')]?_0xa9797a['options'][_0x72ce('0x1e')]||null:null,'limit':_0xa9797a[_0x72ce('0x17')]?_0xa9797a[_0x72ce('0x17')][_0x72ce('0x1f')]||null:null})[_0x72ce('0xa')](function(_0x4a8e0d){logger['info'](_0x72ce('0x1a'),_0xa9797a);logger[_0x72ce('0x19')](_0x72ce('0x1a'),_0xa9797a,JSON[_0x72ce('0xd')](_0x4a8e0d));_0x160d8a(_0x4a8e0d);})['catch'](function(_0x4e0652){logger[_0x72ce('0xe')](_0x72ce('0x1a'),_0x4e0652['message'],_0xa9797a);_0x27c5ff(_0x252662['error'](0x1f4,_0x4e0652[_0x72ce('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 2e5af47..dcac7c2 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 _0x7e79=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','destroy'];(function(_0xdb249f,_0x6e4566){var _0xa5835b=function(_0x2fb65c){while(--_0x2fb65c){_0xdb249f['push'](_0xdb249f['shift']());}};_0xa5835b(++_0x6e4566);}(_0x7e79,0xdd));var _0x97e7=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7e79[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x97e7('0x0'));var util=require('util');var path=require(_0x97e7('0x1'));var timeout=require(_0x97e7('0x2'));var express=require(_0x97e7('0x3'));var router=express['Router']();var fs_extra=require(_0x97e7('0x4'));var auth=require(_0x97e7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x97e7('0x6'));var controller=require(_0x97e7('0x7'));router[_0x97e7('0x8')]('/',auth[_0x97e7('0x9')](),controller[_0x97e7('0xa')]);router[_0x97e7('0x8')](_0x97e7('0xb'),auth['isAuthenticated'](),controller[_0x97e7('0xc')]);router[_0x97e7('0x8')]('/:id',auth[_0x97e7('0x9')](),controller[_0x97e7('0xd')]);router[_0x97e7('0xe')]('/',auth[_0x97e7('0x9')](),controller['create']);router[_0x97e7('0xf')](_0x97e7('0x10'),auth[_0x97e7('0x9')](),controller[_0x97e7('0x11')]);router['delete'](_0x97e7('0x10'),auth[_0x97e7('0x9')](),controller[_0x97e7('0x12')]);module[_0x97e7('0x13')]=router; \ No newline at end of file +var _0x8947=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','/:id','post','create','put','delete','destroy'];(function(_0x17d34b,_0x21209e){var _0x19e1ab=function(_0x2fc9ae){while(--_0x2fc9ae){_0x17d34b['push'](_0x17d34b['shift']());}};_0x19e1ab(++_0x21209e);}(_0x8947,0x19f));var _0x7894=function(_0x10bde1,_0x2bb5fe){_0x10bde1=_0x10bde1-0x0;var _0x49d844=_0x8947[_0x10bde1];return _0x49d844;};'use strict';var multer=require(_0x7894('0x0'));var util=require(_0x7894('0x1'));var path=require('path');var timeout=require(_0x7894('0x2'));var express=require(_0x7894('0x3'));var router=express[_0x7894('0x4')]();var fs_extra=require(_0x7894('0x5'));var auth=require(_0x7894('0x6'));var interaction=require(_0x7894('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7894('0x8')]);router[_0x7894('0x9')]('/describe',auth[_0x7894('0xa')](),controller['describe']);router[_0x7894('0x9')](_0x7894('0xb'),auth[_0x7894('0xa')](),controller['show']);router[_0x7894('0xc')]('/',auth[_0x7894('0xa')](),controller[_0x7894('0xd')]);router[_0x7894('0xe')](_0x7894('0xb'),auth[_0x7894('0xa')](),controller['update']);router[_0x7894('0xf')]('/:id',auth[_0x7894('0xa')](),controller[_0x7894('0x10')]);module[_0x7894('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4b98c69..2455f4a 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 _0x9116=['sequelize','exports','STRING','TEXT'];(function(_0x3d553c,_0x3a0694){var _0x28f764=function(_0x15a643){while(--_0x15a643){_0x3d553c['push'](_0x3d553c['shift']());}};_0x28f764(++_0x3a0694);}(_0x9116,0x114));var _0x6911=function(_0x23d160,_0x15e4dc){_0x23d160=_0x23d160-0x0;var _0x5df430=_0x9116[_0x23d160];return _0x5df430;};'use strict';var Sequelize=require(_0x6911('0x0'));module[_0x6911('0x1')]={'uniqueid':{'type':Sequelize[_0x6911('0x2')]},'node':{'type':Sequelize[_0x6911('0x2')]},'application':{'type':Sequelize[_0x6911('0x2')]},'data':{'type':Sequelize[_0x6911('0x3')]},'project_name':{'type':Sequelize[_0x6911('0x2')]},'callerid':{'type':Sequelize[_0x6911('0x2')]}}; \ No newline at end of file +var _0xbe39=['sequelize','STRING'];(function(_0x551fb0,_0x4b9433){var _0x497492=function(_0x3d2a2b){while(--_0x3d2a2b){_0x551fb0['push'](_0x551fb0['shift']());}};_0x497492(++_0x4b9433);}(_0xbe39,0xee));var _0x9be3=function(_0x49c7b6,_0x1a8e76){_0x49c7b6=_0x49c7b6-0x0;var _0x3c8d3d=_0xbe39[_0x49c7b6];return _0x3c8d3d;};'use strict';var Sequelize=require(_0x9be3('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9be3('0x1')]},'node':{'type':Sequelize[_0x9be3('0x1')]},'application':{'type':Sequelize[_0x9be3('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x9be3('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 e63bbf1..6451284 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 _0xe5a4=['fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','send','index','map','SquareDetailsReport','rawAttributes','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xe5a4,0xd8));var _0x4e5a=function(_0x28c7ac,_0x22173d){_0x28c7ac=_0x28c7ac-0x0;var _0x47fcfa=_0xe5a4[_0x28c7ac];return _0x47fcfa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e5a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e5a('0x1'));var moment=require(_0x4e5a('0x2'));var BPromise=require(_0x4e5a('0x3'));var Mustache=require(_0x4e5a('0x4'));var util=require(_0x4e5a('0x5'));var path=require(_0x4e5a('0x6'));var sox=require(_0x4e5a('0x7'));var csv=require('to-csv');var ejs=require(_0x4e5a('0x8'));var fs=require('fs');var fs_extra=require(_0x4e5a('0x9'));var _=require(_0x4e5a('0xa'));var squel=require(_0x4e5a('0xb'));var crypto=require('crypto');var jsforce=require(_0x4e5a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4e5a('0xd'));var querystring=require(_0x4e5a('0xe'));var Papa=require(_0x4e5a('0xf'));var Redis=require(_0x4e5a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4e5a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e5a('0x12'));var logger=require(_0x4e5a('0x13'))('api');var utils=require(_0x4e5a('0x14'));var config=require(_0x4e5a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e5a('0x16'))['db'];function respondWithStatusCode(_0x9bdb54,_0x1e433a){_0x1e433a=_0x1e433a||0xcc;return function(_0x24add5){if(_0x24add5){return _0x9bdb54[_0x4e5a('0x17')](_0x1e433a);}return _0x9bdb54[_0x4e5a('0x18')](_0x1e433a)[_0x4e5a('0x19')]();};}function respondWithResult(_0x3ed304,_0x3b1eb4){_0x3b1eb4=_0x3b1eb4||0xc8;return function(_0x3ba5e8){if(_0x3ba5e8){return _0x3ed304[_0x4e5a('0x18')](_0x3b1eb4)[_0x4e5a('0x1a')](_0x3ba5e8);}};}function respondWithFilteredResult(_0x5bbb84,_0x164650){return function(_0x25ec93){if(_0x25ec93){var _0x206952=typeof _0x164650[_0x4e5a('0x1b')]===_0x4e5a('0x1c')&&typeof _0x164650[_0x4e5a('0x1d')]===_0x4e5a('0x1c');var _0x78e1e6=_0x25ec93['count'];var _0x2a58fb=_0x206952?0x0:_0x164650['offset'];var _0x1a4d37=_0x206952?_0x25ec93[_0x4e5a('0x1e')]:_0x164650['offset']+_0x164650[_0x4e5a('0x1d')];var _0x6583a6;if(_0x1a4d37>=_0x78e1e6){_0x1a4d37=_0x78e1e6;_0x6583a6=0xc8;}else{_0x6583a6=0xce;}_0x5bbb84[_0x4e5a('0x18')](_0x6583a6);return _0x5bbb84[_0x4e5a('0x1f')](_0x4e5a('0x20'),_0x2a58fb+'-'+_0x1a4d37+'/'+_0x78e1e6)['json'](_0x25ec93);}return null;};}function patchUpdates(_0x3cd2ca){return function(_0x3e1f2c){try{jsonpatch[_0x4e5a('0x21')](_0x3e1f2c,_0x3cd2ca,!![]);}catch(_0x462aad){return BPromise['reject'](_0x462aad);}return _0x3e1f2c['save']();};}function saveUpdates(_0x578846,_0x1203fa){return function(_0x379eb5){if(_0x379eb5){return _0x379eb5[_0x4e5a('0x22')](_0x578846)[_0x4e5a('0x23')](function(_0x305863){return _0x305863;});}return null;};}function removeEntity(_0x648d8c,_0x1fef92){return function(_0x4fe96e){if(_0x4fe96e){return _0x4fe96e[_0x4e5a('0x24')]()[_0x4e5a('0x23')](function(){_0x648d8c[_0x4e5a('0x18')](0xcc)[_0x4e5a('0x19')]();});}};}function handleEntityNotFound(_0x3765b6,_0x315494){return function(_0x27b338){if(!_0x27b338){_0x3765b6[_0x4e5a('0x17')](0x194);}return _0x27b338;};}function handleError(_0x46ccea,_0x90822a){_0x90822a=_0x90822a||0x1f4;return function(_0x69b0fb){logger[_0x4e5a('0x25')](_0x69b0fb[_0x4e5a('0x26')]);if(_0x69b0fb['name']){delete _0x69b0fb['name'];}_0x46ccea[_0x4e5a('0x18')](_0x90822a)[_0x4e5a('0x27')](_0x69b0fb);};}exports[_0x4e5a('0x28')]=function(_0x360b33,_0x511edb){var _0x1292ad={},_0x1d3b87={},_0x400e14={'count':0x0,'rows':[]};var _0x17a80b=_[_0x4e5a('0x29')](db[_0x4e5a('0x2a')][_0x4e5a('0x2b')],function(_0x2e4719){return{'name':_0x2e4719['fieldName'],'type':_0x2e4719['type'][_0x4e5a('0x2c')]};});_0x1d3b87['model']=_[_0x4e5a('0x29')](_0x17a80b,'name');_0x1d3b87[_0x4e5a('0x2d')]=_['keys'](_0x360b33[_0x4e5a('0x2d')]);_0x1d3b87[_0x4e5a('0x2e')]=_['intersection'](_0x1d3b87[_0x4e5a('0x2f')],_0x1d3b87[_0x4e5a('0x2d')]);_0x1292ad['attributes']=_[_0x4e5a('0x30')](_0x1d3b87[_0x4e5a('0x2f')],qs[_0x4e5a('0x31')](_0x360b33[_0x4e5a('0x2d')][_0x4e5a('0x31')]));_0x1292ad[_0x4e5a('0x32')]=_0x1292ad[_0x4e5a('0x32')][_0x4e5a('0x33')]?_0x1292ad[_0x4e5a('0x32')]:_0x1d3b87['model'];if(!_0x360b33['query'][_0x4e5a('0x34')]('nolimit')){_0x1292ad['limit']=qs[_0x4e5a('0x1d')](_0x360b33[_0x4e5a('0x2d')][_0x4e5a('0x1d')]);_0x1292ad[_0x4e5a('0x1b')]=qs[_0x4e5a('0x1b')](_0x360b33[_0x4e5a('0x2d')][_0x4e5a('0x1b')]);}_0x1292ad[_0x4e5a('0x35')]=qs[_0x4e5a('0x36')](_0x360b33[_0x4e5a('0x2d')][_0x4e5a('0x36')]);_0x1292ad[_0x4e5a('0x37')]=qs['filters'](_[_0x4e5a('0x38')](_0x360b33[_0x4e5a('0x2d')],_0x1d3b87[_0x4e5a('0x2e')]),_0x17a80b);if(_0x360b33[_0x4e5a('0x2d')][_0x4e5a('0x39')]){_0x1292ad[_0x4e5a('0x37')]=_['merge'](_0x1292ad[_0x4e5a('0x37')],{'$or':_['map'](_0x17a80b,function(_0x5b7fe8){if(_0x5b7fe8[_0x4e5a('0x3a')]!==_0x4e5a('0x3b')){var _0x1b9ba7={};_0x1b9ba7[_0x5b7fe8[_0x4e5a('0x3c')]]={'$like':'%'+_0x360b33['query'][_0x4e5a('0x39')]+'%'};return _0x1b9ba7;}})});}_0x1292ad=_[_0x4e5a('0x3d')]({},_0x1292ad,_0x360b33[_0x4e5a('0x3e')]);var _0xaf1d8b={'where':_0x1292ad[_0x4e5a('0x37')]};return db[_0x4e5a('0x2a')][_0x4e5a('0x1e')](_0xaf1d8b)[_0x4e5a('0x23')](function(_0x275e63){_0x400e14[_0x4e5a('0x1e')]=_0x275e63;if(_0x360b33[_0x4e5a('0x2d')][_0x4e5a('0x3f')]){_0x1292ad[_0x4e5a('0x40')]=[{'all':!![]}];}return db[_0x4e5a('0x2a')][_0x4e5a('0x41')](_0x1292ad);})[_0x4e5a('0x23')](function(_0x132623){_0x400e14[_0x4e5a('0x42')]=_0x132623;return _0x400e14;})[_0x4e5a('0x23')](respondWithFilteredResult(_0x511edb,_0x1292ad))['catch'](handleError(_0x511edb,null));};exports[_0x4e5a('0x43')]=function(_0x2d258a,_0x26f923){var _0x51943e={'raw':!![],'where':{'id':_0x2d258a[_0x4e5a('0x44')]['id']}},_0xae3e86={};_0xae3e86[_0x4e5a('0x2f')]=_[_0x4e5a('0x45')](db[_0x4e5a('0x2a')][_0x4e5a('0x2b')]);_0xae3e86[_0x4e5a('0x2d')]=_[_0x4e5a('0x45')](_0x2d258a[_0x4e5a('0x2d')]);_0xae3e86[_0x4e5a('0x2e')]=_[_0x4e5a('0x30')](_0xae3e86['model'],_0xae3e86[_0x4e5a('0x2d')]);_0x51943e[_0x4e5a('0x32')]=_[_0x4e5a('0x30')](_0xae3e86['model'],qs[_0x4e5a('0x31')](_0x2d258a[_0x4e5a('0x2d')][_0x4e5a('0x31')]));_0x51943e[_0x4e5a('0x32')]=_0x51943e['attributes'][_0x4e5a('0x33')]?_0x51943e[_0x4e5a('0x32')]:_0xae3e86[_0x4e5a('0x2f')];if(_0x2d258a[_0x4e5a('0x2d')]['includeAll']){_0x51943e['include']=[{'all':!![]}];}_0x51943e=_['merge']({},_0x51943e,_0x2d258a[_0x4e5a('0x3e')]);return db[_0x4e5a('0x2a')][_0x4e5a('0x46')](_0x51943e)['then'](handleEntityNotFound(_0x26f923,null))['then'](respondWithResult(_0x26f923,null))[_0x4e5a('0x47')](handleError(_0x26f923,null));};exports[_0x4e5a('0x48')]=function(_0x37101f,_0x39cc50){return db[_0x4e5a('0x2a')][_0x4e5a('0x48')](_0x37101f[_0x4e5a('0x49')],{})[_0x4e5a('0x23')](respondWithResult(_0x39cc50,0xc9))[_0x4e5a('0x47')](handleError(_0x39cc50,null));};exports[_0x4e5a('0x22')]=function(_0x6fe65a,_0x133f51){if(_0x6fe65a[_0x4e5a('0x49')]['id']){delete _0x6fe65a[_0x4e5a('0x49')]['id'];}return db[_0x4e5a('0x2a')][_0x4e5a('0x46')]({'where':{'id':_0x6fe65a[_0x4e5a('0x44')]['id']}})[_0x4e5a('0x23')](handleEntityNotFound(_0x133f51,null))['then'](saveUpdates(_0x6fe65a['body'],null))['then'](respondWithResult(_0x133f51,null))['catch'](handleError(_0x133f51,null));};exports[_0x4e5a('0x24')]=function(_0x51ca51,_0x58e385){return db['SquareDetailsReport'][_0x4e5a('0x46')]({'where':{'id':_0x51ca51['params']['id']}})['then'](handleEntityNotFound(_0x58e385,null))[_0x4e5a('0x23')](removeEntity(_0x58e385,null))[_0x4e5a('0x47')](handleError(_0x58e385,null));};exports[_0x4e5a('0x4a')]=function(_0x5c1c7b,_0x48e5c0){return db[_0x4e5a('0x2a')][_0x4e5a('0x4a')]()[_0x4e5a('0x23')](respondWithResult(_0x48e5c0,null))[_0x4e5a('0x47')](handleError(_0x48e5c0,null));}; \ No newline at end of file +var _0xc83c=['rawAttributes','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','catch','show','params','keys'];(function(_0x31b506,_0x41f951){var _0x32316f=function(_0x1e04d7){while(--_0x1e04d7){_0x31b506['push'](_0x31b506['shift']());}};_0x32316f(++_0x41f951);}(_0xc83c,0x178));var _0xcc83=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc83c[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0xcc83('0x0'));var rimraf=require(_0xcc83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc83('0x2'));var rp=require(_0xcc83('0x3'));var moment=require(_0xcc83('0x4'));var BPromise=require(_0xcc83('0x5'));var Mustache=require(_0xcc83('0x6'));var util=require(_0xcc83('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcc83('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc83('0x9'));var _=require(_0xcc83('0xa'));var squel=require(_0xcc83('0xb'));var crypto=require(_0xcc83('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcc83('0x8'));var querystring=require('querystring');var Papa=require(_0xcc83('0xd'));var Redis=require(_0xcc83('0xe'));var authService=require(_0xcc83('0xf'));var qs=require(_0xcc83('0x10'));var as=require(_0xcc83('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc83('0x12'))(_0xcc83('0x13'));var utils=require('../../config/utils');var config=require(_0xcc83('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc83('0x15'))['db'];function respondWithStatusCode(_0x4f56bd,_0x5e1a3e){_0x5e1a3e=_0x5e1a3e||0xcc;return function(_0x330e05){if(_0x330e05){return _0x4f56bd[_0xcc83('0x16')](_0x5e1a3e);}return _0x4f56bd['status'](_0x5e1a3e)[_0xcc83('0x17')]();};}function respondWithResult(_0x2398bb,_0x419f30){_0x419f30=_0x419f30||0xc8;return function(_0x18c0f7){if(_0x18c0f7){return _0x2398bb['status'](_0x419f30)[_0xcc83('0x18')](_0x18c0f7);}};}function respondWithFilteredResult(_0x4c8fec,_0x316c79){return function(_0x4232b0){if(_0x4232b0){var _0x1d4bce=typeof _0x316c79['offset']===_0xcc83('0x19')&&typeof _0x316c79[_0xcc83('0x1a')]===_0xcc83('0x19');var _0x4b16cc=_0x4232b0[_0xcc83('0x1b')];var _0x22b305=_0x1d4bce?0x0:_0x316c79[_0xcc83('0x1c')];var _0x5b9711=_0x1d4bce?_0x4232b0['count']:_0x316c79[_0xcc83('0x1c')]+_0x316c79['limit'];var _0x3c7b26;if(_0x5b9711>=_0x4b16cc){_0x5b9711=_0x4b16cc;_0x3c7b26=0xc8;}else{_0x3c7b26=0xce;}_0x4c8fec[_0xcc83('0x1d')](_0x3c7b26);return _0x4c8fec[_0xcc83('0x1e')](_0xcc83('0x1f'),_0x22b305+'-'+_0x5b9711+'/'+_0x4b16cc)['json'](_0x4232b0);}return null;};}function patchUpdates(_0x588332){return function(_0x6d1290){try{jsonpatch[_0xcc83('0x20')](_0x6d1290,_0x588332,!![]);}catch(_0x342de7){return BPromise[_0xcc83('0x21')](_0x342de7);}return _0x6d1290[_0xcc83('0x22')]();};}function saveUpdates(_0x408b22,_0x33cac0){return function(_0x1d0491){if(_0x1d0491){return _0x1d0491['update'](_0x408b22)[_0xcc83('0x23')](function(_0x3f8484){return _0x3f8484;});}return null;};}function removeEntity(_0x3f4fcf,_0x94ebdb){return function(_0x49a906){if(_0x49a906){return _0x49a906[_0xcc83('0x24')]()['then'](function(){_0x3f4fcf['status'](0xcc)[_0xcc83('0x17')]();});}};}function handleEntityNotFound(_0x439fa4,_0x1e5ae8){return function(_0x11393e){if(!_0x11393e){_0x439fa4[_0xcc83('0x16')](0x194);}return _0x11393e;};}function handleError(_0x3bd5cf,_0x17fe2f){_0x17fe2f=_0x17fe2f||0x1f4;return function(_0x2eefc2){logger[_0xcc83('0x25')](_0x2eefc2[_0xcc83('0x26')]);if(_0x2eefc2[_0xcc83('0x27')]){delete _0x2eefc2[_0xcc83('0x27')];}_0x3bd5cf[_0xcc83('0x1d')](_0x17fe2f)['send'](_0x2eefc2);};}exports[_0xcc83('0x28')]=function(_0x292860,_0x5e37f1){var _0x3971f8={},_0x544b1e={},_0x433a9c={'count':0x0,'rows':[]};var _0x9619a=_[_0xcc83('0x29')](db['SquareDetailsReport']['rawAttributes'],function(_0x62e744){return{'name':_0x62e744[_0xcc83('0x2a')],'type':_0x62e744['type']['key']};});_0x544b1e[_0xcc83('0x2b')]=_[_0xcc83('0x29')](_0x9619a,_0xcc83('0x27'));_0x544b1e[_0xcc83('0x2c')]=_['keys'](_0x292860[_0xcc83('0x2c')]);_0x544b1e['filters']=_[_0xcc83('0x2d')](_0x544b1e[_0xcc83('0x2b')],_0x544b1e[_0xcc83('0x2c')]);_0x3971f8[_0xcc83('0x2e')]=_[_0xcc83('0x2d')](_0x544b1e['model'],qs[_0xcc83('0x2f')](_0x292860[_0xcc83('0x2c')][_0xcc83('0x2f')]));_0x3971f8[_0xcc83('0x2e')]=_0x3971f8['attributes'][_0xcc83('0x30')]?_0x3971f8[_0xcc83('0x2e')]:_0x544b1e[_0xcc83('0x2b')];if(!_0x292860[_0xcc83('0x2c')][_0xcc83('0x31')]('nolimit')){_0x3971f8[_0xcc83('0x1a')]=qs[_0xcc83('0x1a')](_0x292860[_0xcc83('0x2c')]['limit']);_0x3971f8[_0xcc83('0x1c')]=qs[_0xcc83('0x1c')](_0x292860[_0xcc83('0x2c')][_0xcc83('0x1c')]);}_0x3971f8[_0xcc83('0x32')]=qs[_0xcc83('0x33')](_0x292860[_0xcc83('0x2c')][_0xcc83('0x33')]);_0x3971f8[_0xcc83('0x34')]=qs[_0xcc83('0x35')](_[_0xcc83('0x36')](_0x292860[_0xcc83('0x2c')],_0x544b1e[_0xcc83('0x35')]),_0x9619a);if(_0x292860[_0xcc83('0x2c')][_0xcc83('0x37')]){_0x3971f8[_0xcc83('0x34')]=_[_0xcc83('0x38')](_0x3971f8[_0xcc83('0x34')],{'$or':_['map'](_0x9619a,function(_0x12c0a7){if(_0x12c0a7[_0xcc83('0x39')]!==_0xcc83('0x3a')){var _0x6b1db9={};_0x6b1db9[_0x12c0a7['name']]={'$like':'%'+_0x292860[_0xcc83('0x2c')]['filter']+'%'};return _0x6b1db9;}})});}_0x3971f8=_[_0xcc83('0x38')]({},_0x3971f8,_0x292860[_0xcc83('0x3b')]);var _0x398ada={'where':_0x3971f8[_0xcc83('0x34')]};return db[_0xcc83('0x3c')][_0xcc83('0x1b')](_0x398ada)[_0xcc83('0x23')](function(_0x5b52fa){_0x433a9c[_0xcc83('0x1b')]=_0x5b52fa;if(_0x292860[_0xcc83('0x2c')][_0xcc83('0x3d')]){_0x3971f8[_0xcc83('0x3e')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xcc83('0x3f')](_0x3971f8);})[_0xcc83('0x23')](function(_0x3c94f5){_0x433a9c['rows']=_0x3c94f5;return _0x433a9c;})[_0xcc83('0x23')](respondWithFilteredResult(_0x5e37f1,_0x3971f8))[_0xcc83('0x40')](handleError(_0x5e37f1,null));};exports[_0xcc83('0x41')]=function(_0x73b723,_0x84a3c8){var _0x3345c5={'raw':!![],'where':{'id':_0x73b723[_0xcc83('0x42')]['id']}},_0x381ba8={};_0x381ba8[_0xcc83('0x2b')]=_[_0xcc83('0x43')](db[_0xcc83('0x3c')][_0xcc83('0x44')]);_0x381ba8[_0xcc83('0x2c')]=_[_0xcc83('0x43')](_0x73b723[_0xcc83('0x2c')]);_0x381ba8[_0xcc83('0x35')]=_[_0xcc83('0x2d')](_0x381ba8[_0xcc83('0x2b')],_0x381ba8[_0xcc83('0x2c')]);_0x3345c5[_0xcc83('0x2e')]=_[_0xcc83('0x2d')](_0x381ba8[_0xcc83('0x2b')],qs[_0xcc83('0x2f')](_0x73b723['query'][_0xcc83('0x2f')]));_0x3345c5[_0xcc83('0x2e')]=_0x3345c5['attributes']['length']?_0x3345c5[_0xcc83('0x2e')]:_0x381ba8[_0xcc83('0x2b')];if(_0x73b723['query'][_0xcc83('0x3d')]){_0x3345c5[_0xcc83('0x3e')]=[{'all':!![]}];}_0x3345c5=_['merge']({},_0x3345c5,_0x73b723[_0xcc83('0x3b')]);return db[_0xcc83('0x3c')][_0xcc83('0x45')](_0x3345c5)[_0xcc83('0x23')](handleEntityNotFound(_0x84a3c8,null))['then'](respondWithResult(_0x84a3c8,null))[_0xcc83('0x40')](handleError(_0x84a3c8,null));};exports[_0xcc83('0x46')]=function(_0x1f40a9,_0x46c2cb){return db[_0xcc83('0x3c')][_0xcc83('0x46')](_0x1f40a9[_0xcc83('0x47')],{})['then'](respondWithResult(_0x46c2cb,0xc9))['catch'](handleError(_0x46c2cb,null));};exports[_0xcc83('0x48')]=function(_0x42b078,_0x332f58){if(_0x42b078[_0xcc83('0x47')]['id']){delete _0x42b078['body']['id'];}return db[_0xcc83('0x3c')][_0xcc83('0x45')]({'where':{'id':_0x42b078[_0xcc83('0x42')]['id']}})[_0xcc83('0x23')](handleEntityNotFound(_0x332f58,null))[_0xcc83('0x23')](saveUpdates(_0x42b078['body'],null))[_0xcc83('0x23')](respondWithResult(_0x332f58,null))[_0xcc83('0x40')](handleError(_0x332f58,null));};exports[_0xcc83('0x24')]=function(_0x5ccfa1,_0x38d319){return db[_0xcc83('0x3c')][_0xcc83('0x45')]({'where':{'id':_0x5ccfa1['params']['id']}})[_0xcc83('0x23')](handleEntityNotFound(_0x38d319,null))[_0xcc83('0x23')](removeEntity(_0x38d319,null))[_0xcc83('0x40')](handleError(_0x38d319,null));};exports[_0xcc83('0x49')]=function(_0x12edac,_0x16e1ad){return db[_0xcc83('0x3c')]['describe']()[_0xcc83('0x23')](respondWithResult(_0x16e1ad,null))[_0xcc83('0x40')](handleError(_0x16e1ad,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 2836494..fe0fcbd 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 _0x4fca=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','SquareDetailsReport','report_square_details'];(function(_0x757920,_0x2d78ac){var _0x18c4da=function(_0x1cdb51){while(--_0x1cdb51){_0x757920['push'](_0x757920['shift']());}};_0x18c4da(++_0x2d78ac);}(_0x4fca,0xa8));var _0xa4fc=function(_0x30192c,_0x30db66){_0x30192c=_0x30192c-0x0;var _0x347c48=_0x4fca[_0x30192c];return _0x347c48;};'use strict';var _=require(_0xa4fc('0x0'));var util=require(_0xa4fc('0x1'));var logger=require(_0xa4fc('0x2'))('api');var moment=require(_0xa4fc('0x3'));var BPromise=require(_0xa4fc('0x4'));var rp=require(_0xa4fc('0x5'));var fs=require('fs');var path=require(_0xa4fc('0x6'));var rimraf=require(_0xa4fc('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0xa4fc('0x8')]=function(_0x2db2c0,_0x30f480){return _0x2db2c0[_0xa4fc('0x9')](_0xa4fc('0xa'),attributes,{'tableName':_0xa4fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd67b=['api','moment','bluebird','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x47a024,_0x15f5c4){var _0x17a041=function(_0xc9c5b5){while(--_0xc9c5b5){_0x47a024['push'](_0x47a024['shift']());}};_0x17a041(++_0x15f5c4);}(_0xd67b,0x1a7));var _0xbd67=function(_0x3097ad,_0x393e24){_0x3097ad=_0x3097ad-0x0;var _0x3521bc=_0xd67b[_0x3097ad];return _0x3521bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbd67('0x0'));var moment=require(_0xbd67('0x1'));var BPromise=require(_0xbd67('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x3'));var rimraf=require(_0xbd67('0x4'));var config=require('../../config/environment');var attributes=require(_0xbd67('0x5'));module[_0xbd67('0x6')]=function(_0x14372d,_0x535335){return _0x14372d[_0xbd67('0x7')](_0xbd67('0x8'),attributes,{'tableName':'report_square_details','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 bade067..447513b 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 _0xbbbc=['options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','CreateSquareDetailsReport','create','body'];(function(_0x5a6403,_0x38cf56){var _0x21e5bf=function(_0x19f704){while(--_0x19f704){_0x5a6403['push'](_0x5a6403['shift']());}};_0x21e5bf(++_0x38cf56);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x116dc4,_0x30994c){_0x116dc4=_0x116dc4-0x0;var _0x2619f3=_0xbbbc[_0x116dc4];return _0x2619f3;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['SquareDetailsReport'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![]})[_0xcbbb('0xd')](function(_0x45de5f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')]('CreateSquareDetailsReport',_0x3436af,JSON[_0xcbbb('0x1a')](_0x45de5f));_0x5052df(_0x45de5f);})[_0xcbbb('0x14')](function(_0x159c62){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x159c62[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x159c62[_0xcbbb('0x12')]));});});}; \ No newline at end of file +var _0x235b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','lodash'];(function(_0x45d414,_0x5ca27b){var _0x4dc948=function(_0x4dd43e){while(--_0x4dd43e){_0x45d414['push'](_0x45d414['shift']());}};_0x4dc948(++_0x5ca27b);}(_0x235b,0x1ed));var _0xb235=function(_0x58d580,_0x4c8f86){_0x58d580=_0x58d580-0x0;var _0x3c096c=_0x235b[_0x58d580];return _0x3c096c;};'use strict';var _=require(_0xb235('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb235('0x1'));var rs=require(_0xb235('0x2'));var fs=require('fs');var Redis=require(_0xb235('0x3'));var db=require(_0xb235('0x4'))['db'];var utils=require(_0xb235('0x5'));var logger=require(_0xb235('0x6'))('rpc');var config=require(_0xb235('0x7'));var jayson=require(_0xb235('0x8'));var client=jayson[_0xb235('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d0ae,_0x44559a,_0x2affe8){return new BPromise(function(_0x436d63,_0x3241b4){return client['request'](_0x12d0ae,_0x2affe8)['then'](function(_0xecf759){logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));logger[_0xb235('0xd')](_0xb235('0xe'),_0x44559a,_0xb235('0xc'),JSON[_0xb235('0xf')](_0xecf759));if(_0xecf759['error']){if(_0xecf759[_0xb235('0x10')][_0xb235('0x11')]===0x1f4){logger[_0xb235('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x44559a,_0xecf759[_0xb235('0x10')]['message']);return _0x3241b4(_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);}logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);return _0x436d63(_0xecf759[_0xb235('0x10')]['message']);}else{logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));_0x436d63(_0xecf759[_0xb235('0x13')][_0xb235('0x12')]);}})[_0xb235('0x14')](function(_0x16f044){logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0x16f044);_0x3241b4(_0x16f044);});});}exports[_0xb235('0x15')]=function(_0x2f1c46){var _0x1b9eae=this;return new Promise(function(_0x1f7cb9,_0x55a479){return db[_0xb235('0x16')]['create'](_0x2f1c46[_0xb235('0x17')],{'raw':_0x2f1c46['options']?_0x2f1c46[_0xb235('0x18')][_0xb235('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x447ec6){logger[_0xb235('0xa')](_0xb235('0x15'),_0x2f1c46);logger[_0xb235('0xd')](_0xb235('0x15'),_0x2f1c46,JSON['stringify'](_0x447ec6));_0x1f7cb9(_0x447ec6);})[_0xb235('0x14')](function(_0x12f787){logger[_0xb235('0x10')](_0xb235('0x15'),_0x12f787[_0xb235('0x12')],_0x2f1c46);_0x55a479(_0x1b9eae[_0xb235('0x10')](0x1f4,_0x12f787['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 501636d..d757508 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 _0x8ba9=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','Router'];(function(_0x3db372,_0x47f21c){var _0xce3d79=function(_0x43c2c4){while(--_0x43c2c4){_0x3db372['push'](_0x3db372['shift']());}};_0xce3d79(++_0x47f21c);}(_0x8ba9,0x1af));var _0x98ba=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x8ba9[_0x243b2f];return _0xcb3c2d;};'use strict';var express=require('express');var router=express[_0x98ba('0x0')]();var auth=require(_0x98ba('0x1'));var controller=require(_0x98ba('0x2'));router[_0x98ba('0x3')]('/',auth[_0x98ba('0x4')](),controller[_0x98ba('0x5')]);router[_0x98ba('0x3')](_0x98ba('0x6'),auth[_0x98ba('0x4')](),controller[_0x98ba('0x7')]);module['exports']=router; \ No newline at end of file +var _0x66a2=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x333cee,_0x17f8b7){var _0x4cb8ce=function(_0x500dd4){while(--_0x500dd4){_0x333cee['push'](_0x333cee['shift']());}};_0x4cb8ce(++_0x17f8b7);}(_0x66a2,0xf3));var _0x266a=function(_0x13a8cc,_0x45b4fc){_0x13a8cc=_0x13a8cc-0x0;var _0x31b53c=_0x66a2[_0x13a8cc];return _0x31b53c;};'use strict';var express=require(_0x266a('0x0'));var router=express[_0x266a('0x1')]();var auth=require(_0x266a('0x2'));var controller=require(_0x266a('0x3'));router[_0x266a('0x4')]('/',auth[_0x266a('0x5')](),controller[_0x266a('0x6')]);router[_0x266a('0x4')](_0x266a('0x7'),auth[_0x266a('0x5')](),controller[_0x266a('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index ae4ccec..317995d 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 _0xa502=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','killProcess'];(function(_0x14241c,_0x513878){var _0x50d4d7=function(_0x256d3f){while(--_0x256d3f){_0x14241c['push'](_0x14241c['shift']());}};_0x50d4d7(++_0x513878);}(_0xa502,0x11b));var _0x2a50=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa502[_0x397e5f];return _0x5302b8;};'use strict';var info=require(_0x2a50('0x0'));var exec=require(_0x2a50('0x1'))[_0x2a50('0x2')];var logger=require(_0x2a50('0x3'))(_0x2a50('0x4'));var util=require('util');var BPromise=require(_0x2a50('0x5'));var _=require(_0x2a50('0x6'));function handleError(_0x4806e9,_0x4a152f,_0x3ebd65){_0x4a152f=_0x4a152f||0x1f4;return function(_0x55053a){logger[_0x2a50('0x7')](_0x2a50('0x8'),_0x3ebd65,_0x4a152f,util[_0x2a50('0x9')](_0x55053a,{'showHidden':![],'depth':null}));delete _0x55053a[_0x2a50('0xa')];_0x4806e9[_0x2a50('0xb')](_0x4a152f)['send'](_0x55053a);};}exports[_0x2a50('0xc')]=function(_0x47c62d,_0x4be5b4){return info[_0x2a50('0xd')]()[_0x2a50('0xe')](function(_0x248cf2){return _0x4be5b4['status'](0xc8)[_0x2a50('0xf')](_0x248cf2);})['catch'](function(_0x23c255){return _0x4be5b4[_0x2a50('0xb')](0x1f4)['json'](_0x23c255);});};exports[_0x2a50('0x10')]=function(_0x426f4c,_0x394945){var _0xb0047b=[_0x2a50('0x11')];return new BPromise(function(_0x328b38,_0x3ecac0){return exec(util[_0x2a50('0x12')](_0x2a50('0x13'),_0x426f4c[_0x2a50('0x14')][_0x2a50('0x15')]),function(_0x1b6753,_0x5ada4e,_0x4d7296){if(_0x1b6753){return _0x3ecac0(_0x1b6753);}return _0x328b38(_0x5ada4e);});})[_0x2a50('0xe')](function(_0x2323aa){var _0x39ac73=![];var _0x518908=_0x2323aa[_0x2a50('0x16')](/\n/);for(var _0x206c60=0x0,_0x2ec7b0=_0xb0047b[_0x2a50('0x17')];_0x206c60<_0x2ec7b0,_0x39ac73===![];_0x206c60+=0x1){if(_0x2323aa[_0x2a50('0x18')](_0xb0047b[_0x206c60])>=0x0){_0x39ac73=!![];}}if(!_0x39ac73){throw new Error(util['format'](_0x2a50('0x19'),_0x426f4c[_0x2a50('0x14')][_0x2a50('0x15')]));}process[_0x2a50('0x1a')](_0x426f4c[_0x2a50('0x14')]['pid'],_0x2a50('0x1b'));return _0x394945['status'](0xc8)['json']({'message':util[_0x2a50('0x12')](_0x2a50('0x1c'),_0x426f4c['params'][_0x2a50('0x15')])});})[_0x2a50('0x1d')](handleError(_0x394945,null,_0x2a50('0x10')));}; \ No newline at end of file +var _0x0013=['killProcess','format','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','getAllData','status','json','catch'];(function(_0x436f34,_0x1041e0){var _0x2bb674=function(_0x78c462){while(--_0x78c462){_0x436f34['push'](_0x436f34['shift']());}};_0x2bb674(++_0x1041e0);}(_0x0013,0x194));var _0x3001=function(_0x75fe31,_0xc1ce5e){_0x75fe31=_0x75fe31-0x0;var _0x2d6c4a=_0x0013[_0x75fe31];return _0x2d6c4a;};'use strict';var info=require(_0x3001('0x0'));var exec=require(_0x3001('0x1'))[_0x3001('0x2')];var logger=require(_0x3001('0x3'))(_0x3001('0x4'));var util=require(_0x3001('0x5'));var BPromise=require('bluebird');var _=require(_0x3001('0x6'));function handleError(_0x6cc57a,_0x2fa324,_0x2ed928){_0x2fa324=_0x2fa324||0x1f4;return function(_0x5aa822){logger[_0x3001('0x7')](_0x3001('0x8'),_0x2ed928,_0x2fa324,util[_0x3001('0x9')](_0x5aa822,{'showHidden':![],'depth':null}));delete _0x5aa822[_0x3001('0xa')];_0x6cc57a['status'](_0x2fa324)['send'](_0x5aa822);};}exports[_0x3001('0xb')]=function(_0x53e1e4,_0xa52cad){return info[_0x3001('0xc')]()['then'](function(_0x18f75e){return _0xa52cad[_0x3001('0xd')](0xc8)[_0x3001('0xe')](_0x18f75e);})[_0x3001('0xf')](function(_0x5b509c){return _0xa52cad[_0x3001('0xd')](0x1f4)[_0x3001('0xe')](_0x5b509c);});};exports[_0x3001('0x10')]=function(_0x181667,_0x4d3855){var _0x19e3ca=['components/import/cm'];return new BPromise(function(_0x63ceec,_0x4f210d){return exec(util[_0x3001('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x181667['params'][_0x3001('0x12')]),function(_0x4fbf6c,_0x5cd914,_0x14deb9){if(_0x4fbf6c){return _0x4f210d(_0x4fbf6c);}return _0x63ceec(_0x5cd914);});})[_0x3001('0x13')](function(_0x5ea48d){var _0x4c50d6=![];var _0x3c4131=_0x5ea48d[_0x3001('0x14')](/\n/);for(var _0x1004ee=0x0,_0x5173db=_0x19e3ca[_0x3001('0x15')];_0x1004ee<_0x5173db,_0x4c50d6===![];_0x1004ee+=0x1){if(_0x5ea48d[_0x3001('0x16')](_0x19e3ca[_0x1004ee])>=0x0){_0x4c50d6=!![];}}if(!_0x4c50d6){throw new Error(util[_0x3001('0x11')](_0x3001('0x17'),_0x181667[_0x3001('0x18')]['pid']));}process[_0x3001('0x19')](_0x181667[_0x3001('0x18')][_0x3001('0x12')],_0x3001('0x1a'));return _0x4d3855[_0x3001('0xd')](0xc8)[_0x3001('0xe')]({'message':util[_0x3001('0x11')](_0x3001('0x1b'),_0x181667[_0x3001('0x18')][_0x3001('0x12')])});})[_0x3001('0xf')](handleError(_0x4d3855,null,_0x3001('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 848c51f..dd0181c 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 _0x3a15=['delete','multer','path','express','Router','fs-extra','../../config/environment','index','/:id','isAuthenticated','show','create','update'];(function(_0x29c191,_0x440f58){var _0x34e868=function(_0x228549){while(--_0x228549){_0x29c191['push'](_0x29c191['shift']());}};_0x34e868(++_0x440f58);}(_0x3a15,0xde));var _0x53a1=function(_0x49fb87,_0x5d65bb){_0x49fb87=_0x49fb87-0x0;var _0x17db71=_0x3a15[_0x49fb87];return _0x17db71;};'use strict';var multer=require(_0x53a1('0x0'));var util=require('util');var path=require(_0x53a1('0x1'));var timeout=require('connect-timeout');var express=require(_0x53a1('0x2'));var router=express[_0x53a1('0x3')]();var fs_extra=require(_0x53a1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x53a1('0x5'));var controller=require('./tag.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x53a1('0x6')]);router['get'](_0x53a1('0x7'),auth[_0x53a1('0x8')](),controller[_0x53a1('0x9')]);router['post']('/',auth[_0x53a1('0x8')](),controller[_0x53a1('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x53a1('0xb')]);router[_0x53a1('0xc')](_0x53a1('0x7'),auth[_0x53a1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x254f=['fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','path','express','Router'];(function(_0x36aad0,_0x3d2e17){var _0x31e987=function(_0x2d0fe4){while(--_0x2d0fe4){_0x36aad0['push'](_0x36aad0['shift']());}};_0x31e987(++_0x3d2e17);}(_0x254f,0x8d));var _0xf254=function(_0x1c7fd2,_0x539c39){_0x1c7fd2=_0x1c7fd2-0x0;var _0x4aa556=_0x254f[_0x1c7fd2];return _0x4aa556;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf254('0x0'));var timeout=require('connect-timeout');var express=require(_0xf254('0x1'));var router=express[_0xf254('0x2')]();var fs_extra=require(_0xf254('0x3'));var auth=require(_0xf254('0x4'));var interaction=require(_0xf254('0x5'));var config=require('../../config/environment');var controller=require(_0xf254('0x6'));router[_0xf254('0x7')]('/',auth[_0xf254('0x8')](),controller[_0xf254('0x9')]);router[_0xf254('0x7')](_0xf254('0xa'),auth['isAuthenticated'](),controller[_0xf254('0xb')]);router[_0xf254('0xc')]('/',auth[_0xf254('0x8')](),controller['create']);router[_0xf254('0xd')](_0xf254('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xf254('0xe')]('/:id',auth[_0xf254('0x8')](),controller[_0xf254('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 59b3725..5c38bbe 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 _0xab40=['STRING','sequelize','exports','#0091EA'];(function(_0x4ca51b,_0x20effe){var _0x447093=function(_0x25f0cf){while(--_0x25f0cf){_0x4ca51b['push'](_0x4ca51b['shift']());}};_0x447093(++_0x20effe);}(_0xab40,0xcd));var _0x0ab4=function(_0x1df04b,_0x3765d3){_0x1df04b=_0x1df04b-0x0;var _0x2aae4a=_0xab40[_0x1df04b];return _0x2aae4a;};'use strict';var Sequelize=require(_0x0ab4('0x0'));module[_0x0ab4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0ab4('0x2')},'description':{'type':Sequelize[_0x0ab4('0x3')]}}; \ No newline at end of file +var _0x0664=['exports','name','STRING'];(function(_0x4bd6a6,_0x1ce766){var _0x469e6b=function(_0x596392){while(--_0x596392){_0x4bd6a6['push'](_0x4bd6a6['shift']());}};_0x469e6b(++_0x1ce766);}(_0x0664,0x93));var _0x4066=function(_0x5c5bbe,_0x11b135){_0x5c5bbe=_0x5c5bbe-0x0;var _0x212f26=_0x0664[_0x5c5bbe];return _0x212f26;};'use strict';var Sequelize=require('sequelize');module[_0x4066('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x4066('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4066('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x4066('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3521429..ed3e788 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 _0x684c=['includeAll','rows','params','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','Tags','UserProfileResource','then','error','name','send','index','map','Tag','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options'];(function(_0x1a037f,_0x2ef991){var _0x36ff51=function(_0x2b41da){while(--_0x2b41da){_0x1a037f['push'](_0x1a037f['shift']());}};_0x36ff51(++_0x2ef991);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc684('0x0'));var rimraf=require(_0xc684('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc684('0x2'));var rp=require(_0xc684('0x3'));var moment=require(_0xc684('0x4'));var BPromise=require(_0xc684('0x5'));var Mustache=require(_0xc684('0x6'));var util=require('util');var path=require(_0xc684('0x7'));var sox=require(_0xc684('0x8'));var csv=require(_0xc684('0x9'));var ejs=require(_0xc684('0xa'));var fs=require('fs');var fs_extra=require(_0xc684('0xb'));var _=require(_0xc684('0xc'));var squel=require(_0xc684('0xd'));var crypto=require(_0xc684('0xe'));var jsforce=require(_0xc684('0xf'));var deskjs=require(_0xc684('0x10'));var toCsv=require(_0xc684('0x9'));var querystring=require(_0xc684('0x11'));var Papa=require(_0xc684('0x12'));var Redis=require(_0xc684('0x13'));var authService=require(_0xc684('0x14'));var qs=require(_0xc684('0x15'));var as=require(_0xc684('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc684('0x17'))(_0xc684('0x18'));var utils=require(_0xc684('0x19'));var config=require(_0xc684('0x1a'));var licenseUtil=require(_0xc684('0x1b'));var db=require(_0xc684('0x1c'))['db'];function respondWithStatusCode(_0x4f3ff9,_0x3004a6){_0x3004a6=_0x3004a6||0xcc;return function(_0x10cc25){if(_0x10cc25){return _0x4f3ff9['sendStatus'](_0x3004a6);}return _0x4f3ff9['status'](_0x3004a6)[_0xc684('0x1d')]();};}function respondWithResult(_0x34cfd7,_0x32d5da){_0x32d5da=_0x32d5da||0xc8;return function(_0x2ad4f1){if(_0x2ad4f1){return _0x34cfd7[_0xc684('0x1e')](_0x32d5da)[_0xc684('0x1f')](_0x2ad4f1);}};}function respondWithFilteredResult(_0x4f26f7,_0x56d76f){return function(_0x43235d){if(_0x43235d){var _0x599c93=typeof _0x56d76f['offset']==='undefined'&&typeof _0x56d76f['limit']==='undefined';var _0x264cb5=_0x43235d[_0xc684('0x20')];var _0x3b6f5e=_0x599c93?0x0:_0x56d76f[_0xc684('0x21')];var _0x1c3af5=_0x599c93?_0x43235d['count']:_0x56d76f[_0xc684('0x21')]+_0x56d76f[_0xc684('0x22')];var _0x4afdd0;if(_0x1c3af5>=_0x264cb5){_0x1c3af5=_0x264cb5;_0x4afdd0=0xc8;}else{_0x4afdd0=0xce;}_0x4f26f7[_0xc684('0x1e')](_0x4afdd0);return _0x4f26f7[_0xc684('0x23')](_0xc684('0x24'),_0x3b6f5e+'-'+_0x1c3af5+'/'+_0x264cb5)['json'](_0x43235d);}return null;};}function patchUpdates(_0x62c4e5){return function(_0x11a159){try{jsonpatch[_0xc684('0x25')](_0x11a159,_0x62c4e5,!![]);}catch(_0xe7aadb){return BPromise[_0xc684('0x26')](_0xe7aadb);}return _0x11a159['save']();};}function saveUpdates(_0x13d43f,_0x39f39a){return function(_0x1fb8b0){if(_0x1fb8b0){return _0x1fb8b0['update'](_0x13d43f)['then'](function(_0x5a7b2e){return _0x5a7b2e;});}return null;};}function removeEntity(_0x41162b,_0x15ce5d){return function(_0xd2a943){if(_0xd2a943){return _0xd2a943['destroy']()['then'](function(){var _0x4e68e0=_0xd2a943['get']({'plain':!![]});var _0x27c7cc=_0xc684('0x27');return db[_0xc684('0x28')]['destroy']({'where':{'type':_0x27c7cc,'resourceId':_0x4e68e0['id']}})[_0xc684('0x29')](function(){return _0xd2a943;});})['then'](function(){_0x41162b[_0xc684('0x1e')](0xcc)[_0xc684('0x1d')]();});}};}function handleEntityNotFound(_0x13e09d,_0x49dad1){return function(_0x1f8e85){if(!_0x1f8e85){_0x13e09d['sendStatus'](0x194);}return _0x1f8e85;};}function handleError(_0x279998,_0x640ca1){_0x640ca1=_0x640ca1||0x1f4;return function(_0x210dcd){logger[_0xc684('0x2a')](_0x210dcd['stack']);if(_0x210dcd[_0xc684('0x2b')]){delete _0x210dcd[_0xc684('0x2b')];}_0x279998[_0xc684('0x1e')](_0x640ca1)[_0xc684('0x2c')](_0x210dcd);};}exports[_0xc684('0x2d')]=function(_0x1e029c,_0x10db0d){var _0x3abd2d={},_0x4df4d4={},_0x5c47ab={'count':0x0,'rows':[]};var _0x4e1d09=_[_0xc684('0x2e')](db[_0xc684('0x2f')]['rawAttributes'],function(_0x4e46c2){return{'name':_0x4e46c2[_0xc684('0x30')],'type':_0x4e46c2['type'][_0xc684('0x31')]};});_0x4df4d4[_0xc684('0x32')]=_[_0xc684('0x2e')](_0x4e1d09,'name');_0x4df4d4['query']=_[_0xc684('0x33')](_0x1e029c[_0xc684('0x34')]);_0x4df4d4['filters']=_['intersection'](_0x4df4d4[_0xc684('0x32')],_0x4df4d4[_0xc684('0x34')]);_0x3abd2d[_0xc684('0x35')]=_[_0xc684('0x36')](_0x4df4d4[_0xc684('0x32')],qs[_0xc684('0x37')](_0x1e029c['query'][_0xc684('0x37')]));_0x3abd2d['attributes']=_0x3abd2d['attributes'][_0xc684('0x38')]?_0x3abd2d[_0xc684('0x35')]:_0x4df4d4['model'];if(!_0x1e029c['query'][_0xc684('0x39')](_0xc684('0x3a'))){_0x3abd2d[_0xc684('0x22')]=qs[_0xc684('0x22')](_0x1e029c[_0xc684('0x34')]['limit']);_0x3abd2d[_0xc684('0x21')]=qs[_0xc684('0x21')](_0x1e029c['query']['offset']);}_0x3abd2d[_0xc684('0x3b')]=qs[_0xc684('0x3c')](_0x1e029c[_0xc684('0x34')][_0xc684('0x3c')]);_0x3abd2d[_0xc684('0x3d')]=qs[_0xc684('0x3e')](_[_0xc684('0x3f')](_0x1e029c['query'],_0x4df4d4['filters']),_0x4e1d09);if(_0x1e029c[_0xc684('0x34')][_0xc684('0x40')]){_0x3abd2d['where']=_['merge'](_0x3abd2d['where'],{'$or':_[_0xc684('0x2e')](_0x4e1d09,function(_0x4a9320){if(_0x4a9320[_0xc684('0x41')]!==_0xc684('0x42')){var _0x2649ee={};_0x2649ee[_0x4a9320['name']]={'$like':'%'+_0x1e029c[_0xc684('0x34')]['filter']+'%'};return _0x2649ee;}})});}_0x3abd2d=_[_0xc684('0x43')]({},_0x3abd2d,_0x1e029c[_0xc684('0x44')]);var _0x380e7c={'where':_0x3abd2d[_0xc684('0x3d')]};return db['Tag'][_0xc684('0x20')](_0x380e7c)[_0xc684('0x29')](function(_0xd9eae7){_0x5c47ab[_0xc684('0x20')]=_0xd9eae7;if(_0x1e029c[_0xc684('0x34')][_0xc684('0x45')]){_0x3abd2d['include']=[{'all':!![]}];}return db[_0xc684('0x2f')]['findAll'](_0x3abd2d);})['then'](function(_0x46c6ad){_0x5c47ab[_0xc684('0x46')]=_0x46c6ad;return _0x5c47ab;})[_0xc684('0x29')](respondWithFilteredResult(_0x10db0d,_0x3abd2d))['catch'](handleError(_0x10db0d,null));};exports['show']=function(_0x4f288b,_0x4ebd3e){var _0x4d0586={'raw':!![],'where':{'id':_0x4f288b[_0xc684('0x47')]['id']}},_0x189b26={};_0x189b26[_0xc684('0x32')]=_['keys'](db[_0xc684('0x2f')]['rawAttributes']);_0x189b26[_0xc684('0x34')]=_['keys'](_0x4f288b[_0xc684('0x34')]);_0x189b26[_0xc684('0x3e')]=_[_0xc684('0x36')](_0x189b26[_0xc684('0x32')],_0x189b26[_0xc684('0x34')]);_0x4d0586['attributes']=_[_0xc684('0x36')](_0x189b26[_0xc684('0x32')],qs[_0xc684('0x37')](_0x4f288b[_0xc684('0x34')][_0xc684('0x37')]));_0x4d0586[_0xc684('0x35')]=_0x4d0586[_0xc684('0x35')][_0xc684('0x38')]?_0x4d0586[_0xc684('0x35')]:_0x189b26['model'];if(_0x4f288b[_0xc684('0x34')][_0xc684('0x45')]){_0x4d0586['include']=[{'all':!![]}];}_0x4d0586=_[_0xc684('0x43')]({},_0x4d0586,_0x4f288b['options']);return db[_0xc684('0x2f')]['find'](_0x4d0586)[_0xc684('0x29')](handleEntityNotFound(_0x4ebd3e,null))[_0xc684('0x29')](respondWithResult(_0x4ebd3e,null))[_0xc684('0x48')](handleError(_0x4ebd3e,null));};exports[_0xc684('0x49')]=function(_0x1bfd8d,_0x1fde57){return db[_0xc684('0x2f')][_0xc684('0x49')](_0x1bfd8d[_0xc684('0x4a')],{})[_0xc684('0x29')](function(_0x4abd04){var _0x16951f=_0x1bfd8d[_0xc684('0x4b')]['get']({'plain':!![]});if(!_0x16951f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16951f['role']===_0xc684('0x4b')){var _0x1304a2=_0x4abd04[_0xc684('0x4c')]({'plain':!![]});var _0x34b2cd=_0xc684('0x27');return db[_0xc684('0x4d')]['find']({'where':{'name':_0x34b2cd,'userProfileId':_0x16951f[_0xc684('0x4e')]},'raw':!![]})[_0xc684('0x29')](function(_0x16f039){if(_0x16f039&&_0x16f039[_0xc684('0x4f')]===0x0){return db[_0xc684('0x28')]['create']({'name':_0x1304a2[_0xc684('0x2b')],'resourceId':_0x1304a2['id'],'type':_0x16f039[_0xc684('0x2b')],'sectionId':_0x16f039['id']},{})['then'](function(){return _0x4abd04;});}else{return _0x4abd04;}})[_0xc684('0x48')](function(_0x7af88c){logger[_0xc684('0x2a')](_0xc684('0x50'),_0x7af88c);throw _0x7af88c;});}return _0x4abd04;})[_0xc684('0x29')](respondWithResult(_0x1fde57,0xc9))['catch'](handleError(_0x1fde57,null));};exports[_0xc684('0x51')]=function(_0x4d3484,_0x3c6f05){if(_0x4d3484[_0xc684('0x4a')]['id']){delete _0x4d3484[_0xc684('0x4a')]['id'];}return db[_0xc684('0x2f')][_0xc684('0x52')]({'where':{'id':_0x4d3484[_0xc684('0x47')]['id']}})[_0xc684('0x29')](handleEntityNotFound(_0x3c6f05,null))[_0xc684('0x29')](saveUpdates(_0x4d3484[_0xc684('0x4a')],null))['then'](respondWithResult(_0x3c6f05,null))['catch'](handleError(_0x3c6f05,null));};exports[_0xc684('0x53')]=function(_0x49218e,_0x2b2d54){return db['Tag']['find']({'where':{'id':_0x49218e[_0xc684('0x47')]['id']}})[_0xc684('0x29')](handleEntityNotFound(_0x2b2d54,null))[_0xc684('0x29')](removeEntity(_0x2b2d54,null))[_0xc684('0x48')](handleError(_0x2b2d54,null));}; \ No newline at end of file +var _0x1bca=['order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','Tag','rawAttributes','find','create','body','role','user','get','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','Tags','error','name','send','map','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0xa4c4ff,_0x5e48a6){var _0x59df77=function(_0x3107f4){while(--_0x3107f4){_0xa4c4ff['push'](_0xa4c4ff['shift']());}};_0x59df77(++_0x5e48a6);}(_0x1bca,0xb6));var _0xa1bc=function(_0x58b409,_0x36f72b){_0x58b409=_0x58b409-0x0;var _0x39b60a=_0x1bca[_0x58b409];return _0x39b60a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1bc('0x1'));var moment=require('moment');var BPromise=require(_0xa1bc('0x2'));var Mustache=require(_0xa1bc('0x3'));var util=require(_0xa1bc('0x4'));var path=require('path');var sox=require(_0xa1bc('0x5'));var csv=require(_0xa1bc('0x6'));var ejs=require(_0xa1bc('0x7'));var fs=require('fs');var fs_extra=require(_0xa1bc('0x8'));var _=require('lodash');var squel=require(_0xa1bc('0x9'));var crypto=require(_0xa1bc('0xa'));var jsforce=require(_0xa1bc('0xb'));var deskjs=require(_0xa1bc('0xc'));var toCsv=require(_0xa1bc('0x6'));var querystring=require(_0xa1bc('0xd'));var Papa=require(_0xa1bc('0xe'));var Redis=require('ioredis');var authService=require(_0xa1bc('0xf'));var qs=require(_0xa1bc('0x10'));var as=require(_0xa1bc('0x11'));var hardwareService=require(_0xa1bc('0x12'));var logger=require(_0xa1bc('0x13'))(_0xa1bc('0x14'));var utils=require(_0xa1bc('0x15'));var config=require(_0xa1bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f65bc,_0x37913b){_0x37913b=_0x37913b||0xcc;return function(_0x2b38cf){if(_0x2b38cf){return _0x1f65bc[_0xa1bc('0x17')](_0x37913b);}return _0x1f65bc[_0xa1bc('0x18')](_0x37913b)[_0xa1bc('0x19')]();};}function respondWithResult(_0x165acf,_0x2c5f01){_0x2c5f01=_0x2c5f01||0xc8;return function(_0xe0d028){if(_0xe0d028){return _0x165acf[_0xa1bc('0x18')](_0x2c5f01)[_0xa1bc('0x1a')](_0xe0d028);}};}function respondWithFilteredResult(_0x5a22e0,_0x565bc2){return function(_0xdb513d){if(_0xdb513d){var _0xf8c08e=typeof _0x565bc2[_0xa1bc('0x1b')]===_0xa1bc('0x1c')&&typeof _0x565bc2[_0xa1bc('0x1d')]===_0xa1bc('0x1c');var _0x36b899=_0xdb513d[_0xa1bc('0x1e')];var _0x4765be=_0xf8c08e?0x0:_0x565bc2['offset'];var _0x510046=_0xf8c08e?_0xdb513d[_0xa1bc('0x1e')]:_0x565bc2[_0xa1bc('0x1b')]+_0x565bc2[_0xa1bc('0x1d')];var _0x2b0410;if(_0x510046>=_0x36b899){_0x510046=_0x36b899;_0x2b0410=0xc8;}else{_0x2b0410=0xce;}_0x5a22e0['status'](_0x2b0410);return _0x5a22e0['set'](_0xa1bc('0x1f'),_0x4765be+'-'+_0x510046+'/'+_0x36b899)[_0xa1bc('0x1a')](_0xdb513d);}return null;};}function patchUpdates(_0x322703){return function(_0x95a766){try{jsonpatch[_0xa1bc('0x20')](_0x95a766,_0x322703,!![]);}catch(_0x3e8cd7){return BPromise['reject'](_0x3e8cd7);}return _0x95a766[_0xa1bc('0x21')]();};}function saveUpdates(_0xc81195,_0x1e4f4e){return function(_0x4fdf7d){if(_0x4fdf7d){return _0x4fdf7d[_0xa1bc('0x22')](_0xc81195)['then'](function(_0x10636d){return _0x10636d;});}return null;};}function removeEntity(_0x44f952,_0x23d67d){return function(_0x2a77a2){if(_0x2a77a2){return _0x2a77a2[_0xa1bc('0x23')]()[_0xa1bc('0x24')](function(){var _0x4f53f2=_0x2a77a2['get']({'plain':!![]});var _0x3cc2e0=_0xa1bc('0x25');return db['UserProfileResource'][_0xa1bc('0x23')]({'where':{'type':_0x3cc2e0,'resourceId':_0x4f53f2['id']}})[_0xa1bc('0x24')](function(){return _0x2a77a2;});})[_0xa1bc('0x24')](function(){_0x44f952[_0xa1bc('0x18')](0xcc)[_0xa1bc('0x19')]();});}};}function handleEntityNotFound(_0x2a89ba,_0x5a579f){return function(_0x4fdfd7){if(!_0x4fdfd7){_0x2a89ba[_0xa1bc('0x17')](0x194);}return _0x4fdfd7;};}function handleError(_0xa2137e,_0x1874dc){_0x1874dc=_0x1874dc||0x1f4;return function(_0x1270f5){logger[_0xa1bc('0x26')](_0x1270f5['stack']);if(_0x1270f5[_0xa1bc('0x27')]){delete _0x1270f5['name'];}_0xa2137e[_0xa1bc('0x18')](_0x1874dc)[_0xa1bc('0x28')](_0x1270f5);};}exports['index']=function(_0x4f0593,_0x4a120c){var _0x3500d0={},_0x4b8a88={},_0x1fe2a5={'count':0x0,'rows':[]};var _0x3b79a9=_[_0xa1bc('0x29')](db['Tag']['rawAttributes'],function(_0x1e68ba){return{'name':_0x1e68ba['fieldName'],'type':_0x1e68ba[_0xa1bc('0x2a')][_0xa1bc('0x2b')]};});_0x4b8a88[_0xa1bc('0x2c')]=_['map'](_0x3b79a9,'name');_0x4b8a88['query']=_[_0xa1bc('0x2d')](_0x4f0593[_0xa1bc('0x2e')]);_0x4b8a88['filters']=_[_0xa1bc('0x2f')](_0x4b8a88[_0xa1bc('0x2c')],_0x4b8a88[_0xa1bc('0x2e')]);_0x3500d0['attributes']=_[_0xa1bc('0x2f')](_0x4b8a88[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x4f0593['query'][_0xa1bc('0x30')]));_0x3500d0[_0xa1bc('0x31')]=_0x3500d0[_0xa1bc('0x31')][_0xa1bc('0x32')]?_0x3500d0[_0xa1bc('0x31')]:_0x4b8a88[_0xa1bc('0x2c')];if(!_0x4f0593[_0xa1bc('0x2e')][_0xa1bc('0x33')]('nolimit')){_0x3500d0[_0xa1bc('0x1d')]=qs[_0xa1bc('0x1d')](_0x4f0593[_0xa1bc('0x2e')][_0xa1bc('0x1d')]);_0x3500d0['offset']=qs[_0xa1bc('0x1b')](_0x4f0593[_0xa1bc('0x2e')]['offset']);}_0x3500d0[_0xa1bc('0x34')]=qs[_0xa1bc('0x35')](_0x4f0593[_0xa1bc('0x2e')][_0xa1bc('0x35')]);_0x3500d0[_0xa1bc('0x36')]=qs['filters'](_[_0xa1bc('0x37')](_0x4f0593[_0xa1bc('0x2e')],_0x4b8a88[_0xa1bc('0x38')]),_0x3b79a9);if(_0x4f0593[_0xa1bc('0x2e')][_0xa1bc('0x39')]){_0x3500d0['where']=_[_0xa1bc('0x3a')](_0x3500d0[_0xa1bc('0x36')],{'$or':_[_0xa1bc('0x29')](_0x3b79a9,function(_0x34fbfb){if(_0x34fbfb[_0xa1bc('0x2a')]!=='VIRTUAL'){var _0x479438={};_0x479438[_0x34fbfb['name']]={'$like':'%'+_0x4f0593[_0xa1bc('0x2e')]['filter']+'%'};return _0x479438;}})});}_0x3500d0=_[_0xa1bc('0x3a')]({},_0x3500d0,_0x4f0593[_0xa1bc('0x3b')]);var _0x33e402={'where':_0x3500d0[_0xa1bc('0x36')]};return db['Tag'][_0xa1bc('0x1e')](_0x33e402)['then'](function(_0x482d37){_0x1fe2a5[_0xa1bc('0x1e')]=_0x482d37;if(_0x4f0593['query'][_0xa1bc('0x3c')]){_0x3500d0[_0xa1bc('0x3d')]=[{'all':!![]}];}return db['Tag'][_0xa1bc('0x3e')](_0x3500d0);})['then'](function(_0x1544c8){_0x1fe2a5[_0xa1bc('0x3f')]=_0x1544c8;return _0x1fe2a5;})[_0xa1bc('0x24')](respondWithFilteredResult(_0x4a120c,_0x3500d0))[_0xa1bc('0x40')](handleError(_0x4a120c,null));};exports['show']=function(_0x2b0e95,_0x46c69d){var _0x50fde9={'raw':!![],'where':{'id':_0x2b0e95[_0xa1bc('0x41')]['id']}},_0x982b40={};_0x982b40[_0xa1bc('0x2c')]=_[_0xa1bc('0x2d')](db[_0xa1bc('0x42')][_0xa1bc('0x43')]);_0x982b40[_0xa1bc('0x2e')]=_[_0xa1bc('0x2d')](_0x2b0e95[_0xa1bc('0x2e')]);_0x982b40[_0xa1bc('0x38')]=_[_0xa1bc('0x2f')](_0x982b40[_0xa1bc('0x2c')],_0x982b40[_0xa1bc('0x2e')]);_0x50fde9[_0xa1bc('0x31')]=_['intersection'](_0x982b40[_0xa1bc('0x2c')],qs['fields'](_0x2b0e95[_0xa1bc('0x2e')][_0xa1bc('0x30')]));_0x50fde9[_0xa1bc('0x31')]=_0x50fde9[_0xa1bc('0x31')]['length']?_0x50fde9['attributes']:_0x982b40['model'];if(_0x2b0e95['query']['includeAll']){_0x50fde9[_0xa1bc('0x3d')]=[{'all':!![]}];}_0x50fde9=_['merge']({},_0x50fde9,_0x2b0e95[_0xa1bc('0x3b')]);return db[_0xa1bc('0x42')][_0xa1bc('0x44')](_0x50fde9)[_0xa1bc('0x24')](handleEntityNotFound(_0x46c69d,null))['then'](respondWithResult(_0x46c69d,null))[_0xa1bc('0x40')](handleError(_0x46c69d,null));};exports[_0xa1bc('0x45')]=function(_0x3fa784,_0x3eb3d7){return db[_0xa1bc('0x42')]['create'](_0x3fa784[_0xa1bc('0x46')],{})[_0xa1bc('0x24')](function(_0x36c784){var _0xfa3afd=_0x3fa784['user']['get']({'plain':!![]});if(!_0xfa3afd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfa3afd[_0xa1bc('0x47')]===_0xa1bc('0x48')){var _0x5b3b1=_0x36c784[_0xa1bc('0x49')]({'plain':!![]});var _0x14bad4='Tags';return db['UserProfileSection'][_0xa1bc('0x44')]({'where':{'name':_0x14bad4,'userProfileId':_0xfa3afd[_0xa1bc('0x4a')]},'raw':!![]})[_0xa1bc('0x24')](function(_0x2bc1cb){if(_0x2bc1cb&&_0x2bc1cb[_0xa1bc('0x4b')]===0x0){return db[_0xa1bc('0x4c')][_0xa1bc('0x45')]({'name':_0x5b3b1[_0xa1bc('0x27')],'resourceId':_0x5b3b1['id'],'type':_0x2bc1cb[_0xa1bc('0x27')],'sectionId':_0x2bc1cb['id']},{})['then'](function(){return _0x36c784;});}else{return _0x36c784;}})[_0xa1bc('0x40')](function(_0xd80e5d){logger['error'](_0xa1bc('0x4d'),_0xd80e5d);throw _0xd80e5d;});}return _0x36c784;})[_0xa1bc('0x24')](respondWithResult(_0x3eb3d7,0xc9))[_0xa1bc('0x40')](handleError(_0x3eb3d7,null));};exports[_0xa1bc('0x22')]=function(_0xb14552,_0x5a9c2c){if(_0xb14552['body']['id']){delete _0xb14552['body']['id'];}return db[_0xa1bc('0x42')][_0xa1bc('0x44')]({'where':{'id':_0xb14552[_0xa1bc('0x41')]['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x5a9c2c,null))['then'](saveUpdates(_0xb14552[_0xa1bc('0x46')],null))[_0xa1bc('0x24')](respondWithResult(_0x5a9c2c,null))['catch'](handleError(_0x5a9c2c,null));};exports[_0xa1bc('0x23')]=function(_0x5a02cf,_0x5c5719){return db['Tag'][_0xa1bc('0x44')]({'where':{'id':_0x5a02cf[_0xa1bc('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c5719,null))[_0xa1bc('0x24')](removeEntity(_0x5c5719,null))[_0xa1bc('0x40')](handleError(_0x5c5719,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 35f2166..3b5d71e 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 _0x8bfc=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag'];(function(_0xa7991d,_0x32459c){var _0x459970=function(_0x5f536f){while(--_0x5f536f){_0xa7991d['push'](_0xa7991d['shift']());}};_0x459970(++_0x32459c);}(_0x8bfc,0x9a));var _0xc8bf=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x8bfc[_0x54d4a8];return _0x3b321b;};'use strict';var _=require('lodash');var util=require(_0xc8bf('0x0'));var logger=require(_0xc8bf('0x1'))('api');var moment=require(_0xc8bf('0x2'));var BPromise=require(_0xc8bf('0x3'));var rp=require(_0xc8bf('0x4'));var fs=require('fs');var path=require(_0xc8bf('0x5'));var rimraf=require(_0xc8bf('0x6'));var config=require(_0xc8bf('0x7'));var attributes=require(_0xc8bf('0x8'));module[_0xc8bf('0x9')]=function(_0x464070,_0x4066a6){return _0x464070['define'](_0xc8bf('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9585=['request-promise','./tag.attributes','exports','Tag','tools_tags','util','../../config/logger','api','moment','bluebird'];(function(_0x221df3,_0x58bc32){var _0x2cc8d6=function(_0x463839){while(--_0x463839){_0x221df3['push'](_0x221df3['shift']());}};_0x2cc8d6(++_0x58bc32);}(_0x9585,0x195));var _0x5958=function(_0x5704fb,_0x26901d){_0x5704fb=_0x5704fb-0x0;var _0x2ecb7c=_0x9585[_0x5704fb];return _0x2ecb7c;};'use strict';var _=require('lodash');var util=require(_0x5958('0x0'));var logger=require(_0x5958('0x1'))(_0x5958('0x2'));var moment=require(_0x5958('0x3'));var BPromise=require(_0x5958('0x4'));var rp=require(_0x5958('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5958('0x6'));module[_0x5958('0x7')]=function(_0x433c1d,_0x35b71f){return _0x433c1d['define'](_0x5958('0x8'),attributes,{'tableName':_0x5958('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index a15d392..cd59ae0 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 _0xac95=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','Tag,\x20%s,\x20%s','message','result','catch'];(function(_0x37fac8,_0x45be65){var _0x2e0f0a=function(_0x4a5e9b){while(--_0x4a5e9b){_0x37fac8['push'](_0x37fac8['shift']());}};_0x2e0f0a(++_0x45be65);}(_0xac95,0xa8));var _0x5ac9=function(_0x22e657,_0xd68adc){_0x22e657=_0x22e657-0x0;var _0x868fc7=_0xac95[_0x22e657];return _0x868fc7;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var moment=require(_0x5ac9('0x2'));var BPromise=require(_0x5ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ac9('0x4'))['db'];var utils=require(_0x5ac9('0x5'));var logger=require('../../config/logger')(_0x5ac9('0x6'));var config=require(_0x5ac9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ac9('0x8')][_0x5ac9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8675ec,_0x4bddcf,_0x4dffb8){return new BPromise(function(_0x32afbc,_0x2ab11c){return client[_0x5ac9('0xa')](_0x8675ec,_0x4dffb8)[_0x5ac9('0xb')](function(_0x397bb8){logger[_0x5ac9('0xc')]('Tag,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'));logger[_0x5ac9('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'),JSON['stringify'](_0x397bb8));if(_0x397bb8[_0x5ac9('0xf')]){if(_0x397bb8['error'][_0x5ac9('0x10')]===0x1f4){logger[_0x5ac9('0xf')](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x2ab11c(_0x397bb8['error'][_0x5ac9('0x12')]);}logger['error'](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x32afbc(_0x397bb8[_0x5ac9('0xf')][_0x5ac9('0x12')]);}else{logger[_0x5ac9('0xc')](_0x5ac9('0x11'),_0x4bddcf,_0x5ac9('0xd'));_0x32afbc(_0x397bb8[_0x5ac9('0x13')][_0x5ac9('0x12')]);}})[_0x5ac9('0x14')](function(_0x460fd7){logger['error']('Tag,\x20%s,\x20%s',_0x4bddcf,_0x460fd7);_0x2ab11c(_0x460fd7);});});} \ No newline at end of file +var _0x3e5c=['info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x498413,_0x3314f){var _0x2ae70b=function(_0x2565c3){while(--_0x2565c3){_0x498413['push'](_0x498413['shift']());}};_0x2ae70b(++_0x3314f);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x3c80f1,_0x2e02f3){_0x3c80f1=_0x3c80f1-0x0;var _0x352444=_0x3e5c[_0x3c80f1];return _0x352444;};'use strict';var _=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var moment=require(_0xc3e5('0x2'));var BPromise=require(_0xc3e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3e5('0x4'));var db=require(_0xc3e5('0x5'))['db'];var utils=require(_0xc3e5('0x6'));var logger=require(_0xc3e5('0x7'))(_0xc3e5('0x8'));var config=require(_0xc3e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3e5('0xa')][_0xc3e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d6089,_0xcbbec0,_0x2d580e){return new BPromise(function(_0x4864a2,_0x196f3a){return client[_0xc3e5('0xc')](_0x2d6089,_0x2d580e)[_0xc3e5('0xd')](function(_0x19813b){logger[_0xc3e5('0xe')](_0xc3e5('0xf'),_0xcbbec0,_0xc3e5('0x10'));logger['debug'](_0xc3e5('0x11'),_0xcbbec0,_0xc3e5('0x10'),JSON[_0xc3e5('0x12')](_0x19813b));if(_0x19813b[_0xc3e5('0x13')]){if(_0x19813b['error'][_0xc3e5('0x14')]===0x1f4){logger[_0xc3e5('0x13')](_0xc3e5('0xf'),_0xcbbec0,_0x19813b[_0xc3e5('0x13')][_0xc3e5('0x15')]);return _0x196f3a(_0x19813b[_0xc3e5('0x13')]['message']);}logger['error']('Tag,\x20%s,\x20%s',_0xcbbec0,_0x19813b[_0xc3e5('0x13')]['message']);return _0x4864a2(_0x19813b[_0xc3e5('0x13')][_0xc3e5('0x15')]);}else{logger['info'](_0xc3e5('0xf'),_0xcbbec0,_0xc3e5('0x10'));_0x4864a2(_0x19813b[_0xc3e5('0x16')][_0xc3e5('0x15')]);}})[_0xc3e5('0x17')](function(_0x47cfd8){logger[_0xc3e5('0x13')](_0xc3e5('0xf'),_0xcbbec0,_0x47cfd8);_0x196f3a(_0x47cfd8);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ca4f28f..423a786 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 f8af61c..8415118 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 _0xbaf0=['name','exports','STRING'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x47eb87,_0x49d6cf){var _0x5a7aa6=function(_0x229d62){while(--_0x229d62){_0x47eb87['push'](_0x47eb87['shift']());}};_0x5a7aa6(++_0x49d6cf);}(_0x2032,0xd9));var _0x2203=function(_0x3856cf,_0x5baeb2){_0x3856cf=_0x3856cf-0x0;var _0xc8d8cb=_0x2032[_0x3856cf];return _0xc8d8cb;};'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/team/team.controller.js b/server/api/team/team.controller.js index 8d5845c..f297bfe 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 _0x4829=['User','findOrCreate','emit','Queue:save','online','interface','upsert','isNil','format','voicePause','TeamVoiceQueue','all','addAgents','spread','removeAgents','parse','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./team.socket','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','Teams','sendStatus','error','stack','name','send','Team','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','user','get','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','channel','isValidChannel','Sequelize','capitalize','toLowerCase','Queue','rawAttributes','pick','Queues','addQueues','findOne','ValidationError','Unknown\x20channel','ids','removeQueues','remove','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','Voice','through','penalty','QueueId','defaults'];(function(_0x23efe6,_0x737a9e){var _0x360532=function(_0x1991a4){while(--_0x1991a4){_0x23efe6['push'](_0x23efe6['shift']());}};_0x360532(++_0x737a9e);}(_0x4829,0x9c));var _0x9482=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x4829[_0x5dfc2a];return _0x3f1a71;};'use strict';var emlformat=require(_0x9482('0x0'));var rimraf=require(_0x9482('0x1'));var zipdir=require(_0x9482('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9482('0x3'));var moment=require(_0x9482('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9482('0x5'));var util=require(_0x9482('0x6'));var path=require(_0x9482('0x7'));var sox=require(_0x9482('0x8'));var csv=require(_0x9482('0x9'));var ejs=require(_0x9482('0xa'));var fs=require('fs');var fs_extra=require(_0x9482('0xb'));var _=require(_0x9482('0xc'));var squel=require(_0x9482('0xd'));var crypto=require('crypto');var jsforce=require(_0x9482('0xe'));var deskjs=require(_0x9482('0xf'));var toCsv=require(_0x9482('0x9'));var querystring=require(_0x9482('0x10'));var Papa=require(_0x9482('0x11'));var Redis=require(_0x9482('0x12'));var authService=require(_0x9482('0x13'));var qs=require(_0x9482('0x14'));var as=require(_0x9482('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9482('0x16'))('api');var utils=require(_0x9482('0x17'));var config=require(_0x9482('0x18'));var licenseUtil=require(_0x9482('0x19'));var db=require(_0x9482('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x9482('0x1b'),'port':0x18eb});var socket=require(_0x9482('0x1c'))(new Redis(config[_0x9482('0x1d')]));require(_0x9482('0x1e'))['register'](socket);function respondWithStatusCode(_0xcfb3cf,_0x15f423){_0x15f423=_0x15f423||0xcc;return function(_0x253d5a){if(_0x253d5a){return _0xcfb3cf['sendStatus'](_0x15f423);}return _0xcfb3cf['status'](_0x15f423)['end']();};}function respondWithResult(_0x121b97,_0x597085){_0x597085=_0x597085||0xc8;return function(_0x58351a){if(_0x58351a){return _0x121b97[_0x9482('0x1f')](_0x597085)[_0x9482('0x20')](_0x58351a);}};}function respondWithFilteredResult(_0x4e1490,_0x348de8){return function(_0x35f691){if(_0x35f691){var _0x2961ff=typeof _0x348de8[_0x9482('0x21')]==='undefined'&&typeof _0x348de8[_0x9482('0x22')]===_0x9482('0x23');var _0x47a763=_0x35f691[_0x9482('0x24')];var _0x95a795=_0x2961ff?0x0:_0x348de8['offset'];var _0x349481=_0x2961ff?_0x35f691[_0x9482('0x24')]:_0x348de8['offset']+_0x348de8[_0x9482('0x22')];var _0x3590dd;if(_0x349481>=_0x47a763){_0x349481=_0x47a763;_0x3590dd=0xc8;}else{_0x3590dd=0xce;}_0x4e1490[_0x9482('0x1f')](_0x3590dd);return _0x4e1490['set'](_0x9482('0x25'),_0x95a795+'-'+_0x349481+'/'+_0x47a763)[_0x9482('0x20')](_0x35f691);}return null;};}function patchUpdates(_0x4d38ef){return function(_0x35077b){try{jsonpatch[_0x9482('0x26')](_0x35077b,_0x4d38ef,!![]);}catch(_0x4a8874){return BPromise[_0x9482('0x27')](_0x4a8874);}return _0x35077b[_0x9482('0x28')]();};}function saveUpdates(_0x3e57bb,_0x1d4bf6){return function(_0x5ba327){if(_0x5ba327){return _0x5ba327[_0x9482('0x29')](_0x3e57bb)[_0x9482('0x2a')](function(_0x4c5a10){return _0x4c5a10;});}return null;};}function removeEntity(_0x683277,_0x422bd8){return function(_0x2c697f){if(_0x2c697f){return _0x2c697f[_0x9482('0x2b')]()[_0x9482('0x2a')](function(){var _0x4dcafb=_0x2c697f['get']({'plain':!![]});var _0x1fb1a9=_0x9482('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1fb1a9,'resourceId':_0x4dcafb['id']}})[_0x9482('0x2a')](function(){return _0x2c697f;});})[_0x9482('0x2a')](function(){_0x683277[_0x9482('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aaf9f,_0x565da0){return function(_0x14548b){if(!_0x14548b){_0x3aaf9f[_0x9482('0x2d')](0x194);}return _0x14548b;};}function handleError(_0x35a02d,_0x24fc20){_0x24fc20=_0x24fc20||0x1f4;return function(_0x5a485f){logger[_0x9482('0x2e')](_0x5a485f[_0x9482('0x2f')]);if(_0x5a485f[_0x9482('0x30')]){delete _0x5a485f[_0x9482('0x30')];}_0x35a02d[_0x9482('0x1f')](_0x24fc20)[_0x9482('0x31')](_0x5a485f);};}exports['index']=function(_0x5b69b3,_0x34d65c){var _0x2d1905={},_0x87ba73={},_0x22af78={'count':0x0,'rows':[]};var _0x2a55dd=_['map'](db[_0x9482('0x32')]['rawAttributes'],function(_0x506aae){return{'name':_0x506aae[_0x9482('0x33')],'type':_0x506aae[_0x9482('0x34')][_0x9482('0x35')]};});_0x87ba73[_0x9482('0x36')]=_['map'](_0x2a55dd,'name');_0x87ba73[_0x9482('0x37')]=_[_0x9482('0x38')](_0x5b69b3[_0x9482('0x37')]);_0x87ba73[_0x9482('0x39')]=_[_0x9482('0x3a')](_0x87ba73[_0x9482('0x36')],_0x87ba73[_0x9482('0x37')]);_0x2d1905['attributes']=_[_0x9482('0x3a')](_0x87ba73[_0x9482('0x36')],qs['fields'](_0x5b69b3[_0x9482('0x37')][_0x9482('0x3b')]));_0x2d1905[_0x9482('0x3c')]=_0x2d1905[_0x9482('0x3c')][_0x9482('0x3d')]?_0x2d1905[_0x9482('0x3c')]:_0x87ba73[_0x9482('0x36')];if(!_0x5b69b3[_0x9482('0x37')][_0x9482('0x3e')](_0x9482('0x3f'))){_0x2d1905[_0x9482('0x22')]=qs[_0x9482('0x22')](_0x5b69b3[_0x9482('0x37')]['limit']);_0x2d1905[_0x9482('0x21')]=qs['offset'](_0x5b69b3['query']['offset']);}_0x2d1905[_0x9482('0x40')]=qs[_0x9482('0x41')](_0x5b69b3[_0x9482('0x37')][_0x9482('0x41')]);_0x2d1905[_0x9482('0x42')]=qs[_0x9482('0x39')](_['pick'](_0x5b69b3[_0x9482('0x37')],_0x87ba73[_0x9482('0x39')]),_0x2a55dd);if(_0x5b69b3['query'][_0x9482('0x43')]){_0x2d1905[_0x9482('0x42')]=_[_0x9482('0x44')](_0x2d1905[_0x9482('0x42')],{'$or':_[_0x9482('0x45')](_0x2a55dd,function(_0x114521){if(_0x114521[_0x9482('0x34')]!==_0x9482('0x46')){var _0xfe62b3={};_0xfe62b3[_0x114521[_0x9482('0x30')]]={'$like':'%'+_0x5b69b3[_0x9482('0x37')]['filter']+'%'};return _0xfe62b3;}})});}_0x2d1905=_[_0x9482('0x44')]({},_0x2d1905,_0x5b69b3[_0x9482('0x47')]);var _0x3beb03={'where':_0x2d1905[_0x9482('0x42')]};return db['Team'][_0x9482('0x24')](_0x3beb03)[_0x9482('0x2a')](function(_0x1f301e){_0x22af78['count']=_0x1f301e;if(_0x5b69b3[_0x9482('0x37')][_0x9482('0x48')]){_0x2d1905[_0x9482('0x49')]=[{'all':!![]}];}return db['Team'][_0x9482('0x4a')](_0x2d1905);})[_0x9482('0x2a')](function(_0x30db8b){_0x22af78['rows']=_0x30db8b;return _0x22af78;})['then'](respondWithFilteredResult(_0x34d65c,_0x2d1905))[_0x9482('0x4b')](handleError(_0x34d65c,null));};exports[_0x9482('0x4c')]=function(_0x38601d,_0x532414){var _0x41f026={'raw':![],'where':{'id':_0x38601d[_0x9482('0x4d')]['id']}},_0x267f35={};_0x267f35[_0x9482('0x36')]=_[_0x9482('0x38')](db[_0x9482('0x32')]['rawAttributes']);_0x267f35[_0x9482('0x37')]=_[_0x9482('0x38')](_0x38601d[_0x9482('0x37')]);_0x267f35['filters']=_[_0x9482('0x3a')](_0x267f35['model'],_0x267f35[_0x9482('0x37')]);_0x41f026[_0x9482('0x3c')]=_[_0x9482('0x3a')](_0x267f35['model'],qs[_0x9482('0x3b')](_0x38601d[_0x9482('0x37')][_0x9482('0x3b')]));_0x41f026['attributes']=_0x41f026[_0x9482('0x3c')][_0x9482('0x3d')]?_0x41f026[_0x9482('0x3c')]:_0x267f35[_0x9482('0x36')];if(_0x38601d[_0x9482('0x37')][_0x9482('0x48')]){_0x41f026['include']=[{'all':!![]}];}_0x41f026=_[_0x9482('0x44')]({},_0x41f026,_0x38601d[_0x9482('0x47')]);return db[_0x9482('0x32')][_0x9482('0x4e')](_0x41f026)[_0x9482('0x2a')](handleEntityNotFound(_0x532414,null))[_0x9482('0x2a')](respondWithResult(_0x532414,null))[_0x9482('0x4b')](handleError(_0x532414,null));};exports['create']=function(_0x20d38c,_0x5cdac0){return db[_0x9482('0x32')]['create'](_0x20d38c[_0x9482('0x4f')],{})['then'](function(_0x5d3c18){var _0x1bd3d9=_0x20d38c[_0x9482('0x50')][_0x9482('0x51')]({'plain':!![]});if(!_0x1bd3d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bd3d9[_0x9482('0x52')]===_0x9482('0x50')){var _0x3e9597=_0x5d3c18['get']({'plain':!![]});var _0x3c9e74=_0x9482('0x2c');return db[_0x9482('0x53')][_0x9482('0x4e')]({'where':{'name':_0x3c9e74,'userProfileId':_0x1bd3d9[_0x9482('0x54')]},'raw':!![]})[_0x9482('0x2a')](function(_0x12acd6){if(_0x12acd6&&_0x12acd6['autoAssociation']===0x0){return db[_0x9482('0x55')][_0x9482('0x56')]({'name':_0x3e9597[_0x9482('0x30')],'resourceId':_0x3e9597['id'],'type':_0x12acd6[_0x9482('0x30')],'sectionId':_0x12acd6['id']},{})['then'](function(){return _0x5d3c18;});}else{return _0x5d3c18;}})[_0x9482('0x4b')](function(_0x587e90){logger[_0x9482('0x2e')](_0x9482('0x57'),_0x587e90);throw _0x587e90;});}return _0x5d3c18;})[_0x9482('0x2a')](respondWithResult(_0x5cdac0,0xc9))['catch'](handleError(_0x5cdac0,null));};exports['update']=function(_0x26a27c,_0x2c897c){if(_0x26a27c[_0x9482('0x4f')]['id']){delete _0x26a27c[_0x9482('0x4f')]['id'];}return db[_0x9482('0x32')][_0x9482('0x4e')]({'where':{'id':_0x26a27c[_0x9482('0x4d')]['id']}})[_0x9482('0x2a')](handleEntityNotFound(_0x2c897c,null))[_0x9482('0x2a')](saveUpdates(_0x26a27c[_0x9482('0x4f')],null))['then'](respondWithResult(_0x2c897c,null))[_0x9482('0x4b')](handleError(_0x2c897c,null));};exports['destroy']=function(_0x3407e4,_0x4363be){return db['Team']['find']({'where':{'id':_0x3407e4['params']['id']}})[_0x9482('0x2a')](handleEntityNotFound(_0x4363be,null))[_0x9482('0x2a')](removeEntity(_0x4363be,null))[_0x9482('0x4b')](handleError(_0x4363be,null));};exports[_0x9482('0x58')]=function(_0x11eb57,_0x18a805,_0xda8d61){return db[_0x9482('0x32')]['findOne']({'where':{'id':_0x11eb57[_0x9482('0x4d')]['id']}})['then'](handleEntityNotFound(_0x18a805,null))['then'](function(_0x2c4645){if(!_0x11eb57['query'][_0x9482('0x59')]||!utils[_0x9482('0x5a')](_0x11eb57[_0x9482('0x37')][_0x9482('0x59')])){throw new db[(_0x9482('0x5b'))]['ValidationError']('Unknown\x20channel');}var _0x27da95={};var _0x2424e4={};_0x2424e4[_0x9482('0x36')]=_[_0x9482('0x38')](db[_[_0x9482('0x5c')](_0x11eb57[_0x9482('0x37')][_0x9482('0x59')][_0x9482('0x5d')]())+_0x9482('0x5e')][_0x9482('0x5f')]);_0x2424e4[_0x9482('0x37')]=_[_0x9482('0x38')](_0x11eb57[_0x9482('0x37')]);_0x2424e4[_0x9482('0x39')]=_[_0x9482('0x3a')](_0x2424e4[_0x9482('0x36')],_0x2424e4[_0x9482('0x37')]);_0x27da95[_0x9482('0x3c')]=_[_0x9482('0x3a')](_0x2424e4['model'],qs[_0x9482('0x3b')](_0x11eb57[_0x9482('0x37')][_0x9482('0x3b')]));_0x27da95[_0x9482('0x3c')]=_0x27da95['attributes'][_0x9482('0x3d')]?_0x27da95[_0x9482('0x3c')]:_0x2424e4['model'];_0x27da95[_0x9482('0x22')]=qs[_0x9482('0x22')](_0x11eb57[_0x9482('0x37')][_0x9482('0x22')]);_0x27da95['offset']=qs['offset'](_0x11eb57[_0x9482('0x37')]['offset']);_0x27da95[_0x9482('0x40')]=qs[_0x9482('0x41')](_0x11eb57[_0x9482('0x37')]['sort']);_0x27da95[_0x9482('0x42')]=qs['filters'](_[_0x9482('0x60')](_0x11eb57['query'],_0x2424e4[_0x9482('0x39')]));_0x27da95=_[_0x9482('0x44')]({},_0x27da95,_0x11eb57[_0x9482('0x47')]);return _0x2c4645[_0x9482('0x51')+_[_0x9482('0x5c')](_0x11eb57['query'][_0x9482('0x59')][_0x9482('0x5d')]())+_0x9482('0x61')](_0x27da95);})[_0x9482('0x2a')](respondWithResult(_0x18a805,null))[_0x9482('0x4b')](handleError(_0x18a805,null));};exports[_0x9482('0x62')]=function(_0x103dd1,_0x1bc873,_0x477f60){return db[_0x9482('0x32')][_0x9482('0x63')]({'where':{'id':_0x103dd1[_0x9482('0x4d')]['id']}})[_0x9482('0x2a')](function(_0x198d79){if(_0x198d79){if(!_0x103dd1[_0x9482('0x4f')][_0x9482('0x59')]||!utils['isValidChannel'](_0x103dd1[_0x9482('0x4f')][_0x9482('0x59')])){throw new db[(_0x9482('0x5b'))][(_0x9482('0x64'))](_0x9482('0x65'));}return _0x198d79['add'+_[_0x9482('0x5c')](_0x103dd1[_0x9482('0x4f')][_0x9482('0x59')]['toLowerCase']())+'Queues'](_0x103dd1['body'][_0x9482('0x66')]);}return null;})[_0x9482('0x2a')](handleEntityNotFound(_0x1bc873,null))[_0x9482('0x2a')](respondWithStatusCode(_0x1bc873,null))[_0x9482('0x4b')](handleError(_0x1bc873,null));};exports[_0x9482('0x67')]=function(_0x53e019,_0x97ccf9,_0x5b6438){return db['Team'][_0x9482('0x63')]({'where':{'id':_0x53e019[_0x9482('0x4d')]['id']}})[_0x9482('0x2a')](function(_0x43e770){if(_0x43e770){if(!_0x53e019[_0x9482('0x37')][_0x9482('0x59')]||!utils[_0x9482('0x5a')](_0x53e019[_0x9482('0x37')][_0x9482('0x59')])){throw new db[(_0x9482('0x5b'))]['ValidationError']('Unknown\x20channel');}return _0x43e770[_0x9482('0x68')+_[_0x9482('0x5c')](_0x53e019[_0x9482('0x37')][_0x9482('0x59')][_0x9482('0x5d')]())+_0x9482('0x61')](_0x53e019['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x97ccf9,null))[_0x9482('0x2a')](respondWithStatusCode(_0x97ccf9,null))[_0x9482('0x4b')](handleError(_0x97ccf9,null));};exports['addAgents']=function(_0x57dd84,_0x75aaa7){return db[_0x9482('0x32')][_0x9482('0x4e')]({'where':{'id':_0x57dd84[_0x9482('0x4d')]['id']}})['then'](handleEntityNotFound(_0x75aaa7,null))[_0x9482('0x2a')](function(_0x5e803b){if(_0x5e803b){var _0xdaf6fa=['Voice',_0x9482('0x69'),_0x9482('0x6a'),_0x9482('0x6b'),_0x9482('0x6c'),_0x9482('0x6d'),_0x9482('0x6e')];return db[_0x9482('0x6f')][_0x9482('0x70')](function(_0xa0b0c7){var _0x6e074a=_[_0x9482('0x45')](_0xdaf6fa,function(_0x130d91){var _0x265e28={'attributes':['id',_0x9482('0x30')]};if(_0x130d91===_0x9482('0x71')){_0x265e28[_0x9482('0x72')]={'attributes':[_0x9482('0x73')]};}return _0x5e803b[_0x9482('0x51')+_0x130d91+'Queues'](_0x265e28)[_0x9482('0x2a')](function(_0x22a0b6){var _0x21b6ee=_['map'](_0x22a0b6,function(_0x3dfdd3){var _0xe7027=_[_0x9482('0x45')](_0x57dd84[_0x9482('0x4f')][_0x9482('0x66')],function(_0x503477){var _0x12a08d={'where':{'UserId':_0x503477,[_0x130d91+_0x9482('0x74')]:_0x3dfdd3['id']},'transaction':_0xa0b0c7};if(_0x130d91===_0x9482('0x71')){_0x12a08d[_0x9482('0x75')]={'penalty':_0x3dfdd3['TeamVoiceQueue'][_0x9482('0x73')]};}return db[_0x9482('0x76')+_0x130d91+'Queue'][_0x9482('0x77')](_0x12a08d)[_0x9482('0x2a')](function(){socket[_0x9482('0x78')](_0x9482('0x50')+_0x130d91+_0x9482('0x79'),{'UserId':_0x503477,[_0x130d91+_0x9482('0x74')]:_0x3dfdd3['id']});if(_0x130d91!=='Voice')return;return db[_0x9482('0x76')][_0x9482('0x4a')]({'where':{'id':_0x57dd84[_0x9482('0x4f')]['ids'],'online':0x1},'attributes':['id',_0x9482('0x30'),_0x9482('0x7a'),'voicePause',_0x9482('0x7b')],'raw':!![]})[_0x9482('0x2a')](function(_0x7820cd){var _0x392962=_[_0x9482('0x45')](_0x7820cd,function(_0x163621){return db['UserVoiceQueueRt'][_0x9482('0x7c')]({'membername':_0x163621[_0x9482('0x30')],'UserId':_0x163621['id'],'queue_name':_0x3dfdd3[_0x9482('0x30')],'VoiceQueueId':_0x3dfdd3['id'],'interface':_[_0x9482('0x7d')](_0x163621[_0x9482('0x7b')])?util[_0x9482('0x7e')]('SIP/%s',_0x163621[_0x9482('0x30')]):_0x163621[_0x9482('0x7b')],'paused':_0x163621[_0x9482('0x7f')]||![],'penalty':_0x3dfdd3[_0x9482('0x80')][_0x9482('0x73')]},{'transaction':_0xa0b0c7});});return Promise[_0x9482('0x81')](_0x392962);});});});return Promise[_0x9482('0x81')](_0xe7027);});return Promise[_0x9482('0x81')](_0x21b6ee);});});return Promise[_0x9482('0x81')](_0x6e074a)[_0x9482('0x2a')](function(){return _0x5e803b[_0x9482('0x82')](_0x57dd84['body'][_0x9482('0x66')],{'transaction':_0xa0b0c7})[_0x9482('0x83')](function(_0x24137c){return _0x24137c;});});});}})[_0x9482('0x2a')](respondWithResult(_0x75aaa7,null))['catch'](handleError(_0x75aaa7,null));};exports[_0x9482('0x84')]=function(_0x2b1251,_0x50b979){return db[_0x9482('0x32')][_0x9482('0x4e')]({'where':{'id':_0x2b1251[_0x9482('0x4d')]['id']}})[_0x9482('0x2a')](handleEntityNotFound(_0x50b979,null))['then'](function(_0x1c97b8){if(_0x1c97b8){var _0x527145=['Voice',_0x9482('0x69'),_0x9482('0x6a'),_0x9482('0x6b'),'Fax',_0x9482('0x6d'),_0x9482('0x6e')];return db[_0x9482('0x6f')][_0x9482('0x70')](function(_0x301840){var _0x38c7be=_['map'](_0x527145,function(_0x83fe1e){var _0x13bb81={'attributes':['id','name']};return _0x1c97b8[_0x9482('0x51')+_0x83fe1e+_0x9482('0x61')](_0x13bb81)[_0x9482('0x2a')](function(_0x5d8090){var _0x18a588=_[_0x9482('0x45')](_0x5d8090,function(_0xb05442){return _0xb05442[_0x9482('0x84')](_0x2b1251['query']['ids'],{'transaction':_0x301840})[_0x9482('0x2a')](function(){var _0x27ae4f=JSON[_0x9482('0x85')]('['+_0x2b1251[_0x9482('0x37')][_0x9482('0x66')]+']');var _0x3bf3dc=_[_0x9482('0x45')](_0x27ae4f,function(_0x2a8299){socket['emit'](_0x9482('0x50')+_0x83fe1e+_0x9482('0x86'),{'UserId':Number(_0x2a8299),[_0x83fe1e+_0x9482('0x74')]:_0xb05442['id']});if(_0x83fe1e!=='Voice')return;return db[_0x9482('0x87')][_0x9482('0x2b')]({'where':{'VoiceQueueId':_0xb05442['id'],'UserId':_0x2a8299},'transaction':_0x301840});});return Promise[_0x9482('0x81')](_0x3bf3dc);});});return Promise[_0x9482('0x81')](_0x18a588);});});return Promise[_0x9482('0x81')](_0x38c7be)[_0x9482('0x2a')](function(){return _0x1c97b8[_0x9482('0x84')](_0x2b1251[_0x9482('0x37')][_0x9482('0x66')],{'transaction':_0x301840});});});}})[_0x9482('0x2a')](respondWithStatusCode(_0x50b979,null))['catch'](handleError(_0x50b979,null));};exports[_0x9482('0x88')]=function(_0x4cd94c,_0x3002bd,_0x1f2a4b){var _0x3c918d={};var _0x2408ab={};var _0x1c61d6;var _0x159904;return db[_0x9482('0x32')][_0x9482('0x63')]({'where':{'id':_0x4cd94c[_0x9482('0x4d')]['id']}})[_0x9482('0x2a')](handleEntityNotFound(_0x3002bd,null))[_0x9482('0x2a')](function(_0x450ca8){if(_0x450ca8){_0x1c61d6=_0x450ca8;_0x2408ab[_0x9482('0x36')]=_[_0x9482('0x38')](db['User']['rawAttributes']);_0x2408ab[_0x9482('0x37')]=_['keys'](_0x4cd94c[_0x9482('0x37')]);_0x2408ab['filters']=_[_0x9482('0x3a')](_0x2408ab[_0x9482('0x36')],_0x2408ab[_0x9482('0x37')]);_0x3c918d[_0x9482('0x3c')]=_['intersection'](_0x2408ab[_0x9482('0x36')],qs[_0x9482('0x3b')](_0x4cd94c[_0x9482('0x37')][_0x9482('0x3b')]));_0x3c918d['attributes']=_0x3c918d[_0x9482('0x3c')][_0x9482('0x3d')]?_0x3c918d[_0x9482('0x3c')]:_0x2408ab[_0x9482('0x36')];_0x3c918d['order']=qs['sort'](_0x4cd94c[_0x9482('0x37')][_0x9482('0x41')]);_0x3c918d[_0x9482('0x42')]=qs['filters'](_[_0x9482('0x60')](_0x4cd94c['query'],_0x2408ab[_0x9482('0x39')]));if(_0x4cd94c[_0x9482('0x37')][_0x9482('0x43')]){_0x3c918d[_0x9482('0x42')]=_['merge'](_0x3c918d[_0x9482('0x42')],{'$or':_[_0x9482('0x45')](_0x3c918d[_0x9482('0x3c')],function(_0x2f3d9d){var _0x100dfb={};_0x100dfb[_0x2f3d9d]={'$like':'%'+_0x4cd94c[_0x9482('0x37')][_0x9482('0x43')]+'%'};return _0x100dfb;})});}_0x3c918d=_[_0x9482('0x44')]({},_0x3c918d,_0x4cd94c[_0x9482('0x47')]);return _0x1c61d6[_0x9482('0x88')](_0x3c918d);}})['then'](function(_0x3bb41c){if(_0x3bb41c){_0x159904=_0x3bb41c[_0x9482('0x3d')];if(!_0x4cd94c['query'][_0x9482('0x3e')](_0x9482('0x3f'))){_0x3c918d['limit']=qs['limit'](_0x4cd94c[_0x9482('0x37')]['limit']);_0x3c918d[_0x9482('0x21')]=qs['offset'](_0x4cd94c[_0x9482('0x37')]['offset']);}return _0x1c61d6[_0x9482('0x88')](_0x3c918d);}})[_0x9482('0x2a')](function(_0x56d4c1){if(_0x56d4c1){return _0x56d4c1?{'count':_0x159904,'rows':_0x56d4c1}:null;}})[_0x9482('0x2a')](respondWithResult(_0x3002bd,null))[_0x9482('0x4b')](handleError(_0x3002bd,null));}; \ No newline at end of file +var _0x1a81=['all','spread','removeAgents','transaction','parse','getAgents','eml-format','rimraf','zip-dir','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','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','destroy','name','send','index','Team','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','rows','show','params','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','ValidationError','toLowerCase','Queue','Queues','addQueues','Sequelize','Unknown\x20channel','capitalize','ids','removeQueues','remove','addAgents','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','Voice','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','isNil','SIP/%s'];(function(_0x22bc09,_0x516bec){var _0x441ba2=function(_0x594288){while(--_0x594288){_0x22bc09['push'](_0x22bc09['shift']());}};_0x441ba2(++_0x516bec);}(_0x1a81,0x19b));var _0x11a8=function(_0x2085f3,_0x13c570){_0x2085f3=_0x2085f3-0x0;var _0x189d5d=_0x1a81[_0x2085f3];return _0x189d5d;};'use strict';var emlformat=require(_0x11a8('0x0'));var rimraf=require(_0x11a8('0x1'));var zipdir=require(_0x11a8('0x2'));var jsonpatch=require(_0x11a8('0x3'));var rp=require(_0x11a8('0x4'));var moment=require(_0x11a8('0x5'));var BPromise=require(_0x11a8('0x6'));var Mustache=require(_0x11a8('0x7'));var util=require(_0x11a8('0x8'));var path=require(_0x11a8('0x9'));var sox=require(_0x11a8('0xa'));var csv=require(_0x11a8('0xb'));var ejs=require(_0x11a8('0xc'));var fs=require('fs');var fs_extra=require(_0x11a8('0xd'));var _=require(_0x11a8('0xe'));var squel=require(_0x11a8('0xf'));var crypto=require('crypto');var jsforce=require(_0x11a8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x11a8('0xb'));var querystring=require(_0x11a8('0x11'));var Papa=require(_0x11a8('0x12'));var Redis=require('ioredis');var authService=require(_0x11a8('0x13'));var qs=require(_0x11a8('0x14'));var as=require(_0x11a8('0x15'));var hardwareService=require(_0x11a8('0x16'));var logger=require(_0x11a8('0x17'))(_0x11a8('0x18'));var utils=require(_0x11a8('0x19'));var config=require(_0x11a8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x11a8('0x1b'))['db'];config['redis']=_[_0x11a8('0x1c')](config[_0x11a8('0x1d')],{'host':_0x11a8('0x1e'),'port':0x18eb});var socket=require(_0x11a8('0x1f'))(new Redis(config[_0x11a8('0x1d')]));require(_0x11a8('0x20'))[_0x11a8('0x21')](socket);function respondWithStatusCode(_0x9948c7,_0x598cec){_0x598cec=_0x598cec||0xcc;return function(_0x6e9654){if(_0x6e9654){return _0x9948c7[_0x11a8('0x22')](_0x598cec);}return _0x9948c7[_0x11a8('0x23')](_0x598cec)[_0x11a8('0x24')]();};}function respondWithResult(_0x43cb29,_0x78748c){_0x78748c=_0x78748c||0xc8;return function(_0x2b3f1f){if(_0x2b3f1f){return _0x43cb29['status'](_0x78748c)[_0x11a8('0x25')](_0x2b3f1f);}};}function respondWithFilteredResult(_0x1cae52,_0x5ebd86){return function(_0x2b52dd){if(_0x2b52dd){var _0x152743=typeof _0x5ebd86[_0x11a8('0x26')]===_0x11a8('0x27')&&typeof _0x5ebd86[_0x11a8('0x28')]==='undefined';var _0x11a42c=_0x2b52dd[_0x11a8('0x29')];var _0x344d85=_0x152743?0x0:_0x5ebd86[_0x11a8('0x26')];var _0x2f8bcf=_0x152743?_0x2b52dd[_0x11a8('0x29')]:_0x5ebd86[_0x11a8('0x26')]+_0x5ebd86[_0x11a8('0x28')];var _0x342f51;if(_0x2f8bcf>=_0x11a42c){_0x2f8bcf=_0x11a42c;_0x342f51=0xc8;}else{_0x342f51=0xce;}_0x1cae52[_0x11a8('0x23')](_0x342f51);return _0x1cae52['set'](_0x11a8('0x2a'),_0x344d85+'-'+_0x2f8bcf+'/'+_0x11a42c)[_0x11a8('0x25')](_0x2b52dd);}return null;};}function patchUpdates(_0x157bcf){return function(_0x293e07){try{jsonpatch[_0x11a8('0x2b')](_0x293e07,_0x157bcf,!![]);}catch(_0x564725){return BPromise[_0x11a8('0x2c')](_0x564725);}return _0x293e07[_0x11a8('0x2d')]();};}function saveUpdates(_0x223884,_0x32afc6){return function(_0x35aca7){if(_0x35aca7){return _0x35aca7['update'](_0x223884)[_0x11a8('0x2e')](function(_0x2edff2){return _0x2edff2;});}return null;};}function removeEntity(_0x550523,_0x37c5ea){return function(_0x903f33){if(_0x903f33){return _0x903f33['destroy']()[_0x11a8('0x2e')](function(){var _0x56df84=_0x903f33[_0x11a8('0x2f')]({'plain':!![]});var _0x1b8c9c='Teams';return db['UserProfileResource'][_0x11a8('0x30')]({'where':{'type':_0x1b8c9c,'resourceId':_0x56df84['id']}})[_0x11a8('0x2e')](function(){return _0x903f33;});})[_0x11a8('0x2e')](function(){_0x550523['status'](0xcc)[_0x11a8('0x24')]();});}};}function handleEntityNotFound(_0x52923c,_0x557829){return function(_0xae0df8){if(!_0xae0df8){_0x52923c['sendStatus'](0x194);}return _0xae0df8;};}function handleError(_0x26d6b6,_0x223960){_0x223960=_0x223960||0x1f4;return function(_0x300a99){logger['error'](_0x300a99['stack']);if(_0x300a99[_0x11a8('0x31')]){delete _0x300a99[_0x11a8('0x31')];}_0x26d6b6['status'](_0x223960)[_0x11a8('0x32')](_0x300a99);};}exports[_0x11a8('0x33')]=function(_0x48696d,_0x1fc63c){var _0x338dbe={},_0x554dc7={},_0x2ce12a={'count':0x0,'rows':[]};var _0x1e0668=_['map'](db[_0x11a8('0x34')][_0x11a8('0x35')],function(_0x4c9d21){return{'name':_0x4c9d21[_0x11a8('0x36')],'type':_0x4c9d21[_0x11a8('0x37')]['key']};});_0x554dc7[_0x11a8('0x38')]=_['map'](_0x1e0668,_0x11a8('0x31'));_0x554dc7[_0x11a8('0x39')]=_[_0x11a8('0x3a')](_0x48696d['query']);_0x554dc7[_0x11a8('0x3b')]=_['intersection'](_0x554dc7[_0x11a8('0x38')],_0x554dc7[_0x11a8('0x39')]);_0x338dbe[_0x11a8('0x3c')]=_[_0x11a8('0x3d')](_0x554dc7[_0x11a8('0x38')],qs[_0x11a8('0x3e')](_0x48696d['query'][_0x11a8('0x3e')]));_0x338dbe[_0x11a8('0x3c')]=_0x338dbe[_0x11a8('0x3c')]['length']?_0x338dbe[_0x11a8('0x3c')]:_0x554dc7[_0x11a8('0x38')];if(!_0x48696d['query'][_0x11a8('0x3f')](_0x11a8('0x40'))){_0x338dbe['limit']=qs[_0x11a8('0x28')](_0x48696d[_0x11a8('0x39')][_0x11a8('0x28')]);_0x338dbe[_0x11a8('0x26')]=qs[_0x11a8('0x26')](_0x48696d['query'][_0x11a8('0x26')]);}_0x338dbe[_0x11a8('0x41')]=qs[_0x11a8('0x42')](_0x48696d[_0x11a8('0x39')]['sort']);_0x338dbe[_0x11a8('0x43')]=qs[_0x11a8('0x3b')](_[_0x11a8('0x44')](_0x48696d['query'],_0x554dc7['filters']),_0x1e0668);if(_0x48696d[_0x11a8('0x39')][_0x11a8('0x45')]){_0x338dbe[_0x11a8('0x43')]=_['merge'](_0x338dbe[_0x11a8('0x43')],{'$or':_[_0x11a8('0x46')](_0x1e0668,function(_0x2d2f09){if(_0x2d2f09['type']!==_0x11a8('0x47')){var _0x130fc8={};_0x130fc8[_0x2d2f09[_0x11a8('0x31')]]={'$like':'%'+_0x48696d[_0x11a8('0x39')]['filter']+'%'};return _0x130fc8;}})});}_0x338dbe=_[_0x11a8('0x48')]({},_0x338dbe,_0x48696d['options']);var _0x140f41={'where':_0x338dbe[_0x11a8('0x43')]};return db['Team'][_0x11a8('0x29')](_0x140f41)[_0x11a8('0x2e')](function(_0x2b2d6c){_0x2ce12a['count']=_0x2b2d6c;if(_0x48696d['query'][_0x11a8('0x49')]){_0x338dbe[_0x11a8('0x4a')]=[{'all':!![]}];}return db[_0x11a8('0x34')]['findAll'](_0x338dbe);})['then'](function(_0x1780aa){_0x2ce12a[_0x11a8('0x4b')]=_0x1780aa;return _0x2ce12a;})[_0x11a8('0x2e')](respondWithFilteredResult(_0x1fc63c,_0x338dbe))['catch'](handleError(_0x1fc63c,null));};exports[_0x11a8('0x4c')]=function(_0x2ab44c,_0x624d7b){var _0x58f7a0={'raw':![],'where':{'id':_0x2ab44c[_0x11a8('0x4d')]['id']}},_0x424555={};_0x424555[_0x11a8('0x38')]=_[_0x11a8('0x3a')](db[_0x11a8('0x34')]['rawAttributes']);_0x424555['query']=_['keys'](_0x2ab44c[_0x11a8('0x39')]);_0x424555[_0x11a8('0x3b')]=_['intersection'](_0x424555[_0x11a8('0x38')],_0x424555[_0x11a8('0x39')]);_0x58f7a0[_0x11a8('0x3c')]=_['intersection'](_0x424555['model'],qs[_0x11a8('0x3e')](_0x2ab44c[_0x11a8('0x39')][_0x11a8('0x3e')]));_0x58f7a0[_0x11a8('0x3c')]=_0x58f7a0[_0x11a8('0x3c')][_0x11a8('0x4e')]?_0x58f7a0[_0x11a8('0x3c')]:_0x424555[_0x11a8('0x38')];if(_0x2ab44c[_0x11a8('0x39')][_0x11a8('0x49')]){_0x58f7a0[_0x11a8('0x4a')]=[{'all':!![]}];}_0x58f7a0=_[_0x11a8('0x48')]({},_0x58f7a0,_0x2ab44c[_0x11a8('0x4f')]);return db['Team'][_0x11a8('0x50')](_0x58f7a0)['then'](handleEntityNotFound(_0x624d7b,null))['then'](respondWithResult(_0x624d7b,null))[_0x11a8('0x51')](handleError(_0x624d7b,null));};exports['create']=function(_0x3887a0,_0x27ea11){return db[_0x11a8('0x34')][_0x11a8('0x52')](_0x3887a0[_0x11a8('0x53')],{})['then'](function(_0x585826){var _0x4b43b5=_0x3887a0[_0x11a8('0x54')][_0x11a8('0x2f')]({'plain':!![]});if(!_0x4b43b5)throw new Error(_0x11a8('0x55'));if(_0x4b43b5[_0x11a8('0x56')]===_0x11a8('0x54')){var _0x46ce89=_0x585826[_0x11a8('0x2f')]({'plain':!![]});var _0x45d8d7=_0x11a8('0x57');return db[_0x11a8('0x58')][_0x11a8('0x50')]({'where':{'name':_0x45d8d7,'userProfileId':_0x4b43b5['userProfileId']},'raw':!![]})[_0x11a8('0x2e')](function(_0x5d59e9){if(_0x5d59e9&&_0x5d59e9[_0x11a8('0x59')]===0x0){return db[_0x11a8('0x5a')][_0x11a8('0x52')]({'name':_0x46ce89['name'],'resourceId':_0x46ce89['id'],'type':_0x5d59e9[_0x11a8('0x31')],'sectionId':_0x5d59e9['id']},{})['then'](function(){return _0x585826;});}else{return _0x585826;}})['catch'](function(_0x2e4e6c){logger[_0x11a8('0x5b')](_0x11a8('0x5c'),_0x2e4e6c);throw _0x2e4e6c;});}return _0x585826;})[_0x11a8('0x2e')](respondWithResult(_0x27ea11,0xc9))[_0x11a8('0x51')](handleError(_0x27ea11,null));};exports['update']=function(_0x11796a,_0x32a3d7){if(_0x11796a['body']['id']){delete _0x11796a['body']['id'];}return db[_0x11a8('0x34')]['find']({'where':{'id':_0x11796a[_0x11a8('0x4d')]['id']}})[_0x11a8('0x2e')](handleEntityNotFound(_0x32a3d7,null))[_0x11a8('0x2e')](saveUpdates(_0x11796a['body'],null))['then'](respondWithResult(_0x32a3d7,null))[_0x11a8('0x51')](handleError(_0x32a3d7,null));};exports[_0x11a8('0x30')]=function(_0x5b9d2b,_0x27af45){return db[_0x11a8('0x34')][_0x11a8('0x50')]({'where':{'id':_0x5b9d2b['params']['id']}})[_0x11a8('0x2e')](handleEntityNotFound(_0x27af45,null))['then'](removeEntity(_0x27af45,null))['catch'](handleError(_0x27af45,null));};exports[_0x11a8('0x5d')]=function(_0x3ef9f9,_0x123d92,_0x4ffea1){return db['Team'][_0x11a8('0x5e')]({'where':{'id':_0x3ef9f9['params']['id']}})[_0x11a8('0x2e')](handleEntityNotFound(_0x123d92,null))[_0x11a8('0x2e')](function(_0x364111){if(!_0x3ef9f9[_0x11a8('0x39')][_0x11a8('0x5f')]||!utils[_0x11a8('0x60')](_0x3ef9f9['query'][_0x11a8('0x5f')])){throw new db['Sequelize'][(_0x11a8('0x61'))]('Unknown\x20channel');}var _0x237244={};var _0x7ead23={};_0x7ead23['model']=_[_0x11a8('0x3a')](db[_['capitalize'](_0x3ef9f9['query'][_0x11a8('0x5f')][_0x11a8('0x62')]())+_0x11a8('0x63')][_0x11a8('0x35')]);_0x7ead23['query']=_[_0x11a8('0x3a')](_0x3ef9f9['query']);_0x7ead23[_0x11a8('0x3b')]=_[_0x11a8('0x3d')](_0x7ead23[_0x11a8('0x38')],_0x7ead23[_0x11a8('0x39')]);_0x237244[_0x11a8('0x3c')]=_[_0x11a8('0x3d')](_0x7ead23[_0x11a8('0x38')],qs[_0x11a8('0x3e')](_0x3ef9f9[_0x11a8('0x39')][_0x11a8('0x3e')]));_0x237244[_0x11a8('0x3c')]=_0x237244[_0x11a8('0x3c')][_0x11a8('0x4e')]?_0x237244[_0x11a8('0x3c')]:_0x7ead23[_0x11a8('0x38')];_0x237244[_0x11a8('0x28')]=qs[_0x11a8('0x28')](_0x3ef9f9['query'][_0x11a8('0x28')]);_0x237244['offset']=qs['offset'](_0x3ef9f9['query'][_0x11a8('0x26')]);_0x237244[_0x11a8('0x41')]=qs['sort'](_0x3ef9f9[_0x11a8('0x39')]['sort']);_0x237244[_0x11a8('0x43')]=qs['filters'](_['pick'](_0x3ef9f9['query'],_0x7ead23[_0x11a8('0x3b')]));_0x237244=_[_0x11a8('0x48')]({},_0x237244,_0x3ef9f9[_0x11a8('0x4f')]);return _0x364111[_0x11a8('0x2f')+_['capitalize'](_0x3ef9f9[_0x11a8('0x39')]['channel'][_0x11a8('0x62')]())+_0x11a8('0x64')](_0x237244);})['then'](respondWithResult(_0x123d92,null))[_0x11a8('0x51')](handleError(_0x123d92,null));};exports[_0x11a8('0x65')]=function(_0x5260d5,_0x1cebfb,_0x2dbdbe){return db['Team']['findOne']({'where':{'id':_0x5260d5[_0x11a8('0x4d')]['id']}})[_0x11a8('0x2e')](function(_0x2a47df){if(_0x2a47df){if(!_0x5260d5[_0x11a8('0x53')][_0x11a8('0x5f')]||!utils['isValidChannel'](_0x5260d5[_0x11a8('0x53')]['channel'])){throw new db[(_0x11a8('0x66'))]['ValidationError'](_0x11a8('0x67'));}return _0x2a47df['add'+_[_0x11a8('0x68')](_0x5260d5[_0x11a8('0x53')][_0x11a8('0x5f')][_0x11a8('0x62')]())+_0x11a8('0x64')](_0x5260d5[_0x11a8('0x53')][_0x11a8('0x69')]);}return null;})[_0x11a8('0x2e')](handleEntityNotFound(_0x1cebfb,null))['then'](respondWithStatusCode(_0x1cebfb,null))['catch'](handleError(_0x1cebfb,null));};exports[_0x11a8('0x6a')]=function(_0x2ae6ff,_0x199696,_0xa22873){return db[_0x11a8('0x34')][_0x11a8('0x5e')]({'where':{'id':_0x2ae6ff['params']['id']}})['then'](function(_0x1114d5){if(_0x1114d5){if(!_0x2ae6ff[_0x11a8('0x39')]['channel']||!utils[_0x11a8('0x60')](_0x2ae6ff[_0x11a8('0x39')]['channel'])){throw new db[(_0x11a8('0x66'))][(_0x11a8('0x61'))](_0x11a8('0x67'));}return _0x1114d5[_0x11a8('0x6b')+_[_0x11a8('0x68')](_0x2ae6ff[_0x11a8('0x39')][_0x11a8('0x5f')][_0x11a8('0x62')]())+_0x11a8('0x64')](_0x2ae6ff[_0x11a8('0x39')]['ids']);}return null;})[_0x11a8('0x2e')](handleEntityNotFound(_0x199696,null))[_0x11a8('0x2e')](respondWithStatusCode(_0x199696,null))[_0x11a8('0x51')](handleError(_0x199696,null));};exports[_0x11a8('0x6c')]=function(_0x50ccf9,_0x3c7305){return db[_0x11a8('0x34')][_0x11a8('0x50')]({'where':{'id':_0x50ccf9[_0x11a8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3c7305,null))['then'](function(_0x197152){if(_0x197152){var _0x37d532=['Voice','Chat',_0x11a8('0x6d'),_0x11a8('0x6e'),_0x11a8('0x6f'),_0x11a8('0x70'),_0x11a8('0x71')];return db[_0x11a8('0x72')]['transaction'](function(_0x1972b5){var _0x11afe7=_['map'](_0x37d532,function(_0x55bd05){var _0x54c786={'attributes':['id',_0x11a8('0x31')]};if(_0x55bd05===_0x11a8('0x73')){_0x54c786[_0x11a8('0x74')]={'attributes':['penalty']};}return _0x197152['get'+_0x55bd05+_0x11a8('0x64')](_0x54c786)['then'](function(_0x5c642c){var _0x8b3661=_[_0x11a8('0x46')](_0x5c642c,function(_0x5d88a7){var _0x4c9e9c=_['map'](_0x50ccf9['body']['ids'],function(_0x1b0285){var _0x1ddede={'where':{'UserId':_0x1b0285,[_0x55bd05+_0x11a8('0x75')]:_0x5d88a7['id']},'transaction':_0x1972b5};if(_0x55bd05==='Voice'){_0x1ddede[_0x11a8('0x1c')]={'penalty':_0x5d88a7[_0x11a8('0x76')][_0x11a8('0x77')]};}return db[_0x11a8('0x78')+_0x55bd05+_0x11a8('0x63')][_0x11a8('0x79')](_0x1ddede)[_0x11a8('0x2e')](function(){socket[_0x11a8('0x7a')]('user'+_0x55bd05+_0x11a8('0x7b'),{'UserId':_0x1b0285,[_0x55bd05+_0x11a8('0x75')]:_0x5d88a7['id']});if(_0x55bd05!==_0x11a8('0x73'))return;return db['User']['findAll']({'where':{'id':_0x50ccf9['body'][_0x11a8('0x69')],'online':0x1},'attributes':['id','name','online',_0x11a8('0x7c'),_0x11a8('0x7d')],'raw':!![]})[_0x11a8('0x2e')](function(_0xd03d23){var _0x3c7b2c=_['map'](_0xd03d23,function(_0x21b638){return db[_0x11a8('0x7e')]['upsert']({'membername':_0x21b638['name'],'UserId':_0x21b638['id'],'queue_name':_0x5d88a7['name'],'VoiceQueueId':_0x5d88a7['id'],'interface':_[_0x11a8('0x7f')](_0x21b638[_0x11a8('0x7d')])?util['format'](_0x11a8('0x80'),_0x21b638[_0x11a8('0x31')]):_0x21b638['interface'],'paused':_0x21b638[_0x11a8('0x7c')]||![],'penalty':_0x5d88a7[_0x11a8('0x76')][_0x11a8('0x77')]},{'transaction':_0x1972b5});});return Promise[_0x11a8('0x81')](_0x3c7b2c);});});});return Promise[_0x11a8('0x81')](_0x4c9e9c);});return Promise[_0x11a8('0x81')](_0x8b3661);});});return Promise[_0x11a8('0x81')](_0x11afe7)['then'](function(){return _0x197152['addAgents'](_0x50ccf9['body'][_0x11a8('0x69')],{'transaction':_0x1972b5})[_0x11a8('0x82')](function(_0x424fc0){return _0x424fc0;});});});}})[_0x11a8('0x2e')](respondWithResult(_0x3c7305,null))[_0x11a8('0x51')](handleError(_0x3c7305,null));};exports[_0x11a8('0x83')]=function(_0x10118f,_0x88057d){return db[_0x11a8('0x34')][_0x11a8('0x50')]({'where':{'id':_0x10118f['params']['id']}})['then'](handleEntityNotFound(_0x88057d,null))['then'](function(_0x471c98){if(_0x471c98){var _0x536525=['Voice','Chat',_0x11a8('0x6d'),_0x11a8('0x6e'),_0x11a8('0x6f'),_0x11a8('0x70'),_0x11a8('0x71')];return db[_0x11a8('0x72')][_0x11a8('0x84')](function(_0x313f9d){var _0x21dfc3=_[_0x11a8('0x46')](_0x536525,function(_0x1b2449){var _0x578dec={'attributes':['id',_0x11a8('0x31')]};return _0x471c98[_0x11a8('0x2f')+_0x1b2449+_0x11a8('0x64')](_0x578dec)[_0x11a8('0x2e')](function(_0x1500fb){var _0x32c4f1=_[_0x11a8('0x46')](_0x1500fb,function(_0x1e32b0){return _0x1e32b0[_0x11a8('0x83')](_0x10118f[_0x11a8('0x39')][_0x11a8('0x69')],{'transaction':_0x313f9d})[_0x11a8('0x2e')](function(){var _0x2a3aa2=JSON[_0x11a8('0x85')]('['+_0x10118f[_0x11a8('0x39')][_0x11a8('0x69')]+']');var _0x151804=_[_0x11a8('0x46')](_0x2a3aa2,function(_0x299a26){socket[_0x11a8('0x7a')](_0x11a8('0x54')+_0x1b2449+'Queue:remove',{'UserId':Number(_0x299a26),[_0x1b2449+_0x11a8('0x75')]:_0x1e32b0['id']});if(_0x1b2449!==_0x11a8('0x73'))return;return db[_0x11a8('0x7e')][_0x11a8('0x30')]({'where':{'VoiceQueueId':_0x1e32b0['id'],'UserId':_0x299a26},'transaction':_0x313f9d});});return Promise['all'](_0x151804);});});return Promise['all'](_0x32c4f1);});});return Promise['all'](_0x21dfc3)[_0x11a8('0x2e')](function(){return _0x471c98[_0x11a8('0x83')](_0x10118f[_0x11a8('0x39')]['ids'],{'transaction':_0x313f9d});});});}})[_0x11a8('0x2e')](respondWithStatusCode(_0x88057d,null))['catch'](handleError(_0x88057d,null));};exports[_0x11a8('0x86')]=function(_0x58b912,_0x30026b,_0x133785){var _0x21ae5e={};var _0x452f73={};var _0x5f1fa6;var _0x31eb2d;return db[_0x11a8('0x34')][_0x11a8('0x5e')]({'where':{'id':_0x58b912[_0x11a8('0x4d')]['id']}})[_0x11a8('0x2e')](handleEntityNotFound(_0x30026b,null))[_0x11a8('0x2e')](function(_0x5f3620){if(_0x5f3620){_0x5f1fa6=_0x5f3620;_0x452f73['model']=_[_0x11a8('0x3a')](db[_0x11a8('0x78')][_0x11a8('0x35')]);_0x452f73[_0x11a8('0x39')]=_[_0x11a8('0x3a')](_0x58b912['query']);_0x452f73[_0x11a8('0x3b')]=_[_0x11a8('0x3d')](_0x452f73['model'],_0x452f73[_0x11a8('0x39')]);_0x21ae5e['attributes']=_[_0x11a8('0x3d')](_0x452f73[_0x11a8('0x38')],qs[_0x11a8('0x3e')](_0x58b912['query'][_0x11a8('0x3e')]));_0x21ae5e['attributes']=_0x21ae5e[_0x11a8('0x3c')][_0x11a8('0x4e')]?_0x21ae5e[_0x11a8('0x3c')]:_0x452f73['model'];_0x21ae5e[_0x11a8('0x41')]=qs['sort'](_0x58b912[_0x11a8('0x39')][_0x11a8('0x42')]);_0x21ae5e[_0x11a8('0x43')]=qs[_0x11a8('0x3b')](_[_0x11a8('0x44')](_0x58b912[_0x11a8('0x39')],_0x452f73[_0x11a8('0x3b')]));if(_0x58b912[_0x11a8('0x39')][_0x11a8('0x45')]){_0x21ae5e[_0x11a8('0x43')]=_['merge'](_0x21ae5e[_0x11a8('0x43')],{'$or':_[_0x11a8('0x46')](_0x21ae5e[_0x11a8('0x3c')],function(_0x4b5527){var _0x449fec={};_0x449fec[_0x4b5527]={'$like':'%'+_0x58b912['query'][_0x11a8('0x45')]+'%'};return _0x449fec;})});}_0x21ae5e=_[_0x11a8('0x48')]({},_0x21ae5e,_0x58b912[_0x11a8('0x4f')]);return _0x5f1fa6[_0x11a8('0x86')](_0x21ae5e);}})['then'](function(_0x7144cb){if(_0x7144cb){_0x31eb2d=_0x7144cb[_0x11a8('0x4e')];if(!_0x58b912['query'][_0x11a8('0x3f')](_0x11a8('0x40'))){_0x21ae5e[_0x11a8('0x28')]=qs[_0x11a8('0x28')](_0x58b912['query'][_0x11a8('0x28')]);_0x21ae5e['offset']=qs[_0x11a8('0x26')](_0x58b912[_0x11a8('0x39')][_0x11a8('0x26')]);}return _0x5f1fa6['getAgents'](_0x21ae5e);}})[_0x11a8('0x2e')](function(_0x10a6fb){if(_0x10a6fb){return _0x10a6fb?{'count':_0x31eb2d,'rows':_0x10a6fb}:null;}})[_0x11a8('0x2e')](respondWithResult(_0x30026b,null))['catch'](handleError(_0x30026b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 969c3a8..d4d1130 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 _0xb226=['../../mysqldb','Team','update','emit','hook','exports','events'];(function(_0xb1174e,_0x1e68a7){var _0x285bac=function(_0x32c505){while(--_0x32c505){_0xb1174e['push'](_0xb1174e['shift']());}};_0x285bac(++_0x1e68a7);}(_0xb226,0xa0));var _0x6b22=function(_0x4e7a44,_0xe11d1b){_0x4e7a44=_0x4e7a44-0x0;var _0x2d2076=_0xb226[_0x4e7a44];return _0x2d2076;};'use strict';var EventEmitter=require(_0x6b22('0x0'));var Team=require(_0x6b22('0x1'))['db'][_0x6b22('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b22('0x3'),'afterDestroy':'remove'};function emitEvent(_0x205cbf){return function(_0x322e86,_0x1a6d1a,_0x437d82){TeamEvents[_0x6b22('0x4')](_0x205cbf+':'+_0x322e86['id'],_0x322e86);TeamEvents[_0x6b22('0x4')](_0x205cbf,_0x322e86);_0x437d82(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x6b22('0x5')](e,emitEvent(event));}}module[_0x6b22('0x6')]=TeamEvents; \ No newline at end of file +var _0x167e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x167e,0x102));var _0xe167=function(_0x334cdd,_0x9c3982){_0x334cdd=_0x334cdd-0x0;var _0x53c49d=_0x167e[_0x334cdd];return _0x53c49d;};'use strict';var EventEmitter=require(_0xe167('0x0'));var Team=require(_0xe167('0x1'))['db'][_0xe167('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xe167('0x3')](0x0);var events={'afterCreate':_0xe167('0x4'),'afterUpdate':_0xe167('0x5'),'afterDestroy':_0xe167('0x6')};function emitEvent(_0x36be7){return function(_0x2bb1e3,_0x530b1f,_0x52872a){TeamEvents[_0xe167('0x7')](_0x36be7+':'+_0x2bb1e3['id'],_0x2bb1e3);TeamEvents['emit'](_0x36be7,_0x2bb1e3);_0x52872a(null);};}for(var e in events){if(events[_0xe167('0x8')](e)){var event=events[e];Team[_0xe167('0x9')](e,emitEvent(event));}}module[_0xe167('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index f0ff9b0..eb71d5b 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 _0xb945=['./team.attributes','exports','define','teams','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x57403d,_0x2d1d07){var _0x24ebef=function(_0x1e361b){while(--_0x1e361b){_0x57403d['push'](_0x57403d['shift']());}};_0x24ebef(++_0x2d1d07);}(_0xb945,0x70));var _0x5b94=function(_0x2bf9ee,_0x1a3233){_0x2bf9ee=_0x2bf9ee-0x0;var _0x4ed4bb=_0xb945[_0x2bf9ee];return _0x4ed4bb;};'use strict';var _=require(_0x5b94('0x0'));var util=require(_0x5b94('0x1'));var logger=require(_0x5b94('0x2'))(_0x5b94('0x3'));var moment=require('moment');var BPromise=require(_0x5b94('0x4'));var rp=require(_0x5b94('0x5'));var fs=require('fs');var path=require(_0x5b94('0x6'));var rimraf=require('rimraf');var config=require(_0x5b94('0x7'));var attributes=require(_0x5b94('0x8'));module[_0x5b94('0x9')]=function(_0x281725,_0x43b9c8){return _0x281725[_0x5b94('0xa')]('Team',attributes,{'tableName':_0x5b94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5dd=['define','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa5dd,0xa8));var _0xda5d=function(_0x7f2994,_0x5273b7){_0x7f2994=_0x7f2994-0x0;var _0x52d36c=_0xa5dd[_0x7f2994];return _0x52d36c;};'use strict';var _=require(_0xda5d('0x0'));var util=require(_0xda5d('0x1'));var logger=require(_0xda5d('0x2'))(_0xda5d('0x3'));var moment=require(_0xda5d('0x4'));var BPromise=require(_0xda5d('0x5'));var rp=require(_0xda5d('0x6'));var fs=require('fs');var path=require(_0xda5d('0x7'));var rimraf=require(_0xda5d('0x8'));var config=require(_0xda5d('0x9'));var attributes=require(_0xda5d('0xa'));module[_0xda5d('0xb')]=function(_0x20dacb,_0x5e3019){return _0x20dacb[_0xda5d('0xc')](_0xda5d('0xd'),attributes,{'tableName':_0xda5d('0xe'),'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 2b75d54..1126959 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 _0xdeab=['redis','defaults','localhost','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x57b89d,_0x27bd3d){var _0x4f48ac=function(_0x2a56fb){while(--_0x2a56fb){_0x57b89d['push'](_0x57b89d['shift']());}};_0x4f48ac(++_0x27bd3d);}(_0xdeab,0x12d));var _0xbdea=function(_0x3f55f0,_0x322fdf){_0x3f55f0=_0x3f55f0-0x0;var _0x405e92=_0xdeab[_0x3f55f0];return _0x405e92;};'use strict';var _=require(_0xbdea('0x0'));var util=require(_0xbdea('0x1'));var moment=require('moment');var BPromise=require(_0xbdea('0x2'));var rs=require(_0xbdea('0x3'));var fs=require('fs');var Redis=require(_0xbdea('0x4'));var db=require(_0xbdea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdea('0x6'))('rpc');var config=require(_0xbdea('0x7'));var jayson=require(_0xbdea('0x8'));var client=jayson[_0xbdea('0x9')][_0xbdea('0xa')]({'port':0x232a});config[_0xbdea('0xb')]=_[_0xbdea('0xc')](config[_0xbdea('0xb')],{'host':_0xbdea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbdea('0xb')]));require(_0xbdea('0xe'))['register'](socket);function respondWithRpcPromise(_0x1f5837,_0x1f26ac,_0x15686b){return new BPromise(function(_0x14265f,_0x3c8a63){return client[_0xbdea('0xf')](_0x1f5837,_0x15686b)['then'](function(_0x4ff661){logger[_0xbdea('0x10')](_0xbdea('0x11'),_0x1f26ac,_0xbdea('0x12'));logger[_0xbdea('0x13')](_0xbdea('0x14'),_0x1f26ac,_0xbdea('0x12'),JSON['stringify'](_0x4ff661));if(_0x4ff661['error']){if(_0x4ff661['error']['code']===0x1f4){logger[_0xbdea('0x15')](_0xbdea('0x11'),_0x1f26ac,_0x4ff661['error']['message']);return _0x3c8a63(_0x4ff661['error'][_0xbdea('0x16')]);}logger[_0xbdea('0x15')]('Team,\x20%s,\x20%s',_0x1f26ac,_0x4ff661[_0xbdea('0x15')][_0xbdea('0x16')]);return _0x14265f(_0x4ff661['error'][_0xbdea('0x16')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x1f26ac,_0xbdea('0x12'));_0x14265f(_0x4ff661[_0xbdea('0x17')]['message']);}})['catch'](function(_0x38eefa){logger['error'](_0xbdea('0x11'),_0x1f26ac,_0x38eefa);_0x3c8a63(_0x38eefa);});});} \ No newline at end of file +var _0x40dc=['jayson/promise','http','redis','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3bf52e,_0xe846f5){var _0x76d727=function(_0x481902){while(--_0x481902){_0x3bf52e['push'](_0x3bf52e['shift']());}};_0x76d727(++_0xe846f5);}(_0x40dc,0x14a));var _0xc40d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40dc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc40d('0x0'));var util=require('util');var moment=require(_0xc40d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc40d('0x2'));var fs=require('fs');var Redis=require(_0xc40d('0x3'));var db=require(_0xc40d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc40d('0x5'))(_0xc40d('0x6'));var config=require(_0xc40d('0x7'));var jayson=require(_0xc40d('0x8'));var client=jayson['client'][_0xc40d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc40d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc40d('0xb'))(new Redis(config['redis']));require(_0xc40d('0xc'))[_0xc40d('0xd')](socket);function respondWithRpcPromise(_0x39ae5f,_0x1fcd82,_0x3e09b5){return new BPromise(function(_0x2c336a,_0x1ed9ed){return client[_0xc40d('0xe')](_0x39ae5f,_0x3e09b5)[_0xc40d('0xf')](function(_0x25f412){logger[_0xc40d('0x10')]('Team,\x20%s,\x20%s',_0x1fcd82,_0xc40d('0x11'));logger[_0xc40d('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x1fcd82,_0xc40d('0x11'),JSON[_0xc40d('0x13')](_0x25f412));if(_0x25f412[_0xc40d('0x14')]){if(_0x25f412[_0xc40d('0x14')][_0xc40d('0x15')]===0x1f4){logger[_0xc40d('0x14')](_0xc40d('0x16'),_0x1fcd82,_0x25f412['error']['message']);return _0x1ed9ed(_0x25f412['error']['message']);}logger['error'](_0xc40d('0x16'),_0x1fcd82,_0x25f412[_0xc40d('0x14')][_0xc40d('0x17')]);return _0x2c336a(_0x25f412[_0xc40d('0x14')][_0xc40d('0x17')]);}else{logger['info'](_0xc40d('0x16'),_0x1fcd82,_0xc40d('0x11'));_0x2c336a(_0x25f412[_0xc40d('0x18')][_0xc40d('0x17')]);}})[_0xc40d('0x19')](function(_0x4ebc58){logger[_0xc40d('0x14')](_0xc40d('0x16'),_0x1fcd82,_0x4ebc58);_0x1ed9ed(_0x4ebc58);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a65b62d..1c18727 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 _0x5bc5=['register','length','./team.events','save','remove','update','emit','removeListener'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0x5bc5,0xb2));var _0x55bc=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0x5bc5[_0x3186aa];return _0x2d8c36;};'use strict';var TeamEvents=require(_0x55bc('0x0'));var events=[_0x55bc('0x1'),_0x55bc('0x2'),_0x55bc('0x3')];function createListener(_0x19006b,_0x2e077d){return function(_0x2ebc5a){_0x2e077d[_0x55bc('0x4')](_0x19006b,_0x2ebc5a);};}function removeListener(_0xa94795,_0x1ea633){return function(){TeamEvents[_0x55bc('0x5')](_0xa94795,_0x1ea633);};}exports[_0x55bc('0x6')]=function(_0x188eb6){for(var _0x5d5f1d=0x0,_0x4d78d6=events[_0x55bc('0x7')];_0x5d5f1d<_0x4d78d6;_0x5d5f1d++){var _0x2a612b=events[_0x5d5f1d];var _0x38839e=createListener('team:'+_0x2a612b,_0x188eb6);TeamEvents['on'](_0x2a612b,_0x38839e);}}; \ No newline at end of file +var _0x8aec=['register','length','./team.events','remove','update','emit'];(function(_0xfe719f,_0x53be3b){var _0x4acc91=function(_0x2b79af){while(--_0x2b79af){_0xfe719f['push'](_0xfe719f['shift']());}};_0x4acc91(++_0x53be3b);}(_0x8aec,0x1a6));var _0xc8ae=function(_0x5e9690,_0x2c89b7){_0x5e9690=_0x5e9690-0x0;var _0x73805b=_0x8aec[_0x5e9690];return _0x73805b;};'use strict';var TeamEvents=require(_0xc8ae('0x0'));var events=['save',_0xc8ae('0x1'),_0xc8ae('0x2')];function createListener(_0x118f4a,_0x229b06){return function(_0x265076){_0x229b06[_0xc8ae('0x3')](_0x118f4a,_0x265076);};}function removeListener(_0x1c0445,_0x1b6ed6){return function(){TeamEvents['removeListener'](_0x1c0445,_0x1b6ed6);};}exports[_0xc8ae('0x4')]=function(_0x3309ae){for(var _0xe0d782=0x0,_0x327874=events[_0xc8ae('0x5')];_0xe0d782<_0x327874;_0xe0d782++){var _0x4be112=events[_0xe0d782];var _0x13de7e=createListener('team:'+_0x4be112,_0x3309ae);TeamEvents['on'](_0x4be112,_0x13de7e);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 837b4bb..e2422ed 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c325f,_0x3968b1){var _0x12cb72=function(_0xc34b64){while(--_0xc34b64){_0x5c325f['push'](_0x5c325f['shift']());}};_0x12cb72(++_0x3968b1);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x66b114,_0x3cf199){var _0x456b4d=function(_0x3888be){while(--_0x3888be){_0x66b114['push'](_0x66b114['shift']());}};_0x456b4d(++_0x3cf199);}(_0x70e0,0x17b));var _0x070e=function(_0x10adda,_0x25f43a){_0x10adda=_0x10adda-0x0;var _0xe4d229=_0x70e0[_0x10adda];return _0xe4d229;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index d893d74..6f612e8 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 _0x268f=['INTEGER','sequelize','exports'];(function(_0x45fd10,_0xe3fe57){var _0x2c7f4f=function(_0xdc993b){while(--_0xdc993b){_0x45fd10['push'](_0x45fd10['shift']());}};_0x2c7f4f(++_0xe3fe57);}(_0x268f,0x196));var _0xf268=function(_0x451a18,_0x13dd1f){_0x451a18=_0x451a18-0x0;var _0x50c962=_0x268f[_0x451a18];return _0x50c962;};'use strict';var Sequelize=require(_0xf268('0x0'));module[_0xf268('0x1')]={'penalty':{'type':Sequelize[_0xf268('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70df=['INTEGER','exports'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0x70df,0xe5));var _0xf70d=function(_0x3d1467,_0x29ee5b){_0x3d1467=_0x3d1467-0x0;var _0x580c50=_0x70df[_0x3d1467];return _0x580c50;};'use strict';var Sequelize=require('sequelize');module[_0xf70d('0x0')]={'penalty':{'type':Sequelize[_0xf70d('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 a0ca0d5..ef8604a 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 _0x12fd=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x12fd,0x199));var _0xd12f=function(_0x3b325e,_0x47d96a){_0x3b325e=_0x3b325e-0x0;var _0x202cb5=_0x12fd[_0x3b325e];return _0x202cb5;};'use strict';var _=require(_0xd12f('0x0'));var util=require(_0xd12f('0x1'));var logger=require(_0xd12f('0x2'))(_0xd12f('0x3'));var moment=require(_0xd12f('0x4'));var BPromise=require('bluebird');var rp=require(_0xd12f('0x5'));var fs=require('fs');var path=require(_0xd12f('0x6'));var rimraf=require(_0xd12f('0x7'));var config=require(_0xd12f('0x8'));var attributes=require(_0xd12f('0x9'));module[_0xd12f('0xa')]=function(_0x55bb7d,_0x3f733d){return _0x55bb7d['define'](_0xd12f('0xb'),attributes,{'tableName':_0xd12f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb8=['TeamVoiceQueue','team_has_voice_queues','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define'];(function(_0x4f18ed,_0x4fd7b1){var _0x3e8b37=function(_0x5dc81e){while(--_0x5dc81e){_0x4f18ed['push'](_0x4f18ed['shift']());}};_0x3e8b37(++_0x4fd7b1);}(_0xadb8,0x1d0));var _0x8adb=function(_0x3504a0,_0x3f770f){_0x3504a0=_0x3504a0-0x0;var _0x3dfca3=_0xadb8[_0x3504a0];return _0x3dfca3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));module['exports']=function(_0x15bc63,_0x1a5f36){return _0x15bc63[_0x8adb('0x8')](_0x8adb('0x9'),attributes,{'tableName':_0x8adb('0xa'),'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 2e041df..d57778e 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 _0x30cf=['stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','request\x20sent'];(function(_0x5bedae,_0x2dee43){var _0x17febb=function(_0x36846f){while(--_0x36846f){_0x5bedae['push'](_0x5bedae['shift']());}};_0x17febb(++_0x2dee43);}(_0x30cf,0x1e5));var _0xf30c=function(_0x3eb267,_0x441384){_0x3eb267=_0x3eb267-0x0;var _0x55b58f=_0x30cf[_0x3eb267];return _0x55b58f;};'use strict';var _=require('lodash');var util=require(_0xf30c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf30c('0x1'));var db=require(_0xf30c('0x2'))['db'];var utils=require(_0xf30c('0x3'));var logger=require('../../config/logger')(_0xf30c('0x4'));var config=require(_0xf30c('0x5'));var jayson=require(_0xf30c('0x6'));var client=jayson[_0xf30c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5549de,_0x1608f9,_0x4fe3e7){return new BPromise(function(_0x364457,_0x2df800){return client[_0xf30c('0x8')](_0x5549de,_0x4fe3e7)['then'](function(_0x385f29){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x1608f9,_0xf30c('0x9'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1608f9,_0xf30c('0x9'),JSON[_0xf30c('0xa')](_0x385f29));if(_0x385f29[_0xf30c('0xb')]){if(_0x385f29[_0xf30c('0xb')][_0xf30c('0xc')]===0x1f4){logger[_0xf30c('0xb')](_0xf30c('0xd'),_0x1608f9,_0x385f29[_0xf30c('0xb')][_0xf30c('0xe')]);return _0x2df800(_0x385f29[_0xf30c('0xb')][_0xf30c('0xe')]);}logger[_0xf30c('0xb')](_0xf30c('0xd'),_0x1608f9,_0x385f29[_0xf30c('0xb')][_0xf30c('0xe')]);return _0x364457(_0x385f29[_0xf30c('0xb')]['message']);}else{logger['info'](_0xf30c('0xd'),_0x1608f9,_0xf30c('0x9'));_0x364457(_0x385f29['result'][_0xf30c('0xe')]);}})['catch'](function(_0xd32990){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x1608f9,_0xd32990);_0x2df800(_0xd32990);});});} \ No newline at end of file +var _0xad36=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x16c49a,_0x48d9d5){var _0x981f8f=function(_0xc82bc8){while(--_0xc82bc8){_0x16c49a['push'](_0x16c49a['shift']());}};_0x981f8f(++_0x48d9d5);}(_0xad36,0x11c));var _0x6ad3=function(_0x18fa97,_0x14b8be){_0x18fa97=_0x18fa97-0x0;var _0x3128ea=_0xad36[_0x18fa97];return _0x3128ea;};'use strict';var _=require('lodash');var util=require(_0x6ad3('0x0'));var moment=require(_0x6ad3('0x1'));var BPromise=require(_0x6ad3('0x2'));var rs=require(_0x6ad3('0x3'));var fs=require('fs');var Redis=require(_0x6ad3('0x4'));var db=require(_0x6ad3('0x5'))['db'];var utils=require(_0x6ad3('0x6'));var logger=require(_0x6ad3('0x7'))(_0x6ad3('0x8'));var config=require('../../config/environment');var jayson=require(_0x6ad3('0x9'));var client=jayson[_0x6ad3('0xa')][_0x6ad3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb38339,_0x4a4ad8,_0x5693c1){return new BPromise(function(_0x50913c,_0x563396){return client[_0x6ad3('0xc')](_0xb38339,_0x5693c1)[_0x6ad3('0xd')](function(_0x363032){logger[_0x6ad3('0xe')](_0x6ad3('0xf'),_0x4a4ad8,_0x6ad3('0x10'));logger[_0x6ad3('0x11')](_0x6ad3('0x12'),_0x4a4ad8,_0x6ad3('0x10'),JSON['stringify'](_0x363032));if(_0x363032[_0x6ad3('0x13')]){if(_0x363032[_0x6ad3('0x13')][_0x6ad3('0x14')]===0x1f4){logger[_0x6ad3('0x13')](_0x6ad3('0xf'),_0x4a4ad8,_0x363032[_0x6ad3('0x13')][_0x6ad3('0x15')]);return _0x563396(_0x363032[_0x6ad3('0x13')]['message']);}logger[_0x6ad3('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4a4ad8,_0x363032[_0x6ad3('0x13')][_0x6ad3('0x15')]);return _0x50913c(_0x363032[_0x6ad3('0x13')][_0x6ad3('0x15')]);}else{logger[_0x6ad3('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4a4ad8,_0x6ad3('0x10'));_0x50913c(_0x363032[_0x6ad3('0x16')][_0x6ad3('0x15')]);}})['catch'](function(_0x5479b8){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x4a4ad8,_0x5479b8);_0x563396(_0x5479b8);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 63d3896..932cc8e 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 _0xd1f1=['isAuthenticated','index','/:id','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x481c41,_0x48ba3c){_0x481c41=_0x481c41-0x0;var _0xf91fd=_0xd1f1[_0x481c41];return _0xf91fd;};'use strict';var multer=require(_0x1d1f('0x0'));var util=require(_0x1d1f('0x1'));var path=require('path');var timeout=require(_0x1d1f('0x2'));var express=require(_0x1d1f('0x3'));var router=express[_0x1d1f('0x4')]();var fs_extra=require(_0x1d1f('0x5'));var auth=require(_0x1d1f('0x6'));var interaction=require(_0x1d1f('0x7'));var config=require(_0x1d1f('0x8'));var controller=require('./template.controller');router[_0x1d1f('0x9')]('/',auth[_0x1d1f('0xa')](),controller[_0x1d1f('0xb')]);router[_0x1d1f('0x9')](_0x1d1f('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1d1f('0xa')](),controller[_0x1d1f('0xd')]);router[_0x1d1f('0xe')](_0x1d1f('0xc'),auth['isAuthenticated'](),controller[_0x1d1f('0xf')]);router[_0x1d1f('0x10')](_0x1d1f('0xc'),auth[_0x1d1f('0xa')](),controller[_0x1d1f('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa3eb=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x12be85,_0x4a5721){var _0x5a1135=function(_0x5663ce){while(--_0x5663ce){_0x12be85['push'](_0x12be85['shift']());}};_0x5a1135(++_0x4a5721);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa3eb[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var path=require(_0xba3e('0x2'));var timeout=require('connect-timeout');var express=require(_0xba3e('0x3'));var router=express[_0xba3e('0x4')]();var fs_extra=require(_0xba3e('0x5'));var auth=require(_0xba3e('0x6'));var interaction=require(_0xba3e('0x7'));var config=require(_0xba3e('0x8'));var controller=require(_0xba3e('0x9'));router[_0xba3e('0xa')]('/',auth[_0xba3e('0xb')](),controller[_0xba3e('0xc')]);router[_0xba3e('0xa')](_0xba3e('0xd'),auth[_0xba3e('0xb')](),controller[_0xba3e('0xe')]);router[_0xba3e('0xf')]('/',auth[_0xba3e('0xb')](),controller[_0xba3e('0x10')]);router[_0xba3e('0x11')](_0xba3e('0xd'),auth['isAuthenticated'](),controller[_0xba3e('0x12')]);router[_0xba3e('0x13')](_0xba3e('0xd'),auth['isAuthenticated'](),controller[_0xba3e('0x14')]);module[_0xba3e('0x15')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 1f9090e..fa792e2 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 _0x0f12=['sequelize','STRING'];(function(_0x19f16a,_0x498777){var _0x2196e1=function(_0x241d53){while(--_0x241d53){_0x19f16a['push'](_0x19f16a['shift']());}};_0x2196e1(++_0x498777);}(_0x0f12,0x108));var _0x20f1=function(_0x37f0ab,_0x256456){_0x37f0ab=_0x37f0ab-0x0;var _0x284ed4=_0x0f12[_0x37f0ab];return _0x284ed4;};'use strict';var Sequelize=require(_0x20f1('0x0'));module['exports']={'name':{'type':Sequelize[_0x20f1('0x1')]},'description':{'type':Sequelize[_0x20f1('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdcc0=['TEXT','sequelize','exports','STRING'];(function(_0x21d048,_0x4103b2){var _0x2f53ef=function(_0x4c8e5e){while(--_0x4c8e5e){_0x21d048['push'](_0x21d048['shift']());}};_0x2f53ef(++_0x4103b2);}(_0xdcc0,0x17d));var _0x0dcc=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xdcc0[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x0dcc('0x0'));module[_0x0dcc('0x1')]={'name':{'type':Sequelize[_0x0dcc('0x2')]},'description':{'type':Sequelize[_0x0dcc('0x2')]},'html':{'type':Sequelize[_0x0dcc('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 97edd68..6889c5f 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 _0xf351=['../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','user','get','Templates','UserProfileSection','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x72f7ca,_0x604a3d){var _0x2d4ad1=function(_0x49d9ab){while(--_0x49d9ab){_0x72f7ca['push'](_0x72f7ca['shift']());}};_0x2d4ad1(++_0x604a3d);}(_0xf351,0x1f0));var _0x1f35=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xf351[_0x18a436];return _0x5c2cf8;};'use strict';var emlformat=require(_0x1f35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f35('0x1'));var jsonpatch=require(_0x1f35('0x2'));var rp=require(_0x1f35('0x3'));var moment=require(_0x1f35('0x4'));var BPromise=require(_0x1f35('0x5'));var Mustache=require(_0x1f35('0x6'));var util=require(_0x1f35('0x7'));var path=require(_0x1f35('0x8'));var sox=require(_0x1f35('0x9'));var csv=require(_0x1f35('0xa'));var ejs=require(_0x1f35('0xb'));var fs=require('fs');var fs_extra=require(_0x1f35('0xc'));var _=require('lodash');var squel=require(_0x1f35('0xd'));var crypto=require(_0x1f35('0xe'));var jsforce=require(_0x1f35('0xf'));var deskjs=require(_0x1f35('0x10'));var toCsv=require(_0x1f35('0xa'));var querystring=require(_0x1f35('0x11'));var Papa=require(_0x1f35('0x12'));var Redis=require(_0x1f35('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f35('0x14'));var hardwareService=require(_0x1f35('0x15'));var logger=require(_0x1f35('0x16'))(_0x1f35('0x17'));var utils=require(_0x1f35('0x18'));var config=require(_0x1f35('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f35('0x1a'))['db'];function respondWithStatusCode(_0xb66150,_0x1b53aa){_0x1b53aa=_0x1b53aa||0xcc;return function(_0x4cbb7c){if(_0x4cbb7c){return _0xb66150['sendStatus'](_0x1b53aa);}return _0xb66150[_0x1f35('0x1b')](_0x1b53aa)[_0x1f35('0x1c')]();};}function respondWithResult(_0x48c5e5,_0x559ed5){_0x559ed5=_0x559ed5||0xc8;return function(_0x3785e6){if(_0x3785e6){return _0x48c5e5[_0x1f35('0x1b')](_0x559ed5)[_0x1f35('0x1d')](_0x3785e6);}};}function respondWithFilteredResult(_0x1cc780,_0x2ff90a){return function(_0x1ec408){if(_0x1ec408){var _0x470bc7=typeof _0x2ff90a['offset']===_0x1f35('0x1e')&&typeof _0x2ff90a[_0x1f35('0x1f')]===_0x1f35('0x1e');var _0x46f9a8=_0x1ec408[_0x1f35('0x20')];var _0x52b7d9=_0x470bc7?0x0:_0x2ff90a[_0x1f35('0x21')];var _0x4e05e2=_0x470bc7?_0x1ec408['count']:_0x2ff90a[_0x1f35('0x21')]+_0x2ff90a[_0x1f35('0x1f')];var _0x45b301;if(_0x4e05e2>=_0x46f9a8){_0x4e05e2=_0x46f9a8;_0x45b301=0xc8;}else{_0x45b301=0xce;}_0x1cc780[_0x1f35('0x1b')](_0x45b301);return _0x1cc780[_0x1f35('0x22')](_0x1f35('0x23'),_0x52b7d9+'-'+_0x4e05e2+'/'+_0x46f9a8)['json'](_0x1ec408);}return null;};}function patchUpdates(_0x10533f){return function(_0x2c2eb3){try{jsonpatch[_0x1f35('0x24')](_0x2c2eb3,_0x10533f,!![]);}catch(_0x10eddc){return BPromise[_0x1f35('0x25')](_0x10eddc);}return _0x2c2eb3[_0x1f35('0x26')]();};}function saveUpdates(_0x232601,_0x2361d4){return function(_0x36d54b){if(_0x36d54b){return _0x36d54b[_0x1f35('0x27')](_0x232601)[_0x1f35('0x28')](function(_0x338777){return _0x338777;});}return null;};}function removeEntity(_0x295ff0,_0x4f55e3){return function(_0x314e39){if(_0x314e39){return _0x314e39[_0x1f35('0x29')]()['then'](function(){var _0x403a24=_0x314e39['get']({'plain':!![]});var _0x286d16='Templates';return db[_0x1f35('0x2a')][_0x1f35('0x29')]({'where':{'type':_0x286d16,'resourceId':_0x403a24['id']}})[_0x1f35('0x28')](function(){return _0x314e39;});})[_0x1f35('0x28')](function(){_0x295ff0[_0x1f35('0x1b')](0xcc)[_0x1f35('0x1c')]();});}};}function handleEntityNotFound(_0x428c84,_0x1be626){return function(_0x4b4743){if(!_0x4b4743){_0x428c84[_0x1f35('0x2b')](0x194);}return _0x4b4743;};}function handleError(_0x35e60d,_0x1ca0f8){_0x1ca0f8=_0x1ca0f8||0x1f4;return function(_0x5b0e3a){logger[_0x1f35('0x2c')](_0x5b0e3a[_0x1f35('0x2d')]);if(_0x5b0e3a[_0x1f35('0x2e')]){delete _0x5b0e3a[_0x1f35('0x2e')];}_0x35e60d[_0x1f35('0x1b')](_0x1ca0f8)[_0x1f35('0x2f')](_0x5b0e3a);};}exports[_0x1f35('0x30')]=function(_0x387d22,_0x51862d){var _0x3b4bad={},_0x45e375={},_0x334d04={'count':0x0,'rows':[]};var _0x422f10=_[_0x1f35('0x31')](db[_0x1f35('0x32')][_0x1f35('0x33')],function(_0x2a1495){return{'name':_0x2a1495[_0x1f35('0x34')],'type':_0x2a1495[_0x1f35('0x35')][_0x1f35('0x36')]};});_0x45e375['model']=_['map'](_0x422f10,_0x1f35('0x2e'));_0x45e375['query']=_[_0x1f35('0x37')](_0x387d22[_0x1f35('0x38')]);_0x45e375[_0x1f35('0x39')]=_['intersection'](_0x45e375[_0x1f35('0x3a')],_0x45e375[_0x1f35('0x38')]);_0x3b4bad[_0x1f35('0x3b')]=_[_0x1f35('0x3c')](_0x45e375[_0x1f35('0x3a')],qs['fields'](_0x387d22[_0x1f35('0x38')]['fields']));_0x3b4bad[_0x1f35('0x3b')]=_0x3b4bad[_0x1f35('0x3b')][_0x1f35('0x3d')]?_0x3b4bad[_0x1f35('0x3b')]:_0x45e375[_0x1f35('0x3a')];if(!_0x387d22[_0x1f35('0x38')][_0x1f35('0x3e')](_0x1f35('0x3f'))){_0x3b4bad['limit']=qs[_0x1f35('0x1f')](_0x387d22['query'][_0x1f35('0x1f')]);_0x3b4bad[_0x1f35('0x21')]=qs[_0x1f35('0x21')](_0x387d22[_0x1f35('0x38')]['offset']);}_0x3b4bad[_0x1f35('0x40')]=qs['sort'](_0x387d22[_0x1f35('0x38')][_0x1f35('0x41')]);_0x3b4bad[_0x1f35('0x42')]=qs[_0x1f35('0x39')](_[_0x1f35('0x43')](_0x387d22[_0x1f35('0x38')],_0x45e375[_0x1f35('0x39')]),_0x422f10);if(_0x387d22[_0x1f35('0x38')][_0x1f35('0x44')]){_0x3b4bad[_0x1f35('0x42')]=_[_0x1f35('0x45')](_0x3b4bad[_0x1f35('0x42')],{'$or':_[_0x1f35('0x31')](_0x422f10,function(_0x566418){if(_0x566418['type']!==_0x1f35('0x46')){var _0x30fb18={};_0x30fb18[_0x566418[_0x1f35('0x2e')]]={'$like':'%'+_0x387d22['query']['filter']+'%'};return _0x30fb18;}})});}_0x3b4bad=_[_0x1f35('0x45')]({},_0x3b4bad,_0x387d22[_0x1f35('0x47')]);var _0x1eb212={'where':_0x3b4bad[_0x1f35('0x42')]};return db[_0x1f35('0x32')]['count'](_0x1eb212)[_0x1f35('0x28')](function(_0x3e33b4){_0x334d04[_0x1f35('0x20')]=_0x3e33b4;if(_0x387d22[_0x1f35('0x38')][_0x1f35('0x48')]){_0x3b4bad[_0x1f35('0x49')]=[{'all':!![]}];}return db['Template'][_0x1f35('0x4a')](_0x3b4bad);})['then'](function(_0x536953){_0x334d04[_0x1f35('0x4b')]=_0x536953;return _0x334d04;})[_0x1f35('0x28')](respondWithFilteredResult(_0x51862d,_0x3b4bad))[_0x1f35('0x4c')](handleError(_0x51862d,null));};exports['show']=function(_0x5ec315,_0x29b8a2){var _0x3d903c={'raw':!![],'where':{'id':_0x5ec315[_0x1f35('0x4d')]['id']}},_0x41dcb8={};_0x41dcb8[_0x1f35('0x3a')]=_[_0x1f35('0x37')](db[_0x1f35('0x32')][_0x1f35('0x33')]);_0x41dcb8[_0x1f35('0x38')]=_[_0x1f35('0x37')](_0x5ec315[_0x1f35('0x38')]);_0x41dcb8[_0x1f35('0x39')]=_[_0x1f35('0x3c')](_0x41dcb8[_0x1f35('0x3a')],_0x41dcb8['query']);_0x3d903c[_0x1f35('0x3b')]=_[_0x1f35('0x3c')](_0x41dcb8[_0x1f35('0x3a')],qs[_0x1f35('0x4e')](_0x5ec315['query'][_0x1f35('0x4e')]));_0x3d903c[_0x1f35('0x3b')]=_0x3d903c['attributes']['length']?_0x3d903c['attributes']:_0x41dcb8[_0x1f35('0x3a')];if(_0x5ec315[_0x1f35('0x38')][_0x1f35('0x48')]){_0x3d903c[_0x1f35('0x49')]=[{'all':!![]}];}_0x3d903c=_['merge']({},_0x3d903c,_0x5ec315[_0x1f35('0x47')]);return db[_0x1f35('0x32')][_0x1f35('0x4f')](_0x3d903c)[_0x1f35('0x28')](handleEntityNotFound(_0x29b8a2,null))[_0x1f35('0x28')](respondWithResult(_0x29b8a2,null))['catch'](handleError(_0x29b8a2,null));};exports[_0x1f35('0x50')]=function(_0x58bb66,_0x129d37){return db[_0x1f35('0x32')]['create'](_0x58bb66[_0x1f35('0x51')],{})['then'](function(_0x5342b9){var _0x383152=_0x58bb66['user']['get']({'plain':!![]});if(!_0x383152)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x383152['role']===_0x1f35('0x52')){var _0x4fdc6b=_0x5342b9[_0x1f35('0x53')]({'plain':!![]});var _0x4abd70=_0x1f35('0x54');return db[_0x1f35('0x55')][_0x1f35('0x4f')]({'where':{'name':_0x4abd70,'userProfileId':_0x383152['userProfileId']},'raw':!![]})[_0x1f35('0x28')](function(_0x50064f){if(_0x50064f&&_0x50064f[_0x1f35('0x56')]===0x0){return db[_0x1f35('0x2a')][_0x1f35('0x50')]({'name':_0x4fdc6b[_0x1f35('0x2e')],'resourceId':_0x4fdc6b['id'],'type':_0x50064f[_0x1f35('0x2e')],'sectionId':_0x50064f['id']},{})[_0x1f35('0x28')](function(){return _0x5342b9;});}else{return _0x5342b9;}})['catch'](function(_0x3b8ca7){logger[_0x1f35('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b8ca7);throw _0x3b8ca7;});}return _0x5342b9;})[_0x1f35('0x28')](respondWithResult(_0x129d37,0xc9))[_0x1f35('0x4c')](handleError(_0x129d37,null));};exports[_0x1f35('0x27')]=function(_0x1824fa,_0x3ed65b){if(_0x1824fa[_0x1f35('0x51')]['id']){delete _0x1824fa[_0x1f35('0x51')]['id'];}return db['Template']['find']({'where':{'id':_0x1824fa[_0x1f35('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ed65b,null))[_0x1f35('0x28')](saveUpdates(_0x1824fa[_0x1f35('0x51')],null))[_0x1f35('0x28')](respondWithResult(_0x3ed65b,null))[_0x1f35('0x4c')](handleError(_0x3ed65b,null));};exports[_0x1f35('0x29')]=function(_0x8645ba,_0x564382){return db['Template']['find']({'where':{'id':_0x8645ba[_0x1f35('0x4d')]['id']}})[_0x1f35('0x28')](handleEntityNotFound(_0x564382,null))['then'](removeEntity(_0x564382,null))[_0x1f35('0x4c')](handleError(_0x564382,null));}; \ No newline at end of file +var _0xb9ae=['model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','fieldName','type'];(function(_0x22fbf8,_0x2499cd){var _0x512fdf=function(_0x200c34){while(--_0x200c34){_0x22fbf8['push'](_0x22fbf8['shift']());}};_0x512fdf(++_0x2499cd);}(_0xb9ae,0x1df));var _0xeb9a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb9ae[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xeb9a('0x0'));var rimraf=require(_0xeb9a('0x1'));var zipdir=require(_0xeb9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb9a('0x3'));var moment=require(_0xeb9a('0x4'));var BPromise=require(_0xeb9a('0x5'));var Mustache=require(_0xeb9a('0x6'));var util=require(_0xeb9a('0x7'));var path=require(_0xeb9a('0x8'));var sox=require(_0xeb9a('0x9'));var csv=require(_0xeb9a('0xa'));var ejs=require(_0xeb9a('0xb'));var fs=require('fs');var fs_extra=require(_0xeb9a('0xc'));var _=require(_0xeb9a('0xd'));var squel=require(_0xeb9a('0xe'));var crypto=require(_0xeb9a('0xf'));var jsforce=require(_0xeb9a('0x10'));var deskjs=require(_0xeb9a('0x11'));var toCsv=require('to-csv');var querystring=require(_0xeb9a('0x12'));var Papa=require(_0xeb9a('0x13'));var Redis=require(_0xeb9a('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xeb9a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb9a('0x16'));var logger=require(_0xeb9a('0x17'))(_0xeb9a('0x18'));var utils=require(_0xeb9a('0x19'));var config=require(_0xeb9a('0x1a'));var licenseUtil=require(_0xeb9a('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc749,_0x54017f){_0x54017f=_0x54017f||0xcc;return function(_0x413688){if(_0x413688){return _0x3cc749[_0xeb9a('0x1c')](_0x54017f);}return _0x3cc749[_0xeb9a('0x1d')](_0x54017f)[_0xeb9a('0x1e')]();};}function respondWithResult(_0x459b9b,_0x4310a3){_0x4310a3=_0x4310a3||0xc8;return function(_0x504e4c){if(_0x504e4c){return _0x459b9b[_0xeb9a('0x1d')](_0x4310a3)[_0xeb9a('0x1f')](_0x504e4c);}};}function respondWithFilteredResult(_0x47aaf0,_0x1eba68){return function(_0x266459){if(_0x266459){var _0x5db0f3=typeof _0x1eba68[_0xeb9a('0x20')]===_0xeb9a('0x21')&&typeof _0x1eba68['limit']===_0xeb9a('0x21');var _0xaee202=_0x266459[_0xeb9a('0x22')];var _0x442a49=_0x5db0f3?0x0:_0x1eba68[_0xeb9a('0x20')];var _0x8d785b=_0x5db0f3?_0x266459['count']:_0x1eba68['offset']+_0x1eba68[_0xeb9a('0x23')];var _0x57c52e;if(_0x8d785b>=_0xaee202){_0x8d785b=_0xaee202;_0x57c52e=0xc8;}else{_0x57c52e=0xce;}_0x47aaf0['status'](_0x57c52e);return _0x47aaf0[_0xeb9a('0x24')](_0xeb9a('0x25'),_0x442a49+'-'+_0x8d785b+'/'+_0xaee202)[_0xeb9a('0x1f')](_0x266459);}return null;};}function patchUpdates(_0x582d8){return function(_0x223479){try{jsonpatch[_0xeb9a('0x26')](_0x223479,_0x582d8,!![]);}catch(_0x4c5e34){return BPromise[_0xeb9a('0x27')](_0x4c5e34);}return _0x223479[_0xeb9a('0x28')]();};}function saveUpdates(_0x3529fc,_0x31807a){return function(_0x315c0f){if(_0x315c0f){return _0x315c0f['update'](_0x3529fc)[_0xeb9a('0x29')](function(_0xc802b){return _0xc802b;});}return null;};}function removeEntity(_0x4d7399,_0x425e63){return function(_0x2b8eb3){if(_0x2b8eb3){return _0x2b8eb3[_0xeb9a('0x2a')]()[_0xeb9a('0x29')](function(){var _0x257b2a=_0x2b8eb3[_0xeb9a('0x2b')]({'plain':!![]});var _0x1d757b=_0xeb9a('0x2c');return db[_0xeb9a('0x2d')][_0xeb9a('0x2a')]({'where':{'type':_0x1d757b,'resourceId':_0x257b2a['id']}})['then'](function(){return _0x2b8eb3;});})[_0xeb9a('0x29')](function(){_0x4d7399[_0xeb9a('0x1d')](0xcc)[_0xeb9a('0x1e')]();});}};}function handleEntityNotFound(_0x3955bb,_0x33ec95){return function(_0x1ec8da){if(!_0x1ec8da){_0x3955bb[_0xeb9a('0x1c')](0x194);}return _0x1ec8da;};}function handleError(_0x54b0bb,_0x305b80){_0x305b80=_0x305b80||0x1f4;return function(_0x5c039a){logger[_0xeb9a('0x2e')](_0x5c039a[_0xeb9a('0x2f')]);if(_0x5c039a[_0xeb9a('0x30')]){delete _0x5c039a['name'];}_0x54b0bb['status'](_0x305b80)[_0xeb9a('0x31')](_0x5c039a);};}exports[_0xeb9a('0x32')]=function(_0x17106c,_0x25fa10){var _0x4da345={},_0x2cf699={},_0x15e82f={'count':0x0,'rows':[]};var _0xfd3c97=_['map'](db[_0xeb9a('0x33')][_0xeb9a('0x34')],function(_0x4c402e){return{'name':_0x4c402e[_0xeb9a('0x35')],'type':_0x4c402e[_0xeb9a('0x36')]['key']};});_0x2cf699[_0xeb9a('0x37')]=_[_0xeb9a('0x38')](_0xfd3c97,_0xeb9a('0x30'));_0x2cf699[_0xeb9a('0x39')]=_[_0xeb9a('0x3a')](_0x17106c[_0xeb9a('0x39')]);_0x2cf699[_0xeb9a('0x3b')]=_['intersection'](_0x2cf699['model'],_0x2cf699[_0xeb9a('0x39')]);_0x4da345['attributes']=_[_0xeb9a('0x3c')](_0x2cf699[_0xeb9a('0x37')],qs[_0xeb9a('0x3d')](_0x17106c[_0xeb9a('0x39')][_0xeb9a('0x3d')]));_0x4da345['attributes']=_0x4da345[_0xeb9a('0x3e')][_0xeb9a('0x3f')]?_0x4da345['attributes']:_0x2cf699[_0xeb9a('0x37')];if(!_0x17106c[_0xeb9a('0x39')]['hasOwnProperty'](_0xeb9a('0x40'))){_0x4da345['limit']=qs[_0xeb9a('0x23')](_0x17106c[_0xeb9a('0x39')][_0xeb9a('0x23')]);_0x4da345[_0xeb9a('0x20')]=qs[_0xeb9a('0x20')](_0x17106c[_0xeb9a('0x39')]['offset']);}_0x4da345[_0xeb9a('0x41')]=qs[_0xeb9a('0x42')](_0x17106c['query'][_0xeb9a('0x42')]);_0x4da345['where']=qs[_0xeb9a('0x3b')](_[_0xeb9a('0x43')](_0x17106c[_0xeb9a('0x39')],_0x2cf699['filters']),_0xfd3c97);if(_0x17106c[_0xeb9a('0x39')][_0xeb9a('0x44')]){_0x4da345[_0xeb9a('0x45')]=_[_0xeb9a('0x46')](_0x4da345['where'],{'$or':_['map'](_0xfd3c97,function(_0x1bc976){if(_0x1bc976['type']!==_0xeb9a('0x47')){var _0x2a006e={};_0x2a006e[_0x1bc976[_0xeb9a('0x30')]]={'$like':'%'+_0x17106c[_0xeb9a('0x39')][_0xeb9a('0x44')]+'%'};return _0x2a006e;}})});}_0x4da345=_[_0xeb9a('0x46')]({},_0x4da345,_0x17106c['options']);var _0x87d0d5={'where':_0x4da345['where']};return db[_0xeb9a('0x33')]['count'](_0x87d0d5)[_0xeb9a('0x29')](function(_0x501f74){_0x15e82f[_0xeb9a('0x22')]=_0x501f74;if(_0x17106c[_0xeb9a('0x39')][_0xeb9a('0x48')]){_0x4da345['include']=[{'all':!![]}];}return db[_0xeb9a('0x33')][_0xeb9a('0x49')](_0x4da345);})['then'](function(_0xd46edd){_0x15e82f['rows']=_0xd46edd;return _0x15e82f;})['then'](respondWithFilteredResult(_0x25fa10,_0x4da345))[_0xeb9a('0x4a')](handleError(_0x25fa10,null));};exports[_0xeb9a('0x4b')]=function(_0x2cf18e,_0x19cc81){var _0x3b17ff={'raw':!![],'where':{'id':_0x2cf18e[_0xeb9a('0x4c')]['id']}},_0x1d1564={};_0x1d1564[_0xeb9a('0x37')]=_[_0xeb9a('0x3a')](db['Template']['rawAttributes']);_0x1d1564[_0xeb9a('0x39')]=_[_0xeb9a('0x3a')](_0x2cf18e['query']);_0x1d1564[_0xeb9a('0x3b')]=_[_0xeb9a('0x3c')](_0x1d1564['model'],_0x1d1564['query']);_0x3b17ff[_0xeb9a('0x3e')]=_[_0xeb9a('0x3c')](_0x1d1564[_0xeb9a('0x37')],qs[_0xeb9a('0x3d')](_0x2cf18e[_0xeb9a('0x39')][_0xeb9a('0x3d')]));_0x3b17ff[_0xeb9a('0x3e')]=_0x3b17ff[_0xeb9a('0x3e')][_0xeb9a('0x3f')]?_0x3b17ff[_0xeb9a('0x3e')]:_0x1d1564[_0xeb9a('0x37')];if(_0x2cf18e[_0xeb9a('0x39')][_0xeb9a('0x48')]){_0x3b17ff[_0xeb9a('0x4d')]=[{'all':!![]}];}_0x3b17ff=_['merge']({},_0x3b17ff,_0x2cf18e[_0xeb9a('0x4e')]);return db['Template'][_0xeb9a('0x4f')](_0x3b17ff)[_0xeb9a('0x29')](handleEntityNotFound(_0x19cc81,null))['then'](respondWithResult(_0x19cc81,null))[_0xeb9a('0x4a')](handleError(_0x19cc81,null));};exports[_0xeb9a('0x50')]=function(_0x112b74,_0x39cdc3){return db['Template'][_0xeb9a('0x50')](_0x112b74[_0xeb9a('0x51')],{})[_0xeb9a('0x29')](function(_0x351441){var _0x180c48=_0x112b74[_0xeb9a('0x52')]['get']({'plain':!![]});if(!_0x180c48)throw new Error(_0xeb9a('0x53'));if(_0x180c48[_0xeb9a('0x54')]===_0xeb9a('0x52')){var _0x2433c1=_0x351441[_0xeb9a('0x2b')]({'plain':!![]});var _0x549cc0=_0xeb9a('0x2c');return db[_0xeb9a('0x55')]['find']({'where':{'name':_0x549cc0,'userProfileId':_0x180c48[_0xeb9a('0x56')]},'raw':!![]})[_0xeb9a('0x29')](function(_0x3e2673){if(_0x3e2673&&_0x3e2673['autoAssociation']===0x0){return db['UserProfileResource'][_0xeb9a('0x50')]({'name':_0x2433c1['name'],'resourceId':_0x2433c1['id'],'type':_0x3e2673[_0xeb9a('0x30')],'sectionId':_0x3e2673['id']},{})[_0xeb9a('0x29')](function(){return _0x351441;});}else{return _0x351441;}})[_0xeb9a('0x4a')](function(_0xe250b9){logger[_0xeb9a('0x2e')](_0xeb9a('0x57'),_0xe250b9);throw _0xe250b9;});}return _0x351441;})[_0xeb9a('0x29')](respondWithResult(_0x39cdc3,0xc9))['catch'](handleError(_0x39cdc3,null));};exports[_0xeb9a('0x58')]=function(_0x39d49a,_0x3f71ee){if(_0x39d49a['body']['id']){delete _0x39d49a[_0xeb9a('0x51')]['id'];}return db[_0xeb9a('0x33')][_0xeb9a('0x4f')]({'where':{'id':_0x39d49a[_0xeb9a('0x4c')]['id']}})[_0xeb9a('0x29')](handleEntityNotFound(_0x3f71ee,null))[_0xeb9a('0x29')](saveUpdates(_0x39d49a[_0xeb9a('0x51')],null))[_0xeb9a('0x29')](respondWithResult(_0x3f71ee,null))[_0xeb9a('0x4a')](handleError(_0x3f71ee,null));};exports[_0xeb9a('0x2a')]=function(_0x6d0d41,_0x2b1da5){return db[_0xeb9a('0x33')][_0xeb9a('0x4f')]({'where':{'id':_0x6d0d41[_0xeb9a('0x4c')]['id']}})[_0xeb9a('0x29')](handleEntityNotFound(_0x2b1da5,null))[_0xeb9a('0x29')](removeEntity(_0x2b1da5,null))[_0xeb9a('0x4a')](handleError(_0x2b1da5,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0f13877..3a44c01 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 _0x3047=['Template','tools_templates','lodash','util','api','moment','request-promise','rimraf','exports','define'];(function(_0x4d7617,_0x457737){var _0x34b074=function(_0x3bf9b6){while(--_0x3bf9b6){_0x4d7617['push'](_0x4d7617['shift']());}};_0x34b074(++_0x457737);}(_0x3047,0xe8));var _0x7304=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3047[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7304('0x0'));var util=require(_0x7304('0x1'));var logger=require('../../config/logger')(_0x7304('0x2'));var moment=require(_0x7304('0x3'));var BPromise=require('bluebird');var rp=require(_0x7304('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7304('0x5'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x7304('0x6')]=function(_0x130d3a,_0x28103f){return _0x130d3a[_0x7304('0x7')](_0x7304('0x8'),attributes,{'tableName':_0x7304('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f4d=['rimraf','../../config/environment','exports','define','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0x7f4d,0x1e5));var _0xd7f4=function(_0x355012,_0x532775){_0x355012=_0x355012-0x0;var _0x141e24=_0x7f4d[_0x355012];return _0x141e24;};'use strict';var _=require(_0xd7f4('0x0'));var util=require(_0xd7f4('0x1'));var logger=require(_0xd7f4('0x2'))(_0xd7f4('0x3'));var moment=require(_0xd7f4('0x4'));var BPromise=require(_0xd7f4('0x5'));var rp=require(_0xd7f4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd7f4('0x7'));var config=require(_0xd7f4('0x8'));var attributes=require('./template.attributes');module[_0xd7f4('0x9')]=function(_0x2c9df6,_0x198dd7){return _0x2c9df6[_0xd7f4('0xa')]('Template',attributes,{'tableName':_0xd7f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index ebf0e19..2aeeac5 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 _0x4978=['include','model','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','Template,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','GetTemplate','Template','findAll','options','where','attributes','limit'];(function(_0x169022,_0x100bf7){var _0x4cad5d=function(_0x34a48b){while(--_0x34a48b){_0x169022['push'](_0x169022['shift']());}};_0x4cad5d(++_0x100bf7);}(_0x4978,0xe3));var _0x8497=function(_0x25981f,_0x392e24){_0x25981f=_0x25981f-0x0;var _0x2aacbf=_0x4978[_0x25981f];return _0x2aacbf;};'use strict';var _=require('lodash');var util=require(_0x8497('0x0'));var moment=require(_0x8497('0x1'));var BPromise=require(_0x8497('0x2'));var rs=require(_0x8497('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8497('0x4'))['db'];var utils=require(_0x8497('0x5'));var logger=require(_0x8497('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8497('0x7')][_0x8497('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2823ca,_0x1c271d,_0x7d3600){return new BPromise(function(_0xeb96cb,_0x4720ff){return client[_0x8497('0x9')](_0x2823ca,_0x7d3600)[_0x8497('0xa')](function(_0x20f510){logger['info'](_0x8497('0xb'),_0x1c271d,'request\x20sent');logger[_0x8497('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x1c271d,_0x8497('0xd'),JSON['stringify'](_0x20f510));if(_0x20f510['error']){if(_0x20f510[_0x8497('0xe')][_0x8497('0xf')]===0x1f4){logger[_0x8497('0xe')](_0x8497('0xb'),_0x1c271d,_0x20f510[_0x8497('0xe')]['message']);return _0x4720ff(_0x20f510['error'][_0x8497('0x10')]);}logger[_0x8497('0xe')](_0x8497('0xb'),_0x1c271d,_0x20f510[_0x8497('0xe')][_0x8497('0x10')]);return _0xeb96cb(_0x20f510['error']['message']);}else{logger['info'](_0x8497('0xb'),_0x1c271d,'request\x20sent');_0xeb96cb(_0x20f510[_0x8497('0x11')][_0x8497('0x10')]);}})['catch'](function(_0x59916f){logger[_0x8497('0xe')](_0x8497('0xb'),_0x1c271d,_0x59916f);_0x4720ff(_0x59916f);});});}exports[_0x8497('0x12')]=function(_0x138ea3){var _0x310ab4=this;return new Promise(function(_0x40563d,_0x1bc089){return db[_0x8497('0x13')][_0x8497('0x14')]({'raw':_0x138ea3[_0x8497('0x15')]?_0x138ea3[_0x8497('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x138ea3['options']?_0x138ea3[_0x8497('0x15')][_0x8497('0x16')]||null:null,'attributes':_0x138ea3[_0x8497('0x15')]?_0x138ea3['options'][_0x8497('0x17')]||null:null,'limit':_0x138ea3['options']?_0x138ea3[_0x8497('0x15')][_0x8497('0x18')]||null:null,'include':_0x138ea3[_0x8497('0x15')]?_0x138ea3[_0x8497('0x15')][_0x8497('0x19')]?_['map'](_0x138ea3[_0x8497('0x15')]['include'],function(_0xa594b5){return{'model':db[_0xa594b5['model']],'as':_0xa594b5['as'],'attributes':_0xa594b5[_0x8497('0x17')],'include':_0xa594b5['include']?_['map'](_0xa594b5[_0x8497('0x19')],function(_0xf32bfe){return{'model':db[_0xf32bfe[_0x8497('0x1a')]],'as':_0xf32bfe['as'],'attributes':_0xf32bfe[_0x8497('0x17')],'include':_0xf32bfe[_0x8497('0x19')]?_['map'](_0xf32bfe[_0x8497('0x19')],function(_0x294781){return{'model':db[_0x294781[_0x8497('0x1a')]],'as':_0x294781['as'],'attributes':_0x294781[_0x8497('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48316e){logger[_0x8497('0x1b')]('GetTemplate',_0x138ea3);logger['debug']('GetTemplate',_0x138ea3,JSON['stringify'](_0x48316e));_0x40563d(_0x48316e);})['catch'](function(_0x1e5640){logger[_0x8497('0xe')](_0x8497('0x12'),_0x1e5640[_0x8497('0x10')],_0x138ea3);_0x1bc089(_0x310ab4[_0x8497('0xe')](0x1f4,_0x1e5640[_0x8497('0x10')]));});});}; \ No newline at end of file +var _0x5ac6=['Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xe51522,_0x266bf5){var _0x5dac8a=function(_0x31b162){while(--_0x31b162){_0xe51522['push'](_0xe51522['shift']());}};_0x5dac8a(++_0x266bf5);}(_0x5ac6,0x151));var _0x65ac=function(_0x23c5ca,_0x27a725){_0x23c5ca=_0x23c5ca-0x0;var _0x1f640c=_0x5ac6[_0x23c5ca];return _0x1f640c;};'use strict';var _=require(_0x65ac('0x0'));var util=require(_0x65ac('0x1'));var moment=require(_0x65ac('0x2'));var BPromise=require(_0x65ac('0x3'));var rs=require(_0x65ac('0x4'));var fs=require('fs');var Redis=require(_0x65ac('0x5'));var db=require(_0x65ac('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x65ac('0x7'));var config=require(_0x65ac('0x8'));var jayson=require(_0x65ac('0x9'));var client=jayson[_0x65ac('0xa')][_0x65ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b56c6,_0x53ac30,_0x26876e){return new BPromise(function(_0x5ad0bd,_0x326d8f){return client[_0x65ac('0xc')](_0x1b56c6,_0x26876e)['then'](function(_0x3af3fa){logger['info'](_0x65ac('0xd'),_0x53ac30,_0x65ac('0xe'));logger[_0x65ac('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x53ac30,'request\x20sent',JSON[_0x65ac('0x10')](_0x3af3fa));if(_0x3af3fa[_0x65ac('0x11')]){if(_0x3af3fa[_0x65ac('0x11')][_0x65ac('0x12')]===0x1f4){logger['error'](_0x65ac('0xd'),_0x53ac30,_0x3af3fa[_0x65ac('0x11')][_0x65ac('0x13')]);return _0x326d8f(_0x3af3fa[_0x65ac('0x11')]['message']);}logger[_0x65ac('0x11')](_0x65ac('0xd'),_0x53ac30,_0x3af3fa[_0x65ac('0x11')][_0x65ac('0x13')]);return _0x5ad0bd(_0x3af3fa[_0x65ac('0x11')][_0x65ac('0x13')]);}else{logger[_0x65ac('0x14')](_0x65ac('0xd'),_0x53ac30,_0x65ac('0xe'));_0x5ad0bd(_0x3af3fa[_0x65ac('0x15')]['message']);}})[_0x65ac('0x16')](function(_0x51990c){logger['error'](_0x65ac('0xd'),_0x53ac30,_0x51990c);_0x326d8f(_0x51990c);});});}exports[_0x65ac('0x17')]=function(_0x56aed8){var _0x143245=this;return new Promise(function(_0x2d302a,_0x564175){return db[_0x65ac('0x18')][_0x65ac('0x19')]({'raw':_0x56aed8[_0x65ac('0x1a')]?_0x56aed8[_0x65ac('0x1a')][_0x65ac('0x1b')]===undefined?!![]:![]:!![],'where':_0x56aed8[_0x65ac('0x1a')]?_0x56aed8[_0x65ac('0x1a')][_0x65ac('0x1c')]||null:null,'attributes':_0x56aed8[_0x65ac('0x1a')]?_0x56aed8[_0x65ac('0x1a')][_0x65ac('0x1d')]||null:null,'limit':_0x56aed8[_0x65ac('0x1a')]?_0x56aed8[_0x65ac('0x1a')][_0x65ac('0x1e')]||null:null,'include':_0x56aed8['options']?_0x56aed8[_0x65ac('0x1a')][_0x65ac('0x1f')]?_['map'](_0x56aed8[_0x65ac('0x1a')][_0x65ac('0x1f')],function(_0x50f6e8){return{'model':db[_0x50f6e8[_0x65ac('0x20')]],'as':_0x50f6e8['as'],'attributes':_0x50f6e8[_0x65ac('0x1d')],'include':_0x50f6e8[_0x65ac('0x1f')]?_[_0x65ac('0x21')](_0x50f6e8['include'],function(_0x595c15){return{'model':db[_0x595c15[_0x65ac('0x20')]],'as':_0x595c15['as'],'attributes':_0x595c15[_0x65ac('0x1d')],'include':_0x595c15['include']?_[_0x65ac('0x21')](_0x595c15[_0x65ac('0x1f')],function(_0x913380){return{'model':db[_0x913380['model']],'as':_0x913380['as'],'attributes':_0x913380[_0x65ac('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x65ac('0x22')](function(_0x52e47a){logger[_0x65ac('0x14')]('GetTemplate',_0x56aed8);logger[_0x65ac('0xf')]('GetTemplate',_0x56aed8,JSON[_0x65ac('0x10')](_0x52e47a));_0x2d302a(_0x52e47a);})['catch'](function(_0x259532){logger[_0x65ac('0x11')](_0x65ac('0x17'),_0x259532[_0x65ac('0x13')],_0x56aed8);_0x564175(_0x143245['error'](0x1f4,_0x259532[_0x65ac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index cef843a..78c3b3a 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 _0x19f6=['create','addAllCondition','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions'];(function(_0x373600,_0x16c91e){var _0x51f877=function(_0x3e728b){while(--_0x3e728b){_0x373600['push'](_0x373600['shift']());}};_0x51f877(++_0x16c91e);}(_0x19f6,0x1ce));var _0x619f=function(_0x4c894b,_0x54fa91){_0x4c894b=_0x4c894b-0x0;var _0x490258=_0x19f6[_0x4c894b];return _0x490258;};'use strict';var multer=require(_0x619f('0x0'));var util=require(_0x619f('0x1'));var path=require(_0x619f('0x2'));var timeout=require(_0x619f('0x3'));var express=require(_0x619f('0x4'));var router=express[_0x619f('0x5')]();var fs_extra=require(_0x619f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x619f('0x7'));var config=require(_0x619f('0x8'));var controller=require('./trigger.controller');router[_0x619f('0x9')]('/',auth['isAuthenticated'](),controller[_0x619f('0xa')]);router[_0x619f('0x9')](_0x619f('0xb'),auth[_0x619f('0xc')](),controller[_0x619f('0xd')]);router['get'](_0x619f('0xe'),auth[_0x619f('0xc')](),controller['getAllConditions']);router[_0x619f('0x9')](_0x619f('0xf'),auth[_0x619f('0xc')](),controller['getAnyConditions']);router[_0x619f('0x9')](_0x619f('0x10'),auth[_0x619f('0xc')](),controller[_0x619f('0x11')]);router['post']('/',auth[_0x619f('0xc')](),controller[_0x619f('0x12')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x619f('0x13')]);router['post'](_0x619f('0xf'),auth[_0x619f('0xc')](),controller['addAnyCondition']);router[_0x619f('0x14')]('/:id/actions',auth[_0x619f('0xc')](),controller['addAction']);router['put'](_0x619f('0xb'),auth[_0x619f('0xc')](),controller['update']);router[_0x619f('0x15')](_0x619f('0xb'),auth[_0x619f('0xc')](),controller[_0x619f('0x16')]);module[_0x619f('0x17')]=router; \ No newline at end of file +var _0xf117=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports'];(function(_0x5e6935,_0x23d0a4){var _0x5498f9=function(_0x592401){while(--_0x592401){_0x5e6935['push'](_0x5e6935['shift']());}};_0x5498f9(++_0x23d0a4);}(_0xf117,0x122));var _0x7f11=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xf117[_0x11005e];return _0x29338f;};'use strict';var multer=require('multer');var util=require(_0x7f11('0x0'));var path=require(_0x7f11('0x1'));var timeout=require(_0x7f11('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7f11('0x3'));var auth=require(_0x7f11('0x4'));var interaction=require(_0x7f11('0x5'));var config=require(_0x7f11('0x6'));var controller=require(_0x7f11('0x7'));router[_0x7f11('0x8')]('/',auth[_0x7f11('0x9')](),controller[_0x7f11('0xa')]);router[_0x7f11('0x8')](_0x7f11('0xb'),auth[_0x7f11('0x9')](),controller[_0x7f11('0xc')]);router['get']('/:id/all_conditions',auth[_0x7f11('0x9')](),controller[_0x7f11('0xd')]);router[_0x7f11('0x8')](_0x7f11('0xe'),auth[_0x7f11('0x9')](),controller[_0x7f11('0xf')]);router[_0x7f11('0x8')](_0x7f11('0x10'),auth['isAuthenticated'](),controller[_0x7f11('0x11')]);router[_0x7f11('0x12')]('/',auth[_0x7f11('0x9')](),controller[_0x7f11('0x13')]);router[_0x7f11('0x12')](_0x7f11('0x14'),auth[_0x7f11('0x9')](),controller[_0x7f11('0x15')]);router['post']('/:id/any_conditions',auth[_0x7f11('0x9')](),controller[_0x7f11('0x16')]);router['post']('/:id/actions',auth[_0x7f11('0x9')](),controller[_0x7f11('0x17')]);router[_0x7f11('0x18')](_0x7f11('0xb'),auth[_0x7f11('0x9')](),controller[_0x7f11('0x19')]);router[_0x7f11('0x1a')](_0x7f11('0xb'),auth[_0x7f11('0x9')](),controller[_0x7f11('0x1b')]);module[_0x7f11('0x1c')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 8ba0aec..b8b7b37 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 _0x247a=['STRING','BOOLEAN','sequelize','exports'];(function(_0x261aec,_0x42733f){var _0x2ff4fa=function(_0x1e2a97){while(--_0x1e2a97){_0x261aec['push'](_0x261aec['shift']());}};_0x2ff4fa(++_0x42733f);}(_0x247a,0x10a));var _0xa247=function(_0x32292b,_0x4e9525){_0x32292b=_0x32292b-0x0;var _0x1845b4=_0x247a[_0x32292b];return _0x1845b4;};'use strict';var Sequelize=require(_0xa247('0x0'));module[_0xa247('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa247('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa247('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc387=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2378ff,_0x1b24e0){var _0x11ac79=function(_0x95fbd6){while(--_0x95fbd6){_0x2378ff['push'](_0x2378ff['shift']());}};_0x11ac79(++_0x1b24e0);}(_0xc387,0x168));var _0x7c38=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc387[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7c38('0x0'));module[_0x7c38('0x1')]={'name':{'type':Sequelize[_0x7c38('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7c38('0x2')]},'status':{'type':Sequelize[_0x7c38('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 280e4cb..821f47d 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 _0xad17=['options','includeAll','Trigger','rows','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','getAnyConditions','addAction','TriggerId','Action','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','then','destroy','Triggers','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge'];(function(_0x4e0de0,_0x268aa7){var _0x5d5e3f=function(_0x3d0adb){while(--_0x3d0adb){_0x4e0de0['push'](_0x4e0de0['shift']());}};_0x5d5e3f(++_0x268aa7);}(_0xad17,0x18e));var _0x7ad1=function(_0x2d77e1,_0xac474b){_0x2d77e1=_0x2d77e1-0x0;var _0x13781a=_0xad17[_0x2d77e1];return _0x13781a;};'use strict';var emlformat=require(_0x7ad1('0x0'));var rimraf=require(_0x7ad1('0x1'));var zipdir=require(_0x7ad1('0x2'));var jsonpatch=require(_0x7ad1('0x3'));var rp=require('request-promise');var moment=require(_0x7ad1('0x4'));var BPromise=require(_0x7ad1('0x5'));var Mustache=require(_0x7ad1('0x6'));var util=require('util');var path=require(_0x7ad1('0x7'));var sox=require('sox');var csv=require(_0x7ad1('0x8'));var ejs=require(_0x7ad1('0x9'));var fs=require('fs');var fs_extra=require(_0x7ad1('0xa'));var _=require(_0x7ad1('0xb'));var squel=require(_0x7ad1('0xc'));var crypto=require('crypto');var jsforce=require(_0x7ad1('0xd'));var deskjs=require(_0x7ad1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7ad1('0xf'));var Papa=require(_0x7ad1('0x10'));var Redis=require(_0x7ad1('0x11'));var authService=require(_0x7ad1('0x12'));var qs=require(_0x7ad1('0x13'));var as=require(_0x7ad1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ad1('0x15'))('api');var utils=require(_0x7ad1('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd652,_0x326376){_0x326376=_0x326376||0xcc;return function(_0x2d0ebb){if(_0x2d0ebb){return _0x4cd652[_0x7ad1('0x17')](_0x326376);}return _0x4cd652[_0x7ad1('0x18')](_0x326376)[_0x7ad1('0x19')]();};}function respondWithResult(_0x28eb73,_0x25aeab){_0x25aeab=_0x25aeab||0xc8;return function(_0x30e6d9){if(_0x30e6d9){return _0x28eb73[_0x7ad1('0x18')](_0x25aeab)['json'](_0x30e6d9);}};}function respondWithFilteredResult(_0x309a94,_0xc3c4c9){return function(_0x8f1fbb){if(_0x8f1fbb){var _0x13ddb8=typeof _0xc3c4c9[_0x7ad1('0x1a')]===_0x7ad1('0x1b')&&typeof _0xc3c4c9[_0x7ad1('0x1c')]===_0x7ad1('0x1b');var _0x49b009=_0x8f1fbb[_0x7ad1('0x1d')];var _0x13e7a8=_0x13ddb8?0x0:_0xc3c4c9[_0x7ad1('0x1a')];var _0x5d951c=_0x13ddb8?_0x8f1fbb[_0x7ad1('0x1d')]:_0xc3c4c9['offset']+_0xc3c4c9[_0x7ad1('0x1c')];var _0x35bd51;if(_0x5d951c>=_0x49b009){_0x5d951c=_0x49b009;_0x35bd51=0xc8;}else{_0x35bd51=0xce;}_0x309a94[_0x7ad1('0x18')](_0x35bd51);return _0x309a94['set'](_0x7ad1('0x1e'),_0x13e7a8+'-'+_0x5d951c+'/'+_0x49b009)[_0x7ad1('0x1f')](_0x8f1fbb);}return null;};}function patchUpdates(_0x24b4ff){return function(_0x461cf7){try{jsonpatch[_0x7ad1('0x20')](_0x461cf7,_0x24b4ff,!![]);}catch(_0x1452ff){return BPromise['reject'](_0x1452ff);}return _0x461cf7[_0x7ad1('0x21')]();};}function saveUpdates(_0x1d1657,_0x504ded){return function(_0x5e1877){if(_0x5e1877){return _0x5e1877['update'](_0x1d1657)[_0x7ad1('0x22')](function(_0x2d0b24){return _0x2d0b24;});}return null;};}function removeEntity(_0x580100,_0x2d44b5){return function(_0x145376){if(_0x145376){return _0x145376[_0x7ad1('0x23')]()[_0x7ad1('0x22')](function(){var _0xde7e30=_0x145376['get']({'plain':!![]});var _0x28b55e=_0x7ad1('0x24');return db[_0x7ad1('0x25')]['destroy']({'where':{'type':_0x28b55e,'resourceId':_0xde7e30['id']}})[_0x7ad1('0x22')](function(){return _0x145376;});})[_0x7ad1('0x22')](function(){_0x580100[_0x7ad1('0x18')](0xcc)[_0x7ad1('0x19')]();});}};}function handleEntityNotFound(_0x68a39,_0x1af657){return function(_0x3ab7b3){if(!_0x3ab7b3){_0x68a39['sendStatus'](0x194);}return _0x3ab7b3;};}function handleError(_0x566af0,_0x168283){_0x168283=_0x168283||0x1f4;return function(_0x15a576){logger[_0x7ad1('0x26')](_0x15a576[_0x7ad1('0x27')]);if(_0x15a576['name']){delete _0x15a576[_0x7ad1('0x28')];}_0x566af0[_0x7ad1('0x18')](_0x168283)[_0x7ad1('0x29')](_0x15a576);};}exports['index']=function(_0x2b34f1,_0x1c94f6){var _0x22331a={},_0x40d0af={},_0x2f3f3c={'count':0x0,'rows':[]};var _0x39f74d=_[_0x7ad1('0x2a')](db['Trigger'][_0x7ad1('0x2b')],function(_0x4d2aba){return{'name':_0x4d2aba[_0x7ad1('0x2c')],'type':_0x4d2aba[_0x7ad1('0x2d')][_0x7ad1('0x2e')]};});_0x40d0af[_0x7ad1('0x2f')]=_[_0x7ad1('0x2a')](_0x39f74d,_0x7ad1('0x28'));_0x40d0af['query']=_[_0x7ad1('0x30')](_0x2b34f1['query']);_0x40d0af['filters']=_[_0x7ad1('0x31')](_0x40d0af[_0x7ad1('0x2f')],_0x40d0af['query']);_0x22331a[_0x7ad1('0x32')]=_['intersection'](_0x40d0af[_0x7ad1('0x2f')],qs[_0x7ad1('0x33')](_0x2b34f1[_0x7ad1('0x34')][_0x7ad1('0x33')]));_0x22331a[_0x7ad1('0x32')]=_0x22331a['attributes'][_0x7ad1('0x35')]?_0x22331a[_0x7ad1('0x32')]:_0x40d0af[_0x7ad1('0x2f')];if(!_0x2b34f1['query'][_0x7ad1('0x36')](_0x7ad1('0x37'))){_0x22331a[_0x7ad1('0x1c')]=qs[_0x7ad1('0x1c')](_0x2b34f1[_0x7ad1('0x34')][_0x7ad1('0x1c')]);_0x22331a[_0x7ad1('0x1a')]=qs[_0x7ad1('0x1a')](_0x2b34f1[_0x7ad1('0x34')][_0x7ad1('0x1a')]);}_0x22331a['order']=qs[_0x7ad1('0x38')](_0x2b34f1[_0x7ad1('0x34')][_0x7ad1('0x38')]);_0x22331a[_0x7ad1('0x39')]=qs[_0x7ad1('0x3a')](_[_0x7ad1('0x3b')](_0x2b34f1[_0x7ad1('0x34')],_0x40d0af['filters']),_0x39f74d);if(_0x2b34f1[_0x7ad1('0x34')]['filter']){_0x22331a['where']=_['merge'](_0x22331a[_0x7ad1('0x39')],{'$or':_[_0x7ad1('0x2a')](_0x39f74d,function(_0x158e45){if(_0x158e45[_0x7ad1('0x2d')]!=='VIRTUAL'){var _0x2489cb={};_0x2489cb[_0x158e45[_0x7ad1('0x28')]]={'$like':'%'+_0x2b34f1['query'][_0x7ad1('0x3c')]+'%'};return _0x2489cb;}})});}_0x22331a=_[_0x7ad1('0x3d')]({},_0x22331a,_0x2b34f1[_0x7ad1('0x3e')]);var _0x4ce028={'where':_0x22331a[_0x7ad1('0x39')]};return db['Trigger'][_0x7ad1('0x1d')](_0x4ce028)['then'](function(_0x3b3ae5){_0x2f3f3c['count']=_0x3b3ae5;if(_0x2b34f1['query'][_0x7ad1('0x3f')]){_0x22331a['include']=[{'all':!![]}];}return db[_0x7ad1('0x40')]['findAll'](_0x22331a);})[_0x7ad1('0x22')](function(_0x31df74){_0x2f3f3c[_0x7ad1('0x41')]=_0x31df74;return _0x2f3f3c;})[_0x7ad1('0x22')](respondWithFilteredResult(_0x1c94f6,_0x22331a))[_0x7ad1('0x42')](handleError(_0x1c94f6,null));};exports[_0x7ad1('0x43')]=function(_0x48ce9e,_0x12d1f0){var _0x508fc2={'raw':![],'where':{'id':_0x48ce9e[_0x7ad1('0x44')]['id']}},_0x29223d={};_0x29223d[_0x7ad1('0x2f')]=_[_0x7ad1('0x30')](db[_0x7ad1('0x40')][_0x7ad1('0x2b')]);_0x29223d[_0x7ad1('0x34')]=_[_0x7ad1('0x30')](_0x48ce9e['query']);_0x29223d['filters']=_[_0x7ad1('0x31')](_0x29223d[_0x7ad1('0x2f')],_0x29223d[_0x7ad1('0x34')]);_0x508fc2['attributes']=_[_0x7ad1('0x31')](_0x29223d['model'],qs[_0x7ad1('0x33')](_0x48ce9e[_0x7ad1('0x34')][_0x7ad1('0x33')]));_0x508fc2[_0x7ad1('0x32')]=_0x508fc2[_0x7ad1('0x32')][_0x7ad1('0x35')]?_0x508fc2[_0x7ad1('0x32')]:_0x29223d[_0x7ad1('0x2f')];if(_0x48ce9e[_0x7ad1('0x34')][_0x7ad1('0x3f')]){_0x508fc2[_0x7ad1('0x45')]=[{'all':!![]}];}_0x508fc2=_[_0x7ad1('0x3d')]({},_0x508fc2,_0x48ce9e[_0x7ad1('0x3e')]);return db['Trigger'][_0x7ad1('0x46')](_0x508fc2)[_0x7ad1('0x22')](handleEntityNotFound(_0x12d1f0,null))[_0x7ad1('0x22')](respondWithResult(_0x12d1f0,null))[_0x7ad1('0x42')](handleError(_0x12d1f0,null));};exports[_0x7ad1('0x47')]=function(_0x5c1a8b,_0x9ce4cd){return db[_0x7ad1('0x40')]['create'](_0x5c1a8b[_0x7ad1('0x48')],{})['then'](function(_0x19b2f9){var _0x5981cf=_0x5c1a8b[_0x7ad1('0x49')][_0x7ad1('0x4a')]({'plain':!![]});if(!_0x5981cf)throw new Error(_0x7ad1('0x4b'));if(_0x5981cf['role']==='user'){var _0x575932=_0x19b2f9[_0x7ad1('0x4a')]({'plain':!![]});var _0x4c62a9=_0x7ad1('0x24');return db[_0x7ad1('0x4c')][_0x7ad1('0x46')]({'where':{'name':_0x4c62a9,'userProfileId':_0x5981cf[_0x7ad1('0x4d')]},'raw':!![]})['then'](function(_0x41f6b9){if(_0x41f6b9&&_0x41f6b9[_0x7ad1('0x4e')]===0x0){return db[_0x7ad1('0x25')][_0x7ad1('0x47')]({'name':_0x575932[_0x7ad1('0x28')],'resourceId':_0x575932['id'],'type':_0x41f6b9[_0x7ad1('0x28')],'sectionId':_0x41f6b9['id']},{})['then'](function(){return _0x19b2f9;});}else{return _0x19b2f9;}})[_0x7ad1('0x42')](function(_0x5afc9d){logger[_0x7ad1('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5afc9d);throw _0x5afc9d;});}return _0x19b2f9;})[_0x7ad1('0x22')](respondWithResult(_0x9ce4cd,0xc9))['catch'](handleError(_0x9ce4cd,null));};exports['update']=function(_0x376bba,_0xc560e3){if(_0x376bba[_0x7ad1('0x48')]['id']){delete _0x376bba[_0x7ad1('0x48')]['id'];}return db[_0x7ad1('0x40')]['find']({'where':{'id':_0x376bba['params']['id']}})[_0x7ad1('0x22')](handleEntityNotFound(_0xc560e3,null))[_0x7ad1('0x22')](saveUpdates(_0x376bba[_0x7ad1('0x48')],null))[_0x7ad1('0x22')](respondWithResult(_0xc560e3,null))['catch'](handleError(_0xc560e3,null));};exports[_0x7ad1('0x23')]=function(_0x503653,_0x232118){return db[_0x7ad1('0x40')][_0x7ad1('0x46')]({'where':{'id':_0x503653[_0x7ad1('0x44')]['id']}})[_0x7ad1('0x22')](handleEntityNotFound(_0x232118,null))[_0x7ad1('0x22')](removeEntity(_0x232118,null))[_0x7ad1('0x42')](handleError(_0x232118,null));};exports[_0x7ad1('0x4f')]=function(_0x9c6b03,_0x55bf94,_0x1a3bbe){if(_0x9c6b03['body']['id']){delete _0x9c6b03[_0x7ad1('0x48')]['id'];}return db[_0x7ad1('0x40')][_0x7ad1('0x46')]({'where':{'id':_0x9c6b03[_0x7ad1('0x44')]['id']}})[_0x7ad1('0x22')](handleEntityNotFound(_0x55bf94,null))[_0x7ad1('0x22')](function(_0x46168b){if(_0x46168b){_0x9c6b03['body'][_0x7ad1('0x50')]=_0x46168b['id'];return db[_0x7ad1('0x51')][_0x7ad1('0x47')](_0x9c6b03[_0x7ad1('0x48')]);}})[_0x7ad1('0x22')](respondWithResult(_0x55bf94,null))['catch'](handleError(_0x55bf94,null));};exports[_0x7ad1('0x52')]=function(_0x10ad5a,_0x288839,_0x3f49ba){if(_0x10ad5a['body']['id']){delete _0x10ad5a[_0x7ad1('0x48')]['id'];}return db[_0x7ad1('0x40')][_0x7ad1('0x46')]({'where':{'id':_0x10ad5a[_0x7ad1('0x44')]['id']}})['then'](handleEntityNotFound(_0x288839,null))[_0x7ad1('0x22')](function(_0xcacb77){if(_0xcacb77){_0x10ad5a[_0x7ad1('0x48')][_0x7ad1('0x53')]=_0xcacb77['id'];return db[_0x7ad1('0x51')][_0x7ad1('0x47')](_0x10ad5a[_0x7ad1('0x48')]);}})['then'](respondWithResult(_0x288839,null))[_0x7ad1('0x42')](handleError(_0x288839,null));};exports[_0x7ad1('0x54')]=function(_0x11241c,_0x13b6b1,_0xe32ae9){var _0x217b58={};var _0x1eafcf={};var _0x4196ff;var _0x78e7e0;return db[_0x7ad1('0x40')]['findOne']({'where':{'id':_0x11241c[_0x7ad1('0x44')]['id']}})[_0x7ad1('0x22')](handleEntityNotFound(_0x13b6b1,null))[_0x7ad1('0x22')](function(_0x1563fe){if(_0x1563fe){_0x4196ff=_0x1563fe;_0x1eafcf['model']=_[_0x7ad1('0x30')](db[_0x7ad1('0x51')][_0x7ad1('0x2b')]);_0x1eafcf[_0x7ad1('0x34')]=_[_0x7ad1('0x30')](_0x11241c[_0x7ad1('0x34')]);_0x1eafcf['filters']=_[_0x7ad1('0x31')](_0x1eafcf[_0x7ad1('0x2f')],_0x1eafcf[_0x7ad1('0x34')]);_0x217b58['attributes']=_[_0x7ad1('0x31')](_0x1eafcf[_0x7ad1('0x2f')],qs[_0x7ad1('0x33')](_0x11241c['query'][_0x7ad1('0x33')]));_0x217b58[_0x7ad1('0x32')]=_0x217b58[_0x7ad1('0x32')]['length']?_0x217b58[_0x7ad1('0x32')]:_0x1eafcf[_0x7ad1('0x2f')];_0x217b58[_0x7ad1('0x55')]=qs[_0x7ad1('0x38')](_0x11241c['query'][_0x7ad1('0x38')]);_0x217b58[_0x7ad1('0x39')]=qs[_0x7ad1('0x3a')](_[_0x7ad1('0x3b')](_0x11241c[_0x7ad1('0x34')],_0x1eafcf[_0x7ad1('0x3a')]));if(_0x11241c['query'][_0x7ad1('0x3c')]){_0x217b58[_0x7ad1('0x39')]=_['merge'](_0x217b58['where'],{'$or':_[_0x7ad1('0x2a')](_0x217b58[_0x7ad1('0x32')],function(_0x230f99){var _0x56a131={};_0x56a131[_0x230f99]={'$like':'%'+_0x11241c[_0x7ad1('0x34')][_0x7ad1('0x3c')]+'%'};return _0x56a131;})});}_0x217b58=_[_0x7ad1('0x3d')]({},_0x217b58,_0x11241c[_0x7ad1('0x3e')]);return _0x4196ff['getAllConditions'](_0x217b58);}})[_0x7ad1('0x22')](function(_0xeef252){if(_0xeef252){_0x78e7e0=_0xeef252[_0x7ad1('0x35')];if(!_0x11241c[_0x7ad1('0x34')]['hasOwnProperty']('nolimit')){_0x217b58['limit']=qs[_0x7ad1('0x1c')](_0x11241c[_0x7ad1('0x34')][_0x7ad1('0x1c')]);_0x217b58[_0x7ad1('0x1a')]=qs[_0x7ad1('0x1a')](_0x11241c['query']['offset']);}return _0x4196ff[_0x7ad1('0x54')](_0x217b58);}})[_0x7ad1('0x22')](function(_0x2d0fd4){if(_0x2d0fd4){return _0x2d0fd4?{'count':_0x78e7e0,'rows':_0x2d0fd4}:null;}})[_0x7ad1('0x22')](respondWithResult(_0x13b6b1,null))['catch'](handleError(_0x13b6b1,null));};exports[_0x7ad1('0x56')]=function(_0x475407,_0xd10962,_0x3e3149){var _0x1c89a2={};var _0x56d771={};var _0x5260f0;var _0x249cc1;return db[_0x7ad1('0x40')]['findOne']({'where':{'id':_0x475407['params']['id']}})[_0x7ad1('0x22')](handleEntityNotFound(_0xd10962,null))[_0x7ad1('0x22')](function(_0x3c6dd4){if(_0x3c6dd4){_0x5260f0=_0x3c6dd4;_0x56d771[_0x7ad1('0x2f')]=_['keys'](db[_0x7ad1('0x51')]['rawAttributes']);_0x56d771[_0x7ad1('0x34')]=_[_0x7ad1('0x30')](_0x475407['query']);_0x56d771[_0x7ad1('0x3a')]=_[_0x7ad1('0x31')](_0x56d771[_0x7ad1('0x2f')],_0x56d771[_0x7ad1('0x34')]);_0x1c89a2[_0x7ad1('0x32')]=_[_0x7ad1('0x31')](_0x56d771[_0x7ad1('0x2f')],qs[_0x7ad1('0x33')](_0x475407['query'][_0x7ad1('0x33')]));_0x1c89a2['attributes']=_0x1c89a2[_0x7ad1('0x32')][_0x7ad1('0x35')]?_0x1c89a2[_0x7ad1('0x32')]:_0x56d771[_0x7ad1('0x2f')];_0x1c89a2[_0x7ad1('0x55')]=qs[_0x7ad1('0x38')](_0x475407[_0x7ad1('0x34')][_0x7ad1('0x38')]);_0x1c89a2[_0x7ad1('0x39')]=qs['filters'](_[_0x7ad1('0x3b')](_0x475407[_0x7ad1('0x34')],_0x56d771['filters']));if(_0x475407[_0x7ad1('0x34')][_0x7ad1('0x3c')]){_0x1c89a2[_0x7ad1('0x39')]=_[_0x7ad1('0x3d')](_0x1c89a2[_0x7ad1('0x39')],{'$or':_['map'](_0x1c89a2[_0x7ad1('0x32')],function(_0x375648){var _0x246eb0={};_0x246eb0[_0x375648]={'$like':'%'+_0x475407[_0x7ad1('0x34')][_0x7ad1('0x3c')]+'%'};return _0x246eb0;})});}_0x1c89a2=_['merge']({},_0x1c89a2,_0x475407[_0x7ad1('0x3e')]);return _0x5260f0[_0x7ad1('0x56')](_0x1c89a2);}})['then'](function(_0x4f78f7){if(_0x4f78f7){_0x249cc1=_0x4f78f7['length'];if(!_0x475407[_0x7ad1('0x34')][_0x7ad1('0x36')](_0x7ad1('0x37'))){_0x1c89a2[_0x7ad1('0x1c')]=qs[_0x7ad1('0x1c')](_0x475407['query'][_0x7ad1('0x1c')]);_0x1c89a2[_0x7ad1('0x1a')]=qs[_0x7ad1('0x1a')](_0x475407['query'][_0x7ad1('0x1a')]);}return _0x5260f0[_0x7ad1('0x56')](_0x1c89a2);}})[_0x7ad1('0x22')](function(_0x42b000){if(_0x42b000){return _0x42b000?{'count':_0x249cc1,'rows':_0x42b000}:null;}})[_0x7ad1('0x22')](respondWithResult(_0xd10962,null))[_0x7ad1('0x42')](handleError(_0xd10962,null));};exports[_0x7ad1('0x57')]=function(_0x427dea,_0x4fa331,_0x554afc){if(_0x427dea[_0x7ad1('0x48')]['id']){delete _0x427dea[_0x7ad1('0x48')]['id'];}return db[_0x7ad1('0x40')][_0x7ad1('0x46')]({'where':{'id':_0x427dea[_0x7ad1('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fa331,null))[_0x7ad1('0x22')](function(_0x100aad){if(_0x100aad){_0x427dea[_0x7ad1('0x48')][_0x7ad1('0x58')]=_0x100aad['id'];return db[_0x7ad1('0x59')]['create'](_0x427dea[_0x7ad1('0x48')]);}})['then'](respondWithResult(_0x4fa331,null))[_0x7ad1('0x42')](handleError(_0x4fa331,null));};exports[_0x7ad1('0x5a')]=function(_0x177473,_0x3b9390,_0xc4960d){var _0x255350={};var _0x58a435={};var _0x9fba97;var _0x43d90a;return db['Trigger'][_0x7ad1('0x5b')]({'where':{'id':_0x177473[_0x7ad1('0x44')]['id']}})[_0x7ad1('0x22')](handleEntityNotFound(_0x3b9390,null))[_0x7ad1('0x22')](function(_0x5dccb5){if(_0x5dccb5){_0x9fba97=_0x5dccb5;_0x58a435[_0x7ad1('0x2f')]=_[_0x7ad1('0x30')](db[_0x7ad1('0x59')][_0x7ad1('0x2b')]);_0x58a435[_0x7ad1('0x34')]=_['keys'](_0x177473[_0x7ad1('0x34')]);_0x58a435[_0x7ad1('0x3a')]=_[_0x7ad1('0x31')](_0x58a435[_0x7ad1('0x2f')],_0x58a435[_0x7ad1('0x34')]);_0x255350['attributes']=_[_0x7ad1('0x31')](_0x58a435['model'],qs[_0x7ad1('0x33')](_0x177473['query'][_0x7ad1('0x33')]));_0x255350['attributes']=_0x255350['attributes'][_0x7ad1('0x35')]?_0x255350[_0x7ad1('0x32')]:_0x58a435[_0x7ad1('0x2f')];_0x255350[_0x7ad1('0x55')]=qs[_0x7ad1('0x38')](_0x177473['query'][_0x7ad1('0x38')]);_0x255350[_0x7ad1('0x39')]=qs[_0x7ad1('0x3a')](_[_0x7ad1('0x3b')](_0x177473['query'],_0x58a435[_0x7ad1('0x3a')]));if(_0x177473[_0x7ad1('0x34')][_0x7ad1('0x3c')]){_0x255350[_0x7ad1('0x39')]=_[_0x7ad1('0x3d')](_0x255350[_0x7ad1('0x39')],{'$or':_[_0x7ad1('0x2a')](_0x255350[_0x7ad1('0x32')],function(_0x418027){var _0x23c8e7={};_0x23c8e7[_0x418027]={'$like':'%'+_0x177473[_0x7ad1('0x34')][_0x7ad1('0x3c')]+'%'};return _0x23c8e7;})});}_0x255350=_[_0x7ad1('0x3d')]({},_0x255350,_0x177473[_0x7ad1('0x3e')]);return _0x9fba97[_0x7ad1('0x5a')](_0x255350);}})[_0x7ad1('0x22')](function(_0x5281f7){if(_0x5281f7){_0x43d90a=_0x5281f7[_0x7ad1('0x35')];if(!_0x177473[_0x7ad1('0x34')][_0x7ad1('0x36')](_0x7ad1('0x37'))){_0x255350[_0x7ad1('0x1c')]=qs['limit'](_0x177473[_0x7ad1('0x34')][_0x7ad1('0x1c')]);_0x255350[_0x7ad1('0x1a')]=qs[_0x7ad1('0x1a')](_0x177473[_0x7ad1('0x34')][_0x7ad1('0x1a')]);}return _0x9fba97[_0x7ad1('0x5a')](_0x255350);}})[_0x7ad1('0x22')](function(_0x1a585d){if(_0x1a585d){return _0x1a585d?{'count':_0x43d90a,'rows':_0x1a585d}:null;}})[_0x7ad1('0x22')](respondWithResult(_0x3b9390,null))[_0x7ad1('0x42')](handleError(_0x3b9390,null));}; \ No newline at end of file +var _0x3934=['catch','show','params','find','create','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','TriggerAllId','Condition','TriggerAnyId','findOne','getAllConditions','hasOwnProperty','getAnyConditions','nolimit','TriggerId','Action','getActions','eml-format','zip-dir','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','Triggers','UserProfileResource','sendStatus','error','name','send','index','Trigger','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x2cbae9,_0x3b70c1){var _0x4bbf35=function(_0x3f2004){while(--_0x3f2004){_0x2cbae9['push'](_0x2cbae9['shift']());}};_0x4bbf35(++_0x3b70c1);}(_0x3934,0xc0));var _0x4393=function(_0x3f5e4c,_0x2b74d0){_0x3f5e4c=_0x3f5e4c-0x0;var _0x225d1d=_0x3934[_0x3f5e4c];return _0x225d1d;};'use strict';var emlformat=require(_0x4393('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4393('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4393('0x2'));var BPromise=require(_0x4393('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4393('0x4'));var sox=require(_0x4393('0x5'));var csv=require(_0x4393('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4393('0x7'));var squel=require('squel');var crypto=require(_0x4393('0x8'));var jsforce=require(_0x4393('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4393('0x6'));var querystring=require(_0x4393('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4393('0xb'));var qs=require(_0x4393('0xc'));var as=require(_0x4393('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4393('0xe'))('api');var utils=require(_0x4393('0xf'));var config=require(_0x4393('0x10'));var licenseUtil=require(_0x4393('0x11'));var db=require(_0x4393('0x12'))['db'];function respondWithStatusCode(_0x264953,_0x4e1ea0){_0x4e1ea0=_0x4e1ea0||0xcc;return function(_0x2db99d){if(_0x2db99d){return _0x264953['sendStatus'](_0x4e1ea0);}return _0x264953[_0x4393('0x13')](_0x4e1ea0)[_0x4393('0x14')]();};}function respondWithResult(_0x4e9125,_0x5b3239){_0x5b3239=_0x5b3239||0xc8;return function(_0x54ea7b){if(_0x54ea7b){return _0x4e9125[_0x4393('0x13')](_0x5b3239)['json'](_0x54ea7b);}};}function respondWithFilteredResult(_0x3473f6,_0x238d41){return function(_0x276854){if(_0x276854){var _0x519b27=typeof _0x238d41[_0x4393('0x15')]===_0x4393('0x16')&&typeof _0x238d41[_0x4393('0x17')]===_0x4393('0x16');var _0x1772b3=_0x276854['count'];var _0x567ce5=_0x519b27?0x0:_0x238d41[_0x4393('0x15')];var _0x349a9a=_0x519b27?_0x276854[_0x4393('0x18')]:_0x238d41[_0x4393('0x15')]+_0x238d41[_0x4393('0x17')];var _0x5f1b23;if(_0x349a9a>=_0x1772b3){_0x349a9a=_0x1772b3;_0x5f1b23=0xc8;}else{_0x5f1b23=0xce;}_0x3473f6['status'](_0x5f1b23);return _0x3473f6['set'](_0x4393('0x19'),_0x567ce5+'-'+_0x349a9a+'/'+_0x1772b3)[_0x4393('0x1a')](_0x276854);}return null;};}function patchUpdates(_0x148e50){return function(_0x311760){try{jsonpatch[_0x4393('0x1b')](_0x311760,_0x148e50,!![]);}catch(_0x5ada69){return BPromise['reject'](_0x5ada69);}return _0x311760[_0x4393('0x1c')]();};}function saveUpdates(_0x3e1eb0,_0x5a5c34){return function(_0x22868a){if(_0x22868a){return _0x22868a[_0x4393('0x1d')](_0x3e1eb0)[_0x4393('0x1e')](function(_0xb09d2c){return _0xb09d2c;});}return null;};}function removeEntity(_0x2aaf2f,_0x13e2bb){return function(_0x35d937){if(_0x35d937){return _0x35d937[_0x4393('0x1f')]()[_0x4393('0x1e')](function(){var _0x2239a4=_0x35d937['get']({'plain':!![]});var _0x40b384=_0x4393('0x20');return db[_0x4393('0x21')]['destroy']({'where':{'type':_0x40b384,'resourceId':_0x2239a4['id']}})[_0x4393('0x1e')](function(){return _0x35d937;});})[_0x4393('0x1e')](function(){_0x2aaf2f[_0x4393('0x13')](0xcc)[_0x4393('0x14')]();});}};}function handleEntityNotFound(_0x543df9,_0x133e31){return function(_0x3241ff){if(!_0x3241ff){_0x543df9[_0x4393('0x22')](0x194);}return _0x3241ff;};}function handleError(_0x169859,_0xab65f6){_0xab65f6=_0xab65f6||0x1f4;return function(_0x5e8a91){logger[_0x4393('0x23')](_0x5e8a91['stack']);if(_0x5e8a91[_0x4393('0x24')]){delete _0x5e8a91[_0x4393('0x24')];}_0x169859[_0x4393('0x13')](_0xab65f6)[_0x4393('0x25')](_0x5e8a91);};}exports[_0x4393('0x26')]=function(_0x5ad273,_0x53ab4e){var _0x186875={},_0x2a2314={},_0x3f223b={'count':0x0,'rows':[]};var _0x27a79f=_['map'](db[_0x4393('0x27')][_0x4393('0x28')],function(_0x5d0e25){return{'name':_0x5d0e25[_0x4393('0x29')],'type':_0x5d0e25['type'][_0x4393('0x2a')]};});_0x2a2314[_0x4393('0x2b')]=_[_0x4393('0x2c')](_0x27a79f,_0x4393('0x24'));_0x2a2314[_0x4393('0x2d')]=_[_0x4393('0x2e')](_0x5ad273['query']);_0x2a2314[_0x4393('0x2f')]=_[_0x4393('0x30')](_0x2a2314[_0x4393('0x2b')],_0x2a2314[_0x4393('0x2d')]);_0x186875[_0x4393('0x31')]=_[_0x4393('0x30')](_0x2a2314[_0x4393('0x2b')],qs[_0x4393('0x32')](_0x5ad273[_0x4393('0x2d')][_0x4393('0x32')]));_0x186875['attributes']=_0x186875[_0x4393('0x31')][_0x4393('0x33')]?_0x186875[_0x4393('0x31')]:_0x2a2314['model'];if(!_0x5ad273[_0x4393('0x2d')]['hasOwnProperty']('nolimit')){_0x186875[_0x4393('0x17')]=qs[_0x4393('0x17')](_0x5ad273['query']['limit']);_0x186875['offset']=qs[_0x4393('0x15')](_0x5ad273[_0x4393('0x2d')][_0x4393('0x15')]);}_0x186875[_0x4393('0x34')]=qs['sort'](_0x5ad273[_0x4393('0x2d')][_0x4393('0x35')]);_0x186875[_0x4393('0x36')]=qs['filters'](_[_0x4393('0x37')](_0x5ad273[_0x4393('0x2d')],_0x2a2314['filters']),_0x27a79f);if(_0x5ad273['query'][_0x4393('0x38')]){_0x186875[_0x4393('0x36')]=_[_0x4393('0x39')](_0x186875[_0x4393('0x36')],{'$or':_[_0x4393('0x2c')](_0x27a79f,function(_0x2b27a3){if(_0x2b27a3['type']!=='VIRTUAL'){var _0x573d00={};_0x573d00[_0x2b27a3[_0x4393('0x24')]]={'$like':'%'+_0x5ad273[_0x4393('0x2d')][_0x4393('0x38')]+'%'};return _0x573d00;}})});}_0x186875=_[_0x4393('0x39')]({},_0x186875,_0x5ad273[_0x4393('0x3a')]);var _0x4aefbb={'where':_0x186875[_0x4393('0x36')]};return db[_0x4393('0x27')]['count'](_0x4aefbb)[_0x4393('0x1e')](function(_0x1ff21b){_0x3f223b[_0x4393('0x18')]=_0x1ff21b;if(_0x5ad273[_0x4393('0x2d')][_0x4393('0x3b')]){_0x186875[_0x4393('0x3c')]=[{'all':!![]}];}return db['Trigger'][_0x4393('0x3d')](_0x186875);})[_0x4393('0x1e')](function(_0x44d62e){_0x3f223b[_0x4393('0x3e')]=_0x44d62e;return _0x3f223b;})[_0x4393('0x1e')](respondWithFilteredResult(_0x53ab4e,_0x186875))[_0x4393('0x3f')](handleError(_0x53ab4e,null));};exports[_0x4393('0x40')]=function(_0x49a330,_0x502222){var _0x55dab1={'raw':![],'where':{'id':_0x49a330[_0x4393('0x41')]['id']}},_0x123b3d={};_0x123b3d[_0x4393('0x2b')]=_[_0x4393('0x2e')](db[_0x4393('0x27')][_0x4393('0x28')]);_0x123b3d[_0x4393('0x2d')]=_[_0x4393('0x2e')](_0x49a330[_0x4393('0x2d')]);_0x123b3d[_0x4393('0x2f')]=_[_0x4393('0x30')](_0x123b3d['model'],_0x123b3d[_0x4393('0x2d')]);_0x55dab1[_0x4393('0x31')]=_['intersection'](_0x123b3d[_0x4393('0x2b')],qs[_0x4393('0x32')](_0x49a330[_0x4393('0x2d')][_0x4393('0x32')]));_0x55dab1[_0x4393('0x31')]=_0x55dab1[_0x4393('0x31')]['length']?_0x55dab1['attributes']:_0x123b3d['model'];if(_0x49a330[_0x4393('0x2d')][_0x4393('0x3b')]){_0x55dab1[_0x4393('0x3c')]=[{'all':!![]}];}_0x55dab1=_[_0x4393('0x39')]({},_0x55dab1,_0x49a330[_0x4393('0x3a')]);return db['Trigger'][_0x4393('0x42')](_0x55dab1)[_0x4393('0x1e')](handleEntityNotFound(_0x502222,null))[_0x4393('0x1e')](respondWithResult(_0x502222,null))['catch'](handleError(_0x502222,null));};exports[_0x4393('0x43')]=function(_0x1a3be9,_0xa2eb06){return db['Trigger'][_0x4393('0x43')](_0x1a3be9['body'],{})[_0x4393('0x1e')](function(_0x5b7dda){var _0x12f6da=_0x1a3be9['user']['get']({'plain':!![]});if(!_0x12f6da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12f6da[_0x4393('0x44')]==='user'){var _0x5afff3=_0x5b7dda['get']({'plain':!![]});var _0x4a2757='Triggers';return db[_0x4393('0x45')]['find']({'where':{'name':_0x4a2757,'userProfileId':_0x12f6da[_0x4393('0x46')]},'raw':!![]})[_0x4393('0x1e')](function(_0x322c7d){if(_0x322c7d&&_0x322c7d[_0x4393('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x5afff3[_0x4393('0x24')],'resourceId':_0x5afff3['id'],'type':_0x322c7d[_0x4393('0x24')],'sectionId':_0x322c7d['id']},{})[_0x4393('0x1e')](function(){return _0x5b7dda;});}else{return _0x5b7dda;}})[_0x4393('0x3f')](function(_0x496c5f){logger[_0x4393('0x23')](_0x4393('0x48'),_0x496c5f);throw _0x496c5f;});}return _0x5b7dda;})[_0x4393('0x1e')](respondWithResult(_0xa2eb06,0xc9))[_0x4393('0x3f')](handleError(_0xa2eb06,null));};exports[_0x4393('0x1d')]=function(_0x29be41,_0xa769da){if(_0x29be41[_0x4393('0x49')]['id']){delete _0x29be41[_0x4393('0x49')]['id'];}return db[_0x4393('0x27')][_0x4393('0x42')]({'where':{'id':_0x29be41[_0x4393('0x41')]['id']}})[_0x4393('0x1e')](handleEntityNotFound(_0xa769da,null))[_0x4393('0x1e')](saveUpdates(_0x29be41[_0x4393('0x49')],null))[_0x4393('0x1e')](respondWithResult(_0xa769da,null))['catch'](handleError(_0xa769da,null));};exports[_0x4393('0x1f')]=function(_0x4f80fd,_0x10da2b){return db[_0x4393('0x27')][_0x4393('0x42')]({'where':{'id':_0x4f80fd['params']['id']}})[_0x4393('0x1e')](handleEntityNotFound(_0x10da2b,null))[_0x4393('0x1e')](removeEntity(_0x10da2b,null))[_0x4393('0x3f')](handleError(_0x10da2b,null));};exports['addAllCondition']=function(_0x3d77af,_0x27a045,_0x55bc36){if(_0x3d77af['body']['id']){delete _0x3d77af['body']['id'];}return db[_0x4393('0x27')]['find']({'where':{'id':_0x3d77af[_0x4393('0x41')]['id']}})['then'](handleEntityNotFound(_0x27a045,null))[_0x4393('0x1e')](function(_0xd08e77){if(_0xd08e77){_0x3d77af[_0x4393('0x49')][_0x4393('0x4a')]=_0xd08e77['id'];return db[_0x4393('0x4b')][_0x4393('0x43')](_0x3d77af[_0x4393('0x49')]);}})['then'](respondWithResult(_0x27a045,null))['catch'](handleError(_0x27a045,null));};exports['addAnyCondition']=function(_0x1435a9,_0x4c8802,_0x3c778e){if(_0x1435a9['body']['id']){delete _0x1435a9['body']['id'];}return db[_0x4393('0x27')][_0x4393('0x42')]({'where':{'id':_0x1435a9[_0x4393('0x41')]['id']}})[_0x4393('0x1e')](handleEntityNotFound(_0x4c8802,null))[_0x4393('0x1e')](function(_0x4a51c3){if(_0x4a51c3){_0x1435a9['body'][_0x4393('0x4c')]=_0x4a51c3['id'];return db[_0x4393('0x4b')][_0x4393('0x43')](_0x1435a9[_0x4393('0x49')]);}})[_0x4393('0x1e')](respondWithResult(_0x4c8802,null))[_0x4393('0x3f')](handleError(_0x4c8802,null));};exports['getAllConditions']=function(_0x549605,_0x5cb0f9,_0x1af71f){var _0x60643={};var _0xd88b27={};var _0x59a3fe;var _0x407b41;return db[_0x4393('0x27')][_0x4393('0x4d')]({'where':{'id':_0x549605[_0x4393('0x41')]['id']}})[_0x4393('0x1e')](handleEntityNotFound(_0x5cb0f9,null))[_0x4393('0x1e')](function(_0x3527fb){if(_0x3527fb){_0x59a3fe=_0x3527fb;_0xd88b27[_0x4393('0x2b')]=_[_0x4393('0x2e')](db[_0x4393('0x4b')]['rawAttributes']);_0xd88b27[_0x4393('0x2d')]=_[_0x4393('0x2e')](_0x549605[_0x4393('0x2d')]);_0xd88b27[_0x4393('0x2f')]=_[_0x4393('0x30')](_0xd88b27['model'],_0xd88b27[_0x4393('0x2d')]);_0x60643['attributes']=_['intersection'](_0xd88b27[_0x4393('0x2b')],qs[_0x4393('0x32')](_0x549605[_0x4393('0x2d')][_0x4393('0x32')]));_0x60643[_0x4393('0x31')]=_0x60643[_0x4393('0x31')][_0x4393('0x33')]?_0x60643[_0x4393('0x31')]:_0xd88b27['model'];_0x60643['order']=qs[_0x4393('0x35')](_0x549605[_0x4393('0x2d')][_0x4393('0x35')]);_0x60643[_0x4393('0x36')]=qs[_0x4393('0x2f')](_['pick'](_0x549605[_0x4393('0x2d')],_0xd88b27[_0x4393('0x2f')]));if(_0x549605[_0x4393('0x2d')][_0x4393('0x38')]){_0x60643['where']=_[_0x4393('0x39')](_0x60643[_0x4393('0x36')],{'$or':_[_0x4393('0x2c')](_0x60643[_0x4393('0x31')],function(_0x2e4f1a){var _0x1ee8d2={};_0x1ee8d2[_0x2e4f1a]={'$like':'%'+_0x549605['query'][_0x4393('0x38')]+'%'};return _0x1ee8d2;})});}_0x60643=_[_0x4393('0x39')]({},_0x60643,_0x549605['options']);return _0x59a3fe[_0x4393('0x4e')](_0x60643);}})['then'](function(_0x3ef8ba){if(_0x3ef8ba){_0x407b41=_0x3ef8ba[_0x4393('0x33')];if(!_0x549605[_0x4393('0x2d')][_0x4393('0x4f')]('nolimit')){_0x60643['limit']=qs[_0x4393('0x17')](_0x549605[_0x4393('0x2d')]['limit']);_0x60643['offset']=qs[_0x4393('0x15')](_0x549605[_0x4393('0x2d')][_0x4393('0x15')]);}return _0x59a3fe['getAllConditions'](_0x60643);}})[_0x4393('0x1e')](function(_0x2044d4){if(_0x2044d4){return _0x2044d4?{'count':_0x407b41,'rows':_0x2044d4}:null;}})['then'](respondWithResult(_0x5cb0f9,null))['catch'](handleError(_0x5cb0f9,null));};exports[_0x4393('0x50')]=function(_0x21de42,_0x425fde,_0x4ca175){var _0x127121={};var _0x59210b={};var _0x615ff9;var _0x41a3e7;return db[_0x4393('0x27')][_0x4393('0x4d')]({'where':{'id':_0x21de42[_0x4393('0x41')]['id']}})[_0x4393('0x1e')](handleEntityNotFound(_0x425fde,null))['then'](function(_0xc87aa1){if(_0xc87aa1){_0x615ff9=_0xc87aa1;_0x59210b[_0x4393('0x2b')]=_[_0x4393('0x2e')](db['Condition']['rawAttributes']);_0x59210b[_0x4393('0x2d')]=_[_0x4393('0x2e')](_0x21de42[_0x4393('0x2d')]);_0x59210b[_0x4393('0x2f')]=_[_0x4393('0x30')](_0x59210b[_0x4393('0x2b')],_0x59210b[_0x4393('0x2d')]);_0x127121[_0x4393('0x31')]=_[_0x4393('0x30')](_0x59210b[_0x4393('0x2b')],qs[_0x4393('0x32')](_0x21de42[_0x4393('0x2d')][_0x4393('0x32')]));_0x127121[_0x4393('0x31')]=_0x127121[_0x4393('0x31')][_0x4393('0x33')]?_0x127121[_0x4393('0x31')]:_0x59210b[_0x4393('0x2b')];_0x127121[_0x4393('0x34')]=qs[_0x4393('0x35')](_0x21de42[_0x4393('0x2d')][_0x4393('0x35')]);_0x127121['where']=qs[_0x4393('0x2f')](_['pick'](_0x21de42['query'],_0x59210b[_0x4393('0x2f')]));if(_0x21de42['query'][_0x4393('0x38')]){_0x127121[_0x4393('0x36')]=_[_0x4393('0x39')](_0x127121[_0x4393('0x36')],{'$or':_[_0x4393('0x2c')](_0x127121[_0x4393('0x31')],function(_0x93644c){var _0x1360e0={};_0x1360e0[_0x93644c]={'$like':'%'+_0x21de42[_0x4393('0x2d')][_0x4393('0x38')]+'%'};return _0x1360e0;})});}_0x127121=_[_0x4393('0x39')]({},_0x127121,_0x21de42['options']);return _0x615ff9[_0x4393('0x50')](_0x127121);}})[_0x4393('0x1e')](function(_0x543d80){if(_0x543d80){_0x41a3e7=_0x543d80[_0x4393('0x33')];if(!_0x21de42[_0x4393('0x2d')]['hasOwnProperty'](_0x4393('0x51'))){_0x127121[_0x4393('0x17')]=qs['limit'](_0x21de42[_0x4393('0x2d')][_0x4393('0x17')]);_0x127121[_0x4393('0x15')]=qs[_0x4393('0x15')](_0x21de42[_0x4393('0x2d')][_0x4393('0x15')]);}return _0x615ff9[_0x4393('0x50')](_0x127121);}})[_0x4393('0x1e')](function(_0x27dd9b){if(_0x27dd9b){return _0x27dd9b?{'count':_0x41a3e7,'rows':_0x27dd9b}:null;}})[_0x4393('0x1e')](respondWithResult(_0x425fde,null))[_0x4393('0x3f')](handleError(_0x425fde,null));};exports['addAction']=function(_0x5dea27,_0x1b575f,_0x48c392){if(_0x5dea27[_0x4393('0x49')]['id']){delete _0x5dea27[_0x4393('0x49')]['id'];}return db['Trigger'][_0x4393('0x42')]({'where':{'id':_0x5dea27[_0x4393('0x41')]['id']}})[_0x4393('0x1e')](handleEntityNotFound(_0x1b575f,null))[_0x4393('0x1e')](function(_0x2abeb3){if(_0x2abeb3){_0x5dea27[_0x4393('0x49')][_0x4393('0x52')]=_0x2abeb3['id'];return db[_0x4393('0x53')]['create'](_0x5dea27[_0x4393('0x49')]);}})[_0x4393('0x1e')](respondWithResult(_0x1b575f,null))['catch'](handleError(_0x1b575f,null));};exports[_0x4393('0x54')]=function(_0x211056,_0x438fc1,_0x2c0bd8){var _0x4ffbac={};var _0xbb79bb={};var _0x42c577;var _0x2bd2f4;return db[_0x4393('0x27')]['findOne']({'where':{'id':_0x211056[_0x4393('0x41')]['id']}})[_0x4393('0x1e')](handleEntityNotFound(_0x438fc1,null))['then'](function(_0x5d9b5d){if(_0x5d9b5d){_0x42c577=_0x5d9b5d;_0xbb79bb['model']=_[_0x4393('0x2e')](db[_0x4393('0x53')][_0x4393('0x28')]);_0xbb79bb[_0x4393('0x2d')]=_[_0x4393('0x2e')](_0x211056[_0x4393('0x2d')]);_0xbb79bb[_0x4393('0x2f')]=_['intersection'](_0xbb79bb[_0x4393('0x2b')],_0xbb79bb[_0x4393('0x2d')]);_0x4ffbac[_0x4393('0x31')]=_[_0x4393('0x30')](_0xbb79bb[_0x4393('0x2b')],qs[_0x4393('0x32')](_0x211056['query']['fields']));_0x4ffbac[_0x4393('0x31')]=_0x4ffbac[_0x4393('0x31')][_0x4393('0x33')]?_0x4ffbac[_0x4393('0x31')]:_0xbb79bb[_0x4393('0x2b')];_0x4ffbac[_0x4393('0x34')]=qs['sort'](_0x211056[_0x4393('0x2d')][_0x4393('0x35')]);_0x4ffbac[_0x4393('0x36')]=qs['filters'](_['pick'](_0x211056[_0x4393('0x2d')],_0xbb79bb[_0x4393('0x2f')]));if(_0x211056[_0x4393('0x2d')][_0x4393('0x38')]){_0x4ffbac[_0x4393('0x36')]=_[_0x4393('0x39')](_0x4ffbac[_0x4393('0x36')],{'$or':_[_0x4393('0x2c')](_0x4ffbac[_0x4393('0x31')],function(_0x3cf7d8){var _0x358660={};_0x358660[_0x3cf7d8]={'$like':'%'+_0x211056['query']['filter']+'%'};return _0x358660;})});}_0x4ffbac=_[_0x4393('0x39')]({},_0x4ffbac,_0x211056[_0x4393('0x3a')]);return _0x42c577[_0x4393('0x54')](_0x4ffbac);}})[_0x4393('0x1e')](function(_0x56a357){if(_0x56a357){_0x2bd2f4=_0x56a357[_0x4393('0x33')];if(!_0x211056['query'][_0x4393('0x4f')](_0x4393('0x51'))){_0x4ffbac[_0x4393('0x17')]=qs[_0x4393('0x17')](_0x211056['query'][_0x4393('0x17')]);_0x4ffbac['offset']=qs[_0x4393('0x15')](_0x211056[_0x4393('0x2d')][_0x4393('0x15')]);}return _0x42c577[_0x4393('0x54')](_0x4ffbac);}})['then'](function(_0x2829e1){if(_0x2829e1){return _0x2829e1?{'count':_0x2bd2f4,'rows':_0x2829e1}:null;}})[_0x4393('0x1e')](respondWithResult(_0x438fc1,null))[_0x4393('0x3f')](handleError(_0x438fc1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d796384..7447691 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 _0xc474=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x5de8f1,_0x1b32f2){var _0x2fb8e6=function(_0x488e06){while(--_0x488e06){_0x5de8f1['push'](_0x5de8f1['shift']());}};_0x2fb8e6(++_0x1b32f2);}(_0xc474,0xfc));var _0x4c47=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xc474[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x4c47('0x0'));var util=require(_0x4c47('0x1'));var logger=require(_0x4c47('0x2'))('api');var moment=require(_0x4c47('0x3'));var BPromise=require(_0x4c47('0x4'));var rp=require(_0x4c47('0x5'));var fs=require('fs');var path=require(_0x4c47('0x6'));var rimraf=require(_0x4c47('0x7'));var config=require(_0x4c47('0x8'));var attributes=require(_0x4c47('0x9'));module[_0x4c47('0xa')]=function(_0x58db78,_0x5aaf0e){return _0x58db78[_0x4c47('0xb')](_0x4c47('0xc'),attributes,{'tableName':_0x4c47('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3663=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3c44c8,_0xe07118){var _0x51fa81=function(_0x3b70bf){while(--_0x3b70bf){_0x3c44c8['push'](_0x3c44c8['shift']());}};_0x51fa81(++_0xe07118);}(_0x3663,0x1cf));var _0x3366=function(_0x1de7e8,_0x355ee5){_0x1de7e8=_0x1de7e8-0x0;var _0x41b9ea=_0x3663[_0x1de7e8];return _0x41b9ea;};'use strict';var _=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var logger=require(_0x3366('0x2'))('api');var moment=require(_0x3366('0x3'));var BPromise=require(_0x3366('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3366('0x5'));var rimraf=require(_0x3366('0x6'));var config=require(_0x3366('0x7'));var attributes=require(_0x3366('0x8'));module[_0x3366('0x9')]=function(_0x5284c0,_0x293cdb){return _0x5284c0[_0x3366('0xa')]('Trigger',attributes,{'tableName':_0x3366('0xb'),'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 8fe5d3d..01917a6 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 _0x9d41=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trigger','findAll','options','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','raw','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d41,0x1e8));var _0x19d4=function(_0x15fdd6,_0x1d6cad){_0x15fdd6=_0x15fdd6-0x0;var _0xd8453=_0x9d41[_0x15fdd6];return _0xd8453;};'use strict';var _=require('lodash');var util=require(_0x19d4('0x0'));var moment=require(_0x19d4('0x1'));var BPromise=require(_0x19d4('0x2'));var rs=require(_0x19d4('0x3'));var fs=require('fs');var Redis=require(_0x19d4('0x4'));var db=require(_0x19d4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x19d4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x19d4('0x7'));var client=jayson[_0x19d4('0x8')][_0x19d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4db751,_0x57f35b,_0x5e1988){return new BPromise(function(_0x13e74d,_0x37c942){return client[_0x19d4('0xa')](_0x4db751,_0x5e1988)[_0x19d4('0xb')](function(_0x2540cf){logger[_0x19d4('0xc')](_0x19d4('0xd'),_0x57f35b,_0x19d4('0xe'));logger[_0x19d4('0xf')](_0x19d4('0x10'),_0x57f35b,_0x19d4('0xe'),JSON[_0x19d4('0x11')](_0x2540cf));if(_0x2540cf[_0x19d4('0x12')]){if(_0x2540cf['error'][_0x19d4('0x13')]===0x1f4){logger[_0x19d4('0x12')](_0x19d4('0xd'),_0x57f35b,_0x2540cf[_0x19d4('0x12')][_0x19d4('0x14')]);return _0x37c942(_0x2540cf[_0x19d4('0x12')][_0x19d4('0x14')]);}logger[_0x19d4('0x12')](_0x19d4('0xd'),_0x57f35b,_0x2540cf[_0x19d4('0x12')][_0x19d4('0x14')]);return _0x13e74d(_0x2540cf[_0x19d4('0x12')][_0x19d4('0x14')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x57f35b,_0x19d4('0xe'));_0x13e74d(_0x2540cf[_0x19d4('0x15')][_0x19d4('0x14')]);}})[_0x19d4('0x16')](function(_0x410a1a){logger[_0x19d4('0x12')](_0x19d4('0xd'),_0x57f35b,_0x410a1a);_0x37c942(_0x410a1a);});});}exports['GetTrigger']=function(_0x1865d7){var _0x40c404=this;return new Promise(function(_0x560b6d,_0x2ccf05){return db[_0x19d4('0x17')][_0x19d4('0x18')]({'raw':_0x1865d7[_0x19d4('0x19')]?_0x1865d7[_0x19d4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1865d7['options']?_0x1865d7[_0x19d4('0x19')][_0x19d4('0x1a')]||null:null,'attributes':_0x1865d7[_0x19d4('0x19')]?_0x1865d7[_0x19d4('0x19')][_0x19d4('0x1b')]||null:null,'limit':_0x1865d7[_0x19d4('0x19')]?_0x1865d7[_0x19d4('0x19')][_0x19d4('0x1c')]||null:null,'include':_0x1865d7[_0x19d4('0x19')]?_0x1865d7[_0x19d4('0x19')][_0x19d4('0x1d')]?_[_0x19d4('0x1e')](_0x1865d7[_0x19d4('0x19')]['include'],function(_0x4e2f88){return{'model':db[_0x4e2f88[_0x19d4('0x1f')]],'as':_0x4e2f88['as'],'attributes':_0x4e2f88[_0x19d4('0x1b')],'include':_0x4e2f88[_0x19d4('0x1d')]?_[_0x19d4('0x1e')](_0x4e2f88[_0x19d4('0x1d')],function(_0x56a460){return{'model':db[_0x56a460[_0x19d4('0x1f')]],'as':_0x56a460['as'],'attributes':_0x56a460[_0x19d4('0x1b')],'include':_0x56a460[_0x19d4('0x1d')]?_['map'](_0x56a460[_0x19d4('0x1d')],function(_0x549e76){return{'model':db[_0x549e76['model']],'as':_0x549e76['as'],'attributes':_0x549e76[_0x19d4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x19d4('0xb')](function(_0x356062){logger[_0x19d4('0xc')](_0x19d4('0x20'),_0x1865d7);logger[_0x19d4('0xf')]('GetTrigger',_0x1865d7,JSON[_0x19d4('0x11')](_0x356062));_0x560b6d(_0x356062);})[_0x19d4('0x16')](function(_0x203c09){logger[_0x19d4('0x12')](_0x19d4('0x20'),_0x203c09[_0x19d4('0x14')],_0x1865d7);_0x2ccf05(_0x40c404[_0x19d4('0x12')](0x1f4,_0x203c09[_0x19d4('0x14')]));});});};exports[_0x19d4('0x21')]=function(_0x52f413){var _0x10400e=this;return new Promise(function(_0x3270cf,_0x42788b){return db[_0x19d4('0x17')]['find']({'raw':_0x52f413[_0x19d4('0x19')]?_0x52f413[_0x19d4('0x19')][_0x19d4('0x22')]===undefined?!![]:![]:!![],'where':_0x52f413[_0x19d4('0x19')]?_0x52f413[_0x19d4('0x19')][_0x19d4('0x1a')]||null:null,'attributes':_0x52f413[_0x19d4('0x19')]?_0x52f413[_0x19d4('0x19')]['attributes']||null:null,'include':_0x52f413['options']?_0x52f413[_0x19d4('0x19')]['include']?_[_0x19d4('0x1e')](_0x52f413['options'][_0x19d4('0x1d')],function(_0x4feea9){return{'model':db[_0x4feea9[_0x19d4('0x1f')]],'as':_0x4feea9['as'],'attributes':_0x4feea9[_0x19d4('0x1b')],'include':_0x4feea9[_0x19d4('0x1d')]?_[_0x19d4('0x1e')](_0x4feea9[_0x19d4('0x1d')],function(_0x16ab98){return{'model':db[_0x16ab98[_0x19d4('0x1f')]],'as':_0x16ab98['as'],'attributes':_0x16ab98[_0x19d4('0x1b')],'include':_0x16ab98[_0x19d4('0x1d')]?_[_0x19d4('0x1e')](_0x16ab98[_0x19d4('0x1d')],function(_0x3e772f){return{'model':db[_0x3e772f['model']],'as':_0x3e772f['as'],'attributes':_0x3e772f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4adca1){logger[_0x19d4('0xc')](_0x19d4('0x21'),_0x52f413);logger[_0x19d4('0xf')](_0x19d4('0x21'),_0x52f413,JSON[_0x19d4('0x11')](_0x4adca1));_0x3270cf(_0x4adca1);})['catch'](function(_0x29d7dc){logger['error'](_0x19d4('0x21'),_0x29d7dc['message'],_0x52f413);_0x42788b(_0x10400e[_0x19d4('0x12')](0x1f4,_0x29d7dc[_0x19d4('0x14')]));});});}; \ No newline at end of file +var _0xe7d3=['code','message','catch','GetTrigger','Trigger','options','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','bluebird','ioredis','../../config/utils','rpc','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0xe7d3,0xfe));var _0x3e7d=function(_0x1104b7,_0x5221b6){_0x1104b7=_0x1104b7-0x0;var _0x2691ca=_0xe7d3[_0x1104b7];return _0x2691ca;};'use strict';var _=require(_0x3e7d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e7d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e7d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e7d('0x3'));var logger=require('../../config/logger')(_0x3e7d('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3e7d('0x5')][_0x3e7d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x269553,_0x34d0bc,_0x45101d){return new BPromise(function(_0x4b39d1,_0x23af22){return client[_0x3e7d('0x7')](_0x269553,_0x45101d)[_0x3e7d('0x8')](function(_0x43cb95){logger[_0x3e7d('0x9')](_0x3e7d('0xa'),_0x34d0bc,_0x3e7d('0xb'));logger[_0x3e7d('0xc')](_0x3e7d('0xd'),_0x34d0bc,_0x3e7d('0xb'),JSON[_0x3e7d('0xe')](_0x43cb95));if(_0x43cb95[_0x3e7d('0xf')]){if(_0x43cb95[_0x3e7d('0xf')][_0x3e7d('0x10')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x34d0bc,_0x43cb95[_0x3e7d('0xf')][_0x3e7d('0x11')]);return _0x23af22(_0x43cb95[_0x3e7d('0xf')]['message']);}logger[_0x3e7d('0xf')]('Trigger,\x20%s,\x20%s',_0x34d0bc,_0x43cb95[_0x3e7d('0xf')][_0x3e7d('0x11')]);return _0x4b39d1(_0x43cb95[_0x3e7d('0xf')][_0x3e7d('0x11')]);}else{logger['info'](_0x3e7d('0xa'),_0x34d0bc,_0x3e7d('0xb'));_0x4b39d1(_0x43cb95['result'][_0x3e7d('0x11')]);}})[_0x3e7d('0x12')](function(_0x4a8312){logger[_0x3e7d('0xf')](_0x3e7d('0xa'),_0x34d0bc,_0x4a8312);_0x23af22(_0x4a8312);});});}exports[_0x3e7d('0x13')]=function(_0x393b6d){var _0x35c332=this;return new Promise(function(_0x3c5a50,_0x1334d2){return db[_0x3e7d('0x14')]['findAll']({'raw':_0x393b6d[_0x3e7d('0x15')]?_0x393b6d[_0x3e7d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x393b6d[_0x3e7d('0x15')]?_0x393b6d[_0x3e7d('0x15')][_0x3e7d('0x16')]||null:null,'attributes':_0x393b6d[_0x3e7d('0x15')]?_0x393b6d[_0x3e7d('0x15')][_0x3e7d('0x17')]||null:null,'limit':_0x393b6d['options']?_0x393b6d[_0x3e7d('0x15')][_0x3e7d('0x18')]||null:null,'include':_0x393b6d[_0x3e7d('0x15')]?_0x393b6d[_0x3e7d('0x15')][_0x3e7d('0x19')]?_[_0x3e7d('0x1a')](_0x393b6d['options'][_0x3e7d('0x19')],function(_0xff6263){return{'model':db[_0xff6263[_0x3e7d('0x1b')]],'as':_0xff6263['as'],'attributes':_0xff6263[_0x3e7d('0x17')],'include':_0xff6263['include']?_[_0x3e7d('0x1a')](_0xff6263[_0x3e7d('0x19')],function(_0x3cf30a){return{'model':db[_0x3cf30a[_0x3e7d('0x1b')]],'as':_0x3cf30a['as'],'attributes':_0x3cf30a[_0x3e7d('0x17')],'include':_0x3cf30a[_0x3e7d('0x19')]?_[_0x3e7d('0x1a')](_0x3cf30a[_0x3e7d('0x19')],function(_0x30ad35){return{'model':db[_0x30ad35[_0x3e7d('0x1b')]],'as':_0x30ad35['as'],'attributes':_0x30ad35[_0x3e7d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3e7d('0x8')](function(_0x30e99c){logger[_0x3e7d('0x9')]('GetTrigger',_0x393b6d);logger['debug'](_0x3e7d('0x13'),_0x393b6d,JSON[_0x3e7d('0xe')](_0x30e99c));_0x3c5a50(_0x30e99c);})['catch'](function(_0x3aaf53){logger[_0x3e7d('0xf')](_0x3e7d('0x13'),_0x3aaf53[_0x3e7d('0x11')],_0x393b6d);_0x1334d2(_0x35c332['error'](0x1f4,_0x3aaf53[_0x3e7d('0x11')]));});});};exports[_0x3e7d('0x1c')]=function(_0x221a7a){var _0x4d9ca4=this;return new Promise(function(_0x2941ea,_0x472c31){return db[_0x3e7d('0x14')][_0x3e7d('0x1d')]({'raw':_0x221a7a['options']?_0x221a7a[_0x3e7d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x221a7a[_0x3e7d('0x15')]?_0x221a7a[_0x3e7d('0x15')][_0x3e7d('0x16')]||null:null,'attributes':_0x221a7a[_0x3e7d('0x15')]?_0x221a7a['options'][_0x3e7d('0x17')]||null:null,'include':_0x221a7a[_0x3e7d('0x15')]?_0x221a7a[_0x3e7d('0x15')][_0x3e7d('0x19')]?_[_0x3e7d('0x1a')](_0x221a7a[_0x3e7d('0x15')]['include'],function(_0x161541){return{'model':db[_0x161541['model']],'as':_0x161541['as'],'attributes':_0x161541[_0x3e7d('0x17')],'include':_0x161541[_0x3e7d('0x19')]?_[_0x3e7d('0x1a')](_0x161541[_0x3e7d('0x19')],function(_0x6f5fd6){return{'model':db[_0x6f5fd6['model']],'as':_0x6f5fd6['as'],'attributes':_0x6f5fd6[_0x3e7d('0x17')],'include':_0x6f5fd6[_0x3e7d('0x19')]?_['map'](_0x6f5fd6[_0x3e7d('0x19')],function(_0x23803f){return{'model':db[_0x23803f[_0x3e7d('0x1b')]],'as':_0x23803f['as'],'attributes':_0x23803f[_0x3e7d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3e7d('0x8')](function(_0x34d14c){logger[_0x3e7d('0x9')](_0x3e7d('0x1c'),_0x221a7a);logger[_0x3e7d('0xc')](_0x3e7d('0x1c'),_0x221a7a,JSON[_0x3e7d('0xe')](_0x34d14c));_0x2941ea(_0x34d14c);})[_0x3e7d('0x12')](function(_0x1afc55){logger['error'](_0x3e7d('0x1c'),_0x1afc55[_0x3e7d('0x11')],_0x221a7a);_0x472c31(_0x4d9ca4[_0x3e7d('0xf')](0x1f4,_0x1afc55[_0x3e7d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3fd7fa5..84d460a 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 _0x0547=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','create','put','update','delete','destroy','exports','util'];(function(_0x165a83,_0x4825ae){var _0x3da6a1=function(_0x13407a){while(--_0x13407a){_0x165a83['push'](_0x165a83['shift']());}};_0x3da6a1(++_0x4825ae);}(_0x0547,0x1a3));var _0x7054=function(_0x21de55,_0x1f77f9){_0x21de55=_0x21de55-0x0;var _0x21d8fb=_0x0547[_0x21de55];return _0x21d8fb;};'use strict';var multer=require('multer');var util=require(_0x7054('0x0'));var path=require(_0x7054('0x1'));var timeout=require('connect-timeout');var express=require(_0x7054('0x2'));var router=express[_0x7054('0x3')]();var fs_extra=require(_0x7054('0x4'));var auth=require(_0x7054('0x5'));var interaction=require(_0x7054('0x6'));var config=require('../../config/environment');var controller=require(_0x7054('0x7'));router[_0x7054('0x8')]('/',auth[_0x7054('0x9')](),controller[_0x7054('0xa')]);router[_0x7054('0x8')](_0x7054('0xb'),auth[_0x7054('0x9')](),controller['show']);router[_0x7054('0xc')](_0x7054('0xd'),auth[_0x7054('0x9')](),controller['clone']);router[_0x7054('0xc')]('/',auth[_0x7054('0x9')](),controller[_0x7054('0xe')]);router[_0x7054('0xf')](_0x7054('0xb'),auth[_0x7054('0x9')](),controller[_0x7054('0x10')]);router[_0x7054('0x11')](_0x7054('0xb'),auth[_0x7054('0x9')](),controller[_0x7054('0x12')]);module[_0x7054('0x13')]=router; \ No newline at end of file +var _0x952f=['get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','update','delete','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0x47719c,_0x50518e){var _0x51a5ae=function(_0x23be69){while(--_0x23be69){_0x47719c['push'](_0x47719c['shift']());}};_0x51a5ae(++_0x50518e);}(_0x952f,0x1d8));var _0xf952=function(_0x4ca536,_0x57c8de){_0x4ca536=_0x4ca536-0x0;var _0x3bd35f=_0x952f[_0x4ca536];return _0x3bd35f;};'use strict';var multer=require('multer');var util=require(_0xf952('0x0'));var path=require(_0xf952('0x1'));var timeout=require(_0xf952('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf952('0x3'));var auth=require(_0xf952('0x4'));var interaction=require(_0xf952('0x5'));var config=require(_0xf952('0x6'));var controller=require(_0xf952('0x7'));router[_0xf952('0x8')]('/',auth[_0xf952('0x9')](),controller[_0xf952('0xa')]);router['get'](_0xf952('0xb'),auth[_0xf952('0x9')](),controller['show']);router[_0xf952('0xc')](_0xf952('0xd'),auth[_0xf952('0x9')](),controller[_0xf952('0xe')]);router[_0xf952('0xc')]('/',auth[_0xf952('0x9')](),controller[_0xf952('0xf')]);router[_0xf952('0x10')]('/:id',auth[_0xf952('0x9')](),controller[_0xf952('0x11')]);router[_0xf952('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf952('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 3111143..3193dfb 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 _0xdc25=['ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uas','pai','certificate','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','ENUM','friend','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','force_rport,comedia','nat','join','split','all'];(function(_0x29d820,_0x454b78){var _0x53f9d9=function(_0x1527f2){while(--_0x1527f2){_0x29d820['push'](_0x29d820['shift']());}};_0x53f9d9(++_0x454b78);}(_0xdc25,0x77));var _0x5dc2=function(_0x5e9f37,_0x5aae2b){_0x5e9f37=_0x5e9f37-0x0;var _0x7b2d4e=_0xdc25[_0x5e9f37];return _0x7b2d4e;};'use strict';var Sequelize=require(_0x5dc2('0x0'));module[_0x5dc2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x3'),'user','peer'),'allowNull':![],'defaultValue':_0x5dc2('0x3')},'context':{'type':Sequelize[_0x5dc2('0x4')],'allowNull':![],'defaultValue':_0x5dc2('0x5')},'callingpres':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x6'),_0x5dc2('0x7'),'ALLOWED_FAILED_SCREEN',_0x5dc2('0x8'),_0x5dc2('0x9'),'PROHIB_PASSED_SCREEN',_0x5dc2('0xa'),_0x5dc2('0xb'))},'deny':{'type':Sequelize[_0x5dc2('0x4')]},'permit':{'type':Sequelize[_0x5dc2('0x4')]},'secret':{'type':Sequelize[_0x5dc2('0x4')]},'md5secret':{'type':Sequelize[_0x5dc2('0x4')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x5dc2('0x4')],'defaultValue':_0x5dc2('0xc'),'set':function(_0xc03470){this[_0x5dc2('0xd')](_0x5dc2('0xe'),_0xc03470?_0xc03470['join'](','):null);},'get':function(){return this[_0x5dc2('0xf')]('transport')?this[_0x5dc2('0xf')]('transport')['split'](','):null;},'comment':_0x5dc2('0x10')},'dtmfmode':{'type':Sequelize['ENUM'](_0x5dc2('0x11'),_0x5dc2('0x12'),'shortinfo',_0x5dc2('0x13'),_0x5dc2('0x14')),'defaultValue':_0x5dc2('0x11')},'directmedia':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no','nonat',_0x5dc2('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5dc2('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x5dc2('0x4')]},'nat':{'type':Sequelize[_0x5dc2('0x4')],'defaultValue':_0x5dc2('0x17'),'set':function(_0x4602b7){this['setDataValue'](_0x5dc2('0x18'),_0x4602b7?_0x4602b7[_0x5dc2('0x19')](','):null);},'get':function(){return this[_0x5dc2('0xf')](_0x5dc2('0x18'))?this[_0x5dc2('0xf')]('nat')[_0x5dc2('0x1a')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x5dc2('0x4')]},'pickupgroup':{'type':Sequelize[_0x5dc2('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x5dc2('0x4')]},'language':{'type':Sequelize[_0x5dc2('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5dc2('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x5dc2('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dc2('0x1c'),'set':function(_0x343ba8){this[_0x5dc2('0xd')](_0x5dc2('0x1d'),_0x343ba8?_0x343ba8[_0x5dc2('0x19')](';'):_0x5dc2('0x1c'));},'get':function(){return this[_0x5dc2('0xf')]('allow')?this[_0x5dc2('0xf')](_0x5dc2('0x1d'))[_0x5dc2('0x1a')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x5dc2('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0x5dc2('0x4')],'defaultValue':_0x5dc2('0x1e'),'set':function(_0x16bc1a){this[_0x5dc2('0xd')]('insecure',_0x16bc1a?_0x16bc1a[_0x5dc2('0x19')](','):null);},'get':function(){return this[_0x5dc2('0xf')]('insecure')?this['getDataValue'](_0x5dc2('0x1f'))[_0x5dc2('0x1a')](','):null;},'comment':_0x5dc2('0x20')},'trustrpid':{'type':Sequelize[_0x5dc2('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x5dc2('0x15'),'no','never')},'promiscredir':{'type':Sequelize[_0x5dc2('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x5dc2('0x21')},'amaflags':{'type':Sequelize[_0x5dc2('0x4')]},'callcounter':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no'),'defaultValue':_0x5dc2('0x15')},'busylevel':{'type':Sequelize[_0x5dc2('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x5dc2('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x5dc2('0x4')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x5dc2('0x15'),'no',_0x5dc2('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5dc2('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0x5dc2('0x4')]},'session_timers':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x24'),_0x5dc2('0x25'),_0x5dc2('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x5dc2('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x5dc2('0x2')]('uac',_0x5dc2('0x27')),'defaultValue':_0x5dc2('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x5dc2('0x4')]},'regexten':{'type':Sequelize[_0x5dc2('0x4')]},'fromdomain':{'type':Sequelize[_0x5dc2('0x4')]},'fromuser':{'type':Sequelize[_0x5dc2('0x4')]},'port':{'type':Sequelize[_0x5dc2('0x22')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x5dc2('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x5dc2('0x4')]},'defaultuser':{'type':Sequelize[_0x5dc2('0x4')]},'rtptimeout':{'type':Sequelize[_0x5dc2('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5dc2('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x5dc2('0x2')]('yes','no',_0x5dc2('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x5dc2('0x4')]},'timert1':{'type':Sequelize[_0x5dc2('0x22')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x5dc2('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x5dc2('0x4')]},'contactdeny':{'type':Sequelize[_0x5dc2('0x4')]},'contactacl':{'type':Sequelize[_0x5dc2('0x4')]},'unsolicited_mailbox':{'type':Sequelize[_0x5dc2('0x4')]},'use_q850_reason':{'type':Sequelize[_0x5dc2('0x4')]},'maxforwards':{'type':Sequelize[_0x5dc2('0x22')](0xb)},'encryption':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no')},'force_avp':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no')},'icesupport':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x5dc2('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no','fingerprint',_0x5dc2('0x29'))},'dtlsrekey':{'type':Sequelize[_0x5dc2('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x5dc2('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0x5dc2('0x4')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x5dc2('0x4')]},'dtlssetup':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x2a'),_0x5dc2('0x2b'),_0x5dc2('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5dc2('0x4')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5dc2('0x4')]},'recordofffeature':{'type':Sequelize[_0x5dc2('0x4')]},'call_limit':{'type':Sequelize[_0x5dc2('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5dc2('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no')},'vmexten':{'type':Sequelize[_0x5dc2('0x4')]},'mohinterpret':{'type':Sequelize[_0x5dc2('0x4')]},'mohsuggest':{'type':Sequelize[_0x5dc2('0x4')]},'parkinglot':{'type':Sequelize[_0x5dc2('0x4')]},'description':{'type':Sequelize[_0x5dc2('0x4')]},'host':{'type':Sequelize[_0x5dc2('0x4')],'defaultValue':_0x5dc2('0x2d')},'canreinvite':{'type':Sequelize[_0x5dc2('0x2')](_0x5dc2('0x15'),'no',_0x5dc2('0x2e'),'update',_0x5dc2('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5dc2('0x4')]},'otherFields':{'type':Sequelize[_0x5dc2('0x4')]},'active':{'type':Sequelize[_0x5dc2('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5dc2('0x4')],'defaultValue':'no'}}; \ No newline at end of file +var _0xd9fc=['active','actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate'];(function(_0x36b285,_0x146c16){var _0xa114cb=function(_0x3be4db){while(--_0x3be4db){_0x36b285['push'](_0x36b285['shift']());}};_0xa114cb(++_0x146c16);}(_0xd9fc,0x1a4));var _0xcd9f=function(_0x41aecc,_0x2196bb){_0x41aecc=_0x41aecc-0x0;var _0x555937=_0xd9fc[_0x41aecc];return _0x555937;};'use strict';var Sequelize=require(_0xcd9f('0x0'));module[_0xcd9f('0x1')]={'name':{'type':Sequelize[_0xcd9f('0x2')],'allowNull':![],'unique':_0xcd9f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x5'),_0xcd9f('0x6'),_0xcd9f('0x7')),'allowNull':![],'defaultValue':_0xcd9f('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcd9f('0x8')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xcd9f('0x9'),_0xcd9f('0xa'),'ALLOWED',_0xcd9f('0xb'),'PROHIB_PASSED_SCREEN',_0xcd9f('0xc'),_0xcd9f('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xcd9f('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xcd9f('0x2')]},'remotesecret':{'type':Sequelize[_0xcd9f('0x2')]},'transport':{'type':Sequelize[_0xcd9f('0x2')],'defaultValue':'udp','set':function(_0x4bbcae){this[_0xcd9f('0xe')]('transport',_0x4bbcae?_0x4bbcae[_0xcd9f('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xcd9f('0x10'))?this['getDataValue'](_0xcd9f('0x10'))[_0xcd9f('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x12'),_0xcd9f('0x13'),_0xcd9f('0x14'),_0xcd9f('0x15'),_0xcd9f('0x16')),'defaultValue':_0xcd9f('0x12')},'directmedia':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no',_0xcd9f('0x18'),_0xcd9f('0x19'),_0xcd9f('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcd9f('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcd9f('0x2')]},'directmediadeny':{'type':Sequelize[_0xcd9f('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xcd9f('0x1b'),'set':function(_0x95e369){this[_0xcd9f('0xe')](_0xcd9f('0x1c'),_0x95e369?_0x95e369['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xcd9f('0x1d')](_0xcd9f('0x1c'))[_0xcd9f('0x11')](','):null;},'comment':_0xcd9f('0x1e')},'callgroup':{'type':Sequelize[_0xcd9f('0x2')]},'namedcallgroup':{'type':Sequelize[_0xcd9f('0x2')]},'pickupgroup':{'type':Sequelize[_0xcd9f('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xcd9f('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcd9f('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xcd9f('0x1f')},'allow':{'type':Sequelize[_0xcd9f('0x2')],'allowNull':![],'defaultValue':_0xcd9f('0x20'),'set':function(_0x139059){this[_0xcd9f('0xe')]('allow',_0x139059?_0x139059[_0xcd9f('0xf')](';'):_0xcd9f('0x20'));},'get':function(){return this[_0xcd9f('0x1d')]('allow')?this['getDataValue'](_0xcd9f('0x21'))[_0xcd9f('0x11')](';'):null;},'comment':_0xcd9f('0x22')},'autoframing':{'type':Sequelize[_0xcd9f('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0xcd9f('0x2')],'defaultValue':_0xcd9f('0x23'),'set':function(_0xe4d2a6){this['setDataValue'](_0xcd9f('0x24'),_0xe4d2a6?_0xe4d2a6[_0xcd9f('0xf')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xcd9f('0x1d')](_0xcd9f('0x24'))[_0xcd9f('0x11')](','):null;},'comment':_0xcd9f('0x25')},'trustrpid':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcd9f('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no')},'accountcode':{'type':Sequelize[_0xcd9f('0x26')](0xb)},'setvar':{'type':Sequelize[_0xcd9f('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xcd9f('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xcd9f('0x4')]('yes','no'),'defaultValue':_0xcd9f('0x17')},'busylevel':{'type':Sequelize[_0xcd9f('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xcd9f('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xcd9f('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xcd9f('0x2')]},'template':{'type':Sequelize[_0xcd9f('0x2')]},'videosupport':{'type':Sequelize[_0xcd9f('0x4')]('yes','no',_0xcd9f('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcd9f('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no')},'mailbox':{'type':Sequelize[_0xcd9f('0x2')]},'session_timers':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x29'),_0xcd9f('0x2a'),_0xcd9f('0x2b'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xcd9f('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x2c'),_0xcd9f('0x2d')),'defaultValue':_0xcd9f('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0xcd9f('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xcd9f('0x2')]},'fromuser':{'type':Sequelize[_0xcd9f('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xcd9f('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xcd9f('0x2')]},'defaultuser':{'type':Sequelize[_0xcd9f('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcd9f('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xcd9f('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcd9f('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xcd9f('0x26')](0xb)},'timerb':{'type':Sequelize[_0xcd9f('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xcd9f('0x2')]},'contactacl':{'type':Sequelize[_0xcd9f('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xcd9f('0x2')]},'use_q850_reason':{'type':Sequelize[_0xcd9f('0x2')]},'maxforwards':{'type':Sequelize[_0xcd9f('0x26')](0xb)},'encryption':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no')},'force_avp':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no')},'icesupport':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xcd9f('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no',_0xcd9f('0x2e'),_0xcd9f('0x2f'))},'dtlsrekey':{'type':Sequelize[_0xcd9f('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xcd9f('0x2')]},'dtlscipher':{'type':Sequelize[_0xcd9f('0x2')]},'dtlscafile':{'type':Sequelize[_0xcd9f('0x2')]},'dtlscapath':{'type':Sequelize[_0xcd9f('0x2')]},'dtlssetup':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x30'),'passive',_0xcd9f('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xcd9f('0x2')]},'call_limit':{'type':Sequelize[_0xcd9f('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xcd9f('0x4')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xcd9f('0x2')]},'mohsuggest':{'type':Sequelize[_0xcd9f('0x2')]},'parkinglot':{'type':Sequelize[_0xcd9f('0x2')]},'description':{'type':Sequelize[_0xcd9f('0x2')]},'host':{'type':Sequelize[_0xcd9f('0x2')],'defaultValue':_0xcd9f('0x32')},'canreinvite':{'type':Sequelize[_0xcd9f('0x4')](_0xcd9f('0x17'),'no','nonat',_0xcd9f('0x19'),_0xcd9f('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xcd9f('0x2')]},'otherFields':{'type':Sequelize[_0xcd9f('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xcd9f('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 c037487..826f1f9 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 _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x33b0fe,_0xb0f328){var _0xcb44ae=function(_0xdd7c04){while(--_0xdd7c04){_0x33b0fe['push'](_0x33b0fe['shift']());}};_0xcb44ae(++_0xb0f328);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x00bb[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x24985d,_0x240eb5){var _0x4cd358=function(_0x305f2b){while(--_0x305f2b){_0x24985d['push'](_0x24985d['shift']());}};_0x4cd358(++_0x240eb5);}(_0x34e8,0x12c));var _0x834e=function(_0x433d5e,_0x1b252b){_0x433d5e=_0x433d5e-0x0;var _0xf6091f=_0x34e8[_0x433d5e];return _0xf6091f;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index f117fd0..56b5a22 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 _0xaf64=['tools_trunks','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','Trunk'];(function(_0xc6a88f,_0x21ce31){var _0x213434=function(_0x3f6b82){while(--_0x3f6b82){_0xc6a88f['push'](_0xc6a88f['shift']());}};_0x213434(++_0x21ce31);}(_0xaf64,0x12d));var _0x4af6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xaf64[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x4af6('0x0'));var util=require(_0x4af6('0x1'));var logger=require(_0x4af6('0x2'))(_0x4af6('0x3'));var moment=require('moment');var BPromise=require(_0x4af6('0x4'));var rp=require(_0x4af6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4af6('0x6'));var config=require(_0x4af6('0x7'));var attributes=require(_0x4af6('0x8'));module[_0x4af6('0x9')]=function(_0x302846,_0x2bfe96){return _0x302846['define'](_0x4af6('0xa'),attributes,{'tableName':_0x4af6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fcb=['exports','define','Trunk','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x100b96,_0x1bac2c){var _0x44bbcf=function(_0x3ed853){while(--_0x3ed853){_0x100b96['push'](_0x100b96['shift']());}};_0x44bbcf(++_0x1bac2c);}(_0x1fcb,0x1f2));var _0xb1fc=function(_0x3e1ece,_0x321203){_0x3e1ece=_0x3e1ece-0x0;var _0x7be675=_0x1fcb[_0x3e1ece];return _0x7be675;};'use strict';var _=require(_0xb1fc('0x0'));var util=require(_0xb1fc('0x1'));var logger=require(_0xb1fc('0x2'))('api');var moment=require(_0xb1fc('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1fc('0x4'));var fs=require('fs');var path=require(_0xb1fc('0x5'));var rimraf=require(_0xb1fc('0x6'));var config=require(_0xb1fc('0x7'));var attributes=require('./trunk.attributes');module[_0xb1fc('0x8')]=function(_0x306cb9,_0x19610f){return _0x306cb9[_0xb1fc('0x9')](_0xb1fc('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 8b7b131..0bbcc5f 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 _0x1e77=['request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x26fe6f,_0x5e1ebe){var _0xc2987b=function(_0x23062c){while(--_0x23062c){_0x26fe6f['push'](_0x26fe6f['shift']());}};_0xc2987b(++_0x5e1ebe);}(_0x1e77,0x126));var _0x71e7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1e77[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x71e7('0x0'));var util=require(_0x71e7('0x1'));var moment=require(_0x71e7('0x2'));var BPromise=require(_0x71e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x71e7('0x5'))(_0x71e7('0x6'));var config=require(_0x71e7('0x7'));var jayson=require(_0x71e7('0x8'));var client=jayson[_0x71e7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f94b5,_0x7e4a6f,_0x1c93a9){return new BPromise(function(_0xfd4791,_0x3bc90f){return client['request'](_0x4f94b5,_0x1c93a9)[_0x71e7('0xa')](function(_0x242b84){logger[_0x71e7('0xb')]('Trunk,\x20%s,\x20%s',_0x7e4a6f,_0x71e7('0xc'));logger[_0x71e7('0xd')](_0x71e7('0xe'),_0x7e4a6f,_0x71e7('0xc'),JSON[_0x71e7('0xf')](_0x242b84));if(_0x242b84['error']){if(_0x242b84[_0x71e7('0x10')][_0x71e7('0x11')]===0x1f4){logger['error'](_0x71e7('0x12'),_0x7e4a6f,_0x242b84['error'][_0x71e7('0x13')]);return _0x3bc90f(_0x242b84['error'][_0x71e7('0x13')]);}logger[_0x71e7('0x10')](_0x71e7('0x12'),_0x7e4a6f,_0x242b84[_0x71e7('0x10')][_0x71e7('0x13')]);return _0xfd4791(_0x242b84[_0x71e7('0x10')][_0x71e7('0x13')]);}else{logger[_0x71e7('0xb')](_0x71e7('0x12'),_0x7e4a6f,'request\x20sent');_0xfd4791(_0x242b84[_0x71e7('0x14')][_0x71e7('0x13')]);}})[_0x71e7('0x15')](function(_0x226911){logger[_0x71e7('0x10')]('Trunk,\x20%s,\x20%s',_0x7e4a6f,_0x226911);_0x3bc90f(_0x226911);});});}exports[_0x71e7('0x16')]=function(_0x5078da){var _0x37b000=this;return new Promise(function(_0x1c33b5,_0x3469a0){return db[_0x71e7('0x17')]['findAll']({'raw':_0x5078da[_0x71e7('0x18')]?_0x5078da['options'][_0x71e7('0x19')]===undefined?!![]:![]:!![],'where':_0x5078da[_0x71e7('0x18')]?_0x5078da['options'][_0x71e7('0x1a')]||null:null,'attributes':_0x5078da[_0x71e7('0x18')]?_0x5078da[_0x71e7('0x18')][_0x71e7('0x1b')]||null:null,'limit':_0x5078da[_0x71e7('0x18')]?_0x5078da[_0x71e7('0x18')][_0x71e7('0x1c')]||null:null,'include':_0x5078da[_0x71e7('0x18')]?_0x5078da[_0x71e7('0x18')][_0x71e7('0x1d')]?_[_0x71e7('0x1e')](_0x5078da[_0x71e7('0x18')][_0x71e7('0x1d')],function(_0x571df5){return{'model':db[_0x571df5['model']],'as':_0x571df5['as'],'attributes':_0x571df5[_0x71e7('0x1b')],'include':_0x571df5[_0x71e7('0x1d')]?_[_0x71e7('0x1e')](_0x571df5['include'],function(_0x1579a6){return{'model':db[_0x1579a6[_0x71e7('0x1f')]],'as':_0x1579a6['as'],'attributes':_0x1579a6['attributes'],'include':_0x1579a6[_0x71e7('0x1d')]?_[_0x71e7('0x1e')](_0x1579a6[_0x71e7('0x1d')],function(_0x17d303){return{'model':db[_0x17d303[_0x71e7('0x1f')]],'as':_0x17d303['as'],'attributes':_0x17d303[_0x71e7('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x182d95){logger['info'](_0x71e7('0x16'),_0x5078da);logger[_0x71e7('0xd')](_0x71e7('0x16'),_0x5078da,JSON[_0x71e7('0xf')](_0x182d95));_0x1c33b5(_0x182d95);})[_0x71e7('0x15')](function(_0xb3f2e3){logger[_0x71e7('0x10')]('GetTrunk',_0xb3f2e3[_0x71e7('0x13')],_0x5078da);_0x3469a0(_0x37b000[_0x71e7('0x10')](0x1f4,_0xb3f2e3['message']));});});};exports[_0x71e7('0x20')]=function(_0x4472f0){var _0x12745d=this;return new Promise(function(_0x1ae885,_0x40ac1e){return db['Trunk'][_0x71e7('0x21')]({'raw':_0x4472f0[_0x71e7('0x18')]?_0x4472f0[_0x71e7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4472f0[_0x71e7('0x18')]?_0x4472f0[_0x71e7('0x18')]['where']||null:null,'attributes':_0x4472f0[_0x71e7('0x18')]?_0x4472f0[_0x71e7('0x18')]['attributes']||null:null,'include':_0x4472f0['options']?_0x4472f0['options']['include']?_[_0x71e7('0x1e')](_0x4472f0['options']['include'],function(_0x236d04){return{'model':db[_0x236d04[_0x71e7('0x1f')]],'as':_0x236d04['as'],'attributes':_0x236d04[_0x71e7('0x1b')],'include':_0x236d04['include']?_[_0x71e7('0x1e')](_0x236d04['include'],function(_0x163a6c){return{'model':db[_0x163a6c['model']],'as':_0x163a6c['as'],'attributes':_0x163a6c[_0x71e7('0x1b')],'include':_0x163a6c[_0x71e7('0x1d')]?_[_0x71e7('0x1e')](_0x163a6c[_0x71e7('0x1d')],function(_0x2e6da5){return{'model':db[_0x2e6da5[_0x71e7('0x1f')]],'as':_0x2e6da5['as'],'attributes':_0x2e6da5[_0x71e7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x71e7('0xa')](function(_0x3408e5){logger[_0x71e7('0xb')](_0x71e7('0x20'),_0x4472f0);logger['debug'](_0x71e7('0x20'),_0x4472f0,JSON[_0x71e7('0xf')](_0x3408e5));_0x1ae885(_0x3408e5);})['catch'](function(_0x5800e1){logger[_0x71e7('0x10')](_0x71e7('0x20'),_0x5800e1[_0x71e7('0x13')],_0x4472f0);_0x40ac1e(_0x12745d[_0x71e7('0x10')](0x1f4,_0x5800e1[_0x71e7('0x13')]));});});}; \ No newline at end of file +var _0x372a=['result','catch','GetTrunk','options','raw','attributes','limit','include','model','map','ShowTrunk','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info'];(function(_0x129c27,_0x333c44){var _0x5a8017=function(_0x5c5083){while(--_0x5c5083){_0x129c27['push'](_0x129c27['shift']());}};_0x5a8017(++_0x333c44);}(_0x372a,0x14c));var _0xa372=function(_0x5dec65,_0x43e48e){_0x5dec65=_0x5dec65-0x0;var _0x1ed913=_0x372a[_0x5dec65];return _0x1ed913;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa372('0x0'));var BPromise=require(_0xa372('0x1'));var rs=require(_0xa372('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa372('0x3'))['db'];var utils=require(_0xa372('0x4'));var logger=require(_0xa372('0x5'))(_0xa372('0x6'));var config=require(_0xa372('0x7'));var jayson=require(_0xa372('0x8'));var client=jayson[_0xa372('0x9')][_0xa372('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfc37dd,_0x3c6a8b,_0xd7cf7b){return new BPromise(function(_0x1cbf0b,_0x3da73b){return client[_0xa372('0xb')](_0xfc37dd,_0xd7cf7b)[_0xa372('0xc')](function(_0x523ca8){logger['info'](_0xa372('0xd'),_0x3c6a8b,_0xa372('0xe'));logger[_0xa372('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3c6a8b,_0xa372('0xe'),JSON[_0xa372('0x10')](_0x523ca8));if(_0x523ca8[_0xa372('0x11')]){if(_0x523ca8[_0xa372('0x11')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x3c6a8b,_0x523ca8[_0xa372('0x11')][_0xa372('0x12')]);return _0x3da73b(_0x523ca8[_0xa372('0x11')][_0xa372('0x12')]);}logger['error'](_0xa372('0xd'),_0x3c6a8b,_0x523ca8[_0xa372('0x11')][_0xa372('0x12')]);return _0x1cbf0b(_0x523ca8[_0xa372('0x11')][_0xa372('0x12')]);}else{logger[_0xa372('0x13')]('Trunk,\x20%s,\x20%s',_0x3c6a8b,'request\x20sent');_0x1cbf0b(_0x523ca8[_0xa372('0x14')]['message']);}})[_0xa372('0x15')](function(_0x5c306b){logger[_0xa372('0x11')](_0xa372('0xd'),_0x3c6a8b,_0x5c306b);_0x3da73b(_0x5c306b);});});}exports[_0xa372('0x16')]=function(_0x275ca9){var _0x494724=this;return new Promise(function(_0x1b421f,_0x411c4d){return db['Trunk']['findAll']({'raw':_0x275ca9[_0xa372('0x17')]?_0x275ca9[_0xa372('0x17')][_0xa372('0x18')]===undefined?!![]:![]:!![],'where':_0x275ca9[_0xa372('0x17')]?_0x275ca9[_0xa372('0x17')]['where']||null:null,'attributes':_0x275ca9[_0xa372('0x17')]?_0x275ca9[_0xa372('0x17')][_0xa372('0x19')]||null:null,'limit':_0x275ca9['options']?_0x275ca9[_0xa372('0x17')][_0xa372('0x1a')]||null:null,'include':_0x275ca9[_0xa372('0x17')]?_0x275ca9['options']['include']?_['map'](_0x275ca9[_0xa372('0x17')][_0xa372('0x1b')],function(_0x202209){return{'model':db[_0x202209[_0xa372('0x1c')]],'as':_0x202209['as'],'attributes':_0x202209['attributes'],'include':_0x202209[_0xa372('0x1b')]?_[_0xa372('0x1d')](_0x202209['include'],function(_0x442f22){return{'model':db[_0x442f22['model']],'as':_0x442f22['as'],'attributes':_0x442f22['attributes'],'include':_0x442f22[_0xa372('0x1b')]?_['map'](_0x442f22[_0xa372('0x1b')],function(_0x56efb0){return{'model':db[_0x56efb0[_0xa372('0x1c')]],'as':_0x56efb0['as'],'attributes':_0x56efb0[_0xa372('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa372('0xc')](function(_0x4e7fa7){logger[_0xa372('0x13')](_0xa372('0x16'),_0x275ca9);logger[_0xa372('0xf')](_0xa372('0x16'),_0x275ca9,JSON[_0xa372('0x10')](_0x4e7fa7));_0x1b421f(_0x4e7fa7);})[_0xa372('0x15')](function(_0x3a359a){logger[_0xa372('0x11')](_0xa372('0x16'),_0x3a359a['message'],_0x275ca9);_0x411c4d(_0x494724[_0xa372('0x11')](0x1f4,_0x3a359a[_0xa372('0x12')]));});});};exports[_0xa372('0x1e')]=function(_0x2e3975){var _0x4899b9=this;return new Promise(function(_0x19d600,_0x560abe){return db['Trunk'][_0xa372('0x1f')]({'raw':_0x2e3975['options']?_0x2e3975['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e3975[_0xa372('0x17')]?_0x2e3975['options']['where']||null:null,'attributes':_0x2e3975[_0xa372('0x17')]?_0x2e3975['options'][_0xa372('0x19')]||null:null,'include':_0x2e3975[_0xa372('0x17')]?_0x2e3975[_0xa372('0x17')][_0xa372('0x1b')]?_[_0xa372('0x1d')](_0x2e3975['options'][_0xa372('0x1b')],function(_0x3d8bb6){return{'model':db[_0x3d8bb6[_0xa372('0x1c')]],'as':_0x3d8bb6['as'],'attributes':_0x3d8bb6[_0xa372('0x19')],'include':_0x3d8bb6['include']?_['map'](_0x3d8bb6['include'],function(_0x2fe24d){return{'model':db[_0x2fe24d[_0xa372('0x1c')]],'as':_0x2fe24d['as'],'attributes':_0x2fe24d[_0xa372('0x19')],'include':_0x2fe24d[_0xa372('0x1b')]?_[_0xa372('0x1d')](_0x2fe24d[_0xa372('0x1b')],function(_0x1760b8){return{'model':db[_0x1760b8['model']],'as':_0x1760b8['as'],'attributes':_0x1760b8[_0xa372('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa372('0xc')](function(_0xae817c){logger[_0xa372('0x13')](_0xa372('0x1e'),_0x2e3975);logger[_0xa372('0xf')](_0xa372('0x1e'),_0x2e3975,JSON['stringify'](_0xae817c));_0x19d600(_0xae817c);})[_0xa372('0x15')](function(_0x3590d5){logger[_0xa372('0x11')]('ShowTrunk',_0x3590d5[_0xa372('0x12')],_0x2e3975);_0x560abe(_0x4899b9['error'](0x1f4,_0x3590d5[_0xa372('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index eb3cce3..d488cb9 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 _0xb481=['/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','removeQueues','removeTeams','delete','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','isAuthenticated','/whoami','whoami','/presence','getPresence','/:id','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/agents','getAgents','/:id/prefixes','getFaxAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb481,0x1ec));var _0x1b48=function(_0x4547d5,_0x91d898){_0x4547d5=_0x4547d5-0x0;var _0x81ad1f=_0xb481[_0x4547d5];return _0x81ad1f;};'use strict';var multer=require(_0x1b48('0x0'));var util=require(_0x1b48('0x1'));var path=require(_0x1b48('0x2'));var timeout=require(_0x1b48('0x3'));var express=require(_0x1b48('0x4'));var router=express[_0x1b48('0x5')]();var fs_extra=require(_0x1b48('0x6'));var auth=require(_0x1b48('0x7'));var interaction=require(_0x1b48('0x8'));var config=require(_0x1b48('0x9'));var controller=require(_0x1b48('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x1b48('0xb')]);router[_0x1b48('0xc')]('/describe',auth[_0x1b48('0xd')](),controller['describe']);router[_0x1b48('0xc')](_0x1b48('0xe'),auth[_0x1b48('0xd')](),controller[_0x1b48('0xf')]);router[_0x1b48('0xc')](_0x1b48('0x10'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x11')]);router['get'](_0x1b48('0x12'),auth[_0x1b48('0xd')](),controller['show']);router['get']('/:id/avatar',controller[_0x1b48('0x13')]);router[_0x1b48('0xc')](_0x1b48('0x14'),auth[_0x1b48('0xd')](),controller['getOpenTabs']);router[_0x1b48('0xc')](_0x1b48('0x15'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x16')]);router[_0x1b48('0xc')](_0x1b48('0x17'),auth['isAuthenticated'](),controller[_0x1b48('0x18')]);router['get']('/:id/queues_rt',auth[_0x1b48('0xd')](),controller[_0x1b48('0x19')]);router[_0x1b48('0xc')]('/:id/groups',auth[_0x1b48('0xd')](),controller[_0x1b48('0x1a')]);router['get'](_0x1b48('0x1b'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x1c')]);router['get'](_0x1b48('0x1d'),auth['isAuthenticated'](),controller['getScreenRecordings']);router['get']('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x1b48('0x1e')]);router['get'](_0x1b48('0x1f'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x20')]);router[_0x1b48('0xc')](_0x1b48('0x21'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x22')]);router[_0x1b48('0xc')]('/:id/sms/interactions',auth[_0x1b48('0xd')](),controller['getSmsInteractions']);router[_0x1b48('0xc')](_0x1b48('0x23'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x24')]);router[_0x1b48('0xc')]('/:id/whatsapp/interactions',auth[_0x1b48('0xd')](),controller[_0x1b48('0x25')]);router[_0x1b48('0xc')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x1b48('0xc')]('/:id/lists',auth[_0x1b48('0xd')](),controller['getLists']);router[_0x1b48('0xc')](_0x1b48('0x26'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x27')]);router[_0x1b48('0xc')](_0x1b48('0x28'),auth[_0x1b48('0xd')](),controller['getVoicePrefixes']);router[_0x1b48('0xc')]('/:id/fax_accounts',auth[_0x1b48('0xd')](),controller[_0x1b48('0x29')]);router[_0x1b48('0xc')]('/:id/mail_accounts',auth[_0x1b48('0xd')](),controller['getMailAccounts']);router[_0x1b48('0xc')](_0x1b48('0x2a'),auth[_0x1b48('0xd')](),controller['getOpenchannelAccounts']);router[_0x1b48('0xc')](_0x1b48('0x2b'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x2c')]);router[_0x1b48('0xc')](_0x1b48('0x2d'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x2e')]);router[_0x1b48('0xc')](_0x1b48('0x2f'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x30')]);router[_0x1b48('0xc')](_0x1b48('0x31'),auth['isAuthenticated'](),controller[_0x1b48('0x32')]);router[_0x1b48('0xc')](_0x1b48('0x33'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x34')]);router[_0x1b48('0xc')](_0x1b48('0x35'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x36')]);router['post'](_0x1b48('0x15'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x37')]);router[_0x1b48('0x38')]('/',auth['isAuthenticated'](),controller[_0x1b48('0x39')]);router['post'](_0x1b48('0x3a'),auth['isAuthenticated'](),controller[_0x1b48('0x3b')]);router['post']('/:id/queues',auth['isAuthenticated'](),controller[_0x1b48('0x3c')]);var upload=multer({'storage':multer[_0x1b48('0x3d')]({'destination':function(_0x3f48ad,_0x13a3af,_0x223209){_0x223209(null,path[_0x1b48('0x3e')](config[_0x1b48('0x3f')],_0x1b48('0x40')));},'filename':function(_0xc8d8d3,_0xbd172,_0x5ee176){_0x5ee176(null,util[_0x1b48('0x41')](_0x1b48('0x42'),Date[_0x1b48('0x43')](),_0xbd172[_0x1b48('0x44')]));}})});router[_0x1b48('0x38')]('/:id/avatar',upload[_0x1b48('0x45')]('file'),controller[_0x1b48('0x46')]);router['post']('/:id/login',auth[_0x1b48('0xd')](),controller['login']);router[_0x1b48('0x38')]('/:id/logout',auth[_0x1b48('0xd')](),controller[_0x1b48('0x47')]);router[_0x1b48('0x38')](_0x1b48('0x48'),auth[_0x1b48('0xd')](),controller['pause']);router[_0x1b48('0x38')](_0x1b48('0x49'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x4a')]);router[_0x1b48('0x38')](_0x1b48('0x4b'),auth['isAuthenticated'](),controller['addTeams']);router[_0x1b48('0x38')]('/:id/chat_interactions',auth[_0x1b48('0xd')](),controller[_0x1b48('0x4c')]);router[_0x1b48('0x38')](_0x1b48('0x4d'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x4e')]);router[_0x1b48('0x38')](_0x1b48('0x4f'),auth['isAuthenticated'](),controller[_0x1b48('0x50')]);router[_0x1b48('0x38')](_0x1b48('0x51'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x52')]);router['post'](_0x1b48('0x53'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x54')]);router[_0x1b48('0x38')](_0x1b48('0x55'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x56')]);router['post']('/:id/fax_accounts',auth[_0x1b48('0xd')](),controller[_0x1b48('0x57')]);router['post'](_0x1b48('0x58'),auth['isAuthenticated'](),controller[_0x1b48('0x59')]);router[_0x1b48('0x38')](_0x1b48('0x2a'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x5a')]);router[_0x1b48('0x38')](_0x1b48('0x2b'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x5b')]);router['post'](_0x1b48('0x2d'),auth[_0x1b48('0xd')](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router['post'](_0x1b48('0x31'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x5c')]);router[_0x1b48('0x38')](_0x1b48('0x35'),auth['isAuthenticated'](),controller[_0x1b48('0x5d')]);router[_0x1b48('0x5e')](_0x1b48('0x12'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x5f')]);router['put'](_0x1b48('0x60'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x61')]);router['delete'](_0x1b48('0x17'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x62')]);router['delete'](_0x1b48('0x4b'),auth['isAuthenticated'](),controller[_0x1b48('0x63')]);router[_0x1b48('0x64')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/chat_interactions',auth[_0x1b48('0xd')](),controller[_0x1b48('0x65')]);router[_0x1b48('0x64')](_0x1b48('0x4d'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x66')]);router[_0x1b48('0x64')]('/:id/fax_interactions',auth[_0x1b48('0xd')](),controller[_0x1b48('0x67')]);router['delete'](_0x1b48('0x51'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x68')]);router[_0x1b48('0x64')]('/:id/openchannel_interactions',auth[_0x1b48('0xd')](),controller[_0x1b48('0x69')]);router[_0x1b48('0x64')](_0x1b48('0x55'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x6a')]);router[_0x1b48('0x64')](_0x1b48('0x6b'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x1b48('0x64')](_0x1b48('0x58'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x6c')]);router['delete'](_0x1b48('0x2a'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x6d')]);router['delete'](_0x1b48('0x2b'),auth['isAuthenticated'](),controller[_0x1b48('0x6e')]);router[_0x1b48('0x64')]('/:id/chat_websites',auth[_0x1b48('0xd')](),controller[_0x1b48('0x6f')]);router['delete'](_0x1b48('0x2f'),auth[_0x1b48('0xd')](),controller[_0x1b48('0x70')]);router[_0x1b48('0x64')](_0x1b48('0x31'),auth[_0x1b48('0xd')](),controller['removeSquareProjects']);router[_0x1b48('0x64')]('/:id/api_key',auth[_0x1b48('0xd')](),controller[_0x1b48('0x71')]);module[_0x1b48('0x72')]=router; \ No newline at end of file +var _0xf2bc=['multer','util','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','post','create','/create_many','addQueues','join','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','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0xf2bc,0x14a));var _0xcf2b=function(_0x4a489f,_0x5402ab){_0x4a489f=_0x4a489f-0x0;var _0x4a4137=_0xf2bc[_0x4a489f];return _0x4a4137;};'use strict';var multer=require(_0xcf2b('0x0'));var util=require(_0xcf2b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcf2b('0x2'));var auth=require(_0xcf2b('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router[_0xcf2b('0x4')]('/',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x6')]);router[_0xcf2b('0x4')](_0xcf2b('0x7'),auth[_0xcf2b('0x5')](),controller['describe']);router[_0xcf2b('0x4')]('/whoami',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x8')]);router[_0xcf2b('0x4')]('/presence',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x9')]);router[_0xcf2b('0x4')](_0xcf2b('0xa'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0xb')]);router[_0xcf2b('0x4')](_0xcf2b('0xc'),controller[_0xcf2b('0xd')]);router['get'](_0xcf2b('0xe'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0xf')]);router[_0xcf2b('0x4')](_0xcf2b('0x10'),auth['isAuthenticated'](),controller[_0xcf2b('0x11')]);router[_0xcf2b('0x4')](_0xcf2b('0x12'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x13')]);router[_0xcf2b('0x4')](_0xcf2b('0x14'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x15')]);router['get']('/:id/groups',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x16')]);router[_0xcf2b('0x4')](_0xcf2b('0x17'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x18')]);router[_0xcf2b('0x4')](_0xcf2b('0x19'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x1a')]);router[_0xcf2b('0x4')](_0xcf2b('0x1b'),auth[_0xcf2b('0x5')](),controller['getChatInteractions']);router[_0xcf2b('0x4')]('/:id/openchannel/interactions',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x1c')]);router[_0xcf2b('0x4')](_0xcf2b('0x1d'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x1e')]);router[_0xcf2b('0x4')](_0xcf2b('0x1f'),auth[_0xcf2b('0x5')](),controller['getSmsInteractions']);router[_0xcf2b('0x4')](_0xcf2b('0x20'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x21')]);router[_0xcf2b('0x4')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xcf2b('0x22')]);router[_0xcf2b('0x4')](_0xcf2b('0x23'),auth[_0xcf2b('0x5')](),controller['getTeams']);router['get'](_0xcf2b('0x24'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x25')]);router[_0xcf2b('0x4')](_0xcf2b('0x26'),auth['isAuthenticated'](),controller['getAgents']);router[_0xcf2b('0x4')]('/:id/prefixes',auth[_0xcf2b('0x5')](),controller['getVoicePrefixes']);router[_0xcf2b('0x4')](_0xcf2b('0x27'),auth['isAuthenticated'](),controller[_0xcf2b('0x28')]);router[_0xcf2b('0x4')](_0xcf2b('0x29'),auth['isAuthenticated'](),controller[_0xcf2b('0x2a')]);router[_0xcf2b('0x4')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xcf2b('0x2b')]);router[_0xcf2b('0x4')](_0xcf2b('0x2c'),auth['isAuthenticated'](),controller[_0xcf2b('0x2d')]);router[_0xcf2b('0x4')](_0xcf2b('0x2e'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x2f')]);router[_0xcf2b('0x4')](_0xcf2b('0x30'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0xcf2b('0x4')](_0xcf2b('0x31'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x32')]);router[_0xcf2b('0x4')](_0xcf2b('0x33'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0xcf2b('0x4')]('/:id/api_key',auth[_0xcf2b('0x5')](),controller['getApiKey']);router[_0xcf2b('0x34')](_0xcf2b('0x10'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth['isAuthenticated'](),controller[_0xcf2b('0x35')]);router['post'](_0xcf2b('0x36'),auth['isAuthenticated'](),controller['bulkCreate']);router['post'](_0xcf2b('0x12'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd691d8,_0x4af2a7,_0x367edf){_0x367edf(null,path[_0xcf2b('0x38')](config['root'],'server/files/images/'));},'filename':function(_0x1ed0dc,_0x271aa1,_0x50def4){_0x50def4(null,util[_0xcf2b('0x39')](_0xcf2b('0x3a'),Date[_0xcf2b('0x3b')](),_0x271aa1[_0xcf2b('0x3c')]));}})});router[_0xcf2b('0x34')](_0xcf2b('0xc'),upload[_0xcf2b('0x3d')](_0xcf2b('0x3e')),controller['addAvatar']);router[_0xcf2b('0x34')](_0xcf2b('0x3f'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x40')]);router[_0xcf2b('0x34')](_0xcf2b('0x41'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x42')]);router['post'](_0xcf2b('0x43'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x44')]);router[_0xcf2b('0x34')](_0xcf2b('0x45'),auth['isAuthenticated'](),controller[_0xcf2b('0x46')]);router[_0xcf2b('0x34')]('/:id/teams',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x47')]);router[_0xcf2b('0x34')]('/:id/chat_interactions',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x48')]);router[_0xcf2b('0x34')](_0xcf2b('0x49'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x4a')]);router[_0xcf2b('0x34')](_0xcf2b('0x4b'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x4c')]);router[_0xcf2b('0x34')]('/:id/sms_interactions',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x4d')]);router[_0xcf2b('0x34')]('/:id/openchannel_interactions',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x4e')]);router[_0xcf2b('0x34')](_0xcf2b('0x4f'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x50')]);router[_0xcf2b('0x34')]('/:id/fax_accounts',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x51')]);router[_0xcf2b('0x34')](_0xcf2b('0x29'),auth['isAuthenticated'](),controller[_0xcf2b('0x52')]);router[_0xcf2b('0x34')](_0xcf2b('0x53'),auth[_0xcf2b('0x5')](),controller['addOpenchannelAccounts']);router[_0xcf2b('0x34')](_0xcf2b('0x2c'),auth[_0xcf2b('0x5')](),controller['addSmsAccounts']);router[_0xcf2b('0x34')]('/:id/chat_websites',auth[_0xcf2b('0x5')](),controller['addChatWebsites']);router[_0xcf2b('0x34')](_0xcf2b('0x30'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x54')]);router[_0xcf2b('0x34')](_0xcf2b('0x31'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x55')]);router[_0xcf2b('0x34')](_0xcf2b('0x56'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x57')]);router[_0xcf2b('0x58')]('/:id',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x59')]);router[_0xcf2b('0x58')](_0xcf2b('0x5a'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x5b')]);router[_0xcf2b('0x5c')](_0xcf2b('0x12'),auth[_0xcf2b('0x5')](),controller['removeQueues']);router[_0xcf2b('0x5c')](_0xcf2b('0x23'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x5d')]);router[_0xcf2b('0x5c')](_0xcf2b('0xa'),auth['isAuthenticated'](),controller[_0xcf2b('0x5e')]);router[_0xcf2b('0x5c')](_0xcf2b('0x5f'),auth[_0xcf2b('0x5')](),controller['removeChatInteractions']);router[_0xcf2b('0x5c')](_0xcf2b('0x49'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x60')]);router['delete']('/:id/fax_interactions',auth[_0xcf2b('0x5')](),controller['removeFaxInteractions']);router[_0xcf2b('0x5c')](_0xcf2b('0x61'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x62')]);router['delete']('/:id/openchannel_interactions',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x63')]);router[_0xcf2b('0x5c')](_0xcf2b('0x4f'),auth['isAuthenticated'](),controller[_0xcf2b('0x64')]);router[_0xcf2b('0x5c')]('/:id/fax_accounts',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x65')]);router[_0xcf2b('0x5c')]('/:id/mail_accounts',auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x66')]);router[_0xcf2b('0x5c')](_0xcf2b('0x53'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x67')]);router[_0xcf2b('0x5c')](_0xcf2b('0x2c'),auth['isAuthenticated'](),controller[_0xcf2b('0x68')]);router['delete'](_0xcf2b('0x2e'),auth['isAuthenticated'](),controller[_0xcf2b('0x69')]);router['delete'](_0xcf2b('0x30'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x6a')]);router[_0xcf2b('0x5c')](_0xcf2b('0x31'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x6b')]);router[_0xcf2b('0x5c')](_0xcf2b('0x56'),auth[_0xcf2b('0x5')](),controller[_0xcf2b('0x6c')]);module[_0xcf2b('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 38cc0df..97d3b19 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 _0xf435=['phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','setDataValue','name','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','BOOLEAN','DATE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','refuse','uac','uas','fingerprint','certificate','active','actpass','nonat','TEXT','showWebBar','get','transport','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf435,0x174));var _0x5f43=function(_0x1f9fd6,_0x16f749){_0x1f9fd6=_0x1f9fd6-0x0;var _0x2b3126=_0xf435[_0x1f9fd6];return _0x2b3126;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5f43('0x0'));var util=require(_0x5f43('0x1'));var _=require(_0x5f43('0x2'));module[_0x5f43('0x3')]={'name':{'type':Sequelize[_0x5f43('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x286c03){this[_0x5f43('0x5')](_0x5f43('0x6'),_0x286c03);this[_0x5f43('0x5')]('defaultuser',_0x286c03);},'comment':_0x5f43('0x7')},'fullname':{'type':Sequelize[_0x5f43('0x4')],'allowNull':![],'set':function(_0x39adbd){this['setDataValue'](_0x5f43('0x8'),_0x39adbd);this[_0x5f43('0x5')](_0x5f43('0x9'),util[_0x5f43('0xa')](_0x5f43('0xb'),_0x39adbd,this[_0x5f43('0xc')](_0x5f43('0xd'))));}},'alias':{'type':Sequelize[_0x5f43('0x4')]},'email':{'type':Sequelize[_0x5f43('0x4')],'allowNull':![],'unique':_0x5f43('0xe'),'validate':{'isEmail':!![]},'set':function(_0x1c9040){if(_0x1c9040){this['setDataValue']('email',_0x1c9040[_0x5f43('0xf')]());}}},'role':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x11'),_0x5f43('0x12'),_0x5f43('0x13'),_0x5f43('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x5f43('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x5f43('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x3c7342){this['setDataValue'](_0x5f43('0xd'),_0x3c7342);this[_0x5f43('0x5')](_0x5f43('0x16'),_0x3c7342);this[_0x5f43('0x5')]('callerid',util[_0x5f43('0xa')](_0x5f43('0xb'),this[_0x5f43('0xc')]('fullname'),_0x3c7342));}},'salt':{'type':Sequelize[_0x5f43('0x4')]},'phone':{'type':Sequelize[_0x5f43('0x4')]},'mobile':{'type':Sequelize[_0x5f43('0x4')]},'address':{'type':Sequelize[_0x5f43('0x4')]},'zipcode':{'type':Sequelize[_0x5f43('0x4')]},'userpic':{'type':Sequelize[_0x5f43('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x5f43('0x4')]},'online':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5f43('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x5f43('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5f43('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5f43('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x5f43('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5f43('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5f43('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5f43('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x5f43('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x19'),_0x5f43('0x12'),_0x5f43('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![],'defaultValue':_0x5f43('0x1b')},'callingpres':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x1c'),_0x5f43('0x1d'),_0x5f43('0x1e'),_0x5f43('0x1f'),_0x5f43('0x20'),_0x5f43('0x21'),_0x5f43('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1f138b){this[_0x5f43('0x5')]('transport',_0x1f138b?_0x1f138b[_0x5f43('0x23')](','):null);},'get':function(){return this[_0x5f43('0xc')]('transport')?this['getDataValue']('transport')[_0x5f43('0x24')](','):null;},'comment':_0x5f43('0x25')},'dtmfmode':{'type':Sequelize['ENUM'](_0x5f43('0x26'),_0x5f43('0x27'),_0x5f43('0x28'),'inband',_0x5f43('0x29')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x5f43('0x2a'),'no','nonat',_0x5f43('0x2b'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![],'defaultValue':_0x5f43('0x2c'),'set':function(_0x2c349f){this[_0x5f43('0x5')](_0x5f43('0x2d'),_0x2c349f?_0x2c349f[_0x5f43('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x5f43('0x2d'))?this[_0x5f43('0xc')](_0x5f43('0x2d'))[_0x5f43('0x24')](','):null;},'comment':_0x5f43('0x2e')},'callgroup':{'type':Sequelize[_0x5f43('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5f43('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x5f43('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5f43('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5f43('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5f43('0x30'),'set':function(_0x3c42e2){this[_0x5f43('0x5')](_0x5f43('0x31'),_0x3c42e2?_0x3c42e2[_0x5f43('0x23')](';'):_0x5f43('0x30'));},'get':function(){return this[_0x5f43('0xc')]('allow')?this['getDataValue'](_0x5f43('0x31'))['split'](';'):null;},'comment':_0x5f43('0x32')},'autoframing':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![],'set':function(_0x5eca7c){this[_0x5f43('0x5')]('insecure',_0x5eca7c?_0x5eca7c[_0x5f43('0x23')](','):null);},'get':function(){return this[_0x5f43('0xc')]('insecure')?this[_0x5f43('0xc')]('insecure')[_0x5f43('0x24')](','):null;},'comment':_0x5f43('0x33')},'trustrpid':{'type':Sequelize['ENUM'](_0x5f43('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5f43('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no',_0x5f43('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5f43('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5f43('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0x5f43('0x2a')},'busylevel':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x5f43('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x35'),_0x5f43('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x5f43('0x37'),_0x5f43('0x38')),'allowNull':!![],'defaultValue':_0x5f43('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5f43('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x5f43('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x5f43('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5f43('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5f43('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x5f43('0x2a'),'no',_0x5f43('0x39'),_0x5f43('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x3b'),'passive',_0x5f43('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x5f43('0x10')](_0x5f43('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5f43('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x5f43('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x5f43('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x5f43('0x10')]('yes','no',_0x5f43('0x3d'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5f43('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x5f43('0x18')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5f43('0x3e')]},'showWebBar':{'type':Sequelize[_0x5f43('0x15')],'defaultValue':0x0,'set':function(_0x434d20){this[_0x5f43('0x5')](_0x5f43('0x3f'),_0x434d20);var _0x26bf86=this[_0x5f43('0x40')]({'plain':!![]});switch(_0x434d20){case 0x0:case 0x1:var _0x12996a=_0x26bf86[_0x5f43('0x41')]?_[_0x5f43('0x42')](_0x26bf86['transport'])?_0x26bf86[_0x5f43('0x41')][_0x5f43('0x23')]():_0x26bf86[_0x5f43('0x41')]:'udp';if(_0x12996a===_0x5f43('0x43')){_0x12996a=_0x5f43('0x44');}this[_0x5f43('0x5')]('transport',_0x12996a);this['setDataValue'](_0x5f43('0x45'),'no');this['setDataValue'](_0x5f43('0x46'),null);this[_0x5f43('0x5')](_0x5f43('0x47'),null);this[_0x5f43('0x5')](_0x5f43('0x48'),null);this[_0x5f43('0x5')](_0x5f43('0x49'),null);this[_0x5f43('0x5')](_0x5f43('0x4a'),null);this[_0x5f43('0x5')](_0x5f43('0x4b'),null);this[_0x5f43('0x5')](_0x5f43('0x4c'),null);this[_0x5f43('0x5')](_0x5f43('0x4d'),null);this[_0x5f43('0x5')](_0x5f43('0x4e'),'no');break;case 0x2:this[_0x5f43('0x5')](_0x5f43('0x41'),_0x5f43('0x43'));this[_0x5f43('0x5')](_0x5f43('0x45'),_0x5f43('0x2a'));this[_0x5f43('0x5')](_0x5f43('0x46'),_0x5f43('0x2a'));this[_0x5f43('0x5')](_0x5f43('0x47'),_0x5f43('0x2a'));this['setDataValue']('icesupport','yes');this['setDataValue']('dtlsenable',_0x5f43('0x2a'));this[_0x5f43('0x5')](_0x5f43('0x4a'),'no');this[_0x5f43('0x5')](_0x5f43('0x4b'),_0x5f43('0x3c'));this[_0x5f43('0x5')](_0x5f43('0x4c'),_0x26bf86['dtlscertfile']||_0x5f43('0x4f'));this[_0x5f43('0x5')]('dtlsprivatekey',_0x26bf86[_0x5f43('0x4d')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x5f43('0x4e'),_0x5f43('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x397251){this['setDataValue'](_0x5f43('0x50'),_0x397251?_0x397251[_0x5f43('0x23')](','):[]);},'get':function(){return this[_0x5f43('0xc')](_0x5f43('0x50'))?_[_0x5f43('0x51')](this[_0x5f43('0xc')](_0x5f43('0x50'))[_0x5f43('0x24')](','),function(_0x31861e){return parseInt(_0x31861e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x5f43('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5f43('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x5f43('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5f43('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5f43('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5f43('0x10')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x5f43('0x52')],'get':function(){return this[_0x5f43('0xc')](_0x5f43('0x53'))?this[_0x5f43('0xc')](_0x5f43('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x5f43('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x233664){if(typeof _0x233664===_0x5f43('0x54')){var _0x2adab8=_0x233664==='1'?!![]:_0x233664==='0'?![]:_0x233664===_0x5f43('0x55')?!![]:_0x233664===_0x5f43('0x56')?![]:![];this[_0x5f43('0x5')](_0x5f43('0x57'),_0x2adab8);}else{this[_0x5f43('0x5')](_0x5f43('0x57'),_0x233664);}}},'blocked':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![],'set':function(_0xe2fb3a){this[_0x5f43('0x5')](_0x5f43('0x58'),_0xe2fb3a);if(_0xe2fb3a===!![]){this['setDataValue'](_0x5f43('0x59'),moment());this[_0x5f43('0x5')]('loginAttempts',0x0);}else{this[_0x5f43('0x5')](_0x5f43('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5f43('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5f43('0x15')](0x5)[_0x5f43('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5f43('0x17')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfb8f=['accountcode','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','rfc2833','info','shortinfo','auto','yes','nonat','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','active','passive','update','TEXT','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','actpass','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','moment','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','email','toLowerCase','ENUM','admin','user','agent','local','internal'];(function(_0x13fbaf,_0x4c4968){var _0x35f014=function(_0x4382a3){while(--_0x4382a3){_0x13fbaf['push'](_0x13fbaf['shift']());}};_0x35f014(++_0x4c4968);}(_0xfb8f,0x18c));var _0xffb8=function(_0x10a78b,_0x289e96){_0x10a78b=_0x10a78b-0x0;var _0xbccfe=_0xfb8f[_0x10a78b];return _0xbccfe;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xffb8('0x0'));var util=require('util');var _=require('lodash');module[_0xffb8('0x1')]={'name':{'type':Sequelize[_0xffb8('0x2')],'allowNull':![],'unique':_0xffb8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2d270d){this[_0xffb8('0x4')]('name',_0x2d270d);this[_0xffb8('0x4')](_0xffb8('0x5'),_0x2d270d);},'comment':_0xffb8('0x6')},'fullname':{'type':Sequelize[_0xffb8('0x2')],'allowNull':![],'set':function(_0x5a70ab){this['setDataValue'](_0xffb8('0x7'),_0x5a70ab);this[_0xffb8('0x4')](_0xffb8('0x8'),util[_0xffb8('0x9')](_0xffb8('0xa'),_0x5a70ab,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xffb8('0x2')]},'email':{'type':Sequelize[_0xffb8('0x2')],'allowNull':![],'unique':_0xffb8('0xb'),'validate':{'isEmail':!![]},'set':function(_0x2b2197){if(_0x2b2197){this[_0xffb8('0x4')]('email',_0x2b2197[_0xffb8('0xc')]());}}},'role':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0xe'),_0xffb8('0xf'),_0xffb8('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xffb8('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xffb8('0x2')],'defaultValue':_0xffb8('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xffb8('0x12'),'set':function(_0x5187a3){this['setDataValue'](_0xffb8('0x12'),_0x5187a3);this[_0xffb8('0x4')](_0xffb8('0x13'),_0x5187a3);this[_0xffb8('0x4')](_0xffb8('0x8'),util[_0xffb8('0x9')](_0xffb8('0xa'),this[_0xffb8('0x14')](_0xffb8('0x7')),_0x5187a3));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xffb8('0x2')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xffb8('0x2')]},'online':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xffb8('0x16')]},'voicePause':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xffb8('0x17')},'lastPauseAt':{'type':Sequelize[_0xffb8('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xffb8('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0xffb8('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x19'),'user','peer'),'allowNull':!![],'defaultValue':_0xffb8('0x19')},'context':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![],'defaultValue':_0xffb8('0x1a')},'callingpres':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x1b'),_0xffb8('0x1c'),'ALLOWED_FAILED_SCREEN',_0xffb8('0x1d'),'PROHIB_NOT_SCREENED',_0xffb8('0x1e'),_0xffb8('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x23eea3){this[_0xffb8('0x4')](_0xffb8('0x20'),_0x23eea3?_0x23eea3[_0xffb8('0x21')](','):null);},'get':function(){return this[_0xffb8('0x14')](_0xffb8('0x20'))?this[_0xffb8('0x14')](_0xffb8('0x20'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xffb8('0x22'),_0xffb8('0x23'),_0xffb8('0x24'),'inband',_0xffb8('0x25')),'allowNull':!![],'defaultValue':_0xffb8('0x22')},'directmedia':{'type':Sequelize['ENUM'](_0xffb8('0x26'),'no',_0xffb8('0x27'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x35fbc0){this[_0xffb8('0x4')](_0xffb8('0x28'),_0x35fbc0?_0x35fbc0[_0xffb8('0x21')](','):null);},'get':function(){return this[_0xffb8('0x14')](_0xffb8('0x28'))?this[_0xffb8('0x14')]('nat')['split'](','):null;},'comment':_0xffb8('0x29')},'callgroup':{'type':Sequelize[_0xffb8('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xffb8('0x2')]},'language':{'type':Sequelize[_0xffb8('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xffb8('0x2')],'allowNull':![],'defaultValue':_0xffb8('0x2a')},'allow':{'type':Sequelize[_0xffb8('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x253885){this[_0xffb8('0x4')](_0xffb8('0x2b'),_0x253885?_0x253885[_0xffb8('0x21')](';'):_0xffb8('0x2c'));},'get':function(){return this['getDataValue'](_0xffb8('0x2b'))?this[_0xffb8('0x14')](_0xffb8('0x2b'))[_0xffb8('0x2d')](';'):null;},'comment':_0xffb8('0x2e')},'autoframing':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![],'set':function(_0x2b441d){this[_0xffb8('0x4')](_0xffb8('0x2f'),_0x2b441d?_0x2b441d[_0xffb8('0x21')](','):null);},'get':function(){return this[_0xffb8('0x14')](_0xffb8('0x2f'))?this[_0xffb8('0x14')](_0xffb8('0x2f'))[_0xffb8('0x2d')](','):null;},'comment':_0xffb8('0x30')},'trustrpid':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xffb8('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no',_0xffb8('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xffb8('0x32')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xffb8('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0xffb8('0x26')},'busylevel':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xffb8('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xffb8('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xffb8('0x26'),'no',_0xffb8('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xffb8('0xd')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xffb8('0x34'),_0xffb8('0x35'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x36'),_0xffb8('0x37')),'allowNull':!![],'defaultValue':_0xffb8('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xffb8('0x26'),'no'),'allowNull':!![],'defaultValue':_0xffb8('0x26')},'keepalive':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xffb8('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xffb8('0x26'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no',_0xffb8('0x38'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x39'),_0xffb8('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xffb8('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xffb8('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xffb8('0xd')](_0xffb8('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xffb8('0x26'),'no',_0xffb8('0x27'),_0xffb8('0x3b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xffb8('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0xffb8('0x16')]},'passwordResetAt':{'type':Sequelize[_0xffb8('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xffb8('0x3c')]},'showWebBar':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x0,'set':function(_0x248686){this['setDataValue']('showWebBar',_0x248686);var _0x2c31ca=this['get']({'plain':!![]});switch(_0x248686){case 0x0:case 0x1:var _0x5900e4=_0x2c31ca[_0xffb8('0x20')]?_[_0xffb8('0x3d')](_0x2c31ca[_0xffb8('0x20')])?_0x2c31ca['transport'][_0xffb8('0x21')]():_0x2c31ca[_0xffb8('0x20')]:'udp';if(_0x5900e4===_0xffb8('0x3e')){_0x5900e4=_0xffb8('0x3f');}this[_0xffb8('0x4')](_0xffb8('0x20'),_0x5900e4);this[_0xffb8('0x4')](_0xffb8('0x40'),'no');this[_0xffb8('0x4')](_0xffb8('0x41'),null);this[_0xffb8('0x4')](_0xffb8('0x42'),null);this['setDataValue'](_0xffb8('0x43'),null);this[_0xffb8('0x4')](_0xffb8('0x44'),null);this['setDataValue'](_0xffb8('0x45'),null);this[_0xffb8('0x4')](_0xffb8('0x46'),null);this['setDataValue'](_0xffb8('0x47'),null);this[_0xffb8('0x4')]('dtlsprivatekey',null);this[_0xffb8('0x4')](_0xffb8('0x48'),'no');break;case 0x2:this['setDataValue'](_0xffb8('0x20'),_0xffb8('0x3e'));this[_0xffb8('0x4')](_0xffb8('0x40'),_0xffb8('0x26'));this[_0xffb8('0x4')](_0xffb8('0x41'),_0xffb8('0x26'));this['setDataValue'](_0xffb8('0x42'),'yes');this[_0xffb8('0x4')](_0xffb8('0x43'),'yes');this[_0xffb8('0x4')](_0xffb8('0x44'),_0xffb8('0x26'));this['setDataValue'](_0xffb8('0x45'),'no');this[_0xffb8('0x4')](_0xffb8('0x46'),_0xffb8('0x49'));this[_0xffb8('0x4')](_0xffb8('0x47'),_0x2c31ca[_0xffb8('0x47')]||'/etc/pki/tls/certs/motion.crt');this[_0xffb8('0x4')](_0xffb8('0x4a'),_0x2c31ca[_0xffb8('0x4a')]||_0xffb8('0x4b'));this[_0xffb8('0x4')](_0xffb8('0x48'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xffb8('0x3c')],'set':function(_0x31c627){this['setDataValue'](_0xffb8('0x4c'),_0x31c627?_0x31c627['join'](','):[]);},'get':function(){return this[_0xffb8('0x14')](_0xffb8('0x4c'))?_[_0xffb8('0x4d')](this[_0xffb8('0x14')](_0xffb8('0x4c'))['split'](','),function(_0x35d8b2){return parseInt(_0x35d8b2,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xffb8('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xffb8('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xffb8('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xffb8('0x2')]},'phoneBarEnableJaws':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xffb8('0x14')](_0xffb8('0x4e'))?this[_0xffb8('0x14')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xffb8('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xffb8('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5ba8ca){if(typeof _0x5ba8ca===_0xffb8('0x4f')){var _0x24adcb=_0x5ba8ca==='1'?!![]:_0x5ba8ca==='0'?![]:_0x5ba8ca==='true'?!![]:_0x5ba8ca==='false'?![]:![];this[_0xffb8('0x4')](_0xffb8('0x50'),_0x24adcb);}else{this[_0xffb8('0x4')](_0xffb8('0x50'),_0x5ba8ca);}}},'blocked':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![],'set':function(_0x19946e){this['setDataValue'](_0xffb8('0x51'),_0x19946e);if(_0x19946e===!![]){this['setDataValue']('blockedAt',moment());this[_0xffb8('0x4')]('loginAttempts',0x0);}else{this['setDataValue'](_0xffb8('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0xffb8('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xffb8('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xffb8('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'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 83ee5b3..06a001d 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 _0x9bc0=['MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','merge','options','hasOwnProperty','CmList','List','Tags','tag','getQueues','Queue','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getWhatsappInteractions','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','SIP/%s','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','destroy','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','getTeams','Team','omit','Voice','getChatQueues','Chat','getMailQueues','setDataValue','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','flatten','addAgent','getDataValue','removeTeams','Mail','getSmsQueues','getFaxQueues','Openchannel','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:save','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$eq','$not','$in','$notIn','$notLike','$notILike','$like','$overlap','$contains','$contained','firstName','lastName','dialActive','VoiceQueue','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unavailable','ringing','busy','charAt','toUpperCase','slice','select','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./user.socket','jayson/promise','client','request','then','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','User,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','get','role','admin','Users','user','agent','Telephones','ignore','map','value','find','name','UserProfileResource','end','send','index','User','rawAttributes','fieldName','type','key','model','salt','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','sequelize','lower','col','filter','includeAll','include','includes','push','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','all','show','params','password','keys','whatsapp','body','describe','addContacts','ids','Setting','findById','securePassword','validatePasswordPattern','internal','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','fullname','email','permissions','101','102','103','113','104','105','107','108','109','100','111','115','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','userProfileId','create','VoiceMail','UserProfileSection','Agents','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','each','findAll','isEmpty','autoAssociation','telephone','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','updatePasswordsHistory','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','Queue:save','voice','format','UserVoiceQueueRt','removeQueues','remove','emit','Queue:remove','addAvatar','userpic','file','getAvatar','root','server/files/images/logos/default_profile.png','download','join','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs'];(function(_0x323369,_0x252aee){var _0x456518=function(_0xa56562){while(--_0xa56562){_0x323369['push'](_0x323369['shift']());}};_0x456518(++_0x252aee);}(_0x9bc0,0xcf));var _0x09bc=function(_0x5744ce,_0x40b19c){_0x5744ce=_0x5744ce-0x0;var _0x311a9c=_0x9bc0[_0x5744ce];return _0x311a9c;};'use strict';var emlformat=require(_0x09bc('0x0'));var rimraf=require(_0x09bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09bc('0x2'));var rp=require(_0x09bc('0x3'));var moment=require(_0x09bc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x09bc('0x5'));var util=require(_0x09bc('0x6'));var path=require(_0x09bc('0x7'));var sox=require(_0x09bc('0x8'));var csv=require(_0x09bc('0x9'));var ejs=require(_0x09bc('0xa'));var fs=require('fs');var fs_extra=require(_0x09bc('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x09bc('0xc'));var jsforce=require(_0x09bc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x09bc('0xe'));var Redis=require('ioredis');var values;var authService=require(_0x09bc('0xf'));var qs=require(_0x09bc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09bc('0x11'));var logger=require(_0x09bc('0x12'))(_0x09bc('0x13'));var utils=require(_0x09bc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x09bc('0x15'));var db=require(_0x09bc('0x16'))['db'];config[_0x09bc('0x17')]=_[_0x09bc('0x18')](config[_0x09bc('0x17')],{'host':_0x09bc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x09bc('0x17')]));require(_0x09bc('0x1a'))['register'](socket);var jayson=require(_0x09bc('0x1b'));var client=jayson[_0x09bc('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x395eb8,_0x1d2345,_0x2ab1b6,_0x566155){return new BPromise(function(_0x350484,_0x38142c){var _0x46a927=_0x566155||client;return _0x46a927[_0x09bc('0x1d')](_0x395eb8,_0x2ab1b6)[_0x09bc('0x1e')](function(_0x44c278){logger['info']('User,\x20%s,\x20%s',_0x1d2345,_0x09bc('0x1f'));logger['debug'](_0x09bc('0x20'),_0x1d2345,'request\x20sent',JSON['stringify'](_0x44c278));if(_0x44c278[_0x09bc('0x21')]){if(_0x44c278[_0x09bc('0x21')][_0x09bc('0x22')]===0x1f4){logger[_0x09bc('0x21')](_0x09bc('0x23'),_0x1d2345,_0x44c278['error'][_0x09bc('0x24')]);return _0x38142c(_0x44c278['error'][_0x09bc('0x24')]);}logger['error'](_0x09bc('0x23'),_0x1d2345,_0x44c278[_0x09bc('0x21')][_0x09bc('0x24')]);return _0x350484(_0x44c278[_0x09bc('0x21')][_0x09bc('0x24')]);}else{logger[_0x09bc('0x25')]('User,\x20%s,\x20%s',_0x1d2345,_0x09bc('0x1f'));_0x350484(_0x44c278[_0x09bc('0x26')]['message']);}})[_0x09bc('0x27')](function(_0x2f9421){logger[_0x09bc('0x21')](_0x09bc('0x23'),_0x1d2345,_0x2f9421);_0x38142c(_0x2f9421);});});}function respondWithStatusCode(_0x3cb717,_0x353ac8){_0x353ac8=_0x353ac8||0xcc;return function(_0x1d29b6){if(_0x1d29b6){return _0x3cb717[_0x09bc('0x28')](_0x353ac8);}return _0x3cb717[_0x09bc('0x29')](_0x353ac8)['end']();};}function respondWithResult(_0x107458,_0x1f0e5d){_0x1f0e5d=_0x1f0e5d||0xc8;return function(_0x3a3ee4){if(_0x3a3ee4){return _0x107458[_0x09bc('0x29')](_0x1f0e5d)['json'](_0x3a3ee4);}};}function respondWithFilteredResult(_0x346bc5,_0x4312e5){return function(_0x1bd0dd){if(_0x1bd0dd){var _0x3dd664=typeof _0x4312e5[_0x09bc('0x2a')]===_0x09bc('0x2b')&&typeof _0x4312e5['limit']===_0x09bc('0x2b');var _0x19c4d6=_0x1bd0dd[_0x09bc('0x2c')];var _0x4b1b0a=_0x3dd664?0x0:_0x4312e5['offset'];var _0x1625f5=_0x3dd664?_0x1bd0dd['count']:_0x4312e5[_0x09bc('0x2a')]+_0x4312e5[_0x09bc('0x2d')];var _0x5c329f;if(_0x1625f5>=_0x19c4d6){_0x1625f5=_0x19c4d6;_0x5c329f=0xc8;}else{_0x5c329f=0xce;}_0x346bc5[_0x09bc('0x29')](_0x5c329f);return _0x346bc5[_0x09bc('0x2e')]('Content-Range',_0x4b1b0a+'-'+_0x1625f5+'/'+_0x19c4d6)[_0x09bc('0x2f')](_0x1bd0dd);}return null;};}function patchUpdates(_0x5c8607){return function(_0x39b398){try{jsonpatch[_0x09bc('0x30')](_0x39b398,_0x5c8607,!![]);}catch(_0x2f0ec4){return BPromise[_0x09bc('0x31')](_0x2f0ec4);}return _0x39b398[_0x09bc('0x32')]();};}function saveUpdates(_0x3b8cc1,_0x4343d1){return function(_0x26acab){if(_0x26acab){return _0x26acab[_0x09bc('0x33')](_0x3b8cc1)['then'](function(_0x28e9f5){return _0x28e9f5;});}return null;};}function removeEntity(_0x11e309,_0x35eb37){return function(_0x1cc720){if(_0x1cc720){return _0x1cc720['destroy']()[_0x09bc('0x1e')](function(){var _0x41cce3=_0x1cc720[_0x09bc('0x34')]({'plain':!![]});if(_0x41cce3[_0x09bc('0x35')]===_0x09bc('0x36'))return;var _0x4e72de=[{'name':_0x09bc('0x37'),'value':_0x09bc('0x38'),'ignore':!![]},{'name':'Agents','value':_0x09bc('0x39'),'ignore':![]},{'name':_0x09bc('0x3a'),'value':'telephone','ignore':![]}];var _0x4a37e3=_(_0x4e72de)['filter'](_0x09bc('0x3b'))[_0x09bc('0x3c')](_0x09bc('0x3d'))[_0x09bc('0x3d')]();if(_['includes'](_0x4a37e3,_0x41cce3[_0x09bc('0x35')])){return;}var _0x793acc=_[_0x09bc('0x3e')](_0x4e72de,[_0x09bc('0x3d'),_0x41cce3['role']])[_0x09bc('0x3f')];return db[_0x09bc('0x40')]['destroy']({'where':{'type':_0x793acc,'resourceId':_0x41cce3['id']}})['then'](function(){return _0x1cc720;});})['then'](function(){_0x11e309['status'](0xcc)[_0x09bc('0x41')]();});}};}function handleEntityNotFound(_0x346740,_0x3e0b22){return function(_0x46bf29){if(!_0x46bf29){_0x346740['sendStatus'](0x194);}return _0x46bf29;};}function handleError(_0x553126,_0x2a882c){_0x2a882c=_0x2a882c||0x1f4;return function(_0x16bc3c){logger[_0x09bc('0x21')](_0x16bc3c['stack']);if(_0x16bc3c['name']){delete _0x16bc3c[_0x09bc('0x3f')];}_0x553126[_0x09bc('0x29')](_0x2a882c)[_0x09bc('0x42')](_0x16bc3c);};}exports[_0x09bc('0x43')]=function(_0x2cb29e,_0x430740){var _0x47b5a3={},_0x3bf4c5={},_0x2bc8b5={'count':0x0,'rows':[]};var _0x53764f=_[_0x09bc('0x3c')](db[_0x09bc('0x44')][_0x09bc('0x45')],function(_0x421d89){return{'name':_0x421d89[_0x09bc('0x46')],'type':_0x421d89[_0x09bc('0x47')][_0x09bc('0x48')]};});_0x3bf4c5[_0x09bc('0x49')]=_['differenceBy'](_[_0x09bc('0x3c')](_0x53764f,_0x09bc('0x3f')),['password',_0x09bc('0x4a')]);_0x3bf4c5[_0x09bc('0x4b')]=_['keys'](_0x2cb29e[_0x09bc('0x4b')]);_0x3bf4c5[_0x09bc('0x4c')]=_[_0x09bc('0x4d')](_0x3bf4c5['model'],_0x3bf4c5['query']);_0x47b5a3[_0x09bc('0x4e')]=_[_0x09bc('0x4d')](_0x3bf4c5[_0x09bc('0x49')],qs[_0x09bc('0x4f')](_0x2cb29e['query'][_0x09bc('0x4f')]));_0x47b5a3['attributes']=_0x47b5a3['attributes'][_0x09bc('0x50')]?_0x47b5a3['attributes']:_0x3bf4c5[_0x09bc('0x49')];if(!_0x2cb29e[_0x09bc('0x4b')]['hasOwnProperty'](_0x09bc('0x51'))){_0x47b5a3[_0x09bc('0x2d')]=qs[_0x09bc('0x2d')](_0x2cb29e['query'][_0x09bc('0x2d')]);_0x47b5a3['offset']=qs[_0x09bc('0x2a')](_0x2cb29e[_0x09bc('0x4b')][_0x09bc('0x2a')]);}_0x47b5a3[_0x09bc('0x52')]=qs[_0x09bc('0x53')](_0x2cb29e['query'][_0x09bc('0x53')]);_0x47b5a3[_0x09bc('0x54')]=qs[_0x09bc('0x4c')](_[_0x09bc('0x55')](_0x2cb29e['query'],_0x3bf4c5[_0x09bc('0x4c')]),_0x53764f);if(_0x2cb29e[_0x09bc('0x4b')]['filter']){_0x47b5a3[_0x09bc('0x54')]=_['merge'](_0x47b5a3[_0x09bc('0x54')],{'$or':_[_0x09bc('0x3c')](_0x53764f,function(_0x2dda33){if(_0x2dda33['type']!==_0x09bc('0x56')){return db[_0x09bc('0x57')][_0x09bc('0x54')](db[_0x09bc('0x57')]['fn'](_0x09bc('0x58'),db[_0x09bc('0x57')][_0x09bc('0x59')](_0x2dda33['name'])),{'$like':db[_0x09bc('0x57')]['fn'](_0x09bc('0x58'),'%'+_0x2cb29e['query'][_0x09bc('0x5a')]+'%')});}})});}_0x47b5a3=_['merge']({},_0x47b5a3,_0x2cb29e['options']);var _0x589a3d={'where':_0x47b5a3['where']};return db['User'][_0x09bc('0x2c')](_0x589a3d)[_0x09bc('0x1e')](function(_0x5a8f48){_0x2bc8b5[_0x09bc('0x2c')]=_0x5a8f48;if(_0x2cb29e[_0x09bc('0x4b')][_0x09bc('0x5b')]){_0x47b5a3[_0x09bc('0x5c')]=[{'all':!![]}];}if(!_[_0x09bc('0x5d')](_0x47b5a3[_0x09bc('0x4e')],'id')){_0x47b5a3['attributes'][_0x09bc('0x5e')]('id');}return db[_0x09bc('0x44')]['findAll'](_0x47b5a3);})[_0x09bc('0x1e')](function(_0x3dc21b){_0x2bc8b5[_0x09bc('0x5f')]=_0x3dc21b;if(_0x2cb29e[_0x09bc('0x4b')][_0x09bc('0x60')]===_0x09bc('0x61')){var _0x38e284=[];for(var _0x1c1066=0x0;_0x1c1066<_0x2bc8b5[_0x09bc('0x5f')][_0x09bc('0x50')];_0x1c1066++){_0x38e284[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x62'),_0x2bc8b5['rows'][_0x1c1066][_0x09bc('0x63')]));_0x38e284[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x64'),_0x2bc8b5['rows'][_0x1c1066][_0x09bc('0x63')]));_0x38e284[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x65'),_0x2bc8b5[_0x09bc('0x5f')][_0x1c1066]['dataValues']));_0x38e284['push'](get_open_tabs(_0x09bc('0x66'),_0x2bc8b5[_0x09bc('0x5f')][_0x1c1066][_0x09bc('0x63')]));_0x38e284[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x67'),_0x2bc8b5[_0x09bc('0x5f')][_0x1c1066][_0x09bc('0x63')]));_0x38e284[_0x09bc('0x5e')](get_open_tabs('whatsapp',_0x2bc8b5[_0x09bc('0x5f')][_0x1c1066]['dataValues']));}return BPromise[_0x09bc('0x68')](_0x38e284)[_0x09bc('0x1e')](function(_0xeead75){return _0x2bc8b5;});}else{return _0x2bc8b5;}})[_0x09bc('0x1e')](respondWithFilteredResult(_0x430740,_0x47b5a3))['catch'](handleError(_0x430740,null));};exports[_0x09bc('0x69')]=function(_0xd674bc,_0x27e9ae){var _0x509eaa={'raw':![],'where':{'id':_0xd674bc[_0x09bc('0x6a')]['id']}},_0x671e81={};_0x671e81['model']=_['differenceBy'](_['keys'](db[_0x09bc('0x44')][_0x09bc('0x45')]),[_0x09bc('0x6b'),_0x09bc('0x4a')]);_0x671e81[_0x09bc('0x4b')]=_[_0x09bc('0x6c')](_0xd674bc[_0x09bc('0x4b')]);_0x671e81['filters']=_['intersection'](_0x671e81[_0x09bc('0x49')],_0x671e81[_0x09bc('0x4b')]);_0x509eaa[_0x09bc('0x4e')]=_[_0x09bc('0x4d')](_0x671e81['model'],qs[_0x09bc('0x4f')](_0xd674bc['query'][_0x09bc('0x4f')]));_0x509eaa[_0x09bc('0x4e')]=_0x509eaa['attributes']['length']?_0x509eaa[_0x09bc('0x4e')]:_0x671e81[_0x09bc('0x49')];if(_0xd674bc[_0x09bc('0x4b')]['includeAll']){_0x509eaa[_0x09bc('0x5c')]=[{'all':!![]}];}_0x509eaa=_['merge']({},_0x509eaa,_0xd674bc['options']);if(!_[_0x09bc('0x5d')](_0x509eaa[_0x09bc('0x4e')],'id')){_0x509eaa['attributes'][_0x09bc('0x5e')]('id');}return db['User']['find'](_0x509eaa)[_0x09bc('0x1e')](handleEntityNotFound(_0x27e9ae,null))[_0x09bc('0x1e')](function(_0x5e14f0){var _0x216bae=[];values=_0x5e14f0;if(_0xd674bc[_0x09bc('0x4b')][_0x09bc('0x60')]===_0x09bc('0x61')){_0x216bae[_0x09bc('0x5e')](get_open_tabs('chat',_0x5e14f0[_0x09bc('0x63')]));_0x216bae[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x64'),_0x5e14f0[_0x09bc('0x63')]));_0x216bae[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x67'),_0x5e14f0[_0x09bc('0x63')]));_0x216bae[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x6d'),_0x5e14f0['dataValues']));_0x216bae[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x65'),_0x5e14f0[_0x09bc('0x63')]));_0x216bae[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x66'),_0x5e14f0[_0x09bc('0x63')]));return BPromise[_0x09bc('0x68')](_0x216bae);}else{return values;}})[_0x09bc('0x1e')](function(_0x49ee1d){return values;})[_0x09bc('0x1e')](respondWithResult(_0x27e9ae,null))[_0x09bc('0x27')](handleError(_0x27e9ae,null));};exports['update']=function(_0x8b23e0,_0x3b0434){if(_0x8b23e0[_0x09bc('0x6e')]['id']){delete _0x8b23e0[_0x09bc('0x6e')]['id'];}delete _0x8b23e0[_0x09bc('0x6e')]['role'];return db['User'][_0x09bc('0x3e')]({'where':{'id':_0x8b23e0[_0x09bc('0x6a')]['id']}})['then'](handleEntityNotFound(_0x3b0434,null))['then'](saveUpdates(_0x8b23e0[_0x09bc('0x6e')],null))[_0x09bc('0x1e')](respondWithResult(_0x3b0434,null))[_0x09bc('0x27')](handleError(_0x3b0434,null));};exports[_0x09bc('0x6f')]=function(_0x4e5e48,_0x3ca86d){return db['User'][_0x09bc('0x6f')]()[_0x09bc('0x1e')](respondWithResult(_0x3ca86d,null))['catch'](handleError(_0x3ca86d,null));};exports[_0x09bc('0x70')]=function(_0xfeb9f9,_0x421920,_0xd954e){return db['User'][_0x09bc('0x3e')]({'where':{'id':_0xfeb9f9[_0x09bc('0x6a')]['id']}})[_0x09bc('0x1e')](handleEntityNotFound(_0x421920,null))[_0x09bc('0x1e')](function(_0x42b818){if(_0x42b818){return _0x42b818[_0x09bc('0x70')](_0xfeb9f9[_0x09bc('0x6e')][_0x09bc('0x71')],_['omit'](_0xfeb9f9[_0x09bc('0x6e')],[_0x09bc('0x71'),'id'])||{});}})['then'](respondWithResult(_0x421920,null))[_0x09bc('0x27')](handleError(_0x421920,null));};function validateUser(_0x2bd66e){return new BPromise(function(_0x58c0b4,_0x18f785){if(_0x2bd66e['internal'])return _0x58c0b4(_0x2bd66e);return db[_0x09bc('0x72')][_0x09bc('0x73')](0x1)['then'](function(_0x2204ad){if(_0x2204ad[_0x09bc('0x74')])authService[_0x09bc('0x75')](_0x2bd66e[_0x09bc('0x6b')]);db[_0x09bc('0x44')]['max'](_0x09bc('0x76'))[_0x09bc('0x1e')](function(_0x4bc3fb){if(_[_0x09bc('0x77')](_0x4bc3fb)){_0x2bd66e[_0x09bc('0x76')]=_0x2204ad[_0x09bc('0x78')]||0x1;return;}if(_[_0x09bc('0x77')](_0x2204ad[_0x09bc('0x78')])||_0x2204ad['min_internal']===_0x4bc3fb){_0x2bd66e[_0x09bc('0x76')]=_0x4bc3fb+0x1;return;}if(_0x2204ad['min_internal']>_0x4bc3fb){_0x2bd66e['internal']=_0x2204ad['min_internal'];return;}return db[_0x09bc('0x57')][_0x09bc('0x4b')](_0x09bc('0x79'),{'type':db['sequelize'][_0x09bc('0x7a')][_0x09bc('0x7b')]})[_0x09bc('0x1e')](function(_0x5c1961){if(_0x5c1961&&_0x5c1961[_0x09bc('0x50')]){for(var _0x1e5682=0x0,_0x5cadf3=_0x5c1961[_0x09bc('0x50')];_0x1e5682<_0x5cadf3&&_[_0x09bc('0x77')](_0x2bd66e[_0x09bc('0x76')]);_0x1e5682++){if(_0x2204ad[_0x09bc('0x78')]<=_0x5c1961[_0x1e5682][_0x09bc('0x7c')]){_0x2bd66e['internal']=_0x5c1961[_0x1e5682]['from'];}else if(_0x2204ad[_0x09bc('0x78')]>_0x5c1961[_0x1e5682][_0x09bc('0x7c')]&&_0x2204ad[_0x09bc('0x78')]<=_0x5c1961[_0x1e5682]['to']){_0x2bd66e[_0x09bc('0x76')]=_0x2204ad['min_internal'];}}}if(_[_0x09bc('0x77')](_0x2bd66e[_0x09bc('0x76')])){_0x2bd66e[_0x09bc('0x76')]=_0x4bc3fb+0x1;}return _0x58c0b4(_0x2bd66e);});});})[_0x09bc('0x27')](function(_0x533d5a){_0x18f785(_0x533d5a);});});}function updateUser(_0x3a3a36){return new BPromise(function(_0x3769db,_0x40d0ff){try{if(_0x3a3a36[_0x09bc('0x7d')]){_0x3a3a36[_0x09bc('0x7e')]=_0x3a3a36[_0x09bc('0x76')];_0x3a3a36['VoiceMail']={'mailbox':_0x3a3a36[_0x09bc('0x76')],'password':_0x3a3a36['password'],'fullname':_0x3a3a36[_0x09bc('0x7f')],'email':_0x3a3a36[_0x09bc('0x80')]};}if(_0x3a3a36['role']===_0x09bc('0x39')){if(!_0x3a3a36[_0x09bc('0x81')])_0x3a3a36['permissions']=[_0x09bc('0x82'),_0x09bc('0x83'),_0x09bc('0x84'),_0x09bc('0x85'),'110',_0x09bc('0x86'),_0x09bc('0x87'),'106',_0x09bc('0x88'),_0x09bc('0x89'),_0x09bc('0x8a'),_0x09bc('0x8b'),_0x09bc('0x8c'),'114',_0x09bc('0x8d')];}_0x3769db(_0x3a3a36);}catch(_0x9922af){_0x40d0ff(_0x9922af);}});}exports['create']=function(_0x1abc9a,_0x391137){if(_0x1abc9a[_0x09bc('0x38')][_0x09bc('0x35')]==='agent')throw new Error('Unauthorized');if(_0x1abc9a[_0x09bc('0x6e')][_0x09bc('0x35')]===_0x09bc('0x38')&&_0x1abc9a[_0x09bc('0x38')][_0x09bc('0x35')]!==_0x09bc('0x36')){throw new Error(_0x09bc('0x8e'));}if(_0x1abc9a['body'][_0x09bc('0x35')]===_0x09bc('0x36')&&_0x1abc9a['user']['role']!==_0x09bc('0x36')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x09bc('0x8f')]([_0x1abc9a[_0x09bc('0x6e')]])['then'](function(){return validateUser(_0x1abc9a[_0x09bc('0x6e')]);})[_0x09bc('0x1e')](function(_0x31f0c9){return updateUser(_0x31f0c9)[_0x09bc('0x1e')](function(_0x4738f0){if(_0x4738f0[_0x09bc('0x35')]===_0x09bc('0x36')){_0x4738f0['settingsEnabled']=_0x1abc9a[_0x09bc('0x38')]['settingsEnabled'];delete _0x4738f0[_0x09bc('0x90')];}return _0x4738f0;});})[_0x09bc('0x1e')](function(_0x14f831){return db[_0x09bc('0x44')][_0x09bc('0x91')](_0x14f831,{'include':[{'model':db[_0x09bc('0x92')],'as':'VoiceMail'}]});})['then'](function(_0x4701f1){if(_0x1abc9a[_0x09bc('0x6e')][_0x09bc('0x35')]==='user')return _0x4701f1;if(_0x1abc9a[_0x09bc('0x38')][_0x09bc('0x35')]!=='user')return _0x4701f1;return db[_0x09bc('0x93')][_0x09bc('0x3e')]({'where':{'name':_0x4701f1[_0x09bc('0x35')]===_0x09bc('0x39')?_0x09bc('0x94'):_0x09bc('0x3a'),'userProfileId':_0x1abc9a['user'][_0x09bc('0x90')]},'raw':!![]})[_0x09bc('0x1e')](function(_0x3c1022){if(!_0x3c1022||_0x3c1022['autoAssociation']!=0x0)return _0x4701f1;return db[_0x09bc('0x40')]['create']({'name':_0x4701f1['name'],'resourceId':_0x4701f1['id'],'type':_0x3c1022[_0x09bc('0x3f')],'sectionId':_0x3c1022['id']},{})[_0x09bc('0x1e')](function(){return _0x4701f1;});})['catch'](function(_0x2f6218){logger['error'](_0x09bc('0x95'),_0x2f6218);throw _0x2f6218;});})['then'](respondWithResult(_0x391137,0xc9))['catch'](handleError(_0x391137,null));};exports[_0x09bc('0x96')]=function(_0x1f22b2,_0x23da15){var _0x4abf35=_0x1f22b2[_0x09bc('0x6e')];var _0x5def98=[];if(_0x1f22b2[_0x09bc('0x38')][_0x09bc('0x35')]===_0x09bc('0x39'))throw new Error(_0x09bc('0x97'));if(_[_0x09bc('0x98')](_0x4abf35,[_0x09bc('0x35'),'user'])&&_0x1f22b2['user']['role']!==_0x09bc('0x36')){throw new Error(_0x09bc('0x8e'));}if(_[_0x09bc('0x98')](_0x4abf35,[_0x09bc('0x35'),_0x09bc('0x36')])&&_0x1f22b2[_0x09bc('0x38')]['role']!==_0x09bc('0x36')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x09bc('0x8f')](_0x4abf35)[_0x09bc('0x1e')](function(){return validateUser(_0x4abf35[0x0]);})['then'](function(){for(var _0x848954=0x1;_0x848954<_0x4abf35['length'];_0x848954++){var _0x490bf2=_0x4abf35[_0x848954-0x1][_0x09bc('0x76')];if(!_0x4abf35[_0x848954][_0x09bc('0x76')])_0x4abf35[_0x848954][_0x09bc('0x76')]=_0x490bf2+0x1;_0x5def98['push'](validateUser(_0x4abf35[_0x848954]));}return BPromise['all'](_0x5def98);})[_0x09bc('0x1e')](function(){_0x5def98=[];for(var _0x367e1e=0x0;_0x367e1e<_0x4abf35[_0x09bc('0x50')];_0x367e1e++){_0x5def98[_0x09bc('0x5e')](updateUser(_0x4abf35[_0x367e1e]));}return BPromise[_0x09bc('0x68')](_0x5def98);})[_0x09bc('0x1e')](function(){return BPromise[_0x09bc('0x99')](_0x4abf35,function(_0xbd142d){return db['User'][_0x09bc('0x91')](_0xbd142d,{'include':[{'model':db[_0x09bc('0x92')],'as':_0x09bc('0x92')}]})['then'](function(_0x4a7964){_0xbd142d['id']=_0x4a7964['id'];return _0xbd142d;});});})[_0x09bc('0x1e')](function(_0x4dc0eb){if(_0x1f22b2[_0x09bc('0x6e')]['role']===_0x09bc('0x38'))return _0x4dc0eb;if(_0x1f22b2['user'][_0x09bc('0x35')]!=='user')return _0x4dc0eb;var _0x86b439=_[_0x09bc('0x98')](_0x4dc0eb,function(_0x2bd0e9){return _0x2bd0e9[_0x09bc('0x35')]===_0x09bc('0x39')||_0x2bd0e9[_0x09bc('0x35')]==='telephone';});if(!_0x86b439)return _0x4dc0eb;return db[_0x09bc('0x93')][_0x09bc('0x9a')]({'where':{'name':{'$or':[_0x09bc('0x94'),_0x09bc('0x3a')]},'userProfileId':_0x1f22b2[_0x09bc('0x38')][_0x09bc('0x90')]},'raw':!![]})[_0x09bc('0x1e')](function(_0xc16b1d){if(_[_0x09bc('0x9b')](_0xc16b1d)||!_[_0x09bc('0x98')](_0xc16b1d,[_0x09bc('0x9c'),0x0]))return _0x4dc0eb;_0x5def98=[];var _0xa1374d=_(_0xc16b1d)[_0x09bc('0x3c')](function(_0x56a54a){if(_0x56a54a[_0x09bc('0x9c')]===0x1)return;return _0x56a54a[_0x09bc('0x3f')]===_0x09bc('0x94')?_0x09bc('0x39'):_0x09bc('0x9d');})[_0x09bc('0x9e')]()[_0x09bc('0x3d')]();for(var _0x4bef61=0x0;_0x4bef61<_0x4dc0eb[_0x09bc('0x50')];_0x4bef61++){if(!_[_0x09bc('0x5d')](_0xa1374d,_0x4dc0eb[_0x4bef61][_0x09bc('0x35')]))return;var _0x23be9d=_0x4dc0eb[_0x4bef61][_0x09bc('0x35')]===_0x09bc('0x39')?'Agents':_0x09bc('0x3a');_0x5def98['push'](db['UserProfileResource']['create']({'name':_0x4dc0eb[_0x4bef61]['name'],'resourceId':_0x4dc0eb[_0x4bef61]['id'],'type':_0x23be9d,'sectionId':_[_0x09bc('0x3e')](_0xc16b1d,[_0x09bc('0x3f'),_0x23be9d])['id']},{}));}return BPromise[_0x09bc('0x68')](_0x5def98);});})[_0x09bc('0x1e')](respondWithResult(_0x23da15,0xc9))['catch'](handleError(_0x23da15,null));};exports[_0x09bc('0x9f')]=function(_0x5575fb,_0x1d212f,_0x8353d){if(_0x5575fb[_0x09bc('0x6e')]['id']){delete _0x5575fb['body']['id'];}return db[_0x09bc('0x44')]['find']({'where':{'id':_0x5575fb['params']['id']}})[_0x09bc('0x1e')](function(_0x7f5726){if(!_0x7f5726)return null;if(_0x7f5726['id']===_0x5575fb[_0x09bc('0x38')]['id']){if(!_0x5575fb[_0x09bc('0x6e')]['oldPassword']||!_0x5575fb['body'][_0x09bc('0xa0')]){throw new db[(_0x09bc('0xa1'))][(_0x09bc('0xa2'))](_0x09bc('0xa3'));}if(!_0x7f5726['authenticate'](_0x5575fb[_0x09bc('0x6e')][_0x09bc('0xa4')])){throw new db[(_0x09bc('0xa1'))]['ValidationError']('Wrong\x20credentials');}if(_0x5575fb[_0x09bc('0x6e')][_0x09bc('0xa4')]===_0x5575fb[_0x09bc('0x6e')][_0x09bc('0xa0')]){throw new db[(_0x09bc('0xa1'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5575fb[_0x09bc('0x38')][_0x09bc('0x35')]==='admin'){if(!_0x5575fb[_0x09bc('0x6e')][_0x09bc('0xa0')]){throw new db[(_0x09bc('0xa1'))][(_0x09bc('0xa2'))](_0x09bc('0xa5'));}}else if(_0x5575fb[_0x09bc('0x38')][_0x09bc('0x35')]===_0x09bc('0x38')){if(!_0x5575fb[_0x09bc('0x6e')][_0x09bc('0xa0')]){throw new db[(_0x09bc('0xa1'))][(_0x09bc('0xa2'))](_0x09bc('0xa5'));}if(_0x7f5726[_0x09bc('0x35')]!=='agent'){throw new db[(_0x09bc('0xa1'))][(_0x09bc('0xa2'))](_0x09bc('0x97'));}}else{throw new db[(_0x09bc('0xa1'))]['ValidationError'](_0x09bc('0x97'));}return _0x7f5726;})[_0x09bc('0x1e')](handleEntityNotFound(_0x1d212f,null))[_0x09bc('0x1e')](function(_0x193589){return db[_0x09bc('0x72')][_0x09bc('0xa6')]({'attributes':['id','securePassword',_0x09bc('0xa7'),_0x09bc('0xa8')]})[_0x09bc('0x1e')](function(_0x6eef10){if(_0x6eef10[_0x09bc('0x74')])authService[_0x09bc('0x75')](_0x5575fb[_0x09bc('0x6e')][_0x09bc('0xa0')]);if(!_0x6eef10['enforcePasswordHistory']||!_0x193589['previousPasswords'])return _0x193589;authService[_0x09bc('0xa9')](_0x5575fb[_0x09bc('0x6e')]['newPassword'],_0x193589[_0x09bc('0xaa')],_0x6eef10['passwordHistoryLimit']);return _0x193589;})[_0x09bc('0x1e')](saveUpdates({'password':_0x5575fb[_0x09bc('0x6e')]['newPassword'],'passwordResetAt':_0x5575fb[_0x09bc('0x38')]['id']==_0x5575fb[_0x09bc('0x6a')]['id']?moment():null,'previousPasswords':authService[_0x09bc('0xab')](_0x5575fb['body'][_0x09bc('0xa0')],_0x193589[_0x09bc('0xaa')])},null));})[_0x09bc('0x1e')](respondWithResult(_0x1d212f,null))[_0x09bc('0x27')](handleError(_0x1d212f,null));};exports[_0x09bc('0xac')]=function(_0x597c59,_0x49c6df,_0x472630){var _0x51a074=_0x597c59[_0x09bc('0x6e')][_0x09bc('0xad')];return db[_0x09bc('0x44')][_0x09bc('0x3e')]({'where':{'id':_0x597c59['params']['id']},'attributes':['id',_0x09bc('0x3f'),_0x09bc('0x35'),_0x09bc('0xae'),'loginInPause',_0x09bc('0xaf'),_0x09bc('0xb0')]})[_0x09bc('0x1e')](handleEntityNotFound(_0x49c6df,null))['then'](function(_0x97424a){if(_0x97424a){if(!utils[_0x09bc('0xb1')](_0x51a074)){throw new db[(_0x09bc('0xa1'))]['ValidationError'](_0x09bc('0xb2'));}return _0x97424a[_0x09bc('0xb3')+_[_0x09bc('0xb4')](_0x51a074[_0x09bc('0xb5')]())+_0x09bc('0xb6')](_0x597c59[_0x09bc('0x6e')][_0x09bc('0x71')],{'penalty':_0x597c59[_0x09bc('0x6e')][_0x09bc('0xb7')]||0x0})['spread'](function(_0x5caca1){for(var _0x3a858a=0x0;_0x3a858a<_0x597c59[_0x09bc('0x6e')][_0x09bc('0x71')][_0x09bc('0x50')];_0x3a858a+=0x1){var _0x54193d={'UserId':Number(_0x597c59['params']['id'])};_0x54193d[_[_0x09bc('0xb4')](_0x51a074['toLowerCase']())+_0x09bc('0xb8')]=Number(_0x597c59[_0x09bc('0x6e')][_0x09bc('0x71')][_0x3a858a]);socket['emit'](_0x09bc('0x38')+_[_0x09bc('0xb4')](_0x51a074['toLowerCase']())+_0x09bc('0xb9'),_0x54193d);}return _0x5caca1;})[_0x09bc('0x1e')](function(){if(_0x51a074===_0x09bc('0xba')){return db['VoiceQueue'][_0x09bc('0x9a')]({'where':{'id':_0x597c59[_0x09bc('0x6e')][_0x09bc('0x71')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x51f330){var _0x48332d=_0x97424a['get']({'plain':!![]});var _0x83c3b5=[];if(_0x51a074===_0x09bc('0xba')&&_0x48332d[_0x09bc('0x35')]===_0x09bc('0x39')&&_0x48332d[_0x09bc('0xae')]){for(var _0x15aabe=0x0;_0x15aabe<_0x51f330[_0x09bc('0x50')];_0x15aabe+=0x1){_0x83c3b5[_0x09bc('0x5e')]({'membername':_0x48332d[_0x09bc('0x3f')],'UserId':_0x48332d['id'],'queue_name':_0x51f330[_0x15aabe]['name'],'VoiceQueueId':_0x51f330[_0x15aabe]['id'],'interface':_[_0x09bc('0x77')](_0x48332d[_0x09bc('0xb0')])?util[_0x09bc('0xbb')]('SIP/%s',_0x48332d[_0x09bc('0x3f')]):_0x48332d[_0x09bc('0xb0')],'paused':_0x48332d['voicePause']||![],'penalty':_0x597c59[_0x09bc('0x6e')][_0x09bc('0xb7')]||0x0});}return BPromise['each'](_0x83c3b5,function(_0x26012b){return db[_0x09bc('0xbc')]['upsert'](_0x26012b);});}return _0x97424a;});}})[_0x09bc('0x1e')](respondWithStatusCode(_0x49c6df,null))['catch'](handleError(_0x49c6df,null));};exports[_0x09bc('0xbd')]=function(_0x2de0d2,_0x47e7a7,_0x51f239){var _0x4433ca;return db['User'][_0x09bc('0x3e')]({'where':{'id':_0x2de0d2[_0x09bc('0x6a')]['id']},'attributes':['id',_0x09bc('0x3f'),_0x09bc('0x35')]})[_0x09bc('0x1e')](handleEntityNotFound(_0x47e7a7,null))[_0x09bc('0x1e')](function(_0x16f16d){if(_0x16f16d){_0x4433ca=_0x16f16d;if(!_0x2de0d2[_0x09bc('0x4b')][_0x09bc('0xad')]||!utils[_0x09bc('0xb1')](_0x2de0d2[_0x09bc('0x4b')][_0x09bc('0xad')])){throw new db[(_0x09bc('0xa1'))]['ValidationError'](_0x09bc('0xb2'));}return _0x16f16d[_0x09bc('0xbe')+_['capitalize'](_0x2de0d2['query'][_0x09bc('0xad')][_0x09bc('0xb5')]())+'Queues'](_0x2de0d2['query']['ids']);}})[_0x09bc('0x1e')](function(_0x47f0c5){for(var _0x52930e=0x0;_0x52930e<_0x2de0d2[_0x09bc('0x4b')][_0x09bc('0x71')][_0x09bc('0x50')];_0x52930e+=0x1){var _0x383f7e={'UserId':Number(_0x2de0d2[_0x09bc('0x6a')]['id'])};_0x383f7e[_['capitalize'](_0x2de0d2[_0x09bc('0x4b')][_0x09bc('0xad')]['toLowerCase']())+'QueueId']=Number(_0x2de0d2[_0x09bc('0x4b')][_0x09bc('0x71')][_0x52930e]);socket[_0x09bc('0xbf')](_0x09bc('0x38')+_['capitalize'](_0x2de0d2['query'][_0x09bc('0xad')][_0x09bc('0xb5')]())+_0x09bc('0xc0'),_0x383f7e);}return _0x47f0c5;})['then'](function(){if(_0x2de0d2['query']['channel']===_0x09bc('0xba')){return db[_0x09bc('0xbc')]['destroy']({'where':{'UserId':_0x2de0d2['params']['id'],'VoiceQueueId':_0x2de0d2['query'][_0x09bc('0x71')]},'individualHooks':!![]})[_0x09bc('0x1e')](function(){return _0x4433ca;});}return _0x4433ca;})[_0x09bc('0x1e')](respondWithStatusCode(_0x47e7a7,null))[_0x09bc('0x27')](handleError(_0x47e7a7,null));};exports[_0x09bc('0xc1')]=function(_0x5bf62a,_0x4f09ef,_0xf79633){_0x5bf62a[_0x09bc('0x6e')][_0x09bc('0xc2')]=_0x5bf62a[_0x09bc('0xc3')]['filename'];return db[_0x09bc('0x44')][_0x09bc('0x3e')]({'where':{'id':_0x5bf62a[_0x09bc('0x6a')]['id']}})[_0x09bc('0x1e')](handleEntityNotFound(_0x4f09ef,null))[_0x09bc('0x1e')](saveUpdates(_0x5bf62a[_0x09bc('0x6e')],null))[_0x09bc('0x1e')](respondWithResult(_0x4f09ef,null))[_0x09bc('0x27')](handleError(_0x4f09ef,null));};exports[_0x09bc('0xc4')]=function(_0x2e64a2,_0xcdde51,_0x3be353){var _0x232dd7=path['join'](config[_0x09bc('0xc5')],_0x09bc('0xc6'));return db[_0x09bc('0x44')]['find']({'where':{'id':_0x2e64a2[_0x09bc('0x6a')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0xcdde51,null))[_0x09bc('0x1e')](function(_0x2b7a52){if(_0x2b7a52){if(_[_0x09bc('0x77')](_0x2b7a52[_0x09bc('0xc2')])){return _0xcdde51[_0x09bc('0xc7')](_0x232dd7);}else{if(!fs['existsSync'](path[_0x09bc('0xc8')](config[_0x09bc('0xc5')],_0x09bc('0xc9'),_0x2b7a52['userpic']))){return _0xcdde51[_0x09bc('0xc7')](_0x232dd7);}return _0xcdde51[_0x09bc('0xc7')](path[_0x09bc('0xc8')](config[_0x09bc('0xc5')],_0x09bc('0xc9'),_0x2b7a52[_0x09bc('0xc2')]));}}})[_0x09bc('0x27')](handleError(_0xcdde51,null));};exports[_0x09bc('0xca')]=function(_0x178a18,_0x557144,_0x440dad){return db[_0x09bc('0x44')][_0x09bc('0x3e')]({'where':{'id':_0x178a18[_0x09bc('0x6a')]['id']},'attributes':['id']})[_0x09bc('0x1e')](handleEntityNotFound(_0x557144,null))[_0x09bc('0x1e')](function(_0x314184){var _0x3abb8b=[];values=_0x314184[_0x09bc('0x63')];_0x3abb8b[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x62'),_0x314184[_0x09bc('0x63')]));_0x3abb8b[_0x09bc('0x5e')](get_open_tabs('sms',_0x314184[_0x09bc('0x63')]));_0x3abb8b['push'](get_open_tabs('openchannel',_0x314184[_0x09bc('0x63')]));_0x3abb8b[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x6d'),_0x314184['dataValues']));_0x3abb8b[_0x09bc('0x5e')](get_open_tabs(_0x09bc('0x65'),_0x314184[_0x09bc('0x63')]));_0x3abb8b['push'](get_open_tabs(_0x09bc('0x66'),_0x314184[_0x09bc('0x63')]));return BPromise[_0x09bc('0x68')](_0x3abb8b);})[_0x09bc('0x1e')](function(_0x14d9ec){var _0x24c000=[];if(_0x14d9ec){for(var _0xeedccf=0x0;_0xeedccf=_0x5b41d9){_0x5e6bd7=_0x5b41d9;_0x44a39d=0xc8;}else{_0x44a39d=0xce;}_0x3d51c6[_0xd5a6('0x24')](_0x44a39d);return _0x3d51c6['set'](_0xd5a6('0x2b'),_0x3e969d+'-'+_0x5e6bd7+'/'+_0x5b41d9)[_0xd5a6('0x26')](_0x4b0367);}return null;};}function patchUpdates(_0xdd2484){return function(_0x57448b){try{jsonpatch['apply'](_0x57448b,_0xdd2484,!![]);}catch(_0xad3c8d){return BPromise['reject'](_0xad3c8d);}return _0x57448b['save']();};}function saveUpdates(_0x353ccc,_0x47c5bf){return function(_0x485332){if(_0x485332){return _0x485332[_0xd5a6('0x2c')](_0x353ccc)[_0xd5a6('0x2d')](function(_0x33cfea){return _0x33cfea;});}return null;};}function removeEntity(_0xb63eb8,_0x18ba11){return function(_0x614cab){if(_0x614cab){return _0x614cab[_0xd5a6('0x2e')]()[_0xd5a6('0x2d')](function(){var _0xd37176=_0x614cab['get']({'plain':!![]});if(_0xd37176[_0xd5a6('0x2f')]===_0xd5a6('0x30'))return;var _0x393c7f=[{'name':_0xd5a6('0x31'),'value':_0xd5a6('0x32'),'ignore':!![]},{'name':_0xd5a6('0x33'),'value':_0xd5a6('0x34'),'ignore':![]},{'name':_0xd5a6('0x35'),'value':'telephone','ignore':![]}];var _0x4ee157=_(_0x393c7f)[_0xd5a6('0x36')](_0xd5a6('0x37'))[_0xd5a6('0x38')](_0xd5a6('0x39'))['value']();if(_[_0xd5a6('0x3a')](_0x4ee157,_0xd37176[_0xd5a6('0x2f')])){return;}var _0x16a3b0=_['find'](_0x393c7f,[_0xd5a6('0x39'),_0xd37176[_0xd5a6('0x2f')]])[_0xd5a6('0x3b')];return db[_0xd5a6('0x3c')][_0xd5a6('0x2e')]({'where':{'type':_0x16a3b0,'resourceId':_0xd37176['id']}})['then'](function(){return _0x614cab;});})[_0xd5a6('0x2d')](function(){_0xb63eb8[_0xd5a6('0x24')](0xcc)[_0xd5a6('0x25')]();});}};}function handleEntityNotFound(_0x186896,_0x2ef0ec){return function(_0x57d259){if(!_0x57d259){_0x186896['sendStatus'](0x194);}return _0x57d259;};}function handleError(_0x922e81,_0x405c7d){_0x405c7d=_0x405c7d||0x1f4;return function(_0x4dc26f){logger[_0xd5a6('0x20')](_0x4dc26f[_0xd5a6('0x3d')]);if(_0x4dc26f[_0xd5a6('0x3b')]){delete _0x4dc26f[_0xd5a6('0x3b')];}_0x922e81[_0xd5a6('0x24')](_0x405c7d)[_0xd5a6('0x3e')](_0x4dc26f);};}exports[_0xd5a6('0x3f')]=function(_0x2d83e1,_0x29c91f){var _0x49f5f2={},_0x5d186a={},_0x1937b7={'count':0x0,'rows':[]};var _0x4275ca=_['map'](db[_0xd5a6('0x40')][_0xd5a6('0x41')],function(_0x2ddc51){return{'name':_0x2ddc51[_0xd5a6('0x42')],'type':_0x2ddc51['type'][_0xd5a6('0x43')]};});_0x5d186a[_0xd5a6('0x44')]=_[_0xd5a6('0x45')](_[_0xd5a6('0x38')](_0x4275ca,_0xd5a6('0x3b')),[_0xd5a6('0x46'),_0xd5a6('0x47')]);_0x5d186a[_0xd5a6('0x48')]=_[_0xd5a6('0x49')](_0x2d83e1[_0xd5a6('0x48')]);_0x5d186a[_0xd5a6('0x4a')]=_[_0xd5a6('0x4b')](_0x5d186a[_0xd5a6('0x44')],_0x5d186a[_0xd5a6('0x48')]);_0x49f5f2['attributes']=_[_0xd5a6('0x4b')](_0x5d186a[_0xd5a6('0x44')],qs[_0xd5a6('0x4c')](_0x2d83e1[_0xd5a6('0x48')][_0xd5a6('0x4c')]));_0x49f5f2['attributes']=_0x49f5f2[_0xd5a6('0x4d')][_0xd5a6('0x4e')]?_0x49f5f2[_0xd5a6('0x4d')]:_0x5d186a['model'];if(!_0x2d83e1['query']['hasOwnProperty'](_0xd5a6('0x4f'))){_0x49f5f2['limit']=qs['limit'](_0x2d83e1['query'][_0xd5a6('0x2a')]);_0x49f5f2[_0xd5a6('0x27')]=qs[_0xd5a6('0x27')](_0x2d83e1[_0xd5a6('0x48')][_0xd5a6('0x27')]);}_0x49f5f2['order']=qs['sort'](_0x2d83e1[_0xd5a6('0x48')][_0xd5a6('0x50')]);_0x49f5f2[_0xd5a6('0x51')]=qs[_0xd5a6('0x4a')](_['pick'](_0x2d83e1[_0xd5a6('0x48')],_0x5d186a[_0xd5a6('0x4a')]),_0x4275ca);if(_0x2d83e1[_0xd5a6('0x48')][_0xd5a6('0x36')]){_0x49f5f2['where']=_['merge'](_0x49f5f2[_0xd5a6('0x51')],{'$or':_['map'](_0x4275ca,function(_0x33228f){if(_0x33228f[_0xd5a6('0x52')]!==_0xd5a6('0x53')){return db[_0xd5a6('0x54')][_0xd5a6('0x51')](db[_0xd5a6('0x54')]['fn']('lower',db[_0xd5a6('0x54')]['col'](_0x33228f[_0xd5a6('0x3b')])),{'$like':db[_0xd5a6('0x54')]['fn'](_0xd5a6('0x55'),'%'+_0x2d83e1[_0xd5a6('0x48')]['filter']+'%')});}})});}_0x49f5f2=_['merge']({},_0x49f5f2,_0x2d83e1[_0xd5a6('0x56')]);var _0x251b20={'where':_0x49f5f2[_0xd5a6('0x51')]};return db[_0xd5a6('0x40')][_0xd5a6('0x29')](_0x251b20)['then'](function(_0x424bbb){_0x1937b7['count']=_0x424bbb;if(_0x2d83e1['query']['includeAll']){_0x49f5f2[_0xd5a6('0x57')]=[{'all':!![]}];}if(!_[_0xd5a6('0x3a')](_0x49f5f2['attributes'],'id')){_0x49f5f2[_0xd5a6('0x4d')][_0xd5a6('0x58')]('id');}return db[_0xd5a6('0x40')][_0xd5a6('0x59')](_0x49f5f2);})['then'](function(_0x49e29a){_0x1937b7[_0xd5a6('0x5a')]=_0x49e29a;if(_0x2d83e1[_0xd5a6('0x48')][_0xd5a6('0x5b')]===_0xd5a6('0x5c')){var _0x37690a=[];for(var _0x1e8ceb=0x0;_0x1e8ceb<_0x1937b7[_0xd5a6('0x5a')]['length'];_0x1e8ceb++){_0x37690a['push'](get_open_tabs(_0xd5a6('0x5d'),_0x1937b7[_0xd5a6('0x5a')][_0x1e8ceb]['dataValues']));_0x37690a[_0xd5a6('0x58')](get_open_tabs('sms',_0x1937b7['rows'][_0x1e8ceb][_0xd5a6('0x5e')]));_0x37690a[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x5f'),_0x1937b7['rows'][_0x1e8ceb][_0xd5a6('0x5e')]));_0x37690a[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x60'),_0x1937b7[_0xd5a6('0x5a')][_0x1e8ceb]['dataValues']));_0x37690a[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x61'),_0x1937b7[_0xd5a6('0x5a')][_0x1e8ceb]['dataValues']));_0x37690a[_0xd5a6('0x58')](get_open_tabs('whatsapp',_0x1937b7[_0xd5a6('0x5a')][_0x1e8ceb][_0xd5a6('0x5e')]));}return BPromise[_0xd5a6('0x62')](_0x37690a)[_0xd5a6('0x2d')](function(_0x471329){return _0x1937b7;});}else{return _0x1937b7;}})['then'](respondWithFilteredResult(_0x29c91f,_0x49f5f2))[_0xd5a6('0x63')](handleError(_0x29c91f,null));};exports[_0xd5a6('0x64')]=function(_0x25733a,_0xbe58d4){var _0x1f9b41={'raw':![],'where':{'id':_0x25733a[_0xd5a6('0x65')]['id']}},_0x1a8b34={};_0x1a8b34[_0xd5a6('0x44')]=_[_0xd5a6('0x45')](_[_0xd5a6('0x49')](db['User']['rawAttributes']),[_0xd5a6('0x46'),_0xd5a6('0x47')]);_0x1a8b34[_0xd5a6('0x48')]=_[_0xd5a6('0x49')](_0x25733a['query']);_0x1a8b34['filters']=_['intersection'](_0x1a8b34[_0xd5a6('0x44')],_0x1a8b34['query']);_0x1f9b41[_0xd5a6('0x4d')]=_['intersection'](_0x1a8b34[_0xd5a6('0x44')],qs[_0xd5a6('0x4c')](_0x25733a['query'][_0xd5a6('0x4c')]));_0x1f9b41['attributes']=_0x1f9b41[_0xd5a6('0x4d')][_0xd5a6('0x4e')]?_0x1f9b41[_0xd5a6('0x4d')]:_0x1a8b34[_0xd5a6('0x44')];if(_0x25733a[_0xd5a6('0x48')]['includeAll']){_0x1f9b41[_0xd5a6('0x57')]=[{'all':!![]}];}_0x1f9b41=_[_0xd5a6('0x66')]({},_0x1f9b41,_0x25733a[_0xd5a6('0x56')]);if(!_['includes'](_0x1f9b41['attributes'],'id')){_0x1f9b41[_0xd5a6('0x4d')][_0xd5a6('0x58')]('id');}return db[_0xd5a6('0x40')][_0xd5a6('0x67')](_0x1f9b41)[_0xd5a6('0x2d')](handleEntityNotFound(_0xbe58d4,null))['then'](function(_0x46d3d0){var _0x250d57=[];values=_0x46d3d0;if(_0x25733a[_0xd5a6('0x48')][_0xd5a6('0x5b')]===_0xd5a6('0x5c')){_0x250d57[_0xd5a6('0x58')](get_open_tabs('chat',_0x46d3d0[_0xd5a6('0x5e')]));_0x250d57['push'](get_open_tabs(_0xd5a6('0x68'),_0x46d3d0['dataValues']));_0x250d57[_0xd5a6('0x58')](get_open_tabs('openchannel',_0x46d3d0[_0xd5a6('0x5e')]));_0x250d57[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x69'),_0x46d3d0[_0xd5a6('0x5e')]));_0x250d57[_0xd5a6('0x58')](get_open_tabs('fax',_0x46d3d0[_0xd5a6('0x5e')]));_0x250d57[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x60'),_0x46d3d0[_0xd5a6('0x5e')]));return BPromise[_0xd5a6('0x62')](_0x250d57);}else{return values;}})['then'](function(_0x1f4c15){return values;})[_0xd5a6('0x2d')](respondWithResult(_0xbe58d4,null))[_0xd5a6('0x63')](handleError(_0xbe58d4,null));};exports[_0xd5a6('0x2c')]=function(_0x314b63,_0x9bb5f9){if(_0x314b63[_0xd5a6('0x6a')]['id']){delete _0x314b63[_0xd5a6('0x6a')]['id'];}delete _0x314b63['body'][_0xd5a6('0x2f')];return db['User']['find']({'where':{'id':_0x314b63['params']['id']}})['then'](handleEntityNotFound(_0x9bb5f9,null))[_0xd5a6('0x2d')](saveUpdates(_0x314b63[_0xd5a6('0x6a')],null))['then'](respondWithResult(_0x9bb5f9,null))[_0xd5a6('0x63')](handleError(_0x9bb5f9,null));};exports['describe']=function(_0x291d04,_0x721a87){return db[_0xd5a6('0x40')][_0xd5a6('0x6b')]()['then'](respondWithResult(_0x721a87,null))['catch'](handleError(_0x721a87,null));};exports[_0xd5a6('0x6c')]=function(_0x450367,_0x406e54,_0xf7229f){return db[_0xd5a6('0x40')][_0xd5a6('0x67')]({'where':{'id':_0x450367[_0xd5a6('0x65')]['id']}})[_0xd5a6('0x2d')](handleEntityNotFound(_0x406e54,null))[_0xd5a6('0x2d')](function(_0x547ec9){if(_0x547ec9){return _0x547ec9['addContacts'](_0x450367['body'][_0xd5a6('0x6d')],_[_0xd5a6('0x6e')](_0x450367['body'],['ids','id'])||{});}})[_0xd5a6('0x2d')](respondWithResult(_0x406e54,null))['catch'](handleError(_0x406e54,null));};function validateUser(_0x25dc8e){return new BPromise(function(_0x56d397,_0x2554c9){if(_0x25dc8e['internal'])return _0x56d397(_0x25dc8e);return db[_0xd5a6('0x6f')]['findById'](0x1)[_0xd5a6('0x2d')](function(_0x4fe85b){if(_0x4fe85b[_0xd5a6('0x70')])authService[_0xd5a6('0x71')](_0x25dc8e[_0xd5a6('0x46')]);db['User']['max'](_0xd5a6('0x72'))[_0xd5a6('0x2d')](function(_0x4d5a1c){if(_['isNil'](_0x4d5a1c)){_0x25dc8e['internal']=_0x4fe85b[_0xd5a6('0x73')]||0x1;return;}if(_[_0xd5a6('0x74')](_0x4fe85b[_0xd5a6('0x73')])||_0x4fe85b['min_internal']===_0x4d5a1c){_0x25dc8e[_0xd5a6('0x72')]=_0x4d5a1c+0x1;return;}if(_0x4fe85b[_0xd5a6('0x73')]>_0x4d5a1c){_0x25dc8e['internal']=_0x4fe85b[_0xd5a6('0x73')];return;}return db['sequelize'][_0xd5a6('0x48')]('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[_0xd5a6('0x54')][_0xd5a6('0x75')][_0xd5a6('0x76')]})[_0xd5a6('0x2d')](function(_0x957a29){if(_0x957a29&&_0x957a29[_0xd5a6('0x4e')]){for(var _0x36fc1e=0x0,_0xdb89f4=_0x957a29['length'];_0x36fc1e<_0xdb89f4&&_[_0xd5a6('0x74')](_0x25dc8e['internal']);_0x36fc1e++){if(_0x4fe85b[_0xd5a6('0x73')]<=_0x957a29[_0x36fc1e][_0xd5a6('0x77')]){_0x25dc8e[_0xd5a6('0x72')]=_0x957a29[_0x36fc1e][_0xd5a6('0x77')];}else if(_0x4fe85b[_0xd5a6('0x73')]>_0x957a29[_0x36fc1e][_0xd5a6('0x77')]&&_0x4fe85b[_0xd5a6('0x73')]<=_0x957a29[_0x36fc1e]['to']){_0x25dc8e[_0xd5a6('0x72')]=_0x4fe85b['min_internal'];}}}if(_[_0xd5a6('0x74')](_0x25dc8e[_0xd5a6('0x72')])){_0x25dc8e['internal']=_0x4d5a1c+0x1;}return _0x56d397(_0x25dc8e);});});})['catch'](function(_0x392647){_0x2554c9(_0x392647);});});}function updateUser(_0x4a3df3){return new BPromise(function(_0xa96f13,_0x3c817b){try{if(_0x4a3df3[_0xd5a6('0x78')]){_0x4a3df3[_0xd5a6('0x79')]=_0x4a3df3[_0xd5a6('0x72')];_0x4a3df3['VoiceMail']={'mailbox':_0x4a3df3[_0xd5a6('0x72')],'password':_0x4a3df3[_0xd5a6('0x46')],'fullname':_0x4a3df3[_0xd5a6('0x7a')],'email':_0x4a3df3['email']};}if(_0x4a3df3[_0xd5a6('0x2f')]==='agent'){if(!_0x4a3df3[_0xd5a6('0x7b')])_0x4a3df3[_0xd5a6('0x7b')]=['101','102',_0xd5a6('0x7c'),_0xd5a6('0x7d'),_0xd5a6('0x7e'),_0xd5a6('0x7f'),_0xd5a6('0x80'),_0xd5a6('0x81'),'107',_0xd5a6('0x82'),_0xd5a6('0x83'),_0xd5a6('0x84'),_0xd5a6('0x85'),_0xd5a6('0x86'),_0xd5a6('0x87')];}_0xa96f13(_0x4a3df3);}catch(_0x3fe5c3){_0x3c817b(_0x3fe5c3);}});}exports['create']=function(_0x372376,_0x131bda){if(_0x372376[_0xd5a6('0x32')][_0xd5a6('0x2f')]==='agent')throw new Error('Unauthorized');if(_0x372376[_0xd5a6('0x6a')][_0xd5a6('0x2f')]===_0xd5a6('0x32')&&_0x372376[_0xd5a6('0x32')]['role']!==_0xd5a6('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x372376['body']['role']===_0xd5a6('0x30')&&_0x372376[_0xd5a6('0x32')]['role']!==_0xd5a6('0x30')){throw new Error(_0xd5a6('0x88'));}return licenseUtil['checkUserLimits']([_0x372376[_0xd5a6('0x6a')]])[_0xd5a6('0x2d')](function(){return validateUser(_0x372376[_0xd5a6('0x6a')]);})[_0xd5a6('0x2d')](function(_0x4e03ac){return updateUser(_0x4e03ac)[_0xd5a6('0x2d')](function(_0x3f2ad2){if(_0x3f2ad2[_0xd5a6('0x2f')]===_0xd5a6('0x30')){_0x3f2ad2['settingsEnabled']=_0x372376[_0xd5a6('0x32')][_0xd5a6('0x89')];delete _0x3f2ad2[_0xd5a6('0x8a')];}return _0x3f2ad2;});})[_0xd5a6('0x2d')](function(_0x17b258){return db['User']['create'](_0x17b258,{'include':[{'model':db['VoiceMail'],'as':_0xd5a6('0x8b')}]});})[_0xd5a6('0x2d')](function(_0x125f84){if(_0x372376[_0xd5a6('0x6a')][_0xd5a6('0x2f')]==='user')return _0x125f84;if(_0x372376['user'][_0xd5a6('0x2f')]!==_0xd5a6('0x32'))return _0x125f84;return db[_0xd5a6('0x8c')][_0xd5a6('0x67')]({'where':{'name':_0x125f84['role']===_0xd5a6('0x34')?_0xd5a6('0x33'):_0xd5a6('0x35'),'userProfileId':_0x372376[_0xd5a6('0x32')][_0xd5a6('0x8a')]},'raw':!![]})[_0xd5a6('0x2d')](function(_0x4ba9f8){if(!_0x4ba9f8||_0x4ba9f8[_0xd5a6('0x8d')]!=0x0)return _0x125f84;return db[_0xd5a6('0x3c')]['create']({'name':_0x125f84[_0xd5a6('0x3b')],'resourceId':_0x125f84['id'],'type':_0x4ba9f8[_0xd5a6('0x3b')],'sectionId':_0x4ba9f8['id']},{})[_0xd5a6('0x2d')](function(){return _0x125f84;});})['catch'](function(_0x502d58){logger[_0xd5a6('0x20')](_0xd5a6('0x8e'),_0x502d58);throw _0x502d58;});})[_0xd5a6('0x2d')](respondWithResult(_0x131bda,0xc9))[_0xd5a6('0x63')](handleError(_0x131bda,null));};exports[_0xd5a6('0x8f')]=function(_0x1a0bca,_0x5abecf){var _0x6ef917=_0x1a0bca[_0xd5a6('0x6a')];var _0x2e037f=[];if(_0x1a0bca[_0xd5a6('0x32')][_0xd5a6('0x2f')]==='agent')throw new Error('Unauthorized');if(_[_0xd5a6('0x90')](_0x6ef917,['role',_0xd5a6('0x32')])&&_0x1a0bca[_0xd5a6('0x32')][_0xd5a6('0x2f')]!==_0xd5a6('0x30')){throw new Error(_0xd5a6('0x91'));}if(_[_0xd5a6('0x90')](_0x6ef917,[_0xd5a6('0x2f'),_0xd5a6('0x30')])&&_0x1a0bca[_0xd5a6('0x32')][_0xd5a6('0x2f')]!==_0xd5a6('0x30')){throw new Error(_0xd5a6('0x92'));}return licenseUtil['checkUserLimits'](_0x6ef917)[_0xd5a6('0x2d')](function(){return validateUser(_0x6ef917[0x0]);})['then'](function(){for(var _0x55398b=0x1;_0x55398b<_0x6ef917[_0xd5a6('0x4e')];_0x55398b++){var _0x218f15=_0x6ef917[_0x55398b-0x1]['internal'];if(!_0x6ef917[_0x55398b][_0xd5a6('0x72')])_0x6ef917[_0x55398b][_0xd5a6('0x72')]=_0x218f15+0x1;_0x2e037f[_0xd5a6('0x58')](validateUser(_0x6ef917[_0x55398b]));}return BPromise['all'](_0x2e037f);})[_0xd5a6('0x2d')](function(){_0x2e037f=[];for(var _0x473c5b=0x0;_0x473c5b<_0x6ef917[_0xd5a6('0x4e')];_0x473c5b++){_0x2e037f[_0xd5a6('0x58')](updateUser(_0x6ef917[_0x473c5b]));}return BPromise[_0xd5a6('0x62')](_0x2e037f);})[_0xd5a6('0x2d')](function(){return BPromise[_0xd5a6('0x93')](_0x6ef917,function(_0x30a516){return db[_0xd5a6('0x40')]['create'](_0x30a516,{'include':[{'model':db['VoiceMail'],'as':_0xd5a6('0x8b')}]})[_0xd5a6('0x2d')](function(_0x5cbb7f){_0x30a516['id']=_0x5cbb7f['id'];return _0x30a516;});});})['then'](function(_0x426dba){if(_0x1a0bca[_0xd5a6('0x6a')][_0xd5a6('0x2f')]===_0xd5a6('0x32'))return _0x426dba;if(_0x1a0bca[_0xd5a6('0x32')][_0xd5a6('0x2f')]!==_0xd5a6('0x32'))return _0x426dba;var _0x3f11aa=_[_0xd5a6('0x90')](_0x426dba,function(_0x27ed36){return _0x27ed36[_0xd5a6('0x2f')]===_0xd5a6('0x34')||_0x27ed36['role']==='telephone';});if(!_0x3f11aa)return _0x426dba;return db[_0xd5a6('0x8c')][_0xd5a6('0x59')]({'where':{'name':{'$or':[_0xd5a6('0x33'),'Telephones']},'userProfileId':_0x1a0bca[_0xd5a6('0x32')]['userProfileId']},'raw':!![]})['then'](function(_0x525466){if(_[_0xd5a6('0x94')](_0x525466)||!_[_0xd5a6('0x90')](_0x525466,[_0xd5a6('0x8d'),0x0]))return _0x426dba;_0x2e037f=[];var _0x43b023=_(_0x525466)['map'](function(_0x5b510d){if(_0x5b510d[_0xd5a6('0x8d')]===0x1)return;return _0x5b510d['name']===_0xd5a6('0x33')?'agent':'telephone';})[_0xd5a6('0x95')]()[_0xd5a6('0x39')]();for(var _0x40722b=0x0;_0x40722b<_0x426dba['length'];_0x40722b++){if(!_[_0xd5a6('0x3a')](_0x43b023,_0x426dba[_0x40722b]['role']))return;var _0x500c61=_0x426dba[_0x40722b][_0xd5a6('0x2f')]===_0xd5a6('0x34')?_0xd5a6('0x33'):'Telephones';_0x2e037f[_0xd5a6('0x58')](db[_0xd5a6('0x3c')][_0xd5a6('0x96')]({'name':_0x426dba[_0x40722b][_0xd5a6('0x3b')],'resourceId':_0x426dba[_0x40722b]['id'],'type':_0x500c61,'sectionId':_[_0xd5a6('0x67')](_0x525466,['name',_0x500c61])['id']},{}));}return BPromise[_0xd5a6('0x62')](_0x2e037f);});})['then'](respondWithResult(_0x5abecf,0xc9))['catch'](handleError(_0x5abecf,null));};exports[_0xd5a6('0x97')]=function(_0x271f5c,_0x31e1e3,_0xf1f921){if(_0x271f5c['body']['id']){delete _0x271f5c[_0xd5a6('0x6a')]['id'];}return db['User']['find']({'where':{'id':_0x271f5c[_0xd5a6('0x65')]['id']}})[_0xd5a6('0x2d')](function(_0x55197d){if(!_0x55197d)return null;if(_0x55197d['id']===_0x271f5c[_0xd5a6('0x32')]['id']){if(!_0x271f5c[_0xd5a6('0x6a')]['oldPassword']||!_0x271f5c[_0xd5a6('0x6a')]['newPassword']){throw new db[(_0xd5a6('0x98'))][(_0xd5a6('0x99'))](_0xd5a6('0x9a'));}if(!_0x55197d[_0xd5a6('0x9b')](_0x271f5c[_0xd5a6('0x6a')][_0xd5a6('0x9c')])){throw new db[(_0xd5a6('0x98'))][(_0xd5a6('0x99'))](_0xd5a6('0x9d'));}if(_0x271f5c[_0xd5a6('0x6a')][_0xd5a6('0x9c')]===_0x271f5c[_0xd5a6('0x6a')][_0xd5a6('0x9e')]){throw new db[(_0xd5a6('0x98'))][(_0xd5a6('0x99'))](_0xd5a6('0x9f'));}}else if(_0x271f5c[_0xd5a6('0x32')]['role']===_0xd5a6('0x30')){if(!_0x271f5c[_0xd5a6('0x6a')]['newPassword']){throw new db[(_0xd5a6('0x98'))][(_0xd5a6('0x99'))](_0xd5a6('0xa0'));}}else if(_0x271f5c[_0xd5a6('0x32')][_0xd5a6('0x2f')]===_0xd5a6('0x32')){if(!_0x271f5c['body'][_0xd5a6('0x9e')]){throw new db[(_0xd5a6('0x98'))][(_0xd5a6('0x99'))](_0xd5a6('0xa0'));}if(_0x55197d[_0xd5a6('0x2f')]!==_0xd5a6('0x34')){throw new db['Sequelize']['ValidationError'](_0xd5a6('0xa1'));}}else{throw new db[(_0xd5a6('0x98'))][(_0xd5a6('0x99'))](_0xd5a6('0xa1'));}return _0x55197d;})[_0xd5a6('0x2d')](handleEntityNotFound(_0x31e1e3,null))[_0xd5a6('0x2d')](function(_0x3c59c3){return db[_0xd5a6('0x6f')][_0xd5a6('0xa2')]({'attributes':['id',_0xd5a6('0x70'),_0xd5a6('0xa3'),_0xd5a6('0xa4')]})['then'](function(_0x259371){if(_0x259371[_0xd5a6('0x70')])authService[_0xd5a6('0x71')](_0x271f5c['body'][_0xd5a6('0x9e')]);if(!_0x259371['enforcePasswordHistory']||!_0x3c59c3['previousPasswords'])return _0x3c59c3;authService[_0xd5a6('0xa5')](_0x271f5c[_0xd5a6('0x6a')][_0xd5a6('0x9e')],_0x3c59c3[_0xd5a6('0xa6')],_0x259371['passwordHistoryLimit']);return _0x3c59c3;})[_0xd5a6('0x2d')](saveUpdates({'password':_0x271f5c['body']['newPassword'],'passwordResetAt':_0x271f5c[_0xd5a6('0x32')]['id']==_0x271f5c[_0xd5a6('0x65')]['id']?moment():null,'previousPasswords':authService[_0xd5a6('0xa7')](_0x271f5c['body']['newPassword'],_0x3c59c3['previousPasswords'])},null));})['then'](respondWithResult(_0x31e1e3,null))[_0xd5a6('0x63')](handleError(_0x31e1e3,null));};exports[_0xd5a6('0xa8')]=function(_0x197a60,_0x5a9390,_0x19cd6d){var _0x4b930b=_0x197a60[_0xd5a6('0x6a')][_0xd5a6('0xa9')];return db['User']['find']({'where':{'id':_0x197a60[_0xd5a6('0x65')]['id']},'attributes':['id',_0xd5a6('0x3b'),_0xd5a6('0x2f'),_0xd5a6('0xaa'),'loginInPause','voicePause',_0xd5a6('0xab')]})[_0xd5a6('0x2d')](handleEntityNotFound(_0x5a9390,null))[_0xd5a6('0x2d')](function(_0x536730){if(_0x536730){if(!utils[_0xd5a6('0xac')](_0x4b930b)){throw new db['Sequelize'][(_0xd5a6('0x99'))](_0xd5a6('0xad'));}return _0x536730[_0xd5a6('0xae')+_['capitalize'](_0x4b930b[_0xd5a6('0xaf')]())+_0xd5a6('0xb0')](_0x197a60[_0xd5a6('0x6a')][_0xd5a6('0x6d')],{'penalty':_0x197a60[_0xd5a6('0x6a')][_0xd5a6('0xb1')]||0x0})[_0xd5a6('0xb2')](function(_0x48bd7d){for(var _0x159808=0x0;_0x159808<_0x197a60[_0xd5a6('0x6a')][_0xd5a6('0x6d')][_0xd5a6('0x4e')];_0x159808+=0x1){var _0x5e082e={'UserId':Number(_0x197a60[_0xd5a6('0x65')]['id'])};_0x5e082e[_['capitalize'](_0x4b930b['toLowerCase']())+_0xd5a6('0xb3')]=Number(_0x197a60[_0xd5a6('0x6a')][_0xd5a6('0x6d')][_0x159808]);socket[_0xd5a6('0xb4')](_0xd5a6('0x32')+_[_0xd5a6('0xb5')](_0x4b930b[_0xd5a6('0xaf')]())+'Queue:save',_0x5e082e);}return _0x48bd7d;})[_0xd5a6('0x2d')](function(){if(_0x4b930b===_0xd5a6('0xb6')){return db[_0xd5a6('0xb7')]['findAll']({'where':{'id':_0x197a60['body'][_0xd5a6('0x6d')]||[]},'raw':!![],'attributes':['id',_0xd5a6('0x3b')]});}})[_0xd5a6('0x2d')](function(_0x12f038){var _0x469c7a=_0x536730['get']({'plain':!![]});var _0x1b208b=[];if(_0x4b930b==='voice'&&_0x469c7a[_0xd5a6('0x2f')]===_0xd5a6('0x34')&&_0x469c7a['online']){for(var _0x69a268=0x0;_0x69a268<_0x12f038[_0xd5a6('0x4e')];_0x69a268+=0x1){_0x1b208b[_0xd5a6('0x58')]({'membername':_0x469c7a['name'],'UserId':_0x469c7a['id'],'queue_name':_0x12f038[_0x69a268][_0xd5a6('0x3b')],'VoiceQueueId':_0x12f038[_0x69a268]['id'],'interface':_[_0xd5a6('0x74')](_0x469c7a['interface'])?util[_0xd5a6('0xb8')](_0xd5a6('0xb9'),_0x469c7a['name']):_0x469c7a['interface'],'paused':_0x469c7a[_0xd5a6('0xba')]||![],'penalty':_0x197a60['body']['penalty']||0x0});}return BPromise['each'](_0x1b208b,function(_0x410f71){return db[_0xd5a6('0xbb')][_0xd5a6('0xbc')](_0x410f71);});}return _0x536730;});}})['then'](respondWithStatusCode(_0x5a9390,null))[_0xd5a6('0x63')](handleError(_0x5a9390,null));};exports[_0xd5a6('0xbd')]=function(_0x33547d,_0xe3709e,_0x1cb633){var _0x31c3aa;return db[_0xd5a6('0x40')][_0xd5a6('0x67')]({'where':{'id':_0x33547d[_0xd5a6('0x65')]['id']},'attributes':['id',_0xd5a6('0x3b'),_0xd5a6('0x2f')]})[_0xd5a6('0x2d')](handleEntityNotFound(_0xe3709e,null))['then'](function(_0x32edd5){if(_0x32edd5){_0x31c3aa=_0x32edd5;if(!_0x33547d[_0xd5a6('0x48')]['channel']||!utils[_0xd5a6('0xac')](_0x33547d[_0xd5a6('0x48')][_0xd5a6('0xa9')])){throw new db[(_0xd5a6('0x98'))][(_0xd5a6('0x99'))](_0xd5a6('0xad'));}return _0x32edd5['remove'+_[_0xd5a6('0xb5')](_0x33547d['query'][_0xd5a6('0xa9')][_0xd5a6('0xaf')]())+_0xd5a6('0xb0')](_0x33547d[_0xd5a6('0x48')][_0xd5a6('0x6d')]);}})[_0xd5a6('0x2d')](function(_0x348c49){for(var _0x4791e5=0x0;_0x4791e5<_0x33547d[_0xd5a6('0x48')][_0xd5a6('0x6d')][_0xd5a6('0x4e')];_0x4791e5+=0x1){var _0x16a658={'UserId':Number(_0x33547d[_0xd5a6('0x65')]['id'])};_0x16a658[_[_0xd5a6('0xb5')](_0x33547d['query'][_0xd5a6('0xa9')][_0xd5a6('0xaf')]())+'QueueId']=Number(_0x33547d[_0xd5a6('0x48')][_0xd5a6('0x6d')][_0x4791e5]);socket['emit'](_0xd5a6('0x32')+_[_0xd5a6('0xb5')](_0x33547d[_0xd5a6('0x48')][_0xd5a6('0xa9')][_0xd5a6('0xaf')]())+_0xd5a6('0xbe'),_0x16a658);}return _0x348c49;})[_0xd5a6('0x2d')](function(){if(_0x33547d[_0xd5a6('0x48')]['channel']===_0xd5a6('0xb6')){return db[_0xd5a6('0xbb')][_0xd5a6('0x2e')]({'where':{'UserId':_0x33547d[_0xd5a6('0x65')]['id'],'VoiceQueueId':_0x33547d[_0xd5a6('0x48')][_0xd5a6('0x6d')]},'individualHooks':!![]})[_0xd5a6('0x2d')](function(){return _0x31c3aa;});}return _0x31c3aa;})[_0xd5a6('0x2d')](respondWithStatusCode(_0xe3709e,null))['catch'](handleError(_0xe3709e,null));};exports[_0xd5a6('0xbf')]=function(_0x20f8d0,_0x28d4bd,_0x113408){_0x20f8d0[_0xd5a6('0x6a')]['userpic']=_0x20f8d0[_0xd5a6('0xc0')][_0xd5a6('0xc1')];return db['User'][_0xd5a6('0x67')]({'where':{'id':_0x20f8d0[_0xd5a6('0x65')]['id']}})[_0xd5a6('0x2d')](handleEntityNotFound(_0x28d4bd,null))[_0xd5a6('0x2d')](saveUpdates(_0x20f8d0[_0xd5a6('0x6a')],null))[_0xd5a6('0x2d')](respondWithResult(_0x28d4bd,null))[_0xd5a6('0x63')](handleError(_0x28d4bd,null));};exports[_0xd5a6('0xc2')]=function(_0x40f72e,_0x63f80e,_0x44b3d0){var _0x2606b3=path[_0xd5a6('0xc3')](config[_0xd5a6('0xc4')],_0xd5a6('0xc5'));return db[_0xd5a6('0x40')][_0xd5a6('0x67')]({'where':{'id':_0x40f72e[_0xd5a6('0x65')]['id']},'attributes':['id',_0xd5a6('0xc6')],'raw':!![]})[_0xd5a6('0x2d')](handleEntityNotFound(_0x63f80e,null))['then'](function(_0x550f59){if(_0x550f59){if(_[_0xd5a6('0x74')](_0x550f59[_0xd5a6('0xc6')])){return _0x63f80e[_0xd5a6('0xc7')](_0x2606b3);}else{if(!fs[_0xd5a6('0xc8')](path['join'](config[_0xd5a6('0xc4')],_0xd5a6('0xc9'),_0x550f59['userpic']))){return _0x63f80e[_0xd5a6('0xc7')](_0x2606b3);}return _0x63f80e['download'](path['join'](config[_0xd5a6('0xc4')],_0xd5a6('0xc9'),_0x550f59[_0xd5a6('0xc6')]));}}})[_0xd5a6('0x63')](handleError(_0x63f80e,null));};exports[_0xd5a6('0xca')]=function(_0x2bbbd8,_0x2e319d,_0x55252b){return db[_0xd5a6('0x40')]['find']({'where':{'id':_0x2bbbd8['params']['id']},'attributes':['id']})[_0xd5a6('0x2d')](handleEntityNotFound(_0x2e319d,null))[_0xd5a6('0x2d')](function(_0xd3c52b){var _0x407d4a=[];values=_0xd3c52b['dataValues'];_0x407d4a['push'](get_open_tabs(_0xd5a6('0x5d'),_0xd3c52b[_0xd5a6('0x5e')]));_0x407d4a[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x68'),_0xd3c52b[_0xd5a6('0x5e')]));_0x407d4a[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x61'),_0xd3c52b[_0xd5a6('0x5e')]));_0x407d4a[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x69'),_0xd3c52b[_0xd5a6('0x5e')]));_0x407d4a[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x5f'),_0xd3c52b['dataValues']));_0x407d4a[_0xd5a6('0x58')](get_open_tabs(_0xd5a6('0x60'),_0xd3c52b[_0xd5a6('0x5e')]));return BPromise[_0xd5a6('0x62')](_0x407d4a);})[_0xd5a6('0x2d')](function(_0x274e73){var _0x5e82a1=[];if(_0x274e73){for(var _0xf13121=0x0;_0xf13121=_0x725808[_0x8f21('0x51')]){throw new Error(_0x8f21('0x52'));}})[_0x8f21('0xc')](function(){if(_0x1f5565){return db[_0x8f21('0x29')][_0x8f21('0x48')]({'where':{'membername':_0x1f5565[_0x8f21('0x30')]},'individualHooks':!![]});}})[_0x8f21('0xc')](function(){if(_0x1f5565){return _0x1f5565[_0x8f21('0x53')]({'raw':!![]});}})[_0x8f21('0xc')](function(_0x1e9f11){if(_0x1f5565){if(_0x1e9f11){var _0x55e83a=[];_0x2c8eba=_0x1e9f11;if(_0x2c8eba[_0x8f21('0x49')]){for(var _0x77e40a=0x0;_0x77e40a<_0x2c8eba['length'];_0x77e40a++){_0x55e83a[_0x8f21('0x2f')](db[_0x8f21('0x29')][_0x8f21('0x54')]({'membername':_0x1f5565[_0x8f21('0x30')],'UserId':_0x1f5565['id'],'queue_name':_0x2c8eba[_0x77e40a][_0x8f21('0x30')],'VoiceQueueId':_0x2c8eba[_0x77e40a]['id'],'interface':_0x4b15ba,'paused':_0x1f5565[_0x8f21('0x4d')]||![],'penalty':_0x2c8eba[_0x77e40a]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x8f21('0x4a')](_0x55e83a);}}}})[_0x8f21('0xc')](function(){if(_0x1f5565){return db[_0x8f21('0x2a')][_0x8f21('0x19')]({'where':{'membername':_0x1f5565[_0x8f21('0x30')],'exitAt':null}});}})[_0x8f21('0xc')](function(_0x466469){if(_0x1f5565){if(_0x466469&&_0x466469[_0x8f21('0x49')]){var _0x359657=[];_0x466469[_0x8f21('0x45')](function(_0x1a1ca4){_0x359657['push'](_0x1a1ca4['update']({'exitAt':moment()[_0x8f21('0x32')](_0x8f21('0x2c'))}));});return BPromise[_0x8f21('0x4a')](_0x359657);}}})[_0x8f21('0xc')](function(_0x5e691a){if(_0x1f5565){var _0x6fef58=[];var _0x4bb97e=[];var _0x5f01b1=utils[_0x8f21('0x2e')]();var _0x578269={'membername':_0x1f5565['name'],'interface':_0x4b15ba,'enterAt':moment()[_0x8f21('0x32')](_0x8f21('0x2c')),'role':_0x1f5565['role'],'internal':_0x1f5565[_0x8f21('0x27')]};_0x5f01b1['forEach'](function(_0x29f635){_0x6fef58[_0x8f21('0x2f')](_['merge']({'channel':_0x29f635,'type':'LOGIN','data1':_0x8f21('0x55'),'data2':_0x4b15ba},_0x578269));if(_0x1f5565[_0x8f21('0x4d')]){_0x4bb97e['push'](_['merge']({'channel':_0x29f635,'type':_0x8f21('0x2b'),'data1':_0x8f21('0x56')},_0x578269));}});return db[_0x8f21('0x2a')]['bulkCreate'](_0x6fef58[_0x8f21('0x57')](_0x4bb97e),{'individualHooks':!![]});}})[_0x8f21('0xc')](function(){if(_0x1f5565){return _0x1f5565[_0x8f21('0x39')]({'online':!![],'lastLoginAt':moment()[_0x8f21('0x32')](_0x8f21('0x2c')),'voicePause':_0x1f5565[_0x8f21('0x4d')]||![],'mailPause':_0x1f5565[_0x8f21('0x4d')]||![],'chatPause':_0x1f5565[_0x8f21('0x4d')]||![],'faxPause':_0x1f5565[_0x8f21('0x4d')]||![],'smsPause':_0x1f5565['loginInPause']||![],'openchannelPause':_0x1f5565[_0x8f21('0x4d')]||![],'pauseType':_0x1f5565[_0x8f21('0x4d')]?_0x8f21('0x56'):null,'lastPauseAt':moment()[_0x8f21('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4b15ba});}})[_0x8f21('0xc')](function(_0x5c764c){_0x47bcb9(_0x5c764c);})[_0x8f21('0x17')](function(_0x17820a){_0x141255(_0xb7719a['error'](0x1f4,_0x17820a[_0x8f21('0x15')]));});});}; \ No newline at end of file +var _0x33ec=['result','catch','GetUser','findAll','options','raw','where','attributes','limit','model','include','map','then','debug','ShowUser','User','find','PauseUser','role','internal','interface','update','MemberReport','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','SIP/%s','type','DEFAULT\x20PAUSE','body','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','UserVoiceQueueRt','mail','fax','openchannel','whatsapp','system','set','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','loginInPause','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','merge','LOGININPAUSE','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','request','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3af1a4,_0x291a52){var _0x37ff7f=function(_0x20c564){while(--_0x20c564){_0x3af1a4['push'](_0x3af1a4['shift']());}};_0x37ff7f(++_0x291a52);}(_0x33ec,0x1ae));var _0xc33e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc33e('0x0'));var util=require(_0xc33e('0x1'));var moment=require(_0xc33e('0x2'));var BPromise=require(_0xc33e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc33e('0x4'))['db'];var utils=require(_0xc33e('0x5'));var logger=require(_0xc33e('0x6'))(_0xc33e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc33e('0x8')][_0xc33e('0x9')]({'port':0x232a});config['redis']=_[_0xc33e('0xa')](config[_0xc33e('0xb')],{'host':_0xc33e('0xc'),'port':0x18eb});var socket=require(_0xc33e('0xd'))(new Redis(config[_0xc33e('0xb')]));require(_0xc33e('0xe'))[_0xc33e('0xf')](socket);function respondWithRpcPromise(_0x2289dd,_0x196528,_0x538933){return new BPromise(function(_0x3f1968,_0x208762){return client[_0xc33e('0x10')](_0x2289dd,_0x538933)['then'](function(_0x14d69a){logger[_0xc33e('0x11')](_0xc33e('0x12'),_0x196528,_0xc33e('0x13'));logger['debug'](_0xc33e('0x14'),_0x196528,_0xc33e('0x13'),JSON[_0xc33e('0x15')](_0x14d69a));if(_0x14d69a[_0xc33e('0x16')]){if(_0x14d69a['error'][_0xc33e('0x17')]===0x1f4){logger[_0xc33e('0x16')](_0xc33e('0x12'),_0x196528,_0x14d69a[_0xc33e('0x16')][_0xc33e('0x18')]);return _0x208762(_0x14d69a[_0xc33e('0x16')][_0xc33e('0x18')]);}logger[_0xc33e('0x16')](_0xc33e('0x12'),_0x196528,_0x14d69a[_0xc33e('0x16')][_0xc33e('0x18')]);return _0x3f1968(_0x14d69a[_0xc33e('0x16')][_0xc33e('0x18')]);}else{logger[_0xc33e('0x11')](_0xc33e('0x12'),_0x196528,'request\x20sent');_0x3f1968(_0x14d69a[_0xc33e('0x19')][_0xc33e('0x18')]);}})[_0xc33e('0x1a')](function(_0x500585){logger[_0xc33e('0x16')]('User,\x20%s,\x20%s',_0x196528,_0x500585);_0x208762(_0x500585);});});}exports[_0xc33e('0x1b')]=function(_0x5ecae3){var _0x4cc136=this;return new Promise(function(_0xf7ad37,_0x1aeb4a){return db['User'][_0xc33e('0x1c')]({'raw':_0x5ecae3[_0xc33e('0x1d')]?_0x5ecae3['options'][_0xc33e('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ecae3[_0xc33e('0x1d')]?_0x5ecae3[_0xc33e('0x1d')][_0xc33e('0x1f')]||null:null,'attributes':_0x5ecae3[_0xc33e('0x1d')]?_0x5ecae3[_0xc33e('0x1d')][_0xc33e('0x20')]||null:null,'limit':_0x5ecae3['options']?_0x5ecae3[_0xc33e('0x1d')][_0xc33e('0x21')]||null:null,'include':_0x5ecae3[_0xc33e('0x1d')]?_0x5ecae3[_0xc33e('0x1d')]['include']?_['map'](_0x5ecae3[_0xc33e('0x1d')]['include'],function(_0x508b17){return{'model':db[_0x508b17[_0xc33e('0x22')]],'as':_0x508b17['as'],'attributes':_0x508b17[_0xc33e('0x20')],'include':_0x508b17[_0xc33e('0x23')]?_[_0xc33e('0x24')](_0x508b17['include'],function(_0x1ef8c6){return{'model':db[_0x1ef8c6[_0xc33e('0x22')]],'as':_0x1ef8c6['as'],'attributes':_0x1ef8c6[_0xc33e('0x20')],'include':_0x1ef8c6[_0xc33e('0x23')]?_[_0xc33e('0x24')](_0x1ef8c6[_0xc33e('0x23')],function(_0x58dd3a){return{'model':db[_0x58dd3a[_0xc33e('0x22')]],'as':_0x58dd3a['as'],'attributes':_0x58dd3a[_0xc33e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc33e('0x25')](function(_0x5432cb){logger['info'](_0xc33e('0x1b'),_0x5ecae3);logger[_0xc33e('0x26')](_0xc33e('0x1b'),_0x5ecae3,JSON['stringify'](_0x5432cb));_0xf7ad37(_0x5432cb);})[_0xc33e('0x1a')](function(_0x52b754){logger[_0xc33e('0x16')](_0xc33e('0x1b'),_0x52b754['message'],_0x5ecae3);_0x1aeb4a(_0x4cc136[_0xc33e('0x16')](0x1f4,_0x52b754[_0xc33e('0x18')]));});});};exports[_0xc33e('0x27')]=function(_0x236dc1){var _0x26017f=this;return new Promise(function(_0xd4f7ed,_0x42ccf7){return db[_0xc33e('0x28')][_0xc33e('0x29')]({'raw':_0x236dc1[_0xc33e('0x1d')]?_0x236dc1['options'][_0xc33e('0x1e')]===undefined?!![]:![]:!![],'where':_0x236dc1[_0xc33e('0x1d')]?_0x236dc1[_0xc33e('0x1d')]['where']||null:null,'attributes':_0x236dc1['options']?_0x236dc1[_0xc33e('0x1d')]['attributes']||null:null,'include':_0x236dc1[_0xc33e('0x1d')]?_0x236dc1[_0xc33e('0x1d')][_0xc33e('0x23')]?_[_0xc33e('0x24')](_0x236dc1[_0xc33e('0x1d')]['include'],function(_0x4cc239){return{'model':db[_0x4cc239[_0xc33e('0x22')]],'as':_0x4cc239['as'],'attributes':_0x4cc239[_0xc33e('0x20')],'include':_0x4cc239[_0xc33e('0x23')]?_[_0xc33e('0x24')](_0x4cc239[_0xc33e('0x23')],function(_0x1454b2){return{'model':db[_0x1454b2[_0xc33e('0x22')]],'as':_0x1454b2['as'],'attributes':_0x1454b2[_0xc33e('0x20')],'include':_0x1454b2[_0xc33e('0x23')]?_[_0xc33e('0x24')](_0x1454b2[_0xc33e('0x23')],function(_0x5ed39e){return{'model':db[_0x5ed39e[_0xc33e('0x22')]],'as':_0x5ed39e['as'],'attributes':_0x5ed39e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc33e('0x25')](function(_0x2b5148){logger[_0xc33e('0x11')](_0xc33e('0x27'),_0x236dc1);logger[_0xc33e('0x26')]('ShowUser',_0x236dc1,JSON['stringify'](_0x2b5148));_0xd4f7ed(_0x2b5148);})[_0xc33e('0x1a')](function(_0x21b5a9){logger[_0xc33e('0x16')]('ShowUser',_0x21b5a9[_0xc33e('0x18')],_0x236dc1);_0x42ccf7(_0x26017f[_0xc33e('0x16')](0x1f4,_0x21b5a9[_0xc33e('0x18')]));});});};exports[_0xc33e('0x2a')]=function(_0x3b8de4){var _0x25486d=this;return new Promise(function(_0x29921f,_0x38a689){var _0x5e1633;return db[_0xc33e('0x28')][_0xc33e('0x29')]({'where':_0x3b8de4[_0xc33e('0x1d')][_0xc33e('0x1f')]||{},'attributes':['id','name',_0xc33e('0x2b'),_0xc33e('0x2c'),_0xc33e('0x2d')]})[_0xc33e('0x25')](function(_0x3289c3){if(_0x3289c3){_0x5e1633=_0x3289c3;return db['UserVoiceQueueRt'][_0xc33e('0x2e')]({'paused':0x1},{'where':{'UserId':_0x5e1633['id']},'individualHooks':!![]});}})['then'](function(){if(_0x5e1633){return db[_0xc33e('0x2f')][_0xc33e('0x1c')]({'where':{'membername':_0x5e1633[_0xc33e('0x30')],'type':_0xc33e('0x31'),'exitAt':null}});}})[_0xc33e('0x25')](function(_0x2267b2){if(_0x5e1633){if(_0x2267b2&&_0x2267b2[_0xc33e('0x32')]){var _0x52c1e3=moment()[_0xc33e('0x33')](_0xc33e('0x34'));for(var _0x5e2d6c=0x0,_0x171b6d=_0x2267b2['length'];_0x5e2d6c<_0x171b6d;_0x5e2d6c++){_0x2267b2[_0x5e2d6c][_0xc33e('0x35')]({'exitAt':_0x52c1e3});}}}})[_0xc33e('0x25')](function(){if(_0x5e1633){var _0x5bf04d=[];var _0x19d06a=utils[_0xc33e('0x36')]();_0x19d06a[_0xc33e('0x37')](function(_0x5f52e3){_0x5bf04d[_0xc33e('0x38')]({'channel':_0x5f52e3,'membername':_0x5e1633['name'],'interface':_['isNil'](_0x5e1633[_0xc33e('0x2d')])?util['format'](_0xc33e('0x39'),_0x5e1633[_0xc33e('0x30')]):_0x5e1633[_0xc33e('0x2d')],'type':_0xc33e('0x31'),'enterAt':moment()[_0xc33e('0x33')](_0xc33e('0x34')),'data1':_0x3b8de4['body'][_0xc33e('0x3a')]||_0xc33e('0x3b'),'role':_0x5e1633[_0xc33e('0x2b')],'internal':_0x5e1633[_0xc33e('0x2c')],'uniqueid':_0x3b8de4[_0xc33e('0x3c')]['uniqueid']||null});});return db['MemberReport'][_0xc33e('0x3d')](_0x5bf04d,{'individualHooks':!![]});}})['then'](function(){if(_0x5e1633){return _0x5e1633[_0xc33e('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3b8de4['body'][_0xc33e('0x3a')]||_0xc33e('0x3b'),'lastPauseAt':moment()['format'](_0xc33e('0x34'))});}})['then'](function(_0x5ea50a){_0x29921f(_0x5ea50a);})[_0xc33e('0x1a')](function(_0x2ae628){_0x38a689(_0x25486d[_0xc33e('0x16')](0x1f4,_0x2ae628[_0xc33e('0x18')]));});});};exports[_0xc33e('0x3e')]=function(_0x2b834a){var _0x5b0ee2=this;return new Promise(function(_0xd4c6e,_0x181eb6){var _0x4032d;return db['User'][_0xc33e('0x3f')]({'where':_0x2b834a['options'][_0xc33e('0x1f')]||{},'attributes':['id',_0xc33e('0x30')]})['then'](function(_0x1055c4){if(_0x1055c4){_0x4032d=_0x1055c4;if(_0x2b834a[_0xc33e('0x3c')][_0xc33e('0x40')]&&!utils[_0xc33e('0x41')](_0x2b834a[_0xc33e('0x3c')][_0xc33e('0x40')])){throw new Error(_0xc33e('0x42'));}switch(_0x2b834a[_0xc33e('0x3c')][_0xc33e('0x40')]){case _0xc33e('0x43'):return db[_0xc33e('0x44')][_0xc33e('0x2e')]({'paused':0x0},{'where':{'UserId':_0x4032d['id']}})[_0xc33e('0x25')](function(){return db['MemberReport'][_0xc33e('0x29')]({'where':{'channel':_0x2b834a['body'][_0xc33e('0x40')],'membername':_0x4032d[_0xc33e('0x30')],'type':'PAUSE','exitAt':null}});})[_0xc33e('0x25')](function(_0x50c04f){if(_0x50c04f){return _0x50c04f[_0xc33e('0x2e')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xc33e('0x25')](function(){return _0x4032d['update']({'voicePause':![]});});case _0xc33e('0x45'):case'chat':case _0xc33e('0x46'):case'sms':case _0xc33e('0x47'):case _0xc33e('0x48'):return db['MemberReport'][_0xc33e('0x29')]({'where':{'channel':_0x2b834a['body']['channel'],'membername':_0x4032d[_0xc33e('0x30')],'type':_0xc33e('0x31'),'exitAt':null}})[_0xc33e('0x25')](function(_0x5335ea){return _0x5335ea[_0xc33e('0x2e')]({'exitAt':moment()[_0xc33e('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xc33e('0x49')},{'individualHooks':!![]});})[_0xc33e('0x25')](function(){var _0x54ca14={};_[_0xc33e('0x4a')](_0x54ca14,util[_0xc33e('0x33')](_0xc33e('0x4b'),_0x2b834a[_0xc33e('0x3c')][_0xc33e('0x40')],_0xc33e('0x4c')),![]);return _0x4032d['update'](_0x54ca14);});default:return db[_0xc33e('0x44')][_0xc33e('0x2e')]({'paused':0x0},{'where':{'UserId':_0x4032d['id']}})[_0xc33e('0x25')](function(){return db['MemberReport'][_0xc33e('0x1c')]({'where':{'membername':_0x4032d['name'],'type':_0xc33e('0x31'),'exitAt':null}});})[_0xc33e('0x25')](function(_0x3006a5){var _0x457923=[];_0x3006a5[_0xc33e('0x37')](function(_0x334d27){_0x457923['push'](_0x334d27['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xc33e('0x49')}));});return BPromise[_0xc33e('0x4d')](_0x457923);})[_0xc33e('0x25')](function(){return _0x4032d[_0xc33e('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xc33e('0x25')](function(_0x20c9d7){_0xd4c6e(_0x20c9d7);})[_0xc33e('0x1a')](function(_0x2f57dc){_0x181eb6(_0x5b0ee2['error'](0x1f4,_0x2f57dc[_0xc33e('0x18')]));});});};exports[_0xc33e('0x4e')]=function(_0x3f595f){var _0x444021=this;return new Promise(function(_0x2e2425,_0x422f89){var _0x50bb9c;return db[_0xc33e('0x28')]['findOne']({'where':_0x3f595f['options'][_0xc33e('0x1f')]||{},'attributes':['id','name']})[_0xc33e('0x25')](function(_0x4c7b0d){if(_0x4c7b0d){_0x50bb9c=_0x4c7b0d;return db[_0xc33e('0x44')][_0xc33e('0x4f')]({'where':{'membername':_0x50bb9c[_0xc33e('0x30')]},'individualHooks':!![]});}})['then'](function(){if(_0x50bb9c){return db['MemberReport'][_0xc33e('0x1c')]({'where':{'membername':_0x50bb9c[_0xc33e('0x30')],'exitAt':null}});}})[_0xc33e('0x25')](function(_0x2f4f42){if(_0x50bb9c){if(_0x2f4f42&&_0x2f4f42[_0xc33e('0x32')]){var _0x4e7f3b=[];_0x2f4f42['forEach'](function(_0x70e3de){_0x4e7f3b[_0xc33e('0x38')](_0x70e3de[_0xc33e('0x2e')]({'exitAt':moment()[_0xc33e('0x33')](_0xc33e('0x34'))}));});return BPromise[_0xc33e('0x4d')](_0x4e7f3b);}}})[_0xc33e('0x25')](function(){if(_0x50bb9c){return _0x50bb9c[_0xc33e('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x287a21){_0x2e2425(_0x287a21);})[_0xc33e('0x1a')](function(_0x11b849){_0x422f89(_0x444021[_0xc33e('0x16')](0x1f4,_0x11b849[_0xc33e('0x18')]));});});};exports[_0xc33e('0x50')]=function(_0x3c262c){var _0x5de303=this;return new Promise(function(_0x15ac9d,_0x613c2){var _0x1d6ab5;var _0x809d28;var _0x531cca;var _0x58fac9;return db[_0xc33e('0x28')]['findOne']({'where':_0x3c262c['options'][_0xc33e('0x1f')]||{},'attributes':['id',_0xc33e('0x30'),_0xc33e('0x2b'),_0xc33e('0x51'),'phone',_0xc33e('0x2c'),_0xc33e('0x52'),'interface']})['then'](function(_0x448777){if(_0x448777){_0x1d6ab5=_0x448777;_0x58fac9=_0x3c262c[_0xc33e('0x3c')]['interface']?_0x3c262c['body']['interface']:util[_0xc33e('0x33')]('SIP/%s',_0x1d6ab5['name']);return db[_0xc33e('0x28')][_0xc33e('0x53')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1d6ab5['id']}}});}})['then'](function(_0xf3dcb3){if(_0xf3dcb3){_0x531cca=_0xf3dcb3;return require(_0xc33e('0x54'))[_0xc33e('0x55')]();}})[_0xc33e('0x25')](function(_0x1f304f){if(_0x1f304f&&_0x1f304f[_0xc33e('0x56')]&&_0x531cca>=_0x1f304f[_0xc33e('0x56')]){throw new Error(_0xc33e('0x57'));}})[_0xc33e('0x25')](function(){if(_0x1d6ab5){return db[_0xc33e('0x44')][_0xc33e('0x4f')]({'where':{'membername':_0x1d6ab5[_0xc33e('0x30')]},'individualHooks':!![]});}})[_0xc33e('0x25')](function(){if(_0x1d6ab5){return _0x1d6ab5[_0xc33e('0x58')]({'raw':!![]});}})[_0xc33e('0x25')](function(_0xfa9d02){if(_0x1d6ab5){if(_0xfa9d02){var _0x2fdfa5=[];_0x809d28=_0xfa9d02;if(_0x809d28['length']){for(var _0x2f96a1=0x0;_0x2f96a1<_0x809d28[_0xc33e('0x32')];_0x2f96a1++){_0x2fdfa5[_0xc33e('0x38')](db[_0xc33e('0x44')]['upsert']({'membername':_0x1d6ab5['name'],'UserId':_0x1d6ab5['id'],'queue_name':_0x809d28[_0x2f96a1][_0xc33e('0x30')],'VoiceQueueId':_0x809d28[_0x2f96a1]['id'],'interface':_0x58fac9,'paused':_0x1d6ab5[_0xc33e('0x52')]||![],'penalty':_0x809d28[_0x2f96a1]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x2fdfa5);}}}})[_0xc33e('0x25')](function(){if(_0x1d6ab5){return db[_0xc33e('0x2f')][_0xc33e('0x1c')]({'where':{'membername':_0x1d6ab5['name'],'exitAt':null}});}})['then'](function(_0x26a8ea){if(_0x1d6ab5){if(_0x26a8ea&&_0x26a8ea['length']){var _0x4695ce=[];_0x26a8ea[_0xc33e('0x37')](function(_0x5124fa){_0x4695ce[_0xc33e('0x38')](_0x5124fa[_0xc33e('0x2e')]({'exitAt':moment()[_0xc33e('0x33')](_0xc33e('0x34'))}));});return BPromise[_0xc33e('0x4d')](_0x4695ce);}}})['then'](function(_0x595a6d){if(_0x1d6ab5){var _0x712257=[];var _0x2a46f9=[];var _0x3cf6eb=utils[_0xc33e('0x36')]();var _0xeaf76d={'membername':_0x1d6ab5[_0xc33e('0x30')],'interface':_0x58fac9,'enterAt':moment()[_0xc33e('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1d6ab5['role'],'internal':_0x1d6ab5[_0xc33e('0x2c')]};_0x3cf6eb[_0xc33e('0x37')](function(_0x2abfd6){_0x712257[_0xc33e('0x38')](_[_0xc33e('0x59')]({'channel':_0x2abfd6,'type':'LOGIN','data1':'callysquare','data2':_0x58fac9},_0xeaf76d));if(_0x1d6ab5[_0xc33e('0x52')]){_0x2a46f9[_0xc33e('0x38')](_[_0xc33e('0x59')]({'channel':_0x2abfd6,'type':'PAUSE','data1':'LOGININPAUSE'},_0xeaf76d));}});return db[_0xc33e('0x2f')][_0xc33e('0x3d')](_0x712257['concat'](_0x2a46f9),{'individualHooks':!![]});}})[_0xc33e('0x25')](function(){if(_0x1d6ab5){return _0x1d6ab5[_0xc33e('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xc33e('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1d6ab5['loginInPause']||![],'mailPause':_0x1d6ab5[_0xc33e('0x52')]||![],'chatPause':_0x1d6ab5[_0xc33e('0x52')]||![],'faxPause':_0x1d6ab5[_0xc33e('0x52')]||![],'smsPause':_0x1d6ab5[_0xc33e('0x52')]||![],'openchannelPause':_0x1d6ab5['loginInPause']||![],'pauseType':_0x1d6ab5[_0xc33e('0x52')]?_0xc33e('0x5a'):null,'lastPauseAt':moment()[_0xc33e('0x33')](_0xc33e('0x34')),'interface':_0x58fac9});}})['then'](function(_0x219dfc){_0x15ac9d(_0x219dfc);})[_0xc33e('0x1a')](function(_0x51eb81){_0x613c2(_0x5de303[_0xc33e('0x16')](0x1f4,_0x51eb81[_0xc33e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 80d0efd..3a54cdb 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 _0xee24=['remove','emit','length','user:','./user.events','save'];(function(_0x431823,_0x24b53d){var _0x5c2130=function(_0x5aefcc){while(--_0x5aefcc){_0x431823['push'](_0x431823['shift']());}};_0x5c2130(++_0x24b53d);}(_0xee24,0x12a));var _0x4ee2=function(_0x4578bc,_0xaa6f80){_0x4578bc=_0x4578bc-0x0;var _0x52d872=_0xee24[_0x4578bc];return _0x52d872;};'use strict';var UserEvents=require(_0x4ee2('0x0'));var events=[_0x4ee2('0x1'),_0x4ee2('0x2'),'update'];function createListener(_0x18420d,_0x1ce092){return function(_0x330f87){_0x1ce092[_0x4ee2('0x3')](_0x18420d,_0x330f87);};}function removeListener(_0x567ad0,_0x560fc3){return function(){UserEvents['removeListener'](_0x567ad0,_0x560fc3);};}exports['register']=function(_0x20ee56){for(var _0x4371a1=0x0,_0x3daa59=events[_0x4ee2('0x4')];_0x4371a1<_0x3daa59;_0x4371a1++){var _0x4f47f3=events[_0x4371a1];var _0x4701d5=createListener(_0x4ee2('0x5')+_0x4f47f3,_0x20ee56);UserEvents['on'](_0x4f47f3,_0x4701d5);}}; \ No newline at end of file +var _0x560e=['emit','register','save'];(function(_0x37e81f,_0x4de6ec){var _0x1fade0=function(_0x2eddea){while(--_0x2eddea){_0x37e81f['push'](_0x37e81f['shift']());}};_0x1fade0(++_0x4de6ec);}(_0x560e,0x110));var _0xe560=function(_0x124ca4,_0x4f3d9c){_0x124ca4=_0x124ca4-0x0;var _0x5e0c15=_0x560e[_0x124ca4];return _0x5e0c15;};'use strict';var UserEvents=require('./user.events');var events=[_0xe560('0x0'),'remove','update'];function createListener(_0x2a1013,_0x1279d9){return function(_0xe1ec32){_0x1279d9[_0xe560('0x1')](_0x2a1013,_0xe1ec32);};}function removeListener(_0x17b5e3,_0x1a7d9a){return function(){UserEvents['removeListener'](_0x17b5e3,_0x1a7d9a);};}exports[_0xe560('0x2')]=function(_0x5cfd3e){for(var _0x3f922a=0x0,_0x2a54e5=events['length'];_0x3f922a<_0x2a54e5;_0x3f922a++){var _0x4b657d=events[_0x3f922a];var _0x5cfadf=createListener('user:'+_0x4b657d,_0x5cfd3e);UserEvents['on'](_0x4b657d,_0x5cfadf);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 757726f..922c305 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xaa3da7,_0x1653e2){var _0x1b4f46=function(_0x538562){while(--_0x538562){_0xaa3da7['push'](_0xaa3da7['shift']());}};_0x1b4f46(++_0x1653e2);}(_0xe706,0xa3));var _0x6e70=function(_0x51fe86,_0x422b66){_0x51fe86=_0x51fe86-0x0;var _0x3557d4=_0xe706[_0x51fe86];return _0x3557d4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4eb057,_0x5acd49){var _0x256994=function(_0x4c77b7){while(--_0x4c77b7){_0x4eb057['push'](_0x4eb057['shift']());}};_0x256994(++_0x5acd49);}(_0xe706,0xa3));var _0x6e70=function(_0x171ac7,_0x339c8d){_0x171ac7=_0x171ac7-0x0;var _0x94478d=_0xe706[_0x171ac7];return _0x94478d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ebd24f6..afa16fa 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 _0xa625=['sequelize','exports','INTEGER'];(function(_0x457c96,_0x13785c){var _0x4e5ebc=function(_0x2fddc2){while(--_0x2fddc2){_0x457c96['push'](_0x457c96['shift']());}};_0x4e5ebc(++_0x13785c);}(_0xa625,0x1bf));var _0x5a62=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xa625[_0x409353];return _0x4f4b59;};'use strict';var Sequelize=require(_0x5a62('0x0'));module[_0x5a62('0x1')]={'penalty':{'type':Sequelize[_0x5a62('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd7a2=['INTEGER','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd7a2,0x18a));var _0x2d7a=function(_0x55ff01,_0xc96aa7){_0x55ff01=_0x55ff01-0x0;var _0x41bd68=_0xd7a2[_0x55ff01];return _0x41bd68;};'use strict';var Sequelize=require(_0x2d7a('0x0'));module[_0x2d7a('0x1')]={'penalty':{'type':Sequelize[_0x2d7a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 88eaa3b..7bf70af 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 _0xc227=['path','rimraf','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1effc9,_0x4496d1){var _0x1cb7e5=function(_0x57ab6c){while(--_0x57ab6c){_0x1effc9['push'](_0x1effc9['shift']());}};_0x1cb7e5(++_0x4496d1);}(_0xc227,0xcb));var _0x7c22=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xc227[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x7c22('0x0'));var util=require('util');var logger=require(_0x7c22('0x1'))(_0x7c22('0x2'));var moment=require(_0x7c22('0x3'));var BPromise=require(_0x7c22('0x4'));var rp=require(_0x7c22('0x5'));var fs=require('fs');var path=require(_0x7c22('0x6'));var rimraf=require(_0x7c22('0x7'));var config=require('../../config/environment');var attributes=require(_0x7c22('0x8'));module['exports']=function(_0x2285b9,_0x1e2423){return _0x2285b9['define'](_0x7c22('0x9'),attributes,{'tableName':_0x7c22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x638b=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x638b,0x1e0));var _0xb638=function(_0x29aeeb,_0x1e45db){_0x29aeeb=_0x29aeeb-0x0;var _0x2c23f1=_0x638b[_0x29aeeb];return _0x2c23f1;};'use strict';var _=require(_0xb638('0x0'));var util=require(_0xb638('0x1'));var logger=require(_0xb638('0x2'))('api');var moment=require(_0xb638('0x3'));var BPromise=require(_0xb638('0x4'));var rp=require(_0xb638('0x5'));var fs=require('fs');var path=require(_0xb638('0x6'));var rimraf=require('rimraf');var config=require(_0xb638('0x7'));var attributes=require(_0xb638('0x8'));module[_0xb638('0x9')]=function(_0x3b808f,_0x4fe3b7){return _0x3b808f[_0xb638('0xa')](_0xb638('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 445ed96..8fd1540 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 _0xc9e9=['../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc9e9,0xb8));var _0x9c9e=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0xc9e9[_0x3a6e4b];return _0x36572d;};'use strict';var _=require(_0x9c9e('0x0'));var util=require(_0x9c9e('0x1'));var moment=require(_0x9c9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c9e('0x3'));var fs=require('fs');var Redis=require(_0x9c9e('0x4'));var db=require(_0x9c9e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9c9e('0x6'));var config=require(_0x9c9e('0x7'));var jayson=require(_0x9c9e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7e84,_0x562f1d,_0x526696){return new BPromise(function(_0x267acb,_0x3a38cc){return client[_0x9c9e('0x9')](_0x3c7e84,_0x526696)[_0x9c9e('0xa')](function(_0x3cae75){logger['info'](_0x9c9e('0xb'),_0x562f1d,_0x9c9e('0xc'));logger['debug'](_0x9c9e('0xd'),_0x562f1d,_0x9c9e('0xc'),JSON[_0x9c9e('0xe')](_0x3cae75));if(_0x3cae75['error']){if(_0x3cae75['error'][_0x9c9e('0xf')]===0x1f4){logger[_0x9c9e('0x10')](_0x9c9e('0xb'),_0x562f1d,_0x3cae75[_0x9c9e('0x10')][_0x9c9e('0x11')]);return _0x3a38cc(_0x3cae75[_0x9c9e('0x10')][_0x9c9e('0x11')]);}logger[_0x9c9e('0x10')](_0x9c9e('0xb'),_0x562f1d,_0x3cae75[_0x9c9e('0x10')][_0x9c9e('0x11')]);return _0x267acb(_0x3cae75[_0x9c9e('0x10')][_0x9c9e('0x11')]);}else{logger[_0x9c9e('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x562f1d,_0x9c9e('0xc'));_0x267acb(_0x3cae75[_0x9c9e('0x13')][_0x9c9e('0x11')]);}})[_0x9c9e('0x14')](function(_0x537fc5){logger[_0x9c9e('0x10')](_0x9c9e('0xb'),_0x562f1d,_0x537fc5);_0x3a38cc(_0x537fc5);});});} \ No newline at end of file +var _0x7746=['rpc','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xd02ab7,_0x3bd888){var _0x4c5283=function(_0x4a5b10){while(--_0x4a5b10){_0xd02ab7['push'](_0xd02ab7['shift']());}};_0x4c5283(++_0x3bd888);}(_0x7746,0x1ad));var _0x6774=function(_0x40d9de,_0x2aca67){_0x40d9de=_0x40d9de-0x0;var _0x2e1f6d=_0x7746[_0x40d9de];return _0x2e1f6d;};'use strict';var _=require(_0x6774('0x0'));var util=require(_0x6774('0x1'));var moment=require(_0x6774('0x2'));var BPromise=require('bluebird');var rs=require(_0x6774('0x3'));var fs=require('fs');var Redis=require(_0x6774('0x4'));var db=require(_0x6774('0x5'))['db'];var utils=require(_0x6774('0x6'));var logger=require(_0x6774('0x7'))(_0x6774('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6774('0x9')][_0x6774('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53e676,_0x5b94f1,_0x4ed419){return new BPromise(function(_0x28f0b3,_0x14850b){return client[_0x6774('0xb')](_0x53e676,_0x4ed419)[_0x6774('0xc')](function(_0x448fc3){logger[_0x6774('0xd')](_0x6774('0xe'),_0x5b94f1,_0x6774('0xf'));logger['debug'](_0x6774('0x10'),_0x5b94f1,_0x6774('0xf'),JSON[_0x6774('0x11')](_0x448fc3));if(_0x448fc3[_0x6774('0x12')]){if(_0x448fc3[_0x6774('0x12')][_0x6774('0x13')]===0x1f4){logger[_0x6774('0x12')](_0x6774('0xe'),_0x5b94f1,_0x448fc3[_0x6774('0x12')]['message']);return _0x14850b(_0x448fc3[_0x6774('0x12')]['message']);}logger[_0x6774('0x12')](_0x6774('0xe'),_0x5b94f1,_0x448fc3[_0x6774('0x12')][_0x6774('0x14')]);return _0x28f0b3(_0x448fc3[_0x6774('0x12')][_0x6774('0x14')]);}else{logger[_0x6774('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x5b94f1,_0x6774('0xf'));_0x28f0b3(_0x448fc3[_0x6774('0x15')][_0x6774('0x14')]);}})[_0x6774('0x16')](function(_0x34678c){logger[_0x6774('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x5b94f1,_0x34678c);_0x14850b(_0x34678c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 49e8320..aef9e21 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5893be,_0x3285bc){var _0x2bc831=function(_0x375f14){while(--_0x375f14){_0x5893be['push'](_0x5893be['shift']());}};_0x2bc831(++_0x3285bc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xcb91[_0x421263];return _0x34e4b5;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3c9dbd,_0x18bfa3){var _0x1a1a4a=function(_0xf8b140){while(--_0xf8b140){_0x3c9dbd['push'](_0x3c9dbd['shift']());}};_0x1a1a4a(++_0x18bfa3);}(_0xedd9,0xfc));var _0x9edd=function(_0x188888,_0x2a0a1c){_0x188888=_0x188888-0x0;var _0x1491a8=_0xedd9[_0x188888];return _0x1491a8;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 5bd3c1d..5f7f7f5 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 _0xb9cb=['exports','INTEGER','STRING','sequelize'];(function(_0x342696,_0x146f50){var _0x15b8e4=function(_0x591e2a){while(--_0x591e2a){_0x342696['push'](_0x342696['shift']());}};_0x15b8e4(++_0x146f50);}(_0xb9cb,0x6b));var _0xbb9c=function(_0xb47dc0,_0x407032){_0xb47dc0=_0xb47dc0-0x0;var _0x57f0b0=_0xb9cb[_0xb47dc0];return _0x57f0b0;};'use strict';var Sequelize=require(_0xbb9c('0x0'));module[_0xbb9c('0x1')]={'penalty':{'type':Sequelize[_0xbb9c('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbb9c('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbb9c('0x3')]}}; \ No newline at end of file +var _0xa11a=['INTEGER','STRING','sequelize'];(function(_0x291b1c,_0x560295){var _0x502aa4=function(_0x192d70){while(--_0x192d70){_0x291b1c['push'](_0x291b1c['shift']());}};_0x502aa4(++_0x560295);}(_0xa11a,0x98));var _0xaa11=function(_0x9049bf,_0x5c5230){_0x9049bf=_0x9049bf-0x0;var _0x5a444a=_0xa11a[_0x9049bf];return _0x5a444a;};'use strict';var Sequelize=require(_0xaa11('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaa11('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaa11('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a48d66a..e178938 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 _0xc418=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','util','../../config/logger','api'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0xc418,0x13e));var _0x8c41=function(_0x255307,_0x4781db){_0x255307=_0x255307-0x0;var _0x33db28=_0xc418[_0x255307];return _0x33db28;};'use strict';var _=require(_0x8c41('0x0'));var util=require(_0x8c41('0x1'));var logger=require(_0x8c41('0x2'))(_0x8c41('0x3'));var moment=require(_0x8c41('0x4'));var BPromise=require(_0x8c41('0x5'));var rp=require(_0x8c41('0x6'));var fs=require('fs');var path=require(_0x8c41('0x7'));var rimraf=require(_0x8c41('0x8'));var config=require(_0x8c41('0x9'));var attributes=require(_0x8c41('0xa'));module[_0x8c41('0xb')]=function(_0x1d8ec8,_0x2b68c7){return _0x1d8ec8[_0x8c41('0xc')]('UserFaxQueue',attributes,{'tableName':_0x8c41('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d7=['exports','define','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x6b25ac,_0x14390e){var _0x15932a=function(_0x47ee8b){while(--_0x47ee8b){_0x6b25ac['push'](_0x6b25ac['shift']());}};_0x15932a(++_0x14390e);}(_0xa5d7,0xd3));var _0x7a5d=function(_0x4054a4,_0x1f5fc8){_0x4054a4=_0x4054a4-0x0;var _0x42fc0a=_0xa5d7[_0x4054a4];return _0x42fc0a;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var logger=require(_0x7a5d('0x2'))(_0x7a5d('0x3'));var moment=require(_0x7a5d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a5d('0x5'));var rimraf=require(_0x7a5d('0x6'));var config=require(_0x7a5d('0x7'));var attributes=require(_0x7a5d('0x8'));module[_0x7a5d('0x9')]=function(_0xf682c9,_0x5ce00b){return _0xf682c9[_0x7a5d('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index eff6717..0577578 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 _0x0983=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0x0983,0xb8));var _0x3098=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0983[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3098('0x0'));var BPromise=require(_0x3098('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3098('0x2'));var db=require(_0x3098('0x3'))['db'];var utils=require(_0x3098('0x4'));var logger=require(_0x3098('0x5'))(_0x3098('0x6'));var config=require(_0x3098('0x7'));var jayson=require(_0x3098('0x8'));var client=jayson[_0x3098('0x9')][_0x3098('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27a2d4,_0x571e33,_0x210ecc){return new BPromise(function(_0x36f5a9,_0x35729a){return client['request'](_0x27a2d4,_0x210ecc)[_0x3098('0xb')](function(_0x3d5d2d){logger[_0x3098('0xc')](_0x3098('0xd'),_0x571e33,_0x3098('0xe'));logger['debug'](_0x3098('0xf'),_0x571e33,_0x3098('0xe'),JSON['stringify'](_0x3d5d2d));if(_0x3d5d2d[_0x3098('0x10')]){if(_0x3d5d2d[_0x3098('0x10')][_0x3098('0x11')]===0x1f4){logger[_0x3098('0x10')](_0x3098('0xd'),_0x571e33,_0x3d5d2d['error'][_0x3098('0x12')]);return _0x35729a(_0x3d5d2d['error'][_0x3098('0x12')]);}logger[_0x3098('0x10')](_0x3098('0xd'),_0x571e33,_0x3d5d2d[_0x3098('0x10')][_0x3098('0x12')]);return _0x36f5a9(_0x3d5d2d[_0x3098('0x10')][_0x3098('0x12')]);}else{logger[_0x3098('0xc')](_0x3098('0xd'),_0x571e33,_0x3098('0xe'));_0x36f5a9(_0x3d5d2d[_0x3098('0x13')][_0x3098('0x12')]);}})[_0x3098('0x14')](function(_0xcf8b9){logger[_0x3098('0x10')](_0x3098('0xd'),_0x571e33,_0xcf8b9);_0x35729a(_0xcf8b9);});});} \ No newline at end of file +var _0x5c47=['message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1d2e5e,_0x145ae6){var _0x4a1d68=function(_0x3dd5b6){while(--_0x3dd5b6){_0x1d2e5e['push'](_0x1d2e5e['shift']());}};_0x4a1d68(++_0x145ae6);}(_0x5c47,0xb3));var _0x75c4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5c47[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x75c4('0x0'));var util=require('util');var moment=require(_0x75c4('0x1'));var BPromise=require(_0x75c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75c4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x75c4('0x4'));var logger=require(_0x75c4('0x5'))(_0x75c4('0x6'));var config=require(_0x75c4('0x7'));var jayson=require(_0x75c4('0x8'));var client=jayson[_0x75c4('0x9')][_0x75c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xac4ecd,_0x5a70c0,_0x446ee5){return new BPromise(function(_0x2a59d6,_0x11fbc8){return client['request'](_0xac4ecd,_0x446ee5)[_0x75c4('0xb')](function(_0x5b669e){logger[_0x75c4('0xc')](_0x75c4('0xd'),_0x5a70c0,_0x75c4('0xe'));logger[_0x75c4('0xf')](_0x75c4('0x10'),_0x5a70c0,_0x75c4('0xe'),JSON['stringify'](_0x5b669e));if(_0x5b669e[_0x75c4('0x11')]){if(_0x5b669e[_0x75c4('0x11')][_0x75c4('0x12')]===0x1f4){logger[_0x75c4('0x11')](_0x75c4('0xd'),_0x5a70c0,_0x5b669e[_0x75c4('0x11')][_0x75c4('0x13')]);return _0x11fbc8(_0x5b669e[_0x75c4('0x11')]['message']);}logger[_0x75c4('0x11')](_0x75c4('0xd'),_0x5a70c0,_0x5b669e[_0x75c4('0x11')][_0x75c4('0x13')]);return _0x2a59d6(_0x5b669e['error']['message']);}else{logger[_0x75c4('0xc')](_0x75c4('0xd'),_0x5a70c0,_0x75c4('0xe'));_0x2a59d6(_0x5b669e[_0x75c4('0x14')][_0x75c4('0x13')]);}})[_0x75c4('0x15')](function(_0x2884a8){logger[_0x75c4('0x11')](_0x75c4('0xd'),_0x5a70c0,_0x2884a8);_0x11fbc8(_0x2884a8);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 0abd52e..23fbb8d 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3dfea6,_0x5cd685){var _0x567aca=function(_0x100a5f){while(--_0x100a5f){_0x3dfea6['push'](_0x3dfea6['shift']());}};_0x567aca(++_0x5cd685);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x68361,_0x231f90){var _0xbb709a=function(_0x47e656){while(--_0x47e656){_0x68361['push'](_0x68361['shift']());}};_0xbb709a(++_0x231f90);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c81043e..96f1673 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 _0xdf32=['exports','INTEGER'];(function(_0x135eda,_0x43decf){var _0x45fc70=function(_0x32ff9d){while(--_0x32ff9d){_0x135eda['push'](_0x135eda['shift']());}};_0x45fc70(++_0x43decf);}(_0xdf32,0x1bc));var _0x2df3=function(_0xbcb461,_0x5af9d7){_0xbcb461=_0xbcb461-0x0;var _0x3907d1=_0xdf32[_0xbcb461];return _0x3907d1;};'use strict';var Sequelize=require('sequelize');module[_0x2df3('0x0')]={'penalty':{'type':Sequelize[_0x2df3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc757=['exports','INTEGER','sequelize'];(function(_0x91792,_0x34e10a){var _0x559ee1=function(_0x578884){while(--_0x578884){_0x91792['push'](_0x91792['shift']());}};_0x559ee1(++_0x34e10a);}(_0xc757,0xe3));var _0x7c75=function(_0x339df8,_0x31a2cf){_0x339df8=_0x339df8-0x0;var _0x4ef64d=_0xc757[_0x339df8];return _0x4ef64d;};'use strict';var Sequelize=require(_0x7c75('0x0'));module[_0x7c75('0x1')]={'penalty':{'type':Sequelize[_0x7c75('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 8dae651..8fe7399 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 _0x964a=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x2ec85a,_0x364f34){var _0x372eae=function(_0x150640){while(--_0x150640){_0x2ec85a['push'](_0x2ec85a['shift']());}};_0x372eae(++_0x364f34);}(_0x964a,0xc3));var _0xa964=function(_0x3f37f1,_0x199544){_0x3f37f1=_0x3f37f1-0x0;var _0x216258=_0x964a[_0x3f37f1];return _0x216258;};'use strict';var _=require(_0xa964('0x0'));var util=require(_0xa964('0x1'));var logger=require(_0xa964('0x2'))(_0xa964('0x3'));var moment=require(_0xa964('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa964('0x5'));var rimraf=require(_0xa964('0x6'));var config=require(_0xa964('0x7'));var attributes=require(_0xa964('0x8'));module[_0xa964('0x9')]=function(_0x195130,_0x20c00e){return _0x195130[_0xa964('0xa')](_0xa964('0xb'),attributes,{'tableName':_0xa964('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x538c=['request-promise','path','rimraf','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x2d86e7,_0x124c0d){var _0x1dfbbd=function(_0xff68ca){while(--_0xff68ca){_0x2d86e7['push'](_0x2d86e7['shift']());}};_0x1dfbbd(++_0x124c0d);}(_0x538c,0xc3));var _0xc538=function(_0xc9b970,_0x1cf01b){_0xc9b970=_0xc9b970-0x0;var _0x3affec=_0x538c[_0xc9b970];return _0x3affec;};'use strict';var _=require(_0xc538('0x0'));var util=require(_0xc538('0x1'));var logger=require(_0xc538('0x2'))(_0xc538('0x3'));var moment=require(_0xc538('0x4'));var BPromise=require('bluebird');var rp=require(_0xc538('0x5'));var fs=require('fs');var path=require(_0xc538('0x6'));var rimraf=require(_0xc538('0x7'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0xc538('0x8')]=function(_0x3f531c,_0x40c368){return _0x3f531c[_0xc538('0x9')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 0f938ec..d602e29 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7217,0x19e));var _0x7721=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x7217[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1cb9,0x14e));var _0x91cb=function(_0xeb54f1,_0x58235b){_0xeb54f1=_0xeb54f1-0x0;var _0x2bca08=_0x1cb9[_0xeb54f1];return _0x2bca08;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 25beb8e..7db7717 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 _0x11ee=['./userNotification.controller','isAuthenticated','multer','path','Router','../../config/environment'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x11ee,0xc8));var _0xe11e=function(_0x4a177c,_0x2bd612){_0x4a177c=_0x4a177c-0x0;var _0x54dd37=_0x11ee[_0x4a177c];return _0x54dd37;};'use strict';var multer=require(_0xe11e('0x0'));var util=require('util');var path=require(_0xe11e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe11e('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe11e('0x3'));var controller=require(_0xe11e('0x4'));router['post']('/',auth[_0xe11e('0x5')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0xcfdc=['isAuthenticated','sendUserNotification','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','post'];(function(_0x4f048e,_0x1d3344){var _0x287e7e=function(_0x28a960){while(--_0x28a960){_0x4f048e['push'](_0x4f048e['shift']());}};_0x287e7e(++_0x1d3344);}(_0xcfdc,0x1cb));var _0xccfd=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcfdc[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xccfd('0x0'));var util=require(_0xccfd('0x1'));var path=require(_0xccfd('0x2'));var timeout=require('connect-timeout');var express=require(_0xccfd('0x3'));var router=express[_0xccfd('0x4')]();var fs_extra=require(_0xccfd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xccfd('0x6'));var config=require(_0xccfd('0x7'));var controller=require('./userNotification.controller');router[_0xccfd('0x8')]('/',auth[_0xccfd('0x9')](),controller[_0xccfd('0xa')]);module[_0xccfd('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f1a60f1..67f85fd 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 _0x53d7=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x27196e,_0x21d888){var _0x5af1a3=function(_0x2e18cb){while(--_0x2e18cb){_0x27196e['push'](_0x27196e['shift']());}};_0x5af1a3(++_0x21d888);}(_0x53d7,0x74));var _0x753d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x753d('0x0'));module['exports']={'body':{'type':Sequelize[_0x753d('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x753d('0x1')]},'recipientsDescription':{'type':Sequelize[_0x753d('0x2')]},'beep':{'type':Sequelize[_0x753d('0x3')]}}; \ No newline at end of file +var _0x37cc=['STRING'];(function(_0x12b0f3,_0x380a21){var _0x522609=function(_0x4ee968){while(--_0x4ee968){_0x12b0f3['push'](_0x12b0f3['shift']());}};_0x522609(++_0x380a21);}(_0x37cc,0x10e));var _0xc37c=function(_0x2459a7,_0x308a3f){_0x2459a7=_0x2459a7-0x0;var _0x42a01d=_0x37cc[_0x2459a7];return _0x42a01d;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xc37c('0x0')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ff65108..176ac75 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 _0x5851=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','model','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','toLowerCase','union','replace','queue','Queue','ids','push','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x25e30f,_0x409cbc){var _0x14832a=function(_0x2ba4f0){while(--_0x2ba4f0){_0x25e30f['push'](_0x25e30f['shift']());}};_0x14832a(++_0x409cbc);}(_0x5851,0xbe));var _0x1585=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5851[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x1585('0x0'));var rimraf=require(_0x1585('0x1'));var zipdir=require(_0x1585('0x2'));var jsonpatch=require(_0x1585('0x3'));var rp=require(_0x1585('0x4'));var moment=require(_0x1585('0x5'));var BPromise=require(_0x1585('0x6'));var Mustache=require(_0x1585('0x7'));var util=require(_0x1585('0x8'));var path=require(_0x1585('0x9'));var sox=require(_0x1585('0xa'));var csv=require('to-csv');var ejs=require(_0x1585('0xb'));var fs=require('fs');var fs_extra=require(_0x1585('0xc'));var _=require('lodash');var squel=require(_0x1585('0xd'));var crypto=require(_0x1585('0xe'));var jsforce=require(_0x1585('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1585('0x10'));var Redis=require('ioredis');var authService=require(_0x1585('0x11'));var qs=require(_0x1585('0x12'));var as=require(_0x1585('0x13'));var hardwareService=require(_0x1585('0x14'));var logger=require(_0x1585('0x15'))(_0x1585('0x16'));var utils=require(_0x1585('0x17'));var config=require(_0x1585('0x18'));var licenseUtil=require(_0x1585('0x19'));var db=require(_0x1585('0x1a'))['db'];config[_0x1585('0x1b')]=_[_0x1585('0x1c')](config['redis'],{'host':_0x1585('0x1d'),'port':0x18eb});var socket=require(_0x1585('0x1e'))(new Redis(config['redis']));require(_0x1585('0x1f'))[_0x1585('0x20')](socket);function respondWithStatusCode(_0x2ecb17,_0x4fbecc){_0x4fbecc=_0x4fbecc||0xcc;return function(_0x292cc3){if(_0x292cc3){return _0x2ecb17[_0x1585('0x21')](_0x4fbecc);}return _0x2ecb17[_0x1585('0x22')](_0x4fbecc)[_0x1585('0x23')]();};}function respondWithResult(_0x245dda,_0xb12016){_0xb12016=_0xb12016||0xc8;return function(_0x19f79b){if(_0x19f79b){return _0x245dda[_0x1585('0x22')](_0xb12016)[_0x1585('0x24')](_0x19f79b);}};}function respondWithFilteredResult(_0x44af73,_0x13ca93){return function(_0x1425a1){if(_0x1425a1){var _0x3e77fe=typeof _0x13ca93[_0x1585('0x25')]===_0x1585('0x26')&&typeof _0x13ca93[_0x1585('0x27')]==='undefined';var _0x55e9fe=_0x1425a1['count'];var _0x5405b1=_0x3e77fe?0x0:_0x13ca93[_0x1585('0x25')];var _0x34af41=_0x3e77fe?_0x1425a1['count']:_0x13ca93['offset']+_0x13ca93[_0x1585('0x27')];var _0x1112e6;if(_0x34af41>=_0x55e9fe){_0x34af41=_0x55e9fe;_0x1112e6=0xc8;}else{_0x1112e6=0xce;}_0x44af73[_0x1585('0x22')](_0x1112e6);return _0x44af73[_0x1585('0x28')](_0x1585('0x29'),_0x5405b1+'-'+_0x34af41+'/'+_0x55e9fe)[_0x1585('0x24')](_0x1425a1);}return null;};}function patchUpdates(_0x121659){return function(_0x42cbda){try{jsonpatch[_0x1585('0x2a')](_0x42cbda,_0x121659,!![]);}catch(_0x307c60){return BPromise[_0x1585('0x2b')](_0x307c60);}return _0x42cbda[_0x1585('0x2c')]();};}function saveUpdates(_0x337105,_0x20eea7){return function(_0x1323ac){if(_0x1323ac){return _0x1323ac['update'](_0x337105)[_0x1585('0x2d')](function(_0x4fb6ac){return _0x4fb6ac;});}return null;};}function removeEntity(_0x63195a,_0x3a513e){return function(_0x25d730){if(_0x25d730){return _0x25d730[_0x1585('0x2e')]()[_0x1585('0x2d')](function(){_0x63195a[_0x1585('0x22')](0xcc)[_0x1585('0x23')]();});}};}function handleEntityNotFound(_0x411829,_0xc557a8){return function(_0x5ba31f){if(!_0x5ba31f){_0x411829[_0x1585('0x21')](0x194);}return _0x5ba31f;};}function handleError(_0x41e2fe,_0x5bc770){_0x5bc770=_0x5bc770||0x1f4;return function(_0x6c2289){logger[_0x1585('0x2f')](_0x6c2289['stack']);if(_0x6c2289[_0x1585('0x30')]){delete _0x6c2289[_0x1585('0x30')];}_0x41e2fe[_0x1585('0x22')](_0x5bc770)[_0x1585('0x31')](_0x6c2289);};}exports[_0x1585('0x32')]=function(_0x2298e1,_0x428514,_0x27873f){if(!_0x2298e1[_0x1585('0x33')][_0x1585('0x34')](_0x1585('0x35'))&&!_0x2298e1['body'][_0x1585('0x34')](_0x1585('0x36'))){throw new db[(_0x1585('0x37'))][(_0x1585('0x38'))](_0x1585('0x39'));}else{if(_0x2298e1[_0x1585('0x33')][_0x1585('0x34')]('TemplateId')&&!_0x2298e1['body'][_0x1585('0x34')](_0x1585('0x3a'))){throw new db[(_0x1585('0x37'))][(_0x1585('0x38'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2298e1[_0x1585('0x33')][_0x1585('0x34')](_0x1585('0x3b'))){throw new db['Sequelize'][(_0x1585('0x38'))](_0x1585('0x3c'));}else{try{var _0x149cb0=JSON[_0x1585('0x3d')](_0x2298e1['body'][_0x1585('0x3b')]);}catch(_0x14ade0){logger['error'](_0x14ade0);throw new db[(_0x1585('0x37'))][(_0x1585('0x38'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x238a9b=[_0x1585('0x3e'),'faxqueue',_0x1585('0x3f'),_0x1585('0x40'),_0x1585('0x41'),_0x1585('0x42'),'whatsappqueue',_0x1585('0x43'),_0x1585('0x44')];if(_[_0x1585('0x45')](_0x149cb0,function(_0x6e9843){return!_[_0x1585('0x46')](_0x238a9b,_0x6e9843[_0x1585('0x47')]['toLowerCase']());})){throw new db['Sequelize'][(_0x1585('0x38'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4e5e7c={};_0x4e5e7c[_0x1585('0x48')]=_0x2298e1[_0x1585('0x33')][_0x1585('0x34')](_0x1585('0x48'))?_0x2298e1[_0x1585('0x33')]['senderName']:_0x2298e1['user'][_0x1585('0x49')];_0x4e5e7c[_0x1585('0x4a')]=_[_0x1585('0x4b')](_0x2298e1[_0x1585('0x33')][_0x1585('0x4a')])?null:_0x2298e1[_0x1585('0x33')][_0x1585('0x4a')];_0x4e5e7c[_0x1585('0x4c')]=_0x2298e1[_0x1585('0x33')][_0x1585('0x4c')]||![];_0x4e5e7c[_0x1585('0x4d')]=_0x2298e1[_0x1585('0x44')]['id'];return getContent(_0x2298e1[_0x1585('0x33')])['then'](function(_0x5e7f38){_0x4e5e7c['body']=_0x5e7f38;return getRecipients(_0x149cb0);})[_0x1585('0x2d')](function(_0x420957){_0x4e5e7c[_0x1585('0x4e')]=_[_0x1585('0x4f')](_0x420957)[_0x1585('0x50')](',');return db[_0x1585('0x51')][_0x1585('0x52')](function(_0xc3f2ba){return db[_0x1585('0x53')][_0x1585('0x54')](_0x4e5e7c,{'raw':!![],'transaction':_0xc3f2ba})['then'](function(_0x28a651){var _0x41627a={'sender':_0x4e5e7c[_0x1585('0x48')],'description':_0x4e5e7c['recipientsDescription'],'content':_0x4e5e7c[_0x1585('0x33')],'beep':_0x4e5e7c[_0x1585('0x4c')]};_0x420957[_0x1585('0x55')](function(_0x23b7fc){_0x41627a[_0x1585('0x56')]=_0x23b7fc;socket[_0x1585('0x57')](_0x1585('0x58'),_0x41627a);});return _0x28a651;});});})[_0x1585('0x2d')](respondWithResult(_0x428514,0xc9))[_0x1585('0x59')](handleError(_0x428514,null));};function getContent(_0x418812){return new BPromise(function(_0xabc1f1,_0x4452cd){if(_0x418812['text']){_0xabc1f1(_0x418812['text']);return;}return db[_0x1585('0x5a')]['findOne']({'attributes':[_0x1585('0x5b')],'where':{'id':_0x418812[_0x1585('0x36')]},'raw':!![]})['then'](function(_0x477c2b){if(!_0x477c2b)throw new db[(_0x1585('0x37'))]['ValidationError'](_0x1585('0x5c'));var _0x1993e5=Mustache['render'](_0x477c2b[_0x1585('0x5b')],_0x418812[_0x1585('0x3a')]);_0xabc1f1(_0x1993e5);})[_0x1585('0x59')](function(_0x395a0c){_0x4452cd(_0x395a0c);});});}function getRecipients(_0x52f1c7){return new BPromise(function(_0x3ab35b,_0x5f1c61){var _0x41cefc=[];var _0x505113=[];_0x52f1c7[_0x1585('0x55')](function(_0xdf15be){var _0x32f777=_[_0x1585('0x5d')](_0xdf15be[_0x1585('0x47')][_0x1585('0x5e')]());if(_0x32f777==='User'){_0x41cefc=_[_0x1585('0x5f')](_0x41cefc,_0xdf15be['ids']);}else{if(_[_0x1585('0x46')](_0x32f777,'queue'))_0x32f777=_0x32f777[_0x1585('0x60')](_0x1585('0x61'),_0x1585('0x62'));_0xdf15be[_0x1585('0x63')][_0x1585('0x55')](function(_0x43b4d7){_0x505113[_0x1585('0x64')](getAgents(_0x32f777,_0x43b4d7));});}});return BPromise['all'](_0x505113)[_0x1585('0x2d')](function(_0x55395d){_0x41cefc=_[_0x1585('0x5f')](_0x41cefc,_[_0x1585('0x65')](_0x55395d));_0x3ab35b(_0x41cefc);})['catch'](function(_0x3b1905){_0x5f1c61(_0x3b1905);});});}function getAgents(_0x3c8160,_0x5ba338){return new BPromise(function(_0x2c0e8b,_0xb0b95b){return db[_0x3c8160][_0x1585('0x66')]({'where':{'id':_0x5ba338}})[_0x1585('0x2d')](function(_0x23e84c){return _0x23e84c[_0x1585('0x67')]({'attributes':['id'],'raw':!![]})['then'](function(_0x21dec9){var _0x1a5274=_[_0x1585('0x68')](_0x21dec9,'id');_0x2c0e8b(_0x1a5274);});})['catch'](function(_0x10fb5c){_0xb0b95b(_0x10fb5c);});});} \ No newline at end of file +var _0x5674=['then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','Template','findOne','html','render','catch','startCase','model','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save'];(function(_0xc120de,_0x575ca2){var _0x48d6ec=function(_0x2d48a8){while(--_0x2d48a8){_0xc120de['push'](_0xc120de['shift']());}};_0x48d6ec(++_0x575ca2);}(_0x5674,0x1e8));var _0x4567=function(_0x4f41ca,_0x2256b1){_0x4f41ca=_0x4f41ca-0x0;var _0x515eba=_0x5674[_0x4f41ca];return _0x515eba;};'use strict';var emlformat=require(_0x4567('0x0'));var rimraf=require(_0x4567('0x1'));var zipdir=require(_0x4567('0x2'));var jsonpatch=require(_0x4567('0x3'));var rp=require(_0x4567('0x4'));var moment=require(_0x4567('0x5'));var BPromise=require(_0x4567('0x6'));var Mustache=require(_0x4567('0x7'));var util=require('util');var path=require(_0x4567('0x8'));var sox=require(_0x4567('0x9'));var csv=require('to-csv');var ejs=require(_0x4567('0xa'));var fs=require('fs');var fs_extra=require(_0x4567('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4567('0xc'));var jsforce=require(_0x4567('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4567('0xe'));var querystring=require(_0x4567('0xf'));var Papa=require(_0x4567('0x10'));var Redis=require(_0x4567('0x11'));var authService=require(_0x4567('0x12'));var qs=require(_0x4567('0x13'));var as=require(_0x4567('0x14'));var hardwareService=require(_0x4567('0x15'));var logger=require(_0x4567('0x16'))(_0x4567('0x17'));var utils=require(_0x4567('0x18'));var config=require(_0x4567('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4567('0x1a'))['db'];config[_0x4567('0x1b')]=_[_0x4567('0x1c')](config['redis'],{'host':_0x4567('0x1d'),'port':0x18eb});var socket=require(_0x4567('0x1e'))(new Redis(config[_0x4567('0x1b')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0xd7ecc0,_0x4440ed){_0x4440ed=_0x4440ed||0xcc;return function(_0x2c94dc){if(_0x2c94dc){return _0xd7ecc0[_0x4567('0x1f')](_0x4440ed);}return _0xd7ecc0[_0x4567('0x20')](_0x4440ed)[_0x4567('0x21')]();};}function respondWithResult(_0x437bc9,_0x19edf1){_0x19edf1=_0x19edf1||0xc8;return function(_0xe8da84){if(_0xe8da84){return _0x437bc9[_0x4567('0x20')](_0x19edf1)['json'](_0xe8da84);}};}function respondWithFilteredResult(_0x2b5c52,_0x232ecc){return function(_0x50d8ec){if(_0x50d8ec){var _0x49ed01=typeof _0x232ecc[_0x4567('0x22')]===_0x4567('0x23')&&typeof _0x232ecc[_0x4567('0x24')]===_0x4567('0x23');var _0x54137a=_0x50d8ec[_0x4567('0x25')];var _0x1d2bb7=_0x49ed01?0x0:_0x232ecc[_0x4567('0x22')];var _0x309e68=_0x49ed01?_0x50d8ec['count']:_0x232ecc[_0x4567('0x22')]+_0x232ecc[_0x4567('0x24')];var _0x1df51c;if(_0x309e68>=_0x54137a){_0x309e68=_0x54137a;_0x1df51c=0xc8;}else{_0x1df51c=0xce;}_0x2b5c52[_0x4567('0x20')](_0x1df51c);return _0x2b5c52[_0x4567('0x26')]('Content-Range',_0x1d2bb7+'-'+_0x309e68+'/'+_0x54137a)[_0x4567('0x27')](_0x50d8ec);}return null;};}function patchUpdates(_0x581b88){return function(_0x153595){try{jsonpatch['apply'](_0x153595,_0x581b88,!![]);}catch(_0x1f6fbb){return BPromise[_0x4567('0x28')](_0x1f6fbb);}return _0x153595[_0x4567('0x29')]();};}function saveUpdates(_0x25260,_0x1980be){return function(_0x4d592b){if(_0x4d592b){return _0x4d592b['update'](_0x25260)[_0x4567('0x2a')](function(_0x3c89ba){return _0x3c89ba;});}return null;};}function removeEntity(_0x391043,_0x343da0){return function(_0x2f3fff){if(_0x2f3fff){return _0x2f3fff[_0x4567('0x2b')]()['then'](function(){_0x391043[_0x4567('0x20')](0xcc)[_0x4567('0x21')]();});}};}function handleEntityNotFound(_0x84dbf4,_0x2ff5ba){return function(_0x1f3f73){if(!_0x1f3f73){_0x84dbf4[_0x4567('0x1f')](0x194);}return _0x1f3f73;};}function handleError(_0x2f6bcd,_0x2f3cd5){_0x2f3cd5=_0x2f3cd5||0x1f4;return function(_0xe6dd7f){logger[_0x4567('0x2c')](_0xe6dd7f[_0x4567('0x2d')]);if(_0xe6dd7f[_0x4567('0x2e')]){delete _0xe6dd7f[_0x4567('0x2e')];}_0x2f6bcd['status'](_0x2f3cd5)[_0x4567('0x2f')](_0xe6dd7f);};}exports[_0x4567('0x30')]=function(_0x264811,_0x5461bf,_0x33c321){if(!_0x264811[_0x4567('0x31')][_0x4567('0x32')](_0x4567('0x33'))&&!_0x264811[_0x4567('0x31')]['hasOwnProperty'](_0x4567('0x34'))){throw new db['Sequelize']['ValidationError'](_0x4567('0x35'));}else{if(_0x264811[_0x4567('0x31')][_0x4567('0x32')]('TemplateId')&&!_0x264811[_0x4567('0x31')]['hasOwnProperty'](_0x4567('0x36'))){throw new db[(_0x4567('0x37'))][(_0x4567('0x38'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x264811[_0x4567('0x31')][_0x4567('0x32')](_0x4567('0x39'))){throw new db[(_0x4567('0x37'))][(_0x4567('0x38'))](_0x4567('0x3a'));}else{try{var _0x538362=JSON['parse'](_0x264811[_0x4567('0x31')]['recipients']);}catch(_0x169622){logger[_0x4567('0x2c')](_0x169622);throw new db[(_0x4567('0x37'))][(_0x4567('0x38'))](_0x4567('0x3b'));}var _0x49a96c=[_0x4567('0x3c'),'faxqueue',_0x4567('0x3d'),_0x4567('0x3e'),_0x4567('0x3f'),_0x4567('0x40'),_0x4567('0x41'),_0x4567('0x42'),_0x4567('0x43')];if(_['some'](_0x538362,function(_0x34090e){return!_[_0x4567('0x44')](_0x49a96c,_0x34090e['model'][_0x4567('0x45')]());})){throw new db['Sequelize'][(_0x4567('0x38'))](_0x4567('0x46'));}}}var _0xcd39f3={};_0xcd39f3[_0x4567('0x47')]=_0x264811['body'][_0x4567('0x32')](_0x4567('0x47'))?_0x264811[_0x4567('0x31')][_0x4567('0x47')]:_0x264811[_0x4567('0x43')][_0x4567('0x48')];_0xcd39f3['recipientsDescription']=_[_0x4567('0x49')](_0x264811['body'][_0x4567('0x4a')])?null:_0x264811[_0x4567('0x31')][_0x4567('0x4a')];_0xcd39f3[_0x4567('0x4b')]=_0x264811[_0x4567('0x31')][_0x4567('0x4b')]||![];_0xcd39f3[_0x4567('0x4c')]=_0x264811[_0x4567('0x43')]['id'];return getContent(_0x264811[_0x4567('0x31')])[_0x4567('0x2a')](function(_0x51d38e){_0xcd39f3[_0x4567('0x31')]=_0x51d38e;return getRecipients(_0x538362);})[_0x4567('0x2a')](function(_0x30839a){_0xcd39f3[_0x4567('0x4d')]=_[_0x4567('0x4e')](_0x30839a)[_0x4567('0x4f')](',');return db[_0x4567('0x50')][_0x4567('0x51')](function(_0x1ef239){return db[_0x4567('0x52')][_0x4567('0x53')](_0xcd39f3,{'raw':!![],'transaction':_0x1ef239})[_0x4567('0x2a')](function(_0x26d954){var _0x26dedf={'sender':_0xcd39f3['senderName'],'description':_0xcd39f3[_0x4567('0x4a')],'content':_0xcd39f3[_0x4567('0x31')],'beep':_0xcd39f3[_0x4567('0x4b')]};_0x30839a[_0x4567('0x54')](function(_0x391b79){_0x26dedf[_0x4567('0x55')]=_0x391b79;socket[_0x4567('0x56')](_0x4567('0x57'),_0x26dedf);});return _0x26d954;});});})[_0x4567('0x2a')](respondWithResult(_0x5461bf,0xc9))['catch'](handleError(_0x5461bf,null));};function getContent(_0x5c7f12){return new BPromise(function(_0x315a4b,_0x4ccca5){if(_0x5c7f12['text']){_0x315a4b(_0x5c7f12[_0x4567('0x33')]);return;}return db[_0x4567('0x58')][_0x4567('0x59')]({'attributes':[_0x4567('0x5a')],'where':{'id':_0x5c7f12[_0x4567('0x34')]},'raw':!![]})[_0x4567('0x2a')](function(_0x22315a){if(!_0x22315a)throw new db['Sequelize'][(_0x4567('0x38'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1f59ce=Mustache[_0x4567('0x5b')](_0x22315a[_0x4567('0x5a')],_0x5c7f12['view']);_0x315a4b(_0x1f59ce);})[_0x4567('0x5c')](function(_0x1e05b3){_0x4ccca5(_0x1e05b3);});});}function getRecipients(_0x926c1e){return new BPromise(function(_0x386c9f,_0x43ba01){var _0x260f13=[];var _0x1efb9d=[];_0x926c1e[_0x4567('0x54')](function(_0x526fe3){var _0xbe3b=_[_0x4567('0x5d')](_0x526fe3[_0x4567('0x5e')][_0x4567('0x45')]());if(_0xbe3b===_0x4567('0x5f')){_0x260f13=_[_0x4567('0x60')](_0x260f13,_0x526fe3[_0x4567('0x61')]);}else{if(_[_0x4567('0x44')](_0xbe3b,_0x4567('0x62')))_0xbe3b=_0xbe3b[_0x4567('0x63')](_0x4567('0x62'),_0x4567('0x64'));_0x526fe3[_0x4567('0x61')][_0x4567('0x54')](function(_0x207476){_0x1efb9d[_0x4567('0x65')](getAgents(_0xbe3b,_0x207476));});}});return BPromise[_0x4567('0x66')](_0x1efb9d)[_0x4567('0x2a')](function(_0x4cb06d){_0x260f13=_[_0x4567('0x60')](_0x260f13,_[_0x4567('0x67')](_0x4cb06d));_0x386c9f(_0x260f13);})['catch'](function(_0x27d004){_0x43ba01(_0x27d004);});});}function getAgents(_0x4a6559,_0x58d80f){return new BPromise(function(_0x14bf36,_0x495e7c){return db[_0x4a6559][_0x4567('0x59')]({'where':{'id':_0x58d80f}})[_0x4567('0x2a')](function(_0x31f2b4){return _0x31f2b4[_0x4567('0x68')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25b044){var _0x3f4ac2=_[_0x4567('0x69')](_0x25b044,'id');_0x14bf36(_0x3f4ac2);});})['catch'](function(_0x4da0b0){_0x495e7c(_0x4da0b0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 91aab75..b257601 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 _0x98b6=['UserNotification','save','emit','exports','events','../../mysqldb'];(function(_0x298784,_0x3e8ef9){var _0x554a8f=function(_0x13a7f5){while(--_0x13a7f5){_0x298784['push'](_0x298784['shift']());}};_0x554a8f(++_0x3e8ef9);}(_0x98b6,0xdc));var _0x698b=function(_0x396ad5,_0x2871a9){_0x396ad5=_0x396ad5-0x0;var _0x80015f=_0x98b6[_0x396ad5];return _0x80015f;};'use strict';var EventEmitter=require(_0x698b('0x0'));var UserNotification=require(_0x698b('0x1'))['db'][_0x698b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x698b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x51f77f){return function(_0x23d032,_0x575938,_0x2fea8b){UserNotificationEvents[_0x698b('0x4')](_0x51f77f+':'+_0x23d032['id'],_0x23d032);UserNotificationEvents[_0x698b('0x4')](_0x51f77f,_0x23d032);_0x2fea8b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x698b('0x5')]=UserNotificationEvents; \ No newline at end of file +var _0x7f82=['remove','hasOwnProperty','exports','../../mysqldb'];(function(_0x18d8e9,_0x2d9568){var _0x1b9102=function(_0x4ecf17){while(--_0x4ecf17){_0x18d8e9['push'](_0x18d8e9['shift']());}};_0x1b9102(++_0x2d9568);}(_0x7f82,0xe3));var _0x27f8=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x7f82[_0x4207f4];return _0x29a621;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x27f8('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x27f8('0x1')};function emitEvent(_0x78de94){return function(_0x46be07,_0x350a23,_0x46bfa4){UserNotificationEvents['emit'](_0x78de94+':'+_0x46be07['id'],_0x46be07);UserNotificationEvents['emit'](_0x78de94,_0x46be07);_0x46bfa4(null);};}for(var e in events){if(events[_0x27f8('0x2')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x27f8('0x3')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 82e7d0a..fdea6bd 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 _0x1d4b=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','utf8mb4_unicode_ci'];(function(_0xa46bc1,_0x523a08){var _0xc3c39a=function(_0x2c3087){while(--_0x2c3087){_0xa46bc1['push'](_0xa46bc1['shift']());}};_0xc3c39a(++_0x523a08);}(_0x1d4b,0x1d4));var _0xb1d4=function(_0x45cbf3,_0x55fdc1){_0x45cbf3=_0x45cbf3-0x0;var _0x73323b=_0x1d4b[_0x45cbf3];return _0x73323b;};'use strict';var _=require(_0xb1d4('0x0'));var util=require(_0xb1d4('0x1'));var logger=require('../../config/logger')(_0xb1d4('0x2'));var moment=require(_0xb1d4('0x3'));var BPromise=require(_0xb1d4('0x4'));var rp=require(_0xb1d4('0x5'));var fs=require('fs');var path=require(_0xb1d4('0x6'));var rimraf=require(_0xb1d4('0x7'));var config=require(_0xb1d4('0x8'));var attributes=require(_0xb1d4('0x9'));module['exports']=function(_0x4a6084,_0x658af8){return _0x4a6084[_0xb1d4('0xa')](_0xb1d4('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb1d4('0xc')});}; \ No newline at end of file +var _0x1848=['rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4c7036,_0x41066a){var _0x2a37f0=function(_0x2eb343){while(--_0x2eb343){_0x4c7036['push'](_0x4c7036['shift']());}};_0x2a37f0(++_0x41066a);}(_0x1848,0x7d));var _0x8184=function(_0x4988d6,_0x22fed7){_0x4988d6=_0x4988d6-0x0;var _0x36ca10=_0x1848[_0x4988d6];return _0x36ca10;};'use strict';var _=require('lodash');var util=require(_0x8184('0x0'));var logger=require(_0x8184('0x1'))('api');var moment=require(_0x8184('0x2'));var BPromise=require(_0x8184('0x3'));var rp=require(_0x8184('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8184('0x5'));var config=require('../../config/environment');var attributes=require(_0x8184('0x6'));module[_0x8184('0x7')]=function(_0x93f8e,_0x20b6b0){return _0x93f8e[_0x8184('0x8')](_0x8184('0x9'),attributes,{'tableName':_0x8184('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8184('0xb'),'collate':_0x8184('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 74bc4a0..6fbd22f 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 _0x5f07=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','error','code','UserNotification,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x287b93,_0x65d733){var _0x13ca78=function(_0x1c5ede){while(--_0x1c5ede){_0x287b93['push'](_0x287b93['shift']());}};_0x13ca78(++_0x65d733);}(_0x5f07,0x189));var _0x75f0=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x5f07[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x75f0('0x0'));var util=require(_0x75f0('0x1'));var moment=require(_0x75f0('0x2'));var BPromise=require(_0x75f0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75f0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x75f0('0x5'));var logger=require(_0x75f0('0x6'))(_0x75f0('0x7'));var config=require(_0x75f0('0x8'));var jayson=require(_0x75f0('0x9'));var client=jayson[_0x75f0('0xa')][_0x75f0('0xb')]({'port':0x232a});config['redis']=_[_0x75f0('0xc')](config[_0x75f0('0xd')],{'host':_0x75f0('0xe'),'port':0x18eb});var socket=require(_0x75f0('0xf'))(new Redis(config[_0x75f0('0xd')]));require('./userNotification.socket')[_0x75f0('0x10')](socket);function respondWithRpcPromise(_0xe2932a,_0x1d215b,_0x19f742){return new BPromise(function(_0x47df7e,_0x291c98){return client['request'](_0xe2932a,_0x19f742)['then'](function(_0x3930ab){logger[_0x75f0('0x11')]('UserNotification,\x20%s,\x20%s',_0x1d215b,_0x75f0('0x12'));logger[_0x75f0('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x1d215b,'request\x20sent',JSON['stringify'](_0x3930ab));if(_0x3930ab[_0x75f0('0x14')]){if(_0x3930ab['error'][_0x75f0('0x15')]===0x1f4){logger[_0x75f0('0x14')](_0x75f0('0x16'),_0x1d215b,_0x3930ab[_0x75f0('0x14')][_0x75f0('0x17')]);return _0x291c98(_0x3930ab[_0x75f0('0x14')][_0x75f0('0x17')]);}logger[_0x75f0('0x14')](_0x75f0('0x16'),_0x1d215b,_0x3930ab[_0x75f0('0x14')][_0x75f0('0x17')]);return _0x47df7e(_0x3930ab[_0x75f0('0x14')][_0x75f0('0x17')]);}else{logger[_0x75f0('0x11')](_0x75f0('0x16'),_0x1d215b,_0x75f0('0x12'));_0x47df7e(_0x3930ab['result'][_0x75f0('0x17')]);}})[_0x75f0('0x18')](function(_0x2e0491){logger['error'](_0x75f0('0x16'),_0x1d215b,_0x2e0491);_0x291c98(_0x2e0491);});});} \ No newline at end of file +var _0x8b18=['info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./userNotification.socket','register','request','then'];(function(_0x579bc0,_0x4c1d82){var _0x320f29=function(_0x4cd885){while(--_0x4cd885){_0x579bc0['push'](_0x579bc0['shift']());}};_0x320f29(++_0x4c1d82);}(_0x8b18,0x17f));var _0x88b1=function(_0x2d5ba6,_0x207e34){_0x2d5ba6=_0x2d5ba6-0x0;var _0x55f046=_0x8b18[_0x2d5ba6];return _0x55f046;};'use strict';var _=require(_0x88b1('0x0'));var util=require(_0x88b1('0x1'));var moment=require('moment');var BPromise=require(_0x88b1('0x2'));var rs=require(_0x88b1('0x3'));var fs=require('fs');var Redis=require(_0x88b1('0x4'));var db=require(_0x88b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x88b1('0x6'))(_0x88b1('0x7'));var config=require(_0x88b1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x88b1('0x9')]({'port':0x232a});config[_0x88b1('0xa')]=_[_0x88b1('0xb')](config['redis'],{'host':_0x88b1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88b1('0xa')]));require(_0x88b1('0xd'))[_0x88b1('0xe')](socket);function respondWithRpcPromise(_0x58941e,_0x52161a,_0x253245){return new BPromise(function(_0x421231,_0x469f08){return client[_0x88b1('0xf')](_0x58941e,_0x253245)[_0x88b1('0x10')](function(_0x1ce658){logger[_0x88b1('0x11')](_0x88b1('0x12'),_0x52161a,_0x88b1('0x13'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x52161a,_0x88b1('0x13'),JSON[_0x88b1('0x14')](_0x1ce658));if(_0x1ce658[_0x88b1('0x15')]){if(_0x1ce658['error'][_0x88b1('0x16')]===0x1f4){logger[_0x88b1('0x15')]('UserNotification,\x20%s,\x20%s',_0x52161a,_0x1ce658[_0x88b1('0x15')][_0x88b1('0x17')]);return _0x469f08(_0x1ce658[_0x88b1('0x15')][_0x88b1('0x17')]);}logger[_0x88b1('0x15')]('UserNotification,\x20%s,\x20%s',_0x52161a,_0x1ce658['error'][_0x88b1('0x17')]);return _0x421231(_0x1ce658[_0x88b1('0x15')][_0x88b1('0x17')]);}else{logger[_0x88b1('0x11')](_0x88b1('0x12'),_0x52161a,_0x88b1('0x13'));_0x421231(_0x1ce658[_0x88b1('0x18')][_0x88b1('0x17')]);}})['catch'](function(_0x55739d){logger['error']('UserNotification,\x20%s,\x20%s',_0x52161a,_0x55739d);_0x469f08(_0x55739d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index c016135..d6b47cc 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 _0x43a0=['register','length','userNotification:','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43a0,0x93));var _0x043a=function(_0x27b9ce,_0x5b6454){_0x27b9ce=_0x27b9ce-0x0;var _0xaeb39a=_0x43a0[_0x27b9ce];return _0xaeb39a;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0x043a('0x0')];function createListener(_0x343894,_0x12f336){return function(_0xbc63ec){_0x12f336[_0x043a('0x1')](_0x343894,_0xbc63ec);};}function removeListener(_0x1b008d,_0x242018){return function(){UserNotificationEvents[_0x043a('0x2')](_0x1b008d,_0x242018);};}exports[_0x043a('0x3')]=function(_0x3d8d7f){for(var _0x1f4833=0x0,_0x24aeda=events[_0x043a('0x4')];_0x1f4833<_0x24aeda;_0x1f4833++){var _0x26e657=events[_0x1f4833];var _0x53aee7=createListener(_0x043a('0x5')+_0x26e657,_0x3d8d7f);UserNotificationEvents['on'](_0x26e657,_0x53aee7);}}; \ No newline at end of file +var _0x750f=['register','length','./userNotification.events','emit'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x750f,0x1e6));var _0xf750=function(_0x29e33e,_0x257491){_0x29e33e=_0x29e33e-0x0;var _0x265092=_0x750f[_0x29e33e];return _0x265092;};'use strict';var UserNotificationEvents=require(_0xf750('0x0'));var events=['save','remove','update'];function createListener(_0x32e89c,_0x162421){return function(_0x5698ed){_0x162421[_0xf750('0x1')](_0x32e89c,_0x5698ed);};}function removeListener(_0x38a1e5,_0xafbf8e){return function(){UserNotificationEvents['removeListener'](_0x38a1e5,_0xafbf8e);};}exports[_0xf750('0x2')]=function(_0x17006c){for(var _0x113b35=0x0,_0x22225c=events[_0xf750('0x3')];_0x113b35<_0x22225c;_0x113b35++){var _0x16c40f=events[_0x113b35];var _0xccee6e=createListener('userNotification:'+_0x16c40f,_0x17006c);UserNotificationEvents['on'](_0x16c40f,_0xccee6e);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 5df967c..7203e65 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x43c89f,_0x32a64f){var _0x56a4fb=function(_0x15cf08){while(--_0x15cf08){_0x43c89f['push'](_0x43c89f['shift']());}};_0x56a4fb(++_0x32a64f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0xcb91[_0x53b133];return _0x5647e0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5d5cd5,_0x15f67b){var _0x57b340=function(_0x45b43b){while(--_0x45b43b){_0x5d5cd5['push'](_0x5d5cd5['shift']());}};_0x57b340(++_0x15f67b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 2d53fef..55691e8 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 _0xde7f=['sequelize'];(function(_0x535d1c,_0x3fd4e9){var _0x428f74=function(_0x383106){while(--_0x383106){_0x535d1c['push'](_0x535d1c['shift']());}};_0x428f74(++_0x3fd4e9);}(_0xde7f,0xa4));var _0xfde7=function(_0x111868,_0x2a55a4){_0x111868=_0x111868-0x0;var _0x46dafc=_0xde7f[_0x111868];return _0x46dafc;};'use strict';var Sequelize=require(_0xfde7('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe5b6=['sequelize','exports','INTEGER'];(function(_0x409708,_0x2d172e){var _0x311541=function(_0x7dda3a){while(--_0x7dda3a){_0x409708['push'](_0x409708['shift']());}};_0x311541(++_0x2d172e);}(_0xe5b6,0xc3));var _0x6e5b=function(_0x53ecf3,_0x300bb2){_0x53ecf3=_0x53ecf3-0x0;var _0xd8997d=_0xe5b6[_0x53ecf3];return _0xd8997d;};'use strict';var Sequelize=require(_0x6e5b('0x0'));module[_0x6e5b('0x1')]={'penalty':{'type':Sequelize[_0x6e5b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 437885e..91346ca 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 _0x8cde=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','util'];(function(_0x4d4092,_0x37717c){var _0x1b4151=function(_0x1054aa){while(--_0x1054aa){_0x4d4092['push'](_0x4d4092['shift']());}};_0x1b4151(++_0x37717c);}(_0x8cde,0xfc));var _0xe8cd=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0x8cde[_0x3f2228];return _0x285ae4;};'use strict';var _=require('lodash');var util=require(_0xe8cd('0x0'));var logger=require(_0xe8cd('0x1'))(_0xe8cd('0x2'));var moment=require(_0xe8cd('0x3'));var BPromise=require(_0xe8cd('0x4'));var rp=require(_0xe8cd('0x5'));var fs=require('fs');var path=require(_0xe8cd('0x6'));var rimraf=require('rimraf');var config=require(_0xe8cd('0x7'));var attributes=require(_0xe8cd('0x8'));module[_0xe8cd('0x9')]=function(_0x3914fb,_0x60243){return _0x3914fb['define'](_0xe8cd('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dba=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','lodash'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x4dba,0x15d));var _0xa4db=function(_0x3a056b,_0x4d0e47){_0x3a056b=_0x3a056b-0x0;var _0x4e8d19=_0x4dba[_0x3a056b];return _0x4e8d19;};'use strict';var _=require(_0xa4db('0x0'));var util=require('util');var logger=require(_0xa4db('0x1'))('api');var moment=require(_0xa4db('0x2'));var BPromise=require(_0xa4db('0x3'));var rp=require(_0xa4db('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4db('0x5'));var config=require(_0xa4db('0x6'));var attributes=require(_0xa4db('0x7'));module[_0xa4db('0x8')]=function(_0x23dca1,_0x1e500b){return _0x23dca1[_0xa4db('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index b9c01e3..0fd41ec 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 _0xea97=['code','message','result','catch','lodash','util','moment','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xea97,0x7c));var _0x7ea9=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xea97[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0x7ea9('0x0'));var util=require(_0x7ea9('0x1'));var moment=require(_0x7ea9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7ea9('0x3'))(_0x7ea9('0x4'));var config=require(_0x7ea9('0x5'));var jayson=require(_0x7ea9('0x6'));var client=jayson[_0x7ea9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17b0d2,_0x315847,_0x1ad681){return new BPromise(function(_0x58d331,_0x1e6bba){return client[_0x7ea9('0x8')](_0x17b0d2,_0x1ad681)['then'](function(_0x5f34f9){logger[_0x7ea9('0x9')](_0x7ea9('0xa'),_0x315847,_0x7ea9('0xb'));logger[_0x7ea9('0xc')](_0x7ea9('0xd'),_0x315847,_0x7ea9('0xb'),JSON[_0x7ea9('0xe')](_0x5f34f9));if(_0x5f34f9[_0x7ea9('0xf')]){if(_0x5f34f9[_0x7ea9('0xf')][_0x7ea9('0x10')]===0x1f4){logger['error'](_0x7ea9('0xa'),_0x315847,_0x5f34f9['error'][_0x7ea9('0x11')]);return _0x1e6bba(_0x5f34f9['error'][_0x7ea9('0x11')]);}logger[_0x7ea9('0xf')](_0x7ea9('0xa'),_0x315847,_0x5f34f9[_0x7ea9('0xf')][_0x7ea9('0x11')]);return _0x58d331(_0x5f34f9['error'][_0x7ea9('0x11')]);}else{logger[_0x7ea9('0x9')](_0x7ea9('0xa'),_0x315847,_0x7ea9('0xb'));_0x58d331(_0x5f34f9[_0x7ea9('0x12')][_0x7ea9('0x11')]);}})[_0x7ea9('0x13')](function(_0x6703cf){logger['error'](_0x7ea9('0xa'),_0x315847,_0x6703cf);_0x1e6bba(_0x6703cf);});});} \ No newline at end of file +var _0x3963=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3963,0xdd));var _0x3396=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x3963[_0x15d18f];return _0xd12bf7;};'use strict';var _=require('lodash');var util=require(_0x3396('0x0'));var moment=require(_0x3396('0x1'));var BPromise=require(_0x3396('0x2'));var rs=require(_0x3396('0x3'));var fs=require('fs');var Redis=require(_0x3396('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3396('0x5'));var logger=require(_0x3396('0x6'))('rpc');var config=require(_0x3396('0x7'));var jayson=require(_0x3396('0x8'));var client=jayson['client'][_0x3396('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b68f4,_0x1dae15,_0x1dcfd9){return new BPromise(function(_0x36969b,_0x4ce830){return client[_0x3396('0xa')](_0x2b68f4,_0x1dcfd9)[_0x3396('0xb')](function(_0x16cfff){logger['info'](_0x3396('0xc'),_0x1dae15,_0x3396('0xd'));logger[_0x3396('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1dae15,_0x3396('0xd'),JSON[_0x3396('0xf')](_0x16cfff));if(_0x16cfff['error']){if(_0x16cfff[_0x3396('0x10')][_0x3396('0x11')]===0x1f4){logger[_0x3396('0x10')](_0x3396('0xc'),_0x1dae15,_0x16cfff[_0x3396('0x10')][_0x3396('0x12')]);return _0x4ce830(_0x16cfff[_0x3396('0x10')][_0x3396('0x12')]);}logger[_0x3396('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1dae15,_0x16cfff[_0x3396('0x10')][_0x3396('0x12')]);return _0x36969b(_0x16cfff[_0x3396('0x10')][_0x3396('0x12')]);}else{logger[_0x3396('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1dae15,_0x3396('0xd'));_0x36969b(_0x16cfff[_0x3396('0x14')][_0x3396('0x12')]);}})[_0x3396('0x15')](function(_0x31761b){logger[_0x3396('0x10')](_0x3396('0xc'),_0x1dae15,_0x31761b);_0x4ce830(_0x31761b);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e3db362..b43b097 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 _0x6c47=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','/:id','delete','destroy','removeSections','removeResources','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c47,0xae));var _0x76c4=function(_0x2236fe,_0x4ef9e1){_0x2236fe=_0x2236fe-0x0;var _0x54ec9b=_0x6c47[_0x2236fe];return _0x54ec9b;};'use strict';var multer=require(_0x76c4('0x0'));var util=require(_0x76c4('0x1'));var path=require('path');var timeout=require(_0x76c4('0x2'));var express=require(_0x76c4('0x3'));var router=express[_0x76c4('0x4')]();var fs_extra=require(_0x76c4('0x5'));var auth=require(_0x76c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x76c4('0x7'));var controller=require(_0x76c4('0x8'));router[_0x76c4('0x9')]('/',auth['isAuthenticated'](),controller[_0x76c4('0xa')]);router[_0x76c4('0x9')](_0x76c4('0xb'),auth[_0x76c4('0xc')](),controller['describe']);router[_0x76c4('0x9')]('/:id',auth[_0x76c4('0xc')](),controller['show']);router[_0x76c4('0x9')](_0x76c4('0xd'),auth[_0x76c4('0xc')](),controller['getSections']);router[_0x76c4('0x9')](_0x76c4('0xe'),auth[_0x76c4('0xc')](),controller[_0x76c4('0xf')]);router[_0x76c4('0x10')]('/',auth[_0x76c4('0xc')](),controller[_0x76c4('0x11')]);router['post'](_0x76c4('0x12'),auth[_0x76c4('0xc')](),controller[_0x76c4('0x13')]);router['post'](_0x76c4('0xd'),auth[_0x76c4('0xc')](),controller[_0x76c4('0x14')]);router[_0x76c4('0x10')]('/:id/resources',auth[_0x76c4('0xc')](),controller[_0x76c4('0x15')]);router[_0x76c4('0x16')](_0x76c4('0x17'),auth[_0x76c4('0xc')](),controller['update']);router[_0x76c4('0x18')](_0x76c4('0x17'),auth[_0x76c4('0xc')](),controller[_0x76c4('0x19')]);router[_0x76c4('0x18')]('/:id/sections',auth['isAuthenticated'](),controller[_0x76c4('0x1a')]);router[_0x76c4('0x18')](_0x76c4('0xe'),auth[_0x76c4('0xc')](),controller[_0x76c4('0x1b')]);module[_0x76c4('0x1c')]=router; \ No newline at end of file +var _0x3407=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','show','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','put','/:id','delete','/:id/sections','removeResources','exports','multer','util','path'];(function(_0x3504a2,_0x5ca975){var _0x454e98=function(_0x494430){while(--_0x494430){_0x3504a2['push'](_0x3504a2['shift']());}};_0x454e98(++_0x5ca975);}(_0x3407,0x177));var _0x7340=function(_0x8f7418,_0x5e7511){_0x8f7418=_0x8f7418-0x0;var _0x36ff7b=_0x3407[_0x8f7418];return _0x36ff7b;};'use strict';var multer=require(_0x7340('0x0'));var util=require(_0x7340('0x1'));var path=require(_0x7340('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7340('0x3')]();var fs_extra=require(_0x7340('0x4'));var auth=require(_0x7340('0x5'));var interaction=require(_0x7340('0x6'));var config=require(_0x7340('0x7'));var controller=require(_0x7340('0x8'));router[_0x7340('0x9')]('/',auth[_0x7340('0xa')](),controller[_0x7340('0xb')]);router['get']('/describe',auth[_0x7340('0xa')](),controller[_0x7340('0xc')]);router[_0x7340('0x9')]('/:id',auth[_0x7340('0xa')](),controller[_0x7340('0xd')]);router[_0x7340('0x9')]('/:id/sections',auth['isAuthenticated'](),controller[_0x7340('0xe')]);router[_0x7340('0x9')](_0x7340('0xf'),auth[_0x7340('0xa')](),controller[_0x7340('0x10')]);router['post']('/',auth[_0x7340('0xa')](),controller['create']);router[_0x7340('0x11')](_0x7340('0x12'),auth[_0x7340('0xa')](),controller[_0x7340('0x13')]);router[_0x7340('0x11')]('/:id/sections',auth[_0x7340('0xa')](),controller[_0x7340('0x14')]);router['post'](_0x7340('0xf'),auth[_0x7340('0xa')](),controller['addResources']);router[_0x7340('0x15')](_0x7340('0x16'),auth[_0x7340('0xa')](),controller['update']);router[_0x7340('0x17')](_0x7340('0x16'),auth[_0x7340('0xa')](),controller['destroy']);router[_0x7340('0x17')](_0x7340('0x18'),auth['isAuthenticated'](),controller['removeSections']);router[_0x7340('0x17')](_0x7340('0xf'),auth[_0x7340('0xa')](),controller[_0x7340('0x19')]);module[_0x7340('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 119e58a..ca68a50 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 _0x7b10=['crudPermissions','getDataValue','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x5841c8,_0xe1dcc3){var _0x190fb9=function(_0x28dddd){while(--_0x28dddd){_0x5841c8['push'](_0x5841c8['shift']());}};_0x190fb9(++_0xe1dcc3);}(_0x7b10,0xab));var _0x07b1=function(_0x4bfb29,_0x232bd9){_0x4bfb29=_0x4bfb29-0x0;var _0x3a173e=_0x7b10[_0x4bfb29];return _0x3a173e;};'use strict';var Sequelize=require(_0x07b1('0x0'));module[_0x07b1('0x1')]={'name':{'type':Sequelize[_0x07b1('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x07b1('0x2')],'set':function(_0x5304f5){this[_0x07b1('0x3')](_0x07b1('0x4'),_0x5304f5?_0x5304f5['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x07b1('0x5')](_0x07b1('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x07b1('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x07b1('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x07b1('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x07b1('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x07b1('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x07b1('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x07b1('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x07b1('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3ed9=['join','getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions'];(function(_0x59af3a,_0x37de92){var _0x574a73=function(_0x12f719){while(--_0x12f719){_0x59af3a['push'](_0x59af3a['shift']());}};_0x574a73(++_0x37de92);}(_0x3ed9,0x151));var _0x93ed=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0x3ed9[_0x4c80d7];return _0x3c5095;};'use strict';var Sequelize=require(_0x93ed('0x0'));module['exports']={'name':{'type':Sequelize[_0x93ed('0x1')],'allowNull':![],'unique':_0x93ed('0x2')},'crudPermissions':{'type':Sequelize[_0x93ed('0x1')],'set':function(_0x27a1d5){this[_0x93ed('0x3')](_0x93ed('0x4'),_0x27a1d5?_0x27a1d5[_0x93ed('0x5')](''):[]);},'get':function(){return this[_0x93ed('0x6')](_0x93ed('0x4'))?this[_0x93ed('0x6')](_0x93ed('0x4'))[_0x93ed('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x93ed('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x93ed('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x93ed('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x93ed('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x93ed('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x93ed('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x93ed('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 139f888..e4dff9a 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 _0x46c1=['autoAssociation','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./userProfile.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','then','error','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','UserProfile','findAll','rows','catch','params','keys','create','clone','omit','createdAt','updatedAt','body','sequelize','transaction','get','UserProfileSection','each','UserProfileResource','sectionId','Resources','update','find','describe','addSections','destroy','userProfileId','removeSections','includes','isEmpty','enabled','subsections','push'];(function(_0x248b8e,_0x369273){var _0x1dab3e=function(_0x554829){while(--_0x554829){_0x248b8e['push'](_0x248b8e['shift']());}};_0x1dab3e(++_0x369273);}(_0x46c1,0x7c));var _0x146c=function(_0x523db2,_0x12b854){_0x523db2=_0x523db2-0x0;var _0x3efa08=_0x46c1[_0x523db2];return _0x3efa08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x146c('0x0'));var zipdir=require(_0x146c('0x1'));var jsonpatch=require(_0x146c('0x2'));var rp=require(_0x146c('0x3'));var moment=require(_0x146c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x146c('0x5'));var util=require(_0x146c('0x6'));var path=require(_0x146c('0x7'));var sox=require(_0x146c('0x8'));var csv=require(_0x146c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x146c('0xa'));var squel=require(_0x146c('0xb'));var crypto=require(_0x146c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x146c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x146c('0xe'));var Papa=require(_0x146c('0xf'));var Redis=require('ioredis');var authService=require(_0x146c('0x10'));var qs=require(_0x146c('0x11'));var as=require(_0x146c('0x12'));var hardwareService=require(_0x146c('0x13'));var logger=require('../../config/logger')(_0x146c('0x14'));var utils=require('../../config/utils');var config=require(_0x146c('0x15'));var licenseUtil=require(_0x146c('0x16'));var db=require(_0x146c('0x17'))['db'];config['redis']=_[_0x146c('0x18')](config['redis'],{'host':_0x146c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x146c('0x1a')]));require(_0x146c('0x1b'))[_0x146c('0x1c')](socket);function respondWithStatusCode(_0x1cd513,_0x542a59){_0x542a59=_0x542a59||0xcc;return function(_0x297c83){if(_0x297c83){return _0x1cd513[_0x146c('0x1d')](_0x542a59);}return _0x1cd513['status'](_0x542a59)[_0x146c('0x1e')]();};}function respondWithResult(_0x50bdae,_0x4a554b){_0x4a554b=_0x4a554b||0xc8;return function(_0x15aaf4){if(_0x15aaf4){return _0x50bdae['status'](_0x4a554b)[_0x146c('0x1f')](_0x15aaf4);}};}function respondWithFilteredResult(_0x1543f4,_0x731da7){return function(_0x4b1f21){if(_0x4b1f21){var _0x4335e4=typeof _0x731da7[_0x146c('0x20')]===_0x146c('0x21')&&typeof _0x731da7[_0x146c('0x22')]===_0x146c('0x21');var _0x3d469f=_0x4b1f21[_0x146c('0x23')];var _0x2e8fe1=_0x4335e4?0x0:_0x731da7[_0x146c('0x20')];var _0x4c5d93=_0x4335e4?_0x4b1f21[_0x146c('0x23')]:_0x731da7[_0x146c('0x20')]+_0x731da7[_0x146c('0x22')];var _0x8e7792;if(_0x4c5d93>=_0x3d469f){_0x4c5d93=_0x3d469f;_0x8e7792=0xc8;}else{_0x8e7792=0xce;}_0x1543f4[_0x146c('0x24')](_0x8e7792);return _0x1543f4['set']('Content-Range',_0x2e8fe1+'-'+_0x4c5d93+'/'+_0x3d469f)[_0x146c('0x1f')](_0x4b1f21);}return null;};}function patchUpdates(_0x26f5ed){return function(_0x133825){try{jsonpatch[_0x146c('0x25')](_0x133825,_0x26f5ed,!![]);}catch(_0x4c6d56){return BPromise[_0x146c('0x26')](_0x4c6d56);}return _0x133825[_0x146c('0x27')]();};}function saveUpdates(_0xbe3d5f,_0x153fe0){return function(_0x441cd8){if(_0x441cd8){return _0x441cd8['update'](_0xbe3d5f)['then'](function(_0x1257ff){return _0x1257ff;});}return null;};}function removeEntity(_0x3651b3,_0x393e6c){return function(_0x46c83c){if(_0x46c83c){return _0x46c83c['destroy']()[_0x146c('0x28')](function(){_0x3651b3[_0x146c('0x24')](0xcc)[_0x146c('0x1e')]();});}};}function handleEntityNotFound(_0x3ad5fb,_0x109a3f){return function(_0x2298c0){if(!_0x2298c0){_0x3ad5fb[_0x146c('0x1d')](0x194);}return _0x2298c0;};}function handleError(_0x428157,_0x3bd8b5){_0x3bd8b5=_0x3bd8b5||0x1f4;return function(_0x5158b2){logger[_0x146c('0x29')](_0x5158b2['stack']);if(_0x5158b2['name']){delete _0x5158b2[_0x146c('0x2a')];}_0x428157[_0x146c('0x24')](_0x3bd8b5)[_0x146c('0x2b')](_0x5158b2);};}exports[_0x146c('0x2c')]=function(_0xed735b,_0x2e07e3){var _0x2073e1={},_0x137f4c={},_0x3d5ca9={'count':0x0,'rows':[]};var _0x19c71d=_[_0x146c('0x2d')](db['UserProfile'][_0x146c('0x2e')],function(_0x15d941){return{'name':_0x15d941['fieldName'],'type':_0x15d941[_0x146c('0x2f')][_0x146c('0x30')]};});_0x137f4c[_0x146c('0x31')]=_[_0x146c('0x2d')](_0x19c71d,_0x146c('0x2a'));_0x137f4c['query']=_['keys'](_0xed735b[_0x146c('0x32')]);_0x137f4c[_0x146c('0x33')]=_[_0x146c('0x34')](_0x137f4c[_0x146c('0x31')],_0x137f4c[_0x146c('0x32')]);_0x2073e1['attributes']=_[_0x146c('0x34')](_0x137f4c[_0x146c('0x31')],qs[_0x146c('0x35')](_0xed735b[_0x146c('0x32')]['fields']));_0x2073e1[_0x146c('0x36')]=_0x2073e1[_0x146c('0x36')][_0x146c('0x37')]?_0x2073e1[_0x146c('0x36')]:_0x137f4c[_0x146c('0x31')];if(!_0xed735b[_0x146c('0x32')][_0x146c('0x38')](_0x146c('0x39'))){_0x2073e1[_0x146c('0x22')]=qs[_0x146c('0x22')](_0xed735b[_0x146c('0x32')][_0x146c('0x22')]);_0x2073e1[_0x146c('0x20')]=qs[_0x146c('0x20')](_0xed735b[_0x146c('0x32')][_0x146c('0x20')]);}_0x2073e1['order']=qs[_0x146c('0x3a')](_0xed735b['query'][_0x146c('0x3a')]);_0x2073e1[_0x146c('0x3b')]=qs['filters'](_[_0x146c('0x3c')](_0xed735b['query'],_0x137f4c['filters']),_0x19c71d);if(_0xed735b[_0x146c('0x32')][_0x146c('0x3d')]){_0x2073e1[_0x146c('0x3b')]=_[_0x146c('0x3e')](_0x2073e1[_0x146c('0x3b')],{'$or':_['map'](_0x19c71d,function(_0x4441b8){if(_0x4441b8[_0x146c('0x2f')]!=='VIRTUAL'){var _0x20b998={};_0x20b998[_0x4441b8[_0x146c('0x2a')]]={'$like':'%'+_0xed735b[_0x146c('0x32')][_0x146c('0x3d')]+'%'};return _0x20b998;}})});}_0x2073e1=_[_0x146c('0x3e')]({},_0x2073e1,_0xed735b[_0x146c('0x3f')]);var _0x351070={'where':_0x2073e1[_0x146c('0x3b')]};return db['UserProfile'][_0x146c('0x23')](_0x351070)[_0x146c('0x28')](function(_0x1c8cbe){_0x3d5ca9[_0x146c('0x23')]=_0x1c8cbe;if(_0xed735b[_0x146c('0x32')][_0x146c('0x40')]){_0x2073e1[_0x146c('0x41')]=[{'all':!![]}];}return db[_0x146c('0x42')][_0x146c('0x43')](_0x2073e1);})[_0x146c('0x28')](function(_0x58d7ec){_0x3d5ca9[_0x146c('0x44')]=_0x58d7ec;return _0x3d5ca9;})[_0x146c('0x28')](respondWithFilteredResult(_0x2e07e3,_0x2073e1))[_0x146c('0x45')](handleError(_0x2e07e3,null));};exports['show']=function(_0x7c5de2,_0x1d2d68){var _0x2d098d={'raw':![],'where':{'id':_0x7c5de2[_0x146c('0x46')]['id']}},_0x5150dd={};_0x5150dd[_0x146c('0x31')]=_['keys'](db[_0x146c('0x42')][_0x146c('0x2e')]);_0x5150dd[_0x146c('0x32')]=_[_0x146c('0x47')](_0x7c5de2[_0x146c('0x32')]);_0x5150dd['filters']=_['intersection'](_0x5150dd[_0x146c('0x31')],_0x5150dd['query']);_0x2d098d[_0x146c('0x36')]=_[_0x146c('0x34')](_0x5150dd[_0x146c('0x31')],qs['fields'](_0x7c5de2[_0x146c('0x32')][_0x146c('0x35')]));_0x2d098d[_0x146c('0x36')]=_0x2d098d[_0x146c('0x36')][_0x146c('0x37')]?_0x2d098d['attributes']:_0x5150dd['model'];if(_0x7c5de2[_0x146c('0x32')][_0x146c('0x40')]){_0x2d098d[_0x146c('0x41')]=[{'all':!![]}];}_0x2d098d=_[_0x146c('0x3e')]({},_0x2d098d,_0x7c5de2[_0x146c('0x3f')]);return db[_0x146c('0x42')]['find'](_0x2d098d)[_0x146c('0x28')](handleEntityNotFound(_0x1d2d68,null))['then'](respondWithResult(_0x1d2d68,null))[_0x146c('0x45')](handleError(_0x1d2d68,null));};exports[_0x146c('0x48')]=function(_0x5a6e88,_0x58f581){return db[_0x146c('0x42')]['create'](_0x5a6e88['body'],{})['then'](respondWithResult(_0x58f581,0xc9))[_0x146c('0x45')](handleError(_0x58f581,null));};exports[_0x146c('0x49')]=function(_0x36af4c,_0x21c1ad){var _0x4d59e2={'where':{'id':_0x36af4c[_0x146c('0x46')]['id']}},_0x4ae818={};_0x4ae818['model']=_[_0x146c('0x47')](db[_0x146c('0x42')][_0x146c('0x2e')]);_0x4d59e2[_0x146c('0x36')]=_[_0x146c('0x34')](_0x4ae818[_0x146c('0x31')],qs[_0x146c('0x35')](_0x36af4c['query']['fields']));_0x4d59e2['attributes']=_0x4d59e2[_0x146c('0x36')]['length']?_0x4d59e2[_0x146c('0x36')]:_0x4ae818[_0x146c('0x31')];if(_0x36af4c[_0x146c('0x32')][_0x146c('0x40')]){_0x4d59e2[_0x146c('0x41')]=[{'all':!![]}];}_0x4d59e2=_[_0x146c('0x3e')]({},_0x4d59e2,_0x36af4c[_0x146c('0x3f')]);return db[_0x146c('0x42')]['find'](_0x4d59e2)['then'](handleEntityNotFound(_0x21c1ad,null))['then'](function(_0x199280){if(_0x199280){var _0x491c54=_0x199280['get']({'plain':!![]});_0x491c54=qs[_0x146c('0x4a')](_0x491c54,['id',_0x146c('0x4b'),_0x146c('0x4c'),'crudPermissions']);_0x36af4c['body']=_['omit'](_0x36af4c[_0x146c('0x4d')],['id',_0x146c('0x4b'),_0x146c('0x4c')]);return db[_0x146c('0x4e')][_0x146c('0x4f')](function(_0x3e8101){return db['UserProfile']['create'](_[_0x146c('0x3e')](_0x491c54,_0x36af4c[_0x146c('0x4d')]),{'include':_0x36af4c['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3e8101})[_0x146c('0x28')](function(_0x55f0d3){var _0x410808=_0x55f0d3[_0x146c('0x50')]({'plain':!![]});return db[_0x146c('0x51')][_0x146c('0x43')]({'where':{'userProfileId':_0x36af4c[_0x146c('0x46')]['id']},'raw':!![]})['then'](function(_0x1dfe6a){if(_0x1dfe6a){return BPromise[_0x146c('0x52')](_0x1dfe6a,function(_0x1e52d3){return new BPromise(function(_0x229f10,_0x105727){if(_0x1e52d3['autoAssociation']===null||_0x1e52d3['autoAssociation']===0x1)_0x229f10(null);return db[_0x146c('0x53')]['findAll']({'where':{'sectionId':_0x1e52d3['id']},'raw':!![]})[_0x146c('0x28')](function(_0x5d1a2a){var _0x3d239e=_[_0x146c('0x2d')](_0x5d1a2a,function(_0x4d8abb){return qs[_0x146c('0x4a')](_0x4d8abb,['id',_0x146c('0x4b'),_0x146c('0x4c'),_0x146c('0x54')]);});_0x229f10(_0x3d239e);})[_0x146c('0x45')](function(_0x129a75){_0x105727(_0x129a75);});})['then'](function(_0x2d8498){var _0x4f2b73=qs[_0x146c('0x4a')](_0x1e52d3,['id',_0x146c('0x4b'),'updatedAt']);_0x4f2b73['userProfileId']=_0x410808['id'];if(_0x2d8498)_0x4f2b73[_0x146c('0x55')]=_0x2d8498;return _0x4f2b73;})[_0x146c('0x28')](function(_0x3a9edc){return db[_0x146c('0x51')][_0x146c('0x48')](_0x3a9edc,{'include':[{'model':db['UserProfileResource'],'as':_0x146c('0x55')}],'raw':!![],'transaction':_0x3e8101});});})[_0x146c('0x28')](function(){return _0x410808;});}});});});}})[_0x146c('0x28')](respondWithResult(_0x21c1ad,0xc9))[_0x146c('0x45')](handleError(_0x21c1ad,null));};exports[_0x146c('0x56')]=function(_0x3f2fcc,_0x53dbda){if(_0x3f2fcc[_0x146c('0x4d')]['id']){delete _0x3f2fcc['body']['id'];}return db[_0x146c('0x42')][_0x146c('0x57')]({'where':{'id':_0x3f2fcc['params']['id']}})['then'](handleEntityNotFound(_0x53dbda,null))[_0x146c('0x28')](saveUpdates(_0x3f2fcc[_0x146c('0x4d')],null))[_0x146c('0x28')](respondWithResult(_0x53dbda,null))[_0x146c('0x45')](handleError(_0x53dbda,null));};exports['destroy']=function(_0x595dc2,_0x58211e){return db[_0x146c('0x42')][_0x146c('0x57')]({'where':{'id':_0x595dc2[_0x146c('0x46')]['id']}})[_0x146c('0x28')](handleEntityNotFound(_0x58211e,null))[_0x146c('0x28')](removeEntity(_0x58211e,null))['catch'](handleError(_0x58211e,null));};exports[_0x146c('0x58')]=function(_0x176b04,_0x26decc){return db[_0x146c('0x42')][_0x146c('0x58')]()['then'](respondWithResult(_0x26decc,null))['catch'](handleError(_0x26decc,null));};exports[_0x146c('0x59')]=function(_0x63b02d,_0x17ff2e){var _0x257320=_0x63b02d['body'];return db[_0x146c('0x42')][_0x146c('0x57')]({'where':{'id':_0x63b02d[_0x146c('0x46')]['id']}})[_0x146c('0x28')](handleEntityNotFound(_0x17ff2e,null))['then'](function(_0x5520a5){if(_0x5520a5){return db[_0x146c('0x4e')][_0x146c('0x4f')](function(_0x5d53aa){return db[_0x146c('0x51')][_0x146c('0x5a')]({'where':{'userProfileId':_0x63b02d[_0x146c('0x46')]['id'],'sectionId':_[_0x146c('0x2d')](_0x257320,function(_0x1e6d26){return _0x1e6d26[_0x146c('0x54')];})},'transaction':_0x5d53aa})[_0x146c('0x28')](function(){var _0x5168d0=_[_0x146c('0x2d')](_0x257320,function(_0x1df3c9){_0x1df3c9[_0x146c('0x5b')]=_0x63b02d[_0x146c('0x46')]['id'];return _0x1df3c9;});var _0x18ad68=[];return BPromise[_0x146c('0x52')](_0x5168d0,function(_0x303ec1){return db[_0x146c('0x51')][_0x146c('0x48')](_0x303ec1,{'include':[{'model':db[_0x146c('0x53')],'as':_0x146c('0x55')}],'raw':!![],'transaction':_0x5d53aa})[_0x146c('0x28')](function(_0x37cd2e){_0x18ad68['push'](_0x37cd2e['get']({'plain':!![]}));});})[_0x146c('0x28')](function(){return _0x18ad68;});});});}})[_0x146c('0x28')](function(_0x31bc71){return _0x31bc71;})[_0x146c('0x28')](respondWithResult(_0x17ff2e,null))[_0x146c('0x45')](handleError(_0x17ff2e,null));};exports[_0x146c('0x5c')]=function(_0xd63b64,_0x3a7993){var _0x1e864a;return db[_0x146c('0x42')][_0x146c('0x57')]({'where':{'id':_0xd63b64[_0x146c('0x46')]['id']},'attributes':['id',_0x146c('0x2a')]})['then'](handleEntityNotFound(_0x3a7993,null))[_0x146c('0x28')](function(_0x4a0649){if(_0x4a0649){_0x1e864a=_0x4a0649;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0xd63b64[_0x146c('0x46')]['id'],'sectionId':_0xd63b64[_0x146c('0x32')]['ids']}});}})[_0x146c('0x28')](function(){return _0x1e864a;})[_0x146c('0x28')](respondWithStatusCode(_0x3a7993,null))[_0x146c('0x45')](handleError(_0x3a7993,null));};exports['getSections']=function(_0x1e5025,_0x311f26){var _0x120ab0=[];var _0x36be03=[];return db[_0x146c('0x51')][_0x146c('0x43')]({'where':{'userProfileId':_0x1e5025[_0x146c('0x46')]['id']},'raw':!![]})[_0x146c('0x28')](function(_0x584f1a){_0x120ab0=_['filter'](_0x584f1a,function(_0x2fa59f){return _0x2fa59f['enabled']===0x1||_[_0x146c('0x5d')]([0x3eb,0x709],_0x2fa59f[_0x146c('0x54')]);});if(!_[_0x146c('0x5e')](_0x120ab0)){return _[_0x146c('0x2d')](_0x120ab0,function(_0x263cf3){return _0x263cf3[_0x146c('0x54')];});}else{return;}})[_0x146c('0x28')](function(_0xd22076){if(_0xd22076)_0x36be03=_0xd22076;if(_[_0x146c('0x5d')](_0x36be03,0x64)){var _0x45f59d=_['find'](_0x120ab0,{'sectionId':0x64});return hasDefaultDashboard(_0x45f59d)[_0x146c('0x28')](function(_0x593a85){return _[_0x146c('0x2d')](_0x120ab0,function(_0x5842e8){if(_0x5842e8['sectionId']===0x64){_0x5842e8['subsections']=_0x593a85;}return _0x5842e8;});});}else{return;}})[_0x146c('0x28')](function(_0xed0e88){if(_0xed0e88)_0x120ab0=_0xed0e88;if(_[_0x146c('0x5d')](_0x36be03,0x3eb)){var _0x23106b=_[_0x146c('0x57')](_0x120ab0,{'sectionId':0x3eb});return getCustomDashboards(_0x23106b)[_0x146c('0x28')](function(_0x3359d9){return _[_0x146c('0x2d')](_0x120ab0,function(_0x123ea4){if(_0x23106b[_0x146c('0x5f')]){if(_0x123ea4['sectionId']===0x3eb){_0x123ea4[_0x146c('0x60')]=_0x3359d9;}}else{if(_0x123ea4[_0x146c('0x54')]===0x64){_0x123ea4[_0x146c('0x60')]=_0x3359d9;}}return _0x123ea4;});});}else{return;}})[_0x146c('0x28')](function(_0x38aee4){if(_0x38aee4)_0x120ab0=_0x38aee4;if(_[_0x146c('0x5d')](_0x36be03,0x709)){var _0x16565f=_[_0x146c('0x57')](_0x120ab0,{'sectionId':0x709});return getPlugins(_0x16565f)['then'](function(_0x25bc89){if(_0x16565f[_0x146c('0x5f')]){return _[_0x146c('0x2d')](_0x120ab0,function(_0x5d026c){if(_0x5d026c[_0x146c('0x54')]===0x709){_0x5d026c[_0x146c('0x60')]=_0x25bc89;}return _0x5d026c;});}else{var _0x22fb6b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x25bc89};var _0x3f05f6=_[_0x146c('0x2d')](_0x120ab0);_0x3f05f6[_0x146c('0x61')](_0x22fb6b);return _0x3f05f6;}});}else{return;}})[_0x146c('0x28')](function(_0x2f868c){if(_0x2f868c)_0x120ab0=_0x2f868c;return _[_0x146c('0x3d')](_0x120ab0,[_0x146c('0x5f'),0x1]);})['then'](respondWithResult(_0x311f26,null))[_0x146c('0x45')](handleError(_0x311f26,null));};function hasDefaultDashboard(_0x39fe31){var _0x1cc41a=[0x65];return new BPromise(function(_0x528595,_0x820e20){try{if(_0x39fe31[_0x146c('0x62')]){_0x528595(_0x1cc41a);}else{return db['UserProfileResource'][_0x146c('0x63')]({'where':{'sectionId':_0x39fe31['id']},'raw':!![]})['then'](function(_0x5c4936){_0x5c4936?_0x528595(_0x1cc41a):_0x528595();});}}catch(_0x2f23f5){_0x820e20(_0x2f23f5);}});}function getCustomDashboards(_0x565ec9){var _0x571ae8=[];return new BPromise(function(_0x101530,_0x24f79c){try{if(_0x565ec9[_0x146c('0x62')]){return db['Dashboard'][_0x146c('0x43')]({'raw':!![]})[_0x146c('0x28')](function(_0x111e3c){_0x111e3c[_0x146c('0x64')](function(_0x3447f6){_0x571ae8[_0x146c('0x61')](_0x3447f6['id']+0x1869f);});_0x101530(_0x571ae8);});}else{return db['UserProfileResource'][_0x146c('0x43')]({'where':{'sectionId':_0x565ec9['id']},'raw':!![]})['then'](function(_0x34f26d){_0x34f26d['forEach'](function(_0x32727d){_0x571ae8[_0x146c('0x61')](_0x32727d[_0x146c('0x65')]+0x1869f);});_0x101530(_0x571ae8);});}}catch(_0x59d456){_0x24f79c(_0x59d456);}});}function getPlugins(_0x4a86d6){var _0x37adfa=[];return new BPromise(function(_0x5e5614,_0x30c1dd){try{if(_0x4a86d6[_0x146c('0x62')]){return db[_0x146c('0x66')][_0x146c('0x43')]({'raw':!![]})[_0x146c('0x28')](function(_0x12381e){_0x12381e[_0x146c('0x64')](function(_0x3b8a13){_0x37adfa[_0x146c('0x61')](_0x3b8a13['id']+0x15b38);});_0x5e5614(_0x37adfa);});}else{return db['UserProfileResource'][_0x146c('0x43')]({'where':{'sectionId':_0x4a86d6['id']},'raw':!![]})['then'](function(_0x5b7843){_0x5b7843[_0x146c('0x64')](function(_0x289ca8){_0x37adfa[_0x146c('0x61')](_0x289ca8[_0x146c('0x65')]+0x15b38);});_0x5e5614(_0x37adfa);});}}catch(_0x3c2a1c){_0x30c1dd(_0x3c2a1c);}});}exports[_0x146c('0x67')]=function(_0x554249,_0x3d5414){return db['UserProfile'][_0x146c('0x57')]({'where':{'id':_0x554249[_0x146c('0x46')]['id']}})[_0x146c('0x28')](handleEntityNotFound(_0x3d5414,null))[_0x146c('0x28')](function(_0xf62580){if(_0xf62580){return db[_0x146c('0x4e')][_0x146c('0x4f')](function(_0x1dcdfe){return db['UserProfileSection'][_0x146c('0x43')]({'where':{'userProfileId':_0x554249[_0x146c('0x46')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x538b89){if(_0x538b89){return db['UserProfileSection'][_0x146c('0x5a')]({'where':{'userProfileId':_0x554249[_0x146c('0x46')]['id'],'id':_[_0x146c('0x2d')](_0x538b89,function(_0x5d1033){return _0x5d1033['id'];})},'transaction':_0x1dcdfe});}})[_0x146c('0x28')](function(_0x2f6ad4){var _0x3a3058=_['map'](_0x554249[_0x146c('0x4d')],function(_0x444b67){_0x444b67['userProfileId']=_0x554249[_0x146c('0x46')]['id'];return _0x444b67;});return db[_0x146c('0x51')][_0x146c('0x68')](_0x3a3058,{'raw':!![],'transaction':_0x1dcdfe});})[_0x146c('0x28')](function(_0xc91429){var _0x350da1=_[_0x146c('0x3d')](_['map'](_0xc91429,function(_0x240ee8){return _0x240ee8[_0x146c('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x350da1){return db[_0x146c('0x51')]['findAll']({'where':{'userProfileId':_0x554249[_0x146c('0x46')]['id'],'sectionId':_['map'](_0x350da1,function(_0x58d0fb){return _0x58d0fb[_0x146c('0x54')];})},'attributes':['id',_0x146c('0x54')],'raw':!![]})['then'](function(_0x2807a6){var _0x5628c2=_[_0x146c('0x2d')](_0x554249[_0x146c('0x4d')],function(_0x18e104){_0x18e104[_0x146c('0x5b')]=_0x554249[_0x146c('0x46')]['id'];return _0x18e104;});return db[_0x146c('0x53')][_0x146c('0x68')](_0x5628c2,{'raw':!![],'transaction':_0x1dcdfe});});}})['catch'](handleError(_0x3d5414,null));});}})[_0x146c('0x28')](function(_0x5ba658){var _0x239782=_[_0x146c('0x2d')](_0x5ba658,function(_0x5742b9){return _0x5742b9[_0x146c('0x50')]({'plain':!![]});});})[_0x146c('0x28')](respondWithResult(_0x3d5414,null))[_0x146c('0x45')](handleError(_0x3d5414,null));};exports['removeResources']=function(_0x15c90a,_0x2f5e05,_0xd4f0dd){return db['UserProfile'][_0x146c('0x57')]({'where':{'id':_0x15c90a['params']['id']}})['then'](handleEntityNotFound(_0x2f5e05,null))[_0x146c('0x28')](function(_0x53f637){if(_0x53f637){return _0x53f637[_0x146c('0x69')](_0x15c90a[_0x146c('0x32')][_0x146c('0x6a')]);}})[_0x146c('0x28')](respondWithStatusCode(_0x2f5e05,null))[_0x146c('0x45')](handleError(_0x2f5e05,null));};exports['getResources']=function(_0x16c299,_0x278ecc){var _0x147980={};if(!_0x16c299[_0x146c('0x32')][_0x146c('0x6b')])throw new Error(_0x146c('0x6c'));if(!_0x16c299[_0x146c('0x32')]['hasOwnProperty'](_0x146c('0x39'))){_0x147980[_0x146c('0x22')]=qs['limit'](_0x16c299[_0x146c('0x32')][_0x146c('0x22')]);_0x147980['offset']=qs[_0x146c('0x20')](_0x16c299[_0x146c('0x32')][_0x146c('0x20')]);}return db[_0x146c('0x42')][_0x146c('0x57')]({'where':{'id':_0x16c299[_0x146c('0x46')]['id']}})[_0x146c('0x28')](function(_0x577db5){if(!_0x577db5)throw new Error(_0x146c('0x6d')+_0x16c299[_0x146c('0x46')]['id']);return db[_0x146c('0x42')][_0x146c('0x6e')](_0x16c299);})[_0x146c('0x28')](respondWithFilteredResult(_0x278ecc,_0x147980))['catch'](handleError(_0x278ecc,null));}; \ No newline at end of file +var _0xc692=['sequelize','sectionId','userProfileId','removeSections','ids','getSections','enabled','includes','subsections','push','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','register','end','undefined','limit','count','offset','status','set','json','apply','reject','update','then','destroy','sendStatus','stack','name','index','UserProfile','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','options','includeAll','include','rows','catch','show','keys','length','find','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','Resources','addSections'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc692,0x15f));var _0x2c69=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xc692[_0x24061a];return _0x82054e;};'use strict';var emlformat=require(_0x2c69('0x0'));var rimraf=require(_0x2c69('0x1'));var zipdir=require(_0x2c69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2c69('0x3'));var BPromise=require(_0x2c69('0x4'));var Mustache=require(_0x2c69('0x5'));var util=require(_0x2c69('0x6'));var path=require(_0x2c69('0x7'));var sox=require(_0x2c69('0x8'));var csv=require(_0x2c69('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c69('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c69('0xb'));var jsforce=require(_0x2c69('0xc'));var deskjs=require(_0x2c69('0xd'));var toCsv=require(_0x2c69('0x9'));var querystring=require(_0x2c69('0xe'));var Papa=require(_0x2c69('0xf'));var Redis=require('ioredis');var authService=require(_0x2c69('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2c69('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c69('0x12'))(_0x2c69('0x13'));var utils=require(_0x2c69('0x14'));var config=require(_0x2c69('0x15'));var licenseUtil=require(_0x2c69('0x16'));var db=require(_0x2c69('0x17'))['db'];config['redis']=_[_0x2c69('0x18')](config['redis'],{'host':_0x2c69('0x19'),'port':0x18eb});var socket=require(_0x2c69('0x1a'))(new Redis(config[_0x2c69('0x1b')]));require(_0x2c69('0x1c'))[_0x2c69('0x1d')](socket);function respondWithStatusCode(_0x211496,_0x5747d8){_0x5747d8=_0x5747d8||0xcc;return function(_0x2d0df5){if(_0x2d0df5){return _0x211496['sendStatus'](_0x5747d8);}return _0x211496['status'](_0x5747d8)[_0x2c69('0x1e')]();};}function respondWithResult(_0x4cabe5,_0x11649b){_0x11649b=_0x11649b||0xc8;return function(_0x5f5bd5){if(_0x5f5bd5){return _0x4cabe5['status'](_0x11649b)['json'](_0x5f5bd5);}};}function respondWithFilteredResult(_0x3bd4a3,_0x35d604){return function(_0xa1c51){if(_0xa1c51){var _0x5b4ca0=typeof _0x35d604['offset']===_0x2c69('0x1f')&&typeof _0x35d604[_0x2c69('0x20')]===_0x2c69('0x1f');var _0x5a9d56=_0xa1c51[_0x2c69('0x21')];var _0x5c3af1=_0x5b4ca0?0x0:_0x35d604[_0x2c69('0x22')];var _0x6f3a7e=_0x5b4ca0?_0xa1c51[_0x2c69('0x21')]:_0x35d604[_0x2c69('0x22')]+_0x35d604['limit'];var _0x823db7;if(_0x6f3a7e>=_0x5a9d56){_0x6f3a7e=_0x5a9d56;_0x823db7=0xc8;}else{_0x823db7=0xce;}_0x3bd4a3[_0x2c69('0x23')](_0x823db7);return _0x3bd4a3[_0x2c69('0x24')]('Content-Range',_0x5c3af1+'-'+_0x6f3a7e+'/'+_0x5a9d56)[_0x2c69('0x25')](_0xa1c51);}return null;};}function patchUpdates(_0x5775fa){return function(_0x528683){try{jsonpatch[_0x2c69('0x26')](_0x528683,_0x5775fa,!![]);}catch(_0x5cc6dc){return BPromise[_0x2c69('0x27')](_0x5cc6dc);}return _0x528683['save']();};}function saveUpdates(_0x58f00f,_0x3fb15c){return function(_0x39f7db){if(_0x39f7db){return _0x39f7db[_0x2c69('0x28')](_0x58f00f)[_0x2c69('0x29')](function(_0x12dbca){return _0x12dbca;});}return null;};}function removeEntity(_0x2edc86,_0x16425d){return function(_0x2a0569){if(_0x2a0569){return _0x2a0569[_0x2c69('0x2a')]()['then'](function(){_0x2edc86[_0x2c69('0x23')](0xcc)[_0x2c69('0x1e')]();});}};}function handleEntityNotFound(_0x4a7ebf,_0x1b29b8){return function(_0xd85b20){if(!_0xd85b20){_0x4a7ebf[_0x2c69('0x2b')](0x194);}return _0xd85b20;};}function handleError(_0x4c6ebe,_0x321f95){_0x321f95=_0x321f95||0x1f4;return function(_0xfe88bf){logger['error'](_0xfe88bf[_0x2c69('0x2c')]);if(_0xfe88bf[_0x2c69('0x2d')]){delete _0xfe88bf[_0x2c69('0x2d')];}_0x4c6ebe[_0x2c69('0x23')](_0x321f95)['send'](_0xfe88bf);};}exports[_0x2c69('0x2e')]=function(_0x77babf,_0x47a853){var _0x5c56a9={},_0x4ada2a={},_0x41d912={'count':0x0,'rows':[]};var _0x5cd649=_['map'](db[_0x2c69('0x2f')][_0x2c69('0x30')],function(_0x389dbf){return{'name':_0x389dbf[_0x2c69('0x31')],'type':_0x389dbf[_0x2c69('0x32')]['key']};});_0x4ada2a[_0x2c69('0x33')]=_[_0x2c69('0x34')](_0x5cd649,_0x2c69('0x2d'));_0x4ada2a[_0x2c69('0x35')]=_['keys'](_0x77babf[_0x2c69('0x35')]);_0x4ada2a[_0x2c69('0x36')]=_[_0x2c69('0x37')](_0x4ada2a[_0x2c69('0x33')],_0x4ada2a[_0x2c69('0x35')]);_0x5c56a9['attributes']=_[_0x2c69('0x37')](_0x4ada2a[_0x2c69('0x33')],qs[_0x2c69('0x38')](_0x77babf[_0x2c69('0x35')][_0x2c69('0x38')]));_0x5c56a9[_0x2c69('0x39')]=_0x5c56a9['attributes']['length']?_0x5c56a9[_0x2c69('0x39')]:_0x4ada2a[_0x2c69('0x33')];if(!_0x77babf[_0x2c69('0x35')]['hasOwnProperty'](_0x2c69('0x3a'))){_0x5c56a9[_0x2c69('0x20')]=qs[_0x2c69('0x20')](_0x77babf['query'][_0x2c69('0x20')]);_0x5c56a9[_0x2c69('0x22')]=qs[_0x2c69('0x22')](_0x77babf[_0x2c69('0x35')][_0x2c69('0x22')]);}_0x5c56a9['order']=qs[_0x2c69('0x3b')](_0x77babf[_0x2c69('0x35')][_0x2c69('0x3b')]);_0x5c56a9[_0x2c69('0x3c')]=qs[_0x2c69('0x36')](_['pick'](_0x77babf[_0x2c69('0x35')],_0x4ada2a[_0x2c69('0x36')]),_0x5cd649);if(_0x77babf[_0x2c69('0x35')][_0x2c69('0x3d')]){_0x5c56a9[_0x2c69('0x3c')]=_[_0x2c69('0x3e')](_0x5c56a9[_0x2c69('0x3c')],{'$or':_[_0x2c69('0x34')](_0x5cd649,function(_0x5c0853){if(_0x5c0853[_0x2c69('0x32')]!=='VIRTUAL'){var _0x5f0d69={};_0x5f0d69[_0x5c0853['name']]={'$like':'%'+_0x77babf[_0x2c69('0x35')][_0x2c69('0x3d')]+'%'};return _0x5f0d69;}})});}_0x5c56a9=_['merge']({},_0x5c56a9,_0x77babf[_0x2c69('0x3f')]);var _0x46ae32={'where':_0x5c56a9[_0x2c69('0x3c')]};return db['UserProfile']['count'](_0x46ae32)[_0x2c69('0x29')](function(_0x23feb4){_0x41d912['count']=_0x23feb4;if(_0x77babf['query'][_0x2c69('0x40')]){_0x5c56a9[_0x2c69('0x41')]=[{'all':!![]}];}return db[_0x2c69('0x2f')]['findAll'](_0x5c56a9);})[_0x2c69('0x29')](function(_0xd63179){_0x41d912[_0x2c69('0x42')]=_0xd63179;return _0x41d912;})['then'](respondWithFilteredResult(_0x47a853,_0x5c56a9))[_0x2c69('0x43')](handleError(_0x47a853,null));};exports[_0x2c69('0x44')]=function(_0x540d06,_0x7176ee){var _0x14cd5c={'raw':![],'where':{'id':_0x540d06['params']['id']}},_0x2068a0={};_0x2068a0[_0x2c69('0x33')]=_['keys'](db[_0x2c69('0x2f')]['rawAttributes']);_0x2068a0[_0x2c69('0x35')]=_[_0x2c69('0x45')](_0x540d06['query']);_0x2068a0[_0x2c69('0x36')]=_[_0x2c69('0x37')](_0x2068a0[_0x2c69('0x33')],_0x2068a0[_0x2c69('0x35')]);_0x14cd5c[_0x2c69('0x39')]=_[_0x2c69('0x37')](_0x2068a0['model'],qs[_0x2c69('0x38')](_0x540d06['query'][_0x2c69('0x38')]));_0x14cd5c[_0x2c69('0x39')]=_0x14cd5c[_0x2c69('0x39')][_0x2c69('0x46')]?_0x14cd5c['attributes']:_0x2068a0[_0x2c69('0x33')];if(_0x540d06[_0x2c69('0x35')]['includeAll']){_0x14cd5c['include']=[{'all':!![]}];}_0x14cd5c=_[_0x2c69('0x3e')]({},_0x14cd5c,_0x540d06[_0x2c69('0x3f')]);return db[_0x2c69('0x2f')][_0x2c69('0x47')](_0x14cd5c)[_0x2c69('0x29')](handleEntityNotFound(_0x7176ee,null))['then'](respondWithResult(_0x7176ee,null))['catch'](handleError(_0x7176ee,null));};exports[_0x2c69('0x48')]=function(_0x409b9c,_0x5d338d){return db[_0x2c69('0x2f')][_0x2c69('0x48')](_0x409b9c[_0x2c69('0x49')],{})[_0x2c69('0x29')](respondWithResult(_0x5d338d,0xc9))[_0x2c69('0x43')](handleError(_0x5d338d,null));};exports[_0x2c69('0x4a')]=function(_0x3ca9ff,_0x114beb){var _0x97c019={'where':{'id':_0x3ca9ff[_0x2c69('0x4b')]['id']}},_0x465e45={};_0x465e45[_0x2c69('0x33')]=_[_0x2c69('0x45')](db[_0x2c69('0x2f')][_0x2c69('0x30')]);_0x97c019['attributes']=_[_0x2c69('0x37')](_0x465e45[_0x2c69('0x33')],qs['fields'](_0x3ca9ff[_0x2c69('0x35')]['fields']));_0x97c019[_0x2c69('0x39')]=_0x97c019[_0x2c69('0x39')]['length']?_0x97c019[_0x2c69('0x39')]:_0x465e45[_0x2c69('0x33')];if(_0x3ca9ff[_0x2c69('0x35')][_0x2c69('0x40')]){_0x97c019[_0x2c69('0x41')]=[{'all':!![]}];}_0x97c019=_[_0x2c69('0x3e')]({},_0x97c019,_0x3ca9ff[_0x2c69('0x3f')]);return db[_0x2c69('0x2f')][_0x2c69('0x47')](_0x97c019)[_0x2c69('0x29')](handleEntityNotFound(_0x114beb,null))['then'](function(_0x1c50dd){if(_0x1c50dd){var _0x2aeef9=_0x1c50dd[_0x2c69('0x4c')]({'plain':!![]});_0x2aeef9=qs[_0x2c69('0x4d')](_0x2aeef9,['id',_0x2c69('0x4e'),_0x2c69('0x4f'),_0x2c69('0x50')]);_0x3ca9ff['body']=_[_0x2c69('0x4d')](_0x3ca9ff[_0x2c69('0x49')],['id','createdAt','updatedAt']);return db['sequelize'][_0x2c69('0x51')](function(_0x3a960c){return db[_0x2c69('0x2f')]['create'](_['merge'](_0x2aeef9,_0x3ca9ff[_0x2c69('0x49')]),{'include':_0x3ca9ff['query'][_0x2c69('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x3a960c})[_0x2c69('0x29')](function(_0xf8348e){var _0x1947d8=_0xf8348e[_0x2c69('0x4c')]({'plain':!![]});return db[_0x2c69('0x52')][_0x2c69('0x53')]({'where':{'userProfileId':_0x3ca9ff[_0x2c69('0x4b')]['id']},'raw':!![]})['then'](function(_0xfb795a){if(_0xfb795a){return BPromise[_0x2c69('0x54')](_0xfb795a,function(_0xf98abe){return new BPromise(function(_0x2246f3,_0x5cc979){if(_0xf98abe[_0x2c69('0x55')]===null||_0xf98abe[_0x2c69('0x55')]===0x1)_0x2246f3(null);return db[_0x2c69('0x56')][_0x2c69('0x53')]({'where':{'sectionId':_0xf98abe['id']},'raw':!![]})['then'](function(_0x1b122f){var _0x12f224=_[_0x2c69('0x34')](_0x1b122f,function(_0x5eac27){return qs[_0x2c69('0x4d')](_0x5eac27,['id',_0x2c69('0x4e'),_0x2c69('0x4f'),'sectionId']);});_0x2246f3(_0x12f224);})[_0x2c69('0x43')](function(_0xffb257){_0x5cc979(_0xffb257);});})[_0x2c69('0x29')](function(_0x5c297e){var _0x1111c8=qs[_0x2c69('0x4d')](_0xf98abe,['id',_0x2c69('0x4e'),_0x2c69('0x4f')]);_0x1111c8['userProfileId']=_0x1947d8['id'];if(_0x5c297e)_0x1111c8[_0x2c69('0x57')]=_0x5c297e;return _0x1111c8;})['then'](function(_0xca04d9){return db['UserProfileSection'][_0x2c69('0x48')](_0xca04d9,{'include':[{'model':db[_0x2c69('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x3a960c});});})[_0x2c69('0x29')](function(){return _0x1947d8;});}});});});}})[_0x2c69('0x29')](respondWithResult(_0x114beb,0xc9))[_0x2c69('0x43')](handleError(_0x114beb,null));};exports[_0x2c69('0x28')]=function(_0x1172eb,_0xf2add0){if(_0x1172eb['body']['id']){delete _0x1172eb[_0x2c69('0x49')]['id'];}return db[_0x2c69('0x2f')][_0x2c69('0x47')]({'where':{'id':_0x1172eb[_0x2c69('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf2add0,null))['then'](saveUpdates(_0x1172eb[_0x2c69('0x49')],null))[_0x2c69('0x29')](respondWithResult(_0xf2add0,null))[_0x2c69('0x43')](handleError(_0xf2add0,null));};exports[_0x2c69('0x2a')]=function(_0x40f2c4,_0x135843){return db[_0x2c69('0x2f')][_0x2c69('0x47')]({'where':{'id':_0x40f2c4['params']['id']}})['then'](handleEntityNotFound(_0x135843,null))[_0x2c69('0x29')](removeEntity(_0x135843,null))[_0x2c69('0x43')](handleError(_0x135843,null));};exports['describe']=function(_0x2f9c11,_0x314df9){return db['UserProfile']['describe']()[_0x2c69('0x29')](respondWithResult(_0x314df9,null))[_0x2c69('0x43')](handleError(_0x314df9,null));};exports[_0x2c69('0x58')]=function(_0x137497,_0x247998){var _0x30a96a=_0x137497[_0x2c69('0x49')];return db['UserProfile']['find']({'where':{'id':_0x137497[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](handleEntityNotFound(_0x247998,null))[_0x2c69('0x29')](function(_0x28e49b){if(_0x28e49b){return db[_0x2c69('0x59')][_0x2c69('0x51')](function(_0x47148d){return db['UserProfileSection'][_0x2c69('0x2a')]({'where':{'userProfileId':_0x137497[_0x2c69('0x4b')]['id'],'sectionId':_[_0x2c69('0x34')](_0x30a96a,function(_0xab7adf){return _0xab7adf[_0x2c69('0x5a')];})},'transaction':_0x47148d})[_0x2c69('0x29')](function(){var _0x55608b=_['map'](_0x30a96a,function(_0x5227af){_0x5227af[_0x2c69('0x5b')]=_0x137497['params']['id'];return _0x5227af;});var _0x3c2375=[];return BPromise[_0x2c69('0x54')](_0x55608b,function(_0x2cf853){return db[_0x2c69('0x52')][_0x2c69('0x48')](_0x2cf853,{'include':[{'model':db['UserProfileResource'],'as':_0x2c69('0x57')}],'raw':!![],'transaction':_0x47148d})[_0x2c69('0x29')](function(_0x18b4fc){_0x3c2375['push'](_0x18b4fc['get']({'plain':!![]}));});})[_0x2c69('0x29')](function(){return _0x3c2375;});});});}})[_0x2c69('0x29')](function(_0x56fc88){return _0x56fc88;})[_0x2c69('0x29')](respondWithResult(_0x247998,null))[_0x2c69('0x43')](handleError(_0x247998,null));};exports[_0x2c69('0x5c')]=function(_0x195909,_0x1ef843){var _0x1e4e34;return db[_0x2c69('0x2f')][_0x2c69('0x47')]({'where':{'id':_0x195909[_0x2c69('0x4b')]['id']},'attributes':['id','name']})[_0x2c69('0x29')](handleEntityNotFound(_0x1ef843,null))[_0x2c69('0x29')](function(_0x1d436a){if(_0x1d436a){_0x1e4e34=_0x1d436a;return db[_0x2c69('0x52')][_0x2c69('0x2a')]({'where':{'userProfileId':_0x195909[_0x2c69('0x4b')]['id'],'sectionId':_0x195909[_0x2c69('0x35')][_0x2c69('0x5d')]}});}})[_0x2c69('0x29')](function(){return _0x1e4e34;})['then'](respondWithStatusCode(_0x1ef843,null))['catch'](handleError(_0x1ef843,null));};exports[_0x2c69('0x5e')]=function(_0x51aad2,_0x48ec7c){var _0x4060a9=[];var _0x31c08a=[];return db[_0x2c69('0x52')][_0x2c69('0x53')]({'where':{'userProfileId':_0x51aad2[_0x2c69('0x4b')]['id']},'raw':!![]})[_0x2c69('0x29')](function(_0x39a6f8){_0x4060a9=_[_0x2c69('0x3d')](_0x39a6f8,function(_0x4b0360){return _0x4b0360[_0x2c69('0x5f')]===0x1||_[_0x2c69('0x60')]([0x3eb,0x709],_0x4b0360['sectionId']);});if(!_['isEmpty'](_0x4060a9)){return _[_0x2c69('0x34')](_0x4060a9,function(_0xfd8ff1){return _0xfd8ff1[_0x2c69('0x5a')];});}else{return;}})[_0x2c69('0x29')](function(_0x2ab91c){if(_0x2ab91c)_0x31c08a=_0x2ab91c;if(_['includes'](_0x31c08a,0x64)){var _0x3687c3=_[_0x2c69('0x47')](_0x4060a9,{'sectionId':0x64});return hasDefaultDashboard(_0x3687c3)[_0x2c69('0x29')](function(_0x20b1c1){return _[_0x2c69('0x34')](_0x4060a9,function(_0x342aca){if(_0x342aca['sectionId']===0x64){_0x342aca[_0x2c69('0x61')]=_0x20b1c1;}return _0x342aca;});});}else{return;}})[_0x2c69('0x29')](function(_0x4e12a6){if(_0x4e12a6)_0x4060a9=_0x4e12a6;if(_[_0x2c69('0x60')](_0x31c08a,0x3eb)){var _0x159839=_[_0x2c69('0x47')](_0x4060a9,{'sectionId':0x3eb});return getCustomDashboards(_0x159839)[_0x2c69('0x29')](function(_0x21536a){return _['map'](_0x4060a9,function(_0x410bdf){if(_0x159839[_0x2c69('0x5f')]){if(_0x410bdf[_0x2c69('0x5a')]===0x3eb){_0x410bdf[_0x2c69('0x61')]=_0x21536a;}}else{if(_0x410bdf['sectionId']===0x64){_0x410bdf[_0x2c69('0x61')]=_0x21536a;}}return _0x410bdf;});});}else{return;}})[_0x2c69('0x29')](function(_0x389abb){if(_0x389abb)_0x4060a9=_0x389abb;if(_[_0x2c69('0x60')](_0x31c08a,0x709)){var _0x39b896=_['find'](_0x4060a9,{'sectionId':0x709});return getPlugins(_0x39b896)['then'](function(_0x4c53e1){if(_0x39b896[_0x2c69('0x5f')]){return _[_0x2c69('0x34')](_0x4060a9,function(_0x175357){if(_0x175357[_0x2c69('0x5a')]===0x709){_0x175357[_0x2c69('0x61')]=_0x4c53e1;}return _0x175357;});}else{var _0x5d80f3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4c53e1};var _0x20f684=_[_0x2c69('0x34')](_0x4060a9);_0x20f684[_0x2c69('0x62')](_0x5d80f3);return _0x20f684;}});}else{return;}})['then'](function(_0x5bcc1b){if(_0x5bcc1b)_0x4060a9=_0x5bcc1b;return _[_0x2c69('0x3d')](_0x4060a9,['enabled',0x1]);})[_0x2c69('0x29')](respondWithResult(_0x48ec7c,null))[_0x2c69('0x43')](handleError(_0x48ec7c,null));};function hasDefaultDashboard(_0x44fdb8){var _0x15e0f2=[0x65];return new BPromise(function(_0x392107,_0xe67be1){try{if(_0x44fdb8[_0x2c69('0x55')]){_0x392107(_0x15e0f2);}else{return db[_0x2c69('0x56')]['findOne']({'where':{'sectionId':_0x44fdb8['id']},'raw':!![]})[_0x2c69('0x29')](function(_0x197c9b){_0x197c9b?_0x392107(_0x15e0f2):_0x392107();});}}catch(_0x18145a){_0xe67be1(_0x18145a);}});}function getCustomDashboards(_0x569183){var _0x4a6bd3=[];return new BPromise(function(_0x10881f,_0x30220f){try{if(_0x569183['autoAssociation']){return db['Dashboard'][_0x2c69('0x53')]({'raw':!![]})[_0x2c69('0x29')](function(_0x560d63){_0x560d63[_0x2c69('0x63')](function(_0x56bbe7){_0x4a6bd3[_0x2c69('0x62')](_0x56bbe7['id']+0x1869f);});_0x10881f(_0x4a6bd3);});}else{return db[_0x2c69('0x56')]['findAll']({'where':{'sectionId':_0x569183['id']},'raw':!![]})[_0x2c69('0x29')](function(_0x3c8299){_0x3c8299[_0x2c69('0x63')](function(_0x360df4){_0x4a6bd3[_0x2c69('0x62')](_0x360df4['resourceId']+0x1869f);});_0x10881f(_0x4a6bd3);});}}catch(_0x30f431){_0x30220f(_0x30f431);}});}function getPlugins(_0x1a3351){var _0x1d6bbd=[];return new BPromise(function(_0x556511,_0x2f9856){try{if(_0x1a3351['autoAssociation']){return db[_0x2c69('0x64')]['findAll']({'raw':!![]})[_0x2c69('0x29')](function(_0x3920ab){_0x3920ab['forEach'](function(_0x4e395e){_0x1d6bbd['push'](_0x4e395e['id']+0x15b38);});_0x556511(_0x1d6bbd);});}else{return db[_0x2c69('0x56')]['findAll']({'where':{'sectionId':_0x1a3351['id']},'raw':!![]})[_0x2c69('0x29')](function(_0x45ae02){_0x45ae02[_0x2c69('0x63')](function(_0x1d5cae){_0x1d6bbd[_0x2c69('0x62')](_0x1d5cae[_0x2c69('0x65')]+0x15b38);});_0x556511(_0x1d6bbd);});}}catch(_0x32cc7a){_0x2f9856(_0x32cc7a);}});}exports[_0x2c69('0x66')]=function(_0x5f5809,_0x1dbb34){return db[_0x2c69('0x2f')]['find']({'where':{'id':_0x5f5809[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](handleEntityNotFound(_0x1dbb34,null))[_0x2c69('0x29')](function(_0x3a9862){if(_0x3a9862){return db[_0x2c69('0x59')][_0x2c69('0x51')](function(_0x363ff5){return db[_0x2c69('0x52')]['findAll']({'where':{'userProfileId':_0x5f5809[_0x2c69('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x2c69('0x29')](function(_0x50514a){if(_0x50514a){return db[_0x2c69('0x52')][_0x2c69('0x2a')]({'where':{'userProfileId':_0x5f5809['params']['id'],'id':_['map'](_0x50514a,function(_0x5c5c1e){return _0x5c5c1e['id'];})},'transaction':_0x363ff5});}})[_0x2c69('0x29')](function(_0x385a30){var _0x190e94=_[_0x2c69('0x34')](_0x5f5809[_0x2c69('0x49')],function(_0x3924c1){_0x3924c1['userProfileId']=_0x5f5809[_0x2c69('0x4b')]['id'];return _0x3924c1;});return db[_0x2c69('0x52')][_0x2c69('0x67')](_0x190e94,{'raw':!![],'transaction':_0x363ff5});})['then'](function(_0x1d1fa9){var _0x209a4c=_[_0x2c69('0x3d')](_[_0x2c69('0x34')](_0x1d1fa9,function(_0x4b80a1){return _0x4b80a1[_0x2c69('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x209a4c){return db['UserProfileSection'][_0x2c69('0x53')]({'where':{'userProfileId':_0x5f5809[_0x2c69('0x4b')]['id'],'sectionId':_['map'](_0x209a4c,function(_0xccf1b9){return _0xccf1b9[_0x2c69('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x2c69('0x29')](function(_0x23c368){var _0xcb9f90=_['map'](_0x5f5809[_0x2c69('0x49')],function(_0x239f12){_0x239f12[_0x2c69('0x5b')]=_0x5f5809[_0x2c69('0x4b')]['id'];return _0x239f12;});return db[_0x2c69('0x56')][_0x2c69('0x67')](_0xcb9f90,{'raw':!![],'transaction':_0x363ff5});});}})['catch'](handleError(_0x1dbb34,null));});}})[_0x2c69('0x29')](function(_0x35157e){var _0x352912=_[_0x2c69('0x34')](_0x35157e,function(_0x55a0af){return _0x55a0af[_0x2c69('0x4c')]({'plain':!![]});});})[_0x2c69('0x29')](respondWithResult(_0x1dbb34,null))['catch'](handleError(_0x1dbb34,null));};exports[_0x2c69('0x68')]=function(_0x5d6d11,_0x1ebafc,_0x246d43){return db['UserProfile'][_0x2c69('0x47')]({'where':{'id':_0x5d6d11['params']['id']}})['then'](handleEntityNotFound(_0x1ebafc,null))['then'](function(_0x2ef27d){if(_0x2ef27d){return _0x2ef27d[_0x2c69('0x68')](_0x5d6d11[_0x2c69('0x35')][_0x2c69('0x5d')]);}})[_0x2c69('0x29')](respondWithStatusCode(_0x1ebafc,null))[_0x2c69('0x43')](handleError(_0x1ebafc,null));};exports[_0x2c69('0x69')]=function(_0x422641,_0x30ceb5){var _0x4458cb={};if(!_0x422641[_0x2c69('0x35')][_0x2c69('0x6a')])throw new Error(_0x2c69('0x6b'));if(!_0x422641[_0x2c69('0x35')][_0x2c69('0x6c')](_0x2c69('0x3a'))){_0x4458cb['limit']=qs[_0x2c69('0x20')](_0x422641[_0x2c69('0x35')][_0x2c69('0x20')]);_0x4458cb[_0x2c69('0x22')]=qs[_0x2c69('0x22')](_0x422641[_0x2c69('0x35')]['offset']);}return db['UserProfile'][_0x2c69('0x47')]({'where':{'id':_0x422641[_0x2c69('0x4b')]['id']}})[_0x2c69('0x29')](function(_0x48220a){if(!_0x48220a)throw new Error(_0x2c69('0x6d')+_0x422641[_0x2c69('0x4b')]['id']);return db['UserProfile'][_0x2c69('0x69')](_0x422641);})[_0x2c69('0x29')](respondWithFilteredResult(_0x30ceb5,_0x4458cb))[_0x2c69('0x43')](handleError(_0x30ceb5,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 4c31cb3..a721d6c 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 _0xb242=['UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xb242,0x1f3));var _0x2b24=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xb242[_0x5280f4];return _0xba93e7;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x2b24('0x0'))['db'][_0x2b24('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2b24('0x2')](0x0);var events={'afterCreate':_0x2b24('0x3'),'afterUpdate':_0x2b24('0x4'),'afterDestroy':_0x2b24('0x5')};function emitEvent(_0x287b01){return function(_0x481806,_0x494b43,_0x44454e){UserProfileEvents[_0x2b24('0x6')](_0x287b01+':'+_0x481806['id'],_0x481806);UserProfileEvents['emit'](_0x287b01,_0x481806);_0x44454e(null);};}for(var e in events){if(events[_0x2b24('0x7')](e)){var event=events[e];UserProfile[_0x2b24('0x8')](e,emitEvent(event));}}module[_0x2b24('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x9af6=['hook','exports','events','../../mysqldb','UserProfile','update','emit'];(function(_0x23a249,_0x464ed7){var _0x5e4899=function(_0x2a97e3){while(--_0x2a97e3){_0x23a249['push'](_0x23a249['shift']());}};_0x5e4899(++_0x464ed7);}(_0x9af6,0x1d7));var _0x69af=function(_0x771eac,_0x16c9bd){_0x771eac=_0x771eac-0x0;var _0x4eb403=_0x9af6[_0x771eac];return _0x4eb403;};'use strict';var EventEmitter=require(_0x69af('0x0'));var UserProfile=require(_0x69af('0x1'))['db'][_0x69af('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x69af('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5e0e6b){return function(_0x185b85,_0x11f0e4,_0x2b73be){UserProfileEvents['emit'](_0x5e0e6b+':'+_0x185b85['id'],_0x185b85);UserProfileEvents[_0x69af('0x4')](_0x5e0e6b,_0x185b85);_0x2b73be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x69af('0x5')](e,emitEvent(event));}}module[_0x69af('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 8dabb65..c94e94f 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 _0x1485=['MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','admin','Agents','ZendeskAccount','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','AnalyticMetric','whatsappaccounts','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','sequelize','query','toString','OpenTabs','define','UserProfile','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','params','all','ignore','union','autoAssociation','push','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','where','pick','merge','key','VIRTUAL','foreignKey','forEach','options','reportType','default','reportId','DefaultReports','custom','CustomReports','count','rows','includeAll','ThroughTags','color','tag','openTabs','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','value','then','associatedResources','map','model','UserProfileResource','findAll','resourceId','type','catch','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','CmContact','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','membername','User','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','Campaign','mailqueues','mailaccounts'];(function(_0x1ef656,_0x4c68b0){var _0x543e7b=function(_0x2a4758){while(--_0x2a4758){_0x1ef656['push'](_0x1ef656['shift']());}};_0x543e7b(++_0x4c68b0);}(_0x1485,0x77));var _0x5148=function(_0x3dbfa1,_0x9a3095){_0x3dbfa1=_0x3dbfa1-0x0;var _0x3bbd4f=_0x1485[_0x3dbfa1];return _0x3bbd4f;};'use strict';var _=require('lodash');var attributes=require(_0x5148('0x0'));var qs=require(_0x5148('0x1'));module[_0x5148('0x2')]=function(_0x55ca00){var _0x151567=_0x55ca00['models'];function _0x32d1f4(_0x314828,_0x2ccc77){return new Promise(function(_0x4c539b,_0x4d8587){if(!_0x2ccc77)return _0x4c539b(null);var _0x4de097=_0x2ccc77[_0x5148('0x3')]?{[_0x2ccc77[_0x5148('0x3')][_0x5148('0x4')]]:_0x2ccc77[_0x5148('0x3')][_0x5148('0x5')]}:undefined;return _0x151567[_0x314828]['findAll']({'where':_0x4de097,'raw':!![]})[_0x5148('0x6')](function(_0x29ed6c){_0x2ccc77[_0x5148('0x7')]=_[_0x5148('0x8')](_0x29ed6c,'id');_0x4c539b(_0x2ccc77);})['catch'](function(_0x3c4494){_0x4d8587(_0x3c4494);});});}function _0x28007c(_0x43d15f,_0x222c2c){return new Promise(function(_0x48928a,_0x25616d){var _0x37eb76=_0x43d15f[_0x5148('0x3')]?{[_0x43d15f[_0x5148('0x3')][_0x5148('0x4')]]:_0x43d15f[_0x5148('0x3')][_0x5148('0x5')]}:undefined;return _0x151567[_0x43d15f[_0x5148('0x9')]]['findAll']({'where':_0x37eb76,'raw':!![]})['then'](function(_0x45c766){_0x222c2c[_0x5148('0x7')]=_[_0x5148('0x8')](_0x45c766,function(_0x428ec7){return _0x428ec7['name'];});_0x48928a(_0x222c2c);})['catch'](function(_0x35255){_0x25616d(_0x35255);});});}function _0x22c875(_0xb4fd64,_0x1b378,_0x3c6d51){if(!_0x1b378)return resolve(null);return new Promise(function(_0x5e45c1,_0x19dc96){return _0x151567[_0x5148('0xa')][_0x5148('0xb')]({'where':{'sectionId':_0x1b378['id']},'raw':!![]})['then'](function(_0x5802c2){if(_0xb4fd64[_0x5148('0x4')]&&_0xb4fd64['field']!=='id'){_0x1b378['associatedResources']=_[_0x5148('0x8')](_0x5802c2,function(_0x5ec7c1){return _0x5ec7c1[_0xb4fd64[_0x5148('0x4')]];});}else{if(_0x3c6d51==='AnalyticExtractedReport'){_0x1b378[_0x5148('0x7')]=_[_0x5148('0x8')](_0x5802c2,function(_0x5209ca){return{'id':_0x5209ca[_0x5148('0xc')],'type':_0x5209ca[_0x5148('0xd')]};});}else{_0x1b378[_0x5148('0x7')]=_[_0x5148('0x8')](_0x5802c2,function(_0x40f4c){return _0x40f4c[_0x5148('0xc')];});}}_0x5e45c1(_0x1b378);})[_0x5148('0xe')](function(_0x3a7efa){_0x19dc96(_0x3a7efa);});});}function _0x3b4ca5(_0x595f29,_0x3dc4c0){var _0x1c29c2={'parentSections':[]};switch(_0x595f29[_0x5148('0xf')]()){case _0x5148('0x10'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x12');break;case _0x5148('0x13'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x14');break;case _0x5148('0x15'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x16');_0x1c29c2[_0x5148('0x17')]=[{'name':_0x5148('0x18'),'field':_0x5148('0x19'),'foreignKey':_0x5148('0x1a')}];break;case _0x5148('0x1b'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x1c');break;case _0x5148('0x1d'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x1e');_0x1c29c2[_0x5148('0x17')]=[{'name':'Lists','field':'id','foreignKey':_0x5148('0x1f')}];break;case _0x5148('0x20'):_0x1c29c2['childModel']=_0x5148('0x21');break;case _0x5148('0x22'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x23');break;case'globalcustomfields':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x24');break;case'chatqueues':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x25');break;case _0x5148('0x26'):_0x1c29c2['childModel']=_0x5148('0x27');break;case _0x5148('0x28'):_0x1c29c2[_0x5148('0x11')]='FaxQueue';break;case _0x5148('0x29'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x2a');break;case _0x5148('0x2b'):case _0x5148('0x2c'):case _0x5148('0x2d'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x2e');break;case _0x5148('0x2f'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x30');break;case _0x5148('0x31'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x32');break;case'voicerecordings':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x33');_0x1c29c2['parentSections']=[{'name':'Agents','field':_0x5148('0x19'),'foreignKey':_0x5148('0x34'),'model':_0x5148('0x35'),'filter':{'field':'role','value':['agent']}},{'name':_0x5148('0x36'),'field':'name','foreignKey':'membername','model':_0x5148('0x35'),'filter':{'field':_0x5148('0x37'),'value':[_0x5148('0x38')]}},{'name':_0x5148('0x39'),'field':_0x5148('0x19'),'foreignKey':_0x5148('0x3a'),'model':_0x5148('0x3b'),'filter':{'field':_0x5148('0xd'),'value':[_0x5148('0x3c')]}},{'name':_0x5148('0x3d'),'field':_0x5148('0x19'),'foreignKey':_0x5148('0x3a'),'model':_0x5148('0x3b'),'filter':{'field':_0x5148('0xd'),'value':[_0x5148('0x3e')]}}];break;case _0x5148('0x3f'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x40');break;case'chanspies':_0x1c29c2[_0x5148('0x11')]='VoiceChanSpy';break;case _0x5148('0x41'):_0x1c29c2[_0x5148('0x11')]='VoicePrefix';break;case'ivrcampaigns':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x42');break;case _0x5148('0x43'):_0x1c29c2[_0x5148('0x11')]='MailQueue';break;case _0x5148('0x44'):_0x1c29c2['childModel']=_0x5148('0x45');break;case _0x5148('0x46'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x47');break;case _0x5148('0x48'):_0x1c29c2['childModel']=_0x5148('0x49');break;case'openchannelaccounts':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x4a');break;case _0x5148('0x4b'):_0x1c29c2['childModel']=_0x5148('0x4c');break;case'smsaccounts':_0x1c29c2[_0x5148('0x11')]='SmsAccount';break;case'whatsappqueues':_0x1c29c2['childModel']='WhatsappQueue';break;case'whatsappaccounts':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x4d');break;case _0x5148('0x4e'):_0x1c29c2['childModel']=_0x5148('0x4f');break;case _0x5148('0x50'):case _0x5148('0x51'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x3b');if(_0x3dc4c0){_0x1c29c2[_0x5148('0x17')]=[{'name':_0x5148('0x39')},{'name':_0x5148('0x3d')}];}break;case _0x5148('0x52'):case _0x5148('0x53'):case'telephones':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x35');if(_0x3dc4c0){_0x1c29c2[_0x5148('0x17')]=[{'name':'Users','filter':{'field':'role','value':[_0x5148('0x54'),'user']},'ignore':!![]},{'name':_0x5148('0x55')},{'name':_0x5148('0x36')}];}break;case'zendeskaccounts':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x56');break;case _0x5148('0x57'):_0x1c29c2[_0x5148('0x11')]='SalesforceAccount';break;case'freshdeskaccounts':_0x1c29c2['childModel']=_0x5148('0x58');break;case _0x5148('0x59'):_0x1c29c2[_0x5148('0x11')]='SugarcrmAccount';break;case'deskaccounts':_0x1c29c2['childModel']=_0x5148('0x5a');break;case _0x5148('0x5b'):_0x1c29c2[_0x5148('0x11')]='ZohoAccount';break;case _0x5148('0x5c'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x35');break;case _0x5148('0x5d'):_0x1c29c2['childModel']=_0x5148('0x5e');break;case'dispositions':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x5f');break;case _0x5148('0x60'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x61');break;case'intervals':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x62');break;case _0x5148('0x63'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x64');break;case _0x5148('0x65'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x66');break;case _0x5148('0x67'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x68');break;case'tags':_0x1c29c2['childModel']=_0x5148('0x69');break;case _0x5148('0x6a'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x6b');break;case _0x5148('0x6c'):_0x1c29c2[_0x5148('0x11')]='Trigger';break;case _0x5148('0x6d'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x6e');break;case _0x5148('0x6f'):_0x1c29c2['childModel']=_0x5148('0x70');break;case _0x5148('0x71'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x72');break;case _0x5148('0x73'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x74');_0x1c29c2['parentSections']=[{'name':_0x5148('0x75'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x1c29c2[_0x5148('0x11')]=_0x5148('0x76');break;case _0x5148('0x77'):_0x1c29c2[_0x5148('0x11')]=_0x5148('0x4d');break;}return _0x1c29c2;}function _0x22952c(_0x1f81ec,_0x23cfd5){var _0x3177e8=_0x1f81ec[_0x5148('0x78')](0x0)[_0x5148('0x79')]()+_0x1f81ec[_0x5148('0x7a')](0x1);var _0x352233={'type':_0x151567[_0x5148('0x7b')][_0x5148('0x7c')][_0x5148('0x7d')],'raw':!![]};return new BPromise(function(_0xd40447,_0x1bff96){var _0x300c80=squel[_0x5148('0x7e')]()[_0x5148('0x4')](_0x5148('0x7f')+_0x3177e8+_0x5148('0x80'),'id')['field'](_0x5148('0x81'))[_0x5148('0x82')](_0x5148('0x83')+_0x1f81ec+_0x5148('0x84'),'ui')['where']('ui.UserId\x20=\x20?',_0x23cfd5['id']);return _0x151567[_0x5148('0x85')][_0x5148('0x86')](_0x300c80[_0x5148('0x87')](),_0x352233)[_0x5148('0x6')](function(_0x14f6f5){_0x23cfd5[_0x3177e8+_0x5148('0x88')]=_0x14f6f5;_0xd40447(_0x14f6f5);})[_0x5148('0xe')](function(_0x15e2c5){_0x1bff96(_0x15e2c5);});});}return _0x55ca00[_0x5148('0x89')](_0x5148('0x8a'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x10ecbe){var _0x237d5d={'raw':![],'where':{}};var _0x598a9e={};var _0x10ec6f={'count':0x0,'rows':[]};var _0x118065=_0x10ecbe[_0x5148('0x86')]['section'];var _0x4ef9f8=_0x10ecbe['query'][_0x5148('0x8b')]||![];var _0xe75345=_0x3b4ca5(_0x118065,_0x4ef9f8);if(!_0xe75345[_0x5148('0x11')])throw new Error(_0x5148('0x8c')+_0x118065+'\x27');var _0x2e6ec9=[{'name':_0x118065}];if(!_[_0x5148('0x8d')](_0xe75345['parentSections']))_0x2e6ec9=_0xe75345[_0x5148('0x17')];var _0x861cbb=[];for(var _0x10615d=0x0;_0x10615d<_0x2e6ec9[_0x5148('0x8e')];_0x10615d++){_0x861cbb['push'](_0x151567[_0x5148('0x8f')][_0x5148('0x90')]({'where':{'userProfileId':_0x10ecbe[_0x5148('0x91')]['id'],'name':_0x2e6ec9[_0x10615d]['name']},'raw':!![]}));}return Promise[_0x5148('0x92')](_0x861cbb)['then'](function(_0x2a9b18){var _0x502a72=_[_0x5148('0x3')](_0x2a9b18,function(_0x213013){return _0x213013?_0x213013:undefined;});var _0x264d7e=_['filter'](_0x2e6ec9,[_0x5148('0x93'),!![]]);var _0x58dce2=_['isEmpty'](_0x502a72)&&_[_0x5148('0x8d')](_0x264d7e)?null:_[_0x5148('0x94')](_0x264d7e,_0x502a72);if(!_0x58dce2)return null;var _0x459bbd=[];for(var _0x5ba67f=0x0;_0x5ba67f<_0x58dce2['length'];_0x5ba67f++){var _0x559042=_['find'](_0x2e6ec9,function(_0x7e3a1c){return _0x58dce2[_0x5ba67f]?_0x7e3a1c['name']===_0x58dce2[_0x5ba67f]['name']:null;});if(_0x559042){if(_0x58dce2[_0x5ba67f][_0x5148('0x93')]){_0x459bbd['push'](_0x32d1f4(_0xe75345[_0x5148('0x11')],_0x58dce2[_0x5ba67f]));}else{if(!_0x58dce2[_0x5ba67f][_0x5148('0x95')]){_0x459bbd[_0x5148('0x96')](_0x22c875(_0x559042,_0x58dce2[_0x5ba67f],_0xe75345[_0x5148('0x11')]));}else{if(_0x559042[_0x5148('0x9')]){_0x459bbd['push'](_0x28007c(_0x559042,_0x58dce2[_0x5ba67f]));}}}}}return Promise['all'](_0x459bbd);})['then'](function(_0x1dfe66){var _0x3d0763=_0x1dfe66;var _0x5000b0=null;if(_0x3d0763){_0x5000b0=_0x3d0763['length']===0x1?_0x3d0763[0x0]:null;}if(!_0x5000b0&&!_0x3d0763)return _0x10ec6f;var _0x180909=_0x151567[_0xe75345[_0x5148('0x11')]]['rawAttributes'];_0x598a9e[_0x5148('0x9')]=_[_0x5148('0x97')](_0x180909);_0x598a9e['query']=_[_0x5148('0x97')](_0x10ecbe['query']);_0x598a9e[_0x5148('0x98')]=_[_0x5148('0x99')](_0x598a9e[_0x5148('0x9')],_0x598a9e[_0x5148('0x86')]);_0x237d5d[_0x5148('0x9a')]=_[_0x5148('0x99')](_0x598a9e[_0x5148('0x9')],qs[_0x5148('0x9b')](_0x10ecbe[_0x5148('0x86')][_0x5148('0x9b')]));_0x237d5d['attributes']=_0x237d5d['attributes'][_0x5148('0x8e')]?_0x237d5d[_0x5148('0x9a')]:_0x598a9e['model'];if(!_0x10ecbe['query'][_0x5148('0x9c')]('nolimit')){_0x237d5d[_0x5148('0x9d')]=qs[_0x5148('0x9d')](_0x10ecbe[_0x5148('0x86')][_0x5148('0x9d')]);_0x237d5d[_0x5148('0x9e')]=qs[_0x5148('0x9e')](_0x10ecbe[_0x5148('0x86')]['offset']);}_0x237d5d[_0x5148('0x9f')]=qs['sort'](_0x10ecbe['query'][_0x5148('0xa0')]);_0x237d5d[_0x5148('0xa1')]=qs[_0x5148('0x98')](_[_0x5148('0xa2')](_0x10ecbe[_0x5148('0x86')],_0x598a9e[_0x5148('0x98')]));if(_0x10ecbe[_0x5148('0x86')][_0x5148('0x3')]){_0x237d5d['where']=_[_0x5148('0xa3')](_0x237d5d[_0x5148('0xa1')],{'$or':_[_0x5148('0x8')](_0x180909,function(_0x3365d3){if(_0x3365d3[_0x5148('0xd')][_0x5148('0xa4')]!==_0x5148('0xa5')){var _0x36cb05={};_0x36cb05[_0x3365d3['field']]={'$like':'%'+_0x10ecbe[_0x5148('0x86')][_0x5148('0x3')]+'%'};return _0x36cb05;}})});}var _0x2e144a=[];if(_0x5000b0){var _0x943b6a=_['find'](_0x2e6ec9,['name',_0x5000b0['name']]);if(_0x943b6a[_0x5148('0x4')]){var _0xc2d922={};if(_0xe75345[_0x5148('0x11')]===_0x5148('0x74')){_0xc2d922[_0x943b6a[_0x5148('0xa6')]]=_['map'](_0x5000b0[_0x5148('0x7')],'id');}else{_0xc2d922[_0x943b6a[_0x5148('0xa6')]]=_0x5000b0[_0x5148('0x7')];}_0x2e144a[_0x5148('0x96')](_0xc2d922);}else{_0x237d5d[_0x5148('0xa1')]['id']=_0x5000b0[_0x5148('0x7')];}}else{for(var _0x2be69f=0x0;_0x2be69f<_0x3d0763[_0x5148('0x8e')];_0x2be69f++){var _0x943b6a=_[_0x5148('0x90')](_0x2e6ec9,['name',_0x3d0763[_0x2be69f]['name']]);if(_0x943b6a[_0x5148('0x4')]){var _0xc2d922={};_0xc2d922[_0x943b6a[_0x5148('0xa6')]]=_0x3d0763[_0x2be69f][_0x5148('0x7')];_0x2e144a[_0x5148('0x96')](_0xc2d922);}else{if(!_0x237d5d[_0x5148('0xa1')]['id'])_0x237d5d[_0x5148('0xa1')]['id']=[];_0x3d0763[_0x2be69f]['associatedResources'][_0x5148('0xa7')](function(_0x18457c){_0x237d5d[_0x5148('0xa1')]['id'][_0x5148('0x96')](_0x18457c);});}}}if(!_[_0x5148('0x8d')](_0x2e144a)){_0x237d5d[_0x5148('0xa1')]=_[_0x5148('0xa3')](_0x237d5d[_0x5148('0xa1')],{'$and':{'$or':_0x2e144a}});}_0x237d5d=_['merge']({},_0x237d5d,_0x10ecbe[_0x5148('0xa8')]);if(_0x5000b0&&!_0x5000b0[_0x5148('0x95')]&&_0xe75345[_0x5148('0x11')]===_0x5148('0x74')){if(_0x10ecbe[_0x5148('0x86')]['includeAll']){_0x237d5d['include']=[{'all':!![]}];}return _0x151567[_0xe75345[_0x5148('0x11')]][_0x5148('0xb')](_0x237d5d)[_0x5148('0x6')](function(_0x5a0abc){var _0x16d91d=[];_0x5a0abc[_0x5148('0xa7')](function(_0x43db69){var _0x407d0e;switch(_0x43db69[_0x5148('0xa9')]){case _0x5148('0xaa'):_0x407d0e=_[_0x5148('0x90')](_0x5000b0[_0x5148('0x7')],function(_0x1d7139){return _0x1d7139['id']===_0x43db69[_0x5148('0xab')]&&_0x1d7139[_0x5148('0xd')]===_0x5148('0xac');});break;case _0x5148('0xad'):_0x407d0e=_[_0x5148('0x90')](_0x5000b0['associatedResources'],function(_0x561266){return _0x561266['id']===_0x43db69[_0x5148('0xab')]&&_0x561266['type']===_0x5148('0xae');});break;}if(_0x407d0e)_0x16d91d['push'](_0x43db69);});_0x10ec6f[_0x5148('0xaf')]=_0x16d91d['length'];_0x10ec6f[_0x5148('0xb0')]=_0x16d91d;return _0x10ec6f;});}else{return _0x151567[_0xe75345['childModel']][_0x5148('0xaf')]({'where':_0x237d5d[_0x5148('0xa1')]})[_0x5148('0x6')](function(_0x795a59){_0x10ec6f[_0x5148('0xaf')]=_0x795a59;if(_0x10ecbe[_0x5148('0x86')][_0x5148('0xb1')]){if(_0xe75345[_0x5148('0x11')]===_0x5148('0x1e')){_0x237d5d['include']=[{'model':_0x151567[_0x5148('0x69')],'as':'Tags','attributes':['id',_0x5148('0x19'),'color'],'required':_0x10ecbe['query']['tag']?!![]:![]},{'model':_0x151567[_0x5148('0x69')],'as':_0x5148('0xb2'),'attributes':['id',_0x5148('0x19'),_0x5148('0xb3')],'through':_0x10ecbe[_0x5148('0x86')][_0x5148('0xb4')]?{'attributes':[],'where':{'TagId':_0x10ecbe[_0x5148('0x86')][_0x5148('0xb4')]||undefined}}:{},'required':_0x10ecbe[_0x5148('0x86')][_0x5148('0xb4')]?!![]:![]}];}else{_0x237d5d['include']=[{'all':!![]}];}}return _0x151567[_0xe75345[_0x5148('0x11')]]['findAll'](_0x237d5d);})[_0x5148('0x6')](function(_0x5abd75){_0x10ec6f['rows']=_0x5abd75;if(_0x118065==='Agents'&&_0x10ecbe[_0x5148('0x86')][_0x5148('0xb5')]==='true'){var _0x1c63b6=[];for(var _0x264b3d=0x0;_0x264b3d<_0x10ec6f[_0x5148('0xb0')][_0x5148('0x8e')];_0x264b3d++){_0x1c63b6[_0x5148('0x96')](_0x22952c(_0x5148('0xb6'),_0x10ec6f['rows'][_0x264b3d][_0x5148('0xb7')]));_0x1c63b6[_0x5148('0x96')](_0x22952c(_0x5148('0xb8'),_0x10ec6f[_0x5148('0xb0')][_0x264b3d][_0x5148('0xb7')]));_0x1c63b6[_0x5148('0x96')](_0x22952c('fax',_0x10ec6f[_0x5148('0xb0')][_0x264b3d][_0x5148('0xb7')]));_0x1c63b6[_0x5148('0x96')](_0x22952c(_0x5148('0xb9'),_0x10ec6f['rows'][_0x264b3d][_0x5148('0xb7')]));_0x1c63b6[_0x5148('0x96')](_0x22952c(_0x5148('0xba'),_0x10ec6f[_0x5148('0xb0')][_0x264b3d]['dataValues']));_0x1c63b6[_0x5148('0x96')](_0x22952c(_0x5148('0xbb'),_0x10ec6f[_0x5148('0xb0')][_0x264b3d][_0x5148('0xb7')]));}return Promise['all'](_0x1c63b6)[_0x5148('0x6')](function(){return _0x10ec6f;});}return _0x10ec6f;});}});}}});}; \ No newline at end of file +var _0x218d=['VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','inbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','voicequeues','queuecampaigns','users','telephones','Users','admin','user','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','scheduler','Sound','tags','Tag','Template','triggers','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','WhatsappAccount','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','model','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','filters','pick','merge','foreignKey','forEach','options','includeAll','reportType','default','DefaultReports','CustomReports','count','include','Tags','tag','rows','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','findAll','then','map','catch','value','name','associatedResources','AnalyticExtractedReport','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','projectName','projects','JscriptyProject','CmContact','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','internalroutes'];(function(_0x558644,_0x3f5bba){var _0x48d4c5=function(_0xe15058){while(--_0xe15058){_0x558644['push'](_0x558644['shift']());}};_0x48d4c5(++_0x3f5bba);}(_0x218d,0x143));var _0xd218=function(_0x4e1925,_0x486a24){_0x4e1925=_0x4e1925-0x0;var _0x4fae1c=_0x218d[_0x4e1925];return _0x4fae1c;};'use strict';var _=require(_0xd218('0x0'));var attributes=require(_0xd218('0x1'));var qs=require(_0xd218('0x2'));module[_0xd218('0x3')]=function(_0x471687){var _0x37501d=_0x471687['models'];function _0x206436(_0xc1b8b8,_0x15a926){return new Promise(function(_0x4d5163,_0x5dcb80){if(!_0x15a926)return _0x4d5163(null);var _0x355851=_0x15a926[_0xd218('0x4')]?{[_0x15a926[_0xd218('0x4')][_0xd218('0x5')]]:_0x15a926[_0xd218('0x4')]['value']}:undefined;return _0x37501d[_0xc1b8b8][_0xd218('0x6')]({'where':_0x355851,'raw':!![]})[_0xd218('0x7')](function(_0x59d205){_0x15a926['associatedResources']=_[_0xd218('0x8')](_0x59d205,'id');_0x4d5163(_0x15a926);})[_0xd218('0x9')](function(_0x2492a8){_0x5dcb80(_0x2492a8);});});}function _0x17de5f(_0x514416,_0xedbe40){return new Promise(function(_0x373615,_0x449404){var _0x9c0d94=_0x514416['filter']?{[_0x514416[_0xd218('0x4')][_0xd218('0x5')]]:_0x514416[_0xd218('0x4')][_0xd218('0xa')]}:undefined;return _0x37501d[_0x514416['model']][_0xd218('0x6')]({'where':_0x9c0d94,'raw':!![]})[_0xd218('0x7')](function(_0x3b9614){_0xedbe40['associatedResources']=_[_0xd218('0x8')](_0x3b9614,function(_0x53a883){return _0x53a883[_0xd218('0xb')];});_0x373615(_0xedbe40);})[_0xd218('0x9')](function(_0x25fd62){_0x449404(_0x25fd62);});});}function _0x586d1b(_0x3aa49f,_0x5f46db,_0x53e124){if(!_0x5f46db)return resolve(null);return new Promise(function(_0x44d16c,_0x593943){return _0x37501d['UserProfileResource'][_0xd218('0x6')]({'where':{'sectionId':_0x5f46db['id']},'raw':!![]})[_0xd218('0x7')](function(_0x425b84){if(_0x3aa49f[_0xd218('0x5')]&&_0x3aa49f[_0xd218('0x5')]!=='id'){_0x5f46db[_0xd218('0xc')]=_['map'](_0x425b84,function(_0x37227d){return _0x37227d[_0x3aa49f['field']];});}else{if(_0x53e124===_0xd218('0xd')){_0x5f46db[_0xd218('0xc')]=_['map'](_0x425b84,function(_0x5438ec){return{'id':_0x5438ec['resourceId'],'type':_0x5438ec[_0xd218('0xe')]};});}else{_0x5f46db[_0xd218('0xc')]=_[_0xd218('0x8')](_0x425b84,function(_0x170eb1){return _0x170eb1['resourceId'];});}}_0x44d16c(_0x5f46db);})[_0xd218('0x9')](function(_0x2e6d30){_0x593943(_0x2e6d30);});});}function _0x933642(_0x37630f,_0x284368){var _0x179b78={'parentSections':[]};switch(_0x37630f[_0xd218('0xf')]()){case _0xd218('0x10'):_0x179b78[_0xd218('0x11')]=_0xd218('0x12');break;case _0xd218('0x13'):_0x179b78['childModel']=_0xd218('0x14');break;case _0xd218('0x15'):_0x179b78['childModel']='SquareRecording';_0x179b78[_0xd218('0x16')]=[{'name':'SquareProjects','field':_0xd218('0xb'),'foreignKey':_0xd218('0x17')}];break;case _0xd218('0x18'):_0x179b78[_0xd218('0x11')]=_0xd218('0x19');break;case'contacts':_0x179b78['childModel']=_0xd218('0x1a');_0x179b78[_0xd218('0x16')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case'lists':_0x179b78['childModel']='CmList';break;case _0xd218('0x1b'):_0x179b78['childModel']=_0xd218('0x1c');break;case'globalcustomfields':_0x179b78[_0xd218('0x11')]='CmCustomField';break;case _0xd218('0x1d'):_0x179b78[_0xd218('0x11')]=_0xd218('0x1e');break;case _0xd218('0x1f'):_0x179b78['childModel']=_0xd218('0x20');break;case _0xd218('0x21'):_0x179b78[_0xd218('0x11')]=_0xd218('0x22');break;case'faxaccounts':_0x179b78['childModel']='FaxAccount';break;case _0xd218('0x23'):case _0xd218('0x24'):case'outboundroutes':_0x179b78[_0xd218('0x11')]=_0xd218('0x25');break;case _0xd218('0x26'):_0x179b78[_0xd218('0x11')]=_0xd218('0x27');break;case _0xd218('0x28'):_0x179b78[_0xd218('0x11')]=_0xd218('0x29');break;case _0xd218('0x2a'):_0x179b78[_0xd218('0x11')]=_0xd218('0x2b');_0x179b78[_0xd218('0x16')]=[{'name':_0xd218('0x2c'),'field':_0xd218('0xb'),'foreignKey':_0xd218('0x2d'),'model':_0xd218('0x2e'),'filter':{'field':_0xd218('0x2f'),'value':[_0xd218('0x30')]}},{'name':_0xd218('0x31'),'field':_0xd218('0xb'),'foreignKey':_0xd218('0x2d'),'model':_0xd218('0x2e'),'filter':{'field':_0xd218('0x2f'),'value':['telephone']}},{'name':_0xd218('0x32'),'field':_0xd218('0xb'),'foreignKey':_0xd218('0x33'),'model':_0xd218('0x34'),'filter':{'field':'type','value':[_0xd218('0x35')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xd218('0xe'),'value':['outbound']}}];break;case _0xd218('0x36'):_0x179b78[_0xd218('0x11')]=_0xd218('0x37');break;case _0xd218('0x38'):_0x179b78['childModel']=_0xd218('0x39');break;case'voiceprefixes':_0x179b78[_0xd218('0x11')]=_0xd218('0x3a');break;case _0xd218('0x3b'):_0x179b78['childModel']=_0xd218('0x3c');break;case _0xd218('0x3d'):_0x179b78['childModel']=_0xd218('0x3e');break;case'mailaccounts':_0x179b78[_0xd218('0x11')]='MailAccount';break;case _0xd218('0x3f'):_0x179b78[_0xd218('0x11')]='MailSubstatus';break;case _0xd218('0x40'):_0x179b78[_0xd218('0x11')]=_0xd218('0x41');break;case _0xd218('0x42'):_0x179b78['childModel']='OpenchannelAccount';break;case _0xd218('0x43'):_0x179b78[_0xd218('0x11')]=_0xd218('0x44');break;case _0xd218('0x45'):_0x179b78[_0xd218('0x11')]=_0xd218('0x46');break;case _0xd218('0x47'):_0x179b78[_0xd218('0x11')]=_0xd218('0x48');break;case _0xd218('0x49'):_0x179b78[_0xd218('0x11')]='WhatsappAccount';break;case _0xd218('0x4a'):_0x179b78[_0xd218('0x11')]='Team';break;case _0xd218('0x4b'):case _0xd218('0x4c'):_0x179b78[_0xd218('0x11')]=_0xd218('0x34');if(_0x284368){_0x179b78[_0xd218('0x16')]=[{'name':_0xd218('0x32')},{'name':'QueueCampaigns'}];}break;case _0xd218('0x4d'):case'agents':case _0xd218('0x4e'):_0x179b78[_0xd218('0x11')]='User';if(_0x284368){_0x179b78[_0xd218('0x16')]=[{'name':_0xd218('0x4f'),'filter':{'field':_0xd218('0x2f'),'value':[_0xd218('0x50'),_0xd218('0x51')]},'ignore':!![]},{'name':'Agents'},{'name':_0xd218('0x31')}];}break;case'zendeskaccounts':_0x179b78[_0xd218('0x11')]='ZendeskAccount';break;case _0xd218('0x52'):_0x179b78[_0xd218('0x11')]=_0xd218('0x53');break;case _0xd218('0x54'):_0x179b78[_0xd218('0x11')]=_0xd218('0x55');break;case _0xd218('0x56'):_0x179b78['childModel']=_0xd218('0x57');break;case'deskaccounts':_0x179b78[_0xd218('0x11')]=_0xd218('0x58');break;case'zohoaccounts':_0x179b78[_0xd218('0x11')]='ZohoAccount';break;case _0xd218('0x59'):_0x179b78[_0xd218('0x11')]=_0xd218('0x2e');break;case'cannedanswers':_0x179b78[_0xd218('0x11')]=_0xd218('0x5a');break;case _0xd218('0x5b'):_0x179b78[_0xd218('0x11')]=_0xd218('0x5c');break;case _0xd218('0x5d'):_0x179b78[_0xd218('0x11')]=_0xd218('0x5e');break;case'intervals':_0x179b78[_0xd218('0x11')]=_0xd218('0x5f');break;case _0xd218('0x60'):_0x179b78[_0xd218('0x11')]='Pause';break;case _0xd218('0x61'):_0x179b78[_0xd218('0x11')]='Schedule';break;case'sounds':_0x179b78[_0xd218('0x11')]=_0xd218('0x62');break;case _0xd218('0x63'):_0x179b78[_0xd218('0x11')]=_0xd218('0x64');break;case'templates':_0x179b78[_0xd218('0x11')]=_0xd218('0x65');break;case _0xd218('0x66'):_0x179b78[_0xd218('0x11')]='Trigger';break;case'trunks':_0x179b78['childModel']=_0xd218('0x67');break;case _0xd218('0x68'):_0x179b78['childModel']=_0xd218('0x69');break;case _0xd218('0x6a'):_0x179b78[_0xd218('0x11')]=_0xd218('0x6b');break;case _0xd218('0x6c'):_0x179b78['childModel']=_0xd218('0xd');_0x179b78[_0xd218('0x16')]=[{'name':_0xd218('0x6d'),'field':'id','foreignKey':_0xd218('0x6e')}];break;case _0xd218('0x6f'):_0x179b78[_0xd218('0x11')]='AnalyticMetric';break;case _0xd218('0x49'):_0x179b78[_0xd218('0x11')]=_0xd218('0x70');break;}return _0x179b78;}function _0x7e8fe6(_0x4506dd,_0x388810){var _0x450efc=_0x4506dd[_0xd218('0x71')](0x0)[_0xd218('0x72')]()+_0x4506dd[_0xd218('0x73')](0x1);var _0x21bb71={'type':_0x37501d[_0xd218('0x74')][_0xd218('0x75')][_0xd218('0x76')],'raw':!![]};return new BPromise(function(_0x379316,_0x382c08){var _0x3a6edc=squel[_0xd218('0x77')]()[_0xd218('0x5')](_0xd218('0x78')+_0x450efc+_0xd218('0x79'),'id')[_0xd218('0x5')](_0xd218('0x7a'))[_0xd218('0x7b')]('user_has_'+_0x4506dd+_0xd218('0x7c'),'ui')[_0xd218('0x7d')](_0xd218('0x7e'),_0x388810['id']);return _0x37501d[_0xd218('0x7f')][_0xd218('0x80')](_0x3a6edc[_0xd218('0x81')](),_0x21bb71)['then'](function(_0x3c1d6b){_0x388810[_0x450efc+_0xd218('0x82')]=_0x3c1d6b;_0x379316(_0x3c1d6b);})[_0xd218('0x9')](function(_0x38a4a6){_0x382c08(_0x38a4a6);});});}return _0x471687[_0xd218('0x83')]('UserProfile',attributes,{'tableName':_0xd218('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5dd163){var _0x223a76={'raw':![],'where':{}};var _0x528ef1={};var _0x4943c1={'count':0x0,'rows':[]};var _0x5ccf79=_0x5dd163['query'][_0xd218('0x85')];var _0x2a0cb6=_0x5dd163[_0xd218('0x80')][_0xd218('0x86')]||![];var _0x2299c1=_0x933642(_0x5ccf79,_0x2a0cb6);if(!_0x2299c1[_0xd218('0x11')])throw new Error(_0xd218('0x87')+_0x5ccf79+'\x27');var _0x2bd6ed=[{'name':_0x5ccf79}];if(!_[_0xd218('0x88')](_0x2299c1[_0xd218('0x16')]))_0x2bd6ed=_0x2299c1[_0xd218('0x16')];var _0x528336=[];for(var _0x52d0f=0x0;_0x52d0f<_0x2bd6ed[_0xd218('0x89')];_0x52d0f++){_0x528336[_0xd218('0x8a')](_0x37501d[_0xd218('0x8b')][_0xd218('0x8c')]({'where':{'userProfileId':_0x5dd163[_0xd218('0x8d')]['id'],'name':_0x2bd6ed[_0x52d0f][_0xd218('0xb')]},'raw':!![]}));}return Promise[_0xd218('0x8e')](_0x528336)['then'](function(_0x5545bb){var _0x4573d0=_[_0xd218('0x4')](_0x5545bb,function(_0x1543a4){return _0x1543a4?_0x1543a4:undefined;});var _0x561045=_[_0xd218('0x4')](_0x2bd6ed,[_0xd218('0x8f'),!![]]);var _0x50697e=_['isEmpty'](_0x4573d0)&&_[_0xd218('0x88')](_0x561045)?null:_[_0xd218('0x90')](_0x561045,_0x4573d0);if(!_0x50697e)return null;var _0x6d190d=[];for(var _0x443e1e=0x0;_0x443e1e<_0x50697e[_0xd218('0x89')];_0x443e1e++){var _0x555d52=_[_0xd218('0x8c')](_0x2bd6ed,function(_0x22257b){return _0x50697e[_0x443e1e]?_0x22257b[_0xd218('0xb')]===_0x50697e[_0x443e1e]['name']:null;});if(_0x555d52){if(_0x50697e[_0x443e1e]['ignore']){_0x6d190d['push'](_0x206436(_0x2299c1[_0xd218('0x11')],_0x50697e[_0x443e1e]));}else{if(!_0x50697e[_0x443e1e][_0xd218('0x91')]){_0x6d190d[_0xd218('0x8a')](_0x586d1b(_0x555d52,_0x50697e[_0x443e1e],_0x2299c1[_0xd218('0x11')]));}else{if(_0x555d52['model']){_0x6d190d[_0xd218('0x8a')](_0x17de5f(_0x555d52,_0x50697e[_0x443e1e]));}}}}}return Promise['all'](_0x6d190d);})['then'](function(_0x4e9e71){var _0x232e2a=_0x4e9e71;var _0x4a4fad=null;if(_0x232e2a){_0x4a4fad=_0x232e2a['length']===0x1?_0x232e2a[0x0]:null;}if(!_0x4a4fad&&!_0x232e2a)return _0x4943c1;var _0x5a4bee=_0x37501d[_0x2299c1[_0xd218('0x11')]][_0xd218('0x92')];_0x528ef1[_0xd218('0x93')]=_[_0xd218('0x94')](_0x5a4bee);_0x528ef1[_0xd218('0x80')]=_[_0xd218('0x94')](_0x5dd163[_0xd218('0x80')]);_0x528ef1['filters']=_[_0xd218('0x95')](_0x528ef1[_0xd218('0x93')],_0x528ef1[_0xd218('0x80')]);_0x223a76[_0xd218('0x96')]=_[_0xd218('0x95')](_0x528ef1[_0xd218('0x93')],qs[_0xd218('0x97')](_0x5dd163[_0xd218('0x80')]['fields']));_0x223a76[_0xd218('0x96')]=_0x223a76[_0xd218('0x96')][_0xd218('0x89')]?_0x223a76[_0xd218('0x96')]:_0x528ef1[_0xd218('0x93')];if(!_0x5dd163['query'][_0xd218('0x98')](_0xd218('0x99'))){_0x223a76[_0xd218('0x9a')]=qs[_0xd218('0x9a')](_0x5dd163[_0xd218('0x80')][_0xd218('0x9a')]);_0x223a76[_0xd218('0x9b')]=qs['offset'](_0x5dd163[_0xd218('0x80')][_0xd218('0x9b')]);}_0x223a76['order']=qs[_0xd218('0x9c')](_0x5dd163[_0xd218('0x80')][_0xd218('0x9c')]);_0x223a76[_0xd218('0x7d')]=qs[_0xd218('0x9d')](_[_0xd218('0x9e')](_0x5dd163[_0xd218('0x80')],_0x528ef1[_0xd218('0x9d')]));if(_0x5dd163['query'][_0xd218('0x4')]){_0x223a76[_0xd218('0x7d')]=_[_0xd218('0x9f')](_0x223a76['where'],{'$or':_[_0xd218('0x8')](_0x5a4bee,function(_0x225723){if(_0x225723['type']['key']!=='VIRTUAL'){var _0x49d59b={};_0x49d59b[_0x225723[_0xd218('0x5')]]={'$like':'%'+_0x5dd163[_0xd218('0x80')][_0xd218('0x4')]+'%'};return _0x49d59b;}})});}var _0x2adfe1=[];if(_0x4a4fad){var _0x1c1a94=_[_0xd218('0x8c')](_0x2bd6ed,[_0xd218('0xb'),_0x4a4fad[_0xd218('0xb')]]);if(_0x1c1a94['field']){var _0x1075b1={};if(_0x2299c1[_0xd218('0x11')]===_0xd218('0xd')){_0x1075b1[_0x1c1a94[_0xd218('0xa0')]]=_[_0xd218('0x8')](_0x4a4fad[_0xd218('0xc')],'id');}else{_0x1075b1[_0x1c1a94['foreignKey']]=_0x4a4fad[_0xd218('0xc')];}_0x2adfe1['push'](_0x1075b1);}else{_0x223a76['where']['id']=_0x4a4fad['associatedResources'];}}else{for(var _0x207a99=0x0;_0x207a99<_0x232e2a[_0xd218('0x89')];_0x207a99++){var _0x1c1a94=_[_0xd218('0x8c')](_0x2bd6ed,['name',_0x232e2a[_0x207a99]['name']]);if(_0x1c1a94[_0xd218('0x5')]){var _0x1075b1={};_0x1075b1[_0x1c1a94[_0xd218('0xa0')]]=_0x232e2a[_0x207a99]['associatedResources'];_0x2adfe1[_0xd218('0x8a')](_0x1075b1);}else{if(!_0x223a76[_0xd218('0x7d')]['id'])_0x223a76[_0xd218('0x7d')]['id']=[];_0x232e2a[_0x207a99][_0xd218('0xc')][_0xd218('0xa1')](function(_0x34fc15){_0x223a76['where']['id'][_0xd218('0x8a')](_0x34fc15);});}}}if(!_[_0xd218('0x88')](_0x2adfe1)){_0x223a76['where']=_['merge'](_0x223a76['where'],{'$and':{'$or':_0x2adfe1}});}_0x223a76=_['merge']({},_0x223a76,_0x5dd163[_0xd218('0xa2')]);if(_0x4a4fad&&!_0x4a4fad['autoAssociation']&&_0x2299c1['childModel']===_0xd218('0xd')){if(_0x5dd163[_0xd218('0x80')][_0xd218('0xa3')]){_0x223a76['include']=[{'all':!![]}];}return _0x37501d[_0x2299c1['childModel']][_0xd218('0x6')](_0x223a76)[_0xd218('0x7')](function(_0x1aaf2e){var _0x2686a0=[];_0x1aaf2e[_0xd218('0xa1')](function(_0x102bdb){var _0x27662e;switch(_0x102bdb[_0xd218('0xa4')]){case _0xd218('0xa5'):_0x27662e=_[_0xd218('0x8c')](_0x4a4fad[_0xd218('0xc')],function(_0x8b36d){return _0x8b36d['id']===_0x102bdb[_0xd218('0x6e')]&&_0x8b36d[_0xd218('0xe')]===_0xd218('0xa6');});break;case'custom':_0x27662e=_[_0xd218('0x8c')](_0x4a4fad[_0xd218('0xc')],function(_0x3cb116){return _0x3cb116['id']===_0x102bdb[_0xd218('0x6e')]&&_0x3cb116[_0xd218('0xe')]===_0xd218('0xa7');});break;}if(_0x27662e)_0x2686a0[_0xd218('0x8a')](_0x102bdb);});_0x4943c1[_0xd218('0xa8')]=_0x2686a0['length'];_0x4943c1['rows']=_0x2686a0;return _0x4943c1;});}else{return _0x37501d[_0x2299c1[_0xd218('0x11')]][_0xd218('0xa8')]({'where':_0x223a76[_0xd218('0x7d')]})[_0xd218('0x7')](function(_0x19da69){_0x4943c1['count']=_0x19da69;if(_0x5dd163[_0xd218('0x80')][_0xd218('0xa3')]){if(_0x2299c1[_0xd218('0x11')]===_0xd218('0x1a')){_0x223a76[_0xd218('0xa9')]=[{'model':_0x37501d[_0xd218('0x64')],'as':_0xd218('0xaa'),'attributes':['id',_0xd218('0xb'),'color'],'required':_0x5dd163[_0xd218('0x80')][_0xd218('0xab')]?!![]:![]},{'model':_0x37501d[_0xd218('0x64')],'as':'ThroughTags','attributes':['id',_0xd218('0xb'),'color'],'through':_0x5dd163[_0xd218('0x80')][_0xd218('0xab')]?{'attributes':[],'where':{'TagId':_0x5dd163[_0xd218('0x80')][_0xd218('0xab')]||undefined}}:{},'required':_0x5dd163['query'][_0xd218('0xab')]?!![]:![]}];}else{_0x223a76[_0xd218('0xa9')]=[{'all':!![]}];}}return _0x37501d[_0x2299c1[_0xd218('0x11')]][_0xd218('0x6')](_0x223a76);})[_0xd218('0x7')](function(_0x172f53){_0x4943c1[_0xd218('0xac')]=_0x172f53;if(_0x5ccf79==='Agents'&&_0x5dd163[_0xd218('0x80')]['openTabs']===_0xd218('0xad')){var _0x51152c=[];for(var _0xd80ae0=0x0;_0xd80ae0<_0x4943c1[_0xd218('0xac')][_0xd218('0x89')];_0xd80ae0++){_0x51152c[_0xd218('0x8a')](_0x7e8fe6('chat',_0x4943c1[_0xd218('0xac')][_0xd80ae0][_0xd218('0xae')]));_0x51152c['push'](_0x7e8fe6(_0xd218('0xaf'),_0x4943c1['rows'][_0xd80ae0][_0xd218('0xae')]));_0x51152c[_0xd218('0x8a')](_0x7e8fe6(_0xd218('0xb0'),_0x4943c1[_0xd218('0xac')][_0xd80ae0][_0xd218('0xae')]));_0x51152c['push'](_0x7e8fe6(_0xd218('0xb1'),_0x4943c1[_0xd218('0xac')][_0xd80ae0]['dataValues']));_0x51152c['push'](_0x7e8fe6(_0xd218('0xb2'),_0x4943c1[_0xd218('0xac')][_0xd80ae0]['dataValues']));_0x51152c[_0xd218('0x8a')](_0x7e8fe6(_0xd218('0xb3'),_0x4943c1[_0xd218('0xac')][_0xd80ae0][_0xd218('0xae')]));}return Promise['all'](_0x51152c)[_0xd218('0x7')](function(){return _0x4943c1;});}return _0x4943c1;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7fcc1c8..e988dbb 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 _0x078f=['code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x582db2,_0x547f07){var _0x2cc3ba=function(_0x5e3b24){while(--_0x5e3b24){_0x582db2['push'](_0x582db2['shift']());}};_0x2cc3ba(++_0x547f07);}(_0x078f,0x1b4));var _0xf078=function(_0x12177f,_0x13a3d){_0x12177f=_0x12177f-0x0;var _0x8b1b58=_0x078f[_0x12177f];return _0x8b1b58;};'use strict';var _=require('lodash');var util=require(_0xf078('0x0'));var moment=require(_0xf078('0x1'));var BPromise=require('bluebird');var rs=require(_0xf078('0x2'));var fs=require('fs');var Redis=require(_0xf078('0x3'));var db=require(_0xf078('0x4'))['db'];var utils=require(_0xf078('0x5'));var logger=require('../../config/logger')(_0xf078('0x6'));var config=require(_0xf078('0x7'));var jayson=require(_0xf078('0x8'));var client=jayson[_0xf078('0x9')][_0xf078('0xa')]({'port':0x232a});config[_0xf078('0xb')]=_[_0xf078('0xc')](config[_0xf078('0xb')],{'host':_0xf078('0xd'),'port':0x18eb});var socket=require(_0xf078('0xe'))(new Redis(config['redis']));require(_0xf078('0xf'))['register'](socket);function respondWithRpcPromise(_0x8090b3,_0x2c6f0e,_0x3e5158){return new BPromise(function(_0x321e45,_0x5946f5){return client[_0xf078('0x10')](_0x8090b3,_0x3e5158)['then'](function(_0x3af678){logger[_0xf078('0x11')](_0xf078('0x12'),_0x2c6f0e,'request\x20sent');logger['debug'](_0xf078('0x13'),_0x2c6f0e,_0xf078('0x14'),JSON[_0xf078('0x15')](_0x3af678));if(_0x3af678['error']){if(_0x3af678[_0xf078('0x16')][_0xf078('0x17')]===0x1f4){logger['error'](_0xf078('0x12'),_0x2c6f0e,_0x3af678[_0xf078('0x16')][_0xf078('0x18')]);return _0x5946f5(_0x3af678[_0xf078('0x16')][_0xf078('0x18')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x2c6f0e,_0x3af678['error'][_0xf078('0x18')]);return _0x321e45(_0x3af678[_0xf078('0x16')]['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x2c6f0e,_0xf078('0x14'));_0x321e45(_0x3af678[_0xf078('0x19')][_0xf078('0x18')]);}})[_0xf078('0x1a')](function(_0x2b6573){logger[_0xf078('0x16')]('UserProfile,\x20%s,\x20%s',_0x2c6f0e,_0x2b6573);_0x5946f5(_0x2b6573);});});} \ No newline at end of file +var _0xffd6=['../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x1aaa57,_0x3b0b60){var _0x1e33ec=function(_0x450b84){while(--_0x450b84){_0x1aaa57['push'](_0x1aaa57['shift']());}};_0x1e33ec(++_0x3b0b60);}(_0xffd6,0x97));var _0x6ffd=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xffd6[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});config[_0x6ffd('0xa')]=_[_0x6ffd('0xb')](config[_0x6ffd('0xa')],{'host':_0x6ffd('0xc'),'port':0x18eb});var socket=require(_0x6ffd('0xd'))(new Redis(config['redis']));require(_0x6ffd('0xe'))[_0x6ffd('0xf')](socket);function respondWithRpcPromise(_0x4e57f5,_0x469d0d,_0x38fc68){return new BPromise(function(_0x23f7f2,_0x3dda1e){return client[_0x6ffd('0x10')](_0x4e57f5,_0x38fc68)[_0x6ffd('0x11')](function(_0x836501){logger['info'](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));logger['debug'](_0x6ffd('0x14'),_0x469d0d,_0x6ffd('0x13'),JSON[_0x6ffd('0x15')](_0x836501));if(_0x836501[_0x6ffd('0x16')]){if(_0x836501['error'][_0x6ffd('0x17')]===0x1f4){logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501['error'][_0x6ffd('0x18')]);return _0x3dda1e(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);return _0x23f7f2(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}else{logger[_0x6ffd('0x19')](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));_0x23f7f2(_0x836501['result'][_0x6ffd('0x18')]);}})['catch'](function(_0x587d0b){logger[_0x6ffd('0x16')](_0x6ffd('0x12'),_0x469d0d,_0x587d0b);_0x3dda1e(_0x587d0b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f23f7ed..aaafa02 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 _0xa558=['update','emit','removeListener','register','userProfile:','./userProfile.events'];(function(_0xce63b8,_0x592df4){var _0x1abbaf=function(_0xa351e6){while(--_0xa351e6){_0xce63b8['push'](_0xce63b8['shift']());}};_0x1abbaf(++_0x592df4);}(_0xa558,0x167));var _0x8a55=function(_0x1bea25,_0x6496a2){_0x1bea25=_0x1bea25-0x0;var _0x1eb0b8=_0xa558[_0x1bea25];return _0x1eb0b8;};'use strict';var UserProfileEvents=require(_0x8a55('0x0'));var events=['save','remove',_0x8a55('0x1')];function createListener(_0x462528,_0x39d38a){return function(_0x2c2738){_0x39d38a[_0x8a55('0x2')](_0x462528,_0x2c2738);};}function removeListener(_0x5c7cbd,_0x4e04ba){return function(){UserProfileEvents[_0x8a55('0x3')](_0x5c7cbd,_0x4e04ba);};}exports[_0x8a55('0x4')]=function(_0x5a24d5){for(var _0x5826a6=0x0,_0x29a1c7=events['length'];_0x5826a6<_0x29a1c7;_0x5826a6++){var _0x294b2b=events[_0x5826a6];var _0x38c3b1=createListener(_0x8a55('0x5')+_0x294b2b,_0x5a24d5);UserProfileEvents['on'](_0x294b2b,_0x38c3b1);}}; \ No newline at end of file +var _0x9ac1=['userProfile:','./userProfile.events','remove','emit','removeListener','register','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9ac1,0x15f));var _0x19ac=function(_0x3dc36e,_0x4af46d){_0x3dc36e=_0x3dc36e-0x0;var _0xa13e71=_0x9ac1[_0x3dc36e];return _0xa13e71;};'use strict';var UserProfileEvents=require(_0x19ac('0x0'));var events=['save',_0x19ac('0x1'),'update'];function createListener(_0x1d2dd8,_0x4ed61d){return function(_0x1dfd79){_0x4ed61d[_0x19ac('0x2')](_0x1d2dd8,_0x1dfd79);};}function removeListener(_0x166209,_0x1c1dc5){return function(){UserProfileEvents[_0x19ac('0x3')](_0x166209,_0x1c1dc5);};}exports[_0x19ac('0x4')]=function(_0x3a3ed6){for(var _0x2876d3=0x0,_0x57f43a=events[_0x19ac('0x5')];_0x2876d3<_0x57f43a;_0x2876d3++){var _0x163cb8=events[_0x2876d3];var _0x39df9f=createListener(_0x19ac('0x6')+_0x163cb8,_0x3a3ed6);UserProfileEvents['on'](_0x163cb8,_0x39df9f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index a8561be..f52a068 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 _0x644c=['/:id','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post','put','delete'];(function(_0xdd3de,_0x2af5db){var _0x12732b=function(_0x25d784){while(--_0x25d784){_0xdd3de['push'](_0xdd3de['shift']());}};_0x12732b(++_0x2af5db);}(_0x644c,0xc0));var _0xc644=function(_0x200117,_0x1c6ccc){_0x200117=_0x200117-0x0;var _0x4c2dea=_0x644c[_0x200117];return _0x4c2dea;};'use strict';var multer=require(_0xc644('0x0'));var util=require(_0xc644('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc644('0x2'));var router=express[_0xc644('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc644('0x4'));var interaction=require(_0xc644('0x5'));var config=require(_0xc644('0x6'));var controller=require(_0xc644('0x7'));router[_0xc644('0x8')]('/',auth[_0xc644('0x9')](),controller[_0xc644('0xa')]);router[_0xc644('0x8')](_0xc644('0xb'),auth['isAuthenticated'](),controller[_0xc644('0xc')]);router[_0xc644('0x8')]('/:id',auth[_0xc644('0x9')](),controller[_0xc644('0xd')]);router[_0xc644('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc644('0xf')]('/:id',auth[_0xc644('0x9')](),controller['update']);router[_0xc644('0x10')](_0xc644('0x11'),auth[_0xc644('0x9')](),controller[_0xc644('0x12')]);module['exports']=router; \ No newline at end of file +var _0x519a=['isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index'];(function(_0x37136f,_0x1785e9){var _0x354dc1=function(_0x584d03){while(--_0x584d03){_0x37136f['push'](_0x37136f['shift']());}};_0x354dc1(++_0x1785e9);}(_0x519a,0x145));var _0xa519=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x519a[_0x58c20f];return _0x3b0318;};'use strict';var multer=require(_0xa519('0x0'));var util=require('util');var path=require(_0xa519('0x1'));var timeout=require(_0xa519('0x2'));var express=require(_0xa519('0x3'));var router=express[_0xa519('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa519('0x5'));var interaction=require(_0xa519('0x6'));var config=require(_0xa519('0x7'));var controller=require(_0xa519('0x8'));router[_0xa519('0x9')]('/',auth['isAuthenticated'](),controller[_0xa519('0xa')]);router['get']('/describe',auth[_0xa519('0xb')](),controller[_0xa519('0xc')]);router['get'](_0xa519('0xd'),auth[_0xa519('0xb')](),controller[_0xa519('0xe')]);router['post']('/',auth[_0xa519('0xb')](),controller[_0xa519('0xf')]);router[_0xa519('0x10')](_0xa519('0xd'),auth[_0xa519('0xb')](),controller[_0xa519('0x11')]);router[_0xa519('0x12')](_0xa519('0xd'),auth[_0xa519('0xb')](),controller[_0xa519('0x13')]);module[_0xa519('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index fd17cd9..dfa6860 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 _0x4e69=['exports','STRING','INTEGER','sequelize'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0x4e69,0x83));var _0x94e6=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4e69[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x94e6('0x0'));module[_0x94e6('0x1')]={'name':{'type':Sequelize[_0x94e6('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x94e6('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x94e6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x87df=['sequelize','exports','STRING','INTEGER'];(function(_0x25fe9e,_0x2088a4){var _0x1210ce=function(_0x43ff87){while(--_0x43ff87){_0x25fe9e['push'](_0x25fe9e['shift']());}};_0x1210ce(++_0x2088a4);}(_0x87df,0xd8));var _0xf87d=function(_0x57494e,_0x2c4d3d){_0x57494e=_0x57494e-0x0;var _0x4099da=_0x87df[_0x57494e];return _0x4099da;};'use strict';var Sequelize=require(_0xf87d('0x0'));module[_0xf87d('0x1')]={'name':{'type':Sequelize[_0xf87d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf87d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf87d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index c2f35e4..45c2a55 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 _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x4973b4,_0x3e9b20){var _0x3dd116=function(_0x187c42){while(--_0x187c42){_0x4973b4['push'](_0x4973b4['shift']());}};_0x3dd116(++_0x3e9b20);}(_0xd943,0x15d));var _0x3d94=function(_0x339b11,_0x135c90){_0x339b11=_0x339b11-0x0;var _0x35263f=_0xd943[_0x339b11];return _0x35263f;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['UserProfileResource']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file +var _0xc2c7=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x303853,_0x5ebe23){var _0xc5f51=function(_0x2edee0){while(--_0x2edee0){_0x303853['push'](_0x303853['shift']());}};_0xc5f51(++_0x5ebe23);}(_0xc2c7,0x134));var _0x7c2c=function(_0x47f0d4,_0xb72e5f){_0x47f0d4=_0x47f0d4-0x0;var _0x53c2dd=_0xc2c7[_0x47f0d4];return _0x53c2dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['UserProfileResource'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['UserProfileResource'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));};exports['describe']=function(_0x13e0bf,_0x11d337){return db['UserProfileResource'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0bd8e8a..e108dd9 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 _0xd35d=['./userProfileResource.attributes','exports','sectionId','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2bc88f,_0x5a8c82){var _0x1d2327=function(_0xf40c24){while(--_0xf40c24){_0x2bc88f['push'](_0x2bc88f['shift']());}};_0x1d2327(++_0x5a8c82);}(_0xd35d,0x1e3));var _0xdd35=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xd35d[_0x39d39d];return _0x577ac3;};'use strict';var _=require('lodash');var util=require(_0xdd35('0x0'));var logger=require('../../config/logger')(_0xdd35('0x1'));var moment=require(_0xdd35('0x2'));var BPromise=require(_0xdd35('0x3'));var rp=require(_0xdd35('0x4'));var fs=require('fs');var path=require(_0xdd35('0x5'));var rimraf=require(_0xdd35('0x6'));var config=require('../../config/environment');var attributes=require(_0xdd35('0x7'));module[_0xdd35('0x8')]=function(_0x460893,_0x7f06f7){return _0x460893['define']('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xdd35('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c3a=['path','rimraf','../../config/environment','exports','define','user_profile_has_resources','resourceId','util','api','moment','bluebird','request-promise'];(function(_0x3890d1,_0x1bb20b){var _0x47cc35=function(_0x462198){while(--_0x462198){_0x3890d1['push'](_0x3890d1['shift']());}};_0x47cc35(++_0x1bb20b);}(_0x8c3a,0x7f));var _0xa8c3=function(_0x4230aa,_0x2b4896){_0x4230aa=_0x4230aa-0x0;var _0x548a5b=_0x8c3a[_0x4230aa];return _0x548a5b;};'use strict';var _=require('lodash');var util=require(_0xa8c3('0x0'));var logger=require('../../config/logger')(_0xa8c3('0x1'));var moment=require(_0xa8c3('0x2'));var BPromise=require(_0xa8c3('0x3'));var rp=require(_0xa8c3('0x4'));var fs=require('fs');var path=require(_0xa8c3('0x5'));var rimraf=require(_0xa8c3('0x6'));var config=require(_0xa8c3('0x7'));var attributes=require('./userProfileResource.attributes');module[_0xa8c3('0x8')]=function(_0x5c6ad1,_0x47a709){return _0x5c6ad1[_0xa8c3('0x9')]('UserProfileResource',attributes,{'tableName':_0xa8c3('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xa8c3('0xb'),'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 f94e6c8..17c399c 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 _0xa3f9=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x24ef35,_0x3d7fd7){var _0x5387e6=function(_0x5f1da1){while(--_0x5f1da1){_0x24ef35['push'](_0x24ef35['shift']());}};_0x5387e6(++_0x3d7fd7);}(_0xa3f9,0x147));var _0x9a3f=function(_0x1c8f49,_0x117bba){_0x1c8f49=_0x1c8f49-0x0;var _0x127ecb=_0xa3f9[_0x1c8f49];return _0x127ecb;};'use strict';var _=require(_0x9a3f('0x0'));var util=require(_0x9a3f('0x1'));var moment=require(_0x9a3f('0x2'));var BPromise=require(_0x9a3f('0x3'));var rs=require(_0x9a3f('0x4'));var fs=require('fs');var Redis=require(_0x9a3f('0x5'));var db=require(_0x9a3f('0x6'))['db'];var utils=require(_0x9a3f('0x7'));var logger=require(_0x9a3f('0x8'))(_0x9a3f('0x9'));var config=require('../../config/environment');var jayson=require(_0x9a3f('0xa'));var client=jayson[_0x9a3f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ba08,_0x140cd1,_0x4696df){return new BPromise(function(_0x466af7,_0xb3c6fa){return client[_0x9a3f('0xc')](_0x30ba08,_0x4696df)['then'](function(_0x513653){logger[_0x9a3f('0xd')](_0x9a3f('0xe'),_0x140cd1,_0x9a3f('0xf'));logger[_0x9a3f('0x10')](_0x9a3f('0x11'),_0x140cd1,_0x9a3f('0xf'),JSON[_0x9a3f('0x12')](_0x513653));if(_0x513653[_0x9a3f('0x13')]){if(_0x513653['error'][_0x9a3f('0x14')]===0x1f4){logger[_0x9a3f('0x13')](_0x9a3f('0xe'),_0x140cd1,_0x513653[_0x9a3f('0x13')][_0x9a3f('0x15')]);return _0xb3c6fa(_0x513653[_0x9a3f('0x13')][_0x9a3f('0x15')]);}logger[_0x9a3f('0x13')](_0x9a3f('0xe'),_0x140cd1,_0x513653[_0x9a3f('0x13')][_0x9a3f('0x15')]);return _0x466af7(_0x513653[_0x9a3f('0x13')][_0x9a3f('0x15')]);}else{logger['info'](_0x9a3f('0xe'),_0x140cd1,_0x9a3f('0xf'));_0x466af7(_0x513653[_0x9a3f('0x16')][_0x9a3f('0x15')]);}})['catch'](function(_0x3ba7ed){logger['error'](_0x9a3f('0xe'),_0x140cd1,_0x3ba7ed);_0xb3c6fa(_0x3ba7ed);});});} \ No newline at end of file +var _0x5df3=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird'];(function(_0x2ec3d1,_0x2d82b2){var _0x2551e2=function(_0x5a638b){while(--_0x5a638b){_0x2ec3d1['push'](_0x2ec3d1['shift']());}};_0x2551e2(++_0x2d82b2);}(_0x5df3,0xb2));var _0x35df=function(_0xa1de8d,_0x1399a8){_0xa1de8d=_0xa1de8d-0x0;var _0x478b44=_0x5df3[_0xa1de8d];return _0x478b44;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x35df('0x0'));var BPromise=require(_0x35df('0x1'));var rs=require(_0x35df('0x2'));var fs=require('fs');var Redis=require(_0x35df('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x35df('0x4'));var logger=require(_0x35df('0x5'))('rpc');var config=require(_0x35df('0x6'));var jayson=require(_0x35df('0x7'));var client=jayson[_0x35df('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349c9a,_0x55c94a,_0x544f0f){return new BPromise(function(_0x5d27ca,_0x20ee6b){return client['request'](_0x349c9a,_0x544f0f)[_0x35df('0x9')](function(_0x507bdb){logger[_0x35df('0xa')](_0x35df('0xb'),_0x55c94a,_0x35df('0xc'));logger[_0x35df('0xd')](_0x35df('0xe'),_0x55c94a,_0x35df('0xc'),JSON[_0x35df('0xf')](_0x507bdb));if(_0x507bdb['error']){if(_0x507bdb['error']['code']===0x1f4){logger[_0x35df('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x55c94a,_0x507bdb[_0x35df('0x10')]['message']);return _0x20ee6b(_0x507bdb[_0x35df('0x10')][_0x35df('0x11')]);}logger[_0x35df('0x10')](_0x35df('0xb'),_0x55c94a,_0x507bdb[_0x35df('0x10')]['message']);return _0x5d27ca(_0x507bdb[_0x35df('0x10')][_0x35df('0x11')]);}else{logger[_0x35df('0xa')](_0x35df('0xb'),_0x55c94a,'request\x20sent');_0x5d27ca(_0x507bdb[_0x35df('0x12')]['message']);}})[_0x35df('0x13')](function(_0x55c0fe){logger[_0x35df('0x10')](_0x35df('0xb'),_0x55c94a,_0x55c0fe);_0x20ee6b(_0x55c0fe);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c624ac5..05d1674 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 _0xb9fe=['exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb9fe,0x89));var _0xeb9f=function(_0x3423f9,_0x2eec95){_0x3423f9=_0x3423f9-0x0;var _0x3bfe93=_0xb9fe[_0x3423f9];return _0x3bfe93;};'use strict';var multer=require('multer');var util=require(_0xeb9f('0x0'));var path=require('path');var timeout=require(_0xeb9f('0x1'));var express=require('express');var router=express[_0xeb9f('0x2')]();var fs_extra=require(_0xeb9f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xeb9f('0x4'));var config=require(_0xeb9f('0x5'));var controller=require(_0xeb9f('0x6'));router[_0xeb9f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeb9f('0x7')]('/describe',auth[_0xeb9f('0x8')](),controller['describe']);router[_0xeb9f('0x7')](_0xeb9f('0x9'),auth['isAuthenticated'](),controller[_0xeb9f('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb9f('0xb')]);router[_0xeb9f('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xeb9f('0xd')]);router[_0xeb9f('0xe')](_0xeb9f('0x9'),auth[_0xeb9f('0x8')](),controller[_0xeb9f('0xf')]);module[_0xeb9f('0x10')]=router; \ No newline at end of file +var _0xee1b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','exports','multer','util'];(function(_0x56612f,_0x14a1df){var _0x3eb11d=function(_0x1431bd){while(--_0x1431bd){_0x56612f['push'](_0x56612f['shift']());}};_0x3eb11d(++_0x14a1df);}(_0xee1b,0xda));var _0xbee1=function(_0xf1fbaa,_0x27ba82){_0xf1fbaa=_0xf1fbaa-0x0;var _0x14889d=_0xee1b[_0xf1fbaa];return _0x14889d;};'use strict';var multer=require(_0xbee1('0x0'));var util=require(_0xbee1('0x1'));var path=require(_0xbee1('0x2'));var timeout=require(_0xbee1('0x3'));var express=require(_0xbee1('0x4'));var router=express[_0xbee1('0x5')]();var fs_extra=require(_0xbee1('0x6'));var auth=require(_0xbee1('0x7'));var interaction=require(_0xbee1('0x8'));var config=require(_0xbee1('0x9'));var controller=require(_0xbee1('0xa'));router[_0xbee1('0xb')]('/',auth[_0xbee1('0xc')](),controller[_0xbee1('0xd')]);router[_0xbee1('0xb')](_0xbee1('0xe'),auth['isAuthenticated'](),controller[_0xbee1('0xf')]);router[_0xbee1('0xb')](_0xbee1('0x10'),auth['isAuthenticated'](),controller[_0xbee1('0x11')]);router[_0xbee1('0x12')]('/',auth[_0xbee1('0xc')](),controller[_0xbee1('0x13')]);router['put']('/:id',auth[_0xbee1('0xc')](),controller[_0xbee1('0x14')]);router['delete'](_0xbee1('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xbee1('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ad77a07..c6ab322 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 _0xb10b=['split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x12c263,_0x2d9bce){var _0x192cd7=function(_0x3a1fc0){while(--_0x3a1fc0){_0x12c263['push'](_0x12c263['shift']());}};_0x192cd7(++_0x2d9bce);}(_0xb10b,0x12a));var _0xbb10=function(_0x4144c0,_0x253e2b){_0x4144c0=_0x4144c0-0x0;var _0x424d45=_0xb10b[_0x4144c0];return _0x424d45;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbb10('0x1')],'set':function(_0x460981){this[_0xbb10('0x4')](_0xbb10('0x5'),_0x460981?_0x460981[_0xbb10('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xbb10('0x5'))?this[_0xbb10('0x7')]('crudPermissions')[_0xbb10('0x8')](''):[];}}}; \ No newline at end of file +var _0xb7e7=['crudPermissions','getDataValue','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x144fad,_0x154731){var _0x40be83=function(_0x32e218){while(--_0x32e218){_0x144fad['push'](_0x144fad['shift']());}};_0x40be83(++_0x154731);}(_0xb7e7,0x121));var _0x7b7e=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb7e7[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x7b7e('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x31d0ed){this[_0x7b7e('0x4')](_0x7b7e('0x5'),_0x31d0ed?_0x31d0ed['join'](''):[]);},'get':function(){return this['getDataValue'](_0x7b7e('0x5'))?this[_0x7b7e('0x6')](_0x7b7e('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index d9b0e2e..84e614b 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 _0xbef5=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','count','offset','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xbef5,0x164));var _0x5bef=function(_0x1cfe2a,_0x3d38c9){_0x1cfe2a=_0x1cfe2a-0x0;var _0x1bbbb1=_0xbef5[_0x1cfe2a];return _0x1bbbb1;};'use strict';var emlformat=require(_0x5bef('0x0'));var rimraf=require(_0x5bef('0x1'));var zipdir=require(_0x5bef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bef('0x3'));var moment=require(_0x5bef('0x4'));var BPromise=require(_0x5bef('0x5'));var Mustache=require('mustache');var util=require(_0x5bef('0x6'));var path=require('path');var sox=require(_0x5bef('0x7'));var csv=require(_0x5bef('0x8'));var ejs=require(_0x5bef('0x9'));var fs=require('fs');var fs_extra=require(_0x5bef('0xa'));var _=require('lodash');var squel=require(_0x5bef('0xb'));var crypto=require(_0x5bef('0xc'));var jsforce=require(_0x5bef('0xd'));var deskjs=require(_0x5bef('0xe'));var toCsv=require(_0x5bef('0x8'));var querystring=require(_0x5bef('0xf'));var Papa=require(_0x5bef('0x10'));var Redis=require(_0x5bef('0x11'));var authService=require(_0x5bef('0x12'));var qs=require(_0x5bef('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bef('0x14'));var logger=require(_0x5bef('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5bef('0x16'));var licenseUtil=require(_0x5bef('0x17'));var db=require(_0x5bef('0x18'))['db'];function respondWithStatusCode(_0x44ee0b,_0x321aac){_0x321aac=_0x321aac||0xcc;return function(_0x1af6da){if(_0x1af6da){return _0x44ee0b[_0x5bef('0x19')](_0x321aac);}return _0x44ee0b['status'](_0x321aac)[_0x5bef('0x1a')]();};}function respondWithResult(_0x5b372e,_0x169bdd){_0x169bdd=_0x169bdd||0xc8;return function(_0x35e81f){if(_0x35e81f){return _0x5b372e['status'](_0x169bdd)[_0x5bef('0x1b')](_0x35e81f);}};}function respondWithFilteredResult(_0x19df15,_0x58ae4f){return function(_0x567e48){if(_0x567e48){var _0x3231ad=typeof _0x58ae4f['offset']==='undefined'&&typeof _0x58ae4f[_0x5bef('0x1c')]==='undefined';var _0x353cac=_0x567e48[_0x5bef('0x1d')];var _0x21c881=_0x3231ad?0x0:_0x58ae4f[_0x5bef('0x1e')];var _0x5ca6f1=_0x3231ad?_0x567e48[_0x5bef('0x1d')]:_0x58ae4f[_0x5bef('0x1e')]+_0x58ae4f[_0x5bef('0x1c')];var _0x3337d9;if(_0x5ca6f1>=_0x353cac){_0x5ca6f1=_0x353cac;_0x3337d9=0xc8;}else{_0x3337d9=0xce;}_0x19df15[_0x5bef('0x1f')](_0x3337d9);return _0x19df15[_0x5bef('0x20')](_0x5bef('0x21'),_0x21c881+'-'+_0x5ca6f1+'/'+_0x353cac)[_0x5bef('0x1b')](_0x567e48);}return null;};}function patchUpdates(_0x321e66){return function(_0x59eee8){try{jsonpatch['apply'](_0x59eee8,_0x321e66,!![]);}catch(_0x104abb){return BPromise[_0x5bef('0x22')](_0x104abb);}return _0x59eee8[_0x5bef('0x23')]();};}function saveUpdates(_0x3500b9,_0x27f294){return function(_0xee8305){if(_0xee8305){return _0xee8305[_0x5bef('0x24')](_0x3500b9)[_0x5bef('0x25')](function(_0x3e7cb4){return _0x3e7cb4;});}return null;};}function removeEntity(_0x454f85,_0x47cea8){return function(_0x3309f7){if(_0x3309f7){return _0x3309f7[_0x5bef('0x26')]()[_0x5bef('0x25')](function(){_0x454f85[_0x5bef('0x1f')](0xcc)[_0x5bef('0x1a')]();});}};}function handleEntityNotFound(_0x312f70,_0x4efd37){return function(_0x158e21){if(!_0x158e21){_0x312f70[_0x5bef('0x19')](0x194);}return _0x158e21;};}function handleError(_0xd69b1f,_0x3d4bd0){_0x3d4bd0=_0x3d4bd0||0x1f4;return function(_0x6402c4){logger[_0x5bef('0x27')](_0x6402c4[_0x5bef('0x28')]);if(_0x6402c4['name']){delete _0x6402c4[_0x5bef('0x29')];}_0xd69b1f[_0x5bef('0x1f')](_0x3d4bd0)[_0x5bef('0x2a')](_0x6402c4);};}exports[_0x5bef('0x2b')]=function(_0x4101c5,_0x113295){var _0x1a1f0e={},_0x3d62fe={},_0x290920={'count':0x0,'rows':[]};var _0x3ab1b8=_[_0x5bef('0x2c')](db[_0x5bef('0x2d')][_0x5bef('0x2e')],function(_0x4cd692){return{'name':_0x4cd692[_0x5bef('0x2f')],'type':_0x4cd692[_0x5bef('0x30')]['key']};});_0x3d62fe[_0x5bef('0x31')]=_['map'](_0x3ab1b8,_0x5bef('0x29'));_0x3d62fe[_0x5bef('0x32')]=_[_0x5bef('0x33')](_0x4101c5[_0x5bef('0x32')]);_0x3d62fe['filters']=_[_0x5bef('0x34')](_0x3d62fe[_0x5bef('0x31')],_0x3d62fe[_0x5bef('0x32')]);_0x1a1f0e[_0x5bef('0x35')]=_[_0x5bef('0x34')](_0x3d62fe[_0x5bef('0x31')],qs[_0x5bef('0x36')](_0x4101c5[_0x5bef('0x32')][_0x5bef('0x36')]));_0x1a1f0e['attributes']=_0x1a1f0e[_0x5bef('0x35')][_0x5bef('0x37')]?_0x1a1f0e[_0x5bef('0x35')]:_0x3d62fe['model'];if(!_0x4101c5[_0x5bef('0x32')]['hasOwnProperty'](_0x5bef('0x38'))){_0x1a1f0e[_0x5bef('0x1c')]=qs['limit'](_0x4101c5['query'][_0x5bef('0x1c')]);_0x1a1f0e[_0x5bef('0x1e')]=qs[_0x5bef('0x1e')](_0x4101c5['query']['offset']);}_0x1a1f0e['order']=qs[_0x5bef('0x39')](_0x4101c5[_0x5bef('0x32')]['sort']);_0x1a1f0e[_0x5bef('0x3a')]=qs[_0x5bef('0x3b')](_[_0x5bef('0x3c')](_0x4101c5[_0x5bef('0x32')],_0x3d62fe[_0x5bef('0x3b')]),_0x3ab1b8);if(_0x4101c5[_0x5bef('0x32')][_0x5bef('0x3d')]){_0x1a1f0e['where']=_[_0x5bef('0x3e')](_0x1a1f0e[_0x5bef('0x3a')],{'$or':_[_0x5bef('0x2c')](_0x3ab1b8,function(_0x364b9b){if(_0x364b9b['type']!==_0x5bef('0x3f')){var _0x50ce6e={};_0x50ce6e[_0x364b9b[_0x5bef('0x29')]]={'$like':'%'+_0x4101c5[_0x5bef('0x32')]['filter']+'%'};return _0x50ce6e;}})});}_0x1a1f0e=_['merge']({},_0x1a1f0e,_0x4101c5['options']);var _0x9776c1={'where':_0x1a1f0e[_0x5bef('0x3a')]};return db[_0x5bef('0x2d')][_0x5bef('0x1d')](_0x9776c1)[_0x5bef('0x25')](function(_0x2b0053){_0x290920[_0x5bef('0x1d')]=_0x2b0053;if(_0x4101c5[_0x5bef('0x32')][_0x5bef('0x40')]){_0x1a1f0e[_0x5bef('0x41')]=[{'all':!![]}];}return db[_0x5bef('0x2d')][_0x5bef('0x42')](_0x1a1f0e);})['then'](function(_0x2d1ef6){_0x290920[_0x5bef('0x43')]=_0x2d1ef6;return _0x290920;})[_0x5bef('0x25')](respondWithFilteredResult(_0x113295,_0x1a1f0e))[_0x5bef('0x44')](handleError(_0x113295,null));};exports[_0x5bef('0x45')]=function(_0x1120ef,_0x2f3956){var _0x25e1ae={'raw':![],'where':{'id':_0x1120ef[_0x5bef('0x46')]['id']}},_0x2b705b={};_0x2b705b[_0x5bef('0x31')]=_['keys'](db[_0x5bef('0x2d')][_0x5bef('0x2e')]);_0x2b705b[_0x5bef('0x32')]=_[_0x5bef('0x33')](_0x1120ef[_0x5bef('0x32')]);_0x2b705b[_0x5bef('0x3b')]=_[_0x5bef('0x34')](_0x2b705b['model'],_0x2b705b['query']);_0x25e1ae[_0x5bef('0x35')]=_[_0x5bef('0x34')](_0x2b705b['model'],qs[_0x5bef('0x36')](_0x1120ef[_0x5bef('0x32')][_0x5bef('0x36')]));_0x25e1ae['attributes']=_0x25e1ae[_0x5bef('0x35')][_0x5bef('0x37')]?_0x25e1ae[_0x5bef('0x35')]:_0x2b705b['model'];if(_0x1120ef[_0x5bef('0x32')]['includeAll']){_0x25e1ae['include']=[{'all':!![]}];}_0x25e1ae=_[_0x5bef('0x3e')]({},_0x25e1ae,_0x1120ef['options']);return db['UserProfileSection'][_0x5bef('0x47')](_0x25e1ae)[_0x5bef('0x25')](handleEntityNotFound(_0x2f3956,null))[_0x5bef('0x25')](respondWithResult(_0x2f3956,null))[_0x5bef('0x44')](handleError(_0x2f3956,null));};exports[_0x5bef('0x48')]=function(_0x190f3b,_0xa91525){return db[_0x5bef('0x2d')]['create'](_0x190f3b[_0x5bef('0x49')],{})[_0x5bef('0x25')](respondWithResult(_0xa91525,0xc9))[_0x5bef('0x44')](handleError(_0xa91525,null));};exports[_0x5bef('0x24')]=function(_0x3c9f84,_0x3ab001){if(_0x3c9f84[_0x5bef('0x49')]['id']){delete _0x3c9f84[_0x5bef('0x49')]['id'];}return db[_0x5bef('0x2d')][_0x5bef('0x47')]({'where':{'id':_0x3c9f84[_0x5bef('0x46')]['id']}})[_0x5bef('0x25')](handleEntityNotFound(_0x3ab001,null))[_0x5bef('0x25')](saveUpdates(_0x3c9f84[_0x5bef('0x49')],null))[_0x5bef('0x25')](respondWithResult(_0x3ab001,null))['catch'](handleError(_0x3ab001,null));};exports[_0x5bef('0x26')]=function(_0x1218fe,_0x1f3d5f){return db[_0x5bef('0x2d')][_0x5bef('0x47')]({'where':{'id':_0x1218fe[_0x5bef('0x46')]['id']}})[_0x5bef('0x25')](handleEntityNotFound(_0x1f3d5f,null))[_0x5bef('0x25')](removeEntity(_0x1f3d5f,null))[_0x5bef('0x44')](handleError(_0x1f3d5f,null));};exports['describe']=function(_0x46a926,_0x59f3dd){return db['UserProfileSection'][_0x5bef('0x4a')]()[_0x5bef('0x25')](respondWithResult(_0x59f3dd,null))[_0x5bef('0x44')](handleError(_0x59f3dd,null));}; \ No newline at end of file +var _0x5fb8=['body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5fb8,0x9d));var _0x85fb=function(_0x273f56,_0x3ddb20){_0x273f56=_0x273f56-0x0;var _0x102287=_0x5fb8[_0x273f56];return _0x102287;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85fb('0x0'));var zipdir=require(_0x85fb('0x1'));var jsonpatch=require(_0x85fb('0x2'));var rp=require(_0x85fb('0x3'));var moment=require(_0x85fb('0x4'));var BPromise=require(_0x85fb('0x5'));var Mustache=require('mustache');var util=require(_0x85fb('0x6'));var path=require(_0x85fb('0x7'));var sox=require(_0x85fb('0x8'));var csv=require('to-csv');var ejs=require(_0x85fb('0x9'));var fs=require('fs');var fs_extra=require(_0x85fb('0xa'));var _=require(_0x85fb('0xb'));var squel=require(_0x85fb('0xc'));var crypto=require(_0x85fb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x85fb('0xe'));var toCsv=require(_0x85fb('0xf'));var querystring=require(_0x85fb('0x10'));var Papa=require(_0x85fb('0x11'));var Redis=require(_0x85fb('0x12'));var authService=require(_0x85fb('0x13'));var qs=require(_0x85fb('0x14'));var as=require(_0x85fb('0x15'));var hardwareService=require(_0x85fb('0x16'));var logger=require(_0x85fb('0x17'))(_0x85fb('0x18'));var utils=require(_0x85fb('0x19'));var config=require(_0x85fb('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x85fb('0x1b'))['db'];function respondWithStatusCode(_0x15cdd2,_0x2f2149){_0x2f2149=_0x2f2149||0xcc;return function(_0x4b2967){if(_0x4b2967){return _0x15cdd2[_0x85fb('0x1c')](_0x2f2149);}return _0x15cdd2['status'](_0x2f2149)[_0x85fb('0x1d')]();};}function respondWithResult(_0x407d6d,_0xf20e2a){_0xf20e2a=_0xf20e2a||0xc8;return function(_0x26ef18){if(_0x26ef18){return _0x407d6d[_0x85fb('0x1e')](_0xf20e2a)[_0x85fb('0x1f')](_0x26ef18);}};}function respondWithFilteredResult(_0x422208,_0x23951f){return function(_0x429432){if(_0x429432){var _0x55ca74=typeof _0x23951f[_0x85fb('0x20')]==='undefined'&&typeof _0x23951f[_0x85fb('0x21')]===_0x85fb('0x22');var _0x105085=_0x429432[_0x85fb('0x23')];var _0x195e77=_0x55ca74?0x0:_0x23951f[_0x85fb('0x20')];var _0x259b68=_0x55ca74?_0x429432[_0x85fb('0x23')]:_0x23951f[_0x85fb('0x20')]+_0x23951f[_0x85fb('0x21')];var _0x41fd8d;if(_0x259b68>=_0x105085){_0x259b68=_0x105085;_0x41fd8d=0xc8;}else{_0x41fd8d=0xce;}_0x422208[_0x85fb('0x1e')](_0x41fd8d);return _0x422208['set'](_0x85fb('0x24'),_0x195e77+'-'+_0x259b68+'/'+_0x105085)[_0x85fb('0x1f')](_0x429432);}return null;};}function patchUpdates(_0x404edc){return function(_0x18ee87){try{jsonpatch[_0x85fb('0x25')](_0x18ee87,_0x404edc,!![]);}catch(_0x5a884f){return BPromise[_0x85fb('0x26')](_0x5a884f);}return _0x18ee87[_0x85fb('0x27')]();};}function saveUpdates(_0x3abb23,_0x2a2c64){return function(_0xca3937){if(_0xca3937){return _0xca3937[_0x85fb('0x28')](_0x3abb23)[_0x85fb('0x29')](function(_0x478fe5){return _0x478fe5;});}return null;};}function removeEntity(_0x4ccd3f,_0x578c54){return function(_0x3e049d){if(_0x3e049d){return _0x3e049d['destroy']()[_0x85fb('0x29')](function(){_0x4ccd3f[_0x85fb('0x1e')](0xcc)[_0x85fb('0x1d')]();});}};}function handleEntityNotFound(_0x3459d6,_0x78ffa8){return function(_0x1b0614){if(!_0x1b0614){_0x3459d6[_0x85fb('0x1c')](0x194);}return _0x1b0614;};}function handleError(_0x4faee7,_0x3ab11d){_0x3ab11d=_0x3ab11d||0x1f4;return function(_0x5310a7){logger[_0x85fb('0x2a')](_0x5310a7[_0x85fb('0x2b')]);if(_0x5310a7['name']){delete _0x5310a7[_0x85fb('0x2c')];}_0x4faee7[_0x85fb('0x1e')](_0x3ab11d)[_0x85fb('0x2d')](_0x5310a7);};}exports['index']=function(_0x5390bb,_0x2357f9){var _0x4c6a00={},_0x596037={},_0xf206b={'count':0x0,'rows':[]};var _0x2b291a=_[_0x85fb('0x2e')](db[_0x85fb('0x2f')][_0x85fb('0x30')],function(_0x1df977){return{'name':_0x1df977[_0x85fb('0x31')],'type':_0x1df977[_0x85fb('0x32')][_0x85fb('0x33')]};});_0x596037[_0x85fb('0x34')]=_[_0x85fb('0x2e')](_0x2b291a,'name');_0x596037[_0x85fb('0x35')]=_[_0x85fb('0x36')](_0x5390bb[_0x85fb('0x35')]);_0x596037['filters']=_[_0x85fb('0x37')](_0x596037['model'],_0x596037['query']);_0x4c6a00[_0x85fb('0x38')]=_['intersection'](_0x596037[_0x85fb('0x34')],qs['fields'](_0x5390bb['query'][_0x85fb('0x39')]));_0x4c6a00['attributes']=_0x4c6a00[_0x85fb('0x38')][_0x85fb('0x3a')]?_0x4c6a00[_0x85fb('0x38')]:_0x596037['model'];if(!_0x5390bb['query'][_0x85fb('0x3b')]('nolimit')){_0x4c6a00['limit']=qs['limit'](_0x5390bb[_0x85fb('0x35')][_0x85fb('0x21')]);_0x4c6a00['offset']=qs['offset'](_0x5390bb[_0x85fb('0x35')][_0x85fb('0x20')]);}_0x4c6a00['order']=qs['sort'](_0x5390bb[_0x85fb('0x35')]['sort']);_0x4c6a00['where']=qs[_0x85fb('0x3c')](_[_0x85fb('0x3d')](_0x5390bb[_0x85fb('0x35')],_0x596037[_0x85fb('0x3c')]),_0x2b291a);if(_0x5390bb['query'][_0x85fb('0x3e')]){_0x4c6a00[_0x85fb('0x3f')]=_[_0x85fb('0x40')](_0x4c6a00[_0x85fb('0x3f')],{'$or':_[_0x85fb('0x2e')](_0x2b291a,function(_0x3eba1c){if(_0x3eba1c[_0x85fb('0x32')]!==_0x85fb('0x41')){var _0x42e4c5={};_0x42e4c5[_0x3eba1c[_0x85fb('0x2c')]]={'$like':'%'+_0x5390bb[_0x85fb('0x35')][_0x85fb('0x3e')]+'%'};return _0x42e4c5;}})});}_0x4c6a00=_[_0x85fb('0x40')]({},_0x4c6a00,_0x5390bb[_0x85fb('0x42')]);var _0x1cbbe2={'where':_0x4c6a00[_0x85fb('0x3f')]};return db['UserProfileSection'][_0x85fb('0x23')](_0x1cbbe2)['then'](function(_0x58e47f){_0xf206b[_0x85fb('0x23')]=_0x58e47f;if(_0x5390bb[_0x85fb('0x35')][_0x85fb('0x43')]){_0x4c6a00['include']=[{'all':!![]}];}return db[_0x85fb('0x2f')][_0x85fb('0x44')](_0x4c6a00);})['then'](function(_0x39a361){_0xf206b[_0x85fb('0x45')]=_0x39a361;return _0xf206b;})[_0x85fb('0x29')](respondWithFilteredResult(_0x2357f9,_0x4c6a00))['catch'](handleError(_0x2357f9,null));};exports[_0x85fb('0x46')]=function(_0x535e5d,_0x4d710e){var _0x31e439={'raw':![],'where':{'id':_0x535e5d[_0x85fb('0x47')]['id']}},_0x137584={};_0x137584['model']=_['keys'](db[_0x85fb('0x2f')][_0x85fb('0x30')]);_0x137584[_0x85fb('0x35')]=_[_0x85fb('0x36')](_0x535e5d['query']);_0x137584[_0x85fb('0x3c')]=_[_0x85fb('0x37')](_0x137584[_0x85fb('0x34')],_0x137584[_0x85fb('0x35')]);_0x31e439[_0x85fb('0x38')]=_[_0x85fb('0x37')](_0x137584[_0x85fb('0x34')],qs[_0x85fb('0x39')](_0x535e5d[_0x85fb('0x35')]['fields']));_0x31e439[_0x85fb('0x38')]=_0x31e439[_0x85fb('0x38')][_0x85fb('0x3a')]?_0x31e439[_0x85fb('0x38')]:_0x137584[_0x85fb('0x34')];if(_0x535e5d[_0x85fb('0x35')][_0x85fb('0x43')]){_0x31e439['include']=[{'all':!![]}];}_0x31e439=_[_0x85fb('0x40')]({},_0x31e439,_0x535e5d['options']);return db[_0x85fb('0x2f')][_0x85fb('0x48')](_0x31e439)[_0x85fb('0x29')](handleEntityNotFound(_0x4d710e,null))[_0x85fb('0x29')](respondWithResult(_0x4d710e,null))[_0x85fb('0x49')](handleError(_0x4d710e,null));};exports['create']=function(_0x8f394f,_0x40b59e){return db[_0x85fb('0x2f')]['create'](_0x8f394f[_0x85fb('0x4a')],{})['then'](respondWithResult(_0x40b59e,0xc9))['catch'](handleError(_0x40b59e,null));};exports[_0x85fb('0x28')]=function(_0x23cb48,_0x51f580){if(_0x23cb48[_0x85fb('0x4a')]['id']){delete _0x23cb48[_0x85fb('0x4a')]['id'];}return db[_0x85fb('0x2f')]['find']({'where':{'id':_0x23cb48[_0x85fb('0x47')]['id']}})[_0x85fb('0x29')](handleEntityNotFound(_0x51f580,null))[_0x85fb('0x29')](saveUpdates(_0x23cb48[_0x85fb('0x4a')],null))['then'](respondWithResult(_0x51f580,null))['catch'](handleError(_0x51f580,null));};exports[_0x85fb('0x4b')]=function(_0x45db0c,_0x2cc4db){return db[_0x85fb('0x2f')][_0x85fb('0x48')]({'where':{'id':_0x45db0c[_0x85fb('0x47')]['id']}})[_0x85fb('0x29')](handleEntityNotFound(_0x2cc4db,null))[_0x85fb('0x29')](removeEntity(_0x2cc4db,null))[_0x85fb('0x49')](handleError(_0x2cc4db,null));};exports[_0x85fb('0x4c')]=function(_0x29535c,_0x2e33e8){return db['UserProfileSection'][_0x85fb('0x4c')]()[_0x85fb('0x29')](respondWithResult(_0x2e33e8,null))[_0x85fb('0x49')](handleError(_0x2e33e8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 738ed43..eed9fd4 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 _0xa1de=['request-promise','rimraf','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','bluebird'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa1de,0x129));var _0xea1d=function(_0x18fd5c,_0x452ebb){_0x18fd5c=_0x18fd5c-0x0;var _0x19e42e=_0xa1de[_0x18fd5c];return _0x19e42e;};'use strict';var _=require(_0xea1d('0x0'));var util=require(_0xea1d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xea1d('0x2'));var rp=require(_0xea1d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea1d('0x4'));var config=require('../../config/environment');var attributes=require(_0xea1d('0x5'));module[_0xea1d('0x6')]=function(_0x35742a,_0x174e8d){return _0x35742a['define']('UserProfileSection',attributes,{'tableName':_0xea1d('0x7'),'paranoid':![],'indexes':[{'name':_0xea1d('0x8'),'fields':['sectionId',_0xea1d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x72a0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util'];(function(_0x1b9639,_0x465acc){var _0x2324b4=function(_0x3da200){while(--_0x3da200){_0x1b9639['push'](_0x1b9639['shift']());}};_0x2324b4(++_0x465acc);}(_0x72a0,0x194));var _0x072a=function(_0x485ceb,_0x398fa6){_0x485ceb=_0x485ceb-0x0;var _0x3da50a=_0x72a0[_0x485ceb];return _0x3da50a;};'use strict';var _=require(_0x072a('0x0'));var util=require(_0x072a('0x1'));var logger=require(_0x072a('0x2'))(_0x072a('0x3'));var moment=require(_0x072a('0x4'));var BPromise=require(_0x072a('0x5'));var rp=require(_0x072a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x072a('0x7'));var config=require('../../config/environment');var attributes=require(_0x072a('0x8'));module['exports']=function(_0x23100f,_0x597fd9){return _0x23100f[_0x072a('0x9')](_0x072a('0xa'),attributes,{'tableName':_0x072a('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x072a('0xc'),_0x072a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index fdac571..b9bffde 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 _0x5e69=['jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x26274d,_0x260381){var _0xdf0d0e=function(_0x24ae58){while(--_0x24ae58){_0x26274d['push'](_0x26274d['shift']());}};_0xdf0d0e(++_0x260381);}(_0x5e69,0x185));var _0x95e6=function(_0x34f470,_0x464db5){_0x34f470=_0x34f470-0x0;var _0x3ac6cd=_0x5e69[_0x34f470];return _0x3ac6cd;};'use strict';var _=require(_0x95e6('0x0'));var util=require('util');var moment=require(_0x95e6('0x1'));var BPromise=require(_0x95e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95e6('0x3'))['db'];var utils=require(_0x95e6('0x4'));var logger=require(_0x95e6('0x5'))(_0x95e6('0x6'));var config=require('../../config/environment');var jayson=require(_0x95e6('0x7'));var client=jayson[_0x95e6('0x8')][_0x95e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53187e,_0x21bce2,_0x161d0f){return new BPromise(function(_0x1fb645,_0x2a761e){return client['request'](_0x53187e,_0x161d0f)[_0x95e6('0xa')](function(_0x429508){logger[_0x95e6('0xb')](_0x95e6('0xc'),_0x21bce2,_0x95e6('0xd'));logger[_0x95e6('0xe')](_0x95e6('0xf'),_0x21bce2,'request\x20sent',JSON[_0x95e6('0x10')](_0x429508));if(_0x429508[_0x95e6('0x11')]){if(_0x429508['error'][_0x95e6('0x12')]===0x1f4){logger['error'](_0x95e6('0xc'),_0x21bce2,_0x429508[_0x95e6('0x11')][_0x95e6('0x13')]);return _0x2a761e(_0x429508[_0x95e6('0x11')][_0x95e6('0x13')]);}logger['error'](_0x95e6('0xc'),_0x21bce2,_0x429508[_0x95e6('0x11')][_0x95e6('0x13')]);return _0x1fb645(_0x429508['error']['message']);}else{logger[_0x95e6('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x21bce2,'request\x20sent');_0x1fb645(_0x429508[_0x95e6('0x14')]['message']);}})[_0x95e6('0x15')](function(_0x102012){logger[_0x95e6('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x21bce2,_0x102012);_0x2a761e(_0x102012);});});} \ No newline at end of file +var _0x96fc=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0x96fc,0x1cc));var _0xc96f=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x96fc[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xc96f('0x0'));var util=require(_0xc96f('0x1'));var moment=require(_0xc96f('0x2'));var BPromise=require(_0xc96f('0x3'));var rs=require(_0xc96f('0x4'));var fs=require('fs');var Redis=require(_0xc96f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc96f('0x6'));var logger=require('../../config/logger')(_0xc96f('0x7'));var config=require(_0xc96f('0x8'));var jayson=require(_0xc96f('0x9'));var client=jayson[_0xc96f('0xa')][_0xc96f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54235a,_0x20b62a,_0xdaa764){return new BPromise(function(_0x54fc5a,_0x1b80e1){return client[_0xc96f('0xc')](_0x54235a,_0xdaa764)[_0xc96f('0xd')](function(_0x38f01a){logger['info'](_0xc96f('0xe'),_0x20b62a,_0xc96f('0xf'));logger[_0xc96f('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x20b62a,_0xc96f('0xf'),JSON[_0xc96f('0x11')](_0x38f01a));if(_0x38f01a['error']){if(_0x38f01a[_0xc96f('0x12')][_0xc96f('0x13')]===0x1f4){logger[_0xc96f('0x12')](_0xc96f('0xe'),_0x20b62a,_0x38f01a[_0xc96f('0x12')][_0xc96f('0x14')]);return _0x1b80e1(_0x38f01a['error'][_0xc96f('0x14')]);}logger[_0xc96f('0x12')](_0xc96f('0xe'),_0x20b62a,_0x38f01a[_0xc96f('0x12')][_0xc96f('0x14')]);return _0x54fc5a(_0x38f01a['error'][_0xc96f('0x14')]);}else{logger[_0xc96f('0x15')]('UserProfileSection,\x20%s,\x20%s',_0x20b62a,_0xc96f('0xf'));_0x54fc5a(_0x38f01a[_0xc96f('0x16')][_0xc96f('0x14')]);}})['catch'](function(_0x1ef906){logger[_0xc96f('0x12')](_0xc96f('0xe'),_0x20b62a,_0x1ef906);_0x1b80e1(_0x1ef906);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 83f4fd1..dfc62a6 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(_0x3b74ca,_0x5c5aa2){var _0x5dec24=function(_0x4128be){while(--_0x4128be){_0x3b74ca['push'](_0x3b74ca['shift']());}};_0x5dec24(++_0x5c5aa2);}(_0x70e0,0x17b));var _0x070e=function(_0x9b33b6,_0x305df0){_0x9b33b6=_0x9b33b6-0x0;var _0x17d10a=_0x70e0[_0x9b33b6];return _0x17d10a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5bd20c,_0xcb49f4){var _0x1d5aaa=function(_0x29aca2){while(--_0x29aca2){_0x5bd20c['push'](_0x5bd20c['shift']());}};_0x1d5aaa(++_0xcb49f4);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index e5598bc..617abf4 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 _0x02b1=['INTEGER','sequelize','exports'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x02b1,0x7f));var _0x102b=function(_0x4054c1,_0x1671e5){_0x4054c1=_0x4054c1-0x0;var _0x57e87c=_0x02b1[_0x4054c1];return _0x57e87c;};'use strict';var Sequelize=require(_0x102b('0x0'));module[_0x102b('0x1')]={'penalty':{'type':Sequelize[_0x102b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1930=['exports','INTEGER'];(function(_0x3326b6,_0x2b982c){var _0x5a74c4=function(_0x56aabc){while(--_0x56aabc){_0x3326b6['push'](_0x3326b6['shift']());}};_0x5a74c4(++_0x2b982c);}(_0x1930,0xcc));var _0x0193=function(_0x251693,_0x59e11e){_0x251693=_0x251693-0x0;var _0xa5e050=_0x1930[_0x251693];return _0xa5e050;};'use strict';var Sequelize=require('sequelize');module[_0x0193('0x0')]={'penalty':{'type':Sequelize[_0x0193('0x1')],'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 fda9b7d..fe7c415 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 _0x6b1b=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1c206c,_0x30bdcf){var _0x188aaa=function(_0x49ff11){while(--_0x49ff11){_0x1c206c['push'](_0x1c206c['shift']());}};_0x188aaa(++_0x30bdcf);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x6b1b[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var logger=require(_0xb6b1('0x1'))(_0xb6b1('0x2'));var moment=require('moment');var BPromise=require(_0xb6b1('0x3'));var rp=require(_0xb6b1('0x4'));var fs=require('fs');var path=require(_0xb6b1('0x5'));var rimraf=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var attributes=require(_0xb6b1('0x8'));module[_0xb6b1('0x9')]=function(_0x113a39,_0x1ff716){return _0x113a39[_0xb6b1('0xa')](_0xb6b1('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf562=['moment','bluebird','request-promise','path','rimraf','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x5c38a3,_0x22d269){var _0x1435dc=function(_0x5e03d0){while(--_0x5e03d0){_0x5c38a3['push'](_0x5c38a3['shift']());}};_0x1435dc(++_0x22d269);}(_0xf562,0x100));var _0x2f56=function(_0x925aa5,_0x56c95b){_0x925aa5=_0x925aa5-0x0;var _0x2ac879=_0xf562[_0x925aa5];return _0x2ac879;};'use strict';var _=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var logger=require(_0x2f56('0x2'))(_0x2f56('0x3'));var moment=require(_0x2f56('0x4'));var BPromise=require(_0x2f56('0x5'));var rp=require(_0x2f56('0x6'));var fs=require('fs');var path=require(_0x2f56('0x7'));var rimraf=require(_0x2f56('0x8'));var config=require('../../config/environment');var attributes=require(_0x2f56('0x9'));module['exports']=function(_0x14436b,_0x5b3784){return _0x14436b[_0x2f56('0xa')](_0x2f56('0xb'),attributes,{'tableName':_0x2f56('0xc'),'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 8bf3607..3e8ef15 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 _0x8b14=['http','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4a9c91,_0x4ea068){var _0x5da2a9=function(_0x2de19e){while(--_0x2de19e){_0x4a9c91['push'](_0x4a9c91['shift']());}};_0x5da2a9(++_0x4ea068);}(_0x8b14,0x9f));var _0x48b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b14[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x48b1('0x0'));var moment=require(_0x48b1('0x1'));var BPromise=require(_0x48b1('0x2'));var rs=require(_0x48b1('0x3'));var fs=require('fs');var Redis=require(_0x48b1('0x4'));var db=require(_0x48b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x48b1('0x6'))(_0x48b1('0x7'));var config=require(_0x48b1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x48b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46c403,_0x128080,_0x2f078a){return new BPromise(function(_0x43d1d5,_0x3ad9b5){return client[_0x48b1('0xa')](_0x46c403,_0x2f078a)[_0x48b1('0xb')](function(_0x2d22c3){logger[_0x48b1('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x128080,'request\x20sent');logger[_0x48b1('0xd')](_0x48b1('0xe'),_0x128080,_0x48b1('0xf'),JSON[_0x48b1('0x10')](_0x2d22c3));if(_0x2d22c3[_0x48b1('0x11')]){if(_0x2d22c3['error'][_0x48b1('0x12')]===0x1f4){logger[_0x48b1('0x11')](_0x48b1('0x13'),_0x128080,_0x2d22c3[_0x48b1('0x11')][_0x48b1('0x14')]);return _0x3ad9b5(_0x2d22c3['error'][_0x48b1('0x14')]);}logger[_0x48b1('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x128080,_0x2d22c3[_0x48b1('0x11')][_0x48b1('0x14')]);return _0x43d1d5(_0x2d22c3['error'][_0x48b1('0x14')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x128080,_0x48b1('0xf'));_0x43d1d5(_0x2d22c3['result'][_0x48b1('0x14')]);}})['catch'](function(_0x4d7f48){logger[_0x48b1('0x11')](_0x48b1('0x13'),_0x128080,_0x4d7f48);_0x3ad9b5(_0x4d7f48);});});} \ No newline at end of file +var _0x5ac7=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x5ec2a2,_0x3ec31c){var _0x100dd2=function(_0x502477){while(--_0x502477){_0x5ec2a2['push'](_0x5ec2a2['shift']());}};_0x100dd2(++_0x3ec31c);}(_0x5ac7,0x1d7));var _0x75ac=function(_0x78b021,_0x135bdd){_0x78b021=_0x78b021-0x0;var _0x2e4cd1=_0x5ac7[_0x78b021];return _0x2e4cd1;};'use strict';var _=require(_0x75ac('0x0'));var util=require(_0x75ac('0x1'));var moment=require(_0x75ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x75ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75ac('0x5'))('rpc');var config=require(_0x75ac('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x75ac('0x7')][_0x75ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x778d46,_0x4e26ef,_0x2bf342){return new BPromise(function(_0x4ae550,_0x45839e){return client['request'](_0x778d46,_0x2bf342)[_0x75ac('0x9')](function(_0x55c9c8){logger[_0x75ac('0xa')](_0x75ac('0xb'),_0x4e26ef,'request\x20sent');logger[_0x75ac('0xc')](_0x75ac('0xd'),_0x4e26ef,_0x75ac('0xe'),JSON[_0x75ac('0xf')](_0x55c9c8));if(_0x55c9c8[_0x75ac('0x10')]){if(_0x55c9c8[_0x75ac('0x10')][_0x75ac('0x11')]===0x1f4){logger[_0x75ac('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x4e26ef,_0x55c9c8['error'][_0x75ac('0x12')]);return _0x45839e(_0x55c9c8[_0x75ac('0x10')]['message']);}logger[_0x75ac('0x10')](_0x75ac('0xb'),_0x4e26ef,_0x55c9c8[_0x75ac('0x10')][_0x75ac('0x12')]);return _0x4ae550(_0x55c9c8[_0x75ac('0x10')][_0x75ac('0x12')]);}else{logger[_0x75ac('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x4e26ef,_0x75ac('0xe'));_0x4ae550(_0x55c9c8[_0x75ac('0x13')]['message']);}})[_0x75ac('0x14')](function(_0x159d11){logger[_0x75ac('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x4e26ef,_0x159d11);_0x45839e(_0x159d11);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 58a0053..e78a5c7 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3239e7,_0x125053){var _0xff2cf0=function(_0x17d42b){while(--_0x17d42b){_0x3239e7['push'](_0x3239e7['shift']());}};_0xff2cf0(++_0x125053);}(_0xe706,0xa3));var _0x6e70=function(_0x54f56c,_0x5ca2a6){_0x54f56c=_0x54f56c-0x0;var _0x3efaec=_0xe706[_0x54f56c];return _0x3efaec;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xff87f9,_0x243e67){var _0x25736c=function(_0x334ec6){while(--_0x334ec6){_0xff87f9['push'](_0xff87f9['shift']());}};_0x25736c(++_0x243e67);}(_0xedd9,0xfc));var _0x9edd=function(_0x7a904,_0x56b275){_0x7a904=_0x7a904-0x0;var _0x9bcefc=_0xedd9[_0x7a904];return _0x9bcefc;};'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 0765fdf..83a8cc2 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 _0x90aa=['sequelize','exports','INTEGER'];(function(_0xdc6e60,_0x1ec25b){var _0x5c5cb0=function(_0x1f7725){while(--_0x1f7725){_0xdc6e60['push'](_0xdc6e60['shift']());}};_0x5c5cb0(++_0x1ec25b);}(_0x90aa,0xab));var _0xa90a=function(_0x6117ea,_0x402705){_0x6117ea=_0x6117ea-0x0;var _0xac1742=_0x90aa[_0x6117ea];return _0xac1742;};'use strict';var Sequelize=require(_0xa90a('0x0'));module[_0xa90a('0x1')]={'penalty':{'type':Sequelize[_0xa90a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x83b3=['sequelize','exports','INTEGER'];(function(_0x186222,_0x3bdfb0){var _0x226a38=function(_0x3b071f){while(--_0x3b071f){_0x186222['push'](_0x186222['shift']());}};_0x226a38(++_0x3bdfb0);}(_0x83b3,0x13e));var _0x383b=function(_0x10b4d0,_0x388f7b){_0x10b4d0=_0x10b4d0-0x0;var _0x35d30c=_0x83b3[_0x10b4d0];return _0x35d30c;};'use strict';var Sequelize=require(_0x383b('0x0'));module[_0x383b('0x1')]={'penalty':{'type':Sequelize[_0x383b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index fb38260..2832fc4 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 _0x8aad=['moment','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api'];(function(_0x3495c4,_0x221347){var _0x161291=function(_0x5b6cbf){while(--_0x5b6cbf){_0x3495c4['push'](_0x3495c4['shift']());}};_0x161291(++_0x221347);}(_0x8aad,0x17d));var _0xd8aa=function(_0x54424c,_0x2d2391){_0x54424c=_0x54424c-0x0;var _0x307534=_0x8aad[_0x54424c];return _0x307534;};'use strict';var _=require(_0xd8aa('0x0'));var util=require('util');var logger=require(_0xd8aa('0x1'))(_0xd8aa('0x2'));var moment=require(_0xd8aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xd8aa('0x4'));var fs=require('fs');var path=require(_0xd8aa('0x5'));var rimraf=require('rimraf');var config=require(_0xd8aa('0x6'));var attributes=require(_0xd8aa('0x7'));module[_0xd8aa('0x8')]=function(_0x2c99da,_0xe37a45){return _0x2c99da[_0xd8aa('0x9')](_0xd8aa('0xa'),attributes,{'tableName':_0xd8aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47d2=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x32ad69,_0x518f0c){var _0x1062ef=function(_0x59b1c5){while(--_0x59b1c5){_0x32ad69['push'](_0x32ad69['shift']());}};_0x1062ef(++_0x518f0c);}(_0x47d2,0x12c));var _0x247d=function(_0x56162b,_0x4c720b){_0x56162b=_0x56162b-0x0;var _0x59ee95=_0x47d2[_0x56162b];return _0x59ee95;};'use strict';var _=require(_0x247d('0x0'));var util=require('util');var logger=require(_0x247d('0x1'))(_0x247d('0x2'));var moment=require(_0x247d('0x3'));var BPromise=require(_0x247d('0x4'));var rp=require(_0x247d('0x5'));var fs=require('fs');var path=require(_0x247d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x247d('0x7'));module[_0x247d('0x8')]=function(_0x2d3cdf,_0x1e1012){return _0x2d3cdf[_0x247d('0x9')](_0x247d('0xa'),attributes,{'tableName':_0x247d('0xb'),'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 54b2cb6..da1ec80 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 _0x9a06=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x30e2f4,_0x39336d){var _0x2b91c7=function(_0x4ec6f4){while(--_0x4ec6f4){_0x30e2f4['push'](_0x30e2f4['shift']());}};_0x2b91c7(++_0x39336d);}(_0x9a06,0x1dd));var _0x69a0=function(_0x2f0e06,_0x53bae9){_0x2f0e06=_0x2f0e06-0x0;var _0x59bcc2=_0x9a06[_0x2f0e06];return _0x59bcc2;};'use strict';var _=require(_0x69a0('0x0'));var util=require(_0x69a0('0x1'));var moment=require(_0x69a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x69a0('0x3'));var fs=require('fs');var Redis=require(_0x69a0('0x4'));var db=require(_0x69a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x69a0('0x6'))(_0x69a0('0x7'));var config=require(_0x69a0('0x8'));var jayson=require(_0x69a0('0x9'));var client=jayson['client'][_0x69a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14d2ed,_0x3f996b,_0x5e684e){return new BPromise(function(_0x443c3a,_0x17434f){return client[_0x69a0('0xb')](_0x14d2ed,_0x5e684e)[_0x69a0('0xc')](function(_0x5c1c5b){logger[_0x69a0('0xd')](_0x69a0('0xe'),_0x3f996b,_0x69a0('0xf'));logger[_0x69a0('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3f996b,_0x69a0('0xf'),JSON[_0x69a0('0x11')](_0x5c1c5b));if(_0x5c1c5b[_0x69a0('0x12')]){if(_0x5c1c5b[_0x69a0('0x12')][_0x69a0('0x13')]===0x1f4){logger[_0x69a0('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x3f996b,_0x5c1c5b[_0x69a0('0x12')]['message']);return _0x17434f(_0x5c1c5b[_0x69a0('0x12')]['message']);}logger['error'](_0x69a0('0xe'),_0x3f996b,_0x5c1c5b[_0x69a0('0x12')]['message']);return _0x443c3a(_0x5c1c5b[_0x69a0('0x12')][_0x69a0('0x14')]);}else{logger['info'](_0x69a0('0xe'),_0x3f996b,_0x69a0('0xf'));_0x443c3a(_0x5c1c5b[_0x69a0('0x15')][_0x69a0('0x14')]);}})[_0x69a0('0x16')](function(_0x2a1075){logger[_0x69a0('0x12')](_0x69a0('0xe'),_0x3f996b,_0x2a1075);_0x17434f(_0x2a1075);});});} \ No newline at end of file +var _0x949e=['error','code','UserVoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','randomstring','ioredis','../../config/logger','../../config/environment','http','request','then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x34219e,_0x46b1cc){var _0x1deeb9=function(_0x5e3b6d){while(--_0x5e3b6d){_0x34219e['push'](_0x34219e['shift']());}};_0x1deeb9(++_0x46b1cc);}(_0x949e,0x196));var _0xe949=function(_0x56032b,_0x32bc50){_0x56032b=_0x56032b-0x0;var _0x5da6d5=_0x949e[_0x56032b];return _0x5da6d5;};'use strict';var _=require(_0xe949('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe949('0x1'));var fs=require('fs');var Redis=require(_0xe949('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe949('0x3'))('rpc');var config=require(_0xe949('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe949('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x23dc5f,_0x2620ce,_0x110bf0){return new BPromise(function(_0x1c28d1,_0x161b8e){return client[_0xe949('0x6')](_0x23dc5f,_0x110bf0)[_0xe949('0x7')](function(_0x3f696b){logger[_0xe949('0x8')]('UserVoiceQueue,\x20%s,\x20%s',_0x2620ce,'request\x20sent');logger[_0xe949('0x9')](_0xe949('0xa'),_0x2620ce,'request\x20sent',JSON[_0xe949('0xb')](_0x3f696b));if(_0x3f696b['error']){if(_0x3f696b[_0xe949('0xc')][_0xe949('0xd')]===0x1f4){logger['error'](_0xe949('0xe'),_0x2620ce,_0x3f696b['error'][_0xe949('0xf')]);return _0x161b8e(_0x3f696b[_0xe949('0xc')][_0xe949('0xf')]);}logger[_0xe949('0xc')](_0xe949('0xe'),_0x2620ce,_0x3f696b[_0xe949('0xc')][_0xe949('0xf')]);return _0x1c28d1(_0x3f696b[_0xe949('0xc')][_0xe949('0xf')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x2620ce,_0xe949('0x10'));_0x1c28d1(_0x3f696b[_0xe949('0x11')][_0xe949('0xf')]);}})[_0xe949('0x12')](function(_0x574170){logger[_0xe949('0xc')](_0xe949('0xe'),_0x2620ce,_0x574170);_0x161b8e(_0x574170);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index d17b6a7..d6ffe1d 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1dac4f,_0x36a9b3){var _0x5cf734=function(_0x4e51ef){while(--_0x4e51ef){_0x1dac4f['push'](_0x1dac4f['shift']());}};_0x5cf734(++_0x36a9b3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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 4931e35..0f49a15 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 _0xddbc=['exports','Required\x20by\x20Asterisk','STRING','queue_interface','INTEGER','sequelize'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0xddbc,0xd7));var _0xcddb=function(_0x184ded,_0x4aaf36){_0x184ded=_0x184ded-0x0;var _0x34d047=_0xddbc[_0x184ded];return _0x34d047;};'use strict';var Sequelize=require(_0xcddb('0x0'));module[_0xcddb('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xcddb('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xcddb('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xcddb('0x3')],'allowNull':![],'unique':_0xcddb('0x4'),'comment':_0xcddb('0x2')},'VoiceQueueId':{'type':Sequelize[_0xcddb('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0xcddb('0x3')],'allowNull':![],'unique':_0xcddb('0x4'),'comment':_0xcddb('0x2')},'penalty':{'type':Sequelize[_0xcddb('0x5')](0xb),'defaultValue':0x0,'comment':_0xcddb('0x2')},'paused':{'type':Sequelize[_0xcddb('0x5')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x088d=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x2787b7,_0x5d49b1){var _0x1953cb=function(_0x2446f8){while(--_0x2446f8){_0x2787b7['push'](_0x2787b7['shift']());}};_0x1953cb(++_0x5d49b1);}(_0x088d,0x1ab));var _0xd088=function(_0x6da7fd,_0x194362){_0x6da7fd=_0x6da7fd-0x0;var _0x4a37cc=_0x088d[_0x6da7fd];return _0x4a37cc;};'use strict';var Sequelize=require(_0xd088('0x0'));module[_0xd088('0x1')]={'uniqueid':{'type':Sequelize[_0xd088('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd088('0x3')},'membername':{'type':Sequelize[_0xd088('0x4')],'allowNull':![],'comment':_0xd088('0x3')},'UserId':{'type':Sequelize[_0xd088('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd088('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xd088('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xd088('0x4')],'allowNull':![],'unique':_0xd088('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xd088('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xd088('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index dcfdfab..bea7af4 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 _0xd8dc=['hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit'];(function(_0x20c15e,_0x769111){var _0x522228=function(_0x3d3b48){while(--_0x3d3b48){_0x20c15e['push'](_0x20c15e['shift']());}};_0x522228(++_0x769111);}(_0xd8dc,0xed));var _0xcd8d=function(_0x392dc7,_0x2b5c91){_0x392dc7=_0x392dc7-0x0;var _0x440de9=_0xd8dc[_0x392dc7];return _0x440de9;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xcd8d('0x0'))['db'][_0xcd8d('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xcd8d('0x2')](0x0);var events={'afterCreate':_0xcd8d('0x3'),'afterUpdate':'update','afterDestroy':_0xcd8d('0x4')};function emitEvent(_0x5443a2){return function(_0x1a5b2a,_0x13d732,_0x5adcc1){UserVoiceQueueRtEvents[_0xcd8d('0x5')](_0x5443a2+':'+_0x1a5b2a['id'],_0x1a5b2a);UserVoiceQueueRtEvents[_0xcd8d('0x5')](_0x5443a2,_0x1a5b2a);_0x5adcc1(null);};}for(var e in events){if(events[_0xcd8d('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xcd8d('0x7')](e,emitEvent(event));}}module[_0xcd8d('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0c06=['emit','hasOwnProperty','hook','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x5798b6,_0x5256b7){var _0x5e0314=function(_0x5dea51){while(--_0x5dea51){_0x5798b6['push'](_0x5798b6['shift']());}};_0x5e0314(++_0x5256b7);}(_0x0c06,0x1ca));var _0x60c0=function(_0x17cf17,_0x3ca20a){_0x17cf17=_0x17cf17-0x0;var _0x524207=_0x0c06[_0x17cf17];return _0x524207;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x60c0('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x60c0('0x1')](0x0);var events={'afterCreate':_0x60c0('0x2'),'afterUpdate':_0x60c0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1ea2a4){return function(_0x255397,_0x4a3266,_0x3cabd3){UserVoiceQueueRtEvents[_0x60c0('0x4')](_0x1ea2a4+':'+_0x255397['id'],_0x255397);UserVoiceQueueRtEvents[_0x60c0('0x4')](_0x1ea2a4,_0x255397);_0x3cabd3(null);};}for(var e in events){if(events[_0x60c0('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x60c0('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 53f4976..46111ee 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 _0x6ea7=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','bluebird','path','rimraf','./userVoiceQueueRt.attributes','exports','define'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0x6ea7,0x14c));var _0x76ea=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6ea7[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x76ea('0x0'));var util=require(_0x76ea('0x1'));var logger=require(_0x76ea('0x2'))('api');var moment=require('moment');var BPromise=require(_0x76ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76ea('0x4'));var rimraf=require(_0x76ea('0x5'));var config=require('../../config/environment');var attributes=require(_0x76ea('0x6'));module[_0x76ea('0x7')]=function(_0x2b1430,_0x150864){return _0x2b1430[_0x76ea('0x8')](_0x76ea('0x9'),attributes,{'tableName':_0x76ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa457=['../../config/logger','api','moment','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x4d05f4,_0x4933ac){var _0x407125=function(_0x3724b2){while(--_0x3724b2){_0x4d05f4['push'](_0x4d05f4['shift']());}};_0x407125(++_0x4933ac);}(_0xa457,0xc6));var _0x7a45=function(_0x12c4e0,_0x538178){_0x12c4e0=_0x12c4e0-0x0;var _0x5ecd6f=_0xa457[_0x12c4e0];return _0x5ecd6f;};'use strict';var _=require(_0x7a45('0x0'));var util=require(_0x7a45('0x1'));var logger=require(_0x7a45('0x2'))(_0x7a45('0x3'));var moment=require(_0x7a45('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a45('0x5'));var config=require('../../config/environment');var attributes=require(_0x7a45('0x6'));module['exports']=function(_0x21d1f6,_0x231ad2){return _0x21d1f6[_0x7a45('0x7')](_0x7a45('0x8'),attributes,{'tableName':_0x7a45('0x9'),'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 4c5faa8..df25cb1 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 _0x6326=['redis','socket.io-emitter','./userVoiceQueueRt.socket','then','request\x20sent','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','info','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x52df0a,_0x2364af){var _0x31e7c6=function(_0x543fd6){while(--_0x543fd6){_0x52df0a['push'](_0x52df0a['shift']());}};_0x31e7c6(++_0x2364af);}(_0x6326,0x19a));var _0x6632=function(_0x28395b,_0x338f93){_0x28395b=_0x28395b-0x0;var _0x14cdb9=_0x6326[_0x28395b];return _0x14cdb9;};'use strict';var _=require(_0x6632('0x0'));var util=require(_0x6632('0x1'));var moment=require(_0x6632('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6632('0x3'));var db=require(_0x6632('0x4'))['db'];var utils=require(_0x6632('0x5'));var logger=require(_0x6632('0x6'))('rpc');var config=require(_0x6632('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6632('0x8')][_0x6632('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6632('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6632('0xb'))(new Redis(config[_0x6632('0xa')]));require(_0x6632('0xc'))['register'](socket);function respondWithRpcPromise(_0x30bde0,_0x7e0f9b,_0x546e89){return new BPromise(function(_0x319277,_0x426ef3){return client['request'](_0x30bde0,_0x546e89)[_0x6632('0xd')](function(_0x34f17e){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x7e0f9b,_0x6632('0xe'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x7e0f9b,_0x6632('0xe'),JSON[_0x6632('0xf')](_0x34f17e));if(_0x34f17e['error']){if(_0x34f17e[_0x6632('0x10')][_0x6632('0x11')]===0x1f4){logger[_0x6632('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x7e0f9b,_0x34f17e['error'][_0x6632('0x12')]);return _0x426ef3(_0x34f17e[_0x6632('0x10')][_0x6632('0x12')]);}logger[_0x6632('0x10')](_0x6632('0x13'),_0x7e0f9b,_0x34f17e[_0x6632('0x10')]['message']);return _0x319277(_0x34f17e[_0x6632('0x10')][_0x6632('0x12')]);}else{logger[_0x6632('0x14')](_0x6632('0x13'),_0x7e0f9b,_0x6632('0xe'));_0x319277(_0x34f17e['result'][_0x6632('0x12')]);}})['catch'](function(_0xbe7ff9){logger['error'](_0x6632('0x13'),_0x7e0f9b,_0xbe7ff9);_0x426ef3(_0xbe7ff9);});});}exports['GetVoiceQueueRtPauses']=function(_0x1d4e53){var _0x46d6e9=this;return new Promise(function(_0x21d78e,_0x394d91){return db[_0x6632('0x15')][_0x6632('0x16')]({'raw':_0x1d4e53[_0x6632('0x17')]?_0x1d4e53['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d4e53['options']?_0x1d4e53[_0x6632('0x17')][_0x6632('0x18')]||null:null,'attributes':[[db[_0x6632('0x19')]['fn'](_0x6632('0x1a'),db[_0x6632('0x19')]['fn']('IF',db[_0x6632('0x19')]['literal'](_0x6632('0x1b')))),'outboundQueuePauses']]})[_0x6632('0xd')](function(_0x1fd6d8){logger[_0x6632('0x14')](_0x6632('0x1c'),_0x1d4e53);logger[_0x6632('0x1d')](_0x6632('0x1c'),_0x1d4e53,JSON['stringify'](_0x1fd6d8));_0x21d78e(_0x1fd6d8);})['catch'](function(_0x32d536){logger[_0x6632('0x10')]('GetVoiceQueueRtPauses',_0x32d536[_0x6632('0x12')],_0x1d4e53);_0x394d91(_0x46d6e9[_0x6632('0x10')](0x1f4,_0x32d536[_0x6632('0x12')]));});});}; \ No newline at end of file +var _0x9fea=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UserVoiceQueueRt','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9fea,0x67));var _0xa9fe=function(_0x405058,_0x3b3117){_0x405058=_0x405058-0x0;var _0x3b95e4=_0x9fea[_0x405058];return _0x3b95e4;};'use strict';var _=require(_0xa9fe('0x0'));var util=require(_0xa9fe('0x1'));var moment=require(_0xa9fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9fe('0x3'))['db'];var utils=require(_0xa9fe('0x4'));var logger=require(_0xa9fe('0x5'))('rpc');var config=require(_0xa9fe('0x6'));var jayson=require(_0xa9fe('0x7'));var client=jayson[_0xa9fe('0x8')][_0xa9fe('0x9')]({'port':0x232a});config[_0xa9fe('0xa')]=_[_0xa9fe('0xb')](config['redis'],{'host':_0xa9fe('0xc'),'port':0x18eb});var socket=require(_0xa9fe('0xd'))(new Redis(config[_0xa9fe('0xa')]));require('./userVoiceQueueRt.socket')[_0xa9fe('0xe')](socket);function respondWithRpcPromise(_0x3d102e,_0x4f822a,_0x59f080){return new BPromise(function(_0x4dcabb,_0x57a994){return client[_0xa9fe('0xf')](_0x3d102e,_0x59f080)[_0xa9fe('0x10')](function(_0x35f102){logger[_0xa9fe('0x11')](_0xa9fe('0x12'),_0x4f822a,'request\x20sent');logger[_0xa9fe('0x13')](_0xa9fe('0x14'),_0x4f822a,'request\x20sent',JSON[_0xa9fe('0x15')](_0x35f102));if(_0x35f102[_0xa9fe('0x16')]){if(_0x35f102[_0xa9fe('0x16')][_0xa9fe('0x17')]===0x1f4){logger[_0xa9fe('0x16')](_0xa9fe('0x12'),_0x4f822a,_0x35f102[_0xa9fe('0x16')][_0xa9fe('0x18')]);return _0x57a994(_0x35f102['error'][_0xa9fe('0x18')]);}logger[_0xa9fe('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4f822a,_0x35f102[_0xa9fe('0x16')][_0xa9fe('0x18')]);return _0x4dcabb(_0x35f102[_0xa9fe('0x16')]['message']);}else{logger[_0xa9fe('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4f822a,_0xa9fe('0x19'));_0x4dcabb(_0x35f102[_0xa9fe('0x1a')]['message']);}})[_0xa9fe('0x1b')](function(_0x1051e3){logger['error'](_0xa9fe('0x12'),_0x4f822a,_0x1051e3);_0x57a994(_0x1051e3);});});}exports['GetVoiceQueueRtPauses']=function(_0x21074a){var _0x310e1b=this;return new Promise(function(_0x52d9de,_0x4ff941){return db[_0xa9fe('0x1c')]['findAll']({'raw':_0x21074a[_0xa9fe('0x1d')]?_0x21074a['options'][_0xa9fe('0x1e')]===undefined?!![]:![]:!![],'where':_0x21074a['options']?_0x21074a[_0xa9fe('0x1d')]['where']||null:null,'attributes':[[db[_0xa9fe('0x1f')]['fn'](_0xa9fe('0x20'),db[_0xa9fe('0x1f')]['fn']('IF',db[_0xa9fe('0x1f')][_0xa9fe('0x21')](_0xa9fe('0x22')))),_0xa9fe('0x23')]]})[_0xa9fe('0x10')](function(_0x5be65){logger[_0xa9fe('0x11')](_0xa9fe('0x24'),_0x21074a);logger['debug'](_0xa9fe('0x24'),_0x21074a,JSON['stringify'](_0x5be65));_0x52d9de(_0x5be65);})[_0xa9fe('0x1b')](function(_0x4da3e5){logger['error'](_0xa9fe('0x24'),_0x4da3e5[_0xa9fe('0x18')],_0x21074a);_0x4ff941(_0x310e1b['error'](0x1f4,_0x4da3e5[_0xa9fe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 02053ab..69c0fcb 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 _0x038b=['removeListener','register','length','save','remove','update','emit'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x038b,0x114));var _0xb038=function(_0x4b7847,_0x1eb8b7){_0x4b7847=_0x4b7847-0x0;var _0x44529a=_0x038b[_0x4b7847];return _0x44529a;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb038('0x0'),_0xb038('0x1'),_0xb038('0x2')];function createListener(_0x5623c3,_0x3d7dfe){return function(_0x5ed31a){_0x3d7dfe[_0xb038('0x3')](_0x5623c3,_0x5ed31a);};}function removeListener(_0x3d090b,_0x4a8a30){return function(){UserVoiceQueueRtEvents[_0xb038('0x4')](_0x3d090b,_0x4a8a30);};}exports[_0xb038('0x5')]=function(_0x4fe092){for(var _0x54e1e7=0x0,_0x2e3e64=events[_0xb038('0x6')];_0x54e1e7<_0x2e3e64;_0x54e1e7++){var _0x1534a9=events[_0x54e1e7];var _0x4b4085=createListener('userVoiceQueueRt:'+_0x1534a9,_0x4fe092);UserVoiceQueueRtEvents['on'](_0x1534a9,_0x4b4085);}}; \ No newline at end of file +var _0x3641=['userVoiceQueueRt:','save','emit','register','length'];(function(_0x5218f5,_0x2c6c3d){var _0x483d19=function(_0x3f2d09){while(--_0x3f2d09){_0x5218f5['push'](_0x5218f5['shift']());}};_0x483d19(++_0x2c6c3d);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x1364('0x0'),'remove','update'];function createListener(_0x174332,_0x1a0e1a){return function(_0x5506bc){_0x1a0e1a[_0x1364('0x1')](_0x174332,_0x5506bc);};}function removeListener(_0x4a9034,_0x3d14e0){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4a9034,_0x3d14e0);};}exports[_0x1364('0x2')]=function(_0x4bcb69){for(var _0x169527=0x0,_0x278f40=events[_0x1364('0x3')];_0x169527<_0x278f40;_0x169527++){var _0x5ef8ba=events[_0x169527];var _0xb5d644=createListener(_0x1364('0x4')+_0x5ef8ba,_0x4bcb69);UserVoiceQueueRtEvents['on'](_0x5ef8ba,_0xb5d644);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 8377f3c..4371d66 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3d0329,_0x2c1986){var _0x7e78e3=function(_0x1a6cac){while(--_0x1a6cac){_0x3d0329['push'](_0x3d0329['shift']());}};_0x7e78e3(++_0x2c1986);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x124df1,_0x470857){var _0x3ebc26=function(_0x291174){while(--_0x291174){_0x124df1['push'](_0x124df1['shift']());}};_0x3ebc26(++_0x470857);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x209bbf,_0x2e2375){_0x209bbf=_0x209bbf-0x0;var _0x592d4b=_0xcb91[_0x209bbf];return _0x592d4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f524fc0..6491fb3 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 _0x8303=['sequelize','exports'];(function(_0x5ea45a,_0x4def47){var _0x4ae6d7=function(_0x342bb9){while(--_0x342bb9){_0x5ea45a['push'](_0x5ea45a['shift']());}};_0x4ae6d7(++_0x4def47);}(_0x8303,0x176));var _0x3830=function(_0x17b6b8,_0x46a853){_0x17b6b8=_0x17b6b8-0x0;var _0x5060f4=_0x8303[_0x17b6b8];return _0x5060f4;};'use strict';var Sequelize=require(_0x3830('0x0'));module[_0x3830('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb748=['exports','INTEGER','sequelize'];(function(_0x43d7f1,_0x11a1eb){var _0x470f7e=function(_0x233fe5){while(--_0x233fe5){_0x43d7f1['push'](_0x43d7f1['shift']());}};_0x470f7e(++_0x11a1eb);}(_0xb748,0xd7));var _0x8b74=function(_0x408956,_0x45cb03){_0x408956=_0x408956-0x0;var _0x402009=_0xb748[_0x408956];return _0x402009;};'use strict';var Sequelize=require(_0x8b74('0x0'));module[_0x8b74('0x1')]={'penalty':{'type':Sequelize[_0x8b74('0x2')],'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 f1c813a..ee929fe 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 _0x7df9=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7df9,0x11d));var _0x97df=function(_0x1ffed9,_0x68479d){_0x1ffed9=_0x1ffed9-0x0;var _0x187aa8=_0x7df9[_0x1ffed9];return _0x187aa8;};'use strict';var _=require(_0x97df('0x0'));var util=require(_0x97df('0x1'));var logger=require(_0x97df('0x2'))('api');var moment=require(_0x97df('0x3'));var BPromise=require(_0x97df('0x4'));var rp=require(_0x97df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97df('0x6'));var config=require(_0x97df('0x7'));var attributes=require(_0x97df('0x8'));module[_0x97df('0x9')]=function(_0x2d75fb,_0x392208){return _0x2d75fb[_0x97df('0xa')](_0x97df('0xb'),attributes,{'tableName':_0x97df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd3f=['user_has_whatsapp_queues','lodash','util','bluebird','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue'];(function(_0x22de84,_0x56142b){var _0x54fc49=function(_0x3be7bc){while(--_0x3be7bc){_0x22de84['push'](_0x22de84['shift']());}};_0x54fc49(++_0x56142b);}(_0xdd3f,0x1ba));var _0xfdd3=function(_0x28b68a,_0x3a72e7){_0x28b68a=_0x28b68a-0x0;var _0x556e27=_0xdd3f[_0x28b68a];return _0x556e27;};'use strict';var _=require(_0xfdd3('0x0'));var util=require(_0xfdd3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfdd3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfdd3('0x3'));var config=require(_0xfdd3('0x4'));var attributes=require(_0xfdd3('0x5'));module['exports']=function(_0x234e09,_0x3c510a){return _0x234e09[_0xfdd3('0x6')](_0xfdd3('0x7'),attributes,{'tableName':_0xfdd3('0x8'),'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 54a832a..93f3f00 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 _0x8ebb=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0x8ebb,0x10f));var _0xb8eb=function(_0x40b6a5,_0x49aaa7){_0x40b6a5=_0x40b6a5-0x0;var _0x2d2182=_0x8ebb[_0x40b6a5];return _0x2d2182;};'use strict';var _=require(_0xb8eb('0x0'));var util=require(_0xb8eb('0x1'));var moment=require(_0xb8eb('0x2'));var BPromise=require(_0xb8eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8eb('0x4'));var db=require(_0xb8eb('0x5'))['db'];var utils=require(_0xb8eb('0x6'));var logger=require(_0xb8eb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb8eb('0x8'));var client=jayson[_0xb8eb('0x9')][_0xb8eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5996a0,_0x4376ca,_0x3c40fd){return new BPromise(function(_0x46f8d7,_0x7b28be){return client[_0xb8eb('0xb')](_0x5996a0,_0x3c40fd)[_0xb8eb('0xc')](function(_0x40e0f3){logger[_0xb8eb('0xd')](_0xb8eb('0xe'),_0x4376ca,_0xb8eb('0xf'));logger[_0xb8eb('0x10')](_0xb8eb('0x11'),_0x4376ca,_0xb8eb('0xf'),JSON[_0xb8eb('0x12')](_0x40e0f3));if(_0x40e0f3['error']){if(_0x40e0f3[_0xb8eb('0x13')]['code']===0x1f4){logger['error'](_0xb8eb('0xe'),_0x4376ca,_0x40e0f3[_0xb8eb('0x13')][_0xb8eb('0x14')]);return _0x7b28be(_0x40e0f3[_0xb8eb('0x13')]['message']);}logger[_0xb8eb('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4376ca,_0x40e0f3[_0xb8eb('0x13')]['message']);return _0x46f8d7(_0x40e0f3[_0xb8eb('0x13')][_0xb8eb('0x14')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x4376ca,_0xb8eb('0xf'));_0x46f8d7(_0x40e0f3[_0xb8eb('0x15')][_0xb8eb('0x14')]);}})[_0xb8eb('0x16')](function(_0xa7b03c){logger[_0xb8eb('0x13')](_0xb8eb('0xe'),_0x4376ca,_0xa7b03c);_0x7b28be(_0xa7b03c);});});} \ No newline at end of file +var _0x007c=['moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x22cba2,_0x1c9223){var _0x5852b7=function(_0x114d1f){while(--_0x114d1f){_0x22cba2['push'](_0x22cba2['shift']());}};_0x5852b7(++_0x1c9223);}(_0x007c,0x124));var _0xc007=function(_0x5a5a9d,_0x1d8f4d){_0x5a5a9d=_0x5a5a9d-0x0;var _0xa36def=_0x007c[_0x5a5a9d];return _0xa36def;};'use strict';var _=require(_0xc007('0x0'));var util=require(_0xc007('0x1'));var moment=require(_0xc007('0x2'));var BPromise=require(_0xc007('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc007('0x4'));var logger=require(_0xc007('0x5'))('rpc');var config=require(_0xc007('0x6'));var jayson=require(_0xc007('0x7'));var client=jayson[_0xc007('0x8')][_0xc007('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bb989,_0xb3d7b1,_0x2feb2b){return new BPromise(function(_0x166077,_0x18192f){return client[_0xc007('0xa')](_0x4bb989,_0x2feb2b)[_0xc007('0xb')](function(_0x5dbea0){logger[_0xc007('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0xb3d7b1,_0xc007('0xd'));logger[_0xc007('0xe')](_0xc007('0xf'),_0xb3d7b1,'request\x20sent',JSON['stringify'](_0x5dbea0));if(_0x5dbea0['error']){if(_0x5dbea0['error'][_0xc007('0x10')]===0x1f4){logger[_0xc007('0x11')](_0xc007('0x12'),_0xb3d7b1,_0x5dbea0[_0xc007('0x11')]['message']);return _0x18192f(_0x5dbea0[_0xc007('0x11')][_0xc007('0x13')]);}logger[_0xc007('0x11')](_0xc007('0x12'),_0xb3d7b1,_0x5dbea0['error'][_0xc007('0x13')]);return _0x166077(_0x5dbea0[_0xc007('0x11')][_0xc007('0x13')]);}else{logger[_0xc007('0xc')](_0xc007('0x12'),_0xb3d7b1,_0xc007('0xd'));_0x166077(_0x5dbea0[_0xc007('0x14')]['message']);}})['catch'](function(_0x20189c){logger[_0xc007('0x11')](_0xc007('0x12'),_0xb3d7b1,_0x20189c);_0x18192f(_0x20189c);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d8a514e..a2e7378 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 _0x4b84=['../../components/interaction/service','../../config/environment','index','/:id','show','create','put','update','delete','isAuthenticated','destroy','exports','multer','util','express','../../components/auth/service'];(function(_0x7f0a45,_0x522e9a){var _0x2baeb3=function(_0xf9246a){while(--_0xf9246a){_0x7f0a45['push'](_0x7f0a45['shift']());}};_0x2baeb3(++_0x522e9a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0x4b84[_0x48c615];return _0x3d9e22;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./variable.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0xa')](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);router[_0x44b8('0xc')](_0x44b8('0x7'),auth[_0x44b8('0xd')](),controller[_0x44b8('0xe')]);module[_0x44b8('0xf')]=router; \ No newline at end of file +var _0xee39=['../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','put','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x387bb2,_0x15cc6e){var _0x2de5e7=function(_0x31177a){while(--_0x31177a){_0x387bb2['push'](_0x387bb2['shift']());}};_0x2de5e7(++_0x15cc6e);}(_0xee39,0x1e6));var _0x9ee3=function(_0x5a8d62,_0x51c7e8){_0x5a8d62=_0x5a8d62-0x0;var _0x328e4a=_0xee39[_0x5a8d62];return _0x328e4a;};'use strict';var multer=require(_0x9ee3('0x0'));var util=require(_0x9ee3('0x1'));var path=require(_0x9ee3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ee3('0x3'));var router=express[_0x9ee3('0x4')]();var fs_extra=require(_0x9ee3('0x5'));var auth=require(_0x9ee3('0x6'));var interaction=require(_0x9ee3('0x7'));var config=require(_0x9ee3('0x8'));var controller=require(_0x9ee3('0x9'));router[_0x9ee3('0xa')]('/',auth[_0x9ee3('0xb')](),controller[_0x9ee3('0xc')]);router['get'](_0x9ee3('0xd'),auth[_0x9ee3('0xb')](),controller[_0x9ee3('0xe')]);router['post']('/',auth[_0x9ee3('0xb')](),controller['create']);router[_0x9ee3('0xf')]('/:id',auth[_0x9ee3('0xb')](),controller['update']);router['delete'](_0x9ee3('0xd'),auth['isAuthenticated'](),controller[_0x9ee3('0x10')]);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 b974ea8..7a20307 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 _0x88f4=['name','STRING','exports'];(function(_0x3dfd18,_0x302721){var _0x4af96a=function(_0xb79f5a){while(--_0xb79f5a){_0x3dfd18['push'](_0x3dfd18['shift']());}};_0x4af96a(++_0x302721);}(_0x88f4,0xfb));var _0x488f=function(_0x101413,_0x13591e){_0x101413=_0x101413-0x0;var _0x24231a=_0x88f4[_0x101413];return _0x24231a;};'use strict';var Sequelize=require('sequelize');module[_0x488f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x488f('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x488f('0x2')]}}; \ No newline at end of file +var _0x3c61=['STRING','name'];(function(_0x1d05ef,_0x1df6a8){var _0x1436eb=function(_0x49b1ec){while(--_0x49b1ec){_0x1d05ef['push'](_0x1d05ef['shift']());}};_0x1436eb(++_0x1df6a8);}(_0x3c61,0x11a));var _0x13c6=function(_0x38b98,_0x5e26ad){_0x38b98=_0x38b98-0x0;var _0x39e0d0=_0x3c61[_0x38b98];return _0x39e0d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x13c6('0x0')],'unique':_0x13c6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 8f987a5..aa03871 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 _0x83a0=['mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','get','Variables','error','stack','name','send','index','map','Variable','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','params','keys','rawAttributes','includeAll','include','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','moment'];(function(_0x2630e2,_0x47c954){var _0x1ced7d=function(_0x4160d4){while(--_0x4160d4){_0x2630e2['push'](_0x2630e2['shift']());}};_0x1ced7d(++_0x47c954);}(_0x83a0,0x184));var _0x083a=function(_0xd4358b,_0x19a430){_0xd4358b=_0xd4358b-0x0;var _0xa91959=_0x83a0[_0xd4358b];return _0xa91959;};'use strict';var emlformat=require(_0x083a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x083a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x083a('0x2'));var util=require(_0x083a('0x3'));var path=require(_0x083a('0x4'));var sox=require(_0x083a('0x5'));var csv=require('to-csv');var ejs=require(_0x083a('0x6'));var fs=require('fs');var fs_extra=require(_0x083a('0x7'));var _=require(_0x083a('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x083a('0x9'));var toCsv=require('to-csv');var querystring=require(_0x083a('0xa'));var Papa=require(_0x083a('0xb'));var Redis=require(_0x083a('0xc'));var authService=require(_0x083a('0xd'));var qs=require(_0x083a('0xe'));var as=require(_0x083a('0xf'));var hardwareService=require(_0x083a('0x10'));var logger=require('../../config/logger')(_0x083a('0x11'));var utils=require('../../config/utils');var config=require(_0x083a('0x12'));var licenseUtil=require(_0x083a('0x13'));var db=require(_0x083a('0x14'))['db'];function respondWithStatusCode(_0x2b6e57,_0x1ce16e){_0x1ce16e=_0x1ce16e||0xcc;return function(_0x24c09a){if(_0x24c09a){return _0x2b6e57[_0x083a('0x15')](_0x1ce16e);}return _0x2b6e57[_0x083a('0x16')](_0x1ce16e)[_0x083a('0x17')]();};}function respondWithResult(_0x4f6234,_0x2d16b1){_0x2d16b1=_0x2d16b1||0xc8;return function(_0x389ec5){if(_0x389ec5){return _0x4f6234[_0x083a('0x16')](_0x2d16b1)[_0x083a('0x18')](_0x389ec5);}};}function respondWithFilteredResult(_0x20ee98,_0xf25317){return function(_0x3699bb){if(_0x3699bb){var _0x1297a6=typeof _0xf25317[_0x083a('0x19')]===_0x083a('0x1a')&&typeof _0xf25317[_0x083a('0x1b')]===_0x083a('0x1a');var _0x12b3dd=_0x3699bb[_0x083a('0x1c')];var _0x5bd166=_0x1297a6?0x0:_0xf25317[_0x083a('0x19')];var _0x4be4b2=_0x1297a6?_0x3699bb['count']:_0xf25317['offset']+_0xf25317[_0x083a('0x1b')];var _0x46f06d;if(_0x4be4b2>=_0x12b3dd){_0x4be4b2=_0x12b3dd;_0x46f06d=0xc8;}else{_0x46f06d=0xce;}_0x20ee98['status'](_0x46f06d);return _0x20ee98['set'](_0x083a('0x1d'),_0x5bd166+'-'+_0x4be4b2+'/'+_0x12b3dd)['json'](_0x3699bb);}return null;};}function patchUpdates(_0x57274d){return function(_0x3825b9){try{jsonpatch[_0x083a('0x1e')](_0x3825b9,_0x57274d,!![]);}catch(_0x4f0b77){return BPromise['reject'](_0x4f0b77);}return _0x3825b9[_0x083a('0x1f')]();};}function saveUpdates(_0x34c68f,_0x8ecdd7){return function(_0x764485){if(_0x764485){return _0x764485[_0x083a('0x20')](_0x34c68f)['then'](function(_0x1ba124){return _0x1ba124;});}return null;};}function removeEntity(_0x19ee77,_0xb6730b){return function(_0x583843){if(_0x583843){return _0x583843[_0x083a('0x21')]()[_0x083a('0x22')](function(){var _0x22adab=_0x583843[_0x083a('0x23')]({'plain':!![]});var _0x32b56e=_0x083a('0x24');return db['UserProfileResource'][_0x083a('0x21')]({'where':{'type':_0x32b56e,'resourceId':_0x22adab['id']}})[_0x083a('0x22')](function(){return _0x583843;});})[_0x083a('0x22')](function(){_0x19ee77[_0x083a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22b0a6,_0x2f3399){return function(_0x55b5bd){if(!_0x55b5bd){_0x22b0a6['sendStatus'](0x194);}return _0x55b5bd;};}function handleError(_0xc6844d,_0x357d6c){_0x357d6c=_0x357d6c||0x1f4;return function(_0x31b54a){logger[_0x083a('0x25')](_0x31b54a[_0x083a('0x26')]);if(_0x31b54a[_0x083a('0x27')]){delete _0x31b54a[_0x083a('0x27')];}_0xc6844d['status'](_0x357d6c)[_0x083a('0x28')](_0x31b54a);};}exports[_0x083a('0x29')]=function(_0x38cfc3,_0x445de6){var _0x18ae2d={},_0x2f3c23={},_0x525b91={'count':0x0,'rows':[]};var _0x123e20=_[_0x083a('0x2a')](db[_0x083a('0x2b')]['rawAttributes'],function(_0x368d74){return{'name':_0x368d74['fieldName'],'type':_0x368d74[_0x083a('0x2c')]['key']};});_0x2f3c23[_0x083a('0x2d')]=_[_0x083a('0x2a')](_0x123e20,'name');_0x2f3c23[_0x083a('0x2e')]=_['keys'](_0x38cfc3[_0x083a('0x2e')]);_0x2f3c23[_0x083a('0x2f')]=_[_0x083a('0x30')](_0x2f3c23[_0x083a('0x2d')],_0x2f3c23[_0x083a('0x2e')]);_0x18ae2d['attributes']=_[_0x083a('0x30')](_0x2f3c23[_0x083a('0x2d')],qs[_0x083a('0x31')](_0x38cfc3[_0x083a('0x2e')][_0x083a('0x31')]));_0x18ae2d[_0x083a('0x32')]=_0x18ae2d[_0x083a('0x32')][_0x083a('0x33')]?_0x18ae2d[_0x083a('0x32')]:_0x2f3c23['model'];if(!_0x38cfc3['query'][_0x083a('0x34')](_0x083a('0x35'))){_0x18ae2d['limit']=qs[_0x083a('0x1b')](_0x38cfc3[_0x083a('0x2e')][_0x083a('0x1b')]);_0x18ae2d[_0x083a('0x19')]=qs[_0x083a('0x19')](_0x38cfc3[_0x083a('0x2e')]['offset']);}_0x18ae2d[_0x083a('0x36')]=qs[_0x083a('0x37')](_0x38cfc3[_0x083a('0x2e')][_0x083a('0x37')]);_0x18ae2d[_0x083a('0x38')]=qs[_0x083a('0x2f')](_[_0x083a('0x39')](_0x38cfc3['query'],_0x2f3c23[_0x083a('0x2f')]),_0x123e20);if(_0x38cfc3[_0x083a('0x2e')][_0x083a('0x3a')]){_0x18ae2d[_0x083a('0x38')]=_['merge'](_0x18ae2d[_0x083a('0x38')],{'$or':_[_0x083a('0x2a')](_0x123e20,function(_0x471d33){if(_0x471d33[_0x083a('0x2c')]!==_0x083a('0x3b')){var _0x59ab8d={};_0x59ab8d[_0x471d33[_0x083a('0x27')]]={'$like':'%'+_0x38cfc3['query'][_0x083a('0x3a')]+'%'};return _0x59ab8d;}})});}_0x18ae2d=_['merge']({},_0x18ae2d,_0x38cfc3[_0x083a('0x3c')]);var _0x4f446d={'where':_0x18ae2d[_0x083a('0x38')]};return db['Variable'][_0x083a('0x1c')](_0x4f446d)['then'](function(_0x5e45eb){_0x525b91['count']=_0x5e45eb;if(_0x38cfc3[_0x083a('0x2e')]['includeAll']){_0x18ae2d['include']=[{'all':!![]}];}return db['Variable'][_0x083a('0x3d')](_0x18ae2d);})[_0x083a('0x22')](function(_0x5f32f3){_0x525b91[_0x083a('0x3e')]=_0x5f32f3;return _0x525b91;})['then'](respondWithFilteredResult(_0x445de6,_0x18ae2d))[_0x083a('0x3f')](handleError(_0x445de6,null));};exports['show']=function(_0x557906,_0x2cac69){var _0x161434={'raw':!![],'where':{'id':_0x557906[_0x083a('0x40')]['id']}},_0x3508ea={};_0x3508ea['model']=_[_0x083a('0x41')](db[_0x083a('0x2b')][_0x083a('0x42')]);_0x3508ea['query']=_['keys'](_0x557906[_0x083a('0x2e')]);_0x3508ea[_0x083a('0x2f')]=_[_0x083a('0x30')](_0x3508ea[_0x083a('0x2d')],_0x3508ea[_0x083a('0x2e')]);_0x161434[_0x083a('0x32')]=_[_0x083a('0x30')](_0x3508ea[_0x083a('0x2d')],qs[_0x083a('0x31')](_0x557906[_0x083a('0x2e')][_0x083a('0x31')]));_0x161434[_0x083a('0x32')]=_0x161434[_0x083a('0x32')][_0x083a('0x33')]?_0x161434['attributes']:_0x3508ea['model'];if(_0x557906['query'][_0x083a('0x43')]){_0x161434[_0x083a('0x44')]=[{'all':!![]}];}_0x161434=_[_0x083a('0x45')]({},_0x161434,_0x557906[_0x083a('0x3c')]);return db[_0x083a('0x2b')][_0x083a('0x46')](_0x161434)[_0x083a('0x22')](handleEntityNotFound(_0x2cac69,null))['then'](respondWithResult(_0x2cac69,null))['catch'](handleError(_0x2cac69,null));};exports[_0x083a('0x47')]=function(_0x38f25e,_0x4986e6){return db[_0x083a('0x2b')][_0x083a('0x47')](_0x38f25e[_0x083a('0x48')],{})['then'](function(_0x425320){var _0x344213=_0x38f25e[_0x083a('0x49')]['get']({'plain':!![]});if(!_0x344213)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x344213[_0x083a('0x4a')]===_0x083a('0x49')){var _0x32469b=_0x425320[_0x083a('0x23')]({'plain':!![]});var _0x2cdc33='Variables';return db[_0x083a('0x4b')]['find']({'where':{'name':_0x2cdc33,'userProfileId':_0x344213[_0x083a('0x4c')]},'raw':!![]})[_0x083a('0x22')](function(_0x5ef80a){if(_0x5ef80a&&_0x5ef80a[_0x083a('0x4d')]===0x0){return db['UserProfileResource'][_0x083a('0x47')]({'name':_0x32469b[_0x083a('0x27')],'resourceId':_0x32469b['id'],'type':_0x5ef80a['name'],'sectionId':_0x5ef80a['id']},{})['then'](function(){return _0x425320;});}else{return _0x425320;}})[_0x083a('0x3f')](function(_0x2ea46b){logger[_0x083a('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ea46b);throw _0x2ea46b;});}return _0x425320;})[_0x083a('0x22')](respondWithResult(_0x4986e6,0xc9))[_0x083a('0x3f')](handleError(_0x4986e6,null));};exports[_0x083a('0x20')]=function(_0x2541ef,_0x624e8f){if(_0x2541ef[_0x083a('0x48')]['id']){delete _0x2541ef[_0x083a('0x48')]['id'];}return db['Variable'][_0x083a('0x46')]({'where':{'id':_0x2541ef[_0x083a('0x40')]['id']}})[_0x083a('0x22')](handleEntityNotFound(_0x624e8f,null))[_0x083a('0x22')](saveUpdates(_0x2541ef[_0x083a('0x48')],null))[_0x083a('0x22')](respondWithResult(_0x624e8f,null))[_0x083a('0x3f')](handleError(_0x624e8f,null));};exports[_0x083a('0x21')]=function(_0x46d0c4,_0x4e94d0){return db[_0x083a('0x2b')]['find']({'where':{'id':_0x46d0c4[_0x083a('0x40')]['id']}})[_0x083a('0x22')](handleEntityNotFound(_0x4e94d0,null))[_0x083a('0x22')](removeEntity(_0x4e94d0,null))[_0x083a('0x3f')](handleError(_0x4e94d0,null));}; \ No newline at end of file +var _0xcca5=['map','Variable','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','create','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','destroy','get','Variables','then','error','name','send'];(function(_0x4aaed4,_0x58e99b){var _0x10d3b9=function(_0x1f1716){while(--_0x1f1716){_0x4aaed4['push'](_0x4aaed4['shift']());}};_0x10d3b9(++_0x58e99b);}(_0xcca5,0x1a4));var _0x5cca=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xcca5[_0x36ed3c];return _0x52a2e0;};'use strict';var emlformat=require(_0x5cca('0x0'));var rimraf=require(_0x5cca('0x1'));var zipdir=require(_0x5cca('0x2'));var jsonpatch=require(_0x5cca('0x3'));var rp=require(_0x5cca('0x4'));var moment=require(_0x5cca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5cca('0x6'));var util=require('util');var path=require(_0x5cca('0x7'));var sox=require(_0x5cca('0x8'));var csv=require(_0x5cca('0x9'));var ejs=require(_0x5cca('0xa'));var fs=require('fs');var fs_extra=require(_0x5cca('0xb'));var _=require(_0x5cca('0xc'));var squel=require('squel');var crypto=require(_0x5cca('0xd'));var jsforce=require(_0x5cca('0xe'));var deskjs=require(_0x5cca('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5cca('0x10'));var Papa=require('papaparse');var Redis=require(_0x5cca('0x11'));var authService=require(_0x5cca('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5cca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cca('0x14'))(_0x5cca('0x15'));var utils=require(_0x5cca('0x16'));var config=require(_0x5cca('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd75625,_0x9ec7f0){_0x9ec7f0=_0x9ec7f0||0xcc;return function(_0x27e2ec){if(_0x27e2ec){return _0xd75625[_0x5cca('0x18')](_0x9ec7f0);}return _0xd75625[_0x5cca('0x19')](_0x9ec7f0)[_0x5cca('0x1a')]();};}function respondWithResult(_0x5e365b,_0x50682a){_0x50682a=_0x50682a||0xc8;return function(_0x31a0bb){if(_0x31a0bb){return _0x5e365b[_0x5cca('0x19')](_0x50682a)[_0x5cca('0x1b')](_0x31a0bb);}};}function respondWithFilteredResult(_0x554800,_0x43fbef){return function(_0x2d3bc6){if(_0x2d3bc6){var _0x3d7da0=typeof _0x43fbef['offset']==='undefined'&&typeof _0x43fbef[_0x5cca('0x1c')]==='undefined';var _0x14d1ef=_0x2d3bc6['count'];var _0x4a8453=_0x3d7da0?0x0:_0x43fbef[_0x5cca('0x1d')];var _0x349120=_0x3d7da0?_0x2d3bc6[_0x5cca('0x1e')]:_0x43fbef[_0x5cca('0x1d')]+_0x43fbef['limit'];var _0x42df9a;if(_0x349120>=_0x14d1ef){_0x349120=_0x14d1ef;_0x42df9a=0xc8;}else{_0x42df9a=0xce;}_0x554800['status'](_0x42df9a);return _0x554800[_0x5cca('0x1f')](_0x5cca('0x20'),_0x4a8453+'-'+_0x349120+'/'+_0x14d1ef)[_0x5cca('0x1b')](_0x2d3bc6);}return null;};}function patchUpdates(_0x5b2075){return function(_0x3ebabb){try{jsonpatch[_0x5cca('0x21')](_0x3ebabb,_0x5b2075,!![]);}catch(_0x20fc9b){return BPromise[_0x5cca('0x22')](_0x20fc9b);}return _0x3ebabb['save']();};}function saveUpdates(_0x2bd086,_0xf75fd4){return function(_0x3a9629){if(_0x3a9629){return _0x3a9629['update'](_0x2bd086)['then'](function(_0x85c1ce){return _0x85c1ce;});}return null;};}function removeEntity(_0x3fdcf1,_0x55688d){return function(_0x8d858b){if(_0x8d858b){return _0x8d858b[_0x5cca('0x23')]()['then'](function(){var _0x10812d=_0x8d858b[_0x5cca('0x24')]({'plain':!![]});var _0x3960a5=_0x5cca('0x25');return db['UserProfileResource'][_0x5cca('0x23')]({'where':{'type':_0x3960a5,'resourceId':_0x10812d['id']}})[_0x5cca('0x26')](function(){return _0x8d858b;});})[_0x5cca('0x26')](function(){_0x3fdcf1[_0x5cca('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd641eb,_0x11cef7){return function(_0x177340){if(!_0x177340){_0xd641eb['sendStatus'](0x194);}return _0x177340;};}function handleError(_0x1001b9,_0x4d9e19){_0x4d9e19=_0x4d9e19||0x1f4;return function(_0x39ed77){logger[_0x5cca('0x27')](_0x39ed77['stack']);if(_0x39ed77[_0x5cca('0x28')]){delete _0x39ed77['name'];}_0x1001b9[_0x5cca('0x19')](_0x4d9e19)[_0x5cca('0x29')](_0x39ed77);};}exports['index']=function(_0x24c1b0,_0x4ddccc){var _0x28ab99={},_0x1cf8b7={},_0x1f8789={'count':0x0,'rows':[]};var _0x3f39c9=_[_0x5cca('0x2a')](db[_0x5cca('0x2b')][_0x5cca('0x2c')],function(_0x79b87f){return{'name':_0x79b87f[_0x5cca('0x2d')],'type':_0x79b87f['type'][_0x5cca('0x2e')]};});_0x1cf8b7['model']=_['map'](_0x3f39c9,_0x5cca('0x28'));_0x1cf8b7[_0x5cca('0x2f')]=_[_0x5cca('0x30')](_0x24c1b0[_0x5cca('0x2f')]);_0x1cf8b7['filters']=_[_0x5cca('0x31')](_0x1cf8b7[_0x5cca('0x32')],_0x1cf8b7['query']);_0x28ab99[_0x5cca('0x33')]=_[_0x5cca('0x31')](_0x1cf8b7[_0x5cca('0x32')],qs[_0x5cca('0x34')](_0x24c1b0[_0x5cca('0x2f')][_0x5cca('0x34')]));_0x28ab99[_0x5cca('0x33')]=_0x28ab99[_0x5cca('0x33')][_0x5cca('0x35')]?_0x28ab99[_0x5cca('0x33')]:_0x1cf8b7[_0x5cca('0x32')];if(!_0x24c1b0[_0x5cca('0x2f')]['hasOwnProperty'](_0x5cca('0x36'))){_0x28ab99[_0x5cca('0x1c')]=qs[_0x5cca('0x1c')](_0x24c1b0[_0x5cca('0x2f')][_0x5cca('0x1c')]);_0x28ab99[_0x5cca('0x1d')]=qs[_0x5cca('0x1d')](_0x24c1b0[_0x5cca('0x2f')][_0x5cca('0x1d')]);}_0x28ab99[_0x5cca('0x37')]=qs['sort'](_0x24c1b0[_0x5cca('0x2f')]['sort']);_0x28ab99[_0x5cca('0x38')]=qs[_0x5cca('0x39')](_[_0x5cca('0x3a')](_0x24c1b0[_0x5cca('0x2f')],_0x1cf8b7[_0x5cca('0x39')]),_0x3f39c9);if(_0x24c1b0[_0x5cca('0x2f')][_0x5cca('0x3b')]){_0x28ab99['where']=_[_0x5cca('0x3c')](_0x28ab99[_0x5cca('0x38')],{'$or':_[_0x5cca('0x2a')](_0x3f39c9,function(_0x16e8a6){if(_0x16e8a6['type']!==_0x5cca('0x3d')){var _0x108e5e={};_0x108e5e[_0x16e8a6[_0x5cca('0x28')]]={'$like':'%'+_0x24c1b0[_0x5cca('0x2f')][_0x5cca('0x3b')]+'%'};return _0x108e5e;}})});}_0x28ab99=_[_0x5cca('0x3c')]({},_0x28ab99,_0x24c1b0[_0x5cca('0x3e')]);var _0x228c84={'where':_0x28ab99[_0x5cca('0x38')]};return db[_0x5cca('0x2b')][_0x5cca('0x1e')](_0x228c84)[_0x5cca('0x26')](function(_0x46114f){_0x1f8789[_0x5cca('0x1e')]=_0x46114f;if(_0x24c1b0[_0x5cca('0x2f')][_0x5cca('0x3f')]){_0x28ab99[_0x5cca('0x40')]=[{'all':!![]}];}return db[_0x5cca('0x2b')][_0x5cca('0x41')](_0x28ab99);})[_0x5cca('0x26')](function(_0x6acfee){_0x1f8789[_0x5cca('0x42')]=_0x6acfee;return _0x1f8789;})['then'](respondWithFilteredResult(_0x4ddccc,_0x28ab99))['catch'](handleError(_0x4ddccc,null));};exports['show']=function(_0x5f3fea,_0x38f903){var _0x4d83b8={'raw':!![],'where':{'id':_0x5f3fea[_0x5cca('0x43')]['id']}},_0x34be0f={};_0x34be0f[_0x5cca('0x32')]=_[_0x5cca('0x30')](db[_0x5cca('0x2b')][_0x5cca('0x2c')]);_0x34be0f[_0x5cca('0x2f')]=_[_0x5cca('0x30')](_0x5f3fea[_0x5cca('0x2f')]);_0x34be0f[_0x5cca('0x39')]=_['intersection'](_0x34be0f[_0x5cca('0x32')],_0x34be0f[_0x5cca('0x2f')]);_0x4d83b8['attributes']=_[_0x5cca('0x31')](_0x34be0f[_0x5cca('0x32')],qs[_0x5cca('0x34')](_0x5f3fea['query'][_0x5cca('0x34')]));_0x4d83b8[_0x5cca('0x33')]=_0x4d83b8['attributes'][_0x5cca('0x35')]?_0x4d83b8[_0x5cca('0x33')]:_0x34be0f['model'];if(_0x5f3fea[_0x5cca('0x2f')]['includeAll']){_0x4d83b8['include']=[{'all':!![]}];}_0x4d83b8=_[_0x5cca('0x3c')]({},_0x4d83b8,_0x5f3fea['options']);return db[_0x5cca('0x2b')]['find'](_0x4d83b8)['then'](handleEntityNotFound(_0x38f903,null))[_0x5cca('0x26')](respondWithResult(_0x38f903,null))['catch'](handleError(_0x38f903,null));};exports[_0x5cca('0x44')]=function(_0x4610d1,_0xc9c6ef){return db['Variable'][_0x5cca('0x44')](_0x4610d1['body'],{})[_0x5cca('0x26')](function(_0x53aee4){var _0x39fc4a=_0x4610d1['user'][_0x5cca('0x24')]({'plain':!![]});if(!_0x39fc4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39fc4a['role']==='user'){var _0x7dddb3=_0x53aee4[_0x5cca('0x24')]({'plain':!![]});var _0x5d1f70=_0x5cca('0x25');return db[_0x5cca('0x45')][_0x5cca('0x46')]({'where':{'name':_0x5d1f70,'userProfileId':_0x39fc4a[_0x5cca('0x47')]},'raw':!![]})[_0x5cca('0x26')](function(_0x2f8856){if(_0x2f8856&&_0x2f8856[_0x5cca('0x48')]===0x0){return db[_0x5cca('0x49')]['create']({'name':_0x7dddb3[_0x5cca('0x28')],'resourceId':_0x7dddb3['id'],'type':_0x2f8856['name'],'sectionId':_0x2f8856['id']},{})[_0x5cca('0x26')](function(){return _0x53aee4;});}else{return _0x53aee4;}})[_0x5cca('0x4a')](function(_0x33b4cc){logger[_0x5cca('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33b4cc);throw _0x33b4cc;});}return _0x53aee4;})['then'](respondWithResult(_0xc9c6ef,0xc9))[_0x5cca('0x4a')](handleError(_0xc9c6ef,null));};exports[_0x5cca('0x4b')]=function(_0x4f9e73,_0x2a0014){if(_0x4f9e73[_0x5cca('0x4c')]['id']){delete _0x4f9e73[_0x5cca('0x4c')]['id'];}return db['Variable'][_0x5cca('0x46')]({'where':{'id':_0x4f9e73[_0x5cca('0x43')]['id']}})[_0x5cca('0x26')](handleEntityNotFound(_0x2a0014,null))[_0x5cca('0x26')](saveUpdates(_0x4f9e73[_0x5cca('0x4c')],null))[_0x5cca('0x26')](respondWithResult(_0x2a0014,null))[_0x5cca('0x4a')](handleError(_0x2a0014,null));};exports[_0x5cca('0x23')]=function(_0x285913,_0x1248cb){return db[_0x5cca('0x2b')][_0x5cca('0x46')]({'where':{'id':_0x285913[_0x5cca('0x43')]['id']}})[_0x5cca('0x26')](handleEntityNotFound(_0x1248cb,null))[_0x5cca('0x26')](removeEntity(_0x1248cb,null))[_0x5cca('0x4a')](handleError(_0x1248cb,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index faa7303..b643667 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 _0x70fb=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./variable.attributes'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x70fb,0xbf));var _0xb70f=function(_0x39887a,_0x5835ca){_0x39887a=_0x39887a-0x0;var _0x1f8468=_0x70fb[_0x39887a];return _0x1f8468;};'use strict';var _=require(_0xb70f('0x0'));var util=require(_0xb70f('0x1'));var logger=require(_0xb70f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb70f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb70f('0x4'));var config=require(_0xb70f('0x5'));var attributes=require(_0xb70f('0x6'));module[_0xb70f('0x7')]=function(_0x1658f3,_0x130362){return _0x1658f3[_0xb70f('0x8')](_0xb70f('0x9'),attributes,{'tableName':_0xb70f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf801=['define','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x2f04bd,_0x346136){var _0x107c0e=function(_0x3837d9){while(--_0x3837d9){_0x2f04bd['push'](_0x2f04bd['shift']());}};_0x107c0e(++_0x346136);}(_0xf801,0xe2));var _0x1f80=function(_0x4a397d,_0x5bab1f){_0x4a397d=_0x4a397d-0x0;var _0x316571=_0xf801[_0x4a397d];return _0x316571;};'use strict';var _=require(_0x1f80('0x0'));var util=require(_0x1f80('0x1'));var logger=require(_0x1f80('0x2'))(_0x1f80('0x3'));var moment=require(_0x1f80('0x4'));var BPromise=require(_0x1f80('0x5'));var rp=require(_0x1f80('0x6'));var fs=require('fs');var path=require(_0x1f80('0x7'));var rimraf=require(_0x1f80('0x8'));var config=require(_0x1f80('0x9'));var attributes=require(_0x1f80('0xa'));module[_0x1f80('0xb')]=function(_0x38d533,_0x50970d){return _0x38d533[_0x1f80('0xc')]('Variable',attributes,{'tableName':_0x1f80('0xd'),'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 779dfb4..9a4ade1 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 _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xa41a,0x6b));var _0xaa41=function(_0x248bc6,_0x4b9d9b){_0x248bc6=_0x248bc6-0x0;var _0x2e2e3c=_0xa41a[_0x248bc6];return _0x2e2e3c;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file +var _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x326f,0xd1));var _0xf326=function(_0x19c638,_0x41769d){_0x19c638=_0x19c638-0x0;var _0x339a19=_0x326f[_0x19c638];return _0x339a19;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 476cc5d..ddb9ce3 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 _0xbee3=['../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','restart','/migrations','exports','express'];(function(_0x5b9e23,_0x5a54b4){var _0x488b71=function(_0x5562ed){while(--_0x5562ed){_0x5b9e23['push'](_0x5b9e23['shift']());}};_0x488b71(++_0x5a54b4);}(_0xbee3,0x10d));var _0x3bee=function(_0x2c4d2d,_0x15c548){_0x2c4d2d=_0x2c4d2d-0x0;var _0x45c312=_0xbee3[_0x2c4d2d];return _0x45c312;};'use strict';var express=require(_0x3bee('0x0'));var router=express['Router']();var auth=require(_0x3bee('0x1'));var controller=require('./version.controller');router[_0x3bee('0x2')]('/',controller[_0x3bee('0x3')]);router[_0x3bee('0x2')](_0x3bee('0x4'),auth[_0x3bee('0x5')](),auth[_0x3bee('0x6')](),controller[_0x3bee('0x7')]);router[_0x3bee('0x2')](_0x3bee('0x8'),auth[_0x3bee('0x5')](),auth['canUpdate'](),controller[_0x3bee('0x9')]);router[_0x3bee('0x2')]('/pull',auth[_0x3bee('0x5')](),auth[_0x3bee('0x6')](),controller[_0x3bee('0xa')]);router[_0x3bee('0x2')](_0x3bee('0xb'),auth[_0x3bee('0x5')](),controller[_0x3bee('0xc')]);router['get'](_0x3bee('0xd'),controller['migrations']);module[_0x3bee('0xe')]=router; \ No newline at end of file +var _0xaa6a=['migrations','express','Router','../../components/auth/service','index','get','isAuthenticated','fetch','/reset','canUpdate','reset','pull','/restart','/migrations'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xaa6a,0x1dd));var _0xaaa6=function(_0x2ecf87,_0x2c0dc1){_0x2ecf87=_0x2ecf87-0x0;var _0x312025=_0xaa6a[_0x2ecf87];return _0x312025;};'use strict';var express=require(_0xaaa6('0x0'));var router=express[_0xaaa6('0x1')]();var auth=require(_0xaaa6('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0xaaa6('0x3')]);router[_0xaaa6('0x4')]('/fetch',auth[_0xaaa6('0x5')](),auth['canUpdate'](),controller[_0xaaa6('0x6')]);router[_0xaaa6('0x4')](_0xaaa6('0x7'),auth[_0xaaa6('0x5')](),auth[_0xaaa6('0x8')](),controller[_0xaaa6('0x9')]);router[_0xaaa6('0x4')]('/pull',auth['isAuthenticated'](),auth[_0xaaa6('0x8')](),controller[_0xaaa6('0xa')]);router[_0xaaa6('0x4')](_0xaaa6('0xb'),auth[_0xaaa6('0x5')](),controller['restart']);router[_0xaaa6('0x4')](_0xaaa6('0xc'),controller[_0xaaa6('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 245a172..f20ce72 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 _0x36fb=['sort','sequelize','Migration','constructor','join','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','umzug','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','query','latest','fetch','exports','version','2.0.0','status','origin','master','error','json','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','server','migrations','length','replace','push'];(function(_0x216947,_0x420f7b){var _0x1c481c=function(_0x547c47){while(--_0x547c47){_0x216947['push'](_0x216947['shift']());}};_0x1c481c(++_0x420f7b);}(_0x36fb,0x109));var _0xb36f=function(_0x25b533,_0x242e32){_0x25b533=_0x25b533-0x0;var _0x32cc36=_0x36fb[_0x25b533];return _0x32cc36;};'use strict';var Umzug=require(_0xb36f('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xb36f('0x1'));var pkginfo=require(_0xb36f('0x2'))(module,'version');var compareVersions=require(_0xb36f('0x3'));var exec=require(_0xb36f('0x4'))['exec'];var db=require(_0xb36f('0x5'))['db'];var config=require(_0xb36f('0x6'));var pm2=require('../../config/pm2');var logger=require(_0xb36f('0x7'))(_0xb36f('0x8'));var git=require(_0xb36f('0x9'))(config[_0xb36f('0xa')]);exports[_0xb36f('0xb')]=function(_0xb61d8e,_0x162f78){var _0x4b2baa={'current':module['exports']['version'],'phonebar':0x2};if(_0xb61d8e[_0xb36f('0xc')]&&_0xb61d8e[_0xb36f('0xc')][_0xb36f('0xd')]){return git[_0xb36f('0xe')]()['tags'](function(_0x22038c,_0x1cf379){_0x4b2baa['latest']=(_0x22038c?module[_0xb36f('0xf')][_0xb36f('0x10')]:_0x1cf379[_0xb36f('0xd')])||_0xb36f('0x11');return _0x162f78['status'](0xc8)['json'](_0x4b2baa);});}else{return _0x162f78[_0xb36f('0x12')](0xc8)['json'](_0x4b2baa);}};exports[_0xb36f('0xe')]=function(_0x30cbc6,_0x1ac269){return git[_0xb36f('0xe')]([_0xb36f('0x13'),_0xb36f('0x14')],function(_0x194f15){if(_0x194f15){logger[_0xb36f('0x15')](_0x194f15);return _0x1ac269[_0xb36f('0x12')](0x1f4)[_0xb36f('0x16')](_0x194f15);}logger[_0xb36f('0x17')](_0xb36f('0x18'));return _0x1ac269['status'](0xc8)[_0xb36f('0x16')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xb36f('0x19')]=function(_0x8bb8d8,_0xa4cadb){return git['reset']([_0xb36f('0x1a'),_0xb36f('0x1b')],function(_0x4496c8){if(_0x4496c8){logger['error'](_0x4496c8);return _0xa4cadb[_0xb36f('0x12')](0x1f4)[_0xb36f('0x16')](_0x4496c8);}logger[_0xb36f('0x17')](_0xb36f('0x1c'));return _0xa4cadb[_0xb36f('0x12')](0xc8)[_0xb36f('0x16')]({'output':'git\x20reset\x20--hard'});});};exports[_0xb36f('0x1d')]=function(_0x205974,_0x4765e7){exec('npm\x20install\x20--production',function(_0x57fe00,_0x6b9b8a,_0x233a8a){logger['info'](_0x6b9b8a);logger[_0xb36f('0x17')](_0x233a8a);if(_0x57fe00){logger[_0xb36f('0x15')](_0x57fe00);return _0x4765e7[_0xb36f('0x12')](0x1f4)[_0xb36f('0x16')](_0x57fe00);}return _0x4765e7[_0xb36f('0x12')](0xc8)['json']({'output':_0x6b9b8a});});};exports[_0xb36f('0x1e')]=function(_0xda6c77,_0x23e885){return pm2['restart'](_0xb36f('0x1f'))[_0xb36f('0x20')](function(_0x410e16){logger[_0xb36f('0x17')](_0xb36f('0x21'),_0x410e16);return _0x23e885[_0xb36f('0x12')](0xc8)[_0xb36f('0x16')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xb36f('0x22')](function(_0x5cc910){logger[_0xb36f('0x15')](_0x5cc910);return _0x23e885['status'](0x1f4)['json'](_0x5cc910);});};exports['migrations']=function(_0x203da8,_0x8e1c29){var _0x462fc5=fs[_0xb36f('0x23')](path['join'](config[_0xb36f('0xa')],_0xb36f('0x24'),_0xb36f('0x25')));var _0x188379=[];for(var _0x4a4a3a=0x0;_0x4a4a3a<_0x462fc5[_0xb36f('0x26')];_0x4a4a3a++){var _0x43515a=_0x462fc5[_0x4a4a3a][_0xb36f('0x27')]('.js','');if(compareVersions(module[_0xb36f('0xf')][_0xb36f('0x10')],_0x43515a)===-0x1){_0x188379[_0xb36f('0x28')](_0x43515a);}}if(_0x188379['length']){var _0x3c2274=_0x188379[_0xb36f('0x29')](compareVersions);var _0x4299d4=new Umzug({'storage':_0xb36f('0x2a'),'storageOptions':{'model':db[_0xb36f('0x2b')],'modelName':'Migration','columnName':_0xb36f('0x10')},'migrations':{'params':[db[_0xb36f('0x2a')]['getQueryInterface'](),db[_0xb36f('0x2a')][_0xb36f('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xb36f('0x2d')](config['root'],'server',_0xb36f('0x25')),'pattern':/\.js$/}});_0x4299d4['up']({'migrations':_[_0xb36f('0x2e')](_0x3c2274,function(_0x297adf){return _0x297adf+_0xb36f('0x2f');})})[_0xb36f('0x20')](function(){return _0x8e1c29[_0xb36f('0x12')](0xc8)[_0xb36f('0x16')]({'output':_0xb36f('0x30')+module['exports'][_0xb36f('0x10')]+_0xb36f('0x31')+_['last'](_0x3c2274),'migrations':_[_0xb36f('0x2d')](_0x3c2274)});})[_0xb36f('0x22')](function(_0x13d725){if(_0x13d725 instanceof db[_0xb36f('0x2a')][_0xb36f('0x32')]){return _0x8e1c29['status'](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x8e1c29[_0xb36f('0x12')](0x1f4)[_0xb36f('0x16')](_0x13d725);}});}else{return _0x8e1c29[_0xb36f('0x12')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x1968=['push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','tags','2.0.0','status','json','origin','info','reset','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','error','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','.js'];(function(_0x174813,_0x360a53){var _0x157a2d=function(_0x1d4458){while(--_0x1d4458){_0x174813['push'](_0x174813['shift']());}};_0x157a2d(++_0x360a53);}(_0x1968,0x169));var _0x8196=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x1968[_0xdea41a];return _0x15d0d8;};'use strict';var Umzug=require('umzug');var path=require(_0x8196('0x0'));var fs=require('fs');var _=require(_0x8196('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x8196('0x2'));var exec=require(_0x8196('0x3'))[_0x8196('0x4')];var db=require(_0x8196('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x8196('0x6'));var logger=require(_0x8196('0x7'))(_0x8196('0x8'));var git=require(_0x8196('0x9'))(config[_0x8196('0xa')]);exports[_0x8196('0xb')]=function(_0x1a4d91,_0xc2795){var _0x52f0a7={'current':module[_0x8196('0xc')][_0x8196('0xd')],'phonebar':0x2};if(_0x1a4d91['query']&&_0x1a4d91[_0x8196('0xe')][_0x8196('0xf')]){return git[_0x8196('0x10')]()[_0x8196('0x11')](function(_0x21610e,_0x62464f){_0x52f0a7[_0x8196('0xf')]=(_0x21610e?module[_0x8196('0xc')][_0x8196('0xd')]:_0x62464f['latest'])||_0x8196('0x12');return _0xc2795[_0x8196('0x13')](0xc8)[_0x8196('0x14')](_0x52f0a7);});}else{return _0xc2795[_0x8196('0x13')](0xc8)[_0x8196('0x14')](_0x52f0a7);}};exports[_0x8196('0x10')]=function(_0x52960e,_0x2b25ac){return git[_0x8196('0x10')]([_0x8196('0x15'),'master'],function(_0x465832){if(_0x465832){logger['error'](_0x465832);return _0x2b25ac[_0x8196('0x13')](0x1f4)['json'](_0x465832);}logger[_0x8196('0x16')]('git\x20fetch');return _0x2b25ac[_0x8196('0x13')](0xc8)[_0x8196('0x14')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x8196('0x17')]=function(_0x5043dd,_0x3930dd){return git[_0x8196('0x17')](['--hard',_0x8196('0x18')],function(_0x356594){if(_0x356594){logger['error'](_0x356594);return _0x3930dd[_0x8196('0x13')](0x1f4)[_0x8196('0x14')](_0x356594);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3930dd[_0x8196('0x13')](0xc8)['json']({'output':_0x8196('0x19')});});};exports[_0x8196('0x1a')]=function(_0x2de056,_0x9b095e){exec(_0x8196('0x1b'),function(_0x1e3052,_0x20145a,_0xebf155){logger[_0x8196('0x16')](_0x20145a);logger[_0x8196('0x16')](_0xebf155);if(_0x1e3052){logger[_0x8196('0x1c')](_0x1e3052);return _0x9b095e['status'](0x1f4)[_0x8196('0x14')](_0x1e3052);}return _0x9b095e[_0x8196('0x13')](0xc8)['json']({'output':_0x20145a});});};exports[_0x8196('0x1d')]=function(_0x34dd0f,_0x5671ee){return pm2[_0x8196('0x1d')]('motion2')[_0x8196('0x1e')](function(_0x206557){logger[_0x8196('0x16')](_0x8196('0x1f'),_0x206557);return _0x5671ee[_0x8196('0x13')](0xc8)[_0x8196('0x14')]({'output':_0x8196('0x20')});})[_0x8196('0x21')](function(_0x349bb7){logger[_0x8196('0x1c')](_0x349bb7);return _0x5671ee[_0x8196('0x13')](0x1f4)[_0x8196('0x14')](_0x349bb7);});};exports['migrations']=function(_0x418aee,_0x118da2){var _0x333dc4=fs[_0x8196('0x22')](path[_0x8196('0x23')](config[_0x8196('0xa')],_0x8196('0x24'),_0x8196('0x25')));var _0x38fafd=[];for(var _0x28c32a=0x0;_0x28c32a<_0x333dc4['length'];_0x28c32a++){var _0x3c3ce3=_0x333dc4[_0x28c32a]['replace'](_0x8196('0x26'),'');if(compareVersions(module[_0x8196('0xc')]['version'],_0x3c3ce3)===-0x1){_0x38fafd[_0x8196('0x27')](_0x3c3ce3);}}if(_0x38fafd[_0x8196('0x28')]){var _0x62a28b=_0x38fafd[_0x8196('0x29')](compareVersions);var _0x184886=new Umzug({'storage':_0x8196('0x2a'),'storageOptions':{'model':db[_0x8196('0x2b')],'modelName':'Migration','columnName':_0x8196('0xd')},'migrations':{'params':[db['sequelize'][_0x8196('0x2c')](),db[_0x8196('0x2a')][_0x8196('0x2d')],function(){throw new Error(_0x8196('0x2e'));}],'path':path[_0x8196('0x23')](config[_0x8196('0xa')],'server',_0x8196('0x25')),'pattern':/\.js$/}});_0x184886['up']({'migrations':_['map'](_0x62a28b,function(_0x42e3e5){return _0x42e3e5+_0x8196('0x26');})})[_0x8196('0x1e')](function(){return _0x118da2['status'](0xc8)[_0x8196('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x8196('0xc')][_0x8196('0xd')]+'\x20to\x20'+_[_0x8196('0x2f')](_0x62a28b),'migrations':_[_0x8196('0x23')](_0x62a28b)});})[_0x8196('0x21')](function(_0x1768a5){if(_0x1768a5 instanceof db['sequelize'][_0x8196('0x30')]){return _0x118da2[_0x8196('0x13')](0xc8)[_0x8196('0x14')]({'output':_0x8196('0x31')});}else{return _0x118da2['status'](0x1f4)[_0x8196('0x14')](_0x1768a5);}});}else{return _0x118da2[_0x8196('0x13')](0xc8)[_0x8196('0x14')]({'output':_0x8196('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 31afdd1..66dff45 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 _0x637e=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x1a6353,_0x296c58){var _0xab7abe=function(_0x5386f2){while(--_0x5386f2){_0x1a6353['push'](_0x1a6353['shift']());}};_0xab7abe(++_0x296c58);}(_0x637e,0x136));var _0xe637=function(_0xb79be6,_0x3d656e){_0xb79be6=_0xb79be6-0x0;var _0x38a7b4=_0x637e[_0xb79be6];return _0x38a7b4;};'use strict';var multer=require(_0xe637('0x0'));var util=require(_0xe637('0x1'));var path=require(_0xe637('0x2'));var timeout=require('connect-timeout');var express=require(_0xe637('0x3'));var router=express[_0xe637('0x4')]();var fs_extra=require(_0xe637('0x5'));var auth=require(_0xe637('0x6'));var interaction=require(_0xe637('0x7'));var config=require(_0xe637('0x8'));var controller=require(_0xe637('0x9'));router[_0xe637('0xa')]('/',auth[_0xe637('0xb')](),controller[_0xe637('0xc')]);router[_0xe637('0xa')](_0xe637('0xd'),auth[_0xe637('0xb')](),controller[_0xe637('0xe')]);router[_0xe637('0xa')](_0xe637('0xf'),auth[_0xe637('0xb')](),controller[_0xe637('0x10')]);router[_0xe637('0x11')]('/',auth[_0xe637('0xb')](),controller[_0xe637('0x12')]);router['put']('/:id',auth[_0xe637('0xb')](),controller[_0xe637('0x13')]);router[_0xe637('0x14')](_0xe637('0xf'),auth['isAuthenticated'](),controller[_0xe637('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc9ab=['put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x312cd8,_0x426245){var _0x137254=function(_0x3affd3){while(--_0x3affd3){_0x312cd8['push'](_0x312cd8['shift']());}};_0x137254(++_0x426245);}(_0xc9ab,0x17d));var _0xbc9a=function(_0x5db867,_0x5dd600){_0x5db867=_0x5db867-0x0;var _0x6de323=_0xc9ab[_0x5db867];return _0x6de323;};'use strict';var multer=require('multer');var util=require(_0xbc9a('0x0'));var path=require(_0xbc9a('0x1'));var timeout=require(_0xbc9a('0x2'));var express=require(_0xbc9a('0x3'));var router=express[_0xbc9a('0x4')]();var fs_extra=require(_0xbc9a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbc9a('0x6'));var config=require(_0xbc9a('0x7'));var controller=require(_0xbc9a('0x8'));router[_0xbc9a('0x9')]('/',auth[_0xbc9a('0xa')](),controller[_0xbc9a('0xb')]);router[_0xbc9a('0x9')](_0xbc9a('0xc'),auth[_0xbc9a('0xa')](),controller[_0xbc9a('0xd')]);router[_0xbc9a('0x9')](_0xbc9a('0xe'),auth[_0xbc9a('0xa')](),controller[_0xbc9a('0xf')]);router[_0xbc9a('0x10')]('/',auth['isAuthenticated'](),controller[_0xbc9a('0x11')]);router[_0xbc9a('0x12')](_0xbc9a('0xe'),auth[_0xbc9a('0xa')](),controller['update']);router['delete']('/:id',auth[_0xbc9a('0xa')](),controller[_0xbc9a('0x13')]);module[_0xbc9a('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 1c09b07..4373302 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 _0x4c71=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x1bf8b1,_0x1b11cd){var _0x37fb94=function(_0x33a62c){while(--_0x33a62c){_0x1bf8b1['push'](_0x1bf8b1['shift']());}};_0x37fb94(++_0x1b11cd);}(_0x4c71,0x12b));var _0x14c7=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x4c71[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0x14c7('0x0'));module[_0x14c7('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x14c7('0x2')]},'calleridnum':{'type':Sequelize[_0x14c7('0x2')]},'calleridname':{'type':Sequelize[_0x14c7('0x2')]},'queue':{'type':Sequelize[_0x14c7('0x2')]},'interface':{'type':Sequelize[_0x14c7('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x14c7('0x3')]},'agentconnectAt':{'type':Sequelize[_0x14c7('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x14c7('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x14c7('0x3')]},'agentdumpAt':{'type':Sequelize[_0x14c7('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x14c7('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x14c7('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x14c7('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x14c7('0x5')]},'agentacw':{'type':Sequelize[_0x14c7('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x14c7('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x14c7('0x2')]},'channelstate':{'type':Sequelize[_0x14c7('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x14c7('0x2')]},'connectedlinename':{'type':Sequelize[_0x14c7('0x2')]},'language':{'type':Sequelize[_0x14c7('0x2')]},'accountcode':{'type':Sequelize[_0x14c7('0x2')]},'context':{'type':Sequelize[_0x14c7('0x2')]},'exten':{'type':Sequelize[_0x14c7('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x14c7('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x14c7('0x2')]},'destcalleridnum':{'type':Sequelize[_0x14c7('0x2')]},'destcalleridname':{'type':Sequelize[_0x14c7('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x14c7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x14c7('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x14c7('0x2')]},'destexten':{'type':Sequelize[_0x14c7('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x14c7('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x14c7('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x14c7('0x2')]},'transfer':{'type':Sequelize[_0x14c7('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x14c7('0x2')],'comment':_0x14c7('0x6')},'transferexten':{'type':Sequelize[_0x14c7('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x14c7('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd7a0=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x3f3b53,_0x3d035f){var _0x3fa180=function(_0x194ff3){while(--_0x194ff3){_0x3f3b53['push'](_0x3f3b53['shift']());}};_0x3fa180(++_0x3d035f);}(_0xd7a0,0x163));var _0x0d7a=function(_0x4cf865,_0x5a9a3d){_0x4cf865=_0x4cf865-0x0;var _0x5d5a74=_0xd7a0[_0x4cf865];return _0x5d5a74;};'use strict';var Sequelize=require(_0x0d7a('0x0'));module[_0x0d7a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0d7a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0d7a('0x2')]},'queue':{'type':Sequelize[_0x0d7a('0x2')]},'interface':{'type':Sequelize[_0x0d7a('0x2')]},'membername':{'type':Sequelize[_0x0d7a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0d7a('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x0d7a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x0d7a('0x3')]},'agentdumpAt':{'type':Sequelize[_0x0d7a('0x3')]},'holdtime':{'type':Sequelize[_0x0d7a('0x4')]},'agentcomplete':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0d7a('0x4')]},'reason':{'type':Sequelize[_0x0d7a('0x2')]},'lastevent':{'type':Sequelize[_0x0d7a('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x0d7a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x0d7a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0d7a('0x2')]},'language':{'type':Sequelize[_0x0d7a('0x2')]},'accountcode':{'type':Sequelize[_0x0d7a('0x2')]},'context':{'type':Sequelize[_0x0d7a('0x2')]},'exten':{'type':Sequelize[_0x0d7a('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x0d7a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x0d7a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x0d7a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x0d7a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x0d7a('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x0d7a('0x2')]},'destpriority':{'type':Sequelize[_0x0d7a('0x2')]},'destuniqueid':{'type':Sequelize[_0x0d7a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0d7a('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0d7a('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0d7a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0d7a('0x2')]},'agententerreason':{'type':Sequelize[_0x0d7a('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index a8e42e1..a6084dd 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(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 6e3bb3b..2bc3ba3 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 _0x943c=['path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x4a6c2e,_0x428844){var _0x3af96c=function(_0x4be733){while(--_0x4be733){_0x4a6c2e['push'](_0x4a6c2e['shift']());}};_0x3af96c(++_0x428844);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var logger=require(_0xc943('0x2'))(_0xc943('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc943('0x4'));var fs=require('fs');var path=require(_0xc943('0x5'));var rimraf=require(_0xc943('0x6'));var config=require('../../config/environment');var attributes=require(_0xc943('0x7'));module[_0xc943('0x8')]=function(_0x3307ef,_0xaff37f){return _0x3307ef[_0xc943('0x9')](_0xc943('0xa'),attributes,{'tableName':_0xc943('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xc943('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','VoiceAgentReport','report_agent','lodash','../../config/logger','moment'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xa8eb,0x179));var _0xba8e=function(_0x3a07f5,_0x357c50){_0x3a07f5=_0x3a07f5-0x0;var _0x1ae6b9=_0xa8eb[_0x3a07f5];return _0x1ae6b9;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 135888a..36db02f 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 _0xfd5f=['error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x22af08,_0x2740cc){var _0x2879fa=function(_0x4ff6d8){while(--_0x4ff6d8){_0x22af08['push'](_0x22af08['shift']());}};_0x2879fa(++_0x2740cc);}(_0xfd5f,0x138));var _0xffd5=function(_0x2f3799,_0x2825d0){_0x2f3799=_0x2f3799-0x0;var _0x38f5db=_0xfd5f[_0x2f3799];return _0x38f5db;};'use strict';var _=require(_0xffd5('0x0'));var util=require(_0xffd5('0x1'));var moment=require(_0xffd5('0x2'));var BPromise=require(_0xffd5('0x3'));var rs=require(_0xffd5('0x4'));var fs=require('fs');var Redis=require(_0xffd5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xffd5('0x6'));var logger=require(_0xffd5('0x7'))(_0xffd5('0x8'));var config=require(_0xffd5('0x9'));var jayson=require(_0xffd5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x340202,_0x32dbd0,_0x59990f){return new BPromise(function(_0x3d1f35,_0x3e2739){return client[_0xffd5('0xb')](_0x340202,_0x59990f)[_0xffd5('0xc')](function(_0x2738f0){logger[_0xffd5('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x32dbd0,'request\x20sent');logger[_0xffd5('0xe')](_0xffd5('0xf'),_0x32dbd0,_0xffd5('0x10'),JSON[_0xffd5('0x11')](_0x2738f0));if(_0x2738f0[_0xffd5('0x12')]){if(_0x2738f0['error'][_0xffd5('0x13')]===0x1f4){logger[_0xffd5('0x12')](_0xffd5('0x14'),_0x32dbd0,_0x2738f0['error'][_0xffd5('0x15')]);return _0x3e2739(_0x2738f0[_0xffd5('0x12')]['message']);}logger[_0xffd5('0x12')](_0xffd5('0x14'),_0x32dbd0,_0x2738f0[_0xffd5('0x12')][_0xffd5('0x15')]);return _0x3d1f35(_0x2738f0[_0xffd5('0x12')][_0xffd5('0x15')]);}else{logger[_0xffd5('0xd')](_0xffd5('0x14'),_0x32dbd0,_0xffd5('0x10'));_0x3d1f35(_0x2738f0[_0xffd5('0x16')][_0xffd5('0x15')]);}})[_0xffd5('0x17')](function(_0x318fd0){logger[_0xffd5('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x32dbd0,_0x318fd0);_0x3e2739(_0x318fd0);});});}exports[_0xffd5('0x18')]=function(_0x4d67d9){var _0x14e151=this;return new Promise(function(_0x1e7177,_0x4506e4){return db['VoiceAgentReport'][_0xffd5('0x19')](_0x4d67d9[_0xffd5('0x1a')],{'raw':_0x4d67d9[_0xffd5('0x1b')]?_0x4d67d9[_0xffd5('0x1b')][_0xffd5('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1d9689){logger['info']('CreateVoiceAgentReport',_0x4d67d9);logger[_0xffd5('0xe')](_0xffd5('0x18'),_0x4d67d9,JSON[_0xffd5('0x11')](_0x1d9689));_0x1e7177(_0x1d9689);})[_0xffd5('0x17')](function(_0x16e263){logger[_0xffd5('0x12')](_0xffd5('0x18'),_0x16e263[_0xffd5('0x15')],_0x4d67d9);_0x4506e4(_0x14e151[_0xffd5('0x12')](0x1f4,_0x16e263['message']));});});};exports[_0xffd5('0x1d')]=function(_0x29d2a2){var _0xc96831=this;return new Promise(function(_0x22ef89,_0x4c5ebf){return db[_0xffd5('0x1e')][_0xffd5('0x1f')](_0x29d2a2[_0xffd5('0x1a')],{'raw':_0x29d2a2[_0xffd5('0x1b')]?_0x29d2a2['options'][_0xffd5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29d2a2[_0xffd5('0x1b')]?_0x29d2a2[_0xffd5('0x1b')][_0xffd5('0x20')]||null:null,'attributes':_0x29d2a2[_0xffd5('0x1b')]?_0x29d2a2[_0xffd5('0x1b')]['attributes']||null:null,'limit':_0x29d2a2['options']?_0x29d2a2[_0xffd5('0x1b')]['limit']||null:null})[_0xffd5('0xc')](function(_0x34fc7c){logger[_0xffd5('0xd')](_0xffd5('0x1d'),_0x29d2a2);logger[_0xffd5('0xe')](_0xffd5('0x1d'),_0x29d2a2,JSON[_0xffd5('0x11')](_0x34fc7c));_0x22ef89(_0x34fc7c);})[_0xffd5('0x17')](function(_0x54aadb){logger[_0xffd5('0x12')](_0xffd5('0x1d'),_0x54aadb['message'],_0x29d2a2);_0x4c5ebf(_0xc96831[_0xffd5('0x12')](0x1f4,_0x54aadb[_0xffd5('0x15')]));});});}; \ No newline at end of file +var _0xe839=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','CreateVoiceAgentReport','create','body','options','raw','stringify','VoiceAgentReport','where','limit','UpdateVoiceAgentReport','debug'];(function(_0x1a512f,_0x15f715){var _0x27b126=function(_0x208fd2){while(--_0x208fd2){_0x1a512f['push'](_0x1a512f['shift']());}};_0x27b126(++_0x15f715);}(_0xe839,0x12c));var _0x9e83=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0xe839[_0x5beda8];return _0x2aa042;};'use strict';var _=require(_0x9e83('0x0'));var util=require('util');var moment=require(_0x9e83('0x1'));var BPromise=require('bluebird');var rs=require(_0x9e83('0x2'));var fs=require('fs');var Redis=require(_0x9e83('0x3'));var db=require(_0x9e83('0x4'))['db'];var utils=require(_0x9e83('0x5'));var logger=require(_0x9e83('0x6'))('rpc');var config=require(_0x9e83('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9e83('0x8')][_0x9e83('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3579e0,_0x3bbd48,_0x11bd3f){return new BPromise(function(_0x39c26a,_0x1a0e2a){return client[_0x9e83('0xa')](_0x3579e0,_0x11bd3f)[_0x9e83('0xb')](function(_0x12281a){logger[_0x9e83('0xc')](_0x9e83('0xd'),_0x3bbd48,'request\x20sent');logger['debug'](_0x9e83('0xe'),_0x3bbd48,_0x9e83('0xf'),JSON['stringify'](_0x12281a));if(_0x12281a[_0x9e83('0x10')]){if(_0x12281a[_0x9e83('0x10')]['code']===0x1f4){logger[_0x9e83('0x10')](_0x9e83('0xd'),_0x3bbd48,_0x12281a['error']['message']);return _0x1a0e2a(_0x12281a[_0x9e83('0x10')]['message']);}logger[_0x9e83('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x3bbd48,_0x12281a[_0x9e83('0x10')][_0x9e83('0x11')]);return _0x39c26a(_0x12281a[_0x9e83('0x10')][_0x9e83('0x11')]);}else{logger[_0x9e83('0xc')](_0x9e83('0xd'),_0x3bbd48,_0x9e83('0xf'));_0x39c26a(_0x12281a[_0x9e83('0x12')][_0x9e83('0x11')]);}})['catch'](function(_0x3de17c){logger[_0x9e83('0x10')](_0x9e83('0xd'),_0x3bbd48,_0x3de17c);_0x1a0e2a(_0x3de17c);});});}exports[_0x9e83('0x13')]=function(_0x5ac4bd){var _0x535507=this;return new Promise(function(_0xfd5ce8,_0x1b4e34){return db['VoiceAgentReport'][_0x9e83('0x14')](_0x5ac4bd[_0x9e83('0x15')],{'raw':_0x5ac4bd[_0x9e83('0x16')]?_0x5ac4bd[_0x9e83('0x16')][_0x9e83('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x42200b){logger[_0x9e83('0xc')]('CreateVoiceAgentReport',_0x5ac4bd);logger['debug']('CreateVoiceAgentReport',_0x5ac4bd,JSON[_0x9e83('0x18')](_0x42200b));_0xfd5ce8(_0x42200b);})['catch'](function(_0x2987c5){logger[_0x9e83('0x10')]('CreateVoiceAgentReport',_0x2987c5[_0x9e83('0x11')],_0x5ac4bd);_0x1b4e34(_0x535507[_0x9e83('0x10')](0x1f4,_0x2987c5[_0x9e83('0x11')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3dec27){var _0x415ca9=this;return new Promise(function(_0x81775d,_0x4f752c){return db[_0x9e83('0x19')]['update'](_0x3dec27[_0x9e83('0x15')],{'raw':_0x3dec27[_0x9e83('0x16')]?_0x3dec27['options'][_0x9e83('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dec27['options']?_0x3dec27['options'][_0x9e83('0x1a')]||null:null,'attributes':_0x3dec27[_0x9e83('0x16')]?_0x3dec27[_0x9e83('0x16')]['attributes']||null:null,'limit':_0x3dec27[_0x9e83('0x16')]?_0x3dec27[_0x9e83('0x16')][_0x9e83('0x1b')]||null:null})['then'](function(_0x2df263){logger[_0x9e83('0xc')](_0x9e83('0x1c'),_0x3dec27);logger[_0x9e83('0x1d')](_0x9e83('0x1c'),_0x3dec27,JSON[_0x9e83('0x18')](_0x2df263));_0x81775d(_0x2df263);})['catch'](function(_0x26e1d3){logger[_0x9e83('0x10')](_0x9e83('0x1c'),_0x26e1d3[_0x9e83('0x11')],_0x3dec27);_0x4f752c(_0x415ca9[_0x9e83('0x10')](0x1f4,_0x26e1d3[_0x9e83('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c729bcb..9b323fb 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 _0x56e7=['put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x2b9f81,_0x2ce317){var _0x132781=function(_0x36cae7){while(--_0x36cae7){_0x2b9f81['push'](_0x2b9f81['shift']());}};_0x132781(++_0x2ce317);}(_0x56e7,0x7b));var _0x756e=function(_0x258a9f,_0x50dff7){_0x258a9f=_0x258a9f-0x0;var _0x3470a7=_0x56e7[_0x258a9f];return _0x3470a7;};'use strict';var multer=require('multer');var util=require(_0x756e('0x0'));var path=require(_0x756e('0x1'));var timeout=require('connect-timeout');var express=require(_0x756e('0x2'));var router=express[_0x756e('0x3')]();var fs_extra=require(_0x756e('0x4'));var auth=require(_0x756e('0x5'));var interaction=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var controller=require(_0x756e('0x8'));router['get']('/',auth[_0x756e('0x9')](),controller[_0x756e('0xa')]);router[_0x756e('0xb')](_0x756e('0xc'),auth['isAuthenticated'](),controller[_0x756e('0xd')]);router['get'](_0x756e('0xe'),auth[_0x756e('0x9')](),controller[_0x756e('0xf')]);router[_0x756e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x756e('0x11')](_0x756e('0xe'),auth[_0x756e('0x9')](),controller['update']);router[_0x756e('0x12')](_0x756e('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x756e('0x13')]=router; \ No newline at end of file +var _0xdc97=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5749c0,_0x34e97b){_0x5749c0=_0x5749c0-0x0;var _0x30adae=_0xdc97[_0x5749c0];return _0x30adae;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['post']('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0xe')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);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 a9a9da3..f401b27 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 _0x9beb=['inbound','internal','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0xb9234d,_0x566e12){var _0x55008a=function(_0x2612c1){while(--_0x2612c1){_0xb9234d['push'](_0xb9234d['shift']());}};_0x55008a(++_0x566e12);}(_0x9beb,0x151));var _0xb9be=function(_0x14342f,_0x57dfc9){_0x14342f=_0x14342f-0x0;var _0x4f6d00=_0x9beb[_0x14342f];return _0x4f6d00;};'use strict';var Sequelize=require(_0xb9be('0x0'));module[_0xb9be('0x1')]={'uniqueid':{'type':Sequelize[_0xb9be('0x2')]},'type':{'type':Sequelize[_0xb9be('0x3')](_0xb9be('0x4'),_0xb9be('0x5'),'outbound',_0xb9be('0x6'),'outbound-fax',_0xb9be('0x7'))},'tag':{'type':Sequelize[_0xb9be('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xb9be('0x2')]},'destination':{'type':Sequelize[_0xb9be('0x2')]},'destinationcontext':{'type':Sequelize[_0xb9be('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb9be('0x2')]},'destinationchannel':{'type':Sequelize[_0xb9be('0x2')]},'lastapplication':{'type':Sequelize[_0xb9be('0x2')]},'lastdata':{'type':Sequelize[_0xb9be('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xb9be('0x9')]},'answertime':{'type':Sequelize[_0xb9be('0x9')]},'endtime':{'type':Sequelize[_0xb9be('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xb9be('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xb9be('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xb9be('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xb9be('0x2')]},'note':{'type':Sequelize[_0xb9be('0x2')]},'prefix':{'type':Sequelize[_0xb9be('0x2')]},'routeid':{'type':Sequelize[_0xb9be('0xa')]},'sipcallid':{'type':Sequelize[_0xb9be('0x2')]}}; \ No newline at end of file +var _0x6c4d=['internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','STRING','inbound'];(function(_0x7b9ac9,_0x5e7091){var _0x1af059=function(_0x5d7289){while(--_0x5d7289){_0x7b9ac9['push'](_0x7b9ac9['shift']());}};_0x1af059(++_0x5e7091);}(_0x6c4d,0x1dd));var _0xd6c4=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x6c4d[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xd6c4('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd6c4('0x1')]},'type':{'type':Sequelize['ENUM'](_0xd6c4('0x2'),_0xd6c4('0x3'),_0xd6c4('0x4'),_0xd6c4('0x5'),_0xd6c4('0x6'),_0xd6c4('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd6c4('0x1')]},'source':{'type':Sequelize[_0xd6c4('0x1')]},'destination':{'type':Sequelize[_0xd6c4('0x1')]},'destinationcontext':{'type':Sequelize[_0xd6c4('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd6c4('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xd6c4('0x8')]},'systemanswertime':{'type':Sequelize[_0xd6c4('0x8')]},'answertime':{'type':Sequelize[_0xd6c4('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xd6c4('0x9')]},'billableseconds':{'type':Sequelize[_0xd6c4('0x9')]},'mohtime':{'type':Sequelize[_0xd6c4('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd6c4('0x1')]},'amaflags':{'type':Sequelize[_0xd6c4('0x1')]},'userfield':{'type':Sequelize[_0xd6c4('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xd6c4('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xd6c4('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xd6c4('0x1')]},'routeid':{'type':Sequelize[_0xd6c4('0x9')]},'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 a7b626c..972e90a 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x500610,_0x9c0cda){_0x500610=_0x500610-0x0;var _0x595f97=_0x2032[_0x500610];return _0x595f97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _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(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x2ef3,0xba));var _0x32ef=function(_0x45bbf7,_0x46dc88){_0x45bbf7=_0x45bbf7-0x0;var _0x8381b6=_0x2ef3[_0x45bbf7];return _0x8381b6;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index bdddeea..c9b482d 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 _0x89e3=['define','uniqueid','util','../../config/logger','api','moment','request-promise','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x1c189b,_0x3efdda){var _0x540701=function(_0x5c6b52){while(--_0x5c6b52){_0x1c189b['push'](_0x1c189b['shift']());}};_0x540701(++_0x3efdda);}(_0x89e3,0x66));var _0x389e=function(_0x5d9dd0,_0x4050fb){_0x5d9dd0=_0x5d9dd0-0x0;var _0x31a59b=_0x89e3[_0x5d9dd0];return _0x31a59b;};'use strict';var _=require('lodash');var util=require(_0x389e('0x0'));var logger=require(_0x389e('0x1'))(_0x389e('0x2'));var moment=require(_0x389e('0x3'));var BPromise=require('bluebird');var rp=require(_0x389e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x389e('0x5'));var attributes=require(_0x389e('0x6'));module[_0x389e('0x7')]=function(_0x78a400,_0x11f26d){return _0x78a400[_0x389e('0x8')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x389e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d4d=['../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ddb02,_0x184ada){var _0x52b85f=function(_0xc7f427){while(--_0xc7f427){_0x3ddb02['push'](_0x3ddb02['shift']());}};_0x52b85f(++_0x184ada);}(_0x2d4d,0x94));var _0xd2d4=function(_0x4fabaf,_0x55a0a7){_0x4fabaf=_0x4fabaf-0x0;var _0x98139a=_0x2d4d[_0x4fabaf];return _0x98139a;};'use strict';var _=require(_0xd2d4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd2d4('0x1'));var BPromise=require(_0xd2d4('0x2'));var rp=require(_0xd2d4('0x3'));var fs=require('fs');var path=require(_0xd2d4('0x4'));var rimraf=require(_0xd2d4('0x5'));var config=require(_0xd2d4('0x6'));var attributes=require(_0xd2d4('0x7'));module[_0xd2d4('0x8')]=function(_0x47006c,_0x471003){return _0x47006c['define'](_0xd2d4('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xd2d4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b22842b..d2b2e90 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 _0x425d=['where','attributes','limit','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','options','raw'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x425d,0x1e0));var _0xd425=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x425d[_0x5d6e30];return _0x3d3f3b;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});}exports[_0xd425('0x18')]=function(_0x434d97){var _0x467a6c=this;return new Promise(function(_0x1155bc,_0x4e88fa){return db['VoiceCallReport']['findAll']({'raw':_0x434d97['options']?_0x434d97[_0xd425('0x19')][_0xd425('0x1a')]===undefined?!![]:![]:!![],'where':_0x434d97[_0xd425('0x19')]?_0x434d97['options'][_0xd425('0x1b')]||null:null,'attributes':_0x434d97[_0xd425('0x19')]?_0x434d97['options'][_0xd425('0x1c')]||null:null,'limit':_0x434d97[_0xd425('0x19')]?_0x434d97[_0xd425('0x19')][_0xd425('0x1d')]||null:null,'include':_0x434d97[_0xd425('0x19')]?_0x434d97[_0xd425('0x19')][_0xd425('0x1e')]?_[_0xd425('0x1f')](_0x434d97[_0xd425('0x19')][_0xd425('0x1e')],function(_0x151ad9){return{'model':db[_0x151ad9[_0xd425('0x20')]],'as':_0x151ad9['as'],'attributes':_0x151ad9['attributes'],'include':_0x151ad9[_0xd425('0x1e')]?_[_0xd425('0x1f')](_0x151ad9[_0xd425('0x1e')],function(_0x1908a5){return{'model':db[_0x1908a5[_0xd425('0x20')]],'as':_0x1908a5['as'],'attributes':_0x1908a5[_0xd425('0x1c')],'include':_0x1908a5[_0xd425('0x1e')]?_['map'](_0x1908a5[_0xd425('0x1e')],function(_0x177de2){return{'model':db[_0x177de2[_0xd425('0x20')]],'as':_0x177de2['as'],'attributes':_0x177de2['attributes']};}):[]};}):[]};}):[]:[]})[_0xd425('0xd')](function(_0x3ad9bd){logger[_0xd425('0xe')](_0xd425('0x18'),_0x434d97);logger[_0xd425('0x11')](_0xd425('0x18'),_0x434d97,JSON[_0xd425('0x13')](_0x3ad9bd));_0x1155bc(_0x3ad9bd);})[_0xd425('0x17')](function(_0x24da23){logger[_0xd425('0x14')]('GetVoiceCallReport',_0x24da23[_0xd425('0x16')],_0x434d97);_0x4e88fa(_0x467a6c[_0xd425('0x14')](0x1f4,_0x24da23[_0xd425('0x16')]));});});};exports[_0xd425('0x21')]=function(_0x3275b1){var _0x1abf33=this;return new Promise(function(_0x47405f,_0x40c392){return db[_0xd425('0x22')][_0xd425('0x23')](_0x3275b1[_0xd425('0x24')],{'raw':_0x3275b1['options']?_0x3275b1[_0xd425('0x19')][_0xd425('0x1a')]===undefined?!![]:![]:!![]})[_0xd425('0xd')](function(_0x21e0bd){logger[_0xd425('0xe')]('CreateVoiceCallReport',_0x3275b1);logger[_0xd425('0x11')](_0xd425('0x21'),_0x3275b1,JSON['stringify'](_0x21e0bd));_0x47405f(_0x21e0bd);})['catch'](function(_0x51669d){logger[_0xd425('0x14')](_0xd425('0x21'),_0x51669d[_0xd425('0x16')],_0x3275b1);_0x40c392(_0x1abf33[_0xd425('0x14')](0x1f4,_0x51669d['message']));});});};exports[_0xd425('0x25')]=function(_0x1d4414){var _0x30a9dc=this;return new Promise(function(_0x1c7f72,_0x27b9e2){return db[_0xd425('0x22')][_0xd425('0x26')](_0x1d4414['body'],{'raw':_0x1d4414[_0xd425('0x19')]?_0x1d4414['options'][_0xd425('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d4414[_0xd425('0x19')]?_0x1d4414[_0xd425('0x19')]['where']||null:null,'attributes':_0x1d4414[_0xd425('0x19')]?_0x1d4414[_0xd425('0x19')][_0xd425('0x1c')]||null:null,'limit':_0x1d4414[_0xd425('0x19')]?_0x1d4414['options'][_0xd425('0x1d')]||null:null})[_0xd425('0xd')](function(_0x59e326){logger['info']('UpdateVoiceCallReport',_0x1d4414);logger[_0xd425('0x11')](_0xd425('0x25'),_0x1d4414,JSON[_0xd425('0x13')](_0x59e326));_0x1c7f72(_0x59e326);})['catch'](function(_0x4f8323){logger['error'](_0xd425('0x25'),_0x4f8323[_0xd425('0x16')],_0x1d4414);_0x27b9e2(_0x30a9dc[_0xd425('0x14')](0x1f4,_0x4f8323[_0xd425('0x16')]));});});}; \ No newline at end of file +var _0xc8ca=['request\x20sent','debug','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','info','result','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then'];(function(_0x2723f3,_0x571ce6){var _0x2da006=function(_0x420110){while(--_0x420110){_0x2723f3['push'](_0x2723f3['shift']());}};_0x2da006(++_0x571ce6);}(_0xc8ca,0x1ed));var _0xac8c=function(_0x4346a8,_0x2dd8e2){_0x4346a8=_0x4346a8-0x0;var _0x287ceb=_0xc8ca[_0x4346a8];return _0x287ceb;};'use strict';var _=require(_0xac8c('0x0'));var util=require(_0xac8c('0x1'));var moment=require('moment');var BPromise=require(_0xac8c('0x2'));var rs=require(_0xac8c('0x3'));var fs=require('fs');var Redis=require(_0xac8c('0x4'));var db=require(_0xac8c('0x5'))['db'];var utils=require(_0xac8c('0x6'));var logger=require('../../config/logger')(_0xac8c('0x7'));var config=require(_0xac8c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d1378,_0x16f46b,_0x3c677a){return new BPromise(function(_0x22fc1a,_0x1c522c){return client[_0xac8c('0x9')](_0x1d1378,_0x3c677a)[_0xac8c('0xa')](function(_0x1f86f0){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x16f46b,_0xac8c('0xb'));logger[_0xac8c('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x16f46b,'request\x20sent',JSON[_0xac8c('0xd')](_0x1f86f0));if(_0x1f86f0[_0xac8c('0xe')]){if(_0x1f86f0[_0xac8c('0xe')][_0xac8c('0xf')]===0x1f4){logger[_0xac8c('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x16f46b,_0x1f86f0[_0xac8c('0xe')][_0xac8c('0x10')]);return _0x1c522c(_0x1f86f0[_0xac8c('0xe')][_0xac8c('0x10')]);}logger[_0xac8c('0xe')](_0xac8c('0x11'),_0x16f46b,_0x1f86f0[_0xac8c('0xe')]['message']);return _0x22fc1a(_0x1f86f0[_0xac8c('0xe')][_0xac8c('0x10')]);}else{logger[_0xac8c('0x12')](_0xac8c('0x11'),_0x16f46b,_0xac8c('0xb'));_0x22fc1a(_0x1f86f0[_0xac8c('0x13')][_0xac8c('0x10')]);}})['catch'](function(_0x8573f9){logger[_0xac8c('0xe')](_0xac8c('0x11'),_0x16f46b,_0x8573f9);_0x1c522c(_0x8573f9);});});}exports['GetVoiceCallReport']=function(_0x176027){var _0x3225ba=this;return new Promise(function(_0x3941d8,_0x4deec4){return db[_0xac8c('0x14')]['findAll']({'raw':_0x176027[_0xac8c('0x15')]?_0x176027[_0xac8c('0x15')][_0xac8c('0x16')]===undefined?!![]:![]:!![],'where':_0x176027[_0xac8c('0x15')]?_0x176027['options'][_0xac8c('0x17')]||null:null,'attributes':_0x176027['options']?_0x176027[_0xac8c('0x15')][_0xac8c('0x18')]||null:null,'limit':_0x176027[_0xac8c('0x15')]?_0x176027[_0xac8c('0x15')][_0xac8c('0x19')]||null:null,'include':_0x176027[_0xac8c('0x15')]?_0x176027['options'][_0xac8c('0x1a')]?_[_0xac8c('0x1b')](_0x176027[_0xac8c('0x15')][_0xac8c('0x1a')],function(_0x454bc6){return{'model':db[_0x454bc6[_0xac8c('0x1c')]],'as':_0x454bc6['as'],'attributes':_0x454bc6[_0xac8c('0x18')],'include':_0x454bc6[_0xac8c('0x1a')]?_[_0xac8c('0x1b')](_0x454bc6['include'],function(_0x7ca7d9){return{'model':db[_0x7ca7d9['model']],'as':_0x7ca7d9['as'],'attributes':_0x7ca7d9['attributes'],'include':_0x7ca7d9[_0xac8c('0x1a')]?_['map'](_0x7ca7d9['include'],function(_0x4ad462){return{'model':db[_0x4ad462[_0xac8c('0x1c')]],'as':_0x4ad462['as'],'attributes':_0x4ad462['attributes']};}):[]};}):[]};}):[]:[]})[_0xac8c('0xa')](function(_0x2f758f){logger[_0xac8c('0x12')](_0xac8c('0x1d'),_0x176027);logger[_0xac8c('0xc')](_0xac8c('0x1d'),_0x176027,JSON[_0xac8c('0xd')](_0x2f758f));_0x3941d8(_0x2f758f);})[_0xac8c('0x1e')](function(_0x48015e){logger[_0xac8c('0xe')](_0xac8c('0x1d'),_0x48015e[_0xac8c('0x10')],_0x176027);_0x4deec4(_0x3225ba['error'](0x1f4,_0x48015e[_0xac8c('0x10')]));});});};exports[_0xac8c('0x1f')]=function(_0x3a7c6b){var _0x14a399=this;return new Promise(function(_0x1bc75c,_0x366014){return db['VoiceCallReport'][_0xac8c('0x20')](_0x3a7c6b[_0xac8c('0x21')],{'raw':_0x3a7c6b[_0xac8c('0x15')]?_0x3a7c6b[_0xac8c('0x15')][_0xac8c('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xe3e483){logger['info'](_0xac8c('0x1f'),_0x3a7c6b);logger['debug'](_0xac8c('0x1f'),_0x3a7c6b,JSON['stringify'](_0xe3e483));_0x1bc75c(_0xe3e483);})['catch'](function(_0x5b83c9){logger['error'](_0xac8c('0x1f'),_0x5b83c9[_0xac8c('0x10')],_0x3a7c6b);_0x366014(_0x14a399[_0xac8c('0xe')](0x1f4,_0x5b83c9[_0xac8c('0x10')]));});});};exports[_0xac8c('0x22')]=function(_0x258b87){var _0x4a8412=this;return new Promise(function(_0x5d0790,_0x4736b1){return db['VoiceCallReport'][_0xac8c('0x23')](_0x258b87[_0xac8c('0x21')],{'raw':_0x258b87['options']?_0x258b87[_0xac8c('0x15')][_0xac8c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258b87[_0xac8c('0x15')]?_0x258b87[_0xac8c('0x15')][_0xac8c('0x17')]||null:null,'attributes':_0x258b87[_0xac8c('0x15')]?_0x258b87[_0xac8c('0x15')][_0xac8c('0x18')]||null:null,'limit':_0x258b87[_0xac8c('0x15')]?_0x258b87['options'][_0xac8c('0x19')]||null:null})[_0xac8c('0xa')](function(_0x29b9d4){logger['info'](_0xac8c('0x22'),_0x258b87);logger['debug'](_0xac8c('0x22'),_0x258b87,JSON[_0xac8c('0xd')](_0x29b9d4));_0x5d0790(_0x29b9d4);})['catch'](function(_0x494233){logger[_0xac8c('0xe')](_0xac8c('0x22'),_0x494233[_0xac8c('0x10')],_0x258b87);_0x4736b1(_0x4a8412[_0xac8c('0xe')](0x1f4,_0x494233[_0xac8c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 7e24a00..6774c4e 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 _0xb8f7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','multer','util','path','connect-timeout','express'];(function(_0x2a6643,_0x1d6576){var _0x3e6bde=function(_0x5af7fa){while(--_0x5af7fa){_0x2a6643['push'](_0x2a6643['shift']());}};_0x3e6bde(++_0x1d6576);}(_0xb8f7,0x175));var _0x7b8f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb8f7[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x7b8f('0x0'));var util=require(_0x7b8f('0x1'));var path=require(_0x7b8f('0x2'));var timeout=require(_0x7b8f('0x3'));var express=require(_0x7b8f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7b8f('0x5'));var interaction=require(_0x7b8f('0x6'));var config=require(_0x7b8f('0x7'));var controller=require(_0x7b8f('0x8'));router['get']('/',auth[_0x7b8f('0x9')](),controller[_0x7b8f('0xa')]);router[_0x7b8f('0xb')](_0x7b8f('0xc'),auth['isAuthenticated'](),controller[_0x7b8f('0xd')]);router[_0x7b8f('0xe')]('/',auth[_0x7b8f('0x9')](),controller[_0x7b8f('0xf')]);router[_0x7b8f('0x10')](_0x7b8f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7b8f('0x11')](_0x7b8f('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbaa7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated','show','post','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x367825,_0xba445e){var _0x17e0c2=function(_0x2a16cc){while(--_0x2a16cc){_0x367825['push'](_0x367825['shift']());}};_0x17e0c2(++_0xba445e);}(_0xbaa7,0x189));var _0x7baa=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xbaa7[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require('multer');var util=require(_0x7baa('0x0'));var path=require('path');var timeout=require(_0x7baa('0x1'));var express=require(_0x7baa('0x2'));var router=express[_0x7baa('0x3')]();var fs_extra=require(_0x7baa('0x4'));var auth=require(_0x7baa('0x5'));var interaction=require(_0x7baa('0x6'));var config=require(_0x7baa('0x7'));var controller=require(_0x7baa('0x8'));router[_0x7baa('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7baa('0x9')](_0x7baa('0xa'),auth[_0x7baa('0xb')](),controller[_0x7baa('0xc')]);router[_0x7baa('0xd')]('/',auth[_0x7baa('0xb')](),controller['create']);router['put']('/:id',auth[_0x7baa('0xb')](),controller[_0x7baa('0xe')]);router[_0x7baa('0xf')](_0x7baa('0xa'),auth[_0x7baa('0xb')](),controller[_0x7baa('0x10')]);module[_0x7baa('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 375946c..45cb6cb 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 _0xc96d=['STRING','exports','setDataValue','options','join','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc96d,0xd3));var _0xdc96=function(_0x591246,_0x446d9d){_0x591246=_0x591246-0x0;var _0x3e749a=_0xc96d[_0x591246];return _0x3e749a;};'use strict';var Sequelize=require('sequelize');module[_0xdc96('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x197ae0){this[_0xdc96('0x1')](_0xdc96('0x2'),_0x197ae0?_0x197ae0[_0xdc96('0x3')](''):[]);},'get':function(){return this[_0xdc96('0x4')]('options')?this[_0xdc96('0x4')](_0xdc96('0x2'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xdc96('0x5')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xdc96('0x5')]},'description':{'type':Sequelize[_0xdc96('0x5')]}}; \ No newline at end of file +var _0x4f05=['setDataValue','options','join','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x5190a7,_0x56d83e){var _0x1a1a77=function(_0x54ab6a){while(--_0x54ab6a){_0x5190a7['push'](_0x5190a7['shift']());}};_0x1a1a77(++_0x56d83e);}(_0x4f05,0xef));var _0x54f0=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x4f05[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x54f0('0x0'));module[_0x54f0('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x54f0('0x2')],'unique':_0x54f0('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x54f0('0x2')],'set':function(_0x36a25b){this[_0x54f0('0x4')](_0x54f0('0x5'),_0x36a25b?_0x36a25b[_0x54f0('0x6')](''):[]);},'get':function(){return this[_0x54f0('0x7')]('options')?this[_0x54f0('0x7')](_0x54f0('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x54f0('0x2')]},'record':{'type':Sequelize[_0x54f0('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x54f0('0x2')]},'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 d0f2414..88284ba 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 _0x5397=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','user'];(function(_0x1e14ad,_0x4b15a6){var _0x27128a=function(_0x179a12){while(--_0x179a12){_0x1e14ad['push'](_0x1e14ad['shift']());}};_0x27128a(++_0x4b15a6);}(_0x5397,0x105));var _0x7539=function(_0x5e5e96,_0x23d042){_0x5e5e96=_0x5e5e96-0x0;var _0x5ce55d=_0x5397[_0x5e5e96];return _0x5ce55d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7539('0x0'));var zipdir=require(_0x7539('0x1'));var jsonpatch=require(_0x7539('0x2'));var rp=require(_0x7539('0x3'));var moment=require(_0x7539('0x4'));var BPromise=require(_0x7539('0x5'));var Mustache=require(_0x7539('0x6'));var util=require(_0x7539('0x7'));var path=require(_0x7539('0x8'));var sox=require('sox');var csv=require(_0x7539('0x9'));var ejs=require(_0x7539('0xa'));var fs=require('fs');var fs_extra=require(_0x7539('0xb'));var _=require(_0x7539('0xc'));var squel=require(_0x7539('0xd'));var crypto=require('crypto');var jsforce=require(_0x7539('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7539('0x9'));var querystring=require(_0x7539('0xf'));var Papa=require(_0x7539('0x10'));var Redis=require(_0x7539('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7539('0x12'));var hardwareService=require(_0x7539('0x13'));var logger=require(_0x7539('0x14'))(_0x7539('0x15'));var utils=require(_0x7539('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7539('0x17'));var db=require(_0x7539('0x18'))['db'];function respondWithStatusCode(_0x57eab9,_0x22400d){_0x22400d=_0x22400d||0xcc;return function(_0x8e2cc8){if(_0x8e2cc8){return _0x57eab9['sendStatus'](_0x22400d);}return _0x57eab9[_0x7539('0x19')](_0x22400d)[_0x7539('0x1a')]();};}function respondWithResult(_0x551f43,_0x131d5e){_0x131d5e=_0x131d5e||0xc8;return function(_0x193e1a){if(_0x193e1a){return _0x551f43[_0x7539('0x19')](_0x131d5e)[_0x7539('0x1b')](_0x193e1a);}};}function respondWithFilteredResult(_0x186ac1,_0x5614ae){return function(_0x2ca9cf){if(_0x2ca9cf){var _0x426af5=typeof _0x5614ae[_0x7539('0x1c')]===_0x7539('0x1d')&&typeof _0x5614ae['limit']===_0x7539('0x1d');var _0x467c77=_0x2ca9cf[_0x7539('0x1e')];var _0x3863e2=_0x426af5?0x0:_0x5614ae[_0x7539('0x1c')];var _0x183161=_0x426af5?_0x2ca9cf[_0x7539('0x1e')]:_0x5614ae[_0x7539('0x1c')]+_0x5614ae['limit'];var _0xbaac15;if(_0x183161>=_0x467c77){_0x183161=_0x467c77;_0xbaac15=0xc8;}else{_0xbaac15=0xce;}_0x186ac1[_0x7539('0x19')](_0xbaac15);return _0x186ac1['set'](_0x7539('0x1f'),_0x3863e2+'-'+_0x183161+'/'+_0x467c77)[_0x7539('0x1b')](_0x2ca9cf);}return null;};}function patchUpdates(_0x3e3a7a){return function(_0x1364bc){try{jsonpatch[_0x7539('0x20')](_0x1364bc,_0x3e3a7a,!![]);}catch(_0x22d6fb){return BPromise[_0x7539('0x21')](_0x22d6fb);}return _0x1364bc[_0x7539('0x22')]();};}function saveUpdates(_0x58b01d,_0x260d8b){return function(_0x93269d){if(_0x93269d){return _0x93269d[_0x7539('0x23')](_0x58b01d)[_0x7539('0x24')](function(_0x55cab2){return _0x55cab2;});}return null;};}function removeEntity(_0x3fd27f,_0x25127c){return function(_0x2c70f7){if(_0x2c70f7){return _0x2c70f7[_0x7539('0x25')]()['then'](function(){var _0x25db09=_0x2c70f7[_0x7539('0x26')]({'plain':!![]});var _0x3c31ba=_0x7539('0x27');return db['UserProfileResource'][_0x7539('0x25')]({'where':{'type':_0x3c31ba,'resourceId':_0x25db09['id']}})[_0x7539('0x24')](function(){return _0x2c70f7;});})['then'](function(){_0x3fd27f[_0x7539('0x19')](0xcc)[_0x7539('0x1a')]();});}};}function handleEntityNotFound(_0x2b4357,_0x39502a){return function(_0x41abd6){if(!_0x41abd6){_0x2b4357[_0x7539('0x28')](0x194);}return _0x41abd6;};}function handleError(_0xea6961,_0x558253){_0x558253=_0x558253||0x1f4;return function(_0xc9f399){logger[_0x7539('0x29')](_0xc9f399[_0x7539('0x2a')]);if(_0xc9f399['name']){delete _0xc9f399[_0x7539('0x2b')];}_0xea6961[_0x7539('0x19')](_0x558253)['send'](_0xc9f399);};}exports[_0x7539('0x2c')]=function(_0x2a6796,_0x4642a5){var _0x17f44b={},_0x1a91ac={},_0x107c8c={'count':0x0,'rows':[]};var _0x41056e=_[_0x7539('0x2d')](db[_0x7539('0x2e')][_0x7539('0x2f')],function(_0x228b48){return{'name':_0x228b48[_0x7539('0x30')],'type':_0x228b48['type'][_0x7539('0x31')]};});_0x1a91ac[_0x7539('0x32')]=_[_0x7539('0x2d')](_0x41056e,'name');_0x1a91ac[_0x7539('0x33')]=_['keys'](_0x2a6796[_0x7539('0x33')]);_0x1a91ac['filters']=_[_0x7539('0x34')](_0x1a91ac[_0x7539('0x32')],_0x1a91ac[_0x7539('0x33')]);_0x17f44b[_0x7539('0x35')]=_[_0x7539('0x34')](_0x1a91ac[_0x7539('0x32')],qs[_0x7539('0x36')](_0x2a6796[_0x7539('0x33')][_0x7539('0x36')]));_0x17f44b[_0x7539('0x35')]=_0x17f44b['attributes'][_0x7539('0x37')]?_0x17f44b[_0x7539('0x35')]:_0x1a91ac[_0x7539('0x32')];if(!_0x2a6796[_0x7539('0x33')][_0x7539('0x38')](_0x7539('0x39'))){_0x17f44b['limit']=qs[_0x7539('0x3a')](_0x2a6796['query'][_0x7539('0x3a')]);_0x17f44b[_0x7539('0x1c')]=qs['offset'](_0x2a6796[_0x7539('0x33')][_0x7539('0x1c')]);}_0x17f44b[_0x7539('0x3b')]=qs[_0x7539('0x3c')](_0x2a6796[_0x7539('0x33')]['sort']);_0x17f44b[_0x7539('0x3d')]=qs[_0x7539('0x3e')](_[_0x7539('0x3f')](_0x2a6796[_0x7539('0x33')],_0x1a91ac[_0x7539('0x3e')]),_0x41056e);if(_0x2a6796['query'][_0x7539('0x40')]){_0x17f44b[_0x7539('0x3d')]=_[_0x7539('0x41')](_0x17f44b[_0x7539('0x3d')],{'$or':_['map'](_0x41056e,function(_0x5ab037){if(_0x5ab037['type']!==_0x7539('0x42')){var _0x2a5cff={};_0x2a5cff[_0x5ab037[_0x7539('0x2b')]]={'$like':'%'+_0x2a6796[_0x7539('0x33')][_0x7539('0x40')]+'%'};return _0x2a5cff;}})});}_0x17f44b=_[_0x7539('0x41')]({},_0x17f44b,_0x2a6796['options']);var _0x2a1641={'where':_0x17f44b[_0x7539('0x3d')]};return db[_0x7539('0x2e')][_0x7539('0x1e')](_0x2a1641)['then'](function(_0x3c83d9){_0x107c8c[_0x7539('0x1e')]=_0x3c83d9;if(_0x2a6796[_0x7539('0x33')][_0x7539('0x43')]){_0x17f44b[_0x7539('0x44')]=[{'all':!![]}];}return db[_0x7539('0x2e')][_0x7539('0x45')](_0x17f44b);})[_0x7539('0x24')](function(_0x33626b){_0x107c8c[_0x7539('0x46')]=_0x33626b;return _0x107c8c;})[_0x7539('0x24')](respondWithFilteredResult(_0x4642a5,_0x17f44b))['catch'](handleError(_0x4642a5,null));};exports[_0x7539('0x47')]=function(_0x32f3c3,_0x5c42cc){var _0x5a4ad6={'raw':![],'where':{'id':_0x32f3c3[_0x7539('0x48')]['id']}},_0xd1c235={};_0xd1c235[_0x7539('0x32')]=_[_0x7539('0x49')](db[_0x7539('0x2e')]['rawAttributes']);_0xd1c235[_0x7539('0x33')]=_['keys'](_0x32f3c3[_0x7539('0x33')]);_0xd1c235[_0x7539('0x3e')]=_[_0x7539('0x34')](_0xd1c235[_0x7539('0x32')],_0xd1c235[_0x7539('0x33')]);_0x5a4ad6['attributes']=_[_0x7539('0x34')](_0xd1c235[_0x7539('0x32')],qs[_0x7539('0x36')](_0x32f3c3['query'][_0x7539('0x36')]));_0x5a4ad6['attributes']=_0x5a4ad6[_0x7539('0x35')]['length']?_0x5a4ad6[_0x7539('0x35')]:_0xd1c235[_0x7539('0x32')];if(_0x32f3c3['query'][_0x7539('0x43')]){_0x5a4ad6[_0x7539('0x44')]=[{'all':!![]}];}_0x5a4ad6=_[_0x7539('0x41')]({},_0x5a4ad6,_0x32f3c3[_0x7539('0x4a')]);return db['VoiceChanSpy'][_0x7539('0x4b')](_0x5a4ad6)[_0x7539('0x24')](handleEntityNotFound(_0x5c42cc,null))[_0x7539('0x24')](respondWithResult(_0x5c42cc,null))['catch'](handleError(_0x5c42cc,null));};exports['create']=function(_0x242c3b,_0xae67f0){return db[_0x7539('0x2e')][_0x7539('0x4c')](_0x242c3b[_0x7539('0x4d')],{})[_0x7539('0x24')](function(_0x43da85){var _0x3be204=_0x242c3b[_0x7539('0x4e')]['get']({'plain':!![]});if(!_0x3be204)throw new Error(_0x7539('0x4f'));if(_0x3be204['role']===_0x7539('0x4e')){var _0x47aee8=_0x43da85['get']({'plain':!![]});var _0x399b60='ChanSpies';return db[_0x7539('0x50')][_0x7539('0x4b')]({'where':{'name':_0x399b60,'userProfileId':_0x3be204['userProfileId']},'raw':!![]})[_0x7539('0x24')](function(_0x210712){if(_0x210712&&_0x210712[_0x7539('0x51')]===0x0){return db[_0x7539('0x52')][_0x7539('0x4c')]({'name':_0x47aee8[_0x7539('0x2b')],'resourceId':_0x47aee8['id'],'type':_0x210712['name'],'sectionId':_0x210712['id']},{})[_0x7539('0x24')](function(){return _0x43da85;});}else{return _0x43da85;}})['catch'](function(_0xed0db3){logger['error'](_0x7539('0x53'),_0xed0db3);throw _0xed0db3;});}return _0x43da85;})[_0x7539('0x24')](respondWithResult(_0xae67f0,0xc9))[_0x7539('0x54')](handleError(_0xae67f0,null));};exports[_0x7539('0x23')]=function(_0x58047c,_0x52afcd){if(_0x58047c[_0x7539('0x4d')]['id']){delete _0x58047c[_0x7539('0x4d')]['id'];}return db[_0x7539('0x2e')][_0x7539('0x4b')]({'where':{'id':_0x58047c['params']['id']}})[_0x7539('0x24')](handleEntityNotFound(_0x52afcd,null))[_0x7539('0x24')](saveUpdates(_0x58047c[_0x7539('0x4d')],null))[_0x7539('0x24')](respondWithResult(_0x52afcd,null))[_0x7539('0x54')](handleError(_0x52afcd,null));};exports[_0x7539('0x25')]=function(_0x3946ec,_0x347b0b){return db['VoiceChanSpy'][_0x7539('0x4b')]({'where':{'id':_0x3946ec[_0x7539('0x48')]['id']}})['then'](handleEntityNotFound(_0x347b0b,null))[_0x7539('0x24')](removeEntity(_0x347b0b,null))[_0x7539('0x54')](handleError(_0x347b0b,null));}; \ No newline at end of file +var _0x80fb=['rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceChanSpy','includeAll','findAll','rows','params','include','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x80fb,0x11e));var _0xb80f=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x80fb[_0x43d11d];return _0x38cd08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb80f('0x0'));var zipdir=require(_0xb80f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb80f('0x2'));var moment=require(_0xb80f('0x3'));var BPromise=require(_0xb80f('0x4'));var Mustache=require(_0xb80f('0x5'));var util=require(_0xb80f('0x6'));var path=require(_0xb80f('0x7'));var sox=require(_0xb80f('0x8'));var csv=require(_0xb80f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb80f('0xa'));var _=require(_0xb80f('0xb'));var squel=require(_0xb80f('0xc'));var crypto=require(_0xb80f('0xd'));var jsforce=require(_0xb80f('0xe'));var deskjs=require(_0xb80f('0xf'));var toCsv=require(_0xb80f('0x9'));var querystring=require(_0xb80f('0x10'));var Papa=require(_0xb80f('0x11'));var Redis=require(_0xb80f('0x12'));var authService=require(_0xb80f('0x13'));var qs=require(_0xb80f('0x14'));var as=require(_0xb80f('0x15'));var hardwareService=require(_0xb80f('0x16'));var logger=require(_0xb80f('0x17'))(_0xb80f('0x18'));var utils=require('../../config/utils');var config=require(_0xb80f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb80f('0x1a'))['db'];function respondWithStatusCode(_0x391a0b,_0x13b5f4){_0x13b5f4=_0x13b5f4||0xcc;return function(_0x30e0c8){if(_0x30e0c8){return _0x391a0b[_0xb80f('0x1b')](_0x13b5f4);}return _0x391a0b[_0xb80f('0x1c')](_0x13b5f4)[_0xb80f('0x1d')]();};}function respondWithResult(_0x369fbe,_0x4686de){_0x4686de=_0x4686de||0xc8;return function(_0x205523){if(_0x205523){return _0x369fbe[_0xb80f('0x1c')](_0x4686de)[_0xb80f('0x1e')](_0x205523);}};}function respondWithFilteredResult(_0x40f815,_0x2af09b){return function(_0x30a126){if(_0x30a126){var _0x59cc1b=typeof _0x2af09b[_0xb80f('0x1f')]===_0xb80f('0x20')&&typeof _0x2af09b['limit']==='undefined';var _0x2fc77e=_0x30a126[_0xb80f('0x21')];var _0x6e017c=_0x59cc1b?0x0:_0x2af09b[_0xb80f('0x1f')];var _0x267f79=_0x59cc1b?_0x30a126[_0xb80f('0x21')]:_0x2af09b['offset']+_0x2af09b[_0xb80f('0x22')];var _0x361a0e;if(_0x267f79>=_0x2fc77e){_0x267f79=_0x2fc77e;_0x361a0e=0xc8;}else{_0x361a0e=0xce;}_0x40f815[_0xb80f('0x1c')](_0x361a0e);return _0x40f815[_0xb80f('0x23')](_0xb80f('0x24'),_0x6e017c+'-'+_0x267f79+'/'+_0x2fc77e)[_0xb80f('0x1e')](_0x30a126);}return null;};}function patchUpdates(_0x2d6550){return function(_0x3ad8a6){try{jsonpatch[_0xb80f('0x25')](_0x3ad8a6,_0x2d6550,!![]);}catch(_0x39a580){return BPromise[_0xb80f('0x26')](_0x39a580);}return _0x3ad8a6['save']();};}function saveUpdates(_0x2ad259,_0x5c6120){return function(_0x713bad){if(_0x713bad){return _0x713bad[_0xb80f('0x27')](_0x2ad259)['then'](function(_0x38a6cc){return _0x38a6cc;});}return null;};}function removeEntity(_0x2a9749,_0x4e46fa){return function(_0x52a032){if(_0x52a032){return _0x52a032[_0xb80f('0x28')]()[_0xb80f('0x29')](function(){var _0x1795e6=_0x52a032['get']({'plain':!![]});var _0x206209='ChanSpies';return db['UserProfileResource'][_0xb80f('0x28')]({'where':{'type':_0x206209,'resourceId':_0x1795e6['id']}})[_0xb80f('0x29')](function(){return _0x52a032;});})[_0xb80f('0x29')](function(){_0x2a9749[_0xb80f('0x1c')](0xcc)[_0xb80f('0x1d')]();});}};}function handleEntityNotFound(_0x3c2c38,_0x1c9139){return function(_0xbffa6e){if(!_0xbffa6e){_0x3c2c38['sendStatus'](0x194);}return _0xbffa6e;};}function handleError(_0x56551d,_0x4c962b){_0x4c962b=_0x4c962b||0x1f4;return function(_0x505da2){logger[_0xb80f('0x2a')](_0x505da2[_0xb80f('0x2b')]);if(_0x505da2[_0xb80f('0x2c')]){delete _0x505da2[_0xb80f('0x2c')];}_0x56551d[_0xb80f('0x1c')](_0x4c962b)[_0xb80f('0x2d')](_0x505da2);};}exports['index']=function(_0x12bf45,_0x6f119e){var _0x5c0846={},_0x1be34a={},_0x563524={'count':0x0,'rows':[]};var _0x26026a=_['map'](db['VoiceChanSpy'][_0xb80f('0x2e')],function(_0x56bd6b){return{'name':_0x56bd6b[_0xb80f('0x2f')],'type':_0x56bd6b[_0xb80f('0x30')]['key']};});_0x1be34a['model']=_[_0xb80f('0x31')](_0x26026a,_0xb80f('0x2c'));_0x1be34a['query']=_[_0xb80f('0x32')](_0x12bf45[_0xb80f('0x33')]);_0x1be34a[_0xb80f('0x34')]=_[_0xb80f('0x35')](_0x1be34a[_0xb80f('0x36')],_0x1be34a['query']);_0x5c0846[_0xb80f('0x37')]=_[_0xb80f('0x35')](_0x1be34a['model'],qs[_0xb80f('0x38')](_0x12bf45[_0xb80f('0x33')][_0xb80f('0x38')]));_0x5c0846['attributes']=_0x5c0846[_0xb80f('0x37')]['length']?_0x5c0846[_0xb80f('0x37')]:_0x1be34a['model'];if(!_0x12bf45[_0xb80f('0x33')]['hasOwnProperty'](_0xb80f('0x39'))){_0x5c0846[_0xb80f('0x22')]=qs[_0xb80f('0x22')](_0x12bf45[_0xb80f('0x33')]['limit']);_0x5c0846[_0xb80f('0x1f')]=qs[_0xb80f('0x1f')](_0x12bf45[_0xb80f('0x33')][_0xb80f('0x1f')]);}_0x5c0846[_0xb80f('0x3a')]=qs[_0xb80f('0x3b')](_0x12bf45[_0xb80f('0x33')][_0xb80f('0x3b')]);_0x5c0846['where']=qs[_0xb80f('0x34')](_[_0xb80f('0x3c')](_0x12bf45[_0xb80f('0x33')],_0x1be34a[_0xb80f('0x34')]),_0x26026a);if(_0x12bf45[_0xb80f('0x33')][_0xb80f('0x3d')]){_0x5c0846[_0xb80f('0x3e')]=_[_0xb80f('0x3f')](_0x5c0846['where'],{'$or':_['map'](_0x26026a,function(_0x2b7f85){if(_0x2b7f85[_0xb80f('0x30')]!==_0xb80f('0x40')){var _0x244a23={};_0x244a23[_0x2b7f85['name']]={'$like':'%'+_0x12bf45['query'][_0xb80f('0x3d')]+'%'};return _0x244a23;}})});}_0x5c0846=_['merge']({},_0x5c0846,_0x12bf45[_0xb80f('0x41')]);var _0x2c20ce={'where':_0x5c0846[_0xb80f('0x3e')]};return db[_0xb80f('0x42')][_0xb80f('0x21')](_0x2c20ce)[_0xb80f('0x29')](function(_0x137796){_0x563524[_0xb80f('0x21')]=_0x137796;if(_0x12bf45[_0xb80f('0x33')][_0xb80f('0x43')]){_0x5c0846['include']=[{'all':!![]}];}return db[_0xb80f('0x42')][_0xb80f('0x44')](_0x5c0846);})[_0xb80f('0x29')](function(_0x2cb571){_0x563524[_0xb80f('0x45')]=_0x2cb571;return _0x563524;})['then'](respondWithFilteredResult(_0x6f119e,_0x5c0846))['catch'](handleError(_0x6f119e,null));};exports['show']=function(_0x58b1f1,_0x1a8712){var _0x138641={'raw':![],'where':{'id':_0x58b1f1[_0xb80f('0x46')]['id']}},_0x363db4={};_0x363db4[_0xb80f('0x36')]=_[_0xb80f('0x32')](db[_0xb80f('0x42')][_0xb80f('0x2e')]);_0x363db4['query']=_['keys'](_0x58b1f1['query']);_0x363db4[_0xb80f('0x34')]=_['intersection'](_0x363db4[_0xb80f('0x36')],_0x363db4[_0xb80f('0x33')]);_0x138641[_0xb80f('0x37')]=_[_0xb80f('0x35')](_0x363db4['model'],qs[_0xb80f('0x38')](_0x58b1f1['query'][_0xb80f('0x38')]));_0x138641[_0xb80f('0x37')]=_0x138641['attributes']['length']?_0x138641[_0xb80f('0x37')]:_0x363db4[_0xb80f('0x36')];if(_0x58b1f1[_0xb80f('0x33')][_0xb80f('0x43')]){_0x138641[_0xb80f('0x47')]=[{'all':!![]}];}_0x138641=_['merge']({},_0x138641,_0x58b1f1[_0xb80f('0x41')]);return db['VoiceChanSpy'][_0xb80f('0x48')](_0x138641)[_0xb80f('0x29')](handleEntityNotFound(_0x1a8712,null))[_0xb80f('0x29')](respondWithResult(_0x1a8712,null))[_0xb80f('0x49')](handleError(_0x1a8712,null));};exports[_0xb80f('0x4a')]=function(_0x151345,_0x22f350){return db[_0xb80f('0x42')][_0xb80f('0x4a')](_0x151345['body'],{})[_0xb80f('0x29')](function(_0x31a37d){var _0x5d412f=_0x151345['user'][_0xb80f('0x4b')]({'plain':!![]});if(!_0x5d412f)throw new Error(_0xb80f('0x4c'));if(_0x5d412f[_0xb80f('0x4d')]===_0xb80f('0x4e')){var _0x5ae0bb=_0x31a37d[_0xb80f('0x4b')]({'plain':!![]});var _0x19e2a9='ChanSpies';return db[_0xb80f('0x4f')]['find']({'where':{'name':_0x19e2a9,'userProfileId':_0x5d412f[_0xb80f('0x50')]},'raw':!![]})[_0xb80f('0x29')](function(_0x3b1ce7){if(_0x3b1ce7&&_0x3b1ce7['autoAssociation']===0x0){return db['UserProfileResource'][_0xb80f('0x4a')]({'name':_0x5ae0bb[_0xb80f('0x2c')],'resourceId':_0x5ae0bb['id'],'type':_0x3b1ce7[_0xb80f('0x2c')],'sectionId':_0x3b1ce7['id']},{})[_0xb80f('0x29')](function(){return _0x31a37d;});}else{return _0x31a37d;}})['catch'](function(_0x1466b2){logger[_0xb80f('0x2a')](_0xb80f('0x51'),_0x1466b2);throw _0x1466b2;});}return _0x31a37d;})[_0xb80f('0x29')](respondWithResult(_0x22f350,0xc9))[_0xb80f('0x49')](handleError(_0x22f350,null));};exports['update']=function(_0x119114,_0x57a2f3){if(_0x119114['body']['id']){delete _0x119114[_0xb80f('0x52')]['id'];}return db['VoiceChanSpy'][_0xb80f('0x48')]({'where':{'id':_0x119114[_0xb80f('0x46')]['id']}})[_0xb80f('0x29')](handleEntityNotFound(_0x57a2f3,null))[_0xb80f('0x29')](saveUpdates(_0x119114[_0xb80f('0x52')],null))[_0xb80f('0x29')](respondWithResult(_0x57a2f3,null))[_0xb80f('0x49')](handleError(_0x57a2f3,null));};exports[_0xb80f('0x28')]=function(_0x1a3fe4,_0x5553c9){return db[_0xb80f('0x42')]['find']({'where':{'id':_0x1a3fe4['params']['id']}})['then'](handleEntityNotFound(_0x5553c9,null))['then'](removeEntity(_0x5553c9,null))[_0xb80f('0x49')](handleError(_0x5553c9,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 548d0f1..a099804 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 _0x256a=['User','findAll','agent','then','catch','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','Authenticate','ChanSpy','name','options','join','StopMixMonitor','length','concat','internal'];(function(_0x370db2,_0x28e84d){var _0x54d7cd=function(_0x253b41){while(--_0x253b41){_0x370db2['push'](_0x370db2['shift']());}};_0x54d7cd(++_0x28e84d);}(_0x256a,0x1c9));var _0xa256=function(_0x57c924,_0x2282d8){_0x57c924=_0x57c924-0x0;var _0x17edae=_0x256a[_0x57c924];return _0x17edae;};'use strict';var _=require(_0xa256('0x0'));var util=require(_0xa256('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x2e5b8,_0x15c5d0,_0x1516e4){var _0x302ed1=0x1;var _0x5285f9=[];var _0x120bec={'context':_0x15c5d0['context']||_0xa256('0x2'),'exten':util[_0xa256('0x3')](_0xa256('0x4'),_0x2e5b8[_0xa256('0x5')],_0x1516e4),'type':_0xa256('0x6'),'isApp':![],'ChanSpyId':_0x2e5b8['id'],'UserId':_0x15c5d0['id']};_0x5285f9[_0xa256('0x7')](_[_0xa256('0x8')]({'app':_0xa256('0x9'),'appdata':util[_0xa256('0x3')](_0xa256('0xa'),'chanspy'),'priority':_0x302ed1++},_0x120bec));if(_0x2e5b8[_0xa256('0xb')]){_0x5285f9[_0xa256('0x7')](_[_0xa256('0x8')]({'app':_0xa256('0xc'),'appdata':util[_0xa256('0x3')](_0xa256('0xd'),_0x2e5b8['recordingFormat']),'priority':_0x302ed1++},_0x120bec));}if(_0x2e5b8['auth']){_0x5285f9[_0xa256('0x7')](_[_0xa256('0x8')]({'app':_0xa256('0xe'),'appdata':_0x2e5b8['password'],'priority':_0x302ed1++},_0x120bec));}_0x5285f9['push'](_[_0xa256('0x8')]({'app':_0xa256('0xf'),'appdata':util[_0xa256('0x3')]('SIP/%s,%s',_0x15c5d0[_0xa256('0x10')],_0x2e5b8[_0xa256('0x11')]?_0x2e5b8[_0xa256('0x11')][_0xa256('0x12')](''):''),'priority':_0x302ed1++},_0x120bec));if(_0x2e5b8[_0xa256('0xb')]){_0x5285f9['push'](_['merge']({'app':_0xa256('0x13'),'priority':_0x302ed1++},_0x120bec));}return _0x5285f9;};var getChanSpyApplications=function(_0x3c6ac5,_0x51a8e8){var _0x2d0f1a=[];for(var _0x5805f0=0x0,_0x19680c=0x1;_0x5805f0<_0x51a8e8[_0xa256('0x14')];_0x5805f0++,_0x19680c=0x1){_0x2d0f1a=_0x2d0f1a[_0xa256('0x15')](getUserApplications(_0x3c6ac5,_0x51a8e8[_0x5805f0],_0x51a8e8[_0x5805f0][_0xa256('0x16')]));if(_0x51a8e8[_0x5805f0][_0xa256('0x16')]!=_0x51a8e8[_0x5805f0][_0xa256('0x10')]){_0x2d0f1a=_0x2d0f1a[_0xa256('0x15')](getUserApplications(_0x3c6ac5,_0x51a8e8[_0x5805f0],_0x51a8e8[_0x5805f0][_0xa256('0x10')]));}}return _0x2d0f1a;};var getChanSpyPromise=function(_0x1778a7,_0x909588){return new BPromise(function(_0x4f536c,_0x302c84){return _0x1778a7[_0xa256('0x17')][_0xa256('0x18')]({'attributes':['id',_0xa256('0x10'),_0xa256('0x16')],'where':{'role':_0xa256('0x19'),'chanspy':!![]},'raw':!![]})[_0xa256('0x1a')](function(_0x4c1ced){if(_0x4c1ced){return _0x4f536c(getChanSpyApplications(_0x909588,_0x4c1ced));}return _0x4f536c([]);})[_0xa256('0x1b')](function(_0x42c93d){_0x302c84(_0x42c93d);});});};module['exports']=function(_0x429dfc,_0x5a82c8){var _0x27478f=_0x429dfc['models'];return _0x429dfc['define']('VoiceChanSpy',attributes,{'tableName':_0xa256('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x980491,_0x102458,_0x46c5fb){return getChanSpyPromise(_0x27478f,_0x980491)[_0xa256('0x1a')](function(_0x202b82){if(_0x202b82&&_0x202b82[_0xa256('0x14')]){return _0x27478f[_0xa256('0x1d')][_0xa256('0x1e')](_0x202b82);}})[_0xa256('0x1a')](function(){_0x46c5fb();})[_0xa256('0x1b')](function(_0x227e26){_0x46c5fb(_0x227e26);});},'afterUpdate':function(_0x5ee0bc,_0x4c0995,_0x68ea48){return _0x27478f[_0xa256('0x1d')][_0xa256('0x1f')]({'where':{'ChanSpyId':_0x5ee0bc['id']}})[_0xa256('0x1a')](function(){return getChanSpyPromise(_0x27478f,_0x5ee0bc);})[_0xa256('0x1a')](function(_0x5be5ce){if(_0x5be5ce&&_0x5be5ce[_0xa256('0x14')]){return _0x27478f[_0xa256('0x1d')][_0xa256('0x1e')](_0x5be5ce);}})['then'](function(){_0x68ea48();})[_0xa256('0x1b')](function(_0x3864b5){_0x68ea48(_0x3864b5);});},'afterDestroy':function(_0x5c93d6,_0x9e38de,_0x1fdd3e){return _0x27478f[_0xa256('0x1d')][_0xa256('0x1f')]({'where':{'ChanSpyId':_0x5c93d6['id']}})[_0xa256('0x1a')](function(){_0x1fdd3e();})['catch'](function(_0x360a8f){_0x1fdd3e(_0x360a8f);});}}});}; \ No newline at end of file +var _0xdb6f=['CDR(type)=%s','chanspy','record','MixMonitor','format','recordingFormat','Authenticate','password','SIP/%s,%s','StopMixMonitor','concat','internal','name','User','findAll','then','catch','exports','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','%s%s','system','push','merge','Set'];(function(_0x30f9af,_0x195046){var _0x8387aa=function(_0x3b9159){while(--_0x3b9159){_0x30f9af['push'](_0x30f9af['shift']());}};_0x8387aa(++_0x195046);}(_0xdb6f,0x177));var _0xfdb6=function(_0x34528e,_0x482db5){_0x34528e=_0x34528e-0x0;var _0x2b4f16=_0xdb6f[_0x34528e];return _0x2b4f16;};'use strict';var _=require(_0xfdb6('0x0'));var util=require(_0xfdb6('0x1'));var BPromise=require(_0xfdb6('0x2'));var attributes=require(_0xfdb6('0x3'));var getUserApplications=function(_0x2c9756,_0x519340,_0x1a8820){var _0x390982=0x1;var _0x4e5546=[];var _0xe71832={'context':_0x519340[_0xfdb6('0x4')]||'from-sip','exten':util['format'](_0xfdb6('0x5'),_0x2c9756['prefix'],_0x1a8820),'type':_0xfdb6('0x6'),'isApp':![],'ChanSpyId':_0x2c9756['id'],'UserId':_0x519340['id']};_0x4e5546[_0xfdb6('0x7')](_[_0xfdb6('0x8')]({'app':_0xfdb6('0x9'),'appdata':util['format'](_0xfdb6('0xa'),_0xfdb6('0xb')),'priority':_0x390982++},_0xe71832));if(_0x2c9756[_0xfdb6('0xc')]){_0x4e5546['push'](_['merge']({'app':_0xfdb6('0xd'),'appdata':util[_0xfdb6('0xe')]('${UNIQUEID}.%s,a',_0x2c9756[_0xfdb6('0xf')]),'priority':_0x390982++},_0xe71832));}if(_0x2c9756['auth']){_0x4e5546[_0xfdb6('0x7')](_[_0xfdb6('0x8')]({'app':_0xfdb6('0x10'),'appdata':_0x2c9756[_0xfdb6('0x11')],'priority':_0x390982++},_0xe71832));}_0x4e5546[_0xfdb6('0x7')](_[_0xfdb6('0x8')]({'app':'ChanSpy','appdata':util[_0xfdb6('0xe')](_0xfdb6('0x12'),_0x519340['name'],_0x2c9756['options']?_0x2c9756['options']['join'](''):''),'priority':_0x390982++},_0xe71832));if(_0x2c9756[_0xfdb6('0xc')]){_0x4e5546[_0xfdb6('0x7')](_[_0xfdb6('0x8')]({'app':_0xfdb6('0x13'),'priority':_0x390982++},_0xe71832));}return _0x4e5546;};var getChanSpyApplications=function(_0x37f99b,_0x3e52f0){var _0x5a4775=[];for(var _0x5a8c0f=0x0,_0x32c715=0x1;_0x5a8c0f<_0x3e52f0['length'];_0x5a8c0f++,_0x32c715=0x1){_0x5a4775=_0x5a4775[_0xfdb6('0x14')](getUserApplications(_0x37f99b,_0x3e52f0[_0x5a8c0f],_0x3e52f0[_0x5a8c0f][_0xfdb6('0x15')]));if(_0x3e52f0[_0x5a8c0f][_0xfdb6('0x15')]!=_0x3e52f0[_0x5a8c0f][_0xfdb6('0x16')]){_0x5a4775=_0x5a4775['concat'](getUserApplications(_0x37f99b,_0x3e52f0[_0x5a8c0f],_0x3e52f0[_0x5a8c0f][_0xfdb6('0x16')]));}}return _0x5a4775;};var getChanSpyPromise=function(_0x5e7653,_0x1b7a64){return new BPromise(function(_0x50bac7,_0x2333d7){return _0x5e7653[_0xfdb6('0x17')][_0xfdb6('0x18')]({'attributes':['id',_0xfdb6('0x16'),_0xfdb6('0x15')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xfdb6('0x19')](function(_0xa1a92d){if(_0xa1a92d){return _0x50bac7(getChanSpyApplications(_0x1b7a64,_0xa1a92d));}return _0x50bac7([]);})[_0xfdb6('0x1a')](function(_0x122fdf){_0x2333d7(_0x122fdf);});});};module[_0xfdb6('0x1b')]=function(_0x2a686a,_0x20fe44){var _0x338f9c=_0x2a686a[_0xfdb6('0x1c')];return _0x2a686a['define'](_0xfdb6('0x1d'),attributes,{'tableName':_0xfdb6('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf2da9d,_0x18dcb5,_0x61a16a){return getChanSpyPromise(_0x338f9c,_0xf2da9d)[_0xfdb6('0x19')](function(_0x533189){if(_0x533189&&_0x533189[_0xfdb6('0x1f')]){return _0x338f9c[_0xfdb6('0x20')][_0xfdb6('0x21')](_0x533189);}})[_0xfdb6('0x19')](function(){_0x61a16a();})[_0xfdb6('0x1a')](function(_0x575519){_0x61a16a(_0x575519);});},'afterUpdate':function(_0x327033,_0x31d428,_0x44f4f3){return _0x338f9c['VoiceExtension'][_0xfdb6('0x22')]({'where':{'ChanSpyId':_0x327033['id']}})[_0xfdb6('0x19')](function(){return getChanSpyPromise(_0x338f9c,_0x327033);})['then'](function(_0x3afe64){if(_0x3afe64&&_0x3afe64[_0xfdb6('0x1f')]){return _0x338f9c['VoiceExtension'][_0xfdb6('0x21')](_0x3afe64);}})[_0xfdb6('0x19')](function(){_0x44f4f3();})[_0xfdb6('0x1a')](function(_0x31b761){_0x44f4f3(_0x31b761);});},'afterDestroy':function(_0x45e02b,_0x226567,_0x3108b9){return _0x338f9c[_0xfdb6('0x20')][_0xfdb6('0x22')]({'where':{'ChanSpyId':_0x45e02b['id']}})['then'](function(){_0x3108b9();})[_0xfdb6('0x1a')](function(_0x3855a2){_0x3108b9(_0x3855a2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index c85600e..91c6095 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 _0x8ce3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0x8de42,_0x29282e){var _0x2ed5f1=function(_0x237b02){while(--_0x237b02){_0x8de42['push'](_0x8de42['shift']());}};_0x2ed5f1(++_0x29282e);}(_0x8ce3,0xc3));var _0x38ce=function(_0x42e988,_0xd8abe0){_0x42e988=_0x42e988-0x0;var _0x5ce1fb=_0x8ce3[_0x42e988];return _0x5ce1fb;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var moment=require('moment');var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));var config=require(_0x38ce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38ce('0xa')][_0x38ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58074c,_0x262b13,_0xbe7332){return new BPromise(function(_0x3f8011,_0x482955){return client[_0x38ce('0xc')](_0x58074c,_0xbe7332)['then'](function(_0x725d27){logger['info'](_0x38ce('0xd'),_0x262b13,_0x38ce('0xe'));logger[_0x38ce('0xf')](_0x38ce('0x10'),_0x262b13,_0x38ce('0xe'),JSON[_0x38ce('0x11')](_0x725d27));if(_0x725d27[_0x38ce('0x12')]){if(_0x725d27[_0x38ce('0x12')][_0x38ce('0x13')]===0x1f4){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);return _0x482955(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}logger[_0x38ce('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x262b13,_0x725d27['error'][_0x38ce('0x14')]);return _0x3f8011(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}else{logger['info'](_0x38ce('0xd'),_0x262b13,'request\x20sent');_0x3f8011(_0x725d27[_0x38ce('0x15')][_0x38ce('0x14')]);}})['catch'](function(_0x5fc115){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x5fc115);_0x482955(_0x5fc115);});});} \ No newline at end of file +var _0xb58b=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x5c2ef8,_0xfa0926){var _0x2f205f=function(_0x4ded3a){while(--_0x4ded3a){_0x5c2ef8['push'](_0x5c2ef8['shift']());}};_0x2f205f(++_0xfa0926);}(_0xb58b,0x1f1));var _0xbb58=function(_0x5b3186,_0x102818){_0x5b3186=_0x5b3186-0x0;var _0x364de9=_0xb58b[_0x5b3186];return _0x364de9;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c60096f..db743c7 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 _0xe006=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceContext.controller','index','get','isAuthenticated','show','post'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0xe006,0x7e));var _0x6e00=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xe006[_0x1b3564];return _0x504069;};'use strict';var multer=require(_0x6e00('0x0'));var util=require(_0x6e00('0x1'));var path=require(_0x6e00('0x2'));var timeout=require(_0x6e00('0x3'));var express=require(_0x6e00('0x4'));var router=express[_0x6e00('0x5')]();var fs_extra=require(_0x6e00('0x6'));var auth=require(_0x6e00('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6e00('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e00('0x9')]);router[_0x6e00('0xa')]('/:id',auth[_0x6e00('0xb')](),controller[_0x6e00('0xc')]);router[_0x6e00('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6e00('0xe')](_0x6e00('0xf'),auth['isAuthenticated'](),controller[_0x6e00('0x10')]);router[_0x6e00('0x11')](_0x6e00('0xf'),auth[_0x6e00('0xb')](),controller[_0x6e00('0x12')]);module[_0x6e00('0x13')]=router; \ No newline at end of file +var _0x4ae8=['/:id','show','create','put','update','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index'];(function(_0x1011dd,_0xa51bac){var _0x57e2a8=function(_0x39c2e6){while(--_0x39c2e6){_0x1011dd['push'](_0x1011dd['shift']());}};_0x57e2a8(++_0xa51bac);}(_0x4ae8,0x7d));var _0x84ae=function(_0x9188ce,_0x3d621d){_0x9188ce=_0x9188ce-0x0;var _0x286bbd=_0x4ae8[_0x9188ce];return _0x286bbd;};'use strict';var multer=require('multer');var util=require(_0x84ae('0x0'));var path=require(_0x84ae('0x1'));var timeout=require(_0x84ae('0x2'));var express=require(_0x84ae('0x3'));var router=express['Router']();var fs_extra=require(_0x84ae('0x4'));var auth=require(_0x84ae('0x5'));var interaction=require(_0x84ae('0x6'));var config=require('../../config/environment');var controller=require(_0x84ae('0x7'));router[_0x84ae('0x8')]('/',auth[_0x84ae('0x9')](),controller[_0x84ae('0xa')]);router['get'](_0x84ae('0xb'),auth[_0x84ae('0x9')](),controller[_0x84ae('0xc')]);router['post']('/',auth[_0x84ae('0x9')](),controller[_0x84ae('0xd')]);router[_0x84ae('0xe')]('/:id',auth[_0x84ae('0x9')](),controller[_0x84ae('0xf')]);router[_0x84ae('0x10')](_0x84ae('0xb'),auth[_0x84ae('0x9')](),controller['destroy']);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 11fb2ae..a3c7323 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 _0x0d6d=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x1b9b05,_0x1de0dc){var _0x222e02=function(_0x4842ef){while(--_0x4842ef){_0x1b9b05['push'](_0x1b9b05['shift']());}};_0x222e02(++_0x1de0dc);}(_0x0d6d,0x165));var _0xd0d6=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x0d6d[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0xd0d6('0x0'));module[_0xd0d6('0x1')]={'name':{'type':Sequelize[_0xd0d6('0x2')],'unique':_0xd0d6('0x3')},'description':{'type':Sequelize[_0xd0d6('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd0d6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x799f=['STRING','name','exports'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x799f,0x18b));var _0xf799=function(_0x3a21f4,_0x2f8521){_0x3a21f4=_0x3a21f4-0x0;var _0x46d4b6=_0x799f[_0x3a21f4];return _0x46d4b6;};'use strict';var Sequelize=require('sequelize');module[_0xf799('0x0')]={'name':{'type':Sequelize[_0xf799('0x1')],'unique':_0xf799('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index feaa110..1137cfe 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 _0x8454=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','Contexts','destroy','sendStatus','stack','name','send','index','map','VoiceContext','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','chan_sip.so','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x8454,0x18a));var _0x4845=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8454[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x4845('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4845('0x1'));var jsonpatch=require(_0x4845('0x2'));var rp=require(_0x4845('0x3'));var moment=require(_0x4845('0x4'));var BPromise=require(_0x4845('0x5'));var Mustache=require(_0x4845('0x6'));var util=require(_0x4845('0x7'));var path=require(_0x4845('0x8'));var sox=require(_0x4845('0x9'));var csv=require(_0x4845('0xa'));var ejs=require(_0x4845('0xb'));var fs=require('fs');var fs_extra=require(_0x4845('0xc'));var _=require(_0x4845('0xd'));var squel=require(_0x4845('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4845('0xa'));var querystring=require(_0x4845('0xf'));var Papa=require('papaparse');var Redis=require(_0x4845('0x10'));var authService=require(_0x4845('0x11'));var qs=require(_0x4845('0x12'));var as=require(_0x4845('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4845('0x14'))(_0x4845('0x15'));var utils=require(_0x4845('0x16'));var config=require(_0x4845('0x17'));var licenseUtil=require(_0x4845('0x18'));var db=require(_0x4845('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x4845('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4d27ba,_0x4c974e,_0xd4272f,_0x56142e){return new BPromise(function(_0x36d9d1,_0x3065e9){var _0x5b4b1b=_0x56142e||client;return _0x5b4b1b[_0x4845('0x1b')](_0x4d27ba,_0xd4272f)[_0x4845('0x1c')](function(_0x1d852c){logger[_0x4845('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x4c974e,_0x4845('0x1e'));logger[_0x4845('0x1f')](_0x4845('0x20'),_0x4c974e,_0x4845('0x1e'),JSON[_0x4845('0x21')](_0x1d852c));if(_0x1d852c[_0x4845('0x22')]){if(_0x1d852c[_0x4845('0x22')]['code']===0x1f4){logger[_0x4845('0x22')]('VoiceContext,\x20%s,\x20%s',_0x4c974e,_0x1d852c[_0x4845('0x22')]['message']);return _0x3065e9(_0x1d852c[_0x4845('0x22')][_0x4845('0x23')]);}logger[_0x4845('0x22')](_0x4845('0x24'),_0x4c974e,_0x1d852c[_0x4845('0x22')][_0x4845('0x23')]);return _0x36d9d1(_0x1d852c[_0x4845('0x22')][_0x4845('0x23')]);}else{logger[_0x4845('0x1d')](_0x4845('0x24'),_0x4c974e,_0x4845('0x1e'));_0x36d9d1(_0x1d852c['result']['message']);}})[_0x4845('0x25')](function(_0x201eb2){logger[_0x4845('0x22')](_0x4845('0x24'),_0x4c974e,_0x201eb2);_0x3065e9(_0x201eb2);});});}function respondWithStatusCode(_0x44bc7f,_0x41de56){_0x41de56=_0x41de56||0xcc;return function(_0x273009){if(_0x273009){return _0x44bc7f['sendStatus'](_0x41de56);}return _0x44bc7f['status'](_0x41de56)[_0x4845('0x26')]();};}function respondWithResult(_0x4a30ee,_0x437703){_0x437703=_0x437703||0xc8;return function(_0x2b29a2){if(_0x2b29a2){return _0x4a30ee[_0x4845('0x27')](_0x437703)[_0x4845('0x28')](_0x2b29a2);}};}function respondWithFilteredResult(_0x5bd42c,_0x5216e9){return function(_0x315e36){if(_0x315e36){var _0x3eefbd=typeof _0x5216e9[_0x4845('0x29')]===_0x4845('0x2a')&&typeof _0x5216e9['limit']===_0x4845('0x2a');var _0x2ced84=_0x315e36[_0x4845('0x2b')];var _0x1a9a02=_0x3eefbd?0x0:_0x5216e9[_0x4845('0x29')];var _0x4e8d39=_0x3eefbd?_0x315e36[_0x4845('0x2b')]:_0x5216e9['offset']+_0x5216e9[_0x4845('0x2c')];var _0x584c1d;if(_0x4e8d39>=_0x2ced84){_0x4e8d39=_0x2ced84;_0x584c1d=0xc8;}else{_0x584c1d=0xce;}_0x5bd42c[_0x4845('0x27')](_0x584c1d);return _0x5bd42c[_0x4845('0x2d')](_0x4845('0x2e'),_0x1a9a02+'-'+_0x4e8d39+'/'+_0x2ced84)[_0x4845('0x28')](_0x315e36);}return null;};}function patchUpdates(_0x550abb){return function(_0x46ae1b){try{jsonpatch[_0x4845('0x2f')](_0x46ae1b,_0x550abb,!![]);}catch(_0x2f3a01){return BPromise['reject'](_0x2f3a01);}return _0x46ae1b[_0x4845('0x30')]();};}function saveUpdates(_0x206e7b,_0x2b59cf){return function(_0x4ed1f7){if(_0x4ed1f7){return _0x4ed1f7[_0x4845('0x31')](_0x206e7b)['then'](function(_0xb0d15b){return _0xb0d15b;});}return null;};}function removeEntity(_0x225ad0,_0x18cbe5){return function(_0x457502){if(_0x457502){return _0x457502['destroy']()[_0x4845('0x1c')](function(){var _0x5aa6cc=_0x457502['get']({'plain':!![]});var _0x56d552=_0x4845('0x32');return db['UserProfileResource'][_0x4845('0x33')]({'where':{'type':_0x56d552,'resourceId':_0x5aa6cc['id']}})[_0x4845('0x1c')](function(){return _0x457502;});})[_0x4845('0x1c')](function(){_0x225ad0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ffac3,_0x4c5400){return function(_0x39eaa2){if(!_0x39eaa2){_0x1ffac3[_0x4845('0x34')](0x194);}return _0x39eaa2;};}function handleError(_0x1ca932,_0x4a1c88){_0x4a1c88=_0x4a1c88||0x1f4;return function(_0x3388cd){logger[_0x4845('0x22')](_0x3388cd[_0x4845('0x35')]);if(_0x3388cd[_0x4845('0x36')]){delete _0x3388cd['name'];}_0x1ca932[_0x4845('0x27')](_0x4a1c88)[_0x4845('0x37')](_0x3388cd);};}exports[_0x4845('0x38')]=function(_0x14a23d,_0x2bed05){var _0x9a3d99={},_0x4bff50={},_0x2cfeb2={'count':0x0,'rows':[]};var _0x3a4534=_[_0x4845('0x39')](db[_0x4845('0x3a')]['rawAttributes'],function(_0x3d1b99){return{'name':_0x3d1b99['fieldName'],'type':_0x3d1b99['type'][_0x4845('0x3b')]};});_0x4bff50[_0x4845('0x3c')]=_[_0x4845('0x39')](_0x3a4534,_0x4845('0x36'));_0x4bff50['query']=_['keys'](_0x14a23d[_0x4845('0x3d')]);_0x4bff50[_0x4845('0x3e')]=_[_0x4845('0x3f')](_0x4bff50['model'],_0x4bff50['query']);_0x9a3d99[_0x4845('0x40')]=_[_0x4845('0x3f')](_0x4bff50[_0x4845('0x3c')],qs[_0x4845('0x41')](_0x14a23d[_0x4845('0x3d')]['fields']));_0x9a3d99[_0x4845('0x40')]=_0x9a3d99[_0x4845('0x40')][_0x4845('0x42')]?_0x9a3d99['attributes']:_0x4bff50[_0x4845('0x3c')];if(!_0x14a23d[_0x4845('0x3d')][_0x4845('0x43')](_0x4845('0x44'))){_0x9a3d99['limit']=qs[_0x4845('0x2c')](_0x14a23d[_0x4845('0x3d')][_0x4845('0x2c')]);_0x9a3d99[_0x4845('0x29')]=qs[_0x4845('0x29')](_0x14a23d['query'][_0x4845('0x29')]);}_0x9a3d99[_0x4845('0x45')]=qs[_0x4845('0x46')](_0x14a23d[_0x4845('0x3d')][_0x4845('0x46')]);_0x9a3d99[_0x4845('0x47')]=qs[_0x4845('0x3e')](_[_0x4845('0x48')](_0x14a23d['query'],_0x4bff50['filters']),_0x3a4534);if(_0x14a23d[_0x4845('0x3d')][_0x4845('0x49')]){_0x9a3d99[_0x4845('0x47')]=_['merge'](_0x9a3d99[_0x4845('0x47')],{'$or':_['map'](_0x3a4534,function(_0x242c09){if(_0x242c09[_0x4845('0x4a')]!==_0x4845('0x4b')){var _0x25b143={};_0x25b143[_0x242c09[_0x4845('0x36')]]={'$like':'%'+_0x14a23d[_0x4845('0x3d')][_0x4845('0x49')]+'%'};return _0x25b143;}})});}_0x9a3d99=_[_0x4845('0x4c')]({},_0x9a3d99,_0x14a23d[_0x4845('0x4d')]);var _0x16b53e={'where':_0x9a3d99[_0x4845('0x47')]};return db['VoiceContext'][_0x4845('0x2b')](_0x16b53e)['then'](function(_0x2f4b7d){_0x2cfeb2[_0x4845('0x2b')]=_0x2f4b7d;if(_0x14a23d[_0x4845('0x3d')][_0x4845('0x4e')]){_0x9a3d99[_0x4845('0x4f')]=[{'all':!![]}];}return db[_0x4845('0x3a')][_0x4845('0x50')](_0x9a3d99);})[_0x4845('0x1c')](function(_0x1381c1){_0x2cfeb2[_0x4845('0x51')]=_0x1381c1;return _0x2cfeb2;})['then'](respondWithFilteredResult(_0x2bed05,_0x9a3d99))[_0x4845('0x25')](handleError(_0x2bed05,null));};exports[_0x4845('0x52')]=function(_0x5f479e,_0x569aa6){var _0x18b784={'raw':![],'where':{'id':_0x5f479e[_0x4845('0x53')]['id']}},_0x25f63d={};_0x25f63d['model']=_['keys'](db['VoiceContext']['rawAttributes']);_0x25f63d[_0x4845('0x3d')]=_[_0x4845('0x54')](_0x5f479e[_0x4845('0x3d')]);_0x25f63d[_0x4845('0x3e')]=_['intersection'](_0x25f63d[_0x4845('0x3c')],_0x25f63d[_0x4845('0x3d')]);_0x18b784[_0x4845('0x40')]=_[_0x4845('0x3f')](_0x25f63d[_0x4845('0x3c')],qs[_0x4845('0x41')](_0x5f479e[_0x4845('0x3d')][_0x4845('0x41')]));_0x18b784[_0x4845('0x40')]=_0x18b784[_0x4845('0x40')][_0x4845('0x42')]?_0x18b784[_0x4845('0x40')]:_0x25f63d[_0x4845('0x3c')];if(_0x5f479e[_0x4845('0x3d')][_0x4845('0x4e')]){_0x18b784[_0x4845('0x4f')]=[{'all':!![]}];}_0x18b784=_['merge']({},_0x18b784,_0x5f479e[_0x4845('0x4d')]);return db[_0x4845('0x3a')][_0x4845('0x55')](_0x18b784)[_0x4845('0x1c')](handleEntityNotFound(_0x569aa6,null))[_0x4845('0x1c')](respondWithResult(_0x569aa6,null))[_0x4845('0x25')](handleError(_0x569aa6,null));};exports[_0x4845('0x56')]=function(_0x1a60bb,_0x57ae51,_0x115f77){var _0x4684ce;return db[_0x4845('0x3a')]['create'](_0x1a60bb[_0x4845('0x57')],{'raw':!![]})[_0x4845('0x1c')](function(_0x48bb40){_0x4684ce=_0x48bb40;return db[_0x4845('0x3a')]['findAll']({'raw':!![]});})[_0x4845('0x1c')](function(_0xe94c78){var _0x37e5b6=fs[_0x4845('0x58')](path[_0x4845('0x59')](config[_0x4845('0x5a')],_0x4845('0x5b')),'utf8');var _0x1dbc3b=ejs[_0x4845('0x5c')](_0x37e5b6,{'contexts':_0xe94c78||[]});fs[_0x4845('0x5d')](_0x4845('0x5e'),_0x1dbc3b);})[_0x4845('0x1c')](function(){return respondWithRpcPromise(_0x4845('0x5f'),_0x4845('0x56'),{'module':'chan_sip.so'});})[_0x4845('0x1c')](function(){var _0x2f843b=_0x1a60bb[_0x4845('0x60')][_0x4845('0x61')]({'plain':!![]});if(!_0x2f843b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f843b[_0x4845('0x62')]===_0x4845('0x60')){var _0x3947b0=_0x4684ce[_0x4845('0x61')]({'plain':!![]});return db[_0x4845('0x63')][_0x4845('0x55')]({'where':{'name':_0x4845('0x32'),'userProfileId':_0x2f843b['userProfileId']},'raw':!![]})[_0x4845('0x1c')](function(_0x56c91c){if(_0x56c91c&&_0x56c91c[_0x4845('0x64')]===0x0){return db['UserProfileResource'][_0x4845('0x56')]({'name':_0x3947b0[_0x4845('0x36')],'resourceId':_0x3947b0['id'],'type':_0x56c91c[_0x4845('0x36')],'sectionId':_0x56c91c['id']},{})[_0x4845('0x1c')](function(){return _0x4684ce;});}else{return _0x4684ce;}})[_0x4845('0x25')](function(_0x5221b4){logger['error'](_0x4845('0x65'),_0x5221b4);throw _0x5221b4;});}return _0x4684ce;})[_0x4845('0x1c')](respondWithResult(_0x57ae51,0xc9))['catch'](handleError(_0x57ae51,null));};exports['update']=function(_0x26ec3f,_0x4f21fa,_0x571df4){var _0x203813;return db[_0x4845('0x3a')]['find']({'where':{'id':_0x26ec3f[_0x4845('0x53')]['id']}})[_0x4845('0x1c')](handleEntityNotFound(_0x4f21fa,null))['then'](saveUpdates(_0x26ec3f['body'],null))['then'](function(_0x142b03){if(_0x142b03){_0x203813=_0x142b03;return db['VoiceContext'][_0x4845('0x50')]({'raw':!![]});}})['then'](function(_0x329480){var _0x5f2150=fs[_0x4845('0x58')](path['join'](config[_0x4845('0x5a')],_0x4845('0x5b')),_0x4845('0x66'));var _0x3c631a=ejs['render'](_0x5f2150,{'contexts':_0x329480||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x3c631a);})[_0x4845('0x1c')](function(){return respondWithRpcPromise('Reload',_0x4845('0x31'),{'module':_0x4845('0x67')});})[_0x4845('0x1c')](function(){return _0x203813;})['then'](respondWithResult(_0x4f21fa,null))[_0x4845('0x25')](handleError(_0x4f21fa,null));};exports[_0x4845('0x33')]=function(_0x2512e7,_0x5aba77,_0x5b4b02){var _0x47c2ac;return db['VoiceContext']['find']({'where':{'id':_0x2512e7[_0x4845('0x53')]['id']}})[_0x4845('0x1c')](handleEntityNotFound(_0x5aba77,null))['then'](removeEntity(_0x5aba77,null))[_0x4845('0x1c')](function(){return db[_0x4845('0x3a')]['findAll']({'raw':!![]});})[_0x4845('0x1c')](function(_0x166ff8){var _0x39eab0=fs[_0x4845('0x58')](path[_0x4845('0x59')](config['root'],_0x4845('0x5b')),_0x4845('0x66'));var _0x4c7def=ejs[_0x4845('0x5c')](_0x39eab0,{'contexts':_0x166ff8});fs[_0x4845('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4c7def);return respondWithRpcPromise('Reload','destroy',{'module':_0x4845('0x67')});})[_0x4845('0x25')](handleError(_0x5aba77,null));}; \ No newline at end of file +var _0xd883=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','server/files/templates/context.ejs','utf8','Reload','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','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','Contexts','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields'];(function(_0x3113d5,_0x5cc37d){var _0x22fbdc=function(_0x50759e){while(--_0x50759e){_0x3113d5['push'](_0x3113d5['shift']());}};_0x22fbdc(++_0x5cc37d);}(_0xd883,0x101));var _0x3d88=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd883[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x3d88('0x0'));var rimraf=require(_0x3d88('0x1'));var zipdir=require(_0x3d88('0x2'));var jsonpatch=require(_0x3d88('0x3'));var rp=require(_0x3d88('0x4'));var moment=require(_0x3d88('0x5'));var BPromise=require(_0x3d88('0x6'));var Mustache=require(_0x3d88('0x7'));var util=require(_0x3d88('0x8'));var path=require(_0x3d88('0x9'));var sox=require(_0x3d88('0xa'));var csv=require(_0x3d88('0xb'));var ejs=require(_0x3d88('0xc'));var fs=require('fs');var fs_extra=require(_0x3d88('0xd'));var _=require('lodash');var squel=require(_0x3d88('0xe'));var crypto=require(_0x3d88('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3d88('0x10'));var toCsv=require(_0x3d88('0xb'));var querystring=require(_0x3d88('0x11'));var Papa=require('papaparse');var Redis=require(_0x3d88('0x12'));var authService=require(_0x3d88('0x13'));var qs=require(_0x3d88('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3d88('0x15'));var utils=require('../../config/utils');var config=require(_0x3d88('0x16'));var licenseUtil=require(_0x3d88('0x17'));var db=require(_0x3d88('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3d88('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2db61c,_0xda80f8,_0x1a6038,_0x1ed3a9){return new BPromise(function(_0x2ec149,_0x4632f6){var _0x320ca9=_0x1ed3a9||client;return _0x320ca9[_0x3d88('0x1a')](_0x2db61c,_0x1a6038)[_0x3d88('0x1b')](function(_0x397dbd){logger[_0x3d88('0x1c')](_0x3d88('0x1d'),_0xda80f8,'request\x20sent');logger[_0x3d88('0x1e')](_0x3d88('0x1f'),_0xda80f8,_0x3d88('0x20'),JSON[_0x3d88('0x21')](_0x397dbd));if(_0x397dbd[_0x3d88('0x22')]){if(_0x397dbd[_0x3d88('0x22')][_0x3d88('0x23')]===0x1f4){logger[_0x3d88('0x22')](_0x3d88('0x1d'),_0xda80f8,_0x397dbd[_0x3d88('0x22')][_0x3d88('0x24')]);return _0x4632f6(_0x397dbd[_0x3d88('0x22')][_0x3d88('0x24')]);}logger[_0x3d88('0x22')]('VoiceContext,\x20%s,\x20%s',_0xda80f8,_0x397dbd['error'][_0x3d88('0x24')]);return _0x2ec149(_0x397dbd[_0x3d88('0x22')]['message']);}else{logger['info'](_0x3d88('0x1d'),_0xda80f8,'request\x20sent');_0x2ec149(_0x397dbd[_0x3d88('0x25')]['message']);}})[_0x3d88('0x26')](function(_0x1c99b2){logger[_0x3d88('0x22')](_0x3d88('0x1d'),_0xda80f8,_0x1c99b2);_0x4632f6(_0x1c99b2);});});}function respondWithStatusCode(_0x2002c4,_0x430c4a){_0x430c4a=_0x430c4a||0xcc;return function(_0x58c48c){if(_0x58c48c){return _0x2002c4[_0x3d88('0x27')](_0x430c4a);}return _0x2002c4[_0x3d88('0x28')](_0x430c4a)[_0x3d88('0x29')]();};}function respondWithResult(_0x20c0e3,_0x367def){_0x367def=_0x367def||0xc8;return function(_0x2dd0ac){if(_0x2dd0ac){return _0x20c0e3[_0x3d88('0x28')](_0x367def)[_0x3d88('0x2a')](_0x2dd0ac);}};}function respondWithFilteredResult(_0x3d5fa5,_0x4f0791){return function(_0x1ffedb){if(_0x1ffedb){var _0xd875f8=typeof _0x4f0791[_0x3d88('0x2b')]===_0x3d88('0x2c')&&typeof _0x4f0791[_0x3d88('0x2d')]===_0x3d88('0x2c');var _0x4feabc=_0x1ffedb[_0x3d88('0x2e')];var _0x59cfa9=_0xd875f8?0x0:_0x4f0791['offset'];var _0x705805=_0xd875f8?_0x1ffedb['count']:_0x4f0791[_0x3d88('0x2b')]+_0x4f0791[_0x3d88('0x2d')];var _0x44ff8b;if(_0x705805>=_0x4feabc){_0x705805=_0x4feabc;_0x44ff8b=0xc8;}else{_0x44ff8b=0xce;}_0x3d5fa5[_0x3d88('0x28')](_0x44ff8b);return _0x3d5fa5[_0x3d88('0x2f')]('Content-Range',_0x59cfa9+'-'+_0x705805+'/'+_0x4feabc)[_0x3d88('0x2a')](_0x1ffedb);}return null;};}function patchUpdates(_0x4eb47d){return function(_0x475d5b){try{jsonpatch['apply'](_0x475d5b,_0x4eb47d,!![]);}catch(_0x339c08){return BPromise[_0x3d88('0x30')](_0x339c08);}return _0x475d5b[_0x3d88('0x31')]();};}function saveUpdates(_0x3cdd75,_0x16e48c){return function(_0x41cff9){if(_0x41cff9){return _0x41cff9[_0x3d88('0x32')](_0x3cdd75)[_0x3d88('0x1b')](function(_0x2976de){return _0x2976de;});}return null;};}function removeEntity(_0x419726,_0x4736ff){return function(_0x5326ce){if(_0x5326ce){return _0x5326ce[_0x3d88('0x33')]()[_0x3d88('0x1b')](function(){var _0x437276=_0x5326ce['get']({'plain':!![]});var _0x2f46bb=_0x3d88('0x34');return db['UserProfileResource'][_0x3d88('0x33')]({'where':{'type':_0x2f46bb,'resourceId':_0x437276['id']}})[_0x3d88('0x1b')](function(){return _0x5326ce;});})[_0x3d88('0x1b')](function(){_0x419726['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a2a94,_0x277212){return function(_0x3f33c7){if(!_0x3f33c7){_0x1a2a94['sendStatus'](0x194);}return _0x3f33c7;};}function handleError(_0x3c1341,_0x4e663b){_0x4e663b=_0x4e663b||0x1f4;return function(_0x5a2282){logger[_0x3d88('0x22')](_0x5a2282[_0x3d88('0x35')]);if(_0x5a2282[_0x3d88('0x36')]){delete _0x5a2282['name'];}_0x3c1341['status'](_0x4e663b)[_0x3d88('0x37')](_0x5a2282);};}exports[_0x3d88('0x38')]=function(_0x362246,_0x4a4ef1){var _0x449f16={},_0x88bad2={},_0x138a30={'count':0x0,'rows':[]};var _0x5e9fc4=_[_0x3d88('0x39')](db['VoiceContext'][_0x3d88('0x3a')],function(_0x5a39a7){return{'name':_0x5a39a7[_0x3d88('0x3b')],'type':_0x5a39a7['type'][_0x3d88('0x3c')]};});_0x88bad2['model']=_[_0x3d88('0x39')](_0x5e9fc4,_0x3d88('0x36'));_0x88bad2[_0x3d88('0x3d')]=_[_0x3d88('0x3e')](_0x362246[_0x3d88('0x3d')]);_0x88bad2[_0x3d88('0x3f')]=_[_0x3d88('0x40')](_0x88bad2[_0x3d88('0x41')],_0x88bad2['query']);_0x449f16['attributes']=_['intersection'](_0x88bad2[_0x3d88('0x41')],qs[_0x3d88('0x42')](_0x362246[_0x3d88('0x3d')][_0x3d88('0x42')]));_0x449f16[_0x3d88('0x43')]=_0x449f16[_0x3d88('0x43')]['length']?_0x449f16[_0x3d88('0x43')]:_0x88bad2['model'];if(!_0x362246[_0x3d88('0x3d')][_0x3d88('0x44')](_0x3d88('0x45'))){_0x449f16['limit']=qs['limit'](_0x362246[_0x3d88('0x3d')]['limit']);_0x449f16[_0x3d88('0x2b')]=qs[_0x3d88('0x2b')](_0x362246[_0x3d88('0x3d')][_0x3d88('0x2b')]);}_0x449f16[_0x3d88('0x46')]=qs[_0x3d88('0x47')](_0x362246['query'][_0x3d88('0x47')]);_0x449f16[_0x3d88('0x48')]=qs[_0x3d88('0x3f')](_[_0x3d88('0x49')](_0x362246[_0x3d88('0x3d')],_0x88bad2['filters']),_0x5e9fc4);if(_0x362246[_0x3d88('0x3d')][_0x3d88('0x4a')]){_0x449f16['where']=_[_0x3d88('0x4b')](_0x449f16[_0x3d88('0x48')],{'$or':_[_0x3d88('0x39')](_0x5e9fc4,function(_0x47d526){if(_0x47d526[_0x3d88('0x4c')]!==_0x3d88('0x4d')){var _0x13efe7={};_0x13efe7[_0x47d526[_0x3d88('0x36')]]={'$like':'%'+_0x362246[_0x3d88('0x3d')][_0x3d88('0x4a')]+'%'};return _0x13efe7;}})});}_0x449f16=_[_0x3d88('0x4b')]({},_0x449f16,_0x362246[_0x3d88('0x4e')]);var _0x36d5e4={'where':_0x449f16[_0x3d88('0x48')]};return db[_0x3d88('0x4f')]['count'](_0x36d5e4)[_0x3d88('0x1b')](function(_0x4589ba){_0x138a30['count']=_0x4589ba;if(_0x362246[_0x3d88('0x3d')][_0x3d88('0x50')]){_0x449f16[_0x3d88('0x51')]=[{'all':!![]}];}return db[_0x3d88('0x4f')][_0x3d88('0x52')](_0x449f16);})[_0x3d88('0x1b')](function(_0x30ad55){_0x138a30[_0x3d88('0x53')]=_0x30ad55;return _0x138a30;})[_0x3d88('0x1b')](respondWithFilteredResult(_0x4a4ef1,_0x449f16))[_0x3d88('0x26')](handleError(_0x4a4ef1,null));};exports[_0x3d88('0x54')]=function(_0x2f975d,_0x4c1da3){var _0xb8a52c={'raw':![],'where':{'id':_0x2f975d[_0x3d88('0x55')]['id']}},_0x3a45bb={};_0x3a45bb[_0x3d88('0x41')]=_[_0x3d88('0x3e')](db[_0x3d88('0x4f')]['rawAttributes']);_0x3a45bb[_0x3d88('0x3d')]=_[_0x3d88('0x3e')](_0x2f975d['query']);_0x3a45bb[_0x3d88('0x3f')]=_[_0x3d88('0x40')](_0x3a45bb[_0x3d88('0x41')],_0x3a45bb[_0x3d88('0x3d')]);_0xb8a52c[_0x3d88('0x43')]=_[_0x3d88('0x40')](_0x3a45bb[_0x3d88('0x41')],qs[_0x3d88('0x42')](_0x2f975d[_0x3d88('0x3d')]['fields']));_0xb8a52c[_0x3d88('0x43')]=_0xb8a52c[_0x3d88('0x43')][_0x3d88('0x56')]?_0xb8a52c[_0x3d88('0x43')]:_0x3a45bb[_0x3d88('0x41')];if(_0x2f975d[_0x3d88('0x3d')][_0x3d88('0x50')]){_0xb8a52c[_0x3d88('0x51')]=[{'all':!![]}];}_0xb8a52c=_[_0x3d88('0x4b')]({},_0xb8a52c,_0x2f975d['options']);return db[_0x3d88('0x4f')][_0x3d88('0x57')](_0xb8a52c)['then'](handleEntityNotFound(_0x4c1da3,null))[_0x3d88('0x1b')](respondWithResult(_0x4c1da3,null))['catch'](handleError(_0x4c1da3,null));};exports[_0x3d88('0x58')]=function(_0x1377c3,_0x158957,_0x317c21){var _0x405a65;return db[_0x3d88('0x4f')]['create'](_0x1377c3[_0x3d88('0x59')],{'raw':!![]})[_0x3d88('0x1b')](function(_0x1ed5f4){_0x405a65=_0x1ed5f4;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x3d88('0x1b')](function(_0x5b4410){var _0xb2c1e2=fs[_0x3d88('0x5a')](path[_0x3d88('0x5b')](config[_0x3d88('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x4a7a09=ejs[_0x3d88('0x5d')](_0xb2c1e2,{'contexts':_0x5b4410||[]});fs[_0x3d88('0x5e')](_0x3d88('0x5f'),_0x4a7a09);})[_0x3d88('0x1b')](function(){return respondWithRpcPromise('Reload',_0x3d88('0x58'),{'module':_0x3d88('0x60')});})[_0x3d88('0x1b')](function(){var _0x1755ce=_0x1377c3[_0x3d88('0x61')][_0x3d88('0x62')]({'plain':!![]});if(!_0x1755ce)throw new Error(_0x3d88('0x63'));if(_0x1755ce[_0x3d88('0x64')]===_0x3d88('0x61')){var _0x1ea747=_0x405a65[_0x3d88('0x62')]({'plain':!![]});return db[_0x3d88('0x65')]['find']({'where':{'name':_0x3d88('0x34'),'userProfileId':_0x1755ce[_0x3d88('0x66')]},'raw':!![]})[_0x3d88('0x1b')](function(_0x26a88a){if(_0x26a88a&&_0x26a88a[_0x3d88('0x67')]===0x0){return db[_0x3d88('0x68')][_0x3d88('0x58')]({'name':_0x1ea747[_0x3d88('0x36')],'resourceId':_0x1ea747['id'],'type':_0x26a88a[_0x3d88('0x36')],'sectionId':_0x26a88a['id']},{})['then'](function(){return _0x405a65;});}else{return _0x405a65;}})[_0x3d88('0x26')](function(_0x440a7e){logger[_0x3d88('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x440a7e);throw _0x440a7e;});}return _0x405a65;})[_0x3d88('0x1b')](respondWithResult(_0x158957,0xc9))['catch'](handleError(_0x158957,null));};exports[_0x3d88('0x32')]=function(_0x81cef9,_0x20c531,_0x5dd27f){var _0x28f474;return db['VoiceContext'][_0x3d88('0x57')]({'where':{'id':_0x81cef9[_0x3d88('0x55')]['id']}})[_0x3d88('0x1b')](handleEntityNotFound(_0x20c531,null))[_0x3d88('0x1b')](saveUpdates(_0x81cef9[_0x3d88('0x59')],null))[_0x3d88('0x1b')](function(_0x1e4693){if(_0x1e4693){_0x28f474=_0x1e4693;return db[_0x3d88('0x4f')][_0x3d88('0x52')]({'raw':!![]});}})['then'](function(_0x44ebea){var _0x118ed0=fs[_0x3d88('0x5a')](path['join'](config[_0x3d88('0x5c')],_0x3d88('0x69')),_0x3d88('0x6a'));var _0xec885=ejs[_0x3d88('0x5d')](_0x118ed0,{'contexts':_0x44ebea||[]});fs[_0x3d88('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xec885);})['then'](function(){return respondWithRpcPromise(_0x3d88('0x6b'),_0x3d88('0x32'),{'module':_0x3d88('0x60')});})[_0x3d88('0x1b')](function(){return _0x28f474;})[_0x3d88('0x1b')](respondWithResult(_0x20c531,null))[_0x3d88('0x26')](handleError(_0x20c531,null));};exports['destroy']=function(_0x173b08,_0x24fbc7,_0x425183){var _0x3b2e4b;return db[_0x3d88('0x4f')][_0x3d88('0x57')]({'where':{'id':_0x173b08[_0x3d88('0x55')]['id']}})['then'](handleEntityNotFound(_0x24fbc7,null))[_0x3d88('0x1b')](removeEntity(_0x24fbc7,null))[_0x3d88('0x1b')](function(){return db[_0x3d88('0x4f')][_0x3d88('0x52')]({'raw':!![]});})[_0x3d88('0x1b')](function(_0x22a40e){var _0x14555f=fs[_0x3d88('0x5a')](path[_0x3d88('0x5b')](config[_0x3d88('0x5c')],'server/files/templates/context.ejs'),_0x3d88('0x6a'));var _0x164245=ejs[_0x3d88('0x5d')](_0x14555f,{'contexts':_0x22a40e});fs[_0x3d88('0x5e')](_0x3d88('0x5f'),_0x164245);return respondWithRpcPromise(_0x3d88('0x6b'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x24fbc7,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e488b91..218776a 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 _0xa3f8=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0xa8691c,_0x5d7a58){var _0x2d2817=function(_0x4725bd){while(--_0x4725bd){_0xa8691c['push'](_0xa8691c['shift']());}};_0x2d2817(++_0x5d7a58);}(_0xa3f8,0x1f4));var _0x8a3f=function(_0x2724e5,_0x229d74){_0x2724e5=_0x2724e5-0x0;var _0x4b6621=_0xa3f8[_0x2724e5];return _0x4b6621;};'use strict';var _=require(_0x8a3f('0x0'));var util=require(_0x8a3f('0x1'));var logger=require('../../config/logger')(_0x8a3f('0x2'));var moment=require(_0x8a3f('0x3'));var BPromise=require(_0x8a3f('0x4'));var rp=require(_0x8a3f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a3f('0x6'));var config=require(_0x8a3f('0x7'));var attributes=require(_0x8a3f('0x8'));module[_0x8a3f('0x9')]=function(_0x283c7d,_0x15978a){return _0x283c7d[_0x8a3f('0xa')](_0x8a3f('0xb'),attributes,{'tableName':_0x8a3f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f29=['request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','api','moment','bluebird'];(function(_0x4ff3f9,_0x202232){var _0x54fe66=function(_0x10ea57){while(--_0x10ea57){_0x4ff3f9['push'](_0x4ff3f9['shift']());}};_0x54fe66(++_0x202232);}(_0x1f29,0x170));var _0x91f2=function(_0x54467b,_0x35652e){_0x54467b=_0x54467b-0x0;var _0x41a4a3=_0x1f29[_0x54467b];return _0x41a4a3;};'use strict';var _=require(_0x91f2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x91f2('0x1'));var moment=require(_0x91f2('0x2'));var BPromise=require(_0x91f2('0x3'));var rp=require(_0x91f2('0x4'));var fs=require('fs');var path=require(_0x91f2('0x5'));var rimraf=require(_0x91f2('0x6'));var config=require(_0x91f2('0x7'));var attributes=require(_0x91f2('0x8'));module[_0x91f2('0x9')]=function(_0x48a5de,_0xbebb75){return _0x48a5de[_0x91f2('0xa')](_0x91f2('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 09a5e1e..67b2e17 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 _0x2ec8=['ioredis','../../config/logger','../../config/environment','jayson/promise','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','info','message','catch','lodash','util','moment','bluebird'];(function(_0x2a9b7a,_0x4ef939){var _0x6284d8=function(_0x1ddbb0){while(--_0x1ddbb0){_0x2a9b7a['push'](_0x2a9b7a['shift']());}};_0x6284d8(++_0x4ef939);}(_0x2ec8,0x188));var _0x82ec=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2ec8[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x82ec('0x0'));var util=require(_0x82ec('0x1'));var moment=require(_0x82ec('0x2'));var BPromise=require(_0x82ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x82ec('0x5'))('rpc');var config=require(_0x82ec('0x6'));var jayson=require(_0x82ec('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c786a,_0x527476,_0x3af0cf){return new BPromise(function(_0x3ceabc,_0x4dd14f){return client['request'](_0x5c786a,_0x3af0cf)[_0x82ec('0x8')](function(_0x132ac9){logger['info'](_0x82ec('0x9'),_0x527476,_0x82ec('0xa'));logger[_0x82ec('0xb')](_0x82ec('0xc'),_0x527476,_0x82ec('0xa'),JSON['stringify'](_0x132ac9));if(_0x132ac9[_0x82ec('0xd')]){if(_0x132ac9[_0x82ec('0xd')][_0x82ec('0xe')]===0x1f4){logger['error'](_0x82ec('0x9'),_0x527476,_0x132ac9[_0x82ec('0xd')]['message']);return _0x4dd14f(_0x132ac9[_0x82ec('0xd')]['message']);}logger[_0x82ec('0xd')](_0x82ec('0x9'),_0x527476,_0x132ac9[_0x82ec('0xd')]['message']);return _0x3ceabc(_0x132ac9[_0x82ec('0xd')]['message']);}else{logger[_0x82ec('0xf')](_0x82ec('0x9'),_0x527476,'request\x20sent');_0x3ceabc(_0x132ac9['result'][_0x82ec('0x10')]);}})[_0x82ec('0x11')](function(_0x195f68){logger[_0x82ec('0xd')](_0x82ec('0x9'),_0x527476,_0x195f68);_0x4dd14f(_0x195f68);});});} \ No newline at end of file +var _0x20c6=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3d0451,_0x3da198){var _0x21fa51=function(_0x14b609){while(--_0x14b609){_0x3d0451['push'](_0x3d0451['shift']());}};_0x21fa51(++_0x3da198);}(_0x20c6,0x1e8));var _0x620c=function(_0x25875c,_0xc144a9){_0x25875c=_0x25875c-0x0;var _0x48a9e6=_0x20c6[_0x25875c];return _0x48a9e6;};'use strict';var _=require(_0x620c('0x0'));var util=require(_0x620c('0x1'));var moment=require(_0x620c('0x2'));var BPromise=require(_0x620c('0x3'));var rs=require(_0x620c('0x4'));var fs=require('fs');var Redis=require(_0x620c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x620c('0x6'))(_0x620c('0x7'));var config=require(_0x620c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x620c('0x9')][_0x620c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x329af4,_0x3e1d09,_0x449e83){return new BPromise(function(_0x4c9ec1,_0x49fa3f){return client['request'](_0x329af4,_0x449e83)[_0x620c('0xb')](function(_0x2b66b4){logger[_0x620c('0xc')](_0x620c('0xd'),_0x3e1d09,'request\x20sent');logger[_0x620c('0xe')](_0x620c('0xf'),_0x3e1d09,_0x620c('0x10'),JSON['stringify'](_0x2b66b4));if(_0x2b66b4[_0x620c('0x11')]){if(_0x2b66b4[_0x620c('0x11')][_0x620c('0x12')]===0x1f4){logger['error'](_0x620c('0xd'),_0x3e1d09,_0x2b66b4[_0x620c('0x11')][_0x620c('0x13')]);return _0x49fa3f(_0x2b66b4[_0x620c('0x11')][_0x620c('0x13')]);}logger[_0x620c('0x11')](_0x620c('0xd'),_0x3e1d09,_0x2b66b4[_0x620c('0x11')][_0x620c('0x13')]);return _0x4c9ec1(_0x2b66b4[_0x620c('0x11')][_0x620c('0x13')]);}else{logger[_0x620c('0xc')](_0x620c('0xd'),_0x3e1d09,_0x620c('0x10'));_0x4c9ec1(_0x2b66b4[_0x620c('0x14')][_0x620c('0x13')]);}})[_0x620c('0x15')](function(_0x585c5b){logger[_0x620c('0x11')]('VoiceContext,\x20%s,\x20%s',_0x3e1d09,_0x585c5b);_0x49fa3f(_0x585c5b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c9b746b..a834005 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 _0xd063=['util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','describe','/:id','post','isAuthenticated','create','put','update','delete','destroy','exports','multer'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xd063,0x13a));var _0x3d06=function(_0x3e70a7,_0x3df2f4){_0x3e70a7=_0x3e70a7-0x0;var _0x191e1a=_0xd063[_0x3e70a7];return _0x191e1a;};'use strict';var multer=require(_0x3d06('0x0'));var util=require(_0x3d06('0x1'));var path=require('path');var timeout=require(_0x3d06('0x2'));var express=require('express');var router=express[_0x3d06('0x3')]();var fs_extra=require(_0x3d06('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3d06('0x5'));var config=require(_0x3d06('0x6'));var controller=require(_0x3d06('0x7'));router[_0x3d06('0x8')]('/',auth['isAuthenticated'](),controller[_0x3d06('0x9')]);router[_0x3d06('0x8')](_0x3d06('0xa'),auth['isAuthenticated'](),controller[_0x3d06('0xb')]);router['get'](_0x3d06('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3d06('0xd')]('/',auth[_0x3d06('0xe')](),controller[_0x3d06('0xf')]);router[_0x3d06('0x10')](_0x3d06('0xc'),auth['isAuthenticated'](),controller[_0x3d06('0x11')]);router[_0x3d06('0x12')]('/:id',auth[_0x3d06('0xe')](),controller[_0x3d06('0x13')]);module[_0x3d06('0x14')]=router; \ No newline at end of file +var _0x0125=['describe','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0125,0x182));var _0x5012=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x0125[_0x3db122];return _0x325b67;};'use strict';var multer=require(_0x5012('0x0'));var util=require(_0x5012('0x1'));var path=require(_0x5012('0x2'));var timeout=require(_0x5012('0x3'));var express=require(_0x5012('0x4'));var router=express[_0x5012('0x5')]();var fs_extra=require(_0x5012('0x6'));var auth=require(_0x5012('0x7'));var interaction=require(_0x5012('0x8'));var config=require(_0x5012('0x9'));var controller=require('./voiceDialReport.controller');router[_0x5012('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5012('0xa')](_0x5012('0xb'),auth[_0x5012('0xc')](),controller[_0x5012('0xd')]);router['get']('/:id',auth[_0x5012('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5012('0xe')]);router['put'](_0x5012('0xf'),auth[_0x5012('0xc')](),controller[_0x5012('0x10')]);router[_0x5012('0x11')](_0x5012('0xf'),auth[_0x5012('0xc')](),controller['destroy']);module[_0x5012('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 1fed86f..2a89e17 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 _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x2fdb4e,_0x436da0){var _0x46938d=function(_0x56ca3b){while(--_0x56ca3b){_0x2fdb4e['push'](_0x2fdb4e['shift']());}};_0x46938d(++_0x436da0);}(_0x425d,0x1e0));var _0xd425=function(_0xb7e28a,_0x5cf4be){_0xb7e28a=_0xb7e28a-0x0;var _0x369be6=_0x425d[_0xb7e28a];return _0x369be6;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x43ec24,_0x2bee02){var _0x3e91a8=function(_0x22dc5d){while(--_0x22dc5d){_0x43ec24['push'](_0x43ec24['shift']());}};_0x3e91a8(++_0x2bee02);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x3b38d5,_0x34df53){_0x3b38d5=_0x3b38d5-0x0;var _0x5ba9ba=_0x8d0e[_0x3b38d5];return _0x5ba9ba;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index be89038..fdaac34 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 _0x4974=['end','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','name','index','VoiceDialReport','rawAttributes','key','model','map','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','catch','params','find','create','body','update','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x2d56c0,_0x302a7c){var _0x3fc9b4=function(_0x2ffa84){while(--_0x2ffa84){_0x2d56c0['push'](_0x2d56c0['shift']());}};_0x3fc9b4(++_0x302a7c);}(_0x4974,0x6d));var _0x4497=function(_0x3f0d65,_0x182a58){_0x3f0d65=_0x3f0d65-0x0;var _0x3b9032=_0x4974[_0x3f0d65];return _0x3b9032;};'use strict';var emlformat=require(_0x4497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4497('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4497('0x2'));var moment=require(_0x4497('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4497('0x4'));var util=require(_0x4497('0x5'));var path=require(_0x4497('0x6'));var sox=require(_0x4497('0x7'));var csv=require(_0x4497('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4497('0x9'));var _=require(_0x4497('0xa'));var squel=require(_0x4497('0xb'));var crypto=require(_0x4497('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4497('0x8'));var querystring=require('querystring');var Papa=require(_0x4497('0xd'));var Redis=require('ioredis');var authService=require(_0x4497('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4497('0xf'));var hardwareService=require(_0x4497('0x10'));var logger=require(_0x4497('0x11'))(_0x4497('0x12'));var utils=require(_0x4497('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4497('0x14'))['db'];function respondWithStatusCode(_0x32676f,_0x243a01){_0x243a01=_0x243a01||0xcc;return function(_0xab2d9c){if(_0xab2d9c){return _0x32676f[_0x4497('0x15')](_0x243a01);}return _0x32676f[_0x4497('0x16')](_0x243a01)[_0x4497('0x17')]();};}function respondWithResult(_0x324ff8,_0x5e1f58){_0x5e1f58=_0x5e1f58||0xc8;return function(_0x42bb6d){if(_0x42bb6d){return _0x324ff8['status'](_0x5e1f58)['json'](_0x42bb6d);}};}function respondWithFilteredResult(_0x5b5f43,_0x14fa06){return function(_0x489701){if(_0x489701){var _0x13ed72=typeof _0x14fa06[_0x4497('0x18')]==='undefined'&&typeof _0x14fa06[_0x4497('0x19')]===_0x4497('0x1a');var _0x2dd323=_0x489701['count'];var _0x29ede5=_0x13ed72?0x0:_0x14fa06[_0x4497('0x18')];var _0x39cbe9=_0x13ed72?_0x489701[_0x4497('0x1b')]:_0x14fa06['offset']+_0x14fa06[_0x4497('0x19')];var _0x305bb3;if(_0x39cbe9>=_0x2dd323){_0x39cbe9=_0x2dd323;_0x305bb3=0xc8;}else{_0x305bb3=0xce;}_0x5b5f43[_0x4497('0x16')](_0x305bb3);return _0x5b5f43[_0x4497('0x1c')](_0x4497('0x1d'),_0x29ede5+'-'+_0x39cbe9+'/'+_0x2dd323)['json'](_0x489701);}return null;};}function patchUpdates(_0x280e17){return function(_0x2e68f2){try{jsonpatch[_0x4497('0x1e')](_0x2e68f2,_0x280e17,!![]);}catch(_0x583e9e){return BPromise['reject'](_0x583e9e);}return _0x2e68f2[_0x4497('0x1f')]();};}function saveUpdates(_0x2010a2,_0x28e17c){return function(_0x3d0f8a){if(_0x3d0f8a){return _0x3d0f8a['update'](_0x2010a2)[_0x4497('0x20')](function(_0x1bd98f){return _0x1bd98f;});}return null;};}function removeEntity(_0x285bca,_0x1d9cdb){return function(_0x2a5447){if(_0x2a5447){return _0x2a5447[_0x4497('0x21')]()[_0x4497('0x20')](function(){_0x285bca[_0x4497('0x16')](0xcc)[_0x4497('0x17')]();});}};}function handleEntityNotFound(_0x2dc013,_0xdc7ff3){return function(_0xb5bcf1){if(!_0xb5bcf1){_0x2dc013[_0x4497('0x15')](0x194);}return _0xb5bcf1;};}function handleError(_0x1ceeb0,_0xd728c4){_0xd728c4=_0xd728c4||0x1f4;return function(_0x4b7f27){logger['error'](_0x4b7f27['stack']);if(_0x4b7f27[_0x4497('0x22')]){delete _0x4b7f27[_0x4497('0x22')];}_0x1ceeb0['status'](_0xd728c4)['send'](_0x4b7f27);};}exports[_0x4497('0x23')]=function(_0x27c228,_0x310cd2){var _0x27293c={},_0x2f3c42={},_0x2efbf3={'count':0x0,'rows':[]};var _0x45800a=_['map'](db[_0x4497('0x24')][_0x4497('0x25')],function(_0x395c7c){return{'name':_0x395c7c['fieldName'],'type':_0x395c7c['type'][_0x4497('0x26')]};});_0x2f3c42[_0x4497('0x27')]=_[_0x4497('0x28')](_0x45800a,_0x4497('0x22'));_0x2f3c42['query']=_[_0x4497('0x29')](_0x27c228['query']);_0x2f3c42[_0x4497('0x2a')]=_['intersection'](_0x2f3c42[_0x4497('0x27')],_0x2f3c42['query']);_0x27293c['attributes']=_[_0x4497('0x2b')](_0x2f3c42[_0x4497('0x27')],qs[_0x4497('0x2c')](_0x27c228[_0x4497('0x2d')][_0x4497('0x2c')]));_0x27293c[_0x4497('0x2e')]=_0x27293c[_0x4497('0x2e')][_0x4497('0x2f')]?_0x27293c[_0x4497('0x2e')]:_0x2f3c42[_0x4497('0x27')];if(!_0x27c228[_0x4497('0x2d')][_0x4497('0x30')]('nolimit')){_0x27293c['limit']=qs[_0x4497('0x19')](_0x27c228[_0x4497('0x2d')][_0x4497('0x19')]);_0x27293c[_0x4497('0x18')]=qs[_0x4497('0x18')](_0x27c228['query'][_0x4497('0x18')]);}_0x27293c['order']=qs[_0x4497('0x31')](_0x27c228[_0x4497('0x2d')]['sort']);_0x27293c[_0x4497('0x32')]=qs[_0x4497('0x2a')](_[_0x4497('0x33')](_0x27c228['query'],_0x2f3c42[_0x4497('0x2a')]),_0x45800a);if(_0x27c228['query']['filter']){_0x27293c[_0x4497('0x32')]=_[_0x4497('0x34')](_0x27293c['where'],{'$or':_['map'](_0x45800a,function(_0x793f88){if(_0x793f88[_0x4497('0x35')]!=='VIRTUAL'){var _0x18be2b={};_0x18be2b[_0x793f88[_0x4497('0x22')]]={'$like':'%'+_0x27c228[_0x4497('0x2d')][_0x4497('0x36')]+'%'};return _0x18be2b;}})});}_0x27293c=_[_0x4497('0x34')]({},_0x27293c,_0x27c228[_0x4497('0x37')]);var _0x1d0827={'where':_0x27293c[_0x4497('0x32')]};return db[_0x4497('0x24')][_0x4497('0x1b')](_0x1d0827)[_0x4497('0x20')](function(_0x4a5e13){_0x2efbf3['count']=_0x4a5e13;if(_0x27c228[_0x4497('0x2d')][_0x4497('0x38')]){_0x27293c[_0x4497('0x39')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x4497('0x3a')](_0x27293c);})[_0x4497('0x20')](function(_0x51e306){_0x2efbf3['rows']=_0x51e306;return _0x2efbf3;})[_0x4497('0x20')](respondWithFilteredResult(_0x310cd2,_0x27293c))[_0x4497('0x3b')](handleError(_0x310cd2,null));};exports['show']=function(_0xef0abe,_0x5d7d53){var _0x475831={'raw':!![],'where':{'id':_0xef0abe[_0x4497('0x3c')]['id']}},_0x5202c9={};_0x5202c9['model']=_[_0x4497('0x29')](db[_0x4497('0x24')]['rawAttributes']);_0x5202c9[_0x4497('0x2d')]=_[_0x4497('0x29')](_0xef0abe[_0x4497('0x2d')]);_0x5202c9[_0x4497('0x2a')]=_[_0x4497('0x2b')](_0x5202c9[_0x4497('0x27')],_0x5202c9['query']);_0x475831[_0x4497('0x2e')]=_['intersection'](_0x5202c9[_0x4497('0x27')],qs[_0x4497('0x2c')](_0xef0abe['query'][_0x4497('0x2c')]));_0x475831[_0x4497('0x2e')]=_0x475831[_0x4497('0x2e')]['length']?_0x475831[_0x4497('0x2e')]:_0x5202c9[_0x4497('0x27')];if(_0xef0abe[_0x4497('0x2d')]['includeAll']){_0x475831[_0x4497('0x39')]=[{'all':!![]}];}_0x475831=_['merge']({},_0x475831,_0xef0abe[_0x4497('0x37')]);return db[_0x4497('0x24')][_0x4497('0x3d')](_0x475831)[_0x4497('0x20')](handleEntityNotFound(_0x5d7d53,null))[_0x4497('0x20')](respondWithResult(_0x5d7d53,null))[_0x4497('0x3b')](handleError(_0x5d7d53,null));};exports[_0x4497('0x3e')]=function(_0x5a9605,_0x2b07ea){return db[_0x4497('0x24')][_0x4497('0x3e')](_0x5a9605[_0x4497('0x3f')],{})[_0x4497('0x20')](respondWithResult(_0x2b07ea,0xc9))[_0x4497('0x3b')](handleError(_0x2b07ea,null));};exports[_0x4497('0x40')]=function(_0x4c9bbd,_0x9f4e43){if(_0x4c9bbd['body']['id']){delete _0x4c9bbd[_0x4497('0x3f')]['id'];}return db['VoiceDialReport'][_0x4497('0x3d')]({'where':{'id':_0x4c9bbd[_0x4497('0x3c')]['id']}})[_0x4497('0x20')](handleEntityNotFound(_0x9f4e43,null))[_0x4497('0x20')](saveUpdates(_0x4c9bbd[_0x4497('0x3f')],null))['then'](respondWithResult(_0x9f4e43,null))[_0x4497('0x3b')](handleError(_0x9f4e43,null));};exports[_0x4497('0x21')]=function(_0x1831c4,_0x2abcf0){return db[_0x4497('0x24')][_0x4497('0x3d')]({'where':{'id':_0x1831c4[_0x4497('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2abcf0,null))[_0x4497('0x20')](removeEntity(_0x2abcf0,null))[_0x4497('0x3b')](handleError(_0x2abcf0,null));};exports[_0x4497('0x41')]=function(_0x4edcae,_0xd45c07){return db[_0x4497('0x24')][_0x4497('0x41')]()['then'](respondWithResult(_0xd45c07,null))[_0x4497('0x3b')](handleError(_0xd45c07,null));}; \ No newline at end of file +var _0xece1=['limit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','include','VoiceDialReport','rows','catch','show','params','rawAttributes','keys','length','includeAll','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','fieldName','type','query','intersection','model','attributes','fields'];(function(_0x5bf840,_0x9fc2ab){var _0x4f4355=function(_0x5bef49){while(--_0x5bef49){_0x5bf840['push'](_0x5bf840['shift']());}};_0x4f4355(++_0x9fc2ab);}(_0xece1,0x138));var _0x1ece=function(_0x5d3f8d,_0x2e5fef){_0x5d3f8d=_0x5d3f8d-0x0;var _0x3a3e38=_0xece1[_0x5d3f8d];return _0x3a3e38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ece('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ece('0x1'));var rp=require(_0x1ece('0x2'));var moment=require(_0x1ece('0x3'));var BPromise=require(_0x1ece('0x4'));var Mustache=require(_0x1ece('0x5'));var util=require(_0x1ece('0x6'));var path=require(_0x1ece('0x7'));var sox=require(_0x1ece('0x8'));var csv=require(_0x1ece('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ece('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ece('0xb'));var jsforce=require(_0x1ece('0xc'));var deskjs=require(_0x1ece('0xd'));var toCsv=require(_0x1ece('0x9'));var querystring=require(_0x1ece('0xe'));var Papa=require('papaparse');var Redis=require(_0x1ece('0xf'));var authService=require(_0x1ece('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1ece('0x11'));var hardwareService=require(_0x1ece('0x12'));var logger=require(_0x1ece('0x13'))(_0x1ece('0x14'));var utils=require(_0x1ece('0x15'));var config=require(_0x1ece('0x16'));var licenseUtil=require(_0x1ece('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ef89c,_0x5421f6){_0x5421f6=_0x5421f6||0xcc;return function(_0x2085dc){if(_0x2085dc){return _0x4ef89c[_0x1ece('0x18')](_0x5421f6);}return _0x4ef89c[_0x1ece('0x19')](_0x5421f6)[_0x1ece('0x1a')]();};}function respondWithResult(_0x5e5d53,_0x418ec5){_0x418ec5=_0x418ec5||0xc8;return function(_0x56f372){if(_0x56f372){return _0x5e5d53[_0x1ece('0x19')](_0x418ec5)['json'](_0x56f372);}};}function respondWithFilteredResult(_0x3e2c46,_0x2a4575){return function(_0x254fed){if(_0x254fed){var _0x2b4751=typeof _0x2a4575['offset']===_0x1ece('0x1b')&&typeof _0x2a4575['limit']===_0x1ece('0x1b');var _0x4877cf=_0x254fed[_0x1ece('0x1c')];var _0xf4ce36=_0x2b4751?0x0:_0x2a4575[_0x1ece('0x1d')];var _0x23af00=_0x2b4751?_0x254fed[_0x1ece('0x1c')]:_0x2a4575[_0x1ece('0x1d')]+_0x2a4575['limit'];var _0x5ad70c;if(_0x23af00>=_0x4877cf){_0x23af00=_0x4877cf;_0x5ad70c=0xc8;}else{_0x5ad70c=0xce;}_0x3e2c46[_0x1ece('0x19')](_0x5ad70c);return _0x3e2c46[_0x1ece('0x1e')](_0x1ece('0x1f'),_0xf4ce36+'-'+_0x23af00+'/'+_0x4877cf)['json'](_0x254fed);}return null;};}function patchUpdates(_0x5230cc){return function(_0x4fc64f){try{jsonpatch[_0x1ece('0x20')](_0x4fc64f,_0x5230cc,!![]);}catch(_0x2767b1){return BPromise['reject'](_0x2767b1);}return _0x4fc64f['save']();};}function saveUpdates(_0x11689f,_0x2d6f33){return function(_0x252679){if(_0x252679){return _0x252679[_0x1ece('0x21')](_0x11689f)[_0x1ece('0x22')](function(_0x2afe83){return _0x2afe83;});}return null;};}function removeEntity(_0x5b757b,_0x39c13f){return function(_0x13732e){if(_0x13732e){return _0x13732e[_0x1ece('0x23')]()[_0x1ece('0x22')](function(){_0x5b757b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2a09,_0x3a8841){return function(_0x3cf4c2){if(!_0x3cf4c2){_0x3d2a09[_0x1ece('0x18')](0x194);}return _0x3cf4c2;};}function handleError(_0x20ef0d,_0x4f751b){_0x4f751b=_0x4f751b||0x1f4;return function(_0x3444ef){logger[_0x1ece('0x24')](_0x3444ef[_0x1ece('0x25')]);if(_0x3444ef[_0x1ece('0x26')]){delete _0x3444ef[_0x1ece('0x26')];}_0x20ef0d[_0x1ece('0x19')](_0x4f751b)[_0x1ece('0x27')](_0x3444ef);};}exports['index']=function(_0x5de92f,_0x20f029){var _0x15dd53={},_0x306389={},_0xbbc057={'count':0x0,'rows':[]};var _0x36fde6=_[_0x1ece('0x28')](db['VoiceDialReport']['rawAttributes'],function(_0x306147){return{'name':_0x306147[_0x1ece('0x29')],'type':_0x306147[_0x1ece('0x2a')]['key']};});_0x306389['model']=_[_0x1ece('0x28')](_0x36fde6,_0x1ece('0x26'));_0x306389[_0x1ece('0x2b')]=_['keys'](_0x5de92f[_0x1ece('0x2b')]);_0x306389['filters']=_[_0x1ece('0x2c')](_0x306389[_0x1ece('0x2d')],_0x306389[_0x1ece('0x2b')]);_0x15dd53[_0x1ece('0x2e')]=_['intersection'](_0x306389[_0x1ece('0x2d')],qs[_0x1ece('0x2f')](_0x5de92f['query'][_0x1ece('0x2f')]));_0x15dd53[_0x1ece('0x2e')]=_0x15dd53[_0x1ece('0x2e')]['length']?_0x15dd53[_0x1ece('0x2e')]:_0x306389[_0x1ece('0x2d')];if(!_0x5de92f[_0x1ece('0x2b')]['hasOwnProperty']('nolimit')){_0x15dd53[_0x1ece('0x30')]=qs[_0x1ece('0x30')](_0x5de92f[_0x1ece('0x2b')]['limit']);_0x15dd53[_0x1ece('0x1d')]=qs[_0x1ece('0x1d')](_0x5de92f[_0x1ece('0x2b')][_0x1ece('0x1d')]);}_0x15dd53[_0x1ece('0x31')]=qs[_0x1ece('0x32')](_0x5de92f[_0x1ece('0x2b')]['sort']);_0x15dd53['where']=qs['filters'](_[_0x1ece('0x33')](_0x5de92f[_0x1ece('0x2b')],_0x306389[_0x1ece('0x34')]),_0x36fde6);if(_0x5de92f[_0x1ece('0x2b')][_0x1ece('0x35')]){_0x15dd53['where']=_[_0x1ece('0x36')](_0x15dd53[_0x1ece('0x37')],{'$or':_[_0x1ece('0x28')](_0x36fde6,function(_0x3dd338){if(_0x3dd338[_0x1ece('0x2a')]!==_0x1ece('0x38')){var _0x111e03={};_0x111e03[_0x3dd338[_0x1ece('0x26')]]={'$like':'%'+_0x5de92f[_0x1ece('0x2b')]['filter']+'%'};return _0x111e03;}})});}_0x15dd53=_[_0x1ece('0x36')]({},_0x15dd53,_0x5de92f[_0x1ece('0x39')]);var _0x58a1e2={'where':_0x15dd53[_0x1ece('0x37')]};return db['VoiceDialReport'][_0x1ece('0x1c')](_0x58a1e2)[_0x1ece('0x22')](function(_0x2e768f){_0xbbc057[_0x1ece('0x1c')]=_0x2e768f;if(_0x5de92f['query']['includeAll']){_0x15dd53[_0x1ece('0x3a')]=[{'all':!![]}];}return db[_0x1ece('0x3b')]['findAll'](_0x15dd53);})[_0x1ece('0x22')](function(_0x42d4ed){_0xbbc057[_0x1ece('0x3c')]=_0x42d4ed;return _0xbbc057;})[_0x1ece('0x22')](respondWithFilteredResult(_0x20f029,_0x15dd53))[_0x1ece('0x3d')](handleError(_0x20f029,null));};exports[_0x1ece('0x3e')]=function(_0x4f9821,_0x92361c){var _0x44173a={'raw':!![],'where':{'id':_0x4f9821[_0x1ece('0x3f')]['id']}},_0x30224c={};_0x30224c[_0x1ece('0x2d')]=_['keys'](db['VoiceDialReport'][_0x1ece('0x40')]);_0x30224c[_0x1ece('0x2b')]=_[_0x1ece('0x41')](_0x4f9821[_0x1ece('0x2b')]);_0x30224c[_0x1ece('0x34')]=_['intersection'](_0x30224c[_0x1ece('0x2d')],_0x30224c[_0x1ece('0x2b')]);_0x44173a[_0x1ece('0x2e')]=_[_0x1ece('0x2c')](_0x30224c[_0x1ece('0x2d')],qs[_0x1ece('0x2f')](_0x4f9821['query'][_0x1ece('0x2f')]));_0x44173a['attributes']=_0x44173a['attributes'][_0x1ece('0x42')]?_0x44173a[_0x1ece('0x2e')]:_0x30224c[_0x1ece('0x2d')];if(_0x4f9821[_0x1ece('0x2b')][_0x1ece('0x43')]){_0x44173a[_0x1ece('0x3a')]=[{'all':!![]}];}_0x44173a=_['merge']({},_0x44173a,_0x4f9821['options']);return db[_0x1ece('0x3b')][_0x1ece('0x44')](_0x44173a)[_0x1ece('0x22')](handleEntityNotFound(_0x92361c,null))['then'](respondWithResult(_0x92361c,null))[_0x1ece('0x3d')](handleError(_0x92361c,null));};exports[_0x1ece('0x45')]=function(_0x2d55b2,_0x5e911a){return db[_0x1ece('0x3b')][_0x1ece('0x45')](_0x2d55b2['body'],{})['then'](respondWithResult(_0x5e911a,0xc9))[_0x1ece('0x3d')](handleError(_0x5e911a,null));};exports[_0x1ece('0x21')]=function(_0x389963,_0x28f96b){if(_0x389963[_0x1ece('0x46')]['id']){delete _0x389963[_0x1ece('0x46')]['id'];}return db[_0x1ece('0x3b')][_0x1ece('0x44')]({'where':{'id':_0x389963[_0x1ece('0x3f')]['id']}})[_0x1ece('0x22')](handleEntityNotFound(_0x28f96b,null))['then'](saveUpdates(_0x389963[_0x1ece('0x46')],null))[_0x1ece('0x22')](respondWithResult(_0x28f96b,null))[_0x1ece('0x3d')](handleError(_0x28f96b,null));};exports[_0x1ece('0x23')]=function(_0x4a1c90,_0x3fd588){return db[_0x1ece('0x3b')][_0x1ece('0x44')]({'where':{'id':_0x4a1c90[_0x1ece('0x3f')]['id']}})[_0x1ece('0x22')](handleEntityNotFound(_0x3fd588,null))['then'](removeEntity(_0x3fd588,null))['catch'](handleError(_0x3fd588,null));};exports[_0x1ece('0x47')]=function(_0x5f4a78,_0x481f0d){return db['VoiceDialReport'][_0x1ece('0x47')]()['then'](respondWithResult(_0x481f0d,null))[_0x1ece('0x3d')](handleError(_0x481f0d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1195972..cb07715 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 _0x38ec=['bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x38ec,0xfa));var _0xc38e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38ec[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc38e('0x0'));var util=require(_0xc38e('0x1'));var logger=require(_0xc38e('0x2'))(_0xc38e('0x3'));var moment=require(_0xc38e('0x4'));var BPromise=require(_0xc38e('0x5'));var rp=require(_0xc38e('0x6'));var fs=require('fs');var path=require(_0xc38e('0x7'));var rimraf=require(_0xc38e('0x8'));var config=require('../../config/environment');var attributes=require(_0xc38e('0x9'));module[_0xc38e('0xa')]=function(_0x1e9de4,_0x17e109){return _0x1e9de4[_0xc38e('0xb')](_0xc38e('0xc'),attributes,{'tableName':_0xc38e('0xd'),'paranoid':![],'indexes':[{'fields':[_0xc38e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1823=['lodash','api','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x1823,0xe6));var _0x3182=function(_0x3af76b,_0x3ff964){_0x3af76b=_0x3af76b-0x0;var _0x441064=_0x1823[_0x3af76b];return _0x441064;};'use strict';var _=require(_0x3182('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3182('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3182('0x2'));var fs=require('fs');var path=require(_0x3182('0x3'));var rimraf=require(_0x3182('0x4'));var config=require(_0x3182('0x5'));var attributes=require(_0x3182('0x6'));module['exports']=function(_0x2e45e4,_0xc8ba4c){return _0x2e45e4[_0x3182('0x7')](_0x3182('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x3182('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 86f457a..21d056c 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 _0xc30d=['raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','debug','stringify','error','code','message','catch','VoiceDialReport','create','body','options'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc30d,0xa8));var _0xdc30=function(_0x261d18,_0x13490f){_0x261d18=_0x261d18-0x0;var _0x3e7208=_0xc30d[_0x261d18];return _0x3e7208;};'use strict';var _=require(_0xdc30('0x0'));var util=require(_0xdc30('0x1'));var moment=require(_0xdc30('0x2'));var BPromise=require(_0xdc30('0x3'));var rs=require(_0xdc30('0x4'));var fs=require('fs');var Redis=require(_0xdc30('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc30('0x6'));var logger=require(_0xdc30('0x7'))('rpc');var config=require(_0xdc30('0x8'));var jayson=require(_0xdc30('0x9'));var client=jayson[_0xdc30('0xa')][_0xdc30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29d293,_0x22dd4e,_0xce0d5f){return new BPromise(function(_0x2dd759,_0xb54325){return client['request'](_0x29d293,_0xce0d5f)['then'](function(_0x57a524){logger[_0xdc30('0xc')](_0xdc30('0xd'),_0x22dd4e,'request\x20sent');logger[_0xdc30('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x22dd4e,'request\x20sent',JSON[_0xdc30('0xf')](_0x57a524));if(_0x57a524[_0xdc30('0x10')]){if(_0x57a524['error'][_0xdc30('0x11')]===0x1f4){logger[_0xdc30('0x10')](_0xdc30('0xd'),_0x22dd4e,_0x57a524[_0xdc30('0x10')][_0xdc30('0x12')]);return _0xb54325(_0x57a524[_0xdc30('0x10')][_0xdc30('0x12')]);}logger[_0xdc30('0x10')](_0xdc30('0xd'),_0x22dd4e,_0x57a524[_0xdc30('0x10')][_0xdc30('0x12')]);return _0x2dd759(_0x57a524[_0xdc30('0x10')][_0xdc30('0x12')]);}else{logger[_0xdc30('0xc')](_0xdc30('0xd'),_0x22dd4e,'request\x20sent');_0x2dd759(_0x57a524['result'][_0xdc30('0x12')]);}})[_0xdc30('0x13')](function(_0x7a398e){logger[_0xdc30('0x10')](_0xdc30('0xd'),_0x22dd4e,_0x7a398e);_0xb54325(_0x7a398e);});});}exports['CreateVoiceDialReport']=function(_0x501832){var _0x13edee=this;return new Promise(function(_0x4630b6,_0x24868e){return db[_0xdc30('0x14')][_0xdc30('0x15')](_0x501832[_0xdc30('0x16')],{'raw':_0x501832[_0xdc30('0x17')]?_0x501832[_0xdc30('0x17')][_0xdc30('0x18')]===undefined?!![]:![]:!![]})[_0xdc30('0x19')](function(_0x4aba9a){logger[_0xdc30('0xc')](_0xdc30('0x1a'),_0x501832);logger[_0xdc30('0xe')](_0xdc30('0x1a'),_0x501832,JSON[_0xdc30('0xf')](_0x4aba9a));_0x4630b6(_0x4aba9a);})[_0xdc30('0x13')](function(_0x5addc1){logger[_0xdc30('0x10')](_0xdc30('0x1a'),_0x5addc1['message'],_0x501832);_0x24868e(_0x13edee[_0xdc30('0x10')](0x1f4,_0x5addc1[_0xdc30('0x12')]));});});};exports[_0xdc30('0x1b')]=function(_0x98a78c){var _0x27c71d=this;return new Promise(function(_0x4386bb,_0x3c3fde){return db[_0xdc30('0x14')][_0xdc30('0x1c')](_0x98a78c[_0xdc30('0x16')],{'raw':_0x98a78c[_0xdc30('0x17')]?_0x98a78c[_0xdc30('0x17')][_0xdc30('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x98a78c[_0xdc30('0x17')]?_0x98a78c['options'][_0xdc30('0x1d')]||null:null,'attributes':_0x98a78c[_0xdc30('0x17')]?_0x98a78c['options'][_0xdc30('0x1e')]||null:null,'limit':_0x98a78c[_0xdc30('0x17')]?_0x98a78c[_0xdc30('0x17')][_0xdc30('0x1f')]||null:null})[_0xdc30('0x19')](function(_0x5caab6){logger[_0xdc30('0xc')](_0xdc30('0x1b'),_0x98a78c);logger[_0xdc30('0xe')](_0xdc30('0x1b'),_0x98a78c,JSON[_0xdc30('0xf')](_0x5caab6));_0x4386bb(_0x5caab6);})[_0xdc30('0x13')](function(_0x107bdb){logger[_0xdc30('0x10')]('UpdateVoiceDialReport',_0x107bdb[_0xdc30('0x12')],_0x98a78c);_0x3c3fde(_0x27c71d[_0xdc30('0x10')](0x1f4,_0x107bdb[_0xdc30('0x12')]));});});}; \ No newline at end of file +var _0x3ed7=['../../config/logger','rpc','jayson/promise','client','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceDialReport','create','options','raw','then','CreateVoiceDialReport','debug','UpdateVoiceDialReport','update','body','where','attributes','limit','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4dafa5,_0x31ab97){var _0x4ad399=function(_0x23ab56){while(--_0x23ab56){_0x4dafa5['push'](_0x4dafa5['shift']());}};_0x4ad399(++_0x31ab97);}(_0x3ed7,0x165));var _0x73ed=function(_0x54b1f7,_0x5724aa){_0x54b1f7=_0x54b1f7-0x0;var _0x2a069c=_0x3ed7[_0x54b1f7];return _0x2a069c;};'use strict';var _=require(_0x73ed('0x0'));var util=require('util');var moment=require(_0x73ed('0x1'));var BPromise=require(_0x73ed('0x2'));var rs=require(_0x73ed('0x3'));var fs=require('fs');var Redis=require(_0x73ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x73ed('0x5'));var logger=require(_0x73ed('0x6'))(_0x73ed('0x7'));var config=require('../../config/environment');var jayson=require(_0x73ed('0x8'));var client=jayson[_0x73ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7508bc,_0x1a7ce3,_0xce0e74){return new BPromise(function(_0x40c42c,_0x296ea3){return client[_0x73ed('0xa')](_0x7508bc,_0xce0e74)['then'](function(_0x2adf0c){logger[_0x73ed('0xb')](_0x73ed('0xc'),_0x1a7ce3,_0x73ed('0xd'));logger['debug'](_0x73ed('0xe'),_0x1a7ce3,'request\x20sent',JSON['stringify'](_0x2adf0c));if(_0x2adf0c['error']){if(_0x2adf0c[_0x73ed('0xf')][_0x73ed('0x10')]===0x1f4){logger['error'](_0x73ed('0xc'),_0x1a7ce3,_0x2adf0c[_0x73ed('0xf')][_0x73ed('0x11')]);return _0x296ea3(_0x2adf0c[_0x73ed('0xf')][_0x73ed('0x11')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x1a7ce3,_0x2adf0c[_0x73ed('0xf')]['message']);return _0x40c42c(_0x2adf0c['error'][_0x73ed('0x11')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x1a7ce3,_0x73ed('0xd'));_0x40c42c(_0x2adf0c[_0x73ed('0x12')][_0x73ed('0x11')]);}})['catch'](function(_0x170985){logger[_0x73ed('0xf')](_0x73ed('0xc'),_0x1a7ce3,_0x170985);_0x296ea3(_0x170985);});});}exports['CreateVoiceDialReport']=function(_0x8dd34a){var _0x18b890=this;return new Promise(function(_0x3284da,_0x29c79a){return db[_0x73ed('0x13')][_0x73ed('0x14')](_0x8dd34a['body'],{'raw':_0x8dd34a[_0x73ed('0x15')]?_0x8dd34a['options'][_0x73ed('0x16')]===undefined?!![]:![]:!![]})[_0x73ed('0x17')](function(_0x5799ac){logger['info'](_0x73ed('0x18'),_0x8dd34a);logger[_0x73ed('0x19')](_0x73ed('0x18'),_0x8dd34a,JSON['stringify'](_0x5799ac));_0x3284da(_0x5799ac);})['catch'](function(_0x2c1877){logger['error'](_0x73ed('0x18'),_0x2c1877[_0x73ed('0x11')],_0x8dd34a);_0x29c79a(_0x18b890['error'](0x1f4,_0x2c1877[_0x73ed('0x11')]));});});};exports[_0x73ed('0x1a')]=function(_0x575ade){var _0x49c94b=this;return new Promise(function(_0x3f602e,_0x156a33){return db[_0x73ed('0x13')][_0x73ed('0x1b')](_0x575ade[_0x73ed('0x1c')],{'raw':_0x575ade[_0x73ed('0x15')]?_0x575ade[_0x73ed('0x15')][_0x73ed('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x575ade[_0x73ed('0x15')]?_0x575ade['options'][_0x73ed('0x1d')]||null:null,'attributes':_0x575ade['options']?_0x575ade[_0x73ed('0x15')][_0x73ed('0x1e')]||null:null,'limit':_0x575ade[_0x73ed('0x15')]?_0x575ade[_0x73ed('0x15')][_0x73ed('0x1f')]||null:null})[_0x73ed('0x17')](function(_0x15e5f9){logger[_0x73ed('0xb')](_0x73ed('0x1a'),_0x575ade);logger[_0x73ed('0x19')](_0x73ed('0x1a'),_0x575ade,JSON[_0x73ed('0x20')](_0x15e5f9));_0x3f602e(_0x15e5f9);})['catch'](function(_0x4538dc){logger['error'](_0x73ed('0x1a'),_0x4538dc[_0x73ed('0x11')],_0x575ade);_0x156a33(_0x49c94b[_0x73ed('0xf')](0x1f4,_0x4538dc[_0x73ed('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 68c2f46..0e16963 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 _0x710d=['create','/:id/applications','addApplications','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post'];(function(_0x1ebc6c,_0x58a00b){var _0x3a826d=function(_0x27d7eb){while(--_0x27d7eb){_0x1ebc6c['push'](_0x1ebc6c['shift']());}};_0x3a826d(++_0x58a00b);}(_0x710d,0x9d));var _0xd710=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0x710d[_0x15fc7a];return _0x3aa9f4;};'use strict';var multer=require(_0xd710('0x0'));var util=require(_0xd710('0x1'));var path=require('path');var timeout=require(_0xd710('0x2'));var express=require(_0xd710('0x3'));var router=express[_0xd710('0x4')]();var fs_extra=require(_0xd710('0x5'));var auth=require(_0xd710('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd710('0x7'));var controller=require(_0xd710('0x8'));router[_0xd710('0x9')]('/',auth[_0xd710('0xa')](),controller['index']);router['get'](_0xd710('0xb'),auth[_0xd710('0xa')](),controller[_0xd710('0xc')]);router[_0xd710('0xd')]('/',auth[_0xd710('0xa')](),controller[_0xd710('0xe')]);router[_0xd710('0xd')](_0xd710('0xf'),auth[_0xd710('0xa')](),controller[_0xd710('0x10')]);router['put'](_0xd710('0xb'),auth[_0xd710('0xa')](),controller[_0xd710('0x11')]);router[_0xd710('0x12')](_0xd710('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4369=['../../components/auth/service','../../config/environment','./voiceExtension.controller','isAuthenticated','get','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','Router'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x4369,0xc3));var _0x9436=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x4369[_0x8ae98b];return _0xc30bd4;};'use strict';var multer=require(_0x9436('0x0'));var util=require(_0x9436('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9436('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9436('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9436('0x4'));var controller=require(_0x9436('0x5'));router['get']('/',auth[_0x9436('0x6')](),controller['index']);router[_0x9436('0x7')](_0x9436('0x8'),auth[_0x9436('0x6')](),controller[_0x9436('0x9')]);router[_0x9436('0xa')]('/',auth[_0x9436('0x6')](),controller[_0x9436('0xb')]);router[_0x9436('0xa')](_0x9436('0xc'),auth[_0x9436('0x6')](),controller[_0x9436('0xd')]);router[_0x9436('0xe')](_0x9436('0x8'),auth[_0x9436('0x6')](),controller['update']);router[_0x9436('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9436('0x10')]);module[_0x9436('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 8390d0e..23373c6 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 _0x0713=['STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten'];(function(_0x1359b1,_0x5336ce){var _0x190f7d=function(_0x2bc217){while(--_0x2bc217){_0x1359b1['push'](_0x1359b1['shift']());}};_0x190f7d(++_0x5336ce);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(_0x4a8cc7){return this['getDataValue'](_0x3071('0x10'));}}}; \ No newline at end of file +var _0xb10b=['system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','inbound','outbound','inbound-fax','outbound-fax'];(function(_0x19c939,_0x25c861){var _0x6e28b9=function(_0xc00467){while(--_0xc00467){_0x19c939['push'](_0x19c939['shift']());}};_0x6e28b9(++_0x25c861);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a397d,_0x5bab1f){_0x4a397d=_0x4a397d-0x0;var _0x316571=_0xb10b[_0x4a397d];return _0x316571;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'context':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xbb10('0x2')},'tag':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'defaultValue':_0xbb10('0x3')},'appdata':{'type':Sequelize[_0xbb10('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xbb10('0x4'),_0xbb10('0x5'),'internal',_0xbb10('0x6'),_0xbb10('0x7'),_0xbb10('0x8'),_0xbb10('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xbb10('0x1')]},'interval':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'defaultValue':_0xbb10('0xa')},'IntervalId':{'type':Sequelize[_0xbb10('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xbb10('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xbb10('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xbb10('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xbb10('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xbb10('0xe')],'get':function(_0x916a32){return this[_0xbb10('0xf')](_0xbb10('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 80ee1d1..34cb799 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 _0x26bc=['user','get','role','InboundRoutes','InternalRoutes','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','recordingFormat','cutdigits','addApplications','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','reject','save','update','destroy','then','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','startsWith','body','exten','create'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x26bc,0x162));var _0xc26b=function(_0xc0e309,_0x2dde6b){_0xc0e309=_0xc0e309-0x0;var _0x182fd2=_0x26bc[_0xc0e309];return _0x182fd2;};'use strict';var emlformat=require(_0xc26b('0x0'));var rimraf=require(_0xc26b('0x1'));var zipdir=require(_0xc26b('0x2'));var jsonpatch=require(_0xc26b('0x3'));var rp=require(_0xc26b('0x4'));var moment=require('moment');var BPromise=require(_0xc26b('0x5'));var Mustache=require(_0xc26b('0x6'));var util=require(_0xc26b('0x7'));var path=require('path');var sox=require(_0xc26b('0x8'));var csv=require('to-csv');var ejs=require(_0xc26b('0x9'));var fs=require('fs');var fs_extra=require(_0xc26b('0xa'));var _=require(_0xc26b('0xb'));var squel=require('squel');var crypto=require(_0xc26b('0xc'));var jsforce=require(_0xc26b('0xd'));var deskjs=require(_0xc26b('0xe'));var toCsv=require(_0xc26b('0xf'));var querystring=require(_0xc26b('0x10'));var Papa=require(_0xc26b('0x11'));var Redis=require(_0xc26b('0x12'));var authService=require(_0xc26b('0x13'));var qs=require(_0xc26b('0x14'));var as=require(_0xc26b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc26b('0x16'))(_0xc26b('0x17'));var utils=require(_0xc26b('0x18'));var config=require(_0xc26b('0x19'));var licenseUtil=require(_0xc26b('0x1a'));var db=require(_0xc26b('0x1b'))['db'];config['redis']=_[_0xc26b('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc26b('0x1d'))(new Redis(config[_0xc26b('0x1e')]));require(_0xc26b('0x1f'))[_0xc26b('0x20')](socket);function respondWithStatusCode(_0x4b692b,_0x2c36c2){_0x2c36c2=_0x2c36c2||0xcc;return function(_0x2ee630){if(_0x2ee630){return _0x4b692b[_0xc26b('0x21')](_0x2c36c2);}return _0x4b692b[_0xc26b('0x22')](_0x2c36c2)[_0xc26b('0x23')]();};}function respondWithResult(_0x34e006,_0x4dc407){_0x4dc407=_0x4dc407||0xc8;return function(_0x248645){if(_0x248645){return _0x34e006[_0xc26b('0x22')](_0x4dc407)['json'](_0x248645);}};}function respondWithFilteredResult(_0x1dba27,_0x488688){return function(_0x4802c7){if(_0x4802c7){var _0x7e6ed0=typeof _0x488688['offset']===_0xc26b('0x24')&&typeof _0x488688[_0xc26b('0x25')]===_0xc26b('0x24');var _0x9d9098=_0x4802c7['count'];var _0x1c7f1b=_0x7e6ed0?0x0:_0x488688[_0xc26b('0x26')];var _0x2523b5=_0x7e6ed0?_0x4802c7[_0xc26b('0x27')]:_0x488688[_0xc26b('0x26')]+_0x488688[_0xc26b('0x25')];var _0x4f90f3;if(_0x2523b5>=_0x9d9098){_0x2523b5=_0x9d9098;_0x4f90f3=0xc8;}else{_0x4f90f3=0xce;}_0x1dba27[_0xc26b('0x22')](_0x4f90f3);return _0x1dba27['set'](_0xc26b('0x28'),_0x1c7f1b+'-'+_0x2523b5+'/'+_0x9d9098)[_0xc26b('0x29')](_0x4802c7);}return null;};}function patchUpdates(_0x282928){return function(_0x2327e6){try{jsonpatch['apply'](_0x2327e6,_0x282928,!![]);}catch(_0x261d3c){return BPromise[_0xc26b('0x2a')](_0x261d3c);}return _0x2327e6[_0xc26b('0x2b')]();};}function saveUpdates(_0x465bdd,_0x5bdf6b){return function(_0x379cdb){if(_0x379cdb){return _0x379cdb[_0xc26b('0x2c')](_0x465bdd)['then'](function(_0x4c0095){return _0x4c0095;});}return null;};}function removeEntity(_0x203374,_0x1bb8e5){return function(_0x3eab6c){if(_0x3eab6c){return _0x3eab6c[_0xc26b('0x2d')]()[_0xc26b('0x2e')](function(){var _0x20a84f=_0x3eab6c['get']({'plain':!![]});var _0x3eea3b=[{'name':'InboundRoutes','value':_0xc26b('0x2f'),'ignore':![]},{'name':_0xc26b('0x30'),'value':_0xc26b('0x31'),'ignore':![]},{'name':'InternalRoutes','value':_0xc26b('0x32'),'ignore':![]}];var _0x3459d3=_(_0x3eea3b)[_0xc26b('0x33')](_0xc26b('0x34'))[_0xc26b('0x35')](_0xc26b('0x36'))['value']();if(_[_0xc26b('0x37')](_0x3459d3,_0x20a84f['type'])){return;}var _0x2f7db7=_['find'](_0x3eea3b,['value',_0x20a84f[_0xc26b('0x38')]])[_0xc26b('0x39')];return db[_0xc26b('0x3a')]['destroy']({'where':{'type':_0x2f7db7,'resourceId':_0x20a84f['id']}})[_0xc26b('0x2e')](function(){return _0x3eab6c;});})[_0xc26b('0x2e')](function(){_0x203374['status'](0xcc)[_0xc26b('0x23')]();});}};}function handleEntityNotFound(_0x764fef,_0x16fc15){return function(_0x197634){if(!_0x197634){_0x764fef[_0xc26b('0x21')](0x194);}return _0x197634;};}function handleError(_0x1a17bd,_0x110ad6){_0x110ad6=_0x110ad6||0x1f4;return function(_0x128c11){logger[_0xc26b('0x3b')](_0x128c11[_0xc26b('0x3c')]);if(_0x128c11['name']){delete _0x128c11[_0xc26b('0x39')];}_0x1a17bd['status'](_0x110ad6)[_0xc26b('0x3d')](_0x128c11);};}exports[_0xc26b('0x3e')]=function(_0x5d3ca3,_0x69e8ca){var _0x150fab={},_0x3c3fa7={},_0x93a49d={'count':0x0,'rows':[]};var _0x270bbf=_[_0xc26b('0x35')](db[_0xc26b('0x3f')][_0xc26b('0x40')],function(_0xb8a2a0){return{'name':_0xb8a2a0[_0xc26b('0x41')],'type':_0xb8a2a0['type'][_0xc26b('0x42')]};});_0x3c3fa7[_0xc26b('0x43')]=_[_0xc26b('0x35')](_0x270bbf,_0xc26b('0x39'));_0x3c3fa7[_0xc26b('0x44')]=_[_0xc26b('0x45')](_0x5d3ca3[_0xc26b('0x44')]);_0x3c3fa7[_0xc26b('0x46')]=_[_0xc26b('0x47')](_0x3c3fa7[_0xc26b('0x43')],_0x3c3fa7[_0xc26b('0x44')]);_0x150fab[_0xc26b('0x48')]=_[_0xc26b('0x47')](_0x3c3fa7[_0xc26b('0x43')],qs[_0xc26b('0x49')](_0x5d3ca3['query'][_0xc26b('0x49')]));_0x150fab['attributes']=_0x150fab[_0xc26b('0x48')][_0xc26b('0x4a')]?_0x150fab['attributes']:_0x3c3fa7['model'];if(!_0x5d3ca3[_0xc26b('0x44')][_0xc26b('0x4b')](_0xc26b('0x4c'))){_0x150fab['limit']=qs['limit'](_0x5d3ca3[_0xc26b('0x44')][_0xc26b('0x25')]);_0x150fab[_0xc26b('0x26')]=qs[_0xc26b('0x26')](_0x5d3ca3[_0xc26b('0x44')][_0xc26b('0x26')]);}_0x150fab[_0xc26b('0x4d')]=qs[_0xc26b('0x4e')](_0x5d3ca3[_0xc26b('0x44')][_0xc26b('0x4e')]);_0x150fab[_0xc26b('0x4f')]=qs['filters'](_[_0xc26b('0x50')](_0x5d3ca3[_0xc26b('0x44')],_0x3c3fa7[_0xc26b('0x46')]),_0x270bbf);if(_0x5d3ca3[_0xc26b('0x44')]['filter']){_0x150fab['where']=_[_0xc26b('0x51')](_0x150fab['where'],{'$or':_[_0xc26b('0x35')](_0x270bbf,function(_0x3346ef){if(_0x3346ef[_0xc26b('0x38')]!==_0xc26b('0x52')){var _0x46b39d={};_0x46b39d[_0x3346ef[_0xc26b('0x39')]]={'$like':'%'+_0x5d3ca3[_0xc26b('0x44')]['filter']+'%'};return _0x46b39d;}})});}_0x150fab=_['merge']({},_0x150fab,_0x5d3ca3[_0xc26b('0x53')]);var _0x20c538={'where':_0x150fab[_0xc26b('0x4f')]};return db[_0xc26b('0x3f')]['count'](_0x20c538)[_0xc26b('0x2e')](function(_0x4a1b11){_0x93a49d[_0xc26b('0x27')]=_0x4a1b11;if(_0x5d3ca3[_0xc26b('0x44')][_0xc26b('0x54')]){_0x150fab[_0xc26b('0x55')]=[{'all':!![]}];}return db[_0xc26b('0x3f')]['findAll'](_0x150fab);})[_0xc26b('0x2e')](function(_0x54e260){_0x93a49d[_0xc26b('0x56')]=_0x54e260;return _0x93a49d;})[_0xc26b('0x2e')](respondWithFilteredResult(_0x69e8ca,_0x150fab))[_0xc26b('0x57')](handleError(_0x69e8ca,null));};exports[_0xc26b('0x58')]=function(_0x55e14b,_0x59cb41){var _0x1feb27={'raw':![],'where':{'id':_0x55e14b['params']['id']}},_0x5f22c8={};_0x5f22c8[_0xc26b('0x43')]=_[_0xc26b('0x45')](db[_0xc26b('0x3f')][_0xc26b('0x40')]);_0x5f22c8[_0xc26b('0x44')]=_[_0xc26b('0x45')](_0x55e14b[_0xc26b('0x44')]);_0x5f22c8[_0xc26b('0x46')]=_[_0xc26b('0x47')](_0x5f22c8[_0xc26b('0x43')],_0x5f22c8[_0xc26b('0x44')]);_0x1feb27[_0xc26b('0x48')]=_[_0xc26b('0x47')](_0x5f22c8[_0xc26b('0x43')],qs['fields'](_0x55e14b['query'][_0xc26b('0x49')]));_0x1feb27[_0xc26b('0x48')]=_0x1feb27[_0xc26b('0x48')][_0xc26b('0x4a')]?_0x1feb27['attributes']:_0x5f22c8[_0xc26b('0x43')];if(_0x55e14b['query'][_0xc26b('0x54')]){_0x1feb27[_0xc26b('0x55')]=[{'all':!![]}];}_0x1feb27=_['merge']({},_0x1feb27,_0x55e14b[_0xc26b('0x53')]);return db['VoiceExtension']['find'](_0x1feb27)['then'](handleEntityNotFound(_0x59cb41,null))['then'](respondWithResult(_0x59cb41,null))[_0xc26b('0x57')](handleError(_0x59cb41,null));};exports[_0xc26b('0x2d')]=function(_0xf294f9,_0x2290ee){return db['VoiceExtension']['find']({'where':{'id':_0xf294f9[_0xc26b('0x59')]['id']}})['then'](handleEntityNotFound(_0x2290ee,null))[_0xc26b('0x2e')](removeEntity(_0x2290ee,null))[_0xc26b('0x57')](handleError(_0x2290ee,null));};exports['create']=function(_0x304070,_0x3ab92a){if(_0x304070['body'][_0xc26b('0x38')]===_0xc26b('0x31')&&!_[_0xc26b('0x5a')](_0x304070[_0xc26b('0x5b')][_0xc26b('0x5c')],'_')){_0x304070[_0xc26b('0x5b')][_0xc26b('0x5c')]='_'['concat'](_0x304070[_0xc26b('0x5b')][_0xc26b('0x5c')]);}return db[_0xc26b('0x3f')][_0xc26b('0x5d')](_0x304070[_0xc26b('0x5b')],{'raw':![]})[_0xc26b('0x2e')](function(_0x2d56b8){var _0xcb7bb1=_0x304070[_0xc26b('0x5e')][_0xc26b('0x5f')]({'plain':!![]});if(!_0xcb7bb1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcb7bb1[_0xc26b('0x60')]===_0xc26b('0x5e')){var _0x14ec36=_0x2d56b8[_0xc26b('0x5f')]({'plain':!![]});var _0x29abb7=[{'name':_0xc26b('0x61'),'value':_0xc26b('0x2f')},{'name':_0xc26b('0x30'),'value':_0xc26b('0x31')},{'name':_0xc26b('0x62'),'value':_0xc26b('0x32')}];var _0x544853=_['find'](_0x29abb7,[_0xc26b('0x36'),_0x14ec36['type']])[_0xc26b('0x39')];return db[_0xc26b('0x63')][_0xc26b('0x64')]({'where':{'name':_0x544853,'userProfileId':_0xcb7bb1[_0xc26b('0x65')]},'raw':!![]})['then'](function(_0x214e68){if(_0x214e68&&_0x214e68[_0xc26b('0x66')]===0x0){return db[_0xc26b('0x3a')][_0xc26b('0x5d')]({'name':_0x14ec36[_0xc26b('0x39')],'resourceId':_0x14ec36['id'],'type':_0x214e68[_0xc26b('0x39')],'sectionId':_0x214e68['id']},{})['then'](function(){return _0x2d56b8;});}else{return _0x2d56b8;}})[_0xc26b('0x57')](function(_0x19cf43){logger['error'](_0xc26b('0x67'),_0x19cf43);throw _0x19cf43;});}return _0x2d56b8;})[_0xc26b('0x2e')](respondWithResult(_0x3ab92a,0xc9))[_0xc26b('0x57')](handleError(_0x3ab92a,null));};exports[_0xc26b('0x2c')]=function(_0x1f6945,_0x5f7777){if(_0x1f6945[_0xc26b('0x5b')]['id']){delete _0x1f6945[_0xc26b('0x5b')]['id'];}return db[_0xc26b('0x3f')][_0xc26b('0x64')]({'where':{'id':_0x1f6945['params']['id']}})[_0xc26b('0x2e')](handleEntityNotFound(_0x5f7777,null))['then'](function(_0x4e99e7){if(_0x4e99e7){return db[_0xc26b('0x3f')][_0xc26b('0x2c')](_[_0xc26b('0x50')](_0x1f6945[_0xc26b('0x5b')],[_0xc26b('0x5c'),'context','description',_0xc26b('0x68'),_0xc26b('0x69'),'mandatoryDisposition']),{'where':{'context':_0x4e99e7['context'],'exten':_0x4e99e7[_0xc26b('0x5c')]},'individualHooks':!![]})['then'](function(_0x59aa7c){return _0x59aa7c;});}return null;})['then'](respondWithStatusCode(_0x5f7777,null))[_0xc26b('0x57')](handleError(_0x5f7777,null));};exports[_0xc26b('0x6a')]=function(_0x365dd9,_0xd5f27d,_0x5223e3){return db[_0xc26b('0x3f')]['findOne']({'where':{'id':_0x365dd9[_0xc26b('0x59')]['id']}})[_0xc26b('0x2e')](handleEntityNotFound(_0xd5f27d,null))[_0xc26b('0x2e')](function(_0xd5ab2d){if(_0xd5ab2d){return db['sequelize'][_0xc26b('0x6b')](function(_0x49aa32){return db[_0xc26b('0x3f')][_0xc26b('0x2d')]({'where':{'VoiceExtensionId':_0x365dd9[_0xc26b('0x59')]['id']},'transaction':_0x49aa32})[_0xc26b('0x2e')](function(_0x397d21){var _0x138826=_[_0xc26b('0x35')](_0x365dd9[_0xc26b('0x5b')],function(_0x1aab78){_0x1aab78[_0xc26b('0x6c')]=_0x365dd9['params']['id'];return _0x1aab78;});return db[_0xc26b('0x3f')][_0xc26b('0x6d')](_0x138826,{'transaction':_0x49aa32});});})[_0xc26b('0x2e')](function(){return db[_0xc26b('0x3f')][_0xc26b('0x6e')]({'where':{'isApp':!![],'VoiceExtensionId':_0x365dd9[_0xc26b('0x59')]['id']},'order':_0xc26b('0x6f')});});}})[_0xc26b('0x2e')](respondWithResult(_0xd5f27d,null))[_0xc26b('0x57')](handleError(_0xd5f27d,null));}; \ No newline at end of file +var _0x6753=['UserProfileResource','error','stack','send','VoiceExtension','rawAttributes','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','outbound','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','userProfileId','autoAssociation','pick','description','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','map','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','count','apply','reject','save','update','then','destroy','inbound','OutboundRoutes','InternalRoutes','internal','filter','value','includes','type','find','name'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x6753,0xa1));var _0x3675=function(_0x27ca6c,_0x2747b6){_0x27ca6c=_0x27ca6c-0x0;var _0x4a9b74=_0x6753[_0x27ca6c];return _0x4a9b74;};'use strict';var emlformat=require(_0x3675('0x0'));var rimraf=require(_0x3675('0x1'));var zipdir=require(_0x3675('0x2'));var jsonpatch=require(_0x3675('0x3'));var rp=require('request-promise');var moment=require(_0x3675('0x4'));var BPromise=require(_0x3675('0x5'));var Mustache=require('mustache');var util=require(_0x3675('0x6'));var path=require(_0x3675('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3675('0x8'));var _=require(_0x3675('0x9'));var squel=require(_0x3675('0xa'));var crypto=require(_0x3675('0xb'));var jsforce=require(_0x3675('0xc'));var deskjs=require(_0x3675('0xd'));var toCsv=require(_0x3675('0xe'));var querystring=require(_0x3675('0xf'));var Papa=require(_0x3675('0x10'));var Redis=require(_0x3675('0x11'));var authService=require(_0x3675('0x12'));var qs=require(_0x3675('0x13'));var as=require(_0x3675('0x14'));var hardwareService=require(_0x3675('0x15'));var logger=require('../../config/logger')(_0x3675('0x16'));var utils=require(_0x3675('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3675('0x18'));var db=require(_0x3675('0x19'))['db'];config[_0x3675('0x1a')]=_[_0x3675('0x1b')](config[_0x3675('0x1a')],{'host':_0x3675('0x1c'),'port':0x18eb});var socket=require(_0x3675('0x1d'))(new Redis(config['redis']));require(_0x3675('0x1e'))[_0x3675('0x1f')](socket);function respondWithStatusCode(_0x1297e2,_0x4add5e){_0x4add5e=_0x4add5e||0xcc;return function(_0x51fc88){if(_0x51fc88){return _0x1297e2[_0x3675('0x20')](_0x4add5e);}return _0x1297e2[_0x3675('0x21')](_0x4add5e)[_0x3675('0x22')]();};}function respondWithResult(_0x27e5bb,_0x510233){_0x510233=_0x510233||0xc8;return function(_0x3bf7c5){if(_0x3bf7c5){return _0x27e5bb[_0x3675('0x21')](_0x510233)[_0x3675('0x23')](_0x3bf7c5);}};}function respondWithFilteredResult(_0x22e7ce,_0x2adb30){return function(_0x5940bf){if(_0x5940bf){var _0x43f041=typeof _0x2adb30[_0x3675('0x24')]==='undefined'&&typeof _0x2adb30[_0x3675('0x25')]==='undefined';var _0x49292b=_0x5940bf[_0x3675('0x26')];var _0x54d793=_0x43f041?0x0:_0x2adb30['offset'];var _0x3d1067=_0x43f041?_0x5940bf[_0x3675('0x26')]:_0x2adb30[_0x3675('0x24')]+_0x2adb30['limit'];var _0x448515;if(_0x3d1067>=_0x49292b){_0x3d1067=_0x49292b;_0x448515=0xc8;}else{_0x448515=0xce;}_0x22e7ce[_0x3675('0x21')](_0x448515);return _0x22e7ce['set']('Content-Range',_0x54d793+'-'+_0x3d1067+'/'+_0x49292b)['json'](_0x5940bf);}return null;};}function patchUpdates(_0x129078){return function(_0x31a404){try{jsonpatch[_0x3675('0x27')](_0x31a404,_0x129078,!![]);}catch(_0x45f57){return BPromise[_0x3675('0x28')](_0x45f57);}return _0x31a404[_0x3675('0x29')]();};}function saveUpdates(_0x3a9499,_0x5ca335){return function(_0x29d9e7){if(_0x29d9e7){return _0x29d9e7[_0x3675('0x2a')](_0x3a9499)[_0x3675('0x2b')](function(_0x53f77e){return _0x53f77e;});}return null;};}function removeEntity(_0x5cffde,_0x16637e){return function(_0x461fc9){if(_0x461fc9){return _0x461fc9[_0x3675('0x2c')]()[_0x3675('0x2b')](function(){var _0x2a9e65=_0x461fc9['get']({'plain':!![]});var _0x49afa9=[{'name':'InboundRoutes','value':_0x3675('0x2d'),'ignore':![]},{'name':_0x3675('0x2e'),'value':'outbound','ignore':![]},{'name':_0x3675('0x2f'),'value':_0x3675('0x30'),'ignore':![]}];var _0x2088b0=_(_0x49afa9)[_0x3675('0x31')]('ignore')['map'](_0x3675('0x32'))['value']();if(_[_0x3675('0x33')](_0x2088b0,_0x2a9e65[_0x3675('0x34')])){return;}var _0x5f3d76=_[_0x3675('0x35')](_0x49afa9,['value',_0x2a9e65[_0x3675('0x34')]])[_0x3675('0x36')];return db[_0x3675('0x37')][_0x3675('0x2c')]({'where':{'type':_0x5f3d76,'resourceId':_0x2a9e65['id']}})['then'](function(){return _0x461fc9;});})[_0x3675('0x2b')](function(){_0x5cffde[_0x3675('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5870,_0x150a77){return function(_0x136286){if(!_0x136286){_0x2a5870['sendStatus'](0x194);}return _0x136286;};}function handleError(_0x1878a9,_0x1b4be8){_0x1b4be8=_0x1b4be8||0x1f4;return function(_0x5360dc){logger[_0x3675('0x38')](_0x5360dc[_0x3675('0x39')]);if(_0x5360dc[_0x3675('0x36')]){delete _0x5360dc[_0x3675('0x36')];}_0x1878a9[_0x3675('0x21')](_0x1b4be8)[_0x3675('0x3a')](_0x5360dc);};}exports['index']=function(_0x31a322,_0x2ad5d8){var _0x178355={},_0x2fe420={},_0x1da58d={'count':0x0,'rows':[]};var _0x237eb4=_['map'](db[_0x3675('0x3b')][_0x3675('0x3c')],function(_0x26fa7e){return{'name':_0x26fa7e['fieldName'],'type':_0x26fa7e[_0x3675('0x34')][_0x3675('0x3d')]};});_0x2fe420['model']=_['map'](_0x237eb4,_0x3675('0x36'));_0x2fe420[_0x3675('0x3e')]=_['keys'](_0x31a322[_0x3675('0x3e')]);_0x2fe420[_0x3675('0x3f')]=_[_0x3675('0x40')](_0x2fe420['model'],_0x2fe420[_0x3675('0x3e')]);_0x178355[_0x3675('0x41')]=_[_0x3675('0x40')](_0x2fe420[_0x3675('0x42')],qs[_0x3675('0x43')](_0x31a322['query'][_0x3675('0x43')]));_0x178355['attributes']=_0x178355['attributes'][_0x3675('0x44')]?_0x178355[_0x3675('0x41')]:_0x2fe420[_0x3675('0x42')];if(!_0x31a322[_0x3675('0x3e')]['hasOwnProperty'](_0x3675('0x45'))){_0x178355[_0x3675('0x25')]=qs[_0x3675('0x25')](_0x31a322[_0x3675('0x3e')][_0x3675('0x25')]);_0x178355[_0x3675('0x24')]=qs[_0x3675('0x24')](_0x31a322[_0x3675('0x3e')][_0x3675('0x24')]);}_0x178355[_0x3675('0x46')]=qs['sort'](_0x31a322[_0x3675('0x3e')]['sort']);_0x178355['where']=qs[_0x3675('0x3f')](_['pick'](_0x31a322[_0x3675('0x3e')],_0x2fe420[_0x3675('0x3f')]),_0x237eb4);if(_0x31a322['query'][_0x3675('0x31')]){_0x178355['where']=_[_0x3675('0x47')](_0x178355[_0x3675('0x48')],{'$or':_['map'](_0x237eb4,function(_0x379ea0){if(_0x379ea0[_0x3675('0x34')]!==_0x3675('0x49')){var _0x44c194={};_0x44c194[_0x379ea0[_0x3675('0x36')]]={'$like':'%'+_0x31a322['query'][_0x3675('0x31')]+'%'};return _0x44c194;}})});}_0x178355=_[_0x3675('0x47')]({},_0x178355,_0x31a322[_0x3675('0x4a')]);var _0xc31fba={'where':_0x178355['where']};return db[_0x3675('0x3b')][_0x3675('0x26')](_0xc31fba)[_0x3675('0x2b')](function(_0x370950){_0x1da58d['count']=_0x370950;if(_0x31a322['query'][_0x3675('0x4b')]){_0x178355[_0x3675('0x4c')]=[{'all':!![]}];}return db[_0x3675('0x3b')][_0x3675('0x4d')](_0x178355);})[_0x3675('0x2b')](function(_0x5765ba){_0x1da58d[_0x3675('0x4e')]=_0x5765ba;return _0x1da58d;})[_0x3675('0x2b')](respondWithFilteredResult(_0x2ad5d8,_0x178355))[_0x3675('0x4f')](handleError(_0x2ad5d8,null));};exports['show']=function(_0x4272a3,_0x31c622){var _0x28f689={'raw':![],'where':{'id':_0x4272a3[_0x3675('0x50')]['id']}},_0x4cc4f5={};_0x4cc4f5['model']=_[_0x3675('0x51')](db[_0x3675('0x3b')][_0x3675('0x3c')]);_0x4cc4f5[_0x3675('0x3e')]=_[_0x3675('0x51')](_0x4272a3[_0x3675('0x3e')]);_0x4cc4f5[_0x3675('0x3f')]=_['intersection'](_0x4cc4f5[_0x3675('0x42')],_0x4cc4f5[_0x3675('0x3e')]);_0x28f689['attributes']=_[_0x3675('0x40')](_0x4cc4f5['model'],qs[_0x3675('0x43')](_0x4272a3[_0x3675('0x3e')][_0x3675('0x43')]));_0x28f689[_0x3675('0x41')]=_0x28f689['attributes']['length']?_0x28f689[_0x3675('0x41')]:_0x4cc4f5[_0x3675('0x42')];if(_0x4272a3['query']['includeAll']){_0x28f689[_0x3675('0x4c')]=[{'all':!![]}];}_0x28f689=_[_0x3675('0x47')]({},_0x28f689,_0x4272a3[_0x3675('0x4a')]);return db[_0x3675('0x3b')]['find'](_0x28f689)['then'](handleEntityNotFound(_0x31c622,null))[_0x3675('0x2b')](respondWithResult(_0x31c622,null))[_0x3675('0x4f')](handleError(_0x31c622,null));};exports[_0x3675('0x2c')]=function(_0x1ab5cc,_0x44e543){return db[_0x3675('0x3b')]['find']({'where':{'id':_0x1ab5cc[_0x3675('0x50')]['id']}})['then'](handleEntityNotFound(_0x44e543,null))[_0x3675('0x2b')](removeEntity(_0x44e543,null))[_0x3675('0x4f')](handleError(_0x44e543,null));};exports[_0x3675('0x52')]=function(_0x1a5c7f,_0x4064fd){if(_0x1a5c7f[_0x3675('0x53')][_0x3675('0x34')]===_0x3675('0x54')&&!_[_0x3675('0x55')](_0x1a5c7f[_0x3675('0x53')][_0x3675('0x56')],'_')){_0x1a5c7f[_0x3675('0x53')][_0x3675('0x56')]='_'[_0x3675('0x57')](_0x1a5c7f['body'][_0x3675('0x56')]);}return db['VoiceExtension']['create'](_0x1a5c7f[_0x3675('0x53')],{'raw':![]})[_0x3675('0x2b')](function(_0x196ce2){var _0x4309d6=_0x1a5c7f[_0x3675('0x58')][_0x3675('0x59')]({'plain':!![]});if(!_0x4309d6)throw new Error(_0x3675('0x5a'));if(_0x4309d6['role']==='user'){var _0x1ec557=_0x196ce2['get']({'plain':!![]});var _0x3a8202=[{'name':_0x3675('0x5b'),'value':_0x3675('0x2d')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x3675('0x30')}];var _0x1443a0=_[_0x3675('0x35')](_0x3a8202,[_0x3675('0x32'),_0x1ec557[_0x3675('0x34')]])['name'];return db['UserProfileSection'][_0x3675('0x35')]({'where':{'name':_0x1443a0,'userProfileId':_0x4309d6[_0x3675('0x5c')]},'raw':!![]})[_0x3675('0x2b')](function(_0x18d8bd){if(_0x18d8bd&&_0x18d8bd[_0x3675('0x5d')]===0x0){return db['UserProfileResource'][_0x3675('0x52')]({'name':_0x1ec557[_0x3675('0x36')],'resourceId':_0x1ec557['id'],'type':_0x18d8bd[_0x3675('0x36')],'sectionId':_0x18d8bd['id']},{})[_0x3675('0x2b')](function(){return _0x196ce2;});}else{return _0x196ce2;}})[_0x3675('0x4f')](function(_0x3b1b22){logger[_0x3675('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b1b22);throw _0x3b1b22;});}return _0x196ce2;})[_0x3675('0x2b')](respondWithResult(_0x4064fd,0xc9))['catch'](handleError(_0x4064fd,null));};exports[_0x3675('0x2a')]=function(_0x164bc4,_0x5cb98c){if(_0x164bc4[_0x3675('0x53')]['id']){delete _0x164bc4[_0x3675('0x53')]['id'];}return db[_0x3675('0x3b')]['find']({'where':{'id':_0x164bc4[_0x3675('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cb98c,null))[_0x3675('0x2b')](function(_0x2caa1c){if(_0x2caa1c){return db[_0x3675('0x3b')][_0x3675('0x2a')](_[_0x3675('0x5e')](_0x164bc4[_0x3675('0x53')],['exten','context',_0x3675('0x5f'),_0x3675('0x60'),_0x3675('0x61'),_0x3675('0x62')]),{'where':{'context':_0x2caa1c[_0x3675('0x63')],'exten':_0x2caa1c[_0x3675('0x56')]},'individualHooks':!![]})[_0x3675('0x2b')](function(_0x515ca0){return _0x515ca0;});}return null;})[_0x3675('0x2b')](respondWithStatusCode(_0x5cb98c,null))['catch'](handleError(_0x5cb98c,null));};exports[_0x3675('0x64')]=function(_0x10b74c,_0x21c531,_0x25cde0){return db[_0x3675('0x3b')][_0x3675('0x65')]({'where':{'id':_0x10b74c['params']['id']}})['then'](handleEntityNotFound(_0x21c531,null))[_0x3675('0x2b')](function(_0x49de7e){if(_0x49de7e){return db[_0x3675('0x66')]['transaction'](function(_0x1fcd18){return db['VoiceExtension'][_0x3675('0x2c')]({'where':{'VoiceExtensionId':_0x10b74c['params']['id']},'transaction':_0x1fcd18})['then'](function(_0x33251f){var _0xdf153c=_[_0x3675('0x67')](_0x10b74c[_0x3675('0x53')],function(_0x39354a){_0x39354a[_0x3675('0x68')]=_0x10b74c[_0x3675('0x50')]['id'];return _0x39354a;});return db['VoiceExtension'][_0x3675('0x69')](_0xdf153c,{'transaction':_0x1fcd18});});})[_0x3675('0x2b')](function(){return db['VoiceExtension'][_0x3675('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x10b74c[_0x3675('0x50')]['id']},'order':_0x3675('0x6b')});});}})[_0x3675('0x2b')](respondWithResult(_0x21c531,null))['catch'](handleError(_0x21c531,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e92ab3d..c441739 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 _0xb7ab=['emit','hasOwnProperty','hook','exports','events','VoiceExtension','update','remove'];(function(_0x19a4ae,_0x21054a){var _0x13b6c3=function(_0x4e3294){while(--_0x4e3294){_0x19a4ae['push'](_0x19a4ae['shift']());}};_0x13b6c3(++_0x21054a);}(_0xb7ab,0xcc));var _0xbb7a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb7ab[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xbb7a('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xbb7a('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb7a('0x2'),'afterDestroy':_0xbb7a('0x3')};function emitEvent(_0x715378){return function(_0x8a6134,_0x41bbf2,_0x50c7ba){VoiceExtensionEvents[_0xbb7a('0x4')](_0x715378+':'+_0x8a6134['id'],_0x8a6134);VoiceExtensionEvents[_0xbb7a('0x4')](_0x715378,_0x8a6134);_0x50c7ba(null);};}for(var e in events){if(events[_0xbb7a('0x5')](e)){var event=events[e];VoiceExtension[_0xbb7a('0x6')](e,emitEvent(event));}}module[_0xbb7a('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x4b55=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','VoiceExtension'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x4b55,0x7e));var _0x54b5=function(_0x1ef6c8,_0x9878c6){_0x1ef6c8=_0x1ef6c8-0x0;var _0x69c967=_0x4b55[_0x1ef6c8];return _0x69c967;};'use strict';var EventEmitter=require(_0x54b5('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x54b5('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x54b5('0x2')](0x0);var events={'afterCreate':_0x54b5('0x3'),'afterUpdate':'update','afterDestroy':_0x54b5('0x4')};function emitEvent(_0x26fe48){return function(_0x591be2,_0xf9a453,_0x1f9585){VoiceExtensionEvents[_0x54b5('0x5')](_0x26fe48+':'+_0x591be2['id'],_0x591be2);VoiceExtensionEvents[_0x54b5('0x5')](_0x26fe48,_0x591be2);_0x1f9585(null);};}for(var e in events){if(events[_0x54b5('0x6')](e)){var event=events[e];VoiceExtension[_0x54b5('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 8ccaa1b..3a4c0d5 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 _0x8c14=['./voiceExtension.attributes','exports','VoiceExtension','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x714d84,_0x1b8294){var _0x568510=function(_0x16ab97){while(--_0x16ab97){_0x714d84['push'](_0x714d84['shift']());}};_0x568510(++_0x1b8294);}(_0x8c14,0x1d9));var _0x48c1=function(_0x49c0b2,_0xe6dd8b){_0x49c0b2=_0x49c0b2-0x0;var _0xf5afc=_0x8c14[_0x49c0b2];return _0xf5afc;};'use strict';var _=require(_0x48c1('0x0'));var util=require('util');var logger=require(_0x48c1('0x1'))('api');var moment=require(_0x48c1('0x2'));var BPromise=require(_0x48c1('0x3'));var rp=require(_0x48c1('0x4'));var fs=require('fs');var path=require(_0x48c1('0x5'));var rimraf=require(_0x48c1('0x6'));var config=require('../../config/environment');var attributes=require(_0x48c1('0x7'));module[_0x48c1('0x8')]=function(_0x3140c8,_0x21fb2e){return _0x3140c8['define'](_0x48c1('0x9'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6f5=['bluebird','request-promise','path','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','lodash','util','../../config/logger','api','moment'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0xe6f5,0x10f));var _0x5e6f=function(_0x1013a3,_0x156610){_0x1013a3=_0x1013a3-0x0;var _0x2e7886=_0xe6f5[_0x1013a3];return _0x2e7886;};'use strict';var _=require(_0x5e6f('0x0'));var util=require(_0x5e6f('0x1'));var logger=require(_0x5e6f('0x2'))(_0x5e6f('0x3'));var moment=require(_0x5e6f('0x4'));var BPromise=require(_0x5e6f('0x5'));var rp=require(_0x5e6f('0x6'));var fs=require('fs');var path=require(_0x5e6f('0x7'));var rimraf=require('rimraf');var config=require(_0x5e6f('0x8'));var attributes=require(_0x5e6f('0x9'));module[_0x5e6f('0xa')]=function(_0x276b41,_0x3fedcc){return _0x276b41['define'](_0x5e6f('0xb'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2784b79..c36cd45 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 _0x06bf=['map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','request','then','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','VoiceExtension,\x20%s,\x20%s','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','raw','options','where','attributes','limit','include','model'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x06bf,0x105));var _0xf06b=function(_0x39d7c1,_0x3f1d0a){_0x39d7c1=_0x39d7c1-0x0;var _0x5ac8c2=_0x06bf[_0x39d7c1];return _0x5ac8c2;};'use strict';var _=require(_0xf06b('0x0'));var util=require(_0xf06b('0x1'));var moment=require(_0xf06b('0x2'));var BPromise=require(_0xf06b('0x3'));var rs=require(_0xf06b('0x4'));var fs=require('fs');var Redis=require(_0xf06b('0x5'));var db=require(_0xf06b('0x6'))['db'];var utils=require(_0xf06b('0x7'));var logger=require('../../config/logger')(_0xf06b('0x8'));var config=require(_0xf06b('0x9'));var jayson=require(_0xf06b('0xa'));var client=jayson['client'][_0xf06b('0xb')]({'port':0x232a});config[_0xf06b('0xc')]=_[_0xf06b('0xd')](config[_0xf06b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf06b('0xe'))(new Redis(config[_0xf06b('0xc')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x222824,_0x2f41d3,_0x151581){return new BPromise(function(_0x40773e,_0x2823b1){return client[_0xf06b('0xf')](_0x222824,_0x151581)[_0xf06b('0x10')](function(_0x12d627){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x2f41d3,'request\x20sent');logger[_0xf06b('0x11')](_0xf06b('0x12'),_0x2f41d3,'request\x20sent',JSON['stringify'](_0x12d627));if(_0x12d627[_0xf06b('0x13')]){if(_0x12d627[_0xf06b('0x13')]['code']===0x1f4){logger[_0xf06b('0x13')](_0xf06b('0x14'),_0x2f41d3,_0x12d627[_0xf06b('0x13')]['message']);return _0x2823b1(_0x12d627[_0xf06b('0x13')][_0xf06b('0x15')]);}logger[_0xf06b('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x2f41d3,_0x12d627[_0xf06b('0x13')][_0xf06b('0x15')]);return _0x40773e(_0x12d627[_0xf06b('0x13')][_0xf06b('0x15')]);}else{logger[_0xf06b('0x16')](_0xf06b('0x14'),_0x2f41d3,'request\x20sent');_0x40773e(_0x12d627[_0xf06b('0x17')][_0xf06b('0x15')]);}})[_0xf06b('0x18')](function(_0x486aea){logger[_0xf06b('0x13')](_0xf06b('0x14'),_0x2f41d3,_0x486aea);_0x2823b1(_0x486aea);});});}exports[_0xf06b('0x19')]=function(_0xb9b03e){var _0x2be4b8=this;return new Promise(function(_0xa991cb,_0x18a6d9){return db[_0xf06b('0x1a')][_0xf06b('0x1b')]({'raw':_0xb9b03e['options']?_0xb9b03e['options'][_0xf06b('0x1c')]===undefined?!![]:![]:!![],'where':_0xb9b03e[_0xf06b('0x1d')]?_0xb9b03e['options'][_0xf06b('0x1e')]||null:null,'attributes':_0xb9b03e[_0xf06b('0x1d')]?_0xb9b03e[_0xf06b('0x1d')][_0xf06b('0x1f')]||null:null,'limit':_0xb9b03e[_0xf06b('0x1d')]?_0xb9b03e['options'][_0xf06b('0x20')]||null:null,'include':_0xb9b03e['options']?_0xb9b03e[_0xf06b('0x1d')][_0xf06b('0x21')]?_['map'](_0xb9b03e[_0xf06b('0x1d')]['include'],function(_0x305f63){return{'model':db[_0x305f63[_0xf06b('0x22')]],'as':_0x305f63['as'],'attributes':_0x305f63['attributes'],'include':_0x305f63['include']?_[_0xf06b('0x23')](_0x305f63[_0xf06b('0x21')],function(_0x553f85){return{'model':db[_0x553f85['model']],'as':_0x553f85['as'],'attributes':_0x553f85['attributes'],'include':_0x553f85['include']?_[_0xf06b('0x23')](_0x553f85[_0xf06b('0x21')],function(_0x4eff77){return{'model':db[_0x4eff77[_0xf06b('0x22')]],'as':_0x4eff77['as'],'attributes':_0x4eff77[_0xf06b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf06b('0x10')](function(_0x3815dc){logger[_0xf06b('0x16')](_0xf06b('0x19'),_0xb9b03e);logger['debug'](_0xf06b('0x19'),_0xb9b03e,JSON[_0xf06b('0x24')](_0x3815dc));_0xa991cb(_0x3815dc);})['catch'](function(_0x57cae3){logger[_0xf06b('0x13')]('GetVoiceExtension',_0x57cae3[_0xf06b('0x15')],_0xb9b03e);_0x18a6d9(_0x2be4b8[_0xf06b('0x13')](0x1f4,_0x57cae3[_0xf06b('0x15')]));});});}; \ No newline at end of file +var _0xe7de=['attributes','limit','map','include','model','GetVoiceExtension','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceExtension','options','raw','where'];(function(_0x304bf7,_0x4fcafc){var _0x5036cd=function(_0x39e810){while(--_0x39e810){_0x304bf7['push'](_0x304bf7['shift']());}};_0x5036cd(++_0x4fcafc);}(_0xe7de,0x165));var _0xee7d=function(_0x13c69f,_0x5ababd){_0x13c69f=_0x13c69f-0x0;var _0x3c8778=_0xe7de[_0x13c69f];return _0x3c8778;};'use strict';var _=require(_0xee7d('0x0'));var util=require(_0xee7d('0x1'));var moment=require(_0xee7d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee7d('0x3'));var db=require(_0xee7d('0x4'))['db'];var utils=require(_0xee7d('0x5'));var logger=require(_0xee7d('0x6'))(_0xee7d('0x7'));var config=require(_0xee7d('0x8'));var jayson=require(_0xee7d('0x9'));var client=jayson[_0xee7d('0xa')][_0xee7d('0xb')]({'port':0x232a});config[_0xee7d('0xc')]=_[_0xee7d('0xd')](config[_0xee7d('0xc')],{'host':_0xee7d('0xe'),'port':0x18eb});var socket=require(_0xee7d('0xf'))(new Redis(config['redis']));require(_0xee7d('0x10'))[_0xee7d('0x11')](socket);function respondWithRpcPromise(_0x44e6ef,_0x474c53,_0x146172){return new BPromise(function(_0x36e00f,_0x598421){return client[_0xee7d('0x12')](_0x44e6ef,_0x146172)['then'](function(_0x1bf8af){logger[_0xee7d('0x13')](_0xee7d('0x14'),_0x474c53,_0xee7d('0x15'));logger[_0xee7d('0x16')](_0xee7d('0x17'),_0x474c53,_0xee7d('0x15'),JSON[_0xee7d('0x18')](_0x1bf8af));if(_0x1bf8af[_0xee7d('0x19')]){if(_0x1bf8af[_0xee7d('0x19')][_0xee7d('0x1a')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x474c53,_0x1bf8af[_0xee7d('0x19')][_0xee7d('0x1b')]);return _0x598421(_0x1bf8af[_0xee7d('0x19')][_0xee7d('0x1b')]);}logger[_0xee7d('0x19')](_0xee7d('0x14'),_0x474c53,_0x1bf8af['error'][_0xee7d('0x1b')]);return _0x36e00f(_0x1bf8af[_0xee7d('0x19')][_0xee7d('0x1b')]);}else{logger[_0xee7d('0x13')](_0xee7d('0x14'),_0x474c53,_0xee7d('0x15'));_0x36e00f(_0x1bf8af['result'][_0xee7d('0x1b')]);}})[_0xee7d('0x1c')](function(_0x3facfb){logger['error'](_0xee7d('0x14'),_0x474c53,_0x3facfb);_0x598421(_0x3facfb);});});}exports['GetVoiceExtension']=function(_0x1ef8ea){var _0x34209e=this;return new Promise(function(_0x2eb283,_0x4f6445){return db[_0xee7d('0x1d')]['findAll']({'raw':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea[_0xee7d('0x1e')][_0xee7d('0x1f')]===undefined?!![]:![]:!![],'where':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea['options'][_0xee7d('0x20')]||null:null,'attributes':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea[_0xee7d('0x1e')][_0xee7d('0x21')]||null:null,'limit':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea[_0xee7d('0x1e')][_0xee7d('0x22')]||null:null,'include':_0x1ef8ea[_0xee7d('0x1e')]?_0x1ef8ea[_0xee7d('0x1e')]['include']?_[_0xee7d('0x23')](_0x1ef8ea[_0xee7d('0x1e')][_0xee7d('0x24')],function(_0x576d56){return{'model':db[_0x576d56[_0xee7d('0x25')]],'as':_0x576d56['as'],'attributes':_0x576d56[_0xee7d('0x21')],'include':_0x576d56[_0xee7d('0x24')]?_[_0xee7d('0x23')](_0x576d56[_0xee7d('0x24')],function(_0x1b4492){return{'model':db[_0x1b4492[_0xee7d('0x25')]],'as':_0x1b4492['as'],'attributes':_0x1b4492[_0xee7d('0x21')],'include':_0x1b4492[_0xee7d('0x24')]?_['map'](_0x1b4492[_0xee7d('0x24')],function(_0x4e1bf5){return{'model':db[_0x4e1bf5['model']],'as':_0x4e1bf5['as'],'attributes':_0x4e1bf5[_0xee7d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x151094){logger[_0xee7d('0x13')]('GetVoiceExtension',_0x1ef8ea);logger[_0xee7d('0x16')](_0xee7d('0x26'),_0x1ef8ea,JSON[_0xee7d('0x18')](_0x151094));_0x2eb283(_0x151094);})[_0xee7d('0x1c')](function(_0xcbfec4){logger['error'](_0xee7d('0x26'),_0xcbfec4[_0xee7d('0x1b')],_0x1ef8ea);_0x4f6445(_0x34209e[_0xee7d('0x19')](0x1f4,_0xcbfec4[_0xee7d('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 13fcff1..58cbdf1 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0xbe5218,_0x1ba294){var _0x2fc66a=function(_0xd18f2e){while(--_0xd18f2e){_0xbe5218['push'](_0xbe5218['shift']());}};_0x2fc66a(++_0x1ba294);}(_0xe14b,0x93));var _0xbe14=function(_0x12cb90,_0xdab1f9){_0x12cb90=_0x12cb90-0x0;var _0x952309=_0xe14b[_0x12cb90];return _0x952309;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x127860,_0x3392c8){var _0x4f40ec=function(_0x3029a0){while(--_0x3029a0){_0x127860['push'](_0x127860['shift']());}};_0x4f40ec(++_0x3392c8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x5fc3[_0x4de1b1];return _0x639f27;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 88677e4..af12a6f 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 _0x0424=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x0424,0x159));var _0x4042=function(_0x47bc58,_0x1e1998){_0x47bc58=_0x47bc58-0x0;var _0x4a0860=_0x0424[_0x47bc58];return _0x4a0860;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['show']);router['get'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xb')]);router['post']('/',auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);router[_0x4042('0xf')](_0x4042('0x9'),auth['isAuthenticated'](),controller[_0x4042('0x10')]);module[_0x4042('0x11')]=router; \ No newline at end of file +var _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3a0b6c,_0x3c0569){var _0x1872f1=function(_0x3ebcf8){while(--_0x3ebcf8){_0x3a0b6c['push'](_0x3a0b6c['shift']());}};_0x1872f1(++_0x3c0569);}(_0x7880,0x1f4));var _0x0788=function(_0x2aa4c8,_0x1f65b4){_0x2aa4c8=_0x2aa4c8-0x0;var _0x29edb8=_0x7880[_0x2aa4c8];return _0x29edb8;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 74d3655..ce1910d 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 _0x7fc3=['yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','STRING','from-voicemail','setDataValue','email','string','trim','central','ENUM'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7fc3,0x1e4));var _0x37fc=function(_0x5c01f9,_0x370926){_0x5c01f9=_0x5c01f9-0x0;var _0xc38767=_0x7fc3[_0x5c01f9];return _0xc38767;};'use strict';var Sequelize=require(_0x37fc('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x37fc('0x1')],'defaultValue':_0x37fc('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x37fc('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x37fc('0x1')]},'email':{'type':Sequelize[_0x37fc('0x1')],'validate':{'isEmail':!![]},'set':function(_0x31c3cf){this[_0x37fc('0x3')](_0x37fc('0x4'),typeof _0x31c3cf===_0x37fc('0x5')&&_0x31c3cf[_0x37fc('0x6')]()?_0x31c3cf[_0x37fc('0x6')]():null);}},'pager':{'type':Sequelize[_0x37fc('0x1')]},'tz':{'type':Sequelize[_0x37fc('0x1')],'defaultValue':_0x37fc('0x7')},'attach':{'type':Sequelize[_0x37fc('0x8')](_0x37fc('0x9'),'no'),'defaultValue':_0x37fc('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x37fc('0x8')](_0x37fc('0x9'),'no'),'defaultValue':_0x37fc('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x37fc('0x1')]},'review':{'type':Sequelize[_0x37fc('0x8')](_0x37fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x37fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x37fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x37fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x37fc('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x37fc('0x8')](_0x37fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x37fc('0x8')](_0x37fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x37fc('0x8')](_0x37fc('0x9'),'no'),'defaultValue':_0x37fc('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x37fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x37fc('0x8')](_0x37fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x37fc('0x8')](_0x37fc('0x9'),'no'),'defaultValue':_0x37fc('0x9'),'allowNull':![]},'stamp':{'type':_0x37fc('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x37fc('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x37fc('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x37fc('0xd')],'get':function(){return this[_0x37fc('0xe')](_0x37fc('0xf'))+'\x20-\x20'+this[_0x37fc('0xe')](_0x37fc('0x10'));}}}; \ No newline at end of file +var _0xf2a9=['trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string'];(function(_0x599d3f,_0x157b5c){var _0x39648a=function(_0x10864e){while(--_0x10864e){_0x599d3f['push'](_0x599d3f['shift']());}};_0x39648a(++_0x157b5c);}(_0xf2a9,0x1bb));var _0x9f2a=function(_0x2f177f,_0x712d2c){_0x2f177f=_0x2f177f-0x0;var _0x51b60b=_0xf2a9[_0x2f177f];return _0x51b60b;};'use strict';var Sequelize=require(_0x9f2a('0x0'));module[_0x9f2a('0x1')]={'customer_id':{'type':Sequelize[_0x9f2a('0x2')]},'context':{'type':Sequelize[_0x9f2a('0x2')],'defaultValue':_0x9f2a('0x3'),'unique':_0x9f2a('0x4')},'mailbox':{'type':Sequelize[_0x9f2a('0x2')],'defaultValue':'','allowNull':![],'unique':_0x9f2a('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x9f2a('0x2')]},'email':{'type':Sequelize[_0x9f2a('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2ff3c3){this['setDataValue'](_0x9f2a('0x5'),typeof _0x2ff3c3===_0x9f2a('0x6')&&_0x2ff3c3[_0x9f2a('0x7')]()?_0x2ff3c3[_0x9f2a('0x7')]():null);}},'pager':{'type':Sequelize[_0x9f2a('0x2')]},'tz':{'type':Sequelize[_0x9f2a('0x2')],'defaultValue':_0x9f2a('0x8')},'attach':{'type':Sequelize['ENUM'](_0x9f2a('0x9'),'no'),'defaultValue':_0x9f2a('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x9f2a('0xa')](_0x9f2a('0x9'),'no'),'defaultValue':_0x9f2a('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9f2a('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x9f2a('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9f2a('0xa')](_0x9f2a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x9f2a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9f2a('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9f2a('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9f2a('0xa')](_0x9f2a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9f2a('0xa')](_0x9f2a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9f2a('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x9f2a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9f2a('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x9f2a('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x9f2a('0xc')},'emailsubject':{'type':Sequelize[_0x9f2a('0x2')]},'emailbody':{'type':Sequelize[_0x9f2a('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9f2a('0xd')],'get':function(){return this[_0x9f2a('0xe')](_0x9f2a('0xf'))+_0x9f2a('0x10')+this['getDataValue'](_0x9f2a('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 323c49d..1c3fb8c 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 _0x4fc2=['nolimit','mailbox','VoiceMailMessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','get','Voicemails','UserProfileResource','stack','name','send','map','VoiceMail','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne'];(function(_0x26a9e8,_0x57a6e1){var _0x4c1d12=function(_0x213ac9){while(--_0x213ac9){_0x26a9e8['push'](_0x26a9e8['shift']());}};_0x4c1d12(++_0x57a6e1);}(_0x4fc2,0x111));var _0x24fc=function(_0x53755d,_0x4f705f){_0x53755d=_0x53755d-0x0;var _0x512b5b=_0x4fc2[_0x53755d];return _0x512b5b;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];function respondWithStatusCode(_0x5cc65e,_0x306873){_0x306873=_0x306873||0xcc;return function(_0x76cb25){if(_0x76cb25){return _0x5cc65e[_0x24fc('0x1b')](_0x306873);}return _0x5cc65e[_0x24fc('0x1c')](_0x306873)[_0x24fc('0x1d')]();};}function respondWithResult(_0x326276,_0x537b5c){_0x537b5c=_0x537b5c||0xc8;return function(_0x2a0971){if(_0x2a0971){return _0x326276[_0x24fc('0x1c')](_0x537b5c)[_0x24fc('0x1e')](_0x2a0971);}};}function respondWithFilteredResult(_0x42cbe8,_0x4acd36){return function(_0x2ac989){if(_0x2ac989){var _0x588543=typeof _0x4acd36[_0x24fc('0x1f')]===_0x24fc('0x20')&&typeof _0x4acd36[_0x24fc('0x21')]===_0x24fc('0x20');var _0x25cb40=_0x2ac989['count'];var _0x23873c=_0x588543?0x0:_0x4acd36[_0x24fc('0x1f')];var _0x6cfa0a=_0x588543?_0x2ac989[_0x24fc('0x22')]:_0x4acd36['offset']+_0x4acd36[_0x24fc('0x21')];var _0x4073e0;if(_0x6cfa0a>=_0x25cb40){_0x6cfa0a=_0x25cb40;_0x4073e0=0xc8;}else{_0x4073e0=0xce;}_0x42cbe8[_0x24fc('0x1c')](_0x4073e0);return _0x42cbe8['set'](_0x24fc('0x23'),_0x23873c+'-'+_0x6cfa0a+'/'+_0x25cb40)[_0x24fc('0x1e')](_0x2ac989);}return null;};}function patchUpdates(_0xbf1d6b){return function(_0x2d0e3d){try{jsonpatch['apply'](_0x2d0e3d,_0xbf1d6b,!![]);}catch(_0x323beb){return BPromise['reject'](_0x323beb);}return _0x2d0e3d[_0x24fc('0x24')]();};}function saveUpdates(_0x591c8f,_0x3ed464){return function(_0x44c121){if(_0x44c121){return _0x44c121[_0x24fc('0x25')](_0x591c8f)['then'](function(_0x313a25){return _0x313a25;});}return null;};}function removeEntity(_0x552035,_0x35a9c7){return function(_0x2bb93a){if(_0x2bb93a){return _0x2bb93a[_0x24fc('0x26')]()[_0x24fc('0x27')](function(){var _0x3296fc=_0x2bb93a[_0x24fc('0x28')]({'plain':!![]});var _0x3f0875=_0x24fc('0x29');return db[_0x24fc('0x2a')][_0x24fc('0x26')]({'where':{'type':_0x3f0875,'resourceId':_0x3296fc['id']}})['then'](function(){return _0x2bb93a;});})[_0x24fc('0x27')](function(){_0x552035[_0x24fc('0x1c')](0xcc)[_0x24fc('0x1d')]();});}};}function handleEntityNotFound(_0x5bb4c8,_0xf2f77d){return function(_0x3d1ec8){if(!_0x3d1ec8){_0x5bb4c8[_0x24fc('0x1b')](0x194);}return _0x3d1ec8;};}function handleError(_0x290f84,_0x8f2528){_0x8f2528=_0x8f2528||0x1f4;return function(_0x443796){logger['error'](_0x443796[_0x24fc('0x2b')]);if(_0x443796[_0x24fc('0x2c')]){delete _0x443796[_0x24fc('0x2c')];}_0x290f84[_0x24fc('0x1c')](_0x8f2528)[_0x24fc('0x2d')](_0x443796);};}exports['index']=function(_0x55c27f,_0x4e6f73){var _0x3df6f4={},_0x574ba3={},_0x3f2464={'count':0x0,'rows':[]};var _0x3e6389=_[_0x24fc('0x2e')](db[_0x24fc('0x2f')]['rawAttributes'],function(_0x66eec0){return{'name':_0x66eec0[_0x24fc('0x30')],'type':_0x66eec0['type'][_0x24fc('0x31')]};});_0x574ba3[_0x24fc('0x32')]=_['map'](_0x3e6389,'name');_0x574ba3[_0x24fc('0x33')]=_['keys'](_0x55c27f[_0x24fc('0x33')]);_0x574ba3[_0x24fc('0x34')]=_['intersection'](_0x574ba3[_0x24fc('0x32')],_0x574ba3[_0x24fc('0x33')]);_0x3df6f4[_0x24fc('0x35')]=_[_0x24fc('0x36')](_0x574ba3[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x37')]));_0x3df6f4[_0x24fc('0x35')]=_0x3df6f4['attributes'][_0x24fc('0x38')]?_0x3df6f4[_0x24fc('0x35')]:_0x574ba3[_0x24fc('0x32')];if(!_0x55c27f[_0x24fc('0x33')][_0x24fc('0x39')]('nolimit')){_0x3df6f4['limit']=qs[_0x24fc('0x21')](_0x55c27f['query'][_0x24fc('0x21')]);_0x3df6f4[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x55c27f[_0x24fc('0x33')]['offset']);}_0x3df6f4[_0x24fc('0x3a')]=qs['sort'](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3b')]);_0x3df6f4[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x55c27f['query'],_0x574ba3[_0x24fc('0x34')]),_0x3e6389);if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]){_0x3df6f4[_0x24fc('0x3c')]=_['merge'](_0x3df6f4[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0x3e6389,function(_0x56306e){if(_0x56306e[_0x24fc('0x3f')]!=='VIRTUAL'){var _0x320f7b={};_0x320f7b[_0x56306e[_0x24fc('0x2c')]]={'$like':'%'+_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]+'%'};return _0x320f7b;}})});}_0x3df6f4=_[_0x24fc('0x40')]({},_0x3df6f4,_0x55c27f[_0x24fc('0x41')]);var _0x77b959={'where':_0x3df6f4[_0x24fc('0x3c')]};return db['VoiceMail'][_0x24fc('0x22')](_0x77b959)[_0x24fc('0x27')](function(_0x32f72c){_0x3f2464['count']=_0x32f72c;if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x42')]){_0x3df6f4['include']=[{'all':!![]}];}return db[_0x24fc('0x2f')][_0x24fc('0x43')](_0x3df6f4);})[_0x24fc('0x27')](function(_0x5e4e9b){_0x3f2464[_0x24fc('0x44')]=_0x5e4e9b;return _0x3f2464;})[_0x24fc('0x27')](respondWithFilteredResult(_0x4e6f73,_0x3df6f4))['catch'](handleError(_0x4e6f73,null));};exports[_0x24fc('0x45')]=function(_0x169982,_0x158f7b){var _0x2a0ac4={'raw':!![],'where':{'id':_0x169982[_0x24fc('0x46')]['id']}},_0x4c8dad={};_0x4c8dad[_0x24fc('0x32')]=_[_0x24fc('0x47')](db[_0x24fc('0x2f')][_0x24fc('0x48')]);_0x4c8dad['query']=_[_0x24fc('0x47')](_0x169982[_0x24fc('0x33')]);_0x4c8dad[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x4c8dad['model'],_0x4c8dad[_0x24fc('0x33')]);_0x2a0ac4[_0x24fc('0x35')]=_['intersection'](_0x4c8dad['model'],qs[_0x24fc('0x37')](_0x169982['query']['fields']));_0x2a0ac4[_0x24fc('0x35')]=_0x2a0ac4['attributes'][_0x24fc('0x38')]?_0x2a0ac4[_0x24fc('0x35')]:_0x4c8dad[_0x24fc('0x32')];if(_0x169982['query'][_0x24fc('0x42')]){_0x2a0ac4[_0x24fc('0x49')]=[{'all':!![]}];}_0x2a0ac4=_[_0x24fc('0x40')]({},_0x2a0ac4,_0x169982[_0x24fc('0x41')]);return db[_0x24fc('0x2f')][_0x24fc('0x4a')](_0x2a0ac4)[_0x24fc('0x27')](handleEntityNotFound(_0x158f7b,null))[_0x24fc('0x27')](respondWithResult(_0x158f7b,null))['catch'](handleError(_0x158f7b,null));};exports['create']=function(_0x266378,_0x2f1a99){return db[_0x24fc('0x2f')]['create'](_0x266378['body'],{})[_0x24fc('0x27')](function(_0x213439){var _0x179a60=_0x266378[_0x24fc('0x4b')][_0x24fc('0x28')]({'plain':!![]});if(!_0x179a60)throw new Error(_0x24fc('0x4c'));if(_0x179a60[_0x24fc('0x4d')]===_0x24fc('0x4b')){var _0x1671b0=_0x213439[_0x24fc('0x28')]({'plain':!![]});var _0x434700=_0x24fc('0x29');return db['UserProfileSection'][_0x24fc('0x4a')]({'where':{'name':_0x434700,'userProfileId':_0x179a60[_0x24fc('0x4e')]},'raw':!![]})[_0x24fc('0x27')](function(_0xb0fc00){if(_0xb0fc00&&_0xb0fc00[_0x24fc('0x4f')]===0x0){return db['UserProfileResource'][_0x24fc('0x50')]({'name':_0x1671b0['name'],'resourceId':_0x1671b0['id'],'type':_0xb0fc00[_0x24fc('0x2c')],'sectionId':_0xb0fc00['id']},{})[_0x24fc('0x27')](function(){return _0x213439;});}else{return _0x213439;}})[_0x24fc('0x51')](function(_0x41ddfb){logger[_0x24fc('0x52')](_0x24fc('0x53'),_0x41ddfb);throw _0x41ddfb;});}return _0x213439;})['then'](respondWithResult(_0x2f1a99,0xc9))[_0x24fc('0x51')](handleError(_0x2f1a99,null));};exports[_0x24fc('0x25')]=function(_0xc49d9f,_0x31a2ef){if(_0xc49d9f[_0x24fc('0x54')]['id']){delete _0xc49d9f[_0x24fc('0x54')]['id'];}return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xc49d9f[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x31a2ef,null))[_0x24fc('0x27')](saveUpdates(_0xc49d9f[_0x24fc('0x54')],null))[_0x24fc('0x27')](respondWithResult(_0x31a2ef,null))[_0x24fc('0x51')](handleError(_0x31a2ef,null));};exports['destroy']=function(_0xd673f8,_0x11690f){return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xd673f8[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x11690f,null))[_0x24fc('0x27')](removeEntity(_0x11690f,null))[_0x24fc('0x51')](handleError(_0x11690f,null));};exports[_0x24fc('0x55')]=function(_0x50302e,_0x28a44c,_0x4a0524){return db[_0x24fc('0x2f')][_0x24fc('0x56')]({'where':{'id':_0x50302e['params']['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x28a44c,null))['then'](function(_0x1c1f74){var _0x595c47;var _0xdff811={},_0x27b612={};_0x27b612['model']=_[_0x24fc('0x47')](db['VoiceMailMessage'][_0x24fc('0x48')]);_0x27b612[_0x24fc('0x33')]=_['keys'](_0x50302e[_0x24fc('0x33')]);_0x27b612[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],_0x27b612[_0x24fc('0x33')]);_0xdff811['attributes']=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x37')]));_0xdff811['attributes']=_0xdff811['attributes'][_0x24fc('0x38')]?_0xdff811[_0x24fc('0x35')]:_0x27b612['model'];if(!_0x50302e['query'][_0x24fc('0x39')](_0x24fc('0x57'))){_0xdff811[_0x24fc('0x21')]=qs[_0x24fc('0x21')](_0x50302e['query'][_0x24fc('0x21')]);_0xdff811[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x1f')]);}_0xdff811[_0x24fc('0x3a')]=qs[_0x24fc('0x3b')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x3b')]);_0xdff811[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x50302e[_0x24fc('0x33')],_0x27b612[_0x24fc('0x34')]));if(_0x50302e[_0x24fc('0x33')]['filter']){_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0xdff811[_0x24fc('0x35')],function(_0x2eb6dc){var _0x10d148={};_0x10d148[_0x2eb6dc]={'$like':'%'+_0x50302e[_0x24fc('0x33')]['filter']+'%'};return _0x10d148;})});}_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'mailboxuser':_0x1c1f74[_0x24fc('0x58')]});_0xdff811=_['merge']({},_0xdff811,_0x50302e[_0x24fc('0x41')]);return db[_0x24fc('0x59')]['findAndCountAll'](_0xdff811)['then'](respondWithFilteredResult(_0x28a44c,_0xdff811));})['catch'](handleError(_0x28a44c,null));}; \ No newline at end of file +var _0xf7b4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x267b53,_0x1caed6){var _0x1d5721=function(_0xb08dab){while(--_0xb08dab){_0x267b53['push'](_0x267b53['shift']());}};_0x1d5721(++_0x1caed6);}(_0xf7b4,0x152));var _0x4f7b=function(_0x11400a,_0x22416d){_0x11400a=_0x11400a-0x0;var _0x5a655b=_0xf7b4[_0x11400a];return _0x5a655b;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd9b349,_0x2e8dd9){_0x2e8dd9=_0x2e8dd9||0xcc;return function(_0x3c55e1){if(_0x3c55e1){return _0xd9b349[_0x4f7b('0x17')](_0x2e8dd9);}return _0xd9b349['status'](_0x2e8dd9)[_0x4f7b('0x18')]();};}function respondWithResult(_0x368091,_0x407cee){_0x407cee=_0x407cee||0xc8;return function(_0x43a51a){if(_0x43a51a){return _0x368091[_0x4f7b('0x19')](_0x407cee)[_0x4f7b('0x1a')](_0x43a51a);}};}function respondWithFilteredResult(_0x40ecb0,_0x2437cc){return function(_0x260667){if(_0x260667){var _0x29fdd5=typeof _0x2437cc[_0x4f7b('0x1b')]===_0x4f7b('0x1c')&&typeof _0x2437cc['limit']===_0x4f7b('0x1c');var _0x496322=_0x260667['count'];var _0x24e5cf=_0x29fdd5?0x0:_0x2437cc[_0x4f7b('0x1b')];var _0x519d90=_0x29fdd5?_0x260667[_0x4f7b('0x1d')]:_0x2437cc[_0x4f7b('0x1b')]+_0x2437cc[_0x4f7b('0x1e')];var _0xf2311f;if(_0x519d90>=_0x496322){_0x519d90=_0x496322;_0xf2311f=0xc8;}else{_0xf2311f=0xce;}_0x40ecb0['status'](_0xf2311f);return _0x40ecb0[_0x4f7b('0x1f')]('Content-Range',_0x24e5cf+'-'+_0x519d90+'/'+_0x496322)[_0x4f7b('0x1a')](_0x260667);}return null;};}function patchUpdates(_0x12374b){return function(_0xa2f54e){try{jsonpatch[_0x4f7b('0x20')](_0xa2f54e,_0x12374b,!![]);}catch(_0x27127b){return BPromise[_0x4f7b('0x21')](_0x27127b);}return _0xa2f54e[_0x4f7b('0x22')]();};}function saveUpdates(_0x1f545e,_0x2a8b50){return function(_0x5508bd){if(_0x5508bd){return _0x5508bd[_0x4f7b('0x23')](_0x1f545e)[_0x4f7b('0x24')](function(_0x2c9ea6){return _0x2c9ea6;});}return null;};}function removeEntity(_0x5bd43f,_0x150f57){return function(_0x4610a4){if(_0x4610a4){return _0x4610a4['destroy']()[_0x4f7b('0x24')](function(){var _0x59ec24=_0x4610a4[_0x4f7b('0x25')]({'plain':!![]});var _0x2429be=_0x4f7b('0x26');return db[_0x4f7b('0x27')][_0x4f7b('0x28')]({'where':{'type':_0x2429be,'resourceId':_0x59ec24['id']}})[_0x4f7b('0x24')](function(){return _0x4610a4;});})[_0x4f7b('0x24')](function(){_0x5bd43f[_0x4f7b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c9626,_0x14e2c2){return function(_0x311675){if(!_0x311675){_0x6c9626['sendStatus'](0x194);}return _0x311675;};}function handleError(_0x19da29,_0x336739){_0x336739=_0x336739||0x1f4;return function(_0x1db684){logger[_0x4f7b('0x29')](_0x1db684[_0x4f7b('0x2a')]);if(_0x1db684['name']){delete _0x1db684[_0x4f7b('0x2b')];}_0x19da29[_0x4f7b('0x19')](_0x336739)[_0x4f7b('0x2c')](_0x1db684);};}exports['index']=function(_0x7de561,_0x5d13a1){var _0x4e4828={},_0x1a2346={},_0x52a5b1={'count':0x0,'rows':[]};var _0x1aad4b=_[_0x4f7b('0x2d')](db[_0x4f7b('0x2e')][_0x4f7b('0x2f')],function(_0x105ffb){return{'name':_0x105ffb[_0x4f7b('0x30')],'type':_0x105ffb[_0x4f7b('0x31')][_0x4f7b('0x32')]};});_0x1a2346[_0x4f7b('0x33')]=_[_0x4f7b('0x2d')](_0x1aad4b,_0x4f7b('0x2b'));_0x1a2346[_0x4f7b('0x34')]=_[_0x4f7b('0x35')](_0x7de561[_0x4f7b('0x34')]);_0x1a2346[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x1a2346[_0x4f7b('0x33')],_0x1a2346[_0x4f7b('0x34')]);_0x4e4828[_0x4f7b('0x38')]=_[_0x4f7b('0x37')](_0x1a2346[_0x4f7b('0x33')],qs[_0x4f7b('0x39')](_0x7de561['query'][_0x4f7b('0x39')]));_0x4e4828['attributes']=_0x4e4828[_0x4f7b('0x38')][_0x4f7b('0x3a')]?_0x4e4828['attributes']:_0x1a2346[_0x4f7b('0x33')];if(!_0x7de561[_0x4f7b('0x34')][_0x4f7b('0x3b')]('nolimit')){_0x4e4828[_0x4f7b('0x1e')]=qs[_0x4f7b('0x1e')](_0x7de561[_0x4f7b('0x34')][_0x4f7b('0x1e')]);_0x4e4828[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x7de561[_0x4f7b('0x34')]['offset']);}_0x4e4828[_0x4f7b('0x3c')]=qs['sort'](_0x7de561[_0x4f7b('0x34')][_0x4f7b('0x3d')]);_0x4e4828[_0x4f7b('0x3e')]=qs['filters'](_[_0x4f7b('0x3f')](_0x7de561['query'],_0x1a2346[_0x4f7b('0x36')]),_0x1aad4b);if(_0x7de561[_0x4f7b('0x34')]['filter']){_0x4e4828['where']=_[_0x4f7b('0x40')](_0x4e4828['where'],{'$or':_[_0x4f7b('0x2d')](_0x1aad4b,function(_0x146268){if(_0x146268['type']!==_0x4f7b('0x41')){var _0x4e34cd={};_0x4e34cd[_0x146268['name']]={'$like':'%'+_0x7de561['query'][_0x4f7b('0x42')]+'%'};return _0x4e34cd;}})});}_0x4e4828=_[_0x4f7b('0x40')]({},_0x4e4828,_0x7de561[_0x4f7b('0x43')]);var _0x3c8745={'where':_0x4e4828['where']};return db[_0x4f7b('0x2e')]['count'](_0x3c8745)[_0x4f7b('0x24')](function(_0x586406){_0x52a5b1[_0x4f7b('0x1d')]=_0x586406;if(_0x7de561['query'][_0x4f7b('0x44')]){_0x4e4828[_0x4f7b('0x45')]=[{'all':!![]}];}return db[_0x4f7b('0x2e')][_0x4f7b('0x46')](_0x4e4828);})[_0x4f7b('0x24')](function(_0x325cd6){_0x52a5b1[_0x4f7b('0x47')]=_0x325cd6;return _0x52a5b1;})[_0x4f7b('0x24')](respondWithFilteredResult(_0x5d13a1,_0x4e4828))[_0x4f7b('0x48')](handleError(_0x5d13a1,null));};exports[_0x4f7b('0x49')]=function(_0x2d0be3,_0x3016d0){var _0x9c58fa={'raw':!![],'where':{'id':_0x2d0be3[_0x4f7b('0x4a')]['id']}},_0x508eaa={};_0x508eaa[_0x4f7b('0x33')]=_[_0x4f7b('0x35')](db[_0x4f7b('0x2e')]['rawAttributes']);_0x508eaa['query']=_[_0x4f7b('0x35')](_0x2d0be3[_0x4f7b('0x34')]);_0x508eaa[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x508eaa['model'],_0x508eaa['query']);_0x9c58fa[_0x4f7b('0x38')]=_[_0x4f7b('0x37')](_0x508eaa[_0x4f7b('0x33')],qs[_0x4f7b('0x39')](_0x2d0be3['query']['fields']));_0x9c58fa[_0x4f7b('0x38')]=_0x9c58fa[_0x4f7b('0x38')][_0x4f7b('0x3a')]?_0x9c58fa[_0x4f7b('0x38')]:_0x508eaa[_0x4f7b('0x33')];if(_0x2d0be3['query'][_0x4f7b('0x44')]){_0x9c58fa[_0x4f7b('0x45')]=[{'all':!![]}];}_0x9c58fa=_[_0x4f7b('0x40')]({},_0x9c58fa,_0x2d0be3['options']);return db[_0x4f7b('0x2e')][_0x4f7b('0x4b')](_0x9c58fa)[_0x4f7b('0x24')](handleEntityNotFound(_0x3016d0,null))[_0x4f7b('0x24')](respondWithResult(_0x3016d0,null))[_0x4f7b('0x48')](handleError(_0x3016d0,null));};exports[_0x4f7b('0x4c')]=function(_0xee485,_0x2e563f){return db[_0x4f7b('0x2e')][_0x4f7b('0x4c')](_0xee485['body'],{})[_0x4f7b('0x24')](function(_0x45eebf){var _0x148da8=_0xee485['user'][_0x4f7b('0x25')]({'plain':!![]});if(!_0x148da8)throw new Error(_0x4f7b('0x4d'));if(_0x148da8[_0x4f7b('0x4e')]===_0x4f7b('0x4f')){var _0x145dd7=_0x45eebf[_0x4f7b('0x25')]({'plain':!![]});var _0x144ba1=_0x4f7b('0x26');return db[_0x4f7b('0x50')][_0x4f7b('0x4b')]({'where':{'name':_0x144ba1,'userProfileId':_0x148da8['userProfileId']},'raw':!![]})[_0x4f7b('0x24')](function(_0xfb6a3d){if(_0xfb6a3d&&_0xfb6a3d[_0x4f7b('0x51')]===0x0){return db['UserProfileResource'][_0x4f7b('0x4c')]({'name':_0x145dd7[_0x4f7b('0x2b')],'resourceId':_0x145dd7['id'],'type':_0xfb6a3d[_0x4f7b('0x2b')],'sectionId':_0xfb6a3d['id']},{})[_0x4f7b('0x24')](function(){return _0x45eebf;});}else{return _0x45eebf;}})[_0x4f7b('0x48')](function(_0x819fb3){logger['error'](_0x4f7b('0x52'),_0x819fb3);throw _0x819fb3;});}return _0x45eebf;})[_0x4f7b('0x24')](respondWithResult(_0x2e563f,0xc9))[_0x4f7b('0x48')](handleError(_0x2e563f,null));};exports['update']=function(_0x4017b5,_0x1906ad){if(_0x4017b5[_0x4f7b('0x53')]['id']){delete _0x4017b5[_0x4f7b('0x53')]['id'];}return db[_0x4f7b('0x2e')][_0x4f7b('0x4b')]({'where':{'id':_0x4017b5['params']['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x1906ad,null))['then'](saveUpdates(_0x4017b5['body'],null))['then'](respondWithResult(_0x1906ad,null))[_0x4f7b('0x48')](handleError(_0x1906ad,null));};exports[_0x4f7b('0x28')]=function(_0x27b2e1,_0x4eded2){return db['VoiceMail'][_0x4f7b('0x4b')]({'where':{'id':_0x27b2e1[_0x4f7b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4eded2,null))[_0x4f7b('0x24')](removeEntity(_0x4eded2,null))[_0x4f7b('0x48')](handleError(_0x4eded2,null));};exports[_0x4f7b('0x54')]=function(_0x1a7ee9,_0x567874,_0x38c89a){return db[_0x4f7b('0x2e')][_0x4f7b('0x55')]({'where':{'id':_0x1a7ee9[_0x4f7b('0x4a')]['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x567874,null))[_0x4f7b('0x24')](function(_0x311bd8){var _0x5cc48d;var _0x529821={},_0x507199={};_0x507199[_0x4f7b('0x33')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x507199['query']=_[_0x4f7b('0x35')](_0x1a7ee9[_0x4f7b('0x34')]);_0x507199[_0x4f7b('0x36')]=_[_0x4f7b('0x37')](_0x507199[_0x4f7b('0x33')],_0x507199[_0x4f7b('0x34')]);_0x529821[_0x4f7b('0x38')]=_[_0x4f7b('0x37')](_0x507199[_0x4f7b('0x33')],qs[_0x4f7b('0x39')](_0x1a7ee9[_0x4f7b('0x34')][_0x4f7b('0x39')]));_0x529821[_0x4f7b('0x38')]=_0x529821[_0x4f7b('0x38')][_0x4f7b('0x3a')]?_0x529821[_0x4f7b('0x38')]:_0x507199[_0x4f7b('0x33')];if(!_0x1a7ee9[_0x4f7b('0x34')]['hasOwnProperty'](_0x4f7b('0x56'))){_0x529821[_0x4f7b('0x1e')]=qs[_0x4f7b('0x1e')](_0x1a7ee9[_0x4f7b('0x34')][_0x4f7b('0x1e')]);_0x529821['offset']=qs['offset'](_0x1a7ee9[_0x4f7b('0x34')]['offset']);}_0x529821[_0x4f7b('0x3c')]=qs[_0x4f7b('0x3d')](_0x1a7ee9[_0x4f7b('0x34')][_0x4f7b('0x3d')]);_0x529821['where']=qs[_0x4f7b('0x36')](_[_0x4f7b('0x3f')](_0x1a7ee9[_0x4f7b('0x34')],_0x507199['filters']));if(_0x1a7ee9['query']['filter']){_0x529821[_0x4f7b('0x3e')]=_['merge'](_0x529821['where'],{'$or':_['map'](_0x529821[_0x4f7b('0x38')],function(_0x1484c8){var _0x2b0043={};_0x2b0043[_0x1484c8]={'$like':'%'+_0x1a7ee9['query'][_0x4f7b('0x42')]+'%'};return _0x2b0043;})});}_0x529821[_0x4f7b('0x3e')]=_['merge'](_0x529821['where'],{'mailboxuser':_0x311bd8[_0x4f7b('0x57')]});_0x529821=_[_0x4f7b('0x40')]({},_0x529821,_0x1a7ee9[_0x4f7b('0x43')]);return db[_0x4f7b('0x58')]['findAndCountAll'](_0x529821)[_0x4f7b('0x24')](respondWithFilteredResult(_0x567874,_0x529821));})[_0x4f7b('0x48')](handleError(_0x567874,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 79d2217..14b2751 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 _0xa972=['define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2836d9,_0x688205){var _0x38c02d=function(_0x380378){while(--_0x380378){_0x2836d9['push'](_0x2836d9['shift']());}};_0x38c02d(++_0x688205);}(_0xa972,0x1c6));var _0x2a97=function(_0x29a7ff,_0x1c1b74){_0x29a7ff=_0x29a7ff-0x0;var _0x170325=_0xa972[_0x29a7ff];return _0x170325;};'use strict';var _=require(_0x2a97('0x0'));var util=require(_0x2a97('0x1'));var logger=require(_0x2a97('0x2'))('api');var moment=require(_0x2a97('0x3'));var BPromise=require(_0x2a97('0x4'));var rp=require(_0x2a97('0x5'));var fs=require('fs');var path=require(_0x2a97('0x6'));var rimraf=require(_0x2a97('0x7'));var config=require(_0x2a97('0x8'));var attributes=require('./voiceMail.attributes');module[_0x2a97('0x9')]=function(_0x3cf481,_0x35cfea){return _0x3cf481[_0x2a97('0xa')](_0x2a97('0xb'),attributes,{'tableName':_0x2a97('0xc'),'paranoid':![],'indexes':[{'name':_0x2a97('0xd'),'fields':[_0x2a97('0xe'),_0x2a97('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f52=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox','context','lodash'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x8f52,0x95));var _0x28f5=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x8f52[_0x368bba];return _0x409f8f;};'use strict';var _=require(_0x28f5('0x0'));var util=require(_0x28f5('0x1'));var logger=require(_0x28f5('0x2'))(_0x28f5('0x3'));var moment=require(_0x28f5('0x4'));var BPromise=require(_0x28f5('0x5'));var rp=require(_0x28f5('0x6'));var fs=require('fs');var path=require(_0x28f5('0x7'));var rimraf=require(_0x28f5('0x8'));var config=require('../../config/environment');var attributes=require(_0x28f5('0x9'));module['exports']=function(_0x2a024e,_0x979b3e){return _0x2a024e[_0x28f5('0xa')](_0x28f5('0xb'),attributes,{'tableName':_0x28f5('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x28f5('0xd'),_0x28f5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 2a428dc..fafb015 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 _0xb83a=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x4e5c9b,_0x2532fa){var _0x5211d4=function(_0xb8fd53){while(--_0xb8fd53){_0x4e5c9b['push'](_0x4e5c9b['shift']());}};_0x5211d4(++_0x2532fa);}(_0xb83a,0xd9));var _0xab83=function(_0x51de12,_0x47ada7){_0x51de12=_0x51de12-0x0;var _0xec8d50=_0xb83a[_0x51de12];return _0xec8d50;};'use strict';var _=require(_0xab83('0x0'));var util=require(_0xab83('0x1'));var moment=require(_0xab83('0x2'));var BPromise=require(_0xab83('0x3'));var rs=require(_0xab83('0x4'));var fs=require('fs');var Redis=require(_0xab83('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xab83('0x6'));var logger=require('../../config/logger')(_0xab83('0x7'));var config=require(_0xab83('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab83('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22f5fc,_0x10e9fe,_0x474449){return new BPromise(function(_0x46232a,_0x318c62){return client[_0xab83('0xa')](_0x22f5fc,_0x474449)[_0xab83('0xb')](function(_0x2ba391){logger[_0xab83('0xc')](_0xab83('0xd'),_0x10e9fe,_0xab83('0xe'));logger[_0xab83('0xf')](_0xab83('0x10'),_0x10e9fe,_0xab83('0xe'),JSON[_0xab83('0x11')](_0x2ba391));if(_0x2ba391[_0xab83('0x12')]){if(_0x2ba391['error']['code']===0x1f4){logger['error'](_0xab83('0xd'),_0x10e9fe,_0x2ba391['error'][_0xab83('0x13')]);return _0x318c62(_0x2ba391['error'][_0xab83('0x13')]);}logger[_0xab83('0x12')](_0xab83('0xd'),_0x10e9fe,_0x2ba391[_0xab83('0x12')][_0xab83('0x13')]);return _0x46232a(_0x2ba391[_0xab83('0x12')]['message']);}else{logger['info'](_0xab83('0xd'),_0x10e9fe,_0xab83('0xe'));_0x46232a(_0x2ba391[_0xab83('0x14')][_0xab83('0x13')]);}})[_0xab83('0x15')](function(_0x313e27){logger['error']('VoiceMail,\x20%s,\x20%s',_0x10e9fe,_0x313e27);_0x318c62(_0x313e27);});});} \ No newline at end of file +var _0x0e5a=['result','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message'];(function(_0x292f4b,_0x9b897c){var _0x32a145=function(_0x3e3ac0){while(--_0x3e3ac0){_0x292f4b['push'](_0x292f4b['shift']());}};_0x32a145(++_0x9b897c);}(_0x0e5a,0x6a));var _0xa0e5=function(_0x340ef1,_0x244e90){_0x340ef1=_0x340ef1-0x0;var _0x589b25=_0x0e5a[_0x340ef1];return _0x589b25;};'use strict';var _=require('lodash');var util=require(_0xa0e5('0x0'));var moment=require(_0xa0e5('0x1'));var BPromise=require(_0xa0e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0e5('0x3'));var logger=require(_0xa0e5('0x4'))(_0xa0e5('0x5'));var config=require(_0xa0e5('0x6'));var jayson=require(_0xa0e5('0x7'));var client=jayson['client'][_0xa0e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x156c58,_0x3fd267,_0x390485){return new BPromise(function(_0x3a6ad8,_0x2f48a8){return client[_0xa0e5('0x9')](_0x156c58,_0x390485)[_0xa0e5('0xa')](function(_0x532f6d){logger[_0xa0e5('0xb')]('VoiceMail,\x20%s,\x20%s',_0x3fd267,_0xa0e5('0xc'));logger[_0xa0e5('0xd')](_0xa0e5('0xe'),_0x3fd267,_0xa0e5('0xc'),JSON[_0xa0e5('0xf')](_0x532f6d));if(_0x532f6d['error']){if(_0x532f6d[_0xa0e5('0x10')][_0xa0e5('0x11')]===0x1f4){logger['error'](_0xa0e5('0x12'),_0x3fd267,_0x532f6d[_0xa0e5('0x10')]['message']);return _0x2f48a8(_0x532f6d['error'][_0xa0e5('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x3fd267,_0x532f6d[_0xa0e5('0x10')][_0xa0e5('0x13')]);return _0x3a6ad8(_0x532f6d['error'][_0xa0e5('0x13')]);}else{logger[_0xa0e5('0xb')](_0xa0e5('0x12'),_0x3fd267,'request\x20sent');_0x3a6ad8(_0x532f6d[_0xa0e5('0x14')][_0xa0e5('0x13')]);}})['catch'](function(_0x33eee1){logger[_0xa0e5('0x10')](_0xa0e5('0x12'),_0x3fd267,_0x33eee1);_0x2f48a8(_0x33eee1);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 417a62d..f8b1d13 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 _0x77ed=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','post','create','/:id','update','delete'];(function(_0x376440,_0x26e85c){var _0x103d64=function(_0x2ff1d3){while(--_0x2ff1d3){_0x376440['push'](_0x376440['shift']());}};_0x103d64(++_0x26e85c);}(_0x77ed,0x16b));var _0xd77e=function(_0x6ed0ec,_0x5d318a){_0x6ed0ec=_0x6ed0ec-0x0;var _0x1b390b=_0x77ed[_0x6ed0ec];return _0x1b390b;};'use strict';var multer=require(_0xd77e('0x0'));var util=require(_0xd77e('0x1'));var path=require('path');var timeout=require(_0xd77e('0x2'));var express=require('express');var router=express[_0xd77e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd77e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd77e('0x5'));var controller=require(_0xd77e('0x6'));router[_0xd77e('0x7')]('/',auth[_0xd77e('0x8')](),controller[_0xd77e('0x9')]);router[_0xd77e('0x7')]('/:id',auth[_0xd77e('0x8')](),controller[_0xd77e('0xa')]);router[_0xd77e('0x7')](_0xd77e('0xb'),auth[_0xd77e('0x8')](),controller['download']);router[_0xd77e('0xc')]('/',auth['isAuthenticated'](),controller[_0xd77e('0xd')]);router['put'](_0xd77e('0xe'),auth['isAuthenticated'](),controller[_0xd77e('0xf')]);router[_0xd77e('0x10')]('/:id',auth[_0xd77e('0x8')](),controller[_0xd77e('0x11')]);module[_0xd77e('0x12')]=router; \ No newline at end of file +var _0xfd24=['update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','download','post','create','put'];(function(_0x28e78d,_0xbe1472){var _0x174e75=function(_0x42de79){while(--_0x42de79){_0x28e78d['push'](_0x28e78d['shift']());}};_0x174e75(++_0xbe1472);}(_0xfd24,0x121));var _0x4fd2=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xfd24[_0x580647];return _0x5f0792;};'use strict';var multer=require(_0x4fd2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4fd2('0x1'));var express=require('express');var router=express[_0x4fd2('0x2')]();var fs_extra=require(_0x4fd2('0x3'));var auth=require(_0x4fd2('0x4'));var interaction=require(_0x4fd2('0x5'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x4fd2('0x6')]('/',auth['isAuthenticated'](),controller[_0x4fd2('0x7')]);router[_0x4fd2('0x6')](_0x4fd2('0x8'),auth[_0x4fd2('0x9')](),controller[_0x4fd2('0xa')]);router[_0x4fd2('0x6')]('/:id/download',auth[_0x4fd2('0x9')](),controller[_0x4fd2('0xb')]);router[_0x4fd2('0xc')]('/',auth[_0x4fd2('0x9')](),controller[_0x4fd2('0xd')]);router[_0x4fd2('0xe')](_0x4fd2('0x8'),auth[_0x4fd2('0x9')](),controller[_0x4fd2('0xf')]);router[_0x4fd2('0x10')]('/:id',auth[_0x4fd2('0x9')](),controller[_0x4fd2('0x11')]);module[_0x4fd2('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 8fc123c..c0cef4e 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 _0x2006=['long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','STRING'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2006,0x65));var _0x6200=function(_0x43347e,_0x197682){_0x43347e=_0x43347e-0x0;var _0x43d04d=_0x2006[_0x43347e];return _0x43d04d;};'use strict';var Sequelize=require(_0x6200('0x0'));module['exports']={'name':{'type':Sequelize[_0x6200('0x1')],'get':function(_0x3132bc){return this[_0x6200('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6200('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x6200('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x6200('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x6200('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6200('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x6200('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x6200('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6200('0x3')],'defaultValue':''},'stamp':{'type':_0x6200('0x5'),'defaultValue':Sequelize['literal'](_0x6200('0x6'))}}; \ No newline at end of file +var _0x4621=['INTEGER','STRING','BLOB','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue'];(function(_0x5aed9f,_0x1cb632){var _0xcd3bc9=function(_0x235009){while(--_0x235009){_0x5aed9f['push'](_0x5aed9f['shift']());}};_0xcd3bc9(++_0x1cb632);}(_0x4621,0x12d));var _0x1462=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4621[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x1462('0x0'));module[_0x1462('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x45eeac){return this[_0x1462('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x1462('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1462('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x1462('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1462('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1462('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1462('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x1462('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x1462('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x1462('0x6'),'defaultValue':Sequelize['literal'](_0x1462('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 1f498ee..068051b 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 _0x386c=['../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','name','index','VoiceMailMessage','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','options','includeAll','include','findAll','rows','catch','show','params','merge','find','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3eda97,_0x2d73bf){var _0x5ec223=function(_0x1e698c){while(--_0x1e698c){_0x3eda97['push'](_0x3eda97['shift']());}};_0x5ec223(++_0x2d73bf);}(_0x386c,0xde));var _0xc386=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x386c[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xc386('0x0'));var rimraf=require(_0xc386('0x1'));var zipdir=require(_0xc386('0x2'));var jsonpatch=require(_0xc386('0x3'));var rp=require(_0xc386('0x4'));var moment=require('moment');var BPromise=require(_0xc386('0x5'));var Mustache=require(_0xc386('0x6'));var util=require(_0xc386('0x7'));var path=require('path');var sox=require(_0xc386('0x8'));var csv=require('to-csv');var ejs=require(_0xc386('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc386('0xa'));var squel=require('squel');var crypto=require(_0xc386('0xb'));var jsforce=require(_0xc386('0xc'));var deskjs=require(_0xc386('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc386('0xe'));var Redis=require(_0xc386('0xf'));var authService=require(_0xc386('0x10'));var qs=require(_0xc386('0x11'));var as=require(_0xc386('0x12'));var hardwareService=require(_0xc386('0x13'));var logger=require(_0xc386('0x14'))('api');var utils=require(_0xc386('0x15'));var config=require(_0xc386('0x16'));var licenseUtil=require(_0xc386('0x17'));var db=require(_0xc386('0x18'))['db'];function respondWithStatusCode(_0x3ae33b,_0x5a4121){_0x5a4121=_0x5a4121||0xcc;return function(_0xb5e8da){if(_0xb5e8da){return _0x3ae33b[_0xc386('0x19')](_0x5a4121);}return _0x3ae33b[_0xc386('0x1a')](_0x5a4121)[_0xc386('0x1b')]();};}function respondWithResult(_0x52e0f9,_0x4238db){_0x4238db=_0x4238db||0xc8;return function(_0x4fc003){if(_0x4fc003){return _0x52e0f9['status'](_0x4238db)[_0xc386('0x1c')](_0x4fc003);}};}function respondWithFilteredResult(_0x464664,_0xa8ca5e){return function(_0x29a56b){if(_0x29a56b){var _0x4498c7=typeof _0xa8ca5e[_0xc386('0x1d')]==='undefined'&&typeof _0xa8ca5e[_0xc386('0x1e')]===_0xc386('0x1f');var _0x3b8dc5=_0x29a56b['count'];var _0x345362=_0x4498c7?0x0:_0xa8ca5e[_0xc386('0x1d')];var _0x51b251=_0x4498c7?_0x29a56b[_0xc386('0x20')]:_0xa8ca5e[_0xc386('0x1d')]+_0xa8ca5e[_0xc386('0x1e')];var _0x3db242;if(_0x51b251>=_0x3b8dc5){_0x51b251=_0x3b8dc5;_0x3db242=0xc8;}else{_0x3db242=0xce;}_0x464664[_0xc386('0x1a')](_0x3db242);return _0x464664[_0xc386('0x21')]('Content-Range',_0x345362+'-'+_0x51b251+'/'+_0x3b8dc5)[_0xc386('0x1c')](_0x29a56b);}return null;};}function patchUpdates(_0x315645){return function(_0xaf95a8){try{jsonpatch[_0xc386('0x22')](_0xaf95a8,_0x315645,!![]);}catch(_0x495acd){return BPromise[_0xc386('0x23')](_0x495acd);}return _0xaf95a8[_0xc386('0x24')]();};}function saveUpdates(_0x17a6ef,_0x5f53ce){return function(_0x5b13b6){if(_0x5b13b6){return _0x5b13b6[_0xc386('0x25')](_0x17a6ef)[_0xc386('0x26')](function(_0x3535d0){return _0x3535d0;});}return null;};}function removeEntity(_0x16e5a3,_0x2cdbc6){return function(_0x7fed22){if(_0x7fed22){return _0x7fed22[_0xc386('0x27')]()['then'](function(){_0x16e5a3[_0xc386('0x1a')](0xcc)[_0xc386('0x1b')]();});}};}function handleEntityNotFound(_0x423035,_0xba89b4){return function(_0x22685b){if(!_0x22685b){_0x423035[_0xc386('0x19')](0x194);}return _0x22685b;};}function handleError(_0xdbd2e2,_0x30e07b){_0x30e07b=_0x30e07b||0x1f4;return function(_0x36eb68){logger[_0xc386('0x28')](_0x36eb68['stack']);if(_0x36eb68[_0xc386('0x29')]){delete _0x36eb68[_0xc386('0x29')];}_0xdbd2e2[_0xc386('0x1a')](_0x30e07b)['send'](_0x36eb68);};}exports[_0xc386('0x2a')]=function(_0x513214,_0x4ebb7e){var _0x394a3d={},_0x23e47e={},_0x4a2264={'count':0x0,'rows':[]};var _0x4bd34a=_['map'](db[_0xc386('0x2b')][_0xc386('0x2c')],function(_0x35fe5a){return{'name':_0x35fe5a[_0xc386('0x2d')],'type':_0x35fe5a[_0xc386('0x2e')]['key']};});_0x23e47e[_0xc386('0x2f')]=_['differenceBy'](_[_0xc386('0x30')](_0x4bd34a,_0xc386('0x29')),[_0xc386('0x29')]);_0x23e47e['query']=_[_0xc386('0x31')](_0x513214[_0xc386('0x32')]);_0x23e47e[_0xc386('0x33')]=_['intersection'](_0x23e47e['model'],_0x23e47e[_0xc386('0x32')]);_0x394a3d[_0xc386('0x34')]=_[_0xc386('0x35')](_0x23e47e['model'],qs['fields'](_0x513214[_0xc386('0x32')][_0xc386('0x36')]));_0x394a3d[_0xc386('0x34')]=_0x394a3d[_0xc386('0x34')][_0xc386('0x37')]?_0x394a3d[_0xc386('0x34')]:_0x23e47e[_0xc386('0x2f')];if(!_0x513214[_0xc386('0x32')]['hasOwnProperty'](_0xc386('0x38'))){_0x394a3d[_0xc386('0x1e')]=qs[_0xc386('0x1e')](_0x513214[_0xc386('0x32')][_0xc386('0x1e')]);_0x394a3d[_0xc386('0x1d')]=qs[_0xc386('0x1d')](_0x513214['query'][_0xc386('0x1d')]);}_0x394a3d[_0xc386('0x39')]=qs[_0xc386('0x3a')](_0x513214[_0xc386('0x32')][_0xc386('0x3a')]);_0x394a3d[_0xc386('0x3b')]=qs[_0xc386('0x33')](_[_0xc386('0x3c')](_0x513214[_0xc386('0x32')],_0x23e47e['filters']),_0x4bd34a);if(_0x513214[_0xc386('0x32')]['filter']){_0x394a3d[_0xc386('0x3b')]=_['merge'](_0x394a3d['where'],{'$or':_[_0xc386('0x30')](_0x4bd34a,function(_0x57e4b2){if(_0x57e4b2[_0xc386('0x2e')]!=='VIRTUAL'){var _0x3c5e6b={};_0x3c5e6b[_0x57e4b2['name']]={'$like':'%'+_0x513214[_0xc386('0x32')]['filter']+'%'};return _0x3c5e6b;}})});}_0x394a3d=_['merge']({},_0x394a3d,_0x513214[_0xc386('0x3d')]);var _0x2f1039={'where':_0x394a3d[_0xc386('0x3b')]};return db[_0xc386('0x2b')][_0xc386('0x20')](_0x2f1039)[_0xc386('0x26')](function(_0x2aa69d){_0x4a2264['count']=_0x2aa69d;if(_0x513214[_0xc386('0x32')][_0xc386('0x3e')]){_0x394a3d[_0xc386('0x3f')]=[{'all':!![]}];}return db[_0xc386('0x2b')][_0xc386('0x40')](_0x394a3d);})[_0xc386('0x26')](function(_0x444562){_0x4a2264[_0xc386('0x41')]=_0x444562;return _0x4a2264;})[_0xc386('0x26')](respondWithFilteredResult(_0x4ebb7e,_0x394a3d))[_0xc386('0x42')](handleError(_0x4ebb7e,null));};exports[_0xc386('0x43')]=function(_0x1e51ed,_0x203e4b){var _0xca1d81={'raw':!![],'where':{'id':_0x1e51ed[_0xc386('0x44')]['id']}},_0x757520={};_0x757520['model']=_[_0xc386('0x31')](db[_0xc386('0x2b')]['rawAttributes']);_0x757520[_0xc386('0x32')]=_['keys'](_0x1e51ed[_0xc386('0x32')]);_0x757520[_0xc386('0x33')]=_['intersection'](_0x757520[_0xc386('0x2f')],_0x757520[_0xc386('0x32')]);_0xca1d81['attributes']=_[_0xc386('0x35')](_0x757520[_0xc386('0x2f')],qs[_0xc386('0x36')](_0x1e51ed[_0xc386('0x32')][_0xc386('0x36')]));_0xca1d81[_0xc386('0x34')]=_0xca1d81['attributes'][_0xc386('0x37')]?_0xca1d81[_0xc386('0x34')]:_0x757520[_0xc386('0x2f')];if(_0x1e51ed[_0xc386('0x32')][_0xc386('0x3e')]){_0xca1d81[_0xc386('0x3f')]=[{'all':!![]}];}_0xca1d81=_[_0xc386('0x45')]({},_0xca1d81,_0x1e51ed[_0xc386('0x3d')]);return db[_0xc386('0x2b')][_0xc386('0x46')](_0xca1d81)[_0xc386('0x26')](handleEntityNotFound(_0x203e4b,null))[_0xc386('0x26')](respondWithResult(_0x203e4b,null))[_0xc386('0x42')](handleError(_0x203e4b,null));};exports['create']=function(_0x28c010,_0x55ce3c){return db[_0xc386('0x2b')]['create'](_0x28c010[_0xc386('0x47')],{})['then'](respondWithResult(_0x55ce3c,0xc9))['catch'](handleError(_0x55ce3c,null));};exports[_0xc386('0x25')]=function(_0x4e580b,_0x1fbced){if(_0x4e580b[_0xc386('0x47')]['id']){delete _0x4e580b['body']['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x4e580b[_0xc386('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fbced,null))[_0xc386('0x26')](saveUpdates(_0x4e580b[_0xc386('0x47')],null))[_0xc386('0x26')](respondWithResult(_0x1fbced,null))['catch'](handleError(_0x1fbced,null));};exports[_0xc386('0x27')]=function(_0x40d749,_0x3aeca6){return db[_0xc386('0x2b')][_0xc386('0x46')]({'where':{'id':_0x40d749[_0xc386('0x44')]['id']}})['then'](handleEntityNotFound(_0x3aeca6,null))['then'](removeEntity(_0x3aeca6,null))[_0xc386('0x42')](handleError(_0x3aeca6,null));};exports[_0xc386('0x48')]=function(_0x5e6541,_0x4dde4b,_0x59ca7b){return db[_0xc386('0x2b')][_0xc386('0x46')]({'where':{'id':_0x5e6541[_0xc386('0x44')]['id']},'attributes':['id',_0xc386('0x49'),_0xc386('0x4a')]})['then'](handleEntityNotFound(_0x4dde4b,null))[_0xc386('0x26')](function(_0x374c23){if(_0x374c23){if(!_0x374c23[_0xc386('0x49')]){throw new db[(_0xc386('0x4b'))]['ValidationError'](_0xc386('0x4c'));}var _0x2e87e4={'Content-Type':_0xc386('0x4d'),'Content-Disposition':_0xc386('0x4e')};if(_0x374c23[_0xc386('0x4a')]){_0x2e87e4[_0xc386('0x4f')]=_0xc386('0x50')+_0x374c23[_0xc386('0x4a')]+'.wav\x22';}_0x4dde4b[_0xc386('0x21')](_0x2e87e4);return _0x4dde4b[_0xc386('0x51')](new Buffer(_0x374c23[_0xc386('0x49')]));}})[_0xc386('0x42')](handleError(_0x4dde4b,null));}; \ No newline at end of file +var _0x4c9e=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','msg_id','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','name','keys','query','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters'];(function(_0x57dd30,_0x1af49b){var _0x54ec30=function(_0x48ffb2){while(--_0x48ffb2){_0x57dd30['push'](_0x57dd30['shift']());}};_0x54ec30(++_0x1af49b);}(_0x4c9e,0x6b));var _0xe4c9=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x4c9e[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0xe4c9('0x0'));var rimraf=require(_0xe4c9('0x1'));var zipdir=require(_0xe4c9('0x2'));var jsonpatch=require(_0xe4c9('0x3'));var rp=require(_0xe4c9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe4c9('0x5'));var util=require('util');var path=require(_0xe4c9('0x6'));var sox=require(_0xe4c9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4c9('0x8'));var _=require(_0xe4c9('0x9'));var squel=require(_0xe4c9('0xa'));var crypto=require(_0xe4c9('0xb'));var jsforce=require(_0xe4c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe4c9('0xd'));var querystring=require(_0xe4c9('0xe'));var Papa=require(_0xe4c9('0xf'));var Redis=require(_0xe4c9('0x10'));var authService=require(_0xe4c9('0x11'));var qs=require(_0xe4c9('0x12'));var as=require(_0xe4c9('0x13'));var hardwareService=require(_0xe4c9('0x14'));var logger=require('../../config/logger')(_0xe4c9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe4c9('0x16'));var db=require(_0xe4c9('0x17'))['db'];function respondWithStatusCode(_0xa311fc,_0x3b1e05){_0x3b1e05=_0x3b1e05||0xcc;return function(_0x2b2d6d){if(_0x2b2d6d){return _0xa311fc[_0xe4c9('0x18')](_0x3b1e05);}return _0xa311fc[_0xe4c9('0x19')](_0x3b1e05)[_0xe4c9('0x1a')]();};}function respondWithResult(_0x53eea4,_0x4cdaa4){_0x4cdaa4=_0x4cdaa4||0xc8;return function(_0xb8044){if(_0xb8044){return _0x53eea4['status'](_0x4cdaa4)[_0xe4c9('0x1b')](_0xb8044);}};}function respondWithFilteredResult(_0x2710a7,_0x1b6e69){return function(_0x4e3deb){if(_0x4e3deb){var _0x5dffb2=typeof _0x1b6e69[_0xe4c9('0x1c')]===_0xe4c9('0x1d')&&typeof _0x1b6e69['limit']===_0xe4c9('0x1d');var _0x362c3b=_0x4e3deb[_0xe4c9('0x1e')];var _0x2bbfd1=_0x5dffb2?0x0:_0x1b6e69[_0xe4c9('0x1c')];var _0x2db885=_0x5dffb2?_0x4e3deb[_0xe4c9('0x1e')]:_0x1b6e69['offset']+_0x1b6e69['limit'];var _0x679b41;if(_0x2db885>=_0x362c3b){_0x2db885=_0x362c3b;_0x679b41=0xc8;}else{_0x679b41=0xce;}_0x2710a7[_0xe4c9('0x19')](_0x679b41);return _0x2710a7[_0xe4c9('0x1f')](_0xe4c9('0x20'),_0x2bbfd1+'-'+_0x2db885+'/'+_0x362c3b)[_0xe4c9('0x1b')](_0x4e3deb);}return null;};}function patchUpdates(_0x42907d){return function(_0x14e2b7){try{jsonpatch[_0xe4c9('0x21')](_0x14e2b7,_0x42907d,!![]);}catch(_0x107dd9){return BPromise[_0xe4c9('0x22')](_0x107dd9);}return _0x14e2b7[_0xe4c9('0x23')]();};}function saveUpdates(_0x1a0ea1,_0x5b2668){return function(_0x453e28){if(_0x453e28){return _0x453e28[_0xe4c9('0x24')](_0x1a0ea1)[_0xe4c9('0x25')](function(_0x41bce3){return _0x41bce3;});}return null;};}function removeEntity(_0x1b18ab,_0x41bf35){return function(_0x1f3edb){if(_0x1f3edb){return _0x1f3edb[_0xe4c9('0x26')]()[_0xe4c9('0x25')](function(){_0x1b18ab[_0xe4c9('0x19')](0xcc)[_0xe4c9('0x1a')]();});}};}function handleEntityNotFound(_0x3e793f,_0x460da8){return function(_0x10ade9){if(!_0x10ade9){_0x3e793f['sendStatus'](0x194);}return _0x10ade9;};}function handleError(_0x1ee4b9,_0x5a0829){_0x5a0829=_0x5a0829||0x1f4;return function(_0x1c6197){logger[_0xe4c9('0x27')](_0x1c6197[_0xe4c9('0x28')]);if(_0x1c6197['name']){delete _0x1c6197['name'];}_0x1ee4b9[_0xe4c9('0x19')](_0x5a0829)[_0xe4c9('0x29')](_0x1c6197);};}exports[_0xe4c9('0x2a')]=function(_0x32ae59,_0x110892){var _0x18dcfa={},_0x3fe1ec={},_0x5267c7={'count':0x0,'rows':[]};var _0x306d65=_[_0xe4c9('0x2b')](db[_0xe4c9('0x2c')][_0xe4c9('0x2d')],function(_0x105a63){return{'name':_0x105a63[_0xe4c9('0x2e')],'type':_0x105a63[_0xe4c9('0x2f')]['key']};});_0x3fe1ec['model']=_['differenceBy'](_[_0xe4c9('0x2b')](_0x306d65,_0xe4c9('0x30')),[_0xe4c9('0x30')]);_0x3fe1ec['query']=_[_0xe4c9('0x31')](_0x32ae59[_0xe4c9('0x32')]);_0x3fe1ec['filters']=_[_0xe4c9('0x33')](_0x3fe1ec[_0xe4c9('0x34')],_0x3fe1ec[_0xe4c9('0x32')]);_0x18dcfa[_0xe4c9('0x35')]=_[_0xe4c9('0x33')](_0x3fe1ec['model'],qs['fields'](_0x32ae59['query']['fields']));_0x18dcfa[_0xe4c9('0x35')]=_0x18dcfa[_0xe4c9('0x35')][_0xe4c9('0x36')]?_0x18dcfa[_0xe4c9('0x35')]:_0x3fe1ec[_0xe4c9('0x34')];if(!_0x32ae59['query'][_0xe4c9('0x37')](_0xe4c9('0x38'))){_0x18dcfa['limit']=qs[_0xe4c9('0x39')](_0x32ae59[_0xe4c9('0x32')][_0xe4c9('0x39')]);_0x18dcfa[_0xe4c9('0x1c')]=qs[_0xe4c9('0x1c')](_0x32ae59[_0xe4c9('0x32')][_0xe4c9('0x1c')]);}_0x18dcfa['order']=qs[_0xe4c9('0x3a')](_0x32ae59[_0xe4c9('0x32')][_0xe4c9('0x3a')]);_0x18dcfa[_0xe4c9('0x3b')]=qs[_0xe4c9('0x3c')](_[_0xe4c9('0x3d')](_0x32ae59['query'],_0x3fe1ec[_0xe4c9('0x3c')]),_0x306d65);if(_0x32ae59[_0xe4c9('0x32')][_0xe4c9('0x3e')]){_0x18dcfa[_0xe4c9('0x3b')]=_[_0xe4c9('0x3f')](_0x18dcfa[_0xe4c9('0x3b')],{'$or':_['map'](_0x306d65,function(_0x2477cd){if(_0x2477cd[_0xe4c9('0x2f')]!==_0xe4c9('0x40')){var _0x5990b6={};_0x5990b6[_0x2477cd['name']]={'$like':'%'+_0x32ae59['query'][_0xe4c9('0x3e')]+'%'};return _0x5990b6;}})});}_0x18dcfa=_['merge']({},_0x18dcfa,_0x32ae59[_0xe4c9('0x41')]);var _0x59f741={'where':_0x18dcfa[_0xe4c9('0x3b')]};return db['VoiceMailMessage']['count'](_0x59f741)[_0xe4c9('0x25')](function(_0x583aa9){_0x5267c7[_0xe4c9('0x1e')]=_0x583aa9;if(_0x32ae59[_0xe4c9('0x32')][_0xe4c9('0x42')]){_0x18dcfa[_0xe4c9('0x43')]=[{'all':!![]}];}return db[_0xe4c9('0x2c')][_0xe4c9('0x44')](_0x18dcfa);})[_0xe4c9('0x25')](function(_0x48d42a){_0x5267c7[_0xe4c9('0x45')]=_0x48d42a;return _0x5267c7;})['then'](respondWithFilteredResult(_0x110892,_0x18dcfa))[_0xe4c9('0x46')](handleError(_0x110892,null));};exports[_0xe4c9('0x47')]=function(_0x4a6e84,_0x294899){var _0x13f6db={'raw':!![],'where':{'id':_0x4a6e84[_0xe4c9('0x48')]['id']}},_0x4b3484={};_0x4b3484[_0xe4c9('0x34')]=_[_0xe4c9('0x31')](db[_0xe4c9('0x2c')]['rawAttributes']);_0x4b3484[_0xe4c9('0x32')]=_[_0xe4c9('0x31')](_0x4a6e84[_0xe4c9('0x32')]);_0x4b3484[_0xe4c9('0x3c')]=_[_0xe4c9('0x33')](_0x4b3484['model'],_0x4b3484['query']);_0x13f6db[_0xe4c9('0x35')]=_[_0xe4c9('0x33')](_0x4b3484[_0xe4c9('0x34')],qs[_0xe4c9('0x49')](_0x4a6e84[_0xe4c9('0x32')][_0xe4c9('0x49')]));_0x13f6db[_0xe4c9('0x35')]=_0x13f6db[_0xe4c9('0x35')][_0xe4c9('0x36')]?_0x13f6db[_0xe4c9('0x35')]:_0x4b3484[_0xe4c9('0x34')];if(_0x4a6e84[_0xe4c9('0x32')][_0xe4c9('0x42')]){_0x13f6db['include']=[{'all':!![]}];}_0x13f6db=_[_0xe4c9('0x3f')]({},_0x13f6db,_0x4a6e84['options']);return db[_0xe4c9('0x2c')][_0xe4c9('0x4a')](_0x13f6db)[_0xe4c9('0x25')](handleEntityNotFound(_0x294899,null))[_0xe4c9('0x25')](respondWithResult(_0x294899,null))['catch'](handleError(_0x294899,null));};exports[_0xe4c9('0x4b')]=function(_0x773dfe,_0x40b090){return db['VoiceMailMessage'][_0xe4c9('0x4b')](_0x773dfe['body'],{})[_0xe4c9('0x25')](respondWithResult(_0x40b090,0xc9))[_0xe4c9('0x46')](handleError(_0x40b090,null));};exports[_0xe4c9('0x24')]=function(_0x5b7ab1,_0x3a2c12){if(_0x5b7ab1[_0xe4c9('0x4c')]['id']){delete _0x5b7ab1[_0xe4c9('0x4c')]['id'];}return db[_0xe4c9('0x2c')][_0xe4c9('0x4a')]({'where':{'id':_0x5b7ab1[_0xe4c9('0x48')]['id']}})[_0xe4c9('0x25')](handleEntityNotFound(_0x3a2c12,null))[_0xe4c9('0x25')](saveUpdates(_0x5b7ab1[_0xe4c9('0x4c')],null))[_0xe4c9('0x25')](respondWithResult(_0x3a2c12,null))[_0xe4c9('0x46')](handleError(_0x3a2c12,null));};exports[_0xe4c9('0x26')]=function(_0x5798c5,_0x393abc){return db['VoiceMailMessage'][_0xe4c9('0x4a')]({'where':{'id':_0x5798c5[_0xe4c9('0x48')]['id']}})[_0xe4c9('0x25')](handleEntityNotFound(_0x393abc,null))['then'](removeEntity(_0x393abc,null))[_0xe4c9('0x46')](handleError(_0x393abc,null));};exports[_0xe4c9('0x4d')]=function(_0x50521c,_0x3a5e60,_0x1fd5a3){return db['VoiceMailMessage'][_0xe4c9('0x4a')]({'where':{'id':_0x50521c[_0xe4c9('0x48')]['id']},'attributes':['id',_0xe4c9('0x4e'),'msg_id']})['then'](handleEntityNotFound(_0x3a5e60,null))[_0xe4c9('0x25')](function(_0x5d3acc){if(_0x5d3acc){if(!_0x5d3acc['recording']){throw new db['Sequelize'][(_0xe4c9('0x4f'))](_0xe4c9('0x50'));}var _0x4188c5={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x5d3acc[_0xe4c9('0x51')]){_0x4188c5['Content-Disposition']=_0xe4c9('0x52')+_0x5d3acc['msg_id']+_0xe4c9('0x53');}_0x3a5e60[_0xe4c9('0x1f')](_0x4188c5);return _0x3a5e60['send'](new Buffer(_0x5d3acc['recording']));}})[_0xe4c9('0x46')](handleError(_0x3a5e60,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4564453..6a575e2 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 _0x3135=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x184de2,_0x338206){var _0x392438=function(_0x710837){while(--_0x710837){_0x184de2['push'](_0x184de2['shift']());}};_0x392438(++_0x338206);}(_0x3135,0x7e));var _0x5313=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3135[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5313('0x0'));var util=require(_0x5313('0x1'));var logger=require(_0x5313('0x2'))(_0x5313('0x3'));var moment=require(_0x5313('0x4'));var BPromise=require(_0x5313('0x5'));var rp=require(_0x5313('0x6'));var fs=require('fs');var path=require(_0x5313('0x7'));var rimraf=require(_0x5313('0x8'));var config=require(_0x5313('0x9'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x24a4cb,_0x57871f){return _0x24a4cb[_0x5313('0xa')](_0x5313('0xb'),attributes,{'tableName':_0x5313('0xc'),'paranoid':![],'indexes':[{'name':_0x5313('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x901f=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','path','rimraf','./voiceMailMessage.attributes'];(function(_0x5b406e,_0xcd06bc){var _0xe7d242=function(_0x3fc6cc){while(--_0x3fc6cc){_0x5b406e['push'](_0x5b406e['shift']());}};_0xe7d242(++_0xcd06bc);}(_0x901f,0x155));var _0xf901=function(_0x19ecea,_0x274385){_0x19ecea=_0x19ecea-0x0;var _0x51d47a=_0x901f[_0x19ecea];return _0x51d47a;};'use strict';var _=require(_0xf901('0x0'));var util=require(_0xf901('0x1'));var logger=require('../../config/logger')(_0xf901('0x2'));var moment=require(_0xf901('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf901('0x4'));var rimraf=require(_0xf901('0x5'));var config=require('../../config/environment');var attributes=require(_0xf901('0x6'));module[_0xf901('0x7')]=function(_0x3ab1ce,_0x352e17){return _0x3ab1ce[_0xf901('0x8')](_0xf901('0x9'),attributes,{'tableName':_0xf901('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xf901('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 48d5159..7977b07 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 _0x808d=['VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x2cab09,_0x424000){var _0xac7153=function(_0x55a7c1){while(--_0x55a7c1){_0x2cab09['push'](_0x2cab09['shift']());}};_0xac7153(++_0x424000);}(_0x808d,0x1c0));var _0xd808=function(_0x1c9084,_0x1e18c5){_0x1c9084=_0x1c9084-0x0;var _0x510434=_0x808d[_0x1c9084];return _0x510434;};'use strict';var _=require(_0xd808('0x0'));var util=require(_0xd808('0x1'));var moment=require(_0xd808('0x2'));var BPromise=require(_0xd808('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd808('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd808('0x5'))(_0xd808('0x6'));var config=require(_0xd808('0x7'));var jayson=require(_0xd808('0x8'));var client=jayson['client'][_0xd808('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb42632,_0x1fb5a1,_0x393bf7){return new BPromise(function(_0x2e72fe,_0x46b26c){return client[_0xd808('0xa')](_0xb42632,_0x393bf7)['then'](function(_0x3941a5){logger[_0xd808('0xb')](_0xd808('0xc'),_0x1fb5a1,_0xd808('0xd'));logger[_0xd808('0xe')](_0xd808('0xf'),_0x1fb5a1,_0xd808('0xd'),JSON[_0xd808('0x10')](_0x3941a5));if(_0x3941a5[_0xd808('0x11')]){if(_0x3941a5[_0xd808('0x11')]['code']===0x1f4){logger['error'](_0xd808('0xc'),_0x1fb5a1,_0x3941a5[_0xd808('0x11')][_0xd808('0x12')]);return _0x46b26c(_0x3941a5[_0xd808('0x11')][_0xd808('0x12')]);}logger[_0xd808('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x1fb5a1,_0x3941a5['error']['message']);return _0x2e72fe(_0x3941a5['error'][_0xd808('0x12')]);}else{logger['info'](_0xd808('0xc'),_0x1fb5a1,_0xd808('0xd'));_0x2e72fe(_0x3941a5['result']['message']);}})[_0xd808('0x13')](function(_0x58acad){logger[_0xd808('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x1fb5a1,_0x58acad);_0x46b26c(_0x58acad);});});} \ No newline at end of file +var _0x545d=['../../config/environment','jayson/promise','http','request','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x545d,0x13b));var _0xd545=function(_0x48adb7,_0x3a0c7b){_0x48adb7=_0x48adb7-0x0;var _0x1aaaf6=_0x545d[_0x48adb7];return _0x1aaaf6;};'use strict';var _=require(_0xd545('0x0'));var util=require(_0xd545('0x1'));var moment=require(_0xd545('0x2'));var BPromise=require(_0xd545('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd545('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd545('0x5'));var logger=require(_0xd545('0x6'))(_0xd545('0x7'));var config=require(_0xd545('0x8'));var jayson=require(_0xd545('0x9'));var client=jayson['client'][_0xd545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58605d,_0x5a3b75,_0x8f788c){return new BPromise(function(_0x163835,_0x5d62c8){return client[_0xd545('0xb')](_0x58605d,_0x8f788c)['then'](function(_0x5e173b){logger['info'](_0xd545('0xc'),_0x5a3b75,'request\x20sent');logger['debug'](_0xd545('0xd'),_0x5a3b75,_0xd545('0xe'),JSON['stringify'](_0x5e173b));if(_0x5e173b[_0xd545('0xf')]){if(_0x5e173b[_0xd545('0xf')]['code']===0x1f4){logger[_0xd545('0xf')](_0xd545('0xc'),_0x5a3b75,_0x5e173b[_0xd545('0xf')]['message']);return _0x5d62c8(_0x5e173b[_0xd545('0xf')][_0xd545('0x10')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x5a3b75,_0x5e173b[_0xd545('0xf')][_0xd545('0x10')]);return _0x163835(_0x5e173b['error'][_0xd545('0x10')]);}else{logger[_0xd545('0x11')](_0xd545('0xc'),_0x5a3b75,_0xd545('0xe'));_0x163835(_0x5e173b[_0xd545('0x12')]['message']);}})['catch'](function(_0x7442d8){logger[_0xd545('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x5a3b75,_0x7442d8);_0x5d62c8(_0x7442d8);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index c582050..fd12e6b 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 _0x667d=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x667d,0x7c));var _0xd667=function(_0x439caa,_0x12337e){_0x439caa=_0x439caa-0x0;var _0x1afbf3=_0x667d[_0x439caa];return _0x1afbf3;};'use strict';var multer=require(_0xd667('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd667('0x1'));var express=require('express');var router=express[_0xd667('0x2')]();var fs_extra=require(_0xd667('0x3'));var auth=require(_0xd667('0x4'));var interaction=require(_0xd667('0x5'));var config=require(_0xd667('0x6'));var controller=require(_0xd667('0x7'));router[_0xd667('0x8')]('/',auth[_0xd667('0x9')](),controller[_0xd667('0xa')]);router['get'](_0xd667('0xb'),auth[_0xd667('0x9')](),controller[_0xd667('0xc')]);router[_0xd667('0x8')](_0xd667('0xd'),auth[_0xd667('0x9')](),controller[_0xd667('0xe')]);router[_0xd667('0xf')]('/',auth[_0xd667('0x9')](),controller[_0xd667('0x10')]);router[_0xd667('0xf')]('/:id/sounds',auth[_0xd667('0x9')](),controller[_0xd667('0x11')]);router[_0xd667('0x12')](_0xd667('0xb'),auth[_0xd667('0x9')](),controller[_0xd667('0x13')]);router[_0xd667('0x14')](_0xd667('0xb'),auth[_0xd667('0x9')](),controller[_0xd667('0x15')]);router[_0xd667('0x14')](_0xd667('0x16'),auth['isAuthenticated'](),controller[_0xd667('0x17')]);module[_0xd667('0x18')]=router; \ No newline at end of file +var _0xbdbd=['isAuthenticated','show','/:id/sounds','getSounds','post','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbdbd,0xbb));var _0xdbdb=function(_0x4b06aa,_0x3feb0c){_0x4b06aa=_0x4b06aa-0x0;var _0x16876c=_0xbdbd[_0x4b06aa];return _0x16876c;};'use strict';var multer=require('multer');var util=require(_0xdbdb('0x0'));var path=require(_0xdbdb('0x1'));var timeout=require(_0xdbdb('0x2'));var express=require(_0xdbdb('0x3'));var router=express[_0xdbdb('0x4')]();var fs_extra=require(_0xdbdb('0x5'));var auth=require(_0xdbdb('0x6'));var interaction=require(_0xdbdb('0x7'));var config=require(_0xdbdb('0x8'));var controller=require(_0xdbdb('0x9'));router[_0xdbdb('0xa')]('/',auth['isAuthenticated'](),controller[_0xdbdb('0xb')]);router[_0xdbdb('0xa')](_0xdbdb('0xc'),auth[_0xdbdb('0xd')](),controller[_0xdbdb('0xe')]);router['get'](_0xdbdb('0xf'),auth[_0xdbdb('0xd')](),controller[_0xdbdb('0x10')]);router[_0xdbdb('0x11')]('/',auth[_0xdbdb('0xd')](),controller['create']);router[_0xdbdb('0x11')](_0xdbdb('0xf'),auth[_0xdbdb('0xd')](),controller[_0xdbdb('0x12')]);router[_0xdbdb('0x13')](_0xdbdb('0xc'),auth[_0xdbdb('0xd')](),controller['update']);router[_0xdbdb('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xdbdb('0x15')]);router[_0xdbdb('0x14')](_0xdbdb('0x16'),auth[_0xdbdb('0xd')](),controller[_0xdbdb('0x17')]);module[_0xdbdb('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7dec27c..170fc4a 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 _0x5833=['alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM','files','mp3nb','quietmp3'];(function(_0x212c1d,_0x216f92){var _0x97d7b=function(_0x40eddd){while(--_0x40eddd){_0x212c1d['push'](_0x212c1d['shift']());}};_0x97d7b(++_0x216f92);}(_0x5833,0xf3));var _0x3583=function(_0x180466,_0x1086c1){_0x180466=_0x180466-0x0;var _0x2bf269=_0x5833[_0x180466];return _0x2bf269;};'use strict';var Sequelize=require('sequelize');module[_0x3583('0x0')]={'name':{'type':Sequelize[_0x3583('0x1')],'allowNull':![],'unique':_0x3583('0x2')},'mode':{'type':Sequelize[_0x3583('0x3')]('custom',_0x3583('0x4'),_0x3583('0x5'),'quietmp3nb',_0x3583('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0x3583('0x4')},'directory':{'type':Sequelize[_0x3583('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x3583('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x3583('0x1')],'allowNull':!![],'defaultValue':_0x3583('0x7')},'format':{'type':Sequelize[_0x3583('0x1')],'allowNull':!![]},'stamp':{'type':_0x3583('0x8')},'defaultEntry':{'type':Sequelize[_0x3583('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfdf0=['BOOLEAN','sequelize','exports','name','ENUM','quietmp3nb','quietmp3','mp3','files','STRING','alpha'];(function(_0x1d4dbc,_0xaf102f){var _0x9592a2=function(_0x240c76){while(--_0x240c76){_0x1d4dbc['push'](_0x1d4dbc['shift']());}};_0x9592a2(++_0xaf102f);}(_0xfdf0,0xbc));var _0x0fdf=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0xfdf0[_0x3e32a8];return _0x2997b0;};'use strict';var Sequelize=require(_0x0fdf('0x0'));module[_0x0fdf('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0fdf('0x2')},'mode':{'type':Sequelize[_0x0fdf('0x3')]('custom','files','mp3nb',_0x0fdf('0x4'),_0x0fdf('0x5'),_0x0fdf('0x6')),'allowNull':!![],'defaultValue':_0x0fdf('0x7')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x0fdf('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0fdf('0x9')},'format':{'type':Sequelize[_0x0fdf('0x8')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x0fdf('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 0f4829c..4e3af82 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 _0xdaa2=['options','includeAll','include','findAll','rows','catch','show','params','find','body','create','transaction','mode','directory','server/files/moh','files','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','root','format','%s.%s','basename','save_name','extname','symlinkSync','removeSound','id2','getSounds','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','MusicOnHolds','then','end','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x57b8a3,_0x3db178){var _0xce85e9=function(_0x2144b7){while(--_0x2144b7){_0x57b8a3['push'](_0x57b8a3['shift']());}};_0xce85e9(++_0x3db178);}(_0xdaa2,0xa5));var _0x2daa=function(_0x10c2a9,_0x566626){_0x10c2a9=_0x10c2a9-0x0;var _0x431906=_0xdaa2[_0x10c2a9];return _0x431906;};'use strict';var emlformat=require(_0x2daa('0x0'));var rimraf=require(_0x2daa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2daa('0x2'));var rp=require(_0x2daa('0x3'));var moment=require(_0x2daa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2daa('0x5'));var util=require(_0x2daa('0x6'));var path=require(_0x2daa('0x7'));var sox=require(_0x2daa('0x8'));var csv=require(_0x2daa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2daa('0xa'));var squel=require('squel');var crypto=require(_0x2daa('0xb'));var jsforce=require(_0x2daa('0xc'));var deskjs=require(_0x2daa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2daa('0xe'));var Papa=require('papaparse');var Redis=require(_0x2daa('0xf'));var authService=require(_0x2daa('0x10'));var qs=require(_0x2daa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2daa('0x12'))(_0x2daa('0x13'));var utils=require(_0x2daa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2daa('0x15'));var db=require(_0x2daa('0x16'))['db'];function respondWithStatusCode(_0x471b31,_0x4d84c4){_0x4d84c4=_0x4d84c4||0xcc;return function(_0x201c97){if(_0x201c97){return _0x471b31[_0x2daa('0x17')](_0x4d84c4);}return _0x471b31[_0x2daa('0x18')](_0x4d84c4)['end']();};}function respondWithResult(_0x2e3e21,_0x49b6e9){_0x49b6e9=_0x49b6e9||0xc8;return function(_0x378a39){if(_0x378a39){return _0x2e3e21[_0x2daa('0x18')](_0x49b6e9)[_0x2daa('0x19')](_0x378a39);}};}function respondWithFilteredResult(_0x562237,_0x1b660f){return function(_0x34363f){if(_0x34363f){var _0x48cb81=typeof _0x1b660f[_0x2daa('0x1a')]===_0x2daa('0x1b')&&typeof _0x1b660f[_0x2daa('0x1c')]===_0x2daa('0x1b');var _0x4fc5d1=_0x34363f[_0x2daa('0x1d')];var _0x1415d5=_0x48cb81?0x0:_0x1b660f[_0x2daa('0x1a')];var _0x30f63a=_0x48cb81?_0x34363f[_0x2daa('0x1d')]:_0x1b660f[_0x2daa('0x1a')]+_0x1b660f['limit'];var _0x2c141b;if(_0x30f63a>=_0x4fc5d1){_0x30f63a=_0x4fc5d1;_0x2c141b=0xc8;}else{_0x2c141b=0xce;}_0x562237[_0x2daa('0x18')](_0x2c141b);return _0x562237[_0x2daa('0x1e')](_0x2daa('0x1f'),_0x1415d5+'-'+_0x30f63a+'/'+_0x4fc5d1)[_0x2daa('0x19')](_0x34363f);}return null;};}function patchUpdates(_0x319d81){return function(_0x2aa99e){try{jsonpatch[_0x2daa('0x20')](_0x2aa99e,_0x319d81,!![]);}catch(_0x5b3741){return BPromise[_0x2daa('0x21')](_0x5b3741);}return _0x2aa99e['save']();};}function saveUpdates(_0x77affa,_0x3a8fbc){return function(_0x40a577){if(_0x40a577){return _0x40a577[_0x2daa('0x22')](_0x77affa)['then'](function(_0x3f9081){return _0x3f9081;});}return null;};}function removeEntity(_0x31d59a,_0x770669){return function(_0x59ed61){if(_0x59ed61){return _0x59ed61[_0x2daa('0x23')]()['then'](function(){var _0x28aa4d=_0x59ed61['get']({'plain':!![]});var _0x15ad85=_0x2daa('0x24');return db['UserProfileResource'][_0x2daa('0x23')]({'where':{'type':_0x15ad85,'resourceId':_0x28aa4d['id']}})[_0x2daa('0x25')](function(){return _0x59ed61;});})[_0x2daa('0x25')](function(){_0x31d59a[_0x2daa('0x18')](0xcc)[_0x2daa('0x26')]();});}};}function handleEntityNotFound(_0x4c76da,_0x5a838d){return function(_0x8a2be7){if(!_0x8a2be7){_0x4c76da[_0x2daa('0x17')](0x194);}return _0x8a2be7;};}function handleError(_0x2458a,_0x126917){_0x126917=_0x126917||0x1f4;return function(_0x16213c){logger[_0x2daa('0x27')](_0x16213c[_0x2daa('0x28')]);if(_0x16213c[_0x2daa('0x29')]){delete _0x16213c[_0x2daa('0x29')];}_0x2458a[_0x2daa('0x18')](_0x126917)[_0x2daa('0x2a')](_0x16213c);};}exports[_0x2daa('0x2b')]=function(_0x3e1007,_0x1cc8dd){var _0x4cf681={},_0x3afdd9={},_0x33fe18={'count':0x0,'rows':[]};var _0x3a16ae=_[_0x2daa('0x2c')](db[_0x2daa('0x2d')][_0x2daa('0x2e')],function(_0x2e9616){return{'name':_0x2e9616['fieldName'],'type':_0x2e9616[_0x2daa('0x2f')][_0x2daa('0x30')]};});_0x3afdd9[_0x2daa('0x31')]=_['map'](_0x3a16ae,_0x2daa('0x29'));_0x3afdd9[_0x2daa('0x32')]=_[_0x2daa('0x33')](_0x3e1007[_0x2daa('0x32')]);_0x3afdd9[_0x2daa('0x34')]=_['intersection'](_0x3afdd9[_0x2daa('0x31')],_0x3afdd9['query']);_0x4cf681[_0x2daa('0x35')]=_[_0x2daa('0x36')](_0x3afdd9[_0x2daa('0x31')],qs[_0x2daa('0x37')](_0x3e1007['query'][_0x2daa('0x37')]));_0x4cf681[_0x2daa('0x35')]=_0x4cf681[_0x2daa('0x35')][_0x2daa('0x38')]?_0x4cf681['attributes']:_0x3afdd9[_0x2daa('0x31')];if(!_0x3e1007[_0x2daa('0x32')][_0x2daa('0x39')](_0x2daa('0x3a'))){_0x4cf681[_0x2daa('0x1c')]=qs[_0x2daa('0x1c')](_0x3e1007[_0x2daa('0x32')][_0x2daa('0x1c')]);_0x4cf681[_0x2daa('0x1a')]=qs['offset'](_0x3e1007['query'][_0x2daa('0x1a')]);}_0x4cf681[_0x2daa('0x3b')]=qs['sort'](_0x3e1007[_0x2daa('0x32')][_0x2daa('0x3c')]);delete _0x3e1007[_0x2daa('0x32')][_0x2daa('0x3c')];_0x4cf681[_0x2daa('0x3d')]=qs[_0x2daa('0x34')](_['pick'](_0x3e1007['query'],_0x3afdd9[_0x2daa('0x34')]),_0x3a16ae);if(_0x3e1007['query'][_0x2daa('0x3e')]){_0x4cf681['where']=_[_0x2daa('0x3f')](_0x4cf681['where'],{'$or':_[_0x2daa('0x2c')](_0x3a16ae,function(_0x68a89b){if(_0x68a89b['type']!==_0x2daa('0x40')){var _0x58068f={};_0x58068f[_0x68a89b[_0x2daa('0x29')]]={'$like':'%'+_0x3e1007['query'][_0x2daa('0x3e')]+'%'};return _0x58068f;}})});}_0x4cf681=_[_0x2daa('0x3f')]({},_0x4cf681,_0x3e1007[_0x2daa('0x41')]);var _0x42c52d={'where':_0x4cf681[_0x2daa('0x3d')]};return db[_0x2daa('0x2d')][_0x2daa('0x1d')](_0x42c52d)[_0x2daa('0x25')](function(_0x5b9566){_0x33fe18[_0x2daa('0x1d')]=_0x5b9566;if(_0x3e1007['query'][_0x2daa('0x42')]){_0x4cf681[_0x2daa('0x43')]=[{'all':!![]}];}return db[_0x2daa('0x2d')][_0x2daa('0x44')](_0x4cf681);})[_0x2daa('0x25')](function(_0x348c6d){_0x33fe18[_0x2daa('0x45')]=_0x348c6d;return _0x33fe18;})[_0x2daa('0x25')](respondWithFilteredResult(_0x1cc8dd,_0x4cf681))[_0x2daa('0x46')](handleError(_0x1cc8dd,null));};exports[_0x2daa('0x47')]=function(_0x2fa8a4,_0x11f9d2){var _0x4cd06f={'raw':![],'where':{'id':_0x2fa8a4[_0x2daa('0x48')]['id']}},_0x75524c={};_0x75524c['model']=_[_0x2daa('0x33')](db[_0x2daa('0x2d')][_0x2daa('0x2e')]);_0x75524c['query']=_[_0x2daa('0x33')](_0x2fa8a4[_0x2daa('0x32')]);_0x75524c['filters']=_['intersection'](_0x75524c[_0x2daa('0x31')],_0x75524c[_0x2daa('0x32')]);_0x4cd06f[_0x2daa('0x35')]=_[_0x2daa('0x36')](_0x75524c['model'],qs['fields'](_0x2fa8a4[_0x2daa('0x32')][_0x2daa('0x37')]));_0x4cd06f[_0x2daa('0x35')]=_0x4cd06f['attributes'][_0x2daa('0x38')]?_0x4cd06f[_0x2daa('0x35')]:_0x75524c[_0x2daa('0x31')];if(_0x2fa8a4[_0x2daa('0x32')][_0x2daa('0x42')]){_0x4cd06f[_0x2daa('0x43')]=[{'all':!![]}];}_0x4cd06f=_[_0x2daa('0x3f')]({},_0x4cd06f,_0x2fa8a4[_0x2daa('0x41')]);return db[_0x2daa('0x2d')][_0x2daa('0x49')](_0x4cd06f)[_0x2daa('0x25')](handleEntityNotFound(_0x11f9d2,null))[_0x2daa('0x25')](respondWithResult(_0x11f9d2,null))['catch'](handleError(_0x11f9d2,null));};exports[_0x2daa('0x22')]=function(_0x3627fb,_0x288d45){if(_0x3627fb[_0x2daa('0x4a')]['id']){delete _0x3627fb[_0x2daa('0x4a')]['id'];}return db[_0x2daa('0x2d')][_0x2daa('0x49')]({'where':{'id':_0x3627fb[_0x2daa('0x48')]['id']}})['then'](handleEntityNotFound(_0x288d45,null))[_0x2daa('0x25')](saveUpdates(_0x3627fb[_0x2daa('0x4a')],null))[_0x2daa('0x25')](respondWithResult(_0x288d45,null))[_0x2daa('0x46')](handleError(_0x288d45,null));};exports[_0x2daa('0x4b')]=function(_0x250910,_0x2535b3,_0x125aca){return db['sequelize'][_0x2daa('0x4c')](function(_0x1bd343){if(_0x250910[_0x2daa('0x4a')][_0x2daa('0x4d')]==='files'){_0x250910[_0x2daa('0x4a')][_0x2daa('0x4e')]=path['join'](config['root'],_0x2daa('0x4f'),_0x250910[_0x2daa('0x4a')]['name']);}return db[_0x2daa('0x2d')]['create'](_0x250910[_0x2daa('0x4a')],{'transaction':_0x1bd343})['then'](function(_0x428e85){if(_0x250910['body'][_0x2daa('0x4d')]===_0x2daa('0x50')){fs[_0x2daa('0x51')](_0x428e85[_0x2daa('0x4e')],parseInt(_0x2daa('0x52'),0x8));}var _0x5e6f26=_0x250910[_0x2daa('0x53')][_0x2daa('0x54')]({'plain':!![]});if(!_0x5e6f26)throw new Error(_0x2daa('0x55'));if(_0x5e6f26[_0x2daa('0x56')]===_0x2daa('0x53')){var _0x1af807=_0x428e85[_0x2daa('0x54')]({'plain':!![]});return db[_0x2daa('0x57')][_0x2daa('0x49')]({'where':{'name':_0x2daa('0x24'),'userProfileId':_0x5e6f26[_0x2daa('0x58')]},'raw':!![]})['then'](function(_0x40235a){if(_0x40235a&&_0x40235a['autoAssociation']===0x0){return db['UserProfileResource'][_0x2daa('0x4b')]({'name':_0x1af807[_0x2daa('0x29')],'resourceId':_0x1af807['id'],'type':_0x40235a['name'],'sectionId':_0x40235a['id']},{})[_0x2daa('0x25')](function(){return _0x428e85;});}else{return _0x428e85;}})['catch'](function(_0x57d410){logger[_0x2daa('0x27')](_0x2daa('0x59'),_0x57d410);});}return _0x428e85;});})[_0x2daa('0x25')](respondWithResult(_0x2535b3,0xc9))['catch'](handleError(_0x2535b3,null));};exports[_0x2daa('0x23')]=function(_0x46d8fa,_0x2bfbe4,_0x1e9318){var _0x10d8b7;return db[_0x2daa('0x2d')][_0x2daa('0x49')]({'where':{'id':_0x46d8fa[_0x2daa('0x48')]['id']}})[_0x2daa('0x25')](function(_0x561c67){if(_0x561c67){return db[_0x2daa('0x5a')][_0x2daa('0x4c')](function(_0x33ae36){return _0x561c67['destroy']({'transaction':_0x33ae36,'raw':!![]})['then'](function(_0x31d086){if(_0x31d086[_0x2daa('0x4e')]){fs[_0x2daa('0x5b')](_0x31d086[_0x2daa('0x4e')])[_0x2daa('0x5c')](function(_0xbcdda){fs[_0x2daa('0x5d')](path[_0x2daa('0x5e')](_0x31d086[_0x2daa('0x4e')],_0xbcdda));});fs[_0x2daa('0x5f')](_0x31d086[_0x2daa('0x4e')]);}return _0x31d086;});})[_0x2daa('0x46')](function(_0x5e6870){throw new db[(_0x2daa('0x60'))][(_0x2daa('0x61'))](_0x5e6870[_0x2daa('0x62')]);});}})[_0x2daa('0x25')](handleEntityNotFound(_0x2bfbe4,null))['then'](removeEntity(_0x2bfbe4,null))[_0x2daa('0x46')](handleError(_0x2bfbe4,null));};exports[_0x2daa('0x63')]=function(_0xe076fe,_0x259162,_0x453290){return db[_0x2daa('0x5a')][_0x2daa('0x4c')](function(_0x31f38d){var _0x36cc15;return db[_0x2daa('0x2d')]['find']({'where':{'id':_0xe076fe[_0x2daa('0x48')]['id']}})['then'](function(_0x3c25bb){if(_0x3c25bb){_0x36cc15=_0x3c25bb;return _0x3c25bb[_0x2daa('0x63')](_0xe076fe['body']['id'],{'transaction':_0x31f38d});}})['then'](function(_0x311939){if(_0x311939){return db[_0x2daa('0x64')][_0x2daa('0x65')]({'where':{'id':_0xe076fe['body']['id']},'attributes':['id','name','save_name',_0x2daa('0x66'),_0x2daa('0x67')],'raw':!![]});}})['then'](function(_0x53cd57){if(_0x53cd57){var _0xd36592=path['join'](config[_0x2daa('0x68')],'server/files/sounds/converted',util[_0x2daa('0x69')](_0x2daa('0x6a'),path[_0x2daa('0x6b')](_0x53cd57[_0x2daa('0x6c')],path[_0x2daa('0x6d')](_0x53cd57[_0x2daa('0x6c')])),_0x53cd57[_0x2daa('0x66')]));var _0x44d277=path[_0x2daa('0x5e')](config['root'],'server/files/moh',_0x36cc15[_0x2daa('0x29')],util[_0x2daa('0x69')](_0x2daa('0x6a'),_0x53cd57[_0x2daa('0x29')],_0x53cd57[_0x2daa('0x66')]));fs[_0x2daa('0x6e')](_0xd36592,_0x44d277);return _0x53cd57;}})[_0x2daa('0x46')](function(_0x1767e7){throw new db[(_0x2daa('0x60'))][(_0x2daa('0x61'))](_0x1767e7[_0x2daa('0x62')]);});})[_0x2daa('0x25')](handleEntityNotFound(_0x259162,null))[_0x2daa('0x25')](respondWithResult(_0x259162,0xc9))[_0x2daa('0x46')](handleError(_0x259162,null));};exports[_0x2daa('0x6f')]=function(_0x8cae3f,_0x38695f,_0x2a5c92){return db[_0x2daa('0x5a')][_0x2daa('0x4c')](function(_0x2b613b){var _0x4da54d;return db['VoiceMusicOnHold'][_0x2daa('0x65')]({'where':{'id':_0x8cae3f[_0x2daa('0x48')]['id']}})[_0x2daa('0x25')](handleEntityNotFound(_0x38695f,null))['then'](function(_0x1ce61a){if(_0x1ce61a){_0x4da54d=_0x1ce61a;return _0x1ce61a[_0x2daa('0x6f')](_0x8cae3f[_0x2daa('0x48')][_0x2daa('0x70')]);}})[_0x2daa('0x25')](function(_0x4b9f25){if(_0x4b9f25){return db[_0x2daa('0x64')]['findOne']({'where':{'id':_0x8cae3f[_0x2daa('0x48')][_0x2daa('0x70')]},'attributes':['id',_0x2daa('0x29'),'save_name',_0x2daa('0x66'),_0x2daa('0x67')],'raw':!![]});}})[_0x2daa('0x25')](function(_0xec4db3){if(_0xec4db3){fs[_0x2daa('0x5d')](path['join'](_0x4da54d[_0x2daa('0x4e')],util[_0x2daa('0x69')]('%s.%s',_0xec4db3[_0x2daa('0x29')],_0xec4db3[_0x2daa('0x66')])));return _0xec4db3;}})[_0x2daa('0x46')](function(_0x145e8d){throw new db['Sequelize'][(_0x2daa('0x61'))](_0x145e8d[_0x2daa('0x62')]);});})['then'](handleEntityNotFound(_0x38695f,null))[_0x2daa('0x25')](respondWithStatusCode(_0x38695f,0xcc))[_0x2daa('0x46')](handleError(_0x38695f,null));};exports[_0x2daa('0x71')]=function(_0xc2045f,_0x5566b1,_0x4039f0){var _0x51942={};var _0x37521e={};var _0x1e6aa9;var _0x4fabc2;return db[_0x2daa('0x2d')][_0x2daa('0x65')]({'where':{'id':_0xc2045f['params']['id']}})[_0x2daa('0x25')](handleEntityNotFound(_0x5566b1,null))[_0x2daa('0x25')](function(_0x303304){if(_0x303304){_0x1e6aa9=_0x303304;_0x37521e[_0x2daa('0x31')]=_[_0x2daa('0x33')](db[_0x2daa('0x64')]['rawAttributes']);_0x37521e[_0x2daa('0x32')]=_[_0x2daa('0x33')](_0xc2045f[_0x2daa('0x32')]);_0x37521e[_0x2daa('0x34')]=_['intersection'](_0x37521e['model'],_0x37521e[_0x2daa('0x32')]);_0x51942[_0x2daa('0x35')]=_[_0x2daa('0x36')](_0x37521e[_0x2daa('0x31')],qs[_0x2daa('0x37')](_0xc2045f[_0x2daa('0x32')]['fields']));_0x51942[_0x2daa('0x35')]=_0x51942[_0x2daa('0x35')][_0x2daa('0x38')]?_0x51942[_0x2daa('0x35')]:_0x37521e['model'];_0x51942[_0x2daa('0x3b')]=qs[_0x2daa('0x3c')](_0xc2045f[_0x2daa('0x32')]['sort']);_0x51942['where']=qs[_0x2daa('0x34')](_[_0x2daa('0x72')](_0xc2045f[_0x2daa('0x32')],_0x37521e[_0x2daa('0x34')]));if(_0xc2045f[_0x2daa('0x32')][_0x2daa('0x3e')]){_0x51942[_0x2daa('0x3d')]=_['merge'](_0x51942[_0x2daa('0x3d')],{'$or':_[_0x2daa('0x2c')](_0x51942[_0x2daa('0x35')],function(_0x46adc1){var _0x4cef43={};_0x4cef43[_0x46adc1]={'$like':'%'+_0xc2045f[_0x2daa('0x32')][_0x2daa('0x3e')]+'%'};return _0x4cef43;})});}_0x51942=_[_0x2daa('0x3f')]({},_0x51942,_0xc2045f[_0x2daa('0x41')]);return _0x1e6aa9['getSounds'](_0x51942);}})[_0x2daa('0x25')](function(_0x3366c8){if(_0x3366c8){_0x4fabc2=_0x3366c8['length'];if(!_0xc2045f[_0x2daa('0x32')][_0x2daa('0x39')](_0x2daa('0x3a'))){_0x51942[_0x2daa('0x1c')]=qs[_0x2daa('0x1c')](_0xc2045f[_0x2daa('0x32')][_0x2daa('0x1c')]);_0x51942[_0x2daa('0x1a')]=qs[_0x2daa('0x1a')](_0xc2045f[_0x2daa('0x32')]['offset']);}return _0x1e6aa9[_0x2daa('0x71')](_0x51942);}})[_0x2daa('0x25')](function(_0x19226a){if(_0x19226a){return _0x19226a?{'count':_0x4fabc2,'rows':_0x19226a}:null;}})[_0x2daa('0x25')](respondWithResult(_0x5566b1,null))[_0x2daa('0x46')](handleError(_0x5566b1,null));}; \ No newline at end of file +var _0x2032=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','MusicOnHolds','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','length','includeAll','find','update','body','sequelize','transaction','mode','directory','join','root','server/files/moh','create','files','mkdirSync','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','%s.%s','symlinkSync','ValidationError','getSounds','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0xc887a1,_0xd53f1f){var _0x4cb057=function(_0x4636fc){while(--_0x4636fc){_0xc887a1['push'](_0xc887a1['shift']());}};_0x4cb057(++_0xd53f1f);}(_0x2032,0xd2));var _0x2203=function(_0x5b670b,_0xcf69f5){_0x5b670b=_0x5b670b-0x0;var _0x321581=_0x2032[_0x5b670b];return _0x321581;};'use strict';var emlformat=require(_0x2203('0x0'));var rimraf=require(_0x2203('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2203('0x2'));var rp=require(_0x2203('0x3'));var moment=require(_0x2203('0x4'));var BPromise=require(_0x2203('0x5'));var Mustache=require(_0x2203('0x6'));var util=require('util');var path=require(_0x2203('0x7'));var sox=require('sox');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('squel');var crypto=require(_0x2203('0xc'));var jsforce=require(_0x2203('0xd'));var deskjs=require(_0x2203('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2203('0xf'));var Papa=require('papaparse');var Redis=require(_0x2203('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2203('0x11'));var as=require(_0x2203('0x12'));var hardwareService=require(_0x2203('0x13'));var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require(_0x2203('0x16'));var licenseUtil=require(_0x2203('0x17'));var db=require(_0x2203('0x18'))['db'];function respondWithStatusCode(_0x4233c0,_0x12bfe0){_0x12bfe0=_0x12bfe0||0xcc;return function(_0x2a523e){if(_0x2a523e){return _0x4233c0['sendStatus'](_0x12bfe0);}return _0x4233c0[_0x2203('0x19')](_0x12bfe0)['end']();};}function respondWithResult(_0x321e6d,_0x241462){_0x241462=_0x241462||0xc8;return function(_0x5a54a4){if(_0x5a54a4){return _0x321e6d[_0x2203('0x19')](_0x241462)['json'](_0x5a54a4);}};}function respondWithFilteredResult(_0xe194d2,_0x5907f5){return function(_0x59194f){if(_0x59194f){var _0x45e8a8=typeof _0x5907f5[_0x2203('0x1a')]===_0x2203('0x1b')&&typeof _0x5907f5[_0x2203('0x1c')]===_0x2203('0x1b');var _0x2119ba=_0x59194f['count'];var _0x47d1ef=_0x45e8a8?0x0:_0x5907f5['offset'];var _0x5ad653=_0x45e8a8?_0x59194f[_0x2203('0x1d')]:_0x5907f5[_0x2203('0x1a')]+_0x5907f5[_0x2203('0x1c')];var _0x20e240;if(_0x5ad653>=_0x2119ba){_0x5ad653=_0x2119ba;_0x20e240=0xc8;}else{_0x20e240=0xce;}_0xe194d2[_0x2203('0x19')](_0x20e240);return _0xe194d2[_0x2203('0x1e')](_0x2203('0x1f'),_0x47d1ef+'-'+_0x5ad653+'/'+_0x2119ba)[_0x2203('0x20')](_0x59194f);}return null;};}function patchUpdates(_0x4099b8){return function(_0x5dbfd6){try{jsonpatch[_0x2203('0x21')](_0x5dbfd6,_0x4099b8,!![]);}catch(_0x700a5e){return BPromise[_0x2203('0x22')](_0x700a5e);}return _0x5dbfd6[_0x2203('0x23')]();};}function saveUpdates(_0x3ccf2b,_0x141a2d){return function(_0x75dc31){if(_0x75dc31){return _0x75dc31['update'](_0x3ccf2b)[_0x2203('0x24')](function(_0x56053f){return _0x56053f;});}return null;};}function removeEntity(_0x4fe961,_0x50b94b){return function(_0x46e5fc){if(_0x46e5fc){return _0x46e5fc[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x3971c5=_0x46e5fc['get']({'plain':!![]});var _0x4a4659=_0x2203('0x26');return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x4a4659,'resourceId':_0x3971c5['id']}})[_0x2203('0x24')](function(){return _0x46e5fc;});})['then'](function(){_0x4fe961[_0x2203('0x19')](0xcc)[_0x2203('0x28')]();});}};}function handleEntityNotFound(_0x91234d,_0x141b9b){return function(_0x109625){if(!_0x109625){_0x91234d[_0x2203('0x29')](0x194);}return _0x109625;};}function handleError(_0x38bd9b,_0x254db5){_0x254db5=_0x254db5||0x1f4;return function(_0x30ab54){logger[_0x2203('0x2a')](_0x30ab54[_0x2203('0x2b')]);if(_0x30ab54['name']){delete _0x30ab54[_0x2203('0x2c')];}_0x38bd9b[_0x2203('0x19')](_0x254db5)[_0x2203('0x2d')](_0x30ab54);};}exports[_0x2203('0x2e')]=function(_0x2c48bb,_0x4f4d84){var _0x2c4587={},_0x2c5648={},_0x22b785={'count':0x0,'rows':[]};var _0x231cb2=_[_0x2203('0x2f')](db[_0x2203('0x30')][_0x2203('0x31')],function(_0x58c764){return{'name':_0x58c764[_0x2203('0x32')],'type':_0x58c764[_0x2203('0x33')]['key']};});_0x2c5648[_0x2203('0x34')]=_[_0x2203('0x2f')](_0x231cb2,'name');_0x2c5648[_0x2203('0x35')]=_['keys'](_0x2c48bb[_0x2203('0x35')]);_0x2c5648[_0x2203('0x36')]=_[_0x2203('0x37')](_0x2c5648['model'],_0x2c5648[_0x2203('0x35')]);_0x2c4587[_0x2203('0x38')]=_[_0x2203('0x37')](_0x2c5648[_0x2203('0x34')],qs['fields'](_0x2c48bb['query'][_0x2203('0x39')]));_0x2c4587['attributes']=_0x2c4587['attributes']['length']?_0x2c4587[_0x2203('0x38')]:_0x2c5648[_0x2203('0x34')];if(!_0x2c48bb[_0x2203('0x35')]['hasOwnProperty']('nolimit')){_0x2c4587[_0x2203('0x1c')]=qs['limit'](_0x2c48bb[_0x2203('0x35')][_0x2203('0x1c')]);_0x2c4587['offset']=qs[_0x2203('0x1a')](_0x2c48bb[_0x2203('0x35')][_0x2203('0x1a')]);}_0x2c4587[_0x2203('0x3a')]=qs[_0x2203('0x3b')](_0x2c48bb[_0x2203('0x35')][_0x2203('0x3b')]);delete _0x2c48bb['query'][_0x2203('0x3b')];_0x2c4587[_0x2203('0x3c')]=qs[_0x2203('0x36')](_[_0x2203('0x3d')](_0x2c48bb['query'],_0x2c5648['filters']),_0x231cb2);if(_0x2c48bb[_0x2203('0x35')][_0x2203('0x3e')]){_0x2c4587[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x2c4587[_0x2203('0x3c')],{'$or':_[_0x2203('0x2f')](_0x231cb2,function(_0x327730){if(_0x327730['type']!==_0x2203('0x40')){var _0x1c8628={};_0x1c8628[_0x327730['name']]={'$like':'%'+_0x2c48bb[_0x2203('0x35')][_0x2203('0x3e')]+'%'};return _0x1c8628;}})});}_0x2c4587=_['merge']({},_0x2c4587,_0x2c48bb[_0x2203('0x41')]);var _0x5c007c={'where':_0x2c4587['where']};return db['VoiceMusicOnHold']['count'](_0x5c007c)[_0x2203('0x24')](function(_0x52b754){_0x22b785[_0x2203('0x1d')]=_0x52b754;if(_0x2c48bb[_0x2203('0x35')]['includeAll']){_0x2c4587[_0x2203('0x42')]=[{'all':!![]}];}return db[_0x2203('0x30')][_0x2203('0x43')](_0x2c4587);})[_0x2203('0x24')](function(_0x5eb640){_0x22b785[_0x2203('0x44')]=_0x5eb640;return _0x22b785;})['then'](respondWithFilteredResult(_0x4f4d84,_0x2c4587))[_0x2203('0x45')](handleError(_0x4f4d84,null));};exports['show']=function(_0x9c8f33,_0x59acc9){var _0x62d3df={'raw':![],'where':{'id':_0x9c8f33[_0x2203('0x46')]['id']}},_0x45f002={};_0x45f002[_0x2203('0x34')]=_[_0x2203('0x47')](db[_0x2203('0x30')]['rawAttributes']);_0x45f002[_0x2203('0x35')]=_['keys'](_0x9c8f33[_0x2203('0x35')]);_0x45f002['filters']=_[_0x2203('0x37')](_0x45f002[_0x2203('0x34')],_0x45f002[_0x2203('0x35')]);_0x62d3df[_0x2203('0x38')]=_[_0x2203('0x37')](_0x45f002[_0x2203('0x34')],qs[_0x2203('0x39')](_0x9c8f33[_0x2203('0x35')][_0x2203('0x39')]));_0x62d3df[_0x2203('0x38')]=_0x62d3df[_0x2203('0x38')][_0x2203('0x48')]?_0x62d3df['attributes']:_0x45f002[_0x2203('0x34')];if(_0x9c8f33[_0x2203('0x35')][_0x2203('0x49')]){_0x62d3df['include']=[{'all':!![]}];}_0x62d3df=_['merge']({},_0x62d3df,_0x9c8f33[_0x2203('0x41')]);return db[_0x2203('0x30')][_0x2203('0x4a')](_0x62d3df)[_0x2203('0x24')](handleEntityNotFound(_0x59acc9,null))[_0x2203('0x24')](respondWithResult(_0x59acc9,null))['catch'](handleError(_0x59acc9,null));};exports[_0x2203('0x4b')]=function(_0x15a271,_0x17728b){if(_0x15a271[_0x2203('0x4c')]['id']){delete _0x15a271[_0x2203('0x4c')]['id'];}return db[_0x2203('0x30')][_0x2203('0x4a')]({'where':{'id':_0x15a271[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x17728b,null))['then'](saveUpdates(_0x15a271['body'],null))[_0x2203('0x24')](respondWithResult(_0x17728b,null))[_0x2203('0x45')](handleError(_0x17728b,null));};exports['create']=function(_0x5d0c69,_0x4b5a94,_0x19c1a1){return db[_0x2203('0x4d')][_0x2203('0x4e')](function(_0x3b8aa1){if(_0x5d0c69[_0x2203('0x4c')][_0x2203('0x4f')]==='files'){_0x5d0c69[_0x2203('0x4c')][_0x2203('0x50')]=path[_0x2203('0x51')](config[_0x2203('0x52')],_0x2203('0x53'),_0x5d0c69['body'][_0x2203('0x2c')]);}return db[_0x2203('0x30')][_0x2203('0x54')](_0x5d0c69['body'],{'transaction':_0x3b8aa1})['then'](function(_0x540a6e){if(_0x5d0c69[_0x2203('0x4c')][_0x2203('0x4f')]===_0x2203('0x55')){fs[_0x2203('0x56')](_0x540a6e[_0x2203('0x50')],parseInt('0777',0x8));}var _0x36e11c=_0x5d0c69[_0x2203('0x57')][_0x2203('0x58')]({'plain':!![]});if(!_0x36e11c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36e11c[_0x2203('0x59')]===_0x2203('0x57')){var _0x2afc98=_0x540a6e[_0x2203('0x58')]({'plain':!![]});return db[_0x2203('0x5a')][_0x2203('0x4a')]({'where':{'name':_0x2203('0x26'),'userProfileId':_0x36e11c[_0x2203('0x5b')]},'raw':!![]})[_0x2203('0x24')](function(_0xb70320){if(_0xb70320&&_0xb70320[_0x2203('0x5c')]===0x0){return db[_0x2203('0x27')][_0x2203('0x54')]({'name':_0x2afc98[_0x2203('0x2c')],'resourceId':_0x2afc98['id'],'type':_0xb70320[_0x2203('0x2c')],'sectionId':_0xb70320['id']},{})[_0x2203('0x24')](function(){return _0x540a6e;});}else{return _0x540a6e;}})['catch'](function(_0x452be2){logger[_0x2203('0x2a')](_0x2203('0x5d'),_0x452be2);});}return _0x540a6e;});})[_0x2203('0x24')](respondWithResult(_0x4b5a94,0xc9))['catch'](handleError(_0x4b5a94,null));};exports[_0x2203('0x25')]=function(_0x4603a1,_0x483c8d,_0xc713ad){var _0x16c262;return db[_0x2203('0x30')]['find']({'where':{'id':_0x4603a1['params']['id']}})[_0x2203('0x24')](function(_0x15e97d){if(_0x15e97d){return db[_0x2203('0x4d')][_0x2203('0x4e')](function(_0x14dba2){return _0x15e97d[_0x2203('0x25')]({'transaction':_0x14dba2,'raw':!![]})['then'](function(_0x162b15){if(_0x162b15['directory']){fs[_0x2203('0x5e')](_0x162b15['directory'])['forEach'](function(_0x3568e5){fs[_0x2203('0x5f')](path[_0x2203('0x51')](_0x162b15[_0x2203('0x50')],_0x3568e5));});fs[_0x2203('0x60')](_0x162b15['directory']);}return _0x162b15;});})['catch'](function(_0x3bdb2f){throw new db[(_0x2203('0x61'))]['ValidationError'](_0x3bdb2f[_0x2203('0x62')]);});}})[_0x2203('0x24')](handleEntityNotFound(_0x483c8d,null))[_0x2203('0x24')](removeEntity(_0x483c8d,null))['catch'](handleError(_0x483c8d,null));};exports[_0x2203('0x63')]=function(_0x27cc5d,_0x2f2026,_0x347029){return db['sequelize'][_0x2203('0x4e')](function(_0x335ee5){var _0x10b6ff;return db[_0x2203('0x30')][_0x2203('0x4a')]({'where':{'id':_0x27cc5d[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x560585){if(_0x560585){_0x10b6ff=_0x560585;return _0x560585[_0x2203('0x63')](_0x27cc5d[_0x2203('0x4c')]['id'],{'transaction':_0x335ee5});}})['then'](function(_0x559faf){if(_0x559faf){return db[_0x2203('0x64')][_0x2203('0x65')]({'where':{'id':_0x27cc5d[_0x2203('0x4c')]['id']},'attributes':['id','name',_0x2203('0x66'),_0x2203('0x67'),_0x2203('0x68')],'raw':!![]});}})[_0x2203('0x24')](function(_0x51668f){if(_0x51668f){var _0x1cf8ba=path[_0x2203('0x51')](config[_0x2203('0x52')],_0x2203('0x69'),util[_0x2203('0x6a')]('%s.%s',path[_0x2203('0x6b')](_0x51668f[_0x2203('0x66')],path['extname'](_0x51668f[_0x2203('0x66')])),_0x51668f['converted_format']));var _0xdf8856=path[_0x2203('0x51')](config[_0x2203('0x52')],_0x2203('0x53'),_0x10b6ff[_0x2203('0x2c')],util[_0x2203('0x6a')](_0x2203('0x6c'),_0x51668f[_0x2203('0x2c')],_0x51668f[_0x2203('0x67')]));fs[_0x2203('0x6d')](_0x1cf8ba,_0xdf8856);return _0x51668f;}})[_0x2203('0x45')](function(_0x37404c){throw new db['Sequelize'][(_0x2203('0x6e'))](_0x37404c[_0x2203('0x62')]);});})[_0x2203('0x24')](handleEntityNotFound(_0x2f2026,null))['then'](respondWithResult(_0x2f2026,0xc9))[_0x2203('0x45')](handleError(_0x2f2026,null));};exports['removeSound']=function(_0x39dc61,_0x3a9c37,_0x24d9de){return db[_0x2203('0x4d')][_0x2203('0x4e')](function(_0x1488db){var _0x2c1c4e;return db['VoiceMusicOnHold'][_0x2203('0x65')]({'where':{'id':_0x39dc61[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x3a9c37,null))['then'](function(_0x5b1846){if(_0x5b1846){_0x2c1c4e=_0x5b1846;return _0x5b1846['removeSound'](_0x39dc61[_0x2203('0x46')]['id2']);}})[_0x2203('0x24')](function(_0x36f111){if(_0x36f111){return db['Sound']['findOne']({'where':{'id':_0x39dc61[_0x2203('0x46')]['id2']},'attributes':['id','name','save_name','converted_format',_0x2203('0x68')],'raw':!![]});}})[_0x2203('0x24')](function(_0x2b44bc){if(_0x2b44bc){fs['unlinkSync'](path[_0x2203('0x51')](_0x2c1c4e['directory'],util['format'](_0x2203('0x6c'),_0x2b44bc[_0x2203('0x2c')],_0x2b44bc['converted_format'])));return _0x2b44bc;}})['catch'](function(_0x4625f2){throw new db[(_0x2203('0x61'))][(_0x2203('0x6e'))](_0x4625f2[_0x2203('0x62')]);});})[_0x2203('0x24')](handleEntityNotFound(_0x3a9c37,null))[_0x2203('0x24')](respondWithStatusCode(_0x3a9c37,0xcc))['catch'](handleError(_0x3a9c37,null));};exports['getSounds']=function(_0x459d57,_0x2736f8,_0x2edc52){var _0x32ef27={};var _0x417adf={};var _0x4eb7e6;var _0x541bf2;return db[_0x2203('0x30')][_0x2203('0x65')]({'where':{'id':_0x459d57[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x2736f8,null))[_0x2203('0x24')](function(_0x420152){if(_0x420152){_0x4eb7e6=_0x420152;_0x417adf[_0x2203('0x34')]=_[_0x2203('0x47')](db[_0x2203('0x64')][_0x2203('0x31')]);_0x417adf[_0x2203('0x35')]=_[_0x2203('0x47')](_0x459d57[_0x2203('0x35')]);_0x417adf['filters']=_[_0x2203('0x37')](_0x417adf[_0x2203('0x34')],_0x417adf[_0x2203('0x35')]);_0x32ef27[_0x2203('0x38')]=_[_0x2203('0x37')](_0x417adf[_0x2203('0x34')],qs[_0x2203('0x39')](_0x459d57[_0x2203('0x35')][_0x2203('0x39')]));_0x32ef27[_0x2203('0x38')]=_0x32ef27[_0x2203('0x38')][_0x2203('0x48')]?_0x32ef27[_0x2203('0x38')]:_0x417adf[_0x2203('0x34')];_0x32ef27[_0x2203('0x3a')]=qs[_0x2203('0x3b')](_0x459d57['query'][_0x2203('0x3b')]);_0x32ef27['where']=qs[_0x2203('0x36')](_[_0x2203('0x3d')](_0x459d57[_0x2203('0x35')],_0x417adf['filters']));if(_0x459d57[_0x2203('0x35')]['filter']){_0x32ef27['where']=_[_0x2203('0x3f')](_0x32ef27[_0x2203('0x3c')],{'$or':_[_0x2203('0x2f')](_0x32ef27['attributes'],function(_0x2f3a30){var _0x5b15f8={};_0x5b15f8[_0x2f3a30]={'$like':'%'+_0x459d57[_0x2203('0x35')][_0x2203('0x3e')]+'%'};return _0x5b15f8;})});}_0x32ef27=_[_0x2203('0x3f')]({},_0x32ef27,_0x459d57[_0x2203('0x41')]);return _0x4eb7e6[_0x2203('0x6f')](_0x32ef27);}})[_0x2203('0x24')](function(_0x4a95cb){if(_0x4a95cb){_0x541bf2=_0x4a95cb[_0x2203('0x48')];if(!_0x459d57[_0x2203('0x35')]['hasOwnProperty'](_0x2203('0x70'))){_0x32ef27[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x459d57[_0x2203('0x35')][_0x2203('0x1c')]);_0x32ef27[_0x2203('0x1a')]=qs[_0x2203('0x1a')](_0x459d57['query'][_0x2203('0x1a')]);}return _0x4eb7e6[_0x2203('0x6f')](_0x32ef27);}})[_0x2203('0x24')](function(_0x4b868d){if(_0x4b868d){return _0x4b868d?{'count':_0x541bf2,'rows':_0x4b868d}:null;}})[_0x2203('0x24')](respondWithResult(_0x2736f8,null))[_0x2203('0x45')](handleError(_0x2736f8,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4b433f7..e57ec51 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 _0xea49=['api','bluebird','path','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea49,0x1d6));var _0x9ea4=function(_0x316f17,_0x2c02a6){_0x316f17=_0x316f17-0x0;var _0x4d6094=_0xea49[_0x316f17];return _0x4d6094;};'use strict';var _=require(_0x9ea4('0x0'));var util=require(_0x9ea4('0x1'));var logger=require(_0x9ea4('0x2'))(_0x9ea4('0x3'));var moment=require('moment');var BPromise=require(_0x9ea4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ea4('0x5'));var rimraf=require('rimraf');var config=require(_0x9ea4('0x6'));var attributes=require(_0x9ea4('0x7'));module[_0x9ea4('0x8')]=function(_0x12a861,_0x5b901e){return _0x12a861['define'](_0x9ea4('0x9'),attributes,{'tableName':_0x9ea4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf18f=['VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x59f1a5,_0x668c50){var _0x34a3c4=function(_0x3366eb){while(--_0x3366eb){_0x59f1a5['push'](_0x59f1a5['shift']());}};_0x34a3c4(++_0x668c50);}(_0xf18f,0x83));var _0xff18=function(_0x1aac45,_0x1dccc1){_0x1aac45=_0x1aac45-0x0;var _0x46302e=_0xf18f[_0x1aac45];return _0x46302e;};'use strict';var _=require(_0xff18('0x0'));var util=require(_0xff18('0x1'));var logger=require(_0xff18('0x2'))(_0xff18('0x3'));var moment=require(_0xff18('0x4'));var BPromise=require(_0xff18('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff18('0x6'));var rimraf=require(_0xff18('0x7'));var config=require(_0xff18('0x8'));var attributes=require(_0xff18('0x9'));module[_0xff18('0xa')]=function(_0x2cbddf,_0x4c1874){return _0x2cbddf[_0xff18('0xb')](_0xff18('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index c487570..3d1ff10 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1f37b5,_0x39a69b){var _0x157963=function(_0x5c1521){while(--_0x5c1521){_0x1f37b5['push'](_0x1f37b5['shift']());}};_0x157963(++_0x39a69b);}(_0xe706,0xa3));var _0x6e70=function(_0xa5d896,_0x263a1d){_0xa5d896=_0xa5d896-0x0;var _0x1c31f8=_0xe706[_0xa5d896];return _0x1c31f8;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56ced8,_0x8204e7){var _0x26834c=function(_0x2f28ca){while(--_0x2f28ca){_0x56ced8['push'](_0x56ced8['shift']());}};_0x26834c(++_0x8204e7);}(_0xe706,0xa3));var _0x6e70=function(_0x30bb7c,_0x27a364){_0x30bb7c=_0x30bb7c-0x0;var _0x3b32be=_0xe706[_0x30bb7c];return _0x3b32be;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5ec1d03..bbe011d 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 _0xf7cd=['create','post','/:id/users','addAgents','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','get','/describe','describe','/:id','show','getAgents'];(function(_0x45a93a,_0x21e029){var _0x2dce82=function(_0xf4f810){while(--_0xf4f810){_0x45a93a['push'](_0x45a93a['shift']());}};_0x2dce82(++_0x21e029);}(_0xf7cd,0x8a));var _0xdf7c=function(_0xa1fc80,_0x51d47a){_0xa1fc80=_0xa1fc80-0x0;var _0x2014b1=_0xf7cd[_0xa1fc80];return _0x2014b1;};'use strict';var multer=require(_0xdf7c('0x0'));var util=require(_0xdf7c('0x1'));var path=require(_0xdf7c('0x2'));var timeout=require(_0xdf7c('0x3'));var express=require(_0xdf7c('0x4'));var router=express[_0xdf7c('0x5')]();var fs_extra=require(_0xdf7c('0x6'));var auth=require(_0xdf7c('0x7'));var interaction=require(_0xdf7c('0x8'));var config=require(_0xdf7c('0x9'));var controller=require(_0xdf7c('0xa'));router['get']('/',auth[_0xdf7c('0xb')](),controller['index']);router[_0xdf7c('0xc')](_0xdf7c('0xd'),auth[_0xdf7c('0xb')](),controller[_0xdf7c('0xe')]);router[_0xdf7c('0xc')](_0xdf7c('0xf'),auth[_0xdf7c('0xb')](),controller[_0xdf7c('0x10')]);router['get']('/:id/users',auth[_0xdf7c('0xb')](),controller[_0xdf7c('0x11')]);router['post']('/',auth[_0xdf7c('0xb')](),controller[_0xdf7c('0x12')]);router[_0xdf7c('0x13')](_0xdf7c('0x14'),auth['isAuthenticated'](),controller[_0xdf7c('0x15')]);router['put'](_0xdf7c('0xf'),auth[_0xdf7c('0xb')](),controller['update']);router[_0xdf7c('0x16')](_0xdf7c('0xf'),auth['isAuthenticated'](),controller[_0xdf7c('0x17')]);router[_0xdf7c('0x16')](_0xdf7c('0x14'),auth['isAuthenticated'](),controller[_0xdf7c('0x18')]);module[_0xdf7c('0x19')]=router; \ No newline at end of file +var _0xc688=['getAgents','post','create','/:id/users','addAgents','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','/:id','isAuthenticated','show'];(function(_0x1210a3,_0x123054){var _0x7aa841=function(_0xe39eb5){while(--_0xe39eb5){_0x1210a3['push'](_0x1210a3['shift']());}};_0x7aa841(++_0x123054);}(_0xc688,0xce));var _0x8c68=function(_0x2cb870,_0xeb15ea){_0x2cb870=_0x2cb870-0x0;var _0x4776b0=_0xc688[_0x2cb870];return _0x4776b0;};'use strict';var multer=require(_0x8c68('0x0'));var util=require('util');var path=require(_0x8c68('0x1'));var timeout=require(_0x8c68('0x2'));var express=require('express');var router=express[_0x8c68('0x3')]();var fs_extra=require(_0x8c68('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8c68('0x5'));var config=require(_0x8c68('0x6'));var controller=require(_0x8c68('0x7'));router[_0x8c68('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c68('0x9')]);router['get'](_0x8c68('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x8c68('0x8')](_0x8c68('0xb'),auth[_0x8c68('0xc')](),controller[_0x8c68('0xd')]);router[_0x8c68('0x8')]('/:id/users',auth[_0x8c68('0xc')](),controller[_0x8c68('0xe')]);router[_0x8c68('0xf')]('/',auth[_0x8c68('0xc')](),controller[_0x8c68('0x10')]);router[_0x8c68('0xf')](_0x8c68('0x11'),auth['isAuthenticated'](),controller[_0x8c68('0x12')]);router[_0x8c68('0x13')]('/:id',auth[_0x8c68('0xc')](),controller[_0x8c68('0x14')]);router[_0x8c68('0x15')](_0x8c68('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x8c68('0x15')](_0x8c68('0x11'),auth[_0x8c68('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index e56c09e..caa0e1b 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 _0x28aa=['STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports'];(function(_0x21e7ef,_0x37ca15){var _0x17769e=function(_0x5c7b39){while(--_0x5c7b39){_0x21e7ef['push'](_0x21e7ef['shift']());}};_0x17769e(++_0x37ca15);}(_0x28aa,0x14e));var _0xa28a=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x28aa[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0xa28a('0x0'));module[_0xa28a('0x1')]={'name':{'type':Sequelize[_0xa28a('0x2')],'allowNull':![],'unique':_0xa28a('0x3')},'prefix':{'type':Sequelize[_0xa28a('0x4')],'get':function(_0x5283c2){return _0xa28a('0x5')+this[_0xa28a('0x6')](_0xa28a('0x3'))+'-';}},'description':{'type':Sequelize[_0xa28a('0x2')]},'callerIdAll':{'type':Sequelize[_0xa28a('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xa28a('0x7')]}}; \ No newline at end of file +var _0x52b6=['STRING','name','system-','sequelize','exports'];(function(_0x2118ad,_0xe8e3fd){var _0x4b5715=function(_0x399f72){while(--_0x399f72){_0x2118ad['push'](_0x2118ad['shift']());}};_0x4b5715(++_0xe8e3fd);}(_0x52b6,0x1ca));var _0x652b=function(_0x1dc4a4,_0xb20501){_0x1dc4a4=_0x1dc4a4-0x0;var _0x5d78e0=_0x52b6[_0x1dc4a4];return _0x5d78e0;};'use strict';var Sequelize=require(_0x652b('0x0'));module[_0x652b('0x1')]={'name':{'type':Sequelize[_0x652b('0x2')],'allowNull':![],'unique':_0x652b('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1626cc){return _0x652b('0x4')+this['getDataValue'](_0x652b('0x3'))+'-';}},'description':{'type':Sequelize[_0x652b('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 98d3624..b12e0af 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 _0x0268=['order','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','show','find','catch','params','describe','create','transaction','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','sequelize','findById','addAgents','ids','omit','spread','userVoicePrefix:save','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User'];(function(_0x518f73,_0x3473ec){var _0x146513=function(_0x2ea208){while(--_0x2ea208){_0x518f73['push'](_0x518f73['shift']());}};_0x146513(++_0x3473ec);}(_0x0268,0x17e));var _0x8026=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x0268[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0x8026('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8026('0x1'));var jsonpatch=require(_0x8026('0x2'));var rp=require('request-promise');var moment=require(_0x8026('0x3'));var BPromise=require(_0x8026('0x4'));var Mustache=require(_0x8026('0x5'));var util=require(_0x8026('0x6'));var path=require(_0x8026('0x7'));var sox=require('sox');var csv=require(_0x8026('0x8'));var ejs=require(_0x8026('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8026('0xa'));var squel=require(_0x8026('0xb'));var crypto=require(_0x8026('0xc'));var jsforce=require(_0x8026('0xd'));var deskjs=require(_0x8026('0xe'));var toCsv=require(_0x8026('0x8'));var querystring=require(_0x8026('0xf'));var Papa=require(_0x8026('0x10'));var Redis=require(_0x8026('0x11'));var authService=require(_0x8026('0x12'));var qs=require(_0x8026('0x13'));var as=require(_0x8026('0x14'));var hardwareService=require(_0x8026('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8026('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8026('0x17'))['db'];config[_0x8026('0x18')]=_[_0x8026('0x19')](config[_0x8026('0x18')],{'host':_0x8026('0x1a'),'port':0x18eb});var socket=require(_0x8026('0x1b'))(new Redis(config[_0x8026('0x18')]));require(_0x8026('0x1c'))[_0x8026('0x1d')](socket);function respondWithStatusCode(_0x2b9da3,_0x2e04c5){_0x2e04c5=_0x2e04c5||0xcc;return function(_0x347808){if(_0x347808){return _0x2b9da3[_0x8026('0x1e')](_0x2e04c5);}return _0x2b9da3[_0x8026('0x1f')](_0x2e04c5)[_0x8026('0x20')]();};}function respondWithResult(_0x10057d,_0x12bec2){_0x12bec2=_0x12bec2||0xc8;return function(_0x4a1810){if(_0x4a1810){return _0x10057d['status'](_0x12bec2)[_0x8026('0x21')](_0x4a1810);}};}function respondWithFilteredResult(_0x27d2f5,_0x2ce7d0){return function(_0x49094d){if(_0x49094d){var _0x3de9bc=typeof _0x2ce7d0['offset']===_0x8026('0x22')&&typeof _0x2ce7d0[_0x8026('0x23')]==='undefined';var _0x1a7ddb=_0x49094d[_0x8026('0x24')];var _0x1a8454=_0x3de9bc?0x0:_0x2ce7d0['offset'];var _0x5cfbec=_0x3de9bc?_0x49094d[_0x8026('0x24')]:_0x2ce7d0[_0x8026('0x25')]+_0x2ce7d0['limit'];var _0x30c9dd;if(_0x5cfbec>=_0x1a7ddb){_0x5cfbec=_0x1a7ddb;_0x30c9dd=0xc8;}else{_0x30c9dd=0xce;}_0x27d2f5[_0x8026('0x1f')](_0x30c9dd);return _0x27d2f5['set'](_0x8026('0x26'),_0x1a8454+'-'+_0x5cfbec+'/'+_0x1a7ddb)[_0x8026('0x21')](_0x49094d);}return null;};}function patchUpdates(_0xe6e4c3){return function(_0x498c67){try{jsonpatch[_0x8026('0x27')](_0x498c67,_0xe6e4c3,!![]);}catch(_0x442f83){return BPromise['reject'](_0x442f83);}return _0x498c67[_0x8026('0x28')]();};}function saveUpdates(_0x3222b2,_0x3b3ae3){return function(_0x42bb17){if(_0x42bb17){return _0x42bb17[_0x8026('0x29')](_0x3222b2)[_0x8026('0x2a')](function(_0x570bb7){return _0x570bb7;});}return null;};}function removeEntity(_0xe28955,_0x471277){return function(_0x3c01c1){if(_0x3c01c1){return _0x3c01c1[_0x8026('0x2b')]()[_0x8026('0x2a')](function(){var _0x2dee5e=_0x3c01c1[_0x8026('0x2c')]({'plain':!![]});var _0x49d212='VoicePrefixes';return db[_0x8026('0x2d')][_0x8026('0x2b')]({'where':{'type':_0x49d212,'resourceId':_0x2dee5e['id']}})[_0x8026('0x2a')](function(){return _0x3c01c1;});})[_0x8026('0x2a')](function(){_0xe28955[_0x8026('0x1f')](0xcc)[_0x8026('0x20')]();});}};}function handleEntityNotFound(_0x558ff7,_0x4f1ecd){return function(_0x5928bc){if(!_0x5928bc){_0x558ff7[_0x8026('0x1e')](0x194);}return _0x5928bc;};}function handleError(_0x7b6b71,_0x11876f){_0x11876f=_0x11876f||0x1f4;return function(_0x3f3ae4){logger['error'](_0x3f3ae4[_0x8026('0x2e')]);if(_0x3f3ae4[_0x8026('0x2f')]){delete _0x3f3ae4[_0x8026('0x2f')];}_0x7b6b71[_0x8026('0x1f')](_0x11876f)[_0x8026('0x30')](_0x3f3ae4);};}exports[_0x8026('0x31')]=function(_0x3ffa62,_0x204dd2){var _0x186801={},_0x58f356={},_0x28a38b={'count':0x0,'rows':[]};var _0xae58e7=_[_0x8026('0x32')](db['VoicePrefix'][_0x8026('0x33')],function(_0x20301c){return{'name':_0x20301c[_0x8026('0x34')],'type':_0x20301c[_0x8026('0x35')][_0x8026('0x36')]};});_0x58f356[_0x8026('0x37')]=_[_0x8026('0x32')](_0xae58e7,_0x8026('0x2f'));_0x58f356['query']=_[_0x8026('0x38')](_0x3ffa62[_0x8026('0x39')]);_0x58f356[_0x8026('0x3a')]=_[_0x8026('0x3b')](_0x58f356[_0x8026('0x37')],_0x58f356['query']);_0x186801['attributes']=_[_0x8026('0x3b')](_0x58f356[_0x8026('0x37')],qs[_0x8026('0x3c')](_0x3ffa62[_0x8026('0x39')][_0x8026('0x3c')]));_0x186801[_0x8026('0x3d')]=_0x186801[_0x8026('0x3d')][_0x8026('0x3e')]?_0x186801[_0x8026('0x3d')]:_0x58f356[_0x8026('0x37')];if(!_0x3ffa62['query'][_0x8026('0x3f')](_0x8026('0x40'))){_0x186801[_0x8026('0x23')]=qs[_0x8026('0x23')](_0x3ffa62[_0x8026('0x39')][_0x8026('0x23')]);_0x186801['offset']=qs[_0x8026('0x25')](_0x3ffa62[_0x8026('0x39')][_0x8026('0x25')]);}_0x186801['order']=qs[_0x8026('0x41')](_0x3ffa62['query'][_0x8026('0x41')]);_0x186801[_0x8026('0x42')]=qs[_0x8026('0x3a')](_[_0x8026('0x43')](_0x3ffa62[_0x8026('0x39')],_0x58f356[_0x8026('0x3a')]),_0xae58e7);if(_0x3ffa62[_0x8026('0x39')]['filter']){_0x186801[_0x8026('0x42')]=_[_0x8026('0x44')](_0x186801[_0x8026('0x42')],{'$or':_[_0x8026('0x32')](_0xae58e7,function(_0x82d16b){if(_0x82d16b[_0x8026('0x35')]!==_0x8026('0x45')){var _0x96dfa0={};_0x96dfa0[_0x82d16b[_0x8026('0x2f')]]={'$like':'%'+_0x3ffa62[_0x8026('0x39')][_0x8026('0x46')]+'%'};return _0x96dfa0;}})});}_0x186801=_[_0x8026('0x44')]({},_0x186801,_0x3ffa62[_0x8026('0x47')]);var _0x25708f={'where':_0x186801['where']};return db[_0x8026('0x48')][_0x8026('0x24')](_0x25708f)[_0x8026('0x2a')](function(_0x27616a){_0x28a38b[_0x8026('0x24')]=_0x27616a;if(_0x3ffa62[_0x8026('0x39')][_0x8026('0x49')]){_0x186801[_0x8026('0x4a')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8026('0x4b')](_0x186801);})[_0x8026('0x2a')](function(_0x445413){_0x28a38b[_0x8026('0x4c')]=_0x445413;return _0x28a38b;})[_0x8026('0x2a')](respondWithFilteredResult(_0x204dd2,_0x186801))['catch'](handleError(_0x204dd2,null));};exports[_0x8026('0x4d')]=function(_0x4948a0,_0x3f87f4){var _0x1ee696={'raw':![],'where':{'id':_0x4948a0['params']['id']}},_0xbb3ee4={};_0xbb3ee4[_0x8026('0x37')]=_[_0x8026('0x38')](db[_0x8026('0x48')][_0x8026('0x33')]);_0xbb3ee4[_0x8026('0x39')]=_[_0x8026('0x38')](_0x4948a0['query']);_0xbb3ee4[_0x8026('0x3a')]=_[_0x8026('0x3b')](_0xbb3ee4[_0x8026('0x37')],_0xbb3ee4['query']);_0x1ee696[_0x8026('0x3d')]=_[_0x8026('0x3b')](_0xbb3ee4[_0x8026('0x37')],qs[_0x8026('0x3c')](_0x4948a0[_0x8026('0x39')][_0x8026('0x3c')]));_0x1ee696[_0x8026('0x3d')]=_0x1ee696['attributes'][_0x8026('0x3e')]?_0x1ee696[_0x8026('0x3d')]:_0xbb3ee4[_0x8026('0x37')];if(_0x4948a0[_0x8026('0x39')][_0x8026('0x49')]){_0x1ee696['include']=[{'all':!![]}];}_0x1ee696=_['merge']({},_0x1ee696,_0x4948a0['options']);return db['VoicePrefix'][_0x8026('0x4e')](_0x1ee696)[_0x8026('0x2a')](handleEntityNotFound(_0x3f87f4,null))[_0x8026('0x2a')](respondWithResult(_0x3f87f4,null))[_0x8026('0x4f')](handleError(_0x3f87f4,null));};exports[_0x8026('0x2b')]=function(_0x48ac85,_0x27ff43){return db[_0x8026('0x48')][_0x8026('0x4e')]({'where':{'id':_0x48ac85[_0x8026('0x50')]['id']}})[_0x8026('0x2a')](handleEntityNotFound(_0x27ff43,null))[_0x8026('0x2a')](removeEntity(_0x27ff43,null))[_0x8026('0x4f')](handleError(_0x27ff43,null));};exports['describe']=function(_0x4164e2,_0x3f89c2){return db[_0x8026('0x48')][_0x8026('0x51')]()[_0x8026('0x2a')](respondWithResult(_0x3f89c2,null))['catch'](handleError(_0x3f89c2,null));};exports[_0x8026('0x52')]=function(_0x3bdae7,_0x20c5c4){var _0x3e6637;return db['sequelize'][_0x8026('0x53')](function(_0x1007cd){return db[_0x8026('0x48')][_0x8026('0x52')](_0x3bdae7[_0x8026('0x54')],{'transaction':_0x1007cd})['then'](function(_0x42ac03){_0x3e6637=_0x42ac03[_0x8026('0x2c')]({'plain':!![]});return db[_0x8026('0x55')][_0x8026('0x4e')]({'where':{'id':_0x3e6637['VoiceExtensionId']},'raw':!![]})[_0x8026('0x2a')](function(_0x1fef79){return createVoicePrefixExtensions(_0x3e6637,_0x1fef79,_0x1007cd);});});})[_0x8026('0x2a')](function(){var _0x198260=_0x3bdae7['user'][_0x8026('0x2c')]({'plain':!![]});if(!_0x198260)throw new Error(_0x8026('0x56'));if(_0x198260['role']==='user'){var _0x57d5ee=_0x3e6637;return db[_0x8026('0x57')][_0x8026('0x4e')]({'where':{'name':_0x8026('0x58'),'userProfileId':_0x198260[_0x8026('0x59')]},'raw':!![]})[_0x8026('0x2a')](function(_0x1e42c1){if(_0x1e42c1&&_0x1e42c1[_0x8026('0x5a')]===0x0){return db[_0x8026('0x2d')][_0x8026('0x52')]({'name':_0x57d5ee['name'],'resourceId':_0x57d5ee['id'],'type':_0x1e42c1[_0x8026('0x2f')],'sectionId':_0x1e42c1['id']},{})['then'](function(){return _0x3e6637;});}else{return _0x3e6637;}})[_0x8026('0x4f')](function(_0x1597b3){logger['error'](_0x8026('0x5b'),_0x1597b3);throw _0x1597b3;});}return _0x3e6637;})[_0x8026('0x2a')](respondWithResult(_0x20c5c4,null))[_0x8026('0x4f')](handleError(_0x20c5c4,null));};function Extension(_0x3fbc9e,_0x4f24d9,_0x25a1d3,_0x2a37bf){this[_0x8026('0x5c')]='from-sip';this[_0x8026('0x5d')]=_0x3fbc9e;this[_0x8026('0x5e')]=_0x25a1d3;this[_0x8026('0x35')]=_0x8026('0x5f');this['description']=_0x8026('0x60');this[_0x8026('0x61')]=_0x4f24d9;this[_0x8026('0x62')]=_0x2a37bf;}function createVoicePrefixExtensions(_0x291f6e,_0x488097,_0x5dfb84){return new BPromise(function(_0x26a595,_0x421dbe){var _0x1f3e78=new Extension(formatPrefixName(_0x291f6e[_0x8026('0x63')]),0x1,'NoOp',_0x8026('0x64'));_0x1f3e78['VoicePrefixId']=_0x291f6e['id'];return db['VoiceExtension'][_0x8026('0x52')](_0x1f3e78,{'transaction':_0x5dfb84})[_0x8026('0x2a')](function(_0x36198e){var _0x4b33bf=_0x36198e[_0x8026('0x2c')]({'plain':!![]});var _0x1864cb=_['map'](addVoicePrefixExtensions(_0x291f6e,_0x488097),function(_0x3edcc9){_0x3edcc9[_0x8026('0x65')]=_0x4b33bf['id'];_0x3edcc9[_0x8026('0x66')]=_0x291f6e['id'];return _0x3edcc9;});return db['VoiceExtension'][_0x8026('0x67')](_0x1864cb,{'transaction':_0x5dfb84})[_0x8026('0x2a')](function(_0x2a5d19){if(!_0x2a5d19){return _0x421dbe('Extensions\x20creation\x20failed');}else{return _0x26a595(_0x2a5d19);}})['catch'](function(_0x37ab68){return _0x421dbe(_0x37ab68);});});;});};function addVoicePrefixExtensions(_0x39b9d3,_0x439321){var _0x20ae3a=[];var _0x24882a=formatPrefixName(_0x39b9d3[_0x8026('0x63')]);_0x20ae3a[_0x8026('0x68')](new Extension(_0x24882a,0x2,_0x8026('0x69'),_0x8026('0x6a')+_0x39b9d3[_0x8026('0x2f')]));if(_0x39b9d3[_0x8026('0x6b')]){_0x20ae3a[_0x8026('0x68')](new Extension(_0x24882a,0x3,_0x8026('0x69'),'PREFIX-CALLERIDALL='+_0x39b9d3['callerIdAll']));}else{_0x20ae3a[_0x8026('0x68')](new Extension(_0x24882a,0x3,_0x8026('0x6c'),_0x8026('0x6d')));}_0x20ae3a['push'](new Extension(_0x24882a,0x4,_0x8026('0x6e'),_0x439321[_0x8026('0x5c')]+','+_0x8026('0x6f')+(0x8+_0x39b9d3[_0x8026('0x2f')]['length'])+'}'+','+0x1));return _0x20ae3a;}function formatPrefixName(_0x20ccd3){var _0x15cf77='_';for(var _0xd3e0e=0x0;_0xd3e0e<_0x20ccd3['length'];_0xd3e0e++){if(_0x20ccd3[_0x8026('0x70')](_0xd3e0e)=='-'){_0x15cf77+=_0x20ccd3[_0x8026('0x70')](_0xd3e0e);}else{_0x15cf77+='['+_0x20ccd3['charAt'](_0xd3e0e)+']';}}_0x15cf77+='.';return _0x15cf77;}exports['update']=function(_0x1de9e8,_0x2085a9,_0x14e85b){var _0x1b9cae=_0x1de9e8[_0x8026('0x54')];_0x1b9cae[_0x8026('0x63')]='system-'+_0x1b9cae[_0x8026('0x2f')]+'-';return db[_0x8026('0x71')][_0x8026('0x53')](function(_0x299957){return db[_0x8026('0x48')][_0x8026('0x29')](_0x1b9cae,{'where':{'id':_0x1b9cae['id']},'transaction':_0x299957})[_0x8026('0x2a')](function(){return db['VoiceExtension'][_0x8026('0x2b')]({'where':{'VoicePrefixId':_0x1b9cae['id']},'transaction':_0x299957})[_0x8026('0x2a')](function(){return db[_0x8026('0x55')]['find']({'where':{'id':_0x1b9cae[_0x8026('0x65')]},'raw':!![]})['then'](function(_0x134e93){return createVoicePrefixExtensions(_0x1b9cae,_0x134e93,_0x299957);});});});})[_0x8026('0x2a')](function(){return db[_0x8026('0x48')][_0x8026('0x72')](_0x1b9cae['id']);})[_0x8026('0x2a')](respondWithResult(_0x2085a9,null))[_0x8026('0x4f')](handleError(_0x2085a9,null));};exports['addAgents']=function(_0x2a0df4,_0x3d05c4,_0x3bb6b3){return db[_0x8026('0x48')][_0x8026('0x4e')]({'where':{'id':_0x2a0df4['params']['id']}})['then'](handleEntityNotFound(_0x3d05c4,null))[_0x8026('0x2a')](function(_0x146acf){if(_0x146acf){return _0x146acf[_0x8026('0x73')](_0x2a0df4['body'][_0x8026('0x74')],_[_0x8026('0x75')](_0x2a0df4[_0x8026('0x54')],[_0x8026('0x74'),'id'])||{})[_0x8026('0x76')](function(_0x29cd6c){for(var _0xfc091f=0x0;_0xfc091f<_0x2a0df4[_0x8026('0x54')][_0x8026('0x74')][_0x8026('0x3e')];_0xfc091f+=0x1){socket['emit'](_0x8026('0x77'),{'UserId':Number(_0x2a0df4[_0x8026('0x54')]['ids'][_0xfc091f]),'VoicePrefixId':Number(_0x2a0df4[_0x8026('0x50')]['id'])});}return _0x29cd6c;});}})[_0x8026('0x2a')](respondWithResult(_0x3d05c4,null))[_0x8026('0x4f')](handleError(_0x3d05c4,null));};exports['removeAgents']=function(_0x278486,_0x144c1d,_0x4479c4){return db[_0x8026('0x48')][_0x8026('0x4e')]({'where':{'id':_0x278486['params']['id']}})[_0x8026('0x2a')](handleEntityNotFound(_0x144c1d,null))['then'](function(_0x5c337d){if(_0x5c337d){return _0x5c337d['removeAgents'](_0x278486['query'][_0x8026('0x74')])[_0x8026('0x2a')](function(){if(_[_0x8026('0x78')](_0x278486['query'][_0x8026('0x74')])){for(var _0x526d21=0x0;_0x526d21<_0x278486['query'][_0x8026('0x74')][_0x8026('0x3e')];_0x526d21+=0x1){socket[_0x8026('0x79')](_0x8026('0x7a'),{'UserId':Number(_0x278486[_0x8026('0x39')]['ids'][_0x526d21]),'VoicePrefixId':Number(_0x278486[_0x8026('0x50')]['id'])});}}else{socket['emit'](_0x8026('0x7a'),{'UserId':Number(_0x278486[_0x8026('0x39')][_0x8026('0x74')]),'VoicePrefixId':Number(_0x278486['params']['id'])});}});}})['then'](respondWithStatusCode(_0x144c1d,null))[_0x8026('0x4f')](handleError(_0x144c1d,null));};exports[_0x8026('0x7b')]=function(_0x72dc32,_0x394e90,_0x2cc7ad){var _0xc68dde={};var _0x5862e1={};var _0x1fd1b2;var _0x23e9c2;return db[_0x8026('0x48')][_0x8026('0x7c')]({'where':{'id':_0x72dc32[_0x8026('0x50')]['id']}})[_0x8026('0x2a')](handleEntityNotFound(_0x394e90,null))['then'](function(_0x18e02f){if(_0x18e02f){_0x1fd1b2=_0x18e02f;_0x5862e1[_0x8026('0x37')]=_['keys'](db[_0x8026('0x7d')][_0x8026('0x33')]);_0x5862e1[_0x8026('0x39')]=_['keys'](_0x72dc32['query']);_0x5862e1['filters']=_[_0x8026('0x3b')](_0x5862e1['model'],_0x5862e1[_0x8026('0x39')]);_0xc68dde[_0x8026('0x3d')]=_[_0x8026('0x3b')](_0x5862e1[_0x8026('0x37')],qs['fields'](_0x72dc32[_0x8026('0x39')][_0x8026('0x3c')]));_0xc68dde['attributes']=_0xc68dde['attributes'][_0x8026('0x3e')]?_0xc68dde['attributes']:_0x5862e1[_0x8026('0x37')];_0xc68dde[_0x8026('0x7e')]=qs[_0x8026('0x41')](_0x72dc32[_0x8026('0x39')][_0x8026('0x41')]);_0xc68dde[_0x8026('0x42')]=qs[_0x8026('0x3a')](_[_0x8026('0x43')](_0x72dc32[_0x8026('0x39')],_0x5862e1[_0x8026('0x3a')]));if(_0x72dc32[_0x8026('0x39')][_0x8026('0x46')]){_0xc68dde[_0x8026('0x42')]=_['merge'](_0xc68dde[_0x8026('0x42')],{'$or':_[_0x8026('0x32')](_0xc68dde[_0x8026('0x3d')],function(_0x481a86){var _0x188936={};_0x188936[_0x481a86]={'$like':'%'+_0x72dc32['query'][_0x8026('0x46')]+'%'};return _0x188936;})});}_0xc68dde=_[_0x8026('0x44')]({},_0xc68dde,_0x72dc32[_0x8026('0x47')]);return _0x1fd1b2['getAgents'](_0xc68dde);}})[_0x8026('0x2a')](function(_0x4f8497){if(_0x4f8497){_0x23e9c2=_0x4f8497[_0x8026('0x3e')];if(!_0x72dc32['query'][_0x8026('0x3f')](_0x8026('0x40'))){_0xc68dde[_0x8026('0x23')]=qs[_0x8026('0x23')](_0x72dc32['query'][_0x8026('0x23')]);_0xc68dde[_0x8026('0x25')]=qs['offset'](_0x72dc32[_0x8026('0x39')][_0x8026('0x25')]);}return _0x1fd1b2[_0x8026('0x7b')](_0xc68dde);}})['then'](function(_0x51d6c9){if(_0x51d6c9){return _0x51d6c9?{'count':_0x23e9c2,'rows':_0x51d6c9}:null;}})[_0x8026('0x2a')](respondWithResult(_0x394e90,null))[_0x8026('0x4f')](handleError(_0x394e90,null));}; \ No newline at end of file +var _0x35c0=['addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','VoicePrefixes','then','name','send','index','map','VoicePrefix','fieldName','type','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filters','find','describe','create','transaction','VoiceExtensionId','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','push','Set','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','sequelize','findById'];(function(_0x56ae01,_0x3db340){var _0x1e46f0=function(_0x803e6e){while(--_0x803e6e){_0x56ae01['push'](_0x56ae01['shift']());}};_0x1e46f0(++_0x3db340);}(_0x35c0,0x10d));var _0x035c=function(_0x336fa0,_0x4e8281){_0x336fa0=_0x336fa0-0x0;var _0x4d1399=_0x35c0[_0x336fa0];return _0x4d1399;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x035c('0x0'));var zipdir=require(_0x035c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x035c('0x2'));var moment=require(_0x035c('0x3'));var BPromise=require(_0x035c('0x4'));var Mustache=require(_0x035c('0x5'));var util=require(_0x035c('0x6'));var path=require(_0x035c('0x7'));var sox=require(_0x035c('0x8'));var csv=require(_0x035c('0x9'));var ejs=require(_0x035c('0xa'));var fs=require('fs');var fs_extra=require(_0x035c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x035c('0xc'));var jsforce=require(_0x035c('0xd'));var deskjs=require(_0x035c('0xe'));var toCsv=require(_0x035c('0x9'));var querystring=require('querystring');var Papa=require(_0x035c('0xf'));var Redis=require(_0x035c('0x10'));var authService=require(_0x035c('0x11'));var qs=require(_0x035c('0x12'));var as=require(_0x035c('0x13'));var hardwareService=require(_0x035c('0x14'));var logger=require(_0x035c('0x15'))(_0x035c('0x16'));var utils=require(_0x035c('0x17'));var config=require(_0x035c('0x18'));var licenseUtil=require(_0x035c('0x19'));var db=require(_0x035c('0x1a'))['db'];config[_0x035c('0x1b')]=_[_0x035c('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0x035c('0x1d')](socket);function respondWithStatusCode(_0x12c503,_0x447234){_0x447234=_0x447234||0xcc;return function(_0x1c7e7b){if(_0x1c7e7b){return _0x12c503[_0x035c('0x1e')](_0x447234);}return _0x12c503[_0x035c('0x1f')](_0x447234)[_0x035c('0x20')]();};}function respondWithResult(_0x341fdf,_0x196fc6){_0x196fc6=_0x196fc6||0xc8;return function(_0xf80641){if(_0xf80641){return _0x341fdf[_0x035c('0x1f')](_0x196fc6)['json'](_0xf80641);}};}function respondWithFilteredResult(_0x5d4b32,_0x308937){return function(_0x58c80e){if(_0x58c80e){var _0x264dc1=typeof _0x308937[_0x035c('0x21')]===_0x035c('0x22')&&typeof _0x308937[_0x035c('0x23')]===_0x035c('0x22');var _0x55f5e6=_0x58c80e[_0x035c('0x24')];var _0xcad945=_0x264dc1?0x0:_0x308937[_0x035c('0x21')];var _0x239085=_0x264dc1?_0x58c80e[_0x035c('0x24')]:_0x308937[_0x035c('0x21')]+_0x308937['limit'];var _0x4c86f0;if(_0x239085>=_0x55f5e6){_0x239085=_0x55f5e6;_0x4c86f0=0xc8;}else{_0x4c86f0=0xce;}_0x5d4b32[_0x035c('0x1f')](_0x4c86f0);return _0x5d4b32[_0x035c('0x25')](_0x035c('0x26'),_0xcad945+'-'+_0x239085+'/'+_0x55f5e6)[_0x035c('0x27')](_0x58c80e);}return null;};}function patchUpdates(_0x2627ff){return function(_0x38ba37){try{jsonpatch[_0x035c('0x28')](_0x38ba37,_0x2627ff,!![]);}catch(_0x174331){return BPromise[_0x035c('0x29')](_0x174331);}return _0x38ba37['save']();};}function saveUpdates(_0x5d4002,_0x54b581){return function(_0x5c68fa){if(_0x5c68fa){return _0x5c68fa[_0x035c('0x2a')](_0x5d4002)['then'](function(_0xa54a7f){return _0xa54a7f;});}return null;};}function removeEntity(_0x190c08,_0x1e0bd9){return function(_0x23468e){if(_0x23468e){return _0x23468e[_0x035c('0x2b')]()['then'](function(){var _0xb62756=_0x23468e['get']({'plain':!![]});var _0x228f62=_0x035c('0x2c');return db['UserProfileResource'][_0x035c('0x2b')]({'where':{'type':_0x228f62,'resourceId':_0xb62756['id']}})[_0x035c('0x2d')](function(){return _0x23468e;});})['then'](function(){_0x190c08[_0x035c('0x1f')](0xcc)[_0x035c('0x20')]();});}};}function handleEntityNotFound(_0xbb6ebc,_0x1e9dce){return function(_0x234fbe){if(!_0x234fbe){_0xbb6ebc[_0x035c('0x1e')](0x194);}return _0x234fbe;};}function handleError(_0x252008,_0x238249){_0x238249=_0x238249||0x1f4;return function(_0x2ea5da){logger['error'](_0x2ea5da['stack']);if(_0x2ea5da[_0x035c('0x2e')]){delete _0x2ea5da[_0x035c('0x2e')];}_0x252008[_0x035c('0x1f')](_0x238249)[_0x035c('0x2f')](_0x2ea5da);};}exports[_0x035c('0x30')]=function(_0x43edb2,_0x2b219c){var _0x417ea3={},_0x7a7082={},_0x433e12={'count':0x0,'rows':[]};var _0x1f4f4b=_[_0x035c('0x31')](db[_0x035c('0x32')]['rawAttributes'],function(_0x4f52b5){return{'name':_0x4f52b5[_0x035c('0x33')],'type':_0x4f52b5[_0x035c('0x34')][_0x035c('0x35')]};});_0x7a7082['model']=_['map'](_0x1f4f4b,_0x035c('0x2e'));_0x7a7082['query']=_[_0x035c('0x36')](_0x43edb2[_0x035c('0x37')]);_0x7a7082['filters']=_['intersection'](_0x7a7082[_0x035c('0x38')],_0x7a7082[_0x035c('0x37')]);_0x417ea3[_0x035c('0x39')]=_[_0x035c('0x3a')](_0x7a7082[_0x035c('0x38')],qs[_0x035c('0x3b')](_0x43edb2[_0x035c('0x37')]['fields']));_0x417ea3[_0x035c('0x39')]=_0x417ea3[_0x035c('0x39')][_0x035c('0x3c')]?_0x417ea3['attributes']:_0x7a7082[_0x035c('0x38')];if(!_0x43edb2['query'][_0x035c('0x3d')](_0x035c('0x3e'))){_0x417ea3[_0x035c('0x23')]=qs['limit'](_0x43edb2[_0x035c('0x37')][_0x035c('0x23')]);_0x417ea3[_0x035c('0x21')]=qs[_0x035c('0x21')](_0x43edb2[_0x035c('0x37')]['offset']);}_0x417ea3['order']=qs[_0x035c('0x3f')](_0x43edb2[_0x035c('0x37')][_0x035c('0x3f')]);_0x417ea3[_0x035c('0x40')]=qs['filters'](_[_0x035c('0x41')](_0x43edb2['query'],_0x7a7082['filters']),_0x1f4f4b);if(_0x43edb2[_0x035c('0x37')][_0x035c('0x42')]){_0x417ea3[_0x035c('0x40')]=_[_0x035c('0x43')](_0x417ea3[_0x035c('0x40')],{'$or':_[_0x035c('0x31')](_0x1f4f4b,function(_0xe4b21e){if(_0xe4b21e[_0x035c('0x34')]!==_0x035c('0x44')){var _0x2dfab7={};_0x2dfab7[_0xe4b21e['name']]={'$like':'%'+_0x43edb2[_0x035c('0x37')][_0x035c('0x42')]+'%'};return _0x2dfab7;}})});}_0x417ea3=_['merge']({},_0x417ea3,_0x43edb2[_0x035c('0x45')]);var _0x1867c5={'where':_0x417ea3[_0x035c('0x40')]};return db[_0x035c('0x32')][_0x035c('0x24')](_0x1867c5)[_0x035c('0x2d')](function(_0x6d6e37){_0x433e12['count']=_0x6d6e37;if(_0x43edb2[_0x035c('0x37')][_0x035c('0x46')]){_0x417ea3[_0x035c('0x47')]=[{'all':!![]}];}return db[_0x035c('0x32')][_0x035c('0x48')](_0x417ea3);})[_0x035c('0x2d')](function(_0x262054){_0x433e12[_0x035c('0x49')]=_0x262054;return _0x433e12;})[_0x035c('0x2d')](respondWithFilteredResult(_0x2b219c,_0x417ea3))[_0x035c('0x4a')](handleError(_0x2b219c,null));};exports[_0x035c('0x4b')]=function(_0x20c9fd,_0x1aa9c0){var _0x2897c3={'raw':![],'where':{'id':_0x20c9fd[_0x035c('0x4c')]['id']}},_0x218a7d={};_0x218a7d[_0x035c('0x38')]=_['keys'](db['VoicePrefix'][_0x035c('0x4d')]);_0x218a7d[_0x035c('0x37')]=_[_0x035c('0x36')](_0x20c9fd[_0x035c('0x37')]);_0x218a7d[_0x035c('0x4e')]=_[_0x035c('0x3a')](_0x218a7d[_0x035c('0x38')],_0x218a7d[_0x035c('0x37')]);_0x2897c3['attributes']=_[_0x035c('0x3a')](_0x218a7d[_0x035c('0x38')],qs[_0x035c('0x3b')](_0x20c9fd[_0x035c('0x37')][_0x035c('0x3b')]));_0x2897c3[_0x035c('0x39')]=_0x2897c3[_0x035c('0x39')][_0x035c('0x3c')]?_0x2897c3[_0x035c('0x39')]:_0x218a7d[_0x035c('0x38')];if(_0x20c9fd['query'][_0x035c('0x46')]){_0x2897c3['include']=[{'all':!![]}];}_0x2897c3=_['merge']({},_0x2897c3,_0x20c9fd[_0x035c('0x45')]);return db[_0x035c('0x32')][_0x035c('0x4f')](_0x2897c3)[_0x035c('0x2d')](handleEntityNotFound(_0x1aa9c0,null))[_0x035c('0x2d')](respondWithResult(_0x1aa9c0,null))['catch'](handleError(_0x1aa9c0,null));};exports[_0x035c('0x2b')]=function(_0x2c6cd7,_0x27ba83){return db[_0x035c('0x32')][_0x035c('0x4f')]({'where':{'id':_0x2c6cd7[_0x035c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x27ba83,null))[_0x035c('0x2d')](removeEntity(_0x27ba83,null))['catch'](handleError(_0x27ba83,null));};exports[_0x035c('0x50')]=function(_0x24f7b5,_0x462c82){return db[_0x035c('0x32')][_0x035c('0x50')]()[_0x035c('0x2d')](respondWithResult(_0x462c82,null))[_0x035c('0x4a')](handleError(_0x462c82,null));};exports[_0x035c('0x51')]=function(_0x3601bb,_0x1e88c1){var _0x3635ee;return db['sequelize'][_0x035c('0x52')](function(_0x370cd7){return db[_0x035c('0x32')][_0x035c('0x51')](_0x3601bb['body'],{'transaction':_0x370cd7})[_0x035c('0x2d')](function(_0x18fd3f){_0x3635ee=_0x18fd3f['get']({'plain':!![]});return db['VoiceExtension'][_0x035c('0x4f')]({'where':{'id':_0x3635ee[_0x035c('0x53')]},'raw':!![]})[_0x035c('0x2d')](function(_0x102d26){return createVoicePrefixExtensions(_0x3635ee,_0x102d26,_0x370cd7);});});})[_0x035c('0x2d')](function(){var _0x32daec=_0x3601bb['user'][_0x035c('0x54')]({'plain':!![]});if(!_0x32daec)throw new Error(_0x035c('0x55'));if(_0x32daec[_0x035c('0x56')]===_0x035c('0x57')){var _0x4fc7fc=_0x3635ee;return db[_0x035c('0x58')][_0x035c('0x4f')]({'where':{'name':_0x035c('0x2c'),'userProfileId':_0x32daec[_0x035c('0x59')]},'raw':!![]})[_0x035c('0x2d')](function(_0x5b97be){if(_0x5b97be&&_0x5b97be[_0x035c('0x5a')]===0x0){return db[_0x035c('0x5b')]['create']({'name':_0x4fc7fc[_0x035c('0x2e')],'resourceId':_0x4fc7fc['id'],'type':_0x5b97be['name'],'sectionId':_0x5b97be['id']},{})[_0x035c('0x2d')](function(){return _0x3635ee;});}else{return _0x3635ee;}})['catch'](function(_0x279660){logger[_0x035c('0x5c')](_0x035c('0x5d'),_0x279660);throw _0x279660;});}return _0x3635ee;})[_0x035c('0x2d')](respondWithResult(_0x1e88c1,null))[_0x035c('0x4a')](handleError(_0x1e88c1,null));};function Extension(_0x3485d1,_0x272681,_0x1eb58b,_0x130f1d){this[_0x035c('0x5e')]='from-sip';this[_0x035c('0x5f')]=_0x3485d1;this[_0x035c('0x60')]=_0x1eb58b;this['type']=_0x035c('0x61');this[_0x035c('0x62')]=_0x035c('0x63');this['priority']=_0x272681;this[_0x035c('0x64')]=_0x130f1d;}function createVoicePrefixExtensions(_0x1b953e,_0x258912,_0x3319da){return new BPromise(function(_0x5088c3,_0x5099c2){var _0x5d139c=new Extension(formatPrefixName(_0x1b953e[_0x035c('0x65')]),0x1,_0x035c('0x66'),_0x035c('0x67'));_0x5d139c[_0x035c('0x68')]=_0x1b953e['id'];return db['VoiceExtension'][_0x035c('0x51')](_0x5d139c,{'transaction':_0x3319da})[_0x035c('0x2d')](function(_0x44e6d2){var _0x5a8d5a=_0x44e6d2['get']({'plain':!![]});var _0x41d8e4=_[_0x035c('0x31')](addVoicePrefixExtensions(_0x1b953e,_0x258912),function(_0x14c160){_0x14c160[_0x035c('0x53')]=_0x5a8d5a['id'];_0x14c160['VoicePrefixId']=_0x1b953e['id'];return _0x14c160;});return db[_0x035c('0x69')]['bulkCreate'](_0x41d8e4,{'transaction':_0x3319da})['then'](function(_0x3cfd77){if(!_0x3cfd77){return _0x5099c2(_0x035c('0x6a'));}else{return _0x5088c3(_0x3cfd77);}})[_0x035c('0x4a')](function(_0x37606a){return _0x5099c2(_0x37606a);});});;});};function addVoicePrefixExtensions(_0x3cd488,_0x2b907e){var _0x31d199=[];var _0x55613e=formatPrefixName(_0x3cd488[_0x035c('0x65')]);_0x31d199[_0x035c('0x6b')](new Extension(_0x55613e,0x2,_0x035c('0x6c'),'CDR(prefix)='+_0x3cd488['name']));if(_0x3cd488[_0x035c('0x6d')]){_0x31d199[_0x035c('0x6b')](new Extension(_0x55613e,0x3,_0x035c('0x6c'),'PREFIX-CALLERIDALL='+_0x3cd488['callerIdAll']));}else{_0x31d199[_0x035c('0x6b')](new Extension(_0x55613e,0x3,_0x035c('0x66'),_0x035c('0x6e')));}_0x31d199[_0x035c('0x6b')](new Extension(_0x55613e,0x4,_0x035c('0x6f'),_0x2b907e[_0x035c('0x5e')]+','+_0x035c('0x70')+(0x8+_0x3cd488[_0x035c('0x2e')]['length'])+'}'+','+0x1));return _0x31d199;}function formatPrefixName(_0x1b6ee0){var _0x296216='_';for(var _0x114b3c=0x0;_0x114b3c<_0x1b6ee0[_0x035c('0x3c')];_0x114b3c++){if(_0x1b6ee0[_0x035c('0x71')](_0x114b3c)=='-'){_0x296216+=_0x1b6ee0[_0x035c('0x71')](_0x114b3c);}else{_0x296216+='['+_0x1b6ee0[_0x035c('0x71')](_0x114b3c)+']';}}_0x296216+='.';return _0x296216;}exports[_0x035c('0x2a')]=function(_0x35a533,_0x19716a,_0x21cee3){var _0x213fd4=_0x35a533[_0x035c('0x72')];_0x213fd4[_0x035c('0x65')]=_0x035c('0x73')+_0x213fd4[_0x035c('0x2e')]+'-';return db[_0x035c('0x74')][_0x035c('0x52')](function(_0x4bfe89){return db[_0x035c('0x32')][_0x035c('0x2a')](_0x213fd4,{'where':{'id':_0x213fd4['id']},'transaction':_0x4bfe89})[_0x035c('0x2d')](function(){return db[_0x035c('0x69')][_0x035c('0x2b')]({'where':{'VoicePrefixId':_0x213fd4['id']},'transaction':_0x4bfe89})[_0x035c('0x2d')](function(){return db['VoiceExtension'][_0x035c('0x4f')]({'where':{'id':_0x213fd4[_0x035c('0x53')]},'raw':!![]})[_0x035c('0x2d')](function(_0x1c7c1a){return createVoicePrefixExtensions(_0x213fd4,_0x1c7c1a,_0x4bfe89);});});});})[_0x035c('0x2d')](function(){return db['VoicePrefix'][_0x035c('0x75')](_0x213fd4['id']);})[_0x035c('0x2d')](respondWithResult(_0x19716a,null))[_0x035c('0x4a')](handleError(_0x19716a,null));};exports[_0x035c('0x76')]=function(_0x5a1ca4,_0x515097,_0x21577f){return db[_0x035c('0x32')]['find']({'where':{'id':_0x5a1ca4[_0x035c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x515097,null))[_0x035c('0x2d')](function(_0x15f537){if(_0x15f537){return _0x15f537[_0x035c('0x76')](_0x5a1ca4[_0x035c('0x72')][_0x035c('0x77')],_[_0x035c('0x78')](_0x5a1ca4[_0x035c('0x72')],[_0x035c('0x77'),'id'])||{})[_0x035c('0x79')](function(_0x531632){for(var _0x36d718=0x0;_0x36d718<_0x5a1ca4[_0x035c('0x72')][_0x035c('0x77')][_0x035c('0x3c')];_0x36d718+=0x1){socket[_0x035c('0x7a')](_0x035c('0x7b'),{'UserId':Number(_0x5a1ca4[_0x035c('0x72')][_0x035c('0x77')][_0x36d718]),'VoicePrefixId':Number(_0x5a1ca4['params']['id'])});}return _0x531632;});}})['then'](respondWithResult(_0x515097,null))['catch'](handleError(_0x515097,null));};exports[_0x035c('0x7c')]=function(_0x2bb402,_0x3b071b,_0x3dd668){return db['VoicePrefix'][_0x035c('0x4f')]({'where':{'id':_0x2bb402[_0x035c('0x4c')]['id']}})[_0x035c('0x2d')](handleEntityNotFound(_0x3b071b,null))[_0x035c('0x2d')](function(_0x246de9){if(_0x246de9){return _0x246de9[_0x035c('0x7c')](_0x2bb402[_0x035c('0x37')]['ids'])[_0x035c('0x2d')](function(){if(_[_0x035c('0x7d')](_0x2bb402[_0x035c('0x37')][_0x035c('0x77')])){for(var _0xbe228c=0x0;_0xbe228c<_0x2bb402[_0x035c('0x37')][_0x035c('0x77')]['length'];_0xbe228c+=0x1){socket[_0x035c('0x7a')](_0x035c('0x7e'),{'UserId':Number(_0x2bb402[_0x035c('0x37')][_0x035c('0x77')][_0xbe228c]),'VoicePrefixId':Number(_0x2bb402['params']['id'])});}}else{socket[_0x035c('0x7a')](_0x035c('0x7e'),{'UserId':Number(_0x2bb402[_0x035c('0x37')][_0x035c('0x77')]),'VoicePrefixId':Number(_0x2bb402['params']['id'])});}});}})[_0x035c('0x2d')](respondWithStatusCode(_0x3b071b,null))['catch'](handleError(_0x3b071b,null));};exports[_0x035c('0x7f')]=function(_0x4d1003,_0x2f936f,_0x14d685){var _0x35f643={};var _0x1fea69={};var _0x3cd537;var _0x14b451;return db[_0x035c('0x32')][_0x035c('0x80')]({'where':{'id':_0x4d1003[_0x035c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f936f,null))['then'](function(_0x396874){if(_0x396874){_0x3cd537=_0x396874;_0x1fea69[_0x035c('0x38')]=_['keys'](db['User'][_0x035c('0x4d')]);_0x1fea69[_0x035c('0x37')]=_[_0x035c('0x36')](_0x4d1003[_0x035c('0x37')]);_0x1fea69[_0x035c('0x4e')]=_[_0x035c('0x3a')](_0x1fea69[_0x035c('0x38')],_0x1fea69[_0x035c('0x37')]);_0x35f643[_0x035c('0x39')]=_[_0x035c('0x3a')](_0x1fea69[_0x035c('0x38')],qs[_0x035c('0x3b')](_0x4d1003[_0x035c('0x37')][_0x035c('0x3b')]));_0x35f643[_0x035c('0x39')]=_0x35f643[_0x035c('0x39')]['length']?_0x35f643['attributes']:_0x1fea69[_0x035c('0x38')];_0x35f643['order']=qs[_0x035c('0x3f')](_0x4d1003[_0x035c('0x37')][_0x035c('0x3f')]);_0x35f643['where']=qs['filters'](_[_0x035c('0x41')](_0x4d1003[_0x035c('0x37')],_0x1fea69[_0x035c('0x4e')]));if(_0x4d1003[_0x035c('0x37')]['filter']){_0x35f643['where']=_[_0x035c('0x43')](_0x35f643['where'],{'$or':_[_0x035c('0x31')](_0x35f643[_0x035c('0x39')],function(_0x242538){var _0x2af470={};_0x2af470[_0x242538]={'$like':'%'+_0x4d1003[_0x035c('0x37')][_0x035c('0x42')]+'%'};return _0x2af470;})});}_0x35f643=_['merge']({},_0x35f643,_0x4d1003[_0x035c('0x45')]);return _0x3cd537['getAgents'](_0x35f643);}})[_0x035c('0x2d')](function(_0x1cdf5d){if(_0x1cdf5d){_0x14b451=_0x1cdf5d[_0x035c('0x3c')];if(!_0x4d1003['query'][_0x035c('0x3d')](_0x035c('0x3e'))){_0x35f643[_0x035c('0x23')]=qs[_0x035c('0x23')](_0x4d1003[_0x035c('0x37')][_0x035c('0x23')]);_0x35f643[_0x035c('0x21')]=qs[_0x035c('0x21')](_0x4d1003[_0x035c('0x37')][_0x035c('0x21')]);}return _0x3cd537[_0x035c('0x7f')](_0x35f643);}})[_0x035c('0x2d')](function(_0x2ca079){if(_0x2ca079){return _0x2ca079?{'count':_0x14b451,'rows':_0x2ca079}:null;}})[_0x035c('0x2d')](respondWithResult(_0x2f936f,null))['catch'](handleError(_0x2f936f,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0efde2e..00846d1 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 _0x819e=['save','update','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xc59e50,_0x1b9456){var _0x72acae=function(_0x5f0a6c){while(--_0x5f0a6c){_0xc59e50['push'](_0xc59e50['shift']());}};_0x72acae(++_0x1b9456);}(_0x819e,0xcb));var _0xe819=function(_0x29b01f,_0x13e8bb){_0x29b01f=_0x29b01f-0x0;var _0xf7d6c3=_0x819e[_0x29b01f];return _0xf7d6c3;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xe819('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe819('0x1'),'afterUpdate':_0xe819('0x2'),'afterDestroy':'remove'};function emitEvent(_0x290ca6){return function(_0x9087eb,_0x4e8a3d,_0x3785b9){VoicePrefixEvents['emit'](_0x290ca6+':'+_0x9087eb['id'],_0x9087eb);VoicePrefixEvents['emit'](_0x290ca6,_0x9087eb);_0x3785b9(null);};}for(var e in events){if(events[_0xe819('0x3')](e)){var event=events[e];VoicePrefix[_0xe819('0x4')](e,emitEvent(event));}}module[_0xe819('0x5')]=VoicePrefixEvents; \ No newline at end of file +var _0x5b12=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x52f0b3,_0x8a0b5d){var _0x3e7d93=function(_0x42c58e){while(--_0x42c58e){_0x52f0b3['push'](_0x52f0b3['shift']());}};_0x3e7d93(++_0x8a0b5d);}(_0x5b12,0xb8));var _0x25b1=function(_0x591547,_0x49de8f){_0x591547=_0x591547-0x0;var _0x3c82fa=_0x5b12[_0x591547];return _0x3c82fa;};'use strict';var EventEmitter=require(_0x25b1('0x0'));var VoicePrefix=require(_0x25b1('0x1'))['db'][_0x25b1('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x25b1('0x3')](0x0);var events={'afterCreate':_0x25b1('0x4'),'afterUpdate':_0x25b1('0x5'),'afterDestroy':_0x25b1('0x6')};function emitEvent(_0x26f8fe){return function(_0x3a4de0,_0x3f356b,_0x70cc0c){VoicePrefixEvents[_0x25b1('0x7')](_0x26f8fe+':'+_0x3a4de0['id'],_0x3a4de0);VoicePrefixEvents[_0x25b1('0x7')](_0x26f8fe,_0x3a4de0);_0x70cc0c(null);};}for(var e in events){if(events[_0x25b1('0x8')](e)){var event=events[e];VoicePrefix[_0x25b1('0x9')](e,emitEvent(event));}}module[_0x25b1('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 5264c4c..0489fd5 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 _0x6a21=['define','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x13dd37,_0x10f74d){var _0x43f9a5=function(_0x4b109a){while(--_0x4b109a){_0x13dd37['push'](_0x13dd37['shift']());}};_0x43f9a5(++_0x10f74d);}(_0x6a21,0x1e4));var _0x16a2=function(_0x1900f6,_0x2108df){_0x1900f6=_0x1900f6-0x0;var _0x22a6d2=_0x6a21[_0x1900f6];return _0x22a6d2;};'use strict';var _=require('lodash');var util=require(_0x16a2('0x0'));var logger=require(_0x16a2('0x1'))(_0x16a2('0x2'));var moment=require(_0x16a2('0x3'));var BPromise=require(_0x16a2('0x4'));var rp=require(_0x16a2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16a2('0x6'));var config=require(_0x16a2('0x7'));var attributes=require(_0x16a2('0x8'));module[_0x16a2('0x9')]=function(_0x3f1614,_0x16fa9b){return _0x3f1614[_0x16a2('0xa')](_0x16a2('0xb'),attributes,{'tableName':_0x16a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7742=['rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5dc2e7,_0x4d363c){var _0x551f1c=function(_0x1a7357){while(--_0x1a7357){_0x5dc2e7['push'](_0x5dc2e7['shift']());}};_0x551f1c(++_0x4d363c);}(_0x7742,0x180));var _0x2774=function(_0x2d2cf1,_0x3ca463){_0x2d2cf1=_0x2d2cf1-0x0;var _0x338698=_0x7742[_0x2d2cf1];return _0x338698;};'use strict';var _=require(_0x2774('0x0'));var util=require('util');var logger=require(_0x2774('0x1'))(_0x2774('0x2'));var moment=require('moment');var BPromise=require(_0x2774('0x3'));var rp=require(_0x2774('0x4'));var fs=require('fs');var path=require(_0x2774('0x5'));var rimraf=require(_0x2774('0x6'));var config=require(_0x2774('0x7'));var attributes=require(_0x2774('0x8'));module[_0x2774('0x9')]=function(_0x3fea95,_0x4f7f15){return _0x3fea95[_0x2774('0xa')](_0x2774('0xb'),attributes,{'tableName':_0x2774('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index ced6ed2..60f1491 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 _0x94ff=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','randomstring','ioredis'];(function(_0x32bbf6,_0xea7dfa){var _0x73eb8e=function(_0x4e0b5d){while(--_0x4e0b5d){_0x32bbf6['push'](_0x32bbf6['shift']());}};_0x73eb8e(++_0xea7dfa);}(_0x94ff,0xc3));var _0xf94f=function(_0x1231b3,_0x2a4ef5){_0x1231b3=_0x1231b3-0x0;var _0x116370=_0x94ff[_0x1231b3];return _0x116370;};'use strict';var _=require(_0xf94f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf94f('0x1'));var fs=require('fs');var Redis=require(_0xf94f('0x2'));var db=require(_0xf94f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf94f('0x4'))(_0xf94f('0x5'));var config=require('../../config/environment');var jayson=require(_0xf94f('0x6'));var client=jayson[_0xf94f('0x7')]['http']({'port':0x232a});config[_0xf94f('0x8')]=_['defaults'](config[_0xf94f('0x8')],{'host':_0xf94f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf94f('0x8')]));require(_0xf94f('0xa'))[_0xf94f('0xb')](socket);function respondWithRpcPromise(_0x57b900,_0x5c518f,_0x510972){return new BPromise(function(_0x2d3ea6,_0x234f34){return client[_0xf94f('0xc')](_0x57b900,_0x510972)[_0xf94f('0xd')](function(_0x18a8a6){logger[_0xf94f('0xe')](_0xf94f('0xf'),_0x5c518f,_0xf94f('0x10'));logger['debug'](_0xf94f('0x11'),_0x5c518f,_0xf94f('0x10'),JSON[_0xf94f('0x12')](_0x18a8a6));if(_0x18a8a6[_0xf94f('0x13')]){if(_0x18a8a6['error'][_0xf94f('0x14')]===0x1f4){logger[_0xf94f('0x13')](_0xf94f('0xf'),_0x5c518f,_0x18a8a6[_0xf94f('0x13')][_0xf94f('0x15')]);return _0x234f34(_0x18a8a6[_0xf94f('0x13')]['message']);}logger[_0xf94f('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x5c518f,_0x18a8a6[_0xf94f('0x13')][_0xf94f('0x15')]);return _0x2d3ea6(_0x18a8a6['error']['message']);}else{logger['info'](_0xf94f('0xf'),_0x5c518f,'request\x20sent');_0x2d3ea6(_0x18a8a6['result'][_0xf94f('0x15')]);}})['catch'](function(_0x33defc){logger['error'](_0xf94f('0xf'),_0x5c518f,_0x33defc);_0x234f34(_0x33defc);});});} \ No newline at end of file +var _0xa899=['error','message','VoicePrefix,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voicePrefix.socket','request','then','info','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','code'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xa899,0x155));var _0x9a89=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xa899[_0x154192];return _0x3c2792;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var moment=require(_0x9a89('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a89('0x3'));var fs=require('fs');var Redis=require(_0x9a89('0x4'));var db=require(_0x9a89('0x5'))['db'];var utils=require(_0x9a89('0x6'));var logger=require(_0x9a89('0x7'))(_0x9a89('0x8'));var config=require(_0x9a89('0x9'));var jayson=require(_0x9a89('0xa'));var client=jayson[_0x9a89('0xb')][_0x9a89('0xc')]({'port':0x232a});config[_0x9a89('0xd')]=_[_0x9a89('0xe')](config[_0x9a89('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a89('0xd')]));require(_0x9a89('0xf'))['register'](socket);function respondWithRpcPromise(_0xccf078,_0x4f487d,_0x111d99){return new BPromise(function(_0x2a9e30,_0x401680){return client[_0x9a89('0x10')](_0xccf078,_0x111d99)[_0x9a89('0x11')](function(_0xc61526){logger[_0x9a89('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x4f487d,'request\x20sent');logger[_0x9a89('0x13')](_0x9a89('0x14'),_0x4f487d,_0x9a89('0x15'),JSON['stringify'](_0xc61526));if(_0xc61526['error']){if(_0xc61526['error'][_0x9a89('0x16')]===0x1f4){logger[_0x9a89('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4f487d,_0xc61526[_0x9a89('0x17')][_0x9a89('0x18')]);return _0x401680(_0xc61526[_0x9a89('0x17')][_0x9a89('0x18')]);}logger['error'](_0x9a89('0x19'),_0x4f487d,_0xc61526[_0x9a89('0x17')]['message']);return _0x2a9e30(_0xc61526['error'][_0x9a89('0x18')]);}else{logger['info'](_0x9a89('0x19'),_0x4f487d,_0x9a89('0x15'));_0x2a9e30(_0xc61526['result'][_0x9a89('0x18')]);}})['catch'](function(_0x2d648f){logger[_0x9a89('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4f487d,_0x2d648f);_0x401680(_0x2d648f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8bb9d76..3f3aa2a 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 _0xe739=['length','voicePrefix:','./voicePrefix.events','remove','update','removeListener','register'];(function(_0x5bbc26,_0x37b718){var _0x1ade7f=function(_0x1d949a){while(--_0x1d949a){_0x5bbc26['push'](_0x5bbc26['shift']());}};_0x1ade7f(++_0x37b718);}(_0xe739,0x105));var _0x9e73=function(_0x1f4979,_0x26522a){_0x1f4979=_0x1f4979-0x0;var _0x5f1548=_0xe739[_0x1f4979];return _0x5f1548;};'use strict';var VoicePrefixEvents=require(_0x9e73('0x0'));var events=['save',_0x9e73('0x1'),_0x9e73('0x2')];function createListener(_0x2dc1a9,_0x508042){return function(_0x54a986){_0x508042['emit'](_0x2dc1a9,_0x54a986);};}function removeListener(_0x3bbc00,_0x43c2e8){return function(){VoicePrefixEvents[_0x9e73('0x3')](_0x3bbc00,_0x43c2e8);};}exports[_0x9e73('0x4')]=function(_0x4cb2ed){for(var _0x3db8fa=0x0,_0x26cb5b=events[_0x9e73('0x5')];_0x3db8fa<_0x26cb5b;_0x3db8fa++){var _0x5e46e7=events[_0x3db8fa];var _0xa49f86=createListener(_0x9e73('0x6')+_0x5e46e7,_0x4cb2ed);VoicePrefixEvents['on'](_0x5e46e7,_0xa49f86);}}; \ No newline at end of file +var _0xcf14=['voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener','register','length'];(function(_0x5d6054,_0x15db55){var _0x3cb091=function(_0x2ec005){while(--_0x2ec005){_0x5d6054['push'](_0x5d6054['shift']());}};_0x3cb091(++_0x15db55);}(_0xcf14,0xa1));var _0x4cf1=function(_0x11c77e,_0x5a56ba){_0x11c77e=_0x11c77e-0x0;var _0x59c3ac=_0xcf14[_0x11c77e];return _0x59c3ac;};'use strict';var VoicePrefixEvents=require(_0x4cf1('0x0'));var events=['save',_0x4cf1('0x1'),_0x4cf1('0x2')];function createListener(_0x55e5b6,_0x3401df){return function(_0x15f9b9){_0x3401df[_0x4cf1('0x3')](_0x55e5b6,_0x15f9b9);};}function removeListener(_0xc34979,_0x5de7f1){return function(){VoicePrefixEvents[_0x4cf1('0x4')](_0xc34979,_0x5de7f1);};}exports[_0x4cf1('0x5')]=function(_0x11a184){for(var _0x12076f=0x0,_0x32ad8c=events[_0x4cf1('0x6')];_0x12076f<_0x32ad8c;_0x12076f++){var _0x9efe60=events[_0x12076f];var _0x50273f=createListener(_0x4cf1('0x7')+_0x9efe60,_0x11a184);VoicePrefixEvents['on'](_0x9efe60,_0x50273f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index fed64e0..02725b8 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 _0x7a4a=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getTeams','/:id/users','/:id/members','getLists','post','create','/:id/clone','/:id/teams','addAgents','addLists','/:id/blacklists','addBlackLists','put','destroy','delete','removeTeams','/:id/lists','removeBlackLists','exports'];(function(_0x3aff8e,_0x932634){var _0x12b023=function(_0x335024){while(--_0x335024){_0x3aff8e['push'](_0x3aff8e['shift']());}};_0x12b023(++_0x932634);}(_0x7a4a,0xcc));var _0xa7a4=function(_0x2efb96,_0x40a4ce){_0x2efb96=_0x2efb96-0x0;var _0x50d38d=_0x7a4a[_0x2efb96];return _0x50d38d;};'use strict';var multer=require(_0xa7a4('0x0'));var util=require(_0xa7a4('0x1'));var path=require('path');var timeout=require(_0xa7a4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa7a4('0x3'));var auth=require(_0xa7a4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa7a4('0x5'));var controller=require('./voiceQueue.controller');router[_0xa7a4('0x6')]('/',auth['isAuthenticated'](),controller[_0xa7a4('0x7')]);router[_0xa7a4('0x6')](_0xa7a4('0x8'),auth[_0xa7a4('0x9')](),controller[_0xa7a4('0xa')]);router['get'](_0xa7a4('0xb'),auth[_0xa7a4('0x9')](),controller['getHoppers']);router[_0xa7a4('0x6')](_0xa7a4('0xc'),auth[_0xa7a4('0x9')](),controller[_0xa7a4('0xd')]);router['get']('/:id/hopper_finals',auth[_0xa7a4('0x9')](),controller[_0xa7a4('0xe')]);router['get']('/:id/hopper_black',auth[_0xa7a4('0x9')](),controller['getHopperBlacks']);router[_0xa7a4('0x6')]('/:id/teams',auth[_0xa7a4('0x9')](),controller[_0xa7a4('0xf')]);router[_0xa7a4('0x6')](_0xa7a4('0x10'),auth[_0xa7a4('0x9')](),controller['getAgents']);router['get'](_0xa7a4('0x11'),auth[_0xa7a4('0x9')](),controller['getMembers']);router[_0xa7a4('0x6')]('/:id/lists',auth[_0xa7a4('0x9')](),controller[_0xa7a4('0x12')]);router[_0xa7a4('0x6')]('/:id/blacklists',auth[_0xa7a4('0x9')](),controller['getBlackLists']);router[_0xa7a4('0x13')]('/',auth[_0xa7a4('0x9')](),controller[_0xa7a4('0x14')]);router[_0xa7a4('0x13')](_0xa7a4('0x15'),auth[_0xa7a4('0x9')](),controller['clone']);router['post'](_0xa7a4('0x16'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa7a4('0x13')](_0xa7a4('0x10'),auth[_0xa7a4('0x9')](),controller[_0xa7a4('0x17')]);router[_0xa7a4('0x13')]('/:id/lists',auth[_0xa7a4('0x9')](),controller[_0xa7a4('0x18')]);router[_0xa7a4('0x13')](_0xa7a4('0x19'),auth[_0xa7a4('0x9')](),controller[_0xa7a4('0x1a')]);router[_0xa7a4('0x1b')](_0xa7a4('0x8'),auth[_0xa7a4('0x9')](),controller['update']);router['delete'](_0xa7a4('0x8'),auth['isAuthenticated'](),controller[_0xa7a4('0x1c')]);router[_0xa7a4('0x1d')](_0xa7a4('0x16'),auth[_0xa7a4('0x9')](),controller[_0xa7a4('0x1e')]);router[_0xa7a4('0x1d')]('/:id/users',auth[_0xa7a4('0x9')](),controller['removeAgents']);router['delete'](_0xa7a4('0x1f'),auth[_0xa7a4('0x9')](),controller['removeLists']);router[_0xa7a4('0x1d')](_0xa7a4('0x19'),auth['isAuthenticated'](),controller[_0xa7a4('0x20')]);module[_0xa7a4('0x21')]=router; \ No newline at end of file +var _0xe0ed=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','get','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','addTeams','addLists','addBlackLists','/:id','destroy','delete','removeLists','multer','util','path','express','Router'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xe0ed,0x11b));var _0xde0e=function(_0x126c81,_0x1c8132){_0x126c81=_0x126c81-0x0;var _0x5eeb41=_0xe0ed[_0x126c81];return _0x5eeb41;};'use strict';var multer=require(_0xde0e('0x0'));var util=require(_0xde0e('0x1'));var path=require(_0xde0e('0x2'));var timeout=require('connect-timeout');var express=require(_0xde0e('0x3'));var router=express[_0xde0e('0x4')]();var fs_extra=require(_0xde0e('0x5'));var auth=require(_0xde0e('0x6'));var interaction=require(_0xde0e('0x7'));var config=require(_0xde0e('0x8'));var controller=require(_0xde0e('0x9'));router['get']('/',auth[_0xde0e('0xa')](),controller[_0xde0e('0xb')]);router['get']('/:id',auth[_0xde0e('0xa')](),controller['show']);router[_0xde0e('0xc')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router['get'](_0xde0e('0xd'),auth[_0xde0e('0xa')](),controller[_0xde0e('0xe')]);router[_0xde0e('0xc')](_0xde0e('0xf'),auth['isAuthenticated'](),controller[_0xde0e('0x10')]);router[_0xde0e('0xc')](_0xde0e('0x11'),auth[_0xde0e('0xa')](),controller[_0xde0e('0x12')]);router[_0xde0e('0xc')](_0xde0e('0x13'),auth['isAuthenticated'](),controller['getTeams']);router[_0xde0e('0xc')](_0xde0e('0x14'),auth[_0xde0e('0xa')](),controller[_0xde0e('0x15')]);router[_0xde0e('0xc')]('/:id/members',auth['isAuthenticated'](),controller[_0xde0e('0x16')]);router[_0xde0e('0xc')](_0xde0e('0x17'),auth[_0xde0e('0xa')](),controller[_0xde0e('0x18')]);router['get'](_0xde0e('0x19'),auth[_0xde0e('0xa')](),controller[_0xde0e('0x1a')]);router[_0xde0e('0x1b')]('/',auth['isAuthenticated'](),controller['create']);router[_0xde0e('0x1b')](_0xde0e('0x1c'),auth[_0xde0e('0xa')](),controller['clone']);router[_0xde0e('0x1b')]('/:id/teams',auth[_0xde0e('0xa')](),controller[_0xde0e('0x1d')]);router['post'](_0xde0e('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0xde0e('0x1b')](_0xde0e('0x17'),auth[_0xde0e('0xa')](),controller[_0xde0e('0x1e')]);router['post']('/:id/blacklists',auth[_0xde0e('0xa')](),controller[_0xde0e('0x1f')]);router['put'](_0xde0e('0x20'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xde0e('0x20'),auth[_0xde0e('0xa')](),controller[_0xde0e('0x21')]);router[_0xde0e('0x22')](_0xde0e('0x13'),auth[_0xde0e('0xa')](),controller['removeTeams']);router[_0xde0e('0x22')](_0xde0e('0x14'),auth[_0xde0e('0xa')](),controller['removeAgents']);router[_0xde0e('0x22')]('/:id/lists',auth[_0xde0e('0xa')](),controller[_0xde0e('0x23')]);router[_0xde0e('0x22')](_0xde0e('0x19'),auth[_0xde0e('0xa')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index c45cd11..80eecd5 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 _0xe548=['power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','ringall','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','inbound','booked','roundrobin','progressive','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview'];(function(_0x211245,_0x1880d7){var _0x24f6b7=function(_0x2683e1){while(--_0x2683e1){_0x211245['push'](_0x211245['shift']());}};_0x24f6b7(++_0x1880d7);}(_0xe548,0x184));var _0x8e54=function(_0x45dd0e,_0x28e603){_0x45dd0e=_0x45dd0e-0x0;var _0x50e5ca=_0xe548[_0x45dd0e];return _0x50e5ca;};'use strict';var Sequelize=require(_0x8e54('0x0'));module[_0x8e54('0x1')]={'name':{'type':Sequelize[_0x8e54('0x2')],'allowNull':![],'unique':_0x8e54('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8e54('0x4')]('inbound','outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x8e54('0x5'),'leastrecent',_0x8e54('0x6'),_0x8e54('0x7'),_0x8e54('0x8'),_0x8e54('0x9'),_0x8e54('0xa'),_0x8e54('0xb')),'allowNull':![],'defaultValue':_0x8e54('0x5'),'set':function(_0x5b4913){this[_0x8e54('0xc')](_0x8e54('0xd'),_0x5b4913?_0x5b4913:_0x8e54('0x8'));},'get':function(){var _0x305327=this[_0x8e54('0xe')]('type');var _0x248605=this[_0x8e54('0xe')]('dialMethod');var _0x543437=this['getDataValue']('strategy');if(_0x305327===_0x8e54('0xf')){return _0x543437;}if(_0x248605===_0x8e54('0x10')&&_0x543437===_0x8e54('0x8')||_0x248605==='booked'&&_0x543437===_0x8e54('0x11')){return _0x543437;}if(_0x248605===_0x8e54('0x12')||_0x248605==='predictive'||_0x248605==='power'){return _0x543437;}return null;}},'servicelevel':{'type':Sequelize[_0x8e54('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8e54('0x13')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8e54('0x2')]},'weight':{'type':Sequelize[_0x8e54('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no'),'defaultValue':_0x8e54('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x8e54('0x14'),'no',_0x8e54('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8e54('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x8e54('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x8e54('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8e54('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8e54('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x8e54('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no'),'defaultValue':_0x8e54('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x8e54('0x14'),'no',_0x8e54('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8e54('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8e54('0x2')]},'queue_quantity1':{'type':Sequelize[_0x8e54('0x2')]},'queue_quantity2':{'type':Sequelize[_0x8e54('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x8e54('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x5706d8){this['setDataValue'](_0x8e54('0x17'),_0x5706d8?_0x5706d8[_0x8e54('0x18')](','):[]);},'get':function(){return this[_0x8e54('0xe')]('periodic_announce')?this[_0x8e54('0xe')](_0x8e54('0x17'))[_0x8e54('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':'yes','set':function(_0xceb456){this[_0x8e54('0xc')](_0x8e54('0x1a'),_0xceb456?_0xceb456[_0x8e54('0x18')](','):undefined);},'get':function(){return this[_0x8e54('0xe')]('joinempty')?this[_0x8e54('0xe')](_0x8e54('0x1a'))[_0x8e54('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x4079d5){this[_0x8e54('0xc')](_0x8e54('0x1b'),_0x4079d5?_0x4079d5[_0x8e54('0x18')](','):undefined);},'get':function(){return this[_0x8e54('0xe')]('leavewhenempty')?this['getDataValue'](_0x8e54('0x1b'))[_0x8e54('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8e54('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8e54('0x2')]},'description':{'type':Sequelize[_0x8e54('0x2')]},'acw':{'type':Sequelize[_0x8e54('0x1c')],'defaultValue':0x0,'set':function(_0x30a3a3){this[_0x8e54('0xc')](_0x8e54('0x1d'),_0x30a3a3);if(_0x30a3a3){if(this[_0x8e54('0xe')](_0x8e54('0x1e'))<0x2){this[_0x8e54('0xc')](_0x8e54('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8e54('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x8e54('0x1f'),_0x8e54('0x12'),_0x8e54('0x20'),_0x8e54('0x21'),_0x8e54('0x10')),'defaultValue':_0x8e54('0x12'),'comment':_0x8e54('0x22')},'dialLimitChannel':{'type':Sequelize[_0x8e54('0x13')](0x4)[_0x8e54('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8e54('0x24')},'dialLimitQueue':{'type':Sequelize[_0x8e54('0x13')](0x4)[_0x8e54('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8e54('0x25')},'dialPowerLevel':{'type':Sequelize[_0x8e54('0x26')](0x2)[_0x8e54('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8e54('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x8e54('0x4')](_0x8e54('0x28'),_0x8e54('0x29')),'defaultValue':_0x8e54('0x29'),'comment':_0x8e54('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8e54('0x26')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8e54('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x8e54('0x13')](0x3)[_0x8e54('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8e54('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8e54('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x8e54('0x13')](0x3)[_0x8e54('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':_0x8e54('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e54('0x2e')},'dialQueueProject':{'type':Sequelize[_0x8e54('0x2')],'comment':_0x8e54('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8e54('0x13')](0x3)[_0x8e54('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e54('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8e54('0x13')](0x5)[_0x8e54('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e54('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x8e54('0x13')](0x3)[_0x8e54('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e54('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8e54('0x13')](0x5)[_0x8e54('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8e54('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x8e54('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8e54('0x13')](0x5)[_0x8e54('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e54('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8e54('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8e54('0x35')},'dialTimezone':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':_0x8e54('0x36')},'dialPrefix':{'type':Sequelize[_0x8e54('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8e54('0x4')]('always',_0x8e54('0x37'),_0x8e54('0x38')),'defaultValue':_0x8e54('0x39')},'dialAMDActive':{'type':Sequelize[_0x8e54('0x1c')],'defaultValue':0x0,'comment':_0x8e54('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x8e54('0x13')](0x9)[_0x8e54('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8e54('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x8e54('0x13')](0x9)[_0x8e54('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8e54('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8e54('0x13')](0x9)[_0x8e54('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8e54('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8e54('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8e54('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x8e54('0x13')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8e54('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8e54('0x13')](0x9)[_0x8e54('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8e54('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8e54('0x13')](0x9)[_0x8e54('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8e54('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8e54('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8e54('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8e54('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x8e54('0x13')](0x5)[_0x8e54('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8e54('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8e54('0x4')]('DESC',_0x8e54('0x44')),'defaultValue':_0x8e54('0x45')},'dialQueueProject2':{'type':Sequelize[_0x8e54('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8e54('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8e54('0x13')](0x3)[_0x8e54('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x8e54('0x13')](0x3)[_0x8e54('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8e54('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8e54('0x13')](0x3)[_0x8e54('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e54('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8e54('0x13')](0x5)[_0x8e54('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x8e54('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e54('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x8e54('0x13')](0x5)[_0x8e54('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e54('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8e54('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e54('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8e54('0x13')](0x5)[_0x8e54('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e54('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x8e54('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e54('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8e54('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e54('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8e54('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e54('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8e54('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e54('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8e54('0x13')],'allowNull':!![],'comment':_0x8e54('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x8e54('0x1c')],'defaultValue':![],'comment':_0x8e54('0x51'),'set':function(_0x23e063){if(!_0x23e063)this['setDataValue'](_0x8e54('0x52'),null);this[_0x8e54('0xc')](_0x8e54('0x53'),_0x23e063);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8e54('0x13')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8e54('0x13')](0x3)[_0x8e54('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x2c46=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','Only\x20for\x20predictive\x20method.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x2c46,0x6f));var _0x62c4=function(_0xf6fc32,_0x175c5e){_0xf6fc32=_0xf6fc32-0x0;var _0x32a988=_0x2c46[_0xf6fc32];return _0x32a988;};'use strict';var Sequelize=require('sequelize');module[_0x62c4('0x0')]={'name':{'type':Sequelize[_0x62c4('0x1')],'allowNull':![],'unique':_0x62c4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x4'),_0x62c4('0x5')),'allowNull':![],'defaultValue':_0x62c4('0x4')},'musiconhold':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':_0x62c4('0x6')},'announce':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x62c4('0x3')]('rr',_0x62c4('0x7'),_0x62c4('0x8'),_0x62c4('0x9'),_0x62c4('0xa'),_0x62c4('0xb'),_0x62c4('0xc'),'wrandom',_0x62c4('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1a16a6){this['setDataValue'](_0x62c4('0xe'),_0x1a16a6?_0x1a16a6:_0x62c4('0xb'));},'get':function(){var _0x169a32=this[_0x62c4('0xf')](_0x62c4('0x10'));var _0x37400d=this[_0x62c4('0xf')](_0x62c4('0x11'));var _0x3098e0=this[_0x62c4('0xf')](_0x62c4('0xe'));if(_0x169a32===_0x62c4('0x4')){return _0x3098e0;}if(_0x37400d==='booked'&&_0x3098e0==='rrmemory'||_0x37400d===_0x62c4('0x12')&&_0x3098e0===_0x62c4('0x13')){return _0x3098e0;}if(_0x37400d===_0x62c4('0x14')||_0x37400d===_0x62c4('0x15')||_0x37400d==='power'){return _0x3098e0;}return null;}},'servicelevel':{'type':Sequelize[_0x62c4('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x62c4('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x62c4('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no'),'defaultValue':_0x62c4('0x17')},'autopause':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no',_0x62c4('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x62c4('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x62c4('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x62c4('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x62c4('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x62c4('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x62c4('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x62c4('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x62c4('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x62c4('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x62c4('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x62c4('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no',_0x62c4('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x62c4('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x62c4('0x1')]},'queue_youarenext':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x62c4('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x62c4('0x1')]},'queue_less_than':{'type':Sequelize[_0x62c4('0x1')]},'periodic_announce':{'type':Sequelize[_0x62c4('0x1a')],'set':function(_0x31ddc6){this[_0x62c4('0x1b')](_0x62c4('0x1c'),_0x31ddc6?_0x31ddc6[_0x62c4('0x1d')](','):[]);},'get':function(){return this[_0x62c4('0xf')](_0x62c4('0x1c'))?this['getDataValue'](_0x62c4('0x1c'))[_0x62c4('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x62c4('0x17'),'set':function(_0x5763c2){this[_0x62c4('0x1b')](_0x62c4('0x1f'),_0x5763c2?_0x5763c2[_0x62c4('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0x62c4('0x1f'))?this[_0x62c4('0xf')](_0x62c4('0x1f'))[_0x62c4('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':'no','set':function(_0x4f6834){this[_0x62c4('0x1b')](_0x62c4('0x20'),_0x4f6834?_0x4f6834[_0x62c4('0x1d')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this['getDataValue']('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x62c4('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x62c4('0x3')](_0x62c4('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x62c4('0x1')]},'acw':{'type':Sequelize[_0x62c4('0x21')],'defaultValue':0x0,'set':function(_0x2ff8d5){this[_0x62c4('0x1b')](_0x62c4('0x22'),_0x2ff8d5);if(_0x2ff8d5){if(this[_0x62c4('0xf')](_0x62c4('0x23'))<0x2){this['setDataValue'](_0x62c4('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x62c4('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x62c4('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x62c4('0x3')]('preview',_0x62c4('0x14'),'power',_0x62c4('0x15'),'booked'),'defaultValue':_0x62c4('0x14'),'comment':_0x62c4('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x62c4('0x25')},'dialLimitQueue':{'type':Sequelize[_0x62c4('0x16')](0x4)[_0x62c4('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x62c4('0x27')},'dialPowerLevel':{'type':Sequelize[_0x62c4('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x62c4('0x29')),'defaultValue':_0x62c4('0x29'),'comment':_0x62c4('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x62c4('0x28')](0x2)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x62c4('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x62c4('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62c4('0x2b')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62c4('0x2c')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62c4('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x62c4('0x16')](0x5)[_0x62c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62c4('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62c4('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x62c4('0x16')](0x5)[_0x62c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62c4('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x62c4('0x16')](0x5)[_0x62c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62c4('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x62c4('0x32')},'dialTimezone':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':_0x62c4('0x33')},'dialPrefix':{'type':Sequelize[_0x62c4('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x62c4('0x34'),_0x62c4('0x35'),_0x62c4('0x36')),'defaultValue':_0x62c4('0x34')},'dialAMDActive':{'type':Sequelize[_0x62c4('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x62c4('0x16')](0x9)[_0x62c4('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x62c4('0x37')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x62c4('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x62c4('0x16')](0x9)[_0x62c4('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x62c4('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x62c4('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x62c4('0x16')](0x9)[_0x62c4('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x62c4('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x62c4('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x62c4('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x62c4('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x62c4('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x62c4('0x16')](0x9)[_0x62c4('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x62c4('0x16')](0x5)[_0x62c4('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x62c4('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x62c4('0x21')],'defaultValue':0x0,'comment':_0x62c4('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x62c4('0x3')]('DESC',_0x62c4('0x3e')),'defaultValue':_0x62c4('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x62c4('0x1')],'comment':_0x62c4('0x40')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x62c4('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x62c4('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x62c4('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x62c4('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x62c4('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62c4('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x62c4('0x16')](0x5)[_0x62c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62c4('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62c4('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0x62c4('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62c4('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62c4('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x62c4('0x16')](0x5)[_0x62c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62c4('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62c4('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x62c4('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62c4('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62c4('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x62c4('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62c4('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x62c4('0x16')],'allowNull':!![],'comment':_0x62c4('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x62c4('0x21')],'defaultValue':![],'comment':_0x62c4('0x4d'),'set':function(_0x180310){if(!_0x180310)this['setDataValue'](_0x62c4('0x4e'),null);this[_0x62c4('0x1b')](_0x62c4('0x4f'),_0x180310);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x62c4('0x16')](0x3)[_0x62c4('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index e762989..278a786 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 _0x2e45=['ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','QueryTypes','SELECT','every','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','online','push','isArray','UserVoiceQueueRt','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','limit','undefined','count','set','apply','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','sendStatus','send','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','include','findAll','catch','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','clone','omit','updatedAt','createdAt','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','CmHopper','VoiceQueueId','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','each','UserVoiceQueue','findOrCreate','upsert','isNil','format','SIP/%s','emit','removeTeams','Team','ids','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams'];(function(_0x3ca8ac,_0x1f919e){var _0x48fc31=function(_0x319d60){while(--_0x319d60){_0x3ca8ac['push'](_0x3ca8ac['shift']());}};_0x48fc31(++_0x1f919e);}(_0x2e45,0x1a4));var _0x52e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e45[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x52e4('0x0'));var rimraf=require(_0x52e4('0x1'));var zipdir=require(_0x52e4('0x2'));var jsonpatch=require(_0x52e4('0x3'));var rp=require(_0x52e4('0x4'));var moment=require('moment');var BPromise=require(_0x52e4('0x5'));var Mustache=require(_0x52e4('0x6'));var util=require(_0x52e4('0x7'));var path=require(_0x52e4('0x8'));var sox=require('sox');var csv=require(_0x52e4('0x9'));var ejs=require(_0x52e4('0xa'));var fs=require('fs');var fs_extra=require(_0x52e4('0xb'));var _=require(_0x52e4('0xc'));var squel=require(_0x52e4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x52e4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x52e4('0xf'));var Papa=require(_0x52e4('0x10'));var Redis=require(_0x52e4('0x11'));var authService=require(_0x52e4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52e4('0x13'));var logger=require('../../config/logger')(_0x52e4('0x14'));var utils=require(_0x52e4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x52e4('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x52e4('0x17')](config['redis'],{'host':_0x52e4('0x18'),'port':0x18eb});var socket=require(_0x52e4('0x19'))(new Redis(config['redis']));require(_0x52e4('0x1a'))[_0x52e4('0x1b')](socket);function respondWithStatusCode(_0x22a534,_0x3fe775){_0x3fe775=_0x3fe775||0xcc;return function(_0x420ef4){if(_0x420ef4){return _0x22a534['sendStatus'](_0x3fe775);}return _0x22a534[_0x52e4('0x1c')](_0x3fe775)[_0x52e4('0x1d')]();};}function respondWithResult(_0x554a26,_0x2222b6){_0x2222b6=_0x2222b6||0xc8;return function(_0x34de28){if(_0x34de28){return _0x554a26[_0x52e4('0x1c')](_0x2222b6)[_0x52e4('0x1e')](_0x34de28);}};}function respondWithFilteredResult(_0x5802f2,_0x1cc0f6){return function(_0x54b0c3){if(_0x54b0c3){var _0xfa4adb=typeof _0x1cc0f6[_0x52e4('0x1f')]==='undefined'&&typeof _0x1cc0f6[_0x52e4('0x20')]===_0x52e4('0x21');var _0x1e16f0=_0x54b0c3[_0x52e4('0x22')];var _0x222ef4=_0xfa4adb?0x0:_0x1cc0f6[_0x52e4('0x1f')];var _0x3ef459=_0xfa4adb?_0x54b0c3[_0x52e4('0x22')]:_0x1cc0f6[_0x52e4('0x1f')]+_0x1cc0f6['limit'];var _0x16b852;if(_0x3ef459>=_0x1e16f0){_0x3ef459=_0x1e16f0;_0x16b852=0xc8;}else{_0x16b852=0xce;}_0x5802f2[_0x52e4('0x1c')](_0x16b852);return _0x5802f2[_0x52e4('0x23')]('Content-Range',_0x222ef4+'-'+_0x3ef459+'/'+_0x1e16f0)['json'](_0x54b0c3);}return null;};}function patchUpdates(_0x1ec78b){return function(_0x2ca5ef){try{jsonpatch[_0x52e4('0x24')](_0x2ca5ef,_0x1ec78b,!![]);}catch(_0x421bb0){return BPromise['reject'](_0x421bb0);}return _0x2ca5ef[_0x52e4('0x25')]();};}function saveUpdates(_0x4ade08,_0x437029){return function(_0xa66bd){if(_0xa66bd){return _0xa66bd['update'](_0x4ade08)[_0x52e4('0x26')](function(_0x34ec3d){return _0x34ec3d;});}return null;};}function removeEntity(_0x3efafa,_0x32bb49){return function(_0x1059aa){if(_0x1059aa){return _0x1059aa[_0x52e4('0x27')]()[_0x52e4('0x26')](function(){var _0x2f2fd7=_0x1059aa[_0x52e4('0x28')]({'plain':!![]});var _0x20ee4a=[{'name':_0x52e4('0x29'),'value':_0x52e4('0x2a'),'ignore':![]},{'name':_0x52e4('0x2b'),'value':_0x52e4('0x2c'),'ignore':![]}];var _0x28ea5d=_(_0x20ee4a)[_0x52e4('0x2d')](_0x52e4('0x2e'))[_0x52e4('0x2f')](_0x52e4('0x30'))['value']();if(_[_0x52e4('0x31')](_0x28ea5d,_0x2f2fd7[_0x52e4('0x32')])){return;}var _0x3cb3a9=_[_0x52e4('0x33')](_0x20ee4a,['value',_0x2f2fd7[_0x52e4('0x32')]])[_0x52e4('0x34')];return db[_0x52e4('0x35')]['destroy']({'where':{'type':_0x3cb3a9,'resourceId':_0x2f2fd7['id']}})['then'](function(){return _0x1059aa;});})[_0x52e4('0x26')](function(){_0x3efafa[_0x52e4('0x1c')](0xcc)[_0x52e4('0x1d')]();});}};}function handleEntityNotFound(_0x24cf75,_0x299601){return function(_0x52d3e3){if(!_0x52d3e3){_0x24cf75[_0x52e4('0x36')](0x194);}return _0x52d3e3;};}function handleError(_0x314190,_0x2372fe){_0x2372fe=_0x2372fe||0x1f4;return function(_0x4bb527){logger['error'](_0x4bb527['stack']);if(_0x4bb527['name']){delete _0x4bb527[_0x52e4('0x34')];}_0x314190[_0x52e4('0x1c')](_0x2372fe)[_0x52e4('0x37')](_0x4bb527);};}exports[_0x52e4('0x38')]=function(_0x3a92f7,_0x1db14b){var _0x300dd1={},_0x54a454={},_0x48bf7b={'count':0x0,'rows':[]};var _0x32f1e3=_['map'](db[_0x52e4('0x39')][_0x52e4('0x3a')],function(_0x5ba0a8){return{'name':_0x5ba0a8[_0x52e4('0x3b')],'type':_0x5ba0a8['type']['key']};});_0x54a454[_0x52e4('0x3c')]=_[_0x52e4('0x2f')](_0x32f1e3,_0x52e4('0x34'));_0x54a454[_0x52e4('0x3d')]=_[_0x52e4('0x3e')](_0x3a92f7[_0x52e4('0x3d')]);_0x54a454[_0x52e4('0x3f')]=_[_0x52e4('0x40')](_0x54a454[_0x52e4('0x3c')],_0x54a454[_0x52e4('0x3d')]);_0x300dd1[_0x52e4('0x41')]=_[_0x52e4('0x40')](_0x54a454['model'],qs[_0x52e4('0x42')](_0x3a92f7['query'][_0x52e4('0x42')]));_0x300dd1[_0x52e4('0x41')]=_0x300dd1[_0x52e4('0x41')][_0x52e4('0x43')]?_0x300dd1['attributes']:_0x54a454[_0x52e4('0x3c')];if(!_0x3a92f7[_0x52e4('0x3d')][_0x52e4('0x44')](_0x52e4('0x45'))){_0x300dd1['limit']=qs[_0x52e4('0x20')](_0x3a92f7[_0x52e4('0x3d')][_0x52e4('0x20')]);_0x300dd1['offset']=qs[_0x52e4('0x1f')](_0x3a92f7[_0x52e4('0x3d')][_0x52e4('0x1f')]);}_0x300dd1[_0x52e4('0x46')]=qs[_0x52e4('0x47')](_0x3a92f7[_0x52e4('0x3d')][_0x52e4('0x47')]);_0x300dd1['where']=qs[_0x52e4('0x3f')](_[_0x52e4('0x48')](_0x3a92f7[_0x52e4('0x3d')],_0x54a454[_0x52e4('0x3f')]),_0x32f1e3);if(_0x3a92f7[_0x52e4('0x3d')]['filter']){_0x300dd1['where']=_[_0x52e4('0x49')](_0x300dd1[_0x52e4('0x4a')],{'$or':_['map'](_0x32f1e3,function(_0x58ad34){if(_0x58ad34[_0x52e4('0x32')]!==_0x52e4('0x4b')){var _0x5dab56={};_0x5dab56[_0x58ad34[_0x52e4('0x34')]]={'$like':'%'+_0x3a92f7[_0x52e4('0x3d')][_0x52e4('0x2d')]+'%'};return _0x5dab56;}})});}_0x300dd1=_[_0x52e4('0x49')]({},_0x300dd1,_0x3a92f7[_0x52e4('0x4c')]);var _0x56dad6={'where':_0x300dd1[_0x52e4('0x4a')]};return db[_0x52e4('0x39')][_0x52e4('0x22')](_0x56dad6)[_0x52e4('0x26')](function(_0x353660){_0x48bf7b[_0x52e4('0x22')]=_0x353660;if(_0x3a92f7[_0x52e4('0x3d')]['includeAll']){_0x300dd1[_0x52e4('0x4d')]=[{'all':!![]}];}return db[_0x52e4('0x39')][_0x52e4('0x4e')](_0x300dd1);})['then'](function(_0x1269b5){_0x48bf7b['rows']=_0x1269b5;return _0x48bf7b;})['then'](respondWithFilteredResult(_0x1db14b,_0x300dd1))[_0x52e4('0x4f')](handleError(_0x1db14b,null));};exports['show']=function(_0xebfed5,_0x547656){var _0x21571b={'raw':![],'where':{'id':_0xebfed5['params']['id']}},_0x2e7d37={};_0x2e7d37[_0x52e4('0x3c')]=_[_0x52e4('0x3e')](db[_0x52e4('0x39')][_0x52e4('0x3a')]);_0x2e7d37['query']=_[_0x52e4('0x3e')](_0xebfed5[_0x52e4('0x3d')]);_0x2e7d37[_0x52e4('0x3f')]=_[_0x52e4('0x40')](_0x2e7d37[_0x52e4('0x3c')],_0x2e7d37['query']);_0x21571b['attributes']=_[_0x52e4('0x40')](_0x2e7d37[_0x52e4('0x3c')],qs[_0x52e4('0x42')](_0xebfed5[_0x52e4('0x3d')][_0x52e4('0x42')]));_0x21571b[_0x52e4('0x41')]=_0x21571b[_0x52e4('0x41')][_0x52e4('0x43')]?_0x21571b[_0x52e4('0x41')]:_0x2e7d37[_0x52e4('0x3c')];if(_0xebfed5[_0x52e4('0x3d')][_0x52e4('0x50')]){_0x21571b[_0x52e4('0x4d')]=[{'all':!![]}];}_0x21571b=_[_0x52e4('0x49')]({},_0x21571b,_0xebfed5[_0x52e4('0x4c')]);return db[_0x52e4('0x39')][_0x52e4('0x33')](_0x21571b)[_0x52e4('0x26')](handleEntityNotFound(_0x547656,null))['then'](respondWithResult(_0x547656,null))['catch'](handleError(_0x547656,null));};exports[_0x52e4('0x51')]=function(_0x30330f,_0x551267){return db[_0x52e4('0x39')][_0x52e4('0x51')](_0x30330f[_0x52e4('0x52')],{})[_0x52e4('0x26')](function(_0x57778b){var _0xfff9d7=_0x30330f[_0x52e4('0x53')]['get']({'plain':!![]});if(!_0xfff9d7)throw new Error(_0x52e4('0x54'));if(_0xfff9d7[_0x52e4('0x55')]==='user'){var _0x57064d=_0x57778b[_0x52e4('0x28')]({'plain':!![]});var _0x5b6b79=[{'name':_0x52e4('0x29'),'value':'inbound'},{'name':_0x52e4('0x2b'),'value':_0x52e4('0x2c')}];var _0x2c030f=_[_0x52e4('0x33')](_0x5b6b79,[_0x52e4('0x30'),_0x57064d[_0x52e4('0x32')]])['name'];return db['UserProfileSection'][_0x52e4('0x33')]({'where':{'name':_0x2c030f,'userProfileId':_0xfff9d7['userProfileId']},'raw':!![]})[_0x52e4('0x26')](function(_0x4e3edc){if(_0x4e3edc&&_0x4e3edc[_0x52e4('0x56')]===0x0){return db[_0x52e4('0x35')][_0x52e4('0x51')]({'name':_0x57064d[_0x52e4('0x34')],'resourceId':_0x57064d['id'],'type':_0x4e3edc[_0x52e4('0x34')],'sectionId':_0x4e3edc['id']},{})[_0x52e4('0x26')](function(){return _0x57778b;});}else{return _0x57778b;}})[_0x52e4('0x4f')](function(_0xdc8636){logger[_0x52e4('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdc8636);throw _0xdc8636;});}return _0x57778b;})[_0x52e4('0x26')](respondWithResult(_0x551267,0xc9))['catch'](handleError(_0x551267,null));};exports[_0x52e4('0x58')]=function(_0x5466bb,_0x5a726a){var _0x50369f={'where':{'id':_0x5466bb['params']['id']}},_0x6509c3={};_0x6509c3['model']=_[_0x52e4('0x3e')](db['VoiceQueue'][_0x52e4('0x3a')]);_0x50369f[_0x52e4('0x41')]=_[_0x52e4('0x40')](_0x6509c3[_0x52e4('0x3c')],qs[_0x52e4('0x42')](_0x5466bb[_0x52e4('0x3d')][_0x52e4('0x42')]));_0x50369f[_0x52e4('0x41')]=_0x50369f[_0x52e4('0x41')][_0x52e4('0x43')]?_0x50369f['attributes']:_0x6509c3[_0x52e4('0x3c')];if(_0x5466bb['query'][_0x52e4('0x50')]){_0x50369f['include']=[{'all':!![]}];}_0x50369f=_['merge']({},_0x50369f,_0x5466bb['options']);return db[_0x52e4('0x39')][_0x52e4('0x33')](_0x50369f)[_0x52e4('0x26')](handleEntityNotFound(_0x5a726a,null))['then'](function(_0x3f86da){if(_0x3f86da){var _0x13da46=_0x3f86da[_0x52e4('0x28')]({'plain':!![]});_0x13da46=qs[_0x52e4('0x59')](_0x13da46,['id','createdAt',_0x52e4('0x5a')]);_0x5466bb['body']=_[_0x52e4('0x59')](_0x5466bb['body'],['id',_0x52e4('0x5b'),'updatedAt']);return db[_0x52e4('0x39')][_0x52e4('0x51')](_[_0x52e4('0x49')](_0x13da46,_0x5466bb[_0x52e4('0x52')]),{'include':_0x5466bb['query']['includeAll']?[{'all':!![]}]:undefined})[_0x52e4('0x26')](function(_0x10a451){var _0x2a6840=_0x5466bb[_0x52e4('0x53')][_0x52e4('0x28')]({'plain':!![]});if(!_0x2a6840)throw new Error(_0x52e4('0x54'));if(_0x2a6840[_0x52e4('0x55')]===_0x52e4('0x53')){var _0x4f0542=_0x10a451[_0x52e4('0x28')]({'plain':!![]});var _0x40b52e=[{'name':_0x52e4('0x29'),'value':_0x52e4('0x2a')},{'name':'QueueCampaigns','value':_0x52e4('0x2c')}];var _0x14abd5=_['find'](_0x40b52e,[_0x52e4('0x30'),_0x4f0542[_0x52e4('0x32')]])[_0x52e4('0x34')];return db[_0x52e4('0x5c')][_0x52e4('0x33')]({'where':{'name':_0x14abd5,'userProfileId':_0x2a6840[_0x52e4('0x5d')]},'raw':!![]})[_0x52e4('0x26')](function(_0x30276f){if(_0x30276f&&_0x30276f[_0x52e4('0x56')]===0x0){return db['UserProfileResource'][_0x52e4('0x51')]({'name':_0x4f0542['name'],'resourceId':_0x4f0542['id'],'type':_0x30276f['name'],'sectionId':_0x30276f['id']},{})[_0x52e4('0x26')](function(){return _0x10a451;});}else{return _0x10a451;}})[_0x52e4('0x4f')](function(_0x49bb16){logger[_0x52e4('0x57')](_0x52e4('0x5e'),_0x49bb16);throw _0x49bb16;});}return _0x10a451;});}})['then'](respondWithResult(_0x5a726a,0xc9))[_0x52e4('0x4f')](handleError(_0x5a726a,null));};exports[_0x52e4('0x5f')]=function(_0x28785b,_0x86ffa2){if(_0x28785b[_0x52e4('0x52')]['id']){delete _0x28785b[_0x52e4('0x52')]['id'];}return db[_0x52e4('0x39')][_0x52e4('0x33')]({'where':{'id':_0x28785b[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x86ffa2,null))['then'](saveUpdates(_0x28785b[_0x52e4('0x52')],null))[_0x52e4('0x26')](respondWithResult(_0x86ffa2,null))['catch'](handleError(_0x86ffa2,null));};exports[_0x52e4('0x27')]=function(_0x1f875d,_0x3899aa){return db[_0x52e4('0x39')][_0x52e4('0x33')]({'where':{'id':_0x1f875d[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x3899aa,null))['then'](removeEntity(_0x3899aa,null))[_0x52e4('0x4f')](handleError(_0x3899aa,null));};exports[_0x52e4('0x61')]=function(_0x4588e7,_0x1ea424,_0x3474df){var _0x54dd53={'raw':![],'where':{}};var _0x3536f0={};var _0x2aecab={'count':0x0,'rows':[]};return db[_0x52e4('0x39')]['findOne']({'where':{'id':_0x4588e7[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x1ea424,null))['then'](function(_0x562bdb){if(_0x562bdb){_0x3536f0[_0x52e4('0x3c')]=_[_0x52e4('0x3e')](db[_0x52e4('0x62')][_0x52e4('0x3a')]);_0x3536f0[_0x52e4('0x3d')]=_[_0x52e4('0x3e')](_0x4588e7['query']);_0x3536f0['filters']=_['intersection'](_0x3536f0['model'],_0x3536f0[_0x52e4('0x3d')]);_0x54dd53[_0x52e4('0x41')]=_['intersection'](_0x3536f0['model'],qs['fields'](_0x4588e7[_0x52e4('0x3d')][_0x52e4('0x42')]));_0x54dd53[_0x52e4('0x41')]=_0x54dd53[_0x52e4('0x41')][_0x52e4('0x43')]?_0x54dd53['attributes']:_0x3536f0[_0x52e4('0x3c')];if(!_0x4588e7['query'][_0x52e4('0x44')](_0x52e4('0x45'))){_0x54dd53['limit']=qs['limit'](_0x4588e7['query'][_0x52e4('0x20')]);_0x54dd53[_0x52e4('0x1f')]=qs[_0x52e4('0x1f')](_0x4588e7[_0x52e4('0x3d')][_0x52e4('0x1f')]);}_0x54dd53[_0x52e4('0x46')]=qs['sort'](_0x4588e7['query'][_0x52e4('0x47')]);_0x54dd53[_0x52e4('0x4a')]=qs[_0x52e4('0x3f')](_[_0x52e4('0x48')](_0x4588e7[_0x52e4('0x3d')],_0x3536f0[_0x52e4('0x3f')]));_0x54dd53[_0x52e4('0x4a')][_0x52e4('0x63')]=_0x562bdb['id'];if(_0x4588e7[_0x52e4('0x3d')][_0x52e4('0x2d')]){_0x54dd53[_0x52e4('0x4a')]=_[_0x52e4('0x49')](_0x54dd53['where'],{'$or':_[_0x52e4('0x2f')](_0x54dd53['attributes'],function(_0x419ff2){var _0x5565ef={};_0x5565ef[_0x419ff2]={'$like':'%'+_0x4588e7[_0x52e4('0x3d')][_0x52e4('0x2d')]+'%'};return _0x5565ef;})});}_0x54dd53=_['merge']({},_0x54dd53,_0x4588e7['options']);return db[_0x52e4('0x62')]['count']({'where':_0x54dd53[_0x52e4('0x4a')]})[_0x52e4('0x26')](function(_0x5d0b37){_0x2aecab[_0x52e4('0x22')]=_0x5d0b37;if(_0x4588e7['query'][_0x52e4('0x50')]){_0x54dd53[_0x52e4('0x4d')]=[{'all':!![]}];}return db[_0x52e4('0x62')][_0x52e4('0x4e')](_0x54dd53);})[_0x52e4('0x26')](function(_0x3d820c){_0x2aecab[_0x52e4('0x64')]=_0x3d820c;return _0x2aecab;});}})[_0x52e4('0x26')](respondWithFilteredResult(_0x1ea424,_0x54dd53))[_0x52e4('0x4f')](handleError(_0x1ea424,null));};exports[_0x52e4('0x65')]=function(_0x229c83,_0x1da2c6,_0x27f967){var _0x445ea4={'raw':!![],'where':{}};var _0x39e14c={};var _0x1dfa9b={'count':0x0,'rows':[]};return db[_0x52e4('0x39')][_0x52e4('0x66')]({'where':{'id':_0x229c83[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x1da2c6,null))[_0x52e4('0x26')](function(_0x99f91e){if(_0x99f91e){_0x39e14c[_0x52e4('0x3c')]=_['keys'](db[_0x52e4('0x67')][_0x52e4('0x3a')]);_0x39e14c['query']=_['keys'](_0x229c83['query']);_0x39e14c['filters']=_[_0x52e4('0x40')](_0x39e14c[_0x52e4('0x3c')],_0x39e14c['query']);_0x445ea4['attributes']=_[_0x52e4('0x40')](_0x39e14c['model'],qs[_0x52e4('0x42')](_0x229c83[_0x52e4('0x3d')][_0x52e4('0x42')]));_0x445ea4['attributes']=_0x445ea4[_0x52e4('0x41')][_0x52e4('0x43')]?_0x445ea4['attributes']:_0x39e14c[_0x52e4('0x3c')];if(!_0x229c83[_0x52e4('0x3d')][_0x52e4('0x44')](_0x52e4('0x45'))){_0x445ea4[_0x52e4('0x20')]=qs['limit'](_0x229c83['query'][_0x52e4('0x20')]);_0x445ea4['offset']=qs[_0x52e4('0x1f')](_0x229c83[_0x52e4('0x3d')][_0x52e4('0x1f')]);}_0x445ea4[_0x52e4('0x46')]=qs[_0x52e4('0x47')](_0x229c83['query'][_0x52e4('0x47')]);_0x445ea4['where']=qs[_0x52e4('0x3f')](_['pick'](_0x229c83[_0x52e4('0x3d')],_0x39e14c[_0x52e4('0x3f')]));_0x445ea4['where'][_0x52e4('0x63')]=_0x99f91e['id'];if(_0x229c83[_0x52e4('0x3d')]['filter']){_0x445ea4[_0x52e4('0x4a')]=_[_0x52e4('0x49')](_0x445ea4[_0x52e4('0x4a')],{'$or':_['map'](_0x445ea4[_0x52e4('0x41')],function(_0x5a5eb1){var _0x314619={};_0x314619[_0x5a5eb1]={'$like':'%'+_0x229c83[_0x52e4('0x3d')][_0x52e4('0x2d')]+'%'};return _0x314619;})});}_0x445ea4=_[_0x52e4('0x49')]({},_0x445ea4,_0x229c83[_0x52e4('0x4c')]);return db['CmHopperHistory'][_0x52e4('0x22')]({'where':_0x445ea4[_0x52e4('0x4a')]})[_0x52e4('0x26')](function(_0x5859eb){_0x1dfa9b[_0x52e4('0x22')]=_0x5859eb;if(_0x229c83[_0x52e4('0x3d')][_0x52e4('0x50')]){_0x445ea4[_0x52e4('0x4d')]=[{'all':!![]}];}return db[_0x52e4('0x67')][_0x52e4('0x4e')](_0x445ea4);})[_0x52e4('0x26')](function(_0x1165f1){_0x1dfa9b['rows']=_0x1165f1;return _0x1dfa9b;});}})[_0x52e4('0x26')](respondWithFilteredResult(_0x1da2c6,_0x445ea4))[_0x52e4('0x4f')](handleError(_0x1da2c6,null));};exports[_0x52e4('0x68')]=function(_0x5a5369,_0x44ca55,_0x4c67ac){var _0x1a6904={'raw':!![],'where':{}};var _0x45acbe={};var _0x59e4f0={'count':0x0,'rows':[]};return db[_0x52e4('0x39')][_0x52e4('0x66')]({'where':{'id':_0x5a5369['params']['id']}})['then'](handleEntityNotFound(_0x44ca55,null))[_0x52e4('0x26')](function(_0x2e4b19){if(_0x2e4b19){_0x45acbe[_0x52e4('0x3c')]=_[_0x52e4('0x3e')](db[_0x52e4('0x69')][_0x52e4('0x3a')]);_0x45acbe['query']=_['keys'](_0x5a5369[_0x52e4('0x3d')]);_0x45acbe[_0x52e4('0x3f')]=_[_0x52e4('0x40')](_0x45acbe[_0x52e4('0x3c')],_0x45acbe[_0x52e4('0x3d')]);_0x1a6904[_0x52e4('0x41')]=_['intersection'](_0x45acbe[_0x52e4('0x3c')],qs[_0x52e4('0x42')](_0x5a5369[_0x52e4('0x3d')][_0x52e4('0x42')]));_0x1a6904['attributes']=_0x1a6904[_0x52e4('0x41')][_0x52e4('0x43')]?_0x1a6904[_0x52e4('0x41')]:_0x45acbe[_0x52e4('0x3c')];if(!_0x5a5369['query'][_0x52e4('0x44')]('nolimit')){_0x1a6904[_0x52e4('0x20')]=qs[_0x52e4('0x20')](_0x5a5369[_0x52e4('0x3d')][_0x52e4('0x20')]);_0x1a6904[_0x52e4('0x1f')]=qs[_0x52e4('0x1f')](_0x5a5369[_0x52e4('0x3d')]['offset']);}_0x1a6904[_0x52e4('0x46')]=qs[_0x52e4('0x47')](_0x5a5369[_0x52e4('0x3d')][_0x52e4('0x47')]);_0x1a6904['where']=qs[_0x52e4('0x3f')](_[_0x52e4('0x48')](_0x5a5369[_0x52e4('0x3d')],_0x45acbe[_0x52e4('0x3f')]));_0x1a6904['where'][_0x52e4('0x63')]=_0x2e4b19['id'];if(_0x5a5369[_0x52e4('0x3d')][_0x52e4('0x2d')]){_0x1a6904[_0x52e4('0x4a')]=_[_0x52e4('0x49')](_0x1a6904[_0x52e4('0x4a')],{'$or':_[_0x52e4('0x2f')](_0x1a6904[_0x52e4('0x41')],function(_0x59cbfd){var _0x17a4d1={};_0x17a4d1[_0x59cbfd]={'$like':'%'+_0x5a5369[_0x52e4('0x3d')][_0x52e4('0x2d')]+'%'};return _0x17a4d1;})});}_0x1a6904=_[_0x52e4('0x49')]({},_0x1a6904,_0x5a5369[_0x52e4('0x4c')]);return db[_0x52e4('0x69')][_0x52e4('0x22')]({'where':_0x1a6904[_0x52e4('0x4a')]})['then'](function(_0x16f872){_0x59e4f0[_0x52e4('0x22')]=_0x16f872;if(_0x5a5369[_0x52e4('0x3d')][_0x52e4('0x50')]){_0x1a6904[_0x52e4('0x4d')]=[{'all':!![]}];}return db[_0x52e4('0x69')][_0x52e4('0x4e')](_0x1a6904);})[_0x52e4('0x26')](function(_0x4b7918){_0x59e4f0[_0x52e4('0x64')]=_0x4b7918;return _0x59e4f0;});}})[_0x52e4('0x26')](respondWithFilteredResult(_0x44ca55,_0x1a6904))[_0x52e4('0x4f')](handleError(_0x44ca55,null));};exports[_0x52e4('0x6a')]=function(_0x1f3625,_0x57272a,_0xce0d32){var _0x1b108c={'raw':!![],'where':{}};var _0x32d11c={};var _0x1ddd81={'count':0x0,'rows':[]};return db[_0x52e4('0x39')][_0x52e4('0x66')]({'where':{'id':_0x1f3625[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x57272a,null))['then'](function(_0x59c4fe){if(_0x59c4fe){_0x32d11c[_0x52e4('0x3c')]=_[_0x52e4('0x3e')](db[_0x52e4('0x6b')]['rawAttributes']);_0x32d11c[_0x52e4('0x3d')]=_['keys'](_0x1f3625[_0x52e4('0x3d')]);_0x32d11c[_0x52e4('0x3f')]=_[_0x52e4('0x40')](_0x32d11c[_0x52e4('0x3c')],_0x32d11c[_0x52e4('0x3d')]);_0x1b108c[_0x52e4('0x41')]=_['intersection'](_0x32d11c['model'],qs[_0x52e4('0x42')](_0x1f3625[_0x52e4('0x3d')][_0x52e4('0x42')]));_0x1b108c['attributes']=_0x1b108c[_0x52e4('0x41')][_0x52e4('0x43')]?_0x1b108c[_0x52e4('0x41')]:_0x32d11c['model'];if(!_0x1f3625[_0x52e4('0x3d')]['hasOwnProperty'](_0x52e4('0x45'))){_0x1b108c[_0x52e4('0x20')]=qs[_0x52e4('0x20')](_0x1f3625[_0x52e4('0x3d')][_0x52e4('0x20')]);_0x1b108c[_0x52e4('0x1f')]=qs[_0x52e4('0x1f')](_0x1f3625[_0x52e4('0x3d')][_0x52e4('0x1f')]);}_0x1b108c[_0x52e4('0x46')]=qs[_0x52e4('0x47')](_0x1f3625['query'][_0x52e4('0x47')]);_0x1b108c[_0x52e4('0x4a')]=qs[_0x52e4('0x3f')](_['pick'](_0x1f3625['query'],_0x32d11c[_0x52e4('0x3f')]));_0x1b108c['where'][_0x52e4('0x63')]=_0x59c4fe['id'];if(_0x1f3625[_0x52e4('0x3d')][_0x52e4('0x2d')]){_0x1b108c[_0x52e4('0x4a')]=_[_0x52e4('0x49')](_0x1b108c[_0x52e4('0x4a')],{'$or':_[_0x52e4('0x2f')](_0x1b108c['attributes'],function(_0x186111){var _0x1a517a={};_0x1a517a[_0x186111]={'$like':'%'+_0x1f3625['query'][_0x52e4('0x2d')]+'%'};return _0x1a517a;})});}_0x1b108c=_['merge']({},_0x1b108c,_0x1f3625[_0x52e4('0x4c')]);return db[_0x52e4('0x6b')]['count']({'where':_0x1b108c[_0x52e4('0x4a')]})[_0x52e4('0x26')](function(_0x3a6683){_0x1ddd81['count']=_0x3a6683;if(_0x1f3625['query'][_0x52e4('0x50')]){_0x1b108c[_0x52e4('0x4d')]=[{'all':!![]}];}return db[_0x52e4('0x6b')][_0x52e4('0x4e')](_0x1b108c);})[_0x52e4('0x26')](function(_0x3f5aa7){_0x1ddd81['rows']=_0x3f5aa7;return _0x1ddd81;});}})[_0x52e4('0x26')](respondWithFilteredResult(_0x57272a,_0x1b108c))[_0x52e4('0x4f')](handleError(_0x57272a,null));};exports[_0x52e4('0x6c')]=function(_0x3201f8,_0x2a4a70,_0x1ea21e){var _0xd02d2f={};var _0x2ccddd={};var _0x585770;var _0x2ff564;return db['VoiceQueue'][_0x52e4('0x66')]({'where':{'id':_0x3201f8[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x2a4a70,null))[_0x52e4('0x26')](function(_0x106d5f){if(_0x106d5f){_0x585770=_0x106d5f;_0x2ccddd[_0x52e4('0x3c')]=_['keys'](db['Team'][_0x52e4('0x3a')]);_0x2ccddd[_0x52e4('0x3d')]=_[_0x52e4('0x3e')](_0x3201f8[_0x52e4('0x3d')]);_0x2ccddd['filters']=_[_0x52e4('0x40')](_0x2ccddd['model'],_0x2ccddd['query']);_0xd02d2f[_0x52e4('0x41')]=_['intersection'](_0x2ccddd['model'],qs[_0x52e4('0x42')](_0x3201f8[_0x52e4('0x3d')][_0x52e4('0x42')]));_0xd02d2f[_0x52e4('0x41')]=_0xd02d2f[_0x52e4('0x41')]['length']?_0xd02d2f[_0x52e4('0x41')]:_0x2ccddd[_0x52e4('0x3c')];_0xd02d2f[_0x52e4('0x46')]=qs[_0x52e4('0x47')](_0x3201f8[_0x52e4('0x3d')][_0x52e4('0x47')]);_0xd02d2f[_0x52e4('0x4a')]=qs[_0x52e4('0x3f')](_[_0x52e4('0x48')](_0x3201f8[_0x52e4('0x3d')],_0x2ccddd['filters']));if(_0x3201f8[_0x52e4('0x3d')]['filter']){_0xd02d2f[_0x52e4('0x4a')]=_[_0x52e4('0x49')](_0xd02d2f['where'],{'$or':_[_0x52e4('0x2f')](_0xd02d2f[_0x52e4('0x41')],function(_0x2a281c){var _0x196975={};_0x196975[_0x2a281c]={'$like':'%'+_0x3201f8['query'][_0x52e4('0x2d')]+'%'};return _0x196975;})});}_0xd02d2f=_[_0x52e4('0x49')]({},_0xd02d2f,_0x3201f8[_0x52e4('0x4c')]);return _0x585770[_0x52e4('0x6c')](_0xd02d2f);}})['then'](function(_0x2b83af){if(_0x2b83af){_0x2ff564=_0x2b83af[_0x52e4('0x43')];if(!_0x3201f8[_0x52e4('0x3d')][_0x52e4('0x44')](_0x52e4('0x45'))){_0xd02d2f[_0x52e4('0x20')]=qs[_0x52e4('0x20')](_0x3201f8['query'][_0x52e4('0x20')]);_0xd02d2f[_0x52e4('0x1f')]=qs[_0x52e4('0x1f')](_0x3201f8[_0x52e4('0x3d')][_0x52e4('0x1f')]);}return _0x585770[_0x52e4('0x6c')](_0xd02d2f);}})[_0x52e4('0x26')](function(_0x1528a1){if(_0x1528a1){return _0x1528a1?{'count':_0x2ff564,'rows':_0x1528a1}:null;}})[_0x52e4('0x26')](respondWithResult(_0x2a4a70,null))[_0x52e4('0x4f')](handleError(_0x2a4a70,null));};exports[_0x52e4('0x6d')]=function(_0x29ecb2,_0x549d8,_0x2470cc){var _0x5ded90=_0x29ecb2[_0x52e4('0x52')]['teams'];var _0x2bddc8=_[_0x52e4('0x2f')](_0x5ded90,'id');return db['Team'][_0x52e4('0x4e')]({'where':{'id':_0x2bddc8},'attributes':['id'],'include':[{'model':db[_0x52e4('0x6e')],'as':_0x52e4('0x6f'),'attributes':['id',_0x52e4('0x34'),'online',_0x52e4('0x70'),_0x52e4('0x71')],'raw':!![]}]})['then'](function(_0x32e508){if(_0x32e508){var _0x7b0017=_[_0x52e4('0x72')](_0x32e508,function(_0x915c3e){var _0x3fc1e0=_0x915c3e[_0x52e4('0x28')]({'plain':!![]});_0x3fc1e0['Agents'][_0x52e4('0x73')](function(_0x1d690c){_0x1d690c[_0x52e4('0x74')]=_['find'](_0x5ded90,{'id':_0x3fc1e0['id']})[_0x52e4('0x74')];});return _0x3fc1e0['Agents'];});return db[_0x52e4('0x39')][_0x52e4('0x33')]({'where':{'id':_0x29ecb2[_0x52e4('0x60')]['id']}})['then'](function(_0x1106af){return db[_0x52e4('0x75')]['transaction'](function(_0x1fd0ef){return _0x1106af[_0x52e4('0x6d')](_0x2bddc8,{'transaction':_0x1fd0ef})[_0x52e4('0x26')](function(){return BPromise[_0x52e4('0x76')](_0x5ded90,function(_0x2bb546){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x2bb546['id'],'VoiceQueueId':_0x29ecb2[_0x52e4('0x60')]['id'],'penalty':_0x2bb546[_0x52e4('0x74')]},{'transaction':_0x1fd0ef});});})[_0x52e4('0x26')](function(){return BPromise[_0x52e4('0x76')](_0x7b0017,function(_0x2da2ea){return db[_0x52e4('0x77')][_0x52e4('0x78')]({'where':{'UserId':_0x2da2ea['id'],'VoiceQueueId':_0x29ecb2[_0x52e4('0x60')]['id']},'defaults':{'penalty':_0x2da2ea['penalty']},'transaction':_0x1fd0ef});});})['then'](function(){return BPromise[_0x52e4('0x76')](_['filter'](_0x7b0017,{'online':!![]}),function(_0x4807bd){return db['UserVoiceQueueRt'][_0x52e4('0x79')]({'membername':_0x4807bd['name'],'UserId':_0x4807bd['id'],'queue_name':_0x1106af[_0x52e4('0x34')],'VoiceQueueId':_0x1106af['id'],'interface':_[_0x52e4('0x7a')](_0x4807bd[_0x52e4('0x71')])?util[_0x52e4('0x7b')](_0x52e4('0x7c'),_0x4807bd['name']):_0x4807bd[_0x52e4('0x71')],'paused':_0x4807bd['voicePause']||![],'penalty':_0x4807bd[_0x52e4('0x74')]},{'transaction':_0x1fd0ef});});})[_0x52e4('0x26')](function(){_0x7b0017['forEach'](function(_0x482cd2){socket[_0x52e4('0x7d')]('userVoiceQueue:save',{'UserId':_0x482cd2['id'],'VoiceQueueId':_0x1106af['id']});});});});});}})[_0x52e4('0x26')](respondWithStatusCode(_0x549d8,null))[_0x52e4('0x4f')](handleError(_0x549d8,null));};exports[_0x52e4('0x7e')]=function(_0xbc9136,_0x2bfb9b,_0x9153b4){return db[_0x52e4('0x7f')][_0x52e4('0x4e')]({'where':{'id':_0xbc9136[_0x52e4('0x3d')][_0x52e4('0x80')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x52e4('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x52e4('0x26')](handleEntityNotFound(_0x2bfb9b,null))[_0x52e4('0x26')](function(_0x5a849c){var _0x208789=_[_0x52e4('0x2f')](_0x5a849c,'id');var _0x56b2a9=[];var _0x1fec27=[];var _0x16be68=squel[_0x52e4('0x81')]();_0x16be68[_0x52e4('0x82')](_0x52e4('0x83'))['from'](_0x52e4('0x84'),'tq')[_0x52e4('0x85')](_0x52e4('0x86'),'ut',_0x52e4('0x87'))[_0x52e4('0x4a')](_0x52e4('0x88'),_0xbc9136['params']['id']);for(var _0x579812=0x0;_0x579812<_0x5a849c[_0x52e4('0x43')];_0x579812+=0x1){let _0x308612=_0x5a849c[_0x579812];for(var _0x41455f=0x0;_0x41455f<_0x308612[_0x52e4('0x6f')]['length'];_0x41455f+=0x1){let _0xe08a18=_0x308612[_0x52e4('0x6f')][_0x41455f];var _0x6ce1f7=_0x16be68['clone']();_0x6ce1f7[_0x52e4('0x4a')]('ut.UserId\x20=\x20?',_0xe08a18['id']);_0x1fec27['push'](db[_0x52e4('0x75')][_0x52e4('0x3d')](_0x6ce1f7['toString'](),{'type':db[_0x52e4('0x75')][_0x52e4('0x89')][_0x52e4('0x8a')]})[_0x52e4('0x26')](function(_0x4eb74b){if(_0x4eb74b[_0x52e4('0x43')]===0x1){return _0xe08a18['id'];}else{var _0x5568ba=_[_0x52e4('0x8b')](_['map'](_0x4eb74b,'TeamId'),function(_0x16bea1){return _[_0x52e4('0x31')](_0x208789,_0x16bea1);});if(_0x5568ba){return _0xe08a18['id'];}}}));}}return BPromise[_0x52e4('0x8c')](_0x1fec27)[_0x52e4('0x26')](function(_0x5585ac){_0x56b2a9=_(_0x56b2a9)[_0x52e4('0x8d')](_0x5585ac)[_0x52e4('0x8e')]()[_0x52e4('0x30')]();return db[_0x52e4('0x39')][_0x52e4('0x33')]({'where':{'id':_0xbc9136[_0x52e4('0x60')]['id']}})['then'](function(_0x2f65a5){return db[_0x52e4('0x75')][_0x52e4('0x8f')](function(_0x26a454){return _0x2f65a5['removeTeams'](_0xbc9136[_0x52e4('0x3d')][_0x52e4('0x80')],{'transaction':_0x26a454})[_0x52e4('0x26')](function(){if(!_[_0x52e4('0x90')](_0x56b2a9)){return _0x2f65a5[_0x52e4('0x91')](_0x56b2a9,{'transaction':_0x26a454})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xbc9136['params']['id'],'UserId':_0x56b2a9},'transaction':_0x26a454});});}})['then'](function(){_0x56b2a9[_0x52e4('0x73')](function(_0x6a8698){socket[_0x52e4('0x7d')](_0x52e4('0x92'),{'UserId':_0x6a8698,'VoiceQueueId':_0x2f65a5['id']});});});});});});})[_0x52e4('0x26')](respondWithStatusCode(_0x2bfb9b,null))['catch'](handleError(_0x2bfb9b,null));};exports[_0x52e4('0x93')]=function(_0x1f52c8,_0x19c125,_0x2fc905){var _0x479e30,_0x4fe5c3;return db[_0x52e4('0x39')][_0x52e4('0x33')]({'where':{'id':_0x1f52c8[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x19c125,null))[_0x52e4('0x26')](function(_0x2eb560){if(_0x2eb560){_0x4fe5c3=_0x2eb560;return _0x2eb560['addAgents'](_0x1f52c8['body'][_0x52e4('0x80')],_['omit'](_0x1f52c8[_0x52e4('0x52')],[_0x52e4('0x80'),'id'])||{})[_0x52e4('0x94')](function(_0x1fa20c){for(var _0x1e894c=0x0;_0x1e894c<_0x1f52c8[_0x52e4('0x52')]['ids']['length'];_0x1e894c+=0x1){socket[_0x52e4('0x7d')](_0x52e4('0x95'),{'UserId':Number(_0x1f52c8['body'][_0x52e4('0x80')][_0x1e894c]),'VoiceQueueId':Number(_0x1f52c8[_0x52e4('0x60')]['id'])});}return _0x1fa20c;});}})['then'](function(_0x30c4e1){_0x479e30=_0x30c4e1||[];if(_0x4fe5c3){return db[_0x52e4('0x6e')]['findAll']({'where':{'id':_0x1f52c8['body'][_0x52e4('0x80')]},'attributes':['id','name',_0x52e4('0x96'),_0x52e4('0x70'),_0x52e4('0x71')],'raw':!![]});}})[_0x52e4('0x26')](function(_0x13ff37){if(!_['isEmpty'](_0x13ff37)){var _0x1a919b=[];for(var _0xc92839=0x0;_0xc92839<_0x13ff37[_0x52e4('0x43')];_0xc92839++){if(_0x13ff37[_0xc92839][_0x52e4('0x96')]){_0x1a919b[_0x52e4('0x97')](db['UserVoiceQueueRt'][_0x52e4('0x79')]({'membername':_0x13ff37[_0xc92839][_0x52e4('0x34')],'UserId':_0x13ff37[_0xc92839]['id'],'queue_name':_0x4fe5c3['name'],'VoiceQueueId':_0x4fe5c3['id'],'interface':_[_0x52e4('0x7a')](_0x13ff37[_0xc92839][_0x52e4('0x71')])?util[_0x52e4('0x7b')](_0x52e4('0x7c'),_0x13ff37[_0xc92839][_0x52e4('0x34')]):_0x13ff37[_0xc92839][_0x52e4('0x71')],'paused':_0x13ff37[_0xc92839]['voicePause']||![],'penalty':_0x1f52c8[_0x52e4('0x52')][_0x52e4('0x74')]||0x0}));}}return BPromise[_0x52e4('0x8c')](_0x1a919b);}})[_0x52e4('0x26')](function(){return _0x479e30;})[_0x52e4('0x26')](respondWithResult(_0x19c125,null))[_0x52e4('0x4f')](handleError(_0x19c125,null));};exports[_0x52e4('0x91')]=function(_0xfabd44,_0x19697e,_0x440e95){return db['VoiceQueue']['find']({'where':{'id':_0xfabd44[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x19697e,null))['then'](function(_0x2749b8){if(_0x2749b8){return _0x2749b8['removeAgents'](_0xfabd44[_0x52e4('0x3d')][_0x52e4('0x80')])['then'](function(){if(_[_0x52e4('0x98')](_0xfabd44['query'][_0x52e4('0x80')])){for(var _0x17b965=0x0;_0x17b965<_0xfabd44['query']['ids'][_0x52e4('0x43')];_0x17b965+=0x1){socket['emit'](_0x52e4('0x92'),{'UserId':Number(_0xfabd44['query'][_0x52e4('0x80')][_0x17b965]),'VoiceQueueId':Number(_0xfabd44[_0x52e4('0x60')]['id'])});}}else{socket[_0x52e4('0x7d')](_0x52e4('0x92'),{'UserId':Number(_0xfabd44[_0x52e4('0x3d')][_0x52e4('0x80')]),'VoiceQueueId':Number(_0xfabd44[_0x52e4('0x60')]['id'])});}});}})[_0x52e4('0x26')](function(_0x493ce2){return db[_0x52e4('0x99')][_0x52e4('0x27')]({'where':{'VoiceQueueId':_0xfabd44[_0x52e4('0x60')]['id'],'UserId':_0xfabd44[_0x52e4('0x3d')][_0x52e4('0x80')]}})['then'](function(){return _0x493ce2;});})[_0x52e4('0x26')](respondWithStatusCode(_0x19697e,null))[_0x52e4('0x4f')](handleError(_0x19697e,null));};exports[_0x52e4('0x9a')]=function(_0x3c6907,_0x206c77,_0x7a3d19){var _0x5357a3={};var _0x5b6b74={};var _0x5992df;var _0x3fcab0;return db[_0x52e4('0x39')][_0x52e4('0x66')]({'where':{'id':_0x3c6907[_0x52e4('0x60')]['id']}})['then'](handleEntityNotFound(_0x206c77,null))['then'](function(_0x25af55){if(_0x25af55){_0x5992df=_0x25af55;_0x5b6b74['model']=_[_0x52e4('0x3e')](db[_0x52e4('0x6e')][_0x52e4('0x3a')]);_0x5b6b74[_0x52e4('0x3d')]=_['keys'](_0x3c6907['query']);_0x5b6b74[_0x52e4('0x3f')]=_['intersection'](_0x5b6b74[_0x52e4('0x3c')],_0x5b6b74[_0x52e4('0x3d')]);_0x5357a3[_0x52e4('0x41')]=_[_0x52e4('0x40')](_0x5b6b74[_0x52e4('0x3c')],qs[_0x52e4('0x42')](_0x3c6907['query'][_0x52e4('0x42')]));_0x5357a3[_0x52e4('0x41')]=_0x5357a3[_0x52e4('0x41')]['length']?_0x5357a3[_0x52e4('0x41')]:_0x5b6b74['model'];_0x5357a3[_0x52e4('0x46')]=qs[_0x52e4('0x47')](_0x3c6907[_0x52e4('0x3d')]['sort']);_0x5357a3[_0x52e4('0x4a')]=qs[_0x52e4('0x3f')](_['pick'](_0x3c6907['query'],_0x5b6b74[_0x52e4('0x3f')]));if(_0x3c6907[_0x52e4('0x3d')][_0x52e4('0x2d')]){_0x5357a3['where']=_['merge'](_0x5357a3[_0x52e4('0x4a')],{'$or':_[_0x52e4('0x2f')](_0x5357a3[_0x52e4('0x41')],function(_0x13a13d){var _0x2252fa={};_0x2252fa[_0x13a13d]={'$like':'%'+_0x3c6907[_0x52e4('0x3d')][_0x52e4('0x2d')]+'%'};return _0x2252fa;})});}_0x5357a3=_['merge']({},_0x5357a3,_0x3c6907[_0x52e4('0x4c')]);return _0x5992df['getAgents'](_0x5357a3);}})[_0x52e4('0x26')](function(_0x30b571){if(_0x30b571){_0x3fcab0=_0x30b571[_0x52e4('0x43')];if(!_0x3c6907['query']['hasOwnProperty'](_0x52e4('0x45'))){_0x5357a3[_0x52e4('0x20')]=qs[_0x52e4('0x20')](_0x3c6907[_0x52e4('0x3d')]['limit']);_0x5357a3[_0x52e4('0x1f')]=qs[_0x52e4('0x1f')](_0x3c6907[_0x52e4('0x3d')]['offset']);}return _0x5992df[_0x52e4('0x9a')](_0x5357a3);}})[_0x52e4('0x26')](function(_0x42974d){if(_0x42974d){return _0x42974d?{'count':_0x3fcab0,'rows':_0x42974d}:null;}})['then'](respondWithResult(_0x206c77,null))[_0x52e4('0x4f')](handleError(_0x206c77,null));};exports[_0x52e4('0x9b')]=function(_0xb52c82,_0x59c4d0,_0x1fbec1){var _0x202263={};var _0x370201={};var _0x3c70fc;var _0x22dfb9;return db[_0x52e4('0x39')]['findOne']({'where':{'id':_0xb52c82['params']['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x59c4d0,null))[_0x52e4('0x26')](function(_0x2f9add){if(_0x2f9add){_0x3c70fc=_0x2f9add;_0x370201[_0x52e4('0x3c')]=_[_0x52e4('0x3e')](db[_0x52e4('0x99')][_0x52e4('0x3a')]);_0x370201[_0x52e4('0x3d')]=_['keys'](_0xb52c82[_0x52e4('0x3d')]);_0x370201['filters']=_['intersection'](_0x370201[_0x52e4('0x3c')],_0x370201[_0x52e4('0x3d')]);_0x202263['attributes']=_['intersection'](_0x370201[_0x52e4('0x3c')],qs[_0x52e4('0x42')](_0xb52c82[_0x52e4('0x3d')][_0x52e4('0x42')]));_0x202263[_0x52e4('0x41')]=_0x202263[_0x52e4('0x41')][_0x52e4('0x43')]?_0x202263[_0x52e4('0x41')]:_0x370201[_0x52e4('0x3c')];_0x202263[_0x52e4('0x46')]=qs[_0x52e4('0x47')](_0xb52c82[_0x52e4('0x3d')][_0x52e4('0x47')]);_0x202263[_0x52e4('0x4a')]=qs[_0x52e4('0x3f')](_['pick'](_0xb52c82[_0x52e4('0x3d')],_0x370201[_0x52e4('0x3f')]));if(_0xb52c82[_0x52e4('0x3d')][_0x52e4('0x2d')]){_0x202263[_0x52e4('0x4a')]=_[_0x52e4('0x49')](_0x202263['where'],{'$or':_[_0x52e4('0x2f')](_0x202263[_0x52e4('0x41')],function(_0x2047f7){var _0x115321={};_0x115321[_0x2047f7]={'$like':'%'+_0xb52c82[_0x52e4('0x3d')][_0x52e4('0x2d')]+'%'};return _0x115321;})});}_0x202263=_[_0x52e4('0x49')]({},_0x202263,_0xb52c82[_0x52e4('0x4c')]);return _0x3c70fc[_0x52e4('0x9b')](_0x202263);}})[_0x52e4('0x26')](function(_0x296f38){if(_0x296f38){_0x22dfb9=_0x296f38[_0x52e4('0x43')];if(!_0xb52c82['query'][_0x52e4('0x44')](_0x52e4('0x45'))){_0x202263['limit']=qs[_0x52e4('0x20')](_0xb52c82['query']['limit']);_0x202263['offset']=qs[_0x52e4('0x1f')](_0xb52c82['query'][_0x52e4('0x1f')]);}return _0x3c70fc['getMembers'](_0x202263);}})['then'](function(_0x1d227f){return _0x1d227f?{'count':_0x22dfb9,'rows':_0x1d227f}:null;})[_0x52e4('0x26')](respondWithResult(_0x59c4d0,null))[_0x52e4('0x4f')](handleError(_0x59c4d0,null));};exports['getLists']=function(_0xbc1e4d,_0x318a57,_0x331736){var _0x27ec03={};var _0x479fc3={};var _0x493b09;var _0x522b8f;return db[_0x52e4('0x39')][_0x52e4('0x66')]({'where':{'id':_0xbc1e4d[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x318a57,null))['then'](function(_0x2d0b3d){if(_0x2d0b3d){_0x493b09=_0x2d0b3d;_0x479fc3[_0x52e4('0x3c')]=_[_0x52e4('0x3e')](db['CmList'][_0x52e4('0x3a')]);_0x479fc3['query']=_[_0x52e4('0x3e')](_0xbc1e4d['query']);_0x479fc3[_0x52e4('0x3f')]=_[_0x52e4('0x40')](_0x479fc3['model'],_0x479fc3[_0x52e4('0x3d')]);_0x27ec03[_0x52e4('0x41')]=_[_0x52e4('0x40')](_0x479fc3[_0x52e4('0x3c')],qs[_0x52e4('0x42')](_0xbc1e4d[_0x52e4('0x3d')][_0x52e4('0x42')]));_0x27ec03[_0x52e4('0x41')]=_0x27ec03['attributes'][_0x52e4('0x43')]?_0x27ec03[_0x52e4('0x41')]:_0x479fc3[_0x52e4('0x3c')];_0x27ec03['order']=qs[_0x52e4('0x47')](_0xbc1e4d[_0x52e4('0x3d')]['sort']);_0x27ec03[_0x52e4('0x4a')]=qs[_0x52e4('0x3f')](_['pick'](_0xbc1e4d[_0x52e4('0x3d')],_0x479fc3[_0x52e4('0x3f')]));if(_0xbc1e4d[_0x52e4('0x3d')][_0x52e4('0x2d')]){_0x27ec03[_0x52e4('0x4a')]=_[_0x52e4('0x49')](_0x27ec03['where'],{'$or':_['map'](_0x27ec03[_0x52e4('0x41')],function(_0x125495){var _0x5a7079={};_0x5a7079[_0x125495]={'$like':'%'+_0xbc1e4d[_0x52e4('0x3d')][_0x52e4('0x2d')]+'%'};return _0x5a7079;})});}_0x27ec03=_['merge']({},_0x27ec03,_0xbc1e4d['options']);return _0x493b09['getLists'](_0x27ec03);}})[_0x52e4('0x26')](function(_0x3872cf){if(_0x3872cf){_0x522b8f=_0x3872cf['length'];if(!_0xbc1e4d[_0x52e4('0x3d')]['hasOwnProperty'](_0x52e4('0x45'))){_0x27ec03[_0x52e4('0x20')]=qs['limit'](_0xbc1e4d[_0x52e4('0x3d')][_0x52e4('0x20')]);_0x27ec03[_0x52e4('0x1f')]=qs[_0x52e4('0x1f')](_0xbc1e4d['query'][_0x52e4('0x1f')]);}return _0x493b09[_0x52e4('0x9c')](_0x27ec03);}})[_0x52e4('0x26')](function(_0x12616d){if(_0x12616d){return _0x12616d?{'count':_0x522b8f,'rows':_0x12616d}:null;}})[_0x52e4('0x26')](respondWithResult(_0x318a57,null))[_0x52e4('0x4f')](handleError(_0x318a57,null));};exports[_0x52e4('0x9d')]=function(_0x4bb51d,_0x122897,_0xaea393){var _0x498bc6,_0x2a875a;return db[_0x52e4('0x39')]['find']({'where':{'id':_0x4bb51d[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x122897,null))['then'](function(_0x4c105c){if(_0x4c105c){_0x2a875a=_0x4c105c;return _0x4c105c['addLists'](_0x4bb51d[_0x52e4('0x52')][_0x52e4('0x80')],_[_0x52e4('0x59')](_0x4bb51d['body'],[_0x52e4('0x80'),'id'])||{});}return null;})[_0x52e4('0x94')](function(_0x5cdd66){var _0x43b4c0;_0x498bc6=_0x5cdd66||[];var _0x25c677=[];if(_0x5cdd66){for(var _0x357504=0x0;_0x357504<_0x5cdd66[_0x52e4('0x43')];_0x357504+=0x1){var _0x192d55=_0x5cdd66[_0x357504]['get']({'plain':!![]});_0x2a875a[_0x52e4('0x9e')]=_0x4bb51d[_0x52e4('0x52')][_0x52e4('0x9e')]?_0x4bb51d[_0x52e4('0x52')][_0x52e4('0x9e')]:_0x2a875a[_0x52e4('0x9e')];switch(_0x2a875a['dialCheckDuplicateType']){case'always':_0x43b4c0=squel[_0x52e4('0x9f')]()[_0x52e4('0xa0')](_0x52e4('0xa1'))[_0x52e4('0xa2')]([_0x52e4('0xa3'),_0x52e4('0xa4'),_0x52e4('0xa5'),_0x52e4('0xa6'),_0x52e4('0x63'),_0x52e4('0x5b'),_0x52e4('0x5a')],squel['select']()[_0x52e4('0x82')]('phone',_0x52e4('0xa3'))['field'](_0x52e4('0xa7'),'scheduledAt')[_0x52e4('0x82')]('id','ContactId')['field'](_0x192d55[_0x52e4('0xa8')][_0x52e4('0xa9')](),_0x52e4('0xa6'))[_0x52e4('0x82')](_0x4bb51d[_0x52e4('0x60')]['id'][_0x52e4('0xa9')](),_0x52e4('0x63'))[_0x52e4('0x82')](_0x52e4('0xa7'),_0x52e4('0x5b'))[_0x52e4('0x82')](_0x52e4('0xa7'),_0x52e4('0x5a'))[_0x52e4('0xaa')](_0x52e4('0xab'))['where'](_0x52e4('0xac'))[_0x52e4('0x4a')](_0x52e4('0xad'),_0x192d55[_0x52e4('0xa8')][_0x52e4('0xa9')]())['where'](_0x52e4('0xae'))[_0x52e4('0x4a')](_0x52e4('0xaf'),squel[_0x52e4('0x81')]()[_0x52e4('0x82')](_0x52e4('0xb0'))[_0x52e4('0xaa')](_0x52e4('0xb1'))[_0x52e4('0x4a')]('VoiceQueueId\x20=\x20?',_0x4bb51d['params']['id']['toString']()))['where'](_0x52e4('0xaf'),squel[_0x52e4('0x81')]()[_0x52e4('0x82')]('COALESCE(phone,\x27\x27)')['from'](_0x52e4('0xa1'))[_0x52e4('0x4a')](_0x52e4('0x88'),_0x4bb51d[_0x52e4('0x60')]['id']['toString']())))[_0x52e4('0xa9')]();break;case _0x52e4('0xb2'):_0x43b4c0=squel[_0x52e4('0x9f')]()[_0x52e4('0xa0')](_0x52e4('0xa1'))[_0x52e4('0xa2')]([_0x52e4('0xa3'),_0x52e4('0xa4'),_0x52e4('0xa5'),_0x52e4('0xa6'),'VoiceQueueId',_0x52e4('0x5b'),_0x52e4('0x5a')],squel[_0x52e4('0x81')]()['field'](_0x52e4('0xa3'),_0x52e4('0xa3'))[_0x52e4('0x82')](_0x52e4('0xa7'),_0x52e4('0xa4'))[_0x52e4('0x82')]('id',_0x52e4('0xa5'))[_0x52e4('0x82')](_0x192d55['CmListId'][_0x52e4('0xa9')](),_0x52e4('0xa6'))[_0x52e4('0x82')](_0x4bb51d[_0x52e4('0x60')]['id'][_0x52e4('0xa9')](),_0x52e4('0x63'))['field']('NOW()',_0x52e4('0x5b'))[_0x52e4('0x82')](_0x52e4('0xa7'),_0x52e4('0x5a'))[_0x52e4('0xaa')](_0x52e4('0xab'))['where'](_0x52e4('0xac'))[_0x52e4('0x4a')](_0x52e4('0xad'),_0x192d55[_0x52e4('0xa8')][_0x52e4('0xa9')]())[_0x52e4('0x4a')](_0x52e4('0xae'))[_0x52e4('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x52e4('0x81')]()[_0x52e4('0x82')](_0x52e4('0xb3'))[_0x52e4('0xaa')](_0x52e4('0xa1'))[_0x52e4('0x4a')](_0x52e4('0x88'),_0x4bb51d[_0x52e4('0x60')]['id'][_0x52e4('0xa9')]())))[_0x52e4('0xa9')]();break;default:_0x43b4c0=squel[_0x52e4('0x9f')]()[_0x52e4('0xa0')](_0x52e4('0xa1'))[_0x52e4('0xa2')]([_0x52e4('0xa3'),_0x52e4('0xa4'),_0x52e4('0xa5'),_0x52e4('0xa6'),_0x52e4('0x63'),_0x52e4('0x5b'),'updatedAt'],squel[_0x52e4('0x81')]()[_0x52e4('0x82')](_0x52e4('0xa3'),_0x52e4('0xa3'))[_0x52e4('0x82')](_0x52e4('0xa7'),'scheduledAt')[_0x52e4('0x82')]('id','ContactId')[_0x52e4('0x82')](_0x192d55['CmListId'][_0x52e4('0xa9')](),_0x52e4('0xa6'))['field'](_0x4bb51d[_0x52e4('0x60')]['id'][_0x52e4('0xa9')](),'VoiceQueueId')[_0x52e4('0x82')](_0x52e4('0xa7'),_0x52e4('0x5b'))[_0x52e4('0x82')](_0x52e4('0xa7'),_0x52e4('0x5a'))['from']('cm_contacts')[_0x52e4('0x4a')](_0x52e4('0xac'))[_0x52e4('0x4a')](_0x52e4('0xad'),_0x192d55[_0x52e4('0xa8')][_0x52e4('0xa9')]())['where'](_0x52e4('0xae')))[_0x52e4('0xa9')]();}_0x25c677[_0x52e4('0x97')](db['sequelize'][_0x52e4('0x3d')](_0x43b4c0));}return BPromise[_0x52e4('0x8c')](_0x25c677);}})[_0x52e4('0x26')](function(){return _0x498bc6;})['then'](respondWithResult(_0x122897,null))[_0x52e4('0x4f')](handleError(_0x122897,null));};exports['removeLists']=function(_0x1e3706,_0x464825,_0x55d3a7){return db[_0x52e4('0x39')][_0x52e4('0x33')]({'where':{'id':_0x1e3706[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x464825,null))[_0x52e4('0x26')](function(_0x10ded3){if(_0x10ded3){return _0x10ded3[_0x52e4('0xb4')](_0x1e3706[_0x52e4('0x3d')][_0x52e4('0x80')]);}})[_0x52e4('0x26')](function(_0xb83436){if(_0xb83436){return db[_0x52e4('0x62')][_0x52e4('0x27')]({'where':{'ListId':_0x1e3706[_0x52e4('0x3d')]['ids'],'VoiceQueueId':_0x1e3706[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](function(){return _0xb83436;});}})[_0x52e4('0x26')](respondWithStatusCode(_0x464825,null))[_0x52e4('0x4f')](handleError(_0x464825,null));};exports['getBlackLists']=function(_0x45da7c,_0x3f79c3,_0x3a9572){var _0x3d2064={};var _0x5a1b7d={};var _0x11d1fa;var _0x223980;return db[_0x52e4('0x39')]['findOne']({'where':{'id':_0x45da7c[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x3f79c3,null))[_0x52e4('0x26')](function(_0x1d3f75){if(_0x1d3f75){_0x11d1fa=_0x1d3f75;_0x5a1b7d[_0x52e4('0x3c')]=_[_0x52e4('0x3e')](db['CmList'][_0x52e4('0x3a')]);_0x5a1b7d[_0x52e4('0x3d')]=_[_0x52e4('0x3e')](_0x45da7c[_0x52e4('0x3d')]);_0x5a1b7d[_0x52e4('0x3f')]=_['intersection'](_0x5a1b7d['model'],_0x5a1b7d[_0x52e4('0x3d')]);_0x3d2064[_0x52e4('0x41')]=_[_0x52e4('0x40')](_0x5a1b7d[_0x52e4('0x3c')],qs[_0x52e4('0x42')](_0x45da7c[_0x52e4('0x3d')][_0x52e4('0x42')]));_0x3d2064[_0x52e4('0x41')]=_0x3d2064['attributes'][_0x52e4('0x43')]?_0x3d2064[_0x52e4('0x41')]:_0x5a1b7d[_0x52e4('0x3c')];_0x3d2064[_0x52e4('0x46')]=qs['sort'](_0x45da7c[_0x52e4('0x3d')]['sort']);_0x3d2064[_0x52e4('0x4a')]=qs[_0x52e4('0x3f')](_[_0x52e4('0x48')](_0x45da7c[_0x52e4('0x3d')],_0x5a1b7d[_0x52e4('0x3f')]));if(_0x45da7c[_0x52e4('0x3d')][_0x52e4('0x2d')]){_0x3d2064[_0x52e4('0x4a')]=_[_0x52e4('0x49')](_0x3d2064[_0x52e4('0x4a')],{'$or':_[_0x52e4('0x2f')](_0x3d2064['attributes'],function(_0x4f5c62){var _0x54c61d={};_0x54c61d[_0x4f5c62]={'$like':'%'+_0x45da7c['query'][_0x52e4('0x2d')]+'%'};return _0x54c61d;})});}_0x3d2064=_[_0x52e4('0x49')]({},_0x3d2064,_0x45da7c[_0x52e4('0x4c')]);return _0x11d1fa[_0x52e4('0xb5')](_0x3d2064);}})['then'](function(_0x599478){if(_0x599478){_0x223980=_0x599478[_0x52e4('0x43')];if(!_0x45da7c[_0x52e4('0x3d')]['hasOwnProperty'](_0x52e4('0x45'))){_0x3d2064['limit']=qs[_0x52e4('0x20')](_0x45da7c['query']['limit']);_0x3d2064[_0x52e4('0x1f')]=qs['offset'](_0x45da7c['query'][_0x52e4('0x1f')]);}return _0x11d1fa[_0x52e4('0xb5')](_0x3d2064);}})[_0x52e4('0x26')](function(_0x334113){if(_0x334113){return _0x334113?{'count':_0x223980,'rows':_0x334113}:null;}})['then'](respondWithResult(_0x3f79c3,null))['catch'](handleError(_0x3f79c3,null));};exports['addBlackLists']=function(_0x1af876,_0x96b5ba,_0x430d3f){var _0x36b866,_0x375bea;return db[_0x52e4('0x39')]['find']({'where':{'id':_0x1af876[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x96b5ba,null))['then'](function(_0x4266ce){if(_0x4266ce){_0x375bea=_0x4266ce;return _0x4266ce[_0x52e4('0xb6')](_0x1af876[_0x52e4('0x52')][_0x52e4('0x80')],_[_0x52e4('0x59')](_0x1af876[_0x52e4('0x52')],['ids','id'])||{});}return null;})[_0x52e4('0x94')](function(_0x27ca79){var _0x1e734e;_0x36b866=_0x27ca79||[];var _0x42bfb4=[];if(_0x27ca79){for(var _0x53da11=0x0;_0x53da11<_0x27ca79['length'];_0x53da11+=0x1){var _0x2b384f=_0x27ca79[_0x53da11][_0x52e4('0x28')]({'plain':!![]});_0x1e734e=squel['insert']()['into'](_0x52e4('0xb7'))[_0x52e4('0xa2')]([_0x52e4('0xa3'),'ContactId',_0x52e4('0xa6'),'VoiceQueueId',_0x52e4('0x5b'),_0x52e4('0x5a')],squel['select']()['field'](_0x52e4('0xa3'),'phone')['field']('id',_0x52e4('0xa5'))[_0x52e4('0x82')](_0x2b384f[_0x52e4('0xa8')][_0x52e4('0xa9')](),_0x52e4('0xa6'))[_0x52e4('0x82')](_0x1af876['params']['id'][_0x52e4('0xa9')](),_0x52e4('0x63'))[_0x52e4('0x82')](_0x52e4('0xa7'),_0x52e4('0x5b'))['field']('NOW()','updatedAt')[_0x52e4('0xaa')](_0x52e4('0xab'))[_0x52e4('0x4a')]('deletedAt\x20IS\x20NULL')[_0x52e4('0x4a')]('ListId\x20=\x20?',_0x2b384f['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x52e4('0xa9')]();_0x42bfb4['push'](db[_0x52e4('0x75')][_0x52e4('0x3d')](_0x1e734e));}return BPromise['all'](_0x42bfb4);}})[_0x52e4('0x26')](function(){return _0x36b866;})['then'](respondWithResult(_0x96b5ba,null))['catch'](handleError(_0x96b5ba,null));};exports[_0x52e4('0xb8')]=function(_0x5dfd95,_0x13de49,_0xe184e4){return db[_0x52e4('0x39')][_0x52e4('0x33')]({'where':{'id':_0x5dfd95[_0x52e4('0x60')]['id']}})[_0x52e4('0x26')](handleEntityNotFound(_0x13de49,null))[_0x52e4('0x26')](function(_0x4626e4){if(_0x4626e4){return _0x4626e4[_0x52e4('0xb8')](_0x5dfd95[_0x52e4('0x3d')]['ids']);}})[_0x52e4('0x26')](function(_0xe77652){if(_0xe77652){return db['CmHopperBlack'][_0x52e4('0x27')]({'where':{'ListId':_0x5dfd95[_0x52e4('0x3d')][_0x52e4('0x80')],'VoiceQueueId':_0x5dfd95['params']['id']}})['then'](function(){return _0xe77652;});}})[_0x52e4('0x26')](respondWithStatusCode(_0x13de49,null))['catch'](handleError(_0x13de49,null));}; \ No newline at end of file +var _0x6a6d=['../../config/environment','../../config/license/util','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','includes','type','value','name','UserProfileResource','end','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','keys','query','filters','model','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','createdAt','updatedAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','findAll','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','forEach','penalty','sequelize','transaction','each','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','interface','userVoiceQueue:save','select','field','tq.TeamId','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','union','compact','ids','removeAgents','emit','userVoiceQueue:remove','addAgents','isEmpty','all','isArray','getAgents','getMembers','CmList','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_contacts','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','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'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x6a6d,0xa4));var _0xd6a6=function(_0x301bab,_0x322b6e){_0x301bab=_0x301bab-0x0;var _0x41eace=_0x6a6d[_0x301bab];return _0x41eace;};'use strict';var emlformat=require(_0xd6a6('0x0'));var rimraf=require(_0xd6a6('0x1'));var zipdir=require(_0xd6a6('0x2'));var jsonpatch=require(_0xd6a6('0x3'));var rp=require('request-promise');var moment=require(_0xd6a6('0x4'));var BPromise=require(_0xd6a6('0x5'));var Mustache=require(_0xd6a6('0x6'));var util=require('util');var path=require(_0xd6a6('0x7'));var sox=require(_0xd6a6('0x8'));var csv=require('to-csv');var ejs=require(_0xd6a6('0x9'));var fs=require('fs');var fs_extra=require(_0xd6a6('0xa'));var _=require(_0xd6a6('0xb'));var squel=require(_0xd6a6('0xc'));var crypto=require(_0xd6a6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6a6('0xe'));var Papa=require(_0xd6a6('0xf'));var Redis=require(_0xd6a6('0x10'));var authService=require(_0xd6a6('0x11'));var qs=require(_0xd6a6('0x12'));var as=require(_0xd6a6('0x13'));var hardwareService=require(_0xd6a6('0x14'));var logger=require(_0xd6a6('0x15'))(_0xd6a6('0x16'));var utils=require(_0xd6a6('0x17'));var config=require(_0xd6a6('0x18'));var licenseUtil=require(_0xd6a6('0x19'));var db=require('../../mysqldb')['db'];config[_0xd6a6('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd6a6('0x1b'))(new Redis(config[_0xd6a6('0x1a')]));require(_0xd6a6('0x1c'))[_0xd6a6('0x1d')](socket);function respondWithStatusCode(_0xb2fd15,_0x186153){_0x186153=_0x186153||0xcc;return function(_0xd007ca){if(_0xd007ca){return _0xb2fd15[_0xd6a6('0x1e')](_0x186153);}return _0xb2fd15['status'](_0x186153)['end']();};}function respondWithResult(_0x30f10d,_0x463fed){_0x463fed=_0x463fed||0xc8;return function(_0xb345){if(_0xb345){return _0x30f10d[_0xd6a6('0x1f')](_0x463fed)[_0xd6a6('0x20')](_0xb345);}};}function respondWithFilteredResult(_0x2a6d5f,_0x1569f0){return function(_0x4cd1ec){if(_0x4cd1ec){var _0x508cba=typeof _0x1569f0[_0xd6a6('0x21')]==='undefined'&&typeof _0x1569f0[_0xd6a6('0x22')]===_0xd6a6('0x23');var _0x487aec=_0x4cd1ec[_0xd6a6('0x24')];var _0x478ddb=_0x508cba?0x0:_0x1569f0[_0xd6a6('0x21')];var _0x2914bd=_0x508cba?_0x4cd1ec['count']:_0x1569f0[_0xd6a6('0x21')]+_0x1569f0[_0xd6a6('0x22')];var _0x419d1b;if(_0x2914bd>=_0x487aec){_0x2914bd=_0x487aec;_0x419d1b=0xc8;}else{_0x419d1b=0xce;}_0x2a6d5f[_0xd6a6('0x1f')](_0x419d1b);return _0x2a6d5f[_0xd6a6('0x25')](_0xd6a6('0x26'),_0x478ddb+'-'+_0x2914bd+'/'+_0x487aec)['json'](_0x4cd1ec);}return null;};}function patchUpdates(_0x4e871e){return function(_0x2bc864){try{jsonpatch[_0xd6a6('0x27')](_0x2bc864,_0x4e871e,!![]);}catch(_0x2fb394){return BPromise[_0xd6a6('0x28')](_0x2fb394);}return _0x2bc864[_0xd6a6('0x29')]();};}function saveUpdates(_0x35435c,_0x6d8842){return function(_0x3bf03){if(_0x3bf03){return _0x3bf03[_0xd6a6('0x2a')](_0x35435c)[_0xd6a6('0x2b')](function(_0x286004){return _0x286004;});}return null;};}function removeEntity(_0x18ace4,_0x500bfa){return function(_0x647e43){if(_0x647e43){return _0x647e43[_0xd6a6('0x2c')]()['then'](function(){var _0xe4fbcc=_0x647e43[_0xd6a6('0x2d')]({'plain':!![]});var _0x560a95=[{'name':_0xd6a6('0x2e'),'value':_0xd6a6('0x2f'),'ignore':![]},{'name':_0xd6a6('0x30'),'value':_0xd6a6('0x31'),'ignore':![]}];var _0x1ed01f=_(_0x560a95)[_0xd6a6('0x32')](_0xd6a6('0x33'))[_0xd6a6('0x34')]('value')['value']();if(_[_0xd6a6('0x35')](_0x1ed01f,_0xe4fbcc[_0xd6a6('0x36')])){return;}var _0x4a5c80=_['find'](_0x560a95,[_0xd6a6('0x37'),_0xe4fbcc['type']])[_0xd6a6('0x38')];return db[_0xd6a6('0x39')][_0xd6a6('0x2c')]({'where':{'type':_0x4a5c80,'resourceId':_0xe4fbcc['id']}})[_0xd6a6('0x2b')](function(){return _0x647e43;});})[_0xd6a6('0x2b')](function(){_0x18ace4[_0xd6a6('0x1f')](0xcc)[_0xd6a6('0x3a')]();});}};}function handleEntityNotFound(_0x579247,_0x560083){return function(_0x4ba143){if(!_0x4ba143){_0x579247[_0xd6a6('0x1e')](0x194);}return _0x4ba143;};}function handleError(_0x1b01b3,_0x1c036c){_0x1c036c=_0x1c036c||0x1f4;return function(_0x2403c8){logger['error'](_0x2403c8[_0xd6a6('0x3b')]);if(_0x2403c8['name']){delete _0x2403c8[_0xd6a6('0x38')];}_0x1b01b3[_0xd6a6('0x1f')](_0x1c036c)[_0xd6a6('0x3c')](_0x2403c8);};}exports[_0xd6a6('0x3d')]=function(_0x51e28a,_0x1ac66d){var _0x1dd768={},_0x988cc4={},_0x1569bd={'count':0x0,'rows':[]};var _0x105abc=_[_0xd6a6('0x34')](db[_0xd6a6('0x3e')][_0xd6a6('0x3f')],function(_0x389fab){return{'name':_0x389fab[_0xd6a6('0x40')],'type':_0x389fab[_0xd6a6('0x36')][_0xd6a6('0x41')]};});_0x988cc4['model']=_[_0xd6a6('0x34')](_0x105abc,'name');_0x988cc4['query']=_[_0xd6a6('0x42')](_0x51e28a[_0xd6a6('0x43')]);_0x988cc4[_0xd6a6('0x44')]=_['intersection'](_0x988cc4[_0xd6a6('0x45')],_0x988cc4['query']);_0x1dd768['attributes']=_[_0xd6a6('0x46')](_0x988cc4[_0xd6a6('0x45')],qs[_0xd6a6('0x47')](_0x51e28a['query'][_0xd6a6('0x47')]));_0x1dd768['attributes']=_0x1dd768[_0xd6a6('0x48')]['length']?_0x1dd768[_0xd6a6('0x48')]:_0x988cc4[_0xd6a6('0x45')];if(!_0x51e28a[_0xd6a6('0x43')]['hasOwnProperty'](_0xd6a6('0x49'))){_0x1dd768['limit']=qs[_0xd6a6('0x22')](_0x51e28a[_0xd6a6('0x43')][_0xd6a6('0x22')]);_0x1dd768[_0xd6a6('0x21')]=qs[_0xd6a6('0x21')](_0x51e28a[_0xd6a6('0x43')][_0xd6a6('0x21')]);}_0x1dd768[_0xd6a6('0x4a')]=qs['sort'](_0x51e28a['query'][_0xd6a6('0x4b')]);_0x1dd768[_0xd6a6('0x4c')]=qs[_0xd6a6('0x44')](_[_0xd6a6('0x4d')](_0x51e28a[_0xd6a6('0x43')],_0x988cc4[_0xd6a6('0x44')]),_0x105abc);if(_0x51e28a[_0xd6a6('0x43')][_0xd6a6('0x32')]){_0x1dd768[_0xd6a6('0x4c')]=_[_0xd6a6('0x4e')](_0x1dd768[_0xd6a6('0x4c')],{'$or':_['map'](_0x105abc,function(_0x41a84d){if(_0x41a84d[_0xd6a6('0x36')]!==_0xd6a6('0x4f')){var _0x740247={};_0x740247[_0x41a84d[_0xd6a6('0x38')]]={'$like':'%'+_0x51e28a[_0xd6a6('0x43')]['filter']+'%'};return _0x740247;}})});}_0x1dd768=_[_0xd6a6('0x4e')]({},_0x1dd768,_0x51e28a[_0xd6a6('0x50')]);var _0x235a12={'where':_0x1dd768[_0xd6a6('0x4c')]};return db[_0xd6a6('0x3e')]['count'](_0x235a12)[_0xd6a6('0x2b')](function(_0xaafe85){_0x1569bd[_0xd6a6('0x24')]=_0xaafe85;if(_0x51e28a[_0xd6a6('0x43')][_0xd6a6('0x51')]){_0x1dd768[_0xd6a6('0x52')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x1dd768);})[_0xd6a6('0x2b')](function(_0x1a25bc){_0x1569bd[_0xd6a6('0x53')]=_0x1a25bc;return _0x1569bd;})[_0xd6a6('0x2b')](respondWithFilteredResult(_0x1ac66d,_0x1dd768))[_0xd6a6('0x54')](handleError(_0x1ac66d,null));};exports[_0xd6a6('0x55')]=function(_0x5a20b4,_0x3cade0){var _0x532665={'raw':![],'where':{'id':_0x5a20b4[_0xd6a6('0x56')]['id']}},_0x2f9005={};_0x2f9005[_0xd6a6('0x45')]=_[_0xd6a6('0x42')](db['VoiceQueue'][_0xd6a6('0x3f')]);_0x2f9005[_0xd6a6('0x43')]=_[_0xd6a6('0x42')](_0x5a20b4[_0xd6a6('0x43')]);_0x2f9005[_0xd6a6('0x44')]=_[_0xd6a6('0x46')](_0x2f9005[_0xd6a6('0x45')],_0x2f9005[_0xd6a6('0x43')]);_0x532665['attributes']=_[_0xd6a6('0x46')](_0x2f9005[_0xd6a6('0x45')],qs['fields'](_0x5a20b4[_0xd6a6('0x43')][_0xd6a6('0x47')]));_0x532665[_0xd6a6('0x48')]=_0x532665[_0xd6a6('0x48')][_0xd6a6('0x57')]?_0x532665[_0xd6a6('0x48')]:_0x2f9005['model'];if(_0x5a20b4[_0xd6a6('0x43')]['includeAll']){_0x532665[_0xd6a6('0x52')]=[{'all':!![]}];}_0x532665=_['merge']({},_0x532665,_0x5a20b4[_0xd6a6('0x50')]);return db[_0xd6a6('0x3e')][_0xd6a6('0x58')](_0x532665)[_0xd6a6('0x2b')](handleEntityNotFound(_0x3cade0,null))[_0xd6a6('0x2b')](respondWithResult(_0x3cade0,null))['catch'](handleError(_0x3cade0,null));};exports[_0xd6a6('0x59')]=function(_0x24c197,_0x4ebe10){return db['VoiceQueue'][_0xd6a6('0x59')](_0x24c197[_0xd6a6('0x5a')],{})[_0xd6a6('0x2b')](function(_0x113cc1){var _0x53b135=_0x24c197[_0xd6a6('0x5b')][_0xd6a6('0x2d')]({'plain':!![]});if(!_0x53b135)throw new Error(_0xd6a6('0x5c'));if(_0x53b135[_0xd6a6('0x5d')]===_0xd6a6('0x5b')){var _0x31ec22=_0x113cc1['get']({'plain':!![]});var _0xda0272=[{'name':'VoiceQueues','value':_0xd6a6('0x2f')},{'name':_0xd6a6('0x30'),'value':'outbound'}];var _0x3f8e4d=_[_0xd6a6('0x58')](_0xda0272,[_0xd6a6('0x37'),_0x31ec22['type']])['name'];return db[_0xd6a6('0x5e')][_0xd6a6('0x58')]({'where':{'name':_0x3f8e4d,'userProfileId':_0x53b135[_0xd6a6('0x5f')]},'raw':!![]})['then'](function(_0x4dce1a){if(_0x4dce1a&&_0x4dce1a[_0xd6a6('0x60')]===0x0){return db[_0xd6a6('0x39')][_0xd6a6('0x59')]({'name':_0x31ec22[_0xd6a6('0x38')],'resourceId':_0x31ec22['id'],'type':_0x4dce1a['name'],'sectionId':_0x4dce1a['id']},{})['then'](function(){return _0x113cc1;});}else{return _0x113cc1;}})[_0xd6a6('0x54')](function(_0x59701b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59701b);throw _0x59701b;});}return _0x113cc1;})[_0xd6a6('0x2b')](respondWithResult(_0x4ebe10,0xc9))['catch'](handleError(_0x4ebe10,null));};exports['clone']=function(_0x306b30,_0x3d2c28){var _0x25485c={'where':{'id':_0x306b30[_0xd6a6('0x56')]['id']}},_0x4d751b={};_0x4d751b['model']=_[_0xd6a6('0x42')](db[_0xd6a6('0x3e')]['rawAttributes']);_0x25485c[_0xd6a6('0x48')]=_['intersection'](_0x4d751b[_0xd6a6('0x45')],qs[_0xd6a6('0x47')](_0x306b30['query'][_0xd6a6('0x47')]));_0x25485c[_0xd6a6('0x48')]=_0x25485c[_0xd6a6('0x48')]['length']?_0x25485c[_0xd6a6('0x48')]:_0x4d751b['model'];if(_0x306b30['query'][_0xd6a6('0x51')]){_0x25485c[_0xd6a6('0x52')]=[{'all':!![]}];}_0x25485c=_[_0xd6a6('0x4e')]({},_0x25485c,_0x306b30[_0xd6a6('0x50')]);return db[_0xd6a6('0x3e')][_0xd6a6('0x58')](_0x25485c)['then'](handleEntityNotFound(_0x3d2c28,null))[_0xd6a6('0x2b')](function(_0x3a7357){if(_0x3a7357){var _0xecbb9d=_0x3a7357[_0xd6a6('0x2d')]({'plain':!![]});_0xecbb9d=qs['omit'](_0xecbb9d,['id',_0xd6a6('0x61'),_0xd6a6('0x62')]);_0x306b30[_0xd6a6('0x5a')]=_[_0xd6a6('0x63')](_0x306b30[_0xd6a6('0x5a')],['id',_0xd6a6('0x61'),_0xd6a6('0x62')]);return db[_0xd6a6('0x3e')]['create'](_[_0xd6a6('0x4e')](_0xecbb9d,_0x306b30[_0xd6a6('0x5a')]),{'include':_0x306b30[_0xd6a6('0x43')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3ca3d8){var _0x107902=_0x306b30['user'][_0xd6a6('0x2d')]({'plain':!![]});if(!_0x107902)throw new Error(_0xd6a6('0x5c'));if(_0x107902[_0xd6a6('0x5d')]==='user'){var _0x1eaa62=_0x3ca3d8[_0xd6a6('0x2d')]({'plain':!![]});var _0x3428c9=[{'name':'VoiceQueues','value':_0xd6a6('0x2f')},{'name':'QueueCampaigns','value':_0xd6a6('0x31')}];var _0x2960e8=_[_0xd6a6('0x58')](_0x3428c9,[_0xd6a6('0x37'),_0x1eaa62['type']])['name'];return db[_0xd6a6('0x5e')]['find']({'where':{'name':_0x2960e8,'userProfileId':_0x107902[_0xd6a6('0x5f')]},'raw':!![]})[_0xd6a6('0x2b')](function(_0x48e8d6){if(_0x48e8d6&&_0x48e8d6[_0xd6a6('0x60')]===0x0){return db['UserProfileResource'][_0xd6a6('0x59')]({'name':_0x1eaa62[_0xd6a6('0x38')],'resourceId':_0x1eaa62['id'],'type':_0x48e8d6[_0xd6a6('0x38')],'sectionId':_0x48e8d6['id']},{})['then'](function(){return _0x3ca3d8;});}else{return _0x3ca3d8;}})[_0xd6a6('0x54')](function(_0x4f0346){logger['error'](_0xd6a6('0x64'),_0x4f0346);throw _0x4f0346;});}return _0x3ca3d8;});}})['then'](respondWithResult(_0x3d2c28,0xc9))[_0xd6a6('0x54')](handleError(_0x3d2c28,null));};exports[_0xd6a6('0x2a')]=function(_0x1d6a78,_0x4741ef){if(_0x1d6a78[_0xd6a6('0x5a')]['id']){delete _0x1d6a78[_0xd6a6('0x5a')]['id'];}return db[_0xd6a6('0x3e')][_0xd6a6('0x58')]({'where':{'id':_0x1d6a78['params']['id']}})['then'](handleEntityNotFound(_0x4741ef,null))['then'](saveUpdates(_0x1d6a78[_0xd6a6('0x5a')],null))[_0xd6a6('0x2b')](respondWithResult(_0x4741ef,null))[_0xd6a6('0x54')](handleError(_0x4741ef,null));};exports[_0xd6a6('0x2c')]=function(_0x3417c1,_0x5381d0){return db[_0xd6a6('0x3e')][_0xd6a6('0x58')]({'where':{'id':_0x3417c1[_0xd6a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x5381d0,null))[_0xd6a6('0x2b')](removeEntity(_0x5381d0,null))[_0xd6a6('0x54')](handleError(_0x5381d0,null));};exports[_0xd6a6('0x65')]=function(_0x53e747,_0x435d8b,_0x4540f6){var _0x24dc2f={'raw':![],'where':{}};var _0x2d1518={};var _0x21593c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd6a6('0x66')]({'where':{'id':_0x53e747[_0xd6a6('0x56')]['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0x435d8b,null))[_0xd6a6('0x2b')](function(_0x151f13){if(_0x151f13){_0x2d1518[_0xd6a6('0x45')]=_['keys'](db[_0xd6a6('0x67')][_0xd6a6('0x3f')]);_0x2d1518[_0xd6a6('0x43')]=_[_0xd6a6('0x42')](_0x53e747[_0xd6a6('0x43')]);_0x2d1518[_0xd6a6('0x44')]=_['intersection'](_0x2d1518['model'],_0x2d1518[_0xd6a6('0x43')]);_0x24dc2f['attributes']=_[_0xd6a6('0x46')](_0x2d1518[_0xd6a6('0x45')],qs[_0xd6a6('0x47')](_0x53e747[_0xd6a6('0x43')][_0xd6a6('0x47')]));_0x24dc2f[_0xd6a6('0x48')]=_0x24dc2f['attributes'][_0xd6a6('0x57')]?_0x24dc2f[_0xd6a6('0x48')]:_0x2d1518['model'];if(!_0x53e747['query']['hasOwnProperty'](_0xd6a6('0x49'))){_0x24dc2f[_0xd6a6('0x22')]=qs['limit'](_0x53e747[_0xd6a6('0x43')]['limit']);_0x24dc2f[_0xd6a6('0x21')]=qs[_0xd6a6('0x21')](_0x53e747['query']['offset']);}_0x24dc2f[_0xd6a6('0x4a')]=qs[_0xd6a6('0x4b')](_0x53e747[_0xd6a6('0x43')][_0xd6a6('0x4b')]);_0x24dc2f[_0xd6a6('0x4c')]=qs[_0xd6a6('0x44')](_[_0xd6a6('0x4d')](_0x53e747[_0xd6a6('0x43')],_0x2d1518[_0xd6a6('0x44')]));_0x24dc2f[_0xd6a6('0x4c')]['VoiceQueueId']=_0x151f13['id'];if(_0x53e747[_0xd6a6('0x43')][_0xd6a6('0x32')]){_0x24dc2f['where']=_['merge'](_0x24dc2f[_0xd6a6('0x4c')],{'$or':_[_0xd6a6('0x34')](_0x24dc2f[_0xd6a6('0x48')],function(_0x15df65){var _0x2911f8={};_0x2911f8[_0x15df65]={'$like':'%'+_0x53e747['query'][_0xd6a6('0x32')]+'%'};return _0x2911f8;})});}_0x24dc2f=_[_0xd6a6('0x4e')]({},_0x24dc2f,_0x53e747[_0xd6a6('0x50')]);return db[_0xd6a6('0x67')]['count']({'where':_0x24dc2f[_0xd6a6('0x4c')]})['then'](function(_0xb24b92){_0x21593c['count']=_0xb24b92;if(_0x53e747['query'][_0xd6a6('0x51')]){_0x24dc2f['include']=[{'all':!![]}];}return db['CmHopper'][_0xd6a6('0x68')](_0x24dc2f);})[_0xd6a6('0x2b')](function(_0x7cd4c){_0x21593c[_0xd6a6('0x53')]=_0x7cd4c;return _0x21593c;});}})[_0xd6a6('0x2b')](respondWithFilteredResult(_0x435d8b,_0x24dc2f))[_0xd6a6('0x54')](handleError(_0x435d8b,null));};exports['getHopperHistories']=function(_0x4e6685,_0x33e68a,_0x35222f){var _0x19cc65={'raw':!![],'where':{}};var _0x6ec606={};var _0x373004={'count':0x0,'rows':[]};return db[_0xd6a6('0x3e')][_0xd6a6('0x66')]({'where':{'id':_0x4e6685[_0xd6a6('0x56')]['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0x33e68a,null))[_0xd6a6('0x2b')](function(_0x5167f3){if(_0x5167f3){_0x6ec606[_0xd6a6('0x45')]=_['keys'](db[_0xd6a6('0x69')][_0xd6a6('0x3f')]);_0x6ec606[_0xd6a6('0x43')]=_['keys'](_0x4e6685[_0xd6a6('0x43')]);_0x6ec606['filters']=_['intersection'](_0x6ec606[_0xd6a6('0x45')],_0x6ec606[_0xd6a6('0x43')]);_0x19cc65[_0xd6a6('0x48')]=_[_0xd6a6('0x46')](_0x6ec606[_0xd6a6('0x45')],qs[_0xd6a6('0x47')](_0x4e6685[_0xd6a6('0x43')]['fields']));_0x19cc65[_0xd6a6('0x48')]=_0x19cc65['attributes'][_0xd6a6('0x57')]?_0x19cc65[_0xd6a6('0x48')]:_0x6ec606[_0xd6a6('0x45')];if(!_0x4e6685[_0xd6a6('0x43')][_0xd6a6('0x6a')](_0xd6a6('0x49'))){_0x19cc65[_0xd6a6('0x22')]=qs[_0xd6a6('0x22')](_0x4e6685[_0xd6a6('0x43')][_0xd6a6('0x22')]);_0x19cc65['offset']=qs[_0xd6a6('0x21')](_0x4e6685[_0xd6a6('0x43')][_0xd6a6('0x21')]);}_0x19cc65[_0xd6a6('0x4a')]=qs['sort'](_0x4e6685[_0xd6a6('0x43')][_0xd6a6('0x4b')]);_0x19cc65[_0xd6a6('0x4c')]=qs['filters'](_[_0xd6a6('0x4d')](_0x4e6685['query'],_0x6ec606[_0xd6a6('0x44')]));_0x19cc65['where'][_0xd6a6('0x6b')]=_0x5167f3['id'];if(_0x4e6685['query'][_0xd6a6('0x32')]){_0x19cc65[_0xd6a6('0x4c')]=_[_0xd6a6('0x4e')](_0x19cc65[_0xd6a6('0x4c')],{'$or':_[_0xd6a6('0x34')](_0x19cc65[_0xd6a6('0x48')],function(_0x437c2c){var _0x179f0e={};_0x179f0e[_0x437c2c]={'$like':'%'+_0x4e6685[_0xd6a6('0x43')]['filter']+'%'};return _0x179f0e;})});}_0x19cc65=_[_0xd6a6('0x4e')]({},_0x19cc65,_0x4e6685[_0xd6a6('0x50')]);return db[_0xd6a6('0x69')]['count']({'where':_0x19cc65[_0xd6a6('0x4c')]})['then'](function(_0x3ff3d3){_0x373004[_0xd6a6('0x24')]=_0x3ff3d3;if(_0x4e6685[_0xd6a6('0x43')][_0xd6a6('0x51')]){_0x19cc65['include']=[{'all':!![]}];}return db[_0xd6a6('0x69')][_0xd6a6('0x68')](_0x19cc65);})[_0xd6a6('0x2b')](function(_0x469469){_0x373004[_0xd6a6('0x53')]=_0x469469;return _0x373004;});}})[_0xd6a6('0x2b')](respondWithFilteredResult(_0x33e68a,_0x19cc65))[_0xd6a6('0x54')](handleError(_0x33e68a,null));};exports[_0xd6a6('0x6c')]=function(_0x1a5d0d,_0xd49b2a,_0x4317d0){var _0x546194={'raw':!![],'where':{}};var _0x397ed7={};var _0x566e8b={'count':0x0,'rows':[]};return db[_0xd6a6('0x3e')]['findOne']({'where':{'id':_0x1a5d0d[_0xd6a6('0x56')]['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0xd49b2a,null))[_0xd6a6('0x2b')](function(_0x3e7aac){if(_0x3e7aac){_0x397ed7[_0xd6a6('0x45')]=_[_0xd6a6('0x42')](db[_0xd6a6('0x6d')][_0xd6a6('0x3f')]);_0x397ed7[_0xd6a6('0x43')]=_[_0xd6a6('0x42')](_0x1a5d0d['query']);_0x397ed7['filters']=_[_0xd6a6('0x46')](_0x397ed7[_0xd6a6('0x45')],_0x397ed7[_0xd6a6('0x43')]);_0x546194[_0xd6a6('0x48')]=_[_0xd6a6('0x46')](_0x397ed7['model'],qs[_0xd6a6('0x47')](_0x1a5d0d[_0xd6a6('0x43')][_0xd6a6('0x47')]));_0x546194['attributes']=_0x546194[_0xd6a6('0x48')][_0xd6a6('0x57')]?_0x546194[_0xd6a6('0x48')]:_0x397ed7[_0xd6a6('0x45')];if(!_0x1a5d0d['query'][_0xd6a6('0x6a')](_0xd6a6('0x49'))){_0x546194['limit']=qs[_0xd6a6('0x22')](_0x1a5d0d[_0xd6a6('0x43')][_0xd6a6('0x22')]);_0x546194[_0xd6a6('0x21')]=qs[_0xd6a6('0x21')](_0x1a5d0d[_0xd6a6('0x43')][_0xd6a6('0x21')]);}_0x546194['order']=qs['sort'](_0x1a5d0d['query'][_0xd6a6('0x4b')]);_0x546194[_0xd6a6('0x4c')]=qs[_0xd6a6('0x44')](_[_0xd6a6('0x4d')](_0x1a5d0d[_0xd6a6('0x43')],_0x397ed7[_0xd6a6('0x44')]));_0x546194[_0xd6a6('0x4c')][_0xd6a6('0x6b')]=_0x3e7aac['id'];if(_0x1a5d0d[_0xd6a6('0x43')][_0xd6a6('0x32')]){_0x546194[_0xd6a6('0x4c')]=_[_0xd6a6('0x4e')](_0x546194[_0xd6a6('0x4c')],{'$or':_[_0xd6a6('0x34')](_0x546194[_0xd6a6('0x48')],function(_0x35e96e){var _0x5e93da={};_0x5e93da[_0x35e96e]={'$like':'%'+_0x1a5d0d[_0xd6a6('0x43')]['filter']+'%'};return _0x5e93da;})});}_0x546194=_['merge']({},_0x546194,_0x1a5d0d['options']);return db[_0xd6a6('0x6d')][_0xd6a6('0x24')]({'where':_0x546194[_0xd6a6('0x4c')]})['then'](function(_0x5908f7){_0x566e8b[_0xd6a6('0x24')]=_0x5908f7;if(_0x1a5d0d['query'][_0xd6a6('0x51')]){_0x546194[_0xd6a6('0x52')]=[{'all':!![]}];}return db[_0xd6a6('0x6d')]['findAll'](_0x546194);})[_0xd6a6('0x2b')](function(_0x93a9a0){_0x566e8b[_0xd6a6('0x53')]=_0x93a9a0;return _0x566e8b;});}})[_0xd6a6('0x2b')](respondWithFilteredResult(_0xd49b2a,_0x546194))[_0xd6a6('0x54')](handleError(_0xd49b2a,null));};exports['getHopperBlacks']=function(_0x2cc7f3,_0x517ab2,_0x5455c9){var _0x227f31={'raw':!![],'where':{}};var _0x50b8ab={};var _0x51e4bd={'count':0x0,'rows':[]};return db[_0xd6a6('0x3e')][_0xd6a6('0x66')]({'where':{'id':_0x2cc7f3[_0xd6a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x517ab2,null))[_0xd6a6('0x2b')](function(_0x452a4f){if(_0x452a4f){_0x50b8ab['model']=_[_0xd6a6('0x42')](db[_0xd6a6('0x6e')][_0xd6a6('0x3f')]);_0x50b8ab[_0xd6a6('0x43')]=_[_0xd6a6('0x42')](_0x2cc7f3['query']);_0x50b8ab[_0xd6a6('0x44')]=_[_0xd6a6('0x46')](_0x50b8ab[_0xd6a6('0x45')],_0x50b8ab[_0xd6a6('0x43')]);_0x227f31[_0xd6a6('0x48')]=_[_0xd6a6('0x46')](_0x50b8ab[_0xd6a6('0x45')],qs[_0xd6a6('0x47')](_0x2cc7f3[_0xd6a6('0x43')][_0xd6a6('0x47')]));_0x227f31[_0xd6a6('0x48')]=_0x227f31[_0xd6a6('0x48')][_0xd6a6('0x57')]?_0x227f31[_0xd6a6('0x48')]:_0x50b8ab[_0xd6a6('0x45')];if(!_0x2cc7f3['query'][_0xd6a6('0x6a')]('nolimit')){_0x227f31[_0xd6a6('0x22')]=qs[_0xd6a6('0x22')](_0x2cc7f3[_0xd6a6('0x43')][_0xd6a6('0x22')]);_0x227f31['offset']=qs[_0xd6a6('0x21')](_0x2cc7f3[_0xd6a6('0x43')][_0xd6a6('0x21')]);}_0x227f31[_0xd6a6('0x4a')]=qs[_0xd6a6('0x4b')](_0x2cc7f3[_0xd6a6('0x43')][_0xd6a6('0x4b')]);_0x227f31[_0xd6a6('0x4c')]=qs[_0xd6a6('0x44')](_[_0xd6a6('0x4d')](_0x2cc7f3[_0xd6a6('0x43')],_0x50b8ab[_0xd6a6('0x44')]));_0x227f31[_0xd6a6('0x4c')]['VoiceQueueId']=_0x452a4f['id'];if(_0x2cc7f3[_0xd6a6('0x43')]['filter']){_0x227f31['where']=_[_0xd6a6('0x4e')](_0x227f31[_0xd6a6('0x4c')],{'$or':_['map'](_0x227f31[_0xd6a6('0x48')],function(_0x5b1771){var _0x99778d={};_0x99778d[_0x5b1771]={'$like':'%'+_0x2cc7f3['query'][_0xd6a6('0x32')]+'%'};return _0x99778d;})});}_0x227f31=_[_0xd6a6('0x4e')]({},_0x227f31,_0x2cc7f3['options']);return db[_0xd6a6('0x6e')][_0xd6a6('0x24')]({'where':_0x227f31[_0xd6a6('0x4c')]})[_0xd6a6('0x2b')](function(_0x26e698){_0x51e4bd[_0xd6a6('0x24')]=_0x26e698;if(_0x2cc7f3[_0xd6a6('0x43')][_0xd6a6('0x51')]){_0x227f31[_0xd6a6('0x52')]=[{'all':!![]}];}return db[_0xd6a6('0x6e')][_0xd6a6('0x68')](_0x227f31);})[_0xd6a6('0x2b')](function(_0x30f135){_0x51e4bd[_0xd6a6('0x53')]=_0x30f135;return _0x51e4bd;});}})[_0xd6a6('0x2b')](respondWithFilteredResult(_0x517ab2,_0x227f31))['catch'](handleError(_0x517ab2,null));};exports[_0xd6a6('0x6f')]=function(_0x5bd152,_0x24cc4f,_0x3faa6a){var _0x3d50d6={};var _0x1bbdc3={};var _0x5e15b9;var _0x4f81ee;return db['VoiceQueue'][_0xd6a6('0x66')]({'where':{'id':_0x5bd152[_0xd6a6('0x56')]['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0x24cc4f,null))[_0xd6a6('0x2b')](function(_0x59ef01){if(_0x59ef01){_0x5e15b9=_0x59ef01;_0x1bbdc3[_0xd6a6('0x45')]=_[_0xd6a6('0x42')](db[_0xd6a6('0x70')]['rawAttributes']);_0x1bbdc3['query']=_[_0xd6a6('0x42')](_0x5bd152['query']);_0x1bbdc3[_0xd6a6('0x44')]=_['intersection'](_0x1bbdc3[_0xd6a6('0x45')],_0x1bbdc3[_0xd6a6('0x43')]);_0x3d50d6['attributes']=_[_0xd6a6('0x46')](_0x1bbdc3[_0xd6a6('0x45')],qs[_0xd6a6('0x47')](_0x5bd152[_0xd6a6('0x43')][_0xd6a6('0x47')]));_0x3d50d6[_0xd6a6('0x48')]=_0x3d50d6[_0xd6a6('0x48')][_0xd6a6('0x57')]?_0x3d50d6[_0xd6a6('0x48')]:_0x1bbdc3[_0xd6a6('0x45')];_0x3d50d6[_0xd6a6('0x4a')]=qs[_0xd6a6('0x4b')](_0x5bd152[_0xd6a6('0x43')][_0xd6a6('0x4b')]);_0x3d50d6[_0xd6a6('0x4c')]=qs[_0xd6a6('0x44')](_[_0xd6a6('0x4d')](_0x5bd152[_0xd6a6('0x43')],_0x1bbdc3[_0xd6a6('0x44')]));if(_0x5bd152[_0xd6a6('0x43')]['filter']){_0x3d50d6[_0xd6a6('0x4c')]=_[_0xd6a6('0x4e')](_0x3d50d6[_0xd6a6('0x4c')],{'$or':_[_0xd6a6('0x34')](_0x3d50d6[_0xd6a6('0x48')],function(_0x1cf382){var _0x2ec65e={};_0x2ec65e[_0x1cf382]={'$like':'%'+_0x5bd152[_0xd6a6('0x43')][_0xd6a6('0x32')]+'%'};return _0x2ec65e;})});}_0x3d50d6=_[_0xd6a6('0x4e')]({},_0x3d50d6,_0x5bd152[_0xd6a6('0x50')]);return _0x5e15b9[_0xd6a6('0x6f')](_0x3d50d6);}})[_0xd6a6('0x2b')](function(_0x204dff){if(_0x204dff){_0x4f81ee=_0x204dff[_0xd6a6('0x57')];if(!_0x5bd152['query'][_0xd6a6('0x6a')](_0xd6a6('0x49'))){_0x3d50d6['limit']=qs[_0xd6a6('0x22')](_0x5bd152[_0xd6a6('0x43')][_0xd6a6('0x22')]);_0x3d50d6[_0xd6a6('0x21')]=qs['offset'](_0x5bd152[_0xd6a6('0x43')][_0xd6a6('0x21')]);}return _0x5e15b9[_0xd6a6('0x6f')](_0x3d50d6);}})[_0xd6a6('0x2b')](function(_0x166b9c){if(_0x166b9c){return _0x166b9c?{'count':_0x4f81ee,'rows':_0x166b9c}:null;}})[_0xd6a6('0x2b')](respondWithResult(_0x24cc4f,null))[_0xd6a6('0x54')](handleError(_0x24cc4f,null));};exports[_0xd6a6('0x71')]=function(_0x263a5c,_0xea9d3d,_0x3f9eeb){var _0x359ddf=_0x263a5c[_0xd6a6('0x5a')][_0xd6a6('0x72')];var _0x4ceff1=_['map'](_0x359ddf,'id');return db[_0xd6a6('0x70')][_0xd6a6('0x68')]({'where':{'id':_0x4ceff1},'attributes':['id'],'include':[{'model':db[_0xd6a6('0x73')],'as':_0xd6a6('0x74'),'attributes':['id','name',_0xd6a6('0x75'),_0xd6a6('0x76'),'interface'],'raw':!![]}]})['then'](function(_0x102137){if(_0x102137){var _0x5e5e34=_['flatMap'](_0x102137,function(_0x39c9d6){var _0x590624=_0x39c9d6['get']({'plain':!![]});_0x590624[_0xd6a6('0x74')][_0xd6a6('0x77')](function(_0x29b0ba){_0x29b0ba['penalty']=_[_0xd6a6('0x58')](_0x359ddf,{'id':_0x590624['id']})[_0xd6a6('0x78')];});return _0x590624[_0xd6a6('0x74')];});return db[_0xd6a6('0x3e')][_0xd6a6('0x58')]({'where':{'id':_0x263a5c[_0xd6a6('0x56')]['id']}})[_0xd6a6('0x2b')](function(_0x19ae9b){return db[_0xd6a6('0x79')][_0xd6a6('0x7a')](function(_0x4f4a03){return _0x19ae9b[_0xd6a6('0x71')](_0x4ceff1,{'transaction':_0x4f4a03})[_0xd6a6('0x2b')](function(){return BPromise[_0xd6a6('0x7b')](_0x359ddf,function(_0x359f8b){return db['TeamVoiceQueue'][_0xd6a6('0x7c')]({'TeamId':_0x359f8b['id'],'VoiceQueueId':_0x263a5c[_0xd6a6('0x56')]['id'],'penalty':_0x359f8b['penalty']},{'transaction':_0x4f4a03});});})[_0xd6a6('0x2b')](function(){return BPromise[_0xd6a6('0x7b')](_0x5e5e34,function(_0x381243){return db['UserVoiceQueue'][_0xd6a6('0x7d')]({'where':{'UserId':_0x381243['id'],'VoiceQueueId':_0x263a5c[_0xd6a6('0x56')]['id']},'defaults':{'penalty':_0x381243[_0xd6a6('0x78')]},'transaction':_0x4f4a03});});})[_0xd6a6('0x2b')](function(){return BPromise['each'](_[_0xd6a6('0x32')](_0x5e5e34,{'online':!![]}),function(_0x281d43){return db[_0xd6a6('0x7e')]['upsert']({'membername':_0x281d43[_0xd6a6('0x38')],'UserId':_0x281d43['id'],'queue_name':_0x19ae9b[_0xd6a6('0x38')],'VoiceQueueId':_0x19ae9b['id'],'interface':_[_0xd6a6('0x7f')](_0x281d43['interface'])?util[_0xd6a6('0x80')](_0xd6a6('0x81'),_0x281d43[_0xd6a6('0x38')]):_0x281d43[_0xd6a6('0x82')],'paused':_0x281d43[_0xd6a6('0x76')]||![],'penalty':_0x281d43['penalty']},{'transaction':_0x4f4a03});});})[_0xd6a6('0x2b')](function(){_0x5e5e34['forEach'](function(_0x516b33){socket['emit'](_0xd6a6('0x83'),{'UserId':_0x516b33['id'],'VoiceQueueId':_0x19ae9b['id']});});});});});}})[_0xd6a6('0x2b')](respondWithStatusCode(_0xea9d3d,null))['catch'](handleError(_0xea9d3d,null));};exports['removeTeams']=function(_0x5aa41f,_0x277b61,_0x1f53dc){return db[_0xd6a6('0x70')][_0xd6a6('0x68')]({'where':{'id':_0x5aa41f[_0xd6a6('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd6a6('0x73')],'as':_0xd6a6('0x74'),'attributes':['id'],'raw':!![]}]})[_0xd6a6('0x2b')](handleEntityNotFound(_0x277b61,null))['then'](function(_0x43fe0e){var _0x5d35fe=_[_0xd6a6('0x34')](_0x43fe0e,'id');var _0x35637f=[];var _0x3a0a2f=[];var _0x83512f=squel[_0xd6a6('0x84')]();_0x83512f[_0xd6a6('0x85')](_0xd6a6('0x86'))['from'](_0xd6a6('0x87'),'tq')[_0xd6a6('0x88')]('user_has_teams','ut',_0xd6a6('0x89'))[_0xd6a6('0x4c')](_0xd6a6('0x8a'),_0x5aa41f[_0xd6a6('0x56')]['id']);for(var _0x37fe4a=0x0;_0x37fe4a<_0x43fe0e[_0xd6a6('0x57')];_0x37fe4a+=0x1){let _0x358370=_0x43fe0e[_0x37fe4a];for(var _0x2a3325=0x0;_0x2a3325<_0x358370[_0xd6a6('0x74')][_0xd6a6('0x57')];_0x2a3325+=0x1){let _0x2317c3=_0x358370[_0xd6a6('0x74')][_0x2a3325];var _0x1dba8d=_0x83512f[_0xd6a6('0x8b')]();_0x1dba8d[_0xd6a6('0x4c')](_0xd6a6('0x8c'),_0x2317c3['id']);_0x3a0a2f[_0xd6a6('0x8d')](db['sequelize'][_0xd6a6('0x43')](_0x1dba8d[_0xd6a6('0x8e')](),{'type':db['sequelize'][_0xd6a6('0x8f')][_0xd6a6('0x90')]})[_0xd6a6('0x2b')](function(_0x40beb1){if(_0x40beb1[_0xd6a6('0x57')]===0x1){return _0x2317c3['id'];}else{var _0x3c54f8=_['every'](_[_0xd6a6('0x34')](_0x40beb1,_0xd6a6('0x91')),function(_0x1f9d79){return _[_0xd6a6('0x35')](_0x5d35fe,_0x1f9d79);});if(_0x3c54f8){return _0x2317c3['id'];}}}));}}return BPromise['all'](_0x3a0a2f)[_0xd6a6('0x2b')](function(_0x4d10a9){_0x35637f=_(_0x35637f)[_0xd6a6('0x92')](_0x4d10a9)[_0xd6a6('0x93')]()[_0xd6a6('0x37')]();return db[_0xd6a6('0x3e')]['find']({'where':{'id':_0x5aa41f['params']['id']}})['then'](function(_0x18d60f){return db[_0xd6a6('0x79')][_0xd6a6('0x7a')](function(_0x16ff9e){return _0x18d60f['removeTeams'](_0x5aa41f['query'][_0xd6a6('0x94')],{'transaction':_0x16ff9e})[_0xd6a6('0x2b')](function(){if(!_['isEmpty'](_0x35637f)){return _0x18d60f[_0xd6a6('0x95')](_0x35637f,{'transaction':_0x16ff9e})[_0xd6a6('0x2b')](function(){return db[_0xd6a6('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x5aa41f[_0xd6a6('0x56')]['id'],'UserId':_0x35637f},'transaction':_0x16ff9e});});}})['then'](function(){_0x35637f[_0xd6a6('0x77')](function(_0x3ae668){socket[_0xd6a6('0x96')](_0xd6a6('0x97'),{'UserId':_0x3ae668,'VoiceQueueId':_0x18d60f['id']});});});});});});})['then'](respondWithStatusCode(_0x277b61,null))[_0xd6a6('0x54')](handleError(_0x277b61,null));};exports[_0xd6a6('0x98')]=function(_0x2d9051,_0x5e337a,_0x1e958d){var _0x12202b,_0x2a6d38;return db['VoiceQueue'][_0xd6a6('0x58')]({'where':{'id':_0x2d9051['params']['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0x5e337a,null))[_0xd6a6('0x2b')](function(_0x520cb8){if(_0x520cb8){_0x2a6d38=_0x520cb8;return _0x520cb8[_0xd6a6('0x98')](_0x2d9051[_0xd6a6('0x5a')][_0xd6a6('0x94')],_[_0xd6a6('0x63')](_0x2d9051[_0xd6a6('0x5a')],[_0xd6a6('0x94'),'id'])||{})['spread'](function(_0x329c21){for(var _0x1082bf=0x0;_0x1082bf<_0x2d9051[_0xd6a6('0x5a')][_0xd6a6('0x94')][_0xd6a6('0x57')];_0x1082bf+=0x1){socket['emit'](_0xd6a6('0x83'),{'UserId':Number(_0x2d9051['body'][_0xd6a6('0x94')][_0x1082bf]),'VoiceQueueId':Number(_0x2d9051[_0xd6a6('0x56')]['id'])});}return _0x329c21;});}})[_0xd6a6('0x2b')](function(_0xfd5db0){_0x12202b=_0xfd5db0||[];if(_0x2a6d38){return db['User']['findAll']({'where':{'id':_0x2d9051[_0xd6a6('0x5a')][_0xd6a6('0x94')]},'attributes':['id',_0xd6a6('0x38'),_0xd6a6('0x75'),_0xd6a6('0x76'),'interface'],'raw':!![]});}})[_0xd6a6('0x2b')](function(_0x377bb3){if(!_[_0xd6a6('0x99')](_0x377bb3)){var _0x186347=[];for(var _0xe8993e=0x0;_0xe8993e<_0x377bb3[_0xd6a6('0x57')];_0xe8993e++){if(_0x377bb3[_0xe8993e][_0xd6a6('0x75')]){_0x186347[_0xd6a6('0x8d')](db[_0xd6a6('0x7e')]['upsert']({'membername':_0x377bb3[_0xe8993e][_0xd6a6('0x38')],'UserId':_0x377bb3[_0xe8993e]['id'],'queue_name':_0x2a6d38[_0xd6a6('0x38')],'VoiceQueueId':_0x2a6d38['id'],'interface':_['isNil'](_0x377bb3[_0xe8993e][_0xd6a6('0x82')])?util['format'](_0xd6a6('0x81'),_0x377bb3[_0xe8993e]['name']):_0x377bb3[_0xe8993e][_0xd6a6('0x82')],'paused':_0x377bb3[_0xe8993e][_0xd6a6('0x76')]||![],'penalty':_0x2d9051[_0xd6a6('0x5a')][_0xd6a6('0x78')]||0x0}));}}return BPromise[_0xd6a6('0x9a')](_0x186347);}})[_0xd6a6('0x2b')](function(){return _0x12202b;})[_0xd6a6('0x2b')](respondWithResult(_0x5e337a,null))[_0xd6a6('0x54')](handleError(_0x5e337a,null));};exports['removeAgents']=function(_0x442796,_0x38983a,_0x312a8b){return db['VoiceQueue']['find']({'where':{'id':_0x442796[_0xd6a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x38983a,null))[_0xd6a6('0x2b')](function(_0x1d59a9){if(_0x1d59a9){return _0x1d59a9[_0xd6a6('0x95')](_0x442796[_0xd6a6('0x43')][_0xd6a6('0x94')])[_0xd6a6('0x2b')](function(){if(_[_0xd6a6('0x9b')](_0x442796[_0xd6a6('0x43')][_0xd6a6('0x94')])){for(var _0x149e05=0x0;_0x149e05<_0x442796[_0xd6a6('0x43')]['ids'][_0xd6a6('0x57')];_0x149e05+=0x1){socket[_0xd6a6('0x96')](_0xd6a6('0x97'),{'UserId':Number(_0x442796[_0xd6a6('0x43')][_0xd6a6('0x94')][_0x149e05]),'VoiceQueueId':Number(_0x442796[_0xd6a6('0x56')]['id'])});}}else{socket[_0xd6a6('0x96')](_0xd6a6('0x97'),{'UserId':Number(_0x442796[_0xd6a6('0x43')][_0xd6a6('0x94')]),'VoiceQueueId':Number(_0x442796[_0xd6a6('0x56')]['id'])});}});}})[_0xd6a6('0x2b')](function(_0x560391){return db[_0xd6a6('0x7e')][_0xd6a6('0x2c')]({'where':{'VoiceQueueId':_0x442796[_0xd6a6('0x56')]['id'],'UserId':_0x442796['query'][_0xd6a6('0x94')]}})[_0xd6a6('0x2b')](function(){return _0x560391;});})[_0xd6a6('0x2b')](respondWithStatusCode(_0x38983a,null))[_0xd6a6('0x54')](handleError(_0x38983a,null));};exports['getAgents']=function(_0x23d054,_0x483ed1,_0xe712fb){var _0x4ce356={};var _0x5f0f42={};var _0x413f2e;var _0x188b58;return db[_0xd6a6('0x3e')][_0xd6a6('0x66')]({'where':{'id':_0x23d054[_0xd6a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x483ed1,null))['then'](function(_0x55724a){if(_0x55724a){_0x413f2e=_0x55724a;_0x5f0f42['model']=_['keys'](db[_0xd6a6('0x73')][_0xd6a6('0x3f')]);_0x5f0f42[_0xd6a6('0x43')]=_[_0xd6a6('0x42')](_0x23d054[_0xd6a6('0x43')]);_0x5f0f42[_0xd6a6('0x44')]=_[_0xd6a6('0x46')](_0x5f0f42['model'],_0x5f0f42[_0xd6a6('0x43')]);_0x4ce356[_0xd6a6('0x48')]=_[_0xd6a6('0x46')](_0x5f0f42[_0xd6a6('0x45')],qs[_0xd6a6('0x47')](_0x23d054[_0xd6a6('0x43')][_0xd6a6('0x47')]));_0x4ce356['attributes']=_0x4ce356[_0xd6a6('0x48')][_0xd6a6('0x57')]?_0x4ce356[_0xd6a6('0x48')]:_0x5f0f42[_0xd6a6('0x45')];_0x4ce356[_0xd6a6('0x4a')]=qs[_0xd6a6('0x4b')](_0x23d054[_0xd6a6('0x43')]['sort']);_0x4ce356[_0xd6a6('0x4c')]=qs[_0xd6a6('0x44')](_['pick'](_0x23d054[_0xd6a6('0x43')],_0x5f0f42[_0xd6a6('0x44')]));if(_0x23d054['query'][_0xd6a6('0x32')]){_0x4ce356[_0xd6a6('0x4c')]=_[_0xd6a6('0x4e')](_0x4ce356['where'],{'$or':_[_0xd6a6('0x34')](_0x4ce356[_0xd6a6('0x48')],function(_0x59bf6a){var _0x44921c={};_0x44921c[_0x59bf6a]={'$like':'%'+_0x23d054[_0xd6a6('0x43')]['filter']+'%'};return _0x44921c;})});}_0x4ce356=_[_0xd6a6('0x4e')]({},_0x4ce356,_0x23d054[_0xd6a6('0x50')]);return _0x413f2e[_0xd6a6('0x9c')](_0x4ce356);}})[_0xd6a6('0x2b')](function(_0xefd141){if(_0xefd141){_0x188b58=_0xefd141[_0xd6a6('0x57')];if(!_0x23d054[_0xd6a6('0x43')][_0xd6a6('0x6a')](_0xd6a6('0x49'))){_0x4ce356[_0xd6a6('0x22')]=qs['limit'](_0x23d054[_0xd6a6('0x43')][_0xd6a6('0x22')]);_0x4ce356[_0xd6a6('0x21')]=qs[_0xd6a6('0x21')](_0x23d054[_0xd6a6('0x43')][_0xd6a6('0x21')]);}return _0x413f2e[_0xd6a6('0x9c')](_0x4ce356);}})[_0xd6a6('0x2b')](function(_0x5aac42){if(_0x5aac42){return _0x5aac42?{'count':_0x188b58,'rows':_0x5aac42}:null;}})[_0xd6a6('0x2b')](respondWithResult(_0x483ed1,null))[_0xd6a6('0x54')](handleError(_0x483ed1,null));};exports[_0xd6a6('0x9d')]=function(_0x4f211f,_0x1d1b2f,_0x15d7dd){var _0x271da0={};var _0x4b2702={};var _0x2f5394;var _0x4d1174;return db[_0xd6a6('0x3e')]['findOne']({'where':{'id':_0x4f211f['params']['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0x1d1b2f,null))['then'](function(_0x54249d){if(_0x54249d){_0x2f5394=_0x54249d;_0x4b2702[_0xd6a6('0x45')]=_[_0xd6a6('0x42')](db[_0xd6a6('0x7e')][_0xd6a6('0x3f')]);_0x4b2702[_0xd6a6('0x43')]=_['keys'](_0x4f211f[_0xd6a6('0x43')]);_0x4b2702[_0xd6a6('0x44')]=_[_0xd6a6('0x46')](_0x4b2702[_0xd6a6('0x45')],_0x4b2702['query']);_0x271da0[_0xd6a6('0x48')]=_['intersection'](_0x4b2702[_0xd6a6('0x45')],qs[_0xd6a6('0x47')](_0x4f211f[_0xd6a6('0x43')][_0xd6a6('0x47')]));_0x271da0[_0xd6a6('0x48')]=_0x271da0[_0xd6a6('0x48')]['length']?_0x271da0[_0xd6a6('0x48')]:_0x4b2702[_0xd6a6('0x45')];_0x271da0['order']=qs[_0xd6a6('0x4b')](_0x4f211f['query']['sort']);_0x271da0[_0xd6a6('0x4c')]=qs['filters'](_[_0xd6a6('0x4d')](_0x4f211f[_0xd6a6('0x43')],_0x4b2702[_0xd6a6('0x44')]));if(_0x4f211f[_0xd6a6('0x43')][_0xd6a6('0x32')]){_0x271da0[_0xd6a6('0x4c')]=_['merge'](_0x271da0[_0xd6a6('0x4c')],{'$or':_['map'](_0x271da0[_0xd6a6('0x48')],function(_0x63011f){var _0x3c148d={};_0x3c148d[_0x63011f]={'$like':'%'+_0x4f211f['query'][_0xd6a6('0x32')]+'%'};return _0x3c148d;})});}_0x271da0=_[_0xd6a6('0x4e')]({},_0x271da0,_0x4f211f[_0xd6a6('0x50')]);return _0x2f5394[_0xd6a6('0x9d')](_0x271da0);}})[_0xd6a6('0x2b')](function(_0x200e9e){if(_0x200e9e){_0x4d1174=_0x200e9e[_0xd6a6('0x57')];if(!_0x4f211f[_0xd6a6('0x43')]['hasOwnProperty'](_0xd6a6('0x49'))){_0x271da0[_0xd6a6('0x22')]=qs[_0xd6a6('0x22')](_0x4f211f[_0xd6a6('0x43')][_0xd6a6('0x22')]);_0x271da0[_0xd6a6('0x21')]=qs[_0xd6a6('0x21')](_0x4f211f[_0xd6a6('0x43')][_0xd6a6('0x21')]);}return _0x2f5394['getMembers'](_0x271da0);}})[_0xd6a6('0x2b')](function(_0x5a2a63){return _0x5a2a63?{'count':_0x4d1174,'rows':_0x5a2a63}:null;})[_0xd6a6('0x2b')](respondWithResult(_0x1d1b2f,null))['catch'](handleError(_0x1d1b2f,null));};exports['getLists']=function(_0x563fd5,_0x121021,_0x2eb3d7){var _0x54e818={};var _0x1f9a8f={};var _0x4aa34f;var _0x1f21e4;return db[_0xd6a6('0x3e')]['findOne']({'where':{'id':_0x563fd5[_0xd6a6('0x56')]['id']}})['then'](handleEntityNotFound(_0x121021,null))[_0xd6a6('0x2b')](function(_0x230554){if(_0x230554){_0x4aa34f=_0x230554;_0x1f9a8f['model']=_[_0xd6a6('0x42')](db[_0xd6a6('0x9e')][_0xd6a6('0x3f')]);_0x1f9a8f[_0xd6a6('0x43')]=_[_0xd6a6('0x42')](_0x563fd5[_0xd6a6('0x43')]);_0x1f9a8f[_0xd6a6('0x44')]=_[_0xd6a6('0x46')](_0x1f9a8f[_0xd6a6('0x45')],_0x1f9a8f[_0xd6a6('0x43')]);_0x54e818[_0xd6a6('0x48')]=_['intersection'](_0x1f9a8f[_0xd6a6('0x45')],qs[_0xd6a6('0x47')](_0x563fd5[_0xd6a6('0x43')][_0xd6a6('0x47')]));_0x54e818[_0xd6a6('0x48')]=_0x54e818[_0xd6a6('0x48')]['length']?_0x54e818[_0xd6a6('0x48')]:_0x1f9a8f['model'];_0x54e818[_0xd6a6('0x4a')]=qs[_0xd6a6('0x4b')](_0x563fd5[_0xd6a6('0x43')][_0xd6a6('0x4b')]);_0x54e818[_0xd6a6('0x4c')]=qs['filters'](_['pick'](_0x563fd5['query'],_0x1f9a8f[_0xd6a6('0x44')]));if(_0x563fd5[_0xd6a6('0x43')][_0xd6a6('0x32')]){_0x54e818[_0xd6a6('0x4c')]=_['merge'](_0x54e818[_0xd6a6('0x4c')],{'$or':_[_0xd6a6('0x34')](_0x54e818['attributes'],function(_0x22b7b3){var _0x411751={};_0x411751[_0x22b7b3]={'$like':'%'+_0x563fd5[_0xd6a6('0x43')]['filter']+'%'};return _0x411751;})});}_0x54e818=_['merge']({},_0x54e818,_0x563fd5[_0xd6a6('0x50')]);return _0x4aa34f[_0xd6a6('0x9f')](_0x54e818);}})[_0xd6a6('0x2b')](function(_0x434a77){if(_0x434a77){_0x1f21e4=_0x434a77[_0xd6a6('0x57')];if(!_0x563fd5[_0xd6a6('0x43')][_0xd6a6('0x6a')]('nolimit')){_0x54e818['limit']=qs[_0xd6a6('0x22')](_0x563fd5[_0xd6a6('0x43')]['limit']);_0x54e818[_0xd6a6('0x21')]=qs[_0xd6a6('0x21')](_0x563fd5[_0xd6a6('0x43')][_0xd6a6('0x21')]);}return _0x4aa34f['getLists'](_0x54e818);}})[_0xd6a6('0x2b')](function(_0x193f5c){if(_0x193f5c){return _0x193f5c?{'count':_0x1f21e4,'rows':_0x193f5c}:null;}})['then'](respondWithResult(_0x121021,null))[_0xd6a6('0x54')](handleError(_0x121021,null));};exports[_0xd6a6('0xa0')]=function(_0x4ac6b1,_0x4825d3,_0x1008fa){var _0x418fa0,_0x53764b;return db['VoiceQueue'][_0xd6a6('0x58')]({'where':{'id':_0x4ac6b1['params']['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0x4825d3,null))['then'](function(_0x1ae8c3){if(_0x1ae8c3){_0x53764b=_0x1ae8c3;return _0x1ae8c3['addLists'](_0x4ac6b1[_0xd6a6('0x5a')]['ids'],_[_0xd6a6('0x63')](_0x4ac6b1[_0xd6a6('0x5a')],[_0xd6a6('0x94'),'id'])||{});}return null;})[_0xd6a6('0xa1')](function(_0x192527){var _0x1e4a4f;_0x418fa0=_0x192527||[];var _0x524342=[];if(_0x192527){for(var _0x1901d7=0x0;_0x1901d7<_0x192527['length'];_0x1901d7+=0x1){var _0x498f0f=_0x192527[_0x1901d7][_0xd6a6('0x2d')]({'plain':!![]});_0x53764b[_0xd6a6('0xa2')]=_0x4ac6b1[_0xd6a6('0x5a')]['dialCheckDuplicateType']?_0x4ac6b1[_0xd6a6('0x5a')][_0xd6a6('0xa2')]:_0x53764b[_0xd6a6('0xa2')];switch(_0x53764b[_0xd6a6('0xa2')]){case _0xd6a6('0xa3'):_0x1e4a4f=squel[_0xd6a6('0xa4')]()[_0xd6a6('0xa5')](_0xd6a6('0xa6'))[_0xd6a6('0xa7')]([_0xd6a6('0xa8'),_0xd6a6('0xa9'),_0xd6a6('0xaa'),_0xd6a6('0xab'),_0xd6a6('0x6b'),_0xd6a6('0x61'),_0xd6a6('0x62')],squel[_0xd6a6('0x84')]()[_0xd6a6('0x85')](_0xd6a6('0xa8'),_0xd6a6('0xa8'))[_0xd6a6('0x85')](_0xd6a6('0xac'),_0xd6a6('0xa9'))[_0xd6a6('0x85')]('id',_0xd6a6('0xaa'))[_0xd6a6('0x85')](_0x498f0f[_0xd6a6('0xad')][_0xd6a6('0x8e')](),_0xd6a6('0xab'))[_0xd6a6('0x85')](_0x4ac6b1['params']['id'][_0xd6a6('0x8e')](),_0xd6a6('0x6b'))['field']('NOW()',_0xd6a6('0x61'))[_0xd6a6('0x85')]('NOW()','updatedAt')[_0xd6a6('0xae')]('cm_contacts')[_0xd6a6('0x4c')]('deletedAt\x20IS\x20NULL')[_0xd6a6('0x4c')](_0xd6a6('0xaf'),_0x498f0f[_0xd6a6('0xad')][_0xd6a6('0x8e')]())[_0xd6a6('0x4c')](_0xd6a6('0xb0'))[_0xd6a6('0x4c')](_0xd6a6('0xb1'),squel[_0xd6a6('0x84')]()['field'](_0xd6a6('0xb2'))[_0xd6a6('0xae')](_0xd6a6('0xb3'))[_0xd6a6('0x4c')](_0xd6a6('0x8a'),_0x4ac6b1[_0xd6a6('0x56')]['id'][_0xd6a6('0x8e')]()))[_0xd6a6('0x4c')](_0xd6a6('0xb1'),squel['select']()[_0xd6a6('0x85')](_0xd6a6('0xb4'))[_0xd6a6('0xae')](_0xd6a6('0xa6'))['where'](_0xd6a6('0x8a'),_0x4ac6b1[_0xd6a6('0x56')]['id'][_0xd6a6('0x8e')]())))['toString']();break;case'onlyIfOpen':_0x1e4a4f=squel['insert']()[_0xd6a6('0xa5')](_0xd6a6('0xa6'))[_0xd6a6('0xa7')](['phone',_0xd6a6('0xa9'),_0xd6a6('0xaa'),_0xd6a6('0xab'),_0xd6a6('0x6b'),_0xd6a6('0x61'),_0xd6a6('0x62')],squel[_0xd6a6('0x84')]()[_0xd6a6('0x85')]('phone',_0xd6a6('0xa8'))['field'](_0xd6a6('0xac'),'scheduledAt')[_0xd6a6('0x85')]('id',_0xd6a6('0xaa'))[_0xd6a6('0x85')](_0x498f0f[_0xd6a6('0xad')][_0xd6a6('0x8e')](),_0xd6a6('0xab'))[_0xd6a6('0x85')](_0x4ac6b1['params']['id']['toString'](),_0xd6a6('0x6b'))[_0xd6a6('0x85')](_0xd6a6('0xac'),_0xd6a6('0x61'))[_0xd6a6('0x85')]('NOW()',_0xd6a6('0x62'))[_0xd6a6('0xae')](_0xd6a6('0xb5'))[_0xd6a6('0x4c')](_0xd6a6('0xb6'))[_0xd6a6('0x4c')](_0xd6a6('0xaf'),_0x498f0f[_0xd6a6('0xad')]['toString']())['where'](_0xd6a6('0xb0'))[_0xd6a6('0x4c')](_0xd6a6('0xb1'),squel[_0xd6a6('0x84')]()['field'](_0xd6a6('0xb4'))[_0xd6a6('0xae')](_0xd6a6('0xa6'))[_0xd6a6('0x4c')](_0xd6a6('0x8a'),_0x4ac6b1[_0xd6a6('0x56')]['id'][_0xd6a6('0x8e')]())))['toString']();break;default:_0x1e4a4f=squel[_0xd6a6('0xa4')]()['into']('cm_hopper')[_0xd6a6('0xa7')]([_0xd6a6('0xa8'),_0xd6a6('0xa9'),_0xd6a6('0xaa'),_0xd6a6('0xab'),_0xd6a6('0x6b'),_0xd6a6('0x61'),'updatedAt'],squel[_0xd6a6('0x84')]()['field'](_0xd6a6('0xa8'),_0xd6a6('0xa8'))['field']('NOW()',_0xd6a6('0xa9'))['field']('id',_0xd6a6('0xaa'))['field'](_0x498f0f['CmListId'][_0xd6a6('0x8e')](),_0xd6a6('0xab'))[_0xd6a6('0x85')](_0x4ac6b1[_0xd6a6('0x56')]['id'][_0xd6a6('0x8e')](),_0xd6a6('0x6b'))['field'](_0xd6a6('0xac'),'createdAt')[_0xd6a6('0x85')](_0xd6a6('0xac'),_0xd6a6('0x62'))[_0xd6a6('0xae')](_0xd6a6('0xb5'))[_0xd6a6('0x4c')](_0xd6a6('0xb6'))[_0xd6a6('0x4c')](_0xd6a6('0xaf'),_0x498f0f[_0xd6a6('0xad')][_0xd6a6('0x8e')]())[_0xd6a6('0x4c')](_0xd6a6('0xb0')))[_0xd6a6('0x8e')]();}_0x524342[_0xd6a6('0x8d')](db['sequelize']['query'](_0x1e4a4f));}return BPromise['all'](_0x524342);}})['then'](function(){return _0x418fa0;})['then'](respondWithResult(_0x4825d3,null))[_0xd6a6('0x54')](handleError(_0x4825d3,null));};exports[_0xd6a6('0xb7')]=function(_0x2ec8f9,_0x455193,_0x38ce77){return db[_0xd6a6('0x3e')][_0xd6a6('0x58')]({'where':{'id':_0x2ec8f9[_0xd6a6('0x56')]['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0x455193,null))['then'](function(_0x9a26b){if(_0x9a26b){return _0x9a26b['removeLists'](_0x2ec8f9['query'][_0xd6a6('0x94')]);}})['then'](function(_0x90f408){if(_0x90f408){return db[_0xd6a6('0x67')][_0xd6a6('0x2c')]({'where':{'ListId':_0x2ec8f9['query'][_0xd6a6('0x94')],'VoiceQueueId':_0x2ec8f9[_0xd6a6('0x56')]['id']}})[_0xd6a6('0x2b')](function(){return _0x90f408;});}})[_0xd6a6('0x2b')](respondWithStatusCode(_0x455193,null))[_0xd6a6('0x54')](handleError(_0x455193,null));};exports[_0xd6a6('0xb8')]=function(_0x1cb484,_0xd259a1,_0x3e91d7){var _0x5a1d9e={};var _0x5ed7f2={};var _0x3d9ded;var _0x51e85b;return db[_0xd6a6('0x3e')][_0xd6a6('0x66')]({'where':{'id':_0x1cb484[_0xd6a6('0x56')]['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0xd259a1,null))[_0xd6a6('0x2b')](function(_0x2f6113){if(_0x2f6113){_0x3d9ded=_0x2f6113;_0x5ed7f2[_0xd6a6('0x45')]=_[_0xd6a6('0x42')](db[_0xd6a6('0x9e')][_0xd6a6('0x3f')]);_0x5ed7f2['query']=_['keys'](_0x1cb484['query']);_0x5ed7f2[_0xd6a6('0x44')]=_[_0xd6a6('0x46')](_0x5ed7f2['model'],_0x5ed7f2[_0xd6a6('0x43')]);_0x5a1d9e['attributes']=_['intersection'](_0x5ed7f2[_0xd6a6('0x45')],qs['fields'](_0x1cb484[_0xd6a6('0x43')]['fields']));_0x5a1d9e[_0xd6a6('0x48')]=_0x5a1d9e['attributes'][_0xd6a6('0x57')]?_0x5a1d9e[_0xd6a6('0x48')]:_0x5ed7f2[_0xd6a6('0x45')];_0x5a1d9e[_0xd6a6('0x4a')]=qs[_0xd6a6('0x4b')](_0x1cb484[_0xd6a6('0x43')][_0xd6a6('0x4b')]);_0x5a1d9e['where']=qs[_0xd6a6('0x44')](_['pick'](_0x1cb484[_0xd6a6('0x43')],_0x5ed7f2[_0xd6a6('0x44')]));if(_0x1cb484[_0xd6a6('0x43')][_0xd6a6('0x32')]){_0x5a1d9e['where']=_[_0xd6a6('0x4e')](_0x5a1d9e[_0xd6a6('0x4c')],{'$or':_[_0xd6a6('0x34')](_0x5a1d9e[_0xd6a6('0x48')],function(_0x244886){var _0x495ed9={};_0x495ed9[_0x244886]={'$like':'%'+_0x1cb484['query']['filter']+'%'};return _0x495ed9;})});}_0x5a1d9e=_['merge']({},_0x5a1d9e,_0x1cb484['options']);return _0x3d9ded[_0xd6a6('0xb8')](_0x5a1d9e);}})['then'](function(_0x132e2f){if(_0x132e2f){_0x51e85b=_0x132e2f[_0xd6a6('0x57')];if(!_0x1cb484[_0xd6a6('0x43')]['hasOwnProperty'](_0xd6a6('0x49'))){_0x5a1d9e[_0xd6a6('0x22')]=qs[_0xd6a6('0x22')](_0x1cb484[_0xd6a6('0x43')][_0xd6a6('0x22')]);_0x5a1d9e[_0xd6a6('0x21')]=qs[_0xd6a6('0x21')](_0x1cb484[_0xd6a6('0x43')][_0xd6a6('0x21')]);}return _0x3d9ded[_0xd6a6('0xb8')](_0x5a1d9e);}})[_0xd6a6('0x2b')](function(_0x20257e){if(_0x20257e){return _0x20257e?{'count':_0x51e85b,'rows':_0x20257e}:null;}})[_0xd6a6('0x2b')](respondWithResult(_0xd259a1,null))['catch'](handleError(_0xd259a1,null));};exports[_0xd6a6('0xb9')]=function(_0x47ee3e,_0x527221,_0xa0e791){var _0x4c19e6,_0x8d243b;return db[_0xd6a6('0x3e')][_0xd6a6('0x58')]({'where':{'id':_0x47ee3e[_0xd6a6('0x56')]['id']}})[_0xd6a6('0x2b')](handleEntityNotFound(_0x527221,null))['then'](function(_0xc9359c){if(_0xc9359c){_0x8d243b=_0xc9359c;return _0xc9359c[_0xd6a6('0xb9')](_0x47ee3e[_0xd6a6('0x5a')][_0xd6a6('0x94')],_[_0xd6a6('0x63')](_0x47ee3e[_0xd6a6('0x5a')],['ids','id'])||{});}return null;})[_0xd6a6('0xa1')](function(_0x59c8c7){var _0x46d70a;_0x4c19e6=_0x59c8c7||[];var _0xe153e6=[];if(_0x59c8c7){for(var _0x2b8174=0x0;_0x2b8174<_0x59c8c7['length'];_0x2b8174+=0x1){var _0x15bedf=_0x59c8c7[_0x2b8174][_0xd6a6('0x2d')]({'plain':!![]});_0x46d70a=squel[_0xd6a6('0xa4')]()[_0xd6a6('0xa5')](_0xd6a6('0xba'))[_0xd6a6('0xa7')](['phone',_0xd6a6('0xaa'),_0xd6a6('0xab'),'VoiceQueueId',_0xd6a6('0x61'),'updatedAt'],squel['select']()[_0xd6a6('0x85')](_0xd6a6('0xa8'),_0xd6a6('0xa8'))[_0xd6a6('0x85')]('id',_0xd6a6('0xaa'))['field'](_0x15bedf[_0xd6a6('0xad')][_0xd6a6('0x8e')](),_0xd6a6('0xab'))[_0xd6a6('0x85')](_0x47ee3e[_0xd6a6('0x56')]['id']['toString'](),_0xd6a6('0x6b'))[_0xd6a6('0x85')](_0xd6a6('0xac'),_0xd6a6('0x61'))['field'](_0xd6a6('0xac'),_0xd6a6('0x62'))['from'](_0xd6a6('0xb5'))[_0xd6a6('0x4c')]('deletedAt\x20IS\x20NULL')[_0xd6a6('0x4c')](_0xd6a6('0xaf'),_0x15bedf[_0xd6a6('0xad')]['toString']())[_0xd6a6('0x4c')]('phone\x20IS\x20NOT\x20NULL'))[_0xd6a6('0x8e')]();_0xe153e6[_0xd6a6('0x8d')](db['sequelize'][_0xd6a6('0x43')](_0x46d70a));}return BPromise[_0xd6a6('0x9a')](_0xe153e6);}})[_0xd6a6('0x2b')](function(){return _0x4c19e6;})[_0xd6a6('0x2b')](respondWithResult(_0x527221,null))[_0xd6a6('0x54')](handleError(_0x527221,null));};exports[_0xd6a6('0xbb')]=function(_0x1d0d5b,_0xb3dee0,_0x4bd8e0){return db[_0xd6a6('0x3e')][_0xd6a6('0x58')]({'where':{'id':_0x1d0d5b[_0xd6a6('0x56')]['id']}})['then'](handleEntityNotFound(_0xb3dee0,null))[_0xd6a6('0x2b')](function(_0x5838ce){if(_0x5838ce){return _0x5838ce[_0xd6a6('0xbb')](_0x1d0d5b[_0xd6a6('0x43')][_0xd6a6('0x94')]);}})[_0xd6a6('0x2b')](function(_0x1d3661){if(_0x1d3661){return db[_0xd6a6('0x6e')][_0xd6a6('0x2c')]({'where':{'ListId':_0x1d0d5b[_0xd6a6('0x43')][_0xd6a6('0x94')],'VoiceQueueId':_0x1d0d5b[_0xd6a6('0x56')]['id']}})['then'](function(){return _0x1d3661;});}})['then'](respondWithStatusCode(_0xb3dee0,null))[_0xd6a6('0x54')](handleError(_0xb3dee0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1599701..564fac5 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 _0xee22=['VoiceQueue','setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x5b682f,_0x3befac){var _0x47f01b=function(_0xe2c7be){while(--_0xe2c7be){_0x5b682f['push'](_0x5b682f['shift']());}};_0x47f01b(++_0x3befac);}(_0xee22,0x1c9));var _0x2ee2=function(_0x81e59e,_0x5f082d){_0x81e59e=_0x81e59e-0x0;var _0x221350=_0xee22[_0x81e59e];return _0x221350;};'use strict';var EventEmitter=require(_0x2ee2('0x0'));var VoiceQueue=require(_0x2ee2('0x1'))['db'][_0x2ee2('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2ee2('0x3')](0x0);var events={'afterCreate':_0x2ee2('0x4'),'afterUpdate':_0x2ee2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x55d05a){return function(_0x321617,_0x427d39,_0xc3c629){VoiceQueueEvents[_0x2ee2('0x6')](_0x55d05a+':'+_0x321617['id'],_0x321617);VoiceQueueEvents[_0x2ee2('0x6')](_0x55d05a,_0x321617);_0xc3c629(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x2ee2('0x7')](e,emitEvent(event));}}module[_0x2ee2('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xe88c=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit'];(function(_0x34659e,_0x37e790){var _0x144956=function(_0x2fa081){while(--_0x2fa081){_0x34659e['push'](_0x34659e['shift']());}};_0x144956(++_0x37e790);}(_0xe88c,0x1e3));var _0xce88=function(_0x4e76b0,_0x3168de){_0x4e76b0=_0x4e76b0-0x0;var _0x5d5358=_0xe88c[_0x4e76b0];return _0x5d5358;};'use strict';var EventEmitter=require(_0xce88('0x0'));var VoiceQueue=require(_0xce88('0x1'))['db'][_0xce88('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xce88('0x3')](0x0);var events={'afterCreate':_0xce88('0x4'),'afterUpdate':_0xce88('0x5'),'afterDestroy':'remove'};function emitEvent(_0x9d34c0){return function(_0x1b160e,_0x567baa,_0x5da5ee){VoiceQueueEvents['emit'](_0x9d34c0+':'+_0x1b160e['id'],_0x1b160e);VoiceQueueEvents[_0xce88('0x6')](_0x9d34c0,_0x1b160e);_0x5da5ee(null);};}for(var e in events){if(events[_0xce88('0x7')](e)){var event=events[e];VoiceQueue[_0xce88('0x8')](e,emitEvent(event));}}module[_0xce88('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 787b34f..2ddb9a7 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0x55ca,0x126));var _0xa55c=function(_0x50a19b,_0x80c4d0){_0x50a19b=_0x50a19b-0x0;var _0x19b42d=_0x55ca[_0x50a19b];return _0x19b42d;};'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')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x34158b,_0x6e54c0){var _0xf70991=function(_0x884d21){while(--_0x884d21){_0x34158b['push'](_0x34158b['shift']());}};_0xf70991(++_0x6e54c0);}(_0x70e0,0x17b));var _0x070e=function(_0x40a934,_0x453d52){_0x40a934=_0x40a934-0x0;var _0x5a3e15=_0x70e0[_0x40a934];return _0x5a3e15;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 52cb179..624d68d 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 _0xfee0=['then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowVoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfee0,0xbc));var _0x0fee=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0xfee0[_0x503ffd];return _0x160437;};'use strict';var _=require(_0x0fee('0x0'));var util=require(_0x0fee('0x1'));var moment=require(_0x0fee('0x2'));var BPromise=require(_0x0fee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fee('0x4'));var db=require(_0x0fee('0x5'))['db'];var utils=require(_0x0fee('0x6'));var logger=require(_0x0fee('0x7'))(_0x0fee('0x8'));var config=require(_0x0fee('0x9'));var jayson=require(_0x0fee('0xa'));var client=jayson['client'][_0x0fee('0xb')]({'port':0x232a});config[_0x0fee('0xc')]=_[_0x0fee('0xd')](config[_0x0fee('0xc')],{'host':_0x0fee('0xe'),'port':0x18eb});var socket=require(_0x0fee('0xf'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x49f8af,_0x40ea1b,_0xfa0587){return new BPromise(function(_0x2ca1ae,_0x23bca3){return client[_0x0fee('0x10')](_0x49f8af,_0xfa0587)[_0x0fee('0x11')](function(_0x2ce190){logger[_0x0fee('0x12')](_0x0fee('0x13'),_0x40ea1b,'request\x20sent');logger['debug'](_0x0fee('0x14'),_0x40ea1b,_0x0fee('0x15'),JSON[_0x0fee('0x16')](_0x2ce190));if(_0x2ce190[_0x0fee('0x17')]){if(_0x2ce190[_0x0fee('0x17')]['code']===0x1f4){logger['error'](_0x0fee('0x13'),_0x40ea1b,_0x2ce190[_0x0fee('0x17')][_0x0fee('0x18')]);return _0x23bca3(_0x2ce190['error'][_0x0fee('0x18')]);}logger[_0x0fee('0x17')](_0x0fee('0x13'),_0x40ea1b,_0x2ce190[_0x0fee('0x17')][_0x0fee('0x18')]);return _0x2ca1ae(_0x2ce190[_0x0fee('0x17')][_0x0fee('0x18')]);}else{logger[_0x0fee('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x40ea1b,_0x0fee('0x15'));_0x2ca1ae(_0x2ce190[_0x0fee('0x19')][_0x0fee('0x18')]);}})[_0x0fee('0x1a')](function(_0x3526a1){logger[_0x0fee('0x17')](_0x0fee('0x13'),_0x40ea1b,_0x3526a1);_0x23bca3(_0x3526a1);});});}exports[_0x0fee('0x1b')]=function(_0x528ff1){var _0x1e8814=this;return new Promise(function(_0x2134bf,_0x2e8885){return db[_0x0fee('0x1c')][_0x0fee('0x1d')]({'raw':_0x528ff1[_0x0fee('0x1e')]?_0x528ff1[_0x0fee('0x1e')][_0x0fee('0x1f')]===undefined?!![]:![]:!![],'where':_0x528ff1[_0x0fee('0x1e')]?_0x528ff1['options'][_0x0fee('0x20')]||null:null,'attributes':_0x528ff1[_0x0fee('0x1e')]?_0x528ff1['options'][_0x0fee('0x21')]||null:null,'limit':_0x528ff1[_0x0fee('0x1e')]?_0x528ff1[_0x0fee('0x1e')][_0x0fee('0x22')]||null:null,'include':_0x528ff1[_0x0fee('0x1e')]?_0x528ff1[_0x0fee('0x1e')][_0x0fee('0x23')]?_[_0x0fee('0x24')](_0x528ff1[_0x0fee('0x1e')][_0x0fee('0x23')],function(_0x656bd8){return{'model':db[_0x656bd8[_0x0fee('0x25')]],'as':_0x656bd8['as'],'attributes':_0x656bd8[_0x0fee('0x21')],'include':_0x656bd8[_0x0fee('0x23')]?_[_0x0fee('0x24')](_0x656bd8[_0x0fee('0x23')],function(_0x537e1b){return{'model':db[_0x537e1b[_0x0fee('0x25')]],'as':_0x537e1b['as'],'attributes':_0x537e1b[_0x0fee('0x21')],'include':_0x537e1b['include']?_[_0x0fee('0x24')](_0x537e1b[_0x0fee('0x23')],function(_0xbba076){return{'model':db[_0xbba076[_0x0fee('0x25')]],'as':_0xbba076['as'],'attributes':_0xbba076[_0x0fee('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0fee('0x11')](function(_0x5ea9b1){logger['info'](_0x0fee('0x1b'),_0x528ff1);logger[_0x0fee('0x26')]('GetVoiceQueue',_0x528ff1,JSON[_0x0fee('0x16')](_0x5ea9b1));_0x2134bf(_0x5ea9b1);})['catch'](function(_0x43807e){logger[_0x0fee('0x17')](_0x0fee('0x1b'),_0x43807e[_0x0fee('0x18')],_0x528ff1);_0x2e8885(_0x1e8814[_0x0fee('0x17')](0x1f4,_0x43807e[_0x0fee('0x18')]));});});};exports[_0x0fee('0x27')]=function(_0x2879f9){var _0x1e522a=this;return new Promise(function(_0x2e3f72,_0x58240b){return db[_0x0fee('0x1c')][_0x0fee('0x28')]({'raw':_0x2879f9[_0x0fee('0x1e')]?_0x2879f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x2879f9[_0x0fee('0x1e')]?_0x2879f9[_0x0fee('0x1e')]['where']||null:null,'attributes':_0x2879f9[_0x0fee('0x1e')]?_0x2879f9[_0x0fee('0x1e')][_0x0fee('0x21')]||null:null,'include':_0x2879f9['options']?_0x2879f9[_0x0fee('0x1e')][_0x0fee('0x23')]?_[_0x0fee('0x24')](_0x2879f9[_0x0fee('0x1e')][_0x0fee('0x23')],function(_0x584c85){return{'model':db[_0x584c85[_0x0fee('0x25')]],'as':_0x584c85['as'],'attributes':_0x584c85[_0x0fee('0x21')],'include':_0x584c85['include']?_[_0x0fee('0x24')](_0x584c85['include'],function(_0x17ff99){return{'model':db[_0x17ff99[_0x0fee('0x25')]],'as':_0x17ff99['as'],'attributes':_0x17ff99['attributes'],'include':_0x17ff99[_0x0fee('0x23')]?_[_0x0fee('0x24')](_0x17ff99[_0x0fee('0x23')],function(_0x182066){return{'model':db[_0x182066[_0x0fee('0x25')]],'as':_0x182066['as'],'attributes':_0x182066['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ae987){logger[_0x0fee('0x12')]('ShowVoiceQueue',_0x2879f9);logger[_0x0fee('0x26')](_0x0fee('0x27'),_0x2879f9,JSON[_0x0fee('0x16')](_0x5ae987));_0x2e3f72(_0x5ae987);})['catch'](function(_0x5b9aac){logger['error']('ShowVoiceQueue',_0x5b9aac[_0x0fee('0x18')],_0x2879f9);_0x58240b(_0x1e522a['error'](0x1f4,_0x5b9aac[_0x0fee('0x18')]));});});}; \ No newline at end of file +var _0x9aa5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x9aa5,0x7b));var _0x59aa=function(_0x218d1b,_0x5cf934){_0x218d1b=_0x218d1b-0x0;var _0x405ad0=_0x9aa5[_0x218d1b];return _0x405ad0;};'use strict';var _=require('lodash');var util=require(_0x59aa('0x0'));var moment=require(_0x59aa('0x1'));var BPromise=require(_0x59aa('0x2'));var rs=require(_0x59aa('0x3'));var fs=require('fs');var Redis=require(_0x59aa('0x4'));var db=require(_0x59aa('0x5'))['db'];var utils=require(_0x59aa('0x6'));var logger=require(_0x59aa('0x7'))('rpc');var config=require(_0x59aa('0x8'));var jayson=require(_0x59aa('0x9'));var client=jayson[_0x59aa('0xa')]['http']({'port':0x232a});config['redis']=_[_0x59aa('0xb')](config[_0x59aa('0xc')],{'host':_0x59aa('0xd'),'port':0x18eb});var socket=require(_0x59aa('0xe'))(new Redis(config[_0x59aa('0xc')]));require(_0x59aa('0xf'))[_0x59aa('0x10')](socket);function respondWithRpcPromise(_0x23625a,_0x110de5,_0x2ce980){return new BPromise(function(_0x4f8ccb,_0x1d96c2){return client['request'](_0x23625a,_0x2ce980)[_0x59aa('0x11')](function(_0x23ca37){logger['info'](_0x59aa('0x12'),_0x110de5,_0x59aa('0x13'));logger[_0x59aa('0x14')](_0x59aa('0x15'),_0x110de5,_0x59aa('0x13'),JSON[_0x59aa('0x16')](_0x23ca37));if(_0x23ca37['error']){if(_0x23ca37[_0x59aa('0x17')][_0x59aa('0x18')]===0x1f4){logger[_0x59aa('0x17')](_0x59aa('0x12'),_0x110de5,_0x23ca37['error'][_0x59aa('0x19')]);return _0x1d96c2(_0x23ca37['error'][_0x59aa('0x19')]);}logger['error'](_0x59aa('0x12'),_0x110de5,_0x23ca37[_0x59aa('0x17')][_0x59aa('0x19')]);return _0x4f8ccb(_0x23ca37[_0x59aa('0x17')][_0x59aa('0x19')]);}else{logger[_0x59aa('0x1a')](_0x59aa('0x12'),_0x110de5,_0x59aa('0x13'));_0x4f8ccb(_0x23ca37[_0x59aa('0x1b')][_0x59aa('0x19')]);}})[_0x59aa('0x1c')](function(_0x490ed0){logger[_0x59aa('0x17')](_0x59aa('0x12'),_0x110de5,_0x490ed0);_0x1d96c2(_0x490ed0);});});}exports[_0x59aa('0x1d')]=function(_0x4ea2ee){var _0x5d2b37=this;return new Promise(function(_0x3c2f33,_0x5c9deb){return db[_0x59aa('0x1e')][_0x59aa('0x1f')]({'raw':_0x4ea2ee[_0x59aa('0x20')]?_0x4ea2ee[_0x59aa('0x20')][_0x59aa('0x21')]===undefined?!![]:![]:!![],'where':_0x4ea2ee[_0x59aa('0x20')]?_0x4ea2ee[_0x59aa('0x20')][_0x59aa('0x22')]||null:null,'attributes':_0x4ea2ee[_0x59aa('0x20')]?_0x4ea2ee[_0x59aa('0x20')][_0x59aa('0x23')]||null:null,'limit':_0x4ea2ee[_0x59aa('0x20')]?_0x4ea2ee['options'][_0x59aa('0x24')]||null:null,'include':_0x4ea2ee[_0x59aa('0x20')]?_0x4ea2ee[_0x59aa('0x20')][_0x59aa('0x25')]?_[_0x59aa('0x26')](_0x4ea2ee[_0x59aa('0x20')][_0x59aa('0x25')],function(_0x482487){return{'model':db[_0x482487[_0x59aa('0x27')]],'as':_0x482487['as'],'attributes':_0x482487[_0x59aa('0x23')],'include':_0x482487[_0x59aa('0x25')]?_['map'](_0x482487[_0x59aa('0x25')],function(_0x4682a7){return{'model':db[_0x4682a7[_0x59aa('0x27')]],'as':_0x4682a7['as'],'attributes':_0x4682a7[_0x59aa('0x23')],'include':_0x4682a7[_0x59aa('0x25')]?_[_0x59aa('0x26')](_0x4682a7[_0x59aa('0x25')],function(_0xa517f1){return{'model':db[_0xa517f1[_0x59aa('0x27')]],'as':_0xa517f1['as'],'attributes':_0xa517f1[_0x59aa('0x23')]};}):[]};}):[]};}):[]:[]})[_0x59aa('0x11')](function(_0xe6e770){logger[_0x59aa('0x1a')]('GetVoiceQueue',_0x4ea2ee);logger[_0x59aa('0x14')]('GetVoiceQueue',_0x4ea2ee,JSON[_0x59aa('0x16')](_0xe6e770));_0x3c2f33(_0xe6e770);})[_0x59aa('0x1c')](function(_0x46bea1){logger[_0x59aa('0x17')](_0x59aa('0x1d'),_0x46bea1[_0x59aa('0x19')],_0x4ea2ee);_0x5c9deb(_0x5d2b37[_0x59aa('0x17')](0x1f4,_0x46bea1['message']));});});};exports[_0x59aa('0x28')]=function(_0x545d1f){var _0x5d9e38=this;return new Promise(function(_0x494229,_0x5af2ef){return db[_0x59aa('0x1e')]['find']({'raw':_0x545d1f['options']?_0x545d1f[_0x59aa('0x20')][_0x59aa('0x21')]===undefined?!![]:![]:!![],'where':_0x545d1f[_0x59aa('0x20')]?_0x545d1f[_0x59aa('0x20')][_0x59aa('0x22')]||null:null,'attributes':_0x545d1f['options']?_0x545d1f[_0x59aa('0x20')]['attributes']||null:null,'include':_0x545d1f[_0x59aa('0x20')]?_0x545d1f[_0x59aa('0x20')][_0x59aa('0x25')]?_[_0x59aa('0x26')](_0x545d1f[_0x59aa('0x20')]['include'],function(_0x117164){return{'model':db[_0x117164[_0x59aa('0x27')]],'as':_0x117164['as'],'attributes':_0x117164[_0x59aa('0x23')],'include':_0x117164['include']?_[_0x59aa('0x26')](_0x117164[_0x59aa('0x25')],function(_0x5bfda7){return{'model':db[_0x5bfda7[_0x59aa('0x27')]],'as':_0x5bfda7['as'],'attributes':_0x5bfda7[_0x59aa('0x23')],'include':_0x5bfda7[_0x59aa('0x25')]?_[_0x59aa('0x26')](_0x5bfda7[_0x59aa('0x25')],function(_0x49f2ff){return{'model':db[_0x49f2ff[_0x59aa('0x27')]],'as':_0x49f2ff['as'],'attributes':_0x49f2ff[_0x59aa('0x23')]};}):[]};}):[]};}):[]:[]})[_0x59aa('0x11')](function(_0x1e2486){logger[_0x59aa('0x1a')](_0x59aa('0x28'),_0x545d1f);logger[_0x59aa('0x14')](_0x59aa('0x28'),_0x545d1f,JSON['stringify'](_0x1e2486));_0x494229(_0x1e2486);})[_0x59aa('0x1c')](function(_0x1e3ede){logger[_0x59aa('0x17')]('ShowVoiceQueue',_0x1e3ede[_0x59aa('0x19')],_0x545d1f);_0x5af2ef(_0x5d9e38[_0x59aa('0x17')](0x1f4,_0x1e3ede['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index bccb811..c694445 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 _0x16aa=['register','length','./voiceQueue.events','save','remove','update','emit'];(function(_0x11e9ca,_0x2918b5){var _0x3448c9=function(_0x37e67b){while(--_0x37e67b){_0x11e9ca['push'](_0x11e9ca['shift']());}};_0x3448c9(++_0x2918b5);}(_0x16aa,0xbf));var _0xa16a=function(_0x244ed8,_0x49443e){_0x244ed8=_0x244ed8-0x0;var _0x131b43=_0x16aa[_0x244ed8];return _0x131b43;};'use strict';var VoiceQueueEvents=require(_0xa16a('0x0'));var events=[_0xa16a('0x1'),_0xa16a('0x2'),_0xa16a('0x3')];function createListener(_0x36365c,_0x2409b2){return function(_0xa77138){_0x2409b2[_0xa16a('0x4')](_0x36365c,_0xa77138);};}function removeListener(_0x4c35c0,_0x337d74){return function(){VoiceQueueEvents['removeListener'](_0x4c35c0,_0x337d74);};}exports[_0xa16a('0x5')]=function(_0x3a9498){for(var _0x346a2b=0x0,_0x1d5c9d=events[_0xa16a('0x6')];_0x346a2b<_0x1d5c9d;_0x346a2b++){var _0x530603=events[_0x346a2b];var _0x216cfa=createListener('voiceQueue:'+_0x530603,_0x3a9498);VoiceQueueEvents['on'](_0x530603,_0x216cfa);}}; \ No newline at end of file +var _0x457d=['voiceQueue:','save','remove','emit','removeListener'];(function(_0x55f8fa,_0x616528){var _0x20a9a9=function(_0x337bb5){while(--_0x337bb5){_0x55f8fa['push'](_0x55f8fa['shift']());}};_0x20a9a9(++_0x616528);}(_0x457d,0x14b));var _0xd457=function(_0x556a99,_0x3d0574){_0x556a99=_0x556a99-0x0;var _0x45a65a=_0x457d[_0x556a99];return _0x45a65a;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xd457('0x0'),_0xd457('0x1'),'update'];function createListener(_0x55f61d,_0xdb1b53){return function(_0xee5ee6){_0xdb1b53[_0xd457('0x2')](_0x55f61d,_0xee5ee6);};}function removeListener(_0x47d352,_0x43992f){return function(){VoiceQueueEvents[_0xd457('0x3')](_0x47d352,_0x43992f);};}exports['register']=function(_0x8fc891){for(var _0x396e74=0x0,_0x3a5d5a=events['length'];_0x396e74<_0x3a5d5a;_0x396e74++){var _0x128030=events[_0x396e74];var _0x3a9191=createListener(_0xd457('0x4')+_0x128030,_0x8fc891);VoiceQueueEvents['on'](_0x128030,_0x3a9191);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1c4a782..7ffc9a8 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 _0xc323=['/:id','show','post','put','update','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport'];(function(_0xfce9a0,_0x5c8a98){var _0xbc7d52=function(_0x503cb9){while(--_0x503cb9){_0xfce9a0['push'](_0xfce9a0['shift']());}};_0xbc7d52(++_0x5c8a98);}(_0xc323,0xf6));var _0x3c32=function(_0x39be2e,_0xdf0686){_0x39be2e=_0x39be2e-0x0;var _0x130433=_0xc323[_0x39be2e];return _0x130433;};'use strict';var multer=require(_0x3c32('0x0'));var util=require(_0x3c32('0x1'));var path=require('path');var timeout=require(_0x3c32('0x2'));var express=require(_0x3c32('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3c32('0x4'));var interaction=require(_0x3c32('0x5'));var config=require('../../config/environment');var controller=require(_0x3c32('0x6'));router[_0x3c32('0x7')]('/',auth[_0x3c32('0x8')](),controller[_0x3c32('0x9')]);router[_0x3c32('0x7')](_0x3c32('0xa'),auth['isAuthenticated'](),controller[_0x3c32('0xb')]);router[_0x3c32('0x7')](_0x3c32('0xc'),auth[_0x3c32('0x8')](),controller[_0x3c32('0xd')]);router[_0x3c32('0x7')](_0x3c32('0xe'),auth[_0x3c32('0x8')](),controller[_0x3c32('0xf')]);router[_0x3c32('0x10')]('/',auth[_0x3c32('0x8')](),controller['create']);router[_0x3c32('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3c32('0x12')]);router['delete'](_0x3c32('0xe'),auth['isAuthenticated'](),controller[_0x3c32('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0a41=['isAuthenticated','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe'];(function(_0x2e9c7d,_0x379775){var _0x440303=function(_0x2433fa){while(--_0x2433fa){_0x2e9c7d['push'](_0x2e9c7d['shift']());}};_0x440303(++_0x379775);}(_0x0a41,0x122));var _0x10a4=function(_0x1e691f,_0x215f5f){_0x1e691f=_0x1e691f-0x0;var _0x5b37cb=_0x0a41[_0x1e691f];return _0x5b37cb;};'use strict';var multer=require(_0x10a4('0x0'));var util=require(_0x10a4('0x1'));var path=require('path');var timeout=require(_0x10a4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x10a4('0x3'));var auth=require(_0x10a4('0x4'));var interaction=require(_0x10a4('0x5'));var config=require(_0x10a4('0x6'));var controller=require(_0x10a4('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x10a4('0x8')](_0x10a4('0x9'),auth[_0x10a4('0xa')](),controller['describe']);router[_0x10a4('0x8')](_0x10a4('0xb'),auth[_0x10a4('0xa')](),controller[_0x10a4('0xc')]);router['get'](_0x10a4('0xd'),auth[_0x10a4('0xa')](),controller[_0x10a4('0xe')]);router[_0x10a4('0xf')]('/',auth[_0x10a4('0xa')](),controller['create']);router[_0x10a4('0x10')]('/:id',auth[_0x10a4('0xa')](),controller[_0x10a4('0x11')]);router[_0x10a4('0x12')]('/:id',auth[_0x10a4('0xa')](),controller[_0x10a4('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b2fafa4..3ec7534 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 _0x54d4=['INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','getDataValue','YYYY-MM-DD\x20HH:mm:ss','setDataValue','holdtime'];(function(_0xb87f20,_0x4ae8f5){var _0x5e02bb=function(_0x2611ec){while(--_0x2611ec){_0xb87f20['push'](_0xb87f20['shift']());}};_0x5e02bb(++_0x4ae8f5);}(_0x54d4,0xdd));var _0x454d=function(_0x5d3e97,_0x17254e){_0x5d3e97=_0x5d3e97-0x0;var _0x233e5b=_0x54d4[_0x5d3e97];return _0x233e5b;};'use strict';var Sequelize=require(_0x454d('0x0'));var moment=require(_0x454d('0x1'));module['exports']={'type':{'type':Sequelize[_0x454d('0x2')]},'uniqueid':{'type':Sequelize[_0x454d('0x2')]},'calleridnum':{'type':Sequelize[_0x454d('0x2')]},'calleridname':{'type':Sequelize[_0x454d('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x28fd2d){var _0x256319=moment(_0x28fd2d);var _0x2de638=moment(this[_0x454d('0x3')]('queuecallerjoinAt'))['format'](_0x454d('0x4'));var _0x1ddaf8=_0x256319['diff'](_0x2de638,'seconds');this[_0x454d('0x5')]('queuecallerleaveAt',_0x28fd2d);this['setDataValue'](_0x454d('0x6'),_0x1ddaf8||null);}},'position':{'type':Sequelize[_0x454d('0x7')]},'count':{'type':Sequelize[_0x454d('0x7')]},'queuecallerabandon':{'type':Sequelize[_0x454d('0x8')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x454d('0x9')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x454d('0x9')]},'queuecallerexit':{'type':Sequelize[_0x454d('0x8')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x454d('0x9')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x454d('0xa')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x454d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x454d('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x454d('0x2')]},'context':{'type':Sequelize[_0x454d('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x454d('0x2')]},'holdtime':{'type':Sequelize[_0x454d('0x7')]},'mohtime':{'type':Sequelize[_0x454d('0x7')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x454d('0x8')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x454d('0x8')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x454d('0x2')],'comment':_0x454d('0xb')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x454d('0x2')]},'disposition':{'type':Sequelize[_0x454d('0x2')]},'secondDisposition':{'type':Sequelize[_0x454d('0x2')]},'thirdDisposition':{'type':Sequelize[_0x454d('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x454d('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1275=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2222f7,_0x446b82){var _0x4d364a=function(_0x479bc7){while(--_0x479bc7){_0x2222f7['push'](_0x2222f7['shift']());}};_0x4d364a(++_0x446b82);}(_0x1275,0x117));var _0x5127=function(_0x2b38fd,_0x66acb5){_0x2b38fd=_0x2b38fd-0x0;var _0x4a8477=_0x1275[_0x2b38fd];return _0x4a8477;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5127('0x0'));module[_0x5127('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5127('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x5127('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x270081){var _0x15a3a9=moment(_0x270081);var _0x4d5cb6=moment(this['getDataValue'](_0x5127('0x4')))[_0x5127('0x5')](_0x5127('0x6'));var _0xfc3ee9=_0x15a3a9['diff'](_0x4d5cb6,_0x5127('0x7'));this[_0x5127('0x8')](_0x5127('0x9'),_0x270081);this[_0x5127('0x8')](_0x5127('0xa'),_0xfc3ee9||null);}},'position':{'type':Sequelize[_0x5127('0xb')]},'count':{'type':Sequelize[_0x5127('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x5127('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x5127('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5127('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x5127('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x5127('0xb')]},'channel':{'type':Sequelize[_0x5127('0x2')]},'connectedlinenum':{'type':Sequelize[_0x5127('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5127('0x2')]},'priority':{'type':Sequelize[_0x5127('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5127('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5127('0x2')]},'transfer':{'type':Sequelize[_0x5127('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x5127('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5127('0x2')]},'disposition':{'type':Sequelize[_0x5127('0x2')]},'secondDisposition':{'type':Sequelize[_0x5127('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x5127('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index fa584bb..4d32916 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 _0x7cff=['fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','merge','VIRTUAL','options','includeAll','include','VoiceQueueReport','findAll','rows','catch','show','params','create','body','describe','getVoiceQueuesReport','order','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes'];(function(_0x333e1e,_0xc5b460){var _0x127eba=function(_0x3fca17){while(--_0x3fca17){_0x333e1e['push'](_0x333e1e['shift']());}};_0x127eba(++_0xc5b460);}(_0x7cff,0x106));var _0xf7cf=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7cff[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7cf('0x0'));var zipdir=require(_0xf7cf('0x1'));var jsonpatch=require(_0xf7cf('0x2'));var rp=require(_0xf7cf('0x3'));var moment=require(_0xf7cf('0x4'));var BPromise=require(_0xf7cf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf7cf('0x6'));var ejs=require(_0xf7cf('0x7'));var fs=require('fs');var fs_extra=require(_0xf7cf('0x8'));var _=require(_0xf7cf('0x9'));var squel=require(_0xf7cf('0xa'));var crypto=require(_0xf7cf('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf7cf('0x6'));var querystring=require('querystring');var Papa=require(_0xf7cf('0xc'));var Redis=require(_0xf7cf('0xd'));var authService=require(_0xf7cf('0xe'));var qs=require(_0xf7cf('0xf'));var as=require(_0xf7cf('0x10'));var hardwareService=require(_0xf7cf('0x11'));var logger=require('../../config/logger')(_0xf7cf('0x12'));var utils=require(_0xf7cf('0x13'));var config=require(_0xf7cf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf7cf('0x15')]=_[_0xf7cf('0x16')](config[_0xf7cf('0x15')],{'host':_0xf7cf('0x17'),'port':0x18eb});var socket=require(_0xf7cf('0x18'))(new Redis(config['redis']));require(_0xf7cf('0x19'))[_0xf7cf('0x1a')](socket);function respondWithStatusCode(_0x77a38b,_0x23b4bc){_0x23b4bc=_0x23b4bc||0xcc;return function(_0x22edc7){if(_0x22edc7){return _0x77a38b[_0xf7cf('0x1b')](_0x23b4bc);}return _0x77a38b[_0xf7cf('0x1c')](_0x23b4bc)[_0xf7cf('0x1d')]();};}function respondWithResult(_0x22f851,_0x252f19){_0x252f19=_0x252f19||0xc8;return function(_0x5d6caa){if(_0x5d6caa){return _0x22f851[_0xf7cf('0x1c')](_0x252f19)[_0xf7cf('0x1e')](_0x5d6caa);}};}function respondWithFilteredResult(_0x47985e,_0x12dea7){return function(_0x2df143){if(_0x2df143){var _0x578dbc=typeof _0x12dea7[_0xf7cf('0x1f')]===_0xf7cf('0x20')&&typeof _0x12dea7[_0xf7cf('0x21')]===_0xf7cf('0x20');var _0xd75f6a=_0x2df143['count'];var _0x59e12f=_0x578dbc?0x0:_0x12dea7[_0xf7cf('0x1f')];var _0x5a3552=_0x578dbc?_0x2df143[_0xf7cf('0x22')]:_0x12dea7['offset']+_0x12dea7[_0xf7cf('0x21')];var _0x5dcbed;if(_0x5a3552>=_0xd75f6a){_0x5a3552=_0xd75f6a;_0x5dcbed=0xc8;}else{_0x5dcbed=0xce;}_0x47985e['status'](_0x5dcbed);return _0x47985e['set']('Content-Range',_0x59e12f+'-'+_0x5a3552+'/'+_0xd75f6a)['json'](_0x2df143);}return null;};}function patchUpdates(_0x49984f){return function(_0x258adc){try{jsonpatch[_0xf7cf('0x23')](_0x258adc,_0x49984f,!![]);}catch(_0x46c462){return BPromise[_0xf7cf('0x24')](_0x46c462);}return _0x258adc['save']();};}function saveUpdates(_0x17111d,_0x254c8d){return function(_0x2b3096){if(_0x2b3096){return _0x2b3096[_0xf7cf('0x25')](_0x17111d)[_0xf7cf('0x26')](function(_0x75baad){return _0x75baad;});}return null;};}function removeEntity(_0x3ccccc,_0x1d279d){return function(_0x789fbb){if(_0x789fbb){return _0x789fbb[_0xf7cf('0x27')]()['then'](function(){_0x3ccccc[_0xf7cf('0x1c')](0xcc)[_0xf7cf('0x1d')]();});}};}function handleEntityNotFound(_0x1c5852,_0xc10a8c){return function(_0xc41b6c){if(!_0xc41b6c){_0x1c5852[_0xf7cf('0x1b')](0x194);}return _0xc41b6c;};}function handleError(_0x4b7c6f,_0x1298e7){_0x1298e7=_0x1298e7||0x1f4;return function(_0xa9c794){logger[_0xf7cf('0x28')](_0xa9c794[_0xf7cf('0x29')]);if(_0xa9c794[_0xf7cf('0x2a')]){delete _0xa9c794[_0xf7cf('0x2a')];}_0x4b7c6f[_0xf7cf('0x1c')](_0x1298e7)[_0xf7cf('0x2b')](_0xa9c794);};}exports[_0xf7cf('0x2c')]=function(_0x430138,_0x21e83f){var _0x48e690={},_0x123380={},_0xd4083d={'count':0x0,'rows':[]};var _0x20452d=_['map'](db['VoiceQueueReport'][_0xf7cf('0x2d')],function(_0x44587f){return{'name':_0x44587f[_0xf7cf('0x2e')],'type':_0x44587f[_0xf7cf('0x2f')]['key']};});_0x123380[_0xf7cf('0x30')]=_[_0xf7cf('0x31')](_0x20452d,_0xf7cf('0x2a'));_0x123380[_0xf7cf('0x32')]=_[_0xf7cf('0x33')](_0x430138['query']);_0x123380[_0xf7cf('0x34')]=_[_0xf7cf('0x35')](_0x123380['model'],_0x123380[_0xf7cf('0x32')]);_0x48e690[_0xf7cf('0x36')]=_[_0xf7cf('0x35')](_0x123380[_0xf7cf('0x30')],qs[_0xf7cf('0x37')](_0x430138[_0xf7cf('0x32')]['fields']));_0x48e690[_0xf7cf('0x36')]=_0x48e690[_0xf7cf('0x36')][_0xf7cf('0x38')]?_0x48e690[_0xf7cf('0x36')]:_0x123380['model'];if(!_0x430138[_0xf7cf('0x32')]['hasOwnProperty']('nolimit')){_0x48e690[_0xf7cf('0x21')]=qs[_0xf7cf('0x21')](_0x430138[_0xf7cf('0x32')]['limit']);_0x48e690['offset']=qs[_0xf7cf('0x1f')](_0x430138[_0xf7cf('0x32')]['offset']);}_0x48e690['order']=qs['sort'](_0x430138[_0xf7cf('0x32')][_0xf7cf('0x39')]);_0x48e690['where']=qs['filters'](_['pick'](_0x430138['query'],_0x123380[_0xf7cf('0x34')]),_0x20452d);if(_0x430138['query'][_0xf7cf('0x3a')]){_0x48e690[_0xf7cf('0x3b')]=_[_0xf7cf('0x3c')](_0x48e690[_0xf7cf('0x3b')],{'$or':_[_0xf7cf('0x31')](_0x20452d,function(_0x4b2f69){if(_0x4b2f69['type']!==_0xf7cf('0x3d')){var _0x2b95fa={};_0x2b95fa[_0x4b2f69[_0xf7cf('0x2a')]]={'$like':'%'+_0x430138[_0xf7cf('0x32')][_0xf7cf('0x3a')]+'%'};return _0x2b95fa;}})});}_0x48e690=_[_0xf7cf('0x3c')]({},_0x48e690,_0x430138[_0xf7cf('0x3e')]);var _0x5a0fab={'where':_0x48e690[_0xf7cf('0x3b')]};return db['VoiceQueueReport'][_0xf7cf('0x22')](_0x5a0fab)[_0xf7cf('0x26')](function(_0x16b5d2){_0xd4083d['count']=_0x16b5d2;if(_0x430138[_0xf7cf('0x32')][_0xf7cf('0x3f')]){_0x48e690[_0xf7cf('0x40')]=[{'all':!![]}];}return db[_0xf7cf('0x41')][_0xf7cf('0x42')](_0x48e690);})[_0xf7cf('0x26')](function(_0xf22752){_0xd4083d[_0xf7cf('0x43')]=_0xf22752;return _0xd4083d;})['then'](respondWithFilteredResult(_0x21e83f,_0x48e690))[_0xf7cf('0x44')](handleError(_0x21e83f,null));};exports[_0xf7cf('0x45')]=function(_0x54fe47,_0x5b4be9){var _0x41cf26={'raw':![],'where':{'id':_0x54fe47[_0xf7cf('0x46')]['id']}},_0x36a59b={};_0x36a59b[_0xf7cf('0x30')]=_[_0xf7cf('0x33')](db['VoiceQueueReport'][_0xf7cf('0x2d')]);_0x36a59b[_0xf7cf('0x32')]=_['keys'](_0x54fe47[_0xf7cf('0x32')]);_0x36a59b['filters']=_['intersection'](_0x36a59b[_0xf7cf('0x30')],_0x36a59b[_0xf7cf('0x32')]);_0x41cf26[_0xf7cf('0x36')]=_['intersection'](_0x36a59b[_0xf7cf('0x30')],qs['fields'](_0x54fe47['query'][_0xf7cf('0x37')]));_0x41cf26[_0xf7cf('0x36')]=_0x41cf26[_0xf7cf('0x36')][_0xf7cf('0x38')]?_0x41cf26[_0xf7cf('0x36')]:_0x36a59b[_0xf7cf('0x30')];if(_0x54fe47[_0xf7cf('0x32')][_0xf7cf('0x3f')]){_0x41cf26['include']=[{'all':!![]}];}_0x41cf26=_['merge']({},_0x41cf26,_0x54fe47[_0xf7cf('0x3e')]);return db[_0xf7cf('0x41')]['find'](_0x41cf26)['then'](handleEntityNotFound(_0x5b4be9,null))[_0xf7cf('0x26')](respondWithResult(_0x5b4be9,null))[_0xf7cf('0x44')](handleError(_0x5b4be9,null));};exports[_0xf7cf('0x47')]=function(_0x18e6d3,_0x16843b){return db[_0xf7cf('0x41')]['create'](_0x18e6d3[_0xf7cf('0x48')],{})['then'](respondWithResult(_0x16843b,0xc9))['catch'](handleError(_0x16843b,null));};exports[_0xf7cf('0x25')]=function(_0x5b7d3c,_0x4b41b0){if(_0x5b7d3c[_0xf7cf('0x48')]['id']){delete _0x5b7d3c[_0xf7cf('0x48')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x5b7d3c[_0xf7cf('0x46')]['id']}})[_0xf7cf('0x26')](handleEntityNotFound(_0x4b41b0,null))['then'](saveUpdates(_0x5b7d3c[_0xf7cf('0x48')],null))[_0xf7cf('0x26')](respondWithResult(_0x4b41b0,null))[_0xf7cf('0x44')](handleError(_0x4b41b0,null));};exports[_0xf7cf('0x27')]=function(_0x127627,_0x47adc1){return db[_0xf7cf('0x41')]['find']({'where':{'id':_0x127627[_0xf7cf('0x46')]['id']}})['then'](handleEntityNotFound(_0x47adc1,null))[_0xf7cf('0x26')](removeEntity(_0x47adc1,null))[_0xf7cf('0x44')](handleError(_0x47adc1,null));};exports[_0xf7cf('0x49')]=function(_0x344d31,_0x497dcb){return db[_0xf7cf('0x41')][_0xf7cf('0x49')]()[_0xf7cf('0x26')](respondWithResult(_0x497dcb,null))[_0xf7cf('0x44')](handleError(_0x497dcb,null));};exports[_0xf7cf('0x4a')]=function(_0x536d33,_0x52a25e){var _0x3e3028={},_0x1599d2={},_0x498f95={'count':0x0,'rows':[]};_0x1599d2[_0xf7cf('0x30')]=_['keys'](db['VoiceQueueReport'][_0xf7cf('0x2d')]);_0x1599d2[_0xf7cf('0x32')]=_[_0xf7cf('0x33')](_0x536d33['query']);_0x1599d2[_0xf7cf('0x34')]=_[_0xf7cf('0x35')](_0x1599d2['model'],_0x1599d2['query']);_0x3e3028[_0xf7cf('0x36')]=_[_0xf7cf('0x35')](_0x1599d2[_0xf7cf('0x30')],qs['fields'](_0x536d33['query'][_0xf7cf('0x37')]));_0x3e3028[_0xf7cf('0x36')]=_0x3e3028[_0xf7cf('0x36')][_0xf7cf('0x38')]?_0x3e3028[_0xf7cf('0x36')]:_0x1599d2[_0xf7cf('0x30')];if(!_0x536d33['query']['hasOwnProperty']('nolimit')){_0x3e3028[_0xf7cf('0x21')]=qs[_0xf7cf('0x21')](_0x536d33['query']['limit']);_0x3e3028[_0xf7cf('0x1f')]=qs['offset'](_0x536d33[_0xf7cf('0x32')][_0xf7cf('0x1f')]);}_0x3e3028[_0xf7cf('0x4b')]=qs['sort'](_0x536d33[_0xf7cf('0x32')][_0xf7cf('0x39')]);_0x3e3028[_0xf7cf('0x3b')]=qs['filters'](_[_0xf7cf('0x4c')](_0x536d33[_0xf7cf('0x32')],_0x1599d2['filters']));if(_0x536d33[_0xf7cf('0x32')][_0xf7cf('0x3a')]){_0x3e3028['where']=_[_0xf7cf('0x3c')](_0x3e3028[_0xf7cf('0x3b')],{'$or':_[_0xf7cf('0x31')](_0x3e3028[_0xf7cf('0x36')],function(_0x24f23c){var _0x25a405={};_0x25a405[_0x24f23c]={'$like':'%'+_0x536d33[_0xf7cf('0x32')]['filter']+'%'};return _0x25a405;})});}_0x3e3028=_[_0xf7cf('0x3c')]({},_0x3e3028,_0x536d33['options']);var _0x136396={'where':_0x3e3028[_0xf7cf('0x3b')]};return db[_0xf7cf('0x41')][_0xf7cf('0x22')](_0x136396)[_0xf7cf('0x26')](function(_0x5b6318){_0x498f95[_0xf7cf('0x22')]=_0x5b6318;if(_0x536d33['query'][_0xf7cf('0x3f')]){_0x3e3028[_0xf7cf('0x40')]=[{'all':!![]}];}return db[_0xf7cf('0x41')]['findAll'](_0x3e3028);})['then'](function(_0x423e0b){_0x498f95[_0xf7cf('0x43')]=_0x423e0b;return _0x498f95;})['then'](respondWithFilteredResult(_0x52a25e,_0x3e3028,_0xf7cf('0x4a')))[_0xf7cf('0x44')](handleError(_0x52a25e,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x0687=['then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','rows','catch','show','params','filters','includeAll','create','body','find','describe','getVoiceQueuesReport','pick','eml-format','rimraf','request-promise','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/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x0687,0x16f));var _0x7068=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0687[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x7068('0x0'));var rimraf=require(_0x7068('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7068('0x2'));var moment=require('moment');var BPromise=require(_0x7068('0x3'));var Mustache=require(_0x7068('0x4'));var util=require(_0x7068('0x5'));var path=require('path');var sox=require(_0x7068('0x6'));var csv=require(_0x7068('0x7'));var ejs=require(_0x7068('0x8'));var fs=require('fs');var fs_extra=require(_0x7068('0x9'));var _=require(_0x7068('0xa'));var squel=require(_0x7068('0xb'));var crypto=require(_0x7068('0xc'));var jsforce=require(_0x7068('0xd'));var deskjs=require(_0x7068('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7068('0xf'));var Papa=require(_0x7068('0x10'));var Redis=require('ioredis');var authService=require(_0x7068('0x11'));var qs=require(_0x7068('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7068('0x13'))(_0x7068('0x14'));var utils=require(_0x7068('0x15'));var config=require(_0x7068('0x16'));var licenseUtil=require(_0x7068('0x17'));var db=require(_0x7068('0x18'))['db'];config['redis']=_['defaults'](config[_0x7068('0x19')],{'host':_0x7068('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7068('0x19')]));require(_0x7068('0x1b'))[_0x7068('0x1c')](socket);function respondWithStatusCode(_0x5ec715,_0x478f80){_0x478f80=_0x478f80||0xcc;return function(_0x2cb5c9){if(_0x2cb5c9){return _0x5ec715[_0x7068('0x1d')](_0x478f80);}return _0x5ec715[_0x7068('0x1e')](_0x478f80)[_0x7068('0x1f')]();};}function respondWithResult(_0x39b0fa,_0x385824){_0x385824=_0x385824||0xc8;return function(_0x43d750){if(_0x43d750){return _0x39b0fa['status'](_0x385824)[_0x7068('0x20')](_0x43d750);}};}function respondWithFilteredResult(_0x13bb19,_0x29db4d){return function(_0x2b5e09){if(_0x2b5e09){var _0x27a497=typeof _0x29db4d[_0x7068('0x21')]===_0x7068('0x22')&&typeof _0x29db4d['limit']==='undefined';var _0x4af0f8=_0x2b5e09[_0x7068('0x23')];var _0x596300=_0x27a497?0x0:_0x29db4d[_0x7068('0x21')];var _0x46223a=_0x27a497?_0x2b5e09['count']:_0x29db4d[_0x7068('0x21')]+_0x29db4d[_0x7068('0x24')];var _0x5f2f1c;if(_0x46223a>=_0x4af0f8){_0x46223a=_0x4af0f8;_0x5f2f1c=0xc8;}else{_0x5f2f1c=0xce;}_0x13bb19[_0x7068('0x1e')](_0x5f2f1c);return _0x13bb19[_0x7068('0x25')](_0x7068('0x26'),_0x596300+'-'+_0x46223a+'/'+_0x4af0f8)[_0x7068('0x20')](_0x2b5e09);}return null;};}function patchUpdates(_0x45fdda){return function(_0x4b2d5d){try{jsonpatch[_0x7068('0x27')](_0x4b2d5d,_0x45fdda,!![]);}catch(_0x582954){return BPromise[_0x7068('0x28')](_0x582954);}return _0x4b2d5d[_0x7068('0x29')]();};}function saveUpdates(_0x19b493,_0x33c970){return function(_0x542dd6){if(_0x542dd6){return _0x542dd6[_0x7068('0x2a')](_0x19b493)[_0x7068('0x2b')](function(_0x104565){return _0x104565;});}return null;};}function removeEntity(_0x424cf4,_0x2f0459){return function(_0x7ed9c8){if(_0x7ed9c8){return _0x7ed9c8[_0x7068('0x2c')]()[_0x7068('0x2b')](function(){_0x424cf4[_0x7068('0x1e')](0xcc)[_0x7068('0x1f')]();});}};}function handleEntityNotFound(_0x5c8ce1,_0x19a19f){return function(_0x562fa7){if(!_0x562fa7){_0x5c8ce1[_0x7068('0x1d')](0x194);}return _0x562fa7;};}function handleError(_0x1dcdff,_0x439b25){_0x439b25=_0x439b25||0x1f4;return function(_0xb830e9){logger[_0x7068('0x2d')](_0xb830e9[_0x7068('0x2e')]);if(_0xb830e9[_0x7068('0x2f')]){delete _0xb830e9[_0x7068('0x2f')];}_0x1dcdff[_0x7068('0x1e')](_0x439b25)[_0x7068('0x30')](_0xb830e9);};}exports[_0x7068('0x31')]=function(_0x47c0ac,_0x136611){var _0x36e390={},_0x1463ea={},_0x186745={'count':0x0,'rows':[]};var _0x2b5ca3=_[_0x7068('0x32')](db[_0x7068('0x33')][_0x7068('0x34')],function(_0x2da747){return{'name':_0x2da747['fieldName'],'type':_0x2da747[_0x7068('0x35')]['key']};});_0x1463ea['model']=_['map'](_0x2b5ca3,'name');_0x1463ea[_0x7068('0x36')]=_[_0x7068('0x37')](_0x47c0ac[_0x7068('0x36')]);_0x1463ea['filters']=_[_0x7068('0x38')](_0x1463ea[_0x7068('0x39')],_0x1463ea['query']);_0x36e390['attributes']=_[_0x7068('0x38')](_0x1463ea[_0x7068('0x39')],qs['fields'](_0x47c0ac[_0x7068('0x36')][_0x7068('0x3a')]));_0x36e390[_0x7068('0x3b')]=_0x36e390[_0x7068('0x3b')][_0x7068('0x3c')]?_0x36e390[_0x7068('0x3b')]:_0x1463ea['model'];if(!_0x47c0ac[_0x7068('0x36')][_0x7068('0x3d')](_0x7068('0x3e'))){_0x36e390[_0x7068('0x24')]=qs['limit'](_0x47c0ac[_0x7068('0x36')][_0x7068('0x24')]);_0x36e390[_0x7068('0x21')]=qs[_0x7068('0x21')](_0x47c0ac[_0x7068('0x36')][_0x7068('0x21')]);}_0x36e390[_0x7068('0x3f')]=qs[_0x7068('0x40')](_0x47c0ac[_0x7068('0x36')][_0x7068('0x40')]);_0x36e390[_0x7068('0x41')]=qs['filters'](_['pick'](_0x47c0ac[_0x7068('0x36')],_0x1463ea['filters']),_0x2b5ca3);if(_0x47c0ac[_0x7068('0x36')][_0x7068('0x42')]){_0x36e390['where']=_['merge'](_0x36e390[_0x7068('0x41')],{'$or':_[_0x7068('0x32')](_0x2b5ca3,function(_0x149023){if(_0x149023[_0x7068('0x35')]!=='VIRTUAL'){var _0x2e0a3e={};_0x2e0a3e[_0x149023['name']]={'$like':'%'+_0x47c0ac['query']['filter']+'%'};return _0x2e0a3e;}})});}_0x36e390=_[_0x7068('0x43')]({},_0x36e390,_0x47c0ac[_0x7068('0x44')]);var _0xc1a233={'where':_0x36e390[_0x7068('0x41')]};return db[_0x7068('0x33')][_0x7068('0x23')](_0xc1a233)[_0x7068('0x2b')](function(_0x418350){_0x186745['count']=_0x418350;if(_0x47c0ac['query']['includeAll']){_0x36e390[_0x7068('0x45')]=[{'all':!![]}];}return db[_0x7068('0x33')]['findAll'](_0x36e390);})[_0x7068('0x2b')](function(_0x3b832e){_0x186745[_0x7068('0x46')]=_0x3b832e;return _0x186745;})[_0x7068('0x2b')](respondWithFilteredResult(_0x136611,_0x36e390))[_0x7068('0x47')](handleError(_0x136611,null));};exports[_0x7068('0x48')]=function(_0xfa997e,_0x25b868){var _0x51af3c={'raw':![],'where':{'id':_0xfa997e[_0x7068('0x49')]['id']}},_0x34b011={};_0x34b011[_0x7068('0x39')]=_[_0x7068('0x37')](db[_0x7068('0x33')][_0x7068('0x34')]);_0x34b011[_0x7068('0x36')]=_[_0x7068('0x37')](_0xfa997e['query']);_0x34b011[_0x7068('0x4a')]=_[_0x7068('0x38')](_0x34b011[_0x7068('0x39')],_0x34b011['query']);_0x51af3c[_0x7068('0x3b')]=_['intersection'](_0x34b011[_0x7068('0x39')],qs[_0x7068('0x3a')](_0xfa997e['query'][_0x7068('0x3a')]));_0x51af3c[_0x7068('0x3b')]=_0x51af3c['attributes'][_0x7068('0x3c')]?_0x51af3c['attributes']:_0x34b011[_0x7068('0x39')];if(_0xfa997e[_0x7068('0x36')][_0x7068('0x4b')]){_0x51af3c[_0x7068('0x45')]=[{'all':!![]}];}_0x51af3c=_[_0x7068('0x43')]({},_0x51af3c,_0xfa997e[_0x7068('0x44')]);return db['VoiceQueueReport']['find'](_0x51af3c)['then'](handleEntityNotFound(_0x25b868,null))['then'](respondWithResult(_0x25b868,null))[_0x7068('0x47')](handleError(_0x25b868,null));};exports[_0x7068('0x4c')]=function(_0x2c5f80,_0x51dc48){return db[_0x7068('0x33')][_0x7068('0x4c')](_0x2c5f80['body'],{})[_0x7068('0x2b')](respondWithResult(_0x51dc48,0xc9))[_0x7068('0x47')](handleError(_0x51dc48,null));};exports[_0x7068('0x2a')]=function(_0x450383,_0x454656){if(_0x450383[_0x7068('0x4d')]['id']){delete _0x450383[_0x7068('0x4d')]['id'];}return db['VoiceQueueReport'][_0x7068('0x4e')]({'where':{'id':_0x450383['params']['id']}})['then'](handleEntityNotFound(_0x454656,null))[_0x7068('0x2b')](saveUpdates(_0x450383['body'],null))[_0x7068('0x2b')](respondWithResult(_0x454656,null))['catch'](handleError(_0x454656,null));};exports['destroy']=function(_0x488484,_0x2fa5aa){return db[_0x7068('0x33')][_0x7068('0x4e')]({'where':{'id':_0x488484['params']['id']}})[_0x7068('0x2b')](handleEntityNotFound(_0x2fa5aa,null))[_0x7068('0x2b')](removeEntity(_0x2fa5aa,null))[_0x7068('0x47')](handleError(_0x2fa5aa,null));};exports[_0x7068('0x4f')]=function(_0x4600bc,_0x12da64){return db['VoiceQueueReport']['describe']()[_0x7068('0x2b')](respondWithResult(_0x12da64,null))['catch'](handleError(_0x12da64,null));};exports[_0x7068('0x50')]=function(_0x5e5c94,_0x260815){var _0x5b652a={},_0x1f7a41={},_0x577364={'count':0x0,'rows':[]};_0x1f7a41[_0x7068('0x39')]=_[_0x7068('0x37')](db[_0x7068('0x33')]['rawAttributes']);_0x1f7a41[_0x7068('0x36')]=_['keys'](_0x5e5c94[_0x7068('0x36')]);_0x1f7a41[_0x7068('0x4a')]=_[_0x7068('0x38')](_0x1f7a41['model'],_0x1f7a41['query']);_0x5b652a[_0x7068('0x3b')]=_[_0x7068('0x38')](_0x1f7a41[_0x7068('0x39')],qs[_0x7068('0x3a')](_0x5e5c94[_0x7068('0x36')][_0x7068('0x3a')]));_0x5b652a[_0x7068('0x3b')]=_0x5b652a['attributes'][_0x7068('0x3c')]?_0x5b652a[_0x7068('0x3b')]:_0x1f7a41[_0x7068('0x39')];if(!_0x5e5c94['query']['hasOwnProperty'](_0x7068('0x3e'))){_0x5b652a[_0x7068('0x24')]=qs[_0x7068('0x24')](_0x5e5c94[_0x7068('0x36')][_0x7068('0x24')]);_0x5b652a['offset']=qs[_0x7068('0x21')](_0x5e5c94[_0x7068('0x36')][_0x7068('0x21')]);}_0x5b652a[_0x7068('0x3f')]=qs[_0x7068('0x40')](_0x5e5c94[_0x7068('0x36')][_0x7068('0x40')]);_0x5b652a[_0x7068('0x41')]=qs[_0x7068('0x4a')](_[_0x7068('0x51')](_0x5e5c94[_0x7068('0x36')],_0x1f7a41[_0x7068('0x4a')]));if(_0x5e5c94[_0x7068('0x36')][_0x7068('0x42')]){_0x5b652a['where']=_[_0x7068('0x43')](_0x5b652a[_0x7068('0x41')],{'$or':_['map'](_0x5b652a[_0x7068('0x3b')],function(_0x429a6c){var _0xb367d8={};_0xb367d8[_0x429a6c]={'$like':'%'+_0x5e5c94[_0x7068('0x36')]['filter']+'%'};return _0xb367d8;})});}_0x5b652a=_[_0x7068('0x43')]({},_0x5b652a,_0x5e5c94[_0x7068('0x44')]);var _0x33aa47={'where':_0x5b652a[_0x7068('0x41')]};return db[_0x7068('0x33')]['count'](_0x33aa47)[_0x7068('0x2b')](function(_0x1c28bb){_0x577364[_0x7068('0x23')]=_0x1c28bb;if(_0x5e5c94[_0x7068('0x36')]['includeAll']){_0x5b652a[_0x7068('0x45')]=[{'all':!![]}];}return db[_0x7068('0x33')]['findAll'](_0x5b652a);})['then'](function(_0x19700){_0x577364[_0x7068('0x46')]=_0x19700;return _0x577364;})[_0x7068('0x2b')](respondWithFilteredResult(_0x260815,_0x5b652a,_0x7068('0x50')))[_0x7068('0x47')](handleError(_0x260815,null,_0x7068('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 418733f..83b0c62 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 _0x9c17=['update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x9c17,0xff));var _0x79c1=function(_0x3e779c,_0x546ea2){_0x3e779c=_0x3e779c-0x0;var _0x22ab11=_0x9c17[_0x3e779c];return _0x22ab11;};'use strict';var EventEmitter=require(_0x79c1('0x0'));var VoiceQueueReport=require(_0x79c1('0x1'))['db'][_0x79c1('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x79c1('0x3')](0x0);var events={'afterCreate':_0x79c1('0x4'),'afterUpdate':_0x79c1('0x5'),'afterDestroy':_0x79c1('0x6')};function emitEvent(_0x4955f3){return function(_0x1a0533,_0x4a477a,_0x23560f){VoiceQueueReportEvents[_0x79c1('0x7')](_0x4955f3+':'+_0x1a0533['id'],_0x1a0533);VoiceQueueReportEvents[_0x79c1('0x7')](_0x4955f3,_0x1a0533);_0x23560f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x79c1('0x8')](e,emitEvent(event));}}module[_0x79c1('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x01c6=['update','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0x01c6,0xb8));var _0x601c=function(_0xdfc87d,_0x28e1a5){_0xdfc87d=_0xdfc87d-0x0;var _0x4e2a5e=_0x01c6[_0xdfc87d];return _0x4e2a5e;};'use strict';var EventEmitter=require(_0x601c('0x0'));var VoiceQueueReport=require(_0x601c('0x1'))['db'][_0x601c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x601c('0x3')](0x0);var events={'afterCreate':_0x601c('0x4'),'afterUpdate':_0x601c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3caad8){return function(_0xc9639a,_0x44ce2f,_0x9516e1){VoiceQueueReportEvents['emit'](_0x3caad8+':'+_0xc9639a['id'],_0xc9639a);VoiceQueueReportEvents['emit'](_0x3caad8,_0xc9639a);_0x9516e1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x601c('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 41738b0..2198cc4 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 _0xf5c0=['lodash','util','../../config/logger','api','moment','bluebird','path','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','calleridnum'];(function(_0x235ad6,_0x5e4437){var _0x2885d9=function(_0x3e55ba){while(--_0x3e55ba){_0x235ad6['push'](_0x235ad6['shift']());}};_0x2885d9(++_0x5e4437);}(_0xf5c0,0x1e0));var _0x0f5c=function(_0x59cd35,_0x5a9053){_0x59cd35=_0x59cd35-0x0;var _0x26e325=_0xf5c0[_0x59cd35];return _0x26e325;};'use strict';var _=require(_0x0f5c('0x0'));var util=require(_0x0f5c('0x1'));var logger=require(_0x0f5c('0x2'))(_0x0f5c('0x3'));var moment=require(_0x0f5c('0x4'));var BPromise=require(_0x0f5c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f5c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0f5c('0x7'));module[_0x0f5c('0x8')]=function(_0x3936a5,_0x1da000){return _0x3936a5['define'](_0x0f5c('0x9'),attributes,{'tableName':_0x0f5c('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0f5c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1fc2=['VoiceQueueReport','uniqueid','calleridnum','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','define'];(function(_0x8150e7,_0x40f472){var _0x2418a3=function(_0x31e66c){while(--_0x31e66c){_0x8150e7['push'](_0x8150e7['shift']());}};_0x2418a3(++_0x40f472);}(_0x1fc2,0x9d));var _0x21fc=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x1fc2[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x21fc('0x0'));var util=require('util');var logger=require(_0x21fc('0x1'))('api');var moment=require(_0x21fc('0x2'));var BPromise=require('bluebird');var rp=require(_0x21fc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x21fc('0x4'));var config=require(_0x21fc('0x5'));var attributes=require(_0x21fc('0x6'));module['exports']=function(_0x34dea5,_0x114e7c){return _0x34dea5[_0x21fc('0x7')](_0x21fc('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x21fc('0x9')]},{'fields':[_0x21fc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index add8822..2805da8 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 _0x5b30=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','GetVoiceQueueReport','debug','body','CreateVoiceQueueReport','update','where','UpdateVoiceQueueReport','lodash','bluebird','randomstring'];(function(_0x2dd95b,_0x4cd1f1){var _0x535856=function(_0x29fbaf){while(--_0x29fbaf){_0x2dd95b['push'](_0x2dd95b['shift']());}};_0x535856(++_0x4cd1f1);}(_0x5b30,0x9d));var _0x05b3=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x5b30[_0x3cae69];return _0x3128eb;};'use strict';var _=require(_0x05b3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x05b3('0x1'));var rs=require(_0x05b3('0x2'));var fs=require('fs');var Redis=require(_0x05b3('0x3'));var db=require(_0x05b3('0x4'))['db'];var utils=require(_0x05b3('0x5'));var logger=require('../../config/logger')(_0x05b3('0x6'));var config=require(_0x05b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x05b3('0x8')]['http']({'port':0x232a});config['redis']=_[_0x05b3('0x9')](config[_0x05b3('0xa')],{'host':_0x05b3('0xb'),'port':0x18eb});var socket=require(_0x05b3('0xc'))(new Redis(config['redis']));require(_0x05b3('0xd'))['register'](socket);function respondWithRpcPromise(_0x21b103,_0x2df6d5,_0x4ecb43){return new BPromise(function(_0x3071d1,_0x209374){return client[_0x05b3('0xe')](_0x21b103,_0x4ecb43)[_0x05b3('0xf')](function(_0x6410d9){logger[_0x05b3('0x10')](_0x05b3('0x11'),_0x2df6d5,_0x05b3('0x12'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2df6d5,_0x05b3('0x12'),JSON[_0x05b3('0x13')](_0x6410d9));if(_0x6410d9[_0x05b3('0x14')]){if(_0x6410d9[_0x05b3('0x14')][_0x05b3('0x15')]===0x1f4){logger[_0x05b3('0x14')](_0x05b3('0x11'),_0x2df6d5,_0x6410d9[_0x05b3('0x14')][_0x05b3('0x16')]);return _0x209374(_0x6410d9['error'][_0x05b3('0x16')]);}logger['error'](_0x05b3('0x11'),_0x2df6d5,_0x6410d9[_0x05b3('0x14')][_0x05b3('0x16')]);return _0x3071d1(_0x6410d9[_0x05b3('0x14')][_0x05b3('0x16')]);}else{logger['info'](_0x05b3('0x11'),_0x2df6d5,_0x05b3('0x12'));_0x3071d1(_0x6410d9['result'][_0x05b3('0x16')]);}})[_0x05b3('0x17')](function(_0x1cb4b8){logger[_0x05b3('0x14')](_0x05b3('0x11'),_0x2df6d5,_0x1cb4b8);_0x209374(_0x1cb4b8);});});}exports['GetVoiceQueueReport']=function(_0x47c722){var _0x5224c8=this;return new Promise(function(_0x52c55f,_0x56a8f8){return db[_0x05b3('0x18')][_0x05b3('0x19')]({'raw':_0x47c722[_0x05b3('0x1a')]?_0x47c722[_0x05b3('0x1a')][_0x05b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x47c722[_0x05b3('0x1a')]?_0x47c722[_0x05b3('0x1a')]['where']||null:null,'attributes':_0x47c722['options']?_0x47c722[_0x05b3('0x1a')][_0x05b3('0x1c')]||null:null,'limit':_0x47c722[_0x05b3('0x1a')]?_0x47c722[_0x05b3('0x1a')][_0x05b3('0x1d')]||null:null,'include':_0x47c722[_0x05b3('0x1a')]?_0x47c722[_0x05b3('0x1a')][_0x05b3('0x1e')]?_[_0x05b3('0x1f')](_0x47c722[_0x05b3('0x1a')]['include'],function(_0x2657d1){return{'model':db[_0x2657d1['model']],'as':_0x2657d1['as'],'attributes':_0x2657d1[_0x05b3('0x1c')],'include':_0x2657d1['include']?_[_0x05b3('0x1f')](_0x2657d1['include'],function(_0x3a4a6f){return{'model':db[_0x3a4a6f[_0x05b3('0x20')]],'as':_0x3a4a6f['as'],'attributes':_0x3a4a6f[_0x05b3('0x1c')],'include':_0x3a4a6f[_0x05b3('0x1e')]?_['map'](_0x3a4a6f['include'],function(_0x10722f){return{'model':db[_0x10722f[_0x05b3('0x20')]],'as':_0x10722f['as'],'attributes':_0x10722f[_0x05b3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e45b9){logger[_0x05b3('0x10')](_0x05b3('0x21'),_0x47c722);logger[_0x05b3('0x22')](_0x05b3('0x21'),_0x47c722,JSON[_0x05b3('0x13')](_0x2e45b9));_0x52c55f(_0x2e45b9);})[_0x05b3('0x17')](function(_0x124625){logger['error'](_0x05b3('0x21'),_0x124625[_0x05b3('0x16')],_0x47c722);_0x56a8f8(_0x5224c8[_0x05b3('0x14')](0x1f4,_0x124625[_0x05b3('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x165b17){var _0x19d92a=this;return new Promise(function(_0xc7f399,_0x4a5c12){return db[_0x05b3('0x18')]['create'](_0x165b17[_0x05b3('0x23')],{'raw':_0x165b17[_0x05b3('0x1a')]?_0x165b17[_0x05b3('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x05b3('0xf')](function(_0x5af614){logger[_0x05b3('0x10')]('CreateVoiceQueueReport',_0x165b17);logger[_0x05b3('0x22')](_0x05b3('0x24'),_0x165b17,JSON['stringify'](_0x5af614));_0xc7f399(_0x5af614);})['catch'](function(_0x2bb5b5){logger[_0x05b3('0x14')](_0x05b3('0x24'),_0x2bb5b5[_0x05b3('0x16')],_0x165b17);_0x4a5c12(_0x19d92a[_0x05b3('0x14')](0x1f4,_0x2bb5b5[_0x05b3('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x302bd7){var _0xcb03bc=this;return new Promise(function(_0x45af65,_0x448c3d){return db[_0x05b3('0x18')][_0x05b3('0x25')](_0x302bd7[_0x05b3('0x23')],{'raw':_0x302bd7[_0x05b3('0x1a')]?_0x302bd7[_0x05b3('0x1a')][_0x05b3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x302bd7[_0x05b3('0x1a')]?_0x302bd7['options'][_0x05b3('0x26')]||null:null,'attributes':_0x302bd7[_0x05b3('0x1a')]?_0x302bd7['options'][_0x05b3('0x1c')]||null:null,'limit':_0x302bd7['options']?_0x302bd7[_0x05b3('0x1a')][_0x05b3('0x1d')]||null:null})['then'](function(_0x1e4281){logger[_0x05b3('0x10')](_0x05b3('0x27'),_0x302bd7);logger[_0x05b3('0x22')](_0x05b3('0x27'),_0x302bd7,JSON['stringify'](_0x1e4281));_0x45af65(_0x1e4281);})[_0x05b3('0x17')](function(_0x34799d){logger[_0x05b3('0x14')](_0x05b3('0x27'),_0x34799d[_0x05b3('0x16')],_0x302bd7);_0x448c3d(_0xcb03bc['error'](0x1f4,_0x34799d[_0x05b3('0x16')]));});});}; \ No newline at end of file +var _0x059c=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','VoiceQueueReport','findAll','options','raw','where','attributes','map','include','model','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','limit','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x335db1,_0x3434ba){var _0x14bcc4=function(_0x4e7d16){while(--_0x4e7d16){_0x335db1['push'](_0x335db1['shift']());}};_0x14bcc4(++_0x3434ba);}(_0x059c,0xda));var _0xc059=function(_0x373b3e,_0x347ac7){_0x373b3e=_0x373b3e-0x0;var _0xa4ce3=_0x059c[_0x373b3e];return _0xa4ce3;};'use strict';var _=require(_0xc059('0x0'));var util=require(_0xc059('0x1'));var moment=require('moment');var BPromise=require(_0xc059('0x2'));var rs=require(_0xc059('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc059('0x4'));var logger=require(_0xc059('0x5'))(_0xc059('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc059('0x7')]['http']({'port':0x232a});config[_0xc059('0x8')]=_[_0xc059('0x9')](config[_0xc059('0x8')],{'host':_0xc059('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc059('0x8')]));require('./voiceQueueReport.socket')[_0xc059('0xb')](socket);function respondWithRpcPromise(_0xa636ea,_0x235af1,_0xe1f4a7){return new BPromise(function(_0x35674d,_0x4500d9){return client[_0xc059('0xc')](_0xa636ea,_0xe1f4a7)[_0xc059('0xd')](function(_0x5d0803){logger['info'](_0xc059('0xe'),_0x235af1,_0xc059('0xf'));logger['debug'](_0xc059('0x10'),_0x235af1,_0xc059('0xf'),JSON['stringify'](_0x5d0803));if(_0x5d0803[_0xc059('0x11')]){if(_0x5d0803[_0xc059('0x11')][_0xc059('0x12')]===0x1f4){logger['error'](_0xc059('0xe'),_0x235af1,_0x5d0803[_0xc059('0x11')][_0xc059('0x13')]);return _0x4500d9(_0x5d0803['error'][_0xc059('0x13')]);}logger[_0xc059('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x235af1,_0x5d0803['error'][_0xc059('0x13')]);return _0x35674d(_0x5d0803[_0xc059('0x11')]['message']);}else{logger[_0xc059('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x235af1,_0xc059('0xf'));_0x35674d(_0x5d0803['result'][_0xc059('0x13')]);}})[_0xc059('0x15')](function(_0xb70e85){logger[_0xc059('0x11')](_0xc059('0xe'),_0x235af1,_0xb70e85);_0x4500d9(_0xb70e85);});});}exports['GetVoiceQueueReport']=function(_0x1f18f9){var _0x16def5=this;return new Promise(function(_0x502783,_0x236db1){return db[_0xc059('0x16')][_0xc059('0x17')]({'raw':_0x1f18f9[_0xc059('0x18')]?_0x1f18f9[_0xc059('0x18')][_0xc059('0x19')]===undefined?!![]:![]:!![],'where':_0x1f18f9[_0xc059('0x18')]?_0x1f18f9[_0xc059('0x18')][_0xc059('0x1a')]||null:null,'attributes':_0x1f18f9[_0xc059('0x18')]?_0x1f18f9[_0xc059('0x18')][_0xc059('0x1b')]||null:null,'limit':_0x1f18f9[_0xc059('0x18')]?_0x1f18f9[_0xc059('0x18')]['limit']||null:null,'include':_0x1f18f9['options']?_0x1f18f9[_0xc059('0x18')]['include']?_[_0xc059('0x1c')](_0x1f18f9[_0xc059('0x18')][_0xc059('0x1d')],function(_0x18f490){return{'model':db[_0x18f490[_0xc059('0x1e')]],'as':_0x18f490['as'],'attributes':_0x18f490[_0xc059('0x1b')],'include':_0x18f490[_0xc059('0x1d')]?_[_0xc059('0x1c')](_0x18f490[_0xc059('0x1d')],function(_0x4f7bd2){return{'model':db[_0x4f7bd2[_0xc059('0x1e')]],'as':_0x4f7bd2['as'],'attributes':_0x4f7bd2['attributes'],'include':_0x4f7bd2[_0xc059('0x1d')]?_['map'](_0x4f7bd2['include'],function(_0x26e9d9){return{'model':db[_0x26e9d9[_0xc059('0x1e')]],'as':_0x26e9d9['as'],'attributes':_0x26e9d9[_0xc059('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc059('0xd')](function(_0xe861d8){logger[_0xc059('0x14')](_0xc059('0x1f'),_0x1f18f9);logger['debug'](_0xc059('0x1f'),_0x1f18f9,JSON[_0xc059('0x20')](_0xe861d8));_0x502783(_0xe861d8);})[_0xc059('0x15')](function(_0x34f603){logger[_0xc059('0x11')](_0xc059('0x1f'),_0x34f603[_0xc059('0x13')],_0x1f18f9);_0x236db1(_0x16def5[_0xc059('0x11')](0x1f4,_0x34f603[_0xc059('0x13')]));});});};exports[_0xc059('0x21')]=function(_0x137b42){var _0x12ca89=this;return new Promise(function(_0x361314,_0x1c1238){return db['VoiceQueueReport'][_0xc059('0x22')](_0x137b42[_0xc059('0x23')],{'raw':_0x137b42[_0xc059('0x18')]?_0x137b42[_0xc059('0x18')][_0xc059('0x19')]===undefined?!![]:![]:!![]})[_0xc059('0xd')](function(_0x3d9061){logger[_0xc059('0x14')]('CreateVoiceQueueReport',_0x137b42);logger[_0xc059('0x24')](_0xc059('0x21'),_0x137b42,JSON['stringify'](_0x3d9061));_0x361314(_0x3d9061);})[_0xc059('0x15')](function(_0xe9d579){logger[_0xc059('0x11')](_0xc059('0x21'),_0xe9d579['message'],_0x137b42);_0x1c1238(_0x12ca89[_0xc059('0x11')](0x1f4,_0xe9d579[_0xc059('0x13')]));});});};exports[_0xc059('0x25')]=function(_0x3834b3){var _0x1a45cd=this;return new Promise(function(_0x5a88f8,_0xd762f8){return db[_0xc059('0x16')]['update'](_0x3834b3['body'],{'raw':_0x3834b3[_0xc059('0x18')]?_0x3834b3['options'][_0xc059('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3834b3[_0xc059('0x18')]?_0x3834b3[_0xc059('0x18')][_0xc059('0x1a')]||null:null,'attributes':_0x3834b3[_0xc059('0x18')]?_0x3834b3['options']['attributes']||null:null,'limit':_0x3834b3[_0xc059('0x18')]?_0x3834b3['options'][_0xc059('0x26')]||null:null})['then'](function(_0x50cf18){logger[_0xc059('0x14')](_0xc059('0x25'),_0x3834b3);logger[_0xc059('0x24')]('UpdateVoiceQueueReport',_0x3834b3,JSON[_0xc059('0x20')](_0x50cf18));_0x5a88f8(_0x50cf18);})['catch'](function(_0x3158f1){logger['error'](_0xc059('0x25'),_0x3158f1[_0xc059('0x13')],_0x3834b3);_0xd762f8(_0x1a45cd[_0xc059('0x11')](0x1f4,_0x3158f1[_0xc059('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b477963..b129720 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 _0x1e6c=['./voiceQueueReport.events','remove','update','removeListener','register','length'];(function(_0x4ad94a,_0x428963){var _0xebe74a=function(_0x18cf77){while(--_0x18cf77){_0x4ad94a['push'](_0x4ad94a['shift']());}};_0xebe74a(++_0x428963);}(_0x1e6c,0x11a));var _0xc1e6=function(_0x20b18f,_0xf29421){_0x20b18f=_0x20b18f-0x0;var _0x510ea8=_0x1e6c[_0x20b18f];return _0x510ea8;};'use strict';var VoiceQueueReportEvents=require(_0xc1e6('0x0'));var events=['save',_0xc1e6('0x1'),_0xc1e6('0x2')];function createListener(_0x3eea0c,_0x17d44e){return function(_0x21faab){_0x17d44e['emit'](_0x3eea0c,_0x21faab);};}function removeListener(_0x579250,_0x477d95){return function(){VoiceQueueReportEvents[_0xc1e6('0x3')](_0x579250,_0x477d95);};}exports[_0xc1e6('0x4')]=function(_0x157b8d){for(var _0x36968b=0x0,_0x36c625=events[_0xc1e6('0x5')];_0x36968b<_0x36c625;_0x36968b++){var _0x5cd563=events[_0x36968b];var _0x399c3e=createListener('voiceQueueReport:'+_0x5cd563,_0x157b8d);VoiceQueueReportEvents['on'](_0x5cd563,_0x399c3e);}}; \ No newline at end of file +var _0x8ce1=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x4d6aa7,_0x1cc48c){var _0x5275ec=function(_0x5c6a83){while(--_0x5c6a83){_0x4d6aa7['push'](_0x4d6aa7['shift']());}};_0x5275ec(++_0x1cc48c);}(_0x8ce1,0x183));var _0x18ce=function(_0x70e80,_0x1410ee){_0x70e80=_0x70e80-0x0;var _0x51a0cf=_0x8ce1[_0x70e80];return _0x51a0cf;};'use strict';var VoiceQueueReportEvents=require(_0x18ce('0x0'));var events=[_0x18ce('0x1'),_0x18ce('0x2'),_0x18ce('0x3')];function createListener(_0x202f93,_0x22b196){return function(_0x211dc4){_0x22b196[_0x18ce('0x4')](_0x202f93,_0x211dc4);};}function removeListener(_0x1d842c,_0x15f55e){return function(){VoiceQueueReportEvents[_0x18ce('0x5')](_0x1d842c,_0x15f55e);};}exports[_0x18ce('0x6')]=function(_0x13ff9d){for(var _0x36f8db=0x0,_0x682d4b=events[_0x18ce('0x7')];_0x36f8db<_0x682d4b;_0x36f8db++){var _0x4ebf82=events[_0x36f8db];var _0x1a60c5=createListener(_0x18ce('0x8')+_0x4ebf82,_0x13ff9d);VoiceQueueReportEvents['on'](_0x4ebf82,_0x1a60c5);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index f5a2d82..ee655e4 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 _0xc5f5=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','create','put','update','delete'];(function(_0x27a299,_0x3d99b4){var _0x30c1ff=function(_0x20306a){while(--_0x20306a){_0x27a299['push'](_0x27a299['shift']());}};_0x30c1ff(++_0x3d99b4);}(_0xc5f5,0x1ca));var _0x5c5f=function(_0x45bc11,_0xf270b5){_0x45bc11=_0x45bc11-0x0;var _0x11e84e=_0xc5f5[_0x45bc11];return _0x11e84e;};'use strict';var multer=require(_0x5c5f('0x0'));var util=require(_0x5c5f('0x1'));var path=require(_0x5c5f('0x2'));var timeout=require('connect-timeout');var express=require(_0x5c5f('0x3'));var router=express[_0x5c5f('0x4')]();var fs_extra=require(_0x5c5f('0x5'));var auth=require(_0x5c5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5c5f('0x7'));var controller=require(_0x5c5f('0x8'));router[_0x5c5f('0x9')]('/',auth[_0x5c5f('0xa')](),controller[_0x5c5f('0xb')]);router[_0x5c5f('0x9')](_0x5c5f('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5c5f('0xd')]);router[_0x5c5f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5c5f('0xf')]);router[_0x5c5f('0x10')](_0x5c5f('0xc'),auth[_0x5c5f('0xa')](),controller[_0x5c5f('0x11')]);module[_0x5c5f('0x12')]=router; \ No newline at end of file +var _0xf925=['delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','update'];(function(_0xa2867,_0x4f70d0){var _0x58ffb9=function(_0x28a6d6){while(--_0x28a6d6){_0xa2867['push'](_0xa2867['shift']());}};_0x58ffb9(++_0x4f70d0);}(_0xf925,0x1a7));var _0x5f92=function(_0x481ee8,_0x5aa574){_0x481ee8=_0x481ee8-0x0;var _0x5ad55f=_0xf925[_0x481ee8];return _0x5ad55f;};'use strict';var multer=require(_0x5f92('0x0'));var util=require(_0x5f92('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5f92('0x2'));var auth=require(_0x5f92('0x3'));var interaction=require(_0x5f92('0x4'));var config=require('../../config/environment');var controller=require(_0x5f92('0x5'));router[_0x5f92('0x6')]('/',auth[_0x5f92('0x7')](),controller['index']);router[_0x5f92('0x6')](_0x5f92('0x8'),auth[_0x5f92('0x7')](),controller[_0x5f92('0x9')]);router[_0x5f92('0xa')]('/',auth[_0x5f92('0x7')](),controller['create']);router['put'](_0x5f92('0x8'),auth['isAuthenticated'](),controller[_0x5f92('0xb')]);router[_0x5f92('0xc')](_0x5f92('0x8'),auth['isAuthenticated'](),controller[_0x5f92('0xd')]);module[_0x5f92('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6ceefb8..15e79f7 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 _0x0b06=['sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1a540d,_0x2c6ca6){var _0x6d88e9=function(_0x1792ac){while(--_0x1792ac){_0x1a540d['push'](_0x1a540d['shift']());}};_0x6d88e9(++_0x2c6ca6);}(_0x0b06,0x11f));var _0x60b0=function(_0x2ae675,_0x3822dc){_0x2ae675=_0x2ae675-0x0;var _0xce803d=_0x0b06[_0x2ae675];return _0xce803d;};'use strict';var Sequelize=require(_0x60b0('0x0'));var moment=require(_0x60b0('0x1'));module[_0x60b0('0x2')]={'time':{'type':Sequelize[_0x60b0('0x3')]},'callid':{'type':Sequelize[_0x60b0('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x60b0('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x60b0('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x60b0('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x60b0('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x60b0('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x60b0('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x60b0('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x60b0('0x4')],'allowNull':![],'defaultValue':moment()[_0x60b0('0x5')](_0x60b0('0x6'))}}; \ No newline at end of file +var _0x858c=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x858c,0x17e));var _0xc858=function(_0x5cd26d,_0x18bd79){_0x5cd26d=_0x5cd26d-0x0;var _0x5264f7=_0x858c[_0x5cd26d];return _0x5264f7;};'use strict';var Sequelize=require(_0xc858('0x0'));var moment=require('moment');module[_0xc858('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc858('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc858('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc858('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc858('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc858('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc858('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc858('0x3')],'allowNull':![],'defaultValue':moment()[_0xc858('0x4')](_0xc858('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a3a3014..8e93cbe 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 _0x21a0=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VoiceQueuesLog','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status'];(function(_0x1bc173,_0x1f46f5){var _0x2815a0=function(_0x30bcdc){while(--_0x30bcdc){_0x1bc173['push'](_0x1bc173['shift']());}};_0x2815a0(++_0x1f46f5);}(_0x21a0,0x75));var _0x021a=function(_0x50bed8,_0x395957){_0x50bed8=_0x50bed8-0x0;var _0x1ae771=_0x21a0[_0x50bed8];return _0x1ae771;};'use strict';var emlformat=require(_0x021a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x021a('0x1'));var jsonpatch=require(_0x021a('0x2'));var rp=require('request-promise');var moment=require(_0x021a('0x3'));var BPromise=require(_0x021a('0x4'));var Mustache=require(_0x021a('0x5'));var util=require('util');var path=require(_0x021a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x021a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x021a('0x8'));var squel=require(_0x021a('0x9'));var crypto=require(_0x021a('0xa'));var jsforce=require(_0x021a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x021a('0xc'));var querystring=require('querystring');var Papa=require(_0x021a('0xd'));var Redis=require(_0x021a('0xe'));var authService=require(_0x021a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x021a('0x10'));var hardwareService=require(_0x021a('0x11'));var logger=require(_0x021a('0x12'))(_0x021a('0x13'));var utils=require(_0x021a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x021a('0x15'))['db'];function respondWithStatusCode(_0x19cdd8,_0x58a319){_0x58a319=_0x58a319||0xcc;return function(_0xffe574){if(_0xffe574){return _0x19cdd8[_0x021a('0x16')](_0x58a319);}return _0x19cdd8['status'](_0x58a319)[_0x021a('0x17')]();};}function respondWithResult(_0xc25051,_0x5c7aab){_0x5c7aab=_0x5c7aab||0xc8;return function(_0x1ff0e1){if(_0x1ff0e1){return _0xc25051[_0x021a('0x18')](_0x5c7aab)[_0x021a('0x19')](_0x1ff0e1);}};}function respondWithFilteredResult(_0x4b06d3,_0x5eeeca){return function(_0x5a29ec){if(_0x5a29ec){var _0x2868d8=typeof _0x5eeeca[_0x021a('0x1a')]===_0x021a('0x1b')&&typeof _0x5eeeca[_0x021a('0x1c')]===_0x021a('0x1b');var _0x18cab9=_0x5a29ec[_0x021a('0x1d')];var _0x27872f=_0x2868d8?0x0:_0x5eeeca[_0x021a('0x1a')];var _0x25e48d=_0x2868d8?_0x5a29ec[_0x021a('0x1d')]:_0x5eeeca['offset']+_0x5eeeca[_0x021a('0x1c')];var _0x57f6e7;if(_0x25e48d>=_0x18cab9){_0x25e48d=_0x18cab9;_0x57f6e7=0xc8;}else{_0x57f6e7=0xce;}_0x4b06d3[_0x021a('0x18')](_0x57f6e7);return _0x4b06d3['set'](_0x021a('0x1e'),_0x27872f+'-'+_0x25e48d+'/'+_0x18cab9)[_0x021a('0x19')](_0x5a29ec);}return null;};}function patchUpdates(_0x1b02a9){return function(_0x224f71){try{jsonpatch[_0x021a('0x1f')](_0x224f71,_0x1b02a9,!![]);}catch(_0x4a1934){return BPromise[_0x021a('0x20')](_0x4a1934);}return _0x224f71[_0x021a('0x21')]();};}function saveUpdates(_0x2d3909,_0x70c32){return function(_0x23500d){if(_0x23500d){return _0x23500d[_0x021a('0x22')](_0x2d3909)[_0x021a('0x23')](function(_0x5db6be){return _0x5db6be;});}return null;};}function removeEntity(_0x1dc82c,_0x4f558b){return function(_0x20311b){if(_0x20311b){return _0x20311b['destroy']()[_0x021a('0x23')](function(){_0x1dc82c[_0x021a('0x18')](0xcc)[_0x021a('0x17')]();});}};}function handleEntityNotFound(_0x380569,_0x27b72e){return function(_0xbede16){if(!_0xbede16){_0x380569['sendStatus'](0x194);}return _0xbede16;};}function handleError(_0x5892b5,_0x33d499){_0x33d499=_0x33d499||0x1f4;return function(_0x3841be){logger[_0x021a('0x24')](_0x3841be[_0x021a('0x25')]);if(_0x3841be[_0x021a('0x26')]){delete _0x3841be[_0x021a('0x26')];}_0x5892b5['status'](_0x33d499)['send'](_0x3841be);};}exports[_0x021a('0x27')]=function(_0x515a80,_0x438f89){var _0x56f3bc={},_0x36fa84={},_0x5d7044={'count':0x0,'rows':[]};var _0x1d4f15=_[_0x021a('0x28')](db[_0x021a('0x29')]['rawAttributes'],function(_0xa9119c){return{'name':_0xa9119c[_0x021a('0x2a')],'type':_0xa9119c[_0x021a('0x2b')]['key']};});_0x36fa84[_0x021a('0x2c')]=_[_0x021a('0x28')](_0x1d4f15,_0x021a('0x26'));_0x36fa84[_0x021a('0x2d')]=_[_0x021a('0x2e')](_0x515a80[_0x021a('0x2d')]);_0x36fa84[_0x021a('0x2f')]=_[_0x021a('0x30')](_0x36fa84[_0x021a('0x2c')],_0x36fa84[_0x021a('0x2d')]);_0x56f3bc[_0x021a('0x31')]=_[_0x021a('0x30')](_0x36fa84[_0x021a('0x2c')],qs[_0x021a('0x32')](_0x515a80[_0x021a('0x2d')][_0x021a('0x32')]));_0x56f3bc['attributes']=_0x56f3bc[_0x021a('0x31')][_0x021a('0x33')]?_0x56f3bc[_0x021a('0x31')]:_0x36fa84[_0x021a('0x2c')];if(!_0x515a80[_0x021a('0x2d')][_0x021a('0x34')](_0x021a('0x35'))){_0x56f3bc['limit']=qs[_0x021a('0x1c')](_0x515a80[_0x021a('0x2d')]['limit']);_0x56f3bc[_0x021a('0x1a')]=qs[_0x021a('0x1a')](_0x515a80[_0x021a('0x2d')][_0x021a('0x1a')]);}_0x56f3bc[_0x021a('0x36')]=qs[_0x021a('0x37')](_0x515a80[_0x021a('0x2d')][_0x021a('0x37')]);_0x56f3bc[_0x021a('0x38')]=qs[_0x021a('0x2f')](_[_0x021a('0x39')](_0x515a80['query'],_0x36fa84[_0x021a('0x2f')]),_0x1d4f15);if(_0x515a80['query'][_0x021a('0x3a')]){_0x56f3bc[_0x021a('0x38')]=_[_0x021a('0x3b')](_0x56f3bc[_0x021a('0x38')],{'$or':_['map'](_0x1d4f15,function(_0x1e23c6){if(_0x1e23c6['type']!=='VIRTUAL'){var _0x56abe8={};_0x56abe8[_0x1e23c6[_0x021a('0x26')]]={'$like':'%'+_0x515a80[_0x021a('0x2d')]['filter']+'%'};return _0x56abe8;}})});}_0x56f3bc=_[_0x021a('0x3b')]({},_0x56f3bc,_0x515a80[_0x021a('0x3c')]);var _0x49b17e={'where':_0x56f3bc[_0x021a('0x38')]};return db['VoiceQueuesLog'][_0x021a('0x1d')](_0x49b17e)['then'](function(_0x3dbc76){_0x5d7044['count']=_0x3dbc76;if(_0x515a80[_0x021a('0x2d')][_0x021a('0x3d')]){_0x56f3bc[_0x021a('0x3e')]=[{'all':!![]}];}return db[_0x021a('0x29')][_0x021a('0x3f')](_0x56f3bc);})[_0x021a('0x23')](function(_0x581401){_0x5d7044[_0x021a('0x40')]=_0x581401;return _0x5d7044;})[_0x021a('0x23')](respondWithFilteredResult(_0x438f89,_0x56f3bc))['catch'](handleError(_0x438f89,null));};exports[_0x021a('0x41')]=function(_0x1d133d,_0x535373){var _0x515568={'raw':!![],'where':{'id':_0x1d133d['params']['id']}},_0x5551dd={};_0x5551dd[_0x021a('0x2c')]=_[_0x021a('0x2e')](db[_0x021a('0x29')]['rawAttributes']);_0x5551dd['query']=_['keys'](_0x1d133d[_0x021a('0x2d')]);_0x5551dd[_0x021a('0x2f')]=_['intersection'](_0x5551dd[_0x021a('0x2c')],_0x5551dd[_0x021a('0x2d')]);_0x515568[_0x021a('0x31')]=_[_0x021a('0x30')](_0x5551dd[_0x021a('0x2c')],qs['fields'](_0x1d133d['query'][_0x021a('0x32')]));_0x515568[_0x021a('0x31')]=_0x515568['attributes'][_0x021a('0x33')]?_0x515568[_0x021a('0x31')]:_0x5551dd[_0x021a('0x2c')];if(_0x1d133d[_0x021a('0x2d')][_0x021a('0x3d')]){_0x515568['include']=[{'all':!![]}];}_0x515568=_[_0x021a('0x3b')]({},_0x515568,_0x1d133d[_0x021a('0x3c')]);return db[_0x021a('0x29')]['find'](_0x515568)[_0x021a('0x23')](handleEntityNotFound(_0x535373,null))[_0x021a('0x23')](respondWithResult(_0x535373,null))[_0x021a('0x42')](handleError(_0x535373,null));};exports['create']=function(_0x34787a,_0x1eb6a2){return db[_0x021a('0x29')][_0x021a('0x43')](_0x34787a[_0x021a('0x44')],{})[_0x021a('0x23')](respondWithResult(_0x1eb6a2,0xc9))[_0x021a('0x42')](handleError(_0x1eb6a2,null));};exports[_0x021a('0x22')]=function(_0x1b4eaf,_0x238945){if(_0x1b4eaf[_0x021a('0x44')]['id']){delete _0x1b4eaf[_0x021a('0x44')]['id'];}return db['VoiceQueuesLog'][_0x021a('0x45')]({'where':{'id':_0x1b4eaf['params']['id']}})['then'](handleEntityNotFound(_0x238945,null))[_0x021a('0x23')](saveUpdates(_0x1b4eaf[_0x021a('0x44')],null))[_0x021a('0x23')](respondWithResult(_0x238945,null))[_0x021a('0x42')](handleError(_0x238945,null));};exports[_0x021a('0x46')]=function(_0x4dfe78,_0x492e16){return db[_0x021a('0x29')][_0x021a('0x45')]({'where':{'id':_0x4dfe78['params']['id']}})[_0x021a('0x23')](handleEntityNotFound(_0x492e16,null))[_0x021a('0x23')](removeEntity(_0x492e16,null))[_0x021a('0x42')](handleError(_0x492e16,null));}; \ No newline at end of file +var _0x0a91=['../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','apply','save','then','stack','name','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueuesLog','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','destroy','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','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'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0a91,0x1cd));var _0x10a9=function(_0x52a01f,_0x476c6a){_0x52a01f=_0x52a01f-0x0;var _0x37748f=_0x0a91[_0x52a01f];return _0x37748f;};'use strict';var emlformat=require(_0x10a9('0x0'));var rimraf=require(_0x10a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x10a9('0x2'));var moment=require(_0x10a9('0x3'));var BPromise=require(_0x10a9('0x4'));var Mustache=require(_0x10a9('0x5'));var util=require('util');var path=require(_0x10a9('0x6'));var sox=require('sox');var csv=require(_0x10a9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10a9('0x8'));var _=require(_0x10a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x10a9('0xa'));var deskjs=require(_0x10a9('0xb'));var toCsv=require(_0x10a9('0x7'));var querystring=require(_0x10a9('0xc'));var Papa=require('papaparse');var Redis=require(_0x10a9('0xd'));var authService=require(_0x10a9('0xe'));var qs=require(_0x10a9('0xf'));var as=require(_0x10a9('0x10'));var hardwareService=require(_0x10a9('0x11'));var logger=require(_0x10a9('0x12'))(_0x10a9('0x13'));var utils=require(_0x10a9('0x14'));var config=require(_0x10a9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x10a9('0x16'))['db'];function respondWithStatusCode(_0x343fe7,_0x345fb7){_0x345fb7=_0x345fb7||0xcc;return function(_0x233a3a){if(_0x233a3a){return _0x343fe7[_0x10a9('0x17')](_0x345fb7);}return _0x343fe7['status'](_0x345fb7)[_0x10a9('0x18')]();};}function respondWithResult(_0x189e48,_0x306693){_0x306693=_0x306693||0xc8;return function(_0x251b14){if(_0x251b14){return _0x189e48[_0x10a9('0x19')](_0x306693)[_0x10a9('0x1a')](_0x251b14);}};}function respondWithFilteredResult(_0x515139,_0x452c9c){return function(_0xdb1af4){if(_0xdb1af4){var _0x4bc6a1=typeof _0x452c9c[_0x10a9('0x1b')]==='undefined'&&typeof _0x452c9c['limit']===_0x10a9('0x1c');var _0x9a293e=_0xdb1af4['count'];var _0x2d2d5d=_0x4bc6a1?0x0:_0x452c9c['offset'];var _0x38e9b9=_0x4bc6a1?_0xdb1af4[_0x10a9('0x1d')]:_0x452c9c['offset']+_0x452c9c[_0x10a9('0x1e')];var _0x5d7a94;if(_0x38e9b9>=_0x9a293e){_0x38e9b9=_0x9a293e;_0x5d7a94=0xc8;}else{_0x5d7a94=0xce;}_0x515139['status'](_0x5d7a94);return _0x515139['set']('Content-Range',_0x2d2d5d+'-'+_0x38e9b9+'/'+_0x9a293e)[_0x10a9('0x1a')](_0xdb1af4);}return null;};}function patchUpdates(_0x6664a1){return function(_0x1a5c48){try{jsonpatch[_0x10a9('0x1f')](_0x1a5c48,_0x6664a1,!![]);}catch(_0x92e0ff){return BPromise['reject'](_0x92e0ff);}return _0x1a5c48[_0x10a9('0x20')]();};}function saveUpdates(_0x4ced5d,_0x57880e){return function(_0x2cab98){if(_0x2cab98){return _0x2cab98['update'](_0x4ced5d)[_0x10a9('0x21')](function(_0x17f6a9){return _0x17f6a9;});}return null;};}function removeEntity(_0x4132e9,_0x460ea0){return function(_0x24089f){if(_0x24089f){return _0x24089f['destroy']()[_0x10a9('0x21')](function(){_0x4132e9[_0x10a9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16397d,_0x3d24c9){return function(_0x2a539e){if(!_0x2a539e){_0x16397d[_0x10a9('0x17')](0x194);}return _0x2a539e;};}function handleError(_0x67334d,_0x284461){_0x284461=_0x284461||0x1f4;return function(_0x240465){logger['error'](_0x240465[_0x10a9('0x22')]);if(_0x240465[_0x10a9('0x23')]){delete _0x240465[_0x10a9('0x23')];}_0x67334d[_0x10a9('0x19')](_0x284461)['send'](_0x240465);};}exports['index']=function(_0x4719dc,_0x3ebbe2){var _0x21fc66={},_0x2e444b={},_0x1202a5={'count':0x0,'rows':[]};var _0x255e86=_['map'](db['VoiceQueuesLog'][_0x10a9('0x24')],function(_0x149910){return{'name':_0x149910[_0x10a9('0x25')],'type':_0x149910[_0x10a9('0x26')]['key']};});_0x2e444b['model']=_[_0x10a9('0x27')](_0x255e86,_0x10a9('0x23'));_0x2e444b[_0x10a9('0x28')]=_[_0x10a9('0x29')](_0x4719dc[_0x10a9('0x28')]);_0x2e444b[_0x10a9('0x2a')]=_['intersection'](_0x2e444b[_0x10a9('0x2b')],_0x2e444b[_0x10a9('0x28')]);_0x21fc66[_0x10a9('0x2c')]=_[_0x10a9('0x2d')](_0x2e444b[_0x10a9('0x2b')],qs[_0x10a9('0x2e')](_0x4719dc[_0x10a9('0x28')][_0x10a9('0x2e')]));_0x21fc66[_0x10a9('0x2c')]=_0x21fc66[_0x10a9('0x2c')]['length']?_0x21fc66[_0x10a9('0x2c')]:_0x2e444b[_0x10a9('0x2b')];if(!_0x4719dc[_0x10a9('0x28')][_0x10a9('0x2f')]('nolimit')){_0x21fc66[_0x10a9('0x1e')]=qs['limit'](_0x4719dc[_0x10a9('0x28')]['limit']);_0x21fc66[_0x10a9('0x1b')]=qs[_0x10a9('0x1b')](_0x4719dc[_0x10a9('0x28')][_0x10a9('0x1b')]);}_0x21fc66[_0x10a9('0x30')]=qs[_0x10a9('0x31')](_0x4719dc['query']['sort']);_0x21fc66[_0x10a9('0x32')]=qs[_0x10a9('0x2a')](_[_0x10a9('0x33')](_0x4719dc[_0x10a9('0x28')],_0x2e444b[_0x10a9('0x2a')]),_0x255e86);if(_0x4719dc[_0x10a9('0x28')][_0x10a9('0x34')]){_0x21fc66[_0x10a9('0x32')]=_[_0x10a9('0x35')](_0x21fc66[_0x10a9('0x32')],{'$or':_[_0x10a9('0x27')](_0x255e86,function(_0x224a5e){if(_0x224a5e[_0x10a9('0x26')]!==_0x10a9('0x36')){var _0x398e2e={};_0x398e2e[_0x224a5e['name']]={'$like':'%'+_0x4719dc[_0x10a9('0x28')][_0x10a9('0x34')]+'%'};return _0x398e2e;}})});}_0x21fc66=_[_0x10a9('0x35')]({},_0x21fc66,_0x4719dc[_0x10a9('0x37')]);var _0x56dfb0={'where':_0x21fc66['where']};return db[_0x10a9('0x38')][_0x10a9('0x1d')](_0x56dfb0)[_0x10a9('0x21')](function(_0x1fc5a9){_0x1202a5[_0x10a9('0x1d')]=_0x1fc5a9;if(_0x4719dc['query']['includeAll']){_0x21fc66[_0x10a9('0x39')]=[{'all':!![]}];}return db[_0x10a9('0x38')][_0x10a9('0x3a')](_0x21fc66);})[_0x10a9('0x21')](function(_0x49671f){_0x1202a5[_0x10a9('0x3b')]=_0x49671f;return _0x1202a5;})[_0x10a9('0x21')](respondWithFilteredResult(_0x3ebbe2,_0x21fc66))[_0x10a9('0x3c')](handleError(_0x3ebbe2,null));};exports[_0x10a9('0x3d')]=function(_0x2c96d0,_0x17d84d){var _0x2b0e5d={'raw':!![],'where':{'id':_0x2c96d0['params']['id']}},_0x4150d7={};_0x4150d7[_0x10a9('0x2b')]=_[_0x10a9('0x29')](db['VoiceQueuesLog']['rawAttributes']);_0x4150d7[_0x10a9('0x28')]=_[_0x10a9('0x29')](_0x2c96d0[_0x10a9('0x28')]);_0x4150d7['filters']=_[_0x10a9('0x2d')](_0x4150d7[_0x10a9('0x2b')],_0x4150d7[_0x10a9('0x28')]);_0x2b0e5d[_0x10a9('0x2c')]=_['intersection'](_0x4150d7[_0x10a9('0x2b')],qs[_0x10a9('0x2e')](_0x2c96d0['query'][_0x10a9('0x2e')]));_0x2b0e5d[_0x10a9('0x2c')]=_0x2b0e5d['attributes'][_0x10a9('0x3e')]?_0x2b0e5d[_0x10a9('0x2c')]:_0x4150d7[_0x10a9('0x2b')];if(_0x2c96d0[_0x10a9('0x28')][_0x10a9('0x3f')]){_0x2b0e5d[_0x10a9('0x39')]=[{'all':!![]}];}_0x2b0e5d=_[_0x10a9('0x35')]({},_0x2b0e5d,_0x2c96d0[_0x10a9('0x37')]);return db[_0x10a9('0x38')][_0x10a9('0x40')](_0x2b0e5d)[_0x10a9('0x21')](handleEntityNotFound(_0x17d84d,null))[_0x10a9('0x21')](respondWithResult(_0x17d84d,null))[_0x10a9('0x3c')](handleError(_0x17d84d,null));};exports[_0x10a9('0x41')]=function(_0x583a03,_0x37b033){return db[_0x10a9('0x38')]['create'](_0x583a03['body'],{})[_0x10a9('0x21')](respondWithResult(_0x37b033,0xc9))[_0x10a9('0x3c')](handleError(_0x37b033,null));};exports['update']=function(_0xd20d02,_0x56ac56){if(_0xd20d02[_0x10a9('0x42')]['id']){delete _0xd20d02[_0x10a9('0x42')]['id'];}return db[_0x10a9('0x38')][_0x10a9('0x40')]({'where':{'id':_0xd20d02[_0x10a9('0x43')]['id']}})[_0x10a9('0x21')](handleEntityNotFound(_0x56ac56,null))[_0x10a9('0x21')](saveUpdates(_0xd20d02[_0x10a9('0x42')],null))[_0x10a9('0x21')](respondWithResult(_0x56ac56,null))[_0x10a9('0x3c')](handleError(_0x56ac56,null));};exports[_0x10a9('0x44')]=function(_0x39a42d,_0x43be3c){return db[_0x10a9('0x38')][_0x10a9('0x40')]({'where':{'id':_0x39a42d[_0x10a9('0x43')]['id']}})[_0x10a9('0x21')](handleEntityNotFound(_0x43be3c,null))[_0x10a9('0x21')](removeEntity(_0x43be3c,null))[_0x10a9('0x3c')](handleError(_0x43be3c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 4d02c82..0659a3a 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 _0xd953=['exports','VoiceQueuesLog','voice_queues_log','dtm','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xd953,0x1f0));var _0x3d95=function(_0x4dfc03,_0x53ff23){_0x4dfc03=_0x4dfc03-0x0;var _0x674a6=_0xd953[_0x4dfc03];return _0x674a6;};'use strict';var _=require('lodash');var util=require(_0x3d95('0x0'));var logger=require(_0x3d95('0x1'))(_0x3d95('0x2'));var moment=require('moment');var BPromise=require(_0x3d95('0x3'));var rp=require(_0x3d95('0x4'));var fs=require('fs');var path=require(_0x3d95('0x5'));var rimraf=require('rimraf');var config=require(_0x3d95('0x6'));var attributes=require(_0x3d95('0x7'));module[_0x3d95('0x8')]=function(_0xf226cb,_0xc8f677){return _0xf226cb['define'](_0x3d95('0x9'),attributes,{'tableName':_0x3d95('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0x3d95('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x368a=['event','dtm','lodash','util','api','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x152ebc,_0x557a8d){var _0x592340=function(_0x59d05a){while(--_0x59d05a){_0x152ebc['push'](_0x152ebc['shift']());}};_0x592340(++_0x557a8d);}(_0x368a,0x1b4));var _0xa368=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x368a[_0x48b810];return _0x23c17d;};'use strict';var _=require(_0xa368('0x0'));var util=require(_0xa368('0x1'));var logger=require('../../config/logger')(_0xa368('0x2'));var moment=require('moment');var BPromise=require(_0xa368('0x3'));var rp=require(_0xa368('0x4'));var fs=require('fs');var path=require(_0xa368('0x5'));var rimraf=require(_0xa368('0x6'));var config=require('../../config/environment');var attributes=require(_0xa368('0x7'));module[_0xa368('0x8')]=function(_0x5d7d8c,_0x3fb98f){return _0x5d7d8c['define'](_0xa368('0x9'),attributes,{'tableName':_0xa368('0xa'),'paranoid':![],'indexes':[{'name':_0xa368('0xb'),'fields':[_0xa368('0xc'),_0xa368('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 9a9b30d..f7b2f58 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 _0x79d8=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x561ad6,_0x2cb207){var _0xcaa2bd=function(_0x253314){while(--_0x253314){_0x561ad6['push'](_0x561ad6['shift']());}};_0xcaa2bd(++_0x2cb207);}(_0x79d8,0x67));var _0x879d=function(_0x60d878,_0x3cfa4b){_0x60d878=_0x60d878-0x0;var _0x21c6c7=_0x79d8[_0x60d878];return _0x21c6c7;};'use strict';var _=require(_0x879d('0x0'));var util=require(_0x879d('0x1'));var moment=require(_0x879d('0x2'));var BPromise=require(_0x879d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x879d('0x4'));var db=require(_0x879d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x879d('0x6'))(_0x879d('0x7'));var config=require(_0x879d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x879d('0x9')][_0x879d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x142181,_0xc70b64,_0x49c05d){return new BPromise(function(_0x257050,_0x154db7){return client[_0x879d('0xb')](_0x142181,_0x49c05d)[_0x879d('0xc')](function(_0x2d5fbc){logger['info'](_0x879d('0xd'),_0xc70b64,'request\x20sent');logger['debug'](_0x879d('0xe'),_0xc70b64,_0x879d('0xf'),JSON[_0x879d('0x10')](_0x2d5fbc));if(_0x2d5fbc['error']){if(_0x2d5fbc[_0x879d('0x11')][_0x879d('0x12')]===0x1f4){logger['error'](_0x879d('0xd'),_0xc70b64,_0x2d5fbc[_0x879d('0x11')]['message']);return _0x154db7(_0x2d5fbc[_0x879d('0x11')]['message']);}logger[_0x879d('0x11')](_0x879d('0xd'),_0xc70b64,_0x2d5fbc[_0x879d('0x11')][_0x879d('0x13')]);return _0x257050(_0x2d5fbc[_0x879d('0x11')][_0x879d('0x13')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0xc70b64,_0x879d('0xf'));_0x257050(_0x2d5fbc[_0x879d('0x14')]['message']);}})['catch'](function(_0x7478cd){logger[_0x879d('0x11')](_0x879d('0xd'),_0xc70b64,_0x7478cd);_0x154db7(_0x7478cd);});});} \ No newline at end of file +var _0x08bf=['result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x31293a,_0x5849bf){var _0x5a4776=function(_0x2e1ae5){while(--_0x2e1ae5){_0x31293a['push'](_0x31293a['shift']());}};_0x5a4776(++_0x5849bf);}(_0x08bf,0x1e6));var _0xf08b=function(_0x24db94,_0x27c748){_0x24db94=_0x24db94-0x0;var _0x5de5c2=_0x08bf[_0x24db94];return _0x5de5c2;};'use strict';var _=require(_0xf08b('0x0'));var util=require(_0xf08b('0x1'));var moment=require(_0xf08b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf08b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf08b('0x4'));var logger=require(_0xf08b('0x5'))(_0xf08b('0x6'));var config=require(_0xf08b('0x7'));var jayson=require(_0xf08b('0x8'));var client=jayson['client'][_0xf08b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d45ef,_0x4a3a89,_0x1b2bc2){return new BPromise(function(_0x4f9278,_0x5c8027){return client[_0xf08b('0xa')](_0x1d45ef,_0x1b2bc2)[_0xf08b('0xb')](function(_0x33c49e){logger['info'](_0xf08b('0xc'),_0x4a3a89,'request\x20sent');logger['debug'](_0xf08b('0xd'),_0x4a3a89,_0xf08b('0xe'),JSON[_0xf08b('0xf')](_0x33c49e));if(_0x33c49e[_0xf08b('0x10')]){if(_0x33c49e[_0xf08b('0x10')][_0xf08b('0x11')]===0x1f4){logger[_0xf08b('0x10')](_0xf08b('0xc'),_0x4a3a89,_0x33c49e[_0xf08b('0x10')][_0xf08b('0x12')]);return _0x5c8027(_0x33c49e[_0xf08b('0x10')]['message']);}logger[_0xf08b('0x10')](_0xf08b('0xc'),_0x4a3a89,_0x33c49e[_0xf08b('0x10')]['message']);return _0x4f9278(_0x33c49e[_0xf08b('0x10')][_0xf08b('0x12')]);}else{logger[_0xf08b('0x13')](_0xf08b('0xc'),_0x4a3a89,_0xf08b('0xe'));_0x4f9278(_0x33c49e[_0xf08b('0x14')][_0xf08b('0x12')]);}})[_0xf08b('0x15')](function(_0x46e956){logger['error'](_0xf08b('0xc'),_0x4a3a89,_0x46e956);_0x5c8027(_0x46e956);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 63fffe1..9171810 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 _0xcfd9=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','describe','/:id','isAuthenticated','show','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy'];(function(_0x27cb8e,_0x4f6a2e){var _0x4cc0f1=function(_0x32b967){while(--_0x32b967){_0x27cb8e['push'](_0x27cb8e['shift']());}};_0x4cc0f1(++_0x4f6a2e);}(_0xcfd9,0x6d));var _0x9cfd=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xcfd9[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0x9cfd('0x0'));var util=require(_0x9cfd('0x1'));var path=require('path');var timeout=require(_0x9cfd('0x2'));var express=require(_0x9cfd('0x3'));var router=express[_0x9cfd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9cfd('0x5'));var interaction=require(_0x9cfd('0x6'));var config=require(_0x9cfd('0x7'));var controller=require(_0x9cfd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9cfd('0x9')]);router[_0x9cfd('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x9cfd('0xb')]);router['get'](_0x9cfd('0xc'),auth[_0x9cfd('0xd')](),controller[_0x9cfd('0xe')]);router[_0x9cfd('0xa')]('/:id/download',auth[_0x9cfd('0xd')](),controller['download']);router['get'](_0x9cfd('0xf'),controller[_0x9cfd('0x10')]);router[_0x9cfd('0xa')](_0x9cfd('0x11'),auth[_0x9cfd('0xd')](),controller[_0x9cfd('0x12')]);router[_0x9cfd('0x13')]('/',auth['isAuthenticated'](),controller[_0x9cfd('0x14')]);router[_0x9cfd('0x13')](_0x9cfd('0x11'),auth['isAuthenticated'](),controller[_0x9cfd('0x15')]);router[_0x9cfd('0x16')](_0x9cfd('0xc'),auth[_0x9cfd('0xd')](),controller[_0x9cfd('0x17')]);router[_0x9cfd('0x18')](_0x9cfd('0xc'),auth['isAuthenticated'](),controller[_0x9cfd('0x19')]);module[_0x9cfd('0x1a')]=router; \ No newline at end of file +var _0xfb04=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra'];(function(_0x549443,_0x2e04c8){var _0x372ed3=function(_0x214a87){while(--_0x214a87){_0x549443['push'](_0x549443['shift']());}};_0x372ed3(++_0x2e04c8);}(_0xfb04,0x1e2));var _0x4fb0=function(_0x5dac76,_0x5081f6){_0x5dac76=_0x5dac76-0x0;var _0x279518=_0xfb04[_0x5dac76];return _0x279518;};'use strict';var multer=require('multer');var util=require(_0x4fb0('0x0'));var path=require('path');var timeout=require(_0x4fb0('0x1'));var express=require('express');var router=express[_0x4fb0('0x2')]();var fs_extra=require(_0x4fb0('0x3'));var auth=require(_0x4fb0('0x4'));var interaction=require(_0x4fb0('0x5'));var config=require(_0x4fb0('0x6'));var controller=require(_0x4fb0('0x7'));router[_0x4fb0('0x8')]('/',auth[_0x4fb0('0x9')](),controller[_0x4fb0('0xa')]);router['get'](_0x4fb0('0xb'),auth[_0x4fb0('0x9')](),controller[_0x4fb0('0xc')]);router['get']('/:id',auth[_0x4fb0('0x9')](),controller[_0x4fb0('0xd')]);router[_0x4fb0('0x8')](_0x4fb0('0xe'),auth[_0x4fb0('0x9')](),controller[_0x4fb0('0xf')]);router[_0x4fb0('0x8')]('/:id/downloads',controller['downloads']);router[_0x4fb0('0x8')](_0x4fb0('0x10'),auth[_0x4fb0('0x9')](),controller[_0x4fb0('0x11')]);router['post']('/',auth[_0x4fb0('0x9')](),controller[_0x4fb0('0x12')]);router[_0x4fb0('0x13')]('/:id/transcribe',auth[_0x4fb0('0x9')](),controller[_0x4fb0('0x14')]);router[_0x4fb0('0x15')](_0x4fb0('0x16'),auth[_0x4fb0('0x9')](),controller[_0x4fb0('0x17')]);router[_0x4fb0('0x18')](_0x4fb0('0x16'),auth[_0x4fb0('0x9')](),controller[_0x4fb0('0x19')]);module[_0x4fb0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index dd61413..b85a5f3 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(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 02aee07..3affc95 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 _0x80ef=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','unlink','message','send','Not\x20found','downloads','sequelize','MD5','col','push','$and','%s.cypher','filename','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','index','VoiceRecording','format','query'];(function(_0x5aaf54,_0x116458){var _0xfad324=function(_0x4392e0){while(--_0x4392e0){_0x5aaf54['push'](_0x5aaf54['shift']());}};_0xfad324(++_0x116458);}(_0x80ef,0x6a));var _0xf80e=function(_0x47baa4,_0x522480){_0x47baa4=_0x47baa4-0x0;var _0x484801=_0x80ef[_0x47baa4];return _0x484801;};'use strict';var emlformat=require(_0xf80e('0x0'));var rimraf=require(_0xf80e('0x1'));var zipdir=require(_0xf80e('0x2'));var jsonpatch=require(_0xf80e('0x3'));var rp=require('request-promise');var moment=require(_0xf80e('0x4'));var BPromise=require(_0xf80e('0x5'));var Mustache=require(_0xf80e('0x6'));var util=require(_0xf80e('0x7'));var path=require(_0xf80e('0x8'));var sox=require(_0xf80e('0x9'));var csv=require(_0xf80e('0xa'));var ejs=require(_0xf80e('0xb'));var fs=require('fs');var fs_extra=require(_0xf80e('0xc'));var _=require(_0xf80e('0xd'));var squel=require(_0xf80e('0xe'));var crypto=require('crypto');var jsforce=require(_0xf80e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf80e('0xa'));var querystring=require(_0xf80e('0x10'));var Papa=require(_0xf80e('0x11'));var AWS=require(_0xf80e('0x12'));var uuidv4=require(_0xf80e('0x13'));var Redis=require(_0xf80e('0x14'));var authService=require(_0xf80e('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xf80e('0x16'));var hardwareService=require(_0xf80e('0x17'));var logger=require(_0xf80e('0x18'))('api');var utils=require(_0xf80e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xf80e('0x1a'));var db=require(_0xf80e('0x1b'))['db'];function respondWithStatusCode(_0x1d0331,_0x2adcff){_0x2adcff=_0x2adcff||0xcc;return function(_0x32f8de){if(_0x32f8de){return _0x1d0331[_0xf80e('0x1c')](_0x2adcff);}return _0x1d0331[_0xf80e('0x1d')](_0x2adcff)['end']();};}function respondWithResult(_0x14b46e,_0x24b664){_0x24b664=_0x24b664||0xc8;return function(_0x529e59){if(_0x529e59){return _0x14b46e[_0xf80e('0x1d')](_0x24b664)[_0xf80e('0x1e')](_0x529e59);}};}function respondWithFilteredResult(_0x33f3e9,_0x5f5c05){return function(_0x31ab78){if(_0x31ab78){var _0x2ad8db=typeof _0x5f5c05[_0xf80e('0x1f')]===_0xf80e('0x20')&&typeof _0x5f5c05[_0xf80e('0x21')]===_0xf80e('0x20');var _0x45808c=_0x31ab78[_0xf80e('0x22')];var _0x4d8a67=_0x2ad8db?0x0:_0x5f5c05['offset'];var _0x42aa39=_0x2ad8db?_0x31ab78[_0xf80e('0x22')]:_0x5f5c05[_0xf80e('0x1f')]+_0x5f5c05['limit'];var _0x377600;if(_0x42aa39>=_0x45808c){_0x42aa39=_0x45808c;_0x377600=0xc8;}else{_0x377600=0xce;}_0x33f3e9[_0xf80e('0x1d')](_0x377600);return _0x33f3e9[_0xf80e('0x23')](_0xf80e('0x24'),_0x4d8a67+'-'+_0x42aa39+'/'+_0x45808c)[_0xf80e('0x1e')](_0x31ab78);}return null;};}function patchUpdates(_0x4129c9){return function(_0x49f343){try{jsonpatch[_0xf80e('0x25')](_0x49f343,_0x4129c9,!![]);}catch(_0x4364e9){return BPromise[_0xf80e('0x26')](_0x4364e9);}return _0x49f343[_0xf80e('0x27')]();};}function saveUpdates(_0x2822e8,_0x327215){return function(_0x241ed4){if(_0x241ed4){return _0x241ed4['update'](_0x2822e8)[_0xf80e('0x28')](function(_0x1ad53d){return _0x1ad53d;});}return null;};}function removeEntity(_0x28e206,_0x42f37b){return function(_0x12baf3){if(_0x12baf3){return _0x12baf3[_0xf80e('0x29')]()[_0xf80e('0x28')](function(){_0x28e206[_0xf80e('0x1d')](0xcc)[_0xf80e('0x2a')]();});}};}function handleEntityNotFound(_0x22b8d5,_0x23fa79){return function(_0x5e0451){if(!_0x5e0451){_0x22b8d5[_0xf80e('0x1c')](0x194);}return _0x5e0451;};}function handleError(_0x453fc7,_0x5b7988){_0x5b7988=_0x5b7988||0x1f4;return function(_0x3b2bd1){logger['error'](_0x3b2bd1[_0xf80e('0x2b')]);if(_0x3b2bd1['name']){delete _0x3b2bd1[_0xf80e('0x2c')];}_0x453fc7['status'](_0x5b7988)['send'](_0x3b2bd1);};}exports[_0xf80e('0x2d')]=function(_0x4d508f,_0x3738dd){var _0x130fe2={},_0x30d88b={},_0x265f47={'count':0x0,'rows':[]};var _0x4b40e3=_['map'](db[_0xf80e('0x2e')]['rawAttributes'],function(_0x5b0c1d){return{'name':_0x5b0c1d['fieldName'],'type':_0x5b0c1d['type']['key']};});_0x30d88b['model']=_['differenceBy'](_['map'](_0x4b40e3,_0xf80e('0x2c')),[_0xf80e('0x2f')]);_0x30d88b[_0xf80e('0x30')]=_[_0xf80e('0x31')](_0x4d508f[_0xf80e('0x30')]);_0x30d88b[_0xf80e('0x32')]=_[_0xf80e('0x33')](_0x30d88b[_0xf80e('0x34')],_0x30d88b[_0xf80e('0x30')]);_0x130fe2[_0xf80e('0x35')]=_['intersection'](_0x30d88b['model'],qs[_0xf80e('0x36')](_0x4d508f['query']['fields']));_0x130fe2['attributes']=_0x130fe2[_0xf80e('0x35')][_0xf80e('0x37')]?_0x130fe2['attributes']:_0x30d88b[_0xf80e('0x34')];if(!_0x4d508f[_0xf80e('0x30')][_0xf80e('0x38')](_0xf80e('0x39'))){_0x130fe2['limit']=qs[_0xf80e('0x21')](_0x4d508f[_0xf80e('0x30')][_0xf80e('0x21')]);_0x130fe2['offset']=qs[_0xf80e('0x1f')](_0x4d508f['query'][_0xf80e('0x1f')]);}_0x130fe2[_0xf80e('0x3a')]=qs[_0xf80e('0x3b')](_0x4d508f[_0xf80e('0x30')][_0xf80e('0x3b')]);_0x130fe2['where']=qs[_0xf80e('0x32')](_[_0xf80e('0x3c')](_0x4d508f['query'],_0x30d88b[_0xf80e('0x32')]),_0x4b40e3);if(_0x4d508f[_0xf80e('0x30')]['filter']){_0x130fe2[_0xf80e('0x3d')]=_[_0xf80e('0x3e')](_0x130fe2[_0xf80e('0x3d')],{'$or':_[_0xf80e('0x3f')](_0x4b40e3,function(_0x58ea46){if(_0x58ea46[_0xf80e('0x40')]!==_0xf80e('0x41')){var _0x538650={};_0x538650[_0x58ea46['name']]={'$like':'%'+_0x4d508f[_0xf80e('0x30')]['filter']+'%'};return _0x538650;}})});}_0x130fe2=_[_0xf80e('0x3e')]({},_0x130fe2,_0x4d508f[_0xf80e('0x42')]);var _0x318ec7={'where':_0x130fe2['where']};return db[_0xf80e('0x2e')][_0xf80e('0x22')](_0x318ec7)[_0xf80e('0x28')](function(_0x46f72d){_0x265f47[_0xf80e('0x22')]=_0x46f72d;if(_0x4d508f[_0xf80e('0x30')][_0xf80e('0x43')]){_0x130fe2['include']=[{'all':!![]}];}return db['VoiceRecording'][_0xf80e('0x44')](_0x130fe2);})[_0xf80e('0x28')](function(_0x205317){_0x265f47[_0xf80e('0x45')]=_0x205317;return _0x265f47;})[_0xf80e('0x28')](respondWithFilteredResult(_0x3738dd,_0x130fe2))[_0xf80e('0x46')](handleError(_0x3738dd,null));};exports[_0xf80e('0x47')]=function(_0xce583e,_0x1e7c6e){var _0x56243c={'raw':![],'where':{'id':_0xce583e[_0xf80e('0x48')]['id']}},_0x5d329a={};_0x5d329a['model']=_['keys'](db['VoiceRecording'][_0xf80e('0x49')]);_0x5d329a[_0xf80e('0x30')]=_['keys'](_0xce583e[_0xf80e('0x30')]);_0x5d329a[_0xf80e('0x32')]=_[_0xf80e('0x33')](_0x5d329a['model'],_0x5d329a['query']);_0x56243c[_0xf80e('0x35')]=_['intersection'](_0x5d329a['model'],qs['fields'](_0xce583e[_0xf80e('0x30')]['fields']));_0x56243c['attributes']=_0x56243c[_0xf80e('0x35')][_0xf80e('0x37')]?_0x56243c[_0xf80e('0x35')]:_0x5d329a[_0xf80e('0x34')];if(_0xce583e[_0xf80e('0x30')][_0xf80e('0x43')]){_0x56243c[_0xf80e('0x4a')]=[{'all':!![]}];}_0x56243c=_[_0xf80e('0x3e')]({},_0x56243c,_0xce583e['options']);return db[_0xf80e('0x2e')][_0xf80e('0x4b')](_0x56243c)[_0xf80e('0x28')](handleEntityNotFound(_0x1e7c6e,null))[_0xf80e('0x28')](respondWithResult(_0x1e7c6e,null))[_0xf80e('0x46')](handleError(_0x1e7c6e,null));};exports['create']=function(_0x251932,_0x24c6a1){return db[_0xf80e('0x2e')][_0xf80e('0x4c')](_0x251932[_0xf80e('0x4d')],{})[_0xf80e('0x28')](respondWithResult(_0x24c6a1,0xc9))[_0xf80e('0x46')](handleError(_0x24c6a1,null));};exports[_0xf80e('0x4e')]=function(_0x48196f,_0x48f6de){if(_0x48196f['body']['id']){delete _0x48196f[_0xf80e('0x4d')]['id'];}return db[_0xf80e('0x2e')][_0xf80e('0x4b')]({'where':{'id':_0x48196f['params']['id']}})[_0xf80e('0x28')](handleEntityNotFound(_0x48f6de,null))[_0xf80e('0x28')](saveUpdates(_0x48196f[_0xf80e('0x4d')],null))[_0xf80e('0x28')](respondWithResult(_0x48f6de,null))['catch'](handleError(_0x48f6de,null));};exports[_0xf80e('0x4f')]=function(_0x936bab,_0x50a63b){return db['VoiceRecording'][_0xf80e('0x4f')]()[_0xf80e('0x28')](respondWithResult(_0x50a63b,null))[_0xf80e('0x46')](handleError(_0x50a63b,null));};exports[_0xf80e('0x50')]=function(_0x314421,_0x5a49e9,_0xf31ef0){var _0x4e9679=require(_0xf80e('0x51'));var _0x4085f5=![];var _0x5de631={};if(_0x314421['query'][_0xf80e('0x40')]&&_0x314421[_0xf80e('0x30')][_0xf80e('0x40')]===_0xf80e('0x52')){_0x5de631[_0xf80e('0x52')]=_0x314421['params']['id'];}else{_0x5de631['id']=_0x314421[_0xf80e('0x48')]['id'];}return db[_0xf80e('0x2e')][_0xf80e('0x4b')]({'where':_0x5de631,'attributes':['id',_0xf80e('0x53')],'raw':!![]})[_0xf80e('0x28')](handleEntityNotFound(_0x5a49e9,null))[_0xf80e('0x28')](function(_0x2cf4af){if(_0x2cf4af){var _0x2d5be3=_0x2cf4af[_0xf80e('0x53')];var _0x52602e=util[_0xf80e('0x2f')]('%s.cypher',_0x2d5be3);if(fs[_0xf80e('0x54')](_0x52602e)){_0x4085f5=!![];return _0x4e9679[_0xf80e('0x55')](_0x52602e,_0x2d5be3,config[_0xf80e('0x56')][_0xf80e('0x57')])[_0xf80e('0x28')](function(){return _0x2cf4af;});}return _0x2cf4af;}})[_0xf80e('0x28')](function(_0x218112){if(_0x218112){var _0x20db75=_0x218112[_0xf80e('0x53')];if(!fs['existsSync'](_0x20db75)){throw new db[(_0xf80e('0x58'))][(_0xf80e('0x59'))](_0xf80e('0x5a'));}if(_0x218112['filename']){return _0x5a49e9[_0xf80e('0x50')](_0x20db75,_0x218112['filename']+path['extname'](_0x20db75),function(){if(_0x4085f5){fs[_0xf80e('0x5b')](_0x20db75);}});}else{return _0x5a49e9[_0xf80e('0x50')](_0x20db75,function(_0x14877b){if(_0x4085f5){fs[_0xf80e('0x5b')](_0x20db75);}});}}})[_0xf80e('0x46')](function(_0x3217bf){if(_0x3217bf[_0xf80e('0x5c')]==='VoiceRecording\x20not\x20found'){_0x5a49e9[_0xf80e('0x1d')](0x194)[_0xf80e('0x5d')](_0xf80e('0x5e'));}else{return handleError(_0x5a49e9,null);}});};exports[_0xf80e('0x5f')]=function(_0x17fcfa,_0xdfc9ec,_0x1b6c7a){var _0x2116e1=require(_0xf80e('0x51'));var _0x370ef1=![];var _0x4b8cb3={'$and':[db[_0xf80e('0x60')][_0xf80e('0x3d')](db['sequelize']['fn'](_0xf80e('0x61'),db[_0xf80e('0x60')][_0xf80e('0x62')](_0xf80e('0x52'))),_0x17fcfa[_0xf80e('0x30')]['token'])]};if(_0x17fcfa['query'][_0xf80e('0x40')]&&_0x17fcfa[_0xf80e('0x30')][_0xf80e('0x40')]===_0xf80e('0x52')){_0x4b8cb3['$and'][_0xf80e('0x63')]({'uniqueid':_0x17fcfa['params']['id']});}else{_0x4b8cb3[_0xf80e('0x64')][_0xf80e('0x63')]({'id':_0x17fcfa[_0xf80e('0x48')]['id']});}return db[_0xf80e('0x2e')][_0xf80e('0x4b')]({'where':_0x4b8cb3,'attributes':['id',_0xf80e('0x53')],'raw':!![]})[_0xf80e('0x28')](handleEntityNotFound(_0xdfc9ec,null))[_0xf80e('0x28')](function(_0x4a3e44){if(_0x4a3e44){var _0x28f72a=util['format'](_0xf80e('0x65'),_0x4a3e44['value']);if(fs[_0xf80e('0x54')](_0x28f72a)){_0x370ef1=!![];return _0x2116e1['decryptFile'](_0x28f72a,_0x4a3e44[_0xf80e('0x53')],config[_0xf80e('0x56')][_0xf80e('0x57')])[_0xf80e('0x28')](function(){return _0x4a3e44;});}return _0x4a3e44;}})[_0xf80e('0x28')](function(_0xe2f19b){if(_0xe2f19b){if(!fs[_0xf80e('0x54')](_0xe2f19b['value'])){throw new db[(_0xf80e('0x58'))][(_0xf80e('0x59'))](_0xf80e('0x5a'));}if(_0xe2f19b[_0xf80e('0x66')]){return _0xdfc9ec[_0xf80e('0x50')](_0xe2f19b[_0xf80e('0x53')],_0xe2f19b['filename']+path[_0xf80e('0x67')](_0xe2f19b[_0xf80e('0x53')]),function(){if(_0x370ef1){fs['unlink'](_0xe2f19b[_0xf80e('0x53')]);}});}else{return _0xdfc9ec[_0xf80e('0x50')](_0xe2f19b[_0xf80e('0x53')],function(_0x2f60c9){if(_0x370ef1){fs[_0xf80e('0x5b')](_0xe2f19b[_0xf80e('0x53')]);}});}}})['catch'](handleError(_0xdfc9ec,null));};exports[_0xf80e('0x29')]=function(_0x1b5a22,_0x1d07ab){return db[_0xf80e('0x2e')]['find']({'where':{'id':_0x1b5a22[_0xf80e('0x48')]['id']}})[_0xf80e('0x28')](function(_0x272854){if(_[_0xf80e('0x68')](_0x272854)){throw new ReferenceError(_0xf80e('0x69'));}return _0x272854;})[_0xf80e('0x28')](function(_0x234ba6){var _0x3e6086=_0x234ba6[_0xf80e('0x53')];logger[_0xf80e('0x6a')](_0xf80e('0x6b'),_0x3e6086);if(!_[_0xf80e('0x68')](_0x234ba6[_0xf80e('0x53')])&&fs[_0xf80e('0x54')](_0x3e6086)){logger[_0xf80e('0x6a')](_0xf80e('0x6c')+_0x3e6086+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf80e('0x6d')](_0x3e6086);}_0x3e6086=_0x3e6086+_0xf80e('0x6e');if(!_[_0xf80e('0x68')](_0x234ba6[_0xf80e('0x53')])&&fs['existsSync'](_0x3e6086)){logger[_0xf80e('0x6a')](_0xf80e('0x6c')+_0x3e6086+_0xf80e('0x6f'));fs[_0xf80e('0x6d')](_0x3e6086);}return _0x234ba6;})[_0xf80e('0x28')](function(_0x183c01){if(!_0x183c01)throw new InternalError();return _0x183c01[_0xf80e('0x29')]();})[_0xf80e('0x28')](function(){_0x1d07ab[_0xf80e('0x1d')](0xcc)[_0xf80e('0x2a')]();})[_0xf80e('0x46')](handleError(_0x1d07ab,null));};function getBucketslist(_0x3941a2,_0x2c84cb,_0x6a5984){return new Promise(function(_0x2a74c5,_0x32d63b){var _0x69c90e=new AWS['S3']({'accessKeyId':_0x2c84cb,'secretAccessKey':_0x3941a2,'region':_0x6a5984});_0x69c90e['listBuckets']({},function(_0x2f1360,_0x2dc52f){if(_0x2f1360){return _0x32d63b(_0x2f1360);}else{return _0x2a74c5(_0x2dc52f);}});});}function createBucket(_0x132814,_0x53872f,_0x23e663,_0x5d6cc7){return new Promise(function(_0x50cfda,_0x2cefb6){var _0x49e57f=new AWS['S3']({'accessKeyId':_0x53872f,'secretAccessKey':_0x132814,'region':_0x23e663});_0x49e57f[_0xf80e('0x70')]({'Bucket':_0x5d6cc7},function(_0x2af4e2,_0x76fb0e){if(_0x2af4e2){return _0x2cefb6(_0x2af4e2);}else{return _0x50cfda(_0x76fb0e);}});});}function uploadFile(_0x4c8c60,_0x44115b,_0x11e0aa,_0x2157ba,_0x336510,_0x10d803){return new Promise(function(_0x4beddb,_0x5a2983){var _0xce602c=new AWS['S3']({'accessKeyId':_0x44115b,'secretAccessKey':_0x4c8c60,'region':_0x11e0aa});_0xce602c[_0xf80e('0x71')]({'Bucket':_0x2157ba,'Key':_0x336510,'Body':_0x10d803},function(_0x4130ad,_0x339969){if(_0x4130ad){return _0x5a2983(_0x4130ad);}else{return _0x4beddb(_0x339969);}});});}function startTranscribe(_0x45a6e9,_0x431273,_0x5b208f,_0x10c61d,_0x11ea59,_0x574113){return new Promise(function(_0x40cc6e,_0x1b07eb){var _0x25e6fe=new AWS['TranscribeService']({'accessKeyId':_0x431273,'secretAccessKey':_0x45a6e9,'region':_0x5b208f});_0x25e6fe['startTranscriptionJob']({'TranscriptionJobName':_0x10c61d,'LanguageCode':_0x11ea59,'Media':{'MediaFileUri':_0x574113}},function(_0x589696,_0x38b491){if(_0x589696){return _0x1b07eb(_0x589696);}else{return _0x40cc6e(_0x38b491);}});});}function transcribe(_0x397ab5,_0x2fa3fa,_0x17d995,_0x443c41,_0x34c1c4,_0x46148c,_0xbc19e5){return new Promise(function(_0x3affe2,_0x155167){var _0x55dbc0={};logger[_0xf80e('0x6a')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x397ab5,_0x34c1c4));return uploadFile(_0x2fa3fa,_0x17d995,_0x443c41,_0x34c1c4,path[_0xf80e('0x72')](_0x46148c),fs[_0xf80e('0x73')](_0x46148c))[_0xf80e('0x28')](function(_0x2a5a10){logger[_0xf80e('0x6a')](util[_0xf80e('0x2f')](_0xf80e('0x74'),_0x397ab5,_0x34c1c4,_0x2a5a10['Location']));_0x55dbc0[_0xf80e('0x75')]=_0x2a5a10[_0xf80e('0x76')];_0x55dbc0[_0xf80e('0x77')]=_0x2a5a10[_0xf80e('0x78')];logger[_0xf80e('0x6a')](util[_0xf80e('0x2f')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x397ab5));return startTranscribe(_0x2fa3fa,_0x17d995,_0x443c41,uuidv4(),_0xbc19e5,_0x2a5a10[_0xf80e('0x78')]);})[_0xf80e('0x28')](function(_0x3f00de){logger[_0xf80e('0x6a')](util[_0xf80e('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x397ab5,_0x3f00de[_0xf80e('0x79')][_0xf80e('0x7a')]));_0x55dbc0['transcribeName']=_0x3f00de[_0xf80e('0x79')][_0xf80e('0x7a')];_0x55dbc0[_0xf80e('0x7b')]=_0x3f00de[_0xf80e('0x79')][_0xf80e('0x7c')];return _0x3affe2(_0x55dbc0);})[_0xf80e('0x46')](function(_0x675246){return _0x155167(_0x675246);});});}exports[_0xf80e('0x7d')]=function(_0x56fba4,_0x22a0a7,_0x3c8968){var _0x32d9ec;var _0x17fda7;var _0x2d6250;var _0xdaa6d4=require('../../components/encryptor');return db[_0xf80e('0x2e')][_0xf80e('0x7e')]({'where':{'id':_0x56fba4[_0xf80e('0x48')]['id']}})['then'](function(_0x5db733){if(_0x5db733){var _0x32d1cb=util['format'](_0xf80e('0x65'),_0x5db733[_0xf80e('0x53')]);if(fs[_0xf80e('0x54')](_0x32d1cb)){cypher=!![];return _0xdaa6d4[_0xf80e('0x55')](_0x32d1cb,_0x5db733[_0xf80e('0x53')],config['secrets'][_0xf80e('0x57')])[_0xf80e('0x28')](function(){return _0x5db733;});}return _0x5db733;}})['then'](function(_0x4fe8e6){if(!_0x4fe8e6){throw new db[(_0xf80e('0x58'))][(_0xf80e('0x59'))](_0xf80e('0x7f'));}_0x17fda7=_0x4fe8e6;return db['Setting'][_0xf80e('0x7e')]({'where':{'id':0x1}});})[_0xf80e('0x28')](handleEntityNotFound(_0x22a0a7,null))['then'](function(_0x2bab5f){if(_0x2bab5f){_0x32d9ec=_0x2bab5f;if(!_0x32d9ec['transcribe']||!_0x32d9ec['transcribeAccountId']||!_0x32d9ec['transcribeRegion']||!_0x32d9ec[_0xf80e('0x80')]||!_0x32d9ec['bucket']){throw new db[(_0xf80e('0x58'))][(_0xf80e('0x59'))](_0xf80e('0x81'));}if(_0x56fba4[_0xf80e('0x4d')]['runSentiment']&&(!_0x32d9ec[_0xf80e('0x82')]||!_0x32d9ec[_0xf80e('0x83')]||!_0x32d9ec[_0xf80e('0x84')]||!_0x32d9ec[_0xf80e('0x80')]||!_0x32d9ec[_0xf80e('0x75')])){throw new db[(_0xf80e('0x58'))][(_0xf80e('0x59'))](_0xf80e('0x85'));}return db[_0xf80e('0x86')][_0xf80e('0x7e')]({'where':{'id':_0x32d9ec[_0xf80e('0x87')]}});}})['then'](function(_0x42ebe9){if(!_0x42ebe9){throw new db[(_0xf80e('0x58'))]['ValidationError'](_0xf80e('0x88'));}if(!_0x42ebe9[_0xf80e('0x89')]||!_0x42ebe9[_0xf80e('0x8a')]){throw new db['Sequelize'][(_0xf80e('0x59'))](_0xf80e('0x8b'));}_0x2d6250=_0x42ebe9;return getBucketslist(_0x2d6250[_0xf80e('0x89')],_0x2d6250[_0xf80e('0x8a')],_0x32d9ec['transcribeRegion']);})[_0xf80e('0x28')](function(_0xda28a4){if(_0xda28a4&&_0xda28a4[_0xf80e('0x8c')]){var _0x3582aa=_[_0xf80e('0x4b')](_0xda28a4[_0xf80e('0x8c')],function(_0x595296){return _0x595296['Name']===_0x32d9ec[_0xf80e('0x75')];});if(!_0x3582aa){logger[_0xf80e('0x6a')](util['format'](_0xf80e('0x8d'),_0x56fba4[_0xf80e('0x48')]['id'],_0x32d9ec[_0xf80e('0x75')]));return createBucket(_0x2d6250[_0xf80e('0x89')],_0x2d6250[_0xf80e('0x8a')],_0x32d9ec[_0xf80e('0x8e')],_0x32d9ec[_0xf80e('0x75')]);}logger[_0xf80e('0x6a')](util[_0xf80e('0x2f')](_0xf80e('0x8f'),_0x56fba4[_0xf80e('0x48')]['id'],_0x32d9ec[_0xf80e('0x75')]));return;}})[_0xf80e('0x28')](function(_0x4b6cf5){if(_0x17fda7['transcribeStatus']==='NEW'){return transcribe(_0x56fba4[_0xf80e('0x48')]['id'],_0x2d6250['data1'],_0x2d6250[_0xf80e('0x8a')],_0x32d9ec[_0xf80e('0x8e')],_0x32d9ec[_0xf80e('0x75')],_0x17fda7[_0xf80e('0x53')],_0x32d9ec['language']);}else{logger[_0xf80e('0x6a')](util[_0xf80e('0x2f')](_0xf80e('0x90'),_0x56fba4[_0xf80e('0x48')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xf80e('0x28')](function(_0x4bcbcf){if(_0x4bcbcf){_0x4bcbcf[_0xf80e('0x91')]=_0x56fba4['body'][_0xf80e('0x92')];return _0x17fda7[_0xf80e('0x93')](_0x4bcbcf);}})['then'](respondWithResult(_0x22a0a7,null))[_0xf80e('0x46')](handleError(_0x22a0a7,null));};function writeFile(_0x3d6a51,_0x2cdc08){return new Promise(function(_0x3778a3,_0x474e03){fs[_0xf80e('0x94')](_0x2cdc08,_0x3d6a51,function(_0x49e4c0,_0x47d9d8){if(_0x49e4c0){return _0x474e03(_0x49e4c0);}else{return _0x3778a3(_0x47d9d8);}});});}exports[_0xf80e('0x95')]=function(_0x193602,_0x1ffb82,_0x26be36){return db[_0xf80e('0x2e')][_0xf80e('0x7e')]({'where':{'id':_0x193602[_0xf80e('0x48')]['id']}})[_0xf80e('0x28')](handleEntityNotFound(_0x1ffb82))[_0xf80e('0x28')](function(_0x2076a1){if(_0x2076a1&&_0x2076a1[_0xf80e('0x96')]){var _0x3f2202=_0x2076a1[_0xf80e('0x96')];var _0x5af8f5=config[_0xf80e('0x97')]+_0xf80e('0x98')+_0x2076a1['id']+_0xf80e('0x99');if(fs[_0xf80e('0x54')](_0x5af8f5)){return _0x5af8f5;}return writeFile(_0x3f2202,_0x5af8f5)[_0xf80e('0x28')](function(){return _0x5af8f5;});}else{throw new db['Sequelize']['ValidationError'](_0xf80e('0x9a'));}})[_0xf80e('0x28')](function(_0x303b58){return _0x1ffb82[_0xf80e('0x50')](_0x303b58);})[_0xf80e('0x46')](handleError(_0x1ffb82));}; \ No newline at end of file +var _0x6bac=['uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','error','name','send','map','VoiceRecording','rawAttributes','fieldName','key','differenceBy','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','body','find','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','Not\x20found','sequelize','MD5','col','token','$and','push','secrets','filename','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','listBuckets','upload','TranscribeService','startTranscriptionJob','format','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','aws-sdk'];(function(_0x3a4f83,_0x286f77){var _0x3b4262=function(_0x551124){while(--_0x551124){_0x3a4f83['push'](_0x3a4f83['shift']());}};_0x3b4262(++_0x286f77);}(_0x6bac,0x1a2));var _0xc6ba=function(_0xf72cd9,_0x4fbde9){_0xf72cd9=_0xf72cd9-0x0;var _0xe61fb=_0x6bac[_0xf72cd9];return _0xe61fb;};'use strict';var emlformat=require(_0xc6ba('0x0'));var rimraf=require(_0xc6ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc6ba('0x2'));var BPromise=require(_0xc6ba('0x3'));var Mustache=require(_0xc6ba('0x4'));var util=require('util');var path=require(_0xc6ba('0x5'));var sox=require(_0xc6ba('0x6'));var csv=require('to-csv');var ejs=require(_0xc6ba('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6ba('0x8'));var squel=require('squel');var crypto=require(_0xc6ba('0x9'));var jsforce=require(_0xc6ba('0xa'));var deskjs=require(_0xc6ba('0xb'));var toCsv=require(_0xc6ba('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0xc6ba('0xd'));var uuidv4=require(_0xc6ba('0xe'));var Redis=require(_0xc6ba('0xf'));var authService=require(_0xc6ba('0x10'));var qs=require(_0xc6ba('0x11'));var as=require(_0xc6ba('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc6ba('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc6ba('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fac9c,_0x17b55b){_0x17b55b=_0x17b55b||0xcc;return function(_0x3456de){if(_0x3456de){return _0x3fac9c['sendStatus'](_0x17b55b);}return _0x3fac9c['status'](_0x17b55b)[_0xc6ba('0x15')]();};}function respondWithResult(_0x358d35,_0x30118c){_0x30118c=_0x30118c||0xc8;return function(_0x14d1e0){if(_0x14d1e0){return _0x358d35[_0xc6ba('0x16')](_0x30118c)['json'](_0x14d1e0);}};}function respondWithFilteredResult(_0x49e72c,_0x23cac1){return function(_0x53f745){if(_0x53f745){var _0x57e890=typeof _0x23cac1[_0xc6ba('0x17')]===_0xc6ba('0x18')&&typeof _0x23cac1[_0xc6ba('0x19')]===_0xc6ba('0x18');var _0x26e07c=_0x53f745['count'];var _0x34e482=_0x57e890?0x0:_0x23cac1[_0xc6ba('0x17')];var _0x34b9cb=_0x57e890?_0x53f745[_0xc6ba('0x1a')]:_0x23cac1['offset']+_0x23cac1[_0xc6ba('0x19')];var _0x3a2545;if(_0x34b9cb>=_0x26e07c){_0x34b9cb=_0x26e07c;_0x3a2545=0xc8;}else{_0x3a2545=0xce;}_0x49e72c[_0xc6ba('0x16')](_0x3a2545);return _0x49e72c[_0xc6ba('0x1b')]('Content-Range',_0x34e482+'-'+_0x34b9cb+'/'+_0x26e07c)[_0xc6ba('0x1c')](_0x53f745);}return null;};}function patchUpdates(_0x297db7){return function(_0x186ce3){try{jsonpatch[_0xc6ba('0x1d')](_0x186ce3,_0x297db7,!![]);}catch(_0x1d84df){return BPromise['reject'](_0x1d84df);}return _0x186ce3[_0xc6ba('0x1e')]();};}function saveUpdates(_0x4b853a,_0x47670c){return function(_0x12693d){if(_0x12693d){return _0x12693d[_0xc6ba('0x1f')](_0x4b853a)[_0xc6ba('0x20')](function(_0x556819){return _0x556819;});}return null;};}function removeEntity(_0x5c9695,_0x3b9d79){return function(_0x4af0bb){if(_0x4af0bb){return _0x4af0bb['destroy']()['then'](function(){_0x5c9695[_0xc6ba('0x16')](0xcc)[_0xc6ba('0x15')]();});}};}function handleEntityNotFound(_0x19aa3e,_0x80967){return function(_0x2b1c58){if(!_0x2b1c58){_0x19aa3e['sendStatus'](0x194);}return _0x2b1c58;};}function handleError(_0x33c2c8,_0x57f836){_0x57f836=_0x57f836||0x1f4;return function(_0x1d660d){logger[_0xc6ba('0x21')](_0x1d660d['stack']);if(_0x1d660d['name']){delete _0x1d660d[_0xc6ba('0x22')];}_0x33c2c8[_0xc6ba('0x16')](_0x57f836)[_0xc6ba('0x23')](_0x1d660d);};}exports['index']=function(_0x58a771,_0x86c754){var _0x432cc1={},_0xaf189d={},_0x366366={'count':0x0,'rows':[]};var _0xf563ef=_[_0xc6ba('0x24')](db[_0xc6ba('0x25')][_0xc6ba('0x26')],function(_0x40228e){return{'name':_0x40228e[_0xc6ba('0x27')],'type':_0x40228e['type'][_0xc6ba('0x28')]};});_0xaf189d['model']=_[_0xc6ba('0x29')](_[_0xc6ba('0x24')](_0xf563ef,_0xc6ba('0x22')),['format']);_0xaf189d['query']=_['keys'](_0x58a771[_0xc6ba('0x2a')]);_0xaf189d[_0xc6ba('0x2b')]=_[_0xc6ba('0x2c')](_0xaf189d[_0xc6ba('0x2d')],_0xaf189d[_0xc6ba('0x2a')]);_0x432cc1[_0xc6ba('0x2e')]=_[_0xc6ba('0x2c')](_0xaf189d['model'],qs['fields'](_0x58a771[_0xc6ba('0x2a')][_0xc6ba('0x2f')]));_0x432cc1[_0xc6ba('0x2e')]=_0x432cc1['attributes'][_0xc6ba('0x30')]?_0x432cc1['attributes']:_0xaf189d[_0xc6ba('0x2d')];if(!_0x58a771['query']['hasOwnProperty'](_0xc6ba('0x31'))){_0x432cc1[_0xc6ba('0x19')]=qs[_0xc6ba('0x19')](_0x58a771[_0xc6ba('0x2a')][_0xc6ba('0x19')]);_0x432cc1['offset']=qs['offset'](_0x58a771['query']['offset']);}_0x432cc1[_0xc6ba('0x32')]=qs[_0xc6ba('0x33')](_0x58a771[_0xc6ba('0x2a')][_0xc6ba('0x33')]);_0x432cc1[_0xc6ba('0x34')]=qs[_0xc6ba('0x2b')](_[_0xc6ba('0x35')](_0x58a771[_0xc6ba('0x2a')],_0xaf189d['filters']),_0xf563ef);if(_0x58a771[_0xc6ba('0x2a')]['filter']){_0x432cc1[_0xc6ba('0x34')]=_[_0xc6ba('0x36')](_0x432cc1[_0xc6ba('0x34')],{'$or':_[_0xc6ba('0x24')](_0xf563ef,function(_0xe24172){if(_0xe24172[_0xc6ba('0x37')]!==_0xc6ba('0x38')){var _0x2d7e45={};_0x2d7e45[_0xe24172[_0xc6ba('0x22')]]={'$like':'%'+_0x58a771['query'][_0xc6ba('0x39')]+'%'};return _0x2d7e45;}})});}_0x432cc1=_[_0xc6ba('0x36')]({},_0x432cc1,_0x58a771[_0xc6ba('0x3a')]);var _0x185b58={'where':_0x432cc1[_0xc6ba('0x34')]};return db[_0xc6ba('0x25')][_0xc6ba('0x1a')](_0x185b58)['then'](function(_0x246040){_0x366366[_0xc6ba('0x1a')]=_0x246040;if(_0x58a771[_0xc6ba('0x2a')][_0xc6ba('0x3b')]){_0x432cc1[_0xc6ba('0x3c')]=[{'all':!![]}];}return db[_0xc6ba('0x25')][_0xc6ba('0x3d')](_0x432cc1);})[_0xc6ba('0x20')](function(_0x403acd){_0x366366[_0xc6ba('0x3e')]=_0x403acd;return _0x366366;})[_0xc6ba('0x20')](respondWithFilteredResult(_0x86c754,_0x432cc1))[_0xc6ba('0x3f')](handleError(_0x86c754,null));};exports[_0xc6ba('0x40')]=function(_0x5e7269,_0x18ccaf){var _0x326071={'raw':![],'where':{'id':_0x5e7269[_0xc6ba('0x41')]['id']}},_0x406257={};_0x406257[_0xc6ba('0x2d')]=_[_0xc6ba('0x42')](db[_0xc6ba('0x25')]['rawAttributes']);_0x406257[_0xc6ba('0x2a')]=_[_0xc6ba('0x42')](_0x5e7269[_0xc6ba('0x2a')]);_0x406257['filters']=_[_0xc6ba('0x2c')](_0x406257[_0xc6ba('0x2d')],_0x406257[_0xc6ba('0x2a')]);_0x326071[_0xc6ba('0x2e')]=_[_0xc6ba('0x2c')](_0x406257[_0xc6ba('0x2d')],qs['fields'](_0x5e7269['query'][_0xc6ba('0x2f')]));_0x326071[_0xc6ba('0x2e')]=_0x326071['attributes'][_0xc6ba('0x30')]?_0x326071[_0xc6ba('0x2e')]:_0x406257[_0xc6ba('0x2d')];if(_0x5e7269[_0xc6ba('0x2a')][_0xc6ba('0x3b')]){_0x326071['include']=[{'all':!![]}];}_0x326071=_[_0xc6ba('0x36')]({},_0x326071,_0x5e7269[_0xc6ba('0x3a')]);return db[_0xc6ba('0x25')]['find'](_0x326071)[_0xc6ba('0x20')](handleEntityNotFound(_0x18ccaf,null))[_0xc6ba('0x20')](respondWithResult(_0x18ccaf,null))[_0xc6ba('0x3f')](handleError(_0x18ccaf,null));};exports['create']=function(_0x2ec55d,_0x688e23){return db[_0xc6ba('0x25')]['create'](_0x2ec55d[_0xc6ba('0x43')],{})[_0xc6ba('0x20')](respondWithResult(_0x688e23,0xc9))[_0xc6ba('0x3f')](handleError(_0x688e23,null));};exports[_0xc6ba('0x1f')]=function(_0x562b9c,_0x3ee5fd){if(_0x562b9c[_0xc6ba('0x43')]['id']){delete _0x562b9c['body']['id'];}return db[_0xc6ba('0x25')][_0xc6ba('0x44')]({'where':{'id':_0x562b9c['params']['id']}})[_0xc6ba('0x20')](handleEntityNotFound(_0x3ee5fd,null))['then'](saveUpdates(_0x562b9c[_0xc6ba('0x43')],null))['then'](respondWithResult(_0x3ee5fd,null))[_0xc6ba('0x3f')](handleError(_0x3ee5fd,null));};exports[_0xc6ba('0x45')]=function(_0x4bc95a,_0x40d40e){return db[_0xc6ba('0x25')][_0xc6ba('0x45')]()['then'](respondWithResult(_0x40d40e,null))[_0xc6ba('0x3f')](handleError(_0x40d40e,null));};exports[_0xc6ba('0x46')]=function(_0x502809,_0x25cc03,_0xc3d129){var _0x3d6a53=require('../../components/encryptor');var _0x437360=![];var _0x105fcf={};if(_0x502809[_0xc6ba('0x2a')][_0xc6ba('0x37')]&&_0x502809[_0xc6ba('0x2a')][_0xc6ba('0x37')]===_0xc6ba('0x47')){_0x105fcf[_0xc6ba('0x47')]=_0x502809[_0xc6ba('0x41')]['id'];}else{_0x105fcf['id']=_0x502809[_0xc6ba('0x41')]['id'];}return db[_0xc6ba('0x25')][_0xc6ba('0x44')]({'where':_0x105fcf,'attributes':['id',_0xc6ba('0x48')],'raw':!![]})[_0xc6ba('0x20')](handleEntityNotFound(_0x25cc03,null))[_0xc6ba('0x20')](function(_0x433fb0){if(_0x433fb0){var _0x8e29f4=_0x433fb0[_0xc6ba('0x48')];var _0x23cb89=util['format'](_0xc6ba('0x49'),_0x8e29f4);if(fs[_0xc6ba('0x4a')](_0x23cb89)){_0x437360=!![];return _0x3d6a53[_0xc6ba('0x4b')](_0x23cb89,_0x8e29f4,config['secrets'][_0xc6ba('0x4c')])[_0xc6ba('0x20')](function(){return _0x433fb0;});}return _0x433fb0;}})[_0xc6ba('0x20')](function(_0x295503){if(_0x295503){var _0x16ffe9=_0x295503[_0xc6ba('0x48')];if(!fs[_0xc6ba('0x4a')](_0x16ffe9)){throw new db[(_0xc6ba('0x4d'))][(_0xc6ba('0x4e'))](_0xc6ba('0x4f'));}if(_0x295503['filename']){return _0x25cc03[_0xc6ba('0x46')](_0x16ffe9,_0x295503['filename']+path[_0xc6ba('0x50')](_0x16ffe9),function(){if(_0x437360){fs['unlink'](_0x16ffe9);}});}else{return _0x25cc03['download'](_0x16ffe9,function(_0x2e271b){if(_0x437360){fs[_0xc6ba('0x51')](_0x16ffe9);}});}}})[_0xc6ba('0x3f')](function(_0x166ff5){if(_0x166ff5['message']===_0xc6ba('0x4f')){_0x25cc03[_0xc6ba('0x16')](0x194)[_0xc6ba('0x23')](_0xc6ba('0x52'));}else{return handleError(_0x25cc03,null);}});};exports['downloads']=function(_0x3f46db,_0x341f03,_0x53c830){var _0x384644=require('../../components/encryptor');var _0x23d3cf=![];var _0x2f2f4a={'$and':[db[_0xc6ba('0x53')][_0xc6ba('0x34')](db[_0xc6ba('0x53')]['fn'](_0xc6ba('0x54'),db[_0xc6ba('0x53')][_0xc6ba('0x55')](_0xc6ba('0x47'))),_0x3f46db[_0xc6ba('0x2a')][_0xc6ba('0x56')])]};if(_0x3f46db[_0xc6ba('0x2a')][_0xc6ba('0x37')]&&_0x3f46db[_0xc6ba('0x2a')][_0xc6ba('0x37')]==='uniqueid'){_0x2f2f4a[_0xc6ba('0x57')][_0xc6ba('0x58')]({'uniqueid':_0x3f46db[_0xc6ba('0x41')]['id']});}else{_0x2f2f4a[_0xc6ba('0x57')][_0xc6ba('0x58')]({'id':_0x3f46db['params']['id']});}return db[_0xc6ba('0x25')][_0xc6ba('0x44')]({'where':_0x2f2f4a,'attributes':['id','value'],'raw':!![]})[_0xc6ba('0x20')](handleEntityNotFound(_0x341f03,null))[_0xc6ba('0x20')](function(_0x2048be){if(_0x2048be){var _0x259afa=util['format']('%s.cypher',_0x2048be[_0xc6ba('0x48')]);if(fs['existsSync'](_0x259afa)){_0x23d3cf=!![];return _0x384644['decryptFile'](_0x259afa,_0x2048be['value'],config[_0xc6ba('0x59')][_0xc6ba('0x4c')])[_0xc6ba('0x20')](function(){return _0x2048be;});}return _0x2048be;}})[_0xc6ba('0x20')](function(_0x420f4a){if(_0x420f4a){if(!fs['existsSync'](_0x420f4a['value'])){throw new db[(_0xc6ba('0x4d'))][(_0xc6ba('0x4e'))](_0xc6ba('0x4f'));}if(_0x420f4a[_0xc6ba('0x5a')]){return _0x341f03[_0xc6ba('0x46')](_0x420f4a['value'],_0x420f4a[_0xc6ba('0x5a')]+path[_0xc6ba('0x50')](_0x420f4a[_0xc6ba('0x48')]),function(){if(_0x23d3cf){fs[_0xc6ba('0x51')](_0x420f4a[_0xc6ba('0x48')]);}});}else{return _0x341f03[_0xc6ba('0x46')](_0x420f4a[_0xc6ba('0x48')],function(_0x4941f0){if(_0x23d3cf){fs[_0xc6ba('0x51')](_0x420f4a[_0xc6ba('0x48')]);}});}}})[_0xc6ba('0x3f')](handleError(_0x341f03,null));};exports[_0xc6ba('0x5b')]=function(_0x4adc33,_0x4a7f5e){return db[_0xc6ba('0x25')]['find']({'where':{'id':_0x4adc33[_0xc6ba('0x41')]['id']}})[_0xc6ba('0x20')](function(_0x5b862b){if(_['isNil'](_0x5b862b)){throw new ReferenceError(_0xc6ba('0x5c'));}return _0x5b862b;})[_0xc6ba('0x20')](function(_0x3c6df5){var _0x2dfcb6=_0x3c6df5[_0xc6ba('0x48')];logger[_0xc6ba('0x5d')](_0xc6ba('0x5e'),_0x2dfcb6);if(!_['isNil'](_0x3c6df5[_0xc6ba('0x48')])&&fs[_0xc6ba('0x4a')](_0x2dfcb6)){logger[_0xc6ba('0x5d')]('File:\x20\x22'+_0x2dfcb6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2dfcb6);}_0x2dfcb6=_0x2dfcb6+'.cypher';if(!_[_0xc6ba('0x5f')](_0x3c6df5[_0xc6ba('0x48')])&&fs[_0xc6ba('0x4a')](_0x2dfcb6)){logger['info'](_0xc6ba('0x60')+_0x2dfcb6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2dfcb6);}return _0x3c6df5;})[_0xc6ba('0x20')](function(_0x23c0f4){if(!_0x23c0f4)throw new InternalError();return _0x23c0f4[_0xc6ba('0x5b')]();})[_0xc6ba('0x20')](function(){_0x4a7f5e[_0xc6ba('0x16')](0xcc)[_0xc6ba('0x15')]();})[_0xc6ba('0x3f')](handleError(_0x4a7f5e,null));};function getBucketslist(_0x444713,_0x488b2e,_0x59ecf0){return new Promise(function(_0x51a27b,_0x36abce){var _0x4942fe=new AWS['S3']({'accessKeyId':_0x488b2e,'secretAccessKey':_0x444713,'region':_0x59ecf0});_0x4942fe[_0xc6ba('0x61')]({},function(_0x42989a,_0x236a0c){if(_0x42989a){return _0x36abce(_0x42989a);}else{return _0x51a27b(_0x236a0c);}});});}function createBucket(_0x52a10a,_0x2bf864,_0x4abb40,_0x4c1c88){return new Promise(function(_0x310d44,_0x4234ee){var _0x592402=new AWS['S3']({'accessKeyId':_0x2bf864,'secretAccessKey':_0x52a10a,'region':_0x4abb40});_0x592402['createBucket']({'Bucket':_0x4c1c88},function(_0x58ae68,_0x33ab7c){if(_0x58ae68){return _0x4234ee(_0x58ae68);}else{return _0x310d44(_0x33ab7c);}});});}function uploadFile(_0x384022,_0x1b137a,_0x16c861,_0x3d6bd8,_0x1a53b9,_0x2ae0f5){return new Promise(function(_0x725a0b,_0x20b289){var _0x1e4305=new AWS['S3']({'accessKeyId':_0x1b137a,'secretAccessKey':_0x384022,'region':_0x16c861});_0x1e4305[_0xc6ba('0x62')]({'Bucket':_0x3d6bd8,'Key':_0x1a53b9,'Body':_0x2ae0f5},function(_0x58baa2,_0x3fad62){if(_0x58baa2){return _0x20b289(_0x58baa2);}else{return _0x725a0b(_0x3fad62);}});});}function startTranscribe(_0x1ba8c9,_0x402f87,_0x2df28d,_0x35e2ae,_0xd94b4c,_0x160ffb){return new Promise(function(_0x3116d3,_0x30e10f){var _0x5dd9b9=new AWS[(_0xc6ba('0x63'))]({'accessKeyId':_0x402f87,'secretAccessKey':_0x1ba8c9,'region':_0x2df28d});_0x5dd9b9[_0xc6ba('0x64')]({'TranscriptionJobName':_0x35e2ae,'LanguageCode':_0xd94b4c,'Media':{'MediaFileUri':_0x160ffb}},function(_0x409209,_0x4b5771){if(_0x409209){return _0x30e10f(_0x409209);}else{return _0x3116d3(_0x4b5771);}});});}function transcribe(_0x34b50a,_0x436581,_0x5046a0,_0x557efb,_0xffffe9,_0x4fc9f3,_0x293ab7){return new Promise(function(_0xf2f8b5,_0x18e513){var _0x9e148c={};logger[_0xc6ba('0x5d')](util[_0xc6ba('0x65')](_0xc6ba('0x66'),_0x34b50a,_0xffffe9));return uploadFile(_0x436581,_0x5046a0,_0x557efb,_0xffffe9,path[_0xc6ba('0x67')](_0x4fc9f3),fs['readFileSync'](_0x4fc9f3))['then'](function(_0x4ba4e0){logger[_0xc6ba('0x5d')](util[_0xc6ba('0x65')](_0xc6ba('0x68'),_0x34b50a,_0xffffe9,_0x4ba4e0[_0xc6ba('0x69')]));_0x9e148c['bucket']=_0x4ba4e0[_0xc6ba('0x6a')];_0x9e148c['location']=_0x4ba4e0[_0xc6ba('0x69')];logger[_0xc6ba('0x5d')](util['format'](_0xc6ba('0x6b'),_0x34b50a));return startTranscribe(_0x436581,_0x5046a0,_0x557efb,uuidv4(),_0x293ab7,_0x4ba4e0[_0xc6ba('0x69')]);})[_0xc6ba('0x20')](function(_0x41ea0f){logger['info'](util[_0xc6ba('0x65')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x34b50a,_0x41ea0f[_0xc6ba('0x6c')][_0xc6ba('0x6d')]));_0x9e148c[_0xc6ba('0x6e')]=_0x41ea0f['TranscriptionJob'][_0xc6ba('0x6d')];_0x9e148c[_0xc6ba('0x6f')]=_0x41ea0f[_0xc6ba('0x6c')]['TranscriptionJobStatus'];return _0xf2f8b5(_0x9e148c);})[_0xc6ba('0x3f')](function(_0x11bf48){return _0x18e513(_0x11bf48);});});}exports[_0xc6ba('0x70')]=function(_0x454010,_0x51a64f,_0xec5d2f){var _0x236103;var _0x467e9f;var _0x470322;var _0x3a1c75=require(_0xc6ba('0x71'));return db['VoiceRecording'][_0xc6ba('0x72')]({'where':{'id':_0x454010[_0xc6ba('0x41')]['id']}})['then'](function(_0x1d6c00){if(_0x1d6c00){var _0xce296f=util[_0xc6ba('0x65')](_0xc6ba('0x49'),_0x1d6c00[_0xc6ba('0x48')]);if(fs[_0xc6ba('0x4a')](_0xce296f)){cypher=!![];return _0x3a1c75['decryptFile'](_0xce296f,_0x1d6c00[_0xc6ba('0x48')],config[_0xc6ba('0x59')]['recording'])[_0xc6ba('0x20')](function(){return _0x1d6c00;});}return _0x1d6c00;}})[_0xc6ba('0x20')](function(_0x4cb99e){if(!_0x4cb99e){throw new db[(_0xc6ba('0x4d'))][(_0xc6ba('0x4e'))](_0xc6ba('0x73'));}_0x467e9f=_0x4cb99e;return db[_0xc6ba('0x74')][_0xc6ba('0x72')]({'where':{'id':0x1}});})[_0xc6ba('0x20')](handleEntityNotFound(_0x51a64f,null))[_0xc6ba('0x20')](function(_0x5538c0){if(_0x5538c0){_0x236103=_0x5538c0;if(!_0x236103[_0xc6ba('0x75')]||!_0x236103[_0xc6ba('0x76')]||!_0x236103['transcribeRegion']||!_0x236103['language']||!_0x236103['bucket']){throw new db[(_0xc6ba('0x4d'))]['ValidationError'](_0xc6ba('0x77'));}if(_0x454010[_0xc6ba('0x43')][_0xc6ba('0x78')]&&(!_0x236103[_0xc6ba('0x79')]||!_0x236103[_0xc6ba('0x7a')]||!_0x236103['sentimentRegion']||!_0x236103[_0xc6ba('0x7b')]||!_0x236103[_0xc6ba('0x7c')])){throw new db[(_0xc6ba('0x4d'))][(_0xc6ba('0x4e'))](_0xc6ba('0x7d'));}return db[_0xc6ba('0x7e')][_0xc6ba('0x72')]({'where':{'id':_0x236103[_0xc6ba('0x76')]}});}})['then'](function(_0x415219){if(!_0x415219){throw new db[(_0xc6ba('0x4d'))][(_0xc6ba('0x4e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x415219[_0xc6ba('0x7f')]||!_0x415219[_0xc6ba('0x80')]){throw new db[(_0xc6ba('0x4d'))][(_0xc6ba('0x4e'))](_0xc6ba('0x81'));}_0x470322=_0x415219;return getBucketslist(_0x470322[_0xc6ba('0x7f')],_0x470322['data2'],_0x236103['transcribeRegion']);})[_0xc6ba('0x20')](function(_0x6aee43){if(_0x6aee43&&_0x6aee43[_0xc6ba('0x82')]){var _0x5d3376=_[_0xc6ba('0x44')](_0x6aee43[_0xc6ba('0x82')],function(_0xf05846){return _0xf05846[_0xc6ba('0x83')]===_0x236103[_0xc6ba('0x7c')];});if(!_0x5d3376){logger[_0xc6ba('0x5d')](util[_0xc6ba('0x65')](_0xc6ba('0x84'),_0x454010[_0xc6ba('0x41')]['id'],_0x236103[_0xc6ba('0x7c')]));return createBucket(_0x470322[_0xc6ba('0x7f')],_0x470322['data2'],_0x236103[_0xc6ba('0x85')],_0x236103[_0xc6ba('0x7c')]);}logger[_0xc6ba('0x5d')](util[_0xc6ba('0x65')](_0xc6ba('0x86'),_0x454010[_0xc6ba('0x41')]['id'],_0x236103[_0xc6ba('0x7c')]));return;}})[_0xc6ba('0x20')](function(_0x1d7881){if(_0x467e9f[_0xc6ba('0x6f')]===_0xc6ba('0x87')){return transcribe(_0x454010[_0xc6ba('0x41')]['id'],_0x470322[_0xc6ba('0x7f')],_0x470322[_0xc6ba('0x80')],_0x236103[_0xc6ba('0x85')],_0x236103[_0xc6ba('0x7c')],_0x467e9f['value'],_0x236103[_0xc6ba('0x7b')]);}else{logger[_0xc6ba('0x5d')](util[_0xc6ba('0x65')](_0xc6ba('0x88'),_0x454010['params']['id']));return{'transcribeStatus':_0xc6ba('0x89')};}})[_0xc6ba('0x20')](function(_0x2ebef5){if(_0x2ebef5){_0x2ebef5[_0xc6ba('0x8a')]=_0x454010[_0xc6ba('0x43')][_0xc6ba('0x78')];return _0x467e9f['updateAttributes'](_0x2ebef5);}})['then'](respondWithResult(_0x51a64f,null))[_0xc6ba('0x3f')](handleError(_0x51a64f,null));};function writeFile(_0x5ae104,_0x22fc1f){return new Promise(function(_0x59e6f6,_0x20efaf){fs['writeFile'](_0x22fc1f,_0x5ae104,function(_0x4d1f86,_0xf8b74a){if(_0x4d1f86){return _0x20efaf(_0x4d1f86);}else{return _0x59e6f6(_0xf8b74a);}});});}exports[_0xc6ba('0x8b')]=function(_0x51134c,_0x32e692,_0x5bc8c7){return db[_0xc6ba('0x25')][_0xc6ba('0x72')]({'where':{'id':_0x51134c[_0xc6ba('0x41')]['id']}})[_0xc6ba('0x20')](handleEntityNotFound(_0x32e692))[_0xc6ba('0x20')](function(_0x61909d){if(_0x61909d&&_0x61909d[_0xc6ba('0x8c')]){var _0x10cb77=_0x61909d[_0xc6ba('0x8c')];var _0xc3dda=config[_0xc6ba('0x8d')]+'/server/files/transcribes/transcribe_'+_0x61909d['id']+_0xc6ba('0x8e');if(fs[_0xc6ba('0x4a')](_0xc3dda)){return _0xc3dda;}return writeFile(_0x10cb77,_0xc3dda)[_0xc6ba('0x20')](function(){return _0xc3dda;});}else{throw new db['Sequelize'][(_0xc6ba('0x4e'))](_0xc6ba('0x8f'));}})[_0xc6ba('0x20')](function(_0x1a91a7){return _0x32e692[_0xc6ba('0x46')](_0x1a91a7);})[_0xc6ba('0x3f')](handleError(_0x32e692));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6e22be6..9c8b062 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 _0xb397=['voice_recordings','uniqueid','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceRecording.attributes','define','VoiceRecording'];(function(_0xfceef5,_0x2145dc){var _0x146cf8=function(_0x9b37f9){while(--_0x9b37f9){_0xfceef5['push'](_0xfceef5['shift']());}};_0x146cf8(++_0x2145dc);}(_0xb397,0x1af));var _0x7b39=function(_0x571987,_0x1d2c41){_0x571987=_0x571987-0x0;var _0x84bc3b=_0xb397[_0x571987];return _0x84bc3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7b39('0x0'))(_0x7b39('0x1'));var moment=require(_0x7b39('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b39('0x3'));var fs=require('fs');var path=require(_0x7b39('0x4'));var rimraf=require('rimraf');var config=require(_0x7b39('0x5'));var attributes=require(_0x7b39('0x6'));module['exports']=function(_0x117675,_0x9d671f){return _0x117675[_0x7b39('0x7')](_0x7b39('0x8'),attributes,{'tableName':_0x7b39('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7b39('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x349e=['bluebird','request-promise','path','rimraf','./voiceRecording.attributes','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5c34aa,_0x2946d2){var _0x162073=function(_0x299259){while(--_0x299259){_0x5c34aa['push'](_0x5c34aa['shift']());}};_0x162073(++_0x2946d2);}(_0x349e,0xcb));var _0xe349=function(_0xd500b3,_0x3a3bff){_0xd500b3=_0xd500b3-0x0;var _0xd3331=_0x349e[_0xd500b3];return _0xd3331;};'use strict';var _=require(_0xe349('0x0'));var util=require(_0xe349('0x1'));var logger=require(_0xe349('0x2'))(_0xe349('0x3'));var moment=require(_0xe349('0x4'));var BPromise=require(_0xe349('0x5'));var rp=require(_0xe349('0x6'));var fs=require('fs');var path=require(_0xe349('0x7'));var rimraf=require(_0xe349('0x8'));var config=require('../../config/environment');var attributes=require(_0xe349('0x9'));module['exports']=function(_0x55aae6,_0xb21068){return _0x55aae6['define'](_0xe349('0xa'),attributes,{'tableName':_0xe349('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe349('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 56e99b0..800c945 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 _0x4888=['recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateVoiceRecording','VoiceRecording','update','body','options','where','attributes','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','value','format','%s.cypher','encryptFile','secrets'];(function(_0x317249,_0x90339c){var _0x530795=function(_0x4224ea){while(--_0x4224ea){_0x317249['push'](_0x317249['shift']());}};_0x530795(++_0x90339c);}(_0x4888,0x198));var _0x8488=function(_0xe6894,_0x5a1755){_0xe6894=_0xe6894-0x0;var _0x4e2ea7=_0x4888[_0xe6894];return _0x4e2ea7;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});}exports[_0x8488('0x17')]=function(_0x60ae2f){var _0x39775f=this;return new Promise(function(_0x1aedb1,_0x27c62a){return db[_0x8488('0x18')][_0x8488('0x19')](_0x60ae2f[_0x8488('0x1a')],{'raw':_0x60ae2f[_0x8488('0x1b')]?_0x60ae2f[_0x8488('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60ae2f['options']?_0x60ae2f[_0x8488('0x1b')][_0x8488('0x1c')]||null:null,'attributes':_0x60ae2f[_0x8488('0x1b')]?_0x60ae2f[_0x8488('0x1b')][_0x8488('0x1d')]||null:null,'limit':_0x60ae2f[_0x8488('0x1b')]?_0x60ae2f[_0x8488('0x1b')][_0x8488('0x1e')]||null:null})[_0x8488('0xd')](function(_0x5123d0){logger[_0x8488('0xe')](_0x8488('0x17'),_0x60ae2f);logger[_0x8488('0x11')](_0x8488('0x17'),_0x60ae2f,JSON[_0x8488('0x12')](_0x5123d0));_0x1aedb1(_0x5123d0);})['catch'](function(_0x577234){logger['error']('UpdateVoiceRecording',_0x577234[_0x8488('0x15')],_0x60ae2f);_0x27c62a(_0x39775f['error'](0x1f4,_0x577234['message']));});});};exports[_0x8488('0x1f')]=function(_0x2f350a){var _0x2b3c97=this;return new Promise(function(_0x6ebee0,_0x287662){var _0x503b83=require(_0x8488('0x20'));var _0x38c137;return db[_0x8488('0x21')][_0x8488('0x22')]({'attributes':['id',_0x8488('0x23')],'where':{'id':0x1},'raw':!![]})[_0x8488('0xd')](function(_0x2c15ff){_0x38c137=_0x2c15ff;return db[_0x8488('0x18')][_0x8488('0x24')](_0x2f350a[_0x8488('0x1a')]);})[_0x8488('0xd')](function(_0x58d0cc){if(_0x38c137['callRecordingEncryption']&&fs['existsSync'](_0x58d0cc[_0x8488('0x25')])){var _0x408c36=util[_0x8488('0x26')](_0x8488('0x27'),_0x58d0cc[_0x8488('0x25')]);return _0x503b83[_0x8488('0x28')](_0x58d0cc['value'],_0x408c36,config[_0x8488('0x29')][_0x8488('0x2a')])[_0x8488('0xd')](function(){fs[_0x8488('0x2b')](_0x58d0cc[_0x8488('0x25')]);logger['info'](_0x8488('0x2c'));return _0x58d0cc;});}return _0x58d0cc;})[_0x8488('0xd')](function(_0x579d50){logger[_0x8488('0xe')](_0x8488('0x1f'),_0x2f350a);logger[_0x8488('0x11')](_0x8488('0x1f'),_0x2f350a,JSON[_0x8488('0x12')](_0x579d50));_0x6ebee0(_0x579d50);})['catch'](function(_0x44c8f3){logger[_0x8488('0x13')](_0x8488('0x1f'),_0x44c8f3['message'],_0x2f350a);_0x287662(_0x2b3c97[_0x8488('0x13')](0x1f4,_0x44c8f3['message']));});});}; \ No newline at end of file +var _0x0424=['stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s'];(function(_0x263a16,_0x489c01){var _0x251824=function(_0x510c89){while(--_0x510c89){_0x263a16['push'](_0x263a16['shift']());}};_0x251824(++_0x489c01);}(_0x0424,0x159));var _0x4042=function(_0x5e8c7c,_0x3429c6){_0x5e8c7c=_0x5e8c7c-0x0;var _0x48f7bd=_0x0424[_0x5e8c7c];return _0x48f7bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('VoiceRecording,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['update'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x466077['options']?_0x466077[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'attributes':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')]['attributes']||null:null,'limit':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x1b')]||null:null})[_0x4042('0xa')](function(_0x352631){logger['info'](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('UpdateVoiceRecording',_0x466077,JSON[_0x4042('0xf')](_0x352631));_0xe5c1ec(_0x352631);})['catch'](function(_0x271b82){logger[_0x4042('0x10')](_0x4042('0x15'),_0x271b82['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0x271b82[_0x4042('0x11')]));});});};exports[_0x4042('0x1c')]=function(_0xbdadc8){var _0x1c4d9f=this;return new Promise(function(_0x52e575,_0x58c409){var _0x1d8d48=require(_0x4042('0x1d'));var _0x26542c;return db[_0x4042('0x1e')][_0x4042('0x1f')]({'attributes':['id',_0x4042('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x33733b){_0x26542c=_0x33733b;return db[_0x4042('0x16')]['create'](_0xbdadc8[_0x4042('0x17')]);})[_0x4042('0xa')](function(_0xe924fe){if(_0x26542c['callRecordingEncryption']&&fs['existsSync'](_0xe924fe[_0x4042('0x21')])){var _0x43bd1c=util['format'](_0x4042('0x22'),_0xe924fe[_0x4042('0x21')]);return _0x1d8d48[_0x4042('0x23')](_0xe924fe[_0x4042('0x21')],_0x43bd1c,config[_0x4042('0x24')][_0x4042('0x25')])[_0x4042('0xa')](function(){fs[_0x4042('0x26')](_0xe924fe[_0x4042('0x21')]);logger['info'](_0x4042('0x27'));return _0xe924fe;});}return _0xe924fe;})[_0x4042('0xa')](function(_0x5320f8){logger[_0x4042('0x12')](_0x4042('0x1c'),_0xbdadc8);logger['debug'](_0x4042('0x1c'),_0xbdadc8,JSON[_0x4042('0xf')](_0x5320f8));_0x52e575(_0x5320f8);})[_0x4042('0x14')](function(_0xaa7c99){logger[_0x4042('0x10')](_0x4042('0x1c'),_0xaa7c99[_0x4042('0x11')],_0xbdadc8);_0x58c409(_0x1c4d9f[_0x4042('0x10')](0x1f4,_0xaa7c99[_0x4042('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index e55a068..8184beb 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 _0x8ad8=['exports','util','path','express','fs-extra','./voiceTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy'];(function(_0x14ed9d,_0x31a698){var _0x45bc46=function(_0x2de349){while(--_0x2de349){_0x14ed9d['push'](_0x14ed9d['shift']());}};_0x45bc46(++_0x31a698);}(_0x8ad8,0x1a1));var _0x88ad=function(_0x3b0be5,_0x2f850f){_0x3b0be5=_0x3b0be5-0x0;var _0xd7117f=_0x8ad8[_0x3b0be5];return _0xd7117f;};'use strict';var multer=require('multer');var util=require(_0x88ad('0x0'));var path=require(_0x88ad('0x1'));var timeout=require('connect-timeout');var express=require(_0x88ad('0x2'));var router=express['Router']();var fs_extra=require(_0x88ad('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x88ad('0x4'));router[_0x88ad('0x5')]('/',auth[_0x88ad('0x6')](),controller['index']);router[_0x88ad('0x5')](_0x88ad('0x7'),auth[_0x88ad('0x6')](),controller['describe']);router[_0x88ad('0x5')](_0x88ad('0x8'),auth[_0x88ad('0x6')](),controller[_0x88ad('0x9')]);router[_0x88ad('0xa')]('/',auth[_0x88ad('0x6')](),controller[_0x88ad('0xb')]);router[_0x88ad('0xc')](_0x88ad('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x88ad('0xd')](_0x88ad('0x8'),auth[_0x88ad('0x6')](),controller[_0x88ad('0xe')]);module[_0x88ad('0xf')]=router; \ No newline at end of file +var _0x631b=['isAuthenticated','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0x631b,0xf7));var _0xb631=function(_0x31bd8b,_0x56fa02){_0x31bd8b=_0x31bd8b-0x0;var _0x1506e4=_0x631b[_0x31bd8b];return _0x1506e4;};'use strict';var multer=require(_0xb631('0x0'));var util=require(_0xb631('0x1'));var path=require(_0xb631('0x2'));var timeout=require(_0xb631('0x3'));var express=require(_0xb631('0x4'));var router=express[_0xb631('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb631('0x6'));var config=require(_0xb631('0x7'));var controller=require('./voiceTransferReport.controller');router[_0xb631('0x8')]('/',auth['isAuthenticated'](),controller[_0xb631('0x9')]);router['get'](_0xb631('0xa'),auth['isAuthenticated'](),controller[_0xb631('0xb')]);router[_0xb631('0x8')](_0xb631('0xc'),auth[_0xb631('0xd')](),controller[_0xb631('0xe')]);router[_0xb631('0xf')]('/',auth[_0xb631('0xd')](),controller['create']);router[_0xb631('0x10')](_0xb631('0xc'),auth[_0xb631('0xd')](),controller[_0xb631('0x11')]);router[_0xb631('0x12')](_0xb631('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xb631('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 b4f696a..c076f39 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 _0x297a=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x85f077,_0x362348){var _0x37f55d=function(_0x2d10f4){while(--_0x2d10f4){_0x85f077['push'](_0x85f077['shift']());}};_0x37f55d(++_0x362348);}(_0x297a,0xf7));var _0xa297=function(_0x4ff44d,_0x4aea75){_0x4ff44d=_0x4ff44d-0x0;var _0x4eea65=_0x297a[_0x4ff44d];return _0x4eea65;};'use strict';var Sequelize=require(_0xa297('0x0'));var moment=require(_0xa297('0x1'));module[_0xa297('0x2')]={'type':{'type':Sequelize[_0xa297('0x3')](_0xa297('0x4'),_0xa297('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xa297('0x6')]},'transferercalleridname':{'type':Sequelize[_0xa297('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xa297('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xa297('0x6')]},'transferercontext':{'type':Sequelize[_0xa297('0x6')]},'transfererexten':{'type':Sequelize[_0xa297('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xa297('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xa297('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xa297('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xa297('0x6')]},'transfereeexten':{'type':Sequelize[_0xa297('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xa297('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0xa297('0x7'),'No')},'context':{'type':Sequelize[_0xa297('0x6')]},'extension':{'type':Sequelize[_0xa297('0x6')]}}; \ No newline at end of file +var _0xe0f1=['blind','attended','STRING','sequelize','exports','ENUM'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xe0f1,0x105));var _0x1e0f=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0xe0f1[_0x589aee];return _0x2f5ed4;};'use strict';var Sequelize=require(_0x1e0f('0x0'));var moment=require('moment');module[_0x1e0f('0x1')]={'type':{'type':Sequelize[_0x1e0f('0x2')](_0x1e0f('0x3'),_0x1e0f('0x4'))},'result':{'type':Sequelize[_0x1e0f('0x5')]},'transfererchannel':{'type':Sequelize[_0x1e0f('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x1e0f('0x5')]},'transferercalleridname':{'type':Sequelize[_0x1e0f('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x1e0f('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x1e0f('0x5')]},'transferercontext':{'type':Sequelize[_0x1e0f('0x5')]},'transfererexten':{'type':Sequelize[_0x1e0f('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x1e0f('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x1e0f('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x1e0f('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1e0f('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1e0f('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x1e0f('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1e0f('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x1e0f('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x1e0f('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 91c9235..b4a08aa 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 _0xc109=['filters','filter','VIRTUAL','then','includeAll','include','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','save','destroy','error','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','map','keys','query','intersection','attributes','model','fields','length','nolimit','order','where','pick'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0xc109,0xf2));var _0x9c10=function(_0x3fb2d4,_0x44a3a8){_0x3fb2d4=_0x3fb2d4-0x0;var _0x4cfd9a=_0xc109[_0x3fb2d4];return _0x4cfd9a;};'use strict';var emlformat=require(_0x9c10('0x0'));var rimraf=require(_0x9c10('0x1'));var zipdir=require(_0x9c10('0x2'));var jsonpatch=require(_0x9c10('0x3'));var rp=require(_0x9c10('0x4'));var moment=require('moment');var BPromise=require(_0x9c10('0x5'));var Mustache=require(_0x9c10('0x6'));var util=require(_0x9c10('0x7'));var path=require(_0x9c10('0x8'));var sox=require(_0x9c10('0x9'));var csv=require('to-csv');var ejs=require(_0x9c10('0xa'));var fs=require('fs');var fs_extra=require(_0x9c10('0xb'));var _=require(_0x9c10('0xc'));var squel=require('squel');var crypto=require(_0x9c10('0xd'));var jsforce=require(_0x9c10('0xe'));var deskjs=require(_0x9c10('0xf'));var toCsv=require(_0x9c10('0x10'));var querystring=require(_0x9c10('0x11'));var Papa=require(_0x9c10('0x12'));var Redis=require(_0x9c10('0x13'));var authService=require(_0x9c10('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9c10('0x15'));var hardwareService=require(_0x9c10('0x16'));var logger=require('../../config/logger')(_0x9c10('0x17'));var utils=require(_0x9c10('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9c10('0x19'));var db=require(_0x9c10('0x1a'))['db'];function respondWithStatusCode(_0xaf584f,_0x5c2520){_0x5c2520=_0x5c2520||0xcc;return function(_0x115287){if(_0x115287){return _0xaf584f[_0x9c10('0x1b')](_0x5c2520);}return _0xaf584f[_0x9c10('0x1c')](_0x5c2520)[_0x9c10('0x1d')]();};}function respondWithResult(_0x110e07,_0x2ccfbd){_0x2ccfbd=_0x2ccfbd||0xc8;return function(_0x2423f1){if(_0x2423f1){return _0x110e07[_0x9c10('0x1c')](_0x2ccfbd)[_0x9c10('0x1e')](_0x2423f1);}};}function respondWithFilteredResult(_0x17b007,_0x4fb051){return function(_0x6fb92f){if(_0x6fb92f){var _0x5f0527=typeof _0x4fb051[_0x9c10('0x1f')]===_0x9c10('0x20')&&typeof _0x4fb051[_0x9c10('0x21')]===_0x9c10('0x20');var _0x1db564=_0x6fb92f[_0x9c10('0x22')];var _0x47ed0a=_0x5f0527?0x0:_0x4fb051[_0x9c10('0x1f')];var _0x3e00ad=_0x5f0527?_0x6fb92f[_0x9c10('0x22')]:_0x4fb051[_0x9c10('0x1f')]+_0x4fb051[_0x9c10('0x21')];var _0x12c1a1;if(_0x3e00ad>=_0x1db564){_0x3e00ad=_0x1db564;_0x12c1a1=0xc8;}else{_0x12c1a1=0xce;}_0x17b007[_0x9c10('0x1c')](_0x12c1a1);return _0x17b007[_0x9c10('0x23')](_0x9c10('0x24'),_0x47ed0a+'-'+_0x3e00ad+'/'+_0x1db564)['json'](_0x6fb92f);}return null;};}function patchUpdates(_0x49b1e5){return function(_0x51f1d6){try{jsonpatch[_0x9c10('0x25')](_0x51f1d6,_0x49b1e5,!![]);}catch(_0x4bd629){return BPromise[_0x9c10('0x26')](_0x4bd629);}return _0x51f1d6[_0x9c10('0x27')]();};}function saveUpdates(_0x38ef6e,_0x16b5ef){return function(_0x444275){if(_0x444275){return _0x444275['update'](_0x38ef6e)['then'](function(_0x4faf76){return _0x4faf76;});}return null;};}function removeEntity(_0x1267dd,_0x3f2e3a){return function(_0x5ca660){if(_0x5ca660){return _0x5ca660[_0x9c10('0x28')]()['then'](function(){_0x1267dd[_0x9c10('0x1c')](0xcc)[_0x9c10('0x1d')]();});}};}function handleEntityNotFound(_0x36c5ca,_0x530455){return function(_0x43f699){if(!_0x43f699){_0x36c5ca['sendStatus'](0x194);}return _0x43f699;};}function handleError(_0xa6cc6d,_0x3aa3d0){_0x3aa3d0=_0x3aa3d0||0x1f4;return function(_0x53609a){logger[_0x9c10('0x29')](_0x53609a['stack']);if(_0x53609a[_0x9c10('0x2a')]){delete _0x53609a[_0x9c10('0x2a')];}_0xa6cc6d[_0x9c10('0x1c')](_0x3aa3d0)[_0x9c10('0x2b')](_0x53609a);};}exports[_0x9c10('0x2c')]=function(_0x3abd54,_0x346d87){var _0x27658c={},_0x1f58a6={},_0x547e1b={'count':0x0,'rows':[]};var _0x44fef3=_['map'](db[_0x9c10('0x2d')][_0x9c10('0x2e')],function(_0xeae248){return{'name':_0xeae248[_0x9c10('0x2f')],'type':_0xeae248[_0x9c10('0x30')][_0x9c10('0x31')]};});_0x1f58a6['model']=_[_0x9c10('0x32')](_0x44fef3,_0x9c10('0x2a'));_0x1f58a6['query']=_[_0x9c10('0x33')](_0x3abd54[_0x9c10('0x34')]);_0x1f58a6['filters']=_[_0x9c10('0x35')](_0x1f58a6['model'],_0x1f58a6[_0x9c10('0x34')]);_0x27658c[_0x9c10('0x36')]=_['intersection'](_0x1f58a6[_0x9c10('0x37')],qs['fields'](_0x3abd54['query'][_0x9c10('0x38')]));_0x27658c['attributes']=_0x27658c[_0x9c10('0x36')][_0x9c10('0x39')]?_0x27658c['attributes']:_0x1f58a6[_0x9c10('0x37')];if(!_0x3abd54['query']['hasOwnProperty'](_0x9c10('0x3a'))){_0x27658c[_0x9c10('0x21')]=qs['limit'](_0x3abd54[_0x9c10('0x34')][_0x9c10('0x21')]);_0x27658c['offset']=qs[_0x9c10('0x1f')](_0x3abd54[_0x9c10('0x34')][_0x9c10('0x1f')]);}_0x27658c[_0x9c10('0x3b')]=qs['sort'](_0x3abd54[_0x9c10('0x34')]['sort']);_0x27658c[_0x9c10('0x3c')]=qs['filters'](_[_0x9c10('0x3d')](_0x3abd54[_0x9c10('0x34')],_0x1f58a6[_0x9c10('0x3e')]),_0x44fef3);if(_0x3abd54[_0x9c10('0x34')][_0x9c10('0x3f')]){_0x27658c[_0x9c10('0x3c')]=_['merge'](_0x27658c[_0x9c10('0x3c')],{'$or':_['map'](_0x44fef3,function(_0x5c5202){if(_0x5c5202['type']!==_0x9c10('0x40')){var _0x1343c7={};_0x1343c7[_0x5c5202[_0x9c10('0x2a')]]={'$like':'%'+_0x3abd54[_0x9c10('0x34')][_0x9c10('0x3f')]+'%'};return _0x1343c7;}})});}_0x27658c=_['merge']({},_0x27658c,_0x3abd54['options']);var _0x525baa={'where':_0x27658c[_0x9c10('0x3c')]};return db[_0x9c10('0x2d')][_0x9c10('0x22')](_0x525baa)[_0x9c10('0x41')](function(_0x1bd906){_0x547e1b['count']=_0x1bd906;if(_0x3abd54[_0x9c10('0x34')][_0x9c10('0x42')]){_0x27658c[_0x9c10('0x43')]=[{'all':!![]}];}return db[_0x9c10('0x2d')]['findAll'](_0x27658c);})[_0x9c10('0x41')](function(_0x4805c6){_0x547e1b[_0x9c10('0x44')]=_0x4805c6;return _0x547e1b;})[_0x9c10('0x41')](respondWithFilteredResult(_0x346d87,_0x27658c))[_0x9c10('0x45')](handleError(_0x346d87,null));};exports[_0x9c10('0x46')]=function(_0x328660,_0x4c75db){var _0x44b7a5={'raw':!![],'where':{'id':_0x328660[_0x9c10('0x47')]['id']}},_0x413154={};_0x413154[_0x9c10('0x37')]=_[_0x9c10('0x33')](db['VoiceTransferReport'][_0x9c10('0x2e')]);_0x413154[_0x9c10('0x34')]=_['keys'](_0x328660[_0x9c10('0x34')]);_0x413154[_0x9c10('0x3e')]=_['intersection'](_0x413154[_0x9c10('0x37')],_0x413154['query']);_0x44b7a5['attributes']=_['intersection'](_0x413154[_0x9c10('0x37')],qs[_0x9c10('0x38')](_0x328660[_0x9c10('0x34')][_0x9c10('0x38')]));_0x44b7a5[_0x9c10('0x36')]=_0x44b7a5[_0x9c10('0x36')][_0x9c10('0x39')]?_0x44b7a5[_0x9c10('0x36')]:_0x413154[_0x9c10('0x37')];if(_0x328660['query'][_0x9c10('0x42')]){_0x44b7a5[_0x9c10('0x43')]=[{'all':!![]}];}_0x44b7a5=_['merge']({},_0x44b7a5,_0x328660['options']);return db[_0x9c10('0x2d')][_0x9c10('0x48')](_0x44b7a5)[_0x9c10('0x41')](handleEntityNotFound(_0x4c75db,null))[_0x9c10('0x41')](respondWithResult(_0x4c75db,null))[_0x9c10('0x45')](handleError(_0x4c75db,null));};exports[_0x9c10('0x49')]=function(_0xc0c53c,_0x3dd223){return db[_0x9c10('0x2d')]['create'](_0xc0c53c[_0x9c10('0x4a')],{})['then'](respondWithResult(_0x3dd223,0xc9))[_0x9c10('0x45')](handleError(_0x3dd223,null));};exports[_0x9c10('0x4b')]=function(_0x1f5980,_0x6a1159){if(_0x1f5980['body']['id']){delete _0x1f5980[_0x9c10('0x4a')]['id'];}return db['VoiceTransferReport'][_0x9c10('0x48')]({'where':{'id':_0x1f5980[_0x9c10('0x47')]['id']}})[_0x9c10('0x41')](handleEntityNotFound(_0x6a1159,null))[_0x9c10('0x41')](saveUpdates(_0x1f5980['body'],null))[_0x9c10('0x41')](respondWithResult(_0x6a1159,null))[_0x9c10('0x45')](handleError(_0x6a1159,null));};exports[_0x9c10('0x28')]=function(_0x4a0281,_0x10531d){return db['VoiceTransferReport']['find']({'where':{'id':_0x4a0281['params']['id']}})[_0x9c10('0x41')](handleEntityNotFound(_0x10531d,null))[_0x9c10('0x41')](removeEntity(_0x10531d,null))[_0x9c10('0x45')](handleError(_0x10531d,null));};exports['describe']=function(_0x4b1dfe,_0x2d209a){return db[_0x9c10('0x2d')]['describe']()[_0x9c10('0x41')](respondWithResult(_0x2d209a,null))[_0x9c10('0x45')](handleError(_0x2d209a,null));}; \ No newline at end of file +var _0x89f0=['catch','params','include','create','body','find','destroy','describe','rimraf','fast-json-patch','bluebird','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','rawAttributes','type','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','findAll'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0x89f0,0xd4));var _0x089f=function(_0x3f6393,_0x30ede6){_0x3f6393=_0x3f6393-0x0;var _0x3f3416=_0x89f0[_0x3f6393];return _0x3f3416;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x089f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x089f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x089f('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x089f('0x3'));var fs=require('fs');var fs_extra=require(_0x089f('0x4'));var _=require('lodash');var squel=require(_0x089f('0x5'));var crypto=require(_0x089f('0x6'));var jsforce=require(_0x089f('0x7'));var deskjs=require(_0x089f('0x8'));var toCsv=require(_0x089f('0x9'));var querystring=require(_0x089f('0xa'));var Papa=require(_0x089f('0xb'));var Redis=require(_0x089f('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x089f('0xd'));var as=require(_0x089f('0xe'));var hardwareService=require(_0x089f('0xf'));var logger=require(_0x089f('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x089f('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x089f('0x12'))['db'];function respondWithStatusCode(_0x4eb10e,_0x4cc53c){_0x4cc53c=_0x4cc53c||0xcc;return function(_0x358a69){if(_0x358a69){return _0x4eb10e[_0x089f('0x13')](_0x4cc53c);}return _0x4eb10e['status'](_0x4cc53c)['end']();};}function respondWithResult(_0xe0c9e0,_0x2c9af7){_0x2c9af7=_0x2c9af7||0xc8;return function(_0xb21958){if(_0xb21958){return _0xe0c9e0[_0x089f('0x14')](_0x2c9af7)[_0x089f('0x15')](_0xb21958);}};}function respondWithFilteredResult(_0x59b0fc,_0x2b2113){return function(_0xf7028f){if(_0xf7028f){var _0x3a3732=typeof _0x2b2113[_0x089f('0x16')]===_0x089f('0x17')&&typeof _0x2b2113[_0x089f('0x18')]===_0x089f('0x17');var _0x1deb25=_0xf7028f[_0x089f('0x19')];var _0x36531c=_0x3a3732?0x0:_0x2b2113[_0x089f('0x16')];var _0x499993=_0x3a3732?_0xf7028f[_0x089f('0x19')]:_0x2b2113['offset']+_0x2b2113['limit'];var _0x194c3c;if(_0x499993>=_0x1deb25){_0x499993=_0x1deb25;_0x194c3c=0xc8;}else{_0x194c3c=0xce;}_0x59b0fc['status'](_0x194c3c);return _0x59b0fc[_0x089f('0x1a')](_0x089f('0x1b'),_0x36531c+'-'+_0x499993+'/'+_0x1deb25)[_0x089f('0x15')](_0xf7028f);}return null;};}function patchUpdates(_0x1c1d0c){return function(_0x338f2a){try{jsonpatch[_0x089f('0x1c')](_0x338f2a,_0x1c1d0c,!![]);}catch(_0x2cecfe){return BPromise[_0x089f('0x1d')](_0x2cecfe);}return _0x338f2a[_0x089f('0x1e')]();};}function saveUpdates(_0x319d21,_0x30d362){return function(_0x818c26){if(_0x818c26){return _0x818c26[_0x089f('0x1f')](_0x319d21)[_0x089f('0x20')](function(_0x4fbf45){return _0x4fbf45;});}return null;};}function removeEntity(_0x3b2b2f,_0x1edb18){return function(_0x18f354){if(_0x18f354){return _0x18f354['destroy']()[_0x089f('0x20')](function(){_0x3b2b2f[_0x089f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x763905,_0x3e4004){return function(_0x14d6e6){if(!_0x14d6e6){_0x763905[_0x089f('0x13')](0x194);}return _0x14d6e6;};}function handleError(_0xdbd8d1,_0x49edb4){_0x49edb4=_0x49edb4||0x1f4;return function(_0x5d9e06){logger['error'](_0x5d9e06[_0x089f('0x21')]);if(_0x5d9e06[_0x089f('0x22')]){delete _0x5d9e06[_0x089f('0x22')];}_0xdbd8d1['status'](_0x49edb4)[_0x089f('0x23')](_0x5d9e06);};}exports[_0x089f('0x24')]=function(_0x5e4205,_0x14c810){var _0x2b8104={},_0x1efdca={},_0x3e8cbc={'count':0x0,'rows':[]};var _0x13b6c4=_['map'](db['VoiceTransferReport'][_0x089f('0x25')],function(_0x37d5af){return{'name':_0x37d5af['fieldName'],'type':_0x37d5af[_0x089f('0x26')][_0x089f('0x27')]};});_0x1efdca['model']=_['map'](_0x13b6c4,_0x089f('0x22'));_0x1efdca['query']=_[_0x089f('0x28')](_0x5e4205['query']);_0x1efdca[_0x089f('0x29')]=_[_0x089f('0x2a')](_0x1efdca[_0x089f('0x2b')],_0x1efdca[_0x089f('0x2c')]);_0x2b8104['attributes']=_['intersection'](_0x1efdca[_0x089f('0x2b')],qs[_0x089f('0x2d')](_0x5e4205[_0x089f('0x2c')]['fields']));_0x2b8104[_0x089f('0x2e')]=_0x2b8104['attributes'][_0x089f('0x2f')]?_0x2b8104[_0x089f('0x2e')]:_0x1efdca['model'];if(!_0x5e4205[_0x089f('0x2c')][_0x089f('0x30')](_0x089f('0x31'))){_0x2b8104[_0x089f('0x18')]=qs[_0x089f('0x18')](_0x5e4205[_0x089f('0x2c')][_0x089f('0x18')]);_0x2b8104[_0x089f('0x16')]=qs[_0x089f('0x16')](_0x5e4205['query']['offset']);}_0x2b8104[_0x089f('0x32')]=qs['sort'](_0x5e4205[_0x089f('0x2c')][_0x089f('0x33')]);_0x2b8104[_0x089f('0x34')]=qs[_0x089f('0x29')](_[_0x089f('0x35')](_0x5e4205[_0x089f('0x2c')],_0x1efdca[_0x089f('0x29')]),_0x13b6c4);if(_0x5e4205[_0x089f('0x2c')][_0x089f('0x36')]){_0x2b8104[_0x089f('0x34')]=_[_0x089f('0x37')](_0x2b8104[_0x089f('0x34')],{'$or':_['map'](_0x13b6c4,function(_0x371e08){if(_0x371e08['type']!==_0x089f('0x38')){var _0x6a85d6={};_0x6a85d6[_0x371e08['name']]={'$like':'%'+_0x5e4205[_0x089f('0x2c')]['filter']+'%'};return _0x6a85d6;}})});}_0x2b8104=_[_0x089f('0x37')]({},_0x2b8104,_0x5e4205[_0x089f('0x39')]);var _0x3101fd={'where':_0x2b8104[_0x089f('0x34')]};return db[_0x089f('0x3a')][_0x089f('0x19')](_0x3101fd)[_0x089f('0x20')](function(_0x557462){_0x3e8cbc['count']=_0x557462;if(_0x5e4205[_0x089f('0x2c')]['includeAll']){_0x2b8104['include']=[{'all':!![]}];}return db[_0x089f('0x3a')][_0x089f('0x3b')](_0x2b8104);})['then'](function(_0x374457){_0x3e8cbc['rows']=_0x374457;return _0x3e8cbc;})['then'](respondWithFilteredResult(_0x14c810,_0x2b8104))[_0x089f('0x3c')](handleError(_0x14c810,null));};exports['show']=function(_0x4f6be7,_0x454777){var _0x485cc5={'raw':!![],'where':{'id':_0x4f6be7[_0x089f('0x3d')]['id']}},_0x2a8044={};_0x2a8044[_0x089f('0x2b')]=_[_0x089f('0x28')](db[_0x089f('0x3a')][_0x089f('0x25')]);_0x2a8044[_0x089f('0x2c')]=_[_0x089f('0x28')](_0x4f6be7['query']);_0x2a8044[_0x089f('0x29')]=_['intersection'](_0x2a8044[_0x089f('0x2b')],_0x2a8044['query']);_0x485cc5[_0x089f('0x2e')]=_[_0x089f('0x2a')](_0x2a8044[_0x089f('0x2b')],qs[_0x089f('0x2d')](_0x4f6be7[_0x089f('0x2c')][_0x089f('0x2d')]));_0x485cc5['attributes']=_0x485cc5['attributes'][_0x089f('0x2f')]?_0x485cc5[_0x089f('0x2e')]:_0x2a8044[_0x089f('0x2b')];if(_0x4f6be7[_0x089f('0x2c')]['includeAll']){_0x485cc5[_0x089f('0x3e')]=[{'all':!![]}];}_0x485cc5=_[_0x089f('0x37')]({},_0x485cc5,_0x4f6be7[_0x089f('0x39')]);return db['VoiceTransferReport']['find'](_0x485cc5)['then'](handleEntityNotFound(_0x454777,null))[_0x089f('0x20')](respondWithResult(_0x454777,null))[_0x089f('0x3c')](handleError(_0x454777,null));};exports['create']=function(_0x53c5af,_0xa8d163){return db[_0x089f('0x3a')][_0x089f('0x3f')](_0x53c5af[_0x089f('0x40')],{})[_0x089f('0x20')](respondWithResult(_0xa8d163,0xc9))[_0x089f('0x3c')](handleError(_0xa8d163,null));};exports[_0x089f('0x1f')]=function(_0x3fcf27,_0x554d74){if(_0x3fcf27['body']['id']){delete _0x3fcf27[_0x089f('0x40')]['id'];}return db[_0x089f('0x3a')][_0x089f('0x41')]({'where':{'id':_0x3fcf27['params']['id']}})[_0x089f('0x20')](handleEntityNotFound(_0x554d74,null))[_0x089f('0x20')](saveUpdates(_0x3fcf27['body'],null))[_0x089f('0x20')](respondWithResult(_0x554d74,null))['catch'](handleError(_0x554d74,null));};exports[_0x089f('0x42')]=function(_0x5bbc44,_0x3137d7){return db[_0x089f('0x3a')][_0x089f('0x41')]({'where':{'id':_0x5bbc44['params']['id']}})[_0x089f('0x20')](handleEntityNotFound(_0x3137d7,null))['then'](removeEntity(_0x3137d7,null))[_0x089f('0x3c')](handleError(_0x3137d7,null));};exports[_0x089f('0x43')]=function(_0x494b81,_0x14a62f){return db[_0x089f('0x3a')][_0x089f('0x43')]()[_0x089f('0x20')](respondWithResult(_0x14a62f,null))['catch'](handleError(_0x14a62f,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 217afee..92e069d 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 _0xc982=['report_call_transfer','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x22a901,_0x2e8f91){var _0x2dc87e=function(_0x541545){while(--_0x541545){_0x22a901['push'](_0x22a901['shift']());}};_0x2dc87e(++_0x2e8f91);}(_0xc982,0xd2));var _0x2c98=function(_0x10d8c7,_0xa80d12){_0x10d8c7=_0x10d8c7-0x0;var _0x4105b9=_0xc982[_0x10d8c7];return _0x4105b9;};'use strict';var _=require('lodash');var util=require(_0x2c98('0x0'));var logger=require(_0x2c98('0x1'))(_0x2c98('0x2'));var moment=require(_0x2c98('0x3'));var BPromise=require(_0x2c98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c98('0x5'));var rimraf=require('rimraf');var config=require(_0x2c98('0x6'));var attributes=require(_0x2c98('0x7'));module[_0x2c98('0x8')]=function(_0x44d52c,_0x37e7df){return _0x44d52c[_0x2c98('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x2c98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe60=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x16a681,_0x35e78e){var _0x333df3=function(_0x20fe02){while(--_0x20fe02){_0x16a681['push'](_0x16a681['shift']());}};_0x333df3(++_0x35e78e);}(_0xbe60,0x19e));var _0x0be6=function(_0x174404,_0x511294){_0x174404=_0x174404-0x0;var _0x374750=_0xbe60[_0x174404];return _0x374750;};'use strict';var _=require(_0x0be6('0x0'));var util=require(_0x0be6('0x1'));var logger=require(_0x0be6('0x2'))(_0x0be6('0x3'));var moment=require(_0x0be6('0x4'));var BPromise=require(_0x0be6('0x5'));var rp=require(_0x0be6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0be6('0x7'));var config=require('../../config/environment');var attributes=require(_0x0be6('0x8'));module[_0x0be6('0x9')]=function(_0x4e336e,_0x35453a){return _0x4e336e[_0x0be6('0xa')](_0x0be6('0xb'),attributes,{'tableName':_0x0be6('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 620b4f0..78677fc 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 _0xd623=['result','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x47623f,_0x148f3a){var _0x282ce8=function(_0x35bca1){while(--_0x35bca1){_0x47623f['push'](_0x47623f['shift']());}};_0x282ce8(++_0x148f3a);}(_0xd623,0xb7));var _0x3d62=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd623[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3d62('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3d62('0x1'));var fs=require('fs');var Redis=require(_0x3d62('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d62('0x3'));var logger=require(_0x3d62('0x4'))(_0x3d62('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d62('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23fca4,_0x5a8166,_0xe1162f){return new BPromise(function(_0x4bb325,_0x147284){return client[_0x3d62('0x7')](_0x23fca4,_0xe1162f)[_0x3d62('0x8')](function(_0x541d7d){logger['info'](_0x3d62('0x9'),_0x5a8166,_0x3d62('0xa'));logger[_0x3d62('0xb')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5a8166,_0x3d62('0xa'),JSON[_0x3d62('0xc')](_0x541d7d));if(_0x541d7d[_0x3d62('0xd')]){if(_0x541d7d[_0x3d62('0xd')][_0x3d62('0xe')]===0x1f4){logger['error'](_0x3d62('0x9'),_0x5a8166,_0x541d7d[_0x3d62('0xd')][_0x3d62('0xf')]);return _0x147284(_0x541d7d[_0x3d62('0xd')][_0x3d62('0xf')]);}logger[_0x3d62('0xd')](_0x3d62('0x9'),_0x5a8166,_0x541d7d['error'][_0x3d62('0xf')]);return _0x4bb325(_0x541d7d['error'][_0x3d62('0xf')]);}else{logger[_0x3d62('0x10')](_0x3d62('0x9'),_0x5a8166,'request\x20sent');_0x4bb325(_0x541d7d[_0x3d62('0x11')][_0x3d62('0xf')]);}})['catch'](function(_0x584b20){logger[_0x3d62('0xd')](_0x3d62('0x9'),_0x5a8166,_0x584b20);_0x147284(_0x584b20);});});}exports['CreateVoiceTransferReport']=function(_0x4f331e){var _0x682ffc=this;return new Promise(function(_0x3c5ce0,_0x74598a){return db[_0x3d62('0x12')][_0x3d62('0x13')](_0x4f331e[_0x3d62('0x14')],{'raw':_0x4f331e[_0x3d62('0x15')]?_0x4f331e[_0x3d62('0x15')][_0x3d62('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1f96e9){logger[_0x3d62('0x10')]('CreateVoiceTransferReport',_0x4f331e);logger[_0x3d62('0xb')](_0x3d62('0x17'),_0x4f331e,JSON[_0x3d62('0xc')](_0x1f96e9));_0x3c5ce0(_0x1f96e9);})[_0x3d62('0x18')](function(_0x3f8e1d){logger[_0x3d62('0xd')](_0x3d62('0x17'),_0x3f8e1d[_0x3d62('0xf')],_0x4f331e);_0x74598a(_0x682ffc[_0x3d62('0xd')](0x1f4,_0x3f8e1d[_0x3d62('0xf')]));});});}; \ No newline at end of file +var _0x404d=['message','info','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x471ac2,_0x3f459e){var _0x46eb4c=function(_0x3465c1){while(--_0x3465c1){_0x471ac2['push'](_0x471ac2['shift']());}};_0x46eb4c(++_0x3f459e);}(_0x404d,0x11d));var _0xd404=function(_0x5998bd,_0x2b537e){_0x5998bd=_0x5998bd-0x0;var _0x5e8e8e=_0x404d[_0x5998bd];return _0x5e8e8e;};'use strict';var _=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd404('0x2'));var fs=require('fs');var Redis=require(_0xd404('0x3'));var db=require(_0xd404('0x4'))['db'];var utils=require(_0xd404('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd404('0x6'));var jayson=require(_0xd404('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49436a,_0x4f3238,_0x1e278e){return new BPromise(function(_0x407c0c,_0x15ddd2){return client[_0xd404('0x8')](_0x49436a,_0x1e278e)['then'](function(_0x3edb9c){logger['info'](_0xd404('0x9'),_0x4f3238,_0xd404('0xa'));logger[_0xd404('0xb')](_0xd404('0xc'),_0x4f3238,_0xd404('0xa'),JSON[_0xd404('0xd')](_0x3edb9c));if(_0x3edb9c[_0xd404('0xe')]){if(_0x3edb9c[_0xd404('0xe')]['code']===0x1f4){logger[_0xd404('0xe')](_0xd404('0x9'),_0x4f3238,_0x3edb9c['error'][_0xd404('0xf')]);return _0x15ddd2(_0x3edb9c[_0xd404('0xe')][_0xd404('0xf')]);}logger[_0xd404('0xe')](_0xd404('0x9'),_0x4f3238,_0x3edb9c[_0xd404('0xe')]['message']);return _0x407c0c(_0x3edb9c['error'][_0xd404('0xf')]);}else{logger[_0xd404('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f3238,'request\x20sent');_0x407c0c(_0x3edb9c[_0xd404('0x11')]['message']);}})['catch'](function(_0x4d00a4){logger[_0xd404('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f3238,_0x4d00a4);_0x15ddd2(_0x4d00a4);});});}exports[_0xd404('0x12')]=function(_0x217534){var _0x2db002=this;return new Promise(function(_0x52ad88,_0x5433e3){return db[_0xd404('0x13')][_0xd404('0x14')](_0x217534['body'],{'raw':_0x217534[_0xd404('0x15')]?_0x217534[_0xd404('0x15')][_0xd404('0x16')]===undefined?!![]:![]:!![]})[_0xd404('0x17')](function(_0x133a52){logger['info'](_0xd404('0x12'),_0x217534);logger[_0xd404('0xb')]('CreateVoiceTransferReport',_0x217534,JSON[_0xd404('0xd')](_0x133a52));_0x52ad88(_0x133a52);})[_0xd404('0x18')](function(_0x42940d){logger[_0xd404('0xe')](_0xd404('0x12'),_0x42940d[_0xd404('0xf')],_0x217534);_0x5433e3(_0x2db002[_0xd404('0xe')](0x1f4,_0x42940d['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index e0a7ad2..478f1d6 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 _0x9456=['exports','express','Router','./webbar.controller','post','/originate','canUpdate','originate','/hangup','isAuthenticated','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0x49831e,_0x4adae8){var _0x3640ea=function(_0x3d9297){while(--_0x3d9297){_0x49831e['push'](_0x49831e['shift']());}};_0x3640ea(++_0x4adae8);}(_0x9456,0x79));var _0x6945=function(_0x589b51,_0x55b2ac){_0x589b51=_0x589b51-0x0;var _0x3dbc4a=_0x9456[_0x589b51];return _0x3dbc4a;};'use strict';var express=require(_0x6945('0x0'));var router=express[_0x6945('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6945('0x2'));router[_0x6945('0x3')](_0x6945('0x4'),auth['isAuthenticated'](),auth[_0x6945('0x5')](),controller[_0x6945('0x6')]);router[_0x6945('0x3')](_0x6945('0x7'),auth[_0x6945('0x8')](),auth['canUpdate'](),controller[_0x6945('0x9')]);router[_0x6945('0x3')](_0x6945('0xa'),auth['isAuthenticated'](),auth[_0x6945('0x5')](),controller[_0x6945('0xb')]);router[_0x6945('0x3')](_0x6945('0xc'),auth[_0x6945('0x8')](),auth[_0x6945('0x5')](),controller[_0x6945('0xd')]);router[_0x6945('0x3')](_0x6945('0xe'),auth[_0x6945('0x8')](),auth[_0x6945('0x5')](),controller[_0x6945('0xf')]);router[_0x6945('0x3')](_0x6945('0x10'),auth[_0x6945('0x8')](),auth[_0x6945('0x5')](),controller[_0x6945('0x11')]);router[_0x6945('0x3')](_0x6945('0x12'),auth[_0x6945('0x8')](),auth[_0x6945('0x5')](),controller['transfer']);module[_0x6945('0x13')]=router; \ No newline at end of file +var _0x2a85=['hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','/hangup','hangup','/answer','answer'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x2a85,0x138));var _0x52a8=function(_0x173e4e,_0x24de6){_0x173e4e=_0x173e4e-0x0;var _0x52597c=_0x2a85[_0x173e4e];return _0x52597c;};'use strict';var express=require(_0x52a8('0x0'));var router=express[_0x52a8('0x1')]();var auth=require(_0x52a8('0x2'));var controller=require(_0x52a8('0x3'));router[_0x52a8('0x4')]('/originate',auth[_0x52a8('0x5')](),auth[_0x52a8('0x6')](),controller['originate']);router[_0x52a8('0x4')](_0x52a8('0x7'),auth[_0x52a8('0x5')](),auth[_0x52a8('0x6')](),controller[_0x52a8('0x8')]);router[_0x52a8('0x4')](_0x52a8('0x9'),auth[_0x52a8('0x5')](),auth[_0x52a8('0x6')](),controller[_0x52a8('0xa')]);router[_0x52a8('0x4')]('/hold',auth[_0x52a8('0x5')](),auth[_0x52a8('0x6')](),controller[_0x52a8('0xb')]);router[_0x52a8('0x4')](_0x52a8('0xc'),auth[_0x52a8('0x5')](),auth[_0x52a8('0x6')](),controller[_0x52a8('0xd')]);router[_0x52a8('0x4')](_0x52a8('0xe'),auth[_0x52a8('0x5')](),auth['canUpdate'](),controller[_0x52a8('0xf')]);router[_0x52a8('0x4')](_0x52a8('0x10'),auth[_0x52a8('0x5')](),auth[_0x52a8('0x6')](),controller[_0x52a8('0x11')]);module[_0x52a8('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 74fb0db..e5293c4 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 _0xfc03=['send','NotFound','request','then','code','message','result','catch','User','agent','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','info','format','json','originate\x20executed!','hangup','hangup\x20fired:','user:%s','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','stringify','handleError:','error','stack','name','status'];(function(_0x587fd0,_0x41f496){var _0x59c4ae=function(_0x4acc35){while(--_0x4acc35){_0x587fd0['push'](_0x587fd0['shift']());}};_0x59c4ae(++_0x41f496);}(_0xfc03,0x16f));var _0x3fc0=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xfc03[_0x2f45ea];return _0x485a84;};'use strict';var path=require(_0x3fc0('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x3fc0('0x1'))['db'];var config=require(_0x3fc0('0x2'));var util=require('util');var BPromise=require(_0x3fc0('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x3fc0('0x4')][_0x3fc0('0x5')]({'port':0x232a});var logger=require(_0x3fc0('0x6'))(_0x3fc0('0x7'));var Redis=require(_0x3fc0('0x8'));config[_0x3fc0('0x9')]=_[_0x3fc0('0xa')](config[_0x3fc0('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x3fc0('0xb'))(new Redis(config['redis']));var Schema=require(_0x3fc0('0xc'));var originateValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],_0x3fc0('0xe')]},'callNumber':{'type':_0x3fc0('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x3fc0('0xf')},'callbackUrl':{'type':_0x3fc0('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],_0x3fc0('0xe')]},'sessionId':{'type':_0x3fc0('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3fc0('0xe')]},'sessionId':{'type':_0x3fc0('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3fc0('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x3fc0('0xf'),'required':[!![],_0x3fc0('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3fc0('0xe')]},'sessionId':{'type':_0x3fc0('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3fc0('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],_0x3fc0('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3fc0('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x277dbf,_0x3d869e,_0x3ef95e){logger['info'](_0x277dbf,_0x3d869e,JSON[_0x3fc0('0x11')](_0x3ef95e));io['to'](_0x277dbf)['emit'](_0x3d869e,_0x3ef95e);}function handleError(_0x121931){return function(_0x3c5026){console['log'](_0x3fc0('0x12'),_0x3c5026,_0x3c5026 instanceof RangeError);logger[_0x3fc0('0x13')](_0x3c5026[_0x3fc0('0x14')]);if(_0x3c5026 instanceof RangeError){if(_0x3c5026[_0x3fc0('0x15')]){delete _0x3c5026[_0x3fc0('0x15')];}_0x121931[_0x3fc0('0x16')](0x194)[_0x3fc0('0x17')](_0x3c5026);}else{if(_0x3c5026[_0x3fc0('0x15')]){delete _0x3c5026[_0x3fc0('0x15')];}_0x121931['status'](0x1f4)[_0x3fc0('0x17')](_0x3c5026);}};}function checkError(){return function(_0x9ab2c5){if(!_0x9ab2c5){throw new RangeError(_0x3fc0('0x18'));}return _0x9ab2c5;};}function respondWithRpcPromise(_0x3d6c0a,_0x3a09cd){return new BPromise(function(_0x448293,_0x47c770){var _0x477674=amiClient;return _0x477674[_0x3fc0('0x19')](_0x3d6c0a,_0x3a09cd)[_0x3fc0('0x1a')](function(_0x28fc65){if(_0x28fc65[_0x3fc0('0x13')]){if(_0x28fc65[_0x3fc0('0x13')][_0x3fc0('0x1b')]===0x1f4){return _0x47c770(_0x28fc65[_0x3fc0('0x13')][_0x3fc0('0x1c')]);}return _0x448293(_0x28fc65[_0x3fc0('0x13')][_0x3fc0('0x1c')]);}else{_0x448293(_0x28fc65[_0x3fc0('0x1d')]);}})[_0x3fc0('0x1e')](function(_0xba1a23){_0x47c770(_0xba1a23);});});}function getAgent(_0x55f507){return db[_0x3fc0('0x1f')]['findOne']({'where':{'id':_0x55f507,'role':_0x3fc0('0x20')}})[_0x3fc0('0x1a')](checkError());}function getAgentCheckSession(_0x1d9932,_0x35c34c){return new BPromise(function(_0x5a9179,_0x134317){var _0x197dfa=respondWithRpcPromise(_0x3fc0('0x21'));var _0x2645b4=getAgent(_0x1d9932);Promise['all']([_0x197dfa,_0x2645b4])[_0x3fc0('0x1a')](function(_0x1a2261){var _0x1960a4=_0x1a2261[0x0];var _0xac736c=_0x1a2261[0x1];var _0x29aa32=_[_0x3fc0('0x22')](_0x1960a4['rows'],function(_0xd9ecae){return _0xd9ecae[_0x3fc0('0x23')]==_0xac736c['id']&&_0xd9ecae[_0x3fc0('0x24')]==_0x35c34c;});if(_0x29aa32[_0x3fc0('0x25')]==0x1){_0x5a9179(_0xac736c);}else{_0x134317(new RangeError(_0x3fc0('0x26')+_0x35c34c+_0x3fc0('0x27')));}});});}exports[_0x3fc0('0x28')]=function(_0x164a96,_0x4d6551){logger['info'](_0x3fc0('0x29'),_0x164a96['body']);var _0x58d698=originateValidation[_0x3fc0('0xc')](_0x164a96[_0x3fc0('0x2a')]);if(_0x58d698[_0x3fc0('0x25')]>0x0){return _0x4d6551[_0x3fc0('0x16')](0x190)['json'](_0x58d698);}var _0x4dc8cd=_0x164a96[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x151492=_0x164a96[_0x3fc0('0x2a')][_0x3fc0('0x2c')];var _0x5f0ca1=_0x164a96[_0x3fc0('0x2a')][_0x3fc0('0x2d')];var _0x399c9c=_0x164a96['body'][_0x3fc0('0x2e')];return getAgent(_0x4dc8cd)[_0x3fc0('0x1a')](function(_0x325a2f){logger[_0x3fc0('0x2f')]('entityFound:',_0x325a2f[_0x3fc0('0x15')]);emit(util[_0x3fc0('0x30')]('user:%s',_0x325a2f[_0x3fc0('0x15')]),'webbar:originate',{'callNumber':_0x151492,'callerId':_0x5f0ca1,'callbackUrl':_0x399c9c});return _0x4d6551[_0x3fc0('0x16')](0xc8)[_0x3fc0('0x31')]({'error':![],'message':_0x3fc0('0x32')});})[_0x3fc0('0x1e')](handleError(_0x4d6551));};exports[_0x3fc0('0x33')]=function(_0x104332,_0x469d4b){logger[_0x3fc0('0x2f')](_0x3fc0('0x34'),_0x104332[_0x3fc0('0x2a')]);var _0x41b4b3=hangupValidation['validate'](_0x104332[_0x3fc0('0x2a')]);if(_0x41b4b3[_0x3fc0('0x25')]>0x0){return _0x469d4b[_0x3fc0('0x16')](0x190)[_0x3fc0('0x31')](_0x41b4b3);}var _0x21de4c=_0x104332[_0x3fc0('0x2a')]['userId'];var _0x5ae22c=_0x104332[_0x3fc0('0x2a')][_0x3fc0('0x24')];return getAgent(_0x21de4c)[_0x3fc0('0x1a')](function(_0x3e285f){logger[_0x3fc0('0x2f')]('entityFound:',_0x3e285f['name']);emit(util['format'](_0x3fc0('0x35'),_0x3e285f[_0x3fc0('0x15')]),_0x3fc0('0x36'),{'sessionId':_0x5ae22c});return _0x469d4b['status'](0xc8)['json']({'error':![],'message':_0x3fc0('0x37')});})[_0x3fc0('0x1e')](handleError(_0x469d4b));};exports[_0x3fc0('0x38')]=function(_0x10b845,_0x494c66){logger['info'](_0x3fc0('0x39'),_0x10b845[_0x3fc0('0x2a')]);var _0x547670=answerValidation[_0x3fc0('0xc')](_0x10b845['body']);if(_0x547670[_0x3fc0('0x25')]>0x0){return _0x494c66[_0x3fc0('0x16')](0x190)[_0x3fc0('0x31')](_0x547670);}var _0x90120f=_0x10b845[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x80dfee=_0x10b845[_0x3fc0('0x2a')]['sessionId'];return getAgent(_0x90120f)[_0x3fc0('0x1a')](function(_0x5bd6a8){logger[_0x3fc0('0x2f')](_0x3fc0('0x3a'),_0x5bd6a8[_0x3fc0('0x15')]);emit(util[_0x3fc0('0x30')](_0x3fc0('0x35'),_0x5bd6a8['name']),_0x3fc0('0x3b'),{'sessionId':_0x80dfee});return _0x494c66[_0x3fc0('0x16')](0xc8)[_0x3fc0('0x31')]({'error':![],'message':_0x3fc0('0x3c')});})['catch'](handleError(_0x494c66));};exports[_0x3fc0('0x3d')]=function(_0x5a1672,_0x21c065){logger[_0x3fc0('0x2f')](_0x3fc0('0x3e'),_0x5a1672[_0x3fc0('0x2a')]);var _0x277480=holdValidation['validate'](_0x5a1672[_0x3fc0('0x2a')]);if(_0x277480[_0x3fc0('0x25')]>0x0){return _0x21c065[_0x3fc0('0x16')](0x190)['json'](_0x277480);}var _0x3df404=_0x5a1672[_0x3fc0('0x2a')]['userId'];var _0x1f5e6a=_0x5a1672[_0x3fc0('0x2a')][_0x3fc0('0x24')];return getAgent(_0x3df404)['then'](function(_0x5e5c73){logger[_0x3fc0('0x2f')](_0x3fc0('0x3a'),_0x5e5c73[_0x3fc0('0x15')]);emit(util['format'](_0x3fc0('0x35'),_0x5e5c73['name']),_0x3fc0('0x3f'),{'sessionId':_0x1f5e6a});return _0x21c065['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x3fc0('0x1e')](handleError(_0x21c065));};exports[_0x3fc0('0x40')]=function(_0x141b4c,_0x3730f5){logger[_0x3fc0('0x2f')](_0x3fc0('0x41'),_0x141b4c['body']);var _0x2cf279=unholdValidation[_0x3fc0('0xc')](_0x141b4c['body']);if(_0x2cf279['length']>0x0){return _0x3730f5[_0x3fc0('0x16')](0x190)[_0x3fc0('0x31')](_0x2cf279);}var _0x1f070b=_0x141b4c[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x330b8f=_0x141b4c[_0x3fc0('0x2a')][_0x3fc0('0x24')];return getAgent(_0x1f070b)[_0x3fc0('0x1a')](function(_0x1cc9f2){logger[_0x3fc0('0x2f')](_0x3fc0('0x3a'),_0x1cc9f2['name']);emit(util[_0x3fc0('0x30')](_0x3fc0('0x35'),_0x1cc9f2[_0x3fc0('0x15')]),_0x3fc0('0x42'),{'sessionId':_0x330b8f});return _0x3730f5[_0x3fc0('0x16')](0xc8)['json']({'error':![],'message':_0x3fc0('0x43')});})['catch'](handleError(_0x3730f5));};exports[_0x3fc0('0x44')]=function(_0xa4864f,_0x397434){logger[_0x3fc0('0x2f')]('calls\x20fired:',_0x397434[_0x3fc0('0x2a')]);var _0xd903e3=callsValidation[_0x3fc0('0xc')](_0xa4864f[_0x3fc0('0x2a')]);if(_0xd903e3[_0x3fc0('0x25')]>0x0){return _0x397434[_0x3fc0('0x16')](0x190)['json'](_0xd903e3);}var _0x2c5ca1=_0xa4864f[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x21c46f=respondWithRpcPromise(_0x3fc0('0x21'));var _0x737d45=getAgent(_0x2c5ca1);return Promise['all']([_0x21c46f,_0x737d45])[_0x3fc0('0x1a')](function(_0x258a27){var _0x3e04a1=_0x258a27[0x0];var _0x5a3732=_0x258a27[0x1];var _0x2cc735=_[_0x3fc0('0x22')](_0x3e04a1[_0x3fc0('0x45')],function(_0x2b709c){return _0x2b709c[_0x3fc0('0x23')]==_0x5a3732['id'];});return _0x397434[_0x3fc0('0x16')](0xc8)[_0x3fc0('0x31')]({'count':_0x2cc735[_0x3fc0('0x25')],'rows':_0x2cc735});})[_0x3fc0('0x1e')](handleError(_0x397434));};exports[_0x3fc0('0x46')]=function(_0x4a5b96,_0x194a3b){logger[_0x3fc0('0x2f')](_0x3fc0('0x47'),_0x4a5b96[_0x3fc0('0x2a')]);var _0x4cb346=conferenceValidation[_0x3fc0('0xc')](_0x4a5b96[_0x3fc0('0x2a')]);if(_0x4cb346[_0x3fc0('0x25')]>0x0){return _0x194a3b[_0x3fc0('0x16')](0x190)[_0x3fc0('0x31')](_0x4cb346);}var _0x27a828=_0x4a5b96[_0x3fc0('0x2a')][_0x3fc0('0x2b')];return getAgent(_0x27a828)[_0x3fc0('0x1a')](function(_0x2b9226){logger['info'](_0x3fc0('0x3a'),_0x2b9226[_0x3fc0('0x15')]);emit(util[_0x3fc0('0x30')](_0x3fc0('0x35'),_0x2b9226[_0x3fc0('0x15')]),_0x3fc0('0x48'));return _0x194a3b['status'](0xc8)[_0x3fc0('0x31')]({'error':![],'message':_0x3fc0('0x49')});})[_0x3fc0('0x1e')](handleError(_0x194a3b));};exports['transfer']=function(_0x40f6d8,_0x431087){logger[_0x3fc0('0x2f')](_0x3fc0('0x4a'),_0x40f6d8[_0x3fc0('0x2a')]);var _0x12758a=transferValidation[_0x3fc0('0xc')](_0x40f6d8[_0x3fc0('0x2a')]);if(_0x12758a[_0x3fc0('0x25')]>0x0){return _0x431087['status'](0x190)[_0x3fc0('0x31')](_0x12758a);}var _0x16cd67=_0x40f6d8[_0x3fc0('0x2a')][_0x3fc0('0x2b')];var _0x3b9b6f=_0x40f6d8['body'][_0x3fc0('0x24')];var _0x42c1ee=_0x40f6d8[_0x3fc0('0x2a')][_0x3fc0('0x4b')];return getAgent(_0x16cd67)[_0x3fc0('0x1a')](function(_0x20e372){logger[_0x3fc0('0x2f')](_0x3fc0('0x3a'),_0x20e372[_0x3fc0('0x15')]);emit(util[_0x3fc0('0x30')](_0x3fc0('0x35'),_0x20e372['name']),_0x3fc0('0x4c'),{'sessionId':_0x3b9b6f,'transferNumber':_0x42c1ee});return _0x431087['status'](0xc8)[_0x3fc0('0x31')]({'error':![],'message':_0x3fc0('0x4d')});})[_0x3fc0('0x1e')](handleError(_0x431087));}; \ No newline at end of file +var _0x5636=['then','error','message','result','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','json','originate\x20executed!','catch','hangup','info','format','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','unhold\x20executed!','calls','calls\x20fired:','filter','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','stack','name','status','send','NotFound','request'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x5636,0x102));var _0x6563=function(_0x54b28a,_0x37101f){_0x54b28a=_0x54b28a-0x0;var _0x342098=_0x5636[_0x54b28a];return _0x342098;};'use strict';var path=require(_0x6563('0x0'));var fs=require('fs');var _=require(_0x6563('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x6563('0x2'));var jayson=require(_0x6563('0x3'));var amiClient=jayson[_0x6563('0x4')]['http']({'port':0x232a});var logger=require(_0x6563('0x5'))(_0x6563('0x6'));var Redis=require(_0x6563('0x7'));config[_0x6563('0x8')]=_[_0x6563('0x9')](config[_0x6563('0x8')],{'host':_0x6563('0xa'),'port':0x18eb});var io=require(_0x6563('0xb'))(new Redis(config[_0x6563('0x8')]));var Schema=require(_0x6563('0xc'));var originateValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]},'callNumber':{'type':_0x6563('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x6563('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':[!![],_0x6563('0x10')]},'transferNumber':{'type':_0x6563('0xf'),'required':[!![],_0x6563('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]}});function emit(_0x11baa2,_0x477d9b,_0xd398ce){logger['info'](_0x11baa2,_0x477d9b,JSON[_0x6563('0x12')](_0xd398ce));io['to'](_0x11baa2)['emit'](_0x477d9b,_0xd398ce);}function handleError(_0x502694){return function(_0x47972a){console[_0x6563('0x13')]('handleError:',_0x47972a,_0x47972a instanceof RangeError);logger['error'](_0x47972a[_0x6563('0x14')]);if(_0x47972a instanceof RangeError){if(_0x47972a[_0x6563('0x15')]){delete _0x47972a[_0x6563('0x15')];}_0x502694[_0x6563('0x16')](0x194)[_0x6563('0x17')](_0x47972a);}else{if(_0x47972a[_0x6563('0x15')]){delete _0x47972a[_0x6563('0x15')];}_0x502694[_0x6563('0x16')](0x1f4)[_0x6563('0x17')](_0x47972a);}};}function checkError(){return function(_0x5bf608){if(!_0x5bf608){throw new RangeError(_0x6563('0x18'));}return _0x5bf608;};}function respondWithRpcPromise(_0x9c3da7,_0x20b478){return new BPromise(function(_0x5a335c,_0x293db2){var _0x5c37bb=amiClient;return _0x5c37bb[_0x6563('0x19')](_0x9c3da7,_0x20b478)[_0x6563('0x1a')](function(_0x5610b0){if(_0x5610b0['error']){if(_0x5610b0[_0x6563('0x1b')]['code']===0x1f4){return _0x293db2(_0x5610b0[_0x6563('0x1b')][_0x6563('0x1c')]);}return _0x5a335c(_0x5610b0[_0x6563('0x1b')]['message']);}else{_0x5a335c(_0x5610b0[_0x6563('0x1d')]);}})['catch'](function(_0x7ea857){_0x293db2(_0x7ea857);});});}function getAgent(_0x1590e6){return db['User'][_0x6563('0x1e')]({'where':{'id':_0x1590e6,'role':_0x6563('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x2ddb2b,_0x5b03a7){return new BPromise(function(_0x1fe1cb,_0x4fbb20){var _0x480408=respondWithRpcPromise(_0x6563('0x20'));var _0x118d31=getAgent(_0x2ddb2b);Promise[_0x6563('0x21')]([_0x480408,_0x118d31])[_0x6563('0x1a')](function(_0x3eb23b){var _0x4b4d3b=_0x3eb23b[0x0];var _0x3c8bd1=_0x3eb23b[0x1];var _0x4f275c=_['filter'](_0x4b4d3b[_0x6563('0x22')],function(_0x35af37){return _0x35af37[_0x6563('0x23')]==_0x3c8bd1['id']&&_0x35af37[_0x6563('0x24')]==_0x5b03a7;});if(_0x4f275c[_0x6563('0x25')]==0x1){_0x1fe1cb(_0x3c8bd1);}else{_0x4fbb20(new RangeError(_0x6563('0x26')+_0x5b03a7+_0x6563('0x27')));}});});}exports[_0x6563('0x28')]=function(_0x101b24,_0x246d53){logger['info'](_0x6563('0x29'),_0x101b24[_0x6563('0x2a')]);var _0x29fb9d=originateValidation[_0x6563('0xc')](_0x101b24[_0x6563('0x2a')]);if(_0x29fb9d[_0x6563('0x25')]>0x0){return _0x246d53[_0x6563('0x16')](0x190)['json'](_0x29fb9d);}var _0x8cf1=_0x101b24[_0x6563('0x2a')][_0x6563('0x2b')];var _0x46fb1b=_0x101b24[_0x6563('0x2a')][_0x6563('0x2c')];var _0x574a35=_0x101b24[_0x6563('0x2a')][_0x6563('0x2d')];var _0x26c24b=_0x101b24[_0x6563('0x2a')][_0x6563('0x2e')];return getAgent(_0x8cf1)[_0x6563('0x1a')](function(_0x3f578a){logger['info'](_0x6563('0x2f'),_0x3f578a[_0x6563('0x15')]);emit(util['format'](_0x6563('0x30'),_0x3f578a[_0x6563('0x15')]),'webbar:originate',{'callNumber':_0x46fb1b,'callerId':_0x574a35,'callbackUrl':_0x26c24b});return _0x246d53['status'](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x32')});})[_0x6563('0x33')](handleError(_0x246d53));};exports[_0x6563('0x34')]=function(_0x4962c2,_0x2d36d4){logger[_0x6563('0x35')]('hangup\x20fired:',_0x4962c2[_0x6563('0x2a')]);var _0xe5e80f=hangupValidation[_0x6563('0xc')](_0x4962c2[_0x6563('0x2a')]);if(_0xe5e80f[_0x6563('0x25')]>0x0){return _0x2d36d4[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0xe5e80f);}var _0x15c23e=_0x4962c2[_0x6563('0x2a')]['userId'];var _0x130a88=_0x4962c2[_0x6563('0x2a')][_0x6563('0x24')];return getAgent(_0x15c23e)[_0x6563('0x1a')](function(_0x5ebe88){logger['info'](_0x6563('0x2f'),_0x5ebe88[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x5ebe88[_0x6563('0x15')]),'webbar:hangup',{'sessionId':_0x130a88});return _0x2d36d4[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0x6563('0x33')](handleError(_0x2d36d4));};exports[_0x6563('0x37')]=function(_0xea186,_0xcf92cd){logger[_0x6563('0x35')](_0x6563('0x38'),_0xea186[_0x6563('0x2a')]);var _0x32932f=answerValidation[_0x6563('0xc')](_0xea186[_0x6563('0x2a')]);if(_0x32932f[_0x6563('0x25')]>0x0){return _0xcf92cd['status'](0x190)['json'](_0x32932f);}var _0x38eab4=_0xea186[_0x6563('0x2a')][_0x6563('0x2b')];var _0x2f2aa6=_0xea186[_0x6563('0x2a')][_0x6563('0x24')];return getAgent(_0x38eab4)[_0x6563('0x1a')](function(_0x4b7838){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x4b7838[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x4b7838[_0x6563('0x15')]),_0x6563('0x39'),{'sessionId':_0x2f2aa6});return _0xcf92cd[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x3a')});})['catch'](handleError(_0xcf92cd));};exports['hold']=function(_0x1504ca,_0x42d54c){logger[_0x6563('0x35')]('hold\x20fired:',_0x1504ca[_0x6563('0x2a')]);var _0x120723=holdValidation[_0x6563('0xc')](_0x1504ca[_0x6563('0x2a')]);if(_0x120723['length']>0x0){return _0x42d54c[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x120723);}var _0xd54477=_0x1504ca['body'][_0x6563('0x2b')];var _0x4bcfff=_0x1504ca[_0x6563('0x2a')]['sessionId'];return getAgent(_0xd54477)['then'](function(_0x1ef2da){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x1ef2da[_0x6563('0x15')]);emit(util[_0x6563('0x36')](_0x6563('0x30'),_0x1ef2da[_0x6563('0x15')]),_0x6563('0x3b'),{'sessionId':_0x4bcfff});return _0x42d54c[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':'hold\x20executed!'});})[_0x6563('0x33')](handleError(_0x42d54c));};exports['unhold']=function(_0x22306a,_0xb339e9){logger[_0x6563('0x35')]('unhold\x20fired:',_0x22306a[_0x6563('0x2a')]);var _0x141f0c=unholdValidation['validate'](_0x22306a[_0x6563('0x2a')]);if(_0x141f0c[_0x6563('0x25')]>0x0){return _0xb339e9[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x141f0c);}var _0xbd920a=_0x22306a['body'][_0x6563('0x2b')];var _0x5c4cfa=_0x22306a[_0x6563('0x2a')]['sessionId'];return getAgent(_0xbd920a)[_0x6563('0x1a')](function(_0x5992c8){logger['info']('entityFound:',_0x5992c8['name']);emit(util[_0x6563('0x36')]('user:%s',_0x5992c8[_0x6563('0x15')]),'webbar:unhold',{'sessionId':_0x5c4cfa});return _0xb339e9[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x3c')});})[_0x6563('0x33')](handleError(_0xb339e9));};exports[_0x6563('0x3d')]=function(_0x199a0e,_0x23c94a){logger[_0x6563('0x35')](_0x6563('0x3e'),_0x23c94a['body']);var _0x386ae9=callsValidation[_0x6563('0xc')](_0x199a0e[_0x6563('0x2a')]);if(_0x386ae9[_0x6563('0x25')]>0x0){return _0x23c94a[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x386ae9);}var _0x40c99b=_0x199a0e[_0x6563('0x2a')][_0x6563('0x2b')];var _0x2c7e9d=respondWithRpcPromise(_0x6563('0x20'));var _0x5c456b=getAgent(_0x40c99b);return Promise[_0x6563('0x21')]([_0x2c7e9d,_0x5c456b])[_0x6563('0x1a')](function(_0x23f38d){var _0x2e9c69=_0x23f38d[0x0];var _0x46c26c=_0x23f38d[0x1];var _0x3c06ac=_[_0x6563('0x3f')](_0x2e9c69[_0x6563('0x22')],function(_0x53292e){return _0x53292e[_0x6563('0x23')]==_0x46c26c['id'];});return _0x23c94a['status'](0xc8)[_0x6563('0x31')]({'count':_0x3c06ac[_0x6563('0x25')],'rows':_0x3c06ac});})['catch'](handleError(_0x23c94a));};exports['conference']=function(_0x3374b0,_0x8f5e46){logger[_0x6563('0x35')](_0x6563('0x40'),_0x3374b0['body']);var _0x2a3df0=conferenceValidation['validate'](_0x3374b0[_0x6563('0x2a')]);if(_0x2a3df0[_0x6563('0x25')]>0x0){return _0x8f5e46['status'](0x190)['json'](_0x2a3df0);}var _0x3a3a35=_0x3374b0['body']['userId'];return getAgent(_0x3a3a35)[_0x6563('0x1a')](function(_0x49d6a5){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x49d6a5[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x49d6a5[_0x6563('0x15')]),_0x6563('0x41'));return _0x8f5e46[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x42')});})[_0x6563('0x33')](handleError(_0x8f5e46));};exports[_0x6563('0x43')]=function(_0x7d8546,_0x58728d){logger['info'](_0x6563('0x44'),_0x7d8546[_0x6563('0x2a')]);var _0x5b5783=transferValidation['validate'](_0x7d8546['body']);if(_0x5b5783[_0x6563('0x25')]>0x0){return _0x58728d[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x5b5783);}var _0x149b74=_0x7d8546['body'][_0x6563('0x2b')];var _0x1a5c54=_0x7d8546[_0x6563('0x2a')][_0x6563('0x24')];var _0xb55389=_0x7d8546['body']['transferNumber'];return getAgent(_0x149b74)[_0x6563('0x1a')](function(_0x1d7b5d){logger[_0x6563('0x35')]('entityFound:',_0x1d7b5d[_0x6563('0x15')]);emit(util['format'](_0x6563('0x30'),_0x1d7b5d[_0x6563('0x15')]),_0x6563('0x45'),{'sessionId':_0x1a5c54,'transferNumber':_0xb55389});return _0x58728d[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x46')});})[_0x6563('0x33')](handleError(_0x58728d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index aa372ca..a6e4808 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 _0x1967=['addAnswer','addAgents','/:id/notify','notify','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','create'];(function(_0x4b92c9,_0x535c2d){var _0x21f2c1=function(_0x2317cd){while(--_0x2317cd){_0x4b92c9['push'](_0x4b92c9['shift']());}};_0x21f2c1(++_0x535c2d);}(_0x1967,0x173));var _0x7196=function(_0x401579,_0x2ea94f){_0x401579=_0x401579-0x0;var _0x5c1642=_0x1967[_0x401579];return _0x5c1642;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0xc')](_0x7196('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x7196('0xc')](_0x7196('0x12'),auth[_0x7196('0xa')](),controller[_0x7196('0x13')]);router[_0x7196('0xc')](_0x7196('0x14'),auth[_0x7196('0xa')](),controller[_0x7196('0x15')]);router[_0x7196('0xc')](_0x7196('0x16'),auth[_0x7196('0xa')](),controller['getApplications']);router[_0x7196('0x17')]('/',auth[_0x7196('0xa')](),controller[_0x7196('0x18')]);router[_0x7196('0x17')]('/:id/dispositions',auth[_0x7196('0xa')](),controller['addDisposition']);router[_0x7196('0x17')](_0x7196('0x12'),auth[_0x7196('0xa')](),controller[_0x7196('0x19')]);router[_0x7196('0x17')](_0x7196('0x14'),auth[_0x7196('0xa')](),controller[_0x7196('0x1a')]);router[_0x7196('0x17')](_0x7196('0x16'),auth[_0x7196('0xa')](),controller['addApplications']);router['post'](_0x7196('0x1b'),controller[_0x7196('0x1c')]);router[_0x7196('0x17')]('/:id/send',auth[_0x7196('0xa')](),controller['send']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x1d')]);router['delete']('/:id',auth[_0x7196('0xa')](),controller[_0x7196('0x1e')]);router['delete'](_0x7196('0x11'),auth[_0x7196('0xa')](),controller[_0x7196('0x1f')]);router[_0x7196('0x20')](_0x7196('0x12'),auth['isAuthenticated'](),controller[_0x7196('0x21')]);router['delete'](_0x7196('0x14'),auth[_0x7196('0xa')](),controller[_0x7196('0x22')]);module[_0x7196('0x23')]=router; \ No newline at end of file +var _0x1a85=['removeAgents','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addAnswer','addApplications','/:id/notify','/:id/send','send','put','/:id','update','destroy','delete','removeAnswers'];(function(_0x48c3f0,_0x285e0a){var _0x36d889=function(_0x460a86){while(--_0x460a86){_0x48c3f0['push'](_0x48c3f0['shift']());}};_0x36d889(++_0x285e0a);}(_0x1a85,0x178));var _0x51a8=function(_0x45a546,_0x11b6a6){_0x45a546=_0x45a546-0x0;var _0x3e5eac=_0x1a85[_0x45a546];return _0x3e5eac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./whatsappAccount.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0x6')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0x6')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xe')]);router[_0x51a8('0x6')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x10')]);router[_0x51a8('0x6')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x12')]);router['post']('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0x13')]);router[_0x51a8('0x14')]('/:id/dispositions',auth[_0x51a8('0x9')](),controller['addDisposition']);router[_0x51a8('0x14')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x15')]);router[_0x51a8('0x14')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller['addAgents']);router[_0x51a8('0x14')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x16')]);router[_0x51a8('0x14')](_0x51a8('0x17'),controller['notify']);router[_0x51a8('0x14')](_0x51a8('0x18'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x19')]);router[_0x51a8('0x1a')](_0x51a8('0x1b'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x1c')]);router['delete'](_0x51a8('0x1b'),auth['isAuthenticated'](),controller[_0x51a8('0x1d')]);router[_0x51a8('0x1e')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller['removeDispositions']);router[_0x51a8('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x51a8('0x1f')]);router['delete'](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x20')]);module[_0x51a8('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2e6563c..3f73f5d 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 _0xc2c4=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','BOOLEAN'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xc2c4,0xe2));var _0x4c2c=function(_0x4264c2,_0x2da6e8){_0x4264c2=_0x4264c2-0x0;var _0x3be967=_0xc2c4[_0x4264c2];return _0x3be967;};'use strict';var Sequelize=require(_0x4c2c('0x0'));var rs=require(_0x4c2c('0x1'));module[_0x4c2c('0x2')]={'name':{'type':Sequelize[_0x4c2c('0x3')],'unique':_0x4c2c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x4c2c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x4c2c('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x4c2c('0x3')]},'type':{'type':Sequelize[_0x4c2c('0x5')](_0x4c2c('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x4c2c('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4c2c('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4c2c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4c2c('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c2c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4c2c('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4c2c('0x8')],'comment':_0x4c2c('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4c2c('0xa'),'set':function(_0x15ca6e){if(!_0x15ca6e){this[_0x4c2c('0xb')]('mandatoryDispositionPauseId',null);}this[_0x4c2c('0xb')](_0x4c2c('0xc'),_0x15ca6e);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba55=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','TEXT'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0xba55,0x165));var _0x5ba5=function(_0xce2382,_0x2b6aaf){_0xce2382=_0xce2382-0x0;var _0x302163=_0xba55[_0xce2382];return _0x302163;};'use strict';var Sequelize=require(_0x5ba5('0x0'));var rs=require(_0x5ba5('0x1'));module[_0x5ba5('0x2')]={'name':{'type':Sequelize[_0x5ba5('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5ba5('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5ba5('0x3')],'defaultValue':function(){return rs[_0x5ba5('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5ba5('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0x5ba5('0x3')]},'authToken':{'type':Sequelize[_0x5ba5('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5ba5('0x6')],'defaultValue':function(){return _0x5ba5('0x7');}},'notificationSound':{'type':Sequelize[_0x5ba5('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5ba5('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5ba5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5ba5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5ba5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5ba5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5ba5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5ba5('0x9')],'comment':_0x5ba5('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5ba5('0xb'),'set':function(_0x377576){if(!_0x377576){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x5ba5('0xc')](_0x5ba5('0xd'),_0x377576);}},'description':{'type':Sequelize[_0x5ba5('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d8f08da..4c1497e 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 _0xe491=['ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','request','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','Content-Range','reject','save','then','WhatsappAccounts','UserProfileResource','destroy','end','stack','name','send','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','applications','orderBy','Applications','asc','account','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','From','replace','whatsapp:','Body','messageId','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','list','contact','WhatsappInteraction','created','autoclose','close','unmanaged','*,*,*,*','interaction','ContactId','AttachmentId','UserId','unshift','startRouting','Start','receiveMessage','entity\x20found','twilio','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x3dbcc2,_0x40457d){var _0x4af166=function(_0x5248c6){while(--_0x5248c6){_0x3dbcc2['push'](_0x3dbcc2['shift']());}};_0x4af166(++_0x40457d);}(_0xe491,0x162));var _0x1e49=function(_0x564558,_0x418dba){_0x564558=_0x564558-0x0;var _0x10a381=_0xe491[_0x564558];return _0x10a381;};'use strict';var emlformat=require(_0x1e49('0x0'));var rimraf=require(_0x1e49('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e49('0x2'));var rp=require(_0x1e49('0x3'));var moment=require(_0x1e49('0x4'));var BPromise=require(_0x1e49('0x5'));var Mustache=require(_0x1e49('0x6'));var util=require(_0x1e49('0x7'));var path=require(_0x1e49('0x8'));var sox=require('sox');var csv=require(_0x1e49('0x9'));var ejs=require(_0x1e49('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e49('0xb'));var squel=require(_0x1e49('0xc'));var crypto=require('crypto');var jsforce=require(_0x1e49('0xd'));var deskjs=require(_0x1e49('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e49('0xf'));var Papa=require(_0x1e49('0x10'));var Redis=require(_0x1e49('0x11'));var authService=require(_0x1e49('0x12'));var qs=require(_0x1e49('0x13'));var as=require(_0x1e49('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e49('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1e49('0x16'));var db=require('../../mysqldb')['db'];config[_0x1e49('0x17')]=_[_0x1e49('0x18')](config['redis'],{'host':_0x1e49('0x19'),'port':0x18eb});var socket=require(_0x1e49('0x1a'))(new Redis(config[_0x1e49('0x17')]));require(_0x1e49('0x1b'))[_0x1e49('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1e49('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x49bc53,_0xce79b1,_0x3b519f,_0x47f0a1){return new BPromise(function(_0x1e5ccc,_0x43312f){var _0xd08a17=_0x47f0a1||client;return _0xd08a17[_0x1e49('0x1e')](_0x49bc53,_0x3b519f)['then'](function(_0x423219){logger[_0x1e49('0x1f')](_0x1e49('0x20'),_0xce79b1,'request\x20sent');logger['debug'](_0x1e49('0x21'),_0xce79b1,'request\x20sent',JSON[_0x1e49('0x22')](_0x423219));if(_0x423219[_0x1e49('0x23')]){if(_0x423219[_0x1e49('0x23')][_0x1e49('0x24')]===0x1f4){logger[_0x1e49('0x23')](_0x1e49('0x20'),_0xce79b1,_0x423219[_0x1e49('0x23')][_0x1e49('0x25')]);return _0x43312f(_0x423219[_0x1e49('0x23')][_0x1e49('0x25')]);}logger[_0x1e49('0x23')](_0x1e49('0x20'),_0xce79b1,_0x423219[_0x1e49('0x23')][_0x1e49('0x25')]);return _0x1e5ccc(_0x423219['error']['message']);}else{logger[_0x1e49('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0xce79b1,'request\x20sent');_0x1e5ccc(_0x423219[_0x1e49('0x26')][_0x1e49('0x25')]);}})[_0x1e49('0x27')](function(_0x390d8e){logger[_0x1e49('0x23')](_0x1e49('0x20'),_0xce79b1,_0x390d8e);_0x43312f(_0x390d8e);});});}function respondWithStatusCode(_0x143fd3,_0x2f3cf2){_0x2f3cf2=_0x2f3cf2||0xcc;return function(_0x16e5af){if(_0x16e5af){return _0x143fd3['sendStatus'](_0x2f3cf2);}return _0x143fd3[_0x1e49('0x28')](_0x2f3cf2)['end']();};}function respondWithResult(_0x3dd8f1,_0x4ddbb9){_0x4ddbb9=_0x4ddbb9||0xc8;return function(_0x47677f){if(_0x47677f){return _0x3dd8f1[_0x1e49('0x28')](_0x4ddbb9)[_0x1e49('0x29')](_0x47677f);}};}function respondWithFilteredResult(_0x3d768c,_0x507a03){return function(_0x562606){if(_0x562606){var _0x6ad479=typeof _0x507a03[_0x1e49('0x2a')]===_0x1e49('0x2b')&&typeof _0x507a03['limit']==='undefined';var _0x2db58d=_0x562606[_0x1e49('0x2c')];var _0x7f1406=_0x6ad479?0x0:_0x507a03['offset'];var _0x4c95af=_0x6ad479?_0x562606[_0x1e49('0x2c')]:_0x507a03[_0x1e49('0x2a')]+_0x507a03[_0x1e49('0x2d')];var _0x7a1f5b;if(_0x4c95af>=_0x2db58d){_0x4c95af=_0x2db58d;_0x7a1f5b=0xc8;}else{_0x7a1f5b=0xce;}_0x3d768c[_0x1e49('0x28')](_0x7a1f5b);return _0x3d768c['set'](_0x1e49('0x2e'),_0x7f1406+'-'+_0x4c95af+'/'+_0x2db58d)[_0x1e49('0x29')](_0x562606);}return null;};}function patchUpdates(_0x32f2e9){return function(_0x1c784e){try{jsonpatch['apply'](_0x1c784e,_0x32f2e9,!![]);}catch(_0x18e250){return BPromise[_0x1e49('0x2f')](_0x18e250);}return _0x1c784e[_0x1e49('0x30')]();};}function saveUpdates(_0xacf0be,_0x5aa310){return function(_0x185154){if(_0x185154){return _0x185154['update'](_0xacf0be)[_0x1e49('0x31')](function(_0x1b28d7){return _0x1b28d7;});}return null;};}function removeEntity(_0x150f68,_0x1d5021){return function(_0x2da31e){if(_0x2da31e){return _0x2da31e['destroy']()[_0x1e49('0x31')](function(){var _0x582c97=_0x2da31e['get']({'plain':!![]});var _0xd6b6fc=_0x1e49('0x32');return db[_0x1e49('0x33')][_0x1e49('0x34')]({'where':{'type':_0xd6b6fc,'resourceId':_0x582c97['id']}})[_0x1e49('0x31')](function(){return _0x2da31e;});})[_0x1e49('0x31')](function(){_0x150f68[_0x1e49('0x28')](0xcc)[_0x1e49('0x35')]();});}};}function handleEntityNotFound(_0x24e571,_0x464836){return function(_0x29f877){if(!_0x29f877){_0x24e571['sendStatus'](0x194);}return _0x29f877;};}function handleError(_0x5ddf52,_0x2809ec){_0x2809ec=_0x2809ec||0x1f4;return function(_0x528312){logger['error'](_0x528312[_0x1e49('0x36')]);if(_0x528312[_0x1e49('0x37')]){delete _0x528312[_0x1e49('0x37')];}_0x5ddf52[_0x1e49('0x28')](_0x2809ec)[_0x1e49('0x38')](_0x528312);};}exports['index']=function(_0x378db6,_0xff2df2){var _0x4531f8={'include':[{'model':db['Pause'],'as':_0x1e49('0x39')}]},_0x39a81b={},_0xe8dece={'count':0x0,'rows':[]};var _0x32a8b3=_[_0x1e49('0x3a')](db[_0x1e49('0x3b')][_0x1e49('0x3c')],function(_0x3a1339){return{'name':_0x3a1339['fieldName'],'type':_0x3a1339['type'][_0x1e49('0x3d')]};});_0x39a81b[_0x1e49('0x3e')]=_[_0x1e49('0x3a')](_0x32a8b3,_0x1e49('0x37'));_0x39a81b[_0x1e49('0x3f')]=_[_0x1e49('0x40')](_0x378db6[_0x1e49('0x3f')]);_0x39a81b[_0x1e49('0x41')]=_[_0x1e49('0x42')](_0x39a81b['model'],_0x39a81b[_0x1e49('0x3f')]);_0x4531f8[_0x1e49('0x43')]=_[_0x1e49('0x42')](_0x39a81b['model'],qs['fields'](_0x378db6[_0x1e49('0x3f')]['fields']));_0x4531f8[_0x1e49('0x43')]=_0x4531f8['attributes'][_0x1e49('0x44')]?_0x4531f8['attributes']:_0x39a81b[_0x1e49('0x3e')];if(!_0x378db6['query'][_0x1e49('0x45')]('nolimit')){_0x4531f8[_0x1e49('0x2d')]=qs[_0x1e49('0x2d')](_0x378db6[_0x1e49('0x3f')][_0x1e49('0x2d')]);_0x4531f8[_0x1e49('0x2a')]=qs['offset'](_0x378db6[_0x1e49('0x3f')]['offset']);}_0x4531f8[_0x1e49('0x46')]=qs['sort'](_0x378db6['query'][_0x1e49('0x47')]);_0x4531f8[_0x1e49('0x48')]=qs[_0x1e49('0x41')](_[_0x1e49('0x49')](_0x378db6[_0x1e49('0x3f')],_0x39a81b[_0x1e49('0x41')]),_0x32a8b3);if(_0x378db6[_0x1e49('0x3f')][_0x1e49('0x4a')]){_0x4531f8[_0x1e49('0x48')]=_[_0x1e49('0x4b')](_0x4531f8[_0x1e49('0x48')],{'$or':_['map'](_0x32a8b3,function(_0x104386){if(_0x104386[_0x1e49('0x4c')]!==_0x1e49('0x4d')){var _0x1e27ac={};_0x1e27ac[_0x104386[_0x1e49('0x37')]]={'$like':'%'+_0x378db6['query'][_0x1e49('0x4a')]+'%'};return _0x1e27ac;}})});}_0x4531f8=_[_0x1e49('0x4b')]({},_0x4531f8,_0x378db6[_0x1e49('0x4e')]);var _0x4a39e8={'where':_0x4531f8[_0x1e49('0x48')]};return db[_0x1e49('0x3b')][_0x1e49('0x2c')](_0x4a39e8)[_0x1e49('0x31')](function(_0xa8475a){_0xe8dece[_0x1e49('0x2c')]=_0xa8475a;if(_0x378db6[_0x1e49('0x3f')][_0x1e49('0x4f')]){_0x4531f8[_0x1e49('0x50')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x1e49('0x51')](_0x4531f8);})[_0x1e49('0x31')](function(_0x76125b){_0xe8dece[_0x1e49('0x52')]=_0x76125b;return _0xe8dece;})[_0x1e49('0x31')](respondWithFilteredResult(_0xff2df2,_0x4531f8))['catch'](handleError(_0xff2df2,null));};exports[_0x1e49('0x53')]=function(_0x9abdb9,_0x23c1b1){var _0x22f195={'raw':![],'where':{'id':_0x9abdb9[_0x1e49('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x1e49('0x39')}]},_0x57968c={};_0x57968c['model']=_[_0x1e49('0x40')](db[_0x1e49('0x3b')][_0x1e49('0x3c')]);_0x57968c[_0x1e49('0x3f')]=_['keys'](_0x9abdb9[_0x1e49('0x3f')]);_0x57968c['filters']=_[_0x1e49('0x42')](_0x57968c[_0x1e49('0x3e')],_0x57968c[_0x1e49('0x3f')]);_0x22f195[_0x1e49('0x43')]=_['intersection'](_0x57968c[_0x1e49('0x3e')],qs[_0x1e49('0x55')](_0x9abdb9[_0x1e49('0x3f')][_0x1e49('0x55')]));_0x22f195[_0x1e49('0x43')]=_0x22f195['attributes'][_0x1e49('0x44')]?_0x22f195[_0x1e49('0x43')]:_0x57968c[_0x1e49('0x3e')];if(_0x9abdb9[_0x1e49('0x3f')]['includeAll']){_0x22f195[_0x1e49('0x50')]=[{'all':!![]}];}_0x22f195=_['merge']({},_0x22f195,_0x9abdb9[_0x1e49('0x4e')]);return db[_0x1e49('0x3b')][_0x1e49('0x56')](_0x22f195)['then'](handleEntityNotFound(_0x23c1b1,null))[_0x1e49('0x31')](respondWithResult(_0x23c1b1,null))[_0x1e49('0x27')](handleError(_0x23c1b1,null));};exports[_0x1e49('0x57')]=function(_0x44eda0,_0x41c2d1){return db[_0x1e49('0x3b')][_0x1e49('0x57')](_0x44eda0[_0x1e49('0x58')],{})['then'](function(_0x3d294d){var _0x5d68fb=_0x44eda0['user']['get']({'plain':!![]});if(!_0x5d68fb)throw new Error(_0x1e49('0x59'));if(_0x5d68fb[_0x1e49('0x5a')]===_0x1e49('0x5b')){var _0x35f3e2=_0x3d294d[_0x1e49('0x5c')]({'plain':!![]});var _0x230b1e=_0x1e49('0x32');return db[_0x1e49('0x5d')][_0x1e49('0x56')]({'where':{'name':_0x230b1e,'userProfileId':_0x5d68fb[_0x1e49('0x5e')]},'raw':!![]})[_0x1e49('0x31')](function(_0x510337){if(_0x510337&&_0x510337['autoAssociation']===0x0){return db[_0x1e49('0x33')][_0x1e49('0x57')]({'name':_0x35f3e2[_0x1e49('0x37')],'resourceId':_0x35f3e2['id'],'type':_0x510337['name'],'sectionId':_0x510337['id']},{})[_0x1e49('0x31')](function(){return _0x3d294d;});}else{return _0x3d294d;}})[_0x1e49('0x27')](function(_0x448ff8){logger[_0x1e49('0x23')](_0x1e49('0x5f'),_0x448ff8);throw _0x448ff8;});}return _0x3d294d;})[_0x1e49('0x31')](respondWithResult(_0x41c2d1,0xc9))[_0x1e49('0x27')](handleError(_0x41c2d1,null));};exports[_0x1e49('0x60')]=function(_0x133865,_0x150bc6){if(_0x133865[_0x1e49('0x58')]['id']){delete _0x133865['body']['id'];}return db['WhatsappAccount'][_0x1e49('0x56')]({'where':{'id':_0x133865[_0x1e49('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x1e49('0x39')}]})['then'](handleEntityNotFound(_0x150bc6,null))[_0x1e49('0x31')](saveUpdates(_0x133865[_0x1e49('0x58')],null))[_0x1e49('0x31')](respondWithResult(_0x150bc6,null))[_0x1e49('0x27')](handleError(_0x150bc6,null));};exports['destroy']=function(_0x3bac78,_0x33de3e){return db['WhatsappAccount'][_0x1e49('0x56')]({'where':{'id':_0x3bac78[_0x1e49('0x54')]['id']}})[_0x1e49('0x31')](handleEntityNotFound(_0x33de3e,null))[_0x1e49('0x31')](removeEntity(_0x33de3e,null))[_0x1e49('0x27')](handleError(_0x33de3e,null));};exports[_0x1e49('0x61')]=function(_0x5d150d,_0xa12f88){return db['WhatsappAccount'][_0x1e49('0x61')]()['then'](respondWithResult(_0xa12f88,null))[_0x1e49('0x27')](handleError(_0xa12f88,null));};exports[_0x1e49('0x62')]=function(_0x5a82bf,_0x15e608,_0x56015d){if(_0x5a82bf[_0x1e49('0x58')]['id']){delete _0x5a82bf[_0x1e49('0x58')]['id'];}return db[_0x1e49('0x3b')][_0x1e49('0x56')]({'where':{'id':_0x5a82bf[_0x1e49('0x54')]['id']}})[_0x1e49('0x31')](handleEntityNotFound(_0x15e608,null))[_0x1e49('0x31')](function(_0x5b8b6a){if(_0x5b8b6a){_0x5a82bf['body'][_0x1e49('0x63')]=_0x5b8b6a['id'];return db[_0x1e49('0x64')][_0x1e49('0x57')](_0x5a82bf['body']);}})[_0x1e49('0x31')](respondWithResult(_0x15e608,null))[_0x1e49('0x27')](handleError(_0x15e608,null));};exports[_0x1e49('0x65')]=function(_0x12df29,_0x51cccf,_0x3e5642){var _0x4df7fc={'raw':![],'where':{}};var _0x147b6d={};var _0x126955={'count':0x0,'rows':[]};return db[_0x1e49('0x3b')][_0x1e49('0x66')]({'where':{'id':_0x12df29[_0x1e49('0x54')]['id']}})['then'](handleEntityNotFound(_0x51cccf,null))['then'](function(_0x16c52f){if(_0x16c52f){_0x147b6d[_0x1e49('0x3e')]=_[_0x1e49('0x40')](db[_0x1e49('0x64')][_0x1e49('0x3c')]);_0x147b6d[_0x1e49('0x3f')]=_['keys'](_0x12df29[_0x1e49('0x3f')]);_0x147b6d[_0x1e49('0x41')]=_['intersection'](_0x147b6d[_0x1e49('0x3e')],_0x147b6d[_0x1e49('0x3f')]);_0x4df7fc[_0x1e49('0x43')]=_[_0x1e49('0x42')](_0x147b6d[_0x1e49('0x3e')],qs[_0x1e49('0x55')](_0x12df29[_0x1e49('0x3f')][_0x1e49('0x55')]));_0x4df7fc['attributes']=_0x4df7fc[_0x1e49('0x43')][_0x1e49('0x44')]?_0x4df7fc['attributes']:_0x147b6d[_0x1e49('0x3e')];if(!_0x12df29[_0x1e49('0x3f')][_0x1e49('0x45')](_0x1e49('0x67'))){_0x4df7fc[_0x1e49('0x2d')]=qs[_0x1e49('0x2d')](_0x12df29['query'][_0x1e49('0x2d')]);_0x4df7fc[_0x1e49('0x2a')]=qs[_0x1e49('0x2a')](_0x12df29[_0x1e49('0x3f')]['offset']);}_0x4df7fc['order']=qs[_0x1e49('0x47')](_0x12df29[_0x1e49('0x3f')][_0x1e49('0x47')]);_0x4df7fc['where']=qs['filters'](_['pick'](_0x12df29[_0x1e49('0x3f')],_0x147b6d[_0x1e49('0x41')]));_0x4df7fc[_0x1e49('0x48')][_0x1e49('0x63')]=_0x16c52f['id'];if(_0x12df29['query'][_0x1e49('0x4a')]){_0x4df7fc[_0x1e49('0x48')]=_[_0x1e49('0x4b')](_0x4df7fc['where'],{'$or':_[_0x1e49('0x3a')](_0x4df7fc[_0x1e49('0x43')],function(_0x3d25a0){var _0x5ede0b={};_0x5ede0b[_0x3d25a0]={'$like':'%'+_0x12df29[_0x1e49('0x3f')]['filter']+'%'};return _0x5ede0b;})});}_0x4df7fc=_[_0x1e49('0x4b')]({},_0x4df7fc,_0x12df29[_0x1e49('0x4e')]);return db[_0x1e49('0x64')][_0x1e49('0x2c')]({'where':_0x4df7fc['where']})[_0x1e49('0x31')](function(_0x526ea2){_0x126955[_0x1e49('0x2c')]=_0x526ea2;if(_0x12df29['query'][_0x1e49('0x4f')]){_0x4df7fc[_0x1e49('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4df7fc);})[_0x1e49('0x31')](function(_0x28d1cd){_0x126955[_0x1e49('0x52')]=_0x28d1cd;return _0x126955;});}})[_0x1e49('0x31')](respondWithFilteredResult(_0x51cccf,_0x4df7fc))[_0x1e49('0x27')](handleError(_0x51cccf,null));};exports[_0x1e49('0x68')]=function(_0x214540,_0x388cf3,_0x28bd2b){return db[_0x1e49('0x3b')]['find']({'where':{'id':_0x214540[_0x1e49('0x54')]['id']}})['then'](handleEntityNotFound(_0x388cf3,null))[_0x1e49('0x31')](function(_0x5d881c){if(_0x5d881c){return _0x5d881c[_0x1e49('0x68')](_0x214540[_0x1e49('0x3f')]['ids']);}})[_0x1e49('0x31')](respondWithStatusCode(_0x388cf3,null))['catch'](handleError(_0x388cf3,null));};exports['addAnswer']=function(_0x48a33d,_0x2740fb,_0x5d6f3c){if(_0x48a33d['body']['id']){delete _0x48a33d[_0x1e49('0x58')]['id'];}return db[_0x1e49('0x3b')][_0x1e49('0x56')]({'where':{'id':_0x48a33d[_0x1e49('0x54')]['id']}})[_0x1e49('0x31')](handleEntityNotFound(_0x2740fb,null))[_0x1e49('0x31')](function(_0x20c76d){if(_0x20c76d){_0x48a33d[_0x1e49('0x58')][_0x1e49('0x63')]=_0x20c76d['id'];return db[_0x1e49('0x69')][_0x1e49('0x57')](_0x48a33d[_0x1e49('0x58')]);}})[_0x1e49('0x31')](respondWithResult(_0x2740fb,null))[_0x1e49('0x27')](handleError(_0x2740fb,null));};exports[_0x1e49('0x6a')]=function(_0x44e39e,_0x5838b9,_0x1d05d3){var _0x400c32={'raw':![],'where':{}};var _0x2ae86b={};var _0xc99988={'count':0x0,'rows':[]};return db[_0x1e49('0x3b')][_0x1e49('0x66')]({'where':{'id':_0x44e39e[_0x1e49('0x54')]['id']}})[_0x1e49('0x31')](handleEntityNotFound(_0x5838b9,null))['then'](function(_0x5e3d77){if(_0x5e3d77){_0x2ae86b[_0x1e49('0x3e')]=_[_0x1e49('0x40')](db[_0x1e49('0x69')]['rawAttributes']);_0x2ae86b['query']=_[_0x1e49('0x40')](_0x44e39e['query']);_0x2ae86b[_0x1e49('0x41')]=_['intersection'](_0x2ae86b[_0x1e49('0x3e')],_0x2ae86b[_0x1e49('0x3f')]);_0x400c32[_0x1e49('0x43')]=_['intersection'](_0x2ae86b[_0x1e49('0x3e')],qs[_0x1e49('0x55')](_0x44e39e[_0x1e49('0x3f')][_0x1e49('0x55')]));_0x400c32[_0x1e49('0x43')]=_0x400c32[_0x1e49('0x43')]['length']?_0x400c32[_0x1e49('0x43')]:_0x2ae86b[_0x1e49('0x3e')];if(!_0x44e39e['query']['hasOwnProperty'](_0x1e49('0x67'))){_0x400c32['limit']=qs[_0x1e49('0x2d')](_0x44e39e[_0x1e49('0x3f')][_0x1e49('0x2d')]);_0x400c32[_0x1e49('0x2a')]=qs[_0x1e49('0x2a')](_0x44e39e[_0x1e49('0x3f')][_0x1e49('0x2a')]);}_0x400c32['order']=qs[_0x1e49('0x47')](_0x44e39e[_0x1e49('0x3f')]['sort']);_0x400c32['where']=qs[_0x1e49('0x41')](_[_0x1e49('0x49')](_0x44e39e[_0x1e49('0x3f')],_0x2ae86b[_0x1e49('0x41')]));_0x400c32['where'][_0x1e49('0x63')]=_0x5e3d77['id'];if(_0x44e39e['query']['filter']){_0x400c32[_0x1e49('0x48')]=_[_0x1e49('0x4b')](_0x400c32[_0x1e49('0x48')],{'$or':_['map'](_0x400c32['attributes'],function(_0x289c87){var _0x234cbf={};_0x234cbf[_0x289c87]={'$like':'%'+_0x44e39e['query'][_0x1e49('0x4a')]+'%'};return _0x234cbf;})});}_0x400c32=_['merge']({},_0x400c32,_0x44e39e[_0x1e49('0x4e')]);return db['CannedAnswer'][_0x1e49('0x2c')]({'where':_0x400c32[_0x1e49('0x48')]})[_0x1e49('0x31')](function(_0x7d94dd){_0xc99988[_0x1e49('0x2c')]=_0x7d94dd;if(_0x44e39e[_0x1e49('0x3f')][_0x1e49('0x4f')]){_0x400c32[_0x1e49('0x50')]=[{'all':!![]}];}return db[_0x1e49('0x69')][_0x1e49('0x51')](_0x400c32);})[_0x1e49('0x31')](function(_0x33dd96){_0xc99988[_0x1e49('0x52')]=_0x33dd96;return _0xc99988;});}})[_0x1e49('0x31')](respondWithFilteredResult(_0x5838b9,_0x400c32))[_0x1e49('0x27')](handleError(_0x5838b9,null));};exports['removeAnswers']=function(_0xf85457,_0x19dabd,_0x4866cc){return db[_0x1e49('0x3b')]['find']({'where':{'id':_0xf85457[_0x1e49('0x54')]['id']}})[_0x1e49('0x31')](handleEntityNotFound(_0x19dabd,null))[_0x1e49('0x31')](function(_0x588e8a){if(_0x588e8a){return _0x588e8a[_0x1e49('0x6b')](_0xf85457[_0x1e49('0x3f')][_0x1e49('0x6c')]);}})[_0x1e49('0x31')](respondWithStatusCode(_0x19dabd,null))[_0x1e49('0x27')](handleError(_0x19dabd,null));};exports[_0x1e49('0x6d')]=function(_0x379060,_0x5df55c,_0x392fcd){return db[_0x1e49('0x3b')][_0x1e49('0x56')]({'where':{'id':_0x379060['params']['id']}})[_0x1e49('0x31')](handleEntityNotFound(_0x5df55c,null))[_0x1e49('0x31')](function(_0xcf56a){if(_0xcf56a){return _0xcf56a['addAgents'](_0x379060[_0x1e49('0x58')][_0x1e49('0x6c')],_[_0x1e49('0x6e')](_0x379060[_0x1e49('0x58')],[_0x1e49('0x6c'),'id'])||{})[_0x1e49('0x6f')](function(_0x1ee3bb){for(var _0x2126f3=0x0;_0x2126f3<_0x379060['body'][_0x1e49('0x6c')][_0x1e49('0x44')];_0x2126f3+=0x1){socket[_0x1e49('0x70')](_0x1e49('0x71'),{'UserId':Number(_0x379060[_0x1e49('0x58')][_0x1e49('0x6c')][_0x2126f3]),'WhatsappAccountId':Number(_0x379060[_0x1e49('0x54')]['id'])});}return _0x1ee3bb;});}})[_0x1e49('0x31')](respondWithResult(_0x5df55c,null))[_0x1e49('0x27')](handleError(_0x5df55c,null));};exports[_0x1e49('0x72')]=function(_0x1f418a,_0xceed31,_0x518525){return db[_0x1e49('0x3b')][_0x1e49('0x56')]({'where':{'id':_0x1f418a[_0x1e49('0x54')]['id']}})[_0x1e49('0x31')](handleEntityNotFound(_0xceed31,null))['then'](function(_0x1b17af){if(_0x1b17af){return _0x1b17af[_0x1e49('0x72')](_0x1f418a[_0x1e49('0x3f')][_0x1e49('0x6c')])['then'](function(){if(_[_0x1e49('0x73')](_0x1f418a[_0x1e49('0x3f')][_0x1e49('0x6c')])){for(var _0x457587=0x0;_0x457587<_0x1f418a[_0x1e49('0x3f')]['ids'][_0x1e49('0x44')];_0x457587+=0x1){socket['emit'](_0x1e49('0x74'),{'UserId':Number(_0x1f418a['query'][_0x1e49('0x6c')][_0x457587]),'WhatsappAccountId':Number(_0x1f418a[_0x1e49('0x54')]['id'])});}}else{socket[_0x1e49('0x70')](_0x1e49('0x74'),{'UserId':Number(_0x1f418a[_0x1e49('0x3f')]['ids']),'WhatsappAccountId':Number(_0x1f418a[_0x1e49('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0xceed31,null))['catch'](handleError(_0xceed31,null));};exports[_0x1e49('0x75')]=function(_0x513a20,_0x44da5c,_0x50922d){var _0x51768e={};var _0x2fcf8c={};var _0x500a78;var _0x4cfd1b;return db['WhatsappAccount']['findOne']({'where':{'id':_0x513a20[_0x1e49('0x54')]['id']}})['then'](handleEntityNotFound(_0x44da5c,null))[_0x1e49('0x31')](function(_0x74dca7){if(_0x74dca7){_0x500a78=_0x74dca7;_0x2fcf8c['model']=_[_0x1e49('0x40')](db['User'][_0x1e49('0x3c')]);_0x2fcf8c[_0x1e49('0x3f')]=_[_0x1e49('0x40')](_0x513a20[_0x1e49('0x3f')]);_0x2fcf8c[_0x1e49('0x41')]=_[_0x1e49('0x42')](_0x2fcf8c[_0x1e49('0x3e')],_0x2fcf8c['query']);_0x51768e[_0x1e49('0x43')]=_[_0x1e49('0x42')](_0x2fcf8c[_0x1e49('0x3e')],qs['fields'](_0x513a20['query'][_0x1e49('0x55')]));_0x51768e[_0x1e49('0x43')]=_0x51768e[_0x1e49('0x43')][_0x1e49('0x44')]?_0x51768e[_0x1e49('0x43')]:_0x2fcf8c['model'];_0x51768e[_0x1e49('0x46')]=qs[_0x1e49('0x47')](_0x513a20['query'][_0x1e49('0x47')]);_0x51768e[_0x1e49('0x48')]=qs[_0x1e49('0x41')](_['pick'](_0x513a20[_0x1e49('0x3f')],_0x2fcf8c[_0x1e49('0x41')]));if(_0x513a20['query'][_0x1e49('0x4a')]){_0x51768e[_0x1e49('0x48')]=_[_0x1e49('0x4b')](_0x51768e[_0x1e49('0x48')],{'$or':_['map'](_0x51768e[_0x1e49('0x43')],function(_0x1c2145){var _0x447d9d={};_0x447d9d[_0x1c2145]={'$like':'%'+_0x513a20[_0x1e49('0x3f')][_0x1e49('0x4a')]+'%'};return _0x447d9d;})});}_0x51768e=_[_0x1e49('0x4b')]({},_0x51768e,_0x513a20[_0x1e49('0x4e')]);return _0x500a78[_0x1e49('0x75')](_0x51768e);}})[_0x1e49('0x31')](function(_0x1ffa2c){if(_0x1ffa2c){_0x4cfd1b=_0x1ffa2c[_0x1e49('0x44')];if(!_0x513a20[_0x1e49('0x3f')]['hasOwnProperty'](_0x1e49('0x67'))){_0x51768e[_0x1e49('0x2d')]=qs[_0x1e49('0x2d')](_0x513a20[_0x1e49('0x3f')][_0x1e49('0x2d')]);_0x51768e[_0x1e49('0x2a')]=qs[_0x1e49('0x2a')](_0x513a20['query']['offset']);}return _0x500a78[_0x1e49('0x75')](_0x51768e);}})[_0x1e49('0x31')](function(_0x191708){if(_0x191708){return _0x191708?{'count':_0x4cfd1b,'rows':_0x191708}:null;}})[_0x1e49('0x31')](respondWithResult(_0x44da5c,null))[_0x1e49('0x27')](handleError(_0x44da5c,null));};exports[_0x1e49('0x76')]=function(_0x181b67,_0x3fd664,_0x43f5c2){return db['WhatsappAccount'][_0x1e49('0x66')]({'where':{'id':_0x181b67[_0x1e49('0x54')]['id']}})[_0x1e49('0x31')](handleEntityNotFound(_0x3fd664,null))[_0x1e49('0x31')](function(_0x5cab2d){if(_0x5cab2d){return db[_0x1e49('0x77')][_0x1e49('0x78')](function(_0x38b97d){return db[_0x1e49('0x79')][_0x1e49('0x34')]({'where':{'WhatsappAccountId':_0x181b67[_0x1e49('0x54')]['id']},'transaction':_0x38b97d})[_0x1e49('0x31')](function(_0x18cffe){var _0x4e50da=_[_0x1e49('0x3a')](_0x181b67['body'],function(_0x3dfbdb){_0x3dfbdb[_0x1e49('0x63')]=_0x181b67['params']['id'];return _0x3dfbdb;});return db[_0x1e49('0x79')][_0x1e49('0x7a')](_0x4e50da,{'transaction':_0x38b97d});});})[_0x1e49('0x31')](function(){return db[_0x1e49('0x79')][_0x1e49('0x7b')]({'where':{'WhatsappAccountId':_0x181b67['params']['id']},'order':_0x1e49('0x7c')});});}})['then'](respondWithResult(_0x3fd664,null))['catch'](handleError(_0x3fd664,null));};exports[_0x1e49('0x7d')]=function(_0x3bf811,_0x2b86c2,_0x2bb2f4){var _0x29209c={};var _0x3f89d6={};var _0x3fe151;var _0x53e156;return db[_0x1e49('0x3b')][_0x1e49('0x66')]({'where':{'id':_0x3bf811['params']['id']}})[_0x1e49('0x31')](handleEntityNotFound(_0x2b86c2,null))[_0x1e49('0x31')](function(_0x10578a){if(_0x10578a){_0x3fe151=_0x10578a;_0x3f89d6[_0x1e49('0x3e')]=_['keys'](db['WhatsappApplication'][_0x1e49('0x3c')]);_0x3f89d6[_0x1e49('0x3f')]=_[_0x1e49('0x40')](_0x3bf811[_0x1e49('0x3f')]);_0x3f89d6[_0x1e49('0x41')]=_['intersection'](_0x3f89d6[_0x1e49('0x3e')],_0x3f89d6[_0x1e49('0x3f')]);_0x29209c[_0x1e49('0x43')]=_[_0x1e49('0x42')](_0x3f89d6['model'],qs['fields'](_0x3bf811[_0x1e49('0x3f')][_0x1e49('0x55')]));_0x29209c[_0x1e49('0x43')]=_0x29209c[_0x1e49('0x43')]['length']?_0x29209c[_0x1e49('0x43')]:_0x3f89d6[_0x1e49('0x3e')];_0x29209c[_0x1e49('0x46')]=qs[_0x1e49('0x47')](_0x3bf811[_0x1e49('0x3f')]['sort']);_0x29209c['where']=qs[_0x1e49('0x41')](_[_0x1e49('0x49')](_0x3bf811['query'],_0x3f89d6['filters']));if(_0x3bf811[_0x1e49('0x3f')][_0x1e49('0x4a')]){_0x29209c[_0x1e49('0x48')]=_[_0x1e49('0x4b')](_0x29209c['where'],{'$or':_[_0x1e49('0x3a')](_0x29209c['attributes'],function(_0x371d1e){var _0x141d25={};_0x141d25[_0x371d1e]={'$like':'%'+_0x3bf811[_0x1e49('0x3f')]['filter']+'%'};return _0x141d25;})});}_0x29209c=_[_0x1e49('0x4b')]({},_0x29209c,_0x3bf811[_0x1e49('0x4e')]);return _0x3fe151[_0x1e49('0x7d')](_0x29209c);}})[_0x1e49('0x31')](function(_0xb44c0){if(_0xb44c0){_0x53e156=_0xb44c0[_0x1e49('0x44')];if(!_0x3bf811['query']['hasOwnProperty'](_0x1e49('0x67'))){_0x29209c[_0x1e49('0x2d')]=qs[_0x1e49('0x2d')](_0x3bf811[_0x1e49('0x3f')][_0x1e49('0x2d')]);_0x29209c[_0x1e49('0x2a')]=qs[_0x1e49('0x2a')](_0x3bf811['query'][_0x1e49('0x2a')]);}return _0x3fe151['getApplications'](_0x29209c);}})[_0x1e49('0x31')](function(_0x2bff18){if(_0x2bff18){return _0x2bff18?{'count':_0x53e156,'rows':_0x2bff18}:null;}})[_0x1e49('0x31')](respondWithResult(_0x2b86c2,null))[_0x1e49('0x27')](handleError(_0x2b86c2,null));};exports[_0x1e49('0x7e')]=function(_0x3008f9,_0x1961ad,_0x3c642d){var _0x5d966d={'channel':_0x1e49('0x7f')};var _0x572635=[];var _0x2403d9=[];var _0x5ba97a={};return db[_0x1e49('0x3b')][_0x1e49('0x56')]({'where':{'id':_0x3008f9[_0x1e49('0x54')]['id']},'include':[{'model':db[_0x1e49('0x79')],'as':'Applications'}]})[_0x1e49('0x31')](handleEntityNotFound(_0x1961ad,null))[_0x1e49('0x31')](function(_0x31bbcc){_0x5d966d['account']=_0x31bbcc;_0x5d966d[_0x1e49('0x80')]=_[_0x1e49('0x81')](_0x31bbcc[_0x1e49('0x82')],[_0x1e49('0x7c')],[_0x1e49('0x83')]);if(_0x5d966d[_0x1e49('0x84')][_0x1e49('0x82')]){delete _0x5d966d['account'][_0x1e49('0x82')];}return db[_0x1e49('0x85')][_0x1e49('0x61')]();})[_0x1e49('0x31')](function(_0x5a609f){if(!_0x5a609f){throw new db['Sequelize'][(_0x1e49('0x86'))]('no\x20available\x20attributes');}_0x572635=_[_0x1e49('0x87')](_['keys'](_0x5a609f),[_0x1e49('0x88'),_0x1e49('0x89')]);_0x2403d9=_[_0x1e49('0x87')](_[_0x1e49('0x40')](_0x5a609f),['createdAt',_0x1e49('0x89'),_0x1e49('0x8a'),_0x1e49('0x8b')]);_0x5d966d[_0x1e49('0x58')]={'mapKey':'mobile'};if(_0x5d966d[_0x1e49('0x84')][_0x1e49('0x4c')]&&_0x5d966d[_0x1e49('0x84')]['type']==='twilio'){_0x5d966d[_0x1e49('0x58')]['from']=_0x3008f9[_0x1e49('0x58')][_0x1e49('0x8c')][_0x1e49('0x8d')](_0x1e49('0x8e'),'');_0x5d966d[_0x1e49('0x58')][_0x1e49('0x58')]=_0x3008f9[_0x1e49('0x58')][_0x1e49('0x8f')];_0x5d966d['body'][_0x1e49('0x90')]=_0x3008f9[_0x1e49('0x58')]['MessageSid'];}if(_0x5d966d[_0x1e49('0x58')]['id']){delete _0x5d966d[_0x1e49('0x58')]['id'];}if(_[_0x1e49('0x91')](_0x5d966d[_0x1e49('0x58')]['from'])){throw new db[(_0x1e49('0x92'))][(_0x1e49('0x86'))]('from\x20is\x20mandatory');}if(_[_0x1e49('0x91')](_0x5d966d[_0x1e49('0x58')][_0x1e49('0x58')])||_0x5d966d[_0x1e49('0x58')][_0x1e49('0x58')]===''){throw new db[(_0x1e49('0x92'))]['ValidationError'](_0x1e49('0x93'));}if(_[_0x1e49('0x91')](_0x5d966d[_0x1e49('0x58')][_0x1e49('0x94')])){throw new db[(_0x1e49('0x92'))]['ValidationError'](_0x1e49('0x95')+_0x2403d9);}if(!_['includes'](_0x2403d9,_0x5d966d[_0x1e49('0x58')][_0x1e49('0x94')])){throw new db[(_0x1e49('0x92'))][(_0x1e49('0x86'))](_0x1e49('0x96')+_0x2403d9);}_0x5ba97a[_0x5d966d[_0x1e49('0x58')][_0x1e49('0x94')]]=_0x5d966d['body'][_0x1e49('0x97')];return db[_0x1e49('0x98')][_0x1e49('0x56')]({'where':{'id':_0x5d966d[_0x1e49('0x84')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x1e49('0x99'),'where':_0x5ba97a,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x1961ad,null))[_0x1e49('0x31')](function(_0x3b2511){if(_0x3b2511){_0x5d966d[_0x1e49('0x9a')]=_[_0x1e49('0x6e')](_0x3b2511,[_0x1e49('0x99')]);if(_0x3b2511[_0x1e49('0x99')][_0x1e49('0x44')]){return _0x3b2511['Contacts'][0x0];}var _0x2ed700=_['defaults'](_0x5d966d[_0x1e49('0x58')],{'firstName':_0x5d966d[_0x1e49('0x58')][_0x1e49('0x97')],'ListId':_0x3b2511['id']});_0x2ed700[_0x5d966d[_0x1e49('0x58')][_0x1e49('0x94')]]=_0x5d966d[_0x1e49('0x58')]['from'];return db[_0x1e49('0x85')][_0x1e49('0x57')](_0x2ed700,{'fields':_0x572635,'raw':!![]});}})[_0x1e49('0x31')](handleEntityNotFound(_0x1961ad,null))[_0x1e49('0x31')](function(_0x5d1b04){if(_0x5d1b04){_0x5d966d[_0x1e49('0x9b')]=_0x5d1b04;var _0x4b5c53={'ContactId':_0x5d1b04['id'],'phone':_0x5d966d[_0x1e49('0x58')][_0x1e49('0x97')],'WhatsappAccountId':_0x3008f9['params']['id']};var _0x291229={'ContactId':_0x5d1b04['id'],'WhatsappAccountId':_0x3008f9[_0x1e49('0x54')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x1e49('0x56')]({'where':_0x291229})[_0x1e49('0x31')](function(_0x41e01f){if(_0x41e01f){return[_0x41e01f,![]];}return db[_0x1e49('0x9c')]['create'](_0x4b5c53)[_0x1e49('0x31')](function(_0x5f5c4f){return[_0x5f5c4f,!![]];});});}})['spread'](function(_0x42c0cb,_0x41e015){_0x5d966d['interaction']=_0x42c0cb[_0x1e49('0x5c')]({'plain':!![]});_0x5d966d['interaction'][_0x1e49('0x9d')]=![];if(_0x41e015){if(_0x5d966d[_0x1e49('0x84')][_0x1e49('0x9e')]){_0x5d966d['applications']['push']({'id':0x0,'priority':_0x5d966d[_0x1e49('0x80')][_0x1e49('0x44')]+0x1,'app':_0x1e49('0x9f'),'appdata':_0x1e49('0xa0'),'interval':_0x1e49('0xa1')});}_0x5d966d[_0x1e49('0xa2')][_0x1e49('0x9d')]=!![];}return db['WhatsappMessage'][_0x1e49('0x57')]({'phone':_0x5d966d[_0x1e49('0x58')][_0x1e49('0x97')],'messageId':_0x5d966d[_0x1e49('0x58')]['messageId'],'body':_0x5d966d['body'][_0x1e49('0x58')],'WhatsappAccountId':_0x3008f9[_0x1e49('0x54')]['id'],'WhatsappInteractionId':_0x42c0cb['id'],'direction':'in','ContactId':_0x42c0cb[_0x1e49('0xa3')],'AttachmentId':_0x5d966d[_0x1e49('0x58')][_0x1e49('0xa4')]});})[_0x1e49('0x31')](function(_0x58f0cd){_0x5d966d[_0x1e49('0x25')]=_0x58f0cd;if(_0x5d966d[_0x1e49('0xa2')][_0x1e49('0xa5')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x5d966d['interaction'][_0x1e49('0xa5')]}})[_0x1e49('0x31')](function(_0x4c055b){if(_0x4c055b){_0x5d966d[_0x1e49('0x80')][_0x1e49('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c055b[_0x1e49('0x37')]+','+(_0x5d966d[_0x1e49('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0x1e49('0xa1')});}return respondWithRpcPromise('Start',_0x1e49('0xa7'),_0x5d966d);});}return respondWithRpcPromise(_0x1e49('0xa8'),'startRouting',_0x5d966d);})[_0x1e49('0x31')](function(_0x36983d){if(_0x36983d){var _0x56b3dd=0xc8;var _0xce1a59=_0x1e49('0xa9');logger[_0x1e49('0x1f')](_0x1e49('0x21'),_0xce1a59,_0x56b3dd,_0x1e49('0xaa'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xce1a59,_0x56b3dd,_0x1e49('0xaa'),JSON['stringify'](_0x36983d));if(_0x5d966d[_0x1e49('0x84')][_0x1e49('0x4c')]===_0x1e49('0xab')){return _0x1961ad['status'](_0x56b3dd)[_0x1e49('0xac')](_0x1e49('0xad'),_0x1e49('0xae'))[_0x1e49('0x38')](_0x1e49('0xaf'));}else{return _0x1961ad[_0x1e49('0x28')](_0x56b3dd)['json'](_0x36983d);}}})[_0x1e49('0x27')](handleError(_0x1961ad,null));};exports['send']=function(_0x30199f,_0x563533,_0x44882e){var _0x20185a,_0x18bc42,_0x1d02b3;if(_['isNil'](_0x30199f[_0x1e49('0x58')][_0x1e49('0x58')])||_0x30199f[_0x1e49('0x58')][_0x1e49('0x58')]===''){throw new db[(_0x1e49('0x92'))][(_0x1e49('0x86'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x30199f[_0x1e49('0x58')]['to'])){throw new db['Sequelize'][(_0x1e49('0x86'))](_0x1e49('0xb0'));}_0x20185a=_0x30199f[_0x1e49('0x58')]['to'];return db[_0x1e49('0x3b')]['find']({'where':{'id':_0x30199f[_0x1e49('0x54')]['id']},'include':[{'model':db[_0x1e49('0x98')],'as':_0x1e49('0xb1'),'include':[{'model':db[_0x1e49('0x85')],'as':'Contacts','where':{'mobile':_0x20185a},'limit':0x1,'order':[['updatedAt',_0x1e49('0xb2')]]}]}]})[_0x1e49('0x31')](handleEntityNotFound(_0x563533,null))[_0x1e49('0x31')](function(_0x4a0130){if(_0x4a0130&&_0x4a0130['List']){_0x18bc42=_0x4a0130[_0x1e49('0x5c')]({'plain':!![]});if(_0x18bc42[_0x1e49('0xb1')]&&_0x18bc42[_0x1e49('0xb1')]['Contacts'][_0x1e49('0x44')]){return _0x18bc42[_0x1e49('0xb1')][_0x1e49('0x99')][0x0];}return db[_0x1e49('0x85')][_0x1e49('0x57')](_[_0x1e49('0x18')](_0x30199f[_0x1e49('0x58')],{'firstName':_0x20185a,'mobile':_0x20185a,'phone':_0x20185a,'ListId':_0x18bc42['ListId']}));}})[_0x1e49('0x31')](handleEntityNotFound(_0x563533,null))[_0x1e49('0x31')](function(_0x4ee4be){if(_0x4ee4be){_0x1d02b3=_0x4ee4be;return db['WhatsappInteraction'][_0x1e49('0x56')]({'where':{'ContactId':_0x1d02b3['id'],'closed':![],'WhatsappAccountId':_0x18bc42['id']}})[_0x1e49('0x31')](function(_0x4ac117){if(_0x4ac117){return[_0x4ac117,![]];}return db['WhatsappInteraction'][_0x1e49('0x57')]({'UserId':_0x30199f[_0x1e49('0x5b')]['id'],'ContactId':_0x1d02b3['id'],'WhatsappAccountId':_0x18bc42['id'],'phone':_0x20185a,'firstMsgDirection':_0x1e49('0xb3'),'Messages':[_[_0x1e49('0x4b')](_0x30199f['body'],{'read':![],'body':_0x30199f[_0x1e49('0x58')][_0x1e49('0x58')],'phone':_0x20185a,'WhatsappAccountId':_0x18bc42['id'],'UserId':_0x30199f[_0x1e49('0x5b')]['id'],'ContactId':_0x1d02b3['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x1e49('0x31')](function(_0x2d9d81){return[_0x2d9d81,!![]];});});}})[_0x1e49('0x6f')](function(_0x5be471,_0x4f9bdd){if(_0x4f9bdd){return _0x5be471;}return db['WhatsappMessage'][_0x1e49('0x57')](_[_0x1e49('0x4b')](_0x30199f[_0x1e49('0x58')],{'read':![],'body':_0x30199f[_0x1e49('0x58')][_0x1e49('0x58')],'phone':_0x20185a,'WhatsappAccountId':_0x18bc42['id'],'WhatsappInteractionId':_0x5be471['id'],'UserId':_0x30199f['user']['id'],'ContactId':_0x1d02b3['id']}))[_0x1e49('0x31')](function(_0x581640){_0x5be471[_0x1e49('0xb4')][_0x1e49('0xb5')]=[];_0x5be471['dataValues'][_0x1e49('0xb5')]['push'](_0x581640[_0x1e49('0xb4')]);return _0x5be471;});})[_0x1e49('0x31')](respondWithResult(_0x563533,null))[_0x1e49('0x27')](handleError(_0x563533,null));}; \ No newline at end of file +var _0x2627=['options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','params','describe','addDisposition','WhatsappAccountId','Disposition','order','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','findOne','pick','removeAnswers','addAgents','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','WhatsappInteraction','spread','interaction','autoclose','unmanaged','created','WhatsappMessage','ContactId','AttachmentId','UserId','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','DESC','List','Messages','dataValues','push','eml-format','zip-dir','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','WhatsappAccounts','UserProfileResource','sendStatus','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','merge','type','findAll','rawAttributes','length','includeAll','include'];(function(_0x4622a9,_0x1db61c){var _0x351b04=function(_0xe4cef0){while(--_0xe4cef0){_0x4622a9['push'](_0x4622a9['shift']());}};_0x351b04(++_0x1db61c);}(_0x2627,0x1be));var _0x7262=function(_0x8b5e60,_0xb77ad6){_0x8b5e60=_0x8b5e60-0x0;var _0x29877d=_0x2627[_0x8b5e60];return _0x29877d;};'use strict';var emlformat=require(_0x7262('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7262('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7262('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7262('0x3'));var util=require('util');var path=require(_0x7262('0x4'));var sox=require('sox');var csv=require(_0x7262('0x5'));var ejs=require(_0x7262('0x6'));var fs=require('fs');var fs_extra=require(_0x7262('0x7'));var _=require(_0x7262('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7262('0x9'));var deskjs=require(_0x7262('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7262('0xb'));var Redis=require(_0x7262('0xc'));var authService=require(_0x7262('0xd'));var qs=require(_0x7262('0xe'));var as=require(_0x7262('0xf'));var hardwareService=require(_0x7262('0x10'));var logger=require('../../config/logger')(_0x7262('0x11'));var utils=require(_0x7262('0x12'));var config=require(_0x7262('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7262('0x14'))['db'];config[_0x7262('0x15')]=_[_0x7262('0x16')](config[_0x7262('0x15')],{'host':_0x7262('0x17'),'port':0x18eb});var socket=require(_0x7262('0x18'))(new Redis(config[_0x7262('0x15')]));require('./whatsappAccount.socket')[_0x7262('0x19')](socket);var jayson=require(_0x7262('0x1a'));var client=jayson[_0x7262('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x9e4f52,_0x530d86,_0x5e6c99,_0x5be6ac){return new BPromise(function(_0x18a490,_0x49416f){var _0x4c49bb=_0x5be6ac||client;return _0x4c49bb[_0x7262('0x1c')](_0x9e4f52,_0x5e6c99)[_0x7262('0x1d')](function(_0x4f2106){logger[_0x7262('0x1e')](_0x7262('0x1f'),_0x530d86,_0x7262('0x20'));logger[_0x7262('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x530d86,'request\x20sent',JSON[_0x7262('0x22')](_0x4f2106));if(_0x4f2106[_0x7262('0x23')]){if(_0x4f2106['error'][_0x7262('0x24')]===0x1f4){logger[_0x7262('0x23')](_0x7262('0x1f'),_0x530d86,_0x4f2106['error']['message']);return _0x49416f(_0x4f2106[_0x7262('0x23')][_0x7262('0x25')]);}logger['error'](_0x7262('0x1f'),_0x530d86,_0x4f2106[_0x7262('0x23')][_0x7262('0x25')]);return _0x18a490(_0x4f2106[_0x7262('0x23')][_0x7262('0x25')]);}else{logger[_0x7262('0x1e')](_0x7262('0x1f'),_0x530d86,'request\x20sent');_0x18a490(_0x4f2106[_0x7262('0x26')][_0x7262('0x25')]);}})[_0x7262('0x27')](function(_0x335848){logger[_0x7262('0x23')](_0x7262('0x1f'),_0x530d86,_0x335848);_0x49416f(_0x335848);});});}function respondWithStatusCode(_0x3e4fc9,_0x50c01d){_0x50c01d=_0x50c01d||0xcc;return function(_0x33f16d){if(_0x33f16d){return _0x3e4fc9['sendStatus'](_0x50c01d);}return _0x3e4fc9[_0x7262('0x28')](_0x50c01d)[_0x7262('0x29')]();};}function respondWithResult(_0x1f3de5,_0xf3eea6){_0xf3eea6=_0xf3eea6||0xc8;return function(_0x12ddaf){if(_0x12ddaf){return _0x1f3de5[_0x7262('0x28')](_0xf3eea6)[_0x7262('0x2a')](_0x12ddaf);}};}function respondWithFilteredResult(_0x13d14e,_0x2b2f26){return function(_0x1dd5d4){if(_0x1dd5d4){var _0x59fe88=typeof _0x2b2f26[_0x7262('0x2b')]===_0x7262('0x2c')&&typeof _0x2b2f26[_0x7262('0x2d')]===_0x7262('0x2c');var _0x16aad4=_0x1dd5d4[_0x7262('0x2e')];var _0x59440d=_0x59fe88?0x0:_0x2b2f26[_0x7262('0x2b')];var _0x1276cf=_0x59fe88?_0x1dd5d4[_0x7262('0x2e')]:_0x2b2f26[_0x7262('0x2b')]+_0x2b2f26[_0x7262('0x2d')];var _0x5e1501;if(_0x1276cf>=_0x16aad4){_0x1276cf=_0x16aad4;_0x5e1501=0xc8;}else{_0x5e1501=0xce;}_0x13d14e['status'](_0x5e1501);return _0x13d14e['set'](_0x7262('0x2f'),_0x59440d+'-'+_0x1276cf+'/'+_0x16aad4)[_0x7262('0x2a')](_0x1dd5d4);}return null;};}function patchUpdates(_0x18d4b4){return function(_0x5d6675){try{jsonpatch['apply'](_0x5d6675,_0x18d4b4,!![]);}catch(_0x245640){return BPromise[_0x7262('0x30')](_0x245640);}return _0x5d6675[_0x7262('0x31')]();};}function saveUpdates(_0x1fab9c,_0x1a312d){return function(_0x5005db){if(_0x5005db){return _0x5005db['update'](_0x1fab9c)[_0x7262('0x1d')](function(_0x41c370){return _0x41c370;});}return null;};}function removeEntity(_0x57257a,_0x2d54f8){return function(_0x4205dc){if(_0x4205dc){return _0x4205dc[_0x7262('0x32')]()[_0x7262('0x1d')](function(){var _0x2f9996=_0x4205dc['get']({'plain':!![]});var _0x319d95=_0x7262('0x33');return db[_0x7262('0x34')][_0x7262('0x32')]({'where':{'type':_0x319d95,'resourceId':_0x2f9996['id']}})[_0x7262('0x1d')](function(){return _0x4205dc;});})[_0x7262('0x1d')](function(){_0x57257a['status'](0xcc)[_0x7262('0x29')]();});}};}function handleEntityNotFound(_0xd80aa0,_0x1740ff){return function(_0x3c3fa3){if(!_0x3c3fa3){_0xd80aa0[_0x7262('0x35')](0x194);}return _0x3c3fa3;};}function handleError(_0x437b8c,_0x15b887){_0x15b887=_0x15b887||0x1f4;return function(_0x307789){logger[_0x7262('0x23')](_0x307789['stack']);if(_0x307789[_0x7262('0x36')]){delete _0x307789[_0x7262('0x36')];}_0x437b8c[_0x7262('0x28')](_0x15b887)[_0x7262('0x37')](_0x307789);};}exports['index']=function(_0x269e78,_0x264fa6){var _0x5a38e8={'include':[{'model':db[_0x7262('0x38')],'as':_0x7262('0x39')}]},_0x5e4a45={},_0x7127fd={'count':0x0,'rows':[]};var _0x13c7ad=_[_0x7262('0x3a')](db[_0x7262('0x3b')]['rawAttributes'],function(_0x647a25){return{'name':_0x647a25['fieldName'],'type':_0x647a25['type'][_0x7262('0x3c')]};});_0x5e4a45[_0x7262('0x3d')]=_[_0x7262('0x3a')](_0x13c7ad,_0x7262('0x36'));_0x5e4a45[_0x7262('0x3e')]=_[_0x7262('0x3f')](_0x269e78['query']);_0x5e4a45['filters']=_[_0x7262('0x40')](_0x5e4a45['model'],_0x5e4a45[_0x7262('0x3e')]);_0x5a38e8[_0x7262('0x41')]=_[_0x7262('0x40')](_0x5e4a45[_0x7262('0x3d')],qs['fields'](_0x269e78['query'][_0x7262('0x42')]));_0x5a38e8[_0x7262('0x41')]=_0x5a38e8['attributes']['length']?_0x5a38e8[_0x7262('0x41')]:_0x5e4a45[_0x7262('0x3d')];if(!_0x269e78[_0x7262('0x3e')][_0x7262('0x43')](_0x7262('0x44'))){_0x5a38e8[_0x7262('0x2d')]=qs[_0x7262('0x2d')](_0x269e78[_0x7262('0x3e')][_0x7262('0x2d')]);_0x5a38e8[_0x7262('0x2b')]=qs[_0x7262('0x2b')](_0x269e78[_0x7262('0x3e')][_0x7262('0x2b')]);}_0x5a38e8['order']=qs[_0x7262('0x45')](_0x269e78['query']['sort']);_0x5a38e8[_0x7262('0x46')]=qs[_0x7262('0x47')](_['pick'](_0x269e78[_0x7262('0x3e')],_0x5e4a45[_0x7262('0x47')]),_0x13c7ad);if(_0x269e78[_0x7262('0x3e')]['filter']){_0x5a38e8[_0x7262('0x46')]=_[_0x7262('0x48')](_0x5a38e8[_0x7262('0x46')],{'$or':_[_0x7262('0x3a')](_0x13c7ad,function(_0x45463e){if(_0x45463e[_0x7262('0x49')]!=='VIRTUAL'){var _0x109552={};_0x109552[_0x45463e[_0x7262('0x36')]]={'$like':'%'+_0x269e78[_0x7262('0x3e')]['filter']+'%'};return _0x109552;}})});}_0x5a38e8=_[_0x7262('0x48')]({},_0x5a38e8,_0x269e78['options']);var _0x144464={'where':_0x5a38e8['where']};return db[_0x7262('0x3b')][_0x7262('0x2e')](_0x144464)[_0x7262('0x1d')](function(_0x6e2e9){_0x7127fd[_0x7262('0x2e')]=_0x6e2e9;if(_0x269e78[_0x7262('0x3e')]['includeAll']){_0x5a38e8['include']=[{'all':!![]}];}return db[_0x7262('0x3b')][_0x7262('0x4a')](_0x5a38e8);})[_0x7262('0x1d')](function(_0x79ceba){_0x7127fd['rows']=_0x79ceba;return _0x7127fd;})[_0x7262('0x1d')](respondWithFilteredResult(_0x264fa6,_0x5a38e8))['catch'](handleError(_0x264fa6,null));};exports['show']=function(_0x22b1cf,_0x3f586f){var _0x1c38c6={'raw':![],'where':{'id':_0x22b1cf['params']['id']},'include':[{'model':db[_0x7262('0x38')],'as':_0x7262('0x39')}]},_0x25ffd9={};_0x25ffd9[_0x7262('0x3d')]=_[_0x7262('0x3f')](db[_0x7262('0x3b')][_0x7262('0x4b')]);_0x25ffd9[_0x7262('0x3e')]=_[_0x7262('0x3f')](_0x22b1cf[_0x7262('0x3e')]);_0x25ffd9['filters']=_['intersection'](_0x25ffd9[_0x7262('0x3d')],_0x25ffd9[_0x7262('0x3e')]);_0x1c38c6[_0x7262('0x41')]=_[_0x7262('0x40')](_0x25ffd9[_0x7262('0x3d')],qs[_0x7262('0x42')](_0x22b1cf[_0x7262('0x3e')][_0x7262('0x42')]));_0x1c38c6['attributes']=_0x1c38c6['attributes'][_0x7262('0x4c')]?_0x1c38c6[_0x7262('0x41')]:_0x25ffd9[_0x7262('0x3d')];if(_0x22b1cf[_0x7262('0x3e')][_0x7262('0x4d')]){_0x1c38c6[_0x7262('0x4e')]=[{'all':!![]}];}_0x1c38c6=_[_0x7262('0x48')]({},_0x1c38c6,_0x22b1cf[_0x7262('0x4f')]);return db[_0x7262('0x3b')]['find'](_0x1c38c6)['then'](handleEntityNotFound(_0x3f586f,null))[_0x7262('0x1d')](respondWithResult(_0x3f586f,null))[_0x7262('0x27')](handleError(_0x3f586f,null));};exports[_0x7262('0x50')]=function(_0x5851cd,_0x5809f0){return db[_0x7262('0x3b')][_0x7262('0x50')](_0x5851cd[_0x7262('0x51')],{})[_0x7262('0x1d')](function(_0x5d754b){var _0x31a1c4=_0x5851cd['user'][_0x7262('0x52')]({'plain':!![]});if(!_0x31a1c4)throw new Error(_0x7262('0x53'));if(_0x31a1c4[_0x7262('0x54')]===_0x7262('0x55')){var _0x2e89e2=_0x5d754b[_0x7262('0x52')]({'plain':!![]});var _0x300122=_0x7262('0x33');return db[_0x7262('0x56')][_0x7262('0x57')]({'where':{'name':_0x300122,'userProfileId':_0x31a1c4[_0x7262('0x58')]},'raw':!![]})[_0x7262('0x1d')](function(_0x3a5cee){if(_0x3a5cee&&_0x3a5cee[_0x7262('0x59')]===0x0){return db[_0x7262('0x34')][_0x7262('0x50')]({'name':_0x2e89e2[_0x7262('0x36')],'resourceId':_0x2e89e2['id'],'type':_0x3a5cee[_0x7262('0x36')],'sectionId':_0x3a5cee['id']},{})[_0x7262('0x1d')](function(){return _0x5d754b;});}else{return _0x5d754b;}})[_0x7262('0x27')](function(_0x5bf66b){logger[_0x7262('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf66b);throw _0x5bf66b;});}return _0x5d754b;})[_0x7262('0x1d')](respondWithResult(_0x5809f0,0xc9))[_0x7262('0x27')](handleError(_0x5809f0,null));};exports['update']=function(_0x3f0c2b,_0x441995){if(_0x3f0c2b[_0x7262('0x51')]['id']){delete _0x3f0c2b[_0x7262('0x51')]['id'];}return db[_0x7262('0x3b')]['find']({'where':{'id':_0x3f0c2b[_0x7262('0x5a')]['id']},'include':[{'model':db[_0x7262('0x38')],'as':_0x7262('0x39')}]})[_0x7262('0x1d')](handleEntityNotFound(_0x441995,null))['then'](saveUpdates(_0x3f0c2b[_0x7262('0x51')],null))[_0x7262('0x1d')](respondWithResult(_0x441995,null))[_0x7262('0x27')](handleError(_0x441995,null));};exports[_0x7262('0x32')]=function(_0x21a9ce,_0x19b815){return db[_0x7262('0x3b')][_0x7262('0x57')]({'where':{'id':_0x21a9ce[_0x7262('0x5a')]['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0x19b815,null))[_0x7262('0x1d')](removeEntity(_0x19b815,null))[_0x7262('0x27')](handleError(_0x19b815,null));};exports[_0x7262('0x5b')]=function(_0x289b7a,_0x54635c){return db[_0x7262('0x3b')][_0x7262('0x5b')]()[_0x7262('0x1d')](respondWithResult(_0x54635c,null))['catch'](handleError(_0x54635c,null));};exports[_0x7262('0x5c')]=function(_0x4cdac8,_0x42ba6c,_0x10b25d){if(_0x4cdac8[_0x7262('0x51')]['id']){delete _0x4cdac8['body']['id'];}return db[_0x7262('0x3b')][_0x7262('0x57')]({'where':{'id':_0x4cdac8[_0x7262('0x5a')]['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0x42ba6c,null))[_0x7262('0x1d')](function(_0x3e2a86){if(_0x3e2a86){_0x4cdac8['body'][_0x7262('0x5d')]=_0x3e2a86['id'];return db[_0x7262('0x5e')]['create'](_0x4cdac8[_0x7262('0x51')]);}})[_0x7262('0x1d')](respondWithResult(_0x42ba6c,null))[_0x7262('0x27')](handleError(_0x42ba6c,null));};exports['getDispositions']=function(_0x388c4f,_0xb2e8fb,_0x2ee657){var _0xb912b8={'raw':![],'where':{}};var _0x525eb6={};var _0x333c34={'count':0x0,'rows':[]};return db[_0x7262('0x3b')]['findOne']({'where':{'id':_0x388c4f[_0x7262('0x5a')]['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0xb2e8fb,null))[_0x7262('0x1d')](function(_0x502aec){if(_0x502aec){_0x525eb6['model']=_[_0x7262('0x3f')](db[_0x7262('0x5e')][_0x7262('0x4b')]);_0x525eb6['query']=_[_0x7262('0x3f')](_0x388c4f[_0x7262('0x3e')]);_0x525eb6[_0x7262('0x47')]=_['intersection'](_0x525eb6[_0x7262('0x3d')],_0x525eb6[_0x7262('0x3e')]);_0xb912b8[_0x7262('0x41')]=_[_0x7262('0x40')](_0x525eb6[_0x7262('0x3d')],qs['fields'](_0x388c4f[_0x7262('0x3e')][_0x7262('0x42')]));_0xb912b8['attributes']=_0xb912b8[_0x7262('0x41')][_0x7262('0x4c')]?_0xb912b8[_0x7262('0x41')]:_0x525eb6[_0x7262('0x3d')];if(!_0x388c4f[_0x7262('0x3e')][_0x7262('0x43')](_0x7262('0x44'))){_0xb912b8[_0x7262('0x2d')]=qs[_0x7262('0x2d')](_0x388c4f[_0x7262('0x3e')]['limit']);_0xb912b8[_0x7262('0x2b')]=qs[_0x7262('0x2b')](_0x388c4f[_0x7262('0x3e')]['offset']);}_0xb912b8[_0x7262('0x5f')]=qs[_0x7262('0x45')](_0x388c4f[_0x7262('0x3e')][_0x7262('0x45')]);_0xb912b8['where']=qs[_0x7262('0x47')](_['pick'](_0x388c4f[_0x7262('0x3e')],_0x525eb6[_0x7262('0x47')]));_0xb912b8[_0x7262('0x46')]['WhatsappAccountId']=_0x502aec['id'];if(_0x388c4f[_0x7262('0x3e')]['filter']){_0xb912b8[_0x7262('0x46')]=_[_0x7262('0x48')](_0xb912b8[_0x7262('0x46')],{'$or':_['map'](_0xb912b8[_0x7262('0x41')],function(_0x90bf77){var _0x1038f8={};_0x1038f8[_0x90bf77]={'$like':'%'+_0x388c4f['query'][_0x7262('0x60')]+'%'};return _0x1038f8;})});}_0xb912b8=_[_0x7262('0x48')]({},_0xb912b8,_0x388c4f[_0x7262('0x4f')]);return db['Disposition'][_0x7262('0x2e')]({'where':_0xb912b8[_0x7262('0x46')]})[_0x7262('0x1d')](function(_0x15b521){_0x333c34[_0x7262('0x2e')]=_0x15b521;if(_0x388c4f[_0x7262('0x3e')][_0x7262('0x4d')]){_0xb912b8['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0xb912b8);})[_0x7262('0x1d')](function(_0x4dd0b4){_0x333c34[_0x7262('0x61')]=_0x4dd0b4;return _0x333c34;});}})['then'](respondWithFilteredResult(_0xb2e8fb,_0xb912b8))[_0x7262('0x27')](handleError(_0xb2e8fb,null));};exports[_0x7262('0x62')]=function(_0x1ae02c,_0x49b489,_0x36b7f6){return db[_0x7262('0x3b')][_0x7262('0x57')]({'where':{'id':_0x1ae02c[_0x7262('0x5a')]['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0x49b489,null))[_0x7262('0x1d')](function(_0x5e05f0){if(_0x5e05f0){return _0x5e05f0[_0x7262('0x62')](_0x1ae02c[_0x7262('0x3e')][_0x7262('0x63')]);}})['then'](respondWithStatusCode(_0x49b489,null))['catch'](handleError(_0x49b489,null));};exports[_0x7262('0x64')]=function(_0x484b93,_0x5d58e8,_0x52f264){if(_0x484b93[_0x7262('0x51')]['id']){delete _0x484b93[_0x7262('0x51')]['id'];}return db['WhatsappAccount'][_0x7262('0x57')]({'where':{'id':_0x484b93[_0x7262('0x5a')]['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0x5d58e8,null))[_0x7262('0x1d')](function(_0xd18528){if(_0xd18528){_0x484b93['body'][_0x7262('0x5d')]=_0xd18528['id'];return db[_0x7262('0x65')][_0x7262('0x50')](_0x484b93['body']);}})[_0x7262('0x1d')](respondWithResult(_0x5d58e8,null))[_0x7262('0x27')](handleError(_0x5d58e8,null));};exports['getAnswers']=function(_0x563770,_0x4bf3c2,_0x383305){var _0x59b181={'raw':![],'where':{}};var _0xb60799={};var _0x3246c6={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x7262('0x66')]({'where':{'id':_0x563770['params']['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0x4bf3c2,null))[_0x7262('0x1d')](function(_0x51fb4a){if(_0x51fb4a){_0xb60799[_0x7262('0x3d')]=_[_0x7262('0x3f')](db[_0x7262('0x65')][_0x7262('0x4b')]);_0xb60799[_0x7262('0x3e')]=_[_0x7262('0x3f')](_0x563770[_0x7262('0x3e')]);_0xb60799[_0x7262('0x47')]=_[_0x7262('0x40')](_0xb60799[_0x7262('0x3d')],_0xb60799[_0x7262('0x3e')]);_0x59b181['attributes']=_[_0x7262('0x40')](_0xb60799[_0x7262('0x3d')],qs[_0x7262('0x42')](_0x563770[_0x7262('0x3e')]['fields']));_0x59b181[_0x7262('0x41')]=_0x59b181['attributes'][_0x7262('0x4c')]?_0x59b181[_0x7262('0x41')]:_0xb60799[_0x7262('0x3d')];if(!_0x563770['query'][_0x7262('0x43')]('nolimit')){_0x59b181[_0x7262('0x2d')]=qs[_0x7262('0x2d')](_0x563770[_0x7262('0x3e')][_0x7262('0x2d')]);_0x59b181[_0x7262('0x2b')]=qs['offset'](_0x563770[_0x7262('0x3e')]['offset']);}_0x59b181['order']=qs['sort'](_0x563770[_0x7262('0x3e')][_0x7262('0x45')]);_0x59b181[_0x7262('0x46')]=qs[_0x7262('0x47')](_[_0x7262('0x67')](_0x563770[_0x7262('0x3e')],_0xb60799[_0x7262('0x47')]));_0x59b181[_0x7262('0x46')]['WhatsappAccountId']=_0x51fb4a['id'];if(_0x563770[_0x7262('0x3e')][_0x7262('0x60')]){_0x59b181[_0x7262('0x46')]=_['merge'](_0x59b181['where'],{'$or':_[_0x7262('0x3a')](_0x59b181[_0x7262('0x41')],function(_0x548b90){var _0xf038b1={};_0xf038b1[_0x548b90]={'$like':'%'+_0x563770[_0x7262('0x3e')][_0x7262('0x60')]+'%'};return _0xf038b1;})});}_0x59b181=_[_0x7262('0x48')]({},_0x59b181,_0x563770['options']);return db[_0x7262('0x65')][_0x7262('0x2e')]({'where':_0x59b181[_0x7262('0x46')]})[_0x7262('0x1d')](function(_0x90fb5e){_0x3246c6['count']=_0x90fb5e;if(_0x563770['query'][_0x7262('0x4d')]){_0x59b181[_0x7262('0x4e')]=[{'all':!![]}];}return db[_0x7262('0x65')][_0x7262('0x4a')](_0x59b181);})[_0x7262('0x1d')](function(_0x48274d){_0x3246c6['rows']=_0x48274d;return _0x3246c6;});}})[_0x7262('0x1d')](respondWithFilteredResult(_0x4bf3c2,_0x59b181))[_0x7262('0x27')](handleError(_0x4bf3c2,null));};exports[_0x7262('0x68')]=function(_0x4f7d42,_0x5ba8a,_0x1a2029){return db[_0x7262('0x3b')][_0x7262('0x57')]({'where':{'id':_0x4f7d42[_0x7262('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5ba8a,null))[_0x7262('0x1d')](function(_0x53761e){if(_0x53761e){return _0x53761e[_0x7262('0x68')](_0x4f7d42[_0x7262('0x3e')]['ids']);}})[_0x7262('0x1d')](respondWithStatusCode(_0x5ba8a,null))[_0x7262('0x27')](handleError(_0x5ba8a,null));};exports[_0x7262('0x69')]=function(_0xdd1ffd,_0x38370a,_0x22c340){return db['WhatsappAccount'][_0x7262('0x57')]({'where':{'id':_0xdd1ffd[_0x7262('0x5a')]['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0x38370a,null))[_0x7262('0x1d')](function(_0xeae242){if(_0xeae242){return _0xeae242['addAgents'](_0xdd1ffd[_0x7262('0x51')][_0x7262('0x63')],_['omit'](_0xdd1ffd[_0x7262('0x51')],[_0x7262('0x63'),'id'])||{})['spread'](function(_0x1445a8){for(var _0x3579cd=0x0;_0x3579cd<_0xdd1ffd['body'][_0x7262('0x63')][_0x7262('0x4c')];_0x3579cd+=0x1){socket[_0x7262('0x6a')]('userWhatsappAccount:save',{'UserId':Number(_0xdd1ffd[_0x7262('0x51')][_0x7262('0x63')][_0x3579cd]),'WhatsappAccountId':Number(_0xdd1ffd[_0x7262('0x5a')]['id'])});}return _0x1445a8;});}})['then'](respondWithResult(_0x38370a,null))[_0x7262('0x27')](handleError(_0x38370a,null));};exports[_0x7262('0x6b')]=function(_0x5f1b45,_0x3b06f1,_0x2f08a0){return db[_0x7262('0x3b')][_0x7262('0x57')]({'where':{'id':_0x5f1b45[_0x7262('0x5a')]['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0x3b06f1,null))[_0x7262('0x1d')](function(_0x4a7998){if(_0x4a7998){return _0x4a7998[_0x7262('0x6b')](_0x5f1b45[_0x7262('0x3e')][_0x7262('0x63')])[_0x7262('0x1d')](function(){if(_[_0x7262('0x6c')](_0x5f1b45[_0x7262('0x3e')][_0x7262('0x63')])){for(var _0x20fd9=0x0;_0x20fd9<_0x5f1b45[_0x7262('0x3e')][_0x7262('0x63')]['length'];_0x20fd9+=0x1){socket[_0x7262('0x6a')](_0x7262('0x6d'),{'UserId':Number(_0x5f1b45[_0x7262('0x3e')]['ids'][_0x20fd9]),'WhatsappAccountId':Number(_0x5f1b45[_0x7262('0x5a')]['id'])});}}else{socket[_0x7262('0x6a')](_0x7262('0x6d'),{'UserId':Number(_0x5f1b45['query'][_0x7262('0x63')]),'WhatsappAccountId':Number(_0x5f1b45[_0x7262('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b06f1,null))[_0x7262('0x27')](handleError(_0x3b06f1,null));};exports[_0x7262('0x6e')]=function(_0x22e667,_0x285218,_0x3547c6){var _0x59e3e1={};var _0x127db4={};var _0x11f0a5;var _0x38b403;return db['WhatsappAccount'][_0x7262('0x66')]({'where':{'id':_0x22e667[_0x7262('0x5a')]['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0x285218,null))[_0x7262('0x1d')](function(_0x4ffc7d){if(_0x4ffc7d){_0x11f0a5=_0x4ffc7d;_0x127db4['model']=_[_0x7262('0x3f')](db[_0x7262('0x6f')][_0x7262('0x4b')]);_0x127db4['query']=_['keys'](_0x22e667['query']);_0x127db4['filters']=_[_0x7262('0x40')](_0x127db4['model'],_0x127db4[_0x7262('0x3e')]);_0x59e3e1['attributes']=_[_0x7262('0x40')](_0x127db4[_0x7262('0x3d')],qs[_0x7262('0x42')](_0x22e667[_0x7262('0x3e')][_0x7262('0x42')]));_0x59e3e1[_0x7262('0x41')]=_0x59e3e1[_0x7262('0x41')]['length']?_0x59e3e1[_0x7262('0x41')]:_0x127db4[_0x7262('0x3d')];_0x59e3e1[_0x7262('0x5f')]=qs[_0x7262('0x45')](_0x22e667[_0x7262('0x3e')][_0x7262('0x45')]);_0x59e3e1[_0x7262('0x46')]=qs[_0x7262('0x47')](_[_0x7262('0x67')](_0x22e667[_0x7262('0x3e')],_0x127db4['filters']));if(_0x22e667[_0x7262('0x3e')][_0x7262('0x60')]){_0x59e3e1[_0x7262('0x46')]=_[_0x7262('0x48')](_0x59e3e1[_0x7262('0x46')],{'$or':_[_0x7262('0x3a')](_0x59e3e1[_0x7262('0x41')],function(_0x541717){var _0x6bd108={};_0x6bd108[_0x541717]={'$like':'%'+_0x22e667[_0x7262('0x3e')][_0x7262('0x60')]+'%'};return _0x6bd108;})});}_0x59e3e1=_[_0x7262('0x48')]({},_0x59e3e1,_0x22e667[_0x7262('0x4f')]);return _0x11f0a5[_0x7262('0x6e')](_0x59e3e1);}})[_0x7262('0x1d')](function(_0x1e9db6){if(_0x1e9db6){_0x38b403=_0x1e9db6[_0x7262('0x4c')];if(!_0x22e667[_0x7262('0x3e')][_0x7262('0x43')](_0x7262('0x44'))){_0x59e3e1[_0x7262('0x2d')]=qs[_0x7262('0x2d')](_0x22e667[_0x7262('0x3e')][_0x7262('0x2d')]);_0x59e3e1['offset']=qs[_0x7262('0x2b')](_0x22e667[_0x7262('0x3e')][_0x7262('0x2b')]);}return _0x11f0a5[_0x7262('0x6e')](_0x59e3e1);}})[_0x7262('0x1d')](function(_0x1e7c01){if(_0x1e7c01){return _0x1e7c01?{'count':_0x38b403,'rows':_0x1e7c01}:null;}})[_0x7262('0x1d')](respondWithResult(_0x285218,null))['catch'](handleError(_0x285218,null));};exports[_0x7262('0x70')]=function(_0x2fd8f5,_0x167d1f,_0x5d4ded){return db['WhatsappAccount'][_0x7262('0x66')]({'where':{'id':_0x2fd8f5[_0x7262('0x5a')]['id']}})[_0x7262('0x1d')](handleEntityNotFound(_0x167d1f,null))[_0x7262('0x1d')](function(_0x470103){if(_0x470103){return db[_0x7262('0x71')]['transaction'](function(_0x231753){return db[_0x7262('0x72')][_0x7262('0x32')]({'where':{'WhatsappAccountId':_0x2fd8f5[_0x7262('0x5a')]['id']},'transaction':_0x231753})['then'](function(_0x2f56df){var _0x30f1b7=_[_0x7262('0x3a')](_0x2fd8f5[_0x7262('0x51')],function(_0x788996){_0x788996[_0x7262('0x5d')]=_0x2fd8f5['params']['id'];return _0x788996;});return db[_0x7262('0x72')][_0x7262('0x73')](_0x30f1b7,{'transaction':_0x231753});});})[_0x7262('0x1d')](function(){return db['WhatsappApplication'][_0x7262('0x74')]({'where':{'WhatsappAccountId':_0x2fd8f5[_0x7262('0x5a')]['id']},'order':_0x7262('0x75')});});}})[_0x7262('0x1d')](respondWithResult(_0x167d1f,null))[_0x7262('0x27')](handleError(_0x167d1f,null));};exports[_0x7262('0x76')]=function(_0x20c2b7,_0x1e0f23,_0xfea6d2){var _0x1fbaf6={};var _0x1c2cc0={};var _0x2b77a3;var _0x362643;return db['WhatsappAccount']['findOne']({'where':{'id':_0x20c2b7[_0x7262('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1e0f23,null))[_0x7262('0x1d')](function(_0x125ae7){if(_0x125ae7){_0x2b77a3=_0x125ae7;_0x1c2cc0[_0x7262('0x3d')]=_[_0x7262('0x3f')](db['WhatsappApplication'][_0x7262('0x4b')]);_0x1c2cc0[_0x7262('0x3e')]=_[_0x7262('0x3f')](_0x20c2b7[_0x7262('0x3e')]);_0x1c2cc0[_0x7262('0x47')]=_[_0x7262('0x40')](_0x1c2cc0[_0x7262('0x3d')],_0x1c2cc0[_0x7262('0x3e')]);_0x1fbaf6[_0x7262('0x41')]=_[_0x7262('0x40')](_0x1c2cc0[_0x7262('0x3d')],qs[_0x7262('0x42')](_0x20c2b7[_0x7262('0x3e')][_0x7262('0x42')]));_0x1fbaf6[_0x7262('0x41')]=_0x1fbaf6[_0x7262('0x41')][_0x7262('0x4c')]?_0x1fbaf6[_0x7262('0x41')]:_0x1c2cc0[_0x7262('0x3d')];_0x1fbaf6[_0x7262('0x5f')]=qs[_0x7262('0x45')](_0x20c2b7[_0x7262('0x3e')][_0x7262('0x45')]);_0x1fbaf6[_0x7262('0x46')]=qs['filters'](_[_0x7262('0x67')](_0x20c2b7[_0x7262('0x3e')],_0x1c2cc0['filters']));if(_0x20c2b7[_0x7262('0x3e')][_0x7262('0x60')]){_0x1fbaf6[_0x7262('0x46')]=_[_0x7262('0x48')](_0x1fbaf6[_0x7262('0x46')],{'$or':_[_0x7262('0x3a')](_0x1fbaf6[_0x7262('0x41')],function(_0x1ebb39){var _0x7927e8={};_0x7927e8[_0x1ebb39]={'$like':'%'+_0x20c2b7[_0x7262('0x3e')][_0x7262('0x60')]+'%'};return _0x7927e8;})});}_0x1fbaf6=_['merge']({},_0x1fbaf6,_0x20c2b7[_0x7262('0x4f')]);return _0x2b77a3[_0x7262('0x76')](_0x1fbaf6);}})[_0x7262('0x1d')](function(_0x22f501){if(_0x22f501){_0x362643=_0x22f501[_0x7262('0x4c')];if(!_0x20c2b7[_0x7262('0x3e')][_0x7262('0x43')](_0x7262('0x44'))){_0x1fbaf6[_0x7262('0x2d')]=qs['limit'](_0x20c2b7[_0x7262('0x3e')][_0x7262('0x2d')]);_0x1fbaf6[_0x7262('0x2b')]=qs[_0x7262('0x2b')](_0x20c2b7[_0x7262('0x3e')]['offset']);}return _0x2b77a3[_0x7262('0x76')](_0x1fbaf6);}})[_0x7262('0x1d')](function(_0x21628a){if(_0x21628a){return _0x21628a?{'count':_0x362643,'rows':_0x21628a}:null;}})[_0x7262('0x1d')](respondWithResult(_0x1e0f23,null))[_0x7262('0x27')](handleError(_0x1e0f23,null));};exports[_0x7262('0x77')]=function(_0x46e669,_0x86d059,_0x406440){var _0x3dd725={'channel':_0x7262('0x78')};var _0x545d43=[];var _0xf1fd47=[];var _0x4dcfed={};return db[_0x7262('0x3b')][_0x7262('0x57')]({'where':{'id':_0x46e669[_0x7262('0x5a')]['id']},'include':[{'model':db[_0x7262('0x72')],'as':_0x7262('0x79')}]})[_0x7262('0x1d')](handleEntityNotFound(_0x86d059,null))[_0x7262('0x1d')](function(_0x466ba1){_0x3dd725[_0x7262('0x7a')]=_0x466ba1;_0x3dd725[_0x7262('0x7b')]=_[_0x7262('0x7c')](_0x466ba1['Applications'],['priority'],[_0x7262('0x7d')]);if(_0x3dd725[_0x7262('0x7a')]['Applications']){delete _0x3dd725[_0x7262('0x7a')][_0x7262('0x79')];}return db[_0x7262('0x7e')][_0x7262('0x5b')]();})['then'](function(_0x397d32){if(!_0x397d32){throw new db[(_0x7262('0x7f'))]['ValidationError']('no\x20available\x20attributes');}_0x545d43=_[_0x7262('0x80')](_[_0x7262('0x3f')](_0x397d32),[_0x7262('0x81'),_0x7262('0x82')]);_0xf1fd47=_[_0x7262('0x80')](_[_0x7262('0x3f')](_0x397d32),[_0x7262('0x81'),_0x7262('0x82'),_0x7262('0x83'),_0x7262('0x84')]);_0x3dd725[_0x7262('0x51')]={'mapKey':_0x7262('0x85')};if(_0x3dd725[_0x7262('0x7a')][_0x7262('0x49')]&&_0x3dd725[_0x7262('0x7a')][_0x7262('0x49')]===_0x7262('0x86')){_0x3dd725['body'][_0x7262('0x87')]=_0x46e669[_0x7262('0x51')][_0x7262('0x88')][_0x7262('0x89')](_0x7262('0x8a'),'');_0x3dd725[_0x7262('0x51')][_0x7262('0x51')]=_0x46e669[_0x7262('0x51')]['Body'];_0x3dd725[_0x7262('0x51')][_0x7262('0x8b')]=_0x46e669[_0x7262('0x51')][_0x7262('0x8c')];}if(_0x3dd725[_0x7262('0x51')]['id']){delete _0x3dd725[_0x7262('0x51')]['id'];}if(_[_0x7262('0x8d')](_0x3dd725['body'][_0x7262('0x87')])){throw new db['Sequelize'][(_0x7262('0x8e'))](_0x7262('0x8f'));}if(_[_0x7262('0x8d')](_0x3dd725['body'][_0x7262('0x51')])||_0x3dd725['body'][_0x7262('0x51')]===''){throw new db[(_0x7262('0x7f'))][(_0x7262('0x8e'))](_0x7262('0x90'));}if(_[_0x7262('0x8d')](_0x3dd725[_0x7262('0x51')]['mapKey'])){throw new db[(_0x7262('0x7f'))]['ValidationError'](_0x7262('0x91')+_0xf1fd47);}if(!_[_0x7262('0x92')](_0xf1fd47,_0x3dd725['body'][_0x7262('0x93')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf1fd47);}_0x4dcfed[_0x3dd725[_0x7262('0x51')][_0x7262('0x93')]]=_0x3dd725[_0x7262('0x51')][_0x7262('0x87')];return db[_0x7262('0x94')][_0x7262('0x57')]({'where':{'id':_0x3dd725['account'][_0x7262('0x84')]},'include':[{'model':db['CmContact'],'as':_0x7262('0x95'),'where':_0x4dcfed,'limit':0x1,'order':[[_0x7262('0x82'),'DESC']]}]});})['then'](handleEntityNotFound(_0x86d059,null))[_0x7262('0x1d')](function(_0xb5d8a8){if(_0xb5d8a8){_0x3dd725['list']=_['omit'](_0xb5d8a8,[_0x7262('0x95')]);if(_0xb5d8a8[_0x7262('0x95')]['length']){return _0xb5d8a8[_0x7262('0x95')][0x0];}var _0x5347cc=_[_0x7262('0x16')](_0x3dd725['body'],{'firstName':_0x3dd725[_0x7262('0x51')][_0x7262('0x87')],'ListId':_0xb5d8a8['id']});_0x5347cc[_0x3dd725[_0x7262('0x51')][_0x7262('0x93')]]=_0x3dd725['body'][_0x7262('0x87')];return db[_0x7262('0x7e')][_0x7262('0x50')](_0x5347cc,{'fields':_0x545d43,'raw':!![]});}})[_0x7262('0x1d')](handleEntityNotFound(_0x86d059,null))[_0x7262('0x1d')](function(_0x3255a5){if(_0x3255a5){_0x3dd725['contact']=_0x3255a5;var _0x520d7a={'ContactId':_0x3255a5['id'],'phone':_0x3dd725[_0x7262('0x51')][_0x7262('0x87')],'WhatsappAccountId':_0x46e669[_0x7262('0x5a')]['id']};var _0x4de618={'ContactId':_0x3255a5['id'],'WhatsappAccountId':_0x46e669[_0x7262('0x5a')]['id'],'closed':![]};return db[_0x7262('0x96')][_0x7262('0x57')]({'where':_0x4de618})[_0x7262('0x1d')](function(_0x55146e){if(_0x55146e){return[_0x55146e,![]];}return db[_0x7262('0x96')][_0x7262('0x50')](_0x520d7a)[_0x7262('0x1d')](function(_0x260715){return[_0x260715,!![]];});});}})[_0x7262('0x97')](function(_0x46d090,_0xb8b195){_0x3dd725[_0x7262('0x98')]=_0x46d090['get']({'plain':!![]});_0x3dd725[_0x7262('0x98')]['created']=![];if(_0xb8b195){if(_0x3dd725['account'][_0x7262('0x99')]){_0x3dd725[_0x7262('0x7b')]['push']({'id':0x0,'priority':_0x3dd725[_0x7262('0x7b')][_0x7262('0x4c')]+0x1,'app':'close','appdata':_0x7262('0x9a'),'interval':'*,*,*,*'});}_0x3dd725[_0x7262('0x98')][_0x7262('0x9b')]=!![];}return db[_0x7262('0x9c')]['create']({'phone':_0x3dd725['body'][_0x7262('0x87')],'messageId':_0x3dd725[_0x7262('0x51')][_0x7262('0x8b')],'body':_0x3dd725[_0x7262('0x51')][_0x7262('0x51')],'WhatsappAccountId':_0x46e669[_0x7262('0x5a')]['id'],'WhatsappInteractionId':_0x46d090['id'],'direction':'in','ContactId':_0x46d090[_0x7262('0x9d')],'AttachmentId':_0x3dd725[_0x7262('0x51')][_0x7262('0x9e')]});})['then'](function(_0x47463e){_0x3dd725['message']=_0x47463e;if(_0x3dd725[_0x7262('0x98')][_0x7262('0x9f')]){return db[_0x7262('0x6f')][_0x7262('0x57')]({'attributes':['id',_0x7262('0x36')],'where':{'id':_0x3dd725['interaction']['UserId']}})[_0x7262('0x1d')](function(_0x1e692c){if(_0x1e692c){_0x3dd725[_0x7262('0x7b')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1e692c[_0x7262('0x36')]+','+(_0x3dd725[_0x7262('0x7a')]['waitForTheAssignedAgent']||0xa),'interval':_0x7262('0xa0')});}return respondWithRpcPromise(_0x7262('0xa1'),_0x7262('0xa2'),_0x3dd725);});}return respondWithRpcPromise(_0x7262('0xa1'),'startRouting',_0x3dd725);})[_0x7262('0x1d')](function(_0x44fae7){if(_0x44fae7){var _0x253f05=0xc8;var _0x4bbefe=_0x7262('0xa3');logger[_0x7262('0x1e')](_0x7262('0xa4'),_0x4bbefe,_0x253f05,'entity\x20found');logger['debug'](_0x7262('0xa5'),_0x4bbefe,_0x253f05,_0x7262('0xa6'),JSON[_0x7262('0x22')](_0x44fae7));if(_0x3dd725['account']['type']===_0x7262('0x86')){return _0x86d059[_0x7262('0x28')](_0x253f05)['set'](_0x7262('0xa7'),_0x7262('0xa8'))[_0x7262('0x37')](_0x7262('0xa9'));}else{return _0x86d059[_0x7262('0x28')](_0x253f05)['json'](_0x44fae7);}}})[_0x7262('0x27')](handleError(_0x86d059,null));};exports[_0x7262('0x37')]=function(_0x4b4fc1,_0x576fe7,_0x2115bf){var _0x403227,_0x2d79b2,_0x2415cc;if(_[_0x7262('0x8d')](_0x4b4fc1['body'][_0x7262('0x51')])||_0x4b4fc1[_0x7262('0x51')][_0x7262('0x51')]===''){throw new db[(_0x7262('0x7f'))][(_0x7262('0x8e'))](_0x7262('0x90'));}if(_[_0x7262('0x8d')](_0x4b4fc1[_0x7262('0x51')]['to'])){throw new db['Sequelize']['ValidationError']('to\x20is\x20mandatory');}_0x403227=_0x4b4fc1['body']['to'];return db[_0x7262('0x3b')]['find']({'where':{'id':_0x4b4fc1[_0x7262('0x5a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x7262('0x95'),'where':{'mobile':_0x403227},'limit':0x1,'order':[[_0x7262('0x82'),_0x7262('0xaa')]]}]}]})[_0x7262('0x1d')](handleEntityNotFound(_0x576fe7,null))[_0x7262('0x1d')](function(_0x3dec89){if(_0x3dec89&&_0x3dec89[_0x7262('0xab')]){_0x2d79b2=_0x3dec89[_0x7262('0x52')]({'plain':!![]});if(_0x2d79b2['List']&&_0x2d79b2[_0x7262('0xab')][_0x7262('0x95')][_0x7262('0x4c')]){return _0x2d79b2[_0x7262('0xab')][_0x7262('0x95')][0x0];}return db[_0x7262('0x7e')][_0x7262('0x50')](_[_0x7262('0x16')](_0x4b4fc1[_0x7262('0x51')],{'firstName':_0x403227,'mobile':_0x403227,'phone':_0x403227,'ListId':_0x2d79b2[_0x7262('0x84')]}));}})['then'](handleEntityNotFound(_0x576fe7,null))[_0x7262('0x1d')](function(_0x3e0624){if(_0x3e0624){_0x2415cc=_0x3e0624;return db[_0x7262('0x96')][_0x7262('0x57')]({'where':{'ContactId':_0x2415cc['id'],'closed':![],'WhatsappAccountId':_0x2d79b2['id']}})[_0x7262('0x1d')](function(_0x501c87){if(_0x501c87){return[_0x501c87,![]];}return db['WhatsappInteraction'][_0x7262('0x50')]({'UserId':_0x4b4fc1[_0x7262('0x55')]['id'],'ContactId':_0x2415cc['id'],'WhatsappAccountId':_0x2d79b2['id'],'phone':_0x403227,'firstMsgDirection':'out','Messages':[_[_0x7262('0x48')](_0x4b4fc1['body'],{'read':![],'body':_0x4b4fc1[_0x7262('0x51')][_0x7262('0x51')],'phone':_0x403227,'WhatsappAccountId':_0x2d79b2['id'],'UserId':_0x4b4fc1[_0x7262('0x55')]['id'],'ContactId':_0x2415cc['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x7262('0xac')}]})[_0x7262('0x1d')](function(_0x56a223){return[_0x56a223,!![]];});});}})[_0x7262('0x97')](function(_0x202846,_0x1a3a16){if(_0x1a3a16){return _0x202846;}return db[_0x7262('0x9c')][_0x7262('0x50')](_[_0x7262('0x48')](_0x4b4fc1[_0x7262('0x51')],{'read':![],'body':_0x4b4fc1[_0x7262('0x51')][_0x7262('0x51')],'phone':_0x403227,'WhatsappAccountId':_0x2d79b2['id'],'WhatsappInteractionId':_0x202846['id'],'UserId':_0x4b4fc1[_0x7262('0x55')]['id'],'ContactId':_0x2415cc['id']}))['then'](function(_0x2f54dc){_0x202846[_0x7262('0xad')][_0x7262('0xac')]=[];_0x202846['dataValues'][_0x7262('0xac')][_0x7262('0xae')](_0x2f54dc['dataValues']);return _0x202846;});})['then'](respondWithResult(_0x576fe7,null))[_0x7262('0x27')](handleError(_0x576fe7,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f74c0d7..e1ffb9c 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 _0xcb3e=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5a2557,_0x27f14a){var _0x52fd6a=function(_0xe15222){while(--_0xe15222){_0x5a2557['push'](_0x5a2557['shift']());}};_0x52fd6a(++_0x27f14a);}(_0xcb3e,0x12f));var _0xecb3=function(_0x5c3a22,_0xf9eb07){_0x5c3a22=_0x5c3a22-0x0;var _0x2e8fb8=_0xcb3e[_0x5c3a22];return _0x2e8fb8;};'use strict';var EventEmitter=require(_0xecb3('0x0'));var WhatsappAccount=require(_0xecb3('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xecb3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xecb3('0x3'),'afterDestroy':_0xecb3('0x4')};function emitEvent(_0x51de32){return function(_0x4cf2ff,_0x577c45,_0x89a4d8){WhatsappAccountEvents[_0xecb3('0x5')](_0x51de32+':'+_0x4cf2ff['id'],_0x4cf2ff);WhatsappAccountEvents[_0xecb3('0x5')](_0x51de32,_0x4cf2ff);_0x89a4d8(null);};}for(var e in events){if(events[_0xecb3('0x6')](e)){var event=events[e];WhatsappAccount[_0xecb3('0x7')](e,emitEvent(event));}}module[_0xecb3('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x22b2=['WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x22b2,0x94));var _0x222b=function(_0x5650a9,_0x5f2025){_0x5650a9=_0x5650a9-0x0;var _0x5b441a=_0x22b2[_0x5650a9];return _0x5b441a;};'use strict';var EventEmitter=require(_0x222b('0x0'));var WhatsappAccount=require(_0x222b('0x1'))['db'][_0x222b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x222b('0x3')](0x0);var events={'afterCreate':_0x222b('0x4'),'afterUpdate':_0x222b('0x5'),'afterDestroy':_0x222b('0x6')};function emitEvent(_0xa1b278){return function(_0x218686,_0x594dbb,_0x4145bb){WhatsappAccountEvents[_0x222b('0x7')](_0xa1b278+':'+_0x218686['id'],_0x218686);WhatsappAccountEvents['emit'](_0xa1b278,_0x218686);_0x4145bb(null);};}for(var e in events){if(events[_0x222b('0x8')](e)){var event=events[e];WhatsappAccount[_0x222b('0x9')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 74c1f75..19c8fad 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 _0xa964=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x279262,_0x3af2bc){var _0x136529=function(_0x3ea782){while(--_0x3ea782){_0x279262['push'](_0x279262['shift']());}};_0x136529(++_0x3af2bc);}(_0xa964,0xcf));var _0x4a96=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0xa964[_0x24392f];return _0x591e33;};'use strict';var _=require(_0x4a96('0x0'));var util=require(_0x4a96('0x1'));var logger=require(_0x4a96('0x2'))(_0x4a96('0x3'));var moment=require(_0x4a96('0x4'));var BPromise=require(_0x4a96('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a96('0x6'));var config=require(_0x4a96('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x4a96('0x8')]=function(_0x434080,_0x16230f){return _0x434080['define'](_0x4a96('0x9'),attributes,{'tableName':_0x4a96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x115b=['define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x115b,0x1bb));var _0xb115=function(_0x551e6e,_0xdd9f6d){_0x551e6e=_0x551e6e-0x0;var _0x5e06a7=_0x115b[_0x551e6e];return _0x5e06a7;};'use strict';var _=require(_0xb115('0x0'));var util=require(_0xb115('0x1'));var logger=require(_0xb115('0x2'))('api');var moment=require(_0xb115('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb115('0x4'));var config=require(_0xb115('0x5'));var attributes=require(_0xb115('0x6'));module[_0xb115('0x7')]=function(_0x195f68,_0x4864e8){return _0x195f68[_0xb115('0x8')](_0xb115('0x9'),attributes,{'tableName':_0xb115('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 a4bf5e2..278dcb7 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 _0x4d7c=['../../config/environment','jayson/promise','http','redis','defaults','register','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','options','raw','where','include','map','model','attributes','then','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x13e211,_0x9b584e){var _0xd1357e=function(_0x6c0092){while(--_0x6c0092){_0x13e211['push'](_0x13e211['shift']());}};_0xd1357e(++_0x9b584e);}(_0x4d7c,0xc5));var _0xc4d7=function(_0xa2af66,_0x13bfa8){_0xa2af66=_0xa2af66-0x0;var _0x1dbd74=_0x4d7c[_0xa2af66];return _0x1dbd74;};'use strict';var _=require(_0xc4d7('0x0'));var util=require('util');var moment=require(_0xc4d7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4d7('0x2'));var db=require(_0xc4d7('0x3'))['db'];var utils=require(_0xc4d7('0x4'));var logger=require(_0xc4d7('0x5'))(_0xc4d7('0x6'));var config=require(_0xc4d7('0x7'));var jayson=require(_0xc4d7('0x8'));var client=jayson['client'][_0xc4d7('0x9')]({'port':0x232a});config[_0xc4d7('0xa')]=_[_0xc4d7('0xb')](config[_0xc4d7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4d7('0xa')]));require('./whatsappAccount.socket')[_0xc4d7('0xc')](socket);function respondWithRpcPromise(_0x516746,_0x29e159,_0x40fb30){return new BPromise(function(_0x27c897,_0xeda1c7){return client[_0xc4d7('0xd')](_0x516746,_0x40fb30)['then'](function(_0x2bd91e){logger['info'](_0xc4d7('0xe'),_0x29e159,_0xc4d7('0xf'));logger[_0xc4d7('0x10')](_0xc4d7('0x11'),_0x29e159,_0xc4d7('0xf'),JSON[_0xc4d7('0x12')](_0x2bd91e));if(_0x2bd91e[_0xc4d7('0x13')]){if(_0x2bd91e[_0xc4d7('0x13')][_0xc4d7('0x14')]===0x1f4){logger[_0xc4d7('0x13')](_0xc4d7('0xe'),_0x29e159,_0x2bd91e[_0xc4d7('0x13')][_0xc4d7('0x15')]);return _0xeda1c7(_0x2bd91e[_0xc4d7('0x13')][_0xc4d7('0x15')]);}logger[_0xc4d7('0x13')](_0xc4d7('0xe'),_0x29e159,_0x2bd91e[_0xc4d7('0x13')]['message']);return _0x27c897(_0x2bd91e[_0xc4d7('0x13')][_0xc4d7('0x15')]);}else{logger[_0xc4d7('0x16')](_0xc4d7('0xe'),_0x29e159,'request\x20sent');_0x27c897(_0x2bd91e[_0xc4d7('0x17')][_0xc4d7('0x15')]);}})[_0xc4d7('0x18')](function(_0x3c5a3b){logger['error'](_0xc4d7('0xe'),_0x29e159,_0x3c5a3b);_0xeda1c7(_0x3c5a3b);});});}exports[_0xc4d7('0x19')]=function(_0x47c651){var _0x45af43=this;return new Promise(function(_0x5a7720,_0x470847){return db['WhatsappAccount']['find']({'raw':_0x47c651[_0xc4d7('0x1a')]?_0x47c651[_0xc4d7('0x1a')][_0xc4d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x47c651[_0xc4d7('0x1a')]?_0x47c651['options'][_0xc4d7('0x1c')]||null:null,'attributes':_0x47c651[_0xc4d7('0x1a')]?_0x47c651[_0xc4d7('0x1a')]['attributes']||null:null,'include':_0x47c651[_0xc4d7('0x1a')]?_0x47c651[_0xc4d7('0x1a')][_0xc4d7('0x1d')]?_[_0xc4d7('0x1e')](_0x47c651[_0xc4d7('0x1a')][_0xc4d7('0x1d')],function(_0x1a497c){return{'model':db[_0x1a497c[_0xc4d7('0x1f')]],'as':_0x1a497c['as'],'attributes':_0x1a497c[_0xc4d7('0x20')],'include':_0x1a497c[_0xc4d7('0x1d')]?_[_0xc4d7('0x1e')](_0x1a497c[_0xc4d7('0x1d')],function(_0x8358f){return{'model':db[_0x8358f[_0xc4d7('0x1f')]],'as':_0x8358f['as'],'attributes':_0x8358f[_0xc4d7('0x20')],'include':_0x8358f['include']?_[_0xc4d7('0x1e')](_0x8358f[_0xc4d7('0x1d')],function(_0x2650d4){return{'model':db[_0x2650d4[_0xc4d7('0x1f')]],'as':_0x2650d4['as'],'attributes':_0x2650d4[_0xc4d7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc4d7('0x21')](function(_0x38b7b6){logger['info'](_0xc4d7('0x19'),_0x47c651);logger[_0xc4d7('0x10')](_0xc4d7('0x19'),_0x47c651,JSON[_0xc4d7('0x12')](_0x38b7b6));_0x5a7720(_0x38b7b6);})['catch'](function(_0x252afb){logger['error']('ShowWhatsappAccount',_0x252afb[_0xc4d7('0x15')],_0x47c651);_0x470847(_0x45af43[_0xc4d7('0x13')](0x1f4,_0x252afb['message']));});});}; \ No newline at end of file +var _0x8a70=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','defaults','localhost','redis','./whatsappAccount.socket','request','then','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','options','raw','where','attributes','include','map','model','stringify','lodash','moment'];(function(_0x3cb773,_0x3ba3b7){var _0x520be6=function(_0x5c8659){while(--_0x5c8659){_0x3cb773['push'](_0x3cb773['shift']());}};_0x520be6(++_0x3ba3b7);}(_0x8a70,0x152));var _0x08a7=function(_0xf1e2c6,_0x35cf78){_0xf1e2c6=_0xf1e2c6-0x0;var _0x52d32b=_0x8a70[_0xf1e2c6];return _0x52d32b;};'use strict';var _=require(_0x08a7('0x0'));var util=require('util');var moment=require(_0x08a7('0x1'));var BPromise=require(_0x08a7('0x2'));var rs=require(_0x08a7('0x3'));var fs=require('fs');var Redis=require(_0x08a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x08a7('0x5'));var logger=require(_0x08a7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x08a7('0x7'));var client=jayson[_0x08a7('0x8')]['http']({'port':0x232a});config['redis']=_[_0x08a7('0x9')](config['redis'],{'host':_0x08a7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08a7('0xb')]));require(_0x08a7('0xc'))['register'](socket);function respondWithRpcPromise(_0x39fab5,_0x5bfb16,_0x3d0c41){return new BPromise(function(_0x4bafc6,_0x29b098){return client[_0x08a7('0xd')](_0x39fab5,_0x3d0c41)[_0x08a7('0xe')](function(_0x1d06d8){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5bfb16,'request\x20sent');logger[_0x08a7('0xf')](_0x08a7('0x10'),_0x5bfb16,_0x08a7('0x11'),JSON['stringify'](_0x1d06d8));if(_0x1d06d8[_0x08a7('0x12')]){if(_0x1d06d8['error'][_0x08a7('0x13')]===0x1f4){logger['error'](_0x08a7('0x14'),_0x5bfb16,_0x1d06d8['error']['message']);return _0x29b098(_0x1d06d8['error']['message']);}logger[_0x08a7('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x5bfb16,_0x1d06d8[_0x08a7('0x12')][_0x08a7('0x15')]);return _0x4bafc6(_0x1d06d8[_0x08a7('0x12')][_0x08a7('0x15')]);}else{logger[_0x08a7('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x5bfb16,_0x08a7('0x11'));_0x4bafc6(_0x1d06d8[_0x08a7('0x17')][_0x08a7('0x15')]);}})[_0x08a7('0x18')](function(_0xbae386){logger[_0x08a7('0x12')](_0x08a7('0x14'),_0x5bfb16,_0xbae386);_0x29b098(_0xbae386);});});}exports[_0x08a7('0x19')]=function(_0x192614){var _0x1c7d44=this;return new Promise(function(_0x5e17f7,_0x1b1fd6){return db['WhatsappAccount']['find']({'raw':_0x192614[_0x08a7('0x1a')]?_0x192614[_0x08a7('0x1a')][_0x08a7('0x1b')]===undefined?!![]:![]:!![],'where':_0x192614[_0x08a7('0x1a')]?_0x192614['options'][_0x08a7('0x1c')]||null:null,'attributes':_0x192614['options']?_0x192614[_0x08a7('0x1a')][_0x08a7('0x1d')]||null:null,'include':_0x192614['options']?_0x192614[_0x08a7('0x1a')][_0x08a7('0x1e')]?_[_0x08a7('0x1f')](_0x192614[_0x08a7('0x1a')][_0x08a7('0x1e')],function(_0x1163f9){return{'model':db[_0x1163f9[_0x08a7('0x20')]],'as':_0x1163f9['as'],'attributes':_0x1163f9[_0x08a7('0x1d')],'include':_0x1163f9[_0x08a7('0x1e')]?_[_0x08a7('0x1f')](_0x1163f9[_0x08a7('0x1e')],function(_0x115311){return{'model':db[_0x115311[_0x08a7('0x20')]],'as':_0x115311['as'],'attributes':_0x115311[_0x08a7('0x1d')],'include':_0x115311[_0x08a7('0x1e')]?_[_0x08a7('0x1f')](_0x115311[_0x08a7('0x1e')],function(_0x5c6e33){return{'model':db[_0x5c6e33[_0x08a7('0x20')]],'as':_0x5c6e33['as'],'attributes':_0x5c6e33[_0x08a7('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de831){logger[_0x08a7('0x16')]('ShowWhatsappAccount',_0x192614);logger['debug'](_0x08a7('0x19'),_0x192614,JSON[_0x08a7('0x21')](_0x2de831));_0x5e17f7(_0x2de831);})['catch'](function(_0x4148ef){logger['error']('ShowWhatsappAccount',_0x4148ef[_0x08a7('0x15')],_0x192614);_0x1b1fd6(_0x1c7d44[_0x08a7('0x12')](0x1f4,_0x4148ef[_0x08a7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2605f72..a3bf68d 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 _0xb155=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb155,0xac));var _0x5b15=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xb155[_0x37b3e5];return _0x207f20;};'use strict';var WhatsappAccountEvents=require(_0x5b15('0x0'));var events=[_0x5b15('0x1'),_0x5b15('0x2'),'update'];function createListener(_0x1dcb8e,_0x2e07ae){return function(_0x2541ea){_0x2e07ae[_0x5b15('0x3')](_0x1dcb8e,_0x2541ea);};}function removeListener(_0x3af5d0,_0x509cb7){return function(){WhatsappAccountEvents[_0x5b15('0x4')](_0x3af5d0,_0x509cb7);};}exports[_0x5b15('0x5')]=function(_0x302f8b){for(var _0x288db4=0x0,_0x1ac9df=events[_0x5b15('0x6')];_0x288db4<_0x1ac9df;_0x288db4++){var _0x368402=events[_0x288db4];var _0x34f5d4=createListener(_0x5b15('0x7')+_0x368402,_0x302f8b);WhatsappAccountEvents['on'](_0x368402,_0x34f5d4);}}; \ No newline at end of file +var _0x2e6c=['length','whatsappAccount:','./whatsappAccount.events','update','removeListener'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x2e6c,0x174));var _0xc2e6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2e6c[_0x19950b];return _0x3c6b41;};'use strict';var WhatsappAccountEvents=require(_0xc2e6('0x0'));var events=['save','remove',_0xc2e6('0x1')];function createListener(_0x36cea1,_0x25cf9d){return function(_0x4da461){_0x25cf9d['emit'](_0x36cea1,_0x4da461);};}function removeListener(_0x1bceb9,_0x5a909c){return function(){WhatsappAccountEvents[_0xc2e6('0x2')](_0x1bceb9,_0x5a909c);};}exports['register']=function(_0x4a9865){for(var _0x44de98=0x0,_0x2f3023=events[_0xc2e6('0x3')];_0x44de98<_0x2f3023;_0x44de98++){var _0x4ed68f=events[_0x44de98];var _0x64b5a1=createListener(_0xc2e6('0x4')+_0x4ed68f,_0x4a9865);WhatsappAccountEvents['on'](_0x4ed68f,_0x64b5a1);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 6b34137..8197550 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 _0xef82=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','path','connect-timeout','express'];(function(_0x1c7dcf,_0x25723c){var _0x1ede61=function(_0x41f909){while(--_0x41f909){_0x1c7dcf['push'](_0x1c7dcf['shift']());}};_0x1ede61(++_0x25723c);}(_0xef82,0xb8));var _0x2ef8=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xef82[_0x29d915];return _0x160f86;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2ef8('0x0'));var timeout=require(_0x2ef8('0x1'));var express=require(_0x2ef8('0x2'));var router=express[_0x2ef8('0x3')]();var fs_extra=require(_0x2ef8('0x4'));var auth=require(_0x2ef8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2ef8('0x6'));var controller=require('./whatsappApplication.controller');router[_0x2ef8('0x7')]('/',auth[_0x2ef8('0x8')](),controller[_0x2ef8('0x9')]);router[_0x2ef8('0x7')](_0x2ef8('0xa'),auth[_0x2ef8('0x8')](),controller[_0x2ef8('0xb')]);router[_0x2ef8('0xc')]('/',auth[_0x2ef8('0x8')](),controller[_0x2ef8('0xd')]);router['put'](_0x2ef8('0xa'),auth[_0x2ef8('0x8')](),controller['update']);router[_0x2ef8('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x2ef8('0xf')]);module[_0x2ef8('0x10')]=router; \ No newline at end of file +var _0xf6b5=['./whatsappApplication.controller','get','index','isAuthenticated','show','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5650dc,_0x5cfccb){var _0x3e88ce=function(_0x56e346){while(--_0x56e346){_0x5650dc['push'](_0x5650dc['shift']());}};_0x3e88ce(++_0x5cfccb);}(_0xf6b5,0x82));var _0x5f6b=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0xf6b5[_0x39bc44];return _0x2916d8;};'use strict';var multer=require(_0x5f6b('0x0'));var util=require(_0x5f6b('0x1'));var path=require(_0x5f6b('0x2'));var timeout=require(_0x5f6b('0x3'));var express=require(_0x5f6b('0x4'));var router=express[_0x5f6b('0x5')]();var fs_extra=require(_0x5f6b('0x6'));var auth=require(_0x5f6b('0x7'));var interaction=require(_0x5f6b('0x8'));var config=require(_0x5f6b('0x9'));var controller=require(_0x5f6b('0xa'));router[_0x5f6b('0xb')]('/',auth['isAuthenticated'](),controller[_0x5f6b('0xc')]);router[_0x5f6b('0xb')]('/:id',auth[_0x5f6b('0xd')](),controller[_0x5f6b('0xe')]);router['post']('/',auth[_0x5f6b('0xd')](),controller['create']);router['put'](_0x5f6b('0xf'),auth[_0x5f6b('0xd')](),controller[_0x5f6b('0x10')]);router[_0x5f6b('0x11')](_0x5f6b('0xf'),auth['isAuthenticated'](),controller[_0x5f6b('0x12')]);module[_0x5f6b('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index b2e4304..8c4f353 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 _0x85f6=['STRING','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x4f34d8,_0x40f022){var _0xc97536=function(_0xef9dfc){while(--_0xef9dfc){_0x4f34d8['push'](_0x4f34d8['shift']());}};_0xc97536(++_0x40f022);}(_0x85f6,0x1ed));var _0x685f=function(_0x79b75f,_0x1a136e){_0x79b75f=_0x79b75f-0x0;var _0x5e25a7=_0x85f6[_0x79b75f];return _0x5e25a7;};'use strict';var Sequelize=require(_0x685f('0x0'));module[_0x685f('0x1')]={'priority':{'type':Sequelize[_0x685f('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x685f('0x3')},'appdata':{'type':Sequelize[_0x685f('0x4')]()},'description':{'type':Sequelize[_0x685f('0x5')]},'interval':{'type':Sequelize[_0x685f('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x96fd=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x13e8d9,_0x15a757){var _0x283357=function(_0x180cc7){while(--_0x180cc7){_0x13e8d9['push'](_0x13e8d9['shift']());}};_0x283357(++_0x15a757);}(_0x96fd,0x1df));var _0xd96f=function(_0x9aeb2d,_0x4b11c9){_0x9aeb2d=_0x9aeb2d-0x0;var _0x27fec7=_0x96fd[_0x9aeb2d];return _0x27fec7;};'use strict';var Sequelize=require(_0xd96f('0x0'));module[_0xd96f('0x1')]={'priority':{'type':Sequelize[_0xd96f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd96f('0x3')],'allowNull':![],'defaultValue':_0xd96f('0x4')},'appdata':{'type':Sequelize[_0xd96f('0x5')]()},'description':{'type':Sequelize[_0xd96f('0x3')]},'interval':{'type':Sequelize[_0xd96f('0x3')],'defaultValue':_0xd96f('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 06d999a..4e30a96 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 _0x2272=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','show','params','merge','options','create','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv'];(function(_0x7d3877,_0x493d1b){var _0x2b6944=function(_0x5cd435){while(--_0x5cd435){_0x7d3877['push'](_0x7d3877['shift']());}};_0x2b6944(++_0x493d1b);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x2227('0x0'));var rimraf=require(_0x2227('0x1'));var zipdir=require(_0x2227('0x2'));var jsonpatch=require(_0x2227('0x3'));var rp=require(_0x2227('0x4'));var moment=require('moment');var BPromise=require(_0x2227('0x5'));var Mustache=require(_0x2227('0x6'));var util=require(_0x2227('0x7'));var path=require('path');var sox=require('sox');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(_0x2227('0xe'));var deskjs=require(_0x2227('0xf'));var toCsv=require(_0x2227('0x8'));var querystring=require(_0x2227('0x10'));var Papa=require('papaparse');var Redis=require(_0x2227('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require(_0x2227('0x15'))(_0x2227('0x16'));var utils=require('../../config/utils');var config=require(_0x2227('0x17'));var licenseUtil=require(_0x2227('0x18'));var db=require(_0x2227('0x19'))['db'];function respondWithStatusCode(_0x2e19fb,_0x125c3b){_0x125c3b=_0x125c3b||0xcc;return function(_0x18a2c0){if(_0x18a2c0){return _0x2e19fb['sendStatus'](_0x125c3b);}return _0x2e19fb['status'](_0x125c3b)['end']();};}function respondWithResult(_0x136f6b,_0x571dd1){_0x571dd1=_0x571dd1||0xc8;return function(_0x42f60b){if(_0x42f60b){return _0x136f6b[_0x2227('0x1a')](_0x571dd1)['json'](_0x42f60b);}};}function respondWithFilteredResult(_0x3da09c,_0x4fa23d){return function(_0x1df1ef){if(_0x1df1ef){var _0x43e174=typeof _0x4fa23d[_0x2227('0x1b')]===_0x2227('0x1c')&&typeof _0x4fa23d['limit']===_0x2227('0x1c');var _0x1cf016=_0x1df1ef[_0x2227('0x1d')];var _0x531f75=_0x43e174?0x0:_0x4fa23d[_0x2227('0x1b')];var _0x620012=_0x43e174?_0x1df1ef[_0x2227('0x1d')]:_0x4fa23d[_0x2227('0x1b')]+_0x4fa23d[_0x2227('0x1e')];var _0x28e642;if(_0x620012>=_0x1cf016){_0x620012=_0x1cf016;_0x28e642=0xc8;}else{_0x28e642=0xce;}_0x3da09c[_0x2227('0x1a')](_0x28e642);return _0x3da09c['set'](_0x2227('0x1f'),_0x531f75+'-'+_0x620012+'/'+_0x1cf016)['json'](_0x1df1ef);}return null;};}function patchUpdates(_0x2b26b7){return function(_0x3aed68){try{jsonpatch[_0x2227('0x20')](_0x3aed68,_0x2b26b7,!![]);}catch(_0x1f28ef){return BPromise[_0x2227('0x21')](_0x1f28ef);}return _0x3aed68[_0x2227('0x22')]();};}function saveUpdates(_0x19ab59,_0x10d9ca){return function(_0x3299fd){if(_0x3299fd){return _0x3299fd[_0x2227('0x23')](_0x19ab59)[_0x2227('0x24')](function(_0x5a454f){return _0x5a454f;});}return null;};}function removeEntity(_0x45def5,_0x42d500){return function(_0x5b3a09){if(_0x5b3a09){return _0x5b3a09[_0x2227('0x25')]()[_0x2227('0x24')](function(){_0x45def5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17c7a4,_0xa4d18b){return function(_0x35333f){if(!_0x35333f){_0x17c7a4[_0x2227('0x26')](0x194);}return _0x35333f;};}function handleError(_0x5be889,_0x191a3e){_0x191a3e=_0x191a3e||0x1f4;return function(_0x301304){logger[_0x2227('0x27')](_0x301304[_0x2227('0x28')]);if(_0x301304['name']){delete _0x301304[_0x2227('0x29')];}_0x5be889[_0x2227('0x1a')](_0x191a3e)[_0x2227('0x2a')](_0x301304);};}exports[_0x2227('0x2b')]=function(_0x1627d3,_0x4789eb){var _0x55015e={},_0x5d1d56={},_0x2dc38d={'count':0x0,'rows':[]};var _0x497f91=_[_0x2227('0x2c')](db[_0x2227('0x2d')]['rawAttributes'],function(_0x5916d4){return{'name':_0x5916d4[_0x2227('0x2e')],'type':_0x5916d4[_0x2227('0x2f')][_0x2227('0x30')]};});_0x5d1d56['model']=_[_0x2227('0x2c')](_0x497f91,'name');_0x5d1d56[_0x2227('0x31')]=_[_0x2227('0x32')](_0x1627d3[_0x2227('0x31')]);_0x5d1d56[_0x2227('0x33')]=_[_0x2227('0x34')](_0x5d1d56[_0x2227('0x35')],_0x5d1d56[_0x2227('0x31')]);_0x55015e[_0x2227('0x36')]=_[_0x2227('0x34')](_0x5d1d56[_0x2227('0x35')],qs[_0x2227('0x37')](_0x1627d3['query'][_0x2227('0x37')]));_0x55015e[_0x2227('0x36')]=_0x55015e[_0x2227('0x36')][_0x2227('0x38')]?_0x55015e['attributes']:_0x5d1d56[_0x2227('0x35')];if(!_0x1627d3[_0x2227('0x31')][_0x2227('0x39')](_0x2227('0x3a'))){_0x55015e['limit']=qs[_0x2227('0x1e')](_0x1627d3[_0x2227('0x31')][_0x2227('0x1e')]);_0x55015e['offset']=qs['offset'](_0x1627d3[_0x2227('0x31')][_0x2227('0x1b')]);}_0x55015e['order']=qs[_0x2227('0x3b')](_0x1627d3[_0x2227('0x31')]['sort']);_0x55015e[_0x2227('0x3c')]=qs['filters'](_[_0x2227('0x3d')](_0x1627d3[_0x2227('0x31')],_0x5d1d56[_0x2227('0x33')]),_0x497f91);if(_0x1627d3[_0x2227('0x31')]['filter']){_0x55015e[_0x2227('0x3c')]=_['merge'](_0x55015e[_0x2227('0x3c')],{'$or':_[_0x2227('0x2c')](_0x497f91,function(_0x5ef625){if(_0x5ef625['type']!==_0x2227('0x3e')){var _0x2b96b1={};_0x2b96b1[_0x5ef625[_0x2227('0x29')]]={'$like':'%'+_0x1627d3[_0x2227('0x31')][_0x2227('0x3f')]+'%'};return _0x2b96b1;}})});}_0x55015e=_['merge']({},_0x55015e,_0x1627d3['options']);var _0x2b1a8c={'where':_0x55015e['where']};return db[_0x2227('0x2d')][_0x2227('0x1d')](_0x2b1a8c)[_0x2227('0x24')](function(_0x3ae79a){_0x2dc38d[_0x2227('0x1d')]=_0x3ae79a;if(_0x1627d3[_0x2227('0x31')][_0x2227('0x40')]){_0x55015e[_0x2227('0x41')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2227('0x42')](_0x55015e);})['then'](function(_0x3c67c6){_0x2dc38d['rows']=_0x3c67c6;return _0x2dc38d;})[_0x2227('0x24')](respondWithFilteredResult(_0x4789eb,_0x55015e))['catch'](handleError(_0x4789eb,null));};exports[_0x2227('0x43')]=function(_0x49239e,_0xf45d6b){var _0x307099={'raw':!![],'where':{'id':_0x49239e[_0x2227('0x44')]['id']}},_0x46eb0f={};_0x46eb0f[_0x2227('0x35')]=_[_0x2227('0x32')](db['WhatsappApplication']['rawAttributes']);_0x46eb0f[_0x2227('0x31')]=_['keys'](_0x49239e[_0x2227('0x31')]);_0x46eb0f['filters']=_[_0x2227('0x34')](_0x46eb0f[_0x2227('0x35')],_0x46eb0f[_0x2227('0x31')]);_0x307099[_0x2227('0x36')]=_[_0x2227('0x34')](_0x46eb0f[_0x2227('0x35')],qs['fields'](_0x49239e[_0x2227('0x31')][_0x2227('0x37')]));_0x307099[_0x2227('0x36')]=_0x307099[_0x2227('0x36')][_0x2227('0x38')]?_0x307099[_0x2227('0x36')]:_0x46eb0f[_0x2227('0x35')];if(_0x49239e[_0x2227('0x31')]['includeAll']){_0x307099[_0x2227('0x41')]=[{'all':!![]}];}_0x307099=_[_0x2227('0x45')]({},_0x307099,_0x49239e[_0x2227('0x46')]);return db[_0x2227('0x2d')]['find'](_0x307099)[_0x2227('0x24')](handleEntityNotFound(_0xf45d6b,null))[_0x2227('0x24')](respondWithResult(_0xf45d6b,null))['catch'](handleError(_0xf45d6b,null));};exports[_0x2227('0x47')]=function(_0x475a1b,_0x1e4d8f){return db[_0x2227('0x2d')][_0x2227('0x47')](_0x475a1b[_0x2227('0x48')],{})[_0x2227('0x24')](respondWithResult(_0x1e4d8f,0xc9))['catch'](handleError(_0x1e4d8f,null));};exports[_0x2227('0x23')]=function(_0x3155dd,_0x482bf9){if(_0x3155dd[_0x2227('0x48')]['id']){delete _0x3155dd['body']['id'];}return db[_0x2227('0x2d')][_0x2227('0x49')]({'where':{'id':_0x3155dd[_0x2227('0x44')]['id']}})[_0x2227('0x24')](handleEntityNotFound(_0x482bf9,null))['then'](saveUpdates(_0x3155dd['body'],null))['then'](respondWithResult(_0x482bf9,null))[_0x2227('0x4a')](handleError(_0x482bf9,null));};exports[_0x2227('0x25')]=function(_0x5b0e5b,_0x3ab28b){return db[_0x2227('0x2d')][_0x2227('0x49')]({'where':{'id':_0x5b0e5b[_0x2227('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ab28b,null))['then'](removeEntity(_0x3ab28b,null))[_0x2227('0x4a')](handleError(_0x3ab28b,null));}; \ No newline at end of file +var _0xb98e=['request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','catch','create','body','update','eml-format','rimraf'];(function(_0x49e6db,_0x1a4546){var _0x5a6137=function(_0xcf3ed9){while(--_0xcf3ed9){_0x49e6db['push'](_0x49e6db['shift']());}};_0x5a6137(++_0x1a4546);}(_0xb98e,0x184));var _0xeb98=function(_0x30c45f,_0x4314e7){_0x30c45f=_0x30c45f-0x0;var _0x515af1=_0xb98e[_0x30c45f];return _0x515af1;};'use strict';var emlformat=require(_0xeb98('0x0'));var rimraf=require(_0xeb98('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb98('0x2'));var moment=require(_0xeb98('0x3'));var BPromise=require(_0xeb98('0x4'));var Mustache=require('mustache');var util=require(_0xeb98('0x5'));var path=require(_0xeb98('0x6'));var sox=require(_0xeb98('0x7'));var csv=require('to-csv');var ejs=require(_0xeb98('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb98('0x9'));var squel=require('squel');var crypto=require(_0xeb98('0xa'));var jsforce=require(_0xeb98('0xb'));var deskjs=require(_0xeb98('0xc'));var toCsv=require(_0xeb98('0xd'));var querystring=require(_0xeb98('0xe'));var Papa=require(_0xeb98('0xf'));var Redis=require(_0xeb98('0x10'));var authService=require(_0xeb98('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeb98('0x12'));var hardwareService=require(_0xeb98('0x13'));var logger=require(_0xeb98('0x14'))(_0xeb98('0x15'));var utils=require(_0xeb98('0x16'));var config=require(_0xeb98('0x17'));var licenseUtil=require(_0xeb98('0x18'));var db=require(_0xeb98('0x19'))['db'];function respondWithStatusCode(_0x2b3f9f,_0x7f5944){_0x7f5944=_0x7f5944||0xcc;return function(_0x147706){if(_0x147706){return _0x2b3f9f['sendStatus'](_0x7f5944);}return _0x2b3f9f[_0xeb98('0x1a')](_0x7f5944)[_0xeb98('0x1b')]();};}function respondWithResult(_0x55164a,_0x5d395c){_0x5d395c=_0x5d395c||0xc8;return function(_0x297a7a){if(_0x297a7a){return _0x55164a[_0xeb98('0x1a')](_0x5d395c)[_0xeb98('0x1c')](_0x297a7a);}};}function respondWithFilteredResult(_0x31ff03,_0xac14bc){return function(_0x29117b){if(_0x29117b){var _0x33de7f=typeof _0xac14bc[_0xeb98('0x1d')]===_0xeb98('0x1e')&&typeof _0xac14bc[_0xeb98('0x1f')]===_0xeb98('0x1e');var _0x2a77ff=_0x29117b[_0xeb98('0x20')];var _0x3520a4=_0x33de7f?0x0:_0xac14bc[_0xeb98('0x1d')];var _0x1caff9=_0x33de7f?_0x29117b[_0xeb98('0x20')]:_0xac14bc[_0xeb98('0x1d')]+_0xac14bc[_0xeb98('0x1f')];var _0x1785fc;if(_0x1caff9>=_0x2a77ff){_0x1caff9=_0x2a77ff;_0x1785fc=0xc8;}else{_0x1785fc=0xce;}_0x31ff03['status'](_0x1785fc);return _0x31ff03[_0xeb98('0x21')](_0xeb98('0x22'),_0x3520a4+'-'+_0x1caff9+'/'+_0x2a77ff)['json'](_0x29117b);}return null;};}function patchUpdates(_0x56b018){return function(_0x35f4f5){try{jsonpatch[_0xeb98('0x23')](_0x35f4f5,_0x56b018,!![]);}catch(_0x5261b0){return BPromise['reject'](_0x5261b0);}return _0x35f4f5[_0xeb98('0x24')]();};}function saveUpdates(_0x4e34fc,_0x3e7693){return function(_0x3ebf3d){if(_0x3ebf3d){return _0x3ebf3d['update'](_0x4e34fc)[_0xeb98('0x25')](function(_0xb561eb){return _0xb561eb;});}return null;};}function removeEntity(_0x3a3566,_0x131128){return function(_0x16274e){if(_0x16274e){return _0x16274e[_0xeb98('0x26')]()[_0xeb98('0x25')](function(){_0x3a3566[_0xeb98('0x1a')](0xcc)[_0xeb98('0x1b')]();});}};}function handleEntityNotFound(_0x378284,_0x7d361){return function(_0x499ae8){if(!_0x499ae8){_0x378284[_0xeb98('0x27')](0x194);}return _0x499ae8;};}function handleError(_0x29fecd,_0x45afdc){_0x45afdc=_0x45afdc||0x1f4;return function(_0x1c1ace){logger[_0xeb98('0x28')](_0x1c1ace[_0xeb98('0x29')]);if(_0x1c1ace[_0xeb98('0x2a')]){delete _0x1c1ace[_0xeb98('0x2a')];}_0x29fecd[_0xeb98('0x1a')](_0x45afdc)[_0xeb98('0x2b')](_0x1c1ace);};}exports[_0xeb98('0x2c')]=function(_0x37fdd6,_0x54a957){var _0x23dc9f={},_0x462a78={},_0x2eb410={'count':0x0,'rows':[]};var _0x388277=_['map'](db[_0xeb98('0x2d')][_0xeb98('0x2e')],function(_0x31cddf){return{'name':_0x31cddf[_0xeb98('0x2f')],'type':_0x31cddf[_0xeb98('0x30')][_0xeb98('0x31')]};});_0x462a78['model']=_['map'](_0x388277,_0xeb98('0x2a'));_0x462a78[_0xeb98('0x32')]=_[_0xeb98('0x33')](_0x37fdd6[_0xeb98('0x32')]);_0x462a78[_0xeb98('0x34')]=_[_0xeb98('0x35')](_0x462a78[_0xeb98('0x36')],_0x462a78[_0xeb98('0x32')]);_0x23dc9f[_0xeb98('0x37')]=_[_0xeb98('0x35')](_0x462a78[_0xeb98('0x36')],qs[_0xeb98('0x38')](_0x37fdd6[_0xeb98('0x32')][_0xeb98('0x38')]));_0x23dc9f[_0xeb98('0x37')]=_0x23dc9f['attributes'][_0xeb98('0x39')]?_0x23dc9f[_0xeb98('0x37')]:_0x462a78[_0xeb98('0x36')];if(!_0x37fdd6['query'][_0xeb98('0x3a')](_0xeb98('0x3b'))){_0x23dc9f['limit']=qs[_0xeb98('0x1f')](_0x37fdd6[_0xeb98('0x32')][_0xeb98('0x1f')]);_0x23dc9f['offset']=qs['offset'](_0x37fdd6[_0xeb98('0x32')][_0xeb98('0x1d')]);}_0x23dc9f[_0xeb98('0x3c')]=qs[_0xeb98('0x3d')](_0x37fdd6['query'][_0xeb98('0x3d')]);_0x23dc9f[_0xeb98('0x3e')]=qs['filters'](_[_0xeb98('0x3f')](_0x37fdd6['query'],_0x462a78[_0xeb98('0x34')]),_0x388277);if(_0x37fdd6[_0xeb98('0x32')][_0xeb98('0x40')]){_0x23dc9f[_0xeb98('0x3e')]=_[_0xeb98('0x41')](_0x23dc9f['where'],{'$or':_['map'](_0x388277,function(_0x40e58e){if(_0x40e58e[_0xeb98('0x30')]!==_0xeb98('0x42')){var _0xa4d8aa={};_0xa4d8aa[_0x40e58e[_0xeb98('0x2a')]]={'$like':'%'+_0x37fdd6[_0xeb98('0x32')][_0xeb98('0x40')]+'%'};return _0xa4d8aa;}})});}_0x23dc9f=_[_0xeb98('0x41')]({},_0x23dc9f,_0x37fdd6[_0xeb98('0x43')]);var _0x341f50={'where':_0x23dc9f[_0xeb98('0x3e')]};return db[_0xeb98('0x2d')][_0xeb98('0x20')](_0x341f50)[_0xeb98('0x25')](function(_0xba4fa7){_0x2eb410['count']=_0xba4fa7;if(_0x37fdd6[_0xeb98('0x32')][_0xeb98('0x44')]){_0x23dc9f['include']=[{'all':!![]}];}return db[_0xeb98('0x2d')][_0xeb98('0x45')](_0x23dc9f);})[_0xeb98('0x25')](function(_0x3e48ee){_0x2eb410[_0xeb98('0x46')]=_0x3e48ee;return _0x2eb410;})[_0xeb98('0x25')](respondWithFilteredResult(_0x54a957,_0x23dc9f))['catch'](handleError(_0x54a957,null));};exports['show']=function(_0x3c8618,_0x133549){var _0x2c1cee={'raw':!![],'where':{'id':_0x3c8618[_0xeb98('0x47')]['id']}},_0x59ae37={};_0x59ae37[_0xeb98('0x36')]=_['keys'](db['WhatsappApplication'][_0xeb98('0x2e')]);_0x59ae37[_0xeb98('0x32')]=_[_0xeb98('0x33')](_0x3c8618[_0xeb98('0x32')]);_0x59ae37[_0xeb98('0x34')]=_['intersection'](_0x59ae37[_0xeb98('0x36')],_0x59ae37[_0xeb98('0x32')]);_0x2c1cee[_0xeb98('0x37')]=_[_0xeb98('0x35')](_0x59ae37[_0xeb98('0x36')],qs[_0xeb98('0x38')](_0x3c8618[_0xeb98('0x32')][_0xeb98('0x38')]));_0x2c1cee[_0xeb98('0x37')]=_0x2c1cee[_0xeb98('0x37')][_0xeb98('0x39')]?_0x2c1cee[_0xeb98('0x37')]:_0x59ae37[_0xeb98('0x36')];if(_0x3c8618[_0xeb98('0x32')][_0xeb98('0x44')]){_0x2c1cee[_0xeb98('0x48')]=[{'all':!![]}];}_0x2c1cee=_[_0xeb98('0x41')]({},_0x2c1cee,_0x3c8618['options']);return db[_0xeb98('0x2d')][_0xeb98('0x49')](_0x2c1cee)['then'](handleEntityNotFound(_0x133549,null))['then'](respondWithResult(_0x133549,null))[_0xeb98('0x4a')](handleError(_0x133549,null));};exports['create']=function(_0x4b69a7,_0x53d046){return db['WhatsappApplication'][_0xeb98('0x4b')](_0x4b69a7[_0xeb98('0x4c')],{})[_0xeb98('0x25')](respondWithResult(_0x53d046,0xc9))[_0xeb98('0x4a')](handleError(_0x53d046,null));};exports[_0xeb98('0x4d')]=function(_0x23f0c2,_0x34c3ff){if(_0x23f0c2[_0xeb98('0x4c')]['id']){delete _0x23f0c2[_0xeb98('0x4c')]['id'];}return db[_0xeb98('0x2d')][_0xeb98('0x49')]({'where':{'id':_0x23f0c2[_0xeb98('0x47')]['id']}})[_0xeb98('0x25')](handleEntityNotFound(_0x34c3ff,null))[_0xeb98('0x25')](saveUpdates(_0x23f0c2[_0xeb98('0x4c')],null))['then'](respondWithResult(_0x34c3ff,null))[_0xeb98('0x4a')](handleError(_0x34c3ff,null));};exports[_0xeb98('0x26')]=function(_0x276409,_0x3f09dd){return db[_0xeb98('0x2d')][_0xeb98('0x49')]({'where':{'id':_0x276409[_0xeb98('0x47')]['id']}})[_0xeb98('0x25')](handleEntityNotFound(_0x3f09dd,null))['then'](removeEntity(_0x3f09dd,null))['catch'](handleError(_0x3f09dd,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 0aaf6d2..a502ee9 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 _0xa63f=['request-promise','path','rimraf','../../config/environment','define','WhatsappApplication','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa63f,0x1b6));var _0xfa63=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0xa63f[_0x254076];return _0x21a93e;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var logger=require(_0xfa63('0x2'))(_0xfa63('0x3'));var moment=require(_0xfa63('0x4'));var BPromise=require(_0xfa63('0x5'));var rp=require(_0xfa63('0x6'));var fs=require('fs');var path=require(_0xfa63('0x7'));var rimraf=require(_0xfa63('0x8'));var config=require(_0xfa63('0x9'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x20d4f6,_0x41efce){return _0x20d4f6[_0xfa63('0xa')](_0xfa63('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x089f=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','WhatsappApplication','whatsapp_applications','utf8mb4','util'];(function(_0x29982b,_0x594e0){var _0xb1f0a9=function(_0x3d824c){while(--_0x3d824c){_0x29982b['push'](_0x29982b['shift']());}};_0xb1f0a9(++_0x594e0);}(_0x089f,0x1c7));var _0xf089=function(_0x42fe81,_0xca264e){_0x42fe81=_0x42fe81-0x0;var _0x23dbae=_0x089f[_0x42fe81];return _0x23dbae;};'use strict';var _=require('lodash');var util=require(_0xf089('0x0'));var logger=require(_0xf089('0x1'))(_0xf089('0x2'));var moment=require(_0xf089('0x3'));var BPromise=require(_0xf089('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf089('0x5'));var rimraf=require(_0xf089('0x6'));var config=require(_0xf089('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xf089('0x8')]=function(_0x126d3d,_0x21bce2){return _0x126d3d['define'](_0xf089('0x9'),attributes,{'tableName':_0xf089('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf089('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 3913f1c..2326fdf 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 _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0x99e9,0xb4));var _0x999e=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x99e9[_0x1b51ea];return _0x18bbdc;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0x33c5=['then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x33c5,0xe6));var _0x533c=function(_0x265468,_0xcf7439){_0x265468=_0x265468-0x0;var _0x37d555=_0x33c5[_0x265468];return _0x37d555;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f440711..41d63fc 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 _0x9fd4=['../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x116c04,_0x4963da){var _0x9e011d=function(_0x143880){while(--_0x143880){_0x116c04['push'](_0x116c04['shift']());}};_0x9e011d(++_0x4963da);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3f47dc,_0x450bae){_0x3f47dc=_0x3f47dc-0x0;var _0x291362=_0x9fd4[_0x3f47dc];return _0x291362;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var fs_extra=require(_0x49fd('0x6'));var auth=require(_0x49fd('0x7'));var interaction=require(_0x49fd('0x8'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x49fd('0x9')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0xb')]);router[_0x49fd('0x9')]('/describe',auth[_0x49fd('0xa')](),controller[_0x49fd('0xc')]);router[_0x49fd('0x9')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),controller['show']);router[_0x49fd('0x9')](_0x49fd('0xe'),auth[_0x49fd('0xa')](),controller[_0x49fd('0xf')]);router[_0x49fd('0x9')](_0x49fd('0x10'),auth[_0x49fd('0xa')](),controller['download']);router[_0x49fd('0x11')]('/',auth[_0x49fd('0xa')](),controller[_0x49fd('0x12')]);router[_0x49fd('0x11')](_0x49fd('0xe'),auth[_0x49fd('0xa')](),controller[_0x49fd('0x13')]);router[_0x49fd('0x11')](_0x49fd('0x14'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),_0x49fd('0x17')),controller[_0x49fd('0x18')]);router[_0x49fd('0x19')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),_0x49fd('0x1a')),controller[_0x49fd('0x1b')]);router[_0x49fd('0x1c')](_0x49fd('0xd'),auth[_0x49fd('0xa')](),interaction[_0x49fd('0x15')](_0x49fd('0x16'),'whatsappinteraction:destroy'),controller[_0x49fd('0x1d')]);router[_0x49fd('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0x49fd('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xafdd=['download','post','addMessage','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0xafdd,0x19a));var _0xdafd=function(_0x588d7f,_0x129444){_0x588d7f=_0x588d7f-0x0;var _0x447659=_0xafdd[_0x588d7f];return _0x447659;};'use strict';var multer=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var path=require(_0xdafd('0x2'));var timeout=require(_0xdafd('0x3'));var express=require(_0xdafd('0x4'));var router=express[_0xdafd('0x5')]();var fs_extra=require(_0xdafd('0x6'));var auth=require(_0xdafd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdafd('0x8'));var controller=require(_0xdafd('0x9'));router[_0xdafd('0xa')]('/',auth[_0xdafd('0xb')](),controller[_0xdafd('0xc')]);router[_0xdafd('0xa')](_0xdafd('0xd'),auth['isAuthenticated'](),controller[_0xdafd('0xe')]);router[_0xdafd('0xa')](_0xdafd('0xf'),auth['isAuthenticated'](),controller[_0xdafd('0x10')]);router[_0xdafd('0xa')](_0xdafd('0x11'),auth[_0xdafd('0xb')](),controller['getMessages']);router[_0xdafd('0xa')](_0xdafd('0x12'),auth[_0xdafd('0xb')](),controller[_0xdafd('0x13')]);router[_0xdafd('0x14')]('/',auth[_0xdafd('0xb')](),controller['create']);router[_0xdafd('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0xdafd('0x15')]);router[_0xdafd('0x14')]('/:id/tags',auth[_0xdafd('0xb')](),interaction['tracked']('whatsapp',_0xdafd('0x16')),controller[_0xdafd('0x17')]);router[_0xdafd('0x18')](_0xdafd('0xf'),auth[_0xdafd('0xb')](),interaction['tracked'](_0xdafd('0x19'),_0xdafd('0x1a')),controller[_0xdafd('0x1b')]);router['delete'](_0xdafd('0xf'),auth[_0xdafd('0xb')](),interaction['tracked']('whatsapp',_0xdafd('0x1c')),controller['destroy']);router[_0xdafd('0x1d')](_0xdafd('0x1e'),auth[_0xdafd('0xb')](),controller[_0xdafd('0x1f')]);module[_0xdafd('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 8e093d5..e63c7bc 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 _0x1b20=['DATE','ENUM','out','BOOLEAN','moment','exports','STRING'];(function(_0xda3484,_0x2ce92b){var _0x549287=function(_0x2c53c9){while(--_0x2c53c9){_0xda3484['push'](_0xda3484['shift']());}};_0x549287(++_0x2ce92b);}(_0x1b20,0x66));var _0x01b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b20[_0x4565bf];return _0x5610ba;};'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 +var _0xe75a=['ENUM','out','sequelize','moment','BOOLEAN','DATE','STRING'];(function(_0x47c51d,_0x48aafb){var _0x20182c=function(_0x14023a){while(--_0x14023a){_0x47c51d['push'](_0x47c51d['shift']());}};_0x20182c(++_0x48aafb);}(_0xe75a,0x1de));var _0xae75=function(_0x2d36a6,_0x2f8cd0){_0x2d36a6=_0x2d36a6-0x0;var _0x59cec0=_0xe75a[_0x2d36a6];return _0x59cec0;};'use strict';var Sequelize=require(_0xae75('0x0'));var moment=require(_0xae75('0x1'));module['exports']={'closed':{'type':Sequelize[_0xae75('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xae75('0x3')]},'disposition':{'type':Sequelize[_0xae75('0x4')]},'secondDisposition':{'type':Sequelize[_0xae75('0x4')]},'thirdDisposition':{'type':Sequelize[_0xae75('0x4')]},'note':{'type':Sequelize[_0xae75('0x4')]},'phone':{'type':Sequelize[_0xae75('0x4')]},'read1stAt':{'type':Sequelize[_0xae75('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xae75('0x5')]('in',_0xae75('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xae75('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 11d16dd..1a64e61 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 _0x340b=['ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','WhatsappInteraction','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','rawAttributes','includeAll','include','options','create','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','emit','whatsappInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','Attachment','direction','secret','WhatsappAccount','Owner','Whatsapp','Account','closed','closedAt','basename','existsSync','pipe','createWriteStream','out','System','Contact','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','map','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x3806c0,_0x543458){var _0x1358b2=function(_0x414fbb){while(--_0x414fbb){_0x3806c0['push'](_0x3806c0['shift']());}};_0x1358b2(++_0x543458);}(_0x340b,0x16a));var _0xb340=function(_0x168768,_0x15efef){_0x168768=_0x168768-0x0;var _0x59ec67=_0x340b[_0x168768];return _0x59ec67;};'use strict';var emlformat=require(_0xb340('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb340('0x1'));var jsonpatch=require(_0xb340('0x2'));var rp=require(_0xb340('0x3'));var moment=require('moment');var BPromise=require(_0xb340('0x4'));var Mustache=require(_0xb340('0x5'));var util=require(_0xb340('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb340('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb340('0x8'));var _=require(_0xb340('0x9'));var squel=require('squel');var crypto=require(_0xb340('0xa'));var jsforce=require(_0xb340('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb340('0xc'));var Papa=require(_0xb340('0xd'));var Redis=require(_0xb340('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xb340('0xf'));var hardwareService=require(_0xb340('0x10'));var logger=require(_0xb340('0x11'))(_0xb340('0x12'));var utils=require('../../config/utils');var config=require(_0xb340('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb340('0x14')]=_[_0xb340('0x15')](config[_0xb340('0x14')],{'host':_0xb340('0x16'),'port':0x18eb});var socket=require(_0xb340('0x17'))(new Redis(config[_0xb340('0x14')]));require(_0xb340('0x18'))['register'](socket);function respondWithStatusCode(_0x54cfde,_0xf2ee43){_0xf2ee43=_0xf2ee43||0xcc;return function(_0x1edbf3){if(_0x1edbf3){return _0x54cfde[_0xb340('0x19')](_0xf2ee43);}return _0x54cfde[_0xb340('0x1a')](_0xf2ee43)[_0xb340('0x1b')]();};}function respondWithResult(_0x49548d,_0x50b7c8){_0x50b7c8=_0x50b7c8||0xc8;return function(_0x4de427){if(_0x4de427){return _0x49548d[_0xb340('0x1a')](_0x50b7c8)['json'](_0x4de427);}};}function respondWithFilteredResult(_0x2b55df,_0x3c6fd3){return function(_0x1a8ae9){if(_0x1a8ae9){var _0x40cf56=typeof _0x3c6fd3[_0xb340('0x1c')]==='undefined'&&typeof _0x3c6fd3[_0xb340('0x1d')]==='undefined';var _0x3b2a43=_0x1a8ae9['count'];var _0x239674=_0x40cf56?0x0:_0x3c6fd3[_0xb340('0x1c')];var _0x3bda2a=_0x40cf56?_0x1a8ae9[_0xb340('0x1e')]:_0x3c6fd3['offset']+_0x3c6fd3[_0xb340('0x1d')];var _0x3e4b02;if(_0x3bda2a>=_0x3b2a43){_0x3bda2a=_0x3b2a43;_0x3e4b02=0xc8;}else{_0x3e4b02=0xce;}_0x2b55df[_0xb340('0x1a')](_0x3e4b02);return _0x2b55df[_0xb340('0x1f')](_0xb340('0x20'),_0x239674+'-'+_0x3bda2a+'/'+_0x3b2a43)[_0xb340('0x21')](_0x1a8ae9);}return null;};}function patchUpdates(_0x4adedd){return function(_0x2e8e28){try{jsonpatch[_0xb340('0x22')](_0x2e8e28,_0x4adedd,!![]);}catch(_0x127956){return BPromise[_0xb340('0x23')](_0x127956);}return _0x2e8e28[_0xb340('0x24')]();};}function saveUpdates(_0x11e175,_0x51791c){return function(_0x5f53c2){if(_0x5f53c2){return _0x5f53c2[_0xb340('0x25')](_0x11e175)[_0xb340('0x26')](function(_0x2678b8){return _0x2678b8;});}return null;};}function removeEntity(_0x3c1946,_0x3ccb25){return function(_0x25a8ec){if(_0x25a8ec){return _0x25a8ec[_0xb340('0x27')]()['then'](function(){_0x3c1946[_0xb340('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac802,_0x5772eb){return function(_0x46763e){if(!_0x46763e){_0x5ac802[_0xb340('0x19')](0x194);}return _0x46763e;};}function handleError(_0x4c8576,_0x5e2b19){_0x5e2b19=_0x5e2b19||0x1f4;return function(_0x110d7b){logger['error'](_0x110d7b[_0xb340('0x28')]);if(_0x110d7b[_0xb340('0x29')]){delete _0x110d7b['name'];}_0x4c8576[_0xb340('0x1a')](_0x5e2b19)[_0xb340('0x2a')](_0x110d7b);};}function getInteractionUsers(_0x30154e,_0x279b9b){return new BPromise(function(_0x1547f6,_0x5496fa){try{if(_0x279b9b[_0x30154e['id']]){_0x30154e[_0xb340('0x2b')]=_['map'](_0x279b9b[_0x30154e['id']],function(_0x269cf0){return{'id':_0x269cf0['id'],'fullname':_0x269cf0[_0xb340('0x2c')]};});}}catch(_0x2eb756){_0x5496fa(_0x2eb756);}_0x1547f6(_0x30154e);});}function getInteractionTags(_0xeddd15,_0x1de8d6){return new BPromise(function(_0x3243f7,_0x6cab44){try{if(_0xeddd15[_0xb340('0x2d')]){_0xeddd15[_0xb340('0x2e')]=[];_0xeddd15[_0xb340('0x2d')][_0xb340('0x2f')](',')[_0xb340('0x30')](function(_0x472305){_0xeddd15[_0xb340('0x2e')]['push'](_0x1de8d6[_0x472305]);});}delete _0xeddd15[_0xb340('0x2d')];}catch(_0x2da590){_0x6cab44(_0x2da590);}_0x3243f7(_0xeddd15);});}function updateWhatsappInteraction(_0x5cf263,_0x5d9fb8,_0x117b02){return new BPromise(function(_0x397151,_0x21b730){return getInteractionUsers(_0x5cf263,_0x117b02)[_0xb340('0x26')](function(_0x517465){return getInteractionTags(_0x517465,_0x5d9fb8);})[_0xb340('0x26')](function(_0x307398){_0x397151(_0x307398);})['catch'](function(_0x4d907d){_0x21b730(_0x4d907d);});});}exports['index']=function(_0x596f18,_0x5530a9){var _0x463769={},_0x44ac42={},_0x430308={'count':0x0,'rows':[]};var _0x1a17c0=_[_0xb340('0x31')](db['WhatsappInteraction']['rawAttributes'],function(_0x5b6f69){return{'name':_0x5b6f69[_0xb340('0x32')],'type':_0x5b6f69[_0xb340('0x33')]['key']};});_0x44ac42[_0xb340('0x34')]=_[_0xb340('0x31')](_0x1a17c0,'name');_0x44ac42[_0xb340('0x35')]=_['keys'](_0x596f18['query']);_0x44ac42['filters']=_[_0xb340('0x36')](_0x44ac42[_0xb340('0x34')],_0x44ac42[_0xb340('0x35')]);_0x463769[_0xb340('0x37')]=_[_0xb340('0x36')](_0x44ac42[_0xb340('0x34')],qs['fields'](_0x596f18[_0xb340('0x35')][_0xb340('0x38')]));_0x463769[_0xb340('0x37')]=_0x463769[_0xb340('0x37')][_0xb340('0x39')]?_0x463769[_0xb340('0x37')]:_0x44ac42[_0xb340('0x34')];if(!_0x596f18['query'][_0xb340('0x3a')](_0xb340('0x3b'))){_0x463769['limit']=qs[_0xb340('0x1d')](_0x596f18[_0xb340('0x35')][_0xb340('0x1d')]);_0x463769[_0xb340('0x1c')]=qs[_0xb340('0x1c')](_0x596f18['query'][_0xb340('0x1c')]);}_0x463769[_0xb340('0x3c')]=qs[_0xb340('0x3d')](_0x596f18[_0xb340('0x35')][_0xb340('0x3d')]);_0x463769[_0xb340('0x3e')]=qs['filters'](_[_0xb340('0x3f')](_0x596f18['query'],_0x44ac42[_0xb340('0x40')]),_0x1a17c0);var _0x19529f=[];var _0x1d01cd=squel[_0xb340('0x41')]()[_0xb340('0x42')]('id')['field'](_0xb340('0x29'))[_0xb340('0x42')](_0xb340('0x43'))[_0xb340('0x44')](_0xb340('0x45'));var _0x298d10=squel[_0xb340('0x41')]()[_0xb340('0x42')](_0xb340('0x46'))[_0xb340('0x42')]('u.fullname')[_0xb340('0x42')](_0xb340('0x47'))[_0xb340('0x44')](_0xb340('0x48'),'ui')[_0xb340('0x49')](_0xb340('0x4a'),'u',_0xb340('0x4b'));var _0x2fa111=squel['select']()['from']('whatsapp_interactions','i')[_0xb340('0x49')](_0xb340('0x4c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb340('0x49')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xb340('0x4d'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb340('0x49')](_0xb340('0x4e'),'me',_0xb340('0x4f'))['left_join'](_0xb340('0x50'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xb340('0x49')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x22fa98=squel['expr']();var _0x4477db=[];var _0x453c50=squel[_0xb340('0x51')]();var _0x5bb1f8;if(_0x596f18[_0xb340('0x35')][_0xb340('0x52')]){_0x5bb1f8=as[_0xb340('0x53')](_0x596f18[_0xb340('0x35')][_0xb340('0x52')]);var _0x400f5c=_0x5bb1f8['sqlOperator'];for(var _0x5833d2=0x0;_0x5833d2<_0x5bb1f8[_0xb340('0x54')]['length'];_0x5833d2++){var _0x32e1e1=_0x5bb1f8[_0xb340('0x54')][_0x5833d2];var _0x4309f2='i';var _0x495105=_[_0xb340('0x55')](_0x1a17c0,['name',_0x32e1e1[_0xb340('0x42')]]);if(!_0x495105){switch(_0x32e1e1[_0xb340('0x42')]){case _0xb340('0x56'):if(_0x32e1e1[_0xb340('0x57')]==0x1){_0x2fa111['having']('`'+_0x32e1e1[_0xb340('0x42')]+_0xb340('0x58'));}else{_0x2fa111['having']('`'+_0x32e1e1[_0xb340('0x42')]+_0xb340('0x59'));}break;case'Contact':if(_0x32e1e1[_0xb340('0x5a')]===_0xb340('0x5b')){if(_0x32e1e1[_0xb340('0x57')]['split']('\x20')[_0xb340('0x39')]>0x1){_0x22fa98[_0x400f5c](_0xb340('0x5c'),qs['getFullTextValue'](_0x32e1e1['value']),null);}else{var _0x300d67='%'+_0x32e1e1['value']+'%';_0x22fa98[_0x400f5c](_0xb340('0x5d'),_0x300d67,_0x300d67,_0x300d67);}}else{_0x495105=_['find'](_0x1a17c0,[_0xb340('0x29'),_0xb340('0x5e')]);_0x32e1e1[_0xb340('0x42')]=_0xb340('0x5e');_0x43cc48=as[_0xb340('0x5f')](_0x4309f2,_0x495105[_0xb340('0x33')],_0x32e1e1);_0x22fa98[_0x400f5c](_0x43cc48[_0xb340('0x60')],_0x43cc48['value'][_0xb340('0x61')],_0x43cc48[_0xb340('0x57')][_0xb340('0x1b')]);}break;case _0xb340('0x62'):var _0x101f0c=_0x32e1e1['value'][_0xb340('0x2f')](',')[_0xb340('0x31')](function(_0x40a91a){return Number(_0x40a91a);});_0x101f0c[_0xb340('0x30')](function(_0x443b8b){_0x453c50['or'](_0xb340('0x63'),'%,'+_0x443b8b+',%');});_0x4477db=_[_0xb340('0x64')](_0x4477db,_0x101f0c);break;case'User':if(_0x32e1e1[_0xb340('0x5a')]===_0xb340('0x5b')){_0x22fa98[_0x400f5c](_0xb340('0x65'),'%'+_0x32e1e1[_0xb340('0x57')]+'%',null);}else{_0x495105=_['find'](_0x1a17c0,[_0xb340('0x29'),'UserId']);_0x32e1e1[_0xb340('0x42')]='UserId';_0x43cc48=as['buildExpression'](_0x4309f2,_0x495105[_0xb340('0x33')],_0x32e1e1);_0x22fa98[_0x400f5c](_0x43cc48[_0xb340('0x60')],_0x43cc48[_0xb340('0x57')][_0xb340('0x61')],_0x43cc48[_0xb340('0x57')]['end']);}break;case _0xb340('0x66'):_0x43cc48=as[_0xb340('0x5f')]('me',null,_0x32e1e1);_0x22fa98[_0x400f5c](_0x43cc48[_0xb340('0x60')],_0x43cc48[_0xb340('0x57')][_0xb340('0x61')],_0x43cc48[_0xb340('0x57')][_0xb340('0x1b')]);break;}}else{var _0x43cc48=as['buildExpression'](_0x4309f2,_0x495105[_0xb340('0x33')],_0x32e1e1);_0x22fa98[_0x400f5c](_0x43cc48['text'],_0x43cc48['value'][_0xb340('0x61')],_0x43cc48[_0xb340('0x57')][_0xb340('0x1b')]);}}}else{var _0x4a169b=_(_0x596f18['query'])[_0xb340('0x67')]()[_0xb340('0x31')](function(_0x33a971){return _[_0xb340('0x68')](_0x1a17c0,[_0xb340('0x29'),_0x33a971])?_0x33a971:undefined;})[_0xb340('0x69')]()[_0xb340('0x57')]();if(!_[_0xb340('0x6a')](_0x4a169b)){_0x4a169b[_0xb340('0x30')](function(_0x3931c0){if(_0x3931c0===_0xb340('0x6b')){_0x2fa111[_0xb340('0x3e')](_0xb340('0x6c'),[]['concat'](_0x596f18[_0xb340('0x35')][_0x3931c0]));}else if(_0x3931c0===_0xb340('0x6d')){var _0x7fa00f=JSON['parse'](_0x596f18[_0xb340('0x35')][_0x3931c0])[_0xb340('0x6e')];var _0x392a13=JSON[_0xb340('0x6f')](_0x596f18[_0xb340('0x35')][_0x3931c0])[_0xb340('0x70')];_0x2fa111[_0xb340('0x3e')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x7fa00f,_0x392a13);}else{if(_0x596f18[_0xb340('0x35')][_0x3931c0]===_0xb340('0x71')){_0x2fa111[_0xb340('0x3e')]('i.'+_0x3931c0+_0xb340('0x72'));}else{_0x2fa111['where']('i.'+_0x3931c0+_0xb340('0x73'),_0x596f18['query'][_0x3931c0]);}}});}if(_0x596f18[_0xb340('0x35')][_0xb340('0x74')]){if(_0x596f18[_0xb340('0x35')][_0xb340('0x74')]==0x1){_0x2fa111[_0xb340('0x75')](_0xb340('0x76'));}else{_0x2fa111[_0xb340('0x75')]('`unreadMessages`\x20>\x200');}}if(_0x596f18[_0xb340('0x35')][_0xb340('0x77')]){_0x4477db=_[_0xb340('0x78')](_0x596f18[_0xb340('0x35')][_0xb340('0x77')])?_0x596f18[_0xb340('0x35')][_0xb340('0x77')]:new Array(_0x596f18[_0xb340('0x35')][_0xb340('0x77')]);_0x4477db[_0xb340('0x30')](function(_0x4e3b27){_0x453c50['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e3b27+',%');});}if(_0x596f18[_0xb340('0x35')][_0xb340('0x79')]){var _0x5d0805=_0x596f18[_0xb340('0x35')]['filter']['replace']('\x5c','\x5c\x5c')[_0xb340('0x7a')](/'/g,'\x27\x27');if(qs[_0xb340('0x7b')](_0x5d0805)){_0x22fa98['or'](_0xb340('0x7c'),_0x5d0805+'%')['or'](_0xb340('0x7d'),_0x5d0805+'%');}else{_0x22fa98['or'](_0xb340('0x7e'),qs[_0xb340('0x7f')](_0x5d0805))['or'](_0xb340('0x80'),_0x5d0805+'%');}}}_0x2fa111[_0xb340('0x3e')](_0x22fa98);_0x2fa111[_0xb340('0x81')](_0xb340('0x82'));var _0x10060d={'type':db[_0xb340('0x83')][_0xb340('0x84')][_0xb340('0x85')],'raw':!![]};var _0xdc2b5e=_0x2fa111[_0xb340('0x86')]();_0xdc2b5e[_0xb340('0x42')]('i.id');_0xdc2b5e[_0xb340('0x42')](_0xb340('0x87'),_0xb340('0x56'));if(_0x463769[_0xb340('0x3c')]){_0x463769[_0xb340('0x3c')][_0xb340('0x30')](function(_0x2f6ab4){var _0x24e270=_0x2f6ab4[0x0]===_0xb340('0x88')?_0x2f6ab4[0x0]:'i.'+_0x2f6ab4[0x0];_0x2fa111['order'](_0x24e270,_0x2f6ab4[0x1]===_0xb340('0x89')?![]:!![]);});}if(!_[_0xb340('0x6a')](_0x4477db)){_0x2fa111[_0xb340('0x75')](_0x453c50);_0xdc2b5e['where'](_0xb340('0x8a'),_0x4477db);}BPromise[_0xb340('0x8b')]()[_0xb340('0x26')](function(){if(!_0x5bb1f8){if(_0x596f18[_0xb340('0x35')][_0xb340('0x6b')])return;_0xdc2b5e[_0xb340('0x3e')](_0xb340('0x8c'));_0x2fa111[_0xb340('0x3e')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x596f18[_0xb340('0x8d')][_0xb340('0x8e')]!=='agent')return;return _0x596f18[_0xb340('0x8d')][_0xb340('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x21f042){if(_['isEmpty'](_0x21f042)){_0xdc2b5e[_0xb340('0x3e')](_0xb340('0x90'));_0x2fa111[_0xb340('0x3e')](_0xb340('0x90'));}else{_0xdc2b5e[_0xb340('0x3e')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb340('0x31')](_0x21f042,'id'));_0x2fa111[_0xb340('0x3e')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb340('0x31')](_0x21f042,'id'));}});})[_0xb340('0x26')](function(){if(_0x596f18[_0xb340('0x8d')]['role']===_0xb340('0x91')&&!_0x5bb1f8&&!_0x596f18[_0xb340('0x35')][_0xb340('0x6b')])return[];return db[_0xb340('0x92')][_0xb340('0x35')](_0xdc2b5e['toString'](),_0x10060d);})[_0xb340('0x26')](function(_0x42ed66){_0x430308['count']=_0x42ed66[_0xb340('0x39')];if(_0x430308[_0xb340('0x1e')]===0x0)return[];return db['sequelize'][_0xb340('0x35')](_0x1d01cd[_0xb340('0x93')](),_0x10060d)['then'](function(_0x1e9ef4){_0x19529f=_['keyBy'](_0x1e9ef4,'id');_0x10060d=_[_0xb340('0x94')](_0x10060d,{'model':db[_0xb340('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x596f18[_0xb340('0x35')][_0xb340('0x38')]){_0x463769[_0xb340('0x37')][_0xb340('0x30')](function(_0x53d754){_0x2fa111[_0xb340('0x42')]('i.'+_0x53d754);});}else{_0x2fa111[_0xb340('0x42')](_0xb340('0x87'),_0xb340('0x56'));_0x2fa111[_0xb340('0x42')]('a.key','Account.key');_0x2fa111[_0xb340('0x42')]('a.mandatoryDisposition',_0xb340('0x96'));_0x2fa111[_0xb340('0x42')]('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',_0xb340('0x88'));_0x2fa111[_0xb340('0x42')](_0xb340('0x97'));_0x2fa111[_0xb340('0x42')](_0xb340('0x98'),_0xb340('0x99'));_0x2fa111['field']('c.lastName',_0xb340('0x9a'));_0x2fa111[_0xb340('0x42')](_0xb340('0x9b'),'Contact.email');_0x2fa111[_0xb340('0x42')](_0xb340('0x9c'),'Contact.phone');_0x2fa111[_0xb340('0x42')](_0xb340('0x9d'),_0xb340('0x9e'));_0x2fa111[_0xb340('0x42')]('c.fax',_0xb340('0x9f'));_0x2fa111[_0xb340('0x42')](_0xb340('0xa0'),'Owner.fullname');_0x2fa111['field'](_0xb340('0xa1'),_0xb340('0xa2'));_0x2fa111['field'](_0xb340('0xa3'),_0xb340('0x2d'));}if(_0x463769['limit'])_0x2fa111['limit'](_0x463769[_0xb340('0x1d')]);if(_0x463769[_0xb340('0x1c')])_0x2fa111[_0xb340('0x1c')](_0x463769[_0xb340('0x1c')]);return db['sequelize'][_0xb340('0x35')](_0x2fa111[_0xb340('0x93')](),_0x10060d);})[_0xb340('0x26')](function(_0x49d967){if(_0x49d967[_0xb340('0x39')]>0x0)_0x298d10[_0xb340('0x3e')](_0xb340('0xa4'),_[_0xb340('0x31')](_0x49d967,'id'));return db[_0xb340('0x92')][_0xb340('0x35')](_0x298d10[_0xb340('0x93')](),_0x10060d)['then'](function(_0x5d7234){var _0x1b683e=_[_0xb340('0xa5')](_0x5d7234,_0xb340('0xa6'));var _0x16bff7=[];_0x49d967['forEach'](function(_0x5429c4){_0x16bff7['push'](updateWhatsappInteraction(_0x5429c4,_0x19529f,_0x1b683e));});return BPromise[_0xb340('0xa7')](_0x16bff7);});});})['then'](function(_0xff211c){_0x430308[_0xb340('0xa8')]=_0xff211c;return _0x430308;})[_0xb340('0x26')](respondWithFilteredResult(_0x5530a9,_0x463769))[_0xb340('0xa9')](handleError(_0x5530a9,null));};exports[_0xb340('0xaa')]=function(_0x32a588,_0x2937d3){var _0xc13180={'raw':![],'where':{'id':_0x32a588['params']['id']}},_0x5654a1={};_0x5654a1[_0xb340('0x34')]=_[_0xb340('0x67')](db[_0xb340('0x95')][_0xb340('0xab')]);_0x5654a1[_0xb340('0x35')]=_['keys'](_0x32a588['query']);_0x5654a1['filters']=_[_0xb340('0x36')](_0x5654a1[_0xb340('0x34')],_0x5654a1['query']);_0xc13180[_0xb340('0x37')]=_[_0xb340('0x36')](_0x5654a1[_0xb340('0x34')],qs[_0xb340('0x38')](_0x32a588[_0xb340('0x35')][_0xb340('0x38')]));_0xc13180[_0xb340('0x37')]=_0xc13180[_0xb340('0x37')][_0xb340('0x39')]?_0xc13180[_0xb340('0x37')]:_0x5654a1[_0xb340('0x34')];if(_0x32a588[_0xb340('0x35')][_0xb340('0xac')]){_0xc13180[_0xb340('0xad')]=[{'all':!![]}];}_0xc13180=_['merge']({},_0xc13180,_0x32a588[_0xb340('0xae')]);return db['WhatsappInteraction'][_0xb340('0x55')](_0xc13180)[_0xb340('0x26')](handleEntityNotFound(_0x2937d3,null))[_0xb340('0x26')](respondWithResult(_0x2937d3,null))['catch'](handleError(_0x2937d3,null));};exports[_0xb340('0xaf')]=function(_0x2b0f03,_0x24fc00){return db['WhatsappInteraction'][_0xb340('0xaf')](_0x2b0f03[_0xb340('0x66')],{})[_0xb340('0x26')](respondWithResult(_0x24fc00,0xc9))[_0xb340('0xa9')](handleError(_0x24fc00,null));};exports[_0xb340('0x25')]=function(_0x51cbc4,_0x25dba1){if(_0x51cbc4['body']['id']){delete _0x51cbc4[_0xb340('0x66')]['id'];}return db['WhatsappInteraction'][_0xb340('0x55')]({'where':{'id':_0x51cbc4[_0xb340('0xb0')]['id']}})[_0xb340('0x26')](handleEntityNotFound(_0x25dba1,null))[_0xb340('0x26')](saveUpdates(_0x51cbc4['body'],null))[_0xb340('0x26')](respondWithResult(_0x25dba1,null))[_0xb340('0xa9')](handleError(_0x25dba1,null));};exports['destroy']=function(_0x4ca357,_0x35920b){return db[_0xb340('0x95')][_0xb340('0x55')]({'where':{'id':_0x4ca357[_0xb340('0xb0')]['id']}})['then'](handleEntityNotFound(_0x35920b,null))[_0xb340('0x26')](removeEntity(_0x35920b,null))['catch'](handleError(_0x35920b,null));};exports[_0xb340('0xb1')]=function(_0xc1db0f,_0x4f909f){return db[_0xb340('0x95')][_0xb340('0xb1')]()['then'](respondWithResult(_0x4f909f,null))[_0xb340('0xa9')](handleError(_0x4f909f,null));};exports[_0xb340('0xb2')]=function(_0x47e443,_0x48e80e,_0x4e2e03){return db[_0xb340('0xb3')]['find']({'where':{'id':_0x47e443[_0xb340('0xb0')]['id']}})['then'](handleEntityNotFound(_0x48e80e,null))[_0xb340('0x26')](function(_0x303ff2){if(_0x303ff2){return _0x303ff2[_0xb340('0xb2')](_0x47e443[_0xb340('0x66')][_0xb340('0xb4')],_[_0xb340('0xb5')](_0x47e443[_0xb340('0x66')],[_0xb340('0xb4'),'id'])||{});}})[_0xb340('0x26')](respondWithResult(_0x48e80e,null))[_0xb340('0xa9')](handleError(_0x48e80e,null));};exports[_0xb340('0xb6')]=function(_0x2abacf,_0x2451b8,_0x5333a0){var _0x5d28aa={'raw':![],'where':{}};var _0x4c0e06={};var _0x12e266={'count':0x0,'rows':[]};return db[_0xb340('0x95')]['findOne']({'where':{'id':_0x2abacf[_0xb340('0xb0')]['id']}})[_0xb340('0x26')](handleEntityNotFound(_0x2451b8,null))[_0xb340('0x26')](function(_0xfe0d3){if(_0xfe0d3){_0x4c0e06[_0xb340('0x34')]=_[_0xb340('0x67')](db['WhatsappMessage'][_0xb340('0xab')]);_0x4c0e06[_0xb340('0x35')]=_[_0xb340('0x67')](_0x2abacf[_0xb340('0x35')]);_0x4c0e06[_0xb340('0x40')]=_[_0xb340('0x36')](_0x4c0e06[_0xb340('0x34')],_0x4c0e06['query']);_0x5d28aa[_0xb340('0x37')]=_['intersection'](_0x4c0e06[_0xb340('0x34')],qs[_0xb340('0x38')](_0x2abacf[_0xb340('0x35')]['fields']));_0x5d28aa[_0xb340('0x37')]=_0x5d28aa[_0xb340('0x37')][_0xb340('0x39')]?_0x5d28aa[_0xb340('0x37')]:_0x4c0e06[_0xb340('0x34')];if(!_0x2abacf[_0xb340('0x35')]['hasOwnProperty']('nolimit')){_0x5d28aa[_0xb340('0x1d')]=qs[_0xb340('0x1d')](_0x2abacf[_0xb340('0x35')][_0xb340('0x1d')]);_0x5d28aa['offset']=qs[_0xb340('0x1c')](_0x2abacf[_0xb340('0x35')]['offset']);}_0x5d28aa['order']=qs['sort'](_0x2abacf[_0xb340('0x35')][_0xb340('0x3d')]);_0x5d28aa[_0xb340('0x3e')]=qs[_0xb340('0x40')](_[_0xb340('0x3f')](_0x2abacf['query'],_0x4c0e06[_0xb340('0x40')]));_0x5d28aa[_0xb340('0x3e')][_0xb340('0xa6')]=_0xfe0d3['id'];if(_0x2abacf[_0xb340('0x35')]['filter']){_0x5d28aa[_0xb340('0x3e')]=_[_0xb340('0x94')](_0x5d28aa['where'],{'$or':_[_0xb340('0x31')](_0x5d28aa[_0xb340('0x37')],function(_0x26c474){var _0x2f2bf9={};_0x2f2bf9[_0x26c474]={'$like':'%'+_0x2abacf[_0xb340('0x35')]['filter']+'%'};return _0x2f2bf9;})});}if(_0x2abacf[_0xb340('0x35')][_0xb340('0x6e')]){var _0x1a016f=_0x2abacf['query'][_0xb340('0x6e')]['split'](',');var _0x3b0389={};_0x3b0389[_0x1a016f[0x0]]={'$gte':moment(_0x1a016f[0x1])[_0xb340('0xb7')](_0xb340('0xb8'))};_0x5d28aa['where']=_[_0xb340('0x94')](_0x5d28aa[_0xb340('0x3e')],_0x3b0389);}_0x5d28aa=_[_0xb340('0x94')]({},_0x5d28aa,_0x2abacf[_0xb340('0xae')]);return db[_0xb340('0xb3')][_0xb340('0x1e')]({'where':_0x5d28aa[_0xb340('0x3e')]})[_0xb340('0x26')](function(_0x24d62a){_0x12e266[_0xb340('0x1e')]=_0x24d62a;if(_0x2abacf[_0xb340('0x35')][_0xb340('0xac')]){_0x5d28aa['include']=[{'all':!![]}];}return db[_0xb340('0xb3')][_0xb340('0xb9')](_0x5d28aa);})[_0xb340('0x26')](function(_0x485cb9){_0x12e266[_0xb340('0xa8')]=_0x485cb9;return _0x12e266;});}})[_0xb340('0x26')](respondWithFilteredResult(_0x2451b8,_0x5d28aa))[_0xb340('0xa9')](handleError(_0x2451b8,null));};exports[_0xb340('0xba')]=function(_0x66623f,_0x28404d,_0x3453ba){return db[_0xb340('0x95')]['find']({'where':{'id':_0x66623f[_0xb340('0xb0')]['id']}})[_0xb340('0x26')](handleEntityNotFound(_0x28404d,null))['then'](function(_0x38a8e0){if(_0x38a8e0){return _0x38a8e0[_0xb340('0xbb')](_0x66623f[_0xb340('0x66')][_0xb340('0xb4')],_[_0xb340('0xb5')](_0x66623f[_0xb340('0x66')],[_0xb340('0xb4'),'id'])||{})['spread'](function(){return db[_0xb340('0x62')]['findAll']({'attributes':['id',_0xb340('0x29'),'color'],'where':{'id':_0x66623f['body'][_0xb340('0xb4')]}});})[_0xb340('0x26')](function(_0x56b2b3){socket[_0xb340('0xbc')](_0xb340('0xbd'),{'id':Number(_0x66623f[_0xb340('0xb0')]['id']),'tags':_0x56b2b3||[]});return{'id':Number(_0x66623f[_0xb340('0xb0')]['id']),'tags':_0x56b2b3||[]};});}})[_0xb340('0x26')](respondWithResult(_0x28404d,null))[_0xb340('0xa9')](handleError(_0x28404d,null));};exports[_0xb340('0xbe')]=function(_0x90ad03,_0x1a927b,_0x4c2baa){return db[_0xb340('0x95')][_0xb340('0x55')]({'where':{'id':_0x90ad03[_0xb340('0xb0')]['id']}})[_0xb340('0x26')](handleEntityNotFound(_0x1a927b,null))[_0xb340('0x26')](function(_0x3f5832){if(_0x3f5832){return _0x3f5832[_0xb340('0xbe')](_0x90ad03[_0xb340('0x35')][_0xb340('0xb4')]);}})[_0xb340('0x26')](respondWithStatusCode(_0x1a927b,null))[_0xb340('0xa9')](handleError(_0x1a927b,null));};exports[_0xb340('0xbf')]=function(_0x214a40,_0x37c2dd){var _0x142a68=moment()[_0xb340('0xc0')]()[_0xb340('0x93')]();var _0x1adbbd=path['join'](config['root'],_0xb340('0xc1'),_0xb340('0xc2'),_0xb340('0xc3'));var _0x42ef38=path[_0xb340('0xc4')](config[_0xb340('0xc5')],_0xb340('0xc1'),'files',_0xb340('0xc6'));var _0x36db84=path[_0xb340('0xc4')](_0x1adbbd,_0x142a68);var _0xae88a8=util['format'](_0xb340('0xc7'),_0x214a40['params']['id'],_0x142a68);var _0x241885=path[_0xb340('0xc4')](_0x1adbbd,_0xae88a8);var _0x31fef0=[];_0x31fef0[_0xb340('0xc8')]({'model':db['User'],'as':_0xb340('0xc9'),'attributes':['id',_0xb340('0x2c')],'raw':!![]});_0x31fef0['push']({'model':db[_0xb340('0xca')],'as':'Contact','attributes':['id',_0xb340('0xcb'),_0xb340('0xcc')],'raw':!![]});if(_0x214a40[_0xb340('0x35')][_0xb340('0xc6')]){_0x31fef0[_0xb340('0xc8')]({'model':db[_0xb340('0xcd')],'as':_0xb340('0xcd'),'raw':!![]});}var _0xc015dc=[{'model':db[_0xb340('0xb3')],'as':'Messages','attributes':['id','body',_0xb340('0x6d'),_0xb340('0xce'),_0xb340('0xcf'),_0xb340('0x74')],'include':_0x31fef0}];_0xc015dc[_0xb340('0xc8')]({'model':db[_0xb340('0xd0')],'as':'Account','attributes':['id',_0xb340('0x29')]});_0xc015dc[_0xb340('0xc8')]({'model':db[_0xb340('0xc9')],'as':_0xb340('0xd1'),'attributes':['id',_0xb340('0x2c')]});return db[_0xb340('0x95')][_0xb340('0x55')]({'where':{'id':_0x214a40[_0xb340('0xb0')]['id']},'include':_0xc015dc})[_0xb340('0x26')](handleEntityNotFound(_0x37c2dd,null))[_0xb340('0x26')](function(_0x151c54){if(_0x151c54){var _0x29808e=_0x151c54['get']({'plain':!![]});fs['mkdirSync'](_0x36db84);var _0x4c4a2e={'channel':_0xb340('0xd2'),'account':_0x29808e[_0xb340('0xd3')]['name'],'agent':_0x29808e[_0xb340('0xd1')]?_0x29808e['Owner'][_0xb340('0x2c')]:'N.A.','createdAt':moment(_0x29808e[_0xb340('0x6d')])[_0xb340('0xb7')](_0xb340('0xb8'))[_0xb340('0x93')](),'closedAt':_0x29808e[_0xb340('0xd4')]?moment(_0x29808e[_0xb340('0xd5')])[_0xb340('0xb7')](_0xb340('0xb8'))[_0xb340('0x93')]():'','disposition':_0x29808e['disposition'],'messages':_(_0x29808e['Messages'])[_0xb340('0x79')]({'secret':![]})['map'](function(_0x37c73f){if(_0x37c73f[_0xb340('0xcd')]){var _0x464601=path['join'](_0x42ef38,_0x37c73f[_0xb340('0xcd')][_0xb340('0xd6')]);if(fs[_0xb340('0xd7')](_0x464601)){fs['createReadStream'](_0x464601)[_0xb340('0xd8')](fs[_0xb340('0xd9')](path[_0xb340('0xc4')](_0x36db84,_0x37c73f[_0xb340('0xcd')][_0xb340('0xd6')])));}}return{'date':moment(_0x37c73f[_0xb340('0x6d')])[_0xb340('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb340('0x93')](),'sender':_0x37c73f[_0xb340('0xce')]===_0xb340('0xda')?_0x37c73f[_0xb340('0xc9')]?_0x37c73f[_0xb340('0xc9')]['fullname']:_0xb340('0xdb'):_0x37c73f[_0xb340('0xdc')][_0xb340('0xcb')]+(_0x37c73f['Contact'][_0xb340('0xcc')]?'\x20'+_0x37c73f[_0xb340('0xdc')][_0xb340('0xcc')]:''),'body':_0x37c73f[_0xb340('0xcd')]?_0x37c73f[_0xb340('0xcd')][_0xb340('0xd6')]:_0x37c73f[_0xb340('0x66')],'direction':_0x37c73f[_0xb340('0xce')]==='out'?'A':'C','secret':_0x37c73f[_0xb340('0xcf')],'read':_0x37c73f[_0xb340('0x74')],'attachment':_0x37c73f[_0xb340('0xcd')]};})[_0xb340('0x57')]()};return ejs[_0xb340('0xdd')](path[_0xb340('0xc4')](config[_0xb340('0xc5')],_0xb340('0xc1'),_0xb340('0xde'),_0xb340('0xdf')),{'interaction':_0x4c4a2e})[_0xb340('0x26')](function(_0x10e860){var _0x5519fb=path[_0xb340('0xc4')](_0x36db84,_0xb340('0xe0')+_0x29808e['id']+'-'+_0x142a68+'.pdf');var _0x10e18e={'path':_0x5519fb,'channel':_0xb340('0xd2'),'interactionId':_0x29808e['id']};return pdf[_0xb340('0xe1')](_0x10e860,_0x10e18e);})['then'](function(){return new BPromise(function(_0x144769,_0x97068e){zipdir(_0x36db84,{'saveTo':_0x241885},function(_0x382a71,_0x47dcea){if(_0x382a71)return _0x97068e(_0x382a71);return _0x144769(_0x47dcea);});})['then'](function(){return new BPromise(function(_0x3f2a13,_0x5b917b){rimraf(_0x36db84,function(_0x455675){if(_0x455675)_0x5b917b(_0x455675);return _0x3f2a13();});});})[_0xb340('0x26')](function(){return _0x37c2dd['download'](_0x241885,_0xae88a8,function(_0x128a6c){if(_0x128a6c){console[_0xb340('0xe2')]('err',_0x128a6c);}else{fs[_0xb340('0xe3')](_0x241885);}});});});}else{return _0x37c2dd[_0xb340('0x19')](0xc8);}})[_0xb340('0xa9')](handleError(_0x37c2dd,null));}; \ No newline at end of file +var _0xe13e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','some','compact','WhatsappAccountId','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','role','sequelize','toString','count','keyBy','merge','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.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','includeAll','include','options','create','body','params','describe','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','pick','YYYY-MM-DD\x20HH:mm:ss','spread','findAll','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','tmp','attachments','join','push','firstName','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','format','closedAt','existsSync','pipe','createWriteStream','basename','out','System','lastName','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x38837d,_0x27d645){var _0x3c13d8=function(_0x3560bc){while(--_0x3560bc){_0x38837d['push'](_0x38837d['shift']());}};_0x3c13d8(++_0x27d645);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee13('0x0'));var jsonpatch=require(_0xee13('0x1'));var rp=require(_0xee13('0x2'));var moment=require(_0xee13('0x3'));var BPromise=require(_0xee13('0x4'));var Mustache=require(_0xee13('0x5'));var util=require(_0xee13('0x6'));var path=require(_0xee13('0x7'));var sox=require(_0xee13('0x8'));var csv=require(_0xee13('0x9'));var ejs=require(_0xee13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee13('0xb'));var squel=require(_0xee13('0xc'));var crypto=require(_0xee13('0xd'));var jsforce=require(_0xee13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xee13('0x9'));var querystring=require(_0xee13('0xf'));var Papa=require(_0xee13('0x10'));var Redis=require(_0xee13('0x11'));var authService=require(_0xee13('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xee13('0x13'));var pdf=require(_0xee13('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee13('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xee13('0x16'));var db=require('../../mysqldb')['db'];config[_0xee13('0x17')]=_[_0xee13('0x18')](config[_0xee13('0x17')],{'host':_0xee13('0x19'),'port':0x18eb});var socket=require(_0xee13('0x1a'))(new Redis(config[_0xee13('0x17')]));require(_0xee13('0x1b'))['register'](socket);function respondWithStatusCode(_0x383ca0,_0x174b02){_0x174b02=_0x174b02||0xcc;return function(_0xafe3d8){if(_0xafe3d8){return _0x383ca0['sendStatus'](_0x174b02);}return _0x383ca0[_0xee13('0x1c')](_0x174b02)[_0xee13('0x1d')]();};}function respondWithResult(_0x4cc57c,_0x3bcd50){_0x3bcd50=_0x3bcd50||0xc8;return function(_0xcd1482){if(_0xcd1482){return _0x4cc57c[_0xee13('0x1c')](_0x3bcd50)[_0xee13('0x1e')](_0xcd1482);}};}function respondWithFilteredResult(_0x2513b2,_0x3a5819){return function(_0xd353d0){if(_0xd353d0){var _0x33bd9c=typeof _0x3a5819[_0xee13('0x1f')]===_0xee13('0x20')&&typeof _0x3a5819['limit']===_0xee13('0x20');var _0x1ab3f8=_0xd353d0['count'];var _0x374f8a=_0x33bd9c?0x0:_0x3a5819['offset'];var _0x17e664=_0x33bd9c?_0xd353d0['count']:_0x3a5819[_0xee13('0x1f')]+_0x3a5819[_0xee13('0x21')];var _0x51e2d0;if(_0x17e664>=_0x1ab3f8){_0x17e664=_0x1ab3f8;_0x51e2d0=0xc8;}else{_0x51e2d0=0xce;}_0x2513b2[_0xee13('0x1c')](_0x51e2d0);return _0x2513b2[_0xee13('0x22')](_0xee13('0x23'),_0x374f8a+'-'+_0x17e664+'/'+_0x1ab3f8)[_0xee13('0x1e')](_0xd353d0);}return null;};}function patchUpdates(_0x3d5354){return function(_0x57a9e2){try{jsonpatch[_0xee13('0x24')](_0x57a9e2,_0x3d5354,!![]);}catch(_0x46bd44){return BPromise['reject'](_0x46bd44);}return _0x57a9e2[_0xee13('0x25')]();};}function saveUpdates(_0x4fe9b8,_0x839455){return function(_0x5170eb){if(_0x5170eb){return _0x5170eb['update'](_0x4fe9b8)[_0xee13('0x26')](function(_0x323e1e){return _0x323e1e;});}return null;};}function removeEntity(_0x49eddd,_0x2b5f64){return function(_0x37cf4b){if(_0x37cf4b){return _0x37cf4b[_0xee13('0x27')]()['then'](function(){_0x49eddd['status'](0xcc)[_0xee13('0x1d')]();});}};}function handleEntityNotFound(_0x2c42fa,_0x257323){return function(_0xa7a06b){if(!_0xa7a06b){_0x2c42fa[_0xee13('0x28')](0x194);}return _0xa7a06b;};}function handleError(_0x1247aa,_0x148477){_0x148477=_0x148477||0x1f4;return function(_0x29ddad){logger[_0xee13('0x29')](_0x29ddad[_0xee13('0x2a')]);if(_0x29ddad[_0xee13('0x2b')]){delete _0x29ddad[_0xee13('0x2b')];}_0x1247aa[_0xee13('0x1c')](_0x148477)[_0xee13('0x2c')](_0x29ddad);};}function getInteractionUsers(_0xb6fc02,_0x122983){return new BPromise(function(_0x4bc1f6,_0x4d9211){try{if(_0x122983[_0xb6fc02['id']]){_0xb6fc02[_0xee13('0x2d')]=_[_0xee13('0x2e')](_0x122983[_0xb6fc02['id']],function(_0x399242){return{'id':_0x399242['id'],'fullname':_0x399242[_0xee13('0x2f')]};});}}catch(_0x577575){_0x4d9211(_0x577575);}_0x4bc1f6(_0xb6fc02);});}function getInteractionTags(_0x306290,_0x43be46){return new BPromise(function(_0x3201db,_0xd052f6){try{if(_0x306290[_0xee13('0x30')]){_0x306290[_0xee13('0x31')]=[];_0x306290[_0xee13('0x30')][_0xee13('0x32')](',')[_0xee13('0x33')](function(_0x4fbc2b){_0x306290[_0xee13('0x31')]['push'](_0x43be46[_0x4fbc2b]);});}delete _0x306290['TagIds'];}catch(_0x2e3e48){_0xd052f6(_0x2e3e48);}_0x3201db(_0x306290);});}function updateWhatsappInteraction(_0x503a80,_0x226c0e,_0x5c593b){return new BPromise(function(_0x4739f0,_0x966052){return getInteractionUsers(_0x503a80,_0x5c593b)[_0xee13('0x26')](function(_0x2e2714){return getInteractionTags(_0x2e2714,_0x226c0e);})[_0xee13('0x26')](function(_0x36e39e){_0x4739f0(_0x36e39e);})[_0xee13('0x34')](function(_0x42ced5){_0x966052(_0x42ced5);});});}exports[_0xee13('0x35')]=function(_0x5cef12,_0x16ab86){var _0x21dde2={},_0xcaec77={},_0x5b080a={'count':0x0,'rows':[]};var _0x6faeb7=_[_0xee13('0x2e')](db[_0xee13('0x36')][_0xee13('0x37')],function(_0x647a47){return{'name':_0x647a47[_0xee13('0x38')],'type':_0x647a47['type'][_0xee13('0x39')]};});_0xcaec77[_0xee13('0x3a')]=_[_0xee13('0x2e')](_0x6faeb7,'name');_0xcaec77[_0xee13('0x3b')]=_[_0xee13('0x3c')](_0x5cef12['query']);_0xcaec77[_0xee13('0x3d')]=_[_0xee13('0x3e')](_0xcaec77[_0xee13('0x3a')],_0xcaec77[_0xee13('0x3b')]);_0x21dde2[_0xee13('0x3f')]=_['intersection'](_0xcaec77['model'],qs[_0xee13('0x40')](_0x5cef12[_0xee13('0x3b')][_0xee13('0x40')]));_0x21dde2[_0xee13('0x3f')]=_0x21dde2[_0xee13('0x3f')][_0xee13('0x41')]?_0x21dde2[_0xee13('0x3f')]:_0xcaec77[_0xee13('0x3a')];if(!_0x5cef12[_0xee13('0x3b')]['hasOwnProperty'](_0xee13('0x42'))){_0x21dde2[_0xee13('0x21')]=qs[_0xee13('0x21')](_0x5cef12[_0xee13('0x3b')]['limit']);_0x21dde2['offset']=qs['offset'](_0x5cef12[_0xee13('0x3b')]['offset']);}_0x21dde2['order']=qs[_0xee13('0x43')](_0x5cef12['query'][_0xee13('0x43')]);_0x21dde2[_0xee13('0x44')]=qs[_0xee13('0x3d')](_['pick'](_0x5cef12[_0xee13('0x3b')],_0xcaec77[_0xee13('0x3d')]),_0x6faeb7);var _0x5ab5b7=[];var _0x51c08b=squel['select']()[_0xee13('0x45')]('id')['field'](_0xee13('0x2b'))[_0xee13('0x45')](_0xee13('0x46'))[_0xee13('0x47')](_0xee13('0x48'));var _0x1642e1=squel[_0xee13('0x49')]()[_0xee13('0x45')](_0xee13('0x4a'))[_0xee13('0x45')](_0xee13('0x4b'))[_0xee13('0x45')](_0xee13('0x4c'))[_0xee13('0x47')](_0xee13('0x4d'),'ui')[_0xee13('0x4e')](_0xee13('0x4f'),'u',_0xee13('0x50'));var _0x10c111=squel[_0xee13('0x49')]()[_0xee13('0x47')](_0xee13('0x51'),'i')[_0xee13('0x4e')](_0xee13('0x52'),'c',_0xee13('0x53'))[_0xee13('0x4e')]('users','o',_0xee13('0x54'))[_0xee13('0x4e')](_0xee13('0x55'),'a',_0xee13('0x56'))[_0xee13('0x4e')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xee13('0x57'),'it',_0xee13('0x58'))[_0xee13('0x4e')](_0xee13('0x48'),'t',_0xee13('0x59'));var _0x17e7e2=squel[_0xee13('0x5a')]();var _0x4f97dd=[];var _0x362cd9=squel[_0xee13('0x5a')]();var _0x225eda;if(_0x5cef12[_0xee13('0x3b')]['search']){_0x225eda=as[_0xee13('0x5b')](_0x5cef12[_0xee13('0x3b')]['search']);var _0x5c13b7=_0x225eda[_0xee13('0x5c')];for(var _0x4356bf=0x0;_0x4356bf<_0x225eda[_0xee13('0x5d')][_0xee13('0x41')];_0x4356bf++){var _0x1d6157=_0x225eda[_0xee13('0x5d')][_0x4356bf];var _0x39bbf1='i';var _0x17a8ec=_['find'](_0x6faeb7,[_0xee13('0x2b'),_0x1d6157[_0xee13('0x45')]]);if(!_0x17a8ec){switch(_0x1d6157[_0xee13('0x45')]){case _0xee13('0x5e'):if(_0x1d6157['value']==0x1){_0x10c111[_0xee13('0x5f')]('`'+_0x1d6157['field']+'`\x20=\x200');}else{_0x10c111[_0xee13('0x5f')]('`'+_0x1d6157['field']+_0xee13('0x60'));}break;case _0xee13('0x61'):if(_0x1d6157[_0xee13('0x62')]===_0xee13('0x63')){if(_0x1d6157[_0xee13('0x64')]['split']('\x20')[_0xee13('0x41')]>0x1){_0x17e7e2[_0x5c13b7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee13('0x65')](_0x1d6157[_0xee13('0x64')]),null);}else{var _0x19d054='%'+_0x1d6157[_0xee13('0x64')]+'%';_0x17e7e2[_0x5c13b7](_0xee13('0x66'),_0x19d054,_0x19d054,_0x19d054);}}else{_0x17a8ec=_[_0xee13('0x67')](_0x6faeb7,[_0xee13('0x2b'),_0xee13('0x68')]);_0x1d6157['field']=_0xee13('0x68');_0x1c30ed=as[_0xee13('0x69')](_0x39bbf1,_0x17a8ec['type'],_0x1d6157);_0x17e7e2[_0x5c13b7](_0x1c30ed[_0xee13('0x6a')],_0x1c30ed[_0xee13('0x64')][_0xee13('0x6b')],_0x1c30ed[_0xee13('0x64')]['end']);}break;case _0xee13('0x6c'):var _0x2aa091=_0x1d6157[_0xee13('0x64')][_0xee13('0x32')](',')[_0xee13('0x2e')](function(_0x11f747){return Number(_0x11f747);});_0x2aa091['forEach'](function(_0x3c8713){_0x362cd9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c8713+',%');});_0x4f97dd=_[_0xee13('0x6d')](_0x4f97dd,_0x2aa091);break;case _0xee13('0x6e'):if(_0x1d6157['operator']===_0xee13('0x63')){_0x17e7e2[_0x5c13b7](_0xee13('0x6f'),'%'+_0x1d6157[_0xee13('0x64')]+'%',null);}else{_0x17a8ec=_['find'](_0x6faeb7,[_0xee13('0x2b'),'UserId']);_0x1d6157[_0xee13('0x45')]='UserId';_0x1c30ed=as[_0xee13('0x69')](_0x39bbf1,_0x17a8ec[_0xee13('0x70')],_0x1d6157);_0x17e7e2[_0x5c13b7](_0x1c30ed[_0xee13('0x6a')],_0x1c30ed[_0xee13('0x64')][_0xee13('0x6b')],_0x1c30ed['value'][_0xee13('0x1d')]);}break;case'body':_0x1c30ed=as[_0xee13('0x69')]('me',null,_0x1d6157);_0x17e7e2[_0x5c13b7](_0x1c30ed[_0xee13('0x6a')],_0x1c30ed[_0xee13('0x64')]['start'],_0x1c30ed['value'][_0xee13('0x1d')]);break;}}else{var _0x1c30ed=as[_0xee13('0x69')](_0x39bbf1,_0x17a8ec[_0xee13('0x70')],_0x1d6157);_0x17e7e2[_0x5c13b7](_0x1c30ed[_0xee13('0x6a')],_0x1c30ed[_0xee13('0x64')][_0xee13('0x6b')],_0x1c30ed['value'][_0xee13('0x1d')]);}}}else{var _0x165a88=_(_0x5cef12[_0xee13('0x3b')])[_0xee13('0x3c')]()[_0xee13('0x2e')](function(_0x25ef35){return _[_0xee13('0x71')](_0x6faeb7,[_0xee13('0x2b'),_0x25ef35])?_0x25ef35:undefined;})[_0xee13('0x72')]()[_0xee13('0x64')]();if(!_['isEmpty'](_0x165a88)){_0x165a88[_0xee13('0x33')](function(_0x16a56f){if(_0x16a56f===_0xee13('0x73')){_0x10c111[_0xee13('0x44')]('i.WhatsappAccountId\x20IN\x20?',[][_0xee13('0x74')](_0x5cef12[_0xee13('0x3b')][_0x16a56f]));}else if(_0x16a56f==='createdAt'){var _0x4ae336=JSON[_0xee13('0x75')](_0x5cef12['query'][_0x16a56f])[_0xee13('0x76')];var _0x3395d0=JSON[_0xee13('0x75')](_0x5cef12['query'][_0x16a56f])['$lte'];_0x10c111[_0xee13('0x44')](_0xee13('0x77'),_0x4ae336,_0x3395d0);}else{if(_0x5cef12[_0xee13('0x3b')][_0x16a56f]===_0xee13('0x78')){_0x10c111[_0xee13('0x44')]('i.'+_0x16a56f+'\x20IS\x20NULL');}else{_0x10c111[_0xee13('0x44')]('i.'+_0x16a56f+_0xee13('0x79'),_0x5cef12[_0xee13('0x3b')][_0x16a56f]);}}});}if(_0x5cef12[_0xee13('0x3b')][_0xee13('0x7a')]){if(_0x5cef12[_0xee13('0x3b')][_0xee13('0x7a')]==0x1){_0x10c111[_0xee13('0x5f')](_0xee13('0x7b'));}else{_0x10c111[_0xee13('0x5f')](_0xee13('0x7c'));}}if(_0x5cef12['query']['tag']){_0x4f97dd=_[_0xee13('0x7d')](_0x5cef12[_0xee13('0x3b')][_0xee13('0x7e')])?_0x5cef12['query'][_0xee13('0x7e')]:new Array(_0x5cef12[_0xee13('0x3b')][_0xee13('0x7e')]);_0x4f97dd['forEach'](function(_0x58bb5b){_0x362cd9['or'](_0xee13('0x7f'),'%,'+_0x58bb5b+',%');});}if(_0x5cef12['query'][_0xee13('0x80')]){var _0x549c7e=_0x5cef12[_0xee13('0x3b')][_0xee13('0x80')]['replace']('\x5c','\x5c\x5c')[_0xee13('0x81')](/'/g,'\x27\x27');if(qs[_0xee13('0x82')](_0x549c7e)){_0x17e7e2['or'](_0xee13('0x83'),_0x549c7e+'%')['or'](_0xee13('0x84'),_0x549c7e+'%');}else{_0x17e7e2['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee13('0x65')](_0x549c7e))['or'](_0xee13('0x85'),_0x549c7e+'%');}}}_0x10c111[_0xee13('0x44')](_0x17e7e2);_0x10c111['group'](_0xee13('0x86'));var _0x394e05={'type':db[_0xee13('0x87')][_0xee13('0x88')][_0xee13('0x89')],'raw':!![]};var _0x4a57bb=_0x10c111[_0xee13('0x8a')]();_0x4a57bb[_0xee13('0x45')](_0xee13('0x86'));_0x4a57bb['field'](_0xee13('0x8b'),_0xee13('0x5e'));if(_0x21dde2[_0xee13('0x8c')]){_0x21dde2[_0xee13('0x8c')]['forEach'](function(_0xad5e8f){var _0x24f2b8=_0xad5e8f[0x0]===_0xee13('0x8d')?_0xad5e8f[0x0]:'i.'+_0xad5e8f[0x0];_0x10c111[_0xee13('0x8c')](_0x24f2b8,_0xad5e8f[0x1]===_0xee13('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x4f97dd)){_0x10c111[_0xee13('0x5f')](_0x362cd9);_0x4a57bb['where'](_0xee13('0x8f'),_0x4f97dd);}BPromise[_0xee13('0x90')]()[_0xee13('0x26')](function(){if(!_0x225eda){if(_0x5cef12[_0xee13('0x3b')]['WhatsappAccountId'])return;_0x4a57bb[_0xee13('0x44')](_0xee13('0x91'));_0x10c111[_0xee13('0x44')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5cef12[_0xee13('0x92')]['role']!==_0xee13('0x93'))return;return _0x5cef12[_0xee13('0x92')][_0xee13('0x94')]({'attributes':['id'],'raw':!![]})[_0xee13('0x26')](function(_0x120c53){if(_[_0xee13('0x95')](_0x120c53)){_0x4a57bb[_0xee13('0x44')]('i.WhatsappAccountId\x20IS\x20NULL');_0x10c111[_0xee13('0x44')](_0xee13('0x96'));}else{_0x4a57bb['where'](_0xee13('0x97'),_[_0xee13('0x2e')](_0x120c53,'id'));_0x10c111['where'](_0xee13('0x97'),_['map'](_0x120c53,'id'));}});})['then'](function(){if(_0x5cef12[_0xee13('0x92')][_0xee13('0x98')]==='agent'&&!_0x225eda&&!_0x5cef12['query'][_0xee13('0x73')])return[];return db[_0xee13('0x99')][_0xee13('0x3b')](_0x4a57bb[_0xee13('0x9a')](),_0x394e05);})['then'](function(_0x328ce5){_0x5b080a[_0xee13('0x9b')]=_0x328ce5[_0xee13('0x41')];if(_0x5b080a['count']===0x0)return[];return db[_0xee13('0x99')]['query'](_0x51c08b['toString'](),_0x394e05)[_0xee13('0x26')](function(_0x3abb70){_0x5ab5b7=_[_0xee13('0x9c')](_0x3abb70,'id');_0x394e05=_[_0xee13('0x9d')](_0x394e05,{'model':db[_0xee13('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5cef12[_0xee13('0x3b')]['fields']){_0x21dde2[_0xee13('0x3f')][_0xee13('0x33')](function(_0x232492){_0x10c111[_0xee13('0x45')]('i.'+_0x232492);});}else{_0x10c111[_0xee13('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xee13('0x5e'));_0x10c111['field']('a.key',_0xee13('0x9e'));_0x10c111[_0xee13('0x45')](_0xee13('0x9f'),_0xee13('0xa0'));_0x10c111['field'](_0xee13('0xa1'),_0xee13('0x8d'));_0x10c111[_0xee13('0x45')](_0xee13('0xa2'));_0x10c111['field']('c.firstName',_0xee13('0xa3'));_0x10c111[_0xee13('0x45')](_0xee13('0xa4'),'Contact.lastName');_0x10c111[_0xee13('0x45')](_0xee13('0xa5'),_0xee13('0xa6'));_0x10c111[_0xee13('0x45')](_0xee13('0xa7'),_0xee13('0xa8'));_0x10c111[_0xee13('0x45')](_0xee13('0xa9'),_0xee13('0xaa'));_0x10c111[_0xee13('0x45')](_0xee13('0xab'),_0xee13('0xac'));_0x10c111['field'](_0xee13('0xad'),'Owner.fullname');_0x10c111[_0xee13('0x45')](_0xee13('0xae'),'Owner.internal');_0x10c111['field'](_0xee13('0xaf'),'TagIds');}if(_0x21dde2[_0xee13('0x21')])_0x10c111[_0xee13('0x21')](_0x21dde2[_0xee13('0x21')]);if(_0x21dde2[_0xee13('0x1f')])_0x10c111['offset'](_0x21dde2[_0xee13('0x1f')]);return db[_0xee13('0x99')][_0xee13('0x3b')](_0x10c111[_0xee13('0x9a')](),_0x394e05);})[_0xee13('0x26')](function(_0x482fc0){if(_0x482fc0[_0xee13('0x41')]>0x0)_0x1642e1[_0xee13('0x44')](_0xee13('0xb0'),_[_0xee13('0x2e')](_0x482fc0,'id'));return db['sequelize']['query'](_0x1642e1[_0xee13('0x9a')](),_0x394e05)[_0xee13('0x26')](function(_0x28c93b){var _0x5997db=_[_0xee13('0xb1')](_0x28c93b,_0xee13('0xb2'));var _0xdd5d06=[];_0x482fc0[_0xee13('0x33')](function(_0x2eb74a){_0xdd5d06['push'](updateWhatsappInteraction(_0x2eb74a,_0x5ab5b7,_0x5997db));});return BPromise[_0xee13('0xb3')](_0xdd5d06);});});})[_0xee13('0x26')](function(_0x1bd189){_0x5b080a[_0xee13('0xb4')]=_0x1bd189;return _0x5b080a;})[_0xee13('0x26')](respondWithFilteredResult(_0x16ab86,_0x21dde2))[_0xee13('0x34')](handleError(_0x16ab86,null));};exports[_0xee13('0xb5')]=function(_0xb71f7,_0x33f1d6){var _0x2133cb={'raw':![],'where':{'id':_0xb71f7['params']['id']}},_0x4344d2={};_0x4344d2[_0xee13('0x3a')]=_[_0xee13('0x3c')](db[_0xee13('0x36')][_0xee13('0x37')]);_0x4344d2[_0xee13('0x3b')]=_[_0xee13('0x3c')](_0xb71f7['query']);_0x4344d2[_0xee13('0x3d')]=_[_0xee13('0x3e')](_0x4344d2[_0xee13('0x3a')],_0x4344d2[_0xee13('0x3b')]);_0x2133cb[_0xee13('0x3f')]=_['intersection'](_0x4344d2['model'],qs[_0xee13('0x40')](_0xb71f7[_0xee13('0x3b')][_0xee13('0x40')]));_0x2133cb[_0xee13('0x3f')]=_0x2133cb[_0xee13('0x3f')][_0xee13('0x41')]?_0x2133cb[_0xee13('0x3f')]:_0x4344d2[_0xee13('0x3a')];if(_0xb71f7['query'][_0xee13('0xb6')]){_0x2133cb[_0xee13('0xb7')]=[{'all':!![]}];}_0x2133cb=_[_0xee13('0x9d')]({},_0x2133cb,_0xb71f7[_0xee13('0xb8')]);return db[_0xee13('0x36')][_0xee13('0x67')](_0x2133cb)[_0xee13('0x26')](handleEntityNotFound(_0x33f1d6,null))[_0xee13('0x26')](respondWithResult(_0x33f1d6,null))[_0xee13('0x34')](handleError(_0x33f1d6,null));};exports[_0xee13('0xb9')]=function(_0x376461,_0x44008c){return db[_0xee13('0x36')][_0xee13('0xb9')](_0x376461[_0xee13('0xba')],{})[_0xee13('0x26')](respondWithResult(_0x44008c,0xc9))[_0xee13('0x34')](handleError(_0x44008c,null));};exports['update']=function(_0x13a3de,_0x17527a){if(_0x13a3de[_0xee13('0xba')]['id']){delete _0x13a3de[_0xee13('0xba')]['id'];}return db[_0xee13('0x36')][_0xee13('0x67')]({'where':{'id':_0x13a3de[_0xee13('0xbb')]['id']}})[_0xee13('0x26')](handleEntityNotFound(_0x17527a,null))[_0xee13('0x26')](saveUpdates(_0x13a3de[_0xee13('0xba')],null))[_0xee13('0x26')](respondWithResult(_0x17527a,null))[_0xee13('0x34')](handleError(_0x17527a,null));};exports['destroy']=function(_0x1b75de,_0x560c4b){return db[_0xee13('0x36')][_0xee13('0x67')]({'where':{'id':_0x1b75de[_0xee13('0xbb')]['id']}})[_0xee13('0x26')](handleEntityNotFound(_0x560c4b,null))[_0xee13('0x26')](removeEntity(_0x560c4b,null))[_0xee13('0x34')](handleError(_0x560c4b,null));};exports[_0xee13('0xbc')]=function(_0x38d3c5,_0x423e64){return db[_0xee13('0x36')][_0xee13('0xbc')]()[_0xee13('0x26')](respondWithResult(_0x423e64,null))['catch'](handleError(_0x423e64,null));};exports['addMessage']=function(_0x2a5aff,_0x50b8b1,_0x5cd5dc){return db['WhatsappMessage'][_0xee13('0x67')]({'where':{'id':_0x2a5aff[_0xee13('0xbb')]['id']}})[_0xee13('0x26')](handleEntityNotFound(_0x50b8b1,null))[_0xee13('0x26')](function(_0x25e8fd){if(_0x25e8fd){return _0x25e8fd['addMessage'](_0x2a5aff[_0xee13('0xba')][_0xee13('0xbd')],_[_0xee13('0xbe')](_0x2a5aff['body'],[_0xee13('0xbd'),'id'])||{});}})['then'](respondWithResult(_0x50b8b1,null))['catch'](handleError(_0x50b8b1,null));};exports[_0xee13('0xbf')]=function(_0x1f01c2,_0x4feeb9,_0x3c4714){var _0x127f7c={'raw':![],'where':{}};var _0x49ef27={};var _0x286cc1={'count':0x0,'rows':[]};return db[_0xee13('0x36')][_0xee13('0xc0')]({'where':{'id':_0x1f01c2[_0xee13('0xbb')]['id']}})[_0xee13('0x26')](handleEntityNotFound(_0x4feeb9,null))[_0xee13('0x26')](function(_0x27a3ef){if(_0x27a3ef){_0x49ef27['model']=_[_0xee13('0x3c')](db[_0xee13('0xc1')]['rawAttributes']);_0x49ef27['query']=_['keys'](_0x1f01c2['query']);_0x49ef27[_0xee13('0x3d')]=_[_0xee13('0x3e')](_0x49ef27['model'],_0x49ef27[_0xee13('0x3b')]);_0x127f7c[_0xee13('0x3f')]=_[_0xee13('0x3e')](_0x49ef27[_0xee13('0x3a')],qs[_0xee13('0x40')](_0x1f01c2[_0xee13('0x3b')][_0xee13('0x40')]));_0x127f7c[_0xee13('0x3f')]=_0x127f7c['attributes'][_0xee13('0x41')]?_0x127f7c['attributes']:_0x49ef27[_0xee13('0x3a')];if(!_0x1f01c2['query'][_0xee13('0xc2')](_0xee13('0x42'))){_0x127f7c[_0xee13('0x21')]=qs[_0xee13('0x21')](_0x1f01c2[_0xee13('0x3b')]['limit']);_0x127f7c['offset']=qs[_0xee13('0x1f')](_0x1f01c2[_0xee13('0x3b')]['offset']);}_0x127f7c[_0xee13('0x8c')]=qs[_0xee13('0x43')](_0x1f01c2['query']['sort']);_0x127f7c[_0xee13('0x44')]=qs[_0xee13('0x3d')](_[_0xee13('0xc3')](_0x1f01c2[_0xee13('0x3b')],_0x49ef27[_0xee13('0x3d')]));_0x127f7c[_0xee13('0x44')][_0xee13('0xb2')]=_0x27a3ef['id'];if(_0x1f01c2[_0xee13('0x3b')][_0xee13('0x80')]){_0x127f7c[_0xee13('0x44')]=_['merge'](_0x127f7c[_0xee13('0x44')],{'$or':_[_0xee13('0x2e')](_0x127f7c[_0xee13('0x3f')],function(_0x5db012){var _0x572272={};_0x572272[_0x5db012]={'$like':'%'+_0x1f01c2[_0xee13('0x3b')][_0xee13('0x80')]+'%'};return _0x572272;})});}if(_0x1f01c2[_0xee13('0x3b')][_0xee13('0x76')]){var _0x26a86e=_0x1f01c2['query'][_0xee13('0x76')]['split'](',');var _0x59bc41={};_0x59bc41[_0x26a86e[0x0]]={'$gte':moment(_0x26a86e[0x1])['format'](_0xee13('0xc4'))};_0x127f7c[_0xee13('0x44')]=_[_0xee13('0x9d')](_0x127f7c[_0xee13('0x44')],_0x59bc41);}_0x127f7c=_[_0xee13('0x9d')]({},_0x127f7c,_0x1f01c2[_0xee13('0xb8')]);return db['WhatsappMessage']['count']({'where':_0x127f7c['where']})[_0xee13('0x26')](function(_0x5a2545){_0x286cc1['count']=_0x5a2545;if(_0x1f01c2['query'][_0xee13('0xb6')]){_0x127f7c['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x127f7c);})[_0xee13('0x26')](function(_0x698777){_0x286cc1[_0xee13('0xb4')]=_0x698777;return _0x286cc1;});}})[_0xee13('0x26')](respondWithFilteredResult(_0x4feeb9,_0x127f7c))[_0xee13('0x34')](handleError(_0x4feeb9,null));};exports['addTags']=function(_0x61cb59,_0x386f5e,_0x2efb52){return db[_0xee13('0x36')][_0xee13('0x67')]({'where':{'id':_0x61cb59[_0xee13('0xbb')]['id']}})[_0xee13('0x26')](handleEntityNotFound(_0x386f5e,null))[_0xee13('0x26')](function(_0x35cc97){if(_0x35cc97){return _0x35cc97['setTags'](_0x61cb59[_0xee13('0xba')][_0xee13('0xbd')],_[_0xee13('0xbe')](_0x61cb59[_0xee13('0xba')],[_0xee13('0xbd'),'id'])||{})[_0xee13('0xc5')](function(){return db[_0xee13('0x6c')][_0xee13('0xc6')]({'attributes':['id','name',_0xee13('0x46')],'where':{'id':_0x61cb59[_0xee13('0xba')][_0xee13('0xbd')]}});})[_0xee13('0x26')](function(_0x3fb4b5){socket[_0xee13('0xc7')](_0xee13('0xc8'),{'id':Number(_0x61cb59[_0xee13('0xbb')]['id']),'tags':_0x3fb4b5||[]});return{'id':Number(_0x61cb59[_0xee13('0xbb')]['id']),'tags':_0x3fb4b5||[]};});}})[_0xee13('0x26')](respondWithResult(_0x386f5e,null))[_0xee13('0x34')](handleError(_0x386f5e,null));};exports[_0xee13('0xc9')]=function(_0x203aec,_0x56e001,_0x58aacc){return db[_0xee13('0x36')][_0xee13('0x67')]({'where':{'id':_0x203aec[_0xee13('0xbb')]['id']}})[_0xee13('0x26')](handleEntityNotFound(_0x56e001,null))[_0xee13('0x26')](function(_0x724c4b){if(_0x724c4b){return _0x724c4b['removeTags'](_0x203aec[_0xee13('0x3b')]['ids']);}})[_0xee13('0x26')](respondWithStatusCode(_0x56e001,null))[_0xee13('0x34')](handleError(_0x56e001,null));};exports['download']=function(_0x5a0940,_0x5e0d01){var _0x1a4f14=moment()[_0xee13('0xca')]()[_0xee13('0x9a')]();var _0x3d85ed=path['join'](config[_0xee13('0xcb')],_0xee13('0xcc'),_0xee13('0xcd'),_0xee13('0xce'));var _0x4e72af=path['join'](config[_0xee13('0xcb')],_0xee13('0xcc'),_0xee13('0xcd'),_0xee13('0xcf'));var _0x3c73d7=path[_0xee13('0xd0')](_0x3d85ed,_0x1a4f14);var _0x47b0cc=util['format']('transcript-%d-%s.zip',_0x5a0940[_0xee13('0xbb')]['id'],_0x1a4f14);var _0x4d7054=path[_0xee13('0xd0')](_0x3d85ed,_0x47b0cc);var _0x3d9f16=[];_0x3d9f16[_0xee13('0xd1')]({'model':db[_0xee13('0x6e')],'as':'User','attributes':['id',_0xee13('0x2f')],'raw':!![]});_0x3d9f16[_0xee13('0xd1')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xee13('0xd2'),'lastName'],'raw':!![]});if(_0x5a0940['query'][_0xee13('0xcf')]){_0x3d9f16['push']({'model':db[_0xee13('0xd3')],'as':_0xee13('0xd3'),'raw':!![]});}var _0x16c1f3=[{'model':db[_0xee13('0xc1')],'as':_0xee13('0xd4'),'attributes':['id',_0xee13('0xba'),_0xee13('0xd5'),_0xee13('0xd6'),_0xee13('0xd7'),_0xee13('0x7a')],'include':_0x3d9f16}];_0x16c1f3[_0xee13('0xd1')]({'model':db[_0xee13('0xd8')],'as':_0xee13('0xd9'),'attributes':['id',_0xee13('0x2b')]});_0x16c1f3[_0xee13('0xd1')]({'model':db[_0xee13('0x6e')],'as':_0xee13('0xda'),'attributes':['id',_0xee13('0x2f')]});return db[_0xee13('0x36')][_0xee13('0x67')]({'where':{'id':_0x5a0940[_0xee13('0xbb')]['id']},'include':_0x16c1f3})[_0xee13('0x26')](handleEntityNotFound(_0x5e0d01,null))[_0xee13('0x26')](function(_0x13e57f){if(_0x13e57f){var _0x4e671d=_0x13e57f[_0xee13('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x3c73d7);var _0x26590c={'channel':_0xee13('0xdc'),'account':_0x4e671d[_0xee13('0xd9')][_0xee13('0x2b')],'agent':_0x4e671d[_0xee13('0xda')]?_0x4e671d['Owner']['fullname']:_0xee13('0xdd'),'createdAt':moment(_0x4e671d['createdAt'])[_0xee13('0xde')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4e671d['closed']?moment(_0x4e671d[_0xee13('0xdf')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xee13('0x9a')]():'','disposition':_0x4e671d['disposition'],'messages':_(_0x4e671d[_0xee13('0xd4')])[_0xee13('0x80')]({'secret':![]})[_0xee13('0x2e')](function(_0x5ad06c){if(_0x5ad06c[_0xee13('0xd3')]){var _0x2237d3=path[_0xee13('0xd0')](_0x4e72af,_0x5ad06c[_0xee13('0xd3')]['basename']);if(fs[_0xee13('0xe0')](_0x2237d3)){fs['createReadStream'](_0x2237d3)[_0xee13('0xe1')](fs[_0xee13('0xe2')](path['join'](_0x3c73d7,_0x5ad06c[_0xee13('0xd3')][_0xee13('0xe3')])));}}return{'date':moment(_0x5ad06c[_0xee13('0xd5')])[_0xee13('0xde')](_0xee13('0xc4'))[_0xee13('0x9a')](),'sender':_0x5ad06c['direction']===_0xee13('0xe4')?_0x5ad06c['User']?_0x5ad06c[_0xee13('0x6e')][_0xee13('0x2f')]:_0xee13('0xe5'):_0x5ad06c[_0xee13('0x61')][_0xee13('0xd2')]+(_0x5ad06c[_0xee13('0x61')]['lastName']?'\x20'+_0x5ad06c[_0xee13('0x61')][_0xee13('0xe6')]:''),'body':_0x5ad06c[_0xee13('0xd3')]?_0x5ad06c['Attachment'][_0xee13('0xe3')]:_0x5ad06c[_0xee13('0xba')],'direction':_0x5ad06c[_0xee13('0xd6')]===_0xee13('0xe4')?'A':'C','secret':_0x5ad06c['secret'],'read':_0x5ad06c['read'],'attachment':_0x5ad06c[_0xee13('0xd3')]};})[_0xee13('0x64')]()};return ejs['renderFile'](path[_0xee13('0xd0')](config[_0xee13('0xcb')],_0xee13('0xcc'),_0xee13('0xe7'),_0xee13('0xe8')),{'interaction':_0x26590c})[_0xee13('0x26')](function(_0x5f4837){var _0x2c9c03=path[_0xee13('0xd0')](_0x3c73d7,_0xee13('0xe9')+_0x4e671d['id']+'-'+_0x1a4f14+'.pdf');var _0x513ac2={'path':_0x2c9c03,'channel':_0xee13('0xdc'),'interactionId':_0x4e671d['id']};return pdf[_0xee13('0xea')](_0x5f4837,_0x513ac2);})[_0xee13('0x26')](function(){return new BPromise(function(_0x186f35,_0x3c7c25){zipdir(_0x3c73d7,{'saveTo':_0x4d7054},function(_0x2aa579,_0x5e276c){if(_0x2aa579)return _0x3c7c25(_0x2aa579);return _0x186f35(_0x5e276c);});})[_0xee13('0x26')](function(){return new BPromise(function(_0xcbdb34,_0x2a5f2c){rimraf(_0x3c73d7,function(_0x4c75b2){if(_0x4c75b2)_0x2a5f2c(_0x4c75b2);return _0xcbdb34();});});})[_0xee13('0x26')](function(){return _0x5e0d01['download'](_0x4d7054,_0x47b0cc,function(_0x5b62a6){if(_0x5b62a6){console[_0xee13('0xeb')]('err',_0x5b62a6);}else{fs[_0xee13('0xec')](_0x4d7054);}});});});}else{return _0x5e0d01[_0xee13('0x28')](0xc8);}})[_0xee13('0x34')](handleError(_0x5e0d01,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index e480a11..34d4b1e 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 _0x5ff3=['findAll','unreadMessages','length','catch','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x5ff3,0x17d));var _0x35ff=function(_0x586903,_0xbf232a){_0x586903=_0x586903-0x0;var _0x5acf98=_0x5ff3[_0x586903];return _0x5acf98;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x35ff('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x35ff('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x35ff('0x1')](0x0);var events={'afterCreate':_0x35ff('0x2'),'afterUpdate':_0x35ff('0x3'),'afterDestroy':_0x35ff('0x4')};function emitEvent(_0x551514){return function(_0x2fcb74,_0x3bf5b8,_0x2e9873){_0x2fcb74[_0x35ff('0x5')]({'attributes':['id'],'raw':!![]})[_0x35ff('0x6')](function(_0x495c31){_0x2fcb74[_0x35ff('0x7')]('Users',_0x495c31[_0x35ff('0x8')](function(_0xfcec34){return{'id':_0xfcec34['id']};}));return WhatsappMessage[_0x35ff('0x9')]({'where':{'WhatsappInteractionId':_0x2fcb74['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x20647e){_0x2fcb74['setDataValue'](_0x35ff('0xa'),_0x20647e[_0x35ff('0xb')]);WhatsappInteractionEvents['emit'](_0x551514+':'+_0x2fcb74['id'],_0x2fcb74);WhatsappInteractionEvents['emit'](_0x551514,_0x2fcb74);_0x2e9873(null);})[_0x35ff('0xc')](_0x2e9873(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x6a00=['setMaxListeners','save','update','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x3e50aa,_0x299677){var _0x51edcc=function(_0x7ea1e4){while(--_0x7ea1e4){_0x3e50aa['push'](_0x3e50aa['shift']());}};_0x51edcc(++_0x299677);}(_0x6a00,0xc9));var _0x06a0=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x6a00[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0x06a0('0x0'));var WhatsappInteraction=require(_0x06a0('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x06a0('0x1'))['db'][_0x06a0('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x06a0('0x3')](0x0);var events={'afterCreate':_0x06a0('0x4'),'afterUpdate':_0x06a0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a423e){return function(_0x34c32c,_0x3b042f,_0x1de0c2){_0x34c32c[_0x06a0('0x6')]({'attributes':['id'],'raw':!![]})[_0x06a0('0x7')](function(_0x1b8019){_0x34c32c['setDataValue'](_0x06a0('0x8'),_0x1b8019[_0x06a0('0x9')](function(_0x91eaab){return{'id':_0x91eaab['id']};}));return WhatsappMessage[_0x06a0('0xa')]({'where':{'WhatsappInteractionId':_0x34c32c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x06a0('0x7')](function(_0x26c616){_0x34c32c[_0x06a0('0xb')](_0x06a0('0xc'),_0x26c616[_0x06a0('0xd')]);WhatsappInteractionEvents[_0x06a0('0xe')](_0x4a423e+':'+_0x34c32c['id'],_0x34c32c);WhatsappInteractionEvents[_0x06a0('0xe')](_0x4a423e,_0x34c32c);_0x1de0c2(null);})['catch'](_0x1de0c2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x06a0('0xf')](e,emitEvent(event));}}module[_0x06a0('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index cd284b7..eb73925 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 _0x6965=['closed','closedAt','format','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6965,0xa8));var _0x5696=function(_0x39fcc0,_0x1f4242){_0x39fcc0=_0x39fcc0-0x0;var _0x5e4ab5=_0x6965[_0x39fcc0];return _0x5e4ab5;};'use strict';var _=require(_0x5696('0x0'));var util=require('util');var logger=require(_0x5696('0x1'))(_0x5696('0x2'));var moment=require(_0x5696('0x3'));var BPromise=require('bluebird');var rp=require(_0x5696('0x4'));var fs=require('fs');var path=require(_0x5696('0x5'));var rimraf=require(_0x5696('0x6'));var config=require(_0x5696('0x7'));var attributes=require(_0x5696('0x8'));module[_0x5696('0x9')]=function(_0x2c05bf,_0xdad5c1){return _0x2c05bf[_0x5696('0xa')](_0x5696('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fa9de,_0x4f5728,_0xa3c07){if(_0x3fa9de['changed'](_0x5696('0xc'))){_0x3fa9de[_0x5696('0xd')]=moment()[_0x5696('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0xa3c07(null,_0x3fa9de);}}});}; \ No newline at end of file +var _0x76c1=['api','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x76c1,0x15b));var _0x176c=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x76c1[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x176c('0x0'));var util=require(_0x176c('0x1'));var logger=require(_0x176c('0x2'))(_0x176c('0x3'));var moment=require(_0x176c('0x4'));var BPromise=require(_0x176c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x176c('0x6'));var config=require(_0x176c('0x7'));var attributes=require(_0x176c('0x8'));module['exports']=function(_0x5a1e37,_0xc28671){return _0x5a1e37[_0x176c('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x176c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fc769,_0x40c110,_0x5d58ba){if(_0x3fc769['changed'](_0x176c('0xb'))){_0x3fc769[_0x176c('0xc')]=moment()['format'](_0x176c('0xd'));}_0x5d58ba(null,_0x3fc769);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b3c04b6..b9f9138 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 _0xae9e=['omit','spread','AddTags','util','bluebird','randomstring','../../config/logger','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','addTags','ids'];(function(_0x4c0dee,_0x6c973a){var _0x10a576=function(_0x368093){while(--_0x368093){_0x4c0dee['push'](_0x4c0dee['shift']());}};_0x10a576(++_0x6c973a);}(_0xae9e,0x1b3));var _0xeae9=function(_0x32c49b,_0x37a04b){_0x32c49b=_0x32c49b-0x0;var _0xa9946=_0xae9e[_0x32c49b];return _0xa9946;};'use strict';var _=require('lodash');var util=require(_0xeae9('0x0'));var moment=require('moment');var BPromise=require(_0xeae9('0x1'));var rs=require(_0xeae9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeae9('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xeae9('0x4')]=_[_0xeae9('0x5')](config[_0xeae9('0x4')],{'host':_0xeae9('0x6'),'port':0x18eb});var socket=require(_0xeae9('0x7'))(new Redis(config['redis']));require(_0xeae9('0x8'))[_0xeae9('0x9')](socket);function respondWithRpcPromise(_0x1a0cc5,_0x10fc6d,_0x54ec7d){return new BPromise(function(_0x3dab79,_0x27d6f2){return client[_0xeae9('0xa')](_0x1a0cc5,_0x54ec7d)[_0xeae9('0xb')](function(_0x5dbb0a){logger[_0xeae9('0xc')](_0xeae9('0xd'),_0x10fc6d,_0xeae9('0xe'));logger[_0xeae9('0xf')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x10fc6d,'request\x20sent',JSON['stringify'](_0x5dbb0a));if(_0x5dbb0a[_0xeae9('0x10')]){if(_0x5dbb0a[_0xeae9('0x10')][_0xeae9('0x11')]===0x1f4){logger[_0xeae9('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x10fc6d,_0x5dbb0a[_0xeae9('0x10')]['message']);return _0x27d6f2(_0x5dbb0a['error'][_0xeae9('0x12')]);}logger[_0xeae9('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x10fc6d,_0x5dbb0a['error']['message']);return _0x3dab79(_0x5dbb0a[_0xeae9('0x10')][_0xeae9('0x12')]);}else{logger['info'](_0xeae9('0xd'),_0x10fc6d,_0xeae9('0xe'));_0x3dab79(_0x5dbb0a[_0xeae9('0x13')]['message']);}})[_0xeae9('0x14')](function(_0x49f11b){logger[_0xeae9('0x10')](_0xeae9('0xd'),_0x10fc6d,_0x49f11b);_0x27d6f2(_0x49f11b);});});}exports[_0xeae9('0x15')]=function(_0x544784){var _0x4e78bf=this;return new Promise(function(_0x2c8cc6,_0x136c69){return db[_0xeae9('0x16')][_0xeae9('0x17')](_0x544784[_0xeae9('0x18')],{'raw':_0x544784[_0xeae9('0x19')]?_0x544784[_0xeae9('0x19')][_0xeae9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x544784[_0xeae9('0x19')]?_0x544784[_0xeae9('0x19')][_0xeae9('0x1b')]||null:null,'attributes':_0x544784[_0xeae9('0x19')]?_0x544784[_0xeae9('0x19')][_0xeae9('0x1c')]||null:null,'limit':_0x544784[_0xeae9('0x19')]?_0x544784['options'][_0xeae9('0x1d')]||null:null})[_0xeae9('0xb')](function(_0x1397cc){logger[_0xeae9('0xc')]('UpdateWhatsappInteraction',_0x544784);logger['debug'](_0xeae9('0x15'),_0x544784,JSON[_0xeae9('0x1e')](_0x1397cc));_0x2c8cc6(_0x1397cc);})[_0xeae9('0x14')](function(_0x2e26c7){logger['error'](_0xeae9('0x15'),_0x2e26c7[_0xeae9('0x12')],_0x544784);_0x136c69(_0x4e78bf['error'](0x1f4,_0x2e26c7['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x34d890){return new Promise(function(_0xa45946,_0x3eaebc){return db['WhatsappInteraction']['find']({'where':_0x34d890['options']?_0x34d890['options']['where']||null:null})['then'](function(_0x454e6b){if(_0x454e6b){return _0x454e6b[_0xeae9('0x1f')](_0x34d890[_0xeae9('0x18')][_0xeae9('0x20')],_[_0xeae9('0x21')](_0x34d890[_0xeae9('0x18')],[_0xeae9('0x20'),'id'])||{});}})[_0xeae9('0x22')](function(_0x2331bf){logger['info'](_0xeae9('0x23'),_0x34d890);logger[_0xeae9('0xf')](_0xeae9('0x23'),_0x34d890,JSON[_0xeae9('0x1e')](_0x2331bf));_0xa45946(_0x2331bf);})[_0xeae9('0x14')](function(_0x529e15){logger[_0xeae9('0x10')](_0xeae9('0x23'),_0x529e15[_0xeae9('0x12')],_0x34d890);_0x3eaebc(_this['error'](0x1f4,_0x529e15[_0xeae9('0x12')]));});});}; \ No newline at end of file +var _0xaf55=['limit','catch','AddTagsToWhatsappInteraction','addTags','ids','omit','body','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','options','raw','where'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xaf55,0x159));var _0x5af5=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xaf55[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var moment=require(_0x5af5('0x2'));var BPromise=require('bluebird');var rs=require(_0x5af5('0x3'));var fs=require('fs');var Redis=require(_0x5af5('0x4'));var db=require(_0x5af5('0x5'))['db'];var utils=require(_0x5af5('0x6'));var logger=require(_0x5af5('0x7'))(_0x5af5('0x8'));var config=require(_0x5af5('0x9'));var jayson=require(_0x5af5('0xa'));var client=jayson[_0x5af5('0xb')][_0x5af5('0xc')]({'port':0x232a});config[_0x5af5('0xd')]=_['defaults'](config[_0x5af5('0xd')],{'host':_0x5af5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5af5('0xf'))[_0x5af5('0x10')](socket);function respondWithRpcPromise(_0x2adaba,_0x35a9ef,_0x43a69b){return new BPromise(function(_0x2f6071,_0x237072){return client[_0x5af5('0x11')](_0x2adaba,_0x43a69b)[_0x5af5('0x12')](function(_0x3564cb){logger[_0x5af5('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x35a9ef,_0x5af5('0x14'));logger[_0x5af5('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x35a9ef,_0x5af5('0x14'),JSON[_0x5af5('0x16')](_0x3564cb));if(_0x3564cb[_0x5af5('0x17')]){if(_0x3564cb['error'][_0x5af5('0x18')]===0x1f4){logger['error'](_0x5af5('0x19'),_0x35a9ef,_0x3564cb['error'][_0x5af5('0x1a')]);return _0x237072(_0x3564cb[_0x5af5('0x17')][_0x5af5('0x1a')]);}logger[_0x5af5('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x35a9ef,_0x3564cb[_0x5af5('0x17')][_0x5af5('0x1a')]);return _0x2f6071(_0x3564cb[_0x5af5('0x17')][_0x5af5('0x1a')]);}else{logger[_0x5af5('0x13')](_0x5af5('0x19'),_0x35a9ef,_0x5af5('0x14'));_0x2f6071(_0x3564cb[_0x5af5('0x1b')][_0x5af5('0x1a')]);}})['catch'](function(_0x2221a5){logger[_0x5af5('0x17')](_0x5af5('0x19'),_0x35a9ef,_0x2221a5);_0x237072(_0x2221a5);});});}exports[_0x5af5('0x1c')]=function(_0x12319a){var _0x3edad6=this;return new Promise(function(_0x20d0e6,_0x242e76){return db[_0x5af5('0x1d')]['update'](_0x12319a['body'],{'raw':_0x12319a[_0x5af5('0x1e')]?_0x12319a[_0x5af5('0x1e')][_0x5af5('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12319a[_0x5af5('0x1e')]?_0x12319a['options'][_0x5af5('0x20')]||null:null,'attributes':_0x12319a['options']?_0x12319a[_0x5af5('0x1e')]['attributes']||null:null,'limit':_0x12319a[_0x5af5('0x1e')]?_0x12319a[_0x5af5('0x1e')][_0x5af5('0x21')]||null:null})['then'](function(_0x4b7e73){logger['info'](_0x5af5('0x1c'),_0x12319a);logger[_0x5af5('0x15')](_0x5af5('0x1c'),_0x12319a,JSON[_0x5af5('0x16')](_0x4b7e73));_0x20d0e6(_0x4b7e73);})[_0x5af5('0x22')](function(_0x270227){logger[_0x5af5('0x17')](_0x5af5('0x1c'),_0x270227[_0x5af5('0x1a')],_0x12319a);_0x242e76(_0x3edad6[_0x5af5('0x17')](0x1f4,_0x270227[_0x5af5('0x1a')]));});});};exports[_0x5af5('0x23')]=function(_0x5e7638){return new Promise(function(_0x3d77f4,_0x13ab94){return db[_0x5af5('0x1d')]['find']({'where':_0x5e7638[_0x5af5('0x1e')]?_0x5e7638[_0x5af5('0x1e')][_0x5af5('0x20')]||null:null})[_0x5af5('0x12')](function(_0x4ab02f){if(_0x4ab02f){return _0x4ab02f[_0x5af5('0x24')](_0x5e7638['body'][_0x5af5('0x25')],_[_0x5af5('0x26')](_0x5e7638[_0x5af5('0x27')],[_0x5af5('0x25'),'id'])||{});}})[_0x5af5('0x28')](function(_0xb828e2){logger[_0x5af5('0x13')](_0x5af5('0x29'),_0x5e7638);logger[_0x5af5('0x15')](_0x5af5('0x29'),_0x5e7638,JSON[_0x5af5('0x16')](_0xb828e2));_0x3d77f4(_0xb828e2);})[_0x5af5('0x22')](function(_0x553372){logger[_0x5af5('0x17')]('AddTags',_0x553372[_0x5af5('0x1a')],_0x5e7638);_0x13ab94(_this[_0x5af5('0x17')](0x1f4,_0x553372[_0x5af5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7e61158..467d23b 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 _0xa99f=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x432b9f,_0x1fc0dd){var _0x4b038c=function(_0x41aed1){while(--_0x41aed1){_0x432b9f['push'](_0x432b9f['shift']());}};_0x4b038c(++_0x1fc0dd);}(_0xa99f,0x189));var _0xfa99=function(_0x8411ff,_0x12a34a){_0x8411ff=_0x8411ff-0x0;var _0x566c37=_0xa99f[_0x8411ff];return _0x566c37;};'use strict';var WhatsappInteractionEvents=require(_0xfa99('0x0'));var events=[_0xfa99('0x1'),_0xfa99('0x2'),_0xfa99('0x3')];function createListener(_0x33d203,_0x519abd){return function(_0x5a4ebe){_0x519abd[_0xfa99('0x4')](_0x33d203,_0x5a4ebe);};}function removeListener(_0x116e27,_0x55b180){return function(){WhatsappInteractionEvents[_0xfa99('0x5')](_0x116e27,_0x55b180);};}exports['register']=function(_0x1bf5d3){for(var _0x3a0050=0x0,_0x4c6d2b=events[_0xfa99('0x6')];_0x3a0050<_0x4c6d2b;_0x3a0050++){var _0x10f946=events[_0x3a0050];var _0x508f7c=createListener(_0xfa99('0x7')+_0x10f946,_0x1bf5d3);WhatsappInteractionEvents['on'](_0x10f946,_0x508f7c);}}; \ No newline at end of file +var _0xd0cd=['emit','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x496fc1,_0x1403ac){var _0x90579a=function(_0x415832){while(--_0x415832){_0x496fc1['push'](_0x496fc1['shift']());}};_0x90579a(++_0x1403ac);}(_0xd0cd,0x10c));var _0xdd0c=function(_0xff659d,_0x2283a1){_0xff659d=_0xff659d-0x0;var _0x19c170=_0xd0cd[_0xff659d];return _0x19c170;};'use strict';var WhatsappInteractionEvents=require(_0xdd0c('0x0'));var events=[_0xdd0c('0x1'),_0xdd0c('0x2'),_0xdd0c('0x3')];function createListener(_0x972f3e,_0xdd606a){return function(_0x10535e){_0xdd606a[_0xdd0c('0x4')](_0x972f3e,_0x10535e);};}function removeListener(_0x358432,_0x45d668){return function(){WhatsappInteractionEvents['removeListener'](_0x358432,_0x45d668);};}exports[_0xdd0c('0x5')]=function(_0x1f4310){for(var _0x37c31f=0x0,_0x2f5111=events[_0xdd0c('0x6')];_0x37c31f<_0x2f5111;_0x37c31f++){var _0x3f5266=events[_0x37c31f];var _0x79a45f=createListener(_0xdd0c('0x7')+_0x3f5266,_0x1f4310);WhatsappInteractionEvents['on'](_0x3f5266,_0x79a45f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index bb785c2..2b45c3c 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 _0x4ed8=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','update','accept','put','/:id/reject','reject','delete'];(function(_0x52e317,_0x2f7164){var _0x5d3eba=function(_0x42406a){while(--_0x42406a){_0x52e317['push'](_0x52e317['shift']());}};_0x5d3eba(++_0x2f7164);}(_0x4ed8,0x198));var _0x84ed=function(_0x3f9a2f,_0x34a6ec){_0x3f9a2f=_0x3f9a2f-0x0;var _0xee9833=_0x4ed8[_0x3f9a2f];return _0xee9833;};'use strict';var multer=require(_0x84ed('0x0'));var util=require(_0x84ed('0x1'));var path=require(_0x84ed('0x2'));var timeout=require(_0x84ed('0x3'));var express=require(_0x84ed('0x4'));var router=express['Router']();var fs_extra=require(_0x84ed('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x84ed('0x6'));var config=require(_0x84ed('0x7'));var controller=require(_0x84ed('0x8'));router['get']('/',auth[_0x84ed('0x9')](),controller['index']);router[_0x84ed('0xa')](_0x84ed('0xb'),auth[_0x84ed('0x9')](),controller[_0x84ed('0xc')]);router[_0x84ed('0xa')](_0x84ed('0xd'),auth[_0x84ed('0x9')](),controller[_0x84ed('0xe')]);router[_0x84ed('0xf')]('/',auth[_0x84ed('0x9')](),interaction[_0x84ed('0x10')](_0x84ed('0x11'),_0x84ed('0x12')),controller['create']);router[_0x84ed('0xf')](_0x84ed('0x13'),controller[_0x84ed('0x14')]);router['put'](_0x84ed('0xd'),auth[_0x84ed('0x9')](),controller[_0x84ed('0x15')]);router['put']('/:id/accept',auth[_0x84ed('0x9')](),controller[_0x84ed('0x16')]);router[_0x84ed('0x17')](_0x84ed('0x18'),auth[_0x84ed('0x9')](),controller[_0x84ed('0x19')]);router[_0x84ed('0x1a')](_0x84ed('0xd'),auth[_0x84ed('0x9')](),controller[_0x84ed('0x1b')]);module[_0x84ed('0x1c')]=router; \ No newline at end of file +var _0x6474=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','status','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x23095d,_0x4729cd){var _0x4b9d65=function(_0x54097c){while(--_0x54097c){_0x23095d['push'](_0x23095d['shift']());}};_0x4b9d65(++_0x4729cd);}(_0x6474,0x17c));var _0x4647=function(_0x4ff445,_0x2de54e){_0x4ff445=_0x4ff445-0x0;var _0x5c7756=_0x6474[_0x4ff445];return _0x5c7756;};'use strict';var multer=require(_0x4647('0x0'));var util=require(_0x4647('0x1'));var path=require('path');var timeout=require(_0x4647('0x2'));var express=require(_0x4647('0x3'));var router=express[_0x4647('0x4')]();var fs_extra=require(_0x4647('0x5'));var auth=require(_0x4647('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4647('0x7'));var controller=require(_0x4647('0x8'));router[_0x4647('0x9')]('/',auth[_0x4647('0xa')](),controller[_0x4647('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4647('0xc')]);router[_0x4647('0x9')](_0x4647('0xd'),auth[_0x4647('0xa')](),controller[_0x4647('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x4647('0xf')](_0x4647('0x10'),_0x4647('0x11')),controller[_0x4647('0x12')]);router['post']('/:id/status',controller[_0x4647('0x13')]);router[_0x4647('0x14')](_0x4647('0xd'),auth[_0x4647('0xa')](),controller['update']);router[_0x4647('0x14')](_0x4647('0x15'),auth['isAuthenticated'](),controller[_0x4647('0x16')]);router[_0x4647('0x14')](_0x4647('0x17'),auth[_0x4647('0xa')](),controller[_0x4647('0x18')]);router['delete'](_0x4647('0xd'),auth['isAuthenticated'](),controller[_0x4647('0x19')]);module[_0x4647('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 8bc92b5..b07fc0d 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 _0x1f0d=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x1f0d,0x165));var _0xd1f0=function(_0x4972a0,_0x59c686){_0x4972a0=_0x4972a0-0x0;var _0x32f4d2=_0x1f0d[_0x4972a0];return _0x32f4d2;};'use strict';var Sequelize=require(_0xd1f0('0x0'));module[_0xd1f0('0x1')]={'body':{'type':Sequelize[_0xd1f0('0x2')](_0xd1f0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd1f0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd1f0('0x5')]('in',_0xd1f0('0x6')),'defaultValue':_0xd1f0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd1f0('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xd1f0('0x8')]},'secret':{'type':Sequelize[_0xd1f0('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd1f0('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa07f=['out','STRING','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x5d6fc1,_0x2b5414){var _0x3388da=function(_0xb6891c){while(--_0xb6891c){_0x5d6fc1['push'](_0x5d6fc1['shift']());}};_0x3388da(++_0x2b5414);}(_0xa07f,0xee));var _0xfa07=function(_0x3e09c3,_0x3c1f0a){_0x3e09c3=_0x3e09c3-0x0;var _0xbbfc4c=_0xa07f[_0x3e09c3];return _0xbbfc4c;};'use strict';var Sequelize=require(_0xfa07('0x0'));module[_0xfa07('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfa07('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfa07('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfa07('0x4')]('in',_0xfa07('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xfa07('0x6')](0xbe)},'phone':{'type':Sequelize[_0xfa07('0x6')]},'readAt':{'type':Sequelize[_0xfa07('0x7')]},'secret':{'type':Sequelize[_0xfa07('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfa07('0x6')]},'providerResponse':{'type':Sequelize[_0xfa07('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 0c87d37..b6cbf9e 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 _0x0b9b=['rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','count','includeAll','findAll','rows','show','params','length','include','find','create','update','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','rejectMessage','ContactId','contact','email','internal'];(function(_0x4f7083,_0x20dea6){var _0x28e25f=function(_0x2be734){while(--_0x2be734){_0x4f7083['push'](_0x4f7083['shift']());}};_0x28e25f(++_0x20dea6);}(_0x0b9b,0x1b9));var _0xb0b9=function(_0x3a29a7,_0x532a19){_0x3a29a7=_0x3a29a7-0x0;var _0x468596=_0x0b9b[_0x3a29a7];return _0x468596;};'use strict';var emlformat=require(_0xb0b9('0x0'));var rimraf=require(_0xb0b9('0x1'));var zipdir=require(_0xb0b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0b9('0x3'));var moment=require(_0xb0b9('0x4'));var BPromise=require(_0xb0b9('0x5'));var Mustache=require('mustache');var util=require(_0xb0b9('0x6'));var path=require(_0xb0b9('0x7'));var sox=require(_0xb0b9('0x8'));var csv=require(_0xb0b9('0x9'));var ejs=require(_0xb0b9('0xa'));var fs=require('fs');var fs_extra=require(_0xb0b9('0xb'));var _=require('lodash');var squel=require(_0xb0b9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb0b9('0xd'));var toCsv=require(_0xb0b9('0x9'));var querystring=require('querystring');var Papa=require(_0xb0b9('0xe'));var Redis=require(_0xb0b9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb0b9('0x10'));var as=require(_0xb0b9('0x11'));var hardwareService=require(_0xb0b9('0x12'));var logger=require('../../config/logger')(_0xb0b9('0x13'));var utils=require(_0xb0b9('0x14'));var config=require(_0xb0b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0b9('0x16'))['db'];config['redis']=_[_0xb0b9('0x17')](config[_0xb0b9('0x18')],{'host':_0xb0b9('0x19'),'port':0x18eb});var socket=require(_0xb0b9('0x1a'))(new Redis(config[_0xb0b9('0x18')]));require(_0xb0b9('0x1b'))[_0xb0b9('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb0b9('0x1d')]({'port':0x232c});var client9002=jayson[_0xb0b9('0x1e')][_0xb0b9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54b4db,_0x4f9b65,_0x4e8d34,_0x765604){return new BPromise(function(_0x2c146a,_0x4f2f50){var _0x31a23a=_0x765604||client;return _0x31a23a[_0xb0b9('0x1f')](_0x54b4db,_0x4e8d34)[_0xb0b9('0x20')](function(_0x401cf8){logger[_0xb0b9('0x21')](_0xb0b9('0x22'),_0x4f9b65,_0xb0b9('0x23'));logger[_0xb0b9('0x24')](_0xb0b9('0x25'),_0x4f9b65,_0xb0b9('0x23'),JSON[_0xb0b9('0x26')](_0x401cf8));if(_0x401cf8[_0xb0b9('0x27')]){if(_0x401cf8[_0xb0b9('0x27')][_0xb0b9('0x28')]===0x1f4){logger[_0xb0b9('0x27')](_0xb0b9('0x22'),_0x4f9b65,_0x401cf8[_0xb0b9('0x27')][_0xb0b9('0x29')]);return _0x4f2f50(_0x401cf8['error']['message']);}logger[_0xb0b9('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x4f9b65,_0x401cf8[_0xb0b9('0x27')][_0xb0b9('0x29')]);return _0x2c146a(_0x401cf8[_0xb0b9('0x27')][_0xb0b9('0x29')]);}else{logger[_0xb0b9('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x4f9b65,_0xb0b9('0x23'));_0x2c146a(_0x401cf8[_0xb0b9('0x2a')]['message']);}})[_0xb0b9('0x2b')](function(_0x45e7c6){logger[_0xb0b9('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x4f9b65,_0x45e7c6);_0x4f2f50(_0x45e7c6);});});}function respondWithStatusCode(_0x47ad25,_0x120773){_0x120773=_0x120773||0xcc;return function(_0x6c4af6){if(_0x6c4af6){return _0x47ad25[_0xb0b9('0x2c')](_0x120773);}return _0x47ad25[_0xb0b9('0x2d')](_0x120773)[_0xb0b9('0x2e')]();};}function respondWithResult(_0xc6092c,_0x4c2588){_0x4c2588=_0x4c2588||0xc8;return function(_0x8c4aec){if(_0x8c4aec){return _0xc6092c[_0xb0b9('0x2d')](_0x4c2588)[_0xb0b9('0x2f')](_0x8c4aec);}};}function respondWithFilteredResult(_0x3b5fd4,_0xf24747){return function(_0x45c791){if(_0x45c791){var _0x215d41=typeof _0xf24747[_0xb0b9('0x30')]===_0xb0b9('0x31')&&typeof _0xf24747['limit']===_0xb0b9('0x31');var _0x31f8b5=_0x45c791['count'];var _0x26bfda=_0x215d41?0x0:_0xf24747[_0xb0b9('0x30')];var _0x395908=_0x215d41?_0x45c791['count']:_0xf24747['offset']+_0xf24747[_0xb0b9('0x32')];var _0x16bd7a;if(_0x395908>=_0x31f8b5){_0x395908=_0x31f8b5;_0x16bd7a=0xc8;}else{_0x16bd7a=0xce;}_0x3b5fd4[_0xb0b9('0x2d')](_0x16bd7a);return _0x3b5fd4[_0xb0b9('0x33')](_0xb0b9('0x34'),_0x26bfda+'-'+_0x395908+'/'+_0x31f8b5)[_0xb0b9('0x2f')](_0x45c791);}return null;};}function patchUpdates(_0x5c7082){return function(_0x580fad){try{jsonpatch[_0xb0b9('0x35')](_0x580fad,_0x5c7082,!![]);}catch(_0xcbe3b4){return BPromise[_0xb0b9('0x36')](_0xcbe3b4);}return _0x580fad['save']();};}function saveUpdates(_0x70a8b0,_0x768adc){return function(_0x553929){if(_0x553929){return _0x553929['update'](_0x70a8b0)['then'](function(_0x5c87aa){return _0x5c87aa;});}return null;};}function removeEntity(_0x1e7553,_0x173e79){return function(_0x248671){if(_0x248671){return _0x248671['destroy']()[_0xb0b9('0x20')](function(){_0x1e7553[_0xb0b9('0x2d')](0xcc)[_0xb0b9('0x2e')]();});}};}function handleEntityNotFound(_0x53b428,_0x1b980e){return function(_0x526c1d){if(!_0x526c1d){_0x53b428[_0xb0b9('0x2c')](0x194);}return _0x526c1d;};}function handleError(_0x4f841d,_0x5a5093){_0x5a5093=_0x5a5093||0x1f4;return function(_0xd88394){logger[_0xb0b9('0x27')](_0xd88394[_0xb0b9('0x37')]);if(_0xd88394[_0xb0b9('0x38')]){delete _0xd88394[_0xb0b9('0x38')];}_0x4f841d[_0xb0b9('0x2d')](_0x5a5093)[_0xb0b9('0x39')](_0xd88394);};}exports[_0xb0b9('0x3a')]=function(_0x16e6b3,_0x25a9cb){var _0x335d8b={},_0x35a56f={},_0x50676d={'count':0x0,'rows':[]};var _0x565005=_['map'](db[_0xb0b9('0x3b')][_0xb0b9('0x3c')],function(_0x1dfbde){return{'name':_0x1dfbde[_0xb0b9('0x3d')],'type':_0x1dfbde[_0xb0b9('0x3e')][_0xb0b9('0x3f')]};});_0x35a56f['model']=_['map'](_0x565005,_0xb0b9('0x38'));_0x35a56f[_0xb0b9('0x40')]=_[_0xb0b9('0x41')](_0x16e6b3[_0xb0b9('0x40')]);_0x35a56f[_0xb0b9('0x42')]=_[_0xb0b9('0x43')](_0x35a56f['model'],_0x35a56f[_0xb0b9('0x40')]);_0x335d8b[_0xb0b9('0x44')]=_[_0xb0b9('0x43')](_0x35a56f[_0xb0b9('0x45')],qs[_0xb0b9('0x46')](_0x16e6b3['query'][_0xb0b9('0x46')]));_0x335d8b[_0xb0b9('0x44')]=_0x335d8b[_0xb0b9('0x44')]['length']?_0x335d8b[_0xb0b9('0x44')]:_0x35a56f[_0xb0b9('0x45')];if(!_0x16e6b3[_0xb0b9('0x40')][_0xb0b9('0x47')](_0xb0b9('0x48'))){_0x335d8b[_0xb0b9('0x32')]=qs[_0xb0b9('0x32')](_0x16e6b3[_0xb0b9('0x40')]['limit']);_0x335d8b[_0xb0b9('0x30')]=qs[_0xb0b9('0x30')](_0x16e6b3[_0xb0b9('0x40')][_0xb0b9('0x30')]);}_0x335d8b[_0xb0b9('0x49')]=qs[_0xb0b9('0x4a')](_0x16e6b3[_0xb0b9('0x40')][_0xb0b9('0x4a')]);_0x335d8b[_0xb0b9('0x4b')]=qs['filters'](_[_0xb0b9('0x4c')](_0x16e6b3[_0xb0b9('0x40')],_0x35a56f[_0xb0b9('0x42')]),_0x565005);if(_0x16e6b3[_0xb0b9('0x40')][_0xb0b9('0x4d')]){_0x335d8b[_0xb0b9('0x4b')]=_['merge'](_0x335d8b['where'],{'$or':_[_0xb0b9('0x4e')](_0x565005,function(_0x4f9d21){if(_0x4f9d21[_0xb0b9('0x3e')]!==_0xb0b9('0x4f')){var _0x5373e8={};_0x5373e8[_0x4f9d21[_0xb0b9('0x38')]]={'$like':'%'+_0x16e6b3[_0xb0b9('0x40')][_0xb0b9('0x4d')]+'%'};return _0x5373e8;}})});}_0x335d8b=_['merge']({},_0x335d8b,_0x16e6b3[_0xb0b9('0x50')]);var _0x2c2b6c={'where':_0x335d8b[_0xb0b9('0x4b')]};return db[_0xb0b9('0x3b')][_0xb0b9('0x51')](_0x2c2b6c)[_0xb0b9('0x20')](function(_0x53ee25){_0x50676d['count']=_0x53ee25;if(_0x16e6b3[_0xb0b9('0x40')][_0xb0b9('0x52')]){_0x335d8b['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xb0b9('0x53')](_0x335d8b);})['then'](function(_0xbf0376){_0x50676d[_0xb0b9('0x54')]=_0xbf0376;return _0x50676d;})[_0xb0b9('0x20')](respondWithFilteredResult(_0x25a9cb,_0x335d8b))[_0xb0b9('0x2b')](handleError(_0x25a9cb,null));};exports[_0xb0b9('0x55')]=function(_0x9854fa,_0x3563f1){var _0x314a33={'raw':!![],'where':{'id':_0x9854fa[_0xb0b9('0x56')]['id']}},_0x525a85={};_0x525a85[_0xb0b9('0x45')]=_[_0xb0b9('0x41')](db[_0xb0b9('0x3b')][_0xb0b9('0x3c')]);_0x525a85[_0xb0b9('0x40')]=_['keys'](_0x9854fa[_0xb0b9('0x40')]);_0x525a85[_0xb0b9('0x42')]=_[_0xb0b9('0x43')](_0x525a85[_0xb0b9('0x45')],_0x525a85[_0xb0b9('0x40')]);_0x314a33[_0xb0b9('0x44')]=_['intersection'](_0x525a85['model'],qs[_0xb0b9('0x46')](_0x9854fa[_0xb0b9('0x40')]['fields']));_0x314a33[_0xb0b9('0x44')]=_0x314a33[_0xb0b9('0x44')][_0xb0b9('0x57')]?_0x314a33[_0xb0b9('0x44')]:_0x525a85['model'];if(_0x9854fa[_0xb0b9('0x40')][_0xb0b9('0x52')]){_0x314a33[_0xb0b9('0x58')]=[{'all':!![]}];}_0x314a33=_['merge']({},_0x314a33,_0x9854fa[_0xb0b9('0x50')]);return db[_0xb0b9('0x3b')][_0xb0b9('0x59')](_0x314a33)[_0xb0b9('0x20')](handleEntityNotFound(_0x3563f1,null))['then'](respondWithResult(_0x3563f1,null))[_0xb0b9('0x2b')](handleError(_0x3563f1,null));};exports[_0xb0b9('0x5a')]=function(_0x24d6a3,_0x55ae69){return db[_0xb0b9('0x3b')][_0xb0b9('0x5a')](_0x24d6a3['body'],{})[_0xb0b9('0x20')](respondWithResult(_0x55ae69,0xc9))[_0xb0b9('0x2b')](handleError(_0x55ae69,null));};exports[_0xb0b9('0x5b')]=function(_0x5960c0,_0x2a658f){if(_0x5960c0[_0xb0b9('0x5c')]['id']){delete _0x5960c0[_0xb0b9('0x5c')]['id'];}return db[_0xb0b9('0x3b')][_0xb0b9('0x59')]({'where':{'id':_0x5960c0[_0xb0b9('0x56')]['id']}})[_0xb0b9('0x20')](handleEntityNotFound(_0x2a658f,null))[_0xb0b9('0x20')](saveUpdates(_0x5960c0[_0xb0b9('0x5c')],null))[_0xb0b9('0x20')](respondWithResult(_0x2a658f,null))[_0xb0b9('0x2b')](handleError(_0x2a658f,null));};exports[_0xb0b9('0x5d')]=function(_0x1e6ee4,_0x3d358f){return db[_0xb0b9('0x3b')][_0xb0b9('0x59')]({'where':{'id':_0x1e6ee4['params']['id']}})[_0xb0b9('0x20')](handleEntityNotFound(_0x3d358f,null))[_0xb0b9('0x20')](removeEntity(_0x3d358f,null))[_0xb0b9('0x2b')](handleError(_0x3d358f,null));};exports[_0xb0b9('0x5e')]=function(_0x353f08,_0x324189){return db[_0xb0b9('0x3b')][_0xb0b9('0x5e')]()[_0xb0b9('0x20')](respondWithResult(_0x324189,null))[_0xb0b9('0x2b')](handleError(_0x324189,null));};var interaction_log=require('../../config/logger')(_0xb0b9('0x5f'));exports[_0xb0b9('0x60')]=function(_0x97cdef,_0x1ecfcf,_0x7cdf2a){var _0x5baf82={'agent':{},'channel':_0xb0b9('0x61')};if(_0x97cdef[_0xb0b9('0x5c')]['id']){delete _0x97cdef[_0xb0b9('0x5c')]['id'];}_0x97cdef['body'][_0xb0b9('0x62')]=!![];_0x97cdef['body'][_0xb0b9('0x63')]=moment()[_0xb0b9('0x64')](_0xb0b9('0x65'));_0x97cdef[_0xb0b9('0x5c')]['UserId']=_0x97cdef[_0xb0b9('0x5c')][_0xb0b9('0x66')]||_0x97cdef[_0xb0b9('0x67')]['id'];_0x5baf82['agent']['id']=_0x97cdef[_0xb0b9('0x5c')][_0xb0b9('0x66')];return db[_0xb0b9('0x3b')][_0xb0b9('0x59')]({'where':{'id':_0x97cdef[_0xb0b9('0x56')]['id'],'UserId':null}})[_0xb0b9('0x20')](handleEntityNotFound(_0x1ecfcf,null))['then'](saveUpdates(_0x97cdef[_0xb0b9('0x5c')],null))[_0xb0b9('0x20')](function(_0x493aa5){if(_0x493aa5){_0x5baf82['message']=_0x493aa5['get']({'plain':!![]});return db[_0xb0b9('0x68')][_0xb0b9('0x59')]({'where':{'id':_0x493aa5[_0xb0b9('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x1ecfcf,null))[_0xb0b9('0x20')](function(_0x1098f9){if(_0x1098f9){return _0x1098f9[_0xb0b9('0x5b')]({'UserId':_0x97cdef[_0xb0b9('0x5c')][_0xb0b9('0x66')],'read1stAt':_[_0xb0b9('0x6a')](_0x1098f9[_0xb0b9('0x6b')])?moment()[_0xb0b9('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb0b9('0x20')](function(_0x4e572e){if(_0x4e572e){_0x5baf82[_0xb0b9('0x6c')]=_0x4e572e[_0xb0b9('0x6d')]({'plain':!![]});interaction_log[_0xb0b9('0x21')](_0xb0b9('0x6e'),_0x97cdef[_0xb0b9('0x67')]['id'],_0x97cdef[_0xb0b9('0x67')][_0xb0b9('0x38')],_0x97cdef[_0xb0b9('0x67')][_0xb0b9('0x6f')],_0x5baf82['interaction']['id'],_0x97cdef['body']?JSON['stringify'](_0x97cdef[_0xb0b9('0x5c')]):_0xb0b9('0x70'));return respondWithRpcPromise(_0xb0b9('0x71'),_0xb0b9('0x72'),_0x5baf82);}return null;})[_0xb0b9('0x20')](function(_0x2907ed){var _0x9f1b50=_0xb0b9('0x73')+_0x2907ed[_0xb0b9('0x29')]['ContactId'];return db[_0xb0b9('0x74')][_0xb0b9('0x40')](_0x9f1b50,{'type':db[_0xb0b9('0x75')][_0xb0b9('0x76')][_0xb0b9('0x77')],'raw':!![]})[_0xb0b9('0x20')](function(_0x520e53){return _0x520e53;});})[_0xb0b9('0x20')](function(_0x20ddee){if(_0x20ddee){_0x5baf82['message']['contact']=_0x20ddee[0x0];if(!_0x97cdef[_0xb0b9('0x5c')][_0xb0b9('0x66')])return;return db[_0xb0b9('0x78')][_0xb0b9('0x59')]({'where':{'id':_0x97cdef[_0xb0b9('0x5c')][_0xb0b9('0x66')],'role':_0xb0b9('0x79')},'attributes':['id','name',_0xb0b9('0x7a'),'email','internal'],'raw':!![]});}return null;})[_0xb0b9('0x20')](function(_0x4a75b9){if(!_0x4a75b9)return null;_0x5baf82['message'][_0xb0b9('0x79')]=_0x4a75b9;return _0x5baf82;})[_0xb0b9('0x20')](function(_0x1a43b2){if(_0x1a43b2){if(_0x97cdef[_0xb0b9('0x5c')][_0xb0b9('0x7b')]){_0x5baf82['message'][_0xb0b9('0x7c')]=util[_0xb0b9('0x64')](_0xb0b9('0x7d'),_0x97cdef[_0xb0b9('0x67')][_0xb0b9('0x38')]);_0x5baf82['message'][_0xb0b9('0x7e')]=_0x5baf82['channel'];_0x5baf82[_0xb0b9('0x29')][_0xb0b9('0x7f')]=_0xb0b9('0x60');return respondWithRpcPromise(_0xb0b9('0x80'),_0xb0b9('0x80'),{'event':_0xb0b9('0x81'),'message':_0x5baf82['message']},client9002)[_0xb0b9('0x20')](function(){return _0x5baf82;});}return _0x5baf82;}return null;})[_0xb0b9('0x20')](respondWithResult(_0x1ecfcf,null))[_0xb0b9('0x2b')](handleError(_0x1ecfcf,null));};var interaction_log=require('../../config/logger')(_0xb0b9('0x5f'));exports[_0xb0b9('0x36')]=function(_0x5bb389,_0x534c0b,_0x9a398e){var _0xf7a89c={'agent':{},'channel':_0xb0b9('0x61')};if(_0x5bb389[_0xb0b9('0x5c')]['id']){delete _0x5bb389[_0xb0b9('0x5c')]['id'];}_0x5bb389[_0xb0b9('0x5c')][_0xb0b9('0x66')]=_0x5bb389['body'][_0xb0b9('0x66')]||_0x5bb389[_0xb0b9('0x67')]['id'];_0xf7a89c[_0xb0b9('0x79')]['id']=_0x5bb389[_0xb0b9('0x5c')][_0xb0b9('0x66')];return db[_0xb0b9('0x3b')][_0xb0b9('0x59')]({'where':{'id':_0x5bb389[_0xb0b9('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x534c0b,null))[_0xb0b9('0x20')](function(_0x4583b6){if(_0x4583b6){_0xf7a89c[_0xb0b9('0x29')]=_0x4583b6[_0xb0b9('0x6d')]({'plain':!![]});return db[_0xb0b9('0x68')][_0xb0b9('0x59')]({'where':{'id':_0x4583b6[_0xb0b9('0x69')]}});}return null;})[_0xb0b9('0x20')](handleEntityNotFound(_0x534c0b,null))['then'](function(_0x5410f8){if(_0x5410f8){_0xf7a89c[_0xb0b9('0x6c')]=_0x5410f8[_0xb0b9('0x6d')]({'plain':!![]});interaction_log[_0xb0b9('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5bb389[_0xb0b9('0x67')]['id'],_0x5bb389['user'][_0xb0b9('0x38')],_0x5bb389[_0xb0b9('0x67')]['role'],_0xf7a89c[_0xb0b9('0x6c')]['id'],_0x5bb389['body']?JSON[_0xb0b9('0x26')](_0x5bb389[_0xb0b9('0x5c')]):_0xb0b9('0x70'));return respondWithRpcPromise('RejectMessage',_0xb0b9('0x82'),_0xf7a89c);}return null;})[_0xb0b9('0x20')](function(_0x19d4e3){var _0x4ab34f=_0xb0b9('0x73')+_0x19d4e3[_0xb0b9('0x29')][_0xb0b9('0x83')];return db[_0xb0b9('0x74')][_0xb0b9('0x40')](_0x4ab34f,{'type':db[_0xb0b9('0x75')][_0xb0b9('0x76')]['SELECT'],'raw':!![]})[_0xb0b9('0x20')](function(_0x52f4e2){return _0x52f4e2;});})[_0xb0b9('0x20')](function(_0x13c70d){if(_0x13c70d){_0xf7a89c[_0xb0b9('0x29')][_0xb0b9('0x84')]=_0x13c70d[0x0];if(!_0x5bb389[_0xb0b9('0x5c')]['UserId'])return;return db['User'][_0xb0b9('0x59')]({'where':{'id':_0x5bb389[_0xb0b9('0x5c')][_0xb0b9('0x66')],'role':_0xb0b9('0x79')},'attributes':['id',_0xb0b9('0x38'),_0xb0b9('0x7a'),_0xb0b9('0x85'),_0xb0b9('0x86')],'raw':!![]});}return null;})[_0xb0b9('0x20')](function(_0x49a4f1){if(!_0x49a4f1)return null;_0xf7a89c[_0xb0b9('0x29')]['agent']=_0x49a4f1;return _0xf7a89c;})['then'](function(_0x4e06b3){if(_0x4e06b3){_0x4e06b3['message']['interface']=util['format'](_0xb0b9('0x7d'),_0x5bb389[_0xb0b9('0x67')][_0xb0b9('0x38')]);_0x4e06b3['message']['channel']=_0xf7a89c['channel'];_0x4e06b3[_0xb0b9('0x29')][_0xb0b9('0x7f')]=_0xb0b9('0x36');respondWithRpcPromise(_0xb0b9('0x80'),_0xb0b9('0x80'),{'event':_0xb0b9('0x87'),'message':_0x4e06b3[_0xb0b9('0x29')]},client9002);return _0xf7a89c;}return null;})[_0xb0b9('0x20')](respondWithResult(_0x534c0b,null))[_0xb0b9('0x2b')](handleError(_0x534c0b,null));};exports[_0xb0b9('0x2d')]=function(_0x6f67b9,_0x11f927,_0x357926){if(_0x6f67b9[_0xb0b9('0x5c')]['id']){delete _0x6f67b9[_0xb0b9('0x5c')]['id'];}var _0x2a22e0;return db[_0xb0b9('0x3b')]['find']({'where':{'id':_0x6f67b9[_0xb0b9('0x56')]['id']}})[_0xb0b9('0x20')](handleEntityNotFound(_0x11f927,null))[_0xb0b9('0x20')](function(_0x263456){if(_0x263456){_0x2a22e0=_0x263456;return db['WhatsappAccount']['find']({'where':{'id':_0x263456[_0xb0b9('0x88')]}});}})[_0xb0b9('0x20')](handleEntityNotFound(_0x11f927,null))[_0xb0b9('0x20')](function(_0x314ac8){if(_0x314ac8){logger[_0xb0b9('0x24')](_0xb0b9('0x89'),_0xb0b9('0x2d'),_0xb0b9('0x8a'),_0x314ac8[_0xb0b9('0x3e')],util['inspect'](_0x6f67b9[_0xb0b9('0x5c')],{'showHidden':![],'depth':null}));switch(_0x314ac8[_0xb0b9('0x3e')]){case'twilio':if(_0x6f67b9[_0xb0b9('0x5c')][_0xb0b9('0x8b')]&&_0x6f67b9[_0xb0b9('0x5c')][_0xb0b9('0x8b')]===_0x2a22e0[_0xb0b9('0x8c')]&&_0x6f67b9[_0xb0b9('0x5c')][_0xb0b9('0x8d')]&&_0x6f67b9['body']['MessageStatus']===_0xb0b9('0x62')){return _0x2a22e0['update']({'read':!![]});}else{logger['error'](_0xb0b9('0x8e'),'status',_0xb0b9('0x8f'),util['inspect'](_0x6f67b9['body'],{'showHidden':![],'depth':null}));}break;}return _0x2a22e0;}})[_0xb0b9('0x20')](respondWithResult(_0x11f927,null))[_0xb0b9('0x2b')](handleError(_0x11f927,null));}; \ No newline at end of file +var _0x0295=['offset','set','Content-Range','apply','save','update','destroy','name','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','../../config/logger','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','accept','EventManager','whatsapp-interactions','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','event','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','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','undefined','limit','count'];(function(_0x4121bf,_0x55f7ab){var _0x50ab54=function(_0x36b742){while(--_0x36b742){_0x4121bf['push'](_0x4121bf['shift']());}};_0x50ab54(++_0x55f7ab);}(_0x0295,0x1f0));var _0x5029=function(_0x280dd8,_0x5c8eb8){_0x280dd8=_0x280dd8-0x0;var _0x2a6aa6=_0x0295[_0x280dd8];return _0x2a6aa6;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];config[_0x5029('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5029('0x15')]));require(_0x5029('0x16'))[_0x5029('0x17')](socket);var jayson=require(_0x5029('0x18'));var client=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232c});var client9002=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x10bf55,_0x326923,_0x457c73,_0x353cba){return new BPromise(function(_0x3786b5,_0x2c273c){var _0x343918=_0x353cba||client;return _0x343918['request'](_0x10bf55,_0x457c73)[_0x5029('0x1b')](function(_0x31a155){logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x326923,_0x5029('0x1e'));logger[_0x5029('0x1f')](_0x5029('0x20'),_0x326923,'request\x20sent',JSON[_0x5029('0x21')](_0x31a155));if(_0x31a155['error']){if(_0x31a155[_0x5029('0x22')][_0x5029('0x23')]===0x1f4){logger[_0x5029('0x22')](_0x5029('0x1d'),_0x326923,_0x31a155['error']['message']);return _0x2c273c(_0x31a155[_0x5029('0x22')]['message']);}logger[_0x5029('0x22')](_0x5029('0x1d'),_0x326923,_0x31a155[_0x5029('0x22')][_0x5029('0x24')]);return _0x3786b5(_0x31a155[_0x5029('0x22')][_0x5029('0x24')]);}else{logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x326923,_0x5029('0x1e'));_0x3786b5(_0x31a155['result']['message']);}})['catch'](function(_0x588d90){logger[_0x5029('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x326923,_0x588d90);_0x2c273c(_0x588d90);});});}function respondWithStatusCode(_0x5727e9,_0x181da0){_0x181da0=_0x181da0||0xcc;return function(_0x1e7e61){if(_0x1e7e61){return _0x5727e9[_0x5029('0x25')](_0x181da0);}return _0x5727e9['status'](_0x181da0)[_0x5029('0x26')]();};}function respondWithResult(_0xb14bc,_0x5e45c4){_0x5e45c4=_0x5e45c4||0xc8;return function(_0x2b6d99){if(_0x2b6d99){return _0xb14bc[_0x5029('0x27')](_0x5e45c4)[_0x5029('0x28')](_0x2b6d99);}};}function respondWithFilteredResult(_0x4a24b9,_0x32da06){return function(_0x251f99){if(_0x251f99){var _0xe5313e=typeof _0x32da06['offset']===_0x5029('0x29')&&typeof _0x32da06[_0x5029('0x2a')]==='undefined';var _0x1d79b9=_0x251f99[_0x5029('0x2b')];var _0x4434ff=_0xe5313e?0x0:_0x32da06[_0x5029('0x2c')];var _0x196830=_0xe5313e?_0x251f99[_0x5029('0x2b')]:_0x32da06[_0x5029('0x2c')]+_0x32da06[_0x5029('0x2a')];var _0x250156;if(_0x196830>=_0x1d79b9){_0x196830=_0x1d79b9;_0x250156=0xc8;}else{_0x250156=0xce;}_0x4a24b9[_0x5029('0x27')](_0x250156);return _0x4a24b9[_0x5029('0x2d')](_0x5029('0x2e'),_0x4434ff+'-'+_0x196830+'/'+_0x1d79b9)['json'](_0x251f99);}return null;};}function patchUpdates(_0x11ae38){return function(_0x5cb04b){try{jsonpatch[_0x5029('0x2f')](_0x5cb04b,_0x11ae38,!![]);}catch(_0x4f672e){return BPromise['reject'](_0x4f672e);}return _0x5cb04b[_0x5029('0x30')]();};}function saveUpdates(_0x447680,_0x1f9173){return function(_0x4b7330){if(_0x4b7330){return _0x4b7330[_0x5029('0x31')](_0x447680)[_0x5029('0x1b')](function(_0x3f20fb){return _0x3f20fb;});}return null;};}function removeEntity(_0x29c59a,_0x1bb896){return function(_0x4513b9){if(_0x4513b9){return _0x4513b9[_0x5029('0x32')]()[_0x5029('0x1b')](function(){_0x29c59a[_0x5029('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1db45c,_0xa4a432){return function(_0xc110e8){if(!_0xc110e8){_0x1db45c[_0x5029('0x25')](0x194);}return _0xc110e8;};}function handleError(_0x5ecd00,_0x184b8d){_0x184b8d=_0x184b8d||0x1f4;return function(_0x388cca){logger[_0x5029('0x22')](_0x388cca['stack']);if(_0x388cca['name']){delete _0x388cca[_0x5029('0x33')];}_0x5ecd00[_0x5029('0x27')](_0x184b8d)['send'](_0x388cca);};}exports['index']=function(_0x9656f2,_0x157969){var _0x270d66={},_0x3210cb={},_0x33c8c3={'count':0x0,'rows':[]};var _0xfa9ac=_[_0x5029('0x34')](db[_0x5029('0x35')][_0x5029('0x36')],function(_0x3effa4){return{'name':_0x3effa4[_0x5029('0x37')],'type':_0x3effa4[_0x5029('0x38')][_0x5029('0x39')]};});_0x3210cb[_0x5029('0x3a')]=_['map'](_0xfa9ac,'name');_0x3210cb[_0x5029('0x3b')]=_[_0x5029('0x3c')](_0x9656f2[_0x5029('0x3b')]);_0x3210cb['filters']=_[_0x5029('0x3d')](_0x3210cb[_0x5029('0x3a')],_0x3210cb['query']);_0x270d66[_0x5029('0x3e')]=_['intersection'](_0x3210cb[_0x5029('0x3a')],qs['fields'](_0x9656f2[_0x5029('0x3b')][_0x5029('0x3f')]));_0x270d66[_0x5029('0x3e')]=_0x270d66[_0x5029('0x3e')][_0x5029('0x40')]?_0x270d66[_0x5029('0x3e')]:_0x3210cb[_0x5029('0x3a')];if(!_0x9656f2[_0x5029('0x3b')][_0x5029('0x41')]('nolimit')){_0x270d66[_0x5029('0x2a')]=qs[_0x5029('0x2a')](_0x9656f2[_0x5029('0x3b')][_0x5029('0x2a')]);_0x270d66[_0x5029('0x2c')]=qs[_0x5029('0x2c')](_0x9656f2['query'][_0x5029('0x2c')]);}_0x270d66[_0x5029('0x42')]=qs[_0x5029('0x43')](_0x9656f2[_0x5029('0x3b')][_0x5029('0x43')]);_0x270d66['where']=qs[_0x5029('0x44')](_[_0x5029('0x45')](_0x9656f2[_0x5029('0x3b')],_0x3210cb[_0x5029('0x44')]),_0xfa9ac);if(_0x9656f2[_0x5029('0x3b')][_0x5029('0x46')]){_0x270d66[_0x5029('0x47')]=_[_0x5029('0x48')](_0x270d66[_0x5029('0x47')],{'$or':_['map'](_0xfa9ac,function(_0x32d0fa){if(_0x32d0fa[_0x5029('0x38')]!==_0x5029('0x49')){var _0xdb3e78={};_0xdb3e78[_0x32d0fa['name']]={'$like':'%'+_0x9656f2['query'][_0x5029('0x46')]+'%'};return _0xdb3e78;}})});}_0x270d66=_[_0x5029('0x48')]({},_0x270d66,_0x9656f2[_0x5029('0x4a')]);var _0x26a724={'where':_0x270d66[_0x5029('0x47')]};return db[_0x5029('0x35')][_0x5029('0x2b')](_0x26a724)[_0x5029('0x1b')](function(_0x1257a4){_0x33c8c3[_0x5029('0x2b')]=_0x1257a4;if(_0x9656f2[_0x5029('0x3b')][_0x5029('0x4b')]){_0x270d66[_0x5029('0x4c')]=[{'all':!![]}];}return db[_0x5029('0x35')][_0x5029('0x4d')](_0x270d66);})[_0x5029('0x1b')](function(_0x10fc07){_0x33c8c3[_0x5029('0x4e')]=_0x10fc07;return _0x33c8c3;})[_0x5029('0x1b')](respondWithFilteredResult(_0x157969,_0x270d66))[_0x5029('0x4f')](handleError(_0x157969,null));};exports[_0x5029('0x50')]=function(_0x489457,_0x1069c4){var _0x5e1bcb={'raw':!![],'where':{'id':_0x489457[_0x5029('0x51')]['id']}},_0x189d7d={};_0x189d7d['model']=_['keys'](db[_0x5029('0x35')]['rawAttributes']);_0x189d7d['query']=_[_0x5029('0x3c')](_0x489457[_0x5029('0x3b')]);_0x189d7d[_0x5029('0x44')]=_['intersection'](_0x189d7d['model'],_0x189d7d[_0x5029('0x3b')]);_0x5e1bcb[_0x5029('0x3e')]=_['intersection'](_0x189d7d[_0x5029('0x3a')],qs['fields'](_0x489457[_0x5029('0x3b')]['fields']));_0x5e1bcb[_0x5029('0x3e')]=_0x5e1bcb[_0x5029('0x3e')][_0x5029('0x40')]?_0x5e1bcb[_0x5029('0x3e')]:_0x189d7d[_0x5029('0x3a')];if(_0x489457[_0x5029('0x3b')][_0x5029('0x4b')]){_0x5e1bcb[_0x5029('0x4c')]=[{'all':!![]}];}_0x5e1bcb=_['merge']({},_0x5e1bcb,_0x489457[_0x5029('0x4a')]);return db['WhatsappMessage'][_0x5029('0x52')](_0x5e1bcb)[_0x5029('0x1b')](handleEntityNotFound(_0x1069c4,null))['then'](respondWithResult(_0x1069c4,null))[_0x5029('0x4f')](handleError(_0x1069c4,null));};exports['create']=function(_0x58928f,_0x55c57c){return db[_0x5029('0x35')]['create'](_0x58928f[_0x5029('0x53')],{})[_0x5029('0x1b')](respondWithResult(_0x55c57c,0xc9))[_0x5029('0x4f')](handleError(_0x55c57c,null));};exports['update']=function(_0xb43232,_0x53fd4f){if(_0xb43232['body']['id']){delete _0xb43232[_0x5029('0x53')]['id'];}return db[_0x5029('0x35')][_0x5029('0x52')]({'where':{'id':_0xb43232[_0x5029('0x51')]['id']}})[_0x5029('0x1b')](handleEntityNotFound(_0x53fd4f,null))['then'](saveUpdates(_0xb43232[_0x5029('0x53')],null))[_0x5029('0x1b')](respondWithResult(_0x53fd4f,null))[_0x5029('0x4f')](handleError(_0x53fd4f,null));};exports[_0x5029('0x32')]=function(_0x4dca54,_0x33812b){return db[_0x5029('0x35')]['find']({'where':{'id':_0x4dca54['params']['id']}})[_0x5029('0x1b')](handleEntityNotFound(_0x33812b,null))[_0x5029('0x1b')](removeEntity(_0x33812b,null))[_0x5029('0x4f')](handleError(_0x33812b,null));};exports[_0x5029('0x54')]=function(_0x50a9d1,_0x4208ab){return db[_0x5029('0x35')][_0x5029('0x54')]()[_0x5029('0x1b')](respondWithResult(_0x4208ab,null))[_0x5029('0x4f')](handleError(_0x4208ab,null));};var interaction_log=require(_0x5029('0x55'))('whatsapp-interactions');exports['accept']=function(_0x4314c0,_0xae788d,_0x3830f2){var _0x520c00={'agent':{},'channel':_0x5029('0x56')};if(_0x4314c0[_0x5029('0x53')]['id']){delete _0x4314c0[_0x5029('0x53')]['id'];}_0x4314c0[_0x5029('0x53')][_0x5029('0x57')]=!![];_0x4314c0['body'][_0x5029('0x58')]=moment()[_0x5029('0x59')](_0x5029('0x5a'));_0x4314c0['body'][_0x5029('0x5b')]=_0x4314c0['body'][_0x5029('0x5b')]||_0x4314c0['user']['id'];_0x520c00[_0x5029('0x5c')]['id']=_0x4314c0[_0x5029('0x53')][_0x5029('0x5b')];return db[_0x5029('0x35')][_0x5029('0x52')]({'where':{'id':_0x4314c0[_0x5029('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xae788d,null))[_0x5029('0x1b')](saveUpdates(_0x4314c0[_0x5029('0x53')],null))[_0x5029('0x1b')](function(_0x151562){if(_0x151562){_0x520c00[_0x5029('0x24')]=_0x151562['get']({'plain':!![]});return db[_0x5029('0x5d')]['find']({'where':{'id':_0x151562[_0x5029('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0xae788d,null))[_0x5029('0x1b')](function(_0x512392){if(_0x512392){return _0x512392[_0x5029('0x31')]({'UserId':_0x4314c0['body']['UserId'],'read1stAt':_[_0x5029('0x5f')](_0x512392['read1stAt'])?moment()[_0x5029('0x59')](_0x5029('0x5a')):undefined});}return null;})[_0x5029('0x1b')](function(_0x554e30){if(_0x554e30){_0x520c00[_0x5029('0x60')]=_0x554e30['get']({'plain':!![]});interaction_log[_0x5029('0x1c')](_0x5029('0x61'),_0x4314c0[_0x5029('0x62')]['id'],_0x4314c0[_0x5029('0x62')][_0x5029('0x33')],_0x4314c0['user'][_0x5029('0x63')],_0x520c00[_0x5029('0x60')]['id'],_0x4314c0['body']?JSON[_0x5029('0x21')](_0x4314c0[_0x5029('0x53')]):_0x5029('0x64'));return respondWithRpcPromise(_0x5029('0x65'),_0x5029('0x66'),_0x520c00);}return null;})[_0x5029('0x1b')](function(_0x5bd84e){var _0x577644=_0x5029('0x67')+_0x5bd84e['message'][_0x5029('0x68')];return db[_0x5029('0x69')]['query'](_0x577644,{'type':db[_0x5029('0x6a')]['QueryTypes']['SELECT'],'raw':!![]})[_0x5029('0x1b')](function(_0x340db9){return _0x340db9;});})[_0x5029('0x1b')](function(_0x3efc4b){if(_0x3efc4b){_0x520c00['message'][_0x5029('0x6b')]=_0x3efc4b[0x0];if(!_0x4314c0[_0x5029('0x53')]['UserId'])return;return db[_0x5029('0x6c')][_0x5029('0x52')]({'where':{'id':_0x4314c0['body']['UserId'],'role':'agent'},'attributes':['id',_0x5029('0x33'),_0x5029('0x6d'),_0x5029('0x6e'),_0x5029('0x6f')],'raw':!![]});}return null;})[_0x5029('0x1b')](function(_0x2ee3bb){if(!_0x2ee3bb)return null;_0x520c00[_0x5029('0x24')][_0x5029('0x5c')]=_0x2ee3bb;return _0x520c00;})[_0x5029('0x1b')](function(_0x5d7139){if(_0x5d7139){if(_0x4314c0['body'][_0x5029('0x70')]){_0x520c00[_0x5029('0x24')][_0x5029('0x71')]=util[_0x5029('0x59')](_0x5029('0x72'),_0x4314c0[_0x5029('0x62')][_0x5029('0x33')]);_0x520c00['message'][_0x5029('0x73')]=_0x520c00[_0x5029('0x73')];_0x520c00[_0x5029('0x24')]['event']=_0x5029('0x74');return respondWithRpcPromise(_0x5029('0x75'),_0x5029('0x75'),{'event':'acceptmessage','message':_0x520c00[_0x5029('0x24')]},client9002)[_0x5029('0x1b')](function(){return _0x520c00;});}return _0x520c00;}return null;})[_0x5029('0x1b')](respondWithResult(_0xae788d,null))['catch'](handleError(_0xae788d,null));};var interaction_log=require(_0x5029('0x55'))(_0x5029('0x76'));exports['reject']=function(_0x2cdd11,_0x42d795,_0x3f3118){var _0x124631={'agent':{},'channel':_0x5029('0x56')};if(_0x2cdd11['body']['id']){delete _0x2cdd11[_0x5029('0x53')]['id'];}_0x2cdd11[_0x5029('0x53')][_0x5029('0x5b')]=_0x2cdd11[_0x5029('0x53')][_0x5029('0x5b')]||_0x2cdd11['user']['id'];_0x124631[_0x5029('0x5c')]['id']=_0x2cdd11[_0x5029('0x53')][_0x5029('0x5b')];return db['WhatsappMessage'][_0x5029('0x52')]({'where':{'id':_0x2cdd11[_0x5029('0x51')]['id'],'UserId':null}})[_0x5029('0x1b')](handleEntityNotFound(_0x42d795,null))[_0x5029('0x1b')](function(_0x1b3860){if(_0x1b3860){_0x124631[_0x5029('0x24')]=_0x1b3860[_0x5029('0x77')]({'plain':!![]});return db['WhatsappInteraction'][_0x5029('0x52')]({'where':{'id':_0x1b3860[_0x5029('0x5e')]}});}return null;})[_0x5029('0x1b')](handleEntityNotFound(_0x42d795,null))[_0x5029('0x1b')](function(_0x2dcfee){if(_0x2dcfee){_0x124631['interaction']=_0x2dcfee[_0x5029('0x77')]({'plain':!![]});interaction_log[_0x5029('0x1c')](_0x5029('0x78'),_0x2cdd11['user']['id'],_0x2cdd11[_0x5029('0x62')][_0x5029('0x33')],_0x2cdd11['user']['role'],_0x124631['interaction']['id'],_0x2cdd11[_0x5029('0x53')]?JSON[_0x5029('0x21')](_0x2cdd11[_0x5029('0x53')]):_0x5029('0x64'));return respondWithRpcPromise(_0x5029('0x79'),'rejectMessage',_0x124631);}return null;})[_0x5029('0x1b')](function(_0x2e4782){var _0x2c0540='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e4782['message'][_0x5029('0x68')];return db[_0x5029('0x69')][_0x5029('0x3b')](_0x2c0540,{'type':db[_0x5029('0x6a')]['QueryTypes'][_0x5029('0x7a')],'raw':!![]})[_0x5029('0x1b')](function(_0x13df8d){return _0x13df8d;});})[_0x5029('0x1b')](function(_0x49f6b8){if(_0x49f6b8){_0x124631[_0x5029('0x24')][_0x5029('0x6b')]=_0x49f6b8[0x0];if(!_0x2cdd11[_0x5029('0x53')]['UserId'])return;return db[_0x5029('0x6c')]['find']({'where':{'id':_0x2cdd11['body'][_0x5029('0x5b')],'role':'agent'},'attributes':['id',_0x5029('0x33'),_0x5029('0x6d'),_0x5029('0x6e'),_0x5029('0x6f')],'raw':!![]});}return null;})[_0x5029('0x1b')](function(_0x227d13){if(!_0x227d13)return null;_0x124631[_0x5029('0x24')][_0x5029('0x5c')]=_0x227d13;return _0x124631;})['then'](function(_0x5b7694){if(_0x5b7694){_0x5b7694[_0x5029('0x24')]['interface']=util['format'](_0x5029('0x72'),_0x2cdd11['user']['name']);_0x5b7694[_0x5029('0x24')][_0x5029('0x73')]=_0x124631[_0x5029('0x73')];_0x5b7694[_0x5029('0x24')][_0x5029('0x7b')]='reject';respondWithRpcPromise(_0x5029('0x75'),_0x5029('0x75'),{'event':_0x5029('0x7c'),'message':_0x5b7694['message']},client9002);return _0x124631;}return null;})[_0x5029('0x1b')](respondWithResult(_0x42d795,null))[_0x5029('0x4f')](handleError(_0x42d795,null));};exports[_0x5029('0x27')]=function(_0x35bcb1,_0x3867a1,_0x47b720){if(_0x35bcb1['body']['id']){delete _0x35bcb1[_0x5029('0x53')]['id'];}var _0xe2189;return db['WhatsappMessage'][_0x5029('0x52')]({'where':{'id':_0x35bcb1[_0x5029('0x51')]['id']}})[_0x5029('0x1b')](handleEntityNotFound(_0x3867a1,null))[_0x5029('0x1b')](function(_0x13d02e){if(_0x13d02e){_0xe2189=_0x13d02e;return db[_0x5029('0x7d')][_0x5029('0x52')]({'where':{'id':_0x13d02e[_0x5029('0x7e')]}});}})['then'](handleEntityNotFound(_0x3867a1,null))['then'](function(_0x4243c3){if(_0x4243c3){logger['debug'](_0x5029('0x7f'),'status',_0x5029('0x80'),_0x4243c3[_0x5029('0x38')],util[_0x5029('0x81')](_0x35bcb1['body'],{'showHidden':![],'depth':null}));switch(_0x4243c3[_0x5029('0x38')]){case _0x5029('0x82'):if(_0x35bcb1[_0x5029('0x53')]['MessageSid']&&_0x35bcb1[_0x5029('0x53')][_0x5029('0x83')]===_0xe2189[_0x5029('0x84')]&&_0x35bcb1[_0x5029('0x53')][_0x5029('0x85')]&&_0x35bcb1[_0x5029('0x53')][_0x5029('0x85')]===_0x5029('0x57')){return _0xe2189[_0x5029('0x31')]({'read':!![]});}else{logger[_0x5029('0x22')](_0x5029('0x86'),_0x5029('0x27'),_0x5029('0x82'),util[_0x5029('0x81')](_0x35bcb1[_0x5029('0x53')],{'showHidden':![],'depth':null}));}break;}return _0xe2189;}})[_0x5029('0x1b')](respondWithResult(_0x3867a1,null))[_0x5029('0x4f')](handleError(_0x3867a1,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ebc4764..845ad39 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 _0xc36d=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x56bbd0,_0x4be5b8){var _0x32c8ce=function(_0x27e9db){while(--_0x27e9db){_0x56bbd0['push'](_0x56bbd0['shift']());}};_0x32c8ce(++_0x4be5b8);}(_0xc36d,0x7d));var _0xdc36=function(_0x9077a4,_0x41748c){_0x9077a4=_0x9077a4-0x0;var _0x204bdc=_0xc36d[_0x9077a4];return _0x204bdc;};'use strict';var EventEmitter=require(_0xdc36('0x0'));var WhatsappMessage=require(_0xdc36('0x1'))['db'][_0xdc36('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xdc36('0x3')](0x0);var events={'afterCreate':_0xdc36('0x4'),'afterUpdate':_0xdc36('0x5'),'afterDestroy':'remove'};function emitEvent(_0x42522b){return function(_0x3431f9,_0x53ac17,_0x18c8fe){WhatsappMessageEvents[_0xdc36('0x6')](_0x42522b+':'+_0x3431f9['id'],_0x3431f9);WhatsappMessageEvents[_0xdc36('0x6')](_0x42522b,_0x3431f9);_0x18c8fe(null);};}for(var e in events){if(events[_0xdc36('0x7')](e)){var event=events[e];WhatsappMessage[_0xdc36('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x131e=['hasOwnProperty','hook','setMaxListeners','save','update','remove','emit'];(function(_0x12e650,_0x33f29f){var _0x5b56b1=function(_0xa7f3d8){while(--_0xa7f3d8){_0x12e650['push'](_0x12e650['shift']());}};_0x5b56b1(++_0x33f29f);}(_0x131e,0x1ec));var _0xe131=function(_0x531d3c,_0x5109c3){_0x531d3c=_0x531d3c-0x0;var _0x4b1bea=_0x131e[_0x531d3c];return _0x4b1bea;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xe131('0x0')](0x0);var events={'afterCreate':_0xe131('0x1'),'afterUpdate':_0xe131('0x2'),'afterDestroy':_0xe131('0x3')};function emitEvent(_0x30486b){return function(_0x761c,_0x4ff7f7,_0x2fc440){WhatsappMessageEvents[_0xe131('0x4')](_0x30486b+':'+_0x761c['id'],_0x761c);WhatsappMessageEvents[_0xe131('0x4')](_0x30486b,_0x761c);_0x2fc440(null);};}for(var e in events){if(events[_0xe131('0x5')](e)){var event=events[e];WhatsappMessage[_0xe131('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 80abf6f..243f3b9 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 _0x9e40=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','WhatsappInteractionId','update','createdAt','catch','WhatsappAccount','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/status?token=','token','then','sid','afterCreate','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x53b4dc,_0x51f549){var _0x3b2b68=function(_0x532722){while(--_0x532722){_0x53b4dc['push'](_0x53b4dc['shift']());}};_0x3b2b68(++_0x51f549);}(_0x9e40,0x10d));var _0x09e4=function(_0x1d4454,_0x237da4){_0x1d4454=_0x1d4454-0x0;var _0x3410b0=_0x9e40[_0x1d4454];return _0x3410b0;};'use strict';var _=require(_0x09e4('0x0'));var util=require('util');var logger=require(_0x09e4('0x1'))(_0x09e4('0x2'));var moment=require(_0x09e4('0x3'));var BPromise=require(_0x09e4('0x4'));var rp=require(_0x09e4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09e4('0x6'));var config=require('../../config/environment');var attributes=require(_0x09e4('0x7'));module[_0x09e4('0x8')]=function(_0x52e1f8,_0x58f38f){return _0x52e1f8['define'](_0x09e4('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x09e4('0xa')]},{'name':_0x09e4('0xb'),'fields':[_0x09e4('0xc')],'type':_0x09e4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x341e57,_0x2698d5,_0x26994f){var _0x5ea9f0=_0x52e1f8[_0x09e4('0xe')];var _0xa4ad9e=_0x341e57[_0x09e4('0xf')]({'plain':!![]});if(_0xa4ad9e[_0x09e4('0x10')]['toLowerCase']()==='in'||_0xa4ad9e[_0x09e4('0x10')][_0x09e4('0x11')]()===_0x09e4('0x12')&&!_0xa4ad9e[_0x09e4('0x13')]&&!_[_0x09e4('0x14')](_0xa4ad9e['UserId'])){_0x5ea9f0['WhatsappInteraction'][_0x09e4('0x15')]({'where':{'id':_0xa4ad9e[_0x09e4('0x16')]}})['then'](function(_0x51cc6a){if(_0x51cc6a){_0x51cc6a[_0x09e4('0x17')]({'lastMsgAt':_0xa4ad9e[_0x09e4('0x18')],'lastMsgDirection':_0xa4ad9e[_0x09e4('0x10')][_0x09e4('0x11')]()});}})[_0x09e4('0x19')](function(_0x721db6){console['error'](_0x721db6);});}if(_0xa4ad9e[_0x09e4('0x10')]==='out'&&!_0xa4ad9e[_0x09e4('0x13')]){var _0x4bf4e4;_0x5ea9f0[_0x09e4('0x1a')]['find']({'where':{'id':_0xa4ad9e['WhatsappAccountId']},'raw':!![]})['then'](function(_0x112bbe){_0x4bf4e4=_0x112bbe;if(_0x4bf4e4&&_0x4bf4e4[_0x09e4('0x1b')]){switch(_0x4bf4e4['type']){case _0x09e4('0x1c'):var _0x171d2d=require('twilio');if(_0x4bf4e4[_0x09e4('0x1d')]&&_0x4bf4e4[_0x09e4('0x1e')]&&_0x4bf4e4[_0x09e4('0x1f')]){var _0x4091c1=new _0x171d2d(_0x4bf4e4[_0x09e4('0x1d')],_0x4bf4e4[_0x09e4('0x1e')]);_0x4091c1[_0x09e4('0x20')][_0x09e4('0x21')]({'body':_0xa4ad9e[_0x09e4('0xc')],'to':_0x09e4('0x22')+_0xa4ad9e[_0x09e4('0x1f')],'from':_0x09e4('0x22')+_0x4bf4e4['phone'],'statusCallback':_0x4bf4e4['remote']+'/api/whatsapp/messages/'+_0xa4ad9e['id']+_0x09e4('0x23')+_0x4bf4e4[_0x09e4('0x24')]})[_0x09e4('0x25')](function(_0x1b6f36){if(_0x1b6f36[_0x09e4('0x26')]){return _0x341e57[_0x09e4('0x17')]({'messageId':_0x1b6f36[_0x09e4('0x26')]});}})[_0x09e4('0x19')](function(_0x2a2af1){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x09e4('0x27'),_0x09e4('0x1c'),util['inspect'](_0x2a2af1,{'showHidden':![],'depth':null}));});}else{logger[_0x09e4('0x28')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x09e4('0x1c'),_0x09e4('0x29'));}break;}}})[_0x09e4('0x2a')](function(){_0x26994f();});}else{_0x26994f();}}},'charset':_0x09e4('0x2b'),'collate':_0x09e4('0x2c')});}; \ No newline at end of file +var _0xf28f=['messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','out','isNil','findOne','WhatsappInteractionId','update','catch','error','direction','secret','WhatsappAccount','find','then','type','twilio','authToken','phone','accountSid'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0xf28f,0x6f));var _0xff28=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xf28f[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xff28('0x0'));var util=require('util');var logger=require(_0xff28('0x1'))(_0xff28('0x2'));var moment=require('moment');var BPromise=require(_0xff28('0x3'));var rp=require(_0xff28('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff28('0x5'));var attributes=require('./whatsappMessage.attributes');module[_0xff28('0x6')]=function(_0x44eba8,_0x44fabd){return _0x44eba8[_0xff28('0x7')]('WhatsappMessage',attributes,{'tableName':_0xff28('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xff28('0x9')]},{'name':_0xff28('0xa'),'fields':[_0xff28('0xb')],'type':_0xff28('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfe2a7a,_0x51fd71,_0x4eefe3){var _0xa98d6e=_0x44eba8[_0xff28('0xd')];var _0x372302=_0xfe2a7a[_0xff28('0xe')]({'plain':!![]});if(_0x372302['direction']['toLowerCase']()==='in'||_0x372302['direction'][_0xff28('0xf')]()===_0xff28('0x10')&&!_0x372302['secret']&&!_[_0xff28('0x11')](_0x372302['UserId'])){_0xa98d6e['WhatsappInteraction'][_0xff28('0x12')]({'where':{'id':_0x372302[_0xff28('0x13')]}})['then'](function(_0x723b84){if(_0x723b84){_0x723b84[_0xff28('0x14')]({'lastMsgAt':_0x372302['createdAt'],'lastMsgDirection':_0x372302['direction'][_0xff28('0xf')]()});}})[_0xff28('0x15')](function(_0x5ee003){console[_0xff28('0x16')](_0x5ee003);});}if(_0x372302[_0xff28('0x17')]===_0xff28('0x10')&&!_0x372302[_0xff28('0x18')]){var _0x356376;_0xa98d6e[_0xff28('0x19')][_0xff28('0x1a')]({'where':{'id':_0x372302['WhatsappAccountId']},'raw':!![]})[_0xff28('0x1b')](function(_0x4f8131){_0x356376=_0x4f8131;if(_0x356376&&_0x356376['type']){switch(_0x356376[_0xff28('0x1c')]){case _0xff28('0x1d'):var _0x4e9d1c=require(_0xff28('0x1d'));if(_0x356376['accountSid']&&_0x356376[_0xff28('0x1e')]&&_0x356376[_0xff28('0x1f')]){var _0x278d25=new _0x4e9d1c(_0x356376[_0xff28('0x20')],_0x356376[_0xff28('0x1e')]);_0x278d25[_0xff28('0x21')][_0xff28('0x22')]({'body':_0x372302[_0xff28('0xb')],'to':'whatsapp:'+_0x372302[_0xff28('0x1f')],'from':_0xff28('0x23')+_0x356376['phone'],'statusCallback':_0x356376[_0xff28('0x24')]+_0xff28('0x25')+_0x372302['id']+_0xff28('0x26')+_0x356376[_0xff28('0x27')]})[_0xff28('0x1b')](function(_0x3371cc){if(_0x3371cc['sid']){return _0xfe2a7a[_0xff28('0x14')]({'messageId':_0x3371cc[_0xff28('0x28')]});}})[_0xff28('0x15')](function(_0x45b8ca){logger[_0xff28('0x16')](_0xff28('0x29'),_0xff28('0x2a'),_0xff28('0x1d'),util[_0xff28('0x2b')](_0x45b8ca,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xff28('0x2a'),'twilio',_0xff28('0x2c'));}break;}}})[_0xff28('0x2d')](function(){_0x4eefe3();});}else{_0x4eefe3();}}},'charset':_0xff28('0x2e'),'collate':_0xff28('0x2f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ab29b09..7bf95da 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 _0x28c9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','request\x20sent','result','catch','CreateWhatsappMessage','create','body','options','stringify'];(function(_0x4b1040,_0x478e3d){var _0x1f4e63=function(_0x1b62ba){while(--_0x1b62ba){_0x4b1040['push'](_0x4b1040['shift']());}};_0x1f4e63(++_0x478e3d);}(_0x28c9,0x13b));var _0x928c=function(_0x95a28c,_0x4ba797){_0x95a28c=_0x95a28c-0x0;var _0x1f7c7b=_0x28c9[_0x95a28c];return _0x1f7c7b;};'use strict';var _=require(_0x928c('0x0'));var util=require(_0x928c('0x1'));var moment=require(_0x928c('0x2'));var BPromise=require(_0x928c('0x3'));var rs=require(_0x928c('0x4'));var fs=require('fs');var Redis=require(_0x928c('0x5'));var db=require(_0x928c('0x6'))['db'];var utils=require(_0x928c('0x7'));var logger=require(_0x928c('0x8'))(_0x928c('0x9'));var config=require(_0x928c('0xa'));var jayson=require(_0x928c('0xb'));var client=jayson[_0x928c('0xc')]['http']({'port':0x232a});config[_0x928c('0xd')]=_[_0x928c('0xe')](config[_0x928c('0xd')],{'host':_0x928c('0xf'),'port':0x18eb});var socket=require(_0x928c('0x10'))(new Redis(config[_0x928c('0xd')]));require(_0x928c('0x11'))['register'](socket);function respondWithRpcPromise(_0x36fda1,_0x4547de,_0x3f870c){return new BPromise(function(_0x265ae2,_0x129298){return client[_0x928c('0x12')](_0x36fda1,_0x3f870c)[_0x928c('0x13')](function(_0x24965e){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4547de,'request\x20sent');logger[_0x928c('0x14')](_0x928c('0x15'),_0x4547de,'request\x20sent',JSON['stringify'](_0x24965e));if(_0x24965e[_0x928c('0x16')]){if(_0x24965e['error'][_0x928c('0x17')]===0x1f4){logger[_0x928c('0x16')](_0x928c('0x18'),_0x4547de,_0x24965e[_0x928c('0x16')][_0x928c('0x19')]);return _0x129298(_0x24965e[_0x928c('0x16')]['message']);}logger['error'](_0x928c('0x18'),_0x4547de,_0x24965e['error'][_0x928c('0x19')]);return _0x265ae2(_0x24965e[_0x928c('0x16')]['message']);}else{logger[_0x928c('0x1a')](_0x928c('0x18'),_0x4547de,_0x928c('0x1b'));_0x265ae2(_0x24965e[_0x928c('0x1c')][_0x928c('0x19')]);}})[_0x928c('0x1d')](function(_0x3fd6b8){logger[_0x928c('0x16')](_0x928c('0x18'),_0x4547de,_0x3fd6b8);_0x129298(_0x3fd6b8);});});}exports[_0x928c('0x1e')]=function(_0x354896){var _0x3a7308=this;return new Promise(function(_0x50a37b,_0x382c20){return db['WhatsappMessage'][_0x928c('0x1f')](_0x354896[_0x928c('0x20')],{'raw':_0x354896[_0x928c('0x21')]?_0x354896[_0x928c('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x928c('0x13')](function(_0xf51504){logger[_0x928c('0x1a')](_0x928c('0x1e'),_0x354896);logger[_0x928c('0x14')](_0x928c('0x1e'),_0x354896,JSON[_0x928c('0x22')](_0xf51504));_0x50a37b(_0xf51504);})[_0x928c('0x1d')](function(_0x4dc47a){logger['error'](_0x928c('0x1e'),_0x4dc47a['message'],_0x354896);_0x382c20(_0x3a7308[_0x928c('0x16')](0x1f4,_0x4dc47a[_0x928c('0x19')]));});});}; \ No newline at end of file +var _0x9be9=['WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40bc7d,_0x2ed7c4){var _0x11a274=function(_0x4589b6){while(--_0x4589b6){_0x40bc7d['push'](_0x40bc7d['shift']());}};_0x11a274(++_0x2ed7c4);}(_0x9be9,0x6a));var _0x99be=function(_0x170674,_0x236cfa){_0x170674=_0x170674-0x0;var _0x401fe8=_0x9be9[_0x170674];return _0x401fe8;};'use strict';var _=require(_0x99be('0x0'));var util=require('util');var moment=require(_0x99be('0x1'));var BPromise=require(_0x99be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99be('0x3'))['db'];var utils=require(_0x99be('0x4'));var logger=require('../../config/logger')(_0x99be('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x99be('0x6')][_0x99be('0x7')]({'port':0x232a});config[_0x99be('0x8')]=_[_0x99be('0x9')](config[_0x99be('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x99be('0xa'))(new Redis(config[_0x99be('0x8')]));require(_0x99be('0xb'))[_0x99be('0xc')](socket);function respondWithRpcPromise(_0x58b89c,_0x54e97e,_0x496e73){return new BPromise(function(_0x366e43,_0x713e37){return client[_0x99be('0xd')](_0x58b89c,_0x496e73)['then'](function(_0x178ea7){logger[_0x99be('0xe')](_0x99be('0xf'),_0x54e97e,_0x99be('0x10'));logger[_0x99be('0x11')](_0x99be('0x12'),_0x54e97e,_0x99be('0x10'),JSON[_0x99be('0x13')](_0x178ea7));if(_0x178ea7[_0x99be('0x14')]){if(_0x178ea7[_0x99be('0x14')][_0x99be('0x15')]===0x1f4){logger[_0x99be('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x54e97e,_0x178ea7[_0x99be('0x14')][_0x99be('0x16')]);return _0x713e37(_0x178ea7[_0x99be('0x14')]['message']);}logger[_0x99be('0x14')](_0x99be('0xf'),_0x54e97e,_0x178ea7[_0x99be('0x14')][_0x99be('0x16')]);return _0x366e43(_0x178ea7['error'][_0x99be('0x16')]);}else{logger[_0x99be('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x54e97e,_0x99be('0x10'));_0x366e43(_0x178ea7[_0x99be('0x17')][_0x99be('0x16')]);}})['catch'](function(_0x1f5ae4){logger['error'](_0x99be('0xf'),_0x54e97e,_0x1f5ae4);_0x713e37(_0x1f5ae4);});});}exports[_0x99be('0x18')]=function(_0x5a967d){var _0xc2b9f5=this;return new Promise(function(_0x3d08c1,_0x2735ed){return db[_0x99be('0x19')][_0x99be('0x1a')](_0x5a967d[_0x99be('0x1b')],{'raw':_0x5a967d[_0x99be('0x1c')]?_0x5a967d[_0x99be('0x1c')][_0x99be('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x43439a){logger[_0x99be('0xe')]('CreateWhatsappMessage',_0x5a967d);logger[_0x99be('0x11')](_0x99be('0x18'),_0x5a967d,JSON[_0x99be('0x13')](_0x43439a));_0x3d08c1(_0x43439a);})[_0x99be('0x1e')](function(_0x1d3814){logger[_0x99be('0x14')](_0x99be('0x18'),_0x1d3814[_0x99be('0x16')],_0x5a967d);_0x2735ed(_0xc2b9f5['error'](0x1f4,_0x1d3814[_0x99be('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index af78d73..6d5484e 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 _0x1852=['save','remove','update','emit','removeListener','register','./whatsappMessage.events'];(function(_0x2547e5,_0x2588b5){var _0x346dee=function(_0x1c5efc){while(--_0x1c5efc){_0x2547e5['push'](_0x2547e5['shift']());}};_0x346dee(++_0x2588b5);}(_0x1852,0x1e2));var _0x2185=function(_0x1e0f55,_0x2bcd89){_0x1e0f55=_0x1e0f55-0x0;var _0x5da725=_0x1852[_0x1e0f55];return _0x5da725;};'use strict';var WhatsappMessageEvents=require(_0x2185('0x0'));var events=[_0x2185('0x1'),_0x2185('0x2'),_0x2185('0x3')];function createListener(_0x201c49,_0x4177d2){return function(_0x3fb57f){_0x4177d2[_0x2185('0x4')](_0x201c49,_0x3fb57f);};}function removeListener(_0x3cf21b,_0x4d1ce9){return function(){WhatsappMessageEvents[_0x2185('0x5')](_0x3cf21b,_0x4d1ce9);};}exports[_0x2185('0x6')]=function(_0x3e5057){for(var _0x3f6012=0x0,_0x4759af=events['length'];_0x3f6012<_0x4759af;_0x3f6012++){var _0x325918=events[_0x3f6012];var _0x43d0d0=createListener('whatsappMessage:'+_0x325918,_0x3e5057);WhatsappMessageEvents['on'](_0x325918,_0x43d0d0);}}; \ No newline at end of file +var _0x6740=['update','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x1766f9,_0x506f9f){var _0x4ae5af=function(_0x86a5f6){while(--_0x86a5f6){_0x1766f9['push'](_0x1766f9['shift']());}};_0x4ae5af(++_0x506f9f);}(_0x6740,0xbd));var _0x0674=function(_0x465260,_0x459173){_0x465260=_0x465260-0x0;var _0x4a5405=_0x6740[_0x465260];return _0x4a5405;};'use strict';var WhatsappMessageEvents=require(_0x0674('0x0'));var events=[_0x0674('0x1'),_0x0674('0x2'),_0x0674('0x3')];function createListener(_0x23e930,_0x340c44){return function(_0x5192d3){_0x340c44[_0x0674('0x4')](_0x23e930,_0x5192d3);};}function removeListener(_0x2b7ad6,_0x3a8558){return function(){WhatsappMessageEvents[_0x0674('0x5')](_0x2b7ad6,_0x3a8558);};}exports[_0x0674('0x6')]=function(_0x203b1c){for(var _0x59bea6=0x0,_0x22b65a=events['length'];_0x59bea6<_0x22b65a;_0x59bea6++){var _0x638cf9=events[_0x59bea6];var _0x4cff84=createListener(_0x0674('0x7')+_0x638cf9,_0x203b1c);WhatsappMessageEvents['on'](_0x638cf9,_0x4cff84);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 206ac24..41679e5 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 _0x5f46=['create','put','/:id','update','delete','destroy','removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x5f46,0x8f));var _0x65f4=function(_0x1b7ac8,_0x549d64){_0x1b7ac8=_0x1b7ac8-0x0;var _0xc2e13c=_0x5f46[_0x1b7ac8];return _0xc2e13c;};'use strict';var multer=require('multer');var util=require(_0x65f4('0x0'));var path=require('path');var timeout=require(_0x65f4('0x1'));var express=require(_0x65f4('0x2'));var router=express[_0x65f4('0x3')]();var fs_extra=require(_0x65f4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x65f4('0x5'));var config=require(_0x65f4('0x6'));var controller=require('./whatsappQueue.controller');router[_0x65f4('0x7')]('/',auth[_0x65f4('0x8')](),controller[_0x65f4('0x9')]);router[_0x65f4('0x7')](_0x65f4('0xa'),auth[_0x65f4('0x8')](),controller[_0x65f4('0xb')]);router[_0x65f4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x65f4('0xc')]);router['get'](_0x65f4('0xd'),auth[_0x65f4('0x8')](),controller['getMembers']);router[_0x65f4('0x7')](_0x65f4('0xe'),auth[_0x65f4('0x8')](),controller[_0x65f4('0xf')]);router['get'](_0x65f4('0x10'),auth[_0x65f4('0x8')](),controller[_0x65f4('0x11')]);router[_0x65f4('0x12')]('/',auth[_0x65f4('0x8')](),controller[_0x65f4('0x13')]);router[_0x65f4('0x12')](_0x65f4('0xe'),auth[_0x65f4('0x8')](),controller['addTeams']);router[_0x65f4('0x12')](_0x65f4('0x10'),auth[_0x65f4('0x8')](),controller['addAgents']);router[_0x65f4('0x14')](_0x65f4('0x15'),auth[_0x65f4('0x8')](),controller[_0x65f4('0x16')]);router[_0x65f4('0x17')](_0x65f4('0x15'),auth[_0x65f4('0x8')](),controller[_0x65f4('0x18')]);router[_0x65f4('0x17')]('/:id/teams',auth[_0x65f4('0x8')](),controller[_0x65f4('0x19')]);router[_0x65f4('0x17')](_0x65f4('0x10'),auth[_0x65f4('0x8')](),controller['removeAgents']);module[_0x65f4('0x1a')]=router; \ No newline at end of file +var _0xa3b3=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams','removeAgents'];(function(_0x20bd86,_0x38688b){var _0x3a4623=function(_0x47bd85){while(--_0x47bd85){_0x20bd86['push'](_0x20bd86['shift']());}};_0x3a4623(++_0x38688b);}(_0xa3b3,0x1e1));var _0x3a3b=function(_0x2fe81,_0x134d72){_0x2fe81=_0x2fe81-0x0;var _0x49644a=_0xa3b3[_0x2fe81];return _0x49644a;};'use strict';var multer=require(_0x3a3b('0x0'));var util=require(_0x3a3b('0x1'));var path=require(_0x3a3b('0x2'));var timeout=require(_0x3a3b('0x3'));var express=require(_0x3a3b('0x4'));var router=express[_0x3a3b('0x5')]();var fs_extra=require(_0x3a3b('0x6'));var auth=require(_0x3a3b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3a3b('0x8'));var controller=require(_0x3a3b('0x9'));router[_0x3a3b('0xa')]('/',auth[_0x3a3b('0xb')](),controller[_0x3a3b('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3a3b('0xd')]);router['get'](_0x3a3b('0xe'),auth[_0x3a3b('0xb')](),controller[_0x3a3b('0xf')]);router[_0x3a3b('0xa')]('/:id/members',auth[_0x3a3b('0xb')](),controller[_0x3a3b('0x10')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x3a3b('0x11'),auth[_0x3a3b('0xb')](),controller[_0x3a3b('0x12')]);router[_0x3a3b('0x13')]('/',auth[_0x3a3b('0xb')](),controller[_0x3a3b('0x14')]);router[_0x3a3b('0x13')]('/:id/teams',auth[_0x3a3b('0xb')](),controller[_0x3a3b('0x15')]);router[_0x3a3b('0x13')](_0x3a3b('0x11'),auth['isAuthenticated'](),controller[_0x3a3b('0x16')]);router[_0x3a3b('0x17')](_0x3a3b('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x3a3b('0x18')](_0x3a3b('0xe'),auth[_0x3a3b('0xb')](),controller[_0x3a3b('0x19')]);router[_0x3a3b('0x18')](_0x3a3b('0x1a'),auth[_0x3a3b('0xb')](),controller[_0x3a3b('0x1b')]);router[_0x3a3b('0x18')](_0x3a3b('0x11'),auth['isAuthenticated'](),controller[_0x3a3b('0x1c')]);module[_0x3a3b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6e9bb69..91c05a2 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 _0x4d46=['exports','STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x19d41a,_0x42b5c8){var _0x35d8a0=function(_0x5264db){while(--_0x5264db){_0x19d41a['push'](_0x19d41a['shift']());}};_0x35d8a0(++_0x42b5c8);}(_0x4d46,0x197));var _0x64d4=function(_0x33e4f4,_0x3bc0e4){_0x33e4f4=_0x33e4f4-0x0;var _0x389487=_0x4d46[_0x33e4f4];return _0x389487;};'use strict';var Sequelize=require(_0x64d4('0x0'));module[_0x64d4('0x1')]={'name':{'type':Sequelize[_0x64d4('0x2')],'unique':_0x64d4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x64d4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x64d4('0x5')]('rrmemory',_0x64d4('0x6'),_0x64d4('0x7'))},'description':{'type':Sequelize[_0x64d4('0x2')]}}; \ No newline at end of file +var _0x2e54=['ENUM','rrmemory','beepall','roundrobin','STRING','sequelize','name','INTEGER'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x2e54,0x1dd));var _0x42e5=function(_0xb25b5f,_0x38c234){_0xb25b5f=_0xb25b5f-0x0;var _0x54da9b=_0x2e54[_0xb25b5f];return _0x54da9b;};'use strict';var Sequelize=require(_0x42e5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x42e5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x42e5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x42e5('0x3')](_0x42e5('0x4'),_0x42e5('0x5'),_0x42e5('0x6'))},'description':{'type':Sequelize[_0x42e5('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 0c8cbc7..c64f08c 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 _0xbeed=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','hasOwnProperty','order','WhatsappQueueId','User','findAndCountAll','UserId','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','ids','select','tq.TeamId','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','json','undefined','count','offset','limit','status','Content-Range','apply','reject','update','then','destroy','get','WhatsappQueues','sendStatus','error','stack','send','map','WhatsappQueue','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbeed,0x165));var _0xdbee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbeed[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdbee('0x0'));var rp=require('request-promise');var moment=require(_0xdbee('0x1'));var BPromise=require(_0xdbee('0x2'));var Mustache=require(_0xdbee('0x3'));var util=require(_0xdbee('0x4'));var path=require(_0xdbee('0x5'));var sox=require(_0xdbee('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbee('0x7'));var squel=require('squel');var crypto=require(_0xdbee('0x8'));var jsforce=require(_0xdbee('0x9'));var deskjs=require(_0xdbee('0xa'));var toCsv=require(_0xdbee('0xb'));var querystring=require(_0xdbee('0xc'));var Papa=require('papaparse');var Redis=require(_0xdbee('0xd'));var authService=require(_0xdbee('0xe'));var qs=require(_0xdbee('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbee('0x10'));var logger=require(_0xdbee('0x11'))(_0xdbee('0x12'));var utils=require('../../config/utils');var config=require(_0xdbee('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbee('0x14'))['db'];config[_0xdbee('0x15')]=_[_0xdbee('0x16')](config[_0xdbee('0x15')],{'host':_0xdbee('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbee('0x15')]));require(_0xdbee('0x18'))['register'](socket);function respondWithStatusCode(_0x16b6cd,_0x1df180){_0x1df180=_0x1df180||0xcc;return function(_0x2b9d07){if(_0x2b9d07){return _0x16b6cd['sendStatus'](_0x1df180);}return _0x16b6cd['status'](_0x1df180)['end']();};}function respondWithResult(_0x228993,_0x3506ec){_0x3506ec=_0x3506ec||0xc8;return function(_0x548942){if(_0x548942){return _0x228993['status'](_0x3506ec)[_0xdbee('0x19')](_0x548942);}};}function respondWithFilteredResult(_0x281305,_0x3a3c4e){return function(_0x1847bb){if(_0x1847bb){var _0x1afb5a=typeof _0x3a3c4e['offset']===_0xdbee('0x1a')&&typeof _0x3a3c4e['limit']===_0xdbee('0x1a');var _0x35ffdd=_0x1847bb[_0xdbee('0x1b')];var _0x551eaa=_0x1afb5a?0x0:_0x3a3c4e[_0xdbee('0x1c')];var _0x45206e=_0x1afb5a?_0x1847bb['count']:_0x3a3c4e[_0xdbee('0x1c')]+_0x3a3c4e[_0xdbee('0x1d')];var _0x7feb46;if(_0x45206e>=_0x35ffdd){_0x45206e=_0x35ffdd;_0x7feb46=0xc8;}else{_0x7feb46=0xce;}_0x281305[_0xdbee('0x1e')](_0x7feb46);return _0x281305['set'](_0xdbee('0x1f'),_0x551eaa+'-'+_0x45206e+'/'+_0x35ffdd)[_0xdbee('0x19')](_0x1847bb);}return null;};}function patchUpdates(_0x31d147){return function(_0x59bbe1){try{jsonpatch[_0xdbee('0x20')](_0x59bbe1,_0x31d147,!![]);}catch(_0x215018){return BPromise[_0xdbee('0x21')](_0x215018);}return _0x59bbe1['save']();};}function saveUpdates(_0x1d2482,_0x1e73ba){return function(_0x5ca1ae){if(_0x5ca1ae){return _0x5ca1ae[_0xdbee('0x22')](_0x1d2482)[_0xdbee('0x23')](function(_0x45dd2e){return _0x45dd2e;});}return null;};}function removeEntity(_0x4e91db,_0x261f90){return function(_0x547c9d){if(_0x547c9d){return _0x547c9d[_0xdbee('0x24')]()[_0xdbee('0x23')](function(){var _0x3526ec=_0x547c9d[_0xdbee('0x25')]({'plain':!![]});var _0x496b28=_0xdbee('0x26');return db['UserProfileResource'][_0xdbee('0x24')]({'where':{'type':_0x496b28,'resourceId':_0x3526ec['id']}})[_0xdbee('0x23')](function(){return _0x547c9d;});})[_0xdbee('0x23')](function(){_0x4e91db[_0xdbee('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeb4f22,_0x36183c){return function(_0x3892ff){if(!_0x3892ff){_0xeb4f22[_0xdbee('0x27')](0x194);}return _0x3892ff;};}function handleError(_0x4f2efe,_0x42a33e){_0x42a33e=_0x42a33e||0x1f4;return function(_0x4785a){logger[_0xdbee('0x28')](_0x4785a[_0xdbee('0x29')]);if(_0x4785a['name']){delete _0x4785a['name'];}_0x4f2efe[_0xdbee('0x1e')](_0x42a33e)[_0xdbee('0x2a')](_0x4785a);};}exports['index']=function(_0x48033d,_0x24fb4b){var _0x3266b={},_0x1244e8={},_0x2d6dc0={'count':0x0,'rows':[]};var _0x390bfe=_[_0xdbee('0x2b')](db[_0xdbee('0x2c')]['rawAttributes'],function(_0x1271c0){return{'name':_0x1271c0[_0xdbee('0x2d')],'type':_0x1271c0[_0xdbee('0x2e')][_0xdbee('0x2f')]};});_0x1244e8[_0xdbee('0x30')]=_[_0xdbee('0x2b')](_0x390bfe,_0xdbee('0x31'));_0x1244e8[_0xdbee('0x32')]=_[_0xdbee('0x33')](_0x48033d['query']);_0x1244e8[_0xdbee('0x34')]=_['intersection'](_0x1244e8[_0xdbee('0x30')],_0x1244e8[_0xdbee('0x32')]);_0x3266b[_0xdbee('0x35')]=_[_0xdbee('0x36')](_0x1244e8[_0xdbee('0x30')],qs[_0xdbee('0x37')](_0x48033d[_0xdbee('0x32')]['fields']));_0x3266b[_0xdbee('0x35')]=_0x3266b[_0xdbee('0x35')][_0xdbee('0x38')]?_0x3266b[_0xdbee('0x35')]:_0x1244e8[_0xdbee('0x30')];if(!_0x48033d[_0xdbee('0x32')]['hasOwnProperty'](_0xdbee('0x39'))){_0x3266b[_0xdbee('0x1d')]=qs[_0xdbee('0x1d')](_0x48033d[_0xdbee('0x32')][_0xdbee('0x1d')]);_0x3266b[_0xdbee('0x1c')]=qs[_0xdbee('0x1c')](_0x48033d[_0xdbee('0x32')][_0xdbee('0x1c')]);}_0x3266b['order']=qs[_0xdbee('0x3a')](_0x48033d[_0xdbee('0x32')][_0xdbee('0x3a')]);_0x3266b[_0xdbee('0x3b')]=qs[_0xdbee('0x34')](_[_0xdbee('0x3c')](_0x48033d['query'],_0x1244e8[_0xdbee('0x34')]),_0x390bfe);if(_0x48033d[_0xdbee('0x32')]['filter']){_0x3266b['where']=_[_0xdbee('0x3d')](_0x3266b[_0xdbee('0x3b')],{'$or':_[_0xdbee('0x2b')](_0x390bfe,function(_0x1d6bcd){if(_0x1d6bcd['type']!==_0xdbee('0x3e')){var _0x4138e4={};_0x4138e4[_0x1d6bcd[_0xdbee('0x31')]]={'$like':'%'+_0x48033d[_0xdbee('0x32')][_0xdbee('0x3f')]+'%'};return _0x4138e4;}})});}_0x3266b=_['merge']({},_0x3266b,_0x48033d[_0xdbee('0x40')]);var _0x9aa745={'where':_0x3266b['where']};return db[_0xdbee('0x2c')][_0xdbee('0x1b')](_0x9aa745)[_0xdbee('0x23')](function(_0x1e1154){_0x2d6dc0[_0xdbee('0x1b')]=_0x1e1154;if(_0x48033d[_0xdbee('0x32')][_0xdbee('0x41')]){_0x3266b[_0xdbee('0x42')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xdbee('0x43')](_0x3266b);})[_0xdbee('0x23')](function(_0x3ca2fd){_0x2d6dc0[_0xdbee('0x44')]=_0x3ca2fd;return _0x2d6dc0;})[_0xdbee('0x23')](respondWithFilteredResult(_0x24fb4b,_0x3266b))[_0xdbee('0x45')](handleError(_0x24fb4b,null));};exports['show']=function(_0x5ef3bd,_0x17c836){var _0xf56d6={'raw':!![],'where':{'id':_0x5ef3bd[_0xdbee('0x46')]['id']}},_0x214ae6={};_0x214ae6[_0xdbee('0x30')]=_[_0xdbee('0x33')](db[_0xdbee('0x2c')]['rawAttributes']);_0x214ae6['query']=_[_0xdbee('0x33')](_0x5ef3bd[_0xdbee('0x32')]);_0x214ae6[_0xdbee('0x34')]=_[_0xdbee('0x36')](_0x214ae6['model'],_0x214ae6[_0xdbee('0x32')]);_0xf56d6[_0xdbee('0x35')]=_['intersection'](_0x214ae6[_0xdbee('0x30')],qs['fields'](_0x5ef3bd[_0xdbee('0x32')][_0xdbee('0x37')]));_0xf56d6['attributes']=_0xf56d6['attributes'][_0xdbee('0x38')]?_0xf56d6[_0xdbee('0x35')]:_0x214ae6[_0xdbee('0x30')];if(_0x5ef3bd[_0xdbee('0x32')][_0xdbee('0x41')]){_0xf56d6[_0xdbee('0x42')]=[{'all':!![]}];}_0xf56d6=_[_0xdbee('0x3d')]({},_0xf56d6,_0x5ef3bd[_0xdbee('0x40')]);return db[_0xdbee('0x2c')][_0xdbee('0x47')](_0xf56d6)['then'](handleEntityNotFound(_0x17c836,null))[_0xdbee('0x23')](respondWithResult(_0x17c836,null))['catch'](handleError(_0x17c836,null));};exports[_0xdbee('0x48')]=function(_0x55b957,_0x569ee6){return db[_0xdbee('0x2c')]['create'](_0x55b957[_0xdbee('0x49')],{})[_0xdbee('0x23')](function(_0x4d917b){var _0x553811=_0x55b957[_0xdbee('0x4a')][_0xdbee('0x25')]({'plain':!![]});if(!_0x553811)throw new Error(_0xdbee('0x4b'));if(_0x553811[_0xdbee('0x4c')]===_0xdbee('0x4a')){var _0x5c530d=_0x4d917b[_0xdbee('0x25')]({'plain':!![]});var _0x51610d='WhatsappQueues';return db['UserProfileSection'][_0xdbee('0x47')]({'where':{'name':_0x51610d,'userProfileId':_0x553811[_0xdbee('0x4d')]},'raw':!![]})[_0xdbee('0x23')](function(_0x430534){if(_0x430534&&_0x430534[_0xdbee('0x4e')]===0x0){return db[_0xdbee('0x4f')]['create']({'name':_0x5c530d[_0xdbee('0x31')],'resourceId':_0x5c530d['id'],'type':_0x430534['name'],'sectionId':_0x430534['id']},{})[_0xdbee('0x23')](function(){return _0x4d917b;});}else{return _0x4d917b;}})[_0xdbee('0x45')](function(_0x6f9676){logger['error'](_0xdbee('0x50'),_0x6f9676);throw _0x6f9676;});}return _0x4d917b;})[_0xdbee('0x23')](respondWithResult(_0x569ee6,0xc9))[_0xdbee('0x45')](handleError(_0x569ee6,null));};exports[_0xdbee('0x22')]=function(_0x170ea0,_0x40425a){if(_0x170ea0[_0xdbee('0x49')]['id']){delete _0x170ea0[_0xdbee('0x49')]['id'];}return db[_0xdbee('0x2c')][_0xdbee('0x47')]({'where':{'id':_0x170ea0[_0xdbee('0x46')]['id']}})[_0xdbee('0x23')](handleEntityNotFound(_0x40425a,null))['then'](saveUpdates(_0x170ea0[_0xdbee('0x49')],null))[_0xdbee('0x23')](respondWithResult(_0x40425a,null))[_0xdbee('0x45')](handleError(_0x40425a,null));};exports['destroy']=function(_0x55a6f1,_0x39b5fa){return db['WhatsappQueue'][_0xdbee('0x47')]({'where':{'id':_0x55a6f1[_0xdbee('0x46')]['id']}})['then'](handleEntityNotFound(_0x39b5fa,null))[_0xdbee('0x23')](removeEntity(_0x39b5fa,null))[_0xdbee('0x45')](handleError(_0x39b5fa,null));};exports['describe']=function(_0x520869,_0xaacf97){return db['WhatsappQueue'][_0xdbee('0x51')]()[_0xdbee('0x23')](respondWithResult(_0xaacf97,null))['catch'](handleError(_0xaacf97,null));};exports[_0xdbee('0x52')]=function(_0x319736,_0x55dc42,_0x2adfc2){var _0x142855={'raw':!![],'where':{}},_0x1bbb6a={},_0x231342;return db['WhatsappQueue'][_0xdbee('0x53')]({'where':{'id':_0x319736[_0xdbee('0x46')]['id']}})[_0xdbee('0x23')](handleEntityNotFound(_0x55dc42,null))[_0xdbee('0x23')](function(_0x11c530){if(_0x11c530){_0x231342=_0x11c530[_0xdbee('0x25')]({'plain':!![]});_0x1bbb6a[_0xdbee('0x30')]=_['keys'](db[_0xdbee('0x54')][_0xdbee('0x55')]);_0x1bbb6a[_0xdbee('0x32')]=_[_0xdbee('0x33')](_0x319736[_0xdbee('0x32')]);_0x1bbb6a[_0xdbee('0x34')]=_['intersection'](_0x1bbb6a[_0xdbee('0x30')],_0x1bbb6a[_0xdbee('0x32')]);_0x142855['attributes']=_[_0xdbee('0x36')](_0x1bbb6a['model'],qs['fields'](_0x319736['query']['fields']));_0x142855['attributes']=_0x142855[_0xdbee('0x35')][_0xdbee('0x38')]?_0x142855[_0xdbee('0x35')]:_0x1bbb6a[_0xdbee('0x30')];if(!_0x319736[_0xdbee('0x32')][_0xdbee('0x56')](_0xdbee('0x39'))){_0x142855[_0xdbee('0x1d')]=qs['limit'](_0x319736['query'][_0xdbee('0x1d')]);_0x142855[_0xdbee('0x1c')]=qs[_0xdbee('0x1c')](_0x319736[_0xdbee('0x32')]['offset']);}_0x142855[_0xdbee('0x57')]=qs[_0xdbee('0x3a')](_0x319736[_0xdbee('0x32')][_0xdbee('0x3a')]);_0x142855[_0xdbee('0x3b')]=qs[_0xdbee('0x34')](_['pick'](_0x319736[_0xdbee('0x32')],_0x1bbb6a[_0xdbee('0x34')]));_0x142855[_0xdbee('0x3b')][_0xdbee('0x58')]=_0x11c530['id'];if(_0x319736['query'][_0xdbee('0x3f')]){_0x142855[_0xdbee('0x3b')]=_[_0xdbee('0x3d')](_0x142855[_0xdbee('0x3b')],{'$or':_[_0xdbee('0x2b')](_0x142855['attributes'],function(_0x57ea9e){var _0x40ccef={};_0x40ccef[_0x57ea9e]={'$like':'%'+_0x319736['query'][_0xdbee('0x3f')]+'%'};return _0x40ccef;})});}_0x142855=_[_0xdbee('0x3d')]({},_0x142855,_0x319736[_0xdbee('0x40')]);return db[_0xdbee('0x54')][_0xdbee('0x43')](_0x142855);}})[_0xdbee('0x23')](function(_0x5654e7){if(_0x5654e7){return db[_0xdbee('0x59')][_0xdbee('0x5a')]({'where':{'id':_[_0xdbee('0x2b')](_0x5654e7,_0xdbee('0x5b')),'role':'agent'},'attributes':['id','name','whatsappPause',_0xdbee('0x5c'),'createdAt']});}})['then'](function(_0x515bd7){if(_0x515bd7){return{'count':_0x515bd7[_0xdbee('0x1b')],'rows':_[_0xdbee('0x2b')](_0x515bd7[_0xdbee('0x44')],function(_0x2ea626){return{'membername':_0x2ea626[_0xdbee('0x31')],'UserId':_0x2ea626['id'],'queue_name':_0x231342[_0xdbee('0x31')],'WhatsappQueueId':_0x231342['id'],'interface':util[_0xdbee('0x5d')](_0xdbee('0x5e'),_0xdbee('0x5f'),_0x2ea626[_0xdbee('0x31')]),'penalty':0x0,'paused':_0x2ea626['whatsappPause'],'createdAt':_0x2ea626[_0xdbee('0x60')],'updatedAt':_0x2ea626['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x55dc42,_0x142855))[_0xdbee('0x45')](handleError(_0x55dc42,null));};exports[_0xdbee('0x61')]=function(_0x1ea78b,_0x138b25,_0x5b7acf){var _0x40e77e={};var _0x191ac3={};var _0x5a0c9d;var _0x591697;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1ea78b['params']['id']}})['then'](handleEntityNotFound(_0x138b25,null))['then'](function(_0x2ec98c){if(_0x2ec98c){_0x5a0c9d=_0x2ec98c;_0x191ac3['model']=_['keys'](db[_0xdbee('0x62')][_0xdbee('0x55')]);_0x191ac3[_0xdbee('0x32')]=_['keys'](_0x1ea78b[_0xdbee('0x32')]);_0x191ac3[_0xdbee('0x34')]=_[_0xdbee('0x36')](_0x191ac3[_0xdbee('0x30')],_0x191ac3[_0xdbee('0x32')]);_0x40e77e[_0xdbee('0x35')]=_['intersection'](_0x191ac3[_0xdbee('0x30')],qs[_0xdbee('0x37')](_0x1ea78b[_0xdbee('0x32')]['fields']));_0x40e77e[_0xdbee('0x35')]=_0x40e77e[_0xdbee('0x35')][_0xdbee('0x38')]?_0x40e77e['attributes']:_0x191ac3[_0xdbee('0x30')];_0x40e77e[_0xdbee('0x57')]=qs[_0xdbee('0x3a')](_0x1ea78b['query'][_0xdbee('0x3a')]);_0x40e77e[_0xdbee('0x3b')]=qs[_0xdbee('0x34')](_[_0xdbee('0x3c')](_0x1ea78b[_0xdbee('0x32')],_0x191ac3[_0xdbee('0x34')]));if(_0x1ea78b[_0xdbee('0x32')][_0xdbee('0x3f')]){_0x40e77e[_0xdbee('0x3b')]=_[_0xdbee('0x3d')](_0x40e77e[_0xdbee('0x3b')],{'$or':_[_0xdbee('0x2b')](_0x40e77e[_0xdbee('0x35')],function(_0x24afc3){var _0x226e65={};_0x226e65[_0x24afc3]={'$like':'%'+_0x1ea78b[_0xdbee('0x32')][_0xdbee('0x3f')]+'%'};return _0x226e65;})});}_0x40e77e=_[_0xdbee('0x3d')]({},_0x40e77e,_0x1ea78b[_0xdbee('0x40')]);return _0x5a0c9d[_0xdbee('0x61')](_0x40e77e);}})[_0xdbee('0x23')](function(_0x645ae){if(_0x645ae){_0x591697=_0x645ae['length'];if(!_0x1ea78b[_0xdbee('0x32')]['hasOwnProperty'](_0xdbee('0x39'))){_0x40e77e[_0xdbee('0x1d')]=qs[_0xdbee('0x1d')](_0x1ea78b[_0xdbee('0x32')][_0xdbee('0x1d')]);_0x40e77e[_0xdbee('0x1c')]=qs[_0xdbee('0x1c')](_0x1ea78b[_0xdbee('0x32')][_0xdbee('0x1c')]);}return _0x5a0c9d['getTeams'](_0x40e77e);}})['then'](function(_0x212b21){if(_0x212b21){return _0x212b21?{'count':_0x591697,'rows':_0x212b21}:null;}})[_0xdbee('0x23')](respondWithResult(_0x138b25,null))[_0xdbee('0x45')](handleError(_0x138b25,null));};exports[_0xdbee('0x63')]=function(_0x48d002,_0x267e4a,_0x24bcbb){var _0x5a0c8f=_0x48d002[_0xdbee('0x49')]['ids'];return db[_0xdbee('0x62')][_0xdbee('0x43')]({'where':{'id':_0x5a0c8f},'attributes':['id'],'include':[{'model':db[_0xdbee('0x59')],'as':_0xdbee('0x64'),'attributes':['id',_0xdbee('0x31'),_0xdbee('0x65'),_0xdbee('0x66'),_0xdbee('0x67')],'raw':!![]}]})[_0xdbee('0x23')](function(_0x1a1533){if(_0x1a1533){var _0x4bf683=_[_0xdbee('0x68')](_0x1a1533,function(_0x47dadf){var _0x41cb3a=_0x47dadf[_0xdbee('0x25')]({'plain':!![]});return _0x41cb3a[_0xdbee('0x64')];});return db[_0xdbee('0x2c')][_0xdbee('0x47')]({'where':{'id':_0x48d002[_0xdbee('0x46')]['id']}})[_0xdbee('0x23')](function(_0x1ec960){return db['sequelize'][_0xdbee('0x69')](function(_0x29152c){return _0x1ec960[_0xdbee('0x63')](_0x5a0c8f,{'transaction':_0x29152c})[_0xdbee('0x23')](function(){return BPromise[_0xdbee('0x6a')](_0x4bf683,function(_0x17c498){return db['UserWhatsappQueue'][_0xdbee('0x6b')]({'where':{'UserId':_0x17c498['id'],'WhatsappQueueId':_0x48d002['params']['id']},'transaction':_0x29152c});});})[_0xdbee('0x23')](function(){_0x4bf683[_0xdbee('0x6c')](function(_0x22c63a){socket[_0xdbee('0x6d')]('userWhatsappQueue:save',{'UserId':_0x22c63a['id'],'WhatsappQueueId':_0x1ec960['id']});});});});});}})['then'](respondWithStatusCode(_0x267e4a,null))[_0xdbee('0x45')](handleError(_0x267e4a,null));};exports['removeTeams']=function(_0x3e6247,_0x1ddd63,_0x5066e2){return db['Team']['findAll']({'where':{'id':_0x3e6247[_0xdbee('0x32')][_0xdbee('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xdbee('0x59')],'as':_0xdbee('0x64'),'attributes':['id'],'raw':!![]}]})[_0xdbee('0x23')](handleEntityNotFound(_0x1ddd63,null))[_0xdbee('0x23')](function(_0x307403){var _0x44faef=_[_0xdbee('0x2b')](_0x307403,'id');var _0x4a47de=[];var _0x5bd94c=[];var _0x30c361=squel[_0xdbee('0x6f')]();_0x30c361['field'](_0xdbee('0x70'))[_0xdbee('0x71')](_0xdbee('0x72'),'tq')[_0xdbee('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdbee('0x3b')](_0xdbee('0x74'),_0x3e6247[_0xdbee('0x46')]['id']);for(var _0x3505d7=0x0;_0x3505d7<_0x307403[_0xdbee('0x38')];_0x3505d7+=0x1){let _0x5ebf37=_0x307403[_0x3505d7];for(var _0xf6d354=0x0;_0xf6d354<_0x5ebf37[_0xdbee('0x64')]['length'];_0xf6d354+=0x1){let _0x2eb183=_0x5ebf37[_0xdbee('0x64')][_0xf6d354];var _0x40a90b=_0x30c361[_0xdbee('0x75')]();_0x40a90b[_0xdbee('0x3b')]('ut.UserId\x20=\x20?',_0x2eb183['id']);_0x5bd94c[_0xdbee('0x76')](db[_0xdbee('0x77')][_0xdbee('0x32')](_0x40a90b[_0xdbee('0x78')](),{'type':db[_0xdbee('0x77')]['QueryTypes'][_0xdbee('0x79')]})[_0xdbee('0x23')](function(_0x4ac1c8){if(_0x4ac1c8['length']===0x1){return _0x2eb183['id'];}else{var _0xb8cddb=_[_0xdbee('0x7a')](_[_0xdbee('0x2b')](_0x4ac1c8,_0xdbee('0x7b')),function(_0x1b74f3){return _[_0xdbee('0x7c')](_0x44faef,_0x1b74f3);});if(_0xb8cddb){return _0x2eb183['id'];}}}));}}return BPromise[_0xdbee('0x7d')](_0x5bd94c)[_0xdbee('0x23')](function(_0x1d4556){_0x4a47de=_(_0x4a47de)[_0xdbee('0x7e')](_0x1d4556)[_0xdbee('0x7f')]()[_0xdbee('0x80')]();return db[_0xdbee('0x2c')][_0xdbee('0x47')]({'where':{'id':_0x3e6247[_0xdbee('0x46')]['id']}})[_0xdbee('0x23')](function(_0x50b214){return db[_0xdbee('0x77')][_0xdbee('0x69')](function(_0x3c1099){return _0x50b214[_0xdbee('0x81')](_0x3e6247[_0xdbee('0x32')][_0xdbee('0x6e')],{'transaction':_0x3c1099})[_0xdbee('0x23')](function(){if(!_[_0xdbee('0x82')](_0x4a47de)){return _0x50b214[_0xdbee('0x83')](_0x4a47de,{'transaction':_0x3c1099});}})[_0xdbee('0x23')](function(){_0x4a47de[_0xdbee('0x6c')](function(_0x5b68b4){socket[_0xdbee('0x6d')](_0xdbee('0x84'),{'UserId':_0x5b68b4,'WhatsappQueueId':_0x50b214['id']});});});});});});})[_0xdbee('0x23')](respondWithStatusCode(_0x1ddd63,null))[_0xdbee('0x45')](handleError(_0x1ddd63,null));};exports[_0xdbee('0x85')]=function(_0xb99d30,_0x44eff7,_0xd5159){return db[_0xdbee('0x2c')][_0xdbee('0x47')]({'where':{'id':_0xb99d30['params']['id']}})[_0xdbee('0x23')](handleEntityNotFound(_0x44eff7,null))[_0xdbee('0x23')](function(_0x495dc4){if(_0x495dc4){return _0x495dc4[_0xdbee('0x85')](_0xb99d30[_0xdbee('0x49')]['ids'],_[_0xdbee('0x86')](_0xb99d30[_0xdbee('0x49')],[_0xdbee('0x6e'),'id'])||{})[_0xdbee('0x87')](function(_0x378774){for(var _0x5193e8=0x0;_0x5193e8<_0xb99d30[_0xdbee('0x49')][_0xdbee('0x6e')][_0xdbee('0x38')];_0x5193e8+=0x1){socket[_0xdbee('0x6d')](_0xdbee('0x88'),{'UserId':Number(_0xb99d30['body'][_0xdbee('0x6e')][_0x5193e8]),'WhatsappQueueId':Number(_0xb99d30[_0xdbee('0x46')]['id'])});}return _0x378774;});}})[_0xdbee('0x23')](respondWithResult(_0x44eff7,null))['catch'](handleError(_0x44eff7,null));};exports['removeAgents']=function(_0x2d1b19,_0x2d05d0,_0x56063a){return db[_0xdbee('0x2c')][_0xdbee('0x47')]({'where':{'id':_0x2d1b19[_0xdbee('0x46')]['id']}})[_0xdbee('0x23')](handleEntityNotFound(_0x2d05d0,null))[_0xdbee('0x23')](function(_0x2bcbdb){if(_0x2bcbdb){return _0x2bcbdb['removeAgents'](_0x2d1b19[_0xdbee('0x32')][_0xdbee('0x6e')])['then'](function(){if(_[_0xdbee('0x89')](_0x2d1b19[_0xdbee('0x32')]['ids'])){for(var _0x57e0d5=0x0;_0x57e0d5<_0x2d1b19[_0xdbee('0x32')][_0xdbee('0x6e')][_0xdbee('0x38')];_0x57e0d5+=0x1){socket[_0xdbee('0x6d')](_0xdbee('0x84'),{'UserId':Number(_0x2d1b19[_0xdbee('0x32')]['ids'][_0x57e0d5]),'WhatsappQueueId':Number(_0x2d1b19[_0xdbee('0x46')]['id'])});}}else{socket[_0xdbee('0x6d')](_0xdbee('0x84'),{'UserId':Number(_0x2d1b19[_0xdbee('0x32')][_0xdbee('0x6e')]),'WhatsappQueueId':Number(_0x2d1b19[_0xdbee('0x46')]['id'])});}});}})[_0xdbee('0x23')](respondWithStatusCode(_0x2d05d0,null))['catch'](handleError(_0x2d05d0,null));};exports[_0xdbee('0x8a')]=function(_0x364971,_0x26a880,_0x312755){var _0x255446={};var _0x264223={};var _0x18f63b;var _0x1d9031;return db['WhatsappQueue']['findOne']({'where':{'id':_0x364971['params']['id']}})[_0xdbee('0x23')](handleEntityNotFound(_0x26a880,null))['then'](function(_0x4f9340){if(_0x4f9340){_0x18f63b=_0x4f9340;_0x264223[_0xdbee('0x30')]=_[_0xdbee('0x33')](db['User'][_0xdbee('0x55')]);_0x264223[_0xdbee('0x32')]=_[_0xdbee('0x33')](_0x364971['query']);_0x264223[_0xdbee('0x34')]=_[_0xdbee('0x36')](_0x264223[_0xdbee('0x30')],_0x264223[_0xdbee('0x32')]);_0x255446[_0xdbee('0x35')]=_['intersection'](_0x264223[_0xdbee('0x30')],qs[_0xdbee('0x37')](_0x364971['query'][_0xdbee('0x37')]));_0x255446[_0xdbee('0x35')]=_0x255446[_0xdbee('0x35')][_0xdbee('0x38')]?_0x255446[_0xdbee('0x35')]:_0x264223[_0xdbee('0x30')];_0x255446[_0xdbee('0x57')]=qs[_0xdbee('0x3a')](_0x364971[_0xdbee('0x32')]['sort']);_0x255446[_0xdbee('0x3b')]=qs[_0xdbee('0x34')](_['pick'](_0x364971[_0xdbee('0x32')],_0x264223['filters']));if(_0x364971[_0xdbee('0x32')][_0xdbee('0x3f')]){_0x255446[_0xdbee('0x3b')]=_[_0xdbee('0x3d')](_0x255446[_0xdbee('0x3b')],{'$or':_['map'](_0x255446[_0xdbee('0x35')],function(_0xea11f5){var _0x4d8a55={};_0x4d8a55[_0xea11f5]={'$like':'%'+_0x364971[_0xdbee('0x32')][_0xdbee('0x3f')]+'%'};return _0x4d8a55;})});}_0x255446=_[_0xdbee('0x3d')]({},_0x255446,_0x364971[_0xdbee('0x40')]);return _0x18f63b[_0xdbee('0x8a')](_0x255446);}})[_0xdbee('0x23')](function(_0x3cf7ab){if(_0x3cf7ab){_0x1d9031=_0x3cf7ab[_0xdbee('0x38')];if(!_0x364971[_0xdbee('0x32')]['hasOwnProperty'](_0xdbee('0x39'))){_0x255446[_0xdbee('0x1d')]=qs[_0xdbee('0x1d')](_0x364971[_0xdbee('0x32')][_0xdbee('0x1d')]);_0x255446[_0xdbee('0x1c')]=qs['offset'](_0x364971['query'][_0xdbee('0x1c')]);}return _0x18f63b[_0xdbee('0x8a')](_0x255446);}})[_0xdbee('0x23')](function(_0x1540ec){if(_0x1540ec){return _0x1540ec?{'count':_0x1d9031,'rows':_0x1540ec}:null;}})[_0xdbee('0x23')](respondWithResult(_0x26a880,null))[_0xdbee('0x45')](handleError(_0x26a880,null));}; \ No newline at end of file +var _0xb10f=['findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','findOne','Team','getTeams','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','WhatsappQueues','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','User'];(function(_0x3991de,_0x2ffbd1){var _0x24d193=function(_0x2e8585){while(--_0x2e8585){_0x3991de['push'](_0x3991de['shift']());}};_0x24d193(++_0x2ffbd1);}(_0xb10f,0x149));var _0xfb10=function(_0x25398a,_0x31d8cf){_0x25398a=_0x25398a-0x0;var _0x459586=_0xb10f[_0x25398a];return _0x459586;};'use strict';var emlformat=require(_0xfb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb10('0x1'));var jsonpatch=require(_0xfb10('0x2'));var rp=require(_0xfb10('0x3'));var moment=require(_0xfb10('0x4'));var BPromise=require(_0xfb10('0x5'));var Mustache=require(_0xfb10('0x6'));var util=require(_0xfb10('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfb10('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfb10('0x9'));var crypto=require(_0xfb10('0xa'));var jsforce=require(_0xfb10('0xb'));var deskjs=require(_0xfb10('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfb10('0xd'));var Papa=require(_0xfb10('0xe'));var Redis=require(_0xfb10('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfb10('0x10'));var as=require(_0xfb10('0x11'));var hardwareService=require(_0xfb10('0x12'));var logger=require(_0xfb10('0x13'))(_0xfb10('0x14'));var utils=require(_0xfb10('0x15'));var config=require(_0xfb10('0x16'));var licenseUtil=require(_0xfb10('0x17'));var db=require(_0xfb10('0x18'))['db'];config[_0xfb10('0x19')]=_[_0xfb10('0x1a')](config[_0xfb10('0x19')],{'host':_0xfb10('0x1b'),'port':0x18eb});var socket=require(_0xfb10('0x1c'))(new Redis(config[_0xfb10('0x19')]));require('./whatsappQueue.socket')[_0xfb10('0x1d')](socket);function respondWithStatusCode(_0x3ecd3a,_0x17f7c9){_0x17f7c9=_0x17f7c9||0xcc;return function(_0x4b052d){if(_0x4b052d){return _0x3ecd3a[_0xfb10('0x1e')](_0x17f7c9);}return _0x3ecd3a[_0xfb10('0x1f')](_0x17f7c9)['end']();};}function respondWithResult(_0x110d59,_0x36656f){_0x36656f=_0x36656f||0xc8;return function(_0x1b14b6){if(_0x1b14b6){return _0x110d59[_0xfb10('0x1f')](_0x36656f)[_0xfb10('0x20')](_0x1b14b6);}};}function respondWithFilteredResult(_0x57a623,_0x41ba4d){return function(_0x19c166){if(_0x19c166){var _0x4f0cba=typeof _0x41ba4d['offset']===_0xfb10('0x21')&&typeof _0x41ba4d[_0xfb10('0x22')]===_0xfb10('0x21');var _0x331201=_0x19c166['count'];var _0x100517=_0x4f0cba?0x0:_0x41ba4d['offset'];var _0x5db149=_0x4f0cba?_0x19c166[_0xfb10('0x23')]:_0x41ba4d[_0xfb10('0x24')]+_0x41ba4d[_0xfb10('0x22')];var _0x5037ba;if(_0x5db149>=_0x331201){_0x5db149=_0x331201;_0x5037ba=0xc8;}else{_0x5037ba=0xce;}_0x57a623[_0xfb10('0x1f')](_0x5037ba);return _0x57a623[_0xfb10('0x25')](_0xfb10('0x26'),_0x100517+'-'+_0x5db149+'/'+_0x331201)[_0xfb10('0x20')](_0x19c166);}return null;};}function patchUpdates(_0x3b9ec8){return function(_0x558e02){try{jsonpatch['apply'](_0x558e02,_0x3b9ec8,!![]);}catch(_0x2be482){return BPromise[_0xfb10('0x27')](_0x2be482);}return _0x558e02[_0xfb10('0x28')]();};}function saveUpdates(_0x54819d,_0x5f0bfa){return function(_0x12b6ba){if(_0x12b6ba){return _0x12b6ba[_0xfb10('0x29')](_0x54819d)[_0xfb10('0x2a')](function(_0x163b7c){return _0x163b7c;});}return null;};}function removeEntity(_0x37a8ee,_0xc760d7){return function(_0x5d12ef){if(_0x5d12ef){return _0x5d12ef[_0xfb10('0x2b')]()[_0xfb10('0x2a')](function(){var _0x2b9e7e=_0x5d12ef[_0xfb10('0x2c')]({'plain':!![]});var _0x28e271=_0xfb10('0x2d');return db['UserProfileResource'][_0xfb10('0x2b')]({'where':{'type':_0x28e271,'resourceId':_0x2b9e7e['id']}})[_0xfb10('0x2a')](function(){return _0x5d12ef;});})[_0xfb10('0x2a')](function(){_0x37a8ee['status'](0xcc)[_0xfb10('0x2e')]();});}};}function handleEntityNotFound(_0x1aec82,_0x4e1366){return function(_0x132548){if(!_0x132548){_0x1aec82[_0xfb10('0x1e')](0x194);}return _0x132548;};}function handleError(_0x44d3d4,_0x58313f){_0x58313f=_0x58313f||0x1f4;return function(_0x58e0ec){logger[_0xfb10('0x2f')](_0x58e0ec[_0xfb10('0x30')]);if(_0x58e0ec[_0xfb10('0x31')]){delete _0x58e0ec[_0xfb10('0x31')];}_0x44d3d4[_0xfb10('0x1f')](_0x58313f)[_0xfb10('0x32')](_0x58e0ec);};}exports[_0xfb10('0x33')]=function(_0x148842,_0x54f3b4){var _0x4f0a51={},_0xba5bff={},_0x378526={'count':0x0,'rows':[]};var _0x450507=_[_0xfb10('0x34')](db[_0xfb10('0x35')][_0xfb10('0x36')],function(_0x4349cb){return{'name':_0x4349cb[_0xfb10('0x37')],'type':_0x4349cb['type'][_0xfb10('0x38')]};});_0xba5bff[_0xfb10('0x39')]=_[_0xfb10('0x34')](_0x450507,_0xfb10('0x31'));_0xba5bff['query']=_[_0xfb10('0x3a')](_0x148842[_0xfb10('0x3b')]);_0xba5bff[_0xfb10('0x3c')]=_[_0xfb10('0x3d')](_0xba5bff[_0xfb10('0x39')],_0xba5bff['query']);_0x4f0a51[_0xfb10('0x3e')]=_[_0xfb10('0x3d')](_0xba5bff[_0xfb10('0x39')],qs[_0xfb10('0x3f')](_0x148842[_0xfb10('0x3b')]['fields']));_0x4f0a51[_0xfb10('0x3e')]=_0x4f0a51[_0xfb10('0x3e')]['length']?_0x4f0a51['attributes']:_0xba5bff[_0xfb10('0x39')];if(!_0x148842[_0xfb10('0x3b')][_0xfb10('0x40')](_0xfb10('0x41'))){_0x4f0a51[_0xfb10('0x22')]=qs[_0xfb10('0x22')](_0x148842[_0xfb10('0x3b')][_0xfb10('0x22')]);_0x4f0a51[_0xfb10('0x24')]=qs['offset'](_0x148842[_0xfb10('0x3b')][_0xfb10('0x24')]);}_0x4f0a51[_0xfb10('0x42')]=qs[_0xfb10('0x43')](_0x148842[_0xfb10('0x3b')][_0xfb10('0x43')]);_0x4f0a51[_0xfb10('0x44')]=qs['filters'](_[_0xfb10('0x45')](_0x148842['query'],_0xba5bff[_0xfb10('0x3c')]),_0x450507);if(_0x148842[_0xfb10('0x3b')]['filter']){_0x4f0a51[_0xfb10('0x44')]=_[_0xfb10('0x46')](_0x4f0a51['where'],{'$or':_[_0xfb10('0x34')](_0x450507,function(_0x207f7c){if(_0x207f7c[_0xfb10('0x47')]!=='VIRTUAL'){var _0x586e1f={};_0x586e1f[_0x207f7c[_0xfb10('0x31')]]={'$like':'%'+_0x148842[_0xfb10('0x3b')][_0xfb10('0x48')]+'%'};return _0x586e1f;}})});}_0x4f0a51=_[_0xfb10('0x46')]({},_0x4f0a51,_0x148842[_0xfb10('0x49')]);var _0x3c8091={'where':_0x4f0a51['where']};return db[_0xfb10('0x35')][_0xfb10('0x23')](_0x3c8091)[_0xfb10('0x2a')](function(_0x10778f){_0x378526[_0xfb10('0x23')]=_0x10778f;if(_0x148842[_0xfb10('0x3b')][_0xfb10('0x4a')]){_0x4f0a51['include']=[{'all':!![]}];}return db['WhatsappQueue'][_0xfb10('0x4b')](_0x4f0a51);})[_0xfb10('0x2a')](function(_0xed5d30){_0x378526[_0xfb10('0x4c')]=_0xed5d30;return _0x378526;})[_0xfb10('0x2a')](respondWithFilteredResult(_0x54f3b4,_0x4f0a51))[_0xfb10('0x4d')](handleError(_0x54f3b4,null));};exports[_0xfb10('0x4e')]=function(_0x497017,_0x311e1a){var _0xa1582f={'raw':!![],'where':{'id':_0x497017[_0xfb10('0x4f')]['id']}},_0x2ec251={};_0x2ec251['model']=_[_0xfb10('0x3a')](db[_0xfb10('0x35')]['rawAttributes']);_0x2ec251[_0xfb10('0x3b')]=_['keys'](_0x497017[_0xfb10('0x3b')]);_0x2ec251['filters']=_['intersection'](_0x2ec251[_0xfb10('0x39')],_0x2ec251[_0xfb10('0x3b')]);_0xa1582f['attributes']=_[_0xfb10('0x3d')](_0x2ec251[_0xfb10('0x39')],qs[_0xfb10('0x3f')](_0x497017['query'][_0xfb10('0x3f')]));_0xa1582f[_0xfb10('0x3e')]=_0xa1582f['attributes'][_0xfb10('0x50')]?_0xa1582f[_0xfb10('0x3e')]:_0x2ec251['model'];if(_0x497017[_0xfb10('0x3b')][_0xfb10('0x4a')]){_0xa1582f[_0xfb10('0x51')]=[{'all':!![]}];}_0xa1582f=_['merge']({},_0xa1582f,_0x497017[_0xfb10('0x49')]);return db[_0xfb10('0x35')]['find'](_0xa1582f)[_0xfb10('0x2a')](handleEntityNotFound(_0x311e1a,null))[_0xfb10('0x2a')](respondWithResult(_0x311e1a,null))[_0xfb10('0x4d')](handleError(_0x311e1a,null));};exports[_0xfb10('0x52')]=function(_0x32bf7c,_0x3582a7){return db[_0xfb10('0x35')]['create'](_0x32bf7c[_0xfb10('0x53')],{})['then'](function(_0x3e2ada){var _0x11ac66=_0x32bf7c[_0xfb10('0x54')][_0xfb10('0x2c')]({'plain':!![]});if(!_0x11ac66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11ac66['role']===_0xfb10('0x54')){var _0x4d9993=_0x3e2ada['get']({'plain':!![]});var _0xf54e8a=_0xfb10('0x2d');return db['UserProfileSection'][_0xfb10('0x55')]({'where':{'name':_0xf54e8a,'userProfileId':_0x11ac66[_0xfb10('0x56')]},'raw':!![]})['then'](function(_0x187928){if(_0x187928&&_0x187928[_0xfb10('0x57')]===0x0){return db[_0xfb10('0x58')][_0xfb10('0x52')]({'name':_0x4d9993[_0xfb10('0x31')],'resourceId':_0x4d9993['id'],'type':_0x187928[_0xfb10('0x31')],'sectionId':_0x187928['id']},{})[_0xfb10('0x2a')](function(){return _0x3e2ada;});}else{return _0x3e2ada;}})[_0xfb10('0x4d')](function(_0x5745ea){logger[_0xfb10('0x2f')](_0xfb10('0x59'),_0x5745ea);throw _0x5745ea;});}return _0x3e2ada;})[_0xfb10('0x2a')](respondWithResult(_0x3582a7,0xc9))[_0xfb10('0x4d')](handleError(_0x3582a7,null));};exports[_0xfb10('0x29')]=function(_0x51a68b,_0x503efe){if(_0x51a68b[_0xfb10('0x53')]['id']){delete _0x51a68b[_0xfb10('0x53')]['id'];}return db[_0xfb10('0x35')]['find']({'where':{'id':_0x51a68b[_0xfb10('0x4f')]['id']}})['then'](handleEntityNotFound(_0x503efe,null))[_0xfb10('0x2a')](saveUpdates(_0x51a68b[_0xfb10('0x53')],null))[_0xfb10('0x2a')](respondWithResult(_0x503efe,null))[_0xfb10('0x4d')](handleError(_0x503efe,null));};exports['destroy']=function(_0x4dc1f6,_0x3918d9){return db[_0xfb10('0x35')]['find']({'where':{'id':_0x4dc1f6[_0xfb10('0x4f')]['id']}})[_0xfb10('0x2a')](handleEntityNotFound(_0x3918d9,null))[_0xfb10('0x2a')](removeEntity(_0x3918d9,null))[_0xfb10('0x4d')](handleError(_0x3918d9,null));};exports[_0xfb10('0x5a')]=function(_0x18e7fc,_0x2f5c42){return db[_0xfb10('0x35')][_0xfb10('0x5a')]()[_0xfb10('0x2a')](respondWithResult(_0x2f5c42,null))['catch'](handleError(_0x2f5c42,null));};exports[_0xfb10('0x5b')]=function(_0x24640d,_0x357235,_0x2d6c75){var _0x1a8835={'raw':!![],'where':{}},_0x7a7686={},_0xa7841d;return db[_0xfb10('0x35')]['findOne']({'where':{'id':_0x24640d['params']['id']}})[_0xfb10('0x2a')](handleEntityNotFound(_0x357235,null))[_0xfb10('0x2a')](function(_0x4f787e){if(_0x4f787e){_0xa7841d=_0x4f787e[_0xfb10('0x2c')]({'plain':!![]});_0x7a7686['model']=_[_0xfb10('0x3a')](db[_0xfb10('0x5c')][_0xfb10('0x36')]);_0x7a7686[_0xfb10('0x3b')]=_[_0xfb10('0x3a')](_0x24640d[_0xfb10('0x3b')]);_0x7a7686[_0xfb10('0x3c')]=_[_0xfb10('0x3d')](_0x7a7686[_0xfb10('0x39')],_0x7a7686['query']);_0x1a8835[_0xfb10('0x3e')]=_[_0xfb10('0x3d')](_0x7a7686['model'],qs[_0xfb10('0x3f')](_0x24640d[_0xfb10('0x3b')][_0xfb10('0x3f')]));_0x1a8835[_0xfb10('0x3e')]=_0x1a8835['attributes'][_0xfb10('0x50')]?_0x1a8835[_0xfb10('0x3e')]:_0x7a7686['model'];if(!_0x24640d[_0xfb10('0x3b')][_0xfb10('0x40')](_0xfb10('0x41'))){_0x1a8835[_0xfb10('0x22')]=qs[_0xfb10('0x22')](_0x24640d[_0xfb10('0x3b')][_0xfb10('0x22')]);_0x1a8835[_0xfb10('0x24')]=qs[_0xfb10('0x24')](_0x24640d['query'][_0xfb10('0x24')]);}_0x1a8835[_0xfb10('0x42')]=qs[_0xfb10('0x43')](_0x24640d[_0xfb10('0x3b')][_0xfb10('0x43')]);_0x1a8835['where']=qs[_0xfb10('0x3c')](_[_0xfb10('0x45')](_0x24640d['query'],_0x7a7686[_0xfb10('0x3c')]));_0x1a8835[_0xfb10('0x44')]['WhatsappQueueId']=_0x4f787e['id'];if(_0x24640d['query'][_0xfb10('0x48')]){_0x1a8835[_0xfb10('0x44')]=_['merge'](_0x1a8835[_0xfb10('0x44')],{'$or':_['map'](_0x1a8835['attributes'],function(_0x3f3e8b){var _0x1a77b6={};_0x1a77b6[_0x3f3e8b]={'$like':'%'+_0x24640d[_0xfb10('0x3b')][_0xfb10('0x48')]+'%'};return _0x1a77b6;})});}_0x1a8835=_[_0xfb10('0x46')]({},_0x1a8835,_0x24640d[_0xfb10('0x49')]);return db[_0xfb10('0x5c')][_0xfb10('0x4b')](_0x1a8835);}})[_0xfb10('0x2a')](function(_0x2ce8c1){if(_0x2ce8c1){return db[_0xfb10('0x5d')][_0xfb10('0x5e')]({'where':{'id':_[_0xfb10('0x34')](_0x2ce8c1,'UserId'),'role':_0xfb10('0x5f')},'attributes':['id',_0xfb10('0x31'),_0xfb10('0x60'),_0xfb10('0x61'),_0xfb10('0x62')]});}})[_0xfb10('0x2a')](function(_0x40ab53){if(_0x40ab53){return{'count':_0x40ab53[_0xfb10('0x23')],'rows':_[_0xfb10('0x34')](_0x40ab53[_0xfb10('0x4c')],function(_0xf292b2){return{'membername':_0xf292b2[_0xfb10('0x31')],'UserId':_0xf292b2['id'],'queue_name':_0xa7841d[_0xfb10('0x31')],'WhatsappQueueId':_0xa7841d['id'],'interface':util[_0xfb10('0x63')](_0xfb10('0x64'),'SIP',_0xf292b2['name']),'penalty':0x0,'paused':_0xf292b2['whatsappPause'],'createdAt':_0xf292b2[_0xfb10('0x62')],'updatedAt':_0xf292b2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x357235,_0x1a8835))[_0xfb10('0x4d')](handleError(_0x357235,null));};exports['getTeams']=function(_0x4fa8ff,_0x363ef3,_0x59e275){var _0x4e896b={};var _0x4251cd={};var _0x2dc794;var _0x4bc774;return db[_0xfb10('0x35')][_0xfb10('0x65')]({'where':{'id':_0x4fa8ff[_0xfb10('0x4f')]['id']}})[_0xfb10('0x2a')](handleEntityNotFound(_0x363ef3,null))[_0xfb10('0x2a')](function(_0x7829c1){if(_0x7829c1){_0x2dc794=_0x7829c1;_0x4251cd[_0xfb10('0x39')]=_['keys'](db[_0xfb10('0x66')][_0xfb10('0x36')]);_0x4251cd[_0xfb10('0x3b')]=_[_0xfb10('0x3a')](_0x4fa8ff[_0xfb10('0x3b')]);_0x4251cd['filters']=_[_0xfb10('0x3d')](_0x4251cd[_0xfb10('0x39')],_0x4251cd['query']);_0x4e896b[_0xfb10('0x3e')]=_[_0xfb10('0x3d')](_0x4251cd[_0xfb10('0x39')],qs[_0xfb10('0x3f')](_0x4fa8ff[_0xfb10('0x3b')]['fields']));_0x4e896b['attributes']=_0x4e896b[_0xfb10('0x3e')]['length']?_0x4e896b['attributes']:_0x4251cd[_0xfb10('0x39')];_0x4e896b[_0xfb10('0x42')]=qs[_0xfb10('0x43')](_0x4fa8ff[_0xfb10('0x3b')]['sort']);_0x4e896b['where']=qs[_0xfb10('0x3c')](_[_0xfb10('0x45')](_0x4fa8ff[_0xfb10('0x3b')],_0x4251cd[_0xfb10('0x3c')]));if(_0x4fa8ff[_0xfb10('0x3b')]['filter']){_0x4e896b[_0xfb10('0x44')]=_['merge'](_0x4e896b[_0xfb10('0x44')],{'$or':_['map'](_0x4e896b[_0xfb10('0x3e')],function(_0x4e6d43){var _0x4e3117={};_0x4e3117[_0x4e6d43]={'$like':'%'+_0x4fa8ff['query'][_0xfb10('0x48')]+'%'};return _0x4e3117;})});}_0x4e896b=_[_0xfb10('0x46')]({},_0x4e896b,_0x4fa8ff['options']);return _0x2dc794[_0xfb10('0x67')](_0x4e896b);}})['then'](function(_0x4c0420){if(_0x4c0420){_0x4bc774=_0x4c0420[_0xfb10('0x50')];if(!_0x4fa8ff[_0xfb10('0x3b')][_0xfb10('0x40')]('nolimit')){_0x4e896b[_0xfb10('0x22')]=qs[_0xfb10('0x22')](_0x4fa8ff[_0xfb10('0x3b')][_0xfb10('0x22')]);_0x4e896b[_0xfb10('0x24')]=qs['offset'](_0x4fa8ff[_0xfb10('0x3b')][_0xfb10('0x24')]);}return _0x2dc794[_0xfb10('0x67')](_0x4e896b);}})['then'](function(_0x2f8059){if(_0x2f8059){return _0x2f8059?{'count':_0x4bc774,'rows':_0x2f8059}:null;}})[_0xfb10('0x2a')](respondWithResult(_0x363ef3,null))[_0xfb10('0x4d')](handleError(_0x363ef3,null));};exports[_0xfb10('0x68')]=function(_0x2f933a,_0x41955e,_0x13038c){var _0x318c20=_0x2f933a[_0xfb10('0x53')]['ids'];return db[_0xfb10('0x66')][_0xfb10('0x4b')]({'where':{'id':_0x318c20},'attributes':['id'],'include':[{'model':db[_0xfb10('0x5d')],'as':_0xfb10('0x69'),'attributes':['id','name',_0xfb10('0x6a'),'voicePause',_0xfb10('0x6b')],'raw':!![]}]})['then'](function(_0xed2b7f){if(_0xed2b7f){var _0x42e315=_[_0xfb10('0x6c')](_0xed2b7f,function(_0x5a5ae3){var _0x52822a=_0x5a5ae3[_0xfb10('0x2c')]({'plain':!![]});return _0x52822a[_0xfb10('0x69')];});return db[_0xfb10('0x35')]['find']({'where':{'id':_0x2f933a['params']['id']}})[_0xfb10('0x2a')](function(_0x5738c2){return db[_0xfb10('0x6d')][_0xfb10('0x6e')](function(_0x16fd88){return _0x5738c2[_0xfb10('0x68')](_0x318c20,{'transaction':_0x16fd88})[_0xfb10('0x2a')](function(){return BPromise[_0xfb10('0x6f')](_0x42e315,function(_0x279854){return db[_0xfb10('0x5c')]['findOrCreate']({'where':{'UserId':_0x279854['id'],'WhatsappQueueId':_0x2f933a[_0xfb10('0x4f')]['id']},'transaction':_0x16fd88});});})['then'](function(){_0x42e315[_0xfb10('0x70')](function(_0x55fd1b){socket[_0xfb10('0x71')](_0xfb10('0x72'),{'UserId':_0x55fd1b['id'],'WhatsappQueueId':_0x5738c2['id']});});});});});}})['then'](respondWithStatusCode(_0x41955e,null))[_0xfb10('0x4d')](handleError(_0x41955e,null));};exports[_0xfb10('0x73')]=function(_0x531e11,_0x1bf8ce,_0x320c82){return db[_0xfb10('0x66')]['findAll']({'where':{'id':_0x531e11[_0xfb10('0x3b')][_0xfb10('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfb10('0x2a')](handleEntityNotFound(_0x1bf8ce,null))['then'](function(_0x57eeba){var _0x52af15=_[_0xfb10('0x34')](_0x57eeba,'id');var _0xe71d38=[];var _0x16faf8=[];var _0x536831=squel[_0xfb10('0x75')]();_0x536831[_0xfb10('0x76')](_0xfb10('0x77'))['from'](_0xfb10('0x78'),'tq')[_0xfb10('0x79')](_0xfb10('0x7a'),'ut',_0xfb10('0x7b'))[_0xfb10('0x44')](_0xfb10('0x7c'),_0x531e11[_0xfb10('0x4f')]['id']);for(var _0x56766c=0x0;_0x56766c<_0x57eeba['length'];_0x56766c+=0x1){let _0x22754a=_0x57eeba[_0x56766c];for(var _0x1a3fe0=0x0;_0x1a3fe0<_0x22754a[_0xfb10('0x69')][_0xfb10('0x50')];_0x1a3fe0+=0x1){let _0x1f87ee=_0x22754a[_0xfb10('0x69')][_0x1a3fe0];var _0x257793=_0x536831[_0xfb10('0x7d')]();_0x257793[_0xfb10('0x44')](_0xfb10('0x7e'),_0x1f87ee['id']);_0x16faf8[_0xfb10('0x7f')](db['sequelize'][_0xfb10('0x3b')](_0x257793[_0xfb10('0x80')](),{'type':db[_0xfb10('0x6d')][_0xfb10('0x81')][_0xfb10('0x82')]})['then'](function(_0x2fd750){if(_0x2fd750['length']===0x1){return _0x1f87ee['id'];}else{var _0x63cc3=_['every'](_['map'](_0x2fd750,'TeamId'),function(_0x3c5ad8){return _[_0xfb10('0x83')](_0x52af15,_0x3c5ad8);});if(_0x63cc3){return _0x1f87ee['id'];}}}));}}return BPromise[_0xfb10('0x84')](_0x16faf8)[_0xfb10('0x2a')](function(_0x495504){_0xe71d38=_(_0xe71d38)['union'](_0x495504)[_0xfb10('0x85')]()['value']();return db[_0xfb10('0x35')][_0xfb10('0x55')]({'where':{'id':_0x531e11[_0xfb10('0x4f')]['id']}})[_0xfb10('0x2a')](function(_0x4d33d8){return db[_0xfb10('0x6d')]['transaction'](function(_0x55e78a){return _0x4d33d8[_0xfb10('0x73')](_0x531e11[_0xfb10('0x3b')][_0xfb10('0x74')],{'transaction':_0x55e78a})[_0xfb10('0x2a')](function(){if(!_[_0xfb10('0x86')](_0xe71d38)){return _0x4d33d8[_0xfb10('0x87')](_0xe71d38,{'transaction':_0x55e78a});}})[_0xfb10('0x2a')](function(){_0xe71d38[_0xfb10('0x70')](function(_0xe07d97){socket[_0xfb10('0x71')](_0xfb10('0x88'),{'UserId':_0xe07d97,'WhatsappQueueId':_0x4d33d8['id']});});});});});});})[_0xfb10('0x2a')](respondWithStatusCode(_0x1bf8ce,null))[_0xfb10('0x4d')](handleError(_0x1bf8ce,null));};exports[_0xfb10('0x89')]=function(_0x3df03e,_0x16d2d4,_0x2b7607){return db['WhatsappQueue'][_0xfb10('0x55')]({'where':{'id':_0x3df03e[_0xfb10('0x4f')]['id']}})[_0xfb10('0x2a')](handleEntityNotFound(_0x16d2d4,null))[_0xfb10('0x2a')](function(_0x406266){if(_0x406266){return _0x406266[_0xfb10('0x89')](_0x3df03e[_0xfb10('0x53')][_0xfb10('0x74')],_['omit'](_0x3df03e[_0xfb10('0x53')],[_0xfb10('0x74'),'id'])||{})[_0xfb10('0x8a')](function(_0x115c5d){for(var _0x3d2319=0x0;_0x3d2319<_0x3df03e[_0xfb10('0x53')][_0xfb10('0x74')][_0xfb10('0x50')];_0x3d2319+=0x1){socket[_0xfb10('0x71')](_0xfb10('0x72'),{'UserId':Number(_0x3df03e['body'][_0xfb10('0x74')][_0x3d2319]),'WhatsappQueueId':Number(_0x3df03e[_0xfb10('0x4f')]['id'])});}return _0x115c5d;});}})[_0xfb10('0x2a')](respondWithResult(_0x16d2d4,null))[_0xfb10('0x4d')](handleError(_0x16d2d4,null));};exports[_0xfb10('0x87')]=function(_0x293b44,_0x57bb46,_0x4b90a9){return db[_0xfb10('0x35')][_0xfb10('0x55')]({'where':{'id':_0x293b44[_0xfb10('0x4f')]['id']}})['then'](handleEntityNotFound(_0x57bb46,null))['then'](function(_0x8b9c34){if(_0x8b9c34){return _0x8b9c34[_0xfb10('0x87')](_0x293b44[_0xfb10('0x3b')][_0xfb10('0x74')])['then'](function(){if(_[_0xfb10('0x8b')](_0x293b44[_0xfb10('0x3b')][_0xfb10('0x74')])){for(var _0x3ab1c0=0x0;_0x3ab1c0<_0x293b44['query'][_0xfb10('0x74')][_0xfb10('0x50')];_0x3ab1c0+=0x1){socket[_0xfb10('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x293b44[_0xfb10('0x3b')][_0xfb10('0x74')][_0x3ab1c0]),'WhatsappQueueId':Number(_0x293b44['params']['id'])});}}else{socket['emit'](_0xfb10('0x88'),{'UserId':Number(_0x293b44[_0xfb10('0x3b')][_0xfb10('0x74')]),'WhatsappQueueId':Number(_0x293b44[_0xfb10('0x4f')]['id'])});}});}})[_0xfb10('0x2a')](respondWithStatusCode(_0x57bb46,null))['catch'](handleError(_0x57bb46,null));};exports[_0xfb10('0x8c')]=function(_0x58919f,_0x35a8de,_0x3a27e1){var _0x2d5ee1={};var _0x1cddce={};var _0x4182be;var _0x35e404;return db[_0xfb10('0x35')]['findOne']({'where':{'id':_0x58919f[_0xfb10('0x4f')]['id']}})[_0xfb10('0x2a')](handleEntityNotFound(_0x35a8de,null))[_0xfb10('0x2a')](function(_0xd07f8f){if(_0xd07f8f){_0x4182be=_0xd07f8f;_0x1cddce[_0xfb10('0x39')]=_[_0xfb10('0x3a')](db['User']['rawAttributes']);_0x1cddce[_0xfb10('0x3b')]=_['keys'](_0x58919f['query']);_0x1cddce[_0xfb10('0x3c')]=_[_0xfb10('0x3d')](_0x1cddce[_0xfb10('0x39')],_0x1cddce[_0xfb10('0x3b')]);_0x2d5ee1[_0xfb10('0x3e')]=_[_0xfb10('0x3d')](_0x1cddce['model'],qs[_0xfb10('0x3f')](_0x58919f[_0xfb10('0x3b')][_0xfb10('0x3f')]));_0x2d5ee1[_0xfb10('0x3e')]=_0x2d5ee1['attributes'][_0xfb10('0x50')]?_0x2d5ee1[_0xfb10('0x3e')]:_0x1cddce[_0xfb10('0x39')];_0x2d5ee1[_0xfb10('0x42')]=qs[_0xfb10('0x43')](_0x58919f[_0xfb10('0x3b')][_0xfb10('0x43')]);_0x2d5ee1[_0xfb10('0x44')]=qs['filters'](_[_0xfb10('0x45')](_0x58919f[_0xfb10('0x3b')],_0x1cddce['filters']));if(_0x58919f['query']['filter']){_0x2d5ee1[_0xfb10('0x44')]=_['merge'](_0x2d5ee1[_0xfb10('0x44')],{'$or':_['map'](_0x2d5ee1[_0xfb10('0x3e')],function(_0x201b2d){var _0x1b88da={};_0x1b88da[_0x201b2d]={'$like':'%'+_0x58919f['query']['filter']+'%'};return _0x1b88da;})});}_0x2d5ee1=_[_0xfb10('0x46')]({},_0x2d5ee1,_0x58919f[_0xfb10('0x49')]);return _0x4182be[_0xfb10('0x8c')](_0x2d5ee1);}})[_0xfb10('0x2a')](function(_0x1a2721){if(_0x1a2721){_0x35e404=_0x1a2721[_0xfb10('0x50')];if(!_0x58919f[_0xfb10('0x3b')][_0xfb10('0x40')](_0xfb10('0x41'))){_0x2d5ee1['limit']=qs[_0xfb10('0x22')](_0x58919f['query'][_0xfb10('0x22')]);_0x2d5ee1[_0xfb10('0x24')]=qs[_0xfb10('0x24')](_0x58919f[_0xfb10('0x3b')][_0xfb10('0x24')]);}return _0x4182be[_0xfb10('0x8c')](_0x2d5ee1);}})['then'](function(_0x48ec68){if(_0x48ec68){return _0x48ec68?{'count':_0x35e404,'rows':_0x48ec68}:null;}})[_0xfb10('0x2a')](respondWithResult(_0x35a8de,null))[_0xfb10('0x4d')](handleError(_0x35a8de,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ae8a008..7b60eac 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 _0x83fd=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x1d800f,_0x31c32d){var _0x226ab9=function(_0x3f57d0){while(--_0x3f57d0){_0x1d800f['push'](_0x1d800f['shift']());}};_0x226ab9(++_0x31c32d);}(_0x83fd,0xdf));var _0xd83f=function(_0x261031,_0x330c1b){_0x261031=_0x261031-0x0;var _0x43c143=_0x83fd[_0x261031];return _0x43c143;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xd83f('0x0'))['db'][_0xd83f('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd83f('0x2')](0x0);var events={'afterCreate':_0xd83f('0x3'),'afterUpdate':_0xd83f('0x4'),'afterDestroy':_0xd83f('0x5')};function emitEvent(_0x19022d){return function(_0x253828,_0x5b7176,_0x4bd138){WhatsappQueueEvents[_0xd83f('0x6')](_0x19022d+':'+_0x253828['id'],_0x253828);WhatsappQueueEvents[_0xd83f('0x6')](_0x19022d,_0x253828);_0x4bd138(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd83f('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x10ba=['remove','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x15c91d,_0xa83a7f){var _0xcb9d40=function(_0x2ac0c0){while(--_0x2ac0c0){_0x15c91d['push'](_0x15c91d['shift']());}};_0xcb9d40(++_0xa83a7f);}(_0x10ba,0x17d));var _0xa10b=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x10ba[_0x5f1cf8];return _0x27d0fa;};'use strict';var EventEmitter=require(_0xa10b('0x0'));var WhatsappQueue=require(_0xa10b('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa10b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa10b('0x3'),'afterDestroy':_0xa10b('0x4')};function emitEvent(_0x2e39d3){return function(_0x821f92,_0x5c7692,_0x1039d9){WhatsappQueueEvents['emit'](_0x2e39d3+':'+_0x821f92['id'],_0x821f92);WhatsappQueueEvents['emit'](_0x2e39d3,_0x821f92);_0x1039d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xa10b('0x5')](e,emitEvent(event));}}module[_0xa10b('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 94250dd..5bedfbb 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 _0x6710=['rimraf','../../config/environment','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2b806c,_0x588c52){var _0x1eff27=function(_0x7ac630){while(--_0x7ac630){_0x2b806c['push'](_0x2b806c['shift']());}};_0x1eff27(++_0x588c52);}(_0x6710,0x130));var _0x0671=function(_0x3c837c,_0x439e47){_0x3c837c=_0x3c837c-0x0;var _0x59cc23=_0x6710[_0x3c837c];return _0x59cc23;};'use strict';var _=require(_0x0671('0x0'));var util=require(_0x0671('0x1'));var logger=require(_0x0671('0x2'))(_0x0671('0x3'));var moment=require(_0x0671('0x4'));var BPromise=require(_0x0671('0x5'));var rp=require(_0x0671('0x6'));var fs=require('fs');var path=require(_0x0671('0x7'));var rimraf=require(_0x0671('0x8'));var config=require(_0x0671('0x9'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x5bd45f,_0x2eac5f){return _0x5bd45f[_0x0671('0xa')](_0x0671('0xb'),attributes,{'tableName':_0x0671('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8be3=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8be3,0xc9));var _0x38be=function(_0x3e40d6,_0x26a601){_0x3e40d6=_0x3e40d6-0x0;var _0x5ca19b=_0x8be3[_0x3e40d6];return _0x5ca19b;};'use strict';var _=require('lodash');var util=require(_0x38be('0x0'));var logger=require(_0x38be('0x1'))(_0x38be('0x2'));var moment=require(_0x38be('0x3'));var BPromise=require(_0x38be('0x4'));var rp=require(_0x38be('0x5'));var fs=require('fs');var path=require(_0x38be('0x6'));var rimraf=require(_0x38be('0x7'));var config=require(_0x38be('0x8'));var attributes=require(_0x38be('0x9'));module[_0x38be('0xa')]=function(_0x5b6e55,_0x460e01){return _0x5b6e55[_0x38be('0xb')](_0x38be('0xc'),attributes,{'tableName':'whatsapp_queues','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 3d6f2e6..df8f475 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 _0x61a6=['redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4a2eb8,_0x3fa441){var _0x10cba4=function(_0x40bd7a){while(--_0x40bd7a){_0x4a2eb8['push'](_0x4a2eb8['shift']());}};_0x10cba4(++_0x3fa441);}(_0x61a6,0x127));var _0x661a=function(_0x3391fe,_0x5c24d9){_0x3391fe=_0x3391fe-0x0;var _0x1ae383=_0x61a6[_0x3391fe];return _0x1ae383;};'use strict';var _=require(_0x661a('0x0'));var util=require(_0x661a('0x1'));var moment=require(_0x661a('0x2'));var BPromise=require(_0x661a('0x3'));var rs=require(_0x661a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x661a('0x5'))['db'];var utils=require(_0x661a('0x6'));var logger=require(_0x661a('0x7'))(_0x661a('0x8'));var config=require(_0x661a('0x9'));var jayson=require(_0x661a('0xa'));var client=jayson[_0x661a('0xb')][_0x661a('0xc')]({'port':0x232a});config[_0x661a('0xd')]=_[_0x661a('0xe')](config[_0x661a('0xd')],{'host':_0x661a('0xf'),'port':0x18eb});var socket=require(_0x661a('0x10'))(new Redis(config['redis']));require(_0x661a('0x11'))[_0x661a('0x12')](socket);function respondWithRpcPromise(_0x2e8ac7,_0x376361,_0x57e003){return new BPromise(function(_0x36d1a9,_0x42cfa8){return client[_0x661a('0x13')](_0x2e8ac7,_0x57e003)[_0x661a('0x14')](function(_0x27ec3f){logger[_0x661a('0x15')](_0x661a('0x16'),_0x376361,_0x661a('0x17'));logger[_0x661a('0x18')](_0x661a('0x19'),_0x376361,_0x661a('0x17'),JSON[_0x661a('0x1a')](_0x27ec3f));if(_0x27ec3f[_0x661a('0x1b')]){if(_0x27ec3f[_0x661a('0x1b')][_0x661a('0x1c')]===0x1f4){logger[_0x661a('0x1b')](_0x661a('0x16'),_0x376361,_0x27ec3f[_0x661a('0x1b')][_0x661a('0x1d')]);return _0x42cfa8(_0x27ec3f[_0x661a('0x1b')]['message']);}logger[_0x661a('0x1b')](_0x661a('0x16'),_0x376361,_0x27ec3f[_0x661a('0x1b')][_0x661a('0x1d')]);return _0x36d1a9(_0x27ec3f['error']['message']);}else{logger[_0x661a('0x15')](_0x661a('0x16'),_0x376361,_0x661a('0x17'));_0x36d1a9(_0x27ec3f['result'][_0x661a('0x1d')]);}})[_0x661a('0x1e')](function(_0x2e68ea){logger[_0x661a('0x1b')]('WhatsappQueue,\x20%s,\x20%s',_0x376361,_0x2e68ea);_0x42cfa8(_0x2e68ea);});});}exports['GetWhatsappQueue']=function(_0xb48d21){var _0x3f41e1=this;return new Promise(function(_0x33e1cd,_0x510636){return db[_0x661a('0x1f')][_0x661a('0x20')]({'raw':_0xb48d21[_0x661a('0x21')]?_0xb48d21[_0x661a('0x21')][_0x661a('0x22')]===undefined?!![]:![]:!![],'where':_0xb48d21[_0x661a('0x21')]?_0xb48d21[_0x661a('0x21')][_0x661a('0x23')]||null:null,'attributes':_0xb48d21['options']?_0xb48d21[_0x661a('0x21')][_0x661a('0x24')]||null:null,'limit':_0xb48d21[_0x661a('0x21')]?_0xb48d21['options'][_0x661a('0x25')]||null:null,'include':_0xb48d21[_0x661a('0x21')]?_0xb48d21[_0x661a('0x21')][_0x661a('0x26')]?_['map'](_0xb48d21[_0x661a('0x21')]['include'],function(_0x4b27cd){return{'model':db[_0x4b27cd[_0x661a('0x27')]],'as':_0x4b27cd['as'],'attributes':_0x4b27cd['attributes'],'include':_0x4b27cd['include']?_[_0x661a('0x28')](_0x4b27cd['include'],function(_0x9b9793){return{'model':db[_0x9b9793[_0x661a('0x27')]],'as':_0x9b9793['as'],'attributes':_0x9b9793[_0x661a('0x24')],'include':_0x9b9793[_0x661a('0x26')]?_[_0x661a('0x28')](_0x9b9793[_0x661a('0x26')],function(_0x8629e8){return{'model':db[_0x8629e8['model']],'as':_0x8629e8['as'],'attributes':_0x8629e8['attributes']};}):[]};}):[]};}):[]:[]})[_0x661a('0x14')](function(_0x8415a3){logger[_0x661a('0x15')](_0x661a('0x29'),_0xb48d21);logger[_0x661a('0x18')]('GetWhatsappQueue',_0xb48d21,JSON[_0x661a('0x1a')](_0x8415a3));_0x33e1cd(_0x8415a3);})[_0x661a('0x1e')](function(_0x5d253c){logger[_0x661a('0x1b')](_0x661a('0x29'),_0x5d253c[_0x661a('0x1d')],_0xb48d21);_0x510636(_0x3f41e1['error'](0x1f4,_0x5d253c[_0x661a('0x1d')]));});});};exports[_0x661a('0x2a')]=function(_0x254546){var _0x343baf=this;return new Promise(function(_0x4b99f6,_0x3f2546){return db['WhatsappQueue'][_0x661a('0x2b')]({'raw':_0x254546[_0x661a('0x21')]?_0x254546['options'][_0x661a('0x22')]===undefined?!![]:![]:!![],'where':_0x254546['options']?_0x254546[_0x661a('0x21')]['where']||null:null,'attributes':_0x254546[_0x661a('0x21')]?_0x254546[_0x661a('0x21')][_0x661a('0x24')]||null:null,'include':_0x254546[_0x661a('0x21')]?_0x254546['options'][_0x661a('0x26')]?_[_0x661a('0x28')](_0x254546['options'][_0x661a('0x26')],function(_0x4cd5e6){return{'model':db[_0x4cd5e6['model']],'as':_0x4cd5e6['as'],'attributes':_0x4cd5e6[_0x661a('0x24')],'include':_0x4cd5e6[_0x661a('0x26')]?_[_0x661a('0x28')](_0x4cd5e6['include'],function(_0x22e2b9){return{'model':db[_0x22e2b9[_0x661a('0x27')]],'as':_0x22e2b9['as'],'attributes':_0x22e2b9[_0x661a('0x24')],'include':_0x22e2b9[_0x661a('0x26')]?_[_0x661a('0x28')](_0x22e2b9[_0x661a('0x26')],function(_0x2ee117){return{'model':db[_0x2ee117[_0x661a('0x27')]],'as':_0x2ee117['as'],'attributes':_0x2ee117[_0x661a('0x24')]};}):[]};}):[]};}):[]:[]})[_0x661a('0x14')](function(_0x227ffa){logger[_0x661a('0x15')](_0x661a('0x2a'),_0x254546);logger[_0x661a('0x18')]('ShowWhatsappQueue',_0x254546,JSON['stringify'](_0x227ffa));_0x4b99f6(_0x227ffa);})['catch'](function(_0x189a07){logger['error'](_0x661a('0x2a'),_0x189a07['message'],_0x254546);_0x3f2546(_0x343baf[_0x661a('0x1b')](0x1f4,_0x189a07[_0x661a('0x1d')]));});});}; \ No newline at end of file +var _0x3ddf=['stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','raw','options','where','attributes','limit','map','model','include','debug','ShowWhatsappQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x211bda,_0x394065){var _0x1005c8=function(_0x65f7de){while(--_0x65f7de){_0x211bda['push'](_0x211bda['shift']());}};_0x1005c8(++_0x394065);}(_0x3ddf,0xd6));var _0xf3dd=function(_0x4150d6,_0x50be85){_0x4150d6=_0x4150d6-0x0;var _0x2f73e8=_0x3ddf[_0x4150d6];return _0x2f73e8;};'use strict';var _=require(_0xf3dd('0x0'));var util=require(_0xf3dd('0x1'));var moment=require(_0xf3dd('0x2'));var BPromise=require(_0xf3dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3dd('0x5'));var logger=require('../../config/logger')(_0xf3dd('0x6'));var config=require(_0xf3dd('0x7'));var jayson=require(_0xf3dd('0x8'));var client=jayson['client'][_0xf3dd('0x9')]({'port':0x232a});config['redis']=_[_0xf3dd('0xa')](config[_0xf3dd('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf3dd('0xc'))(new Redis(config[_0xf3dd('0xb')]));require('./whatsappQueue.socket')[_0xf3dd('0xd')](socket);function respondWithRpcPromise(_0x7ec7c7,_0x51a214,_0x4dd7d6){return new BPromise(function(_0x493417,_0x1c25db){return client[_0xf3dd('0xe')](_0x7ec7c7,_0x4dd7d6)[_0xf3dd('0xf')](function(_0x160cc9){logger[_0xf3dd('0x10')](_0xf3dd('0x11'),_0x51a214,_0xf3dd('0x12'));logger['debug'](_0xf3dd('0x13'),_0x51a214,_0xf3dd('0x12'),JSON[_0xf3dd('0x14')](_0x160cc9));if(_0x160cc9[_0xf3dd('0x15')]){if(_0x160cc9[_0xf3dd('0x15')][_0xf3dd('0x16')]===0x1f4){logger[_0xf3dd('0x15')](_0xf3dd('0x11'),_0x51a214,_0x160cc9[_0xf3dd('0x15')][_0xf3dd('0x17')]);return _0x1c25db(_0x160cc9['error'][_0xf3dd('0x17')]);}logger[_0xf3dd('0x15')](_0xf3dd('0x11'),_0x51a214,_0x160cc9[_0xf3dd('0x15')][_0xf3dd('0x17')]);return _0x493417(_0x160cc9[_0xf3dd('0x15')][_0xf3dd('0x17')]);}else{logger[_0xf3dd('0x10')](_0xf3dd('0x11'),_0x51a214,_0xf3dd('0x12'));_0x493417(_0x160cc9['result']['message']);}})[_0xf3dd('0x18')](function(_0x56c6a7){logger[_0xf3dd('0x15')](_0xf3dd('0x11'),_0x51a214,_0x56c6a7);_0x1c25db(_0x56c6a7);});});}exports[_0xf3dd('0x19')]=function(_0x21eb3b){var _0x5dd2b2=this;return new Promise(function(_0x2f45f1,_0x429f3d){return db[_0xf3dd('0x1a')][_0xf3dd('0x1b')]({'raw':_0x21eb3b['options']?_0x21eb3b['options'][_0xf3dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x21eb3b[_0xf3dd('0x1d')]?_0x21eb3b[_0xf3dd('0x1d')][_0xf3dd('0x1e')]||null:null,'attributes':_0x21eb3b[_0xf3dd('0x1d')]?_0x21eb3b[_0xf3dd('0x1d')][_0xf3dd('0x1f')]||null:null,'limit':_0x21eb3b[_0xf3dd('0x1d')]?_0x21eb3b[_0xf3dd('0x1d')][_0xf3dd('0x20')]||null:null,'include':_0x21eb3b[_0xf3dd('0x1d')]?_0x21eb3b[_0xf3dd('0x1d')]['include']?_[_0xf3dd('0x21')](_0x21eb3b[_0xf3dd('0x1d')]['include'],function(_0x310533){return{'model':db[_0x310533[_0xf3dd('0x22')]],'as':_0x310533['as'],'attributes':_0x310533['attributes'],'include':_0x310533[_0xf3dd('0x23')]?_[_0xf3dd('0x21')](_0x310533[_0xf3dd('0x23')],function(_0x97bec3){return{'model':db[_0x97bec3[_0xf3dd('0x22')]],'as':_0x97bec3['as'],'attributes':_0x97bec3[_0xf3dd('0x1f')],'include':_0x97bec3[_0xf3dd('0x23')]?_[_0xf3dd('0x21')](_0x97bec3[_0xf3dd('0x23')],function(_0x478538){return{'model':db[_0x478538['model']],'as':_0x478538['as'],'attributes':_0x478538[_0xf3dd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf3dd('0xf')](function(_0x3d904f){logger[_0xf3dd('0x10')](_0xf3dd('0x19'),_0x21eb3b);logger[_0xf3dd('0x24')]('GetWhatsappQueue',_0x21eb3b,JSON[_0xf3dd('0x14')](_0x3d904f));_0x2f45f1(_0x3d904f);})[_0xf3dd('0x18')](function(_0x71de2d){logger[_0xf3dd('0x15')](_0xf3dd('0x19'),_0x71de2d[_0xf3dd('0x17')],_0x21eb3b);_0x429f3d(_0x5dd2b2[_0xf3dd('0x15')](0x1f4,_0x71de2d[_0xf3dd('0x17')]));});});};exports[_0xf3dd('0x25')]=function(_0x1f2e61){var _0x2e0ac6=this;return new Promise(function(_0x44d145,_0x5b4080){return db[_0xf3dd('0x1a')][_0xf3dd('0x26')]({'raw':_0x1f2e61[_0xf3dd('0x1d')]?_0x1f2e61['options'][_0xf3dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f2e61[_0xf3dd('0x1d')]?_0x1f2e61[_0xf3dd('0x1d')][_0xf3dd('0x1e')]||null:null,'attributes':_0x1f2e61[_0xf3dd('0x1d')]?_0x1f2e61['options']['attributes']||null:null,'include':_0x1f2e61[_0xf3dd('0x1d')]?_0x1f2e61['options']['include']?_[_0xf3dd('0x21')](_0x1f2e61[_0xf3dd('0x1d')]['include'],function(_0x4c86be){return{'model':db[_0x4c86be[_0xf3dd('0x22')]],'as':_0x4c86be['as'],'attributes':_0x4c86be[_0xf3dd('0x1f')],'include':_0x4c86be[_0xf3dd('0x23')]?_[_0xf3dd('0x21')](_0x4c86be['include'],function(_0x1a894b){return{'model':db[_0x1a894b['model']],'as':_0x1a894b['as'],'attributes':_0x1a894b[_0xf3dd('0x1f')],'include':_0x1a894b[_0xf3dd('0x23')]?_[_0xf3dd('0x21')](_0x1a894b[_0xf3dd('0x23')],function(_0x5e61db){return{'model':db[_0x5e61db[_0xf3dd('0x22')]],'as':_0x5e61db['as'],'attributes':_0x5e61db[_0xf3dd('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3730ea){logger['info'](_0xf3dd('0x25'),_0x1f2e61);logger[_0xf3dd('0x24')](_0xf3dd('0x25'),_0x1f2e61,JSON['stringify'](_0x3730ea));_0x44d145(_0x3730ea);})[_0xf3dd('0x18')](function(_0x109597){logger[_0xf3dd('0x15')](_0xf3dd('0x25'),_0x109597[_0xf3dd('0x17')],_0x1f2e61);_0x5b4080(_0x2e0ac6['error'](0x1f4,_0x109597[_0xf3dd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c449d11..b04c0ba 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 _0x49fd=['removeListener','length','whatsappQueue:','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49fd,0x8a));var _0xd49f=function(_0xfd78b4,_0x5aead8){_0xfd78b4=_0xfd78b4-0x0;var _0x1dc669=_0x49fd[_0xfd78b4];return _0x1dc669;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save','remove',_0xd49f('0x0')];function createListener(_0x589fdc,_0xf9b96c){return function(_0x301a9d){_0xf9b96c[_0xd49f('0x1')](_0x589fdc,_0x301a9d);};}function removeListener(_0x3703d8,_0x155ef9){return function(){WhatsappQueueEvents[_0xd49f('0x2')](_0x3703d8,_0x155ef9);};}exports['register']=function(_0x32b6f9){for(var _0x4176eb=0x0,_0x38940c=events[_0xd49f('0x3')];_0x4176eb<_0x38940c;_0x4176eb++){var _0x146d1e=events[_0x4176eb];var _0x26bbdc=createListener(_0xd49f('0x4')+_0x146d1e,_0x32b6f9);WhatsappQueueEvents['on'](_0x146d1e,_0x26bbdc);}}; \ No newline at end of file +var _0x0fed=['update','register','length','./whatsappQueue.events','remove'];(function(_0x506a66,_0x4fab8a){var _0x10780d=function(_0x45a2b3){while(--_0x45a2b3){_0x506a66['push'](_0x506a66['shift']());}};_0x10780d(++_0x4fab8a);}(_0x0fed,0x8f));var _0xd0fe=function(_0x1cbd39,_0x5d5e12){_0x1cbd39=_0x1cbd39-0x0;var _0x4367ec=_0x0fed[_0x1cbd39];return _0x4367ec;};'use strict';var WhatsappQueueEvents=require(_0xd0fe('0x0'));var events=['save',_0xd0fe('0x1'),_0xd0fe('0x2')];function createListener(_0x4fcdbb,_0x500944){return function(_0x5095e0){_0x500944['emit'](_0x4fcdbb,_0x5095e0);};}function removeListener(_0x1977d0,_0x4f082c){return function(){WhatsappQueueEvents['removeListener'](_0x1977d0,_0x4f082c);};}exports[_0xd0fe('0x3')]=function(_0x327e4d){for(var _0x14646e=0x0,_0x2b03c1=events[_0xd0fe('0x4')];_0x14646e<_0x2b03c1;_0x14646e++){var _0x1d0fab=events[_0x14646e];var _0x267fd2=createListener('whatsappQueue:'+_0x1d0fab,_0x327e4d);WhatsappQueueEvents['on'](_0x1d0fab,_0x267fd2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a31753b..8a3cbfc 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 _0x6458=['get','isAuthenticated','index','/describe','describe','show','post','create','update','delete','/:id','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6458,0x124));var _0x8645=function(_0x49b73b,_0x49456b){_0x49b73b=_0x49b73b-0x0;var _0x391e11=_0x6458[_0x49b73b];return _0x391e11;};'use strict';var multer=require(_0x8645('0x0'));var util=require('util');var path=require(_0x8645('0x1'));var timeout=require(_0x8645('0x2'));var express=require(_0x8645('0x3'));var router=express[_0x8645('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8645('0x5'));var config=require(_0x8645('0x6'));var controller=require(_0x8645('0x7'));router[_0x8645('0x8')]('/',auth[_0x8645('0x9')](),controller[_0x8645('0xa')]);router['get'](_0x8645('0xb'),auth[_0x8645('0x9')](),controller[_0x8645('0xc')]);router['get']('/:id',auth[_0x8645('0x9')](),controller[_0x8645('0xd')]);router[_0x8645('0xe')]('/',auth[_0x8645('0x9')](),controller[_0x8645('0xf')]);router['put']('/:id',auth[_0x8645('0x9')](),controller[_0x8645('0x10')]);router[_0x8645('0x11')](_0x8645('0x12'),auth[_0x8645('0x9')](),controller['destroy']);module[_0x8645('0x13')]=router; \ No newline at end of file +var _0x263e=['./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x263e,0x174));var _0xe263=function(_0x3dc089,_0x5ccb0d){_0x3dc089=_0x3dc089-0x0;var _0x34d9d3=_0x263e[_0x3dc089];return _0x34d9d3;};'use strict';var multer=require(_0xe263('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe263('0x1'));var express=require('express');var router=express[_0xe263('0x2')]();var fs_extra=require(_0xe263('0x3'));var auth=require(_0xe263('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe263('0x5'));var controller=require(_0xe263('0x6'));router[_0xe263('0x7')]('/',auth['isAuthenticated'](),controller[_0xe263('0x8')]);router[_0xe263('0x7')](_0xe263('0x9'),auth[_0xe263('0xa')](),controller[_0xe263('0xb')]);router[_0xe263('0x7')](_0xe263('0xc'),auth[_0xe263('0xa')](),controller[_0xe263('0xd')]);router[_0xe263('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe263('0xf')](_0xe263('0xc'),auth[_0xe263('0xa')](),controller['update']);router['delete'](_0xe263('0xc'),auth['isAuthenticated'](),controller[_0xe263('0x10')]);module[_0xe263('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 230a6d5..38302bb 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2c0175,_0x3e96f7){var _0x32c47d=function(_0x5cffe9){while(--_0x5cffe9){_0x2c0175['push'](_0x2c0175['shift']());}};_0x32c47d(++_0x3e96f7);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4a1915,_0x36ce26){var _0x574087=function(_0x53025d){while(--_0x53025d){_0x4a1915['push'](_0x4a1915['shift']());}};_0x574087(++_0x36ce26);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index ca1b1c8..f6ba430 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 _0x1d2d=['options','WhatsappQueueReport','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x11e78f,_0x416053){var _0x2925c2=function(_0x5b0c0e){while(--_0x5b0c0e){_0x11e78f['push'](_0x11e78f['shift']());}};_0x2925c2(++_0x416053);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x219e78,_0x594ffd){_0x219e78=_0x219e78-0x0;var _0xd0498d=_0x1d2d[_0x219e78];return _0xd0498d;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){_0x19d535['status'](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x42da6d,_0x41330f){return function(_0x2e1709){if(!_0x2e1709){_0x42da6d[_0xd1d2('0x1b')](0x194);}return _0x2e1709;};}function handleError(_0x39e991,_0x28b8be){_0x28b8be=_0x28b8be||0x1f4;return function(_0x34faf7){logger[_0xd1d2('0x28')](_0x34faf7[_0xd1d2('0x29')]);if(_0x34faf7[_0xd1d2('0x2a')]){delete _0x34faf7['name'];}_0x39e991['status'](_0x28b8be)[_0xd1d2('0x2b')](_0x34faf7);};}exports[_0xd1d2('0x2c')]=function(_0x1e6072,_0x2b4c1f){var _0xc815ea={},_0x48ade1={},_0x39d694={'count':0x0,'rows':[]};var _0x41171c=_[_0xd1d2('0x2d')](db['WhatsappQueueReport'][_0xd1d2('0x2e')],function(_0x1db17f){return{'name':_0x1db17f[_0xd1d2('0x2f')],'type':_0x1db17f['type'][_0xd1d2('0x30')]};});_0x48ade1[_0xd1d2('0x31')]=_[_0xd1d2('0x2d')](_0x41171c,_0xd1d2('0x2a'));_0x48ade1[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x1e6072[_0xd1d2('0x32')]);_0x48ade1[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],_0x48ade1[_0xd1d2('0x32')]);_0xc815ea[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],qs[_0xd1d2('0x37')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x37')]));_0xc815ea[_0xd1d2('0x36')]=_0xc815ea['attributes'][_0xd1d2('0x38')]?_0xc815ea[_0xd1d2('0x36')]:_0x48ade1[_0xd1d2('0x31')];if(!_0x1e6072['query'][_0xd1d2('0x39')]('nolimit')){_0xc815ea['limit']=qs[_0xd1d2('0x21')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x21')]);_0xc815ea[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1e6072[_0xd1d2('0x32')]['offset']);}_0xc815ea[_0xd1d2('0x3a')]=qs[_0xd1d2('0x3b')](_0x1e6072['query'][_0xd1d2('0x3b')]);_0xc815ea[_0xd1d2('0x3c')]=qs[_0xd1d2('0x34')](_[_0xd1d2('0x3d')](_0x1e6072['query'],_0x48ade1['filters']),_0x41171c);if(_0x1e6072[_0xd1d2('0x32')]['filter']){_0xc815ea['where']=_['merge'](_0xc815ea[_0xd1d2('0x3c')],{'$or':_['map'](_0x41171c,function(_0x3f4fd7){if(_0x3f4fd7['type']!=='VIRTUAL'){var _0x4bcea4={};_0x4bcea4[_0x3f4fd7[_0xd1d2('0x2a')]]={'$like':'%'+_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x3e')]+'%'};return _0x4bcea4;}})});}_0xc815ea=_[_0xd1d2('0x3f')]({},_0xc815ea,_0x1e6072[_0xd1d2('0x40')]);var _0xb5bec2={'where':_0xc815ea[_0xd1d2('0x3c')]};return db[_0xd1d2('0x41')][_0xd1d2('0x22')](_0xb5bec2)[_0xd1d2('0x26')](function(_0x2cedb4){_0x39d694[_0xd1d2('0x22')]=_0x2cedb4;if(_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x42')]){_0xc815ea['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xd1d2('0x43')](_0xc815ea);})[_0xd1d2('0x26')](function(_0x24fc93){_0x39d694['rows']=_0x24fc93;return _0x39d694;})['then'](respondWithFilteredResult(_0x2b4c1f,_0xc815ea))[_0xd1d2('0x44')](handleError(_0x2b4c1f,null));};exports[_0xd1d2('0x45')]=function(_0x4dc730,_0x2fe92a){var _0x4c5d49={'raw':!![],'where':{'id':_0x4dc730[_0xd1d2('0x46')]['id']}},_0x5a3790={};_0x5a3790['model']=_['keys'](db[_0xd1d2('0x41')][_0xd1d2('0x2e')]);_0x5a3790[_0xd1d2('0x32')]=_['keys'](_0x4dc730[_0xd1d2('0x32')]);_0x5a3790[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x5a3790[_0xd1d2('0x31')],_0x5a3790['query']);_0x4c5d49[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x5a3790['model'],qs[_0xd1d2('0x37')](_0x4dc730['query'][_0xd1d2('0x37')]));_0x4c5d49[_0xd1d2('0x36')]=_0x4c5d49[_0xd1d2('0x36')][_0xd1d2('0x38')]?_0x4c5d49[_0xd1d2('0x36')]:_0x5a3790['model'];if(_0x4dc730['query'][_0xd1d2('0x42')]){_0x4c5d49[_0xd1d2('0x47')]=[{'all':!![]}];}_0x4c5d49=_['merge']({},_0x4c5d49,_0x4dc730[_0xd1d2('0x40')]);return db[_0xd1d2('0x41')][_0xd1d2('0x48')](_0x4c5d49)[_0xd1d2('0x26')](handleEntityNotFound(_0x2fe92a,null))[_0xd1d2('0x26')](respondWithResult(_0x2fe92a,null))[_0xd1d2('0x44')](handleError(_0x2fe92a,null));};exports[_0xd1d2('0x49')]=function(_0x57c668,_0xed9e9){return db[_0xd1d2('0x41')]['create'](_0x57c668[_0xd1d2('0x4a')],{})[_0xd1d2('0x26')](respondWithResult(_0xed9e9,0xc9))['catch'](handleError(_0xed9e9,null));};exports['update']=function(_0x3d4fe3,_0x182ea8){if(_0x3d4fe3['body']['id']){delete _0x3d4fe3[_0xd1d2('0x4a')]['id'];}return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0x3d4fe3[_0xd1d2('0x46')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x182ea8,null))['then'](saveUpdates(_0x3d4fe3['body'],null))[_0xd1d2('0x26')](respondWithResult(_0x182ea8,null))['catch'](handleError(_0x182ea8,null));};exports[_0xd1d2('0x27')]=function(_0xcd4b70,_0x4f4cb9){return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0xcd4b70['params']['id']}})['then'](handleEntityNotFound(_0x4f4cb9,null))[_0xd1d2('0x26')](removeEntity(_0x4f4cb9,null))[_0xd1d2('0x44')](handleError(_0x4f4cb9,null));};exports[_0xd1d2('0x4b')]=function(_0xfd8024,_0xa013ce){return db[_0xd1d2('0x41')][_0xd1d2('0x4b')]()[_0xd1d2('0x26')](respondWithResult(_0xa013ce,null))[_0xd1d2('0x44')](handleError(_0xa013ce,null));}; \ No newline at end of file +var _0x878f=['intersection','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','include','WhatsappQueueReport','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes'];(function(_0x3ebf7,_0x1f7ede){var _0x31ad7f=function(_0x2c9dd0){while(--_0x2c9dd0){_0x3ebf7['push'](_0x3ebf7['shift']());}};_0x31ad7f(++_0x1f7ede);}(_0x878f,0x173));var _0xf878=function(_0x4a0aff,_0xff4d78){_0x4a0aff=_0x4a0aff-0x0;var _0x17e01e=_0x878f[_0x4a0aff];return _0x17e01e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf878('0x0'));var zipdir=require(_0xf878('0x1'));var jsonpatch=require(_0xf878('0x2'));var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require(_0xf878('0x8'));var sox=require(_0xf878('0x9'));var csv=require(_0xf878('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xd'));var authService=require(_0xf878('0xe'));var qs=require(_0xf878('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x10'));var logger=require(_0xf878('0x11'))('api');var utils=require(_0xf878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x13'));var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x339c9c,_0x596fb5){_0x596fb5=_0x596fb5||0xcc;return function(_0x1ce004){if(_0x1ce004){return _0x339c9c[_0xf878('0x15')](_0x596fb5);}return _0x339c9c[_0xf878('0x16')](_0x596fb5)['end']();};}function respondWithResult(_0xe2c2de,_0x3902f7){_0x3902f7=_0x3902f7||0xc8;return function(_0x119e9e){if(_0x119e9e){return _0xe2c2de['status'](_0x3902f7)['json'](_0x119e9e);}};}function respondWithFilteredResult(_0x4c0948,_0x35ff2d){return function(_0x31d888){if(_0x31d888){var _0x6dbeca=typeof _0x35ff2d[_0xf878('0x17')]===_0xf878('0x18')&&typeof _0x35ff2d[_0xf878('0x19')]===_0xf878('0x18');var _0x3c5dee=_0x31d888[_0xf878('0x1a')];var _0x3b2e1b=_0x6dbeca?0x0:_0x35ff2d['offset'];var _0x2b2b54=_0x6dbeca?_0x31d888[_0xf878('0x1a')]:_0x35ff2d[_0xf878('0x17')]+_0x35ff2d[_0xf878('0x19')];var _0x3714f6;if(_0x2b2b54>=_0x3c5dee){_0x2b2b54=_0x3c5dee;_0x3714f6=0xc8;}else{_0x3714f6=0xce;}_0x4c0948[_0xf878('0x16')](_0x3714f6);return _0x4c0948[_0xf878('0x1b')]('Content-Range',_0x3b2e1b+'-'+_0x2b2b54+'/'+_0x3c5dee)[_0xf878('0x1c')](_0x31d888);}return null;};}function patchUpdates(_0x140866){return function(_0x250f85){try{jsonpatch['apply'](_0x250f85,_0x140866,!![]);}catch(_0x432e5d){return BPromise[_0xf878('0x1d')](_0x432e5d);}return _0x250f85[_0xf878('0x1e')]();};}function saveUpdates(_0x392822,_0x22d884){return function(_0x442450){if(_0x442450){return _0x442450[_0xf878('0x1f')](_0x392822)[_0xf878('0x20')](function(_0x212436){return _0x212436;});}return null;};}function removeEntity(_0x1a6506,_0x45e61f){return function(_0x566995){if(_0x566995){return _0x566995[_0xf878('0x21')]()['then'](function(){_0x1a6506[_0xf878('0x16')](0xcc)[_0xf878('0x22')]();});}};}function handleEntityNotFound(_0x35b3b4,_0x280036){return function(_0x20449e){if(!_0x20449e){_0x35b3b4['sendStatus'](0x194);}return _0x20449e;};}function handleError(_0x58c713,_0x59ba7b){_0x59ba7b=_0x59ba7b||0x1f4;return function(_0x242926){logger[_0xf878('0x23')](_0x242926[_0xf878('0x24')]);if(_0x242926['name']){delete _0x242926[_0xf878('0x25')];}_0x58c713[_0xf878('0x16')](_0x59ba7b)[_0xf878('0x26')](_0x242926);};}exports[_0xf878('0x27')]=function(_0x41dd55,_0x5aff46){var _0x502322={},_0x9a127d={},_0x5d9c97={'count':0x0,'rows':[]};var _0x4a0286=_[_0xf878('0x28')](db['WhatsappQueueReport'][_0xf878('0x29')],function(_0x51afaf){return{'name':_0x51afaf[_0xf878('0x2a')],'type':_0x51afaf['type'][_0xf878('0x2b')]};});_0x9a127d['model']=_[_0xf878('0x28')](_0x4a0286,_0xf878('0x25'));_0x9a127d[_0xf878('0x2c')]=_[_0xf878('0x2d')](_0x41dd55[_0xf878('0x2c')]);_0x9a127d[_0xf878('0x2e')]=_['intersection'](_0x9a127d[_0xf878('0x2f')],_0x9a127d[_0xf878('0x2c')]);_0x502322[_0xf878('0x30')]=_[_0xf878('0x31')](_0x9a127d[_0xf878('0x2f')],qs['fields'](_0x41dd55[_0xf878('0x2c')][_0xf878('0x32')]));_0x502322['attributes']=_0x502322[_0xf878('0x30')][_0xf878('0x33')]?_0x502322[_0xf878('0x30')]:_0x9a127d[_0xf878('0x2f')];if(!_0x41dd55[_0xf878('0x2c')]['hasOwnProperty'](_0xf878('0x34'))){_0x502322[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x41dd55[_0xf878('0x2c')]['limit']);_0x502322[_0xf878('0x17')]=qs['offset'](_0x41dd55['query'][_0xf878('0x17')]);}_0x502322[_0xf878('0x35')]=qs[_0xf878('0x36')](_0x41dd55[_0xf878('0x2c')][_0xf878('0x36')]);_0x502322['where']=qs[_0xf878('0x2e')](_['pick'](_0x41dd55[_0xf878('0x2c')],_0x9a127d[_0xf878('0x2e')]),_0x4a0286);if(_0x41dd55['query'][_0xf878('0x37')]){_0x502322[_0xf878('0x38')]=_['merge'](_0x502322[_0xf878('0x38')],{'$or':_[_0xf878('0x28')](_0x4a0286,function(_0x5b4098){if(_0x5b4098[_0xf878('0x39')]!==_0xf878('0x3a')){var _0x34731d={};_0x34731d[_0x5b4098[_0xf878('0x25')]]={'$like':'%'+_0x41dd55[_0xf878('0x2c')][_0xf878('0x37')]+'%'};return _0x34731d;}})});}_0x502322=_[_0xf878('0x3b')]({},_0x502322,_0x41dd55['options']);var _0x1179fb={'where':_0x502322[_0xf878('0x38')]};return db['WhatsappQueueReport'][_0xf878('0x1a')](_0x1179fb)['then'](function(_0x489964){_0x5d9c97[_0xf878('0x1a')]=_0x489964;if(_0x41dd55[_0xf878('0x2c')][_0xf878('0x3c')]){_0x502322[_0xf878('0x3d')]=[{'all':!![]}];}return db[_0xf878('0x3e')]['findAll'](_0x502322);})[_0xf878('0x20')](function(_0x4c4ae4){_0x5d9c97[_0xf878('0x3f')]=_0x4c4ae4;return _0x5d9c97;})[_0xf878('0x20')](respondWithFilteredResult(_0x5aff46,_0x502322))['catch'](handleError(_0x5aff46,null));};exports['show']=function(_0x180594,_0x2a66c1){var _0x13fcd3={'raw':!![],'where':{'id':_0x180594[_0xf878('0x40')]['id']}},_0x2f6ee5={};_0x2f6ee5[_0xf878('0x2f')]=_[_0xf878('0x2d')](db[_0xf878('0x3e')][_0xf878('0x29')]);_0x2f6ee5['query']=_[_0xf878('0x2d')](_0x180594[_0xf878('0x2c')]);_0x2f6ee5[_0xf878('0x2e')]=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],_0x2f6ee5[_0xf878('0x2c')]);_0x13fcd3['attributes']=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],qs[_0xf878('0x32')](_0x180594[_0xf878('0x2c')][_0xf878('0x32')]));_0x13fcd3['attributes']=_0x13fcd3[_0xf878('0x30')][_0xf878('0x33')]?_0x13fcd3[_0xf878('0x30')]:_0x2f6ee5[_0xf878('0x2f')];if(_0x180594['query'][_0xf878('0x3c')]){_0x13fcd3[_0xf878('0x3d')]=[{'all':!![]}];}_0x13fcd3=_[_0xf878('0x3b')]({},_0x13fcd3,_0x180594['options']);return db['WhatsappQueueReport'][_0xf878('0x41')](_0x13fcd3)['then'](handleEntityNotFound(_0x2a66c1,null))['then'](respondWithResult(_0x2a66c1,null))['catch'](handleError(_0x2a66c1,null));};exports[_0xf878('0x42')]=function(_0x49e719,_0x156fdb){return db[_0xf878('0x3e')][_0xf878('0x42')](_0x49e719[_0xf878('0x43')],{})[_0xf878('0x20')](respondWithResult(_0x156fdb,0xc9))[_0xf878('0x44')](handleError(_0x156fdb,null));};exports[_0xf878('0x1f')]=function(_0x526c89,_0xb0bf4c){if(_0x526c89[_0xf878('0x43')]['id']){delete _0x526c89[_0xf878('0x43')]['id'];}return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x526c89['params']['id']}})['then'](handleEntityNotFound(_0xb0bf4c,null))[_0xf878('0x20')](saveUpdates(_0x526c89[_0xf878('0x43')],null))['then'](respondWithResult(_0xb0bf4c,null))[_0xf878('0x44')](handleError(_0xb0bf4c,null));};exports['destroy']=function(_0x1ce6b9,_0x31adde){return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x1ce6b9['params']['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x31adde,null))[_0xf878('0x20')](removeEntity(_0x31adde,null))[_0xf878('0x44')](handleError(_0x31adde,null));};exports['describe']=function(_0xce30a5,_0x30df05){return db[_0xf878('0x3e')][_0xf878('0x45')]()['then'](respondWithResult(_0x30df05,null))[_0xf878('0x44')](handleError(_0x30df05,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 443f6c8..e00ddcb 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 _0xe833=['moment','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger'];(function(_0x1f8e8e,_0x1c9144){var _0x58cf50=function(_0x2a5037){while(--_0x2a5037){_0x1f8e8e['push'](_0x1f8e8e['shift']());}};_0x58cf50(++_0x1c9144);}(_0xe833,0x172));var _0x3e83=function(_0x483e96,_0x53ae46){_0x483e96=_0x483e96-0x0;var _0x2bbd9c=_0xe833[_0x483e96];return _0x2bbd9c;};'use strict';var _=require(_0x3e83('0x0'));var util=require('util');var logger=require(_0x3e83('0x1'))('api');var moment=require(_0x3e83('0x2'));var BPromise=require(_0x3e83('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e83('0x4'));var rimraf=require(_0x3e83('0x5'));var config=require(_0x3e83('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x3e83('0x7')]=function(_0x4b75c6,_0x3f6fd6){return _0x4b75c6[_0x3e83('0x8')](_0x3e83('0x9'),attributes,{'tableName':_0x3e83('0xa'),'paranoid':![],'indexes':[{'name':_0x3e83('0xb'),'fields':[_0x3e83('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99ee=['../../config/environment','./whatsappQueueReport.attributes','define','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x51f80d,_0x1a2606){var _0x40919f=function(_0x54a2b2){while(--_0x54a2b2){_0x51f80d['push'](_0x51f80d['shift']());}};_0x40919f(++_0x1a2606);}(_0x99ee,0x13c));var _0xe99e=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x99ee[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xe99e('0x0'));var util=require(_0xe99e('0x1'));var logger=require(_0xe99e('0x2'))('api');var moment=require(_0xe99e('0x3'));var BPromise=require(_0xe99e('0x4'));var rp=require(_0xe99e('0x5'));var fs=require('fs');var path=require(_0xe99e('0x6'));var rimraf=require(_0xe99e('0x7'));var config=require(_0xe99e('0x8'));var attributes=require(_0xe99e('0x9'));module['exports']=function(_0x69eb98,_0x3df87b){return _0x69eb98[_0xe99e('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xe99e('0xb'),'fields':[_0xe99e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 0733f2c..749f59f 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 _0x9857=['raw','CreateWhatsappQueueReport','stringify','UpdateWhatsappQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','WhatsappQueueReport','create','body','options'];(function(_0x384691,_0x1f4e03){var _0x28b395=function(_0x541706){while(--_0x541706){_0x384691['push'](_0x384691['shift']());}};_0x28b395(++_0x1f4e03);}(_0x9857,0x87));var _0x7985=function(_0x2868b9,_0xf2c027){_0x2868b9=_0x2868b9-0x0;var _0x4a7747=_0x9857[_0x2868b9];return _0x4a7747;};'use strict';var _=require(_0x7985('0x0'));var util=require(_0x7985('0x1'));var moment=require('moment');var BPromise=require(_0x7985('0x2'));var rs=require(_0x7985('0x3'));var fs=require('fs');var Redis=require(_0x7985('0x4'));var db=require(_0x7985('0x5'))['db'];var utils=require(_0x7985('0x6'));var logger=require('../../config/logger')(_0x7985('0x7'));var config=require(_0x7985('0x8'));var jayson=require(_0x7985('0x9'));var client=jayson[_0x7985('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fa565,_0x53b82a,_0x3bce64){return new BPromise(function(_0x2757e5,_0x302f94){return client[_0x7985('0xb')](_0x4fa565,_0x3bce64)[_0x7985('0xc')](function(_0x5a8ddb){logger[_0x7985('0xd')](_0x7985('0xe'),_0x53b82a,_0x7985('0xf'));logger[_0x7985('0x10')](_0x7985('0x11'),_0x53b82a,_0x7985('0xf'),JSON['stringify'](_0x5a8ddb));if(_0x5a8ddb[_0x7985('0x12')]){if(_0x5a8ddb[_0x7985('0x12')]['code']===0x1f4){logger[_0x7985('0x12')](_0x7985('0xe'),_0x53b82a,_0x5a8ddb['error']['message']);return _0x302f94(_0x5a8ddb['error'][_0x7985('0x13')]);}logger[_0x7985('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x53b82a,_0x5a8ddb['error'][_0x7985('0x13')]);return _0x2757e5(_0x5a8ddb['error'][_0x7985('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x53b82a,_0x7985('0xf'));_0x2757e5(_0x5a8ddb['result'][_0x7985('0x13')]);}})[_0x7985('0x14')](function(_0x27ada5){logger['error'](_0x7985('0xe'),_0x53b82a,_0x27ada5);_0x302f94(_0x27ada5);});});}exports['CreateWhatsappQueueReport']=function(_0x518b17){var _0x1de99f=this;return new Promise(function(_0x1c69fb,_0x2a46c5){return db[_0x7985('0x15')][_0x7985('0x16')](_0x518b17[_0x7985('0x17')],{'raw':_0x518b17['options']?_0x518b17[_0x7985('0x18')][_0x7985('0x19')]===undefined?!![]:![]:!![]})[_0x7985('0xc')](function(_0x546ae4){logger[_0x7985('0xd')]('CreateWhatsappQueueReport',_0x518b17);logger[_0x7985('0x10')](_0x7985('0x1a'),_0x518b17,JSON[_0x7985('0x1b')](_0x546ae4));_0x1c69fb(_0x546ae4);})[_0x7985('0x14')](function(_0x1bc328){logger['error']('CreateWhatsappQueueReport',_0x1bc328['message'],_0x518b17);_0x2a46c5(_0x1de99f['error'](0x1f4,_0x1bc328[_0x7985('0x13')]));});});};exports[_0x7985('0x1c')]=function(_0x52ca5a){var _0xdfe838=this;return new Promise(function(_0xc5723b,_0x46a0fb){return db[_0x7985('0x15')][_0x7985('0x1d')](_0x52ca5a['body'],{'raw':_0x52ca5a[_0x7985('0x18')]?_0x52ca5a[_0x7985('0x18')][_0x7985('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52ca5a[_0x7985('0x18')]?_0x52ca5a[_0x7985('0x18')]['where']||null:null,'attributes':_0x52ca5a[_0x7985('0x18')]?_0x52ca5a[_0x7985('0x18')][_0x7985('0x1e')]||null:null,'limit':_0x52ca5a[_0x7985('0x18')]?_0x52ca5a['options'][_0x7985('0x1f')]||null:null})[_0x7985('0xc')](function(_0x44b64b){logger['info'](_0x7985('0x1c'),_0x52ca5a);logger[_0x7985('0x10')](_0x7985('0x1c'),_0x52ca5a,JSON[_0x7985('0x1b')](_0x44b64b));_0xc5723b(_0x44b64b);})[_0x7985('0x14')](function(_0xe750a2){logger['error'](_0x7985('0x1c'),_0xe750a2[_0x7985('0x13')],_0x52ca5a);_0x46a0fb(_0xdfe838['error'](0x1f4,_0xe750a2[_0x7985('0x13')]));});});}; \ No newline at end of file +var _0xbd79=['WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x2a880e,_0x44beb7){var _0x45e0ce=function(_0x10cbc2){while(--_0x10cbc2){_0x2a880e['push'](_0x2a880e['shift']());}};_0x45e0ce(++_0x44beb7);}(_0xbd79,0x1ed));var _0x9bd7=function(_0x10e3fd,_0x16d0f9){_0x10e3fd=_0x10e3fd-0x0;var _0x25ecd2=_0xbd79[_0x10e3fd];return _0x25ecd2;};'use strict';var _=require(_0x9bd7('0x0'));var util=require(_0x9bd7('0x1'));var moment=require(_0x9bd7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bd7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9bd7('0x4'))(_0x9bd7('0x5'));var config=require('../../config/environment');var jayson=require(_0x9bd7('0x6'));var client=jayson['client'][_0x9bd7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe81474,_0x32ea60,_0x21945f){return new BPromise(function(_0x15e7f6,_0xbbfdc3){return client[_0x9bd7('0x8')](_0xe81474,_0x21945f)[_0x9bd7('0x9')](function(_0xd10095){logger[_0x9bd7('0xa')](_0x9bd7('0xb'),_0x32ea60,_0x9bd7('0xc'));logger[_0x9bd7('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x32ea60,_0x9bd7('0xc'),JSON[_0x9bd7('0xe')](_0xd10095));if(_0xd10095[_0x9bd7('0xf')]){if(_0xd10095['error'][_0x9bd7('0x10')]===0x1f4){logger[_0x9bd7('0xf')](_0x9bd7('0xb'),_0x32ea60,_0xd10095['error'][_0x9bd7('0x11')]);return _0xbbfdc3(_0xd10095[_0x9bd7('0xf')][_0x9bd7('0x11')]);}logger[_0x9bd7('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x32ea60,_0xd10095[_0x9bd7('0xf')][_0x9bd7('0x11')]);return _0x15e7f6(_0xd10095[_0x9bd7('0xf')][_0x9bd7('0x11')]);}else{logger[_0x9bd7('0xa')](_0x9bd7('0xb'),_0x32ea60,_0x9bd7('0xc'));_0x15e7f6(_0xd10095[_0x9bd7('0x12')][_0x9bd7('0x11')]);}})[_0x9bd7('0x13')](function(_0x3e737d){logger[_0x9bd7('0xf')](_0x9bd7('0xb'),_0x32ea60,_0x3e737d);_0xbbfdc3(_0x3e737d);});});}exports[_0x9bd7('0x14')]=function(_0x5c9351){var _0x11eae8=this;return new Promise(function(_0x2cd7cb,_0x19fc7e){return db[_0x9bd7('0x15')]['create'](_0x5c9351[_0x9bd7('0x16')],{'raw':_0x5c9351[_0x9bd7('0x17')]?_0x5c9351[_0x9bd7('0x17')][_0x9bd7('0x18')]===undefined?!![]:![]:!![]})[_0x9bd7('0x9')](function(_0x15647b){logger[_0x9bd7('0xa')](_0x9bd7('0x14'),_0x5c9351);logger['debug'](_0x9bd7('0x14'),_0x5c9351,JSON[_0x9bd7('0xe')](_0x15647b));_0x2cd7cb(_0x15647b);})['catch'](function(_0x6a5c97){logger[_0x9bd7('0xf')](_0x9bd7('0x14'),_0x6a5c97['message'],_0x5c9351);_0x19fc7e(_0x11eae8['error'](0x1f4,_0x6a5c97['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x30eac9){var _0x26c6d2=this;return new Promise(function(_0x475130,_0x439eab){return db[_0x9bd7('0x15')]['update'](_0x30eac9[_0x9bd7('0x16')],{'raw':_0x30eac9[_0x9bd7('0x17')]?_0x30eac9[_0x9bd7('0x17')][_0x9bd7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30eac9[_0x9bd7('0x17')]?_0x30eac9[_0x9bd7('0x17')]['where']||null:null,'attributes':_0x30eac9[_0x9bd7('0x17')]?_0x30eac9[_0x9bd7('0x17')][_0x9bd7('0x19')]||null:null,'limit':_0x30eac9[_0x9bd7('0x17')]?_0x30eac9['options'][_0x9bd7('0x1a')]||null:null})[_0x9bd7('0x9')](function(_0x1a6a50){logger[_0x9bd7('0xa')]('UpdateWhatsappQueueReport',_0x30eac9);logger[_0x9bd7('0xd')](_0x9bd7('0x1b'),_0x30eac9,JSON['stringify'](_0x1a6a50));_0x475130(_0x1a6a50);})[_0x9bd7('0x13')](function(_0x53548e){logger[_0x9bd7('0xf')](_0x9bd7('0x1b'),_0x53548e[_0x9bd7('0x11')],_0x30eac9);_0x439eab(_0x26c6d2[_0x9bd7('0xf')](0x1f4,_0x53548e[_0x9bd7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index da18af7..69647d7 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 _0x1efc=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create'];(function(_0x5e7265,_0x38f67a){var _0x2bb829=function(_0x3d47ce){while(--_0x3d47ce){_0x5e7265['push'](_0x5e7265['shift']());}};_0x2bb829(++_0x38f67a);}(_0x1efc,0x10c));var _0xc1ef=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x1efc[_0x6f1a87];return _0x2495c7;};'use strict';var multer=require(_0xc1ef('0x0'));var util=require(_0xc1ef('0x1'));var path=require(_0xc1ef('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1ef('0x3'));var router=express[_0xc1ef('0x4')]();var fs_extra=require(_0xc1ef('0x5'));var auth=require(_0xc1ef('0x6'));var interaction=require(_0xc1ef('0x7'));var config=require(_0xc1ef('0x8'));var controller=require(_0xc1ef('0x9'));router[_0xc1ef('0xa')]('/',auth['isAuthenticated'](),controller[_0xc1ef('0xb')]);router[_0xc1ef('0xa')]('/describe',auth[_0xc1ef('0xc')](),controller[_0xc1ef('0xd')]);router[_0xc1ef('0xa')](_0xc1ef('0xe'),auth[_0xc1ef('0xc')](),controller[_0xc1ef('0xf')]);router[_0xc1ef('0x10')]('/',auth[_0xc1ef('0xc')](),controller[_0xc1ef('0x11')]);router['put'](_0xc1ef('0xe'),auth['isAuthenticated'](),controller[_0xc1ef('0x12')]);router[_0xc1ef('0x13')]('/:id',auth[_0xc1ef('0xc')](),controller[_0xc1ef('0x14')]);module[_0xc1ef('0x15')]=router; \ No newline at end of file +var _0x6091=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6091,0x1d8));var _0x1609=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x6091[_0x35a274];return _0x40d905;};'use strict';var multer=require(_0x1609('0x0'));var util=require(_0x1609('0x1'));var path=require(_0x1609('0x2'));var timeout=require(_0x1609('0x3'));var express=require(_0x1609('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1609('0x5'));var config=require(_0x1609('0x6'));var controller=require(_0x1609('0x7'));router[_0x1609('0x8')]('/',auth[_0x1609('0x9')](),controller[_0x1609('0xa')]);router['get'](_0x1609('0xb'),auth[_0x1609('0x9')](),controller[_0x1609('0xc')]);router[_0x1609('0x8')](_0x1609('0xd'),auth[_0x1609('0x9')](),controller[_0x1609('0xe')]);router[_0x1609('0xf')]('/',auth[_0x1609('0x9')](),controller[_0x1609('0x10')]);router['put'](_0x1609('0xd'),auth[_0x1609('0x9')](),controller['update']);router[_0x1609('0x11')](_0x1609('0xd'),auth[_0x1609('0x9')](),controller[_0x1609('0x12')]);module[_0x1609('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 28b8cb4..3a00012 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 _0x3f48=['STRING','ENUM','account','agent','DATE'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x3f48,0x17c));var _0x83f4=function(_0x26b5a1,_0x5f1162){_0x26b5a1=_0x26b5a1-0x0;var _0x1d3144=_0x3f48[_0x26b5a1];return _0x1d3144;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x83f4('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x83f4('0x1')](_0x83f4('0x2'),_0x83f4('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x83f4('0x4')]}}; \ No newline at end of file +var _0xedf1=['account','agent','queue','sequelize','exports'];(function(_0xa188e5,_0x4aa91e){var _0x36a0b3=function(_0x4247ba){while(--_0x4247ba){_0xa188e5['push'](_0xa188e5['shift']());}};_0x36a0b3(++_0x4aa91e);}(_0xedf1,0xb2));var _0x1edf=function(_0x3b2282,_0x354151){_0x3b2282=_0x3b2282-0x0;var _0x4f1388=_0xedf1[_0x3b2282];return _0x4f1388;};'use strict';var Sequelize=require(_0x1edf('0x0'));module[_0x1edf('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1edf('0x2'),_0x1edf('0x3'),_0x1edf('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2a09e3e..3e74f0e 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 _0x0b2f=['describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','update','body'];(function(_0x38fc37,_0x378bff){var _0x48c596=function(_0x42b4c9){while(--_0x42b4c9){_0x38fc37['push'](_0x38fc37['shift']());}};_0x48c596(++_0x378bff);}(_0x0b2f,0x1f2));var _0xf0b2=function(_0xa56846,_0x3b315e){_0xa56846=_0xa56846-0x0;var _0x36367f=_0x0b2f[_0xa56846];return _0x36367f;};'use strict';var emlformat=require(_0xf0b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0b2('0x1'));var jsonpatch=require(_0xf0b2('0x2'));var rp=require(_0xf0b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf0b2('0x4'));var path=require(_0xf0b2('0x5'));var sox=require('sox');var csv=require(_0xf0b2('0x6'));var ejs=require(_0xf0b2('0x7'));var fs=require('fs');var fs_extra=require(_0xf0b2('0x8'));var _=require(_0xf0b2('0x9'));var squel=require(_0xf0b2('0xa'));var crypto=require('crypto');var jsforce=require(_0xf0b2('0xb'));var deskjs=require(_0xf0b2('0xc'));var toCsv=require(_0xf0b2('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf0b2('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf0b2('0xe'));var hardwareService=require(_0xf0b2('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xf0b2('0x10'));var config=require(_0xf0b2('0x11'));var licenseUtil=require(_0xf0b2('0x12'));var db=require(_0xf0b2('0x13'))['db'];function respondWithStatusCode(_0x4077d1,_0x2f7d98){_0x2f7d98=_0x2f7d98||0xcc;return function(_0x2cf0fb){if(_0x2cf0fb){return _0x4077d1[_0xf0b2('0x14')](_0x2f7d98);}return _0x4077d1[_0xf0b2('0x15')](_0x2f7d98)[_0xf0b2('0x16')]();};}function respondWithResult(_0x40cf0a,_0x33cbff){_0x33cbff=_0x33cbff||0xc8;return function(_0x35bd45){if(_0x35bd45){return _0x40cf0a[_0xf0b2('0x15')](_0x33cbff)[_0xf0b2('0x17')](_0x35bd45);}};}function respondWithFilteredResult(_0x2b1e2f,_0x135c2e){return function(_0x33934a){if(_0x33934a){var _0x54ee57=typeof _0x135c2e['offset']===_0xf0b2('0x18')&&typeof _0x135c2e[_0xf0b2('0x19')]===_0xf0b2('0x18');var _0x546ed5=_0x33934a[_0xf0b2('0x1a')];var _0x1d6e1c=_0x54ee57?0x0:_0x135c2e[_0xf0b2('0x1b')];var _0x2d905c=_0x54ee57?_0x33934a[_0xf0b2('0x1a')]:_0x135c2e[_0xf0b2('0x1b')]+_0x135c2e[_0xf0b2('0x19')];var _0x22da03;if(_0x2d905c>=_0x546ed5){_0x2d905c=_0x546ed5;_0x22da03=0xc8;}else{_0x22da03=0xce;}_0x2b1e2f[_0xf0b2('0x15')](_0x22da03);return _0x2b1e2f[_0xf0b2('0x1c')]('Content-Range',_0x1d6e1c+'-'+_0x2d905c+'/'+_0x546ed5)[_0xf0b2('0x17')](_0x33934a);}return null;};}function patchUpdates(_0x3344c5){return function(_0x59a6bc){try{jsonpatch[_0xf0b2('0x1d')](_0x59a6bc,_0x3344c5,!![]);}catch(_0xb9b5ad){return BPromise[_0xf0b2('0x1e')](_0xb9b5ad);}return _0x59a6bc['save']();};}function saveUpdates(_0x5862e6,_0x4dc885){return function(_0x2279b6){if(_0x2279b6){return _0x2279b6['update'](_0x5862e6)[_0xf0b2('0x1f')](function(_0x13e6b1){return _0x13e6b1;});}return null;};}function removeEntity(_0x4e3c31,_0x830165){return function(_0x4d3f90){if(_0x4d3f90){return _0x4d3f90[_0xf0b2('0x20')]()[_0xf0b2('0x1f')](function(){_0x4e3c31[_0xf0b2('0x15')](0xcc)[_0xf0b2('0x16')]();});}};}function handleEntityNotFound(_0x1931bd,_0x2c55c0){return function(_0x4de501){if(!_0x4de501){_0x1931bd['sendStatus'](0x194);}return _0x4de501;};}function handleError(_0x2bed80,_0x491c33){_0x491c33=_0x491c33||0x1f4;return function(_0x5ecc2b){logger[_0xf0b2('0x21')](_0x5ecc2b['stack']);if(_0x5ecc2b[_0xf0b2('0x22')]){delete _0x5ecc2b[_0xf0b2('0x22')];}_0x2bed80[_0xf0b2('0x15')](_0x491c33)[_0xf0b2('0x23')](_0x5ecc2b);};}exports[_0xf0b2('0x24')]=function(_0x3e4538,_0x36fb91){var _0x291a65={},_0x31a180={},_0x4943ae={'count':0x0,'rows':[]};var _0x198aec=_[_0xf0b2('0x25')](db[_0xf0b2('0x26')][_0xf0b2('0x27')],function(_0x34ff89){return{'name':_0x34ff89[_0xf0b2('0x28')],'type':_0x34ff89[_0xf0b2('0x29')][_0xf0b2('0x2a')]};});_0x31a180['model']=_[_0xf0b2('0x25')](_0x198aec,_0xf0b2('0x22'));_0x31a180[_0xf0b2('0x2b')]=_['keys'](_0x3e4538['query']);_0x31a180['filters']=_[_0xf0b2('0x2c')](_0x31a180['model'],_0x31a180['query']);_0x291a65[_0xf0b2('0x2d')]=_[_0xf0b2('0x2c')](_0x31a180['model'],qs['fields'](_0x3e4538[_0xf0b2('0x2b')][_0xf0b2('0x2e')]));_0x291a65[_0xf0b2('0x2d')]=_0x291a65[_0xf0b2('0x2d')][_0xf0b2('0x2f')]?_0x291a65[_0xf0b2('0x2d')]:_0x31a180[_0xf0b2('0x30')];if(!_0x3e4538[_0xf0b2('0x2b')][_0xf0b2('0x31')](_0xf0b2('0x32'))){_0x291a65['limit']=qs['limit'](_0x3e4538[_0xf0b2('0x2b')][_0xf0b2('0x19')]);_0x291a65['offset']=qs['offset'](_0x3e4538['query']['offset']);}_0x291a65[_0xf0b2('0x33')]=qs[_0xf0b2('0x34')](_0x3e4538['query'][_0xf0b2('0x34')]);_0x291a65[_0xf0b2('0x35')]=qs[_0xf0b2('0x36')](_[_0xf0b2('0x37')](_0x3e4538[_0xf0b2('0x2b')],_0x31a180[_0xf0b2('0x36')]),_0x198aec);if(_0x3e4538[_0xf0b2('0x2b')][_0xf0b2('0x38')]){_0x291a65['where']=_[_0xf0b2('0x39')](_0x291a65[_0xf0b2('0x35')],{'$or':_['map'](_0x198aec,function(_0x19dc08){if(_0x19dc08[_0xf0b2('0x29')]!==_0xf0b2('0x3a')){var _0x528c36={};_0x528c36[_0x19dc08[_0xf0b2('0x22')]]={'$like':'%'+_0x3e4538[_0xf0b2('0x2b')]['filter']+'%'};return _0x528c36;}})});}_0x291a65=_[_0xf0b2('0x39')]({},_0x291a65,_0x3e4538[_0xf0b2('0x3b')]);var _0x1a7089={'where':_0x291a65['where']};return db[_0xf0b2('0x26')][_0xf0b2('0x1a')](_0x1a7089)[_0xf0b2('0x1f')](function(_0x248b96){_0x4943ae['count']=_0x248b96;if(_0x3e4538['query'][_0xf0b2('0x3c')]){_0x291a65[_0xf0b2('0x3d')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xf0b2('0x3e')](_0x291a65);})[_0xf0b2('0x1f')](function(_0x415874){_0x4943ae['rows']=_0x415874;return _0x4943ae;})['then'](respondWithFilteredResult(_0x36fb91,_0x291a65))[_0xf0b2('0x3f')](handleError(_0x36fb91,null));};exports['show']=function(_0x4103ff,_0x5a2b96){var _0x45e19c={'raw':!![],'where':{'id':_0x4103ff[_0xf0b2('0x40')]['id']}},_0x6c53f={};_0x6c53f[_0xf0b2('0x30')]=_[_0xf0b2('0x41')](db['WhatsappTransferReport'][_0xf0b2('0x27')]);_0x6c53f['query']=_[_0xf0b2('0x41')](_0x4103ff[_0xf0b2('0x2b')]);_0x6c53f[_0xf0b2('0x36')]=_[_0xf0b2('0x2c')](_0x6c53f[_0xf0b2('0x30')],_0x6c53f[_0xf0b2('0x2b')]);_0x45e19c[_0xf0b2('0x2d')]=_[_0xf0b2('0x2c')](_0x6c53f['model'],qs[_0xf0b2('0x2e')](_0x4103ff[_0xf0b2('0x2b')]['fields']));_0x45e19c[_0xf0b2('0x2d')]=_0x45e19c[_0xf0b2('0x2d')]['length']?_0x45e19c[_0xf0b2('0x2d')]:_0x6c53f[_0xf0b2('0x30')];if(_0x4103ff[_0xf0b2('0x2b')][_0xf0b2('0x3c')]){_0x45e19c['include']=[{'all':!![]}];}_0x45e19c=_['merge']({},_0x45e19c,_0x4103ff[_0xf0b2('0x3b')]);return db['WhatsappTransferReport'][_0xf0b2('0x42')](_0x45e19c)['then'](handleEntityNotFound(_0x5a2b96,null))[_0xf0b2('0x1f')](respondWithResult(_0x5a2b96,null))[_0xf0b2('0x3f')](handleError(_0x5a2b96,null));};exports[_0xf0b2('0x43')]=function(_0x4d84d3,_0x428fb7){return db[_0xf0b2('0x26')][_0xf0b2('0x43')](_0x4d84d3['body'],{})['then'](respondWithResult(_0x428fb7,0xc9))[_0xf0b2('0x3f')](handleError(_0x428fb7,null));};exports[_0xf0b2('0x44')]=function(_0x36aeaf,_0x5c059d){if(_0x36aeaf[_0xf0b2('0x45')]['id']){delete _0x36aeaf['body']['id'];}return db[_0xf0b2('0x26')]['find']({'where':{'id':_0x36aeaf[_0xf0b2('0x40')]['id']}})[_0xf0b2('0x1f')](handleEntityNotFound(_0x5c059d,null))[_0xf0b2('0x1f')](saveUpdates(_0x36aeaf[_0xf0b2('0x45')],null))[_0xf0b2('0x1f')](respondWithResult(_0x5c059d,null))[_0xf0b2('0x3f')](handleError(_0x5c059d,null));};exports[_0xf0b2('0x20')]=function(_0x26236b,_0x1dfd5e){return db[_0xf0b2('0x26')]['find']({'where':{'id':_0x26236b['params']['id']}})[_0xf0b2('0x1f')](handleEntityNotFound(_0x1dfd5e,null))['then'](removeEntity(_0x1dfd5e,null))[_0xf0b2('0x3f')](handleError(_0x1dfd5e,null));};exports[_0xf0b2('0x46')]=function(_0x4f526b,_0x5066c3){return db[_0xf0b2('0x26')]['describe']()[_0xf0b2('0x1f')](respondWithResult(_0x5066c3,null))['catch'](handleError(_0x5066c3,null));}; \ No newline at end of file +var _0xeef8=['update','then','error','stack','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','name','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','length','body','destroy','find','rimraf','zip-dir','fast-json-patch','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xeef8,0x197));var _0x8eef=function(_0x4e3e9a,_0x37f9fd){_0x4e3e9a=_0x4e3e9a-0x0;var _0x980496=_0xeef8[_0x4e3e9a];return _0x980496;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8eef('0x0'));var zipdir=require(_0x8eef('0x1'));var jsonpatch=require(_0x8eef('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8eef('0x3'));var util=require(_0x8eef('0x4'));var path=require(_0x8eef('0x5'));var sox=require(_0x8eef('0x6'));var csv=require(_0x8eef('0x7'));var ejs=require(_0x8eef('0x8'));var fs=require('fs');var fs_extra=require(_0x8eef('0x9'));var _=require(_0x8eef('0xa'));var squel=require(_0x8eef('0xb'));var crypto=require(_0x8eef('0xc'));var jsforce=require(_0x8eef('0xd'));var deskjs=require(_0x8eef('0xe'));var toCsv=require(_0x8eef('0x7'));var querystring=require(_0x8eef('0xf'));var Papa=require(_0x8eef('0x10'));var Redis=require(_0x8eef('0x11'));var authService=require(_0x8eef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eef('0x13'));var logger=require(_0x8eef('0x14'))('api');var utils=require(_0x8eef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8eef('0x16'));var db=require(_0x8eef('0x17'))['db'];function respondWithStatusCode(_0x523e87,_0x55a0a3){_0x55a0a3=_0x55a0a3||0xcc;return function(_0x28a4c9){if(_0x28a4c9){return _0x523e87[_0x8eef('0x18')](_0x55a0a3);}return _0x523e87[_0x8eef('0x19')](_0x55a0a3)[_0x8eef('0x1a')]();};}function respondWithResult(_0x898bd,_0x4f27f9){_0x4f27f9=_0x4f27f9||0xc8;return function(_0x435194){if(_0x435194){return _0x898bd[_0x8eef('0x19')](_0x4f27f9)[_0x8eef('0x1b')](_0x435194);}};}function respondWithFilteredResult(_0x3b7e02,_0x5d7bbb){return function(_0x1846c){if(_0x1846c){var _0x51e789=typeof _0x5d7bbb[_0x8eef('0x1c')]===_0x8eef('0x1d')&&typeof _0x5d7bbb['limit']===_0x8eef('0x1d');var _0x489bdb=_0x1846c['count'];var _0x5d9188=_0x51e789?0x0:_0x5d7bbb[_0x8eef('0x1c')];var _0x330e5f=_0x51e789?_0x1846c[_0x8eef('0x1e')]:_0x5d7bbb[_0x8eef('0x1c')]+_0x5d7bbb[_0x8eef('0x1f')];var _0x48537a;if(_0x330e5f>=_0x489bdb){_0x330e5f=_0x489bdb;_0x48537a=0xc8;}else{_0x48537a=0xce;}_0x3b7e02[_0x8eef('0x19')](_0x48537a);return _0x3b7e02[_0x8eef('0x20')](_0x8eef('0x21'),_0x5d9188+'-'+_0x330e5f+'/'+_0x489bdb)['json'](_0x1846c);}return null;};}function patchUpdates(_0x14a043){return function(_0x3eca18){try{jsonpatch[_0x8eef('0x22')](_0x3eca18,_0x14a043,!![]);}catch(_0x10ee5d){return BPromise[_0x8eef('0x23')](_0x10ee5d);}return _0x3eca18[_0x8eef('0x24')]();};}function saveUpdates(_0x1ef739,_0x2d31ba){return function(_0x534f9c){if(_0x534f9c){return _0x534f9c[_0x8eef('0x25')](_0x1ef739)['then'](function(_0x4cc9bc){return _0x4cc9bc;});}return null;};}function removeEntity(_0xf3fd6a,_0x4a0f4f){return function(_0x1dca68){if(_0x1dca68){return _0x1dca68['destroy']()[_0x8eef('0x26')](function(){_0xf3fd6a[_0x8eef('0x19')](0xcc)[_0x8eef('0x1a')]();});}};}function handleEntityNotFound(_0x4dd541,_0x4a9c7f){return function(_0x347d23){if(!_0x347d23){_0x4dd541[_0x8eef('0x18')](0x194);}return _0x347d23;};}function handleError(_0x493d28,_0x46be8e){_0x46be8e=_0x46be8e||0x1f4;return function(_0x31b2a5){logger[_0x8eef('0x27')](_0x31b2a5[_0x8eef('0x28')]);if(_0x31b2a5['name']){delete _0x31b2a5['name'];}_0x493d28['status'](_0x46be8e)['send'](_0x31b2a5);};}exports[_0x8eef('0x29')]=function(_0x2aa7e1,_0x3b323d){var _0x14d283={},_0x5daeec={},_0x4b5efa={'count':0x0,'rows':[]};var _0x401e73=_[_0x8eef('0x2a')](db[_0x8eef('0x2b')][_0x8eef('0x2c')],function(_0x19fd38){return{'name':_0x19fd38[_0x8eef('0x2d')],'type':_0x19fd38['type'][_0x8eef('0x2e')]};});_0x5daeec[_0x8eef('0x2f')]=_[_0x8eef('0x2a')](_0x401e73,_0x8eef('0x30'));_0x5daeec['query']=_[_0x8eef('0x31')](_0x2aa7e1['query']);_0x5daeec[_0x8eef('0x32')]=_[_0x8eef('0x33')](_0x5daeec[_0x8eef('0x2f')],_0x5daeec['query']);_0x14d283[_0x8eef('0x34')]=_[_0x8eef('0x33')](_0x5daeec[_0x8eef('0x2f')],qs[_0x8eef('0x35')](_0x2aa7e1[_0x8eef('0x36')]['fields']));_0x14d283[_0x8eef('0x34')]=_0x14d283['attributes']['length']?_0x14d283['attributes']:_0x5daeec[_0x8eef('0x2f')];if(!_0x2aa7e1[_0x8eef('0x36')][_0x8eef('0x37')](_0x8eef('0x38'))){_0x14d283[_0x8eef('0x1f')]=qs[_0x8eef('0x1f')](_0x2aa7e1['query'][_0x8eef('0x1f')]);_0x14d283[_0x8eef('0x1c')]=qs[_0x8eef('0x1c')](_0x2aa7e1[_0x8eef('0x36')]['offset']);}_0x14d283['order']=qs[_0x8eef('0x39')](_0x2aa7e1[_0x8eef('0x36')][_0x8eef('0x39')]);_0x14d283[_0x8eef('0x3a')]=qs[_0x8eef('0x32')](_[_0x8eef('0x3b')](_0x2aa7e1[_0x8eef('0x36')],_0x5daeec[_0x8eef('0x32')]),_0x401e73);if(_0x2aa7e1[_0x8eef('0x36')][_0x8eef('0x3c')]){_0x14d283['where']=_[_0x8eef('0x3d')](_0x14d283[_0x8eef('0x3a')],{'$or':_['map'](_0x401e73,function(_0x227e89){if(_0x227e89[_0x8eef('0x3e')]!==_0x8eef('0x3f')){var _0x53497d={};_0x53497d[_0x227e89[_0x8eef('0x30')]]={'$like':'%'+_0x2aa7e1[_0x8eef('0x36')]['filter']+'%'};return _0x53497d;}})});}_0x14d283=_[_0x8eef('0x3d')]({},_0x14d283,_0x2aa7e1[_0x8eef('0x40')]);var _0x47758d={'where':_0x14d283[_0x8eef('0x3a')]};return db[_0x8eef('0x2b')]['count'](_0x47758d)['then'](function(_0x511ad0){_0x4b5efa[_0x8eef('0x1e')]=_0x511ad0;if(_0x2aa7e1[_0x8eef('0x36')]['includeAll']){_0x14d283[_0x8eef('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x14d283);})[_0x8eef('0x26')](function(_0x48a874){_0x4b5efa[_0x8eef('0x42')]=_0x48a874;return _0x4b5efa;})[_0x8eef('0x26')](respondWithFilteredResult(_0x3b323d,_0x14d283))[_0x8eef('0x43')](handleError(_0x3b323d,null));};exports[_0x8eef('0x44')]=function(_0x2ea734,_0x2ceb5c){var _0x312ec9={'raw':!![],'where':{'id':_0x2ea734[_0x8eef('0x45')]['id']}},_0x3b1290={};_0x3b1290[_0x8eef('0x2f')]=_[_0x8eef('0x31')](db[_0x8eef('0x2b')]['rawAttributes']);_0x3b1290[_0x8eef('0x36')]=_[_0x8eef('0x31')](_0x2ea734[_0x8eef('0x36')]);_0x3b1290['filters']=_[_0x8eef('0x33')](_0x3b1290[_0x8eef('0x2f')],_0x3b1290[_0x8eef('0x36')]);_0x312ec9[_0x8eef('0x34')]=_[_0x8eef('0x33')](_0x3b1290[_0x8eef('0x2f')],qs['fields'](_0x2ea734['query'][_0x8eef('0x35')]));_0x312ec9[_0x8eef('0x34')]=_0x312ec9[_0x8eef('0x34')][_0x8eef('0x46')]?_0x312ec9[_0x8eef('0x34')]:_0x3b1290['model'];if(_0x2ea734[_0x8eef('0x36')]['includeAll']){_0x312ec9[_0x8eef('0x41')]=[{'all':!![]}];}_0x312ec9=_[_0x8eef('0x3d')]({},_0x312ec9,_0x2ea734['options']);return db[_0x8eef('0x2b')]['find'](_0x312ec9)[_0x8eef('0x26')](handleEntityNotFound(_0x2ceb5c,null))[_0x8eef('0x26')](respondWithResult(_0x2ceb5c,null))['catch'](handleError(_0x2ceb5c,null));};exports['create']=function(_0x533568,_0x5bae6a){return db[_0x8eef('0x2b')]['create'](_0x533568[_0x8eef('0x47')],{})[_0x8eef('0x26')](respondWithResult(_0x5bae6a,0xc9))[_0x8eef('0x43')](handleError(_0x5bae6a,null));};exports['update']=function(_0x20ecb7,_0x4fbcf4){if(_0x20ecb7[_0x8eef('0x47')]['id']){delete _0x20ecb7[_0x8eef('0x47')]['id'];}return db[_0x8eef('0x2b')]['find']({'where':{'id':_0x20ecb7[_0x8eef('0x45')]['id']}})[_0x8eef('0x26')](handleEntityNotFound(_0x4fbcf4,null))[_0x8eef('0x26')](saveUpdates(_0x20ecb7['body'],null))[_0x8eef('0x26')](respondWithResult(_0x4fbcf4,null))[_0x8eef('0x43')](handleError(_0x4fbcf4,null));};exports[_0x8eef('0x48')]=function(_0x1d588a,_0x1bed4f){return db[_0x8eef('0x2b')][_0x8eef('0x49')]({'where':{'id':_0x1d588a[_0x8eef('0x45')]['id']}})[_0x8eef('0x26')](handleEntityNotFound(_0x1bed4f,null))['then'](removeEntity(_0x1bed4f,null))['catch'](handleError(_0x1bed4f,null));};exports['describe']=function(_0x1d7c0f,_0x3a6285){return db[_0x8eef('0x2b')]['describe']()[_0x8eef('0x26')](respondWithResult(_0x3a6285,null))[_0x8eef('0x43')](handleError(_0x3a6285,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 5baa073..3e0c3bc 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 _0xce8a=['../../config/environment','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x562d2e,_0x50fd0d){var _0x25169b=function(_0x1a916a){while(--_0x1a916a){_0x562d2e['push'](_0x562d2e['shift']());}};_0x25169b(++_0x50fd0d);}(_0xce8a,0x122));var _0xace8=function(_0xd9ed31,_0x2484b7){_0xd9ed31=_0xd9ed31-0x0;var _0x424171=_0xce8a[_0xd9ed31];return _0x424171;};'use strict';var _=require(_0xace8('0x0'));var util=require(_0xace8('0x1'));var logger=require('../../config/logger')(_0xace8('0x2'));var moment=require(_0xace8('0x3'));var BPromise=require(_0xace8('0x4'));var rp=require(_0xace8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xace8('0x6'));var config=require(_0xace8('0x7'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x4bb30d,_0x1340a7){return _0x4bb30d['define']('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xace8('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xefce=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x42b678,_0x38ee8b){var _0x102def=function(_0x567128){while(--_0x567128){_0x42b678['push'](_0x42b678['shift']());}};_0x102def(++_0x38ee8b);}(_0xefce,0x64));var _0xeefc=function(_0x15fc07,_0x41cc0c){_0x15fc07=_0x15fc07-0x0;var _0x3d2c0f=_0xefce[_0x15fc07];return _0x3d2c0f;};'use strict';var _=require(_0xeefc('0x0'));var util=require(_0xeefc('0x1'));var logger=require(_0xeefc('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeefc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeefc('0x4'));var rimraf=require(_0xeefc('0x5'));var config=require(_0xeefc('0x6'));var attributes=require(_0xeefc('0x7'));module[_0xeefc('0x8')]=function(_0x194fe4,_0x5a76db){return _0x194fe4[_0xeefc('0x9')](_0xeefc('0xa'),attributes,{'tableName':_0xeefc('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xeefc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 5b53931..acef95f 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 _0x55f9=['code','WhatsappTransferReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x55f9,0x1cf));var _0x955f=function(_0x2ac67c,_0x581c0f){_0x2ac67c=_0x2ac67c-0x0;var _0x3d6808=_0x55f9[_0x2ac67c];return _0x3d6808;};'use strict';var _=require(_0x955f('0x0'));var util=require(_0x955f('0x1'));var moment=require(_0x955f('0x2'));var BPromise=require(_0x955f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x955f('0x4'));var db=require(_0x955f('0x5'))['db'];var utils=require(_0x955f('0x6'));var logger=require(_0x955f('0x7'))(_0x955f('0x8'));var config=require(_0x955f('0x9'));var jayson=require(_0x955f('0xa'));var client=jayson[_0x955f('0xb')][_0x955f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fa8ed,_0x31643f,_0x439d66){return new BPromise(function(_0xc348ec,_0x3674d1){return client[_0x955f('0xd')](_0x3fa8ed,_0x439d66)[_0x955f('0xe')](function(_0x3e7f80){logger[_0x955f('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x31643f,_0x955f('0x10'));logger['debug'](_0x955f('0x11'),_0x31643f,_0x955f('0x10'),JSON[_0x955f('0x12')](_0x3e7f80));if(_0x3e7f80[_0x955f('0x13')]){if(_0x3e7f80[_0x955f('0x13')][_0x955f('0x14')]===0x1f4){logger[_0x955f('0x13')](_0x955f('0x15'),_0x31643f,_0x3e7f80[_0x955f('0x13')][_0x955f('0x16')]);return _0x3674d1(_0x3e7f80[_0x955f('0x13')][_0x955f('0x16')]);}logger[_0x955f('0x13')](_0x955f('0x15'),_0x31643f,_0x3e7f80[_0x955f('0x13')][_0x955f('0x16')]);return _0xc348ec(_0x3e7f80[_0x955f('0x13')][_0x955f('0x16')]);}else{logger[_0x955f('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x31643f,_0x955f('0x10'));_0xc348ec(_0x3e7f80['result'][_0x955f('0x16')]);}})['catch'](function(_0x28a762){logger['error'](_0x955f('0x15'),_0x31643f,_0x28a762);_0x3674d1(_0x28a762);});});} \ No newline at end of file +var _0x574e=['WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x381802,_0xa6a3b9){var _0xfbb554=function(_0x576f74){while(--_0x576f74){_0x381802['push'](_0x381802['shift']());}};_0xfbb554(++_0xa6a3b9);}(_0x574e,0x121));var _0xe574=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x574e[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe574('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe574('0x1'));var db=require(_0xe574('0x2'))['db'];var utils=require(_0xe574('0x3'));var logger=require(_0xe574('0x4'))(_0xe574('0x5'));var config=require(_0xe574('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe574('0x7')][_0xe574('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x549ac1,_0x3cd959,_0x62357f){return new BPromise(function(_0x38f6af,_0x48f2a1){return client['request'](_0x549ac1,_0x62357f)[_0xe574('0x9')](function(_0x109257){logger[_0xe574('0xa')](_0xe574('0xb'),_0x3cd959,'request\x20sent');logger['debug'](_0xe574('0xc'),_0x3cd959,_0xe574('0xd'),JSON[_0xe574('0xe')](_0x109257));if(_0x109257['error']){if(_0x109257['error'][_0xe574('0xf')]===0x1f4){logger[_0xe574('0x10')](_0xe574('0xb'),_0x3cd959,_0x109257[_0xe574('0x10')][_0xe574('0x11')]);return _0x48f2a1(_0x109257[_0xe574('0x10')][_0xe574('0x11')]);}logger[_0xe574('0x10')](_0xe574('0xb'),_0x3cd959,_0x109257['error'][_0xe574('0x11')]);return _0x38f6af(_0x109257[_0xe574('0x10')][_0xe574('0x11')]);}else{logger[_0xe574('0xa')](_0xe574('0xb'),_0x3cd959,_0xe574('0xd'));_0x38f6af(_0x109257[_0xe574('0x12')][_0xe574('0x11')]);}})[_0xe574('0x13')](function(_0x21e953){logger[_0xe574('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3cd959,_0x21e953);_0x48f2a1(_0x21e953);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 39c9d27..5e6593b 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1b4=['Offline\x20apps:','status','seedDB','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','start','info','Online\x20apps:','map','filter','online','name','join'];(function(_0x241e4,_0x10eb7a){var _0x4f0050=function(_0x4bc26b){while(--_0x4bc26b){_0x241e4['push'](_0x241e4['shift']());}};_0x4f0050(++_0x10eb7a);}(_0xd1b4,0x174));var _0x4d1b=function(_0x5a4815,_0x368f5d){_0x5a4815=_0x5a4815-0x0;var _0x5454be=_0xd1b4[_0x5a4815];return _0x5454be;};'use strict';var _=require(_0x4d1b('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0x4d1b('0x1'));var logger=require(_0x4d1b('0x2'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x4d1b('0x3'));var schedule=require(_0x4d1b('0x4'));var chat=require(_0x4d1b('0x5'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x4d1b('0x6'));function main(){return mysqldb['db'][_0x4d1b('0x7')][_0x4d1b('0x8')]()['then'](function(){return rpc['listen']();})[_0x4d1b('0x9')](function(_0x1609a9){logger['info'](_0x1609a9);return chat['start']();})[_0x4d1b('0x9')](function(){return whatsapp[_0x4d1b('0xa')]();})[_0x4d1b('0x9')](function(){return schedule[_0x4d1b('0xa')]();})[_0x4d1b('0x9')](function(){return transcribe[_0x4d1b('0xa')]();})[_0x4d1b('0x9')](function(_0x5daf2e){logger[_0x4d1b('0xb')](_0x5daf2e);return pm2[_0x4d1b('0xa')](pm2Config);})[_0x4d1b('0x9')](function(_0x491260){logger['info'](_0x4d1b('0xc'),_[_0x4d1b('0xd')](_[_0x4d1b('0xe')](_0x491260,{'status':_0x4d1b('0xf')}),_0x4d1b('0x10'))[_0x4d1b('0x11')]());logger['info'](_0x4d1b('0x12'),_['map'](_[_0x4d1b('0xe')](_0x491260,function(_0x5a7151){return _0x5a7151[_0x4d1b('0x13')]!==_0x4d1b('0xf');}),_0x4d1b('0x10'))[_0x4d1b('0x11')]()||'None');config[_0x4d1b('0x14')]&&require(_0x4d1b('0x15'))[_0x4d1b('0x16')]();require(_0x4d1b('0x17'))[_0x4d1b('0x16')]();})[_0x4d1b('0x18')](function(_0x40772c){logger['error'](_0x4d1b('0x19'),_0x40772c);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x8150=['online','Offline\x20apps:','name','join','seedDB','./config/seedDB','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','map','filter'];(function(_0x28444a,_0x4287ea){var _0x4797f4=function(_0x53b3af){while(--_0x53b3af){_0x28444a['push'](_0x28444a['shift']());}};_0x4797f4(++_0x4287ea);}(_0x8150,0xb8));var _0x0815=function(_0x4d9202,_0x4d804e){_0x4d9202=_0x4d9202-0x0;var _0x21ae74=_0x8150[_0x4d9202];return _0x21ae74;};'use strict';var _=require(_0x0815('0x0'));var mysqldb=require(_0x0815('0x1'));var rpc=require(_0x0815('0x2'));var config=require(_0x0815('0x3'));var logger=require(_0x0815('0x4'))(_0x0815('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x0815('0x6'));var schedule=require(_0x0815('0x7'));var chat=require(_0x0815('0x8'));var whatsapp=require(_0x0815('0x9'));var transcribe=require(_0x0815('0xa'));function main(){return mysqldb['db'][_0x0815('0xb')][_0x0815('0xc')]()[_0x0815('0xd')](function(){return rpc[_0x0815('0xe')]();})['then'](function(_0x5d6b22){logger[_0x0815('0xf')](_0x5d6b22);return chat['start']();})[_0x0815('0xd')](function(){return whatsapp[_0x0815('0x10')]();})[_0x0815('0xd')](function(){return schedule['start']();})[_0x0815('0xd')](function(){return transcribe[_0x0815('0x10')]();})[_0x0815('0xd')](function(_0x23f1fd){logger[_0x0815('0xf')](_0x23f1fd);return pm2['start'](pm2Config);})[_0x0815('0xd')](function(_0x1bb628){logger[_0x0815('0xf')]('Online\x20apps:',_[_0x0815('0x11')](_[_0x0815('0x12')](_0x1bb628,{'status':_0x0815('0x13')}),'name')['join']());logger[_0x0815('0xf')](_0x0815('0x14'),_[_0x0815('0x11')](_['filter'](_0x1bb628,function(_0x261f29){return _0x261f29['status']!==_0x0815('0x13');}),_0x0815('0x15'))[_0x0815('0x16')]()||'None');config[_0x0815('0x17')]&&require(_0x0815('0x18'))[_0x0815('0x19')]();require('./config/license')[_0x0815('0x19')]();})[_0x0815('0x1a')](function(_0x5eaffa){logger['error'](_0x0815('0x1b'),_0x5eaffa);process[_0x0815('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a3d9de0..3c48cd0 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 _0x78ad=['authorization','startsWith','Basic','User','find','name','then','authenticate','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','setTokenCookie','role','cookie','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','join','promisify','secret','secrets','payload','options','verify','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','basic-auth','moment','session','fullname','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','status','unmanaged','Forbidden.','catch','headers'];(function(_0x3e131c,_0x4d3996){var _0x54e230=function(_0x4b820f){while(--_0x4b820f){_0x3e131c['push'](_0x3e131c['shift']());}};_0x54e230(++_0x4d3996);}(_0x78ad,0x136));var _0xd78a=function(_0x564de3,_0x58039b){_0x564de3=_0x564de3-0x0;var _0x10e9e9=_0x78ad[_0x564de3];return _0x10e9e9;};'use strict';var db=require(_0xd78a('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xd78a('0x1'));var encryptor=require(_0xd78a('0x2'));var _=require('lodash');var jwt=require(_0xd78a('0x3'));var expressJwt=require(_0xd78a('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0xd78a('0x5'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require('util');var moment=require(_0xd78a('0x6'));var validateJwt=expressJwt({'secret':config['secrets'][_0xd78a('0x7')]});var userAttributes=['id','role',_0xd78a('0x8'),'name',_0xd78a('0x9'),_0xd78a('0xa'),'userpic',_0xd78a('0xb'),_0xd78a('0xc'),_0xd78a('0xd'),_0xd78a('0xe'),_0xd78a('0xf'),'faxPause',_0xd78a('0x10'),_0xd78a('0x11'),_0xd78a('0x12'),_0xd78a('0x13'),'lastLoginAt',_0xd78a('0x14'),'crudPermissions','allowmessenger',_0xd78a('0x15'),_0xd78a('0x16'),_0xd78a('0x17'),_0xd78a('0x18'),_0xd78a('0x19'),_0xd78a('0x1a'),_0xd78a('0x1b'),_0xd78a('0x1c'),_0xd78a('0x1d'),'phoneBarPrefixRequired',_0xd78a('0x1e'),_0xd78a('0x1f'),'hotdesk',_0xd78a('0x20'),_0xd78a('0x21'),_0xd78a('0x22'),_0xd78a('0x23'),_0xd78a('0x24'),_0xd78a('0x25'),_0xd78a('0x26'),_0xd78a('0x27')];exports[_0xd78a('0x28')]=function(){return this[_0xd78a('0x29')](!![])[_0xd78a('0x2a')](function(_0x4c0e68,_0x3fdd99,_0x345c90){if(_0x4c0e68[_0xd78a('0x2b')]){_0x345c90();}else{return db[_0xd78a('0x2c')]['findOne']({'where':{'id':_0x4c0e68[_0xd78a('0x2d')]['id']},'attributes':['id',_0xd78a('0x2e'),_0xd78a('0x2f')],'raw':!![]})['then'](function(_0x52e379){if(_0x52e379&&_0x52e379['closed']){return _0x3fdd99[_0xd78a('0x30')](_0x52e379['disposition']===_0xd78a('0x31')?0x195:0x193)['json']({'message':_0x52e379[_0xd78a('0x2f')]===_0xd78a('0x31')?'Unmanaged.':_0xd78a('0x32')});}else{_0x345c90();}})[_0xd78a('0x33')](function(_0x9f02e4){_0x345c90(_0x9f02e4);});}});};exports[_0xd78a('0x29')]=function isAuthenticated(_0x43d97c){return compose()[_0xd78a('0x2a')](function(_0x217f9d,_0x14a719,_0x3ad7c6){var _0xd7f3b2;if(_0x217f9d[_0xd78a('0x34')][_0xd78a('0x35')]){if(_[_0xd78a('0x36')](_0x217f9d['headers'][_0xd78a('0x35')],_0xd78a('0x37'))){var _0x3e2466=basicAuth(_0x217f9d);db[_0xd78a('0x38')][_0xd78a('0x39')]({'where':{'name':_0x3e2466[_0xd78a('0x3a')]}})[_0xd78a('0x3b')](function(_0xb7f5a6){if(!_0xb7f5a6||!_0xb7f5a6[_0xd78a('0x3c')](_0x3e2466['pass'])){return _0x14a719[_0xd78a('0x30')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x217f9d['user']={'id':_0xb7f5a6['id']};_0x3ad7c6();})['catch'](function(_0x13b9ed){_0x3ad7c6(_0x13b9ed);});}else if(_[_0xd78a('0x36')](_0x217f9d['headers']['authorization'],_0xd78a('0x3d'))){validateJwt(_0x217f9d,_0x14a719,_0x3ad7c6);}else{if(_0x43d97c){_0x3ad7c6();}else{return _0x14a719[_0xd78a('0x30')](0x193)[_0xd78a('0x3e')]({'message':_0xd78a('0x3f')});}}}else if(_0x217f9d[_0xd78a('0x40')]['apikey']){try{var _0x4b42fa={'audience':hardwareConf[_0xd78a('0x41')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x217f9d[_0xd78a('0x40')][_0xd78a('0x42')],_0x4b42fa)[_0xd78a('0x3b')](function(_0x456b87){return db[_0xd78a('0x38')][_0xd78a('0x39')]({'where':{'id':_0x456b87[_0xd78a('0x43')]}})[_0xd78a('0x3b')](function(_0x4457ed){_0xd7f3b2=_0x4457ed;return db[_0xd78a('0x44')][_0xd78a('0x45')]({'where':{'id':0x1},'attributes':[_0xd78a('0x46'),_0xd78a('0x47')],'raw':!![]});})['then'](function(_0x48a75f){if(!_0xd7f3b2||!_[_0xd78a('0x48')](_0xd7f3b2[_0xd78a('0x49')],_0x456b87['nonce'])){return _0x14a719[_0xd78a('0x30')](0x191)[_0xd78a('0x3e')]({'message':_0xd78a('0x4a')});}if(_0xd7f3b2[_0xd78a('0x4b')]){return _0x14a719['status'](0x191)[_0xd78a('0x3e')]({'message':_0xd78a('0x4c')});}if(_0xd7f3b2[_0xd78a('0x4d')]){if(_0x48a75f[_0xd78a('0x47')]>0x0){if(moment(_0xd7f3b2[_0xd78a('0x4e')])['add'](_0x48a75f[_0xd78a('0x47')],_0xd78a('0x4f'))>moment()){return _0x14a719[_0xd78a('0x30')](0x191)[_0xd78a('0x3e')]({'message':_0xd78a('0x4c')});}}else{return _0x14a719[_0xd78a('0x30')](0x191)[_0xd78a('0x3e')]({'message':_0xd78a('0x4c')});}}_0x217f9d[_0xd78a('0x2b')]={'id':_0xd7f3b2['id']};_0x3ad7c6();});})[_0xd78a('0x33')](function(){return _0x14a719[_0xd78a('0x30')](0x191)[_0xd78a('0x3e')]({'message':_0xd78a('0x4c')});});}catch(_0x522d6d){_0x3ad7c6(_0x522d6d);}}else if(_0x43d97c){_0x3ad7c6();}else{return _0x14a719[_0xd78a('0x30')](0x193)[_0xd78a('0x3e')]({'message':'Unknown\x20authorization\x20format'});}})[_0xd78a('0x2a')](function(_0x2834b1,_0x41c713,_0xa50b86){if(_0x2834b1[_0xd78a('0x2b')]){db[_0xd78a('0x38')]['find']({'where':{'id':_0x2834b1[_0xd78a('0x2b')]['id']},'attributes':userAttributes})[_0xd78a('0x3b')](function(_0x4da944){if(!_0x4da944){return _0x41c713[_0xd78a('0x30')](0x194)[_0xd78a('0x3e')]({'message':_0xd78a('0x50')});}_0x2834b1[_0xd78a('0x2b')]=_0x4da944;_0xa50b86();})[_0xd78a('0x33')](function(_0x48288d){_0xa50b86(_0x48288d);});}else if(_0x43d97c){_0xa50b86();}else{return _0x41c713['status'](0x194)[_0xd78a('0x3e')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xd78a('0x51')]=function canUpdate(){return compose()[_0xd78a('0x2a')](function(_0x12ae2d,_0x49c6dc,_0x175c28){return licenseUtil['getLicense']()[_0xd78a('0x3b')](function(_0x44f33c){if(_0x44f33c[_0xd78a('0x52')]){_0x175c28();}else{return _0x49c6dc[_0xd78a('0x30')](0x193)[_0xd78a('0x3e')]({'message':_0xd78a('0x53')});}})[_0xd78a('0x33')](function(_0xe1b728){_0x175c28(_0xe1b728);});});};exports['isMiddleware']=function(_0x474bed,_0x3315bd,_0x47446c){_0x474bed[_0xd78a('0x54')]=!![];return _0x47446c();};exports[_0xd78a('0x55')]=function signToken(_0x4bddae){return signJwt(_0x4bddae);};exports[_0xd78a('0x56')]=function(_0x1d1907,_0x522b99){if(!_0x1d1907[_0xd78a('0x2b')]){return _0x522b99[_0xd78a('0x30')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x40d8f4={'payload':{'id':_0x1d1907[_0xd78a('0x2b')]['id'],'role':_0x1d1907['user'][_0xd78a('0x57')]},'options':{'expiresIn':0x15180}};return signJwt(_0x40d8f4)[_0xd78a('0x3b')](function(_0x3cae16){_0x522b99[_0xd78a('0x58')]('motion.token',_0x3cae16);_0x522b99[_0xd78a('0x59')]('/dashboards/general');})['catch'](function(_0x2ce1a2){return _0x522b99[_0xd78a('0x30')](0x1f4)[_0xd78a('0x5a')](_0x2ce1a2);});};exports[_0xd78a('0x5b')]=function(_0x217c83){if(_[_0xd78a('0x5c')](_0x217c83['apiKeyNonce'])||_['isNil'](_0x217c83[_0xd78a('0x5d')])){return null;}else{return createJwt(_0x217c83);}};exports[_0xd78a('0x5e')]=function(_0x2755eb){_0x2755eb[_0xd78a('0x49')]=generateNonce();_0x2755eb[_0xd78a('0x5d')]=generateIssuedAt();return createJwt(_0x2755eb);};exports['regenerateApiKey']=function(_0x43d8c8,_0x20a53b){var _0x4ea398=_0x43d8c8[_0xd78a('0x40')][_0xd78a('0x42')];if(_0x4ea398){var _0x514bd6={'nonce':_0x20a53b[_0xd78a('0x49')],'iat':_0x20a53b[_0xd78a('0x5d')],'audience':hardwareConf[_0xd78a('0x41')](),'issuer':hardwareConf[_0xd78a('0x41')]()};return verifyJwt(_0x4ea398,_0x514bd6)[_0xd78a('0x3b')](function(){return generateApiKey(_0x20a53b);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x175ff1){var _0x59de2b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x59de2b[_0xd78a('0x5f')](_0x175ff1))throw new db[(_0xd78a('0x60'))][(_0xd78a('0x61'))](_0xd78a('0x62'));return;};exports[_0xd78a('0x63')]=function(_0x3df070,_0x1fdc76,_0x2b063e){var _0x565abc=encryptor[_0xd78a('0x64')](_0x1fdc76)[_0xd78a('0x65')](',');for(var _0xb0b86d=0x0;_0xb0b86d<_0x2b063e;_0xb0b86d++){if(!_0x565abc[_0xb0b86d])break;if(_0x3df070[_0xd78a('0x66')]()===_0x565abc[_0xb0b86d][_0xd78a('0x66')]()){var _0x31fe9f=util[_0xd78a('0x67')](_0xd78a('0x68'),_0x2b063e);if(_0x2b063e===0x1){_0x31fe9f=_0xd78a('0x69');}throw new db[(_0xd78a('0x60'))][(_0xd78a('0x61'))](_0x31fe9f);}}return;};exports[_0xd78a('0x6a')]=function(_0x3fddad,_0x3c895a){var _0x1c62e1=_0x3c895a?encryptor[_0xd78a('0x64')](_0x3c895a)[_0xd78a('0x65')](','):[];if(_0x1c62e1[_0xd78a('0x6b')]===0x5){_0x1c62e1[_0xd78a('0x6c')](-0x1,0x1);}_0x1c62e1['unshift'](_0x3fddad);return encryptor['encryptString'](_0x1c62e1[_0xd78a('0x6d')](','));};function signJwt(_0x1ba760){var _0x567bb4=BPromise[_0xd78a('0x6e')](jwt['sign'],{'context':jwt});var _0x107a8e=_0x1ba760[_0xd78a('0x6f')]||config[_0xd78a('0x70')][_0xd78a('0x7')];return new BPromise(function(_0x589da4,_0x1ef967){_0x567bb4(_0x1ba760[_0xd78a('0x71')],_0x107a8e,_0x1ba760[_0xd78a('0x72')])[_0xd78a('0x3b')](function(_0x53671b){_0x589da4(_0x53671b);})['catch'](function(_0x3aa60a){_0x1ef967(_0x3aa60a);});});}function verifyJwt(_0x1ab445,_0x2699dc,_0x5e7eff){var _0x1ec263=BPromise[_0xd78a('0x6e')](jwt[_0xd78a('0x73')],{'context':jwt});var _0x112bda=_0x5e7eff||config[_0xd78a('0x70')][_0xd78a('0x7')];return new BPromise(function(_0x2e4832,_0x296953){_0x1ec263(_0x1ab445,_0x112bda,_0x2699dc)[_0xd78a('0x3b')](function(_0x3f34df){_0x2e4832(_0x3f34df);})[_0xd78a('0x33')](function(_0x4ba260){_0x296953(_0x4ba260);});});}function generateNonce(){return crypto[_0xd78a('0x74')](0x10)[_0xd78a('0x75')](_0xd78a('0x76'));}function generateIssuedAt(){return Math[_0xd78a('0x77')](Date['now']()/0x3e8)[_0xd78a('0x75')]();}function createJwt(_0xe2bb0d){var _0x53c901={'payload':{'iat':_0xe2bb0d['apiKeyIat'],'nonce':_0xe2bb0d[_0xd78a('0x49')]},'options':{'algorithm':_0xd78a('0x78'),'subject':_0xe2bb0d['id'][_0xd78a('0x75')](),'issuer':hardwareConf[_0xd78a('0x41')](),'audience':hardwareConf[_0xd78a('0x41')]()}};return signJwt(_0x53c901)[_0xd78a('0x3b')](function(_0x4982c6){return{'iat':_0xe2bb0d['apiKeyIat'],'nonce':_0xe2bb0d[_0xd78a('0x49')],'token':_0x4982c6};});} \ No newline at end of file +var _0x0e4d=['util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','disposition','then','closed','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','startsWith','authorization','Basic','User','find','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','blocked','add','blockDuration','Invalid\x20API\x20access\x20key','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','sign','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird'];(function(_0x7450d2,_0x46afc8){var _0x5987aa=function(_0x5cd719){while(--_0x5cd719){_0x7450d2['push'](_0x7450d2['shift']());}};_0x5987aa(++_0x46afc8);}(_0x0e4d,0xf3));var _0xd0e4=function(_0x170289,_0x2fbdcd){_0x170289=_0x170289-0x0;var _0x1d2450=_0x0e4d[_0x170289];return _0x1d2450;};'use strict';var db=require(_0xd0e4('0x0'))['db'];var config=require(_0xd0e4('0x1'));var hardwareConf=require(_0xd0e4('0x2'));var licenseUtil=require(_0xd0e4('0x3'));var encryptor=require(_0xd0e4('0x4'));var _=require(_0xd0e4('0x5'));var jwt=require(_0xd0e4('0x6'));var expressJwt=require(_0xd0e4('0x7'));var compose=require(_0xd0e4('0x8'));var basicAuth=require(_0xd0e4('0x9'));var crypto=require('crypto');var BPromise=require(_0xd0e4('0xa'));var util=require(_0xd0e4('0xb'));var moment=require(_0xd0e4('0xc'));var validateJwt=expressJwt({'secret':config[_0xd0e4('0xd')][_0xd0e4('0xe')]});var userAttributes=['id','role',_0xd0e4('0xf'),_0xd0e4('0x10'),_0xd0e4('0x11'),_0xd0e4('0x12'),_0xd0e4('0x13'),_0xd0e4('0x14'),'md5secret',_0xd0e4('0x15'),_0xd0e4('0x16'),_0xd0e4('0x17'),_0xd0e4('0x18'),_0xd0e4('0x19'),_0xd0e4('0x1a'),_0xd0e4('0x1b'),_0xd0e4('0x1c'),_0xd0e4('0x1d'),_0xd0e4('0x1e'),'crudPermissions',_0xd0e4('0x1f'),_0xd0e4('0x20'),'alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0xd0e4('0x21'),_0xd0e4('0x22'),_0xd0e4('0x23'),_0xd0e4('0x24'),_0xd0e4('0x25'),_0xd0e4('0x26'),'phoneBarRemoteControl',_0xd0e4('0x27'),_0xd0e4('0x28'),_0xd0e4('0x29'),_0xd0e4('0x2a'),_0xd0e4('0x2b'),_0xd0e4('0x2c'),_0xd0e4('0x2d'),_0xd0e4('0x2e'),_0xd0e4('0x2f'),_0xd0e4('0x30')];exports[_0xd0e4('0x31')]=function(){return this[_0xd0e4('0x32')](!![])[_0xd0e4('0x33')](function(_0x339220,_0x365e80,_0x5dbef5){if(_0x339220[_0xd0e4('0x34')]){_0x5dbef5();}else{return db[_0xd0e4('0x35')][_0xd0e4('0x36')]({'where':{'id':_0x339220['params']['id']},'attributes':['id','closed',_0xd0e4('0x37')],'raw':!![]})[_0xd0e4('0x38')](function(_0x4aa5d3){if(_0x4aa5d3&&_0x4aa5d3[_0xd0e4('0x39')]){return _0x365e80[_0xd0e4('0x3a')](_0x4aa5d3[_0xd0e4('0x37')]===_0xd0e4('0x3b')?0x195:0x193)['json']({'message':_0x4aa5d3['disposition']==='unmanaged'?_0xd0e4('0x3c'):_0xd0e4('0x3d')});}else{_0x5dbef5();}})[_0xd0e4('0x3e')](function(_0x51b390){_0x5dbef5(_0x51b390);});}});};exports[_0xd0e4('0x32')]=function isAuthenticated(_0x49813e){return compose()[_0xd0e4('0x33')](function(_0x47707b,_0x47146b,_0x2c83a5){var _0x545fcf;if(_0x47707b[_0xd0e4('0x3f')]['authorization']){if(_[_0xd0e4('0x40')](_0x47707b[_0xd0e4('0x3f')][_0xd0e4('0x41')],_0xd0e4('0x42'))){var _0x4fa4fd=basicAuth(_0x47707b);db[_0xd0e4('0x43')][_0xd0e4('0x44')]({'where':{'name':_0x4fa4fd[_0xd0e4('0x10')]}})[_0xd0e4('0x38')](function(_0xdcfa7d){if(!_0xdcfa7d||!_0xdcfa7d['authenticate'](_0x4fa4fd['pass'])){return _0x47146b[_0xd0e4('0x3a')](0x191)[_0xd0e4('0x45')]({'message':'Wrong\x20credentials.'});}_0x47707b['user']={'id':_0xdcfa7d['id']};_0x2c83a5();})['catch'](function(_0x302217){_0x2c83a5(_0x302217);});}else if(_[_0xd0e4('0x40')](_0x47707b[_0xd0e4('0x3f')][_0xd0e4('0x41')],'Bearer')){validateJwt(_0x47707b,_0x47146b,_0x2c83a5);}else{if(_0x49813e){_0x2c83a5();}else{return _0x47146b[_0xd0e4('0x3a')](0x193)[_0xd0e4('0x45')]({'message':_0xd0e4('0x46')});}}}else if(_0x47707b[_0xd0e4('0x47')]['apikey']){try{var _0x596657={'audience':hardwareConf[_0xd0e4('0x48')](),'issuer':hardwareConf[_0xd0e4('0x48')]()};verifyJwt(_0x47707b['query'][_0xd0e4('0x49')],_0x596657)[_0xd0e4('0x38')](function(_0x4979cf){return db['User']['find']({'where':{'id':_0x4979cf[_0xd0e4('0x4a')]}})[_0xd0e4('0x38')](function(_0x1900c3){_0x545fcf=_0x1900c3;return db['Setting'][_0xd0e4('0x36')]({'where':{'id':0x1},'attributes':[_0xd0e4('0x4b'),'blockDuration'],'raw':!![]});})['then'](function(_0x3d571a){if(!_0x545fcf||!_[_0xd0e4('0x4c')](_0x545fcf[_0xd0e4('0x4d')],_0x4979cf[_0xd0e4('0x4e')])){return _0x47146b[_0xd0e4('0x3a')](0x191)[_0xd0e4('0x45')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x545fcf[_0xd0e4('0x4f')]){return _0x47146b[_0xd0e4('0x3a')](0x191)[_0xd0e4('0x45')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x545fcf[_0xd0e4('0x50')]){if(_0x3d571a['blockDuration']>0x0){if(moment(_0x545fcf['blockedAt'])[_0xd0e4('0x51')](_0x3d571a[_0xd0e4('0x52')],'minutes')>moment()){return _0x47146b[_0xd0e4('0x3a')](0x191)[_0xd0e4('0x45')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x47146b['status'](0x191)[_0xd0e4('0x45')]({'message':_0xd0e4('0x53')});}}_0x47707b[_0xd0e4('0x34')]={'id':_0x545fcf['id']};_0x2c83a5();});})['catch'](function(){return _0x47146b['status'](0x191)[_0xd0e4('0x45')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x2ad9ba){_0x2c83a5(_0x2ad9ba);}}else if(_0x49813e){_0x2c83a5();}else{return _0x47146b['status'](0x193)[_0xd0e4('0x45')]({'message':_0xd0e4('0x46')});}})[_0xd0e4('0x33')](function(_0x1c37ea,_0x59e7c1,_0x4f67e8){if(_0x1c37ea['user']){db[_0xd0e4('0x43')][_0xd0e4('0x44')]({'where':{'id':_0x1c37ea[_0xd0e4('0x34')]['id']},'attributes':userAttributes})[_0xd0e4('0x38')](function(_0x330464){if(!_0x330464){return _0x59e7c1['status'](0x194)[_0xd0e4('0x45')]({'message':'User\x20not\x20found.'});}_0x1c37ea['user']=_0x330464;_0x4f67e8();})['catch'](function(_0x4e63a7){_0x4f67e8(_0x4e63a7);});}else if(_0x49813e){_0x4f67e8();}else{return _0x59e7c1[_0xd0e4('0x3a')](0x194)[_0xd0e4('0x45')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xd0e4('0x54')]=function canUpdate(){return compose()[_0xd0e4('0x33')](function(_0x5bd62a,_0x383bc0,_0x5446ea){return licenseUtil[_0xd0e4('0x55')]()['then'](function(_0x356ca5){if(_0x356ca5[_0xd0e4('0x56')]){_0x5446ea();}else{return _0x383bc0['status'](0x193)['json']({'message':_0xd0e4('0x57')});}})[_0xd0e4('0x3e')](function(_0x25156b){_0x5446ea(_0x25156b);});});};exports[_0xd0e4('0x58')]=function(_0x107e68,_0xd4e48,_0x22bf86){_0x107e68[_0xd0e4('0x58')]=!![];return _0x22bf86();};exports[_0xd0e4('0x59')]=function signToken(_0x23f169){return signJwt(_0x23f169);};exports['setTokenCookie']=function(_0x1e1a08,_0x26b715){if(!_0x1e1a08[_0xd0e4('0x34')]){return _0x26b715['status'](0x194)[_0xd0e4('0x45')]({'message':_0xd0e4('0x5a')});}var _0x129a36={'payload':{'id':_0x1e1a08[_0xd0e4('0x34')]['id'],'role':_0x1e1a08[_0xd0e4('0x34')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x129a36)[_0xd0e4('0x38')](function(_0x5dca9){_0x26b715[_0xd0e4('0x5b')](_0xd0e4('0x5c'),_0x5dca9);_0x26b715[_0xd0e4('0x5d')](_0xd0e4('0x5e'));})[_0xd0e4('0x3e')](function(_0x27d9da){return _0x26b715[_0xd0e4('0x3a')](0x1f4)[_0xd0e4('0x5f')](_0x27d9da);});};exports[_0xd0e4('0x60')]=function(_0x6f497){if(_[_0xd0e4('0x61')](_0x6f497['apiKeyNonce'])||_[_0xd0e4('0x61')](_0x6f497[_0xd0e4('0x62')])){return null;}else{return createJwt(_0x6f497);}};exports['generateApiKey']=function(_0x1235d4){_0x1235d4['apiKeyNonce']=generateNonce();_0x1235d4['apiKeyIat']=generateIssuedAt();return createJwt(_0x1235d4);};exports[_0xd0e4('0x63')]=function(_0x224a45,_0x530f34){var _0x3ed0bd=_0x224a45[_0xd0e4('0x47')][_0xd0e4('0x49')];if(_0x3ed0bd){var _0x26e32f={'nonce':_0x530f34[_0xd0e4('0x4d')],'iat':_0x530f34[_0xd0e4('0x62')],'audience':hardwareConf[_0xd0e4('0x48')](),'issuer':hardwareConf[_0xd0e4('0x48')]()};return verifyJwt(_0x3ed0bd,_0x26e32f)['then'](function(){return generateApiKey(_0x530f34);});}else{throw{'message':_0xd0e4('0x64')};}};exports[_0xd0e4('0x65')]=function(_0x3d387d){var _0x313429=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x313429[_0xd0e4('0x66')](_0x3d387d))throw new db[(_0xd0e4('0x67'))][(_0xd0e4('0x68'))]('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[_0xd0e4('0x69')]=function(_0x35bde7,_0x3d6024,_0xd1c70d){var _0x159fa3=encryptor[_0xd0e4('0x6a')](_0x3d6024)['split'](',');for(var _0x1e0935=0x0;_0x1e0935<_0xd1c70d;_0x1e0935++){if(!_0x159fa3[_0x1e0935])break;if(_0x35bde7[_0xd0e4('0x6b')]()===_0x159fa3[_0x1e0935][_0xd0e4('0x6b')]()){var _0x1de8c8=util[_0xd0e4('0x6c')](_0xd0e4('0x6d'),_0xd1c70d);if(_0xd1c70d===0x1){_0x1de8c8=_0xd0e4('0x6e');}throw new db[(_0xd0e4('0x67'))][(_0xd0e4('0x68'))](_0x1de8c8);}}return;};exports[_0xd0e4('0x6f')]=function(_0x79e5ae,_0x5c02aa){var _0x188a0f=_0x5c02aa?encryptor[_0xd0e4('0x6a')](_0x5c02aa)[_0xd0e4('0x70')](','):[];if(_0x188a0f[_0xd0e4('0x71')]===0x5){_0x188a0f[_0xd0e4('0x72')](-0x1,0x1);}_0x188a0f[_0xd0e4('0x73')](_0x79e5ae);return encryptor[_0xd0e4('0x74')](_0x188a0f[_0xd0e4('0x75')](','));};function signJwt(_0x73c3a0){var _0x138ea2=BPromise['promisify'](jwt[_0xd0e4('0x76')],{'context':jwt});var _0x2cd259=_0x73c3a0['secret']||config['secrets']['session'];return new BPromise(function(_0x80195d,_0x4c020e){_0x138ea2(_0x73c3a0['payload'],_0x2cd259,_0x73c3a0[_0xd0e4('0x77')])['then'](function(_0x7cd523){_0x80195d(_0x7cd523);})['catch'](function(_0x4cbed7){_0x4c020e(_0x4cbed7);});});}function verifyJwt(_0x25300e,_0x820a9e,_0x5af6db){var _0x5692c2=BPromise['promisify'](jwt[_0xd0e4('0x78')],{'context':jwt});var _0x172c50=_0x5af6db||config[_0xd0e4('0xd')][_0xd0e4('0xe')];return new BPromise(function(_0x204291,_0x3fd177){_0x5692c2(_0x25300e,_0x172c50,_0x820a9e)[_0xd0e4('0x38')](function(_0x1dbe82){_0x204291(_0x1dbe82);})[_0xd0e4('0x3e')](function(_0x38625b){_0x3fd177(_0x38625b);});});}function generateNonce(){return crypto[_0xd0e4('0x79')](0x10)[_0xd0e4('0x7a')](_0xd0e4('0x7b'));}function generateIssuedAt(){return Math[_0xd0e4('0x7c')](Date[_0xd0e4('0x7d')]()/0x3e8)[_0xd0e4('0x7a')]();}function createJwt(_0x509d95){var _0x250aa0={'payload':{'iat':_0x509d95['apiKeyIat'],'nonce':_0x509d95[_0xd0e4('0x4d')]},'options':{'algorithm':_0xd0e4('0x7e'),'subject':_0x509d95['id']['toString'](),'issuer':hardwareConf[_0xd0e4('0x48')](),'audience':hardwareConf[_0xd0e4('0x48')]()}};return signJwt(_0x250aa0)['then'](function(_0x14266a){return{'iat':_0x509d95['apiKeyIat'],'nonce':_0x509d95[_0xd0e4('0x4d')],'token':_0x14266a};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 3ea0153..aa8ef54 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 _0x7400=['lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','end','binary','write','close','unlink','decryptFile','createDecipher','data','final','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird'];(function(_0xdd598a,_0x2f4169){var _0x18c8d7=function(_0x52be9c){while(--_0x52be9c){_0xdd598a['push'](_0xdd598a['shift']());}};_0x18c8d7(++_0x2f4169);}(_0x7400,0x92));var _0x0740=function(_0x2f2cb9,_0x6e0d62){_0x2f2cb9=_0x2f2cb9-0x0;var _0x15c9c0=_0x7400[_0x2f2cb9];return _0x15c9c0;};'use strict';var crypto=require(_0x0740('0x0'));var fs=require('fs');var BPromise=require(_0x0740('0x1'));var _=require(_0x0740('0x2'));var config=require(_0x0740('0x3'));var logger=require(_0x0740('0x4'))(_0x0740('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0740('0x6')][_0x0740('0x7')],'algorithm':_0x0740('0x8')};const fileOptions={'algorithm':_0x0740('0x9')};if(config[_0x0740('0xa')]&&config[_0x0740('0xa')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0x0740('0xb')]);if(isSupported){fileOptions[_0x0740('0xb')]=config[_0x0740('0xa')][_0x0740('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x0740('0xc')](config[_0x0740('0xa')]['algorithm'],_0x0740('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x575491){return AES_SUPPORTED_RX[_0x0740('0xe')](_0x575491);}function getSupportedCiphers(){return crypto[_0x0740('0xf')]()[_0x0740('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x4edcdd){return getSupportedCiphers()['indexOf'](_0x4edcdd)>-0x1;}function combineOptions(_0x330e07){var _0x112984={};for(var _0x277307 in fileOptions){if(fileOptions[_0x0740('0x11')](_0x277307)){_0x112984[_0x277307]=fileOptions[_0x277307];}}if(_0x330e07){for(var _0x539b0f in _0x330e07){if(_0x330e07[_0x0740('0x11')](_0x539b0f)){_0x112984[_0x539b0f]=_0x330e07[_0x539b0f];}}}return _0x112984;}exports[_0x0740('0x12')]=function(_0x3133d6,_0xca5619,_0x4e16d7,_0x46f26a){return new BPromise(function(_0x3d4e45,_0x5aac6f){_0x46f26a=combineOptions(_0x46f26a);var _0xd9c785=new Buffer(_0x4e16d7);var _0x3d2b27=fs[_0x0740('0x13')](_0x3133d6);var _0x1ad101=fs[_0x0740('0x14')](_0xca5619);var _0x148f15=crypto['createCipher'](_0x46f26a['algorithm'],_0xd9c785);_0x3d2b27['on']('data',function(_0x59f306){var _0x5a6c5a=new Buffer(_0x148f15[_0x0740('0x15')](_0x59f306),'binary');_0x1ad101['write'](_0x5a6c5a);});_0x3d2b27['on'](_0x0740('0x16'),function(){try{var _0x1ceca2=new Buffer(_0x148f15['final'](_0x0740('0x17')),_0x0740('0x17'));_0x1ad101[_0x0740('0x18')](_0x1ceca2);_0x1ad101['end']();_0x1ad101['on'](_0x0740('0x19'),function(){return _0x3d4e45(_0xca5619);});}catch(_0xee54f8){fs[_0x0740('0x1a')](_0xca5619);return _0x5aac6f(_0xee54f8);}});});};exports[_0x0740('0x1b')]=function(_0x555eb6,_0x716f11,_0x5253e5,_0x2f26d0){return new BPromise(function(_0x4ae954,_0x38b552){_0x2f26d0=combineOptions(_0x2f26d0);var _0x3af9e3=new Buffer(_0x5253e5);var _0x4addf8=fs[_0x0740('0x13')](_0x555eb6);var _0x5d2479=fs['createWriteStream'](_0x716f11);var _0x51cbb7=crypto[_0x0740('0x1c')](_0x2f26d0[_0x0740('0xb')],_0x3af9e3);_0x4addf8['on'](_0x0740('0x1d'),function(_0x293e2d){var _0x53db48=new Buffer(_0x51cbb7[_0x0740('0x15')](_0x293e2d),'binary');_0x5d2479[_0x0740('0x18')](_0x53db48);});_0x4addf8['on']('end',function(){try{var _0xd54fe0=new Buffer(_0x51cbb7[_0x0740('0x1e')](_0x0740('0x17')),'binary');_0x5d2479[_0x0740('0x18')](_0xd54fe0);_0x5d2479['end']();_0x5d2479['on'](_0x0740('0x19'),function(){return _0x4ae954(_0x716f11);});}catch(_0x2995f1){fs['unlink'](_0x716f11);return _0x38b552(_0x2995f1);}});});};exports[_0x0740('0x1f')]=function(_0x1d91cb,_0x290a6c,_0x106a0d){var _0x5badbb=_0x106a0d||stringOptions['algorithm'];var _0xc312e=_0x290a6c||stringOptions[_0x0740('0x20')];var _0x26d7b8=crypto[_0x0740('0x21')](_0x5badbb,_0xc312e);var _0x336d50=_0x26d7b8['update'](_0x1d91cb,_0x0740('0x22'),_0x0740('0x23'));_0x336d50+=_0x26d7b8[_0x0740('0x1e')](_0x0740('0x23'));return _0x336d50;};exports[_0x0740('0x24')]=function(_0x179d7e,_0xbb6607,_0x4a220f){var _0x4bbd23=_0x4a220f||stringOptions[_0x0740('0xb')];var _0x28f2fd=_0xbb6607||stringOptions['secret'];var _0x3b35e8=crypto[_0x0740('0x1c')](_0x4bbd23,_0x28f2fd);var _0x8c1af4=_0x3b35e8[_0x0740('0x15')](_0x179d7e,_0x0740('0x23'),_0x0740('0x22'));_0x8c1af4+=_0x3b35e8[_0x0740('0x1e')]('utf8');return _0x8c1af4;}; \ No newline at end of file +var _0x8997=['decryptString','bluebird','lodash','../../config/environment','app','secrets','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','write','final','binary','end','close','createDecipher','unlink','secret','utf8','base64'];(function(_0xd66d0b,_0x36dfd2){var _0x585136=function(_0x1054ee){while(--_0x1054ee){_0xd66d0b['push'](_0xd66d0b['shift']());}};_0x585136(++_0x36dfd2);}(_0x8997,0xbb));var _0x7899=function(_0x33a0ab,_0x4b717b){_0x33a0ab=_0x33a0ab-0x0;var _0x5abd60=_0x8997[_0x33a0ab];return _0x5abd60;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x7899('0x0'));var _=require(_0x7899('0x1'));var config=require(_0x7899('0x2'));var logger=require('../../config/logger')(_0x7899('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7899('0x4')]['session'],'algorithm':_0x7899('0x5')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x7899('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x7899('0x6')][_0x7899('0x7')]);if(isSupported){fileOptions[_0x7899('0x7')]=config[_0x7899('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x7899('0x8')](config['encrypt'][_0x7899('0x7')],_0x7899('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x10f44a){return AES_SUPPORTED_RX[_0x7899('0xa')](_0x10f44a);}function getSupportedCiphers(){return crypto[_0x7899('0xb')]()[_0x7899('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x448e25){return getSupportedCiphers()['indexOf'](_0x448e25)>-0x1;}function combineOptions(_0x47abc1){var _0x38c26e={};for(var _0x19877a in fileOptions){if(fileOptions[_0x7899('0xd')](_0x19877a)){_0x38c26e[_0x19877a]=fileOptions[_0x19877a];}}if(_0x47abc1){for(var _0x2ecc6f in _0x47abc1){if(_0x47abc1[_0x7899('0xd')](_0x2ecc6f)){_0x38c26e[_0x2ecc6f]=_0x47abc1[_0x2ecc6f];}}}return _0x38c26e;}exports[_0x7899('0xe')]=function(_0x2c3c9c,_0x250672,_0x714f0e,_0x7853e8){return new BPromise(function(_0x3e447b,_0x399e1a){_0x7853e8=combineOptions(_0x7853e8);var _0x160d84=new Buffer(_0x714f0e);var _0x439efc=fs[_0x7899('0xf')](_0x2c3c9c);var _0x30ed7d=fs[_0x7899('0x10')](_0x250672);var _0x5a1eea=crypto[_0x7899('0x11')](_0x7853e8[_0x7899('0x7')],_0x160d84);_0x439efc['on'](_0x7899('0x12'),function(_0x5d270f){var _0x112758=new Buffer(_0x5a1eea[_0x7899('0x13')](_0x5d270f),'binary');_0x30ed7d[_0x7899('0x14')](_0x112758);});_0x439efc['on']('end',function(){try{var _0x2a67e6=new Buffer(_0x5a1eea[_0x7899('0x15')](_0x7899('0x16')),_0x7899('0x16'));_0x30ed7d[_0x7899('0x14')](_0x2a67e6);_0x30ed7d[_0x7899('0x17')]();_0x30ed7d['on'](_0x7899('0x18'),function(){return _0x3e447b(_0x250672);});}catch(_0x18042b){fs['unlink'](_0x250672);return _0x399e1a(_0x18042b);}});});};exports['decryptFile']=function(_0x4bb277,_0x20898b,_0x12262b,_0x3327d3){return new BPromise(function(_0x1bb7b7,_0x5860b8){_0x3327d3=combineOptions(_0x3327d3);var _0x31b107=new Buffer(_0x12262b);var _0x43c6f4=fs[_0x7899('0xf')](_0x4bb277);var _0x232691=fs[_0x7899('0x10')](_0x20898b);var _0x202f38=crypto[_0x7899('0x19')](_0x3327d3['algorithm'],_0x31b107);_0x43c6f4['on'](_0x7899('0x12'),function(_0x16b63e){var _0xad1f86=new Buffer(_0x202f38[_0x7899('0x13')](_0x16b63e),_0x7899('0x16'));_0x232691[_0x7899('0x14')](_0xad1f86);});_0x43c6f4['on'](_0x7899('0x17'),function(){try{var _0x8a989d=new Buffer(_0x202f38[_0x7899('0x15')](_0x7899('0x16')),_0x7899('0x16'));_0x232691[_0x7899('0x14')](_0x8a989d);_0x232691[_0x7899('0x17')]();_0x232691['on']('close',function(){return _0x1bb7b7(_0x20898b);});}catch(_0x10dc4f){fs[_0x7899('0x1a')](_0x20898b);return _0x5860b8(_0x10dc4f);}});});};exports['encryptString']=function(_0x5918e9,_0x3cbbe6,_0x2538a6){var _0xca3808=_0x2538a6||stringOptions[_0x7899('0x7')];var _0x322ca2=_0x3cbbe6||stringOptions[_0x7899('0x1b')];var _0x3157e0=crypto[_0x7899('0x11')](_0xca3808,_0x322ca2);var _0x120970=_0x3157e0['update'](_0x5918e9,_0x7899('0x1c'),_0x7899('0x1d'));_0x120970+=_0x3157e0[_0x7899('0x15')](_0x7899('0x1d'));return _0x120970;};exports[_0x7899('0x1e')]=function(_0x553f64,_0xd52db4,_0xa1b58c){var _0x5671f3=_0xa1b58c||stringOptions[_0x7899('0x7')];var _0x3c30e9=_0xd52db4||stringOptions['secret'];var _0x28fb42=crypto[_0x7899('0x19')](_0x5671f3,_0x3c30e9);var _0x5e7b7a=_0x28fb42[_0x7899('0x13')](_0x553f64,_0x7899('0x1d'),_0x7899('0x1c'));_0x5e7b7a+=_0x28fb42[_0x7899('0x15')](_0x7899('0x1c'));return _0x5e7b7a;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 8fa5b93..31d7c07 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 _0xb4e6=['QueryTypes','dirname','basename','.csv','length','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','CSV','inspect','Failed','finally','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0xb4e6[_0x3f4dd9];return _0x31c54a;};'use strict';var util=require(_0x6b4e('0x0'));var path=require('path');var _=require(_0x6b4e('0x1'));var csv=require(_0x6b4e('0x2'));var fs=require('fs');var BPromise=require(_0x6b4e('0x3'));var zipdir=require(_0x6b4e('0x4'));var rimraf=require(_0x6b4e('0x5'));var db=require(_0x6b4e('0x6'))['db'];var dbH=require(_0x6b4e('0x6'))['dbH'];var logger=require(_0x6b4e('0x7'))(_0x6b4e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x6b4e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6b4e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x570346,_0x4f00be){var _0x2311d9={'status':_0x570346};var _0x48c870={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f00be){_0x2311d9['savename']=_0x4f00be;}return db[_0x6b4e('0xa')][_0x6b4e('0xb')](_0x2311d9,_0x48c870);}function main(){var _0x1e3bf6=0x1388;var _0x39ed74;logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x6b4e('0xf')][_0x6b4e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6b4e('0x11')]})[_0x6b4e('0x12')](function(_0x432399){if(_0x432399){_0x39ed74=_0x432399;_0x1e3bf6=_0x39ed74[_0x6b4e('0x11')]||0x1388;}})[_0x6b4e('0x12')](function(){return dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util['format'](_0x6b4e('0x15'),QUERY),{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]});})['then'](function(_0x355f10){if(!_0x355f10[0x0][_0x6b4e('0x17')]){return analyticExtractedReport(_0x6b4e('0x18'));}var _0x42e265=[];var _0x28c3ba=0x0;var _0x135568=!![];if(_0x355f10&&_0x355f10['length']){var _0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6);if(_0x39ed74[_0x6b4e('0x19')]){for(;_0x135568;_0x28c3ba+=_0x1e3bf6,_0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6)){if(_0x5775f4==0x0||_0x5775f4==_0x355f10[0x0][_0x6b4e('0x17')]){_0x135568=![];}_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util[_0x6b4e('0xd')](_0x6b4e('0x1b'),QUERY,_0x1e3bf6,_0x28c3ba),{'type':dbH[_0x6b4e('0x13')][_0x6b4e('0x1c')]['SELECT']}));}}else{_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](QUERY,{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]}));}}var _0x507703=path[_0x6b4e('0x1d')](PATH);var _0x163dea=path[_0x6b4e('0x1e')](PATH,_0x6b4e('0x1f'));var _0xa06ccd=_0x39ed74[_0x6b4e('0x19')]&&_0x42e265[_0x6b4e('0x20')]>0x1;var _0x5c33be=[];if(!fs[_0x6b4e('0x21')](path['join'](_0x507703,_0x163dea))&&_0xa06ccd){fs[_0x6b4e('0x22')](path[_0x6b4e('0x23')](_0x507703,_0x163dea));}return BPromise[_0x6b4e('0x24')](_0x42e265,function(_0xdba4fe){_0x5c33be['push'](_0xdba4fe);})[_0x6b4e('0x12')](function(){for(var _0x3f72d7=0x0;_0x3f72d7<_0x5c33be['length'];_0x3f72d7+=0x1){var _0x32102f;var _0x381ff0=_0x5c33be[_0x3f72d7];if(_0xa06ccd){_0x32102f=path[_0x6b4e('0x23')](_0x507703,_0x163dea,util[_0x6b4e('0xd')]('%s%d.%s',_0x163dea,_0x3f72d7,_0x6b4e('0x25')));}else{_0x32102f=path[_0x6b4e('0x23')](_0x507703,util['format'](_0x6b4e('0x26'),_0x163dea,_0x6b4e('0x25')));}fs[_0x6b4e('0x27')](_0x32102f,csv(_0x381ff0));}})[_0x6b4e('0x12')](function(){if(_0xa06ccd){zipdir(path['join'](_0x507703,_0x163dea),{'saveTo':path[_0x6b4e('0x23')](_0x507703,util[_0x6b4e('0xd')]('%s.%s',_0x163dea,_0x6b4e('0x28')))},function(_0x3f9868,_0x37b636){});rimraf(path['join'](_0x507703,_0x163dea),function(){});}})['then'](function(){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x6b4e('0x2a'),_0xa06ccd?util[_0x6b4e('0xd')](_0x6b4e('0x26'),_0x163dea,_0xa06ccd?'zip':'csv'):null);});})[_0x6b4e('0x2b')](function(_0x4952ef){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6b4e('0x2c')),util[_0x6b4e('0x2d')](_0x4952ef,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6b4e('0x2e'));})[_0x6b4e('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xbb53=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','each','%s%d.%s','format','%s.%s','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','argv','AnalyticExtractedReport','update','info','CSV','Setting','split','then','sequelize','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbb53,0x121));var _0x3bb5=function(_0x34e461,_0x5c1242){_0x34e461=_0x34e461-0x0;var _0x513dfb=_0xbb53[_0x34e461];return _0x513dfb;};'use strict';var util=require(_0x3bb5('0x0'));var path=require(_0x3bb5('0x1'));var _=require(_0x3bb5('0x2'));var csv=require(_0x3bb5('0x3'));var fs=require('fs');var BPromise=require(_0x3bb5('0x4'));var zipdir=require(_0x3bb5('0x5'));var rimraf=require(_0x3bb5('0x6'));var db=require(_0x3bb5('0x7'))['db'];var dbH=require(_0x3bb5('0x7'))[_0x3bb5('0x8')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3bb5('0x9')][0x2]);var QUERY=process[_0x3bb5('0x9')][0x3];var PATH=process[_0x3bb5('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x157e04,_0x22f92f){var _0x480f9c={'status':_0x157e04};var _0x5a4ae3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x22f92f){_0x480f9c['savename']=_0x22f92f;}return db[_0x3bb5('0xa')][_0x3bb5('0xb')](_0x480f9c,_0x5a4ae3);}function main(){var _0x473c1d=0x1388;var _0x56d6e3;logger[_0x3bb5('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3bb5('0xd')));return db[_0x3bb5('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3bb5('0xf'),'splitSizeCsv']})[_0x3bb5('0x10')](function(_0x511bd8){if(_0x511bd8){_0x56d6e3=_0x511bd8;_0x473c1d=_0x56d6e3['splitSizeCsv']||0x1388;}})[_0x3bb5('0x10')](function(){return dbH[_0x3bb5('0x11')][_0x3bb5('0x12')](util['format'](_0x3bb5('0x13'),QUERY),{'type':dbH[_0x3bb5('0x11')]['QueryTypes'][_0x3bb5('0x14')]});})[_0x3bb5('0x10')](function(_0x5cec77){if(!_0x5cec77[0x0]['num']){return analyticExtractedReport('Empty');}var _0x42ef1b=[];var _0x4693d6=0x0;var _0x5245cc=!![];if(_0x5cec77&&_0x5cec77[_0x3bb5('0x15')]){var _0x476463=_0x5cec77[0x0][_0x3bb5('0x16')]%(_0x4693d6+_0x473c1d);if(_0x56d6e3[_0x3bb5('0xf')]){for(;_0x5245cc;_0x4693d6+=_0x473c1d,_0x476463=_0x5cec77[0x0]['num']%(_0x4693d6+_0x473c1d)){if(_0x476463==0x0||_0x476463==_0x5cec77[0x0][_0x3bb5('0x16')]){_0x5245cc=![];}_0x42ef1b[_0x3bb5('0x17')](dbH[_0x3bb5('0x11')]['query'](util['format'](_0x3bb5('0x18'),QUERY,_0x473c1d,_0x4693d6),{'type':dbH[_0x3bb5('0x11')][_0x3bb5('0x19')]['SELECT']}));}}else{_0x42ef1b[_0x3bb5('0x17')](dbH[_0x3bb5('0x11')][_0x3bb5('0x12')](QUERY,{'type':dbH[_0x3bb5('0x11')][_0x3bb5('0x19')][_0x3bb5('0x14')]}));}}var _0x504c29=path[_0x3bb5('0x1a')](PATH);var _0x3eae85=path[_0x3bb5('0x1b')](PATH,_0x3bb5('0x1c'));var _0x1a55e6=_0x56d6e3[_0x3bb5('0xf')]&&_0x42ef1b[_0x3bb5('0x15')]>0x1;var _0x58c10f=[];if(!fs[_0x3bb5('0x1d')](path[_0x3bb5('0x1e')](_0x504c29,_0x3eae85))&&_0x1a55e6){fs['mkdirSync'](path['join'](_0x504c29,_0x3eae85));}return BPromise[_0x3bb5('0x1f')](_0x42ef1b,function(_0x36cfda){_0x58c10f['push'](_0x36cfda);})['then'](function(){for(var _0x477d1f=0x0;_0x477d1f<_0x58c10f[_0x3bb5('0x15')];_0x477d1f+=0x1){var _0x2fc543;var _0xc1c149=_0x58c10f[_0x477d1f];if(_0x1a55e6){_0x2fc543=path['join'](_0x504c29,_0x3eae85,util['format'](_0x3bb5('0x20'),_0x3eae85,_0x477d1f,'csv'));}else{_0x2fc543=path[_0x3bb5('0x1e')](_0x504c29,util[_0x3bb5('0x21')](_0x3bb5('0x22'),_0x3eae85,'csv'));}fs['writeFileSync'](_0x2fc543,csv(_0xc1c149));}})[_0x3bb5('0x10')](function(){if(_0x1a55e6){zipdir(path[_0x3bb5('0x1e')](_0x504c29,_0x3eae85),{'saveTo':path[_0x3bb5('0x1e')](_0x504c29,util[_0x3bb5('0x21')](_0x3bb5('0x22'),_0x3eae85,_0x3bb5('0x23')))},function(_0x3ed2cc,_0x5ce225){});rimraf(path[_0x3bb5('0x1e')](_0x504c29,_0x3eae85),function(){});}})[_0x3bb5('0x10')](function(){logger[_0x3bb5('0xc')](util[_0x3bb5('0x21')](_0x3bb5('0x24'),EXTRACTED_REPORT_ID,_0x3bb5('0xd')));return analyticExtractedReport(_0x3bb5('0x25'),_0x1a55e6?util['format'](_0x3bb5('0x22'),_0x3eae85,_0x1a55e6?_0x3bb5('0x23'):'csv'):null);});})[_0x3bb5('0x26')](function(_0x1fa29d){logger[_0x3bb5('0xc')](util[_0x3bb5('0x21')](_0x3bb5('0x27'),EXTRACTED_REPORT_ID,'CSV'),util[_0x3bb5('0x28')](_0x1fa29d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3bb5('0x29'));})[_0x3bb5('0x2a')](function(){process[_0x3bb5('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 33ac997..a308679 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 _0x2ede=['CSV','Completed','%s.%s','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','end','createPdfFromHTML','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','argv','savename','update','map','tableHeader','toString','value','fill','length','auto','push','body','concat','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','num','dirname','basename','.pdf','join','pdf','Setting','find','then','split','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','mkdirSync','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ede,0xc6));var _0xe2ed=function(_0x504b81,_0x4b4572){_0x504b81=_0x504b81-0x0;var _0x4f64a0=_0x2ede[_0x504b81];return _0x4f64a0;};'use strict';var _=require(_0xe2ed('0x0'));var fs=require('fs');var util=require(_0xe2ed('0x1'));var path=require(_0xe2ed('0x2'));var moment=require(_0xe2ed('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xe2ed('0x4'));var zipdir=require(_0xe2ed('0x5'));var rimraf=require(_0xe2ed('0x6'));var JSDOM=require(_0xe2ed('0x7'))[_0xe2ed('0x8')];var window=new JSDOM('')[_0xe2ed('0x9')];var db=require('../../mysqldb')['db'];var dbH=require(_0xe2ed('0xa'))[_0xe2ed('0xb')];var logger=require(_0xe2ed('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe2ed('0xd')][0x2]);var QUERY=process[_0xe2ed('0xd')][0x3];var PATH=process[_0xe2ed('0xd')][0x4];var NAME=process[_0xe2ed('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xbb030f,_0x493666){var _0x3e3fce={'status':_0xbb030f};var _0x5697d3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x493666){_0x3e3fce[_0xe2ed('0xe')]=_0x493666;}return db['AnalyticExtractedReport'][_0xe2ed('0xf')](_0x3e3fce,_0x5697d3);}function getHeaders(_0x1d42f4){return _[_0xe2ed('0x10')](_0x1d42f4,function(_0x4daafb){return{'text':_0x4daafb,'style':_0xe2ed('0x11')};});}function getRows(_0x4c33e0,_0x30aa35){return _[_0xe2ed('0x10')](_0x30aa35,function(_0x56015b){return _(_0x56015b)['pick'](_0x4c33e0)[_0xe2ed('0x10')](function(_0x5bc120){return _0x5bc120?_[_0xe2ed('0x12')](_0x5bc120):'';})[_0xe2ed('0x13')]();});}function createTable(_0x1f2abd,_0x4de4b1){var _0x35c3df={'widths':_[_0xe2ed('0x14')](Array(_0x1f2abd[_0xe2ed('0x15')]),0x91),'heights':function(_0x42a183){return _0x42a183===0x0?_0xe2ed('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x30bc83=getHeaders(_0x1f2abd);_0x35c3df['body'][_0xe2ed('0x17')](_0x30bc83);var _0x4985f5=getRows(_0x1f2abd,_0x4de4b1);_0x35c3df[_0xe2ed('0x18')]=_0x35c3df[_0xe2ed('0x18')][_0xe2ed('0x19')](_0x4985f5);return _0x35c3df;}function createTables(_0x347f2c){var _0x1cbcdb=[];var _0x47cd8d=_[_0xe2ed('0x1a')](Object['keys'](_0x347f2c[0x0]),0x5);_0x47cd8d['forEach'](function(_0x45cf7c){_0x1cbcdb[_0xe2ed('0x17')](createTable(_0x45cf7c,_0x347f2c));});return _0x1cbcdb;}function getPDFDocDefinition(_0x2667a4){var _0x19918e=util[_0xe2ed('0x1b')](_0xe2ed('0x1c'),NAME,EXTRACTED_REPORT[_0xe2ed('0x1d')],moment(EXTRACTED_REPORT[_0xe2ed('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xe2ed('0x1f')])[_0xe2ed('0x1b')](FORMAT));var _0x58e081=[];for(var _0x5ed7aa=0x0;_0x5ed7aa<_0x2667a4[_0xe2ed('0x15')];_0x5ed7aa++){var _0x5dfe68=[];if(_0x5ed7aa===0x0){_0x5dfe68[_0xe2ed('0x17')]({'text':_0x19918e,'style':_0xe2ed('0x20')});}var _0x360117={'table':_0x2667a4[_0x5ed7aa]};if(_0x5ed7aa>0x0){_0x360117[_0xe2ed('0x21')]=_0xe2ed('0x22');_0x360117[_0xe2ed('0x23')]=[0x0,0x46,0x0,0x0];}_0x5dfe68[_0xe2ed('0x17')](_0x360117);_0x58e081[_0xe2ed('0x17')](_0x5dfe68);}return{'pageSize':'A4','pageOrientation':_0xe2ed('0x24'),'content':_0x58e081,'footer':function(_0x49b843,_0x17f8f9){return{'text':_0x49b843[_0xe2ed('0x12')]()+_0xe2ed('0x25')+_0x17f8f9,'style':_0xe2ed('0x26')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe2ed('0x27')},'footer':{'alignment':_0xe2ed('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x533e98){var _0x7686b9=0x1388;var _0x5e7f71;if(!_0x533e98[0x0][_0xe2ed('0x29')]){return analyticExtractedReport('Empty');}var _0xca8ccd=[];var _0x106ba4=0x0;var _0x2420b7=!![];var _0x41806a=path[_0xe2ed('0x2a')](PATH);var _0x10afda=path[_0xe2ed('0x2b')](PATH,_0xe2ed('0x2c'));var _0x439da6=path[_0xe2ed('0x2d')](_0x41806a,util['format']('%s.%s',_0x10afda,_0xe2ed('0x2e')));var _0x47cd93=![];return db[_0xe2ed('0x2f')][_0xe2ed('0x30')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0xe2ed('0x31')](function(_0x41a629){if(_0x41a629){_0x5e7f71=_0x41a629;_0x7686b9=_0x5e7f71['splitSizePdf']||0x3e8;}})['then'](function(){if(_0x533e98&&_0x533e98[_0xe2ed('0x15')]){var _0x5a4629=_0x533e98[0x0][_0xe2ed('0x29')]%(_0x106ba4+_0x7686b9);if(_0x5e7f71[_0xe2ed('0x32')]){for(;_0x2420b7;_0x106ba4+=_0x7686b9,_0x5a4629=_0x533e98[0x0][_0xe2ed('0x29')]%(_0x106ba4+_0x7686b9)){if(_0x5a4629==0x0||_0x5a4629==_0x533e98[0x0]['num']){_0x2420b7=![];}_0xca8ccd[_0xe2ed('0x17')](dbH[_0xe2ed('0x33')][_0xe2ed('0x34')](util['format'](_0xe2ed('0x35'),QUERY,_0x7686b9,_0x106ba4),{'type':dbH[_0xe2ed('0x33')][_0xe2ed('0x36')][_0xe2ed('0x37')]}));}}else{_0xca8ccd[_0xe2ed('0x17')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0xe2ed('0x36')][_0xe2ed('0x37')]}));}}_0x47cd93=_0x5e7f71['split']&&_0xca8ccd[_0xe2ed('0x15')]>0x1;if(!fs[_0xe2ed('0x38')](path['join'](_0x41806a,_0x10afda))&&_0x47cd93){fs[_0xe2ed('0x39')](path[_0xe2ed('0x2d')](_0x41806a,_0x10afda));}return Promise['all'](_0xca8ccd);})['then'](function(_0x598b7b){return createTables(_['flatten'](_0x598b7b));})[_0xe2ed('0x31')](function(_0x131a78){var _0xf39065=getPDFDocDefinition(_0x131a78);var _0xba6b44=getPDFPrinter();var _0x10e751=_0xba6b44['createPdfKitDocument'](_0xf39065);if(_0x47cd93)_0x439da6=path[_0xe2ed('0x2d')](_0x41806a,_0x10afda,util[_0xe2ed('0x1b')]('%s%d.%s',_0x10afda,index,_0xe2ed('0x2e')));return writePDFDocument(_0x10e751,_0x439da6);})[_0xe2ed('0x31')](function(){if(!_0x47cd93)return;zipdir(path[_0xe2ed('0x2d')](_0x41806a,_0x10afda),{'saveTo':path['join'](_0x41806a,util[_0xe2ed('0x1b')]('%s.%s',_0x10afda,'zip'))},function(_0x4405b9){if(_0x4405b9)throw _0x4405b9;return;});})[_0xe2ed('0x31')](function(){if(!_0x47cd93)return;rimraf(path['join'](_0x41806a,_0x10afda),function(){});})[_0xe2ed('0x31')](function(){logger[_0xe2ed('0x3a')](util[_0xe2ed('0x1b')](_0xe2ed('0x3b'),EXTRACTED_REPORT_ID,_0xe2ed('0x3c')));return analyticExtractedReport(_0xe2ed('0x3d'),_0x47cd93?util[_0xe2ed('0x1b')](_0xe2ed('0x3e'),_0x10afda,_0x47cd93?_0xe2ed('0x3f'):_0xe2ed('0x2e')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xe2ed('0x3a')](util[_0xe2ed('0x1b')](_0xe2ed('0x40'),EXTRACTED_REPORT_ID,_0xe2ed('0x41')));return db['AnalyticExtractedReport'][_0xe2ed('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5c7951){EXTRACTED_REPORT=_0x5c7951;return dbH[_0xe2ed('0x33')][_0xe2ed('0x34')](util['format'](_0xe2ed('0x43'),QUERY),{'type':dbH['sequelize'][_0xe2ed('0x36')][_0xe2ed('0x37')]});})[_0xe2ed('0x31')](extractReport)[_0xe2ed('0x44')](function(_0x4cffbc){logger[_0xe2ed('0x3a')](util['format'](_0xe2ed('0x45'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x4cffbc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe2ed('0x46'));})[_0xe2ed('0x47')](function(){process[_0xe2ed('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x321eea=new PdfPrinter({'Arial':{'normal':__dirname+_0xe2ed('0x49'),'bold':__dirname+_0xe2ed('0x4a'),'italics':__dirname+_0xe2ed('0x4b'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x321eea;}function getPDFDocDefinitionFromHTML(_0x4fda6b,_0x24f30b){var _0x4f5c39=util[_0xe2ed('0x1b')](_0xe2ed('0x4c'),_0x24f30b[_0xe2ed('0x4d')],_0x24f30b['interactionId']);var _0x254265=moment()['format'](_0xe2ed('0x4e'))[_0xe2ed('0x12')]();var _0x2766e4=htmlToPdfmake(_0x4fda6b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2766e4],'defaultStyle':{'font':_0xe2ed('0x4f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xe2ed('0x50'),'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':_0xe2ed('0x50')}},'header':function(){return[{'text':_0xe2ed('0x51'),'style':'header'}];},'footer':function(_0x3cef41,_0x34db44){return[{'text':util[_0xe2ed('0x1b')](_0xe2ed('0x52'),_0x4f5c39,_0x3cef41,_0x34db44,_0x254265),'style':'footer'}];}};}function writePDFDocument(_0x5eba68,_0x53f045){return new Promise(function(_0x51ba29,_0x4b9407){var _0x93940d=_0x5eba68['pipe'](fs['createWriteStream'](_0x53f045));_0x93940d['on'](_0xe2ed('0x53'),function(){_0x51ba29(_0xe2ed('0x53'));});_0x93940d['on']('error',function(_0x23cfc2){_0x4b9407(_0x23cfc2);});_0x5eba68[_0xe2ed('0x54')]();});}exports[_0xe2ed('0x55')]=function(_0x490a75,_0x753094){var _0x5a042f=getPDFPrinter();var _0x4fd9bb=getPDFDocDefinitionFromHTML(_0x490a75,_0x753094);var _0x242e20=_0x5a042f['createPdfKitDocument'](_0x4fd9bb);return writePDFDocument(_0x242e20,_0x753094[_0xe2ed('0x2')])[_0xe2ed('0x44')](function(_0x10272b){throw _0x10272b;});}; \ No newline at end of file +var _0x8e29=['Empty','dirname','basename','%s.%s','pdf','Setting','find','split','splitSizePdf','then','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','existsSync','join','mkdirSync','flatten','%s%d.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','channel','center','Interaction\x20Transcript','createWriteStream','finish','end','createPdfFromHTML','createPdfKitDocument','path','lodash','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','map','pick','toString','fill','length','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','num'];(function(_0x50d0a5,_0x3ece14){var _0x16a49c=function(_0x5857fb){while(--_0x5857fb){_0x50d0a5['push'](_0x50d0a5['shift']());}};_0x16a49c(++_0x3ece14);}(_0x8e29,0x1ca));var _0x98e2=function(_0x5d2b83,_0x3c54b8){_0x5d2b83=_0x5d2b83-0x0;var _0x34b99f=_0x8e29[_0x5d2b83];return _0x34b99f;};'use strict';var _=require(_0x98e2('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x98e2('0x1'));var htmlToPdfmake=require(_0x98e2('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x98e2('0x3'));var rimraf=require(_0x98e2('0x4'));var JSDOM=require(_0x98e2('0x5'))[_0x98e2('0x6')];var window=new JSDOM('')[_0x98e2('0x7')];var db=require(_0x98e2('0x8'))['db'];var dbH=require(_0x98e2('0x8'))[_0x98e2('0x9')];var logger=require('../../config/logger')(_0x98e2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x98e2('0xb')][0x2]);var QUERY=process[_0x98e2('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x98e2('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x153d60,_0x232a22){var _0x5a6909={'status':_0x153d60};var _0x39a6e8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x232a22){_0x5a6909[_0x98e2('0xc')]=_0x232a22;}return db[_0x98e2('0xd')][_0x98e2('0xe')](_0x5a6909,_0x39a6e8);}function getHeaders(_0x12a99b){return _[_0x98e2('0xf')](_0x12a99b,function(_0x4928a5){return{'text':_0x4928a5,'style':'tableHeader'};});}function getRows(_0x529193,_0x2e0def){return _[_0x98e2('0xf')](_0x2e0def,function(_0x1bfc3f){return _(_0x1bfc3f)[_0x98e2('0x10')](_0x529193)[_0x98e2('0xf')](function(_0x141025){return _0x141025?_[_0x98e2('0x11')](_0x141025):'';})['value']();});}function createTable(_0x5df68c,_0x3db46f){var _0x26e899={'widths':_[_0x98e2('0x12')](Array(_0x5df68c[_0x98e2('0x13')]),0x91),'heights':function(_0x56b793){return _0x56b793===0x0?_0x98e2('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1dbf1e=getHeaders(_0x5df68c);_0x26e899[_0x98e2('0x15')][_0x98e2('0x16')](_0x1dbf1e);var _0x527add=getRows(_0x5df68c,_0x3db46f);_0x26e899[_0x98e2('0x15')]=_0x26e899['body'][_0x98e2('0x17')](_0x527add);return _0x26e899;}function createTables(_0x11c115){var _0x29a8ed=[];var _0x2046b1=_[_0x98e2('0x18')](Object[_0x98e2('0x19')](_0x11c115[0x0]),0x5);_0x2046b1[_0x98e2('0x1a')](function(_0x355f39){_0x29a8ed[_0x98e2('0x16')](createTable(_0x355f39,_0x11c115));});return _0x29a8ed;}function getPDFDocDefinition(_0x3cd64e){var _0x3dbe9d=util['format'](_0x98e2('0x1b'),NAME,EXTRACTED_REPORT[_0x98e2('0x1c')],moment(EXTRACTED_REPORT[_0x98e2('0x1d')])[_0x98e2('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x98e2('0x1f')])[_0x98e2('0x1e')](FORMAT));var _0x2859ba=[];for(var _0x29cd5c=0x0;_0x29cd5c<_0x3cd64e[_0x98e2('0x13')];_0x29cd5c++){var _0x2066bf=[];if(_0x29cd5c===0x0){_0x2066bf[_0x98e2('0x16')]({'text':_0x3dbe9d,'style':_0x98e2('0x20')});}var _0x10dd5b={'table':_0x3cd64e[_0x29cd5c]};if(_0x29cd5c>0x0){_0x10dd5b[_0x98e2('0x21')]='before';_0x10dd5b[_0x98e2('0x22')]=[0x0,0x46,0x0,0x0];}_0x2066bf[_0x98e2('0x16')](_0x10dd5b);_0x2859ba[_0x98e2('0x16')](_0x2066bf);}return{'pageSize':'A4','pageOrientation':_0x98e2('0x23'),'content':_0x2859ba,'footer':function(_0x4dd830,_0x2f9699){return{'text':_0x4dd830[_0x98e2('0x11')]()+_0x98e2('0x24')+_0x2f9699,'style':_0x98e2('0x25')};},'defaultStyle':{'font':_0x98e2('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xa7389d){var _0x1938b4=0x1388;var _0x49a5ea;if(!_0xa7389d[0x0][_0x98e2('0x27')]){return analyticExtractedReport(_0x98e2('0x28'));}var _0x42d8b3=[];var _0x14f0e7=0x0;var _0x43f810=!![];var _0x433232=path[_0x98e2('0x29')](PATH);var _0x3ba76b=path[_0x98e2('0x2a')](PATH,'.pdf');var _0x33f7dd=path['join'](_0x433232,util[_0x98e2('0x1e')](_0x98e2('0x2b'),_0x3ba76b,_0x98e2('0x2c')));var _0x22587b=![];return db[_0x98e2('0x2d')][_0x98e2('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x98e2('0x2f'),_0x98e2('0x30')]})[_0x98e2('0x31')](function(_0x1418c6){if(_0x1418c6){_0x49a5ea=_0x1418c6;_0x1938b4=_0x49a5ea[_0x98e2('0x30')]||0x3e8;}})[_0x98e2('0x31')](function(){if(_0xa7389d&&_0xa7389d[_0x98e2('0x13')]){var _0x215548=_0xa7389d[0x0]['num']%(_0x14f0e7+_0x1938b4);if(_0x49a5ea['split']){for(;_0x43f810;_0x14f0e7+=_0x1938b4,_0x215548=_0xa7389d[0x0]['num']%(_0x14f0e7+_0x1938b4)){if(_0x215548==0x0||_0x215548==_0xa7389d[0x0]['num']){_0x43f810=![];}_0x42d8b3[_0x98e2('0x16')](dbH['sequelize'][_0x98e2('0x32')](util[_0x98e2('0x1e')](_0x98e2('0x33'),QUERY,_0x1938b4,_0x14f0e7),{'type':dbH[_0x98e2('0x34')][_0x98e2('0x35')][_0x98e2('0x36')]}));}}else{_0x42d8b3[_0x98e2('0x16')](dbH['sequelize'][_0x98e2('0x32')](QUERY,{'type':dbH[_0x98e2('0x34')][_0x98e2('0x35')]['SELECT']}));}}_0x22587b=_0x49a5ea[_0x98e2('0x2f')]&&_0x42d8b3[_0x98e2('0x13')]>0x1;if(!fs[_0x98e2('0x37')](path[_0x98e2('0x38')](_0x433232,_0x3ba76b))&&_0x22587b){fs[_0x98e2('0x39')](path[_0x98e2('0x38')](_0x433232,_0x3ba76b));}return Promise['all'](_0x42d8b3);})[_0x98e2('0x31')](function(_0x1cced9){return createTables(_[_0x98e2('0x3a')](_0x1cced9));})['then'](function(_0x284cce){var _0x22d76f=getPDFDocDefinition(_0x284cce);var _0x156836=getPDFPrinter();var _0x4de588=_0x156836['createPdfKitDocument'](_0x22d76f);if(_0x22587b)_0x33f7dd=path[_0x98e2('0x38')](_0x433232,_0x3ba76b,util[_0x98e2('0x1e')](_0x98e2('0x3b'),_0x3ba76b,index,'pdf'));return writePDFDocument(_0x4de588,_0x33f7dd);})[_0x98e2('0x31')](function(){if(!_0x22587b)return;zipdir(path['join'](_0x433232,_0x3ba76b),{'saveTo':path[_0x98e2('0x38')](_0x433232,util[_0x98e2('0x1e')](_0x98e2('0x2b'),_0x3ba76b,_0x98e2('0x3c')))},function(_0x8e2cd5){if(_0x8e2cd5)throw _0x8e2cd5;return;});})[_0x98e2('0x31')](function(){if(!_0x22587b)return;rimraf(path[_0x98e2('0x38')](_0x433232,_0x3ba76b),function(){});})[_0x98e2('0x31')](function(){logger[_0x98e2('0x3d')](util['format'](_0x98e2('0x3e'),EXTRACTED_REPORT_ID,_0x98e2('0x3f')));return analyticExtractedReport('Completed',_0x22587b?util[_0x98e2('0x1e')](_0x98e2('0x2b'),_0x3ba76b,_0x22587b?_0x98e2('0x3c'):_0x98e2('0x2c')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x98e2('0x3d')](util[_0x98e2('0x1e')](_0x98e2('0x40'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x98e2('0xd')][_0x98e2('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x98e2('0x31')](function(_0x5588c3){EXTRACTED_REPORT=_0x5588c3;return dbH[_0x98e2('0x34')][_0x98e2('0x32')](util[_0x98e2('0x1e')](_0x98e2('0x42'),QUERY),{'type':dbH[_0x98e2('0x34')]['QueryTypes']['SELECT']});})[_0x98e2('0x31')](extractReport)[_0x98e2('0x43')](function(_0x5e6245){logger[_0x98e2('0x3d')](util[_0x98e2('0x1e')](_0x98e2('0x44'),EXTRACTED_REPORT_ID,_0x98e2('0x45')),util[_0x98e2('0x46')](_0x5e6245,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x494d4e=new PdfPrinter({'Arial':{'normal':__dirname+_0x98e2('0x47'),'bold':__dirname+_0x98e2('0x48'),'italics':__dirname+_0x98e2('0x49'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x494d4e;}function getPDFDocDefinitionFromHTML(_0x4465dc,_0x1e3de6){var _0x6c2738=util['format']('%s\x20#%d',_0x1e3de6[_0x98e2('0x4a')],_0x1e3de6['interactionId']);var _0x33ba57=moment()[_0x98e2('0x1e')]('YYYY-MM-DD')['toString']();var _0x26f975=htmlToPdfmake(_0x4465dc,{'window':window,'tableAutoSize':!![]});return{'content':[_0x26f975],'defaultStyle':{'font':_0x98e2('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x98e2('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x98e2('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x98e2('0x4c'),'style':_0x98e2('0x20')}];},'footer':function(_0x21ca8f,_0x546ef8){return[{'text':util[_0x98e2('0x1e')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x6c2738,_0x21ca8f,_0x546ef8,_0x33ba57),'style':_0x98e2('0x25')}];}};}function writePDFDocument(_0x5edbc1,_0x1108ac){return new Promise(function(_0x5053a3,_0x441b1d){var _0x4305f5=_0x5edbc1['pipe'](fs[_0x98e2('0x4d')](_0x1108ac));_0x4305f5['on']('finish',function(){_0x5053a3(_0x98e2('0x4e'));});_0x4305f5['on']('error',function(_0x5f5a2a){_0x441b1d(_0x5f5a2a);});_0x5edbc1[_0x98e2('0x4f')]();});}exports[_0x98e2('0x50')]=function(_0x5e7239,_0x3f4a4a){var _0x154833=getPDFPrinter();var _0x147e69=getPDFDocDefinitionFromHTML(_0x5e7239,_0x3f4a4a);var _0x16c342=_0x154833[_0x98e2('0x51')](_0x147e69);return writePDFDocument(_0x16c342,_0x3f4a4a[_0x98e2('0x52')])[_0x98e2('0x43')](function(_0x188605){throw _0x188605;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index bd7de7a..6ca33dc 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 _0x7abe=['Failed','exit','util','lodash','json2xls','bluebird','rimraf','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7abe,0x121));var _0xe7ab=function(_0x10b498,_0x1db34e){_0x10b498=_0x10b498-0x0;var _0x331217=_0x7abe[_0x10b498];return _0x331217;};'use strict';var util=require(_0xe7ab('0x0'));var path=require('path');var _=require(_0xe7ab('0x1'));var fs=require('fs');var json2xls=require(_0xe7ab('0x2'));var BPromise=require(_0xe7ab('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xe7ab('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xe7ab('0x5')];var logger=require(_0xe7ab('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe7ab('0x7')][0x3];var PATH=process[_0xe7ab('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd9afb3,_0x6a2f63){var _0x1cd7a3={'status':_0xd9afb3};var _0x178b94={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x6a2f63){_0x1cd7a3['savename']=_0x6a2f63;}return db[_0xe7ab('0x8')][_0xe7ab('0x9')](_0x1cd7a3,_0x178b94);}function main(){var _0x4c19fe=0x1388;var _0x414f8b;logger[_0xe7ab('0xa')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe7ab('0xb')));return db[_0xe7ab('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe7ab('0xd'),_0xe7ab('0xe')]})[_0xe7ab('0xf')](function(_0x3968be){if(_0x3968be){_0x414f8b=_0x3968be;_0x4c19fe=_0x414f8b[_0xe7ab('0xe')]||0x1388;}})[_0xe7ab('0xf')](function(){return dbH[_0xe7ab('0x10')][_0xe7ab('0x11')](util[_0xe7ab('0x12')](_0xe7ab('0x13'),QUERY),{'type':dbH[_0xe7ab('0x10')][_0xe7ab('0x14')][_0xe7ab('0x15')]});})['then'](function(_0x344c47){if(!_0x344c47[0x0]['num']){return analyticExtractedReport('Empty');}var _0xb4f399=[];var _0x536acc=0x0;var _0x12881c=!![];if(_0x414f8b[_0xe7ab('0xd')]){if(_0x344c47&&_0x344c47[_0xe7ab('0x16')]){var _0x1d8d33=_0x344c47[0x0][_0xe7ab('0x17')]%(_0x536acc+_0x4c19fe);for(;_0x12881c;_0x536acc+=_0x4c19fe,_0x1d8d33=_0x344c47[0x0][_0xe7ab('0x17')]%(_0x536acc+_0x4c19fe)){if(_0x1d8d33==0x0||_0x1d8d33==_0x344c47[0x0]['num']){_0x12881c=![];}_0xb4f399[_0xe7ab('0x18')](dbH['sequelize']['query'](util[_0xe7ab('0x12')](_0xe7ab('0x19'),QUERY,_0x4c19fe,_0x536acc),{'type':dbH[_0xe7ab('0x10')]['QueryTypes'][_0xe7ab('0x15')]}));}}}else{_0xb4f399['push'](dbH[_0xe7ab('0x10')][_0xe7ab('0x11')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xe7ab('0x15')]}));}var _0x123cd9=path[_0xe7ab('0x1a')](PATH);var _0xc838cb=path['basename'](PATH,_0xe7ab('0x1b'));var _0x625b0f=_0x414f8b['split']&&_0xb4f399[_0xe7ab('0x16')]>0x1;var _0x48e240=[];if(!fs[_0xe7ab('0x1c')](path[_0xe7ab('0x1d')](_0x123cd9,_0xc838cb))&&_0x625b0f){fs['mkdirSync'](path[_0xe7ab('0x1d')](_0x123cd9,_0xc838cb));}return BPromise['each'](_0xb4f399,function(_0x2d9971){_0x48e240[_0xe7ab('0x18')](_0x2d9971);})[_0xe7ab('0xf')](function(){for(var _0x4d31fe=0x0;_0x4d31fe<_0x48e240[_0xe7ab('0x16')];_0x4d31fe+=0x1){var _0x156ba5;var _0x5a7ca2=_0x48e240[_0x4d31fe];if(_0x625b0f){_0x156ba5=path[_0xe7ab('0x1d')](_0x123cd9,_0xc838cb,util[_0xe7ab('0x12')](_0xe7ab('0x1e'),_0xc838cb,_0x4d31fe,_0xe7ab('0x1f')));}else{_0x156ba5=path[_0xe7ab('0x1d')](_0x123cd9,util[_0xe7ab('0x12')](_0xe7ab('0x20'),_0xc838cb,_0xe7ab('0x1f')));}fs[_0xe7ab('0x21')](_0x156ba5,json2xls(_0x5a7ca2),_0xe7ab('0x22'));}})['then'](function(){if(_0x625b0f){zipdir(path[_0xe7ab('0x1d')](_0x123cd9,_0xc838cb),{'saveTo':path[_0xe7ab('0x1d')](_0x123cd9,util[_0xe7ab('0x12')](_0xe7ab('0x20'),_0xc838cb,_0xe7ab('0x23')))},function(_0x18c656,_0x12656b){});rimraf(path[_0xe7ab('0x1d')](_0x123cd9,_0xc838cb),function(){});}})[_0xe7ab('0xf')](function(){logger[_0xe7ab('0xa')](util[_0xe7ab('0x12')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xe7ab('0xb')));return analyticExtractedReport(_0xe7ab('0x24'),_0x625b0f?util['format'](_0xe7ab('0x20'),_0xc838cb,_0x625b0f?_0xe7ab('0x23'):_0xe7ab('0x1f')):null);});})['catch'](function(_0x1060df){logger['info'](util[_0xe7ab('0x12')](_0xe7ab('0x25'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xe7ab('0x26')](_0x1060df,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe7ab('0x27'));})['finally'](function(){process[_0xe7ab('0x28')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x79ac=['writeFileSync','binary','zip','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','then','num','Empty','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0x79ac,0xee));var _0xc79a=function(_0x170d7c,_0x54031f){_0x170d7c=_0x170d7c-0x0;var _0x1c0e57=_0x79ac[_0x170d7c];return _0x1c0e57;};'use strict';var util=require(_0xc79a('0x0'));var path=require(_0xc79a('0x1'));var _=require(_0xc79a('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xc79a('0x3'));var zipdir=require(_0xc79a('0x4'));var rimraf=require(_0xc79a('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc79a('0x6'))[_0xc79a('0x7')];var logger=require(_0xc79a('0x8'))(_0xc79a('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xc79a('0xa')][0x2]);var QUERY=process[_0xc79a('0xa')][0x3];var PATH=process[_0xc79a('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x146300,_0x219918){var _0x4368e7={'status':_0x146300};var _0x38d86b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x219918){_0x4368e7['savename']=_0x219918;}return db['AnalyticExtractedReport'][_0xc79a('0xb')](_0x4368e7,_0x38d86b);}function main(){var _0x5d11b3=0x1388;var _0x1eb3d9;logger['info'](util[_0xc79a('0xc')](_0xc79a('0xd'),EXTRACTED_REPORT_ID,_0xc79a('0xe')));return db['Setting'][_0xc79a('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc79a('0x10'),'splitSizeXlsx']})['then'](function(_0x59a90f){if(_0x59a90f){_0x1eb3d9=_0x59a90f;_0x5d11b3=_0x1eb3d9[_0xc79a('0x11')]||0x1388;}})['then'](function(){return dbH[_0xc79a('0x12')][_0xc79a('0x13')](util[_0xc79a('0xc')](_0xc79a('0x14'),QUERY),{'type':dbH['sequelize'][_0xc79a('0x15')]['SELECT']});})[_0xc79a('0x16')](function(_0x45f78a){if(!_0x45f78a[0x0][_0xc79a('0x17')]){return analyticExtractedReport(_0xc79a('0x18'));}var _0x4b7127=[];var _0x5033b1=0x0;var _0xb657e2=!![];if(_0x1eb3d9[_0xc79a('0x10')]){if(_0x45f78a&&_0x45f78a['length']){var _0x2a7039=_0x45f78a[0x0][_0xc79a('0x17')]%(_0x5033b1+_0x5d11b3);for(;_0xb657e2;_0x5033b1+=_0x5d11b3,_0x2a7039=_0x45f78a[0x0][_0xc79a('0x17')]%(_0x5033b1+_0x5d11b3)){if(_0x2a7039==0x0||_0x2a7039==_0x45f78a[0x0][_0xc79a('0x17')]){_0xb657e2=![];}_0x4b7127[_0xc79a('0x19')](dbH['sequelize']['query'](util[_0xc79a('0xc')](_0xc79a('0x1a'),QUERY,_0x5d11b3,_0x5033b1),{'type':dbH[_0xc79a('0x12')][_0xc79a('0x15')][_0xc79a('0x1b')]}));}}}else{_0x4b7127[_0xc79a('0x19')](dbH[_0xc79a('0x12')][_0xc79a('0x13')](QUERY,{'type':dbH[_0xc79a('0x12')][_0xc79a('0x15')]['SELECT']}));}var _0x2c316a=path[_0xc79a('0x1c')](PATH);var _0x7c6aec=path[_0xc79a('0x1d')](PATH,_0xc79a('0x1e'));var _0x2045a3=_0x1eb3d9[_0xc79a('0x10')]&&_0x4b7127[_0xc79a('0x1f')]>0x1;var _0x5dbae2=[];if(!fs[_0xc79a('0x20')](path[_0xc79a('0x21')](_0x2c316a,_0x7c6aec))&&_0x2045a3){fs[_0xc79a('0x22')](path[_0xc79a('0x21')](_0x2c316a,_0x7c6aec));}return BPromise['each'](_0x4b7127,function(_0x4517ab){_0x5dbae2[_0xc79a('0x19')](_0x4517ab);})[_0xc79a('0x16')](function(){for(var _0x1975c1=0x0;_0x1975c1<_0x5dbae2[_0xc79a('0x1f')];_0x1975c1+=0x1){var _0x23046d;var _0x195c92=_0x5dbae2[_0x1975c1];if(_0x2045a3){_0x23046d=path[_0xc79a('0x21')](_0x2c316a,_0x7c6aec,util['format'](_0xc79a('0x23'),_0x7c6aec,_0x1975c1,_0xc79a('0x24')));}else{_0x23046d=path[_0xc79a('0x21')](_0x2c316a,util[_0xc79a('0xc')](_0xc79a('0x25'),_0x7c6aec,_0xc79a('0x24')));}fs[_0xc79a('0x26')](_0x23046d,json2xls(_0x195c92),_0xc79a('0x27'));}})[_0xc79a('0x16')](function(){if(_0x2045a3){zipdir(path['join'](_0x2c316a,_0x7c6aec),{'saveTo':path['join'](_0x2c316a,util[_0xc79a('0xc')](_0xc79a('0x25'),_0x7c6aec,_0xc79a('0x28')))},function(_0x46ff39,_0x1fccc0){});rimraf(path[_0xc79a('0x21')](_0x2c316a,_0x7c6aec),function(){});}})[_0xc79a('0x16')](function(){logger[_0xc79a('0x29')](util[_0xc79a('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc79a('0xe')));return analyticExtractedReport('Completed',_0x2045a3?util[_0xc79a('0xc')](_0xc79a('0x25'),_0x7c6aec,_0x2045a3?_0xc79a('0x28'):'xlsx'):null);});})['catch'](function(_0x24b338){logger[_0xc79a('0x29')](util[_0xc79a('0xc')](_0xc79a('0x2a'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xc79a('0x2b')](_0x24b338,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc79a('0x2c'));})[_0xc79a('0x2d')](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 89e7788..f316277 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 _0x52e7=['app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','map','exten','filter','queue','playback','extensions','extension','find','push','Set','CDR(type)=%s','type','priority','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','context','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','updatedAt','interval','IntervalId','hasOwnProperty','tag','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'];(function(_0x189a79,_0x35a0fd){var _0x585151=function(_0x4f7423){while(--_0x4f7423){_0x189a79['push'](_0x189a79['shift']());}};_0x585151(++_0x35a0fd);}(_0x52e7,0x9e));var _0x752e=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x52e7[_0x3c4a7c];return _0xf13d1e;};'use strict';var _=require(_0x752e('0x0'));var util=require(_0x752e('0x1'));function rewrite(_0x523218,_0x4dc145){var _0x3d8338=this;return _0x523218[_0x752e('0x2')][_0x752e('0x3')][_0x752e('0x4')]({'raw':!![]})[_0x752e('0x5')](function(_0x216d43){_0x3d8338[_0x752e('0x6')]=_0x216d43;return _0x523218[_0x752e('0x2')]['VoiceExtension'][_0x752e('0x4')]({'where':{'IntervalId':_0x4dc145['IntervalId']},'raw':!![]});})[_0x752e('0x5')](function(_0xd34f70){return _0x523218[_0x752e('0x2')][_0x752e('0x7')][_0x752e('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x752e('0x8')](_0xd34f70,_0x752e('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x752e('0x5')](function(_0xfcdcc7){var _0x2fb9bc=_[_0x752e('0xa')](_0xfcdcc7,{'priority':'1'});var _0x299ba8=_['filter'](_0xfcdcc7,{'isApp':0x1});var _0x49f914=_['groupBy'](_0x299ba8,_0x752e('0x9'));var _0x472df3=[_0x752e('0xb'),_0x752e('0xc')];var _0x1d1c20=[];var _0x535531=[];for(var _0xe870b6 in _0x49f914){if(_0x49f914['hasOwnProperty'](_0xe870b6)){_0x3d8338['priority']=0x2;_0x3d8338[_0x752e('0xd')]=[];_0x3d8338[_0x752e('0xe')]=_[_0x752e('0xf')](_0x2fb9bc,{'exten':_0x49f914[_0xe870b6][0x0][_0x752e('0x9')]});_0x3d8338['extensions'][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0]['type'],'app':_0x752e('0x11'),'appdata':util['format'](_0x752e('0x12'),_0x49f914[_0xe870b6][0x0][_0x752e('0x13')]),'context':_0x49f914[_0xe870b6][0x0]['context'],'exten':_0x49f914[_0xe870b6][0x0][_0x752e('0x9')],'priority':_0x3d8338[_0x752e('0x14')]++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});if(_0x49f914[_0xe870b6][0x0][_0x752e('0x13')]===_0x752e('0x16')){if(_0x3d8338[_0x752e('0xe')]){_0x3d8338[_0x752e('0xd')][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0][_0x752e('0x13')],'app':_0x752e('0x11'),'appdata':_0x752e('0x17')+(_0x3d8338['extension'][_0x752e('0x18')]?_0x752e('0x19')+_0x3d8338[_0x752e('0xe')][_0x752e('0x18')]+'}':_0x752e('0x1a')),'context':_0x49f914[_0xe870b6][0x0]['context'],'exten':_0x49f914[_0xe870b6][0x0][_0x752e('0x9')],'priority':_0x3d8338[_0x752e('0x14')]++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});}_0x3d8338['extensions'][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0]['type'],'app':_0x752e('0x11'),'appdata':_0x752e('0x1b')+_0x49f914[_0xe870b6][0x0][_0x752e('0x15')],'context':_0x49f914[_0xe870b6][0x0][_0x752e('0x1c')],'exten':_0x49f914[_0xe870b6][0x0][_0x752e('0x9')],'priority':_0x3d8338[_0x752e('0x14')]++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});var _0x3a20a1=_0x3d8338[_0x752e('0x14')]++;_0x3d8338['extensions'][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0][_0x752e('0x13')],'app':'ExecIf','appdata':_0x752e('0x1d')+(_0x3a20a1+0x2)+'):Goto('+(_0x3a20a1+0x1)+')','context':_0x49f914[_0xe870b6][0x0][_0x752e('0x1c')],'exten':_0x49f914[_0xe870b6][0x0][_0x752e('0x9')],'priority':_0x3a20a1,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0]['VoiceExtensionId']});if(_0x3d8338[_0x752e('0xe')]){_0x3d8338[_0x752e('0xd')]['push']({'type':_0x49f914[_0xe870b6][0x0][_0x752e('0x13')],'app':_0x752e('0x11'),'appdata':_0x3d8338[_0x752e('0xe')][_0x752e('0x18')]?_0x752e('0x1e')+_0x3d8338[_0x752e('0xe')][_0x752e('0x18')]+'}':_0x752e('0x1f'),'context':_0x49f914[_0xe870b6][0x0]['context'],'exten':_0x49f914[_0xe870b6][0x0][_0x752e('0x9')],'priority':_0x3d8338[_0x752e('0x14')]++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});}_0x3d8338['extensions'][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0]['type'],'app':_0x752e('0x11'),'appdata':_0x752e('0x20')+_0x49f914[_0xe870b6][0x0]['VoiceExtensionId'],'context':_0x49f914[_0xe870b6][0x0][_0x752e('0x1c')],'exten':_0x49f914[_0xe870b6][0x0]['exten'],'priority':_0x3d8338['priority']++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});if(_0x3d8338[_0x752e('0xe')]&&_0x3d8338[_0x752e('0xe')]['hasOwnProperty'](_0x752e('0x21'))&&_0x3d8338[_0x752e('0xe')]['recordingFormat']!==_0x752e('0x22')){_0x3d8338['extensions'][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0][_0x752e('0x13')],'app':_0x752e('0x11'),'appdata':_0x752e('0x23'),'context':_0x49f914[_0xe870b6][0x0][_0x752e('0x1c')],'exten':_0x49f914[_0xe870b6][0x0]['exten'],'priority':_0x3d8338[_0x752e('0x14')]++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});_0x3d8338[_0x752e('0xd')][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3d8338[_0x752e('0xe')][_0x752e('0x21')]||_0x752e('0x24'),'context':_0x49f914[_0xe870b6][0x0][_0x752e('0x1c')],'exten':_0x49f914[_0xe870b6][0x0][_0x752e('0x9')],'priority':_0x3d8338[_0x752e('0x14')]++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});}}_0x3d8338[_0x752e('0xd')]['push']({'type':_0x49f914[_0xe870b6][0x0][_0x752e('0x13')],'app':_0x752e('0x11'),'appdata':_0x752e('0x25'),'context':_0x49f914[_0xe870b6][0x0][_0x752e('0x1c')],'exten':_0x49f914[_0xe870b6][0x0][_0x752e('0x9')],'priority':_0x3d8338[_0x752e('0x14')]++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0]['VoiceExtensionId']});_0x3d8338[_0x752e('0xd')][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0][_0x752e('0x13')],'app':_0x752e('0x11'),'appdata':_0x752e('0x26'),'context':_0x49f914[_0xe870b6][0x0]['context'],'exten':_0x49f914[_0xe870b6][0x0]['exten'],'priority':_0x3d8338[_0x752e('0x14')]++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});_0x3d8338['extensions'][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0][_0x752e('0x13')],'app':_0x752e('0x11'),'appdata':_0x752e('0x27'),'context':_0x49f914[_0xe870b6][0x0][_0x752e('0x1c')],'exten':_0x49f914[_0xe870b6][0x0]['exten'],'priority':_0x3d8338['priority']++,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});for(var _0xb469ca=0x0,_0xc4bb97=0x0;_0xb469ca<_0x49f914[_0xe870b6][_0x752e('0x28')];_0xb469ca+=0x1,_0xc4bb97=0x0){var _0x19aa22=_0x49f914[_0xe870b6][_0xb469ca];if(_0x19aa22[_0x752e('0x13')]){_0x19aa22[_0x752e('0x13')]=_0x19aa22[_0x752e('0x13')]['toLowerCase']();}var _0x16083b=[];var _0x121047=[];delete _0x19aa22['id'];delete _0x19aa22['createdAt'];delete _0x19aa22[_0x752e('0x29')];var _0x2de9b7=_0x19aa22[_0x752e('0x2a')]!=='*,*,*,*'?[_0x19aa22[_0x752e('0x2a')]]:_0x19aa22[_0x752e('0x2b')]?_['map'](_[_0x752e('0xa')](_0x3d8338['intervals'],{'IntervalId':_0x19aa22['IntervalId']}),_0x752e('0x2a')):[];if(_0x19aa22[_0x752e('0x2c')](_0x752e('0x2d'))){if(_0x19aa22[_0x752e('0x2d')]&&_0x19aa22[_0x752e('0x2d')]!=='--'){_0x16083b[_0x752e('0x10')]({'type':_0x19aa22[_0x752e('0x13')],'app':_0x752e('0x11'),'appdata':'CDR(tag)='+_0x19aa22[_0x752e('0x2d')],'context':_0x19aa22[_0x752e('0x1c')],'exten':_0x19aa22[_0x752e('0x9')],'priority':_0x2de9b7[_0x752e('0x28')]+_0x3d8338[_0x752e('0x14')]+_0xc4bb97++,'VoiceExtensionId':_0x19aa22[_0x752e('0x15')]});}}if(_0x19aa22['type']===_0x752e('0x16')&&_0x19aa22[_0x752e('0x2c')](_0x752e('0x2e'))){if(_0x19aa22[_0x752e('0x2e')]){_0x16083b[_0x752e('0x10')]({'type':_0x19aa22[_0x752e('0x13')],'app':_0x752e('0x2f'),'appdata':_0x752e('0x30')+_0x19aa22[_0x752e('0x2e')]+')','context':_0x19aa22['context'],'exten':_0x19aa22[_0x752e('0x9')],'priority':_0x2de9b7['length']+_0x3d8338[_0x752e('0x14')]+_0xc4bb97++,'VoiceExtensionId':_0x19aa22[_0x752e('0x15')]});}else{_0x16083b[_0x752e('0x10')]({'type':_0x19aa22['type'],'app':_0x752e('0x2f'),'appdata':_0x752e('0x31'),'context':_0x19aa22[_0x752e('0x1c')],'exten':_0x19aa22[_0x752e('0x9')],'priority':_0x2de9b7[_0x752e('0x28')]+_0x3d8338[_0x752e('0x14')]+_0xc4bb97++,'VoiceExtensionId':_0x19aa22[_0x752e('0x15')]});}}if(_0x19aa22[_0x752e('0x2c')](_0x752e('0x32'))){if(_0x472df3[_0x752e('0x33')](_0x19aa22[_0x752e('0x34')]['toLowerCase']())>=0x0&&_0x19aa22[_0x752e('0x35')]!==_0x752e('0x36')){if(_0x19aa22[_0x752e('0x32')]){_0x16083b['push']({'type':_0x19aa22[_0x752e('0x13')],'app':'ExecIf','appdata':_0x752e('0x37'),'context':_0x19aa22[_0x752e('0x1c')],'exten':_0x19aa22['exten'],'priority':_0x2de9b7[_0x752e('0x28')]+_0x3d8338[_0x752e('0x14')]+_0xc4bb97++,'VoiceExtensionId':_0x19aa22[_0x752e('0x15')]});_0x16083b[_0x752e('0x10')]({'type':_0x19aa22['type'],'app':_0x752e('0x11'),'appdata':_0x752e('0x38'),'context':_0x19aa22['context'],'exten':_0x19aa22[_0x752e('0x9')],'priority':_0x2de9b7[_0x752e('0x28')]+_0x3d8338['priority']+_0xc4bb97++,'VoiceExtensionId':_0x19aa22['VoiceExtensionId']});}else{_0x16083b[_0x752e('0x10')]({'type':_0x19aa22['type'],'app':_0x752e('0x2f'),'appdata':_0x752e('0x39'),'context':_0x19aa22[_0x752e('0x1c')],'exten':_0x19aa22[_0x752e('0x9')],'priority':_0x2de9b7['length']+_0x3d8338[_0x752e('0x14')]+_0xc4bb97++,'VoiceExtensionId':_0x19aa22[_0x752e('0x15')]});_0x16083b[_0x752e('0x10')]({'type':_0x19aa22[_0x752e('0x13')],'app':'Set','appdata':_0x752e('0x3a'),'context':_0x19aa22[_0x752e('0x1c')],'exten':_0x19aa22['exten'],'priority':_0x2de9b7[_0x752e('0x28')]+_0x3d8338[_0x752e('0x14')]+_0xc4bb97++,'VoiceExtensionId':_0x19aa22[_0x752e('0x15')]});}}}for(var _0x1fb06c=0x0;_0x1fb06c<_0x2de9b7[_0x752e('0x28')];_0x1fb06c+=0x1){var _0x5d8669=_0x3d8338[_0x752e('0x14')]+_0x2de9b7[_0x752e('0x28')];var _0x36f88e=_0x1fb06c===_0x2de9b7[_0x752e('0x28')]-0x1?_0x3d8338[_0x752e('0x14')]+_0x16083b[_0x752e('0x28')]+_0x121047[_0x752e('0x28')]+0x2:_0x3d8338[_0x752e('0x14')]+_0x1fb06c+0x1;_0x16083b['splice'](_0x1fb06c,0x0,{'type':_0x19aa22[_0x752e('0x13')],'app':_0x752e('0x3b'),'appdata':_0x2de9b7[_0x1fb06c]+'?'+_0x19aa22[_0x752e('0x1c')]+_0x752e('0x3c')+_0x5d8669+':'+_0x19aa22[_0x752e('0x1c')]+',${EXTEN},'+_0x36f88e,'exten':_0x19aa22[_0x752e('0x9')],'context':_0x19aa22[_0x752e('0x1c')],'priority':_0x3d8338[_0x752e('0x14')]+_0x1fb06c,'VoiceExtensionId':_0x49f914[_0xe870b6][0x0]['VoiceExtensionId']});}_0x19aa22['priority']=_0x16083b['length']?_[_0x752e('0x3d')](_0x16083b)[_0x752e('0x14')]+0x1:_0x3d8338[_0x752e('0x14')];_0x3d8338[_0x752e('0x14')]=(_0x121047[_0x752e('0x28')]?_[_0x752e('0x3d')](_0x121047)[_0x752e('0x14')]:_0x19aa22[_0x752e('0x14')])+0x1;_0x3d8338[_0x752e('0xd')]=_[_0x752e('0x3e')](_0x3d8338[_0x752e('0xd')],_0x16083b,[_0x19aa22],_0x121047);}_0x3d8338[_0x752e('0xd')][_0x752e('0x10')]({'type':_0x49f914[_0xe870b6][0x0][_0x752e('0x13')],'app':_0x752e('0x3f'),'exten':_0x49f914[_0xe870b6][0x0][_0x752e('0x9')],'context':_0x49f914[_0xe870b6][0x0][_0x752e('0x1c')],'priority':_0x3d8338[_0x752e('0x14')],'VoiceExtensionId':_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]});_0x1d1c20[_0x752e('0x10')](_0x49f914[_0xe870b6][0x0][_0x752e('0x15')]);_0x535531=_[_0x752e('0x3e')](_0x535531,_0x3d8338['extensions']);}}return _0x523218[_0x752e('0x40')](function(_0x23527e){return _0x523218['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x1d1c20}},'transaction':_0x23527e})[_0x752e('0x5')](function(_0x4eb4f7){return _0x523218[_0x752e('0x2')]['VoiceExtension'][_0x752e('0x41')](_[_0x752e('0x42')](_0x535531,_0x752e('0x14')),{'transaction':_0x23527e});});});})[_0x752e('0x43')](function(_0x3929f4){console[_0x752e('0x44')](_0x3929f4);});}exports[_0x752e('0x45')]=rewrite; \ No newline at end of file +var _0x3bc4=['interval','*,*,*,*','tag','CDR(tag)=','outbound','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','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','last','Hangup','VoiceExtension','destroy','bulkCreate','sortBy','lodash','util','models','Interval','findAll','intervals','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','push','type','Set','format','context','VoiceExtensionId','CDR(destination)=','extension','${EXTEN:','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','updatedAt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3bc4,0x116));var _0x43bc=function(_0x48b88f,_0x2e1e94){_0x48b88f=_0x48b88f-0x0;var _0x34d441=_0x3bc4[_0x48b88f];return _0x34d441;};'use strict';var _=require(_0x43bc('0x0'));var util=require(_0x43bc('0x1'));function rewrite(_0x43d183,_0x517a40){var _0x207e43=this;return _0x43d183[_0x43bc('0x2')][_0x43bc('0x3')][_0x43bc('0x4')]({'raw':!![]})['then'](function(_0x567119){_0x207e43[_0x43bc('0x5')]=_0x567119;return _0x43d183[_0x43bc('0x2')]['VoiceExtension'][_0x43bc('0x4')]({'where':{'IntervalId':_0x517a40[_0x43bc('0x6')]},'raw':!![]});})[_0x43bc('0x7')](function(_0x15fc21){return _0x43d183[_0x43bc('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x43bc('0x8')](_[_0x43bc('0x9')](_0x15fc21,_0x43bc('0xa')))}},'order':[{'raw':_0x43bc('0xb')}],'raw':!![]});})[_0x43bc('0x7')](function(_0x562b2f){var _0x5dc706=_['filter'](_0x562b2f,{'priority':'1'});var _0x47f26e=_[_0x43bc('0xc')](_0x562b2f,{'isApp':0x1});var _0x4704ab=_[_0x43bc('0xd')](_0x47f26e,_0x43bc('0xa'));var _0x129338=[_0x43bc('0xe'),_0x43bc('0xf')];var _0x16a45c=[];var _0x597a07=[];for(var _0x12c1cb in _0x4704ab){if(_0x4704ab[_0x43bc('0x10')](_0x12c1cb)){_0x207e43[_0x43bc('0x11')]=0x2;_0x207e43[_0x43bc('0x12')]=[];_0x207e43['extension']=_[_0x43bc('0x13')](_0x5dc706,{'exten':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0xa')]});_0x207e43['extensions'][_0x43bc('0x14')]({'type':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x15')],'app':_0x43bc('0x16'),'appdata':util[_0x43bc('0x17')]('CDR(type)=%s',_0x4704ab[_0x12c1cb][0x0]['type']),'context':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x18')],'exten':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0xa')],'priority':_0x207e43[_0x43bc('0x11')]++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});if(_0x4704ab[_0x12c1cb][0x0]['type']==='outbound'){if(_0x207e43['extension']){_0x207e43[_0x43bc('0x12')]['push']({'type':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x15')],'app':_0x43bc('0x16'),'appdata':_0x43bc('0x1a')+(_0x207e43[_0x43bc('0x1b')]['cutdigits']?_0x43bc('0x1c')+_0x207e43['extension'][_0x43bc('0x1d')]+'}':'${EXTEN}'),'context':_0x4704ab[_0x12c1cb][0x0]['context'],'exten':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0xa')],'priority':_0x207e43[_0x43bc('0x11')]++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});}_0x207e43['extensions'][_0x43bc('0x14')]({'type':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')],'context':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x18')],'exten':_0x4704ab[_0x12c1cb][0x0]['exten'],'priority':_0x207e43[_0x43bc('0x11')]++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});var _0x52181a=_0x207e43['priority']++;_0x207e43['extensions'][_0x43bc('0x14')]({'type':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x15')],'app':'ExecIf','appdata':_0x43bc('0x1e')+(_0x52181a+0x2)+_0x43bc('0x1f')+(_0x52181a+0x1)+')','context':_0x4704ab[_0x12c1cb][0x0]['context'],'exten':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0xa')],'priority':_0x52181a,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});if(_0x207e43[_0x43bc('0x1b')]){_0x207e43[_0x43bc('0x12')]['push']({'type':_0x4704ab[_0x12c1cb][0x0]['type'],'app':_0x43bc('0x16'),'appdata':_0x207e43[_0x43bc('0x1b')]['cutdigits']?_0x43bc('0x20')+_0x207e43['extension'][_0x43bc('0x1d')]+'}':_0x43bc('0x21'),'context':_0x4704ab[_0x12c1cb][0x0]['context'],'exten':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0xa')],'priority':_0x207e43[_0x43bc('0x11')]++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});}_0x207e43[_0x43bc('0x12')][_0x43bc('0x14')]({'type':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x15')],'app':_0x43bc('0x16'),'appdata':'outboundrouteid='+_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')],'context':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x18')],'exten':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0xa')],'priority':_0x207e43[_0x43bc('0x11')]++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});if(_0x207e43['extension']&&_0x207e43[_0x43bc('0x1b')]['hasOwnProperty'](_0x43bc('0x22'))&&_0x207e43[_0x43bc('0x1b')][_0x43bc('0x22')]!==_0x43bc('0x23')){_0x207e43[_0x43bc('0x12')][_0x43bc('0x14')]({'type':_0x4704ab[_0x12c1cb][0x0]['type'],'app':_0x43bc('0x16'),'appdata':_0x43bc('0x24'),'context':_0x4704ab[_0x12c1cb][0x0]['context'],'exten':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0xa')],'priority':_0x207e43[_0x43bc('0x11')]++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});_0x207e43[_0x43bc('0x12')]['push']({'type':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x15')],'app':_0x43bc('0x16'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x207e43[_0x43bc('0x1b')]['recordingFormat']||'wav','context':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x18')],'exten':_0x4704ab[_0x12c1cb][0x0]['exten'],'priority':_0x207e43[_0x43bc('0x11')]++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0]['VoiceExtensionId']});}}_0x207e43[_0x43bc('0x12')][_0x43bc('0x14')]({'type':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x15')],'app':_0x43bc('0x16'),'appdata':_0x43bc('0x25'),'context':_0x4704ab[_0x12c1cb][0x0]['context'],'exten':_0x4704ab[_0x12c1cb][0x0]['exten'],'priority':_0x207e43[_0x43bc('0x11')]++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});_0x207e43['extensions']['push']({'type':_0x4704ab[_0x12c1cb][0x0]['type'],'app':'Set','appdata':_0x43bc('0x26'),'context':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x18')],'exten':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0xa')],'priority':_0x207e43['priority']++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});_0x207e43[_0x43bc('0x12')]['push']({'type':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x15')],'app':_0x43bc('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4704ab[_0x12c1cb][0x0]['context'],'exten':_0x4704ab[_0x12c1cb][0x0]['exten'],'priority':_0x207e43[_0x43bc('0x11')]++,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0]['VoiceExtensionId']});for(var _0x205766=0x0,_0x461bcc=0x0;_0x205766<_0x4704ab[_0x12c1cb][_0x43bc('0x27')];_0x205766+=0x1,_0x461bcc=0x0){var _0x197f76=_0x4704ab[_0x12c1cb][_0x205766];if(_0x197f76[_0x43bc('0x15')]){_0x197f76[_0x43bc('0x15')]=_0x197f76['type'][_0x43bc('0x28')]();}var _0x19e80e=[];var _0x402929=[];delete _0x197f76['id'];delete _0x197f76['createdAt'];delete _0x197f76[_0x43bc('0x29')];var _0x3f3327=_0x197f76[_0x43bc('0x2a')]!==_0x43bc('0x2b')?[_0x197f76[_0x43bc('0x2a')]]:_0x197f76[_0x43bc('0x6')]?_[_0x43bc('0x9')](_['filter'](_0x207e43[_0x43bc('0x5')],{'IntervalId':_0x197f76['IntervalId']}),_0x43bc('0x2a')):[];if(_0x197f76[_0x43bc('0x10')](_0x43bc('0x2c'))){if(_0x197f76[_0x43bc('0x2c')]&&_0x197f76[_0x43bc('0x2c')]!=='--'){_0x19e80e['push']({'type':_0x197f76['type'],'app':_0x43bc('0x16'),'appdata':_0x43bc('0x2d')+_0x197f76[_0x43bc('0x2c')],'context':_0x197f76[_0x43bc('0x18')],'exten':_0x197f76['exten'],'priority':_0x3f3327[_0x43bc('0x27')]+_0x207e43['priority']+_0x461bcc++,'VoiceExtensionId':_0x197f76[_0x43bc('0x19')]});}}if(_0x197f76[_0x43bc('0x15')]===_0x43bc('0x2e')&&_0x197f76[_0x43bc('0x10')](_0x43bc('0x2f'))){if(_0x197f76[_0x43bc('0x2f')]){_0x19e80e[_0x43bc('0x14')]({'type':_0x197f76['type'],'app':'ExecIf','appdata':_0x43bc('0x30')+_0x197f76['callerID']+')','context':_0x197f76['context'],'exten':_0x197f76[_0x43bc('0xa')],'priority':_0x3f3327[_0x43bc('0x27')]+_0x207e43[_0x43bc('0x11')]+_0x461bcc++,'VoiceExtensionId':_0x197f76['VoiceExtensionId']});}else{_0x19e80e['push']({'type':_0x197f76[_0x43bc('0x15')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x197f76['context'],'exten':_0x197f76[_0x43bc('0xa')],'priority':_0x3f3327[_0x43bc('0x27')]+_0x207e43[_0x43bc('0x11')]+_0x461bcc++,'VoiceExtensionId':_0x197f76[_0x43bc('0x19')]});}}if(_0x197f76[_0x43bc('0x10')](_0x43bc('0x31'))){if(_0x129338[_0x43bc('0x32')](_0x197f76[_0x43bc('0x33')][_0x43bc('0x28')]())>=0x0&&_0x197f76[_0x43bc('0x34')]!==_0x43bc('0x35')){if(_0x197f76[_0x43bc('0x31')]){_0x19e80e[_0x43bc('0x14')]({'type':_0x197f76[_0x43bc('0x15')],'app':'ExecIf','appdata':_0x43bc('0x36'),'context':_0x197f76[_0x43bc('0x18')],'exten':_0x197f76['exten'],'priority':_0x3f3327[_0x43bc('0x27')]+_0x207e43[_0x43bc('0x11')]+_0x461bcc++,'VoiceExtensionId':_0x197f76[_0x43bc('0x19')]});_0x19e80e[_0x43bc('0x14')]({'type':_0x197f76[_0x43bc('0x15')],'app':_0x43bc('0x16'),'appdata':_0x43bc('0x37'),'context':_0x197f76[_0x43bc('0x18')],'exten':_0x197f76[_0x43bc('0xa')],'priority':_0x3f3327['length']+_0x207e43[_0x43bc('0x11')]+_0x461bcc++,'VoiceExtensionId':_0x197f76['VoiceExtensionId']});}else{_0x19e80e['push']({'type':_0x197f76['type'],'app':'ExecIf','appdata':_0x43bc('0x38'),'context':_0x197f76[_0x43bc('0x18')],'exten':_0x197f76[_0x43bc('0xa')],'priority':_0x3f3327['length']+_0x207e43['priority']+_0x461bcc++,'VoiceExtensionId':_0x197f76[_0x43bc('0x19')]});_0x19e80e[_0x43bc('0x14')]({'type':_0x197f76[_0x43bc('0x15')],'app':_0x43bc('0x16'),'appdata':_0x43bc('0x39'),'context':_0x197f76[_0x43bc('0x18')],'exten':_0x197f76[_0x43bc('0xa')],'priority':_0x3f3327['length']+_0x207e43[_0x43bc('0x11')]+_0x461bcc++,'VoiceExtensionId':_0x197f76[_0x43bc('0x19')]});}}}for(var _0x3d5fa4=0x0;_0x3d5fa4<_0x3f3327[_0x43bc('0x27')];_0x3d5fa4+=0x1){var _0x2d709e=_0x207e43['priority']+_0x3f3327[_0x43bc('0x27')];var _0x1b9648=_0x3d5fa4===_0x3f3327[_0x43bc('0x27')]-0x1?_0x207e43[_0x43bc('0x11')]+_0x19e80e[_0x43bc('0x27')]+_0x402929[_0x43bc('0x27')]+0x2:_0x207e43[_0x43bc('0x11')]+_0x3d5fa4+0x1;_0x19e80e['splice'](_0x3d5fa4,0x0,{'type':_0x197f76[_0x43bc('0x15')],'app':'GotoIfTime','appdata':_0x3f3327[_0x3d5fa4]+'?'+_0x197f76[_0x43bc('0x18')]+',${EXTEN},'+_0x2d709e+':'+_0x197f76[_0x43bc('0x18')]+',${EXTEN},'+_0x1b9648,'exten':_0x197f76['exten'],'context':_0x197f76[_0x43bc('0x18')],'priority':_0x207e43['priority']+_0x3d5fa4,'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});}_0x197f76['priority']=_0x19e80e[_0x43bc('0x27')]?_['last'](_0x19e80e)[_0x43bc('0x11')]+0x1:_0x207e43[_0x43bc('0x11')];_0x207e43[_0x43bc('0x11')]=(_0x402929[_0x43bc('0x27')]?_[_0x43bc('0x3a')](_0x402929)[_0x43bc('0x11')]:_0x197f76['priority'])+0x1;_0x207e43[_0x43bc('0x12')]=_['concat'](_0x207e43[_0x43bc('0x12')],_0x19e80e,[_0x197f76],_0x402929);}_0x207e43['extensions'][_0x43bc('0x14')]({'type':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x15')],'app':_0x43bc('0x3b'),'exten':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0xa')],'context':_0x4704ab[_0x12c1cb][0x0]['context'],'priority':_0x207e43['priority'],'VoiceExtensionId':_0x4704ab[_0x12c1cb][0x0][_0x43bc('0x19')]});_0x16a45c[_0x43bc('0x14')](_0x4704ab[_0x12c1cb][0x0]['VoiceExtensionId']);_0x597a07=_['concat'](_0x597a07,_0x207e43[_0x43bc('0x12')]);}}return _0x43d183['transaction'](function(_0x527ca8){return _0x43d183[_0x43bc('0x2')][_0x43bc('0x3c')][_0x43bc('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x16a45c}},'transaction':_0x527ca8})[_0x43bc('0x7')](function(_0x142e0d){return _0x43d183[_0x43bc('0x2')][_0x43bc('0x3c')][_0x43bc('0x3e')](_[_0x43bc('0x3f')](_0x597a07,_0x43bc('0x11')),{'transaction':_0x527ca8});});});})['catch'](function(_0x3f2834){console['error'](_0x3f2834);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 4f82eae..edcf7ac 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 _0xe840=['outbound','BlackLists','Campaign','always','CampaignId','onlyIfOpen','CmList','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','pause','CSV\x20parsed\x20correctly!','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','create','keys','then','length','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','select','field','NOW()','ContactId','toString','createdAt','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','updatedAt','from','cm_contacts','id\x20IN\x20?','str','calleridnum','\x20=\x20?','deletedAt\x20IS\x20NULL','VoiceQueue','findAll','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','all'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xe840,0x101));var _0x0e84=function(_0xc99631,_0x56eb33){_0xc99631=_0xc99631-0x0;var _0x5b80cb=_0xe840[_0xc99631];return _0x5b80cb;};'use strict';var BPromise=require(_0x0e84('0x0'));var util=require(_0x0e84('0x1'));var _=require(_0x0e84('0x2'));var fs=require('fs');var squel=require(_0x0e84('0x3'));var Papa=require('papaparse');var Redis=require(_0x0e84('0x4'));var db=require(_0x0e84('0x5'))['db'];var config=require(_0x0e84('0x6'));var logger=require(_0x0e84('0x7'))(_0x0e84('0x8'));config['redis']=_[_0x0e84('0x9')](config[_0x0e84('0xa')],{'host':_0x0e84('0xb'),'port':0x18eb});var socket=require(_0x0e84('0xc'))(new Redis(config[_0x0e84('0xa')]));require(_0x0e84('0xd'))[_0x0e84('0xe')](socket);try{if(!process[_0x0e84('0xf')][0x2]||process['argv'][0x2]===_0x0e84('0x10')||process[_0x0e84('0xf')][0x2]===_0x0e84('0x11')){throw new Error(_0x0e84('0x12'));}var FILEPATH=process['argv'][0x2];if(!process[_0x0e84('0xf')][0x3]||process[_0x0e84('0xf')][0x3]===_0x0e84('0x10')||process[_0x0e84('0xf')][0x3]===_0x0e84('0x11')||!process[_0x0e84('0xf')][0x4]||process[_0x0e84('0xf')][0x4]===_0x0e84('0x10')||process['argv'][0x4]===_0x0e84('0x11')){throw new Error(_0x0e84('0x13'));}var FIELDS=_[_0x0e84('0x14')](process[_0x0e84('0xf')][0x3][_0x0e84('0x15')](','),process['argv'][0x4][_0x0e84('0x15')](','));if(!process[_0x0e84('0xf')][0x5]||process[_0x0e84('0xf')][0x5]===_0x0e84('0x10')||process[_0x0e84('0xf')][0x5]===_0x0e84('0x11')){throw new Error(_0x0e84('0x16'));}var LISTID=process[_0x0e84('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x0e84('0x10')&&process[_0x0e84('0xf')][0x6]!==_0x0e84('0x11')?process[_0x0e84('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x0e84('0x10')&&process[_0x0e84('0xf')][0x7]!==_0x0e84('0x11')?process['argv'][0x7]:null;if(!process[_0x0e84('0xf')][0x8]||process[_0x0e84('0xf')][0x8]===_0x0e84('0x10')||process[_0x0e84('0xf')][0x8]===_0x0e84('0x11')){throw new Error(_0x0e84('0x17'));}var SOCKET_TIMESTAMP=process[_0x0e84('0xf')][0x8];}catch(_0x37c51f){logger[_0x0e84('0x18')](_0x37c51f);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(_0x39d402,_0xdaae70,_0x10241c,_0xf3fa81){var _0x160433={'message':_0xdaae70};_0x160433[_0x39d402]=!![];if(_0x10241c){_0x160433[_0x0e84('0x19')]=_0x10241c;}if(_0xf3fa81){_0x160433[_0x0e84('0x1a')]=_0xf3fa81;}return _0x160433;}function isEmail(_0x11e631){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))*$/[_0x0e84('0x1b')](_0x11e631);}function checkRow(_0x1468bc,_0x1843ac,_0x285951){return new BPromise(function(_0x3fc27c,_0x3d800d){if(_[_0x0e84('0x1c')](_0x1468bc)){return _0x3d800d(handleCheckRowError(_0x0e84('0x18'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x285951));}if(_0x1468bc[_0x0e84('0x1d')]&&_0x1468bc[_0x0e84('0x1d')]['length']){var _0x27dd3f=_[_0x0e84('0x1e')](_0x1468bc['errors'],_0x0e84('0x1f'))[_0x0e84('0x20')](';');return _0x3d800d(handleCheckRowError(_0x0e84('0x18'),_0x27dd3f,null,_0x285951));}var _0x1e38a8={};for(var _0x408db1 in FIELDS){if(FIELDS[_0x0e84('0x21')](_0x408db1)&&FIELDS[_0x408db1]){_0x1e38a8[_0x408db1]=_0x1468bc[_0x0e84('0x22')][0x0][FIELDS[_0x408db1]]||_0x1468bc[_0x0e84('0x22')][0x0]['\ufeff'+FIELDS[_0x408db1]];}}if(!_0x1e38a8['firstName']){return _0x3d800d(handleCheckRowError(_0x0e84('0x18'),_0x0e84('0x23'),null,_0x285951));}if(!_0x1e38a8[_0x0e84('0x24')]){return _0x3d800d(handleCheckRowError(_0x0e84('0x18'),_0x0e84('0x25'),null,_0x285951));}if(_0x1e38a8[_0x0e84('0x26')]){var _0x7be3bf=moment(_0x1e38a8[_0x0e84('0x26')],_0x0e84('0x27'));if(!_0x7be3bf[_0x0e84('0x28')]()){return _0x3d800d(handleCheckRowError(_0x0e84('0x18'),_0x0e84('0x29'),null,_0x285951));}}if(_0x1e38a8[_0x0e84('0x2a')]){if(!isEmail(_0x1e38a8['email'])){return _0x3d800d(handleCheckRowError('error',_0x0e84('0x2b'),null,_0x285951));}}_0x1e38a8[_0x0e84('0x2c')]=LISTID;_0x1e38a8[_0x0e84('0x2d')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1843ac){var _0x18a4a0={};for(var _0x277c09=0x0,_0x184531=DUPLICATES['length'];_0x277c09<_0x184531;_0x277c09+=0x1){_0x18a4a0[DUPLICATES[_0x277c09]]=_0x1e38a8[DUPLICATES[_0x277c09]];}var _0x15ff6f=_[_0x0e84('0x2e')](_0x1843ac,_0x18a4a0);if(_0x15ff6f){return _0x3d800d(handleCheckRowError(_0x0e84('0x2f'),_0x0e84('0x30'),_0x15ff6f,_0x285951));}}return db['CmContact'][_0x0e84('0x31')](_0x1e38a8,{'raw':!![],'hooks':![],'fields':_[_0x0e84('0x32')](_0x1e38a8)})[_0x0e84('0x33')](function(_0xf5fd16){if(DUPLICATES&&DUPLICATES[_0x0e84('0x34')]&&_0x1843ac){_0x1843ac[_0x0e84('0x35')](_[_0x0e84('0x36')](_0x1e38a8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf5fd16['id'];return _0x3fc27c();})[_0x0e84('0x37')](function(_0x575021){return _0x3d800d(handleCheckRowError(_0x0e84('0x18'),_0x0e84('0x38')+(_0x575021['message']||JSON['stringify'](_0x575021)),null,_0x285951));});});}function checkHopper(){function _0x497832(){return function(_0x5875b1){logger[_0x0e84('0x18')]('cmContact',_0x0e84('0x39'),util[_0x0e84('0x3a')](_0x5875b1,{'showHidden':![],'depth':null}));};}var _0x1f9fa6=function(_0x1470f7,_0x13ebce){var _0x1fdbb9=squel[_0x0e84('0x3b')]()[_0x0e84('0x3c')](_0x0e84('0x3d'))[_0x0e84('0x3e')](['phone',_0x0e84('0x3f'),'ContactId',_0x0e84('0x2c'),_0x13ebce,'createdAt','updatedAt'],squel[_0x0e84('0x40')]()['field'](_0x0e84('0x24'),_0x0e84('0x24'))[_0x0e84('0x41')](_0x0e84('0x42'),_0x0e84('0x3f'))[_0x0e84('0x41')]('id',_0x0e84('0x43'))[_0x0e84('0x41')](LISTID[_0x0e84('0x44')](),'ListId')[_0x0e84('0x41')](_0x1470f7['id']['toString'](),_0x13ebce)[_0x0e84('0x41')](_0x0e84('0x42'),_0x0e84('0x45'))[_0x0e84('0x41')](_0x0e84('0x42'),'updatedAt')['from']('cm_contacts')[_0x0e84('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0x0e84('0x47'),LISTID[_0x0e84('0x44')]())[_0x0e84('0x46')](_0x0e84('0x48'))[_0x0e84('0x46')](_0x0e84('0x49'),squel['select']()[_0x0e84('0x41')](_0x0e84('0x24'))['from'](_0x0e84('0x3d'))[_0x0e84('0x46')](_0x13ebce+'\x20=\x20?',_0x1470f7['id'][_0x0e84('0x44')]())))[_0x0e84('0x44')]();return _0x1fdbb9;};var _0x19d7a6=function(_0x4157da,_0x351a2c){var _0x385add=squel[_0x0e84('0x3b')]()[_0x0e84('0x3c')]('cm_hopper')[_0x0e84('0x3e')]([_0x0e84('0x24'),_0x0e84('0x3f'),_0x0e84('0x43'),'ListId',_0x351a2c,_0x0e84('0x45'),_0x0e84('0x4a')],squel[_0x0e84('0x40')]()[_0x0e84('0x41')]('phone','phone')[_0x0e84('0x41')](_0x0e84('0x42'),'scheduledAt')['field']('id','ContactId')[_0x0e84('0x41')](LISTID['toString'](),'ListId')['field'](_0x4157da['id'][_0x0e84('0x44')](),_0x351a2c)[_0x0e84('0x41')]('NOW()',_0x0e84('0x45'))[_0x0e84('0x41')](_0x0e84('0x42'),_0x0e84('0x4a'))[_0x0e84('0x4b')](_0x0e84('0x4c'))[_0x0e84('0x46')]('deletedAt\x20IS\x20NULL')[_0x0e84('0x46')](_0x0e84('0x47'),LISTID['toString']())[_0x0e84('0x46')](_0x0e84('0x4d'),squel[_0x0e84('0x4e')](hopperContacts))[_0x0e84('0x46')](_0x0e84('0x48'))['where'](_0x0e84('0x49'),squel[_0x0e84('0x40')]()[_0x0e84('0x41')](_0x0e84('0x4f'))[_0x0e84('0x4b')]('cm_hopper_final')[_0x0e84('0x46')](_0x351a2c+_0x0e84('0x50'),_0x4157da['id'][_0x0e84('0x44')]()))[_0x0e84('0x46')](_0x0e84('0x49'),squel[_0x0e84('0x40')]()[_0x0e84('0x41')](_0x0e84('0x24'))['from'](_0x0e84('0x3d'))[_0x0e84('0x46')](_0x351a2c+_0x0e84('0x50'),_0x4157da['id'][_0x0e84('0x44')]())))[_0x0e84('0x44')]();return _0x385add;};function _0x3b21b5(_0x412354,_0x55b853){var _0x566108=squel[_0x0e84('0x3b')]()[_0x0e84('0x3c')]('cm_hopper')[_0x0e84('0x3e')](['phone',_0x0e84('0x3f'),_0x0e84('0x43'),_0x0e84('0x2c'),_0x55b853,_0x0e84('0x45'),'updatedAt'],squel[_0x0e84('0x40')]()['field'](_0x0e84('0x24'),_0x0e84('0x24'))[_0x0e84('0x41')](_0x0e84('0x42'),_0x0e84('0x3f'))[_0x0e84('0x41')]('id','ContactId')[_0x0e84('0x41')](LISTID['toString'](),_0x0e84('0x2c'))[_0x0e84('0x41')](_0x412354['id'][_0x0e84('0x44')](),_0x55b853)[_0x0e84('0x41')](_0x0e84('0x42'),_0x0e84('0x45'))[_0x0e84('0x41')](_0x0e84('0x42'),_0x0e84('0x4a'))[_0x0e84('0x4b')](_0x0e84('0x4c'))['where'](_0x0e84('0x51'))[_0x0e84('0x46')](_0x0e84('0x47'),LISTID[_0x0e84('0x44')]())[_0x0e84('0x46')](_0x0e84('0x4d'),squel[_0x0e84('0x4e')](hopperContacts))[_0x0e84('0x46')](_0x0e84('0x48')))[_0x0e84('0x44')]();return _0x566108;}function _0x508e4e(_0x21e903,_0x48b35e){var _0x2e6fe9=squel[_0x0e84('0x3b')]()['into']('cm_hopper_black')[_0x0e84('0x3e')]([_0x0e84('0x24'),_0x0e84('0x43'),_0x0e84('0x2c'),_0x48b35e,_0x0e84('0x45'),_0x0e84('0x4a')],squel['select']()[_0x0e84('0x41')](_0x0e84('0x24'),_0x0e84('0x24'))[_0x0e84('0x41')]('id',_0x0e84('0x43'))[_0x0e84('0x41')](LISTID[_0x0e84('0x44')](),'ListId')[_0x0e84('0x41')](_0x21e903['id'][_0x0e84('0x44')](),_0x48b35e)[_0x0e84('0x41')]('NOW()','createdAt')[_0x0e84('0x41')](_0x0e84('0x42'),_0x0e84('0x4a'))[_0x0e84('0x4b')](_0x0e84('0x4c'))['where'](_0x0e84('0x51'))[_0x0e84('0x46')]('ListId\x20=\x20?',LISTID[_0x0e84('0x44')]())[_0x0e84('0x46')](_0x0e84('0x4d'),squel[_0x0e84('0x4e')](hopperContacts))[_0x0e84('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0x0e84('0x44')]();return _0x2e6fe9;}return db[_0x0e84('0x52')][_0x0e84('0x53')]({'where':{'type':'outbound'},'attributes':['id',_0x0e84('0x54')],'include':[{'model':db['CmList'],'as':_0x0e84('0x55'),'where':{'id':LISTID}}]})[_0x0e84('0x33')](function(_0x527e71){var _0x31f33e=[];if(_0x527e71){var _0x4d0bd3;for(var _0x5e04f2=0x0,_0x1fb6bc;_0x5e04f2<_0x527e71[_0x0e84('0x34')];_0x5e04f2+=0x1){_0x1fb6bc=_0x527e71[_0x5e04f2][_0x0e84('0x56')]({'plain':!![]});switch(_0x1fb6bc[_0x0e84('0x54')]){case'always':_0x31f33e[_0x0e84('0x35')](db[_0x0e84('0x57')][_0x0e84('0x58')](_0x19d7a6(_0x1fb6bc,_0x0e84('0x59')))[_0x0e84('0x33')](function(){})[_0x0e84('0x37')](_0x497832()));break;case'onlyIfOpen':_0x31f33e['push'](db[_0x0e84('0x57')]['query'](_0x1f9fa6(_0x1fb6bc,_0x0e84('0x59')))['then'](function(){})[_0x0e84('0x37')](_0x497832()));break;default:_0x31f33e[_0x0e84('0x35')](db[_0x0e84('0x57')][_0x0e84('0x58')](_0x3b21b5(_0x1fb6bc,_0x0e84('0x59')))['then'](function(){})[_0x0e84('0x37')](_0x497832()));}}}return _0x31f33e;})[_0x0e84('0x5a')]()[_0x0e84('0x33')](function(){return db[_0x0e84('0x52')]['findAll']({'where':{'type':_0x0e84('0x5b')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0e84('0x5c'),'where':{'id':LISTID}}]})[_0x0e84('0x33')](function(_0x5671ed){var _0x531396=[];if(_0x5671ed){var _0x223f57;for(var _0x147c8c=0x0,_0x4717aa;_0x147c8c<_0x5671ed['length'];_0x147c8c+=0x1){_0x4717aa=_0x5671ed[_0x147c8c][_0x0e84('0x56')]({'plain':!![]});_0x531396[_0x0e84('0x35')](db[_0x0e84('0x57')][_0x0e84('0x58')](_0x508e4e(_0x4717aa,'VoiceQueueId'))[_0x0e84('0x33')](function(){})['catch'](_0x497832()));}}return _0x531396;})[_0x0e84('0x5a')]();})[_0x0e84('0x33')](function(){return db[_0x0e84('0x5d')][_0x0e84('0x53')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0e84('0x55'),'where':{'id':LISTID}}]})[_0x0e84('0x33')](function(_0x4adb91){var _0x5c9c0e=[];if(_0x4adb91){for(var _0x6dbe2f=0x0,_0x1dd5f0;_0x6dbe2f<_0x4adb91['length'];_0x6dbe2f+=0x1){_0x1dd5f0=_0x4adb91[_0x6dbe2f]['get']({'plain':!![]});switch(_0x1dd5f0['dialCheckDuplicateType']){case _0x0e84('0x5e'):_0x5c9c0e[_0x0e84('0x35')](db[_0x0e84('0x57')][_0x0e84('0x58')](_0x19d7a6(_0x1dd5f0,_0x0e84('0x5f')))[_0x0e84('0x33')](function(){})[_0x0e84('0x37')](_0x497832()));break;case _0x0e84('0x60'):_0x5c9c0e[_0x0e84('0x35')](db['sequelize'][_0x0e84('0x58')](_0x1f9fa6(_0x1dd5f0,_0x0e84('0x5f')))[_0x0e84('0x33')](function(){})[_0x0e84('0x37')](_0x497832()));break;default:_0x5c9c0e[_0x0e84('0x35')](db[_0x0e84('0x57')][_0x0e84('0x58')](_0x3b21b5(_0x1dd5f0,_0x0e84('0x5f')))[_0x0e84('0x33')](function(){})[_0x0e84('0x37')](_0x497832()));}}}return _0x5c9c0e;})[_0x0e84('0x5a')]();})[_0x0e84('0x33')](function(){return db[_0x0e84('0x5d')][_0x0e84('0x53')]({'attributes':['id'],'include':[{'model':db[_0x0e84('0x61')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0e84('0x33')](function(_0x291be3){var _0x2c05c5=[];if(_0x291be3){for(var _0x442bf8=0x0,_0x12cc1f;_0x442bf8<_0x291be3[_0x0e84('0x34')];_0x442bf8+=0x1){_0x12cc1f=_0x291be3[_0x442bf8][_0x0e84('0x56')]({'plain':!![]});_0x2c05c5[_0x0e84('0x35')](db[_0x0e84('0x57')][_0x0e84('0x58')](_0x508e4e(_0x12cc1f,'CampaignId'))[_0x0e84('0x33')](function(){})[_0x0e84('0x37')](_0x497832()));}}return _0x2c05c5;})['all']();})['catch'](function(_0x4f779d){logger[_0x0e84('0x18')](_0x0e84('0x62'),_0x0e84('0x63'),_0x4f779d['message']);});}var processPromises=function(_0x53b37e){return BPromise[_0x0e84('0x5a')](promises)[_0x0e84('0x33')](function(_0x2af1bc){})[_0x0e84('0x37')](function(_0xef296d){logger[_0x0e84('0x18')](_0x0e84('0x64'),JSON[_0x0e84('0x65')](_0xef296d));})[_0x0e84('0x66')](function(){socket[_0x0e84('0x67')](_0x0e84('0x68')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x53b37e){return _0x53b37e['resume']();}});};var endCsv=function(){return BPromise[_0x0e84('0x69')]()[_0x0e84('0x33')](function(){if(hopperContacts){return checkHopper();}})[_0x0e84('0x33')](function(){socket[_0x0e84('0x67')](_0x0e84('0x68')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0e84('0x6a')](FILEPATH);}catch(_0x26b683){logger[_0x0e84('0x18')](_0x0e84('0x6b'),JSON[_0x0e84('0x65')](_0x26b683));}finally{process[_0x0e84('0x6c')](0x0);}});};process['on'](_0x0e84('0x6d'),function(){logger[_0x0e84('0x6e')](_0x0e84('0x6f'));endCsv();});function main(){return BPromise[_0x0e84('0x69')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0e84('0x15')](',');return db[_0x0e84('0x70')][_0x0e84('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0e84('0x33')](function(_0x34e459){var _0x200863=fs[_0x0e84('0x71')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x200863,{'header':!![],'skipEmptyLines':!![],'step':function(_0x33e7b7,_0x5405e1){total+=0x1;var _0x3187df=total;promises[_0x0e84('0x35')](checkRow(_0x33e7b7,_0x34e459,_0x3187df)[_0x0e84('0x33')](function(){success+=0x1;})[_0x0e84('0x37')](function(_0x305035){if(_0x305035[_0x0e84('0x18')]){errors+=0x1;delete _0x305035['error'];}else if(_0x305035['duplicate']){duplicates+=0x1;delete _0x305035['duplicate'];}rows[_0x0e84('0x35')](_0x305035);}));if(total%0xc8===0x0){_0x5405e1[_0x0e84('0x72')]();return processPromises(_0x5405e1);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x0e84('0x73'));endCsv();});},'error':function(_0x27c102,_0x49e3f8){logger[_0x0e84('0x6e')]('CSV\x20parse\x20error',JSON[_0x0e84('0x65')](_0x27c102));endCsv();}});})[_0x0e84('0x37')](function(_0x42e783){logger[_0x0e84('0x18')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0e84('0x65')](_0x42e783));});}main(); \ No newline at end of file +var _0xe38e=['dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','outbound','CmList','BlackLists','get','all','Campaign','Lists','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','bluebird','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','select','field','toString','NOW()','updatedAt','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','deletedAt\x20IS\x20NULL','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe38e,0x170));var _0xee38=function(_0xc9de55,_0x459be2){_0xc9de55=_0xc9de55-0x0;var _0x5194b6=_0xe38e[_0xc9de55];return _0x5194b6;};'use strict';var BPromise=require(_0xee38('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0xee38('0x1'));var Papa=require(_0xee38('0x2'));var Redis=require(_0xee38('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xee38('0x4'));var logger=require(_0xee38('0x5'))(_0xee38('0x6'));config[_0xee38('0x7')]=_[_0xee38('0x8')](config[_0xee38('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xee38('0x9'))(new Redis(config[_0xee38('0x7')]));require(_0xee38('0xa'))[_0xee38('0xb')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xee38('0xc')||process[_0xee38('0xd')][0x2]===_0xee38('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xee38('0xd')][0x2];if(!process[_0xee38('0xd')][0x3]||process[_0xee38('0xd')][0x3]==='undefined'||process['argv'][0x3]===_0xee38('0xe')||!process['argv'][0x4]||process['argv'][0x4]===_0xee38('0xc')||process[_0xee38('0xd')][0x4]===_0xee38('0xe')){throw new Error(_0xee38('0xf'));}var FIELDS=_[_0xee38('0x10')](process['argv'][0x3]['split'](','),process[_0xee38('0xd')][0x4][_0xee38('0x11')](','));if(!process[_0xee38('0xd')][0x5]||process[_0xee38('0xd')][0x5]===_0xee38('0xc')||process[_0xee38('0xd')][0x5]===_0xee38('0xe')){throw new Error(_0xee38('0x12'));}var LISTID=process[_0xee38('0xd')][0x5];var COMPANYID=process[_0xee38('0xd')][0x6]&&process[_0xee38('0xd')][0x6]!==_0xee38('0xc')&&process[_0xee38('0xd')][0x6]!=='null'?process[_0xee38('0xd')][0x6]:null;var DUPLICATES=process[_0xee38('0xd')][0x7]&&process[_0xee38('0xd')][0x7]!==_0xee38('0xc')&&process[_0xee38('0xd')][0x7]!==_0xee38('0xe')?process['argv'][0x7]:null;if(!process[_0xee38('0xd')][0x8]||process['argv'][0x8]===_0xee38('0xc')||process[_0xee38('0xd')][0x8]===_0xee38('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xee38('0xd')][0x8];}catch(_0x310355){logger[_0xee38('0x13')](_0x310355);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(_0x393e2e,_0x2388ff,_0x17fdeb,_0x390482){var _0x503f48={'message':_0x2388ff};_0x503f48[_0x393e2e]=!![];if(_0x17fdeb){_0x503f48[_0xee38('0x14')]=_0x17fdeb;}if(_0x390482){_0x503f48[_0xee38('0x15')]=_0x390482;}return _0x503f48;}function isEmail(_0x23a3ff){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))*$/[_0xee38('0x16')](_0x23a3ff);}function checkRow(_0xd668bf,_0x5bed4d,_0x54a633){return new BPromise(function(_0x10fee4,_0x2c0420){if(_[_0xee38('0x17')](_0xd668bf)){return _0x2c0420(handleCheckRowError(_0xee38('0x13'),_0xee38('0x18'),null,_0x54a633));}if(_0xd668bf[_0xee38('0x19')]&&_0xd668bf['errors'][_0xee38('0x1a')]){var _0x321a9c=_[_0xee38('0x1b')](_0xd668bf[_0xee38('0x19')],'message')['join'](';');return _0x2c0420(handleCheckRowError('error',_0x321a9c,null,_0x54a633));}var _0x535493={};for(var _0x423b0b in FIELDS){if(FIELDS[_0xee38('0x1c')](_0x423b0b)&&FIELDS[_0x423b0b]){_0x535493[_0x423b0b]=_0xd668bf[_0xee38('0x1d')][0x0][FIELDS[_0x423b0b]]||_0xd668bf['data'][0x0]['\ufeff'+FIELDS[_0x423b0b]];}}if(!_0x535493[_0xee38('0x1e')]){return _0x2c0420(handleCheckRowError('error',_0xee38('0x1f'),null,_0x54a633));}if(!_0x535493['phone']){return _0x2c0420(handleCheckRowError('error',_0xee38('0x20'),null,_0x54a633));}if(_0x535493[_0xee38('0x21')]){var _0x57a4ab=moment(_0x535493[_0xee38('0x21')],_0xee38('0x22'));if(!_0x57a4ab[_0xee38('0x23')]()){return _0x2c0420(handleCheckRowError(_0xee38('0x13'),_0xee38('0x24'),null,_0x54a633));}}if(_0x535493[_0xee38('0x25')]){if(!isEmail(_0x535493[_0xee38('0x25')])){return _0x2c0420(handleCheckRowError(_0xee38('0x13'),_0xee38('0x26'),null,_0x54a633));}}_0x535493[_0xee38('0x27')]=LISTID;_0x535493[_0xee38('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xee38('0x1a')]&&_0x5bed4d){var _0x3aac73={};for(var _0x28ef7e=0x0,_0x562260=DUPLICATES['length'];_0x28ef7e<_0x562260;_0x28ef7e+=0x1){_0x3aac73[DUPLICATES[_0x28ef7e]]=_0x535493[DUPLICATES[_0x28ef7e]];}var _0x526238=_[_0xee38('0x29')](_0x5bed4d,_0x3aac73);if(_0x526238){return _0x2c0420(handleCheckRowError(_0xee38('0x2a'),_0xee38('0x2b'),_0x526238,_0x54a633));}}return db['CmContact']['create'](_0x535493,{'raw':!![],'hooks':![],'fields':_[_0xee38('0x2c')](_0x535493)})[_0xee38('0x2d')](function(_0x335c0b){if(DUPLICATES&&DUPLICATES[_0xee38('0x1a')]&&_0x5bed4d){_0x5bed4d[_0xee38('0x2e')](_[_0xee38('0x2f')](_0x535493,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x335c0b['id'];return _0x10fee4();})[_0xee38('0x30')](function(_0x360454){return _0x2c0420(handleCheckRowError(_0xee38('0x13'),'Error\x20while\x20creating\x20contact:\x20'+(_0x360454[_0xee38('0x31')]||JSON[_0xee38('0x32')](_0x360454)),null,_0x54a633));});});}function checkHopper(){function _0x3c39d7(){return function(_0x4780c7){logger['error'](_0xee38('0x33'),_0xee38('0x34'),util[_0xee38('0x35')](_0x4780c7,{'showHidden':![],'depth':null}));};}var _0x2d4322=function(_0x2ab334,_0x5b286b){var _0x4a004f=squel[_0xee38('0x36')]()[_0xee38('0x37')](_0xee38('0x38'))[_0xee38('0x39')]([_0xee38('0x3a'),_0xee38('0x3b'),_0xee38('0x3c'),'ListId',_0x5b286b,_0xee38('0x3d'),'updatedAt'],squel[_0xee38('0x3e')]()[_0xee38('0x3f')]('phone',_0xee38('0x3a'))[_0xee38('0x3f')]('NOW()',_0xee38('0x3b'))[_0xee38('0x3f')]('id',_0xee38('0x3c'))['field'](LISTID[_0xee38('0x40')](),_0xee38('0x27'))[_0xee38('0x3f')](_0x2ab334['id'][_0xee38('0x40')](),_0x5b286b)[_0xee38('0x3f')]('NOW()',_0xee38('0x3d'))[_0xee38('0x3f')](_0xee38('0x41'),_0xee38('0x42'))[_0xee38('0x43')](_0xee38('0x44'))[_0xee38('0x45')]('deletedAt\x20IS\x20NULL')[_0xee38('0x45')](_0xee38('0x46'),LISTID[_0xee38('0x40')]())[_0xee38('0x45')](_0xee38('0x47'))[_0xee38('0x45')](_0xee38('0x48'),squel[_0xee38('0x3e')]()['field'](_0xee38('0x3a'))[_0xee38('0x43')](_0xee38('0x38'))[_0xee38('0x45')](_0x5b286b+'\x20=\x20?',_0x2ab334['id'][_0xee38('0x40')]())))[_0xee38('0x40')]();return _0x4a004f;};var _0x55754a=function(_0x119ea2,_0x271617){var _0x3fd327=squel[_0xee38('0x36')]()['into'](_0xee38('0x38'))[_0xee38('0x39')]([_0xee38('0x3a'),_0xee38('0x3b'),'ContactId','ListId',_0x271617,_0xee38('0x3d'),'updatedAt'],squel['select']()[_0xee38('0x3f')](_0xee38('0x3a'),'phone')[_0xee38('0x3f')]('NOW()',_0xee38('0x3b'))[_0xee38('0x3f')]('id',_0xee38('0x3c'))[_0xee38('0x3f')](LISTID['toString'](),'ListId')[_0xee38('0x3f')](_0x119ea2['id'][_0xee38('0x40')](),_0x271617)[_0xee38('0x3f')](_0xee38('0x41'),_0xee38('0x3d'))['field'](_0xee38('0x41'),_0xee38('0x42'))[_0xee38('0x43')](_0xee38('0x44'))[_0xee38('0x45')](_0xee38('0x49'))[_0xee38('0x45')](_0xee38('0x46'),LISTID[_0xee38('0x40')]())['where']('id\x20IN\x20?',squel[_0xee38('0x4a')](hopperContacts))[_0xee38('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xee38('0x45')](_0xee38('0x48'),squel[_0xee38('0x3e')]()[_0xee38('0x3f')]('calleridnum')[_0xee38('0x43')](_0xee38('0x4b'))[_0xee38('0x45')](_0x271617+_0xee38('0x4c'),_0x119ea2['id']['toString']()))[_0xee38('0x45')](_0xee38('0x48'),squel[_0xee38('0x3e')]()[_0xee38('0x3f')](_0xee38('0x3a'))[_0xee38('0x43')](_0xee38('0x38'))[_0xee38('0x45')](_0x271617+_0xee38('0x4c'),_0x119ea2['id'][_0xee38('0x40')]())))[_0xee38('0x40')]();return _0x3fd327;};function _0x49f922(_0x5776d9,_0xd50d02){var _0x1de877=squel[_0xee38('0x36')]()[_0xee38('0x37')]('cm_hopper')[_0xee38('0x39')](['phone','scheduledAt',_0xee38('0x3c'),_0xee38('0x27'),_0xd50d02,_0xee38('0x3d'),'updatedAt'],squel[_0xee38('0x3e')]()[_0xee38('0x3f')](_0xee38('0x3a'),'phone')[_0xee38('0x3f')]('NOW()',_0xee38('0x3b'))[_0xee38('0x3f')]('id','ContactId')[_0xee38('0x3f')](LISTID[_0xee38('0x40')](),_0xee38('0x27'))[_0xee38('0x3f')](_0x5776d9['id']['toString'](),_0xd50d02)[_0xee38('0x3f')](_0xee38('0x41'),_0xee38('0x3d'))[_0xee38('0x3f')](_0xee38('0x41'),'updatedAt')[_0xee38('0x43')](_0xee38('0x44'))[_0xee38('0x45')]('deletedAt\x20IS\x20NULL')[_0xee38('0x45')](_0xee38('0x46'),LISTID[_0xee38('0x40')]())['where'](_0xee38('0x4d'),squel['str'](hopperContacts))[_0xee38('0x45')](_0xee38('0x47')))[_0xee38('0x40')]();return _0x1de877;}function _0x3a9b37(_0x352cfd,_0x5dfca4){var _0x16873f=squel[_0xee38('0x36')]()['into'](_0xee38('0x4e'))[_0xee38('0x39')](['phone',_0xee38('0x3c'),_0xee38('0x27'),_0x5dfca4,_0xee38('0x3d'),_0xee38('0x42')],squel[_0xee38('0x3e')]()[_0xee38('0x3f')](_0xee38('0x3a'),_0xee38('0x3a'))[_0xee38('0x3f')]('id',_0xee38('0x3c'))['field'](LISTID['toString'](),'ListId')[_0xee38('0x3f')](_0x352cfd['id'][_0xee38('0x40')](),_0x5dfca4)[_0xee38('0x3f')](_0xee38('0x41'),_0xee38('0x3d'))['field']('NOW()','updatedAt')[_0xee38('0x43')](_0xee38('0x44'))['where'](_0xee38('0x49'))['where'](_0xee38('0x46'),LISTID[_0xee38('0x40')]())[_0xee38('0x45')]('id\x20IN\x20?',squel[_0xee38('0x4a')](hopperContacts))[_0xee38('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xee38('0x40')]();return _0x16873f;}return db['VoiceQueue'][_0xee38('0x4f')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xee38('0x2d')](function(_0x5818ee){var _0x386c9f=[];if(_0x5818ee){var _0x16fdce;for(var _0xbd85d9=0x0,_0x3d398a;_0xbd85d9<_0x5818ee[_0xee38('0x1a')];_0xbd85d9+=0x1){_0x3d398a=_0x5818ee[_0xbd85d9]['get']({'plain':!![]});switch(_0x3d398a[_0xee38('0x50')]){case _0xee38('0x51'):_0x386c9f[_0xee38('0x2e')](db[_0xee38('0x52')]['query'](_0x55754a(_0x3d398a,_0xee38('0x53')))['then'](function(){})[_0xee38('0x30')](_0x3c39d7()));break;case _0xee38('0x54'):_0x386c9f[_0xee38('0x2e')](db[_0xee38('0x52')][_0xee38('0x55')](_0x2d4322(_0x3d398a,_0xee38('0x53')))[_0xee38('0x2d')](function(){})['catch'](_0x3c39d7()));break;default:_0x386c9f[_0xee38('0x2e')](db[_0xee38('0x52')][_0xee38('0x55')](_0x49f922(_0x3d398a,'VoiceQueueId'))[_0xee38('0x2d')](function(){})[_0xee38('0x30')](_0x3c39d7()));}}}return _0x386c9f;})['all']()[_0xee38('0x2d')](function(){return db['VoiceQueue'][_0xee38('0x4f')]({'where':{'type':_0xee38('0x56')},'attributes':['id'],'include':[{'model':db[_0xee38('0x57')],'as':_0xee38('0x58'),'where':{'id':LISTID}}]})[_0xee38('0x2d')](function(_0x39a075){var _0x2c3f3b=[];if(_0x39a075){var _0x20ebbb;for(var _0x43459b=0x0,_0x2ca591;_0x43459b<_0x39a075[_0xee38('0x1a')];_0x43459b+=0x1){_0x2ca591=_0x39a075[_0x43459b][_0xee38('0x59')]({'plain':!![]});_0x2c3f3b[_0xee38('0x2e')](db[_0xee38('0x52')][_0xee38('0x55')](_0x3a9b37(_0x2ca591,_0xee38('0x53')))[_0xee38('0x2d')](function(){})['catch'](_0x3c39d7()));}}return _0x2c3f3b;})[_0xee38('0x5a')]();})['then'](function(){return db[_0xee38('0x5b')][_0xee38('0x4f')]({'attributes':['id',_0xee38('0x50')],'include':[{'model':db[_0xee38('0x57')],'as':_0xee38('0x5c'),'where':{'id':LISTID}}]})[_0xee38('0x2d')](function(_0x1c464a){var _0x13e45f=[];if(_0x1c464a){for(var _0x10f6e2=0x0,_0x19341b;_0x10f6e2<_0x1c464a[_0xee38('0x1a')];_0x10f6e2+=0x1){_0x19341b=_0x1c464a[_0x10f6e2]['get']({'plain':!![]});switch(_0x19341b[_0xee38('0x50')]){case _0xee38('0x51'):_0x13e45f['push'](db[_0xee38('0x52')][_0xee38('0x55')](_0x55754a(_0x19341b,'CampaignId'))['then'](function(){})['catch'](_0x3c39d7()));break;case _0xee38('0x54'):_0x13e45f[_0xee38('0x2e')](db[_0xee38('0x52')]['query'](_0x2d4322(_0x19341b,_0xee38('0x5d')))[_0xee38('0x2d')](function(){})[_0xee38('0x30')](_0x3c39d7()));break;default:_0x13e45f['push'](db['sequelize'][_0xee38('0x55')](_0x49f922(_0x19341b,_0xee38('0x5d')))['then'](function(){})['catch'](_0x3c39d7()));}}}return _0x13e45f;})[_0xee38('0x5a')]();})[_0xee38('0x2d')](function(){return db[_0xee38('0x5b')][_0xee38('0x4f')]({'attributes':['id'],'include':[{'model':db[_0xee38('0x57')],'as':_0xee38('0x58'),'where':{'id':LISTID}}]})[_0xee38('0x2d')](function(_0x5ea5ae){var _0x3f00c4=[];if(_0x5ea5ae){for(var _0x193dad=0x0,_0x85417c;_0x193dad<_0x5ea5ae[_0xee38('0x1a')];_0x193dad+=0x1){_0x85417c=_0x5ea5ae[_0x193dad][_0xee38('0x59')]({'plain':!![]});_0x3f00c4[_0xee38('0x2e')](db['sequelize'][_0xee38('0x55')](_0x3a9b37(_0x85417c,_0xee38('0x5d')))['then'](function(){})[_0xee38('0x30')](_0x3c39d7()));}}return _0x3f00c4;})[_0xee38('0x5a')]();})[_0xee38('0x30')](function(_0x5372b0){logger[_0xee38('0x13')]('cmContact,\x20%s,\x20%s',_0xee38('0x5e'),_0x5372b0[_0xee38('0x31')]);});}var processPromises=function(_0x209c8e){return BPromise[_0xee38('0x5a')](promises)[_0xee38('0x2d')](function(_0x99b695){})[_0xee38('0x30')](function(_0x10d7b4){logger['error'](_0xee38('0x5f'),JSON[_0xee38('0x32')](_0x10d7b4));})[_0xee38('0x60')](function(){socket[_0xee38('0x61')](_0xee38('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x209c8e){return _0x209c8e[_0xee38('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xee38('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0xee38('0x2d')](function(){socket['emit'](_0xee38('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xee38('0x64')](FILEPATH);}catch(_0x74bd88){logger[_0xee38('0x13')](_0xee38('0x65'),JSON[_0xee38('0x32')](_0x74bd88));}finally{process[_0xee38('0x66')](0x0);}});};process['on'](_0xee38('0x67'),function(){logger[_0xee38('0x68')](_0xee38('0x69'));endCsv();});function main(){return BPromise[_0xee38('0x6a')]()[_0xee38('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xee38('0x11')](',');return db[_0xee38('0x6b')][_0xee38('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xee38('0x2d')](function(_0x47b128){var _0x32b9a9=fs[_0xee38('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xee38('0x6d')](_0x32b9a9,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5043b5,_0x54d914){total+=0x1;var _0x2eceb6=total;promises['push'](checkRow(_0x5043b5,_0x47b128,_0x2eceb6)[_0xee38('0x2d')](function(){success+=0x1;})[_0xee38('0x30')](function(_0x313931){if(_0x313931[_0xee38('0x13')]){errors+=0x1;delete _0x313931[_0xee38('0x13')];}else if(_0x313931[_0xee38('0x2a')]){duplicates+=0x1;delete _0x313931['duplicate'];}rows[_0xee38('0x2e')](_0x313931);}));if(total%0xc8===0x0){_0x54d914[_0xee38('0x6e')]();return processPromises(_0x54d914);}},'complete':function(){return processPromises()[_0xee38('0x2d')](function(){logger[_0xee38('0x68')](_0xee38('0x6f'));endCsv();});},'error':function(_0x58a393,_0xa8e2bf){logger[_0xee38('0x68')]('CSV\x20parse\x20error',JSON['stringify'](_0x58a393));endCsv();}});})['catch'](function(_0x105f26){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xee38('0x32')](_0x105f26));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 50b6f5d..5892380 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 _0xe203=['duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','exit','catch','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','scheduledat','ListId','createdAt','updatedAt','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fromQuery','ContactId','fields','field','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','insert','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','push','spread','main','stringify','send','binding','socket_timestamp','server/files/tmp','.csv','writeFileSync','parse','data','hasOwnProperty','replace','isNaN','UserId','isNumber','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','length','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step'];(function(_0x202b7c,_0x143753){var _0x3b5401=function(_0x18d507){while(--_0x18d507){_0x202b7c['push'](_0x202b7c['shift']());}};_0x3b5401(++_0x143753);}(_0xe203,0x1a4));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x3e20('0x0'));var _=require('lodash');var Papa=require(_0x3e20('0x1'));var util=require('util');var BPromise=require(_0x3e20('0x2'));var moment=require(_0x3e20('0x3'));var squel=require(_0x3e20('0x4'));var Redis=require(_0x3e20('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x3e20('0x6'));var logger=require(_0x3e20('0x7'))(_0x3e20('0x8'));config[_0x3e20('0x9')]=_[_0x3e20('0xa')](config[_0x3e20('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e20('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x3e20('0xc')](_0x3e20('0xd'));function isEmail(_0x12e633){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))*$/[_0x3e20('0xe')](_0x12e633);}function selectNotIn(_0x25de2d,_0x365bdb,_0x33e44c,_0xe54c7a,_0x59f9b5){return squel[_0x3e20('0xf')]()['field'](_0x3e20('0x10'))['from'](_0xe54c7a)[_0x3e20('0x11')](_0x365bdb,null,_0x365bdb+_0x3e20('0x12')+_0xe54c7a+'.'+_0x33e44c)[_0x3e20('0x13')](_0xe54c7a+'.'+_0x33e44c+_0x3e20('0x14')+_0x25de2d+'.'+_0x33e44c)[_0x3e20('0x13')](_0x365bdb+_0x3e20('0x15')+_0x59f9b5[_0x3e20('0x11')]()+')');}function insertCmHopper(_0x310fef,_0x457a8d,_0x458dfd,_0x3f9eba,_0x4e4c05){var _0x23f90e=[_0x3e20('0x16'),_0x3e20('0x17'),_0x3e20('0x18'),_0x3e20('0x19'),_0x457a8d+'.'+_0x3f9eba,_0x3e20('0x1a'),_0x3e20('0x1b'),_0x3e20('0x1c'),_0x3e20('0x1d'),'\x22'+_0x4e4c05+'\x22'];return squel['insert']()[_0x3e20('0x1e')](_0x3e20('0x1f'))['fromQuery']([_0x3e20('0x10'),_0x3e20('0x20'),'ContactId',_0x3e20('0x21'),_0x3f9eba,_0x3e20('0x22'),_0x3e20('0x23'),'priority','UserId','recallme'],squel[_0x3e20('0xf')]()['fields'](_0x23f90e)[_0x3e20('0x24')](_0x457a8d)[_0x3e20('0x11')](_0x3e20('0x25'),null,_0x3e20('0x26')+_0x457a8d+_0x3e20('0x27'))['join'](_0x458dfd,null,_0x458dfd+'.id\x20=\x20'+_0x457a8d+'.'+_0x3f9eba)[_0x3e20('0x13')](_0x457a8d+_0x3e20('0x28'),_0x310fef)['where'](_0x3e20('0x29'),NOW)['where'](_0x3e20('0x2a'),selectNotIn(_0x457a8d,_0x458dfd,_0x3f9eba,_0x3e20('0x1f'),[_0x3e20('0x2b'),_0x3e20('0x2c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x457a8d,_0x458dfd,_0x3f9eba,_0x3e20('0x1f'),[_0x3e20('0x2b')])))[_0x3e20('0x2d')]();}function insertCmHopperBlack(_0x1ca737,_0x13d7ba,_0x9e8205,_0x5cb499){var _0x2abf3e=[_0x3e20('0x16'),'cm_contacts.id',_0x3e20('0x19'),_0x13d7ba+'.'+_0x5cb499,_0x3e20('0x1a'),_0x3e20('0x1b')];return squel['insert']()['into'](_0x3e20('0x2e'))[_0x3e20('0x2f')]([_0x3e20('0x10'),_0x3e20('0x30'),_0x3e20('0x21'),_0x5cb499,_0x3e20('0x22'),_0x3e20('0x23')],squel[_0x3e20('0xf')]()[_0x3e20('0x31')](_0x2abf3e)['from'](_0x13d7ba)[_0x3e20('0x11')]('cm_contacts',null,_0x3e20('0x26')+_0x13d7ba+_0x3e20('0x27'))[_0x3e20('0x11')](_0x9e8205,null,_0x9e8205+'.id\x20=\x20'+_0x13d7ba+'.'+_0x5cb499)[_0x3e20('0x13')](_0x13d7ba+_0x3e20('0x28'),_0x1ca737)['where'](_0x3e20('0x29'),NOW)[_0x3e20('0x13')](_0x3e20('0x2a'),squel['select']()[_0x3e20('0x32')](_0x3e20('0x10'))[_0x3e20('0x24')](_0x3e20('0x2e'))[_0x3e20('0x13')](_0x3e20('0x33'),_0x1ca737)[_0x3e20('0x13')](_0x5cb499+_0x3e20('0x34'),_0x13d7ba+'.'+_0x5cb499)))[_0x3e20('0x2d')]();}function insertCmContact(_0x2a994a,_0x1e2d9f,_0x4c4790,_0x2273c8){var _0x332dc7=_['concat'](_[_0x3e20('0x35')](_0x2273c8),[_0x3e20('0x21'),_0x3e20('0x36'),_0x3e20('0x22'),'updatedAt']);return squel[_0x3e20('0x37')]()[_0x3e20('0x1e')](_0x3e20('0x25'))[_0x3e20('0x2f')](_0x332dc7,squel[_0x3e20('0xf')]()[_0x3e20('0x31')](_0x332dc7)['from'](_0x1e2d9f)['where']('('+_0x4c4790[_0x3e20('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0x3e20('0xf')]()['fields'](_0x4c4790)['from']('cm_contacts')[_0x3e20('0x13')](_0x3e20('0x33'),_0x2a994a)[_0x3e20('0x13')](_0x3e20('0x38')))['where']('id\x20IN\x20?',squel['select']()['field'](_0x3e20('0x39'),_0x3e20('0x3a'))[_0x3e20('0x24')](_0x1e2d9f)[_0x3e20('0x3b')](_0x4c4790[_0x3e20('0x11')](','))))['toString']();}function handleStop(){logger[_0x3e20('0x3c')](_0x3e20('0x3d'));stopped=!![];}function handleUncaughtException(_0x2a11dd){logger[_0x3e20('0x3e')](_0x2a11dd[_0x3e20('0x3f')]);process['exit'](0x1);}function handleError(_0x1446c9,_0xe24add){stats[_0x3e20('0x40')][_0x3e20('0x41')]({'name':_0xe24add['code'],'message':_0xe24add[_0x3e20('0x3f')],'row':_0x1446c9});}function handleQuery(_0x2d2dae){logger['info'](_0x2d2dae);return db['sequelize']['query'](_0x2d2dae)[_0x3e20('0x42')](function(_0x3c5aac){results['push'](_0x3c5aac);})['catch'](function(_0x4154a2){logger['error'](_0x4154a2['message']);});}function main(_0x7c6c9f,_0x11986e,_0x5852ba,_0x43d593){logger[_0x3e20('0x3c')](_0x3e20('0x43'),_0x7c6c9f,JSON[_0x3e20('0x44')](_0x11986e));process[_0x3e20('0x45')]('start');var _0x215c13=_0x11986e[_0x3e20('0x46')];var _0x561c3f=_0x11986e[_0x3e20('0x47')];var _0x2391d8=path[_0x3e20('0x11')](config['root'],_0x3e20('0x48'),_0x561c3f+_0x3e20('0x49'));var _0x4a7e9d=_[_0x3e20('0x35')](_0x215c13)[_0x3e20('0x11')]();logger[_0x3e20('0x3c')]('header',_0x4a7e9d);fs[_0x3e20('0x4a')](_0x2391d8,_0x4a7e9d+'\x0a');Papa[_0x3e20('0x4b')](fs['createReadStream'](_0x7c6c9f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x20fb59,_0x135cf0){try{for(var _0x5a9ccc=0x0,_0x17cee7=[];_0x5a9ccc<_0x20fb59['data']['length'];_0x5a9ccc++){stats['rows']+=0x1;if(_0x20fb59[_0x3e20('0x40')][_0x5a9ccc]){handleError(_0x20fb59[_0x3e20('0x4c')][_0x5a9ccc],_0x20fb59['errors'][_0x5a9ccc]);}else{var _0x4078f0=[];for(var _0x2ef8a3 in _0x215c13){if(_0x215c13[_0x3e20('0x4d')](_0x2ef8a3)){if(_0x20fb59[_0x3e20('0x4c')][_0x5a9ccc][_0x215c13[_0x2ef8a3]]){var _0x119752=_['trim'](_0x20fb59['data'][_0x5a9ccc][_0x215c13[_0x2ef8a3]][_0x3e20('0x4e')](/"/g,'\x27'));switch(_0x2ef8a3){case'scheduledat':var _0x41c466=moment(_0x119752,_0x3e20('0xd'),!![]);if(_0x41c466['isValid']()){_0x17cee7[_0x3e20('0x41')]('\x22'+_0x119752+'\x22');}else{_0x4078f0[_0x3e20('0x41')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x3fc2e0=parseInt(_0x119752);_0x119752=_[_0x3e20('0x4f')](_0x3fc2e0)||_0x3fc2e0<0x0||_0x3fc2e0>0x4?_0x43d593?0x3:0x2:_0x3fc2e0;_0x17cee7[_0x3e20('0x41')]('\x22'+_0x119752+'\x22');break;case _0x3e20('0x50'):var _0x1939fc=parseInt(_0x119752);if(_[_0x3e20('0x51')](_0x1939fc)&&_['includes'](_0x5852ba,_0x1939fc)){_0x17cee7[_0x3e20('0x41')]('\x22'+_0x1939fc+'\x22');}else{_0x4078f0[_0x3e20('0x41')]('agent\x20not\x20exists');}break;case _0x3e20('0x52'):if(isEmail(_0x119752)){_0x17cee7['push']('\x22'+_0x119752+'\x22');}else{_0x4078f0['push']('email\x20wrong\x20format');}break;case _0x3e20('0x53'):var _0x2c4b21=moment(_0x119752,_0x3e20('0x54'),!![]);if(_0x2c4b21['isValid']()){_0x17cee7[_0x3e20('0x41')]('\x22'+_0x119752+'\x22');}else{_0x4078f0[_0x3e20('0x41')](_0x3e20('0x55'));}break;default:_0x17cee7['push']('\x22'+_0x119752+'\x22');}}else{switch(_0x2ef8a3){case'firstName':case _0x3e20('0x10'):_0x4078f0[_0x3e20('0x41')](_0x2ef8a3+_0x3e20('0x56'));break;default:_0x17cee7[_0x3e20('0x41')]('\x22\x22');}}}}if(_0x4078f0[_0x3e20('0x57')]){handleError(_0x20fb59[_0x3e20('0x4c')][_0x5a9ccc],{'code':'SystemRow','message':_0x4078f0[_0x3e20('0x11')]()});}else{fs[_0x3e20('0x58')](_0x2391d8,_0x17cee7[_0x3e20('0x11')]()+'\x0a');}_0x17cee7=[];}if(!(stats[_0x3e20('0x59')]%0xc8)){socket[_0x3e20('0x5a')](_0x3e20('0x5b')+_0x561c3f,stats);stats[_0x3e20('0x40')]=[];}}if(stopped){logger[_0x3e20('0x3c')](_0x3e20('0x5c'));_0x135cf0[_0x3e20('0x5d')]();}}catch(_0xf22bb6){handleError(_0x20fb59[_0x3e20('0x4c')][_0x5a9ccc],{'code':_0x3e20('0x5e'),'message':_0xf22bb6[_0x3e20('0x3f')]});logger[_0x3e20('0x3e')](_0x3e20('0x5f'),_0xf22bb6[_0x3e20('0x3f')]);}},'complete':function(){try{var _0xfe06cf=[];var _0x1682de=_0x3e20('0x25');if(_0x11986e['duplicates']&&_0x11986e[_0x3e20('0x60')][_0x3e20('0x57')]){_0x1682de=_0x3e20('0x61')+_0x561c3f;_0xfe06cf[_0x3e20('0x41')](_0x3e20('0x62')+_0x1682de+_0x3e20('0x63'));}var _0x584a17=util[_0x3e20('0xc')](_0x3e20('0x64'),_0x2391d8,_0x1682de,_0x4a7e9d,_0x11986e[_0x3e20('0x21')],_0x11986e['CompanyId']||null,NOW,NOW);if(_[_0x3e20('0x65')](_0x215c13['scheduledat'])){_0x584a17+=_0x3e20('0x66');}_0xfe06cf[_0x3e20('0x41')](_0x584a17);if(_0x11986e[_0x3e20('0x60')]&&_0x11986e[_0x3e20('0x60')]['length']){_0xfe06cf[_0x3e20('0x41')](insertCmContact(_0x11986e[_0x3e20('0x21')],_0x1682de,_0x11986e['duplicates'],_0x215c13));_0xfe06cf[_0x3e20('0x41')](_0x3e20('0x67')+_0x1682de+';');}_0xfe06cf['push'](insertCmHopper(_0x11986e[_0x3e20('0x21')],_0x3e20('0x68'),_0x3e20('0x69'),_0x3e20('0x6a'),_0x43d593));_0xfe06cf[_0x3e20('0x41')](insertCmHopperBlack(_0x11986e[_0x3e20('0x21')],_0x3e20('0x6b'),'voice_queues',_0x3e20('0x6a')));_0xfe06cf[_0x3e20('0x41')](insertCmHopper(_0x11986e[_0x3e20('0x21')],'campaigns_has_cm_lists',_0x3e20('0x6c'),_0x3e20('0x6d'),_0x43d593));_0xfe06cf[_0x3e20('0x41')](insertCmHopperBlack(_0x11986e['ListId'],_0x3e20('0x6e'),'campaigns',_0x3e20('0x6d')));BPromise[_0x3e20('0x6f')](_0xfe06cf,handleQuery)[_0x3e20('0x70')](function(_0x284146){stats[_0x3e20('0x71')]=!![];stats[_0x3e20('0x72')]=_0x11986e['duplicates']&&_0x11986e[_0x3e20('0x60')][_0x3e20('0x57')]?results[0x2][_0x3e20('0x72')]:results[0x0][_0x3e20('0x72')];socket['emit'](_0x3e20('0x5b')+_0x561c3f,stats);fs['unlink'](_0x7c6c9f);fs[_0x3e20('0x73')](_0x2391d8);process[_0x3e20('0x74')](0x0);})[_0x3e20('0x75')](function(_0x3da6dc){logger[_0x3e20('0x3e')](_0x3da6dc['message']);process[_0x3e20('0x74')](0x1);});}catch(_0x189b06){logger[_0x3e20('0x3e')](_0x3e20('0x76'),_0x189b06[_0x3e20('0x3f')]);process[_0x3e20('0x74')](0x1);}},'error':function(_0x20a8a4,_0x47e47b,_0x2d3491,_0x520df4){throw new Error(_0x520df4);}});}function validate(){if(process[_0x3e20('0x77')]&&process['argv'][_0x3e20('0x57')]<0x4){throw new Error(_0x3e20('0x78'));}var _0x470edf=path[_0x3e20('0x11')](config[_0x3e20('0x79')],_0x3e20('0x48'),process[_0x3e20('0x77')][0x2]);if(!fs[_0x3e20('0x7a')](_0x470edf)){throw new Error(_0x3e20('0x7b'));}var _0x43f3f3={};try{_0x43f3f3=JSON[_0x3e20('0x4b')](process['argv'][0x3]);if(!_0x43f3f3['binding']){throw new Error(_0x3e20('0x7c'));}if(!_0x43f3f3[_0x3e20('0x46')][_0x3e20('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x43f3f3[_0x3e20('0x46')]['firstName']){throw new Error(_0x3e20('0x7d'));}var _0x4d3b88=0x0;if(_0x43f3f3[_0x3e20('0x46')][_0x3e20('0x50')]){_0x4d3b88=0x1;}if(!_0x43f3f3[_0x3e20('0x21')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1d593e){throw new Error(_0x3e20('0x7e'));}var _0x2f55fc=[];try{_0x2f55fc=_[_0x3e20('0x7f')](JSON[_0x3e20('0x4b')](process[_0x3e20('0x77')][0x4]),'id');}catch(_0xc81b74){logger['info'](_0x3e20('0x80'));}main(_0x470edf,_0x43f3f3,_0x2f55fc,_0x4d3b88);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xe068=['moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','format','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','Received\x20SIGINT','message','exit','push','code','info','sequelize','query','spread','catch','error','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','errors','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird'];(function(_0x1b1743,_0x3cc1d7){var _0x1770d7=function(_0x505bea){while(--_0x505bea){_0x1b1743['push'](_0x1b1743['shift']());}};_0x1770d7(++_0x3cc1d7);}(_0xe068,0x111));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x8e06('0x0'));var _=require(_0x8e06('0x1'));var Papa=require(_0x8e06('0x2'));var util=require(_0x8e06('0x3'));var BPromise=require(_0x8e06('0x4'));var moment=require(_0x8e06('0x5'));var squel=require(_0x8e06('0x6'));var Redis=require(_0x8e06('0x7'));var db=require(_0x8e06('0x8'))['db'];var config=require(_0x8e06('0x9'));var logger=require(_0x8e06('0xa'))('import');config[_0x8e06('0xb')]=_[_0x8e06('0xc')](config[_0x8e06('0xb')],{'host':_0x8e06('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e06('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x8e06('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x571787){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))*$/[_0x8e06('0xf')](_0x571787);}function selectNotIn(_0x5b5860,_0x2f560c,_0x76f5f0,_0x1261e4,_0x1b9d35){return squel[_0x8e06('0x10')]()[_0x8e06('0x11')](_0x8e06('0x12'))['from'](_0x1261e4)[_0x8e06('0x13')](_0x2f560c,null,_0x2f560c+_0x8e06('0x14')+_0x1261e4+'.'+_0x76f5f0)[_0x8e06('0x15')](_0x1261e4+'.'+_0x76f5f0+_0x8e06('0x16')+_0x5b5860+'.'+_0x76f5f0)['where'](_0x2f560c+_0x8e06('0x17')+_0x1b9d35[_0x8e06('0x13')]()+')');}function insertCmHopper(_0x487183,_0x51af9c,_0x6d6463,_0x5c3928,_0x415d9e){var _0x17843a=[_0x8e06('0x18'),'cm_contacts.scheduledat',_0x8e06('0x19'),'cm_contacts.ListId',_0x51af9c+'.'+_0x5c3928,'cm_contacts.createdAt',_0x8e06('0x1a'),_0x8e06('0x1b'),_0x8e06('0x1c'),'\x22'+_0x415d9e+'\x22'];return squel[_0x8e06('0x1d')]()[_0x8e06('0x1e')](_0x8e06('0x1f'))[_0x8e06('0x20')]([_0x8e06('0x12'),_0x8e06('0x21'),_0x8e06('0x22'),_0x8e06('0x23'),_0x5c3928,_0x8e06('0x24'),_0x8e06('0x25'),_0x8e06('0x26'),'UserId','recallme'],squel[_0x8e06('0x10')]()[_0x8e06('0x27')](_0x17843a)[_0x8e06('0x28')](_0x51af9c)['join'](_0x8e06('0x29'),null,_0x8e06('0x2a')+_0x51af9c+_0x8e06('0x2b'))[_0x8e06('0x13')](_0x6d6463,null,_0x6d6463+_0x8e06('0x14')+_0x51af9c+'.'+_0x5c3928)[_0x8e06('0x15')](_0x51af9c+_0x8e06('0x2c'),_0x487183)[_0x8e06('0x15')](_0x8e06('0x2d'),NOW)['where'](_0x8e06('0x2e'),selectNotIn(_0x51af9c,_0x6d6463,_0x5c3928,_0x8e06('0x1f'),[_0x8e06('0x2f'),'\x22onlyIfOpen\x22']))[_0x8e06('0x15')](_0x8e06('0x2e'),selectNotIn(_0x51af9c,_0x6d6463,_0x5c3928,'cm_hopper',[_0x8e06('0x2f')])))[_0x8e06('0x30')]();}function insertCmHopperBlack(_0x227af1,_0x2d20cc,_0x8266d9,_0x599818){var _0x25dd12=[_0x8e06('0x18'),_0x8e06('0x19'),'cm_contacts.ListId',_0x2d20cc+'.'+_0x599818,'cm_contacts.createdAt',_0x8e06('0x1a')];return squel[_0x8e06('0x1d')]()[_0x8e06('0x1e')](_0x8e06('0x31'))[_0x8e06('0x20')](['phone','ContactId','ListId',_0x599818,'createdAt',_0x8e06('0x25')],squel[_0x8e06('0x10')]()[_0x8e06('0x27')](_0x25dd12)[_0x8e06('0x28')](_0x2d20cc)[_0x8e06('0x13')](_0x8e06('0x29'),null,'cm_contacts.ListId\x20=\x20'+_0x2d20cc+_0x8e06('0x2b'))['join'](_0x8266d9,null,_0x8266d9+_0x8e06('0x14')+_0x2d20cc+'.'+_0x599818)[_0x8e06('0x15')](_0x2d20cc+_0x8e06('0x2c'),_0x227af1)[_0x8e06('0x15')](_0x8e06('0x2d'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x8e06('0x11')](_0x8e06('0x12'))[_0x8e06('0x28')](_0x8e06('0x31'))['where'](_0x8e06('0x32'),_0x227af1)[_0x8e06('0x15')](_0x599818+_0x8e06('0x33'),_0x2d20cc+'.'+_0x599818)))[_0x8e06('0x30')]();}function insertCmContact(_0x4500a2,_0x17e730,_0x4184e3,_0x465a70){var _0x1fb931=_[_0x8e06('0x34')](_[_0x8e06('0x35')](_0x465a70),[_0x8e06('0x23'),_0x8e06('0x36'),'createdAt',_0x8e06('0x25')]);return squel[_0x8e06('0x1d')]()['into'](_0x8e06('0x29'))[_0x8e06('0x20')](_0x1fb931,squel[_0x8e06('0x10')]()[_0x8e06('0x27')](_0x1fb931)[_0x8e06('0x28')](_0x17e730)[_0x8e06('0x15')]('('+_0x4184e3[_0x8e06('0x13')](',')+_0x8e06('0x37'),squel[_0x8e06('0x10')]()[_0x8e06('0x27')](_0x4184e3)[_0x8e06('0x28')](_0x8e06('0x29'))['where']('ListId\x20=\x20?',_0x4500a2)[_0x8e06('0x15')](_0x8e06('0x38')))[_0x8e06('0x15')](_0x8e06('0x39'),squel[_0x8e06('0x10')]()[_0x8e06('0x11')]('MIN(id)',_0x8e06('0x3a'))[_0x8e06('0x28')](_0x17e730)[_0x8e06('0x3b')](_0x4184e3[_0x8e06('0x13')](','))))[_0x8e06('0x30')]();}function handleStop(){logger['info'](_0x8e06('0x3c'));stopped=!![];}function handleUncaughtException(_0x3b0a5d){logger['error'](_0x3b0a5d[_0x8e06('0x3d')]);process[_0x8e06('0x3e')](0x1);}function handleError(_0x494ec6,_0x27214a){stats['errors'][_0x8e06('0x3f')]({'name':_0x27214a[_0x8e06('0x40')],'message':_0x27214a['message'],'row':_0x494ec6});}function handleQuery(_0x23c5fa){logger[_0x8e06('0x41')](_0x23c5fa);return db[_0x8e06('0x42')][_0x8e06('0x43')](_0x23c5fa)[_0x8e06('0x44')](function(_0x4f4323){results[_0x8e06('0x3f')](_0x4f4323);})[_0x8e06('0x45')](function(_0x6be189){logger[_0x8e06('0x46')](_0x6be189['message']);});}function main(_0x3f2522,_0x19da12,_0x4a065c,_0x34ff5d){logger['info'](_0x8e06('0x47'),_0x3f2522,JSON[_0x8e06('0x48')](_0x19da12));process[_0x8e06('0x49')](_0x8e06('0x4a'));var _0x1c2f77=_0x19da12[_0x8e06('0x4b')];var _0x44f1c8=_0x19da12[_0x8e06('0x4c')];var _0x36fb7a=path[_0x8e06('0x13')](config[_0x8e06('0x4d')],_0x8e06('0x4e'),_0x44f1c8+_0x8e06('0x4f'));var _0x485237=_[_0x8e06('0x35')](_0x1c2f77)[_0x8e06('0x13')]();logger[_0x8e06('0x41')](_0x8e06('0x50'),_0x485237);fs[_0x8e06('0x51')](_0x36fb7a,_0x485237+'\x0a');Papa[_0x8e06('0x52')](fs[_0x8e06('0x53')](_0x3f2522),{'header':!![],'skipEmptyLines':!![],'step':function(_0x41d2ab,_0x2624bf){try{for(var _0x245a0e=0x0,_0x11b44a=[];_0x245a0e<_0x41d2ab[_0x8e06('0x54')][_0x8e06('0x55')];_0x245a0e++){stats['rows']+=0x1;if(_0x41d2ab[_0x8e06('0x56')][_0x245a0e]){handleError(_0x41d2ab[_0x8e06('0x54')][_0x245a0e],_0x41d2ab[_0x8e06('0x56')][_0x245a0e]);}else{var _0x477e37=[];for(var _0x168a93 in _0x1c2f77){if(_0x1c2f77[_0x8e06('0x57')](_0x168a93)){if(_0x41d2ab[_0x8e06('0x54')][_0x245a0e][_0x1c2f77[_0x168a93]]){var _0x59361e=_['trim'](_0x41d2ab['data'][_0x245a0e][_0x1c2f77[_0x168a93]][_0x8e06('0x58')](/"/g,'\x27'));switch(_0x168a93){case _0x8e06('0x21'):var _0x3a32fd=moment(_0x59361e,_0x8e06('0x59'),!![]);if(_0x3a32fd['isValid']()){_0x11b44a['push']('\x22'+_0x59361e+'\x22');}else{_0x477e37[_0x8e06('0x3f')](_0x8e06('0x5a'));}break;case _0x8e06('0x26'):var _0x386c91=parseInt(_0x59361e);_0x59361e=_[_0x8e06('0x5b')](_0x386c91)||_0x386c91<0x0||_0x386c91>0x4?_0x34ff5d?0x3:0x2:_0x386c91;_0x11b44a[_0x8e06('0x3f')]('\x22'+_0x59361e+'\x22');break;case _0x8e06('0x5c'):var _0x171696=parseInt(_0x59361e);if(_[_0x8e06('0x5d')](_0x171696)&&_[_0x8e06('0x5e')](_0x4a065c,_0x171696)){_0x11b44a[_0x8e06('0x3f')]('\x22'+_0x171696+'\x22');}else{_0x477e37['push'](_0x8e06('0x5f'));}break;case _0x8e06('0x60'):if(isEmail(_0x59361e)){_0x11b44a[_0x8e06('0x3f')]('\x22'+_0x59361e+'\x22');}else{_0x477e37[_0x8e06('0x3f')]('email\x20wrong\x20format');}break;case _0x8e06('0x61'):var _0x33de98=moment(_0x59361e,_0x8e06('0x62'),!![]);if(_0x33de98[_0x8e06('0x63')]()){_0x11b44a[_0x8e06('0x3f')]('\x22'+_0x59361e+'\x22');}else{_0x477e37[_0x8e06('0x3f')](_0x8e06('0x64'));}break;default:_0x11b44a[_0x8e06('0x3f')]('\x22'+_0x59361e+'\x22');}}else{switch(_0x168a93){case _0x8e06('0x65'):case _0x8e06('0x12'):_0x477e37[_0x8e06('0x3f')](_0x168a93+_0x8e06('0x66'));break;default:_0x11b44a[_0x8e06('0x3f')]('\x22\x22');}}}}if(_0x477e37['length']){handleError(_0x41d2ab['data'][_0x245a0e],{'code':_0x8e06('0x67'),'message':_0x477e37[_0x8e06('0x13')]()});}else{fs[_0x8e06('0x68')](_0x36fb7a,_0x11b44a['join']()+'\x0a');}_0x11b44a=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x8e06('0x69')+_0x44f1c8,stats);stats[_0x8e06('0x56')]=[];}}if(stopped){logger[_0x8e06('0x41')](_0x8e06('0x6a'));_0x2624bf[_0x8e06('0x6b')]();}}catch(_0x487c6a){handleError(_0x41d2ab[_0x8e06('0x54')][_0x245a0e],{'code':_0x8e06('0x6c'),'message':_0x487c6a[_0x8e06('0x3d')]});logger[_0x8e06('0x46')](_0x8e06('0x6d'),_0x487c6a[_0x8e06('0x3d')]);}},'complete':function(){try{var _0x296fe9=[];var _0x252129=_0x8e06('0x29');if(_0x19da12[_0x8e06('0x6e')]&&_0x19da12[_0x8e06('0x6e')][_0x8e06('0x55')]){_0x252129='cm_contacts_'+_0x44f1c8;_0x296fe9['push'](_0x8e06('0x6f')+_0x252129+_0x8e06('0x70'));}var _0x4ebb6d=util[_0x8e06('0xe')](_0x8e06('0x71'),_0x36fb7a,_0x252129,_0x485237,_0x19da12[_0x8e06('0x23')],_0x19da12['CompanyId']||null,NOW,NOW);if(_[_0x8e06('0x72')](_0x1c2f77[_0x8e06('0x21')])){_0x4ebb6d+=_0x8e06('0x73');}_0x296fe9['push'](_0x4ebb6d);if(_0x19da12['duplicates']&&_0x19da12[_0x8e06('0x6e')]['length']){_0x296fe9[_0x8e06('0x3f')](insertCmContact(_0x19da12[_0x8e06('0x23')],_0x252129,_0x19da12['duplicates'],_0x1c2f77));_0x296fe9[_0x8e06('0x3f')]('DROP\x20TABLE\x20'+_0x252129+';');}_0x296fe9[_0x8e06('0x3f')](insertCmHopper(_0x19da12[_0x8e06('0x23')],_0x8e06('0x74'),_0x8e06('0x75'),_0x8e06('0x76'),_0x34ff5d));_0x296fe9[_0x8e06('0x3f')](insertCmHopperBlack(_0x19da12[_0x8e06('0x23')],'voice_queues_has_cm_blacklists',_0x8e06('0x75'),'VoiceQueueId'));_0x296fe9[_0x8e06('0x3f')](insertCmHopper(_0x19da12['ListId'],_0x8e06('0x77'),_0x8e06('0x78'),_0x8e06('0x79'),_0x34ff5d));_0x296fe9[_0x8e06('0x3f')](insertCmHopperBlack(_0x19da12[_0x8e06('0x23')],_0x8e06('0x7a'),_0x8e06('0x78'),_0x8e06('0x79')));BPromise[_0x8e06('0x7b')](_0x296fe9,handleQuery)[_0x8e06('0x7c')](function(_0x70ad0f){stats['finish']=!![];stats['affectedRows']=_0x19da12['duplicates']&&_0x19da12[_0x8e06('0x6e')][_0x8e06('0x55')]?results[0x2][_0x8e06('0x7d')]:results[0x0][_0x8e06('0x7d')];socket['emit']('contact:import:'+_0x44f1c8,stats);fs[_0x8e06('0x7e')](_0x3f2522);fs[_0x8e06('0x7e')](_0x36fb7a);process[_0x8e06('0x3e')](0x0);})[_0x8e06('0x45')](function(_0x21471f){logger[_0x8e06('0x46')](_0x21471f[_0x8e06('0x3d')]);process['exit'](0x1);});}catch(_0x404c39){logger['error'](_0x8e06('0x7f'),_0x404c39[_0x8e06('0x3d')]);process[_0x8e06('0x3e')](0x1);}},'error':function(_0xdf6b20,_0x8ec57e,_0x2de828,_0x5640d8){throw new Error(_0x5640d8);}});}function validate(){if(process[_0x8e06('0x80')]&&process['argv'][_0x8e06('0x55')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x9ab3d2=path['join'](config[_0x8e06('0x4d')],_0x8e06('0x4e'),process[_0x8e06('0x80')][0x2]);if(!fs[_0x8e06('0x81')](_0x9ab3d2)){throw new Error(_0x8e06('0x82'));}var _0x3748ba={};try{_0x3748ba=JSON[_0x8e06('0x52')](process['argv'][0x3]);if(!_0x3748ba[_0x8e06('0x4b')]){throw new Error(_0x8e06('0x83'));}if(!_0x3748ba['binding']['phone']){throw new Error(_0x8e06('0x84'));}if(!_0x3748ba[_0x8e06('0x4b')][_0x8e06('0x65')]){throw new Error(_0x8e06('0x85'));}var _0x58b7e9=0x0;if(_0x3748ba[_0x8e06('0x4b')]['UserId']){_0x58b7e9=0x1;}if(!_0x3748ba['ListId']){throw new Error(_0x8e06('0x86'));}}catch(_0x3636d0){throw new Error(_0x8e06('0x87'));}var _0x288699=[];try{_0x288699=_[_0x8e06('0x88')](JSON[_0x8e06('0x52')](process['argv'][0x4]),'id');}catch(_0xb9134a){logger[_0x8e06('0x41')]('No\x20agent\x20available');}main(_0x9ab3d2,_0x3748ba,_0x288699,_0x58b7e9);}validate();process['on'](_0x8e06('0x89'),handleStop);process['on'](_0x8e06('0x8a'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index aa875c9..df120de 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 _0x7320=['Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','calleridname','keyValue','Call\x20To','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound'];(function(_0x5214fd,_0x238b9d){var _0x4c22f8=function(_0x53b8bf){while(--_0x53b8bf){_0x5214fd['push'](_0x5214fd['shift']());}};_0x4c22f8(++_0x238b9d);}(_0x7320,0xd0));var _0x0732=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7320[_0x3bf83f];return _0x22c4a9;};'use strict';exports['getSubjects']=function(_0x494e33,_0xb17e26){var _0x59112d=[{'type':_0x0732('0x0'),'content':_0x0732('0x1'),'variableName':null}];switch(_0x494e33[_0x0732('0x2')]()){case _0x0732('0x3'):switch(_0xb17e26['toLowerCase']()){case _0x0732('0x4'):_0x59112d[_0x0732('0x5')]({'type':_0x0732('0x6'),'content':'','variableName':_0x0732('0x7')});_0x59112d[_0x0732('0x5')]({'type':'variable','content':'','variableName':_0x0732('0x8')});break;case'outbound':_0x59112d[_0x0732('0x5')]({'type':_0x0732('0x0'),'content':_0x0732('0x9'),'variableName':null});_0x59112d[_0x0732('0x5')]({'type':_0x0732('0x6'),'content':'','variableName':_0x0732('0xa')});break;}}return _0x59112d;};exports[_0x0732('0xb')]=function(_0x62523a,_0x3b5352){var _0x582445=[];switch(_0x62523a['toLowerCase']()){case _0x0732('0x3'):switch(_0x3b5352['toLowerCase']()){case'inbound':_0x582445=[{'type':'string','content':_0x0732('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x0732('0xd'),'keyType':_0x0732('0x6'),'variableName':_0x0732('0x8')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':_0x0732('0x6'),'variableName':_0x0732('0xe')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x10'),'keyType':'variable','variableName':'destexten'},{'type':'keyValue','content':'','key':_0x0732('0x11'),'keyType':_0x0732('0x6'),'variableName':_0x0732('0x7')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x12'),'keyType':'variable','variableName':_0x0732('0x13')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x14'),'keyType':_0x0732('0x6'),'variableName':_0x0732('0x15')},{'type':_0x0732('0x0'),'content':_0x0732('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x17'),'keyType':_0x0732('0x6'),'variableName':_0x0732('0x18')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x19'),'keyType':'variable','variableName':'destcalleridnum'},{'type':'string','content':_0x0732('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x1b'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x1c'),'keyType':_0x0732('0x6'),'variableName':_0x0732('0x1d')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x1e'),'keyType':'variable','variableName':_0x0732('0x1f')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x20'),'keyType':_0x0732('0x6'),'variableName':_0x0732('0x21')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x22'),'keyType':'variable','variableName':_0x0732('0x23')}];break;case _0x0732('0x24'):_0x582445=[{'type':_0x0732('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x25'),'keyType':_0x0732('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x26'),'keyType':_0x0732('0x6'),'keyContent':'','variableName':_0x0732('0x27')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x12'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x14'),'keyType':'variable','keyContent':'','variableName':_0x0732('0x28')},{'type':_0x0732('0x0'),'content':_0x0732('0x1a')},{'type':'keyValue','content':'','key':_0x0732('0x29'),'keyType':'variable','keyContent':'','variableName':_0x0732('0x2a')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x2b'),'keyType':_0x0732('0x6'),'keyContent':'','variableName':_0x0732('0x2c')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x2d'),'keyType':_0x0732('0x6'),'keyContent':'','variableName':_0x0732('0x2e')},{'type':_0x0732('0xf'),'content':'','key':_0x0732('0x2f'),'keyType':_0x0732('0x6'),'keyContent':'','variableName':_0x0732('0x30')}];break;}}return _0x582445;}; \ No newline at end of file +var _0x8b7b=['Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','Caller\x20Number','keyValue','Caller\x20Name','calleridname','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','agentconnectAt','agentcompleteAt'];(function(_0x13c108,_0x56ab5c){var _0x17ff51=function(_0x54a66a){while(--_0x54a66a){_0x13c108['push'](_0x13c108['shift']());}};_0x17ff51(++_0x56ab5c);}(_0x8b7b,0x136));var _0xb8b7=function(_0x3d10db,_0x216442){_0x3d10db=_0x3d10db-0x0;var _0x433cbe=_0x8b7b[_0x3d10db];return _0x433cbe;};'use strict';exports['getSubjects']=function(_0x428072,_0x14e016){var _0x1349ae=[{'type':_0xb8b7('0x0'),'content':_0xb8b7('0x1'),'variableName':null}];switch(_0x428072[_0xb8b7('0x2')]()){case _0xb8b7('0x3'):switch(_0x14e016[_0xb8b7('0x2')]()){case _0xb8b7('0x4'):_0x1349ae[_0xb8b7('0x5')]({'type':_0xb8b7('0x6'),'content':'','variableName':_0xb8b7('0x7')});_0x1349ae['push']({'type':_0xb8b7('0x6'),'content':'','variableName':_0xb8b7('0x8')});break;case _0xb8b7('0x9'):_0x1349ae['push']({'type':'string','content':_0xb8b7('0xa'),'variableName':null});_0x1349ae['push']({'type':_0xb8b7('0x6'),'content':'','variableName':_0xb8b7('0xb')});break;}}return _0x1349ae;};exports[_0xb8b7('0xc')]=function(_0x46848b,_0x5d4770){var _0x4efabe=[];switch(_0x46848b[_0xb8b7('0x2')]()){case _0xb8b7('0x3'):switch(_0x5d4770[_0xb8b7('0x2')]()){case'inbound':_0x4efabe=[{'type':_0xb8b7('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb8b7('0xd'),'keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0x8')},{'type':_0xb8b7('0xe'),'content':'','key':_0xb8b7('0xf'),'keyType':'variable','variableName':_0xb8b7('0x10')},{'type':_0xb8b7('0xe'),'content':'','key':'Call\x20To','keyType':'variable','variableName':'destexten'},{'type':_0xb8b7('0xe'),'content':'','key':'Queue','keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0x7')},{'type':_0xb8b7('0xe'),'content':'','key':'UniqueId','keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0x11')},{'type':_0xb8b7('0xe'),'content':'','key':_0xb8b7('0x12'),'keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0x13')},{'type':_0xb8b7('0x0'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb8b7('0x14'),'keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0x15')},{'type':_0xb8b7('0xe'),'content':'','key':_0xb8b7('0x16'),'keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0xb')},{'type':'string','content':_0xb8b7('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0x13')},{'type':_0xb8b7('0xe'),'content':'','key':'Agent\x20Connect','keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0x18')},{'type':_0xb8b7('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0x19')},{'type':'keyValue','content':'','key':_0xb8b7('0x1a'),'keyType':'variable','variableName':_0xb8b7('0x1b')},{'type':_0xb8b7('0xe'),'content':'','key':_0xb8b7('0x1c'),'keyType':_0xb8b7('0x6'),'variableName':_0xb8b7('0x1d')}];break;case _0xb8b7('0x9'):_0x4efabe=[{'type':_0xb8b7('0x0'),'content':_0xb8b7('0x1e'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0xb8b7('0xb')},{'type':_0xb8b7('0xe'),'content':'','key':_0xb8b7('0x1f'),'keyType':_0xb8b7('0x6'),'keyContent':'','variableName':_0xb8b7('0x20')},{'type':_0xb8b7('0xe'),'content':'','key':_0xb8b7('0x21'),'keyType':'variable','keyContent':'','variableName':_0xb8b7('0x11')},{'type':_0xb8b7('0xe'),'content':'','key':_0xb8b7('0x12'),'keyType':_0xb8b7('0x6'),'keyContent':'','variableName':_0xb8b7('0x22')},{'type':_0xb8b7('0x0'),'content':_0xb8b7('0x17')},{'type':'keyValue','content':'','key':_0xb8b7('0x23'),'keyType':_0xb8b7('0x6'),'keyContent':'','variableName':_0xb8b7('0x24')},{'type':_0xb8b7('0xe'),'content':'','key':_0xb8b7('0x25'),'keyType':_0xb8b7('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xb8b7('0xe'),'content':'','key':_0xb8b7('0x26'),'keyType':_0xb8b7('0x6'),'keyContent':'','variableName':_0xb8b7('0x27')},{'type':'keyValue','content':'','key':_0xb8b7('0x28'),'keyType':_0xb8b7('0x6'),'keyContent':'','variableName':_0xb8b7('0x29')}];break;}}return _0x4efabe;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index ecfedce..df46411 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 _0x766f=['chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','Interaction','then','info','catch','tracked','user','clone','omit','body','html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x766f,0x109));var _0xf766=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x766f[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xf766('0x0'));var db=require(_0xf766('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xf766('0x2')),'mail':require(_0xf766('0x3'))('mail-interactions'),'fax':require(_0xf766('0x3'))(_0xf766('0x4')),'sms':require(_0xf766('0x3'))('sms-interactions'),'chat':require(_0xf766('0x3'))(_0xf766('0x5')),'whatsapp':require(_0xf766('0x3'))(_0xf766('0x6'))};function getInteractionId(_0x52539a,_0x3131de,_0x2149da){if(_0x52539a&&_0x52539a[_['upperFirst'](_0x2149da)+'InteractionId']){return _0x52539a[_[_0xf766('0x7')](_0x2149da)+_0xf766('0x8')];}else if(_0x52539a&&_0x52539a['id']){return _0x52539a['id'];}else if(_0x3131de&&_0x3131de['id']){return _0x3131de['id'];}else{return'unknown';}}function log(_0x14f60b,_0x58b284,_0x5ef898,_0xb2911e,_0x49b5b8,_0x53704c){loggers[_0x49b5b8[_0xf766('0x9')]()][_0x14f60b](_0xf766('0xa'),_0x53704c['toUpperCase'](),_0x58b284?_0x58b284['id']:null,_0x58b284?_0x58b284['name']:null,_0x58b284?_0x58b284[_0xf766('0xb')]:null,getInteractionId(_0x5ef898,_0xb2911e,_0x49b5b8),_0x5ef898?JSON[_0xf766('0xc')](_0x5ef898):_0xf766('0xd'));}function updateUser(_0x3f4065,_0x229177,_0x307cac,_0x26a186,_0x389175){db[_[_0xf766('0x7')](_0x26a186)+_0xf766('0xe')]['findOne']({'where':{'id':getInteractionId(_0x229177,_0x307cac,_0x26a186)}})[_0xf766('0xf')](function(_0x4f0d4c){if(_0x4f0d4c){return _0x4f0d4c['update']({'UserId':_0x3f4065?_0x3f4065['id']:null});}})[_0xf766('0xf')](function(_0x490f25){if(_0x490f25){log(_0xf766('0x10'),_0x3f4065,_0x229177,_0x307cac,_0x26a186,_0x389175);}})[_0xf766('0x11')](function(){log('error',_0x3f4065,_0x229177,_0x307cac,_0x26a186,_0x389175);});}exports[_0xf766('0x12')]=function(_0x2f5322,_0x3cae23){return function(_0x15a0ef,_0x54d671,_0x1fbe71){var _0x3d8406=_0x15a0ef[_0xf766('0x13')];var _0x403fcf={};var _0x230ceb=_0x15a0ef['query'];if(_0x403fcf){_0x403fcf=_[_0xf766('0x14')](_0x15a0ef['body']);_0x403fcf=_[_0xf766('0x15')](_0x403fcf,[_0xf766('0x16'),_0xf766('0x17'),_0xf766('0x18'),_0xf766('0x19'),_0xf766('0x1a')]);}updateUser(_0x3d8406,_0x403fcf,_0x230ceb,_0x2f5322,_0x3cae23);_0x1fbe71(null);};}; \ No newline at end of file +var _0x8f09=['user','clone','body','omit','html','phone','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','upperFirst','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','then','info','catch','error','tracked'];(function(_0x2ea08a,_0x240f73){var _0x5401ad=function(_0x194c90){while(--_0x194c90){_0x2ea08a['push'](_0x2ea08a['shift']());}};_0x5401ad(++_0x240f73);}(_0x8f09,0x19c));var _0x98f0=function(_0x591306,_0xab05e1){_0x591306=_0x591306-0x0;var _0x9ee7a3=_0x8f09[_0x591306];return _0x9ee7a3;};'use strict';var _=require(_0x98f0('0x0'));var db=require(_0x98f0('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x98f0('0x2')),'mail':require(_0x98f0('0x3'))('mail-interactions'),'fax':require(_0x98f0('0x3'))(_0x98f0('0x4')),'sms':require('../../config/logger')(_0x98f0('0x5')),'chat':require(_0x98f0('0x3'))(_0x98f0('0x6')),'whatsapp':require(_0x98f0('0x3'))('whatsapp-interactions')};function getInteractionId(_0xcf1bb1,_0x2c262c,_0x2befc4){if(_0xcf1bb1&&_0xcf1bb1[_['upperFirst'](_0x2befc4)+'InteractionId']){return _0xcf1bb1[_[_0x98f0('0x7')](_0x2befc4)+'InteractionId'];}else if(_0xcf1bb1&&_0xcf1bb1['id']){return _0xcf1bb1['id'];}else if(_0x2c262c&&_0x2c262c['id']){return _0x2c262c['id'];}else{return'unknown';}}function log(_0x2d837c,_0x338016,_0x1f0c4b,_0x12bc31,_0x32fe05,_0x43d9d9){loggers[_0x32fe05[_0x98f0('0x8')]()][_0x2d837c](_0x98f0('0x9'),_0x43d9d9[_0x98f0('0xa')](),_0x338016?_0x338016['id']:null,_0x338016?_0x338016[_0x98f0('0xb')]:null,_0x338016?_0x338016['role']:null,getInteractionId(_0x1f0c4b,_0x12bc31,_0x32fe05),_0x1f0c4b?JSON[_0x98f0('0xc')](_0x1f0c4b):_0x98f0('0xd'));}function updateUser(_0xb6d783,_0x12849e,_0x17207d,_0x597326,_0x46d24e){db[_[_0x98f0('0x7')](_0x597326)+'Interaction'][_0x98f0('0xe')]({'where':{'id':getInteractionId(_0x12849e,_0x17207d,_0x597326)}})[_0x98f0('0xf')](function(_0x21287f){if(_0x21287f){return _0x21287f['update']({'UserId':_0xb6d783?_0xb6d783['id']:null});}})[_0x98f0('0xf')](function(_0x593e22){if(_0x593e22){log(_0x98f0('0x10'),_0xb6d783,_0x12849e,_0x17207d,_0x597326,_0x46d24e);}})[_0x98f0('0x11')](function(){log(_0x98f0('0x12'),_0xb6d783,_0x12849e,_0x17207d,_0x597326,_0x46d24e);});}exports[_0x98f0('0x13')]=function(_0x45575c,_0x3b90ed){return function(_0x54e915,_0x37a90d,_0x5cf1ac){var _0x141438=_0x54e915[_0x98f0('0x14')];var _0x13b919={};var _0x200f91=_0x54e915['query'];if(_0x13b919){_0x13b919=_[_0x98f0('0x15')](_0x54e915[_0x98f0('0x16')]);_0x13b919=_[_0x98f0('0x17')](_0x13b919,[_0x98f0('0x16'),_0x98f0('0x18'),_0x98f0('0x19'),'fax',_0x98f0('0x1a')]);}updateUser(_0x141438,_0x13b919,_0x200f91,_0x45575c,_0x3b90ed);_0x5cf1ac(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index fe2195e..843018e 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 _0xafc8=['base64','utf8','parse','hasOwnProperty','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update'];(function(_0x5c5a81,_0x350ac3){var _0x1c4506=function(_0x24d2bd){while(--_0x24d2bd){_0x5c5a81['push'](_0x5c5a81['shift']());}};_0x1c4506(++_0x350ac3);}(_0xafc8,0x174));var _0x8afc=function(_0x1d61df,_0x50d7a5){_0x1d61df=_0x1d61df-0x0;var _0x2c9b6e=_0xafc8[_0x1d61df];return _0x2c9b6e;};'use strict';var crypto=require(_0x8afc('0x0'));var util=require(_0x8afc('0x1'));var compose=require(_0x8afc('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x8afc('0x3'));function getValueFromLicense(_0x1aa4a2,_0x2e58cf){if(_0x1aa4a2&&_0x2e58cf){if(_0x2e58cf[_0x8afc('0x4')]&&_0x2e58cf[_0x8afc('0x5')]){var _0x30f356=_0x2e58cf[_0x8afc('0x4')];var _0x474415=_0x2e58cf[_0x8afc('0x5')];var _0x4da5e3=_0x30f356[_0x8afc('0x6')]('-')[0x4];var _0x20e4e3=_0x30f356[_0x8afc('0x6')]('-')[0x0];var _0xd00b78=crypto[_0x8afc('0x7')](_0x8afc('0x8'),util[_0x8afc('0x9')](_0x8afc('0xa'),_0x4da5e3,_0x30f356,_0x20e4e3));var _0x3f2abe=_0xd00b78[_0x8afc('0xb')](_0x474415,_0x8afc('0xc'),'utf8');_0x3f2abe+=_0xd00b78['final'](_0x8afc('0xd'));var _0x633ebd=JSON[_0x8afc('0xe')](_0x3f2abe);return _0x633ebd[_0x8afc('0xf')](_0x1aa4a2)?_0x633ebd[_0x1aa4a2]:null;}}return null;}function isLimit(_0x279ae8,_0xfd436a,_0xf233b8,_0x453f8a){var _0x1b70d6=_0xfd436a;return compose()['use'](function(_0x29af78,_0x4c00a1,_0x5d4cf4){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x8afc('0x10')](function(_0x487eb3){var _0x560fc1=getValueFromLicense(_0x279ae8,_0x487eb3);return _0x560fc1?_0x560fc1:_0x1b70d6;})['then'](function(_0x5b45fd){_0x1b70d6=_0x5b45fd;return _0xf233b8[_0x8afc('0x11')](_0x453f8a);})[_0x8afc('0x10')](function(_0x137ac5){if(_0x137ac5>=_0x1b70d6){return _0x4c00a1[_0x8afc('0x12')](0x193)['json']({'message':util[_0x8afc('0x9')](_0x8afc('0x13'),_0x279ae8)});}_0x5d4cf4();})['catch'](function(_0x3f05bb){_0x5d4cf4(_0x3f05bb);});});}function isUserLimit(){return isLimit(_0x8afc('0x14'),0x1,db[_0x8afc('0x15')],{'where':{'$or':[{'role':_0x8afc('0x16')},{'role':_0x8afc('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xa384=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license'];(function(_0x25d45e,_0x26f1d6){var _0x209ce4=function(_0x25e3f4){while(--_0x25e3f4){_0x25d45e['push'](_0x25d45e['shift']());}};_0x209ce4(++_0x26f1d6);}(_0xa384,0x1ba));var _0x4a38=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xa384[_0x45b034];return _0x509cb0;};'use strict';var crypto=require(_0x4a38('0x0'));var util=require('util');var compose=require(_0x4a38('0x1'));var db=require(_0x4a38('0x2'))['db'];var config=require(_0x4a38('0x3'));function getValueFromLicense(_0x345dbd,_0x569a67){if(_0x345dbd&&_0x569a67){if(_0x569a67[_0x4a38('0x4')]&&_0x569a67[_0x4a38('0x5')]){var _0x58504b=_0x569a67[_0x4a38('0x4')];var _0x1c5138=_0x569a67[_0x4a38('0x5')];var _0x268bd9=_0x58504b[_0x4a38('0x6')]('-')[0x4];var _0x252d85=_0x58504b['split']('-')[0x0];var _0x26eced=crypto[_0x4a38('0x7')](_0x4a38('0x8'),util[_0x4a38('0x9')](_0x4a38('0xa'),_0x268bd9,_0x58504b,_0x252d85));var _0x33e8a2=_0x26eced[_0x4a38('0xb')](_0x1c5138,_0x4a38('0xc'),_0x4a38('0xd'));_0x33e8a2+=_0x26eced[_0x4a38('0xe')]('utf8');var _0x577818=JSON['parse'](_0x33e8a2);return _0x577818[_0x4a38('0xf')](_0x345dbd)?_0x577818[_0x345dbd]:null;}}return null;}function isLimit(_0x28ec9e,_0xb9f4c0,_0x304db8,_0x5d939b){var _0x29acd2=_0xb9f4c0;return compose()[_0x4a38('0x10')](function(_0x45b7cf,_0x351882,_0x29e5ec){return db['License'][_0x4a38('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x4a38('0x12')](function(_0x473760){var _0x1a3a5c=getValueFromLicense(_0x28ec9e,_0x473760);return _0x1a3a5c?_0x1a3a5c:_0x29acd2;})[_0x4a38('0x12')](function(_0xee2a7e){_0x29acd2=_0xee2a7e;return _0x304db8[_0x4a38('0x13')](_0x5d939b);})[_0x4a38('0x12')](function(_0x205d31){if(_0x205d31>=_0x29acd2){return _0x351882[_0x4a38('0x14')](0x193)[_0x4a38('0x15')]({'message':util[_0x4a38('0x9')](_0x4a38('0x16'),_0x28ec9e)});}_0x29e5ec();})[_0x4a38('0x17')](function(_0x361e36){_0x29e5ec(_0x361e36);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x4a38('0x18')],{'where':{'$or':[{'role':_0x4a38('0x19')},{'role':_0x4a38('0x1a')}]}});}exports[_0x4a38('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a6862a6..8b2c9e7 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 _0x5f21=['start','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','split','length','forEach','shift','match','filter','map','conditions','push','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?'];(function(_0xf8a3e9,_0xeb4a04){var _0x4bb02e=function(_0x27e33a){while(--_0x27e33a){_0xf8a3e9['push'](_0xf8a3e9['shift']());}};_0x4bb02e(++_0xeb4a04);}(_0x5f21,0xe1));var _0x15f2=function(_0x34ddf1,_0x494e77){_0x34ddf1=_0x34ddf1-0x0;var _0x264cd6=_0x5f21[_0x34ddf1];return _0x264cd6;};'use strict';var _=require(_0x15f2('0x0'));var moment=require(_0x15f2('0x1'));exports['parseSearch']=function(_0x156a39){var _0x4d5d1f={'conditions':[]};_0x4d5d1f[_0x15f2('0x2')]=_[_0x15f2('0x3')](_0x156a39,_0x15f2('0x4'))?'or':_0x15f2('0x5');var _0x28e3cc=_0x156a39[_0x15f2('0x6')]('[$and]','')[_0x15f2('0x6')]('[$or]','')[_0x15f2('0x7')]('||');for(var _0xf4b9b6=0x0;_0xf4b9b6<_0x28e3cc[_0x15f2('0x8')];_0xf4b9b6++){var _0x58387a=_0x28e3cc[_0xf4b9b6]['split'](':=');var _0x135fbb=_0x58387a[0x0];var _0x5e9cfd=_0x58387a['slice'](0x1);_0x5e9cfd[_0x15f2('0x9')](function(_0x239228){var _0x3f8b90=_0x239228[_0x15f2('0x7')]('[')[_0x15f2('0xa')]();var _0x419b9c=_0x239228[_0x15f2('0xb')](/\[(.*?)\]/g);_0x419b9c[_0x15f2('0x9')](function(_0x288ffe){var _0x1b07e6=_0x288ffe[_0x15f2('0x7')]('[')[_0x15f2('0xc')](function(_0x205ff4){return _0x205ff4['indexOf'](']')>-0x1;})[_0x15f2('0xd')](function(_0x2f519c){return _0x2f519c[_0x15f2('0x7')](']')[0x0];})[0x0];_0x4d5d1f[_0x15f2('0xe')][_0x15f2('0xf')]({'field':_0x135fbb,'operator':_0x3f8b90,'value':_0x1b07e6});});});}return _0x4d5d1f;};exports[_0x15f2('0x10')]=function(_0x4d9106,_0x503aab,_0x423bf6){var _0x5ea07c={};if(_0x503aab===_0x15f2('0x11')){if(_0x423bf6['operator']===_0x15f2('0x12')){_0x423bf6[_0x15f2('0x13')]=_0x15f2('0x14');_0x423bf6[_0x15f2('0x15')]+=','+_0x423bf6[_0x15f2('0x15')];}else if(_[_0x15f2('0x16')]([_0x15f2('0x17'),_0x15f2('0x18')],_0x423bf6[_0x15f2('0x13')])){_0x423bf6[_0x15f2('0x15')]=moment(_0x423bf6[_0x15f2('0x15')])[_0x15f2('0x19')](0x1,_0x15f2('0x1a'))[_0x15f2('0x1b')](_0x15f2('0x1c'));}}if(_0x423bf6['castTo']){_0x503aab=_0x423bf6[_0x15f2('0x1d')];_0x5ea07c[_0x15f2('0x1e')]=_0x15f2('0x1f')+_0x4d9106+'.'+_0x423bf6['field']+'\x20AS\x20'+_0x423bf6[_0x15f2('0x1d')]+')\x20'+parseOperator(_0x423bf6[_0x15f2('0x13')]);}else{_0x5ea07c[_0x15f2('0x1e')]=_0x4d9106+'.'+_0x423bf6[_0x15f2('0x20')]+'\x20'+parseOperator(_0x423bf6[_0x15f2('0x13')]);}if(_['includes']([_0x15f2('0x21'),_0x15f2('0x22')],_0x423bf6['operator']))_0x5ea07c[_0x15f2('0x1e')]='('+_0x5ea07c['text']+_0x15f2('0x23')+_0x4d9106+'.'+_0x423bf6[_0x15f2('0x20')]+'\x20IS\x20NULL)';_0x5ea07c[_0x15f2('0x15')]=parseValue(_0x503aab,_0x423bf6[_0x15f2('0x13')],_0x423bf6[_0x15f2('0x15')]);return _0x5ea07c;};function parseOperator(_0x4063b4){var _0x2c6378;switch(_0x4063b4){case _0x15f2('0x24'):_0x2c6378=_0x15f2('0x25');break;case _0x15f2('0x22'):_0x2c6378=_0x15f2('0x26');break;case _0x15f2('0x12'):_0x2c6378=_0x15f2('0x27');break;case _0x15f2('0x21'):_0x2c6378=_0x15f2('0x28');break;case _0x15f2('0x29'):case _0x15f2('0x2a'):case _0x15f2('0x2b'):_0x2c6378='LIKE\x20?';break;case _0x15f2('0x2c'):_0x2c6378=_0x15f2('0x2d');break;case _0x15f2('0x17'):_0x2c6378=_0x15f2('0x2e');break;case _0x15f2('0x18'):_0x2c6378=_0x15f2('0x2f');break;case _0x15f2('0x30'):_0x2c6378='>=\x20?';break;case _0x15f2('0x14'):_0x2c6378=_0x15f2('0x31');break;}return _0x2c6378;}function parseValue(_0x14b22d,_0x50069f,_0x540122){var _0xca28d4={'start':undefined,'end':undefined};switch(_0x50069f){case _0x15f2('0x24'):case _0x15f2('0x22'):_0xca28d4['start']=_0x540122[_0x15f2('0x7')](',');break;case _0x15f2('0x29'):_0xca28d4[_0x15f2('0x32')]='%'+_0x540122+'%';break;case _0x15f2('0x2a'):_0xca28d4['start']=_0x540122+'%';break;case _0x15f2('0x2b'):_0xca28d4[_0x15f2('0x32')]='%'+_0x540122;break;case _0x15f2('0x14'):var _0x5c4f48=_0x540122[_0x15f2('0x7')](',');var _0x540122=_0x5c4f48['shift']();var _0x2dcdd6=_0x5c4f48['pop']();if(_0x14b22d===_0x15f2('0x11')){_0x540122=moment(_0x540122)['utcOffset'](0x0,!![])[_0x15f2('0x1b')]();_0x2dcdd6=moment(_0x2dcdd6)[_0x15f2('0x33')](0x0,!![])[_0x15f2('0x19')](0x17,_0x15f2('0x34'))[_0x15f2('0x19')](0x3b,_0x15f2('0x35'))['add'](0x3b,_0x15f2('0x36'))['format']();}_0xca28d4={'start':_0x540122,'end':_0x2dcdd6};break;default:_0xca28d4[_0x15f2('0x32')]=_0x540122;break;}return _0xca28d4;} \ No newline at end of file +var _0x100b=['field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','add','minutes','seconds','lodash','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','match','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','days','YYYY-MM-DD','castTo','text','CAST('];(function(_0x167442,_0x3563cb){var _0xd24d00=function(_0x46488e){while(--_0x46488e){_0x167442['push'](_0x167442['shift']());}};_0xd24d00(++_0x3563cb);}(_0x100b,0x129));var _0xb100=function(_0x418b7b,_0x3d0171){_0x418b7b=_0x418b7b-0x0;var _0x386d74=_0x100b[_0x418b7b];return _0x386d74;};'use strict';var _=require(_0xb100('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x50807c){var _0x456ba3={'conditions':[]};_0x456ba3[_0xb100('0x1')]=_[_0xb100('0x2')](_0x50807c,_0xb100('0x3'))?'or':_0xb100('0x4');var _0x4bd161=_0x50807c[_0xb100('0x5')]('[$and]','')[_0xb100('0x5')](_0xb100('0x3'),'')[_0xb100('0x6')]('||');for(var _0xcc8d9=0x0;_0xcc8d9<_0x4bd161[_0xb100('0x7')];_0xcc8d9++){var _0x4ec9ba=_0x4bd161[_0xcc8d9]['split'](':=');var _0x3390cd=_0x4ec9ba[0x0];var _0x4da109=_0x4ec9ba[_0xb100('0x8')](0x1);_0x4da109[_0xb100('0x9')](function(_0x3cf1e1){var _0x6d3d44=_0x3cf1e1[_0xb100('0x6')]('[')['shift']();var _0x208165=_0x3cf1e1[_0xb100('0xa')](/\[(.*?)\]/g);_0x208165['forEach'](function(_0x153ef1){var _0x5b12b4=_0x153ef1['split']('[')['filter'](function(_0x3c5554){return _0x3c5554[_0xb100('0xb')](']')>-0x1;})[_0xb100('0xc')](function(_0x100457){return _0x100457[_0xb100('0x6')](']')[0x0];})[0x0];_0x456ba3[_0xb100('0xd')]['push']({'field':_0x3390cd,'operator':_0x6d3d44,'value':_0x5b12b4});});});}return _0x456ba3;};exports[_0xb100('0xe')]=function(_0x581773,_0x31262c,_0x19edd9){var _0x36bbd9={};if(_0x31262c===_0xb100('0xf')){if(_0x19edd9[_0xb100('0x10')]===_0xb100('0x11')){_0x19edd9[_0xb100('0x10')]=_0xb100('0x12');_0x19edd9['value']+=','+_0x19edd9[_0xb100('0x13')];}else if(_['includes']([_0xb100('0x14'),_0xb100('0x15')],_0x19edd9[_0xb100('0x10')])){_0x19edd9['value']=moment(_0x19edd9[_0xb100('0x13')])['add'](0x1,_0xb100('0x16'))['format'](_0xb100('0x17'));}}if(_0x19edd9['castTo']){_0x31262c=_0x19edd9[_0xb100('0x18')];_0x36bbd9[_0xb100('0x19')]=_0xb100('0x1a')+_0x581773+'.'+_0x19edd9[_0xb100('0x1b')]+_0xb100('0x1c')+_0x19edd9['castTo']+')\x20'+parseOperator(_0x19edd9['operator']);}else{_0x36bbd9[_0xb100('0x19')]=_0x581773+'.'+_0x19edd9[_0xb100('0x1b')]+'\x20'+parseOperator(_0x19edd9[_0xb100('0x10')]);}if(_[_0xb100('0x1d')]([_0xb100('0x1e'),_0xb100('0x1f')],_0x19edd9['operator']))_0x36bbd9[_0xb100('0x19')]='('+_0x36bbd9[_0xb100('0x19')]+_0xb100('0x20')+_0x581773+'.'+_0x19edd9[_0xb100('0x1b')]+_0xb100('0x21');_0x36bbd9[_0xb100('0x13')]=parseValue(_0x31262c,_0x19edd9[_0xb100('0x10')],_0x19edd9[_0xb100('0x13')]);return _0x36bbd9;};function parseOperator(_0x29ab17){var _0x5c5e8e;switch(_0x29ab17){case _0xb100('0x22'):_0x5c5e8e='IN\x20?';break;case _0xb100('0x1f'):_0x5c5e8e=_0xb100('0x23');break;case _0xb100('0x11'):_0x5c5e8e='=\x20?';break;case _0xb100('0x1e'):_0x5c5e8e=_0xb100('0x24');break;case _0xb100('0x25'):case _0xb100('0x26'):case _0xb100('0x27'):_0x5c5e8e=_0xb100('0x28');break;case'$lt':_0x5c5e8e=_0xb100('0x29');break;case'$gt':_0x5c5e8e=_0xb100('0x2a');break;case _0xb100('0x15'):_0x5c5e8e=_0xb100('0x2b');break;case _0xb100('0x2c'):_0x5c5e8e=_0xb100('0x2d');break;case _0xb100('0x12'):_0x5c5e8e=_0xb100('0x2e');break;}return _0x5c5e8e;}function parseValue(_0x2ea5ee,_0x117dd4,_0x1a7eb6){var _0x21e724={'start':undefined,'end':undefined};switch(_0x117dd4){case'$in':case'$notIn':_0x21e724['start']=_0x1a7eb6[_0xb100('0x6')](',');break;case _0xb100('0x25'):_0x21e724['start']='%'+_0x1a7eb6+'%';break;case _0xb100('0x26'):_0x21e724[_0xb100('0x2f')]=_0x1a7eb6+'%';break;case _0xb100('0x27'):_0x21e724['start']='%'+_0x1a7eb6;break;case _0xb100('0x12'):var _0x5c6789=_0x1a7eb6[_0xb100('0x6')](',');var _0x1a7eb6=_0x5c6789[_0xb100('0x30')]();var _0xb816d9=_0x5c6789[_0xb100('0x31')]();if(_0x2ea5ee===_0xb100('0xf')){_0x1a7eb6=moment(_0x1a7eb6)['utcOffset'](0x0,!![])['format']();_0xb816d9=moment(_0xb816d9)[_0xb100('0x32')](0x0,!![])[_0xb100('0x33')](0x17,'hours')[_0xb100('0x33')](0x3b,_0xb100('0x34'))[_0xb100('0x33')](0x3b,_0xb100('0x35'))['format']();}_0x21e724={'start':_0x1a7eb6,'end':_0xb816d9};break;default:_0x21e724[_0xb100('0x2f')]=_0x1a7eb6;break;}return _0x21e724;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6af5e8e..bb5cbff 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 _0x28a4=['query','intersection','model','attributes','fields','nolimit','order','where','pick','merge','filter','options','lodash','sequelize','moment','filters','forOwn','find','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','isEmpty','isObject','isString','length','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','includes','push','join','getOptions'];(function(_0x20ddb9,_0x3d3552){var _0x170c09=function(_0x1e0a1c){while(--_0x1e0a1c){_0x20ddb9['push'](_0x20ddb9['shift']());}};_0x170c09(++_0x3d3552);}(_0x28a4,0x124));var _0x428a=function(_0x34e84d,_0x3f3502){_0x34e84d=_0x34e84d-0x0;var _0x3f9125=_0x28a4[_0x34e84d];return _0x3f9125;};'use strict';var _=require(_0x428a('0x0'));var sequelize=require(_0x428a('0x1'));var moment=require(_0x428a('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x51b9d4){var _0x4de000=null;if(_0x51b9d4){_0x4de000=_0x51b9d4['split'](',');}return _0x4de000;};exports[_0x428a('0x3')]=function(_0x3daf09,_0x59945e){var _0xf6d9a6={};if(!_['isEmpty'](_0x3daf09)){_[_0x428a('0x4')](_0x3daf09,function(_0x31e1cd,_0x4fee51){try{if(_0x59945e){var _0x12ea66=_[_0x428a('0x5')](_0x59945e,{'name':_0x4fee51})||{};if(_0x12ea66['type']==='DATE'&&_[_0x428a('0x6')](_0x31e1cd)){var _0x3b7651=JSON[_0x428a('0x7')](_0x31e1cd);var _0xd24c5e={'$gte':moment(moment(_0x3b7651['$gte'])[_0x428a('0x8')](_0x428a('0x9')))[_0x428a('0xa')]()['format'](),'$lte':moment(moment(_0x3b7651[_0x428a('0xb')])[_0x428a('0x8')](_0x428a('0x9')))[_0x428a('0xa')]()[_0x428a('0xc')](0x1,'s')[_0x428a('0x8')]()};_0xf6d9a6[_0x4fee51]=_0xd24c5e;}else if(_0x12ea66[_0x428a('0xd')]===_0x428a('0xe')){_0xf6d9a6[_0x4fee51]=_0x31e1cd;}else{_0xf6d9a6[_0x4fee51]=_[_0x428a('0xf')](_0x31e1cd)?_0x31e1cd:JSON[_0x428a('0x7')](_0x31e1cd);}}else{_0xf6d9a6[_0x4fee51]=_[_0x428a('0xf')](_0x31e1cd)?_0x31e1cd:JSON[_0x428a('0x7')](_0x31e1cd);}}catch(_0x26483b){_0xf6d9a6[_0x4fee51]=_0x31e1cd[_0x428a('0x10')](',');}});}return _0xf6d9a6;};exports[_0x428a('0x11')]=function(_0x36f338){_0x36f338=parseInt(_0x36f338,0xa);if(!_0x36f338||_0x36f338<0x0){_0x36f338=LIMIT_VALUE;}return _0x36f338;};exports[_0x428a('0x12')]=function(_0x44c635){_0x44c635=parseInt(_0x44c635,0xa);if(!_0x44c635||_0x44c635<0x0){_0x44c635=0x0;}return _0x44c635;};exports[_0x428a('0x13')]=function(_0x26ef81){var _0x26f9f1,_0x4f26a9=null;if(_0x26ef81){_0x26f9f1=_0x26ef81[_0x428a('0x10')](',');_0x4f26a9=_[_0x428a('0x14')](_0x26f9f1,function(_0x262446){if(_0x262446[_0x428a('0x15')]('-')===0x0){return[_0x262446===_0x428a('0x16')?sequelize[_0x428a('0x17')](sequelize[_0x428a('0x18')](_0x428a('0x16')),_0x428a('0x19')):_0x262446['substr'](0x1),_0x428a('0x1a')];}else{return[_0x262446===_0x428a('0x16')?sequelize[_0x428a('0x17')](sequelize['col']('priority'),_0x428a('0x19')):_0x262446,_0x428a('0x1b')];}});}return _0x4f26a9;};exports[_0x428a('0x1c')]=function(_0x1ea5bc,_0x231ad7){if(_[_0x428a('0x1d')](_0x1ea5bc)){return _0x1ea5bc;}if(_[_0x428a('0xf')](_0x1ea5bc)){for(var _0x50a508=0x0;_0x50a508<_0x1ea5bc['length'];_0x50a508+=0x1){_0x1ea5bc[_0x50a508]=this['omit'](_0x1ea5bc[_0x50a508],_0x231ad7);}return _0x1ea5bc;}if(!_[_0x428a('0x1e')](_0x1ea5bc)){return _0x1ea5bc;}if(_[_0x428a('0x1f')](_0x231ad7)){_0x231ad7=[_0x231ad7];}if(!_[_0x428a('0xf')](_0x231ad7)){return _0x1ea5bc;}for(var _0x51b779=0x0;_0x51b779<_0x231ad7[_0x428a('0x20')];_0x51b779+=0x1){_[_0x428a('0x21')](_0x1ea5bc,_0x231ad7[_0x51b779]);}for(var _0x4c03a3 in _0x1ea5bc){if(_0x1ea5bc[_0x428a('0x22')](_0x4c03a3)){_0x1ea5bc[_0x4c03a3]=this[_0x428a('0x1c')](_0x1ea5bc[_0x4c03a3],_0x231ad7);}}return _0x1ea5bc;};exports[_0x428a('0x23')]=function(_0x22a7a8){return _0x22a7a8['match'](RegExp(_0x428a('0x24')))?!![]:![];};exports[_0x428a('0x25')]=function(_0x544f1d){return _0x544f1d['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x428a('0x26')]=function(_0x196994){var _0xecb0c9=[];_0x196994[_0x428a('0x10')](/[ ,]+/)[_0x428a('0x27')](function(_0x1bfbb1){_0x1bfbb1=_0x1bfbb1['replace'](/([^:]")"+/g,'$1');_0x1bfbb1='+'+_0x1bfbb1+'*';if(_0x1bfbb1[_0x428a('0x28')]('@'))_0x1bfbb1='\x22'+_0x1bfbb1+'\x22';_0xecb0c9[_0x428a('0x29')](_0x1bfbb1);});return _0xecb0c9[_0x428a('0x2a')]('\x20');};exports[_0x428a('0x2b')]=function(_0x485bd9,_0x21f402){var _0x1f26c7={},_0x19124c={};_0x1f26c7['model']=_['map'](_0x485bd9,_0x428a('0xd'));_0x1f26c7[_0x428a('0x2c')]=_['keys'](_0x21f402[_0x428a('0x2c')]);_0x1f26c7['filters']=_[_0x428a('0x2d')](_0x1f26c7[_0x428a('0x2e')],_0x1f26c7['query']);_0x19124c[_0x428a('0x2f')]=_['intersection'](_0x1f26c7[_0x428a('0x2e')],this[_0x428a('0x30')](_0x21f402[_0x428a('0x2c')][_0x428a('0x30')]));_0x19124c[_0x428a('0x2f')]=_0x19124c[_0x428a('0x2f')][_0x428a('0x20')]?_0x19124c[_0x428a('0x2f')]:_0x1f26c7[_0x428a('0x2e')];if(!_0x21f402['query']['hasOwnProperty'](_0x428a('0x31'))){_0x19124c['limit']=this[_0x428a('0x11')](_0x21f402[_0x428a('0x2c')][_0x428a('0x11')]);_0x19124c['offset']=this[_0x428a('0x12')](_0x21f402[_0x428a('0x2c')][_0x428a('0x12')]);}_0x19124c[_0x428a('0x32')]=this[_0x428a('0x13')](_0x21f402[_0x428a('0x2c')][_0x428a('0x13')]);_0x19124c[_0x428a('0x33')]=this[_0x428a('0x3')](_[_0x428a('0x34')](_0x21f402[_0x428a('0x2c')],_0x1f26c7[_0x428a('0x3')]),_0x485bd9);if(_0x21f402['query']['filter']){_0x19124c[_0x428a('0x33')]=_[_0x428a('0x35')](_0x19124c[_0x428a('0x33')],{'$or':_[_0x428a('0x14')](_0x485bd9,function(_0x9d020c){if(_0x9d020c['type']!=='VIRTUAL'){var _0x2ce5dd={};_0x2ce5dd[_0x9d020c[_0x428a('0xd')]]={'$like':'%'+_0x21f402[_0x428a('0x2c')][_0x428a('0x36')]+'%'};return _0x2ce5dd;}})});}_0x19124c=_['merge']({},_0x19124c,_0x21f402[_0x428a('0x37')]);return _0x19124c;}; \ No newline at end of file +var _0xc494=['name','options','sequelize','fields','split','filters','isEmpty','forOwn','find','DATE','parse','$gte','YYYY-MM-DD','utc','format','$lte','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','join','getOptions','model','query','keys','intersection','attributes','nolimit','offset','where','filter','merge'];(function(_0x4647dc,_0x2bf2f6){var _0x1c3cab=function(_0x4c9cf0){while(--_0x4c9cf0){_0x4647dc['push'](_0x4647dc['shift']());}};_0x1c3cab(++_0x2bf2f6);}(_0xc494,0x134));var _0x4c49=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0xc494[_0x375492];return _0x18ba5b;};'use strict';var _=require('lodash');var sequelize=require(_0x4c49('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x4c49('0x1')]=function(_0x10be9b){var _0x13ce42=null;if(_0x10be9b){_0x13ce42=_0x10be9b[_0x4c49('0x2')](',');}return _0x13ce42;};exports[_0x4c49('0x3')]=function(_0x319de6,_0x1cb617){var _0x1cd6b1={};if(!_[_0x4c49('0x4')](_0x319de6)){_[_0x4c49('0x5')](_0x319de6,function(_0x521ea4,_0x50eefa){try{if(_0x1cb617){var _0x4890f5=_[_0x4c49('0x6')](_0x1cb617,{'name':_0x50eefa})||{};if(_0x4890f5['type']===_0x4c49('0x7')&&_['isPlainObject'](_0x521ea4)){var _0x23c090=JSON[_0x4c49('0x8')](_0x521ea4);var _0x2bba14={'$gte':moment(moment(_0x23c090[_0x4c49('0x9')])['format'](_0x4c49('0xa')))[_0x4c49('0xb')]()[_0x4c49('0xc')](),'$lte':moment(moment(_0x23c090[_0x4c49('0xd')])[_0x4c49('0xc')](_0x4c49('0xa')))[_0x4c49('0xb')]()['subtract'](0x1,'s')[_0x4c49('0xc')]()};_0x1cd6b1[_0x50eefa]=_0x2bba14;}else if(_0x4890f5['name']===_0x4c49('0xe')){_0x1cd6b1[_0x50eefa]=_0x521ea4;}else{_0x1cd6b1[_0x50eefa]=_['isArray'](_0x521ea4)?_0x521ea4:JSON['parse'](_0x521ea4);}}else{_0x1cd6b1[_0x50eefa]=_[_0x4c49('0xf')](_0x521ea4)?_0x521ea4:JSON[_0x4c49('0x8')](_0x521ea4);}}catch(_0x422150){_0x1cd6b1[_0x50eefa]=_0x521ea4[_0x4c49('0x2')](',');}});}return _0x1cd6b1;};exports[_0x4c49('0x10')]=function(_0x774060){_0x774060=parseInt(_0x774060,0xa);if(!_0x774060||_0x774060<0x0){_0x774060=LIMIT_VALUE;}return _0x774060;};exports['offset']=function(_0x35a830){_0x35a830=parseInt(_0x35a830,0xa);if(!_0x35a830||_0x35a830<0x0){_0x35a830=0x0;}return _0x35a830;};exports[_0x4c49('0x11')]=function(_0x350006){var _0x1152fe,_0x146672=null;if(_0x350006){_0x1152fe=_0x350006['split'](',');_0x146672=_[_0x4c49('0x12')](_0x1152fe,function(_0x58cb45){if(_0x58cb45[_0x4c49('0x13')]('-')===0x0){return[_0x58cb45===_0x4c49('0x14')?sequelize[_0x4c49('0x15')](sequelize[_0x4c49('0x16')]('priority'),_0x4c49('0x17')):_0x58cb45[_0x4c49('0x18')](0x1),_0x4c49('0x19')];}else{return[_0x58cb45===_0x4c49('0x14')?sequelize[_0x4c49('0x15')](sequelize[_0x4c49('0x16')](_0x4c49('0x14')),_0x4c49('0x17')):_0x58cb45,_0x4c49('0x1a')];}});}return _0x146672;};exports[_0x4c49('0x1b')]=function(_0x17a53c,_0x4e2c12){if(_[_0x4c49('0x4')](_0x17a53c)){return _0x17a53c;}if(_[_0x4c49('0xf')](_0x17a53c)){for(var _0x3da024=0x0;_0x3da024<_0x17a53c[_0x4c49('0x1c')];_0x3da024+=0x1){_0x17a53c[_0x3da024]=this[_0x4c49('0x1b')](_0x17a53c[_0x3da024],_0x4e2c12);}return _0x17a53c;}if(!_[_0x4c49('0x1d')](_0x17a53c)){return _0x17a53c;}if(_['isString'](_0x4e2c12)){_0x4e2c12=[_0x4e2c12];}if(!_['isArray'](_0x4e2c12)){return _0x17a53c;}for(var _0x5ed212=0x0;_0x5ed212<_0x4e2c12[_0x4c49('0x1c')];_0x5ed212+=0x1){_['unset'](_0x17a53c,_0x4e2c12[_0x5ed212]);}for(var _0x452fd0 in _0x17a53c){if(_0x17a53c['hasOwnProperty'](_0x452fd0)){_0x17a53c[_0x452fd0]=this[_0x4c49('0x1b')](_0x17a53c[_0x452fd0],_0x4e2c12);}}return _0x17a53c;};exports[_0x4c49('0x1e')]=function(_0x7a0585){return _0x7a0585[_0x4c49('0x1f')](RegExp(_0x4c49('0x20')))?!![]:![];};exports[_0x4c49('0x21')]=function(_0x39ff7b){return _0x39ff7b[_0x4c49('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0x4c49('0x22')]=function(_0x4cb4c6){var _0x46bae0=[];_0x4cb4c6[_0x4c49('0x2')](/[ ,]+/)[_0x4c49('0x23')](function(_0x5713a1){_0x5713a1=_0x5713a1[_0x4c49('0x24')](/([^:]")"+/g,'$1');_0x5713a1='+'+_0x5713a1+'*';if(_0x5713a1['includes']('@'))_0x5713a1='\x22'+_0x5713a1+'\x22';_0x46bae0['push'](_0x5713a1);});return _0x46bae0[_0x4c49('0x25')]('\x20');};exports[_0x4c49('0x26')]=function(_0x1563c4,_0x2142a0){var _0x15270d={},_0x11c055={};_0x15270d[_0x4c49('0x27')]=_[_0x4c49('0x12')](_0x1563c4,'name');_0x15270d[_0x4c49('0x28')]=_[_0x4c49('0x29')](_0x2142a0['query']);_0x15270d[_0x4c49('0x3')]=_[_0x4c49('0x2a')](_0x15270d[_0x4c49('0x27')],_0x15270d[_0x4c49('0x28')]);_0x11c055['attributes']=_['intersection'](_0x15270d[_0x4c49('0x27')],this[_0x4c49('0x1')](_0x2142a0[_0x4c49('0x28')][_0x4c49('0x1')]));_0x11c055['attributes']=_0x11c055[_0x4c49('0x2b')][_0x4c49('0x1c')]?_0x11c055[_0x4c49('0x2b')]:_0x15270d[_0x4c49('0x27')];if(!_0x2142a0['query']['hasOwnProperty'](_0x4c49('0x2c'))){_0x11c055[_0x4c49('0x10')]=this[_0x4c49('0x10')](_0x2142a0[_0x4c49('0x28')]['limit']);_0x11c055['offset']=this[_0x4c49('0x2d')](_0x2142a0[_0x4c49('0x28')][_0x4c49('0x2d')]);}_0x11c055['order']=this[_0x4c49('0x11')](_0x2142a0['query'][_0x4c49('0x11')]);_0x11c055[_0x4c49('0x2e')]=this[_0x4c49('0x3')](_['pick'](_0x2142a0[_0x4c49('0x28')],_0x15270d[_0x4c49('0x3')]),_0x1563c4);if(_0x2142a0[_0x4c49('0x28')][_0x4c49('0x2f')]){_0x11c055[_0x4c49('0x2e')]=_[_0x4c49('0x30')](_0x11c055[_0x4c49('0x2e')],{'$or':_[_0x4c49('0x12')](_0x1563c4,function(_0x42589a){if(_0x42589a['type']!=='VIRTUAL'){var _0x11c15c={};_0x11c15c[_0x42589a[_0x4c49('0x31')]]={'$like':'%'+_0x2142a0[_0x4c49('0x28')]['filter']+'%'};return _0x11c15c;}})});}_0x11c055=_[_0x4c49('0x30')]({},_0x11c055,_0x2142a0[_0x4c49('0x32')]);return _0x11c055;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a91a4b7..f0bd3cb 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dd5=['urlencoded','50mb','initialize','express','cookie-parser','path','cors','./environment','../mysqldb','get','set','appPath','join','root','public','development','test','client','use','toISOString','split','static','/server/views','engine','html','ejs','renderFile'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x6dd5,0xc0));var _0x56dd=function(_0x2101f2,_0x120c2b){_0x2101f2=_0x2101f2-0x0;var _0x47e643=_0x6dd5[_0x2101f2];return _0x47e643;};'use strict';var express=require(_0x56dd('0x0'));var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require(_0x56dd('0x1'));var errorHandler=require('errorhandler');var path=require(_0x56dd('0x2'));var passport=require('passport');var cors=require(_0x56dd('0x3'));var moment=require('moment');var config=require(_0x56dd('0x4'));var db=require(_0x56dd('0x5'))['db'];exports['default']=function(_0x4e7c93){var _0x23a774=_0x4e7c93[_0x56dd('0x6')]('env');if(_0x23a774==='production'){_0x4e7c93[_0x56dd('0x7')](_0x56dd('0x8'),path[_0x56dd('0x9')](config[_0x56dd('0xa')],_0x56dd('0xb')));}if(_0x23a774===_0x56dd('0xc')||_0x23a774===_0x56dd('0xd')){_0x4e7c93['set'](_0x56dd('0x8'),path[_0x56dd('0x9')](config[_0x56dd('0xa')],_0x56dd('0xe')));_0x4e7c93[_0x56dd('0xf')](errorHandler());}_0x4e7c93[_0x56dd('0x7')]('json\x20replacer',function(_0x4fcde0,_0x333fc6){if(this[_0x4fcde0]instanceof Date){_0x333fc6=this[_0x4fcde0][_0x56dd('0x10')]()[_0x56dd('0x11')]('.')[0x0]+'Z';}return _0x333fc6;});_0x4e7c93['use'](express[_0x56dd('0x12')](_0x4e7c93[_0x56dd('0x6')](_0x56dd('0x8'))));_0x4e7c93[_0x56dd('0x7')]('views',config['root']+_0x56dd('0x13'));_0x4e7c93[_0x56dd('0x14')](_0x56dd('0x15'),require(_0x56dd('0x16'))[_0x56dd('0x17')]);_0x4e7c93[_0x56dd('0x7')]('view\x20engine','html');_0x4e7c93[_0x56dd('0xf')](bodyParser[_0x56dd('0x18')]({'limit':_0x56dd('0x19'),'extended':!![]}));_0x4e7c93[_0x56dd('0xf')](bodyParser['json']({'limit':_0x56dd('0x19')}));_0x4e7c93[_0x56dd('0xf')](cors());_0x4e7c93[_0x56dd('0xf')](methodOverride());_0x4e7c93[_0x56dd('0xf')](cookieParser());_0x4e7c93[_0x56dd('0xf')](passport[_0x56dd('0x1a')]());}; \ No newline at end of file +var _0x20a0=['method-override','errorhandler','path','passport','moment','../mysqldb','default','get','env','production','appPath','root','public','development','test','set','join','use','json\x20replacer','toISOString','split','static','views','/server/views','engine','html','ejs','renderFile','view\x20engine','50mb','json','initialize','express','serve-favicon','body-parser'];(function(_0x3bdb07,_0x25a3e5){var _0xc9956e=function(_0x1609ae){while(--_0x1609ae){_0x3bdb07['push'](_0x3bdb07['shift']());}};_0xc9956e(++_0x25a3e5);}(_0x20a0,0x89));var _0x020a=function(_0x5291f1,_0x3e2d26){_0x5291f1=_0x5291f1-0x0;var _0x5755ba=_0x20a0[_0x5291f1];return _0x5755ba;};'use strict';var express=require(_0x020a('0x0'));var favicon=require(_0x020a('0x1'));var bodyParser=require(_0x020a('0x2'));var methodOverride=require(_0x020a('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x020a('0x4'));var path=require(_0x020a('0x5'));var passport=require(_0x020a('0x6'));var cors=require('cors');var moment=require(_0x020a('0x7'));var config=require('./environment');var db=require(_0x020a('0x8'))['db'];exports[_0x020a('0x9')]=function(_0x52b779){var _0xf04675=_0x52b779[_0x020a('0xa')](_0x020a('0xb'));if(_0xf04675===_0x020a('0xc')){_0x52b779['set'](_0x020a('0xd'),path['join'](config[_0x020a('0xe')],_0x020a('0xf')));}if(_0xf04675===_0x020a('0x10')||_0xf04675===_0x020a('0x11')){_0x52b779[_0x020a('0x12')]('appPath',path[_0x020a('0x13')](config[_0x020a('0xe')],'client'));_0x52b779[_0x020a('0x14')](errorHandler());}_0x52b779[_0x020a('0x12')](_0x020a('0x15'),function(_0x566caa,_0x38c650){if(this[_0x566caa]instanceof Date){_0x38c650=this[_0x566caa][_0x020a('0x16')]()[_0x020a('0x17')]('.')[0x0]+'Z';}return _0x38c650;});_0x52b779[_0x020a('0x14')](express[_0x020a('0x18')](_0x52b779['get'](_0x020a('0xd'))));_0x52b779[_0x020a('0x12')](_0x020a('0x19'),config[_0x020a('0xe')]+_0x020a('0x1a'));_0x52b779[_0x020a('0x1b')](_0x020a('0x1c'),require(_0x020a('0x1d'))[_0x020a('0x1e')]);_0x52b779['set'](_0x020a('0x1f'),'html');_0x52b779[_0x020a('0x14')](bodyParser['urlencoded']({'limit':_0x020a('0x20'),'extended':!![]}));_0x52b779[_0x020a('0x14')](bodyParser[_0x020a('0x21')]({'limit':'50mb'}));_0x52b779['use'](cors());_0x52b779['use'](methodOverride());_0x52b779[_0x020a('0x14')](cookieParser());_0x52b779[_0x020a('0x14')](passport[_0x020a('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 9ea3f16..5096a71 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 _0x3df9=['internal','concat','head','mac','address','127.0.0.1','getFirstInterface','model','createHash','md5','digest','hex','getUuid','platform','licenseToken','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','family','IPv4'];(function(_0x39f860,_0x8b837e){var _0x96276=function(_0x47159a){while(--_0x47159a){_0x39f860['push'](_0x39f860['shift']());}};_0x96276(++_0x8b837e);}(_0x3df9,0x1a2));var _0x93df=function(_0x4c577b,_0x6f3228){_0x4c577b=_0x4c577b-0x0;var _0x29d6b4=_0x3df9[_0x4c577b];return _0x29d6b4;};'use strict';var _=require(_0x93df('0x0'));var os=require('os');var crypto=require(_0x93df('0x1'));var machine=require(_0x93df('0x2'));var exec=require(_0x93df('0x3'))[_0x93df('0x4')];var config=require('../environment');function getInterfaces(){var _0x52b997=[];var _0x2963eb=os['networkInterfaces']();var _0x324540=_[_0x93df('0x5')](_[_0x93df('0x6')](_0x2963eb));for(var _0x53165d=0x0;_0x53165d<_0x324540[_0x93df('0x7')];_0x53165d++){var _0x22b906=_0x2963eb[_0x324540[_0x53165d]][_0x93df('0x8')](function(_0x390415){return _0x390415[_0x93df('0x9')]===_0x93df('0xa')&&_0x390415[_0x93df('0xb')]===![];});_0x52b997=_0x52b997[_0x93df('0xc')](_0x22b906);}return _0x52b997;}function getFirstInterface(){var _0x4e6aa8=_[_0x93df('0xd')](getInterfaces());return{'macAddress':_0x4e6aa8&&_0x4e6aa8['mac']?_0x4e6aa8[_0x93df('0xe')]:'00:00:00:00:00:00','ipAddress':_0x4e6aa8&&_0x4e6aa8[_0x93df('0xf')]?_0x4e6aa8[_0x93df('0xf')]:_0x93df('0x10')};}exports[_0x93df('0x11')]=getFirstInterface;function getCPUhash(){var _0x5808df=_[_0x93df('0x5')](os['cpus']()['map'](function(_0x58d22a){return _0x58d22a[_0x93df('0x12')];}))['join'](':');return crypto[_0x93df('0x13')](_0x93df('0x14'))['update'](_0x5808df)[_0x93df('0x15')](_0x93df('0x16'));}exports[_0x93df('0x17')]=function(){var _0x1e7294=os[_0x93df('0x18')]();var _0x4187d7=/[0-9a-f-]{36}/;if(config[_0x93df('0x19')]&&_0x4187d7['test'](config['licenseToken'])){return config[_0x93df('0x19')];}else if(_0x1e7294==='win32'){return exec(_0x93df('0x1a'),{'encoding':'utf8'})[_0x93df('0x1b')]('\x0d\x0a','');}else{var _0x489cf6=getFirstInterface();var _0x23971c=getCPUhash();var _0x2f54f1=_0x23971c+'|'+os[_0x93df('0x1c')]()+'|'+_0x489cf6[_0x93df('0x1d')]+'|'+_0x489cf6[_0x93df('0x1e')];var _0x2dce19=crypto['createHash'](_0x93df('0x14'))[_0x93df('0x1f')](_0x2f54f1)['digest']('hex');return _0x2dce19[_0x93df('0x20')](0x0,0x8)+'-'+_0x2dce19[_0x93df('0x20')](0x8,0xc)+'-'+_0x2dce19[_0x93df('0x20')](0xc,0x10)+'-'+_0x2dce19['substring'](0x10,0x14)+'-'+_0x2dce19[_0x93df('0x20')](0x14);}}; \ No newline at end of file +var _0x44c7=['map','md5','update','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','createHash','substring','crypto','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','head','mac','address','127.0.0.1','getFirstInterface','cpus'];(function(_0x1a6fb2,_0x26c808){var _0x1153dc=function(_0x4150fa){while(--_0x4150fa){_0x1a6fb2['push'](_0x1a6fb2['shift']());}};_0x1153dc(++_0x26c808);}(_0x44c7,0x177));var _0x744c=function(_0x176c65,_0x112f7a){_0x176c65=_0x176c65-0x0;var _0x21869e=_0x44c7[_0x176c65];return _0x21869e;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x744c('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];var config=require(_0x744c('0x1'));function getInterfaces(){var _0x1434dc=[];var _0x22ad1b=os[_0x744c('0x2')]();var _0x50823f=_[_0x744c('0x3')](_[_0x744c('0x4')](_0x22ad1b));for(var _0x413dbe=0x0;_0x413dbe<_0x50823f[_0x744c('0x5')];_0x413dbe++){var _0x4c523f=_0x22ad1b[_0x50823f[_0x413dbe]][_0x744c('0x6')](function(_0x1f26b2){return _0x1f26b2['family']===_0x744c('0x7')&&_0x1f26b2[_0x744c('0x8')]===![];});_0x1434dc=_0x1434dc['concat'](_0x4c523f);}return _0x1434dc;}function getFirstInterface(){var _0x3a1443=_[_0x744c('0x9')](getInterfaces());return{'macAddress':_0x3a1443&&_0x3a1443[_0x744c('0xa')]?_0x3a1443[_0x744c('0xa')]:'00:00:00:00:00:00','ipAddress':_0x3a1443&&_0x3a1443[_0x744c('0xb')]?_0x3a1443[_0x744c('0xb')]:_0x744c('0xc')};}exports[_0x744c('0xd')]=getFirstInterface;function getCPUhash(){var _0x117364=_[_0x744c('0x3')](os[_0x744c('0xe')]()[_0x744c('0xf')](function(_0x41fbef){return _0x41fbef['model'];}))['join'](':');return crypto['createHash'](_0x744c('0x10'))[_0x744c('0x11')](_0x117364)[_0x744c('0x12')](_0x744c('0x13'));}exports[_0x744c('0x14')]=function(){var _0x3aff8c=os[_0x744c('0x15')]();var _0x2ba385=/[0-9a-f-]{36}/;if(config[_0x744c('0x16')]&&_0x2ba385['test'](config[_0x744c('0x16')])){return config[_0x744c('0x16')];}else if(_0x3aff8c===_0x744c('0x17')){return exec(_0x744c('0x18'),{'encoding':_0x744c('0x19')})['replace']('\x0d\x0a','');}else{var _0x1846ec=getFirstInterface();var _0x268d17=getCPUhash();var _0x1de1bc=_0x268d17+'|'+os[_0x744c('0x1a')]()+'|'+_0x1846ec[_0x744c('0x1b')]+'|'+_0x1846ec['ipAddress'];var _0x22f51f=crypto[_0x744c('0x1c')](_0x744c('0x10'))[_0x744c('0x11')](_0x1de1bc)[_0x744c('0x12')](_0x744c('0x13'));return _0x22f51f[_0x744c('0x1d')](0x0,0x8)+'-'+_0x22f51f[_0x744c('0x1d')](0x8,0xc)+'-'+_0x22f51f['substring'](0xc,0x10)+'-'+_0x22f51f[_0x744c('0x1d')](0x10,0x14)+'-'+_0x22f51f['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 5b3b4e0..f9e5637 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 _0x02ae=['finally','getUuid','findOrCreate','spread','default','util','request-promise','pkginfo','version','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message'];(function(_0x5ddbb8,_0x3cb263){var _0x3246b2=function(_0x490475){while(--_0x490475){_0x5ddbb8['push'](_0x5ddbb8['shift']());}};_0x3246b2(++_0x3cb263);}(_0x02ae,0x137));var _0xe02a=function(_0x3d0378,_0x3ec370){_0x3d0378=_0x3d0378-0x0;var _0x12a37c=_0x02ae[_0x3d0378];return _0x12a37c;};'use strict';var util=require(_0xe02a('0x0'));var moment=require('moment');var rp=require(_0xe02a('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xe02a('0x2'))(module,_0xe02a('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xe02a('0x4'));var hardware=require('./hardware');var logger=require(_0xe02a('0x5'))(_0xe02a('0x6'));var HOST=_0xe02a('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4c265b){return new BPromise(function(_0x5a839a,_0x4ff86a){var _0x45925f=util[_0xe02a('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x4c265b,module[_0xe02a('0x9')][_0xe02a('0x3')]);if(oldToken){_0x45925f=util[_0xe02a('0x8')](_0xe02a('0xa'),HOST,_0x4c265b,module['exports'][_0xe02a('0x3')],oldToken);}var _0x254956={'uri':_0x45925f,'method':_0xe02a('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x254956)[_0xe02a('0xc')](function(_0x41900c){_0x5a839a(_0x41900c);})[_0xe02a('0xd')](function(_0x294dbb){_0x4ff86a(_0x294dbb);});});}function manageLicense(_0x5b839b,_0x96fc11){var _0x4dd7dd=_0x96fc11[_0xe02a('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x4dd7dd[_0xe02a('0xf')]!==_0x5b839b&&!_0x4dd7dd[_0xe02a('0x10')]){oldToken=_0x4dd7dd['data1'];}httpRequest(_0x5b839b)[_0xe02a('0xc')](function(_0x44a492){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x44a492[_0xe02a('0x11')]){isOldTokenSent=![];if(!_0x4dd7dd[_0xe02a('0x6')]&&_0x4dd7dd[_0xe02a('0x6')]!=_0x44a492[_0xe02a('0x6')]||_0x4dd7dd['license']&&_0x4dd7dd[_0xe02a('0x10')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4dd7dd['license']&&!_0x4dd7dd[_0xe02a('0x10')]&&_0x4dd7dd[_0xe02a('0x6')]!=_0x44a492[_0xe02a('0x6')]){logger[_0xe02a('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4dd7dd[_0xe02a('0x6')]&&!_0x4dd7dd[_0xe02a('0x10')]&&_0x4dd7dd[_0xe02a('0x6')]==_0x44a492[_0xe02a('0x6')]){return _0x96fc11;}return _0x96fc11[_0xe02a('0x13')]({'data1':_0x5b839b,'data2':null,'license':_0x44a492[_0xe02a('0x6')]});}else{if(_0x44a492[_0xe02a('0x6')]||_0x4dd7dd[_0xe02a('0x6')]){if(!_0x4dd7dd[_0xe02a('0x10')]){if(_0x4dd7dd[_0xe02a('0xf')]==_0x5b839b){GRAY_PERIOD_REASON=_0xe02a('0x14');logger[_0xe02a('0x12')](_0xe02a('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xe02a('0x12')](_0xe02a('0x16'),_0x4dd7dd[_0xe02a('0xf')],_0x5b839b);}logger[_0xe02a('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xe02a('0x17')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x96fc11[_0xe02a('0x13')]({'data2':encryptor['encryptString'](moment()[_0xe02a('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xe02a('0x18')](_0x4dd7dd[_0xe02a('0x10')]),_0xe02a('0x19'))>DAYS){logger[_0xe02a('0x12')](_0xe02a('0x1a'),moment()[_0xe02a('0x8')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x96fc11['update']({'data1':_0x5b839b,'data2':null,'license':null});}}}else{if(_0x4dd7dd[_0xe02a('0xf')]!=_0x5b839b){logger[_0xe02a('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4dd7dd[_0xe02a('0xf')],_0x5b839b);return _0x96fc11[_0xe02a('0x13')]({'data1':_0x5b839b,'data2':null,'license':null});}}}return _0x96fc11;})['then'](function(_0x148a7a){_0x96fc11=_0x148a7a;})[_0xe02a('0xd')](function(_0x41c4e){logger[_0xe02a('0x1b')](_0x41c4e[_0xe02a('0x1c')]);})[_0xe02a('0x1d')](function(){setTimeout(function(){manageLicense(hardware[_0xe02a('0x1e')](),_0x96fc11);},TIME);});}function defaultLicense(){var _0x5bf8dd=hardware[_0xe02a('0x1e')]();if(_0x5bf8dd){return db['License'][_0xe02a('0x1f')]({'where':{'id':0x1},'defaults':{'data1':_0x5bf8dd}})[_0xe02a('0x20')](function(_0x24816a,_0x2c3fd2){logger[_0xe02a('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x5bf8dd);manageLicense(_0x5bf8dd,_0x24816a);})[_0xe02a('0xd')](function(_0x36739d){logger[_0xe02a('0x1b')](_0x36739d['message']);});}}exports[_0xe02a('0x21')]=defaultLicense; \ No newline at end of file +var _0xd963=['NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','GET','then','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update'];(function(_0x4694ef,_0x1666a1){var _0x40eaa4=function(_0x1b6fcb){while(--_0x1b6fcb){_0x4694ef['push'](_0x4694ef['shift']());}};_0x40eaa4(++_0x1666a1);}(_0xd963,0x137));var _0x3d96=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0xd963[_0x16337a];return _0x422365;};'use strict';var util=require(_0x3d96('0x0'));var moment=require(_0x3d96('0x1'));var rp=require(_0x3d96('0x2'));var BPromise=require(_0x3d96('0x3'));var pkginfo=require(_0x3d96('0x4'))(module,_0x3d96('0x5'));var db=require(_0x3d96('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x3d96('0x7'));var logger=require(_0x3d96('0x8'))(_0x3d96('0x9'));var HOST=_0x3d96('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1b53f0){return new BPromise(function(_0xc0ab3e,_0x569958){var _0x30bc4e=util[_0x3d96('0xb')](_0x3d96('0xc'),HOST,_0x1b53f0,module['exports'][_0x3d96('0x5')]);if(oldToken){_0x30bc4e=util[_0x3d96('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x1b53f0,module['exports']['version'],oldToken);}var _0x340782={'uri':_0x30bc4e,'method':_0x3d96('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x340782)[_0x3d96('0xe')](function(_0x5d440d){_0xc0ab3e(_0x5d440d);})['catch'](function(_0x4dc372){_0x569958(_0x4dc372);});});}function manageLicense(_0x5117a6,_0x277884){var _0x3f1389=_0x277884[_0x3d96('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x3f1389[_0x3d96('0x10')]!==_0x5117a6&&!_0x3f1389[_0x3d96('0x11')]){oldToken=_0x3f1389[_0x3d96('0x10')];}httpRequest(_0x5117a6)[_0x3d96('0xe')](function(_0x698828){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x698828['active']){isOldTokenSent=![];if(!_0x3f1389[_0x3d96('0x9')]&&_0x3f1389['license']!=_0x698828[_0x3d96('0x9')]||_0x3f1389[_0x3d96('0x9')]&&_0x3f1389['data2']){logger[_0x3d96('0x12')](_0x3d96('0x13'));}if(_0x3f1389['license']&&!_0x3f1389[_0x3d96('0x11')]&&_0x3f1389[_0x3d96('0x9')]!=_0x698828[_0x3d96('0x9')]){logger[_0x3d96('0x12')](_0x3d96('0x14'));}if(_0x3f1389[_0x3d96('0x9')]&&!_0x3f1389[_0x3d96('0x11')]&&_0x3f1389[_0x3d96('0x9')]==_0x698828[_0x3d96('0x9')]){return _0x277884;}return _0x277884[_0x3d96('0x15')]({'data1':_0x5117a6,'data2':null,'license':_0x698828[_0x3d96('0x9')]});}else{if(_0x698828[_0x3d96('0x9')]||_0x3f1389['license']){if(!_0x3f1389[_0x3d96('0x11')]){if(_0x3f1389[_0x3d96('0x10')]==_0x5117a6){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x3d96('0x12')](_0x3d96('0x16'),_0x3f1389['data1'],_0x5117a6);}logger['info'](_0x3d96('0x17'),GRAY_PERIOD_REASON[_0x3d96('0x18')](),moment()[_0x3d96('0xb')](_0x3d96('0x19')));return _0x277884[_0x3d96('0x15')]({'data2':encryptor['encryptString'](moment()[_0x3d96('0xb')](_0x3d96('0x19')))});}else{if(moment()[_0x3d96('0x1a')](encryptor[_0x3d96('0x1b')](_0x3f1389[_0x3d96('0x11')]),_0x3d96('0x1c'))>DAYS){logger[_0x3d96('0x12')]('DEMO\x20START\x20AT\x20%s',moment()[_0x3d96('0xb')](_0x3d96('0x19')));isOldTokenSent=![];return _0x277884['update']({'data1':_0x5117a6,'data2':null,'license':null});}}}else{if(_0x3f1389[_0x3d96('0x10')]!=_0x5117a6){logger['info'](_0x3d96('0x16'),_0x3f1389[_0x3d96('0x10')],_0x5117a6);return _0x277884[_0x3d96('0x15')]({'data1':_0x5117a6,'data2':null,'license':null});}}}return _0x277884;})['then'](function(_0x8e3b23){_0x277884=_0x8e3b23;})[_0x3d96('0x1d')](function(_0x3f0e9e){logger[_0x3d96('0x1e')](_0x3f0e9e[_0x3d96('0x1f')]);})[_0x3d96('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x3d96('0x21')](),_0x277884);},TIME);});}function defaultLicense(){var _0x5f17cd=hardware[_0x3d96('0x21')]();if(_0x5f17cd){return db['License'][_0x3d96('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x5f17cd}})[_0x3d96('0x23')](function(_0x4e6154,_0xc891bb){logger[_0x3d96('0x12')](_0x3d96('0x24'),_0x5f17cd);manageLicense(_0x5f17cd,_0x4e6154);})['catch'](function(_0x4c472d){logger[_0x3d96('0x1e')](_0x4c472d[_0x3d96('0x1f')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index bbb2e76..f3f30aa 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 _0x43e1=['disabled','message','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','telephones','forEach','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','License','defaults','then','catch','data1','license','isEmpty','data2','split','decryptString','format','parse','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed'];(function(_0x528df4,_0x35dda5){var _0x2cfdf9=function(_0x36f7fd){while(--_0x36f7fd){_0x528df4['push'](_0x528df4['shift']());}};_0x2cfdf9(++_0x35dda5);}(_0x43e1,0x10c));var _0x143e=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x43e1[_0xb301d4];return _0x3b5bde;};'use strict';var util=require(_0x143e('0x0'));var _=require(_0x143e('0x1'));var moment=require(_0x143e('0x2'));var BPromise=require(_0x143e('0x3'));var hardware=require(_0x143e('0x4'));var encryptor=require(_0x143e('0x5'));var db=require(_0x143e('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x143e('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x143e('0x8'),'machineUuid':hardware[_0x143e('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x143e('0xa'),'machineUuid':hardware[_0x143e('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x17aa42){return new BPromise(function(_0x5f8c78,_0x3691b9){return db[_0x143e('0xb')]['find'](_[_0x143e('0xc')](_0x17aa42,{'raw':!![],'where':{'id':0x1}}))[_0x143e('0xd')](function(_0x36f09f){return checkLicense(_0x36f09f,null);})['then'](function(_0x56b7f1){_0x5f8c78(_0x56b7f1);return;})[_0x143e('0xe')](function(_0x1bb150){_0x3691b9(_0x1bb150);});});}function checkLicense(_0x15278b,_0x45d3e2){if(!_0x15278b){demoLicense['uuid']=_0x15278b[_0x143e('0xf')];return demoLicense;}try{var _0x12cf24=_0x45d3e2||_0x15278b[_0x143e('0x10')];if(_[_0x143e('0x11')](_0x12cf24)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x650fc2=_0x15278b[_0x143e('0xf')];var _0x117007=_0x15278b[_0x143e('0x12')];var _0x360a53=_0x650fc2[_0x143e('0x13')]('-')[0x4];var _0x1c0976=_0x650fc2[_0x143e('0x13')]('-')[0x0];var _0x36cefe=encryptor[_0x143e('0x14')](_0x12cf24,util[_0x143e('0x15')]('%s:%s:%s',_0x360a53,_0x650fc2,_0x1c0976));var _0x1479bd=JSON[_0x143e('0x16')](_0x36cefe);_0x1479bd[_0x143e('0x17')]=![];_0x1479bd[_0x143e('0x18')]=_0x650fc2;_0x1479bd[_0x143e('0x19')]=hardware[_0x143e('0x9')]();if(_0x117007){var _0x310216=encryptor['decryptString'](_0x117007);_0x1479bd[_0x143e('0x1a')]=_0x310216;_0x1479bd[_0x143e('0x1b')]=moment(_0x310216)[_0x143e('0x1c')](0x7,_0x143e('0x1d'))[_0x143e('0x15')]();_0x1479bd[_0x143e('0x1e')]=_0x1479bd[_0x143e('0x18')]!=_0x1479bd[_0x143e('0x19')]?_0x143e('0x1f'):_0x143e('0x20');}return _0x1479bd;}catch(_0xa291db){breakingLicense[_0x143e('0x18')]=_0x15278b['data1'];breakingLicense[_0x143e('0x21')]=_0xa291db[_0x143e('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2bd57e,_0x54e497){getLicense()[_0x143e('0xd')](function(_0x3433da){return db['User'][_0x143e('0x22')]({'attributes':[_0x143e('0x23'),[db[_0x143e('0x24')]['fn'](_0x143e('0x25'),db[_0x143e('0x24')][_0x143e('0x26')]('role')),'count']],'group':_0x143e('0x23'),'where':{'role':{'$or':[_0x143e('0x27'),_0x143e('0x28'),_0x143e('0x29')]}},'raw':!![]})[_0x143e('0xd')](function(_0xe7e60a){var _0x2203f2={'user':_0x3433da[_0x143e('0x2a')]||0x0,'telephone':_0x3433da[_0x143e('0x2b')]||0x0};_0xe7e60a[_0x143e('0x2c')](function(_0x47a79f){var _0x125bf2=_0x47a79f[_0x143e('0x23')]===_0x143e('0x27')?'user':_0x47a79f[_0x143e('0x23')];_0x2203f2[_0x125bf2]-=_0x47a79f['count'];if(_0x2203f2[_0x125bf2]<0x0)_0x2203f2[_0x125bf2]=0x0;});_0x2bd57e(_0x2203f2);return;});})[_0x143e('0xe')](function(_0x5d33b0){_0x54e497(_0x5d33b0);});});}function checkUserLimits(_0x61453c){return new BPromise(function(_0x4e2a1d,_0x1f6120){getLimits()[_0x143e('0xd')](function(_0x699ba0){var _0x270703=_[_0x143e('0x2d')](_[_0x143e('0x2e')](_0x61453c,_0x143e('0x23')),['admin',_0x143e('0x28'),_0x143e('0x29')]);var _0x28cf5a=(_0x270703[_0x143e('0x27')]||0x0)+(_0x270703[_0x143e('0x28')]||0x0);var _0x2ddd46=_0x270703[_0x143e('0x29')]||0x0;if(_0x28cf5a>_0x699ba0['user'])return _0x1f6120(_0x143e('0x2f'));if(_0x2ddd46>_0x699ba0[_0x143e('0x29')])return _0x1f6120(_0x143e('0x30'));return _0x4e2a1d();})['catch'](function(_0x271d75){_0x1f6120(_0x271d75);});});}module[_0x143e('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x9ac8=['count','catch','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','../../components/encryptor','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','decryptString','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','telephones','user'];(function(_0x2b77ef,_0x5abb2e){var _0x35032b=function(_0x22623f){while(--_0x22623f){_0x2b77ef['push'](_0x2b77ef['shift']());}};_0x35032b(++_0x5abb2e);}(_0x9ac8,0x1ea));var _0x89ac=function(_0x190d5d,_0x139f2c){_0x190d5d=_0x190d5d-0x0;var _0x46255b=_0x9ac8[_0x190d5d];return _0x46255b;};'use strict';var util=require(_0x89ac('0x0'));var _=require(_0x89ac('0x1'));var moment=require('moment');var BPromise=require(_0x89ac('0x2'));var hardware=require('./hardware');var encryptor=require(_0x89ac('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x89ac('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x89ac('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x89ac('0x6'),'machineUuid':hardware[_0x89ac('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x33762a){return new BPromise(function(_0x22621a,_0x5b2f34){return db[_0x89ac('0x7')][_0x89ac('0x8')](_[_0x89ac('0x9')](_0x33762a,{'raw':!![],'where':{'id':0x1}}))[_0x89ac('0xa')](function(_0xb904cd){return checkLicense(_0xb904cd,null);})['then'](function(_0x2b995b){_0x22621a(_0x2b995b);return;})['catch'](function(_0x2b8d54){_0x5b2f34(_0x2b8d54);});});}function checkLicense(_0x79090,_0x5ea6ac){if(!_0x79090){demoLicense[_0x89ac('0xb')]=_0x79090[_0x89ac('0xc')];return demoLicense;}try{var _0x132f51=_0x5ea6ac||_0x79090[_0x89ac('0xd')];if(_[_0x89ac('0xe')](_0x132f51)){throw new Error(_0x89ac('0xf'));}var _0x19e9ff=_0x79090[_0x89ac('0xc')];var _0x180ddb=_0x79090[_0x89ac('0x10')];var _0x99e31c=_0x19e9ff[_0x89ac('0x11')]('-')[0x4];var _0x5bd053=_0x19e9ff['split']('-')[0x0];var _0x43d132=encryptor['decryptString'](_0x132f51,util[_0x89ac('0x12')](_0x89ac('0x13'),_0x99e31c,_0x19e9ff,_0x5bd053));var _0x29f094=JSON[_0x89ac('0x14')](_0x43d132);_0x29f094['demo']=![];_0x29f094[_0x89ac('0xb')]=_0x19e9ff;_0x29f094['machineUuid']=hardware[_0x89ac('0x4')]();if(_0x180ddb){var _0x1c22f8=encryptor[_0x89ac('0x15')](_0x180ddb);_0x29f094['gray']=_0x1c22f8;_0x29f094['deadline']=moment(_0x1c22f8)[_0x89ac('0x16')](0x7,_0x89ac('0x17'))[_0x89ac('0x12')]();_0x29f094[_0x89ac('0x18')]=_0x29f094[_0x89ac('0xb')]!=_0x29f094[_0x89ac('0x19')]?_0x89ac('0x1a'):_0x89ac('0x1b');}return _0x29f094;}catch(_0x2c586c){breakingLicense[_0x89ac('0xb')]=_0x79090[_0x89ac('0xc')];breakingLicense['message']=_0x2c586c[_0x89ac('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4a266b,_0xbd4d8e){getLicense()[_0x89ac('0xa')](function(_0x160282){return db[_0x89ac('0x1d')][_0x89ac('0x1e')]({'attributes':[_0x89ac('0x1f'),[db[_0x89ac('0x20')]['fn'](_0x89ac('0x21'),db[_0x89ac('0x20')][_0x89ac('0x22')](_0x89ac('0x1f'))),'count']],'group':_0x89ac('0x1f'),'where':{'role':{'$or':[_0x89ac('0x23'),'user','telephone']}},'raw':!![]})['then'](function(_0x535622){var _0x500e54={'user':_0x160282['users']||0x0,'telephone':_0x160282[_0x89ac('0x24')]||0x0};_0x535622['forEach'](function(_0x477540){var _0x12c2e1=_0x477540[_0x89ac('0x1f')]===_0x89ac('0x23')?_0x89ac('0x25'):_0x477540['role'];_0x500e54[_0x12c2e1]-=_0x477540[_0x89ac('0x26')];if(_0x500e54[_0x12c2e1]<0x0)_0x500e54[_0x12c2e1]=0x0;});_0x4a266b(_0x500e54);return;});})[_0x89ac('0x27')](function(_0xcaa108){_0xbd4d8e(_0xcaa108);});});}function checkUserLimits(_0x510ee2){return new BPromise(function(_0x493f73,_0x2fdb60){getLimits()['then'](function(_0x5013a4){var _0x2b6394=_['pick'](_['countBy'](_0x510ee2,'role'),[_0x89ac('0x23'),_0x89ac('0x25'),_0x89ac('0x28')]);var _0x37d6e8=(_0x2b6394[_0x89ac('0x23')]||0x0)+(_0x2b6394[_0x89ac('0x25')]||0x0);var _0x42309a=_0x2b6394[_0x89ac('0x28')]||0x0;if(_0x37d6e8>_0x5013a4[_0x89ac('0x25')])return _0x2fdb60(_0x89ac('0x29'));if(_0x42309a>_0x5013a4['telephone'])return _0x2fdb60(_0x89ac('0x2a'));return _0x493f73();})[_0x89ac('0x27')](function(_0x55c4ac){_0x2fdb60(_0x55c4ac);});});}module[_0x89ac('0x2b')]={'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 3ae7ab2..86b0725 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 _0x430c=['exports','app-id','secret'];(function(_0x11be4f,_0xb43ee){var _0x10faf9=function(_0x578c85){while(--_0x578c85){_0x11be4f['push'](_0x11be4f['shift']());}};_0x10faf9(++_0xb43ee);}(_0x430c,0x1a1));var _0xc430=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x430c[_0x43b487];return _0x2f707a;};'use strict';module[_0xc430('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xc430('0x1'),'GOOGLE_SECRET':_0xc430('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xdd4f=['exports','secret'];(function(_0x366f30,_0x5992aa){var _0x148ed6=function(_0x3042e6){while(--_0x3042e6){_0x366f30['push'](_0x366f30['shift']());}};_0x148ed6(++_0x5992aa);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2ea34a,_0x343b3c){_0x2ea34a=_0x2ea34a-0x0;var _0x58bfe4=_0xdd4f[_0x2ea34a];return _0x58bfe4;};'use strict';module[_0xfdd4('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xfdd4('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index e6f1c32..b1239dc 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3db=['replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','debugLevel','moment','winston','util','path','join','/var','log','xcally','format','%s-%s.log','message'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0xe3db,0x153));var _0xbe3d=function(_0x3e8750,_0x1c70d7){_0x3e8750=_0x3e8750-0x0;var _0x2243c1=_0xe3db[_0x3e8750];return _0x2243c1;};'use strict';var moment=require(_0xbe3d('0x0'));var winston=require(_0xbe3d('0x1'));var util=require(_0xbe3d('0x2'));var path=require(_0xbe3d('0x3'));var debugLevel='INFO';function filename(_0x332c5e,_0x183dfd){return path[_0xbe3d('0x4')](_0xbe3d('0x5'),_0xbe3d('0x6'),_0xbe3d('0x7'),util[_0xbe3d('0x8')](_0xbe3d('0x9'),_0x332c5e,_0x183dfd));}function formatter(_0x272d23,_0x17c732){_0x17c732[_0xbe3d('0xa')]=_0x17c732[_0xbe3d('0xa')][_0xbe3d('0xb')](/@@{/g,_0xbe3d('0xc'))[_0xbe3d('0xb')](/}@@/g,'}}}')[_0xbe3d('0xb')](/@{/g,'{{')[_0xbe3d('0xb')](/}@/g,'}}');return util[_0xbe3d('0x8')](_0xbe3d('0xd'),moment()['format'](_0xbe3d('0xe')),_0x17c732['level'][_0xbe3d('0xf')](),_0x272d23,_0x17c732['message']);}module[_0xbe3d('0x10')]=function(_0x29e08b){return new winston[(_0xbe3d('0x11'))]({'transports':[new winston[(_0xbe3d('0x12'))][(_0xbe3d('0x13'))]({'name':util['format'](_0xbe3d('0x14'),_0x29e08b,_0xbe3d('0x15')),'filename':filename(_0x29e08b,_0xbe3d('0x15')),'level':_0xbe3d('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x20301a){return formatter(_0x29e08b,_0x20301a);}}),new winston[(_0xbe3d('0x12'))]['File']({'name':util[_0xbe3d('0x8')]('%s-%s',_0x29e08b,'info'),'filename':filename(_0x29e08b,_0xbe3d('0x16')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1dac49){return formatter(_0x29e08b,_0x1dac49);}}),new winston[(_0xbe3d('0x12'))][(_0xbe3d('0x17'))]({'level':process['env'][_0xbe3d('0x18')]||debugLevel,'json':![],'formatter':function(_0x2fdc9d){return formatter(_0x29e08b,_0x2fdc9d);}})]});}; \ No newline at end of file +var _0x53d6=['}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','transports','File','%s-%s','error','info','util','path','INFO','/var','log','xcally','message','replace','{{{'];(function(_0xf15036,_0x52e137){var _0x2985dd=function(_0x2d2dca){while(--_0x2d2dca){_0xf15036['push'](_0xf15036['shift']());}};_0x2985dd(++_0x52e137);}(_0x53d6,0xbf));var _0x653d=function(_0x20a4dc,_0x2bd7c7){_0x20a4dc=_0x20a4dc-0x0;var _0x49000f=_0x53d6[_0x20a4dc];return _0x49000f;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x653d('0x0'));var path=require(_0x653d('0x1'));var debugLevel=_0x653d('0x2');function filename(_0x1cb02c,_0x685f43){return path['join'](_0x653d('0x3'),_0x653d('0x4'),_0x653d('0x5'),util['format']('%s-%s.log',_0x1cb02c,_0x685f43));}function formatter(_0x3547cc,_0x32acbb){_0x32acbb[_0x653d('0x6')]=_0x32acbb['message'][_0x653d('0x7')](/@@{/g,_0x653d('0x8'))[_0x653d('0x7')](/}@@/g,_0x653d('0x9'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x653d('0xa')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x653d('0xa')](_0x653d('0xb')),_0x32acbb[_0x653d('0xc')]['toUpperCase'](),_0x3547cc,_0x32acbb[_0x653d('0x6')]);}module[_0x653d('0xd')]=function(_0x65cdd7){return new winston[(_0x653d('0xe'))]({'transports':[new winston[(_0x653d('0xf'))][(_0x653d('0x10'))]({'name':util[_0x653d('0xa')](_0x653d('0x11'),_0x65cdd7,_0x653d('0x12')),'filename':filename(_0x65cdd7,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x57ce8c){return formatter(_0x65cdd7,_0x57ce8c);}}),new winston[(_0x653d('0xf'))][(_0x653d('0x10'))]({'name':util[_0x653d('0xa')](_0x653d('0x11'),_0x65cdd7,'info'),'filename':filename(_0x65cdd7,'info'),'level':_0x653d('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xbd84b3){return formatter(_0x65cdd7,_0xbd84b3);}}),new winston[(_0x653d('0xf'))]['Console']({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x394a93){return formatter(_0x65cdd7,_0x394a93);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 963fa26..5c5a261 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 _0x0592=['../../services/routing/index.js','../../services/xdr/index.js','path','express','ami','join','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x1a0d63,_0x23b283){var _0x275ad1=function(_0x42a0e2){while(--_0x42a0e2){_0x1a0d63['push'](_0x1a0d63['shift']());}};_0x275ad1(++_0x23b283);}(_0x0592,0xb6));var _0x2059=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0592[_0x2641f9];return _0x585741;};'use strict';var path=require(_0x2059('0x0'));var os=require('os');var config={'apps':[{'name':_0x2059('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x2059('0x2'),'script':path[_0x2059('0x3')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x2059('0x3')](__dirname,_0x2059('0x4'))},{'name':_0x2059('0x5'),'script':path[_0x2059('0x3')](__dirname,_0x2059('0x6'))},{'name':_0x2059('0x7'),'script':path['join'](__dirname,_0x2059('0x8'))},{'name':'xdr','script':path[_0x2059('0x3')](__dirname,_0x2059('0x9'))}]};module['exports']=config; \ No newline at end of file +var _0xd8ac=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','routing'];(function(_0x37f395,_0x17aeb3){var _0x33591f=function(_0x52d2eb){while(--_0x52d2eb){_0x37f395['push'](_0x37f395['shift']());}};_0x33591f(++_0x17aeb3);}(_0xd8ac,0xd4));var _0xcd8a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd8ac[_0x397e5f];return _0x5302b8;};'use strict';var path=require(_0xcd8a('0x0'));var os=require('os');var config={'apps':[{'name':_0xcd8a('0x1'),'script':path[_0xcd8a('0x2')](__dirname,_0xcd8a('0x3'))},{'name':_0xcd8a('0x4'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0xcd8a('0x5'),'script':path[_0xcd8a('0x2')](__dirname,_0xcd8a('0x6'))},{'name':_0xcd8a('0x7'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0xcd8a('0x8'),'script':path[_0xcd8a('0x2')](__dirname,_0xcd8a('0x9'))},{'name':_0xcd8a('0xa'),'script':path[_0xcd8a('0x2')](__dirname,_0xcd8a('0xb'))}]};module[_0xcd8a('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index a35f928..776641d 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 _0x1360=['dump','saved','pm2','bluebird','connected','start','disconnect','stop','restart','then','list','describe','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1360,0x1af));var _0x0136=function(_0x35a9a7,_0x5e8c7f){_0x35a9a7=_0x35a9a7-0x0;var _0x142c13=_0x1360[_0x35a9a7];return _0x142c13;};'use strict';var pm2=require(_0x0136('0x0'));var BPromise=require(_0x0136('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x4f3dfa,_0x235eef){return pm2['connect'](function(_0x1199ed){if(_0x1199ed){return _0x235eef(_0x1199ed);}return _0x4f3dfa(_0x0136('0x2'));});});};exports[_0x0136('0x3')]=function(_0x20ca31){return connect()['then'](function(){return new BPromise(function(_0x56bd76,_0xde307d){return pm2[_0x0136('0x3')](_0x20ca31,function(_0x9818f2,_0x4a813d){if(_0x9818f2){return _0xde307d(_0x9818f2);}pm2[_0x0136('0x4')]();return _0x56bd76(_0x4a813d);});});});};exports[_0x0136('0x5')]=function(_0x14a55a){return connect()['then'](function(){return new BPromise(function(_0x4f2fd7,_0x404c4a){return pm2[_0x0136('0x5')](_0x14a55a,function(_0x3102ab,_0x3ba073){if(_0x3102ab){return _0x404c4a(_0x3102ab);}pm2[_0x0136('0x4')]();return _0x4f2fd7(_0x3ba073);});});});};exports[_0x0136('0x6')]=function(_0x561110){return connect()[_0x0136('0x7')](function(){return new BPromise(function(_0x3512b6,_0x4056ef){return pm2[_0x0136('0x6')](_0x561110,function(_0x211f61,_0x39b830){if(_0x211f61){return _0x4056ef(_0x211f61);}pm2[_0x0136('0x4')]();return _0x3512b6(_0x39b830);});});});};exports[_0x0136('0x8')]=function(){return connect()[_0x0136('0x7')](function(){return new BPromise(function(_0x49374c,_0x1c5b3e){return pm2[_0x0136('0x8')](function(_0x291ece,_0x3cd6b3){if(_0x291ece){return _0x1c5b3e(_0x291ece);}pm2['disconnect']();return _0x49374c(_0x3cd6b3);});});});};exports[_0x0136('0x9')]=function(_0x48ae8){return connect()[_0x0136('0x7')](function(){return new BPromise(function(_0x241e48,_0x5f51b5){return pm2[_0x0136('0x9')](_0x48ae8,function(_0x240c6e,_0x85fcf6){if(_0x240c6e){return _0x5f51b5(_0x240c6e);}pm2['disconnect']();return _0x241e48(_0x85fcf6);});});});};exports[_0x0136('0xa')]=function(_0x34ae0a){return connect()['then'](function(){return new BPromise(function(_0x5853be,_0x532ef4){return pm2[_0x0136('0xa')](_0x34ae0a,function(_0x5b3077,_0x4d0b1b){if(_0x5b3077){return _0x532ef4(_0x5b3077);}pm2[_0x0136('0x4')]();return _0x5853be(_0x4d0b1b);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x4d4d15,_0x5a34a9){return pm2[_0x0136('0xb')](function(_0x54ecd4){if(_0x54ecd4){return _0x5a34a9(_0x54ecd4);}return _0x4d4d15(_0x0136('0xc'));});});});}; \ No newline at end of file +var _0x5d3f=['saved','./config','connected','start','disconnect','stop','then','restart','delete','dump'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x5d3f,0x79));var _0xf5d3=function(_0xaa52db,_0x175048){_0xaa52db=_0xaa52db-0x0;var _0x227388=_0x5d3f[_0xaa52db];return _0x227388;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0xf5d3('0x0'));function connect(){return new BPromise(function(_0x577e24,_0x153bc4){return pm2['connect'](function(_0x269618){if(_0x269618){return _0x153bc4(_0x269618);}return _0x577e24(_0xf5d3('0x1'));});});};exports[_0xf5d3('0x2')]=function(_0x143517){return connect()['then'](function(){return new BPromise(function(_0x4a7a43,_0x5026b4){return pm2['start'](_0x143517,function(_0x3c4253,_0x594c4d){if(_0x3c4253){return _0x5026b4(_0x3c4253);}pm2[_0xf5d3('0x3')]();return _0x4a7a43(_0x594c4d);});});});};exports[_0xf5d3('0x4')]=function(_0x202d8f){return connect()[_0xf5d3('0x5')](function(){return new BPromise(function(_0x17ed72,_0x1aedf0){return pm2[_0xf5d3('0x4')](_0x202d8f,function(_0x5f0bd4,_0x460d14){if(_0x5f0bd4){return _0x1aedf0(_0x5f0bd4);}pm2['disconnect']();return _0x17ed72(_0x460d14);});});});};exports[_0xf5d3('0x6')]=function(_0x14b323){return connect()[_0xf5d3('0x5')](function(){return new BPromise(function(_0x5b8152,_0x7cd100){return pm2[_0xf5d3('0x6')](_0x14b323,function(_0x311e62,_0x38aeb7){if(_0x311e62){return _0x7cd100(_0x311e62);}pm2[_0xf5d3('0x3')]();return _0x5b8152(_0x38aeb7);});});});};exports['list']=function(){return connect()[_0xf5d3('0x5')](function(){return new BPromise(function(_0x9640c7,_0x4d8274){return pm2['list'](function(_0x9c4cd1,_0x42cae1){if(_0x9c4cd1){return _0x4d8274(_0x9c4cd1);}pm2['disconnect']();return _0x9640c7(_0x42cae1);});});});};exports['describe']=function(_0x5dfaf6){return connect()[_0xf5d3('0x5')](function(){return new BPromise(function(_0x56a650,_0x41e931){return pm2['describe'](_0x5dfaf6,function(_0x5740bf,_0x32cfe7){if(_0x5740bf){return _0x41e931(_0x5740bf);}pm2['disconnect']();return _0x56a650(_0x32cfe7);});});});};exports[_0xf5d3('0x7')]=function(_0x141641){return connect()[_0xf5d3('0x5')](function(){return new BPromise(function(_0x17e9f6,_0x1dbd3e){return pm2[_0xf5d3('0x7')](_0x141641,function(_0x2dd1c3,_0x1a6e2a){if(_0x2dd1c3){return _0x1dbd3e(_0x2dd1c3);}pm2[_0xf5d3('0x3')]();return _0x17e9f6(_0x1a6e2a);});});});};exports[_0xf5d3('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x37da41,_0x53bba0){return pm2['dump'](function(_0x131cf9){if(_0x131cf9){return _0x53bba0(_0x131cf9);}return _0x37da41(_0xf5d3('0x9'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c5d1b64..0945f18 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 _0x73be=['error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch'];(function(_0x29c4e5,_0x548ab7){var _0x452747=function(_0x3d8f62){while(--_0x3d8f62){_0x29c4e5['push'](_0x29c4e5['shift']());}};_0x452747(++_0x548ab7);}(_0x73be,0xa9));var _0xe73b=function(_0x5cf40e,_0x46fdbc){_0x5cf40e=_0x5cf40e-0x0;var _0x1d280a=_0x73be[_0x5cf40e];return _0x1d280a;};'use strict';var _=require(_0xe73b('0x0'));var moment=require('moment');var Redis=require(_0xe73b('0x1'));var util=require(_0xe73b('0x2'));var config=require(_0xe73b('0x3'));var db=require(_0xe73b('0x4'))['db'];var logger=require(_0xe73b('0x5'))(_0xe73b('0x6'));config[_0xe73b('0x7')]=_[_0xe73b('0x8')](config[_0xe73b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe73b('0x9'))(new Redis(config[_0xe73b('0x7')]));function closeInteractions(){var _0x1a8d93=0x0;var _0x224675=[];return db[_0xe73b('0xa')][_0xe73b('0xb')]({'raw':!![],'attributes':['id',_0xe73b('0xc')],'where':{'id':0x1}})[_0xe73b('0xd')](function(_0x4e2f98){_0x1a8d93=_0x4e2f98[_0xe73b('0xc')];if(_0x1a8d93){return db['ChatInteraction'][_0xe73b('0xe')]({'raw':!![],'attributes':['id',_0xe73b('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x4e2f98['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0xedc485){if(_0xedc485&&_0xedc485[_0xe73b('0x10')]){_0x224675=_[_0xe73b('0x11')](_0xedc485||[],'id');logger['info'](_0xe73b('0x12'),_0x224675[_0xe73b('0x13')]());return db['ChatInteraction']['update']({'closeReason':_0xe73b('0x14'),'disposition':_0xe73b('0x15'),'closed':!![],'closedAt':moment()[_0xe73b('0x16')](_0xe73b('0x17'))},{'where':{'id':_0x224675}});}})[_0xe73b('0xd')](function(){if(_0x224675&&_0x224675[_0xe73b('0x10')]){logger[_0xe73b('0x18')](_0xe73b('0x19'),_0x224675[_0xe73b('0x13')]());for(var _0x1933f6=0x0;_0x1933f6<_0x224675[_0xe73b('0x10')];_0x1933f6++){io[_0xe73b('0x1a')](_0xe73b('0x1b'),{'id':_0x224675[_0x1933f6],'closed':!![]});}}})[_0xe73b('0x1c')](function(_0x5a317e){logger[_0xe73b('0x1d')](_0xe73b('0x1e'),_0x5a317e?util[_0xe73b('0x1f')](_0x5a317e,{'showHidden':![],'depth':null}):'');});}exports[_0xe73b('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2176=['map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','format','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','schedule','defaults','redis','localhost','socket.io-emitter','chatTimeout','ChatInteraction','findAll','subtract','minutes','then','length'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x2176,0xd0));var _0x6217=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2176[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6217('0x0'));var moment=require(_0x6217('0x1'));var Redis=require(_0x6217('0x2'));var util=require(_0x6217('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x6217('0x4'));config['redis']=_[_0x6217('0x5')](config[_0x6217('0x6')],{'host':_0x6217('0x7'),'port':0x18eb});var io=require(_0x6217('0x8'))(new Redis(config[_0x6217('0x6')]));function closeInteractions(){var _0x1272cb=0x0;var _0x1a72ae=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x6217('0x9')],'where':{'id':0x1}})['then'](function(_0xb6445f){_0x1272cb=_0xb6445f[_0x6217('0x9')];if(_0x1272cb){return db[_0x6217('0xa')][_0x6217('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6217('0xc')](_0xb6445f[_0x6217('0x9')],_0x6217('0xd'))}}});}else{return[];}})[_0x6217('0xe')](function(_0x2afec9){if(_0x2afec9&&_0x2afec9[_0x6217('0xf')]){_0x1a72ae=_[_0x6217('0x10')](_0x2afec9||[],'id');logger[_0x6217('0x11')](_0x6217('0x12'),_0x1a72ae[_0x6217('0x13')]());return db[_0x6217('0xa')][_0x6217('0x14')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x6217('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1a72ae}});}})[_0x6217('0xe')](function(){if(_0x1a72ae&&_0x1a72ae[_0x6217('0xf')]){logger[_0x6217('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x1a72ae['join']());for(var _0x43df83=0x0;_0x43df83<_0x1a72ae[_0x6217('0xf')];_0x43df83++){io[_0x6217('0x16')](_0x6217('0x17'),{'id':_0x1a72ae[_0x43df83],'closed':!![]});}}})[_0x6217('0x18')](function(_0x5aa0b6){logger[_0x6217('0x19')](_0x6217('0x1a'),_0x5aa0b6?util[_0x6217('0x1b')](_0x5aa0b6,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index a4ca1d6..61d1790 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 _0x264e=['DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','deleteJob','run','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','host','Smtp','port','secure','pass','format','\x22%s\x22\x20<%s>','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','../../files/reports','savename','%s.%s','extname','join','status','Sent','message','stringify','existsSync','attachments','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled'];(function(_0x25997b,_0xeddec4){var _0x43f8e1=function(_0x3a1005){while(--_0x3a1005){_0x25997b['push'](_0x25997b['shift']());}};_0x43f8e1(++_0xeddec4);}(_0x264e,0x7c));var _0xe264=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x264e[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xe264('0x0'));var _=require(_0xe264('0x1'));var moment=require(_0xe264('0x2'));var CronJobManager=require(_0xe264('0x3'));var jayson=require(_0xe264('0x4'));var BPromise=require('bluebird');var logger=require(_0xe264('0x5'))(_0xe264('0x6'));var db=require(_0xe264('0x7'))['db'];var analyticCustomReportController=require(_0xe264('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xe264('0x9')][_0xe264('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2b97db,_0x246fa8){return function(){logger[_0xe264('0xb')](_0xe264('0xc'),_0x2b97db[_0xe264('0xd')]);var _0x3545a2=!![];var _0x5c7c2f={'tls':{'rejectUnauthorized':![]}};if(_0x2b97db[_0xe264('0xe')]['Smtp']['service']){_0x5c7c2f[_0xe264('0xf')]=_0x2b97db[_0xe264('0xe')]['Smtp'][_0xe264('0xf')];}else{_0x5c7c2f[_0xe264('0x10')]=_0x2b97db[_0xe264('0xe')][_0xe264('0x11')][_0xe264('0x10')];_0x5c7c2f['port']=_0x2b97db[_0xe264('0xe')][_0xe264('0x11')][_0xe264('0x12')];_0x5c7c2f[_0xe264('0x13')]=_0x2b97db[_0xe264('0xe')]['Smtp']['secure'];}if(_0x2b97db[_0xe264('0xe')][_0xe264('0x11')]['authentication']){_0x5c7c2f['auth']={'user':_0x2b97db[_0xe264('0xe')][_0xe264('0x11')]['user'],'pass':_0x2b97db[_0xe264('0xe')][_0xe264('0x11')][_0xe264('0x14')]};}var _0x47aa3c={'account':_0x5c7c2f,'message':{'from':util[_0xe264('0x15')](_0xe264('0x16'),_0x2b97db[_0xe264('0xe')]['name'],_0x2b97db['MailAccount']['email']||_0x2b97db[_0xe264('0xe')]['Smtp'][_0xe264('0x17')]),'to':_0x2b97db[_0xe264('0xd')],'cc':_0x2b97db['cc'],'bcc':_0x2b97db[_0xe264('0x18')],'subject':util[_0xe264('0x15')](_0xe264('0x19'),_0x246fa8[_0xe264('0x1a')],_0x2b97db[_0xe264('0x1b')],_0x2b97db['subtractUnit'])}};var _0x50e9f5=path['join'](__dirname,_0xe264('0x1c'));var _0x8577de=_0x246fa8[_0xe264('0x1d')];var _0x17d230=util[_0xe264('0x15')](_0xe264('0x1e'),path['basename'](_0x246fa8[_0xe264('0x1d')],path[_0xe264('0x1f')](_0x246fa8[_0xe264('0x1d')])),'zip');var _0x446a12=path[_0xe264('0x20')](_0x50e9f5,_0x8577de);var _0x1cda89=path[_0xe264('0x20')](_0x50e9f5,_0x17d230);if(fs['existsSync'](_0x446a12)){_0x246fa8[_0xe264('0x21')]=_0xe264('0x22');_0x47aa3c['message']['attachments']=[{'filename':_0x8577de,'path':_0x446a12}];_0x47aa3c[_0xe264('0x23')]['text']=util[_0xe264('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xe264('0x24')](_0x246fa8,null,0x2));}else if(fs[_0xe264('0x25')](_0x1cda89)){_0x246fa8[_0xe264('0x21')]=_0xe264('0x22');_0x47aa3c[_0xe264('0x23')][_0xe264('0x26')]=[{'filename':_0x17d230,'path':_0x1cda89}];}else{_0x47aa3c[_0xe264('0x23')][_0xe264('0x27')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2b97db[_0xe264('0x28')]){_0x3545a2=![];logger['info'](_0xe264('0x29'));}}if(_0x3545a2){return client['request']('SendMail',_0x47aa3c)[_0xe264('0x2a')](function(_0x18dbc8){if(_0x18dbc8[_0xe264('0x2b')]){return logger[_0xe264('0x2b')](_0xe264('0x2c'),JSON[_0xe264('0x24')](_0x18dbc8));}return logger[_0xe264('0xb')](_0xe264('0x2d'));})[_0xe264('0x2e')](function(_0x5290ec){return logger[_0xe264('0x2b')](_0xe264('0x2c'),JSON['stringify'](_0x5290ec));});}};}function handleError(){return function(_0x3d318b){return logger['error'](JSON[_0xe264('0x24')](_0x3d318b));};}function handleResult(_0x295edd){return function(_0x46da39){logger[_0xe264('0xb')](_0xe264('0x2f'),JSON['stringify'](_0x46da39));if(_0x295edd[_0xe264('0xe')]&&_0x295edd[_0xe264('0xe')][_0xe264('0x11')]&&!_['isNil'](_0x295edd[_0xe264('0xd')])){setTimeout(handleSendEmail(_0x295edd,_0x46da39),0x3c*0x3e8);}};}function handleJob(_0x2bf528){return function(){try{if(_[_0xe264('0x30')](_0x2bf528[_0xe264('0x1b')])){return logger[_0xe264('0xb')](_0xe264('0x31'));}if(_[_0xe264('0x30')](_0x2bf528[_0xe264('0x32')])){return logger[_0xe264('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x57ebf8={'startDate':moment()[_0xe264('0x33')](_0x2bf528[_0xe264('0x1b')],_0x2bf528['subtractUnit'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xe264('0x34')),'type':_0xe264('0x35'),'output':_0x2bf528['output'],'name':_0x2bf528[_0xe264('0x1a')]};if(!_[_0xe264('0x30')](_0x2bf528[_0xe264('0x36')])){logger[_0xe264('0xb')](_0xe264('0x37'),_0x2bf528[_0xe264('0x36')]);return analyticDefaultReportController[_0xe264('0x38')]({'id':_0x2bf528[_0xe264('0x36')]},_0x57ebf8)[_0xe264('0x2a')](handleResult(_0x2bf528))[_0xe264('0x2e')](handleError());}if(!_[_0xe264('0x30')](_0x2bf528[_0xe264('0x39')])){logger[_0xe264('0xb')](_0xe264('0x3a'),_0x2bf528[_0xe264('0x39')]);return analyticCustomReportController['runReport']({'id':_0x2bf528[_0xe264('0x39')]},_0x57ebf8)[_0xe264('0x2a')](handleResult(_0x2bf528))['catch'](handleError());}}catch(_0x3bf129){logger[_0xe264('0x2b')](JSON[_0xe264('0x24')](_0x3bf129));}return logger[_0xe264('0xb')](_0xe264('0x3b'));};}function getJobs(_0x28acb7){var _0x20c7fa={};if(_0x28acb7){_0x20c7fa['id']=_0x28acb7;}return db[_0xe264('0x3c')][_0xe264('0x3d')]({'where':_0x20c7fa,'include':[{'model':db[_0xe264('0xe')],'attributes':['id',_0xe264('0x1a'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xe264('0x11')}]}]})[_0xe264('0x2a')](function(_0x38aa82){var _0x2d9714=_[_0xe264('0x3e')](manager[_0xe264('0x3f')]);var _0x5c83ae=_[_0xe264('0x40')](_0x38aa82,function(_0x105638){return _0x105638['id']['toString']();});var _0x4da243=_[_0xe264('0x41')](_0x38aa82,function(_0x4ba099){return _0x4ba099['id'][_0xe264('0x42')]();});var _0x1e5816=_0x28acb7?_0x5c83ae:_[_0xe264('0x43')](_0x5c83ae,_0x2d9714);var _0x59867f=_[_0xe264('0x44')](_0x5c83ae,_0x2d9714);var _0x51611f=_[_0xe264('0x43')](_0x2d9714,_0x5c83ae);var _0xb53589;var _0x462883;for(_0xb53589=0x0;_0xb53589<_0x51611f[_0xe264('0x45')]&&!_0x28acb7;_0xb53589+=0x1){_0x462883=_0x51611f[_0xb53589][_0xe264('0x42')]();if(manager[_0xe264('0x46')](_0x462883)){manager[_0xe264('0x47')](_0x462883);manager['deleteJob'](_0x462883);logger['info'](_0xe264('0x48'),_0x462883);}}logger[_0xe264('0xb')](_0xe264('0x49'),JSON[_0xe264('0x24')](_0x1e5816));for(_0xb53589=0x0;_0xb53589<_0x1e5816[_0xe264('0x45')];_0xb53589+=0x1){_0x462883=_0x1e5816[_0xb53589]['toString']();logger[_0xe264('0xb')](_0xe264('0x4a'),_0x462883);if(_0x28acb7){logger[_0xe264('0xb')](_0xe264('0x4b'),_0x28acb7);logger['info'](JSON[_0xe264('0x24')](_0x4da243[_0x462883]));BPromise['resolve']()['then'](handleJob(_0x4da243[_0x462883]));logger[_0xe264('0xb')](_0xe264('0x4c'),_0x4da243[_0x462883]['name'],_0x4da243[_0x462883][_0xe264('0x4d')]);}else if(_0x4da243[_0x462883][_0xe264('0x4d')]&&_0x4da243[_0x462883][_0xe264('0x4e')]&&moment()[_0xe264('0x4f')](_0x4da243[_0x462883]['startAt'],_0x4da243[_0x462883][_0xe264('0x50')])){manager[_0xe264('0x51')](_0x462883,_0x4da243[_0x462883][_0xe264('0x4d')],handleJob(_0x4da243[_0x462883]));manager[_0xe264('0x52')](_0x462883);logger[_0xe264('0xb')](_0xe264('0x53'),_0x4da243[_0x462883]['name'],_0x4da243[_0x462883]['cron']);}else if(manager['exists'](_0x462883)){manager[_0xe264('0x47')](_0x462883);manager['deleteJob'](_0x462883);logger[_0xe264('0xb')](_0xe264('0x54'),_0x4da243[_0x462883][_0xe264('0x1a')],_0x4da243[_0x462883][_0xe264('0x4d')]);}}for(_0xb53589=0x0,_0x462883;_0xb53589<_0x59867f[_0xe264('0x45')]&&!_0x28acb7;_0xb53589+=0x1){_0x462883=_0x59867f[_0xb53589][_0xe264('0x42')]();if(manager[_0xe264('0x46')](_0x462883)){if(_0x4da243[_0x462883]['cron']&&_0x4da243[_0x462883][_0xe264('0x4e')]&&moment()[_0xe264('0x4f')](_0x4da243[_0x462883]['startAt'],_0x4da243[_0x462883][_0xe264('0x50')])){manager[_0xe264('0x55')](_0x462883,_0x4da243[_0x462883][_0xe264('0x4d')],handleJob(_0x4da243[_0x462883]));logger['info'](_0xe264('0x56'),_0x4da243[_0x462883]['name'],_0x4da243[_0x462883]['cron']);}else{manager['stop'](_0x462883);manager[_0xe264('0x57')](_0x462883);logger['info']('stop\x20cron',_0x4da243[_0x462883][_0xe264('0x1a')],_0x4da243[_0x462883][_0xe264('0x4d')]);}}}})[_0xe264('0x2e')](function(_0x3fc348){logger[_0xe264('0x2b')](JSON['stringify'](_0x3fc348));});}exports[_0xe264('0x58')]=function(_0x1084b3){return getJobs(_0x1084b3);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x444b=['subtractNumber','join','../../files/reports','savename','basename','extname','zip','existsSync','Sent','message','attachments','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','length','stop','deleteJob','index','resolve','cron','active','isBetween','add','start','exists','startAt','update','update\x20cron','stop\x20cron','run','lodash','moment','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','bcc','format','Report\x20%s\x20last\x20%s\x20%s'];(function(_0x578d1a,_0x281b05){var _0x4e470f=function(_0x3eade1){while(--_0x3eade1){_0x578d1a['push'](_0x578d1a['shift']());}};_0x4e470f(++_0x281b05);}(_0x444b,0x142));var _0xb444=function(_0x4a5362,_0x1bfc44){_0x4a5362=_0x4a5362-0x0;var _0x3bf22c=_0x444b[_0x4a5362];return _0x3bf22c;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0xb444('0x0'));var moment=require(_0xb444('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xb444('0x2'));var BPromise=require(_0xb444('0x3'));var logger=require('../logger')(_0xb444('0x4'));var db=require(_0xb444('0x5'))['db'];var analyticCustomReportController=require(_0xb444('0x6'));var analyticDefaultReportController=require(_0xb444('0x7'));var client=jayson[_0xb444('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x42766b,_0x10fb86){return function(){logger['info'](_0xb444('0x9'),_0x42766b[_0xb444('0xa')]);var _0xd912ae=!![];var _0x1501eb={'tls':{'rejectUnauthorized':![]}};if(_0x42766b[_0xb444('0xb')][_0xb444('0xc')]['service']){_0x1501eb[_0xb444('0xd')]=_0x42766b[_0xb444('0xb')]['Smtp'][_0xb444('0xd')];}else{_0x1501eb[_0xb444('0xe')]=_0x42766b[_0xb444('0xb')][_0xb444('0xc')][_0xb444('0xe')];_0x1501eb[_0xb444('0xf')]=_0x42766b[_0xb444('0xb')][_0xb444('0xc')][_0xb444('0xf')];_0x1501eb[_0xb444('0x10')]=_0x42766b['MailAccount'][_0xb444('0xc')][_0xb444('0x10')];}if(_0x42766b['MailAccount']['Smtp'][_0xb444('0x11')]){_0x1501eb[_0xb444('0x12')]={'user':_0x42766b[_0xb444('0xb')][_0xb444('0xc')][_0xb444('0x13')],'pass':_0x42766b['MailAccount'][_0xb444('0xc')][_0xb444('0x14')]};}var _0x229265={'account':_0x1501eb,'message':{'from':util['format'](_0xb444('0x15'),_0x42766b['MailAccount'][_0xb444('0x16')],_0x42766b[_0xb444('0xb')][_0xb444('0xa')]||_0x42766b[_0xb444('0xb')][_0xb444('0xc')][_0xb444('0x13')]),'to':_0x42766b['email'],'cc':_0x42766b['cc'],'bcc':_0x42766b[_0xb444('0x17')],'subject':util[_0xb444('0x18')](_0xb444('0x19'),_0x10fb86[_0xb444('0x16')],_0x42766b[_0xb444('0x1a')],_0x42766b['subtractUnit'])}};var _0x46aa5f=path[_0xb444('0x1b')](__dirname,_0xb444('0x1c'));var _0x11d684=_0x10fb86[_0xb444('0x1d')];var _0x1c48f9=util[_0xb444('0x18')]('%s.%s',path[_0xb444('0x1e')](_0x10fb86['savename'],path[_0xb444('0x1f')](_0x10fb86[_0xb444('0x1d')])),_0xb444('0x20'));var _0x1d7708=path[_0xb444('0x1b')](_0x46aa5f,_0x11d684);var _0x122570=path['join'](_0x46aa5f,_0x1c48f9);if(fs[_0xb444('0x21')](_0x1d7708)){_0x10fb86['status']=_0xb444('0x22');_0x229265[_0xb444('0x23')][_0xb444('0x24')]=[{'filename':_0x11d684,'path':_0x1d7708}];_0x229265['message'][_0xb444('0x25')]=util[_0xb444('0x18')](_0xb444('0x26'),JSON[_0xb444('0x27')](_0x10fb86,null,0x2));}else if(fs[_0xb444('0x21')](_0x122570)){_0x10fb86['status']=_0xb444('0x22');_0x229265['message'][_0xb444('0x24')]=[{'filename':_0x1c48f9,'path':_0x122570}];}else{_0x229265[_0xb444('0x23')][_0xb444('0x25')]=_0xb444('0x28');if(!_0x42766b[_0xb444('0x29')]){_0xd912ae=![];logger[_0xb444('0x2a')](_0xb444('0x2b'));}}if(_0xd912ae){return client['request'](_0xb444('0x2c'),_0x229265)[_0xb444('0x2d')](function(_0x133d5e){if(_0x133d5e['error']){return logger[_0xb444('0x2e')](_0xb444('0x2f'),JSON[_0xb444('0x27')](_0x133d5e));}return logger[_0xb444('0x2a')](_0xb444('0x30'));})[_0xb444('0x31')](function(_0xf1b50){return logger[_0xb444('0x2e')](_0xb444('0x2f'),JSON[_0xb444('0x27')](_0xf1b50));});}};}function handleError(){return function(_0x1b4cf9){return logger[_0xb444('0x2e')](JSON[_0xb444('0x27')](_0x1b4cf9));};}function handleResult(_0x226ab7){return function(_0x35f3f0){logger[_0xb444('0x2a')](_0xb444('0x32'),JSON[_0xb444('0x27')](_0x35f3f0));if(_0x226ab7[_0xb444('0xb')]&&_0x226ab7[_0xb444('0xb')][_0xb444('0xc')]&&!_[_0xb444('0x33')](_0x226ab7['email'])){setTimeout(handleSendEmail(_0x226ab7,_0x35f3f0),0x3c*0x3e8);}};}function handleJob(_0x24cfe1){return function(){try{if(_[_0xb444('0x33')](_0x24cfe1[_0xb444('0x1a')])){return logger[_0xb444('0x2a')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xb444('0x33')](_0x24cfe1[_0xb444('0x34')])){return logger[_0xb444('0x2a')](_0xb444('0x35'));}var _0x15ba48={'startDate':moment()[_0xb444('0x36')](_0x24cfe1['subtractNumber'],_0x24cfe1['subtractUnit'])[_0xb444('0x18')](_0xb444('0x37')),'endDate':moment()['format'](_0xb444('0x37')),'type':'scheduled','output':_0x24cfe1[_0xb444('0x38')],'name':_0x24cfe1['name']};if(!_[_0xb444('0x33')](_0x24cfe1['DefaultReportId'])){logger[_0xb444('0x2a')](_0xb444('0x39'),_0x24cfe1[_0xb444('0x3a')]);return analyticDefaultReportController[_0xb444('0x3b')]({'id':_0x24cfe1[_0xb444('0x3a')]},_0x15ba48)[_0xb444('0x2d')](handleResult(_0x24cfe1))[_0xb444('0x31')](handleError());}if(!_[_0xb444('0x33')](_0x24cfe1[_0xb444('0x3c')])){logger[_0xb444('0x2a')](_0xb444('0x3d'),_0x24cfe1['CustomReportId']);return analyticCustomReportController[_0xb444('0x3b')]({'id':_0x24cfe1[_0xb444('0x3c')]},_0x15ba48)[_0xb444('0x2d')](handleResult(_0x24cfe1))[_0xb444('0x31')](handleError());}}catch(_0x3495f2){logger[_0xb444('0x2e')](JSON[_0xb444('0x27')](_0x3495f2));}return logger[_0xb444('0x2a')](_0xb444('0x3e'));};}function getJobs(_0x52f07a){var _0x4d1333={};if(_0x52f07a){_0x4d1333['id']=_0x52f07a;}return db[_0xb444('0x3f')][_0xb444('0x40')]({'where':_0x4d1333,'include':[{'model':db[_0xb444('0xb')],'attributes':['id',_0xb444('0x16'),_0xb444('0xa')],'include':[{'model':db[_0xb444('0x41')],'as':_0xb444('0xc')}]}]})[_0xb444('0x2d')](function(_0x2a4332){var _0x574ca0=_[_0xb444('0x42')](manager[_0xb444('0x43')]);var _0x1f8b57=_[_0xb444('0x44')](_0x2a4332,function(_0x18e68f){return _0x18e68f['id']['toString']();});var _0x2434eb=_['keyBy'](_0x2a4332,function(_0x4c948a){return _0x4c948a['id'][_0xb444('0x45')]();});var _0x45a028=_0x52f07a?_0x1f8b57:_[_0xb444('0x46')](_0x1f8b57,_0x574ca0);var _0x3f02fd=_['intersection'](_0x1f8b57,_0x574ca0);var _0x1925b8=_[_0xb444('0x46')](_0x574ca0,_0x1f8b57);var _0x27b56e;var _0x2bf8d5;for(_0x27b56e=0x0;_0x27b56e<_0x1925b8[_0xb444('0x47')]&&!_0x52f07a;_0x27b56e+=0x1){_0x2bf8d5=_0x1925b8[_0x27b56e][_0xb444('0x45')]();if(manager['exists'](_0x2bf8d5)){manager[_0xb444('0x48')](_0x2bf8d5);manager[_0xb444('0x49')](_0x2bf8d5);logger[_0xb444('0x2a')]('delete\x20cron',_0x2bf8d5);}}logger[_0xb444('0x2a')]('toRun',JSON['stringify'](_0x45a028));for(_0x27b56e=0x0;_0x27b56e<_0x45a028[_0xb444('0x47')];_0x27b56e+=0x1){_0x2bf8d5=_0x45a028[_0x27b56e][_0xb444('0x45')]();logger[_0xb444('0x2a')](_0xb444('0x4a'),_0x2bf8d5);if(_0x52f07a){logger[_0xb444('0x2a')]('my\x20id',_0x52f07a);logger['info'](JSON['stringify'](_0x2434eb[_0x2bf8d5]));BPromise[_0xb444('0x4b')]()[_0xb444('0x2d')](handleJob(_0x2434eb[_0x2bf8d5]));logger[_0xb444('0x2a')]('run\x20job',_0x2434eb[_0x2bf8d5][_0xb444('0x16')],_0x2434eb[_0x2bf8d5][_0xb444('0x4c')]);}else if(_0x2434eb[_0x2bf8d5]['cron']&&_0x2434eb[_0x2bf8d5][_0xb444('0x4d')]&&moment()[_0xb444('0x4e')](_0x2434eb[_0x2bf8d5]['startAt'],_0x2434eb[_0x2bf8d5]['endAt'])){manager[_0xb444('0x4f')](_0x2bf8d5,_0x2434eb[_0x2bf8d5][_0xb444('0x4c')],handleJob(_0x2434eb[_0x2bf8d5]));manager[_0xb444('0x50')](_0x2bf8d5);logger['info']('add\x20cron',_0x2434eb[_0x2bf8d5]['name'],_0x2434eb[_0x2bf8d5][_0xb444('0x4c')]);}else if(manager[_0xb444('0x51')](_0x2bf8d5)){manager['stop'](_0x2bf8d5);manager[_0xb444('0x49')](_0x2bf8d5);logger[_0xb444('0x2a')]('stop\x20cron',_0x2434eb[_0x2bf8d5]['name'],_0x2434eb[_0x2bf8d5][_0xb444('0x4c')]);}}for(_0x27b56e=0x0,_0x2bf8d5;_0x27b56e<_0x3f02fd[_0xb444('0x47')]&&!_0x52f07a;_0x27b56e+=0x1){_0x2bf8d5=_0x3f02fd[_0x27b56e][_0xb444('0x45')]();if(manager[_0xb444('0x51')](_0x2bf8d5)){if(_0x2434eb[_0x2bf8d5][_0xb444('0x4c')]&&_0x2434eb[_0x2bf8d5][_0xb444('0x4d')]&&moment()[_0xb444('0x4e')](_0x2434eb[_0x2bf8d5][_0xb444('0x52')],_0x2434eb[_0x2bf8d5]['endAt'])){manager[_0xb444('0x53')](_0x2bf8d5,_0x2434eb[_0x2bf8d5][_0xb444('0x4c')],handleJob(_0x2434eb[_0x2bf8d5]));logger[_0xb444('0x2a')](_0xb444('0x54'),_0x2434eb[_0x2bf8d5][_0xb444('0x16')],_0x2434eb[_0x2bf8d5][_0xb444('0x4c')]);}else{manager[_0xb444('0x48')](_0x2bf8d5);manager[_0xb444('0x49')](_0x2bf8d5);logger[_0xb444('0x2a')](_0xb444('0x55'),_0x2434eb[_0x2bf8d5][_0xb444('0x16')],_0x2434eb[_0x2bf8d5]['cron']);}}}})[_0xb444('0x31')](function(_0x3e8f55){logger[_0xb444('0x2e')](JSON[_0xb444('0x27')](_0x3e8f55));});}exports[_0xb444('0x56')]=function(_0x342c4a){return getJobs(_0x342c4a);};exports[_0xb444('0x50')]=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 729e828..185a7ce 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 _0xb921=['TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','ValidationError','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','COMPLETED','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','start','lodash','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0x1af2a3,_0x5d2c7c){var _0x2be1b0=function(_0x51c3a0){while(--_0x51c3a0){_0x1af2a3['push'](_0x1af2a3['shift']());}};_0x2be1b0(++_0x5d2c7c);}(_0xb921,0x16a));var _0x1b92=function(_0x229101,_0x31339d){_0x229101=_0x229101-0x0;var _0xc93cb=_0xb921[_0x229101];return _0xc93cb;};var _=require(_0x1b92('0x0'));var AWS=require(_0x1b92('0x1'));var rp=require(_0x1b92('0x2'));var util=require(_0x1b92('0x3'));var BPromise=require(_0x1b92('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x1b92('0x5'));function getTranscriptionJob(_0xc3832e,_0x1e49a8,_0x10868d,_0x464cc4){return new Promise(function(_0x29a1db,_0x4358e3){var _0x8a6282=new AWS[(_0x1b92('0x6'))]({'accessKeyId':_0x1e49a8,'secretAccessKey':_0xc3832e,'region':_0x10868d});_0x8a6282[_0x1b92('0x7')]({'TranscriptionJobName':_0x464cc4},function(_0x1545f9,_0x64a3ed){if(_0x1545f9){return _0x4358e3(_0x1545f9);}else{return _0x29a1db(_0x64a3ed);}});});}function sentiment(_0x2cf050,_0x37b876,_0x4567ab,_0x4c8e30,_0x31e314){return new Promise(function(_0x1e5802,_0x154b6d){var _0x146d68=new AWS[(_0x1b92('0x8'))]({'accessKeyId':_0x37b876,'secretAccessKey':_0x2cf050,'region':_0x4567ab});_0x146d68[_0x1b92('0x9')]({'Text':_0x4c8e30,'LanguageCode':_0x31e314[_0x1b92('0xa')](0x0,0x2)},function(_0x4aee95,_0x352b18){if(_0x4aee95){return _0x154b6d(_0x4aee95);}else{return _0x1e5802(_0x352b18);}});});}function checkTranscribeJob(_0x3b5e5b,_0x5a1ca5,_0x81cbe0){var _0x29a7ed;return new BPromise(function(_0x2c07a4,_0x178f66){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0xd'),_0x3b5e5b['id'],_0x3b5e5b['transcribeName']));return getTranscriptionJob(_0x81cbe0[_0x1b92('0xe')],_0x81cbe0['data2'],_0x5a1ca5[_0x1b92('0xf')],_0x3b5e5b['transcribeName'])[_0x1b92('0x10')](function(_0x523285){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x11'),_0x3b5e5b['id'],_0x3b5e5b['transcribeName'],_0x523285[_0x1b92('0x12')][_0x1b92('0x13')]));if(!_0x3b5e5b[_0x1b92('0x14')]){switch(_0x523285[_0x1b92('0x12')][_0x1b92('0x13')]){case'COMPLETED':var _0x4024bf={'transcribeStatus':_0x523285[_0x1b92('0x12')][_0x1b92('0x13')],'fileUri':_0x523285['TranscriptionJob'][_0x1b92('0x15')][_0x1b92('0x16')]};logger[_0x1b92('0xb')](util['format'](_0x1b92('0x17'),_0x3b5e5b['id']));return rp({'uri':_0x523285['TranscriptionJob'][_0x1b92('0x15')][_0x1b92('0x16')],'json':!![]})['then'](function(_0x4ea25f){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x18'),_0x3b5e5b['id']));if(_0x4ea25f&&_0x4ea25f[_0x1b92('0x19')]&&_0x4ea25f[_0x1b92('0x19')][_0x1b92('0x1a')]&&_0x4ea25f['results'][_0x1b92('0x1a')][_0x1b92('0x1b')]){_0x4024bf[_0x1b92('0x14')]='';for(var _0x39dcaa=0x0;_0x39dcaa<_0x4ea25f['results'][_0x1b92('0x1a')]['length'];_0x39dcaa++){_0x4024bf[_0x1b92('0x14')]+=_0x4ea25f[_0x1b92('0x19')][_0x1b92('0x1a')][_0x39dcaa][_0x1b92('0x1c')]+'';}}return _0x3b5e5b[_0x1b92('0x1d')](_0x4024bf);})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util[_0x1b92('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3b5e5b['id']));if(!_0x3b5e5b['tempSentiment']){throw new db['Sequelize'][(_0x1b92('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5a1ca5[_0x1b92('0x1f')]||!_0x5a1ca5['sentimentAccountId']||!_0x5a1ca5[_0x1b92('0x20')]||!_0x5a1ca5[_0x1b92('0x21')]||!_0x5a1ca5[_0x1b92('0x22')]){throw new db['Sequelize'][(_0x1b92('0x1e'))](_0x1b92('0x23'));}if(!_0x4024bf['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5a1ca5[_0x1b92('0x24')]===_0x81cbe0['id']){return _0x81cbe0;}else{return db[_0x1b92('0x25')][_0x1b92('0x26')]({'where':{'id':_settings[_0x1b92('0x24')]}});}})[_0x1b92('0x10')](function(_0x50eddf){if(!_0x50eddf){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x28'));}if(!_0x50eddf[_0x1b92('0xe')]||!_0x50eddf[_0x1b92('0x29')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x29a7ed=_0x50eddf;logger[_0x1b92('0xb')](util[_0x1b92('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3b5e5b['id']));return sentiment(_0x29a7ed[_0x1b92('0xe')],_0x29a7ed[_0x1b92('0x29')],_0x5a1ca5[_0x1b92('0x20')],_0x4024bf['fileText'],_0x5a1ca5[_0x1b92('0x21')]);})[_0x1b92('0x10')](function(_0x5cce14){logger['info'](util[_0x1b92('0xc')](_0x1b92('0x2a'),_0x3b5e5b['id']));return _0x3b5e5b[_0x1b92('0x1d')]({'sentiment':_0x5cce14[_0x1b92('0x2b')],'sPositive':_0x5cce14['SentimentScore']['Positive'],'sNegative':_0x5cce14['SentimentScore'][_0x1b92('0x2c')],'sMixed':_0x5cce14[_0x1b92('0x2d')][_0x1b92('0x2e')],'sNeutral':_0x5cce14[_0x1b92('0x2d')][_0x1b92('0x2f')]});})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util['format'](_0x1b92('0x30'),_0x3b5e5b['id']));_0x2c07a4();});case _0x1b92('0x31'):return _0x3b5e5b['update']({'transcribeStatus':_0x1b92('0x31'),'failureReason':_0x523285[_0x1b92('0x12')][_0x1b92('0x32')]})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x30'),_0x3b5e5b['id']));_0x2c07a4();});default:logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x33'),_0x3b5e5b['id']));break;}}else{return BPromise['resolve']()[_0x1b92('0x10')](function(){if(!_0x3b5e5b['tempSentiment']){throw new db[(_0x1b92('0x27'))]['ValidationError'](_0x1b92('0x34'));}if(!_0x5a1ca5[_0x1b92('0x1f')]||!_0x5a1ca5[_0x1b92('0x24')]||!_0x5a1ca5[_0x1b92('0x20')]||!_0x5a1ca5[_0x1b92('0x21')]||!_0x5a1ca5[_0x1b92('0x22')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x23'));}if(!_0x3b5e5b['fileText']){throw new Error(_0x1b92('0x35'));}if(_0x5a1ca5['sentimentAccountId']===_0x81cbe0['id']){return _0x81cbe0;}else{return db[_0x1b92('0x25')][_0x1b92('0x26')]({'where':{'id':_settings[_0x1b92('0x24')]}});}})[_0x1b92('0x10')](function(_0x52a982){if(!_0x52a982){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x28'));}if(!_0x52a982[_0x1b92('0xe')]||!_0x52a982[_0x1b92('0x29')]){throw new db[(_0x1b92('0x27'))]['ValidationError'](_0x1b92('0x36'));}_0x29a7ed=_0x52a982;logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x37'),_0x3b5e5b['id']));return sentiment(_0x29a7ed[_0x1b92('0xe')],_0x29a7ed[_0x1b92('0x29')],_0x5a1ca5['sentimentRegion'],_0x3b5e5b[_0x1b92('0x14')],_0x5a1ca5[_0x1b92('0x21')]);})['then'](function(_0x4af49c){logger['info'](util[_0x1b92('0xc')](_0x1b92('0x2a'),_0x3b5e5b['id']));return _0x3b5e5b[_0x1b92('0x1d')]({'sentiment':_0x4af49c['Sentiment'],'sPositive':_0x4af49c[_0x1b92('0x2d')][_0x1b92('0x38')],'sNegative':_0x4af49c['SentimentScore']['Negative'],'sMixed':_0x4af49c['SentimentScore'][_0x1b92('0x2e')],'sNeutral':_0x4af49c[_0x1b92('0x2d')][_0x1b92('0x2f')],'transcribeStatus':_0x1b92('0x39')});})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util['format'](_0x1b92('0x30'),_0x3b5e5b['id']));_0x2c07a4();});}})[_0x1b92('0x3a')](function(_0x498012){if(_0x498012){if(!_0x498012[_0x1b92('0x3b')]||_0x498012[_0x1b92('0x3b')]!==_0x1b92('0x3c')){logger['error'](util[_0x1b92('0xc')](_0x1b92('0x3d'),_0x3b5e5b['id']),util[_0x1b92('0x3e')](_0x498012,{'showHidden':![],'depth':null}));}}_0x2c07a4();});});}function checkTranscribe(){var _0x3d57d3;var _0x199c29;var _0x5ac096;return db[_0x1b92('0x3f')][_0x1b92('0x40')]({'where':{'transcribeStatus':_0x1b92('0x41')}})[_0x1b92('0x10')](function(_0x619e35){if(!_0x619e35||!_0x619e35['length']){throw new db['Sequelize'][(_0x1b92('0x1e'))](_0x1b92('0x42'));}_0x3d57d3=_0x619e35;return db[_0x1b92('0x43')][_0x1b92('0x26')]({'where':{'id':0x1}});})['then'](function(_0x4e0954){if(!_0x4e0954){throw new db[(_0x1b92('0x27'))]['ValidationError'](_0x1b92('0x44'));}_0x199c29=_0x4e0954;if(!_0x199c29[_0x1b92('0x5')]||!_0x199c29[_0x1b92('0x45')]||!_0x199c29['transcribeRegion']||!_0x199c29[_0x1b92('0x21')]||!_0x199c29[_0x1b92('0x22')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x46'));}return db[_0x1b92('0x25')][_0x1b92('0x26')]({'where':{'id':_0x199c29[_0x1b92('0x45')]}});})['then'](function(_0x140202){if(!_0x140202){throw new db['Sequelize'][(_0x1b92('0x1e'))](_0x1b92('0x28'));}if(!_0x140202[_0x1b92('0xe')]||!_0x140202[_0x1b92('0x29')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x36'));}_0x5ac096=_0x140202;var _0x32d994=[];_0x3d57d3[_0x1b92('0x47')](function(_0x23e03a){_0x32d994[_0x1b92('0x48')](checkTranscribeJob(_0x23e03a,_0x199c29,_0x5ac096));});return BPromise[_0x1b92('0x49')](_0x32d994);})[_0x1b92('0x3a')](function(_0x181e03){if(_0x181e03){if(!_0x181e03[_0x1b92('0x3b')]||_0x181e03[_0x1b92('0x3b')]!==_0x1b92('0x3c')){logger[_0x1b92('0x4a')](util[_0x1b92('0x3e')](_0x181e03,{'showHidden':![],'depth':null}));}}});}exports[_0x1b92('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x9b00=['[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','length','results','fileText','transcript','update','tempSentiment','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data2','transcribeRegion','then'];(function(_0x105660,_0x13447d){var _0x4c6542=function(_0x35df52){while(--_0x35df52){_0x105660['push'](_0x105660['shift']());}};_0x4c6542(++_0x13447d);}(_0x9b00,0xcc));var _0x09b0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9b00[_0x465028];return _0xb783d4;};var _=require(_0x09b0('0x0'));var AWS=require(_0x09b0('0x1'));var rp=require(_0x09b0('0x2'));var util=require('util');var BPromise=require(_0x09b0('0x3'));var db=require(_0x09b0('0x4'))['db'];var logger=require(_0x09b0('0x5'))(_0x09b0('0x6'));function getTranscriptionJob(_0x405978,_0x3c02c5,_0x2e56a5,_0x53c312){return new Promise(function(_0x79bc56,_0x57b9e0){var _0x20c971=new AWS[(_0x09b0('0x7'))]({'accessKeyId':_0x3c02c5,'secretAccessKey':_0x405978,'region':_0x2e56a5});_0x20c971[_0x09b0('0x8')]({'TranscriptionJobName':_0x53c312},function(_0x4290c7,_0x1bc2ce){if(_0x4290c7){return _0x57b9e0(_0x4290c7);}else{return _0x79bc56(_0x1bc2ce);}});});}function sentiment(_0x419960,_0x289d1d,_0x541785,_0x231740,_0x3f9abd){return new Promise(function(_0x2a948f,_0x247ab0){var _0x3847f9=new AWS[(_0x09b0('0x9'))]({'accessKeyId':_0x289d1d,'secretAccessKey':_0x419960,'region':_0x541785});_0x3847f9[_0x09b0('0xa')]({'Text':_0x231740,'LanguageCode':_0x3f9abd[_0x09b0('0xb')](0x0,0x2)},function(_0x2d487b,_0xb85ce3){if(_0x2d487b){return _0x247ab0(_0x2d487b);}else{return _0x2a948f(_0xb85ce3);}});});}function checkTranscribeJob(_0x3871d5,_0x48689b,_0x2e2ad5){var _0x3a43d9;return new BPromise(function(_0x11c160,_0x5e0888){logger[_0x09b0('0xc')](util[_0x09b0('0xd')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3871d5['id'],_0x3871d5[_0x09b0('0xe')]));return getTranscriptionJob(_0x2e2ad5['data1'],_0x2e2ad5[_0x09b0('0xf')],_0x48689b[_0x09b0('0x10')],_0x3871d5[_0x09b0('0xe')])[_0x09b0('0x11')](function(_0x4c23d0){logger['info'](util['format'](_0x09b0('0x12'),_0x3871d5['id'],_0x3871d5[_0x09b0('0xe')],_0x4c23d0['TranscriptionJob'][_0x09b0('0x13')]));if(!_0x3871d5['fileText']){switch(_0x4c23d0['TranscriptionJob']['TranscriptionJobStatus']){case _0x09b0('0x14'):var _0x20e8f3={'transcribeStatus':_0x4c23d0[_0x09b0('0x15')][_0x09b0('0x13')],'fileUri':_0x4c23d0[_0x09b0('0x15')][_0x09b0('0x16')][_0x09b0('0x17')]};logger[_0x09b0('0xc')](util['format'](_0x09b0('0x18'),_0x3871d5['id']));return rp({'uri':_0x4c23d0['TranscriptionJob'][_0x09b0('0x16')][_0x09b0('0x17')],'json':!![]})[_0x09b0('0x11')](function(_0x1fd062){logger[_0x09b0('0xc')](util['format'](_0x09b0('0x19'),_0x3871d5['id']));if(_0x1fd062&&_0x1fd062['results']&&_0x1fd062['results'][_0x09b0('0x1a')]&&_0x1fd062['results'][_0x09b0('0x1a')][_0x09b0('0x1b')]){_0x20e8f3['fileText']='';for(var _0x1e6324=0x0;_0x1e6324<_0x1fd062[_0x09b0('0x1c')][_0x09b0('0x1a')][_0x09b0('0x1b')];_0x1e6324++){_0x20e8f3[_0x09b0('0x1d')]+=_0x1fd062[_0x09b0('0x1c')][_0x09b0('0x1a')][_0x1e6324][_0x09b0('0x1e')]+'';}}return _0x3871d5[_0x09b0('0x1f')](_0x20e8f3);})[_0x09b0('0x11')](function(){logger[_0x09b0('0xc')](util[_0x09b0('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3871d5['id']));if(!_0x3871d5[_0x09b0('0x20')]){throw new db['Sequelize'][(_0x09b0('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x48689b[_0x09b0('0x22')]||!_0x48689b[_0x09b0('0x23')]||!_0x48689b[_0x09b0('0x24')]||!_0x48689b[_0x09b0('0x25')]||!_0x48689b['bucket']){throw new db[(_0x09b0('0x26'))][(_0x09b0('0x21'))](_0x09b0('0x27'));}if(!_0x20e8f3['fileText']){throw new Error(_0x09b0('0x28'));}if(_0x48689b[_0x09b0('0x23')]===_0x2e2ad5['id']){return _0x2e2ad5;}else{return db[_0x09b0('0x29')][_0x09b0('0x2a')]({'where':{'id':_settings[_0x09b0('0x23')]}});}})['then'](function(_0x3d5338){if(!_0x3d5338){throw new db[(_0x09b0('0x26'))][(_0x09b0('0x21'))](_0x09b0('0x2b'));}if(!_0x3d5338[_0x09b0('0x2c')]||!_0x3d5338[_0x09b0('0xf')]){throw new db[(_0x09b0('0x26'))][(_0x09b0('0x21'))](_0x09b0('0x2d'));}_0x3a43d9=_0x3d5338;logger[_0x09b0('0xc')](util[_0x09b0('0xd')](_0x09b0('0x2e'),_0x3871d5['id']));return sentiment(_0x3a43d9['data1'],_0x3a43d9[_0x09b0('0xf')],_0x48689b['sentimentRegion'],_0x20e8f3[_0x09b0('0x1d')],_0x48689b['language']);})[_0x09b0('0x11')](function(_0x6d2b00){logger[_0x09b0('0xc')](util[_0x09b0('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3871d5['id']));return _0x3871d5['update']({'sentiment':_0x6d2b00[_0x09b0('0x2f')],'sPositive':_0x6d2b00[_0x09b0('0x30')][_0x09b0('0x31')],'sNegative':_0x6d2b00[_0x09b0('0x30')]['Negative'],'sMixed':_0x6d2b00[_0x09b0('0x30')]['Mixed'],'sNeutral':_0x6d2b00['SentimentScore'][_0x09b0('0x32')]});})[_0x09b0('0x11')](function(){logger[_0x09b0('0xc')](util[_0x09b0('0xd')](_0x09b0('0x33'),_0x3871d5['id']));_0x11c160();});case _0x09b0('0x34'):return _0x3871d5[_0x09b0('0x1f')]({'transcribeStatus':'FAILED','failureReason':_0x4c23d0[_0x09b0('0x15')][_0x09b0('0x35')]})[_0x09b0('0x11')](function(){logger['info'](util[_0x09b0('0xd')](_0x09b0('0x33'),_0x3871d5['id']));_0x11c160();});default:logger[_0x09b0('0xc')](util[_0x09b0('0xd')](_0x09b0('0x36'),_0x3871d5['id']));break;}}else{return BPromise[_0x09b0('0x37')]()[_0x09b0('0x11')](function(){if(!_0x3871d5[_0x09b0('0x20')]){throw new db[(_0x09b0('0x26'))][(_0x09b0('0x21'))](_0x09b0('0x38'));}if(!_0x48689b[_0x09b0('0x22')]||!_0x48689b['sentimentAccountId']||!_0x48689b[_0x09b0('0x24')]||!_0x48689b[_0x09b0('0x25')]||!_0x48689b[_0x09b0('0x39')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3871d5[_0x09b0('0x1d')]){throw new Error(_0x09b0('0x28'));}if(_0x48689b[_0x09b0('0x23')]===_0x2e2ad5['id']){return _0x2e2ad5;}else{return db['CloudProvider'][_0x09b0('0x2a')]({'where':{'id':_settings[_0x09b0('0x23')]}});}})[_0x09b0('0x11')](function(_0x3db98c){if(!_0x3db98c){throw new db[(_0x09b0('0x26'))]['ValidationError'](_0x09b0('0x2b'));}if(!_0x3db98c[_0x09b0('0x2c')]||!_0x3db98c[_0x09b0('0xf')]){throw new db['Sequelize'][(_0x09b0('0x21'))](_0x09b0('0x2d'));}_0x3a43d9=_0x3db98c;logger[_0x09b0('0xc')](util[_0x09b0('0xd')](_0x09b0('0x2e'),_0x3871d5['id']));return sentiment(_0x3a43d9[_0x09b0('0x2c')],_0x3a43d9[_0x09b0('0xf')],_0x48689b['sentimentRegion'],_0x3871d5['fileText'],_0x48689b['language']);})['then'](function(_0x184e03){logger['info'](util[_0x09b0('0xd')](_0x09b0('0x3a'),_0x3871d5['id']));return _0x3871d5['update']({'sentiment':_0x184e03[_0x09b0('0x2f')],'sPositive':_0x184e03[_0x09b0('0x30')][_0x09b0('0x31')],'sNegative':_0x184e03['SentimentScore']['Negative'],'sMixed':_0x184e03[_0x09b0('0x30')][_0x09b0('0x3b')],'sNeutral':_0x184e03[_0x09b0('0x30')]['Neutral'],'transcribeStatus':_0x09b0('0x14')});})[_0x09b0('0x11')](function(){logger[_0x09b0('0xc')](util['format'](_0x09b0('0x33'),_0x3871d5['id']));_0x11c160();});}})[_0x09b0('0x3c')](function(_0x46409c){if(_0x46409c){if(!_0x46409c['name']||_0x46409c[_0x09b0('0x3d')]!==_0x09b0('0x3e')){logger[_0x09b0('0x3f')](util[_0x09b0('0xd')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3871d5['id']),util[_0x09b0('0x40')](_0x46409c,{'showHidden':![],'depth':null}));}}_0x11c160();});});}function checkTranscribe(){var _0x6a96fe;var _0x6cd71c;var _0x78a2b6;return db[_0x09b0('0x41')][_0x09b0('0x42')]({'where':{'transcribeStatus':_0x09b0('0x43')}})[_0x09b0('0x11')](function(_0x3bb2c6){if(!_0x3bb2c6||!_0x3bb2c6[_0x09b0('0x1b')]){throw new db[(_0x09b0('0x26'))][(_0x09b0('0x21'))]('No\x20transcribe\x20job\x20to\x20check');}_0x6a96fe=_0x3bb2c6;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x09b0('0x11')](function(_0x5315d0){if(!_0x5315d0){throw new db[(_0x09b0('0x26'))][(_0x09b0('0x21'))](_0x09b0('0x44'));}_0x6cd71c=_0x5315d0;if(!_0x6cd71c['transcribe']||!_0x6cd71c['transcribeAccountId']||!_0x6cd71c[_0x09b0('0x10')]||!_0x6cd71c[_0x09b0('0x25')]||!_0x6cd71c[_0x09b0('0x39')]){throw new db[(_0x09b0('0x26'))]['ValidationError'](_0x09b0('0x45'));}return db[_0x09b0('0x29')][_0x09b0('0x2a')]({'where':{'id':_0x6cd71c[_0x09b0('0x46')]}});})['then'](function(_0x21e1b4){if(!_0x21e1b4){throw new db[(_0x09b0('0x26'))][(_0x09b0('0x21'))](_0x09b0('0x2b'));}if(!_0x21e1b4[_0x09b0('0x2c')]||!_0x21e1b4['data2']){throw new db[(_0x09b0('0x26'))][(_0x09b0('0x21'))](_0x09b0('0x2d'));}_0x78a2b6=_0x21e1b4;var _0x24e416=[];_0x6a96fe[_0x09b0('0x47')](function(_0x28a636){_0x24e416[_0x09b0('0x48')](checkTranscribeJob(_0x28a636,_0x6cd71c,_0x78a2b6));});return BPromise['all'](_0x24e416);})[_0x09b0('0x3c')](function(_0x5ac31d){if(_0x5ac31d){if(!_0x5ac31d['name']||_0x5ac31d[_0x09b0('0x3d')]!==_0x09b0('0x3e')){logger[_0x09b0('0x3f')](util[_0x09b0('0x40')](_0x5ac31d,{'showHidden':![],'depth':null}));}}});}exports[_0x09b0('0x49')]=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 46f1055..df1dcca 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 _0x9f6b=['whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../mysqldb','../logger','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format','length','emit'];(function(_0x2ee77b,_0x51f964){var _0xe2d687=function(_0x51df21){while(--_0x51df21){_0x2ee77b['push'](_0x2ee77b['shift']());}};_0xe2d687(++_0x51f964);}(_0x9f6b,0x112));var _0xb9f6=function(_0x1df467,_0x3839b3){_0x1df467=_0x1df467-0x0;var _0x30cfff=_0x9f6b[_0x1df467];return _0x30cfff;};'use strict';var _=require(_0xb9f6('0x0'));var moment=require(_0xb9f6('0x1'));var Redis=require(_0xb9f6('0x2'));var util=require(_0xb9f6('0x3'));var config=require('../../config/environment');var db=require(_0xb9f6('0x4'))['db'];var logger=require(_0xb9f6('0x5'))('schedule');config['redis']=_[_0xb9f6('0x6')](config['redis'],{'host':_0xb9f6('0x7'),'port':0x18eb});var io=require(_0xb9f6('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x434b19=[];return db[_0xb9f6('0x9')][_0xb9f6('0xa')]({'raw':!![],'attributes':['id',_0xb9f6('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb9f6('0xc')](0x18,_0xb9f6('0xd'))}}})[_0xb9f6('0xe')](function(_0x1f74b9){if(_0x1f74b9&&_0x1f74b9['length']){_0x434b19=_[_0xb9f6('0xf')](_0x1f74b9||[],'id');logger[_0xb9f6('0x10')](_0xb9f6('0x11'),_0x434b19[_0xb9f6('0x12')]());return db[_0xb9f6('0x9')][_0xb9f6('0x13')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xb9f6('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x434b19}});}})[_0xb9f6('0xe')](function(){if(_0x434b19&&_0x434b19[_0xb9f6('0x15')]){logger[_0xb9f6('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x434b19[_0xb9f6('0x12')]());for(var _0x446b75=0x0;_0x446b75<_0x434b19[_0xb9f6('0x15')];_0x446b75++){io[_0xb9f6('0x16')](_0xb9f6('0x17'),{'id':_0x434b19[_0x446b75],'closed':!![]});}}})[_0xb9f6('0x18')](function(_0x1ee63c){logger['error'](_0xb9f6('0x19'),_0x1ee63c?util['inspect'](_0x1ee63c,{'showHidden':![],'depth':null}):'');});}exports[_0xb9f6('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5c88=['findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','WhatsappInteraction'];(function(_0x5e4819,_0x3db0da){var _0x2ca5e7=function(_0x1b19e9){while(--_0x1b19e9){_0x5e4819['push'](_0x5e4819['shift']());}};_0x2ca5e7(++_0x3db0da);}(_0x5c88,0x1e6));var _0x85c8=function(_0xaa4b4c,_0x4827f2){_0xaa4b4c=_0xaa4b4c-0x0;var _0x44ba74=_0x5c88[_0xaa4b4c];return _0x44ba74;};'use strict';var _=require(_0x85c8('0x0'));var moment=require(_0x85c8('0x1'));var Redis=require(_0x85c8('0x2'));var util=require(_0x85c8('0x3'));var config=require(_0x85c8('0x4'));var db=require(_0x85c8('0x5'))['db'];var logger=require('../logger')(_0x85c8('0x6'));config[_0x85c8('0x7')]=_[_0x85c8('0x8')](config[_0x85c8('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x85c8('0x7')]));function closeInteractions(){var _0x4bd650=[];return db[_0x85c8('0x9')][_0x85c8('0xa')]({'raw':!![],'attributes':['id',_0x85c8('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x85c8('0xc')](0x18,_0x85c8('0xd'))}}})[_0x85c8('0xe')](function(_0x1324cb){if(_0x1324cb&&_0x1324cb['length']){_0x4bd650=_[_0x85c8('0xf')](_0x1324cb||[],'id');logger[_0x85c8('0x10')](_0x85c8('0x11'),_0x4bd650[_0x85c8('0x12')]());return db[_0x85c8('0x9')][_0x85c8('0x13')]({'closeReason':'system','disposition':_0x85c8('0x14'),'closed':!![],'closedAt':moment()[_0x85c8('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4bd650}});}})[_0x85c8('0xe')](function(){if(_0x4bd650&&_0x4bd650[_0x85c8('0x16')]){logger[_0x85c8('0x10')](_0x85c8('0x17'),_0x4bd650[_0x85c8('0x12')]());for(var _0x3569ee=0x0;_0x3569ee<_0x4bd650['length'];_0x3569ee++){io[_0x85c8('0x18')](_0x85c8('0x19'),{'id':_0x4bd650[_0x3569ee],'closed':!![]});}}})[_0x85c8('0x1a')](function(_0x3b83ce){logger[_0x85c8('0x1b')](_0x85c8('0x1c'),_0x3b83ce?util[_0x85c8('0x1d')](_0x3b83ce,{'showHidden':![],'depth':null}):'');});}exports[_0x85c8('0x1e')]=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 13441cb..031f864 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x102b=['finished\x20populating','hopper1','contacts2','CmHopper','hopper2','catch','push','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','then','bulkCreate','log','destroy'];(function(_0x29aca7,_0x21c650){var _0x1db0a0=function(_0x45b5ea){while(--_0x45b5ea){_0x29aca7['push'](_0x29aca7['shift']());}};_0x1db0a0(++_0x21c650);}(_0x102b,0x176));var _0xb102=function(_0x15e70b,_0x4d426c){_0x15e70b=_0x15e70b-0x0;var _0x539e40=_0x102b[_0x15e70b];return _0x539e40;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb102('0x0')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xb102('0x1')+i,'phone':0xf879fb460+i,'email':_0xb102('0x2')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb102('0x0')]({'id':i,'active':![],'scheduledat':Date[_0xb102('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb102('0x3')](),'updatedAt':Date[_0xb102('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb102('0x0')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xb102('0x2')+i+_0xb102('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xb102('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb102('0x3')](),'updatedAt':Date[_0xb102('0x3')]()});}db[_0xb102('0x5')]['destroy']({'where':{}})[_0xb102('0x6')](function(){return db[_0xb102('0x5')][_0xb102('0x7')](contacts);})[_0xb102('0x6')](function(){console[_0xb102('0x8')]('finished\x20populating','contacts1');return db['CmHopper'][_0xb102('0x9')]({'where':{}});})[_0xb102('0x6')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xb102('0x6')](function(){console['log'](_0xb102('0xa'),_0xb102('0xb'));return db[_0xb102('0x5')]['bulkCreate'](contacts2);})[_0xb102('0x6')](function(){console[_0xb102('0x8')](_0xb102('0xa'),_0xb102('0xc'));return db[_0xb102('0xd')][_0xb102('0x7')](hopper2);})['then'](function(){console[_0xb102('0x8')]('finished\x20populating',_0xb102('0xe'));})[_0xb102('0xf')](function(_0x5f0e2b){console[_0xb102('0x8')](_0x5f0e2b);}); \ No newline at end of file +var _0x22f7=['Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','push','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','util'];(function(_0x5d0e5c,_0x1eb95f){var _0x2c4bd4=function(_0x5528dd){while(--_0x5528dd){_0x5d0e5c['push'](_0x5d0e5c['shift']());}};_0x2c4bd4(++_0x1eb95f);}(_0x22f7,0xfe));var _0x722f=function(_0x423ca9,_0x3849f3){_0x423ca9=_0x423ca9-0x0;var _0x433867=_0x22f7[_0x423ca9];return _0x433867;};'use strict';var util=require(_0x722f('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x722f('0x1')+i,'phone':0xf879fb460+i,'email':_0x722f('0x2')+i+_0x722f('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x722f('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x722f('0x4')](),'updatedAt':Date[_0x722f('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x722f('0x5')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x722f('0x2')+i+_0x722f('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x722f('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x722f('0x4')](),'updatedAt':Date[_0x722f('0x4')]()});}db[_0x722f('0x7')][_0x722f('0x8')]({'where':{}})[_0x722f('0x9')](function(){return db[_0x722f('0x7')][_0x722f('0xa')](contacts);})[_0x722f('0x9')](function(){console[_0x722f('0xb')](_0x722f('0xc'),_0x722f('0xd'));return db[_0x722f('0xe')]['destroy']({'where':{}});})[_0x722f('0x9')](function(){return db[_0x722f('0xe')]['bulkCreate'](hopper);})['then'](function(){console['log'](_0x722f('0xc'),_0x722f('0xf'));return db['CmContact'][_0x722f('0xa')](contacts2);})[_0x722f('0x9')](function(){console[_0x722f('0xb')](_0x722f('0xc'),'contacts2');return db[_0x722f('0xe')][_0x722f('0xa')](hopper2);})['then'](function(){console[_0x722f('0xb')](_0x722f('0xc'),_0x722f('0x10'));})['catch'](function(_0x2788b7){console['log'](_0x2788b7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index c2630f8..7523b31 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9de7=['../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','User','bulkCreate','log','add\x20user','util'];(function(_0x5da682,_0xa8b205){var _0x15093d=function(_0x228af6){while(--_0x228af6){_0x5da682['push'](_0x5da682['shift']());}};_0x15093d(++_0xa8b205);}(_0x9de7,0x1bf));var _0x79de=function(_0x51d4ee,_0xdead36){_0x51d4ee=_0x51d4ee-0x0;var _0x2939b0=_0x9de7[_0x51d4ee];return _0x2939b0;};'use strict';var util=require(_0x79de('0x0'));var db=require(_0x79de('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x79de('0x2')](_0x79de('0x3'),_0x79de('0x4'),i),'fullname':util[_0x79de('0x2')](_0x79de('0x3'),_0x79de('0x4'),i),'email':util[_0x79de('0x2')](_0x79de('0x5'),_0x79de('0x4'),i),'role':_0x79de('0x4'),'password':_0x79de('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x79de('0x7')],'disallow':[_0x79de('0x8')],'allow':[_0x79de('0x9')],'defaultuser':util[_0x79de('0x2')]('%s%s',_0x79de('0x4'),i),'encryption':'yes','avpf':_0x79de('0xa'),'force_avp':_0x79de('0xa'),'icesupport':_0x79de('0xa'),'dtlsenable':_0x79de('0xa'),'dtlsverify':'no','dtlscertfile':_0x79de('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x79de('0x2')]('%s%s','agent',i),0xfa0+i)});}db[_0x79de('0xc')][_0x79de('0xd')](users)['then'](function(){console[_0x79de('0xe')](_0x79de('0xf'));})['catch'](function(_0x525c0c){console[_0x79de('0xe')](_0x525c0c);}); \ No newline at end of file +var _0xba34=['%s%s','yes','/etc/pki/tls/certs/motion.crt','actpass','User','then','log','add\x20user','util','../mysqldb','push','format','agent','%s%s@xcally.com','password','wss','all','ulaw'];(function(_0x2349b4,_0x8739a1){var _0x17f76b=function(_0x5cc362){while(--_0x5cc362){_0x2349b4['push'](_0x2349b4['shift']());}};_0x17f76b(++_0x8739a1);}(_0xba34,0x1a6));var _0x4ba3=function(_0x434032,_0x50efbf){_0x434032=_0x434032-0x0;var _0x40c00f=_0xba34[_0x434032];return _0x40c00f;};'use strict';var util=require(_0x4ba3('0x0'));var db=require(_0x4ba3('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x4ba3('0x2')]({'name':util[_0x4ba3('0x3')]('%s%s',_0x4ba3('0x4'),i),'fullname':util[_0x4ba3('0x3')]('%s%s',_0x4ba3('0x4'),i),'email':util['format'](_0x4ba3('0x5'),_0x4ba3('0x4'),i),'role':_0x4ba3('0x4'),'password':_0x4ba3('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x4ba3('0x7')],'disallow':[_0x4ba3('0x8')],'allow':[_0x4ba3('0x9')],'defaultuser':util[_0x4ba3('0x3')](_0x4ba3('0xa'),_0x4ba3('0x4'),i),'encryption':_0x4ba3('0xb'),'avpf':_0x4ba3('0xb'),'force_avp':_0x4ba3('0xb'),'icesupport':_0x4ba3('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x4ba3('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x4ba3('0xd'),'callerid':util[_0x4ba3('0x3')]('\x22%s\x22\x20<%s>',util[_0x4ba3('0x3')](_0x4ba3('0xa'),_0x4ba3('0x4'),i),0xfa0+i)});}db[_0x4ba3('0xe')]['bulkCreate'](users)[_0x4ba3('0xf')](function(){console[_0x4ba3('0x10')](_0x4ba3('0x11'));})['catch'](function(_0x3b414e){console[_0x4ba3('0x10')](_0x3b414e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b05a367..5a96c27 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd916=['default','connection','setMaxListeners','address','request','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','agent','name','type','ivr','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:inbound','voice:outbound','SmsQueue','Trunk','getVoiceQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','leave','ChatInteractions','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xd916,0x18a));var _0x6d91=function(_0x549dc8,_0x4b83bc){_0x549dc8=_0x549dc8-0x0;var _0x138e37=_0xd916[_0x549dc8];return _0x138e37;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var BPromise=require(_0x6d91('0x2'));var db=require(_0x6d91('0x3'))['db'];var config=require(_0x6d91('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x6d91('0x5'),'model':db[_0x6d91('0x6')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x6d91('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6d91('0x8')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x6d91('0x8')]};var queryAgents={'raw':!![],'attributes':['id',_0x6d91('0x8')],'where':{'role':_0x6d91('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6d91('0x8'),_0x6d91('0x9')],'where':{'type':_0x6d91('0xa')}};function getAssociatedResources(_0x1c874c,_0x592be1,_0x574d9e){return db['UserProfileSection']['findOne']({'where':{'name':_0x1c874c,'userProfileId':_0x592be1},'raw':!![]})[_0x6d91('0xb')](function(_0xae0aa1){if(_0xae0aa1){if(_0xae0aa1[_0x6d91('0xc')]){switch(_0x1c874c){case _0x6d91('0xd'):case _0x6d91('0xe'):case'FaxQueues':case _0x6d91('0xf'):case _0x6d91('0x10'):case _0x6d91('0x11'):case _0x6d91('0x12'):return db[_0x574d9e][_0x6d91('0x13')](queryQueues);case _0x6d91('0x14'):return db[_0x574d9e][_0x6d91('0x13')](queryTelephones);case _0x6d91('0x15'):return db[_0x574d9e][_0x6d91('0x13')](queryTrunks);case _0x6d91('0x16'):return db[_0x574d9e][_0x6d91('0x13')](queryCampaigns);}}else{return db[_0x6d91('0x17')][_0x6d91('0x13')]({'attributes':[_0x6d91('0x18')],'where':{'sectionId':_0xae0aa1['id']},'raw':!![]})[_0x6d91('0xb')](function(_0x4d9a21){if(_0x4d9a21){var _0x2ecb1f={'where':{'id':_[_0x6d91('0x19')](_0x4d9a21,_0x6d91('0x18'))},'raw':!![]};switch(_0x574d9e){case _0x6d91('0x6'):_0x2ecb1f[_0x6d91('0x1a')][_0x6d91('0x1b')]='telephone';break;case _0x6d91('0x1c'):_0x2ecb1f['where']['type']=_0x6d91('0xa');break;}return db[_0x574d9e]['findAll'](_0x2ecb1f);}else{return[];}});}}else{return[];}})[_0x6d91('0xb')](function(_0x535f4c){return _0x535f4c;});}function joinOrLeaveQueues(_0x539c29,_0x178f38,_0x2a0ce7,_0xa7d6e){_0x539c29[_0x178f38](util['format'](_0x6d91('0x1d'),_0x2a0ce7,_0xa7d6e[_0x6d91('0x8')]));if(_0xa7d6e[_0x6d91('0x5')]){for(var _0x95c65d=0x0;_0x95c65d<_0xa7d6e[_0x6d91('0x5')][_0x6d91('0x1e')];_0x95c65d+=0x1){_0x539c29[_0x178f38](util[_0x6d91('0x1f')](_0x6d91('0x20'),_0xa7d6e[_0x6d91('0x5')][_0x95c65d][_0x6d91('0x8')]));}}}function joinOrLeave(_0x582f6d,_0x91ab12,_0x58e917){var _0x43b3ad;if(_0x582f6d[_0x6d91('0x21')][_0x6d91('0x22')]['id']){db['User'][_0x6d91('0x23')]({'attributes':['id',_0x6d91('0x8'),'role',_0x6d91('0x24')],'where':{'id':_0x582f6d[_0x6d91('0x21')][_0x6d91('0x22')]['id']},'include':[{'model':db[_0x6d91('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6d91('0x26')],'as':_0x6d91('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x6d91('0x28')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6d91('0x29')],'as':_0x6d91('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x6d91('0x2b')],'as':_0x6d91('0x2c'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x6d91('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x6d91('0xb')](function(_0x14f2bd){if(_0x14f2bd){_0x43b3ad=_0x14f2bd;_0x582f6d[_0x91ab12](util['format'](_0x6d91('0x20'),_0x14f2bd[_0x6d91('0x8')]));var _0x4eb0f6=[];switch(_0x14f2bd[_0x6d91('0x1b')]){case'admin':_0x582f6d[_0x91ab12]('voice:inbound');_0x582f6d[_0x91ab12]('voice:outbound');if(queryQueues[_0x6d91('0x2e')](_0x6d91('0x2f'))){delete queryQueues[_0x6d91('0x2f')];}_0x4eb0f6[_0x6d91('0x30')](db[_0x6d91('0x31')][_0x6d91('0x13')](queryQueues));_0x4eb0f6[_0x6d91('0x30')](db[_0x6d91('0x32')][_0x6d91('0x13')](queryQueues));_0x4eb0f6['push'](db[_0x6d91('0x33')][_0x6d91('0x13')](queryQueues));_0x4eb0f6[_0x6d91('0x30')](db['SmsQueue'][_0x6d91('0x13')](queryQueues));_0x4eb0f6['push'](db[_0x6d91('0x34')][_0x6d91('0x13')](queryQueues));_0x4eb0f6[_0x6d91('0x30')](db[_0x6d91('0x35')][_0x6d91('0x13')](queryQueues));_0x4eb0f6[_0x6d91('0x30')](db[_0x6d91('0x36')]['findAll'](queryQueues));_0x4eb0f6[_0x6d91('0x30')](db['User']['findAll'](queryTelephones));_0x4eb0f6[_0x6d91('0x30')](db['Trunk']['findAll'](queryTrunks));_0x4eb0f6['push'](db['Campaign'][_0x6d91('0x13')](queryCampaigns));_0x4eb0f6[_0x6d91('0x30')](db[_0x6d91('0x6')]['findAll'](queryAgents));break;case _0x6d91('0x37'):_0x582f6d[_0x91ab12](_0x6d91('0x38'));_0x582f6d[_0x91ab12](_0x6d91('0x39'));_0x4eb0f6[_0x6d91('0x30')](getAssociatedResources('VoiceQueues',_0x14f2bd[_0x6d91('0x24')],_0x6d91('0x31')));_0x4eb0f6[_0x6d91('0x30')](getAssociatedResources(_0x6d91('0xe'),_0x14f2bd[_0x6d91('0x24')],_0x6d91('0x32')));_0x4eb0f6[_0x6d91('0x30')](getAssociatedResources('FaxQueues',_0x14f2bd[_0x6d91('0x24')],'FaxQueue'));_0x4eb0f6['push'](getAssociatedResources(_0x6d91('0xf'),_0x14f2bd['userProfileId'],_0x6d91('0x3a')));_0x4eb0f6[_0x6d91('0x30')](getAssociatedResources('MailQueues',_0x14f2bd[_0x6d91('0x24')],'MailQueue'));_0x4eb0f6[_0x6d91('0x30')](getAssociatedResources(_0x6d91('0x11'),_0x14f2bd['userProfileId'],_0x6d91('0x35')));_0x4eb0f6['push'](getAssociatedResources(_0x6d91('0x12'),_0x14f2bd[_0x6d91('0x24')],_0x6d91('0x36')));_0x4eb0f6[_0x6d91('0x30')](getAssociatedResources(_0x6d91('0x14'),_0x14f2bd[_0x6d91('0x24')],'User'));_0x4eb0f6[_0x6d91('0x30')](getAssociatedResources(_0x6d91('0x15'),_0x14f2bd[_0x6d91('0x24')],_0x6d91('0x3b')));_0x4eb0f6['push'](getAssociatedResources('IvrCampaigns',_0x14f2bd['userProfileId'],'Campaign'));_0x4eb0f6['push'](db[_0x6d91('0x6')]['findAll'](queryAgents));break;case'agent':_0x582f6d[_0x91ab12](_0x6d91('0x38'));_0x582f6d[_0x91ab12](_0x6d91('0x39'));_0x4eb0f6[_0x6d91('0x30')](_0x14f2bd[_0x6d91('0x3c')]({'attributes':['id',_0x6d91('0x8')]}));_0x4eb0f6['push'](_0x14f2bd['getChatQueues']({'attributes':['id','name']}));_0x4eb0f6[_0x6d91('0x30')](_0x14f2bd[_0x6d91('0x3d')]({'attributes':['id',_0x6d91('0x8')]}));_0x4eb0f6['push'](_0x14f2bd[_0x6d91('0x3e')]({'attributes':['id',_0x6d91('0x8')]}));_0x4eb0f6['push'](_0x14f2bd['getMailQueues']({'attributes':['id',_0x6d91('0x8')]}));_0x4eb0f6[_0x6d91('0x30')](_0x14f2bd[_0x6d91('0x3f')]({'attributes':['id',_0x6d91('0x8')]}));_0x4eb0f6[_0x6d91('0x30')](_0x14f2bd[_0x6d91('0x40')]({'attributes':['id',_0x6d91('0x8')]}));break;}return BPromise['all'](_0x4eb0f6);}})['then'](function(_0x4054e2){if(_0x4054e2&&_0x4054e2['length']){for(var _0x243949=0x0;_0x243949<_0x4054e2['length'];_0x243949+=0x1){for(var _0x417968=0x0;_0x417968<_0x4054e2[_0x243949][_0x6d91('0x1e')];_0x417968+=0x1){switch(_0x243949){case 0x0:joinOrLeaveQueues(_0x582f6d,_0x91ab12,_0x6d91('0x41'),_0x4054e2[_0x243949][_0x417968]);break;case 0x1:joinOrLeaveQueues(_0x582f6d,_0x91ab12,_0x6d91('0x42'),_0x4054e2[_0x243949][_0x417968]);break;case 0x2:joinOrLeaveQueues(_0x582f6d,_0x91ab12,'fax',_0x4054e2[_0x243949][_0x417968]);break;case 0x3:joinOrLeaveQueues(_0x582f6d,_0x91ab12,_0x6d91('0x43'),_0x4054e2[_0x243949][_0x417968]);break;case 0x4:joinOrLeaveQueues(_0x582f6d,_0x91ab12,_0x6d91('0x44'),_0x4054e2[_0x243949][_0x417968]);break;case 0x5:joinOrLeaveQueues(_0x582f6d,_0x91ab12,_0x6d91('0x45'),_0x4054e2[_0x243949][_0x417968]);break;case 0x6:joinOrLeaveQueues(_0x582f6d,_0x91ab12,_0x6d91('0x46'),_0x4054e2[_0x243949][_0x417968]);break;case 0x7:if(_0x43b3ad[_0x6d91('0x1b')]!==_0x6d91('0x7'))_0x582f6d[_0x91ab12](util[_0x6d91('0x1f')](_0x6d91('0x47'),_0x4054e2[_0x243949][_0x417968]['name']));break;case 0x8:if(_0x43b3ad[_0x6d91('0x1b')]!==_0x6d91('0x7'))_0x582f6d[_0x91ab12](util[_0x6d91('0x1f')]('trunk:%s',_0x4054e2[_0x243949][_0x417968][_0x6d91('0x8')]));break;case 0x9:if(_0x43b3ad[_0x6d91('0x1b')]!==_0x6d91('0x7'))_0x582f6d[_0x91ab12](util[_0x6d91('0x1f')]('campaign:%s:%s',_0x4054e2[_0x243949][_0x417968][_0x6d91('0x9')],_0x4054e2[_0x243949][_0x417968][_0x6d91('0x8')]));break;case 0xa:_0x582f6d[_0x91ab12](util[_0x6d91('0x1f')](_0x6d91('0x20'),_0x4054e2[_0x243949][_0x417968][_0x6d91('0x8')]));break;}}}}})['then'](function(){if(_0x91ab12===_0x6d91('0x48')){var _0x7ecbe3=_[_0x6d91('0x19')](_0x43b3ad[_0x6d91('0x49')],'id');return _0x43b3ad[_0x6d91('0x4a')](_0x7ecbe3)[_0x6d91('0xb')](function(){for(var _0x3e3dfd=0x0;_0x3e3dfd<_0x7ecbe3[_0x6d91('0x1e')];_0x3e3dfd+=0x1){_0x58e917[_0x6d91('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x7ecbe3[_0x3e3dfd]),'UserId':Number(_0x43b3ad['id'])});}});}})[_0x6d91('0xb')](function(){if(_0x91ab12===_0x6d91('0x48')){var _0xc6da84=_[_0x6d91('0x19')](_0x43b3ad[_0x6d91('0x27')],'id');return _0x43b3ad[_0x6d91('0x4c')](_0xc6da84)[_0x6d91('0xb')](function(){for(var _0x28c1be=0x0;_0x28c1be<_0xc6da84[_0x6d91('0x1e')];_0x28c1be+=0x1){_0x58e917[_0x6d91('0x4b')](_0x6d91('0x4d'),{'MailInteractionId':Number(_0xc6da84[_0x28c1be]),'UserId':Number(_0x43b3ad['id'])});}});}})[_0x6d91('0xb')](function(){if(_0x91ab12==='leave'){var _0x5de6f6=_[_0x6d91('0x19')](_0x43b3ad['FaxInteractions'],'id');return _0x43b3ad[_0x6d91('0x4e')](_0x5de6f6)[_0x6d91('0xb')](function(){for(var _0x39b107=0x0;_0x39b107<_0x5de6f6[_0x6d91('0x1e')];_0x39b107+=0x1){_0x58e917[_0x6d91('0x4b')](_0x6d91('0x4f'),{'FaxInteractionId':Number(_0x5de6f6[_0x39b107]),'UserId':Number(_0x43b3ad['id'])});}});}})[_0x6d91('0xb')](function(){if(_0x91ab12===_0x6d91('0x48')){var _0x1bcbbe=_[_0x6d91('0x19')](_0x43b3ad['SmsInteractions'],'id');return _0x43b3ad[_0x6d91('0x50')](_0x1bcbbe)[_0x6d91('0xb')](function(){for(var _0x42a4d9=0x0;_0x42a4d9<_0x1bcbbe[_0x6d91('0x1e')];_0x42a4d9+=0x1){_0x58e917['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1bcbbe[_0x42a4d9]),'UserId':Number(_0x43b3ad['id'])});}});}})[_0x6d91('0xb')](function(){if(_0x91ab12==='leave'){var _0x1d8b81=_[_0x6d91('0x19')](_0x43b3ad[_0x6d91('0x2c')],'id');return _0x43b3ad['removeOpenchannelInteractions'](_0x1d8b81)[_0x6d91('0xb')](function(){for(var _0x52533e=0x0;_0x52533e<_0x1d8b81[_0x6d91('0x1e')];_0x52533e+=0x1){_0x58e917[_0x6d91('0x4b')](_0x6d91('0x51'),{'OpenchannelInteractionId':Number(_0x1d8b81[_0x52533e]),'UserId':Number(_0x43b3ad['id'])});}});}})['then'](function(){if(_0x91ab12===_0x6d91('0x48')){var _0x45b40b=_[_0x6d91('0x19')](_0x43b3ad[_0x6d91('0x2d')],'id');return _0x43b3ad[_0x6d91('0x52')](_0x45b40b)[_0x6d91('0xb')](function(){for(var _0x50b3d6=0x0;_0x50b3d6<_0x45b40b[_0x6d91('0x1e')];_0x50b3d6+=0x1){_0x58e917[_0x6d91('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x45b40b[_0x50b3d6]),'UserId':Number(_0x43b3ad['id'])});}});}})[_0x6d91('0x53')](function(_0x111d53){_0x582f6d[_0x6d91('0x54')](_0x111d53);});}}function onDisconnect(_0x349cbb,_0x53c9bc){joinOrLeave(_0x349cbb,_0x6d91('0x48'),_0x53c9bc);}function onConnect(_0x2a3fcb){joinOrLeave(_0x2a3fcb,_0x6d91('0x55'));}exports[_0x6d91('0x56')]=function(_0x4c24ee){_0x4c24ee['on'](_0x6d91('0x57'),function(_0x4da22f){_0x4da22f[_0x6d91('0x58')](0x0);_0x4da22f[_0x6d91('0x59')]=_0x4da22f[_0x6d91('0x5a')][_0x6d91('0x57')]['remoteAddress']+':'+_0x4da22f[_0x6d91('0x5a')][_0x6d91('0x57')]['remotePort'];_0x4da22f[_0x6d91('0x5b')]=new Date();_0x4da22f['log']=function(_0x3f9e08){console[_0x6d91('0x54')](_0x6d91('0x5c')+_0x4da22f['nsp']['name']+'['+_0x4da22f[_0x6d91('0x59')]+']',_0x3f9e08);};_0x4da22f['on'](_0x6d91('0x5d'),function(){onDisconnect(_0x4da22f,_0x4c24ee);_0x4da22f[_0x6d91('0x54')](_0x6d91('0x5e'));});onConnect(_0x4da22f);_0x4da22f[_0x6d91('0x54')](_0x6d91('0x5f'));});}; \ No newline at end of file +var _0x09df=['ivr','UserProfileSection','then','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','format','%s:queue:%s','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','include','push','MailQueue','WhatsappQueue','User','VoiceQueue','ChatQueues','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','fax','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','emit','user_has_chat_interactions:remove','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','setMaxListeners','address','request','connection','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','Agents','role','agent','name','type'];(function(_0x577d26,_0xb9b851){var _0x270d6d=function(_0x55aeed){while(--_0x55aeed){_0x577d26['push'](_0x577d26['shift']());}};_0x270d6d(++_0xb9b851);}(_0x09df,0x164));var _0xf09d=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x09df[_0x450689];return _0x46ffb0;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var BPromise=require('bluebird');var db=require(_0xf09d('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xf09d('0x3'),'model':db['User'],'attributes':['id','name',_0xf09d('0x4')],'raw':!![],'where':{'role':_0xf09d('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xf09d('0x6')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf09d('0x6'),_0xf09d('0x7')],'where':{'type':_0xf09d('0x8')}};function getAssociatedResources(_0x46527b,_0x39cf1d,_0x2a59a8){return db[_0xf09d('0x9')]['findOne']({'where':{'name':_0x46527b,'userProfileId':_0x39cf1d},'raw':!![]})[_0xf09d('0xa')](function(_0x227a55){if(_0x227a55){if(_0x227a55['autoAssociation']){switch(_0x46527b){case _0xf09d('0xb'):case'ChatQueues':case _0xf09d('0xc'):case _0xf09d('0xd'):case _0xf09d('0xe'):case _0xf09d('0xf'):case _0xf09d('0x10'):return db[_0x2a59a8][_0xf09d('0x11')](queryQueues);case _0xf09d('0x12'):return db[_0x2a59a8][_0xf09d('0x11')](queryTelephones);case _0xf09d('0x13'):return db[_0x2a59a8]['findAll'](queryTrunks);case _0xf09d('0x14'):return db[_0x2a59a8][_0xf09d('0x11')](queryCampaigns);}}else{return db[_0xf09d('0x15')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x227a55['id']},'raw':!![]})[_0xf09d('0xa')](function(_0x3a8652){if(_0x3a8652){var _0x2f06b9={'where':{'id':_['map'](_0x3a8652,_0xf09d('0x16'))},'raw':!![]};switch(_0x2a59a8){case'User':_0x2f06b9[_0xf09d('0x17')][_0xf09d('0x4')]=_0xf09d('0x18');break;case _0xf09d('0x19'):_0x2f06b9['where'][_0xf09d('0x7')]=_0xf09d('0x8');break;}return db[_0x2a59a8][_0xf09d('0x11')](_0x2f06b9);}else{return[];}});}}else{return[];}})[_0xf09d('0xa')](function(_0x166284){return _0x166284;});}function joinOrLeaveQueues(_0x2b486f,_0x4f336c,_0x2f341d,_0x5478ba){_0x2b486f[_0x4f336c](util[_0xf09d('0x1a')](_0xf09d('0x1b'),_0x2f341d,_0x5478ba[_0xf09d('0x6')]));if(_0x5478ba[_0xf09d('0x3')]){for(var _0x11eadd=0x0;_0x11eadd<_0x5478ba[_0xf09d('0x3')]['length'];_0x11eadd+=0x1){_0x2b486f[_0x4f336c](util[_0xf09d('0x1a')](_0xf09d('0x1c'),_0x5478ba[_0xf09d('0x3')][_0x11eadd][_0xf09d('0x6')]));}}}function joinOrLeave(_0x12af9f,_0x3e6d44,_0x15e861){var _0x1affe3;if(_0x12af9f['handshake'][_0xf09d('0x1d')]['id']){db['User'][_0xf09d('0x1e')]({'attributes':['id','name',_0xf09d('0x4'),_0xf09d('0x1f')],'where':{'id':_0x12af9f[_0xf09d('0x20')][_0xf09d('0x1d')]['id']},'include':[{'model':db[_0xf09d('0x21')],'as':_0xf09d('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xf09d('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xf09d('0x24')],'as':_0xf09d('0x25'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xf09d('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xf09d('0x27')],'as':_0xf09d('0x28'),'attributes':['id'],'raw':!![]}]})[_0xf09d('0xa')](function(_0x45e073){if(_0x45e073){_0x1affe3=_0x45e073;_0x12af9f[_0x3e6d44](util[_0xf09d('0x1a')](_0xf09d('0x1c'),_0x45e073['name']));var _0x3d3475=[];switch(_0x45e073['role']){case'admin':_0x12af9f[_0x3e6d44](_0xf09d('0x29'));_0x12af9f[_0x3e6d44](_0xf09d('0x2a'));if(queryQueues['hasOwnProperty'](_0xf09d('0x2b'))){delete queryQueues[_0xf09d('0x2b')];}_0x3d3475[_0xf09d('0x2c')](db['VoiceQueue'][_0xf09d('0x11')](queryQueues));_0x3d3475[_0xf09d('0x2c')](db['ChatQueue'][_0xf09d('0x11')](queryQueues));_0x3d3475[_0xf09d('0x2c')](db['FaxQueue']['findAll'](queryQueues));_0x3d3475[_0xf09d('0x2c')](db['SmsQueue']['findAll'](queryQueues));_0x3d3475[_0xf09d('0x2c')](db[_0xf09d('0x2d')]['findAll'](queryQueues));_0x3d3475[_0xf09d('0x2c')](db['OpenchannelQueue']['findAll'](queryQueues));_0x3d3475['push'](db[_0xf09d('0x2e')][_0xf09d('0x11')](queryQueues));_0x3d3475['push'](db[_0xf09d('0x2f')][_0xf09d('0x11')](queryTelephones));_0x3d3475[_0xf09d('0x2c')](db['Trunk']['findAll'](queryTrunks));_0x3d3475[_0xf09d('0x2c')](db[_0xf09d('0x19')][_0xf09d('0x11')](queryCampaigns));_0x3d3475[_0xf09d('0x2c')](db[_0xf09d('0x2f')]['findAll'](queryAgents));break;case'user':_0x12af9f[_0x3e6d44](_0xf09d('0x29'));_0x12af9f[_0x3e6d44](_0xf09d('0x2a'));_0x3d3475[_0xf09d('0x2c')](getAssociatedResources(_0xf09d('0xb'),_0x45e073[_0xf09d('0x1f')],_0xf09d('0x30')));_0x3d3475[_0xf09d('0x2c')](getAssociatedResources(_0xf09d('0x31'),_0x45e073[_0xf09d('0x1f')],_0xf09d('0x32')));_0x3d3475[_0xf09d('0x2c')](getAssociatedResources(_0xf09d('0xc'),_0x45e073['userProfileId'],_0xf09d('0x33')));_0x3d3475['push'](getAssociatedResources(_0xf09d('0xd'),_0x45e073['userProfileId'],_0xf09d('0x34')));_0x3d3475[_0xf09d('0x2c')](getAssociatedResources(_0xf09d('0xe'),_0x45e073[_0xf09d('0x1f')],_0xf09d('0x2d')));_0x3d3475[_0xf09d('0x2c')](getAssociatedResources(_0xf09d('0xf'),_0x45e073[_0xf09d('0x1f')],_0xf09d('0x35')));_0x3d3475[_0xf09d('0x2c')](getAssociatedResources(_0xf09d('0x10'),_0x45e073[_0xf09d('0x1f')],_0xf09d('0x2e')));_0x3d3475[_0xf09d('0x2c')](getAssociatedResources(_0xf09d('0x12'),_0x45e073[_0xf09d('0x1f')],_0xf09d('0x2f')));_0x3d3475[_0xf09d('0x2c')](getAssociatedResources(_0xf09d('0x13'),_0x45e073[_0xf09d('0x1f')],'Trunk'));_0x3d3475[_0xf09d('0x2c')](getAssociatedResources(_0xf09d('0x14'),_0x45e073[_0xf09d('0x1f')],_0xf09d('0x19')));_0x3d3475[_0xf09d('0x2c')](db[_0xf09d('0x2f')][_0xf09d('0x11')](queryAgents));break;case'agent':_0x12af9f[_0x3e6d44]('voice:inbound');_0x12af9f[_0x3e6d44]('voice:outbound');_0x3d3475[_0xf09d('0x2c')](_0x45e073[_0xf09d('0x36')]({'attributes':['id',_0xf09d('0x6')]}));_0x3d3475[_0xf09d('0x2c')](_0x45e073['getChatQueues']({'attributes':['id','name']}));_0x3d3475[_0xf09d('0x2c')](_0x45e073[_0xf09d('0x37')]({'attributes':['id','name']}));_0x3d3475[_0xf09d('0x2c')](_0x45e073[_0xf09d('0x38')]({'attributes':['id',_0xf09d('0x6')]}));_0x3d3475[_0xf09d('0x2c')](_0x45e073[_0xf09d('0x39')]({'attributes':['id',_0xf09d('0x6')]}));_0x3d3475['push'](_0x45e073['getOpenchannelQueues']({'attributes':['id','name']}));_0x3d3475['push'](_0x45e073[_0xf09d('0x3a')]({'attributes':['id',_0xf09d('0x6')]}));break;}return BPromise[_0xf09d('0x3b')](_0x3d3475);}})['then'](function(_0x4a1333){if(_0x4a1333&&_0x4a1333[_0xf09d('0x3c')]){for(var _0x2edfe6=0x0;_0x2edfe6<_0x4a1333[_0xf09d('0x3c')];_0x2edfe6+=0x1){for(var _0x2a2602=0x0;_0x2a2602<_0x4a1333[_0x2edfe6][_0xf09d('0x3c')];_0x2a2602+=0x1){switch(_0x2edfe6){case 0x0:joinOrLeaveQueues(_0x12af9f,_0x3e6d44,_0xf09d('0x3d'),_0x4a1333[_0x2edfe6][_0x2a2602]);break;case 0x1:joinOrLeaveQueues(_0x12af9f,_0x3e6d44,'chat',_0x4a1333[_0x2edfe6][_0x2a2602]);break;case 0x2:joinOrLeaveQueues(_0x12af9f,_0x3e6d44,_0xf09d('0x3e'),_0x4a1333[_0x2edfe6][_0x2a2602]);break;case 0x3:joinOrLeaveQueues(_0x12af9f,_0x3e6d44,'sms',_0x4a1333[_0x2edfe6][_0x2a2602]);break;case 0x4:joinOrLeaveQueues(_0x12af9f,_0x3e6d44,'mail',_0x4a1333[_0x2edfe6][_0x2a2602]);break;case 0x5:joinOrLeaveQueues(_0x12af9f,_0x3e6d44,_0xf09d('0x3f'),_0x4a1333[_0x2edfe6][_0x2a2602]);break;case 0x6:joinOrLeaveQueues(_0x12af9f,_0x3e6d44,_0xf09d('0x40'),_0x4a1333[_0x2edfe6][_0x2a2602]);break;case 0x7:if(_0x1affe3[_0xf09d('0x4')]!=='agent')_0x12af9f[_0x3e6d44](util['format'](_0xf09d('0x41'),_0x4a1333[_0x2edfe6][_0x2a2602][_0xf09d('0x6')]));break;case 0x8:if(_0x1affe3[_0xf09d('0x4')]!==_0xf09d('0x5'))_0x12af9f[_0x3e6d44](util['format'](_0xf09d('0x42'),_0x4a1333[_0x2edfe6][_0x2a2602][_0xf09d('0x6')]));break;case 0x9:if(_0x1affe3[_0xf09d('0x4')]!==_0xf09d('0x5'))_0x12af9f[_0x3e6d44](util[_0xf09d('0x1a')](_0xf09d('0x43'),_0x4a1333[_0x2edfe6][_0x2a2602][_0xf09d('0x7')],_0x4a1333[_0x2edfe6][_0x2a2602][_0xf09d('0x6')]));break;case 0xa:_0x12af9f[_0x3e6d44](util[_0xf09d('0x1a')]('user:%s',_0x4a1333[_0x2edfe6][_0x2a2602][_0xf09d('0x6')]));break;}}}}})[_0xf09d('0xa')](function(){if(_0x3e6d44===_0xf09d('0x44')){var _0x334943=_[_0xf09d('0x45')](_0x1affe3['ChatInteractions'],'id');return _0x1affe3['removeChatInteractions'](_0x334943)[_0xf09d('0xa')](function(){for(var _0x5b2b58=0x0;_0x5b2b58<_0x334943[_0xf09d('0x3c')];_0x5b2b58+=0x1){_0x15e861[_0xf09d('0x46')](_0xf09d('0x47'),{'ChatInteractionId':Number(_0x334943[_0x5b2b58]),'UserId':Number(_0x1affe3['id'])});}});}})[_0xf09d('0xa')](function(){if(_0x3e6d44===_0xf09d('0x44')){var _0x15f72f=_[_0xf09d('0x45')](_0x1affe3['MailInteractions'],'id');return _0x1affe3['removeMailInteractions'](_0x15f72f)[_0xf09d('0xa')](function(){for(var _0x18c94a=0x0;_0x18c94a<_0x15f72f['length'];_0x18c94a+=0x1){_0x15e861[_0xf09d('0x46')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x15f72f[_0x18c94a]),'UserId':Number(_0x1affe3['id'])});}});}})['then'](function(){if(_0x3e6d44===_0xf09d('0x44')){var _0x3d7eb5=_[_0xf09d('0x45')](_0x1affe3['FaxInteractions'],'id');return _0x1affe3[_0xf09d('0x48')](_0x3d7eb5)[_0xf09d('0xa')](function(){for(var _0x5ba3ed=0x0;_0x5ba3ed<_0x3d7eb5[_0xf09d('0x3c')];_0x5ba3ed+=0x1){_0x15e861[_0xf09d('0x46')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3d7eb5[_0x5ba3ed]),'UserId':Number(_0x1affe3['id'])});}});}})['then'](function(){if(_0x3e6d44===_0xf09d('0x44')){var _0x369255=_[_0xf09d('0x45')](_0x1affe3[_0xf09d('0x49')],'id');return _0x1affe3['removeSmsInteractions'](_0x369255)[_0xf09d('0xa')](function(){for(var _0x59117c=0x0;_0x59117c<_0x369255['length'];_0x59117c+=0x1){_0x15e861[_0xf09d('0x46')](_0xf09d('0x4a'),{'SmsInteractionId':Number(_0x369255[_0x59117c]),'UserId':Number(_0x1affe3['id'])});}});}})[_0xf09d('0xa')](function(){if(_0x3e6d44===_0xf09d('0x44')){var _0x18f3a1=_[_0xf09d('0x45')](_0x1affe3[_0xf09d('0x26')],'id');return _0x1affe3[_0xf09d('0x4b')](_0x18f3a1)[_0xf09d('0xa')](function(){for(var _0x402458=0x0;_0x402458<_0x18f3a1[_0xf09d('0x3c')];_0x402458+=0x1){_0x15e861[_0xf09d('0x46')](_0xf09d('0x4c'),{'OpenchannelInteractionId':Number(_0x18f3a1[_0x402458]),'UserId':Number(_0x1affe3['id'])});}});}})[_0xf09d('0xa')](function(){if(_0x3e6d44===_0xf09d('0x44')){var _0x4891ae=_['map'](_0x1affe3['WhatsappInteractions'],'id');return _0x1affe3[_0xf09d('0x4d')](_0x4891ae)[_0xf09d('0xa')](function(){for(var _0xddbd43=0x0;_0xddbd43<_0x4891ae['length'];_0xddbd43+=0x1){_0x15e861[_0xf09d('0x46')](_0xf09d('0x4e'),{'WhatsappInteractionId':Number(_0x4891ae[_0xddbd43]),'UserId':Number(_0x1affe3['id'])});}});}})['catch'](function(_0x54a912){_0x12af9f[_0xf09d('0x4f')](_0x54a912);});}}function onDisconnect(_0x2c6852,_0x25073c){joinOrLeave(_0x2c6852,'leave',_0x25073c);}function onConnect(_0x257fa8){joinOrLeave(_0x257fa8,_0xf09d('0x50'));}exports['default']=function(_0x27d27a){_0x27d27a['on']('connection',function(_0x1de17d){_0x1de17d[_0xf09d('0x51')](0x0);_0x1de17d[_0xf09d('0x52')]=_0x1de17d[_0xf09d('0x53')][_0xf09d('0x54')]['remoteAddress']+':'+_0x1de17d[_0xf09d('0x53')]['connection'][_0xf09d('0x55')];_0x1de17d[_0xf09d('0x56')]=new Date();_0x1de17d[_0xf09d('0x4f')]=function(_0x5c801a){console[_0xf09d('0x4f')](_0xf09d('0x57')+_0x1de17d[_0xf09d('0x58')][_0xf09d('0x6')]+'['+_0x1de17d[_0xf09d('0x52')]+']',_0x5c801a);};_0x1de17d['on'](_0xf09d('0x59'),function(){onDisconnect(_0x1de17d,_0x27d27a);_0x1de17d[_0xf09d('0x4f')](_0xf09d('0x5a'));});onConnect(_0x1de17d);_0x1de17d[_0xf09d('0x4f')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a5bb334..5135a11 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 _0x75bd=['FaxMessage','MailInteraction','Mail','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','then','info','EventManager','error','Trigger,\x20%s','catch','channel','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','User','find','name','email','internal','interface','format','agent','incomingmessage','outgoingmessage','get','opened','ContactId','contact','changed','closed','SIP/%s','default','length','hasOwnProperty','model','hook','callback','condition','util','../../mysqldb','../logger','lodash','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','Fax','FaxInteraction'];(function(_0x582376,_0x56ffbe){var _0x445b67=function(_0x170215){while(--_0x170215){_0x582376['push'](_0x582376['shift']());}};_0x445b67(++_0x56ffbe);}(_0x75bd,0xb8));var _0xd75b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75bd[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xd75b('0x0'));var db=require(_0xd75b('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xd75b('0x2'))('triggers');var _=require(_0xd75b('0x3'));var client=jayson[_0xd75b('0x4')][_0xd75b('0x5')]({'port':0x232a});var triggers=[{'channel':_0xd75b('0x6'),'model':'ChatInteraction','event':_0xd75b('0x7'),'condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':_0xd75b('0x6'),'model':_0xd75b('0x9'),'event':_0xd75b('0xa'),'condition':_0xd75b('0xb'),'callback':afterUpdate},{'channel':_0xd75b('0x6'),'model':_0xd75b('0xc'),'event':_0xd75b('0x7'),'condition':_0xd75b('0xd'),'callback':afterCreateMessage},{'channel':_0xd75b('0xe'),'model':_0xd75b('0xf'),'event':_0xd75b('0x7'),'condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':_0xd75b('0xe'),'model':'SmsInteraction','event':_0xd75b('0xa'),'condition':_0xd75b('0xb'),'callback':afterUpdate},{'channel':_0xd75b('0xe'),'model':'SmsMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd75b('0x10'),'model':_0xd75b('0x11'),'event':_0xd75b('0x7'),'condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0xd75b('0xa'),'condition':_0xd75b('0xb'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':'afterCreate','condition':_0xd75b('0xd'),'callback':afterCreateMessage},{'channel':_0xd75b('0x12'),'model':_0xd75b('0x13'),'event':_0xd75b('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd75b('0x12'),'model':'FaxInteraction','event':_0xd75b('0xa'),'condition':_0xd75b('0xb'),'callback':afterUpdate},{'channel':_0xd75b('0x12'),'model':_0xd75b('0x14'),'event':_0xd75b('0x7'),'condition':_0xd75b('0xd'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xd75b('0x15'),'event':_0xd75b('0x7'),'condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':_0xd75b('0x16'),'model':_0xd75b('0x15'),'event':_0xd75b('0xa'),'condition':_0xd75b('0xb'),'callback':afterUpdate},{'channel':'Mail','model':_0xd75b('0x17'),'event':_0xd75b('0x7'),'condition':_0xd75b('0xd'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xd75b('0x18'),'event':_0xd75b('0x7'),'condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0xd75b('0x18'),'event':_0xd75b('0xa'),'condition':_0xd75b('0xb'),'callback':afterUpdate},{'channel':_0xd75b('0x19'),'model':_0xd75b('0x1a'),'event':_0xd75b('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x81edf4){return client[_0xd75b('0x1b')]('EventManager',_0x81edf4)[_0xd75b('0x1c')](function(_0x1815ce){logger[_0xd75b('0x1d')]('Trigger,\x20%s',_0xd75b('0x1e'),_0x1815ce);if(_0x1815ce[_0xd75b('0x1f')]){if(_0x1815ce[_0xd75b('0x1f')]['code']===0x1f4){logger[_0xd75b('0x1f')](_0xd75b('0x20'),_0xd75b('0x1e'),_0x1815ce[_0xd75b('0x1f')]);}}})[_0xd75b('0x21')](function(_0x305703){logger['error']('Trigger,\x20%s',_0xd75b('0x1e'),_0x305703);});}function afterCreateMessage(_0x22b55e,_0x427552){return function(_0x4ea656,_0x4781b4){_0x4ea656=_0x4ea656['get']({'plain':!![]});_0x4ea656[_0xd75b('0x22')]=_0x22b55e;_0x4ea656[_0xd75b('0x23')]=_0x4ea656[_0xd75b('0x24')];var _0x5aca60=_0xd75b('0x25')+_0x4ea656['ContactId'];return db[_0xd75b('0x26')][_0xd75b('0x27')](_0x5aca60,{'type':db[_0xd75b('0x28')][_0xd75b('0x29')][_0xd75b('0x2a')],'raw':!![]})['then'](function(_0x4773be){return _0x4773be;})[_0xd75b('0x1c')](function(_0x417025){if(_0x417025){_0x4ea656['contact']=_0x417025[0x0];}if(_0x4ea656[_0xd75b('0x2b')]){return db[_0xd75b('0x2c')][_0xd75b('0x2d')]({'where':{'id':_0x4ea656[_0xd75b('0x2b')]},'attributes':['id',_0xd75b('0x2e'),'fullname',_0xd75b('0x2f'),_0xd75b('0x30')],'raw':!![]})[_0xd75b('0x1c')](function(_0x497a4b){_0x4ea656[_0xd75b('0x31')]=util[_0xd75b('0x32')]('SIP/%s',_0x497a4b[_0xd75b('0x2e')]);_0x4ea656[_0xd75b('0x22')]=_0x22b55e;_0x4ea656[_0xd75b('0x33')]=_0x497a4b;return request({'event':_0xd75b('0x34'),'message':_0x4ea656});})[_0xd75b('0x21')](function(_0x2470e3){console[_0xd75b('0x1f')](_0x2470e3);});}else{return request({'event':_0xd75b('0x35'),'message':_0x4ea656});}});};}function afterCreate(_0x1bab70,_0x19ea0e){return function(_0xa33eb2,_0x55f2bc){_0xa33eb2=_0xa33eb2[_0xd75b('0x36')]({'plain':!![]});_0xa33eb2[_0xd75b('0x22')]=_0x1bab70;_0xa33eb2[_0xd75b('0x23')]=_0xd75b('0x37');var _0xb35cea=_0xd75b('0x25')+_0xa33eb2[_0xd75b('0x38')];return db['sequelize'][_0xd75b('0x27')](_0xb35cea,{'type':db['Sequelize']['QueryTypes'][_0xd75b('0x2a')],'raw':!![]})[_0xd75b('0x1c')](function(_0x1413cb){return _0x1413cb;})['then'](function(_0x4cf159){if(_0x4cf159){_0xa33eb2[_0xd75b('0x39')]=_0x4cf159[0x0];}return request({'event':_0x19ea0e,'message':_0xa33eb2});});};}function afterUpdate(_0x25b012,_0x30b228){return function(_0x134a96,_0x570539){if(_0x134a96[_0xd75b('0x3a')](_0xd75b('0x3b'))&&_0x134a96['closed']){_0x134a96=_0x134a96['get']({'plain':!![]});_0x134a96[_0xd75b('0x22')]=_0x25b012;_0x134a96[_0xd75b('0x23')]=_0xd75b('0x3b');var _0x13fe49='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x134a96['ContactId'];return db[_0xd75b('0x26')][_0xd75b('0x27')](_0x13fe49,{'type':db[_0xd75b('0x28')][_0xd75b('0x29')]['SELECT'],'raw':!![]})[_0xd75b('0x1c')](function(_0x5ee6ec){return _0x5ee6ec;})[_0xd75b('0x1c')](function(_0x429b9c){if(_0x429b9c){_0x134a96[_0xd75b('0x39')]=_0x429b9c[0x0];}if(_0x134a96[_0xd75b('0x2b')]){return db[_0xd75b('0x2c')]['find']({'where':{'id':_0x134a96[_0xd75b('0x2b')]},'attributes':['id',_0xd75b('0x2e'),'fullname','email','internal'],'raw':!![]})[_0xd75b('0x1c')](function(_0x35d47f){_0x134a96[_0xd75b('0x31')]=util['format'](_0xd75b('0x3c'),_0x35d47f[_0xd75b('0x2e')]);_0x134a96[_0xd75b('0x33')]=_0x35d47f;return request({'event':_0x30b228,'message':_0x134a96});})[_0xd75b('0x21')](function(_0x39beed){console[_0xd75b('0x1f')](_0x39beed);});}else{return request({'event':_0x30b228,'message':_0x134a96});}});}};}exports[_0xd75b('0x3d')]=function(){for(var _0x59e6a8=0x0;_0x59e6a8=_0x13e3cb['agents']){throw Error(_0xdfc2('0x13'));}_0x46bf48(_0x2f784c);})[_0xdfc2('0x14')](function(_0x9e8bcd){_0x59e007(_0x9e8bcd);});});}; \ No newline at end of file +var _0x0c38=['fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','count','agent','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','../mysqldb','voice','mail'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0c38,0x150));var _0x80c3=function(_0x310828,_0x5627a5){_0x310828=_0x310828-0x0;var _0x3317ea=_0x0c38[_0x310828];return _0x3317ea;};'use strict';var _=require('lodash');var BPromise=require(_0x80c3('0x0'));var db=require(_0x80c3('0x1'))['db'];var util=require('./license/util');var channels=[_0x80c3('0x2'),_0x80c3('0x3'),'chat',_0x80c3('0x4'),_0x80c3('0x5'),'whatsapp',_0x80c3('0x6')];exports[_0x80c3('0x7')]=function(){return channels;};exports[_0x80c3('0x8')]=function(_0x3e7408){_0x3e7408=_0x3e7408[_0x80c3('0x9')]();return _['includes'](channels,_0x3e7408);};exports[_0x80c3('0xa')]=function(_0x4e0579,_0x81b6c9,_0xb3685a,_0x2b8d62){var _0x37eef1={'loginAttempts':_0x81b6c9,'blocked':_0xb3685a};if(!_[_0x80c3('0xb')](_0x2b8d62)){_0x37eef1[_0x80c3('0xc')]=_0x2b8d62;}return _0x4e0579[_0x80c3('0xd')](_0x37eef1);};exports[_0x80c3('0xe')]=function(_0x26f66a){return new BPromise(function(_0x4759c0,_0x3c8535){var _0x284bf4=0x0;if(_0x26f66a[_0x80c3('0xf')]!=='agent'){_0x4759c0(_0x26f66a);}db['User'][_0x80c3('0x10')]({'where':{'role':_0x80c3('0x11'),'online':!![],'id':{'$ne':_0x26f66a['id']}}})['then'](function(_0x4ae8c0){_0x284bf4=_0x4ae8c0;return util['getLicense']();})['then'](function(_0x4de1df){if(_0x4de1df&&_0x4de1df['agents']&&_0x284bf4>=_0x4de1df[_0x80c3('0x12')]){throw Error(_0x80c3('0x13'));}_0x4759c0(_0x26f66a);})['catch'](function(_0x352b20){_0x3c8535(_0x352b20);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 5ede2dc..fbddf5f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaec=['send','exports','404','status','render','json'];(function(_0x4b23f4,_0x20676f){var _0x248b71=function(_0x34f5ae){while(--_0x34f5ae){_0x4b23f4['push'](_0x4b23f4['shift']());}};_0x248b71(++_0x20676f);}(_0xfaec,0x139));var _0xcfae=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfaec[_0x5b644e];return _0x49c6bf;};'use strict';module[_0xcfae('0x0')][0x194]=function pageNotFound(_0x1f04e8,_0x2ff03a){var _0x5c3db3=_0xcfae('0x1');var _0x27bda3=0x194;var _0x4d70a6={'status':_0x27bda3};_0x2ff03a['status'](_0x4d70a6[_0xcfae('0x2')]);_0x2ff03a[_0xcfae('0x3')](_0x5c3db3,{},function(_0xeaeb70,_0x360ffa){if(_0xeaeb70){return _0x2ff03a[_0xcfae('0x2')](_0x4d70a6[_0xcfae('0x2')])[_0xcfae('0x4')](_0x4d70a6);}_0x2ff03a[_0xcfae('0x5')](_0x360ffa);});}; \ No newline at end of file +var _0x0962=['status','render','json','exports','404'];(function(_0x2fc000,_0x966867){var _0xb22690=function(_0x202412){while(--_0x202412){_0x2fc000['push'](_0x2fc000['shift']());}};_0xb22690(++_0x966867);}(_0x0962,0x116));var _0x2096=function(_0x406213,_0x5da1a4){_0x406213=_0x406213-0x0;var _0xc80a88=_0x0962[_0x406213];return _0xc80a88;};'use strict';module[_0x2096('0x0')][0x194]=function pageNotFound(_0x106f82,_0x16a0fc){var _0x237146=_0x2096('0x1');var _0x42c6d1=0x194;var _0x3a5367={'status':_0x42c6d1};_0x16a0fc[_0x2096('0x2')](_0x3a5367['status']);_0x16a0fc[_0x2096('0x3')](_0x237146,{},function(_0x3f7ede,_0x519396){if(_0x3f7ede){return _0x16a0fc[_0x2096('0x2')](_0x3a5367[_0x2096('0x2')])[_0x2096('0x4')](_0x3a5367);}_0x16a0fc['send'](_0x519396);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 24f986f..8e8e296 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc17d=['uniqueid','AgentReports','ContactId','MailAccountId','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','Template','TemplateId','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','restrict','IntervalId','ListId','Contact','Items','FaxAccountId','FaxApplication','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','TagId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','Agent','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CompanyId','Hoppers','HopperHistories','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','Automation','AutomationAllId','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','Mohs','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','SubjectId','Descriptions','FieldId','Subject','DescriptionId','Variable','VariableId','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','Subjects','Description','Field','int_desk_configuration_has_tags','DeskField','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','Dynamics365Configuration','Dynamics365Field','ToId','SessionId','JscriptyProject','ProjectId','user_has_square_projects','team_has_whatsapp_queues','HopperBlacks','TrunkId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','FromUserId','ToQueue','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','exports','path','../config/environment','sequelize','lodash','determine','defaultsDeep','xcall','mysql','name','utf8','sequelizeHistory','motion2','xC@LL1234','127.0.0.1','utf8mb4','utf8_general_ci','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','Realtime','../api/realtime/realtime.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','VoiceMail','cascade','Recordings','UserId','hasMany','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteraction','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopperBlack','JscriptySessions','Trunk','TrunkBackup','TrunkBackupId','Interval','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailbox','VoiceMailMessage','mailboxuser','QueueCalls'];(function(_0x370852,_0x2c7e62){var _0x40cc7e=function(_0x34a439){while(--_0x34a439){_0x370852['push'](_0x370852['shift']());}};_0x40cc7e(++_0x2c7e62);}(_0xc17d,0x96));var _0xdc17=function(_0x5b18af,_0x1a76ad){_0x5b18af=_0x5b18af-0x0;var _0x6f02bc=_0xc17d[_0x5b18af];return _0x6f02bc;};'use strict';var path=require(_0xdc17('0x0'));var config=require(_0xdc17('0x1'));var Sequelize=require(_0xdc17('0x2'));var _=require(_0xdc17('0x3'));var jstz=require('jstz');var timezone=jstz[_0xdc17('0x4')]();config[_0xdc17('0x2')]=_[_0xdc17('0x5')](config[_0xdc17('0x2')],{'database':'motion2','username':_0xdc17('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xdc17('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xdc17('0x8')](),'define':{'charset':_0xdc17('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0xdc17('0x5')](config[_0xdc17('0xa')],{'database':_0xdc17('0xb'),'username':_0xdc17('0x6'),'password':_0xdc17('0xc'),'options':{'host':_0xdc17('0xd'),'port':0xcea,'dialect':_0xdc17('0x7'),'dialectOptions':{'charset':_0xdc17('0xe')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xdc17('0x9'),'collate':_0xdc17('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdc17('0x2')]['database'],config[_0xdc17('0x2')]['username'],config[_0xdc17('0x2')][_0xdc17('0x10')],config['sequelize'][_0xdc17('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdc17('0xa')]['database'],config[_0xdc17('0xa')]['username'],config[_0xdc17('0xa')][_0xdc17('0x10')],config['sequelizeHistory'][_0xdc17('0x11')])};db[_0xdc17('0x12')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x14'));db[_0xdc17('0x15')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x16'));db[_0xdc17('0x17')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x18'));db['VoiceExtension']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x19'));db[_0xdc17('0x1a')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xdc17('0x1b')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x1c'));db[_0xdc17('0x1d')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x1e'));db['ScreenRecording']=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xdc17('0x2')]['import'](_0xdc17('0x1f'));db['VoiceMailMessage']=db[_0xdc17('0x2')]['import']('../api/voiceMailMessage/voiceMailMessage.model');db[_0xdc17('0x20')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x21'));db[_0xdc17('0x22')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x23'));db[_0xdc17('0x24')]=db['sequelize'][_0xdc17('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xdc17('0x25')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xdc17('0x26')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x27'));db['Trunk']=db[_0xdc17('0x2')]['import']('../api/trunk/trunk.model');db[_0xdc17('0x28')]=db['sequelize']['import'](_0xdc17('0x29'));db[_0xdc17('0x2a')]=db['sequelize']['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0xdc17('0x2')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xdc17('0x2')]['import'](_0xdc17('0x2b'));db[_0xdc17('0x2c')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x2d'));db['UserFaxQueue']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x2e'));db[_0xdc17('0x2f')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x30'));db[_0xdc17('0x31')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xdc17('0x32')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xdc17('0x33')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x34'));db[_0xdc17('0x35')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x36'));db[_0xdc17('0x37')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x38'));db[_0xdc17('0x39')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x3a'));db[_0xdc17('0x3b')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x3c'));db['MailInteraction']=db[_0xdc17('0x2')]['import'](_0xdc17('0x3d'));db[_0xdc17('0x3e')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x3f'));db[_0xdc17('0x40')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x41'));db[_0xdc17('0x42')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x43'));db[_0xdc17('0x44')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/dashboard/dashboard.model');db[_0xdc17('0x45')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x46'));db[_0xdc17('0x47')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x48'));db[_0xdc17('0x49')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x4a'));db[_0xdc17('0x4b')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x4c'));db[_0xdc17('0x4d')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x4e'));db[_0xdc17('0x4f')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x50'));db[_0xdc17('0x51')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x52'));db['SmsApplication']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x53'));db['SmsInteraction']=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0xdc17('0x54')]=db[_0xdc17('0x2')]['import']('../api/smsMessage/smsMessage.model');db[_0xdc17('0x55')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x56'));db[_0xdc17('0x57')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x58'));db[_0xdc17('0x59')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x5a'));db[_0xdc17('0x5b')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x5c'));db[_0xdc17('0x5d')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x5e'));db[_0xdc17('0x5f')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x60'));db[_0xdc17('0x61')]=db[_0xdc17('0x2')]['import']('../api/chatWebsite/chatWebsite.model');db[_0xdc17('0x62')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x63'));db[_0xdc17('0x64')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x65'));db[_0xdc17('0x66')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x67'));db[_0xdc17('0x68')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x69'));db[_0xdc17('0x6a')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x6b'));db[_0xdc17('0x6c')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x6d'));db[_0xdc17('0x6e')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x6f'));db[_0xdc17('0x70')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x71'));db[_0xdc17('0x72')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x73'));db[_0xdc17('0x74')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x75'));db[_0xdc17('0x76')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x77'));db['CmHopperBlack']=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x78'));db[_0xdc17('0x79')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x7a'));db[_0xdc17('0x7b')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xdc17('0x7c')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x7d'));db[_0xdc17('0x7e')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x7f'));db[_0xdc17('0x80')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x81'));db['Automation']=db['sequelize']['import'](_0xdc17('0x82'));db['CannedAnswer']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x83'));db[_0xdc17('0x84')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x85'));db[_0xdc17('0x86')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/condition/condition.model');db['Interval']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x87'));db['Pause']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x88'));db[_0xdc17('0x89')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x8a'));db[_0xdc17('0x8b')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x8c'));db['Schedule']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x8d'));db[_0xdc17('0x8e')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x8f'));db[_0xdc17('0x90')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x91'));db['Template']=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/template/template.model');db[_0xdc17('0x92')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x93'));db['Variable']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x94'));db[_0xdc17('0x95')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/integration/integration.model');db[_0xdc17('0x96')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x97'));db[_0xdc17('0x98')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x99'));db[_0xdc17('0x9a')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x9b'));db[_0xdc17('0x9c')]=db[_0xdc17('0x2')]['import'](_0xdc17('0x9d'));db[_0xdc17('0x9e')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x9f'));db[_0xdc17('0xa0')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xdc17('0xa1')]=db[_0xdc17('0x2')]['import'](_0xdc17('0xa2'));db[_0xdc17('0xa3')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xa4'));db[_0xdc17('0xa5')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xa6'));db[_0xdc17('0xa7')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xa8'));db['SugarcrmConfiguration']=db['sequelize']['import'](_0xdc17('0xa9'));db['SugarcrmField']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xaa'));db[_0xdc17('0xab')]=db['sequelize'][_0xdc17('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0xdc17('0xac')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xad'));db['DeskField']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xae'));db[_0xdc17('0xaf')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0xdc17('0xb0')]=db['sequelize'][_0xdc17('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xdc17('0xb1')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0xb2'));db[_0xdc17('0xb3')]=db['sequelize'][_0xdc17('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xdc17('0xb4')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xb5'));db['ZendeskField']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xb6'));db[_0xdc17('0xb7')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xb8'));db[_0xdc17('0xb9')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xba'));db[_0xdc17('0xbb')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xbc'));db['VtigerAccount']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xbd'));db[_0xdc17('0xbe')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xbf'));db[_0xdc17('0xc0')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xc1'));db['ServicenowAccount']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xc2'));db[_0xdc17('0xc3')]=db['sequelize']['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xdc17('0xc4')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xc5'));db[_0xdc17('0xc6')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize'][_0xdc17('0x13')](_0xdc17('0xc7'));db['Dynamics365Field']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xc8'));db[_0xdc17('0xc9')]=db[_0xdc17('0x2')]['import'](_0xdc17('0xca'));db[_0xdc17('0xcb')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xdc17('0xcc')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xcd'));db[_0xdc17('0x95')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xce'));db[_0xdc17('0xcf')]=db[_0xdc17('0x2')]['import']('../api/network/network.model');db[_0xdc17('0xd0')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xd1'));db[_0xdc17('0xd2')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xd3'));db[_0xdc17('0xd4')]=db['sequelize'][_0xdc17('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xdc17('0xd5')]=db[_0xdc17('0x2')]['import'](_0xdc17('0xd6'));db[_0xdc17('0xd7')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xd8'));db['SquareReport']=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/squareReport/squareReport.model');db[_0xdc17('0xd9')]=db[_0xdc17('0x2')]['import'](_0xdc17('0xda'));db['JscriptyProject']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xdb'));db[_0xdc17('0xdc')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0xdd'));db[_0xdc17('0xde')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xdf'));db[_0xdc17('0xe0')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xe1'));db['SquareRecording']=db[_0xdc17('0x2')]['import']('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xe2'));db[_0xdc17('0xe3')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xe4'));db[_0xdc17('0xe5')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0xe6'));db[_0xdc17('0xe7')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xe8'));db[_0xdc17('0xe9')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0xea'));db[_0xdc17('0xeb')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xec'));db[_0xdc17('0xed')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0xee'));db[_0xdc17('0xef')]=db['sequelize'][_0xdc17('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xdc17('0xf0')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xf1'));db[_0xdc17('0xf2')]=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0xdc17('0xf3')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xf4'));db['SmsTransferReport']=db['sequelize'][_0xdc17('0x13')](_0xdc17('0xf5'));db['CmList']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xf6'));db[_0xdc17('0xf7')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xf8'));db[_0xdc17('0xf9')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xfa'));db['UserProfileSection']=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0xdc17('0x2')][_0xdc17('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0xdc17('0xfb')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0xfc'));db[_0xdc17('0xfd')]=db[_0xdc17('0x2')]['import'](_0xdc17('0xfe'));db[_0xdc17('0xff')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x100'));db[_0xdc17('0x101')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x102'));db[_0xdc17('0x103')]=db['sequelize'][_0xdc17('0x13')](_0xdc17('0x104'));db['WhatsappQueueReport']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x105'));db['WhatsappTransferReport']=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x106'));db[_0xdc17('0x107')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x108'));db[_0xdc17('0x109')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x10a'));db[_0xdc17('0x10b')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x10c'));db[_0xdc17('0x10d')]=db[_0xdc17('0x2')][_0xdc17('0x13')](_0xdc17('0x10e'));db[_0xdc17('0x12')][_0xdc17('0x10f')](db[_0xdc17('0x110')],{'as':'VoiceMail','onDelete':_0xdc17('0x111'),'foreignKey':'UserId'});db[_0xdc17('0x12')]['hasMany'](db['VoiceRecording'],{'as':_0xdc17('0x112'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x12')][_0xdc17('0x114')](db['UserVoiceQueueRt'],{'as':_0xdc17('0x115'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x12')]['hasMany'](db[_0xdc17('0x116')],{'as':_0xdc17('0x117'),'onDelete':'cascade','hooks':!![]});db[_0xdc17('0x12')][_0xdc17('0x114')](db[_0xdc17('0x79')],{'as':_0xdc17('0x118'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x12')][_0xdc17('0x114')](db[_0xdc17('0x7b')],{'as':_0xdc17('0x119'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x12')]['hasMany'](db[_0xdc17('0x7c')],{'as':_0xdc17('0x7c'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x12')]['hasMany'](db[_0xdc17('0x5b')],{'as':_0xdc17('0x11a'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x12')]['hasMany'](db[_0xdc17('0x66')],{'as':_0xdc17('0x11b'),'foreignKey':'UserId'});db[_0xdc17('0x12')][_0xdc17('0x114')](db[_0xdc17('0x11c')],{'as':_0xdc17('0x11d'),'foreignKey':_0xdc17('0x113')});db['User']['hasMany'](db[_0xdc17('0x49')],{'as':_0xdc17('0x11e'),'foreignKey':'UserId'});db[_0xdc17('0x12')]['hasMany'](db[_0xdc17('0x11f')],{'as':'MailInteractions','foreignKey':_0xdc17('0x113')});db[_0xdc17('0x12')][_0xdc17('0x114')](db[_0xdc17('0x101')],{'as':_0xdc17('0x120'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x12')][_0xdc17('0x114')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0xdc17('0x121')});db[_0xdc17('0x12')][_0xdc17('0x122')](db[_0xdc17('0xf9')],{'as':_0xdc17('0xf9'),'foreignKey':_0xdc17('0x123')});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x6e')],{'as':_0xdc17('0x125'),'through':_0xdc17('0x126')});db['User'][_0xdc17('0x124')](db['CmContact'],{'as':_0xdc17('0x127'),'through':_0xdc17('0x128')});db[_0xdc17('0x12')]['belongsToMany'](db[_0xdc17('0x129')],{'as':_0xdc17('0x12a'),'through':_0xdc17('0x12b')});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0xe3')],{'through':_0xdc17('0x12c')});db[_0xdc17('0x12')][_0xdc17('0x124')](db['MailInteraction'],{'as':_0xdc17('0x12d'),'through':_0xdc17('0x12e')});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x66')],{'as':_0xdc17('0x11b'),'through':_0xdc17('0x12f')});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x49')],{'as':_0xdc17('0x11e'),'through':'user_has_fax_interactions'});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x11c')],{'as':_0xdc17('0x11d'),'through':'user_has_sms_interactions'});db[_0xdc17('0x12')][_0xdc17('0x124')](db['OpenchannelInteraction'],{'as':_0xdc17('0x11a'),'through':_0xdc17('0x130')});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x101')],{'as':_0xdc17('0x120'),'through':_0xdc17('0x131')});db['User'][_0xdc17('0x124')](db[_0xdc17('0x1b')],{'as':_0xdc17('0x132'),'through':_0xdc17('0x133'),'required':![]});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x39')],{'as':_0xdc17('0x134'),'through':'UserMailQueue','required':![]});db[_0xdc17('0x12')][_0xdc17('0x124')](db['ChatQueue'],{'as':_0xdc17('0x135'),'through':_0xdc17('0x136'),'required':![],'hooks':!![]});db['User'][_0xdc17('0x124')](db['FaxQueue'],{'as':_0xdc17('0x137'),'through':_0xdc17('0x138'),'required':![]});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x55')],{'as':_0xdc17('0x139'),'through':_0xdc17('0x2f'),'required':![]});db[_0xdc17('0x12')][_0xdc17('0x124')](db['OpenchannelQueue'],{'as':_0xdc17('0x13a'),'through':_0xdc17('0x31'),'required':![]});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x107')],{'as':_0xdc17('0x13b'),'through':_0xdc17('0x32'),'required':![]});db['User'][_0xdc17('0x124')](db[_0xdc17('0x129')],{'through':_0xdc17('0x12b')});db[_0xdc17('0x12')][_0xdc17('0x124')](db['VoicePrefix'],{'as':_0xdc17('0x13c'),'through':_0xdc17('0x13d'),'required':![]});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x61')],{'as':_0xdc17('0x13e'),'through':_0xdc17('0x13f')});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x47')],{'as':_0xdc17('0x140'),'through':_0xdc17('0x141')});db[_0xdc17('0x12')][_0xdc17('0x124')](db['MailAccount'],{'as':_0xdc17('0x142'),'through':_0xdc17('0x143')});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x57')],{'as':_0xdc17('0x144'),'through':'user_has_openchannel_accounts'});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0x51')],{'as':_0xdc17('0x145'),'through':_0xdc17('0x146')});db[_0xdc17('0x12')][_0xdc17('0x124')](db[_0xdc17('0xfd')],{'as':_0xdc17('0x147'),'through':'user_has_whatsapp_accounts'});db['User'][_0xdc17('0x124')](db['SquareProject'],{'as':_0xdc17('0x148'),'through':'user_has_square_projects'});db[_0xdc17('0x15')][_0xdc17('0x114')](db['VoiceExtension'],{'as':_0xdc17('0x149'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x14a')});db['VoiceContext'][_0xdc17('0x114')](db[_0xdc17('0x116')],{'onDelete':_0xdc17('0x111')});db[_0xdc17('0x116')][_0xdc17('0x114')](db[_0xdc17('0x116')],{'as':_0xdc17('0x14b'),'onDelete':'cascade'});db[_0xdc17('0x1a')][_0xdc17('0x124')](db[_0xdc17('0x8e')],{'as':_0xdc17('0x14c'),'through':_0xdc17('0x14d')});db[_0xdc17('0x1b')][_0xdc17('0x114')](db[_0xdc17('0x2a')],{'as':_0xdc17('0x14e'),'foreignKey':_0xdc17('0x14f')});db[_0xdc17('0x1b')][_0xdc17('0x114')](db[_0xdc17('0x76')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xdc17('0x114')](db[_0xdc17('0x79')],{'as':_0xdc17('0x118'),'foreignKey':_0xdc17('0x14f')});db[_0xdc17('0x1b')][_0xdc17('0x114')](db[_0xdc17('0x7b')],{'as':'HopperHistories','foreignKey':_0xdc17('0x14f')});db[_0xdc17('0x1b')][_0xdc17('0x114')](db['ReportAgentPreview'],{'as':_0xdc17('0x7c'),'foreignKey':_0xdc17('0x14f')});db['VoiceQueue']['hasMany'](db[_0xdc17('0x150')],{'as':'HopperBlacks','foreignKey':_0xdc17('0x14f')});db['VoiceQueue'][_0xdc17('0x114')](db['JscriptySessionReport'],{'as':_0xdc17('0x151'),'foreignKey':_0xdc17('0x14f')});db[_0xdc17('0x1b')][_0xdc17('0x122')](db[_0xdc17('0x152')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xdc17('0x1b')][_0xdc17('0x122')](db[_0xdc17('0x152')],{'as':_0xdc17('0x153'),'foreignKey':_0xdc17('0x154')});db[_0xdc17('0x1b')][_0xdc17('0x122')](db[_0xdc17('0x155')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xdc17('0x1b')][_0xdc17('0x122')](db[_0xdc17('0x156')],{'as':_0xdc17('0x157'),'foreignKey':_0xdc17('0x158')});db[_0xdc17('0x1b')][_0xdc17('0x124')](db[_0xdc17('0x129')],{'as':_0xdc17('0x12a'),'through':_0xdc17('0x159')});db[_0xdc17('0x1b')][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x133')});db[_0xdc17('0x1b')]['belongsToMany'](db[_0xdc17('0xe3')],{'as':_0xdc17('0x15b'),'through':_0xdc17('0x10d')});db[_0xdc17('0x1b')]['belongsToMany'](db[_0xdc17('0x129')],{'as':_0xdc17('0x15c'),'through':'voice_queues_has_cm_blacklists'});db[_0xdc17('0x1d')]['belongsTo'](db['User'],{'as':_0xdc17('0x12'),'foreignKey':_0xdc17('0x113')});db['ScreenRecording'][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':_0xdc17('0x12'),'foreignKey':'UserId'});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':_0xdc17('0x15d'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0xdc17('0x15e')});db[_0xdc17('0x15f')]['belongsTo'](db[_0xdc17('0x110')],{'foreignKey':_0xdc17('0x160'),'targetKey':_0xdc17('0x15e')});db[_0xdc17('0x20')]['hasMany'](db['VoiceQueueReport'],{'as':_0xdc17('0x161'),'foreignKey':_0xdc17('0x162'),'constraints':![]});db[_0xdc17('0x20')][_0xdc17('0x114')](db[_0xdc17('0x24')],{'as':_0xdc17('0x163'),'foreignKey':_0xdc17('0x162'),'constraints':![]});db[_0xdc17('0x20')]['belongsTo'](db[_0xdc17('0x12')],{'as':_0xdc17('0x12'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x20')][_0xdc17('0x122')](db['CmContact'],{'as':'Contact','foreignKey':_0xdc17('0x164')});db[_0xdc17('0x33')][_0xdc17('0x122')](db[_0xdc17('0x37')],{'as':_0xdc17('0x37'),'foreignKey':_0xdc17('0x165')});db[_0xdc17('0x35')][_0xdc17('0x122')](db[_0xdc17('0x37')],{'as':_0xdc17('0x37'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xdc17('0x10f')](db['MailServerIn'],{'as':_0xdc17('0x166'),'onDelete':_0xdc17('0x111')});db[_0xdc17('0x37')]['hasOne'](db['MailServerOut'],{'as':_0xdc17('0x167'),'onDelete':_0xdc17('0x111')});db[_0xdc17('0x37')][_0xdc17('0x114')](db[_0xdc17('0x84')],{'as':_0xdc17('0x168'),'foreignKey':_0xdc17('0x165')});db[_0xdc17('0x37')][_0xdc17('0x114')](db[_0xdc17('0x169')],{'as':_0xdc17('0x16a'),'foreignKey':_0xdc17('0x165')});db['MailAccount']['hasMany'](db[_0xdc17('0x3e')],{'as':'Messages','foreignKey':_0xdc17('0x165')});db[_0xdc17('0x37')][_0xdc17('0x114')](db[_0xdc17('0x11f')],{'as':_0xdc17('0x16b')});db[_0xdc17('0x37')]['hasMany'](db[_0xdc17('0x40')],{'as':'Applications'});db['MailAccount']['belongsTo'](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':'ListId'});db['MailAccount'][_0xdc17('0x122')](db[_0xdc17('0x16d')],{'as':_0xdc17('0x16d'),'foreignKey':_0xdc17('0x16e')});db[_0xdc17('0x37')]['belongsTo'](db['Pause'],{'as':_0xdc17('0x157'),'foreignKey':_0xdc17('0x158')});db[_0xdc17('0x37')][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x143')});db[_0xdc17('0x39')][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x2c')});db['MailQueue']['belongsToMany'](db[_0xdc17('0xe3')],{'through':_0xdc17('0x16f'),'as':_0xdc17('0x15b')});db[_0xdc17('0x11f')]['hasMany'](db[_0xdc17('0x3e')],{'as':'Messages','onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x170')});db['MailInteraction']['belongsTo'](db[_0xdc17('0x37')],{'as':'Account','foreignKey':_0xdc17('0x165')});db[_0xdc17('0x11f')][_0xdc17('0x122')](db['CmContact'],{'as':'Contact','foreignKey':_0xdc17('0x164')});db[_0xdc17('0x11f')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':_0xdc17('0x171'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x11f')][_0xdc17('0x124')](db['Tag'],{'through':_0xdc17('0x172'),'as':_0xdc17('0x173')});db['MailInteraction'][_0xdc17('0x124')](db[_0xdc17('0x90')],{'through':_0xdc17('0x172'),'as':_0xdc17('0x174')});db[_0xdc17('0x11f')][_0xdc17('0x124')](db['User'],{'as':_0xdc17('0x175'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0xdc17('0x3e')][_0xdc17('0x114')](db[_0xdc17('0xeb')],{'as':_0xdc17('0x176'),'onDelete':'cascade'});db[_0xdc17('0x3e')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':_0xdc17('0x12')});db[_0xdc17('0x3e')][_0xdc17('0x122')](db[_0xdc17('0x74')],{'onDelete':_0xdc17('0x111'),'as':'Contact'});db['MailMessage'][_0xdc17('0x122')](db[_0xdc17('0x11f')],{'as':_0xdc17('0x177'),'foreignKey':_0xdc17('0x170')});db['MailMessage'][_0xdc17('0x122')](db[_0xdc17('0x37')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x165')});db[_0xdc17('0x3e')][_0xdc17('0x122')](db[_0xdc17('0x61')],{'as':_0xdc17('0x61'),'foreignKey':_0xdc17('0x179')});db[_0xdc17('0x3e')][_0xdc17('0x122')](db[_0xdc17('0x6a')],{'as':'ChatOfflineMessage','foreignKey':_0xdc17('0x17a')});db[_0xdc17('0x40')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x40')][_0xdc17('0x122')](db['MailQueue'],{'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x40')][_0xdc17('0x122')](db[_0xdc17('0x37')],{'onDelete':'restrict'});db[_0xdc17('0x40')][_0xdc17('0x122')](db['Interval'],{'onDelete':_0xdc17('0x17b'),'foreignKey':_0xdc17('0x17c')});db[_0xdc17('0x40')][_0xdc17('0x122')](db[_0xdc17('0x90')],{'onDelete':_0xdc17('0x17b'),'foreignKey':'TagId'});db[_0xdc17('0x42')][_0xdc17('0x122')](db['MailAccount'],{});db[_0xdc17('0x42')][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x42')][_0xdc17('0x122')](db[_0xdc17('0x74')],{'as':_0xdc17('0x17e'),'foreignKey':_0xdc17('0x164')});db['MailQueueReport']['belongsTo'](db[_0xdc17('0x11f')],{});db[_0xdc17('0x42')][_0xdc17('0x122')](db[_0xdc17('0x3e')],{});db['MailQueueReport'][_0xdc17('0x122')](db[_0xdc17('0x12')],{});db[_0xdc17('0x42')][_0xdc17('0x122')](db[_0xdc17('0x39')],{});db[_0xdc17('0x44')][_0xdc17('0x114')](db[_0xdc17('0x45')],{'as':_0xdc17('0x17f'),'onDelete':_0xdc17('0x111')});db['FaxAccount']['hasMany'](db[_0xdc17('0x84')],{'as':_0xdc17('0x168'),'foreignKey':_0xdc17('0x180')});db['FaxAccount'][_0xdc17('0x114')](db['CannedAnswer'],{'as':_0xdc17('0x16a'),'foreignKey':'FaxAccountId'});db[_0xdc17('0x47')][_0xdc17('0x114')](db[_0xdc17('0x49')],{'as':_0xdc17('0x16b')});db[_0xdc17('0x47')][_0xdc17('0x114')](db[_0xdc17('0x181')],{'as':_0xdc17('0x14b')});db['FaxAccount'][_0xdc17('0x114')](db[_0xdc17('0x116')],{'as':'Exntensions','onDelete':_0xdc17('0x111')});db[_0xdc17('0x47')][_0xdc17('0x114')](db['FaxMessage'],{'as':_0xdc17('0x15d')});db[_0xdc17('0x47')][_0xdc17('0x122')](db[_0xdc17('0x152')],{'as':'Trunk'});db[_0xdc17('0x47')][_0xdc17('0x122')](db['CmList'],{'as':'List','foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x47')][_0xdc17('0x122')](db[_0xdc17('0x156')],{'as':_0xdc17('0x157'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xdc17('0x47')][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x141')});db[_0xdc17('0x181')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x181')][_0xdc17('0x122')](db['FaxQueue'],{'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x181')]['belongsTo'](db[_0xdc17('0x47')],{'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x181')]['belongsTo'](db[_0xdc17('0x90')],{'onDelete':_0xdc17('0x17b'),'foreignKey':'TagId'});db[_0xdc17('0x49')][_0xdc17('0x114')](db[_0xdc17('0x4b')],{'as':_0xdc17('0x15d'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x182')});db[_0xdc17('0x49')][_0xdc17('0x122')](db[_0xdc17('0x47')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x180')});db[_0xdc17('0x49')]['belongsTo'](db[_0xdc17('0x74')],{'as':'Contact','foreignKey':_0xdc17('0x164')});db['FaxInteraction']['belongsTo'](db[_0xdc17('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0xdc17('0x49')]['belongsToMany'](db[_0xdc17('0x90')],{'through':_0xdc17('0x183'),'as':_0xdc17('0x173')});db[_0xdc17('0x49')][_0xdc17('0x124')](db[_0xdc17('0x90')],{'through':_0xdc17('0x183'),'as':_0xdc17('0x174')});db[_0xdc17('0x49')]['belongsToMany'](db[_0xdc17('0x12')],{'as':_0xdc17('0x175'),'through':_0xdc17('0x184'),'foreignKey':_0xdc17('0x182')});db['FaxMessage']['belongsTo'](db[_0xdc17('0x12')],{'onDelete':'cascade','as':'User'});db[_0xdc17('0x4b')][_0xdc17('0x122')](db['FaxInteraction'],{'as':_0xdc17('0x177'),'foreignKey':_0xdc17('0x182')});db[_0xdc17('0x4b')][_0xdc17('0x122')](db[_0xdc17('0x74')],{'onDelete':_0xdc17('0x111'),'as':_0xdc17('0x17e')});db['FaxMessage'][_0xdc17('0x122')](db['Attachment'],{'as':'Attachment','foreignKey':_0xdc17('0x185')});db[_0xdc17('0x4b')][_0xdc17('0x122')](db['FaxAccount'],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x180')});db[_0xdc17('0x4d')][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':'Agents','through':_0xdc17('0x138')});db['FaxQueue'][_0xdc17('0x124')](db[_0xdc17('0xe3')],{'through':_0xdc17('0x186'),'as':_0xdc17('0x15b')});db[_0xdc17('0x4f')][_0xdc17('0x122')](db[_0xdc17('0x47')],{});db[_0xdc17('0x4f')][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':'List','foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x4f')][_0xdc17('0x122')](db[_0xdc17('0x74')],{'as':_0xdc17('0x17e'),'foreignKey':_0xdc17('0x164')});db[_0xdc17('0x4f')][_0xdc17('0x122')](db[_0xdc17('0x49')],{});db[_0xdc17('0x4f')][_0xdc17('0x122')](db['FaxMessage'],{});db[_0xdc17('0x4f')][_0xdc17('0x122')](db[_0xdc17('0x12')],{});db[_0xdc17('0x4f')][_0xdc17('0x122')](db[_0xdc17('0x4d')],{});db['SmsAccount'][_0xdc17('0x114')](db[_0xdc17('0x84')],{'as':_0xdc17('0x168'),'foreignKey':_0xdc17('0x187')});db[_0xdc17('0x51')][_0xdc17('0x114')](db[_0xdc17('0x169')],{'as':_0xdc17('0x16a'),'foreignKey':'SmsAccountId'});db[_0xdc17('0x51')]['hasMany'](db[_0xdc17('0x54')],{'as':_0xdc17('0x15d'),'foreignKey':_0xdc17('0x187')});db['SmsAccount'][_0xdc17('0x114')](db['SmsInteraction'],{'as':_0xdc17('0x16b')});db['SmsAccount'][_0xdc17('0x114')](db[_0xdc17('0x188')],{'as':_0xdc17('0x14b')});db['SmsAccount'][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x51')][_0xdc17('0x122')](db[_0xdc17('0x156')],{'as':_0xdc17('0x157'),'foreignKey':_0xdc17('0x158')});db[_0xdc17('0x51')]['belongsToMany'](db[_0xdc17('0x12')],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x146')});db[_0xdc17('0x188')]['belongsTo'](db[_0xdc17('0x12')],{'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x188')][_0xdc17('0x122')](db[_0xdc17('0x55')],{'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x188')]['belongsTo'](db[_0xdc17('0x51')],{'onDelete':_0xdc17('0x17b')});db['SmsApplication']['belongsTo'](db[_0xdc17('0x155')],{'onDelete':_0xdc17('0x17b'),'foreignKey':_0xdc17('0x17c')});db[_0xdc17('0x188')]['belongsTo'](db[_0xdc17('0x90')],{'onDelete':_0xdc17('0x17b'),'foreignKey':_0xdc17('0x189')});db['SmsInteraction'][_0xdc17('0x114')](db[_0xdc17('0x54')],{'as':_0xdc17('0x15d'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xdc17('0x11c')][_0xdc17('0x122')](db[_0xdc17('0x51')],{'as':_0xdc17('0x178'),'foreignKey':'SmsAccountId'});db[_0xdc17('0x11c')]['belongsTo'](db[_0xdc17('0x74')],{'as':_0xdc17('0x17e'),'foreignKey':'ContactId'});db[_0xdc17('0x11c')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':_0xdc17('0x171'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x11c')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0xdc17('0x11c')]['belongsToMany'](db[_0xdc17('0x90')],{'through':_0xdc17('0x18a'),'as':_0xdc17('0x174')});db['SmsInteraction'][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0xdc17('0x18b')});db[_0xdc17('0x54')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':'User'});db[_0xdc17('0x54')][_0xdc17('0x122')](db[_0xdc17('0x74')],{'onDelete':'cascade','as':'Contact'});db[_0xdc17('0x54')]['belongsTo'](db[_0xdc17('0x11c')],{'onDelete':_0xdc17('0x111'),'as':'Interaction','foreignKey':_0xdc17('0x18b')});db[_0xdc17('0x54')][_0xdc17('0x122')](db['SmsAccount'],{'as':_0xdc17('0x178'),'foreignKey':'SmsAccountId'});db[_0xdc17('0x55')][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':_0xdc17('0x15a'),'through':'UserSmsQueue','foreignKey':_0xdc17('0x18c')});db[_0xdc17('0x55')][_0xdc17('0x124')](db[_0xdc17('0xe3')],{'through':_0xdc17('0x18d'),'as':_0xdc17('0x15b')});db[_0xdc17('0x57')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0xdc17('0x18e')});db[_0xdc17('0x57')]['hasMany'](db['CannedAnswer'],{'as':_0xdc17('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0xdc17('0x57')][_0xdc17('0x114')](db[_0xdc17('0x5b')],{'as':_0xdc17('0x16b'),'foreignKey':_0xdc17('0x18e')});db[_0xdc17('0x57')][_0xdc17('0x114')](db[_0xdc17('0x5d')],{'as':_0xdc17('0x15d'),'foreignKey':_0xdc17('0x18e')});db[_0xdc17('0x57')][_0xdc17('0x114')](db[_0xdc17('0x59')],{'as':_0xdc17('0x14b'),'foreignKey':_0xdc17('0x18e')});db['OpenchannelAccount'][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d')});db['OpenchannelAccount']['belongsTo'](db[_0xdc17('0x156')],{'as':_0xdc17('0x157'),'foreignKey':_0xdc17('0x158')});db['OpenchannelAccount'][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':_0xdc17('0x15a'),'through':'user_has_openchannel_accounts'});db[_0xdc17('0x59')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'onDelete':_0xdc17('0x17b')});db['OpenchannelApplication'][_0xdc17('0x122')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0xdc17('0x18f')});db[_0xdc17('0x59')]['belongsTo'](db[_0xdc17('0x57')],{'onDelete':_0xdc17('0x17b'),'foreignKey':_0xdc17('0x18e')});db[_0xdc17('0x59')]['belongsTo'](db[_0xdc17('0x155')],{'onDelete':_0xdc17('0x17b'),'foreignKey':'IntervalId'});db['OpenchannelApplication']['belongsTo'](db[_0xdc17('0x90')],{'onDelete':_0xdc17('0x17b'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0xdc17('0x114')](db['OpenchannelMessage'],{'as':_0xdc17('0x15d'),'onDelete':'cascade','foreignKey':_0xdc17('0x190')});db[_0xdc17('0x5b')][_0xdc17('0x122')](db[_0xdc17('0x57')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x18e')});db['OpenchannelInteraction']['belongsTo'](db[_0xdc17('0x74')],{'as':_0xdc17('0x17e'),'foreignKey':'ContactId'});db[_0xdc17('0x5b')][_0xdc17('0x122')](db['User'],{'as':_0xdc17('0x171'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x5b')][_0xdc17('0x124')](db[_0xdc17('0x90')],{'through':_0xdc17('0x191'),'as':_0xdc17('0x173')});db[_0xdc17('0x5b')][_0xdc17('0x124')](db['Tag'],{'through':_0xdc17('0x191'),'as':_0xdc17('0x174')});db[_0xdc17('0x5b')][_0xdc17('0x124')](db['User'],{'as':_0xdc17('0x175'),'through':_0xdc17('0x130'),'foreignKey':_0xdc17('0x190')});db[_0xdc17('0x5d')]['belongsTo'](db[_0xdc17('0x12')],{'onDelete':_0xdc17('0x111'),'as':_0xdc17('0x12')});db['OpenchannelMessage'][_0xdc17('0x122')](db[_0xdc17('0x74')],{'onDelete':_0xdc17('0x111'),'as':_0xdc17('0x17e')});db[_0xdc17('0x5d')][_0xdc17('0x122')](db[_0xdc17('0x5b')],{'onDelete':_0xdc17('0x111'),'as':'Interaction','foreignKey':_0xdc17('0x190')});db[_0xdc17('0x5d')][_0xdc17('0x122')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xdc17('0x5d')][_0xdc17('0x122')](db[_0xdc17('0x57')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x18e')});db[_0xdc17('0x5f')][_0xdc17('0x124')](db['User'],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x31'),'foreignKey':_0xdc17('0x18f')});db['OpenchannelQueue'][_0xdc17('0x124')](db['Team'],{'through':_0xdc17('0x192'),'as':'Teams'});db[_0xdc17('0x61')][_0xdc17('0x114')](db[_0xdc17('0x84')],{'as':'Dispositions','foreignKey':_0xdc17('0x179')});db[_0xdc17('0x61')][_0xdc17('0x114')](db[_0xdc17('0x169')],{'as':_0xdc17('0x16a'),'foreignKey':_0xdc17('0x179')});db[_0xdc17('0x61')][_0xdc17('0x114')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xdc17('0x61')][_0xdc17('0x114')](db[_0xdc17('0x66')],{'as':'Interactions'});db['ChatWebsite'][_0xdc17('0x114')](db[_0xdc17('0x64')],{'as':'Applications'});db[_0xdc17('0x61')]['hasMany'](db['ChatMessage'],{'as':_0xdc17('0x15d')});db[_0xdc17('0x61')][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x61')]['belongsTo'](db[_0xdc17('0x155')],{'as':'Interval','foreignKey':_0xdc17('0x17c')});db[_0xdc17('0x61')][_0xdc17('0x122')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xdc17('0x165')});db[_0xdc17('0x61')][_0xdc17('0x122')](db[_0xdc17('0x156')],{'as':_0xdc17('0x157'),'foreignKey':_0xdc17('0x158')});db[_0xdc17('0x61')][_0xdc17('0x124')](db['User'],{'as':'Agents','through':_0xdc17('0x13f')});db['OpenchannelQueueReport'][_0xdc17('0x122')](db[_0xdc17('0x57')],{});db['OpenchannelQueueReport'][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':'ListId'});db[_0xdc17('0x62')]['belongsTo'](db[_0xdc17('0x74')],{'as':_0xdc17('0x17e'),'foreignKey':_0xdc17('0x164')});db[_0xdc17('0x62')][_0xdc17('0x122')](db[_0xdc17('0x5b')],{});db[_0xdc17('0x62')][_0xdc17('0x122')](db[_0xdc17('0x5d')],{});db['OpenchannelQueueReport'][_0xdc17('0x122')](db['User'],{});db['OpenchannelQueueReport'][_0xdc17('0x122')](db[_0xdc17('0x5f')],{});db[_0xdc17('0x64')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':_0xdc17('0x193'),'foreignKey':_0xdc17('0x113'),'onDelete':_0xdc17('0x17b')});db['ChatApplication']['belongsTo'](db[_0xdc17('0x6c')],{'as':'Queue','foreignKey':_0xdc17('0x194'),'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x64')]['belongsTo'](db[_0xdc17('0x61')],{'as':'Website','foreignKey':_0xdc17('0x179'),'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x64')][_0xdc17('0x122')](db[_0xdc17('0x90')],{'onDelete':_0xdc17('0x17b'),'foreignKey':_0xdc17('0x189')});db[_0xdc17('0x66')]['hasMany'](db[_0xdc17('0x68')],{'as':_0xdc17('0x15d'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x195')});db[_0xdc17('0x66')][_0xdc17('0x122')](db['ChatWebsite'],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x179')});db[_0xdc17('0x66')][_0xdc17('0x122')](db[_0xdc17('0x74')],{'as':_0xdc17('0x17e'),'foreignKey':_0xdc17('0x164')});db['ChatInteraction'][_0xdc17('0x122')](db['User'],{'as':_0xdc17('0x171'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x66')][_0xdc17('0x124')](db[_0xdc17('0x90')],{'through':_0xdc17('0x196'),'as':_0xdc17('0x173')});db[_0xdc17('0x66')][_0xdc17('0x124')](db[_0xdc17('0x90')],{'through':'chat_interaction_has_tags','as':_0xdc17('0x174')});db[_0xdc17('0x66')][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':_0xdc17('0x175'),'through':_0xdc17('0x12f'),'foreignKey':'ChatInteractionId'});db[_0xdc17('0x68')]['belongsTo'](db[_0xdc17('0x12')],{'onDelete':_0xdc17('0x111'),'as':'User'});db[_0xdc17('0x68')][_0xdc17('0x122')](db[_0xdc17('0x74')],{'onDelete':_0xdc17('0x111'),'as':_0xdc17('0x17e'),'foreignKey':_0xdc17('0x164')});db[_0xdc17('0x68')][_0xdc17('0x122')](db[_0xdc17('0x66')],{'onDelete':_0xdc17('0x111'),'as':'Interaction','foreignKey':_0xdc17('0x195')});db[_0xdc17('0x68')][_0xdc17('0x122')](db[_0xdc17('0xeb')],{'as':_0xdc17('0xeb'),'foreignKey':_0xdc17('0x185')});db[_0xdc17('0x68')]['belongsTo'](db[_0xdc17('0x61')],{'as':_0xdc17('0x178'),'foreignKey':'ChatWebsiteId'});db[_0xdc17('0x6a')]['hasMany'](db['Attachment'],{'as':_0xdc17('0x176'),'foreignKey':_0xdc17('0x17a'),'onDelete':_0xdc17('0x111'),'hooks':!![]});db[_0xdc17('0x6a')]['belongsTo'](db[_0xdc17('0x74')],{'onDelete':_0xdc17('0x111'),'as':'Contact','foreignKey':'ContactId'});db[_0xdc17('0x6a')][_0xdc17('0x122')](db[_0xdc17('0x61')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x179')});db['ChatQueue'][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x136'),'hooks':!![]});db['ChatQueue'][_0xdc17('0x124')](db[_0xdc17('0xe3')],{'through':_0xdc17('0x197'),'as':'Teams'});db[_0xdc17('0x6e')][_0xdc17('0x114')](db[_0xdc17('0xd2')],{'as':_0xdc17('0x15d'),'foreignKey':_0xdc17('0x198'),'onDelete':_0xdc17('0x111')});db[_0xdc17('0x6e')][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':'Members','through':_0xdc17('0x126')});db['ChatProactiveAction'][_0xdc17('0x122')](db[_0xdc17('0x61')],{'as':_0xdc17('0x199'),'foreignKey':_0xdc17('0x179')});db[_0xdc17('0x72')][_0xdc17('0x114')](db[_0xdc17('0x74')],{'as':_0xdc17('0x127'),'foreignKey':_0xdc17('0x19a')});db['CmContact']['hasMany'](db[_0xdc17('0x76')],{'as':_0xdc17('0x19b'),'foreignKey':_0xdc17('0x164')});db[_0xdc17('0x74')][_0xdc17('0x114')](db[_0xdc17('0x79')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xdc17('0x74')][_0xdc17('0x114')](db[_0xdc17('0x7b')],{'as':_0xdc17('0x19c'),'foreignKey':_0xdc17('0x164')});db[_0xdc17('0x74')][_0xdc17('0x114')](db[_0xdc17('0x7c')],{'as':_0xdc17('0x7c'),'foreignKey':_0xdc17('0x164')});db[_0xdc17('0x74')][_0xdc17('0x114')](db[_0xdc17('0xd5')],{'as':_0xdc17('0x151'),'foreignKey':_0xdc17('0x164')});db[_0xdc17('0x74')][_0xdc17('0x114')](db[_0xdc17('0x5b')],{'as':'OpenchannelInteractions','foreignKey':_0xdc17('0x164'),'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x74')][_0xdc17('0x114')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xdc17('0x164'),'onDelete':'restrict'});db['CmContact'][_0xdc17('0x114')](db['SmsInteraction'],{'as':_0xdc17('0x11d'),'foreignKey':_0xdc17('0x164'),'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x74')]['hasMany'](db['FaxInteraction'],{'as':_0xdc17('0x11e'),'foreignKey':_0xdc17('0x164'),'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x74')][_0xdc17('0x114')](db[_0xdc17('0x11f')],{'as':'MailInteractions','foreignKey':_0xdc17('0x164'),'onDelete':'restrict'});db[_0xdc17('0x74')][_0xdc17('0x122')](db[_0xdc17('0x72')],{'as':_0xdc17('0x19d'),'foreignKey':_0xdc17('0x19a')});db[_0xdc17('0x74')][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d'),'onDelete':'cascade'});db['CmContact'][_0xdc17('0x124')](db['User'],{'as':_0xdc17('0x175'),'through':_0xdc17('0x128')});db[_0xdc17('0x74')][_0xdc17('0x124')](db['Tag'],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xdc17('0x74')][_0xdc17('0x124')](db['Tag'],{'through':_0xdc17('0x19e'),'as':_0xdc17('0x174')});db[_0xdc17('0x76')][_0xdc17('0x122')](db[_0xdc17('0x74')],{'as':'Contact','foreignKey':_0xdc17('0x164'),'onDelete':_0xdc17('0x111')});db[_0xdc17('0x76')][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d'),'onDelete':'cascade'});db[_0xdc17('0x76')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':_0xdc17('0x193'),'foreignKey':'UserId'});db[_0xdc17('0x76')][_0xdc17('0x122')](db['VoiceQueue'],{'as':_0xdc17('0x19f'),'foreignKey':_0xdc17('0x14f'),'onDelete':_0xdc17('0x111')});db[_0xdc17('0x76')][_0xdc17('0x122')](db[_0xdc17('0xe7')],{'as':_0xdc17('0xe7'),'foreignKey':_0xdc17('0x1a0'),'onDelete':_0xdc17('0x111')});db[_0xdc17('0x76')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':_0xdc17('0x171'),'foreignKey':_0xdc17('0x1a1')});db[_0xdc17('0x150')][_0xdc17('0x122')](db['CmContact'],{'as':_0xdc17('0x17e'),'foreignKey':_0xdc17('0x164'),'onDelete':_0xdc17('0x111')});db[_0xdc17('0x150')][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d'),'onDelete':'cascade'});db[_0xdc17('0x150')]['belongsTo'](db[_0xdc17('0x1b')],{'as':_0xdc17('0x19f'),'foreignKey':'VoiceQueueId','onDelete':_0xdc17('0x111')});db[_0xdc17('0x150')][_0xdc17('0x122')](db[_0xdc17('0xe7')],{'as':_0xdc17('0xe7'),'foreignKey':'CampaignId','onDelete':_0xdc17('0x111')});db[_0xdc17('0x1a2')][_0xdc17('0x114')](db[_0xdc17('0x86')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xdc17('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0xdc17('0x1a2')][_0xdc17('0x114')](db[_0xdc17('0x86')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0xdc17('0x1a4'),'onDelete':_0xdc17('0x111'),'hooks':!![]});db[_0xdc17('0x1a2')][_0xdc17('0x114')](db['Action'],{'as':_0xdc17('0x1a5'),'foreignKey':_0xdc17('0x1a6'),'onDelete':_0xdc17('0x111'),'hooks':!![]});db[_0xdc17('0x84')][_0xdc17('0x114')](db[_0xdc17('0x84')],{'as':_0xdc17('0x168'),'foreignKey':'ParentId','onDelete':_0xdc17('0x111')});db[_0xdc17('0x155')][_0xdc17('0x114')](db[_0xdc17('0x155')],{'as':_0xdc17('0x1a7'),'foreignKey':_0xdc17('0x17c'),'onDelete':_0xdc17('0x111'),'hooks':!![],'required':![]});db['Interval'][_0xdc17('0x114')](db[_0xdc17('0x116')],{'as':_0xdc17('0x117'),'foreignKey':_0xdc17('0x17c'),'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x155')][_0xdc17('0x114')](db[_0xdc17('0x40')],{'as':_0xdc17('0x1a8'),'foreignKey':_0xdc17('0x17c')});db['Interval'][_0xdc17('0x114')](db[_0xdc17('0x64')],{'as':_0xdc17('0x1a9'),'foreignKey':_0xdc17('0x17c')});db[_0xdc17('0x155')][_0xdc17('0x114')](db['FaxApplication'],{'as':_0xdc17('0x1aa'),'foreignKey':_0xdc17('0x17c')});db['Interval']['hasMany'](db[_0xdc17('0x188')],{'as':_0xdc17('0x1ab'),'foreignKey':_0xdc17('0x17c')});db[_0xdc17('0x1ac')][_0xdc17('0x122')](db[_0xdc17('0x37')],{});db[_0xdc17('0x1ac')][_0xdc17('0x122')](db[_0xdc17('0x9a')],{'foreignKey':'DefaultReportId'});db[_0xdc17('0x1ac')][_0xdc17('0x122')](db['AnalyticCustomReport'],{'foreignKey':_0xdc17('0x1ad')});db['Sound'][_0xdc17('0x124')](db[_0xdc17('0x1a')],{'as':_0xdc17('0x1ae'),'through':_0xdc17('0x14d'),'onDelete':_0xdc17('0x17b')});db[_0xdc17('0x90')][_0xdc17('0x124')](db['CmContact'],{'through':_0xdc17('0x19e')});db['Tag'][_0xdc17('0x124')](db['ChatInteraction'],{'through':_0xdc17('0x196')});db[_0xdc17('0x90')][_0xdc17('0x124')](db[_0xdc17('0x11f')],{'through':_0xdc17('0x172')});db[_0xdc17('0x90')][_0xdc17('0x124')](db[_0xdc17('0x11c')],{'through':'sms_interaction_has_tags'});db[_0xdc17('0x90')]['belongsToMany'](db[_0xdc17('0x49')],{'through':_0xdc17('0x183')});db['Tag'][_0xdc17('0x124')](db[_0xdc17('0x5b')],{'through':_0xdc17('0x191')});db[_0xdc17('0x90')][_0xdc17('0x124')](db[_0xdc17('0x101')],{'through':'whatsapp_interaction_has_tags'});db[_0xdc17('0x92')][_0xdc17('0x114')](db[_0xdc17('0x86')],{'as':{'plural':_0xdc17('0x1af'),'singular':'AllCondition'},'foreignKey':_0xdc17('0x1b0'),'onDelete':_0xdc17('0x111'),'hooks':!![]});db[_0xdc17('0x92')]['hasMany'](db['Condition'],{'as':{'plural':_0xdc17('0x1b1'),'singular':_0xdc17('0x1b2')},'foreignKey':_0xdc17('0x1b3'),'onDelete':_0xdc17('0x111'),'hooks':!![]});db[_0xdc17('0x92')][_0xdc17('0x114')](db['Action'],{'as':_0xdc17('0x1a5'),'foreignKey':'TriggerId','onDelete':_0xdc17('0x111'),'hooks':!![]});db[_0xdc17('0x98')][_0xdc17('0x114')](db[_0xdc17('0xa0')],{'as':_0xdc17('0x1b4'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1ad'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0xdc17('0xa0')],{'as':_0xdc17('0x1b4'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0xdc17('0x9e')][_0xdc17('0x114')](db[_0xdc17('0xa0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xdc17('0x1b5')});db[_0xdc17('0xa0')][_0xdc17('0x122')](db[_0xdc17('0x9e')],{'foreignKey':_0xdc17('0x1b5')});db[_0xdc17('0xa3')][_0xdc17('0x114')](db['SalesforceConfiguration'],{'as':_0xdc17('0x1b6'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xa5')][_0xdc17('0x114')](db['SalesforceField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xdc17('0x1b8')});db['SalesforceConfiguration'][_0xdc17('0x114')](db[_0xdc17('0xa7')],{'as':_0xdc17('0x1b9'),'onDelete':_0xdc17('0x111'),'foreignKey':'DescriptionId'});db[_0xdc17('0xa5')][_0xdc17('0x114')](db[_0xdc17('0xa7')],{'as':_0xdc17('0x1b4'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1ba')});db['SalesforceConfiguration'][_0xdc17('0x122')](db[_0xdc17('0xa3')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xa7')]['hasMany'](db[_0xdc17('0xa7')],{'as':_0xdc17('0x1bb'),'foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0xa7')]['hasMany'](db[_0xdc17('0xa7')],{'as':'Description','foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0xa7')]['hasMany'](db[_0xdc17('0xa7')],{'as':'Field','foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0xa7')][_0xdc17('0x122')](db[_0xdc17('0x1bd')],{'as':_0xdc17('0x1bd'),'foreignKey':_0xdc17('0x1be')});db[_0xdc17('0x1bf')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xdc17('0x1b6'),'onDelete':'cascade','foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0x1c0')][_0xdc17('0x114')](db[_0xdc17('0x1c1')],{'as':_0xdc17('0x1c2'),'onDelete':_0xdc17('0x111'),'foreignKey':'SubjectId'});db[_0xdc17('0x1c0')][_0xdc17('0x114')](db[_0xdc17('0x1c1')],{'as':_0xdc17('0x1b9'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0x1c0')][_0xdc17('0x114')](db[_0xdc17('0x1c1')],{'as':_0xdc17('0x1b4'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0x1c0')][_0xdc17('0x122')](db[_0xdc17('0x1bf')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1b7')});db['SugarcrmField'][_0xdc17('0x114')](db[_0xdc17('0x1c1')],{'as':_0xdc17('0x1bb'),'foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0x1c1')]['hasMany'](db[_0xdc17('0x1c1')],{'as':_0xdc17('0x1c3'),'foreignKey':_0xdc17('0x1bc')});db['SugarcrmField'][_0xdc17('0x114')](db[_0xdc17('0x1c1')],{'as':_0xdc17('0x1c4'),'foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0x1c1')]['belongsTo'](db[_0xdc17('0x1bd')],{'as':_0xdc17('0x1bd'),'foreignKey':_0xdc17('0x1be')});db[_0xdc17('0xab')][_0xdc17('0x114')](db['DeskConfiguration'],{'as':_0xdc17('0x1b6'),'onDelete':_0xdc17('0x111'),'foreignKey':'AccountId'});db[_0xdc17('0xac')][_0xdc17('0x114')](db['DeskField'],{'as':_0xdc17('0x1c2'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0xac')]['hasMany'](db['DeskField'],{'as':_0xdc17('0x1b9'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0xac')][_0xdc17('0x114')](db['DeskField'],{'as':_0xdc17('0x1b4'),'onDelete':'cascade','foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0xac')][_0xdc17('0x122')](db['DeskAccount'],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xac')][_0xdc17('0x124')](db[_0xdc17('0x90')],{'through':_0xdc17('0x1c5')});db['DeskField'][_0xdc17('0x114')](db[_0xdc17('0x1c6')],{'as':'Subject','foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0x1c6')][_0xdc17('0x114')](db['DeskField'],{'as':_0xdc17('0x1c3'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0x1c6')]['hasMany'](db[_0xdc17('0x1c6')],{'as':_0xdc17('0x1c4'),'foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0x1c6')][_0xdc17('0x122')](db[_0xdc17('0x1bd')],{'as':'Variable','foreignKey':'VariableId'});db[_0xdc17('0xaf')][_0xdc17('0x114')](db[_0xdc17('0xb0')],{'as':_0xdc17('0x1b6'),'onDelete':_0xdc17('0x111'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0xdc17('0x114')](db[_0xdc17('0xb1')],{'as':_0xdc17('0x1c2'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1b8')});db['ZohoConfiguration'][_0xdc17('0x114')](db[_0xdc17('0xb1')],{'as':_0xdc17('0x1b9'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0xb0')][_0xdc17('0x114')](db[_0xdc17('0xb1')],{'as':_0xdc17('0x1b4'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xdc17('0xb0')]['belongsTo'](db[_0xdc17('0xaf')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1b7')});db['ZohoField']['hasMany'](db[_0xdc17('0xb1')],{'as':_0xdc17('0x1bb'),'foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0xb1')][_0xdc17('0x114')](db['ZohoField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xdc17('0xb1')]['hasMany'](db[_0xdc17('0xb1')],{'as':_0xdc17('0x1c4'),'foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0xb1')]['belongsTo'](db[_0xdc17('0x1bd')],{'as':'Variable','foreignKey':_0xdc17('0x1be')});db['ZendeskAccount']['hasMany'](db[_0xdc17('0xb4')],{'as':'Configurations','onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xb4')]['hasMany'](db['ZendeskField'],{'as':_0xdc17('0x1c2'),'foreignKey':'SubjectId'});db[_0xdc17('0xb4')][_0xdc17('0x114')](db[_0xdc17('0x1c7')],{'as':_0xdc17('0x1b9'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0xb4')][_0xdc17('0x114')](db['ZendeskField'],{'as':_0xdc17('0x1b4'),'foreignKey':_0xdc17('0x1ba')});db['ZendeskConfiguration']['belongsTo'](db[_0xdc17('0xb3')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1b7')});db['ZendeskConfiguration']['belongsToMany'](db[_0xdc17('0x90')],{'through':_0xdc17('0x1c8')});db[_0xdc17('0x1c7')][_0xdc17('0x114')](db[_0xdc17('0x1c7')],{'as':_0xdc17('0x1bb'),'foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0x1c7')][_0xdc17('0x114')](db[_0xdc17('0x1c7')],{'as':'Description','foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0x1c7')][_0xdc17('0x114')](db[_0xdc17('0x1c7')],{'as':_0xdc17('0x1c4'),'foreignKey':'FieldId'});db[_0xdc17('0x1c7')]['belongsTo'](db[_0xdc17('0x1bd')],{'as':_0xdc17('0x1bd'),'foreignKey':_0xdc17('0x1be')});db[_0xdc17('0xb7')][_0xdc17('0x114')](db['FreshdeskConfiguration'],{'as':_0xdc17('0x1b6'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xb9')][_0xdc17('0x114')](db[_0xdc17('0xbb')],{'as':'Subjects','onDelete':_0xdc17('0x111'),'foreignKey':'SubjectId'});db[_0xdc17('0xb9')][_0xdc17('0x114')](db[_0xdc17('0xbb')],{'as':_0xdc17('0x1b9'),'onDelete':_0xdc17('0x111'),'foreignKey':'DescriptionId'});db[_0xdc17('0xb9')][_0xdc17('0x114')](db[_0xdc17('0xbb')],{'as':_0xdc17('0x1b4'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0xb9')]['belongsTo'](db['FreshdeskAccount'],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xb9')][_0xdc17('0x124')](db['Tag'],{'through':_0xdc17('0x1c9')});db[_0xdc17('0xbb')][_0xdc17('0x114')](db[_0xdc17('0xbb')],{'as':_0xdc17('0x1bb'),'foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0xbb')][_0xdc17('0x114')](db[_0xdc17('0xbb')],{'as':_0xdc17('0x1c3'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0xbb')]['hasMany'](db[_0xdc17('0xbb')],{'as':'Field','foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0xbb')][_0xdc17('0x122')](db['Variable'],{'as':_0xdc17('0x1bd'),'foreignKey':_0xdc17('0x1be')});db[_0xdc17('0x1ca')][_0xdc17('0x114')](db[_0xdc17('0xbe')],{'as':_0xdc17('0x1b6'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1b7')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0xdc17('0x1c2'),'foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0xbe')][_0xdc17('0x114')](db[_0xdc17('0xc0')],{'as':_0xdc17('0x1b9'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0xbe')][_0xdc17('0x114')](db[_0xdc17('0xc0')],{'as':_0xdc17('0x1b4'),'foreignKey':_0xdc17('0x1ba')});db['VtigerConfiguration'][_0xdc17('0x122')](db[_0xdc17('0x1ca')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xc0')]['hasMany'](db['VtigerField'],{'as':_0xdc17('0x1bb'),'foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0xc0')]['hasMany'](db[_0xdc17('0xc0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xdc17('0xc0')]['hasMany'](db[_0xdc17('0xc0')],{'as':_0xdc17('0x1c4'),'foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0xc0')][_0xdc17('0x122')](db[_0xdc17('0x1bd')],{'as':_0xdc17('0x1bd'),'foreignKey':_0xdc17('0x1be')});db[_0xdc17('0x1cb')][_0xdc17('0x114')](db[_0xdc17('0xc3')],{'as':_0xdc17('0x1b6'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xc3')][_0xdc17('0x114')](db[_0xdc17('0xc4')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xdc17('0xc3')][_0xdc17('0x114')](db[_0xdc17('0xc4')],{'as':'Descriptions','foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0xc3')][_0xdc17('0x114')](db[_0xdc17('0xc4')],{'as':'Fields','foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0xc3')][_0xdc17('0x122')](db[_0xdc17('0x1cb')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xc4')]['hasMany'](db[_0xdc17('0xc4')],{'as':_0xdc17('0x1bb'),'foreignKey':_0xdc17('0x1b8')});db['ServicenowField'][_0xdc17('0x114')](db[_0xdc17('0xc4')],{'as':_0xdc17('0x1c3'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0xc4')][_0xdc17('0x114')](db[_0xdc17('0xc4')],{'as':'Field','foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0xc4')][_0xdc17('0x122')](db[_0xdc17('0x1bd')],{'as':_0xdc17('0x1bd'),'foreignKey':_0xdc17('0x1be')});db[_0xdc17('0xc6')][_0xdc17('0x114')](db[_0xdc17('0x1cc')],{'as':_0xdc17('0x1b6'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0x1cc')][_0xdc17('0x114')](db[_0xdc17('0x1cd')],{'as':_0xdc17('0x1c2'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1b8')});db['Dynamics365Configuration']['hasMany'](db[_0xdc17('0x1cd')],{'as':_0xdc17('0x1b9'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1bc')});db['Dynamics365Configuration'][_0xdc17('0x114')](db['Dynamics365Field'],{'as':_0xdc17('0x1b4'),'onDelete':_0xdc17('0x111'),'foreignKey':'FieldId'});db[_0xdc17('0x1cc')][_0xdc17('0x122')](db[_0xdc17('0xc6')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0x1cd')]['hasMany'](db[_0xdc17('0x1cd')],{'as':_0xdc17('0x1bb'),'foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0x1cd')]['hasMany'](db[_0xdc17('0x1cd')],{'as':_0xdc17('0x1c3'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0x1cd')][_0xdc17('0x114')](db[_0xdc17('0x1cd')],{'as':_0xdc17('0x1c4'),'foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0x1cd')][_0xdc17('0x122')](db[_0xdc17('0x1bd')],{'as':_0xdc17('0x1bd'),'foreignKey':_0xdc17('0x1be')});db['FreshsalesAccount'][_0xdc17('0x114')](db[_0xdc17('0xcb')],{'as':_0xdc17('0x1b6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xdc17('0xcb')]['hasMany'](db['FreshsalesField'],{'as':_0xdc17('0x1c2'),'foreignKey':_0xdc17('0x1b8')});db['FreshsalesConfiguration'][_0xdc17('0x114')](db[_0xdc17('0xcc')],{'as':_0xdc17('0x1b9'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0xdc17('0xcc')],{'as':_0xdc17('0x1b4'),'foreignKey':'FieldId'});db[_0xdc17('0xcb')][_0xdc17('0x122')](db[_0xdc17('0xc9')],{'as':'Account','foreignKey':_0xdc17('0x1b7')});db[_0xdc17('0xcc')]['hasMany'](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xdc17('0x1b8')});db[_0xdc17('0xcc')][_0xdc17('0x114')](db['FreshsalesField'],{'as':_0xdc17('0x1c3'),'foreignKey':_0xdc17('0x1bc')});db[_0xdc17('0xcc')]['hasMany'](db[_0xdc17('0xcc')],{'as':'Field','foreignKey':_0xdc17('0x1ba')});db[_0xdc17('0xcc')][_0xdc17('0x122')](db[_0xdc17('0x1bd')],{'as':'Variable','foreignKey':'VariableId'});db[_0xdc17('0xd0')][_0xdc17('0x122')](db[_0xdc17('0x61')],{});db[_0xdc17('0xd0')][_0xdc17('0x122')](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d')});db[_0xdc17('0xd0')]['belongsTo'](db['CmContact'],{'as':_0xdc17('0x17e'),'foreignKey':'ContactId'});db[_0xdc17('0xd0')][_0xdc17('0x122')](db[_0xdc17('0x66')],{});db['ChatQueueReport'][_0xdc17('0x122')](db[_0xdc17('0x68')],{});db[_0xdc17('0xd0')][_0xdc17('0x122')](db[_0xdc17('0x12')],{});db[_0xdc17('0xd0')][_0xdc17('0x122')](db[_0xdc17('0x6c')],{});db[_0xdc17('0xd2')]['belongsTo'](db['User'],{'onDelete':_0xdc17('0x111'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0xdc17('0x122')](db[_0xdc17('0x12')],{'onDelete':'cascade','foreignKey':_0xdc17('0x1ce')});db[_0xdc17('0xd5')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0xdc17('0x111')});db[_0xdc17('0xd5')][_0xdc17('0x114')](db[_0xdc17('0xd4')],{'foreignKey':_0xdc17('0x1cf'),'onDelete':'cascade'});db[_0xdc17('0xd7')]['belongsTo'](db['SmsAccount'],{});db[_0xdc17('0xd7')]['belongsTo'](db[_0xdc17('0x129')],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d')});db['SmsQueueReport'][_0xdc17('0x122')](db['CmContact'],{'as':_0xdc17('0x17e'),'foreignKey':_0xdc17('0x164')});db[_0xdc17('0xd7')][_0xdc17('0x122')](db['SmsInteraction'],{});db[_0xdc17('0xd7')]['belongsTo'](db[_0xdc17('0x54')],{});db['SmsQueueReport'][_0xdc17('0x122')](db[_0xdc17('0x12')],{});db[_0xdc17('0xd7')][_0xdc17('0x122')](db[_0xdc17('0x55')],{});db[_0xdc17('0x1d0')][_0xdc17('0x114')](db[_0xdc17('0xd5')],{'foreignKey':_0xdc17('0x1d1')});db[_0xdc17('0x1d0')][_0xdc17('0x114')](db['JscriptyQuestionReport'],{'foreignKey':_0xdc17('0x1d1')});db[_0xdc17('0x1d0')][_0xdc17('0x114')](db[_0xdc17('0xd4')],{'foreignKey':_0xdc17('0x1d1')});db[_0xdc17('0xe0')][_0xdc17('0x124')](db['User'],{'as':_0xdc17('0x175'),'through':_0xdc17('0x1d2')});db[_0xdc17('0xe3')]['belongsToMany'](db['User'],{'as':_0xdc17('0x15a'),'through':'user_has_teams'});db[_0xdc17('0xe3')][_0xdc17('0x124')](db[_0xdc17('0x1b')],{'through':_0xdc17('0x10d'),'as':'VoiceQueues'});db['Team'][_0xdc17('0x124')](db['MailQueue'],{'through':_0xdc17('0x16f'),'as':_0xdc17('0x134')});db[_0xdc17('0xe3')][_0xdc17('0x124')](db[_0xdc17('0x6c')],{'through':_0xdc17('0x197'),'as':_0xdc17('0x135')});db[_0xdc17('0xe3')][_0xdc17('0x124')](db[_0xdc17('0x4d')],{'through':_0xdc17('0x186'),'as':_0xdc17('0x137')});db[_0xdc17('0xe3')][_0xdc17('0x124')](db[_0xdc17('0x55')],{'through':_0xdc17('0x18d'),'as':_0xdc17('0x139')});db[_0xdc17('0xe3')][_0xdc17('0x124')](db[_0xdc17('0x5f')],{'through':'team_has_openchannel_queues','as':_0xdc17('0x13a')});db[_0xdc17('0xe3')][_0xdc17('0x124')](db['WhatsappQueue'],{'through':_0xdc17('0x1d3'),'as':_0xdc17('0x13b')});db[_0xdc17('0xe7')]['hasMany'](db['CmHopper'],{'as':_0xdc17('0x19b'),'foreignKey':_0xdc17('0x1a0')});db[_0xdc17('0xe7')]['hasMany'](db['CmHopperFinal'],{'as':_0xdc17('0x118'),'foreignKey':_0xdc17('0x1a0')});db[_0xdc17('0xe7')][_0xdc17('0x114')](db[_0xdc17('0x7b')],{'as':_0xdc17('0x19c'),'foreignKey':_0xdc17('0x1a0')});db[_0xdc17('0xe7')][_0xdc17('0x114')](db[_0xdc17('0x150')],{'as':_0xdc17('0x1d4'),'foreignKey':_0xdc17('0x1a0')});db[_0xdc17('0xe7')][_0xdc17('0x122')](db[_0xdc17('0x152')],{'as':_0xdc17('0x152'),'foreignKey':_0xdc17('0x1d5')});db[_0xdc17('0xe7')][_0xdc17('0x122')](db[_0xdc17('0x152')],{'as':_0xdc17('0x153'),'foreignKey':_0xdc17('0x154')});db[_0xdc17('0xe7')][_0xdc17('0x122')](db[_0xdc17('0x155')],{'as':_0xdc17('0x155'),'foreignKey':_0xdc17('0x17c')});db[_0xdc17('0xe7')]['belongsTo'](db[_0xdc17('0xe0')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xdc17('0xe7')][_0xdc17('0x124')](db[_0xdc17('0x129')],{'as':_0xdc17('0x12a'),'through':_0xdc17('0x1d6')});db['Campaign'][_0xdc17('0x124')](db[_0xdc17('0x129')],{'as':_0xdc17('0x15c'),'through':_0xdc17('0x1d7')});db['Attachment'][_0xdc17('0x122')](db[_0xdc17('0x6a')],{'as':_0xdc17('0x6a'),'foreignKey':_0xdc17('0x17a')});db[_0xdc17('0xef')][_0xdc17('0x122')](db[_0xdc17('0x3e')],{});db[_0xdc17('0xef')][_0xdc17('0x122')](db[_0xdc17('0x11f')],{});db[_0xdc17('0xef')]['belongsTo'](db[_0xdc17('0x37')],{'foreignKey':'FromMailAccountId','as':_0xdc17('0x1d8')});db[_0xdc17('0xef')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'foreignKey':'FromUserId','as':_0xdc17('0x1d9')});db[_0xdc17('0xef')][_0xdc17('0x122')](db['User'],{'foreignKey':_0xdc17('0x1da'),'as':_0xdc17('0x1db')});db[_0xdc17('0xef')]['belongsTo'](db[_0xdc17('0x39')],{'foreignKey':_0xdc17('0x1dc'),'as':'ToQueue'});db[_0xdc17('0xef')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xdc17('0x1dd'),'as':'ToAccount'});db['ChatTransferReport'][_0xdc17('0x122')](db[_0xdc17('0x68')],{});db[_0xdc17('0xf0')]['belongsTo'](db['ChatInteraction'],{});db[_0xdc17('0xf0')][_0xdc17('0x122')](db['ChatWebsite'],{'foreignKey':_0xdc17('0x1de'),'as':_0xdc17('0x1d8')});db[_0xdc17('0xf0')]['belongsTo'](db[_0xdc17('0x12')],{'foreignKey':_0xdc17('0x1df'),'as':'FromAgent'});db['ChatTransferReport'][_0xdc17('0x122')](db[_0xdc17('0x12')],{'foreignKey':_0xdc17('0x1da'),'as':_0xdc17('0x1db')});db[_0xdc17('0xf0')][_0xdc17('0x122')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0xdc17('0x1e0')});db[_0xdc17('0xf0')][_0xdc17('0x122')](db[_0xdc17('0x61')],{'foreignKey':_0xdc17('0x1e1'),'as':_0xdc17('0x1e2')});db[_0xdc17('0xf2')]['belongsTo'](db[_0xdc17('0x4b')],{});db[_0xdc17('0xf2')][_0xdc17('0x122')](db['FaxInteraction'],{});db['FaxTransferReport'][_0xdc17('0x122')](db[_0xdc17('0x47')],{'foreignKey':_0xdc17('0x1e3'),'as':_0xdc17('0x1d8')});db[_0xdc17('0xf2')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'foreignKey':_0xdc17('0x1df'),'as':_0xdc17('0x1d9')});db[_0xdc17('0xf2')]['belongsTo'](db[_0xdc17('0x12')],{'foreignKey':_0xdc17('0x1da'),'as':_0xdc17('0x1db')});db[_0xdc17('0xf2')][_0xdc17('0x122')](db[_0xdc17('0x4d')],{'foreignKey':_0xdc17('0x1e4'),'as':'ToQueue'});db[_0xdc17('0xf2')]['belongsTo'](db[_0xdc17('0x47')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0xdc17('0xf3')][_0xdc17('0x122')](db[_0xdc17('0x5d')],{});db['OpenchannelTransferReport'][_0xdc17('0x122')](db[_0xdc17('0x5b')],{});db[_0xdc17('0xf3')][_0xdc17('0x122')](db[_0xdc17('0x57')],{'foreignKey':_0xdc17('0x1e5'),'as':_0xdc17('0x1d8')});db[_0xdc17('0xf3')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'foreignKey':_0xdc17('0x1df'),'as':_0xdc17('0x1d9')});db[_0xdc17('0xf3')][_0xdc17('0x122')](db['User'],{'foreignKey':_0xdc17('0x1da'),'as':'ToAgent'});db[_0xdc17('0xf3')][_0xdc17('0x122')](db[_0xdc17('0x5f')],{'foreignKey':_0xdc17('0x1e6'),'as':'ToQueue'});db[_0xdc17('0xf3')][_0xdc17('0x122')](db[_0xdc17('0x57')],{'foreignKey':_0xdc17('0x1e7'),'as':'ToAccount'});db['SmsTransferReport'][_0xdc17('0x122')](db[_0xdc17('0x54')],{});db[_0xdc17('0x1e8')]['belongsTo'](db[_0xdc17('0x11c')],{});db['SmsTransferReport'][_0xdc17('0x122')](db[_0xdc17('0x51')],{'foreignKey':_0xdc17('0x1e9'),'as':_0xdc17('0x1d8')});db[_0xdc17('0x1e8')]['belongsTo'](db[_0xdc17('0x12')],{'foreignKey':_0xdc17('0x1df'),'as':_0xdc17('0x1d9')});db[_0xdc17('0x1e8')][_0xdc17('0x122')](db['User'],{'foreignKey':_0xdc17('0x1da'),'as':_0xdc17('0x1db')});db['SmsTransferReport'][_0xdc17('0x122')](db[_0xdc17('0x55')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0xdc17('0x1e8')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xdc17('0x1ea'),'as':'ToAccount'});db[_0xdc17('0x129')][_0xdc17('0x114')](db[_0xdc17('0x84')],{'as':_0xdc17('0x168'),'foreignKey':_0xdc17('0x17d')});db['CmList'][_0xdc17('0x114')](db[_0xdc17('0x7e')],{'as':'CustomFields','foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x129')][_0xdc17('0x114')](db[_0xdc17('0x74')],{'as':_0xdc17('0x127'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x129')][_0xdc17('0x114')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList'][_0xdc17('0x114')](db[_0xdc17('0x7b')],{'as':_0xdc17('0x119'),'foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x129')][_0xdc17('0x114')](db[_0xdc17('0x7c')],{'as':_0xdc17('0x7c'),'foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x129')]['belongsToMany'](db[_0xdc17('0x1b')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0xdc17('0x129')][_0xdc17('0x124')](db['User'],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x12b')});db[_0xdc17('0xf7')][_0xdc17('0x114')](db[_0xdc17('0x116')],{'as':_0xdc17('0x117'),'onDelete':_0xdc17('0x111')});db[_0xdc17('0xf7')][_0xdc17('0x124')](db['User'],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x13d')});db[_0xdc17('0xf9')]['hasMany'](db[_0xdc17('0x12')],{'as':_0xdc17('0x175'),'foreignKey':'userProfileId'});db[_0xdc17('0xf9')][_0xdc17('0x114')](db[_0xdc17('0x1eb')],{'as':_0xdc17('0x1ec'),'foreignKey':_0xdc17('0x123'),'onDelete':'cascade'});db[_0xdc17('0x1eb')][_0xdc17('0x114')](db[_0xdc17('0x1ed')],{'as':_0xdc17('0x1ee'),'foreignKey':_0xdc17('0x1ef'),'onDelete':_0xdc17('0x111')});db['WhatsappAccount']['hasMany'](db[_0xdc17('0x84')],{'as':_0xdc17('0x168'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xdc17('0x114')](db[_0xdc17('0x169')],{'as':'Answers','foreignKey':_0xdc17('0x1f0')});db[_0xdc17('0xfd')][_0xdc17('0x114')](db[_0xdc17('0x103')],{'as':_0xdc17('0x15d'),'foreignKey':_0xdc17('0x1f0')});db[_0xdc17('0xfd')][_0xdc17('0x114')](db[_0xdc17('0x101')],{'as':_0xdc17('0x16b')});db[_0xdc17('0xfd')][_0xdc17('0x114')](db[_0xdc17('0xff')],{'as':_0xdc17('0x14b')});db['WhatsappAccount']['belongsTo'](db['CmList'],{'as':_0xdc17('0x16c'),'foreignKey':'ListId'});db['WhatsappAccount'][_0xdc17('0x122')](db[_0xdc17('0x156')],{'as':_0xdc17('0x157'),'foreignKey':_0xdc17('0x158')});db['WhatsappAccount'][_0xdc17('0x124')](db['User'],{'as':'Agents','through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xdc17('0x122')](db['User'],{'onDelete':'restrict'});db[_0xdc17('0xff')]['belongsTo'](db[_0xdc17('0x107')],{'onDelete':_0xdc17('0x17b')});db[_0xdc17('0xff')][_0xdc17('0x122')](db[_0xdc17('0xfd')],{'onDelete':'restrict'});db[_0xdc17('0xff')][_0xdc17('0x122')](db['Interval'],{'onDelete':_0xdc17('0x17b'),'foreignKey':'IntervalId'});db[_0xdc17('0xff')]['belongsTo'](db[_0xdc17('0x90')],{'onDelete':_0xdc17('0x17b'),'foreignKey':_0xdc17('0x189')});db[_0xdc17('0x101')][_0xdc17('0x114')](db['WhatsappMessage'],{'as':_0xdc17('0x15d'),'onDelete':_0xdc17('0x111'),'foreignKey':_0xdc17('0x1f1')});db[_0xdc17('0x101')][_0xdc17('0x122')](db[_0xdc17('0xfd')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1f0')});db[_0xdc17('0x101')]['belongsTo'](db[_0xdc17('0x74')],{'as':_0xdc17('0x17e'),'foreignKey':_0xdc17('0x164')});db['WhatsappInteraction'][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':_0xdc17('0x171'),'foreignKey':_0xdc17('0x113')});db[_0xdc17('0x101')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0xdc17('0x101')][_0xdc17('0x124')](db[_0xdc17('0x90')],{'through':_0xdc17('0x1f2'),'as':_0xdc17('0x174')});db['WhatsappInteraction'][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':'Users','through':_0xdc17('0x131'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xdc17('0x122')](db[_0xdc17('0x12')],{'as':'User'});db['WhatsappMessage'][_0xdc17('0x122')](db[_0xdc17('0x74')],{'onDelete':_0xdc17('0x111'),'as':_0xdc17('0x17e')});db[_0xdc17('0x103')][_0xdc17('0x122')](db[_0xdc17('0x101')],{'onDelete':_0xdc17('0x111'),'as':_0xdc17('0x177'),'foreignKey':_0xdc17('0x1f1')});db[_0xdc17('0x103')][_0xdc17('0x122')](db[_0xdc17('0xfd')],{'as':_0xdc17('0x178'),'foreignKey':_0xdc17('0x1f0')});db[_0xdc17('0x1f3')][_0xdc17('0x122')](db[_0xdc17('0xfd')],{});db['WhatsappQueueReport'][_0xdc17('0x122')](db['CmList'],{'as':_0xdc17('0x16c'),'foreignKey':_0xdc17('0x17d')});db[_0xdc17('0x1f3')][_0xdc17('0x122')](db[_0xdc17('0x74')],{'as':_0xdc17('0x17e'),'foreignKey':'ContactId'});db[_0xdc17('0x1f3')][_0xdc17('0x122')](db[_0xdc17('0x101')],{});db[_0xdc17('0x1f3')][_0xdc17('0x122')](db[_0xdc17('0x107')],{});db[_0xdc17('0x1f3')][_0xdc17('0x122')](db[_0xdc17('0x103')],{});db[_0xdc17('0x1f3')]['belongsTo'](db[_0xdc17('0x12')],{});db['WhatsappTransferReport'][_0xdc17('0x122')](db[_0xdc17('0x103')],{});db[_0xdc17('0x1f4')][_0xdc17('0x122')](db[_0xdc17('0x101')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xdc17('0xfd')],{'foreignKey':_0xdc17('0x1f5'),'as':_0xdc17('0x1d8')});db['WhatsappTransferReport'][_0xdc17('0x122')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0xdc17('0x1e2')});db[_0xdc17('0x1f4')]['belongsTo'](db[_0xdc17('0x107')],{'foreignKey':_0xdc17('0x1f6'),'as':_0xdc17('0x1e0')});db['WhatsappTransferReport'][_0xdc17('0x122')](db['User'],{'foreignKey':_0xdc17('0x1df'),'as':_0xdc17('0x1d9')});db[_0xdc17('0x1f4')][_0xdc17('0x122')](db[_0xdc17('0x12')],{'foreignKey':_0xdc17('0x1da'),'as':_0xdc17('0x1db')});db[_0xdc17('0x107')][_0xdc17('0x124')](db[_0xdc17('0x12')],{'as':_0xdc17('0x15a'),'through':_0xdc17('0x32'),'foreignKey':'WhatsappQueueId'});db[_0xdc17('0x107')][_0xdc17('0x124')](db[_0xdc17('0xe3')],{'through':_0xdc17('0x1d3'),'as':_0xdc17('0x15b')});module[_0xdc17('0x1f7')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x6901=['MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/realtime/realtime.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','cascade','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Hoppers','VoiceQueueId','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','mandatoryDispositionPause','Teams','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsiteId','restrict','IntervalId','Items','Disposition','FaxAccountId','TagId','fax_interaction_has_tags','Tags','Interaction','FaxInteractionId','team_has_fax_queues','SmsAccountId','CannedAnswer','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','openchannel_interaction_has_tags','OpenchannelInteractionId','Agent','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','ChatOfflineMessageId','team_has_chat_queues','Members','CompanyId','OpenchannelInteractions','Company','cm_contact_has_tags','Queue','Campaign','CampaignId','OwnerId','Automation','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','Trigger','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','DefaultReportId','AnalyticMetric','MetricId','Configurations','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','VariableId','Subjects','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskField','VtigerConfiguration','FreshsalesField','FromId','ToId','SessionId','ProjectId','user_has_square_projects','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','FromAgent','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CmCustomField','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','WhatsappQueueId','exports','path','sequelize','lodash','defaultsDeep','xcall','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xC@LL1234','127.0.0.1','database','username','password','options','User','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelQueue','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/tag/tag.model','../api/template/template.model','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model'];(function(_0x2bc6de,_0x15013d){var _0x42d71b=function(_0x3c025f){while(--_0x3c025f){_0x2bc6de['push'](_0x2bc6de['shift']());}};_0x42d71b(++_0x15013d);}(_0x6901,0x100));var _0x1690=function(_0x2cea71,_0x360d29){_0x2cea71=_0x2cea71-0x0;var _0x169749=_0x6901[_0x2cea71];return _0x169749;};'use strict';var path=require(_0x1690('0x0'));var config=require('../config/environment');var Sequelize=require(_0x1690('0x1'));var _=require(_0x1690('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x1690('0x1')]=_[_0x1690('0x3')](config['sequelize'],{'database':'motion2','username':_0x1690('0x4'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x1690('0x5'),'dialectOptions':{'charset':_0x1690('0x6')},'logging':![],'timezone':timezone[_0x1690('0x7')](),'define':{'charset':_0x1690('0x8'),'collate':_0x1690('0x9')}}});config[_0x1690('0xa')]=_['defaultsDeep'](config[_0x1690('0xa')],{'database':_0x1690('0xb'),'username':_0x1690('0x4'),'password':_0x1690('0xc'),'options':{'host':_0x1690('0xd'),'port':0xcea,'dialect':_0x1690('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x1690('0x7')](),'define':{'charset':_0x1690('0x8'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1690('0x1')][_0x1690('0xe')],config[_0x1690('0x1')][_0x1690('0xf')],config[_0x1690('0x1')][_0x1690('0x10')],config[_0x1690('0x1')][_0x1690('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1690('0xa')][_0x1690('0xe')],config['sequelizeHistory'][_0x1690('0xf')],config[_0x1690('0xa')][_0x1690('0x10')],config['sequelizeHistory']['options'])};db[_0x1690('0x12')]=db['sequelize'][_0x1690('0x13')]('../api/user/user.model');db['VoiceChanSpy']=db[_0x1690('0x1')]['import'](_0x1690('0x14'));db[_0x1690('0x15')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x16'));db[_0x1690('0x17')]=db[_0x1690('0x1')]['import'](_0x1690('0x18'));db['VoiceMusicOnHold']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x19'));db[_0x1690('0x1a')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x1b'));db[_0x1690('0x1c')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x1d'));db[_0x1690('0x1e')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x1f'));db[_0x1690('0x20')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/voiceMail/voiceMail.model');db[_0x1690('0x21')]=db[_0x1690('0x1')]['import'](_0x1690('0x22'));db[_0x1690('0x23')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x1690('0x24')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x25'));db[_0x1690('0x26')]=db[_0x1690('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x1690('0x27')]=db['sequelize']['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0x1690('0x28')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x29'));db[_0x1690('0x2a')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/trunk/trunk.model');db[_0x1690('0x2b')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x2c'));db[_0x1690('0x2d')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x1690('0x2e')]=db[_0x1690('0x1')]['import'](_0x1690('0x2f'));db[_0x1690('0x30')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x31'));db[_0x1690('0x32')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x1690('0x33')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x34'));db['UserSmsQueue']=db['sequelize'][_0x1690('0x13')](_0x1690('0x35'));db[_0x1690('0x36')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x37'));db['UserWhatsappQueue']=db[_0x1690('0x1')][_0x1690('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x1690('0x38')]=db['sequelize']['import'](_0x1690('0x39'));db[_0x1690('0x3a')]=db['sequelize']['import'](_0x1690('0x3b'));db[_0x1690('0x3c')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x3d'));db[_0x1690('0x3e')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/mailQueue/mailQueue.model');db[_0x1690('0x3f')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x40'));db[_0x1690('0x41')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x42'));db[_0x1690('0x43')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x44'));db[_0x1690('0x45')]=db[_0x1690('0x1')]['import']('../api/mailApplication/mailApplication.model');db[_0x1690('0x46')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x47'));db['Dashboard']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x48'));db[_0x1690('0x49')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db[_0x1690('0x4a')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/faxAccount/faxAccount.model');db[_0x1690('0x4b')]=db[_0x1690('0x1')]['import'](_0x1690('0x4c'));db[_0x1690('0x4d')]=db['sequelize'][_0x1690('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x1690('0x4e')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x4f'));db[_0x1690('0x50')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x51'));db[_0x1690('0x52')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x53'));db[_0x1690('0x54')]=db[_0x1690('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x1690('0x55')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x56'));db[_0x1690('0x57')]=db[_0x1690('0x1')]['import'](_0x1690('0x58'));db[_0x1690('0x59')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/smsMessage/smsMessage.model');db[_0x1690('0x5a')]=db['sequelize'][_0x1690('0x13')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x1690('0x1')]['import'](_0x1690('0x5b'));db[_0x1690('0x5c')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x5d'));db[_0x1690('0x5e')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x1690('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0x1690('0x5f')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db['sequelize'][_0x1690('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x1690('0x60')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x61'));db[_0x1690('0x62')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x63'));db[_0x1690('0x64')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x65'));db[_0x1690('0x66')]=db['sequelize']['import']('../api/chatMessage/chatMessage.model');db[_0x1690('0x67')]=db[_0x1690('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x1690('0x68')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x69'));db['ChatGroup']=db[_0x1690('0x1')][_0x1690('0x13')]('../api/chatGroup/chatGroup.model');db[_0x1690('0x6a')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x1690('0x6b')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/cmCompany/cmCompany.model');db[_0x1690('0x6c')]=db['sequelize']['import'](_0x1690('0x6d'));db[_0x1690('0x6e')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x6f'));db[_0x1690('0x70')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x1690('0x71')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x72'));db['CmHopperHistory']=db['sequelize'][_0x1690('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x1690('0x73')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x74'));db['CmCustomField']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x75'));db[_0x1690('0x76')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x77'));db['Automation']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x78'));db['CannedAnswer']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x79'));db['Disposition']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x7a'));db[_0x1690('0x7b')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/condition/condition.model');db[_0x1690('0x7c')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x7d'));db[_0x1690('0x7e')]=db['sequelize'][_0x1690('0x13')]('../api/pause/pause.model');db['Cdr']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x7f'));db[_0x1690('0x80')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x81'));db[_0x1690('0x82')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/schedule/schedule.model');db[_0x1690('0x83')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/sound/sound.model');db['Tag']=db[_0x1690('0x1')]['import'](_0x1690('0x84'));db['Template']=db['sequelize'][_0x1690('0x13')](_0x1690('0x85'));db['Trigger']=db['sequelize'][_0x1690('0x13')](_0x1690('0x86'));db[_0x1690('0x87')]=db[_0x1690('0x1')]['import']('../api/variable/variable.model');db[_0x1690('0x88')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/integration/integration.model');db[_0x1690('0x89')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x8a'));db[_0x1690('0x8b')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x8c'));db[_0x1690('0x8d')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x1690('0x8e')]=db[_0x1690('0x1')]['import'](_0x1690('0x8f'));db['AnalyticMetric']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x90'));db[_0x1690('0x91')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x1690('0x92')]=db['sequelize'][_0x1690('0x13')](_0x1690('0x93'));db[_0x1690('0x94')]=db[_0x1690('0x1')]['import'](_0x1690('0x95'));db[_0x1690('0x96')]=db['sequelize']['import'](_0x1690('0x97'));db[_0x1690('0x98')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x99'));db['SugarcrmAccount']=db[_0x1690('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x1690('0x9a')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x9b'));db[_0x1690('0x9c')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x9d'));db[_0x1690('0x9e')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x9f'));db[_0x1690('0xa0')]=db['sequelize'][_0x1690('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x1690('0xa1')]=db[_0x1690('0x1')]['import'](_0x1690('0xa2'));db[_0x1690('0xa3')]=db['sequelize']['import'](_0x1690('0xa4'));db[_0x1690('0xa5')]=db['sequelize'][_0x1690('0x13')](_0x1690('0xa6'));db[_0x1690('0xa7')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xa8'));db[_0x1690('0xa9')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x1690('0xaa')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xab'));db[_0x1690('0xac')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xad'));db[_0x1690('0xae')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xaf'));db[_0x1690('0xb0')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xb1'));db['FreshdeskField']=db[_0x1690('0x1')]['import'](_0x1690('0xb2'));db[_0x1690('0xb3')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xb4'));db['VtigerConfiguration']=db[_0x1690('0x1')]['import'](_0x1690('0xb5'));db[_0x1690('0xb6')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xb7'));db[_0x1690('0xb8')]=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x1690('0xb9')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xba'));db[_0x1690('0xbb')]=db[_0x1690('0x1')]['import'](_0x1690('0xbc'));db[_0x1690('0xbd')]=db['sequelize'][_0x1690('0x13')](_0x1690('0xbe'));db[_0x1690('0xbf')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xc0'));db[_0x1690('0xc1')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xc2'));db[_0x1690('0xc3')]=db[_0x1690('0x1')]['import'](_0x1690('0xc4'));db[_0x1690('0xc5')]=db['sequelize'][_0x1690('0x13')](_0x1690('0xc6'));db['FreshsalesField']=db[_0x1690('0x1')][_0x1690('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x1690('0x88')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xc7'));db[_0x1690('0xc8')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xc9'));db[_0x1690('0xca')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xcb'));db[_0x1690('0xcc')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x1690('0xcd')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xce'));db[_0x1690('0xcf')]=db[_0x1690('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db['sequelize'][_0x1690('0x13')](_0x1690('0xd0'));db[_0x1690('0xd1')]=db['sequelize'][_0x1690('0x13')](_0x1690('0xd2'));db[_0x1690('0xd3')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xd4'));db[_0x1690('0xd5')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xd6'));db[_0x1690('0xd7')]=db[_0x1690('0x1')]['import'](_0x1690('0xd8'));db[_0x1690('0xd9')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/setting/setting.model');db[_0x1690('0xda')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xdb'));db[_0x1690('0xdc')]=db[_0x1690('0x1')]['import'](_0x1690('0xdd'));db['SquareRecording']=db[_0x1690('0x1')]['import'](_0x1690('0xde'));db[_0x1690('0xdf')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xe0'));db[_0x1690('0xe1')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xe2'));db[_0x1690('0xe3')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xe4'));db['Campaign']=db['sequelize'][_0x1690('0x13')](_0x1690('0xe5'));db[_0x1690('0xe6')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xe7'));db[_0x1690('0xe8')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xe9'));db[_0x1690('0xea')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xeb'));db[_0x1690('0xec')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xed'));db[_0x1690('0xee')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xef'));db['FaxTransferReport']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xf0'));db[_0x1690('0xf1')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x1690('0xf2')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xf3'));db[_0x1690('0xf4')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xf5'));db[_0x1690('0xf6')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xf7'));db[_0x1690('0xf8')]=db['sequelize'][_0x1690('0x13')](_0x1690('0xf9'));db[_0x1690('0xfa')]=db['sequelize'][_0x1690('0x13')](_0x1690('0xfb'));db['UserProfileResource']=db[_0x1690('0x1')][_0x1690('0x13')]('../api/userProfileResource/userProfileResource.model');db[_0x1690('0xfc')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/userNotification/userNotification.model');db[_0x1690('0xfd')]=db[_0x1690('0x1')][_0x1690('0x13')]('../api/whatsappAccount/whatsappAccount.model');db[_0x1690('0xfe')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0xff'));db[_0x1690('0x100')]=db['sequelize']['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x1690('0x101')]=db['sequelize'][_0x1690('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x1690('0x102')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x103'));db[_0x1690('0x104')]=db[_0x1690('0x1')]['import'](_0x1690('0x105'));db[_0x1690('0x106')]=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x107'));db[_0x1690('0x108')]=db[_0x1690('0x1')]['import']('../api/cloudProvider/cloudProvider.model');db['Realtime']=db[_0x1690('0x1')][_0x1690('0x13')](_0x1690('0x109'));db[_0x1690('0x10a')]=db[_0x1690('0x1')]['import'](_0x1690('0x10b'));db[_0x1690('0x12')][_0x1690('0x10c')](db[_0x1690('0x20')],{'as':_0x1690('0x20'),'onDelete':'cascade','foreignKey':_0x1690('0x10d')});db[_0x1690('0x12')][_0x1690('0x10e')](db[_0x1690('0x1c')],{'as':_0x1690('0x10f'),'foreignKey':'UserId'});db[_0x1690('0x12')][_0x1690('0x10e')](db[_0x1690('0x2d')],{'as':_0x1690('0x110'),'foreignKey':_0x1690('0x10d')});db['User'][_0x1690('0x10e')](db[_0x1690('0x17')],{'as':_0x1690('0x111'),'onDelete':'cascade','hooks':!![]});db['User'][_0x1690('0x10e')](db[_0x1690('0x71')],{'as':_0x1690('0x112'),'foreignKey':'UserId'});db['User'][_0x1690('0x10e')](db['CmHopperHistory'],{'as':_0x1690('0x113'),'foreignKey':_0x1690('0x10d')});db[_0x1690('0x12')]['hasMany'](db[_0x1690('0x73')],{'as':'ReportAgentPreview','foreignKey':_0x1690('0x10d')});db['User'][_0x1690('0x10e')](db[_0x1690('0x5e')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0x1690('0x12')][_0x1690('0x10e')](db[_0x1690('0x64')],{'as':_0x1690('0x114'),'foreignKey':_0x1690('0x10d')});db[_0x1690('0x12')]['hasMany'](db[_0x1690('0x57')],{'as':_0x1690('0x115'),'foreignKey':_0x1690('0x10d')});db[_0x1690('0x12')][_0x1690('0x10e')](db[_0x1690('0x4d')],{'as':_0x1690('0x116'),'foreignKey':_0x1690('0x10d')});db[_0x1690('0x12')][_0x1690('0x10e')](db[_0x1690('0x41')],{'as':_0x1690('0x117'),'foreignKey':_0x1690('0x10d')});db[_0x1690('0x12')][_0x1690('0x10e')](db[_0x1690('0x100')],{'as':'WhatsappInteractions','foreignKey':_0x1690('0x10d')});db[_0x1690('0x12')][_0x1690('0x10e')](db[_0x1690('0xfc')],{'as':_0x1690('0x118'),'foreignKey':'SenderId'});db[_0x1690('0x12')][_0x1690('0x119')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x1690('0x11a')});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x11c')],{'as':_0x1690('0x11d'),'through':_0x1690('0x11e')});db['User'][_0x1690('0x11b')](db[_0x1690('0x6c')],{'as':_0x1690('0x11f'),'through':_0x1690('0x120')});db[_0x1690('0x12')]['belongsToMany'](db['CmList'],{'as':'Lists','through':_0x1690('0x121')});db[_0x1690('0x12')][_0x1690('0x11b')](db['Team'],{'through':_0x1690('0x122')});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x41')],{'as':_0x1690('0x117'),'through':_0x1690('0x123')});db[_0x1690('0x12')]['belongsToMany'](db[_0x1690('0x64')],{'as':_0x1690('0x114'),'through':'user_has_chat_interactions'});db['User'][_0x1690('0x11b')](db[_0x1690('0x4d')],{'as':_0x1690('0x116'),'through':'user_has_fax_interactions'});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x57')],{'as':_0x1690('0x115'),'through':_0x1690('0x124')});db[_0x1690('0x12')][_0x1690('0x11b')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x1690('0x125')});db['User'][_0x1690('0x11b')](db[_0x1690('0x100')],{'as':'WhatsappInteractions','through':_0x1690('0x126')});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x1a')],{'as':_0x1690('0x127'),'through':'UserVoiceQueue','required':![]});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x3e')],{'as':_0x1690('0x128'),'through':_0x1690('0x32'),'required':![]});db['User'][_0x1690('0x11b')](db[_0x1690('0x68')],{'as':_0x1690('0x129'),'through':_0x1690('0x30'),'required':![],'hooks':!![]});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x50')],{'as':_0x1690('0x12a'),'through':_0x1690('0x33'),'required':![]});db['User'][_0x1690('0x11b')](db[_0x1690('0x5a')],{'as':_0x1690('0x12b'),'through':'UserSmsQueue','required':![]});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x5f')],{'as':_0x1690('0x12c'),'through':'UserOpenchannelQueue','required':![]});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x106')],{'as':_0x1690('0x12d'),'through':_0x1690('0x12e'),'required':![]});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0xf4')],{'through':_0x1690('0x121')});db['User'][_0x1690('0x11b')](db[_0x1690('0xf6')],{'as':_0x1690('0x12f'),'through':_0x1690('0x130'),'required':![]});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x131')],{'as':_0x1690('0x132'),'through':_0x1690('0x133')});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x4a')],{'as':_0x1690('0x134'),'through':_0x1690('0x135')});db['User']['belongsToMany'](db[_0x1690('0x3c')],{'as':_0x1690('0x136'),'through':_0x1690('0x137')});db[_0x1690('0x12')][_0x1690('0x11b')](db[_0x1690('0x138')],{'as':'OpenchannelAccounts','through':_0x1690('0x139')});db[_0x1690('0x12')][_0x1690('0x11b')](db['SmsAccount'],{'as':_0x1690('0x13a'),'through':_0x1690('0x13b')});db['User'][_0x1690('0x11b')](db[_0x1690('0xfd')],{'as':_0x1690('0x13c'),'through':_0x1690('0x13d')});db['User']['belongsToMany'](db['SquareProject'],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0x1690('0x13e')]['hasMany'](db[_0x1690('0x17')],{'as':_0x1690('0x13f'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x141')});db[_0x1690('0x15')][_0x1690('0x10e')](db[_0x1690('0x17')],{'onDelete':_0x1690('0x140')});db['VoiceExtension'][_0x1690('0x10e')](db[_0x1690('0x17')],{'as':_0x1690('0x142'),'onDelete':_0x1690('0x140')});db[_0x1690('0x143')][_0x1690('0x11b')](db[_0x1690('0x83')],{'as':_0x1690('0x144'),'through':_0x1690('0x145')});db[_0x1690('0x1a')][_0x1690('0x10e')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x1690('0x1a')][_0x1690('0x10e')](db[_0x1690('0x6e')],{'as':_0x1690('0x146'),'foreignKey':_0x1690('0x147')});db[_0x1690('0x1a')]['hasMany'](db[_0x1690('0x71')],{'as':'HopperFinals','foreignKey':_0x1690('0x147')});db[_0x1690('0x1a')][_0x1690('0x10e')](db[_0x1690('0x148')],{'as':_0x1690('0x149'),'foreignKey':_0x1690('0x147')});db[_0x1690('0x1a')][_0x1690('0x10e')](db['ReportAgentPreview'],{'as':_0x1690('0x73'),'foreignKey':_0x1690('0x147')});db[_0x1690('0x1a')][_0x1690('0x10e')](db[_0x1690('0x70')],{'as':_0x1690('0x14a'),'foreignKey':_0x1690('0x147')});db[_0x1690('0x1a')][_0x1690('0x10e')](db[_0x1690('0x14b')],{'as':_0x1690('0x14c'),'foreignKey':_0x1690('0x147')});db[_0x1690('0x1a')]['belongsTo'](db['Trunk'],{'as':_0x1690('0x2a'),'foreignKey':_0x1690('0x14d')});db[_0x1690('0x1a')]['belongsTo'](db[_0x1690('0x2a')],{'as':_0x1690('0x14e'),'foreignKey':'TrunkBackupId'});db[_0x1690('0x1a')]['belongsTo'](db[_0x1690('0x7c')],{'as':_0x1690('0x7c'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0x1690('0x119')](db[_0x1690('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':_0x1690('0x14f')});db[_0x1690('0x1a')][_0x1690('0x11b')](db['CmList'],{'as':_0x1690('0x150'),'through':_0x1690('0x151')});db[_0x1690('0x1a')]['belongsToMany'](db['User'],{'as':_0x1690('0x152'),'through':_0x1690('0x2e')});db[_0x1690('0x1a')][_0x1690('0x11b')](db[_0x1690('0xe1')],{'as':'Teams','through':_0x1690('0x10a')});db[_0x1690('0x1a')][_0x1690('0x11b')](db[_0x1690('0xf4')],{'as':'BlackLists','through':_0x1690('0x153')});db[_0x1690('0x1c')]['belongsTo'](db[_0x1690('0x12')],{'as':_0x1690('0x12'),'foreignKey':_0x1690('0x10d')});db[_0x1690('0x1e')][_0x1690('0x119')](db[_0x1690('0x12')],{'as':'User','foreignKey':_0x1690('0x10d')});db[_0x1690('0x20')]['hasMany'](db[_0x1690('0x21')],{'as':_0x1690('0x154'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x155'),'sourceKey':'mailbox'});db[_0x1690('0x21')][_0x1690('0x119')](db['VoiceMail'],{'foreignKey':_0x1690('0x155'),'targetKey':_0x1690('0x156')});db[_0x1690('0x23')][_0x1690('0x10e')](db[_0x1690('0x27')],{'as':_0x1690('0x157'),'foreignKey':_0x1690('0x158'),'constraints':![]});db[_0x1690('0x23')][_0x1690('0x10e')](db['VoiceAgentReport'],{'as':_0x1690('0x159'),'foreignKey':_0x1690('0x158'),'constraints':![]});db[_0x1690('0x23')]['belongsTo'](db[_0x1690('0x12')],{'as':_0x1690('0x12'),'foreignKey':_0x1690('0x10d')});db['VoiceCallReport'][_0x1690('0x119')](db[_0x1690('0x6c')],{'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b')});db[_0x1690('0x38')][_0x1690('0x119')](db[_0x1690('0x3c')],{'as':'MailAccount','foreignKey':_0x1690('0x15c')});db[_0x1690('0x3a')][_0x1690('0x119')](db[_0x1690('0x3c')],{'as':_0x1690('0x3c'),'foreignKey':_0x1690('0x15c')});db[_0x1690('0x3c')][_0x1690('0x10c')](db[_0x1690('0x38')],{'as':_0x1690('0x15d'),'onDelete':_0x1690('0x140')});db['MailAccount'][_0x1690('0x10c')](db[_0x1690('0x3a')],{'as':_0x1690('0x15e'),'onDelete':'cascade'});db[_0x1690('0x3c')][_0x1690('0x10e')](db['Disposition'],{'as':_0x1690('0x15f'),'foreignKey':_0x1690('0x15c')});db[_0x1690('0x3c')][_0x1690('0x10e')](db['CannedAnswer'],{'as':_0x1690('0x160'),'foreignKey':_0x1690('0x15c')});db[_0x1690('0x3c')][_0x1690('0x10e')](db[_0x1690('0x43')],{'as':_0x1690('0x154'),'foreignKey':_0x1690('0x15c')});db['MailAccount']['hasMany'](db[_0x1690('0x41')],{'as':_0x1690('0x161')});db[_0x1690('0x3c')][_0x1690('0x10e')](db[_0x1690('0x45')],{'as':_0x1690('0x142')});db[_0x1690('0x3c')][_0x1690('0x119')](db[_0x1690('0xf4')],{'as':_0x1690('0x162'),'foreignKey':_0x1690('0x163')});db[_0x1690('0x3c')][_0x1690('0x119')](db[_0x1690('0x164')],{'as':_0x1690('0x164'),'foreignKey':'TemplateId'});db[_0x1690('0x3c')]['belongsTo'](db[_0x1690('0x7e')],{'as':_0x1690('0x165'),'foreignKey':_0x1690('0x14f')});db[_0x1690('0x3c')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':_0x1690('0x137')});db[_0x1690('0x3e')]['belongsToMany'](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':'UserMailQueue'});db[_0x1690('0x3e')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':_0x1690('0x166')});db[_0x1690('0x41')][_0x1690('0x10e')](db[_0x1690('0x43')],{'as':_0x1690('0x154'),'onDelete':'cascade','foreignKey':_0x1690('0x167')});db[_0x1690('0x41')][_0x1690('0x119')](db[_0x1690('0x3c')],{'as':_0x1690('0x168'),'foreignKey':'MailAccountId'});db[_0x1690('0x41')]['belongsTo'](db[_0x1690('0x6c')],{'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b')});db[_0x1690('0x41')][_0x1690('0x119')](db[_0x1690('0x12')],{'as':_0x1690('0x169'),'foreignKey':_0x1690('0x10d')});db[_0x1690('0x41')][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':'mail_interaction_has_tags','as':'Tags'});db['MailInteraction'][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':_0x1690('0x16b'),'as':_0x1690('0x16c')});db[_0x1690('0x41')]['belongsToMany'](db[_0x1690('0x12')],{'as':_0x1690('0x16d'),'through':_0x1690('0x123'),'foreignKey':_0x1690('0x167')});db[_0x1690('0x43')][_0x1690('0x10e')](db['Attachment'],{'as':_0x1690('0x16e'),'onDelete':_0x1690('0x140')});db[_0x1690('0x43')][_0x1690('0x119')](db[_0x1690('0x12')],{'as':_0x1690('0x12')});db[_0x1690('0x43')][_0x1690('0x119')](db[_0x1690('0x6c')],{'onDelete':_0x1690('0x140'),'as':'Contact'});db[_0x1690('0x43')][_0x1690('0x119')](db[_0x1690('0x41')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x1690('0x43')][_0x1690('0x119')](db[_0x1690('0x3c')],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x15c')});db['MailMessage'][_0x1690('0x119')](db[_0x1690('0x131')],{'as':_0x1690('0x131'),'foreignKey':_0x1690('0x16f')});db[_0x1690('0x43')][_0x1690('0x119')](db[_0x1690('0x67')],{'as':_0x1690('0x67'),'foreignKey':'ChatOfflineMessageId'});db[_0x1690('0x45')]['belongsTo'](db[_0x1690('0x12')],{'onDelete':'restrict'});db[_0x1690('0x45')]['belongsTo'](db[_0x1690('0x3e')],{'onDelete':_0x1690('0x170')});db[_0x1690('0x45')][_0x1690('0x119')](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication'][_0x1690('0x119')](db['Interval'],{'onDelete':_0x1690('0x170'),'foreignKey':_0x1690('0x171')});db[_0x1690('0x45')][_0x1690('0x119')](db[_0x1690('0x16a')],{'onDelete':_0x1690('0x170'),'foreignKey':'TagId'});db[_0x1690('0x46')][_0x1690('0x119')](db['MailAccount'],{});db[_0x1690('0x46')][_0x1690('0x119')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b')});db['MailQueueReport']['belongsTo'](db[_0x1690('0x41')],{});db[_0x1690('0x46')]['belongsTo'](db[_0x1690('0x43')],{});db['MailQueueReport']['belongsTo'](db[_0x1690('0x12')],{});db[_0x1690('0x46')][_0x1690('0x119')](db[_0x1690('0x3e')],{});db['Dashboard'][_0x1690('0x10e')](db[_0x1690('0x49')],{'as':_0x1690('0x172'),'onDelete':_0x1690('0x140')});db[_0x1690('0x4a')][_0x1690('0x10e')](db[_0x1690('0x173')],{'as':_0x1690('0x15f'),'foreignKey':_0x1690('0x174')});db[_0x1690('0x4a')][_0x1690('0x10e')](db['CannedAnswer'],{'as':_0x1690('0x160'),'foreignKey':'FaxAccountId'});db[_0x1690('0x4a')]['hasMany'](db[_0x1690('0x4d')],{'as':'Interactions'});db[_0x1690('0x4a')]['hasMany'](db[_0x1690('0x4b')],{'as':_0x1690('0x142')});db['FaxAccount'][_0x1690('0x10e')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0x1690('0x140')});db[_0x1690('0x4a')][_0x1690('0x10e')](db['FaxMessage'],{'as':'Messages'});db[_0x1690('0x4a')]['belongsTo'](db[_0x1690('0x2a')],{'as':'Trunk'});db[_0x1690('0x4a')][_0x1690('0x119')](db[_0x1690('0xf4')],{'as':_0x1690('0x162'),'foreignKey':'ListId'});db[_0x1690('0x4a')][_0x1690('0x119')](db['Pause'],{'as':_0x1690('0x165'),'foreignKey':_0x1690('0x14f')});db[_0x1690('0x4a')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x1690('0x4b')][_0x1690('0x119')](db['User'],{'onDelete':_0x1690('0x170')});db[_0x1690('0x4b')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x1690('0x170')});db[_0x1690('0x4b')][_0x1690('0x119')](db[_0x1690('0x4a')],{'onDelete':_0x1690('0x170')});db[_0x1690('0x4b')][_0x1690('0x119')](db[_0x1690('0x16a')],{'onDelete':_0x1690('0x170'),'foreignKey':_0x1690('0x175')});db[_0x1690('0x4d')][_0x1690('0x10e')](db[_0x1690('0x4e')],{'as':_0x1690('0x154'),'onDelete':_0x1690('0x140'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x1690('0x119')](db['FaxAccount'],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x174')});db['FaxInteraction']['belongsTo'](db[_0x1690('0x6c')],{'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b')});db[_0x1690('0x4d')]['belongsTo'](db[_0x1690('0x12')],{'as':'Owner','foreignKey':_0x1690('0x10d')});db['FaxInteraction'][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':_0x1690('0x176'),'as':_0x1690('0x177')});db[_0x1690('0x4d')][_0x1690('0x11b')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x1690('0x16c')});db[_0x1690('0x4d')]['belongsToMany'](db['User'],{'as':_0x1690('0x16d'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0x1690('0x12')],{'onDelete':_0x1690('0x140'),'as':_0x1690('0x12')});db[_0x1690('0x4e')]['belongsTo'](db[_0x1690('0x4d')],{'as':_0x1690('0x178'),'foreignKey':_0x1690('0x179')});db[_0x1690('0x4e')][_0x1690('0x119')](db[_0x1690('0x6c')],{'onDelete':'cascade','as':'Contact'});db['FaxMessage']['belongsTo'](db[_0x1690('0xe8')],{'as':_0x1690('0xe8'),'foreignKey':'AttachmentId'});db[_0x1690('0x4e')][_0x1690('0x119')](db[_0x1690('0x4a')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x1690('0x50')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':'UserFaxQueue'});db[_0x1690('0x50')]['belongsToMany'](db[_0x1690('0xe1')],{'through':_0x1690('0x17a'),'as':'Teams'});db[_0x1690('0x52')][_0x1690('0x119')](db[_0x1690('0x4a')],{});db[_0x1690('0x52')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x1690('0x52')][_0x1690('0x119')](db[_0x1690('0x6c')],{'as':'Contact','foreignKey':_0x1690('0x15b')});db[_0x1690('0x52')]['belongsTo'](db[_0x1690('0x4d')],{});db['FaxQueueReport'][_0x1690('0x119')](db['FaxMessage'],{});db['FaxQueueReport'][_0x1690('0x119')](db[_0x1690('0x12')],{});db['FaxQueueReport'][_0x1690('0x119')](db[_0x1690('0x50')],{});db[_0x1690('0x54')][_0x1690('0x10e')](db[_0x1690('0x173')],{'as':_0x1690('0x15f'),'foreignKey':_0x1690('0x17b')});db[_0x1690('0x54')][_0x1690('0x10e')](db[_0x1690('0x17c')],{'as':_0x1690('0x160'),'foreignKey':'SmsAccountId'});db[_0x1690('0x54')][_0x1690('0x10e')](db[_0x1690('0x59')],{'as':_0x1690('0x154'),'foreignKey':'SmsAccountId'});db[_0x1690('0x54')][_0x1690('0x10e')](db[_0x1690('0x57')],{'as':_0x1690('0x161')});db[_0x1690('0x54')][_0x1690('0x10e')](db[_0x1690('0x55')],{'as':_0x1690('0x142')});db[_0x1690('0x54')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x1690('0x54')][_0x1690('0x119')](db[_0x1690('0x7e')],{'as':_0x1690('0x165'),'foreignKey':_0x1690('0x14f')});db[_0x1690('0x54')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x1690('0x55')][_0x1690('0x119')](db['User'],{'onDelete':'restrict'});db[_0x1690('0x55')][_0x1690('0x119')](db[_0x1690('0x5a')],{'onDelete':_0x1690('0x170')});db[_0x1690('0x55')][_0x1690('0x119')](db[_0x1690('0x54')],{'onDelete':'restrict'});db[_0x1690('0x55')][_0x1690('0x119')](db[_0x1690('0x7c')],{'onDelete':_0x1690('0x170'),'foreignKey':_0x1690('0x171')});db[_0x1690('0x55')][_0x1690('0x119')](db[_0x1690('0x16a')],{'onDelete':_0x1690('0x170'),'foreignKey':_0x1690('0x175')});db[_0x1690('0x57')][_0x1690('0x10e')](db[_0x1690('0x59')],{'as':_0x1690('0x154'),'onDelete':'cascade','foreignKey':_0x1690('0x17d')});db[_0x1690('0x57')][_0x1690('0x119')](db[_0x1690('0x54')],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x17b')});db[_0x1690('0x57')][_0x1690('0x119')](db['CmContact'],{'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b')});db[_0x1690('0x57')][_0x1690('0x119')](db[_0x1690('0x12')],{'as':_0x1690('0x169'),'foreignKey':'UserId'});db['SmsInteraction'][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':_0x1690('0x17e'),'as':'Tags'});db[_0x1690('0x57')][_0x1690('0x11b')](db['Tag'],{'through':_0x1690('0x17e'),'as':_0x1690('0x16c')});db[_0x1690('0x57')]['belongsToMany'](db['User'],{'as':_0x1690('0x16d'),'through':_0x1690('0x124'),'foreignKey':_0x1690('0x17d')});db[_0x1690('0x59')][_0x1690('0x119')](db[_0x1690('0x12')],{'as':_0x1690('0x12')});db['SmsMessage'][_0x1690('0x119')](db[_0x1690('0x6c')],{'onDelete':_0x1690('0x140'),'as':_0x1690('0x15a')});db['SmsMessage'][_0x1690('0x119')](db['SmsInteraction'],{'onDelete':_0x1690('0x140'),'as':_0x1690('0x178'),'foreignKey':_0x1690('0x17d')});db['SmsMessage'][_0x1690('0x119')](db[_0x1690('0x54')],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x17b')});db[_0x1690('0x5a')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':'UserSmsQueue','foreignKey':_0x1690('0x17f')});db['SmsQueue']['belongsToMany'](db[_0x1690('0xe1')],{'through':_0x1690('0x180'),'as':_0x1690('0x166')});db[_0x1690('0x138')][_0x1690('0x10e')](db['Disposition'],{'as':_0x1690('0x15f'),'foreignKey':_0x1690('0x181')});db[_0x1690('0x138')][_0x1690('0x10e')](db[_0x1690('0x17c')],{'as':_0x1690('0x160'),'foreignKey':_0x1690('0x181')});db[_0x1690('0x138')][_0x1690('0x10e')](db['OpenchannelInteraction'],{'as':_0x1690('0x161'),'foreignKey':_0x1690('0x181')});db[_0x1690('0x138')][_0x1690('0x10e')](db[_0x1690('0x182')],{'as':_0x1690('0x154'),'foreignKey':_0x1690('0x181')});db['OpenchannelAccount'][_0x1690('0x10e')](db[_0x1690('0x5c')],{'as':_0x1690('0x142'),'foreignKey':_0x1690('0x181')});db[_0x1690('0x138')]['belongsTo'](db['CmList'],{'as':_0x1690('0x162'),'foreignKey':_0x1690('0x163')});db[_0x1690('0x138')][_0x1690('0x119')](db['Pause'],{'as':_0x1690('0x165'),'foreignKey':_0x1690('0x14f')});db[_0x1690('0x138')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':_0x1690('0x139')});db['OpenchannelApplication'][_0x1690('0x119')](db['User'],{'onDelete':'restrict'});db['OpenchannelApplication'][_0x1690('0x119')](db[_0x1690('0x5f')],{'onDelete':_0x1690('0x170'),'foreignKey':'OpenchannelQueueId'});db[_0x1690('0x5c')][_0x1690('0x119')](db[_0x1690('0x138')],{'onDelete':_0x1690('0x170'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication']['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x1690('0x171')});db[_0x1690('0x5c')]['belongsTo'](db[_0x1690('0x16a')],{'onDelete':_0x1690('0x170'),'foreignKey':_0x1690('0x175')});db[_0x1690('0x5e')]['hasMany'](db[_0x1690('0x182')],{'as':_0x1690('0x154'),'onDelete':_0x1690('0x140'),'foreignKey':'OpenchannelInteractionId'});db[_0x1690('0x5e')][_0x1690('0x119')](db[_0x1690('0x138')],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x181')});db[_0x1690('0x5e')][_0x1690('0x119')](db[_0x1690('0x6c')],{'as':'Contact','foreignKey':_0x1690('0x15b')});db['OpenchannelInteraction'][_0x1690('0x119')](db[_0x1690('0x12')],{'as':_0x1690('0x169'),'foreignKey':'UserId'});db[_0x1690('0x5e')]['belongsToMany'](db[_0x1690('0x16a')],{'through':_0x1690('0x183'),'as':_0x1690('0x177')});db['OpenchannelInteraction'][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':'openchannel_interaction_has_tags','as':_0x1690('0x16c')});db['OpenchannelInteraction'][_0x1690('0x11b')](db['User'],{'as':_0x1690('0x16d'),'through':_0x1690('0x125'),'foreignKey':_0x1690('0x184')});db['OpenchannelMessage'][_0x1690('0x119')](db[_0x1690('0x12')],{'onDelete':_0x1690('0x140'),'as':_0x1690('0x12')});db[_0x1690('0x182')]['belongsTo'](db[_0x1690('0x6c')],{'onDelete':'cascade','as':'Contact'});db[_0x1690('0x182')]['belongsTo'](db[_0x1690('0x5e')],{'onDelete':'cascade','as':_0x1690('0x178'),'foreignKey':_0x1690('0x184')});db['OpenchannelMessage'][_0x1690('0x119')](db['Attachment'],{'as':_0x1690('0xe8'),'foreignKey':'AttachmentId'});db[_0x1690('0x182')]['belongsTo'](db[_0x1690('0x138')],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x181')});db['OpenchannelQueue'][_0x1690('0x11b')](db['User'],{'as':_0x1690('0x152'),'through':_0x1690('0x36'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x1690('0x11b')](db[_0x1690('0xe1')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x1690('0x131')][_0x1690('0x10e')](db['Disposition'],{'as':_0x1690('0x15f'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x1690('0x10e')](db[_0x1690('0x17c')],{'as':_0x1690('0x160'),'foreignKey':_0x1690('0x16f')});db[_0x1690('0x131')][_0x1690('0x10e')](db[_0x1690('0x6a')],{'as':'ProactiveActions'});db[_0x1690('0x131')][_0x1690('0x10e')](db[_0x1690('0x64')],{'as':'Interactions'});db[_0x1690('0x131')]['hasMany'](db[_0x1690('0x62')],{'as':_0x1690('0x142')});db[_0x1690('0x131')][_0x1690('0x10e')](db['ChatMessage'],{'as':_0x1690('0x154')});db[_0x1690('0x131')]['belongsTo'](db[_0x1690('0xf4')],{'as':_0x1690('0x162'),'foreignKey':'ListId'});db[_0x1690('0x131')][_0x1690('0x119')](db[_0x1690('0x7c')],{'as':_0x1690('0x7c'),'foreignKey':'IntervalId'});db[_0x1690('0x131')][_0x1690('0x119')](db[_0x1690('0x3c')],{'as':'MailAccount','foreignKey':_0x1690('0x15c')});db[_0x1690('0x131')][_0x1690('0x119')](db[_0x1690('0x7e')],{'as':_0x1690('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1690('0x131')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':_0x1690('0x133')});db[_0x1690('0x60')][_0x1690('0x119')](db['OpenchannelAccount'],{});db[_0x1690('0x60')][_0x1690('0x119')](db['CmList'],{'as':_0x1690('0x162'),'foreignKey':_0x1690('0x163')});db['OpenchannelQueueReport']['belongsTo'](db[_0x1690('0x6c')],{'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b')});db[_0x1690('0x60')][_0x1690('0x119')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x1690('0x119')](db[_0x1690('0x182')],{});db[_0x1690('0x60')][_0x1690('0x119')](db[_0x1690('0x12')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x1690('0x5f')],{});db[_0x1690('0x62')][_0x1690('0x119')](db[_0x1690('0x12')],{'as':_0x1690('0x185'),'foreignKey':_0x1690('0x10d'),'onDelete':_0x1690('0x170')});db[_0x1690('0x62')][_0x1690('0x119')](db['ChatQueue'],{'as':'Queue','foreignKey':_0x1690('0x186'),'onDelete':_0x1690('0x170')});db[_0x1690('0x62')]['belongsTo'](db[_0x1690('0x131')],{'as':_0x1690('0x187'),'foreignKey':'ChatWebsiteId','onDelete':_0x1690('0x170')});db[_0x1690('0x62')]['belongsTo'](db[_0x1690('0x16a')],{'onDelete':_0x1690('0x170'),'foreignKey':_0x1690('0x175')});db[_0x1690('0x64')][_0x1690('0x10e')](db[_0x1690('0x66')],{'as':_0x1690('0x154'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x1690('0x64')][_0x1690('0x119')](db[_0x1690('0x131')],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x16f')});db[_0x1690('0x64')][_0x1690('0x119')](db[_0x1690('0x6c')],{'as':_0x1690('0x15a'),'foreignKey':'ContactId'});db[_0x1690('0x64')][_0x1690('0x119')](db[_0x1690('0x12')],{'as':_0x1690('0x169'),'foreignKey':_0x1690('0x10d')});db[_0x1690('0x64')][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':'chat_interaction_has_tags','as':_0x1690('0x177')});db[_0x1690('0x64')][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':_0x1690('0x188'),'as':_0x1690('0x16c')});db['ChatInteraction'][_0x1690('0x11b')](db['User'],{'as':_0x1690('0x16d'),'through':_0x1690('0x189'),'foreignKey':_0x1690('0x18a')});db[_0x1690('0x66')]['belongsTo'](db['User'],{'onDelete':_0x1690('0x140'),'as':_0x1690('0x12')});db[_0x1690('0x66')][_0x1690('0x119')](db[_0x1690('0x6c')],{'onDelete':'cascade','as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b')});db[_0x1690('0x66')][_0x1690('0x119')](db[_0x1690('0x64')],{'onDelete':_0x1690('0x140'),'as':_0x1690('0x178'),'foreignKey':_0x1690('0x18a')});db['ChatMessage'][_0x1690('0x119')](db[_0x1690('0xe8')],{'as':_0x1690('0xe8'),'foreignKey':'AttachmentId'});db[_0x1690('0x66')][_0x1690('0x119')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x1690('0x16f')});db[_0x1690('0x67')][_0x1690('0x10e')](db[_0x1690('0xe8')],{'as':_0x1690('0x16e'),'foreignKey':_0x1690('0x18b'),'onDelete':'cascade','hooks':!![]});db[_0x1690('0x67')][_0x1690('0x119')](db[_0x1690('0x6c')],{'onDelete':_0x1690('0x140'),'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b')});db[_0x1690('0x67')][_0x1690('0x119')](db['ChatWebsite'],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x16f')});db[_0x1690('0x68')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':'UserChatQueue','hooks':!![]});db[_0x1690('0x68')][_0x1690('0x11b')](db['Team'],{'through':_0x1690('0x18c'),'as':'Teams'});db['ChatGroup'][_0x1690('0x10e')](db[_0x1690('0xcc')],{'as':_0x1690('0x154'),'foreignKey':'ChatGroupId','onDelete':_0x1690('0x140')});db[_0x1690('0x11c')]['belongsToMany'](db['User'],{'as':_0x1690('0x18d'),'through':_0x1690('0x11e')});db[_0x1690('0x6a')][_0x1690('0x119')](db[_0x1690('0x131')],{'as':_0x1690('0x187'),'foreignKey':'ChatWebsiteId'});db[_0x1690('0x6b')]['hasMany'](db[_0x1690('0x6c')],{'as':_0x1690('0x11f'),'foreignKey':_0x1690('0x18e')});db['CmContact']['hasMany'](db[_0x1690('0x6e')],{'as':_0x1690('0x146'),'foreignKey':_0x1690('0x15b')});db['CmContact']['hasMany'](db[_0x1690('0x71')],{'as':_0x1690('0x112'),'foreignKey':_0x1690('0x15b')});db['CmContact'][_0x1690('0x10e')](db[_0x1690('0x148')],{'as':_0x1690('0x149'),'foreignKey':_0x1690('0x15b')});db[_0x1690('0x6c')][_0x1690('0x10e')](db[_0x1690('0x73')],{'as':'ReportAgentPreview','foreignKey':_0x1690('0x15b')});db['CmContact'][_0x1690('0x10e')](db[_0x1690('0x14b')],{'as':_0x1690('0x14c'),'foreignKey':'ContactId'});db[_0x1690('0x6c')][_0x1690('0x10e')](db['OpenchannelInteraction'],{'as':_0x1690('0x18f'),'foreignKey':_0x1690('0x15b'),'onDelete':_0x1690('0x170')});db[_0x1690('0x6c')]['hasMany'](db['ChatInteraction'],{'as':_0x1690('0x114'),'foreignKey':_0x1690('0x15b'),'onDelete':_0x1690('0x170')});db[_0x1690('0x6c')][_0x1690('0x10e')](db[_0x1690('0x57')],{'as':_0x1690('0x115'),'foreignKey':_0x1690('0x15b'),'onDelete':_0x1690('0x170')});db[_0x1690('0x6c')][_0x1690('0x10e')](db[_0x1690('0x4d')],{'as':_0x1690('0x116'),'foreignKey':'ContactId','onDelete':_0x1690('0x170')});db[_0x1690('0x6c')]['hasMany'](db['MailInteraction'],{'as':_0x1690('0x117'),'foreignKey':_0x1690('0x15b'),'onDelete':_0x1690('0x170')});db[_0x1690('0x6c')][_0x1690('0x119')](db[_0x1690('0x6b')],{'as':_0x1690('0x190'),'foreignKey':_0x1690('0x18e')});db[_0x1690('0x6c')][_0x1690('0x119')](db[_0x1690('0xf4')],{'as':_0x1690('0x162'),'foreignKey':_0x1690('0x163'),'onDelete':_0x1690('0x140')});db['CmContact'][_0x1690('0x11b')](db['User'],{'as':_0x1690('0x16d'),'through':_0x1690('0x120')});db['CmContact'][_0x1690('0x11b')](db[_0x1690('0x16a')],{'as':_0x1690('0x177'),'through':_0x1690('0x191')});db[_0x1690('0x6c')][_0x1690('0x11b')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x1690('0x16c')});db['CmHopper'][_0x1690('0x119')](db[_0x1690('0x6c')],{'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b'),'onDelete':_0x1690('0x140')});db[_0x1690('0x6e')][_0x1690('0x119')](db[_0x1690('0xf4')],{'as':_0x1690('0x162'),'foreignKey':_0x1690('0x163'),'onDelete':_0x1690('0x140')});db['CmHopper'][_0x1690('0x119')](db[_0x1690('0x12')],{'as':'Agent','foreignKey':'UserId'});db[_0x1690('0x6e')][_0x1690('0x119')](db[_0x1690('0x1a')],{'as':_0x1690('0x192'),'foreignKey':_0x1690('0x147'),'onDelete':_0x1690('0x140')});db['CmHopper']['belongsTo'](db[_0x1690('0x193')],{'as':_0x1690('0x193'),'foreignKey':_0x1690('0x194'),'onDelete':_0x1690('0x140')});db[_0x1690('0x6e')]['belongsTo'](db['User'],{'as':_0x1690('0x169'),'foreignKey':_0x1690('0x195')});db[_0x1690('0x70')][_0x1690('0x119')](db['CmContact'],{'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b'),'onDelete':_0x1690('0x140')});db['CmHopperBlack'][_0x1690('0x119')](db['CmList'],{'as':_0x1690('0x162'),'foreignKey':_0x1690('0x163'),'onDelete':_0x1690('0x140')});db['CmHopperBlack'][_0x1690('0x119')](db[_0x1690('0x1a')],{'as':'Queue','foreignKey':_0x1690('0x147'),'onDelete':'cascade'});db[_0x1690('0x70')]['belongsTo'](db[_0x1690('0x193')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x1690('0x140')});db[_0x1690('0x196')]['hasMany'](db[_0x1690('0x7b')],{'as':{'plural':'All','singular':_0x1690('0x197')},'foreignKey':_0x1690('0x198'),'onDelete':_0x1690('0x140'),'hooks':!![]});db[_0x1690('0x196')][_0x1690('0x10e')](db[_0x1690('0x7b')],{'as':{'plural':_0x1690('0x199'),'singular':'OneAny'},'foreignKey':_0x1690('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0x1690('0x196')]['hasMany'](db[_0x1690('0x76')],{'as':_0x1690('0x19b'),'foreignKey':'AutomationId','onDelete':_0x1690('0x140'),'hooks':!![]});db[_0x1690('0x173')][_0x1690('0x10e')](db['Disposition'],{'as':_0x1690('0x15f'),'foreignKey':_0x1690('0x19c'),'onDelete':_0x1690('0x140')});db['Interval'][_0x1690('0x10e')](db[_0x1690('0x7c')],{'as':_0x1690('0x19d'),'foreignKey':'IntervalId','onDelete':_0x1690('0x140'),'hooks':!![],'required':![]});db[_0x1690('0x7c')][_0x1690('0x10e')](db[_0x1690('0x17')],{'as':'Extensions','foreignKey':_0x1690('0x171'),'onDelete':_0x1690('0x170')});db[_0x1690('0x7c')]['hasMany'](db[_0x1690('0x45')],{'as':_0x1690('0x19e'),'foreignKey':'IntervalId'});db[_0x1690('0x7c')][_0x1690('0x10e')](db[_0x1690('0x62')],{'as':_0x1690('0x19f'),'foreignKey':'IntervalId'});db[_0x1690('0x7c')][_0x1690('0x10e')](db['FaxApplication'],{'as':_0x1690('0x1a0'),'foreignKey':_0x1690('0x171')});db[_0x1690('0x7c')][_0x1690('0x10e')](db['SmsApplication'],{'as':_0x1690('0x1a1'),'foreignKey':'IntervalId'});db['Schedule'][_0x1690('0x119')](db[_0x1690('0x3c')],{});db[_0x1690('0x82')][_0x1690('0x119')](db[_0x1690('0x8d')],{'foreignKey':'DefaultReportId'});db[_0x1690('0x82')][_0x1690('0x119')](db[_0x1690('0x8b')],{'foreignKey':_0x1690('0x1a2')});db[_0x1690('0x83')]['belongsToMany'](db[_0x1690('0x143')],{'as':_0x1690('0x1a3'),'through':_0x1690('0x145'),'onDelete':'restrict'});db[_0x1690('0x16a')][_0x1690('0x11b')](db[_0x1690('0x6c')],{'through':_0x1690('0x191')});db['Tag'][_0x1690('0x11b')](db['ChatInteraction'],{'through':_0x1690('0x188')});db[_0x1690('0x16a')][_0x1690('0x11b')](db['MailInteraction'],{'through':_0x1690('0x16b')});db[_0x1690('0x16a')][_0x1690('0x11b')](db[_0x1690('0x57')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x1690('0x11b')](db[_0x1690('0x4d')],{'through':_0x1690('0x176')});db[_0x1690('0x16a')][_0x1690('0x11b')](db[_0x1690('0x5e')],{'through':_0x1690('0x183')});db[_0x1690('0x16a')][_0x1690('0x11b')](db[_0x1690('0x100')],{'through':_0x1690('0x1a4')});db['Trigger'][_0x1690('0x10e')](db[_0x1690('0x7b')],{'as':{'plural':_0x1690('0x1a5'),'singular':_0x1690('0x1a6')},'foreignKey':_0x1690('0x1a7'),'onDelete':_0x1690('0x140'),'hooks':!![]});db[_0x1690('0x1a8')][_0x1690('0x10e')](db[_0x1690('0x7b')],{'as':{'plural':_0x1690('0x1a9'),'singular':_0x1690('0x1aa')},'foreignKey':_0x1690('0x1ab'),'onDelete':_0x1690('0x140'),'hooks':!![]});db[_0x1690('0x1a8')][_0x1690('0x10e')](db['Action'],{'as':_0x1690('0x19b'),'foreignKey':_0x1690('0x1ac'),'onDelete':_0x1690('0x140'),'hooks':!![]});db[_0x1690('0x8b')][_0x1690('0x10e')](db['AnalyticFieldReport'],{'as':_0x1690('0x1ad'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1a2'),'hooks':!![]});db[_0x1690('0x8d')][_0x1690('0x10e')](db[_0x1690('0x91')],{'as':_0x1690('0x1ad'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1ae')});db[_0x1690('0x1af')][_0x1690('0x10e')](db[_0x1690('0x91')],{'as':_0x1690('0x1ad'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b0')});db[_0x1690('0x91')][_0x1690('0x119')](db[_0x1690('0x1af')],{'foreignKey':_0x1690('0x1b0')});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':_0x1690('0x1b1'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1690('0x96')][_0x1690('0x10e')](db[_0x1690('0x98')],{'as':'Subjects','onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b2')});db[_0x1690('0x96')][_0x1690('0x10e')](db[_0x1690('0x98')],{'as':_0x1690('0x1b3'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b4')});db[_0x1690('0x96')][_0x1690('0x10e')](db[_0x1690('0x98')],{'as':_0x1690('0x1ad'),'onDelete':'cascade','foreignKey':_0x1690('0x1b5')});db[_0x1690('0x96')][_0x1690('0x119')](db['SalesforceAccount'],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x1b6')});db['SalesforceField'][_0x1690('0x10e')](db['SalesforceField'],{'as':_0x1690('0x1b7'),'foreignKey':_0x1690('0x1b2')});db[_0x1690('0x98')][_0x1690('0x10e')](db[_0x1690('0x98')],{'as':_0x1690('0x1b8'),'foreignKey':_0x1690('0x1b4')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x1690('0x1b9'),'foreignKey':'FieldId'});db[_0x1690('0x98')][_0x1690('0x119')](db['Variable'],{'as':_0x1690('0x87'),'foreignKey':_0x1690('0x1ba')});db['SugarcrmAccount'][_0x1690('0x10e')](db[_0x1690('0x9a')],{'as':_0x1690('0x1b1'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b6')});db[_0x1690('0x9a')]['hasMany'](db[_0x1690('0x9c')],{'as':'Subjects','onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b2')});db[_0x1690('0x9a')][_0x1690('0x10e')](db[_0x1690('0x9c')],{'as':'Descriptions','onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b4')});db[_0x1690('0x9a')][_0x1690('0x10e')](db[_0x1690('0x9c')],{'as':_0x1690('0x1ad'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b5')});db['SugarcrmConfiguration'][_0x1690('0x119')](db['SugarcrmAccount'],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x1b6')});db[_0x1690('0x9c')]['hasMany'](db['SugarcrmField'],{'as':_0x1690('0x1b7'),'foreignKey':_0x1690('0x1b2')});db['SugarcrmField']['hasMany'](db[_0x1690('0x9c')],{'as':_0x1690('0x1b8'),'foreignKey':_0x1690('0x1b4')});db[_0x1690('0x9c')][_0x1690('0x10e')](db[_0x1690('0x9c')],{'as':_0x1690('0x1b9'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0x9c')]['belongsTo'](db[_0x1690('0x87')],{'as':_0x1690('0x87'),'foreignKey':_0x1690('0x1ba')});db[_0x1690('0x9e')][_0x1690('0x10e')](db[_0x1690('0xa0')],{'as':_0x1690('0x1b1'),'onDelete':_0x1690('0x140'),'foreignKey':'AccountId'});db[_0x1690('0xa0')][_0x1690('0x10e')](db[_0x1690('0xa1')],{'as':_0x1690('0x1bb'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b2')});db['DeskConfiguration']['hasMany'](db[_0x1690('0xa1')],{'as':_0x1690('0x1b3'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b4')});db[_0x1690('0xa0')]['hasMany'](db['DeskField'],{'as':_0x1690('0x1ad'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x1690('0xa0')][_0x1690('0x119')](db[_0x1690('0x9e')],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x1b6')});db[_0x1690('0xa0')][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':_0x1690('0x1bc')});db[_0x1690('0xa1')][_0x1690('0x10e')](db['DeskField'],{'as':_0x1690('0x1b7'),'foreignKey':_0x1690('0x1b2')});db[_0x1690('0xa1')]['hasMany'](db['DeskField'],{'as':'Description','foreignKey':_0x1690('0x1b4')});db[_0x1690('0xa1')]['hasMany'](db[_0x1690('0xa1')],{'as':_0x1690('0x1b9'),'foreignKey':'FieldId'});db[_0x1690('0xa1')]['belongsTo'](db[_0x1690('0x87')],{'as':_0x1690('0x87'),'foreignKey':_0x1690('0x1ba')});db[_0x1690('0xa3')]['hasMany'](db[_0x1690('0xa5')],{'as':_0x1690('0x1b1'),'onDelete':'cascade','foreignKey':_0x1690('0x1b6')});db[_0x1690('0xa5')]['hasMany'](db[_0x1690('0xa7')],{'as':_0x1690('0x1bb'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b2')});db[_0x1690('0xa5')][_0x1690('0x10e')](db[_0x1690('0xa7')],{'as':_0x1690('0x1b3'),'onDelete':'cascade','foreignKey':_0x1690('0x1b4')});db[_0x1690('0xa5')][_0x1690('0x10e')](db[_0x1690('0xa7')],{'as':_0x1690('0x1ad'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0xa5')]['belongsTo'](db['ZohoAccount'],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x1b6')});db[_0x1690('0xa7')][_0x1690('0x10e')](db[_0x1690('0xa7')],{'as':_0x1690('0x1b7'),'foreignKey':_0x1690('0x1b2')});db[_0x1690('0xa7')]['hasMany'](db['ZohoField'],{'as':_0x1690('0x1b8'),'foreignKey':_0x1690('0x1b4')});db[_0x1690('0xa7')][_0x1690('0x10e')](db[_0x1690('0xa7')],{'as':_0x1690('0x1b9'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0xa7')][_0x1690('0x119')](db[_0x1690('0x87')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1690('0xa9')]['hasMany'](db[_0x1690('0xaa')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1690('0x1b6')});db[_0x1690('0xaa')]['hasMany'](db[_0x1690('0xac')],{'as':_0x1690('0x1bb'),'foreignKey':_0x1690('0x1b2')});db[_0x1690('0xaa')][_0x1690('0x10e')](db[_0x1690('0xac')],{'as':_0x1690('0x1b3'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0x1690('0xac')],{'as':_0x1690('0x1ad'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0xaa')][_0x1690('0x119')](db[_0x1690('0xa9')],{'as':'Account','foreignKey':_0x1690('0x1b6')});db[_0x1690('0xaa')][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':_0x1690('0x1bd')});db[_0x1690('0xac')]['hasMany'](db[_0x1690('0xac')],{'as':'Subject','foreignKey':_0x1690('0x1b2')});db[_0x1690('0xac')][_0x1690('0x10e')](db['ZendeskField'],{'as':_0x1690('0x1b8'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x1690('0x10e')](db[_0x1690('0xac')],{'as':_0x1690('0x1b9'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0xac')]['belongsTo'](db[_0x1690('0x87')],{'as':_0x1690('0x87'),'foreignKey':_0x1690('0x1ba')});db[_0x1690('0xae')][_0x1690('0x10e')](db[_0x1690('0xb0')],{'as':'Configurations','onDelete':_0x1690('0x140'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x1690('0x10e')](db[_0x1690('0x1be')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x1690('0x1b2')});db[_0x1690('0xb0')][_0x1690('0x10e')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b4')});db[_0x1690('0xb0')][_0x1690('0x10e')](db[_0x1690('0x1be')],{'as':_0x1690('0x1ad'),'onDelete':'cascade','foreignKey':_0x1690('0x1b5')});db[_0x1690('0xb0')][_0x1690('0x119')](db['FreshdeskAccount'],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x1b6')});db['FreshdeskConfiguration'][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x1690('0x1be')][_0x1690('0x10e')](db[_0x1690('0x1be')],{'as':'Subject','foreignKey':_0x1690('0x1b2')});db['FreshdeskField']['hasMany'](db[_0x1690('0x1be')],{'as':_0x1690('0x1b8'),'foreignKey':'DescriptionId'});db[_0x1690('0x1be')][_0x1690('0x10e')](db['FreshdeskField'],{'as':_0x1690('0x1b9'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0x1be')][_0x1690('0x119')](db[_0x1690('0x87')],{'as':_0x1690('0x87'),'foreignKey':_0x1690('0x1ba')});db[_0x1690('0xb3')][_0x1690('0x10e')](db[_0x1690('0x1bf')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1690('0x1b6')});db[_0x1690('0x1bf')][_0x1690('0x10e')](db[_0x1690('0xb6')],{'as':_0x1690('0x1bb'),'foreignKey':'SubjectId'});db[_0x1690('0x1bf')]['hasMany'](db[_0x1690('0xb6')],{'as':_0x1690('0x1b3'),'foreignKey':_0x1690('0x1b4')});db['VtigerConfiguration'][_0x1690('0x10e')](db[_0x1690('0xb6')],{'as':'Fields','foreignKey':_0x1690('0x1b5')});db[_0x1690('0x1bf')][_0x1690('0x119')](db[_0x1690('0xb3')],{'as':'Account','foreignKey':_0x1690('0x1b6')});db[_0x1690('0xb6')][_0x1690('0x10e')](db[_0x1690('0xb6')],{'as':_0x1690('0x1b7'),'foreignKey':'SubjectId'});db[_0x1690('0xb6')][_0x1690('0x10e')](db[_0x1690('0xb6')],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0x1690('0x10e')](db['VtigerField'],{'as':_0x1690('0x1b9'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0xb6')][_0x1690('0x119')](db[_0x1690('0x87')],{'as':'Variable','foreignKey':_0x1690('0x1ba')});db[_0x1690('0xb8')][_0x1690('0x10e')](db[_0x1690('0xb9')],{'as':_0x1690('0x1b1'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b6')});db[_0x1690('0xb9')][_0x1690('0x10e')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0x1690('0x1b2')});db['ServicenowConfiguration'][_0x1690('0x10e')](db['ServicenowField'],{'as':_0x1690('0x1b3'),'foreignKey':_0x1690('0x1b4')});db['ServicenowConfiguration'][_0x1690('0x10e')](db[_0x1690('0xbb')],{'as':'Fields','foreignKey':_0x1690('0x1b5')});db[_0x1690('0xb9')][_0x1690('0x119')](db[_0x1690('0xb8')],{'as':'Account','foreignKey':_0x1690('0x1b6')});db['ServicenowField'][_0x1690('0x10e')](db[_0x1690('0xbb')],{'as':'Subject','foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x1690('0x1b8'),'foreignKey':_0x1690('0x1b4')});db[_0x1690('0xbb')][_0x1690('0x10e')](db[_0x1690('0xbb')],{'as':_0x1690('0x1b9'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0xbb')]['belongsTo'](db[_0x1690('0x87')],{'as':_0x1690('0x87'),'foreignKey':_0x1690('0x1ba')});db[_0x1690('0xbd')][_0x1690('0x10e')](db['Dynamics365Configuration'],{'as':_0x1690('0x1b1'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1690('0xbf')]['hasMany'](db['Dynamics365Field'],{'as':_0x1690('0x1bb'),'onDelete':'cascade','foreignKey':_0x1690('0x1b2')});db[_0x1690('0xbf')][_0x1690('0x10e')](db['Dynamics365Field'],{'as':_0x1690('0x1b3'),'onDelete':_0x1690('0x140'),'foreignKey':'DescriptionId'});db[_0x1690('0xbf')][_0x1690('0x10e')](db[_0x1690('0xc1')],{'as':_0x1690('0x1ad'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0xbf')][_0x1690('0x119')](db[_0x1690('0xbd')],{'as':_0x1690('0x168'),'foreignKey':'AccountId'});db[_0x1690('0xc1')][_0x1690('0x10e')](db['Dynamics365Field'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x1690('0xc1')]['hasMany'](db['Dynamics365Field'],{'as':_0x1690('0x1b8'),'foreignKey':_0x1690('0x1b4')});db['Dynamics365Field'][_0x1690('0x10e')](db[_0x1690('0xc1')],{'as':_0x1690('0x1b9'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0xc1')]['belongsTo'](db[_0x1690('0x87')],{'as':_0x1690('0x87'),'foreignKey':_0x1690('0x1ba')});db[_0x1690('0xc3')][_0x1690('0x10e')](db[_0x1690('0xc5')],{'as':_0x1690('0x1b1'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1b6')});db[_0x1690('0xc5')][_0x1690('0x10e')](db[_0x1690('0x1c0')],{'as':_0x1690('0x1bb'),'foreignKey':_0x1690('0x1b2')});db[_0x1690('0xc5')][_0x1690('0x10e')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x1690('0x1b4')});db[_0x1690('0xc5')][_0x1690('0x10e')](db[_0x1690('0x1c0')],{'as':_0x1690('0x1ad'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0xc5')][_0x1690('0x119')](db[_0x1690('0xc3')],{'as':_0x1690('0x168'),'foreignKey':_0x1690('0x1b6')});db[_0x1690('0x1c0')]['hasMany'](db[_0x1690('0x1c0')],{'as':_0x1690('0x1b7'),'foreignKey':_0x1690('0x1b2')});db['FreshsalesField'][_0x1690('0x10e')](db[_0x1690('0x1c0')],{'as':'Description','foreignKey':_0x1690('0x1b4')});db[_0x1690('0x1c0')][_0x1690('0x10e')](db[_0x1690('0x1c0')],{'as':_0x1690('0x1b9'),'foreignKey':_0x1690('0x1b5')});db[_0x1690('0x1c0')][_0x1690('0x119')](db[_0x1690('0x87')],{'as':_0x1690('0x87'),'foreignKey':_0x1690('0x1ba')});db[_0x1690('0xca')][_0x1690('0x119')](db[_0x1690('0x131')],{});db[_0x1690('0xca')][_0x1690('0x119')](db[_0x1690('0xf4')],{'as':_0x1690('0x162'),'foreignKey':_0x1690('0x163')});db[_0x1690('0xca')][_0x1690('0x119')](db[_0x1690('0x6c')],{'as':'Contact','foreignKey':_0x1690('0x15b')});db[_0x1690('0xca')][_0x1690('0x119')](db[_0x1690('0x64')],{});db[_0x1690('0xca')][_0x1690('0x119')](db[_0x1690('0x66')],{});db[_0x1690('0xca')]['belongsTo'](db[_0x1690('0x12')],{});db['ChatQueueReport'][_0x1690('0x119')](db[_0x1690('0x68')],{});db[_0x1690('0xcc')][_0x1690('0x119')](db['User'],{'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1c1')});db['ChatInternalMessage'][_0x1690('0x119')](db[_0x1690('0x12')],{'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1c2')});db['JscriptySessionReport']['hasMany'](db[_0x1690('0xcf')],{'foreignKey':_0x1690('0x1c3'),'onDelete':_0x1690('0x140')});db[_0x1690('0x14b')]['hasMany'](db[_0x1690('0xcd')],{'foreignKey':_0x1690('0x1c3'),'onDelete':_0x1690('0x140')});db[_0x1690('0xd1')][_0x1690('0x119')](db[_0x1690('0x54')],{});db[_0x1690('0xd1')][_0x1690('0x119')](db['CmList'],{'as':'List','foreignKey':_0x1690('0x163')});db[_0x1690('0xd1')][_0x1690('0x119')](db[_0x1690('0x6c')],{'as':_0x1690('0x15a'),'foreignKey':'ContactId'});db[_0x1690('0xd1')]['belongsTo'](db['SmsInteraction'],{});db[_0x1690('0xd1')][_0x1690('0x119')](db['SmsMessage'],{});db[_0x1690('0xd1')][_0x1690('0x119')](db['User'],{});db[_0x1690('0xd1')][_0x1690('0x119')](db[_0x1690('0x5a')],{});db[_0x1690('0xd7')][_0x1690('0x10e')](db[_0x1690('0x14b')],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0x1690('0xcf')],{'foreignKey':_0x1690('0x1c4')});db[_0x1690('0xd7')][_0x1690('0x10e')](db[_0x1690('0xcd')],{'foreignKey':_0x1690('0x1c4')});db[_0x1690('0xdc')][_0x1690('0x11b')](db['User'],{'as':'Users','through':_0x1690('0x1c5')});db[_0x1690('0xe1')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':_0x1690('0x122')});db[_0x1690('0xe1')]['belongsToMany'](db[_0x1690('0x1a')],{'through':_0x1690('0x10a'),'as':_0x1690('0x127')});db[_0x1690('0xe1')]['belongsToMany'](db[_0x1690('0x3e')],{'through':'team_has_mail_queues','as':_0x1690('0x128')});db[_0x1690('0xe1')]['belongsToMany'](db[_0x1690('0x68')],{'through':_0x1690('0x18c'),'as':'ChatQueues'});db[_0x1690('0xe1')]['belongsToMany'](db[_0x1690('0x50')],{'through':'team_has_fax_queues','as':_0x1690('0x12a')});db['Team']['belongsToMany'](db[_0x1690('0x5a')],{'through':_0x1690('0x180'),'as':_0x1690('0x12b')});db[_0x1690('0xe1')][_0x1690('0x11b')](db[_0x1690('0x5f')],{'through':'team_has_openchannel_queues','as':_0x1690('0x12c')});db[_0x1690('0xe1')][_0x1690('0x11b')](db[_0x1690('0x106')],{'through':_0x1690('0x1c6'),'as':'WhatsappQueues'});db['Campaign']['hasMany'](db['CmHopper'],{'as':_0x1690('0x146'),'foreignKey':'CampaignId'});db[_0x1690('0x193')][_0x1690('0x10e')](db[_0x1690('0x71')],{'as':_0x1690('0x112'),'foreignKey':'CampaignId'});db[_0x1690('0x193')][_0x1690('0x10e')](db[_0x1690('0x148')],{'as':_0x1690('0x149'),'foreignKey':_0x1690('0x194')});db[_0x1690('0x193')]['hasMany'](db[_0x1690('0x70')],{'as':_0x1690('0x14a'),'foreignKey':_0x1690('0x194')});db[_0x1690('0x193')]['belongsTo'](db[_0x1690('0x2a')],{'as':_0x1690('0x2a'),'foreignKey':_0x1690('0x14d')});db[_0x1690('0x193')][_0x1690('0x119')](db[_0x1690('0x2a')],{'as':'TrunkBackup','foreignKey':_0x1690('0x1c7')});db[_0x1690('0x193')][_0x1690('0x119')](db[_0x1690('0x7c')],{'as':_0x1690('0x7c'),'foreignKey':_0x1690('0x171')});db['Campaign'][_0x1690('0x119')](db['SquareProject'],{'as':_0x1690('0xdc'),'foreignKey':_0x1690('0x1c8')});db[_0x1690('0x193')][_0x1690('0x11b')](db['CmList'],{'as':_0x1690('0x150'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0x1690('0x11b')](db[_0x1690('0xf4')],{'as':_0x1690('0x1c9'),'through':_0x1690('0x1ca')});db[_0x1690('0xe8')][_0x1690('0x119')](db[_0x1690('0x67')],{'as':_0x1690('0x67'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport']['belongsTo'](db['MailMessage'],{});db[_0x1690('0xec')]['belongsTo'](db[_0x1690('0x41')],{});db[_0x1690('0xec')][_0x1690('0x119')](db[_0x1690('0x3c')],{'foreignKey':_0x1690('0x1cb'),'as':_0x1690('0x1cc')});db[_0x1690('0xec')][_0x1690('0x119')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db['MailTransferReport'][_0x1690('0x119')](db[_0x1690('0x12')],{'foreignKey':_0x1690('0x1cd'),'as':_0x1690('0x1ce')});db[_0x1690('0xec')]['belongsTo'](db[_0x1690('0x3e')],{'foreignKey':_0x1690('0x1cf'),'as':_0x1690('0x1d0')});db['MailTransferReport'][_0x1690('0x119')](db[_0x1690('0x3c')],{'foreignKey':_0x1690('0x1d1'),'as':_0x1690('0x1d2')});db['ChatTransferReport'][_0x1690('0x119')](db[_0x1690('0x66')],{});db['ChatTransferReport'][_0x1690('0x119')](db[_0x1690('0x64')],{});db['ChatTransferReport'][_0x1690('0x119')](db[_0x1690('0x131')],{'foreignKey':_0x1690('0x1d3'),'as':_0x1690('0x1cc')});db['ChatTransferReport'][_0x1690('0x119')](db['User'],{'foreignKey':_0x1690('0x1d4'),'as':'FromAgent'});db[_0x1690('0xee')][_0x1690('0x119')](db[_0x1690('0x12')],{'foreignKey':_0x1690('0x1cd'),'as':_0x1690('0x1ce')});db[_0x1690('0xee')][_0x1690('0x119')](db[_0x1690('0x68')],{'foreignKey':_0x1690('0x1d5'),'as':_0x1690('0x1d0')});db[_0x1690('0xee')][_0x1690('0x119')](db[_0x1690('0x131')],{'foreignKey':_0x1690('0x1d6'),'as':_0x1690('0x1d2')});db[_0x1690('0x1d7')][_0x1690('0x119')](db[_0x1690('0x4e')],{});db[_0x1690('0x1d7')][_0x1690('0x119')](db[_0x1690('0x4d')],{});db[_0x1690('0x1d7')][_0x1690('0x119')](db[_0x1690('0x4a')],{'foreignKey':_0x1690('0x1d8'),'as':'FromAccount'});db[_0x1690('0x1d7')]['belongsTo'](db['User'],{'foreignKey':_0x1690('0x1d4'),'as':_0x1690('0x1d9')});db[_0x1690('0x1d7')][_0x1690('0x119')](db[_0x1690('0x12')],{'foreignKey':_0x1690('0x1cd'),'as':_0x1690('0x1ce')});db['FaxTransferReport'][_0x1690('0x119')](db[_0x1690('0x50')],{'foreignKey':_0x1690('0x1da'),'as':_0x1690('0x1d0')});db[_0x1690('0x1d7')][_0x1690('0x119')](db[_0x1690('0x4a')],{'foreignKey':_0x1690('0x1db'),'as':_0x1690('0x1d2')});db[_0x1690('0xf1')]['belongsTo'](db[_0x1690('0x182')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x1690('0x5e')],{});db[_0x1690('0xf1')][_0x1690('0x119')](db[_0x1690('0x138')],{'foreignKey':_0x1690('0x1dc'),'as':_0x1690('0x1cc')});db['OpenchannelTransferReport'][_0x1690('0x119')](db['User'],{'foreignKey':_0x1690('0x1d4'),'as':_0x1690('0x1d9')});db[_0x1690('0xf1')][_0x1690('0x119')](db[_0x1690('0x12')],{'foreignKey':_0x1690('0x1cd'),'as':_0x1690('0x1ce')});db['OpenchannelTransferReport'][_0x1690('0x119')](db[_0x1690('0x5f')],{'foreignKey':_0x1690('0x1dd'),'as':_0x1690('0x1d0')});db[_0x1690('0xf1')]['belongsTo'](db[_0x1690('0x138')],{'foreignKey':_0x1690('0x1de'),'as':_0x1690('0x1d2')});db[_0x1690('0xf2')][_0x1690('0x119')](db[_0x1690('0x59')],{});db[_0x1690('0xf2')]['belongsTo'](db[_0x1690('0x57')],{});db[_0x1690('0xf2')]['belongsTo'](db[_0x1690('0x54')],{'foreignKey':_0x1690('0x1df'),'as':_0x1690('0x1cc')});db[_0x1690('0xf2')][_0x1690('0x119')](db[_0x1690('0x12')],{'foreignKey':_0x1690('0x1d4'),'as':_0x1690('0x1d9')});db[_0x1690('0xf2')][_0x1690('0x119')](db['User'],{'foreignKey':_0x1690('0x1cd'),'as':_0x1690('0x1ce')});db[_0x1690('0xf2')][_0x1690('0x119')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x1690('0x1d0')});db[_0x1690('0xf2')]['belongsTo'](db[_0x1690('0x54')],{'foreignKey':_0x1690('0x1e0'),'as':_0x1690('0x1d2')});db['CmList'][_0x1690('0x10e')](db[_0x1690('0x173')],{'as':_0x1690('0x15f'),'foreignKey':_0x1690('0x163')});db[_0x1690('0xf4')][_0x1690('0x10e')](db[_0x1690('0x1e1')],{'as':'CustomFields','foreignKey':_0x1690('0x163')});db[_0x1690('0xf4')][_0x1690('0x10e')](db[_0x1690('0x6c')],{'as':_0x1690('0x11f'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x163')});db[_0x1690('0xf4')][_0x1690('0x10e')](db[_0x1690('0x71')],{'as':_0x1690('0x112'),'foreignKey':_0x1690('0x163')});db[_0x1690('0xf4')]['hasMany'](db['CmHopperHistory'],{'as':_0x1690('0x113'),'foreignKey':_0x1690('0x163')});db['CmList']['hasMany'](db[_0x1690('0x73')],{'as':_0x1690('0x73'),'foreignKey':'ListId'});db[_0x1690('0xf4')]['belongsToMany'](db[_0x1690('0x1a')],{'as':_0x1690('0x1e2'),'through':_0x1690('0x151')});db[_0x1690('0xf4')][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':_0x1690('0x121')});db[_0x1690('0xf6')][_0x1690('0x10e')](db[_0x1690('0x17')],{'as':_0x1690('0x111'),'onDelete':_0x1690('0x140')});db[_0x1690('0xf6')]['belongsToMany'](db[_0x1690('0x12')],{'as':'Agents','through':_0x1690('0x130')});db[_0x1690('0xf8')][_0x1690('0x10e')](db[_0x1690('0x12')],{'as':_0x1690('0x16d'),'foreignKey':'userProfileId'});db[_0x1690('0xf8')][_0x1690('0x10e')](db[_0x1690('0xfa')],{'as':_0x1690('0x1e3'),'foreignKey':_0x1690('0x11a'),'onDelete':_0x1690('0x140')});db[_0x1690('0xfa')][_0x1690('0x10e')](db[_0x1690('0x1e4')],{'as':_0x1690('0x1e5'),'foreignKey':_0x1690('0x1e6'),'onDelete':_0x1690('0x140')});db[_0x1690('0xfd')][_0x1690('0x10e')](db[_0x1690('0x173')],{'as':_0x1690('0x15f'),'foreignKey':_0x1690('0x1e7')});db[_0x1690('0xfd')][_0x1690('0x10e')](db[_0x1690('0x17c')],{'as':_0x1690('0x160'),'foreignKey':_0x1690('0x1e7')});db[_0x1690('0xfd')][_0x1690('0x10e')](db['WhatsappMessage'],{'as':_0x1690('0x154'),'foreignKey':'WhatsappAccountId'});db[_0x1690('0xfd')][_0x1690('0x10e')](db[_0x1690('0x100')],{'as':'Interactions'});db[_0x1690('0xfd')][_0x1690('0x10e')](db[_0x1690('0xfe')],{'as':_0x1690('0x142')});db[_0x1690('0xfd')][_0x1690('0x119')](db[_0x1690('0xf4')],{'as':_0x1690('0x162'),'foreignKey':_0x1690('0x163')});db[_0x1690('0xfd')]['belongsTo'](db[_0x1690('0x7e')],{'as':_0x1690('0x165'),'foreignKey':_0x1690('0x14f')});db['WhatsappAccount'][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':_0x1690('0x13d')});db[_0x1690('0xfe')][_0x1690('0x119')](db['User'],{'onDelete':_0x1690('0x170')});db[_0x1690('0xfe')]['belongsTo'](db[_0x1690('0x106')],{'onDelete':_0x1690('0x170')});db[_0x1690('0xfe')]['belongsTo'](db[_0x1690('0xfd')],{'onDelete':_0x1690('0x170')});db[_0x1690('0xfe')][_0x1690('0x119')](db['Interval'],{'onDelete':_0x1690('0x170'),'foreignKey':_0x1690('0x171')});db['WhatsappApplication'][_0x1690('0x119')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x1690('0x175')});db[_0x1690('0x100')][_0x1690('0x10e')](db[_0x1690('0x101')],{'as':_0x1690('0x154'),'onDelete':_0x1690('0x140'),'foreignKey':_0x1690('0x1e8')});db[_0x1690('0x100')][_0x1690('0x119')](db[_0x1690('0xfd')],{'as':'Account','foreignKey':_0x1690('0x1e7')});db[_0x1690('0x100')][_0x1690('0x119')](db[_0x1690('0x6c')],{'as':_0x1690('0x15a'),'foreignKey':_0x1690('0x15b')});db[_0x1690('0x100')]['belongsTo'](db[_0x1690('0x12')],{'as':_0x1690('0x169'),'foreignKey':_0x1690('0x10d')});db[_0x1690('0x100')][_0x1690('0x11b')](db[_0x1690('0x16a')],{'through':_0x1690('0x1a4'),'as':_0x1690('0x177')});db[_0x1690('0x100')][_0x1690('0x11b')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x1690('0x16c')});db[_0x1690('0x100')][_0x1690('0x11b')](db['User'],{'as':_0x1690('0x16d'),'through':'user_has_whatsapp_interactions','foreignKey':_0x1690('0x1e8')});db[_0x1690('0x101')][_0x1690('0x119')](db[_0x1690('0x12')],{'as':_0x1690('0x12')});db['WhatsappMessage'][_0x1690('0x119')](db[_0x1690('0x6c')],{'onDelete':_0x1690('0x140'),'as':_0x1690('0x15a')});db[_0x1690('0x101')][_0x1690('0x119')](db[_0x1690('0x100')],{'onDelete':_0x1690('0x140'),'as':_0x1690('0x178'),'foreignKey':_0x1690('0x1e8')});db[_0x1690('0x101')][_0x1690('0x119')](db[_0x1690('0xfd')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x1690('0x102')]['belongsTo'](db[_0x1690('0xfd')],{});db[_0x1690('0x102')]['belongsTo'](db[_0x1690('0xf4')],{'as':_0x1690('0x162'),'foreignKey':'ListId'});db[_0x1690('0x102')][_0x1690('0x119')](db[_0x1690('0x6c')],{'as':_0x1690('0x15a'),'foreignKey':'ContactId'});db[_0x1690('0x102')][_0x1690('0x119')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x1690('0x106')],{});db['WhatsappQueueReport'][_0x1690('0x119')](db['WhatsappMessage'],{});db[_0x1690('0x102')][_0x1690('0x119')](db[_0x1690('0x12')],{});db[_0x1690('0x104')][_0x1690('0x119')](db[_0x1690('0x101')],{});db[_0x1690('0x104')][_0x1690('0x119')](db[_0x1690('0x100')],{});db[_0x1690('0x104')][_0x1690('0x119')](db[_0x1690('0xfd')],{'foreignKey':_0x1690('0x1e9'),'as':_0x1690('0x1cc')});db[_0x1690('0x104')][_0x1690('0x119')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0x1690('0x1d2')});db[_0x1690('0x104')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':_0x1690('0x1d0')});db['WhatsappTransferReport']['belongsTo'](db[_0x1690('0x12')],{'foreignKey':'FromUserId','as':_0x1690('0x1d9')});db[_0x1690('0x104')][_0x1690('0x119')](db[_0x1690('0x12')],{'foreignKey':_0x1690('0x1cd'),'as':_0x1690('0x1ce')});db['WhatsappQueue'][_0x1690('0x11b')](db[_0x1690('0x12')],{'as':_0x1690('0x152'),'through':'UserWhatsappQueue','foreignKey':_0x1690('0x1ea')});db[_0x1690('0x106')][_0x1690('0x11b')](db[_0x1690('0xe1')],{'through':_0x1690('0x1c6'),'as':_0x1690('0x166')});module[_0x1690('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 452c2f6..2019166 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95c1=['./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','/api/webbar','/apidoc','static','root','join','/www','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','appPath','/index.html','password','newPassword','apiKey','firstName','lastName','street','phone','clientId','clientSecret','code','tenantId','token','channelSecret','accessToken','consumerKey','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace','@@{','}@@','includes','lodash','path','express-winston','./errors','./config/logger','api','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','responseTime','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/disposition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/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/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts'];(function(_0x21267f,_0x57490b){var _0x3d7f91=function(_0x66e2cc){while(--_0x66e2cc){_0x21267f['push'](_0x21267f['shift']());}};_0x3d7f91(++_0x57490b);}(_0x95c1,0x86));var _0x195c=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x95c1[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x195c('0x0'));var path=require(_0x195c('0x1'));var express=require('express');var ewinston=require(_0x195c('0x2'));var util=require('util');var errors=require(_0x195c('0x3'));var config=require('./config/environment');var logger=require(_0x195c('0x4'))(_0x195c('0x5'));var authLogger=require(_0x195c('0x4'))('auth');exports['default']=function(_0x30cbe3){_0x30cbe3[_0x195c('0x6')](ewinston[_0x195c('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x28ad23,_0x586e50){var _0x799ce7=_0x195c('0x8');if(!_[_0x195c('0x9')](_0x28ad23[_0x195c('0xa')])){_0x799ce7+=_0x195c('0xb');var _0x7a06a8=_0x28ad23[_0x195c('0xa')];maskSensitiveData(_0x7a06a8);}return util[_0x195c('0xc')](_0x799ce7,_0x28ad23[_0x195c('0xd')],_0x28ad23[_0x195c('0xe')][_0x195c('0xf')]?_0x28ad23[_0x195c('0xe')][_0x195c('0xf')]:_0x28ad23['connection'][_0x195c('0x10')]||_0x28ad23['ip'],_0x28ad23[_0x195c('0x11')],_0x586e50[_0x195c('0x12')],_0x586e50['responseTime'],_0x28ad23[_0x195c('0x13')]?_0x28ad23['user']['id']:null,_0x28ad23[_0x195c('0x13')]?_0x28ad23[_0x195c('0x13')][_0x195c('0x14')]:null,_0x28ad23['user']?_0x28ad23[_0x195c('0x13')][_0x195c('0x15')]:null,_0x7a06a8?util['inspect'](_0x7a06a8,![],null):'');}}));_0x30cbe3['use'](ewinston[_0x195c('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x22ac89,_0xb1af48){var _0x137c4f=_0x195c('0x16');if(_0x22ac89[_0x195c('0xa')]&&_0x22ac89['body'][_0x195c('0x17')]&&_0x22ac89[_0x195c('0xa')][_0x195c('0x18')]){_0x137c4f=_0x195c('0x19');}return util['format'](_0x137c4f,_0x22ac89['method'],_0x22ac89[_0x195c('0xe')][_0x195c('0xf')]?_0x22ac89[_0x195c('0xe')]['x-forwarded-for']:_0x22ac89[_0x195c('0x1a')][_0x195c('0x10')]||_0x22ac89['ip'],_0x22ac89['url'],_0xb1af48[_0x195c('0x12')],_0xb1af48[_0x195c('0x1b')],_0x22ac89['user']?_0x22ac89['user']['id']:null,_0x22ac89[_0x195c('0x13')]?_0x22ac89['user']['name']:null,_0x22ac89[_0x195c('0x13')]?_0x22ac89[_0x195c('0x13')][_0x195c('0x15')]:null,_0x22ac89[_0x195c('0xa')]&&_0x22ac89[_0x195c('0xa')][_0x195c('0x17')]?_0x22ac89[_0x195c('0xa')][_0x195c('0x17')]:'other',_0x22ac89['body']&&_0x22ac89[_0x195c('0xa')][_0x195c('0x18')]?_0x22ac89['body']['agent_id']:'',_0x22ac89[_0x195c('0xa')]&&_0x22ac89['body'][_0x195c('0x1c')]?_0x22ac89[_0x195c('0xa')][_0x195c('0x1c')]:'');},'ignoreRoute':function(_0x41271a){var _0x1c8cb7=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1c8cb7[_0x195c('0x1d')](_0x41271a[_0x195c('0x11')]);}}));_0x30cbe3[_0x195c('0x6')](_0x195c('0x1e'),require(_0x195c('0x1f')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x20'),require(_0x195c('0x21')));_0x30cbe3[_0x195c('0x6')]('/api/voice/contexts',require('./api/voiceContext'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x22'),require('./api/voiceExtension'));_0x30cbe3['use'](_0x195c('0x23'),require(_0x195c('0x24')));_0x30cbe3[_0x195c('0x6')]('/api/voice/queues',require('./api/voiceQueue'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x25'),require(_0x195c('0x26')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x27'),require(_0x195c('0x28')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x29'),require(_0x195c('0x2a')));_0x30cbe3['use']('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x2b'),require('./api/voiceCallReport'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x2c'),require(_0x195c('0x2d')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x2e'),require(_0x195c('0x2f')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x30'),require(_0x195c('0x31')));_0x30cbe3['use'](_0x195c('0x32'),require(_0x195c('0x33')));_0x30cbe3['use'](_0x195c('0x34'),require(_0x195c('0x35')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x36'),require(_0x195c('0x37')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x38'),require(_0x195c('0x39')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x3a'),require(_0x195c('0x3b')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x3c'),require(_0x195c('0x3d')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x3e'),require(_0x195c('0x3f')));_0x30cbe3[_0x195c('0x6')]('/api/mail/interactions',require('./api/mailInteraction'));_0x30cbe3[_0x195c('0x6')]('/api/mail/messages',require(_0x195c('0x40')));_0x30cbe3[_0x195c('0x6')]('/api/mail/applications',require(_0x195c('0x41')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x42'),require('./api/mailQueueReport'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x43'),require(_0x195c('0x44')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x45'),require(_0x195c('0x46')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x47'),require(_0x195c('0x48')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x49'),require(_0x195c('0x4a')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x4b'),require(_0x195c('0x4c')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x4d'),require(_0x195c('0x4e')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x4f'),require('./api/faxQueue'));_0x30cbe3['use'](_0x195c('0x50'),require(_0x195c('0x51')));_0x30cbe3[_0x195c('0x6')]('/api/sms/accounts',require(_0x195c('0x52')));_0x30cbe3['use'](_0x195c('0x53'),require('./api/smsApplication'));_0x30cbe3[_0x195c('0x6')]('/api/sms/interactions',require('./api/smsInteraction'));_0x30cbe3[_0x195c('0x6')]('/api/sms/messages',require(_0x195c('0x54')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x55'),require(_0x195c('0x56')));_0x30cbe3['use'](_0x195c('0x57'),require(_0x195c('0x58')));_0x30cbe3[_0x195c('0x6')]('/api/openchannel/applications',require(_0x195c('0x59')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x5a'),require(_0x195c('0x5b')));_0x30cbe3['use'](_0x195c('0x5c'),require(_0x195c('0x5d')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x5e'),require('./api/openchannelQueue'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x5f'),require(_0x195c('0x60')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x61'),require(_0x195c('0x62')));_0x30cbe3['use'](_0x195c('0x63'),require('./api/chatApplication'));_0x30cbe3[_0x195c('0x6')]('/api/chat/interactions',require(_0x195c('0x64')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x65'),require(_0x195c('0x66')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x67'),require(_0x195c('0x68')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x69'),require(_0x195c('0x6a')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x6b'),require('./api/chatGroup'));_0x30cbe3[_0x195c('0x6')]('/api/chat/proactive_actions',require(_0x195c('0x6c')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x6d'),require('./api/cmCompany'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x6e'),require(_0x195c('0x6f')));_0x30cbe3['use'](_0x195c('0x70'),require(_0x195c('0x71')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x72'),require(_0x195c('0x73')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x74'),require(_0x195c('0x75')));_0x30cbe3[_0x195c('0x6')]('/api/cm/hopper_history',require(_0x195c('0x76')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x77'),require(_0x195c('0x78')));_0x30cbe3['use'](_0x195c('0x79'),require('./api/action'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x7a'),require(_0x195c('0x7b')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x7c'),require('./api/cannedAnswer'));_0x30cbe3['use']('/api/dispositions',require(_0x195c('0x7d')));_0x30cbe3[_0x195c('0x6')]('/api/conditions',require('./api/condition'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x7e'),require(_0x195c('0x7f')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x80'),require(_0x195c('0x81')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x82'),require(_0x195c('0x83')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x84'),require(_0x195c('0x85')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x86'),require(_0x195c('0x87')));_0x30cbe3['use']('/api/sounds',require(_0x195c('0x88')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x89'),require(_0x195c('0x8a')));_0x30cbe3[_0x195c('0x6')]('/api/templates',require('./api/template'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x8b'),require('./api/trigger'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x8c'),require(_0x195c('0x8d')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x8e'),require(_0x195c('0x8f')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x90'),require(_0x195c('0x91')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x92'),require('./api/analyticCustomReport'));_0x30cbe3['use'](_0x195c('0x93'),require(_0x195c('0x94')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x95'),require(_0x195c('0x96')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x97'),require(_0x195c('0x98')));_0x30cbe3[_0x195c('0x6')]('/api/analytics/field_reports',require(_0x195c('0x99')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x9a'),require(_0x195c('0x9b')));_0x30cbe3[_0x195c('0x6')]('/api/integrations/salesforce/accounts',require(_0x195c('0x9c')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x9d'),require('./api/intSalesforceConfiguration'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x9e'),require(_0x195c('0x9f')));_0x30cbe3['use']('/api/integrations/sugarcrm/accounts',require(_0x195c('0xa0')));_0x30cbe3['use'](_0x195c('0xa1'),require(_0x195c('0xa2')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xa3'),require(_0x195c('0xa4')));_0x30cbe3['use']('/api/integrations/desk/accounts',require(_0x195c('0xa5')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xa6'),require(_0x195c('0xa7')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xa8'),require('./api/intDeskField'));_0x30cbe3['use'](_0x195c('0xa9'),require('./api/intZohoAccount'));_0x30cbe3['use']('/api/integrations/zoho/configurations',require(_0x195c('0xaa')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xab'),require(_0x195c('0xac')));_0x30cbe3[_0x195c('0x6')]('/api/integrations/zendesk/accounts',require(_0x195c('0xad')));_0x30cbe3['use'](_0x195c('0xae'),require('./api/intZendeskConfiguration'));_0x30cbe3[_0x195c('0x6')](_0x195c('0xaf'),require(_0x195c('0xb0')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xb1'),require('./api/intFreshdeskAccount'));_0x30cbe3[_0x195c('0x6')](_0x195c('0xb2'),require(_0x195c('0xb3')));_0x30cbe3[_0x195c('0x6')]('/api/integrations/freshdesk/fields',require(_0x195c('0xb4')));_0x30cbe3['use'](_0x195c('0xb5'),require(_0x195c('0xb6')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xb7'),require(_0x195c('0xb8')));_0x30cbe3['use'](_0x195c('0xb9'),require(_0x195c('0xba')));_0x30cbe3['use'](_0x195c('0xbb'),require('./api/intServicenowAccount'));_0x30cbe3[_0x195c('0x6')](_0x195c('0xbc'),require('./api/intServicenowConfiguration'));_0x30cbe3[_0x195c('0x6')]('/api/integrations/servicenow/fields',require(_0x195c('0xbd')));_0x30cbe3['use']('/api/integrations/dynamics365/accounts',require(_0x195c('0xbe')));_0x30cbe3['use'](_0x195c('0xbf'),require(_0x195c('0xc0')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xc1'),require(_0x195c('0xc2')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xc3'),require(_0x195c('0xc4')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xc5'),require(_0x195c('0xc6')));_0x30cbe3[_0x195c('0x6')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x30cbe3[_0x195c('0x6')]('/api/networks',require(_0x195c('0xc7')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xc8'),require(_0x195c('0xc9')));_0x30cbe3['use']('/api/chat/internal/messages',require(_0x195c('0xca')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xcb'),require(_0x195c('0xcc')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xcd'),require(_0x195c('0xce')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xcf'),require(_0x195c('0xd0')));_0x30cbe3[_0x195c('0x6')]('/api/sms/reports/queue',require(_0x195c('0xd1')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xd2'),require(_0x195c('0xd3')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xd4'),require(_0x195c('0xd5')));_0x30cbe3[_0x195c('0x6')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x30cbe3[_0x195c('0x6')]('/api/settings',require('./api/setting'));_0x30cbe3[_0x195c('0x6')](_0x195c('0xd6'),require(_0x195c('0xd7')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xd8'),require(_0x195c('0xd9')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xda'),require('./api/squareRecording'));_0x30cbe3['use'](_0x195c('0xdb'),require(_0x195c('0xdc')));_0x30cbe3['use'](_0x195c('0xdd'),require(_0x195c('0xde')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xdf'),require(_0x195c('0xe0')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xe1'),require(_0x195c('0xe2')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xe3'),require(_0x195c('0xe4')));_0x30cbe3['use'](_0x195c('0xe5'),require(_0x195c('0xe6')));_0x30cbe3[_0x195c('0x6')]('/api/plugins',require(_0x195c('0xe7')));_0x30cbe3[_0x195c('0x6')]('/api/mail/reports/transfer',require(_0x195c('0xe8')));_0x30cbe3[_0x195c('0x6')]('/api/chat/reports/transfer',require(_0x195c('0xe9')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xea'),require('./api/faxTransferReport'));_0x30cbe3[_0x195c('0x6')](_0x195c('0xeb'),require(_0x195c('0xec')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xed'),require(_0x195c('0xee')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xef'),require(_0x195c('0xf0')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xf1'),require(_0x195c('0xf2')));_0x30cbe3[_0x195c('0x6')]('/api/userProfiles',require(_0x195c('0xf3')));_0x30cbe3['use'](_0x195c('0xf4'),require(_0x195c('0xf5')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xf6'),require(_0x195c('0xf7')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xf8'),require(_0x195c('0xf9')));_0x30cbe3['use'](_0x195c('0xfa'),require(_0x195c('0xfb')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xfc'),require(_0x195c('0xfd')));_0x30cbe3[_0x195c('0x6')](_0x195c('0xfe'),require(_0x195c('0xff')));_0x30cbe3[_0x195c('0x6')]('/api/whatsapp/messages',require(_0x195c('0x100')));_0x30cbe3['use'](_0x195c('0x101'),require(_0x195c('0x102')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x103'),require(_0x195c('0x104')));_0x30cbe3[_0x195c('0x6')]('/api/whatsapp/queues',require(_0x195c('0x105')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x106'),require(_0x195c('0x107')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x108'),require(_0x195c('0x109')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x10a'),require('./api/authLocal'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x10b'),require(_0x195c('0x10c')));_0x30cbe3[_0x195c('0x6')]('/api/jira',require(_0x195c('0x10d')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x10e'),require(_0x195c('0x10f')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x110'),require(_0x195c('0x111')));_0x30cbe3[_0x195c('0x6')]('/api/system',require('./api/system'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x112'),require(_0x195c('0x113')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x114'),require('./api/webbar'));_0x30cbe3[_0x195c('0x6')](_0x195c('0x115'),express[_0x195c('0x116')](path['join'](config[_0x195c('0x117')],_0x195c('0x115'))));_0x30cbe3[_0x195c('0x6')]('/www',express['static'](path[_0x195c('0x118')](config[_0x195c('0x117')],_0x195c('0x119'))));_0x30cbe3[_0x195c('0x6')]('/demo',express[_0x195c('0x116')](path['join'](config['root'],'/demo')));_0x30cbe3[_0x195c('0x6')](_0x195c('0x11a'),express['static'](path['join'](config[_0x195c('0x117')],_0x195c('0x11b'),_0x195c('0x11c'))));_0x30cbe3[_0x195c('0x6')](_0x195c('0x11d'),express[_0x195c('0x116')](path[_0x195c('0x118')](config['root'],_0x195c('0x11e'))));_0x30cbe3[_0x195c('0x11f')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x195c('0x120')](errors[0x194]);_0x30cbe3[_0x195c('0x11f')]('/*')[_0x195c('0x120')](function(_0x18727c,_0x5253da){_0x5253da['sendFile'](path['resolve'](_0x30cbe3[_0x195c('0x120')](_0x195c('0x121'))+_0x195c('0x122')));});};var sensitiveFields=['username',_0x195c('0x123'),_0x195c('0x124'),_0x195c('0x125'),_0x195c('0x126'),_0x195c('0x127'),_0x195c('0x128'),_0x195c('0x129'),'mobile','fax','email',_0x195c('0x12a'),_0x195c('0x12b'),'securityToken',_0x195c('0x12c'),'accessKey',_0x195c('0x12d'),_0x195c('0x12e'),_0x195c('0x12f'),_0x195c('0x130'),'accessTokenSecret','authToken',_0x195c('0x131'),_0x195c('0x132'),_0x195c('0x133'),_0x195c('0x134'),'calleridnum',_0x195c('0x135'),_0x195c('0x136'),_0x195c('0x137'),_0x195c('0x138'),_0x195c('0x139'),_0x195c('0x13a'),_0x195c('0x13b'),_0x195c('0x13'),_0x195c('0x13c'),_0x195c('0x13d'),_0x195c('0x13e'),_0x195c('0x13f'),_0x195c('0x140'),_0x195c('0x141'),_0x195c('0x142')];function maskSensitiveData(_0x3d1caf){var _0xaff3cb=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x3d1caf))return;for(var _0x14f524 in _0x3d1caf){if(_[_0x195c('0x143')](_0x3d1caf[_0x14f524])){for(var _0x429596=0x0;_0x429596<_0x3d1caf[_0x14f524][_0x195c('0x144')];_0x429596++){maskSensitiveData(_0x3d1caf[_0x14f524][_0x429596]);}}else if(_['isPlainObject'](_0x3d1caf[_0x14f524])){maskSensitiveData(_0x3d1caf[_0x14f524]);}else if(_[_0x195c('0x145')](_0x3d1caf[_0x14f524])){_0x3d1caf[_0x14f524]=_0x3d1caf[_0x14f524][_0x195c('0x146')](/{{{/g,_0x195c('0x147'))[_0x195c('0x146')](/}}}/g,_0x195c('0x148'))[_0x195c('0x146')](/{{/g,'@{')[_0x195c('0x146')](/}}/g,'}@');if(_[_0x195c('0x149')](sensitiveFields,_0x14f524)){_0x3d1caf[_0x14f524]=_0x3d1caf[_0x14f524][_0x195c('0x146')](_0xaff3cb,'*');}}}} \ No newline at end of file +var _0x004e=['./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static','join','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','username','lastName','street','phone','mobile','email','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','vidaooApiKey','clientEmail','privateKey','accesskeyid','key','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','isString','replace','@@{','includes','path','express','express-winston','util','./config/environment','./config/logger','api','default','use','logger','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','agent_name','test','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./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/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x004e,0xad));var _0xe004=function(_0xa2f6d8,_0x586241){_0xa2f6d8=_0xa2f6d8-0x0;var _0x35c446=_0x004e[_0xa2f6d8];return _0x35c446;};'use strict';var _=require('lodash');var path=require(_0xe004('0x0'));var express=require(_0xe004('0x1'));var ewinston=require(_0xe004('0x2'));var util=require(_0xe004('0x3'));var errors=require('./errors');var config=require(_0xe004('0x4'));var logger=require(_0xe004('0x5'))(_0xe004('0x6'));var authLogger=require(_0xe004('0x5'))('auth');exports[_0xe004('0x7')]=function(_0xbfae69){_0xbfae69[_0xe004('0x8')](ewinston[_0xe004('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3a76ac,_0x5b4118){var _0x1a4d51='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xe004('0xa')](_0x3a76ac[_0xe004('0xb')])){_0x1a4d51+=_0xe004('0xc');var _0x5ae045=_0x3a76ac[_0xe004('0xb')];maskSensitiveData(_0x5ae045);}return util['format'](_0x1a4d51,_0x3a76ac[_0xe004('0xd')],_0x3a76ac[_0xe004('0xe')][_0xe004('0xf')]?_0x3a76ac[_0xe004('0xe')][_0xe004('0xf')]:_0x3a76ac[_0xe004('0x10')]['remoteAddress']||_0x3a76ac['ip'],_0x3a76ac[_0xe004('0x11')],_0x5b4118[_0xe004('0x12')],_0x5b4118[_0xe004('0x13')],_0x3a76ac[_0xe004('0x14')]?_0x3a76ac[_0xe004('0x14')]['id']:null,_0x3a76ac['user']?_0x3a76ac[_0xe004('0x14')][_0xe004('0x15')]:null,_0x3a76ac['user']?_0x3a76ac[_0xe004('0x14')][_0xe004('0x16')]:null,_0x5ae045?util[_0xe004('0x17')](_0x5ae045,![],null):'');}}));_0xbfae69[_0xe004('0x8')](ewinston[_0xe004('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x35c330,_0x285d61){var _0x2295d9=_0xe004('0x18');if(_0x35c330['body']&&_0x35c330[_0xe004('0xb')][_0xe004('0x19')]&&_0x35c330['body'][_0xe004('0x1a')]){_0x2295d9=_0xe004('0x1b');}return util[_0xe004('0x1c')](_0x2295d9,_0x35c330[_0xe004('0xd')],_0x35c330[_0xe004('0xe')]['x-forwarded-for']?_0x35c330[_0xe004('0xe')][_0xe004('0xf')]:_0x35c330[_0xe004('0x10')]['remoteAddress']||_0x35c330['ip'],_0x35c330[_0xe004('0x11')],_0x285d61[_0xe004('0x12')],_0x285d61[_0xe004('0x13')],_0x35c330['user']?_0x35c330[_0xe004('0x14')]['id']:null,_0x35c330[_0xe004('0x14')]?_0x35c330['user'][_0xe004('0x15')]:null,_0x35c330[_0xe004('0x14')]?_0x35c330[_0xe004('0x14')]['role']:null,_0x35c330[_0xe004('0xb')]&&_0x35c330['body'][_0xe004('0x19')]?_0x35c330[_0xe004('0xb')]['device']:'other',_0x35c330[_0xe004('0xb')]&&_0x35c330[_0xe004('0xb')]['agent_id']?_0x35c330[_0xe004('0xb')][_0xe004('0x1a')]:'',_0x35c330[_0xe004('0xb')]&&_0x35c330[_0xe004('0xb')]['agent_name']?_0x35c330[_0xe004('0xb')][_0xe004('0x1d')]:'');},'ignoreRoute':function(_0x4f901d){var _0x573b21=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x573b21[_0xe004('0x1e')](_0x4f901d[_0xe004('0x11')]);}}));_0xbfae69[_0xe004('0x8')](_0xe004('0x1f'),require(_0xe004('0x20')));_0xbfae69[_0xe004('0x8')]('/api/voice/chanspy',require(_0xe004('0x21')));_0xbfae69[_0xe004('0x8')](_0xe004('0x22'),require('./api/voiceContext'));_0xbfae69[_0xe004('0x8')](_0xe004('0x23'),require(_0xe004('0x24')));_0xbfae69[_0xe004('0x8')](_0xe004('0x25'),require(_0xe004('0x26')));_0xbfae69[_0xe004('0x8')](_0xe004('0x27'),require('./api/voiceQueue'));_0xbfae69[_0xe004('0x8')](_0xe004('0x28'),require(_0xe004('0x29')));_0xbfae69[_0xe004('0x8')](_0xe004('0x2a'),require(_0xe004('0x2b')));_0xbfae69[_0xe004('0x8')]('/api/voice/mails',require(_0xe004('0x2c')));_0xbfae69[_0xe004('0x8')](_0xe004('0x2d'),require(_0xe004('0x2e')));_0xbfae69[_0xe004('0x8')](_0xe004('0x2f'),require('./api/voiceCallReport'));_0xbfae69['use'](_0xe004('0x30'),require(_0xe004('0x31')));_0xbfae69['use'](_0xe004('0x32'),require('./api/voiceAgentReport'));_0xbfae69[_0xe004('0x8')](_0xe004('0x33'),require('./api/voiceQueueReport'));_0xbfae69[_0xe004('0x8')]('/api/members/reports',require('./api/memberReport'));_0xbfae69[_0xe004('0x8')](_0xe004('0x34'),require('./api/trunk'));_0xbfae69[_0xe004('0x8')](_0xe004('0x35'),require(_0xe004('0x36')));_0xbfae69[_0xe004('0x8')](_0xe004('0x37'),require(_0xe004('0x38')));_0xbfae69[_0xe004('0x8')]('/api/mail/accounts',require(_0xe004('0x39')));_0xbfae69[_0xe004('0x8')](_0xe004('0x3a'),require(_0xe004('0x3b')));_0xbfae69['use'](_0xe004('0x3c'),require('./api/mailSubstatus'));_0xbfae69[_0xe004('0x8')](_0xe004('0x3d'),require('./api/mailInteraction'));_0xbfae69[_0xe004('0x8')](_0xe004('0x3e'),require(_0xe004('0x3f')));_0xbfae69[_0xe004('0x8')](_0xe004('0x40'),require(_0xe004('0x41')));_0xbfae69[_0xe004('0x8')]('/api/mail/reports/queue',require(_0xe004('0x42')));_0xbfae69[_0xe004('0x8')](_0xe004('0x43'),require(_0xe004('0x44')));_0xbfae69[_0xe004('0x8')](_0xe004('0x45'),require(_0xe004('0x46')));_0xbfae69[_0xe004('0x8')](_0xe004('0x47'),require('./api/faxAccount'));_0xbfae69[_0xe004('0x8')](_0xe004('0x48'),require(_0xe004('0x49')));_0xbfae69['use'](_0xe004('0x4a'),require('./api/faxInteraction'));_0xbfae69[_0xe004('0x8')](_0xe004('0x4b'),require(_0xe004('0x4c')));_0xbfae69[_0xe004('0x8')](_0xe004('0x4d'),require(_0xe004('0x4e')));_0xbfae69[_0xe004('0x8')](_0xe004('0x4f'),require('./api/faxQueueReport'));_0xbfae69[_0xe004('0x8')]('/api/sms/accounts',require(_0xe004('0x50')));_0xbfae69[_0xe004('0x8')](_0xe004('0x51'),require('./api/smsApplication'));_0xbfae69['use'](_0xe004('0x52'),require(_0xe004('0x53')));_0xbfae69[_0xe004('0x8')](_0xe004('0x54'),require('./api/smsMessage'));_0xbfae69[_0xe004('0x8')](_0xe004('0x55'),require(_0xe004('0x56')));_0xbfae69[_0xe004('0x8')]('/api/openchannel/accounts',require(_0xe004('0x57')));_0xbfae69['use'](_0xe004('0x58'),require('./api/openchannelApplication'));_0xbfae69[_0xe004('0x8')](_0xe004('0x59'),require(_0xe004('0x5a')));_0xbfae69[_0xe004('0x8')]('/api/openchannel/messages',require(_0xe004('0x5b')));_0xbfae69[_0xe004('0x8')](_0xe004('0x5c'),require(_0xe004('0x5d')));_0xbfae69[_0xe004('0x8')](_0xe004('0x5e'),require('./api/chatWebsite'));_0xbfae69['use'](_0xe004('0x5f'),require(_0xe004('0x60')));_0xbfae69[_0xe004('0x8')](_0xe004('0x61'),require(_0xe004('0x62')));_0xbfae69[_0xe004('0x8')]('/api/chat/interactions',require(_0xe004('0x63')));_0xbfae69[_0xe004('0x8')](_0xe004('0x64'),require(_0xe004('0x65')));_0xbfae69[_0xe004('0x8')](_0xe004('0x66'),require(_0xe004('0x67')));_0xbfae69[_0xe004('0x8')](_0xe004('0x68'),require(_0xe004('0x69')));_0xbfae69['use'](_0xe004('0x6a'),require('./api/chatGroup'));_0xbfae69[_0xe004('0x8')](_0xe004('0x6b'),require(_0xe004('0x6c')));_0xbfae69['use'](_0xe004('0x6d'),require(_0xe004('0x6e')));_0xbfae69[_0xe004('0x8')](_0xe004('0x6f'),require('./api/cmContact'));_0xbfae69[_0xe004('0x8')](_0xe004('0x70'),require(_0xe004('0x71')));_0xbfae69[_0xe004('0x8')](_0xe004('0x72'),require(_0xe004('0x73')));_0xbfae69[_0xe004('0x8')](_0xe004('0x74'),require(_0xe004('0x75')));_0xbfae69[_0xe004('0x8')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0xbfae69['use'](_0xe004('0x76'),require(_0xe004('0x77')));_0xbfae69[_0xe004('0x8')](_0xe004('0x78'),require('./api/action'));_0xbfae69[_0xe004('0x8')]('/api/automations',require(_0xe004('0x79')));_0xbfae69[_0xe004('0x8')](_0xe004('0x7a'),require(_0xe004('0x7b')));_0xbfae69[_0xe004('0x8')](_0xe004('0x7c'),require(_0xe004('0x7d')));_0xbfae69[_0xe004('0x8')]('/api/conditions',require(_0xe004('0x7e')));_0xbfae69[_0xe004('0x8')]('/api/intervals',require(_0xe004('0x7f')));_0xbfae69[_0xe004('0x8')](_0xe004('0x80'),require(_0xe004('0x81')));_0xbfae69[_0xe004('0x8')]('/api/cdr',require('./api/cdr'));_0xbfae69['use'](_0xe004('0x82'),require('./api/voiceQueuesLog'));_0xbfae69[_0xe004('0x8')](_0xe004('0x83'),require('./api/schedule'));_0xbfae69[_0xe004('0x8')](_0xe004('0x84'),require(_0xe004('0x85')));_0xbfae69[_0xe004('0x8')](_0xe004('0x86'),require('./api/tag'));_0xbfae69[_0xe004('0x8')](_0xe004('0x87'),require(_0xe004('0x88')));_0xbfae69[_0xe004('0x8')](_0xe004('0x89'),require(_0xe004('0x8a')));_0xbfae69[_0xe004('0x8')](_0xe004('0x8b'),require(_0xe004('0x8c')));_0xbfae69[_0xe004('0x8')](_0xe004('0x8d'),require('./api/integration'));_0xbfae69[_0xe004('0x8')](_0xe004('0x8e'),require('./api/integrationReport'));_0xbfae69[_0xe004('0x8')](_0xe004('0x8f'),require(_0xe004('0x90')));_0xbfae69[_0xe004('0x8')](_0xe004('0x91'),require(_0xe004('0x92')));_0xbfae69[_0xe004('0x8')](_0xe004('0x93'),require(_0xe004('0x94')));_0xbfae69[_0xe004('0x8')](_0xe004('0x95'),require(_0xe004('0x96')));_0xbfae69['use']('/api/analytics/field_reports',require(_0xe004('0x97')));_0xbfae69[_0xe004('0x8')](_0xe004('0x98'),require(_0xe004('0x99')));_0xbfae69[_0xe004('0x8')](_0xe004('0x9a'),require(_0xe004('0x9b')));_0xbfae69[_0xe004('0x8')]('/api/integrations/salesforce/configurations',require(_0xe004('0x9c')));_0xbfae69[_0xe004('0x8')](_0xe004('0x9d'),require('./api/intSalesforceField'));_0xbfae69[_0xe004('0x8')]('/api/integrations/sugarcrm/accounts',require(_0xe004('0x9e')));_0xbfae69['use'](_0xe004('0x9f'),require('./api/intSugarcrmConfiguration'));_0xbfae69[_0xe004('0x8')](_0xe004('0xa0'),require('./api/intSugarcrmField'));_0xbfae69['use'](_0xe004('0xa1'),require('./api/intDeskAccount'));_0xbfae69[_0xe004('0x8')]('/api/integrations/desk/configurations',require(_0xe004('0xa2')));_0xbfae69[_0xe004('0x8')](_0xe004('0xa3'),require(_0xe004('0xa4')));_0xbfae69['use']('/api/integrations/zoho/accounts',require(_0xe004('0xa5')));_0xbfae69[_0xe004('0x8')](_0xe004('0xa6'),require(_0xe004('0xa7')));_0xbfae69[_0xe004('0x8')]('/api/integrations/zoho/fields',require(_0xe004('0xa8')));_0xbfae69['use']('/api/integrations/zendesk/accounts',require(_0xe004('0xa9')));_0xbfae69['use'](_0xe004('0xaa'),require('./api/intZendeskConfiguration'));_0xbfae69[_0xe004('0x8')](_0xe004('0xab'),require(_0xe004('0xac')));_0xbfae69['use'](_0xe004('0xad'),require('./api/intFreshdeskAccount'));_0xbfae69[_0xe004('0x8')](_0xe004('0xae'),require(_0xe004('0xaf')));_0xbfae69[_0xe004('0x8')]('/api/integrations/freshdesk/fields',require(_0xe004('0xb0')));_0xbfae69[_0xe004('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0xbfae69[_0xe004('0x8')](_0xe004('0xb1'),require(_0xe004('0xb2')));_0xbfae69[_0xe004('0x8')](_0xe004('0xb3'),require('./api/intVtigerField'));_0xbfae69[_0xe004('0x8')](_0xe004('0xb4'),require(_0xe004('0xb5')));_0xbfae69[_0xe004('0x8')](_0xe004('0xb6'),require(_0xe004('0xb7')));_0xbfae69[_0xe004('0x8')]('/api/integrations/servicenow/fields',require(_0xe004('0xb8')));_0xbfae69[_0xe004('0x8')](_0xe004('0xb9'),require(_0xe004('0xba')));_0xbfae69[_0xe004('0x8')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0xbfae69['use'](_0xe004('0xbb'),require('./api/intDynamics365Field'));_0xbfae69[_0xe004('0x8')]('/api/integrations/freshsales/accounts',require(_0xe004('0xbc')));_0xbfae69[_0xe004('0x8')](_0xe004('0xbd'),require(_0xe004('0xbe')));_0xbfae69[_0xe004('0x8')]('/api/integrations/freshsales/fields',require(_0xe004('0xbf')));_0xbfae69[_0xe004('0x8')]('/api/networks',require(_0xe004('0xc0')));_0xbfae69['use'](_0xe004('0xc1'),require(_0xe004('0xc2')));_0xbfae69[_0xe004('0x8')](_0xe004('0xc3'),require(_0xe004('0xc4')));_0xbfae69[_0xe004('0x8')](_0xe004('0xc5'),require(_0xe004('0xc6')));_0xbfae69[_0xe004('0x8')](_0xe004('0xc7'),require(_0xe004('0xc8')));_0xbfae69[_0xe004('0x8')]('/api/jscripty/sessions/reports',require(_0xe004('0xc9')));_0xbfae69[_0xe004('0x8')](_0xe004('0xca'),require('./api/smsQueueReport'));_0xbfae69[_0xe004('0x8')](_0xe004('0xcb'),require('./api/squareReport'));_0xbfae69[_0xe004('0x8')](_0xe004('0xcc'),require(_0xe004('0xcd')));_0xbfae69[_0xe004('0x8')](_0xe004('0xce'),require(_0xe004('0xcf')));_0xbfae69[_0xe004('0x8')](_0xe004('0xd0'),require(_0xe004('0xd1')));_0xbfae69[_0xe004('0x8')](_0xe004('0xd2'),require(_0xe004('0xd3')));_0xbfae69[_0xe004('0x8')](_0xe004('0xd4'),require(_0xe004('0xd5')));_0xbfae69[_0xe004('0x8')](_0xe004('0xd6'),require(_0xe004('0xd7')));_0xbfae69[_0xe004('0x8')](_0xe004('0xd8'),require('./api/squareMessage'));_0xbfae69[_0xe004('0x8')](_0xe004('0xd9'),require(_0xe004('0xda')));_0xbfae69[_0xe004('0x8')](_0xe004('0xdb'),require(_0xe004('0xdc')));_0xbfae69[_0xe004('0x8')](_0xe004('0xdd'),require(_0xe004('0xde')));_0xbfae69[_0xe004('0x8')](_0xe004('0xdf'),require(_0xe004('0xe0')));_0xbfae69[_0xe004('0x8')]('/api/attachments',require(_0xe004('0xe1')));_0xbfae69[_0xe004('0x8')](_0xe004('0xe2'),require('./api/plugin'));_0xbfae69[_0xe004('0x8')](_0xe004('0xe3'),require('./api/mailTransferReport'));_0xbfae69[_0xe004('0x8')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0xbfae69[_0xe004('0x8')](_0xe004('0xe4'),require(_0xe004('0xe5')));_0xbfae69[_0xe004('0x8')]('/api/openchannel/reports/transfer',require(_0xe004('0xe6')));_0xbfae69['use'](_0xe004('0xe7'),require(_0xe004('0xe8')));_0xbfae69['use'](_0xe004('0xe9'),require(_0xe004('0xea')));_0xbfae69[_0xe004('0x8')](_0xe004('0xeb'),require('./api/voicePrefix'));_0xbfae69[_0xe004('0x8')](_0xe004('0xec'),require(_0xe004('0xed')));_0xbfae69[_0xe004('0x8')](_0xe004('0xee'),require('./api/userProfileSection'));_0xbfae69[_0xe004('0x8')]('/api/userProfile/resources',require(_0xe004('0xef')));_0xbfae69[_0xe004('0x8')]('/api/userNotifications',require(_0xe004('0xf0')));_0xbfae69[_0xe004('0x8')](_0xe004('0xf1'),require(_0xe004('0xf2')));_0xbfae69['use'](_0xe004('0xf3'),require('./api/whatsappApplication'));_0xbfae69['use'](_0xe004('0xf4'),require(_0xe004('0xf5')));_0xbfae69[_0xe004('0x8')](_0xe004('0xf6'),require(_0xe004('0xf7')));_0xbfae69[_0xe004('0x8')](_0xe004('0xf8'),require(_0xe004('0xf9')));_0xbfae69['use'](_0xe004('0xfa'),require(_0xe004('0xfb')));_0xbfae69['use'](_0xe004('0xfc'),require(_0xe004('0xfd')));_0xbfae69[_0xe004('0x8')]('/api/cloudProviders',require(_0xe004('0xfe')));_0xbfae69['use'](_0xe004('0xff'),require(_0xe004('0x100')));_0xbfae69[_0xe004('0x8')](_0xe004('0x101'),require(_0xe004('0x102')));_0xbfae69[_0xe004('0x8')](_0xe004('0x103'),require(_0xe004('0x104')));_0xbfae69[_0xe004('0x8')](_0xe004('0x105'),require(_0xe004('0x106')));_0xbfae69['use'](_0xe004('0x107'),require(_0xe004('0x108')));_0xbfae69[_0xe004('0x8')]('/api/version',require(_0xe004('0x109')));_0xbfae69[_0xe004('0x8')](_0xe004('0x10a'),require('./api/system'));_0xbfae69[_0xe004('0x8')](_0xe004('0x10b'),require(_0xe004('0x10c')));_0xbfae69['use'](_0xe004('0x10d'),require(_0xe004('0x10e')));_0xbfae69[_0xe004('0x8')](_0xe004('0x10f'),express['static'](path['join'](config[_0xe004('0x110')],_0xe004('0x10f'))));_0xbfae69[_0xe004('0x8')](_0xe004('0x111'),express[_0xe004('0x112')](path[_0xe004('0x113')](config[_0xe004('0x110')],_0xe004('0x111'))));_0xbfae69['use'](_0xe004('0x114'),express[_0xe004('0x112')](path[_0xe004('0x113')](config[_0xe004('0x110')],_0xe004('0x114'))));_0xbfae69[_0xe004('0x8')](_0xe004('0x115'),express['static'](path[_0xe004('0x113')](config[_0xe004('0x110')],_0xe004('0x116'),_0xe004('0x117'))));_0xbfae69['use'](_0xe004('0x118'),express[_0xe004('0x112')](path[_0xe004('0x113')](config[_0xe004('0x110')],_0xe004('0x119'))));_0xbfae69[_0xe004('0x11a')](_0xe004('0x11b'))[_0xe004('0x11c')](errors[0x194]);_0xbfae69[_0xe004('0x11a')]('/*')[_0xe004('0x11c')](function(_0x2b1730,_0x57a92d){_0x57a92d['sendFile'](path[_0xe004('0x11d')](_0xbfae69[_0xe004('0x11c')](_0xe004('0x11e'))+_0xe004('0x11f')));});};var sensitiveFields=[_0xe004('0x120'),'password','newPassword','apiKey','firstName',_0xe004('0x121'),_0xe004('0x122'),_0xe004('0x123'),_0xe004('0x124'),'fax',_0xe004('0x125'),'clientId',_0xe004('0x126'),_0xe004('0x127'),_0xe004('0x128'),_0xe004('0x129'),_0xe004('0x12a'),_0xe004('0x12b'),_0xe004('0x12c'),'accessToken',_0xe004('0x12d'),_0xe004('0x12e'),_0xe004('0x12f'),_0xe004('0x130'),_0xe004('0x131'),_0xe004('0x132'),'calleridnum','exten',_0xe004('0x133'),_0xe004('0x134'),_0xe004('0x135'),_0xe004('0x136'),'secretaccesskey',_0xe004('0x137'),_0xe004('0x14'),'pass',_0xe004('0x138'),_0xe004('0x139'),_0xe004('0x13a'),_0xe004('0x13b'),_0xe004('0x13c'),_0xe004('0x13d')];function maskSensitiveData(_0x49b7e6){var _0x361026=/(?!^)[\s\S](?!$)/g;if(!_[_0xe004('0x13e')](_0x49b7e6))return;for(var _0x468de4 in _0x49b7e6){if(_[_0xe004('0x13f')](_0x49b7e6[_0x468de4])){for(var _0x45d7e2=0x0;_0x45d7e2<_0x49b7e6[_0x468de4]['length'];_0x45d7e2++){maskSensitiveData(_0x49b7e6[_0x468de4][_0x45d7e2]);}}else if(_['isPlainObject'](_0x49b7e6[_0x468de4])){maskSensitiveData(_0x49b7e6[_0x468de4]);}else if(_[_0xe004('0x140')](_0x49b7e6[_0x468de4])){_0x49b7e6[_0x468de4]=_0x49b7e6[_0x468de4][_0xe004('0x141')](/{{{/g,_0xe004('0x142'))[_0xe004('0x141')](/}}}/g,'}@@')[_0xe004('0x141')](/{{/g,'@{')[_0xe004('0x141')](/}}/g,'}@');if(_[_0xe004('0x143')](sensitiveFields,_0x468de4)){_0x49b7e6[_0x468de4]=_0x49b7e6[_0x468de4][_0xe004('0x141')](_0x361026,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3dcba0e..e5ca727 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96de=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.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/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x1135f1,_0x1c36f9){var _0x4483a5=function(_0x44bc37){while(--_0x44bc37){_0x1135f1['push'](_0x1135f1['shift']());}};_0x4483a5(++_0x1c36f9);}(_0x96de,0x67));var _0xe96d=function(_0x178a2d,_0x4d73b4){_0x178a2d=_0x178a2d-0x0;var _0x5c7afa=_0x96de[_0x178a2d];return _0x5c7afa;};'use strict';var jayson=require(_0xe96d('0x0'));var BPromise=require('bluebird');var _=require('lodash');var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x56fe11,_0x55d440){var _0x36f23b={};_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x2')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/voiceExtension/voiceExtension.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x3')));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x4')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x5')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x6')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x7')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x8')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/trunk/trunk.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x9')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0xa')));_0x36f23b=_['merge'](_0x36f23b,require('../api/mailServerIn/mailServerIn.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/mailAccount/mailAccount.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0xb')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0xc')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0xd')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/mailApplication/mailApplication.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0xe')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0xf')));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x10')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x11')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x12')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x13')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x14')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x15')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x16')));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x17')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x18')));_0x36f23b=_['merge'](_0x36f23b,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x19')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x1a')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x1b')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x1c')));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x1d')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/chatQueue/chatQueue.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x1e')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/cmHopper/cmHopper.rpc'));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x1f')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x20')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x21')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x22')));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x23')));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x24')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x25')));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x26')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x27')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/variable/variable.rpc'));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x28')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x36f23b=_['merge'](_0x36f23b,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x29')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x2a')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x2b')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x2c')));_0x36f23b=_['merge'](_0x36f23b,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x2d')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x2e')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x2f')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/setting/setting.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x30')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x31')));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x32')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x33')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/campaign/campaign.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x34')));_0x36f23b=_['merge'](_0x36f23b,require(_0xe96d('0x35')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x36')));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x36f23b=_[_0xe96d('0x1')](_0x36f23b,require(_0xe96d('0x37')));var _0x4441ed=jayson[_0xe96d('0x38')](_0x36f23b)['http']();var _0x4dbc06=config[_0xe96d('0x39')][_0xe96d('0x3a')]||config[_0xe96d('0x3a')]+0x1;var _0x419aec=config[_0xe96d('0x39')]['ip']||_0xe96d('0x3b');_0x4441ed['on']('error',function(_0x126dc9){return _0x55d440(_0x126dc9);});_0x4441ed['listen'](_0x4dbc06,_0x419aec,function(){console[_0xe96d('0x3c')](_0xe96d('0x3d'),_0x419aec,_0x4dbc06);require(_0xe96d('0x3e'))[_0xe96d('0x3f')]();return _0x56fe11(_0xe96d('0x40')+_0x419aec+':'+_0x4dbc06);});});}; \ No newline at end of file +var _0x213b=['../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.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/chatInteraction/chatInteraction.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','bluebird','../config/environment','listen','merge'];(function(_0x237388,_0x5862eb){var _0x2332f4=function(_0x3e931d){while(--_0x3e931d){_0x237388['push'](_0x237388['shift']());}};_0x2332f4(++_0x5862eb);}(_0x213b,0xd3));var _0xb213=function(_0x242c42,_0x3df02a){_0x242c42=_0x242c42-0x0;var _0x15680b=_0x213b[_0x242c42];return _0x15680b;};'use strict';var jayson=require(_0xb213('0x0'));var BPromise=require(_0xb213('0x1'));var _=require('lodash');var config=require(_0xb213('0x2'));exports[_0xb213('0x3')]=function(){return new BPromise(function(_0x3d0c8a,_0x5e63b9){var _0x4d418b={};_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x5')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x6')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/voiceQueue/voiceQueue.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x7')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x8')));_0x4d418b=_['merge'](_0x4d418b,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x9')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0xa')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0xb')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/trunk/trunk.rpc'));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0xc')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0xd')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0xe')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0xf')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x10')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x11')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x12')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/mailApplication/mailApplication.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/faxAccount/faxAccount.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x13')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x14')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/faxMessage/faxMessage.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x15')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x16')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x17')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x18')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x19')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x1a')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x1b')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x1c')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x1d')));_0x4d418b=_['merge'](_0x4d418b,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x1e')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/chatMessage/chatMessage.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/chatQueue/chatQueue.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x1f')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/cmHopper/cmHopper.rpc'));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x20')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x21')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x22')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x23')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x24')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/sound/sound.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x25')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x26')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x27')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x28')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x29')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x2a')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x2b')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x2c')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x2d')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x2e')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x2f')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x30')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/squareReport/squareReport.rpc'));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x31')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x32')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x33')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x34')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x35')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x36')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x37')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x38')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x39')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x3a')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x3b')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require(_0xb213('0x3c')));_0x4d418b=_['merge'](_0x4d418b,require(_0xb213('0x3d')));_0x4d418b=_[_0xb213('0x4')](_0x4d418b,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1c8754=jayson[_0xb213('0x3e')](_0x4d418b)[_0xb213('0x3f')]();var _0x3245f9=config[_0xb213('0x40')]['port']||config[_0xb213('0x41')]+0x1;var _0xd06559=config['rpc']['ip']||_0xb213('0x42');_0x1c8754['on'](_0xb213('0x43'),function(_0x3a8500){return _0x5e63b9(_0x3a8500);});_0x1c8754[_0xb213('0x3')](_0x3245f9,_0xd06559,function(){console[_0xb213('0x44')](_0xb213('0x45'),_0xd06559,_0x3245f9);require(_0xb213('0x46'))[_0xb213('0x47')]();return _0x3d0c8a('RPC\x20listening\x20on\x20'+_0xd06559+':'+_0x3245f9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 67f173c..77e988b 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 _0x65d2=['SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','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','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','prototype','answer','beep','sendRequest','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension'];(function(_0x1290f3,_0x2be588){var _0x47f342=function(_0x171438){while(--_0x171438){_0x1290f3['push'](_0x1290f3['shift']());}};_0x47f342(++_0x2be588);}(_0x65d2,0x1f3));var _0x265d=function(_0x2a9354,_0x570acd){_0x2a9354=_0x2a9354-0x0;var _0x2a6f1f=_0x65d2[_0x2a9354];return _0x2a6f1f;};'use strict';var util=require(_0x265d('0x0'));var _=require(_0x265d('0x1'));var EventEmitter=require(_0x265d('0x2'))[_0x265d('0x3')];var AGIReply=require(_0x265d('0x4'));var AGIError=require(_0x265d('0x5'));function AGIChannel(_0x33ee30){var _0x1b7ec6=this,_0x2e4711=new AGIReply(),_0x1ab8e7=![],_0x43d3fd={};EventEmitter[_0x265d('0x6')](_0x1b7ec6);_0x33ee30[_0x265d('0x7')](_0x265d('0x8'));_0x33ee30[_0x265d('0x9')](0x8*0x3c*0x3c*0x3e8);_0x2e4711['setEncoding']('utf8');_0x2e4711['on'](_0x265d('0xa'),function(_0x1f4da4){for(var _0x227942 in _0x1f4da4){_0x1b7ec6[_0x227942]=_0x1f4da4[_0x227942];}_0x1b7ec6['emit'](_0x265d('0xb'));});_0x2e4711['on'](_0x265d('0xc'),function(_0x2badfd){if(_0x2badfd[_0x265d('0xd')]()==_0x265d('0xe')){_0x1b7ec6[_0x265d('0xf')](_0x265d('0xe'));return;}if(_0x2badfd[_0x265d('0x10')](0x0,0xb)==_0x265d('0x11')){_0x1ab8e7=!![];}if(_0x1ab8e7){_0x43d3fd['rx']+=_0x2badfd+'\x0a';if(_0x2badfd[_0x265d('0x12')](_0x265d('0x13'))!=-0x1){_0x1ab8e7=![];}}else{_0x43d3fd['rx']=_0x2badfd;}if(_0x1ab8e7){return;}if(typeof _0x43d3fd['cb']==_0x265d('0x14')){var _0x4cb07f=_0x43d3fd['rx'][_0x265d('0x10')](0x0,0x3),_0x5bf031=null,_0x88cc54=null;_0x4cb07f=parseInt(_0x4cb07f);if(isNaN(_0x4cb07f)){_0x43d3fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x265d('0x15')});return;}if(_0x4cb07f!=0xc8){_0x43d3fd['cb'](null,{'code':_0x4cb07f,'result':-0x1,'extra':'KO'});return;}_0x5bf031=_0x43d3fd['rx']['substring'](0x4)[_0x265d('0x16')](_0x265d('0x17'),'');if(_0x5bf031[_0x265d('0x18')]('\x20')!=-0x1){_0x5bf031=_0x5bf031[_0x265d('0x19')](0x0,_0x5bf031[_0x265d('0x18')]('\x20'));}if(_[_0x265d('0x1a')](_0x5bf031,'-1')){_0x5bf031=parseInt(_0x5bf031);}_0x88cc54=_0x43d3fd['rx']['split']('\x20');if(_0x88cc54['length']==0x3){_0x88cc54=_0x88cc54[0x2][_0x265d('0x10')](0x1,_0x88cc54[0x2][_0x265d('0x1b')]-0x1);}else if(_0x88cc54[_0x265d('0x1b')]>0x3){var _0x4f1216=/\((.+)\)/;var _0x544f46=_0x43d3fd['rx']['match'](_0x4f1216);if(_0x544f46){_0x88cc54=_0x544f46[0x1];}else{_0x88cc54=null;}}else{_0x88cc54=null;}_0x43d3fd['cb'](null,{'code':_0x4cb07f,'result':_0x5bf031,'extra':_0x88cc54});}});_0x33ee30['on']('error',function(_0x2f444e){_0x1b7ec6[_0x265d('0xf')](_0x265d('0x1c'),new AGIError(_0x265d('0x1d'),_0x2f444e[_0x265d('0x1e')]));});_0x33ee30['on'](_0x265d('0x1f'),function(){_0x1b7ec6['emit'](_0x265d('0x1f'),new AGIError(_0x265d('0x20')));});_0x33ee30['on'](_0x265d('0x21'),function(){_0x1b7ec6[_0x265d('0xf')](_0x265d('0x21'),new AGIError(_0x265d('0x22')));_0x33ee30['destroy']();});_0x33ee30[_0x265d('0x23')](_0x2e4711);this[_0x265d('0x24')]=function(_0x4f22de,_0x4df20f){var _0x4f22de=_0x4f22de||'',_0x4df20f=typeof _0x4df20f==_0x265d('0x14')?_0x4df20f:new Function();_0x43d3fd={'tx':_0x4f22de,'rx':'','cb':_0x4df20f};_0x33ee30[_0x265d('0x25')](_0x4f22de+'\x0a');},this['close']=function(){_0x33ee30[_0x265d('0x26')]();};}util[_0x265d('0x27')](AGIChannel,EventEmitter);AGIChannel[_0x265d('0x28')]['sendRequest']=function(_0x322e9b){return this[_0x265d('0x24')]['sync'](this,_0x322e9b);};AGIChannel[_0x265d('0x28')][_0x265d('0x29')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x265d('0x28')]['getData']=function(_0x4c7730,_0x4a9bcf,_0x4a678e){_0x4c7730=_0x4c7730===undefined?_0x265d('0x2a'):_0x4c7730;_0x4a9bcf=_0x4a9bcf===undefined?'5':_0x4a9bcf;_0x4a678e=_0x4a678e===undefined?'1':_0x4a678e;return this[_0x265d('0x2b')](util[_0x265d('0x2c')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x4c7730,_0x4a9bcf*0x3e8,_0x4a678e));};AGIChannel[_0x265d('0x28')]['noop']=function(_0x3c7676){_0x3c7676=_0x3c7676||_0x265d('0x2d');return this['sendRequest'](util[_0x265d('0x2c')](_0x265d('0x2e'),_0x3c7676));};AGIChannel[_0x265d('0x28')][_0x265d('0x2f')]=function(_0x486a32,_0x3ae554){if(_[_0x265d('0x30')](_0x3ae554)){return this[_0x265d('0x2b')](util[_0x265d('0x2c')](_0x265d('0x31'),_0x486a32,_0x3ae554[_0x265d('0x32')](',')));}return this[_0x265d('0x2b')](util[_0x265d('0x2c')]('EXEC\x20%s\x20%s',_0x486a32,_0x3ae554));};AGIChannel[_0x265d('0x28')][_0x265d('0x33')]=function(_0x3ae173){return this[_0x265d('0x2b')](util[_0x265d('0x2c')](_0x265d('0x34'),_0x3ae173));};AGIChannel['prototype'][_0x265d('0x35')]=function(_0x23298e){return this['sendRequest'](util['format'](_0x265d('0x36'),_0x23298e));};AGIChannel[_0x265d('0x28')][_0x265d('0x37')]=function(_0x484a55){return this['sendRequest'](util[_0x265d('0x2c')](_0x265d('0x38'),_0x484a55));};AGIChannel['prototype'][_0x265d('0xe')]=function(){return this[_0x265d('0x2b')]('HANGUP');};AGIChannel['prototype'][_0x265d('0x39')]=function(_0xa7d0ac,_0x3472eb){var _0x59e6fb=_['isBoolean'](_0x3472eb)||_[_0x265d('0x3a')](_0x3472eb)?_0x3472eb[_0x265d('0x3b')]():_0x3472eb;return this[_0x265d('0x2b')](util[_0x265d('0x2c')](_0x265d('0x3c'),_0xa7d0ac,_0x59e6fb?_0x59e6fb[_0x265d('0x3b')]()[_0x265d('0x16')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x16fcf8,_0x1aef59){return this[_0x265d('0x2b')](util[_0x265d('0x2c')](_0x265d('0x3d'),_0x16fcf8,_0x1aef59));};AGIChannel[_0x265d('0x28')][_0x265d('0x3e')]=function(_0x1e329a,_0x5a83ef){return this[_0x265d('0x2b')](util[_0x265d('0x2c')](_0x265d('0x3f'),_0x1e329a,_0x5a83ef));};AGIChannel[_0x265d('0x28')][_0x265d('0x40')]=function(_0x552e16,_0x3920cb){return this['sendRequest'](util[_0x265d('0x2c')](_0x265d('0x41'),_0x552e16,_0x3920cb));};AGIChannel[_0x265d('0x28')]['continueAt']=function(_0x4c6772,_0x1f38e4,_0x4cd235){_0x1f38e4=_0x1f38e4||this['extension'];_0x4cd235=_0x4cd235||0x1;this[_0x265d('0x33')](_0x4c6772);this[_0x265d('0x35')](_0x1f38e4);this[_0x265d('0x37')](_0x4cd235);return this[_0x265d('0x42')](util[_0x265d('0x2c')](_0x265d('0x43'),_0x4c6772,_0x1f38e4,_0x4cd235));};AGIChannel[_0x265d('0x28')][_0x265d('0x44')]=function(_0x11f96f){return this[_0x265d('0x2b')](util[_0x265d('0x2c')](_0x265d('0x45'),_0x11f96f));};AGIChannel[_0x265d('0x28')][_0x265d('0x46')]=function(_0x58d63d,_0x44f2b1,_0x540451,_0x439c50,_0x362d9b,_0x16bc45){_0x44f2b1=_0x44f2b1||_0x265d('0x47');_0x540451=_0x540451||'';_0x439c50=_0x439c50===undefined?-0x1:_0x439c50==='-1'?-0x1:_0x439c50*0x3e8;_0x362d9b=_0x362d9b===undefined?'':'s='+_0x362d9b;_0x16bc45=_0x16bc45?'BEEP':'';return this['sendRequest'](util[_0x265d('0x2c')](_0x265d('0x48'),_0x58d63d,_0x44f2b1,_0x540451,_0x439c50,_0x16bc45,_0x362d9b));};AGIChannel[_0x265d('0x28')][_0x265d('0x49')]=function(_0x3d0384,_0x59e7ce){_0x59e7ce=_0x59e7ce||'';return this[_0x265d('0x2b')](util[_0x265d('0x2c')](_0x265d('0x4a'),_0x3d0384,_0x59e7ce));};AGIChannel[_0x265d('0x28')]['agi']=function(_0x19a9a6){return this[_0x265d('0x2f')](_0x265d('0x4b'),_0x19a9a6);};AGIChannel['prototype']['wait']=function(_0x2137ff){return this[_0x265d('0x2f')]('WAIT',_0x2137ff);};AGIChannel[_0x265d('0x28')]['error']=function(_0x3f7878,_0x16c6bd){this['noop'](util['format'](_0x265d('0x4c'),_0x3f7878['id'],_0x3f7878[_0x265d('0x4d')],_0x16c6bd));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x265d('0x4e')]=AGIChannel; \ No newline at end of file +var _0x3e94=['replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','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','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','utf8','setEncoding','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','substring','no\x20code','result=','substr','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest','ANSWER','getData','prototype','format','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22'];(function(_0x500fee,_0xb36dd){var _0x4a5133=function(_0x2b176a){while(--_0x2b176a){_0x500fee['push'](_0x500fee['shift']());}};_0x4a5133(++_0xb36dd);}(_0x3e94,0x67));var _0x43e9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x3e94[_0x3e5086];return _0xfeb102;};'use strict';var util=require(_0x43e9('0x0'));var _=require(_0x43e9('0x1'));var EventEmitter=require('events')[_0x43e9('0x2')];var AGIReply=require(_0x43e9('0x3'));var AGIError=require(_0x43e9('0x4'));function AGIChannel(_0x5a75f8){var _0x2e3b33=this,_0x42c806=new AGIReply(),_0x2fac0f=![],_0x50eacc={};EventEmitter[_0x43e9('0x5')](_0x2e3b33);_0x5a75f8['setEncoding'](_0x43e9('0x6'));_0x5a75f8['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x42c806[_0x43e9('0x7')](_0x43e9('0x6'));_0x42c806['on'](_0x43e9('0x8'),function(_0x510ee7){for(var _0x1cabf1 in _0x510ee7){_0x2e3b33[_0x1cabf1]=_0x510ee7[_0x1cabf1];}_0x2e3b33[_0x43e9('0x9')](_0x43e9('0xa'));});_0x42c806['on'](_0x43e9('0xb'),function(_0x3d2694){if(_0x3d2694[_0x43e9('0xc')]()==_0x43e9('0xd')){_0x2e3b33[_0x43e9('0x9')](_0x43e9('0xd'));return;}if(_0x3d2694['substring'](0x0,0xb)==_0x43e9('0xe')){_0x2fac0f=!![];}if(_0x2fac0f){_0x50eacc['rx']+=_0x3d2694+'\x0a';if(_0x3d2694[_0x43e9('0xf')](_0x43e9('0x10'))!=-0x1){_0x2fac0f=![];}}else{_0x50eacc['rx']=_0x3d2694;}if(_0x2fac0f){return;}if(typeof _0x50eacc['cb']=='function'){var _0xa95f9f=_0x50eacc['rx'][_0x43e9('0x11')](0x0,0x3),_0x46d512=null,_0x3ca672=null;_0xa95f9f=parseInt(_0xa95f9f);if(isNaN(_0xa95f9f)){_0x50eacc['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x43e9('0x12')});return;}if(_0xa95f9f!=0xc8){_0x50eacc['cb'](null,{'code':_0xa95f9f,'result':-0x1,'extra':'KO'});return;}_0x46d512=_0x50eacc['rx']['substring'](0x4)['replace'](_0x43e9('0x13'),'');if(_0x46d512['indexOf']('\x20')!=-0x1){_0x46d512=_0x46d512[_0x43e9('0x14')](0x0,_0x46d512[_0x43e9('0x15')]('\x20'));}if(_[_0x43e9('0x16')](_0x46d512,'-1')){_0x46d512=parseInt(_0x46d512);}_0x3ca672=_0x50eacc['rx'][_0x43e9('0x17')]('\x20');if(_0x3ca672[_0x43e9('0x18')]==0x3){_0x3ca672=_0x3ca672[0x2][_0x43e9('0x11')](0x1,_0x3ca672[0x2][_0x43e9('0x18')]-0x1);}else if(_0x3ca672[_0x43e9('0x18')]>0x3){var _0x3f7164=/\((.+)\)/;var _0x13ceac=_0x50eacc['rx'][_0x43e9('0x19')](_0x3f7164);if(_0x13ceac){_0x3ca672=_0x13ceac[0x1];}else{_0x3ca672=null;}}else{_0x3ca672=null;}_0x50eacc['cb'](null,{'code':_0xa95f9f,'result':_0x46d512,'extra':_0x3ca672});}});_0x5a75f8['on'](_0x43e9('0x1a'),function(_0x310476){_0x2e3b33[_0x43e9('0x9')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x310476[_0x43e9('0x1b')]));});_0x5a75f8['on'](_0x43e9('0x1c'),function(){_0x2e3b33[_0x43e9('0x9')](_0x43e9('0x1c'),new AGIError(_0x43e9('0x1d')));});_0x5a75f8['on']('timeout',function(){_0x2e3b33[_0x43e9('0x9')]('timeout',new AGIError(_0x43e9('0x1e')));_0x5a75f8[_0x43e9('0x1f')]();});_0x5a75f8[_0x43e9('0x20')](_0x42c806);this[_0x43e9('0x21')]=function(_0x448750,_0x536a70){var _0x448750=_0x448750||'',_0x536a70=typeof _0x536a70=='function'?_0x536a70:new Function();_0x50eacc={'tx':_0x448750,'rx':'','cb':_0x536a70};_0x5a75f8[_0x43e9('0x22')](_0x448750+'\x0a');},this[_0x43e9('0x1c')]=function(){_0x5a75f8[_0x43e9('0x1f')]();};}util[_0x43e9('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x43e9('0x24')]=function(_0x4ba987){return this[_0x43e9('0x21')]['sync'](this,_0x4ba987);};AGIChannel['prototype']['answer']=function(){return this['sendRequest'](_0x43e9('0x25'));};AGIChannel['prototype'][_0x43e9('0x26')]=function(_0xf0dbbf,_0x393136,_0x55a298){_0xf0dbbf=_0xf0dbbf===undefined?'beep':_0xf0dbbf;_0x393136=_0x393136===undefined?'5':_0x393136;_0x55a298=_0x55a298===undefined?'1':_0x55a298;return this[_0x43e9('0x24')](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xf0dbbf,_0x393136*0x3e8,_0x55a298));};AGIChannel[_0x43e9('0x27')]['noop']=function(_0x502f88){_0x502f88=_0x502f88||'NO\x20MESSAGE';return this[_0x43e9('0x24')](util[_0x43e9('0x28')]('VERBOSE\x20\x22%s\x22',_0x502f88));};AGIChannel[_0x43e9('0x27')]['exec']=function(_0x4191ff,_0x5777a8){if(_[_0x43e9('0x29')](_0x5777a8)){return this['sendRequest'](util['format'](_0x43e9('0x2a'),_0x4191ff,_0x5777a8[_0x43e9('0x2b')](',')));}return this[_0x43e9('0x24')](util[_0x43e9('0x28')](_0x43e9('0x2a'),_0x4191ff,_0x5777a8));};AGIChannel['prototype'][_0x43e9('0x2c')]=function(_0x4bdded){return this['sendRequest'](util[_0x43e9('0x28')](_0x43e9('0x2d'),_0x4bdded));};AGIChannel[_0x43e9('0x27')][_0x43e9('0x2e')]=function(_0x5e88bb){return this[_0x43e9('0x24')](util[_0x43e9('0x28')](_0x43e9('0x2f'),_0x5e88bb));};AGIChannel[_0x43e9('0x27')]['setPriority']=function(_0x23cb79){return this[_0x43e9('0x24')](util[_0x43e9('0x28')](_0x43e9('0x30'),_0x23cb79));};AGIChannel[_0x43e9('0x27')][_0x43e9('0xd')]=function(){return this[_0x43e9('0x24')]('HANGUP');};AGIChannel[_0x43e9('0x27')][_0x43e9('0x31')]=function(_0x2038c9,_0x42b436){var _0x3036df=_['isBoolean'](_0x42b436)||_[_0x43e9('0x32')](_0x42b436)?_0x42b436[_0x43e9('0x33')]():_0x42b436;return this[_0x43e9('0x24')](util['format'](_0x43e9('0x34'),_0x2038c9,_0x3036df?_0x3036df[_0x43e9('0x33')]()[_0x43e9('0x35')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x43e9('0x27')][_0x43e9('0x36')]=function(_0x5a33e4,_0x10a4cc){return this[_0x43e9('0x24')](util[_0x43e9('0x28')](_0x43e9('0x37'),_0x5a33e4,_0x10a4cc));};AGIChannel[_0x43e9('0x27')][_0x43e9('0x38')]=function(_0xd5a134,_0x330820){return this[_0x43e9('0x24')](util[_0x43e9('0x28')](_0x43e9('0x39'),_0xd5a134,_0x330820));};AGIChannel[_0x43e9('0x27')][_0x43e9('0x3a')]=function(_0x1d5500,_0x59f3c1){return this[_0x43e9('0x24')](util[_0x43e9('0x28')](_0x43e9('0x3b'),_0x1d5500,_0x59f3c1));};AGIChannel['prototype'][_0x43e9('0x3c')]=function(_0x44f944,_0x192aca,_0x33d2e4){_0x192aca=_0x192aca||this[_0x43e9('0x3d')];_0x33d2e4=_0x33d2e4||0x1;this[_0x43e9('0x2c')](_0x44f944);this['setExtension'](_0x192aca);this[_0x43e9('0x3e')](_0x33d2e4);return this[_0x43e9('0x3f')](util[_0x43e9('0x28')](_0x43e9('0x40'),_0x44f944,_0x192aca,_0x33d2e4));};AGIChannel[_0x43e9('0x27')][_0x43e9('0x41')]=function(_0x44ae75){return this[_0x43e9('0x24')](util[_0x43e9('0x28')](_0x43e9('0x42'),_0x44ae75));};AGIChannel['prototype']['recordFile']=function(_0x31689f,_0x15d96b,_0x235236,_0x1a3156,_0x41f250,_0x2c2724){_0x15d96b=_0x15d96b||_0x43e9('0x43');_0x235236=_0x235236||'';_0x1a3156=_0x1a3156===undefined?-0x1:_0x1a3156==='-1'?-0x1:_0x1a3156*0x3e8;_0x41f250=_0x41f250===undefined?'':'s='+_0x41f250;_0x2c2724=_0x2c2724?'BEEP':'';return this[_0x43e9('0x24')](util['format'](_0x43e9('0x44'),_0x31689f,_0x15d96b,_0x235236,_0x1a3156,_0x2c2724,_0x41f250));};AGIChannel[_0x43e9('0x27')][_0x43e9('0x45')]=function(_0x18ee87,_0x8b0325){_0x8b0325=_0x8b0325||'';return this[_0x43e9('0x24')](util[_0x43e9('0x28')](_0x43e9('0x46'),_0x18ee87,_0x8b0325));};AGIChannel[_0x43e9('0x27')]['agi']=function(_0xd16b61){return this[_0x43e9('0x47')](_0x43e9('0x48'),_0xd16b61);};AGIChannel[_0x43e9('0x27')][_0x43e9('0x49')]=function(_0xa13c51){return this['exec'](_0x43e9('0x4a'),_0xa13c51);};AGIChannel[_0x43e9('0x27')]['error']=function(_0x3e132d,_0xac3308){this[_0x43e9('0x3f')](util[_0x43e9('0x28')](_0x43e9('0x4b'),_0x3e132d['id'],_0x3e132d[_0x43e9('0x4c')],_0xac3308));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x43e9('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ea4e423..d5b5d6e 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 _0x2759=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x3cb615,_0x56c32c){var _0xc57961=function(_0x15aa7c){while(--_0x15aa7c){_0x3cb615['push'](_0x3cb615['shift']());}};_0xc57961(++_0x56c32c);}(_0x2759,0x10b));var _0x9275=function(_0x349883,_0x53efaa){_0x349883=_0x349883-0x0;var _0x47871e=_0x2759[_0x349883];return _0x47871e;};'use strict';var util=require(_0x9275('0x0'));var error={'E_AGI_UNDEFINED':_0x9275('0x1'),'E_AGI_ARGUMENT_PORT':_0x9275('0x2'),'E_AGI_SERVER_ERROR':_0x9275('0x3'),'E_AGI_SERVER_CLOSE':_0x9275('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x9275('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x9275('0x6'),'E_AGI_SOCKET_CLOSE':_0x9275('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x9275('0x8'),'E_AGI_COMMAND_EMPTY':_0x9275('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9275('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x106e40){var _0x106e40=_0x106e40||null,_0x4d731d=_0x4d731d||[],_0x26bf55=0x1,_0x507cc2='';if(!error[_0x106e40]){_0x106e40=_0x9275('0xb');}_0x4d731d[_0x9275('0xc')](error[_0x106e40]);while(arguments[_0x26bf55]){_0x4d731d[_0x9275('0xc')](arguments[_0x26bf55]);_0x26bf55++;}_0x507cc2=util[_0x9275('0xd')]['apply'](util,_0x4d731d);this[_0x9275('0xe')]=_0x507cc2;this[_0x9275('0xf')]=_0x106e40;}module['exports']=AGIError; \ No newline at end of file +var _0x725e=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x3e0d76,_0x45e005){var _0x42c91d=function(_0x29e0dd){while(--_0x29e0dd){_0x3e0d76['push'](_0x3e0d76['shift']());}};_0x42c91d(++_0x45e005);}(_0x725e,0x14b));var _0xe725=function(_0x2d87b9,_0x219dd8){_0x2d87b9=_0x2d87b9-0x0;var _0x1c6b78=_0x725e[_0x2d87b9];return _0x1c6b78;};'use strict';var util=require(_0xe725('0x0'));var error={'E_AGI_UNDEFINED':_0xe725('0x1'),'E_AGI_ARGUMENT_PORT':_0xe725('0x2'),'E_AGI_SERVER_ERROR':_0xe725('0x3'),'E_AGI_SERVER_CLOSE':_0xe725('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xe725('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xe725('0x6'),'E_AGI_SOCKET_ERROR':_0xe725('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xe725('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe725('0x9'),'E_AGI_IVR_ENTRY':_0xe725('0xa')};function AGIError(_0xb409c){var _0xb409c=_0xb409c||null,_0x5390d=_0x5390d||[],_0x13b624=0x1,_0x21841d='';if(!error[_0xb409c]){_0xb409c='E_AGI_UNDEFINED';}_0x5390d[_0xe725('0xb')](error[_0xb409c]);while(arguments[_0x13b624]){_0x5390d[_0xe725('0xb')](arguments[_0x13b624]);_0x13b624++;}_0x21841d=util['format'][_0xe725('0xc')](util,_0x5390d);this['message']=_0x21841d;this[_0xe725('0xd')]=_0xb409c;}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 5490a44..ba273ee 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 _0x1c76=['prototype','addVertex','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','getdigits','getsecretdigits','vertices','edges','numberOfEdges'];(function(_0x4f5a26,_0x310a1b){var _0x4ef286=function(_0xbe933d){while(--_0xbe933d){_0x4f5a26['push'](_0x4f5a26['shift']());}};_0x4ef286(++_0x310a1b);}(_0x1c76,0x1d9));var _0x61c7=function(_0x412c89,_0x10e591){_0x412c89=_0x412c89-0x0;var _0x5ae409=_0x1c76[_0x412c89];return _0x5ae409;};'use strict';var _=require(_0x61c7('0x0'));var logger=require(_0x61c7('0x1'))('agi');var verticesWithRetry=['menu',_0x61c7('0x2'),_0x61c7('0x3')];var Graph=function(){this[_0x61c7('0x4')]={};this[_0x61c7('0x5')]={};this[_0x61c7('0x6')]=0x0;};Graph[_0x61c7('0x7')][_0x61c7('0x8')]=function(_0x2d92ba){this[_0x61c7('0x4')][_0x2d92ba['id']]=_0x2d92ba;this[_0x61c7('0x5')][_0x2d92ba['id']]=[];};Graph[_0x61c7('0x7')]['addEdge']=function(_0x5370e3,_0x3cfc0e,_0x394885){this[_0x61c7('0x5')][_0x5370e3]['push']({'target':_0x3cfc0e,'condition':_0x394885});this[_0x61c7('0x6')]+=0x1;};Graph[_0x61c7('0x7')][_0x61c7('0x9')]=function(){return _[_0x61c7('0x9')](this[_0x61c7('0x4')]);};Graph[_0x61c7('0x7')][_0x61c7('0xa')]=function(){return this[_0x61c7('0x6')];};Graph[_0x61c7('0x7')][_0x61c7('0xb')]=function(_0x4ffb71){return this['vertices'][_0x4ffb71];};Graph[_0x61c7('0x7')][_0x61c7('0xc')]=function(_0x2c5ec5,_0x3fb392){if(!this[_0x61c7('0x4')][_0x2c5ec5]){return logger['info']('no\x20vertex\x20found');}var _0x4a419a=_0x3fb392(this[_0x61c7('0x4')][_0x2c5ec5]);if(!_0x4a419a){return logger[_0x61c7('0xd')](_0x61c7('0xe'));}if(this['edges'][_0x2c5ec5][_0x61c7('0xf')]===0x0){return logger[_0x61c7('0xd')](_0x61c7('0x10'));}for(var _0x5c4641=0x0,_0x37b9bf=[],_0x4d80a8=![];_0x5c4641\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','calleridname','evtHangup','toJson','mxGraphModel','root','agicommand','maxRetry','retry','addVertex','omit','mxCell','hasOwnProperty','length','target','addEdge','source','value','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','close','timeout','hangup','sync','production','stringify','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','start','clear','vertex','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','traverseBFS','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]','listening','xml2json','lodash','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','port'];(function(_0x1b328c,_0xc4bffa){var _0x23400e=function(_0x4975d7){while(--_0x4975d7){_0x1b328c['push'](_0x1b328c['shift']());}};_0x23400e(++_0xc4bffa);}(_0x00e5,0xf6));var _0x500e=function(_0x4cacba,_0xd35143){_0x4cacba=_0x4cacba-0x0;var _0x475132=_0x00e5[_0x4cacba];return _0x475132;};'use strict';var parser=require(_0x500e('0x0'));var _=require(_0x500e('0x1'));var syncho=require(_0x500e('0x2'));var util=require('util');var moment=require(_0x500e('0x3'));var config=require(_0x500e('0x4'));var logger=require(_0x500e('0x5'))(_0x500e('0x6'));var utilLicense=require(_0x500e('0x7'));var rpc=require(_0x500e('0x8'));var mailRpc=require(_0x500e('0x9'));var Graph=require('./graph');var Vertices=require(_0x500e('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x500e('0x6')]=_[_0x500e('0xb')](config[_0x500e('0x6')],{'ip':_0x500e('0xc'),'port':0x11dd});function connectionHandler(_0x4a6c0e){process[_0x500e('0xd')](function(){syncho(function(){try{setChannelVariables(_0x4a6c0e);agiHandler(_0x4a6c0e);}catch(_0x48815d){logger[_0x500e('0xe')](_0x48815d[_0x500e('0xf')]);}});});}function listeningHandler(){console[_0x500e('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x500e('0x6')][_0x500e('0x11')]);logger[_0x500e('0x12')](util[_0x500e('0x13')](_0x500e('0x14'),config[_0x500e('0x6')]['ip'],config[_0x500e('0x6')][_0x500e('0x11')]));}function errorHandler(_0x164d58){if(_0x164d58&&_0x164d58['name']&&_0x164d58[_0x500e('0x15')]){logger[_0x500e('0xe')](util[_0x500e('0x13')](_0x500e('0x16'),_0x164d58[_0x500e('0x17')],_0x164d58['message']));}else{logger[_0x500e('0xe')](util['format'](_0x500e('0x18'),_0x164d58[_0x500e('0xf')]));}}function closeHandler(){logger[_0x500e('0x12')](util['format'](_0x500e('0x19'),this[_0x500e('0x1a')],this['calleridname'],this['callerid'],this[_0x500e('0x1b')],this[_0x500e('0x1c')]));try{createSquareReport(this);}catch(_0x22c4e0){logger[_0x500e('0xe')](_0x22c4e0[_0x500e('0xf')]);}}function timeoutHandler(){logger[_0x500e('0x12')](util['format'](_0x500e('0x1d'),this[_0x500e('0x1a')],this['calleridname'],this[_0x500e('0x1e')],this[_0x500e('0x1b')],this[_0x500e('0x1c')]));}function hangupHandler(){logger['info'](util[_0x500e('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x500e('0x1f')],this['callerid'],this[_0x500e('0x1b')],this[_0x500e('0x1c')]));this[_0x500e('0x20')]=!![];}function getRoot(_0x4b4ea4){return parser[_0x500e('0x21')](_0x4b4ea4,{'object':!![]})[_0x500e('0x22')][_0x500e('0x23')];}function addVertex(_0x26bae4,_0x45c737,_0x20ccbb){_0x45c737[_0x500e('0x24')]=_0x20ccbb;if(_0x45c737['hasOwnProperty']('retry')){_0x45c737[_0x500e('0x25')]=parseInt(_0x45c737[_0x500e('0x26')],0xa);}_0x26bae4[_0x500e('0x27')](_[_0x500e('0x28')](_0x45c737,_0x500e('0x29')));}function initGraph(_0x4d00ce,_0x39e5cd){var _0x12ecad=new Graph();for(var _0x527eb3 in _0x4d00ce){if(_0x4d00ce[_0x500e('0x2a')](_0x527eb3)){if(_['isArray'](_0x4d00ce[_0x527eb3])){for(var _0x2ad602=0x0;_0x2ad602<_0x4d00ce[_0x527eb3][_0x500e('0x2b')];_0x2ad602+=0x1){addVertex(_0x12ecad,_0x4d00ce[_0x527eb3][_0x2ad602],_0x527eb3);}}else{addVertex(_0x12ecad,_0x4d00ce[_0x527eb3],_0x527eb3);}}}for(var _0xb402a9=0x0;_0xb402a9<_0x39e5cd[_0x500e('0x2b')];_0xb402a9+=0x1){if(_0x39e5cd[_0xb402a9]['source']&&_0x39e5cd[_0xb402a9][_0x500e('0x2c')]){_0x12ecad[_0x500e('0x2d')](_0x39e5cd[_0xb402a9][_0x500e('0x2e')],_0x39e5cd[_0xb402a9][_0x500e('0x2c')],_0x39e5cd[_0xb402a9][_0x500e('0x2f')]);}}return _0x12ecad;}function getSquareProject(_0x1b3643,_0x38732d){rpc['getSquareProject'](_0x1b3643)[_0x500e('0x30')](function(_0x12ed67){_0x38732d(null,_0x12ed67);})[_0x500e('0x31')](function(_0x55cccb){_0x38732d(null,_0x55cccb);});}function createSquareReport(_0xf9dba5,_0x4ddb3f){rpc[_0x500e('0x32')](_0xf9dba5)[_0x500e('0x30')](function(_0x52f47a){if(_0x4ddb3f){_0x4ddb3f(null,_0x52f47a);}})[_0x500e('0x31')](function(_0x1f7303){if(_0x4ddb3f){_0x4ddb3f(null,_0x1f7303);}});}function setChannelVariables(_0x35c1c5){for(var _0x25fb9e in _0x35c1c5){if(_0x35c1c5[_0x500e('0x2a')](_0x25fb9e)){if(_0x25fb9e[_0x500e('0x33')](_0x500e('0x34'))===0x0){_0x35c1c5[_0x25fb9e[_0x500e('0x35')](0x4)]=_0x35c1c5[_0x25fb9e];delete _0x35c1c5[_0x25fb9e];}}}}function getLogFromObject(_0x225946){return util[_0x500e('0x36')](_0x225946,{'showHidden':![],'depth':null});}function agiHandler(_0x411521){var _0x10b9bc,_0x2920bb,_0x51d771,_0x1d9f3a,_0x5b3e15;logger[_0x500e('0x37')](_0x500e('0x38'),JSON['stringify'](_0x411521,null,0x2));logger[_0x500e('0x12')](util[_0x500e('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x411521['arg_1'],_0x411521[_0x500e('0x1f')],_0x411521['callerid'],_0x411521[_0x500e('0x1b')],_0x411521[_0x500e('0x1c')]));_0x411521['on'](_0x500e('0xe'),errorHandler);_0x411521['on'](_0x500e('0x39'),closeHandler);_0x411521['on'](_0x500e('0x3a'),timeoutHandler);_0x411521[_0x500e('0x20')]=![];_0x411521['on'](_0x500e('0x3b'),hangupHandler);var _0x1530ab=getSquareProject[_0x500e('0x3c')](null,_0x411521['arg_1']);if(_0x1530ab){if(_0x1530ab[_0x500e('0x3d')]){_0x10b9bc=getRoot(_0x1530ab[_0x500e('0x3d')]);if(_0x10b9bc&&_0x10b9bc['start']){logger[_0x500e('0x37')](_0x500e('0x23'),JSON[_0x500e('0x3e')](_0x10b9bc,null,0x2));_0x411521['joinAt']=moment()[_0x500e('0x13')](_0x500e('0x3f'));_0x2920bb=initGraph(_['omit'](_0x10b9bc,'mxCell'),_0x10b9bc['mxCell']);_0x51d771=new Vertices(_0x411521,rpc,mailRpc);logger[_0x500e('0x12')](util[_0x500e('0x13')](_0x500e('0x40'),_0x411521[_0x500e('0x1a')],_0x411521['calleridname'],_0x411521['callerid'],_0x411521['dnid'],_0x411521[_0x500e('0x1c')]));_0x2920bb['traverseBFS'](_0x10b9bc[_0x500e('0x41')]['id'],function(_0x39de32){try{_0x39de32=_0x51d771[_0x500e('0x42')](_0x39de32);logger[_0x500e('0x37')](_0x500e('0x43'),JSON[_0x500e('0x3e')](_0x39de32,null,0x2));if(_0x39de32[_0x500e('0x24')]==='gotoc'){logger[_0x500e('0x12')](_0x500e('0x44'));_0x411521[_0x500e('0x45')]=_0x39de32[_0x500e('0x45')]||_0x411521['context'];_0x411521[_0x500e('0x46')]=_0x39de32[_0x500e('0x46')];_0x411521[_0x500e('0x47')]=_0x39de32[_0x500e('0x47')]?_0x39de32[_0x500e('0x47')]-0x1:0x1;return null;}else if(_0x39de32&&_0x51d771[_0x39de32['agicommand']]){_0x5b3e15=_0x51d771[_0x39de32[_0x500e('0x24')]](_0x39de32);logger[_0x500e('0x12')](_0x500e('0x48'),JSON[_0x500e('0x3e')](_0x5b3e15,null,0x2));if(_0x5b3e15&&_0x5b3e15[_0x500e('0x49')]===AGI_CODE_SUCCESS&&_0x5b3e15['result']!==AGI_RESULT_ERROR&&!_0x411521[_0x500e('0x20')]){logger[_0x500e('0x37')](_0x500e('0x48'),getLogFromObject(_0x5b3e15));return _[_0x500e('0x4a')](_0x5b3e15['result'])?null:_0x5b3e15[_0x500e('0x4b')][_0x500e('0x4c')]();}else{logger['error'](_0x500e('0x48'),getLogFromObject(_0x5b3e15));return null;}}else{logger[_0x500e('0xe')](_0x500e('0x4d'));return null;}}catch(_0x497659){logger[_0x500e('0xe')](_0x497659[_0x500e('0xf')]);return null;}});if(_0x10b9bc[_0x500e('0x4e')]){logger[_0x500e('0x12')](util['format'](_0x500e('0x4f'),_0x411521[_0x500e('0x1a')],_0x411521[_0x500e('0x1f')],_0x411521[_0x500e('0x1e')],_0x411521['dnid'],_0x411521[_0x500e('0x1c')]));_0x2920bb[_0x500e('0x50')](_0x10b9bc[_0x500e('0x4e')]['id'],function(_0x5558c8){try{_0x5558c8=_0x51d771[_0x500e('0x42')](_0x5558c8);logger[_0x500e('0x37')]('vertex',JSON['stringify'](_0x5558c8,null,0x2));if(_0x5558c8&&_0x51d771[_0x5558c8[_0x500e('0x24')]]){_0x5b3e15=_0x51d771[_0x5558c8['agicommand']](_0x5558c8);if(_0x5b3e15){logger[_0x500e('0x37')]('response',getLogFromObject(_0x5b3e15));return _[_0x500e('0x4a')](_0x5b3e15[_0x500e('0x4b')])?null:_0x5b3e15[_0x500e('0x4b')][_0x500e('0x4c')]();}else{logger[_0x500e('0xe')](_0x500e('0x48'),getLogFromObject(_0x5b3e15));return null;}}else{logger['error'](_0x500e('0x4d'));return null;}}catch(_0x302769){logger[_0x500e('0xe')](_0x302769[_0x500e('0xf')]);return null;}});}logger['info'](util[_0x500e('0x13')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x411521[_0x500e('0x1a')],_0x411521[_0x500e('0x1f')],_0x411521['callerid'],_0x411521[_0x500e('0x1b')],_0x411521['uniqueid']));logger[_0x500e('0x12')](util[_0x500e('0x13')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x411521[_0x500e('0x45')],_0x411521[_0x500e('0x46')],parseInt(_0x411521[_0x500e('0x47')],0xa)+0x1));_0x411521[_0x500e('0x51')](_0x411521['context'],_0x411521[_0x500e('0x46')],parseInt(_0x411521[_0x500e('0x47')],0xa)+0x1);_0x411521[_0x500e('0x39')]();}}else{logger[_0x500e('0xe')](util[_0x500e('0x13')]('Project\x20%s\x20not\x20published',_0x411521[_0x500e('0x1a')]));_0x411521[_0x500e('0x51')](_0x411521[_0x500e('0x45')],_0x411521[_0x500e('0x46')],parseInt(_0x411521['priority'],0xa)+0x1);_0x411521[_0x500e('0x39')]();}}else{logger['error'](util[_0x500e('0x13')](_0x500e('0x52'),_0x411521[_0x500e('0x1a')]));_0x411521[_0x500e('0x51')](_0x411521['context'],_0x411521['extension'],parseInt(_0x411521[_0x500e('0x47')],0xa)+0x1);_0x411521[_0x500e('0x39')]();}}function main(){var _0x2394e6;return utilLicense[_0x500e('0x53')]()[_0x500e('0x30')](function(_0x485a2e){if(_0x485a2e){if(_0x485a2e[_0x500e('0x54')]){if(_0x485a2e[_0x500e('0x55')]&&_0x485a2e['callysquare']>0x0){logger[_0x500e('0x12')](util[_0x500e('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x485a2e[_0x500e('0x55')]));_0x2394e6=_0x485a2e['callysquare'];}else{logger[_0x500e('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2394e6=-0x1;}}})[_0x500e('0x31')](function(_0x1a7a0e){logger[_0x500e('0xe')](_0x500e('0x56'),_0x1a7a0e[_0x500e('0xf')]);})[_0x500e('0x4e')](function(){var _0xb40d2a=require('./server')(config[_0x500e('0x6')][_0x500e('0x11')],config[_0x500e('0x6')]['ip'],_0x2394e6);_0xb40d2a['on'](_0x500e('0xe'),errorHandler);_0xb40d2a['on'](_0x500e('0x57'),listeningHandler);_0xb40d2a['on']('connection',connectionHandler);_0xb40d2a['on'](_0x500e('0x39'),closeHandler);});}main(); \ No newline at end of file +var _0x0597=['./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','name','format','info','arg_1','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','addEdge','getSquareProject','then','catch','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util'];(function(_0x46824f,_0x81b265){var _0x56f9b8=function(_0x246128){while(--_0x246128){_0x46824f['push'](_0x46824f['shift']());}};_0x56f9b8(++_0x81b265);}(_0x0597,0x10c));var _0x7059=function(_0x48ef4d,_0x43e3d4){_0x48ef4d=_0x48ef4d-0x0;var _0x1b04cd=_0x0597[_0x48ef4d];return _0x1b04cd;};'use strict';var parser=require('xml2json');var _=require(_0x7059('0x0'));var syncho=require(_0x7059('0x1'));var util=require(_0x7059('0x2'));var moment=require(_0x7059('0x3'));var config=require(_0x7059('0x4'));var logger=require(_0x7059('0x5'))(_0x7059('0x6'));var utilLicense=require(_0x7059('0x7'));var rpc=require(_0x7059('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x7059('0x9'));var Vertices=require(_0x7059('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7059('0x6')]=_[_0x7059('0xb')](config[_0x7059('0x6')],{'ip':_0x7059('0xc'),'port':0x11dd});function connectionHandler(_0xf0fef6){process[_0x7059('0xd')](function(){syncho(function(){try{setChannelVariables(_0xf0fef6);agiHandler(_0xf0fef6);}catch(_0x2a2a8a){logger[_0x7059('0xe')](_0x2a2a8a[_0x7059('0xf')]);}});});}function listeningHandler(){console[_0x7059('0x10')](_0x7059('0x11'),config[_0x7059('0x6')][_0x7059('0x12')]);logger['info'](util['format'](_0x7059('0x13'),config[_0x7059('0x6')]['ip'],config[_0x7059('0x6')][_0x7059('0x12')]));}function errorHandler(_0x2190cc){if(_0x2190cc&&_0x2190cc['name']&&_0x2190cc[_0x7059('0x14')]){logger[_0x7059('0xe')](util['format']('[%s]\x20%s',_0x2190cc[_0x7059('0x15')],_0x2190cc[_0x7059('0x14')]));}else{logger[_0x7059('0xe')](util[_0x7059('0x16')]('[ERROR]\x20%s',_0x2190cc[_0x7059('0xf')]));}}function closeHandler(){logger[_0x7059('0x17')](util[_0x7059('0x16')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7059('0x18')],this['calleridname'],this[_0x7059('0x19')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x4f3c40){logger['error'](_0x4f3c40[_0x7059('0xf')]);}}function timeoutHandler(){logger[_0x7059('0x17')](util[_0x7059('0x16')](_0x7059('0x1a'),this[_0x7059('0x18')],this['calleridname'],this[_0x7059('0x19')],this[_0x7059('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x7059('0x17')](util[_0x7059('0x16')](_0x7059('0x1c'),this[_0x7059('0x18')],this['calleridname'],this['callerid'],this['dnid'],this[_0x7059('0x1d')]));this[_0x7059('0x1e')]=!![];}function getRoot(_0x749122){return parser[_0x7059('0x1f')](_0x749122,{'object':!![]})[_0x7059('0x20')][_0x7059('0x21')];}function addVertex(_0x5d2927,_0x4d173e,_0xbaa563){_0x4d173e['agicommand']=_0xbaa563;if(_0x4d173e[_0x7059('0x22')](_0x7059('0x23'))){_0x4d173e[_0x7059('0x24')]=parseInt(_0x4d173e[_0x7059('0x23')],0xa);}_0x5d2927[_0x7059('0x25')](_[_0x7059('0x26')](_0x4d173e,_0x7059('0x27')));}function initGraph(_0x2f89e4,_0x2195f9){var _0x13bacc=new Graph();for(var _0x2cec58 in _0x2f89e4){if(_0x2f89e4[_0x7059('0x22')](_0x2cec58)){if(_['isArray'](_0x2f89e4[_0x2cec58])){for(var _0x13731b=0x0;_0x13731b<_0x2f89e4[_0x2cec58]['length'];_0x13731b+=0x1){addVertex(_0x13bacc,_0x2f89e4[_0x2cec58][_0x13731b],_0x2cec58);}}else{addVertex(_0x13bacc,_0x2f89e4[_0x2cec58],_0x2cec58);}}}for(var _0x1a9f1c=0x0;_0x1a9f1c<_0x2195f9[_0x7059('0x28')];_0x1a9f1c+=0x1){if(_0x2195f9[_0x1a9f1c][_0x7059('0x29')]&&_0x2195f9[_0x1a9f1c][_0x7059('0x2a')]){_0x13bacc[_0x7059('0x2b')](_0x2195f9[_0x1a9f1c]['source'],_0x2195f9[_0x1a9f1c][_0x7059('0x2a')],_0x2195f9[_0x1a9f1c]['value']);}}return _0x13bacc;}function getSquareProject(_0x111ffe,_0x2130f1){rpc[_0x7059('0x2c')](_0x111ffe)[_0x7059('0x2d')](function(_0xc2157c){_0x2130f1(null,_0xc2157c);})[_0x7059('0x2e')](function(_0x28c86a){_0x2130f1(null,_0x28c86a);});}function createSquareReport(_0xe4b55e,_0x317c68){rpc['createSquareReport'](_0xe4b55e)[_0x7059('0x2d')](function(_0x769c1){if(_0x317c68){_0x317c68(null,_0x769c1);}})[_0x7059('0x2e')](function(_0x29e396){if(_0x317c68){_0x317c68(null,_0x29e396);}});}function setChannelVariables(_0x130cdf){for(var _0x5b779a in _0x130cdf){if(_0x130cdf[_0x7059('0x22')](_0x5b779a)){if(_0x5b779a[_0x7059('0x2f')](_0x7059('0x30'))===0x0){_0x130cdf[_0x5b779a[_0x7059('0x31')](0x4)]=_0x130cdf[_0x5b779a];delete _0x130cdf[_0x5b779a];}}}}function getLogFromObject(_0x3cd651){return util[_0x7059('0x32')](_0x3cd651,{'showHidden':![],'depth':null});}function agiHandler(_0x1112b6){var _0x1cb7de,_0x66e6ee,_0x5e4999,_0x41760d,_0x24bff2;logger[_0x7059('0x33')]('variables',JSON[_0x7059('0x34')](_0x1112b6,null,0x2));logger['info'](util[_0x7059('0x16')](_0x7059('0x35'),_0x1112b6[_0x7059('0x18')],_0x1112b6[_0x7059('0x36')],_0x1112b6['callerid'],_0x1112b6['dnid'],_0x1112b6['uniqueid']));_0x1112b6['on'](_0x7059('0xe'),errorHandler);_0x1112b6['on']('close',closeHandler);_0x1112b6['on'](_0x7059('0x37'),timeoutHandler);_0x1112b6[_0x7059('0x1e')]=![];_0x1112b6['on'](_0x7059('0x38'),hangupHandler);var _0x252c34=getSquareProject[_0x7059('0x39')](null,_0x1112b6['arg_1']);if(_0x252c34){if(_0x252c34['production']){_0x1cb7de=getRoot(_0x252c34[_0x7059('0x3a')]);if(_0x1cb7de&&_0x1cb7de[_0x7059('0x3b')]){logger[_0x7059('0x33')](_0x7059('0x21'),JSON[_0x7059('0x34')](_0x1cb7de,null,0x2));_0x1112b6[_0x7059('0x3c')]=moment()['format'](_0x7059('0x3d'));_0x66e6ee=initGraph(_[_0x7059('0x26')](_0x1cb7de,'mxCell'),_0x1cb7de['mxCell']);_0x5e4999=new Vertices(_0x1112b6,rpc,mailRpc);logger[_0x7059('0x17')](util[_0x7059('0x16')](_0x7059('0x3e'),_0x1112b6['arg_1'],_0x1112b6['calleridname'],_0x1112b6[_0x7059('0x19')],_0x1112b6[_0x7059('0x1b')],_0x1112b6[_0x7059('0x1d')]));_0x66e6ee[_0x7059('0x3f')](_0x1cb7de[_0x7059('0x3b')]['id'],function(_0x32793a){try{_0x32793a=_0x5e4999[_0x7059('0x40')](_0x32793a);logger[_0x7059('0x33')](_0x7059('0x41'),JSON['stringify'](_0x32793a,null,0x2));if(_0x32793a['agicommand']===_0x7059('0x42')){logger[_0x7059('0x17')](_0x7059('0x43'));_0x1112b6[_0x7059('0x44')]=_0x32793a['context']||_0x1112b6['context'];_0x1112b6[_0x7059('0x45')]=_0x32793a[_0x7059('0x45')];_0x1112b6[_0x7059('0x46')]=_0x32793a[_0x7059('0x46')]?_0x32793a[_0x7059('0x46')]-0x1:0x1;return null;}else if(_0x32793a&&_0x5e4999[_0x32793a[_0x7059('0x47')]]){_0x24bff2=_0x5e4999[_0x32793a[_0x7059('0x47')]](_0x32793a);logger[_0x7059('0x17')](_0x7059('0x48'),JSON[_0x7059('0x34')](_0x24bff2,null,0x2));if(_0x24bff2&&_0x24bff2[_0x7059('0x49')]===AGI_CODE_SUCCESS&&_0x24bff2[_0x7059('0x4a')]!==AGI_RESULT_ERROR&&!_0x1112b6['evtHangup']){logger[_0x7059('0x33')](_0x7059('0x48'),getLogFromObject(_0x24bff2));return _[_0x7059('0x4b')](_0x24bff2[_0x7059('0x4a')])?null:_0x24bff2['result'][_0x7059('0x4c')]();}else{logger[_0x7059('0xe')](_0x7059('0x48'),getLogFromObject(_0x24bff2));return null;}}else{logger[_0x7059('0xe')](_0x7059('0x4d'));return null;}}catch(_0x192778){logger[_0x7059('0xe')](_0x192778[_0x7059('0xf')]);return null;}});if(_0x1cb7de[_0x7059('0x4e')]){logger[_0x7059('0x17')](util[_0x7059('0x16')](_0x7059('0x4f'),_0x1112b6['arg_1'],_0x1112b6[_0x7059('0x36')],_0x1112b6['callerid'],_0x1112b6['dnid'],_0x1112b6['uniqueid']));_0x66e6ee['traverseBFS'](_0x1cb7de[_0x7059('0x4e')]['id'],function(_0x3f4322){try{_0x3f4322=_0x5e4999['clear'](_0x3f4322);logger[_0x7059('0x33')](_0x7059('0x41'),JSON['stringify'](_0x3f4322,null,0x2));if(_0x3f4322&&_0x5e4999[_0x3f4322[_0x7059('0x47')]]){_0x24bff2=_0x5e4999[_0x3f4322[_0x7059('0x47')]](_0x3f4322);if(_0x24bff2){logger[_0x7059('0x33')]('response',getLogFromObject(_0x24bff2));return _[_0x7059('0x4b')](_0x24bff2[_0x7059('0x4a')])?null:_0x24bff2[_0x7059('0x4a')]['toString']();}else{logger[_0x7059('0xe')]('response',getLogFromObject(_0x24bff2));return null;}}else{logger[_0x7059('0xe')](_0x7059('0x4d'));return null;}}catch(_0x149bdf){logger[_0x7059('0xe')](_0x149bdf[_0x7059('0xf')]);return null;}});}logger[_0x7059('0x17')](util[_0x7059('0x16')](_0x7059('0x50'),_0x1112b6[_0x7059('0x18')],_0x1112b6['calleridname'],_0x1112b6[_0x7059('0x19')],_0x1112b6[_0x7059('0x1b')],_0x1112b6['uniqueid']));logger[_0x7059('0x17')](util[_0x7059('0x16')](_0x7059('0x51'),_0x1112b6['context'],_0x1112b6[_0x7059('0x45')],parseInt(_0x1112b6[_0x7059('0x46')],0xa)+0x1));_0x1112b6[_0x7059('0x52')](_0x1112b6[_0x7059('0x44')],_0x1112b6[_0x7059('0x45')],parseInt(_0x1112b6[_0x7059('0x46')],0xa)+0x1);_0x1112b6[_0x7059('0x53')]();}}else{logger['error'](util[_0x7059('0x16')](_0x7059('0x54'),_0x1112b6[_0x7059('0x18')]));_0x1112b6[_0x7059('0x52')](_0x1112b6['context'],_0x1112b6['extension'],parseInt(_0x1112b6[_0x7059('0x46')],0xa)+0x1);_0x1112b6[_0x7059('0x53')]();}}else{logger[_0x7059('0xe')](util[_0x7059('0x16')](_0x7059('0x55'),_0x1112b6[_0x7059('0x18')]));_0x1112b6[_0x7059('0x52')](_0x1112b6[_0x7059('0x44')],_0x1112b6[_0x7059('0x45')],parseInt(_0x1112b6[_0x7059('0x46')],0xa)+0x1);_0x1112b6[_0x7059('0x53')]();}}function main(){var _0x4a663c;return utilLicense[_0x7059('0x56')]()[_0x7059('0x2d')](function(_0x5a9d52){if(_0x5a9d52){if(_0x5a9d52['voice']){if(_0x5a9d52['callysquare']&&_0x5a9d52[_0x7059('0x57')]>0x0){logger[_0x7059('0x17')](util[_0x7059('0x16')](_0x7059('0x58'),_0x5a9d52[_0x7059('0x57')]));_0x4a663c=_0x5a9d52['callysquare'];}else{logger[_0x7059('0x17')](_0x7059('0x59'));}}else{logger[_0x7059('0x17')](_0x7059('0x5a'));_0x4a663c=-0x1;}}})[_0x7059('0x2e')](function(_0x506680){logger[_0x7059('0xe')]('[LICENSE]',_0x506680[_0x7059('0xf')]);})[_0x7059('0x4e')](function(){var _0x54c82b=require(_0x7059('0x5b'))(config[_0x7059('0x6')][_0x7059('0x12')],config[_0x7059('0x6')]['ip'],_0x4a663c);_0x54c82b['on'](_0x7059('0xe'),errorHandler);_0x54c82b['on']('listening',listeningHandler);_0x54c82b['on']('connection',connectionHandler);_0x54c82b['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 743d530..ae11832 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 _0xe01d=['error','message','result','sendMailMessage','SendMail','bluebird','http','then'];(function(_0x45fb76,_0x35fd5d){var _0x338556=function(_0x526a58){while(--_0x526a58){_0x45fb76['push'](_0x45fb76['shift']());}};_0x338556(++_0x35fd5d);}(_0xe01d,0x17d));var _0xde01=function(_0x295a32,_0x541815){_0x295a32=_0x295a32-0x0;var _0x369a14=_0xe01d[_0x295a32];return _0x369a14;};'use strict';var BPromise=require(_0xde01('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xde01('0x1')]({'port':0x232b});function request(_0x4c8223,_0x3fe79c){return new BPromise(function(_0x48d80a,_0x240cea){return client['request'](_0x4c8223,_0x3fe79c)[_0xde01('0x2')](function(_0x44410b){if(_0x44410b['error']){return _0x240cea(_0x44410b[_0xde01('0x3')][_0xde01('0x4')]);}else{return _0x48d80a(_0x44410b[_0xde01('0x5')]);}})['catch'](function(_0x508fbe){return _0x240cea(_0x508fbe);});});}exports[_0xde01('0x6')]=function(_0x3e8df1,_0x5397c8){return request(_0xde01('0x7'),{'account':_0x3e8df1,'message':_0x5397c8});}; \ No newline at end of file +var _0x8260=['jayson/promise','client','then','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8260,0x10d));var _0x0826=function(_0x110e42,_0x134a3e){_0x110e42=_0x110e42-0x0;var _0x343f58=_0x8260[_0x110e42];return _0x343f58;};'use strict';var BPromise=require(_0x0826('0x0'));var jayson=require(_0x0826('0x1'));var client=jayson[_0x0826('0x2')]['http']({'port':0x232b});function request(_0x1bf2ba,_0x989d42){return new BPromise(function(_0x3afccb,_0x5833ce){return client['request'](_0x1bf2ba,_0x989d42)[_0x0826('0x3')](function(_0x1ab4bd){if(_0x1ab4bd['error']){return _0x5833ce(_0x1ab4bd['error'][_0x0826('0x4')]);}else{return _0x3afccb(_0x1ab4bd[_0x0826('0x5')]);}})[_0x0826('0x6')](function(_0x411824){return _0x5833ce(_0x411824);});});}exports[_0x0826('0x7')]=function(_0x150ed2,_0x3bb3bc){return request(_0x0826('0x8'),{'account':_0x150ed2,'message':_0x3bb3bc});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 2b26f8d..e2e5d2c 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 _0x2d65=['line','exports','util','stream','_localBuffer','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','slice','trim','emit','headers'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x2d65,0x1f2));var _0x52d6=function(_0x1dbd34,_0x1924f2){_0x1dbd34=_0x1dbd34-0x0;var _0x16d3d5=_0x2d65[_0x1dbd34];return _0x16d3d5;};'use strict';var util=require(_0x52d6('0x0'));var Transform=require(_0x52d6('0x1'))['Transform'];function AGIReply(_0x12c90f){Transform['call'](this,_0x12c90f);this[_0x52d6('0x2')]='';this[_0x52d6('0x3')]=![];}util[_0x52d6('0x4')](AGIReply,Transform);AGIReply[_0x52d6('0x5')]['_transform']=function(_0x202ef0,_0x4142c5,_0x15aa48){var _0x3d3acc='\x0a',_0x261f88=['\x0a\x0a',_0x52d6('0x6')],_0x5dcd93=-0x1,_0x2ec89e=-0x1,_0x18b4ab='',_0x5c04f3=0x0,_0x4a5e92='',_0x11a923='';this[_0x52d6('0x2')]+=_0x202ef0[_0x52d6('0x7')]();_0x4a5e92=this[_0x52d6('0x2')];if(!this[_0x52d6('0x3')]){_0x5c04f3=0x0;while(_0x261f88[_0x5c04f3]){while((_0x2ec89e=_0x4a5e92[_0x52d6('0x8')](_0x261f88[_0x5c04f3]))!=-0x1){_0x18b4ab=_0x261f88[_0x5c04f3];_0x11a923=_0x4a5e92[_0x52d6('0x9')](0x0,_0x2ec89e);_0x4a5e92=_0x4a5e92[_0x52d6('0x9')](_0x2ec89e+_0x18b4ab['length']);var _0x56294e=_0x11a923['split'](_0x3d3acc),_0x5ca70b=0x0,_0x17dcac={},_0x409d37='',_0x26827f='',_0x5d386f=-0x1;while(_0x56294e[_0x5ca70b]){_0x5d386f=_0x56294e[_0x5ca70b]['indexOf'](':');if(_0x5d386f!=-0x1){_0x409d37=_0x56294e[_0x5ca70b][_0x52d6('0xa')](0x0,_0x5d386f)[_0x52d6('0xb')]();_0x26827f=_0x56294e[_0x5ca70b][_0x52d6('0xa')](_0x5d386f+0x1)[_0x52d6('0xb')]();if(_0x409d37['length']>0x0){_0x17dcac[_0x409d37]=_0x26827f;}}else{}_0x5ca70b++;}this[_0x52d6('0xc')](_0x52d6('0xd'),_0x17dcac);this[_0x52d6('0x3')]=!![];}_0x5c04f3++;}this[_0x52d6('0x2')]=_0x4a5e92;}else{while((_0x5dcd93=_0x4a5e92[_0x52d6('0x8')](_0x3d3acc))!=-0x1){_0x11a923=_0x4a5e92[_0x52d6('0x9')](0x0,_0x5dcd93);this[_0x52d6('0xc')](_0x52d6('0xe'),_0x11a923);_0x4a5e92=_0x4a5e92[_0x52d6('0x9')](_0x5dcd93+_0x3d3acc['length']);}this[_0x52d6('0x2')]=_0x4a5e92;}_0x15aa48();};module[_0x52d6('0xf')]=AGIReply; \ No newline at end of file +var _0xe132=['length','split','indexOf','trim','headers','emit','line','exports','stream','call','_localBuffer','prototype','_transform','toString','substring'];(function(_0x5345c1,_0xec8c14){var _0x4d9f61=function(_0x2aafa3){while(--_0x2aafa3){_0x5345c1['push'](_0x5345c1['shift']());}};_0x4d9f61(++_0xec8c14);}(_0xe132,0xbc));var _0x2e13=function(_0x5af09d,_0x2fb244){_0x5af09d=_0x5af09d-0x0;var _0x536ee1=_0xe132[_0x5af09d];return _0x536ee1;};'use strict';var util=require('util');var Transform=require(_0x2e13('0x0'))['Transform'];function AGIReply(_0x306a84){Transform[_0x2e13('0x1')](this,_0x306a84);this[_0x2e13('0x2')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x2e13('0x3')][_0x2e13('0x4')]=function(_0x5386f1,_0x543e89,_0x5756f4){var _0x1d82a3='\x0a',_0x44e253=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x4349cd=-0x1,_0x3df3c3=-0x1,_0x1dded0='',_0x3a32e5=0x0,_0xd48bb2='',_0x5470c1='';this['_localBuffer']+=_0x5386f1[_0x2e13('0x5')]();_0xd48bb2=this[_0x2e13('0x2')];if(!this['_inBody']){_0x3a32e5=0x0;while(_0x44e253[_0x3a32e5]){while((_0x3df3c3=_0xd48bb2['indexOf'](_0x44e253[_0x3a32e5]))!=-0x1){_0x1dded0=_0x44e253[_0x3a32e5];_0x5470c1=_0xd48bb2[_0x2e13('0x6')](0x0,_0x3df3c3);_0xd48bb2=_0xd48bb2[_0x2e13('0x6')](_0x3df3c3+_0x1dded0[_0x2e13('0x7')]);var _0x1b1745=_0x5470c1[_0x2e13('0x8')](_0x1d82a3),_0x2b31d1=0x0,_0x17064e={},_0x41a751='',_0x54e956='',_0x26e491=-0x1;while(_0x1b1745[_0x2b31d1]){_0x26e491=_0x1b1745[_0x2b31d1][_0x2e13('0x9')](':');if(_0x26e491!=-0x1){_0x41a751=_0x1b1745[_0x2b31d1]['slice'](0x0,_0x26e491)[_0x2e13('0xa')]();_0x54e956=_0x1b1745[_0x2b31d1]['slice'](_0x26e491+0x1)['trim']();if(_0x41a751[_0x2e13('0x7')]>0x0){_0x17064e[_0x41a751]=_0x54e956;}}else{}_0x2b31d1++;}this['emit'](_0x2e13('0xb'),_0x17064e);this['_inBody']=!![];}_0x3a32e5++;}this[_0x2e13('0x2')]=_0xd48bb2;}else{while((_0x4349cd=_0xd48bb2[_0x2e13('0x9')](_0x1d82a3))!=-0x1){_0x5470c1=_0xd48bb2[_0x2e13('0x6')](0x0,_0x4349cd);this[_0x2e13('0xc')](_0x2e13('0xd'),_0x5470c1);_0xd48bb2=_0xd48bb2['substring'](_0x4349cd+_0x1d82a3[_0x2e13('0x7')]);}this[_0x2e13('0x2')]=_0xd48bb2;}_0x5756f4();};module[_0x2e13('0xe')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index fec0dd2..a8201ba 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 _0x3a15=['ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','util','jayson/promise','http','then','error','message','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage'];(function(_0x338611,_0x5402d4){var _0x12521f=function(_0x353b53){while(--_0x353b53){_0x338611['push'](_0x338611['shift']());}};_0x12521f(++_0x5402d4);}(_0x3a15,0xba));var _0x53a1=function(_0x411172,_0x5f3b53){_0x411172=_0x411172-0x0;var _0x489979=_0x3a15[_0x411172];return _0x489979;};'use strict';var BPromise=require(_0x53a1('0x0'));var moment=require(_0x53a1('0x1'));var _=require(_0x53a1('0x2'));var util=require(_0x53a1('0x3'));var jayson=require(_0x53a1('0x4'));var client=jayson['client'][_0x53a1('0x5')]({'port':0x2329});function request(_0xe09a2e,_0x28d439){return new BPromise(function(_0x18cd55,_0x57e4a0){return client['request'](_0xe09a2e,_0x28d439)[_0x53a1('0x6')](function(_0x3606f3){if(_0x3606f3[_0x53a1('0x7')]){return _0x57e4a0(_0x3606f3['error'][_0x53a1('0x8')]);}else{return _0x18cd55(_0x3606f3[_0x53a1('0x9')]);}})[_0x53a1('0xa')](function(_0x1f6fd3){return _0x57e4a0(_0x1f6fd3);});});}exports[_0x53a1('0xb')]=function(_0x102a92){return request(_0x53a1('0xc'),{'options':{'raw':![],'where':{'name':_0x102a92},'attributes':['production']}});};exports[_0x53a1('0xd')]=function(_0x50f7d4){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x50f7d4},'include':[{'model':_0x53a1('0xe'),'as':_0x53a1('0xf')}],'attributes':['id',_0x53a1('0x10'),_0x53a1('0x11')]}});};exports[_0x53a1('0x12')]=function(_0x22919f){return request(_0x53a1('0xc'),{'options':{'where':{'id':_0x22919f},'attributes':[_0x53a1('0x10')]}});};exports[_0x53a1('0x13')]=function(_0x1ab38c){return request(_0x53a1('0x14'),{'options':{'where':{'id':_0x1ab38c},'attributes':[_0x53a1('0x10')]}});};exports['getVariableById']=function(_0x2d0403){return request(_0x53a1('0x15'),{'options':{'where':{'id':_0x2d0403},'attributes':[_0x53a1('0x10')]}});};exports[_0x53a1('0x16')]=function(_0x3f41e3){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3f41e3},'attributes':[_0x53a1('0x17')]}});};exports[_0x53a1('0x18')]=function(_0x23211f){return request(_0x53a1('0x19'),{'options':{'where':{'id':_0x23211f},'attributes':[_0x53a1('0x10')]}});};exports['getTrunkById']=function(_0x3cd4f9){return request(_0x53a1('0x1a'),{'options':{'where':{'id':_0x3cd4f9},'attributes':[_0x53a1('0x10')]}});};exports[_0x53a1('0x1b')]=function(_0x3e2b02){return request('ShowSound',{'options':{'where':{'id':_0x3e2b02},'attributes':[_0x53a1('0x1c')]}});};exports[_0x53a1('0x1d')]=function(_0x438708){return request(_0x53a1('0x1e'),{'options':{'raw':![],'where':{'id':_0x438708},'include':[{'model':_0x53a1('0x1f'),'as':_0x53a1('0x20')}]}});};exports[_0x53a1('0x21')]=function(_0x36e0de){return request(_0x53a1('0x22'),{'options':{'where':{'id':_0x36e0de},'attributes':['id',_0x53a1('0x10')]}});};exports[_0x53a1('0x23')]=function(_0x3a8edc){return request(_0x53a1('0x24'),{'body':_0x3a8edc});};exports[_0x53a1('0x25')]=function(_0x529b82){return request('CreateSquareDetailsReport',{'body':_0x529b82});};exports['createSquareReport']=function(_0x4d75e5){return request(_0x53a1('0x26'),{'body':_[_0x53a1('0x27')](_0x4d75e5,{'project_name':_0x4d75e5['arg_1'],'prev_project_name':_0x4d75e5['arg_2']||'','is_subproject':_0x4d75e5[_0x53a1('0x28')]?!![]:![],'leaveAt':moment()[_0x53a1('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x53a1('0x2a')]=function(_0x3b2a77){return request(_0x53a1('0x2b'),{'body':_0x3b2a77});};exports[_0x53a1('0x2c')]=function(_0x72a1ae){return request(_0x53a1('0x2d'),{'body':_0x72a1ae});};exports['createCmContact']=function(_0x4ca016){return request(_0x53a1('0x2e'),{'options':{'raw':![],'where':{'phone':_0x4ca016[_0x53a1('0x2f')],'ListId':_0x4ca016[_0x53a1('0x30')]}}})[_0x53a1('0x6')](function(_0x38a049){if(_0x38a049){return _0x38a049;}return request(_0x53a1('0x31'),{'body':_0x4ca016});});};exports[_0x53a1('0x32')]=function(_0x4bde4c){return request(_0x53a1('0x33'),{'options':{'where':{'id':_0x4bde4c},'attributes':[_0x53a1('0x10')]}});};exports['agentLogin']=function(_0x4c1819,_0x48ad65){return request(_0x53a1('0x34'),{'body':{'interface':_0x48ad65},'options':{'where':_0x4c1819}});};exports[_0x53a1('0x35')]=function(_0xc22ce2,_0x4644be,_0x118373){return request(_0x53a1('0x36'),{'body':{'type':_0x4644be,'uniqueid':_0x118373},'options':{'where':_0xc22ce2}});};exports[_0x53a1('0x37')]=function(_0x555673){return request(_0x53a1('0x38'),{'body':{},'options':{'where':_0x555673}});};exports[_0x53a1('0x39')]=function(_0x2d8067){return request('LogoutUser',{'body':{},'options':{'where':_0x2d8067}});}; \ No newline at end of file +var _0x3e8d=['createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','merge','format','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','then','CreateCmContact','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','bluebird','lodash','jayson/promise','client','http','request','error','message','result','catch','getSquareProject','Smtp','name','email','ShowSquareProject','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount'];(function(_0x50efff,_0x16022a){var _0x337538=function(_0x39cb02){while(--_0x39cb02){_0x50efff['push'](_0x50efff['shift']());}};_0x337538(++_0x16022a);}(_0x3e8d,0xe8));var _0xd3e8=function(_0x38fd32,_0x479b30){_0x38fd32=_0x38fd32-0x0;var _0x11a906=_0x3e8d[_0x38fd32];return _0x11a906;};'use strict';var BPromise=require(_0xd3e8('0x0'));var moment=require('moment');var _=require(_0xd3e8('0x1'));var util=require('util');var jayson=require(_0xd3e8('0x2'));var client=jayson[_0xd3e8('0x3')][_0xd3e8('0x4')]({'port':0x2329});function request(_0x22e01d,_0x130160){return new BPromise(function(_0xc339fd,_0x80d1af){return client[_0xd3e8('0x5')](_0x22e01d,_0x130160)['then'](function(_0x583d39){if(_0x583d39[_0xd3e8('0x6')]){return _0x80d1af(_0x583d39[_0xd3e8('0x6')][_0xd3e8('0x7')]);}else{return _0xc339fd(_0x583d39[_0xd3e8('0x8')]);}})[_0xd3e8('0x9')](function(_0x12d883){return _0x80d1af(_0x12d883);});});}exports[_0xd3e8('0xa')]=function(_0x44e4d5){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x44e4d5},'attributes':['production']}});};exports['getMailAccountById']=function(_0x4323b8){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4323b8},'include':[{'model':'MailServerOut','as':_0xd3e8('0xb')}],'attributes':['id',_0xd3e8('0xc'),_0xd3e8('0xd')]}});};exports['getSquareProjectById']=function(_0x5551a3){return request(_0xd3e8('0xe'),{'options':{'where':{'id':_0x5551a3},'attributes':[_0xd3e8('0xc')]}});};exports['getVoiceQueueById']=function(_0x222e69){return request(_0xd3e8('0xf'),{'options':{'where':{'id':_0x222e69},'attributes':[_0xd3e8('0xc')]}});};exports[_0xd3e8('0x10')]=function(_0x385d1a){return request(_0xd3e8('0x11'),{'options':{'where':{'id':_0x385d1a},'attributes':[_0xd3e8('0xc')]}});};exports[_0xd3e8('0x12')]=function(_0x25e1cf){return request(_0xd3e8('0x13'),{'options':{'where':{'id':_0x25e1cf},'attributes':[_0xd3e8('0x14')]}});};exports[_0xd3e8('0x15')]=function(_0x4e3eae){return request(_0xd3e8('0x16'),{'options':{'where':{'id':_0x4e3eae},'attributes':[_0xd3e8('0xc')]}});};exports[_0xd3e8('0x17')]=function(_0x15c83b){return request(_0xd3e8('0x18'),{'options':{'where':{'id':_0x15c83b},'attributes':[_0xd3e8('0xc')]}});};exports[_0xd3e8('0x19')]=function(_0x555119){return request(_0xd3e8('0x1a'),{'options':{'where':{'id':_0x555119},'attributes':[_0xd3e8('0x1b')]}});};exports[_0xd3e8('0x1c')]=function(_0x3c00aa){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3c00aa},'include':[{'model':_0xd3e8('0x1d'),'as':_0xd3e8('0x1e')}]}});};exports[_0xd3e8('0x1f')]=function(_0x554594){return request(_0xd3e8('0x20'),{'options':{'where':{'id':_0x554594},'attributes':['id',_0xd3e8('0xc')]}});};exports[_0xd3e8('0x21')]=function(_0xc6b1b0){return request(_0xd3e8('0x22'),{'body':_0xc6b1b0});};exports[_0xd3e8('0x23')]=function(_0x335ed9){return request('CreateSquareDetailsReport',{'body':_0x335ed9});};exports[_0xd3e8('0x24')]=function(_0x3f0fb5){return request('CreateSquareReport',{'body':_[_0xd3e8('0x25')](_0x3f0fb5,{'project_name':_0x3f0fb5['arg_1'],'prev_project_name':_0x3f0fb5['arg_2']||'','is_subproject':_0x3f0fb5['arg_2']?!![]:![],'leaveAt':moment()[_0xd3e8('0x26')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xd3e8('0x27')]=function(_0x45df52){return request('CreateSquareRecording',{'body':_0x45df52});};exports[_0xd3e8('0x28')]=function(_0xbaffed){return request(_0xd3e8('0x29'),{'body':_0xbaffed});};exports['createCmContact']=function(_0x3755ee){return request(_0xd3e8('0x2a'),{'options':{'raw':![],'where':{'phone':_0x3755ee[_0xd3e8('0x2b')],'ListId':_0x3755ee[_0xd3e8('0x2c')]}}})[_0xd3e8('0x2d')](function(_0x1553d0){if(_0x1553d0){return _0x1553d0;}return request(_0xd3e8('0x2e'),{'body':_0x3755ee});});};exports['getPauseById']=function(_0x159d14){return request('ShowPause',{'options':{'where':{'id':_0x159d14},'attributes':[_0xd3e8('0xc')]}});};exports[_0xd3e8('0x2f')]=function(_0x4cf7e8,_0x431476){return request(_0xd3e8('0x30'),{'body':{'interface':_0x431476},'options':{'where':_0x4cf7e8}});};exports[_0xd3e8('0x31')]=function(_0x1674c8,_0x4981bd,_0x3d9ecb){return request(_0xd3e8('0x32'),{'body':{'type':_0x4981bd,'uniqueid':_0x3d9ecb},'options':{'where':_0x1674c8}});};exports['agentUnpause']=function(_0x34f67f){return request(_0xd3e8('0x33'),{'body':{},'options':{'where':_0x34f67f}});};exports[_0xd3e8('0x34')]=function(_0x3b5c2b){return request('LogoutUser',{'body':{},'options':{'where':_0x3b5c2b}});}; \ 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 bda225c..c92cf26 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 _0x9fd4=['exports','./polly','./lex'];(function(_0x2e1da6,_0x41baf1){var _0x18a53a=function(_0x36966a){while(--_0x36966a){_0x2e1da6['push'](_0x2e1da6['shift']());}};_0x18a53a(++_0x41baf1);}(_0x9fd4,0x16c));var _0x49fd=function(_0x308ddd,_0x3a8401){_0x308ddd=_0x308ddd-0x0;var _0x3224c3=_0x9fd4[_0x308ddd];return _0x3224c3;};var polly=require(_0x49fd('0x0'));var lex=require(_0x49fd('0x1'));module[_0x49fd('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x6144=['./polly','./lex','exports'];(function(_0x4540c5,_0x2d1c1a){var _0x2ee268=function(_0x2b1661){while(--_0x2b1661){_0x4540c5['push'](_0x4540c5['shift']());}};_0x2ee268(++_0x2d1c1a);}(_0x6144,0x99));var _0x4614=function(_0x56d152,_0x70fee2){_0x56d152=_0x56d152-0x0;var _0x39a1b8=_0x6144[_0x56d152];return _0x39a1b8;};var polly=require(_0x4614('0x0'));var lex=require(_0x4614('0x1'));module[_0x4614('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 f57f93a..f7e3d56 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 _0x41bb=['exports','./lib/api'];(function(_0x531b3b,_0x534421){var _0x5b6a95=function(_0x493609){while(--_0x493609){_0x531b3b['push'](_0x531b3b['shift']());}};_0x5b6a95(++_0x534421);}(_0x41bb,0xc5));var _0xb41b=function(_0x1224b0,_0x2c826b){_0x1224b0=_0x1224b0-0x0;var _0x2b372a=_0x41bb[_0x1224b0];return _0x2b372a;};'use strict';var lex=require(_0xb41b('0x0'));module[_0xb41b('0x1')]=function(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333){return lex(_0x4ef2f1,_0x428431,_0x4d5578,_0x30ea75,_0x1c9d36,_0x148333);}; \ No newline at end of file +var _0x5c00=['./lib/api','exports'];(function(_0x4f7256,_0x181877){var _0x3a1058=function(_0x4bde88){while(--_0x4bde88){_0x4f7256['push'](_0x4f7256['shift']());}};_0x3a1058(++_0x181877);}(_0x5c00,0x17e));var _0x05c0=function(_0x2dc53c,_0x4a29ce){_0x2dc53c=_0x2dc53c-0x0;var _0x32ea88=_0x5c00[_0x2dc53c];return _0x32ea88;};'use strict';var lex=require(_0x05c0('0x0'));module[_0x05c0('0x1')]=function(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9){return lex(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9);}; \ 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 f8bf321..f82befb 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(_0x1236c3,_0x19c944){var _0x105c97=function(_0x501ceb){while(--_0x501ceb){_0x1236c3['push'](_0x1236c3['shift']());}};_0x105c97(++_0x19c944);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x20ac05,_0x39f25c){var _0xcc9683=function(_0x19f423){while(--_0x19f423){_0x20ac05['push'](_0x20ac05['shift']());}};_0xcc9683(++_0x39f25c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 dbc48ee..7dafccd 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 _0xb42b=['exports','./lib/api'];(function(_0x2a5fd9,_0x329a82){var _0x5a8f86=function(_0x45651c){while(--_0x45651c){_0x2a5fd9['push'](_0x2a5fd9['shift']());}};_0x5a8f86(++_0x329a82);}(_0xb42b,0xcf));var _0xbb42=function(_0x3e34bc,_0x1b4109){_0x3e34bc=_0x3e34bc-0x0;var _0x5b35eb=_0xb42b[_0x3e34bc];return _0x5b35eb;};'use strict';var polly=require(_0xbb42('0x0'));module[_0xbb42('0x1')]=function(_0x2a482c,_0x494270,_0x505351,_0x43f241,_0x2fc55e,_0x1f13b4,_0x443de9){return polly(_0x2a482c,_0x494270,_0x505351,_0x43f241,_0x2fc55e,_0x1f13b4,_0x443de9);}; \ No newline at end of file +var _0xf47b=['./lib/api','exports'];(function(_0x2493d5,_0x5e6fd9){var _0x2a0f23=function(_0x23b13c){while(--_0x23b13c){_0x2493d5['push'](_0x2493d5['shift']());}};_0x2a0f23(++_0x5e6fd9);}(_0xf47b,0xb6));var _0xbf47=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xf47b[_0x2b4411];return _0x8e41ef;};'use strict';var polly=require(_0xbf47('0x0'));module[_0xbf47('0x1')]=function(_0x286116,_0x4273c9,_0x364fb8,_0x59f2df,_0x3abb69,_0x5bebd8,_0x5adf84){return polly(_0x286116,_0x4273c9,_0x364fb8,_0x59f2df,_0x3abb69,_0x5bebd8,_0x5adf84);}; \ 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 eb17f96..85ec35f 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 _0xf9aa=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','bluebird'];(function(_0x220b3b,_0x4f8e95){var _0x3e41b9=function(_0x36f77b){while(--_0x36f77b){_0x220b3b['push'](_0x220b3b['shift']());}};_0x3e41b9(++_0x4f8e95);}(_0xf9aa,0x74));var _0xaf9a=function(_0x379a70,_0x367de6){_0x379a70=_0x379a70-0x0;var _0x3ddaa4=_0xf9aa[_0x379a70];return _0x3ddaa4;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xaf9a('0x0'));var rs=require(_0xaf9a('0x1'));var AWS=require(_0xaf9a('0x2'));function pollyResult(_0x4fb1a2,_0x42f67d,_0x272fd6){return new BPromise(function(_0x48e424,_0x2a4731){_0x4fb1a2[_0xaf9a('0x3')](_0x42f67d,function(_0x1265cc,_0x1e19a2){if(_0x1265cc){_0x2a4731(_0x1265cc);}else if(_0x1e19a2){if(_0x1e19a2[_0xaf9a('0x4')]instanceof Buffer){fs[_0xaf9a('0x5')](_0x272fd6,_0x1e19a2[_0xaf9a('0x4')],function(_0x2952e4){if(_0x2952e4){_0x2a4731(_0x2952e4);}else{_0x48e424();}});}else{_0x2a4731(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2a4731(new Error(_0xaf9a('0x6')));}});});}module[_0xaf9a('0x7')]=function(_0xcd47dc,_0x3a50ac,_0x4ab090,_0x3b4e47,_0x53bde2,_0x139eb4,_0x3c4f6d){var _0x2b69e2=new AWS[(_0xaf9a('0x8'))]({'accessKeyId':_0xcd47dc,'secretAccessKey':_0x3a50ac,'region':_0x4ab090});var _0x9d55b={'Text':_0x53bde2,'TextType':_0x139eb4||'text','OutputFormat':'mp3','VoiceId':_0x3b4e47};return pollyResult(_0x2b69e2,_0x9d55b,_0x3c4f6d);}; \ No newline at end of file +var _0xb0bb=['bluebird','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3'];(function(_0x2c570e,_0x54193d){var _0x7d031=function(_0x50f4b9){while(--_0x50f4b9){_0x2c570e['push'](_0x2c570e['shift']());}};_0x7d031(++_0x54193d);}(_0xb0bb,0x6c));var _0xbb0b=function(_0x1cacb1,_0xeb4784){_0x1cacb1=_0x1cacb1-0x0;var _0x25ee52=_0xb0bb[_0x1cacb1];return _0x25ee52;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xbb0b('0x0'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x29e576,_0x180d14,_0x36398c){return new BPromise(function(_0x4af0ff,_0x4db3ea){_0x29e576[_0xbb0b('0x1')](_0x180d14,function(_0x1905a8,_0x4e0a79){if(_0x1905a8){_0x4db3ea(_0x1905a8);}else if(_0x4e0a79){if(_0x4e0a79[_0xbb0b('0x2')]instanceof Buffer){fs['writeFile'](_0x36398c,_0x4e0a79['AudioStream'],function(_0x1ca9f3){if(_0x1ca9f3){_0x4db3ea(_0x1ca9f3);}else{_0x4af0ff();}});}else{_0x4db3ea(new Error(_0xbb0b('0x3')));}}else{_0x4db3ea(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x349f25,_0x13ea9a,_0x293996,_0x1587f6,_0x520f3c,_0x5e8dfe,_0x4c1623){var _0xc535f1=new AWS[(_0xbb0b('0x4'))]({'accessKeyId':_0x349f25,'secretAccessKey':_0x13ea9a,'region':_0x293996});var _0x5f4ec6={'Text':_0x520f3c,'TextType':_0x5e8dfe||'text','OutputFormat':_0xbb0b('0x5'),'VoiceId':_0x1587f6};return pollyResult(_0xc535f1,_0x5f4ec6,_0x4c1623);}; \ 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 8e8381f..37adc3f 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 _0x74b3=['exports'];(function(_0x4055a3,_0x3910b7){var _0x335572=function(_0x2a419e){while(--_0x2a419e){_0x4055a3['push'](_0x4055a3['shift']());}};_0x335572(++_0x3910b7);}(_0x74b3,0x68));var _0x374b=function(_0x1c33d2,_0x225db3){_0x1c33d2=_0x1c33d2-0x0;var _0x22664a=_0x74b3[_0x1c33d2];return _0x22664a;};'use strict';var asr=require('./lib/api');module[_0x374b('0x0')]=function(_0x46bf9a,_0x144ab7,_0x5f313e,_0x41fdf0){return asr(_0x46bf9a,_0x144ab7,_0x5f313e);}; \ No newline at end of file +var _0x0cec=['./lib/api'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x0cec,0x77));var _0xc0ce=function(_0x27e8e8,_0x16f16d){_0x27e8e8=_0x27e8e8-0x0;var _0x31a6a0=_0x0cec[_0x27e8e8];return _0x31a6a0;};'use strict';var asr=require(_0xc0ce('0x0'));module['exports']=function(_0x5d2342,_0x570783,_0x3775c5,_0x4925ab){return asr(_0x5d2342,_0x570783,_0x3775c5);}; \ 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 ad38e60..b233ec1 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 _0x4c4e=['LINEAR16','8000','url','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key='];(function(_0x2dd252,_0x34eb5c){var _0x296bd6=function(_0x8b9df3){while(--_0x8b9df3){_0x2dd252['push'](_0x2dd252['shift']());}};_0x296bd6(++_0x34eb5c);}(_0x4c4e,0x152));var _0xe4c4=function(_0x5dd2f3,_0xaaa6cd){_0x5dd2f3=_0x5dd2f3-0x0;var _0x2e04dd=_0x4c4e[_0x5dd2f3];return _0x2e04dd;};'use strict';var url=require(_0xe4c4('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xe4c4('0x1');module[_0xe4c4('0x2')]=function(_0xe3f2f,_0x58c8f6,_0x1b6c91){return new BPromise(function(_0x7d7655,_0x1a4483){var _0x4cd652;if(typeof _0xe3f2f!==_0xe4c4('0x3')||_0xe3f2f['length']===0x0){return _0x1a4483(_0xe4c4('0x4'));}if(typeof _0x58c8f6!==_0xe4c4('0x3')||_0x58c8f6[_0xe4c4('0x5')]===0x0){return _0x1a4483(_0xe4c4('0x6'));}if(typeof _0x1b6c91!==_0xe4c4('0x7')&&(typeof _0x1b6c91!==_0xe4c4('0x3')||_0x1b6c91[_0xe4c4('0x5')]===0x0)){return _0x1a4483(_0xe4c4('0x8'));}try{_0x4cd652=fs['readFileSync'](_0xe3f2f)['toString'](_0xe4c4('0x9'));}catch(_0x6f2545){return _0x1a4483(_0x6f2545);}return _0x7d7655({'method':_0xe4c4('0xa'),'uri':host+_0xe4c4('0xb')+_0x58c8f6,'body':{'config':{'encoding':_0xe4c4('0xc'),'sampleRateHertz':_0xe4c4('0xd'),'languageCode':_0x1b6c91},'audio':{'content':_0x4cd652}},'json':!![]});});}; \ No newline at end of file +var _0xae79=['readFileSync','toString','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0xae79,0x1d3));var _0x9ae7=function(_0x318269,_0x3ca8e7){_0x318269=_0x318269-0x0;var _0x2665fe=_0xae79[_0x318269];return _0x2665fe;};'use strict';var url=require(_0x9ae7('0x0'));var BPromise=require(_0x9ae7('0x1'));var fs=require('fs');var host=_0x9ae7('0x2');module[_0x9ae7('0x3')]=function(_0x1f75bc,_0x2cc556,_0x26b6a7){return new BPromise(function(_0x43f4d9,_0x988f5e){var _0x27817e;if(typeof _0x1f75bc!==_0x9ae7('0x4')||_0x1f75bc[_0x9ae7('0x5')]===0x0){return _0x988f5e(_0x9ae7('0x6'));}if(typeof _0x2cc556!==_0x9ae7('0x4')||_0x2cc556[_0x9ae7('0x5')]===0x0){return _0x988f5e('key\x20should\x20be\x20a\x20string');}if(typeof _0x26b6a7!==_0x9ae7('0x7')&&(typeof _0x26b6a7!==_0x9ae7('0x4')||_0x26b6a7[_0x9ae7('0x5')]===0x0)){return _0x988f5e(_0x9ae7('0x8'));}try{_0x27817e=fs[_0x9ae7('0x9')](_0x1f75bc)[_0x9ae7('0xa')]('base64');}catch(_0x410529){return _0x988f5e(_0x410529);}return _0x43f4d9({'method':'POST','uri':host+_0x9ae7('0xb')+_0x2cc556,'body':{'config':{'encoding':_0x9ae7('0xc'),'sampleRateHertz':_0x9ae7('0xd'),'languageCode':_0x26b6a7},'audio':{'content':_0x27817e}},'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 f4a1158..9046e08 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 _0x8e9e=['./asr','exports'];(function(_0x40550f,_0x4fc7e5){var _0x27304d=function(_0x3a43cf){while(--_0x3a43cf){_0x40550f['push'](_0x40550f['shift']());}};_0x27304d(++_0x4fc7e5);}(_0x8e9e,0x9a));var _0xe8e9=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0x8e9e[_0x1505e5];return _0x5b1dcd;};var asr=require(_0xe8e9('0x0'));module[_0xe8e9('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe829=['exports'];(function(_0x3934d5,_0x490c81){var _0x41165a=function(_0x514ad1){while(--_0x514ad1){_0x3934d5['push'](_0x3934d5['shift']());}};_0x41165a(++_0x490c81);}(_0xe829,0x1ac));var _0x9e82=function(_0xfb3b3,_0x10db7a){_0xfb3b3=_0xfb3b3-0x0;var _0x36cae7=_0xe829[_0xfb3b3];return _0x36cae7;};var asr=require('./asr');module[_0x9e82('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 9d5a1e7..2968103 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 _0x2442=['displayName','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','.wav','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','http','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','error','end','protocol','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','tmp','generate','base64','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3','text:synthesize','POST','then','resolve','.mp3','from','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','result','action','actionIncomplete','fulfillment','score','metadata','endConversation','isFallbackIntent','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','name','intent'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2442,0x1bb));var _0x2244=function(_0x447725,_0x49753b){_0x447725=_0x447725-0x0;var _0x399167=_0x2442[_0x447725];return _0x399167;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x2244('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x2244('0x1'));var https=require('https');var md5=require(_0x2244('0x2'));var path=require(_0x2244('0x3'));var querystring=require(_0x2244('0x4'));var rp=require(_0x2244('0x5'));var rs=require(_0x2244('0x6'));var sox=require(_0x2244('0x7'));var tts=require(_0x2244('0x8'));var urlParse=require('url')[_0x2244('0x9')];var util=require(_0x2244('0xa'));var aws=require(_0x2244('0xb'));var google=require(_0x2244('0xc'));var sestek=require(_0x2244('0xd'));var tilde=require('./tilde');var logger=require(_0x2244('0xe'))(_0x2244('0xf'));var ISPEECH_API=_0x2244('0x10');function downloadFile(_0x417e3a,_0x5bae79){return new BPromise(function(_0x4d14b3,_0x560b1f){var _0x30d035=urlParse(_0x417e3a);var _0x10f7e6=_0x30d035['protocol']===_0x2244('0x11')?https:http;var _0x6e6dbc={'host':_0x30d035[_0x2244('0x12')],'path':_0x30d035[_0x2244('0x3')],'headers':{'user-agent':_0x2244('0x13')}};_0x10f7e6[_0x2244('0x14')](_0x6e6dbc,function(_0xc42e6e){if(_0xc42e6e[_0x2244('0x15')]!==0xc8){logger['error'](_0x2244('0x16')+_0x417e3a+_0x2244('0x17')+_0xc42e6e[_0x2244('0x15')]+'\x20('+_0xc42e6e['statusMessage']+')');_0x560b1f(new Error(_0x2244('0x16')+_0x417e3a+_0x2244('0x17')+_0xc42e6e['statusCode']+'\x20('+_0xc42e6e[_0x2244('0x18')]+')'));return;}var _0x2c5ade=fs[_0x2244('0x19')](_0x5bae79);_0x2c5ade['on'](_0x2244('0x1a'),function(){logger['info'](_0x2244('0x1b'));_0x2c5ade[_0x2244('0x1c')](_0x4d14b3);});_0x2c5ade['on']('error',function(_0x770be6){fs[_0x2244('0x1d')](_0x5bae79);logger['error'](_0x2244('0x1e'),_0x770be6);_0x560b1f(_0x770be6);});_0xc42e6e['pipe'](_0x2c5ade);})['on'](_0x2244('0x1f'),function(_0x466413){logger[_0x2244('0x1f')](_0x466413);_0x560b1f(_0x466413);})[_0x2244('0x20')]();});}function uploadFile(_0x16513d){return new BPromise(function(_0xd749e3,_0x4bbe2f){var _0x3c9327=urlParse(_0x16513d);var _0x2afc51=_0x3c9327[_0x2244('0x21')]==='https:'?https:http;var _0x5c36c6={'host':_0x3c9327['host'],'path':_0x3c9327[_0x2244('0x3')],'headers':{'user-agent':_0x2244('0x13')}};_0x2afc51[_0x2244('0x14')](_0x5c36c6,function(_0x5eef72){if(_0x5eef72[_0x2244('0x15')]!==0xc8){_0x4bbe2f(new Error(_0x2244('0x16')+_0x16513d+_0x2244('0x17')+_0x5eef72['statusCode']+'\x20('+_0x5eef72[_0x2244('0x18')]+')'));return;}var _0x4da091='';_0x5eef72['on'](_0x2244('0x22'),function(_0x3f69c6){_0x4da091+=_0x3f69c6;});_0x5eef72['on'](_0x2244('0x20'),function(){_0xd749e3(_0x4da091);});})['on'](_0x2244('0x1f'),function(_0xd74e54){_0x4bbe2f(_0xd74e54);})['end']();});}function convertFile(_0x175012,_0x2e49b9){return new BPromise(function(_0x13c5dc,_0xed8edc){var _0x2ac135=sox[_0x2244('0x23')](_0x175012,_0x2e49b9,{'sampleRate':0x1f40,'format':_0x2244('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ac135['on'](_0x2244('0x1f'),function(_0x25402c){logger[_0x2244('0x1f')](_0x2244('0x25'),_0x25402c);_0xed8edc(_0x25402c);});_0x2ac135['on']('end',function(){logger[_0x2244('0x26')](_0x2244('0x27'));_0x13c5dc();});_0x2ac135[_0x2244('0x28')]();});}function base64Decode(_0x1b7bda,_0x121f9b){var _0x2a8065=path['resolve'](__dirname,_0x2244('0x29'),rs[_0x2244('0x2a')](0x4)+'.wav');fs['writeFileSync'](_0x2a8065,_0x1b7bda,_0x2244('0x2b'));return convertFile(_0x2a8065,_0x121f9b)['then'](function(){try{fs['unlink'](_0x2a8065);fs[_0x2244('0x2c')](_0x121f9b,_0x2244('0x2d'));}catch(_0x1bf59d){logger[_0x2244('0x1f')](_0x1bf59d);}return _0x121f9b['split']('.')[0x0];});}function base64Encode(_0x435385){var _0x27bc68=fs[_0x2244('0x2e')](_0x435385);return new Buffer(_0x27bc68)[_0x2244('0x2f')](_0x2244('0x2b'));}exports[_0x2244('0x30')]=function(_0x5889c1,_0x14085a,_0xfcdf75,_0x2a9a5a,_0x29d110,_0x3e2cd4){var _0x39f648,_0x186fb1;var _0x1e14c4=_0x2244('0x31');var _0x17580f=_0x2244('0x32')+_0x5889c1;var _0x5b3efc={};if(_0x14085a===_0x2244('0x33')){_0x5b3efc['input']={'ssml':_0xfcdf75};}else{_0x5b3efc['input']={'text':_0xfcdf75};};_0x5b3efc[_0x2244('0x34')]={'languageCode':_0x2a9a5a,'ssmlGender':_0x29d110};_0x5b3efc[_0x2244('0x35')]={'audioEncoding':_0x2244('0x36'),'sampleRateHertz':0x1f40};var _0x3e7710={'url':_0x1e14c4+_0x2244('0x37')+_0x17580f,'method':_0x2244('0x38'),'json':!![],'body':_0x5b3efc};return rp(_0x3e7710)[_0x2244('0x39')](function(_0x3e341e){return new BPromise(function(_0x28c529,_0x1ba602){_0x39f648=path[_0x2244('0x3a')](__dirname,'tmp',rs['generate'](0x4)+_0x2244('0x3b'));var _0x306106=Buffer[_0x2244('0x3c')](_0x3e341e['audioContent'],_0x2244('0x2b'));return fs[_0x2244('0x3d')](_0x39f648,_0x306106,function(_0x5dcada){_0x1ba602(_0x5dcada);},function(_0x3ff0f8){fs['chmodSync'](_0x39f648,_0x2244('0x2d'));_0x28c529(_0x3ff0f8);});});})[_0x2244('0x39')](function(_0x495bc8){_0x186fb1=path[_0x2244('0x3a')](__dirname,_0x2244('0x29'),rs['generate'](0x4)+'.wav');return convertFile(_0x39f648,_0x186fb1);})[_0x2244('0x39')](function(){try{fs[_0x2244('0x1d')](_0x39f648);fs['chmodSync'](_0x186fb1,'777');}catch(_0x204a54){logger['error'](_0x204a54);}logger[_0x2244('0x26')](_0x2244('0x3e'),_0x186fb1['split']('.')[0x0]);return _0x186fb1[_0x2244('0x3f')]('.')[0x0];});};exports[_0x2244('0x40')]=function(_0x53ed1e,_0x311529){var _0x1993e0=_0x2244('0x41');var _0x1dca34,_0x3dea54;var _0x2e62b6;var _0x516606={'encoding':_0x2244('0x42'),'method':'POST','timeout':0x2710,'url':_0x1993e0,'headers':{'Content-Type':_0x2244('0x43')},'body':'f.req='+encodeURIComponent(JSON[_0x2244('0x44')]([[[_0x2244('0x45'),JSON[_0x2244('0x44')]([_0x53ed1e,_0x311529||'en',![],_0x2244('0x46')]),null,_0x2244('0x47')]]]))};return rp(_0x516606)[_0x2244('0x39')](function(_0x1cf1ec){try{_0x2e62b6=eval(_0x1cf1ec['slice'](0x5))[0x0][0x2];}catch(_0x5b0034){throw new Error('parse\x20response\x20failed:\x0a'+_0x1cf1ec['data']);}if(!_0x2e62b6){if(_0x53ed1e[_0x2244('0x48')]>0xc8){throw new Error(_0x2244('0x49'));}else{throw new Error(_0x2244('0x4a')+_0x311529+_0x2244('0x4b'));}}try{_0x2e62b6=eval(_0x2e62b6)[0x0];}catch(_0x18f238){throw new Error(_0x2244('0x4c')+res[_0x2244('0x22')]);}const _0x5dd85d=_0x2e62b6;_0x1dca34=path[_0x2244('0x3a')](__dirname,_0x2244('0x29'),rs[_0x2244('0x2a')](0x4)+'.mp3');fs['writeFileSync'](_0x1dca34,_0x2e62b6,{'encoding':_0x2244('0x2b')});_0x3dea54=path[_0x2244('0x3a')](__dirname,_0x2244('0x29'),rs[_0x2244('0x2a')](0x4)+'.wav');return convertFile(_0x1dca34,_0x3dea54);})[_0x2244('0x39')](function(){try{fs[_0x2244('0x1d')](_0x1dca34);fs['chmodSync'](_0x3dea54,'777');}catch(_0x1a16ca){logger[_0x2244('0x1f')](_0x1a16ca);}logger['info'](_0x2244('0x4d'),_0x3dea54[_0x2244('0x3f')]('.')[0x0]);return _0x3dea54[_0x2244('0x3f')]('.')[0x0];});};exports['googleASR']=function(_0x344cc0,_0x5d8e8d,_0x282c69){return google[_0x2244('0x4e')](_0x344cc0,_0x5d8e8d,_0x282c69)[_0x2244('0x39')](function(_0xe0bfd4){logger[_0x2244('0x26')](_0xe0bfd4['uri']);return rp(_0xe0bfd4);})[_0x2244('0x39')](function(_0x5c4ff1){var _0x4579f1='';var _0x15c290=0x0;try{fs[_0x2244('0x1d')](_0x344cc0);}catch(_0x24c802){logger[_0x2244('0x1f')](_0x24c802);}if(_0x5c4ff1&&_0x5c4ff1[_0x2244('0x4f')]){_0x4579f1=_0x5c4ff1[_0x2244('0x4f')][_0x2244('0x50')](function(_0x4e2310){return _0x4e2310&&_0x4e2310[_0x2244('0x51')][0x0]&&_0x4e2310[_0x2244('0x51')][0x0][_0x2244('0x52')]?_0x4e2310[_0x2244('0x51')][0x0][_0x2244('0x52')]:'';})[_0x2244('0x53')]('\x0a');_0x15c290=_0x5c4ff1[_0x2244('0x4f')]['map'](function(_0x3aca10){return _0x3aca10&&_0x3aca10[_0x2244('0x51')][0x0]&&_0x3aca10[_0x2244('0x51')][0x0][_0x2244('0x54')]?_0x3aca10[_0x2244('0x51')][0x0][_0x2244('0x54')]:0x0;})[_0x2244('0x53')]('\x0a');}logger[_0x2244('0x26')](_0x2244('0x55'),_0x4579f1);logger[_0x2244('0x26')](_0x2244('0x56'),_0x15c290);return{'transcript':_0x4579f1,'confidence':_0x15c290};})[_0x2244('0x57')](function(_0x91ff05){logger[_0x2244('0x1f')](_0x2244('0x58'),_0x91ff05[_0x2244('0x15')],_0x91ff05['name'],_0x91ff05[_0x2244('0x59')]);});};exports[_0x2244('0x5a')]=function(_0x2b2b88,_0x3c5731,_0x102f93,_0x23dff7){var _0x5b9efc=apiai(_0x3c5731,{'language':_0x23dff7||'en'});return _0x5b9efc[_0x2244('0x5b')](_0x102f93,{'sessionId':md5(_0x2b2b88)})[_0x2244('0x39')](function(_0x46808a){logger['info'](JSON[_0x2244('0x44')](_0x46808a));return{'source':_0x46808a['result'][_0x2244('0x5c')],'resolvedQuery':_0x46808a['result']['resolvedQuery'],'action':_0x46808a[_0x2244('0x5d')][_0x2244('0x5e')],'actionIncomplete':_0x46808a[_0x2244('0x5d')][_0x2244('0x5f')],'speech':_0x46808a['result'][_0x2244('0x60')]['speech'],'score':_0x46808a[_0x2244('0x5d')][_0x2244('0x61')],'statusCode':_0x46808a['status']['code'],'endConversation':_0x46808a[_0x2244('0x5d')][_0x2244('0x62')][_0x2244('0x63')]||![],'isFallbackIntent':_0x46808a[_0x2244('0x5d')][_0x2244('0x62')][_0x2244('0x64')]};});};exports['googleDialogflowV2']=function(_0x50dc78,_0x2f8ad8,_0x43273b,_0x202050,_0x226f63,_0x2b3898){var _0x43d87f=_0x202050[_0x2244('0x65')](/\\n/g,'\x0a');var _0xbc78c8={'credentials':{'private_key':_0x43d87f,'client_email':_0x43273b}};var _0x32d0a0=new dialogflow['SessionsClient'](_0xbc78c8);var _0x50f9f9=_0x32d0a0['sessionPath'](_0x2f8ad8,md5(_0x50dc78));var _0x513232={'session':_0x50f9f9,'queryInput':{'text':{'text':_0x226f63,'languageCode':_0x2b3898}}};return _0x32d0a0[_0x2244('0x66')](_0x513232)[_0x2244('0x39')](function(_0xbd89bf){if(_0xbd89bf&&_0xbd89bf[_0x2244('0x48')]){logger['info'](_0x2244('0x67'),JSON[_0x2244('0x44')](_0xbd89bf));var _0xb6af29=_0xbd89bf[0x0];if(_0xb6af29){var _0x85379c={'action':_0xb6af29['queryResult'][_0x2244('0x5e')],'allRequiredParamsPresent':_0xb6af29[_0x2244('0x68')][_0x2244('0x69')],'endConversation':_0xb6af29[_0x2244('0x68')][_0x2244('0x6a')]&&_0xb6af29[_0x2244('0x68')][_0x2244('0x6a')][_0x2244('0x6b')]?_0xb6af29[_0x2244('0x68')][_0x2244('0x6a')][_0x2244('0x6b')][_0x2244('0x6c')][_0x2244('0x6d')]:![],'fulfillmentText':_0xb6af29[_0x2244('0x68')][_0x2244('0x6e')],'intentName':_0xb6af29[_0x2244('0x68')]['intent'][_0x2244('0x6f')],'intentDisplayName':_0xb6af29[_0x2244('0x68')][_0x2244('0x70')][_0x2244('0x71')],'isFallbackIntent':_0xb6af29['queryResult'][_0x2244('0x70')]['isFallback'],'languageCode':_0xb6af29[_0x2244('0x68')]['languageCode'],'queryText':_0xb6af29[_0x2244('0x68')][_0x2244('0x72')],'responseId':_0xb6af29['responseId'],'score':_0xb6af29[_0x2244('0x68')][_0x2244('0x73')],'speech':_0xb6af29['queryResult']['fulfillmentText'],'providerResponse':JSON['stringify'](_0xbd89bf)};return _0x85379c;}}});};exports[_0x2244('0x74')]=function(_0x557bd6,_0x4a91bd,_0x1ddb0f,_0x3d1277){return tilde[_0x2244('0x4e')](_0x557bd6,_0x4a91bd,_0x1ddb0f,_0x3d1277)['then'](function(_0x481069){try{fs[_0x2244('0x1d')](_0x557bd6);}catch(_0x52541a){logger[_0x2244('0x1f')](_0x52541a);}logger[_0x2244('0x26')](_0x2244('0x75'),_0x481069[_0x2244('0x52')]);logger[_0x2244('0x26')](_0x2244('0x76'),_0x481069['confidence']);return _0x481069;});};exports[_0x2244('0x77')]=function(_0x3a6877,_0x3f6216,_0x41be91,_0x2eac31,_0x239414,_0x437d7e){var _0x31f3fb=path[_0x2244('0x3a')](__dirname,_0x2244('0x29'),rs['generate'](0x4)+_0x2244('0x3b'));var _0xbd037e;return aws[_0x2244('0x78')](_0x3a6877,_0x3f6216,_0x41be91,_0x2eac31,_0x239414,_0x437d7e,_0x31f3fb)[_0x2244('0x39')](function(){_0xbd037e=path[_0x2244('0x3a')](__dirname,_0x2244('0x29'),rs['generate'](0x4)+_0x2244('0x79'));return convertFile(_0x31f3fb,_0xbd037e);})['then'](function(){try{fs[_0x2244('0x1d')](_0x31f3fb);fs['chmodSync'](_0xbd037e,_0x2244('0x2d'));}catch(_0x44fd4){logger[_0x2244('0x1f')](_0x44fd4);}return _0xbd037e[_0x2244('0x3f')]('.')[0x0];});};exports[_0x2244('0x7a')]=function(_0x2f0407,_0x407124,_0x304455,_0x32a58a,_0x3acb86,_0x58d56f){return aws[_0x2244('0x7b')](_0x2f0407,_0x407124,_0x304455,_0x32a58a,_0x3acb86,_0x58d56f)[_0x2244('0x39')](function(_0x3ee106){logger[_0x2244('0x26')](JSON[_0x2244('0x44')](_0x3ee106));return _0x3ee106;});};exports[_0x2244('0x7c')]=function(_0x2f5750,_0x252b17,_0x4bc64b,_0x1ad935){var _0xb358ae=util[_0x2244('0x7d')](_0x2244('0x7e'),ISPEECH_API,_0x2f5750,encodeURIComponent(_0x252b17),_0x4bc64b,_0x1ad935);var _0x50423e=path[_0x2244('0x3a')](__dirname,_0x2244('0x29'),rs[_0x2244('0x2a')](0x4)+'.mp3');var _0x4675da;return downloadFile(_0xb358ae,_0x50423e)[_0x2244('0x39')](function(){_0x4675da=path[_0x2244('0x3a')](__dirname,_0x2244('0x29'),rs[_0x2244('0x2a')](0x4)+_0x2244('0x79'));return convertFile(_0x50423e,_0x4675da);})[_0x2244('0x39')](function(){try{fs[_0x2244('0x1d')](_0x50423e);fs[_0x2244('0x2c')](_0x4675da,_0x2244('0x2d'));}catch(_0x294ce5){logger[_0x2244('0x1f')](_0x294ce5);}return _0x4675da[_0x2244('0x3f')]('.')[0x0];});};exports[_0x2244('0x7f')]=function(_0x3e01bc,_0x526cf7,_0x44f3cf,_0x469d07){var _0x1ca5b6=util[_0x2244('0x7d')](_0x2244('0x80'),ISPEECH_API,_0x526cf7,_0x44f3cf,base64Encode(_0x3e01bc),_0x469d07?util[_0x2244('0x7d')](_0x2244('0x81'),encodeURIComponent(_0x469d07)):_0x2244('0x82'));return uploadFile(_0x1ca5b6)[_0x2244('0x39')](function(_0x4484d1){return querystring[_0x2244('0x9')](_0x4484d1);});};exports[_0x2244('0x83')]=function(_0x51af39,_0x40cd7d){return sestek['nda'](_0x51af39,_0x40cd7d)[_0x2244('0x39')](function(_0x3a12b4){logger[_0x2244('0x26')](JSON[_0x2244('0x44')](_0x3a12b4));var _0x4171cb={'speech':_0x3a12b4[_0x2244('0x84')],'action':_0x3a12b4['channelData']?_0x3a12b4['channelData']['CustomAction']:undefined,'actiondata':_0x3a12b4[_0x2244('0x85')]?_0x3a12b4[_0x2244('0x85')][_0x2244('0x86')]:undefined};if(_0x3a12b4[_0x2244('0x85')]&&_0x3a12b4[_0x2244('0x85')][_0x2244('0x87')]){return base64Decode(_0x3a12b4[_0x2244('0x85')][_0x2244('0x87')][_0x2244('0x88')],path[_0x2244('0x3a')](__dirname,_0x2244('0x29'),rs['generate'](0x4)+_0x2244('0x79')))['then'](function(_0x86d8f3){_0x4171cb[_0x2244('0x89')]=_0x86d8f3;return _0x4171cb;});}return _0x4171cb;});};exports[_0x2244('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x303c=['diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','name','displayName','intent','isFallback','languageCode','responseId','intentDetectionConfidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','host','data','transcode','wav','error\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','split','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult'];(function(_0x146dd7,_0x4d877d){var _0x2af0bb=function(_0x2327bc){while(--_0x2327bc){_0x146dd7['push'](_0x146dd7['shift']());}};_0x2af0bb(++_0x4d877d);}(_0x303c,0x1cb));var _0xc303=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x303c[_0x3747ae];return _0x339035;};'use strict';var apiai=require(_0xc303('0x0'));var BPromise=require(_0xc303('0x1'));var dialogflow=require(_0xc303('0x2'));var fs=require('fs');var http=require(_0xc303('0x3'));var https=require(_0xc303('0x4'));var md5=require('md5');var path=require(_0xc303('0x5'));var querystring=require(_0xc303('0x6'));var rp=require(_0xc303('0x7'));var rs=require(_0xc303('0x8'));var sox=require(_0xc303('0x9'));var tts=require(_0xc303('0xa'));var urlParse=require(_0xc303('0xb'))[_0xc303('0xc')];var util=require(_0xc303('0xd'));var aws=require('./aws');var google=require(_0xc303('0xe'));var sestek=require(_0xc303('0xf'));var tilde=require(_0xc303('0x10'));var logger=require(_0xc303('0x11'))(_0xc303('0x12'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x3c525b,_0x140878){return new BPromise(function(_0x5f0387,_0x2bec91){var _0x4040d7=urlParse(_0x3c525b);var _0x566b98=_0x4040d7[_0xc303('0x13')]===_0xc303('0x14')?https:http;var _0xe2b389={'host':_0x4040d7['host'],'path':_0x4040d7[_0xc303('0x5')],'headers':{'user-agent':_0xc303('0x15')}};_0x566b98[_0xc303('0x16')](_0xe2b389,function(_0x3bb6a4){if(_0x3bb6a4[_0xc303('0x17')]!==0xc8){logger[_0xc303('0x18')](_0xc303('0x19')+_0x3c525b+'\x20failed,\x20status\x20code\x20=\x20'+_0x3bb6a4['statusCode']+'\x20('+_0x3bb6a4[_0xc303('0x1a')]+')');_0x2bec91(new Error(_0xc303('0x19')+_0x3c525b+_0xc303('0x1b')+_0x3bb6a4[_0xc303('0x17')]+'\x20('+_0x3bb6a4[_0xc303('0x1a')]+')'));return;}var _0x58e0df=fs['createWriteStream'](_0x140878);_0x58e0df['on'](_0xc303('0x1c'),function(){logger[_0xc303('0x1d')](_0xc303('0x1e'));_0x58e0df[_0xc303('0x1f')](_0x5f0387);});_0x58e0df['on'](_0xc303('0x18'),function(_0x39a915){fs[_0xc303('0x20')](_0x140878);logger[_0xc303('0x18')](_0xc303('0x21'),_0x39a915);_0x2bec91(_0x39a915);});_0x3bb6a4[_0xc303('0x22')](_0x58e0df);})['on']('error',function(_0x321602){logger[_0xc303('0x18')](_0x321602);_0x2bec91(_0x321602);})[_0xc303('0x23')]();});}function uploadFile(_0x3a47f5){return new BPromise(function(_0x32d1df,_0x1eede6){var _0x15dc8d=urlParse(_0x3a47f5);var _0x2769d7=_0x15dc8d[_0xc303('0x13')]==='https:'?https:http;var _0x129cee={'host':_0x15dc8d[_0xc303('0x24')],'path':_0x15dc8d['path'],'headers':{'user-agent':_0xc303('0x15')}};_0x2769d7[_0xc303('0x16')](_0x129cee,function(_0x4872da){if(_0x4872da[_0xc303('0x17')]!==0xc8){_0x1eede6(new Error('request\x20to\x20'+_0x3a47f5+_0xc303('0x1b')+_0x4872da['statusCode']+'\x20('+_0x4872da['statusMessage']+')'));return;}var _0x93458a='';_0x4872da['on'](_0xc303('0x25'),function(_0xba3293){_0x93458a+=_0xba3293;});_0x4872da['on'](_0xc303('0x23'),function(){_0x32d1df(_0x93458a);});})['on']('error',function(_0x465da8){_0x1eede6(_0x465da8);})[_0xc303('0x23')]();});}function convertFile(_0x1d2802,_0x23ed55){return new BPromise(function(_0xd3c480,_0x3927ce){var _0x59655e=sox[_0xc303('0x26')](_0x1d2802,_0x23ed55,{'sampleRate':0x1f40,'format':_0xc303('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x59655e['on'](_0xc303('0x18'),function(_0x186c8e){logger[_0xc303('0x18')](_0xc303('0x28'),_0x186c8e);_0x3927ce(_0x186c8e);});_0x59655e['on'](_0xc303('0x23'),function(){logger['info']('finish\x20to\x20convert');_0xd3c480();});_0x59655e[_0xc303('0x29')]();});}function base64Decode(_0x323b0b,_0x5b96bb){var _0x727ad=path[_0xc303('0x2a')](__dirname,_0xc303('0x2b'),rs[_0xc303('0x2c')](0x4)+_0xc303('0x2d'));fs['writeFileSync'](_0x727ad,_0x323b0b,_0xc303('0x2e'));return convertFile(_0x727ad,_0x5b96bb)[_0xc303('0x2f')](function(){try{fs[_0xc303('0x20')](_0x727ad);fs[_0xc303('0x30')](_0x5b96bb,_0xc303('0x31'));}catch(_0x2f310f){logger[_0xc303('0x18')](_0x2f310f);}return _0x5b96bb['split']('.')[0x0];});}function base64Encode(_0x6da70c){var _0x420653=fs[_0xc303('0x32')](_0x6da70c);return new Buffer(_0x420653)[_0xc303('0x33')](_0xc303('0x2e'));}exports[_0xc303('0x34')]=function(_0x5f1b00,_0x44172e,_0x4b5c06,_0x9d7a2a,_0x1ab3ba,_0x3218d3){var _0x3a0bcb,_0x31c37b;var _0x3c49aa=_0xc303('0x35');var _0x468b03=_0xc303('0x36')+_0x5f1b00;var _0x3f3bd6={};if(_0x44172e==='ssml'){_0x3f3bd6[_0xc303('0x37')]={'ssml':_0x4b5c06};}else{_0x3f3bd6[_0xc303('0x37')]={'text':_0x4b5c06};};_0x3f3bd6[_0xc303('0x38')]={'languageCode':_0x9d7a2a,'ssmlGender':_0x1ab3ba};_0x3f3bd6[_0xc303('0x39')]={'audioEncoding':_0xc303('0x3a'),'sampleRateHertz':0x1f40};var _0x107e09={'url':_0x3c49aa+_0xc303('0x3b')+_0x468b03,'method':_0xc303('0x3c'),'json':!![],'body':_0x3f3bd6};return rp(_0x107e09)[_0xc303('0x2f')](function(_0x1c86d2){return new BPromise(function(_0x9df2ed,_0x5e0f12){_0x3a0bcb=path[_0xc303('0x2a')](__dirname,_0xc303('0x2b'),rs[_0xc303('0x2c')](0x4)+'.mp3');var _0x2b335f=Buffer[_0xc303('0x3d')](_0x1c86d2[_0xc303('0x3e')],_0xc303('0x2e'));return fs[_0xc303('0x3f')](_0x3a0bcb,_0x2b335f,function(_0x1b8d65){_0x5e0f12(_0x1b8d65);},function(_0x4d8207){fs['chmodSync'](_0x3a0bcb,_0xc303('0x31'));_0x9df2ed(_0x4d8207);});});})[_0xc303('0x2f')](function(_0x9b0d01){_0x31c37b=path['resolve'](__dirname,_0xc303('0x2b'),rs[_0xc303('0x2c')](0x4)+_0xc303('0x2d'));return convertFile(_0x3a0bcb,_0x31c37b);})[_0xc303('0x2f')](function(){try{fs[_0xc303('0x20')](_0x3a0bcb);fs[_0xc303('0x30')](_0x31c37b,_0xc303('0x31'));}catch(_0x272d15){logger[_0xc303('0x18')](_0x272d15);}logger[_0xc303('0x1d')]('googleCloudTTS\x20path',_0x31c37b[_0xc303('0x40')]('.')[0x0]);return _0x31c37b[_0xc303('0x40')]('.')[0x0];});};exports[_0xc303('0x41')]=function(_0xb1547f,_0x9a15c8){var _0x3f4e77='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x57cf8b,_0x44bca6;var _0x14fe47;var _0x5ef13c={'encoding':_0xc303('0x42'),'method':_0xc303('0x3c'),'timeout':0x2710,'url':_0x3f4e77,'headers':{'Content-Type':_0xc303('0x43')},'body':_0xc303('0x44')+encodeURIComponent(JSON['stringify']([[[_0xc303('0x45'),JSON[_0xc303('0x46')]([_0xb1547f,_0x9a15c8||'en',![],_0xc303('0x47')]),null,_0xc303('0x48')]]]))};return rp(_0x5ef13c)['then'](function(_0x58c3eb){try{_0x14fe47=eval(_0x58c3eb[_0xc303('0x49')](0x5))[0x0][0x2];}catch(_0x1725fa){throw new Error('parse\x20response\x20failed:\x0a'+_0x58c3eb['data']);}if(!_0x14fe47){if(_0xb1547f[_0xc303('0x4a')]>0xc8){throw new Error(_0xc303('0x4b'));}else{throw new Error(_0xc303('0x4c')+_0x9a15c8+_0xc303('0x4d'));}}try{_0x14fe47=eval(_0x14fe47)[0x0];}catch(_0x213cd9){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xc303('0x25')]);}const _0x51e06a=_0x14fe47;_0x57cf8b=path[_0xc303('0x2a')](__dirname,_0xc303('0x2b'),rs[_0xc303('0x2c')](0x4)+_0xc303('0x4e'));fs[_0xc303('0x4f')](_0x57cf8b,_0x14fe47,{'encoding':'base64'});_0x44bca6=path[_0xc303('0x2a')](__dirname,_0xc303('0x2b'),rs['generate'](0x4)+'.wav');return convertFile(_0x57cf8b,_0x44bca6);})[_0xc303('0x2f')](function(){try{fs[_0xc303('0x20')](_0x57cf8b);fs['chmodSync'](_0x44bca6,'777');}catch(_0x3af643){logger[_0xc303('0x18')](_0x3af643);}logger[_0xc303('0x1d')](_0xc303('0x50'),_0x44bca6[_0xc303('0x40')]('.')[0x0]);return _0x44bca6[_0xc303('0x40')]('.')[0x0];});};exports[_0xc303('0x51')]=function(_0x5011ec,_0x51d461,_0x14603e){return google[_0xc303('0x52')](_0x5011ec,_0x51d461,_0x14603e)[_0xc303('0x2f')](function(_0x35bcf4){logger[_0xc303('0x1d')](_0x35bcf4[_0xc303('0x53')]);return rp(_0x35bcf4);})[_0xc303('0x2f')](function(_0x4292fc){var _0x217646='';var _0x1fc1c1=0x0;try{fs[_0xc303('0x20')](_0x5011ec);}catch(_0x1d2c6b){logger[_0xc303('0x18')](_0x1d2c6b);}if(_0x4292fc&&_0x4292fc[_0xc303('0x54')]){_0x217646=_0x4292fc['results'][_0xc303('0x55')](function(_0xe22b1f){return _0xe22b1f&&_0xe22b1f[_0xc303('0x56')][0x0]&&_0xe22b1f[_0xc303('0x56')][0x0][_0xc303('0x57')]?_0xe22b1f[_0xc303('0x56')][0x0]['transcript']:'';})['join']('\x0a');_0x1fc1c1=_0x4292fc['results'][_0xc303('0x55')](function(_0x4e0de7){return _0x4e0de7&&_0x4e0de7[_0xc303('0x56')][0x0]&&_0x4e0de7[_0xc303('0x56')][0x0][_0xc303('0x58')]?_0x4e0de7[_0xc303('0x56')][0x0]['confidence']:0x0;})[_0xc303('0x59')]('\x0a');}logger[_0xc303('0x1d')]('googleASR\x20transcription',_0x217646);logger['info'](_0xc303('0x5a'),_0x1fc1c1);return{'transcript':_0x217646,'confidence':_0x1fc1c1};})[_0xc303('0x5b')](function(_0x11f9a5){logger[_0xc303('0x18')](_0xc303('0x5c'),_0x11f9a5[_0xc303('0x17')],_0x11f9a5['name'],_0x11f9a5[_0xc303('0x5d')]);});};exports[_0xc303('0x5e')]=function(_0x539a72,_0x4af50c,_0x4e90c0,_0xae764d){var _0xa660d9=apiai(_0x4af50c,{'language':_0xae764d||'en'});return _0xa660d9[_0xc303('0x5f')](_0x4e90c0,{'sessionId':md5(_0x539a72)})['then'](function(_0x3993a0){logger[_0xc303('0x1d')](JSON[_0xc303('0x46')](_0x3993a0));return{'source':_0x3993a0['result'][_0xc303('0x60')],'resolvedQuery':_0x3993a0['result'][_0xc303('0x61')],'action':_0x3993a0[_0xc303('0x62')][_0xc303('0x63')],'actionIncomplete':_0x3993a0[_0xc303('0x62')][_0xc303('0x64')],'speech':_0x3993a0['result'][_0xc303('0x65')][_0xc303('0x66')],'score':_0x3993a0['result']['score'],'statusCode':_0x3993a0['status']['code'],'endConversation':_0x3993a0[_0xc303('0x62')][_0xc303('0x67')][_0xc303('0x68')]||![],'isFallbackIntent':_0x3993a0['result'][_0xc303('0x67')][_0xc303('0x69')]};});};exports[_0xc303('0x6a')]=function(_0x2371f3,_0x2c5e91,_0x2dde59,_0x1ef511,_0x2501c1,_0x1ac891){var _0x4628bb=_0x1ef511[_0xc303('0x6b')](/\\n/g,'\x0a');var _0x1b7c65={'credentials':{'private_key':_0x4628bb,'client_email':_0x2dde59}};var _0x32b9db=new dialogflow[(_0xc303('0x6c'))](_0x1b7c65);var _0x54c2c7=_0x32b9db[_0xc303('0x6d')](_0x2c5e91,md5(_0x2371f3));var _0x4b596a={'session':_0x54c2c7,'queryInput':{'text':{'text':_0x2501c1,'languageCode':_0x1ac891}}};return _0x32b9db[_0xc303('0x6e')](_0x4b596a)[_0xc303('0x2f')](function(_0x51541b){if(_0x51541b&&_0x51541b[_0xc303('0x4a')]){logger[_0xc303('0x1d')](_0xc303('0x6f'),JSON['stringify'](_0x51541b));var _0x14a78d=_0x51541b[0x0];if(_0x14a78d){var _0x565dbd={'action':_0x14a78d[_0xc303('0x70')][_0xc303('0x63')],'allRequiredParamsPresent':_0x14a78d[_0xc303('0x70')]['allRequiredParamsPresent'],'endConversation':_0x14a78d['queryResult'][_0xc303('0x71')]&&_0x14a78d[_0xc303('0x70')][_0xc303('0x71')][_0xc303('0x72')]?_0x14a78d[_0xc303('0x70')][_0xc303('0x71')][_0xc303('0x72')][_0xc303('0x73')][_0xc303('0x74')]:![],'fulfillmentText':_0x14a78d[_0xc303('0x70')][_0xc303('0x75')],'intentName':_0x14a78d[_0xc303('0x70')]['intent'][_0xc303('0x76')],'intentDisplayName':_0x14a78d[_0xc303('0x70')]['intent'][_0xc303('0x77')],'isFallbackIntent':_0x14a78d[_0xc303('0x70')][_0xc303('0x78')][_0xc303('0x79')],'languageCode':_0x14a78d[_0xc303('0x70')][_0xc303('0x7a')],'queryText':_0x14a78d[_0xc303('0x70')]['queryText'],'responseId':_0x14a78d[_0xc303('0x7b')],'score':_0x14a78d[_0xc303('0x70')][_0xc303('0x7c')],'speech':_0x14a78d['queryResult'][_0xc303('0x75')],'providerResponse':JSON[_0xc303('0x46')](_0x51541b)};return _0x565dbd;}}});};exports['tildeASR']=function(_0x22c3e8,_0x43bbde,_0xa11c51,_0x3b3a49){return tilde[_0xc303('0x52')](_0x22c3e8,_0x43bbde,_0xa11c51,_0x3b3a49)[_0xc303('0x2f')](function(_0x7b58fd){try{fs[_0xc303('0x20')](_0x22c3e8);}catch(_0x5690e2){logger[_0xc303('0x18')](_0x5690e2);}logger[_0xc303('0x1d')]('Tilde\x20ASR\x20transcription',_0x7b58fd[_0xc303('0x57')]);logger['info']('Tilde\x20ASR\x20confidence',_0x7b58fd['confidence']);return _0x7b58fd;});};exports[_0xc303('0x7d')]=function(_0x238029,_0x46da16,_0x151b5a,_0x41171a,_0x225c99,_0x511616){var _0x266b05=path[_0xc303('0x2a')](__dirname,_0xc303('0x2b'),rs[_0xc303('0x2c')](0x4)+_0xc303('0x4e'));var _0x5bb849;return aws[_0xc303('0x7e')](_0x238029,_0x46da16,_0x151b5a,_0x41171a,_0x225c99,_0x511616,_0x266b05)['then'](function(){_0x5bb849=path[_0xc303('0x2a')](__dirname,_0xc303('0x2b'),rs[_0xc303('0x2c')](0x4)+_0xc303('0x2d'));return convertFile(_0x266b05,_0x5bb849);})[_0xc303('0x2f')](function(){try{fs[_0xc303('0x20')](_0x266b05);fs['chmodSync'](_0x5bb849,_0xc303('0x31'));}catch(_0x4c464a){logger['error'](_0x4c464a);}return _0x5bb849['split']('.')[0x0];});};exports[_0xc303('0x7f')]=function(_0x1066ea,_0xbd1153,_0x405dd0,_0x62cfba,_0x4632d6,_0x4aa113){return aws[_0xc303('0x80')](_0x1066ea,_0xbd1153,_0x405dd0,_0x62cfba,_0x4632d6,_0x4aa113)['then'](function(_0x2586b6){logger[_0xc303('0x1d')](JSON['stringify'](_0x2586b6));return _0x2586b6;});};exports[_0xc303('0x81')]=function(_0x5f408a,_0x2c46a8,_0x2f25d5,_0x2d13b5){var _0x4c3b74=util['format'](_0xc303('0x82'),ISPEECH_API,_0x5f408a,encodeURIComponent(_0x2c46a8),_0x2f25d5,_0x2d13b5);var _0x9b336b=path['resolve'](__dirname,_0xc303('0x2b'),rs[_0xc303('0x2c')](0x4)+_0xc303('0x4e'));var _0x2df232;return downloadFile(_0x4c3b74,_0x9b336b)[_0xc303('0x2f')](function(){_0x2df232=path[_0xc303('0x2a')](__dirname,_0xc303('0x2b'),rs[_0xc303('0x2c')](0x4)+'.wav');return convertFile(_0x9b336b,_0x2df232);})[_0xc303('0x2f')](function(){try{fs[_0xc303('0x20')](_0x9b336b);fs['chmodSync'](_0x2df232,_0xc303('0x31'));}catch(_0x5ab2fe){logger[_0xc303('0x18')](_0x5ab2fe);}return _0x2df232[_0xc303('0x40')]('.')[0x0];});};exports['ispeechASR']=function(_0x4293d2,_0x5262bb,_0x503198,_0x31f5ea){var _0x193b3f=util[_0xc303('0x83')](_0xc303('0x84'),ISPEECH_API,_0x5262bb,_0x503198,base64Encode(_0x4293d2),_0x31f5ea?util[_0xc303('0x83')](_0xc303('0x85'),encodeURIComponent(_0x31f5ea)):'freeform=3');return uploadFile(_0x193b3f)[_0xc303('0x2f')](function(_0x321916){return querystring['parse'](_0x321916);});};exports[_0xc303('0x86')]=function(_0x366037,_0x25d6ab){return sestek[_0xc303('0x87')](_0x366037,_0x25d6ab)[_0xc303('0x2f')](function(_0x17b00d){logger[_0xc303('0x1d')](JSON[_0xc303('0x46')](_0x17b00d));var _0x1ee4e8={'speech':_0x17b00d[_0xc303('0x88')],'action':_0x17b00d[_0xc303('0x89')]?_0x17b00d[_0xc303('0x89')][_0xc303('0x8a')]:undefined,'actiondata':_0x17b00d[_0xc303('0x89')]?_0x17b00d[_0xc303('0x89')][_0xc303('0x8b')]:undefined};if(_0x17b00d['channelData']&&_0x17b00d['channelData'][_0xc303('0x8c')]){return base64Decode(_0x17b00d[_0xc303('0x89')][_0xc303('0x8c')][_0xc303('0x8d')],path[_0xc303('0x2a')](__dirname,_0xc303('0x2b'),rs[_0xc303('0x2c')](0x4)+_0xc303('0x2d')))['then'](function(_0x5b883a){_0x1ee4e8[_0xc303('0x8e')]=_0x5b883a;return _0x1ee4e8;});}return _0x1ee4e8;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 46bc0da..46a4150 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 _0xd3a3=['exports','./nda'];(function(_0x5ddba4,_0x2109c6){var _0x2321f4=function(_0x956b69){while(--_0x956b69){_0x5ddba4['push'](_0x5ddba4['shift']());}};_0x2321f4(++_0x2109c6);}(_0xd3a3,0x137));var _0x3d3a=function(_0x16a948,_0x578bd3){_0x16a948=_0x16a948-0x0;var _0x13ffb3=_0xd3a3[_0x16a948];return _0x13ffb3;};var nda=require(_0x3d3a('0x0'));module[_0x3d3a('0x1')]={'nda':nda}; \ No newline at end of file +var _0x6d6b=['exports','./nda'];(function(_0x4ee579,_0x2e2920){var _0x91668c=function(_0xffd753){while(--_0xffd753){_0x4ee579['push'](_0x4ee579['shift']());}};_0x91668c(++_0x2e2920);}(_0x6d6b,0x165));var _0xb6d6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6d6b[_0x14add3];return _0x4a174f;};var nda=require(_0xb6d6('0x0'));module[_0xb6d6('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 d214605..9d17632 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 _0x235a=['text','Bearer\x20','access_token','ProjectName','project','ndagenerate_audio','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','message','uniqueid','extension'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x235a,0x1ef));var _0xa235=function(_0x100f06,_0x271deb){_0x100f06=_0x100f06-0x0;var _0x319d1f=_0x235a[_0x100f06];return _0x319d1f;};'use strict';var rp=require(_0xa235('0x0'));var url=require(_0xa235('0x1'));var logger=require(_0xa235('0x2'))('agi');module[_0xa235('0x3')]=function(_0x52c3b3,_0x3ae786){var _0x2f7920={'method':_0xa235('0x4'),'uri':url[_0xa235('0x5')](_0x3ae786[_0xa235('0x6')],_0xa235('0x7')),'form':{'grant_type':_0xa235('0x8'),'username':_0x3ae786[_0xa235('0x9')],'password':_0x3ae786['password']},'json':!![]};return rp(_0x2f7920)[_0xa235('0xa')](function(_0x2dc1ba){var _0x450e27={'method':_0xa235('0x4'),'uri':url['resolve'](_0x3ae786[_0xa235('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3ae786['ndaactivity_type']||_0xa235('0xc'),'channelId':'Nda','conversation':{'id':_0x52c3b3[_0xa235('0xd')]},'from':{'id':_0x52c3b3['callerid'],'name':_0x52c3b3['calleridname']},'recipient':{'id':_0x52c3b3['dnid'],'name':_0x52c3b3[_0xa235('0xe')]},'text':_0x3ae786[_0xa235('0xf')],'channelData':{}},'headers':{'Authorization':_0xa235('0x10')+_0x2dc1ba[_0xa235('0x11')]},'json':!![]};if(_0x3ae786['project']){_0x450e27['body']['channelData'][_0xa235('0x12')]=_0x3ae786[_0xa235('0x13')];}if(_0x3ae786[_0xa235('0x14')]=='1'){_0x450e27[_0xa235('0x15')][_0xa235('0x16')][_0xa235('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa235('0x18')};}if(_0x3ae786[_0xa235('0x19')]){_0x450e27[_0xa235('0x15')]['channelData'][_0xa235('0x1a')]=_0x3ae786[_0xa235('0x19')];if(_0x3ae786[_0xa235('0x1b')]){_0x450e27[_0xa235('0x15')][_0xa235('0x16')][_0xa235('0x1c')]=_0x3ae786['custom_action_data'];}}logger['info'](JSON[_0xa235('0x1d')](_0x450e27));return rp(_0x450e27);});}; \ No newline at end of file +var _0x74f4=['POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','dnid','extension','text','access_token','project','channelData','ProjectName','body','AudioOutputSettings','audio/wav','custom_action','custom_action_data','stringify','request-promise','url','agi','exports'];(function(_0x5009b9,_0x40bb46){var _0x3d2fe6=function(_0x1e5f5b){while(--_0x1e5f5b){_0x5009b9['push'](_0x5009b9['shift']());}};_0x3d2fe6(++_0x40bb46);}(_0x74f4,0xaa));var _0x474f=function(_0x4d4c6c,_0x552965){_0x4d4c6c=_0x4d4c6c-0x0;var _0x5497c4=_0x74f4[_0x4d4c6c];return _0x5497c4;};'use strict';var rp=require(_0x474f('0x0'));var url=require(_0x474f('0x1'));var logger=require('../../../../../config/logger')(_0x474f('0x2'));module[_0x474f('0x3')]=function(_0x5931b9,_0x23cf8d){var _0x47fa11={'method':_0x474f('0x4'),'uri':url[_0x474f('0x5')](_0x23cf8d[_0x474f('0x6')],'/token'),'form':{'grant_type':_0x474f('0x7'),'username':_0x23cf8d[_0x474f('0x8')],'password':_0x23cf8d[_0x474f('0x7')]},'json':!![]};return rp(_0x47fa11)[_0x474f('0x9')](function(_0x25e3f2){var _0x461707={'method':_0x474f('0x4'),'uri':url[_0x474f('0x5')](_0x23cf8d[_0x474f('0xa')],_0x474f('0xb')),'body':{'type':_0x23cf8d[_0x474f('0xc')]||'message','channelId':_0x474f('0xd'),'conversation':{'id':_0x5931b9[_0x474f('0xe')]},'from':{'id':_0x5931b9[_0x474f('0xf')],'name':_0x5931b9['calleridname']},'recipient':{'id':_0x5931b9[_0x474f('0x10')],'name':_0x5931b9[_0x474f('0x11')]},'text':_0x23cf8d[_0x474f('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x25e3f2[_0x474f('0x13')]},'json':!![]};if(_0x23cf8d[_0x474f('0x14')]){_0x461707['body'][_0x474f('0x15')][_0x474f('0x16')]=_0x23cf8d[_0x474f('0x14')];}if(_0x23cf8d['ndagenerate_audio']=='1'){_0x461707[_0x474f('0x17')][_0x474f('0x15')][_0x474f('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x474f('0x19')};}if(_0x23cf8d[_0x474f('0x1a')]){_0x461707[_0x474f('0x17')][_0x474f('0x15')]['CustomAction']=_0x23cf8d[_0x474f('0x1a')];if(_0x23cf8d['custom_action_data']){_0x461707[_0x474f('0x17')][_0x474f('0x15')]['CustomActionData']=_0x23cf8d[_0x474f('0x1b')];}}logger['info'](JSON[_0x474f('0x1c')](_0x461707));return rp(_0x461707);});}; \ 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 daaf362..e3ae054 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 _0xfcfa=['./lib/api'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0xfcfa,0x10c));var _0xafcf=function(_0x200496,_0x31c0c3){_0x200496=_0x200496-0x0;var _0x3433d1=_0xfcfa[_0x200496];return _0x3433d1;};'use strict';var asr=require(_0xafcf('0x0'));module['exports']=function(_0x55a429,_0x3fd8a7,_0x5d2252,_0x491172){return asr(_0x55a429,_0x3fd8a7,_0x5d2252,_0x491172);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x580c7b,_0x1517a2,_0x32f928,_0x17f36b){return asr(_0x580c7b,_0x1517a2,_0x32f928,_0x17f36b);}; \ 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 2bb4703..58ab0b6 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 _0xf0bc=['Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','close','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x270fd8,_0x3571a6){var _0x8fb1c4=function(_0x1c31cd){while(--_0x1c31cd){_0x270fd8['push'](_0x270fd8['shift']());}};_0x8fb1c4(++_0x3571a6);}(_0xf0bc,0x121));var _0xcf0b=function(_0x2a6ec9,_0xaecea3){_0x2a6ec9=_0x2a6ec9-0x0;var _0xe55478=_0xf0bc[_0x2a6ec9];return _0xe55478;};'use strict';var BPromise=require(_0xcf0b('0x0'));var _=require(_0xcf0b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcf0b('0x2'));var crypto=require(_0xcf0b('0x3'));var logger=require('../../../../../../config/logger')(_0xcf0b('0x4'));module[_0xcf0b('0x5')]=function(_0x2e6292,_0x1b7488,_0x50c401,_0x2eff55){return new BPromise(function(_0x16bc68,_0x144e61){logger[_0xcf0b('0x6')](_0xcf0b('0x7'),_0x2eff55||_0xcf0b('0x8'));var _0xee24bf=new WebSocket(_0x2eff55||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0xd1050d='';var _0x4c8f74='0';var _0x358f85='1';var _0x2171a8=_0xcf0b('0x9');function _0x1ef259(_0x347b03){var _0x429bdb=crypto[_0xcf0b('0xa')](_0xcf0b('0xb'));_0x429bdb['update'](_0x347b03);return _0x429bdb['digest'](_0xcf0b('0xc'));}function _0x5ed47a(){try{logger[_0xcf0b('0x6')](_0xcf0b('0xd'));var _0x4d7a24=moment()['unix']();var _0x5f2561=_0x1ef259(_0x4d7a24+_0x1b7488+_0x50c401);_0xee24bf[_0xcf0b('0xe')](JSON[_0xcf0b('0xf')]({'appID':_0x1b7488,'timestamp':_0x4d7a24,'appKey':_0x5f2561}));var _0x2c47e7=fs['createReadStream'](_0x2e6292);_0x2c47e7['on']('data',function(_0x28bdb9){_0xee24bf[_0xcf0b('0xe')](_0x28bdb9);});_0x2c47e7['on'](_0xcf0b('0x10'),function(){_0xee24bf[_0xcf0b('0xe')]('EOS');});}catch(_0x41db1b){logger['error']('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x41db1b));_0xee24bf[_0xcf0b('0x11')]();}}function _0x598db3(_0x3832ee){try{if(_0x3832ee){var _0x32aaae=JSON[_0xcf0b('0x12')](_0x3832ee);switch(_0x32aaae['status']){case 0x0:if(_0x32aaae['result']){if(_0x32aaae[_0xcf0b('0x13')][_0xcf0b('0x14')]){logger['info'](_0xcf0b('0x15'),JSON['stringify'](_0x32aaae[_0xcf0b('0x13')]['hypotheses']));_0xd1050d=_0x32aaae['result'][_0xcf0b('0x16')][0x0][_0xcf0b('0x17')];_0x4c8f74=_0x32aaae[_0xcf0b('0x13')][_0xcf0b('0x16')][0x0]['likelihood'];_0x358f85='0';_0x2171a8=_0xcf0b('0x18');_0xee24bf[_0xcf0b('0x11')]();}}break;case 0x1:logger[_0xcf0b('0x6')](_0xcf0b('0x9'));_0x358f85='1';_0x2171a8=_0xcf0b('0x9');break;case 0x2:logger[_0xcf0b('0x6')](_0xcf0b('0x19'));_0x358f85='2';_0x2171a8=_0xcf0b('0x19');break;case 0x9:logger[_0xcf0b('0x6')](_0xcf0b('0x1a'));_0x358f85='9';_0x2171a8=_0xcf0b('0x1a');break;case 0xa:logger['info'](_0xcf0b('0x1b'));_0x358f85='10';_0x2171a8=_0xcf0b('0x1b');break;case 0xb:logger[_0xcf0b('0x6')](_0xcf0b('0x1c'));_0x358f85='11';_0x2171a8='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x24f5f2){logger[_0xcf0b('0x1d')](_0xcf0b('0x1e'),JSON[_0xcf0b('0xf')](_0x24f5f2));_0xee24bf[_0xcf0b('0x11')]();}}function _0x2376cb(){logger[_0xcf0b('0x6')](_0xcf0b('0x1f'));_0x16bc68({'transcript':_0xd1050d,'confidence':_0x4c8f74,'status':_0x358f85,'status_message':_0x2171a8});}function _0x54828e(_0x5f1721){logger[_0xcf0b('0x1d')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x5f1721)){logger[_0xcf0b('0x1d')](_[_0xcf0b('0x20')](_0x5f1721)?JSON[_0xcf0b('0xf')](_0x5f1721):_0x5f1721);}}_0xee24bf['on'](_0xcf0b('0x21'),_0x5ed47a);_0xee24bf['on'](_0xcf0b('0x22'),_0x598db3);_0xee24bf['on'](_0xcf0b('0x10'),_0x2376cb);_0xee24bf['on'](_0xcf0b('0x1d'),_0x54828e);});}; \ No newline at end of file +var _0xe434=['update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','error','bluebird','lodash','moment','crypto','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1'];(function(_0x454564,_0x2a5ea6){var _0x3bdfea=function(_0x265436){while(--_0x265436){_0x454564['push'](_0x454564['shift']());}};_0x3bdfea(++_0x2a5ea6);}(_0xe434,0x15d));var _0x4e43=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xe434[_0x2160a9];return _0xa88cf7;};'use strict';var BPromise=require(_0x4e43('0x0'));var _=require(_0x4e43('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4e43('0x2'));var crypto=require(_0x4e43('0x3'));var logger=require('../../../../../../config/logger')('agi');module[_0x4e43('0x4')]=function(_0x5ec94b,_0x324744,_0x3ede66,_0x14ae45){return new BPromise(function(_0x25b238,_0x4b17ad){logger[_0x4e43('0x5')](_0x4e43('0x6'),_0x14ae45||_0x4e43('0x7'));var _0x514f9c=new WebSocket(_0x14ae45||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x528b0d='';var _0x266c29='0';var _0x5b13fa='1';var _0x8be0d0=_0x4e43('0x8');function _0x165997(_0x1af1e8){var _0x425a9d=crypto[_0x4e43('0x9')](_0x4e43('0xa'));_0x425a9d[_0x4e43('0xb')](_0x1af1e8);return _0x425a9d['digest'](_0x4e43('0xc'));}function _0x3faa97(){try{logger[_0x4e43('0x5')](_0x4e43('0xd'));var _0x21fccb=moment()[_0x4e43('0xe')]();var _0x4a7803=_0x165997(_0x21fccb+_0x324744+_0x3ede66);_0x514f9c[_0x4e43('0xf')](JSON[_0x4e43('0x10')]({'appID':_0x324744,'timestamp':_0x21fccb,'appKey':_0x4a7803}));var _0xec1e3a=fs[_0x4e43('0x11')](_0x5ec94b);_0xec1e3a['on'](_0x4e43('0x12'),function(_0x5ede6a){_0x514f9c['send'](_0x5ede6a);});_0xec1e3a['on'](_0x4e43('0x13'),function(){_0x514f9c['send']('EOS');});}catch(_0x1fee75){logger['error'](_0x4e43('0x14'),JSON[_0x4e43('0x10')](_0x1fee75));_0x514f9c[_0x4e43('0x15')]();}}function _0x12ef37(_0x488cf5){try{if(_0x488cf5){var _0x61a649=JSON[_0x4e43('0x16')](_0x488cf5);switch(_0x61a649[_0x4e43('0x17')]){case 0x0:if(_0x61a649[_0x4e43('0x18')]){if(_0x61a649[_0x4e43('0x18')]['final']){logger[_0x4e43('0x5')](_0x4e43('0x19'),JSON['stringify'](_0x61a649[_0x4e43('0x18')][_0x4e43('0x1a')]));_0x528b0d=_0x61a649[_0x4e43('0x18')][_0x4e43('0x1a')][0x0][_0x4e43('0x1b')];_0x266c29=_0x61a649['result'][_0x4e43('0x1a')][0x0]['likelihood'];_0x5b13fa='0';_0x8be0d0=_0x4e43('0x1c');_0x514f9c[_0x4e43('0x15')]();}}break;case 0x1:logger[_0x4e43('0x5')](_0x4e43('0x8'));_0x5b13fa='1';_0x8be0d0=_0x4e43('0x8');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x5b13fa='2';_0x8be0d0=_0x4e43('0x1d');break;case 0x9:logger['info'](_0x4e43('0x1e'));_0x5b13fa='9';_0x8be0d0=_0x4e43('0x1e');break;case 0xa:logger['info'](_0x4e43('0x1f'));_0x5b13fa='10';_0x8be0d0=_0x4e43('0x1f');break;case 0xb:logger[_0x4e43('0x5')](_0x4e43('0x20'));_0x5b13fa='11';_0x8be0d0=_0x4e43('0x20');}}}catch(_0x9d6ec0){logger['error'](_0x4e43('0x21'),JSON[_0x4e43('0x10')](_0x9d6ec0));_0x514f9c[_0x4e43('0x15')]();}}function _0xf8327c(){logger[_0x4e43('0x5')](_0x4e43('0x22'));_0x25b238({'transcript':_0x528b0d,'confidence':_0x266c29,'status':_0x5b13fa,'status_message':_0x8be0d0});}function _0x299ab9(_0x3d0f1){logger['error'](_0x4e43('0x23'));if(!_[_0x4e43('0x24')](_0x3d0f1)){logger['error'](_[_0x4e43('0x25')](_0x3d0f1)?JSON[_0x4e43('0x10')](_0x3d0f1):_0x3d0f1);}}_0x514f9c['on']('open',_0x3faa97);_0x514f9c['on'](_0x4e43('0x26'),_0x12ef37);_0x514f9c['on']('close',_0xf8327c);_0x514f9c['on'](_0x4e43('0x27'),_0x299ab9);});}; \ 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 32290b3..c121e85 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 _0x0b5e=['exports'];(function(_0x260b48,_0x117977){var _0x3f730b=function(_0x7a1e53){while(--_0x7a1e53){_0x260b48['push'](_0x260b48['shift']());}};_0x3f730b(++_0x117977);}(_0x0b5e,0xf7));var _0xe0b5=function(_0x40914a,_0xc7dbfb){_0x40914a=_0x40914a-0x0;var _0x2e85c3=_0x0b5e[_0x40914a];return _0x2e85c3;};var asr=require('./asr');module[_0xe0b5('0x0')]={'asr':asr}; \ No newline at end of file +var _0x97af=['exports'];(function(_0x22c833,_0xdbc462){var _0x56071a=function(_0x5282ed){while(--_0x5282ed){_0x22c833['push'](_0x22c833['shift']());}};_0x56071a(++_0xdbc462);}(_0x97af,0x137));var _0xf97a=function(_0x43e5ac,_0x2218d8){_0x43e5ac=_0x43e5ac-0x0;var _0x5b1e32=_0x97af[_0x43e5ac];return _0x5b1e32;};var asr=require('./asr');module[_0xf97a('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 9a8b135..09156b9 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 _0x1bbb=['connection','error','E_AGI_SERVER_ERROR','destroy','ready','code','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x1c22ff,_0x6faa3a){var _0x5da76b=function(_0xfc60d9){while(--_0xfc60d9){_0x1c22ff['push'](_0x1c22ff['shift']());}};_0x5da76b(++_0x6faa3a);}(_0x1bbb,0x1e9));var _0xb1bb=function(_0x52c611,_0x58dfd6){_0x52c611=_0x52c611-0x0;var _0x518d10=_0x1bbb[_0x52c611];return _0x518d10;};'use strict';var util=require(_0xb1bb('0x0'));var net=require(_0xb1bb('0x1'));var EventEmitter=require(_0xb1bb('0x2'))['EventEmitter'];var AGIError=require(_0xb1bb('0x3'));var AGIChannel=require(_0xb1bb('0x4'));var AGIServer=function(_0x37d5ff,_0x40f91e,_0x11c0a8){var _0xe401bb=this,_0x37d5ff=_0x37d5ff||0x11dd,_0x40f91e=_0x40f91e||_0xb1bb('0x5'),_0x5c65ab=null,_0x400226=0x0;EventEmitter[_0xb1bb('0x6')](_0xe401bb);function _0x4f5e1a(){if(!_0x37d5ff){_0xe401bb[_0xb1bb('0x7')]('error',new AGIError(_0xb1bb('0x8')));return![];}_0x5c65ab=net[_0xb1bb('0x9')]();_0x5c65ab[_0xb1bb('0xa')](_0x37d5ff,_0x40f91e);_0x5c65ab['on']('listening',function(){_0xe401bb['emit']('listening');});_0x5c65ab['on'](_0xb1bb('0xb'),function(_0x28bffb){_0x5c65ab['getConnections'](function(_0xca8c5a,_0x53ec31){if(_0xca8c5a){_0xe401bb[_0xb1bb('0x7')](_0xb1bb('0xc'),new AGIError(_0xb1bb('0xd'),_0xca8c5a));}else if(_0x11c0a8&&_0x11c0a8<0x0){_0xe401bb[_0xb1bb('0x7')](_0xb1bb('0xc'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x28bffb[_0xb1bb('0xe')]();}else if(_0x11c0a8&&_0x11c0a8>0x0&&_0x11c0a8<_0x53ec31){_0x400226+=0x1;_0xe401bb[_0xb1bb('0x7')](_0xb1bb('0xc'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x400226));_0x28bffb[_0xb1bb('0xe')]();}else{var _0x2fcbb5=new AGIChannel(_0x28bffb);_0x2fcbb5['on'](_0xb1bb('0xf'),function(){_0xe401bb[_0xb1bb('0x7')](_0xb1bb('0xb'),_0x2fcbb5);});}});});_0x5c65ab['on'](_0xb1bb('0xc'),function(_0x115467){_0xe401bb['emit'](_0xb1bb('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x115467[_0xb1bb('0x10')]));});_0x5c65ab['on'](_0xb1bb('0x11'),function(){_0xe401bb[_0xb1bb('0x7')](_0xb1bb('0x11'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xb1bb('0x12')](function(){_0x4f5e1a();});};util['inherits'](AGIServer,EventEmitter);module[_0xb1bb('0x13')]=function(_0x43d331,_0x3d40af,_0x44c3c5){return new AGIServer(_0x43d331,_0x3d40af,_0x44c3c5);}; \ No newline at end of file +var _0x9efc=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','events','EventEmitter','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection'];(function(_0x77b766,_0x2c3445){var _0xe0eb06=function(_0x596252){while(--_0x596252){_0x77b766['push'](_0x77b766['shift']());}};_0xe0eb06(++_0x2c3445);}(_0x9efc,0xac));var _0xc9ef=function(_0x32e865,_0x317078){_0x32e865=_0x32e865-0x0;var _0x850461=_0x9efc[_0x32e865];return _0x850461;};'use strict';var util=require(_0xc9ef('0x0'));var net=require(_0xc9ef('0x1'));var EventEmitter=require(_0xc9ef('0x2'))[_0xc9ef('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xc9ef('0x4'));var AGIServer=function(_0x37f50e,_0x534089,_0x39c7b1){var _0x2a0310=this,_0x37f50e=_0x37f50e||0x11dd,_0x534089=_0x534089||_0xc9ef('0x5'),_0x3980b7=null,_0x4192ec=0x0;EventEmitter['call'](_0x2a0310);function _0x2f278b(){if(!_0x37f50e){_0x2a0310[_0xc9ef('0x6')](_0xc9ef('0x7'),new AGIError(_0xc9ef('0x8')));return![];}_0x3980b7=net[_0xc9ef('0x9')]();_0x3980b7['listen'](_0x37f50e,_0x534089);_0x3980b7['on'](_0xc9ef('0xa'),function(){_0x2a0310[_0xc9ef('0x6')](_0xc9ef('0xa'));});_0x3980b7['on'](_0xc9ef('0xb'),function(_0x4c4956){_0x3980b7[_0xc9ef('0xc')](function(_0x1384fe,_0x2d5570){if(_0x1384fe){_0x2a0310[_0xc9ef('0x6')](_0xc9ef('0x7'),new AGIError(_0xc9ef('0xd'),_0x1384fe));}else if(_0x39c7b1&&_0x39c7b1<0x0){_0x2a0310[_0xc9ef('0x6')](_0xc9ef('0x7'),new AGIError(_0xc9ef('0xe')));_0x4c4956[_0xc9ef('0xf')]();}else if(_0x39c7b1&&_0x39c7b1>0x0&&_0x39c7b1<_0x2d5570){_0x4192ec+=0x1;_0x2a0310[_0xc9ef('0x6')](_0xc9ef('0x7'),new AGIError(_0xc9ef('0x10'),_0x4192ec));_0x4c4956['destroy']();}else{var _0xcf325c=new AGIChannel(_0x4c4956);_0xcf325c['on'](_0xc9ef('0x11'),function(){_0x2a0310[_0xc9ef('0x6')]('connection',_0xcf325c);});}});});_0x3980b7['on'](_0xc9ef('0x7'),function(_0x1b2501){_0x2a0310[_0xc9ef('0x6')](_0xc9ef('0x7'),new AGIError(_0xc9ef('0xd'),_0x1b2501[_0xc9ef('0x12')]));});_0x3980b7['on']('close',function(){_0x2a0310[_0xc9ef('0x6')](_0xc9ef('0x13'),new AGIError(_0xc9ef('0x14')));});}process[_0xc9ef('0x15')](function(){_0x2f278b();});};util['inherits'](AGIServer,EventEmitter);module[_0xc9ef('0x16')]=function(_0x1e11bc,_0x39a5a5,_0x52ef61){return new AGIServer(_0x1e11bc,_0x39a5a5,_0x52ef61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 8d80bf7..2340ac3 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 _0xb875=['googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','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_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','tildeASR','clear','hasOwnProperty','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','split','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','out','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','variable_id','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\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','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','PLAYBACK','queue','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','QUEUE','gosub','record','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','user','bcc','subject','service','host','port','secure','authentication','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','join','exports','path','odbc','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','callback_','random','isEmpty','lastName','isNil','phone','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xb875,0x167));var _0x5b87=function(_0x11090e,_0x2f1226){_0x11090e=_0x11090e-0x0;var _0x103e19=_0xb875[_0x11090e];return _0x103e19;};'use strict';var fs=require('fs');var path=require(_0x5b87('0x0'));var util=require('util');var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x5b87('0x1'))();var rs=require('randomstring');var moment=require(_0x5b87('0x2'));var Mustache=require(_0x5b87('0x3'));var rp=require('request-promise');var logger=require(_0x5b87('0x4'))(_0x5b87('0x5'));var config=require(_0x5b87('0x6'));var scripts=require(_0x5b87('0x7'));var FILES_PATH=_0x5b87('0x8');var recursiveMapAttributes=[_0x5b87('0x9'),_0x5b87('0xa')];var verticesWithRetry=[_0x5b87('0xb'),_0x5b87('0xc'),_0x5b87('0xd')];var AGIVertices=function(_0x493bb2,_0x20fc30,_0x537f81){this[_0x5b87('0xe')]=_0x493bb2;this[_0x5b87('0xf')]=_0x20fc30;this[_0x5b87('0x10')]=_0x537f81;};AGIVertices[_0x5b87('0x11')]['getVariable']=function(_0x4d7cf8,_0x32b22b){this[_0x5b87('0xf')]['getVariableById'](_0x4d7cf8)[_0x5b87('0x12')](function(_0x3112bd){_0x32b22b(null,_0x3112bd?_0x3112bd[_0x5b87('0x13')]:![]);})[_0x5b87('0x14')](function(_0x2de6a4){_0x32b22b(_0x2de6a4);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x15')]=function(_0x301eb6,_0x90d2de){this['rpc'][_0x5b87('0x16')](_0x301eb6)['then'](function(_0x10c5df){_0x90d2de(null,_0x10c5df?_0x10c5df[_0x5b87('0x13')]:![]);})['catch'](function(_0x59bf2b){_0x90d2de(_0x59bf2b);});};AGIVertices[_0x5b87('0x11')]['getSquareProject']=function(_0x971dd9,_0x175452){this[_0x5b87('0xf')][_0x5b87('0x17')](_0x971dd9)[_0x5b87('0x12')](function(_0x18cfa8){_0x175452(null,_0x18cfa8?_0x18cfa8[_0x5b87('0x13')]:![]);})['catch'](function(_0x4e6777){_0x175452(_0x4e6777);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x1b0f5a,_0x3b466c){this[_0x5b87('0xf')][_0x5b87('0x18')](_0x1b0f5a)[_0x5b87('0x12')](function(_0x5491ec){_0x3b466c(null,_0x5491ec?_0x5491ec[_0x5b87('0x19')]:![]);})['catch'](function(_0x5ac69f){_0x3b466c(_0x5ac69f);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x1a')]=function(_0x4c8ce2,_0x1a1088){this[_0x5b87('0xf')][_0x5b87('0x1b')](_0x4c8ce2)[_0x5b87('0x12')](function(_0x360010){_0x1a1088(null,_0x360010?_0x360010[_0x5b87('0x13')]:![]);})[_0x5b87('0x14')](function(_0x23cfda){_0x1a1088(_0x23cfda);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x1c')]=function(_0x4c0f10,_0x3b0122){this[_0x5b87('0xf')][_0x5b87('0x1d')](_0x4c0f10)[_0x5b87('0x12')](function(_0x1cfb4b){_0x3b0122(null,_0x1cfb4b?_0x1cfb4b[_0x5b87('0x13')]:![]);})[_0x5b87('0x14')](function(_0x27b4e1){_0x3b0122(_0x27b4e1);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x1e')]=function(_0x1b5ebd,_0x5a9f77){var _0x490200=this;this[_0x5b87('0xf')]['getSoundById'](_0x1b5ebd)[_0x5b87('0x12')](function(_0x369fac){_0x5a9f77(null,_0x369fac?_0x490200['getSoundPath'](_0x369fac['save_name']):![]);})[_0x5b87('0x14')](function(_0xad390f){_0x5a9f77(_0xad390f);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x1f')]=function(_0xa87aad,_0x583449){this[_0x5b87('0xf')][_0x5b87('0x20')](_0xa87aad)['then'](function(_0x1290eb){_0x583449(null,_0x1290eb?_0x1290eb:![]);})['catch'](function(_0x34df8f){_0x583449(_0x34df8f);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x21')]=function(_0x4f1ea5,_0x22d559,_0x17e3e3){this[_0x5b87('0x10')][_0x5b87('0x21')](_0x4f1ea5,_0x22d559)['then'](function(){_0x17e3e3(null);})['catch'](function(_0x5781d1){_0x17e3e3(_0x5781d1);});};AGIVertices[_0x5b87('0x11')]['getIntervals']=function(_0x101522,_0x5061ec){this[_0x5b87('0xf')][_0x5b87('0x22')](_0x101522)['then'](function(_0x2b9a2a){if(_0x2b9a2a){if(_0x2b9a2a[_0x5b87('0x23')]){_0x5061ec(null,[_0x2b9a2a[_0x5b87('0x24')]]);}else{_0x5061ec(null,_[_0x5b87('0x25')](_0x2b9a2a['Intervals'],_0x5b87('0x24')));}}else{_0x5061ec(null,![]);}})[_0x5b87('0x14')](function(_0x304e5e){_0x5061ec(_0x304e5e);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x26')]=function(_0x219316){return util[_0x5b87('0x27')](_0x5b87('0x28'),FILES_PATH,_0x219316);};AGIVertices[_0x5b87('0x11')][_0x5b87('0x29')]=function(_0x1bf304,_0x5a2f1b,_0x27c728){odbc['open'](_0x1bf304,function(_0x3793e8){if(_0x3793e8){logger[_0x5b87('0x2a')](_0x5b87('0x2b'),_0x3793e8);_0x27c728(_0x3793e8);}else{logger[_0x5b87('0x2c')](_0x5b87('0x2d'));odbc[_0x5b87('0x2e')](_0x5a2f1b,function(_0x17b264,_0x213a9c){if(_0x17b264){logger[_0x5b87('0x2c')](_0x5b87('0x2f'),_0x5a2f1b);_0x27c728(_0x17b264);}else{logger['info'](_0x5b87('0x30'),_0x5a2f1b);odbc[_0x5b87('0x31')](function(_0x5e7930){if(_0x5e7930){logger[_0x5b87('0x2a')](_0x5b87('0x32'),_0x5e7930);}_0x27c728(null,_0x213a9c);});}});}});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x33')]=function(_0x95ac76,_0x4bd150){this[_0x5b87('0xf')][_0x5b87('0x34')](_0x95ac76)[_0x5b87('0x12')](function(_0x5ce30e){_0x4bd150(null,_0x5ce30e?_0x5ce30e:![]);})[_0x5b87('0x14')](function(_0x413e11){_0x4bd150(_0x413e11);});};AGIVertices['prototype'][_0x5b87('0x35')]=function(_0x34dc4b,_0xfee58e){this[_0x5b87('0xf')]['createSmsMessage'](_0x34dc4b)[_0x5b87('0x12')](function(_0x43d421){_0xfee58e(null,_0x43d421);})[_0x5b87('0x14')](function(_0x4ddfcb){_0xfee58e(_0x4ddfcb);});};AGIVertices[_0x5b87('0x11')]['createSquareDetailsReport']=function(_0x4564b9,_0x165187,_0x17bd67){this[_0x5b87('0xf')][_0x5b87('0x36')]({'uniqueid':this[_0x5b87('0xe')]['uniqueid'],'node':_0x4564b9[_0x5b87('0x37')],'application':_0x4564b9[_0x5b87('0x38')],'data':_0x165187||null,'project_name':this['channel'][_0x5b87('0x39')],'callerid':this[_0x5b87('0xe')][_0x5b87('0x3a')]})['then'](function(_0x16e7f2){if(_0x17bd67){_0x17bd67(null,_0x16e7f2);}})[_0x5b87('0x14')](function(_0x3e3f6b){if(_0x17bd67){_0x17bd67(_0x3e3f6b);}});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x3b')]=function(_0x56abc9,_0x30f966,_0x1f8b72,_0x216c69){this[_0x5b87('0xf')][_0x5b87('0x3b')]({'uniqueid':this['channel'][_0x5b87('0x3c')],'callerid':this[_0x5b87('0xe')][_0x5b87('0x3a')],'calleridname':this[_0x5b87('0xe')]['calleridname'],'context':this[_0x5b87('0xe')][_0x5b87('0x3d')],'extension':this[_0x5b87('0xe')]['extension'],'priority':this['channel'][_0x5b87('0x3e')],'accountcode':this[_0x5b87('0xe')][_0x5b87('0x3f')],'dnid':this['channel'][_0x5b87('0x40')],'projectName':this[_0x5b87('0xe')][_0x5b87('0x39')],'saveName':_0x30f966,'filename':_0x56abc9[_0x5b87('0x41')]||_0x30f966,'savePath':_0x1f8b72})[_0x5b87('0x12')](function(_0x374f66){_0x216c69(null,_0x374f66);})[_0x5b87('0x14')](function(_0x10736d){_0x216c69(_0x10736d);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x42')]=function(_0x152a04,_0x290714,_0x582f48,_0x54e1d6,_0x5004f5){this[_0x5b87('0xf')][_0x5b87('0x42')]({'uniqueid':this['channel']['uniqueid'],'body':_0x152a04,'direction':_0x290714,'providerName':_0x582f48,'providerResponse':_0x54e1d6})[_0x5b87('0x12')](function(_0xc8f5e5){if(_0x5004f5){_0x5004f5(null,_0xc8f5e5);}})['catch'](function(_0x18a8e8){if(_0x5004f5){_0x5004f5(_0x18a8e8);}});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x43')]=function(_0x2138ae,_0x32d076){this[_0x5b87('0xf')]['createCmContact']({'firstName':_['isEmpty'](_0x2138ae[_0x5b87('0x13')])||_['isNil'](_0x2138ae[_0x5b87('0x13')])?_0x5b87('0x44')+Math[_0x5b87('0x45')]():_0x2138ae[_0x5b87('0x13')],'lastName':_[_0x5b87('0x46')](_0x2138ae[_0x5b87('0x47')])||_[_0x5b87('0x48')](_0x2138ae['lastName'])?null:_0x2138ae[_0x5b87('0x47')],'phone':_0x2138ae[_0x5b87('0x49')],'ListId':_0x2138ae['list_id'],'scheduledat':_0x2138ae[_0x5b87('0x4a')],'callbackUniqueid':this[_0x5b87('0xe')][_0x5b87('0x3c')],'tags':'callback','description':_0x5b87('0x4b')+_0x2138ae[_0x5b87('0x4a')][_0x5b87('0x4c')](),'priority':_0x2138ae[_0x5b87('0x4d')]})[_0x5b87('0x12')](function(_0x238989){_0x32d076(null,_0x238989);})['catch'](function(_0x1f2a59){_0x32d076(_0x1f2a59);});};AGIVertices['prototype'][_0x5b87('0x4e')]=function(_0x17b178,_0x5bb874){this[_0x5b87('0xf')][_0x5b87('0x4f')](_0x17b178)[_0x5b87('0x12')](function(_0x5b8ddd){_0x5bb874(null,_0x5b8ddd?_0x5b8ddd[_0x5b87('0x13')]:![]);})['catch'](function(_0x2fabb9){_0x5bb874(_0x2fabb9);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x50')]=function(_0x3e117e,_0x2087de,_0x52ad3d){var _0x1bd031={'role':_0x5b87('0x51')};_0x1bd031[_0x3e117e]=this[_0x5b87('0xe')][_0x5b87('0x3a')];this['rpc'][_0x5b87('0x50')](_0x1bd031,_0x2087de,this[_0x5b87('0xe')][_0x5b87('0x3c')])[_0x5b87('0x12')](function(_0x3c58a5){_0x52ad3d(null,_[_0x5b87('0x48')](_0x3c58a5)?![]:!![]);})[_0x5b87('0x14')](function(_0x154002){logger[_0x5b87('0x2a')](_0x154002);_0x52ad3d(null,![]);});};AGIVertices[_0x5b87('0x11')]['agentUnpause']=function(_0xbba196,_0x5e879c){var _0x4c2228={'role':_0x5b87('0x51')};_0x4c2228[_0xbba196]=this[_0x5b87('0xe')]['callerid'];this[_0x5b87('0xf')][_0x5b87('0x52')](_0x4c2228)[_0x5b87('0x12')](function(_0x13d6a8){_0x5e879c(null,_['isNil'](_0x13d6a8)?![]:!![]);})[_0x5b87('0x14')](function(_0x39ff09){logger[_0x5b87('0x2a')](_0x39ff09);_0x5e879c(null,![]);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x53')]=function(_0x21e79e,_0x3012af){var _0x4f65bb={'role':_0x5b87('0x51')};_0x4f65bb[_0x21e79e]=this[_0x5b87('0xe')][_0x5b87('0x3a')];this[_0x5b87('0xf')][_0x5b87('0x53')](_0x4f65bb)[_0x5b87('0x12')](function(_0x1896e7){_0x3012af(null,_['isNil'](_0x1896e7)?![]:!![]);})['catch'](function(_0x36105f){logger['error'](_0x36105f);_0x3012af(null,![]);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x54')]=function(_0x4a310e,_0x2dede9){var _0x306188={'role':_0x5b87('0x51')};_0x306188[_0x4a310e]=this[_0x5b87('0xe')][_0x5b87('0x3a')];var _0x4bb048=_0x4a310e!=_0x5b87('0x55')?util[_0x5b87('0x27')](_0x5b87('0x56'),_0x5b87('0x57'),this[_0x5b87('0xe')][_0x5b87('0x3a')]):undefined;this[_0x5b87('0xf')][_0x5b87('0x54')](_0x306188,_0x4bb048)[_0x5b87('0x12')](function(_0x529c2f){_0x2dede9(null,_[_0x5b87('0x48')](_0x529c2f)?![]:!![]);})[_0x5b87('0x14')](function(_0x5c9486){logger['error'](_0x5c9486);_0x2dede9(null,![]);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x58')]=function(_0x59f294,_0x2f1ede){sh[_0x5b87('0x59')](_[_0x5b87('0x5a')](_0x59f294),function(_0x30f209,_0x4437ba){var _0x36637d=_0x4437ba[_0x5b87('0x5b')](/(\r\n|\n|\r)/gm,'');_0x2f1ede(null,_0x36637d);});};AGIVertices['prototype'][_0x5b87('0x5c')]=function(_0x52a443,_0x11ee0a){scripts[_0x5b87('0x5c')](_0x52a443[_0x5b87('0x5d')],_0x52a443[_0x5b87('0x5e')]||_0x5b87('0x5f'),_0x52a443['text'],_0x52a443[_0x5b87('0x60')]||'en-US',_0x52a443['ssmlGender']||_0x5b87('0x61'),_0x52a443[_0x5b87('0x62')]||_0x5b87('0x63'))[_0x5b87('0x12')](function(_0x4c9153){_0x11ee0a(null,_0x4c9153);})[_0x5b87('0x14')](function(_0x3a1c59){_0x11ee0a(_0x3a1c59);});};AGIVertices['prototype']['googleTTS']=function(_0x7580a1,_0x2a0370){scripts[_0x5b87('0x64')](_0x7580a1[_0x5b87('0x5f')],_0x7580a1['google_tts_language']||'en',0x1)[_0x5b87('0x12')](function(_0x4d9dc0){_0x2a0370(null,_0x4d9dc0);})[_0x5b87('0x14')](function(_0x3baf41){_0x2a0370(_0x3baf41);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x65')]=function(_0x31cf78,_0x52e61b){var _0x58ae7c={'uri':_0x31cf78[_0x5b87('0x66')],'method':_0x31cf78[_0x5b87('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x31cf78[_0x5b87('0x68')])==='number'&&parseInt(_0x31cf78['timeout'])>=0x1?parseInt(_0x31cf78['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x5b87('0x69'),_0x5b87('0x6a')],_0x58ae7c[_0x5b87('0x67')]['toUpperCase']())){try{_0x58ae7c[_0x5b87('0x6b')]=_0x31cf78['rawBody']?JSON[_0x5b87('0x6c')](_0x31cf78['rawBody']):{};}catch(_0x1bfa35){logger['error'](_0x5b87('0x6d'),_0x1bfa35);}}try{_0x58ae7c[_0x5b87('0x6e')]=_0x31cf78[_0x5b87('0x9')]?JSON[_0x5b87('0x6c')](_0x31cf78[_0x5b87('0x9')]):{};}catch(_0x2d87de){logger[_0x5b87('0x2a')](_0x5b87('0x6f'),_0x2d87de);}if(_0x31cf78[_0x5b87('0x70')]){try{var _0x5d9066=require(_0x31cf78[_0x5b87('0x70')])[_0x5b87('0x71')](this,_0x58ae7c);_0x58ae7c[_0x5b87('0x72')]=Mustache[_0x5b87('0x73')](_0x31cf78[_0x5b87('0x66')],_0x5d9066,{},['$$','$$']);if(_0x58ae7c[_0x5b87('0x6e')]){_0x58ae7c['headers']=JSON[_0x5b87('0x6c')](Mustache[_0x5b87('0x73')](JSON[_0x5b87('0x74')](_0x58ae7c[_0x5b87('0x6e')]),_0x5d9066,{},['$$','$$']));}if(_0x58ae7c[_0x5b87('0x6b')]){_0x58ae7c[_0x5b87('0x6b')]=JSON[_0x5b87('0x6c')](Mustache['render'](JSON[_0x5b87('0x74')](_0x58ae7c[_0x5b87('0x6b')]),_0x5d9066,{},['$$','$$']));}}catch(_0x186b05){logger[_0x5b87('0x2a')](_0x5b87('0x75'),_0x186b05);}}rp(_0x58ae7c)[_0x5b87('0x12')](function(_0x585989){var _0x5c543c={'statusCode':_0x585989['statusCode']||0xc8,'statusMessage':_0x585989['statusMessage']||'OK','headers':_0x585989[_0x5b87('0x6e')]||{},'body':_0x585989[_0x5b87('0x6b')]||{}};_0x52e61b(null,_0x5c543c);})['catch'](function(_0x49beb5){var _0x51bc19={'statusCode':_0x49beb5[_0x5b87('0x76')]||0x1f4,'statusMessage':_0x49beb5[_0x5b87('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x49beb5['options'][_0x5b87('0x6e')]||{},'body':_0x49beb5[_0x5b87('0x78')][_0x5b87('0x6b')]||{}};_0x52e61b(null,_0x51bc19);});};AGIVertices['prototype'][_0x5b87('0x79')]=function(_0x10012d,_0x1cf254){scripts[_0x5b87('0x79')](this[_0x5b87('0xe')][_0x5b87('0x3c')],_0x10012d[_0x5b87('0x7a')],_0x10012d['text'],_0x10012d[_0x5b87('0x7b')]||'en')[_0x5b87('0x12')](function(_0x4b2c10){_0x1cf254(null,_0x4b2c10);})[_0x5b87('0x14')](function(_0x3ac556){_0x1cf254(_0x3ac556);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x5845a0,_0x36207a){scripts[_0x5b87('0x7c')](this[_0x5b87('0xe')]['uniqueid'],_0x5845a0[_0x5b87('0x7d')],_0x5845a0[_0x5b87('0x7e')],_0x5845a0[_0x5b87('0x7f')],_0x5845a0['text'],_0x5845a0[_0x5b87('0x80')]||'en')['then'](function(_0x1d86e){_0x36207a(null,_0x1d86e);})['catch'](function(_0x463c22){_0x36207a(_0x463c22);});};AGIVertices[_0x5b87('0x11')]['sestekNDA']=function(_0x338938,_0x3cbf21){scripts[_0x5b87('0x81')](this[_0x5b87('0xe')],_0x338938)[_0x5b87('0x12')](function(_0x3f68ed){_0x3cbf21(null,_0x3f68ed);})[_0x5b87('0x14')](function(_0x5e82e6){_0x3cbf21(_0x5e82e6);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x82')]=function(_0x206268,_0x5c90ef){scripts[_0x5b87('0x82')](_0x206268[_0x5b87('0x7a')],_0x206268[_0x5b87('0x5f')],_0x206268[_0x5b87('0x83')]||_0x5b87('0x84'),_0x206268[_0x5b87('0x85')])['then'](function(_0x509975){_0x5c90ef(null,_0x509975);})[_0x5b87('0x14')](function(_0x507b82){_0x5c90ef(_0x507b82);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x86')]=function(_0x55bcd9,_0x2d1a24,_0x597dfa){scripts[_0x5b87('0x86')](_0x2d1a24,_0x55bcd9[_0x5b87('0x7a')],_0x55bcd9[_0x5b87('0x87')]||_0x5b87('0x84'),this[_0x5b87('0x88')](_0x55bcd9[_0x5b87('0x89')])?_0x55bcd9[_0x5b87('0x89')]:undefined)['then'](function(_0x24fe8e){_0x597dfa(null,_0x24fe8e);})[_0x5b87('0x14')](function(_0x2ba5e8){_0x597dfa(_0x2ba5e8);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x8a')]=function(_0xe7c46,_0x502e5e){scripts[_0x5b87('0x8a')](_0xe7c46[_0x5b87('0x8b')],_0xe7c46['aws_secret_access_key'],_0xe7c46[_0x5b87('0x8c')],_0xe7c46[_0x5b87('0x8d')]||_0x5b87('0x8e'),_0xe7c46['text'],_0xe7c46[_0x5b87('0x8f')]||_0x5b87('0x5f'))[_0x5b87('0x12')](function(_0x40dade){_0x502e5e(null,_0x40dade);})[_0x5b87('0x14')](function(_0x32d930){_0x502e5e(_0x32d930);});};AGIVertices['prototype'][_0x5b87('0x90')]=function(_0x5900da,_0x13493e){scripts[_0x5b87('0x90')](this['channel'][_0x5b87('0x3c')],_0x5900da[_0x5b87('0x8b')],_0x5900da[_0x5b87('0x91')],_0x5900da[_0x5b87('0x92')],_0x5900da[_0x5b87('0x5f')],_0x5900da['aws_bot_name'])[_0x5b87('0x12')](function(_0x12c23f){_0x13493e(null,_0x12c23f);})[_0x5b87('0x14')](function(_0x148552){_0x13493e(_0x148552);});};AGIVertices[_0x5b87('0x11')][_0x5b87('0x93')]=function(_0x107844,_0x19083e,_0x3abb58){scripts[_0x5b87('0x93')](_0x19083e,_0x107844[_0x5b87('0x7a')],_0x107844['google_asr_language']||'en-US')[_0x5b87('0x12')](function(_0x3a0912){_0x3abb58(null,_0x3a0912);})[_0x5b87('0x14')](function(_0x25c0b6){_0x3abb58(_0x25c0b6);});};AGIVertices['prototype'][_0x5b87('0x94')]=function(_0x4a5ff3,_0x1e4624,_0x22af63){scripts['tildeASR'](_0x1e4624,_0x4a5ff3['appid'],_0x4a5ff3['appsecret'],_0x4a5ff3['uri'])['then'](function(_0x4d1af2){_0x22af63(null,_0x4d1af2);})['catch'](function(_0x4cc2c0){_0x22af63(_0x4cc2c0);});};AGIVertices['prototype'][_0x5b87('0x95')]=function(_0x49a8cb){var _0x82c8b7=_['includes'](verticesWithRetry,_0x49a8cb[_0x5b87('0x38')])?_0x49a8cb:_['clone'](_0x49a8cb);for(var _0x59d859 in _0x82c8b7){if(_0x82c8b7[_0x5b87('0x96')](_0x59d859)){if(_0x82c8b7[_0x59d859]&&_[_0x5b87('0x97')](_0x82c8b7[_0x59d859])){if(_[_0x5b87('0x98')](recursiveMapAttributes,_0x59d859)){_0x82c8b7[_0x59d859]=this[_0x5b87('0x99')](_0x82c8b7[_0x59d859]);}else{_0x82c8b7[_0x59d859]=this[_0x5b87('0x9a')](_0x82c8b7[_0x59d859]);}}}}return _0x82c8b7;};AGIVertices[_0x5b87('0x11')]['recursiveNodeIndex']=function(_0x1b9285){for(var _0x518b18 in _0x1b9285){if(_0x1b9285[_0x5b87('0x96')](_0x518b18)){if(_['isPlainObject'](_0x1b9285[_0x518b18])){this[_0x5b87('0x9b')](_0x1b9285[_0x518b18]);}else if(_[_0x5b87('0x9c')](_0x1b9285[_0x518b18])){for(var _0x211205=0x0;_0x211205<_0x1b9285[_0x518b18][_0x5b87('0x9d')];_0x211205++){this['recursiveNodeIndex'](_0x1b9285[_0x518b18][_0x211205]);}}else if(_[_0x5b87('0x97')](_0x1b9285[_0x518b18])){_0x1b9285[_0x518b18]=this[_0x5b87('0x9a')](_0x1b9285[_0x518b18]);}}}};AGIVertices[_0x5b87('0x11')][_0x5b87('0x9e')]=function(_0x634324,_0xba68f2){for(var _0x18e743 in _0x634324){if(_0x634324['hasOwnProperty'](_0x18e743)){if(_['isPlainObject'](_0x634324[_0x18e743])){if(!_[_0x5b87('0x46')](_0x634324[_0x18e743])){this[_0x5b87('0x9e')](_0x634324[_0x18e743],util[_0x5b87('0x27')](_0x5b87('0x9f'),_0xba68f2,_0x18e743));}}else if(_[_0x5b87('0x9c')](_0x634324[_0x18e743])){for(var _0x3519fa=0x0;_0x3519fa<_0x634324[_0x18e743][_0x5b87('0x9d')];_0x3519fa++){this[_0x5b87('0x9e')](_0x634324[_0x18e743][_0x3519fa],util[_0x5b87('0x27')](_0x5b87('0x9f'),_0xba68f2,_0x18e743+'['+_0x3519fa+']'));}}else{if(!_[_0x5b87('0x48')](_0x634324[_0x18e743])){this[_0x5b87('0xe')]['setVariable'](util[_0x5b87('0x27')](_0x5b87('0x9f'),_0xba68f2,_0x18e743),_0x634324[_0x18e743]);}}}}};AGIVertices[_0x5b87('0x11')][_0x5b87('0x99')]=function(_0x4a2590){try{var _0x5c1a4b=JSON[_0x5b87('0x6c')](_0x4a2590);this[_0x5b87('0x9b')](_0x5c1a4b);return JSON[_0x5b87('0x74')](_0x5c1a4b);}catch(_0x3e365c){return this[_0x5b87('0x9a')](_0x4a2590);}};AGIVertices[_0x5b87('0x11')][_0x5b87('0x9a')]=function(_0x2e09e1){var _0x451821=_0x2e09e1[_0x5b87('0xa0')]('{');for(var _0x8dcde0=0x1;_0x8dcde0<_0x451821[_0x5b87('0x9d')];_0x8dcde0+=0x1){var _0x539431=_0x451821[_0x8dcde0][_0x5b87('0xa0')]('}');if(_0x539431[_0x5b87('0x9d')]>0x1){_0x2e09e1=_0x2e09e1['replaceAll']('{'+_0x539431[0x0]+'}',this[_0x5b87('0xe')][_0x5b87('0xa1')](_0x539431[0x0])[_0x5b87('0xa2')]||_0x539431[0x0]);}}if(_0x451821[_0x5b87('0x9d')]===0x1){return _0x2e09e1[_0x5b87('0x4c')]();}return this[_0x5b87('0x9a')](_0x2e09e1);};AGIVertices['prototype'][_0x5b87('0xa3')]=function(_0x3d40fc,_0x1fd39a){var _0x1b2374=this[_0x5b87('0xe')][_0x5b87('0xa1')](_0x3d40fc);if(_0x1b2374[_0x5b87('0xa4')]===-0x1){return _0x1b2374;}logger['info'](util[_0x5b87('0x27')](_0x5b87('0xa5'),_0x1fd39a,_0x1b2374[_0x5b87('0xa2')]));return this[_0x5b87('0xe')][_0x5b87('0xa6')](_0x1fd39a,_0x1b2374[_0x5b87('0xa2')]);};AGIVertices[_0x5b87('0x11')][_0x5b87('0x88')]=function(_0x1bdddb){return _0x1bdddb&&_0x1bdddb!=='0'&&_0x1bdddb!=='-1'&&_0x1bdddb!=='';};AGIVertices[_0x5b87('0x11')][_0x5b87('0xa7')]=function(_0xb0de80){this[_0x5b87('0x36')][_0x5b87('0x71')](this,_0xb0de80,'-');_0xb0de80[_0x5b87('0xa8')]=_0xb0de80[_0x5b87('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x5b87('0xa9')]=function(_0x38dba1){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0xaa'),_0x38dba1[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x38dba1[_0x5b87('0x5f')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0xac'));}var _0xdebb68='\x22'+_0x38dba1[_0x5b87('0x5f')]+'\x22';if(this['isConfigured'](_0x38dba1[_0x5b87('0x78')])){_0xdebb68+=','+_0x38dba1[_0x5b87('0x78')];}var _0x4f1c93=this[_0x5b87('0xe')][_0x5b87('0x59')](_0x5b87('0xad'),_0xdebb68);if(_0x4f1c93['result']===-0x1){return _0x4f1c93;}return this['channel']['noop'](util[_0x5b87('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0xdebb68));};AGIVertices['prototype'][_0x5b87('0xae')]=function(_0x17f04d){logger['info'](util[_0x5b87('0x27')](_0x5b87('0xaf'),_0x17f04d[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x17f04d[_0x5b87('0xb0')])){return this[_0x5b87('0xe')][_0x5b87('0xab')]('no\x20grammar\x20configured');}var _0x4ceccd=_0x17f04d[_0x5b87('0xb0')];if(this[_0x5b87('0x88')](_0x17f04d[_0x5b87('0x78')])){_0x4ceccd+=','+_0x17f04d[_0x5b87('0x78')];}var _0x2ab343=this[_0x5b87('0xe')][_0x5b87('0x59')](_0x5b87('0xb1'),_0x4ceccd);if(_0x2ab343['result']===-0x1){return _0x2ab343;}var _0x3e7b36=this[_0x5b87('0xa3')](_0x5b87('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x3e7b36[_0x5b87('0xa4')]===-0x1){return _0x3e7b36;}var _0x3aee7a=this[_0x5b87('0xa3')](_0x5b87('0xb3'),'MRCP_RECOG_TRANSCRIPT');if(_0x3aee7a[_0x5b87('0xa4')]===-0x1){return _0x3aee7a;}var _0x1474e9=this[_0x5b87('0xa3')](_0x5b87('0xb4'),_0x5b87('0xb5'));if(_0x1474e9['result']===-0x1){return _0x1474e9;}return this[_0x5b87('0xe')]['noop'](util[_0x5b87('0x27')](_0x5b87('0xb6'),_0x4ceccd));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x5')]=function(_0xe23b87){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0xb7'),_0xe23b87[_0x5b87('0x37')]));return this['channel'][_0x5b87('0x5')]([_0xe23b87[_0x5b87('0xb8')],_0xe23b87['args']]);};AGIVertices[_0x5b87('0x11')]['answer']=function(_0x4193c1){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0xb9'),_0x4193c1[_0x5b87('0x37')]));if(this[_0x5b87('0x88')](_0x4193c1[_0x5b87('0x68')])){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x4193c1[_0x5b87('0x68')]));var _0x5ec20b=this['channel'][_0x5b87('0xba')](_0x4193c1[_0x5b87('0x68')]);if(_0x5ec20b[_0x5b87('0xa4')]===-0x1){return _0x5ec20b;}}return this[_0x5b87('0xe')]['answer']();};AGIVertices['prototype'][_0x5b87('0xbb')]=function(_0x281513){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0xbc'),_0x281513['label']));if(!this['isConfigured'](_0x281513['list_id'])){return this['channel'][_0x5b87('0x2a')](_0x281513,_0x5b87('0xbd'));}_0x281513['scheduledAt']=moment();if(this['isConfigured'](_0x281513['delay'])){_0x281513['scheduledAt']=moment()[_0x5b87('0xbe')](_0x281513[_0x5b87('0xbf')],_0x5b87('0xc0'));}if(!this[_0x5b87('0x88')](_0x281513[_0x5b87('0x4d')])){_0x281513[_0x5b87('0x4d')]=0x2;}this[_0x5b87('0x43')][_0x5b87('0x71')](this,_0x281513);return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xc1'),_0x281513[_0x5b87('0x49')],_0x281513[_0x5b87('0xc2')],_0x281513[_0x5b87('0x4a')]));};AGIVertices[_0x5b87('0x11')]['custom_app']=function(_0x299ca0){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x299ca0[_0x5b87('0x37')]));var _0x1310b5=this[_0x5b87('0xe')][_0x5b87('0x59')](_0x299ca0[_0x5b87('0xc3')],_0x299ca0[_0x5b87('0x78')]);if(_0x1310b5[_0x5b87('0xa4')]===-0x1){return _0x1310b5;}return this['channel'][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xc4'),_0x299ca0[_0x5b87('0xc3')],_0x299ca0[_0x5b87('0x78')]));};AGIVertices[_0x5b87('0x11')][_0x5b87('0xc5')]=function(_0x26e698){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0xc6'),_0x26e698[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x26e698[_0x5b87('0x5f')])){return this[_0x5b87('0xe')]['noop']('no\x20text\x20configured');}var _0x4a88d7='\x22'+_0x26e698['text']+'\x22';if(this[_0x5b87('0x88')](_0x26e698[_0x5b87('0x78')])){_0x4a88d7+=','+_0x26e698[_0x5b87('0x78')];}var _0x2d2a43=this['channel'][_0x5b87('0x59')](_0x5b87('0xad'),_0x4a88d7);if(_0x2d2a43[_0x5b87('0xa4')]===-0x1){return _0x2d2a43;}return this[_0x5b87('0xe')][_0x5b87('0xab')](util['format'](_0x5b87('0xc7'),_0x4a88d7));};AGIVertices[_0x5b87('0x11')]['sestektts']=function(_0x45a99d){logger['info'](util[_0x5b87('0x27')](_0x5b87('0xc8'),_0x45a99d[_0x5b87('0x37')]));if(!this['isConfigured'](_0x45a99d[_0x5b87('0x5f')])){return this[_0x5b87('0xe')][_0x5b87('0xab')]('no\x20text\x20configured');}var _0x36d933='\x22'+_0x45a99d[_0x5b87('0x5f')]+'\x22';if(this[_0x5b87('0x88')](_0x45a99d[_0x5b87('0x78')])){_0x36d933+=','+_0x45a99d['options'];}var _0x521eab=this[_0x5b87('0xe')]['exec'](_0x5b87('0xad'),_0x36d933);if(_0x521eab[_0x5b87('0xa4')]===-0x1){return _0x521eab;}return this[_0x5b87('0xe')][_0x5b87('0xab')](util['format'](_0x5b87('0xc7'),_0x36d933));};AGIVertices[_0x5b87('0x11')]['lumenvoxasr']=function(_0x43e0a6){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x43e0a6[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x43e0a6[_0x5b87('0xb0')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0xc9'));}var _0x74911b=_0x43e0a6[_0x5b87('0xb0')];if(this[_0x5b87('0x88')](_0x43e0a6[_0x5b87('0x78')])){_0x74911b+=','+_0x43e0a6[_0x5b87('0x78')];}var _0x53b5e1=this[_0x5b87('0xe')][_0x5b87('0x59')](_0x5b87('0xb1'),_0x74911b);if(_0x53b5e1[_0x5b87('0xa4')]===-0x1){return _0x53b5e1;}var _0x549f2a=this['getAndSetVariable'](_0x5b87('0xb2'),_0x5b87('0xca'));if(_0x549f2a[_0x5b87('0xa4')]===-0x1){return _0x549f2a;}var _0x4c61b6=this[_0x5b87('0xa3')](_0x5b87('0xb3'),_0x5b87('0xcb'));if(_0x4c61b6[_0x5b87('0xa4')]===-0x1){return _0x4c61b6;}var _0x58b092=this[_0x5b87('0xa3')](_0x5b87('0xb4'),_0x5b87('0xcc'));if(_0x58b092[_0x5b87('0xa4')]===-0x1){return _0x58b092;}return this[_0x5b87('0xe')]['noop'](util[_0x5b87('0x27')](_0x5b87('0xb6'),_0x74911b));};AGIVertices[_0x5b87('0x11')][_0x5b87('0xcd')]=function(_0x5c9ebe){logger[_0x5b87('0x2c')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5c9ebe[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x5c9ebe['grammar'])){return this[_0x5b87('0xe')]['noop'](_0x5b87('0xc9'));}var _0x506b88=_0x5c9ebe[_0x5b87('0xb0')];if(this[_0x5b87('0x88')](_0x5c9ebe[_0x5b87('0x78')])){_0x506b88+=','+_0x5c9ebe[_0x5b87('0x78')];}var _0x5a5589=this[_0x5b87('0xe')][_0x5b87('0x59')]('MRCPRecog',_0x506b88);if(_0x5a5589[_0x5b87('0xa4')]===-0x1){return _0x5a5589;}var _0xf0a143=this[_0x5b87('0xa3')](_0x5b87('0xb2'),_0x5b87('0xce'));if(_0xf0a143['result']===-0x1){return _0xf0a143;}var _0x5012e8=this[_0x5b87('0xa3')](_0x5b87('0xb3'),'SESTEK_ASR_TRANSCRIPT');if(_0x5012e8[_0x5b87('0xa4')]===-0x1){return _0x5012e8;}var _0x298285=this[_0x5b87('0xa3')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x298285['result']===-0x1){return _0x298285;}return this[_0x5b87('0xe')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x506b88));};AGIVertices['prototype']['database']=function(_0x111367){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0xcf'),_0x111367[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x111367[_0x5b87('0xd0')])){return this['channel'][_0x5b87('0x2a')](_0x111367,_0x5b87('0xd1'));}var _0x3643e8=this['getSquareOdbc'][_0x5b87('0x71')](this,_0x111367['odbc_id']);if(!_0x3643e8){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x111367,_0x5b87('0xd2'));}if(!this['isConfigured'](_0x111367[_0x5b87('0x2e')])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x111367,_0x5b87('0xd3'));}var _0x2869ee=_0x111367['query'][_0x5b87('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xd4'),_0x2869ee));var _0xbdda4a=this[_0x5b87('0x29')]['sync'](this,_0x3643e8,_0x2869ee);this[_0x5b87('0x36')][_0x5b87('0x71')](this,_0x111367,_0x2869ee);if(!this['isConfigured'](_0x111367['variable_id'])){return this['channel'][_0x5b87('0xab')](_0x5b87('0xd5'));}var _0x10f660=this['getVariable'][_0x5b87('0x71')](this,_0x111367['variable_id']);if(!_0x10f660){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x111367,_0x5b87('0xd6'));}var _0x10439e=this;_0xbdda4a['forEach'](function(_0x2fee50,_0x2b85b1){Object[_0x5b87('0xd7')](_0x2fee50)[_0x5b87('0xd8')](function(_0x21bb70){_0x10439e['channel'][_0x5b87('0xa6')](util[_0x5b87('0x27')](_0x5b87('0xd9'),_0x10f660,_0x2b85b1,_0x21bb70),_0x2fee50[_0x21bb70]);});});this[_0x5b87('0xe')][_0x5b87('0xa6')](util[_0x5b87('0x27')](_0x5b87('0xda'),_0x10f660),_0xbdda4a[_0x5b87('0x9d')]);return this['channel'][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xdb'),_0x10f660));};AGIVertices['prototype'][_0x5b87('0xdc')]=function(_0x3c94ff){logger[_0x5b87('0xdd')](util[_0x5b87('0x27')](_0x5b87('0xde'),_0x3c94ff[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x3c94ff['sip_id'])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x3c94ff,_0x5b87('0xdf'));}var _0x68d33c=this[_0x5b87('0x1a')]['sync'](this,_0x3c94ff[_0x5b87('0xe0')]);if(!_0x68d33c){return this[_0x5b87('0xe')]['error'](_0x3c94ff,_0x5b87('0xe1'));}var _0x26ddbd=this[_0x5b87('0xe')]['exec'](_0x5b87('0xe2'),[util[_0x5b87('0x27')](_0x5b87('0xe3'),_0x68d33c),_0x3c94ff[_0x5b87('0x68')],_0x3c94ff['opts'],_0x3c94ff['url']]);if(_0x26ddbd[_0x5b87('0xa4')]===-0x1){return _0x26ddbd;}return this['channel'][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xe4'),_0x5b87('0xe2')));};AGIVertices[_0x5b87('0x11')]['dialogflow']=function(_0x1f5308){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0xe5'),_0x1f5308['label']));if(!this[_0x5b87('0x88')](_0x1f5308[_0x5b87('0x7a')])){return this[_0x5b87('0xe')]['noop'](_0x5b87('0xe6'));}if(!this['isConfigured'](_0x1f5308[_0x5b87('0x5f')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0xac'));}this[_0x5b87('0xe')][_0x5b87('0xe7')]=!![];this[_0x5b87('0x36')](_0x1f5308);this[_0x5b87('0x42')](_0x1f5308[_0x5b87('0x5f')],'in','','');this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xe8'),_0x1f5308[_0x5b87('0x5f')]));var _0x4280fe=this[_0x5b87('0x79')][_0x5b87('0x71')](this,_0x1f5308);if(_0x4280fe){for(var _0x3aca02 in _0x4280fe){if(_0x4280fe['hasOwnProperty'](_0x3aca02)){this[_0x5b87('0xe')][_0x5b87('0xa6')](util[_0x5b87('0x27')]('DIALOGFLOW_%s',_0x3aca02[_0x5b87('0xe9')]()),_0x4280fe[_0x3aca02]);}}this[_0x5b87('0x42')](_0x4280fe[_0x5b87('0xea')],'out',_0x5b87('0xeb'),'');return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xec'),_0x4280fe[_0x5b87('0xea')]));}return this['channel'][_0x5b87('0x2a')](_0x1f5308,_0x5b87('0xed'));};AGIVertices[_0x5b87('0x11')][_0x5b87('0xee')]=function(_0x2afdec){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0xef'),_0x2afdec['label']));if(!this[_0x5b87('0x88')](_0x2afdec[_0x5b87('0x7d')])){return this[_0x5b87('0xe')]['noop'](_0x5b87('0xf0'));}if(!this[_0x5b87('0x88')](_0x2afdec[_0x5b87('0x7e')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0xf1'));}if(!this['isConfigured'](_0x2afdec[_0x5b87('0x7f')])){return this[_0x5b87('0xe')][_0x5b87('0xab')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x2afdec[_0x5b87('0x80')])){return this[_0x5b87('0xe')][_0x5b87('0xab')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x2afdec[_0x5b87('0x5f')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x5b87('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x2afdec);this[_0x5b87('0x42')](_0x2afdec[_0x5b87('0x5f')],'in','','');this[_0x5b87('0xe')]['noop'](util['format'](_0x5b87('0xf2'),_0x2afdec[_0x5b87('0x5f')]));var _0xf6a134=this[_0x5b87('0x7c')][_0x5b87('0x71')](this,_0x2afdec);if(_0xf6a134){for(var _0x3daf64 in _0xf6a134){if(_0xf6a134['hasOwnProperty'](_0x3daf64)){if(_0x3daf64!==_0x5b87('0xf3')){this[_0x5b87('0xe')][_0x5b87('0xa6')](util[_0x5b87('0x27')]('DIALOGFLOW_%s',_0x3daf64[_0x5b87('0xe9')]()),_0xf6a134[_0x3daf64]);}}}this[_0x5b87('0x42')](_0xf6a134[_0x5b87('0xea')],'out',_0x5b87('0xee'),_0xf6a134[_0x5b87('0xf3')]);return this['channel'][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xf4'),_0xf6a134[_0x5b87('0xea')]));}return this[_0x5b87('0xe')]['error'](_0x2afdec,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x41c409){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0xf5'),_0x41c409[_0x5b87('0x37')]));if(!this['isConfigured'](_0x41c409[_0x5b87('0xf6')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0xf7'));}if(!this[_0x5b87('0x88')](_0x41c409['username'])){return this[_0x5b87('0xe')][_0x5b87('0xab')]('no\x20username\x20configured');}if(!this[_0x5b87('0x88')](_0x41c409[_0x5b87('0xf8')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0xf9'));}if(!this[_0x5b87('0x88')](_0x41c409[_0x5b87('0xfa')])){return this['channel'][_0x5b87('0xab')](_0x5b87('0xac'));}this[_0x5b87('0xe')][_0x5b87('0xe7')]=!![];this[_0x5b87('0x36')](_0x41c409);this[_0x5b87('0x42')](_0x41c409[_0x5b87('0x5f')],'in','','');this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xfb'),_0x41c409[_0x5b87('0x5f')]));var _0x356a49=this[_0x5b87('0x81')]['sync'](this,_0x41c409);if(_0x356a49){for(var _0x522d3a in _0x356a49){if(_0x356a49['hasOwnProperty'](_0x522d3a)){this['channel'][_0x5b87('0xa6')](util[_0x5b87('0x27')]('SESTEK_NDA_%s',_0x522d3a[_0x5b87('0xe9')]()),_0x356a49[_0x522d3a]);}}this[_0x5b87('0x42')](_0x356a49['speech'],_0x5b87('0xfc'),_0x5b87('0xfd'),'');if(_0x356a49[_0x5b87('0xfe')]){this[_0x5b87('0xe')][_0x5b87('0xab')](util['format'](_0x5b87('0xff'),_0x356a49[_0x5b87('0xfe')]));var _0x347bfb=this[_0x5b87('0xe')][_0x5b87('0x100')](_0x356a49[_0x5b87('0xfe')]);try{fs[_0x5b87('0x101')](_0x356a49[_0x5b87('0xfe')]+_0x5b87('0x102'));}catch(_0x4cce9c){logger[_0x5b87('0x2a')](_0x4cce9c);}return _0x347bfb;}else{return this['channel'][_0x5b87('0xab')](util[_0x5b87('0x27')]('SestekNDA\x20Result\x20%s',_0x356a49[_0x5b87('0xea')]));}}return this[_0x5b87('0xe')]['error'](_0x41c409,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x5b87('0x11')]['end']=function(_0x5f4e05){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x103'),_0x5f4e05[_0x5b87('0x37')]));return this[_0x5b87('0xe')][_0x5b87('0xab')]('end');};AGIVertices[_0x5b87('0x11')]['ext_dial']=function(_0xc061e4){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x104'),_0xc061e4[_0x5b87('0x37')]));var _0x24cbeb='';if(_0xc061e4['trunk_id']){if(!this[_0x5b87('0x88')](_0xc061e4[_0x5b87('0x105')])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0xc061e4,_0x5b87('0x106'));}else{var _0x1896bd=parseInt(_0xc061e4['trunk_id'],0xa);if(isNaN(_0x1896bd)){_0x24cbeb=_0xc061e4[_0x5b87('0x105')];}else{_0x24cbeb=this['getTrunk']['sync'](this,_0xc061e4[_0x5b87('0x105')]);if(!_0x24cbeb){return this[_0x5b87('0xe')]['error'](_0xc061e4,_0x5b87('0x107'));}}}}else if(_0xc061e4[_0x5b87('0x108')]){_0x24cbeb=_0xc061e4[_0x5b87('0x108')];}else{return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0xc061e4,_0x5b87('0x106'));}var _0x5602b8=this[_0x5b87('0xe')][_0x5b87('0x59')](_0x5b87('0xe2'),[util[_0x5b87('0x27')](_0x5b87('0x109'),_0x24cbeb,_0xc061e4['phone']),_0xc061e4[_0x5b87('0x68')],_0xc061e4[_0x5b87('0x10a')],_0xc061e4[_0x5b87('0x66')]]);if(_0x5602b8[_0x5b87('0xa4')]===-0x1){return _0x5602b8;}return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xe4'),_0x5b87('0xe2')));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x10b')]=function(_0x8a4343){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x8a4343[_0x5b87('0x37')]));return this[_0x5b87('0xe')][_0x5b87('0xab')]('finally');};AGIVertices[_0x5b87('0x11')][_0x5b87('0xc')]=function(_0x284a66){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x10c'),_0x284a66[_0x5b87('0x37')]));if(_0x284a66['retry']===0x0){return this[_0x5b87('0xa7')](_0x284a66);}_0x284a66['retry']-=0x1;if(!this[_0x5b87('0x88')](_0x284a66[_0x5b87('0x10d')])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x284a66,_0x5b87('0x10e'));}var _0x26b66a=this[_0x5b87('0x1e')][_0x5b87('0x71')](this,_0x284a66[_0x5b87('0x10d')]);if(!_0x26b66a){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x284a66,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x284a66[_0x5b87('0x10f')])){return this['channel'][_0x5b87('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x57991f=this[_0x5b87('0xe')][_0x5b87('0x110')](_0x26b66a,_0x284a66[_0x5b87('0x111')],_0x284a66['maxdigit']);var _0x1e2d0e=_0x57991f[_0x5b87('0xa4')]?_0x57991f['result']['toString']():'';logger[_0x5b87('0x2c')](_0x5b87('0x112'),JSON[_0x5b87('0x74')](_0x57991f));if(_0x57991f[_0x5b87('0xa4')]===-0x1){this['createSquareDetailsReport'][_0x5b87('0x71')](this,_0x284a66,_0x1e2d0e);return _0x57991f;}else if(_0x57991f[_0x5b87('0xa2')]===_0x5b87('0x68')){_0x57991f['result']=_0x1e2d0e['length']>=parseInt(_0x284a66[_0x5b87('0x113')])?'x':'i';}else{_0x57991f[_0x5b87('0xa4')]=_0x1e2d0e[_0x5b87('0x9d')]>=parseInt(_0x284a66[_0x5b87('0x113')])&&_0x1e2d0e[_0x5b87('0x9d')]<=parseInt(_0x284a66[_0x5b87('0x114')])?'x':'i';}var _0x4ef329=this[_0x5b87('0xa1')][_0x5b87('0x71')](this,_0x284a66[_0x5b87('0x10f')]);if(!_0x4ef329){return this['channel'][_0x5b87('0x2a')](_0x284a66,_0x5b87('0xd6'));}this['channel']['setVariable'](_0x4ef329,_0x1e2d0e);if(this[_0x5b87('0x88')](_0x284a66[_0x5b87('0x115')])){var _0x243a69=parseInt(_0x284a66[_0x5b87('0x115')],0xa);var _0x8ff065=rs[_0x5b87('0x116')]({'charset':'*','length':_0x243a69});var _0x3f166f=_0x1e2d0e[_0x5b87('0x9d')];if(_0x3f166f>0x0){if(_0x3f166f>_0x243a69){this[_0x5b87('0x36')][_0x5b87('0x71')](this,_0x284a66,_0x284a66['hiddendigitspos']==='first'?_0x8ff065+_0x1e2d0e[_0x5b87('0x117')](_0x243a69):_0x1e2d0e[_0x5b87('0x117')](0x0,_0x3f166f-_0x243a69)+_0x8ff065);}else{this[_0x5b87('0x36')][_0x5b87('0x71')](this,_0x284a66,rs[_0x5b87('0x116')]({'charset':'*','length':_0x3f166f}));}}else{this[_0x5b87('0x36')][_0x5b87('0x71')](this,_0x284a66,'');}}else{this['createSquareDetailsReport'][_0x5b87('0x71')](this,_0x284a66,_0x1e2d0e);}return _0x57991f;};AGIVertices['prototype'][_0x5b87('0xd')]=function(_0x3597ad){logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x118'),_0x3597ad[_0x5b87('0x37')]));return this[_0x5b87('0xc')](_0x3597ad);};AGIVertices[_0x5b87('0x11')]['goal']=function(_0x576ed3){logger[_0x5b87('0x2c')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x576ed3['label']));this[_0x5b87('0x36')][_0x5b87('0x71')](this,_0x576ed3,_0x576ed3[_0x5b87('0x119')]);return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x11a'),_0x576ed3[_0x5b87('0x119')]));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x11b')]=function(_0x6dde1c){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x11c'),_0x6dde1c[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x6dde1c[_0x5b87('0x8b')])||!this[_0x5b87('0x88')](_0x6dde1c[_0x5b87('0x91')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0x11d'));}if(!this['isConfigured'](_0x6dde1c[_0x5b87('0x5f')])){return this[_0x5b87('0xe')][_0x5b87('0xab')]('no\x20text\x20configured');}this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x11e'),_0x6dde1c[_0x5b87('0x5f')]));var _0x3890ac=this[_0x5b87('0x8a')][_0x5b87('0x71')](this,_0x6dde1c);if(_0x3890ac){this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x11f'),_0x3890ac));var _0xd73718=this[_0x5b87('0xe')][_0x5b87('0x100')](_0x3890ac);try{fs[_0x5b87('0x101')](_0x3890ac+_0x5b87('0x102'));}catch(_0x57090b){logger[_0x5b87('0x2a')](_0x57090b);}return _0xd73718;}return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x6dde1c,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x5b87('0x11')][_0x5b87('0x120')]=function(_0x4042d0){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x121'),_0x4042d0[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x4042d0[_0x5b87('0x8b')])||!this[_0x5b87('0x88')](_0x4042d0[_0x5b87('0x91')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0x11d'));}if(!this[_0x5b87('0x88')](_0x4042d0[_0x5b87('0x122')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0x123'));}if(!this['isConfigured'](_0x4042d0['text'])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0xac'));}this['channel'][_0x5b87('0xe7')]=!![];this[_0x5b87('0x36')](_0x4042d0);this[_0x5b87('0x42')](_0x4042d0[_0x5b87('0x5f')],'in','','');this[_0x5b87('0xe')][_0x5b87('0xab')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x4042d0[_0x5b87('0x5f')]));var _0x24dee2=this[_0x5b87('0x90')]['sync'](this,_0x4042d0);if(_0x24dee2){for(var _0x5584e8 in _0x24dee2){if(_0x24dee2[_0x5b87('0x96')](_0x5584e8)&&_[_0x5b87('0x97')](_0x24dee2[_0x5584e8])){this[_0x5b87('0xe')][_0x5b87('0xa6')](util['format'](_0x5b87('0x124'),_0x5584e8['toUpperCase']()),_0x24dee2[_0x5584e8]);}}if(_[_0x5b87('0x48')](_0x24dee2[_0x5b87('0x77')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0x125'));}else{this['createSquareMessage'](_0x24dee2[_0x5b87('0x77')],_0x5b87('0xfc'),_0x5b87('0x126'),'');return this[_0x5b87('0xe')][_0x5b87('0xab')](util['format'](_0x5b87('0x127'),_0x24dee2['message']));}}return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x4042d0,_0x5b87('0x128'));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x129')]=function(_0x37337e){logger[_0x5b87('0x2c')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x37337e[_0x5b87('0x37')],_0x37337e[_0x5b87('0x68')]));if(!this[_0x5b87('0x88')](_0x37337e['key'])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0xe6'));}var _0x16c8b6=_0x5b87('0x12a');var _0x4b9692=util['format'](_0x5b87('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x2fb942=util[_0x5b87('0x27')](_0x5b87('0x9f'),_0x4b9692,_0x16c8b6);var _0x19188b=!![];if(_0x37337e[_0x5b87('0x12c')]===_0x5b87('0x12d')){_0x19188b=![];}var _0x3598df=this['channel'][_0x5b87('0x12e')](_0x4b9692,_0x16c8b6,_0x37337e[_0x5b87('0x12f')],_0x37337e[_0x5b87('0x68')],undefined,_0x19188b);if(_0x3598df['result']!==-0x1){this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x130'),_0x2fb942));var _0x437513=this[_0x5b87('0x93')][_0x5b87('0x71')](this,_0x37337e,_0x2fb942);if(_0x437513){for(var _0xe46321 in _0x437513){if(_0x437513[_0x5b87('0x96')](_0xe46321)){this[_0x5b87('0xe')][_0x5b87('0xa6')](util['format']('GOOGLE_ASR_%s',_0xe46321[_0x5b87('0xe9')]()),_0x437513[_0xe46321]);}}return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x131'),JSON[_0x5b87('0x74')](_0x437513)));}}return _0x3598df;};AGIVertices[_0x5b87('0x11')]['tildeasr']=function(_0x5f5850){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x132'),_0x5f5850[_0x5b87('0x37')]));if(!this['isConfigured'](_0x5f5850[_0x5b87('0x133')])){return this[_0x5b87('0xe')]['noop'](_0x5b87('0x134'));}if(!this[_0x5b87('0x88')](_0x5f5850[_0x5b87('0x135')])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0x136'));}var _0x136d3d=_0x5b87('0x12a');var _0x39c3ce=util['format'](_0x5b87('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x157381=util[_0x5b87('0x27')]('%s.%s',_0x39c3ce,_0x136d3d);var _0x18b8cc=!![];if(_0x5f5850['beep']===_0x5b87('0x12d')){_0x18b8cc=![];}var _0x28810c=this['channel']['recordFile'](_0x39c3ce,_0x136d3d,_0x5f5850[_0x5b87('0x12f')],_0x5f5850[_0x5b87('0x68')],undefined,_0x18b8cc);if(_0x28810c[_0x5b87('0xa4')]!==-0x1){this['channel'][_0x5b87('0xab')](util[_0x5b87('0x27')]('tilde\x20%s\x20file\x20created',_0x157381));var _0x3b6bce=this['tildeASR'][_0x5b87('0x71')](this,_0x5f5850,_0x157381);if(_0x3b6bce){for(var _0x1f0552 in _0x3b6bce){if(_0x3b6bce[_0x5b87('0x96')](_0x1f0552)){this[_0x5b87('0xe')]['setVariable'](util[_0x5b87('0x27')](_0x5b87('0x137'),_0x1f0552[_0x5b87('0xe9')]()),_0x3b6bce[_0x1f0552]);}}return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')]('TildeASR\x20Result\x20%s',JSON[_0x5b87('0x74')](_0x3b6bce)));}}return _0x28810c;};AGIVertices['prototype'][_0x5b87('0x138')]=function(_0x155f7b){logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x139'),_0x155f7b[_0x5b87('0x37')]));return this['channel'][_0x5b87('0x13a')](_0x155f7b[_0x5b87('0x3d')],_0x155f7b[_0x5b87('0x13b')],_0x155f7b['priority']);};AGIVertices['prototype'][_0x5b87('0x13c')]=function(_0x57e2eb){logger[_0x5b87('0x2c')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x57e2eb[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x57e2eb[_0x5b87('0x13d')])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x57e2eb,_0x5b87('0x13e'));}try{var _0x366299=eval(_0x57e2eb[_0x5b87('0x13d')])?_0x5b87('0x13f'):_0x5b87('0x140');this[_0x5b87('0xe')]['noop'](util[_0x5b87('0x27')](_0x5b87('0x141'),_0x57e2eb['condition'],_0x366299));return{'code':0xc8,'result':_0x366299};}catch(_0x3c38eb){return{'code':0xc8,'result':_0x5b87('0x140')};}};AGIVertices[_0x5b87('0x11')][_0x5b87('0x142')]=function(_0x4332fb){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x143'),_0x4332fb[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x4332fb[_0x5b87('0x144')])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x4332fb,_0x5b87('0x145'));}var _0xe9ed1a=this['getIntervals'][_0x5b87('0x71')](this,_0x4332fb['interval_id']);if(!_0xe9ed1a){return this[_0x5b87('0xe')]['error'](_0x4332fb,_0x5b87('0x146'));}for(var _0x597b26=0x0;_0x597b26<_0xe9ed1a[_0x5b87('0x9d')];_0x597b26+=0x1){var _0x218b8a=this['channel'][_0x5b87('0xa1')](util[_0x5b87('0x27')](_0x5b87('0x147'),_0xe9ed1a[_0x597b26]));if(_0x218b8a[_0x5b87('0xa4')]===-0x1){return _0x218b8a;}logger['info'](util[_0x5b87('0x27')]('IFTIME\x20%s\x20%s',_0xe9ed1a[_0x597b26],_0x218b8a[_0x5b87('0xa2')]));if(_0x218b8a['extra']==='true'){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x148'),_0xe9ed1a[_0x597b26],_0x5b87('0x13f')));this['channel']['noop'](util[_0x5b87('0x27')]('IFTIME\x20%s\x20%s',_0xe9ed1a[_0x597b26],'true'));return{'code':0xc8,'result':_0x5b87('0x13f')};}else{logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x148'),_0xe9ed1a[_0x597b26],_0x5b87('0x140')));this[_0x5b87('0xe')]['noop'](util[_0x5b87('0x27')](_0x5b87('0x148'),_0xe9ed1a[_0x597b26],_0x5b87('0x140')));}}return{'code':0xc8,'result':_0x5b87('0x140')};};AGIVertices[_0x5b87('0x11')][_0x5b87('0x149')]=function(_0x335d24){logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x14a'),_0x335d24['label']));return this[_0x5b87('0xe')]['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x15f14c){logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x14b'),_0x15f14c[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x15f14c['key'])){return this['channel']['noop'](_0x5b87('0xe6'));}var _0x1241bc=_0x5b87('0x12a');var _0x42a95a=util[_0x5b87('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x5b87('0x116')](0x4));var _0x263baa=util['format'](_0x5b87('0x9f'),_0x42a95a,_0x1241bc);var _0x1448e0=!![];if(_0x15f14c[_0x5b87('0x12c')]===_0x5b87('0x12d')){_0x1448e0=![];}var _0x121b20=this[_0x5b87('0xe')][_0x5b87('0x12e')](_0x42a95a,_0x1241bc,_0x15f14c[_0x5b87('0x12f')],_0x15f14c[_0x5b87('0x68')],undefined,_0x1448e0);if(_0x121b20[_0x5b87('0xa4')]!==-0x1){this[_0x5b87('0xe')][_0x5b87('0xab')](util['format'](_0x5b87('0x14c'),_0x263baa));var _0x281508=this['ispeechASR'][_0x5b87('0x71')](this,_0x15f14c,_0x263baa);if(_0x281508){for(var _0x42e5a6 in _0x281508){if(_0x281508[_0x5b87('0x96')](_0x42e5a6)){this[_0x5b87('0xe')][_0x5b87('0xa6')](util[_0x5b87('0x27')](_0x5b87('0x14d'),_0x42e5a6['toUpperCase']()),_0x281508[_0x42e5a6]);}}return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x281508)));}}return _0x121b20;};AGIVertices[_0x5b87('0x11')]['ispeechtts']=function(_0x2d5a10){logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x14e'),_0x2d5a10[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x2d5a10['key'])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0xe6'));}if(!this[_0x5b87('0x88')](_0x2d5a10[_0x5b87('0x5f')])){return this[_0x5b87('0xe')]['noop'](_0x5b87('0xac'));}this[_0x5b87('0xe')][_0x5b87('0xab')](util['format'](_0x5b87('0x14f'),_0x2d5a10['text']));var _0x2feec8=this[_0x5b87('0x82')][_0x5b87('0x71')](this,_0x2d5a10);if(_0x2feec8){this[_0x5b87('0xe')]['noop'](util[_0x5b87('0x27')]('ispeech\x20%s\x20file\x20created',_0x2feec8));var _0x402d20=this['channel'][_0x5b87('0x100')](_0x2feec8,_0x2d5a10['intKey']);try{fs[_0x5b87('0x101')](_0x2feec8+'.wav');}catch(_0x59e37c){logger[_0x5b87('0x2a')](_0x59e37c);}return _0x402d20;}return this[_0x5b87('0xe')]['error'](_0x2d5a10,_0x5b87('0x150'));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x151')]=function(_0x3742b4){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x152'),_0x3742b4[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x3742b4['findBy'])){return this[_0x5b87('0xe')]['error'](_0x3742b4,'no\x20find\x20by\x20configured');}logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x153'),this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x3742b4[_0x5b87('0x154')]));var _0x211d59=this[_0x5b87('0x54')][_0x5b87('0x71')](this,_0x3742b4['findBy']);if(_0x211d59){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5b87('0xe')]['callerid'],_0x3742b4[_0x5b87('0x154')]));this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x155'),this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x3742b4[_0x5b87('0x154')]));return{'code':0xc8,'result':_0x5b87('0x156')};}else{logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x157'),this['channel'][_0x5b87('0x3a')],_0x3742b4[_0x5b87('0x154')]));this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x157'),this['channel'][_0x5b87('0x3a')],_0x3742b4[_0x5b87('0x154')]));return{'code':0xc8,'result':_0x5b87('0x158')};}};AGIVertices[_0x5b87('0x11')][_0x5b87('0x159')]=function(_0x1eba98){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1eba98[_0x5b87('0x37')]));if(!this['isConfigured'](_0x1eba98[_0x5b87('0x154')])){return this['channel'][_0x5b87('0x2a')](_0x1eba98,_0x5b87('0x15a'));}logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x153'),this[_0x5b87('0xe')]['callerid'],_0x1eba98['findBy']));var _0x14e8e8=this['agentLogout'][_0x5b87('0x71')](this,_0x1eba98[_0x5b87('0x154')]);if(_0x14e8e8){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x155'),this['channel']['callerid'],_0x1eba98['findBy']));this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x155'),this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x1eba98[_0x5b87('0x154')]));return{'code':0xc8,'result':_0x5b87('0x156')};}else{logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x157'),this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x1eba98['findBy']));this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x1eba98['findBy']));return{'code':0xc8,'result':_0x5b87('0x158')};}};AGIVertices[_0x5b87('0x11')]['math']=function(_0x269e1e){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x15b'),_0x269e1e['label']));if(!this[_0x5b87('0x88')](_0x269e1e['operation'])){return this[_0x5b87('0xe')]['error'](_0x269e1e,_0x5b87('0x15c'));}this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x15d'),_0x269e1e[_0x5b87('0x15e')]));var _0x58e17d=eval(_0x269e1e[_0x5b87('0x15e')]);if(!this['isConfigured'](_0x269e1e[_0x5b87('0x10f')])){return this['channel'][_0x5b87('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x28db9a=this['getVariable'][_0x5b87('0x71')](this,_0x269e1e[_0x5b87('0x10f')]);if(!_0x28db9a){return this['channel'][_0x5b87('0x2a')](_0x269e1e,_0x5b87('0xd6'));}if(_[_0x5b87('0x9c')](_0x58e17d)){var _0x238530=this;_0x58e17d['forEach'](function(_0x4a6e0f,_0x5358e4){_0x238530['channel'][_0x5b87('0xa6')](util[_0x5b87('0x27')]('%s[%s]',_0x28db9a,_0x5358e4),_0x4a6e0f);});return this['channel'][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x15f'),_0x28db9a));}else{return this[_0x5b87('0xe')][_0x5b87('0xa6')](_0x28db9a,_0x58e17d);}};AGIVertices[_0x5b87('0x11')][_0x5b87('0xb')]=function(_0x1ac276){logger['info'](util['format'](_0x5b87('0x160'),_0x1ac276[_0x5b87('0x37')]));if(_0x1ac276['retry']===0x0){return this['maxRetry'](_0x1ac276);}_0x1ac276[_0x5b87('0xa8')]-=0x1;if(!this[_0x5b87('0x88')](_0x1ac276[_0x5b87('0x10d')])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x1ac276,_0x5b87('0x10e'));}var _0x20de1a=this[_0x5b87('0x1e')][_0x5b87('0x71')](this,_0x1ac276[_0x5b87('0x10d')]);if(!_0x20de1a){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x1ac276,'no\x20file\x20audio\x20found');}var _0x26217d=this[_0x5b87('0xe')][_0x5b87('0x110')](_0x20de1a,_0x1ac276[_0x5b87('0x111')],_0x1ac276[_0x5b87('0x161')]);var _0x54fc5e=_0x26217d['result'];if(_0x26217d['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x1ac276,'-1');return _0x26217d;}else if(_0x26217d[_0x5b87('0xa2')]===_0x5b87('0x68')){_0x26217d[_0x5b87('0xa4')]=_0x26217d[_0x5b87('0xa4')][_0x5b87('0x9d')]>0x0?_0x26217d['result']:'t';}else if(_[_0x5b87('0x46')](_0x26217d[_0x5b87('0xa4')])){_0x26217d[_0x5b87('0xa4')]='#';_0x54fc5e='#';}if(!this[_0x5b87('0x88')](_0x1ac276[_0x5b87('0x10f')])){this[_0x5b87('0xe')]['noop'](_0x5b87('0xd5'));}else{var _0x56b578=this[_0x5b87('0xa1')][_0x5b87('0x71')](this,_0x1ac276[_0x5b87('0x10f')]);if(!_0x56b578){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x1ac276,_0x5b87('0xd6'));}this[_0x5b87('0xe')]['setVariable'](_0x56b578,_0x54fc5e);}this[_0x5b87('0x36')][_0x5b87('0x71')](this,_0x1ac276,_0x54fc5e);return _0x26217d;};AGIVertices[_0x5b87('0x11')][_0x5b87('0xab')]=function(_0x4649f2){logger['info'](util[_0x5b87('0x27')](_0x5b87('0x162'),_0x4649f2['label']));return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x4649f2['output']||_0x4649f2[_0x5b87('0x37')]);};AGIVertices['prototype'][_0x5b87('0x163')]=function(_0x52c688){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x164'),_0x52c688['label']));if(!this[_0x5b87('0x88')](_0x52c688[_0x5b87('0x154')])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x52c688,_0x5b87('0x15a'));}logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x153'),this['channel']['callerid'],_0x52c688['findBy']));var _0x1e8ace=this[_0x5b87('0x4e')][_0x5b87('0x71')](this,_0x52c688['pause_id']);var _0xa26900=this[_0x5b87('0x50')][_0x5b87('0x71')](this,_0x52c688[_0x5b87('0x154')],_0x1e8ace);if(_0xa26900){logger['info'](util[_0x5b87('0x27')](_0x5b87('0x155'),this['channel'][_0x5b87('0x3a')],_0x52c688['findBy']));this[_0x5b87('0xe')][_0x5b87('0xab')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5b87('0xe')]['callerid'],_0x52c688[_0x5b87('0x154')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x5b87('0x27')](_0x5b87('0x157'),this['channel'][_0x5b87('0x3a')],_0x52c688[_0x5b87('0x154')]));this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x155'),this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x52c688[_0x5b87('0x154')]));return{'code':0xc8,'result':_0x5b87('0x158')};}};AGIVertices[_0x5b87('0x11')][_0x5b87('0x165')]=function(_0x18c637){logger['info'](util[_0x5b87('0x27')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x18c637[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x18c637[_0x5b87('0x10d')])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x18c637,_0x5b87('0x10e'));}var _0x4d8fc9=this[_0x5b87('0x1e')][_0x5b87('0x71')](this,_0x18c637[_0x5b87('0x10d')]);if(!_0x4d8fc9){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x18c637,'no\x20file\x20audio\x20found');}var _0x51e6ac=this[_0x5b87('0xe')][_0x5b87('0x59')]('PLAYBACK',[_0x4d8fc9,_0x18c637[_0x5b87('0x10a')]]);if(_0x51e6ac[_0x5b87('0xa4')]===-0x1){return _0x51e6ac;}return this['channel'][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xc4'),_0x5b87('0x166'),_0x4d8fc9));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x167')]=function(_0x1af2ac){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x1af2ac[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x1af2ac['queue_id'])){return this['channel'][_0x5b87('0x2a')](_0x1af2ac,_0x5b87('0x168'));}var _0x3929a4='';var _0x261921=parseInt(_0x1af2ac[_0x5b87('0x169')],0xa);if(isNaN(_0x261921)){_0x3929a4=_0x1af2ac[_0x5b87('0x169')];}else{_0x3929a4=this[_0x5b87('0x15')][_0x5b87('0x71')](this,_0x1af2ac[_0x5b87('0x169')]);if(!_0x3929a4){return this[_0x5b87('0xe')]['error'](_0x1af2ac,'no\x20queue\x20found');}}var _0x1baea0='';if(this[_0x5b87('0x88')](_0x1af2ac[_0x5b87('0x10d')])){var _0x3d651f=this[_0x5b87('0x1e')]['sync'](this,_0x1af2ac[_0x5b87('0x10d')]);if(_0x3d651f){_0x1baea0=_0x3d651f;}}this[_0x5b87('0x36')]['sync'](this,_0x1af2ac,_0x3929a4);if(_0x1af2ac['opts'][_0x5b87('0x16a')]('x')<0x0){_0x1af2ac[_0x5b87('0x10a')]+='x';}if(_0x1af2ac[_0x5b87('0x10a')]['indexOf']('X')<0x0){_0x1af2ac[_0x5b87('0x10a')]+='X';}this[_0x5b87('0xe')][_0x5b87('0xa6')](_0x5b87('0x16b'),_0x3929a4?_0x3929a4['toLowerCase']():'');var _0xdb2d1d=this[_0x5b87('0xe')]['exec'](_0x5b87('0x16c'),[_0x3929a4,_0x1af2ac[_0x5b87('0x10a')],_0x1af2ac[_0x5b87('0x66')],_0x1baea0,_0x1af2ac[_0x5b87('0x68')],_0x1af2ac[_0x5b87('0x5')],_0x1af2ac['macro'],_0x1af2ac[_0x5b87('0x16d')],'',_0x1af2ac['position']]);if(_0xdb2d1d[_0x5b87('0xa4')]===-0x1){return _0xdb2d1d;}return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xc4'),_0x5b87('0x16c'),_0x3929a4));};AGIVertices['prototype'][_0x5b87('0x16e')]=function(_0x37f710){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x37f710['label']));var _0x1c092d=_0x37f710['recordingFormat']||_0x5b87('0x12a');var _0x524f0e=util['format'](_0x5b87('0x16f'),this[_0x5b87('0xe')][_0x5b87('0x3c')],rs['generate'](0x5));var _0x45ab17=util['format'](_0x5b87('0x170'),FILES_PATH,_0x524f0e,_0x1c092d);var _0x32292b=util[_0x5b87('0x27')](_0x5b87('0x12b'),FILES_PATH,_0x524f0e);this[_0x5b87('0x3b')][_0x5b87('0x71')](this,_0x37f710,_0x524f0e,_0x45ab17);this[_0x5b87('0xe')][_0x5b87('0xa6')](_0x5b87('0x171'),_0x524f0e);logger[_0x5b87('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x32292b,_0x1c092d,_0x37f710[_0x5b87('0x172')],_0x37f710[_0x5b87('0x68')]);return this[_0x5b87('0xe')]['recordFile'](_0x32292b,_0x1c092d,_0x37f710[_0x5b87('0x172')],_0x37f710[_0x5b87('0x68')],undefined,!![]);};AGIVertices[_0x5b87('0x11')][_0x5b87('0x173')]=function(_0xbfb0c4){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x174'),_0xbfb0c4[_0x5b87('0x37')]));if(!this['isConfigured'](_0xbfb0c4[_0x5b87('0x66')])){return this[_0x5b87('0xe')]['noop'](_0x5b87('0x175'));}var _0x2cdc45=this[_0x5b87('0x65')][_0x5b87('0x71')](this,_0xbfb0c4);logger['info'](util[_0x5b87('0x27')](_0x5b87('0x176'),util['inspect'](_0x2cdc45,{'showHidden':![],'depth':null})));if(!this[_0x5b87('0x88')](_0xbfb0c4['variable_id'])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0x177'));}var _0x273808=this[_0x5b87('0xa1')][_0x5b87('0x71')](this,_0xbfb0c4[_0x5b87('0x10f')]);if(!_0x273808){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0xbfb0c4,_0x5b87('0xd6'));}this[_0x5b87('0xe')][_0x5b87('0xa6')](util[_0x5b87('0x27')](_0x5b87('0x178'),_0x273808),_0x2cdc45[_0x5b87('0x76')]?_0x2cdc45[_0x5b87('0x76')]:_0x5b87('0x179'));this[_0x5b87('0xe')][_0x5b87('0xa6')](util[_0x5b87('0x27')](_0x5b87('0x17a'),_0x273808),_0x2cdc45['statusMessage']?_0x2cdc45['statusMessage']:'OK');if(_0x2cdc45[_0x5b87('0x6b')]){try{this[_0x5b87('0x9e')](_0x2cdc45[_0x5b87('0x6b')],_0x273808);}catch(_0x2b8860){logger[_0x5b87('0x2a')](util[_0x5b87('0x27')](_0x5b87('0x17b'),_0x273808));}}return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xdb'),_0x273808));};AGIVertices['prototype'][_0x5b87('0x17c')]=function(_0x45b16a){logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x17d'),_0x45b16a['label']));return this[_0x5b87('0xe')][_0x5b87('0x17e')](_0x45b16a[_0x5b87('0x17f')][_0x5b87('0x5b')](/\s+/g,''),_0x45b16a[_0x5b87('0x172')]);};AGIVertices[_0x5b87('0x11')][_0x5b87('0x180')]=function(_0x8fc767){logger['info'](util[_0x5b87('0x27')](_0x5b87('0x181'),_0x8fc767[_0x5b87('0x37')]));return this[_0x5b87('0xe')]['sayNumber'](_0x8fc767['number'][_0x5b87('0x5b')](/\s+/g,''),_0x8fc767['escape_digits']);};AGIVertices[_0x5b87('0x11')][_0x5b87('0x182')]=function(_0x22a348){logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x183'),_0x22a348['label']));return this[_0x5b87('0xe')][_0x5b87('0x184')](_0x22a348[_0x5b87('0x5f')],_0x22a348[_0x5b87('0x172')]);};AGIVertices[_0x5b87('0x11')][_0x5b87('0x185')]=function(_0xf3acc5){logger[_0x5b87('0x2c')](util['format'](_0x5b87('0x186'),_0xf3acc5[_0x5b87('0x37')]));if(!this['isConfigured'](_0xf3acc5[_0x5b87('0x187')])){return this[_0x5b87('0xe')]['noop']('no\x20mail\x20account\x20configured');}var _0x429de3=this[_0x5b87('0x1f')][_0x5b87('0x71')](this,_0xf3acc5['account_id']);if(!_0x429de3||!_0x429de3[_0x5b87('0x188')]){return this[_0x5b87('0xe')]['error'](_0xf3acc5,'no\x20mail\x20account\x20found');}var _0x4d9d48={'from':util[_0x5b87('0x27')]('\x22%s\x22\x20<%s>',_0x429de3['name'],_0x429de3['email']||_0x429de3[_0x5b87('0x188')][_0x5b87('0x189')]),'to':_0xf3acc5['to']||'','cc':_0xf3acc5['cc']||'','bcc':_0xf3acc5[_0x5b87('0x18a')]||'','subject':_0xf3acc5[_0x5b87('0x18b')],'html':_0xf3acc5[_0x5b87('0x5f')],'text':_0xf3acc5[_0x5b87('0x5f')]};var _0x45721c={'tls':{'rejectUnauthorized':![]}};if(_0x429de3[_0x5b87('0x188')]['service']){_0x45721c[_0x5b87('0x18c')]=_0x429de3[_0x5b87('0x188')]['service'];}else{_0x45721c[_0x5b87('0x18d')]=_0x429de3[_0x5b87('0x188')][_0x5b87('0x18d')];_0x45721c[_0x5b87('0x18e')]=_0x429de3[_0x5b87('0x188')][_0x5b87('0x18e')];_0x45721c[_0x5b87('0x18f')]=_0x429de3[_0x5b87('0x188')][_0x5b87('0x18f')];}if(_0x429de3[_0x5b87('0x188')][_0x5b87('0x190')]){_0x45721c['auth']={'user':_0x429de3['Smtp'][_0x5b87('0x189')],'pass':_0x429de3[_0x5b87('0x188')]['pass']};}if(this['isConfigured'](_0xf3acc5[_0x5b87('0x191')])){}logger[_0x5b87('0xdd')]('sendMail\x20message',JSON[_0x5b87('0x74')](_0x4d9d48));this[_0x5b87('0x36')][_0x5b87('0x71')](this,_0xf3acc5,_0xf3acc5[_0x5b87('0x187')]);this[_0x5b87('0xe')][_0x5b87('0xab')](util['format'](_0x5b87('0x192'),_0x429de3[_0x5b87('0x13')]));this[_0x5b87('0x21')]['sync'](this,_0x45721c,_0x4d9d48);return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0x193'));};AGIVertices['prototype'][_0x5b87('0x194')]=function(_0x532dbb){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x195'),_0x532dbb[_0x5b87('0x37')]));return this[_0x5b87('0xe')]['noop'](_0x5b87('0x196'));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x197')]=function(_0x7fd021){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x198'),_0x7fd021[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x7fd021['sms_account_id'])){return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0x199'));}var _0x2b3746=this[_0x5b87('0x33')][_0x5b87('0x71')](this,_0x7fd021[_0x5b87('0x19a')]);if(!_0x2b3746){return this['channel']['error'](_0x7fd021,'no\x20sms\x20account\x20found');}var _0x1b5195={'body':_0x7fd021[_0x5b87('0x19b')],'phone':_0x7fd021['to']||'','SmsAccountId':_0x2b3746['id']};logger[_0x5b87('0xdd')](_0x5b87('0x19c'),JSON['stringify'](_0x1b5195));this[_0x5b87('0x36')]['sync'](this,_0x7fd021,_0x7fd021[_0x5b87('0x19a')]);this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x19d'),_0x2b3746[_0x5b87('0x13')]));this[_0x5b87('0x35')][_0x5b87('0x71')](this,_0x1b5195);return this[_0x5b87('0xe')][_0x5b87('0xab')](_0x5b87('0x19e'));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x19f')]=function(_0x564cfd){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x1a0'),_0x564cfd[_0x5b87('0x37')]));if(!this[_0x5b87('0x88')](_0x564cfd['variable_id'])){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x564cfd,'no\x20variable\x20selected');}var _0x30b8ce=this['getVariable'][_0x5b87('0x71')](this,_0x564cfd[_0x5b87('0x10f')]);if(!_0x30b8ce){return this[_0x5b87('0xe')][_0x5b87('0x2a')](_0x564cfd,_0x5b87('0xd6'));}return this[_0x5b87('0xe')][_0x5b87('0xa6')](_0x30b8ce,_0x564cfd[_0x5b87('0x1a1')]);};AGIVertices[_0x5b87('0x11')][_0x5b87('0x1a2')]=function(_0x3ff7bc){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x1a3'),_0x3ff7bc[_0x5b87('0x37')]));this['channel'][_0x5b87('0xab')](_0x5b87('0x1a4'));if(_0x3ff7bc['answer']===_0x5b87('0x1a5')){this['channel'][_0x5b87('0xab')](_0x5b87('0x1a6'));return this['channel'][_0x5b87('0x1a7')]();}return this[_0x5b87('0xe')][_0x5b87('0xab')]('Skipped\x20Answer');};AGIVertices[_0x5b87('0x11')][_0x5b87('0x1a8')]=function(_0x269795){logger[_0x5b87('0x2c')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x269795[_0x5b87('0x37')]));if(!this['isConfigured'](_0x269795[_0x5b87('0x1a9')])){return this['channel'][_0x5b87('0x2a')](_0x269795,_0x5b87('0x1aa'));}var _0x52684e=this[_0x5b87('0x1ab')][_0x5b87('0x71')](this,_0x269795['project_id']);if(!this[_0x5b87('0x88')](_0x52684e)){return this['channel'][_0x5b87('0x2a')](_0x269795,util[_0x5b87('0x27')](_0x5b87('0x1ac'),_0x269795['project_id']));}if(_0x52684e===this[_0x5b87('0xe')][_0x5b87('0x39')]){return this['channel'][_0x5b87('0x2a')](_0x269795,_0x5b87('0x1ad'));}this[_0x5b87('0x36')]['sync'](this,_0x269795,_0x52684e);var _0x5221b6=this[_0x5b87('0xe')][_0x5b87('0x59')](_0x5b87('0x1ae'),util[_0x5b87('0x27')](_0x5b87('0x1af'),config['agi'][_0x5b87('0x18d')]||_0x5b87('0x1b0'),_0x52684e,this[_0x5b87('0xe')][_0x5b87('0x39')]));if(_0x5221b6[_0x5b87('0xa4')]===-0x1){return _0x5221b6;}return this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0xc4'),_0x5b87('0x1ae'),_0x52684e));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x1b1')]=function(_0x197c90){logger['info'](util['format'](_0x5b87('0x1b2'),_0x197c90['label']));var _0x4b7683=this['shellCommand'][_0x5b87('0x71')](this,_0x197c90['command']);this[_0x5b87('0x36')]['sync'](this,_0x197c90,_0x197c90[_0x5b87('0xb8')]);if(this['isConfigured'](_0x197c90[_0x5b87('0x10f')])){var _0x376606=this[_0x5b87('0xa1')][_0x5b87('0x71')](this,_0x197c90[_0x5b87('0x10f')]);if(_0x376606){this['channel'][_0x5b87('0xa6')](_0x376606,_0x4b7683);return this[_0x5b87('0xe')][_0x5b87('0xab')](util['format'](_0x5b87('0x1b3'),_0x197c90['command'],_0x376606));}}return this[_0x5b87('0xe')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x197c90['command']));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x1b4')]=function(_0x32eca1){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x1b5'),_0x32eca1[_0x5b87('0x37')]));_0x32eca1[_0x5b87('0x5f')]=_0x32eca1['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x32eca1[_0x5b87('0x5d')])){return this[_0x5b87('0xe')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x5b87('0x88')](_0x32eca1[_0x5b87('0x5f')])){return this[_0x5b87('0xe')][_0x5b87('0xab')]('no\x20text\x20configured');}this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x32eca1[_0x5b87('0x5f')]));var _0x3e912c=this[_0x5b87('0x5c')][_0x5b87('0x71')](this,_0x32eca1);if(_0x3e912c){this[_0x5b87('0xe')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3e912c));var _0x34bdd8=this['channel'][_0x5b87('0x100')](_0x3e912c);try{fs[_0x5b87('0x101')](_0x3e912c+_0x5b87('0x102'));}catch(_0x43c0ac){logger['error'](_0x43c0ac);}return _0x34bdd8;}return this[_0x5b87('0xe')]['error'](_0x32eca1,_0x5b87('0x1b6'));};AGIVertices['prototype'][_0x5b87('0x1b7')]=function(_0xab0bb2){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x1b8'),_0xab0bb2['label']));_0xab0bb2[_0x5b87('0x5f')]=_0xab0bb2[_0x5b87('0x5f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5b87('0x88')](_0xab0bb2[_0x5b87('0x5f')])){return this[_0x5b87('0xe')]['noop'](_0x5b87('0xac'));}this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x1b9'),_0xab0bb2[_0x5b87('0x5f')]));var _0x559b46=this[_0x5b87('0x64')][_0x5b87('0x71')](this,_0xab0bb2);if(_0x559b46){this[_0x5b87('0xe')][_0x5b87('0xab')](util['format'](_0x5b87('0x1ba'),_0x559b46));var _0x1a1f30=this[_0x5b87('0xe')][_0x5b87('0x100')](_0x559b46);try{fs[_0x5b87('0x101')](_0x559b46+_0x5b87('0x102'));}catch(_0x30ea85){logger[_0x5b87('0x2a')](_0x30ea85);}return _0x1a1f30;}return this['channel'][_0x5b87('0x2a')](_0xab0bb2,_0x5b87('0x1bb'));};AGIVertices[_0x5b87('0x11')]['unpause']=function(_0x11dc36){logger['info'](util['format'](_0x5b87('0x1bc'),_0x11dc36['label']));if(!this[_0x5b87('0x88')](_0x11dc36[_0x5b87('0x154')])){return this[_0x5b87('0xe')]['error'](_0x11dc36,_0x5b87('0x15a'));}logger['info'](util[_0x5b87('0x27')](_0x5b87('0x153'),this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x11dc36[_0x5b87('0x154')]));var _0x2629b5=this[_0x5b87('0x52')][_0x5b87('0x71')](this,_0x11dc36[_0x5b87('0x154')]);if(_0x2629b5){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x155'),this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x11dc36[_0x5b87('0x154')]));this[_0x5b87('0xe')][_0x5b87('0xab')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x11dc36[_0x5b87('0x154')]));return{'code':0xc8,'result':_0x5b87('0x156')};}else{logger[_0x5b87('0x2c')](util[_0x5b87('0x27')](_0x5b87('0x157'),this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x11dc36[_0x5b87('0x154')]));this[_0x5b87('0xe')][_0x5b87('0xab')](util[_0x5b87('0x27')](_0x5b87('0x157'),this[_0x5b87('0xe')][_0x5b87('0x3a')],_0x11dc36[_0x5b87('0x154')]));return{'code':0xc8,'result':_0x5b87('0x158')};}};AGIVertices['prototype']['voicemail']=function(_0x2f4962){logger[_0x5b87('0x2c')](util[_0x5b87('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2f4962[_0x5b87('0x37')]));var _0x2476dc=this['channel']['exec'](_0x5b87('0x1bd'),[_0x2f4962[_0x5b87('0x1be')],_0x2f4962[_0x5b87('0x78')]]);if(_0x2476dc['result']===-0x1){return _0x2476dc;}return this['channel']['noop'](util[_0x5b87('0x27')](_0x5b87('0xc4'),_0x5b87('0x1bd'),_0x2f4962[_0x5b87('0x1be')]));};AGIVertices[_0x5b87('0x11')][_0x5b87('0x1bf')]=function(_0x2e9e1a){logger['info'](util[_0x5b87('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2e9e1a['label']));if(!this[_0x5b87('0x88')](_0x2e9e1a[_0x5b87('0x10f')])){return this['channel'][_0x5b87('0x2a')](_0x2e9e1a,'no\x20variable\x20selected');}var _0x58f0b9=this['getVariable'][_0x5b87('0x71')](this,_0x2e9e1a['variable_id']);if(!_0x58f0b9){return this['channel'][_0x5b87('0x2a')](_0x2e9e1a,_0x5b87('0xd6'));}var _0x201f6a=this['channel'][_0x5b87('0xa1')](_0x58f0b9);return{'code':0xc8,'result':_0x201f6a['extra']?_0x201f6a[_0x5b87('0xa2')]:'-'};};String[_0x5b87('0x11')][_0x5b87('0x1c0')]=function(_0x29b67d,_0x2e0598){return this['split'](_0x29b67d)[_0x5b87('0x1c1')](_0x2e0598);};module[_0x5b87('0x1c2')]=AGIVertices; \ No newline at end of file +var _0x3f7c=['toString','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','clone','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','no\x20user\x20selected','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','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','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','appid','appsecret','no\x20appsecret\x20configured','wav','%s/recordings/%s','beep','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','Smtp','host','port','secure','authentication','pass','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\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','exports','path','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunk','getSound','getSoundById','getMailAccount','sendMailMessage','mailRpc','getIntervals','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20'];(function(_0x40eec9,_0x817a67){var _0xfee890=function(_0x186640){while(--_0x186640){_0x40eec9['push'](_0x40eec9['shift']());}};_0xfee890(++_0x817a67);}(_0x3f7c,0x17a));var _0xc3f7=function(_0xf94630,_0x5d6de5){_0xf94630=_0xf94630-0x0;var _0x57f299=_0x3f7c[_0xf94630];return _0x57f299;};'use strict';var fs=require('fs');var path=require(_0xc3f7('0x0'));var util=require(_0xc3f7('0x1'));var _=require(_0xc3f7('0x2'));var sh=require('shelljs');var odbc=require(_0xc3f7('0x3'))();var rs=require(_0xc3f7('0x4'));var moment=require(_0xc3f7('0x5'));var Mustache=require(_0xc3f7('0x6'));var rp=require(_0xc3f7('0x7'));var logger=require(_0xc3f7('0x8'))(_0xc3f7('0x9'));var config=require(_0xc3f7('0xa'));var scripts=require(_0xc3f7('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xc3f7('0xc'),_0xc3f7('0xd')];var verticesWithRetry=[_0xc3f7('0xe'),_0xc3f7('0xf'),'getsecretdigits'];var AGIVertices=function(_0x879379,_0x4d2c20,_0x850c16){this[_0xc3f7('0x10')]=_0x879379;this[_0xc3f7('0x11')]=_0x4d2c20;this['mailRpc']=_0x850c16;};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x13')]=function(_0x489b16,_0x5ad461){this['rpc'][_0xc3f7('0x14')](_0x489b16)[_0xc3f7('0x15')](function(_0x2799d9){_0x5ad461(null,_0x2799d9?_0x2799d9[_0xc3f7('0x16')]:![]);})['catch'](function(_0x57040f){_0x5ad461(_0x57040f);});};AGIVertices['prototype'][_0xc3f7('0x17')]=function(_0x409cb2,_0x199c03){this[_0xc3f7('0x11')][_0xc3f7('0x18')](_0x409cb2)[_0xc3f7('0x15')](function(_0x794eb0){_0x199c03(null,_0x794eb0?_0x794eb0[_0xc3f7('0x16')]:![]);})[_0xc3f7('0x19')](function(_0x339376){_0x199c03(_0x339376);});};AGIVertices['prototype'][_0xc3f7('0x1a')]=function(_0xc44352,_0x2a6217){this[_0xc3f7('0x11')][_0xc3f7('0x1b')](_0xc44352)[_0xc3f7('0x15')](function(_0x551220){_0x2a6217(null,_0x551220?_0x551220['name']:![]);})['catch'](function(_0x342c75){_0x2a6217(_0x342c75);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x1c')]=function(_0x5638b0,_0x4b7feb){this['rpc']['getSquareOdbcById'](_0x5638b0)[_0xc3f7('0x15')](function(_0x1fe3d7){_0x4b7feb(null,_0x1fe3d7?_0x1fe3d7[_0xc3f7('0x1d')]:![]);})[_0xc3f7('0x19')](function(_0x5c7bff){_0x4b7feb(_0x5c7bff);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x1e')]=function(_0x44b8f8,_0x38714e){this[_0xc3f7('0x11')]['getUserById'](_0x44b8f8)[_0xc3f7('0x15')](function(_0x1127b7){_0x38714e(null,_0x1127b7?_0x1127b7['name']:![]);})[_0xc3f7('0x19')](function(_0x225bcc){_0x38714e(_0x225bcc);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x1f')]=function(_0xed44d2,_0x547b96){this[_0xc3f7('0x11')]['getTrunkById'](_0xed44d2)[_0xc3f7('0x15')](function(_0x2a831c){_0x547b96(null,_0x2a831c?_0x2a831c[_0xc3f7('0x16')]:![]);})[_0xc3f7('0x19')](function(_0x3def34){_0x547b96(_0x3def34);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x20')]=function(_0x3f3957,_0x25c496){var _0x3c1b79=this;this[_0xc3f7('0x11')][_0xc3f7('0x21')](_0x3f3957)[_0xc3f7('0x15')](function(_0x3fe660){_0x25c496(null,_0x3fe660?_0x3c1b79['getSoundPath'](_0x3fe660['save_name']):![]);})[_0xc3f7('0x19')](function(_0x2c915f){_0x25c496(_0x2c915f);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x22')]=function(_0x52b40b,_0x3979db){this[_0xc3f7('0x11')]['getMailAccountById'](_0x52b40b)[_0xc3f7('0x15')](function(_0x52c261){_0x3979db(null,_0x52c261?_0x52c261:![]);})['catch'](function(_0x4e896b){_0x3979db(_0x4e896b);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x23')]=function(_0x1afa0a,_0x3343f2,_0x2d7158){this[_0xc3f7('0x24')][_0xc3f7('0x23')](_0x1afa0a,_0x3343f2)[_0xc3f7('0x15')](function(){_0x2d7158(null);})[_0xc3f7('0x19')](function(_0x48e8e4){_0x2d7158(_0x48e8e4);});};AGIVertices['prototype'][_0xc3f7('0x25')]=function(_0x2dc678,_0x585dd2){this[_0xc3f7('0x11')]['getIntervalById'](_0x2dc678)['then'](function(_0x10bfd5){if(_0x10bfd5){if(_0x10bfd5[_0xc3f7('0x26')]){_0x585dd2(null,[_0x10bfd5[_0xc3f7('0x27')]]);}else{_0x585dd2(null,_[_0xc3f7('0x28')](_0x10bfd5['Intervals'],'interval'));}}else{_0x585dd2(null,![]);}})[_0xc3f7('0x19')](function(_0x5c632d){_0x585dd2(_0x5c632d);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x29')]=function(_0x391fc1){return util[_0xc3f7('0x2a')](_0xc3f7('0x2b'),FILES_PATH,_0x391fc1);};AGIVertices['prototype'][_0xc3f7('0x2c')]=function(_0x5ad0e6,_0x5b3b91,_0x1be6b6){odbc[_0xc3f7('0x2d')](_0x5ad0e6,function(_0x559a43){if(_0x559a43){logger[_0xc3f7('0x2e')](_0xc3f7('0x2f'),_0x559a43);_0x1be6b6(_0x559a43);}else{logger[_0xc3f7('0x30')](_0xc3f7('0x31'));odbc[_0xc3f7('0x32')](_0x5b3b91,function(_0x53e075,_0x1f89e6){if(_0x53e075){logger[_0xc3f7('0x30')]('Error\x20executing\x20query\x20%s',_0x5b3b91);_0x1be6b6(_0x53e075);}else{logger['info'](_0xc3f7('0x33'),_0x5b3b91);odbc[_0xc3f7('0x34')](function(_0x54dc9c){if(_0x54dc9c){logger[_0xc3f7('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x54dc9c);}_0x1be6b6(null,_0x1f89e6);});}});}});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x35')]=function(_0x4cdcf6,_0x279918){this[_0xc3f7('0x11')][_0xc3f7('0x36')](_0x4cdcf6)[_0xc3f7('0x15')](function(_0x397b58){_0x279918(null,_0x397b58?_0x397b58:![]);})['catch'](function(_0x55df16){_0x279918(_0x55df16);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x37')]=function(_0x5d3b01,_0x22298c){this[_0xc3f7('0x11')]['createSmsMessage'](_0x5d3b01)[_0xc3f7('0x15')](function(_0x4e273b){_0x22298c(null,_0x4e273b);})[_0xc3f7('0x19')](function(_0x28c307){_0x22298c(_0x28c307);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x38')]=function(_0x97cf4e,_0x239345,_0x1c38b4){this[_0xc3f7('0x11')][_0xc3f7('0x38')]({'uniqueid':this[_0xc3f7('0x10')][_0xc3f7('0x39')],'node':_0x97cf4e['label'],'application':_0x97cf4e[_0xc3f7('0x3a')],'data':_0x239345||null,'project_name':this[_0xc3f7('0x10')][_0xc3f7('0x3b')],'callerid':this[_0xc3f7('0x10')][_0xc3f7('0x3c')]})[_0xc3f7('0x15')](function(_0x453331){if(_0x1c38b4){_0x1c38b4(null,_0x453331);}})[_0xc3f7('0x19')](function(_0x569f68){if(_0x1c38b4){_0x1c38b4(_0x569f68);}});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x3d')]=function(_0x3e65aa,_0x3381a4,_0x363661,_0x50438e){this[_0xc3f7('0x11')][_0xc3f7('0x3d')]({'uniqueid':this[_0xc3f7('0x10')]['uniqueid'],'callerid':this[_0xc3f7('0x10')][_0xc3f7('0x3c')],'calleridname':this[_0xc3f7('0x10')][_0xc3f7('0x3e')],'context':this['channel'][_0xc3f7('0x3f')],'extension':this[_0xc3f7('0x10')]['extension'],'priority':this[_0xc3f7('0x10')]['priority'],'accountcode':this[_0xc3f7('0x10')][_0xc3f7('0x40')],'dnid':this[_0xc3f7('0x10')][_0xc3f7('0x41')],'projectName':this[_0xc3f7('0x10')]['arg_1'],'saveName':_0x3381a4,'filename':_0x3e65aa[_0xc3f7('0x42')]||_0x3381a4,'savePath':_0x363661})[_0xc3f7('0x15')](function(_0x46bb4f){_0x50438e(null,_0x46bb4f);})[_0xc3f7('0x19')](function(_0x39eb3c){_0x50438e(_0x39eb3c);});};AGIVertices[_0xc3f7('0x12')]['createSquareMessage']=function(_0x32a173,_0x24d9af,_0x5d43d0,_0x48015f,_0x527e3e){this[_0xc3f7('0x11')][_0xc3f7('0x43')]({'uniqueid':this[_0xc3f7('0x10')][_0xc3f7('0x39')],'body':_0x32a173,'direction':_0x24d9af,'providerName':_0x5d43d0,'providerResponse':_0x48015f})[_0xc3f7('0x15')](function(_0x129378){if(_0x527e3e){_0x527e3e(null,_0x129378);}})[_0xc3f7('0x19')](function(_0x31773a){if(_0x527e3e){_0x527e3e(_0x31773a);}});};AGIVertices['prototype']['createCmContact']=function(_0x2f9d37,_0x2d2371){this['rpc'][_0xc3f7('0x44')]({'firstName':_[_0xc3f7('0x45')](_0x2f9d37[_0xc3f7('0x16')])||_[_0xc3f7('0x46')](_0x2f9d37[_0xc3f7('0x16')])?_0xc3f7('0x47')+Math[_0xc3f7('0x48')]():_0x2f9d37[_0xc3f7('0x16')],'lastName':_['isEmpty'](_0x2f9d37['lastName'])||_[_0xc3f7('0x46')](_0x2f9d37['lastName'])?null:_0x2f9d37[_0xc3f7('0x49')],'phone':_0x2f9d37[_0xc3f7('0x4a')],'ListId':_0x2f9d37['list_id'],'scheduledat':_0x2f9d37[_0xc3f7('0x4b')],'callbackUniqueid':this[_0xc3f7('0x10')][_0xc3f7('0x39')],'tags':_0xc3f7('0x4c'),'description':_0xc3f7('0x4d')+_0x2f9d37[_0xc3f7('0x4b')][_0xc3f7('0x4e')](),'priority':_0x2f9d37[_0xc3f7('0x4f')]})[_0xc3f7('0x15')](function(_0x51104b){_0x2d2371(null,_0x51104b);})[_0xc3f7('0x19')](function(_0x24ae1d){_0x2d2371(_0x24ae1d);});};AGIVertices[_0xc3f7('0x12')]['getPause']=function(_0x421103,_0x29932a){this[_0xc3f7('0x11')][_0xc3f7('0x50')](_0x421103)['then'](function(_0x18e837){_0x29932a(null,_0x18e837?_0x18e837[_0xc3f7('0x16')]:![]);})[_0xc3f7('0x19')](function(_0x382cbf){_0x29932a(_0x382cbf);});};AGIVertices[_0xc3f7('0x12')]['agentPause']=function(_0x467d16,_0x647b7e,_0x14e0fd){var _0x32d8e8={'role':_0xc3f7('0x51')};_0x32d8e8[_0x467d16]=this[_0xc3f7('0x10')][_0xc3f7('0x3c')];this['rpc'][_0xc3f7('0x52')](_0x32d8e8,_0x647b7e,this[_0xc3f7('0x10')][_0xc3f7('0x39')])['then'](function(_0x15305d){_0x14e0fd(null,_[_0xc3f7('0x46')](_0x15305d)?![]:!![]);})[_0xc3f7('0x19')](function(_0x4d058e){logger[_0xc3f7('0x2e')](_0x4d058e);_0x14e0fd(null,![]);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x53')]=function(_0x4c2061,_0x29ac17){var _0x45f11c={'role':_0xc3f7('0x51')};_0x45f11c[_0x4c2061]=this[_0xc3f7('0x10')]['callerid'];this[_0xc3f7('0x11')][_0xc3f7('0x53')](_0x45f11c)['then'](function(_0x58f4aa){_0x29ac17(null,_[_0xc3f7('0x46')](_0x58f4aa)?![]:!![]);})[_0xc3f7('0x19')](function(_0x5dce47){logger[_0xc3f7('0x2e')](_0x5dce47);_0x29ac17(null,![]);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x54')]=function(_0x34dc4b,_0x58568c){var _0x2115e0={'role':'agent'};_0x2115e0[_0x34dc4b]=this[_0xc3f7('0x10')][_0xc3f7('0x3c')];this[_0xc3f7('0x11')]['agentLogout'](_0x2115e0)['then'](function(_0x4adb24){_0x58568c(null,_['isNil'](_0x4adb24)?![]:!![]);})[_0xc3f7('0x19')](function(_0x978e3){logger[_0xc3f7('0x2e')](_0x978e3);_0x58568c(null,![]);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x55')]=function(_0x29358b,_0x27a191){var _0x5e45a7={'role':'agent'};_0x5e45a7[_0x29358b]=this[_0xc3f7('0x10')][_0xc3f7('0x3c')];var _0x2579ab=_0x29358b!='internal'?util['format'](_0xc3f7('0x56'),_0xc3f7('0x57'),this['channel'][_0xc3f7('0x3c')]):undefined;this[_0xc3f7('0x11')][_0xc3f7('0x55')](_0x5e45a7,_0x2579ab)[_0xc3f7('0x15')](function(_0x31806f){_0x27a191(null,_['isNil'](_0x31806f)?![]:!![]);})[_0xc3f7('0x19')](function(_0x5c7889){logger[_0xc3f7('0x2e')](_0x5c7889);_0x27a191(null,![]);});};AGIVertices['prototype'][_0xc3f7('0x58')]=function(_0x428f96,_0x4fb214){sh[_0xc3f7('0x59')](_[_0xc3f7('0x5a')](_0x428f96),function(_0x35c9a5,_0xb29066){var _0x3c59dd=_0xb29066[_0xc3f7('0x5b')](/(\r\n|\n|\r)/gm,'');_0x4fb214(null,_0x3c59dd);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x5c')]=function(_0x1c83f0,_0x5353c6){scripts[_0xc3f7('0x5c')](_0x1c83f0[_0xc3f7('0x5d')],_0x1c83f0[_0xc3f7('0x5e')]||_0xc3f7('0x5f'),_0x1c83f0[_0xc3f7('0x5f')],_0x1c83f0[_0xc3f7('0x60')]||_0xc3f7('0x61'),_0x1c83f0['ssmlGender']||_0xc3f7('0x62'),_0x1c83f0[_0xc3f7('0x63')]||_0xc3f7('0x64'))[_0xc3f7('0x15')](function(_0x4df92f){_0x5353c6(null,_0x4df92f);})['catch'](function(_0x3d8e5a){_0x5353c6(_0x3d8e5a);});};AGIVertices[_0xc3f7('0x12')]['googleTTS']=function(_0x653934,_0x4c8084){scripts[_0xc3f7('0x65')](_0x653934[_0xc3f7('0x5f')],_0x653934[_0xc3f7('0x66')]||'en',0x1)[_0xc3f7('0x15')](function(_0x3c65ca){_0x4c8084(null,_0x3c65ca);})[_0xc3f7('0x19')](function(_0xe9b867){_0x4c8084(_0xe9b867);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x67')]=function(_0x342823,_0x1cb2ca){var _0x33204b={'uri':_0x342823[_0xc3f7('0x68')],'method':_0x342823[_0xc3f7('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x342823[_0xc3f7('0x6a')])===_0xc3f7('0x6b')&&parseInt(_0x342823[_0xc3f7('0x6a')])>=0x1?parseInt(_0x342823['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xc3f7('0x6c')]([_0xc3f7('0x6d'),_0xc3f7('0x6e')],_0x33204b[_0xc3f7('0x69')][_0xc3f7('0x6f')]())){try{_0x33204b[_0xc3f7('0x70')]=_0x342823[_0xc3f7('0xd')]?JSON[_0xc3f7('0x71')](_0x342823[_0xc3f7('0xd')]):{};}catch(_0x52b795){logger[_0xc3f7('0x2e')](_0xc3f7('0x72'),_0x52b795);}}try{_0x33204b[_0xc3f7('0x73')]=_0x342823[_0xc3f7('0xc')]?JSON[_0xc3f7('0x71')](_0x342823[_0xc3f7('0xc')]):{};}catch(_0x252949){logger[_0xc3f7('0x2e')](_0xc3f7('0x74'),_0x252949);}if(_0x342823[_0xc3f7('0x75')]){try{var _0x3d6bbe=require(_0x342823[_0xc3f7('0x75')])[_0xc3f7('0x76')](this,_0x33204b);_0x33204b[_0xc3f7('0x77')]=Mustache[_0xc3f7('0x78')](_0x342823[_0xc3f7('0x68')],_0x3d6bbe,{},['$$','$$']);if(_0x33204b[_0xc3f7('0x73')]){_0x33204b[_0xc3f7('0x73')]=JSON[_0xc3f7('0x71')](Mustache[_0xc3f7('0x78')](JSON[_0xc3f7('0x79')](_0x33204b['headers']),_0x3d6bbe,{},['$$','$$']));}if(_0x33204b[_0xc3f7('0x70')]){_0x33204b[_0xc3f7('0x70')]=JSON[_0xc3f7('0x71')](Mustache[_0xc3f7('0x78')](JSON[_0xc3f7('0x79')](_0x33204b[_0xc3f7('0x70')]),_0x3d6bbe,{},['$$','$$']));}}catch(_0x5b9a9c){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5b9a9c);}}rp(_0x33204b)[_0xc3f7('0x15')](function(_0x2c3283){var _0x5812ad={'statusCode':_0x2c3283[_0xc3f7('0x7a')]||0xc8,'statusMessage':_0x2c3283['statusMessage']||'OK','headers':_0x2c3283[_0xc3f7('0x73')]||{},'body':_0x2c3283[_0xc3f7('0x70')]||{}};_0x1cb2ca(null,_0x5812ad);})[_0xc3f7('0x19')](function(_0x26a363){var _0x26a502={'statusCode':_0x26a363[_0xc3f7('0x7a')]||0x1f4,'statusMessage':_0x26a363[_0xc3f7('0x7b')]||_0xc3f7('0x7c'),'headers':_0x26a363[_0xc3f7('0x7d')][_0xc3f7('0x73')]||{},'body':_0x26a363[_0xc3f7('0x7d')]['body']||{}};_0x1cb2ca(null,_0x26a502);});};AGIVertices[_0xc3f7('0x12')]['googleDialogflow']=function(_0x78db7a,_0x425b3c){scripts['googleDialogflow'](this[_0xc3f7('0x10')][_0xc3f7('0x39')],_0x78db7a[_0xc3f7('0x7e')],_0x78db7a[_0xc3f7('0x5f')],_0x78db7a[_0xc3f7('0x7f')]||'en')[_0xc3f7('0x15')](function(_0x2847e9){_0x425b3c(null,_0x2847e9);})[_0xc3f7('0x19')](function(_0x3e322a){_0x425b3c(_0x3e322a);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x80')]=function(_0x2c7971,_0x44b489){scripts['googleDialogflowV2'](this[_0xc3f7('0x10')][_0xc3f7('0x39')],_0x2c7971[_0xc3f7('0x81')],_0x2c7971[_0xc3f7('0x82')],_0x2c7971[_0xc3f7('0x83')],_0x2c7971[_0xc3f7('0x5f')],_0x2c7971['dialogflowV2_language']||'en')[_0xc3f7('0x15')](function(_0x2dd5d8){_0x44b489(null,_0x2dd5d8);})[_0xc3f7('0x19')](function(_0x260552){_0x44b489(_0x260552);});};AGIVertices[_0xc3f7('0x12')]['sestekNDA']=function(_0x48c1b3,_0x39804c){scripts[_0xc3f7('0x84')](this[_0xc3f7('0x10')],_0x48c1b3)['then'](function(_0x39408c){_0x39804c(null,_0x39408c);})['catch'](function(_0x4932b4){_0x39804c(_0x4932b4);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x85')]=function(_0x2f76df,_0xdaaf1c){scripts[_0xc3f7('0x85')](_0x2f76df['key'],_0x2f76df['text'],_0x2f76df[_0xc3f7('0x86')]||_0xc3f7('0x61'),_0x2f76df['speed'])[_0xc3f7('0x15')](function(_0xe69319){_0xdaaf1c(null,_0xe69319);})[_0xc3f7('0x19')](function(_0x1e539b){_0xdaaf1c(_0x1e539b);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x87')]=function(_0x952f59,_0x2f11cb,_0x16db5a){scripts[_0xc3f7('0x87')](_0x2f11cb,_0x952f59['key'],_0x952f59['ispeech_asr_language']||_0xc3f7('0x61'),this[_0xc3f7('0x88')](_0x952f59[_0xc3f7('0x89')])?_0x952f59['model']:undefined)['then'](function(_0x504ba4){_0x16db5a(null,_0x504ba4);})[_0xc3f7('0x19')](function(_0x3d0e75){_0x16db5a(_0x3d0e75);});};AGIVertices[_0xc3f7('0x12')]['awsPolly']=function(_0x2463a5,_0x9d3a6d){scripts[_0xc3f7('0x8a')](_0x2463a5[_0xc3f7('0x8b')],_0x2463a5[_0xc3f7('0x8c')],_0x2463a5[_0xc3f7('0x8d')],_0x2463a5[_0xc3f7('0x8e')]||_0xc3f7('0x8f'),_0x2463a5[_0xc3f7('0x5f')],_0x2463a5[_0xc3f7('0x90')]||_0xc3f7('0x5f'))[_0xc3f7('0x15')](function(_0x502591){_0x9d3a6d(null,_0x502591);})['catch'](function(_0x46d3a9){_0x9d3a6d(_0x46d3a9);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x91')]=function(_0x4e2476,_0x5e4953){scripts[_0xc3f7('0x91')](this['channel'][_0xc3f7('0x39')],_0x4e2476['aws_access_key_id'],_0x4e2476[_0xc3f7('0x8c')],_0x4e2476[_0xc3f7('0x92')],_0x4e2476[_0xc3f7('0x5f')],_0x4e2476[_0xc3f7('0x93')])[_0xc3f7('0x15')](function(_0x42081e){_0x5e4953(null,_0x42081e);})[_0xc3f7('0x19')](function(_0x39fa91){_0x5e4953(_0x39fa91);});};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x94')]=function(_0xd7a762,_0x95d4bf,_0x3771d3){scripts[_0xc3f7('0x94')](_0x95d4bf,_0xd7a762['key'],_0xd7a762[_0xc3f7('0x95')]||_0xc3f7('0x61'))[_0xc3f7('0x15')](function(_0x48b734){_0x3771d3(null,_0x48b734);})[_0xc3f7('0x19')](function(_0x57f4ac){_0x3771d3(_0x57f4ac);});};AGIVertices[_0xc3f7('0x12')]['tildeASR']=function(_0x5363fd,_0xbd6817,_0x20ca1a){scripts[_0xc3f7('0x96')](_0xbd6817,_0x5363fd['appid'],_0x5363fd['appsecret'],_0x5363fd[_0xc3f7('0x77')])[_0xc3f7('0x15')](function(_0x448a46){_0x20ca1a(null,_0x448a46);})[_0xc3f7('0x19')](function(_0x96bbae){_0x20ca1a(_0x96bbae);});};AGIVertices[_0xc3f7('0x12')]['clear']=function(_0x3be280){var _0x211d17=_['includes'](verticesWithRetry,_0x3be280[_0xc3f7('0x3a')])?_0x3be280:_[_0xc3f7('0x97')](_0x3be280);for(var _0x1d7ee7 in _0x211d17){if(_0x211d17['hasOwnProperty'](_0x1d7ee7)){if(_0x211d17[_0x1d7ee7]&&_['isString'](_0x211d17[_0x1d7ee7])){if(_['includes'](recursiveMapAttributes,_0x1d7ee7)){_0x211d17[_0x1d7ee7]=this[_0xc3f7('0x98')](_0x211d17[_0x1d7ee7]);}else{_0x211d17[_0x1d7ee7]=this[_0xc3f7('0x99')](_0x211d17[_0x1d7ee7]);}}}}return _0x211d17;};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x9a')]=function(_0x145d18){for(var _0x48ba2f in _0x145d18){if(_0x145d18[_0xc3f7('0x9b')](_0x48ba2f)){if(_[_0xc3f7('0x9c')](_0x145d18[_0x48ba2f])){this[_0xc3f7('0x9a')](_0x145d18[_0x48ba2f]);}else if(_[_0xc3f7('0x9d')](_0x145d18[_0x48ba2f])){for(var _0x353a6b=0x0;_0x353a6b<_0x145d18[_0x48ba2f][_0xc3f7('0x9e')];_0x353a6b++){this[_0xc3f7('0x9a')](_0x145d18[_0x48ba2f][_0x353a6b]);}}else if(_[_0xc3f7('0x9f')](_0x145d18[_0x48ba2f])){_0x145d18[_0x48ba2f]=this[_0xc3f7('0x99')](_0x145d18[_0x48ba2f]);}}}};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xa0')]=function(_0x562ba2,_0x214c16){for(var _0x43e791 in _0x562ba2){if(_0x562ba2[_0xc3f7('0x9b')](_0x43e791)){if(_['isPlainObject'](_0x562ba2[_0x43e791])){if(!_['isEmpty'](_0x562ba2[_0x43e791])){this[_0xc3f7('0xa0')](_0x562ba2[_0x43e791],util['format'](_0xc3f7('0xa1'),_0x214c16,_0x43e791));}}else if(_[_0xc3f7('0x9d')](_0x562ba2[_0x43e791])){for(var _0x4b7eff=0x0;_0x4b7eff<_0x562ba2[_0x43e791]['length'];_0x4b7eff++){this[_0xc3f7('0xa0')](_0x562ba2[_0x43e791][_0x4b7eff],util[_0xc3f7('0x2a')](_0xc3f7('0xa1'),_0x214c16,_0x43e791+'['+_0x4b7eff+']'));}}else{if(!_[_0xc3f7('0x46')](_0x562ba2[_0x43e791])){this['channel'][_0xc3f7('0xa2')](util[_0xc3f7('0x2a')](_0xc3f7('0xa1'),_0x214c16,_0x43e791),_0x562ba2[_0x43e791]);}}}}};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x98')]=function(_0xa50834){try{var _0x42766f=JSON[_0xc3f7('0x71')](_0xa50834);this['recursiveNodeIndex'](_0x42766f);return JSON['stringify'](_0x42766f);}catch(_0x2da6e6){return this[_0xc3f7('0x99')](_0xa50834);}};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x99')]=function(_0x3b86e1){var _0xc74286=_0x3b86e1[_0xc3f7('0xa3')]('{');for(var _0x2fc181=0x1;_0x2fc181<_0xc74286['length'];_0x2fc181+=0x1){var _0x30ebe8=_0xc74286[_0x2fc181][_0xc3f7('0xa3')]('}');if(_0x30ebe8[_0xc3f7('0x9e')]>0x1){_0x3b86e1=_0x3b86e1[_0xc3f7('0xa4')]('{'+_0x30ebe8[0x0]+'}',this[_0xc3f7('0x10')]['getVariable'](_0x30ebe8[0x0])['extra']||_0x30ebe8[0x0]);}}if(_0xc74286['length']===0x1){return _0x3b86e1['toString']();}return this[_0xc3f7('0x99')](_0x3b86e1);};AGIVertices[_0xc3f7('0x12')]['getAndSetVariable']=function(_0x363a18,_0x5e189e){var _0x4e2507=this[_0xc3f7('0x10')][_0xc3f7('0x13')](_0x363a18);if(_0x4e2507[_0xc3f7('0xa5')]===-0x1){return _0x4e2507;}logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0xa6'),_0x5e189e,_0x4e2507[_0xc3f7('0xa7')]));return this[_0xc3f7('0x10')]['setVariable'](_0x5e189e,_0x4e2507[_0xc3f7('0xa7')]);};AGIVertices['prototype'][_0xc3f7('0x88')]=function(_0x2a2f75){return _0x2a2f75&&_0x2a2f75!=='0'&&_0x2a2f75!=='-1'&&_0x2a2f75!=='';};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xa8')]=function(_0x882d25){this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x882d25,'-');_0x882d25[_0xc3f7('0xa9')]=_0x882d25[_0xc3f7('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xaa')]=function(_0x241649){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0xab'),_0x241649[_0xc3f7('0xac')]));if(!this['isConfigured'](_0x241649['text'])){return this['channel']['noop'](_0xc3f7('0xad'));}var _0x2f2bb9='\x22'+_0x241649['text']+'\x22';if(this[_0xc3f7('0x88')](_0x241649[_0xc3f7('0x7d')])){_0x2f2bb9+=','+_0x241649[_0xc3f7('0x7d')];}var _0x209486=this[_0xc3f7('0x10')][_0xc3f7('0x59')](_0xc3f7('0xae'),_0x2f2bb9);if(_0x209486[_0xc3f7('0xa5')]===-0x1){return _0x209486;}return this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0xaf'),_0x2f2bb9));};AGIVertices[_0xc3f7('0x12')]['mrcprecog']=function(_0x40f172){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0xb0'),_0x40f172[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x40f172['grammar'])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xb2'));}var _0x34a210=_0x40f172[_0xc3f7('0xb3')];if(this[_0xc3f7('0x88')](_0x40f172['options'])){_0x34a210+=','+_0x40f172[_0xc3f7('0x7d')];}var _0x1aae86=this['channel']['exec'](_0xc3f7('0xb4'),_0x34a210);if(_0x1aae86[_0xc3f7('0xa5')]===-0x1){return _0x1aae86;}var _0x14a193=this['getAndSetVariable'](_0xc3f7('0xb5'),_0xc3f7('0xb6'));if(_0x14a193[_0xc3f7('0xa5')]===-0x1){return _0x14a193;}var _0x35d77e=this[_0xc3f7('0xb7')]('RECOG_INPUT()',_0xc3f7('0xb8'));if(_0x35d77e['result']===-0x1){return _0x35d77e;}var _0x180d8e=this[_0xc3f7('0xb7')](_0xc3f7('0xb9'),'MRCP_RECOG_INSTANCE');if(_0x180d8e[_0xc3f7('0xa5')]===-0x1){return _0x180d8e;}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0xba'),_0x34a210));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x9')]=function(_0x501191){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0xbb'),_0x501191[_0xc3f7('0xac')]));return this[_0xc3f7('0x10')][_0xc3f7('0x9')]([_0x501191['command'],_0x501191[_0xc3f7('0xbc')]]);};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xbd')]=function(_0x5a7d28){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0xbe'),_0x5a7d28[_0xc3f7('0xac')]));if(this[_0xc3f7('0x88')](_0x5a7d28[_0xc3f7('0x6a')])){logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0xbf'),_0x5a7d28[_0xc3f7('0x6a')]));var _0x5c3d78=this['channel'][_0xc3f7('0xc0')](_0x5a7d28[_0xc3f7('0x6a')]);if(_0x5c3d78[_0xc3f7('0xa5')]===-0x1){return _0x5c3d78;}}return this[_0xc3f7('0x10')]['answer']();};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x4c')]=function(_0x239ded){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0xc1'),_0x239ded[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x239ded['list_id'])){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x239ded,'no\x20list\x20selected');}_0x239ded[_0xc3f7('0x4b')]=moment();if(this[_0xc3f7('0x88')](_0x239ded[_0xc3f7('0xc2')])){_0x239ded[_0xc3f7('0x4b')]=moment()[_0xc3f7('0xc3')](_0x239ded['delay'],'minutes');}if(!this[_0xc3f7('0x88')](_0x239ded['callback_priority'])){_0x239ded[_0xc3f7('0x4f')]=0x2;}this[_0xc3f7('0x44')][_0xc3f7('0x76')](this,_0x239ded);return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0xc4'),_0x239ded[_0xc3f7('0x4a')],_0x239ded[_0xc3f7('0xc5')],_0x239ded[_0xc3f7('0x4b')]));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xc6')]=function(_0x5deea5){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0xc7'),_0x5deea5['label']));var _0x3c10a4=this['channel'][_0xc3f7('0x59')](_0x5deea5[_0xc3f7('0xc8')],_0x5deea5[_0xc3f7('0x7d')]);if(_0x3c10a4['result']===-0x1){return _0x3c10a4;}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0xc9'),_0x5deea5[_0xc3f7('0xc8')],_0x5deea5['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x53a292){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0xca'),_0x53a292['label']));if(!this[_0xc3f7('0x88')](_0x53a292[_0xc3f7('0x5f')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xad'));}var _0x2bfb0f='\x22'+_0x53a292[_0xc3f7('0x5f')]+'\x22';if(this[_0xc3f7('0x88')](_0x53a292[_0xc3f7('0x7d')])){_0x2bfb0f+=','+_0x53a292[_0xc3f7('0x7d')];}var _0x33bfc2=this[_0xc3f7('0x10')][_0xc3f7('0x59')](_0xc3f7('0xae'),_0x2bfb0f);if(_0x33bfc2['result']===-0x1){return _0x33bfc2;}return this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0xaf'),_0x2bfb0f));};AGIVertices['prototype']['sestektts']=function(_0x3ed569){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0xcb'),_0x3ed569[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x3ed569['text'])){return this['channel'][_0xc3f7('0xb1')](_0xc3f7('0xad'));}var _0x567e4d='\x22'+_0x3ed569[_0xc3f7('0x5f')]+'\x22';if(this[_0xc3f7('0x88')](_0x3ed569[_0xc3f7('0x7d')])){_0x567e4d+=','+_0x3ed569[_0xc3f7('0x7d')];}var _0x3d7b20=this[_0xc3f7('0x10')][_0xc3f7('0x59')](_0xc3f7('0xae'),_0x567e4d);if(_0x3d7b20[_0xc3f7('0xa5')]===-0x1){return _0x3d7b20;}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x567e4d));};AGIVertices['prototype']['lumenvoxasr']=function(_0x39bacc){logger[_0xc3f7('0x30')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x39bacc[_0xc3f7('0xac')]));if(!this['isConfigured'](_0x39bacc['grammar'])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')]('no\x20grammar\x20configured');}var _0x15e082=_0x39bacc[_0xc3f7('0xb3')];if(this[_0xc3f7('0x88')](_0x39bacc[_0xc3f7('0x7d')])){_0x15e082+=','+_0x39bacc['options'];}var _0x19da84=this['channel'][_0xc3f7('0x59')]('MRCPRecog',_0x15e082);if(_0x19da84['result']===-0x1){return _0x19da84;}var _0x131d7a=this['getAndSetVariable'](_0xc3f7('0xb5'),_0xc3f7('0xcc'));if(_0x131d7a[_0xc3f7('0xa5')]===-0x1){return _0x131d7a;}var _0x127f46=this[_0xc3f7('0xb7')](_0xc3f7('0xcd'),_0xc3f7('0xce'));if(_0x127f46[_0xc3f7('0xa5')]===-0x1){return _0x127f46;}var _0x1a1d07=this[_0xc3f7('0xb7')]('RECOG_INSTANCE()',_0xc3f7('0xcf'));if(_0x1a1d07['result']===-0x1){return _0x1a1d07;}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0xba'),_0x15e082));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xd0')]=function(_0x5cd1c7){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0xd1'),_0x5cd1c7[_0xc3f7('0xac')]));if(!this['isConfigured'](_0x5cd1c7[_0xc3f7('0xb3')])){return this[_0xc3f7('0x10')]['noop']('no\x20grammar\x20configured');}var _0x4abc10=_0x5cd1c7[_0xc3f7('0xb3')];if(this['isConfigured'](_0x5cd1c7['options'])){_0x4abc10+=','+_0x5cd1c7[_0xc3f7('0x7d')];}var _0x509f4c=this[_0xc3f7('0x10')][_0xc3f7('0x59')](_0xc3f7('0xb4'),_0x4abc10);if(_0x509f4c['result']===-0x1){return _0x509f4c;}var _0x8abf2b=this['getAndSetVariable'](_0xc3f7('0xb5'),_0xc3f7('0xd2'));if(_0x8abf2b[_0xc3f7('0xa5')]===-0x1){return _0x8abf2b;}var _0x432d93=this[_0xc3f7('0xb7')](_0xc3f7('0xcd'),_0xc3f7('0xd3'));if(_0x432d93[_0xc3f7('0xa5')]===-0x1){return _0x432d93;}var _0x3f44b7=this[_0xc3f7('0xb7')](_0xc3f7('0xb9'),_0xc3f7('0xd4'));if(_0x3f44b7['result']===-0x1){return _0x3f44b7;}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0xba'),_0x4abc10));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xd5')]=function(_0x3e1b4e){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3e1b4e[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x3e1b4e[_0xc3f7('0xd6')])){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x3e1b4e,'no\x20database\x20selected');}var _0x11c57a=this[_0xc3f7('0x1c')][_0xc3f7('0x76')](this,_0x3e1b4e['odbc_id']);if(!_0x11c57a){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x3e1b4e,_0xc3f7('0xd7'));}if(!this['isConfigured'](_0x3e1b4e[_0xc3f7('0x32')])){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x3e1b4e,_0xc3f7('0xd8'));}var _0xaf8b8=_0x3e1b4e[_0xc3f7('0x32')][_0xc3f7('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0xd9'),_0xaf8b8));var _0x5d7a84=this[_0xc3f7('0x2c')][_0xc3f7('0x76')](this,_0x11c57a,_0xaf8b8);this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x3e1b4e,_0xaf8b8);if(!this[_0xc3f7('0x88')](_0x3e1b4e[_0xc3f7('0xda')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xdb'));}var _0x4bbb85=this[_0xc3f7('0x13')]['sync'](this,_0x3e1b4e[_0xc3f7('0xda')]);if(!_0x4bbb85){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x3e1b4e,_0xc3f7('0xdc'));}var _0x5bd481=this;_0x5d7a84['forEach'](function(_0x47e055,_0x43ff15){Object[_0xc3f7('0xdd')](_0x47e055)[_0xc3f7('0xde')](function(_0x5b0b3c){_0x5bd481['channel'][_0xc3f7('0xa2')](util[_0xc3f7('0x2a')](_0xc3f7('0xdf'),_0x4bbb85,_0x43ff15,_0x5b0b3c),_0x47e055[_0x5b0b3c]);});});this[_0xc3f7('0x10')]['setVariable'](util[_0xc3f7('0x2a')](_0xc3f7('0xe0'),_0x4bbb85),_0x5d7a84[_0xc3f7('0x9e')]);return this['channel'][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')]('variable\x20%s\x20set',_0x4bbb85));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xe1')]=function(_0x441ba1){logger[_0xc3f7('0xe2')](util[_0xc3f7('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x441ba1['label']));if(!this[_0xc3f7('0x88')](_0x441ba1['sip_id'])){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x441ba1,_0xc3f7('0xe3'));}var _0xa888b5=this['getUser']['sync'](this,_0x441ba1[_0xc3f7('0xe4')]);if(!_0xa888b5){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x441ba1,'no\x20user\x20found');}var _0x3f9628=this[_0xc3f7('0x10')][_0xc3f7('0x59')](_0xc3f7('0xe5'),[util[_0xc3f7('0x2a')](_0xc3f7('0xe6'),_0xa888b5),_0x441ba1[_0xc3f7('0x6a')],_0x441ba1[_0xc3f7('0xe7')],_0x441ba1['url']]);if(_0x3f9628[_0xc3f7('0xa5')]===-0x1){return _0x3f9628;}return this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0xe8'),_0xc3f7('0xe5')));};AGIVertices[_0xc3f7('0x12')]['dialogflow']=function(_0x5d5b70){logger[_0xc3f7('0x30')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5d5b70['label']));if(!this[_0xc3f7('0x88')](_0x5d5b70[_0xc3f7('0x7e')])){return this[_0xc3f7('0x10')]['noop']('no\x20key\x20configured');}if(!this['isConfigured'](_0x5d5b70[_0xc3f7('0x5f')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xad'));}this[_0xc3f7('0x10')][_0xc3f7('0xe9')]=!![];this[_0xc3f7('0x38')](_0x5d5b70);this[_0xc3f7('0x43')](_0x5d5b70[_0xc3f7('0x5f')],'in','','');this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0xea'),_0x5d5b70[_0xc3f7('0x5f')]));var _0x18ff9e=this[_0xc3f7('0xeb')]['sync'](this,_0x5d5b70);if(_0x18ff9e){for(var _0x1e6335 in _0x18ff9e){if(_0x18ff9e[_0xc3f7('0x9b')](_0x1e6335)){this['channel'][_0xc3f7('0xa2')](util[_0xc3f7('0x2a')](_0xc3f7('0xec'),_0x1e6335[_0xc3f7('0x6f')]()),_0x18ff9e[_0x1e6335]);}}this[_0xc3f7('0x43')](_0x18ff9e[_0xc3f7('0xed')],_0xc3f7('0xee'),'dialogflow','');return this['channel'][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0xef'),_0x18ff9e[_0xc3f7('0xed')]));}return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x5d5b70,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xc3f7('0xf0')]=function(_0x2abafe){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0xf1'),_0x2abafe[_0xc3f7('0xac')]));if(!this['isConfigured'](_0x2abafe[_0xc3f7('0x81')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')]('no\x20project_id\x20configured');}if(!this[_0xc3f7('0x88')](_0x2abafe[_0xc3f7('0x82')])){return this['channel']['noop'](_0xc3f7('0xf2'));}if(!this[_0xc3f7('0x88')](_0x2abafe['private_key'])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xf3'));}if(!this['isConfigured'](_0x2abafe[_0xc3f7('0xf4')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xf5'));}if(!this[_0xc3f7('0x88')](_0x2abafe[_0xc3f7('0x5f')])){return this[_0xc3f7('0x10')]['noop'](_0xc3f7('0xad'));}this[_0xc3f7('0x10')][_0xc3f7('0xe9')]=!![];this[_0xc3f7('0x38')](_0x2abafe);this[_0xc3f7('0x43')](_0x2abafe[_0xc3f7('0x5f')],'in','','');this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0xf6'),_0x2abafe[_0xc3f7('0x5f')]));var _0x3872fa=this['googleDialogflowV2'][_0xc3f7('0x76')](this,_0x2abafe);if(_0x3872fa){for(var _0x27438d in _0x3872fa){if(_0x3872fa['hasOwnProperty'](_0x27438d)){if(_0x27438d!==_0xc3f7('0xf7')){this[_0xc3f7('0x10')]['setVariable'](util[_0xc3f7('0x2a')]('DIALOGFLOW_%s',_0x27438d[_0xc3f7('0x6f')]()),_0x3872fa[_0x27438d]);}}}this[_0xc3f7('0x43')](_0x3872fa[_0xc3f7('0xed')],_0xc3f7('0xee'),_0xc3f7('0xf0'),_0x3872fa[_0xc3f7('0xf7')]);return this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0xf8'),_0x3872fa[_0xc3f7('0xed')]));}return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x2abafe,_0xc3f7('0xf9'));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xfa')]=function(_0x5ada85){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x5ada85[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x5ada85[_0xc3f7('0xfb')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xc3f7('0x88')](_0x5ada85[_0xc3f7('0xfc')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xfd'));}if(!this['isConfigured'](_0x5ada85[_0xc3f7('0xfe')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')]('no\x20password\x20configured');}if(!this[_0xc3f7('0x88')](_0x5ada85[_0xc3f7('0xff')])){return this['channel'][_0xc3f7('0xb1')]('no\x20text\x20configured');}this[_0xc3f7('0x10')][_0xc3f7('0xe9')]=!![];this[_0xc3f7('0x38')](_0x5ada85);this[_0xc3f7('0x43')](_0x5ada85[_0xc3f7('0x5f')],'in','','');this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0x100'),_0x5ada85[_0xc3f7('0x5f')]));var _0x45b7ce=this['sestekNDA'][_0xc3f7('0x76')](this,_0x5ada85);if(_0x45b7ce){for(var _0x36d60d in _0x45b7ce){if(_0x45b7ce[_0xc3f7('0x9b')](_0x36d60d)){this['channel'][_0xc3f7('0xa2')](util[_0xc3f7('0x2a')](_0xc3f7('0x101'),_0x36d60d['toUpperCase']()),_0x45b7ce[_0x36d60d]);}}this[_0xc3f7('0x43')](_0x45b7ce[_0xc3f7('0xed')],_0xc3f7('0xee'),_0xc3f7('0xfa'),'');if(_0x45b7ce[_0xc3f7('0x102')]){this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0x103'),_0x45b7ce[_0xc3f7('0x102')]));var _0x287afc=this[_0xc3f7('0x10')][_0xc3f7('0x104')](_0x45b7ce['audiofile']);try{fs['unlink'](_0x45b7ce[_0xc3f7('0x102')]+_0xc3f7('0x105'));}catch(_0x31cc72){logger[_0xc3f7('0x2e')](_0x31cc72);}return _0x287afc;}else{return this['channel'][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')]('SestekNDA\x20Result\x20%s',_0x45b7ce['speech']));}}return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x5ada85,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x106')]=function(_0x338f99){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x107'),_0x338f99[_0xc3f7('0xac')]));return this['channel'][_0xc3f7('0xb1')](_0xc3f7('0x106'));};AGIVertices['prototype'][_0xc3f7('0x108')]=function(_0x1aed97){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x109'),_0x1aed97[_0xc3f7('0xac')]));var _0x5ecd13='';if(_0x1aed97[_0xc3f7('0x10a')]){if(!this[_0xc3f7('0x88')](_0x1aed97[_0xc3f7('0x10a')])){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x1aed97,_0xc3f7('0x10b'));}else{var _0x38c750=parseInt(_0x1aed97['trunk_id'],0xa);if(isNaN(_0x38c750)){_0x5ecd13=_0x1aed97[_0xc3f7('0x10a')];}else{_0x5ecd13=this[_0xc3f7('0x1f')][_0xc3f7('0x76')](this,_0x1aed97[_0xc3f7('0x10a')]);if(!_0x5ecd13){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x1aed97,_0xc3f7('0x10c'));}}}}else if(_0x1aed97[_0xc3f7('0x10d')]){_0x5ecd13=_0x1aed97[_0xc3f7('0x10d')];}else{return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x1aed97,_0xc3f7('0x10b'));}var _0x58b66b=this['channel'][_0xc3f7('0x59')](_0xc3f7('0xe5'),[util[_0xc3f7('0x2a')](_0xc3f7('0x10e'),_0x5ecd13,_0x1aed97[_0xc3f7('0x4a')]),_0x1aed97[_0xc3f7('0x6a')],_0x1aed97[_0xc3f7('0xe7')],_0x1aed97['url']]);if(_0x58b66b['result']===-0x1){return _0x58b66b;}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0xe8'),'DIAL'));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x10f')]=function(_0xea84b0){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x110'),_0xea84b0[_0xc3f7('0xac')]));return this['channel'][_0xc3f7('0xb1')](_0xc3f7('0x10f'));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xf')]=function(_0x4bba3b){logger[_0xc3f7('0x30')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4bba3b[_0xc3f7('0xac')]));if(_0x4bba3b[_0xc3f7('0xa9')]===0x0){return this[_0xc3f7('0xa8')](_0x4bba3b);}_0x4bba3b['retry']-=0x1;if(!this[_0xc3f7('0x88')](_0x4bba3b['file_id'])){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x4bba3b,_0xc3f7('0x111'));}var _0x280757=this[_0xc3f7('0x20')][_0xc3f7('0x76')](this,_0x4bba3b[_0xc3f7('0x112')]);if(!_0x280757){return this['channel'][_0xc3f7('0x2e')](_0x4bba3b,_0xc3f7('0x113'));}if(!this[_0xc3f7('0x88')](_0x4bba3b[_0xc3f7('0xda')])){return this['channel'][_0xc3f7('0x2e')](_0xc3f7('0xdb'));}var _0x276856=this['channel'][_0xc3f7('0x114')](_0x280757,_0x4bba3b['response'],_0x4bba3b[_0xc3f7('0x115')]);var _0xf58e29=_0x276856[_0xc3f7('0xa5')]?_0x276856[_0xc3f7('0xa5')]['toString']():'';logger[_0xc3f7('0x30')](_0xc3f7('0x116'),JSON[_0xc3f7('0x79')](_0x276856));if(_0x276856[_0xc3f7('0xa5')]===-0x1){this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x4bba3b,_0xf58e29);return _0x276856;}else if(_0x276856[_0xc3f7('0xa7')]===_0xc3f7('0x6a')){_0x276856[_0xc3f7('0xa5')]=_0xf58e29[_0xc3f7('0x9e')]>=parseInt(_0x4bba3b['mindigit'])?'x':'i';}else{_0x276856[_0xc3f7('0xa5')]=_0xf58e29[_0xc3f7('0x9e')]>=parseInt(_0x4bba3b[_0xc3f7('0x117')])&&_0xf58e29[_0xc3f7('0x9e')]<=parseInt(_0x4bba3b['maxdigit'])?'x':'i';}var _0xda55b2=this['getVariable']['sync'](this,_0x4bba3b[_0xc3f7('0xda')]);if(!_0xda55b2){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x4bba3b,_0xc3f7('0xdc'));}this[_0xc3f7('0x10')][_0xc3f7('0xa2')](_0xda55b2,_0xf58e29);if(this[_0xc3f7('0x88')](_0x4bba3b[_0xc3f7('0x118')])){var _0x2f6df1=parseInt(_0x4bba3b[_0xc3f7('0x118')],0xa);var _0x2128a4=rs['generate']({'charset':'*','length':_0x2f6df1});var _0x4b9d27=_0xf58e29[_0xc3f7('0x9e')];if(_0x4b9d27>0x0){if(_0x4b9d27>_0x2f6df1){this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x4bba3b,_0x4bba3b[_0xc3f7('0x119')]===_0xc3f7('0x11a')?_0x2128a4+_0xf58e29[_0xc3f7('0x11b')](_0x2f6df1):_0xf58e29[_0xc3f7('0x11b')](0x0,_0x4b9d27-_0x2f6df1)+_0x2128a4);}else{this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x4bba3b,rs[_0xc3f7('0x11c')]({'charset':'*','length':_0x4b9d27}));}}else{this['createSquareDetailsReport']['sync'](this,_0x4bba3b,'');}}else{this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x4bba3b,_0xf58e29);}return _0x276856;};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x11d')]=function(_0x274b51){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x274b51[_0xc3f7('0xac')]));return this[_0xc3f7('0xf')](_0x274b51);};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x11e')]=function(_0x2acca5){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x11f'),_0x2acca5[_0xc3f7('0xac')]));this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x2acca5,_0x2acca5[_0xc3f7('0x120')]);return this['channel'][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x121'),_0x2acca5['goalname']));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x122')]=function(_0x446625){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x123'),_0x446625[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x446625[_0xc3f7('0x8b')])||!this['isConfigured'](_0x446625[_0xc3f7('0x8c')])){return this['channel'][_0xc3f7('0xb1')](_0xc3f7('0x124'));}if(!this[_0xc3f7('0x88')](_0x446625['text'])){return this[_0xc3f7('0x10')]['noop'](_0xc3f7('0xad'));}this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0x125'),_0x446625[_0xc3f7('0x5f')]));var _0x13f64b=this['awsPolly'][_0xc3f7('0x76')](this,_0x446625);if(_0x13f64b){this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x126'),_0x13f64b));var _0x4fce18=this[_0xc3f7('0x10')][_0xc3f7('0x104')](_0x13f64b);try{fs[_0xc3f7('0x127')](_0x13f64b+_0xc3f7('0x105'));}catch(_0x28da00){logger[_0xc3f7('0x2e')](_0x28da00);}return _0x4fce18;}return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x446625,_0xc3f7('0x128'));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x129')]=function(_0x599bc3){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x12a'),_0x599bc3[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x599bc3[_0xc3f7('0x8b')])||!this['isConfigured'](_0x599bc3[_0xc3f7('0x8c')])){return this['channel'][_0xc3f7('0xb1')](_0xc3f7('0x124'));}if(!this[_0xc3f7('0x88')](_0x599bc3[_0xc3f7('0x93')])){return this['channel'][_0xc3f7('0xb1')](_0xc3f7('0x12b'));}if(!this[_0xc3f7('0x88')](_0x599bc3[_0xc3f7('0x5f')])){return this['channel'][_0xc3f7('0xb1')](_0xc3f7('0xad'));}this[_0xc3f7('0x10')][_0xc3f7('0xe9')]=!![];this[_0xc3f7('0x38')](_0x599bc3);this[_0xc3f7('0x43')](_0x599bc3[_0xc3f7('0x5f')],'in','','');this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x599bc3[_0xc3f7('0x5f')]));var _0x2976e0=this[_0xc3f7('0x91')][_0xc3f7('0x76')](this,_0x599bc3);if(_0x2976e0){for(var _0x3f30ad in _0x2976e0){if(_0x2976e0[_0xc3f7('0x9b')](_0x3f30ad)&&_[_0xc3f7('0x9f')](_0x2976e0[_0x3f30ad])){this[_0xc3f7('0x10')][_0xc3f7('0xa2')](util[_0xc3f7('0x2a')](_0xc3f7('0x12c'),_0x3f30ad['toUpperCase']()),_0x2976e0[_0x3f30ad]);}}if(_[_0xc3f7('0x46')](_0x2976e0[_0xc3f7('0x7b')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x2976e0[_0xc3f7('0x7b')],'out','amazonlex','');return this['channel'][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')]('Amazon\x20Lex\x20Result\x20%s',_0x2976e0[_0xc3f7('0x7b')]));}}return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x599bc3,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x12d')]=function(_0x1ef326){logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0x12e'),_0x1ef326[_0xc3f7('0xac')],_0x1ef326[_0xc3f7('0x6a')]));if(!this[_0xc3f7('0x88')](_0x1ef326[_0xc3f7('0x7e')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0x12f'));}var _0x1046a8='wav';var _0x12b54a=util[_0xc3f7('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x5d1686=util[_0xc3f7('0x2a')](_0xc3f7('0xa1'),_0x12b54a,_0x1046a8);var _0x306c42=!![];if(_0x1ef326['beep']==='NOBEEP'){_0x306c42=![];}var _0x47a691=this['channel'][_0xc3f7('0x130')](_0x12b54a,_0x1046a8,_0x1ef326['intKey'],_0x1ef326[_0xc3f7('0x6a')],undefined,_0x306c42);if(_0x47a691[_0xc3f7('0xa5')]!==-0x1){this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x131'),_0x5d1686));var _0x13d4d1=this[_0xc3f7('0x94')][_0xc3f7('0x76')](this,_0x1ef326,_0x5d1686);if(_0x13d4d1){for(var _0x9648e in _0x13d4d1){if(_0x13d4d1[_0xc3f7('0x9b')](_0x9648e)){this[_0xc3f7('0x10')][_0xc3f7('0xa2')](util[_0xc3f7('0x2a')]('GOOGLE_ASR_%s',_0x9648e['toUpperCase']()),_0x13d4d1[_0x9648e]);}}return this['channel']['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0x132'),JSON[_0xc3f7('0x79')](_0x13d4d1)));}}return _0x47a691;};AGIVertices['prototype'][_0xc3f7('0x133')]=function(_0x47385e){logger['info'](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x47385e[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x47385e[_0xc3f7('0x134')])){return this[_0xc3f7('0x10')]['noop']('no\x20appid\x20configured');}if(!this[_0xc3f7('0x88')](_0x47385e[_0xc3f7('0x135')])){return this['channel'][_0xc3f7('0xb1')](_0xc3f7('0x136'));}var _0x469f6e=_0xc3f7('0x137');var _0x7dc173=util[_0xc3f7('0x2a')](_0xc3f7('0x138'),FILES_PATH,rs[_0xc3f7('0x11c')](0x4));var _0x2b5395=util[_0xc3f7('0x2a')]('%s.%s',_0x7dc173,_0x469f6e);var _0x34fc7c=!![];if(_0x47385e[_0xc3f7('0x139')]===_0xc3f7('0x13a')){_0x34fc7c=![];}var _0x2121b4=this[_0xc3f7('0x10')][_0xc3f7('0x130')](_0x7dc173,_0x469f6e,_0x47385e[_0xc3f7('0x13b')],_0x47385e[_0xc3f7('0x6a')],undefined,_0x34fc7c);if(_0x2121b4[_0xc3f7('0xa5')]!==-0x1){this['channel'][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x13c'),_0x2b5395));var _0x4aede2=this[_0xc3f7('0x96')][_0xc3f7('0x76')](this,_0x47385e,_0x2b5395);if(_0x4aede2){for(var _0x25fd91 in _0x4aede2){if(_0x4aede2[_0xc3f7('0x9b')](_0x25fd91)){this['channel'][_0xc3f7('0xa2')](util['format']('TILDE_ASR_%s',_0x25fd91[_0xc3f7('0x6f')]()),_0x4aede2[_0x25fd91]);}}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x13d'),JSON[_0xc3f7('0x79')](_0x4aede2)));}}return _0x2121b4;};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x13e')]=function(_0x3f0de2){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x13f'),_0x3f0de2[_0xc3f7('0xac')]));return this[_0xc3f7('0x10')][_0xc3f7('0x140')](_0x3f0de2[_0xc3f7('0x3f')],_0x3f0de2[_0xc3f7('0x141')],_0x3f0de2[_0xc3f7('0x142')]);};AGIVertices[_0xc3f7('0x12')]['gotoif']=function(_0x134c3f){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x143'),_0x134c3f[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x134c3f[_0xc3f7('0x144')])){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x134c3f,_0xc3f7('0x145'));}try{var _0x1ddcac=eval(_0x134c3f[_0xc3f7('0x144')])?_0xc3f7('0x146'):_0xc3f7('0x147');this['channel'][_0xc3f7('0xb1')](util['format'](_0xc3f7('0x148'),_0x134c3f[_0xc3f7('0x144')],_0x1ddcac));return{'code':0xc8,'result':_0x1ddcac};}catch(_0xbf5964){return{'code':0xc8,'result':_0xc3f7('0x147')};}};AGIVertices['prototype'][_0xc3f7('0x149')]=function(_0x1c818e){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x14a'),_0x1c818e[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x1c818e[_0xc3f7('0x14b')])){return this['channel'][_0xc3f7('0x2e')](_0x1c818e,_0xc3f7('0x14c'));}var _0x2d88ea=this[_0xc3f7('0x25')][_0xc3f7('0x76')](this,_0x1c818e['interval_id']);if(!_0x2d88ea){return this[_0xc3f7('0x10')]['error'](_0x1c818e,_0xc3f7('0x14d'));}for(var _0x383f48=0x0;_0x383f48<_0x2d88ea[_0xc3f7('0x9e')];_0x383f48+=0x1){var _0x572c09=this['channel'][_0xc3f7('0x13')](util[_0xc3f7('0x2a')](_0xc3f7('0x14e'),_0x2d88ea[_0x383f48]));if(_0x572c09[_0xc3f7('0xa5')]===-0x1){return _0x572c09;}logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')]('IFTIME\x20%s\x20%s',_0x2d88ea[_0x383f48],_0x572c09[_0xc3f7('0xa7')]));if(_0x572c09['extra']===_0xc3f7('0x146')){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x14f'),_0x2d88ea[_0x383f48],_0xc3f7('0x146')));this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x14f'),_0x2d88ea[_0x383f48],_0xc3f7('0x146')));return{'code':0xc8,'result':_0xc3f7('0x146')};}else{logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x14f'),_0x2d88ea[_0x383f48],_0xc3f7('0x147')));this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x14f'),_0x2d88ea[_0x383f48],'false'));}}return{'code':0xc8,'result':_0xc3f7('0x147')};};AGIVertices['prototype'][_0xc3f7('0x150')]=function(_0x1360ef){logger['info'](util[_0xc3f7('0x2a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1360ef[_0xc3f7('0xac')]));return this[_0xc3f7('0x10')][_0xc3f7('0x150')]();};AGIVertices['prototype'][_0xc3f7('0x151')]=function(_0x261f0a){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x261f0a[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x261f0a[_0xc3f7('0x7e')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')]('no\x20key\x20configured');}var _0x2dc43c=_0xc3f7('0x137');var _0x337892=util[_0xc3f7('0x2a')](_0xc3f7('0x138'),FILES_PATH,rs[_0xc3f7('0x11c')](0x4));var _0x40e01b=util[_0xc3f7('0x2a')](_0xc3f7('0xa1'),_0x337892,_0x2dc43c);var _0x5f0d96=!![];if(_0x261f0a[_0xc3f7('0x139')]===_0xc3f7('0x13a')){_0x5f0d96=![];}var _0x127b5f=this[_0xc3f7('0x10')][_0xc3f7('0x130')](_0x337892,_0x2dc43c,_0x261f0a[_0xc3f7('0x13b')],_0x261f0a[_0xc3f7('0x6a')],undefined,_0x5f0d96);if(_0x127b5f['result']!==-0x1){this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util['format'](_0xc3f7('0x152'),_0x40e01b));var _0x201d17=this['ispeechASR'][_0xc3f7('0x76')](this,_0x261f0a,_0x40e01b);if(_0x201d17){for(var _0x242d66 in _0x201d17){if(_0x201d17['hasOwnProperty'](_0x242d66)){this[_0xc3f7('0x10')]['setVariable'](util[_0xc3f7('0x2a')]('ISPEECH_ASR_%s',_0x242d66[_0xc3f7('0x6f')]()),_0x201d17[_0x242d66]);}}return this['channel'][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')]('IspeechASR\x20Result\x20%s',JSON[_0xc3f7('0x79')](_0x201d17)));}}return _0x127b5f;};AGIVertices[_0xc3f7('0x12')]['ispeechtts']=function(_0x5f3cd9){logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0x153'),_0x5f3cd9[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x5f3cd9['key'])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0x12f'));}if(!this[_0xc3f7('0x88')](_0x5f3cd9[_0xc3f7('0x5f')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xad'));}this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x154'),_0x5f3cd9['text']));var _0x13c933=this[_0xc3f7('0x85')][_0xc3f7('0x76')](this,_0x5f3cd9);if(_0x13c933){this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x152'),_0x13c933));var _0x414a0f=this[_0xc3f7('0x10')]['streamFile'](_0x13c933,_0x5f3cd9[_0xc3f7('0x13b')]);try{fs[_0xc3f7('0x127')](_0x13c933+'.wav');}catch(_0x2a6aaf){logger['error'](_0x2a6aaf);}return _0x414a0f;}return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x5f3cd9,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x155')]=function(_0x2d333c){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x156'),_0x2d333c[_0xc3f7('0xac')]));if(!this['isConfigured'](_0x2d333c[_0xc3f7('0x157')])){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x2d333c,_0xc3f7('0x158'));}logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x159'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x2d333c['findBy']));var _0x2ff32f=this['agentLogin']['sync'](this,_0x2d333c['findBy']);if(_0x2ff32f){logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0x15a'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x2d333c[_0xc3f7('0x157')]));this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0x15a'),this['channel'][_0xc3f7('0x3c')],_0x2d333c['findBy']));return{'code':0xc8,'result':_0xc3f7('0x15b')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x2d333c[_0xc3f7('0x157')]));this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util['format'](_0xc3f7('0x15c'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x2d333c[_0xc3f7('0x157')]));return{'code':0xc8,'result':_0xc3f7('0x15d')};}};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x15e')]=function(_0x53dfb4){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x15f'),_0x53dfb4[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x53dfb4['findBy'])){return this[_0xc3f7('0x10')]['error'](_0x53dfb4,_0xc3f7('0x158'));}logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x159'),this[_0xc3f7('0x10')]['callerid'],_0x53dfb4[_0xc3f7('0x157')]));var _0x2369bd=this[_0xc3f7('0x54')][_0xc3f7('0x76')](this,_0x53dfb4[_0xc3f7('0x157')]);if(_0x2369bd){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x15a'),this[_0xc3f7('0x10')]['callerid'],_0x53dfb4['findBy']));this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x15a'),this[_0xc3f7('0x10')]['callerid'],_0x53dfb4[_0xc3f7('0x157')]));return{'code':0xc8,'result':_0xc3f7('0x15b')};}else{logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x15c'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x53dfb4[_0xc3f7('0x157')]));this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0x15c'),this['channel'][_0xc3f7('0x3c')],_0x53dfb4['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x160')]=function(_0x12f4a7){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x161'),_0x12f4a7[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x12f4a7[_0xc3f7('0x162')])){return this['channel'][_0xc3f7('0x2e')](_0x12f4a7,_0xc3f7('0x163'));}this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util['format']('math\x20%s',_0x12f4a7[_0xc3f7('0x162')]));var _0x29a489=eval(_0x12f4a7[_0xc3f7('0x162')]);if(!this[_0xc3f7('0x88')](_0x12f4a7[_0xc3f7('0xda')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1bacd9=this[_0xc3f7('0x13')][_0xc3f7('0x76')](this,_0x12f4a7[_0xc3f7('0xda')]);if(!_0x1bacd9){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x12f4a7,_0xc3f7('0xdc'));}if(_['isArray'](_0x29a489)){var _0x34ef08=this;_0x29a489[_0xc3f7('0xde')](function(_0x580cc0,_0x40ab22){_0x34ef08['channel'][_0xc3f7('0xa2')](util[_0xc3f7('0x2a')](_0xc3f7('0x164'),_0x1bacd9,_0x40ab22),_0x580cc0);});return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x165'),_0x1bacd9));}else{return this[_0xc3f7('0x10')][_0xc3f7('0xa2')](_0x1bacd9,_0x29a489);}};AGIVertices[_0xc3f7('0x12')]['menu']=function(_0xd3def8){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x166'),_0xd3def8['label']));if(_0xd3def8[_0xc3f7('0xa9')]===0x0){return this['maxRetry'](_0xd3def8);}_0xd3def8[_0xc3f7('0xa9')]-=0x1;if(!this[_0xc3f7('0x88')](_0xd3def8[_0xc3f7('0x112')])){return this['channel'][_0xc3f7('0x2e')](_0xd3def8,_0xc3f7('0x111'));}var _0x2bc074=this[_0xc3f7('0x20')]['sync'](this,_0xd3def8[_0xc3f7('0x112')]);if(!_0x2bc074){return this[_0xc3f7('0x10')]['error'](_0xd3def8,_0xc3f7('0x113'));}var _0x1ed2d2=this[_0xc3f7('0x10')]['getData'](_0x2bc074,_0xd3def8['response'],_0xd3def8[_0xc3f7('0x167')]);var _0x547fbf=_0x1ed2d2['result'];if(_0x1ed2d2['result']===-0x1){this[_0xc3f7('0x38')]['sync'](this,_0xd3def8,'-1');return _0x1ed2d2;}else if(_0x1ed2d2[_0xc3f7('0xa7')]===_0xc3f7('0x6a')){_0x1ed2d2[_0xc3f7('0xa5')]=_0x1ed2d2[_0xc3f7('0xa5')][_0xc3f7('0x9e')]>0x0?_0x1ed2d2[_0xc3f7('0xa5')]:'t';}else if(_[_0xc3f7('0x45')](_0x1ed2d2[_0xc3f7('0xa5')])){_0x1ed2d2[_0xc3f7('0xa5')]='#';_0x547fbf='#';}if(!this['isConfigured'](_0xd3def8[_0xc3f7('0xda')])){this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xdb'));}else{var _0x524a2a=this['getVariable'][_0xc3f7('0x76')](this,_0xd3def8['variable_id']);if(!_0x524a2a){return this['channel'][_0xc3f7('0x2e')](_0xd3def8,_0xc3f7('0xdc'));}this[_0xc3f7('0x10')][_0xc3f7('0xa2')](_0x524a2a,_0x547fbf);}this[_0xc3f7('0x38')]['sync'](this,_0xd3def8,_0x547fbf);return _0x1ed2d2;};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0xb1')]=function(_0x2f5f51){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x168'),_0x2f5f51[_0xc3f7('0xac')]));return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0x2f5f51[_0xc3f7('0x169')]||_0x2f5f51['label']);};AGIVertices[_0xc3f7('0x12')]['pause']=function(_0x19c5ff){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x16a'),_0x19c5ff[_0xc3f7('0xac')]));if(!this['isConfigured'](_0x19c5ff[_0xc3f7('0x157')])){return this['channel']['error'](_0x19c5ff,_0xc3f7('0x158'));}logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0x159'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x19c5ff[_0xc3f7('0x157')]));var _0x5a7692=this[_0xc3f7('0x16b')]['sync'](this,_0x19c5ff['pause_id']);var _0x2e3c0c=this[_0xc3f7('0x52')]['sync'](this,_0x19c5ff[_0xc3f7('0x157')],_0x5a7692);if(_0x2e3c0c){logger[_0xc3f7('0x30')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x19c5ff[_0xc3f7('0x157')]));this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x15a'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x19c5ff[_0xc3f7('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x15c'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x19c5ff[_0xc3f7('0x157')]));this['channel'][_0xc3f7('0xb1')](util['format'](_0xc3f7('0x15a'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x19c5ff[_0xc3f7('0x157')]));return{'code':0xc8,'result':_0xc3f7('0x15d')};}};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x16c')]=function(_0x5482f1){logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0x16d'),_0x5482f1[_0xc3f7('0xac')]));if(!this['isConfigured'](_0x5482f1['file_id'])){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x5482f1,_0xc3f7('0x111'));}var _0x1a8113=this['getSound'][_0xc3f7('0x76')](this,_0x5482f1[_0xc3f7('0x112')]);if(!_0x1a8113){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x5482f1,_0xc3f7('0x113'));}var _0x3ab9da=this[_0xc3f7('0x10')][_0xc3f7('0x59')](_0xc3f7('0x16e'),[_0x1a8113,_0x5482f1[_0xc3f7('0xe7')]]);if(_0x3ab9da['result']===-0x1){return _0x3ab9da;}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util['format'](_0xc3f7('0xc9'),_0xc3f7('0x16e'),_0x1a8113));};AGIVertices[_0xc3f7('0x12')]['queue']=function(_0x10f3da){logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0x16f'),_0x10f3da[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x10f3da[_0xc3f7('0x170')])){return this['channel'][_0xc3f7('0x2e')](_0x10f3da,_0xc3f7('0x171'));}var _0x204769='';var _0x3edd46=parseInt(_0x10f3da['queue_id'],0xa);if(isNaN(_0x3edd46)){_0x204769=_0x10f3da[_0xc3f7('0x170')];}else{_0x204769=this[_0xc3f7('0x17')]['sync'](this,_0x10f3da[_0xc3f7('0x170')]);if(!_0x204769){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x10f3da,'no\x20queue\x20found');}}var _0x43d086='';if(this[_0xc3f7('0x88')](_0x10f3da[_0xc3f7('0x112')])){var _0x15d301=this[_0xc3f7('0x20')][_0xc3f7('0x76')](this,_0x10f3da[_0xc3f7('0x112')]);if(_0x15d301){_0x43d086=_0x15d301;}}this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x10f3da,_0x204769);if(_0x10f3da[_0xc3f7('0xe7')]['indexOf']('x')<0x0){_0x10f3da[_0xc3f7('0xe7')]+='x';}if(_0x10f3da[_0xc3f7('0xe7')][_0xc3f7('0x172')]('X')<0x0){_0x10f3da[_0xc3f7('0xe7')]+='X';}this[_0xc3f7('0x10')][_0xc3f7('0xa2')](_0xc3f7('0x173'),_0x204769?_0x204769['toLowerCase']():'');var _0x5618dc=this[_0xc3f7('0x10')][_0xc3f7('0x59')](_0xc3f7('0x174'),[_0x204769,_0x10f3da[_0xc3f7('0xe7')],_0x10f3da['url'],_0x43d086,_0x10f3da[_0xc3f7('0x6a')],_0x10f3da[_0xc3f7('0x9')],_0x10f3da[_0xc3f7('0x175')],_0x10f3da[_0xc3f7('0x176')],'',_0x10f3da[_0xc3f7('0x177')]]);if(_0x5618dc[_0xc3f7('0xa5')]===-0x1){return _0x5618dc;}return this['channel']['noop'](util['format'](_0xc3f7('0xc9'),_0xc3f7('0x174'),_0x204769));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x178')]=function(_0x3ff0d4){logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0x179'),_0x3ff0d4[_0xc3f7('0xac')]));var _0x5ccb05=_0x3ff0d4[_0xc3f7('0x17a')]||_0xc3f7('0x137');var _0x21c0df=util[_0xc3f7('0x2a')](_0xc3f7('0x17b'),this[_0xc3f7('0x10')][_0xc3f7('0x39')],rs[_0xc3f7('0x11c')](0x5));var _0x8532a0=util[_0xc3f7('0x2a')](_0xc3f7('0x17c'),FILES_PATH,_0x21c0df,_0x5ccb05);var _0x4d9c2f=util[_0xc3f7('0x2a')](_0xc3f7('0x138'),FILES_PATH,_0x21c0df);this[_0xc3f7('0x3d')][_0xc3f7('0x76')](this,_0x3ff0d4,_0x21c0df,_0x8532a0);this['channel']['setVariable'](_0xc3f7('0x17d'),_0x21c0df);logger[_0xc3f7('0x30')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x4d9c2f,_0x5ccb05,_0x3ff0d4[_0xc3f7('0x17e')],_0x3ff0d4['timeout']);return this['channel'][_0xc3f7('0x130')](_0x4d9c2f,_0x5ccb05,_0x3ff0d4[_0xc3f7('0x17e')],_0x3ff0d4['timeout'],undefined,!![]);};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x17f')]=function(_0x1ae914){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x180'),_0x1ae914['label']));if(!this[_0xc3f7('0x88')](_0x1ae914[_0xc3f7('0x68')])){return this[_0xc3f7('0x10')]['noop'](_0xc3f7('0x181'));}var _0x2289ee=this[_0xc3f7('0x67')][_0xc3f7('0x76')](this,_0x1ae914);logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x182'),util[_0xc3f7('0x183')](_0x2289ee,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1ae914['variable_id'])){return this['channel'][_0xc3f7('0xb1')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x53ad92=this[_0xc3f7('0x13')]['sync'](this,_0x1ae914[_0xc3f7('0xda')]);if(!_0x53ad92){return this['channel'][_0xc3f7('0x2e')](_0x1ae914,'no\x20variable\x20found');}this[_0xc3f7('0x10')][_0xc3f7('0xa2')](util[_0xc3f7('0x2a')]('%s_STATUS_CODE',_0x53ad92),_0x2289ee['statusCode']?_0x2289ee[_0xc3f7('0x7a')]:'200');this[_0xc3f7('0x10')][_0xc3f7('0xa2')](util['format'](_0xc3f7('0x184'),_0x53ad92),_0x2289ee[_0xc3f7('0x185')]?_0x2289ee[_0xc3f7('0x185')]:'OK');if(_0x2289ee[_0xc3f7('0x70')]){try{this['saveRestApiResult'](_0x2289ee[_0xc3f7('0x70')],_0x53ad92);}catch(_0x2d457){logger[_0xc3f7('0x2e')](util[_0xc3f7('0x2a')](_0xc3f7('0x186'),_0x53ad92));}}return this['channel'][_0xc3f7('0xb1')](util['format'](_0xc3f7('0x187'),_0x53ad92));};AGIVertices[_0xc3f7('0x12')]['saydigits']=function(_0x51c532){logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0x188'),_0x51c532[_0xc3f7('0xac')]));return this[_0xc3f7('0x10')]['sayDigits'](_0x51c532[_0xc3f7('0x189')][_0xc3f7('0x5b')](/\s+/g,''),_0x51c532['escape_digits']);};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x18a')]=function(_0x36aeff){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x18b'),_0x36aeff[_0xc3f7('0xac')]));return this[_0xc3f7('0x10')]['sayNumber'](_0x36aeff[_0xc3f7('0x6b')][_0xc3f7('0x5b')](/\s+/g,''),_0x36aeff['escape_digits']);};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x18c')]=function(_0x359482){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x18d'),_0x359482[_0xc3f7('0xac')]));return this[_0xc3f7('0x10')][_0xc3f7('0x18e')](_0x359482[_0xc3f7('0x5f')],_0x359482[_0xc3f7('0x17e')]);};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x18f')]=function(_0x14a1d8){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x14a1d8['label']));if(!this[_0xc3f7('0x88')](_0x14a1d8[_0xc3f7('0x190')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')]('no\x20mail\x20account\x20configured');}var _0xedec27=this[_0xc3f7('0x22')]['sync'](this,_0x14a1d8[_0xc3f7('0x190')]);if(!_0xedec27||!_0xedec27['Smtp']){return this[_0xc3f7('0x10')]['error'](_0x14a1d8,_0xc3f7('0x191'));}var _0x4f2445={'from':util[_0xc3f7('0x2a')](_0xc3f7('0x192'),_0xedec27[_0xc3f7('0x16')],_0xedec27['email']||_0xedec27['Smtp'][_0xc3f7('0x193')]),'to':_0x14a1d8['to']||'','cc':_0x14a1d8['cc']||'','bcc':_0x14a1d8[_0xc3f7('0x194')]||'','subject':_0x14a1d8[_0xc3f7('0x195')],'html':_0x14a1d8['text'],'text':_0x14a1d8['text']};var _0xc223ab={'tls':{'rejectUnauthorized':![]}};if(_0xedec27['Smtp'][_0xc3f7('0x196')]){_0xc223ab[_0xc3f7('0x196')]=_0xedec27[_0xc3f7('0x197')][_0xc3f7('0x196')];}else{_0xc223ab[_0xc3f7('0x198')]=_0xedec27[_0xc3f7('0x197')][_0xc3f7('0x198')];_0xc223ab['port']=_0xedec27['Smtp'][_0xc3f7('0x199')];_0xc223ab['secure']=_0xedec27[_0xc3f7('0x197')][_0xc3f7('0x19a')];}if(_0xedec27[_0xc3f7('0x197')][_0xc3f7('0x19b')]){_0xc223ab['auth']={'user':_0xedec27[_0xc3f7('0x197')][_0xc3f7('0x193')],'pass':_0xedec27[_0xc3f7('0x197')][_0xc3f7('0x19c')]};}if(this[_0xc3f7('0x88')](_0x14a1d8['template_id'])){}logger[_0xc3f7('0xe2')]('sendMail\x20message',JSON[_0xc3f7('0x79')](_0x4f2445));this[_0xc3f7('0x38')]['sync'](this,_0x14a1d8,_0x14a1d8[_0xc3f7('0x190')]);this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')]('Trying\x20SendMail\x20with\x20account\x20%s',_0xedec27[_0xc3f7('0x16')]));this[_0xc3f7('0x23')]['sync'](this,_0xc223ab,_0x4f2445);return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0x19d'));};AGIVertices['prototype'][_0xc3f7('0x19e')]=function(_0x6e453d){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x19f'),_0x6e453d[_0xc3f7('0xac')]));return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0x1a0'));};AGIVertices[_0xc3f7('0x12')]['sendSMS']=function(_0x49eda5){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x1a1'),_0x49eda5[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x49eda5[_0xc3f7('0x1a2')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0x1a3'));}var _0x14adff=this[_0xc3f7('0x35')][_0xc3f7('0x76')](this,_0x49eda5[_0xc3f7('0x1a2')]);if(!_0x14adff){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x49eda5,'no\x20sms\x20account\x20found');}var _0x4284e9={'body':_0x49eda5[_0xc3f7('0x1a4')],'phone':_0x49eda5['to']||'','SmsAccountId':_0x14adff['id']};logger[_0xc3f7('0xe2')](_0xc3f7('0x1a5'),JSON[_0xc3f7('0x79')](_0x4284e9));this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x49eda5,_0x49eda5[_0xc3f7('0x1a2')]);this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x1a6'),_0x14adff['name']));this[_0xc3f7('0x37')]['sync'](this,_0x4284e9);return this['channel'][_0xc3f7('0xb1')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x1a7')]=function(_0x1e0fd0){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x1a8'),_0x1e0fd0[_0xc3f7('0xac')]));if(!this['isConfigured'](_0x1e0fd0[_0xc3f7('0xda')])){return this[_0xc3f7('0x10')]['error'](_0x1e0fd0,_0xc3f7('0x1a9'));}var _0x1dcf4e=this[_0xc3f7('0x13')][_0xc3f7('0x76')](this,_0x1e0fd0[_0xc3f7('0xda')]);if(!_0x1dcf4e){return this[_0xc3f7('0x10')]['error'](_0x1e0fd0,_0xc3f7('0xdc'));}return this[_0xc3f7('0x10')][_0xc3f7('0xa2')](_0x1dcf4e,_0x1e0fd0[_0xc3f7('0x1aa')]);};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x1ab')]=function(_0x4587d3){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x1ac'),_0x4587d3[_0xc3f7('0xac')]));this[_0xc3f7('0x10')][_0xc3f7('0xb1')]('START\x20CALLY\x20SQUARE');if(_0x4587d3[_0xc3f7('0xbd')]===_0xc3f7('0x1ad')){this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0x1ae'));return this[_0xc3f7('0x10')][_0xc3f7('0xbd')]();}return this['channel'][_0xc3f7('0xb1')](_0xc3f7('0x1af'));};AGIVertices[_0xc3f7('0x12')]['subproject']=function(_0x3f2984){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x1b0'),_0x3f2984[_0xc3f7('0xac')]));if(!this[_0xc3f7('0x88')](_0x3f2984[_0xc3f7('0x1b1')])){return this['channel'][_0xc3f7('0x2e')](_0x3f2984,'no\x20subproject\x20selected');}var _0x3bf8a5=this[_0xc3f7('0x1a')][_0xc3f7('0x76')](this,_0x3f2984[_0xc3f7('0x1b1')]);if(!this[_0xc3f7('0x88')](_0x3bf8a5)){return this[_0xc3f7('0x10')]['error'](_0x3f2984,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x3f2984[_0xc3f7('0x1b1')]));}if(_0x3bf8a5===this[_0xc3f7('0x10')][_0xc3f7('0x3b')]){return this['channel'][_0xc3f7('0x2e')](_0x3f2984,_0xc3f7('0x1b2'));}this[_0xc3f7('0x38')][_0xc3f7('0x76')](this,_0x3f2984,_0x3bf8a5);var _0x5cbcae=this[_0xc3f7('0x10')][_0xc3f7('0x59')](_0xc3f7('0x1b3'),util['format'](_0xc3f7('0x1b4'),config['agi'][_0xc3f7('0x198')]||_0xc3f7('0x1b5'),_0x3bf8a5,this[_0xc3f7('0x10')]['arg_1']));if(_0x5cbcae[_0xc3f7('0xa5')]===-0x1){return _0x5cbcae;}return this['channel'][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')]('Executed\x20command\x20%s\x20%s',_0xc3f7('0x1b3'),_0x3bf8a5));};AGIVertices[_0xc3f7('0x12')]['system']=function(_0x58d1f8){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x58d1f8[_0xc3f7('0xac')]));var _0xfc99e=this[_0xc3f7('0x58')][_0xc3f7('0x76')](this,_0x58d1f8[_0xc3f7('0x1b6')]);this['createSquareDetailsReport'][_0xc3f7('0x76')](this,_0x58d1f8,_0x58d1f8['command']);if(this['isConfigured'](_0x58d1f8[_0xc3f7('0xda')])){var _0x3492a8=this[_0xc3f7('0x13')]['sync'](this,_0x58d1f8['variable_id']);if(_0x3492a8){this[_0xc3f7('0x10')]['setVariable'](_0x3492a8,_0xfc99e);return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x58d1f8[_0xc3f7('0x1b6')],_0x3492a8));}}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x1b7'),_0x58d1f8['command']));};AGIVertices['prototype'][_0xc3f7('0x1b8')]=function(_0x3a1c46){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x1b9'),_0x3a1c46[_0xc3f7('0xac')]));_0x3a1c46[_0xc3f7('0x5f')]=_0x3a1c46['text'][_0xc3f7('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc3f7('0x88')](_0x3a1c46[_0xc3f7('0x5d')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0x1ba'));}if(!this[_0xc3f7('0x88')](_0x3a1c46[_0xc3f7('0x5f')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x1bb'),_0x3a1c46[_0xc3f7('0x5f')]));var _0x45c661=this['googleCloudTTS'][_0xc3f7('0x76')](this,_0x3a1c46);if(_0x45c661){this[_0xc3f7('0x10')]['noop'](util[_0xc3f7('0x2a')](_0xc3f7('0x1bc'),_0x45c661));var _0xf7feb=this['channel'][_0xc3f7('0x104')](_0x45c661);try{fs['unlink'](_0x45c661+'.wav');}catch(_0x274585){logger[_0xc3f7('0x2e')](_0x274585);}return _0xf7feb;}return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x3a1c46,_0xc3f7('0x1bd'));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x1be')]=function(_0x12ed04){logger['info'](util[_0xc3f7('0x2a')](_0xc3f7('0x1bf'),_0x12ed04['label']));_0x12ed04[_0xc3f7('0x5f')]=_0x12ed04[_0xc3f7('0x5f')][_0xc3f7('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc3f7('0x88')](_0x12ed04[_0xc3f7('0x5f')])){return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](_0xc3f7('0xad'));}this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util[_0xc3f7('0x2a')](_0xc3f7('0x1c0'),_0x12ed04[_0xc3f7('0x5f')]));var _0x43ddc3=this['googleTTS'][_0xc3f7('0x76')](this,_0x12ed04);if(_0x43ddc3){this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util['format'](_0xc3f7('0x1c1'),_0x43ddc3));var _0x181f9=this['channel'][_0xc3f7('0x104')](_0x43ddc3);try{fs[_0xc3f7('0x127')](_0x43ddc3+_0xc3f7('0x105'));}catch(_0x3c0b40){logger['error'](_0x3c0b40);}return _0x181f9;}return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x12ed04,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x1c2')]=function(_0x9b12c3){logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x1c3'),_0x9b12c3['label']));if(!this[_0xc3f7('0x88')](_0x9b12c3[_0xc3f7('0x157')])){return this[_0xc3f7('0x10')]['error'](_0x9b12c3,_0xc3f7('0x158'));}logger['info'](util[_0xc3f7('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x9b12c3[_0xc3f7('0x157')]));var _0x12d005=this[_0xc3f7('0x53')][_0xc3f7('0x76')](this,_0x9b12c3[_0xc3f7('0x157')]);if(_0x12d005){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x15a'),this[_0xc3f7('0x10')]['callerid'],_0x9b12c3[_0xc3f7('0x157')]));this['channel'][_0xc3f7('0xb1')](util['format'](_0xc3f7('0x15a'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x9b12c3[_0xc3f7('0x157')]));return{'code':0xc8,'result':_0xc3f7('0x15b')};}else{logger[_0xc3f7('0x30')](util['format'](_0xc3f7('0x15c'),this['channel']['callerid'],_0x9b12c3[_0xc3f7('0x157')]));this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util['format'](_0xc3f7('0x15c'),this[_0xc3f7('0x10')][_0xc3f7('0x3c')],_0x9b12c3[_0xc3f7('0x157')]));return{'code':0xc8,'result':_0xc3f7('0x15d')};}};AGIVertices[_0xc3f7('0x12')]['voicemail']=function(_0x507b86){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')](_0xc3f7('0x1c4'),_0x507b86[_0xc3f7('0xac')]));var _0x3568e4=this[_0xc3f7('0x10')][_0xc3f7('0x59')](_0xc3f7('0x1c5'),[_0x507b86['mailbox'],_0x507b86[_0xc3f7('0x7d')]]);if(_0x3568e4['result']===-0x1){return _0x3568e4;}return this[_0xc3f7('0x10')][_0xc3f7('0xb1')](util['format'](_0xc3f7('0xc9'),_0xc3f7('0x1c5'),_0x507b86['mailbox']));};AGIVertices[_0xc3f7('0x12')][_0xc3f7('0x1c6')]=function(_0x5de28f){logger[_0xc3f7('0x30')](util[_0xc3f7('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x5de28f['label']));if(!this[_0xc3f7('0x88')](_0x5de28f['variable_id'])){return this['channel']['error'](_0x5de28f,_0xc3f7('0x1a9'));}var _0x52e566=this[_0xc3f7('0x13')][_0xc3f7('0x76')](this,_0x5de28f[_0xc3f7('0xda')]);if(!_0x52e566){return this[_0xc3f7('0x10')][_0xc3f7('0x2e')](_0x5de28f,_0xc3f7('0xdc'));}var _0x2c8c87=this[_0xc3f7('0x10')][_0xc3f7('0x13')](_0x52e566);return{'code':0xc8,'result':_0x2c8c87[_0xc3f7('0xa7')]?_0x2c8c87['extra']:'-'};};String['prototype'][_0xc3f7('0xa4')]=function(_0x4a893b,_0x2c4513){return this['split'](_0x4a893b)['join'](_0x2c4513);};module[_0xc3f7('0x1c7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2cf0523..4344885 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 _0x5e3a=['[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','hanguprequest','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','timers','info','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','isUndefined','linkedid','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]'];(function(_0x220527,_0xd1f27d){var _0xe5f758=function(_0x193e66){while(--_0x193e66){_0x220527['push'](_0x220527['shift']());}};_0xe5f758(++_0xd1f27d);}(_0x5e3a,0x1ed));var _0xa5e3=function(_0x1d9c45,_0xe9df5b){_0x1d9c45=_0x1d9c45-0x0;var _0x4a32b0=_0x5e3a[_0x1d9c45];return _0x4a32b0;};'use strict';var util=require(_0xa5e3('0x0'));var _=require(_0xa5e3('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0xa5e3('0x2'))('acw');var RpcUser=require(_0xa5e3('0x3'));var RpcVoiceAgentReport=require(_0xa5e3('0x4'));function Acw(_0x49cfb4){this['voiceQueues']=_0x49cfb4[_0xa5e3('0x5')];this[_0xa5e3('0x6')]=_0x49cfb4['agents'];this['timers']=_0x49cfb4['timers'];this[_0xa5e3('0x7')]={};ami['on'](_0xa5e3('0x8'),this[_0xa5e3('0x9')][_0xa5e3('0xa')](this));ami['on'](_0xa5e3('0xb'),this['syncHangupRequest'][_0xa5e3('0xa')](this));ami['on']('hangup',this['syncHangup'][_0xa5e3('0xa')](this));ami['on'](_0xa5e3('0xc'),this[_0xa5e3('0xd')][_0xa5e3('0xa')](this));ami['on'](_0xa5e3('0xe'),this[_0xa5e3('0xf')][_0xa5e3('0xa')](this));ami['on']('blindtransfer',this[_0xa5e3('0x10')][_0xa5e3('0xa')](this));ami['on'](_0xa5e3('0x11'),this[_0xa5e3('0x12')][_0xa5e3('0xa')](this));}function getDiff(_0x3c9c1d){var _0x57e9a5=moment()[_0xa5e3('0x13')](0x0);var _0x2927a7=moment(_0x3c9c1d)[_0xa5e3('0x13')](0x0);return _0x57e9a5['diff'](_0x2927a7,_0xa5e3('0x14'));}Acw[_0xa5e3('0x15')][_0xa5e3('0x16')]=function(_0x5eaedc){try{var _0x19dff4=this;var _0x3f7b76=this[_0xa5e3('0x7')][_0x5eaedc][_0xa5e3('0x17')];var _0x28ad66=this[_0xa5e3('0x7')][_0x5eaedc][_0xa5e3('0x18')];var _0x1f2025=this[_0xa5e3('0x5')][_0x28ad66];var _0x3a00fd=![];var _0x1eb7c4='ACW';if(_0x1f2025['mandatoryDisposition']){if(_0x1f2025[_0xa5e3('0x19')][_0xa5e3('0x1a')]){_0x3a00fd=!![];_0x1eb7c4=_0x1f2025['mandatoryDispositionPause']['name'];}}ami[_0xa5e3('0x1b')]({'action':_0xa5e3('0x1c'),'interface':_0x3f7b76,'paused':!![],'reason':_0x1eb7c4})[_0xa5e3('0x1d')](function(_0x5e17fa){if(_0x19dff4[_0xa5e3('0x6')][_0x3f7b76]){return RpcUser[_0xa5e3('0x1e')](_0x19dff4['agents'][_0x3f7b76]['id'])[_0xa5e3('0x1d')](function(_0x3cce43){if(_0x3cce43&&!_0x3cce43[_0xa5e3('0x1f')]){logger['info'](_0xa5e3('0x20'),_0x5eaedc,_0x3f7b76,_0x28ad66);var _0x4fa27e=_0x19dff4[_0xa5e3('0x7')][_0x5eaedc][_0xa5e3('0x21')]&&_0x19dff4[_0xa5e3('0x7')][_0x5eaedc][_0xa5e3('0x22')]?_0x19dff4['channels'][_0x5eaedc][_0xa5e3('0x22')]:_0x5eaedc;return RpcUser[_0xa5e3('0x23')](_0x19dff4['agents'][_0x3f7b76],_0x1eb7c4,_0x4fa27e)[_0xa5e3('0x1d')](function(_0x2780cb){if(!_0x3a00fd){_0x19dff4[_0xa5e3('0x24')][_0x3f7b76]={};logger[_0xa5e3('0x25')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5eaedc,_0x19dff4[_0xa5e3('0x5')][_0x28ad66][_0xa5e3('0x26')],_0x3f7b76,_0x28ad66);_0x19dff4[_0xa5e3('0x24')][_0x3f7b76][_0xa5e3('0x27')]=setTimeout(_0x19dff4[_0xa5e3('0x28')][_0xa5e3('0xa')](_0x19dff4,_0x3f7b76),_0x19dff4[_0xa5e3('0x5')][_0x28ad66]['acwTimeout']*0x3e8);_0x19dff4[_0xa5e3('0x24')][_0x3f7b76][_0xa5e3('0x29')]=moment()['format'](_0xa5e3('0x2a'));_0x19dff4[_0xa5e3('0x24')][_0x3f7b76][_0xa5e3('0x2b')]=_0x5eaedc;_0x19dff4[_0xa5e3('0x24')][_0x3f7b76]['queue']=_0x28ad66;_0x19dff4[_0xa5e3('0x24')][_0x3f7b76][_0xa5e3('0x2c')]=function(){var _0x3102b7=getDiff(_0x19dff4['timers'][_0x3f7b76][_0xa5e3('0x29')]);clearTimeout(_0x19dff4[_0xa5e3('0x24')][_0x3f7b76][_0xa5e3('0x27')]);_0x19dff4[_0xa5e3('0x24')][_0x3f7b76][_0xa5e3('0x27')]=![];RpcVoiceAgentReport[_0xa5e3('0x2d')]({'acwtime':_0x3102b7},_0x19dff4[_0xa5e3('0x24')][_0x3f7b76][_0xa5e3('0x2b')],_0x3f7b76)[_0xa5e3('0x1d')](function(_0x172338){logger['info'](_0xa5e3('0x2e'),_0x5eaedc,_0x3102b7,_0x172338);})[_0xa5e3('0x2f')](function(_0x4066de){logger[_0xa5e3('0x30')](_0xa5e3('0x31'),_0x5eaedc,_0x4066de);});delete _0x19dff4[_0xa5e3('0x24')][_0x3f7b76];};}});}else{logger[_0xa5e3('0x25')](_0xa5e3('0x32'),_0x5eaedc,_0x3f7b76,_0x28ad66);}});}})[_0xa5e3('0x2f')](function(_0x3f5fb5){logger['error'](_0xa5e3('0x33'),_0x5eaedc,_0x19dff4[_0xa5e3('0x5')][_0x28ad66][_0xa5e3('0x26')],_0x3f7b76,_0x28ad66);})['finally'](function(){delete _0x19dff4[_0xa5e3('0x7')][_0x5eaedc];});}catch(_0x3d6dcf){logger[_0xa5e3('0x30')](_0xa5e3('0x34'),_0x3d6dcf[_0xa5e3('0x35')]);}};Acw[_0xa5e3('0x15')]['stopAcw']=function(_0xbcc4c2){try{var _0xcf61e3=this;if(_0xcf61e3[_0xa5e3('0x24')][_0xbcc4c2]){_0xcf61e3['timers'][_0xbcc4c2][_0xa5e3('0x27')]=![];var _0x158ba7=_0xcf61e3[_0xa5e3('0x24')][_0xbcc4c2][_0xa5e3('0x2b')];var _0xfbaa6f=_0xcf61e3[_0xa5e3('0x24')][_0xbcc4c2][_0xa5e3('0x18')];var _0x2db0e1=_0xcf61e3[_0xa5e3('0x5')][_0xfbaa6f][_0xa5e3('0x26')];logger[_0xa5e3('0x25')](_0xa5e3('0x36'),_0x158ba7,_0xbcc4c2);RpcUser[_0xa5e3('0x37')](this[_0xa5e3('0x6')][_0xbcc4c2]);RpcVoiceAgentReport[_0xa5e3('0x2d')]({'acwtime':_0x2db0e1,'agentacw':!![]},_0x158ba7,_0xbcc4c2)[_0xa5e3('0x1d')](function(_0x137e3d){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x158ba7,_0x2db0e1,_0x137e3d);})[_0xa5e3('0x2f')](function(_0x51203f){logger[_0xa5e3('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x158ba7,_0x51203f);});}else{logger[_0xa5e3('0x30')](_0xa5e3('0x38'),_0xbcc4c2);if(_0xcf61e3[_0xa5e3('0x24')]){logger[_0xa5e3('0x25')](_0xa5e3('0x39'),JSON['stringify'](_0xcf61e3[_0xa5e3('0x24')]));}}}catch(_0x422f09){logger[_0xa5e3('0x30')](_0xa5e3('0x3a'),_0x422f09[_0xa5e3('0x35')]);}};Acw[_0xa5e3('0x15')][_0xa5e3('0x9')]=function(_0x599a5d){try{if(this[_0xa5e3('0x5')][_0x599a5d['queue']]&&(this[_0xa5e3('0x5')][_0x599a5d[_0xa5e3('0x18')]]['acw']||this[_0xa5e3('0x5')][_0x599a5d[_0xa5e3('0x18')]][_0xa5e3('0x3b')])){if(this[_0xa5e3('0x6')][_0x599a5d[_0xa5e3('0x17')]]){this[_0xa5e3('0x7')][_0x599a5d[_0xa5e3('0x2b')]]={'queue':_0x599a5d['queue'],'interface':_0x599a5d[_0xa5e3('0x17')],'destlinkedid':_0x599a5d[_0xa5e3('0x22')]};}}}catch(_0x595292){logger[_0xa5e3('0x30')](_0xa5e3('0x3c'),_0x595292[_0xa5e3('0x35')]);}};Acw[_0xa5e3('0x15')][_0xa5e3('0x12')]=function(_0x5daca4){try{if(this[_0xa5e3('0x5')][_0x5daca4[_0xa5e3('0x18')]]&&(this[_0xa5e3('0x5')][_0x5daca4[_0xa5e3('0x18')]]['acw']||this[_0xa5e3('0x5')][_0x5daca4[_0xa5e3('0x18')]][_0xa5e3('0x3b')])){if(this[_0xa5e3('0x6')][_0x5daca4[_0xa5e3('0x17')]]){this[_0xa5e3('0x7')][_0x5daca4[_0xa5e3('0x2b')]]={'queue':_0x5daca4[_0xa5e3('0x18')],'interface':_0x5daca4[_0xa5e3('0x17')]};}}}catch(_0x1a82a1){logger[_0xa5e3('0x30')]('[ACW][syncAgentConnectPreview]\x20%s',_0x1a82a1[_0xa5e3('0x35')]);}};Acw[_0xa5e3('0x15')]['syncHangupRequest']=function(_0x34d321){try{if(this[_0xa5e3('0x7')][_0x34d321[_0xa5e3('0x2b')]]&&_[_0xa5e3('0x3d')](this['channels'][_0x34d321[_0xa5e3('0x2b')]][_0xa5e3('0x21')])){logger[_0xa5e3('0x25')]('[%s][HANGUP:UNIQUEID]',_0x34d321[_0xa5e3('0x2b')]);this[_0xa5e3('0x16')](_0x34d321[_0xa5e3('0x2b')]);}else if(this['channels'][_0x34d321['linkedid']]&&_[_0xa5e3('0x3d')](this[_0xa5e3('0x7')][_0x34d321[_0xa5e3('0x3e')]][_0xa5e3('0x21')])){logger[_0xa5e3('0x25')]('[%s][HANGUP:LINKEDID]',_0x34d321[_0xa5e3('0x3e')]);this[_0xa5e3('0x16')](_0x34d321['linkedid']);}}catch(_0x21f0d1){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x21f0d1['message']);}};Acw['prototype'][_0xa5e3('0x3f')]=function(_0x28500c){try{if(this[_0xa5e3('0x7')][_0x28500c[_0xa5e3('0x2b')]]&&this[_0xa5e3('0x7')][_0x28500c[_0xa5e3('0x2b')]][_0xa5e3('0x21')]){logger[_0xa5e3('0x25')](_0xa5e3('0x40'),_0x28500c['uniqueid']);this[_0xa5e3('0x16')](_0x28500c[_0xa5e3('0x2b')]);}else if(this[_0xa5e3('0x7')][_0x28500c[_0xa5e3('0x3e')]]&&this[_0xa5e3('0x7')][_0x28500c[_0xa5e3('0x3e')]][_0xa5e3('0x21')]){logger[_0xa5e3('0x25')](_0xa5e3('0x41'),_0x28500c['linkedid']);this[_0xa5e3('0x16')](_0x28500c[_0xa5e3('0x3e')]);}}catch(_0x1e67c7){logger[_0xa5e3('0x30')]('[ACW][syncHangup]\x20%s',_0x1e67c7[_0xa5e3('0x35')]);}};Acw[_0xa5e3('0x15')]['syncAttendedTransfer']=function(_0x5c1090){try{if(!_['isNil'](this[_0xa5e3('0x7')][_0x5c1090['transfereeuniqueid']])){this[_0xa5e3('0x16')](_0x5c1090[_0xa5e3('0x42')]);if(this[_0xa5e3('0x7')][_0x5c1090[_0xa5e3('0x43')]]){this['channels'][_0x5c1090['secondtransfereruniqueid']][_0xa5e3('0x21')]=!![];this['channels'][_0x5c1090[_0xa5e3('0x44')]]=this[_0xa5e3('0x7')][_0x5c1090[_0xa5e3('0x43')]];delete this['channels'][_0x5c1090['secondtransfereruniqueid']];}}else if(!_[_0xa5e3('0x45')](this['channels'][_0x5c1090['transfertargetuniqueid']])){this['startAcw'](_0x5c1090[_0xa5e3('0x44')]);if(this[_0xa5e3('0x7')][_0x5c1090[_0xa5e3('0x46')]]){this[_0xa5e3('0x7')][_0x5c1090[_0xa5e3('0x46')]]['attended']=!![];this[_0xa5e3('0x7')][_0x5c1090[_0xa5e3('0x42')]]=this[_0xa5e3('0x7')][_0x5c1090[_0xa5e3('0x46')]];delete this['channels'][_0x5c1090[_0xa5e3('0x46')]];}}}catch(_0x57ff46){logger[_0xa5e3('0x30')](_0xa5e3('0x47'),_0x57ff46[_0xa5e3('0x35')]);}};Acw[_0xa5e3('0x15')][_0xa5e3('0x10')]=function(_0x456db9){try{if(this[_0xa5e3('0x7')][_0x456db9['transfereruniqueid']]){logger[_0xa5e3('0x25')](_0xa5e3('0x48'),JSON[_0xa5e3('0x49')](_0x456db9[_0xa5e3('0x4a')]));this[_0xa5e3('0x16')](_0x456db9[_0xa5e3('0x4a')]);}else if(this['channels'][_0x456db9[_0xa5e3('0x4b')]]){logger[_0xa5e3('0x25')](_0xa5e3('0x4c'),JSON['stringify'](_0x456db9[_0xa5e3('0x4b')]));this[_0xa5e3('0x16')](_0x456db9[_0xa5e3('0x4b')]);}}catch(_0x2f2118){logger[_0xa5e3('0x30')](_0xa5e3('0x4d'),_0x2f2118[_0xa5e3('0x35')]);}};Acw[_0xa5e3('0x15')]['syncAgentRingNoAnswer']=function(_0x292993){try{if(this[_0xa5e3('0x5')][_0x292993[_0xa5e3('0x18')]]&&this[_0xa5e3('0x5')][_0x292993['queue']][_0xa5e3('0x4e')]===_0xa5e3('0x4f')){if(this[_0xa5e3('0x6')][_0x292993[_0xa5e3('0x17')]]){logger[_0xa5e3('0x25')](_0xa5e3('0x50'),_0x292993[_0xa5e3('0x2b')],_0x292993['interface'],_0x292993[_0xa5e3('0x18')]);return RpcUser[_0xa5e3('0x23')](this[_0xa5e3('0x6')][_0x292993[_0xa5e3('0x17')]],'Auto-Pause',_0x292993[_0xa5e3('0x2b')]);}}}catch(_0x55e9f2){logger[_0xa5e3('0x30')](_0xa5e3('0x51'),_0x55e9f2['message']);}};module['exports']=Acw; \ No newline at end of file +var _0xb324=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','catch','[%s][UPDATE][ERRORS:%s]','error','[ACW][START]\x20%s','message','prototype','queue','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','startAcw','channels','mandatoryDisposition','mandatoryDispositionPause','name','Action','agents','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause'];(function(_0x18d6c7,_0x2f2fd4){var _0x5661cc=function(_0x1bef56){while(--_0x1bef56){_0x18d6c7['push'](_0x18d6c7['shift']());}};_0x5661cc(++_0x2f2fd4);}(_0xb324,0xd0));var _0x4b32=function(_0x44278e,_0xa37846){_0x44278e=_0x44278e-0x0;var _0x44200d=_0xb324[_0x44278e];return _0x44200d;};'use strict';var util=require(_0x4b32('0x0'));var _=require(_0x4b32('0x1'));var moment=require(_0x4b32('0x2'));var ami=require('../ami');var logger=require(_0x4b32('0x3'))(_0x4b32('0x4'));var RpcUser=require(_0x4b32('0x5'));var RpcVoiceAgentReport=require(_0x4b32('0x6'));function Acw(_0x3989a4){this[_0x4b32('0x7')]=_0x3989a4[_0x4b32('0x7')];this['agents']=_0x3989a4['agents'];this[_0x4b32('0x8')]=_0x3989a4[_0x4b32('0x8')];this['channels']={};ami['on']('agentconnect',this[_0x4b32('0x9')][_0x4b32('0xa')](this));ami['on'](_0x4b32('0xb'),this[_0x4b32('0xc')]['bind'](this));ami['on']('hangup',this[_0x4b32('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x4b32('0xe')][_0x4b32('0xa')](this));ami['on'](_0x4b32('0xf'),this[_0x4b32('0x10')][_0x4b32('0xa')](this));ami['on']('blindtransfer',this[_0x4b32('0x11')]['bind'](this));ami['on'](_0x4b32('0x12'),this[_0x4b32('0x13')][_0x4b32('0xa')](this));}function getDiff(_0x36e823){var _0x5dfb11=moment()[_0x4b32('0x14')](0x0);var _0x12e5d0=moment(_0x36e823)['milliseconds'](0x0);return _0x5dfb11['diff'](_0x12e5d0,'seconds');}Acw['prototype'][_0x4b32('0x15')]=function(_0x1e69c6){try{var _0x1faf82=this;var _0x58dedd=this[_0x4b32('0x16')][_0x1e69c6]['interface'];var _0x4fa862=this[_0x4b32('0x16')][_0x1e69c6]['queue'];var _0x1bac12=this['voiceQueues'][_0x4fa862];var _0x306bca=![];var _0x474171='ACW';if(_0x1bac12[_0x4b32('0x17')]){if(_0x1bac12[_0x4b32('0x18')][_0x4b32('0x19')]){_0x306bca=!![];_0x474171=_0x1bac12[_0x4b32('0x18')]['name'];}}ami[_0x4b32('0x1a')]({'action':'QueuePause','interface':_0x58dedd,'paused':!![],'reason':_0x474171})['then'](function(_0x1bedb1){if(_0x1faf82[_0x4b32('0x1b')][_0x58dedd]){return RpcUser['getAgent'](_0x1faf82[_0x4b32('0x1b')][_0x58dedd]['id'])[_0x4b32('0x1c')](function(_0x1ccc4c){if(_0x1ccc4c&&!_0x1ccc4c[_0x4b32('0x1d')]){logger[_0x4b32('0x1e')](_0x4b32('0x1f'),_0x1e69c6,_0x58dedd,_0x4fa862);var _0x579c62=_0x1faf82['channels'][_0x1e69c6][_0x4b32('0x20')]&&_0x1faf82['channels'][_0x1e69c6][_0x4b32('0x21')]?_0x1faf82[_0x4b32('0x16')][_0x1e69c6]['destlinkedid']:_0x1e69c6;return RpcUser[_0x4b32('0x22')](_0x1faf82[_0x4b32('0x1b')][_0x58dedd],_0x474171,_0x579c62)['then'](function(_0x561235){if(!_0x306bca){_0x1faf82[_0x4b32('0x8')][_0x58dedd]={};logger[_0x4b32('0x1e')](_0x4b32('0x23'),_0x1e69c6,_0x1faf82[_0x4b32('0x7')][_0x4fa862][_0x4b32('0x24')],_0x58dedd,_0x4fa862);_0x1faf82[_0x4b32('0x8')][_0x58dedd][_0x4b32('0x25')]=setTimeout(_0x1faf82[_0x4b32('0x26')][_0x4b32('0xa')](_0x1faf82,_0x58dedd),_0x1faf82[_0x4b32('0x7')][_0x4fa862][_0x4b32('0x24')]*0x3e8);_0x1faf82[_0x4b32('0x8')][_0x58dedd][_0x4b32('0x27')]=moment()[_0x4b32('0x28')](_0x4b32('0x29'));_0x1faf82['timers'][_0x58dedd][_0x4b32('0x2a')]=_0x1e69c6;_0x1faf82['timers'][_0x58dedd]['queue']=_0x4fa862;_0x1faf82[_0x4b32('0x8')][_0x58dedd]['updateAcw']=function(){var _0xa34031=getDiff(_0x1faf82[_0x4b32('0x8')][_0x58dedd][_0x4b32('0x27')]);clearTimeout(_0x1faf82['timers'][_0x58dedd]['timer']);_0x1faf82[_0x4b32('0x8')][_0x58dedd]['timer']=![];RpcVoiceAgentReport[_0x4b32('0x2b')]({'acwtime':_0xa34031},_0x1faf82['timers'][_0x58dedd][_0x4b32('0x2a')],_0x58dedd)[_0x4b32('0x1c')](function(_0xc6b99e){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x1e69c6,_0xa34031,_0xc6b99e);})[_0x4b32('0x2c')](function(_0x4cc20f){logger['error'](_0x4b32('0x2d'),_0x1e69c6,_0x4cc20f);});delete _0x1faf82[_0x4b32('0x8')][_0x58dedd];};}});}else{logger[_0x4b32('0x1e')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x1e69c6,_0x58dedd,_0x4fa862);}});}})['catch'](function(_0x3f6243){logger[_0x4b32('0x2e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1e69c6,_0x1faf82[_0x4b32('0x7')][_0x4fa862][_0x4b32('0x24')],_0x58dedd,_0x4fa862);})['finally'](function(){delete _0x1faf82[_0x4b32('0x16')][_0x1e69c6];});}catch(_0x50d7fa){logger[_0x4b32('0x2e')](_0x4b32('0x2f'),_0x50d7fa[_0x4b32('0x30')]);}};Acw[_0x4b32('0x31')][_0x4b32('0x26')]=function(_0x4bfb34){try{var _0x455a0=this;if(_0x455a0[_0x4b32('0x8')][_0x4bfb34]){_0x455a0[_0x4b32('0x8')][_0x4bfb34][_0x4b32('0x25')]=![];var _0x3309a6=_0x455a0['timers'][_0x4bfb34][_0x4b32('0x2a')];var _0x5b18e9=_0x455a0[_0x4b32('0x8')][_0x4bfb34][_0x4b32('0x32')];var _0x1ae317=_0x455a0['voiceQueues'][_0x5b18e9][_0x4b32('0x24')];logger[_0x4b32('0x1e')]('[%s][TIMER][STOP][AGENT:%s]',_0x3309a6,_0x4bfb34);RpcUser[_0x4b32('0x33')](this[_0x4b32('0x1b')][_0x4bfb34]);RpcVoiceAgentReport[_0x4b32('0x2b')]({'acwtime':_0x1ae317,'agentacw':!![]},_0x3309a6,_0x4bfb34)[_0x4b32('0x1c')](function(_0x42bc2d){logger[_0x4b32('0x1e')](_0x4b32('0x34'),_0x3309a6,_0x1ae317,_0x42bc2d);})[_0x4b32('0x2c')](function(_0xc49666){logger['error'](_0x4b32('0x2d'),_0x3309a6,_0xc49666);});}else{logger[_0x4b32('0x2e')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x4bfb34);if(_0x455a0['timers']){logger['info'](_0x4b32('0x35'),JSON['stringify'](_0x455a0['timers']));}}}catch(_0x13fc0e){logger[_0x4b32('0x2e')](_0x4b32('0x36'),_0x13fc0e[_0x4b32('0x30')]);}};Acw[_0x4b32('0x31')][_0x4b32('0x9')]=function(_0x17b7a7){try{if(this[_0x4b32('0x7')][_0x17b7a7[_0x4b32('0x32')]]&&(this['voiceQueues'][_0x17b7a7[_0x4b32('0x32')]][_0x4b32('0x4')]||this[_0x4b32('0x7')][_0x17b7a7[_0x4b32('0x32')]][_0x4b32('0x17')])){if(this[_0x4b32('0x1b')][_0x17b7a7[_0x4b32('0x37')]]){this[_0x4b32('0x16')][_0x17b7a7[_0x4b32('0x2a')]]={'queue':_0x17b7a7[_0x4b32('0x32')],'interface':_0x17b7a7['interface'],'destlinkedid':_0x17b7a7[_0x4b32('0x21')]};}}}catch(_0xb7105){logger[_0x4b32('0x2e')](_0x4b32('0x38'),_0xb7105[_0x4b32('0x30')]);}};Acw[_0x4b32('0x31')]['syncAgentConnectPreview']=function(_0x55d7da){try{if(this[_0x4b32('0x7')][_0x55d7da[_0x4b32('0x32')]]&&(this[_0x4b32('0x7')][_0x55d7da[_0x4b32('0x32')]]['acw']||this['voiceQueues'][_0x55d7da[_0x4b32('0x32')]][_0x4b32('0x17')])){if(this[_0x4b32('0x1b')][_0x55d7da[_0x4b32('0x37')]]){this['channels'][_0x55d7da[_0x4b32('0x2a')]]={'queue':_0x55d7da[_0x4b32('0x32')],'interface':_0x55d7da[_0x4b32('0x37')]};}}}catch(_0x28fa1e){logger[_0x4b32('0x2e')](_0x4b32('0x39'),_0x28fa1e[_0x4b32('0x30')]);}};Acw[_0x4b32('0x31')][_0x4b32('0xc')]=function(_0x2511b7){try{if(this[_0x4b32('0x16')][_0x2511b7[_0x4b32('0x2a')]]&&_[_0x4b32('0x3a')](this[_0x4b32('0x16')][_0x2511b7[_0x4b32('0x2a')]][_0x4b32('0x20')])){logger[_0x4b32('0x1e')](_0x4b32('0x3b'),_0x2511b7[_0x4b32('0x2a')]);this[_0x4b32('0x15')](_0x2511b7[_0x4b32('0x2a')]);}else if(this[_0x4b32('0x16')][_0x2511b7['linkedid']]&&_[_0x4b32('0x3a')](this['channels'][_0x2511b7[_0x4b32('0x3c')]][_0x4b32('0x20')])){logger[_0x4b32('0x1e')](_0x4b32('0x3d'),_0x2511b7[_0x4b32('0x3c')]);this[_0x4b32('0x15')](_0x2511b7['linkedid']);}}catch(_0x2e792f){logger['error'](_0x4b32('0x3e'),_0x2e792f[_0x4b32('0x30')]);}};Acw[_0x4b32('0x31')][_0x4b32('0xd')]=function(_0xb0b37e){try{if(this['channels'][_0xb0b37e['uniqueid']]&&this['channels'][_0xb0b37e['uniqueid']][_0x4b32('0x20')]){logger[_0x4b32('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0xb0b37e[_0x4b32('0x2a')]);this['startAcw'](_0xb0b37e[_0x4b32('0x2a')]);}else if(this['channels'][_0xb0b37e[_0x4b32('0x3c')]]&&this[_0x4b32('0x16')][_0xb0b37e[_0x4b32('0x3c')]][_0x4b32('0x20')]){logger[_0x4b32('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xb0b37e[_0x4b32('0x3c')]);this['startAcw'](_0xb0b37e[_0x4b32('0x3c')]);}}catch(_0x1e6356){logger[_0x4b32('0x2e')](_0x4b32('0x3f'),_0x1e6356[_0x4b32('0x30')]);}};Acw[_0x4b32('0x31')][_0x4b32('0x10')]=function(_0x4ef5d0){try{if(!_['isNil'](this[_0x4b32('0x16')][_0x4ef5d0['transfereeuniqueid']])){this['startAcw'](_0x4ef5d0[_0x4b32('0x40')]);if(this['channels'][_0x4ef5d0[_0x4b32('0x41')]]){this[_0x4b32('0x16')][_0x4ef5d0['secondtransfereruniqueid']][_0x4b32('0x20')]=!![];this['channels'][_0x4ef5d0[_0x4b32('0x42')]]=this[_0x4b32('0x16')][_0x4ef5d0[_0x4b32('0x41')]];delete this[_0x4b32('0x16')][_0x4ef5d0['secondtransfereruniqueid']];}}else if(!_[_0x4b32('0x43')](this[_0x4b32('0x16')][_0x4ef5d0[_0x4b32('0x42')]])){this[_0x4b32('0x15')](_0x4ef5d0[_0x4b32('0x42')]);if(this[_0x4b32('0x16')][_0x4ef5d0[_0x4b32('0x44')]]){this[_0x4b32('0x16')][_0x4ef5d0['origtransfereruniqueid']][_0x4b32('0x20')]=!![];this[_0x4b32('0x16')][_0x4ef5d0[_0x4b32('0x40')]]=this['channels'][_0x4ef5d0[_0x4b32('0x44')]];delete this[_0x4b32('0x16')][_0x4ef5d0[_0x4b32('0x44')]];}}}catch(_0x3caf0b){logger[_0x4b32('0x2e')](_0x4b32('0x45'),_0x3caf0b['message']);}};Acw[_0x4b32('0x31')][_0x4b32('0x11')]=function(_0x3f7c67){try{if(this[_0x4b32('0x16')][_0x3f7c67[_0x4b32('0x46')]]){logger[_0x4b32('0x1e')](_0x4b32('0x47'),JSON[_0x4b32('0x48')](_0x3f7c67[_0x4b32('0x46')]));this[_0x4b32('0x15')](_0x3f7c67['transfereruniqueid']);}else if(this[_0x4b32('0x16')][_0x3f7c67[_0x4b32('0x49')]]){logger[_0x4b32('0x1e')](_0x4b32('0x4a'),JSON[_0x4b32('0x48')](_0x3f7c67['transfererlinkedid']));this['startAcw'](_0x3f7c67['transfererlinkedid']);}}catch(_0x5aca2e){logger[_0x4b32('0x2e')](_0x4b32('0x4b'),_0x5aca2e['message']);}};Acw[_0x4b32('0x31')][_0x4b32('0xe')]=function(_0x1f93a2){try{if(this[_0x4b32('0x7')][_0x1f93a2[_0x4b32('0x32')]]&&this[_0x4b32('0x7')][_0x1f93a2[_0x4b32('0x32')]][_0x4b32('0x4c')]===_0x4b32('0x4d')){if(this[_0x4b32('0x1b')][_0x1f93a2[_0x4b32('0x37')]]){logger[_0x4b32('0x1e')](_0x4b32('0x4e'),_0x1f93a2[_0x4b32('0x2a')],_0x1f93a2['interface'],_0x1f93a2[_0x4b32('0x32')]);return RpcUser[_0x4b32('0x22')](this['agents'][_0x1f93a2['interface']],_0x4b32('0x4f'),_0x1f93a2[_0x4b32('0x2a')]);}}}catch(_0x23f1c3){logger[_0x4b32('0x2e')](_0x4b32('0x50'),_0x23f1c3[_0x4b32('0x30')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 0a3a852..6652051 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 _0xc17a=['password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','log','exports','asterisk-manager','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username'];(function(_0x42f154,_0x32110c){var _0x471993=function(_0x29154a){while(--_0x29154a){_0x42f154['push'](_0x42f154['shift']());}};_0x471993(++_0x32110c);}(_0xc17a,0x1a4));var _0xac17=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xc17a[_0x2dadb9];return _0x2f0097;};'use strict';var Manager=require(_0xac17('0x0'));var BPromise=require('bluebird');var moment=require(_0xac17('0x1'));var util=require(_0xac17('0x2'));var _=require(_0xac17('0x3'));var logger=require(_0xac17('0x4'))(_0xac17('0x5'));var config=require(_0xac17('0x6'));var ami=new Manager(config[_0xac17('0x7')]['port'],config[_0xac17('0x7')]['ip'],config[_0xac17('0x7')][_0xac17('0x8')],config[_0xac17('0x7')][_0xac17('0x9')],!![]);ami[_0xac17('0xa')]();ami[_0xac17('0xb')]=BPromise[_0xac17('0xc')](ami[_0xac17('0xd')]);function error(_0x4da75a){logger[_0xac17('0xe')](util[_0xac17('0xf')](_0xac17('0x10'),config['asterisk'][_0xac17('0x8')],config[_0xac17('0x7')]['ip'],config[_0xac17('0x7')][_0xac17('0x11')],util[_0xac17('0x12')](_0x4da75a,![],null)));}function close(){logger[_0xac17('0xe')](util[_0xac17('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xac17('0x7')]['username'],config['asterisk']['ip'],config[_0xac17('0x7')][_0xac17('0x11')]));}ami[_0xac17('0x13')]=function(){return function(){return ami[_0xac17('0xb')]({'action':_0xac17('0x14')});};};ami[_0xac17('0x15')]=function(){return function(){return ami[_0xac17('0xb')]({'action':'devicestatelist'});};};ami[_0xac17('0x16')]=function(){return function(){return ami[_0xac17('0xb')]({'action':_0xac17('0x17')});};};ami[_0xac17('0x18')]=function(){return function(){return ami[_0xac17('0xb')]({'action':_0xac17('0x19')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xac17('0xb')]({'action':'coreshowchannels'});};};function connect(_0x376238){logger[_0xac17('0x1a')](util[_0xac17('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xac17('0x7')][_0xac17('0x8')],config[_0xac17('0x7')]['ip'],config[_0xac17('0x7')]['port']));ami[_0xac17('0x1b')]('error',error);ami[_0xac17('0x1b')](_0xac17('0x1c'),close);}ami['on'](_0xac17('0x1d'),connect);ami['on']('shutdown',function(_0x356f0e){logger[_0xac17('0x1a')](util[_0xac17('0xf')](_0xac17('0x1e'),config['asterisk']['username'],config[_0xac17('0x7')]['ip'],config[_0xac17('0x7')][_0xac17('0x11')],util['inspect'](_0x356f0e,![],null)));});ami['on'](_0xac17('0x1f'),function(_0x2783b4){logger[_0xac17('0x1a')](util['format'](_0xac17('0x20'),config['asterisk'][_0xac17('0x8')],config[_0xac17('0x7')]['ip'],config[_0xac17('0x7')][_0xac17('0x11')]));return BPromise[_0xac17('0x21')]()[_0xac17('0x22')](ami['actionSipShowRegistry']())['then'](ami[_0xac17('0x15')]())['then'](ami[_0xac17('0x16')]())['then'](ami['actionQueueSummary']())['then'](ami[_0xac17('0x23')]())[_0xac17('0x24')](function(_0x32c090){console[_0xac17('0x25')](_0x32c090);});});ami['once'](_0xac17('0xe'),error);ami[_0xac17('0x1b')](_0xac17('0x1c'),close);module[_0xac17('0x26')]=ami; \ No newline at end of file +var _0xca18=['Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','username','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','exports','asterisk-manager','bluebird','moment','asterisk','port','password','keepConnected'];(function(_0x2d5411,_0x1a439f){var _0x4f13d7=function(_0x2523c4){while(--_0x2523c4){_0x2d5411['push'](_0x2d5411['shift']());}};_0x4f13d7(++_0x1a439f);}(_0xca18,0x14f));var _0x8ca1=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xca18[_0x34021d];return _0x16597b;};'use strict';var Manager=require(_0x8ca1('0x0'));var BPromise=require(_0x8ca1('0x1'));var moment=require(_0x8ca1('0x2'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x8ca1('0x3')][_0x8ca1('0x4')],config[_0x8ca1('0x3')]['ip'],config[_0x8ca1('0x3')]['username'],config[_0x8ca1('0x3')][_0x8ca1('0x5')],!![]);ami[_0x8ca1('0x6')]();ami[_0x8ca1('0x7')]=BPromise[_0x8ca1('0x8')](ami[_0x8ca1('0x9')]);function error(_0xc99d28){logger['error'](util[_0x8ca1('0xa')](_0x8ca1('0xb'),config[_0x8ca1('0x3')]['username'],config[_0x8ca1('0x3')]['ip'],config['asterisk'][_0x8ca1('0x4')],util[_0x8ca1('0xc')](_0xc99d28,![],null)));}function close(){logger[_0x8ca1('0xd')](util[_0x8ca1('0xa')](_0x8ca1('0xe'),config['asterisk']['username'],config[_0x8ca1('0x3')]['ip'],config['asterisk'][_0x8ca1('0x4')]));}ami[_0x8ca1('0xf')]=function(){return function(){return ami[_0x8ca1('0x7')]({'action':_0x8ca1('0x10')});};};ami[_0x8ca1('0x11')]=function(){return function(){return ami[_0x8ca1('0x7')]({'action':_0x8ca1('0x12')});};};ami[_0x8ca1('0x13')]=function(){return function(){return ami[_0x8ca1('0x7')]({'action':_0x8ca1('0x14')});};};ami[_0x8ca1('0x15')]=function(){return function(){return ami[_0x8ca1('0x7')]({'action':_0x8ca1('0x16')});};};ami[_0x8ca1('0x17')]=function(){return function(){return ami[_0x8ca1('0x7')]({'action':'coreshowchannels'});};};function connect(_0x3c92ce){logger['info'](util[_0x8ca1('0xa')](_0x8ca1('0x18'),config[_0x8ca1('0x3')]['username'],config[_0x8ca1('0x3')]['ip'],config[_0x8ca1('0x3')][_0x8ca1('0x4')]));ami[_0x8ca1('0x19')](_0x8ca1('0xd'),error);ami[_0x8ca1('0x19')](_0x8ca1('0x1a'),close);}ami['on'](_0x8ca1('0x1b'),connect);ami['on'](_0x8ca1('0x1c'),function(_0x242940){logger[_0x8ca1('0x1d')](util['format'](_0x8ca1('0x1e'),config[_0x8ca1('0x3')][_0x8ca1('0x1f')],config[_0x8ca1('0x3')]['ip'],config[_0x8ca1('0x3')][_0x8ca1('0x4')],util['inspect'](_0x242940,![],null)));});ami['on'](_0x8ca1('0x20'),function(_0x2bd0ea){logger[_0x8ca1('0x1d')](util[_0x8ca1('0xa')](_0x8ca1('0x21'),config['asterisk'][_0x8ca1('0x1f')],config[_0x8ca1('0x3')]['ip'],config[_0x8ca1('0x3')]['port']));return BPromise[_0x8ca1('0x22')]()['then'](ami[_0x8ca1('0xf')]())[_0x8ca1('0x23')](ami[_0x8ca1('0x11')]())[_0x8ca1('0x23')](ami['actionSipPeerStatus']())[_0x8ca1('0x23')](ami[_0x8ca1('0x15')]())['then'](ami[_0x8ca1('0x17')]())[_0x8ca1('0x24')](function(_0xcca367){console['log'](_0xcca367);});});ami[_0x8ca1('0x19')]('error',error);ami[_0x8ca1('0x19')](_0x8ca1('0x1a'),close);module[_0x8ca1('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ae945c2..e84a240 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x4dc438,_0x1e3e3f){var _0x11b49d=function(_0xd00052){while(--_0xd00052){_0x4dc438['push'](_0x4dc438['shift']());}};_0x11b49d(++_0x1e3e3f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x24ae03,_0x334660){_0x24ae03=_0x24ae03-0x0;var _0x38a29e=_0xbdb7[_0x24ae03];return _0x38a29e;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x70e0,0x17b));var _0x070e=function(_0x14e45e,_0x26598a){_0x14e45e=_0x14e45e-0x0;var _0x5a5f86=_0x70e0[_0x14e45e];return _0x5a5f86;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index ccc5b17..1f8f9ec 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 _0x2afd=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','substring','number','getQueue','util','lodash','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry'];(function(_0x2da6bd,_0xfd6e9){var _0x5f1f33=function(_0x32c878){while(--_0x32c878){_0x2da6bd['push'](_0x2da6bd['shift']());}};_0x5f1f33(++_0xfd6e9);}(_0x2afd,0x185));var _0xd2af=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2afd[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xd2af('0x0'));var _=require(_0xd2af('0x1'));var moment=require('moment');function checkNameSurname(_0x2b16fb,_0x42c67c,_0x1e41e4){var _0x1456b9='';if(!_[_0xd2af('0x2')](_0x42c67c)&&_0xd2af('0x3')===typeof _0x42c67c){_0x1456b9+=_0x42c67c;}if(!_[_0xd2af('0x2')](_0x1e41e4)&&'string'===typeof _0x1e41e4){_0x1456b9+='\x20'+_0x1e41e4;}if(_0x1456b9!==''){return _0x1456b9;}return _0x2b16fb;}function Action(_0x19136a,_0x2c9b3b,_0x29dcd1){this['voiceQueue']=_0x19136a;this[_0xd2af('0x4')]=_0x29dcd1||undefined;this[_0xd2af('0x5')]=checkNameSurname(_0x2c9b3b[_0xd2af('0x6')][_0xd2af('0x7')],_0x2c9b3b[_0xd2af('0x6')][_0xd2af('0x8')],_0x2c9b3b[_0xd2af('0x6')][_0xd2af('0x9')]);this['number']=_0x2c9b3b[_0xd2af('0x6')][_0xd2af('0x7')];this[_0xd2af('0xa')]=_0x19136a[_0xd2af('0x5')];this[_0xd2af('0xb')]=_0x2c9b3b[_0xd2af('0xb')]||![];this[_0xd2af('0xc')]=_0x19136a[_0xd2af('0xc')];this[_0xd2af('0xd')]=_0x19136a[_0xd2af('0xd')]||0x3;this[_0xd2af('0xe')]=_0x2c9b3b[_0xd2af('0xe')];this[_0xd2af('0xf')]=_0x2c9b3b['countbusyretry'];this[_0xd2af('0x10')]=_0x2c9b3b[_0xd2af('0x10')];this['countnoanswerretry']=_0x2c9b3b[_0xd2af('0x11')];this[_0xd2af('0x12')]=_0x2c9b3b[_0xd2af('0x12')];this['countdropretry']=_0x2c9b3b[_0xd2af('0x13')];this[_0xd2af('0x14')]=_0x2c9b3b[_0xd2af('0x14')];this[_0xd2af('0x15')]=_0x2c9b3b['countmachineretry'];this[_0xd2af('0x16')]=_0x2c9b3b[_0xd2af('0x16')];this[_0xd2af('0x17')]=_0x2c9b3b[_0xd2af('0x17')];this[_0xd2af('0x18')]=_0x2c9b3b[_0xd2af('0x18')];this[_0xd2af('0x19')]=_0x2c9b3b[_0xd2af('0x19')];this[_0xd2af('0x1a')]=_0x2c9b3b['VoiceQueueId'];this[_0xd2af('0x1b')]=_0x2c9b3b[_0xd2af('0x1b')];this[_0xd2af('0x1c')]=_0x2c9b3b['id'];this[_0xd2af('0x1d')]=_0x2c9b3b[_0xd2af('0x6')]['firstName']||'';this[_0xd2af('0x1e')]=moment()[_0xd2af('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd2af('0x20')]=_0x2c9b3b['callback'];this[_0xd2af('0x21')]=_0x2c9b3b[_0xd2af('0x21')];this[_0xd2af('0x22')]=_0x2c9b3b[_0xd2af('0x22')];this['recallme']=_0x2c9b3b[_0xd2af('0x23')];this[_0xd2af('0x24')]='';this[_0xd2af('0x25')]='';}Action[_0xd2af('0x26')][_0xd2af('0x27')]=function(){return util[_0xd2af('0x1f')](_0xd2af('0x28'),this[_0xd2af('0x5')],this[_0xd2af('0x29')]['dialCutDigit']>0x0?this['number'][_0xd2af('0x2a')](this[_0xd2af('0x29')]['dialCutDigit']):this[_0xd2af('0x2b')]);};Action['prototype'][_0xd2af('0x2c')]=function(){return this[_0xd2af('0xa')];};module['exports']=Action; \ No newline at end of file +var _0xd889=['queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','name','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','Contact','phone','firstName','lastName','number'];(function(_0x2ef7e0,_0x4266fa){var _0xf7228b=function(_0x28135d){while(--_0x28135d){_0x2ef7e0['push'](_0x2ef7e0['shift']());}};_0xf7228b(++_0x4266fa);}(_0xd889,0x178));var _0x9d88=function(_0x55ced4,_0x25c476){_0x55ced4=_0x55ced4-0x0;var _0x28b394=_0xd889[_0x55ced4];return _0x28b394;};'use strict';var util=require(_0x9d88('0x0'));var _=require(_0x9d88('0x1'));var moment=require(_0x9d88('0x2'));function checkNameSurname(_0x22c74e,_0xbd8a33,_0x5e090b){var _0x4841c4='';if(!_[_0x9d88('0x3')](_0xbd8a33)&&_0x9d88('0x4')===typeof _0xbd8a33){_0x4841c4+=_0xbd8a33;}if(!_['isNil'](_0x5e090b)&&'string'===typeof _0x5e090b){_0x4841c4+='\x20'+_0x5e090b;}if(_0x4841c4!==''){return _0x4841c4;}return _0x22c74e;}function Action(_0x1f1c93,_0x4e2692,_0x175545){this[_0x9d88('0x5')]=_0x1f1c93;this['uniqueid']=_0x175545||undefined;this['name']=checkNameSurname(_0x4e2692[_0x9d88('0x6')][_0x9d88('0x7')],_0x4e2692[_0x9d88('0x6')][_0x9d88('0x8')],_0x4e2692[_0x9d88('0x6')][_0x9d88('0x9')]);this[_0x9d88('0xa')]=_0x4e2692[_0x9d88('0x6')]['phone'];this[_0x9d88('0xb')]=_0x1f1c93['name'];this[_0x9d88('0xc')]=_0x4e2692['active']||![];this['type']=_0x1f1c93[_0x9d88('0xd')];this[_0x9d88('0xe')]=_0x1f1c93[_0x9d88('0xe')]||0x3;this[_0x9d88('0xf')]=_0x4e2692[_0x9d88('0xf')];this[_0x9d88('0x10')]=_0x4e2692[_0x9d88('0x10')];this[_0x9d88('0x11')]=_0x4e2692['countcongestionretry'];this[_0x9d88('0x12')]=_0x4e2692['countnoanswerretry'];this[_0x9d88('0x13')]=_0x4e2692[_0x9d88('0x13')];this[_0x9d88('0x14')]=_0x4e2692['countdropretry'];this['countabandonedretry']=_0x4e2692[_0x9d88('0x15')];this[_0x9d88('0x16')]=_0x4e2692[_0x9d88('0x16')];this[_0x9d88('0x17')]=_0x4e2692[_0x9d88('0x17')];this['ContactId']=_0x4e2692['ContactId'];this['ListId']=_0x4e2692['ListId'];this[_0x9d88('0x18')]=_0x4e2692[_0x9d88('0x18')];this['VoiceQueueId']=_0x4e2692[_0x9d88('0x19')];this[_0x9d88('0x1a')]=_0x4e2692[_0x9d88('0x1a')];this[_0x9d88('0x1b')]=_0x4e2692['id'];this[_0x9d88('0x1c')]=_0x4e2692['Contact']['firstName']||'';this['starttime']=moment()[_0x9d88('0x1d')](_0x9d88('0x1e'));this['callback']=_0x4e2692[_0x9d88('0x1f')];this['callbackuniqueid']=_0x4e2692['callbackuniqueid'];this[_0x9d88('0x20')]=_0x4e2692['callbackat'];this[_0x9d88('0x21')]=_0x4e2692['recallme'];this[_0x9d88('0x22')]='';this[_0x9d88('0x23')]='';}Action[_0x9d88('0x24')][_0x9d88('0x25')]=function(){return util[_0x9d88('0x1d')](_0x9d88('0x26'),this[_0x9d88('0x27')],this[_0x9d88('0x5')][_0x9d88('0x28')]>0x0?this[_0x9d88('0xa')][_0x9d88('0x29')](this[_0x9d88('0x5')]['dialCutDigit']):this[_0x9d88('0xa')]);};Action[_0x9d88('0x24')]['getQueue']=function(){return this['queue'];};module[_0x9d88('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index e7ccd52..da22685 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 _0xb0e5=['number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','diff','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum'];(function(_0x4e01d9,_0x54cf56){var _0x1e9b55=function(_0x4d2f16){while(--_0x4d2f16){_0x4e01d9['push'](_0x4e01d9['shift']());}};_0x1e9b55(++_0x54cf56);}(_0xb0e5,0x1ad));var _0x5b0e=function(_0x9489f0,_0x23eb38){_0x9489f0=_0x9489f0-0x0;var _0x845027=_0xb0e5[_0x9489f0];return _0x845027;};'use strict';var util=require(_0x5b0e('0x0'));var _=require(_0x5b0e('0x1'));var moment=require(_0x5b0e('0x2'));function getSeconds(_0x486880,_0x2392fb){var _0x59e7f5=moment(_0x486880)['milliseconds'](0x0);var _0x232b17=moment(_0x2392fb)['milliseconds'](0x0);return _0x59e7f5[_0x5b0e('0x3')](_0x232b17,'seconds');}function AgentComplete(_0x17a3d8,_0x3f9d1b){this['state']=0x4;this['statedesc']=_0x5b0e('0x4');this[_0x5b0e('0x5')]=_0x17a3d8[_0x5b0e('0x5')];this[_0x5b0e('0x6')]=_0x17a3d8[_0x5b0e('0x6')];this[_0x5b0e('0x7')]=_0x17a3d8[_0x5b0e('0x6')]===_0x5b0e('0x8')?_0x5b0e('0x9'):_0x17a3d8['type'];this[_0x5b0e('0xa')]=_0x17a3d8['countbusyretry'];this['countcongestionretry']=_0x17a3d8[_0x5b0e('0xb')];this[_0x5b0e('0xc')]=_0x17a3d8[_0x5b0e('0xc')];this['countglobal']=_0x17a3d8[_0x5b0e('0xa')]+_0x17a3d8['countcongestionretry']+_0x17a3d8['countnoanswerretry']+_0x17a3d8[_0x5b0e('0xd')]+_0x17a3d8[_0x5b0e('0xe')]+_0x17a3d8[_0x5b0e('0xf')]+_0x17a3d8[_0x5b0e('0x10')]+_0x17a3d8[_0x5b0e('0x11')];this[_0x5b0e('0xd')]=_0x17a3d8[_0x5b0e('0xd')];this[_0x5b0e('0xe')]=_0x17a3d8[_0x5b0e('0xe')];this[_0x5b0e('0xf')]=_0x17a3d8[_0x5b0e('0xf')];this[_0x5b0e('0x10')]=_0x17a3d8[_0x5b0e('0x10')];this[_0x5b0e('0x11')]=_0x17a3d8[_0x5b0e('0x11')];this[_0x5b0e('0x12')]=_0x3f9d1b[_0x5b0e('0x12')];this[_0x5b0e('0x13')]=_0x17a3d8[_0x5b0e('0x14')];this[_0x5b0e('0x15')]=_0x17a3d8[_0x5b0e('0x16')];this[_0x5b0e('0x17')]=_0x17a3d8['starttime'];this['responsetime']=_0x17a3d8[_0x5b0e('0x18')];this[_0x5b0e('0x19')]=_0x17a3d8[_0x5b0e('0x19')];this['endtime']=moment()['format'](_0x5b0e('0x1a'));this['ringtime']=getSeconds(_0x17a3d8[_0x5b0e('0x18')],_0x17a3d8[_0x5b0e('0x17')]);this[_0x5b0e('0x1b')]=getSeconds(_0x17a3d8[_0x5b0e('0x19')],_0x17a3d8['responsetime']);this['talktime']=getSeconds(this['endtime'],_0x17a3d8['answertime']);this[_0x5b0e('0x9')]=_0x3f9d1b[_0x5b0e('0x9')];this[_0x5b0e('0x1c')]=_0x3f9d1b[_0x5b0e('0x1c')];this[_0x5b0e('0x1d')]=_0x3f9d1b['reason'];this[_0x5b0e('0x1e')]=_0x17a3d8['callback'];this[_0x5b0e('0x1f')]=_0x17a3d8[_0x5b0e('0x1f')];this[_0x5b0e('0x20')]=_0x17a3d8[_0x5b0e('0x20')];this[_0x5b0e('0x21')]=_0x17a3d8[_0x5b0e('0x21')];this[_0x5b0e('0x22')]=_0x17a3d8[_0x5b0e('0x22')];this[_0x5b0e('0x23')]=_0x17a3d8[_0x5b0e('0x23')];this[_0x5b0e('0x24')]=_0x17a3d8[_0x5b0e('0x24')];this[_0x5b0e('0x25')]=_0x17a3d8[_0x5b0e('0x25')];this[_0x5b0e('0x26')]=_0x17a3d8[_0x5b0e('0x26')];this[_0x5b0e('0x27')]=_0x17a3d8[_0x5b0e('0x27')]||'';this[_0x5b0e('0x28')]=_0x17a3d8[_0x5b0e('0x28')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xd207=['reason','callback','callbackat','recallme','ContactId','ListId','UserId','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername'];(function(_0x539fd5,_0x48ba14){var _0x376ea4=function(_0x13c7b0){while(--_0x13c7b0){_0x539fd5['push'](_0x539fd5['shift']());}};_0x376ea4(++_0x48ba14);}(_0xd207,0x7e));var _0x7d20=function(_0x1beb9e,_0x436c8e){_0x1beb9e=_0x1beb9e-0x0;var _0x5cefe8=_0xd207[_0x1beb9e];return _0x5cefe8;};'use strict';var util=require(_0x7d20('0x0'));var _=require(_0x7d20('0x1'));var moment=require(_0x7d20('0x2'));function getSeconds(_0x566e97,_0x187397){var _0x90cc7c=moment(_0x566e97)[_0x7d20('0x3')](0x0);var _0x11d998=moment(_0x187397)[_0x7d20('0x3')](0x0);return _0x90cc7c['diff'](_0x11d998,_0x7d20('0x4'));}function AgentComplete(_0x40eb63,_0x4aeb49){this[_0x7d20('0x5')]=0x4;this['statedesc']='Answer';this[_0x7d20('0x6')]=_0x40eb63[_0x7d20('0x6')];this[_0x7d20('0x7')]=_0x40eb63[_0x7d20('0x7')];this['campaigntype']=_0x40eb63[_0x7d20('0x7')]==='outbound'?_0x7d20('0x8'):_0x40eb63['type'];this['countbusyretry']=_0x40eb63[_0x7d20('0x9')];this['countcongestionretry']=_0x40eb63[_0x7d20('0xa')];this['countnoanswerretry']=_0x40eb63[_0x7d20('0xb')];this['countglobal']=_0x40eb63['countbusyretry']+_0x40eb63['countcongestionretry']+_0x40eb63[_0x7d20('0xb')]+_0x40eb63[_0x7d20('0xc')]+_0x40eb63['countdropretry']+_0x40eb63[_0x7d20('0xd')]+_0x40eb63[_0x7d20('0xe')]+_0x40eb63[_0x7d20('0xf')];this[_0x7d20('0xc')]=_0x40eb63[_0x7d20('0xc')];this[_0x7d20('0x10')]=_0x40eb63[_0x7d20('0x10')];this[_0x7d20('0xd')]=_0x40eb63[_0x7d20('0xd')];this[_0x7d20('0xe')]=_0x40eb63[_0x7d20('0xe')];this[_0x7d20('0xf')]=_0x40eb63[_0x7d20('0xf')];this['uniqueid']=_0x4aeb49[_0x7d20('0x11')];this[_0x7d20('0x12')]=_0x40eb63[_0x7d20('0x13')];this[_0x7d20('0x14')]=_0x40eb63[_0x7d20('0x15')];this['starttime']=_0x40eb63[_0x7d20('0x16')];this[_0x7d20('0x17')]=_0x40eb63[_0x7d20('0x17')];this['answertime']=_0x40eb63[_0x7d20('0x18')];this[_0x7d20('0x19')]=moment()[_0x7d20('0x1a')](_0x7d20('0x1b'));this['ringtime']=getSeconds(_0x40eb63[_0x7d20('0x17')],_0x40eb63[_0x7d20('0x16')]);this['holdtime']=getSeconds(_0x40eb63['answertime'],_0x40eb63[_0x7d20('0x17')]);this[_0x7d20('0x1c')]=getSeconds(this['endtime'],_0x40eb63['answertime']);this[_0x7d20('0x8')]=_0x4aeb49[_0x7d20('0x8')];this[_0x7d20('0x1d')]=_0x4aeb49['membername'];this[_0x7d20('0x1e')]=_0x4aeb49[_0x7d20('0x1e')];this[_0x7d20('0x1f')]=_0x40eb63[_0x7d20('0x1f')];this['callbackuniqueid']=_0x40eb63['callbackuniqueid'];this[_0x7d20('0x20')]=_0x40eb63[_0x7d20('0x20')];this[_0x7d20('0x21')]=_0x40eb63[_0x7d20('0x21')];this[_0x7d20('0x22')]=_0x40eb63['ContactId'];this[_0x7d20('0x23')]=_0x40eb63['ListId'];this[_0x7d20('0x24')]=_0x40eb63[_0x7d20('0x24')];this['VoiceQueueId']=_0x40eb63['VoiceQueueId'];this['CampaignId']=_0x40eb63['CampaignId'];this['originatecalleridnum']=_0x40eb63['originatecalleridnum']||'';this['originatecalleridname']=_0x40eb63[_0x7d20('0x25')]||'';}module[_0x7d20('0x26')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 0a41824..ac8cfc3 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 _0xcca7=['milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment'];(function(_0x2c4645,_0x41ab23){var _0x5445ba=function(_0x2a88ab){while(--_0x2a88ab){_0x2c4645['push'](_0x2c4645['shift']());}};_0x5445ba(++_0x41ab23);}(_0xcca7,0x1aa));var _0x7cca=function(_0x514f19,_0x5d9b97){_0x514f19=_0x514f19-0x0;var _0x3706e1=_0xcca7[_0x514f19];return _0x3706e1;};'use strict';var util=require(_0x7cca('0x0'));var _=require(_0x7cca('0x1'));var moment=require(_0x7cca('0x2'));function getSeconds(_0x33db4f,_0x5cfce5){var _0x4c311e=moment(_0x33db4f)[_0x7cca('0x3')](0x0);var _0x533b00=moment(_0x5cfce5)[_0x7cca('0x3')](0x0);return _0x4c311e[_0x7cca('0x4')](_0x533b00,_0x7cca('0x5'));}function Final(_0x312e98){this[_0x7cca('0x6')]=_0x312e98[_0x7cca('0x6')];this['scheduledat']=_0x312e98['scheduledat'];this[_0x7cca('0x7')]=_0x312e98[_0x7cca('0x7')];this[_0x7cca('0x8')]=_0x312e98[_0x7cca('0x7')]===_0x7cca('0x9')?_0x7cca('0xa'):_0x312e98[_0x7cca('0x7')];this[_0x7cca('0xb')]=_0x312e98[_0x7cca('0xb')];this[_0x7cca('0xc')]=_0x312e98['countcongestionretry'];this[_0x7cca('0xd')]=_0x312e98[_0x7cca('0xd')];this[_0x7cca('0xe')]=_0x312e98[_0x7cca('0xb')]+_0x312e98[_0x7cca('0xc')]+_0x312e98['countnoanswerretry']+_0x312e98[_0x7cca('0xf')]+_0x312e98[_0x7cca('0x10')]+_0x312e98[_0x7cca('0x11')]+_0x312e98['countmachineretry']+_0x312e98['countagentrejectretry'];this[_0x7cca('0xf')]=_0x312e98[_0x7cca('0xf')];this[_0x7cca('0x10')]=_0x312e98[_0x7cca('0x10')];this[_0x7cca('0x11')]=_0x312e98[_0x7cca('0x11')];this[_0x7cca('0x12')]=_0x312e98['countmachineretry'];this[_0x7cca('0x13')]=_0x312e98['countagentrejectretry'];this['queue']=_0x312e98['queue'];this[_0x7cca('0x14')]=_0x312e98[_0x7cca('0x14')];this[_0x7cca('0x15')]=_0x312e98[_0x7cca('0x15')];this[_0x7cca('0x16')]=_0x312e98['starttime'];this[_0x7cca('0x17')]=_0x312e98['responsetime'];this['endtime']=_0x312e98['responsetime'];this[_0x7cca('0x18')]=_0x312e98[_0x7cca('0x18')]||0x0;this[_0x7cca('0x19')]=_0x312e98[_0x7cca('0x19')]||0x0;this[_0x7cca('0x1a')]=_0x312e98[_0x7cca('0x1a')]||0x0;this[_0x7cca('0x1b')]=_0x312e98[_0x7cca('0x1b')];this['callbackuniqueid']=_0x312e98[_0x7cca('0x1c')];this[_0x7cca('0x1d')]=_0x312e98[_0x7cca('0x1d')];this[_0x7cca('0x1e')]=_0x312e98['recallme'];this[_0x7cca('0x1f')]=_0x312e98[_0x7cca('0x1f')];this[_0x7cca('0x20')]=_0x312e98[_0x7cca('0x20')];this[_0x7cca('0x21')]=_0x312e98[_0x7cca('0x21')];this[_0x7cca('0x22')]=_0x312e98[_0x7cca('0x22')];this['CampaignId']=_0x312e98[_0x7cca('0x23')];this[_0x7cca('0x24')]=_0x312e98[_0x7cca('0x24')]||'';this[_0x7cca('0x25')]=_0x312e98[_0x7cca('0x25')]||'';}module[_0x7cca('0x26')]=Final; \ No newline at end of file +var _0xf006=['countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry'];(function(_0x539ab4,_0x36a0d0){var _0x30e81e=function(_0x2fa09b){while(--_0x2fa09b){_0x539ab4['push'](_0x539ab4['shift']());}};_0x30e81e(++_0x36a0d0);}(_0xf006,0x146));var _0x6f00=function(_0x38ad63,_0x5964f8){_0x38ad63=_0x38ad63-0x0;var _0x361415=_0xf006[_0x38ad63];return _0x361415;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x6f00('0x0'));function getSeconds(_0x281499,_0x5914f3){var _0xbab575=moment(_0x281499)['milliseconds'](0x0);var _0x1c7a9e=moment(_0x5914f3)['milliseconds'](0x0);return _0xbab575['diff'](_0x1c7a9e,_0x6f00('0x1'));}function Final(_0x402677){this[_0x6f00('0x2')]=_0x402677['uniqueid'];this[_0x6f00('0x3')]=_0x402677['scheduledat'];this[_0x6f00('0x4')]=_0x402677[_0x6f00('0x4')];this[_0x6f00('0x5')]=_0x402677[_0x6f00('0x4')]===_0x6f00('0x6')?_0x6f00('0x7'):_0x402677[_0x6f00('0x4')];this[_0x6f00('0x8')]=_0x402677[_0x6f00('0x8')];this[_0x6f00('0x9')]=_0x402677[_0x6f00('0x9')];this[_0x6f00('0xa')]=_0x402677[_0x6f00('0xa')];this['countglobal']=_0x402677[_0x6f00('0x8')]+_0x402677[_0x6f00('0x9')]+_0x402677[_0x6f00('0xa')]+_0x402677[_0x6f00('0xb')]+_0x402677[_0x6f00('0xc')]+_0x402677['countabandonedretry']+_0x402677[_0x6f00('0xd')]+_0x402677['countagentrejectretry'];this[_0x6f00('0xb')]=_0x402677['countnosuchnumberretry'];this[_0x6f00('0xc')]=_0x402677[_0x6f00('0xc')];this[_0x6f00('0xe')]=_0x402677[_0x6f00('0xe')];this[_0x6f00('0xd')]=_0x402677[_0x6f00('0xd')];this[_0x6f00('0xf')]=_0x402677[_0x6f00('0xf')];this[_0x6f00('0x7')]=_0x402677['queue'];this[_0x6f00('0x10')]=_0x402677['calleridname'];this['calleridnum']=_0x402677[_0x6f00('0x11')];this[_0x6f00('0x12')]=_0x402677[_0x6f00('0x12')];this[_0x6f00('0x13')]=_0x402677[_0x6f00('0x13')];this[_0x6f00('0x14')]=_0x402677[_0x6f00('0x13')];this[_0x6f00('0x15')]=_0x402677[_0x6f00('0x15')]||0x0;this[_0x6f00('0x16')]=_0x402677[_0x6f00('0x16')]||0x0;this[_0x6f00('0x17')]=_0x402677['talktime']||0x0;this['callback']=_0x402677['callback'];this[_0x6f00('0x18')]=_0x402677[_0x6f00('0x18')];this[_0x6f00('0x19')]=_0x402677['callbackat'];this[_0x6f00('0x1a')]=_0x402677[_0x6f00('0x1a')];this[_0x6f00('0x1b')]=_0x402677[_0x6f00('0x1b')];this[_0x6f00('0x1c')]=_0x402677[_0x6f00('0x1c')];this[_0x6f00('0x1d')]=_0x402677[_0x6f00('0x1d')];this['VoiceQueueId']=_0x402677[_0x6f00('0x1e')];this[_0x6f00('0x1f')]=_0x402677[_0x6f00('0x1f')];this['originatecalleridnum']=_0x402677[_0x6f00('0x20')]||'';this['originatecalleridname']=_0x402677[_0x6f00('0x21')]||'';}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 b9edda7..e6cba0c 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 _0xfbc3=['statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','diff'];(function(_0x28c67a,_0x3dc69e){var _0x170473=function(_0x497476){while(--_0x497476){_0x28c67a['push'](_0x28c67a['shift']());}};_0x170473(++_0x3dc69e);}(_0xfbc3,0x104));var _0x3fbc=function(_0x34d465,_0x337847){_0x34d465=_0x34d465-0x0;var _0x342266=_0xfbc3[_0x34d465];return _0x342266;};'use strict';var util=require(_0x3fbc('0x0'));var _=require(_0x3fbc('0x1'));var moment=require(_0x3fbc('0x2'));function getSeconds(_0x504875,_0x14150f){var _0x62e4ca=moment(_0x504875)['milliseconds'](0x0);var _0x533a4f=moment(_0x14150f)['milliseconds'](0x0);return _0x62e4ca[_0x3fbc('0x3')](_0x533a4f,'seconds');}function Hangup(_0x29c3d4,_0x5ce675){this['state']=0x4;this[_0x3fbc('0x4')]=_0x3fbc('0x5');this[_0x3fbc('0x6')]=_0x29c3d4['scheduledat'];this[_0x3fbc('0x7')]=_0x29c3d4[_0x3fbc('0x7')];this[_0x3fbc('0x8')]=_0x29c3d4[_0x3fbc('0x7')]===_0x3fbc('0x9')?_0x3fbc('0xa'):_0x29c3d4[_0x3fbc('0x7')];this['countbusyretry']=_0x29c3d4[_0x3fbc('0xb')];this['countcongestionretry']=_0x29c3d4[_0x3fbc('0xc')];this['countnoanswerretry']=_0x29c3d4[_0x3fbc('0xd')];this[_0x3fbc('0xe')]=_0x29c3d4[_0x3fbc('0xb')]+_0x29c3d4['countcongestionretry']+_0x29c3d4['countnoanswerretry']+_0x29c3d4['countnosuchnumberretry']+_0x29c3d4['countdropretry']+_0x29c3d4[_0x3fbc('0xf')]+_0x29c3d4[_0x3fbc('0x10')]+_0x29c3d4[_0x3fbc('0x11')];this['countnosuchnumberretry']=_0x29c3d4[_0x3fbc('0x12')];this['countdropretry']=_0x29c3d4[_0x3fbc('0x13')];this[_0x3fbc('0xf')]=_0x29c3d4[_0x3fbc('0xf')];this['countmachineretry']=_0x29c3d4[_0x3fbc('0x10')];this[_0x3fbc('0x11')]=_0x29c3d4[_0x3fbc('0x11')];this[_0x3fbc('0x14')]=_0x5ce675[_0x3fbc('0x14')];this[_0x3fbc('0x15')]=_0x29c3d4[_0x3fbc('0x16')];this['calleridnum']=_0x29c3d4['number'];this[_0x3fbc('0x17')]=_0x29c3d4[_0x3fbc('0x17')];this[_0x3fbc('0x18')]=_0x29c3d4['responsetime'];this[_0x3fbc('0x19')]=moment()[_0x3fbc('0x1a')](_0x3fbc('0x1b'));this[_0x3fbc('0x1c')]=getSeconds(_0x29c3d4['responsetime'],_0x29c3d4['starttime']);this[_0x3fbc('0x1d')]=0x0;this[_0x3fbc('0x1e')]=getSeconds(this[_0x3fbc('0x19')],_0x29c3d4[_0x3fbc('0x18')]);this[_0x3fbc('0xa')]=_0x29c3d4[_0x3fbc('0xa')];this[_0x3fbc('0x1f')]=_0x3fbc('0x20');this[_0x3fbc('0x21')]=_0x5ce675[_0x3fbc('0x22')];this[_0x3fbc('0x23')]=_0x29c3d4['callback'];this[_0x3fbc('0x24')]=_0x29c3d4[_0x3fbc('0x24')];this['callbackat']=_0x29c3d4[_0x3fbc('0x25')];this['recallme']=_0x29c3d4['recallme'];this[_0x3fbc('0x26')]=_0x29c3d4[_0x3fbc('0x26')];this[_0x3fbc('0x27')]=_0x29c3d4[_0x3fbc('0x27')];this[_0x3fbc('0x28')]=_0x29c3d4[_0x3fbc('0x28')];this[_0x3fbc('0x29')]=_0x29c3d4['VoiceQueueId'];this[_0x3fbc('0x2a')]=_0x29c3d4[_0x3fbc('0x2a')];}module[_0x3fbc('0x2b')]=Hangup; \ No newline at end of file +var _0x765b=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound'];(function(_0x4bad84,_0x418639){var _0x57c671=function(_0x3f842f){while(--_0x3f842f){_0x4bad84['push'](_0x4bad84['shift']());}};_0x57c671(++_0x418639);}(_0x765b,0x198));var _0xb765=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x765b[_0x256d6a];return _0x460058;};'use strict';var util=require(_0xb765('0x0'));var _=require(_0xb765('0x1'));var moment=require(_0xb765('0x2'));function getSeconds(_0x1b2752,_0x5c4fbf){var _0x1b0e0=moment(_0x1b2752)[_0xb765('0x3')](0x0);var _0x4003ac=moment(_0x5c4fbf)[_0xb765('0x3')](0x0);return _0x1b0e0[_0xb765('0x4')](_0x4003ac,_0xb765('0x5'));}function Hangup(_0x4023da,_0x539bf7){this[_0xb765('0x6')]=0x4;this[_0xb765('0x7')]='Answer';this[_0xb765('0x8')]=_0x4023da[_0xb765('0x8')];this['type']=_0x4023da[_0xb765('0x9')];this[_0xb765('0xa')]=_0x4023da[_0xb765('0x9')]===_0xb765('0xb')?_0xb765('0xc'):_0x4023da['type'];this[_0xb765('0xd')]=_0x4023da[_0xb765('0xd')];this[_0xb765('0xe')]=_0x4023da['countcongestionretry'];this[_0xb765('0xf')]=_0x4023da[_0xb765('0xf')];this['countglobal']=_0x4023da[_0xb765('0xd')]+_0x4023da['countcongestionretry']+_0x4023da['countnoanswerretry']+_0x4023da[_0xb765('0x10')]+_0x4023da[_0xb765('0x11')]+_0x4023da[_0xb765('0x12')]+_0x4023da[_0xb765('0x13')]+_0x4023da[_0xb765('0x14')];this[_0xb765('0x10')]=_0x4023da['countnosuchnumberretry'];this['countdropretry']=_0x4023da[_0xb765('0x11')];this[_0xb765('0x12')]=_0x4023da[_0xb765('0x12')];this[_0xb765('0x13')]=_0x4023da[_0xb765('0x13')];this[_0xb765('0x14')]=_0x4023da[_0xb765('0x14')];this[_0xb765('0x15')]=_0x539bf7[_0xb765('0x15')];this[_0xb765('0x16')]=_0x4023da[_0xb765('0x17')];this[_0xb765('0x18')]=_0x4023da['number'];this[_0xb765('0x19')]=_0x4023da[_0xb765('0x19')];this[_0xb765('0x1a')]=_0x4023da[_0xb765('0x1a')];this[_0xb765('0x1b')]=moment()[_0xb765('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x4023da[_0xb765('0x1a')],_0x4023da[_0xb765('0x19')]);this['holdtime']=0x0;this[_0xb765('0x1d')]=getSeconds(this['endtime'],_0x4023da[_0xb765('0x1a')]);this[_0xb765('0xc')]=_0x4023da['queue'];this[_0xb765('0x1e')]='IVR';this[_0xb765('0x1f')]=_0x539bf7[_0xb765('0x20')];this['callback']=_0x4023da[_0xb765('0x21')];this['callbackuniqueid']=_0x4023da[_0xb765('0x22')];this[_0xb765('0x23')]=_0x4023da[_0xb765('0x23')];this[_0xb765('0x24')]=_0x4023da[_0xb765('0x24')];this[_0xb765('0x25')]=_0x4023da['ContactId'];this['ListId']=_0x4023da[_0xb765('0x26')];this[_0xb765('0x27')]=_0x4023da[_0xb765('0x27')];this[_0xb765('0x28')]=_0x4023da[_0xb765('0x28')];this['CampaignId']=_0x4023da['CampaignId'];}module[_0xb765('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 7729123..2715a6a 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 _0x1df6=['name','calleridnum','starttime','responsetime','endtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry'];(function(_0x317634,_0x11a4f2){var _0x53ae3b=function(_0x59a5d4){while(--_0x59a5d4){_0x317634['push'](_0x317634['shift']());}};_0x53ae3b(++_0x11a4f2);}(_0x1df6,0x13a));var _0x61df=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x1df6[_0x2070da];return _0x4f9fe1;};'use strict';var util=require(_0x61df('0x0'));var _=require(_0x61df('0x1'));var moment=require(_0x61df('0x2'));function getSeconds(_0x2d3e5d,_0x51bc39){var _0x37be34=moment(_0x2d3e5d)['milliseconds'](0x0);var _0xaf64b3=moment(_0x51bc39)[_0x61df('0x3')](0x0);return _0x37be34[_0x61df('0x4')](_0xaf64b3,_0x61df('0x5'));}function History(_0x2e4397){this[_0x61df('0x6')]=_0x2e4397[_0x61df('0x6')];this[_0x61df('0x7')]=_0x2e4397[_0x61df('0x7')]||undefined;this['type']=_0x2e4397[_0x61df('0x8')];this[_0x61df('0x9')]=_0x2e4397[_0x61df('0x8')]==='outbound'?_0x61df('0xa'):_0x2e4397[_0x61df('0x8')];this['countbusyretry']=_0x2e4397[_0x61df('0xb')];this[_0x61df('0xc')]=_0x2e4397[_0x61df('0xc')];this[_0x61df('0xd')]=_0x2e4397[_0x61df('0xd')];this['countglobal']=_0x2e4397[_0x61df('0xb')]+_0x2e4397['countcongestionretry']+_0x2e4397[_0x61df('0xd')]+_0x2e4397['countnosuchnumberretry']+_0x2e4397[_0x61df('0xe')]+_0x2e4397[_0x61df('0xf')]+_0x2e4397[_0x61df('0x10')]+_0x2e4397[_0x61df('0x11')];this[_0x61df('0x12')]=_0x2e4397[_0x61df('0x12')];this[_0x61df('0xe')]=_0x2e4397[_0x61df('0xe')];this['countabandonedretry']=_0x2e4397[_0x61df('0xf')];this[_0x61df('0x10')]=_0x2e4397[_0x61df('0x10')];this['countagentrejectretry']=_0x2e4397['countagentrejectretry'];this[_0x61df('0xa')]=_0x2e4397['queue'];this['calleridname']=_0x2e4397[_0x61df('0x13')];this[_0x61df('0x14')]=_0x2e4397['number'];this[_0x61df('0x15')]=_0x2e4397[_0x61df('0x15')];this['responsetime']=_0x2e4397[_0x61df('0x16')];this[_0x61df('0x17')]=_0x2e4397[_0x61df('0x16')];this['ringtime']=getSeconds(_0x2e4397[_0x61df('0x16')],_0x2e4397[_0x61df('0x15')]);this[_0x61df('0x18')]=0x0;this['talktime']=0x0;this[_0x61df('0x19')]=_0x2e4397['callback'];this[_0x61df('0x1a')]=_0x2e4397[_0x61df('0x1a')];this[_0x61df('0x1b')]=_0x2e4397['callbackat'];this[_0x61df('0x1c')]=_0x2e4397[_0x61df('0x1c')];this[_0x61df('0x1d')]=_0x2e4397[_0x61df('0x1d')];this[_0x61df('0x1e')]=_0x2e4397['ListId'];this['UserId']=_0x2e4397[_0x61df('0x1f')];this[_0x61df('0x20')]=_0x2e4397['VoiceQueueId'];this[_0x61df('0x21')]=_0x2e4397[_0x61df('0x21')];this[_0x61df('0x22')]=_0x2e4397['originatecalleridnum']||'';this[_0x61df('0x23')]=_0x2e4397[_0x61df('0x23')]||'';}module[_0x61df('0x24')]=History; \ No newline at end of file +var _0x8d81=['countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x36ac36,_0x38a516){var _0x28fd5c=function(_0x87c433){while(--_0x87c433){_0x36ac36['push'](_0x36ac36['shift']());}};_0x28fd5c(++_0x38a516);}(_0x8d81,0xd8));var _0x18d8=function(_0x237408,_0x15ff98){_0x237408=_0x237408-0x0;var _0x1ba3e8=_0x8d81[_0x237408];return _0x1ba3e8;};'use strict';var util=require(_0x18d8('0x0'));var _=require(_0x18d8('0x1'));var moment=require(_0x18d8('0x2'));function getSeconds(_0x2b1eff,_0xf46ab){var _0x3edfda=moment(_0x2b1eff)[_0x18d8('0x3')](0x0);var _0x7545bb=moment(_0xf46ab)[_0x18d8('0x3')](0x0);return _0x3edfda[_0x18d8('0x4')](_0x7545bb,_0x18d8('0x5'));}function History(_0x3c411d){this[_0x18d8('0x6')]=_0x3c411d[_0x18d8('0x6')];this[_0x18d8('0x7')]=_0x3c411d[_0x18d8('0x7')]||undefined;this[_0x18d8('0x8')]=_0x3c411d[_0x18d8('0x8')];this[_0x18d8('0x9')]=_0x3c411d[_0x18d8('0x8')]===_0x18d8('0xa')?_0x18d8('0xb'):_0x3c411d[_0x18d8('0x8')];this[_0x18d8('0xc')]=_0x3c411d[_0x18d8('0xc')];this[_0x18d8('0xd')]=_0x3c411d[_0x18d8('0xd')];this[_0x18d8('0xe')]=_0x3c411d['countnoanswerretry'];this[_0x18d8('0xf')]=_0x3c411d[_0x18d8('0xc')]+_0x3c411d[_0x18d8('0xd')]+_0x3c411d[_0x18d8('0xe')]+_0x3c411d[_0x18d8('0x10')]+_0x3c411d[_0x18d8('0x11')]+_0x3c411d[_0x18d8('0x12')]+_0x3c411d['countmachineretry']+_0x3c411d[_0x18d8('0x13')];this[_0x18d8('0x10')]=_0x3c411d[_0x18d8('0x10')];this['countdropretry']=_0x3c411d[_0x18d8('0x11')];this['countabandonedretry']=_0x3c411d[_0x18d8('0x12')];this[_0x18d8('0x14')]=_0x3c411d['countmachineretry'];this[_0x18d8('0x13')]=_0x3c411d[_0x18d8('0x13')];this['queue']=_0x3c411d[_0x18d8('0xb')];this[_0x18d8('0x15')]=_0x3c411d['name'];this[_0x18d8('0x16')]=_0x3c411d[_0x18d8('0x17')];this[_0x18d8('0x18')]=_0x3c411d['starttime'];this[_0x18d8('0x19')]=_0x3c411d[_0x18d8('0x19')];this[_0x18d8('0x1a')]=_0x3c411d[_0x18d8('0x19')];this[_0x18d8('0x1b')]=getSeconds(_0x3c411d[_0x18d8('0x19')],_0x3c411d[_0x18d8('0x18')]);this['holdtime']=0x0;this[_0x18d8('0x1c')]=0x0;this[_0x18d8('0x1d')]=_0x3c411d[_0x18d8('0x1d')];this[_0x18d8('0x1e')]=_0x3c411d[_0x18d8('0x1e')];this['callbackat']=_0x3c411d['callbackat'];this[_0x18d8('0x1f')]=_0x3c411d[_0x18d8('0x1f')];this['ContactId']=_0x3c411d['ContactId'];this['ListId']=_0x3c411d[_0x18d8('0x20')];this[_0x18d8('0x21')]=_0x3c411d[_0x18d8('0x21')];this[_0x18d8('0x22')]=_0x3c411d['VoiceQueueId'];this[_0x18d8('0x23')]=_0x3c411d[_0x18d8('0x23')];this['originatecalleridnum']=_0x3c411d[_0x18d8('0x24')]||'';this[_0x18d8('0x25')]=_0x3c411d[_0x18d8('0x25')]||'';}module[_0x18d8('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index a4b448f..686d4d8 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 _0x3402=['hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','md5','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','inspect','error','stack','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','sequence','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','catch','[checkIsBlackList]\x20','checkIsBlackListIvr','then','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','saveInDb','ContactId','UserId','VoiceQueueId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','Machine','AMD','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','CampaignId','[rescheduleContact][Machine]','MACHINE','reason19\x20machine....','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','calleridname','actionid','locked','stateinterface','agents','queueBooked','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','pick','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','command','iftime\x20%s,%s','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','power','dialPowerLevel','booked','handlePower','Queue','method\x20not\x20recognized','dialActive','dialGlobalInterval','dialTimezone','launchHandleIvr','\x5cw{0,','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','dialPredictiveOptimizationPercentage','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','Amax\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','exports','util','bluebird','uuid','moment','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary'];(function(_0x46eb6a,_0x49128b){var _0x3b918b=function(_0x1974d3){while(--_0x1974d3){_0x46eb6a['push'](_0x46eb6a['shift']());}};_0x3b918b(++_0x49128b);}(_0x3402,0x1f0));var _0x2340=function(_0x18b35a,_0x1c9da3){_0x18b35a=_0x18b35a-0x0;var _0xb51823=_0x3402[_0x18b35a];return _0xb51823;};'use strict';var util=require(_0x2340('0x0'));var _=require('lodash');var BPromise=require(_0x2340('0x1'));var uuid=require(_0x2340('0x2'));var moment=require(_0x2340('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x2340('0x4'));var config=require(_0x2340('0x5'));var logger=require(_0x2340('0x6'))(_0x2340('0x7'));var loggerBooked=require(_0x2340('0x6'))('booked');var loggerPredictive=require('../../../config/logger')(_0x2340('0x8'));var loggerPredictiveCalls=require(_0x2340('0x6'))(_0x2340('0x9'));var loggerSyncQueueSummary=require(_0x2340('0x6'))(_0x2340('0xa'));var ami=require('../ami');config[_0x2340('0xb')]=_[_0x2340('0xc')](config[_0x2340('0xb')],{'host':_0x2340('0xd'),'port':0x18eb});var io=require(_0x2340('0xe'))(new Redis(config['redis']));var cmHopper=require(_0x2340('0xf'));var cmHopperHistory=require(_0x2340('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x2340('0x11'));var History=require('./history');var Final=require(_0x2340('0x12'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x2340('0x13'));var Hangup=require(_0x2340('0x14'));var ipAgi=process[_0x2340('0x15')][_0x2340('0x16')]||_0x2340('0x17');var strategy={'rrmemory':_0x2340('0x18'),'roundrobin':_0x2340('0x19')};var Sequence=function(){};Sequence['prototype'][_0x2340('0x1a')]=function(_0x26710a){this[_0x2340('0x1b')]=this['tail']?this[_0x2340('0x1b')][_0x2340('0x1c')](_0x26710a):_0x26710a();};function Dialer(_0x3f2429,_0x1f1430){this['sequence']=new Sequence();this[_0x2340('0x1d')]=_0x1f1430;this[_0x2340('0x1e')]=_0x3f2429[_0x2340('0x1e')];this[_0x2340('0x1f')]=_0x3f2429[_0x2340('0x1f')];this['agents']=_0x3f2429['agents'];this[_0x2340('0x20')]=_0x3f2429[_0x2340('0x20')];this[_0x2340('0x21')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x2340('0x22')]={};this[_0x2340('0x23')]={};this[_0x2340('0x24')]={};this[_0x2340('0x25')]={};this['startPredictive']={};this['startProgressive']={};this[_0x2340('0x26')]={};this['queueBooked']={};this[_0x2340('0x27')]={};ami['on'](_0x2340('0x28'),this[_0x2340('0x29')][_0x2340('0x2a')](this));ami['on'](_0x2340('0x2b'),this[_0x2340('0x2c')][_0x2340('0x2a')](this));ami['on'](_0x2340('0x2d'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x2340('0x2e'),this[_0x2340('0x2f')][_0x2340('0x2a')](this));ami['on'](_0x2340('0x30'),this[_0x2340('0xa')][_0x2340('0x2a')](this));ami['on'](_0x2340('0x31'),this['syncHangup'][_0x2340('0x2a')](this));ami['on'](_0x2340('0x32'),this[_0x2340('0x33')][_0x2340('0x2a')](this));ami['on'](_0x2340('0x34'),this[_0x2340('0x35')][_0x2340('0x2a')](this));ami['on'](_0x2340('0x36'),this[_0x2340('0x37')][_0x2340('0x2a')](this));ami['on'](_0x2340('0x38'),this['syncQueueStatusComplete'][_0x2340('0x2a')](this));this[_0x2340('0x39')]();this['loopClearZombieChannels']();}function isNotNull(_0x2f9188){return _0x2f9188!==null&&!_[_0x2340('0x3a')](_0x2f9188);}function checkIsLoggedIn(_0x43c671,_0x2da109){return function(){if(_0x2da109<=0x0){_0x43c671[_0x2340('0x3b')]='AGENTS_NOT_LOGGED';throw _0x43c671[_0x2340('0x3c')]+_0x2340('0x3d');}};}function isActive(_0x3547c7){return _0x3547c7;}function checkIsActive(_0x3f4fbe,_0x10a53f){return function(){if(!isActive(_0x10a53f)){_0x3f4fbe['message']=_0x2340('0x3e');throw _0x3f4fbe[_0x2340('0x3c')]+_0x2340('0x3f');}};}function checkInterval(_0x484b0e){return function(){if(!isNotNull(_0x484b0e[_0x2340('0x40')])){_0x484b0e[_0x2340('0x3b')]='INTERVAL_IS_NULL';throw _0x484b0e[_0x2340('0x3c')]+_0x2340('0x41');}if(!isNotNull(_0x484b0e['Interval'][_0x2340('0x42')])){_0x484b0e[_0x2340('0x3b')]=_0x2340('0x43');throw _0x484b0e[_0x2340('0x3c')]+_0x2340('0x41');}if(!isNotNull(_[_0x2340('0x44')](_0x484b0e['Interval'][_0x2340('0x42')]))){_0x484b0e[_0x2340('0x3b')]=_0x2340('0x43');throw _0x484b0e['name']+_0x2340('0x41');}};}function msgResponse(_0x20c1c9,_0x2f5277,_0x41c745){return{'action':_0x20c1c9,'response':_0x2f5277,'message':_0x41c745,'stack':_0x41c745};}function myreject(_0x14fae7){return function(_0x3b71c0){return _0x14fae7(msgResponse(_0x2340('0x45'),_0x2340('0x46'),JSON[_0x2340('0x47')](_0x3b71c0)));};}function getSeconds(_0x28fcbf,_0x275f6b){var _0x5d7b37=moment(_0x28fcbf)[_0x2340('0x48')](0x0);var _0x5b4f71=moment(_0x275f6b)['milliseconds'](0x0);return _0x5d7b37[_0x2340('0x49')](_0x5b4f71,'seconds');}function emit(_0x1881d8,_0x34c545,_0x596aa4){io['to'](_0x1881d8)[_0x2340('0x4a')](_0x34c545,_0x596aa4);}function emitVoiceQueueSummary(_0x3de046){if(_0x3de046[_0x2340('0x4b')]===_0x2340('0x4c')){var _0x4cd7f2={'id':_0x3de046['id'],'name':_0x3de046[_0x2340('0x3c')],'strategy':_0x3de046[_0x2340('0x4d')],'answered':_0x3de046[_0x2340('0x4e')],'available':_0x3de046[_0x2340('0x4f')],'loggedIn':_0x3de046[_0x2340('0x50')],'pTalking':_0x3de046[_0x2340('0x51')],'sumBillable':_0x3de046[_0x2340('0x52')],'sumDuration':_0x3de046[_0x2340('0x53')],'sumHoldTime':_0x3de046[_0x2340('0x54')]||0x0,'talking':_0x3de046[_0x2340('0x55')],'total':_0x3de046['total'],'type':_0x3de046[_0x2340('0x4b')],'unmanaged':_0x3de046[_0x2340('0x56')],'abandoned':_0x3de046[_0x2340('0x57')],'waiting':_0x3de046[_0x2340('0x58')],'loggedInDb':_0x3de046[_0x2340('0x59')],'dialActive':_0x3de046['dialActive'],'dialMethod':_0x3de046['dialMethod'],'dialOriginateCallerIdName':_0x3de046[_0x2340('0x5a')],'dialOriginateCallerIdNumber':_0x3de046['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3de046[_0x2340('0x5b')],'dialPrefix':_0x3de046[_0x2340('0x5c')],'outboundAnswerAgiCallsDay':_0x3de046[_0x2340('0x5d')],'outboundAnswerCallsDay':_0x3de046[_0x2340('0x5e')],'outboundBlacklistCallsDay':_0x3de046[_0x2340('0x5f')],'outboundBusyCallsDay':_0x3de046['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3de046['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3de046[_0x2340('0x60')],'outboundDropCallsDayCallersExit':_0x3de046[_0x2340('0x61')],'outboundDropCallsDayTimeout':_0x3de046[_0x2340('0x62')],'outboundNoAnswerCallsDay':_0x3de046[_0x2340('0x63')],'outboundNoSuchCallsDay':_0x3de046['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3de046[_0x2340('0x64')],'outboundReCallsDay':_0x3de046['outboundReCallsDay'],'outboundRejectCallsDay':_0x3de046['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3de046[_0x2340('0x65')],'predictiveIntervalAnsweredCalls':_0x3de046[_0x2340('0x66')],'predictiveIntervalAvgHoldtime':_0x3de046['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3de046[_0x2340('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x3de046[_0x2340('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x3de046[_0x2340('0x69')],'predictiveIntervalErlangCalls':_0x3de046[_0x2340('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x3de046[_0x2340('0x6b')],'predictiveIntervalHitRate':_0x3de046[_0x2340('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x3de046['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3de046[_0x2340('0x6d')],'predictiveIntervalAvailable':_0x3de046[_0x2340('0x6e')],'predictiveIntervalTotalCalls':_0x3de046[_0x2340('0x6f')],'message':_0x3de046['message'],'originated':_0x3de046['originated'],'erlangCalls':_0x3de046['erlangCalls'],'erlangCallToSecond':_0x3de046[_0x2340('0x70')],'erlangAbandonmentRate':_0x3de046[_0x2340('0x71')],'erlangBusyFactor':_0x3de046[_0x2340('0x72')],'startPredictive':_0x3de046[_0x2340('0x73')],'startProgressive':_0x3de046[_0x2340('0x74')]};if(_0x3de046[_0x2340('0x75')]){_0x4cd7f2['Trunk']={'id':_0x3de046[_0x2340('0x75')]['id'],'name':_0x3de046[_0x2340('0x75')][_0x2340('0x3c')],'active':_0x3de046[_0x2340('0x75')][_0x2340('0x76')],'callerid':_0x3de046[_0x2340('0x75')][_0x2340('0x77')]};}if(_0x3de046[_0x2340('0x40')]){_0x4cd7f2[_0x2340('0x40')]={'id':_0x3de046[_0x2340('0x40')]['id'],'name':_0x3de046[_0x2340('0x40')]['name']};}var _0x211d58=md5(JSON[_0x2340('0x47')](_0x4cd7f2));if(_0x3de046[_0x2340('0x78')]!==_0x211d58){_0x3de046[_0x2340('0x78')]=_0x211d58;emit(util[_0x2340('0x79')](_0x2340('0x7a'),_0x4cd7f2[_0x2340('0x3c')]),'voice_queue:save',_0x4cd7f2);}}}function emitCampaignSummary(_0x2536f3){if(_0x2536f3[_0x2340('0x4b')]===_0x2340('0x7b')){emit(util[_0x2340('0x79')](_0x2340('0x7c'),_0x2536f3['name']),_0x2340('0x7d'),_0x2536f3);}}function checkGetDataPredictive(_0x3a0034){if(isNotNull(_0x3a0034)&&!_[_0x2340('0x44')](_0x3a0034)){loggerPredictive[_0x2340('0x7e')](_0x2340('0x7f'));loggerPredictive[_0x2340('0x7e')](_0x2340('0x80'),_0x3a0034[_0x2340('0x6f')]);loggerPredictive[_0x2340('0x7e')](_0x2340('0x81'),_0x3a0034[_0x2340('0x66')]);loggerPredictive[_0x2340('0x7e')](_0x2340('0x82'),_0x3a0034[_0x2340('0x69')]);loggerPredictive['info'](_0x2340('0x83'),_0x3a0034[_0x2340('0x68')]);loggerPredictive[_0x2340('0x7e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a0034[_0x2340('0x84')]);loggerPredictive[_0x2340('0x7e')](_0x2340('0x85'),_0x3a0034[_0x2340('0x67')]);loggerPredictive[_0x2340('0x7e')]('---------------------------');if(_0x3a0034[_0x2340('0x6f')]>0x0){if(!_[_0x2340('0x3a')](_0x3a0034[_0x2340('0x67')])&&_0x3a0034['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x2340('0x86'));if(!_[_0x2340('0x3a')](_0x3a0034[_0x2340('0x84')])&&_0x3a0034[_0x2340('0x84')]>0x0){return!![];}loggerPredictive[_0x2340('0x7e')](_0x2340('0x87'));}else{loggerPredictive[_0x2340('0x7e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x2340('0x7e')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xb02d19){return function(_0x55d300){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x2340('0x7e')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x55d300[_0x2340('0x88')]);loggerPredictive[_0x2340('0x7e')](_0x2340('0x89'),_0x55d300[_0x2340('0x70')]);loggerPredictive[_0x2340('0x7e')](_0x2340('0x8a'),_0x55d300['erlangAbandonmentRate']);loggerPredictive[_0x2340('0x7e')](_0x2340('0x8b'),_0x55d300[_0x2340('0x72')]);loggerPredictive[_0x2340('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x55d300[_0x2340('0x71')]);loggerPredictive[_0x2340('0x7e')]('---------------------------');_[_0x2340('0x8c')](_0xb02d19,_0x55d300);};}function getDiff(_0x3b47e9){var _0x1f89d1=moment()[_0x2340('0x48')](0x0);var _0x412eef=moment(_0x3b47e9)[_0x2340('0x48')](0x0);return _0x1f89d1[_0x2340('0x49')](_0x412eef,_0x2340('0x8d'));}function ifInterval(_0x58c980,_0x50772d){if(_[_0x2340('0x3a')](_0x50772d)){return![];}return getDiff(_0x50772d)<_0x58c980*0x3c;}function freeVariablesPredictive(_0x1a799a){if(isNotNull(_0x1a799a)){if(!_[_0x2340('0x3a')](_0x1a799a[_0x2340('0x74')])){_0x1a799a[_0x2340('0x74')]=undefined;loggerPredictive[_0x2340('0x7e')](_0x1a799a[_0x2340('0x3c')],_0x2340('0x8e'));}if(!_[_0x2340('0x3a')](_0x1a799a['startPredictive'])){_0x1a799a[_0x2340('0x73')]=undefined;loggerPredictive['info'](_0x1a799a[_0x2340('0x3c')],_0x2340('0x8f'));}if(!_['isUndefined'](_0x1a799a['handlePredictive'])){clearInterval(_0x1a799a['handlePredictive']);_0x1a799a[_0x2340('0x90')]=undefined;loggerPredictive[_0x2340('0x7e')](_0x1a799a['name'],_0x2340('0x91'));}}}function erlangb(_0x1d24ba,_0x452f80){if(_0x452f80===0x0){return 0x0;}var _0x21714b=0x1;for(var _0xf76c51=0x1;_0xf76c51<=_0x452f80;_0xf76c51+=0x1){_0x21714b=0x1+_0x21714b*_0xf76c51/_0x1d24ba;}return 0x1/_0x21714b;}function isVoiceQueueOutbound(_0x4d9945){return _0x4d9945==='outbound';}function isNotPreview(_0x5744c6){return _0x5744c6!==_0x2340('0x1d');}function isCampaignIvr(_0x583b21){return _0x583b21===_0x2340('0x7b');}function getCallerId(_0x15bf08,_0x1502b1,_0x54cb5e){if(!_[_0x2340('0x3a')](_0x54cb5e)&&typeof _0x54cb5e===_0x2340('0x92')&&!_[_0x2340('0x44')](_0x54cb5e)){if(!_[_0x2340('0x3a')](_0x1502b1)&&typeof _0x1502b1===_0x2340('0x92')&&!_['isEmpty'](_0x1502b1)){return util[_0x2340('0x79')](_0x2340('0x93'),_0x1502b1,_0x54cb5e);}return util[_0x2340('0x79')](_0x2340('0x93'),_0x54cb5e,_0x54cb5e);}if(!_[_0x2340('0x3a')](_0x15bf08)&&typeof _0x15bf08===_0x2340('0x92')&&!_[_0x2340('0x44')](_0x15bf08)){return _0x15bf08;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x5aae20,_0x48af84){return function(_0x3303c3){freeVariablesPredictive(_0x48af84);emitVoiceQueueSummary(_0x48af84);emitCampaignSummary(_0x48af84);loggerSyncQueueSummary['error'](_0x5aae20,util[_0x2340('0x94')](_0x3303c3,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xd56bc2,_0x1b9e61){return function(_0x5264c6){loggerPredictive[_0x2340('0x95')](_0x1b9e61['name'],_0xd56bc2);loggerPredictive[_0x2340('0x95')](_0x5264c6[_0x2340('0x96')]);freeVariablesPredictive(_0x1b9e61);};}function loggerCatch(_0x184b27){return function(_0xe5831e){logger['error'](_0x184b27,util[_0x2340('0x94')](_0xe5831e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x15db2e){return _0x15db2e&&!_[_0x2340('0x3a')](_0x15db2e)&&_0x15db2e['length']>0x0;}function decremetOriginate(_0x109762){if(!_[_0x2340('0x3a')](_0x109762)&&_0x109762!==null){if(typeof _0x109762[_0x2340('0x97')]!==_0x2340('0x98')){if(_0x109762[_0x2340('0x97')]>0x0){_0x109762[_0x2340('0x97')]-=0x1;}else{logger[_0x2340('0x95')](_0x2340('0x99'));}}}else{logger[_0x2340('0x95')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0xc3bd69,_0x1f63c9,_0x1391c4){if(_0x1f63c9>_0x1391c4){for(var _0x53fa4d=0x0;_0x53fa4d<_0x1f63c9-_0x1391c4;_0x53fa4d+=0x1){decremetOriginate(_0xc3bd69);}}}function loggerGetContactDialer(_0x1039b6,_0x3c53af,_0x2cb075){return function(_0x5a2c67){checkContactLowerLimitOriginate(_0x3c53af,_0x2cb075,0x0);logger[_0x2340('0x95')](_0x1039b6,util['inspect'](_0x5a2c67,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1bf9d7){return function(_0x3dbe4f){if(isNotNull(_0x3dbe4f)&&isNotNull(_0x3dbe4f[0x0])){if(_0x3dbe4f[0x0]['contactsRescheduled']>0x0){_0x1bf9d7[_0x2340('0x3b')]=_0x2340('0x9a');logger[_0x2340('0x7e')](_0x2340('0x9b')+_0x1bf9d7['name'],_0x3dbe4f[0x0][_0x2340('0x9c')],_0x2340('0x9d'));}else{_0x1bf9d7['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x2340('0x9e')+_0x1bf9d7[_0x2340('0x3c')]);}}};}function notSendMessagesQueue(_0x3a1d3e){if(_0x3a1d3e[_0x2340('0x9f')]){freeVariablesPredictive(_0x3a1d3e);if(_0x3a1d3e[_0x2340('0x97')]===0x0&&_0x3a1d3e['talking']===0x0&&_0x3a1d3e[_0x2340('0x58')]===0x0&&(_0x3a1d3e[_0x2340('0x51')]||0x0)===0x0){_0x3a1d3e[_0x2340('0x9f')]=![];_0x3a1d3e['available']=0x0;_0x3a1d3e[_0x2340('0x3b')]=_0x2340('0x3e');loggerSyncQueueSummary[_0x2340('0x95')](_0x2340('0xa0'),_0x3a1d3e[_0x2340('0x3c')],_0x2340('0xa1'));}else{_0x3a1d3e[_0x2340('0x3b')]=_0x2340('0xa2');loggerSyncQueueSummary[_0x2340('0x95')](_0x2340('0xa0'),_0x3a1d3e['name'],_0x2340('0xa3'));}emitVoiceQueueSummary(_0x3a1d3e);}}function notSendMessagesCampaign(_0x206166){if(_0x206166['sendMessageOneNotActive']){if(_0x206166[_0x2340('0x97')]===0x0){_0x206166[_0x2340('0x9f')]=![];_0x206166[_0x2340('0x3b')]=_0x2340('0x3e');loggerSyncQueueSummary[_0x2340('0x95')](_0x2340('0xa4'),_0x206166[_0x2340('0x3c')],_0x2340('0xa1'));}else{_0x206166[_0x2340('0x3b')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x2340('0xa4'),_0x206166[_0x2340('0x3c')],_0x2340('0xa3'));}emitCampaignSummary(_0x206166);}}function createObjHistory(_0x234b82,_0x9f39e,_0x337c13,_0x2b2c1b,_0x54b89f){_0x234b82[_0x2340('0x3b')]=_0x337c13;var _0x3ab262=new Action(_0x234b82,_0x9f39e);var _0x432f16=new History(_0x3ab262);_0x432f16[_0x2340('0xa5')]=_0x2b2c1b;_0x432f16[_0x2340('0xa6')]=_0x54b89f;_0x432f16['endtime']=_0x3ab262[_0x2340('0xa7')];return _0x432f16;}Dialer[_0x2340('0xa8')][_0x2340('0xa9')]=function(){var _0x38dddb=this;setInterval(function(){_0x38dddb[_0x2340('0xaa')](_0x38dddb[_0x2340('0x24')],_0x2340('0xab'));_0x38dddb['clearZombieChannels'](_0x38dddb[_0x2340('0x22')],_0x2340('0xac'));},0x32c8);};Dialer[_0x2340('0xa8')][_0x2340('0xaa')]=function(_0x5eb606,_0x3a0302){var _0x1a006a=this;for(var _0x3802fa in _0x5eb606){if(typeof _0x5eb606[_0x3802fa]!=='undefined'){this[_0x2340('0xad')][_0x2340('0x1a')](function(){if(!_[_0x2340('0xae')](_0x5eb606[_0x3802fa])){return ami[_0x2340('0xaf')]({'action':_0x2340('0xb0'),'channel':_0x5eb606[_0x3802fa][_0x2340('0xb1')]})['catch'](function(_0x4e5750){if(_0x4e5750[_0x2340('0x3b')]===_0x2340('0xb2')){setTimeout(function(){if(_0x5eb606[_0x3802fa]&&_0x5eb606[_0x3802fa][_0x2340('0x4b')]!==_0x2340('0x7b')){_0x1a006a[_0x2340('0xb3')](_0x1a006a['voiceQueues'][_0x5eb606[_0x3802fa][_0x2340('0xb4')]]);logger[_0x2340('0x95')](_0x2340('0xb5'),_0x3a0302,_0x3802fa,_0x5eb606[_0x3802fa][_0x2340('0xb4')]);delete _0x5eb606[_0x3802fa];}if(_0x5eb606[_0x3802fa]&&_0x5eb606[_0x3802fa][_0x2340('0x4b')]===_0x2340('0x7b')){_0x1a006a[_0x2340('0xb3')](_0x1a006a[_0x2340('0x1f')][_0x5eb606[_0x3802fa][_0x2340('0xb4')]]);logger['error'](_0x2340('0xb6'),_0x3a0302,_0x3802fa,_0x5eb606[_0x3802fa][_0x2340('0xb4')]);delete _0x5eb606[_0x3802fa];}},0x2328);}});}});}}};Dialer[_0x2340('0xa8')][_0x2340('0xb7')]=function(_0x373083){return BPromise[_0x2340('0xb8')]()['then'](cmHopper[_0x2340('0xb7')](_0x373083))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x2340('0xb9')]=function(_0x4aad2b){return BPromise[_0x2340('0xb8')]()['then'](cmHopperBlack[_0x2340('0xb9')](_0x4aad2b))[_0x2340('0xba')](loggerCatch(_0x2340('0xbb')));};Dialer[_0x2340('0xa8')][_0x2340('0xbc')]=function(_0x310908){return BPromise[_0x2340('0xb8')]()[_0x2340('0xbd')](cmHopperBlack['checkIsBlackListIvr'](_0x310908))[_0x2340('0xba')](loggerCatch(_0x2340('0xbe')));};Dialer[_0x2340('0xa8')]['averageHandleTime']=function(_0x3d6f39){return BPromise[_0x2340('0xb8')]()[_0x2340('0xbd')](cmHopperHistory[_0x2340('0xbf')](_0x3d6f39))[_0x2340('0xba')](loggerCatch(_0x2340('0xc0')));};Dialer[_0x2340('0xa8')][_0x2340('0xc1')]=function(_0x2eafd8){return BPromise[_0x2340('0xb8')]()['then'](cmHopper[_0x2340('0xc1')](_0x2eafd8))['catch'](loggerCatch(_0x2340('0xc2')));};Dialer[_0x2340('0xa8')]['unlockContact']=function(_0x554b61,_0x24e8d8,_0x52d618){return BPromise[_0x2340('0xb8')]()[_0x2340('0xbd')](cmHopper['unlockContact'](_0x554b61,_0x24e8d8,_0x52d618))[_0x2340('0xba')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x2340('0xa8')][_0x2340('0xc3')]=function(_0x46f104,_0x473122,_0x4faff1,_0x1ce6c8,_0x335e64){return BPromise[_0x2340('0xb8')]()[_0x2340('0xbd')](cmHopper['getContactDialer'](_0x46f104,_0x473122,_0x4faff1,_0x1ce6c8))[_0x2340('0xba')](function(_0x5901d1){_0x335e64[_0x2340('0xc4')]-=_0x4faff1;_0x335e64[_0x2340('0xc4')]=_0x335e64[_0x2340('0xc4')]>0x0?_0x335e64[_0x2340('0xc4')]:0x0;loggerCatch(_0x2340('0xc5'))(_0x5901d1);});};Dialer['prototype'][_0x2340('0xc6')]=function(_0x39ed3a,_0x4e38a7,_0x407309,_0x7921d7){return BPromise[_0x2340('0xb8')]()['then'](cmHopper[_0x2340('0xc6')](_0x39ed3a,_0x4e38a7,_0x407309))[_0x2340('0xba')](function(_0x45e0e0){_0x7921d7[_0x2340('0xc4')]-=_0x4e38a7;_0x7921d7[_0x2340('0xc4')]=_0x7921d7[_0x2340('0xc4')]>0x0?_0x7921d7[_0x2340('0xc4')]:0x0;loggerCatch(_0x2340('0xc7'))(_0x45e0e0);});};Dialer['prototype'][_0x2340('0xc8')]=function(_0x531019){return BPromise['resolve']()[_0x2340('0xbd')](voiceQueueRt[_0x2340('0xc8')](_0x531019))[_0x2340('0xba')](loggerCatch(_0x2340('0xc9')));};Dialer['prototype'][_0x2340('0xca')]=function(_0xe2e0a8){return BPromise[_0x2340('0xb8')]()[_0x2340('0xbd')](cmHopper[_0x2340('0xca')](_0xe2e0a8))[_0x2340('0xba')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype']['createHistory']=function(_0x7a73a9){return BPromise[_0x2340('0xb8')]()[_0x2340('0xbd')](cmHopperHistory[_0x2340('0xcb')](_0x7a73a9))[_0x2340('0xba')](loggerCatch(_0x2340('0xcc')));};Dialer[_0x2340('0xa8')]['updateOriginated']=function(_0x152fc5){if(!_['isUndefined'](_0x152fc5)&&_0x152fc5!==null){if(typeof _0x152fc5[_0x2340('0x97')]!==_0x2340('0x98')){if(_0x152fc5[_0x2340('0x97')]>0x0){_0x152fc5[_0x2340('0x97')]-=0x1;}else{logger[_0x2340('0x95')](_0x2340('0xcd'));}}}else{logger[_0x2340('0x95')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x2340('0xa8')]['loggerHandler']=function(_0x51db01,_0x56eb11){var _0x5eef6a=this;return function(_0x6ccd8d){_0x5eef6a[_0x2340('0xb3')](_0x56eb11);logger[_0x2340('0x95')](_0x51db01,util[_0x2340('0x94')](_0x6ccd8d,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x2340('0xce')]=function(_0x511e24,_0x2d82bd,_0x4d99da){var _0x23a9a2={'state':0x19,'statedesc':_0x2340('0xcf')};this['updateOriginated'](_0x2d82bd);this[_0x2340('0xd0')](_[_0x2340('0x8c')](_0x23a9a2,_['pick'](_0x4d99da,[_0x2340('0xd1'),'ListId',_0x2340('0xd2'),_0x2340('0xd3'),'CampaignId'])),'[emptyContact][createHistory]',_0x2340('0xd4'));logger[_0x2340('0x95')](_0x511e24);};Dialer['prototype'][_0x2340('0xd5')]=function(_0x4b5916){return _0x4b5916===_0x2340('0xd6');};Dialer[_0x2340('0xa8')][_0x2340('0xd7')]=function(_0x1407b6){return!_[_0x2340('0x3a')](_0x1407b6)&&_0x1407b6&&!_[_0x2340('0x3a')](_0x1407b6[_0x2340('0x3c')])&&!_[_0x2340('0x3a')](_0x1407b6[_0x2340('0x76')])&&_0x1407b6[_0x2340('0x76')]&&(this['trunks'][util[_0x2340('0x79')](_0x2340('0xd8'),_0x1407b6[_0x2340('0x3c')])]['status']===_0x2340('0xd9')||this[_0x2340('0x20')][util['format'](_0x2340('0xd8'),_0x1407b6[_0x2340('0x3c')])][_0x2340('0xb0')]===_0x2340('0xda'));};Dialer[_0x2340('0xa8')]['saveInDb']=function(_0x25a421,_0x47d2f8,_0x59c191){this[_0x2340('0xcb')](_0x25a421)[_0x2340('0xba')](loggerCatch(_0x47d2f8));this[_0x2340('0xca')](_0x25a421)[_0x2340('0xba')](loggerCatch(_0x59c191));};Dialer[_0x2340('0xa8')][_0x2340('0x35')]=function(_0x453610){var _0x2f51e1=this[_0x2340('0x24')][_0x453610[_0x2340('0xdb')]];var _0x6cd7e1;if(!_[_0x2340('0xae')](_0x453610)&&!_[_0x2340('0xae')](_0x453610[_0x2340('0xdc')])&&!_[_0x2340('0xae')](_0x453610[_0x2340('0xdc')]['amdstatus'])&&_0x453610[_0x2340('0xdd')]===_0x2340('0xde')&&_0x2f51e1){if(_0x2f51e1['type']!==_0x2340('0x7b')&&this[_0x2340('0x1e')][_0x2f51e1[_0x2340('0xb4')]][_0x2340('0xdf')]&&_0x453610['value']===_0x2340('0xe0')){delete this[_0x2340('0x24')][_0x453610[_0x2340('0xdb')]];this[_0x2340('0xb3')](this[_0x2340('0x1e')][_0x2f51e1['queue']]);this[_0x2340('0x1e')][_0x2f51e1[_0x2340('0xb4')]][_0x2340('0x5e')]+=0x1;this[_0x2340('0x1e')][_0x2f51e1[_0x2340('0xb4')]][_0x2340('0x5d')]+=0x1;_0x6cd7e1=new Hangup(_0x2f51e1,_0x453610);_0x6cd7e1['state']=0x12;_0x6cd7e1[_0x2340('0xa6')]=_0x2340('0xe1');_0x6cd7e1[_0x2340('0xe2')]='AMD';ami['emit'](_0x2340('0xe3'),ut[_0x2340('0xe4')](_0x6cd7e1,_0x2340('0xe5')));this[_0x2340('0xd0')](_0x6cd7e1,_0x2340('0xe6'),_0x2340('0xe7'));}if(_0x2f51e1[_0x2340('0x4b')]!==_0x2340('0x7b')&&this[_0x2340('0x1e')][_0x2f51e1['queue']][_0x2340('0xdf')]&&_0x453610[_0x2340('0xe8')]==='MACHINE'){var _0x531da1=this;return new BPromise(function(_0x1f4c30,_0x1bb1d7){delete _0x531da1[_0x2340('0x24')][_0x453610[_0x2340('0xdb')]];_0x531da1[_0x2340('0xb3')](_0x531da1[_0x2340('0x1e')][_0x2f51e1['queue']]);_0x531da1[_0x2340('0x1e')][_0x2f51e1['queue']][_0x2340('0x5e')]+=0x1;_0x531da1['voiceQueues'][_0x2f51e1[_0x2340('0xb4')]][_0x2340('0x5d')]+=0x1;var _0x4aa9de=_0x531da1[_0x2340('0x1e')][_0x2f51e1[_0x2340('0xb4')]];var _0x49ac6b=new Hangup(_0x2f51e1,_0x453610);_0x49ac6b[_0x2340('0xa5')]=0x13;_0x49ac6b[_0x2340('0xa6')]=_0x2340('0xe9');_0x49ac6b[_0x2340('0xe2')]=_0x2340('0xea');_0x49ac6b['countmachineretry']+=0x1;_0x49ac6b[_0x2340('0xeb')]+=0x1;_0x49ac6b[_0x2340('0xe5')]=!![];ami[_0x2340('0x4a')](_0x2340('0xe3'),ut[_0x2340('0xe4')](_0x49ac6b,_0x2340('0xe5')));_0x531da1[_0x2340('0xcb')](_0x49ac6b)['catch'](loggerCatch(_0x2340('0xec')));if(_0x49ac6b[_0x2340('0xed')]+_0x49ac6b[_0x2340('0xee')]+_0x49ac6b[_0x2340('0xef')]+_0x49ac6b[_0x2340('0xf0')]+_0x49ac6b[_0x2340('0xf1')]+_0x49ac6b[_0x2340('0xf2')]+_0x49ac6b[_0x2340('0xf3')]+_0x49ac6b[_0x2340('0xf4')]>=_0x4aa9de['dialGlobalMaxRetry']){_0x531da1[_0x2340('0xf5')](_0x49ac6b,_0x1f4c30,_0x1bb1d7,'reason19\x20machine....');}else{if(_0x49ac6b[_0x2340('0xf3')]>=_0x4aa9de[_0x2340('0xf6')]){_0x531da1['createStateFinal'](_0x49ac6b,_0x1f4c30,_0x1bb1d7,'reason\x2019\x20machine....');}else{_0x531da1['rescheduleContact']({'active':![],'countmachineretry':_0x49ac6b[_0x2340('0xf3')],'scheduledat':moment()[_0x2340('0xf7')](_0x4aa9de[_0x2340('0xf8')],_0x2340('0xf9'))['format'](_0x2340('0xfa')),'ContactId':_0x49ac6b[_0x2340('0xd1')],'ListId':_0x49ac6b[_0x2340('0xfb')],'VoiceQueueId':_0x49ac6b[_0x2340('0xd3')]||undefined,'CampaignId':_0x49ac6b[_0x2340('0xfc')]||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0xfd')));_0x1f4c30({'reschedule':0x1});}}});}if(_0x2f51e1[_0x2340('0x4b')]===_0x2340('0x7b')&&this[_0x2340('0x1f')][_0x2f51e1[_0x2340('0xb4')]][_0x2340('0xdf')]&&_0x453610['value']===_0x2340('0xe0')){delete this[_0x2340('0x24')][_0x453610['uniqueid']];this['updateOriginated'](this[_0x2340('0x1f')][_0x2f51e1[_0x2340('0xb4')]]);_0x6cd7e1=new Hangup(_0x2f51e1,_0x453610);_0x6cd7e1['state']=0x12;_0x6cd7e1[_0x2340('0xa6')]=_0x2340('0xe1');_0x6cd7e1[_0x2340('0xe2')]=_0x2340('0xea');ami[_0x2340('0x4a')](_0x2340('0xe3'),ut[_0x2340('0xe4')](_0x6cd7e1,_0x2340('0xe5')));this['saveInDb'](_0x6cd7e1,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x2f51e1[_0x2340('0x4b')]===_0x2340('0x7b')&&this[_0x2340('0x1f')][_0x2f51e1['queue']][_0x2340('0xdf')]&&_0x453610[_0x2340('0xe8')]===_0x2340('0xfe')){var _0x531da1=this;return new BPromise(function(_0x13fedc,_0x223376){delete _0x531da1['uniqueId'][_0x453610['uniqueid']];_0x531da1[_0x2340('0xb3')](_0x531da1[_0x2340('0x1f')][_0x2f51e1[_0x2340('0xb4')]]);_0x531da1[_0x2340('0x1f')][_0x2f51e1[_0x2340('0xb4')]][_0x2340('0x5e')]+=0x1;_0x531da1['campaigns'][_0x2f51e1['queue']][_0x2340('0x5d')]+=0x1;var _0x3462d5=_0x531da1[_0x2340('0x1f')][_0x2f51e1[_0x2340('0xb4')]];var _0x4ea6b5=new Hangup(_0x2f51e1,_0x453610);_0x4ea6b5[_0x2340('0xa5')]=0x13;_0x4ea6b5[_0x2340('0xa6')]=_0x2340('0xe9');_0x4ea6b5[_0x2340('0xe2')]=_0x2340('0xea');_0x4ea6b5[_0x2340('0xf3')]+=0x1;_0x4ea6b5[_0x2340('0xeb')]+=0x1;_0x4ea6b5['amd']=!![];ami[_0x2340('0x4a')](_0x2340('0xe3'),ut[_0x2340('0xe4')](_0x4ea6b5,_0x2340('0xe5')));_0x531da1[_0x2340('0xcb')](_0x4ea6b5)[_0x2340('0xba')](loggerCatch(_0x2340('0xec')));if(_0x4ea6b5['countbusyretry']+_0x4ea6b5[_0x2340('0xee')]+_0x4ea6b5[_0x2340('0xef')]+_0x4ea6b5['countnosuchnumberretry']+_0x4ea6b5[_0x2340('0xf1')]+_0x4ea6b5['countabandonedretry']+_0x4ea6b5['countmachineretry']+_0x4ea6b5['countagentrejectretry']>=_0x3462d5['dialGlobalMaxRetry']){_0x531da1[_0x2340('0xf5')](_0x4ea6b5,_0x13fedc,_0x223376,_0x2340('0xff'));}else{if(_0x4ea6b5[_0x2340('0xf3')]>=_0x3462d5[_0x2340('0xf6')]){_0x531da1['createStateFinal'](_0x4ea6b5,_0x13fedc,_0x223376,'reason\x2019\x20machine....');}else{_0x531da1['rescheduleContact']({'active':![],'countmachineretry':_0x4ea6b5['countmachineretry'],'scheduledat':moment()[_0x2340('0xf7')](_0x3462d5[_0x2340('0xf8')],_0x2340('0xf9'))[_0x2340('0x79')](_0x2340('0xfa')),'ContactId':_0x4ea6b5[_0x2340('0xd1')],'ListId':_0x4ea6b5['ListId'],'VoiceQueueId':_0x4ea6b5[_0x2340('0xd3')]||undefined,'CampaignId':_0x4ea6b5['CampaignId']||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0xfd')));_0x13fedc({'reschedule':0x1});}}});}}};Dialer[_0x2340('0xa8')][_0x2340('0x100')]=function(_0x12f0b2){var _0x44f76e=this[_0x2340('0x24')][_0x12f0b2[_0x2340('0xdb')]];var _0x21b1ec=this;var _0x572f53;if(_0x44f76e&&_0x44f76e[_0x2340('0x4b')]===_0x2340('0x7b')){delete this[_0x2340('0x24')][_0x12f0b2[_0x2340('0xdb')]];this[_0x2340('0xb3')](this['campaigns'][_0x44f76e['queue']]);this[_0x2340('0x1f')][_0x44f76e[_0x2340('0xb4')]][_0x2340('0x101')]+=0x1;_0x572f53=new Hangup(_0x44f76e,_0x12f0b2);this[_0x2340('0xcb')](_0x572f53)['catch'](loggerCatch(_0x2340('0x102')));this[_0x2340('0xca')](_0x572f53)[_0x2340('0xba')](loggerCatch(_0x2340('0x103')));}if(_0x44f76e&&_0x44f76e[_0x2340('0x4b')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x44f76e[_0x2340('0xb4')]][_0x2340('0x104')])){delete this[_0x2340('0x24')][_0x12f0b2[_0x2340('0xdb')]];this[_0x2340('0xb3')](this['voiceQueues'][_0x44f76e[_0x2340('0xb4')]]);this[_0x2340('0x1e')][_0x44f76e[_0x2340('0xb4')]]['outboundAnswerCallsDay']+=0x1;this[_0x2340('0x1e')][_0x44f76e[_0x2340('0xb4')]][_0x2340('0x5d')]+=0x1;_0x572f53=new Hangup(_0x44f76e,_0x12f0b2);_0x572f53['state']=0x10;_0x572f53[_0x2340('0xa6')]=_0x2340('0x105');_0x572f53[_0x2340('0xe2')]=_0x2340('0x106');this['createHistory'](_0x572f53)[_0x2340('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2340('0xca')](_0x572f53)[_0x2340('0xba')](loggerCatch(_0x2340('0x103')));}if(_0x44f76e&&_0x44f76e['type']!=='ivr'&&!isNotNull(this[_0x2340('0x1e')][_0x44f76e['queue']][_0x2340('0x104')])){delete this[_0x2340('0x24')][_0x12f0b2[_0x2340('0xdb')]];this[_0x2340('0xb3')](this['voiceQueues'][_0x44f76e[_0x2340('0xb4')]]);this[_0x2340('0x1e')][_0x44f76e[_0x2340('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0x572f53=new Hangup(_0x44f76e,_0x12f0b2);_0x572f53[_0x2340('0xa5')]=0xc;_0x572f53[_0x2340('0xa6')]=_0x12f0b2['cause-txt'];_0x572f53[_0x2340('0xe2')]=_0x2340('0x107');this[_0x2340('0xcb')](_0x572f53)['catch'](loggerCatch(_0x2340('0x102')));this[_0x2340('0xca')](_0x572f53)[_0x2340('0xba')](loggerCatch(_0x2340('0x103')));}};Dialer[_0x2340('0xa8')][_0x2340('0x2f')]=function(_0x271e08){var _0xf0485=this[_0x2340('0x24')][_0x271e08[_0x2340('0xdb')]];var _0x5ecfe3=this;if(this['voiceQueues'][_0x271e08[_0x2340('0xb4')]]){if(_0xf0485&&_0xf0485[_0x2340('0x4b')]!==_0x2340('0x7b')){delete this[_0x2340('0x24')][_0x271e08[_0x2340('0xdb')]];this[_0x2340('0x1e')][_0x271e08[_0x2340('0xb4')]][_0x2340('0x5e')]+=0x1;var _0x5acfde=new AgentComplete(_0xf0485,_0x271e08);if(_0x271e08[_0x2340('0x108')]===_0x2340('0x109')){_0x5acfde[_0x2340('0x10a')]=this['voiceQueues'][_0x271e08['queue']]['dialQueueProject2']&&this[_0x2340('0x1e')][_0x271e08['queue']]['dialAgiAfterHangupAgent']?moment()[_0x2340('0x79')](_0x2340('0xfa')):undefined;}this['createHistory'](_0x5acfde)[_0x2340('0xba')](loggerCatch(_0x2340('0x10b')));this[_0x2340('0xca')](_0x5acfde)['catch'](loggerCatch(_0x2340('0x10c')));}}};Dialer[_0x2340('0xa8')]['syncAgentConnect']=function(_0x395694){if(this[_0x2340('0x1e')][_0x395694[_0x2340('0xb4')]]){if(this[_0x2340('0x24')][_0x395694[_0x2340('0xdb')]]&&this['uniqueId'][_0x395694[_0x2340('0xdb')]][_0x2340('0x4b')]!==_0x2340('0x7b')){this[_0x2340('0xb3')](this[_0x2340('0x1e')][_0x395694[_0x2340('0xb4')]]);this[_0x2340('0x24')][_0x395694[_0x2340('0xdb')]][_0x2340('0x10d')]=moment()[_0x2340('0x79')](_0x2340('0xfa'));}}};Dialer[_0x2340('0xa8')][_0x2340('0x10e')]=function(_0x38a262){this['createHistory'](_0x38a262)[_0x2340('0xba')](loggerCatch(_0x2340('0x10b')));this['moveContactManagedDialer'](_0x38a262)[_0x2340('0xba')](loggerCatch(_0x2340('0x10f')));};Dialer[_0x2340('0xa8')]['syncQueueCallerAbandon']=function(_0x3d7e8f){var _0x44c8c2=this[_0x2340('0x24')][_0x3d7e8f['uniqueid']];var _0xc3aaa3=this;if(this['voiceQueues'][_0x3d7e8f[_0x2340('0xb4')]]){if(_0x44c8c2&&_0x44c8c2[_0x2340('0x4b')]!==_0x2340('0x7b')){delete this['uniqueId'][_0x3d7e8f['uniqueid']];this[_0x2340('0xb3')](this[_0x2340('0x1e')][_0x3d7e8f[_0x2340('0xb4')]]);_0x44c8c2[_0x2340('0x110')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xcc8d35=new QueueCallerAbandon(_0x44c8c2,_0x3d7e8f);if(getSeconds(_0x44c8c2[_0x2340('0x110')],_0x44c8c2[_0x2340('0x111')])>=_0x44c8c2[_0x2340('0x112')]){this[_0x2340('0x1e')][_0x3d7e8f[_0x2340('0xb4')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2340('0x1e')][_0x3d7e8f[_0x2340('0xb4')]][_0x2340('0x62')]+=0x1;this[_0x2340('0x1e')][_0x3d7e8f['queue']][_0x2340('0x6b')]+=0x1;_0xcc8d35[_0x2340('0xa5')]=0xa;_0xcc8d35[_0x2340('0xa6')]=_0x2340('0x113');_0xcc8d35[_0x2340('0x114')]=_0x2340('0x115');_0xcc8d35[_0x2340('0x10a')]=this['voiceQueues'][_0x3d7e8f[_0x2340('0xb4')]][_0x2340('0x116')]?moment()[_0x2340('0x79')](_0x2340('0xfa')):undefined;_0xcc8d35['countdropretry']+=0x1;_0xcc8d35[_0x2340('0xeb')]+=0x1;if(_0xcc8d35[_0x2340('0xf1')]>=this[_0x2340('0x1e')][_0x3d7e8f['queue']][_0x2340('0x117')]){this[_0x2340('0x10e')](_0xcc8d35);}else{this[_0x2340('0xc1')]({'active':![],'countdropretry':_0xcc8d35['countdropretry'],'scheduledat':moment()['add'](this[_0x2340('0x1e')][_0x3d7e8f[_0x2340('0xb4')]][_0x2340('0x118')],_0x2340('0xf9'))[_0x2340('0x79')](_0x2340('0xfa')),'ContactId':_0x44c8c2[_0x2340('0xd1')],'ListId':_0x44c8c2[_0x2340('0xfb')],'VoiceQueueId':_0x44c8c2[_0x2340('0xd3')]||undefined,'CampaignId':_0x44c8c2[_0x2340('0xfc')]||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0x119')));var _0x6c003f=new History(_0xcc8d35);_0x6c003f['state']=0xa;_0x6c003f[_0x2340('0xa6')]=_0x2340('0x113');_0x6c003f[_0x2340('0xa7')]=moment()[_0x2340('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x6c003f['endtime']=_0x6c003f['starttime'];_0x6c003f['calleridname']=_0xcc8d35['calleridname'];_0x6c003f[_0x2340('0x11a')]=_0xcc8d35[_0x2340('0x11a')];this[_0x2340('0xcb')](_0x6c003f)[_0x2340('0xba')](loggerCatch(_0x2340('0x11b')));}}else{this['voiceQueues'][_0x3d7e8f[_0x2340('0xb4')]][_0x2340('0x68')]+=0x1;this[_0x2340('0x1e')][_0x3d7e8f['queue']][_0x2340('0x61')]+=0x1;_0xcc8d35['state']=0xb;_0xcc8d35[_0x2340('0xa6')]=_0x2340('0x11c');_0xcc8d35[_0x2340('0x114')]=_0x2340('0x11d');_0xcc8d35[_0x2340('0xf2')]+=0x1;_0xcc8d35[_0x2340('0xeb')]+=0x1;if(_0xcc8d35[_0x2340('0xf2')]>=this[_0x2340('0x1e')][_0x3d7e8f['queue']][_0x2340('0x11e')]){this[_0x2340('0x10e')](_0xcc8d35);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0xcc8d35[_0x2340('0xf2')],'scheduledat':moment()[_0x2340('0xf7')](this[_0x2340('0x1e')][_0x3d7e8f[_0x2340('0xb4')]][_0x2340('0x11f')],_0x2340('0xf9'))[_0x2340('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44c8c2[_0x2340('0xd1')],'ListId':_0x44c8c2['ListId'],'VoiceQueueId':_0x44c8c2[_0x2340('0xd3')]||undefined,'CampaignId':_0x44c8c2[_0x2340('0xfc')]||undefined})['catch'](loggerCatch(_0x2340('0x120')));var _0x6c003f=new History(_0xcc8d35);_0x6c003f[_0x2340('0xa5')]=0xb;_0x6c003f[_0x2340('0xa6')]=_0x2340('0x11c');_0x6c003f['starttime']=moment()[_0x2340('0x79')](_0x2340('0xfa'));_0x6c003f[_0x2340('0x121')]=_0x6c003f[_0x2340('0xa7')];_0x6c003f['calleridname']=_0xcc8d35[_0x2340('0x122')];_0x6c003f[_0x2340('0x11a')]=_0xcc8d35['calleridnum'];this['createHistory'](_0x6c003f)[_0x2340('0xba')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0x2340('0x33')]=function(_0x2d8c7b){if(this[_0x2340('0x22')][_0x2d8c7b[_0x2340('0xdb')]]){this[_0x2340('0x22')][_0x2d8c7b['uniqueid']][_0x2340('0xb1')]=_0x2d8c7b[_0x2340('0xb1')];}if(this[_0x2340('0x24')][_0x2d8c7b[_0x2340('0xdb')]]){this['uniqueId'][_0x2d8c7b[_0x2340('0xdb')]]['channel']=_0x2d8c7b['channel'];}};Dialer[_0x2340('0xa8')][_0x2340('0x37')]=function(_0x11eb3a){if(strategy[this[_0x2340('0x1e')][this[_0x2340('0x22')][_0x11eb3a[_0x2340('0x123')]][_0x2340('0xb4')]][_0x2340('0x4d')]]===_0x2340('0x19')){if(this[_0x2340('0x22')][_0x11eb3a[_0x2340('0x123')]]&&_['isNil'](this[_0x2340('0x22')][_0x11eb3a[_0x2340('0x123')]][_0x2340('0x124')])&&_0x11eb3a[_0x2340('0xb0')]==='1'&&_0x11eb3a['paused']==='0'){if(this['agents'][_0x11eb3a[_0x2340('0x125')]]){if(!this[_0x2340('0x126')][_0x11eb3a[_0x2340('0x125')]][_0x2340('0x124')]){this[_0x2340('0x126')][_0x11eb3a[_0x2340('0x125')]][_0x2340('0x124')]=!![];this[_0x2340('0x22')][_0x11eb3a['actionid']][_0x2340('0x124')]=!![];this[_0x2340('0x22')][_0x11eb3a[_0x2340('0x123')]]['stateinterface']=_0x11eb3a[_0x2340('0x125')];}}}}else if((strategy[this['voiceQueues'][this[_0x2340('0x22')][_0x11eb3a['actionid']][_0x2340('0xb4')]][_0x2340('0x4d')]]||'rrmemory')===_0x2340('0x18')){if(this[_0x2340('0x22')][_0x11eb3a['actionid']]){if(this[_0x2340('0x126')][_0x11eb3a[_0x2340('0x125')]]){this[_0x2340('0x22')][_0x11eb3a['actionid']][_0x2340('0x125')]=_0x11eb3a[_0x2340('0x125')];if(_[_0x2340('0xae')](this[_0x2340('0x127')][this[_0x2340('0x22')][_0x11eb3a[_0x2340('0x123')]][_0x2340('0xb4')]])){this[_0x2340('0x127')][this[_0x2340('0x22')][_0x11eb3a[_0x2340('0x123')]][_0x2340('0xb4')]]=[];}this[_0x2340('0x127')][this[_0x2340('0x22')][_0x11eb3a[_0x2340('0x123')]][_0x2340('0xb4')]][_0x2340('0x128')](_['merge'](_['pick'](this[_0x2340('0x22')][_0x11eb3a[_0x2340('0x123')]],[_0x2340('0x129'),'stateinterface']),{'status':_0x11eb3a[_0x2340('0xb0')],'paused':_0x11eb3a[_0x2340('0x12a')]}));}}}};function unlockQueueStatus(_0x5cf5f0,_0x34f17a){setTimeout(function(){if(_[_0x2340('0x3a')](_0x5cf5f0[_0x2340('0x12b')])){loggerBooked[_0x2340('0x95')](_0x2340('0x12c'),_0x34f17a);}_0x5cf5f0[_0x2340('0x12b')]=!![];loggerBooked[_0x2340('0x7e')](_0x2340('0x12d'),_0x34f17a,JSON[_0x2340('0x47')](_['pick'](_0x5cf5f0,[_0x2340('0x3c'),_0x2340('0x12b')])));},0x1f3);}Dialer[_0x2340('0xa8')]['syncQueueStatusComplete']=function(_0x476e0b){var _0x423e63=this;var _0x45b6b5=_0x423e63[_0x2340('0x1e')][_0x423e63['actions'][_0x476e0b[_0x2340('0x123')]][_0x2340('0xb4')]];if(strategy[this[_0x2340('0x1e')][this[_0x2340('0x22')][_0x476e0b['actionid']][_0x2340('0xb4')]]['strategy']]===_0x2340('0x19')){if(this[_0x2340('0x22')][_0x476e0b['actionid']]&&this[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]]['stateinterface']){this['preview'][_0x2340('0x12e')](this[_0x2340('0x22')][_0x476e0b['actionid']][_0x2340('0x129')],this[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]][_0x2340('0x125')])[_0x2340('0xba')](function(_0x2e0b61){logger['error'](_0x2340('0x12f'),util[_0x2340('0x94')](_0x2e0b61,{'showHidden':![],'depth':null}));})[_0x2340('0x1c')](function(){_0x423e63['updateOriginated'](_0x423e63[_0x2340('0x1e')][_0x423e63[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]][_0x2340('0xb4')]]);_0x423e63['agents'][_0x423e63[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]]['stateinterface']]['locked']=![];delete _0x423e63[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]];unlockQueueStatus(_0x45b6b5);});}else{this[_0x2340('0xb3')](this['voiceQueues'][this[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]][_0x2340('0xb4')]]);this[_0x2340('0xc1')]({'active':![],'ContactId':this[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]][_0x2340('0xd1')],'ListId':this[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]][_0x2340('0xfb')],'VoiceQueueId':this['actions'][_0x476e0b['actionid']]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x476e0b[_0x2340('0x123')]]['CampaignId']||undefined})[_0x2340('0xba')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]];unlockQueueStatus(_0x45b6b5);}}else if((strategy[this[_0x2340('0x1e')][this[_0x2340('0x22')][_0x476e0b['actionid']]['queue']][_0x2340('0x4d')]]||'rrmemory')===_0x2340('0x18')){var _0x419e2c;if(this[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]]&&!_[_0x2340('0x44')](this[_0x2340('0x127')][this[_0x2340('0x22')][_0x476e0b['actionid']][_0x2340('0xb4')]])){if(this[_0x2340('0x27')][_0x423e63[_0x2340('0x22')][_0x476e0b['actionid']][_0x2340('0xb4')]]){this[_0x2340('0x27')][_0x423e63[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]][_0x2340('0xb4')]]=this['queueBookedRR'][this[_0x2340('0x22')][_0x476e0b[_0x2340('0x123')]][_0x2340('0xb4')]]?this[_0x2340('0x27')][this['actions'][_0x476e0b[_0x2340('0x123')]]['queue']]:this[_0x2340('0x127')][this[_0x2340('0x22')][_0x476e0b['actionid']][_0x2340('0xb4')]]?this[_0x2340('0x127')][this['actions'][_0x476e0b[_0x2340('0x123')]][_0x2340('0xb4')]][_0x2340('0x130')]||0x0:0x0;}this[_0x2340('0x127')][this['actions'][_0x476e0b[_0x2340('0x123')]][_0x2340('0xb4')]][_0x2340('0x130')]=this[_0x2340('0x27')][this[_0x2340('0x22')][_0x476e0b['actionid']]['queue']];for(var _0x93bce6=0x0;_0x93bce6=0x0;})[_0x2340('0xba')](myreject(_0x593df8)));}}else{_0x42f050[_0x2340('0x128')](ami[_0x2340('0xaf')]({'action':_0x2340('0x145'),'command':util[_0x2340('0x79')](_0x2340('0x146'),_0x49fc5b,!_[_0x2340('0x3a')](config['timezones'][_0x168412])?_0x168412:'')})[_0x2340('0xbd')](function(_0x1bdaf4){return _0x1bdaf4['content']['indexOf'](_0x2340('0x149'))>=0x0;})['catch'](myreject(_0x593df8)));}BPromise[_0x2340('0x14a')](_0x42f050)[_0x2340('0xbd')](function(_0x14e086){var _0x3a0f28=_[_0x2340('0x14b')](_0x14e086);if(_0x3a0f28){return _0x37c98c(_0x3a0f28);}else{_0x30f4af[_0x2340('0x3b')]=_0x1373c6?_0x2340('0x14c'):_0x2340('0x14d');return _0x593df8(msgResponse(_0x2340('0x14e'),_0x2340('0x140'),_0x2340('0x14f')+_0x1373c6+'\x20'+_0x15d256+_0x2340('0x150')+util['inspect'](_0x49fc5b,{'showHidden':![],'depth':null})+_0x2340('0x151')+_0x168412));}})[_0x2340('0xba')](function(_0x579642){return _0x593df8(msgResponse(_0x2340('0x13e'),'Failure',JSON['stringify'](_0x579642)));});});};Dialer['prototype'][_0x2340('0x152')]=function(_0x2b7a9c){var _0x39e05f=this;return function(){switch(_0x2b7a9c[_0x2340('0x153')]){case _0x2340('0x154'):freeVariablesPredictive(_0x2b7a9c);_0x39e05f['handlePower'](_0x2b7a9c,0x1);break;case _0x2340('0x155'):freeVariablesPredictive(_0x2b7a9c);_0x39e05f['handlePower'](_0x2b7a9c,_0x2b7a9c[_0x2340('0x156')]);break;case _0x2340('0x8'):_0x39e05f[_0x2340('0x8')](_0x2b7a9c);break;case _0x2340('0x157'):freeVariablesPredictive(_0x2b7a9c);_0x39e05f[_0x2340('0x158')](_0x2b7a9c,0x1);break;default:freeVariablesPredictive(_0x2b7a9c);logger['error'](_0x2340('0x159'),_0x2b7a9c[_0x2340('0x3c')],_0x2340('0x15a'));}};};Dialer[_0x2340('0xa8')]['launchHandleIvr']=function(_0x208c9b){var _0x3f6849=this;return function(){_0x3f6849['handleIvr'](_0x208c9b);};};Dialer['prototype'][_0x2340('0xa')]=function(_0x276fa6){var _0xfa6169=this;if(isNotPreview(_0x276fa6['dialMethod'])){if(isVoiceQueueOutbound(_0x276fa6['type'])&&isActive(_0x276fa6[_0x2340('0x15b')])){_0x276fa6[_0x2340('0x9f')]=!![];BPromise[_0x2340('0xb8')]()[_0x2340('0xbd')](checkIsLoggedIn(_0x276fa6,_0x276fa6['loggedIn']))[_0x2340('0xbd')](checkIsActive(_0x276fa6,_0x276fa6[_0x2340('0x15b')]))['then'](checkInterval(_0x276fa6))['then'](_0xfa6169[_0x2340('0x13a')](_0x276fa6))['then'](_0xfa6169[_0x2340('0x13d')](_0x276fa6[_0x2340('0x15c')],_0x276fa6[_0x2340('0x15d')],_0x276fa6['name'],_0x276fa6))[_0x2340('0xbd')](_0xfa6169[_0x2340('0x13f')](_0x276fa6[_0x2340('0x40')],_0x276fa6[_0x2340('0x15d')],_0x276fa6[_0x2340('0x3c')],_0x276fa6))[_0x2340('0xbd')](_0xfa6169[_0x2340('0x152')](_0x276fa6))[_0x2340('0xba')](loggerCatchQueueSummary('[syncQueueSummary]',_0x276fa6));}else{notSendMessagesQueue(_0x276fa6);}}else{freeVariablesPredictive(_0x276fa6);}};Dialer[_0x2340('0xa8')]['syncCampaigns']=function(){var _0x4c6723=this;var _0x349504;for(var _0x2fbd89 in this[_0x2340('0x1f')]){if(typeof this[_0x2340('0x1f')][_0x2fbd89]!=='undefined'){_0x349504=this[_0x2340('0x1f')][_0x2fbd89];if(isCampaignIvr(_0x349504[_0x2340('0x4b')])&&isActive(_0x349504[_0x2340('0x76')])){_0x349504[_0x2340('0x9f')]=!![];BPromise['resolve']()[_0x2340('0xbd')](checkIsActive(_0x349504,_0x349504[_0x2340('0x76')]))['then'](checkInterval(_0x349504))[_0x2340('0xbd')](_0x4c6723[_0x2340('0x13a')](_0x349504))[_0x2340('0xbd')](_0x4c6723[_0x2340('0x13d')](_0x349504[_0x2340('0x15c')],_0x349504[_0x2340('0x15d')],_0x349504[_0x2340('0x3c')],_0x349504))['then'](_0x4c6723[_0x2340('0x13f')](_0x349504[_0x2340('0x40')],_0x349504[_0x2340('0x15d')],_0x349504[_0x2340('0x3c')],_0x349504))[_0x2340('0xbd')](_0x4c6723[_0x2340('0x15e')](_0x349504))[_0x2340('0xba')](loggerCatchQueueSummary('[syncCampaigns]',_0x349504));}else{notSendMessagesCampaign(_0x349504);}}}};function getCallerIdRandom(_0x48b902,_0x3309f1){var _0x45d87f;var _0x5c738d;var _0xa19ddd;if(_0x3309f1<=0x0){_0x3309f1=0x1;}_0x45d87f=new RegExp(_0x2340('0x15f')+_0x3309f1+'}$');_0x5c738d=Math[_0x2340('0x160')](0xa,_0x3309f1-0x1);_0xa19ddd=Math[_0x2340('0x160')](0xa,_0x3309f1)-0x1;return util[_0x2340('0x79')]('%s',_[_0x2340('0x161')](_0x48b902,_0x45d87f,_[_0x2340('0x162')](_0x5c738d,_0xa19ddd)));}function extractCalleridName(_0x26b93f){var _0x3d24a5=_0x26b93f[_0x2340('0x163')](/"(.*?)"/);return _0x3d24a5?_0x3d24a5[0x1]:_0x26b93f;}function extractCalleridNumber(_0x17a2dd){var _0x3b2b20=_0x17a2dd[_0x2340('0x163')](/<(.*?)>/);return _0x3b2b20?_0x3b2b20[0x1]:_0x17a2dd;}Dialer['prototype']['actionOriginate']=function(_0x9dd80a,_0x6eb503){var _0x439aea=this;var _0x130f8b=uuid['v4']();this['actions'][_0x130f8b]=new Action(_0x9dd80a,_0x6eb503,_0x130f8b);return new BPromise(function(_0x333e29,_0x1e17cc){if(_[_0x2340('0x3a')](_0x9dd80a)&&typeof _0x9dd80a!==_0x2340('0x164')){return _0x1e17cc(msgResponse(_0x2340('0x165'),_0x2340('0x140'),_0x2340('0x166')));}if(_['isUndefined'](_0x6eb503['Contact'][_0x2340('0x167')])||_0x6eb503[_0x2340('0x168')][_0x2340('0x167')]===null){return _0x1e17cc(msgResponse(_0x2340('0x165'),_0x2340('0x140'),'contact\x20is\x20undefine'));}var _0x2cede7={'XMD-CALLERID':_0x439aea['actions'][_0x130f8b][_0x2340('0x169')](),'XMD-AGI':_0x9dd80a[_0x2340('0x104')]?util[_0x2340('0x79')](_0x2340('0x16a'),ipAgi,_0x9dd80a[_0x2340('0x104')]):_0x2340('0x16b'),'XMD-AGIAFTER':_0x9dd80a['dialQueueProject2']?util[_0x2340('0x79')](_0x2340('0x16a'),ipAgi,_0x9dd80a[_0x2340('0x116')]):'NONE','XMD-QUEUE':_0x9dd80a['type']==='outbound'?util[_0x2340('0x79')](_0x2340('0x16c'),_0x9dd80a[_0x2340('0x3c')],_0x9dd80a[_0x2340('0x16d')]||'',_0x9dd80a[_0x2340('0x16e')]?'c':'',_0x9dd80a[_0x2340('0x112')]||0x3):_0x2340('0x16b'),'XMD-CONTACTID':_0x6eb503[_0x2340('0xd1')],'XMD-CDRTYPE':_0x2340('0x7'),'CALLERID(all)':_0x439aea[_0x2340('0x22')][_0x130f8b][_0x2340('0x169')](),'XMD-AMD':_0x9dd80a[_0x2340('0xdf')]?_0x2340('0x16f'):_0x2340('0x16b'),'XMD-DESTINATION':_0x2340('0xde')};if(_0x9dd80a[_0x2340('0xdf')]){_0x2cede7[_0x2340('0x170')]=_0x9dd80a[_0x2340('0x171')]||0x9c4;_0x2cede7[_0x2340('0x172')]=_0x9dd80a[_0x2340('0x173')]||0x5dc;_0x2cede7[_0x2340('0x174')]=_0x9dd80a[_0x2340('0x175')]||0x320;_0x2cede7[_0x2340('0x176')]=_0x9dd80a[_0x2340('0x177')]||0x1388;_0x2cede7['XMD-AMDMINWORDLENGTH']=_0x9dd80a['dialAMDMinWordLength']||0x64;_0x2cede7[_0x2340('0x178')]=_0x9dd80a['dialAMDBetweenWordsSilence']||0x32;_0x2cede7[_0x2340('0x179')]=_0x9dd80a[_0x2340('0x17a')]||0x3;_0x2cede7[_0x2340('0x17b')]=_0x9dd80a[_0x2340('0x17c')]||0x100;_0x2cede7['XMD-AMDMAXIMUMWORDLENGTH']=_0x9dd80a['dialAMDMaximumWordLength']||0x1388;}if(_0x9dd80a[_0x2340('0x4b')]===_0x2340('0x4c')){_0x2cede7[_0x2340('0x17d')]=_0x6eb503[_0x2340('0xd3')];}else{_0x2cede7['XMD-CAMPAIGNID']=_0x6eb503[_0x2340('0xfc')];}for(var _0x54001d in _0x6eb503[_0x2340('0x168')]){if(typeof _0x6eb503[_0x2340('0x168')][_0x54001d]!==_0x2340('0x98')){if(isNotNull(_0x6eb503[_0x2340('0x168')][_0x54001d])&&_0x54001d!=='id'&&_0x54001d!==_0x2340('0x17e')&&_0x54001d!==_0x2340('0x17f')&&_0x54001d!==_0x2340('0x180')){_0x2cede7[util[_0x2340('0x79')](_0x2340('0x181'),_0x2340('0x182'),_[_0x2340('0x183')](_0x54001d))]=_0x6eb503[_0x2340('0x168')][_0x54001d];}}}var _0x274cfb=_0x439aea[_0x2340('0xd7')](_0x9dd80a[_0x2340('0x75')])?getCallerId(_0x9dd80a[_0x2340('0x75')][_0x2340('0x77')],_0x9dd80a[_0x2340('0x5a')],_0x9dd80a[_0x2340('0x184')]>0x0?getCallerIdRandom(_0x9dd80a['dialOriginateCallerIdNumber'],_0x9dd80a[_0x2340('0x184')]):_0x9dd80a[_0x2340('0x185')]):getCallerId(_[_0x2340('0xae')](_0x9dd80a[_0x2340('0x13b')])?_0x9dd80a[_0x2340('0x75')][_0x2340('0x77')]:_0x9dd80a[_0x2340('0x13b')][_0x2340('0x77')],_0x9dd80a[_0x2340('0x5a')],_0x9dd80a[_0x2340('0x184')]>0x0?getCallerIdRandom(_0x9dd80a[_0x2340('0x185')],_0x9dd80a['dialRandomLastDigitCallerIdNumber']):_0x9dd80a[_0x2340('0x185')]);if(_0x274cfb){_0x2cede7[_0x2340('0x186')]=_0x439aea[_0x2340('0x22')][_0x130f8b][_0x2340('0x187')]=extractCalleridName(_0x274cfb);_0x2cede7[_0x2340('0x188')]=_0x439aea[_0x2340('0x22')][_0x130f8b]['originatecalleridnum']=extractCalleridNumber(_0x274cfb);}return ami[_0x2340('0xaf')]({'actionid':_0x130f8b,'action':_0x2340('0x165'),'channel':_0x439aea[_0x2340('0xd7')](_0x9dd80a[_0x2340('0x75')])?util[_0x2340('0x79')](_0x2340('0x189'),_0x9dd80a[_0x2340('0x75')][_0x2340('0x3c')],isNotNull(_0x9dd80a[_0x2340('0x5c')])?_0x9dd80a[_0x2340('0x5c')][_0x2340('0x18a')]()||'':'',_0x9dd80a['dialCutDigit']>0x0?_0x6eb503[_0x2340('0x168')][_0x2340('0x167')][_0x2340('0x18b')](_0x9dd80a[_0x2340('0x18c')]):_0x6eb503[_0x2340('0x168')]['phone']):util[_0x2340('0x79')](_0x2340('0x189'),_[_0x2340('0xae')](_0x9dd80a[_0x2340('0x13b')])?_0x9dd80a[_0x2340('0x75')][_0x2340('0x3c')]:_0x9dd80a['TrunkBackup'][_0x2340('0x3c')],isNotNull(_0x9dd80a[_0x2340('0x5c')])?_0x9dd80a['dialPrefix'][_0x2340('0x18a')]()||'':'',_0x9dd80a[_0x2340('0x18c')]>0x0?_0x6eb503['Contact'][_0x2340('0x167')][_0x2340('0x18b')](_0x9dd80a[_0x2340('0x18c')]):_0x6eb503[_0x2340('0x168')][_0x2340('0x167')]),'callerid':_0x274cfb,'Exten':_0x2340('0xde'),'Context':_0x2340('0x18d'),'Priority':'1','variable':_0x2cede7,'timeout':(_0x9dd80a['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x130f8b})[_0x2340('0xbd')](function(_0x53d0f4){return _0x333e29(_0x53d0f4);})['catch'](function(_0x46ab9a){_0x9dd80a[_0x2340('0x64')]+=0x1;var _0x304075=new History(_0x439aea['actions'][_0x130f8b]);logger[_0x2340('0x95')](util[_0x2340('0x79')](_0x2340('0x18e'),JSON[_0x2340('0x47')](_0x46ab9a)));_0x304075['state']=0xe;_0x304075['statedesc']=_0x2340('0x18f');_0x304075[_0x2340('0xa7')]=moment()[_0x2340('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x304075[_0x2340('0x121')]=_0x304075[_0x2340('0xa7')];_0x439aea[_0x2340('0xcb')](_0x304075)[_0x2340('0xba')](loggerCatch(_0x2340('0x190')));_0x439aea[_0x2340('0xca')](_0x304075)['catch'](loggerCatch('[originate][error]'))[_0x2340('0x1c')](function(){delete _0x439aea[_0x2340('0x22')][_0x130f8b];return _0x1e17cc(msgResponse(_0x2340('0x165'),_0x2340('0x46'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x2340('0x191')]=function(_0x1cde18){var _0x5bf576=this[_0x2340('0x22')][_0x1cde18[_0x2340('0x123')]];if(_0x5bf576){delete this['actions'][_0x1cde18[_0x2340('0x123')]];_0x5bf576['responsetime']=moment()[_0x2340('0x79')](_0x2340('0xfa'));var _0xa13481=_0x5bf576[_0x2340('0x4b')]==='ivr'?this[_0x2340('0x1f')][_0x5bf576[_0x2340('0xb4')]]:this[_0x2340('0x1e')][_0x5bf576[_0x2340('0x192')]()];if(!this[_0x2340('0xd5')](_0x1cde18[_0x2340('0x193')])){this[_0x2340('0xb3')](_0xa13481);return this[_0x2340('0x194')](_0x5bf576,_0xa13481,_0x1cde18)[_0x2340('0xba')](loggerCatch(_0x2340('0x195')));}this[_0x2340('0x24')][_0x1cde18[_0x2340('0xdb')]]=_0x5bf576;}};Dialer[_0x2340('0xa8')][_0x2340('0x196')]=function(_0x263007,_0x47a0ea,_0x1559a6){var _0x183114=new History(_0x47a0ea);if(_0x183114[_0x2340('0xed')]+_0x183114[_0x2340('0xee')]+_0x183114[_0x2340('0xef')]+_0x183114['countnosuchnumberretry']+_0x183114[_0x2340('0xf1')]+_0x183114[_0x2340('0xf2')]+_0x183114[_0x2340('0xf3')]+_0x183114[_0x2340('0xf4')]>=_0x1559a6[_0x2340('0x197')]-0x1){return!![];}switch(_0x263007){case 0x3:if(_0x183114[_0x2340('0xef')]>=_0x1559a6[_0x2340('0x198')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x183114[_0x2340('0xef')]+=0x1,'scheduledat':moment()[_0x2340('0xf7')](_0x1559a6[_0x2340('0x199')],_0x2340('0xf9'))[_0x2340('0x79')](_0x2340('0xfa')),'ContactId':_0x183114[_0x2340('0xd1')],'ListId':_0x183114[_0x2340('0xfb')],'VoiceQueueId':_0x183114[_0x2340('0xd3')]||undefined,'CampaignId':_0x183114[_0x2340('0xfc')]||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0x19a')));break;case 0x5:if(_0x183114[_0x2340('0xed')]>=_0x1559a6[_0x2340('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x183114[_0x2340('0xed')]+=0x1,'scheduledat':moment()[_0x2340('0xf7')](_0x1559a6[_0x2340('0x19c')],_0x2340('0xf9'))[_0x2340('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x183114[_0x2340('0xd1')],'ListId':_0x183114[_0x2340('0xfb')],'VoiceQueueId':_0x183114[_0x2340('0xd3')]||undefined,'CampaignId':_0x183114[_0x2340('0xfc')]||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0x19d')));break;case 0x8:if(_0x183114[_0x2340('0xee')]>=_0x1559a6[_0x2340('0x19e')]-0x1){return!![];}this[_0x2340('0xc1')]({'active':![],'countcongestionretry':_0x183114[_0x2340('0xee')]+=0x1,'scheduledat':moment()['add'](_0x1559a6[_0x2340('0x19f')],_0x2340('0xf9'))['format'](_0x2340('0xfa')),'ContactId':_0x183114['ContactId'],'ListId':_0x183114['ListId'],'VoiceQueueId':_0x183114[_0x2340('0xd3')]||undefined,'CampaignId':_0x183114[_0x2340('0xfc')]||undefined})['catch'](loggerCatch(_0x2340('0x1a0')));break;case 0x0:if(_0x183114[_0x2340('0xf0')]>=_0x1559a6[_0x2340('0x1a1')]-0x1){return!![];}else{this[_0x2340('0xc1')]({'active':![],'countnosuchnumberretry':_0x183114[_0x2340('0xf0')]+=0x1,'scheduledat':moment()[_0x2340('0xf7')](_0x1559a6[_0x2340('0x1a2')],'minutes')[_0x2340('0x79')](_0x2340('0xfa')),'ContactId':_0x183114[_0x2340('0xd1')],'ListId':_0x183114[_0x2340('0xfb')],'VoiceQueueId':_0x183114[_0x2340('0xd3')]||undefined,'CampaignId':_0x183114[_0x2340('0xfc')]||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0x1a3')));}break;case 0xa:if(_0x183114[_0x2340('0xf1')]>=_0x1559a6[_0x2340('0x117')]-0x1){return!![];}this[_0x2340('0xc1')]({'active':![],'countdropretry':_0x183114[_0x2340('0xf1')]+=0x1,'scheduledat':moment()[_0x2340('0xf7')](_0x1559a6[_0x2340('0x118')],_0x2340('0xf9'))['format'](_0x2340('0xfa')),'ContactId':_0x183114[_0x2340('0xd1')],'ListId':_0x183114[_0x2340('0xfb')],'VoiceQueueId':_0x183114['VoiceQueueId']||undefined,'CampaignId':_0x183114['CampaignId']||undefined})['catch'](loggerCatch(_0x2340('0x119')));break;case 0xb:if(_0x183114[_0x2340('0xf2')]>=_0x1559a6[_0x2340('0x11e')]-0x1){return!![];}this[_0x2340('0xc1')]({'active':![],'countabandonedretry':_0x183114['countabandonedretry']+=0x1,'scheduledat':moment()[_0x2340('0xf7')](_0x1559a6[_0x2340('0x11f')],'minutes')[_0x2340('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x183114[_0x2340('0xd1')],'ListId':_0x183114[_0x2340('0xfb')],'VoiceQueueId':_0x183114[_0x2340('0xd3')]||undefined,'CampaignId':_0x183114['CampaignId']||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0x120')));break;case 0x13:if(_0x183114[_0x2340('0xf3')]>=_0x1559a6[_0x2340('0xf6')]-0x1){return!![];}this[_0x2340('0xc1')]({'active':![],'countmachineretry':_0x183114['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x1559a6[_0x2340('0xf8')],_0x2340('0xf9'))[_0x2340('0x79')](_0x2340('0xfa')),'ContactId':_0x183114['ContactId'],'ListId':_0x183114[_0x2340('0xfb')],'VoiceQueueId':_0x183114[_0x2340('0xd3')]||undefined,'CampaignId':_0x183114[_0x2340('0xfc')]||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0xfd')));break;case 0x14:if(_0x183114[_0x2340('0xf4')]>=_0x1559a6[_0x2340('0x1a4')]-0x1){return!![];}this[_0x2340('0xc1')]({'active':![],'countagentrejectretry':_0x183114[_0x2340('0xf4')]+=0x1,'scheduledat':moment()[_0x2340('0xf7')](_0x1559a6[_0x2340('0x1a5')],_0x2340('0xf9'))[_0x2340('0x79')](_0x2340('0xfa')),'ContactId':_0x183114[_0x2340('0xd1')],'ListId':_0x183114[_0x2340('0xfb')],'VoiceQueueId':_0x183114['VoiceQueueId']||undefined,'CampaignId':_0x183114[_0x2340('0xfc')]||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0x1a6')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x4fd2a6,_0x1de8cf,_0x1f17d0){var _0x8cc65d=this;var _0x67bc0d=new History(_0x4fd2a6);return new BPromise(function(_0x3d7101,_0x59edec){if(_[_0x2340('0x3a')](_0x1de8cf)&&typeof _0x1de8cf!==_0x2340('0x164')){return _0x59edec(msgResponse('[callProgressDetecting]','Failure','entity\x20is\x20undefine'));}if(_['isUndefined'](_0x1f17d0)&&typeof _0x1f17d0!=='object'){return _0x59edec(msgResponse(_0x2340('0x1a7'),'Failure',_0x2340('0x1a8')));}switch(_0x1f17d0['reason']){case'0':_0x1de8cf[_0x2340('0x1a9')]+=0x1;_0x67bc0d[_0x2340('0xa5')]=0x0;_0x67bc0d[_0x2340('0xa6')]=_0x2340('0x1aa');_0x67bc0d[_0x2340('0xf0')]+=0x1;_0x67bc0d[_0x2340('0xeb')]+=0x1;ami[_0x2340('0x4a')]('custom:agentnosuchnumber',ut['buildObj'](_0x4fd2a6,_0x2340('0x1ab')));_0x8cc65d['createHistory'](_0x67bc0d)[_0x2340('0xba')](loggerCatch(_0x2340('0xec')));if(_0x8cc65d[_0x2340('0x196')](0x0,_0x4fd2a6,_0x1de8cf)){if(_0x67bc0d[_0x2340('0xf0')]>=_0x1de8cf['dialNoSuchNumberMaxRetry']){_0x8cc65d[_0x2340('0x1ac')](_0x67bc0d,_0x3d7101,_0x59edec,_0x2340('0x1ad'));}else{_0x8cc65d[_0x2340('0xf5')](_0x67bc0d,_0x3d7101,_0x59edec,_0x2340('0x1ad'));}}break;case'3':_0x1de8cf[_0x2340('0x63')]+=0x1;_0x67bc0d[_0x2340('0xa5')]=0x3;_0x67bc0d[_0x2340('0xa6')]='NoAnswer';_0x67bc0d[_0x2340('0xef')]+=0x1;_0x67bc0d[_0x2340('0xeb')]+=0x1;ami['emit'](_0x2340('0x1ae'),ut[_0x2340('0xe4')](_0x4fd2a6,_0x2340('0x1af')));_0x8cc65d[_0x2340('0xcb')](_0x67bc0d)[_0x2340('0xba')](loggerCatch(_0x2340('0x1b0')));if(_0x8cc65d['checkRetriveMax'](0x3,_0x4fd2a6,_0x1de8cf)){if(_0x67bc0d[_0x2340('0xef')]>=_0x1de8cf[_0x2340('0x198')]){_0x8cc65d[_0x2340('0x1ac')](_0x67bc0d,_0x3d7101,_0x59edec,_0x2340('0x1b1'));}else{_0x8cc65d[_0x2340('0xf5')](_0x67bc0d,_0x3d7101,_0x59edec,_0x2340('0x1b1'));}}break;case'5':_0x1de8cf[_0x2340('0x1b2')]+=0x1;_0x67bc0d[_0x2340('0xa5')]=0x5;_0x67bc0d[_0x2340('0xa6')]=_0x2340('0x1b3');_0x67bc0d[_0x2340('0xed')]+=0x1;_0x67bc0d[_0x2340('0xeb')]+=0x1;ami[_0x2340('0x4a')]('custom:agentbusy',ut[_0x2340('0xe4')](_0x4fd2a6,_0x2340('0x1b4')));_0x8cc65d['createHistory'](_0x67bc0d)[_0x2340('0xba')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x8cc65d[_0x2340('0x196')](0x5,_0x4fd2a6,_0x1de8cf)){if(_0x67bc0d['countbusyretry']>=_0x1de8cf[_0x2340('0x19b')]){_0x8cc65d['createStateFinal'](_0x67bc0d,_0x3d7101,_0x59edec,'reason\x205\x20busy');}else{_0x8cc65d[_0x2340('0xf5')](_0x67bc0d,_0x3d7101,_0x59edec,'reason\x205\x20busy');}}break;case'8':_0x1de8cf[_0x2340('0x1b5')]+=0x1;_0x67bc0d[_0x2340('0xa5')]=0x8;_0x67bc0d[_0x2340('0xa6')]=_0x2340('0x1b6');_0x67bc0d[_0x2340('0xee')]+=0x1;_0x67bc0d['countglobal']+=0x1;ami['emit']('custom:agentcongestion',ut['buildObj'](_0x4fd2a6,_0x2340('0x1b7')));_0x8cc65d[_0x2340('0xcb')](_0x67bc0d)['catch'](loggerCatch(_0x2340('0x1b8')));if(_0x8cc65d['checkRetriveMax'](0x8,_0x4fd2a6,_0x1de8cf)){if(_0x67bc0d['countcongestionretry']>=_0x1de8cf[_0x2340('0x19e')]){_0x8cc65d['createStateFinal'](_0x67bc0d,_0x3d7101,_0x59edec,'reason\x208\x20congestion');}else{_0x8cc65d[_0x2340('0xf5')](_0x67bc0d,_0x3d7101,_0x59edec,_0x2340('0x1b9'));}}break;case'11':_0x1de8cf[_0x2340('0x1ba')]+=0x1;_0x67bc0d[_0x2340('0xa5')]=0xb;_0x67bc0d[_0x2340('0xa6')]=_0x2340('0x11c');_0x67bc0d[_0x2340('0xf2')]+=0x1;_0x67bc0d[_0x2340('0xeb')]+=0x1;_0x8cc65d[_0x2340('0xcb')](_0x67bc0d)[_0x2340('0xba')](loggerCatch(_0x2340('0x1bb')));if(_0x8cc65d[_0x2340('0x196')](0xb,_0x4fd2a6,_0x1de8cf)){if(_0x67bc0d[_0x2340('0xf2')]>=_0x1de8cf[_0x2340('0x11e')]){_0x8cc65d[_0x2340('0x1ac')](_0x67bc0d,_0x3d7101,_0x59edec,'reason\x2011\x20abandoned');}else{_0x8cc65d[_0x2340('0xf5')](_0x67bc0d,_0x3d7101,_0x59edec,_0x2340('0x1bc'));}}break;case'20':_0x1de8cf[_0x2340('0x1bd')]+=0x1;_0x67bc0d[_0x2340('0xa5')]=0x14;_0x67bc0d[_0x2340('0xa6')]=_0x2340('0x1be');_0x67bc0d[_0x2340('0xf4')]+=0x1;_0x67bc0d[_0x2340('0xeb')]+=0x1;ami[_0x2340('0x4a')](_0x2340('0x1bf'),ut[_0x2340('0xe4')](_0x4fd2a6,_0x2340('0x1c0')));_0x8cc65d[_0x2340('0xcb')](_0x67bc0d)[_0x2340('0xba')](loggerCatch(_0x2340('0x1c1')));if(_0x8cc65d['checkRetriveMax'](0x14,_0x4fd2a6,_0x1de8cf)){if(_0x67bc0d[_0x2340('0xf4')]>=_0x1de8cf[_0x2340('0x1a4')]){_0x8cc65d[_0x2340('0x1ac')](_0x67bc0d,_0x3d7101,_0x59edec,'reason\x2020\x20agentreject');}else{_0x8cc65d[_0x2340('0xf5')](_0x67bc0d,_0x3d7101,_0x59edec,_0x2340('0x1c2'));}}break;default:_0x1de8cf[_0x2340('0x65')]+=0x1;_0x67bc0d[_0x2340('0xa5')]=0xc;_0x67bc0d['statedesc']=_0x1f17d0[_0x2340('0x108')];_0x8cc65d[_0x2340('0xcb')](_0x67bc0d)[_0x2340('0xba')](loggerCatch(_0x2340('0x1c3')));if(_0x8cc65d[_0x2340('0x196')](_0x1f17d0['reason'],_0x4fd2a6,_0x1de8cf)){if(_0x67bc0d[_0x2340('0xed')]+_0x67bc0d[_0x2340('0xee')]+_0x67bc0d[_0x2340('0xef')]+_0x67bc0d[_0x2340('0xf0')]+_0x67bc0d['countdropretry']+_0x67bc0d['countabandonedretry']+_0x67bc0d[_0x2340('0xf3')]+_0x67bc0d[_0x2340('0xf4')]>=_0x1de8cf[_0x2340('0x197')]){_0x8cc65d[_0x2340('0xf5')](_0x67bc0d,_0x3d7101,_0x59edec,_0x1f17d0[_0x2340('0x108')]);}else{_0x8cc65d[_0x2340('0x1ac')](_0x67bc0d,_0x3d7101,_0x59edec,_0x1f17d0[_0x2340('0x108')]);}}}});};Dialer[_0x2340('0xa8')][_0x2340('0xf5')]=function(_0x58581e,_0x203c1d,_0x389cbd,_0x353892){var _0x5b827e=new Final(_0x58581e);_0x5b827e[_0x2340('0xa5')]=0xf;_0x5b827e['statedesc']=_0x2340('0x1c4');this[_0x2340('0x1ac')](_0x5b827e,_0x203c1d,_0x389cbd,_0x353892);};Dialer['prototype'][_0x2340('0x1ac')]=function(_0x2fc79e,_0x206f3c,_0x13ef25,_0x5bc59b){this['moveContactManagedDialer'](_0x2fc79e)[_0x2340('0xbd')](function(){return _0x206f3c(msgResponse('[callProgressDetecting]',_0x2340('0xd6'),_0x5bc59b));})[_0x2340('0xba')](function(){return _0x13ef25(msgResponse('[moveContactManagedDialer][0]',_0x2340('0x140'),_0x2340('0x1c5')));});};Dialer[_0x2340('0xa8')]['predictive']=function(_0x4814af){var _0x38940e=_0x4814af['dialPredictiveOptimizationPercentage']/0x64;var _0x65f0ca=_0x4814af['outboundDropCallsDayTimeout']/(_0x4814af['outboundDropCallsDayTimeout']+_0x4814af[_0x2340('0x5e')]);var _0x55a08f=Math[_0x2340('0x1c6')](_0x4814af['predictiveIntervalAvailable']*(_0x4814af[_0x2340('0x1c7')]/0x64));var _0x315d0c=Math[_0x2340('0x1c6')](_0x4814af[_0x2340('0x6e')]*(_0x4814af[_0x2340('0x1c8')]/0x64));var _0x27b1ac=_0x4814af[_0x2340('0x4f')]+_0x4814af[_0x2340('0x55')];var _0xd9817a=Math[_0x2340('0x1c9')](_0x4814af[_0x2340('0x88')]*_0x4814af['erlangAbandonmentRate']*_0x4814af[_0x2340('0x6c')]*_0x4814af[_0x2340('0x1ca')]);if(_[_0x2340('0x3a')](_0x4814af['startProgressive'])){if(!_[_0x2340('0x3a')](_0x4814af[_0x2340('0x73')])){_0x4814af['startPredictive']=undefined;loggerPredictive[_0x2340('0x95')](_0x2340('0x1cb'),_0x2340('0x1cc'));}if(!_[_0x2340('0x3a')](_0x4814af[_0x2340('0x90')])){loggerPredictive[_0x2340('0x95')](_0x2340('0x1cb'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x4814af[_0x2340('0x90')]);_0x4814af['handlePredictive']=undefined;}_0x4814af[_0x2340('0x74')]=moment()[_0x2340('0x79')](_0x2340('0xfa'));loggerPredictive[_0x2340('0x7e')](_0x4814af[_0x2340('0x3c')],_0x2340('0x1cd'),_0x4814af[_0x2340('0x74')]);this[_0x2340('0x158')](_0x4814af,0x1);}else if(ifInterval(_0x4814af['dialPredictiveInterval'],_0x4814af[_0x2340('0x74')])){this['handlePower'](_0x4814af,0x1);loggerPredictiveCalls[_0x2340('0x7e')](_0x2340('0x1ce'),_0x4814af[_0x2340('0x74')],_0x4814af[_0x2340('0x3c')]);_0x4814af[_0x2340('0x88')]=0x0;_0x4814af[_0x2340('0x6b')]=0x0;}else if(_0x38940e<_0x65f0ca&&_0x4814af[_0x2340('0x1cf')]==='dropRate'){freeVariablesPredictive(_0x4814af);loggerPredictive[_0x2340('0x7e')](_0x2340('0x1d0'),_0x2340('0x1d1'),_0x65f0ca,_0x2340('0x74'),_0x4814af[_0x2340('0x3c')]);}else if(_0xd9817a<_0x4814af[_0x2340('0x6b')]&&_0x4814af[_0x2340('0x1cf')]===_0x2340('0x1d2')){freeVariablesPredictive(_0x4814af);loggerPredictive[_0x2340('0x7e')](_0x2340('0x1d3'),_0x2340('0x1d4'),_0xd9817a,_0x2340('0x1d5'),_0x4814af['predictiveIntervalErlangCallsDroppedCalls'],_0x2340('0x74'),_0x4814af['name']);}else if(!ifInterval(_0x4814af[_0x2340('0x1d6')],_0x4814af[_0x2340('0x74')])&&_['isUndefined'](_0x4814af[_0x2340('0x73')])&&!_[_0x2340('0x3a')](_0x4814af['startProgressive'])){_0x4814af[_0x2340('0x73')]=moment()['format'](_0x2340('0xfa'));loggerPredictive['info'](_0x4814af[_0x2340('0x3c')],_0x2340('0x1d7'),_0x4814af[_0x2340('0x73')]);this[_0x2340('0x1d8')](_0x4814af[_0x2340('0x1d6')])['then'](this[_0x2340('0x1d9')](_0x4814af))[_0x2340('0xbd')](mergeDataErlangB(_0x4814af))[_0x2340('0xbd')](this[_0x2340('0x1da')](_0x4814af))[_0x2340('0xba')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x4814af));}else if(!ifInterval(_0x4814af[_0x2340('0x1d6')],_0x4814af['startPredictive'])){_0x4814af[_0x2340('0x6b')]=0x0;_0x4814af['startPredictive']=moment()['format'](_0x2340('0xfa'));loggerPredictive[_0x2340('0x7e')](_0x4814af[_0x2340('0x3c')],'recalculate\x20predictive\x20at',_0x4814af[_0x2340('0x73')]);clearInterval(_0x4814af[_0x2340('0x90')]);_0x4814af[_0x2340('0x90')]=undefined;this['averageHandleTime'](_0x4814af[_0x2340('0x1d6')])[_0x2340('0xbd')](this[_0x2340('0x1d9')](_0x4814af))[_0x2340('0xbd')](mergeDataErlangB(_0x4814af))[_0x2340('0xbd')](this[_0x2340('0x1da')](_0x4814af))[_0x2340('0xba')](loggerCatchPredictive(_0x2340('0x1db'),_0x4814af));}else if(_0x4814af[_0x2340('0x6e')]&&_0x27b1ac<_0x4814af[_0x2340('0x6e')]-_0x315d0c){freeVariablesPredictive(_0x4814af);loggerPredictive[_0x2340('0x7e')](_0x4814af[_0x2340('0x3c')],_0x2340('0x1dc'),_0x27b1ac,_0x2340('0x1dd'),_0x4814af[_0x2340('0x6e')],'-',_0x315d0c,'=',_0x4814af[_0x2340('0x6e')]-_0x315d0c,')');}else if(_0x4814af[_0x2340('0x6e')]&&_0x27b1ac>_0x4814af[_0x2340('0x6e')]+_0x55a08f){freeVariablesPredictive(_0x4814af);loggerPredictive[_0x2340('0x7e')](_0x4814af[_0x2340('0x3c')],_0x2340('0x1dc'),_0x27b1ac,_0x2340('0x1de'),_0x4814af[_0x2340('0x6e')],'+',_0x55a08f,'=',_0x4814af[_0x2340('0x6e')]+_0x55a08f,')');}};Dialer['prototype'][_0x2340('0x1d9')]=function(_0x4b220e){var _0x3cf389=this;return function(_0x387b53){return new BPromise(function(_0x16262c,_0x4af8a2){_[_0x2340('0x8c')](_0x4b220e,_0x387b53[0x0]);if(checkGetDataPredictive(_0x387b53[0x0])){var _0x16ebdf=_0x4b220e['predictiveIntervalAvailable']=_0x4b220e[_0x2340('0x55')]+_0x4b220e[_0x2340('0x4f')];var _0x2bdabc=_0x4b220e[_0x2340('0x1d6')]*0x3c;var _0x11c3ae=_0x387b53[0x0][_0x2340('0x67')]+_0x387b53[0x0][_0x2340('0x84')];var _0xf4eba5=(_0x387b53[0x0]['predictiveIntervalAnsweredCalls']+_0x387b53[0x0][_0x2340('0x69')]+_0x387b53[0x0][_0x2340('0x68')])/_0x387b53[0x0][_0x2340('0x6f')];_0x4b220e[_0x2340('0x6c')]=_0xf4eba5>0x0?_0xf4eba5:0x1;switch(_0x4b220e['dialPredictiveOptimization']){case _0x2340('0x1d2'):var _0x6b003d=_0x4b220e['dialPredictiveOptimizationPercentage']/0x64;return _0x3cf389[_0x2340('0x1df')](_0x16ebdf,_0x2bdabc,_0x11c3ae,_0xf4eba5,_0x6b003d)['then'](function(_0x325f26){return _0x16262c(_0x325f26);});case _0x2340('0x1e0'):var _0x40224b=_0x4b220e['dialPredictiveOptimizationPercentage']/0x64;return _0x3cf389[_0x2340('0x1e1')](_0x16ebdf,_0x2bdabc,_0x11c3ae,_0xf4eba5,_0x40224b)['then'](function(_0x173a6d){return _0x16262c(_0x173a6d);});default:return _0x4af8a2(msgResponse(_0x2340('0x1e2'),'Failure',_0x2340('0x1e3')));}}else{return _0x4af8a2(msgResponse(_0x2340('0x1e2'),_0x2340('0x140'),_0x2340('0x1e4')));}});};};Dialer[_0x2340('0xa8')][_0x2340('0x1e5')]=function(_0x240f99){var _0x452f5c=this;return function(_0x352754){return new BPromise(function(_0x153d49,_0x9db4bb){_[_0x2340('0x8c')](_0x240f99,_0x352754[0x0]);if(checkGetDataPredictive(_0x352754[0x0])){loggerPredictive[_0x2340('0x7e')](JSON['stringify'](_0x352754[0x0]));if(_0x240f99[_0x2340('0x1cf')]===_0x2340('0x1d2')){return _0x452f5c[_0x2340('0xc8')](_0x240f99['id'])[_0x2340('0xbd')](function(_0x1e625){var _0xde90a0=_0x240f99[_0x2340('0x50')]-_0x1e625[0x0][_0x2340('0x1e6')];var _0x11d8a7=_0x240f99[_0x2340('0x1d6')]*0x3c;var _0x1d18c0=_0x352754[0x0][_0x2340('0x67')]+_0x352754[0x0][_0x2340('0x84')];var _0x4b4db1=(_0x352754[0x0][_0x2340('0x66')]+_0x352754[0x0][_0x2340('0x69')]+_0x352754[0x0][_0x2340('0x68')])/_0x352754[0x0][_0x2340('0x6f')];var _0x36f310=_0x240f99[_0x2340('0x1e7')]/0x64;_0x240f99['predictiveIntervalPauses']=_0x1e625[0x0][_0x2340('0x1e6')]||0x0;_0x240f99[_0x2340('0x6c')]=_0x4b4db1>0x0?_0x4b4db1:0x1;return _0x452f5c[_0x2340('0x1df')](_0xde90a0,_0x11d8a7,_0x1d18c0,_0x4b4db1,_0x36f310);})[_0x2340('0xbd')](function(_0x3efac0){return _0x153d49(_0x3efac0);})[_0x2340('0xba')](function(_0xabaaa5){return _0x9db4bb(msgResponse('[CatchErlangB]',_0x2340('0x140'),JSON[_0x2340('0x47')](_0xabaaa5)));});}if(_0x240f99[_0x2340('0x1cf')]===_0x2340('0x1e0')){return _0x452f5c[_0x2340('0xc8')](_0x240f99['id'])[_0x2340('0xbd')](function(_0x11ea42){var _0x43bebe=_0x240f99[_0x2340('0x50')]-_0x11ea42[0x0]['outboundQueuePauses'];var _0x7d1649=_0x240f99['dialPredictiveInterval']*0x3c;var _0x49b430=_0x352754[0x0]['predictiveIntervalAvgTalktime']+_0x352754[0x0]['predictiveIntervalAvgHoldtime'];var _0x3d4390=(_0x352754[0x0][_0x2340('0x66')]+_0x352754[0x0][_0x2340('0x69')]+_0x352754[0x0][_0x2340('0x68')])/_0x352754[0x0][_0x2340('0x6f')];var _0x4c4daf=_0x240f99[_0x2340('0x1e7')]/0x64;_0x240f99[_0x2340('0x6d')]=_0x11ea42[0x0][_0x2340('0x1e6')]||0x0;_0x240f99[_0x2340('0x6c')]=_0x3d4390>0x0?_0x3d4390:0x1;return _0x452f5c[_0x2340('0x1e1')](_0x43bebe,_0x7d1649,_0x49b430,_0x3d4390,_0x4c4daf);})[_0x2340('0xbd')](function(_0x585ded){return _0x153d49(_0x585ded);})[_0x2340('0xba')](function(_0x486eb5){return _0x9db4bb(msgResponse(_0x2340('0x1e8'),_0x2340('0x140'),JSON[_0x2340('0x47')](_0x486eb5)));});}}else{return _0x9db4bb(msgResponse(_0x2340('0x1e2'),_0x2340('0x140'),_0x2340('0x1e4')));}});};};Dialer[_0x2340('0xa8')][_0x2340('0x1da')]=function(_0xa18276){var _0x5d9800=this;return function(){var _0x37bd72=0x0;var _0x2ff3a2=Math['floor'](_0xa18276[_0x2340('0x70')]*0x3e8);if(_0x2ff3a2>0x0){_0x2ff3a2=_0x2ff3a2<0x64?0x64:_0x2ff3a2;loggerPredictive[_0x2340('0x7e')](_0xa18276[_0x2340('0x3c')],_0x2340('0x1e9'),_0x2ff3a2,_0x2340('0x48'));_0xa18276[_0x2340('0x90')]=setInterval(function(){_0x5d9800[_0x2340('0x90')](_0xa18276);loggerPredictiveCalls['info'](_0x2340('0x1ea'),_0x37bd72+=0x1);},_0x2ff3a2);}else{loggerPredictive[_0x2340('0x7e')](_0xa18276[_0x2340('0x3c')],_0x2340('0x1eb'));}};};Dialer['prototype'][_0x2340('0x1ec')]=function(_0x5c8744,_0x4c8c59){var _0x496cab=this;return function(_0x293d9b){if(_[_0x2340('0x44')](_0x293d9b)){if(_['isNil'](_0x4c8c59['UserId'])||!_0x4c8c59['recallme']){if(_0x5c8744[_0x2340('0x153')]===_0x2340('0x157')){_0x5c8744[_0x2340('0x12b')]=_[_0x2340('0x3a')](_0x5c8744[_0x2340('0x12b')])?!![]:_0x5c8744['queueStatusComplete'];var _0x16ec67=uuid['v4']();_0x496cab[_0x2340('0x22')][_0x16ec67]=new Action(_0x5c8744,_0x4c8c59,_0x16ec67);loggerBooked[_0x2340('0x7e')]('[booked][checkContactBlack]',_0x16ec67,_0x2340('0x1ed'),JSON[_0x2340('0x47')](_0x5c8744['queueStatusComplete']),_0x2340('0x1ee'),_0x5c8744[_0x2340('0x3c')]);if(_0x5c8744['queueStatusComplete']){_0x5c8744['queueStatusComplete']=![];_0x496cab[_0x2340('0x127')][_0x496cab[_0x2340('0x22')][_0x16ec67][_0x2340('0xb4')]]=[];ami[_0x2340('0xaf')]({'actionid':_0x16ec67,'action':_0x2340('0x1ef'),'queue':_0x5c8744[_0x2340('0x3c')]})[_0x2340('0xba')](function(){_0x496cab[_0x2340('0xb3')](_0x5c8744);_0x496cab['rescheduleContact']({'active':![],'ContactId':_0x496cab[_0x2340('0x22')][_0x16ec67]['ContactId'],'ListId':_0x496cab[_0x2340('0x22')][_0x16ec67][_0x2340('0xfb')],'VoiceQueueId':_0x496cab[_0x2340('0x22')][_0x16ec67][_0x2340('0xd3')]||undefined,'CampaignId':_0x496cab[_0x2340('0x22')][_0x16ec67][_0x2340('0xfc')]||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0x1f0')));delete _0x496cab[_0x2340('0x22')][_0x16ec67];});}else{loggerBooked['info'](_0x2340('0x1f1'),JSON[_0x2340('0x47')](_0x5c8744[_0x2340('0x12b')]),_0x2340('0x1ee'),_0x5c8744[_0x2340('0x3c')]);_0x496cab['updateOriginated'](_0x5c8744);_0x496cab['rescheduleContact']({'active':![],'ContactId':_0x496cab[_0x2340('0x22')][_0x16ec67][_0x2340('0xd1')],'ListId':_0x496cab[_0x2340('0x22')][_0x16ec67][_0x2340('0xfb')],'VoiceQueueId':_0x496cab[_0x2340('0x22')][_0x16ec67][_0x2340('0xd3')]||undefined,'CampaignId':_0x496cab[_0x2340('0x22')][_0x16ec67][_0x2340('0xfc')]||undefined})[_0x2340('0xba')](loggerCatch(_0x2340('0x1f0')));delete _0x496cab[_0x2340('0x22')][_0x16ec67];}}else{return _0x496cab[_0x2340('0x1f2')](_0x5c8744,_0x4c8c59);}}else{if(getDiff(_0x4c8c59['scheduledat'])<_0x5c8744[_0x2340('0x1f3')]*0x3c){if(_0x4c8c59['Agent']&&!_0x4c8c59['Agent'][_0x2340('0x1f4')]){_0x496cab[_0x2340('0x1d')][_0x2340('0x12e')](_0x4c8c59['id'])['finally'](function(){_0x496cab[_0x2340('0xb3')](_0x5c8744);});}else{_0x496cab[_0x2340('0x1f5')]({'active':![]},_0x4c8c59['id'],0x1)[_0x2340('0x1c')](function(){_0x496cab[_0x2340('0xb3')](_0x5c8744);});}}else{_0x5c8744[_0x2340('0x1f6')]+=0x1;_0x496cab['updateOriginated'](_0x5c8744);if(_0x5c8744['dialRecallInQueue']){_0x496cab[_0x2340('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4c8c59[_0x2340('0xd1')],'ListId':_0x4c8c59['ListId'],'VoiceQueueId':_0x4c8c59[_0x2340('0xd3')]||undefined,'CampaignId':_0x4c8c59[_0x2340('0xfc')]||undefined})['catch'](loggerCatch(_0x2340('0x1f7')));_0x496cab[_0x2340('0xcb')](createObjHistory(_0x5c8744,_0x4c8c59,_0x2340('0x1f8'),0x17,_0x2340('0x1f9')))[_0x2340('0xba')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x496cab[_0x2340('0xd0')](createObjHistory(_0x5c8744,_0x4c8c59,_0x2340('0x1fa'),0x16,_0x2340('0x1fb')),_0x2340('0x1fc'),_0x2340('0x1fd'));}}}}else{_0x5c8744[_0x2340('0x5f')]+=0x1;_0x496cab[_0x2340('0xd0')](createObjHistory(_0x5c8744,_0x4c8c59,_0x2340('0x1fe'),0xd,_0x2340('0x1ff')),_0x2340('0x200'),_0x2340('0x201'));throw _0x2340('0x202');}};};Dialer[_0x2340('0xa8')]['handleIvr']=function(_0x570933){var _0x2068c1=this;var _0x178345=_0x570933[_0x2340('0x203')]-_0x570933[_0x2340('0x97')]-_0x570933[_0x2340('0xc4')];emitCampaignSummary(_0x570933);if(_0x178345>0x0){if(_0x178345>this[_0x2340('0x21')]){_0x178345=this[_0x2340('0x21')];}_0x570933[_0x2340('0xc4')]+=_0x178345;this[_0x2340('0xc6')](_0x570933['id'],_0x178345,_0x570933['dialOrderByScheduledAt'],_0x570933)[_0x2340('0xbd')](function(_0x2e58a4){_0x570933[_0x2340('0xc4')]-=_0x178345;_0x570933[_0x2340('0xc4')]=_0x570933[_0x2340('0xc4')]>0x0?_0x570933[_0x2340('0xc4')]:0x0;if(!checkContactEmpty(_0x2e58a4)){_0x570933[_0x2340('0x3b')]=_0x2340('0x204');logger['info'](_0x2340('0x205')+_0x570933[_0x2340('0x3c')]);}else{_0x570933['originated']+=_0x2e58a4[_0x2340('0x131')];_0x570933[_0x2340('0x3b')]=_0x2340('0x206');for(var _0x1b7bd4=0x0;_0x1b7bd4<_0x2e58a4[_0x2340('0x131')];_0x1b7bd4+=0x1){_0x570933[_0x2340('0x207')]+=0x1;if(_[_0x2340('0xae')](_0x2e58a4[_0x1b7bd4])||_[_0x2340('0xae')](_0x2e58a4[_0x1b7bd4][_0x2340('0x168')])||_[_0x2340('0xae')](_0x2e58a4[_0x1b7bd4][_0x2340('0x168')][_0x2340('0x167')])){_0x2068c1['emptyContact'](_0x2340('0x208'),_0x570933,_0x2e58a4[_0x1b7bd4]);}else{_0x2068c1['checkIsBlackListIvr'](_['pick'](_0x2e58a4[_0x1b7bd4],[_0x2340('0xfc'),_0x2340('0x209')]))[_0x2340('0xbd')](_0x2068c1[_0x2340('0x1ec')](_0x570933,_0x2e58a4[_0x1b7bd4]))[_0x2340('0xba')](_0x2068c1[_0x2340('0x20a')]('[actionOriginateIvr]\x20',_0x570933));}}}})[_0x2340('0xba')](loggerGetContactDialer('[getContactCampaign2]',_0x570933,_0x178345));}};Dialer[_0x2340('0xa8')][_0x2340('0x158')]=function(_0x325e05,_0x205aa5){var _0x421252=this;var _0x2cf422=[];var _0x4f4795=_0x205aa5>=0x1?_0x205aa5:0x1;if(_0x325e05[_0x2340('0x153')]===_0x2340('0x157')){_0x4f4795=0x1;}var _0x190aaf=Math[_0x2340('0x1c9')](_0x325e05[_0x2340('0x4f')]*_0x4f4795)-_0x325e05[_0x2340('0x97')]-_0x325e05[_0x2340('0xc4')];emitVoiceQueueSummary(_0x325e05);if(_0x325e05[_0x2340('0x20b')]>0x0){var _0x272d83=_0x325e05[_0x2340('0x20b')]-_0x325e05[_0x2340('0x97')]-_0x325e05[_0x2340('0x55')]-_0x325e05[_0x2340('0xc4')]-_0x325e05[_0x2340('0x51')];if(_0x190aaf>_0x272d83){_0x190aaf=_0x272d83;}}if(_0x190aaf>0x0){if(_0x325e05['dialMethod']===_0x2340('0x157')){_0x190aaf=0x1;}if(_0x190aaf>this['maxNumberOriginate']){_0x190aaf=this[_0x2340('0x21')];}_0x325e05['temp']+=_0x190aaf;for(var _0xe8217d in this['agents']){if(typeof this[_0x2340('0x126')][_0xe8217d]!==_0x2340('0x98')){if(this[_0x2340('0x126')][_0xe8217d][_0x2340('0xa5')]===_0x2340('0x20c')&&this[_0x2340('0x126')][_0xe8217d][_0x2340('0xb0')]==='reachable'){_0x2cf422[_0x2340('0x128')](this[_0x2340('0x126')][_0xe8217d]['id']);}}}this[_0x2340('0xc3')](_0x325e05['id'],_0x2cf422,_0x190aaf,_0x325e05[_0x2340('0x20d')],_0x325e05)['then'](function(_0x33cb44){_0x325e05['temp']-=_0x190aaf;_0x325e05[_0x2340('0xc4')]=_0x325e05[_0x2340('0xc4')]>0x0?_0x325e05[_0x2340('0xc4')]:0x0;if(!checkContactEmpty(_0x33cb44)){_0x421252[_0x2340('0xb7')](_0x325e05)[_0x2340('0xbd')](sendMessageReschedule(_0x325e05))[_0x2340('0xba')](loggerCatch(_0x2340('0x20e')));}else{_0x325e05['originated']+=_0x33cb44['length'];_0x325e05[_0x2340('0x3b')]=_0x325e05[_0x2340('0x153')]==='booked'?_0x2340('0x16f'):_0x2340('0x206');for(var _0x383139=0x0;_0x383139<_0x33cb44[_0x2340('0x131')];_0x383139+=0x1){if(_[_0x2340('0xae')](_0x33cb44[_0x383139])||_[_0x2340('0xae')](_0x33cb44[_0x383139][_0x2340('0x168')])||_[_0x2340('0xae')](_0x33cb44[_0x383139]['Contact'][_0x2340('0x167')])){_0x421252[_0x2340('0xce')](_0x2340('0x208'),_0x325e05,_0x33cb44[_0x383139]);}else{_0x421252['checkIsBlackList'](_[_0x2340('0x135')](_0x33cb44[_0x383139],[_0x2340('0xd3'),_0x2340('0x209')]))[_0x2340('0xbd')](_0x421252['checkContactBlack'](_0x325e05,_0x33cb44[_0x383139]))['catch'](_0x421252['loggerHandler']('[actionOriginate]\x20',_0x325e05));}}}})[_0x2340('0xba')](loggerGetContactDialer('[getContactDialer2]',_0x325e05,_0x190aaf));}};Dialer['prototype'][_0x2340('0x90')]=function(_0x4562a5){if(_0x4562a5['dialLimitQueue']>0x0){var _0x29740a=_0x4562a5[_0x2340('0x20b')]-_0x4562a5['originated']-_0x4562a5[_0x2340('0x55')];if(_0x29740a>0x0){this[_0x2340('0x20f')](_0x4562a5);}else{loggerPredictiveCalls[_0x2340('0x7e')]('[handlePredictive][limitChannel]');}}else{this[_0x2340('0x20f')](_0x4562a5);}};Dialer[_0x2340('0xa8')][_0x2340('0x20f')]=function(_0x1dcc48){var _0x9dbf7d=this;var _0x5414a8=[];_0x1dcc48[_0x2340('0x97')]+=0x1;for(var _0xa7cbf0 in this['agents']){if(typeof this['agents'][_0xa7cbf0]!=='undefined'){if(this[_0x2340('0x126')][_0xa7cbf0]['state']===_0x2340('0x20c')&&this[_0x2340('0x126')][_0xa7cbf0]['status']==='reachable'){_0x5414a8['push'](this['agents'][_0xa7cbf0]['id']);}}}this[_0x2340('0xc3')](_0x1dcc48['id'],_0x5414a8,0x1,_0x1dcc48[_0x2340('0x20d')],_0x1dcc48)[_0x2340('0xbd')](function(_0x7b5dfa){if(!checkContactEmpty(_0x7b5dfa)){checkContactLowerLimitOriginate(_0x1dcc48,0x1,0x0);_0x9dbf7d['countReScheduled'](_0x1dcc48)[_0x2340('0xbd')](sendMessageReschedule(_0x1dcc48))[_0x2340('0xba')](loggerCatch(_0x2340('0x20e')));}else{_0x1dcc48[_0x2340('0x3b')]=_0x2340('0x206');if(_[_0x2340('0xae')](_0x7b5dfa[0x0])||_['isNil'](_0x7b5dfa[0x0][_0x2340('0x168')])||_[_0x2340('0xae')](_0x7b5dfa[0x0][_0x2340('0x168')][_0x2340('0x167')])){_0x9dbf7d['emptyContact'](_0x2340('0x208'),_0x1dcc48,_0x7b5dfa[0x0]);}else{_0x9dbf7d['checkIsBlackList'](_[_0x2340('0x135')](_0x7b5dfa[0x0],[_0x2340('0xd3'),'Contact.phone']))[_0x2340('0xbd')](_0x9dbf7d[_0x2340('0x1ec')](_0x1dcc48,_0x7b5dfa[0x0]))['catch'](_0x9dbf7d[_0x2340('0x20a')](_0x2340('0x210'),_0x1dcc48));}}})[_0x2340('0xba')](loggerGetContactDialer(_0x2340('0x211'),_0x1dcc48,0x1));emitVoiceQueueSummary(_0x1dcc48);};Dialer[_0x2340('0xa8')]['abandonmentRate']=function(_0x9eedc1,_0xbbe8c2,_0x2c615c,_0x34e3b0,_0x21140a,_0x2a8acf){loggerPredictive[_0x2340('0x7e')](_0x2340('0x212'));loggerPredictive[_0x2340('0x7e')](_0x2340('0x213'),_0x9eedc1);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xbbe8c2);loggerPredictive['info'](_0x2340('0x214'),_0x2c615c);loggerPredictive[_0x2340('0x7e')]('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',_0x34e3b0);loggerPredictive[_0x2340('0x7e')](_0x2340('0x215'),_0x21140a);loggerPredictive[_0x2340('0x7e')]('---------------------------');return new BPromise(function(_0x4a93aa,_0x5cf2b7){if(_0x9eedc1<=0x0||isNaN(_0x9eedc1)){return _0x5cf2b7(msgResponse('[abandonmentRate]',_0x2340('0x46'),_0x2340('0x216')+_0x9eedc1));}if(_0x2c615c<=0x0||isNaN(_0x2c615c)){return _0x5cf2b7(msgResponse('[abandonmentRate]',_0x2340('0x46'),_0x2340('0x217')+_0x2c615c));}if(_0x34e3b0<=0x0||isNaN(_0x34e3b0)){return _0x5cf2b7(msgResponse(_0x2340('0x218'),_0x2340('0x46'),_0x2340('0x219')+_0x34e3b0));}if(_0xbbe8c2<=0x0||isNaN(_0xbbe8c2)){return _0x5cf2b7(msgResponse(_0x2340('0x218'),'Error','interval\x20=\x20'+_0xbbe8c2));}if(_0x21140a<=0x0||isNaN(_0x21140a)){return _0x5cf2b7(msgResponse(_0x2340('0x218'),_0x2340('0x46'),_0x2340('0x21a')+_0x21140a));}_0x2a8acf=_0x2a8acf||0x0;var _0x28ebb7=0x1/_0x2c615c;var _0x1c861a=0x0;var _0x3e3b37=0x0;var _0x393c40=0x0;var _0x113d71=0x0;for(var _0x2b6407=0x0;_0x393c40<_0x21140a;_0x2b6407+=0x1){_0x3e3b37=_0x2b6407/_0xbbe8c2;_0x1c861a=(_0x34e3b0*_0x3e3b37+_0x2a8acf)/_0x28ebb7;_0x393c40=erlangb(_0x1c861a,_0x9eedc1);_0x113d71=_0x1c861a/_0x9eedc1*(0x1-erlangb(_0x1c861a,_0x9eedc1));}return _0x4a93aa({'erlangCalls':_0x2b6407,'erlangCallToSecond':_0xbbe8c2/_0x2b6407,'erlangAbandonmentRate':_0x393c40,'erlangBusyFactor':_0x113d71});});};Dialer['prototype']['busyFactor']=function(_0x493776,_0x6b194b,_0x5dacb2,_0x49b1d0,_0x31ad65,_0x20d9dc){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x2340('0x7e')](_0x2340('0x213'),_0x493776);loggerPredictive[_0x2340('0x7e')](_0x2340('0x21b'),_0x6b194b);loggerPredictive[_0x2340('0x7e')](_0x2340('0x214'),_0x5dacb2);loggerPredictive[_0x2340('0x7e')](_0x2340('0x21c'),_0x49b1d0);loggerPredictive[_0x2340('0x7e')](_0x2340('0x21d'),_0x31ad65);loggerPredictive[_0x2340('0x7e')]('---------------------------');return new BPromise(function(_0x264fb4,_0x5b0080){if(_0x493776<=0x0||isNaN(_0x493776)){return _0x5b0080(msgResponse('[busyFactor]',_0x2340('0x46'),'m\x20=\x20'+_0x493776));}if(_0x5dacb2<=0x0||isNaN(_0x5dacb2)){return _0x5b0080(msgResponse(_0x2340('0x21e'),'Error',_0x2340('0x217')+_0x5dacb2));}if(_0x49b1d0<=0x0||isNaN(_0x49b1d0)){return _0x5b0080(msgResponse(_0x2340('0x21e'),_0x2340('0x46'),_0x2340('0x219')+_0x49b1d0));}if(_0x6b194b<=0x0||isNaN(_0x6b194b)){return _0x5b0080(msgResponse('[busyFactor]','Error',_0x2340('0x21f')+_0x6b194b));}if(_0x31ad65<=0x0||isNaN(_0x31ad65)){return _0x5b0080(msgResponse(_0x2340('0x21e'),_0x2340('0x46'),'Umin\x20=\x20'+_0x31ad65));}_0x20d9dc=_0x20d9dc||0x0;var _0x45d493=0x1/_0x5dacb2;var _0x24f085=0x0;var _0x12159c=0x0;var _0x44656e=0x0;var _0x30f2ab=0x0;for(var _0x242b96=0x0;_0x30f2ab<_0x31ad65;_0x242b96+=0x1){_0x12159c=_0x242b96/_0x6b194b;_0x24f085=(_0x49b1d0*_0x12159c+_0x20d9dc)/_0x45d493;_0x44656e=erlangb(_0x24f085,_0x493776);_0x30f2ab=_0x24f085/_0x493776*(0x1-erlangb(_0x24f085,_0x493776));}return _0x264fb4({'erlangCalls':_0x242b96,'erlangCallToSecond':_0x6b194b/_0x242b96,'erlangAbandonmentRate':_0x44656e,'erlangBusyFactor':_0x30f2ab});});};module[_0x2340('0x220')]=Dialer; \ No newline at end of file +var _0xc576=['syncOriginateResponse','agentcomplete','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','stringify','diff','seconds','emit','outbound','strategy','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','type','ivr','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','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','Agent\x20Busy\x20Factor:\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','milliseconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','pTalking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','[uniqueid]','actions','[actions]','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','temp','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','membername','countabandonedretry','stateGlobal','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','outboundUnknownCallsDay','syncAgentComplete','reason','agiafterat','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','dialQueueProject2','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','command','iftime\x20%s,%s','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','[syncQueueSummary]','checkIsTrunkReachable','dialGlobalInterval','[syncCampaigns]','pow','random','match','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','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(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','maxNumberOriginate','getContactDialerIvr','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','ACTIVE','RUNNING','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','util','lodash','bluebird','uuid','moment','../preview/util/util','../../../config/logger','dialer','booked','predictive','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon'];(function(_0x1265e4,_0x1e56c9){var _0x56c4cb=function(_0x40638a){while(--_0x40638a){_0x1265e4['push'](_0x1265e4['shift']());}};_0x56c4cb(++_0x1e56c9);}(_0xc576,0x1ea));var _0x6c57=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0xc576[_0x5401ae];return _0x286068;};'use strict';var util=require(_0x6c57('0x0'));var _=require(_0x6c57('0x1'));var BPromise=require(_0x6c57('0x2'));var uuid=require(_0x6c57('0x3'));var moment=require(_0x6c57('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x6c57('0x5'));var config=require('../../../config/environment/');var logger=require(_0x6c57('0x6'))(_0x6c57('0x7'));var loggerBooked=require('../../../config/logger')(_0x6c57('0x8'));var loggerPredictive=require('../../../config/logger')(_0x6c57('0x9'));var loggerPredictiveCalls=require(_0x6c57('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x6c57('0x6'))('syncQueueSummary');var ami=require(_0x6c57('0xa'));config[_0x6c57('0xb')]=_['defaults'](config[_0x6c57('0xb')],{'host':_0x6c57('0xc'),'port':0x18eb});var io=require(_0x6c57('0xd'))(new Redis(config[_0x6c57('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x6c57('0xe'));var cmHopperBlack=require(_0x6c57('0xf'));var voiceQueueRt=require(_0x6c57('0x10'));var Action=require(_0x6c57('0x11'));var History=require(_0x6c57('0x12'));var Final=require(_0x6c57('0x13'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x6c57('0x14'));var Hangup=require(_0x6c57('0x15'));var ipAgi=process[_0x6c57('0x16')][_0x6c57('0x17')]||_0x6c57('0x18');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x6c57('0x19')][_0x6c57('0x1a')]=function(_0xc4139b){this[_0x6c57('0x1b')]=this[_0x6c57('0x1b')]?this[_0x6c57('0x1b')][_0x6c57('0x1c')](_0xc4139b):_0xc4139b();};function Dialer(_0x2fa059,_0x3c4a2c){this[_0x6c57('0x1d')]=new Sequence();this[_0x6c57('0x1e')]=_0x3c4a2c;this[_0x6c57('0x1f')]=_0x2fa059[_0x6c57('0x1f')];this['campaigns']=_0x2fa059[_0x6c57('0x20')];this['agents']=_0x2fa059[_0x6c57('0x21')];this[_0x6c57('0x22')]=_0x2fa059[_0x6c57('0x22')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x6c57('0x23')]={};this['actions']={};this[_0x6c57('0x24')]={};this[_0x6c57('0x25')]={};this[_0x6c57('0x26')]={};this[_0x6c57('0x27')]={};this[_0x6c57('0x28')]={};this['ivrOriginated']={};this[_0x6c57('0x29')]={};this[_0x6c57('0x2a')]={};ami['on'](_0x6c57('0x2b'),this['syncAgentConnect'][_0x6c57('0x2c')](this));ami['on'](_0x6c57('0x2d'),this[_0x6c57('0x2e')][_0x6c57('0x2c')](this));ami['on']('originateresponse',this[_0x6c57('0x2f')]['bind'](this));ami['on'](_0x6c57('0x30'),this['syncAgentComplete'][_0x6c57('0x2c')](this));ami['on']('custom:queuesummary',this[_0x6c57('0x31')][_0x6c57('0x2c')](this));ami['on'](_0x6c57('0x32'),this[_0x6c57('0x33')][_0x6c57('0x2c')](this));ami['on'](_0x6c57('0x34'),this[_0x6c57('0x35')][_0x6c57('0x2c')](this));ami['on'](_0x6c57('0x36'),this[_0x6c57('0x37')][_0x6c57('0x2c')](this));ami['on'](_0x6c57('0x38'),this[_0x6c57('0x39')]['bind'](this));ami['on'](_0x6c57('0x3a'),this[_0x6c57('0x3b')]['bind'](this));this[_0x6c57('0x3c')]();this[_0x6c57('0x3d')]();}function isNotNull(_0x3d5d0f){return _0x3d5d0f!==null&&!_[_0x6c57('0x3e')](_0x3d5d0f);}function checkIsLoggedIn(_0xeef13c,_0x52a6dc){return function(){if(_0x52a6dc<=0x0){_0xeef13c[_0x6c57('0x3f')]=_0x6c57('0x40');throw _0xeef13c[_0x6c57('0x41')]+_0x6c57('0x42');}};}function isActive(_0x43ac10){return _0x43ac10;}function checkIsActive(_0x33d446,_0x4bd470){return function(){if(!isActive(_0x4bd470)){_0x33d446['message']=_0x6c57('0x43');throw _0x33d446[_0x6c57('0x41')]+_0x6c57('0x44');}};}function checkInterval(_0x4d596f){return function(){if(!isNotNull(_0x4d596f['Interval'])){_0x4d596f['message']=_0x6c57('0x45');throw _0x4d596f['name']+_0x6c57('0x46');}if(!isNotNull(_0x4d596f[_0x6c57('0x47')]['Intervals'])){_0x4d596f[_0x6c57('0x3f')]=_0x6c57('0x45');throw _0x4d596f[_0x6c57('0x41')]+_0x6c57('0x46');}if(!isNotNull(_['isEmpty'](_0x4d596f[_0x6c57('0x47')][_0x6c57('0x48')]))){_0x4d596f['message']=_0x6c57('0x45');throw _0x4d596f[_0x6c57('0x41')]+_0x6c57('0x46');}};}function msgResponse(_0x4e4ec0,_0x3538b7,_0x25bb4c){return{'action':_0x4e4ec0,'response':_0x3538b7,'message':_0x25bb4c,'stack':_0x25bb4c};}function myreject(_0x24b780){return function(_0x1ffb0b){return _0x24b780(msgResponse(_0x6c57('0x49'),_0x6c57('0x4a'),JSON[_0x6c57('0x4b')](_0x1ffb0b)));};}function getSeconds(_0x286c7a,_0x100f4b){var _0x4e1f95=moment(_0x286c7a)['milliseconds'](0x0);var _0x1e1a05=moment(_0x100f4b)['milliseconds'](0x0);return _0x4e1f95[_0x6c57('0x4c')](_0x1e1a05,_0x6c57('0x4d'));}function emit(_0x510945,_0x1fc0aa,_0x119367){io['to'](_0x510945)[_0x6c57('0x4e')](_0x1fc0aa,_0x119367);}function emitVoiceQueueSummary(_0x4fee13){if(_0x4fee13['type']===_0x6c57('0x4f')){var _0x143557={'id':_0x4fee13['id'],'name':_0x4fee13[_0x6c57('0x41')],'strategy':_0x4fee13[_0x6c57('0x50')],'answered':_0x4fee13['answered'],'available':_0x4fee13['available'],'loggedIn':_0x4fee13[_0x6c57('0x51')],'pTalking':_0x4fee13['pTalking'],'sumBillable':_0x4fee13[_0x6c57('0x52')],'sumDuration':_0x4fee13[_0x6c57('0x53')],'sumHoldTime':_0x4fee13[_0x6c57('0x54')]||0x0,'talking':_0x4fee13[_0x6c57('0x55')],'total':_0x4fee13['total'],'type':_0x4fee13['type'],'unmanaged':_0x4fee13[_0x6c57('0x56')],'abandoned':_0x4fee13[_0x6c57('0x57')],'waiting':_0x4fee13[_0x6c57('0x58')],'loggedInDb':_0x4fee13[_0x6c57('0x59')],'dialActive':_0x4fee13[_0x6c57('0x5a')],'dialMethod':_0x4fee13[_0x6c57('0x5b')],'dialOriginateCallerIdName':_0x4fee13[_0x6c57('0x5c')],'dialOriginateCallerIdNumber':_0x4fee13[_0x6c57('0x5d')],'dialOriginateTimeout':_0x4fee13[_0x6c57('0x5e')],'dialPrefix':_0x4fee13['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4fee13[_0x6c57('0x5f')],'outboundAnswerCallsDay':_0x4fee13[_0x6c57('0x60')],'outboundBlacklistCallsDay':_0x4fee13['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4fee13['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4fee13[_0x6c57('0x61')],'outboundDropCallsDayACS':_0x4fee13['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4fee13[_0x6c57('0x62')],'outboundDropCallsDayTimeout':_0x4fee13[_0x6c57('0x63')],'outboundNoAnswerCallsDay':_0x4fee13[_0x6c57('0x64')],'outboundNoSuchCallsDay':_0x4fee13[_0x6c57('0x65')],'outboundOriginateFailureCallsDay':_0x4fee13[_0x6c57('0x66')],'outboundReCallsDay':_0x4fee13['outboundReCallsDay'],'outboundRejectCallsDay':_0x4fee13['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4fee13['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x4fee13[_0x6c57('0x67')],'predictiveIntervalAvgHoldtime':_0x4fee13[_0x6c57('0x68')],'predictiveIntervalAvgTalktime':_0x4fee13[_0x6c57('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x4fee13[_0x6c57('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x4fee13[_0x6c57('0x6b')],'predictiveIntervalErlangCalls':_0x4fee13[_0x6c57('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x4fee13[_0x6c57('0x6d')],'predictiveIntervalHitRate':_0x4fee13[_0x6c57('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x4fee13[_0x6c57('0x6f')],'predictiveIntervalPauses':_0x4fee13[_0x6c57('0x70')],'predictiveIntervalAvailable':_0x4fee13[_0x6c57('0x71')],'predictiveIntervalTotalCalls':_0x4fee13[_0x6c57('0x72')],'message':_0x4fee13[_0x6c57('0x3f')],'originated':_0x4fee13[_0x6c57('0x73')],'erlangCalls':_0x4fee13[_0x6c57('0x74')],'erlangCallToSecond':_0x4fee13['erlangCallToSecond'],'erlangAbandonmentRate':_0x4fee13[_0x6c57('0x75')],'erlangBusyFactor':_0x4fee13[_0x6c57('0x76')],'startPredictive':_0x4fee13['startPredictive'],'startProgressive':_0x4fee13['startProgressive']};if(_0x4fee13['Trunk']){_0x143557['Trunk']={'id':_0x4fee13[_0x6c57('0x77')]['id'],'name':_0x4fee13[_0x6c57('0x77')][_0x6c57('0x41')],'active':_0x4fee13['Trunk'][_0x6c57('0x78')],'callerid':_0x4fee13[_0x6c57('0x77')][_0x6c57('0x79')]};}if(_0x4fee13[_0x6c57('0x47')]){_0x143557['Interval']={'id':_0x4fee13[_0x6c57('0x47')]['id'],'name':_0x4fee13[_0x6c57('0x47')]['name']};}var _0x5a6724=md5(JSON[_0x6c57('0x4b')](_0x143557));if(_0x4fee13['md5']!==_0x5a6724){_0x4fee13[_0x6c57('0x7a')]=_0x5a6724;emit(util[_0x6c57('0x7b')](_0x6c57('0x7c'),_0x143557[_0x6c57('0x41')]),'voice_queue:save',_0x143557);}}}function emitCampaignSummary(_0x49150d){if(_0x49150d[_0x6c57('0x7d')]===_0x6c57('0x7e')){emit(util['format']('campaign:ivr:%s',_0x49150d[_0x6c57('0x41')]),_0x6c57('0x7f'),_0x49150d);}}function checkGetDataPredictive(_0x58d064){if(isNotNull(_0x58d064)&&!_[_0x6c57('0x80')](_0x58d064)){loggerPredictive[_0x6c57('0x81')](_0x6c57('0x82'));loggerPredictive['info'](_0x6c57('0x83'),_0x58d064[_0x6c57('0x72')]);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x84'),_0x58d064[_0x6c57('0x67')]);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x85'),_0x58d064[_0x6c57('0x6b')]);loggerPredictive['info'](_0x6c57('0x86'),_0x58d064[_0x6c57('0x6a')]);loggerPredictive[_0x6c57('0x81')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58d064[_0x6c57('0x68')]);loggerPredictive[_0x6c57('0x81')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58d064[_0x6c57('0x69')]);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x87'));if(_0x58d064[_0x6c57('0x72')]>0x0){if(!_[_0x6c57('0x3e')](_0x58d064['predictiveIntervalAvgTalktime'])&&_0x58d064[_0x6c57('0x69')]>0x0){return!![];}loggerPredictive[_0x6c57('0x81')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x58d064[_0x6c57('0x68')])&&_0x58d064[_0x6c57('0x68')]>0x0){return!![];}loggerPredictive[_0x6c57('0x81')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x6c57('0x81')](_0x6c57('0x88'));}return![];}function mergeDataErlangB(_0x26e961){return function(_0x9401b0){loggerPredictive[_0x6c57('0x81')](_0x6c57('0x89'));loggerPredictive[_0x6c57('0x81')](_0x6c57('0x8a'),_0x9401b0['erlangCalls']);loggerPredictive['info'](_0x6c57('0x8b'),_0x9401b0[_0x6c57('0x8c')]);loggerPredictive[_0x6c57('0x81')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9401b0['erlangAbandonmentRate']);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x8d'),_0x9401b0['erlangBusyFactor']);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x8e'),_0x9401b0[_0x6c57('0x75')]);loggerPredictive[_0x6c57('0x81')]('---------------------------');_[_0x6c57('0x8f')](_0x26e961,_0x9401b0);};}function getDiff(_0x1c6c83){var _0x3c321e=moment()[_0x6c57('0x90')](0x0);var _0x31a603=moment(_0x1c6c83)[_0x6c57('0x90')](0x0);return _0x3c321e[_0x6c57('0x4c')](_0x31a603,'seconds');}function ifInterval(_0x40e8fa,_0xae6a20){if(_['isUndefined'](_0xae6a20)){return![];}return getDiff(_0xae6a20)<_0x40e8fa*0x3c;}function freeVariablesPredictive(_0x115c33){if(isNotNull(_0x115c33)){if(!_[_0x6c57('0x3e')](_0x115c33[_0x6c57('0x28')])){_0x115c33['startProgressive']=undefined;loggerPredictive['info'](_0x115c33[_0x6c57('0x41')],_0x6c57('0x91'));}if(!_[_0x6c57('0x3e')](_0x115c33[_0x6c57('0x27')])){_0x115c33['startPredictive']=undefined;loggerPredictive['info'](_0x115c33[_0x6c57('0x41')],_0x6c57('0x92'));}if(!_[_0x6c57('0x3e')](_0x115c33[_0x6c57('0x93')])){clearInterval(_0x115c33['handlePredictive']);_0x115c33[_0x6c57('0x93')]=undefined;loggerPredictive[_0x6c57('0x81')](_0x115c33[_0x6c57('0x41')],_0x6c57('0x94'));}}}function erlangb(_0x5ab87c,_0x1258ae){if(_0x1258ae===0x0){return 0x0;}var _0x176ba3=0x1;for(var _0x6c3d39=0x1;_0x6c3d39<=_0x1258ae;_0x6c3d39+=0x1){_0x176ba3=0x1+_0x176ba3*_0x6c3d39/_0x5ab87c;}return 0x1/_0x176ba3;}function isVoiceQueueOutbound(_0x40f0e8){return _0x40f0e8===_0x6c57('0x4f');}function isNotPreview(_0xbc8c44){return _0xbc8c44!==_0x6c57('0x1e');}function isCampaignIvr(_0x3f470f){return _0x3f470f===_0x6c57('0x7e');}function getCallerId(_0x12d4da,_0x1deea4,_0x5606e2){if(!_[_0x6c57('0x3e')](_0x5606e2)&&typeof _0x5606e2===_0x6c57('0x95')&&!_[_0x6c57('0x80')](_0x5606e2)){if(!_[_0x6c57('0x3e')](_0x1deea4)&&typeof _0x1deea4===_0x6c57('0x95')&&!_[_0x6c57('0x80')](_0x1deea4)){return util[_0x6c57('0x7b')]('\x22%s\x22\x20<%s>',_0x1deea4,_0x5606e2);}return util[_0x6c57('0x7b')](_0x6c57('0x96'),_0x5606e2,_0x5606e2);}if(!_[_0x6c57('0x3e')](_0x12d4da)&&typeof _0x12d4da==='string'&&!_['isEmpty'](_0x12d4da)){return _0x12d4da;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x967a8e,_0x1dbeb8){return function(_0xdfbaa1){freeVariablesPredictive(_0x1dbeb8);emitVoiceQueueSummary(_0x1dbeb8);emitCampaignSummary(_0x1dbeb8);loggerSyncQueueSummary[_0x6c57('0x97')](_0x967a8e,util[_0x6c57('0x98')](_0xdfbaa1,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x219aa0,_0x81c16b){return function(_0x590d74){loggerPredictive['error'](_0x81c16b[_0x6c57('0x41')],_0x219aa0);loggerPredictive[_0x6c57('0x97')](_0x590d74[_0x6c57('0x99')]);freeVariablesPredictive(_0x81c16b);};}function loggerCatch(_0x522320){return function(_0xab430e){logger[_0x6c57('0x97')](_0x522320,util[_0x6c57('0x98')](_0xab430e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x362abf){return _0x362abf&&!_[_0x6c57('0x3e')](_0x362abf)&&_0x362abf[_0x6c57('0x9a')]>0x0;}function decremetOriginate(_0x1e7349){if(!_[_0x6c57('0x3e')](_0x1e7349)&&_0x1e7349!==null){if(typeof _0x1e7349[_0x6c57('0x73')]!==_0x6c57('0x9b')){if(_0x1e7349[_0x6c57('0x73')]>0x0){_0x1e7349[_0x6c57('0x73')]-=0x1;}else{logger[_0x6c57('0x97')](_0x6c57('0x9c'));}}}else{logger[_0x6c57('0x97')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x591b80,_0x23f2ae,_0x2c333f){if(_0x23f2ae>_0x2c333f){for(var _0x5fad07=0x0;_0x5fad07<_0x23f2ae-_0x2c333f;_0x5fad07+=0x1){decremetOriginate(_0x591b80);}}}function loggerGetContactDialer(_0x468571,_0x4bc32e,_0x486e5f){return function(_0x350336){checkContactLowerLimitOriginate(_0x4bc32e,_0x486e5f,0x0);logger[_0x6c57('0x97')](_0x468571,util[_0x6c57('0x98')](_0x350336,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xd33c61){return function(_0x569c7f){if(isNotNull(_0x569c7f)&&isNotNull(_0x569c7f[0x0])){if(_0x569c7f[0x0][_0x6c57('0x9d')]>0x0){_0xd33c61[_0x6c57('0x3f')]=_0x6c57('0x9e');logger[_0x6c57('0x81')](_0x6c57('0x9f')+_0xd33c61[_0x6c57('0x41')],_0x569c7f[0x0][_0x6c57('0x9d')],'contacts');}else{_0xd33c61[_0x6c57('0x3f')]=_0x6c57('0xa0');logger[_0x6c57('0x81')]('[getContactDialer2][Empty]'+_0xd33c61[_0x6c57('0x41')]);}}};}function notSendMessagesQueue(_0x34bce8){if(_0x34bce8[_0x6c57('0xa1')]){freeVariablesPredictive(_0x34bce8);if(_0x34bce8[_0x6c57('0x73')]===0x0&&_0x34bce8[_0x6c57('0x55')]===0x0&&_0x34bce8[_0x6c57('0x58')]===0x0&&(_0x34bce8[_0x6c57('0xa2')]||0x0)===0x0){_0x34bce8[_0x6c57('0xa1')]=![];_0x34bce8[_0x6c57('0xa3')]=0x0;_0x34bce8[_0x6c57('0x3f')]=_0x6c57('0x43');loggerSyncQueueSummary['error'](_0x6c57('0xa4'),_0x34bce8[_0x6c57('0x41')],_0x6c57('0xa5'));}else{_0x34bce8[_0x6c57('0x3f')]=_0x6c57('0xa6');loggerSyncQueueSummary[_0x6c57('0x97')](_0x6c57('0xa4'),_0x34bce8[_0x6c57('0x41')],_0x6c57('0xa7'));}emitVoiceQueueSummary(_0x34bce8);}}function notSendMessagesCampaign(_0x56cf56){if(_0x56cf56[_0x6c57('0xa1')]){if(_0x56cf56[_0x6c57('0x73')]===0x0){_0x56cf56[_0x6c57('0xa1')]=![];_0x56cf56[_0x6c57('0x3f')]=_0x6c57('0x43');loggerSyncQueueSummary[_0x6c57('0x97')](_0x6c57('0xa8'),_0x56cf56[_0x6c57('0x41')],_0x6c57('0xa5'));}else{_0x56cf56['message']='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x6c57('0xa8'),_0x56cf56[_0x6c57('0x41')],_0x6c57('0xa7'));}emitCampaignSummary(_0x56cf56);}}function createObjHistory(_0x4aa969,_0x9bc14d,_0x3dad10,_0xe06b27,_0x3ffd57){_0x4aa969[_0x6c57('0x3f')]=_0x3dad10;var _0x33679c=new Action(_0x4aa969,_0x9bc14d);var _0x1589ce=new History(_0x33679c);_0x1589ce[_0x6c57('0xa9')]=_0xe06b27;_0x1589ce[_0x6c57('0xaa')]=_0x3ffd57;_0x1589ce[_0x6c57('0xab')]=_0x33679c['starttime'];return _0x1589ce;}Dialer[_0x6c57('0x19')][_0x6c57('0x3d')]=function(){var _0x3a2999=this;setInterval(function(){_0x3a2999[_0x6c57('0xac')](_0x3a2999[_0x6c57('0x25')],_0x6c57('0xad'));_0x3a2999['clearZombieChannels'](_0x3a2999[_0x6c57('0xae')],_0x6c57('0xaf'));},0x32c8);};Dialer[_0x6c57('0x19')]['clearZombieChannels']=function(_0x26ef17,_0x588b70){var _0xcb10c5=this;for(var _0x233a98 in _0x26ef17){if(typeof _0x26ef17[_0x233a98]!=='undefined'){this[_0x6c57('0x1d')][_0x6c57('0x1a')](function(){if(!_['isNil'](_0x26ef17[_0x233a98])){return ami[_0x6c57('0xb0')]({'action':_0x6c57('0xb1'),'channel':_0x26ef17[_0x233a98][_0x6c57('0xb2')]})[_0x6c57('0xb3')](function(_0x44d6bb){if(_0x44d6bb[_0x6c57('0x3f')]===_0x6c57('0xb4')){setTimeout(function(){if(_0x26ef17[_0x233a98]&&_0x26ef17[_0x233a98][_0x6c57('0x7d')]!==_0x6c57('0x7e')){_0xcb10c5[_0x6c57('0xb5')](_0xcb10c5[_0x6c57('0x1f')][_0x26ef17[_0x233a98][_0x6c57('0xb6')]]);logger[_0x6c57('0x97')](_0x6c57('0xb7'),_0x588b70,_0x233a98,_0x26ef17[_0x233a98][_0x6c57('0xb6')]);delete _0x26ef17[_0x233a98];}if(_0x26ef17[_0x233a98]&&_0x26ef17[_0x233a98][_0x6c57('0x7d')]===_0x6c57('0x7e')){_0xcb10c5[_0x6c57('0xb5')](_0xcb10c5[_0x6c57('0x20')][_0x26ef17[_0x233a98][_0x6c57('0xb6')]]);logger[_0x6c57('0x97')](_0x6c57('0xb8'),_0x588b70,_0x233a98,_0x26ef17[_0x233a98]['queue']);delete _0x26ef17[_0x233a98];}},0x2328);}});}});}}};Dialer[_0x6c57('0x19')][_0x6c57('0xb9')]=function(_0x5d4ad4){return BPromise['resolve']()[_0x6c57('0xba')](cmHopper[_0x6c57('0xb9')](_0x5d4ad4))[_0x6c57('0xb3')](loggerCatch(_0x6c57('0xbb')));};Dialer[_0x6c57('0x19')]['checkIsBlackList']=function(_0x3cc217){return BPromise[_0x6c57('0xbc')]()[_0x6c57('0xba')](cmHopperBlack['checkIsBlackList'](_0x3cc217))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x6c57('0x19')][_0x6c57('0xbd')]=function(_0x228516){return BPromise['resolve']()[_0x6c57('0xba')](cmHopperBlack[_0x6c57('0xbd')](_0x228516))['catch'](loggerCatch(_0x6c57('0xbe')));};Dialer['prototype'][_0x6c57('0xbf')]=function(_0x21b92b){return BPromise[_0x6c57('0xbc')]()['then'](cmHopperHistory['avgHandleTime'](_0x21b92b))[_0x6c57('0xb3')](loggerCatch(_0x6c57('0xc0')));};Dialer[_0x6c57('0x19')][_0x6c57('0xc1')]=function(_0x370f82){return BPromise[_0x6c57('0xbc')]()[_0x6c57('0xba')](cmHopper[_0x6c57('0xc1')](_0x370f82))[_0x6c57('0xb3')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x6c57('0x19')][_0x6c57('0xc2')]=function(_0x223416,_0x2387fc,_0x3f7f41){return BPromise['resolve']()['then'](cmHopper[_0x6c57('0xc2')](_0x223416,_0x2387fc,_0x3f7f41))[_0x6c57('0xb3')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x6c57('0x19')][_0x6c57('0xc3')]=function(_0x83fecc,_0x53448a,_0x53c9be,_0x1d8eca,_0x3f4a95){return BPromise[_0x6c57('0xbc')]()[_0x6c57('0xba')](cmHopper[_0x6c57('0xc3')](_0x83fecc,_0x53448a,_0x53c9be,_0x1d8eca))[_0x6c57('0xb3')](function(_0x197137){_0x3f4a95['temp']-=_0x53c9be;_0x3f4a95[_0x6c57('0xc4')]=_0x3f4a95[_0x6c57('0xc4')]>0x0?_0x3f4a95[_0x6c57('0xc4')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x197137);});};Dialer[_0x6c57('0x19')]['getContactDialerIvr']=function(_0x45dc41,_0x3565e2,_0x40aebc,_0x354f1f){return BPromise[_0x6c57('0xbc')]()['then'](cmHopper['getContactDialerIvr'](_0x45dc41,_0x3565e2,_0x40aebc))[_0x6c57('0xb3')](function(_0x1ba7f5){_0x354f1f[_0x6c57('0xc4')]-=_0x3565e2;_0x354f1f['temp']=_0x354f1f[_0x6c57('0xc4')]>0x0?_0x354f1f[_0x6c57('0xc4')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x1ba7f5);});};Dialer['prototype'][_0x6c57('0xc5')]=function(_0x349ecd){return BPromise[_0x6c57('0xbc')]()[_0x6c57('0xba')](voiceQueueRt[_0x6c57('0xc5')](_0x349ecd))[_0x6c57('0xb3')](loggerCatch(_0x6c57('0xc6')));};Dialer[_0x6c57('0x19')][_0x6c57('0xc7')]=function(_0x57f77d){return BPromise[_0x6c57('0xbc')]()['then'](cmHopper[_0x6c57('0xc7')](_0x57f77d))[_0x6c57('0xb3')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x6c57('0x19')][_0x6c57('0xc8')]=function(_0x2cdcde){return BPromise[_0x6c57('0xbc')]()[_0x6c57('0xba')](cmHopperHistory[_0x6c57('0xc8')](_0x2cdcde))[_0x6c57('0xb3')](loggerCatch(_0x6c57('0xc9')));};Dialer[_0x6c57('0x19')][_0x6c57('0xb5')]=function(_0x5c08b6){if(!_[_0x6c57('0x3e')](_0x5c08b6)&&_0x5c08b6!==null){if(typeof _0x5c08b6[_0x6c57('0x73')]!==_0x6c57('0x9b')){if(_0x5c08b6['originated']>0x0){_0x5c08b6['originated']-=0x1;}else{logger[_0x6c57('0x97')](_0x6c57('0xca'));}}}else{logger[_0x6c57('0x97')](_0x6c57('0xcb'));}};Dialer[_0x6c57('0x19')]['loggerHandler']=function(_0x150397,_0x4a3e35){var _0x188922=this;return function(_0x4a8e3e){_0x188922[_0x6c57('0xb5')](_0x4a3e35);logger[_0x6c57('0x97')](_0x150397,util[_0x6c57('0x98')](_0x4a8e3e,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x6c57('0xcc')]=function(_0x250d1e,_0x4cf5e3,_0x1ff334){var _0x26cb53={'state':0x19,'statedesc':_0x6c57('0xcd')};this[_0x6c57('0xb5')](_0x4cf5e3);this[_0x6c57('0xce')](_[_0x6c57('0x8f')](_0x26cb53,_[_0x6c57('0xcf')](_0x1ff334,[_0x6c57('0xd0'),_0x6c57('0xd1'),_0x6c57('0xd2'),'VoiceQueueId',_0x6c57('0xd3')])),_0x6c57('0xd4'),_0x6c57('0xd5'));logger[_0x6c57('0x97')](_0x250d1e);};Dialer[_0x6c57('0x19')][_0x6c57('0xd6')]=function(_0x576d51){return _0x576d51===_0x6c57('0xd7');};Dialer[_0x6c57('0x19')][_0x6c57('0xd8')]=function(_0x22035d){return!_['isUndefined'](_0x22035d)&&_0x22035d&&!_[_0x6c57('0x3e')](_0x22035d[_0x6c57('0x41')])&&!_[_0x6c57('0x3e')](_0x22035d['active'])&&_0x22035d[_0x6c57('0x78')]&&(this['trunks'][util[_0x6c57('0x7b')]('SIP/%s',_0x22035d[_0x6c57('0x41')])][_0x6c57('0xb1')]===_0x6c57('0xd9')||this[_0x6c57('0x22')][util[_0x6c57('0x7b')](_0x6c57('0xda'),_0x22035d[_0x6c57('0x41')])][_0x6c57('0xb1')]===_0x6c57('0xdb'));};Dialer['prototype'][_0x6c57('0xce')]=function(_0x4a06eb,_0x2460bc,_0x55b1cc){this[_0x6c57('0xc8')](_0x4a06eb)['catch'](loggerCatch(_0x2460bc));this[_0x6c57('0xc7')](_0x4a06eb)[_0x6c57('0xb3')](loggerCatch(_0x55b1cc));};Dialer[_0x6c57('0x19')]['syncVarSet']=function(_0x212cc0){var _0x6979ab=this[_0x6c57('0x25')][_0x212cc0[_0x6c57('0xdc')]];var _0x1b331f;if(!_[_0x6c57('0xdd')](_0x212cc0)&&!_[_0x6c57('0xdd')](_0x212cc0[_0x6c57('0xde')])&&!_['isNil'](_0x212cc0[_0x6c57('0xde')][_0x6c57('0xdf')])&&_0x212cc0['exten']===_0x6c57('0xe0')&&_0x6979ab){if(_0x6979ab[_0x6c57('0x7d')]!==_0x6c57('0x7e')&&this[_0x6c57('0x1f')][_0x6979ab[_0x6c57('0xb6')]][_0x6c57('0xe1')]&&_0x212cc0['value']===_0x6c57('0xe2')){delete this[_0x6c57('0x25')][_0x212cc0[_0x6c57('0xdc')]];this[_0x6c57('0xb5')](this[_0x6c57('0x1f')][_0x6979ab[_0x6c57('0xb6')]]);this[_0x6c57('0x1f')][_0x6979ab['queue']][_0x6c57('0x60')]+=0x1;this[_0x6c57('0x1f')][_0x6979ab['queue']][_0x6c57('0x5f')]+=0x1;_0x1b331f=new Hangup(_0x6979ab,_0x212cc0);_0x1b331f[_0x6c57('0xa9')]=0x12;_0x1b331f[_0x6c57('0xaa')]='HangupInAMD';_0x1b331f['membername']=_0x6c57('0xe3');ami[_0x6c57('0x4e')](_0x6c57('0xe4'),ut[_0x6c57('0xe5')](_0x1b331f,_0x6c57('0xe6')));this[_0x6c57('0xce')](_0x1b331f,_0x6c57('0xe7'),_0x6c57('0xe8'));}if(_0x6979ab[_0x6c57('0x7d')]!==_0x6c57('0x7e')&&this[_0x6c57('0x1f')][_0x6979ab['queue']][_0x6c57('0xe1')]&&_0x212cc0[_0x6c57('0xe9')]===_0x6c57('0xea')){var _0x399310=this;return new BPromise(function(_0x1684b3,_0x218c73){delete _0x399310['uniqueId'][_0x212cc0['uniqueid']];_0x399310[_0x6c57('0xb5')](_0x399310[_0x6c57('0x1f')][_0x6979ab['queue']]);_0x399310[_0x6c57('0x1f')][_0x6979ab['queue']][_0x6c57('0x60')]+=0x1;_0x399310[_0x6c57('0x1f')][_0x6979ab['queue']][_0x6c57('0x5f')]+=0x1;var _0x5aba31=_0x399310['voiceQueues'][_0x6979ab[_0x6c57('0xb6')]];var _0x126ad0=new Hangup(_0x6979ab,_0x212cc0);_0x126ad0[_0x6c57('0xa9')]=0x13;_0x126ad0[_0x6c57('0xaa')]=_0x6c57('0xeb');_0x126ad0['membername']=_0x6c57('0xe3');_0x126ad0[_0x6c57('0xec')]+=0x1;_0x126ad0[_0x6c57('0xed')]+=0x1;_0x126ad0[_0x6c57('0xe6')]=!![];ami['emit'](_0x6c57('0xe4'),ut[_0x6c57('0xe5')](_0x126ad0,_0x6c57('0xe6')));_0x399310['createHistory'](_0x126ad0)['catch'](loggerCatch(_0x6c57('0xee')));if(_0x126ad0[_0x6c57('0xef')]+_0x126ad0['countcongestionretry']+_0x126ad0[_0x6c57('0xf0')]+_0x126ad0[_0x6c57('0xf1')]+_0x126ad0[_0x6c57('0xf2')]+_0x126ad0['countabandonedretry']+_0x126ad0['countmachineretry']+_0x126ad0[_0x6c57('0xf3')]>=_0x5aba31[_0x6c57('0xf4')]){_0x399310['stateGlobal'](_0x126ad0,_0x1684b3,_0x218c73,_0x6c57('0xf5'));}else{if(_0x126ad0['countmachineretry']>=_0x5aba31[_0x6c57('0xf6')]){_0x399310['createStateFinal'](_0x126ad0,_0x1684b3,_0x218c73,_0x6c57('0xf7'));}else{_0x399310[_0x6c57('0xc1')]({'active':![],'countmachineretry':_0x126ad0[_0x6c57('0xec')],'scheduledat':moment()[_0x6c57('0xf8')](_0x5aba31['dialMachineRetryFrequency'],_0x6c57('0xf9'))[_0x6c57('0x7b')](_0x6c57('0xfa')),'ContactId':_0x126ad0[_0x6c57('0xd0')],'ListId':_0x126ad0['ListId'],'VoiceQueueId':_0x126ad0[_0x6c57('0xfb')]||undefined,'CampaignId':_0x126ad0[_0x6c57('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x1684b3({'reschedule':0x1});}}});}if(_0x6979ab[_0x6c57('0x7d')]===_0x6c57('0x7e')&&this[_0x6c57('0x20')][_0x6979ab[_0x6c57('0xb6')]][_0x6c57('0xe1')]&&_0x212cc0[_0x6c57('0xe9')]==='HANGUP'){delete this[_0x6c57('0x25')][_0x212cc0['uniqueid']];this['updateOriginated'](this[_0x6c57('0x20')][_0x6979ab[_0x6c57('0xb6')]]);_0x1b331f=new Hangup(_0x6979ab,_0x212cc0);_0x1b331f['state']=0x12;_0x1b331f[_0x6c57('0xaa')]=_0x6c57('0xfc');_0x1b331f['membername']=_0x6c57('0xe3');ami['emit']('custom:amd',ut[_0x6c57('0xe5')](_0x1b331f,_0x6c57('0xe6')));this[_0x6c57('0xce')](_0x1b331f,_0x6c57('0xfd'),_0x6c57('0xfe'));}if(_0x6979ab[_0x6c57('0x7d')]===_0x6c57('0x7e')&&this[_0x6c57('0x20')][_0x6979ab[_0x6c57('0xb6')]][_0x6c57('0xe1')]&&_0x212cc0[_0x6c57('0xe9')]===_0x6c57('0xea')){var _0x399310=this;return new BPromise(function(_0x179baf,_0xe0598d){delete _0x399310['uniqueId'][_0x212cc0[_0x6c57('0xdc')]];_0x399310[_0x6c57('0xb5')](_0x399310[_0x6c57('0x20')][_0x6979ab[_0x6c57('0xb6')]]);_0x399310[_0x6c57('0x20')][_0x6979ab[_0x6c57('0xb6')]][_0x6c57('0x60')]+=0x1;_0x399310[_0x6c57('0x20')][_0x6979ab[_0x6c57('0xb6')]][_0x6c57('0x5f')]+=0x1;var _0x733b0b=_0x399310[_0x6c57('0x20')][_0x6979ab[_0x6c57('0xb6')]];var _0x21ad79=new Hangup(_0x6979ab,_0x212cc0);_0x21ad79[_0x6c57('0xa9')]=0x13;_0x21ad79['statedesc']=_0x6c57('0xeb');_0x21ad79[_0x6c57('0xff')]='AMD';_0x21ad79[_0x6c57('0xec')]+=0x1;_0x21ad79[_0x6c57('0xed')]+=0x1;_0x21ad79[_0x6c57('0xe6')]=!![];ami[_0x6c57('0x4e')](_0x6c57('0xe4'),ut[_0x6c57('0xe5')](_0x21ad79,_0x6c57('0xe6')));_0x399310[_0x6c57('0xc8')](_0x21ad79)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0xee')));if(_0x21ad79[_0x6c57('0xef')]+_0x21ad79['countcongestionretry']+_0x21ad79[_0x6c57('0xf0')]+_0x21ad79['countnosuchnumberretry']+_0x21ad79[_0x6c57('0xf2')]+_0x21ad79[_0x6c57('0x100')]+_0x21ad79[_0x6c57('0xec')]+_0x21ad79['countagentrejectretry']>=_0x733b0b[_0x6c57('0xf4')]){_0x399310[_0x6c57('0x101')](_0x21ad79,_0x179baf,_0xe0598d,_0x6c57('0xf5'));}else{if(_0x21ad79[_0x6c57('0xec')]>=_0x733b0b[_0x6c57('0xf6')]){_0x399310[_0x6c57('0x102')](_0x21ad79,_0x179baf,_0xe0598d,_0x6c57('0xf7'));}else{_0x399310['rescheduleContact']({'active':![],'countmachineretry':_0x21ad79[_0x6c57('0xec')],'scheduledat':moment()[_0x6c57('0xf8')](_0x733b0b[_0x6c57('0x103')],'minutes')[_0x6c57('0x7b')](_0x6c57('0xfa')),'ContactId':_0x21ad79[_0x6c57('0xd0')],'ListId':_0x21ad79[_0x6c57('0xd1')],'VoiceQueueId':_0x21ad79[_0x6c57('0xfb')]||undefined,'CampaignId':_0x21ad79[_0x6c57('0xd3')]||undefined})[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x104')));_0x179baf({'reschedule':0x1});}}});}}};Dialer[_0x6c57('0x19')][_0x6c57('0x33')]=function(_0x14bc7a){var _0x3dcbe8=this[_0x6c57('0x25')][_0x14bc7a[_0x6c57('0xdc')]];var _0x5b097b=this;var _0xacac1d;if(_0x3dcbe8&&_0x3dcbe8[_0x6c57('0x7d')]==='ivr'){delete this[_0x6c57('0x25')][_0x14bc7a[_0x6c57('0xdc')]];this[_0x6c57('0xb5')](this[_0x6c57('0x20')][_0x3dcbe8[_0x6c57('0xb6')]]);this[_0x6c57('0x20')][_0x3dcbe8[_0x6c57('0xb6')]][_0x6c57('0x105')]+=0x1;_0xacac1d=new Hangup(_0x3dcbe8,_0x14bc7a);this[_0x6c57('0xc8')](_0xacac1d)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x106')));this[_0x6c57('0xc7')](_0xacac1d)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x107')));}if(_0x3dcbe8&&_0x3dcbe8[_0x6c57('0x7d')]!==_0x6c57('0x7e')&&isNotNull(this[_0x6c57('0x1f')][_0x3dcbe8[_0x6c57('0xb6')]]['dialQueueProject'])){delete this[_0x6c57('0x25')][_0x14bc7a[_0x6c57('0xdc')]];this['updateOriginated'](this[_0x6c57('0x1f')][_0x3dcbe8['queue']]);this['voiceQueues'][_0x3dcbe8[_0x6c57('0xb6')]]['outboundAnswerCallsDay']+=0x1;this[_0x6c57('0x1f')][_0x3dcbe8[_0x6c57('0xb6')]]['outboundAnswerAgiCallsDay']+=0x1;_0xacac1d=new Hangup(_0x3dcbe8,_0x14bc7a);_0xacac1d[_0x6c57('0xa9')]=0x10;_0xacac1d[_0x6c57('0xaa')]=_0x6c57('0x108');_0xacac1d[_0x6c57('0xff')]='AGI';this[_0x6c57('0xc8')](_0xacac1d)['catch'](loggerCatch(_0x6c57('0x106')));this[_0x6c57('0xc7')](_0xacac1d)[_0x6c57('0xb3')](loggerCatch('[syncHangupIvr]'));}if(_0x3dcbe8&&_0x3dcbe8[_0x6c57('0x7d')]!=='ivr'&&!isNotNull(this[_0x6c57('0x1f')][_0x3dcbe8[_0x6c57('0xb6')]]['dialQueueProject'])){delete this[_0x6c57('0x25')][_0x14bc7a[_0x6c57('0xdc')]];this[_0x6c57('0xb5')](this[_0x6c57('0x1f')][_0x3dcbe8[_0x6c57('0xb6')]]);this[_0x6c57('0x1f')][_0x3dcbe8[_0x6c57('0xb6')]][_0x6c57('0x109')]+=0x1;_0xacac1d=new Hangup(_0x3dcbe8,_0x14bc7a);_0xacac1d[_0x6c57('0xa9')]=0xc;_0xacac1d['statedesc']=_0x14bc7a['cause-txt'];_0xacac1d[_0x6c57('0xff')]='Unknow';this[_0x6c57('0xc8')](_0xacac1d)[_0x6c57('0xb3')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0xacac1d)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x107')));}};Dialer[_0x6c57('0x19')][_0x6c57('0x10a')]=function(_0x4cae93){var _0x3ac624=this[_0x6c57('0x25')][_0x4cae93['uniqueid']];var _0x27d0ae=this;if(this[_0x6c57('0x1f')][_0x4cae93[_0x6c57('0xb6')]]){if(_0x3ac624&&_0x3ac624[_0x6c57('0x7d')]!=='ivr'){delete this[_0x6c57('0x25')][_0x4cae93[_0x6c57('0xdc')]];this[_0x6c57('0x1f')][_0x4cae93[_0x6c57('0xb6')]][_0x6c57('0x60')]+=0x1;var _0x2242b2=new AgentComplete(_0x3ac624,_0x4cae93);if(_0x4cae93[_0x6c57('0x10b')]==='agent'){_0x2242b2[_0x6c57('0x10c')]=this[_0x6c57('0x1f')][_0x4cae93['queue']]['dialQueueProject2']&&this[_0x6c57('0x1f')][_0x4cae93[_0x6c57('0xb6')]]['dialAgiAfterHangupAgent']?moment()[_0x6c57('0x7b')](_0x6c57('0xfa')):undefined;}this[_0x6c57('0xc8')](_0x2242b2)[_0x6c57('0xb3')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x6c57('0xc7')](_0x2242b2)[_0x6c57('0xb3')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x6c57('0x19')][_0x6c57('0x10d')]=function(_0x127f4a){if(this[_0x6c57('0x1f')][_0x127f4a[_0x6c57('0xb6')]]){if(this[_0x6c57('0x25')][_0x127f4a[_0x6c57('0xdc')]]&&this[_0x6c57('0x25')][_0x127f4a[_0x6c57('0xdc')]][_0x6c57('0x7d')]!==_0x6c57('0x7e')){this[_0x6c57('0xb5')](this[_0x6c57('0x1f')][_0x127f4a[_0x6c57('0xb6')]]);this[_0x6c57('0x25')][_0x127f4a['uniqueid']][_0x6c57('0x10e')]=moment()['format'](_0x6c57('0xfa'));}}};Dialer[_0x6c57('0x19')][_0x6c57('0x10f')]=function(_0x4114c7){this['createHistory'](_0x4114c7)[_0x6c57('0xb3')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x4114c7)['catch'](loggerCatch(_0x6c57('0x110')));};Dialer[_0x6c57('0x19')][_0x6c57('0x2e')]=function(_0x1c9066){var _0x2b0721=this[_0x6c57('0x25')][_0x1c9066['uniqueid']];var _0x56cb11=this;if(this[_0x6c57('0x1f')][_0x1c9066['queue']]){if(_0x2b0721&&_0x2b0721[_0x6c57('0x7d')]!==_0x6c57('0x7e')){delete this[_0x6c57('0x25')][_0x1c9066[_0x6c57('0xdc')]];this[_0x6c57('0xb5')](this[_0x6c57('0x1f')][_0x1c9066['queue']]);_0x2b0721['droptime']=moment()[_0x6c57('0x7b')](_0x6c57('0xfa'));var _0x1b4b49=new QueueCallerAbandon(_0x2b0721,_0x1c9066);if(getSeconds(_0x2b0721[_0x6c57('0x111')],_0x2b0721[_0x6c57('0x112')])>=_0x2b0721[_0x6c57('0x113')]){this[_0x6c57('0x1f')][_0x1c9066['queue']][_0x6c57('0x6b')]+=0x1;this[_0x6c57('0x1f')][_0x1c9066[_0x6c57('0xb6')]][_0x6c57('0x63')]+=0x1;this[_0x6c57('0x1f')][_0x1c9066[_0x6c57('0xb6')]][_0x6c57('0x6d')]+=0x1;_0x1b4b49[_0x6c57('0xa9')]=0xa;_0x1b4b49[_0x6c57('0xaa')]=_0x6c57('0x114');_0x1b4b49[_0x6c57('0x115')]='TIMEOUT';_0x1b4b49['agiafterat']=this[_0x6c57('0x1f')][_0x1c9066['queue']][_0x6c57('0x116')]?moment()['format'](_0x6c57('0xfa')):undefined;_0x1b4b49[_0x6c57('0xf2')]+=0x1;_0x1b4b49[_0x6c57('0xed')]+=0x1;if(_0x1b4b49[_0x6c57('0xf2')]>=this[_0x6c57('0x1f')][_0x1c9066['queue']]['dialDropMaxRetry']){this[_0x6c57('0x10f')](_0x1b4b49);}else{this[_0x6c57('0xc1')]({'active':![],'countdropretry':_0x1b4b49[_0x6c57('0xf2')],'scheduledat':moment()[_0x6c57('0xf8')](this[_0x6c57('0x1f')][_0x1c9066['queue']]['dialDropRetryFrequency'],_0x6c57('0xf9'))[_0x6c57('0x7b')](_0x6c57('0xfa')),'ContactId':_0x2b0721[_0x6c57('0xd0')],'ListId':_0x2b0721['ListId'],'VoiceQueueId':_0x2b0721[_0x6c57('0xfb')]||undefined,'CampaignId':_0x2b0721[_0x6c57('0xd3')]||undefined})[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x117')));var _0x3f3ba8=new History(_0x1b4b49);_0x3f3ba8[_0x6c57('0xa9')]=0xa;_0x3f3ba8['statedesc']=_0x6c57('0x114');_0x3f3ba8['starttime']=moment()[_0x6c57('0x7b')](_0x6c57('0xfa'));_0x3f3ba8[_0x6c57('0xab')]=_0x3f3ba8[_0x6c57('0x118')];_0x3f3ba8[_0x6c57('0x119')]=_0x1b4b49[_0x6c57('0x119')];_0x3f3ba8[_0x6c57('0x11a')]=_0x1b4b49['calleridnum'];this[_0x6c57('0xc8')](_0x3f3ba8)['catch'](loggerCatch(_0x6c57('0x11b')));}}else{this['voiceQueues'][_0x1c9066[_0x6c57('0xb6')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x6c57('0x1f')][_0x1c9066[_0x6c57('0xb6')]][_0x6c57('0x62')]+=0x1;_0x1b4b49[_0x6c57('0xa9')]=0xb;_0x1b4b49[_0x6c57('0xaa')]=_0x6c57('0x11c');_0x1b4b49[_0x6c57('0x115')]=_0x6c57('0x11d');_0x1b4b49[_0x6c57('0x100')]+=0x1;_0x1b4b49[_0x6c57('0xed')]+=0x1;if(_0x1b4b49[_0x6c57('0x100')]>=this['voiceQueues'][_0x1c9066['queue']]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x1b4b49);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x1b4b49['countabandonedretry'],'scheduledat':moment()[_0x6c57('0xf8')](this[_0x6c57('0x1f')][_0x1c9066[_0x6c57('0xb6')]][_0x6c57('0x11e')],_0x6c57('0xf9'))[_0x6c57('0x7b')](_0x6c57('0xfa')),'ContactId':_0x2b0721['ContactId'],'ListId':_0x2b0721[_0x6c57('0xd1')],'VoiceQueueId':_0x2b0721[_0x6c57('0xfb')]||undefined,'CampaignId':_0x2b0721[_0x6c57('0xd3')]||undefined})[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x11f')));var _0x3f3ba8=new History(_0x1b4b49);_0x3f3ba8[_0x6c57('0xa9')]=0xb;_0x3f3ba8[_0x6c57('0xaa')]='Abandoned';_0x3f3ba8[_0x6c57('0x118')]=moment()[_0x6c57('0x7b')](_0x6c57('0xfa'));_0x3f3ba8['endtime']=_0x3f3ba8[_0x6c57('0x118')];_0x3f3ba8['calleridname']=_0x1b4b49[_0x6c57('0x119')];_0x3f3ba8['calleridnum']=_0x1b4b49[_0x6c57('0x11a')];this[_0x6c57('0xc8')](_0x3f3ba8)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x120')));}}}}};Dialer[_0x6c57('0x19')]['syncNewExten']=function(_0x42ffc6){if(this[_0x6c57('0xae')][_0x42ffc6[_0x6c57('0xdc')]]){this[_0x6c57('0xae')][_0x42ffc6['uniqueid']][_0x6c57('0xb2')]=_0x42ffc6[_0x6c57('0xb2')];}if(this[_0x6c57('0x25')][_0x42ffc6[_0x6c57('0xdc')]]){this['uniqueId'][_0x42ffc6[_0x6c57('0xdc')]][_0x6c57('0xb2')]=_0x42ffc6[_0x6c57('0xb2')];}};Dialer[_0x6c57('0x19')][_0x6c57('0x39')]=function(_0xc18905){if(strategy[this[_0x6c57('0x1f')][this['actions'][_0xc18905[_0x6c57('0x121')]]['queue']][_0x6c57('0x50')]]==='roundrobin'){if(this[_0x6c57('0xae')][_0xc18905[_0x6c57('0x121')]]&&_[_0x6c57('0xdd')](this[_0x6c57('0xae')][_0xc18905[_0x6c57('0x121')]][_0x6c57('0x122')])&&_0xc18905['status']==='1'&&_0xc18905[_0x6c57('0x123')]==='0'){if(this['agents'][_0xc18905[_0x6c57('0x124')]]){if(!this['agents'][_0xc18905[_0x6c57('0x124')]]['locked']){this[_0x6c57('0x21')][_0xc18905[_0x6c57('0x124')]][_0x6c57('0x122')]=!![];this['actions'][_0xc18905[_0x6c57('0x121')]]['locked']=!![];this[_0x6c57('0xae')][_0xc18905[_0x6c57('0x121')]][_0x6c57('0x124')]=_0xc18905[_0x6c57('0x124')];}}}}else if((strategy[this['voiceQueues'][this[_0x6c57('0xae')][_0xc18905[_0x6c57('0x121')]]['queue']][_0x6c57('0x50')]]||_0x6c57('0x125'))===_0x6c57('0x125')){if(this[_0x6c57('0xae')][_0xc18905[_0x6c57('0x121')]]){if(this[_0x6c57('0x21')][_0xc18905[_0x6c57('0x124')]]){this[_0x6c57('0xae')][_0xc18905[_0x6c57('0x121')]][_0x6c57('0x124')]=_0xc18905[_0x6c57('0x124')];if(_[_0x6c57('0xdd')](this[_0x6c57('0x29')][this[_0x6c57('0xae')][_0xc18905[_0x6c57('0x121')]][_0x6c57('0xb6')]])){this['queueBooked'][this['actions'][_0xc18905['actionid']][_0x6c57('0xb6')]]=[];}this['queueBooked'][this[_0x6c57('0xae')][_0xc18905[_0x6c57('0x121')]][_0x6c57('0xb6')]][_0x6c57('0x126')](_['merge'](_[_0x6c57('0xcf')](this[_0x6c57('0xae')][_0xc18905[_0x6c57('0x121')]],[_0x6c57('0x127'),'stateinterface']),{'status':_0xc18905['status'],'paused':_0xc18905[_0x6c57('0x123')]}));}}}};function unlockQueueStatus(_0x2e3270,_0x2f643f){setTimeout(function(){if(_['isUndefined'](_0x2e3270[_0x6c57('0x128')])){loggerBooked[_0x6c57('0x97')](_0x6c57('0x129'),_0x2f643f);}_0x2e3270[_0x6c57('0x128')]=!![];loggerBooked[_0x6c57('0x81')](_0x6c57('0x12a'),_0x2f643f,JSON[_0x6c57('0x4b')](_[_0x6c57('0xcf')](_0x2e3270,[_0x6c57('0x41'),_0x6c57('0x128')])));},0x1f3);}Dialer[_0x6c57('0x19')][_0x6c57('0x3b')]=function(_0x58299a){var _0x28a9b6=this;var _0x93e3e2=_0x28a9b6[_0x6c57('0x1f')][_0x28a9b6[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]];if(strategy[this['voiceQueues'][this['actions'][_0x58299a['actionid']][_0x6c57('0xb6')]]['strategy']]===_0x6c57('0x12b')){if(this['actions'][_0x58299a['actionid']]&&this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0x124')]){this['preview'][_0x6c57('0x12c')](this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0x127')],this['actions'][_0x58299a[_0x6c57('0x121')]][_0x6c57('0x124')])['catch'](function(_0xe0b222){logger[_0x6c57('0x97')](_0x6c57('0x12d'),util[_0x6c57('0x98')](_0xe0b222,{'showHidden':![],'depth':null}));})[_0x6c57('0x1c')](function(){_0x28a9b6[_0x6c57('0xb5')](_0x28a9b6[_0x6c57('0x1f')][_0x28a9b6[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]]);_0x28a9b6[_0x6c57('0x21')][_0x28a9b6[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0x124')]][_0x6c57('0x122')]=![];delete _0x28a9b6[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]];unlockQueueStatus(_0x93e3e2);});}else{this[_0x6c57('0xb5')](this[_0x6c57('0x1f')][this['actions'][_0x58299a['actionid']][_0x6c57('0xb6')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]]['ContactId'],'ListId':this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]]['ListId'],'VoiceQueueId':this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xfb')]||undefined,'CampaignId':this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xd3')]||undefined})['catch'](loggerCatch(_0x6c57('0x12e')));delete this['actions'][_0x58299a[_0x6c57('0x121')]];unlockQueueStatus(_0x93e3e2);}}else if((strategy[this[_0x6c57('0x1f')][this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]][_0x6c57('0x50')]]||'rrmemory')===_0x6c57('0x125')){var _0x2d89fc;if(this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]]&&!_[_0x6c57('0x80')](this['queueBooked'][this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]]['queue']])){if(this[_0x6c57('0x2a')][_0x28a9b6[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]]){this[_0x6c57('0x2a')][_0x28a9b6[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]]=this[_0x6c57('0x2a')][this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]]?this[_0x6c57('0x2a')][this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]]:this[_0x6c57('0x29')][this[_0x6c57('0xae')][_0x58299a['actionid']][_0x6c57('0xb6')]]?this[_0x6c57('0x29')][this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]][_0x6c57('0x12f')]||0x0:0x0;}this[_0x6c57('0x29')][this['actions'][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]]['_rr']=this[_0x6c57('0x2a')][this[_0x6c57('0xae')][_0x58299a[_0x6c57('0x121')]][_0x6c57('0xb6')]];for(var _0x48dd5d=0x0;_0x48dd5d=0x0;})[_0x6c57('0xb3')](myreject(_0x5c9d89)));}}else{_0x48ae4f[_0x6c57('0x126')](ami['Action']({'action':'command','command':util[_0x6c57('0x7b')](_0x6c57('0x146'),_0x3d2529,!_[_0x6c57('0x3e')](config['timezones'][_0x362d4e])?_0x362d4e:'')})[_0x6c57('0xba')](function(_0x34fac8){return _0x34fac8[_0x6c57('0x147')][_0x6c57('0x148')](_0x6c57('0x149'))>=0x0;})[_0x6c57('0xb3')](myreject(_0x5c9d89)));}BPromise[_0x6c57('0x14a')](_0x48ae4f)['then'](function(_0x8cb19a){var _0x1bac65=_['some'](_0x8cb19a);if(_0x1bac65){return _0x5d5487(_0x1bac65);}else{_0x3436ef[_0x6c57('0x3f')]=_0x24e754?_0x6c57('0x14b'):_0x6c57('0x14c');return _0x5c9d89(msgResponse(_0x6c57('0x14d'),'Failure','Global:\x20'+_0x24e754+'\x20'+_0x3aea53+_0x6c57('0x14e')+util[_0x6c57('0x98')](_0x3d2529,{'showHidden':![],'depth':null})+_0x6c57('0x14f')+_0x362d4e));}})['catch'](function(_0x52ab19){return _0x5c9d89(msgResponse(_0x6c57('0x13f'),'Failure',JSON[_0x6c57('0x4b')](_0x52ab19)));});});};Dialer[_0x6c57('0x19')][_0x6c57('0x150')]=function(_0x9a1659){var _0x419662=this;return function(){switch(_0x9a1659['dialMethod']){case _0x6c57('0x151'):freeVariablesPredictive(_0x9a1659);_0x419662[_0x6c57('0x152')](_0x9a1659,0x1);break;case'power':freeVariablesPredictive(_0x9a1659);_0x419662[_0x6c57('0x152')](_0x9a1659,_0x9a1659[_0x6c57('0x153')]);break;case _0x6c57('0x9'):_0x419662[_0x6c57('0x9')](_0x9a1659);break;case _0x6c57('0x8'):freeVariablesPredictive(_0x9a1659);_0x419662[_0x6c57('0x152')](_0x9a1659,0x1);break;default:freeVariablesPredictive(_0x9a1659);logger['error'](_0x6c57('0x154'),_0x9a1659[_0x6c57('0x41')],_0x6c57('0x155'));}};};Dialer[_0x6c57('0x19')][_0x6c57('0x156')]=function(_0x11d17a){var _0x4e2721=this;return function(){_0x4e2721[_0x6c57('0x157')](_0x11d17a);};};Dialer[_0x6c57('0x19')]['syncQueueSummary']=function(_0x342522){var _0x545ed5=this;if(isNotPreview(_0x342522[_0x6c57('0x5b')])){if(isVoiceQueueOutbound(_0x342522[_0x6c57('0x7d')])&&isActive(_0x342522[_0x6c57('0x5a')])){_0x342522[_0x6c57('0xa1')]=!![];BPromise[_0x6c57('0xbc')]()['then'](checkIsLoggedIn(_0x342522,_0x342522['loggedIn']))[_0x6c57('0xba')](checkIsActive(_0x342522,_0x342522[_0x6c57('0x5a')]))[_0x6c57('0xba')](checkInterval(_0x342522))[_0x6c57('0xba')](_0x545ed5['checkIsTrunkReachable'](_0x342522))[_0x6c57('0xba')](_0x545ed5[_0x6c57('0x13d')](_0x342522['dialGlobalInterval'],_0x342522['dialTimezone'],_0x342522[_0x6c57('0x41')],_0x342522))['then'](_0x545ed5[_0x6c57('0x13e')](_0x342522[_0x6c57('0x47')],_0x342522[_0x6c57('0x158')],_0x342522[_0x6c57('0x41')],_0x342522))[_0x6c57('0xba')](_0x545ed5[_0x6c57('0x150')](_0x342522))[_0x6c57('0xb3')](loggerCatchQueueSummary(_0x6c57('0x159'),_0x342522));}else{notSendMessagesQueue(_0x342522);}}else{freeVariablesPredictive(_0x342522);}};Dialer['prototype'][_0x6c57('0x139')]=function(){var _0x208a94=this;var _0x208148;for(var _0x3c6bb5 in this['campaigns']){if(typeof this['campaigns'][_0x3c6bb5]!==_0x6c57('0x9b')){_0x208148=this[_0x6c57('0x20')][_0x3c6bb5];if(isCampaignIvr(_0x208148['type'])&&isActive(_0x208148[_0x6c57('0x78')])){_0x208148['sendMessageOneNotActive']=!![];BPromise[_0x6c57('0xbc')]()['then'](checkIsActive(_0x208148,_0x208148['active']))['then'](checkInterval(_0x208148))[_0x6c57('0xba')](_0x208a94[_0x6c57('0x15a')](_0x208148))[_0x6c57('0xba')](_0x208a94[_0x6c57('0x13d')](_0x208148[_0x6c57('0x15b')],_0x208148[_0x6c57('0x158')],_0x208148[_0x6c57('0x41')],_0x208148))[_0x6c57('0xba')](_0x208a94[_0x6c57('0x13e')](_0x208148['Interval'],_0x208148[_0x6c57('0x158')],_0x208148[_0x6c57('0x41')],_0x208148))[_0x6c57('0xba')](_0x208a94[_0x6c57('0x156')](_0x208148))[_0x6c57('0xb3')](loggerCatchQueueSummary(_0x6c57('0x15c'),_0x208148));}else{notSendMessagesCampaign(_0x208148);}}}};function getCallerIdRandom(_0x395612,_0x298b97){var _0x4f23ba;var _0x1b260a;var _0x2c6ea0;if(_0x298b97<=0x0){_0x298b97=0x1;}_0x4f23ba=new RegExp('\x5cw{0,'+_0x298b97+'}$');_0x1b260a=Math[_0x6c57('0x15d')](0xa,_0x298b97-0x1);_0x2c6ea0=Math[_0x6c57('0x15d')](0xa,_0x298b97)-0x1;return util[_0x6c57('0x7b')]('%s',_['replace'](_0x395612,_0x4f23ba,_[_0x6c57('0x15e')](_0x1b260a,_0x2c6ea0)));}function extractCalleridName(_0x59361a){var _0x1acf60=_0x59361a[_0x6c57('0x15f')](/"(.*?)"/);return _0x1acf60?_0x1acf60[0x1]:_0x59361a;}function extractCalleridNumber(_0xdeb23c){var _0x3df2fe=_0xdeb23c[_0x6c57('0x15f')](/<(.*?)>/);return _0x3df2fe?_0x3df2fe[0x1]:_0xdeb23c;}Dialer[_0x6c57('0x19')]['actionOriginate']=function(_0x2883b7,_0x343031){var _0x477642=this;var _0x101298=uuid['v4']();this['actions'][_0x101298]=new Action(_0x2883b7,_0x343031,_0x101298);return new BPromise(function(_0x4d380e,_0x5443b7){if(_[_0x6c57('0x3e')](_0x2883b7)&&typeof _0x2883b7!==_0x6c57('0x160')){return _0x5443b7(msgResponse(_0x6c57('0x161'),_0x6c57('0x140'),'voiceQueue\x20is\x20undefine'));}if(_[_0x6c57('0x3e')](_0x343031[_0x6c57('0x162')]['phone'])||_0x343031[_0x6c57('0x162')][_0x6c57('0x163')]===null){return _0x5443b7(msgResponse('originate',_0x6c57('0x140'),_0x6c57('0x164')));}var _0x123baf={'XMD-CALLERID':_0x477642[_0x6c57('0xae')][_0x101298][_0x6c57('0x165')](),'XMD-AGI':_0x2883b7[_0x6c57('0x166')]?util[_0x6c57('0x7b')](_0x6c57('0x167'),ipAgi,_0x2883b7[_0x6c57('0x166')]):_0x6c57('0x168'),'XMD-AGIAFTER':_0x2883b7['dialQueueProject2']?util[_0x6c57('0x7b')](_0x6c57('0x167'),ipAgi,_0x2883b7[_0x6c57('0x116')]):_0x6c57('0x168'),'XMD-QUEUE':_0x2883b7[_0x6c57('0x7d')]===_0x6c57('0x4f')?util[_0x6c57('0x7b')](_0x6c57('0x169'),_0x2883b7[_0x6c57('0x41')],_0x2883b7[_0x6c57('0x16a')]||'',_0x2883b7['dialAgiAfterHangupAgent']?'c':'',_0x2883b7[_0x6c57('0x113')]||0x3):_0x6c57('0x168'),'XMD-CONTACTID':_0x343031[_0x6c57('0xd0')],'XMD-CDRTYPE':_0x6c57('0x7'),'CALLERID(all)':_0x477642[_0x6c57('0xae')][_0x101298]['getCaller'](),'XMD-AMD':_0x2883b7[_0x6c57('0xe1')]?'ACTIVE':_0x6c57('0x168'),'XMD-DESTINATION':_0x6c57('0xe0')};if(_0x2883b7[_0x6c57('0xe1')]){_0x123baf['XMD-AMDINITIALSILENCE']=_0x2883b7[_0x6c57('0x16b')]||0x9c4;_0x123baf[_0x6c57('0x16c')]=_0x2883b7[_0x6c57('0x16d')]||0x5dc;_0x123baf[_0x6c57('0x16e')]=_0x2883b7['dialAMDAfterGreetingSilence']||0x320;_0x123baf[_0x6c57('0x16f')]=_0x2883b7[_0x6c57('0x170')]||0x1388;_0x123baf[_0x6c57('0x171')]=_0x2883b7[_0x6c57('0x172')]||0x64;_0x123baf[_0x6c57('0x173')]=_0x2883b7['dialAMDBetweenWordsSilence']||0x32;_0x123baf[_0x6c57('0x174')]=_0x2883b7[_0x6c57('0x175')]||0x3;_0x123baf[_0x6c57('0x176')]=_0x2883b7[_0x6c57('0x177')]||0x100;_0x123baf[_0x6c57('0x178')]=_0x2883b7[_0x6c57('0x179')]||0x1388;}if(_0x2883b7[_0x6c57('0x7d')]==='outbound'){_0x123baf[_0x6c57('0x17a')]=_0x343031[_0x6c57('0xfb')];}else{_0x123baf[_0x6c57('0x17b')]=_0x343031[_0x6c57('0xd3')];}for(var _0x5ec045 in _0x343031['Contact']){if(typeof _0x343031['Contact'][_0x5ec045]!==_0x6c57('0x9b')){if(isNotNull(_0x343031[_0x6c57('0x162')][_0x5ec045])&&_0x5ec045!=='id'&&_0x5ec045!=='tags'&&_0x5ec045!==_0x6c57('0x17c')&&_0x5ec045!=='updatedAt'){_0x123baf[util[_0x6c57('0x7b')](_0x6c57('0x17d'),_0x6c57('0x17e'),_[_0x6c57('0x17f')](_0x5ec045))]=_0x343031[_0x6c57('0x162')][_0x5ec045];}}}var _0x27ed87=_0x477642[_0x6c57('0xd8')](_0x2883b7['Trunk'])?getCallerId(_0x2883b7[_0x6c57('0x77')][_0x6c57('0x79')],_0x2883b7[_0x6c57('0x5c')],_0x2883b7['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2883b7[_0x6c57('0x5d')],_0x2883b7[_0x6c57('0x180')]):_0x2883b7[_0x6c57('0x5d')]):getCallerId(_[_0x6c57('0xdd')](_0x2883b7['TrunkBackup'])?_0x2883b7[_0x6c57('0x77')][_0x6c57('0x79')]:_0x2883b7['TrunkBackup'][_0x6c57('0x79')],_0x2883b7[_0x6c57('0x5c')],_0x2883b7[_0x6c57('0x180')]>0x0?getCallerIdRandom(_0x2883b7[_0x6c57('0x5d')],_0x2883b7[_0x6c57('0x180')]):_0x2883b7[_0x6c57('0x5d')]);if(_0x27ed87){_0x123baf[_0x6c57('0x181')]=_0x477642[_0x6c57('0xae')][_0x101298][_0x6c57('0x182')]=extractCalleridName(_0x27ed87);_0x123baf[_0x6c57('0x183')]=_0x477642[_0x6c57('0xae')][_0x101298][_0x6c57('0x184')]=extractCalleridNumber(_0x27ed87);}return ami[_0x6c57('0xb0')]({'actionid':_0x101298,'action':_0x6c57('0x161'),'channel':_0x477642[_0x6c57('0xd8')](_0x2883b7[_0x6c57('0x77')])?util[_0x6c57('0x7b')](_0x6c57('0x185'),_0x2883b7[_0x6c57('0x77')]['name'],isNotNull(_0x2883b7[_0x6c57('0x186')])?_0x2883b7[_0x6c57('0x186')][_0x6c57('0x187')]()||'':'',_0x2883b7['dialCutDigit']>0x0?_0x343031[_0x6c57('0x162')]['phone']['substring'](_0x2883b7[_0x6c57('0x188')]):_0x343031['Contact'][_0x6c57('0x163')]):util[_0x6c57('0x7b')](_0x6c57('0x185'),_[_0x6c57('0xdd')](_0x2883b7[_0x6c57('0x13a')])?_0x2883b7[_0x6c57('0x77')][_0x6c57('0x41')]:_0x2883b7[_0x6c57('0x13a')]['name'],isNotNull(_0x2883b7[_0x6c57('0x186')])?_0x2883b7[_0x6c57('0x186')][_0x6c57('0x187')]()||'':'',_0x2883b7[_0x6c57('0x188')]>0x0?_0x343031[_0x6c57('0x162')][_0x6c57('0x163')][_0x6c57('0x189')](_0x2883b7['dialCutDigit']):_0x343031[_0x6c57('0x162')]['phone']),'callerid':_0x27ed87,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x123baf,'timeout':(_0x2883b7[_0x6c57('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x101298})[_0x6c57('0xba')](function(_0x537a43){return _0x4d380e(_0x537a43);})['catch'](function(_0x34f452){_0x2883b7[_0x6c57('0x66')]+=0x1;var _0x4550e2=new History(_0x477642[_0x6c57('0xae')][_0x101298]);logger[_0x6c57('0x97')](util[_0x6c57('0x7b')](_0x6c57('0x18a'),JSON[_0x6c57('0x4b')](_0x34f452)));_0x4550e2[_0x6c57('0xa9')]=0xe;_0x4550e2[_0x6c57('0xaa')]=_0x6c57('0x18b');_0x4550e2[_0x6c57('0x118')]=moment()[_0x6c57('0x7b')](_0x6c57('0xfa'));_0x4550e2[_0x6c57('0xab')]=_0x4550e2[_0x6c57('0x118')];_0x477642[_0x6c57('0xc8')](_0x4550e2)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x18c')));_0x477642[_0x6c57('0xc7')](_0x4550e2)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x18c')))['finally'](function(){delete _0x477642[_0x6c57('0xae')][_0x101298];return _0x5443b7(msgResponse('originate',_0x6c57('0x4a'),_0x6c57('0x18d')));});});});};Dialer[_0x6c57('0x19')]['syncOriginateResponse']=function(_0x143d7f){var _0x2f3d7c=this['actions'][_0x143d7f[_0x6c57('0x121')]];if(_0x2f3d7c){delete this[_0x6c57('0xae')][_0x143d7f[_0x6c57('0x121')]];_0x2f3d7c[_0x6c57('0x112')]=moment()[_0x6c57('0x7b')](_0x6c57('0xfa'));var _0x359bbb=_0x2f3d7c[_0x6c57('0x7d')]==='ivr'?this[_0x6c57('0x20')][_0x2f3d7c[_0x6c57('0xb6')]]:this[_0x6c57('0x1f')][_0x2f3d7c['getQueue']()];if(!this[_0x6c57('0xd6')](_0x143d7f[_0x6c57('0x18e')])){this[_0x6c57('0xb5')](_0x359bbb);return this[_0x6c57('0x18f')](_0x2f3d7c,_0x359bbb,_0x143d7f)['catch'](loggerCatch(_0x6c57('0x190')));}this[_0x6c57('0x25')][_0x143d7f[_0x6c57('0xdc')]]=_0x2f3d7c;}};Dialer['prototype'][_0x6c57('0x191')]=function(_0x3546ad,_0x597824,_0x45dc85){var _0x465c99=new History(_0x597824);if(_0x465c99[_0x6c57('0xef')]+_0x465c99[_0x6c57('0x192')]+_0x465c99[_0x6c57('0xf0')]+_0x465c99[_0x6c57('0xf1')]+_0x465c99[_0x6c57('0xf2')]+_0x465c99['countabandonedretry']+_0x465c99[_0x6c57('0xec')]+_0x465c99['countagentrejectretry']>=_0x45dc85['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3546ad){case 0x3:if(_0x465c99[_0x6c57('0xf0')]>=_0x45dc85[_0x6c57('0x193')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x465c99[_0x6c57('0xf0')]+=0x1,'scheduledat':moment()[_0x6c57('0xf8')](_0x45dc85[_0x6c57('0x194')],_0x6c57('0xf9'))['format'](_0x6c57('0xfa')),'ContactId':_0x465c99[_0x6c57('0xd0')],'ListId':_0x465c99[_0x6c57('0xd1')],'VoiceQueueId':_0x465c99[_0x6c57('0xfb')]||undefined,'CampaignId':_0x465c99[_0x6c57('0xd3')]||undefined})[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x195')));break;case 0x5:if(_0x465c99[_0x6c57('0xef')]>=_0x45dc85[_0x6c57('0x196')]-0x1){return!![];}this[_0x6c57('0xc1')]({'active':![],'countbusyretry':_0x465c99[_0x6c57('0xef')]+=0x1,'scheduledat':moment()[_0x6c57('0xf8')](_0x45dc85['dialBusyRetryFrequency'],_0x6c57('0xf9'))[_0x6c57('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x465c99[_0x6c57('0xd0')],'ListId':_0x465c99['ListId'],'VoiceQueueId':_0x465c99['VoiceQueueId']||undefined,'CampaignId':_0x465c99['CampaignId']||undefined})[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x197')));break;case 0x8:if(_0x465c99[_0x6c57('0x192')]>=_0x45dc85[_0x6c57('0x198')]-0x1){return!![];}this[_0x6c57('0xc1')]({'active':![],'countcongestionretry':_0x465c99[_0x6c57('0x192')]+=0x1,'scheduledat':moment()['add'](_0x45dc85['dialCongestionRetryFrequency'],_0x6c57('0xf9'))[_0x6c57('0x7b')](_0x6c57('0xfa')),'ContactId':_0x465c99[_0x6c57('0xd0')],'ListId':_0x465c99[_0x6c57('0xd1')],'VoiceQueueId':_0x465c99[_0x6c57('0xfb')]||undefined,'CampaignId':_0x465c99[_0x6c57('0xd3')]||undefined})[_0x6c57('0xb3')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x465c99['countnosuchnumberretry']>=_0x45dc85[_0x6c57('0x199')]-0x1){return!![];}else{this[_0x6c57('0xc1')]({'active':![],'countnosuchnumberretry':_0x465c99[_0x6c57('0xf1')]+=0x1,'scheduledat':moment()[_0x6c57('0xf8')](_0x45dc85[_0x6c57('0x19a')],_0x6c57('0xf9'))[_0x6c57('0x7b')](_0x6c57('0xfa')),'ContactId':_0x465c99[_0x6c57('0xd0')],'ListId':_0x465c99['ListId'],'VoiceQueueId':_0x465c99[_0x6c57('0xfb')]||undefined,'CampaignId':_0x465c99['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x465c99['countdropretry']>=_0x45dc85[_0x6c57('0x19b')]-0x1){return!![];}this[_0x6c57('0xc1')]({'active':![],'countdropretry':_0x465c99['countdropretry']+=0x1,'scheduledat':moment()[_0x6c57('0xf8')](_0x45dc85[_0x6c57('0x19c')],_0x6c57('0xf9'))[_0x6c57('0x7b')](_0x6c57('0xfa')),'ContactId':_0x465c99[_0x6c57('0xd0')],'ListId':_0x465c99[_0x6c57('0xd1')],'VoiceQueueId':_0x465c99[_0x6c57('0xfb')]||undefined,'CampaignId':_0x465c99['CampaignId']||undefined})[_0x6c57('0xb3')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x465c99[_0x6c57('0x100')]>=_0x45dc85[_0x6c57('0x19d')]-0x1){return!![];}this[_0x6c57('0xc1')]({'active':![],'countabandonedretry':_0x465c99[_0x6c57('0x100')]+=0x1,'scheduledat':moment()[_0x6c57('0xf8')](_0x45dc85['dialAbandonedRetryFrequency'],_0x6c57('0xf9'))['format'](_0x6c57('0xfa')),'ContactId':_0x465c99[_0x6c57('0xd0')],'ListId':_0x465c99['ListId'],'VoiceQueueId':_0x465c99[_0x6c57('0xfb')]||undefined,'CampaignId':_0x465c99[_0x6c57('0xd3')]||undefined})[_0x6c57('0xb3')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x465c99[_0x6c57('0xec')]>=_0x45dc85['dialMachineMaxRetry']-0x1){return!![];}this[_0x6c57('0xc1')]({'active':![],'countmachineretry':_0x465c99[_0x6c57('0xec')]+=0x1,'scheduledat':moment()[_0x6c57('0xf8')](_0x45dc85[_0x6c57('0x103')],_0x6c57('0xf9'))['format'](_0x6c57('0xfa')),'ContactId':_0x465c99[_0x6c57('0xd0')],'ListId':_0x465c99[_0x6c57('0xd1')],'VoiceQueueId':_0x465c99[_0x6c57('0xfb')]||undefined,'CampaignId':_0x465c99[_0x6c57('0xd3')]||undefined})[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x104')));break;case 0x14:if(_0x465c99[_0x6c57('0xf3')]>=_0x45dc85[_0x6c57('0x19e')]-0x1){return!![];}this[_0x6c57('0xc1')]({'active':![],'countagentrejectretry':_0x465c99[_0x6c57('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x45dc85[_0x6c57('0x19f')],_0x6c57('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x465c99[_0x6c57('0xd0')],'ListId':_0x465c99[_0x6c57('0xd1')],'VoiceQueueId':_0x465c99['VoiceQueueId']||undefined,'CampaignId':_0x465c99['CampaignId']||undefined})[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x1a0')));break;default:return!![];}};Dialer[_0x6c57('0x19')]['callProgressDetecting']=function(_0xb1ed2a,_0x6c13aa,_0x465796){var _0x2789ea=this;var _0x3f071f=new History(_0xb1ed2a);return new BPromise(function(_0x21e8d4,_0x17c7b8){if(_[_0x6c57('0x3e')](_0x6c13aa)&&typeof _0x6c13aa!=='object'){return _0x17c7b8(msgResponse(_0x6c57('0x1a1'),'Failure',_0x6c57('0x1a2')));}if(_[_0x6c57('0x3e')](_0x465796)&&typeof _0x465796!==_0x6c57('0x160')){return _0x17c7b8(msgResponse(_0x6c57('0x1a1'),_0x6c57('0x140'),_0x6c57('0x1a3')));}switch(_0x465796[_0x6c57('0x10b')]){case'0':_0x6c13aa[_0x6c57('0x65')]+=0x1;_0x3f071f[_0x6c57('0xa9')]=0x0;_0x3f071f[_0x6c57('0xaa')]=_0x6c57('0x1a4');_0x3f071f[_0x6c57('0xf1')]+=0x1;_0x3f071f[_0x6c57('0xed')]+=0x1;ami[_0x6c57('0x4e')](_0x6c57('0x1a5'),ut[_0x6c57('0xe5')](_0xb1ed2a,_0x6c57('0x1a6')));_0x2789ea[_0x6c57('0xc8')](_0x3f071f)[_0x6c57('0xb3')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2789ea[_0x6c57('0x191')](0x0,_0xb1ed2a,_0x6c13aa)){if(_0x3f071f[_0x6c57('0xf1')]>=_0x6c13aa[_0x6c57('0x199')]){_0x2789ea[_0x6c57('0x102')](_0x3f071f,_0x21e8d4,_0x17c7b8,'reason\x200\x20no\x20such\x20number....');}else{_0x2789ea[_0x6c57('0x101')](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x6c57('0x1a7'));}}break;case'3':_0x6c13aa[_0x6c57('0x64')]+=0x1;_0x3f071f['state']=0x3;_0x3f071f[_0x6c57('0xaa')]=_0x6c57('0x1a8');_0x3f071f[_0x6c57('0xf0')]+=0x1;_0x3f071f['countglobal']+=0x1;ami['emit'](_0x6c57('0x1a9'),ut[_0x6c57('0xe5')](_0xb1ed2a,_0x6c57('0x1aa')));_0x2789ea[_0x6c57('0xc8')](_0x3f071f)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x1ab')));if(_0x2789ea['checkRetriveMax'](0x3,_0xb1ed2a,_0x6c13aa)){if(_0x3f071f[_0x6c57('0xf0')]>=_0x6c13aa['dialNoAnswerMaxRetry']){_0x2789ea[_0x6c57('0x102')](_0x3f071f,_0x21e8d4,_0x17c7b8,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2789ea['stateGlobal'](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x6c57('0x1ac'));}}break;case'5':_0x6c13aa[_0x6c57('0x1ad')]+=0x1;_0x3f071f[_0x6c57('0xa9')]=0x5;_0x3f071f['statedesc']=_0x6c57('0x1ae');_0x3f071f[_0x6c57('0xef')]+=0x1;_0x3f071f[_0x6c57('0xed')]+=0x1;ami[_0x6c57('0x4e')](_0x6c57('0x1af'),ut[_0x6c57('0xe5')](_0xb1ed2a,_0x6c57('0x1b0')));_0x2789ea['createHistory'](_0x3f071f)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x1b1')));if(_0x2789ea[_0x6c57('0x191')](0x5,_0xb1ed2a,_0x6c13aa)){if(_0x3f071f['countbusyretry']>=_0x6c13aa[_0x6c57('0x196')]){_0x2789ea[_0x6c57('0x102')](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x6c57('0x1b2'));}else{_0x2789ea[_0x6c57('0x101')](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x6c57('0x1b2'));}}break;case'8':_0x6c13aa[_0x6c57('0x61')]+=0x1;_0x3f071f[_0x6c57('0xa9')]=0x8;_0x3f071f[_0x6c57('0xaa')]=_0x6c57('0x1b3');_0x3f071f[_0x6c57('0x192')]+=0x1;_0x3f071f['countglobal']+=0x1;ami[_0x6c57('0x4e')](_0x6c57('0x1b4'),ut[_0x6c57('0xe5')](_0xb1ed2a,_0x6c57('0x1b5')));_0x2789ea[_0x6c57('0xc8')](_0x3f071f)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x1b6')));if(_0x2789ea[_0x6c57('0x191')](0x8,_0xb1ed2a,_0x6c13aa)){if(_0x3f071f[_0x6c57('0x192')]>=_0x6c13aa[_0x6c57('0x198')]){_0x2789ea[_0x6c57('0x102')](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x6c57('0x1b7'));}else{_0x2789ea[_0x6c57('0x101')](_0x3f071f,_0x21e8d4,_0x17c7b8,'reason\x208\x20congestion');}}break;case'11':_0x6c13aa['outboundAbandonedCallsDay']+=0x1;_0x3f071f[_0x6c57('0xa9')]=0xb;_0x3f071f[_0x6c57('0xaa')]=_0x6c57('0x11c');_0x3f071f['countabandonedretry']+=0x1;_0x3f071f[_0x6c57('0xed')]+=0x1;_0x2789ea['createHistory'](_0x3f071f)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x120')));if(_0x2789ea[_0x6c57('0x191')](0xb,_0xb1ed2a,_0x6c13aa)){if(_0x3f071f['countabandonedretry']>=_0x6c13aa[_0x6c57('0x19d')]){_0x2789ea[_0x6c57('0x102')](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x6c57('0x1b8'));}else{_0x2789ea[_0x6c57('0x101')](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x6c57('0x1b8'));}}break;case'20':_0x6c13aa['outboundRejectCallsDay']+=0x1;_0x3f071f[_0x6c57('0xa9')]=0x14;_0x3f071f[_0x6c57('0xaa')]=_0x6c57('0x1b9');_0x3f071f['countagentrejectretry']+=0x1;_0x3f071f[_0x6c57('0xed')]+=0x1;ami[_0x6c57('0x4e')](_0x6c57('0x1ba'),ut[_0x6c57('0xe5')](_0xb1ed2a,_0x6c57('0x1bb')));_0x2789ea[_0x6c57('0xc8')](_0x3f071f)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x1bc')));if(_0x2789ea['checkRetriveMax'](0x14,_0xb1ed2a,_0x6c13aa)){if(_0x3f071f[_0x6c57('0xf3')]>=_0x6c13aa[_0x6c57('0x19e')]){_0x2789ea['createStateFinal'](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x6c57('0x1bd'));}else{_0x2789ea[_0x6c57('0x101')](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x6c57('0x1bd'));}}break;default:_0x6c13aa[_0x6c57('0x109')]+=0x1;_0x3f071f[_0x6c57('0xa9')]=0xc;_0x3f071f[_0x6c57('0xaa')]=_0x465796[_0x6c57('0x10b')];_0x2789ea[_0x6c57('0xc8')](_0x3f071f)[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x1be')));if(_0x2789ea['checkRetriveMax'](_0x465796['reason'],_0xb1ed2a,_0x6c13aa)){if(_0x3f071f[_0x6c57('0xef')]+_0x3f071f[_0x6c57('0x192')]+_0x3f071f[_0x6c57('0xf0')]+_0x3f071f['countnosuchnumberretry']+_0x3f071f['countdropretry']+_0x3f071f['countabandonedretry']+_0x3f071f[_0x6c57('0xec')]+_0x3f071f[_0x6c57('0xf3')]>=_0x6c13aa[_0x6c57('0xf4')]){_0x2789ea['stateGlobal'](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x465796['reason']);}else{_0x2789ea['createStateFinal'](_0x3f071f,_0x21e8d4,_0x17c7b8,_0x465796['reason']);}}}});};Dialer[_0x6c57('0x19')][_0x6c57('0x101')]=function(_0x147ce2,_0x2fa2fa,_0x1fb466,_0x5d89b6){var _0x17ef33=new Final(_0x147ce2);_0x17ef33[_0x6c57('0xa9')]=0xf;_0x17ef33[_0x6c57('0xaa')]=_0x6c57('0x1bf');this['createStateFinal'](_0x17ef33,_0x2fa2fa,_0x1fb466,_0x5d89b6);};Dialer['prototype'][_0x6c57('0x102')]=function(_0x586d70,_0x457a45,_0x4494e8,_0x9fbe6e){this['moveContactManagedDialer'](_0x586d70)[_0x6c57('0xba')](function(){return _0x457a45(msgResponse(_0x6c57('0x1a1'),_0x6c57('0xd7'),_0x9fbe6e));})['catch'](function(){return _0x4494e8(msgResponse(_0x6c57('0x1c0'),_0x6c57('0x140'),_0x6c57('0x1c1')));});};Dialer[_0x6c57('0x19')]['predictive']=function(_0x1c60fe){var _0x11d5b4=_0x1c60fe[_0x6c57('0x1c2')]/0x64;var _0x521557=_0x1c60fe['outboundDropCallsDayTimeout']/(_0x1c60fe[_0x6c57('0x63')]+_0x1c60fe[_0x6c57('0x60')]);var _0x29d835=Math['round'](_0x1c60fe[_0x6c57('0x71')]*(_0x1c60fe[_0x6c57('0x1c3')]/0x64));var _0x2856a5=Math[_0x6c57('0x1c4')](_0x1c60fe[_0x6c57('0x71')]*(_0x1c60fe[_0x6c57('0x1c5')]/0x64));var _0x2adf6d=_0x1c60fe[_0x6c57('0xa3')]+_0x1c60fe[_0x6c57('0x55')];var _0x1fa705=Math['floor'](_0x1c60fe[_0x6c57('0x74')]*_0x1c60fe[_0x6c57('0x75')]*_0x1c60fe[_0x6c57('0x6e')]*_0x1c60fe[_0x6c57('0x6f')]);if(_[_0x6c57('0x3e')](_0x1c60fe[_0x6c57('0x28')])){if(!_[_0x6c57('0x3e')](_0x1c60fe['startPredictive'])){_0x1c60fe[_0x6c57('0x27')]=undefined;loggerPredictive[_0x6c57('0x97')](_0x6c57('0x1c6'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x6c57('0x3e')](_0x1c60fe[_0x6c57('0x93')])){loggerPredictive[_0x6c57('0x97')](_0x6c57('0x1c6'),_0x6c57('0x1c7'));clearInterval(_0x1c60fe[_0x6c57('0x93')]);_0x1c60fe[_0x6c57('0x93')]=undefined;}_0x1c60fe[_0x6c57('0x28')]=moment()[_0x6c57('0x7b')](_0x6c57('0xfa'));loggerPredictive['info'](_0x1c60fe[_0x6c57('0x41')],_0x6c57('0x1c8'),_0x1c60fe[_0x6c57('0x28')]);this[_0x6c57('0x152')](_0x1c60fe,0x1);}else if(ifInterval(_0x1c60fe['dialPredictiveInterval'],_0x1c60fe[_0x6c57('0x28')])){this[_0x6c57('0x152')](_0x1c60fe,0x1);loggerPredictiveCalls[_0x6c57('0x81')](_0x6c57('0x1c9'),_0x1c60fe['startProgressive'],_0x1c60fe[_0x6c57('0x41')]);_0x1c60fe[_0x6c57('0x74')]=0x0;_0x1c60fe['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x11d5b4<_0x521557&&_0x1c60fe['dialPredictiveOptimization']===_0x6c57('0x1ca')){freeVariablesPredictive(_0x1c60fe);loggerPredictive['info'](_0x6c57('0x1cb'),_0x6c57('0x1cc'),_0x521557,_0x6c57('0x28'),_0x1c60fe[_0x6c57('0x41')]);}else if(_0x1fa705<_0x1c60fe[_0x6c57('0x6d')]&&_0x1c60fe[_0x6c57('0x1cd')]==='dropRate'){freeVariablesPredictive(_0x1c60fe);loggerPredictive[_0x6c57('0x81')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x1fa705,_0x6c57('0x1ce'),_0x1c60fe[_0x6c57('0x6d')],_0x6c57('0x28'),_0x1c60fe[_0x6c57('0x41')]);}else if(!ifInterval(_0x1c60fe[_0x6c57('0x1cf')],_0x1c60fe[_0x6c57('0x28')])&&_[_0x6c57('0x3e')](_0x1c60fe[_0x6c57('0x27')])&&!_[_0x6c57('0x3e')](_0x1c60fe[_0x6c57('0x28')])){_0x1c60fe[_0x6c57('0x27')]=moment()[_0x6c57('0x7b')](_0x6c57('0xfa'));loggerPredictive[_0x6c57('0x81')](_0x1c60fe['name'],_0x6c57('0x1d0'),_0x1c60fe[_0x6c57('0x27')]);this[_0x6c57('0xbf')](_0x1c60fe['dialPredictiveInterval'])['then'](this[_0x6c57('0x1d1')](_0x1c60fe))[_0x6c57('0xba')](mergeDataErlangB(_0x1c60fe))['then'](this[_0x6c57('0x1d2')](_0x1c60fe))[_0x6c57('0xb3')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1c60fe));}else if(!ifInterval(_0x1c60fe[_0x6c57('0x1cf')],_0x1c60fe[_0x6c57('0x27')])){_0x1c60fe[_0x6c57('0x6d')]=0x0;_0x1c60fe[_0x6c57('0x27')]=moment()[_0x6c57('0x7b')](_0x6c57('0xfa'));loggerPredictive['info'](_0x1c60fe['name'],_0x6c57('0x1d3'),_0x1c60fe['startPredictive']);clearInterval(_0x1c60fe[_0x6c57('0x93')]);_0x1c60fe[_0x6c57('0x93')]=undefined;this[_0x6c57('0xbf')](_0x1c60fe[_0x6c57('0x1cf')])[_0x6c57('0xba')](this[_0x6c57('0x1d1')](_0x1c60fe))['then'](mergeDataErlangB(_0x1c60fe))[_0x6c57('0xba')](this[_0x6c57('0x1d2')](_0x1c60fe))[_0x6c57('0xb3')](loggerCatchPredictive(_0x6c57('0x1d4'),_0x1c60fe));}else if(_0x1c60fe[_0x6c57('0x71')]&&_0x2adf6d<_0x1c60fe['predictiveIntervalAvailable']-_0x2856a5){freeVariablesPredictive(_0x1c60fe);loggerPredictive[_0x6c57('0x81')](_0x1c60fe[_0x6c57('0x41')],_0x6c57('0x1d5'),_0x2adf6d,_0x6c57('0x1d6'),_0x1c60fe['predictiveIntervalAvailable'],'-',_0x2856a5,'=',_0x1c60fe['predictiveIntervalAvailable']-_0x2856a5,')');}else if(_0x1c60fe['predictiveIntervalAvailable']&&_0x2adf6d>_0x1c60fe[_0x6c57('0x71')]+_0x29d835){freeVariablesPredictive(_0x1c60fe);loggerPredictive[_0x6c57('0x81')](_0x1c60fe[_0x6c57('0x41')],_0x6c57('0x1d5'),_0x2adf6d,_0x6c57('0x1d7'),_0x1c60fe['predictiveIntervalAvailable'],'+',_0x29d835,'=',_0x1c60fe[_0x6c57('0x71')]+_0x29d835,')');}};Dialer[_0x6c57('0x19')][_0x6c57('0x1d1')]=function(_0x4ffb53){var _0x2456d3=this;return function(_0x1ef285){return new BPromise(function(_0x4b7b5d,_0x958b2e){_[_0x6c57('0x8f')](_0x4ffb53,_0x1ef285[0x0]);if(checkGetDataPredictive(_0x1ef285[0x0])){var _0x391455=_0x4ffb53[_0x6c57('0x71')]=_0x4ffb53[_0x6c57('0x55')]+_0x4ffb53[_0x6c57('0xa3')];var _0xac9353=_0x4ffb53[_0x6c57('0x1cf')]*0x3c;var _0x3eecbc=_0x1ef285[0x0][_0x6c57('0x69')]+_0x1ef285[0x0]['predictiveIntervalAvgHoldtime'];var _0x18cddf=(_0x1ef285[0x0][_0x6c57('0x67')]+_0x1ef285[0x0][_0x6c57('0x6b')]+_0x1ef285[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1ef285[0x0][_0x6c57('0x72')];_0x4ffb53[_0x6c57('0x6e')]=_0x18cddf>0x0?_0x18cddf:0x1;switch(_0x4ffb53[_0x6c57('0x1cd')]){case _0x6c57('0x1ca'):var _0x239b81=_0x4ffb53[_0x6c57('0x1c2')]/0x64;return _0x2456d3[_0x6c57('0x1d8')](_0x391455,_0xac9353,_0x3eecbc,_0x18cddf,_0x239b81)[_0x6c57('0xba')](function(_0x112abe){return _0x4b7b5d(_0x112abe);});case _0x6c57('0x1d9'):var _0x221a63=_0x4ffb53[_0x6c57('0x1c2')]/0x64;return _0x2456d3[_0x6c57('0x1da')](_0x391455,_0xac9353,_0x3eecbc,_0x18cddf,_0x221a63)['then'](function(_0x4babeb){return _0x4b7b5d(_0x4babeb);});default:return _0x958b2e(msgResponse(_0x6c57('0x1db'),_0x6c57('0x140'),_0x6c57('0x1dc')));}}else{return _0x958b2e(msgResponse(_0x6c57('0x1db'),'Failure',_0x6c57('0x1dd')));}});};};Dialer[_0x6c57('0x19')][_0x6c57('0x1de')]=function(_0x354119){var _0x3394ed=this;return function(_0xc93877){return new BPromise(function(_0x2bc629,_0x1d5593){_['merge'](_0x354119,_0xc93877[0x0]);if(checkGetDataPredictive(_0xc93877[0x0])){loggerPredictive[_0x6c57('0x81')](JSON['stringify'](_0xc93877[0x0]));if(_0x354119[_0x6c57('0x1cd')]===_0x6c57('0x1ca')){return _0x3394ed['getVoiceQueueRtPauses'](_0x354119['id'])['then'](function(_0x2258f0){var _0x231c39=_0x354119[_0x6c57('0x51')]-_0x2258f0[0x0][_0x6c57('0x1df')];var _0x2a57a4=_0x354119[_0x6c57('0x1cf')]*0x3c;var _0xcbbe0d=_0xc93877[0x0]['predictiveIntervalAvgTalktime']+_0xc93877[0x0][_0x6c57('0x68')];var _0x299300=(_0xc93877[0x0][_0x6c57('0x67')]+_0xc93877[0x0][_0x6c57('0x6b')]+_0xc93877[0x0][_0x6c57('0x6a')])/_0xc93877[0x0][_0x6c57('0x72')];var _0x3e08eb=_0x354119['dialPredictiveOptimizationPercentage']/0x64;_0x354119[_0x6c57('0x70')]=_0x2258f0[0x0][_0x6c57('0x1df')]||0x0;_0x354119[_0x6c57('0x6e')]=_0x299300>0x0?_0x299300:0x1;return _0x3394ed[_0x6c57('0x1d8')](_0x231c39,_0x2a57a4,_0xcbbe0d,_0x299300,_0x3e08eb);})[_0x6c57('0xba')](function(_0x1622f0){return _0x2bc629(_0x1622f0);})[_0x6c57('0xb3')](function(_0x2c15a7){return _0x1d5593(msgResponse('[CatchErlangB]','Failure',JSON[_0x6c57('0x4b')](_0x2c15a7)));});}if(_0x354119[_0x6c57('0x1cd')]===_0x6c57('0x1d9')){return _0x3394ed[_0x6c57('0xc5')](_0x354119['id'])['then'](function(_0x32baaa){var _0x2037ec=_0x354119[_0x6c57('0x51')]-_0x32baaa[0x0][_0x6c57('0x1df')];var _0x6ce49f=_0x354119[_0x6c57('0x1cf')]*0x3c;var _0x46f605=_0xc93877[0x0][_0x6c57('0x69')]+_0xc93877[0x0][_0x6c57('0x68')];var _0x4bf51c=(_0xc93877[0x0]['predictiveIntervalAnsweredCalls']+_0xc93877[0x0][_0x6c57('0x6b')]+_0xc93877[0x0][_0x6c57('0x6a')])/_0xc93877[0x0]['predictiveIntervalTotalCalls'];var _0x15ad23=_0x354119[_0x6c57('0x1c2')]/0x64;_0x354119['predictiveIntervalPauses']=_0x32baaa[0x0]['outboundQueuePauses']||0x0;_0x354119[_0x6c57('0x6e')]=_0x4bf51c>0x0?_0x4bf51c:0x1;return _0x3394ed[_0x6c57('0x1da')](_0x2037ec,_0x6ce49f,_0x46f605,_0x4bf51c,_0x15ad23);})[_0x6c57('0xba')](function(_0x568308){return _0x2bc629(_0x568308);})[_0x6c57('0xb3')](function(_0x4a61a3){return _0x1d5593(msgResponse(_0x6c57('0x1e0'),_0x6c57('0x140'),JSON['stringify'](_0x4a61a3)));});}}else{return _0x1d5593(msgResponse('[getDataPredictive]',_0x6c57('0x140'),'check\x20failure'));}});};};Dialer[_0x6c57('0x19')][_0x6c57('0x1d2')]=function(_0x1684bf){var _0xb0752b=this;return function(){var _0x2f9622=0x0;var _0x3ed094=Math[_0x6c57('0x1e1')](_0x1684bf[_0x6c57('0x8c')]*0x3e8);if(_0x3ed094>0x0){_0x3ed094=_0x3ed094<0x64?0x64:_0x3ed094;loggerPredictive[_0x6c57('0x81')](_0x1684bf['name'],'one\x20call\x20every:',_0x3ed094,_0x6c57('0x90'));_0x1684bf['handlePredictive']=setInterval(function(){_0xb0752b[_0x6c57('0x93')](_0x1684bf);loggerPredictiveCalls[_0x6c57('0x81')]('[handlePredictive]',_0x2f9622+=0x1);},_0x3ed094);}else{loggerPredictive['info'](_0x1684bf[_0x6c57('0x41')],_0x6c57('0x1e2'));}};};Dialer[_0x6c57('0x19')][_0x6c57('0x1e3')]=function(_0x445d9e,_0x1a610b){var _0x456ce4=this;return function(_0x895a51){if(_[_0x6c57('0x80')](_0x895a51)){if(_[_0x6c57('0xdd')](_0x1a610b['UserId'])||!_0x1a610b['recallme']){if(_0x445d9e[_0x6c57('0x5b')]===_0x6c57('0x8')){_0x445d9e[_0x6c57('0x128')]=_[_0x6c57('0x3e')](_0x445d9e[_0x6c57('0x128')])?!![]:_0x445d9e[_0x6c57('0x128')];var _0x1e51a3=uuid['v4']();_0x456ce4['actions'][_0x1e51a3]=new Action(_0x445d9e,_0x1a610b,_0x1e51a3);loggerBooked[_0x6c57('0x81')](_0x6c57('0x1e4'),_0x1e51a3,_0x6c57('0x1e5'),JSON[_0x6c57('0x4b')](_0x445d9e[_0x6c57('0x128')]),_0x6c57('0x1e6'),_0x445d9e[_0x6c57('0x41')]);if(_0x445d9e['queueStatusComplete']){_0x445d9e[_0x6c57('0x128')]=![];_0x456ce4[_0x6c57('0x29')][_0x456ce4[_0x6c57('0xae')][_0x1e51a3][_0x6c57('0xb6')]]=[];ami['Action']({'actionid':_0x1e51a3,'action':'queuestatus','queue':_0x445d9e['name']})[_0x6c57('0xb3')](function(){_0x456ce4[_0x6c57('0xb5')](_0x445d9e);_0x456ce4['rescheduleContact']({'active':![],'ContactId':_0x456ce4[_0x6c57('0xae')][_0x1e51a3][_0x6c57('0xd0')],'ListId':_0x456ce4[_0x6c57('0xae')][_0x1e51a3][_0x6c57('0xd1')],'VoiceQueueId':_0x456ce4[_0x6c57('0xae')][_0x1e51a3][_0x6c57('0xfb')]||undefined,'CampaignId':_0x456ce4[_0x6c57('0xae')][_0x1e51a3][_0x6c57('0xd3')]||undefined})[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x1e7')));delete _0x456ce4[_0x6c57('0xae')][_0x1e51a3];});}else{loggerBooked[_0x6c57('0x81')](_0x6c57('0x1e8'),JSON[_0x6c57('0x4b')](_0x445d9e['queueStatusComplete']),_0x6c57('0x1e6'),_0x445d9e[_0x6c57('0x41')]);_0x456ce4['updateOriginated'](_0x445d9e);_0x456ce4['rescheduleContact']({'active':![],'ContactId':_0x456ce4[_0x6c57('0xae')][_0x1e51a3]['ContactId'],'ListId':_0x456ce4['actions'][_0x1e51a3][_0x6c57('0xd1')],'VoiceQueueId':_0x456ce4[_0x6c57('0xae')][_0x1e51a3][_0x6c57('0xfb')]||undefined,'CampaignId':_0x456ce4[_0x6c57('0xae')][_0x1e51a3]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x456ce4[_0x6c57('0xae')][_0x1e51a3];}}else{return _0x456ce4['actionOriginate'](_0x445d9e,_0x1a610b);}}else{if(getDiff(_0x1a610b[_0x6c57('0x1e9')])<_0x445d9e['dialRecallMeTimeout']*0x3c){if(_0x1a610b[_0x6c57('0x1ea')]&&!_0x1a610b[_0x6c57('0x1ea')][_0x6c57('0x1eb')]){_0x456ce4[_0x6c57('0x1e')][_0x6c57('0x12c')](_0x1a610b['id'])[_0x6c57('0x1c')](function(){_0x456ce4['updateOriginated'](_0x445d9e);});}else{_0x456ce4[_0x6c57('0xc2')]({'active':![]},_0x1a610b['id'],0x1)[_0x6c57('0x1c')](function(){_0x456ce4[_0x6c57('0xb5')](_0x445d9e);});}}else{_0x445d9e[_0x6c57('0x1ec')]+=0x1;_0x456ce4[_0x6c57('0xb5')](_0x445d9e);if(_0x445d9e[_0x6c57('0x1ed')]){_0x456ce4['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1a610b[_0x6c57('0xd0')],'ListId':_0x1a610b['ListId'],'VoiceQueueId':_0x1a610b[_0x6c57('0xfb')]||undefined,'CampaignId':_0x1a610b[_0x6c57('0xd3')]||undefined})[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x1ee')));_0x456ce4[_0x6c57('0xc8')](createObjHistory(_0x445d9e,_0x1a610b,'RECALLINQUEUE',0x17,_0x6c57('0x1ef')))[_0x6c57('0xb3')](loggerCatch(_0x6c57('0x1f0')));}else{_0x456ce4['saveInDb'](createObjHistory(_0x445d9e,_0x1a610b,_0x6c57('0x1f1'),0x16,_0x6c57('0x1f2')),_0x6c57('0x1f3'),_0x6c57('0x1f4'));}}}}else{_0x445d9e[_0x6c57('0x1f5')]+=0x1;_0x456ce4['saveInDb'](createObjHistory(_0x445d9e,_0x1a610b,'BLACKLIST',0xd,_0x6c57('0x1f6')),_0x6c57('0x1f7'),_0x6c57('0x1f8'));throw _0x6c57('0x1f9');}};};Dialer['prototype'][_0x6c57('0x157')]=function(_0x5eaf60){var _0x35f7bb=this;var _0x13a442=_0x5eaf60[_0x6c57('0x1fa')]-_0x5eaf60[_0x6c57('0x73')]-_0x5eaf60[_0x6c57('0xc4')];emitCampaignSummary(_0x5eaf60);if(_0x13a442>0x0){if(_0x13a442>this[_0x6c57('0x1fb')]){_0x13a442=this[_0x6c57('0x1fb')];}_0x5eaf60[_0x6c57('0xc4')]+=_0x13a442;this[_0x6c57('0x1fc')](_0x5eaf60['id'],_0x13a442,_0x5eaf60[_0x6c57('0x1fd')],_0x5eaf60)['then'](function(_0x228b9f){_0x5eaf60[_0x6c57('0xc4')]-=_0x13a442;_0x5eaf60[_0x6c57('0xc4')]=_0x5eaf60[_0x6c57('0xc4')]>0x0?_0x5eaf60[_0x6c57('0xc4')]:0x0;if(!checkContactEmpty(_0x228b9f)){_0x5eaf60[_0x6c57('0x3f')]=_0x6c57('0xa0');logger[_0x6c57('0x81')](_0x6c57('0x1fe')+_0x5eaf60[_0x6c57('0x41')]);}else{_0x5eaf60[_0x6c57('0x73')]+=_0x228b9f[_0x6c57('0x9a')];_0x5eaf60['message']='RUNNING';for(var _0x470974=0x0;_0x470974<_0x228b9f[_0x6c57('0x9a')];_0x470974+=0x1){_0x5eaf60[_0x6c57('0x1ff')]+=0x1;if(_[_0x6c57('0xdd')](_0x228b9f[_0x470974])||_[_0x6c57('0xdd')](_0x228b9f[_0x470974][_0x6c57('0x162')])||_[_0x6c57('0xdd')](_0x228b9f[_0x470974][_0x6c57('0x162')]['phone'])){_0x35f7bb['emptyContact']('[actionOriginate]\x20',_0x5eaf60,_0x228b9f[_0x470974]);}else{_0x35f7bb[_0x6c57('0xbd')](_[_0x6c57('0xcf')](_0x228b9f[_0x470974],[_0x6c57('0xd3'),_0x6c57('0x200')]))[_0x6c57('0xba')](_0x35f7bb['checkContactBlack'](_0x5eaf60,_0x228b9f[_0x470974]))['catch'](_0x35f7bb[_0x6c57('0x201')](_0x6c57('0x202'),_0x5eaf60));}}}})[_0x6c57('0xb3')](loggerGetContactDialer(_0x6c57('0x203'),_0x5eaf60,_0x13a442));}};Dialer[_0x6c57('0x19')][_0x6c57('0x152')]=function(_0x2058ed,_0x7c7268){var _0xddd0ec=this;var _0x43b791=[];var _0x4ddd83=_0x7c7268>=0x1?_0x7c7268:0x1;if(_0x2058ed['dialMethod']===_0x6c57('0x8')){_0x4ddd83=0x1;}var _0x146d4a=Math['floor'](_0x2058ed['available']*_0x4ddd83)-_0x2058ed[_0x6c57('0x73')]-_0x2058ed['temp'];emitVoiceQueueSummary(_0x2058ed);if(_0x2058ed[_0x6c57('0x204')]>0x0){var _0x5e6778=_0x2058ed[_0x6c57('0x204')]-_0x2058ed[_0x6c57('0x73')]-_0x2058ed[_0x6c57('0x55')]-_0x2058ed[_0x6c57('0xc4')]-_0x2058ed['pTalking'];if(_0x146d4a>_0x5e6778){_0x146d4a=_0x5e6778;}}if(_0x146d4a>0x0){if(_0x2058ed[_0x6c57('0x5b')]===_0x6c57('0x8')){_0x146d4a=0x1;}if(_0x146d4a>this[_0x6c57('0x1fb')]){_0x146d4a=this[_0x6c57('0x1fb')];}_0x2058ed[_0x6c57('0xc4')]+=_0x146d4a;for(var _0x48e678 in this['agents']){if(typeof this[_0x6c57('0x21')][_0x48e678]!==_0x6c57('0x9b')){if(this['agents'][_0x48e678][_0x6c57('0xa9')]===_0x6c57('0x205')&&this[_0x6c57('0x21')][_0x48e678][_0x6c57('0xb1')]===_0x6c57('0xd9')){_0x43b791['push'](this[_0x6c57('0x21')][_0x48e678]['id']);}}}this[_0x6c57('0xc3')](_0x2058ed['id'],_0x43b791,_0x146d4a,_0x2058ed[_0x6c57('0x1fd')],_0x2058ed)[_0x6c57('0xba')](function(_0x260140){_0x2058ed[_0x6c57('0xc4')]-=_0x146d4a;_0x2058ed['temp']=_0x2058ed[_0x6c57('0xc4')]>0x0?_0x2058ed[_0x6c57('0xc4')]:0x0;if(!checkContactEmpty(_0x260140)){_0xddd0ec[_0x6c57('0xb9')](_0x2058ed)[_0x6c57('0xba')](sendMessageReschedule(_0x2058ed))[_0x6c57('0xb3')](loggerCatch(_0x6c57('0xbb')));}else{_0x2058ed[_0x6c57('0x73')]+=_0x260140[_0x6c57('0x9a')];_0x2058ed['message']=_0x2058ed[_0x6c57('0x5b')]===_0x6c57('0x8')?_0x6c57('0x206'):_0x6c57('0x207');for(var _0x30b813=0x0;_0x30b813<_0x260140[_0x6c57('0x9a')];_0x30b813+=0x1){if(_[_0x6c57('0xdd')](_0x260140[_0x30b813])||_[_0x6c57('0xdd')](_0x260140[_0x30b813][_0x6c57('0x162')])||_['isNil'](_0x260140[_0x30b813]['Contact'][_0x6c57('0x163')])){_0xddd0ec[_0x6c57('0xcc')](_0x6c57('0x208'),_0x2058ed,_0x260140[_0x30b813]);}else{_0xddd0ec[_0x6c57('0x209')](_['pick'](_0x260140[_0x30b813],['VoiceQueueId',_0x6c57('0x200')]))[_0x6c57('0xba')](_0xddd0ec[_0x6c57('0x1e3')](_0x2058ed,_0x260140[_0x30b813]))[_0x6c57('0xb3')](_0xddd0ec[_0x6c57('0x201')](_0x6c57('0x208'),_0x2058ed));}}}})[_0x6c57('0xb3')](loggerGetContactDialer(_0x6c57('0x20a'),_0x2058ed,_0x146d4a));}};Dialer['prototype']['handlePredictive']=function(_0x279d37){if(_0x279d37[_0x6c57('0x204')]>0x0){var _0x2ccb33=_0x279d37[_0x6c57('0x204')]-_0x279d37[_0x6c57('0x73')]-_0x279d37[_0x6c57('0x55')];if(_0x2ccb33>0x0){this[_0x6c57('0x20b')](_0x279d37);}else{loggerPredictiveCalls[_0x6c57('0x81')](_0x6c57('0x20c'));}}else{this[_0x6c57('0x20b')](_0x279d37);}};Dialer[_0x6c57('0x19')][_0x6c57('0x20b')]=function(_0x525a15){var _0x19fb5b=this;var _0x1436d0=[];_0x525a15[_0x6c57('0x73')]+=0x1;for(var _0x2eae0c in this[_0x6c57('0x21')]){if(typeof this[_0x6c57('0x21')][_0x2eae0c]!=='undefined'){if(this['agents'][_0x2eae0c][_0x6c57('0xa9')]===_0x6c57('0x205')&&this[_0x6c57('0x21')][_0x2eae0c]['status']===_0x6c57('0xd9')){_0x1436d0['push'](this['agents'][_0x2eae0c]['id']);}}}this[_0x6c57('0xc3')](_0x525a15['id'],_0x1436d0,0x1,_0x525a15['dialOrderByScheduledAt'],_0x525a15)['then'](function(_0x231a54){if(!checkContactEmpty(_0x231a54)){checkContactLowerLimitOriginate(_0x525a15,0x1,0x0);_0x19fb5b[_0x6c57('0xb9')](_0x525a15)[_0x6c57('0xba')](sendMessageReschedule(_0x525a15))['catch'](loggerCatch(_0x6c57('0xbb')));}else{_0x525a15[_0x6c57('0x3f')]=_0x6c57('0x207');if(_['isNil'](_0x231a54[0x0])||_[_0x6c57('0xdd')](_0x231a54[0x0][_0x6c57('0x162')])||_[_0x6c57('0xdd')](_0x231a54[0x0]['Contact'][_0x6c57('0x163')])){_0x19fb5b[_0x6c57('0xcc')](_0x6c57('0x208'),_0x525a15,_0x231a54[0x0]);}else{_0x19fb5b[_0x6c57('0x209')](_[_0x6c57('0xcf')](_0x231a54[0x0],[_0x6c57('0xfb'),'Contact.phone']))[_0x6c57('0xba')](_0x19fb5b[_0x6c57('0x1e3')](_0x525a15,_0x231a54[0x0]))[_0x6c57('0xb3')](_0x19fb5b['loggerHandler'](_0x6c57('0x20d'),_0x525a15));}}})[_0x6c57('0xb3')](loggerGetContactDialer('[getContactDialerPredictive]',_0x525a15,0x1));emitVoiceQueueSummary(_0x525a15);};Dialer[_0x6c57('0x19')][_0x6c57('0x1d8')]=function(_0x528991,_0x5ef395,_0x5c3853,_0x289df3,_0x22a62c,_0x2c0f58){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x6c57('0x81')](_0x6c57('0x20e'),_0x528991);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x20f'),_0x5ef395);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x210'),_0x5c3853);loggerPredictive['info'](_0x6c57('0x211'),_0x289df3);loggerPredictive[_0x6c57('0x81')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22a62c);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x87'));return new BPromise(function(_0x1fbb61,_0x573aab){if(_0x528991<=0x0||isNaN(_0x528991)){return _0x573aab(msgResponse(_0x6c57('0x212'),'Error',_0x6c57('0x213')+_0x528991));}if(_0x5c3853<=0x0||isNaN(_0x5c3853)){return _0x573aab(msgResponse('[abandonmentRate]',_0x6c57('0x4a'),_0x6c57('0x214')+_0x5c3853));}if(_0x289df3<=0x0||isNaN(_0x289df3)){return _0x573aab(msgResponse(_0x6c57('0x212'),_0x6c57('0x4a'),_0x6c57('0x215')+_0x289df3));}if(_0x5ef395<=0x0||isNaN(_0x5ef395)){return _0x573aab(msgResponse('[abandonmentRate]',_0x6c57('0x4a'),_0x6c57('0x216')+_0x5ef395));}if(_0x22a62c<=0x0||isNaN(_0x22a62c)){return _0x573aab(msgResponse('[abandonmentRate]','Error',_0x6c57('0x217')+_0x22a62c));}_0x2c0f58=_0x2c0f58||0x0;var _0x46ecf0=0x1/_0x5c3853;var _0x3c305f=0x0;var _0x1bced0=0x0;var _0x5e8d2d=0x0;var _0x4e58ee=0x0;for(var _0x20fbea=0x0;_0x5e8d2d<_0x22a62c;_0x20fbea+=0x1){_0x1bced0=_0x20fbea/_0x5ef395;_0x3c305f=(_0x289df3*_0x1bced0+_0x2c0f58)/_0x46ecf0;_0x5e8d2d=erlangb(_0x3c305f,_0x528991);_0x4e58ee=_0x3c305f/_0x528991*(0x1-erlangb(_0x3c305f,_0x528991));}return _0x1fbb61({'erlangCalls':_0x20fbea,'erlangCallToSecond':_0x5ef395/_0x20fbea,'erlangAbandonmentRate':_0x5e8d2d,'erlangBusyFactor':_0x4e58ee});});};Dialer[_0x6c57('0x19')][_0x6c57('0x1da')]=function(_0x1fd8ab,_0x50687f,_0x207756,_0x590115,_0x5f12c5,_0x300b3b){loggerPredictive[_0x6c57('0x81')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x6c57('0x81')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1fd8ab);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x20f'),_0x50687f);loggerPredictive['info'](_0x6c57('0x210'),_0x207756);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x211'),_0x590115);loggerPredictive[_0x6c57('0x81')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5f12c5);loggerPredictive[_0x6c57('0x81')](_0x6c57('0x87'));return new BPromise(function(_0x3724ca,_0x141b3f){if(_0x1fd8ab<=0x0||isNaN(_0x1fd8ab)){return _0x141b3f(msgResponse(_0x6c57('0x218'),'Error',_0x6c57('0x213')+_0x1fd8ab));}if(_0x207756<=0x0||isNaN(_0x207756)){return _0x141b3f(msgResponse(_0x6c57('0x218'),'Error',_0x6c57('0x214')+_0x207756));}if(_0x590115<=0x0||isNaN(_0x590115)){return _0x141b3f(msgResponse(_0x6c57('0x218'),_0x6c57('0x4a'),'p\x20=\x20'+_0x590115));}if(_0x50687f<=0x0||isNaN(_0x50687f)){return _0x141b3f(msgResponse(_0x6c57('0x218'),_0x6c57('0x4a'),'interval\x20=\x20'+_0x50687f));}if(_0x5f12c5<=0x0||isNaN(_0x5f12c5)){return _0x141b3f(msgResponse(_0x6c57('0x218'),_0x6c57('0x4a'),'Umin\x20=\x20'+_0x5f12c5));}_0x300b3b=_0x300b3b||0x0;var _0x4186d3=0x1/_0x207756;var _0x4e5790=0x0;var _0xb70d1a=0x0;var _0x3e4a21=0x0;var _0x5627a0=0x0;for(var _0x1a85e8=0x0;_0x5627a0<_0x5f12c5;_0x1a85e8+=0x1){_0xb70d1a=_0x1a85e8/_0x50687f;_0x4e5790=(_0x590115*_0xb70d1a+_0x300b3b)/_0x4186d3;_0x3e4a21=erlangb(_0x4e5790,_0x1fd8ab);_0x5627a0=_0x4e5790/_0x1fd8ab*(0x1-erlangb(_0x4e5790,_0x1fd8ab));}return _0x3724ca({'erlangCalls':_0x1a85e8,'erlangCallToSecond':_0x50687f/_0x1a85e8,'erlangAbandonmentRate':_0x3e4a21,'erlangBusyFactor':_0x5627a0});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 97fffb4..0ecf0bc 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 _0x401d=['seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x401d,0x1c9));var _0xd401=function(_0x5963aa,_0x20fee4){_0x5963aa=_0x5963aa-0x0;var _0x1b7060=_0x401d[_0x5963aa];return _0x1b7060;};'use strict';var util=require(_0xd401('0x0'));var _=require(_0xd401('0x1'));var moment=require(_0xd401('0x2'));function getSeconds(_0x38068e,_0xe30d54){var _0x57cd4e=moment(_0x38068e)[_0xd401('0x3')](0x0);var _0x1c82cc=moment(_0xe30d54)[_0xd401('0x3')](0x0);return _0x57cd4e[_0xd401('0x4')](_0x1c82cc,_0xd401('0x5'));}function QueueCallerAbandon(_0x106850,_0x4b70f5){this[_0xd401('0x6')]=_0x106850[_0xd401('0x6')];this['type']=_0x106850[_0xd401('0x7')];this[_0xd401('0x8')]=_0x106850['type']==='outbound'?_0xd401('0x9'):_0x106850[_0xd401('0x7')];this['countbusyretry']=_0x106850[_0xd401('0xa')];this[_0xd401('0xb')]=_0x106850[_0xd401('0xb')];this[_0xd401('0xc')]=_0x106850[_0xd401('0xc')];this[_0xd401('0xd')]=_0x106850[_0xd401('0xa')]+_0x106850[_0xd401('0xb')]+_0x106850[_0xd401('0xc')]+_0x106850['countnosuchnumberretry']+_0x106850['countdropretry']+_0x106850[_0xd401('0xe')]+_0x106850['countmachineretry']+_0x106850[_0xd401('0xf')];this['countnosuchnumberretry']=_0x106850[_0xd401('0x10')];this['countdropretry']=_0x106850[_0xd401('0x11')];this[_0xd401('0xe')]=_0x106850['countabandonedretry'];this['countmachineretry']=_0x106850[_0xd401('0x12')];this[_0xd401('0xf')]=_0x106850[_0xd401('0xf')];this[_0xd401('0x13')]=_0x4b70f5[_0xd401('0x13')];this[_0xd401('0x14')]=_0x106850[_0xd401('0x15')];this['calleridnum']=_0x106850[_0xd401('0x16')];this[_0xd401('0x17')]=_0x106850[_0xd401('0x17')];this[_0xd401('0x18')]=_0x106850[_0xd401('0x18')];this['droptime']=_0x106850[_0xd401('0x19')];this[_0xd401('0x1a')]=this[_0xd401('0x19')];this[_0xd401('0x1b')]=getSeconds(_0x106850[_0xd401('0x18')],_0x106850[_0xd401('0x17')]);this[_0xd401('0x1c')]=getSeconds(this[_0xd401('0x19')],_0x106850['responsetime']);this['talktime']=0x0;this[_0xd401('0x9')]=_0x4b70f5[_0xd401('0x9')];this[_0xd401('0x1d')]=_0x4b70f5[_0xd401('0x1e')];this[_0xd401('0x1f')]=_0x4b70f5[_0xd401('0x1f')];this[_0xd401('0x20')]=_0x106850[_0xd401('0x20')];this['callbackuniqueid']=_0x106850[_0xd401('0x21')];this[_0xd401('0x22')]=_0x106850[_0xd401('0x22')];this[_0xd401('0x23')]=_0x106850[_0xd401('0x23')];this[_0xd401('0x24')]=_0x106850[_0xd401('0x24')];this[_0xd401('0x25')]=_0x106850[_0xd401('0x25')];this['UserId']=_0x106850['UserId'];this['VoiceQueueId']=_0x106850['VoiceQueueId'];this[_0xd401('0x26')]=_0x106850[_0xd401('0x26')];this[_0xd401('0x27')]=_0x106850[_0xd401('0x27')]||'';this['originatecalleridname']=_0x106850[_0xd401('0x28')]||'';}module[_0xd401('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x3dc3=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x4ed7f9,_0x30604e){var _0x486cf6=function(_0x2a3e6a){while(--_0x2a3e6a){_0x4ed7f9['push'](_0x4ed7f9['shift']());}};_0x486cf6(++_0x30604e);}(_0x3dc3,0xea));var _0x33dc=function(_0x14b658,_0x3e3f45){_0x14b658=_0x14b658-0x0;var _0x4961fc=_0x3dc3[_0x14b658];return _0x4961fc;};'use strict';var util=require(_0x33dc('0x0'));var _=require('lodash');var moment=require(_0x33dc('0x1'));function getSeconds(_0x2985ee,_0x396b5a){var _0x884ccd=moment(_0x2985ee)[_0x33dc('0x2')](0x0);var _0x22f70c=moment(_0x396b5a)[_0x33dc('0x2')](0x0);return _0x884ccd[_0x33dc('0x3')](_0x22f70c,'seconds');}function QueueCallerAbandon(_0x512d90,_0x1a6d76){this[_0x33dc('0x4')]=_0x512d90[_0x33dc('0x4')];this[_0x33dc('0x5')]=_0x512d90[_0x33dc('0x5')];this[_0x33dc('0x6')]=_0x512d90[_0x33dc('0x5')]==='outbound'?_0x33dc('0x7'):_0x512d90[_0x33dc('0x5')];this[_0x33dc('0x8')]=_0x512d90['countbusyretry'];this[_0x33dc('0x9')]=_0x512d90[_0x33dc('0x9')];this[_0x33dc('0xa')]=_0x512d90['countnoanswerretry'];this[_0x33dc('0xb')]=_0x512d90[_0x33dc('0x8')]+_0x512d90['countcongestionretry']+_0x512d90['countnoanswerretry']+_0x512d90['countnosuchnumberretry']+_0x512d90[_0x33dc('0xc')]+_0x512d90[_0x33dc('0xd')]+_0x512d90[_0x33dc('0xe')]+_0x512d90[_0x33dc('0xf')];this[_0x33dc('0x10')]=_0x512d90['countnosuchnumberretry'];this[_0x33dc('0xc')]=_0x512d90['countdropretry'];this['countabandonedretry']=_0x512d90[_0x33dc('0xd')];this[_0x33dc('0xe')]=_0x512d90[_0x33dc('0xe')];this[_0x33dc('0xf')]=_0x512d90[_0x33dc('0xf')];this[_0x33dc('0x11')]=_0x1a6d76[_0x33dc('0x11')];this['calleridname']=_0x512d90['name'];this[_0x33dc('0x12')]=_0x512d90[_0x33dc('0x13')];this[_0x33dc('0x14')]=_0x512d90[_0x33dc('0x14')];this[_0x33dc('0x15')]=_0x512d90[_0x33dc('0x15')];this[_0x33dc('0x16')]=_0x512d90[_0x33dc('0x16')];this[_0x33dc('0x17')]=this[_0x33dc('0x16')];this[_0x33dc('0x18')]=getSeconds(_0x512d90[_0x33dc('0x15')],_0x512d90[_0x33dc('0x14')]);this[_0x33dc('0x19')]=getSeconds(this[_0x33dc('0x16')],_0x512d90[_0x33dc('0x15')]);this['talktime']=0x0;this['queue']=_0x1a6d76[_0x33dc('0x7')];this[_0x33dc('0x1a')]=_0x1a6d76[_0x33dc('0x1b')];this[_0x33dc('0x1c')]=_0x1a6d76[_0x33dc('0x1c')];this[_0x33dc('0x1d')]=_0x512d90[_0x33dc('0x1d')];this[_0x33dc('0x1e')]=_0x512d90[_0x33dc('0x1e')];this[_0x33dc('0x1f')]=_0x512d90[_0x33dc('0x1f')];this[_0x33dc('0x20')]=_0x512d90[_0x33dc('0x20')];this[_0x33dc('0x21')]=_0x512d90[_0x33dc('0x21')];this['ListId']=_0x512d90[_0x33dc('0x22')];this[_0x33dc('0x23')]=_0x512d90[_0x33dc('0x23')];this[_0x33dc('0x24')]=_0x512d90['VoiceQueueId'];this[_0x33dc('0x25')]=_0x512d90[_0x33dc('0x25')];this[_0x33dc('0x26')]=_0x512d90[_0x33dc('0x26')]||'';this[_0x33dc('0x27')]=_0x512d90['originatecalleridname']||'';}module[_0x33dc('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8a4bede..218675d 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(_0x1aec96,_0x297d87){var _0x425815=function(_0x1d6c72){while(--_0x1d6c72){_0x1aec96['push'](_0x1aec96['shift']());}};_0x425815(++_0x297d87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0xaa2e14,_0x5e2b31){var _0x4ad550=function(_0x456199){while(--_0x456199){_0xaa2e14['push'](_0xaa2e14['shift']());}};_0x4ad550(++_0x5e2b31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 cbbfe75..d783d38 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 _0x11aa=['../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','bind','syncVarSet','syncNewState','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','hasOwnProperty','exten','localstationid','uniqueid','name','info','actions','channel','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','then','notify','calleridnum','fax','.pdf','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[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:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x11aa,0xe6));var _0xa11a=function(_0x41dd15,_0x30a3ba){_0x41dd15=_0x41dd15-0x0;var _0x524e51=_0x11aa[_0x41dd15];return _0x524e51;};'use strict';var util=require(_0xa11a('0x0'));var _=require(_0xa11a('0x1'));var BPromise=require(_0xa11a('0x2'));var uuid=require(_0xa11a('0x3'));var moment=require(_0xa11a('0x4'));var path=require(_0xa11a('0x5'));var tiff2pdf=require(_0xa11a('0x6'));var gs=require(_0xa11a('0x7'));var logger=require(_0xa11a('0x8'))('fax');var ami=require(_0xa11a('0x9'));var rpcDb=require(_0xa11a('0xa'));var Channel=require(_0xa11a('0xb'));var ut=require(_0xa11a('0xc'));var Action=require(_0xa11a('0xd'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xa11a('0xe'));var faxMessage=require(_0xa11a('0xf'));function Fax(_0x2a378c){this[_0xa11a('0x10')]={};this['faxAccounts']=_0x2a378c[_0xa11a('0x11')];this[_0xa11a('0x12')]=_0x2a378c['trunks'];this['actions']={};ami['on']('newchannel',this['syncNewchannel'][_0xa11a('0x13')](this));ami['on']('varset',this[_0xa11a('0x14')]['bind'](this));ami['on']('newstate',this[_0xa11a('0x15')]['bind'](this));ami['on']('newexten',this[_0xa11a('0x16')][_0xa11a('0x13')](this));ami['on'](_0xa11a('0x17'),this['syncFaxStatus'][_0xa11a('0x13')](this));ami['on'](_0xa11a('0x18'),this[_0xa11a('0x19')][_0xa11a('0x13')](this));ami['on'](_0xa11a('0x1a'),this[_0xa11a('0x1b')][_0xa11a('0x13')](this));ami['on'](_0xa11a('0x1c'),this[_0xa11a('0x1d')][_0xa11a('0x13')](this));}Fax[_0xa11a('0x1e')][_0xa11a('0x1f')]=function(_0x2e5331){if(_0x2e5331[_0xa11a('0x20')]==='from-voip-provider'){for(var _0x9ba501 in this['faxAccounts']){if(this['faxAccounts'][_0xa11a('0x21')](_0x9ba501)){if(_0x2e5331[_0xa11a('0x22')]===this[_0xa11a('0x11')][_0x9ba501][_0xa11a('0x23')]){this[_0xa11a('0x10')][_0x2e5331['uniqueid']]={};this[_0xa11a('0x10')][_0x2e5331[_0xa11a('0x24')]]['channel']=_0x2e5331['channel'];this['channels'][_0x2e5331['uniqueid']]['id']=this[_0xa11a('0x11')][_0x9ba501]['id'];this['channels'][_0x2e5331[_0xa11a('0x24')]][_0xa11a('0x25')]=this[_0xa11a('0x11')][_0x9ba501][_0xa11a('0x25')];logger[_0xa11a('0x26')](_0x2e5331[_0xa11a('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0xa11a('0x27')][_0x2e5331[_0xa11a('0x24')]]){this[_0xa11a('0x10')][_0x2e5331[_0xa11a('0x24')]]={};this[_0xa11a('0x10')][_0x2e5331[_0xa11a('0x24')]][_0xa11a('0x28')]=_0x2e5331[_0xa11a('0x28')];logger[_0xa11a('0x26')](_0x2e5331['uniqueid'],_0xa11a('0x29'));}};Fax[_0xa11a('0x1e')][_0xa11a('0x14')]=function(_0x3bd8bf){if(this[_0xa11a('0x10')][_0x3bd8bf[_0xa11a('0x24')]]){for(var _0x2487fe in _0x3bd8bf[_0xa11a('0x2a')]){if(_0x3bd8bf[_0xa11a('0x2a')][_0xa11a('0x21')](_0x2487fe)){this['channels'][_0x3bd8bf[_0xa11a('0x24')]][_0x2487fe]=_0x3bd8bf['value'];}}}};Fax['prototype'][_0xa11a('0x15')]=function(_0x43be3f){if(this['channels'][_0x43be3f['uniqueid']]){this[_0xa11a('0x10')][_0x43be3f['uniqueid']][_0xa11a('0x2b')]=_0x43be3f[_0xa11a('0x2b')];this[_0xa11a('0x10')][_0x43be3f[_0xa11a('0x24')]][_0xa11a('0x2c')]=_0x43be3f[_0xa11a('0x2c')];}};Fax[_0xa11a('0x1e')][_0xa11a('0x16')]=function(_0xa91149){if(this['channels'][_0xa91149[_0xa11a('0x24')]]){for(var _0x53f51a in _0xa91149[_0xa11a('0x2a')]){if(_0xa91149[_0xa11a('0x2a')]['hasOwnProperty'](_0x53f51a)){this['channels'][_0xa91149[_0xa11a('0x24')]][_0x53f51a]=_0xa91149[_0xa11a('0x2d')];}}}};Fax[_0xa11a('0x1e')][_0xa11a('0x2e')]=function(_0x4ff528){if(this[_0xa11a('0x10')][_0x4ff528[_0xa11a('0x24')]]){this[_0xa11a('0x10')][_0x4ff528['uniqueid']][_0xa11a('0x2f')]=_0x4ff528['operation'];this['channels'][_0x4ff528[_0xa11a('0x24')]][_0xa11a('0x30')]=_0x4ff528['status'];this['channels'][_0x4ff528[_0xa11a('0x24')]][_0xa11a('0x23')]=_0x4ff528['localstationid'];this['channels'][_0x4ff528[_0xa11a('0x24')]][_0xa11a('0x31')]=_0x4ff528[_0xa11a('0x31')];logger[_0xa11a('0x26')](_0x4ff528[_0xa11a('0x24')],_0xa11a('0x32'));}};Fax[_0xa11a('0x1e')][_0xa11a('0x19')]=function(_0x31130d){var _0x300877=this;if(this[_0xa11a('0x10')][_0x31130d[_0xa11a('0x24')]]){var _0x16feda=this[_0xa11a('0x10')][_0x31130d[_0xa11a('0x24')]]['id'];this[_0xa11a('0x10')][_0x31130d[_0xa11a('0x24')]][_0xa11a('0x33')]=_0x31130d['remotestationid'];this[_0xa11a('0x10')][_0x31130d[_0xa11a('0x24')]][_0xa11a('0x34')]=_0x31130d['pagestransferred'];this[_0xa11a('0x10')][_0x31130d[_0xa11a('0x24')]][_0xa11a('0x23')]=_0x31130d[_0xa11a('0x23')];this[_0xa11a('0x10')][_0x31130d['uniqueid']][_0xa11a('0x35')]=_0x31130d['resolution'];this[_0xa11a('0x10')][_0x31130d['uniqueid']][_0xa11a('0x36')]=_0x31130d[_0xa11a('0x36')];this[_0xa11a('0x10')][_0x31130d['uniqueid']]['filename']=_0x31130d['filename'];this[_0xa11a('0x10')][_0x31130d[_0xa11a('0x24')]]['calleridnum']=_0x31130d['calleridnum'];if(this[_0xa11a('0x10')][_0x31130d[_0xa11a('0x24')]][_0xa11a('0x34')]>0x0){tiff2pdf(_0x31130d[_0xa11a('0x31')],_0xa11a('0x37'),function(_0x269822){logger[_0xa11a('0x26')](_0x31130d[_0xa11a('0x24')],_0xa11a('0x38'),_0x269822[_0xa11a('0x39')]);attachment[_0xa11a('0x3a')]({'name':path[_0xa11a('0x3b')](_0x31130d['filename'])[_0xa11a('0x25')],'basename':path[_0xa11a('0x3b')](_0x31130d[_0xa11a('0x31')])['name']+'.pdf','type':'application/pdf'})[_0xa11a('0x3c')](function(_0x4aba5d){faxAccount[_0xa11a('0x3d')](_0x16feda,{'from':_0x31130d[_0xa11a('0x3e')],'mapKey':_0xa11a('0x3f'),'body':path[_0xa11a('0x3b')](_0x31130d[_0xa11a('0x31')])[_0xa11a('0x25')]+_0xa11a('0x40'),'AttachmentId':_0x4aba5d['id']})['catch'](function(_0x31f350){logger['error'](_0x31130d[_0xa11a('0x24')],_0xa11a('0x41'),JSON[_0xa11a('0x42')](_0x31f350));});})[_0xa11a('0x43')](function(_0xc73579){logger['error'](_0x31130d[_0xa11a('0x24')],_0xa11a('0x44'),JSON[_0xa11a('0x42')](_0xc73579));});});}logger[_0xa11a('0x26')](_0x31130d[_0xa11a('0x24')],'\x20receiveFax\x20');}};Fax['prototype'][_0xa11a('0x1d')]=function(_0x57330b){if(this[_0xa11a('0x27')][_0x57330b[_0xa11a('0x24')]]){_[_0xa11a('0x45')](this[_0xa11a('0x10')][_0x57330b[_0xa11a('0x24')]],_[_0xa11a('0x46')](_0x57330b,[_0xa11a('0x47'),_0xa11a('0x48')]));}};function updateStatus(_0x595d1c){if(_0x595d1c[_0xa11a('0x49')]){faxMessage[_0xa11a('0x4a')](_0x595d1c[_0xa11a('0x49')],{'failMessage':_0xa11a('0x4b')})[_0xa11a('0x3c')](function(_0x180709){ut[_0xa11a('0x4c')]('[Fax][Message][Error][Updated]',_0x180709);})[_0xa11a('0x43')](function(_0xef4a9){ut['logger'](_0xa11a('0x4d'),_0xef4a9);});}else{ut[_0xa11a('0x4c')](_0xa11a('0x4e'));}}Fax[_0xa11a('0x1e')]['updateStatus']=function(_0x28ef04,_0x1af533,_0x95bc48){var _0x142144=this;var _0x3ccdea={};if(_0x1af533){_0x3ccdea={'read':_0x1af533};}else{_0x3ccdea={'failMessage':_0x95bc48};}if(this[_0xa11a('0x27')][_0x28ef04][_0xa11a('0x49')]){faxMessage[_0xa11a('0x4a')](this[_0xa11a('0x27')][_0x28ef04][_0xa11a('0x49')],_0x3ccdea)[_0xa11a('0x3c')](function(_0x2a786c){ut[_0xa11a('0x4c')](_0xa11a('0x4f'),_0x2a786c);})['catch'](function(_0x13dfa7){ut[_0xa11a('0x4c')](_0xa11a('0x50'),_0x13dfa7);})[_0xa11a('0x51')](function(){delete _0x142144[_0xa11a('0x10')][_0x28ef04];delete _0x142144['actions'][_0x28ef04];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0xa11a('0x10')][_0x28ef04];delete this[_0xa11a('0x27')][_0x28ef04];}};Fax[_0xa11a('0x1e')]['syncHangup']=function(_0x31fe96){var _0x2207b5=this;if(this['channels'][_0x31fe96[_0xa11a('0x24')]]){if(this[_0xa11a('0x27')][_0x31fe96['uniqueid']]){this[_0xa11a('0x10')][_0x31fe96['uniqueid']]['id']=this[_0xa11a('0x27')][_0x31fe96['uniqueid']]['id'];this[_0xa11a('0x10')][_0x31fe96[_0xa11a('0x24')]][_0xa11a('0x25')]=this[_0xa11a('0x27')][_0x31fe96[_0xa11a('0x24')]][_0xa11a('0x25')];}logger[_0xa11a('0x26')](_0x31fe96[_0xa11a('0x24')],this['actions'][_0x31fe96[_0xa11a('0x24')]]?_0xa11a('0x52'):_0xa11a('0x53'),JSON[_0xa11a('0x42')](this[_0xa11a('0x10')][_0x31fe96[_0xa11a('0x24')]]));if(this[_0xa11a('0x27')][_0x31fe96[_0xa11a('0x24')]]){if(this[_0xa11a('0x10')][_0x31fe96['uniqueid']][_0xa11a('0x54')]>0x0&&this['channels'][_0x31fe96['uniqueid']]['faxstatus']===_0xa11a('0x55')){this['updateStatus'](_0x31fe96[_0xa11a('0x24')],!![]);}else{this[_0xa11a('0x56')](_0x31fe96[_0xa11a('0x24')],![],this[_0xa11a('0x10')][_0x31fe96[_0xa11a('0x24')]][_0xa11a('0x57')]?_0xa11a('0x58')+this[_0xa11a('0x10')][_0x31fe96[_0xa11a('0x24')]][_0xa11a('0x57')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x5654dd){var _0x499e0b=this;return new BPromise(function(_0x7661f1,_0x4445ff){_0x499e0b[_0xa11a('0x59')](_0x5654dd,_0x499e0b[_0xa11a('0x11')][_0x5654dd[_0xa11a('0x5a')]])[_0xa11a('0x3c')](function(_0x440ed5){ut[_0xa11a('0x4c')](_0xa11a('0x5b'),_0x440ed5);_0x7661f1(ut[_0xa11a('0x39')]('Fax\x20received'));})[_0xa11a('0x43')](function(_0x523f37){ut[_0xa11a('0x4c')](_0xa11a('0x5c'),_0x523f37);updateStatus(_0x5654dd);_0x4445ff(ut[_0xa11a('0x39')](_0xa11a('0x5d')));});});};Fax[_0xa11a('0x1e')][_0xa11a('0x5e')]=function(_0x4ab895){var _0x1288c9=this;return new BPromise(function(_0xa8bace,_0x19863e){var _0x452968=_0x1288c9[_0xa11a('0x5f')](_0x1288c9[_0xa11a('0x11')][_0x4ab895['FaxAccountId']][_0xa11a('0x60')],_0x4ab895);if(_0x452968[_0xa11a('0x61')]){_0xa8bace(ut[_0xa11a('0x39')]('Trunk\x20Reachable'));}else{_0x19863e(ut['message'](_0x452968[_0xa11a('0x39')]));}});};function originate(_0x3eeb32,_0x10c526,_0x49302d){return new BPromise(function(_0x34a8a9,_0x25ded0){if(_0x49302d){var _0x86240f=util[_0xa11a('0x62')](_0xa11a('0x63'),path[_0xa11a('0x3b')](_0x3eeb32[_0xa11a('0x5')])[_0xa11a('0x25')],_0x3eeb32['path']);gs[_0xa11a('0x64')](_0x86240f)[_0xa11a('0x3c')](function(){_0x3eeb32[_0xa11a('0x5')]=util[_0xa11a('0x62')](_0xa11a('0x65'),path[_0xa11a('0x3b')](_0x3eeb32[_0xa11a('0x5')])[_0xa11a('0x66')],path['parse'](_0x3eeb32[_0xa11a('0x5')])['name']);_0x10c526['XMF-PATH']=_0x3eeb32[_0xa11a('0x5')];ut[_0xa11a('0x4c')](_0xa11a('0x67'),'');ami[_0xa11a('0x68')](ut[_0xa11a('0x69')](_0x3eeb32,_0x10c526))['then'](function(_0x555a0a){_0x34a8a9(_0x555a0a);})[_0xa11a('0x43')](function(_0x161aba){_0x25ded0(_0x161aba);});})[_0xa11a('0x43')](function(_0x1188fa){_0x25ded0(_0x1188fa);});}else{ami['Action'](ut[_0xa11a('0x69')](_0x3eeb32,_0x10c526))['then'](function(_0x4b8eb9){_0x34a8a9(_0x4b8eb9);})[_0xa11a('0x43')](function(_0x558434){_0x25ded0(_0x558434);});}});}Fax[_0xa11a('0x1e')][_0xa11a('0x59')]=function(_0x589e61,_0x242cf1){var _0x2911e0=this;return new BPromise(function(_0x191938,_0x500b9e){var _0x267d59=uuid['v4']();var _0xfb97eb=ut[_0xa11a('0x6a')](_0x589e61,_0x242cf1);_0x2911e0['actions'][_0x267d59]=new Action(_0x267d59,_0x242cf1,_0x589e61);var _0x1c9a36=_0x2911e0[_0xa11a('0x27')][_0x267d59];if(path[_0xa11a('0x3b')](_0x589e61[_0xa11a('0x5')])[_0xa11a('0x6b')]===_0xa11a('0x40')){originate(_0x1c9a36,_0xfb97eb,!![])[_0xa11a('0x3c')](function(_0x3093d1){_0x191938(_0x3093d1);})[_0xa11a('0x43')](function(_0x1518ab){_0x500b9e(_0x1518ab);});}else{originate(_0x1c9a36,_0xfb97eb,![])['then'](function(_0x413715){_0x191938(_0x413715);})[_0xa11a('0x43')](function(_0x5fef13){_0x500b9e(_0x5fef13);});}});};Fax['prototype']['isTrunkReachable']=function(_0x54b38c){return!_[_0xa11a('0x6c')](_0x54b38c)&&!_['isNil'](_0x54b38c[_0xa11a('0x25')])&&!_[_0xa11a('0x6c')](_0x54b38c[_0xa11a('0x6d')])&&_0x54b38c[_0xa11a('0x6d')]&&!_[_0xa11a('0x6c')](this[_0xa11a('0x12')][util[_0xa11a('0x62')](_0xa11a('0x6e'),_0x54b38c['name'])])&&!_[_0xa11a('0x6c')](this[_0xa11a('0x12')][util[_0xa11a('0x62')](_0xa11a('0x6e'),_0x54b38c[_0xa11a('0x25')])][_0xa11a('0x30')])&&(this[_0xa11a('0x12')][util['format'](_0xa11a('0x6e'),_0x54b38c[_0xa11a('0x25')])][_0xa11a('0x30')]===_0xa11a('0x6f')||this['trunks'][util[_0xa11a('0x62')](_0xa11a('0x6e'),_0x54b38c[_0xa11a('0x25')])]['status']===_0xa11a('0x70'));};Fax[_0xa11a('0x1e')][_0xa11a('0x5f')]=function(_0x11c5ad,_0x2ad7c2){if(!this['isTrunkReachable'](_0x11c5ad)){ut[_0xa11a('0x4c')](_0xa11a('0x71'),_[_0xa11a('0x6c')](_0x11c5ad)?'':_0x11c5ad['name']+_0xa11a('0x72'));return{'isValid':![],'message':_0xa11a('0x73')};}if(_[_0xa11a('0x6c')](_0x2ad7c2[_0xa11a('0x3f')])){ut[_0xa11a('0x4c')](_0xa11a('0x74'),JSON[_0xa11a('0x42')](_0x2ad7c2));return{'isValid':![],'message':_0xa11a('0x75')};}if(_[_0xa11a('0x6c')](_0x2ad7c2[_0xa11a('0x5')])){ut[_0xa11a('0x4c')](_0xa11a('0x76'),JSON[_0xa11a('0x42')](_0x2ad7c2));return{'isValid':![],'message':_0xa11a('0x77')};}return{'isValid':!![],'message':_0xa11a('0x78')};};module[_0xa11a('0x79')]=Fax; \ No newline at end of file +var _0xbaa4=['\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','catch','error','stringify','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','checkTrunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','trunks','actions','syncNewchannel','varset','syncVarSet','syncNewState','newexten','syncNewExten','bind','faxstatus','syncFaxStatus','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','faxAccounts','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/'];(function(_0x29b13b,_0x1d9ae6){var _0x2b3041=function(_0x108049){while(--_0x108049){_0x29b13b['push'](_0x29b13b['shift']());}};_0x2b3041(++_0x1d9ae6);}(_0xbaa4,0xa9));var _0x4baa=function(_0x233010,_0x59db39){_0x233010=_0x233010-0x0;var _0x1011a6=_0xbaa4[_0x233010];return _0x1011a6;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x4baa('0x0'));var uuid=require(_0x4baa('0x1'));var moment=require('moment');var path=require(_0x4baa('0x2'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x4baa('0x3'));var logger=require(_0x4baa('0x4'))(_0x4baa('0x5'));var ami=require(_0x4baa('0x6'));var rpcDb=require(_0x4baa('0x7'));var Channel=require('./channel');var ut=require(_0x4baa('0x8'));var Action=require(_0x4baa('0x9'));var faxAccount=require(_0x4baa('0xa'));var attachment=require(_0x4baa('0xb'));var faxMessage=require(_0x4baa('0xc'));function Fax(_0x510ca8){this['channels']={};this['faxAccounts']=_0x510ca8['faxAccounts'];this[_0x4baa('0xd')]=_0x510ca8[_0x4baa('0xd')];this[_0x4baa('0xe')]={};ami['on']('newchannel',this[_0x4baa('0xf')]['bind'](this));ami['on'](_0x4baa('0x10'),this[_0x4baa('0x11')]['bind'](this));ami['on']('newstate',this[_0x4baa('0x12')]['bind'](this));ami['on'](_0x4baa('0x13'),this[_0x4baa('0x14')][_0x4baa('0x15')](this));ami['on'](_0x4baa('0x16'),this[_0x4baa('0x17')][_0x4baa('0x15')](this));ami['on']('receivefax',this['syncReceiveFax'][_0x4baa('0x15')](this));ami['on'](_0x4baa('0x18'),this[_0x4baa('0x19')][_0x4baa('0x15')](this));ami['on'](_0x4baa('0x1a'),this[_0x4baa('0x1b')][_0x4baa('0x15')](this));}Fax[_0x4baa('0x1c')][_0x4baa('0xf')]=function(_0x964b02){if(_0x964b02[_0x4baa('0x1d')]===_0x4baa('0x1e')){for(var _0x594e5c in this[_0x4baa('0x1f')]){if(this[_0x4baa('0x1f')]['hasOwnProperty'](_0x594e5c)){if(_0x964b02['exten']===this[_0x4baa('0x1f')][_0x594e5c][_0x4baa('0x20')]){this[_0x4baa('0x21')][_0x964b02[_0x4baa('0x22')]]={};this[_0x4baa('0x21')][_0x964b02[_0x4baa('0x22')]][_0x4baa('0x23')]=_0x964b02[_0x4baa('0x23')];this[_0x4baa('0x21')][_0x964b02['uniqueid']]['id']=this[_0x4baa('0x1f')][_0x594e5c]['id'];this['channels'][_0x964b02[_0x4baa('0x22')]][_0x4baa('0x24')]=this[_0x4baa('0x1f')][_0x594e5c][_0x4baa('0x24')];logger[_0x4baa('0x25')](_0x964b02[_0x4baa('0x22')],'\x20syncNewchannel\x20');}}}}if(this[_0x4baa('0xe')][_0x964b02[_0x4baa('0x22')]]){this[_0x4baa('0x21')][_0x964b02[_0x4baa('0x22')]]={};this[_0x4baa('0x21')][_0x964b02['uniqueid']][_0x4baa('0x23')]=_0x964b02[_0x4baa('0x23')];logger[_0x4baa('0x25')](_0x964b02[_0x4baa('0x22')],_0x4baa('0x26'));}};Fax[_0x4baa('0x1c')][_0x4baa('0x11')]=function(_0x5c8254){if(this[_0x4baa('0x21')][_0x5c8254[_0x4baa('0x22')]]){for(var _0x2e99e1 in _0x5c8254[_0x4baa('0x27')]){if(_0x5c8254[_0x4baa('0x27')][_0x4baa('0x28')](_0x2e99e1)){this['channels'][_0x5c8254[_0x4baa('0x22')]][_0x2e99e1]=_0x5c8254[_0x4baa('0x29')];}}}};Fax['prototype'][_0x4baa('0x12')]=function(_0x4cb1c3){if(this['channels'][_0x4cb1c3[_0x4baa('0x22')]]){this['channels'][_0x4cb1c3[_0x4baa('0x22')]][_0x4baa('0x2a')]=_0x4cb1c3[_0x4baa('0x2a')];this[_0x4baa('0x21')][_0x4cb1c3['uniqueid']]['channelstatedesc']=_0x4cb1c3[_0x4baa('0x2b')];}};Fax[_0x4baa('0x1c')][_0x4baa('0x14')]=function(_0x3706f6){if(this[_0x4baa('0x21')][_0x3706f6[_0x4baa('0x22')]]){for(var _0x3d7cce in _0x3706f6[_0x4baa('0x27')]){if(_0x3706f6[_0x4baa('0x27')][_0x4baa('0x28')](_0x3d7cce)){this[_0x4baa('0x21')][_0x3706f6[_0x4baa('0x22')]][_0x3d7cce]=_0x3706f6['value'];}}}};Fax['prototype'][_0x4baa('0x17')]=function(_0x49a607){if(this[_0x4baa('0x21')][_0x49a607[_0x4baa('0x22')]]){this[_0x4baa('0x21')][_0x49a607[_0x4baa('0x22')]][_0x4baa('0x2c')]=_0x49a607[_0x4baa('0x2c')];this[_0x4baa('0x21')][_0x49a607[_0x4baa('0x22')]][_0x4baa('0x2d')]=_0x49a607[_0x4baa('0x2d')];this['channels'][_0x49a607[_0x4baa('0x22')]][_0x4baa('0x20')]=_0x49a607['localstationid'];this[_0x4baa('0x21')][_0x49a607['uniqueid']][_0x4baa('0x2e')]=_0x49a607[_0x4baa('0x2e')];logger['info'](_0x49a607['uniqueid'],_0x4baa('0x2f'));}};Fax[_0x4baa('0x1c')][_0x4baa('0x30')]=function(_0x19b3c4){var _0x25f118=this;if(this[_0x4baa('0x21')][_0x19b3c4[_0x4baa('0x22')]]){var _0x1680a5=this[_0x4baa('0x21')][_0x19b3c4[_0x4baa('0x22')]]['id'];this[_0x4baa('0x21')][_0x19b3c4[_0x4baa('0x22')]][_0x4baa('0x31')]=_0x19b3c4[_0x4baa('0x31')];this[_0x4baa('0x21')][_0x19b3c4[_0x4baa('0x22')]][_0x4baa('0x32')]=_0x19b3c4[_0x4baa('0x32')];this[_0x4baa('0x21')][_0x19b3c4[_0x4baa('0x22')]][_0x4baa('0x20')]=_0x19b3c4[_0x4baa('0x20')];this[_0x4baa('0x21')][_0x19b3c4[_0x4baa('0x22')]][_0x4baa('0x33')]=_0x19b3c4[_0x4baa('0x33')];this[_0x4baa('0x21')][_0x19b3c4[_0x4baa('0x22')]][_0x4baa('0x34')]=_0x19b3c4[_0x4baa('0x34')];this[_0x4baa('0x21')][_0x19b3c4[_0x4baa('0x22')]]['filename']=_0x19b3c4[_0x4baa('0x2e')];this['channels'][_0x19b3c4[_0x4baa('0x22')]][_0x4baa('0x35')]=_0x19b3c4[_0x4baa('0x35')];if(this[_0x4baa('0x21')][_0x19b3c4[_0x4baa('0x22')]][_0x4baa('0x32')]>0x0){tiff2pdf(_0x19b3c4[_0x4baa('0x2e')],_0x4baa('0x36'),function(_0x1aefb2){logger[_0x4baa('0x25')](_0x19b3c4[_0x4baa('0x22')],_0x4baa('0x37'),_0x1aefb2['message']);attachment[_0x4baa('0x38')]({'name':path[_0x4baa('0x39')](_0x19b3c4['filename'])[_0x4baa('0x24')],'basename':path[_0x4baa('0x39')](_0x19b3c4[_0x4baa('0x2e')])[_0x4baa('0x24')]+_0x4baa('0x3a'),'type':_0x4baa('0x3b')})[_0x4baa('0x3c')](function(_0x13dda8){faxAccount['notify'](_0x1680a5,{'from':_0x19b3c4[_0x4baa('0x35')],'mapKey':_0x4baa('0x5'),'body':path[_0x4baa('0x39')](_0x19b3c4['filename'])[_0x4baa('0x24')]+_0x4baa('0x3a'),'AttachmentId':_0x13dda8['id']})[_0x4baa('0x3d')](function(_0x129a1e){logger[_0x4baa('0x3e')](_0x19b3c4[_0x4baa('0x22')],'\x20notify\x20',JSON[_0x4baa('0x3f')](_0x129a1e));});})['catch'](function(_0x3ac3cc){logger[_0x4baa('0x3e')](_0x19b3c4['uniqueid'],'\x20receiveFax\x20',JSON[_0x4baa('0x3f')](_0x3ac3cc));});});}logger[_0x4baa('0x25')](_0x19b3c4[_0x4baa('0x22')],'\x20receiveFax\x20');}};Fax[_0x4baa('0x1c')][_0x4baa('0x1b')]=function(_0x37e91c){if(this['actions'][_0x37e91c['uniqueid']]){_['merge'](this[_0x4baa('0x21')][_0x37e91c[_0x4baa('0x22')]],_['pick'](_0x37e91c,[_0x4baa('0x40'),'reason']));}};function updateStatus(_0x3231db){if(_0x3231db[_0x4baa('0x41')]){faxMessage[_0x4baa('0x42')](_0x3231db[_0x4baa('0x41')],{'failMessage':_0x4baa('0x43')})['then'](function(_0x8fef9c){ut[_0x4baa('0x44')](_0x4baa('0x45'),_0x8fef9c);})['catch'](function(_0xba34c){ut[_0x4baa('0x44')](_0x4baa('0x46'),_0xba34c);});}else{ut['logger'](_0x4baa('0x47'));}}Fax[_0x4baa('0x1c')][_0x4baa('0x48')]=function(_0x2176d5,_0x430a74,_0x2e512a){var _0x63d995=this;var _0x52ff4a={};if(_0x430a74){_0x52ff4a={'read':_0x430a74};}else{_0x52ff4a={'failMessage':_0x2e512a};}if(this[_0x4baa('0xe')][_0x2176d5][_0x4baa('0x41')]){faxMessage['update'](this[_0x4baa('0xe')][_0x2176d5][_0x4baa('0x41')],_0x52ff4a)['then'](function(_0x25b8cc){ut['logger'](_0x4baa('0x49'),_0x25b8cc);})['catch'](function(_0x50d1b2){ut[_0x4baa('0x44')]('[Fax][Message][NoUpdate1]',_0x50d1b2);})['finally'](function(){delete _0x63d995[_0x4baa('0x21')][_0x2176d5];delete _0x63d995[_0x4baa('0xe')][_0x2176d5];});}else{ut[_0x4baa('0x44')](_0x4baa('0x4a'));delete this[_0x4baa('0x21')][_0x2176d5];delete this['actions'][_0x2176d5];}};Fax[_0x4baa('0x1c')][_0x4baa('0x19')]=function(_0x302421){var _0x22ca7d=this;if(this['channels'][_0x302421[_0x4baa('0x22')]]){if(this['actions'][_0x302421[_0x4baa('0x22')]]){this[_0x4baa('0x21')][_0x302421[_0x4baa('0x22')]]['id']=this[_0x4baa('0xe')][_0x302421[_0x4baa('0x22')]]['id'];this['channels'][_0x302421[_0x4baa('0x22')]][_0x4baa('0x24')]=this[_0x4baa('0xe')][_0x302421[_0x4baa('0x22')]]['name'];}logger[_0x4baa('0x25')](_0x302421[_0x4baa('0x22')],this['actions'][_0x302421[_0x4baa('0x22')]]?_0x4baa('0x4b'):_0x4baa('0x4c'),JSON['stringify'](this[_0x4baa('0x21')][_0x302421[_0x4baa('0x22')]]));if(this[_0x4baa('0xe')][_0x302421['uniqueid']]){if(this[_0x4baa('0x21')][_0x302421[_0x4baa('0x22')]][_0x4baa('0x4d')]>0x0&&this[_0x4baa('0x21')][_0x302421[_0x4baa('0x22')]][_0x4baa('0x16')]===_0x4baa('0x4e')){this[_0x4baa('0x48')](_0x302421['uniqueid'],!![]);}else{this[_0x4baa('0x48')](_0x302421['uniqueid'],![],this[_0x4baa('0x21')][_0x302421[_0x4baa('0x22')]][_0x4baa('0x4f')]?_0x4baa('0x50')+this[_0x4baa('0x21')][_0x302421[_0x4baa('0x22')]][_0x4baa('0x4f')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x174be0){var _0x3e3efd=this;return new BPromise(function(_0x4a1ebd,_0x2b130a){_0x3e3efd[_0x4baa('0x51')](_0x174be0,_0x3e3efd['faxAccounts'][_0x174be0[_0x4baa('0x52')]])[_0x4baa('0x3c')](function(_0x121ff2){ut['logger'](_0x4baa('0x53'),_0x121ff2);_0x4a1ebd(ut[_0x4baa('0x54')](_0x4baa('0x55')));})['catch'](function(_0x2f4979){ut[_0x4baa('0x44')]('[Fax][execOriginate][failure]',_0x2f4979);updateStatus(_0x174be0);_0x2b130a(ut['message']('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x110512){var _0x4a8f5f=this;return new BPromise(function(_0x8763b9,_0x324247){var _0x1d4a27=_0x4a8f5f[_0x4baa('0x56')](_0x4a8f5f['faxAccounts'][_0x110512[_0x4baa('0x52')]]['Trunk'],_0x110512);if(_0x1d4a27[_0x4baa('0x57')]){_0x8763b9(ut[_0x4baa('0x54')](_0x4baa('0x58')));}else{_0x324247(ut[_0x4baa('0x54')](_0x1d4a27[_0x4baa('0x54')]));}});};function originate(_0x407009,_0x10420d,_0x1e2067){return new BPromise(function(_0x3a3a13,_0x234590){if(_0x1e2067){var _0x248055=util['format'](_0x4baa('0x59'),path[_0x4baa('0x39')](_0x407009['path'])[_0x4baa('0x24')],_0x407009[_0x4baa('0x2')]);gs[_0x4baa('0x5a')](_0x248055)[_0x4baa('0x3c')](function(){_0x407009[_0x4baa('0x2')]=util[_0x4baa('0x5b')](_0x4baa('0x5c'),path['parse'](_0x407009[_0x4baa('0x2')])['dir'],path['parse'](_0x407009[_0x4baa('0x2')])['name']);_0x10420d[_0x4baa('0x5d')]=_0x407009['path'];ut[_0x4baa('0x44')](_0x4baa('0x5e'),'');ami[_0x4baa('0x5f')](ut[_0x4baa('0x60')](_0x407009,_0x10420d))['then'](function(_0x44d523){_0x3a3a13(_0x44d523);})[_0x4baa('0x3d')](function(_0x112865){_0x234590(_0x112865);});})['catch'](function(_0x15fad0){_0x234590(_0x15fad0);});}else{ami[_0x4baa('0x5f')](ut['variablesAction'](_0x407009,_0x10420d))['then'](function(_0x331efa){_0x3a3a13(_0x331efa);})[_0x4baa('0x3d')](function(_0x5674b7){_0x234590(_0x5674b7);});}});}Fax[_0x4baa('0x1c')]['execOriginate']=function(_0x16c50c,_0x493913){var _0x529180=this;return new BPromise(function(_0xb57251,_0x3f972d){var _0x582c9f=uuid['v4']();var _0x35a99b=ut['addVariables'](_0x16c50c,_0x493913);_0x529180[_0x4baa('0xe')][_0x582c9f]=new Action(_0x582c9f,_0x493913,_0x16c50c);var _0x85d6dd=_0x529180[_0x4baa('0xe')][_0x582c9f];if(path[_0x4baa('0x39')](_0x16c50c['path'])[_0x4baa('0x61')]===_0x4baa('0x3a')){originate(_0x85d6dd,_0x35a99b,!![])[_0x4baa('0x3c')](function(_0x5768a7){_0xb57251(_0x5768a7);})[_0x4baa('0x3d')](function(_0x3f3150){_0x3f972d(_0x3f3150);});}else{originate(_0x85d6dd,_0x35a99b,![])[_0x4baa('0x3c')](function(_0x5335c6){_0xb57251(_0x5335c6);})[_0x4baa('0x3d')](function(_0x5ead89){_0x3f972d(_0x5ead89);});}});};Fax[_0x4baa('0x1c')][_0x4baa('0x62')]=function(_0x3ce6dc){return!_[_0x4baa('0x63')](_0x3ce6dc)&&!_[_0x4baa('0x63')](_0x3ce6dc['name'])&&!_[_0x4baa('0x63')](_0x3ce6dc[_0x4baa('0x64')])&&_0x3ce6dc[_0x4baa('0x64')]&&!_[_0x4baa('0x63')](this[_0x4baa('0xd')][util[_0x4baa('0x5b')](_0x4baa('0x65'),_0x3ce6dc[_0x4baa('0x24')])])&&!_[_0x4baa('0x63')](this[_0x4baa('0xd')][util[_0x4baa('0x5b')](_0x4baa('0x65'),_0x3ce6dc[_0x4baa('0x24')])][_0x4baa('0x2d')])&&(this[_0x4baa('0xd')][util[_0x4baa('0x5b')](_0x4baa('0x65'),_0x3ce6dc['name'])][_0x4baa('0x2d')]===_0x4baa('0x66')||this[_0x4baa('0xd')][util[_0x4baa('0x5b')]('SIP/%s',_0x3ce6dc[_0x4baa('0x24')])][_0x4baa('0x2d')]===_0x4baa('0x67'));};Fax[_0x4baa('0x1c')][_0x4baa('0x56')]=function(_0x951f84,_0x48765e){if(!this[_0x4baa('0x62')](_0x951f84)){ut[_0x4baa('0x44')](_0x4baa('0x68'),_[_0x4baa('0x63')](_0x951f84)?'':_0x951f84[_0x4baa('0x24')]+_0x4baa('0x69'));return{'isValid':![],'message':_0x4baa('0x6a')};}if(_[_0x4baa('0x63')](_0x48765e[_0x4baa('0x5')])){ut[_0x4baa('0x44')](_0x4baa('0x6b'),JSON['stringify'](_0x48765e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x4baa('0x63')](_0x48765e[_0x4baa('0x2')])){ut[_0x4baa('0x44')](_0x4baa('0x6c'),JSON[_0x4baa('0x3f')](_0x48765e));return{'isValid':![],'message':_0x4baa('0x6d')};}return{'isValid':!![],'message':_0x4baa('0x6e')};};module[_0x4baa('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 1eb7b27..bc8fce0 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 _0x1447=['[Notify]\x20','util','preview','lodash','error','inspect','resolve','notify','catch'];(function(_0x1d2ad6,_0x555669){var _0x42e8fc=function(_0x4f17d1){while(--_0x4f17d1){_0x1d2ad6['push'](_0x1d2ad6['shift']());}};_0x42e8fc(++_0x555669);}(_0x1447,0x1cc));var _0x7144=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x1447[_0x1cc8fe];return _0x230054;};'use strict';var util=require(_0x7144('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x7144('0x1'));var _=require(_0x7144('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x238bc5){return function(_0x4dc97a){logger[_0x7144('0x3')](_0x238bc5,util[_0x7144('0x4')](_0x4dc97a,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x37648a,_0x472c04){return BPromise[_0x7144('0x5')]()['then'](faxAccount[_0x7144('0x6')](_0x37648a,_0x472c04))[_0x7144('0x7')](loggerCatch(_0x7144('0x8')));}; \ No newline at end of file +var _0x9030=['notify','then','catch','error'];(function(_0x43a58f,_0x53227c){var _0x27a009=function(_0x439b96){while(--_0x439b96){_0x43a58f['push'](_0x43a58f['shift']());}};_0x27a009(++_0x53227c);}(_0x9030,0x97));var _0x0903=function(_0x42817b,_0x1e923f){_0x42817b=_0x42817b-0x0;var _0x30f2b8=_0x9030[_0x42817b];return _0x30f2b8;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x309e18){return function(_0x204d8f){logger[_0x0903('0x0')](_0x309e18,util['inspect'](_0x204d8f,{'showHidden':![],'depth':null}));};}exports[_0x0903('0x1')]=function(_0x6e9992,_0x3484ac){return BPromise['resolve']()[_0x0903('0x2')](faxAccount[_0x0903('0x1')](_0x6e9992,_0x3484ac))[_0x0903('0x3')](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 54c2ed7..6b7b538 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 _0x687b=['child_process','exec','Exec\x20gs','info','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x17475e,_0x483eb8){var _0x280491=function(_0x71dd26){while(--_0x71dd26){_0x17475e['push'](_0x17475e['shift']());}};_0x280491(++_0x483eb8);}(_0x687b,0xcb));var _0xb687=function(_0x5b0f89,_0x303a8b){_0x5b0f89=_0x5b0f89-0x0;var _0x21ae25=_0x687b[_0x5b0f89];return _0x21ae25;};'use strict';var util=require(_0xb687('0x0'));var logger=require(_0xb687('0x1'))(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var exec=require(_0xb687('0x4'))[_0xb687('0x5')];exports['execute']=function(_0x337f5b){return new BPromise(function(_0x28c32a,_0x59fcbd){exec(_0x337f5b,function(_0x3d9975,_0x5175d4,_0x308cb7){logger['info'](_0xb687('0x6'),_0x5175d4);if(_0x3d9975){logger[_0xb687('0x7')](_0xb687('0x6'),'\x20Error\x20:',util[_0xb687('0x8')](_0x3d9975,{'showHidden':![],'depth':null}),_0x5175d4,_0x308cb7);_0x59fcbd(_0x3d9975);}_0x28c32a(_0x5175d4);});});}; \ No newline at end of file +var _0xff15=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process','exec','execute','info'];(function(_0x20e51b,_0x3e9eb6){var _0x4e12a8=function(_0x271b0d){while(--_0x271b0d){_0x20e51b['push'](_0x20e51b['shift']());}};_0x4e12a8(++_0x3e9eb6);}(_0xff15,0x1d9));var _0x5ff1=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0xff15[_0x2136a6];return _0x55b948;};'use strict';var util=require(_0x5ff1('0x0'));var logger=require(_0x5ff1('0x1'))('fax');var BPromise=require(_0x5ff1('0x2'));var exec=require(_0x5ff1('0x3'))[_0x5ff1('0x4')];exports[_0x5ff1('0x5')]=function(_0x17a011){return new BPromise(function(_0x7493e3,_0xc890f){exec(_0x17a011,function(_0x416663,_0x425b6f,_0x5d35eb){logger['info']('Exec\x20gs',_0x425b6f);if(_0x416663){logger[_0x5ff1('0x6')](_0x5ff1('0x7'),_0x5ff1('0x8'),util[_0x5ff1('0x9')](_0x416663,{'showHidden':![],'depth':null}),_0x425b6f,_0x5d35eb);_0xc890f(_0x416663);}_0x7493e3(_0x425b6f);});});}; \ 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 c401e30..8071ed0 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 _0xfea3=['faxdetect','path','variablesAction','originate','xcally-motion-fax','format','\x22%s\x22\x20<%s>','localstationid','uniqueid','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo','minrate','\x22%s\x22','modem','gateway'];(function(_0x3f51b3,_0x44776c){var _0x80e74e=function(_0x52c585){while(--_0x52c585){_0x3f51b3['push'](_0x3f51b3['shift']());}};_0x80e74e(++_0x44776c);}(_0xfea3,0x69));var _0x3fea=function(_0x48ecef,_0x1fb44d){_0x48ecef=_0x48ecef-0x0;var _0x35cbd4=_0xfea3[_0x48ecef];return _0x35cbd4;};'use strict';var util=require(_0x3fea('0x0'));var _=require(_0x3fea('0x1'));var moment=require(_0x3fea('0x2'));var logger=require(_0x3fea('0x3'))(_0x3fea('0x4'));exports[_0x3fea('0x5')]=function(_0x2f5995){return{'message':_0x2f5995};};exports[_0x3fea('0x6')]=function(_0x32c9c9,_0xbf6c79){logger[_0x3fea('0x7')](_0x32c9c9,util[_0x3fea('0x8')](_0xbf6c79,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3d7ae6,_0x47a986){var _0x9de590={'XMF-ECM':_0x47a986[_0x3fea('0x9')],'XMF-HEADERINFO':_0x47a986[_0x3fea('0xa')],'XMF-MINRATE':_0x47a986[_0x3fea('0xb')],'XMF-MAXRATE':_0x47a986['maxrate'],'XMF-MODEM':util['format'](_0x3fea('0xc'),_0x47a986[_0x3fea('0xd')]),'XMF-GATEWAY':_0x47a986[_0x3fea('0xe')],'XMF-FAXDETECT':_0x47a986[_0x3fea('0xf')],'XMF-T38TIMEOUT':_0x47a986['t38timeout'],'XMF-LOCALSTATIONID':_0x47a986['localstationid'],'XMF-PATH':_0x3d7ae6[_0x3fea('0x10')]};return _0x9de590;};exports[_0x3fea('0x11')]=function(_0x211881,_0x2bf353){return{'actionid':_0x211881['uniqueid'],'action':_0x3fea('0x12'),'channel':_0x211881['channel'],'Exten':_0x3fea('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x3fea('0x14')](_0x3fea('0x15'),_0x211881[_0x3fea('0xa')]?_0x211881[_0x3fea('0xa')]:'',_0x211881[_0x3fea('0x16')]),'variable':_0x2bf353,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x211881[_0x3fea('0x17')]};}; \ No newline at end of file +var _0x1bdd=['ecm','headerinfo','minrate','format','\x22%s\x22','modem','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','localstationid','util','lodash','../../../../config/logger','fax','logger','info','inspect','addVariables'];(function(_0x5c9438,_0x55ed27){var _0x5d6761=function(_0x48b7f6){while(--_0x48b7f6){_0x5c9438['push'](_0x5c9438['shift']());}};_0x5d6761(++_0x55ed27);}(_0x1bdd,0x168));var _0xd1bd=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x1bdd[_0x31eb67];return _0x2a8cb8;};'use strict';var util=require(_0xd1bd('0x0'));var _=require(_0xd1bd('0x1'));var moment=require('moment');var logger=require(_0xd1bd('0x2'))(_0xd1bd('0x3'));exports['message']=function(_0x1af481){return{'message':_0x1af481};};exports[_0xd1bd('0x4')]=function(_0x3cea96,_0x2bb00f){logger[_0xd1bd('0x5')](_0x3cea96,util[_0xd1bd('0x6')](_0x2bb00f,{'showHidden':![],'depth':null}));};exports[_0xd1bd('0x7')]=function(_0x409a88,_0xed32b4){var _0x50955b={'XMF-ECM':_0xed32b4[_0xd1bd('0x8')],'XMF-HEADERINFO':_0xed32b4[_0xd1bd('0x9')],'XMF-MINRATE':_0xed32b4[_0xd1bd('0xa')],'XMF-MAXRATE':_0xed32b4['maxrate'],'XMF-MODEM':util[_0xd1bd('0xb')](_0xd1bd('0xc'),_0xed32b4[_0xd1bd('0xd')]),'XMF-GATEWAY':_0xed32b4['gateway'],'XMF-FAXDETECT':_0xed32b4[_0xd1bd('0xe')],'XMF-T38TIMEOUT':_0xed32b4[_0xd1bd('0xf')],'XMF-LOCALSTATIONID':_0xed32b4['localstationid'],'XMF-PATH':_0x409a88[_0xd1bd('0x10')]};return _0x50955b;};exports[_0xd1bd('0x11')]=function(_0x1c5345,_0xc29c0e){return{'actionid':_0x1c5345[_0xd1bd('0x12')],'action':_0xd1bd('0x13'),'channel':_0x1c5345[_0xd1bd('0x14')],'Exten':_0xd1bd('0x15'),'Context':'from-sip','Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x1c5345[_0xd1bd('0x9')]?_0x1c5345[_0xd1bd('0x9')]:'',_0x1c5345[_0xd1bd('0x16')]),'variable':_0xc29c0e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1c5345[_0xd1bd('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 29e6744..d1eef4f 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 _0xfb9c=['initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','sync','catch','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts'];(function(_0x4ed786,_0x74f270){var _0x2f0243=function(_0x5642f5){while(--_0x5642f5){_0x4ed786['push'](_0x4ed786['shift']());}};_0x2f0243(++_0x74f270);}(_0xfb9c,0x1a8));var _0xcfb9=function(_0x58cf07,_0x2e3858){_0x58cf07=_0x58cf07-0x0;var _0x42afe0=_0xfb9c[_0x58cf07];return _0x42afe0;};'use strict';var BPromise=require('bluebird');var util=require(_0xcfb9('0x0'));var moment=require(_0xcfb9('0x1'));var server=require(_0xcfb9('0x2'));var Realtime=require('./realtime');var Report=require(_0xcfb9('0x3'));var Acw=require(_0xcfb9('0x4'));var Trigger=require(_0xcfb9('0x5'));var Dialer=require(_0xcfb9('0x6'));var Preview=require(_0xcfb9('0x7'));var Fax=require(_0xcfb9('0x8'));var user=require(_0xcfb9('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xcfb9('0xa'));var voiceCallReport=require(_0xcfb9('0xb'));var trunk=require(_0xcfb9('0xc'));var trigger=require(_0xcfb9('0xd'));var template=require(_0xcfb9('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xcfb9('0xf'));var voiceExtension=require(_0xcfb9('0x10'));var faxAccount=require(_0xcfb9('0x11'));var zendesk=require(_0xcfb9('0x12'));var salesforce=require(_0xcfb9('0x13'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xcfb9('0x14'));var desk=require(_0xcfb9('0x15'));var zoho=require(_0xcfb9('0x16'));var vtiger=require(_0xcfb9('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xcfb9('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xcfb9('0x19')](_0xcfb9('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xcfb9('0x19')](_0xcfb9('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xcfb9('0x1b')]()[_0xcfb9('0x1c')](user[_0xcfb9('0x1d')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x1e')]())[_0xcfb9('0x1c')](user['getTelephones']())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x1f')]())[_0xcfb9('0x1c')](trunk[_0xcfb9('0x20')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x21')]())['then'](voiceQueue[_0xcfb9('0x22')]())['then'](realtime[_0xcfb9('0x23')]())[_0xcfb9('0x1c')](trigger[_0xcfb9('0x24')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x25')]())[_0xcfb9('0x1c')](template[_0xcfb9('0x26')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x27')]())[_0xcfb9('0x1c')](zendesk['getZendeskAccounts']())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x28')]())[_0xcfb9('0x1c')](salesforce['getSalesforceAccounts']())['then'](realtime[_0xcfb9('0x29')]())[_0xcfb9('0x1c')](sugarcrm[_0xcfb9('0x2a')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x2b')]())['then'](freshdesk[_0xcfb9('0x2c')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x2d')]())[_0xcfb9('0x1c')](desk['getDeskAccounts']())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x2e')]())[_0xcfb9('0x1c')](zoho[_0xcfb9('0x2f')]())['then'](realtime[_0xcfb9('0x30')]())[_0xcfb9('0x1c')](vtiger[_0xcfb9('0x31')]())['then'](realtime[_0xcfb9('0x32')]())[_0xcfb9('0x1c')](freshsales[_0xcfb9('0x33')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x34')]())[_0xcfb9('0x1c')](servicenow['getServicenowAccounts']())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x35')]())[_0xcfb9('0x1c')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0xcfb9('0x36')]())['then'](campaign[_0xcfb9('0x37')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x38')]())[_0xcfb9('0x1c')](voiceExtension[_0xcfb9('0x39')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x3a')]())['then'](faxAccount[_0xcfb9('0x3b')]())['then'](realtime['initFaxAccounts']())[_0xcfb9('0x1c')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0xcfb9('0x3c')]())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x3d')]())['then'](cmHopperHistory[_0xcfb9('0x3e')]())['then'](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xcfb9('0x1c')](realtime[_0xcfb9('0x3f')]())[_0xcfb9('0x1c')](voiceCallReport[_0xcfb9('0x40')]())[_0xcfb9('0x1c')](realtime['initVoiceCallReports']())[_0xcfb9('0x1c')](function(_0x2229a2){})['catch'](function(_0x1bdb16){console[_0xcfb9('0x41')](_0x1bdb16);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x4258be){return initRealtime();})[_0xcfb9('0x1c')](function(){return initParams();})[_0xcfb9('0x1c')](function(){report[_0xcfb9('0x42')]();setInterval(initRealtime,0x1388);})[_0xcfb9('0x43')](function(_0x6fb794){console[_0xcfb9('0x41')](_0x6fb794);});}main(); \ No newline at end of file +var _0x0bb6=['./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','getTelephones','initTelephones','initTrunks','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/campaign'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0bb6,0xab));var _0x60bb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bb6[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x60bb('0x0'));var util=require(_0x60bb('0x1'));var moment=require(_0x60bb('0x2'));var server=require(_0x60bb('0x3'));var Realtime=require(_0x60bb('0x4'));var Report=require(_0x60bb('0x5'));var Acw=require(_0x60bb('0x6'));var Trigger=require(_0x60bb('0x7'));var Dialer=require(_0x60bb('0x8'));var Preview=require(_0x60bb('0x9'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x60bb('0xa'));var voiceQueueReport=require(_0x60bb('0xb'));var voiceCallReport=require(_0x60bb('0xc'));var trunk=require(_0x60bb('0xd'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x60bb('0xe'));var voiceExtension=require(_0x60bb('0xf'));var faxAccount=require(_0x60bb('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x60bb('0x11'));var freshdesk=require(_0x60bb('0x12'));var desk=require(_0x60bb('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x60bb('0x14'));var freshsales=require(_0x60bb('0x15'));var servicenow=require(_0x60bb('0x16'));var dynamics365=require(_0x60bb('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x60bb('0x18')](_0x60bb('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x60bb('0x18')](_0x60bb('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x60bb('0x1a')]()[_0x60bb('0x1b')](user[_0x60bb('0x1c')]())[_0x60bb('0x1b')](realtime['initAgents']())[_0x60bb('0x1b')](user[_0x60bb('0x1d')]())[_0x60bb('0x1b')](realtime[_0x60bb('0x1e')]())['then'](trunk['getTrunks']())['then'](realtime[_0x60bb('0x1f')]())[_0x60bb('0x1b')](voiceQueue['getVoiceQueues']())[_0x60bb('0x1b')](realtime[_0x60bb('0x20')]())['then'](trigger['getTriggers']())['then'](realtime[_0x60bb('0x21')]())[_0x60bb('0x1b')](template[_0x60bb('0x22')]())[_0x60bb('0x1b')](realtime[_0x60bb('0x23')]())[_0x60bb('0x1b')](zendesk[_0x60bb('0x24')]())['then'](realtime['initZendeskAccounts']())[_0x60bb('0x1b')](salesforce[_0x60bb('0x25')]())[_0x60bb('0x1b')](realtime[_0x60bb('0x26')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x60bb('0x1b')](realtime['initSugarcrmAccounts']())[_0x60bb('0x1b')](freshdesk[_0x60bb('0x27')]())[_0x60bb('0x1b')](realtime['initFreshdeskAccounts']())[_0x60bb('0x1b')](desk['getDeskAccounts']())[_0x60bb('0x1b')](realtime['initDeskAccounts']())[_0x60bb('0x1b')](zoho[_0x60bb('0x28')]())['then'](realtime[_0x60bb('0x29')]())[_0x60bb('0x1b')](vtiger[_0x60bb('0x2a')]())[_0x60bb('0x1b')](realtime['initVtigerAccounts']())['then'](freshsales['getFreshsalesAccounts']())[_0x60bb('0x1b')](realtime['initFreshsalesAccounts']())[_0x60bb('0x1b')](servicenow[_0x60bb('0x2b')]())[_0x60bb('0x1b')](realtime['initServicenowAccounts']())[_0x60bb('0x1b')](dynamics365[_0x60bb('0x2c')]())[_0x60bb('0x1b')](realtime[_0x60bb('0x2d')]())[_0x60bb('0x1b')](campaign['getCampaigns']())['then'](realtime[_0x60bb('0x2e')]())[_0x60bb('0x1b')](voiceExtension[_0x60bb('0x2f')]())[_0x60bb('0x1b')](realtime[_0x60bb('0x30')]())['then'](faxAccount[_0x60bb('0x31')]())[_0x60bb('0x1b')](realtime[_0x60bb('0x32')]())[_0x60bb('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x60bb('0x1a')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x60bb('0x1b')](realtime[_0x60bb('0x33')]())[_0x60bb('0x1b')](cmHopperHistory[_0x60bb('0x34')]())[_0x60bb('0x1b')](realtime[_0x60bb('0x35')]())['then'](cmHopperHistory[_0x60bb('0x36')]())[_0x60bb('0x1b')](realtime[_0x60bb('0x37')]())['then'](voiceCallReport[_0x60bb('0x38')]())[_0x60bb('0x1b')](realtime[_0x60bb('0x39')]())[_0x60bb('0x1b')](function(_0x2b4a73){})[_0x60bb('0x3a')](function(_0x509a6a){console[_0x60bb('0x3b')](_0x509a6a);});}function main(){return server[_0x60bb('0x3c')](realtime,preview,fax)['then'](function(_0x20db13){return initRealtime();})[_0x60bb('0x1b')](function(){return initParams();})[_0x60bb('0x1b')](function(){report[_0x60bb('0x3d')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x294cd4){console['log'](_0x294cd4);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 0edc14e..355f01a 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(_0x53ffd2,_0x507be2){var _0x42ec69=function(_0x531246){while(--_0x531246){_0x53ffd2['push'](_0x53ffd2['shift']());}};_0x42ec69(++_0x507be2);}(_0x70e0,0x17b));var _0x070e=function(_0x24e314,_0x23fbeb){_0x24e314=_0x24e314-0x0;var _0x35da3e=_0x70e0[_0x24e314];return _0x35da3e;};'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 _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x3b47a3,_0x509bf6){var _0x4a113e=function(_0x488fda){while(--_0x488fda){_0x3b47a3['push'](_0x3b47a3['shift']());}};_0x4a113e(++_0x509bf6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 99821dd..0dd2f9c 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 _0x14c6=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC'];(function(_0x49f21d,_0x20cae1){var _0x371b86=function(_0xe4c2f4){while(--_0xe4c2f4){_0x49f21d['push'](_0x49f21d['shift']());}};_0x371b86(++_0x20cae1);}(_0x14c6,0x19a));var _0x614c=function(_0x4f9f87,_0x15df3e){_0x4f9f87=_0x4f9f87-0x0;var _0x9e6334=_0x14c6[_0x4f9f87];return _0x9e6334;};'use strict';function Campaign(_0x287a44){this['id']=_0x287a44['id']||0x0;this[_0x614c('0x0')]=_0x287a44[_0x614c('0x0')]||'';this[_0x614c('0x1')]=_0x287a44['type']||_0x614c('0x2');this[_0x614c('0x3')]=0x0;this['temp']=0x0;this[_0x614c('0x4')]=0x0;this[_0x614c('0x5')]=0x0;this[_0x614c('0x6')]='';this[_0x614c('0x7')]=!![];this[_0x614c('0x8')]=_0x287a44[_0x614c('0x8')];this[_0x614c('0x9')]=_0x287a44[_0x614c('0x9')];this['dialTimezone']=_0x287a44[_0x614c('0xa')]||null;this[_0x614c('0xb')]=_0x287a44[_0x614c('0xb')]?_0x287a44['dialGlobalInterval']:null;this[_0x614c('0xc')]=_0x287a44[_0x614c('0xc')];this[_0x614c('0xd')]=_0x287a44[_0x614c('0xd')];this[_0x614c('0xe')]=_0x287a44[_0x614c('0xe')]||0x1e;this[_0x614c('0xf')]=_0x287a44[_0x614c('0xf')];this[_0x614c('0x10')]=_0x287a44[_0x614c('0x10')];this[_0x614c('0x11')]=_0x287a44['dialBusyMaxRetry'];this[_0x614c('0x12')]=_0x287a44['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x287a44['dialNoAnswerMaxRetry'];this[_0x614c('0x13')]=_0x287a44['dialNoAnswerRetryFrequency'];this[_0x614c('0x14')]=_0x287a44[_0x614c('0x14')];this[_0x614c('0x15')]=_0x287a44['dialNoSuchNumberMaxRetry']||0x3;this[_0x614c('0x16')]=_0x287a44[_0x614c('0x16')]||0x96;this[_0x614c('0x17')]=_0x287a44[_0x614c('0x17')]||0x3;this[_0x614c('0x18')]=_0x287a44[_0x614c('0x18')]||0x96;this[_0x614c('0x19')]=_0x287a44[_0x614c('0x19')]||0x3;this[_0x614c('0x1a')]=_0x287a44['dialAbandonedRetryFrequency']||0x96;this[_0x614c('0x1b')]=_0x287a44[_0x614c('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x287a44['dialMachineRetryFrequency']||0x96;this[_0x614c('0x1c')]=_0x287a44[_0x614c('0x1c')]||0x3;this[_0x614c('0x1d')]=_0x287a44['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x287a44['dialOrderByScheduledAt']||_0x614c('0x1e');this[_0x614c('0x1f')]=_0x287a44[_0x614c('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x287a44[_0x614c('0x20')]||undefined;this['dialCutDigit']=_0x287a44[_0x614c('0x21')]||undefined;this[_0x614c('0x22')]=_0x287a44[_0x614c('0x22')]?_0x287a44['TrunkBackup']:undefined;this[_0x614c('0x23')]=_0x287a44[_0x614c('0x23')]?_0x287a44[_0x614c('0x23')]:undefined;this['Interval']=_0x287a44['Interval']?_0x287a44[_0x614c('0x24')]:undefined;this[_0x614c('0x25')]=_0x287a44[_0x614c('0x25')]?_0x287a44[_0x614c('0x25')]:undefined;this[_0x614c('0x26')]=_0x287a44[_0x614c('0x25')]?_0x287a44[_0x614c('0x25')][_0x614c('0x0')]:undefined;this[_0x614c('0x27')]=_0x287a44[_0x614c('0x27')]||![];this['dialAMDInitialSilence']=_0x287a44[_0x614c('0x28')];this[_0x614c('0x29')]=_0x287a44['dialAMDGreeting'];this[_0x614c('0x2a')]=_0x287a44[_0x614c('0x2a')];this['dialAMDTotalAnalysisTime']=_0x287a44['dialAMDTotalAnalysisTime'];this[_0x614c('0x2b')]=_0x287a44[_0x614c('0x2b')];this[_0x614c('0x2c')]=_0x287a44[_0x614c('0x2c')];this[_0x614c('0x2d')]=_0x287a44[_0x614c('0x2d')];this[_0x614c('0x2e')]=_0x287a44[_0x614c('0x2e')];this[_0x614c('0x2f')]=_0x287a44[_0x614c('0x2f')];}module[_0x614c('0x30')]=Campaign; \ No newline at end of file +var _0x02f1=['ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated'];(function(_0x174ffe,_0x4de73b){var _0x40c57e=function(_0x5b8741){while(--_0x5b8741){_0x174ffe['push'](_0x174ffe['shift']());}};_0x40c57e(++_0x4de73b);}(_0x02f1,0x11c));var _0x102f=function(_0x2d032d,_0x3a7a67){_0x2d032d=_0x2d032d-0x0;var _0x1624e7=_0x02f1[_0x2d032d];return _0x1624e7;};'use strict';function Campaign(_0x1ef6ec){this['id']=_0x1ef6ec['id']||0x0;this[_0x102f('0x0')]=_0x1ef6ec['name']||'';this['type']=_0x1ef6ec[_0x102f('0x1')]||_0x102f('0x2');this[_0x102f('0x3')]=0x0;this['temp']=0x0;this[_0x102f('0x4')]=0x0;this[_0x102f('0x5')]=0x0;this['message']='';this[_0x102f('0x6')]=!![];this['active']=_0x1ef6ec[_0x102f('0x7')];this[_0x102f('0x8')]=_0x1ef6ec[_0x102f('0x8')];this['dialTimezone']=_0x1ef6ec[_0x102f('0x9')]||null;this[_0x102f('0xa')]=_0x1ef6ec[_0x102f('0xa')]?_0x1ef6ec[_0x102f('0xa')]:null;this[_0x102f('0xb')]=_0x1ef6ec[_0x102f('0xb')];this[_0x102f('0xc')]=_0x1ef6ec[_0x102f('0xc')];this[_0x102f('0xd')]=_0x1ef6ec[_0x102f('0xd')]||0x1e;this[_0x102f('0xe')]=_0x1ef6ec[_0x102f('0xe')];this[_0x102f('0xf')]=_0x1ef6ec['dialCongestionRetryFrequency'];this[_0x102f('0x10')]=_0x1ef6ec[_0x102f('0x10')];this[_0x102f('0x11')]=_0x1ef6ec[_0x102f('0x11')];this[_0x102f('0x12')]=_0x1ef6ec['dialNoAnswerMaxRetry'];this[_0x102f('0x13')]=_0x1ef6ec['dialNoAnswerRetryFrequency'];this[_0x102f('0x14')]=_0x1ef6ec[_0x102f('0x14')];this['dialNoSuchNumberMaxRetry']=_0x1ef6ec['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1ef6ec[_0x102f('0x15')]||0x96;this[_0x102f('0x16')]=_0x1ef6ec[_0x102f('0x16')]||0x3;this[_0x102f('0x17')]=_0x1ef6ec['dialDropRetryFrequency']||0x96;this[_0x102f('0x18')]=_0x1ef6ec[_0x102f('0x18')]||0x3;this[_0x102f('0x19')]=_0x1ef6ec[_0x102f('0x19')]||0x96;this[_0x102f('0x1a')]=_0x1ef6ec[_0x102f('0x1a')]||0x3;this[_0x102f('0x1b')]=_0x1ef6ec[_0x102f('0x1b')]||0x96;this[_0x102f('0x1c')]=_0x1ef6ec[_0x102f('0x1c')]||0x3;this[_0x102f('0x1d')]=_0x1ef6ec[_0x102f('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x1ef6ec[_0x102f('0x1e')]||_0x102f('0x1f');this['dialPrefix']=_0x1ef6ec[_0x102f('0x20')]||undefined;this[_0x102f('0x21')]=_0x1ef6ec[_0x102f('0x21')]||undefined;this[_0x102f('0x22')]=_0x1ef6ec[_0x102f('0x22')]||undefined;this[_0x102f('0x23')]=_0x1ef6ec[_0x102f('0x23')]?_0x1ef6ec[_0x102f('0x23')]:undefined;this['Trunk']=_0x1ef6ec[_0x102f('0x24')]?_0x1ef6ec[_0x102f('0x24')]:undefined;this['Interval']=_0x1ef6ec[_0x102f('0x25')]?_0x1ef6ec[_0x102f('0x25')]:undefined;this[_0x102f('0x26')]=_0x1ef6ec['SquareProject']?_0x1ef6ec[_0x102f('0x26')]:undefined;this[_0x102f('0x27')]=_0x1ef6ec['SquareProject']?_0x1ef6ec[_0x102f('0x26')]['name']:undefined;this['dialAMDActive']=_0x1ef6ec['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x1ef6ec[_0x102f('0x28')];this[_0x102f('0x29')]=_0x1ef6ec[_0x102f('0x29')];this[_0x102f('0x2a')]=_0x1ef6ec[_0x102f('0x2a')];this[_0x102f('0x2b')]=_0x1ef6ec['dialAMDTotalAnalysisTime'];this[_0x102f('0x2c')]=_0x1ef6ec[_0x102f('0x2c')];this['dialAMDBetweenWordsSilence']=_0x1ef6ec['dialAMDBetweenWordsSilence'];this[_0x102f('0x2d')]=_0x1ef6ec[_0x102f('0x2d')];this[_0x102f('0x2e')]=_0x1ef6ec['dialAMDSilenceThreshold'];this[_0x102f('0x2f')]=_0x1ef6ec[_0x102f('0x2f')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2e7435e..96a02ca 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 _0xfdad=['monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinename','accountcode','context','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition'];(function(_0x5a1f2d,_0x517736){var _0x3727fd=function(_0x3e7393){while(--_0x3e7393){_0x5a1f2d['push'](_0x5a1f2d['shift']());}};_0x3727fd(++_0x517736);}(_0xfdad,0x164));var _0xdfda=function(_0x157990,_0x26a166){_0x157990=_0x157990-0x0;var _0x2e9b8f=_0xfdad[_0x157990];return _0x2e9b8f;};'use strict';function Channel(){this[_0xdfda('0x0')]=null;this[_0xdfda('0x1')]='';this['destinationchannel']='';this[_0xdfda('0x2')]=0x0;this[_0xdfda('0x3')]='';this['connectedlinenum']=undefined;this[_0xdfda('0x4')]=undefined;this[_0xdfda('0x5')]=0x0;this[_0xdfda('0x6')]='';this['uniqueid']=0x0;this[_0xdfda('0x7')]=0x0;this[_0xdfda('0x8')]=0x0;this['answered']=![];this[_0xdfda('0x9')]=null;this[_0xdfda('0xa')]=null;this[_0xdfda('0xb')]=![];this[_0xdfda('0xc')]=![];this[_0xdfda('0xd')]='';this[_0xdfda('0xe')]='';this[_0xdfda('0xf')]=0x0;this[_0xdfda('0x10')]=0x0;this[_0xdfda('0x11')]=0x0;this[_0xdfda('0x12')]=null;this[_0xdfda('0x13')]=null;this[_0xdfda('0x14')]=null;this[_0xdfda('0x15')]=![];this[_0xdfda('0x16')]=null;this[_0xdfda('0x17')]=null;this[_0xdfda('0x18')]=[];this['transfercalleridnum']=undefined;this[_0xdfda('0x19')]=undefined;this[_0xdfda('0x1a')]=undefined;this[_0xdfda('0x1b')]=0x0;}module[_0xdfda('0x1c')]=Channel; \ No newline at end of file +var _0x1681=['answertime','endtime','abandoned','lastdata','duration','holdtime','type','disposition','monitor','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','linkedid','exten'];(function(_0x381954,_0x323506){var _0x34ebec=function(_0xc5753a){while(--_0xc5753a){_0x381954['push'](_0x381954['shift']());}};_0x34ebec(++_0x323506);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x1168('0x0')]='';this[_0x1168('0x1')]=0x0;this[_0x1168('0x2')]='';this[_0x1168('0x3')]=undefined;this[_0x1168('0x4')]=undefined;this[_0x1168('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x1168('0x6')]=0x0;this[_0x1168('0x7')]=0x0;this['answered']=![];this[_0x1168('0x8')]=null;this[_0x1168('0x9')]=null;this['unmanaged']=![];this[_0x1168('0xa')]=![];this['lastapplication']='';this[_0x1168('0xb')]='';this[_0x1168('0xc')]=0x0;this['billableseconds']=0x0;this[_0x1168('0xd')]=0x0;this[_0x1168('0xe')]=null;this['tag']=null;this[_0x1168('0xf')]=null;this[_0x1168('0x10')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x1168('0x11')]=[];this[_0x1168('0x12')]=undefined;this[_0x1168('0x13')]=undefined;this[_0x1168('0x14')]=undefined;this[_0x1168('0x15')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 31d3d0e..c994bc5 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 _0x9a34=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0x9a34,0x170));var _0x49a3=function(_0x458dab,_0x2ce6a3){_0x458dab=_0x458dab-0x0;var _0x32f667=_0x9a34[_0x458dab];return _0x32f667;};'use strict';function DeskAccount(_0xbff1de){this['id']=_0xbff1de['id']||0x0;this[_0x49a3('0x0')]=_0xbff1de['name']||'';this[_0x49a3('0x1')]=_0xbff1de['username']||'';this['remoteUri']=_0xbff1de[_0x49a3('0x2')]||'';this[_0x49a3('0x3')]=_0xbff1de[_0x49a3('0x3')]||'';this['password']=_0xbff1de[_0x49a3('0x4')]||'';this[_0x49a3('0x5')]=_0xbff1de['consumerKey']||'';this[_0x49a3('0x6')]=_0xbff1de[_0x49a3('0x6')]||'';this[_0x49a3('0x7')]=_0xbff1de[_0x49a3('0x7')]||'';this[_0x49a3('0x8')]=_0xbff1de[_0x49a3('0x8')]||'';this[_0x49a3('0x9')]=_0xbff1de[_0x49a3('0x9')]||'';this[_0x49a3('0xa')]=_0xbff1de[_0x49a3('0xa')]||'';this[_0x49a3('0xb')]=_0xbff1de['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x644c=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','exports'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x644c,0x150));var _0xc644=function(_0x38c1f6,_0x1a38c8){_0x38c1f6=_0x38c1f6-0x0;var _0x2e5044=_0x644c[_0x38c1f6];return _0x2e5044;};'use strict';function DeskAccount(_0x2d7e6e){this['id']=_0x2d7e6e['id']||0x0;this[_0xc644('0x0')]=_0x2d7e6e[_0xc644('0x0')]||'';this[_0xc644('0x1')]=_0x2d7e6e['username']||'';this['remoteUri']=_0x2d7e6e[_0xc644('0x2')]||'';this[_0xc644('0x3')]=_0x2d7e6e[_0xc644('0x3')]||'';this[_0xc644('0x4')]=_0x2d7e6e[_0xc644('0x4')]||'';this['consumerKey']=_0x2d7e6e[_0xc644('0x5')]||'';this[_0xc644('0x6')]=_0x2d7e6e[_0xc644('0x6')]||'';this[_0xc644('0x7')]=_0x2d7e6e['token']||'';this['tokenSecret']=_0x2d7e6e[_0xc644('0x8')]||'';this[_0xc644('0x9')]=_0x2d7e6e[_0xc644('0x9')]||'';this['serverUrl']=_0x2d7e6e['serverUrl']||'';this['Configurations']=_0x2d7e6e[_0xc644('0xa')]||{};}module[_0xc644('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index bcbb4a2..a2d937a 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 _0x13f6=['clientId','clientSecret','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x3f4646,_0x138869){var _0x4a2dee=function(_0x38db12){while(--_0x38db12){_0x3f4646['push'](_0x3f4646['shift']());}};_0x4a2dee(++_0x138869);}(_0x13f6,0x124));var _0x613f=function(_0x2e039c,_0x18ffcd){_0x2e039c=_0x2e039c-0x0;var _0x20a04d=_0x13f6[_0x2e039c];return _0x20a04d;};'use strict';function Dynamics365Account(_0xf31e04){this['id']=_0xf31e04['id']||0x0;this[_0x613f('0x0')]=_0xf31e04['name']||'';this['username']=_0xf31e04[_0x613f('0x1')]||'';this[_0x613f('0x2')]=_0xf31e04[_0x613f('0x2')]||'';this['remoteUri']=_0xf31e04[_0x613f('0x3')]||'';this[_0x613f('0x4')]=_0xf31e04[_0x613f('0x4')]||'';this['clientId']=_0xf31e04[_0x613f('0x5')]||'';this[_0x613f('0x6')]=_0xf31e04['clientSecret']||{};this['serverUrl']=_0xf31e04['serverUrl']||'';this['Configurations']=_0xf31e04[_0x613f('0x7')]||{};}module[_0x613f('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x2750=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x53bbdb,_0x3dc0ac){var _0x38ab88=function(_0x4faecd){while(--_0x4faecd){_0x53bbdb['push'](_0x53bbdb['shift']());}};_0x38ab88(++_0x3dc0ac);}(_0x2750,0x13b));var _0x0275=function(_0x4503ab,_0x47dd8e){_0x4503ab=_0x4503ab-0x0;var _0x1cd5db=_0x2750[_0x4503ab];return _0x1cd5db;};'use strict';function Dynamics365Account(_0x1c9f4d){this['id']=_0x1c9f4d['id']||0x0;this['name']=_0x1c9f4d[_0x0275('0x0')]||'';this[_0x0275('0x1')]=_0x1c9f4d[_0x0275('0x1')]||'';this[_0x0275('0x2')]=_0x1c9f4d[_0x0275('0x2')]||'';this[_0x0275('0x3')]=_0x1c9f4d[_0x0275('0x3')]||'';this[_0x0275('0x4')]=_0x1c9f4d[_0x0275('0x4')]||'';this[_0x0275('0x5')]=_0x1c9f4d['clientId']||'';this[_0x0275('0x6')]=_0x1c9f4d[_0x0275('0x6')]||{};this[_0x0275('0x7')]=_0x1c9f4d[_0x0275('0x7')]||'';this['Configurations']=_0x1c9f4d[_0x0275('0x8')]||{};}module[_0x0275('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 212f288..16834c4 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 _0xb598=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description'];(function(_0x23119a,_0x213ff4){var _0x2a8b7e=function(_0x2333c3){while(--_0x2333c3){_0x23119a['push'](_0x23119a['shift']());}};_0x2a8b7e(++_0x213ff4);}(_0xb598,0x10e));var _0x8b59=function(_0x168c4c,_0x1e4ce0){_0x168c4c=_0x168c4c-0x0;var _0x4d993b=_0xb598[_0x168c4c];return _0x4d993b;};'use strict';function FaxAccount(_0x154268){this['id']=_0x154268['id']||0x0;this['name']=_0x154268[_0x8b59('0x0')]||'';this[_0x8b59('0x1')]=_0x154268[_0x8b59('0x1')];this['ecm']=_0x154268[_0x8b59('0x2')];this[_0x8b59('0x3')]=_0x154268[_0x8b59('0x3')];this[_0x8b59('0x4')]=_0x154268[_0x8b59('0x4')];this[_0x8b59('0x5')]=_0x154268['minrate']||0x960;this[_0x8b59('0x6')]=_0x154268[_0x8b59('0x6')]||0x3840;this[_0x8b59('0x7')]=_0x154268[_0x8b59('0x7')]||_0x8b59('0x8');this['gateway']=_0x154268[_0x8b59('0x9')]||'no';this[_0x8b59('0xa')]=_0x154268[_0x8b59('0xa')]||'no';this[_0x8b59('0xb')]=_0x154268[_0x8b59('0xb')]||0x1388;this['tech']=_0x154268[_0x8b59('0xc')]||_0x8b59('0xd');this['Trunk']=_0x154268[_0x8b59('0xe')]?_0x154268[_0x8b59('0xe')]:undefined;this[_0x8b59('0xf')]=_0x154268[_0x8b59('0xf')];this['key']=_0x154268[_0x8b59('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x5068=['ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description'];(function(_0x3641b7,_0x2d0761){var _0x25f65a=function(_0xa6014d){while(--_0xa6014d){_0x3641b7['push'](_0x3641b7['shift']());}};_0x25f65a(++_0x2d0761);}(_0x5068,0x166));var _0x8506=function(_0x2cfbb1,_0x3a2394){_0x2cfbb1=_0x2cfbb1-0x0;var _0x5deb98=_0x5068[_0x2cfbb1];return _0x5deb98;};'use strict';function FaxAccount(_0x31e96a){this['id']=_0x31e96a['id']||0x0;this[_0x8506('0x0')]=_0x31e96a['name']||'';this[_0x8506('0x1')]=_0x31e96a[_0x8506('0x1')];this[_0x8506('0x2')]=_0x31e96a[_0x8506('0x2')];this[_0x8506('0x3')]=_0x31e96a[_0x8506('0x3')];this['localstationid']=_0x31e96a[_0x8506('0x4')];this[_0x8506('0x5')]=_0x31e96a['minrate']||0x960;this[_0x8506('0x6')]=_0x31e96a[_0x8506('0x6')]||0x3840;this['modem']=_0x31e96a[_0x8506('0x7')]||'v17,v27,v29';this[_0x8506('0x8')]=_0x31e96a[_0x8506('0x8')]||'no';this['faxdetect']=_0x31e96a[_0x8506('0x9')]||'no';this[_0x8506('0xa')]=_0x31e96a[_0x8506('0xa')]||0x1388;this[_0x8506('0xb')]=_0x31e96a[_0x8506('0xb')]||'SIP';this['Trunk']=_0x31e96a[_0x8506('0xc')]?_0x31e96a['Trunk']:undefined;this[_0x8506('0xd')]=_0x31e96a[_0x8506('0xd')];this[_0x8506('0xe')]=_0x31e96a['key'];}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 1ee5662..ff47fd5 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 _0xf771=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x48fe73,_0x16c5e0){var _0x99296a=function(_0x468909){while(--_0x468909){_0x48fe73['push'](_0x48fe73['shift']());}};_0x99296a(++_0x16c5e0);}(_0xf771,0x136));var _0x1f77=function(_0x394e5e,_0x215ea8){_0x394e5e=_0x394e5e-0x0;var _0x2015e4=_0xf771[_0x394e5e];return _0x2015e4;};'use strict';function FreshdeskAccount(_0x428035){this['id']=_0x428035['id']||0x0;this['name']=_0x428035[_0x1f77('0x0')]||'';this[_0x1f77('0x1')]=_0x428035[_0x1f77('0x1')]||'';this[_0x1f77('0x2')]=_0x428035[_0x1f77('0x3')]||'';this['remoteUri']=_0x428035[_0x1f77('0x4')]||'';this[_0x1f77('0x5')]=_0x428035[_0x1f77('0x5')]||'';this[_0x1f77('0x6')]=_0x428035[_0x1f77('0x6')]||{};}module[_0x1f77('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x70d3=['serverUrl','Configurations','exports','name','token','remoteUri'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x70d3,0x15f));var _0x370d=function(_0xba85b9,_0x5a8226){_0xba85b9=_0xba85b9-0x0;var _0xcecfa9=_0x70d3[_0xba85b9];return _0xcecfa9;};'use strict';function FreshdeskAccount(_0x229011){this['id']=_0x229011['id']||0x0;this[_0x370d('0x0')]=_0x229011[_0x370d('0x0')]||'';this['username']=_0x229011['username']||'';this['apiKey']=_0x229011[_0x370d('0x1')]||'';this['remoteUri']=_0x229011[_0x370d('0x2')]||'';this['serverUrl']=_0x229011[_0x370d('0x3')]||'';this[_0x370d('0x4')]=_0x229011[_0x370d('0x4')]||{};}module[_0x370d('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 1cb861e..c133b56 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 _0x0b3d=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2967b4,_0x9b5a9b){var _0x483322=function(_0x4652d0){while(--_0x4652d0){_0x2967b4['push'](_0x2967b4['shift']());}};_0x483322(++_0x9b5a9b);}(_0x0b3d,0x76));var _0xd0b3=function(_0x28089e,_0x530f8a){_0x28089e=_0x28089e-0x0;var _0x46a73c=_0x0b3d[_0x28089e];return _0x46a73c;};'use strict';function FreshsalesAccount(_0x28447f){this['id']=_0x28447f['id']||0x0;this['name']=_0x28447f[_0xd0b3('0x0')]||'';this['username']=_0x28447f[_0xd0b3('0x1')]||'';this['apiKey']=_0x28447f[_0xd0b3('0x2')]||'';this['remoteUri']=_0x28447f[_0xd0b3('0x3')]||'';this['serverUrl']=_0x28447f[_0xd0b3('0x4')]||'';this[_0xd0b3('0x5')]=_0x28447f['Configurations']||{};}module[_0xd0b3('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xa0a1=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x43c978,_0x7d069e){var _0x19f759=function(_0x5a539d){while(--_0x5a539d){_0x43c978['push'](_0x43c978['shift']());}};_0x19f759(++_0x7d069e);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x3edad8,_0x1beeee){_0x3edad8=_0x3edad8-0x0;var _0x5e4cee=_0xa0a1[_0x3edad8];return _0x5e4cee;};'use strict';function FreshsalesAccount(_0x5721e4){this['id']=_0x5721e4['id']||0x0;this['name']=_0x5721e4[_0x1a0a('0x0')]||'';this[_0x1a0a('0x1')]=_0x5721e4[_0x1a0a('0x1')]||'';this['apiKey']=_0x5721e4['token']||'';this[_0x1a0a('0x2')]=_0x5721e4[_0x1a0a('0x2')]||'';this['serverUrl']=_0x5721e4[_0x1a0a('0x3')]||'';this[_0x1a0a('0x4')]=_0x5721e4['Configurations']||{};}module[_0x1a0a('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index af486bc..ce6fa7f 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 _0x77fd=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','type','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt'];(function(_0x27a400,_0x38201f){var _0x225aae=function(_0x29ee32){while(--_0x29ee32){_0x27a400['push'](_0x27a400['shift']());}};_0x225aae(++_0x38201f);}(_0x77fd,0xde));var _0xd77f=function(_0x35c12c,_0x378ba0){_0x35c12c=_0x35c12c-0x0;var _0x2bab3a=_0x77fd[_0x35c12c];return _0x2bab3a;};'use strict';function QueueReport(){this[_0xd77f('0x0')]='inbound';this[_0xd77f('0x1')]='';this[_0xd77f('0x2')]='';this['calleridname']='';this[_0xd77f('0x3')]='';this[_0xd77f('0x4')]=null;this[_0xd77f('0x5')]=null;this[_0xd77f('0x6')]=0x1;this[_0xd77f('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xd77f('0x8')]=null;this['queuecallercomplete']=![];this[_0xd77f('0x9')]=null;this[_0xd77f('0xa')]=![];this[_0xd77f('0xb')]=null;this[_0xd77f('0xc')]=0x1;this[_0xd77f('0xd')]='';this['connectedlinenum']='';this[_0xd77f('0xe')]='';this['accountcode']='';this[_0xd77f('0xf')]='';this[_0xd77f('0x10')]='';this[_0xd77f('0x11')]='';this[_0xd77f('0x12')]=0x0;this[_0xd77f('0x13')]=![];this[_0xd77f('0x14')]='';this['mohtime']=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x7bfd=['queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','assigned','mohtime','variables','exports','type','inbound','uniqueid','queue','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt'];(function(_0x1d8627,_0x517694){var _0x56705f=function(_0x13b03d){while(--_0x13b03d){_0x1d8627['push'](_0x1d8627['shift']());}};_0x56705f(++_0x517694);}(_0x7bfd,0x138));var _0xd7bf=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7bfd[_0x57b54c];return _0x59cc19;};'use strict';function QueueReport(){this[_0xd7bf('0x0')]=_0xd7bf('0x1');this[_0xd7bf('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0xd7bf('0x3')]='';this['queuecallerjoinAt']=null;this[_0xd7bf('0x4')]=null;this['position']=0x1;this['count']=0x1;this[_0xd7bf('0x5')]=![];this[_0xd7bf('0x6')]=null;this['queuecallercomplete']=![];this[_0xd7bf('0x7')]=null;this[_0xd7bf('0x8')]=![];this[_0xd7bf('0x9')]=null;this[_0xd7bf('0xa')]=0x1;this[_0xd7bf('0xb')]='';this[_0xd7bf('0xc')]='';this[_0xd7bf('0xd')]='';this[_0xd7bf('0xe')]='';this[_0xd7bf('0xf')]='';this['exten']='';this['priority']='';this['holdtime']=0x0;this[_0xd7bf('0x10')]=![];this['lastAssignedTo']='';this[_0xd7bf('0x11')]=0x0;this[_0xd7bf('0x12')]={};}module[_0xd7bf('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c9e7c45..3bd9287 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 _0xa32b=['type','integrationTab','serverUrl','Configurations','name','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa32b,0x68));var _0xba32=function(_0x35b2a1,_0x4cdca8){_0x35b2a1=_0x35b2a1-0x0;var _0x6023da=_0xa32b[_0x35b2a1];return _0x6023da;};'use strict';function SalesforceAccount(_0x1e497c){this['id']=_0x1e497c['id']||0x0;this['name']=_0x1e497c[_0xba32('0x0')]||'';this['username']=_0x1e497c['username']||'';this[_0xba32('0x1')]=_0x1e497c[_0xba32('0x1')]||'';this[_0xba32('0x2')]=_0x1e497c['password']||'';this[_0xba32('0x3')]=_0x1e497c[_0xba32('0x3')]||'';this[_0xba32('0x4')]=_0x1e497c[_0xba32('0x4')]||'';this[_0xba32('0x5')]=_0x1e497c['securityToken']||'';this[_0xba32('0x6')]=_0x1e497c['type']||_0xba32('0x7');this[_0xba32('0x8')]=_0x1e497c[_0xba32('0x8')]||'';this[_0xba32('0x9')]=_0x1e497c['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xbc2c=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x4ca27e,_0x351cc7){var _0xdac4c1=function(_0x117ca0){while(--_0x117ca0){_0x4ca27e['push'](_0x4ca27e['shift']());}};_0xdac4c1(++_0x351cc7);}(_0xbc2c,0x123));var _0xcbc2=function(_0x9ca21f,_0x437553){_0x9ca21f=_0x9ca21f-0x0;var _0x9ef54b=_0xbc2c[_0x9ca21f];return _0x9ef54b;};'use strict';function SalesforceAccount(_0x1e7097){this['id']=_0x1e7097['id']||0x0;this[_0xcbc2('0x0')]=_0x1e7097[_0xcbc2('0x0')]||'';this[_0xcbc2('0x1')]=_0x1e7097['username']||'';this['remoteUri']=_0x1e7097[_0xcbc2('0x2')]||'';this[_0xcbc2('0x3')]=_0x1e7097[_0xcbc2('0x3')]||'';this[_0xcbc2('0x4')]=_0x1e7097[_0xcbc2('0x4')]||'';this[_0xcbc2('0x5')]=_0x1e7097['clientSecret']||'';this['securityToken']=_0x1e7097[_0xcbc2('0x6')]||'';this[_0xcbc2('0x7')]=_0x1e7097[_0xcbc2('0x7')]||_0xcbc2('0x8');this['serverUrl']=_0x1e7097[_0xcbc2('0x9')]||'';this[_0xcbc2('0xa')]=_0x1e7097[_0xcbc2('0xa')]||{};}module[_0xcbc2('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 55b5932..a9100c0 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 _0x4e46=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x509098,_0x14bf6e){var _0x5cce46=function(_0x281a94){while(--_0x281a94){_0x509098['push'](_0x509098['shift']());}};_0x5cce46(++_0x14bf6e);}(_0x4e46,0xef));var _0x64e4=function(_0x3e5c74,_0x415e5f){_0x3e5c74=_0x3e5c74-0x0;var _0x42d2f9=_0x4e46[_0x3e5c74];return _0x42d2f9;};'use strict';function ServicenowAccount(_0x5c8ce3){this['id']=_0x5c8ce3['id']||0x0;this[_0x64e4('0x0')]=_0x5c8ce3[_0x64e4('0x0')]||'';this[_0x64e4('0x1')]=_0x5c8ce3[_0x64e4('0x1')]||'';this[_0x64e4('0x2')]=_0x5c8ce3['password']||'';this[_0x64e4('0x3')]=_0x5c8ce3[_0x64e4('0x3')]||'';this[_0x64e4('0x4')]=_0x5c8ce3['serverUrl']||'';this[_0x64e4('0x5')]=_0x5c8ce3[_0x64e4('0x5')]||{};}module[_0x64e4('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xecf3=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x567d48,_0x4a6798){var _0x7af946=function(_0x249f14){while(--_0x249f14){_0x567d48['push'](_0x567d48['shift']());}};_0x7af946(++_0x4a6798);}(_0xecf3,0x14b));var _0x3ecf=function(_0x30c3dd,_0x1801fd){_0x30c3dd=_0x30c3dd-0x0;var _0x1a09ec=_0xecf3[_0x30c3dd];return _0x1a09ec;};'use strict';function ServicenowAccount(_0x41b180){this['id']=_0x41b180['id']||0x0;this[_0x3ecf('0x0')]=_0x41b180[_0x3ecf('0x0')]||'';this[_0x3ecf('0x1')]=_0x41b180[_0x3ecf('0x1')]||'';this[_0x3ecf('0x2')]=_0x41b180[_0x3ecf('0x2')]||'';this[_0x3ecf('0x3')]=_0x41b180[_0x3ecf('0x3')]||'';this[_0x3ecf('0x4')]=_0x41b180[_0x3ecf('0x4')]||'';this[_0x3ecf('0x5')]=_0x41b180['Configurations']||{};}module[_0x3ecf('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fa7fc12..dd9940b 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 _0xf166=['Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf166,0x16a));var _0x6f16=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf166[_0x3b380d];return _0x54502b;};'use strict';function SugarcrmAccount(_0x5af423){this['id']=_0x5af423['id']||0x0;this[_0x6f16('0x0')]=_0x5af423['name']||'';this[_0x6f16('0x1')]=_0x5af423[_0x6f16('0x1')]||'';this[_0x6f16('0x2')]=_0x5af423['password']||'';this['remoteUri']=_0x5af423['remoteUri']||'';this['serverUrl']=_0x5af423['serverUrl']||'';this[_0x6f16('0x3')]=_0x5af423[_0x6f16('0x3')]||{};}module[_0x6f16('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0xc61d=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x38da42,_0x53fedb){var _0x58ea79=function(_0x174ccc){while(--_0x174ccc){_0x38da42['push'](_0x38da42['shift']());}};_0x58ea79(++_0x53fedb);}(_0xc61d,0x19a));var _0xdc61=function(_0x235a26,_0x19b391){_0x235a26=_0x235a26-0x0;var _0x2de83c=_0xc61d[_0x235a26];return _0x2de83c;};'use strict';function SugarcrmAccount(_0x58d463){this['id']=_0x58d463['id']||0x0;this['name']=_0x58d463[_0xdc61('0x0')]||'';this['username']=_0x58d463[_0xdc61('0x1')]||'';this['password']=_0x58d463[_0xdc61('0x2')]||'';this[_0xdc61('0x3')]=_0x58d463[_0xdc61('0x3')]||'';this[_0xdc61('0x4')]=_0x58d463[_0xdc61('0x4')]||'';this[_0xdc61('0x5')]=_0x58d463['Configurations']||{};}module[_0xdc61('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 c436a6e..4124ffc 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 _0xdb46=['state','unknown','status','exports','accountcode'];(function(_0x4c5635,_0x42cd0b){var _0x4e6b76=function(_0x118536){while(--_0x118536){_0x4c5635['push'](_0x4c5635['shift']());}};_0x4e6b76(++_0x42cd0b);}(_0xdb46,0x158));var _0x6db4=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xdb46[_0xd0b415];return _0x2bdf2c;};'use strict';function Telephone(_0x5b595d){this['id']=_0x5b595d['id']||0x0;this['name']=_0x5b595d['name']||'';this[_0x6db4('0x0')]=_0x5b595d[_0x6db4('0x0')]||'';this[_0x6db4('0x1')]=_0x6db4('0x2');this['stateTime']=0x0;this[_0x6db4('0x3')]=_0x6db4('0x2');this['address']='';}module[_0x6db4('0x4')]=Telephone; \ No newline at end of file +var _0x3c60=['address','exports','name','accountcode','status'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3c60,0x14c));var _0x03c6=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x3c60[_0x15bc81];return _0x59440e;};'use strict';function Telephone(_0x596e01){this['id']=_0x596e01['id']||0x0;this[_0x03c6('0x0')]=_0x596e01[_0x03c6('0x0')]||'';this[_0x03c6('0x1')]=_0x596e01[_0x03c6('0x1')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0x03c6('0x2')]='unknown';this[_0x03c6('0x3')]='';}module[_0x03c6('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 8e52233..7c7ed05 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(_0x7a76b1,_0xa683){var _0x138216=function(_0x598912){while(--_0x598912){_0x7a76b1['push'](_0x7a76b1['shift']());}};_0x138216(++_0xa683);}(_0xb10b,0x12a));var _0xbb10=function(_0x28e7e1,_0x45f235){_0x28e7e1=_0x28e7e1-0x0;var _0x1d8a9e=_0xb10b[_0x28e7e1];return _0x1d8a9e;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x4b6b3d,_0x28cead){var _0x49791b=function(_0x1f7afe){while(--_0x1f7afe){_0x4b6b3d['push'](_0x4b6b3d['shift']());}};_0x49791b(++_0x28cead);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 4d7ae7a..8cce7f6 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x4d936f,_0x2f9843){var _0x277fdc=function(_0x209829){while(--_0x209829){_0x4d936f['push'](_0x4d936f['shift']());}};_0x277fdc(++_0x2f9843);}(_0x757a,0xde));var _0xa757=function(_0x321238,_0x51685d){_0x321238=_0x321238-0x0;var _0x315d30=_0x757a[_0x321238];return _0x315d30;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x2b64c7,_0x169ef4){var _0x591633=function(_0x3c5723){while(--_0x3c5723){_0x2b64c7['push'](_0x2b64c7['shift']());}};_0x591633(++_0x169ef4);}(_0x8603,0x190));var _0x3860=function(_0x1654cd,_0x47919c){_0x1654cd=_0x1654cd-0x0;var _0x40668e=_0x8603[_0x1654cd];return _0x40668e;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index bb7b478..2020999 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 _0xd8e5=['active','name','state','unknown','status','registry','indexOf','split','host','port','domainport','refresh','registrationtime','address','defaultuser','exports'];(function(_0x458074,_0x51fcdf){var _0x4d425b=function(_0x2b0d72){while(--_0x2b0d72){_0x458074['push'](_0x458074['shift']());}};_0x4d425b(++_0x51fcdf);}(_0xd8e5,0x170));var _0x5d8e=function(_0x331f1b,_0x403195){_0x331f1b=_0x331f1b-0x0;var _0x14f250=_0xd8e5[_0x331f1b];return _0x14f250;};'use strict';function Trunk(_0x35df63){this['id']=_0x35df63['id']||0x0;this['active']=_0x35df63[_0x5d8e('0x0')]||![];this['name']=_0x35df63[_0x5d8e('0x1')]||'';this[_0x5d8e('0x2')]=_0x5d8e('0x3');this['stateTime']=0x0;this[_0x5d8e('0x4')]='unknown';this[_0x5d8e('0x5')]=_0x35df63[_0x5d8e('0x5')]&&_0x35df63[_0x5d8e('0x5')][_0x5d8e('0x6')](':')?_0x35df63['registry'][_0x5d8e('0x7')](':')[0x0]:'';this[_0x5d8e('0x8')]='';this[_0x5d8e('0x9')]='';this['domain']='';this[_0x5d8e('0xa')]='';this[_0x5d8e('0xb')]='';this['stateRegistry']=_0x5d8e('0x3');this[_0x5d8e('0xc')]='';this[_0x5d8e('0xd')]='';this[_0x5d8e('0xe')]=_0x35df63[_0x5d8e('0xe')]||'';}module[_0x5d8e('0xf')]=Trunk; \ No newline at end of file +var _0xc10b=['name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','active'];(function(_0x3f2ddb,_0x7bf076){var _0x2c5165=function(_0x8bd583){while(--_0x8bd583){_0x3f2ddb['push'](_0x3f2ddb['shift']());}};_0x2c5165(++_0x7bf076);}(_0xc10b,0x153));var _0xbc10=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xc10b[_0x7e2eb0];return _0xd92de4;};'use strict';function Trunk(_0x15627e){this['id']=_0x15627e['id']||0x0;this[_0xbc10('0x0')]=_0x15627e[_0xbc10('0x0')]||![];this[_0xbc10('0x1')]=_0x15627e[_0xbc10('0x1')]||'';this[_0xbc10('0x2')]=_0xbc10('0x3');this[_0xbc10('0x4')]=0x0;this[_0xbc10('0x5')]='unknown';this['registry']=_0x15627e[_0xbc10('0x6')]&&_0x15627e[_0xbc10('0x6')][_0xbc10('0x7')](':')?_0x15627e[_0xbc10('0x6')][_0xbc10('0x8')](':')[0x0]:'';this[_0xbc10('0x9')]='';this[_0xbc10('0xa')]='';this[_0xbc10('0xb')]='';this[_0xbc10('0xc')]='';this[_0xbc10('0xd')]='';this[_0xbc10('0xe')]=_0xbc10('0x3');this[_0xbc10('0xf')]='';this[_0xbc10('0x10')]='';this['defaultuser']=_0x15627e['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4615cf2..1fa79cc 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 _0xee65=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0xee65,0x1b8));var _0x5ee6=function(_0x1a96e9,_0x1ecc5a){_0x1a96e9=_0x1a96e9-0x0;var _0xd19e2f=_0xee65[_0x1a96e9];return _0xd19e2f;};'use strict';function voiceExtension(_0x44a6fb){this['id']=_0x44a6fb['id']||0x0;this[_0x5ee6('0x0')]=_0x44a6fb['exten']||'';this[_0x5ee6('0x1')]=_0x44a6fb[_0x5ee6('0x1')]||'none';this['mandatoryDisposition']=_0x44a6fb[_0x5ee6('0x2')]||![];}module[_0x5ee6('0x3')]=voiceExtension; \ No newline at end of file +var _0xa6b8=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x279687,_0x29586f){var _0x24f20c=function(_0x135fa1){while(--_0x135fa1){_0x279687['push'](_0x279687['shift']());}};_0x24f20c(++_0x29586f);}(_0xa6b8,0x1bd));var _0x8a6b=function(_0x16e0a6,_0x18e7f6){_0x16e0a6=_0x16e0a6-0x0;var _0x5e15cf=_0xa6b8[_0x16e0a6];return _0x5e15cf;};'use strict';function voiceExtension(_0x8c792d){this['id']=_0x8c792d['id']||0x0;this[_0x8a6b('0x0')]=_0x8c792d[_0x8a6b('0x0')]||'';this[_0x8a6b('0x1')]=_0x8c792d[_0x8a6b('0x1')]||'none';this['mandatoryDisposition']=_0x8c792d[_0x8a6b('0x2')]||![];}module[_0x8a6b('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 6367249..4fafa3e 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 _0x010e=['outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','ringing','ringinuse','onhold','wav','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay'];(function(_0x20c0c7,_0x27db24){var _0x50e044=function(_0x3ec6b4){while(--_0x3ec6b4){_0x20c0c7['push'](_0x20c0c7['shift']());}};_0x50e044(++_0x27db24);}(_0x010e,0x103));var _0xe010=function(_0x3c893c,_0x3f6afe){_0x3c893c=_0x3c893c-0x0;var _0x430b9f=_0x010e[_0x3c893c];return _0x430b9f;};'use strict';var statusDesc=[_0xe010('0x0'),_0xe010('0x1'),'inuse',_0xe010('0x2'),_0xe010('0x3'),'unavailable',_0xe010('0x4'),_0xe010('0x5'),_0xe010('0x6')];var monitorFormat={'wav':_0xe010('0x7'),'wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':_0xe010('0x8')};function VoiceQueue(_0x41a17b){this['id']=_0x41a17b['id']||0x0;this[_0xe010('0x9')]=_0x41a17b[_0xe010('0x9')]||'';this[_0xe010('0xa')]=_0x41a17b[_0xe010('0xa')]||'';this[_0xe010('0xb')]=_0x41a17b[_0xe010('0xb')]||_0xe010('0xc');this[_0xe010('0xd')]=0x0;this[_0xe010('0xe')]=0x0;this[_0xe010('0xf')]=0x0;this[_0xe010('0x10')]=0x0;this[_0xe010('0x11')]=0x0;this[_0xe010('0x12')]=0x0;this['sumBillable']=0x0;this[_0xe010('0x13')]=0x0;this[_0xe010('0x14')]=0x0;this['loggedIn']=0x0;this[_0xe010('0x15')]=0x0;this[_0xe010('0x16')]=_0x41a17b[_0xe010('0x16')]||![];this['acwTimeout']=_0x41a17b[_0xe010('0x17')]||0xa;this[_0xe010('0x18')]=_0x41a17b[_0xe010('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0xe010('0x19')]='';this['originated']=0x0;this[_0xe010('0x1a')]=0x0;this[_0xe010('0x1b')]=_0x41a17b[_0xe010('0x1b')]||null;this['dialGlobalInterval']=_0x41a17b[_0xe010('0x1c')]?_0x41a17b[_0xe010('0x1c')]:null;this[_0xe010('0x1d')]=_0x41a17b['dialActive'];this[_0xe010('0x1e')]=_0x41a17b[_0xe010('0x1e')]||_0xe010('0x1f');this[_0xe010('0x20')]=_0x41a17b['dialLimitChannel']||0x0;this[_0xe010('0x21')]=_0x41a17b[_0xe010('0x21')]||0x0;this[_0xe010('0x22')]=_0x41a17b[_0xe010('0x22')]||0x1;this[_0xe010('0x23')]=_0x41a17b[_0xe010('0x23')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x41a17b[_0xe010('0x24')]||0.03;this['dialPredictiveInterval']=_0x41a17b[_0xe010('0x25')]||0x258;this[_0xe010('0x26')]=_0x41a17b[_0xe010('0x26')]||_0xe010('0x27');this['dialOriginateCallerIdNumber']=_0x41a17b['dialOriginateCallerIdNumber']||'anonymous';this['dialOriginateTimeout']=_0x41a17b[_0xe010('0x28')]||0x1e;this['dialQueueOptions']=_0x41a17b[_0xe010('0x29')]||_0xe010('0x2a');this[_0xe010('0x2b')]=_0x41a17b[_0xe010('0x2b')]||0x3;this[_0xe010('0x2c')]=_0x41a17b[_0xe010('0x2c')]||undefined;this[_0xe010('0x2d')]=_0x41a17b[_0xe010('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x41a17b['dialCongestionRetryFrequency']||0x96;this[_0xe010('0x2e')]=_0x41a17b['dialBusyMaxRetry']||0x3;this[_0xe010('0x2f')]=_0x41a17b[_0xe010('0x2f')]||0x96;this[_0xe010('0x30')]=_0x41a17b[_0xe010('0x30')]||0x3;this[_0xe010('0x31')]=_0x41a17b[_0xe010('0x31')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x41a17b[_0xe010('0x32')]||0x3;this[_0xe010('0x33')]=_0x41a17b[_0xe010('0x33')]||0x96;this[_0xe010('0x34')]=_0x41a17b[_0xe010('0x34')]||0x3;this[_0xe010('0x35')]=_0x41a17b[_0xe010('0x35')]||0x96;this[_0xe010('0x36')]=_0x41a17b[_0xe010('0x36')]||0x3;this[_0xe010('0x37')]=_0x41a17b[_0xe010('0x37')]||0x96;this['dialMachineMaxRetry']=_0x41a17b['dialMachineMaxRetry']||0x3;this[_0xe010('0x38')]=_0x41a17b['dialMachineRetryFrequency']||0x96;this[_0xe010('0x39')]=_0x41a17b[_0xe010('0x39')]||0x3;this[_0xe010('0x3a')]=_0x41a17b['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x41a17b[_0xe010('0x3b')]||0x4;this[_0xe010('0x3c')]=_0x41a17b[_0xe010('0x3c')]?_0x41a17b[_0xe010('0x3c')]:undefined;this['TrunkBackup']=_0x41a17b[_0xe010('0x3d')]?_0x41a17b[_0xe010('0x3d')]:undefined;this[_0xe010('0x3e')]=_0x41a17b[_0xe010('0x3e')]||undefined;this['Interval']=_0x41a17b[_0xe010('0x3f')]?_0x41a17b['Interval']:undefined;this['dialOrderByScheduledAt']=_0x41a17b[_0xe010('0x40')]||'DESC';this[_0xe010('0x41')]=_0x41a17b[_0xe010('0x41')]||undefined;this[_0xe010('0x42')]=_0x41a17b[_0xe010('0x42')]||undefined;this[_0xe010('0x43')]=strategy[_0x41a17b[_0xe010('0x43')]]||'rrmemory';this[_0xe010('0x44')]=!![];this[_0xe010('0x45')]=_0x41a17b['dialAMDActive']||![];this[_0xe010('0x46')]=_0x41a17b[_0xe010('0x46')];this[_0xe010('0x47')]=_0x41a17b['dialAMDGreeting'];this[_0xe010('0x48')]=_0x41a17b[_0xe010('0x48')];this[_0xe010('0x49')]=_0x41a17b['dialAMDTotalAnalysisTime'];this[_0xe010('0x4a')]=_0x41a17b['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x41a17b[_0xe010('0x4b')];this[_0xe010('0x4c')]=_0x41a17b[_0xe010('0x4c')];this['dialAMDSilenceThreshold']=_0x41a17b['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x41a17b[_0xe010('0x4d')];this[_0xe010('0x4e')]=0x0;this['pTalking']=0x0;this[_0xe010('0x4f')]=_0x41a17b['timeout'];this[_0xe010('0x50')]=0x0;this[_0xe010('0x51')]=0x0;this[_0xe010('0x52')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xe010('0x53')]=0x0;this[_0xe010('0x54')]=0x0;this[_0xe010('0x55')]=0x0;this[_0xe010('0x56')]=0x0;this[_0xe010('0x57')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xe010('0x58')]=0x0;this['outboundReCallsDay']=0x0;this[_0xe010('0x59')]=0x0;this[_0xe010('0x5a')]=undefined;this[_0xe010('0x5b')]=undefined;this[_0xe010('0x5c')]=undefined;this[_0xe010('0x5d')]=1.05;this[_0xe010('0x5e')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xe010('0x5f')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xe010('0x60')]=0x0;this[_0xe010('0x61')]=0x0;this[_0xe010('0x62')]=0x0;this[_0xe010('0x63')]=0x0;this[_0xe010('0x64')]=_0x41a17b[_0xe010('0x65')]||0x14;this[_0xe010('0x66')]=_0x41a17b[_0xe010('0x65')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xe010('0x67')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xe010('0x68')]=0x0;this['erlangCallToSecond']=0x0;this[_0xe010('0x69')]=0x0;this[_0xe010('0x6a')]=0x0;this[_0xe010('0x6b')]=_0x41a17b['dialRecallMeTimeout']||0x1e;this[_0xe010('0x6c')]=_0x41a17b[_0xe010('0x6c')]||![];this['dialQueueProject2']=_0x41a17b[_0xe010('0x6d')]||undefined;this[_0xe010('0x6e')]=_0x41a17b[_0xe010('0x6e')]||![];this['dialAgiAfterHangupAgent']=_0x41a17b[_0xe010('0x6f')]||![];this[_0xe010('0xa')]=monitorFormat[_0x41a17b[_0xe010('0xa')]]?monitorFormat[_0x41a17b[_0xe010('0xa')]]:undefined;this[_0xe010('0x70')]=_0x41a17b[_0xe010('0x70')]||![];this[_0xe010('0x71')]=_0x41a17b[_0xe010('0x71')]?_0x41a17b[_0xe010('0x71')]:undefined;}module[_0xe010('0x72')]=VoiceQueue; \ No newline at end of file +var _0xb856=['sendMessageOneNotActive','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','name','type','talking','total','sumDuration','sumHoldTime','sumBillable','loggedIn','acw','acwTimeout','autopause'];(function(_0x44c6ce,_0x2aff91){var _0x4da2c6=function(_0x29e84f){while(--_0x29e84f){_0x44c6ce['push'](_0x44c6ce['shift']());}};_0x4da2c6(++_0x2aff91);}(_0xb856,0xcf));var _0x6b85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb856[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=[_0x6b85('0x0'),'not_inuse',_0x6b85('0x1'),_0x6b85('0x2'),_0x6b85('0x3'),_0x6b85('0x4'),_0x6b85('0x5'),_0x6b85('0x6'),_0x6b85('0x7')];var monitorFormat={'wav':_0x6b85('0x8'),'wav49':_0x6b85('0x9'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x41bc2e){this['id']=_0x41bc2e['id']||0x0;this[_0x6b85('0xa')]=_0x41bc2e[_0x6b85('0xa')]||'';this['monitor_format']=_0x41bc2e['monitor_format']||'';this['type']=_0x41bc2e[_0x6b85('0xb')]||'inbound';this['waiting']=0x0;this[_0x6b85('0xc')]=0x0;this[_0x6b85('0xd')]=0x0;this['answered']=0x0;this[_0x6b85('0xe')]=0x0;this[_0x6b85('0xf')]=0x0;this[_0x6b85('0x10')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0x6b85('0x11')]=0x0;this['available']=0x0;this[_0x6b85('0x12')]=_0x41bc2e[_0x6b85('0x12')]||![];this[_0x6b85('0x13')]=_0x41bc2e[_0x6b85('0x13')]||0xa;this[_0x6b85('0x14')]=_0x41bc2e['autopause']||'no';this[_0x6b85('0x15')]=!![];this['message']='';this['originated']=0x0;this['temp']=0x0;this[_0x6b85('0x16')]=_0x41bc2e[_0x6b85('0x16')]||null;this['dialGlobalInterval']=_0x41bc2e[_0x6b85('0x17')]?_0x41bc2e['dialGlobalInterval']:null;this[_0x6b85('0x18')]=_0x41bc2e[_0x6b85('0x18')];this[_0x6b85('0x19')]=_0x41bc2e['dialMethod']||_0x6b85('0x1a');this[_0x6b85('0x1b')]=_0x41bc2e['dialLimitChannel']||0x0;this[_0x6b85('0x1c')]=_0x41bc2e[_0x6b85('0x1c')]||0x0;this[_0x6b85('0x1d')]=_0x41bc2e[_0x6b85('0x1d')]||0x1;this[_0x6b85('0x1e')]=_0x41bc2e[_0x6b85('0x1e')]||_0x6b85('0x1f');this['dialPredictiveOptimizationPercentage']=_0x41bc2e['dialPredictiveOptimizationPercentage']||0.03;this[_0x6b85('0x20')]=_0x41bc2e['dialPredictiveInterval']||0x258;this[_0x6b85('0x21')]=_0x41bc2e[_0x6b85('0x21')]||_0x6b85('0x22');this[_0x6b85('0x23')]=_0x41bc2e['dialOriginateCallerIdNumber']||'anonymous';this[_0x6b85('0x24')]=_0x41bc2e['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x41bc2e[_0x6b85('0x25')]||_0x6b85('0x26');this[_0x6b85('0x27')]=_0x41bc2e[_0x6b85('0x27')]||0x3;this[_0x6b85('0x28')]=_0x41bc2e[_0x6b85('0x28')]||undefined;this[_0x6b85('0x29')]=_0x41bc2e[_0x6b85('0x29')]||0x3;this[_0x6b85('0x2a')]=_0x41bc2e[_0x6b85('0x2a')]||0x96;this[_0x6b85('0x2b')]=_0x41bc2e[_0x6b85('0x2b')]||0x3;this['dialBusyRetryFrequency']=_0x41bc2e['dialBusyRetryFrequency']||0x96;this[_0x6b85('0x2c')]=_0x41bc2e[_0x6b85('0x2c')]||0x3;this[_0x6b85('0x2d')]=_0x41bc2e['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x41bc2e[_0x6b85('0x2e')]||0x3;this[_0x6b85('0x2f')]=_0x41bc2e[_0x6b85('0x2f')]||0x96;this[_0x6b85('0x30')]=_0x41bc2e['dialDropMaxRetry']||0x3;this[_0x6b85('0x31')]=_0x41bc2e[_0x6b85('0x31')]||0x96;this[_0x6b85('0x32')]=_0x41bc2e[_0x6b85('0x32')]||0x3;this[_0x6b85('0x33')]=_0x41bc2e[_0x6b85('0x33')]||0x96;this[_0x6b85('0x34')]=_0x41bc2e[_0x6b85('0x34')]||0x3;this[_0x6b85('0x35')]=_0x41bc2e[_0x6b85('0x35')]||0x96;this[_0x6b85('0x36')]=_0x41bc2e['dialAgentRejectMaxRetry']||0x3;this[_0x6b85('0x37')]=_0x41bc2e[_0x6b85('0x37')]||0x96;this[_0x6b85('0x38')]=_0x41bc2e['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x41bc2e[_0x6b85('0x39')]?_0x41bc2e[_0x6b85('0x39')]:undefined;this[_0x6b85('0x3a')]=_0x41bc2e[_0x6b85('0x3a')]?_0x41bc2e[_0x6b85('0x3a')]:undefined;this[_0x6b85('0x3b')]=_0x41bc2e['dialPrefix']||undefined;this[_0x6b85('0x3c')]=_0x41bc2e['Interval']?_0x41bc2e['Interval']:undefined;this[_0x6b85('0x3d')]=_0x41bc2e[_0x6b85('0x3d')]||_0x6b85('0x3e');this[_0x6b85('0x3f')]=_0x41bc2e['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6b85('0x40')]=_0x41bc2e[_0x6b85('0x40')]||undefined;this['strategy']=strategy[_0x41bc2e[_0x6b85('0x41')]]||'rrmemory';this[_0x6b85('0x42')]=!![];this['dialAMDActive']=_0x41bc2e['dialAMDActive']||![];this[_0x6b85('0x43')]=_0x41bc2e[_0x6b85('0x43')];this[_0x6b85('0x44')]=_0x41bc2e['dialAMDGreeting'];this[_0x6b85('0x45')]=_0x41bc2e['dialAMDAfterGreetingSilence'];this[_0x6b85('0x46')]=_0x41bc2e[_0x6b85('0x46')];this[_0x6b85('0x47')]=_0x41bc2e[_0x6b85('0x47')];this[_0x6b85('0x48')]=_0x41bc2e[_0x6b85('0x48')];this[_0x6b85('0x49')]=_0x41bc2e['dialAMDMaximumNumberOfWords'];this[_0x6b85('0x4a')]=_0x41bc2e[_0x6b85('0x4a')];this[_0x6b85('0x4b')]=_0x41bc2e[_0x6b85('0x4b')];this[_0x6b85('0x4c')]=0x0;this[_0x6b85('0x4d')]=0x0;this[_0x6b85('0x4e')]=_0x41bc2e[_0x6b85('0x4e')];this[_0x6b85('0x4f')]=0x0;this[_0x6b85('0x50')]=0x0;this[_0x6b85('0x51')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x6b85('0x52')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x6b85('0x53')]=0x0;this[_0x6b85('0x54')]=0x0;this[_0x6b85('0x55')]=0x0;this[_0x6b85('0x56')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x6b85('0x57')]=0x0;this[_0x6b85('0x58')]=0x0;this[_0x6b85('0x59')]=0x0;this[_0x6b85('0x5a')]=undefined;this[_0x6b85('0x5b')]=undefined;this[_0x6b85('0x5c')]=undefined;this[_0x6b85('0x5d')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x6b85('0x5e')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x6b85('0x5f')]=0x0;this[_0x6b85('0x60')]=0x0;this[_0x6b85('0x61')]=0x0;this[_0x6b85('0x62')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x6b85('0x63')]=_0x41bc2e[_0x6b85('0x64')]||0x14;this[_0x6b85('0x65')]=_0x41bc2e['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x6b85('0x66')]=0x0;this[_0x6b85('0x67')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x6b85('0x68')]=0x0;this['erlangCallToSecond']=0x0;this[_0x6b85('0x69')]=0x0;this['erlangBusyFactor']=0x0;this[_0x6b85('0x6a')]=_0x41bc2e[_0x6b85('0x6a')]||0x1e;this[_0x6b85('0x6b')]=_0x41bc2e[_0x6b85('0x6b')]||![];this[_0x6b85('0x6c')]=_0x41bc2e[_0x6b85('0x6c')]||undefined;this[_0x6b85('0x6d')]=_0x41bc2e['dialAgiAfterHangupClient']||![];this[_0x6b85('0x6e')]=_0x41bc2e[_0x6b85('0x6e')]||![];this[_0x6b85('0x6f')]=monitorFormat[_0x41bc2e[_0x6b85('0x6f')]]?monitorFormat[_0x41bc2e['monitor_format']]:undefined;this['mandatoryDisposition']=_0x41bc2e['mandatoryDisposition']||![];this[_0x6b85('0x70')]=_0x41bc2e[_0x6b85('0x70')]?_0x41bc2e[_0x6b85('0x70')]:undefined;}module[_0x6b85('0x71')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 12d1255..e734bf1 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 _0x61fd=['serverUrl','exports','name','accessKey','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61fd,0x106));var _0xd61f=function(_0x4779e3,_0x5b853d){_0x4779e3=_0x4779e3-0x0;var _0x2af11e=_0x61fd[_0x4779e3];return _0x2af11e;};'use strict';function VtigerAccount(_0x41acdd){this['id']=_0x41acdd['id']||0x0;this[_0xd61f('0x0')]=_0x41acdd[_0xd61f('0x0')]||'';this['username']=_0x41acdd['username']||'';this[_0xd61f('0x1')]=_0x41acdd['accessKey']||'';this['remoteUri']=_0x41acdd[_0xd61f('0x2')]||'';this[_0xd61f('0x3')]=_0x41acdd[_0xd61f('0x3')]||'';this['Configurations']=_0x41acdd['Configurations']||{};}module[_0xd61f('0x4')]=VtigerAccount; \ No newline at end of file +var _0xb08c=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x2dca5c,_0x2cca55){var _0x1f2533=function(_0x484a52){while(--_0x484a52){_0x2dca5c['push'](_0x2dca5c['shift']());}};_0x1f2533(++_0x2cca55);}(_0xb08c,0x181));var _0xcb08=function(_0x57b2a0,_0x2d6698){_0x57b2a0=_0x57b2a0-0x0;var _0x69b68b=_0xb08c[_0x57b2a0];return _0x69b68b;};'use strict';function VtigerAccount(_0x527ad6){this['id']=_0x527ad6['id']||0x0;this[_0xcb08('0x0')]=_0x527ad6[_0xcb08('0x0')]||'';this[_0xcb08('0x1')]=_0x527ad6[_0xcb08('0x1')]||'';this['accessKey']=_0x527ad6[_0xcb08('0x2')]||'';this[_0xcb08('0x3')]=_0x527ad6[_0xcb08('0x3')]||'';this[_0xcb08('0x4')]=_0x527ad6[_0xcb08('0x4')]||'';this[_0xcb08('0x5')]=_0x527ad6[_0xcb08('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 2f8debc..f41b009 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 _0x8efe=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','exports'];(function(_0x476bba,_0x48ffaa){var _0xbbf9b9=function(_0x2ff53b){while(--_0x2ff53b){_0x476bba['push'](_0x476bba['shift']());}};_0xbbf9b9(++_0x48ffaa);}(_0x8efe,0x1b8));var _0xe8ef=function(_0x4e96dc,_0x3ec523){_0x4e96dc=_0x4e96dc-0x0;var _0x29bc29=_0x8efe[_0x4e96dc];return _0x29bc29;};'use strict';function ZendeskAccount(_0x3cfc85){this['id']=_0x3cfc85['id']||0x0;this[_0xe8ef('0x0')]=_0x3cfc85[_0xe8ef('0x0')]||'';this[_0xe8ef('0x1')]=_0x3cfc85[_0xe8ef('0x1')]||'';this['password']=_0x3cfc85[_0xe8ef('0x2')]||'';this[_0xe8ef('0x3')]=_0x3cfc85[_0xe8ef('0x3')]||'';this[_0xe8ef('0x4')]=_0x3cfc85[_0xe8ef('0x4')]||'';this[_0xe8ef('0x5')]=_0x3cfc85['authType']||'';this[_0xe8ef('0x6')]=_0x3cfc85[_0xe8ef('0x6')]||_0xe8ef('0x7');this['serverUrl']=_0x3cfc85[_0xe8ef('0x8')]||'';this['Configurations']=_0x3cfc85['Configurations']||{};}module[_0xe8ef('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xf480=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x166394,_0x206959){var _0x8b4360=function(_0x539e86){while(--_0x539e86){_0x166394['push'](_0x166394['shift']());}};_0x8b4360(++_0x206959);}(_0xf480,0x99));var _0x0f48=function(_0x329152,_0x5a5a37){_0x329152=_0x329152-0x0;var _0x2f4f27=_0xf480[_0x329152];return _0x2f4f27;};'use strict';function ZendeskAccount(_0x473e1d){this['id']=_0x473e1d['id']||0x0;this[_0x0f48('0x0')]=_0x473e1d[_0x0f48('0x0')]||'';this[_0x0f48('0x1')]=_0x473e1d[_0x0f48('0x1')]||'';this[_0x0f48('0x2')]=_0x473e1d[_0x0f48('0x2')]||'';this[_0x0f48('0x3')]=_0x473e1d[_0x0f48('0x3')]||'';this['remoteUri']=_0x473e1d[_0x0f48('0x4')]||'';this[_0x0f48('0x5')]=_0x473e1d[_0x0f48('0x5')]||'';this[_0x0f48('0x6')]=_0x473e1d[_0x0f48('0x6')]||'integrationTab';this['serverUrl']=_0x473e1d[_0x0f48('0x7')]||'';this[_0x0f48('0x8')]=_0x473e1d['Configurations']||{};}module[_0x0f48('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 4c8f2d7..8946b86 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 _0xe982=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x5d3fa6,_0x2afcd6){var _0x20389c=function(_0x4d1e14){while(--_0x4d1e14){_0x5d3fa6['push'](_0x5d3fa6['shift']());}};_0x20389c(++_0x2afcd6);}(_0xe982,0x10e));var _0x2e98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe982[_0x122ef9];return _0x42fba0;};'use strict';function ZohoAccount(_0x2a5eb3){this['id']=_0x2a5eb3['id']||0x0;this['name']=_0x2a5eb3[_0x2e98('0x0')]||'';this[_0x2e98('0x1')]=_0x2a5eb3['description']||'';this[_0x2e98('0x2')]=_0x2a5eb3[_0x2e98('0x2')]||'';this[_0x2e98('0x3')]=_0x2a5eb3[_0x2e98('0x3')]||'';this[_0x2e98('0x4')]=_0x2a5eb3[_0x2e98('0x4')]||'';this[_0x2e98('0x5')]=_0x2a5eb3[_0x2e98('0x5')]||'';this['serverUrl']=_0x2a5eb3[_0x2e98('0x6')]||'';this[_0x2e98('0x7')]=_0x2a5eb3['code']||'';this[_0x2e98('0x8')]=_0x2a5eb3[_0x2e98('0x8')]||'';this[_0x2e98('0x9')]=_0x2a5eb3['Configurations']||{};}module[_0x2e98('0xa')]=ZohoAccount; \ No newline at end of file +var _0xeeac=['Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xeeac,0x169));var _0xceea=function(_0x5b7963,_0x10bff5){_0x5b7963=_0x5b7963-0x0;var _0x57f611=_0xeeac[_0x5b7963];return _0x57f611;};'use strict';function ZohoAccount(_0x27cd52){this['id']=_0x27cd52['id']||0x0;this[_0xceea('0x0')]=_0x27cd52['name']||'';this[_0xceea('0x1')]=_0x27cd52[_0xceea('0x1')]||'';this['host']=_0x27cd52[_0xceea('0x2')]||'';this[_0xceea('0x3')]=_0x27cd52[_0xceea('0x3')]||'';this[_0xceea('0x4')]=_0x27cd52['clientId']||'';this[_0xceea('0x5')]=_0x27cd52[_0xceea('0x5')]||'';this[_0xceea('0x6')]=_0x27cd52[_0xceea('0x6')]||'';this[_0xceea('0x7')]=_0x27cd52[_0xceea('0x7')]||'';this[_0xceea('0x8')]=_0x27cd52[_0xceea('0x8')]||'';this[_0xceea('0x9')]=_0x27cd52[_0xceea('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 5ed0b04..3c9a332 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 _0x9cf8=['calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','recallme','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','queue','name','type','campaigntype','dialAnswer','Agent','membername','format','SIP/%s','phone','Contact','firstName','active'];(function(_0x4d1055,_0x3be1fd){var _0x56a5bd=function(_0x2068e2){while(--_0x2068e2){_0x4d1055['push'](_0x4d1055['shift']());}};_0x56a5bd(++_0x3be1fd);}(_0x9cf8,0x92));var _0x89cf=function(_0x267108,_0x189566){_0x267108=_0x267108-0x0;var _0xb1139=_0x9cf8[_0x267108];return _0xb1139;};'use strict';var util=require(_0x89cf('0x0'));var _=require(_0x89cf('0x1'));var moment=require(_0x89cf('0x2'));function checkNameSurname(_0x299f55,_0x22835f,_0x13f70a){var _0x8fd2e1='';if(!_[_0x89cf('0x3')](_0x22835f)&&'string'===typeof _0x22835f){_0x8fd2e1+=_0x22835f;}if(!_['isNil'](_0x13f70a)&&_0x89cf('0x4')===typeof _0x13f70a){_0x8fd2e1+='\x20'+_0x13f70a;}if(_0x8fd2e1!==''){return _0x8fd2e1;}return _0x299f55;}function Action(_0x2a2533,_0x5e11d3,_0x59df97,_0x281dc6,_0x45f7ba){this['uniqueid']=_0x59df97||undefined;this['idContact']=_0x2a2533['id'];this[_0x89cf('0x5')]=_0x5e11d3[_0x89cf('0x6')];this[_0x89cf('0x7')]=_0x5e11d3[_0x89cf('0x7')];this[_0x89cf('0x8')]=_0x89cf('0x5');this[_0x89cf('0x9')]=![];this['membername']=_[_0x89cf('0x3')](_0x2a2533[_0x89cf('0xa')])?undefined:_0x2a2533[_0x89cf('0xa')][_0x89cf('0x6')];this['channelAgent']=this[_0x89cf('0xb')]?util[_0x89cf('0xc')](_0x89cf('0xd'),this[_0x89cf('0xb')]):_0x281dc6||undefined;this['calleridname']=checkNameSurname(_0x2a2533['Contact'][_0x89cf('0xe')],_0x2a2533[_0x89cf('0xf')][_0x89cf('0x10')],_0x2a2533[_0x89cf('0xf')]['lastName']);this[_0x89cf('0x11')]=_0x2a2533['active']||![];this[_0x89cf('0x12')]=_0x2a2533[_0x89cf('0xf')][_0x89cf('0xe')];this[_0x89cf('0x13')]=_0x2a2533[_0x89cf('0x13')];this[_0x89cf('0x14')]=_0x2a2533[_0x89cf('0x14')]||0x0;this['countcongestionretry']=_0x2a2533[_0x89cf('0x15')]||0x0;this[_0x89cf('0x16')]=_0x2a2533[_0x89cf('0x16')]||0x0;this[_0x89cf('0x17')]=(_0x2a2533[_0x89cf('0x14')]||0x0)+(_0x2a2533[_0x89cf('0x15')]||0x0)+(_0x2a2533['countnoanswerretry']||0x0)+(_0x2a2533[_0x89cf('0x18')]||0x0)+(_0x2a2533['countdropretry']||0x0)+(_0x2a2533[_0x89cf('0x19')]||0x0)+(_0x2a2533['countmachineretry']||0x0)+(_0x2a2533[_0x89cf('0x1a')]||0x0);this[_0x89cf('0x18')]=_0x2a2533[_0x89cf('0x18')]||0x0;this[_0x89cf('0x1b')]=_0x2a2533['countdropretry']||0x0;this[_0x89cf('0x19')]=_0x2a2533[_0x89cf('0x19')]||0x0;this[_0x89cf('0x1c')]=_0x2a2533[_0x89cf('0x1c')]||0x0;this[_0x89cf('0x1a')]=_0x2a2533['countagentrejectretry']||0x0;this[_0x89cf('0x1d')]=_0x2a2533[_0x89cf('0x1d')];this[_0x89cf('0x1e')]=_0x2a2533['callbackuniqueid'];this['callbackat']=_0x2a2533['callbackat'];this[_0x89cf('0x1f')]=_0x2a2533['recallme'];this['ContactId']=_0x2a2533['ContactId'];this[_0x89cf('0x20')]=_0x2a2533[_0x89cf('0x20')];this['UserId']=_['isNil'](_0x2a2533['Agent'])?_0x2a2533['UserId']:_0x2a2533['Agent']['id'];this[_0x89cf('0x21')]=_0x2a2533[_0x89cf('0x21')];this[_0x89cf('0x22')]='';this[_0x89cf('0x23')]='';}Action[_0x89cf('0x24')]['getCaller']=function(){return util[_0x89cf('0xc')](_0x89cf('0x25'),this[_0x89cf('0x26')],this[_0x89cf('0x27')]);};module[_0x89cf('0x28')]=Action; \ No newline at end of file +var _0x7ea0=['membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','scheduledat','countbusyretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','ContactId','ListId','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','isNil','string','uniqueid','queue','name','type','campaigntype'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7ea0,0xfa));var _0x07ea=function(_0x4979dc,_0x57e0d3){_0x4979dc=_0x4979dc-0x0;var _0xe6f25d=_0x7ea0[_0x4979dc];return _0xe6f25d;};'use strict';var util=require(_0x07ea('0x0'));var _=require(_0x07ea('0x1'));var moment=require('moment');function checkNameSurname(_0x1bf2b2,_0x3bd60b,_0x362c7b){var _0x3ed999='';if(!_[_0x07ea('0x2')](_0x3bd60b)&&_0x07ea('0x3')===typeof _0x3bd60b){_0x3ed999+=_0x3bd60b;}if(!_[_0x07ea('0x2')](_0x362c7b)&&_0x07ea('0x3')===typeof _0x362c7b){_0x3ed999+='\x20'+_0x362c7b;}if(_0x3ed999!==''){return _0x3ed999;}return _0x1bf2b2;}function Action(_0x385f42,_0x3a6106,_0x32c751,_0x5e24a5,_0x179bdd){this[_0x07ea('0x4')]=_0x32c751||undefined;this['idContact']=_0x385f42['id'];this[_0x07ea('0x5')]=_0x3a6106[_0x07ea('0x6')];this[_0x07ea('0x7')]=_0x3a6106[_0x07ea('0x7')];this[_0x07ea('0x8')]=_0x07ea('0x5');this['dialAnswer']=![];this[_0x07ea('0x9')]=_[_0x07ea('0x2')](_0x385f42['Agent'])?undefined:_0x385f42[_0x07ea('0xa')][_0x07ea('0x6')];this[_0x07ea('0xb')]=this['membername']?util[_0x07ea('0xc')](_0x07ea('0xd'),this[_0x07ea('0x9')]):_0x5e24a5||undefined;this[_0x07ea('0xe')]=checkNameSurname(_0x385f42[_0x07ea('0xf')][_0x07ea('0x10')],_0x385f42[_0x07ea('0xf')]['firstName'],_0x385f42['Contact'][_0x07ea('0x11')]);this[_0x07ea('0x12')]=_0x385f42[_0x07ea('0x12')]||![];this['calleridnum']=_0x385f42[_0x07ea('0xf')]['phone'];this[_0x07ea('0x13')]=_0x385f42[_0x07ea('0x13')];this[_0x07ea('0x14')]=_0x385f42['countbusyretry']||0x0;this['countcongestionretry']=_0x385f42['countcongestionretry']||0x0;this['countnoanswerretry']=_0x385f42['countnoanswerretry']||0x0;this[_0x07ea('0x15')]=(_0x385f42[_0x07ea('0x14')]||0x0)+(_0x385f42['countcongestionretry']||0x0)+(_0x385f42[_0x07ea('0x16')]||0x0)+(_0x385f42[_0x07ea('0x17')]||0x0)+(_0x385f42['countdropretry']||0x0)+(_0x385f42[_0x07ea('0x18')]||0x0)+(_0x385f42['countmachineretry']||0x0)+(_0x385f42[_0x07ea('0x19')]||0x0);this[_0x07ea('0x17')]=_0x385f42[_0x07ea('0x17')]||0x0;this[_0x07ea('0x1a')]=_0x385f42[_0x07ea('0x1a')]||0x0;this['countabandonedretry']=_0x385f42[_0x07ea('0x18')]||0x0;this[_0x07ea('0x1b')]=_0x385f42['countmachineretry']||0x0;this[_0x07ea('0x19')]=_0x385f42[_0x07ea('0x19')]||0x0;this['callback']=_0x385f42[_0x07ea('0x1c')];this[_0x07ea('0x1d')]=_0x385f42[_0x07ea('0x1d')];this['callbackat']=_0x385f42[_0x07ea('0x1e')];this['recallme']=_0x385f42['recallme'];this[_0x07ea('0x1f')]=_0x385f42['ContactId'];this[_0x07ea('0x20')]=_0x385f42['ListId'];this['UserId']=_[_0x07ea('0x2')](_0x385f42['Agent'])?_0x385f42['UserId']:_0x385f42[_0x07ea('0xa')]['id'];this['VoiceQueueId']=_0x385f42['VoiceQueueId'];this['originatecalleridnum']='';this[_0x07ea('0x21')]='';}Action['prototype'][_0x07ea('0x22')]=function(){return util[_0x07ea('0xc')](_0x07ea('0x23'),this[_0x07ea('0xe')],this[_0x07ea('0x24')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 126a4e9..7b152c5 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 _0x28ac=['NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','trim','dialCutDigit','substring','SIP/%s/%s%s','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridNumber','addVariables','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/logger','actionPreview','../ami','./action','./util/util','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','answered','available','pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','dialActive','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','booked','clockClearZombieChannels','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','info','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','cloneAction','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','isUndefined','object'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x28ac,0x1b9));var _0xc28a=function(_0x457194,_0x362137){_0x457194=_0x457194-0x0;var _0x34b79e=_0x28ac[_0x457194];return _0x34b79e;};'use strict';var util=require(_0xc28a('0x0'));var _=require(_0xc28a('0x1'));var BPromise=require(_0xc28a('0x2'));var uuid=require(_0xc28a('0x3'));var moment=require('moment');var md5=require(_0xc28a('0x4'));var Redis=require(_0xc28a('0x5'));var config=require('../../../config/environment');var logger=require(_0xc28a('0x6'))('preview');var loggerAction=require(_0xc28a('0x6'))(_0xc28a('0x7'));var ami=require(_0xc28a('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0xc28a('0x9'));var ut=require(_0xc28a('0xa'));config[_0xc28a('0xb')]=_[_0xc28a('0xc')](config[_0xc28a('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xc28a('0xd'))(new Redis(config[_0xc28a('0xb')]));var Sequence=function(){};Sequence[_0xc28a('0xe')][_0xc28a('0xf')]=function(_0x4a23c8){this['tail']=this[_0xc28a('0x10')]?this['tail'][_0xc28a('0x11')](_0x4a23c8):_0x4a23c8();};function Preview(_0x367c27){this[_0xc28a('0x12')]=new Sequence();this[_0xc28a('0x13')]=_0x367c27[_0xc28a('0x14')];this[_0xc28a('0x15')]=_0x367c27[_0xc28a('0x15')];this[_0xc28a('0x16')]={};this[_0xc28a('0x17')]=_0x367c27[_0xc28a('0x17')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0xc28a('0x18')][_0xc28a('0x19')](this));ami['on'](_0xc28a('0x1a'),this['syncHangup'][_0xc28a('0x19')](this));ami['on'](_0xc28a('0x1b'),this[_0xc28a('0x1c')][_0xc28a('0x19')](this));ami['on'](_0xc28a('0x1d'),this['syncDialEnd'][_0xc28a('0x19')](this));ami['on'](_0xc28a('0x1e'),this[_0xc28a('0x1f')][_0xc28a('0x19')](this));ami['on'](_0xc28a('0x20'),this[_0xc28a('0x21')][_0xc28a('0x19')](this));ami['on'](_0xc28a('0x22'),this[_0xc28a('0x23')][_0xc28a('0x19')](this));ami['on']('blindtransfer',this[_0xc28a('0x24')][_0xc28a('0x19')](this));this[_0xc28a('0x25')](this[_0xc28a('0x13')]);}function emit(_0x10563b,_0x234463,_0x385238){io['to'](_0x10563b)[_0xc28a('0x26')](_0x234463,_0x385238);}function emitCampaignPreview(_0x5c7f67){if(_0x5c7f67[_0xc28a('0x27')]===_0xc28a('0x28')){var _0x39ae22={'id':_0x5c7f67['id'],'name':_0x5c7f67[_0xc28a('0x29')],'strategy':_0x5c7f67['strategy'],'answered':_0x5c7f67[_0xc28a('0x2a')],'available':_0x5c7f67[_0xc28a('0x2b')],'loggedIn':_0x5c7f67['loggedIn'],'pTalking':_0x5c7f67[_0xc28a('0x2c')],'sumBillable':_0x5c7f67[_0xc28a('0x2d')],'sumDuration':_0x5c7f67[_0xc28a('0x2e')],'sumHoldTime':_0x5c7f67['sumHoldTime']||0x0,'talking':_0x5c7f67[_0xc28a('0x2f')],'total':_0x5c7f67[_0xc28a('0x30')],'type':_0x5c7f67['type'],'unmanaged':_0x5c7f67[_0xc28a('0x31')],'abandoned':_0x5c7f67[_0xc28a('0x32')],'waiting':_0x5c7f67[_0xc28a('0x33')],'loggedInDb':_0x5c7f67['loggedInDb'],'dialActive':_0x5c7f67[_0xc28a('0x34')],'dialMethod':_0x5c7f67['dialMethod'],'dialOriginateCallerIdName':_0x5c7f67['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5c7f67['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5c7f67[_0xc28a('0x35')],'dialPrefix':_0x5c7f67[_0xc28a('0x36')],'outboundAnswerAgiCallsDay':_0x5c7f67[_0xc28a('0x37')],'outboundAnswerCallsDay':_0x5c7f67[_0xc28a('0x38')],'outboundBlacklistCallsDay':_0x5c7f67[_0xc28a('0x39')],'outboundBusyCallsDay':_0x5c7f67[_0xc28a('0x3a')],'outboundCongestionCallsDay':_0x5c7f67[_0xc28a('0x3b')],'outboundDropCallsDayACS':_0x5c7f67[_0xc28a('0x3c')],'outboundDropCallsDayCallersExit':_0x5c7f67[_0xc28a('0x3d')],'outboundDropCallsDayTimeout':_0x5c7f67['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5c7f67[_0xc28a('0x3e')],'outboundNoSuchCallsDay':_0x5c7f67[_0xc28a('0x3f')],'outboundOriginateFailureCallsDay':_0x5c7f67[_0xc28a('0x40')],'outboundReCallsDay':_0x5c7f67['outboundReCallsDay'],'outboundRejectCallsDay':_0x5c7f67[_0xc28a('0x41')],'outboundUnknownCallsDay':_0x5c7f67['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x5c7f67[_0xc28a('0x42')],'predictiveIntervalAnsweredCalls':_0x5c7f67[_0xc28a('0x43')],'predictiveIntervalAvgHoldtime':_0x5c7f67[_0xc28a('0x44')],'predictiveIntervalAvgTalktime':_0x5c7f67[_0xc28a('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x5c7f67[_0xc28a('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x5c7f67['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5c7f67[_0xc28a('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x5c7f67[_0xc28a('0x48')],'predictiveIntervalHitRate':_0x5c7f67['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x5c7f67[_0xc28a('0x49')],'predictiveIntervalPauses':_0x5c7f67['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5c7f67['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5c7f67[_0xc28a('0x4a')],'message':_0x5c7f67[_0xc28a('0x4b')],'originated':_0x5c7f67[_0xc28a('0x4c')],'erlangCalls':_0x5c7f67[_0xc28a('0x4d')],'erlangCallToSecond':_0x5c7f67['erlangCallToSecond'],'erlangAbandonmentRate':_0x5c7f67[_0xc28a('0x4e')],'erlangBusyFactor':_0x5c7f67[_0xc28a('0x4f')],'startPredictive':_0x5c7f67['startPredictive'],'startProgressive':_0x5c7f67['startProgressive']};if(_0x5c7f67[_0xc28a('0x50')]){_0x39ae22['Trunk']={'id':_0x5c7f67[_0xc28a('0x50')]['id'],'name':_0x5c7f67[_0xc28a('0x50')]['name'],'active':_0x5c7f67[_0xc28a('0x50')]['active'],'callerid':_0x5c7f67[_0xc28a('0x50')][_0xc28a('0x51')]};}if(_0x5c7f67[_0xc28a('0x52')]){_0x39ae22['Interval']={'id':_0x5c7f67[_0xc28a('0x52')]['id'],'name':_0x5c7f67[_0xc28a('0x52')][_0xc28a('0x29')]};}var _0x1ca9d6=md5(JSON[_0xc28a('0x53')](_0x39ae22));if(_0x5c7f67[_0xc28a('0x4')]!==_0x1ca9d6){_0x5c7f67[_0xc28a('0x4')]=_0x1ca9d6;emit(util[_0xc28a('0x54')](_0xc28a('0x55'),_0x39ae22[_0xc28a('0x29')]),_0xc28a('0x56'),_0x39ae22);}}}function emitVoiceQueueChannelRemove(_0x4c8b75){logger['info'](_0xc28a('0x57'),JSON[_0xc28a('0x53')](_0x4c8b75));emit(util['format'](_0xc28a('0x55'),_0x4c8b75['name']),_0xc28a('0x58'),_0x4c8b75);io[_0xc28a('0x26')](_0xc28a('0x59'),_0x4c8b75);}function notSendMessagesQueue(_0x386e93){if(_0x386e93['sendMessageOneNotActive']){if(_0x386e93['originated']===0x0&&_0x386e93[_0xc28a('0x2c')]===0x0){_0x386e93[_0xc28a('0x5a')]=![];_0x386e93[_0xc28a('0x2b')]=0x0;_0x386e93[_0xc28a('0x5b')]=0x0;_0x386e93['message']=_0xc28a('0x5c');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x386e93[_0xc28a('0x29')]+_0xc28a('0x5d'));}else{_0x386e93['message']=_0xc28a('0x5e');ut[_0xc28a('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x386e93[_0xc28a('0x29')]+_0xc28a('0x60'));}emitCampaignPreview(_0x386e93);}}Preview['prototype'][_0xc28a('0x25')]=function(){var _0x3f35a5=this;setInterval(function(){_0x3f35a5['syncCampaigns']();},0x7cf);};Preview[_0xc28a('0xe')][_0xc28a('0x61')]=function(){var _0xd1f6a1=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x127329 in _0xd1f6a1){if(_0xd1f6a1[_0xc28a('0x62')](_0x127329)&&(_0xd1f6a1[_0x127329][_0xc28a('0x63')]==='preview'||_0xd1f6a1[_0x127329][_0xc28a('0x63')]===_0xc28a('0x64'))&&_0xd1f6a1[_0x127329][_0xc28a('0x27')]===_0xc28a('0x28')){if(this['clockClearZombieChannels']>0x7){this[_0xc28a('0x65')]=0x0;this[_0xc28a('0x66')]();}}if(_0xd1f6a1[_0xc28a('0x62')](_0x127329)&&_0xd1f6a1[_0x127329][_0xc28a('0x63')]==='preview'&&_0xd1f6a1[_0x127329][_0xc28a('0x27')]==='outbound'){if(_0xd1f6a1[_0x127329][_0xc28a('0x34')]){this[_0xc28a('0x67')](_0xd1f6a1[_0x127329]);this[_0xc28a('0x68')](_0xd1f6a1[_0x127329]);}else{notSendMessagesQueue(_0xd1f6a1[_0x127329]);}}}};Preview['prototype'][_0xc28a('0x69')]=function(_0x14c12c){var _0x57140f=this;this[_0xc28a('0x12')][_0xc28a('0xf')](function(){if(!_[_0xc28a('0x6a')](_0x57140f[_0xc28a('0x16')][_0x14c12c])){loggerAction[_0xc28a('0x6b')]('[clearZombieChannels][talking]',_0x14c12c,_0xc28a('0x6c'),_0x57140f['actions'][_0x14c12c][_0xc28a('0x6d')],_0xc28a('0x6e'),JSON[_0xc28a('0x53')](_0x57140f[_0xc28a('0x13')][_0x57140f['actions'][_0x14c12c][_0xc28a('0x6d')]][_0xc28a('0x4c')]),_0xc28a('0x6f'),JSON[_0xc28a('0x53')](_0x57140f['campaignsPreview'][_0x57140f[_0xc28a('0x16')][_0x14c12c]['queue']]['pTalking']),JSON['stringify'](_0x57140f[_0xc28a('0x16')][_0x14c12c]['dialAnswer']),JSON[_0xc28a('0x53')](_[_0xc28a('0x70')](_0x57140f['actions'][_0x14c12c],[_0xc28a('0x71'),'UserId',_0xc28a('0x72'),_0xc28a('0x73')])));return ami[_0xc28a('0x74')]({'action':_0xc28a('0x75'),'channel':_0x57140f['actions'][_0x14c12c][_0xc28a('0x76')]})['catch'](function(_0x3f1d10){if(_0x3f1d10[_0xc28a('0x4b')]===_0xc28a('0x77')){setTimeout(function(){if(_0x57140f[_0xc28a('0x16')][_0x14c12c]){ut[_0xc28a('0x78')](_0x57140f[_0xc28a('0x13')][_0x57140f[_0xc28a('0x16')][_0x14c12c][_0xc28a('0x6d')]],_0xc28a('0x79'));if(_0x57140f['actions'][_0x14c12c][_0xc28a('0x7a')]===!![]){ut[_0xc28a('0x7b')](_0x57140f[_0xc28a('0x13')][_0x57140f[_0xc28a('0x16')][_0x14c12c][_0xc28a('0x6d')]],_0xc28a('0x79'));ut[_0xc28a('0x7c')](_0xc28a('0x7d')+_0x14c12c,_0x57140f[_0xc28a('0x16')][_0x14c12c][_0xc28a('0x6d')]);}ut[_0xc28a('0x7c')](_0xc28a('0x7e')+_0x14c12c,_0x57140f['actions'][_0x14c12c][_0xc28a('0x6d')]);delete _0x57140f[_0xc28a('0x16')][_0x14c12c];}},0x2328);}});}});};Preview['prototype'][_0xc28a('0x66')]=function(){var _0x3adf9b=this;loggerAction[_0xc28a('0x6b')]('[action]',_['size'](this[_0xc28a('0x16')]));for(var _0x82a6ef in this[_0xc28a('0x16')]){if(_0x3adf9b[_0xc28a('0x16')]['hasOwnProperty'](_0x82a6ef)){_0x3adf9b[_0xc28a('0x69')](_0x82a6ef);}}};Preview[_0xc28a('0xe')]['recallMe']=function(_0x553fae){var _0x422aad=this;rpcDb[_0xc28a('0x7f')](_0x553fae['id'],ut['agentReadyId'](this['agents']))[_0xc28a('0x80')](function(_0x296910){if(!_[_0xc28a('0x6a')](_0x296910)){for(var _0x4b4561=0x0;_0x4b4561<_0x296910[_0xc28a('0x81')];_0x4b4561+=0x1){if(ut[_0xc28a('0x82')](_0x296910[_0x4b4561][_0xc28a('0x83')])<_0x553fae[_0xc28a('0x84')]*0x3c){if(_0x296910[_0x4b4561][_0xc28a('0x85')]&&!_0x296910[_0x4b4561][_0xc28a('0x85')][_0xc28a('0x86')]){_0x422aad[_0xc28a('0x87')](_0x296910[_0x4b4561]['id'])[_0xc28a('0x80')](ut[_0xc28a('0x88')](_0xc28a('0x89')))[_0xc28a('0x8a')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0xc28a('0x8b')](_0x296910[_0x4b4561]['id']);}}else{var _0x442bd0=new Action(_0x296910[_0x4b4561],_0x553fae);_0x442bd0[_0xc28a('0x8c')]=moment()[_0xc28a('0x54')](_0xc28a('0x8d'));_0x553fae[_0xc28a('0x8e')]+=0x1;ut['logCustomer'](_0x442bd0,0x17,_0xc28a('0x8f'));if(_0x553fae[_0xc28a('0x90')]){rpcDb['rescheduleContactInQueue'](ut[_0xc28a('0x91')](_0x296910[_0x4b4561]));rpcDb[_0xc28a('0x92')](_0x442bd0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xc28a('0x93')](_0x442bd0,0x16,_0xc28a('0x94'));rpcDb[_0xc28a('0x92')](_0x442bd0,_0xc28a('0x95'));rpcDb[_0xc28a('0x96')](_0x442bd0,_0xc28a('0x95'));}}}}})[_0xc28a('0x8a')](ut[_0xc28a('0x88')](_0xc28a('0x97')));};Preview[_0xc28a('0xe')][_0xc28a('0x67')]=function(_0x399c83){_0x399c83[_0xc28a('0x5a')]=!![];if(ut['IsNotLoggedIn'](_0x399c83[_0xc28a('0x98')])){_0x399c83[_0xc28a('0x4b')]=_0xc28a('0x99');}else if(!ut[_0xc28a('0x9a')](_0x399c83[_0xc28a('0x34')])){_0x399c83[_0xc28a('0x4b')]=_0xc28a('0x5c');}else if(!this[_0xc28a('0x9b')](_0x399c83[_0xc28a('0x50')])){if(!this['isTrunkReachable'](_0x399c83['TrunkBackup'])){_0x399c83['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x399c83[_0xc28a('0x4b')]=_0xc28a('0x9c');}}else{_0x399c83[_0xc28a('0x4b')]=_0xc28a('0x9c');}emitCampaignPreview(_0x399c83);};Preview[_0xc28a('0xe')][_0xc28a('0x9d')]=function(_0xee2b33,_0x3fe1bc,_0x2c3f06){var _0x36b6ca=this;var _0x224787=this[_0xc28a('0x16')][_0x3fe1bc];var _0x48a45c=this[_0xc28a('0x13')][_0x224787[_0xc28a('0x6d')]];var _0x4b74c4;if(_0x48a45c){switch(_0x2c3f06){case'1':_0x48a45c[_0xc28a('0x3f')]+=0x1;_0x224787[_0xc28a('0x9e')]+=0x1;_0x224787[_0xc28a('0x9f')]=ut[_0xc28a('0xa0')](_0x224787);ut[_0xc28a('0x93')](_0x224787,0x0,'NoSuchNumber');ami[_0xc28a('0x26')](_0xc28a('0xa1'),ut[_0xc28a('0xa2')](_0x224787,_0xc28a('0xa3')));rpcDb[_0xc28a('0x92')](_0x224787,_0xc28a('0xa4'));if(ut[_0xc28a('0xa0')](_0x224787)>=_0x48a45c[_0xc28a('0xa5')]){_0x4b74c4=ut['cloneAction'](_0x224787,0xf,'Global');rpcDb['createCustomerFinal'](_0x4b74c4,_0xc28a('0xa6'));}else{if(_0x224787['countnosuchnumberretry']>=_0x48a45c[_0xc28a('0xa7')]){rpcDb['createCustomerFinal'](_0x224787,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xc28a('0xa8')](ut['scheduledAt'](_0x224787,_0xc28a('0x9e'),_0x48a45c[_0xc28a('0xa9')]),_0x224787['unlockAgent'],_0x224787[_0xc28a('0xaa')]);}}delete this[_0xc28a('0x16')][_0xee2b33[_0xc28a('0xab')]];break;case _0xc28a('0xac'):var _0xaf43d3=moment()[_0xc28a('0x54')](_0xc28a('0x8d'));_0x224787['responsetime']=_0xaf43d3;_0x224787[_0xc28a('0xad')]=_0xaf43d3;_0x224787['dialAnswer']=!![];_0x48a45c[_0xc28a('0x2c')]+=0x1;logger[_0xc28a('0x6b')](_0xc28a('0xae'),_0x224787[_0xc28a('0xaf')],_0xc28a('0xb0'),_0x48a45c[_0xc28a('0x29')],_0xc28a('0x6f'),_0x48a45c[_0xc28a('0x2c')]);ami['emit'](_0xc28a('0xb1'),ut[_0xc28a('0xa2')](_0x224787,'connect',this['campaignsPreview'][_0x224787[_0xc28a('0x6d')]]));if(_0x48a45c['acw']){ami['emit']('custom:agentConnectPreview',ut['buildAcw'](_0x224787));}break;case'16':ami['emit'](_0xc28a('0xb2'),ut['buildObj'](_0x224787,_0xc28a('0xb3'),this['campaignsPreview'][_0x224787['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x224787,'complete'));_0x48a45c[_0xc28a('0x38')]+=0x1;_0x48a45c[_0xc28a('0x30')]+=0x1;_0x48a45c['answered']+=0x1;ut[_0xc28a('0x7b')](_0x48a45c,_0xc28a('0xb4'));_0x224787[_0xc28a('0x9f')]=ut['totalGlobal'](_0x224787);ut['logCustomer'](_0x224787,0x4,_0xc28a('0xb5'));rpcDb[_0xc28a('0x92')](_0x224787,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x224787,_0xc28a('0xb6'));rpcDb[_0xc28a('0xb7')](_0x224787);_0x48a45c['sumDuration']+=_0x224787[_0xc28a('0xb8')];_0x48a45c[_0xc28a('0x2d')]+=_0x224787[_0xc28a('0xb8')];logger[_0xc28a('0x6b')](_0xc28a('0xb9'),_0x224787['uniqueid'],_0xc28a('0xb0'),_0x48a45c['name'],_0xc28a('0x6f'),_0x48a45c[_0xc28a('0x2c')]);delete this[_0xc28a('0x16')][_0xee2b33['linkedid']];break;case'BUSY':_0x48a45c[_0xc28a('0x3a')]+=0x1;_0x224787[_0xc28a('0xba')]+=0x1;_0x224787[_0xc28a('0x9f')]=ut[_0xc28a('0xa0')](_0x224787);ut[_0xc28a('0x93')](_0x224787,0x5,_0xc28a('0xbb'));ami[_0xc28a('0x26')](_0xc28a('0xbc'),ut[_0xc28a('0xa2')](_0x224787,_0xc28a('0xbd')));rpcDb[_0xc28a('0x92')](_0x224787,_0xc28a('0xbe'));if(ut[_0xc28a('0xa0')](_0x224787)>=_0x48a45c[_0xc28a('0xa5')]){_0x4b74c4=ut['cloneAction'](_0x224787,0xf,_0xc28a('0xbf'));rpcDb['createCustomerFinal'](_0x4b74c4,_0xc28a('0xc0'));}else{if(_0x224787[_0xc28a('0xba')]>=_0x48a45c['dialBusyMaxRetry']){rpcDb[_0xc28a('0x96')](_0x224787,_0xc28a('0xbe'));}else{rpcDb[_0xc28a('0xa8')](ut[_0xc28a('0xc1')](_0x224787,'countbusyretry',_0x48a45c[_0xc28a('0xc2')]),_0x224787[_0xc28a('0xc3')],_0x224787[_0xc28a('0xaa')]);}}break;case _0xc28a('0xc4'):_0x48a45c[_0xc28a('0x3e')]+=0x1;_0x224787[_0xc28a('0xc5')]+=0x1;_0x224787['countglobal']=ut[_0xc28a('0xa0')](_0x224787);ut[_0xc28a('0x93')](_0x224787,0x3,_0xc28a('0xc6'));ami[_0xc28a('0x26')](_0xc28a('0xc7'),ut[_0xc28a('0xa2')](_0x224787,_0xc28a('0xc8')));rpcDb['createCustomerHistory'](_0x224787,_0xc28a('0xc9'));if(ut['totalGlobal'](_0x224787)>=_0x48a45c[_0xc28a('0xa5')]){_0x4b74c4=ut['cloneAction'](_0x224787,0xf,_0xc28a('0xbf'));rpcDb['createCustomerFinal'](_0x4b74c4,_0xc28a('0xca'));}else{if(_0x224787[_0xc28a('0xc5')]>=_0x48a45c['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x224787,_0xc28a('0xc9'));}else{rpcDb[_0xc28a('0xa8')](ut[_0xc28a('0xc1')](_0x224787,_0xc28a('0xc5'),_0x48a45c[_0xc28a('0xcb')]),_0x224787[_0xc28a('0xc3')],_0x224787[_0xc28a('0xaa')]);}}break;case _0xc28a('0xcc'):_0x48a45c[_0xc28a('0x3b')]+=0x1;_0x224787['countcongestionretry']+=0x1;_0x224787[_0xc28a('0x9f')]=ut[_0xc28a('0xa0')](_0x224787);ut[_0xc28a('0x93')](_0x224787,0x8,_0xc28a('0xcd'));ami[_0xc28a('0x26')](_0xc28a('0xce'),ut['buildObj'](_0x224787,_0xc28a('0xcf')));rpcDb[_0xc28a('0x92')](_0x224787,_0xc28a('0xd0'));if(ut['totalGlobal'](_0x224787)>=_0x48a45c['dialGlobalMaxRetry']){_0x4b74c4=ut['cloneAction'](_0x224787,0xf,_0xc28a('0xbf'));rpcDb[_0xc28a('0x96')](_0x4b74c4,_0xc28a('0xd1'));}else{if(_0x224787['countcongestionretry']>=_0x48a45c['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x224787,_0xc28a('0xd0'));}else{rpcDb[_0xc28a('0xa8')](ut['scheduledAt'](_0x224787,_0xc28a('0xd2'),_0x48a45c[_0xc28a('0xc2')]),_0x224787['unlockAgent'],_0x224787['activeContact']);}}break;case _0xc28a('0xd3'):_0x48a45c['outboundRejectCallsDay']+=0x1;_0x224787[_0xc28a('0xd4')]+=0x1;_0x224787['countglobal']=ut[_0xc28a('0xa0')](_0x224787);ut['logCustomer'](_0x224787,0x14,_0xc28a('0xd5'));ami[_0xc28a('0x26')](_0xc28a('0xd6'),ut[_0xc28a('0xa2')](_0x224787,'agentreject'));rpcDb['createCustomerHistory'](_0x224787,_0xc28a('0xd7'));if(ut[_0xc28a('0xa0')](_0x224787)>=_0x48a45c[_0xc28a('0xa5')]){_0x4b74c4=ut[_0xc28a('0xd8')](_0x224787,0x14,_0xc28a('0xd5'));rpcDb[_0xc28a('0x96')](_0x4b74c4,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x224787[_0xc28a('0xd4')]>=_0x48a45c[_0xc28a('0xd9')]){rpcDb['createCustomerFinal'](_0x224787,_0xc28a('0xda'));}else{rpcDb[_0xc28a('0xa8')](ut[_0xc28a('0xc1')](_0x224787,_0xc28a('0xd4'),_0x48a45c[_0xc28a('0xdb')]),_0x224787[_0xc28a('0xc3')],_0x224787[_0xc28a('0xaa')]);}}break;case _0xc28a('0xdc'):_0x48a45c[_0xc28a('0x42')]+=0x1;_0x224787[_0xc28a('0xdd')]+=0x1;_0x224787['countglobal']=ut['totalGlobal'](_0x224787);ut[_0xc28a('0x93')](_0x224787,0xb,_0xc28a('0xde'));rpcDb['createCustomerHistory'](_0x224787,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xc28a('0xa0')](_0x224787)>=_0x48a45c['dialGlobalMaxRetry']){_0x4b74c4=ut[_0xc28a('0xd8')](_0x224787,0xf,_0xc28a('0xbf'));rpcDb[_0xc28a('0x96')](_0x4b74c4,_0xc28a('0xdf'));}else{if(_0x224787[_0xc28a('0xe0')]>=_0x48a45c[_0xc28a('0xe1')]){rpcDb[_0xc28a('0x96')](_0x224787,_0xc28a('0xdf'));}else{rpcDb[_0xc28a('0xa8')](ut[_0xc28a('0xc1')](_0x224787,'countabandonedretry',_0x48a45c[_0xc28a('0xe2')]),_0x224787[_0xc28a('0xc3')],_0x224787[_0xc28a('0xaa')]);}}break;case'18':_0x48a45c[_0xc28a('0xe3')]+=0x1;_0x224787['countmachineretry']+=0x1;_0x224787['countglobal']=ut['totalGlobal'](_0x224787);ut[_0xc28a('0x93')](_0x224787,0x12,_0xee2b33['cause-txt']||_0xee2b33[_0xc28a('0xe4')]);ami[_0xc28a('0x26')](_0xc28a('0xe5'),ut['buildObj'](_0x224787,_0xc28a('0xe6')));rpcDb[_0xc28a('0x92')](_0x224787,_0xc28a('0xe7'));if(ut[_0xc28a('0xa0')](_0x224787)>=_0x48a45c[_0xc28a('0xa5')]){_0x4b74c4=ut[_0xc28a('0xd8')](_0x224787,0xf,_0xc28a('0xbf'));rpcDb[_0xc28a('0x96')](_0x4b74c4,_0xc28a('0xe7'));}else{rpcDb[_0xc28a('0x96')](_0x224787,'[callProgressDetectingCustomer][hangupInAMD]');}delete this['actions'][_0xee2b33[_0xc28a('0xab')]];break;case'19':_0x48a45c[_0xc28a('0xe3')]+=0x1;_0x224787[_0xc28a('0x9f')]=ut['totalGlobal'](_0x224787);ut['logCustomer'](_0x224787,0x13,_0xee2b33[_0xc28a('0xe8')]||_0xee2b33[_0xc28a('0xe4')]);ami[_0xc28a('0x26')](_0xc28a('0xe5'),ut[_0xc28a('0xa2')](_0x224787,_0xc28a('0xe6')));rpcDb[_0xc28a('0x92')](_0x224787,'[callProgressDetectingCustomer][machine]');if(ut[_0xc28a('0xa0')](_0x224787)>=_0x48a45c[_0xc28a('0xa5')]){_0x4b74c4=ut[_0xc28a('0xd8')](_0x224787,0xf,_0xc28a('0xbf'));rpcDb[_0xc28a('0x96')](_0x4b74c4,_0xc28a('0xe9'));}else{rpcDb['createCustomerFinal'](_0x224787,_0xc28a('0xe9'));}delete this[_0xc28a('0x16')][_0xee2b33[_0xc28a('0xab')]];break;default:if(_0x224787['dialAnswer']){ut[_0xc28a('0x7b')](_0x48a45c,_0xc28a('0xea'));ut[_0xc28a('0x7c')](_0xc28a('0xeb')+_0x48a45c[_0xc28a('0x29')],_0xee2b33);}_0x48a45c[_0xc28a('0xe3')]+=0x1;_0x224787[_0xc28a('0x9f')]=ut[_0xc28a('0xa0')](_0x224787);ut[_0xc28a('0x93')](_0x224787,0xc,_0xee2b33[_0xc28a('0xe8')]||_0xee2b33[_0xc28a('0xe4')]);rpcDb['createCustomerHistory'](_0x224787,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x224787)>=_0x48a45c['dialGlobalMaxRetry']){_0x4b74c4=ut[_0xc28a('0xd8')](_0x224787,0xf,'Global');rpcDb['createCustomerFinal'](_0x4b74c4,_0xc28a('0xec'));}else{rpcDb[_0xc28a('0x96')](_0x224787,_0xc28a('0xec'));}delete this[_0xc28a('0x16')][_0xee2b33[_0xc28a('0xab')]];}if(!(_0x224787[_0xc28a('0x7a')]&&_0x2c3f06==='16')){ut['updateOriginated'](_0x48a45c,_0xc28a('0xed'));logger[_0xc28a('0x6b')]('[originated][decrement][callProgressDetectingCustomer]',_0x224787[_0xc28a('0xaf')],_0xc28a('0xb0'),_0x48a45c['name'],_0xc28a('0x6e'),_0x48a45c[_0xc28a('0x4c')]);}if(_0x2c3f06!==_0xc28a('0xac')){delete this[_0xc28a('0x16')][_0xee2b33['linkedid']];delete this[_0xc28a('0x16')][_0xee2b33[_0xc28a('0xee')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x598343,_0x3705a8,_0x592678){if(_[_0xc28a('0xef')](_0x3705a8)&&'object'!==typeof _0x3705a8){return;}if(_[_0xc28a('0xef')](_0x592678)&&_0xc28a('0xf0')!==typeof _0x592678){return;}switch(_0x592678['reason']){case'0':ut['logAgent'](_0x598343,0x0,_0xc28a('0xf1'));rpcDb[_0xc28a('0xf2')](_0x598343,_0xc28a('0xf3'));break;case'3':ut[_0xc28a('0xf4')](_0x598343,0x3,_0xc28a('0xc6'));rpcDb['createAgentHistory'](_0x598343,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xc28a('0xf4')](_0x598343,0x5,_0xc28a('0xbb'));rpcDb[_0xc28a('0xf2')](_0x598343,_0xc28a('0xf5'));break;case'8':ut[_0xc28a('0xf4')](_0x598343,0x8,_0xc28a('0xcd'));rpcDb['createAgentHistory'](_0x598343,_0xc28a('0xf6'));break;case'22':ut[_0xc28a('0xf4')](_0x598343,0x16,_0xc28a('0xf7'));rpcDb['createAgentHistory'](_0x598343,_0xc28a('0xf8'));break;default:ut[_0xc28a('0xf4')](_0x598343,0xc,_0x592678[_0xc28a('0xf9')]);rpcDb['createAgentHistory'](_0x598343,_0xc28a('0xf6'));}ut['updateOriginated'](_0x3705a8,_0xc28a('0xfa'));logger[_0xc28a('0x6b')](_0xc28a('0xfb'),_0x598343[_0xc28a('0xaf')],_0xc28a('0xb0'),_0x3705a8[_0xc28a('0x29')],_0xc28a('0x6e'),_0x3705a8[_0xc28a('0x4c')]);delete this[_0xc28a('0x16')][_0x598343[_0xc28a('0xaf')]];};Preview[_0xc28a('0xe')][_0xc28a('0xfc')]=function(_0x7c3acc,_0x4a1669,_0x2fc965,_0xff6747,_0x3e034d){var _0x3b34bc=this;return new BPromise(function(_0x154134,_0x1332d5){if(_[_0xc28a('0x6a')](_0x4a1669)||_[_0xc28a('0x6a')](_0x4a1669[_0xc28a('0xfd')])||_[_0xc28a('0x6a')](_0x4a1669[_0xc28a('0xfd')][_0xc28a('0xfe')])||_[_0xc28a('0x6a')](_0x4a1669[_0xc28a('0x72')])){_0x1332d5(ut[_0xc28a('0x4b')](_0xc28a('0xff'),_0xff6747,_0x3e034d));return;}var _0x24fa57=uuid['v4']();var _0x33ba88=_0x3b34bc[_0xc28a('0x13')][_0x4a1669[_0xc28a('0x6c')][_0xc28a('0x29')]];var _0x4e5def=_0x2fc965?_0x3b34bc[_0xc28a('0x17')][_0x2fc965]['id']:undefined;_0x3b34bc[_0xc28a('0x16')][_0x24fa57]=new Action(_0x4a1669,_0x33ba88,_0x24fa57,_0x2fc965,_0x4e5def);var _0xd58248=_0x3b34bc[_0xc28a('0x16')][_0x24fa57];_0xd58248[_0xc28a('0xc3')]=_0xff6747;_0xd58248['activeContact']=_0x3e034d;_0xd58248['lookAgent']=_0x2fc965;if(_[_0xc28a('0x100')](_0x7c3acc)){_0x3b34bc[_0xc28a('0x101')](_0xd58248,_0x33ba88,_0x4a1669,_0x2fc965)[_0xc28a('0x80')](function(_0x74d785){logger[_0xc28a('0x6b')]('[Preview][execCall][success]',_0xc28a('0x102')+_0xd58248['queue']+_0xc28a('0x103')+_0xd58248[_0xc28a('0x104')],JSON[_0xc28a('0x53')](_0x74d785));ami[_0xc28a('0x26')](_0xc28a('0x105'),ut['buildObj'](_0xd58248,_0xc28a('0x106'),_0x3b34bc[_0xc28a('0x13')][_0xd58248[_0xc28a('0x6d')]]));_0x154134(ut['message']('Calling'));})['catch'](function(_0x4935ed){ut[_0xc28a('0x5f')](_0xc28a('0x107'),_0x4935ed);_0x1332d5(ut[_0xc28a('0x4b')](_0xc28a('0x108'),_0xff6747,_0x3e034d));});}else{_0x33ba88[_0xc28a('0x39')]+=0x1;ut[_0xc28a('0x109')](_0xd58248);rpcDb[_0xc28a('0x10a')](_0xd58248,'[Blacklist][error]');delete _0x3b34bc[_0xc28a('0x16')][_0x24fa57];_0x1332d5(ut['message'](_0xc28a('0x10b'),_0xff6747,_0x3e034d));}});};Preview[_0xc28a('0xe')][_0xc28a('0x9b')]=function(_0x1b6864){return!_[_0xc28a('0x6a')](_0x1b6864)&&!_[_0xc28a('0x6a')](_0x1b6864[_0xc28a('0x29')])&&!_[_0xc28a('0x6a')](_0x1b6864[_0xc28a('0x10c')])&&_0x1b6864['active']&&!_['isNil'](this[_0xc28a('0x15')][util[_0xc28a('0x54')](_0xc28a('0x10d'),_0x1b6864[_0xc28a('0x29')])])&&!_[_0xc28a('0x6a')](this[_0xc28a('0x15')][util[_0xc28a('0x54')](_0xc28a('0x10d'),_0x1b6864[_0xc28a('0x29')])][_0xc28a('0x75')])&&(this['trunks'][util[_0xc28a('0x54')](_0xc28a('0x10d'),_0x1b6864[_0xc28a('0x29')])]['status']===_0xc28a('0x10e')||this['trunks'][util[_0xc28a('0x54')]('SIP/%s',_0x1b6864[_0xc28a('0x29')])][_0xc28a('0x75')]==='unmonitored');};Preview['prototype'][_0xc28a('0x87')]=function(_0x54a8de,_0x26247e){var _0x337002=this;return new BPromise(function(_0x4cab6f,_0x3a42fb){_0x337002[_0xc28a('0x10f')](_0x54a8de,_0x26247e)[_0xc28a('0x80')](function(_0x61ebd2){_0x4cab6f(_[_0xc28a('0x70')](_0x61ebd2,[_0xc28a('0x4b')]));})[_0xc28a('0x8a')](function(_0x207e3b){if(_0x207e3b['unlock']){rpcDb['unlockContact'](_0x54a8de);}if(_0x207e3b[_0xc28a('0x10c')]){rpcDb[_0xc28a('0x8b')](_0x54a8de);}_0x3a42fb(_[_0xc28a('0x70')](_0x207e3b,[_0xc28a('0x4b')]));});});};Preview[_0xc28a('0xe')][_0xc28a('0x10f')]=function(_0x58f84d,_0x3c3f3c){var _0x5edb39=this;return new BPromise(function(_0x1cd671,_0x6162b1){var _0x397a9b,_0x7ae68c;rpcDb[_0xc28a('0x110')](_0x58f84d)[_0xc28a('0x80')](function(_0x51ac57){if(!_[_0xc28a('0x6a')](_0x51ac57[0x0])){_0x7ae68c=_0x51ac57[0x0]['recallme']?![]:!![];_0x397a9b=_0x51ac57[0x0][_0xc28a('0x111')]?!![]:![];_0x397a9b=_0x3c3f3c?!![]:_0x397a9b;}var _0x7dec54=_0x5edb39[_0xc28a('0x112')](_0x51ac57);if(_0x7dec54[_0xc28a('0x113')]){rpcDb[_0xc28a('0x114')](_[_0xc28a('0x70')](_0x51ac57[0x0],[_0xc28a('0x72'),'Contact.phone']))[_0xc28a('0x80')](function(_0x135117){_0x5edb39[_0xc28a('0xfc')](_0x135117,_0x51ac57[0x0],_0x3c3f3c,_0x7ae68c,_0x397a9b)[_0xc28a('0x80')](function(_0x1a3676){_0x1cd671(_0x1a3676);})['catch'](function(_0x467c62){_0x6162b1(_0x467c62);});})[_0xc28a('0x8a')](function(_0x25cb8c){ut['logger']('[Preview][checkIsBlackList]',_0x25cb8c);_0x6162b1(ut[_0xc28a('0x4b')](_0xc28a('0x115'),_0x7ae68c,_0x397a9b));});}else{_0x6162b1(ut['message'](_0x7dec54['message'],_0x7ae68c,_0x397a9b));}})[_0xc28a('0x8a')](function(_0x43bf94){ut['logger'](_0xc28a('0x116'),_0x43bf94);_0x6162b1(ut[_0xc28a('0x4b')](_0xc28a('0x115'),![],!![]));});});};Preview[_0xc28a('0xe')][_0xc28a('0x112')]=function(_0x399371){if(_[_0xc28a('0x6a')](_0x399371)||_['isEmpty'](_0x399371)||!_[_0xc28a('0x6a')](_0x399371[0x0][_0xc28a('0x85')])&&_[_0xc28a('0x6a')](_0x399371[0x0][_0xc28a('0x85')][_0xc28a('0x29')])){ut[_0xc28a('0x5f')]('[Preview][validateContact][Empty\x20Contact]',_0x399371);return{'isValid':![],'message':_0xc28a('0x117')};}var _0xfff7bb=this['campaignsPreview'][_0x399371[0x0][_0xc28a('0x6c')][_0xc28a('0x29')]];_0xfff7bb['message']=_0xc28a('0x9c');if(_[_0xc28a('0x6a')](_0xfff7bb)){ut['logger'](_0xc28a('0x118'),_0xfff7bb);return{'isValid':![],'message':_0xc28a('0x119')};}if(!this[_0xc28a('0x9b')](_0xfff7bb[_0xc28a('0x50')])){ut['logger'](_0xc28a('0x11a'),'campaign\x20Name:\x20'+_0xfff7bb[_0xc28a('0x29')]+_0xc28a('0x11b'));if(!this[_0xc28a('0x9b')](_0xfff7bb[_0xc28a('0x11c')])){ut[_0xc28a('0x5f')](_0xc28a('0x11a'),_0xfff7bb[_0xc28a('0x29')]+_0xc28a('0x11d'));return{'isValid':![],'message':_0xc28a('0x11e')};}}if(!ut[_0xc28a('0x9a')](_0xfff7bb[_0xc28a('0x34')])){ut['logger'](_0xc28a('0x11f'),_0xfff7bb[_0xc28a('0x29')]+_0xc28a('0x120'));return{'isValid':![],'message':_0xc28a('0x121')+_0xfff7bb['name']+_0xc28a('0x120')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0xc28a('0x101')]=function(_0x57c103,_0x1ced8d,_0x1f0158,_0x17c369){var _0x15e355=this;return new BPromise(function(_0x2e93ed,_0x5e0376){var _0x1b873e=_0x57c103[_0xc28a('0xaf')];var _0x423fd9=_0x15e355['isTrunkReachable'](_0x1ced8d['Trunk'])?util[_0xc28a('0x54')]('SIP/%s/%s%s',_0x1ced8d['Trunk'][_0xc28a('0x29')],_[_0xc28a('0x6a')](_0x1ced8d[_0xc28a('0x36')])?'':_0x1ced8d[_0xc28a('0x36')][_0xc28a('0x122')]()||'',_0x1ced8d[_0xc28a('0x123')]>0x0?_0x1f0158[_0xc28a('0xfd')]['phone'][_0xc28a('0x124')](_0x1ced8d[_0xc28a('0x123')]):_0x1f0158[_0xc28a('0xfd')][_0xc28a('0xfe')]):util['format'](_0xc28a('0x125'),_[_0xc28a('0x6a')](_0x1ced8d['TrunkBackup'])?_0x1ced8d['Trunk'][_0xc28a('0x29')]:_0x1ced8d['TrunkBackup']['name'],_[_0xc28a('0x6a')](_0x1ced8d[_0xc28a('0x36')])?'':_0x1ced8d[_0xc28a('0x36')][_0xc28a('0x122')]()||'',_0x1ced8d[_0xc28a('0x123')]>0x0?_0x1f0158['Contact'][_0xc28a('0xfe')][_0xc28a('0x124')](_0x1ced8d[_0xc28a('0x123')]):_0x1f0158[_0xc28a('0xfd')][_0xc28a('0xfe')]);var _0xe57785=_0x15e355[_0xc28a('0x9b')](_0x1ced8d[_0xc28a('0x50')])?ut['getCallerId'](_0x1ced8d['Trunk'][_0xc28a('0x51')],_0x1ced8d[_0xc28a('0x126')],_0x1ced8d[_0xc28a('0x127')]>0x0?ut[_0xc28a('0x128')](_0x1ced8d[_0xc28a('0x129')],_0x1ced8d[_0xc28a('0x127')]):_0x1ced8d[_0xc28a('0x129')]):ut[_0xc28a('0x12a')](_[_0xc28a('0x6a')](_0x1ced8d[_0xc28a('0x11c')])?_0x1ced8d['Trunk'][_0xc28a('0x51')]:_0x1ced8d[_0xc28a('0x11c')][_0xc28a('0x51')],_0x1ced8d[_0xc28a('0x126')],_0x1ced8d[_0xc28a('0x127')]>0x0?ut[_0xc28a('0x128')](_0x1ced8d['dialOriginateCallerIdNumber'],_0x1ced8d[_0xc28a('0x127')]):_0x1ced8d[_0xc28a('0x129')]);if(_0xe57785){_0x57c103[_0xc28a('0x12b')]=ut['extractCalleridName'](_0xe57785);_0x57c103['originatecalleridnum']=ut[_0xc28a('0x12c')](_0xe57785);}var _0xa8b2e7=ut[_0xc28a('0x12d')](_0x1ced8d,_0x1f0158,_0x423fd9,_0xe57785,_0x1b873e,_0x57c103);_[_0xc28a('0x12e')](_0x57c103,ut[_0xc28a('0x12f')](_0xa8b2e7));_0x57c103[_0xc28a('0x8c')]=moment()[_0xc28a('0x54')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xc28a('0x74')](ut['variablesAction'](_0x57c103,_0x1ced8d,_0xa8b2e7,_0x57c103['activeContact'],_0x17c369))[_0xc28a('0x80')](function(_0xbad68b){_0x1ced8d[_0xc28a('0x4c')]+=0x1;logger[_0xc28a('0x6b')](_0xc28a('0x130'),_0x1b873e,_0xc28a('0xb0'),_0x1ced8d[_0xc28a('0x29')],_0xc28a('0x6e'),_0x1ced8d['originated']);_0x2e93ed(_0xbad68b);})[_0xc28a('0x8a')](function(_0x4dc9bd){ut[_0xc28a('0xf4')](_0x57c103,0xe,_0xc28a('0x131'));rpcDb['createAgentHistory'](_0x57c103,_0xc28a('0x132'));_0x5e0376(_0x4dc9bd);});});};Preview[_0xc28a('0xe')]['syncNewExten']=function(_0x52899c){if(this['actions'][_0x52899c[_0xc28a('0xab')]]){this['actions'][_0x52899c[_0xc28a('0xab')]]['channel']=_0x52899c[_0xc28a('0x76')];}};Preview[_0xc28a('0xe')][_0xc28a('0x18')]=function(_0x258704){var _0x25c42f=this;var _0x52632d=this[_0xc28a('0x16')][_0x258704[_0xc28a('0x133')]];if(_0x52632d){if(_0x52632d[_0xc28a('0x134')]&&this['agents'][_0x52632d['lookAgent']]){ut[_0xc28a('0x135')](_0x52632d,this[_0xc28a('0x17')][_0x52632d['lookAgent']][_0xc28a('0x29')],this['agents'][_0x52632d[_0xc28a('0x134')]]['id']);}var _0x5de044=_[_0xc28a('0x136')](_0x52632d);_0x5de044[_0xc28a('0x137')]=moment()[_0xc28a('0x54')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1364fa=_0x25c42f[_0xc28a('0x13')][_0x52632d[_0xc28a('0x6d')]];if(ut[_0xc28a('0x138')](_0x258704[_0xc28a('0x139')])){if(_0x52632d[_0xc28a('0xc3')]){rpcDb[_0xc28a('0x13a')](_0x52632d[_0xc28a('0x104')]);}if(_0x52632d['activeContact']){rpcDb[_0xc28a('0x8b')](_0x52632d['idContact']);}ami[_0xc28a('0x26')](_0xc28a('0x13b'),ut[_0xc28a('0xa2')](_0x52632d,_0xc28a('0x13c'),this[_0xc28a('0x13')][_0x52632d[_0xc28a('0x6d')]]));this['callProgressDetectingAgent'](_0x5de044,_0x1364fa,_0x258704);}else{_0x52632d[_0xc28a('0x8c')]=moment()[_0xc28a('0x54')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xc28a('0xf4')](_0x5de044,0x4,_0xc28a('0xb5'));rpcDb[_0xc28a('0xf2')](_0x5de044,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0xc28a('0x13d')]=function(_0x57a7a4){var _0x5c5903=this;var _0x557541=this[_0xc28a('0x16')][_0x57a7a4['linkedid']];var _0xfa6d4e;if(_0x557541){_0xfa6d4e=this[_0xc28a('0x13')][_0x557541['queue']];logger['info'](_0xc28a('0x13e'),_0x57a7a4[_0xc28a('0xab')],_0xc28a('0xb0'),_0xfa6d4e[_0xc28a('0x29')],_0xc28a('0x6f'),_0xfa6d4e[_0xc28a('0x2c')]);}if(this[_0xc28a('0x16')][_0x57a7a4['linkedid']]&&_0x57a7a4[_0xc28a('0xab')]!==_0x57a7a4['uniqueid']){if(_0x57a7a4[_0xc28a('0x13f')]==='16'&&this[_0xc28a('0x16')][_0x57a7a4[_0xc28a('0xab')]][_0xc28a('0x7a')]){this[_0xc28a('0x9d')](_0x57a7a4,_0x57a7a4[_0xc28a('0xab')],_0x57a7a4[_0xc28a('0x13f')]);}else if(this[_0xc28a('0x16')][_0x57a7a4[_0xc28a('0xab')]][_0xc28a('0x7a')]){logger['info'](_0xc28a('0x140'),_0x57a7a4[_0xc28a('0xab')],_0x57a7a4[_0xc28a('0x13f')],_0xc28a('0xb0'),_0xfa6d4e[_0xc28a('0x29')],'pTalking:\x20',_0xfa6d4e[_0xc28a('0x2c')]);this[_0xc28a('0x9d')](_0x57a7a4,_0x57a7a4[_0xc28a('0xab')],_0x57a7a4['cause']);}}else if(_0x557541&&_[_0xc28a('0x6a')](_0x557541[_0xc28a('0x141')])&&_0xfa6d4e[_0xc28a('0x142')]&&_0x57a7a4[_0xc28a('0xab')]===_0x57a7a4[_0xc28a('0xaf')]&&_[_0xc28a('0x6a')](_0x57a7a4[_0xc28a('0xf9')])&&_0x57a7a4['cause']==='16'&&_0x57a7a4[_0xc28a('0x143')]==='6'&&_[_0xc28a('0xef')](_0x557541[_0xc28a('0x144')])){if(_0x557541[_0xc28a('0xc3')]){rpcDb[_0xc28a('0x13a')](_0x557541[_0xc28a('0x104')]);}if(_0x557541[_0xc28a('0xaa')]){rpcDb[_0xc28a('0x8b')](_0x557541[_0xc28a('0x104')]);}_0x57a7a4[_0xc28a('0xf9')]='22';this[_0xc28a('0x145')](_0x557541,_0xfa6d4e,_0x57a7a4);}else if(_0x557541&&_0x557541[_0xc28a('0x144')]){if(_0x57a7a4[_0xc28a('0x13f')]==='16'&&this['actions'][_0x57a7a4['linkedid']][_0xc28a('0x7a')]){logger[_0xc28a('0x6b')](_0xc28a('0x146'),_0x57a7a4['linkedid'],_0x57a7a4[_0xc28a('0x13f')],_0xc28a('0xb0'),_0xfa6d4e[_0xc28a('0x29')],_0xc28a('0x6f'),_0xfa6d4e['pTalking']);this['callProgressDetectingCustomer'](_0x57a7a4,_0x57a7a4[_0xc28a('0xab')],_0x57a7a4['cause']);}else if(this[_0xc28a('0x16')][_0x57a7a4[_0xc28a('0xab')]][_0xc28a('0x7a')]){logger[_0xc28a('0x6b')](_0xc28a('0x140'),_0x57a7a4[_0xc28a('0xab')],_0x57a7a4[_0xc28a('0x13f')],_0xc28a('0xb0'),_0xfa6d4e['name'],_0xc28a('0x6f'),_0xfa6d4e[_0xc28a('0x2c')]);this[_0xc28a('0x9d')](_0x57a7a4,_0x57a7a4['linkedid'],_0x57a7a4[_0xc28a('0x13f')]);}}};Preview[_0xc28a('0xe')][_0xc28a('0x147')]=function(_0xc7b155){if(this['actions'][_0xc7b155[_0xc28a('0xee')]]&&_0xc7b155[_0xc28a('0xee')]!==_0xc7b155[_0xc28a('0x148')]){this[_0xc28a('0x9d')](_0xc7b155,_0xc7b155[_0xc28a('0xee')],_0xc7b155[_0xc28a('0xe4')]);}};Preview[_0xc28a('0xe')][_0xc28a('0x1c')]=function(_0x14b6fc){if(this[_0xc28a('0x16')][_0x14b6fc[_0xc28a('0xab')]]&&_0x14b6fc[_0xc28a('0xab')]!==_0x14b6fc['uniqueid']&&!this[_0xc28a('0x16')][_0x14b6fc[_0xc28a('0xab')]][_0xc28a('0x7a')]){if(_0x14b6fc[_0xc28a('0x13f')]==='1'){this['callProgressDetectingCustomer'](_0x14b6fc,_0x14b6fc['linkedid'],_0x14b6fc['cause']);}}};Preview[_0xc28a('0xe')][_0xc28a('0x149')]=function(_0x14a4af,_0x3dd370,_0x472b4e){if(this[_0xc28a('0x16')][_0x14a4af]){if(_[_0xc28a('0x6a')](this[_0xc28a('0x16')][_0x14a4af][_0xc28a('0x14a')])){this[_0xc28a('0x16')][_0x14a4af]['variables']={};}this[_0xc28a('0x16')][_0x14a4af]['variables'][_0x3dd370]=_0x472b4e;}};Preview[_0xc28a('0xe')][_0xc28a('0x21')]=function(_0x55fcf8){try{if(!_[_0xc28a('0x6a')](_0x55fcf8)){if(ut[_0xc28a('0x14b')](_[_0xc28a('0x14c')](_0x55fcf8[_0xc28a('0x14d')])[0x0])){this['addVariable'](_0x55fcf8['uniqueid'],_[_0xc28a('0x14c')](_0x55fcf8[_0xc28a('0x14d')])[0x0],_0x55fcf8[_0xc28a('0x14e')]);}}}catch(_0x16daa1){logger[_0xc28a('0x14f')](_0xc28a('0x150'),util[_0xc28a('0x151')](_0x16daa1,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0xed798c){if(_0xed798c){if(this[_0xc28a('0x16')][_0xed798c[_0xc28a('0x152')]]){this['actions'][_0xed798c[_0xc28a('0x152')]][_0xc28a('0x144')]=!![];}}};Preview[_0xc28a('0xe')][_0xc28a('0x24')]=function(_0xc39b63){if(_0xc39b63){if(this[_0xc28a('0x16')][_0xc39b63[_0xc28a('0x153')]]){this[_0xc28a('0x16')][_0xc39b63[_0xc28a('0x153')]][_0xc28a('0x144')]=!![];}}};module[_0xc28a('0x154')]=Preview; \ No newline at end of file +var _0xdbcf=['[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','syncNewExten','channel','logLookAgent','clone','isFailure','unlockContact','rejected','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','variables','syncVarSet','filterKey','keys','addVariable','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./util/util','defaults','redis','localhost','socket.io-emitter','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','syncHangupRequest','dialend','newexten','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','answered','available','sumBillable','talking','total','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','prototype','syncCampaigns','preview','booked','type','clearZombieChannels','setMessage','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','contactId','UserId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','catch','disableContact','starttime','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','activeContact','linkedid','ANSWER','responsetime','answertime','pTalking','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','countbusyretry','Busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','[callProgressDetectingCustomer][logBusy]','rescheduleContact','scheduledAt','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','cloneAction','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','run','execRun','unlock','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdbcf,0x190));var _0xfdbc=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdbcf[_0x42cae2];return _0x5f256f;};'use strict';var util=require('util');var _=require(_0xfdbc('0x0'));var BPromise=require('bluebird');var uuid=require(_0xfdbc('0x1'));var moment=require('moment');var md5=require(_0xfdbc('0x2'));var Redis=require(_0xfdbc('0x3'));var config=require(_0xfdbc('0x4'));var logger=require(_0xfdbc('0x5'))('preview');var loggerAction=require(_0xfdbc('0x5'))(_0xfdbc('0x6'));var ami=require('../ami');var rpcDb=require(_0xfdbc('0x7'));var Action=require('./action');var ut=require(_0xfdbc('0x8'));config['redis']=_[_0xfdbc('0x9')](config[_0xfdbc('0xa')],{'host':_0xfdbc('0xb'),'port':0x18eb});var io=require(_0xfdbc('0xc'))(new Redis(config[_0xfdbc('0xa')]));var Sequence=function(){};Sequence['prototype'][_0xfdbc('0xd')]=function(_0x545a48){this[_0xfdbc('0xe')]=this[_0xfdbc('0xe')]?this[_0xfdbc('0xe')][_0xfdbc('0xf')](_0x545a48):_0x545a48();};function Preview(_0x22df32){this['sequence']=new Sequence();this[_0xfdbc('0x10')]=_0x22df32[_0xfdbc('0x11')];this[_0xfdbc('0x12')]=_0x22df32[_0xfdbc('0x12')];this[_0xfdbc('0x13')]={};this[_0xfdbc('0x14')]=_0x22df32[_0xfdbc('0x14')];this[_0xfdbc('0x15')]=0x0;ami['on'](_0xfdbc('0x16'),this[_0xfdbc('0x17')][_0xfdbc('0x18')](this));ami['on']('hangup',this[_0xfdbc('0x19')][_0xfdbc('0x18')](this));ami['on']('hanguprequest',this[_0xfdbc('0x1a')][_0xfdbc('0x18')](this));ami['on'](_0xfdbc('0x1b'),this['syncDialEnd'][_0xfdbc('0x18')](this));ami['on'](_0xfdbc('0x1c'),this['syncNewExten'][_0xfdbc('0x18')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0xfdbc('0x1d'),this[_0xfdbc('0x1e')]['bind'](this));ami['on'](_0xfdbc('0x1f'),this[_0xfdbc('0x20')][_0xfdbc('0x18')](this));this[_0xfdbc('0x21')](this['campaignsPreview']);}function emit(_0x496370,_0x58c83c,_0x3cc55f){io['to'](_0x496370)[_0xfdbc('0x22')](_0x58c83c,_0x3cc55f);}function emitCampaignPreview(_0x2b4624){if(_0x2b4624['type']===_0xfdbc('0x23')){var _0x48467d={'id':_0x2b4624['id'],'name':_0x2b4624[_0xfdbc('0x24')],'strategy':_0x2b4624['strategy'],'answered':_0x2b4624[_0xfdbc('0x25')],'available':_0x2b4624[_0xfdbc('0x26')],'loggedIn':_0x2b4624['loggedIn'],'pTalking':_0x2b4624['pTalking'],'sumBillable':_0x2b4624[_0xfdbc('0x27')],'sumDuration':_0x2b4624['sumDuration'],'sumHoldTime':_0x2b4624['sumHoldTime']||0x0,'talking':_0x2b4624[_0xfdbc('0x28')],'total':_0x2b4624[_0xfdbc('0x29')],'type':_0x2b4624['type'],'unmanaged':_0x2b4624['unmanaged'],'abandoned':_0x2b4624[_0xfdbc('0x2a')],'waiting':_0x2b4624[_0xfdbc('0x2b')],'loggedInDb':_0x2b4624['loggedInDb'],'dialActive':_0x2b4624[_0xfdbc('0x2c')],'dialMethod':_0x2b4624[_0xfdbc('0x2d')],'dialOriginateCallerIdName':_0x2b4624[_0xfdbc('0x2e')],'dialOriginateCallerIdNumber':_0x2b4624[_0xfdbc('0x2f')],'dialOriginateTimeout':_0x2b4624[_0xfdbc('0x30')],'dialPrefix':_0x2b4624['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2b4624[_0xfdbc('0x31')],'outboundAnswerCallsDay':_0x2b4624['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x2b4624[_0xfdbc('0x32')],'outboundBusyCallsDay':_0x2b4624[_0xfdbc('0x33')],'outboundCongestionCallsDay':_0x2b4624['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x2b4624[_0xfdbc('0x34')],'outboundDropCallsDayCallersExit':_0x2b4624[_0xfdbc('0x35')],'outboundDropCallsDayTimeout':_0x2b4624[_0xfdbc('0x36')],'outboundNoAnswerCallsDay':_0x2b4624[_0xfdbc('0x37')],'outboundNoSuchCallsDay':_0x2b4624[_0xfdbc('0x38')],'outboundOriginateFailureCallsDay':_0x2b4624[_0xfdbc('0x39')],'outboundReCallsDay':_0x2b4624[_0xfdbc('0x3a')],'outboundRejectCallsDay':_0x2b4624[_0xfdbc('0x3b')],'outboundUnknownCallsDay':_0x2b4624['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x2b4624['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x2b4624[_0xfdbc('0x3c')],'predictiveIntervalAvgHoldtime':_0x2b4624[_0xfdbc('0x3d')],'predictiveIntervalAvgTalktime':_0x2b4624['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x2b4624[_0xfdbc('0x3e')],'predictiveIntervalDroppedCallsTimeout':_0x2b4624[_0xfdbc('0x3f')],'predictiveIntervalErlangCalls':_0x2b4624[_0xfdbc('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x2b4624['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2b4624[_0xfdbc('0x41')],'predictiveIntervalMultiplicativeFactor':_0x2b4624[_0xfdbc('0x42')],'predictiveIntervalPauses':_0x2b4624[_0xfdbc('0x43')],'predictiveIntervalAvailable':_0x2b4624[_0xfdbc('0x44')],'predictiveIntervalTotalCalls':_0x2b4624[_0xfdbc('0x45')],'message':_0x2b4624[_0xfdbc('0x46')],'originated':_0x2b4624[_0xfdbc('0x47')],'erlangCalls':_0x2b4624[_0xfdbc('0x48')],'erlangCallToSecond':_0x2b4624[_0xfdbc('0x49')],'erlangAbandonmentRate':_0x2b4624[_0xfdbc('0x4a')],'erlangBusyFactor':_0x2b4624['erlangBusyFactor'],'startPredictive':_0x2b4624[_0xfdbc('0x4b')],'startProgressive':_0x2b4624[_0xfdbc('0x4c')]};if(_0x2b4624[_0xfdbc('0x4d')]){_0x48467d[_0xfdbc('0x4d')]={'id':_0x2b4624[_0xfdbc('0x4d')]['id'],'name':_0x2b4624['Trunk'][_0xfdbc('0x24')],'active':_0x2b4624[_0xfdbc('0x4d')][_0xfdbc('0x4e')],'callerid':_0x2b4624['Trunk']['callerid']};}if(_0x2b4624['Interval']){_0x48467d[_0xfdbc('0x4f')]={'id':_0x2b4624['Interval']['id'],'name':_0x2b4624[_0xfdbc('0x4f')][_0xfdbc('0x24')]};}var _0x66ffa=md5(JSON['stringify'](_0x48467d));if(_0x2b4624[_0xfdbc('0x2')]!==_0x66ffa){_0x2b4624['md5']=_0x66ffa;emit(util['format']('voice:queue:%s',_0x48467d[_0xfdbc('0x24')]),_0xfdbc('0x50'),_0x48467d);}}}function emitVoiceQueueChannelRemove(_0x217541){logger[_0xfdbc('0x51')](_0xfdbc('0x52'),JSON[_0xfdbc('0x53')](_0x217541));emit(util['format'](_0xfdbc('0x54'),_0x217541[_0xfdbc('0x24')]),'voice_queue_channel:remove',_0x217541);io[_0xfdbc('0x22')]('voice_queue_presence:remove',_0x217541);}function notSendMessagesQueue(_0x56ab44){if(_0x56ab44[_0xfdbc('0x55')]){if(_0x56ab44['originated']===0x0&&_0x56ab44['pTalking']===0x0){_0x56ab44['sendMessageOneNotActive']=![];_0x56ab44[_0xfdbc('0x26')]=0x0;_0x56ab44[_0xfdbc('0x56')]=0x0;_0x56ab44[_0xfdbc('0x46')]=_0xfdbc('0x57');ut[_0xfdbc('0x58')](_0xfdbc('0x59'),_0x56ab44[_0xfdbc('0x24')]+_0xfdbc('0x5a'));}else{_0x56ab44[_0xfdbc('0x46')]='IS_DISACTIVED';ut[_0xfdbc('0x58')](_0xfdbc('0x59'),_0x56ab44['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x56ab44);}}Preview[_0xfdbc('0x5b')]['loopCampaigns']=function(){var _0x22caf0=this;setInterval(function(){_0x22caf0[_0xfdbc('0x5c')]();},0x7cf);};Preview[_0xfdbc('0x5b')][_0xfdbc('0x5c')]=function(){var _0x234c4e=this[_0xfdbc('0x10')];this[_0xfdbc('0x15')]+=0x1;for(var _0x28f336 in _0x234c4e){if(_0x234c4e['hasOwnProperty'](_0x28f336)&&(_0x234c4e[_0x28f336][_0xfdbc('0x2d')]===_0xfdbc('0x5d')||_0x234c4e[_0x28f336][_0xfdbc('0x2d')]===_0xfdbc('0x5e'))&&_0x234c4e[_0x28f336][_0xfdbc('0x5f')]==='outbound'){if(this[_0xfdbc('0x15')]>0x7){this[_0xfdbc('0x15')]=0x0;this[_0xfdbc('0x60')]();}}if(_0x234c4e['hasOwnProperty'](_0x28f336)&&_0x234c4e[_0x28f336]['dialMethod']===_0xfdbc('0x5d')&&_0x234c4e[_0x28f336]['type']===_0xfdbc('0x23')){if(_0x234c4e[_0x28f336][_0xfdbc('0x2c')]){this[_0xfdbc('0x61')](_0x234c4e[_0x28f336]);this[_0xfdbc('0x62')](_0x234c4e[_0x28f336]);}else{notSendMessagesQueue(_0x234c4e[_0x28f336]);}}}};Preview[_0xfdbc('0x5b')][_0xfdbc('0x63')]=function(_0x38b7de){var _0x393bfa=this;this[_0xfdbc('0x64')][_0xfdbc('0xd')](function(){if(!_[_0xfdbc('0x65')](_0x393bfa['actions'][_0x38b7de])){loggerAction[_0xfdbc('0x51')](_0xfdbc('0x66'),_0x38b7de,'Queue',_0x393bfa[_0xfdbc('0x13')][_0x38b7de][_0xfdbc('0x67')],'originated:\x20',JSON[_0xfdbc('0x53')](_0x393bfa[_0xfdbc('0x10')][_0x393bfa['actions'][_0x38b7de][_0xfdbc('0x67')]][_0xfdbc('0x47')]),_0xfdbc('0x68'),JSON['stringify'](_0x393bfa['campaignsPreview'][_0x393bfa[_0xfdbc('0x13')][_0x38b7de][_0xfdbc('0x67')]]['pTalking']),JSON['stringify'](_0x393bfa[_0xfdbc('0x13')][_0x38b7de][_0xfdbc('0x69')]),JSON['stringify'](_['pick'](_0x393bfa[_0xfdbc('0x13')][_0x38b7de],[_0xfdbc('0x6a'),_0xfdbc('0x6b'),'VoiceQueueId','ListId'])));return ami[_0xfdbc('0x6c')]({'action':_0xfdbc('0x6d'),'channel':_0x393bfa[_0xfdbc('0x13')][_0x38b7de]['channel']})['catch'](function(_0x540b6c){if(_0x540b6c['message']===_0xfdbc('0x6e')){setTimeout(function(){if(_0x393bfa[_0xfdbc('0x13')][_0x38b7de]){ut[_0xfdbc('0x6f')](_0x393bfa[_0xfdbc('0x10')][_0x393bfa[_0xfdbc('0x13')][_0x38b7de][_0xfdbc('0x67')]],_0xfdbc('0x70'));if(_0x393bfa[_0xfdbc('0x13')][_0x38b7de][_0xfdbc('0x69')]===!![]){ut[_0xfdbc('0x71')](_0x393bfa[_0xfdbc('0x10')][_0x393bfa[_0xfdbc('0x13')][_0x38b7de][_0xfdbc('0x67')]],_0xfdbc('0x70'));ut[_0xfdbc('0x72')]('[Dialer][checkChannel][pTalking][Preview]'+_0x38b7de,_0x393bfa[_0xfdbc('0x13')][_0x38b7de][_0xfdbc('0x67')]);}ut['loggerError'](_0xfdbc('0x73')+_0x38b7de,_0x393bfa[_0xfdbc('0x13')][_0x38b7de]['queue']);delete _0x393bfa[_0xfdbc('0x13')][_0x38b7de];}},0x2328);}});}});};Preview[_0xfdbc('0x5b')][_0xfdbc('0x60')]=function(){var _0x21922d=this;loggerAction[_0xfdbc('0x51')](_0xfdbc('0x74'),_[_0xfdbc('0x75')](this['actions']));for(var _0x23f123 in this[_0xfdbc('0x13')]){if(_0x21922d[_0xfdbc('0x13')][_0xfdbc('0x76')](_0x23f123)){_0x21922d[_0xfdbc('0x63')](_0x23f123);}}};Preview[_0xfdbc('0x5b')][_0xfdbc('0x62')]=function(_0x389952){var _0x3a6e2c=this;rpcDb[_0xfdbc('0x77')](_0x389952['id'],ut[_0xfdbc('0x78')](this['agents']))[_0xfdbc('0x79')](function(_0x49bc2c){if(!_[_0xfdbc('0x65')](_0x49bc2c)){for(var _0x259ed5=0x0;_0x259ed5<_0x49bc2c[_0xfdbc('0x7a')];_0x259ed5+=0x1){if(ut[_0xfdbc('0x7b')](_0x49bc2c[_0x259ed5]['scheduledat'])<_0x389952[_0xfdbc('0x7c')]*0x3c){if(_0x49bc2c[_0x259ed5][_0xfdbc('0x7d')]&&!_0x49bc2c[_0x259ed5][_0xfdbc('0x7d')][_0xfdbc('0x7e')]){_0x3a6e2c['run'](_0x49bc2c[_0x259ed5]['id'])[_0xfdbc('0x79')](ut[_0xfdbc('0x7f')](_0xfdbc('0x80')))[_0xfdbc('0x81')](ut[_0xfdbc('0x7f')](_0xfdbc('0x80')));}else{rpcDb[_0xfdbc('0x82')](_0x49bc2c[_0x259ed5]['id']);}}else{var _0x4287e2=new Action(_0x49bc2c[_0x259ed5],_0x389952);_0x4287e2[_0xfdbc('0x83')]=moment()[_0xfdbc('0x84')](_0xfdbc('0x85'));_0x389952['outboundReCallsDay']+=0x1;ut[_0xfdbc('0x86')](_0x4287e2,0x17,_0xfdbc('0x87'));if(_0x389952[_0xfdbc('0x88')]){rpcDb[_0xfdbc('0x89')](ut['createBody'](_0x49bc2c[_0x259ed5]));rpcDb['createCustomerHistory'](_0x4287e2,_0xfdbc('0x8a'));}else{ut[_0xfdbc('0x86')](_0x4287e2,0x16,_0xfdbc('0x8b'));rpcDb[_0xfdbc('0x8c')](_0x4287e2,_0xfdbc('0x8d'));rpcDb[_0xfdbc('0x8e')](_0x4287e2,_0xfdbc('0x8d'));}}}}})[_0xfdbc('0x81')](ut[_0xfdbc('0x7f')](_0xfdbc('0x8f')));};Preview['prototype']['setMessage']=function(_0x3d0c60){_0x3d0c60['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3d0c60[_0xfdbc('0x90')])){_0x3d0c60['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0xfdbc('0x91')](_0x3d0c60[_0xfdbc('0x2c')])){_0x3d0c60[_0xfdbc('0x46')]=_0xfdbc('0x57');}else if(!this[_0xfdbc('0x92')](_0x3d0c60['Trunk'])){if(!this[_0xfdbc('0x92')](_0x3d0c60[_0xfdbc('0x93')])){_0x3d0c60[_0xfdbc('0x46')]=_0xfdbc('0x94');}else{_0x3d0c60['message']='ACTIVE';}}else{_0x3d0c60['message']=_0xfdbc('0x95');}emitCampaignPreview(_0x3d0c60);};Preview['prototype'][_0xfdbc('0x96')]=function(_0x13821d,_0x41c68a,_0x2af077){var _0x525e60=this;var _0x2887fa=this[_0xfdbc('0x13')][_0x41c68a];var _0x4ac656=this['campaignsPreview'][_0x2887fa[_0xfdbc('0x67')]];var _0x38ea6f;if(_0x4ac656){switch(_0x2af077){case'1':_0x4ac656[_0xfdbc('0x38')]+=0x1;_0x2887fa['countnosuchnumberretry']+=0x1;_0x2887fa[_0xfdbc('0x97')]=ut[_0xfdbc('0x98')](_0x2887fa);ut[_0xfdbc('0x86')](_0x2887fa,0x0,_0xfdbc('0x99'));ami['emit']('custom:agentnosuchnumber',ut[_0xfdbc('0x9a')](_0x2887fa,'nosuchnumber'));rpcDb[_0xfdbc('0x8c')](_0x2887fa,_0xfdbc('0x9b'));if(ut['totalGlobal'](_0x2887fa)>=_0x4ac656['dialGlobalMaxRetry']){_0x38ea6f=ut['cloneAction'](_0x2887fa,0xf,_0xfdbc('0x9c'));rpcDb[_0xfdbc('0x8e')](_0x38ea6f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2887fa['countnosuchnumberretry']>=_0x4ac656[_0xfdbc('0x9d')]){rpcDb[_0xfdbc('0x8e')](_0x2887fa,_0xfdbc('0x9e'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2887fa,'countnosuchnumberretry',_0x4ac656['dialNoSuchNumberRetryFrequency']),_0x2887fa['unlockAgent'],_0x2887fa[_0xfdbc('0x9f')]);}}delete this[_0xfdbc('0x13')][_0x13821d[_0xfdbc('0xa0')]];break;case _0xfdbc('0xa1'):var _0x4f7447=moment()[_0xfdbc('0x84')](_0xfdbc('0x85'));_0x2887fa[_0xfdbc('0xa2')]=_0x4f7447;_0x2887fa[_0xfdbc('0xa3')]=_0x4f7447;_0x2887fa[_0xfdbc('0x69')]=!![];_0x4ac656[_0xfdbc('0xa4')]+=0x1;logger[_0xfdbc('0x51')](_0xfdbc('0xa5'),_0x2887fa[_0xfdbc('0xa6')],_0xfdbc('0xa7'),_0x4ac656[_0xfdbc('0x24')],_0xfdbc('0x68'),_0x4ac656[_0xfdbc('0xa4')]);ami['emit'](_0xfdbc('0xa8'),ut[_0xfdbc('0x9a')](_0x2887fa,_0xfdbc('0xa9'),this[_0xfdbc('0x10')][_0x2887fa['queue']]));if(_0x4ac656[_0xfdbc('0xaa')]){ami['emit'](_0xfdbc('0xab'),ut['buildAcw'](_0x2887fa));}break;case'16':ami['emit'](_0xfdbc('0xac'),ut[_0xfdbc('0x9a')](_0x2887fa,_0xfdbc('0xad'),this[_0xfdbc('0x10')][_0x2887fa[_0xfdbc('0x67')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2887fa,_0xfdbc('0xad')));_0x4ac656[_0xfdbc('0xae')]+=0x1;_0x4ac656['total']+=0x1;_0x4ac656[_0xfdbc('0x25')]+=0x1;ut['decrementTalkink'](_0x4ac656,_0xfdbc('0xaf'));_0x2887fa[_0xfdbc('0x97')]=ut[_0xfdbc('0x98')](_0x2887fa);ut[_0xfdbc('0x86')](_0x2887fa,0x4,'Answer');rpcDb[_0xfdbc('0x8c')](_0x2887fa,_0xfdbc('0xb0'));rpcDb[_0xfdbc('0x8e')](_0x2887fa,_0xfdbc('0xb1'));rpcDb['crateCustomerReportQueue'](_0x2887fa);_0x4ac656['sumDuration']+=_0x2887fa['talktime'];_0x4ac656[_0xfdbc('0x27')]+=_0x2887fa[_0xfdbc('0xb2')];logger[_0xfdbc('0x51')]('[syncHangup][talking][decrement]',_0x2887fa[_0xfdbc('0xa6')],'\x20Queue',_0x4ac656[_0xfdbc('0x24')],_0xfdbc('0x68'),_0x4ac656[_0xfdbc('0xa4')]);delete this[_0xfdbc('0x13')][_0x13821d[_0xfdbc('0xa0')]];break;case'BUSY':_0x4ac656[_0xfdbc('0x33')]+=0x1;_0x2887fa[_0xfdbc('0xb3')]+=0x1;_0x2887fa[_0xfdbc('0x97')]=ut['totalGlobal'](_0x2887fa);ut[_0xfdbc('0x86')](_0x2887fa,0x5,_0xfdbc('0xb4'));ami[_0xfdbc('0x22')]('custom:agentbusy',ut[_0xfdbc('0x9a')](_0x2887fa,'busy'));rpcDb['createCustomerHistory'](_0x2887fa,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xfdbc('0x98')](_0x2887fa)>=_0x4ac656[_0xfdbc('0xb5')]){_0x38ea6f=ut['cloneAction'](_0x2887fa,0xf,_0xfdbc('0x9c'));rpcDb[_0xfdbc('0x8e')](_0x38ea6f,_0xfdbc('0xb6'));}else{if(_0x2887fa[_0xfdbc('0xb3')]>=_0x4ac656['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x2887fa,_0xfdbc('0xb7'));}else{rpcDb[_0xfdbc('0xb8')](ut[_0xfdbc('0xb9')](_0x2887fa,_0xfdbc('0xb3'),_0x4ac656[_0xfdbc('0xba')]),_0x2887fa[_0xfdbc('0xbb')],_0x2887fa['activeContact']);}}break;case _0xfdbc('0xbc'):_0x4ac656['outboundNoAnswerCallsDay']+=0x1;_0x2887fa[_0xfdbc('0xbd')]+=0x1;_0x2887fa['countglobal']=ut[_0xfdbc('0x98')](_0x2887fa);ut[_0xfdbc('0x86')](_0x2887fa,0x3,_0xfdbc('0xbe'));ami[_0xfdbc('0x22')](_0xfdbc('0xbf'),ut[_0xfdbc('0x9a')](_0x2887fa,_0xfdbc('0xc0')));rpcDb[_0xfdbc('0x8c')](_0x2887fa,_0xfdbc('0xc1'));if(ut[_0xfdbc('0x98')](_0x2887fa)>=_0x4ac656[_0xfdbc('0xb5')]){_0x38ea6f=ut['cloneAction'](_0x2887fa,0xf,_0xfdbc('0x9c'));rpcDb[_0xfdbc('0x8e')](_0x38ea6f,_0xfdbc('0xc2'));}else{if(_0x2887fa['countnoanswerretry']>=_0x4ac656[_0xfdbc('0xc3')]){rpcDb[_0xfdbc('0x8e')](_0x2887fa,_0xfdbc('0xc1'));}else{rpcDb['rescheduleContact'](ut[_0xfdbc('0xb9')](_0x2887fa,_0xfdbc('0xbd'),_0x4ac656['dialNoAnswerRetryFrequency']),_0x2887fa[_0xfdbc('0xbb')],_0x2887fa[_0xfdbc('0x9f')]);}}break;case _0xfdbc('0xc4'):_0x4ac656['outboundCongestionCallsDay']+=0x1;_0x2887fa['countcongestionretry']+=0x1;_0x2887fa[_0xfdbc('0x97')]=ut[_0xfdbc('0x98')](_0x2887fa);ut['logCustomer'](_0x2887fa,0x8,_0xfdbc('0xc5'));ami[_0xfdbc('0x22')](_0xfdbc('0xc6'),ut[_0xfdbc('0x9a')](_0x2887fa,_0xfdbc('0xc7')));rpcDb[_0xfdbc('0x8c')](_0x2887fa,_0xfdbc('0xc8'));if(ut[_0xfdbc('0x98')](_0x2887fa)>=_0x4ac656[_0xfdbc('0xb5')]){_0x38ea6f=ut['cloneAction'](_0x2887fa,0xf,_0xfdbc('0x9c'));rpcDb[_0xfdbc('0x8e')](_0x38ea6f,_0xfdbc('0xc9'));}else{if(_0x2887fa[_0xfdbc('0xca')]>=_0x4ac656[_0xfdbc('0xcb')]){rpcDb[_0xfdbc('0x8e')](_0x2887fa,_0xfdbc('0xc8'));}else{rpcDb[_0xfdbc('0xb8')](ut[_0xfdbc('0xb9')](_0x2887fa,_0xfdbc('0xca'),_0x4ac656[_0xfdbc('0xba')]),_0x2887fa[_0xfdbc('0xbb')],_0x2887fa[_0xfdbc('0x9f')]);}}break;case _0xfdbc('0xcc'):_0x4ac656[_0xfdbc('0x3b')]+=0x1;_0x2887fa[_0xfdbc('0xcd')]+=0x1;_0x2887fa[_0xfdbc('0x97')]=ut['totalGlobal'](_0x2887fa);ut[_0xfdbc('0x86')](_0x2887fa,0x14,_0xfdbc('0xce'));ami[_0xfdbc('0x22')](_0xfdbc('0xcf'),ut['buildObj'](_0x2887fa,'agentreject'));rpcDb[_0xfdbc('0x8c')](_0x2887fa,_0xfdbc('0xd0'));if(ut[_0xfdbc('0x98')](_0x2887fa)>=_0x4ac656[_0xfdbc('0xb5')]){_0x38ea6f=ut[_0xfdbc('0xd1')](_0x2887fa,0x14,_0xfdbc('0xce'));rpcDb['createCustomerFinal'](_0x38ea6f,_0xfdbc('0xd2'));}else{if(_0x2887fa[_0xfdbc('0xcd')]>=_0x4ac656[_0xfdbc('0xd3')]){rpcDb[_0xfdbc('0x8e')](_0x2887fa,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xfdbc('0xb8')](ut[_0xfdbc('0xb9')](_0x2887fa,_0xfdbc('0xcd'),_0x4ac656[_0xfdbc('0xd4')]),_0x2887fa[_0xfdbc('0xbb')],_0x2887fa[_0xfdbc('0x9f')]);}}break;case _0xfdbc('0xd5'):_0x4ac656['outboundAbandonedCallsDay']+=0x1;_0x2887fa[_0xfdbc('0xd6')]+=0x1;_0x2887fa[_0xfdbc('0x97')]=ut[_0xfdbc('0x98')](_0x2887fa);ut['logCustomer'](_0x2887fa,0xb,_0xfdbc('0xd7'));rpcDb[_0xfdbc('0x8c')](_0x2887fa,_0xfdbc('0xd8'));if(ut[_0xfdbc('0x98')](_0x2887fa)>=_0x4ac656[_0xfdbc('0xb5')]){_0x38ea6f=ut[_0xfdbc('0xd1')](_0x2887fa,0xf,_0xfdbc('0x9c'));rpcDb[_0xfdbc('0x8e')](_0x38ea6f,_0xfdbc('0xd8'));}else{if(_0x2887fa[_0xfdbc('0xd9')]>=_0x4ac656['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x2887fa,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xfdbc('0xb9')](_0x2887fa,_0xfdbc('0xd6'),_0x4ac656['dialAbandonedRetryFrequency']),_0x2887fa[_0xfdbc('0xbb')],_0x2887fa['activeContact']);}}break;case'18':_0x4ac656[_0xfdbc('0xda')]+=0x1;_0x2887fa[_0xfdbc('0xdb')]+=0x1;_0x2887fa[_0xfdbc('0x97')]=ut[_0xfdbc('0x98')](_0x2887fa);ut[_0xfdbc('0x86')](_0x2887fa,0x12,_0x13821d[_0xfdbc('0xdc')]||_0x13821d[_0xfdbc('0xdd')]);ami['emit'](_0xfdbc('0xde'),ut[_0xfdbc('0x9a')](_0x2887fa,_0xfdbc('0xdf')));rpcDb[_0xfdbc('0x8c')](_0x2887fa,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xfdbc('0x98')](_0x2887fa)>=_0x4ac656[_0xfdbc('0xb5')]){_0x38ea6f=ut[_0xfdbc('0xd1')](_0x2887fa,0xf,_0xfdbc('0x9c'));rpcDb[_0xfdbc('0x8e')](_0x38ea6f,_0xfdbc('0xe0'));}else{rpcDb[_0xfdbc('0x8e')](_0x2887fa,_0xfdbc('0xe0'));}delete this['actions'][_0x13821d[_0xfdbc('0xa0')]];break;case'19':_0x4ac656['outboundUnknownCallsDay']+=0x1;_0x2887fa[_0xfdbc('0x97')]=ut['totalGlobal'](_0x2887fa);ut[_0xfdbc('0x86')](_0x2887fa,0x13,_0x13821d[_0xfdbc('0xdc')]||_0x13821d['dialstatus']);ami[_0xfdbc('0x22')]('custom:amd',ut[_0xfdbc('0x9a')](_0x2887fa,_0xfdbc('0xdf')));rpcDb['createCustomerHistory'](_0x2887fa,_0xfdbc('0xe1'));if(ut[_0xfdbc('0x98')](_0x2887fa)>=_0x4ac656['dialGlobalMaxRetry']){_0x38ea6f=ut[_0xfdbc('0xd1')](_0x2887fa,0xf,_0xfdbc('0x9c'));rpcDb[_0xfdbc('0x8e')](_0x38ea6f,_0xfdbc('0xe1'));}else{rpcDb[_0xfdbc('0x8e')](_0x2887fa,_0xfdbc('0xe1'));}delete this[_0xfdbc('0x13')][_0x13821d['linkedid']];break;default:if(_0x2887fa[_0xfdbc('0x69')]){ut[_0xfdbc('0x71')](_0x4ac656,_0xfdbc('0xe2'));ut[_0xfdbc('0x72')](_0xfdbc('0xe3')+_0x4ac656['name'],_0x13821d);}_0x4ac656[_0xfdbc('0xda')]+=0x1;_0x2887fa[_0xfdbc('0x97')]=ut[_0xfdbc('0x98')](_0x2887fa);ut[_0xfdbc('0x86')](_0x2887fa,0xc,_0x13821d[_0xfdbc('0xdc')]||_0x13821d[_0xfdbc('0xdd')]);rpcDb[_0xfdbc('0x8c')](_0x2887fa,_0xfdbc('0xe4'));if(ut[_0xfdbc('0x98')](_0x2887fa)>=_0x4ac656[_0xfdbc('0xb5')]){_0x38ea6f=ut[_0xfdbc('0xd1')](_0x2887fa,0xf,'Global');rpcDb[_0xfdbc('0x8e')](_0x38ea6f,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xfdbc('0x8e')](_0x2887fa,_0xfdbc('0xe5'));}delete this[_0xfdbc('0x13')][_0x13821d[_0xfdbc('0xa0')]];}if(!(_0x2887fa[_0xfdbc('0x69')]&&_0x2af077==='16')){ut[_0xfdbc('0x6f')](_0x4ac656,_0xfdbc('0xe6'));logger['info'](_0xfdbc('0xe7'),_0x2887fa['uniqueid'],_0xfdbc('0xa7'),_0x4ac656[_0xfdbc('0x24')],_0xfdbc('0xe8'),_0x4ac656[_0xfdbc('0x47')]);}if(_0x2af077!==_0xfdbc('0xa1')){delete this[_0xfdbc('0x13')][_0x13821d[_0xfdbc('0xa0')]];delete this[_0xfdbc('0x13')][_0x13821d[_0xfdbc('0xe9')]];}}};Preview[_0xfdbc('0x5b')]['callProgressDetectingAgent']=function(_0x273ab7,_0x2070f6,_0x826a09){if(_['isUndefined'](_0x2070f6)&&_0xfdbc('0xea')!==typeof _0x2070f6){return;}if(_['isUndefined'](_0x826a09)&&'object'!==typeof _0x826a09){return;}switch(_0x826a09[_0xfdbc('0xeb')]){case'0':ut[_0xfdbc('0xec')](_0x273ab7,0x0,_0xfdbc('0x99'));rpcDb[_0xfdbc('0xed')](_0x273ab7,_0xfdbc('0xee'));break;case'3':ut[_0xfdbc('0xec')](_0x273ab7,0x3,'NoAnswer');rpcDb[_0xfdbc('0xed')](_0x273ab7,_0xfdbc('0xef'));break;case'5':ut['logAgent'](_0x273ab7,0x5,_0xfdbc('0xb4'));rpcDb[_0xfdbc('0xed')](_0x273ab7,_0xfdbc('0xf0'));break;case'8':ut['logAgent'](_0x273ab7,0x8,'Congestion');rpcDb['createAgentHistory'](_0x273ab7,_0xfdbc('0xf1'));break;case'22':ut['logAgent'](_0x273ab7,0x16,_0xfdbc('0xf2'));rpcDb[_0xfdbc('0xed')](_0x273ab7,_0xfdbc('0xf3'));break;default:ut[_0xfdbc('0xec')](_0x273ab7,0xc,_0x826a09[_0xfdbc('0xeb')]);rpcDb['createAgentHistory'](_0x273ab7,_0xfdbc('0xf1'));}ut[_0xfdbc('0x6f')](_0x2070f6,_0xfdbc('0xf4'));logger[_0xfdbc('0x51')](_0xfdbc('0xf5'),_0x273ab7[_0xfdbc('0xa6')],_0xfdbc('0xa7'),_0x2070f6[_0xfdbc('0x24')],_0xfdbc('0xe8'),_0x2070f6['originated']);delete this[_0xfdbc('0x13')][_0x273ab7[_0xfdbc('0xa6')]];};Preview[_0xfdbc('0x5b')]['checkInBlack']=function(_0x4314e5,_0x38ff76,_0x3049b7,_0x4f00c8,_0x4f4f70){var _0x2297e4=this;return new BPromise(function(_0x9c1980,_0x5d8d85){if(_[_0xfdbc('0x65')](_0x38ff76)||_[_0xfdbc('0x65')](_0x38ff76['Contact'])||_[_0xfdbc('0x65')](_0x38ff76[_0xfdbc('0xf6')][_0xfdbc('0xf7')])||_[_0xfdbc('0x65')](_0x38ff76[_0xfdbc('0xf8')])){_0x5d8d85(ut[_0xfdbc('0x46')](_0xfdbc('0xf9'),_0x4f00c8,_0x4f4f70));return;}var _0x2e8f08=uuid['v4']();var _0x5b8e29=_0x2297e4[_0xfdbc('0x10')][_0x38ff76[_0xfdbc('0xfa')][_0xfdbc('0x24')]];var _0xc752ac=_0x3049b7?_0x2297e4['agents'][_0x3049b7]['id']:undefined;_0x2297e4['actions'][_0x2e8f08]=new Action(_0x38ff76,_0x5b8e29,_0x2e8f08,_0x3049b7,_0xc752ac);var _0x4b2a28=_0x2297e4[_0xfdbc('0x13')][_0x2e8f08];_0x4b2a28['unlockAgent']=_0x4f00c8;_0x4b2a28['activeContact']=_0x4f4f70;_0x4b2a28[_0xfdbc('0xfb')]=_0x3049b7;if(_[_0xfdbc('0xfc')](_0x4314e5)){_0x2297e4[_0xfdbc('0xfd')](_0x4b2a28,_0x5b8e29,_0x38ff76,_0x3049b7)[_0xfdbc('0x79')](function(_0x882df9){logger['info']('[Preview][execCall][success]',_0xfdbc('0xfe')+_0x4b2a28[_0xfdbc('0x67')]+_0xfdbc('0xff')+_0x4b2a28[_0xfdbc('0x100')],JSON[_0xfdbc('0x53')](_0x882df9));ami[_0xfdbc('0x22')]('custom:agentcalled',ut['buildObj'](_0x4b2a28,_0xfdbc('0x101'),_0x2297e4[_0xfdbc('0x10')][_0x4b2a28[_0xfdbc('0x67')]]));_0x9c1980(ut[_0xfdbc('0x46')](_0xfdbc('0x102')));})[_0xfdbc('0x81')](function(_0x4195cc){ut[_0xfdbc('0x58')]('[Preview][execCall][failure]',_0x4195cc);_0x5d8d85(ut['message'](_0xfdbc('0x103'),_0x4f00c8,_0x4f4f70));});}else{_0x5b8e29[_0xfdbc('0x32')]+=0x1;ut[_0xfdbc('0x104')](_0x4b2a28);rpcDb[_0xfdbc('0x105')](_0x4b2a28,_0xfdbc('0x106'));delete _0x2297e4[_0xfdbc('0x13')][_0x2e8f08];_0x5d8d85(ut[_0xfdbc('0x46')](_0xfdbc('0x107'),_0x4f00c8,_0x4f4f70));}});};Preview[_0xfdbc('0x5b')][_0xfdbc('0x92')]=function(_0x50deaa){return!_[_0xfdbc('0x65')](_0x50deaa)&&!_[_0xfdbc('0x65')](_0x50deaa[_0xfdbc('0x24')])&&!_[_0xfdbc('0x65')](_0x50deaa[_0xfdbc('0x4e')])&&_0x50deaa[_0xfdbc('0x4e')]&&!_[_0xfdbc('0x65')](this[_0xfdbc('0x12')][util[_0xfdbc('0x84')]('SIP/%s',_0x50deaa[_0xfdbc('0x24')])])&&!_[_0xfdbc('0x65')](this[_0xfdbc('0x12')][util[_0xfdbc('0x84')]('SIP/%s',_0x50deaa['name'])][_0xfdbc('0x6d')])&&(this[_0xfdbc('0x12')][util[_0xfdbc('0x84')](_0xfdbc('0x108'),_0x50deaa['name'])][_0xfdbc('0x6d')]===_0xfdbc('0x109')||this['trunks'][util[_0xfdbc('0x84')](_0xfdbc('0x108'),_0x50deaa[_0xfdbc('0x24')])][_0xfdbc('0x6d')]===_0xfdbc('0x10a'));};Preview[_0xfdbc('0x5b')][_0xfdbc('0x10b')]=function(_0x3a7070,_0x357dd1){var _0x1375ea=this;return new BPromise(function(_0x363b56,_0x6c051f){_0x1375ea[_0xfdbc('0x10c')](_0x3a7070,_0x357dd1)[_0xfdbc('0x79')](function(_0x2fbc9a){_0x363b56(_['pick'](_0x2fbc9a,[_0xfdbc('0x46')]));})[_0xfdbc('0x81')](function(_0x16c713){if(_0x16c713[_0xfdbc('0x10d')]){rpcDb['unlockContact'](_0x3a7070);}if(_0x16c713[_0xfdbc('0x4e')]){rpcDb[_0xfdbc('0x82')](_0x3a7070);}_0x6c051f(_[_0xfdbc('0x10e')](_0x16c713,[_0xfdbc('0x46')]));});});};Preview[_0xfdbc('0x5b')]['execRun']=function(_0x55d908,_0x22d1b4){var _0x49465f=this;return new BPromise(function(_0x103c1d,_0x12b510){var _0xa9d3a9,_0x11ad0d;rpcDb[_0xfdbc('0x10f')](_0x55d908)[_0xfdbc('0x79')](function(_0x3175ff){if(!_[_0xfdbc('0x65')](_0x3175ff[0x0])){_0x11ad0d=_0x3175ff[0x0][_0xfdbc('0x110')]?![]:!![];_0xa9d3a9=_0x3175ff[0x0][_0xfdbc('0x110')]?!![]:![];_0xa9d3a9=_0x22d1b4?!![]:_0xa9d3a9;}var _0xc0bc30=_0x49465f[_0xfdbc('0x111')](_0x3175ff);if(_0xc0bc30[_0xfdbc('0x112')]){rpcDb[_0xfdbc('0x113')](_[_0xfdbc('0x10e')](_0x3175ff[0x0],[_0xfdbc('0xf8'),_0xfdbc('0x114')]))['then'](function(_0x568bb2){_0x49465f[_0xfdbc('0x115')](_0x568bb2,_0x3175ff[0x0],_0x22d1b4,_0x11ad0d,_0xa9d3a9)[_0xfdbc('0x79')](function(_0x1fd07a){_0x103c1d(_0x1fd07a);})['catch'](function(_0x444dd3){_0x12b510(_0x444dd3);});})['catch'](function(_0x5e024d){ut[_0xfdbc('0x58')](_0xfdbc('0x116'),_0x5e024d);_0x12b510(ut[_0xfdbc('0x46')]('Call\x20unsuccessful',_0x11ad0d,_0xa9d3a9));});}else{_0x12b510(ut[_0xfdbc('0x46')](_0xc0bc30[_0xfdbc('0x46')],_0x11ad0d,_0xa9d3a9));}})[_0xfdbc('0x81')](function(_0x442c7a){ut[_0xfdbc('0x58')]('[Preview][getContactPreview]',_0x442c7a);_0x12b510(ut['message'](_0xfdbc('0x117'),![],!![]));});});};Preview['prototype'][_0xfdbc('0x111')]=function(_0x3da522){if(_[_0xfdbc('0x65')](_0x3da522)||_[_0xfdbc('0xfc')](_0x3da522)||!_[_0xfdbc('0x65')](_0x3da522[0x0]['Agent'])&&_['isNil'](_0x3da522[0x0][_0xfdbc('0x7d')][_0xfdbc('0x24')])){ut[_0xfdbc('0x58')](_0xfdbc('0x118'),_0x3da522);return{'isValid':![],'message':_0xfdbc('0x119')};}var _0x39a410=this[_0xfdbc('0x10')][_0x3da522[0x0][_0xfdbc('0xfa')][_0xfdbc('0x24')]];_0x39a410[_0xfdbc('0x46')]=_0xfdbc('0x95');if(_['isNil'](_0x39a410)){ut[_0xfdbc('0x58')](_0xfdbc('0x11a'),_0x39a410);return{'isValid':![],'message':_0xfdbc('0x11b')};}if(!this[_0xfdbc('0x92')](_0x39a410[_0xfdbc('0x4d')])){ut['logger'](_0xfdbc('0x11c'),_0xfdbc('0x11d')+_0x39a410['name']+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x39a410[_0xfdbc('0x93')])){ut[_0xfdbc('0x58')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x39a410[_0xfdbc('0x24')]+_0xfdbc('0x11e'));return{'isValid':![],'message':_0xfdbc('0x11f')};}}if(!ut[_0xfdbc('0x91')](_0x39a410[_0xfdbc('0x2c')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x39a410['name']+_0xfdbc('0x120'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x39a410[_0xfdbc('0x24')]+_0xfdbc('0x120')};}return{'isValid':!![],'message':_0xfdbc('0x121')};};Preview[_0xfdbc('0x5b')][_0xfdbc('0xfd')]=function(_0x1ab144,_0x1923dc,_0x27bac7,_0x304a16){var _0x5dc0a4=this;return new BPromise(function(_0xe7443e,_0x5bd056){var _0xc56ea0=_0x1ab144[_0xfdbc('0xa6')];var _0x31361=_0x5dc0a4[_0xfdbc('0x92')](_0x1923dc['Trunk'])?util[_0xfdbc('0x84')](_0xfdbc('0x122'),_0x1923dc[_0xfdbc('0x4d')][_0xfdbc('0x24')],_[_0xfdbc('0x65')](_0x1923dc['dialPrefix'])?'':_0x1923dc['dialPrefix'][_0xfdbc('0x123')]()||'',_0x1923dc[_0xfdbc('0x124')]>0x0?_0x27bac7[_0xfdbc('0xf6')]['phone']['substring'](_0x1923dc[_0xfdbc('0x124')]):_0x27bac7[_0xfdbc('0xf6')][_0xfdbc('0xf7')]):util['format']('SIP/%s/%s%s',_[_0xfdbc('0x65')](_0x1923dc['TrunkBackup'])?_0x1923dc[_0xfdbc('0x4d')][_0xfdbc('0x24')]:_0x1923dc[_0xfdbc('0x93')][_0xfdbc('0x24')],_[_0xfdbc('0x65')](_0x1923dc[_0xfdbc('0x125')])?'':_0x1923dc[_0xfdbc('0x125')]['trim']()||'',_0x1923dc[_0xfdbc('0x124')]>0x0?_0x27bac7[_0xfdbc('0xf6')]['phone'][_0xfdbc('0x126')](_0x1923dc[_0xfdbc('0x124')]):_0x27bac7['Contact'][_0xfdbc('0xf7')]);var _0x3c9001=_0x5dc0a4[_0xfdbc('0x92')](_0x1923dc[_0xfdbc('0x4d')])?ut[_0xfdbc('0x127')](_0x1923dc[_0xfdbc('0x4d')][_0xfdbc('0x128')],_0x1923dc[_0xfdbc('0x2e')],_0x1923dc[_0xfdbc('0x129')]>0x0?ut['getCallerIdRandom'](_0x1923dc['dialOriginateCallerIdNumber'],_0x1923dc[_0xfdbc('0x129')]):_0x1923dc[_0xfdbc('0x2f')]):ut[_0xfdbc('0x127')](_[_0xfdbc('0x65')](_0x1923dc[_0xfdbc('0x93')])?_0x1923dc['Trunk'][_0xfdbc('0x128')]:_0x1923dc['TrunkBackup'][_0xfdbc('0x128')],_0x1923dc[_0xfdbc('0x2e')],_0x1923dc['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xfdbc('0x12a')](_0x1923dc[_0xfdbc('0x2f')],_0x1923dc[_0xfdbc('0x129')]):_0x1923dc[_0xfdbc('0x2f')]);if(_0x3c9001){_0x1ab144[_0xfdbc('0x12b')]=ut[_0xfdbc('0x12c')](_0x3c9001);_0x1ab144['originatecalleridnum']=ut[_0xfdbc('0x12d')](_0x3c9001);}var _0x438abf=ut[_0xfdbc('0x12e')](_0x1923dc,_0x27bac7,_0x31361,_0x3c9001,_0xc56ea0,_0x1ab144);_[_0xfdbc('0x12f')](_0x1ab144,ut[_0xfdbc('0x130')](_0x438abf));_0x1ab144[_0xfdbc('0x83')]=moment()[_0xfdbc('0x84')](_0xfdbc('0x85'));ami[_0xfdbc('0x6c')](ut[_0xfdbc('0x131')](_0x1ab144,_0x1923dc,_0x438abf,_0x1ab144[_0xfdbc('0x9f')],_0x304a16))[_0xfdbc('0x79')](function(_0x2c04cb){_0x1923dc[_0xfdbc('0x47')]+=0x1;logger[_0xfdbc('0x51')](_0xfdbc('0x132'),_0xc56ea0,_0xfdbc('0xa7'),_0x1923dc['name'],_0xfdbc('0xe8'),_0x1923dc[_0xfdbc('0x47')]);_0xe7443e(_0x2c04cb);})[_0xfdbc('0x81')](function(_0x2fa7e5){ut[_0xfdbc('0xec')](_0x1ab144,0xe,_0xfdbc('0x133'));rpcDb[_0xfdbc('0xed')](_0x1ab144,'[originateFailure][logOriginateFailure]');_0x5bd056(_0x2fa7e5);});});};Preview[_0xfdbc('0x5b')][_0xfdbc('0x134')]=function(_0x37054b){if(this['actions'][_0x37054b[_0xfdbc('0xa0')]]){this[_0xfdbc('0x13')][_0x37054b[_0xfdbc('0xa0')]]['channel']=_0x37054b[_0xfdbc('0x135')];}};Preview[_0xfdbc('0x5b')][_0xfdbc('0x17')]=function(_0x54b5a0){var _0x5cae69=this;var _0x16550e=this[_0xfdbc('0x13')][_0x54b5a0['actionid']];if(_0x16550e){if(_0x16550e[_0xfdbc('0xfb')]&&this[_0xfdbc('0x14')][_0x16550e[_0xfdbc('0xfb')]]){ut[_0xfdbc('0x136')](_0x16550e,this['agents'][_0x16550e[_0xfdbc('0xfb')]][_0xfdbc('0x24')],this[_0xfdbc('0x14')][_0x16550e[_0xfdbc('0xfb')]]['id']);}var _0x3116b9=_[_0xfdbc('0x137')](_0x16550e);_0x3116b9[_0xfdbc('0xa2')]=moment()[_0xfdbc('0x84')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2681c0=_0x5cae69[_0xfdbc('0x10')][_0x16550e[_0xfdbc('0x67')]];if(ut[_0xfdbc('0x138')](_0x54b5a0['response'])){if(_0x16550e[_0xfdbc('0xbb')]){rpcDb[_0xfdbc('0x139')](_0x16550e[_0xfdbc('0x100')]);}if(_0x16550e[_0xfdbc('0x9f')]){rpcDb[_0xfdbc('0x82')](_0x16550e['idContact']);}ami[_0xfdbc('0x22')]('custom:agentringnoanswer',ut['buildObj'](_0x16550e,_0xfdbc('0x13a'),this[_0xfdbc('0x10')][_0x16550e[_0xfdbc('0x67')]]));this[_0xfdbc('0x13b')](_0x3116b9,_0x2681c0,_0x54b5a0);}else{_0x16550e[_0xfdbc('0x83')]=moment()[_0xfdbc('0x84')](_0xfdbc('0x85'));ut[_0xfdbc('0xec')](_0x3116b9,0x4,_0xfdbc('0x13c'));rpcDb[_0xfdbc('0xed')](_0x3116b9,_0xfdbc('0x13d'));}}};Preview['prototype']['syncHangup']=function(_0x259534){var _0x5aff49=this;var _0x559d62=this[_0xfdbc('0x13')][_0x259534[_0xfdbc('0xa0')]];var _0x184fc9;if(_0x559d62){_0x184fc9=this['campaignsPreview'][_0x559d62[_0xfdbc('0x67')]];logger['info']('[syncHangup][talking]',_0x259534[_0xfdbc('0xa0')],_0xfdbc('0xa7'),_0x184fc9['name'],'pTalking:\x20',_0x184fc9[_0xfdbc('0xa4')]);}if(this[_0xfdbc('0x13')][_0x259534[_0xfdbc('0xa0')]]&&_0x259534[_0xfdbc('0xa0')]!==_0x259534[_0xfdbc('0xa6')]){if(_0x259534[_0xfdbc('0x13e')]==='16'&&this['actions'][_0x259534[_0xfdbc('0xa0')]][_0xfdbc('0x69')]){this['callProgressDetectingCustomer'](_0x259534,_0x259534[_0xfdbc('0xa0')],_0x259534['cause']);}else if(this[_0xfdbc('0x13')][_0x259534[_0xfdbc('0xa0')]][_0xfdbc('0x69')]){logger[_0xfdbc('0x51')](_0xfdbc('0x13f'),_0x259534['linkedid'],_0x259534[_0xfdbc('0x13e')],_0xfdbc('0xa7'),_0x184fc9[_0xfdbc('0x24')],_0xfdbc('0x68'),_0x184fc9[_0xfdbc('0xa4')]);this['callProgressDetectingCustomer'](_0x259534,_0x259534[_0xfdbc('0xa0')],_0x259534[_0xfdbc('0x13e')]);}}else if(_0x559d62&&_['isNil'](_0x559d62[_0xfdbc('0x140')])&&_0x184fc9[_0xfdbc('0x141')]&&_0x259534[_0xfdbc('0xa0')]===_0x259534['uniqueid']&&_['isNil'](_0x259534[_0xfdbc('0xeb')])&&_0x259534[_0xfdbc('0x13e')]==='16'&&_0x259534[_0xfdbc('0x142')]==='6'&&_[_0xfdbc('0x143')](_0x559d62['transfer'])){if(_0x559d62[_0xfdbc('0xbb')]){rpcDb[_0xfdbc('0x139')](_0x559d62[_0xfdbc('0x100')]);}if(_0x559d62['activeContact']){rpcDb[_0xfdbc('0x82')](_0x559d62['idContact']);}_0x259534[_0xfdbc('0xeb')]='22';this[_0xfdbc('0x13b')](_0x559d62,_0x184fc9,_0x259534);}else if(_0x559d62&&_0x559d62[_0xfdbc('0x144')]){if(_0x259534[_0xfdbc('0x13e')]==='16'&&this[_0xfdbc('0x13')][_0x259534[_0xfdbc('0xa0')]][_0xfdbc('0x69')]){logger[_0xfdbc('0x51')](_0xfdbc('0x145'),_0x259534[_0xfdbc('0xa0')],_0x259534[_0xfdbc('0x13e')],_0xfdbc('0xa7'),_0x184fc9[_0xfdbc('0x24')],'pTalking:\x20',_0x184fc9['pTalking']);this[_0xfdbc('0x96')](_0x259534,_0x259534[_0xfdbc('0xa0')],_0x259534[_0xfdbc('0x13e')]);}else if(this[_0xfdbc('0x13')][_0x259534['linkedid']][_0xfdbc('0x69')]){logger[_0xfdbc('0x51')](_0xfdbc('0x13f'),_0x259534['linkedid'],_0x259534['cause'],_0xfdbc('0xa7'),_0x184fc9[_0xfdbc('0x24')],_0xfdbc('0x68'),_0x184fc9[_0xfdbc('0xa4')]);this[_0xfdbc('0x96')](_0x259534,_0x259534['linkedid'],_0x259534[_0xfdbc('0x13e')]);}}};Preview[_0xfdbc('0x5b')][_0xfdbc('0x146')]=function(_0x33c936){if(this[_0xfdbc('0x13')][_0x33c936[_0xfdbc('0xe9')]]&&_0x33c936[_0xfdbc('0xe9')]!==_0x33c936[_0xfdbc('0x147')]){this[_0xfdbc('0x96')](_0x33c936,_0x33c936[_0xfdbc('0xe9')],_0x33c936['dialstatus']);}};Preview[_0xfdbc('0x5b')][_0xfdbc('0x1a')]=function(_0x1b3e9d){if(this[_0xfdbc('0x13')][_0x1b3e9d[_0xfdbc('0xa0')]]&&_0x1b3e9d[_0xfdbc('0xa0')]!==_0x1b3e9d['uniqueid']&&!this[_0xfdbc('0x13')][_0x1b3e9d[_0xfdbc('0xa0')]][_0xfdbc('0x69')]){if(_0x1b3e9d[_0xfdbc('0x13e')]==='1'){this['callProgressDetectingCustomer'](_0x1b3e9d,_0x1b3e9d[_0xfdbc('0xa0')],_0x1b3e9d['cause']);}}};Preview[_0xfdbc('0x5b')]['addVariable']=function(_0x2127c2,_0x10a10b,_0x136856){if(this[_0xfdbc('0x13')][_0x2127c2]){if(_[_0xfdbc('0x65')](this[_0xfdbc('0x13')][_0x2127c2][_0xfdbc('0x148')])){this[_0xfdbc('0x13')][_0x2127c2]['variables']={};}this[_0xfdbc('0x13')][_0x2127c2][_0xfdbc('0x148')][_0x10a10b]=_0x136856;}};Preview['prototype'][_0xfdbc('0x149')]=function(_0x944b6c){try{if(!_[_0xfdbc('0x65')](_0x944b6c)){if(ut[_0xfdbc('0x14a')](_[_0xfdbc('0x14b')](_0x944b6c['variable'])[0x0])){this[_0xfdbc('0x14c')](_0x944b6c[_0xfdbc('0xa6')],_[_0xfdbc('0x14b')](_0x944b6c[_0xfdbc('0x14d')])[0x0],_0x944b6c[_0xfdbc('0x14e')]);}}}catch(_0x1e6bd9){logger['error'](_0xfdbc('0x14f'),util[_0xfdbc('0x150')](_0x1e6bd9,{'showHidden':![],'depth':null}));}};Preview[_0xfdbc('0x5b')][_0xfdbc('0x1e')]=function(_0x5dec28){if(_0x5dec28){if(this[_0xfdbc('0x13')][_0x5dec28[_0xfdbc('0x151')]]){this[_0xfdbc('0x13')][_0x5dec28['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xfdbc('0x5b')]['syncBlindTransfer']=function(_0x301b80){if(_0x301b80){if(this['actions'][_0x301b80[_0xfdbc('0x152')]]){this[_0xfdbc('0x13')][_0x301b80[_0xfdbc('0x152')]][_0xfdbc('0x144')]=!![];}}};module[_0xfdbc('0x153')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 86969fc..2eff5e0 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 _0x552e=['../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','then','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','active','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird'];(function(_0x820843,_0x4b6f7e){var _0x2077c2=function(_0x26e103){while(--_0x26e103){_0x820843['push'](_0x820843['shift']());}};_0x2077c2(++_0x4b6f7e);}(_0x552e,0x194));var _0xe552=function(_0x5ae15b,_0x26719c){_0x5ae15b=_0x5ae15b-0x0;var _0x487881=_0x552e[_0x5ae15b];return _0x487881;};'use strict';var util=require(_0xe552('0x0'));var BPromise=require(_0xe552('0x1'));var logger=require(_0xe552('0x2'))(_0xe552('0x3'));var _=require(_0xe552('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xe552('0x5'));var cmHopperHistory=require(_0xe552('0x6'));var cmHopperBlack=require(_0xe552('0x7'));var voiceQueueRt=require(_0xe552('0x8'));var agentReportPreview=require(_0xe552('0x9'));var voiceQueueReport=require(_0xe552('0xa'));function loggerCatch(_0x2a7d28){return function(_0xf2661b){logger[_0xe552('0xb')](_0x2a7d28,util[_0xe552('0xc')](_0xf2661b,{'showHidden':![],'depth':null}));};}function create(_0x504a36){return BPromise[_0xe552('0xd')]()['then'](cmHopperHistory[_0xe552('0xe')](_0x504a36))[_0xe552('0xf')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1d6395){return BPromise[_0xe552('0xd')]()[_0xe552('0x10')](agentReportPreview[_0xe552('0xe')](_0x1d6395))['catch'](loggerCatch(_0xe552('0x11')));}function moveContact(_0x5b0b25){return BPromise[_0xe552('0xd')]()[_0xe552('0x10')](cmHopper['moveContactManagedDialer'](_0x5b0b25,!![]))[_0xe552('0xf')](loggerCatch(_0xe552('0x12')));}exports[_0xe552('0x13')]=function(_0x3219b1){return BPromise[_0xe552('0xd')]()[_0xe552('0x10')](cmHopperBlack['checkIsBlackList'](_0x3219b1))[_0xe552('0xf')](loggerCatch(_0xe552('0x14')));};exports[_0xe552('0x15')]=function(_0x131813){return BPromise[_0xe552('0xd')]()['then'](cmHopper[_0xe552('0x15')](_0x131813))[_0xe552('0xf')](loggerCatch(_0xe552('0x16')));};exports['createHistory']=function(_0x32ab19,_0x1a6917){create(_0x32ab19)[_0xe552('0xf')](loggerCatch(_0x1a6917));moveContact(_0x32ab19)['catch'](loggerCatch(_0x1a6917));};exports[_0xe552('0x17')]=function(_0x42b6d8,_0x412a76){createAgent(_0x42b6d8)[_0xe552('0xf')](loggerCatch(_0x412a76));};exports['createCustomerHistory']=function(_0x2b0cd5,_0x30db33){create(_0x2b0cd5)['catch'](loggerCatch(_0x30db33));};exports[_0xe552('0x18')]=function(_0x50cf4c,_0x45fce9){moveContact(_0x50cf4c)[_0xe552('0xf')](loggerCatch(_0x45fce9));};exports['rescheduleContact']=function(_0x1fa559,_0x1bc3f1,_0x346f6e){if(_0x1bc3f1){_0x1fa559[_0xe552('0x19')]=null;}if(_0x346f6e){_0x1fa559[_0xe552('0x1a')]=![];}return BPromise['resolve']()[_0xe552('0x10')](cmHopper[_0xe552('0x1b')](_0x1fa559))[_0xe552('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xe552('0x1c')]=function(_0x38f202){return BPromise[_0xe552('0xd')]()['then'](cmHopper[_0xe552('0x1c')](_0x38f202))['catch'](loggerCatch(_0xe552('0x1d')));};exports[_0xe552('0x1e')]=function(_0x20528a){return BPromise['resolve']()[_0xe552('0x10')](cmHopper['unlockContact']({'UserId':null},_0x20528a,0x1))[_0xe552('0xf')](loggerCatch(_0xe552('0x1f')));};exports[_0xe552('0x20')]=function(_0x1ac3e6){return BPromise[_0xe552('0xd')]()['then'](cmHopper[_0xe552('0x1e')]({'active':![]},_0x1ac3e6,0x1))[_0xe552('0xf')](loggerCatch('[activeContact]\x20'));};exports[_0xe552('0x21')]=function(_0x3d5f01){var _0x4c688d={};_0x4c688d[_0xe552('0x22')]=_0x3d5f01[_0xe552('0x22')];_0x4c688d[_0xe552('0x23')]=_0x3d5f01['uniqueid'];_0x4c688d[_0xe552('0x24')]=_0x3d5f01[_0xe552('0x24')];_0x4c688d[_0xe552('0x25')]=_0x3d5f01[_0xe552('0x25')];_0x4c688d[_0xe552('0x26')]=_0x3d5f01[_0xe552('0x26')];_0x4c688d[_0xe552('0x27')]=_0x3d5f01[_0xe552('0x28')];_0x4c688d[_0xe552('0x29')]=_0x3d5f01['answertime'];_0x4c688d[_0xe552('0x2a')]=0x1;_0x4c688d[_0xe552('0x2b')]=_0x3d5f01[_0xe552('0x2c')];_0x4c688d[_0xe552('0x2d')]=_0x3d5f01[_0xe552('0x2e')];_0x4c688d['context']=_0xe552('0x2f');_0x4c688d['exten']=_0xe552('0x30');_0x4c688d[_0xe552('0x31')]=0x0;_0x4c688d[_0xe552('0x32')]=0x1;_0x4c688d[_0xe552('0x33')]=_0x3d5f01[_0xe552('0x2e')];_0x4c688d[_0xe552('0x34')]=_0xe552('0x35');return BPromise[_0xe552('0xd')]()['then'](voiceQueueReport['create'](_0x4c688d))[_0xe552('0xf')](loggerCatch(_0xe552('0x36')));};exports[_0xe552('0x37')]=function(_0xaf006,_0x575403){return BPromise[_0xe552('0xd')]()['then'](cmHopper[_0xe552('0x37')](_0xaf006,_0x575403))[_0xe552('0xf')](loggerCatch(_0xe552('0x38')));};exports[_0xe552('0x39')]=function(_0x298122){return BPromise[_0xe552('0xd')]()[_0xe552('0x10')](cmHopper[_0xe552('0x1b')](_0x298122,!![],!![]))[_0xe552('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xd648=['preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','moveContactManagedDialer','catch','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd648,0x17e));var _0x8d64=function(_0x1531dc,_0x172b13){_0x1531dc=_0x1531dc-0x0;var _0x301983=_0xd648[_0x1531dc];return _0x301983;};'use strict';var util=require(_0x8d64('0x0'));var BPromise=require(_0x8d64('0x1'));var logger=require(_0x8d64('0x2'))(_0x8d64('0x3'));var _=require(_0x8d64('0x4'));var cmHopper=require(_0x8d64('0x5'));var cmHopperFinal=require(_0x8d64('0x6'));var cmHopperHistory=require(_0x8d64('0x7'));var cmHopperBlack=require(_0x8d64('0x8'));var voiceQueueRt=require(_0x8d64('0x9'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x8d64('0xa'));function loggerCatch(_0x43f10e){return function(_0x1207d8){logger[_0x8d64('0xb')](_0x43f10e,util[_0x8d64('0xc')](_0x1207d8,{'showHidden':![],'depth':null}));};}function create(_0x4e4f4c){return BPromise[_0x8d64('0xd')]()[_0x8d64('0xe')](cmHopperHistory[_0x8d64('0xf')](_0x4e4f4c))['catch'](loggerCatch(_0x8d64('0x10')));}function createAgent(_0xeb2636){return BPromise[_0x8d64('0xd')]()['then'](agentReportPreview[_0x8d64('0xf')](_0xeb2636))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x19296e){return BPromise[_0x8d64('0xd')]()[_0x8d64('0xe')](cmHopper[_0x8d64('0x11')](_0x19296e,!![]))[_0x8d64('0x12')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x8d64('0x13')]=function(_0x413cfc){return BPromise[_0x8d64('0xd')]()[_0x8d64('0xe')](cmHopperBlack[_0x8d64('0x13')](_0x413cfc))[_0x8d64('0x12')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x8d64('0x14')]=function(_0x211365){return BPromise[_0x8d64('0xd')]()[_0x8d64('0xe')](cmHopper[_0x8d64('0x14')](_0x211365))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x8d64('0xf')]=function(_0x53ff2b,_0x45021e){create(_0x53ff2b)[_0x8d64('0x12')](loggerCatch(_0x45021e));moveContact(_0x53ff2b)[_0x8d64('0x12')](loggerCatch(_0x45021e));};exports[_0x8d64('0x15')]=function(_0x3a409f,_0x3dd8c2){createAgent(_0x3a409f)[_0x8d64('0x12')](loggerCatch(_0x3dd8c2));};exports[_0x8d64('0x16')]=function(_0x1e3e46,_0x3e7b49){create(_0x1e3e46)[_0x8d64('0x12')](loggerCatch(_0x3e7b49));};exports[_0x8d64('0x17')]=function(_0x13e69a,_0x44afe3){moveContact(_0x13e69a)['catch'](loggerCatch(_0x44afe3));};exports[_0x8d64('0x18')]=function(_0x548874,_0x2c7871,_0xbe57da){if(_0x2c7871){_0x548874[_0x8d64('0x19')]=null;}if(_0xbe57da){_0x548874[_0x8d64('0x1a')]=![];}return BPromise[_0x8d64('0xd')]()[_0x8d64('0xe')](cmHopper['rescheduleContact'](_0x548874))[_0x8d64('0x12')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x8d64('0x1b')]=function(_0x4e9627){return BPromise[_0x8d64('0xd')]()[_0x8d64('0xe')](cmHopper[_0x8d64('0x1b')](_0x4e9627))[_0x8d64('0x12')](loggerCatch(_0x8d64('0x1c')));};exports['unlockContact']=function(_0x1d10b4){return BPromise['resolve']()[_0x8d64('0xe')](cmHopper[_0x8d64('0x1d')]({'UserId':null},_0x1d10b4,0x1))[_0x8d64('0x12')](loggerCatch(_0x8d64('0x1e')));};exports[_0x8d64('0x1f')]=function(_0x41287f){return BPromise[_0x8d64('0xd')]()[_0x8d64('0xe')](cmHopper['unlockContact']({'active':![]},_0x41287f,0x1))[_0x8d64('0x12')](loggerCatch(_0x8d64('0x20')));};exports[_0x8d64('0x21')]=function(_0x46e4b8){var _0x3bccb1={};_0x3bccb1[_0x8d64('0x22')]=_0x46e4b8['type'];_0x3bccb1[_0x8d64('0x23')]=_0x46e4b8[_0x8d64('0x23')];_0x3bccb1[_0x8d64('0x24')]=_0x46e4b8['calleridnum'];_0x3bccb1[_0x8d64('0x25')]=_0x46e4b8[_0x8d64('0x25')];_0x3bccb1['queue']=_0x46e4b8[_0x8d64('0x26')];_0x3bccb1[_0x8d64('0x27')]=_0x46e4b8[_0x8d64('0x28')];_0x3bccb1['queuecallerleaveAt']=_0x46e4b8[_0x8d64('0x28')];_0x3bccb1[_0x8d64('0x29')]=0x1;_0x3bccb1[_0x8d64('0x2a')]=_0x46e4b8[_0x8d64('0x2b')];_0x3bccb1['connectedlinename']=_0x46e4b8[_0x8d64('0x2c')];_0x3bccb1[_0x8d64('0x2d')]=_0x8d64('0x2e');_0x3bccb1['exten']=_0x8d64('0x2f');_0x3bccb1[_0x8d64('0x30')]=0x0;_0x3bccb1['assigned']=0x1;_0x3bccb1['lastAssignedTo']=_0x46e4b8[_0x8d64('0x2c')];_0x3bccb1[_0x8d64('0x31')]=_0x8d64('0x32');return BPromise[_0x8d64('0xd')]()[_0x8d64('0xe')](voiceQueueReport['create'](_0x3bccb1))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x8d64('0x33')]=function(_0x4540b5,_0x2c6d00){return BPromise['resolve']()['then'](cmHopper[_0x8d64('0x33')](_0x4540b5,_0x2c6d00))[_0x8d64('0x12')](loggerCatch(_0x8d64('0x34')));};exports[_0x8d64('0x35')]=function(_0x3dcbf1){return BPromise[_0x8d64('0xd')]()[_0x8d64('0xe')](cmHopper['rescheduleContact'](_0x3dcbf1,!![],!![]))[_0x8d64('0x12')](loggerCatch(_0x8d64('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 d647e19..71ef1b8 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 _0x1f36=['filterKey','type','campaigntype','dialAnswer','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','ringtime','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','push','getDiff','seconds','CampaignId'];(function(_0x1d932b,_0x15271b){var _0xdbec2e=function(_0x523772){while(--_0x523772){_0x1d932b['push'](_0x1d932b['shift']());}};_0xdbec2e(++_0x15271b);}(_0x1f36,0x1be));var _0x61f3=function(_0xe9ce81,_0x4d48bb){_0xe9ce81=_0xe9ce81-0x0;var _0x27c089=_0x1f36[_0xe9ce81];return _0x27c089;};'use strict';var util=require(_0x61f3('0x0'));var _=require(_0x61f3('0x1'));var moment=require(_0x61f3('0x2'));var logger=require(_0x61f3('0x3'))(_0x61f3('0x4'));var ipAgi=process['env'][_0x61f3('0x5')]||_0x61f3('0x6');function getSeconds(_0x337e6d,_0x29e7ab){var _0x16ef58=moment(_0x337e6d)[_0x61f3('0x7')](0x0);var _0x48fd49=moment(_0x29e7ab)[_0x61f3('0x7')](0x0);return _0x16ef58[_0x61f3('0x8')](_0x48fd49,'seconds');}exports[_0x61f3('0x9')]=function(_0x13a5c4){return function(_0x4b9415){logger['error'](_0x13a5c4,util[_0x61f3('0xa')](_0x4b9415,{'showHidden':![],'depth':null}));};};exports[_0x61f3('0xb')]=function(_0x1d9002,_0x1766e9){logger[_0x61f3('0xc')](_0x1d9002,util[_0x61f3('0xa')](_0x1766e9,{'showHidden':![],'depth':null}));};exports[_0x61f3('0xd')]=function(_0xc06c5c,_0x4f1c35){logger[_0x61f3('0xe')](_0xc06c5c,util[_0x61f3('0xa')](_0x4f1c35,{'showHidden':![],'depth':null}));};exports[_0x61f3('0xf')]=function(_0x23c195){return function(_0x38bd03){logger[_0x61f3('0xc')](_0x23c195,util[_0x61f3('0xa')](_0x38bd03,{'showHidden':![],'depth':null}));};};exports[_0x61f3('0x10')]=function(_0x99485c,_0x371bd8,_0x77d326){return{'message':_0x99485c,'unlock':_0x371bd8,'active':_0x77d326};};exports['getCallerId']=function(_0x409521,_0x1f40e8,_0x1a40bc){if(!_[_0x61f3('0x11')](_0x1a40bc)&&_0x61f3('0x12')===typeof _0x1a40bc&&!_['isEmpty'](_0x1a40bc)){if(!_['isUndefined'](_0x1f40e8)&&_0x61f3('0x12')===typeof _0x1f40e8&&!_[_0x61f3('0x13')](_0x1f40e8)){return util[_0x61f3('0x14')]('\x22%s\x22\x20<%s>',_0x1f40e8,_0x1a40bc);}return util[_0x61f3('0x14')]('\x22%s\x22\x20<%s>',_0x1a40bc,_0x1a40bc);}if(!_[_0x61f3('0x11')](_0x409521)&&_0x61f3('0x12')===typeof _0x409521&&!_['isEmpty'](_0x409521)){return _0x409521;}return _0x61f3('0x15');};exports[_0x61f3('0x16')]=function(_0xeaa404){if(_[_0x61f3('0x17')](_0xeaa404)){return![];}return _0xeaa404;};exports[_0x61f3('0x18')]=function(_0x457ae2,_0x2f3c39,_0x476746,_0x3003ac,_0x2ddc44,_0x56a30c){var _0x53541c={'XMD-QUEUE':_0x2f3c39[_0x61f3('0x19')]?_0x2f3c39[_0x61f3('0x19')]['name']:'','XMD-CALLERID':_0x3003ac,'XMD-CALLERID-PREVIEW':_0x56a30c?util[_0x61f3('0x14')](_0x61f3('0x1a'),_0x56a30c[_0x61f3('0x1b')],_0x56a30c[_0x61f3('0x1c')]):_0x3003ac,'XMD-DIALID':_0x2ddc44,'XMD-CONTACTID':_0x2f3c39['ContactId'],'XMD-CDRTYPE':_0x61f3('0x1d'),'CALLERID(all)':_0x3003ac,'XMD-VOICEQUEUEID':_0x2f3c39[_0x61f3('0x1e')],'XMD-DIALCHANNEL':_0x476746,'XMD-DIALTIMEOUT':_0x457ae2[_0x61f3('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x61f3('0x14')](_0x61f3('0x20'),_0x457ae2[_0x61f3('0x21')]?'g':'',_[_0x61f3('0x13')](_0x457ae2[_0x61f3('0x22')])?'':_0x61f3('0x23')),'XMD-DIALURL':_0x457ae2[_0x61f3('0x24')]||'','XMD-AGI':_0x457ae2[_0x61f3('0x25')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x457ae2[_0x61f3('0x25')]):_0x61f3('0x26'),'XMD-AGIAFTER':_0x457ae2[_0x61f3('0x21')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x457ae2[_0x61f3('0x21')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x56a30c?_0x56a30c[_0x61f3('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x56a30c?_0x56a30c[_0x61f3('0x28')]:'','XMD-DESTINATION':_0x61f3('0x29')};if(!_[_0x61f3('0x13')](_0x457ae2[_0x61f3('0x22')])){_0x53541c[util[_0x61f3('0x14')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x457ae2['monitor_format'];_0x53541c[util['format']('%s',_0x61f3('0x2a'))]=_0x2ddc44;}if(_0x2f3c39&&_0x2f3c39[_0x61f3('0x2b')]){for(var _0x4b97f1 in _0x2f3c39[_0x61f3('0x2b')]){if(_0x2f3c39[_0x61f3('0x2b')]['hasOwnProperty'](_0x4b97f1)){if(!_[_0x61f3('0x17')](_0x2f3c39[_0x61f3('0x2b')][_0x4b97f1])&&_0x4b97f1!=='id'&&_0x4b97f1!=='tags'&&_0x4b97f1!==_0x61f3('0x2c')&&_0x4b97f1!==_0x61f3('0x2d')){_0x53541c[util[_0x61f3('0x14')](_0x61f3('0x2e'),_0x61f3('0x2f'),_['toUpper'](_0x4b97f1))]=_0x2f3c39[_0x61f3('0x2b')][_0x4b97f1];}}}}return _0x53541c;};exports[_0x61f3('0x30')]=function(_0x450ec4){var _0x56853e={};for(var _0x238e98 in _0x450ec4){if(_0x450ec4[_0x61f3('0x31')](_0x238e98)){_0x56853e[util['format']('%s',_[_0x61f3('0x32')](_0x238e98))]=_0x450ec4[_0x238e98];}}return{'variables':_0x56853e};};exports['updateOriginated']=function(_0x33e4b4,_0x58fea5){if(!_['isNil'](_0x33e4b4)){if(_0x33e4b4[_0x61f3('0x31')](_0x61f3('0x33'))){if(_0x33e4b4[_0x61f3('0x33')]>0x0){_0x33e4b4[_0x61f3('0x33')]-=0x1;}else{logger[_0x61f3('0xe')](_0x61f3('0x34'),_0x58fea5);}}}else{logger[_0x61f3('0xe')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x58fea5);}};exports[_0x61f3('0x35')]=function(_0x1e07bc){var _0x2b9b40=moment()[_0x61f3('0x14')](_0x61f3('0x36'));_0x1e07bc[_0x61f3('0x37')]=0xd;_0x1e07bc[_0x61f3('0x38')]='Blacklist';_0x1e07bc[_0x61f3('0x39')]=_0x2b9b40;_0x1e07bc[_0x61f3('0x3a')]=_0x2b9b40;_0x1e07bc[_0x61f3('0x3b')]=_0x2b9b40;};exports['logAgent']=function(_0x16adad,_0x3b95d9,_0x4a61cc){var _0x130cb5=moment()[_0x61f3('0x14')](_0x61f3('0x36'));_0x16adad[_0x61f3('0x37')]=_0x3b95d9;_0x16adad['statedesc']=_0x4a61cc;_0x16adad[_0x61f3('0x3a')]=_0x130cb5;_0x16adad[_0x61f3('0x3c')]=getSeconds(_0x16adad[_0x61f3('0x3a')],_0x16adad[_0x61f3('0x39')]);};exports['logLookAgent']=function(_0x3c7337,_0x2fa00d,_0x29300e){_0x3c7337[_0x61f3('0x3d')]=_0x2fa00d;_0x3c7337[_0x61f3('0x3e')]=_0x29300e;};exports['logCustomer']=function(_0x14982d,_0x5e90b7,_0x79e75){var _0x507aec=moment()[_0x61f3('0x14')](_0x61f3('0x36'));_0x14982d[_0x61f3('0x37')]=_0x5e90b7;_0x14982d[_0x61f3('0x38')]=_0x79e75;_0x14982d[_0x61f3('0x3a')]=_0x14982d[_0x61f3('0x3a')]?_0x14982d['responsetime']:_0x507aec;_0x14982d[_0x61f3('0x3b')]=_0x14982d[_0x61f3('0x3b')]?_0x14982d[_0x61f3('0x3b')]:_0x507aec;_0x14982d[_0x61f3('0x3c')]=getSeconds(_0x14982d[_0x61f3('0x3a')]||0x0,_0x14982d[_0x61f3('0x39')]||0x0);_0x14982d[_0x61f3('0x3f')]=_0x14982d[_0x61f3('0x40')]?getSeconds(_0x14982d['endtime'],_0x14982d['answertime']):0x0;};exports[_0x61f3('0x41')]=function(_0xb642a){return _0xb642a===_0x61f3('0x42');};exports[_0x61f3('0x43')]=function(_0x56b4d6,_0x224a51,_0x25c22f,_0x1d8ee6,_0x2b375f){var _0x99a5c2=_0x1d8ee6?_0x61f3('0x44'):_0x56b4d6[_0x61f3('0x1b')];_0x99a5c2=_0x2b375f?'BOOKED':_0x99a5c2;return{'actionid':_0x56b4d6['uniqueid'],'action':_0x61f3('0x45'),'channel':_0x56b4d6[_0x61f3('0x46')],'callerid':util[_0x61f3('0x14')]('\x22%s\x22\x20<%s>',_0x99a5c2,_0x56b4d6[_0x61f3('0x1c')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x25c22f,'timeout':(_0x224a51['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x56b4d6[_0x61f3('0x47')]};};exports[_0x61f3('0x48')]=function(_0x158a19){return _0x158a19[_0x61f3('0x49')]+_0x158a19[_0x61f3('0x4a')]+_0x158a19[_0x61f3('0x4b')]+_0x158a19['countagentrejectretry']+_0x158a19[_0x61f3('0x4c')];};exports[_0x61f3('0x4d')]=function(_0x15a64e){var _0x60581b=_[_0x61f3('0x4e')](_0x15a64e);_0x60581b[_0x61f3('0x37')]=0xf;_0x60581b[_0x61f3('0x38')]=_0x61f3('0x4f');return _0x60581b;};exports[_0x61f3('0x50')]=function(_0x40fbc8,_0x3aa599,_0x330dc1){var _0x16bcca={};_0x16bcca[_0x3aa599]=_0x40fbc8[_0x3aa599];_0x16bcca[_0x61f3('0x51')]=![];_0x16bcca[_0x61f3('0x52')]=moment()['add'](_0x330dc1,'minutes')[_0x61f3('0x14')](_0x61f3('0x36'));_0x16bcca['ContactId']=_0x40fbc8[_0x61f3('0x53')];_0x16bcca['ListId']=_0x40fbc8[_0x61f3('0x54')];_0x16bcca[_0x61f3('0x1e')]=_0x40fbc8[_0x61f3('0x1e')]||undefined;return _0x16bcca;};exports[_0x61f3('0x55')]=function(_0x53be2b,_0x462e67){if(!_[_0x61f3('0x17')](_0x53be2b)){if(_0x53be2b[_0x61f3('0x56')]>0x0){_0x53be2b[_0x61f3('0x56')]-=0x1;}else{logger[_0x61f3('0xe')](_0x462e67,_0x61f3('0x57'));}}else{logger[_0x61f3('0xe')](_0x462e67,_0x61f3('0x58'));}};exports[_0x61f3('0x59')]=function(_0x31f5ed){if(_0x31f5ed<=0x0){return!![];}return![];};exports['buildObj']=function(_0x75131,_0xa780da,_0x20509b){_0x75131[_0x61f3('0x5a')]=_0xa780da;_0x75131[_0x61f3('0x5b')]=_0x75131[_0x61f3('0x5c')];_0x75131[_0x61f3('0x5d')]=_0x75131[_0x61f3('0x46')];if(_0x20509b){_0x75131[_0x61f3('0x5e')]=_0x20509b[_0x61f3('0x5e')];}return _0x75131;};exports[_0x61f3('0x5f')]=function(_0x183691){var _0x9234d6={};_0x9234d6[_0x61f3('0x5c')]=_0x183691['queue'];_0x9234d6[_0x61f3('0x5d')]=_0x183691['channelAgent'];_0x9234d6[_0x61f3('0x47')]=_0x183691[_0x61f3('0x47')];return _0x9234d6;};exports[_0x61f3('0x60')]=function(_0xe92701){var _0x5b6f0e=[];for(var _0x979150 in _0xe92701){if(_0xe92701['hasOwnProperty'](_0x979150)){if(!_[_0x61f3('0x17')](_0xe92701[_0x979150])&&_0xe92701[_0x979150]['state']===_0x61f3('0x61')&&_0xe92701[_0x979150]['status']==='reachable'){_0x5b6f0e[_0x61f3('0x62')](_0xe92701[_0x979150]['id']);}}}return _0x5b6f0e;};exports[_0x61f3('0x63')]=function(_0x3f403b){var _0x3fd67=moment()[_0x61f3('0x7')](0x0);var _0x1b820c=moment(_0x3f403b)['milliseconds'](0x0);return _0x3fd67[_0x61f3('0x8')](_0x1b820c,_0x61f3('0x64'));};exports['createBody']=function(_0x106daf){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x106daf[_0x61f3('0x53')],'ListId':_0x106daf[_0x61f3('0x54')],'VoiceQueueId':_0x106daf[_0x61f3('0x1e')]||undefined,'CampaignId':_0x106daf[_0x61f3('0x65')]||undefined};};exports[_0x61f3('0x66')]=function(_0x245cc5){if(_0x245cc5===_0x61f3('0x47')||_0x245cc5==='idContact'||_0x245cc5==='queue'||_0x245cc5===_0x61f3('0x67')||_0x245cc5===_0x61f3('0x68')||_0x245cc5===_0x61f3('0x69')||_0x245cc5===_0x61f3('0x3d')||_0x245cc5===_0x61f3('0x46')||_0x245cc5===_0x61f3('0x1b')||_0x245cc5===_0x61f3('0x51')||_0x245cc5===_0x61f3('0x1c')||_0x245cc5===_0x61f3('0x52')||_0x245cc5===_0x61f3('0x49')||_0x245cc5===_0x61f3('0x4a')||_0x245cc5===_0x61f3('0x4b')||_0x245cc5===_0x61f3('0x6a')||_0x245cc5===_0x61f3('0x6b')||_0x245cc5==='callbackuniqueid'||_0x245cc5===_0x61f3('0x6c')||_0x245cc5===_0x61f3('0x6d')||_0x245cc5==='ContactId'||_0x245cc5===_0x61f3('0x54')||_0x245cc5===_0x61f3('0x3e')||_0x245cc5===_0x61f3('0x1e')||_0x245cc5===_0x61f3('0x6e')||_0x245cc5===_0x61f3('0x6f')||_0x245cc5===_0x61f3('0x70')||_0x245cc5===_0x61f3('0x71')||_0x245cc5===_0x61f3('0x72')||_0x245cc5===_0x61f3('0x73')||_0x245cc5===_0x61f3('0x74')||_0x245cc5===_0x61f3('0x75')||_0x245cc5===_0x61f3('0x76')||_0x245cc5===_0x61f3('0x77')||_0x245cc5==='xmd-contactid'||_0x245cc5===_0x61f3('0x78')||_0x245cc5===_0x61f3('0x79')||_0x245cc5===_0x61f3('0x7a')||_0x245cc5==='xmd-agi'||_0x245cc5===_0x61f3('0x7b')||_0x245cc5==='rtpaudioqosbridged'||_0x245cc5===_0x61f3('0x7c')||_0x245cc5==='rtpaudioqosjitterbridged'||_0x245cc5==='rtpaudioqosloss'||_0x245cc5===_0x61f3('0x7d')||_0x245cc5===_0x61f3('0x7e')||_0x245cc5===_0x61f3('0x7f')||_0x245cc5===_0x61f3('0x7b')||_0x245cc5==='rtpaudioqosbridged'||_0x245cc5===_0x61f3('0x7c')||_0x245cc5===_0x61f3('0x80')||_0x245cc5==='rtpaudioqosloss'||_0x245cc5===_0x61f3('0x7d')||_0x245cc5===_0x61f3('0x7e')||_0x245cc5===_0x61f3('0x7f')||_0x245cc5===_0x61f3('0x81')||_0x245cc5==='bridgepvtcallid'||_0x245cc5===_0x61f3('0x37')||_0x245cc5===_0x61f3('0x38')){return![];}return!![];};exports[_0x61f3('0x82')]=function(_0x24fd3f,_0xdfcb40){var _0xa5bf98,_0x2f077b,_0x192e41;if(_0xdfcb40<=0x0){_0xdfcb40=0x1;}_0xa5bf98=new RegExp(_0x61f3('0x83')+_0xdfcb40+'}$');_0x2f077b=Math['pow'](0xa,_0xdfcb40-0x1);_0x192e41=Math[_0x61f3('0x84')](0xa,_0xdfcb40)-0x1;return util[_0x61f3('0x14')]('%s',_[_0x61f3('0x85')](_0x24fd3f,_0xa5bf98,_[_0x61f3('0x86')](_0x2f077b,_0x192e41)));};exports[_0x61f3('0x87')]=function(_0x3f29a3){var _0x2319fa=_0x3f29a3[_0x61f3('0x88')](/"(.*?)"/);return _0x2319fa?_0x2319fa[0x1]:_0x3f29a3;};exports['extractCalleridNumber']=function(_0x331fb4){var _0x177aea=_0x331fb4[_0x61f3('0x88')](/<(.*?)>/);return _0x177aea?_0x177aea[0x1]:_0x331fb4;}; \ No newline at end of file +var _0x4249=['logLookAgent','membername','UserId','statedesc','talktime','answertime','variablesAction','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','mandatoryDisposition','buildAcw','interface','agentReadyId','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-contactid','xmd-cdrtype','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','error','inspect','logger','info','loggerError','logger2','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','ringtime'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4249,0x1dc));var _0x9424=function(_0x5919c7,_0x34071c){_0x5919c7=_0x5919c7-0x0;var _0x2224ab=_0x4249[_0x5919c7];return _0x2224ab;};'use strict';var util=require(_0x9424('0x0'));var _=require('lodash');var moment=require(_0x9424('0x1'));var logger=require(_0x9424('0x2'))(_0x9424('0x3'));var ipAgi=process[_0x9424('0x4')][_0x9424('0x5')]||_0x9424('0x6');function getSeconds(_0x3bab3b,_0x35bfb2){var _0x5575d6=moment(_0x3bab3b)[_0x9424('0x7')](0x0);var _0x1aef85=moment(_0x35bfb2)['milliseconds'](0x0);return _0x5575d6[_0x9424('0x8')](_0x1aef85,'seconds');}exports['loggerCatch']=function(_0x436a43){return function(_0x187723){logger[_0x9424('0x9')](_0x436a43,util[_0x9424('0xa')](_0x187723,{'showHidden':![],'depth':null}));};};exports[_0x9424('0xb')]=function(_0x5453a3,_0x1e0c72){logger[_0x9424('0xc')](_0x5453a3,util['inspect'](_0x1e0c72,{'showHidden':![],'depth':null}));};exports[_0x9424('0xd')]=function(_0x4e4734,_0x5cb981){logger[_0x9424('0x9')](_0x4e4734,util[_0x9424('0xa')](_0x5cb981,{'showHidden':![],'depth':null}));};exports[_0x9424('0xe')]=function(_0x55cb84){return function(_0x473ffd){logger[_0x9424('0xc')](_0x55cb84,util[_0x9424('0xa')](_0x473ffd,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x211e22,_0x1e6b61,_0x3dba61){return{'message':_0x211e22,'unlock':_0x1e6b61,'active':_0x3dba61};};exports['getCallerId']=function(_0x4d2c52,_0x4b91d6,_0x45babd){if(!_['isUndefined'](_0x45babd)&&_0x9424('0xf')===typeof _0x45babd&&!_[_0x9424('0x10')](_0x45babd)){if(!_[_0x9424('0x11')](_0x4b91d6)&&_0x9424('0xf')===typeof _0x4b91d6&&!_[_0x9424('0x10')](_0x4b91d6)){return util[_0x9424('0x12')]('\x22%s\x22\x20<%s>',_0x4b91d6,_0x45babd);}return util[_0x9424('0x12')](_0x9424('0x13'),_0x45babd,_0x45babd);}if(!_[_0x9424('0x11')](_0x4d2c52)&&'string'===typeof _0x4d2c52&&!_[_0x9424('0x10')](_0x4d2c52)){return _0x4d2c52;}return _0x9424('0x14');};exports[_0x9424('0x15')]=function(_0x18f8bb){if(_['isNil'](_0x18f8bb)){return![];}return _0x18f8bb;};exports[_0x9424('0x16')]=function(_0x496950,_0x1dc34d,_0x550d9d,_0x582d45,_0x5ab873,_0x13b093){var _0x2ec7a3={'XMD-QUEUE':_0x1dc34d[_0x9424('0x17')]?_0x1dc34d[_0x9424('0x17')][_0x9424('0x18')]:'','XMD-CALLERID':_0x582d45,'XMD-CALLERID-PREVIEW':_0x13b093?util[_0x9424('0x12')](_0x9424('0x13'),_0x13b093[_0x9424('0x19')],_0x13b093[_0x9424('0x1a')]):_0x582d45,'XMD-DIALID':_0x5ab873,'XMD-CONTACTID':_0x1dc34d['ContactId'],'XMD-CDRTYPE':_0x9424('0x1b'),'CALLERID(all)':_0x582d45,'XMD-VOICEQUEUEID':_0x1dc34d[_0x9424('0x1c')],'XMD-DIALCHANNEL':_0x550d9d,'XMD-DIALTIMEOUT':_0x496950['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x9424('0x12')](_0x9424('0x1d'),_0x496950['dialQueueProject2']?'g':'',_[_0x9424('0x10')](_0x496950[_0x9424('0x1e')])?'':_0x9424('0x1f')),'XMD-DIALURL':_0x496950['dialPreviewUrl']||'','XMD-AGI':_0x496950[_0x9424('0x20')]?util[_0x9424('0x12')](_0x9424('0x21'),ipAgi,_0x496950[_0x9424('0x20')]):'NONE','XMD-AGIAFTER':_0x496950[_0x9424('0x22')]?util['format'](_0x9424('0x21'),ipAgi,_0x496950[_0x9424('0x22')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x13b093?_0x13b093[_0x9424('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x13b093?_0x13b093[_0x9424('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x9424('0x10')](_0x496950[_0x9424('0x1e')])){_0x2ec7a3[util['format']('%s',_0x9424('0x25'))]=_0x496950[_0x9424('0x1e')];_0x2ec7a3[util[_0x9424('0x12')]('%s',_0x9424('0x26'))]=_0x5ab873;}if(_0x1dc34d&&_0x1dc34d[_0x9424('0x27')]){for(var _0x13dc90 in _0x1dc34d[_0x9424('0x27')]){if(_0x1dc34d[_0x9424('0x27')][_0x9424('0x28')](_0x13dc90)){if(!_[_0x9424('0x29')](_0x1dc34d[_0x9424('0x27')][_0x13dc90])&&_0x13dc90!=='id'&&_0x13dc90!==_0x9424('0x2a')&&_0x13dc90!==_0x9424('0x2b')&&_0x13dc90!==_0x9424('0x2c')){_0x2ec7a3[util[_0x9424('0x12')]('%s%s',_0x9424('0x2d'),_[_0x9424('0x2e')](_0x13dc90))]=_0x1dc34d[_0x9424('0x27')][_0x13dc90];}}}}return _0x2ec7a3;};exports[_0x9424('0x2f')]=function(_0x5ba770){var _0xf83e68={};for(var _0x309673 in _0x5ba770){if(_0x5ba770[_0x9424('0x28')](_0x309673)){_0xf83e68[util[_0x9424('0x12')]('%s',_['toLower'](_0x309673))]=_0x5ba770[_0x309673];}}return{'variables':_0xf83e68};};exports[_0x9424('0x30')]=function(_0x272e24,_0xce7a37){if(!_[_0x9424('0x29')](_0x272e24)){if(_0x272e24[_0x9424('0x28')]('originated')){if(_0x272e24[_0x9424('0x31')]>0x0){_0x272e24[_0x9424('0x31')]-=0x1;}else{logger[_0x9424('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0xce7a37);}}}else{logger[_0x9424('0x9')](_0x9424('0x32'),_0xce7a37);}};exports[_0x9424('0x33')]=function(_0x3edbb0){var _0x3552aa=moment()[_0x9424('0x12')](_0x9424('0x34'));_0x3edbb0[_0x9424('0x35')]=0xd;_0x3edbb0['statedesc']=_0x9424('0x36');_0x3edbb0[_0x9424('0x37')]=_0x3552aa;_0x3edbb0[_0x9424('0x38')]=_0x3552aa;_0x3edbb0[_0x9424('0x39')]=_0x3552aa;};exports[_0x9424('0x3a')]=function(_0x4224c3,_0x2bb9a1,_0x5728b4){var _0x5c47b0=moment()[_0x9424('0x12')](_0x9424('0x34'));_0x4224c3[_0x9424('0x35')]=_0x2bb9a1;_0x4224c3['statedesc']=_0x5728b4;_0x4224c3[_0x9424('0x38')]=_0x5c47b0;_0x4224c3[_0x9424('0x3b')]=getSeconds(_0x4224c3['responsetime'],_0x4224c3['starttime']);};exports[_0x9424('0x3c')]=function(_0x5b070d,_0x56438e,_0xb5e2e9){_0x5b070d[_0x9424('0x3d')]=_0x56438e;_0x5b070d[_0x9424('0x3e')]=_0xb5e2e9;};exports['logCustomer']=function(_0x559d86,_0x492502,_0x13c147){var _0x980c41=moment()[_0x9424('0x12')](_0x9424('0x34'));_0x559d86[_0x9424('0x35')]=_0x492502;_0x559d86[_0x9424('0x3f')]=_0x13c147;_0x559d86[_0x9424('0x38')]=_0x559d86[_0x9424('0x38')]?_0x559d86['responsetime']:_0x980c41;_0x559d86[_0x9424('0x39')]=_0x559d86[_0x9424('0x39')]?_0x559d86['endtime']:_0x980c41;_0x559d86[_0x9424('0x3b')]=getSeconds(_0x559d86['responsetime']||0x0,_0x559d86[_0x9424('0x37')]||0x0);_0x559d86[_0x9424('0x40')]=_0x559d86[_0x9424('0x41')]?getSeconds(_0x559d86[_0x9424('0x39')],_0x559d86[_0x9424('0x41')]):0x0;};exports['isFailure']=function(_0x5dae8b){return _0x5dae8b==='Failure';};exports[_0x9424('0x42')]=function(_0x385e6e,_0x2ace7a,_0x549b1c,_0x4adbbe,_0x2f458e){var _0x144962=_0x4adbbe?'RECALL':_0x385e6e[_0x9424('0x19')];_0x144962=_0x2f458e?'BOOKED':_0x144962;return{'actionid':_0x385e6e[_0x9424('0x43')],'action':_0x9424('0x44'),'channel':_0x385e6e[_0x9424('0x45')],'callerid':util[_0x9424('0x12')](_0x9424('0x13'),_0x144962,_0x385e6e[_0x9424('0x1a')]),'Exten':'xcally-motion-preview','Context':_0x9424('0x46'),'Priority':'1','variable':_0x549b1c,'timeout':(_0x2ace7a[_0x9424('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x385e6e[_0x9424('0x43')]};};exports[_0x9424('0x48')]=function(_0x10514c){return _0x10514c[_0x9424('0x49')]+_0x10514c['countcongestionretry']+_0x10514c[_0x9424('0x4a')]+_0x10514c[_0x9424('0x4b')]+_0x10514c[_0x9424('0x4c')];};exports[_0x9424('0x4d')]=function(_0x574f88){var _0x4bf6e5=_[_0x9424('0x4e')](_0x574f88);_0x4bf6e5[_0x9424('0x35')]=0xf;_0x4bf6e5[_0x9424('0x3f')]=_0x9424('0x4f');return _0x4bf6e5;};exports[_0x9424('0x50')]=function(_0x500ca4,_0x4dceec,_0x53bffb){var _0x42a60c={};_0x42a60c[_0x4dceec]=_0x500ca4[_0x4dceec];_0x42a60c[_0x9424('0x51')]=![];_0x42a60c['scheduledat']=moment()['add'](_0x53bffb,_0x9424('0x52'))[_0x9424('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x42a60c[_0x9424('0x53')]=_0x500ca4[_0x9424('0x53')];_0x42a60c[_0x9424('0x54')]=_0x500ca4[_0x9424('0x54')];_0x42a60c[_0x9424('0x1c')]=_0x500ca4['VoiceQueueId']||undefined;return _0x42a60c;};exports[_0x9424('0x55')]=function(_0x378dd9,_0x68ac12){if(!_[_0x9424('0x29')](_0x378dd9)){if(_0x378dd9[_0x9424('0x56')]>0x0){_0x378dd9[_0x9424('0x56')]-=0x1;}else{logger[_0x9424('0x9')](_0x68ac12,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x68ac12,_0x9424('0x57'));}};exports[_0x9424('0x58')]=function(_0x1094c2){if(_0x1094c2<=0x0){return!![];}return![];};exports[_0x9424('0x59')]=function(_0x24f242,_0x5a8f27,_0x3a8559){_0x24f242[_0x9424('0x5a')]=_0x5a8f27;_0x24f242['name']=_0x24f242[_0x9424('0x5b')];_0x24f242['interface']=_0x24f242[_0x9424('0x45')];if(_0x3a8559){_0x24f242['mandatoryDisposition']=_0x3a8559[_0x9424('0x5c')];}return _0x24f242;};exports[_0x9424('0x5d')]=function(_0x57e6f5){var _0x1ddacc={};_0x1ddacc[_0x9424('0x5b')]=_0x57e6f5[_0x9424('0x5b')];_0x1ddacc[_0x9424('0x5e')]=_0x57e6f5[_0x9424('0x45')];_0x1ddacc['uniqueid']=_0x57e6f5[_0x9424('0x43')];return _0x1ddacc;};exports[_0x9424('0x5f')]=function(_0x5e72c2){var _0x37c2bc=[];for(var _0x2f58ae in _0x5e72c2){if(_0x5e72c2['hasOwnProperty'](_0x2f58ae)){if(!_[_0x9424('0x29')](_0x5e72c2[_0x2f58ae])&&_0x5e72c2[_0x2f58ae][_0x9424('0x35')]==='not_inuse'&&_0x5e72c2[_0x2f58ae][_0x9424('0x60')]===_0x9424('0x61')){_0x37c2bc[_0x9424('0x62')](_0x5e72c2[_0x2f58ae]['id']);}}}return _0x37c2bc;};exports[_0x9424('0x63')]=function(_0x1e16fe){var _0x2e34f3=moment()[_0x9424('0x7')](0x0);var _0x38cae7=moment(_0x1e16fe)['milliseconds'](0x0);return _0x2e34f3['diff'](_0x38cae7,'seconds');};exports[_0x9424('0x64')]=function(_0x4cfbfa){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4cfbfa[_0x9424('0x53')],'ListId':_0x4cfbfa[_0x9424('0x54')],'VoiceQueueId':_0x4cfbfa[_0x9424('0x1c')]||undefined,'CampaignId':_0x4cfbfa[_0x9424('0x65')]||undefined};};exports['filterKey']=function(_0x2fb2da){if(_0x2fb2da===_0x9424('0x43')||_0x2fb2da===_0x9424('0x66')||_0x2fb2da===_0x9424('0x5b')||_0x2fb2da===_0x9424('0x67')||_0x2fb2da===_0x9424('0x68')||_0x2fb2da===_0x9424('0x69')||_0x2fb2da===_0x9424('0x3d')||_0x2fb2da===_0x9424('0x45')||_0x2fb2da==='calleridname'||_0x2fb2da==='active'||_0x2fb2da===_0x9424('0x1a')||_0x2fb2da==='scheduledat'||_0x2fb2da===_0x9424('0x49')||_0x2fb2da===_0x9424('0x6a')||_0x2fb2da==='countnoanswerretry'||_0x2fb2da===_0x9424('0x6b')||_0x2fb2da===_0x9424('0x6c')||_0x2fb2da===_0x9424('0x6d')||_0x2fb2da===_0x9424('0x6e')||_0x2fb2da===_0x9424('0x6f')||_0x2fb2da===_0x9424('0x53')||_0x2fb2da===_0x9424('0x54')||_0x2fb2da===_0x9424('0x3e')||_0x2fb2da===_0x9424('0x1c')||_0x2fb2da===_0x9424('0x70')||_0x2fb2da===_0x9424('0x71')||_0x2fb2da==='xmd-queue'||_0x2fb2da===_0x9424('0x72')||_0x2fb2da==='xmd-listid'||_0x2fb2da===_0x9424('0x73')||_0x2fb2da==='xmd-dialtimeout'||_0x2fb2da===_0x9424('0x74')||_0x2fb2da==='xmd-dialid'||_0x2fb2da==='xmd-dialchannel'||_0x2fb2da===_0x9424('0x75')||_0x2fb2da===_0x9424('0x76')||_0x2fb2da==='xmd-callerid'||_0x2fb2da==='xmd-agiafter'||_0x2fb2da==='xmd-agi'||_0x2fb2da==='rtpaudioqos'||_0x2fb2da==='rtpaudioqosbridged'||_0x2fb2da===_0x9424('0x77')||_0x2fb2da===_0x9424('0x78')||_0x2fb2da===_0x9424('0x79')||_0x2fb2da===_0x9424('0x7a')||_0x2fb2da===_0x9424('0x7b')||_0x2fb2da===_0x9424('0x7c')||_0x2fb2da==='rtpaudioqos'||_0x2fb2da===_0x9424('0x7d')||_0x2fb2da===_0x9424('0x77')||_0x2fb2da===_0x9424('0x78')||_0x2fb2da===_0x9424('0x79')||_0x2fb2da===_0x9424('0x7a')||_0x2fb2da===_0x9424('0x7b')||_0x2fb2da==='rtpaudioqosrttbridged'||_0x2fb2da==='bridgepeer'||_0x2fb2da===_0x9424('0x7e')||_0x2fb2da===_0x9424('0x35')||_0x2fb2da===_0x9424('0x3f')){return![];}return!![];};exports[_0x9424('0x7f')]=function(_0x2dfdd0,_0x3214f1){var _0x1dc9b8,_0x37dce6,_0x253e0b;if(_0x3214f1<=0x0){_0x3214f1=0x1;}_0x1dc9b8=new RegExp(_0x9424('0x80')+_0x3214f1+'}$');_0x37dce6=Math[_0x9424('0x81')](0xa,_0x3214f1-0x1);_0x253e0b=Math['pow'](0xa,_0x3214f1)-0x1;return util[_0x9424('0x12')]('%s',_[_0x9424('0x82')](_0x2dfdd0,_0x1dc9b8,_[_0x9424('0x83')](_0x37dce6,_0x253e0b)));};exports[_0x9424('0x84')]=function(_0x303f46){var _0x40787c=_0x303f46['match'](/"(.*?)"/);return _0x40787c?_0x40787c[0x1]:_0x303f46;};exports[_0x9424('0x85')]=function(_0x650dfd){var _0xc5a1b=_0x650dfd['match'](/<(.*?)>/);return _0xc5a1b?_0xc5a1b[0x1]:_0x650dfd;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a6bc404..063615a 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 _0x50e9=['number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x460e45,_0x5ab5d9){var _0x44c9ee=function(_0x314e65){while(--_0x314e65){_0x460e45['push'](_0x460e45['shift']());}};_0x44c9ee(++_0x5ab5d9);}(_0x50e9,0x13d));var _0x950e=function(_0x58ef50,_0x2f8957){_0x58ef50=_0x58ef50-0x0;var _0x4325f0=_0x50e9[_0x58ef50];return _0x4325f0;};'use strict';exports[_0x950e('0x0')]={'queue':{'type':_0x950e('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x950e('0x1'),'required':!![]},'penalty':{'type':_0x950e('0x2'),'required':![]},'paused':{'type':_0x950e('0x3'),'required':![]}};exports[_0x950e('0x4')]={'queue':{'type':_0x950e('0x1'),'required':!![]},'interface':{'type':_0x950e('0x1'),'required':!![]}};exports[_0x950e('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x950e('0x1'),'required':![]}};exports[_0x950e('0x6')]={'module':{'type':_0x950e('0x1'),'required':![]}};exports[_0x950e('0x7')]={'uniqueid':{'type':_0x950e('0x1'),'required':!![]}};exports[_0x950e('0x8')]={'uniqueid':{'type':_0x950e('0x1'),'required':!![]},'filename':{'type':_0x950e('0x1')},'format':{'type':_0x950e('0x1')},'mixmonitorid':{'type':_0x950e('0x1')}};exports[_0x950e('0x9')]={'uniqueid':{'type':_0x950e('0x1'),'required':!![]}};exports[_0x950e('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x950e('0x1'),'required':!![]},'context':{'type':_0x950e('0x1')}}; \ No newline at end of file +var _0xbb4e=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload'];(function(_0x2fd540,_0x2cdc12){var _0x105ae0=function(_0x465184){while(--_0x465184){_0x2fd540['push'](_0x2fd540['shift']());}};_0x105ae0(++_0x2cdc12);}(_0xbb4e,0x19b));var _0xebb4=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xbb4e[_0x386c3e];return _0x4b8e13;};'use strict';exports[_0xebb4('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xebb4('0x1'),'required':!![]},'membername':{'type':_0xebb4('0x1'),'required':!![]},'penalty':{'type':_0xebb4('0x2'),'required':![]},'paused':{'type':_0xebb4('0x3'),'required':![]}};exports[_0xebb4('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xebb4('0x1'),'required':!![]}};exports[_0xebb4('0x5')]={'interface':{'type':_0xebb4('0x1'),'required':!![]},'paused':{'type':_0xebb4('0x3')},'reason':{'type':_0xebb4('0x1'),'required':![]}};exports[_0xebb4('0x6')]={'module':{'type':_0xebb4('0x1'),'required':![]}};exports[_0xebb4('0x7')]={'uniqueid':{'type':_0xebb4('0x1'),'required':!![]}};exports[_0xebb4('0x8')]={'uniqueid':{'type':_0xebb4('0x1'),'required':!![]},'filename':{'type':_0xebb4('0x1')},'format':{'type':_0xebb4('0x1')},'mixmonitorid':{'type':_0xebb4('0x1')}};exports[_0xebb4('0x9')]={'uniqueid':{'type':_0xebb4('0x1'),'required':!![]}};exports[_0xebb4('0xa')]={'uniqueid':{'type':_0xebb4('0x1'),'required':!![]},'exten':{'type':_0xebb4('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index df8e791..449d638 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 _0x1743=['initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','unmanaged','queuecallerabandon','abandoned','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','answered','diff','initVoiceCallReports','outbound','disposition','ANSWERED','duration','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','voiceExtensions','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','ivrAnswerCallsDay','isEmpty','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','initTelephones','initTrunks','trunks','isUndefined','initVoiceQueues','voiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initSugarcrmAccounts'];(function(_0x11e03f,_0x20b967){var _0x5666fe=function(_0x19ce63){while(--_0x19ce63){_0x11e03f['push'](_0x11e03f['shift']());}};_0x5666fe(++_0x20b967);}(_0x1743,0x170));var _0x3174=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1743[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x3174('0x0'));var util=require(_0x3174('0x1'));var _=require(_0x3174('0x2'));var moment=require(_0x3174('0x3'));var Agent=require(_0x3174('0x4'));var Telephone=require(_0x3174('0x5'));var Trunk=require(_0x3174('0x6'));var VoiceQueue=require(_0x3174('0x7'));var Trigger=require('../model/trigger');var Template=require(_0x3174('0x8'));var Campaign=require(_0x3174('0x9'));var VoiceExtension=require(_0x3174('0xa'));var ZendeskAccount=require(_0x3174('0xb'));var SalesforceAccount=require(_0x3174('0xc'));var FreshdeskAccount=require(_0x3174('0xd'));var SugarcrmAccount=require(_0x3174('0xe'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x3174('0xf'));var Dynamics365Account=require(_0x3174('0x10'));var FreshsalesAccount=require(_0x3174('0x11'));var FaxAccount=require(_0x3174('0x12'));var Realtime=function(){this[_0x3174('0x13')]={};this[_0x3174('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0x3174('0x15')]={};this[_0x3174('0x16')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3174('0x17')]={};this[_0x3174('0x18')]={};this['queueChannels']={};this[_0x3174('0x19')]={};this['timers']={};this[_0x3174('0x1a')]={};this[_0x3174('0x1b')]={};this[_0x3174('0x1c')]={};this[_0x3174('0x1d')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x3174('0x1e')]={};this['vtigerAccounts']={};this[_0x3174('0x1f')]={};this['dynamics365Accounts']={};this[_0x3174('0x20')]={};this[_0x3174('0x21')]={};};function freeIsNotKey(_0x275578,_0x180272,_0x5eef8c){var _0x10864a=_[_0x3174('0x22')](_0x275578,function(_0x48734f,_0x1c56d6){return _0x48734f[_0x5eef8c];});for(var _0x3463e8 in _0x180272){if(_0x180272[_0x3174('0x23')](_0x3463e8)){if(!_0x10864a[_0x3463e8]){delete _0x180272[_0x3463e8];}}}}function freeIsNotKeySip(_0x5b5795,_0x9b5fcd){var _0x309035=_[_0x3174('0x22')](_0x5b5795,function(_0x3ad88b,_0x370b7f){return util[_0x3174('0x24')](_0x3174('0x25'),_0x3ad88b[_0x3174('0x26')]);});for(var _0x35bcc9 in _0x9b5fcd){if(_0x9b5fcd[_0x3174('0x23')](_0x35bcc9)){if(!_0x309035[_0x35bcc9]){delete _0x9b5fcd[_0x35bcc9];}}}}function freeIsNotKeyAgent(_0x1a5f04,_0x2528e3){var _0xaaff68=_[_0x3174('0x22')](_0x1a5f04,function(_0x244f69,_0x3c3204){var _0x3337d9=_[_0x3174('0x27')](_0x244f69[_0x3174('0x28')])?util[_0x3174('0x24')](_0x3174('0x25'),_0x244f69[_0x3174('0x26')]):_0x244f69[_0x3174('0x28')];return _0x3337d9;});for(var _0x350d99 in _0x2528e3){if(_0x2528e3[_0x3174('0x23')](_0x350d99)){if(!_0xaaff68[_0x350d99]){delete _0x2528e3[_0x350d99];}}}}function clearVoiceCallReports(_0xfa4ebf){_0xfa4ebf[_0x3174('0x29')]=0x0;_0xfa4ebf['answered']=0x0;_0xfa4ebf[_0x3174('0x2a')]=0x0;_0xfa4ebf[_0x3174('0x2b')]=0x0;_0xfa4ebf[_0x3174('0x2c')]=0x0;}function clearCampaigns(_0x523558){if(!_['isEmpty'](_0x523558)){for(var _0x80b312 in _0x523558){if(_0x523558[_0x3174('0x23')](_0x80b312)){_0x523558[_0x80b312]['ivrTotalCallsDays']=0x0;_0x523558[_0x80b312][_0x3174('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x396ba4){if(!_[_0x3174('0x2e')](_0x396ba4)){for(var _0x4f79d8 in _0x396ba4){if(_0x396ba4[_0x3174('0x23')](_0x4f79d8)){_0x396ba4[_0x4f79d8][_0x3174('0x29')]=0x0;_0x396ba4[_0x4f79d8]['answered']=0x0;_0x396ba4[_0x4f79d8]['unmanaged']=0x0;_0x396ba4[_0x4f79d8]['abandoned']=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x2a')]=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x2b')]=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x2c')]=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x2f')]=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x30')]=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x31')]=0x0;_0x396ba4[_0x4f79d8]['outboundCongestionCallsDay']=0x0;_0x396ba4[_0x4f79d8]['outboundNoSuchCallsDay']=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x32')]=0x0;_0x396ba4[_0x4f79d8]['outboundDropCallsDayTimeout']=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x33')]=0x0;_0x396ba4[_0x4f79d8]['outboundBlacklistCallsDay']=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x34')]=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x35')]=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x36')]=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x2f')]=0x0;_0x396ba4[_0x4f79d8][_0x3174('0x37')]=0x0;_0x396ba4[_0x4f79d8]['queueStatusComplete']=!![];}}}}Realtime[_0x3174('0x38')][_0x3174('0x39')]=function(_0x1411a4,_0x1172ae){for(var _0x2194cc in _0x1172ae){if(_0x1411a4[_0x3174('0x23')](_0x2194cc)){_0x1411a4[_0x2194cc]=_0x1172ae[_0x2194cc];}}};Realtime[_0x3174('0x38')][_0x3174('0x3a')]=function(){var _0x10704a=this;return function(_0x1108e4){if(_0x1108e4){freeIsNotKeyAgent(_0x1108e4,_0x10704a[_0x3174('0x13')]);for(var _0x130487=0x0,_0x1d8829={},_0x25df32={};_0x130487<_0x1108e4[_0x3174('0x3b')];_0x130487+=0x1){_0x1d8829=_0x1108e4[_0x130487];var _0xd79012=_[_0x3174('0x27')](_0x1d8829[_0x3174('0x28')])?util['format'](_0x3174('0x25'),_0x1d8829['name']):_0x1d8829['interface'];if(_['isUndefined'](_0x10704a[_0x3174('0x13')][_0xd79012])){_0x10704a[_0x3174('0x13')][_0xd79012]=new Agent(_0x1d8829);}else{_0x10704a[_0x3174('0x39')](_0x10704a[_0x3174('0x13')][_0xd79012],_0x1d8829);}}}return _0x10704a[_0x3174('0x13')];};};Realtime['prototype'][_0x3174('0x3c')]=function(){var _0x300faa=this;return function(_0x51da3e){if(_0x51da3e){freeIsNotKeySip(_0x51da3e,_0x300faa[_0x3174('0x14')]);for(var _0x397043=0x0,_0xed0354={},_0x5ed2e9={};_0x397043<_0x51da3e[_0x3174('0x3b')];_0x397043+=0x1){_0xed0354=_0x51da3e[_0x397043];if(_['isUndefined'](_0x300faa['telephones'][util[_0x3174('0x24')](_0x3174('0x25'),_0xed0354[_0x3174('0x26')])])){_0x300faa[_0x3174('0x14')][util[_0x3174('0x24')](_0x3174('0x25'),_0xed0354[_0x3174('0x26')])]=new Telephone(_0xed0354);}else{_0x300faa[_0x3174('0x39')](_0x300faa[_0x3174('0x14')][util[_0x3174('0x24')](_0x3174('0x25'),_0xed0354[_0x3174('0x26')])],_0xed0354);}}}return _0x300faa['telephones'];};};Realtime['prototype'][_0x3174('0x3d')]=function(){var _0x4357ed=this;return function(_0x401a70){if(_0x401a70){freeIsNotKeySip(_0x401a70,_0x4357ed[_0x3174('0x3e')]);for(var _0x2af859=0x0,_0x538c02={},_0x2da999={};_0x2af859<_0x401a70['length'];_0x2af859+=0x1){_0x538c02=_0x401a70[_0x2af859];if(_[_0x3174('0x3f')](_0x4357ed[_0x3174('0x3e')][util[_0x3174('0x24')](_0x3174('0x25'),_0x538c02[_0x3174('0x26')])])){_0x4357ed[_0x3174('0x3e')][util['format']('SIP/%s',_0x538c02[_0x3174('0x26')])]=new Trunk(_0x538c02);}else{_0x4357ed[_0x3174('0x39')](_0x4357ed[_0x3174('0x3e')][util[_0x3174('0x24')]('SIP/%s',_0x538c02[_0x3174('0x26')])],_0x538c02);}}}return _0x4357ed[_0x3174('0x3e')];};};Realtime[_0x3174('0x38')][_0x3174('0x40')]=function(){var _0x54e410=this;return function(_0x55bf2c){if(_0x55bf2c){freeIsNotKey(_0x55bf2c,_0x54e410[_0x3174('0x41')],_0x3174('0x26'));for(var _0x47035e=0x0,_0x4baaf8={},_0x281130={};_0x47035e<_0x55bf2c[_0x3174('0x3b')];_0x47035e+=0x1){_0x4baaf8=_0x55bf2c[_0x47035e];if(_[_0x3174('0x3f')](_0x54e410['voiceQueues'][_0x4baaf8[_0x3174('0x26')]])){_0x54e410['voiceQueues'][_0x4baaf8['name']]=new VoiceQueue(_0x4baaf8);}else{_0x54e410['mergeFromDatabase'](_0x54e410['voiceQueues'][_0x4baaf8[_0x3174('0x26')]],_0x4baaf8);}}}return _0x54e410[_0x3174('0x41')];};};Realtime[_0x3174('0x38')][_0x3174('0x42')]=function(){var _0x584dc0=this;return function(_0x49c10c){if(_0x49c10c){freeIsNotKey(_0x49c10c,_0x584dc0[_0x3174('0x15')],'id');for(var _0x1bd0ec=0x0,_0x2b4a60={},_0x20f678={};_0x1bd0ec<_0x49c10c[_0x3174('0x3b')];_0x1bd0ec+=0x1){_0x2b4a60=_0x49c10c[_0x1bd0ec];if(_[_0x3174('0x3f')](_0x584dc0['triggers'][_0x2b4a60['id']])){_0x584dc0['triggers'][_0x2b4a60['id']]=new Trigger(_0x2b4a60);}else{_0x584dc0[_0x3174('0x39')](_0x584dc0[_0x3174('0x15')][_0x2b4a60['id']],_0x2b4a60);}}}return _0x584dc0[_0x3174('0x15')];};};Realtime[_0x3174('0x38')][_0x3174('0x43')]=function(){var _0xc935b6=this;return function(_0x82828b){if(_0x82828b){freeIsNotKey(_0x82828b,_0xc935b6[_0x3174('0x44')],'id');for(var _0x2865e4=0x0,_0x55422f={},_0x3ba871={};_0x2865e4<_0x82828b['length'];_0x2865e4+=0x1){_0x55422f=_0x82828b[_0x2865e4];if(_[_0x3174('0x3f')](_0xc935b6[_0x3174('0x44')][_0x55422f['id']])){_0xc935b6[_0x3174('0x44')][_0x55422f['id']]=new Template(_0x55422f);}else{_0xc935b6[_0x3174('0x39')](_0xc935b6['templates'][_0x55422f['id']],_0x55422f);}}}return _0xc935b6[_0x3174('0x44')];};};Realtime[_0x3174('0x38')][_0x3174('0x45')]=function(){var _0x27f6cd=this;return function(_0x21df0e){if(_0x21df0e){freeIsNotKey(_0x21df0e,_0x27f6cd[_0x3174('0x1b')],'id');for(var _0x488230=0x0,_0x253194={},_0x360f4f={};_0x488230<_0x21df0e['length'];_0x488230+=0x1){_0x253194=_0x21df0e[_0x488230];if(_['isUndefined'](_0x27f6cd[_0x3174('0x1b')][_0x253194['id']])){_0x27f6cd[_0x3174('0x1b')][_0x253194['id']]=new ZendeskAccount(_0x253194);}else{_0x27f6cd[_0x3174('0x39')](_0x27f6cd[_0x3174('0x1b')][_0x253194['id']],_0x253194);}}}return _0x27f6cd[_0x3174('0x1b')];};};Realtime['prototype'][_0x3174('0x46')]=function(){var _0x8307c4=this;return function(_0x25f2f4){if(_0x25f2f4){freeIsNotKey(_0x25f2f4,_0x8307c4['salesforceAccounts'],'id');for(var _0x1f4df1=0x0,_0x312686={},_0x5e4318={};_0x1f4df1<_0x25f2f4[_0x3174('0x3b')];_0x1f4df1+=0x1){_0x312686=_0x25f2f4[_0x1f4df1];if(_['isUndefined'](_0x8307c4[_0x3174('0x1c')][_0x312686['id']])){_0x8307c4[_0x3174('0x1c')][_0x312686['id']]=new SalesforceAccount(_0x312686);}else{_0x8307c4['mergeFromDatabase'](_0x8307c4['salesforceAccounts'][_0x312686['id']],_0x312686);}}}return _0x8307c4[_0x3174('0x1c')];};};Realtime[_0x3174('0x38')][_0x3174('0x47')]=function(){var _0x3d9fdd=this;return function(_0x3fb6a7){if(_0x3fb6a7){freeIsNotKey(_0x3fb6a7,_0x3d9fdd['freshdeskAccounts'],'id');for(var _0x596b7c=0x0,_0x43ef2c={},_0x109acb={};_0x596b7c<_0x3fb6a7[_0x3174('0x3b')];_0x596b7c+=0x1){_0x43ef2c=_0x3fb6a7[_0x596b7c];if(_[_0x3174('0x3f')](_0x3d9fdd[_0x3174('0x48')][_0x43ef2c['id']])){_0x3d9fdd[_0x3174('0x48')][_0x43ef2c['id']]=new FreshdeskAccount(_0x43ef2c);}else{_0x3d9fdd[_0x3174('0x39')](_0x3d9fdd[_0x3174('0x48')][_0x43ef2c['id']],_0x43ef2c);}}}return _0x3d9fdd[_0x3174('0x48')];};};Realtime['prototype'][_0x3174('0x49')]=function(){var _0x314919=this;return function(_0x5022d0){if(_0x5022d0){freeIsNotKey(_0x5022d0,_0x314919[_0x3174('0x4a')],'id');for(var _0x34f795=0x0,_0x2061dc={},_0x33e463={};_0x34f795<_0x5022d0[_0x3174('0x3b')];_0x34f795+=0x1){_0x2061dc=_0x5022d0[_0x34f795];if(_[_0x3174('0x3f')](_0x314919[_0x3174('0x4a')][_0x2061dc['id']])){_0x314919['zohoAccounts'][_0x2061dc['id']]=new ZohoAccount(_0x2061dc);}else{_0x314919['mergeFromDatabase'](_0x314919['zohoAccounts'][_0x2061dc['id']],_0x2061dc);}}}return _0x314919[_0x3174('0x4a')];};};Realtime[_0x3174('0x38')]['initDeskAccounts']=function(){var _0x35bc5a=this;return function(_0x26913d){if(_0x26913d){freeIsNotKey(_0x26913d,_0x35bc5a['deskAccounts'],'id');for(var _0x259259=0x0,_0x450100={},_0x3e601d={};_0x259259<_0x26913d[_0x3174('0x3b')];_0x259259+=0x1){_0x450100=_0x26913d[_0x259259];if(_['isUndefined'](_0x35bc5a[_0x3174('0x1e')][_0x450100['id']])){_0x35bc5a[_0x3174('0x1e')][_0x450100['id']]=new DeskAccount(_0x450100);}else{_0x35bc5a[_0x3174('0x39')](_0x35bc5a[_0x3174('0x1e')][_0x450100['id']],_0x450100);}}}return _0x35bc5a[_0x3174('0x1e')];};};Realtime[_0x3174('0x38')][_0x3174('0x4b')]=function(){var _0x21015d=this;return function(_0x1582d7){if(_0x1582d7){freeIsNotKey(_0x1582d7,_0x21015d['sugarcrmAccounts'],'id');for(var _0x310caf=0x0,_0x1c7e4e={},_0x1ceaea={};_0x310caf<_0x1582d7[_0x3174('0x3b')];_0x310caf+=0x1){_0x1c7e4e=_0x1582d7[_0x310caf];if(_[_0x3174('0x3f')](_0x21015d[_0x3174('0x1d')][_0x1c7e4e['id']])){_0x21015d['sugarcrmAccounts'][_0x1c7e4e['id']]=new SugarcrmAccount(_0x1c7e4e);}else{_0x21015d[_0x3174('0x39')](_0x21015d[_0x3174('0x1d')][_0x1c7e4e['id']],_0x1c7e4e);}}}return _0x21015d[_0x3174('0x1d')];};};Realtime[_0x3174('0x38')][_0x3174('0x4c')]=function(){var _0x28ff2b=this;return function(_0x78523d){if(_0x78523d){freeIsNotKey(_0x78523d,_0x28ff2b[_0x3174('0x4d')],'id');for(var _0x389fa1=0x0,_0x5214c8={},_0x56310c={};_0x389fa1<_0x78523d[_0x3174('0x3b')];_0x389fa1+=0x1){_0x5214c8=_0x78523d[_0x389fa1];if(_[_0x3174('0x3f')](_0x28ff2b['vtigerAccounts'][_0x5214c8['id']])){_0x28ff2b[_0x3174('0x4d')][_0x5214c8['id']]=new VtigerAccount(_0x5214c8);}else{_0x28ff2b[_0x3174('0x39')](_0x28ff2b[_0x3174('0x4d')][_0x5214c8['id']],_0x5214c8);}}}return _0x28ff2b['vtigerAccounts'];};};Realtime[_0x3174('0x38')][_0x3174('0x4e')]=function(){var _0xd9a93f=this;return function(_0x30660d){if(_0x30660d){freeIsNotKey(_0x30660d,_0xd9a93f[_0x3174('0x1f')],'id');for(var _0x346b3c=0x0,_0x2a8437={},_0x480a55={};_0x346b3c<_0x30660d[_0x3174('0x3b')];_0x346b3c+=0x1){_0x2a8437=_0x30660d[_0x346b3c];if(_[_0x3174('0x3f')](_0xd9a93f[_0x3174('0x1f')][_0x2a8437['id']])){_0xd9a93f['servicenowAccounts'][_0x2a8437['id']]=new ServicenowAccount(_0x2a8437);}else{_0xd9a93f[_0x3174('0x39')](_0xd9a93f[_0x3174('0x1f')][_0x2a8437['id']],_0x2a8437);}}}return _0xd9a93f[_0x3174('0x1f')];};};Realtime[_0x3174('0x38')][_0x3174('0x4f')]=function(){var _0x5bdf63=this;return function(_0x1d0ace){if(_0x1d0ace){freeIsNotKey(_0x1d0ace,_0x5bdf63[_0x3174('0x50')],'id');for(var _0x1b7f94=0x0,_0x29ac8f={},_0x3a6076={};_0x1b7f94<_0x1d0ace[_0x3174('0x3b')];_0x1b7f94+=0x1){_0x29ac8f=_0x1d0ace[_0x1b7f94];if(_[_0x3174('0x3f')](_0x5bdf63[_0x3174('0x50')][_0x29ac8f['id']])){_0x5bdf63[_0x3174('0x50')][_0x29ac8f['id']]=new Dynamics365Account(_0x29ac8f);}else{_0x5bdf63['mergeFromDatabase'](_0x5bdf63[_0x3174('0x50')][_0x29ac8f['id']],_0x29ac8f);}}}return _0x5bdf63[_0x3174('0x50')];};};Realtime['prototype'][_0x3174('0x51')]=function(){var _0x5b75eb=this;return function(_0xb4141b){if(_0xb4141b){freeIsNotKey(_0xb4141b,_0x5b75eb[_0x3174('0x20')],'id');for(var _0x283647=0x0,_0x52b1c1={},_0x21e5ea={};_0x283647<_0xb4141b[_0x3174('0x3b')];_0x283647+=0x1){_0x52b1c1=_0xb4141b[_0x283647];if(_['isUndefined'](_0x5b75eb[_0x3174('0x20')][_0x52b1c1['id']])){_0x5b75eb[_0x3174('0x20')][_0x52b1c1['id']]=new FreshsalesAccount(_0x52b1c1);}else{_0x5b75eb['mergeFromDatabase'](_0x5b75eb[_0x3174('0x20')][_0x52b1c1['id']],_0x52b1c1);}}}return _0x5b75eb[_0x3174('0x20')];};};Realtime[_0x3174('0x38')][_0x3174('0x52')]=function(){var _0x8997ac=this;return function(_0x5b9fa9){for(var _0x257bf8=0x0;_0x257bf8<_0x5b9fa9['length'];_0x257bf8+=0x1){_[_0x3174('0x53')](_0x8997ac[_0x3174('0x41')][_0x5b9fa9[_0x257bf8][_0x3174('0x26')]],_0x5b9fa9[_0x257bf8]);}return _0x8997ac[_0x3174('0x41')];};};Realtime[_0x3174('0x38')][_0x3174('0x54')]=function(){var _0x262ab9=this;return function(_0x1f6ad4){clearVoiceQueues(_0x262ab9['voiceQueues']);if(_0x1f6ad4){_0x1f6ad4=_[_0x3174('0x55')](_0x1f6ad4,'uniqueid');for(var _0x231530 in _0x1f6ad4){if(_0x1f6ad4[_0x3174('0x23')](_0x231530)){var _0x1f58b8={};for(var _0x25ddf3=0x0;_0x25ddf3<_0x1f6ad4[_0x231530]['length'];_0x25ddf3+=0x1){var _0x1305bc=_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x56')];if(_0x262ab9[_0x3174('0x41')][_0x1305bc]){if(_0x1f6ad4[_0x231530][_0x25ddf3]['queuecallerexit']){_0x262ab9[_0x3174('0x41')][_0x1305bc][_0x3174('0x57')]+=0x1;}if(_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x58')]){_0x262ab9['voiceQueues'][_0x1305bc][_0x3174('0x59')]+=0x1;}_0x262ab9[_0x3174('0x41')][_0x1305bc]['sumHoldTime']+=moment(_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x5a')])['diff'](moment(_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x5b')]),_0x3174('0x5c'))||0x0;if(_0x25ddf3===_0x1f6ad4[_0x231530][_0x3174('0x3b')]-0x1){_0x262ab9[_0x3174('0x41')][_0x1305bc]['sumDuration']+=moment(_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x5d')]||_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x5e')]||_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x5f')])['diff'](moment(_0x1f6ad4[_0x231530][_0x25ddf3]['queuecallerjoinAt']),_0x3174('0x5c'))||0x0;_0x262ab9[_0x3174('0x41')][_0x1305bc]['total']+=0x1;if(_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x60')]){_0x262ab9[_0x3174('0x41')][_0x1305bc][_0x3174('0x61')]+=0x1;_0x262ab9[_0x3174('0x41')][_0x1305bc][_0x3174('0x2c')]+=moment(_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x5d')])[_0x3174('0x62')](moment(_0x1f6ad4[_0x231530][_0x25ddf3][_0x3174('0x5a')]),_0x3174('0x5c'))||0x0;}}else{_0x262ab9['voiceQueues'][_0x1305bc][_0x3174('0x2b')]+=_0x262ab9[_0x3174('0x41')][_0x1305bc][_0x3174('0x2a')]||0x0;}}}}}}return _0x262ab9['voiceQueues'];};};Realtime[_0x3174('0x38')][_0x3174('0x63')]=function(){var _0x1dd676=this;return function(_0x110051){clearVoiceCallReports(_0x1dd676[_0x3174('0x64')]);if(_0x110051){for(var _0x3f88c1=0x0;_0x3f88c1<_0x110051['length'];_0x3f88c1+=0x1){_0x1dd676[_0x3174('0x64')][_0x3174('0x29')]+=0x1;_0x1dd676[_0x3174('0x64')][_0x3174('0x2b')]+=_0x110051[_0x3f88c1]['duration'];if(_0x110051[_0x3f88c1][_0x3174('0x65')]===_0x3174('0x66')){_0x1dd676['outbound'][_0x3174('0x61')]+=0x1;_0x1dd676[_0x3174('0x64')]['sumHoldTime']+=_0x110051[_0x3f88c1][_0x3174('0x67')]-_0x110051[_0x3f88c1][_0x3174('0x68')]||0x0;_0x1dd676[_0x3174('0x64')][_0x3174('0x2c')]+=_0x110051[_0x3f88c1][_0x3174('0x68')];}}}return _0x1dd676[_0x3174('0x64')];};};Realtime[_0x3174('0x38')]['initCampaigns']=function(){var _0x331e7c=this;return function(_0x1039c5){if(_0x1039c5){freeIsNotKey(_0x1039c5,_0x331e7c[_0x3174('0x16')],_0x3174('0x26'));for(var _0x5152a4=0x0,_0x3e020f={};_0x5152a4<_0x1039c5[_0x3174('0x3b')];_0x5152a4+=0x1){_0x3e020f=_0x1039c5[_0x5152a4];if(_[_0x3174('0x3f')](_0x331e7c['campaigns'][_0x3e020f[_0x3174('0x26')]])){_0x331e7c[_0x3174('0x16')][_0x3e020f[_0x3174('0x26')]]=new Campaign(_0x3e020f);}else{_0x331e7c[_0x3174('0x39')](_0x331e7c[_0x3174('0x16')][_0x3e020f[_0x3174('0x26')]],_0x3e020f);_0x331e7c[_0x3174('0x16')][_0x3e020f[_0x3174('0x26')]][_0x3174('0x69')]=_0x3e020f[_0x3174('0x6a')]?_0x3e020f[_0x3174('0x6a')]['name']:undefined;}}}return _0x331e7c[_0x3174('0x16')];};};Realtime[_0x3174('0x38')][_0x3174('0x6b')]=function(){var _0x41fbdb=this;return function(_0x268c90){if(_0x268c90){freeIsNotKey(_0x268c90,_0x41fbdb[_0x3174('0x17')],'id');for(var _0xaf8a7b=0x0,_0x2c91e0={};_0xaf8a7b<_0x268c90[_0x3174('0x3b')];_0xaf8a7b+=0x1){_0x2c91e0=_0x268c90[_0xaf8a7b];if(_[_0x3174('0x3f')](_0x41fbdb['voiceExtensions'][_0x2c91e0['id']])){_0x41fbdb[_0x3174('0x17')][_0x2c91e0['id']]=new VoiceExtension(_0x2c91e0);}else{_0x41fbdb[_0x3174('0x39')](_0x41fbdb[_0x3174('0x17')][_0x2c91e0['id']],_0x2c91e0);}}}return _0x41fbdb[_0x3174('0x17')];};};Realtime[_0x3174('0x38')][_0x3174('0x6c')]=function(){var _0xab05e5=this;return function(_0x1afcf2){clearCampaigns(_0xab05e5[_0x3174('0x16')]);for(var _0x5344a2=0x0;_0x5344a2<_0x1afcf2[_0x3174('0x3b')];_0x5344a2+=0x1){_['merge'](_0xab05e5[_0x3174('0x16')][_0x1afcf2[_0x5344a2][_0x3174('0x26')]],_0x1afcf2[_0x5344a2]);}return _0xab05e5[_0x3174('0x16')];};};Realtime[_0x3174('0x38')][_0x3174('0x6d')]=function(){var _0x4de129=this;return function(_0x638300){if(_0x638300){freeIsNotKey(_0x638300,_0x4de129[_0x3174('0x21')],'id');for(var _0x233c99=0x0,_0x52dc27={},_0x162db3={};_0x233c99<_0x638300[_0x3174('0x3b')];_0x233c99+=0x1){_0x52dc27=_0x638300[_0x233c99];if(_[_0x3174('0x3f')](_0x4de129[_0x3174('0x21')][_0x52dc27['id']])){_0x4de129[_0x3174('0x21')][_0x52dc27['id']]=new FaxAccount(_0x52dc27);}else{_0x4de129[_0x3174('0x39')](_0x4de129[_0x3174('0x21')][_0x52dc27['id']],_0x52dc27);}}}return _0x4de129[_0x3174('0x21')];};};module[_0x3174('0x6e')]=Realtime; \ No newline at end of file +var _0x2b3a=['isUndefined','agents','mergeFromDatabase','initTelephones','trunks','initTriggers','initTemplates','templates','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','diff','seconds','sumDuration','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','bluebird','util','lodash','../model/agent','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','outboundChannels','timers','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length'];(function(_0x113d23,_0x1f3ea4){var _0x4c9e06=function(_0x159023){while(--_0x159023){_0x113d23['push'](_0x113d23['shift']());}};_0x4c9e06(++_0x1f3ea4);}(_0x2b3a,0x1c3));var _0xa2b3=function(_0x1ca3a0,_0x8c8db9){_0x1ca3a0=_0x1ca3a0-0x0;var _0x33da97=_0x2b3a[_0x1ca3a0];return _0x33da97;};'use strict';var BPromise=require(_0xa2b3('0x0'));var util=require(_0xa2b3('0x1'));var _=require(_0xa2b3('0x2'));var moment=require('moment');var Agent=require(_0xa2b3('0x3'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa2b3('0x4'));var Trigger=require(_0xa2b3('0x5'));var Template=require(_0xa2b3('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xa2b3('0x7'));var ZendeskAccount=require(_0xa2b3('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xa2b3('0x9'));var ZohoAccount=require(_0xa2b3('0xa'));var DeskAccount=require(_0xa2b3('0xb'));var VtigerAccount=require(_0xa2b3('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xa2b3('0xd'));var FreshsalesAccount=require(_0xa2b3('0xe'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0xa2b3('0xf')]={};this['trunks']={};this[_0xa2b3('0x10')]={};this[_0xa2b3('0x11')]={};this[_0xa2b3('0x12')]={};this['templates']={};this[_0xa2b3('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa2b3('0x14')]={};this[_0xa2b3('0x15')]={};this['queueChannels']={};this[_0xa2b3('0x16')]={};this[_0xa2b3('0x17')]={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0xa2b3('0x18')]={};this[_0xa2b3('0x19')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xa2b3('0x1a')]={};this[_0xa2b3('0x1b')]={};this[_0xa2b3('0x1c')]={};this[_0xa2b3('0x1d')]={};this[_0xa2b3('0x1e')]={};};function freeIsNotKey(_0x37a704,_0x87bdc7,_0x550a2a){var _0x4c6d86=_[_0xa2b3('0x1f')](_0x37a704,function(_0x2ea435,_0x45450e){return _0x2ea435[_0x550a2a];});for(var _0x21a0f9 in _0x87bdc7){if(_0x87bdc7[_0xa2b3('0x20')](_0x21a0f9)){if(!_0x4c6d86[_0x21a0f9]){delete _0x87bdc7[_0x21a0f9];}}}}function freeIsNotKeySip(_0x14b6be,_0x50ae4f){var _0x5a3d1d=_[_0xa2b3('0x1f')](_0x14b6be,function(_0x2873e7,_0x32b660){return util[_0xa2b3('0x21')](_0xa2b3('0x22'),_0x2873e7[_0xa2b3('0x23')]);});for(var _0x5a695c in _0x50ae4f){if(_0x50ae4f[_0xa2b3('0x20')](_0x5a695c)){if(!_0x5a3d1d[_0x5a695c]){delete _0x50ae4f[_0x5a695c];}}}}function freeIsNotKeyAgent(_0x499224,_0x3abbfc){var _0x26f655=_[_0xa2b3('0x1f')](_0x499224,function(_0x294f32,_0x5bfbaf){var _0x4dd0e7=_[_0xa2b3('0x24')](_0x294f32[_0xa2b3('0x25')])?util[_0xa2b3('0x21')](_0xa2b3('0x22'),_0x294f32['name']):_0x294f32['interface'];return _0x4dd0e7;});for(var _0x9492c6 in _0x3abbfc){if(_0x3abbfc[_0xa2b3('0x20')](_0x9492c6)){if(!_0x26f655[_0x9492c6]){delete _0x3abbfc[_0x9492c6];}}}}function clearVoiceCallReports(_0x1e78b6){_0x1e78b6[_0xa2b3('0x26')]=0x0;_0x1e78b6[_0xa2b3('0x27')]=0x0;_0x1e78b6[_0xa2b3('0x28')]=0x0;_0x1e78b6['sumDuration']=0x0;_0x1e78b6[_0xa2b3('0x29')]=0x0;}function clearCampaigns(_0x288024){if(!_[_0xa2b3('0x2a')](_0x288024)){for(var _0x52432e in _0x288024){if(_0x288024['hasOwnProperty'](_0x52432e)){_0x288024[_0x52432e][_0xa2b3('0x2b')]=0x0;_0x288024[_0x52432e][_0xa2b3('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x4ede1f){if(!_[_0xa2b3('0x2a')](_0x4ede1f)){for(var _0x4b7fea in _0x4ede1f){if(_0x4ede1f['hasOwnProperty'](_0x4b7fea)){_0x4ede1f[_0x4b7fea]['total']=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x27')]=0x0;_0x4ede1f[_0x4b7fea]['unmanaged']=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x2d')]=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x28')]=0x0;_0x4ede1f[_0x4b7fea]['sumDuration']=0x0;_0x4ede1f[_0x4b7fea]['sumBillable']=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x2e')]=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x2f')]=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x30')]=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x31')]=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x32')]=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x33')]=0x0;_0x4ede1f[_0x4b7fea]['outboundDropCallsDayTimeout']=0x0;_0x4ede1f[_0x4b7fea]['outboundDropCallsDayCallersExit']=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x34')]=0x0;_0x4ede1f[_0x4b7fea]['outboundOriginateFailureCallsDay']=0x0;_0x4ede1f[_0x4b7fea]['outboundRejectCallsDay']=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x35')]=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x2e')]=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x36')]=0x0;_0x4ede1f[_0x4b7fea][_0xa2b3('0x37')]=!![];}}}}Realtime[_0xa2b3('0x38')]['mergeFromDatabase']=function(_0x34cd99,_0x1364d3){for(var _0x2aa4a2 in _0x1364d3){if(_0x34cd99[_0xa2b3('0x20')](_0x2aa4a2)){_0x34cd99[_0x2aa4a2]=_0x1364d3[_0x2aa4a2];}}};Realtime[_0xa2b3('0x38')][_0xa2b3('0x39')]=function(){var _0x22bfdf=this;return function(_0x14e11f){if(_0x14e11f){freeIsNotKeyAgent(_0x14e11f,_0x22bfdf['agents']);for(var _0x1ce417=0x0,_0x22404f={},_0x3fc521={};_0x1ce417<_0x14e11f[_0xa2b3('0x3a')];_0x1ce417+=0x1){_0x22404f=_0x14e11f[_0x1ce417];var _0x17e73f=_[_0xa2b3('0x24')](_0x22404f[_0xa2b3('0x25')])?util[_0xa2b3('0x21')]('SIP/%s',_0x22404f['name']):_0x22404f[_0xa2b3('0x25')];if(_[_0xa2b3('0x3b')](_0x22bfdf[_0xa2b3('0x3c')][_0x17e73f])){_0x22bfdf[_0xa2b3('0x3c')][_0x17e73f]=new Agent(_0x22404f);}else{_0x22bfdf[_0xa2b3('0x3d')](_0x22bfdf['agents'][_0x17e73f],_0x22404f);}}}return _0x22bfdf[_0xa2b3('0x3c')];};};Realtime['prototype'][_0xa2b3('0x3e')]=function(){var _0x327bee=this;return function(_0x2d4cf0){if(_0x2d4cf0){freeIsNotKeySip(_0x2d4cf0,_0x327bee[_0xa2b3('0xf')]);for(var _0x58e00a=0x0,_0x1ecb94={},_0x9cae0c={};_0x58e00a<_0x2d4cf0[_0xa2b3('0x3a')];_0x58e00a+=0x1){_0x1ecb94=_0x2d4cf0[_0x58e00a];if(_[_0xa2b3('0x3b')](_0x327bee[_0xa2b3('0xf')][util[_0xa2b3('0x21')](_0xa2b3('0x22'),_0x1ecb94[_0xa2b3('0x23')])])){_0x327bee[_0xa2b3('0xf')][util[_0xa2b3('0x21')](_0xa2b3('0x22'),_0x1ecb94[_0xa2b3('0x23')])]=new Telephone(_0x1ecb94);}else{_0x327bee[_0xa2b3('0x3d')](_0x327bee[_0xa2b3('0xf')][util[_0xa2b3('0x21')](_0xa2b3('0x22'),_0x1ecb94[_0xa2b3('0x23')])],_0x1ecb94);}}}return _0x327bee[_0xa2b3('0xf')];};};Realtime[_0xa2b3('0x38')]['initTrunks']=function(){var _0x48bdcb=this;return function(_0x1da179){if(_0x1da179){freeIsNotKeySip(_0x1da179,_0x48bdcb[_0xa2b3('0x3f')]);for(var _0x3a2c56=0x0,_0x3f2693={},_0x4370d1={};_0x3a2c56<_0x1da179[_0xa2b3('0x3a')];_0x3a2c56+=0x1){_0x3f2693=_0x1da179[_0x3a2c56];if(_['isUndefined'](_0x48bdcb[_0xa2b3('0x3f')][util['format'](_0xa2b3('0x22'),_0x3f2693[_0xa2b3('0x23')])])){_0x48bdcb[_0xa2b3('0x3f')][util['format']('SIP/%s',_0x3f2693['name'])]=new Trunk(_0x3f2693);}else{_0x48bdcb[_0xa2b3('0x3d')](_0x48bdcb[_0xa2b3('0x3f')][util[_0xa2b3('0x21')](_0xa2b3('0x22'),_0x3f2693['name'])],_0x3f2693);}}}return _0x48bdcb[_0xa2b3('0x3f')];};};Realtime[_0xa2b3('0x38')]['initVoiceQueues']=function(){var _0x4b7efe=this;return function(_0x5aa782){if(_0x5aa782){freeIsNotKey(_0x5aa782,_0x4b7efe[_0xa2b3('0x10')],_0xa2b3('0x23'));for(var _0x730de3=0x0,_0x3ba792={},_0x2ebf13={};_0x730de3<_0x5aa782[_0xa2b3('0x3a')];_0x730de3+=0x1){_0x3ba792=_0x5aa782[_0x730de3];if(_['isUndefined'](_0x4b7efe[_0xa2b3('0x10')][_0x3ba792[_0xa2b3('0x23')]])){_0x4b7efe[_0xa2b3('0x10')][_0x3ba792[_0xa2b3('0x23')]]=new VoiceQueue(_0x3ba792);}else{_0x4b7efe[_0xa2b3('0x3d')](_0x4b7efe[_0xa2b3('0x10')][_0x3ba792[_0xa2b3('0x23')]],_0x3ba792);}}}return _0x4b7efe[_0xa2b3('0x10')];};};Realtime['prototype'][_0xa2b3('0x40')]=function(){var _0x53d208=this;return function(_0x37da93){if(_0x37da93){freeIsNotKey(_0x37da93,_0x53d208[_0xa2b3('0x11')],'id');for(var _0x413069=0x0,_0x562c3b={},_0x1fee49={};_0x413069<_0x37da93['length'];_0x413069+=0x1){_0x562c3b=_0x37da93[_0x413069];if(_[_0xa2b3('0x3b')](_0x53d208['triggers'][_0x562c3b['id']])){_0x53d208[_0xa2b3('0x11')][_0x562c3b['id']]=new Trigger(_0x562c3b);}else{_0x53d208[_0xa2b3('0x3d')](_0x53d208[_0xa2b3('0x11')][_0x562c3b['id']],_0x562c3b);}}}return _0x53d208[_0xa2b3('0x11')];};};Realtime[_0xa2b3('0x38')][_0xa2b3('0x41')]=function(){var _0x1ca8a3=this;return function(_0x2225fc){if(_0x2225fc){freeIsNotKey(_0x2225fc,_0x1ca8a3[_0xa2b3('0x42')],'id');for(var _0x4be9e2=0x0,_0x163ea5={},_0x54af9d={};_0x4be9e2<_0x2225fc['length'];_0x4be9e2+=0x1){_0x163ea5=_0x2225fc[_0x4be9e2];if(_[_0xa2b3('0x3b')](_0x1ca8a3['templates'][_0x163ea5['id']])){_0x1ca8a3['templates'][_0x163ea5['id']]=new Template(_0x163ea5);}else{_0x1ca8a3['mergeFromDatabase'](_0x1ca8a3[_0xa2b3('0x42')][_0x163ea5['id']],_0x163ea5);}}}return _0x1ca8a3[_0xa2b3('0x42')];};};Realtime[_0xa2b3('0x38')]['initZendeskAccounts']=function(){var _0x45d35f=this;return function(_0x301c72){if(_0x301c72){freeIsNotKey(_0x301c72,_0x45d35f[_0xa2b3('0x43')],'id');for(var _0x2ced78=0x0,_0x428f40={},_0xc953c8={};_0x2ced78<_0x301c72[_0xa2b3('0x3a')];_0x2ced78+=0x1){_0x428f40=_0x301c72[_0x2ced78];if(_[_0xa2b3('0x3b')](_0x45d35f[_0xa2b3('0x43')][_0x428f40['id']])){_0x45d35f[_0xa2b3('0x43')][_0x428f40['id']]=new ZendeskAccount(_0x428f40);}else{_0x45d35f['mergeFromDatabase'](_0x45d35f['zendeskAccounts'][_0x428f40['id']],_0x428f40);}}}return _0x45d35f[_0xa2b3('0x43')];};};Realtime[_0xa2b3('0x38')][_0xa2b3('0x44')]=function(){var _0x7939ce=this;return function(_0x564159){if(_0x564159){freeIsNotKey(_0x564159,_0x7939ce[_0xa2b3('0x45')],'id');for(var _0x18fc08=0x0,_0x50bf3e={},_0x1e0574={};_0x18fc08<_0x564159[_0xa2b3('0x3a')];_0x18fc08+=0x1){_0x50bf3e=_0x564159[_0x18fc08];if(_[_0xa2b3('0x3b')](_0x7939ce[_0xa2b3('0x45')][_0x50bf3e['id']])){_0x7939ce[_0xa2b3('0x45')][_0x50bf3e['id']]=new SalesforceAccount(_0x50bf3e);}else{_0x7939ce[_0xa2b3('0x3d')](_0x7939ce[_0xa2b3('0x45')][_0x50bf3e['id']],_0x50bf3e);}}}return _0x7939ce[_0xa2b3('0x45')];};};Realtime['prototype'][_0xa2b3('0x46')]=function(){var _0xb595fa=this;return function(_0x136713){if(_0x136713){freeIsNotKey(_0x136713,_0xb595fa[_0xa2b3('0x19')],'id');for(var _0x518f03=0x0,_0x48177f={},_0x422d34={};_0x518f03<_0x136713['length'];_0x518f03+=0x1){_0x48177f=_0x136713[_0x518f03];if(_[_0xa2b3('0x3b')](_0xb595fa[_0xa2b3('0x19')][_0x48177f['id']])){_0xb595fa[_0xa2b3('0x19')][_0x48177f['id']]=new FreshdeskAccount(_0x48177f);}else{_0xb595fa['mergeFromDatabase'](_0xb595fa[_0xa2b3('0x19')][_0x48177f['id']],_0x48177f);}}}return _0xb595fa[_0xa2b3('0x19')];};};Realtime['prototype'][_0xa2b3('0x47')]=function(){var _0x334e48=this;return function(_0x312506){if(_0x312506){freeIsNotKey(_0x312506,_0x334e48['zohoAccounts'],'id');for(var _0x4fefd3=0x0,_0xb53db3={},_0x5d6eac={};_0x4fefd3<_0x312506[_0xa2b3('0x3a')];_0x4fefd3+=0x1){_0xb53db3=_0x312506[_0x4fefd3];if(_[_0xa2b3('0x3b')](_0x334e48[_0xa2b3('0x48')][_0xb53db3['id']])){_0x334e48[_0xa2b3('0x48')][_0xb53db3['id']]=new ZohoAccount(_0xb53db3);}else{_0x334e48[_0xa2b3('0x3d')](_0x334e48[_0xa2b3('0x48')][_0xb53db3['id']],_0xb53db3);}}}return _0x334e48[_0xa2b3('0x48')];};};Realtime[_0xa2b3('0x38')][_0xa2b3('0x49')]=function(){var _0x2a3b75=this;return function(_0x5d1513){if(_0x5d1513){freeIsNotKey(_0x5d1513,_0x2a3b75['deskAccounts'],'id');for(var _0x2e3241=0x0,_0x461cae={},_0x5812a6={};_0x2e3241<_0x5d1513[_0xa2b3('0x3a')];_0x2e3241+=0x1){_0x461cae=_0x5d1513[_0x2e3241];if(_['isUndefined'](_0x2a3b75[_0xa2b3('0x4a')][_0x461cae['id']])){_0x2a3b75['deskAccounts'][_0x461cae['id']]=new DeskAccount(_0x461cae);}else{_0x2a3b75['mergeFromDatabase'](_0x2a3b75[_0xa2b3('0x4a')][_0x461cae['id']],_0x461cae);}}}return _0x2a3b75[_0xa2b3('0x4a')];};};Realtime[_0xa2b3('0x38')][_0xa2b3('0x4b')]=function(){var _0x10ed9f=this;return function(_0x513545){if(_0x513545){freeIsNotKey(_0x513545,_0x10ed9f[_0xa2b3('0x18')],'id');for(var _0x30f831=0x0,_0x5d6ae2={},_0x3794cc={};_0x30f831<_0x513545['length'];_0x30f831+=0x1){_0x5d6ae2=_0x513545[_0x30f831];if(_[_0xa2b3('0x3b')](_0x10ed9f[_0xa2b3('0x18')][_0x5d6ae2['id']])){_0x10ed9f[_0xa2b3('0x18')][_0x5d6ae2['id']]=new SugarcrmAccount(_0x5d6ae2);}else{_0x10ed9f['mergeFromDatabase'](_0x10ed9f[_0xa2b3('0x18')][_0x5d6ae2['id']],_0x5d6ae2);}}}return _0x10ed9f[_0xa2b3('0x18')];};};Realtime[_0xa2b3('0x38')]['initVtigerAccounts']=function(){var _0x4ea6ea=this;return function(_0x3c7820){if(_0x3c7820){freeIsNotKey(_0x3c7820,_0x4ea6ea['vtigerAccounts'],'id');for(var _0x2fc50d=0x0,_0x30e17c={},_0x4bc413={};_0x2fc50d<_0x3c7820[_0xa2b3('0x3a')];_0x2fc50d+=0x1){_0x30e17c=_0x3c7820[_0x2fc50d];if(_['isUndefined'](_0x4ea6ea[_0xa2b3('0x1a')][_0x30e17c['id']])){_0x4ea6ea[_0xa2b3('0x1a')][_0x30e17c['id']]=new VtigerAccount(_0x30e17c);}else{_0x4ea6ea[_0xa2b3('0x3d')](_0x4ea6ea['vtigerAccounts'][_0x30e17c['id']],_0x30e17c);}}}return _0x4ea6ea['vtigerAccounts'];};};Realtime[_0xa2b3('0x38')][_0xa2b3('0x4c')]=function(){var _0xe33df9=this;return function(_0x42bc19){if(_0x42bc19){freeIsNotKey(_0x42bc19,_0xe33df9[_0xa2b3('0x1b')],'id');for(var _0x5e92bd=0x0,_0x42e401={},_0x2ec07d={};_0x5e92bd<_0x42bc19[_0xa2b3('0x3a')];_0x5e92bd+=0x1){_0x42e401=_0x42bc19[_0x5e92bd];if(_['isUndefined'](_0xe33df9[_0xa2b3('0x1b')][_0x42e401['id']])){_0xe33df9[_0xa2b3('0x1b')][_0x42e401['id']]=new ServicenowAccount(_0x42e401);}else{_0xe33df9[_0xa2b3('0x3d')](_0xe33df9['servicenowAccounts'][_0x42e401['id']],_0x42e401);}}}return _0xe33df9[_0xa2b3('0x1b')];};};Realtime[_0xa2b3('0x38')][_0xa2b3('0x4d')]=function(){var _0x469626=this;return function(_0x3b8517){if(_0x3b8517){freeIsNotKey(_0x3b8517,_0x469626[_0xa2b3('0x1c')],'id');for(var _0x2a95c6=0x0,_0x3850c7={},_0x10e05f={};_0x2a95c6<_0x3b8517['length'];_0x2a95c6+=0x1){_0x3850c7=_0x3b8517[_0x2a95c6];if(_[_0xa2b3('0x3b')](_0x469626[_0xa2b3('0x1c')][_0x3850c7['id']])){_0x469626[_0xa2b3('0x1c')][_0x3850c7['id']]=new Dynamics365Account(_0x3850c7);}else{_0x469626['mergeFromDatabase'](_0x469626['dynamics365Accounts'][_0x3850c7['id']],_0x3850c7);}}}return _0x469626[_0xa2b3('0x1c')];};};Realtime['prototype'][_0xa2b3('0x4e')]=function(){var _0x223e26=this;return function(_0x5de6ee){if(_0x5de6ee){freeIsNotKey(_0x5de6ee,_0x223e26[_0xa2b3('0x1d')],'id');for(var _0x3280bc=0x0,_0x15f027={},_0x352787={};_0x3280bc<_0x5de6ee[_0xa2b3('0x3a')];_0x3280bc+=0x1){_0x15f027=_0x5de6ee[_0x3280bc];if(_['isUndefined'](_0x223e26[_0xa2b3('0x1d')][_0x15f027['id']])){_0x223e26[_0xa2b3('0x1d')][_0x15f027['id']]=new FreshsalesAccount(_0x15f027);}else{_0x223e26[_0xa2b3('0x3d')](_0x223e26[_0xa2b3('0x1d')][_0x15f027['id']],_0x15f027);}}}return _0x223e26[_0xa2b3('0x1d')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x102b1c=this;return function(_0x3d7e5f){for(var _0x479668=0x0;_0x479668<_0x3d7e5f[_0xa2b3('0x3a')];_0x479668+=0x1){_[_0xa2b3('0x4f')](_0x102b1c[_0xa2b3('0x10')][_0x3d7e5f[_0x479668]['name']],_0x3d7e5f[_0x479668]);}return _0x102b1c['voiceQueues'];};};Realtime[_0xa2b3('0x38')][_0xa2b3('0x50')]=function(){var _0x4c3179=this;return function(_0x6c63c0){clearVoiceQueues(_0x4c3179[_0xa2b3('0x10')]);if(_0x6c63c0){_0x6c63c0=_[_0xa2b3('0x51')](_0x6c63c0,_0xa2b3('0x52'));for(var _0x7eff0a in _0x6c63c0){if(_0x6c63c0[_0xa2b3('0x20')](_0x7eff0a)){var _0x5dabd4={};for(var _0x4c0f16=0x0;_0x4c0f16<_0x6c63c0[_0x7eff0a]['length'];_0x4c0f16+=0x1){var _0x460829=_0x6c63c0[_0x7eff0a][_0x4c0f16][_0xa2b3('0x53')];if(_0x4c3179[_0xa2b3('0x10')][_0x460829]){if(_0x6c63c0[_0x7eff0a][_0x4c0f16][_0xa2b3('0x54')]){_0x4c3179[_0xa2b3('0x10')][_0x460829][_0xa2b3('0x55')]+=0x1;}if(_0x6c63c0[_0x7eff0a][_0x4c0f16][_0xa2b3('0x56')]){_0x4c3179[_0xa2b3('0x10')][_0x460829][_0xa2b3('0x2d')]+=0x1;}_0x4c3179['voiceQueues'][_0x460829][_0xa2b3('0x28')]+=moment(_0x6c63c0[_0x7eff0a][_0x4c0f16][_0xa2b3('0x57')])['diff'](moment(_0x6c63c0[_0x7eff0a][_0x4c0f16][_0xa2b3('0x58')]),'seconds')||0x0;if(_0x4c0f16===_0x6c63c0[_0x7eff0a][_0xa2b3('0x3a')]-0x1){_0x4c3179[_0xa2b3('0x10')][_0x460829]['sumDuration']+=moment(_0x6c63c0[_0x7eff0a][_0x4c0f16][_0xa2b3('0x59')]||_0x6c63c0[_0x7eff0a][_0x4c0f16][_0xa2b3('0x5a')]||_0x6c63c0[_0x7eff0a][_0x4c0f16]['queuecallerexitAt'])[_0xa2b3('0x5b')](moment(_0x6c63c0[_0x7eff0a][_0x4c0f16]['queuecallerjoinAt']),'seconds')||0x0;_0x4c3179[_0xa2b3('0x10')][_0x460829][_0xa2b3('0x26')]+=0x1;if(_0x6c63c0[_0x7eff0a][_0x4c0f16]['queuecallercomplete']){_0x4c3179[_0xa2b3('0x10')][_0x460829][_0xa2b3('0x27')]+=0x1;_0x4c3179[_0xa2b3('0x10')][_0x460829]['sumBillable']+=moment(_0x6c63c0[_0x7eff0a][_0x4c0f16]['queuecallercompleteAt'])[_0xa2b3('0x5b')](moment(_0x6c63c0[_0x7eff0a][_0x4c0f16][_0xa2b3('0x57')]),_0xa2b3('0x5c'))||0x0;}}else{_0x4c3179[_0xa2b3('0x10')][_0x460829][_0xa2b3('0x5d')]+=_0x4c3179[_0xa2b3('0x10')][_0x460829][_0xa2b3('0x28')]||0x0;}}}}}}return _0x4c3179['voiceQueues'];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x12065d=this;return function(_0x227a86){clearVoiceCallReports(_0x12065d[_0xa2b3('0x13')]);if(_0x227a86){for(var _0x5d935a=0x0;_0x5d935a<_0x227a86[_0xa2b3('0x3a')];_0x5d935a+=0x1){_0x12065d[_0xa2b3('0x13')][_0xa2b3('0x26')]+=0x1;_0x12065d[_0xa2b3('0x13')][_0xa2b3('0x5d')]+=_0x227a86[_0x5d935a][_0xa2b3('0x5e')];if(_0x227a86[_0x5d935a][_0xa2b3('0x5f')]===_0xa2b3('0x60')){_0x12065d[_0xa2b3('0x13')]['answered']+=0x1;_0x12065d[_0xa2b3('0x13')][_0xa2b3('0x28')]+=_0x227a86[_0x5d935a]['duration']-_0x227a86[_0x5d935a][_0xa2b3('0x61')]||0x0;_0x12065d[_0xa2b3('0x13')][_0xa2b3('0x29')]+=_0x227a86[_0x5d935a][_0xa2b3('0x61')];}}}return _0x12065d['outbound'];};};Realtime[_0xa2b3('0x38')]['initCampaigns']=function(){var _0x213060=this;return function(_0x2d45ee){if(_0x2d45ee){freeIsNotKey(_0x2d45ee,_0x213060['campaigns'],_0xa2b3('0x23'));for(var _0x389dd8=0x0,_0x2c63eb={};_0x389dd8<_0x2d45ee[_0xa2b3('0x3a')];_0x389dd8+=0x1){_0x2c63eb=_0x2d45ee[_0x389dd8];if(_[_0xa2b3('0x3b')](_0x213060[_0xa2b3('0x12')][_0x2c63eb[_0xa2b3('0x23')]])){_0x213060[_0xa2b3('0x12')][_0x2c63eb[_0xa2b3('0x23')]]=new Campaign(_0x2c63eb);}else{_0x213060['mergeFromDatabase'](_0x213060[_0xa2b3('0x12')][_0x2c63eb['name']],_0x2c63eb);_0x213060[_0xa2b3('0x12')][_0x2c63eb[_0xa2b3('0x23')]][_0xa2b3('0x62')]=_0x2c63eb['SquareProject']?_0x2c63eb[_0xa2b3('0x63')][_0xa2b3('0x23')]:undefined;}}}return _0x213060['campaigns'];};};Realtime['prototype'][_0xa2b3('0x64')]=function(){var _0x45e87a=this;return function(_0x5d1586){if(_0x5d1586){freeIsNotKey(_0x5d1586,_0x45e87a[_0xa2b3('0x14')],'id');for(var _0xc92aef=0x0,_0x49c3c9={};_0xc92aef<_0x5d1586[_0xa2b3('0x3a')];_0xc92aef+=0x1){_0x49c3c9=_0x5d1586[_0xc92aef];if(_[_0xa2b3('0x3b')](_0x45e87a[_0xa2b3('0x14')][_0x49c3c9['id']])){_0x45e87a[_0xa2b3('0x14')][_0x49c3c9['id']]=new VoiceExtension(_0x49c3c9);}else{_0x45e87a[_0xa2b3('0x3d')](_0x45e87a[_0xa2b3('0x14')][_0x49c3c9['id']],_0x49c3c9);}}}return _0x45e87a[_0xa2b3('0x14')];};};Realtime['prototype'][_0xa2b3('0x65')]=function(){var _0x244526=this;return function(_0x585c7a){clearCampaigns(_0x244526[_0xa2b3('0x12')]);for(var _0x5eac8e=0x0;_0x5eac8e<_0x585c7a[_0xa2b3('0x3a')];_0x5eac8e+=0x1){_[_0xa2b3('0x4f')](_0x244526[_0xa2b3('0x12')][_0x585c7a[_0x5eac8e]['name']],_0x585c7a[_0x5eac8e]);}return _0x244526[_0xa2b3('0x12')];};};Realtime[_0xa2b3('0x38')]['initFaxAccounts']=function(){var _0x4b79d3=this;return function(_0x4ad08b){if(_0x4ad08b){freeIsNotKey(_0x4ad08b,_0x4b79d3[_0xa2b3('0x1e')],'id');for(var _0x1ac079=0x0,_0x5aef2d={},_0x59ef7b={};_0x1ac079<_0x4ad08b[_0xa2b3('0x3a')];_0x1ac079+=0x1){_0x5aef2d=_0x4ad08b[_0x1ac079];if(_[_0xa2b3('0x3b')](_0x4b79d3[_0xa2b3('0x1e')][_0x5aef2d['id']])){_0x4b79d3[_0xa2b3('0x1e')][_0x5aef2d['id']]=new FaxAccount(_0x5aef2d);}else{_0x4b79d3[_0xa2b3('0x3d')](_0x4b79d3[_0xa2b3('0x1e')][_0x5aef2d['id']],_0x5aef2d);}}}return _0x4b79d3['faxAccounts'];};};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 6fb8f97..73fe2d6 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 _0x27de=['phone','lastIndexOf','transfererlinkedid','exports','moment','../ami','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','type','lastapplication','lastdata','context','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','ANSWERED','calleridname','transfers','uniqueid','linkedid','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile'];(function(_0x120165,_0x5f0370){var _0x432703=function(_0x535c19){while(--_0x535c19){_0x120165['push'](_0x120165['shift']());}};_0x432703(++_0x5f0370);}(_0x27de,0x148));var _0xe27d=function(_0xaaa123,_0x4c23e3){_0xaaa123=_0xaaa123-0x0;var _0x44d6d7=_0x27de[_0xaaa123];return _0x44d6d7;};'use strict';var _=require('lodash');var moment=require(_0xe27d('0x0'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0xe27d('0x1'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xe27d('0x2'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xe27d('0x3'));var RpcVoiceQueueReport=require(_0xe27d('0x4'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xe27d('0x5'));var VoiceCallReport=require(_0xe27d('0x6'));var VoiceAgentReport=require(_0xe27d('0x7'));var VoiceDialReport=require(_0xe27d('0x8'));var UserReport=require(_0xe27d('0x9'));function Report(_0x5ccac7){this[_0xe27d('0xa')]=_0x5ccac7;this[_0xe27d('0xb')]=_0x5ccac7[_0xe27d('0xb')];this[_0xe27d('0xc')]=_0x5ccac7[_0xe27d('0xc')];}Report[_0xe27d('0xd')][_0xe27d('0xe')]=function(_0x584b43){var _0x232fa2=new VoiceQueueReport(this[_0xe27d('0xa')]);var _0xb743ba=new VoiceAgentReport(this['realtime']);var _0x40945e=new VoiceDialReport(this[_0xe27d('0xa')]);var _0x3cf296=new VoiceCallReport(this[_0xe27d('0xa')]);var _0xbc51a0=new UserReport(this['realtime']);if(config[_0xe27d('0xf')]&&config[_0xe27d('0xf')][_0xe27d('0x10')]){ami['on'](_0xe27d('0x11'),this[_0xe27d('0x12')][_0xe27d('0x13')](this));ami['on'](_0xe27d('0x14'),this[_0xe27d('0x15')][_0xe27d('0x13')](this));ami['on']('custom:voiceAgentReport',this[_0xe27d('0x16')][_0xe27d('0x13')](this));ami['on'](_0xe27d('0x17'),this[_0xe27d('0x18')][_0xe27d('0x13')](this));ami['on'](_0xe27d('0x19'),this[_0xe27d('0x1a')][_0xe27d('0x13')](this));ami['on'](_0xe27d('0x1b'),this[_0xe27d('0x1c')][_0xe27d('0x13')](this));}};Report[_0xe27d('0xd')][_0xe27d('0x1d')]=function(_0x25c6d0){var _0x2a4ac8;_0x2a4ac8=_[_0xe27d('0x1e')](this[_0xe27d('0xb')],function(_0x393058){return _0x393058[_0xe27d('0x1f')]==_0x25c6d0||_0x393058[_0xe27d('0x20')]==_0x25c6d0;});if(_[_0xe27d('0x21')](_0x2a4ac8)){var _0x117d7b=_['find'](this[_0xe27d('0xc')],function(_0xe5999e){return _0xe5999e['accountcode']==_0x25c6d0||_0xe5999e[_0xe27d('0x20')]==_0x25c6d0;});if(_0x117d7b){_0x2a4ac8=_[_0xe27d('0x1e')](this[_0xe27d('0xb')],function(_0x2c421d){return _0x2c421d[_0xe27d('0x22')]==util[_0xe27d('0x23')](_0xe27d('0x24'),_0x117d7b[_0xe27d('0x20')]);});}}return _0x2a4ac8;};Report['prototype'][_0xe27d('0x12')]=function(_0x1fff8b){for(var _0x1c84af=0x0;_0x1c84af<_0x1fff8b[_0xe27d('0x25')];_0x1c84af+=0x1){var _0x57a726=this[_0xe27d('0x1d')](_0x1fff8b[_0x1c84af][_0xe27d('0x26')]);if(_0x57a726){_0x1fff8b[_0x1c84af]['accountcode']=_0x57a726[_0xe27d('0x1f')];_0x1fff8b[_0x1c84af]['assigned']=!![];_0x1fff8b[_0x1c84af]['lastAssignedTo']=_0x57a726[_0xe27d('0x20')];_0x1fff8b[_0x1c84af][_0xe27d('0x22')]=_[_0xe27d('0x21')](_0x57a726[_0xe27d('0x22')])?util['format'](_0xe27d('0x24'),_0x57a726['name']):_0x57a726['interface'];if(_0x1fff8b[_0x1c84af][_0xe27d('0x27')]){_0x1fff8b[_0x1c84af][_0xe27d('0x28')]=moment()[_0xe27d('0x23')](_0xe27d('0x29'));}if(_0x1fff8b[_0x1c84af]['queuecallerexit']){_0x1fff8b[_0x1c84af][_0xe27d('0x2a')]=moment()[_0xe27d('0x23')](_0xe27d('0x29'));}RpcMemberReport[_0xe27d('0x12')](_0x1fff8b[_0x1c84af]);}RpcVoiceQueueReport[_0xe27d('0x2b')](_0x1fff8b[_0x1c84af]);}};function extractCalleridNumber(_0x4d3f63){var _0x5237ba=_0x4d3f63[_0xe27d('0x2c')](/<(.*?)>/);return _0x5237ba?_0x5237ba[0x1]:_0x4d3f63;}Report[_0xe27d('0xd')][_0xe27d('0x15')]=function(_0x1746ad){_0x1746ad[_0xe27d('0x2d')]=_0x1746ad[_0xe27d('0x2d')]||_0x1746ad[_0xe27d('0x2e')];if(_0x1746ad[_0xe27d('0x2f')]=='dialer'){_0x1746ad[_0xe27d('0x30')]='queue';_0x1746ad[_0xe27d('0x31')]=_0x1746ad['queue'];if(_0x1746ad[_0xe27d('0x32')]=='from-voip-provider'){_0x1746ad[_0xe27d('0x1f')]='';_0x1746ad['destination']=extractCalleridNumber(_0x1746ad['callerid']);}else if(_0x1746ad[_0xe27d('0x32')]=='from-sip'){if(_0x1746ad[_0xe27d('0x2d')]==_0xe27d('0x33')){_0x1746ad[_0xe27d('0x2d')]=extractCalleridNumber(_0x1746ad[_0xe27d('0x34')]);_0x1746ad[_0xe27d('0x35')]=_0x1746ad[_0xe27d('0x36')];_0x1746ad['destinationchannel']=[_0x1746ad['channel'],_0x1746ad[_0xe27d('0x37')]=_0x1746ad[_0xe27d('0x38')]][0x0];_0x1746ad['callerid']=_0x1746ad[_0xe27d('0x34')];}else{_0x1746ad[_0xe27d('0x2d')]=_0x1746ad[_0xe27d('0x35')];_0x1746ad[_0xe27d('0x35')]=_0x1746ad[_0xe27d('0x36')];if(_0x1746ad['disposition']==_0xe27d('0x39')){_0x1746ad['accountcode']=_0x1746ad[_0xe27d('0x26')];}else{_0x1746ad['accountcode']='';}}}}else{_0x1746ad['callerid']=util[_0xe27d('0x23')]('\x22%s\x22\x20<%s>',_0x1746ad[_0xe27d('0x3a')],_0x1746ad[_0xe27d('0x35')]);}if(RpcVoiceTransferReport[_0xe27d('0x3b')][_0x1746ad['linkedid']]){var _0x11b072=RpcVoiceTransferReport[_0xe27d('0x3b')][_0x1746ad['linkedid']];_0x11b072['transfereelinkedid']=_0x1746ad[_0xe27d('0x3c')];RpcVoiceTransferReport[_0xe27d('0x1a')](_0x11b072);delete RpcVoiceTransferReport[_0xe27d('0x3b')][_0x1746ad[_0xe27d('0x3d')]];}RpcVoiceCallReport[_0xe27d('0x2b')](_0x1746ad);if(_0x1746ad[_0xe27d('0x3e')]){for(var _0x5c38f4=0x0;_0x5c38f4<_0x1746ad[_0xe27d('0x3f')]['length'];_0x5c38f4+=0x1){_0x1746ad[_0xe27d('0x40')]=_0x1746ad['monitors'][_0x5c38f4][_0xe27d('0x41')];_0x1746ad['createdAt']=_0x1746ad['monitors'][_0x5c38f4][_0xe27d('0x42')];if(_0x1746ad[_0xe27d('0x2e')]==_0xe27d('0x33')){_0x1746ad['calleridnum']=_0x1746ad['connectedlinenum'];_0x1746ad['calleridname']=_0x1746ad[_0xe27d('0x43')];_0x1746ad[_0xe27d('0x26')]=_0x1746ad[_0xe27d('0x1f')];_0x1746ad[_0xe27d('0x43')]=_0x1746ad[_0xe27d('0x44')];_0x1746ad[_0xe27d('0x2e')]=_0x1746ad[_0xe27d('0x36')];}else if(_0x1746ad[_0xe27d('0x2e')]==_0xe27d('0x45')){_0x1746ad[_0xe27d('0x35')]=_0x1746ad[_0xe27d('0x2d')];_0x1746ad['exten']=_0x1746ad[_0xe27d('0x36')];}RpcVoiceRecording[_0xe27d('0x2b')](_0x1746ad);}}};Report['prototype'][_0xe27d('0x16')]=function(_0x31033f){if(_[_0xe27d('0x46')](_0x31033f)){_0x31033f[_0xe27d('0x47')](function(_0x262b93){RpcVoiceAgentReport[_0xe27d('0x2b')](_0x262b93);});}else{RpcVoiceAgentReport[_0xe27d('0x2b')](_0x31033f);}};Report[_0xe27d('0xd')][_0xe27d('0x18')]=function(_0xf99587){RpcVoiceDialReport[_0xe27d('0x2b')](_0xf99587);var _0x1d93b4;var _0x1faa7c;var _0x3bd9b5=_0xf99587[_0xe27d('0x37')];if(_[_0xe27d('0x48')](_0x3bd9b5,_0xe27d('0x49'))){_0x1faa7c=_0x3bd9b5[_0xe27d('0x4a')](_0x3bd9b5[_0xe27d('0x4b')]('/')+0x1,_0x3bd9b5['indexOf']('@'));_0x1d93b4=_['find'](this[_0xe27d('0xb')],function(_0x1dbebd){return _0x1dbebd[_0xe27d('0x4c')]==_0x1faa7c||_0x1dbebd[_0xe27d('0x4d')]==_0x1faa7c||_0x1dbebd['accountcode']==_0x1faa7c;});}else{_0x1faa7c=_0x3bd9b5['substring'](_0x3bd9b5[_0xe27d('0x4b')]('/')+0x1,_0x3bd9b5[_0xe27d('0x4e')]('-'));_0x1d93b4=this[_0xe27d('0x1d')](_0x1faa7c);}if(_0x1d93b4){_0xf99587[_0xe27d('0x22')]=_[_0xe27d('0x21')](_0x1d93b4[_0xe27d('0x22')])?util[_0xe27d('0x23')](_0xe27d('0x24'),_0x1d93b4[_0xe27d('0x20')]):_0x1d93b4[_0xe27d('0x22')];_0xf99587[_0xe27d('0x44')]=_0x1d93b4[_0xe27d('0x20')];_0xf99587['accountcode']=_0x1d93b4['accountcode'];RpcMemberReport[_0xe27d('0x18')](_0xf99587);}};Report['prototype'][_0xe27d('0x1a')]=function(_0x466e1d){RpcVoiceTransferReport[_0xe27d('0x3b')][_0x466e1d[_0xe27d('0x4f')]]=_0x466e1d;};Report[_0xe27d('0xd')][_0xe27d('0x1c')]=function(_0x3b761c){RpcVoiceTransferReport[_0xe27d('0x1c')](_0x3b761c);};module[_0xe27d('0x50')]=Report; \ No newline at end of file +var _0x85a7=['type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','connectedlinenum','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','voiceDialReport','startsWith','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','format','SIP/%s','voiceQueueReport','length','findAgent','assigned','lastAssignedTo','interface','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten'];(function(_0x37023c,_0x298013){var _0x108052=function(_0x8b2037){while(--_0x8b2037){_0x37023c['push'](_0x37023c['shift']());}};_0x108052(++_0x298013);}(_0x85a7,0x11d));var _0x785a=function(_0x5af30c,_0x2c43df){_0x5af30c=_0x5af30c-0x0;var _0x39a5b4=_0x85a7[_0x5af30c];return _0x39a5b4;};'use strict';var _=require(_0x785a('0x0'));var moment=require(_0x785a('0x1'));var util=require(_0x785a('0x2'));var config=require(_0x785a('0x3'));var ami=require(_0x785a('0x4'));var RpcVoiceAgentReport=require(_0x785a('0x5'));var RpcVoiceCallReport=require(_0x785a('0x6'));var RpcVoiceDialReport=require(_0x785a('0x7'));var RpcMemberReport=require(_0x785a('0x8'));var RpcVoiceQueueReport=require(_0x785a('0x9'));var RpcVoiceRecording=require(_0x785a('0xa'));var RpcVoiceTransferReport=require(_0x785a('0xb'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x785a('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x785a('0xd'));function Report(_0x4e928a){this[_0x785a('0xe')]=_0x4e928a;this['agents']=_0x4e928a[_0x785a('0xf')];this[_0x785a('0x10')]=_0x4e928a['telephones'];}Report[_0x785a('0x11')][_0x785a('0x12')]=function(_0x5dcbbe){var _0x4136d9=new VoiceQueueReport(this[_0x785a('0xe')]);var _0x36da17=new VoiceAgentReport(this['realtime']);var _0x5e6af0=new VoiceDialReport(this[_0x785a('0xe')]);var _0x1c81cf=new VoiceCallReport(this[_0x785a('0xe')]);var _0x7acda5=new UserReport(this[_0x785a('0xe')]);if(config[_0x785a('0x13')]&&config[_0x785a('0x13')][_0x785a('0x14')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x785a('0x15')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport']['bind'](this));ami['on'](_0x785a('0x16'),this[_0x785a('0x17')][_0x785a('0x15')](this));ami['on'](_0x785a('0x18'),this['voiceDialReport'][_0x785a('0x15')](this));ami['on'](_0x785a('0x19'),this[_0x785a('0x1a')][_0x785a('0x15')](this));ami['on'](_0x785a('0x1b'),this[_0x785a('0x1c')]['bind'](this));}};Report[_0x785a('0x11')]['findAgent']=function(_0x4aadc2){var _0x4e10d6;_0x4e10d6=_[_0x785a('0x1d')](this['agents'],function(_0x73e737){return _0x73e737[_0x785a('0x1e')]==_0x4aadc2||_0x73e737[_0x785a('0x1f')]==_0x4aadc2;});if(_[_0x785a('0x20')](_0x4e10d6)){var _0x1451e5=_[_0x785a('0x1d')](this['telephones'],function(_0x43677f){return _0x43677f[_0x785a('0x1e')]==_0x4aadc2||_0x43677f[_0x785a('0x1f')]==_0x4aadc2;});if(_0x1451e5){_0x4e10d6=_[_0x785a('0x1d')](this[_0x785a('0xf')],function(_0x5a490b){return _0x5a490b['interface']==util[_0x785a('0x21')](_0x785a('0x22'),_0x1451e5[_0x785a('0x1f')]);});}}return _0x4e10d6;};Report[_0x785a('0x11')][_0x785a('0x23')]=function(_0x5c77a5){for(var _0x1bb9a3=0x0;_0x1bb9a3<_0x5c77a5[_0x785a('0x24')];_0x1bb9a3+=0x1){var _0x1f7bbe=this[_0x785a('0x25')](_0x5c77a5[_0x1bb9a3]['connectedlinenum']);if(_0x1f7bbe){_0x5c77a5[_0x1bb9a3][_0x785a('0x1e')]=_0x1f7bbe[_0x785a('0x1e')];_0x5c77a5[_0x1bb9a3][_0x785a('0x26')]=!![];_0x5c77a5[_0x1bb9a3][_0x785a('0x27')]=_0x1f7bbe[_0x785a('0x1f')];_0x5c77a5[_0x1bb9a3]['interface']=_[_0x785a('0x20')](_0x1f7bbe[_0x785a('0x28')])?util[_0x785a('0x21')](_0x785a('0x22'),_0x1f7bbe[_0x785a('0x1f')]):_0x1f7bbe['interface'];if(_0x5c77a5[_0x1bb9a3]['queuecallercomplete']){_0x5c77a5[_0x1bb9a3]['queuecallercompleteAt']=moment()['format'](_0x785a('0x29'));}if(_0x5c77a5[_0x1bb9a3]['queuecallerexit']){_0x5c77a5[_0x1bb9a3][_0x785a('0x2a')]=moment()[_0x785a('0x21')](_0x785a('0x29'));}RpcMemberReport[_0x785a('0x23')](_0x5c77a5[_0x1bb9a3]);}RpcVoiceQueueReport[_0x785a('0x2b')](_0x5c77a5[_0x1bb9a3]);}};function extractCalleridNumber(_0x52999c){var _0x3e1ceb=_0x52999c[_0x785a('0x2c')](/<(.*?)>/);return _0x3e1ceb?_0x3e1ceb[0x1]:_0x52999c;}Report['prototype']['voiceCallReport']=function(_0x266c9f){_0x266c9f[_0x785a('0x2d')]=_0x266c9f['destination']||_0x266c9f[_0x785a('0x2e')];if(_0x266c9f[_0x785a('0x2f')]==_0x785a('0x30')){_0x266c9f[_0x785a('0x31')]=_0x785a('0x32');_0x266c9f[_0x785a('0x33')]=_0x266c9f[_0x785a('0x32')];if(_0x266c9f['context']==_0x785a('0x34')){_0x266c9f[_0x785a('0x1e')]='';_0x266c9f['destination']=extractCalleridNumber(_0x266c9f[_0x785a('0x35')]);}else if(_0x266c9f[_0x785a('0x36')]=='from-sip'){if(_0x266c9f['destination']==_0x785a('0x37')){_0x266c9f[_0x785a('0x2d')]=extractCalleridNumber(_0x266c9f[_0x785a('0x38')]);_0x266c9f[_0x785a('0x39')]=_0x266c9f[_0x785a('0x3a')];_0x266c9f[_0x785a('0x3b')]=[_0x266c9f[_0x785a('0x3c')],_0x266c9f[_0x785a('0x3c')]=_0x266c9f[_0x785a('0x3b')]][0x0];_0x266c9f[_0x785a('0x35')]=_0x266c9f['calleridpreview'];}else{_0x266c9f['destination']=_0x266c9f['calleridnum'];_0x266c9f[_0x785a('0x39')]=_0x266c9f[_0x785a('0x3a')];if(_0x266c9f[_0x785a('0x3d')]=='ANSWERED'){_0x266c9f['accountcode']=_0x266c9f[_0x785a('0x3e')];}else{_0x266c9f[_0x785a('0x1e')]='';}}}}else{_0x266c9f[_0x785a('0x35')]=util[_0x785a('0x21')]('\x22%s\x22\x20<%s>',_0x266c9f['calleridname'],_0x266c9f[_0x785a('0x39')]);}if(RpcVoiceTransferReport[_0x785a('0x3f')][_0x266c9f[_0x785a('0x40')]]){var _0x502a0a=RpcVoiceTransferReport[_0x785a('0x3f')][_0x266c9f[_0x785a('0x40')]];_0x502a0a[_0x785a('0x41')]=_0x266c9f[_0x785a('0x42')];RpcVoiceTransferReport[_0x785a('0x1a')](_0x502a0a);delete RpcVoiceTransferReport['transfers'][_0x266c9f[_0x785a('0x40')]];}RpcVoiceCallReport[_0x785a('0x2b')](_0x266c9f);if(_0x266c9f[_0x785a('0x43')]){for(var _0x5ebcb8=0x0;_0x5ebcb8<_0x266c9f[_0x785a('0x44')][_0x785a('0x24')];_0x5ebcb8+=0x1){_0x266c9f['monitorFilename']=_0x266c9f[_0x785a('0x44')][_0x5ebcb8][_0x785a('0x45')];_0x266c9f[_0x785a('0x46')]=_0x266c9f[_0x785a('0x44')][_0x5ebcb8][_0x785a('0x46')];if(_0x266c9f[_0x785a('0x2e')]==_0x785a('0x37')){_0x266c9f[_0x785a('0x39')]=_0x266c9f['connectedlinenum'];_0x266c9f['calleridname']=_0x266c9f[_0x785a('0x47')];_0x266c9f['connectedlinenum']=_0x266c9f[_0x785a('0x1e')];_0x266c9f[_0x785a('0x47')]=_0x266c9f[_0x785a('0x48')];_0x266c9f[_0x785a('0x2e')]=_0x266c9f[_0x785a('0x3a')];}else if(_0x266c9f[_0x785a('0x2e')]==_0x785a('0x49')){_0x266c9f['calleridnum']=_0x266c9f[_0x785a('0x2d')];_0x266c9f[_0x785a('0x2e')]=_0x266c9f[_0x785a('0x3a')];}RpcVoiceRecording[_0x785a('0x2b')](_0x266c9f);}}};Report[_0x785a('0x11')][_0x785a('0x17')]=function(_0x1463a9){if(_[_0x785a('0x4a')](_0x1463a9)){_0x1463a9['forEach'](function(_0x418cab){RpcVoiceAgentReport[_0x785a('0x2b')](_0x418cab);});}else{RpcVoiceAgentReport[_0x785a('0x2b')](_0x1463a9);}};Report[_0x785a('0x11')][_0x785a('0x4b')]=function(_0x23ce04){RpcVoiceDialReport[_0x785a('0x2b')](_0x23ce04);var _0x5850fb;var _0x350fdf;var _0xbb1589=_0x23ce04['channel'];if(_[_0x785a('0x4c')](_0xbb1589,'Local')){_0x350fdf=_0xbb1589['substring'](_0xbb1589[_0x785a('0x4d')]('/')+0x1,_0xbb1589[_0x785a('0x4d')]('@'));_0x5850fb=_['find'](this[_0x785a('0xf')],function(_0x200faa){return _0x200faa[_0x785a('0x4e')]==_0x350fdf||_0x200faa[_0x785a('0x4f')]==_0x350fdf||_0x200faa[_0x785a('0x1e')]==_0x350fdf;});}else{_0x350fdf=_0xbb1589[_0x785a('0x50')](_0xbb1589[_0x785a('0x4d')]('/')+0x1,_0xbb1589[_0x785a('0x51')]('-'));_0x5850fb=this['findAgent'](_0x350fdf);}if(_0x5850fb){_0x23ce04[_0x785a('0x28')]=_[_0x785a('0x20')](_0x5850fb[_0x785a('0x28')])?util[_0x785a('0x21')](_0x785a('0x22'),_0x5850fb[_0x785a('0x1f')]):_0x5850fb[_0x785a('0x28')];_0x23ce04[_0x785a('0x48')]=_0x5850fb[_0x785a('0x1f')];_0x23ce04[_0x785a('0x1e')]=_0x5850fb['accountcode'];RpcMemberReport[_0x785a('0x4b')](_0x23ce04);}};Report[_0x785a('0x11')][_0x785a('0x1a')]=function(_0xc81687){RpcVoiceTransferReport['transfers'][_0xc81687[_0x785a('0x52')]]=_0xc81687;};Report[_0x785a('0x11')][_0x785a('0x1c')]=function(_0x5bf3c5){RpcVoiceTransferReport[_0x785a('0x1c')](_0x5bf3c5);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index f31cf40..85fc96c 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe43c=['telephones','syncRegistry','bind','syncDeviceState','syncPeerStatus','resolve','then','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','updateStatusRealtime','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','indexOf','mobile','accountcode','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','lodash','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents'];(function(_0x2fc987,_0xbd46bf){var _0x488b88=function(_0x49eced){while(--_0x49eced){_0x2fc987['push'](_0x2fc987['shift']());}};_0x488b88(++_0xbd46bf);}(_0xe43c,0x15f));var _0xce43=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe43c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xce43('0x0'));var moment=require(_0xce43('0x1'));var util=require(_0xce43('0x2'));var Redis=require('ioredis');var BPromise=require(_0xce43('0x3'));var config=require(_0xce43('0x4'));var logger=require(_0xce43('0x5'))(_0xce43('0x6'));var ami=require(_0xce43('0x7'));config[_0xce43('0x8')]=_[_0xce43('0x9')](config['redis'],{'host':_0xce43('0xa'),'port':0x18eb});var io=require(_0xce43('0xb'))(new Redis(config[_0xce43('0x8')]));function UserReport(_0x2256fd){this[_0xce43('0xc')]=_0x2256fd[_0xce43('0xc')];this[_0xce43('0xd')]=_0x2256fd[_0xce43('0xd')];this[_0xce43('0xe')]=_0x2256fd['telephones'];ami['on']('registryentry',this['syncRegistry']['bind'](this));ami['on']('registry',this[_0xce43('0xf')][_0xce43('0x10')](this));ami['on']('devicestatechange',this[_0xce43('0x11')][_0xce43('0x10')](this));ami['on']('peerstatus',this[_0xce43('0x12')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xce43('0x13')]()[_0xce43('0x14')](ami['actionSipShowRegistry']())[_0xce43('0x15')](function(_0x262116){logger[_0xce43('0x16')](_0xce43('0x17'),util['inspect'](_0x262116,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xce43('0x13')]()[_0xce43('0x14')](ami[_0xce43('0x18')]())[_0xce43('0x15')](function(_0x3f63bf){logger[_0xce43('0x16')](_0xce43('0x19'),util[_0xce43('0x1a')](_0x3f63bf,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xce43('0x13')]()[_0xce43('0x14')](ami[_0xce43('0x1b')]())[_0xce43('0x15')](function(_0x51d227){logger[_0xce43('0x16')](_0xce43('0x1c'),util['inspect'](_0x51d227,{'showHidden':![],'depth':null}));});}UserReport[_0xce43('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xce43('0x13')]()[_0xce43('0x14')](showSipRegistrations())[_0xce43('0x14')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xce43('0x1d')]['isNotNull']=function(_0x28c17b){return _0x28c17b!==null&&!_[_0xce43('0x1e')](_0x28c17b);};UserReport['prototype'][_0xce43('0x1f')]=function(_0x322ea9,_0x267649,_0x5c971e){io['to'](_0x322ea9)[_0xce43('0x1f')](_0x267649,_0x5c971e);};UserReport[_0xce43('0x1d')][_0xce43('0xf')]=function(_0x5b7b2a){try{if(this[_0xce43('0x20')](_0x5b7b2a)){logger[_0xce43('0x21')](_0xce43('0x22'),_0x5b7b2a[_0xce43('0x23')],_0x5b7b2a[_0xce43('0x24')]);logger[_0xce43('0x25')](_0xce43('0x26'),util[_0xce43('0x1a')](_0x5b7b2a,{'showHidden':![],'depth':null}));var _0x4cae46=_[_0xce43('0x27')](this[_0xce43('0xc')],{'defaultuser':_0x5b7b2a[_0xce43('0x23')]});if(_0x4cae46){_0x5b7b2a['stateRegistry']=_0x5b7b2a[_0xce43('0x24')];_[_0xce43('0x28')](_0x4cae46,_[_0xce43('0x29')](_0x5b7b2a,[_0xce43('0x2a'),_0xce43('0x2b'),_0xce43('0x23'),'state']));logger[_0xce43('0x25')](_0xce43('0x2c'),util[_0xce43('0x1a')](_0x4cae46,{'showHidden':![],'depth':null}));this[_0xce43('0x1f')](util[_0xce43('0x2d')](_0xce43('0x2e'),_0x4cae46[_0xce43('0x2f')]),_0xce43('0x30'),_0x4cae46);}}}catch(_0x36ecd4){logger[_0xce43('0x16')]('[userReport][registry]',util[_0xce43('0x1a')](_0x36ecd4,{'showHidden':![],'depth':null}));}};UserReport[_0xce43('0x1d')]['syncDeviceState']=function(_0x5bedf8){try{if(this[_0xce43('0x20')](_0x5bedf8)){logger[_0xce43('0x21')](_0xce43('0x31'),_0x5bedf8[_0xce43('0x32')],_0x5bedf8[_0xce43('0x24')]);logger[_0xce43('0x25')](_0xce43('0x33'),util['inspect'](_0x5bedf8,{'showHidden':![],'depth':null}));if(this[_0xce43('0xd')][_0x5bedf8['device']]){if(!this[_0xce43('0xd')][_0x5bedf8[_0xce43('0x32')]][_0xce43('0x34')]||_0x5bedf8[_0xce43('0x24')][_0xce43('0x35')]()=='inuse'){this[_0xce43('0xd')][_0x5bedf8['device']]['local']=![];if(this[_0xce43('0xd')][_0x5bedf8[_0xce43('0x32')]][_0xce43('0x24')]!==_0x5bedf8['state']['toLowerCase']()){this[_0xce43('0xd')][_0x5bedf8[_0xce43('0x32')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0xce43('0xd')][_0x5bedf8[_0xce43('0x32')]][_0xce43('0x24')]=_0x5bedf8['state'][_0xce43('0x35')]();this[_0xce43('0xd')][_0x5bedf8[_0xce43('0x32')]][_0xce43('0x36')](_0x5bedf8);}}else if(this[_0xce43('0xe')][_0x5bedf8[_0xce43('0x32')]]){if(this['telephones'][_0x5bedf8[_0xce43('0x32')]][_0xce43('0x24')]!==_0x5bedf8[_0xce43('0x24')]['toLowerCase']()){this['telephones'][_0x5bedf8[_0xce43('0x32')]][_0xce43('0x37')]=_[_0xce43('0x38')](moment()[_0xce43('0x2d')]('x'));}this[_0xce43('0xe')][_0x5bedf8['device']]['state']=_0x5bedf8[_0xce43('0x24')][_0xce43('0x35')]();logger[_0xce43('0x25')](_0xce43('0x39'),util[_0xce43('0x1a')](this[_0xce43('0xe')][_0x5bedf8['device']],{'showHidden':![],'depth':null}));this[_0xce43('0x1f')](util['format'](_0xce43('0x3a'),this['telephones'][_0x5bedf8['device']][_0xce43('0x2f')]),_0xce43('0x3b'),this['telephones'][_0x5bedf8[_0xce43('0x32')]]);}else if(this[_0xce43('0xc')][_0x5bedf8[_0xce43('0x32')]]){if(this['trunks'][_0x5bedf8[_0xce43('0x32')]][_0xce43('0x24')]!==_0x5bedf8[_0xce43('0x24')]['toLowerCase']()){this[_0xce43('0xc')][_0x5bedf8['device']]['stateTime']=_[_0xce43('0x38')](moment()['format']('x'));}this[_0xce43('0xc')][_0x5bedf8[_0xce43('0x32')]][_0xce43('0x24')]=_0x5bedf8[_0xce43('0x24')][_0xce43('0x35')]();logger[_0xce43('0x25')](_0xce43('0x3c'),util[_0xce43('0x1a')](this[_0xce43('0xc')][_0x5bedf8[_0xce43('0x32')]],{'showHidden':![],'depth':null}));this[_0xce43('0x1f')](util[_0xce43('0x2d')](_0xce43('0x2e'),this['trunks'][_0x5bedf8[_0xce43('0x32')]][_0xce43('0x2f')]),_0xce43('0x30'),this[_0xce43('0xc')][_0x5bedf8['device']]);}else if(_['startsWith'](_0x5bedf8['device'],'Local')){var _0x102b11=_0x5bedf8[_0xce43('0x32')];var _0x537eaa=_0x102b11['substring'](_0x102b11[_0xce43('0x3d')]('/')+0x1,_0x102b11[_0xce43('0x3d')]('@'));var _0x39e528=_['find'](this[_0xce43('0xd')],function(_0x10d3c4){return _0x10d3c4[_0xce43('0x3e')]==_0x537eaa||_0x10d3c4['phone']==_0x537eaa||_0x10d3c4[_0xce43('0x3f')]==_0x537eaa;});if(_0x39e528){if(_0x39e528[_0xce43('0x24')]!==_0x5bedf8['state']['toLowerCase']()){_0x39e528['stateTime']=_['toNumber'](moment()[_0xce43('0x2d')]('x'));}_0x39e528['state']=_0x5bedf8[_0xce43('0x24')]['toLowerCase']();_0x39e528['local']=!![];_0x39e528[_0xce43('0x36')](_0x5bedf8);}}}}catch(_0x2409c9){logger[_0xce43('0x16')](_0xce43('0x33'),util[_0xce43('0x1a')](_0x2409c9,{'showHidden':![],'depth':null}));}};UserReport[_0xce43('0x1d')]['syncPeerStatus']=function(_0x4ffe97){try{if(this['isNotNull'](_0x4ffe97)&&this['isNotNull'](_0x4ffe97[_0xce43('0x40')])){logger[_0xce43('0x21')](_0xce43('0x41'),_0x4ffe97[_0xce43('0x42')],_0x4ffe97[_0xce43('0x43')],_0x4ffe97[_0xce43('0x40')]);logger[_0xce43('0x25')](_0xce43('0x44'),util[_0xce43('0x1a')](_0x4ffe97,{'showHidden':![],'depth':null}));if(this[_0xce43('0xd')][_0x4ffe97[_0xce43('0x42')]]){if(!this['agents'][_0x4ffe97[_0xce43('0x42')]][_0xce43('0x34')]||_0x4ffe97['peerstatus'][_0xce43('0x35')]()==_0xce43('0x45')){this[_0xce43('0xd')][_0x4ffe97[_0xce43('0x42')]][_0xce43('0x34')]=![];this['agents'][_0x4ffe97['peer']][_0xce43('0x46')]=_0x4ffe97[_0xce43('0x40')]['toLowerCase']();this[_0xce43('0xd')][_0x4ffe97[_0xce43('0x42')]]['address']=_0x4ffe97[_0xce43('0x43')];this['agents'][_0x4ffe97[_0xce43('0x42')]][_0xce43('0x36')](_0x4ffe97);}}else if(this[_0xce43('0xe')][_0x4ffe97[_0xce43('0x42')]]){this[_0xce43('0xe')][_0x4ffe97[_0xce43('0x42')]]['status']=_0x4ffe97[_0xce43('0x40')][_0xce43('0x35')]();this[_0xce43('0xe')][_0x4ffe97[_0xce43('0x42')]]['address']=_0x4ffe97[_0xce43('0x43')];logger['debug'](_0xce43('0x47'),util[_0xce43('0x1a')](this[_0xce43('0xe')][_0x4ffe97['peer']],{'showHidden':![],'depth':null}));this[_0xce43('0x1f')](util[_0xce43('0x2d')](_0xce43('0x3a'),this[_0xce43('0xe')][_0x4ffe97[_0xce43('0x42')]][_0xce43('0x2f')]),_0xce43('0x3b'),this['telephones'][_0x4ffe97[_0xce43('0x42')]]);}else if(this[_0xce43('0xc')][_0x4ffe97[_0xce43('0x42')]]){this[_0xce43('0xc')][_0x4ffe97['peer']]['status']=_0x4ffe97['peerstatus']['toLowerCase']();this[_0xce43('0xc')][_0x4ffe97[_0xce43('0x42')]][_0xce43('0x43')]=_0x4ffe97[_0xce43('0x43')];logger[_0xce43('0x25')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xce43('0x1a')](this[_0xce43('0xc')][_0x4ffe97['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xce43('0x2e'),this[_0xce43('0xc')][_0x4ffe97[_0xce43('0x42')]][_0xce43('0x2f')]),_0xce43('0x30'),this['trunks'][_0x4ffe97[_0xce43('0x42')]]);}}}catch(_0x36a7cb){logger[_0xce43('0x16')]('[userReport][peerstatus]',util[_0xce43('0x1a')](_0x36a7cb,{'showHidden':![],'depth':null}));}};module[_0xce43('0x48')]=UserReport; \ No newline at end of file +var _0xda24=['peerstatus','syncRealtimeShow','resolve','then','catch','error','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','find','username','stateRegistry','merge','omit','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','agents','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','indexOf','mobile','phone','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','bluebird','ami','../ami','defaults','redis','trunks','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xda24,0x1f0));var _0x4da2=function(_0x6a7421,_0x20b4f5){_0x6a7421=_0x6a7421-0x0;var _0x33f5d1=_0xda24[_0x6a7421];return _0x33f5d1;};'use strict';var _=require(_0x4da2('0x0'));var moment=require(_0x4da2('0x1'));var util=require(_0x4da2('0x2'));var Redis=require('ioredis');var BPromise=require(_0x4da2('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4da2('0x4'));var ami=require(_0x4da2('0x5'));config['redis']=_[_0x4da2('0x6')](config[_0x4da2('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4da2('0x7')]));function UserReport(_0x90f20){this[_0x4da2('0x8')]=_0x90f20[_0x4da2('0x8')];this['agents']=_0x90f20['agents'];this[_0x4da2('0x9')]=_0x90f20[_0x4da2('0x9')];ami['on']('registryentry',this[_0x4da2('0xa')][_0x4da2('0xb')](this));ami['on'](_0x4da2('0xc'),this[_0x4da2('0xa')][_0x4da2('0xb')](this));ami['on'](_0x4da2('0xd'),this[_0x4da2('0xe')][_0x4da2('0xb')](this));ami['on'](_0x4da2('0xf'),this['syncPeerStatus'][_0x4da2('0xb')](this));return this[_0x4da2('0x10')]();}function showSipRegistrations(){Promise[_0x4da2('0x11')]()[_0x4da2('0x12')](ami['actionSipShowRegistry']())[_0x4da2('0x13')](function(_0x11e44f){logger[_0x4da2('0x14')]('[userReport][sipshowregistry]',util[_0x4da2('0x15')](_0x11e44f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x4da2('0x16')]())['catch'](function(_0xa0a213){logger[_0x4da2('0x14')](_0x4da2('0x17'),util['inspect'](_0xa0a213,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x4da2('0x11')]()[_0x4da2('0x12')](ami[_0x4da2('0x18')]())['catch'](function(_0x35c5d4){logger[_0x4da2('0x14')](_0x4da2('0x19'),util[_0x4da2('0x15')](_0x35c5d4,{'showHidden':![],'depth':null}));});}UserReport[_0x4da2('0x1a')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x4da2('0x11')]()[_0x4da2('0x12')](showSipRegistrations())[_0x4da2('0x12')](listDeviceStates())[_0x4da2('0x12')](showPeersStatus());},0x32c8);};UserReport[_0x4da2('0x1a')][_0x4da2('0x1b')]=function(_0x1a2d0b){return _0x1a2d0b!==null&&!_[_0x4da2('0x1c')](_0x1a2d0b);};UserReport[_0x4da2('0x1a')][_0x4da2('0x1d')]=function(_0xa4eed2,_0x1bf97e,_0x15ae1d){io['to'](_0xa4eed2)['emit'](_0x1bf97e,_0x15ae1d);};UserReport['prototype'][_0x4da2('0xa')]=function(_0x544f58){try{if(this[_0x4da2('0x1b')](_0x544f58)){logger[_0x4da2('0x1e')](_0x4da2('0x1f'),_0x544f58['username'],_0x544f58[_0x4da2('0x20')]);logger[_0x4da2('0x21')]('[userReport][registry]',util[_0x4da2('0x15')](_0x544f58,{'showHidden':![],'depth':null}));var _0xac8191=_[_0x4da2('0x22')](this[_0x4da2('0x8')],{'defaultuser':_0x544f58[_0x4da2('0x23')]});if(_0xac8191){_0x544f58[_0x4da2('0x24')]=_0x544f58[_0x4da2('0x20')];_[_0x4da2('0x25')](_0xac8191,_[_0x4da2('0x26')](_0x544f58,['event','actionid',_0x4da2('0x23'),_0x4da2('0x20')]));logger['debug'](_0x4da2('0x27'),util['inspect'](_0xac8191,{'showHidden':![],'depth':null}));this[_0x4da2('0x1d')](util[_0x4da2('0x28')](_0x4da2('0x29'),_0xac8191[_0x4da2('0x2a')]),'trunk:save',_0xac8191);}}}catch(_0x31659b){logger[_0x4da2('0x14')](_0x4da2('0x2b'),util[_0x4da2('0x15')](_0x31659b,{'showHidden':![],'depth':null}));}};UserReport[_0x4da2('0x1a')][_0x4da2('0xe')]=function(_0xc9dd14){try{if(this[_0x4da2('0x1b')](_0xc9dd14)){logger[_0x4da2('0x1e')](_0x4da2('0x2c'),_0xc9dd14['device'],_0xc9dd14[_0x4da2('0x20')]);logger['debug'](_0x4da2('0x2d'),util[_0x4da2('0x15')](_0xc9dd14,{'showHidden':![],'depth':null}));if(this['agents'][_0xc9dd14[_0x4da2('0x2e')]]){if(!this[_0x4da2('0x2f')][_0xc9dd14[_0x4da2('0x2e')]][_0x4da2('0x30')]||_0xc9dd14['state'][_0x4da2('0x31')]()==_0x4da2('0x32')){this['agents'][_0xc9dd14[_0x4da2('0x2e')]]['local']=![];if(this[_0x4da2('0x2f')][_0xc9dd14['device']][_0x4da2('0x20')]!==_0xc9dd14['state']['toLowerCase']()){this[_0x4da2('0x2f')][_0xc9dd14[_0x4da2('0x2e')]][_0x4da2('0x33')]=_[_0x4da2('0x34')](moment()[_0x4da2('0x28')]('x'));}this[_0x4da2('0x2f')][_0xc9dd14[_0x4da2('0x2e')]][_0x4da2('0x20')]=_0xc9dd14[_0x4da2('0x20')]['toLowerCase']();this[_0x4da2('0x2f')][_0xc9dd14[_0x4da2('0x2e')]][_0x4da2('0x35')](_0xc9dd14);}}else if(this[_0x4da2('0x9')][_0xc9dd14[_0x4da2('0x2e')]]){if(this[_0x4da2('0x9')][_0xc9dd14['device']][_0x4da2('0x20')]!==_0xc9dd14[_0x4da2('0x20')]['toLowerCase']()){this[_0x4da2('0x9')][_0xc9dd14[_0x4da2('0x2e')]][_0x4da2('0x33')]=_[_0x4da2('0x34')](moment()[_0x4da2('0x28')]('x'));}this[_0x4da2('0x9')][_0xc9dd14[_0x4da2('0x2e')]][_0x4da2('0x20')]=_0xc9dd14[_0x4da2('0x20')][_0x4da2('0x31')]();logger['debug'](_0x4da2('0x36'),util[_0x4da2('0x15')](this[_0x4da2('0x9')][_0xc9dd14[_0x4da2('0x2e')]],{'showHidden':![],'depth':null}));this[_0x4da2('0x1d')](util['format'](_0x4da2('0x37'),this[_0x4da2('0x9')][_0xc9dd14['device']][_0x4da2('0x2a')]),_0x4da2('0x38'),this['telephones'][_0xc9dd14[_0x4da2('0x2e')]]);}else if(this[_0x4da2('0x8')][_0xc9dd14[_0x4da2('0x2e')]]){if(this['trunks'][_0xc9dd14[_0x4da2('0x2e')]][_0x4da2('0x20')]!==_0xc9dd14[_0x4da2('0x20')]['toLowerCase']()){this[_0x4da2('0x8')][_0xc9dd14[_0x4da2('0x2e')]][_0x4da2('0x33')]=_[_0x4da2('0x34')](moment()[_0x4da2('0x28')]('x'));}this['trunks'][_0xc9dd14[_0x4da2('0x2e')]][_0x4da2('0x20')]=_0xc9dd14[_0x4da2('0x20')][_0x4da2('0x31')]();logger['debug'](_0x4da2('0x39'),util[_0x4da2('0x15')](this['trunks'][_0xc9dd14['device']],{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',this[_0x4da2('0x8')][_0xc9dd14['device']][_0x4da2('0x2a')]),_0x4da2('0x3a'),this['trunks'][_0xc9dd14[_0x4da2('0x2e')]]);}else if(_[_0x4da2('0x3b')](_0xc9dd14[_0x4da2('0x2e')],_0x4da2('0x3c'))){var _0x6d6374=_0xc9dd14[_0x4da2('0x2e')];var _0x2c163a=_0x6d6374['substring'](_0x6d6374[_0x4da2('0x3d')]('/')+0x1,_0x6d6374[_0x4da2('0x3d')]('@'));var _0x429a00=_[_0x4da2('0x22')](this[_0x4da2('0x2f')],function(_0x1ad40e){return _0x1ad40e[_0x4da2('0x3e')]==_0x2c163a||_0x1ad40e[_0x4da2('0x3f')]==_0x2c163a||_0x1ad40e[_0x4da2('0x40')]==_0x2c163a;});if(_0x429a00){if(_0x429a00[_0x4da2('0x20')]!==_0xc9dd14[_0x4da2('0x20')][_0x4da2('0x31')]()){_0x429a00[_0x4da2('0x33')]=_['toNumber'](moment()[_0x4da2('0x28')]('x'));}_0x429a00[_0x4da2('0x20')]=_0xc9dd14[_0x4da2('0x20')][_0x4da2('0x31')]();_0x429a00[_0x4da2('0x30')]=!![];_0x429a00['updateStatusRealtime'](_0xc9dd14);}}}}catch(_0x1650e4){logger[_0x4da2('0x14')](_0x4da2('0x2d'),util[_0x4da2('0x15')](_0x1650e4,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x4da2('0x41')]=function(_0x3a8433){try{if(this[_0x4da2('0x1b')](_0x3a8433)&&this[_0x4da2('0x1b')](_0x3a8433[_0x4da2('0xf')])){logger[_0x4da2('0x1e')](_0x4da2('0x42'),_0x3a8433[_0x4da2('0x43')],_0x3a8433[_0x4da2('0x44')],_0x3a8433[_0x4da2('0xf')]);logger[_0x4da2('0x21')](_0x4da2('0x45'),util[_0x4da2('0x15')](_0x3a8433,{'showHidden':![],'depth':null}));if(this[_0x4da2('0x2f')][_0x3a8433['peer']]){if(!this[_0x4da2('0x2f')][_0x3a8433[_0x4da2('0x43')]][_0x4da2('0x30')]||_0x3a8433[_0x4da2('0xf')][_0x4da2('0x31')]()=='registered'){this[_0x4da2('0x2f')][_0x3a8433[_0x4da2('0x43')]][_0x4da2('0x30')]=![];this[_0x4da2('0x2f')][_0x3a8433['peer']][_0x4da2('0x46')]=_0x3a8433[_0x4da2('0xf')][_0x4da2('0x31')]();this[_0x4da2('0x2f')][_0x3a8433[_0x4da2('0x43')]][_0x4da2('0x44')]=_0x3a8433[_0x4da2('0x44')];this['agents'][_0x3a8433['peer']][_0x4da2('0x35')](_0x3a8433);}}else if(this[_0x4da2('0x9')][_0x3a8433['peer']]){this[_0x4da2('0x9')][_0x3a8433[_0x4da2('0x43')]]['status']=_0x3a8433[_0x4da2('0xf')][_0x4da2('0x31')]();this[_0x4da2('0x9')][_0x3a8433[_0x4da2('0x43')]][_0x4da2('0x44')]=_0x3a8433[_0x4da2('0x44')];logger[_0x4da2('0x21')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x4da2('0x15')](this[_0x4da2('0x9')][_0x3a8433[_0x4da2('0x43')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x4da2('0x37'),this['telephones'][_0x3a8433[_0x4da2('0x43')]][_0x4da2('0x2a')]),_0x4da2('0x38'),this[_0x4da2('0x9')][_0x3a8433[_0x4da2('0x43')]]);}else if(this['trunks'][_0x3a8433[_0x4da2('0x43')]]){this[_0x4da2('0x8')][_0x3a8433['peer']][_0x4da2('0x46')]=_0x3a8433[_0x4da2('0xf')][_0x4da2('0x31')]();this[_0x4da2('0x8')][_0x3a8433['peer']][_0x4da2('0x44')]=_0x3a8433[_0x4da2('0x44')];logger[_0x4da2('0x21')](_0x4da2('0x47'),util[_0x4da2('0x15')](this[_0x4da2('0x8')][_0x3a8433[_0x4da2('0x43')]],{'showHidden':![],'depth':null}));this[_0x4da2('0x1d')](util[_0x4da2('0x28')]('trunk:%s',this[_0x4da2('0x8')][_0x3a8433[_0x4da2('0x43')]][_0x4da2('0x2a')]),_0x4da2('0x3a'),this[_0x4da2('0x8')][_0x3a8433['peer']]);}}}catch(_0x3a0e73){logger[_0x4da2('0x14')](_0x4da2('0x45'),util['inspect'](_0x3a0e73,{'showHidden':![],'depth':null}));}};module[_0x4da2('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index f3b1c48..ca8208f 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88eb=['syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','destuniqueid','debug','uniqueid','format','called','queue','mandatoryDisposition','type','inbound','merge','event','inspect','custom:agentcalled','user:%s','membername','user:called','error','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','transfer','talktime','acw','acwtime','acwTimeout','omit','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer'];(function(_0x13650b,_0x1dbd80){var _0x49783c=function(_0x373169){while(--_0x373169){_0x13650b['push'](_0x13650b['shift']());}};_0x49783c(++_0x1dbd80);}(_0x88eb,0x76));var _0xb88e=function(_0x2185ac,_0x4ec43c){_0x2185ac=_0x2185ac-0x0;var _0x2e90a0=_0x88eb[_0x2185ac];return _0x2e90a0;};'use strict';var _=require(_0xb88e('0x0'));var moment=require(_0xb88e('0x1'));var util=require(_0xb88e('0x2'));var Redis=require('ioredis');var config=require(_0xb88e('0x3'));var logger=require('../../../config/logger')(_0xb88e('0x4'));var ami=require(_0xb88e('0x5'));config[_0xb88e('0x6')]=_[_0xb88e('0x7')](config[_0xb88e('0x6')],{'host':_0xb88e('0x8'),'port':0x18eb});var io=require(_0xb88e('0x9'))(new Redis(config[_0xb88e('0x6')]));function VoiceAgentReport(_0xf77ae2){this[_0xb88e('0xa')]={};this[_0xb88e('0xb')]=_0xf77ae2[_0xb88e('0xb')];this[_0xb88e('0xc')]=_0xf77ae2['agents'];this[_0xb88e('0xd')]={};ami['on']('agentcalled',this[_0xb88e('0xe')][_0xb88e('0xf')](this));ami['on']('agentconnect',this[_0xb88e('0x10')][_0xb88e('0xf')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb88e('0x11'),this[_0xb88e('0x12')][_0xb88e('0xf')](this));ami['on'](_0xb88e('0x13'),this[_0xb88e('0x14')][_0xb88e('0xf')](this));ami['on'](_0xb88e('0x15'),this['syncVarSet'][_0xb88e('0xf')](this));ami['on']('hangup',this[_0xb88e('0x16')]['bind'](this));ami['on'](_0xb88e('0x17'),this[_0xb88e('0x18')]['bind'](this));ami['on'](_0xb88e('0x19'),this[_0xb88e('0x1a')][_0xb88e('0xf')](this));ami['on'](_0xb88e('0x1b'),this[_0xb88e('0x1c')]['bind'](this));ami['on']('blindtransfer',this[_0xb88e('0x1d')][_0xb88e('0xf')](this));}VoiceAgentReport[_0xb88e('0x1e')][_0xb88e('0x1f')]=function(_0x113f56,_0x5bcb79,_0x35a60d){io['to'](_0x113f56)[_0xb88e('0x1f')](_0x5bcb79,_0x35a60d);};VoiceAgentReport['prototype'][_0xb88e('0x20')]=function(_0x15d796){return _0x15d796!==null&&!_[_0xb88e('0x21')](_0x15d796);};VoiceAgentReport['prototype'][_0xb88e('0xe')]=function(_0x48bfa3){try{if(this[_0xb88e('0x20')](_0x48bfa3)){logger['info'](_0xb88e('0x22'),_0x48bfa3['uniqueid'],_0x48bfa3['membername'],_0x48bfa3[_0xb88e('0x23')]);logger[_0xb88e('0x24')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x48bfa3[_0xb88e('0x25')],util['inspect'](_0x48bfa3,{'showHidden':![],'depth':null}));if(_[_0xb88e('0x21')](this['channels'][_0x48bfa3['uniqueid']])){this[_0xb88e('0xa')][_0x48bfa3['uniqueid']]={};}if(_[_0xb88e('0x21')](this[_0xb88e('0xa')][_0x48bfa3['uniqueid']][_0x48bfa3[_0xb88e('0x23')]])){this[_0xb88e('0xa')][_0x48bfa3[_0xb88e('0x25')]][_0x48bfa3[_0xb88e('0x23')]]={'agentcalledAt':moment()[_0xb88e('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xb88e('0x27'),'mandatoryDisposition':this[_0xb88e('0xb')][_0x48bfa3['queue']]?this[_0xb88e('0xb')][_0x48bfa3[_0xb88e('0x28')]][_0xb88e('0x29')]||![]:![],'type':this['voiceQueues'][_0x48bfa3[_0xb88e('0x28')]]?this['voiceQueues'][_0x48bfa3['queue']][_0xb88e('0x2a')]||_0xb88e('0x2b'):_0xb88e('0x2b'),'variables':this[_0xb88e('0xd')][_0x48bfa3['uniqueid']]};}_[_0xb88e('0x2c')](this[_0xb88e('0xa')][_0x48bfa3[_0xb88e('0x25')]][_0x48bfa3[_0xb88e('0x23')]],_['omit'](_0x48bfa3,[_0xb88e('0x2d'),'privilege']));logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x48bfa3['uniqueid'],util[_0xb88e('0x2e')](this['channels'][_0x48bfa3[_0xb88e('0x25')]][_0x48bfa3[_0xb88e('0x23')]],{'showHidden':![],'depth':null}));ami[_0xb88e('0x1f')](_0xb88e('0x2f'),this[_0xb88e('0xa')][_0x48bfa3[_0xb88e('0x25')]][_0x48bfa3[_0xb88e('0x23')]]);logger[_0xb88e('0x24')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x48bfa3[_0xb88e('0x25')],util[_0xb88e('0x2e')](this[_0xb88e('0xa')][_0x48bfa3[_0xb88e('0x25')]][_0x48bfa3['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xb88e('0x1f')](util[_0xb88e('0x26')](_0xb88e('0x30'),_0x48bfa3[_0xb88e('0x31')]),_0xb88e('0x32'),this[_0xb88e('0xa')][_0x48bfa3['uniqueid']][_0x48bfa3['destuniqueid']]);}}catch(_0x9916bc){logger[_0xb88e('0x33')]('[%s][voiceAgentReport][agentcalled]',_0x48bfa3[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x9916bc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb88e('0x1e')][_0xb88e('0x10')]=function(_0x370405){try{if(this[_0xb88e('0x20')](_0x370405)){if(this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]]){logger[_0xb88e('0x24')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x370405[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x370405,{'showHidden':![],'depth':null}));for(var _0x5866c1 in this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]]){if(this['channels'][_0x370405['uniqueid']][_0xb88e('0x34')](_0x5866c1)){if(_0x370405[_0xb88e('0x23')]===_0x5866c1){logger[_0xb88e('0x35')](_0xb88e('0x36'),_0x370405[_0xb88e('0x25')],_0x370405[_0xb88e('0x31')],_0x370405[_0xb88e('0x23')]);this[_0xb88e('0xa')][_0x370405['uniqueid']][_0x5866c1][_0xb88e('0x37')]=moment()[_0xb88e('0x26')](_0xb88e('0x38'));this['channels'][_0x370405['uniqueid']][_0x5866c1][_0xb88e('0x39')]=_0x370405[_0xb88e('0x39')];this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]][_0x5866c1][_0xb88e('0x3a')]=_0x370405[_0xb88e('0x3a')];this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]][_0x5866c1]['destchannelstate']=_0x370405[_0xb88e('0x3b')];this['channels'][_0x370405[_0xb88e('0x25')]][_0x5866c1][_0xb88e('0x3c')]=_0x370405[_0xb88e('0x3c')];this['channels'][_0x370405['uniqueid']][_0x5866c1]['holdtime']=_0x370405[_0xb88e('0x3d')];this['channels'][_0x370405['uniqueid']][_0x5866c1]['lastevent']='connect';_[_0xb88e('0x2c')](this[_0xb88e('0xc')][_0x370405[_0xb88e('0x3e')]],_['pick'](_0x370405,[_0xb88e('0x28'),_0xb88e('0x3f')]));logger[_0xb88e('0x24')](_0xb88e('0x40'),_0x370405[_0xb88e('0x25')],util[_0xb88e('0x2e')](this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]][_0x370405[_0xb88e('0x23')]],{'showHidden':![],'depth':null}));ami[_0xb88e('0x1f')](_0xb88e('0x41'),this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]][_0x370405[_0xb88e('0x23')]]);logger[_0xb88e('0x24')](_0xb88e('0x42'),_0x370405[_0xb88e('0x25')],util[_0xb88e('0x2e')](this['channels'][_0x370405[_0xb88e('0x25')]][_0x370405[_0xb88e('0x23')]],{'showHidden':![],'depth':null}));this[_0xb88e('0x1f')](util[_0xb88e('0x26')](_0xb88e('0x30'),_0x370405[_0xb88e('0x31')]),_0xb88e('0x43'),this[_0xb88e('0xa')][_0x370405['uniqueid']][_0x370405[_0xb88e('0x23')]]);}else if(!this['channels'][_0x370405[_0xb88e('0x25')]][_0x5866c1]['agentringnoanswer']&&!this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]][_0x5866c1][_0xb88e('0x13')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x370405[_0xb88e('0x25')],this['channels'][_0x370405[_0xb88e('0x25')]][_0x5866c1][_0xb88e('0x31')],_0x5866c1);this[_0xb88e('0xa')][_0x370405['uniqueid']][_0x5866c1][_0xb88e('0x44')]=!![];this['channels'][_0x370405[_0xb88e('0x25')]][_0x5866c1][_0xb88e('0x45')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]][_0x5866c1][_0xb88e('0x46')]=_0x370405['destuniqueid'];this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]][_0x5866c1]['answeredelsewheremembername']=_0x370405[_0xb88e('0x31')];this['channels'][_0x370405['uniqueid']][_0x5866c1][_0xb88e('0x47')]=_0xb88e('0x48');this[_0xb88e('0xa')][_0x370405[_0xb88e('0x25')]][_0x5866c1]['reason']='answered_elsewhere';logger[_0xb88e('0x24')](_0xb88e('0x49'),_0x370405[_0xb88e('0x25')],util['inspect'](this['channels'][_0x370405['uniqueid']][_0x5866c1],{'showHidden':![],'depth':null}));ami[_0xb88e('0x1f')](_0xb88e('0x4a'),this[_0xb88e('0xa')][_0x370405['uniqueid']][_0x5866c1]);}}}}}}catch(_0x15786b){logger[_0xb88e('0x33')](_0xb88e('0x4b'),_0x370405[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x15786b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb88e('0x1e')][_0xb88e('0x4c')]=function(_0x5cb147){try{if(this[_0xb88e('0x20')](_0x5cb147)){logger[_0xb88e('0x24')](_0xb88e('0x4d'),_0x5cb147[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x5cb147,{'showHidden':![],'depth':null}));if(this[_0xb88e('0xa')][_0x5cb147[_0xb88e('0x25')]]&&this[_0xb88e('0xa')][_0x5cb147[_0xb88e('0x25')]][_0x5cb147[_0xb88e('0x23')]]){logger[_0xb88e('0x35')](_0xb88e('0x4e'),_0x5cb147[_0xb88e('0x25')],_0x5cb147[_0xb88e('0x31')],_0x5cb147[_0xb88e('0x23')]);this[_0xb88e('0xa')][_0x5cb147[_0xb88e('0x25')]][_0x5cb147[_0xb88e('0x23')]][_0xb88e('0x44')]=!![];this[_0xb88e('0xa')][_0x5cb147[_0xb88e('0x25')]][_0x5cb147['destuniqueid']][_0xb88e('0x45')]=moment()[_0xb88e('0x26')](_0xb88e('0x38'));this['channels'][_0x5cb147[_0xb88e('0x25')]][_0x5cb147[_0xb88e('0x23')]][_0xb88e('0x47')]='rejected';this[_0xb88e('0xa')][_0x5cb147[_0xb88e('0x25')]][_0x5cb147[_0xb88e('0x23')]][_0xb88e('0x4f')]='rejected';logger[_0xb88e('0x24')](_0xb88e('0x50'),_0x5cb147[_0xb88e('0x25')],util['inspect'](this[_0xb88e('0xa')][_0x5cb147[_0xb88e('0x25')]][_0x5cb147['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xb88e('0x51'),this['channels'][_0x5cb147[_0xb88e('0x25')]][_0x5cb147[_0xb88e('0x23')]]);}}}catch(_0x4d8837){logger[_0xb88e('0x33')](_0xb88e('0x52'),_0x5cb147[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x4d8837,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x4e7096){try{if(this['isNotNull'](_0x4e7096)){logger[_0xb88e('0x24')](_0xb88e('0x53'),_0x4e7096['uniqueid'],util[_0xb88e('0x2e')](_0x4e7096,{'showHidden':![],'depth':null}));if(this[_0xb88e('0xa')][_0x4e7096['uniqueid']]){for(var _0x30c3b6 in this[_0xb88e('0xa')][_0x4e7096[_0xb88e('0x25')]]){if(this[_0xb88e('0xa')][_0x4e7096[_0xb88e('0x25')]][_0xb88e('0x34')](_0x30c3b6)&&!this[_0xb88e('0xa')][_0x4e7096[_0xb88e('0x25')]][_0x30c3b6][_0xb88e('0x44')]&&!this[_0xb88e('0xa')][_0x4e7096['uniqueid']][_0x30c3b6]['agentcomplete']){logger[_0xb88e('0x35')](_0xb88e('0x54'),_0x4e7096[_0xb88e('0x25')],this[_0xb88e('0xa')][_0x4e7096['uniqueid']][_0x30c3b6]['membername'],_0x30c3b6);this[_0xb88e('0xa')][_0x4e7096[_0xb88e('0x25')]][_0x30c3b6][_0xb88e('0x44')]=!![];this['channels'][_0x4e7096[_0xb88e('0x25')]][_0x30c3b6][_0xb88e('0x45')]=moment()['format'](_0xb88e('0x38'));this[_0xb88e('0xa')][_0x4e7096[_0xb88e('0x25')]][_0x30c3b6][_0xb88e('0x47')]='abandoned';this['channels'][_0x4e7096['uniqueid']][_0x30c3b6][_0xb88e('0x4f')]='abandoned';logger[_0xb88e('0x24')](_0xb88e('0x55'),_0x4e7096['uniqueid'],util[_0xb88e('0x2e')](this[_0xb88e('0xa')][_0x4e7096[_0xb88e('0x25')]][_0x30c3b6],{'showHidden':![],'depth':null}));ami[_0xb88e('0x1f')]('custom:agentqueuecallerabandon',this['channels'][_0x4e7096['uniqueid']][_0x30c3b6]);}}}}}catch(_0x5a2ff0){logger['error'](_0xb88e('0x56'),_0x4e7096[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x5a2ff0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb88e('0x1e')][_0xb88e('0x14')]=function(_0x4e37be){try{if(this[_0xb88e('0x20')](_0x4e37be)){logger[_0xb88e('0x24')](_0xb88e('0x57'),_0x4e37be[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x4e37be,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e37be[_0xb88e('0x25')]]){for(var _0xc43417 in this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]]){if(this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xb88e('0x34')](_0xc43417)){if(this[_0xb88e('0xa')][_0x4e37be['uniqueid']][_0xc43417][_0xb88e('0x37')]&&!this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xc43417][_0xb88e('0x13')]){logger[_0xb88e('0x35')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4e37be[_0xb88e('0x25')],this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xc43417][_0xb88e('0x31')],_0xc43417);this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xc43417][_0xb88e('0x13')]=!![];this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xc43417][_0xb88e('0x58')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xc43417][_0xb88e('0x47')]='complete';this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xc43417][_0xb88e('0x4f')]=_0x4e37be[_0xb88e('0x4f')]==_0xb88e('0x59')?'agent':_0x4e37be[_0xb88e('0x4f')];this[_0xb88e('0xa')][_0x4e37be['uniqueid']][_0xc43417][_0xb88e('0x5a')]=_0x4e37be[_0xb88e('0x5a')];if(this[_0xb88e('0xb')][_0x4e37be[_0xb88e('0x28')]]&&this[_0xb88e('0xb')][_0x4e37be['queue']][_0xb88e('0x5b')]){this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xc43417][_0xb88e('0x5c')]=this[_0xb88e('0xb')][_0x4e37be[_0xb88e('0x28')]][_0xb88e('0x5d')];this['channels'][_0x4e37be[_0xb88e('0x25')]][_0xc43417]['agentacw']=!![];}this[_0xb88e('0xc')][_0x4e37be[_0xb88e('0x3e')]]=_[_0xb88e('0x5e')](this[_0xb88e('0xc')][_0x4e37be[_0xb88e('0x3e')]],[_0xb88e('0x28'),_0xb88e('0x3f')]);logger[_0xb88e('0x24')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x4e37be['uniqueid'],util[_0xb88e('0x2e')](this[_0xb88e('0xa')][_0x4e37be['uniqueid']][_0xc43417],{'showHidden':![],'depth':null}));ami[_0xb88e('0x1f')](_0xb88e('0x5f'),this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xc43417]);logger[_0xb88e('0x24')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x4e37be[_0xb88e('0x25')],util['inspect'](this['channels'][_0x4e37be[_0xb88e('0x25')]][_0xc43417],{'showHidden':![],'depth':null}));this[_0xb88e('0x1f')](util['format']('user:%s',_0x4e37be[_0xb88e('0x31')]),'user:agentcomplete',this[_0xb88e('0xa')][_0x4e37be[_0xb88e('0x25')]][_0xc43417]);}}}}}}catch(_0x35aab1){logger[_0xb88e('0x33')](_0xb88e('0x60'),_0x4e37be[_0xb88e('0x25')],util['inspect'](_0x35aab1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb88e('0x1e')]['syncVarSet']=function(_0xe1e641){try{if(this[_0xb88e('0x20')](_0xe1e641)){logger[_0xb88e('0x24')](_0xb88e('0x61'),_0xe1e641[_0xb88e('0x25')],util['inspect'](_0xe1e641,{'showHidden':![],'depth':null}));this[_0xb88e('0x62')](_0xe1e641['uniqueid'],_[_0xb88e('0x63')](_0xe1e641['variable'])[0x0],_0xe1e641[_0xb88e('0x64')]);if(this[_0xb88e('0xa')][_0xe1e641[_0xb88e('0x25')]]){for(var _0x1669fe in this[_0xb88e('0xa')][_0xe1e641[_0xb88e('0x25')]]){if(this[_0xb88e('0xa')][_0xe1e641['uniqueid']][_0xb88e('0x34')](_0x1669fe)){logger[_0xb88e('0x35')](_0xb88e('0x65'),_0xe1e641[_0xb88e('0x25')],_0x1669fe,_[_0xb88e('0x63')](_0xe1e641[_0xb88e('0x66')])[0x0],_0xe1e641[_0xb88e('0x64')]);if(_[_0xb88e('0x21')](this[_0xb88e('0xa')][_0xe1e641[_0xb88e('0x25')]][_0x1669fe][_0xb88e('0xd')])){this[_0xb88e('0xa')][_0xe1e641['uniqueid']][_0x1669fe][_0xb88e('0xd')]={};}this[_0xb88e('0xa')][_0xe1e641[_0xb88e('0x25')]][_0x1669fe]['variables']=this[_0xb88e('0xd')][_0xe1e641['uniqueid']];}}}}}catch(_0x12dc65){logger[_0xb88e('0x33')](_0xb88e('0x67'),_0xe1e641[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x12dc65,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb88e('0x1e')][_0xb88e('0x62')]=function(_0x27dae9,_0x1435cc,_0x9eb1f4){var _0x305476=[_0xb88e('0x68'),_0xb88e('0x69'),'rtpaudioqosjitter',_0xb88e('0x6a'),_0xb88e('0x6b'),_0xb88e('0x6c'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xb88e('0x6d'),_0xb88e('0x6e'),_0xb88e('0x6f'),'bridgepvtcallid',_0xb88e('0x70'),_0xb88e('0x71'),_0xb88e('0x72'),_0xb88e('0x73'),_0xb88e('0x31'),'memberpenalty',_0xb88e('0x74')];if(!_[_0xb88e('0x75')](_0x1435cc)&&!_[_0xb88e('0x76')](_0x305476,_0x1435cc)){if(_[_0xb88e('0x21')](this['variables'][_0x27dae9])){this[_0xb88e('0xd')][_0x27dae9]={};}this[_0xb88e('0xd')][_0x27dae9][_0x1435cc]=_0x9eb1f4;}};VoiceAgentReport['prototype'][_0xb88e('0x16')]=function(_0x499d93){try{if(this[_0xb88e('0x20')](_0x499d93)){logger[_0xb88e('0x24')](_0xb88e('0x77'),_0x499d93['uniqueid'],util[_0xb88e('0x2e')](_0x499d93,{'showHidden':![],'depth':null}));if(this[_0xb88e('0xa')][_0x499d93[_0xb88e('0x25')]]){for(var _0x392041 in this['channels'][_0x499d93[_0xb88e('0x25')]]){if(this[_0xb88e('0xa')][_0x499d93[_0xb88e('0x25')]][_0xb88e('0x34')](_0x392041)){if(this[_0xb88e('0xa')][_0x499d93[_0xb88e('0x25')]][_0x392041][_0xb88e('0x4f')]==_0xb88e('0x59')&&this[_0xb88e('0xa')][_0x499d93[_0xb88e('0x25')]][_0x392041][_0xb88e('0x13')]){logger[_0xb88e('0x35')](_0xb88e('0x78'),_0x499d93['uniqueid'],_0x392041);this['channels'][_0x499d93['uniqueid']][_0x392041][_0xb88e('0x58')]=moment()[_0xb88e('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xb88e('0x24')](_0xb88e('0x79'),_0x499d93[_0xb88e('0x25')],util['inspect'](_['values'](this[_0xb88e('0xa')][_0x499d93[_0xb88e('0x25')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xb88e('0x7a'),_[_0xb88e('0x7b')](this['channels'][_0x499d93[_0xb88e('0x25')]]));delete this[_0xb88e('0xa')][_0x499d93['uniqueid']];}if(this[_0xb88e('0xd')][_0x499d93[_0xb88e('0x25')]]){delete this[_0xb88e('0xd')][_0x499d93[_0xb88e('0x25')]];}}}catch(_0x2a78b1){logger[_0xb88e('0x33')](_0xb88e('0x7c'),_0x499d93[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x2a78b1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb88e('0x1c')]=function(_0x29846f){try{if(this[_0xb88e('0x20')](_0x29846f)){logger[_0xb88e('0x24')](_0xb88e('0x7d'),_0x29846f['uniqueid'],util[_0xb88e('0x2e')](_0x29846f,{'showHidden':![],'depth':null}));if(this['channels'][_0x29846f[_0xb88e('0x7e')]]){for(var _0x43b74e in this['channels'][_0x29846f['transfereeuniqueid']]){if(this[_0xb88e('0xa')][_0x29846f['transfereeuniqueid']][_0xb88e('0x34')](_0x43b74e)){if(_0x29846f[_0xb88e('0x7f')]===_0x43b74e){logger[_0xb88e('0x35')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x29846f[_0xb88e('0x25')],this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x7e')]][_0x43b74e][_0xb88e('0x31')],_0x43b74e);var _0x94ab96=moment();this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x7e')]][_0x43b74e][_0xb88e('0x13')]=!![];this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x7e')]][_0x43b74e][_0xb88e('0x58')]=moment()[_0xb88e('0x26')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x7e')]][_0x43b74e][_0xb88e('0x47')]=_0xb88e('0x80');this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x7e')]][_0x43b74e]['reason']='transfer';this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x7e')]][_0x43b74e]['talktime']=_0x94ab96[_0xb88e('0x81')](this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x7e')]][_0x43b74e][_0xb88e('0x37')],_0xb88e('0x82'));}}}}if(this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x83')]]){var _0x2c3d47=this['channels'][_0x29846f[_0xb88e('0x83')]];this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x83')]]=this[_0xb88e('0xa')][_0x29846f[_0xb88e('0x7e')]];this['channels'][_0x29846f['transfereeuniqueid']]=_0x2c3d47;}}}catch(_0x4b54ad){logger[_0xb88e('0x33')]('[%s][voiceAgentReport][attendedtransfer]',_0x29846f[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x4b54ad,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncBlindTransfer']=function(_0x23b98c){try{if(this[_0xb88e('0x20')](_0x23b98c)){logger[_0xb88e('0x24')](_0xb88e('0x84'),_0x23b98c[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x23b98c,{'showHidden':![],'depth':null}));if(this[_0xb88e('0xa')][_0x23b98c[_0xb88e('0x7e')]]){for(var _0x26e180 in this['channels'][_0x23b98c[_0xb88e('0x7e')]]){if(this[_0xb88e('0xa')][_0x23b98c[_0xb88e('0x7e')]][_0xb88e('0x34')](_0x26e180)){if(_0x23b98c['transfereruniqueid']===_0x26e180){logger['info'](_0xb88e('0x85'),_0x23b98c[_0xb88e('0x25')],this[_0xb88e('0xa')][_0x23b98c[_0xb88e('0x7e')]][_0x26e180]['membername'],_0x26e180);var _0x10d6d4=moment();this[_0xb88e('0xa')][_0x23b98c['transfereeuniqueid']][_0x26e180][_0xb88e('0x13')]=!![];this['channels'][_0x23b98c[_0xb88e('0x7e')]][_0x26e180]['agentcompleteAt']=_0x10d6d4;this[_0xb88e('0xa')][_0x23b98c[_0xb88e('0x7e')]][_0x26e180]['lastevent']=_0xb88e('0x80');this[_0xb88e('0xa')][_0x23b98c[_0xb88e('0x7e')]][_0x26e180]['reason']=_0xb88e('0x59');this['channels'][_0x23b98c['transfereeuniqueid']][_0x26e180]['talktime']=_0x10d6d4['diff'](this['channels'][_0x23b98c[_0xb88e('0x7e')]][_0x26e180][_0xb88e('0x37')],_0xb88e('0x82'));}}}}}}catch(_0x3bd464){logger[_0xb88e('0x33')](_0xb88e('0x86'),_0x23b98c[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x3bd464,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb88e('0x18')]=function(_0x4a793b){var _0x1a934b='';try{if(this[_0xb88e('0x20')](_0x4a793b)){logger['debug'](_0xb88e('0x87'),_0x4a793b[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x4a793b,{'showHidden':![],'depth':null}));if(_0x4a793b[_0xb88e('0x88')]){_0x1a934b=_0x4a793b[_0xb88e('0x88')][_0xb88e('0x89')](0x0,_0x4a793b[_0xb88e('0x88')]['lastIndexOf']('-'));if(this[_0xb88e('0xc')][_0x1a934b]){logger[_0xb88e('0x35')](_0xb88e('0x8a'),_0x4a793b['uniqueid'],_0x1a934b);this[_0xb88e('0xc')][_0x1a934b][_0xb88e('0x8b')]=!![];}}}}catch(_0x5cb0f7){logger[_0xb88e('0x33')](_0xb88e('0x8c'),_0x4a793b[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x5cb0f7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb88e('0x1e')][_0xb88e('0x1a')]=function(_0x324eff){var _0x3de6c4='';try{if(this['isNotNull'](_0x324eff)){logger[_0xb88e('0x24')](_0xb88e('0x8d'),_0x324eff[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x324eff,{'showHidden':![],'depth':null}));if(_0x324eff[_0xb88e('0x88')]){_0x3de6c4=_0x324eff[_0xb88e('0x88')][_0xb88e('0x89')](0x0,_0x324eff[_0xb88e('0x88')][_0xb88e('0x8e')]('-'));if(this[_0xb88e('0xc')][_0x3de6c4]){logger['info'](_0xb88e('0x8f'),_0x324eff['uniqueid'],_0x3de6c4);this[_0xb88e('0xc')][_0x3de6c4][_0xb88e('0x8b')]=![];}}}}catch(_0x188432){logger[_0xb88e('0x33')](_0xb88e('0x90'),_0x324eff[_0xb88e('0x25')],util[_0xb88e('0x2e')](_0x188432,{'showHidden':![],'depth':null}));}};module[_0xb88e('0x91')]=VoiceAgentReport; \ No newline at end of file +var _0x4404=['membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','privilege','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','membername','user:called','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','lastevent','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','variable','variables','[%s][voiceAgentReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x4404,0x1ef));var _0x4440=function(_0xb6e1b4,_0x3808c8){_0xb6e1b4=_0xb6e1b4-0x0;var _0xa10683=_0x4404[_0xb6e1b4];return _0xa10683;};'use strict';var _=require(_0x4440('0x0'));var moment=require('moment');var util=require(_0x4440('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x4440('0x2'))(_0x4440('0x3'));var ami=require(_0x4440('0x4'));config[_0x4440('0x5')]=_[_0x4440('0x6')](config[_0x4440('0x5')],{'host':_0x4440('0x7'),'port':0x18eb});var io=require(_0x4440('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x3758e7){this[_0x4440('0x9')]={};this[_0x4440('0xa')]=_0x3758e7[_0x4440('0xa')];this['agents']=_0x3758e7[_0x4440('0xb')];this['variables']={};ami['on'](_0x4440('0xc'),this[_0x4440('0xd')][_0x4440('0xe')](this));ami['on'](_0x4440('0xf'),this[_0x4440('0x10')][_0x4440('0xe')](this));ami['on'](_0x4440('0x11'),this[_0x4440('0x12')][_0x4440('0xe')](this));ami['on'](_0x4440('0x13'),this[_0x4440('0x14')][_0x4440('0xe')](this));ami['on'](_0x4440('0x15'),this[_0x4440('0x16')][_0x4440('0xe')](this));ami['on']('varset',this[_0x4440('0x17')]['bind'](this));ami['on'](_0x4440('0x18'),this[_0x4440('0x19')][_0x4440('0xe')](this));ami['on'](_0x4440('0x1a'),this[_0x4440('0x1b')]['bind'](this));ami['on'](_0x4440('0x1c'),this[_0x4440('0x1d')][_0x4440('0xe')](this));ami['on'](_0x4440('0x1e'),this['syncAttendedTransfer'][_0x4440('0xe')](this));ami['on'](_0x4440('0x1f'),this[_0x4440('0x20')]['bind'](this));}VoiceAgentReport[_0x4440('0x21')][_0x4440('0x22')]=function(_0x5779c4,_0x3c6fc1,_0x4ed2b2){io['to'](_0x5779c4)[_0x4440('0x22')](_0x3c6fc1,_0x4ed2b2);};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x23')]=function(_0x448321){return _0x448321!==null&&!_['isUndefined'](_0x448321);};VoiceAgentReport[_0x4440('0x21')][_0x4440('0xd')]=function(_0x26908b){try{if(this[_0x4440('0x23')](_0x26908b)){logger[_0x4440('0x24')](_0x4440('0x25'),_0x26908b[_0x4440('0x26')],_0x26908b['membername'],_0x26908b[_0x4440('0x27')]);logger[_0x4440('0x28')](_0x4440('0x29'),_0x26908b['uniqueid'],util[_0x4440('0x2a')](_0x26908b,{'showHidden':![],'depth':null}));if(_[_0x4440('0x2b')](this[_0x4440('0x9')][_0x26908b[_0x4440('0x26')]])){this[_0x4440('0x9')][_0x26908b[_0x4440('0x26')]]={};}if(_[_0x4440('0x2b')](this[_0x4440('0x9')][_0x26908b[_0x4440('0x26')]][_0x26908b[_0x4440('0x27')]])){this[_0x4440('0x9')][_0x26908b['uniqueid']][_0x26908b[_0x4440('0x27')]]={'agentcalledAt':moment()['format'](_0x4440('0x2c')),'lastevent':_0x4440('0x2d'),'mandatoryDisposition':this[_0x4440('0xa')][_0x26908b['queue']]?this[_0x4440('0xa')][_0x26908b['queue']]['mandatoryDisposition']||![]:![],'type':this[_0x4440('0xa')][_0x26908b[_0x4440('0x2e')]]?this[_0x4440('0xa')][_0x26908b[_0x4440('0x2e')]][_0x4440('0x2f')]||'inbound':_0x4440('0x30'),'variables':this['variables'][_0x26908b[_0x4440('0x26')]]};}_[_0x4440('0x31')](this[_0x4440('0x9')][_0x26908b[_0x4440('0x26')]][_0x26908b['destuniqueid']],_[_0x4440('0x32')](_0x26908b,['event',_0x4440('0x33')]));logger[_0x4440('0x28')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x26908b[_0x4440('0x26')],util['inspect'](this[_0x4440('0x9')][_0x26908b[_0x4440('0x26')]][_0x26908b[_0x4440('0x27')]],{'showHidden':![],'depth':null}));ami[_0x4440('0x22')](_0x4440('0x34'),this[_0x4440('0x9')][_0x26908b['uniqueid']][_0x26908b[_0x4440('0x27')]]);logger[_0x4440('0x28')](_0x4440('0x35'),_0x26908b[_0x4440('0x26')],util[_0x4440('0x2a')](this['channels'][_0x26908b[_0x4440('0x26')]][_0x26908b[_0x4440('0x27')]],{'showHidden':![],'depth':null}));this[_0x4440('0x22')](util[_0x4440('0x36')](_0x4440('0x37'),_0x26908b[_0x4440('0x38')]),_0x4440('0x39'),this[_0x4440('0x9')][_0x26908b[_0x4440('0x26')]][_0x26908b[_0x4440('0x27')]]);}}catch(_0x20dc8b){logger['error']('[%s][voiceAgentReport][agentcalled]',_0x26908b[_0x4440('0x26')],util[_0x4440('0x2a')](_0x20dc8b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4440('0x21')]['syncAgentConnect']=function(_0x5deed9){try{if(this['isNotNull'](_0x5deed9)){if(this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]]){logger[_0x4440('0x28')](_0x4440('0x3a'),_0x5deed9[_0x4440('0x26')],util[_0x4440('0x2a')](_0x5deed9,{'showHidden':![],'depth':null}));for(var _0x568914 in this['channels'][_0x5deed9[_0x4440('0x26')]]){if(this['channels'][_0x5deed9[_0x4440('0x26')]][_0x4440('0x3b')](_0x568914)){if(_0x5deed9[_0x4440('0x27')]===_0x568914){logger[_0x4440('0x24')](_0x4440('0x3c'),_0x5deed9[_0x4440('0x26')],_0x5deed9['membername'],_0x5deed9[_0x4440('0x27')]);this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]][_0x568914][_0x4440('0x3d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x4440('0x9')][_0x5deed9['uniqueid']][_0x568914][_0x4440('0x3e')]=_0x5deed9[_0x4440('0x3e')];this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]][_0x568914][_0x4440('0x3f')]=_0x5deed9['connectedlinenum'];this['channels'][_0x5deed9[_0x4440('0x26')]][_0x568914][_0x4440('0x40')]=_0x5deed9[_0x4440('0x40')];this[_0x4440('0x9')][_0x5deed9['uniqueid']][_0x568914]['destchannelstatedesc']=_0x5deed9[_0x4440('0x41')];this['channels'][_0x5deed9['uniqueid']][_0x568914]['holdtime']=_0x5deed9['holdtime'];this[_0x4440('0x9')][_0x5deed9['uniqueid']][_0x568914][_0x4440('0x42')]='connect';_[_0x4440('0x31')](this[_0x4440('0xb')][_0x5deed9[_0x4440('0x43')]],_[_0x4440('0x44')](_0x5deed9,[_0x4440('0x2e'),_0x4440('0x45')]));logger[_0x4440('0x28')](_0x4440('0x46'),_0x5deed9[_0x4440('0x26')],util[_0x4440('0x2a')](this['channels'][_0x5deed9[_0x4440('0x26')]][_0x5deed9[_0x4440('0x27')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4440('0x47'),this[_0x4440('0x9')][_0x5deed9['uniqueid']][_0x5deed9[_0x4440('0x27')]]);logger[_0x4440('0x28')](_0x4440('0x48'),_0x5deed9[_0x4440('0x26')],util[_0x4440('0x2a')](this['channels'][_0x5deed9[_0x4440('0x26')]][_0x5deed9[_0x4440('0x27')]],{'showHidden':![],'depth':null}));this[_0x4440('0x22')](util[_0x4440('0x36')](_0x4440('0x37'),_0x5deed9['membername']),'user:agentconnect',this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]][_0x5deed9[_0x4440('0x27')]]);}else if(!this[_0x4440('0x9')][_0x5deed9['uniqueid']][_0x568914][_0x4440('0x11')]&&!this['channels'][_0x5deed9[_0x4440('0x26')]][_0x568914]['agentcomplete']){logger[_0x4440('0x24')](_0x4440('0x49'),_0x5deed9[_0x4440('0x26')],this['channels'][_0x5deed9[_0x4440('0x26')]][_0x568914]['membername'],_0x568914);this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]][_0x568914][_0x4440('0x11')]=!![];this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]][_0x568914][_0x4440('0x4a')]=moment()[_0x4440('0x36')](_0x4440('0x2c'));this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]][_0x568914][_0x4440('0x4b')]=_0x5deed9[_0x4440('0x27')];this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]][_0x568914][_0x4440('0x4c')]=_0x5deed9['membername'];this['channels'][_0x5deed9[_0x4440('0x26')]][_0x568914][_0x4440('0x42')]=_0x4440('0x4d');this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]][_0x568914][_0x4440('0x4e')]=_0x4440('0x4d');logger[_0x4440('0x28')](_0x4440('0x4f'),_0x5deed9[_0x4440('0x26')],util[_0x4440('0x2a')](this[_0x4440('0x9')][_0x5deed9[_0x4440('0x26')]][_0x568914],{'showHidden':![],'depth':null}));ami[_0x4440('0x22')](_0x4440('0x50'),this['channels'][_0x5deed9[_0x4440('0x26')]][_0x568914]);}}}}}}catch(_0x2bf9d7){logger[_0x4440('0x51')](_0x4440('0x52'),_0x5deed9[_0x4440('0x26')],util[_0x4440('0x2a')](_0x2bf9d7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x12')]=function(_0x306bda){try{if(this[_0x4440('0x23')](_0x306bda)){logger[_0x4440('0x28')](_0x4440('0x53'),_0x306bda[_0x4440('0x26')],util[_0x4440('0x2a')](_0x306bda,{'showHidden':![],'depth':null}));if(this[_0x4440('0x9')][_0x306bda[_0x4440('0x26')]]&&this[_0x4440('0x9')][_0x306bda[_0x4440('0x26')]][_0x306bda['destuniqueid']]){logger[_0x4440('0x24')](_0x4440('0x54'),_0x306bda['uniqueid'],_0x306bda[_0x4440('0x38')],_0x306bda[_0x4440('0x27')]);this['channels'][_0x306bda[_0x4440('0x26')]][_0x306bda[_0x4440('0x27')]][_0x4440('0x11')]=!![];this[_0x4440('0x9')][_0x306bda[_0x4440('0x26')]][_0x306bda[_0x4440('0x27')]][_0x4440('0x4a')]=moment()[_0x4440('0x36')](_0x4440('0x2c'));this[_0x4440('0x9')][_0x306bda[_0x4440('0x26')]][_0x306bda['destuniqueid']][_0x4440('0x42')]=_0x4440('0x55');this['channels'][_0x306bda[_0x4440('0x26')]][_0x306bda[_0x4440('0x27')]][_0x4440('0x4e')]=_0x4440('0x55');logger[_0x4440('0x28')](_0x4440('0x56'),_0x306bda[_0x4440('0x26')],util['inspect'](this['channels'][_0x306bda[_0x4440('0x26')]][_0x306bda[_0x4440('0x27')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this[_0x4440('0x9')][_0x306bda[_0x4440('0x26')]][_0x306bda['destuniqueid']]);}}}catch(_0x5835be){logger[_0x4440('0x51')]('[%s][voiceAgentReport][agentringnoanswer]',_0x306bda[_0x4440('0x26')],util[_0x4440('0x2a')](_0x5835be,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x14')]=function(_0x1ba60c){try{if(this[_0x4440('0x23')](_0x1ba60c)){logger[_0x4440('0x28')](_0x4440('0x57'),_0x1ba60c[_0x4440('0x26')],util[_0x4440('0x2a')](_0x1ba60c,{'showHidden':![],'depth':null}));if(this[_0x4440('0x9')][_0x1ba60c['uniqueid']]){for(var _0x43d0cd in this[_0x4440('0x9')][_0x1ba60c[_0x4440('0x26')]]){if(this[_0x4440('0x9')][_0x1ba60c[_0x4440('0x26')]][_0x4440('0x3b')](_0x43d0cd)&&!this[_0x4440('0x9')][_0x1ba60c[_0x4440('0x26')]][_0x43d0cd]['agentringnoanswer']&&!this[_0x4440('0x9')][_0x1ba60c[_0x4440('0x26')]][_0x43d0cd][_0x4440('0x15')]){logger[_0x4440('0x24')](_0x4440('0x58'),_0x1ba60c[_0x4440('0x26')],this[_0x4440('0x9')][_0x1ba60c[_0x4440('0x26')]][_0x43d0cd]['membername'],_0x43d0cd);this[_0x4440('0x9')][_0x1ba60c[_0x4440('0x26')]][_0x43d0cd]['agentringnoanswer']=!![];this[_0x4440('0x9')][_0x1ba60c[_0x4440('0x26')]][_0x43d0cd][_0x4440('0x4a')]=moment()['format'](_0x4440('0x2c'));this['channels'][_0x1ba60c[_0x4440('0x26')]][_0x43d0cd][_0x4440('0x42')]='abandoned';this[_0x4440('0x9')][_0x1ba60c['uniqueid']][_0x43d0cd][_0x4440('0x4e')]='abandoned';logger['debug'](_0x4440('0x59'),_0x1ba60c[_0x4440('0x26')],util[_0x4440('0x2a')](this['channels'][_0x1ba60c[_0x4440('0x26')]][_0x43d0cd],{'showHidden':![],'depth':null}));ami[_0x4440('0x22')](_0x4440('0x5a'),this[_0x4440('0x9')][_0x1ba60c[_0x4440('0x26')]][_0x43d0cd]);}}}}}catch(_0x505790){logger[_0x4440('0x51')]('[%s][voiceAgentReport][queuecallerabandon]',_0x1ba60c[_0x4440('0x26')],util[_0x4440('0x2a')](_0x505790,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x16')]=function(_0x329542){try{if(this[_0x4440('0x23')](_0x329542)){logger['debug'](_0x4440('0x5b'),_0x329542[_0x4440('0x26')],util[_0x4440('0x2a')](_0x329542,{'showHidden':![],'depth':null}));if(this['channels'][_0x329542[_0x4440('0x26')]]){for(var _0x406fce in this[_0x4440('0x9')][_0x329542[_0x4440('0x26')]]){if(this['channels'][_0x329542[_0x4440('0x26')]][_0x4440('0x3b')](_0x406fce)){if(this[_0x4440('0x9')][_0x329542['uniqueid']][_0x406fce][_0x4440('0x3d')]&&!this['channels'][_0x329542[_0x4440('0x26')]][_0x406fce][_0x4440('0x15')]){logger[_0x4440('0x24')](_0x4440('0x5c'),_0x329542[_0x4440('0x26')],this['channels'][_0x329542[_0x4440('0x26')]][_0x406fce]['membername'],_0x406fce);this[_0x4440('0x9')][_0x329542[_0x4440('0x26')]][_0x406fce][_0x4440('0x15')]=!![];this['channels'][_0x329542[_0x4440('0x26')]][_0x406fce][_0x4440('0x5d')]=moment()[_0x4440('0x36')](_0x4440('0x2c'));this['channels'][_0x329542[_0x4440('0x26')]][_0x406fce][_0x4440('0x42')]=_0x4440('0x5e');this[_0x4440('0x9')][_0x329542['uniqueid']][_0x406fce][_0x4440('0x4e')]=_0x329542['reason']==_0x4440('0x5f')?'agent':_0x329542['reason'];this[_0x4440('0x9')][_0x329542[_0x4440('0x26')]][_0x406fce]['talktime']=_0x329542[_0x4440('0x60')];if(this[_0x4440('0xa')][_0x329542[_0x4440('0x2e')]]&&this[_0x4440('0xa')][_0x329542[_0x4440('0x2e')]][_0x4440('0x61')]){this[_0x4440('0x9')][_0x329542[_0x4440('0x26')]][_0x406fce][_0x4440('0x62')]=this[_0x4440('0xa')][_0x329542[_0x4440('0x2e')]][_0x4440('0x63')];this['channels'][_0x329542[_0x4440('0x26')]][_0x406fce][_0x4440('0x64')]=!![];}this[_0x4440('0xb')][_0x329542[_0x4440('0x43')]]=_[_0x4440('0x32')](this['agents'][_0x329542[_0x4440('0x43')]],[_0x4440('0x2e'),'destconnectedlinenum']);logger[_0x4440('0x28')](_0x4440('0x65'),_0x329542[_0x4440('0x26')],util[_0x4440('0x2a')](this[_0x4440('0x9')][_0x329542[_0x4440('0x26')]][_0x406fce],{'showHidden':![],'depth':null}));ami['emit'](_0x4440('0x66'),this['channels'][_0x329542[_0x4440('0x26')]][_0x406fce]);logger[_0x4440('0x28')](_0x4440('0x67'),_0x329542[_0x4440('0x26')],util[_0x4440('0x2a')](this[_0x4440('0x9')][_0x329542[_0x4440('0x26')]][_0x406fce],{'showHidden':![],'depth':null}));this[_0x4440('0x22')](util[_0x4440('0x36')](_0x4440('0x37'),_0x329542['membername']),'user:agentcomplete',this[_0x4440('0x9')][_0x329542[_0x4440('0x26')]][_0x406fce]);}}}}}}catch(_0x14013c){logger[_0x4440('0x51')](_0x4440('0x68'),_0x329542['uniqueid'],util[_0x4440('0x2a')](_0x14013c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x17')]=function(_0x5af59f){try{if(this[_0x4440('0x23')](_0x5af59f)){logger[_0x4440('0x28')](_0x4440('0x69'),_0x5af59f[_0x4440('0x26')],util['inspect'](_0x5af59f,{'showHidden':![],'depth':null}));this[_0x4440('0x6a')](_0x5af59f[_0x4440('0x26')],_['keys'](_0x5af59f['variable'])[0x0],_0x5af59f[_0x4440('0x6b')]);if(this[_0x4440('0x9')][_0x5af59f[_0x4440('0x26')]]){for(var _0x42b9a1 in this[_0x4440('0x9')][_0x5af59f['uniqueid']]){if(this[_0x4440('0x9')][_0x5af59f['uniqueid']][_0x4440('0x3b')](_0x42b9a1)){logger[_0x4440('0x24')](_0x4440('0x6c'),_0x5af59f[_0x4440('0x26')],_0x42b9a1,_[_0x4440('0x6d')](_0x5af59f[_0x4440('0x6e')])[0x0],_0x5af59f[_0x4440('0x6b')]);if(_[_0x4440('0x2b')](this['channels'][_0x5af59f[_0x4440('0x26')]][_0x42b9a1][_0x4440('0x6f')])){this['channels'][_0x5af59f[_0x4440('0x26')]][_0x42b9a1][_0x4440('0x6f')]={};}this[_0x4440('0x9')][_0x5af59f['uniqueid']][_0x42b9a1][_0x4440('0x6f')]=this['variables'][_0x5af59f[_0x4440('0x26')]];}}}}}catch(_0x3f21df){logger[_0x4440('0x51')](_0x4440('0x70'),_0x5af59f[_0x4440('0x26')],util['inspect'](_0x3f21df,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4440('0x6a')]=function(_0xf2256f,_0x276dde,_0x30ac9e){var _0x330da0=['rtpaudioqos','rtpaudioqosbridged',_0x4440('0x71'),_0x4440('0x72'),'rtpaudioqosloss',_0x4440('0x73'),_0x4440('0x74'),_0x4440('0x75'),_0x4440('0x76'),_0x4440('0x77'),_0x4440('0x78'),'bridgepvtcallid',_0x4440('0x79'),_0x4440('0x7a'),_0x4440('0x7b'),_0x4440('0x7c'),_0x4440('0x38'),'memberpenalty',_0x4440('0x7d')];if(!_[_0x4440('0x7e')](_0x276dde)&&!_[_0x4440('0x7f')](_0x330da0,_0x276dde)){if(_[_0x4440('0x2b')](this[_0x4440('0x6f')][_0xf2256f])){this['variables'][_0xf2256f]={};}this[_0x4440('0x6f')][_0xf2256f][_0x276dde]=_0x30ac9e;}};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x19')]=function(_0xe1e451){try{if(this['isNotNull'](_0xe1e451)){logger[_0x4440('0x28')](_0x4440('0x80'),_0xe1e451['uniqueid'],util[_0x4440('0x2a')](_0xe1e451,{'showHidden':![],'depth':null}));if(this[_0x4440('0x9')][_0xe1e451[_0x4440('0x26')]]){for(var _0x59b1a0 in this['channels'][_0xe1e451[_0x4440('0x26')]]){if(this['channels'][_0xe1e451[_0x4440('0x26')]][_0x4440('0x3b')](_0x59b1a0)){if(this[_0x4440('0x9')][_0xe1e451[_0x4440('0x26')]][_0x59b1a0][_0x4440('0x4e')]==_0x4440('0x5f')&&this[_0x4440('0x9')][_0xe1e451[_0x4440('0x26')]][_0x59b1a0]['agentcomplete']){logger[_0x4440('0x24')](_0x4440('0x81'),_0xe1e451['uniqueid'],_0x59b1a0);this[_0x4440('0x9')][_0xe1e451[_0x4440('0x26')]][_0x59b1a0][_0x4440('0x5d')]=moment()[_0x4440('0x36')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x4440('0x28')](_0x4440('0x82'),_0xe1e451[_0x4440('0x26')],util[_0x4440('0x2a')](_[_0x4440('0x83')](this[_0x4440('0x9')][_0xe1e451['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit'](_0x4440('0x84'),_[_0x4440('0x83')](this['channels'][_0xe1e451[_0x4440('0x26')]]));delete this[_0x4440('0x9')][_0xe1e451[_0x4440('0x26')]];}if(this[_0x4440('0x6f')][_0xe1e451[_0x4440('0x26')]]){delete this[_0x4440('0x6f')][_0xe1e451[_0x4440('0x26')]];}}}catch(_0x52ae3e){logger[_0x4440('0x51')](_0x4440('0x85'),_0xe1e451[_0x4440('0x26')],util[_0x4440('0x2a')](_0x52ae3e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x86')]=function(_0x29d62b){try{if(this[_0x4440('0x23')](_0x29d62b)){logger[_0x4440('0x28')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x29d62b['uniqueid'],util[_0x4440('0x2a')](_0x29d62b,{'showHidden':![],'depth':null}));if(this['channels'][_0x29d62b[_0x4440('0x87')]]){for(var _0x3096cf in this[_0x4440('0x9')][_0x29d62b[_0x4440('0x87')]]){if(this[_0x4440('0x9')][_0x29d62b[_0x4440('0x87')]][_0x4440('0x3b')](_0x3096cf)){if(_0x29d62b['origtransfereruniqueid']===_0x3096cf){logger['info'](_0x4440('0x88'),_0x29d62b[_0x4440('0x26')],this['channels'][_0x29d62b[_0x4440('0x87')]][_0x3096cf][_0x4440('0x38')],_0x3096cf);var _0x427582=moment();this[_0x4440('0x9')][_0x29d62b[_0x4440('0x87')]][_0x3096cf]['agentcomplete']=!![];this[_0x4440('0x9')][_0x29d62b[_0x4440('0x87')]][_0x3096cf][_0x4440('0x5d')]=moment()['format'](_0x4440('0x2c'));this[_0x4440('0x9')][_0x29d62b['transfereeuniqueid']][_0x3096cf]['lastevent']=_0x4440('0x5e');this[_0x4440('0x9')][_0x29d62b[_0x4440('0x87')]][_0x3096cf][_0x4440('0x4e')]='transfer';this[_0x4440('0x9')][_0x29d62b[_0x4440('0x87')]][_0x3096cf][_0x4440('0x60')]=_0x427582[_0x4440('0x89')](this[_0x4440('0x9')][_0x29d62b[_0x4440('0x87')]][_0x3096cf][_0x4440('0x3d')],_0x4440('0x8a'));}}}}if(this[_0x4440('0x9')][_0x29d62b[_0x4440('0x8b')]]){var _0x2de8f0=this[_0x4440('0x9')][_0x29d62b[_0x4440('0x8b')]];this[_0x4440('0x9')][_0x29d62b['secondtransfereruniqueid']]=this[_0x4440('0x9')][_0x29d62b[_0x4440('0x87')]];this[_0x4440('0x9')][_0x29d62b[_0x4440('0x87')]]=_0x2de8f0;}}}catch(_0xa77e12){logger[_0x4440('0x51')](_0x4440('0x8c'),_0x29d62b[_0x4440('0x26')],util['inspect'](_0xa77e12,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x20')]=function(_0x2fe25e){try{if(this[_0x4440('0x23')](_0x2fe25e)){logger[_0x4440('0x28')](_0x4440('0x8d'),_0x2fe25e['uniqueid'],util[_0x4440('0x2a')](_0x2fe25e,{'showHidden':![],'depth':null}));if(this['channels'][_0x2fe25e[_0x4440('0x87')]]){for(var _0x4e6684 in this['channels'][_0x2fe25e[_0x4440('0x87')]]){if(this[_0x4440('0x9')][_0x2fe25e[_0x4440('0x87')]][_0x4440('0x3b')](_0x4e6684)){if(_0x2fe25e[_0x4440('0x8e')]===_0x4e6684){logger[_0x4440('0x24')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2fe25e['uniqueid'],this[_0x4440('0x9')][_0x2fe25e['transfereeuniqueid']][_0x4e6684][_0x4440('0x38')],_0x4e6684);var _0x37eeb4=moment();this[_0x4440('0x9')][_0x2fe25e[_0x4440('0x87')]][_0x4e6684][_0x4440('0x15')]=!![];this[_0x4440('0x9')][_0x2fe25e[_0x4440('0x87')]][_0x4e6684][_0x4440('0x5d')]=_0x37eeb4;this[_0x4440('0x9')][_0x2fe25e[_0x4440('0x87')]][_0x4e6684][_0x4440('0x42')]=_0x4440('0x5e');this[_0x4440('0x9')][_0x2fe25e[_0x4440('0x87')]][_0x4e6684]['reason']=_0x4440('0x5f');this[_0x4440('0x9')][_0x2fe25e[_0x4440('0x87')]][_0x4e6684][_0x4440('0x60')]=_0x37eeb4[_0x4440('0x89')](this[_0x4440('0x9')][_0x2fe25e[_0x4440('0x87')]][_0x4e6684][_0x4440('0x3d')],_0x4440('0x8a'));}}}}}}catch(_0x374119){logger[_0x4440('0x51')](_0x4440('0x8f'),_0x2fe25e['uniqueid'],util[_0x4440('0x2a')](_0x374119,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x1b')]=function(_0x54bdeb){var _0x45e206='';try{if(this['isNotNull'](_0x54bdeb)){logger[_0x4440('0x28')](_0x4440('0x90'),_0x54bdeb[_0x4440('0x26')],util[_0x4440('0x2a')](_0x54bdeb,{'showHidden':![],'depth':null}));if(_0x54bdeb[_0x4440('0x91')]){_0x45e206=_0x54bdeb[_0x4440('0x91')][_0x4440('0x92')](0x0,_0x54bdeb[_0x4440('0x91')][_0x4440('0x93')]('-'));if(this[_0x4440('0xb')][_0x45e206]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x54bdeb[_0x4440('0x26')],_0x45e206);this[_0x4440('0xb')][_0x45e206][_0x4440('0x94')]=!![];}}}}catch(_0x171142){logger[_0x4440('0x51')](_0x4440('0x95'),_0x54bdeb[_0x4440('0x26')],util[_0x4440('0x2a')](_0x171142,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4440('0x21')][_0x4440('0x1d')]=function(_0x525950){var _0x481387='';try{if(this['isNotNull'](_0x525950)){logger[_0x4440('0x28')](_0x4440('0x96'),_0x525950[_0x4440('0x26')],util['inspect'](_0x525950,{'showHidden':![],'depth':null}));if(_0x525950[_0x4440('0x91')]){_0x481387=_0x525950[_0x4440('0x91')][_0x4440('0x92')](0x0,_0x525950['channel']['lastIndexOf']('-'));if(this[_0x4440('0xb')][_0x481387]){logger['info'](_0x4440('0x97'),_0x525950[_0x4440('0x26')],_0x481387);this[_0x4440('0xb')][_0x481387][_0x4440('0x94')]=![];}}}}catch(_0x1823e9){logger[_0x4440('0x51')](_0x4440('0x98'),_0x525950['uniqueid'],util['inspect'](_0x1823e9,{'showHidden':![],'depth':null}));}};module[_0x4440('0x99')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 18b5e80..1fb0546 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca54=['musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','keys','[%s][voiceCallReport][newcallerid]','syncNewChannel','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','channel','context','exten','starttime','format','channelstate','merge','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','applicationdata','appdata','toLowerCase','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','disposition','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','toNumber','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','rec','variable','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','cause-txt','answered','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfercalleridnum','origtransfereruniqueid','transfertargetuniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohstarttime','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../rpc/setting','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','defaults','localhost','channels','agents','blindTransfers','syncNewExten','newexten','newchannel','bind','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xca54,0x9c));var _0x4ca5=function(_0x4f00dd,_0x15fedc){_0x4f00dd=_0x4f00dd-0x0;var _0x3506c9=_0xca54[_0x4f00dd];return _0x3506c9;};'use strict';var BPromise=require('bluebird');var _=require(_0x4ca5('0x0'));var moment=require(_0x4ca5('0x1'));var util=require(_0x4ca5('0x2'));var path=require(_0x4ca5('0x3'));var Redis=require(_0x4ca5('0x4'));var config=require(_0x4ca5('0x5'));var logger=require(_0x4ca5('0x6'))('ami');var ami=require(_0x4ca5('0x7'));var Channel=require('../model/channel');var RpcSetting=require(_0x4ca5('0x8'));var statusDesc=['unknown',_0x4ca5('0x9'),_0x4ca5('0xa'),_0x4ca5('0xb'),'invalid',_0x4ca5('0xc'),_0x4ca5('0xd'),_0x4ca5('0xe'),_0x4ca5('0xf')];var applications=[_0x4ca5('0x10'),_0x4ca5('0x11'),_0x4ca5('0x12'),_0x4ca5('0x13'),_0x4ca5('0x14'),_0x4ca5('0x15')];var dispositions=['NO\x20ANSWER','FAILED',_0x4ca5('0x16'),_0x4ca5('0x17'),_0x4ca5('0x17'),_0x4ca5('0x17'),'ANSWERED',_0x4ca5('0x18'),_0x4ca5('0x16'),_0x4ca5('0x16'),_0x4ca5('0x16')];var actions={};config[_0x4ca5('0x19')]=_[_0x4ca5('0x1a')](config[_0x4ca5('0x19')],{'host':_0x4ca5('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4ca5('0x19')]));function VoiceCallReport(_0xc3a3c7){this[_0x4ca5('0x1c')]=_0xc3a3c7['channels'];this[_0x4ca5('0x1d')]=_0xc3a3c7['agents'];this[_0x4ca5('0x1e')]={};ami['on']('coreshowchannel',this[_0x4ca5('0x1f')]['bind'](this));ami['on'](_0x4ca5('0x20'),this[_0x4ca5('0x1f')]['bind'](this));ami['on'](_0x4ca5('0x21'),this['syncNewChannel'][_0x4ca5('0x22')](this));ami['on'](_0x4ca5('0x23'),this[_0x4ca5('0x24')][_0x4ca5('0x22')](this));ami['on']('varset',this[_0x4ca5('0x25')][_0x4ca5('0x22')](this));ami['on'](_0x4ca5('0x26'),this[_0x4ca5('0x27')]['bind'](this));ami['on'](_0x4ca5('0x28'),this[_0x4ca5('0x29')][_0x4ca5('0x22')](this));ami['on'](_0x4ca5('0x2a'),this[_0x4ca5('0x2b')][_0x4ca5('0x22')](this));ami['on'](_0x4ca5('0x2c'),this['syncBlindTransfer'][_0x4ca5('0x22')](this));ami['on'](_0x4ca5('0x2d'),this['syncMusicOnHoldStart'][_0x4ca5('0x22')](this));ami['on'](_0x4ca5('0x2e'),this[_0x4ca5('0x2f')][_0x4ca5('0x22')](this));try{logger[_0x4ca5('0x30')](_0x4ca5('0x31'));ami[_0x4ca5('0x32')]();}catch(_0x51a823){logger[_0x4ca5('0x33')](_0x4ca5('0x34'),util[_0x4ca5('0x35')](_0x51a823,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x1dee0a){return _0x1dee0a!==null&&!_[_0x4ca5('0x36')](_0x1dee0a);};VoiceCallReport[_0x4ca5('0x37')]['emit']=function(_0x1dc1c6,_0x5549e2,_0x18b8e6){io['to'](_0x1dc1c6)[_0x4ca5('0x38')](_0x5549e2,_0x18b8e6);};VoiceCallReport['prototype'][_0x4ca5('0x29')]=function(_0x31e662){try{if(this['isNotNull'](_0x31e662)){logger[_0x4ca5('0x30')](_0x4ca5('0x39'),_0x31e662[_0x4ca5('0x3a')],_0x31e662[_0x4ca5('0x3b')],_0x31e662[_0x4ca5('0x3c')]);logger[_0x4ca5('0x3d')](_0x4ca5('0x3e'),_0x31e662[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0x31e662,{'showHidden':![],'depth':null}));if(_0x31e662['uniqueid']===_0x31e662[_0x4ca5('0x3f')]){if(!_[_0x4ca5('0x36')](this[_0x4ca5('0x1c')][_0x31e662['uniqueid']])){_['merge'](this[_0x4ca5('0x1c')][_0x31e662[_0x4ca5('0x3a')]],_[_0x4ca5('0x40')](_0x31e662,_[_0x4ca5('0x41')](this[_0x4ca5('0x1c')][_0x31e662[_0x4ca5('0x3a')]])));}}}}catch(_0x362840){logger[_0x4ca5('0x33')](_0x4ca5('0x42'),_0x31e662['uniqueid'],util[_0x4ca5('0x35')](_0x362840,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ca5('0x37')][_0x4ca5('0x43')]=function(_0xbbfa9b){try{if(this[_0x4ca5('0x44')](_0xbbfa9b)){logger[_0x4ca5('0x3d')](_0x4ca5('0x45'),_0xbbfa9b[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0xbbfa9b,{'showHidden':![],'depth':null}));if(_0xbbfa9b[_0x4ca5('0x3a')]===_0xbbfa9b[_0x4ca5('0x3f')]&&_0xbbfa9b[_0x4ca5('0x46')]!='OutgoingSpoolFailed'){if(_[_0x4ca5('0x36')](this[_0x4ca5('0x1c')][_0xbbfa9b[_0x4ca5('0x3a')]])){logger[_0x4ca5('0x30')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0xbbfa9b['uniqueid'],_0xbbfa9b[_0x4ca5('0x47')],_0xbbfa9b[_0x4ca5('0x48')]);this[_0x4ca5('0x1c')][_0xbbfa9b[_0x4ca5('0x3a')]]=new Channel();this[_0x4ca5('0x1c')][_0xbbfa9b[_0x4ca5('0x3a')]][_0x4ca5('0x49')]=moment()[_0x4ca5('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xbbfa9b[_0x4ca5('0x3a')]]['disposition']=dispositions[_['toNumber'](_0xbbfa9b[_0x4ca5('0x4b')])];_[_0x4ca5('0x4c')](this[_0x4ca5('0x1c')][_0xbbfa9b[_0x4ca5('0x3a')]],_[_0x4ca5('0x40')](_0xbbfa9b,_[_0x4ca5('0x41')](this['channels'][_0xbbfa9b[_0x4ca5('0x3a')]])));if(_0xbbfa9b[_0x4ca5('0x47')]===_0x4ca5('0x4d')){if(this[_0x4ca5('0x1d')][_0xbbfa9b[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]){this[_0x4ca5('0x1d')][_0xbbfa9b[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]][_0x4ca5('0x4f')]=_0xbbfa9b[_0x4ca5('0x48')];logger[_0x4ca5('0x3d')](_0x4ca5('0x50'),_0xbbfa9b[_0x4ca5('0x3a')],util[_0x4ca5('0x35')]({'id':this[_0x4ca5('0x1d')][_0xbbfa9b[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]['id'],'destaccountcode':this[_0x4ca5('0x1d')][_0xbbfa9b['channel'][_0x4ca5('0x4e')]('-')[0x0]][_0x4ca5('0x51')],'destconnectedlinenum':_0xbbfa9b[_0x4ca5('0x48')]},{'showHidden':![],'depth':null}));this[_0x4ca5('0x38')](util[_0x4ca5('0x4a')](_0x4ca5('0x52'),this[_0x4ca5('0x1d')][_0xbbfa9b['channel'][_0x4ca5('0x4e')]('-')[0x0]][_0x4ca5('0x53')]),_0x4ca5('0x54'),{'id':this[_0x4ca5('0x1d')][_0xbbfa9b[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]['id'],'destaccountcode':this[_0x4ca5('0x1d')][_0xbbfa9b[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]][_0x4ca5('0x51')],'destconnectedlinenum':_0xbbfa9b['exten']});}}}}}}catch(_0x52f4c9){logger[_0x4ca5('0x33')]('[%s][voiceCallReport][newchannel]',_0xbbfa9b[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0x52f4c9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ca5('0x37')][_0x4ca5('0x1f')]=function(_0x31e74c){try{if(this['isNotNull'](_0x31e74c)){logger[_0x4ca5('0x3d')](_0x4ca5('0x55'),_0x31e74c['uniqueid'],util['inspect'](_0x31e74c,{'showHidden':![],'depth':null}));if(_0x31e74c[_0x4ca5('0x3a')]===_0x31e74c['linkedid']&&_0x31e74c[_0x4ca5('0x48')]!='h'&&_0x31e74c[_0x4ca5('0x46')]!=_0x4ca5('0x56')){_0x31e74c[_0x4ca5('0x57')]=_0x31e74c[_0x4ca5('0x57')]['toLowerCase']();_0x31e74c[_0x4ca5('0x58')]=(_0x31e74c[_0x4ca5('0x59')]||_0x31e74c['applicationdata'])[_0x4ca5('0x5a')]();logger[_0x4ca5('0x30')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x31e74c[_0x4ca5('0x3a')],_0x31e74c[_0x4ca5('0x57')],_0x31e74c['applicationdata']);if(_[_0x4ca5('0x36')](this[_0x4ca5('0x1c')][_0x31e74c[_0x4ca5('0x3a')]])){this[_0x4ca5('0x1c')][_0x31e74c[_0x4ca5('0x3a')]]=new Channel();this['channels'][_0x31e74c[_0x4ca5('0x3a')]][_0x4ca5('0x49')]=_0x31e74c['duration']?moment()[_0x4ca5('0x5b')](moment['duration'](_0x31e74c[_0x4ca5('0x5c')])[_0x4ca5('0x5d')](),_0x4ca5('0x5d'))[_0x4ca5('0x4a')](_0x4ca5('0x5e')):moment()[_0x4ca5('0x4a')](_0x4ca5('0x5e'));this[_0x4ca5('0x1c')][_0x31e74c[_0x4ca5('0x3a')]][_0x4ca5('0x5f')]=_0x4ca5('0x17');}_[_0x4ca5('0x4c')](this['channels'][_0x31e74c[_0x4ca5('0x3a')]],_[_0x4ca5('0x40')](_0x31e74c,_['keys'](this[_0x4ca5('0x1c')][_0x31e74c[_0x4ca5('0x3a')]])));if(_[_0x4ca5('0x60')](applications,_0x31e74c['application'])){this['channels'][_0x31e74c['uniqueid']][_0x4ca5('0x61')]=_0x31e74c['application'];this[_0x4ca5('0x1c')][_0x31e74c[_0x4ca5('0x3a')]][_0x4ca5('0x62')]=_0x31e74c[_0x4ca5('0x58')];if(_0x31e74c[_0x4ca5('0x57')]===_0x4ca5('0x10')&&_[_0x4ca5('0x63')](_0x31e74c['applicationdata'],_0x4ca5('0x64'))){var _0x5c136a=_0x31e74c[_0x4ca5('0x58')][_0x4ca5('0x4e')]('=');var _0x29953c=_0x5c136a[0x0][_0x4ca5('0x65')](/cdr\((.*)\)/);if(_0x29953c){this['channels'][_0x31e74c[_0x4ca5('0x3a')]][_0x29953c[0x1]]=_0x5c136a[0x1];}}else if(_0x31e74c[_0x4ca5('0x57')]===_0x4ca5('0x11')){this[_0x4ca5('0x1c')][_0x31e74c[_0x4ca5('0x3a')]][_0x4ca5('0x11')]=_0x31e74c['applicationdata'][_0x4ca5('0x4e')](',')[0x0];}}}}}catch(_0x5041d2){logger[_0x4ca5('0x33')]('[%s][voiceCallReport][newexten]',_0x31e74c[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0x5041d2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ca5('0x37')]['syncNewState']=function(_0x13015e){try{if(this['isNotNull'](_0x13015e)){logger[_0x4ca5('0x30')](_0x4ca5('0x66'),_0x13015e['uniqueid'],_0x13015e[_0x4ca5('0x3f')],_0x13015e['calleridname'],_0x13015e[_0x4ca5('0x3c')]);logger[_0x4ca5('0x3d')](_0x4ca5('0x67'),_0x13015e[_0x4ca5('0x3a')],util['inspect'](_0x13015e,{'showHidden':![],'depth':null}));if(_0x13015e[_0x4ca5('0x3a')]!==_0x13015e[_0x4ca5('0x3f')]){if(this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3f')]]){if(_0x13015e[_0x4ca5('0x4b')]==='6'){if(!this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3f')]]['answered']){var _0x505349=moment();this[_0x4ca5('0x1c')][_0x13015e['linkedid']]['answered']=!![];this['channels'][_0x13015e[_0x4ca5('0x3f')]][_0x4ca5('0x68')]=_0x505349[_0x4ca5('0x4a')](_0x4ca5('0x5e'));if(this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3f')]][_0x4ca5('0x49')]){this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3f')]][_0x4ca5('0x69')]=_0x505349[_0x4ca5('0x6a')](this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3f')]][_0x4ca5('0x49')],_0x4ca5('0x5d'));}}this[_0x4ca5('0x1c')][_0x13015e['linkedid']][_0x4ca5('0x3f')]=_0x13015e[_0x4ca5('0x3a')];if(_0x13015e['calleridnum']!==_0x4ca5('0x6b')){this['channels'][_0x13015e[_0x4ca5('0x3f')]][_0x4ca5('0x6c')]=_0x13015e[_0x4ca5('0x3c')];}this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3f')]][_0x4ca5('0x6d')]=_0x13015e[_0x4ca5('0x3b')];this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3f')]][_0x4ca5('0x6e')]=_0x13015e[_0x4ca5('0x46')];this[_0x4ca5('0x1c')][_0x13015e['linkedid']][_0x4ca5('0x5f')]=dispositions[_[_0x4ca5('0x6f')](_0x13015e[_0x4ca5('0x4b')])];if(this[_0x4ca5('0x1d')][_0x13015e[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]){this['channels'][_0x13015e['linkedid']][_0x4ca5('0x70')]=this[_0x4ca5('0x1d')][_0x13015e[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]['id'];this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3f')]][_0x4ca5('0x71')]=this['agents'][_0x13015e['channel'][_0x4ca5('0x4e')]('-')[0x0]][_0x4ca5('0x53')];}}}}else{if(this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3a')]]){if(_0x13015e[_0x4ca5('0x4b')]==='6'){if(this[_0x4ca5('0x1d')][_0x13015e[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]){this['channels'][_0x13015e[_0x4ca5('0x3a')]][_0x4ca5('0x70')]=this['agents'][_0x13015e[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]['id'];this[_0x4ca5('0x1c')][_0x13015e[_0x4ca5('0x3a')]]['membername']=this[_0x4ca5('0x1d')][_0x13015e['channel'][_0x4ca5('0x4e')]('-')[0x0]][_0x4ca5('0x53')];}}}}}}catch(_0xf94e11){logger['error'](_0x4ca5('0x72'),_0x13015e[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0xf94e11,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4ca5('0x73')]=function(_0x4eebe8,_0x1d5a61){try{if(this[_0x4ca5('0x1c')][_0x4eebe8]){logger['info'](_0x4ca5('0x74'),_0x4eebe8,_0x1d5a61);this['channels'][_0x4eebe8][_0x4ca5('0x75')]=!![];if(_[_0x4ca5('0x76')](_0x1d5a61,_0x4ca5('0x77'))){_0x1d5a61=_0x1d5a61[_0x4ca5('0x78')](_0x4ca5('0x77'),_0x4ca5('0x79'));}this[_0x4ca5('0x1c')][_0x4eebe8][_0x4ca5('0x7a')]=_0x1d5a61;var _0x361777=_['find'](this[_0x4ca5('0x1c')][_0x4eebe8][_0x4ca5('0x7b')],{'filename':_0x1d5a61});if(_[_0x4ca5('0x7c')](_0x361777)){this[_0x4ca5('0x1c')][_0x4eebe8][_0x4ca5('0x7b')][_0x4ca5('0x7d')]({'filename':_0x1d5a61,'createdAt':moment()[_0x4ca5('0x4a')](_0x4ca5('0x5e')),'mixmonitorid':'','status':_0x4ca5('0x7e')});}}}catch(_0x7951ac){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x4eebe8,util[_0x4ca5('0x35')](_0x7951ac,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ca5('0x37')][_0x4ca5('0x25')]=function(_0x4d8009){try{if(this[_0x4ca5('0x44')](_0x4d8009)){logger[_0x4ca5('0x3d')]('[%s][voiceCallReport][varset]\x20event:',_0x4d8009[_0x4ca5('0x3a')],util['inspect'](_0x4d8009,{'showHidden':![],'depth':null}));if(this['channels'][_0x4d8009['uniqueid']]&&_0x4d8009['channel']!=_0x4ca5('0x56')){if(this['isNotNull'](_0x4d8009['variable'])){if(this[_0x4ca5('0x44')](_0x4d8009[_0x4ca5('0x7f')]['mixmonitor_filename'])){logger[_0x4ca5('0x30')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4d8009[_0x4ca5('0x3a')],_0x4d8009[_0x4ca5('0x80')]);this[_0x4ca5('0x73')](_0x4d8009['uniqueid'],_0x4d8009[_0x4ca5('0x80')]);}else if(this['isNotNull'](_0x4d8009[_0x4ca5('0x7f')]['xmd-phone'])){logger[_0x4ca5('0x30')](_0x4ca5('0x81'),_0x4d8009[_0x4ca5('0x3a')],_0x4d8009[_0x4ca5('0x80')]);this[_0x4ca5('0x1c')][_0x4d8009[_0x4ca5('0x3a')]][_0x4ca5('0x3c')]=_0x4d8009[_0x4ca5('0x80')];}else if(this['isNotNull'](_0x4d8009[_0x4ca5('0x7f')][_0x4ca5('0x82')])){logger['info'](_0x4ca5('0x83'),_0x4d8009[_0x4ca5('0x3a')],_0x4d8009[_0x4ca5('0x80')]);this['channels'][_0x4d8009[_0x4ca5('0x3a')]]['callerid']=_0x4d8009['value'];}else if(this[_0x4ca5('0x44')](_0x4d8009[_0x4ca5('0x7f')][_0x4ca5('0x84')])){logger[_0x4ca5('0x30')](_0x4ca5('0x85'),_0x4d8009['uniqueid'],_0x4d8009[_0x4ca5('0x80')]);this[_0x4ca5('0x1c')][_0x4d8009[_0x4ca5('0x3a')]][_0x4ca5('0x86')]=_0x4d8009[_0x4ca5('0x80')];}else if(this['isNotNull'](_0x4d8009[_0x4ca5('0x7f')][_0x4ca5('0x87')])){logger[_0x4ca5('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x4d8009[_0x4ca5('0x3a')],_0x4d8009[_0x4ca5('0x80')][_0x4ca5('0x4e')](',')[0x0]);this[_0x4ca5('0x1c')][_0x4d8009['uniqueid']][_0x4ca5('0x11')]=_0x4d8009[_0x4ca5('0x80')][_0x4ca5('0x4e')](',')[0x0];}else if(this[_0x4ca5('0x44')](_0x4d8009[_0x4ca5('0x7f')][_0x4ca5('0x88')])){logger[_0x4ca5('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4d8009['uniqueid'],_0x4d8009[_0x4ca5('0x80')]);this[_0x4ca5('0x1c')][_0x4d8009[_0x4ca5('0x3a')]][_0x4ca5('0x89')]=_0x4d8009['value'];}else if(this['isNotNull'](_0x4d8009[_0x4ca5('0x7f')][_0x4ca5('0x8a')])){logger[_0x4ca5('0x30')](_0x4ca5('0x8b'),_0x4d8009[_0x4ca5('0x3a')],_0x4d8009['value']);this[_0x4ca5('0x1c')][_0x4d8009[_0x4ca5('0x3a')]][_0x4ca5('0x8c')]=_0x4d8009[_0x4ca5('0x80')];}else if(this[_0x4ca5('0x44')](_0x4d8009['variable'][_0x4ca5('0x8d')])){logger[_0x4ca5('0x30')](_0x4ca5('0x8e'),_0x4d8009[_0x4ca5('0x3a')],_0x4d8009[_0x4ca5('0x80')]);this[_0x4ca5('0x1c')][_0x4d8009[_0x4ca5('0x3a')]][_0x4ca5('0x8f')]=_0x4d8009[_0x4ca5('0x80')];}else if(this[_0x4ca5('0x44')](_0x4d8009[_0x4ca5('0x7f')][_0x4ca5('0x90')])){logger[_0x4ca5('0x30')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x4d8009['uniqueid'],_0x4d8009[_0x4ca5('0x80')]);this[_0x4ca5('0x1c')][_0x4d8009[_0x4ca5('0x3a')]][_0x4ca5('0x11')]=_0x4d8009[_0x4ca5('0x80')];}else if(this[_0x4ca5('0x44')](_0x4d8009['variable'][_0x4ca5('0x91')])){logger['info'](_0x4ca5('0x92'),_0x4d8009[_0x4ca5('0x3a')],_0x4d8009['value']);this[_0x4ca5('0x1c')][_0x4d8009[_0x4ca5('0x3a')]][_0x4ca5('0x93')]=_0x4d8009[_0x4ca5('0x80')];}}}else if(this['isNotNull'](_0x4d8009['variable'][_0x4ca5('0x94')])){if(_0x4d8009[_0x4ca5('0x80')]){var _0x2cdee5=path[_0x4ca5('0x95')](_0x4d8009[_0x4ca5('0x80')])['name'];logger['info'](_0x4ca5('0x96'),_0x2cdee5,_0x4d8009[_0x4ca5('0x80')]);this['syncMixMonitorFilename'](_0x2cdee5,_0x4d8009[_0x4ca5('0x80')]);}}else if(this['channels'][_0x4d8009[_0x4ca5('0x3f')]]){if(this[_0x4ca5('0x44')](_0x4d8009['variable'])){if(this[_0x4ca5('0x44')](_0x4d8009[_0x4ca5('0x7f')]['sipcallid'])){logger[_0x4ca5('0x30')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4d8009[_0x4ca5('0x3f')],_0x4d8009[_0x4ca5('0x80')]);this['channels'][_0x4d8009['linkedid']][_0x4ca5('0x97')]=_0x4d8009[_0x4ca5('0x80')];}}}}}catch(_0x476a13){logger[_0x4ca5('0x33')](_0x4ca5('0x98'),_0x4d8009[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0x476a13,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ca5('0x37')][_0x4ca5('0x27')]=function(_0x4faca3){try{if(this['isNotNull'](_0x4faca3)){logger[_0x4ca5('0x3d')]('[%s][voiceCallReport][hangup]\x20event:',_0x4faca3[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0x4faca3,{'showHidden':![],'depth':null}));if(this[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]]){logger[_0x4ca5('0x30')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x4faca3[_0x4ca5('0x3a')],_0x4faca3[_0x4ca5('0x99')]);var _0xef3089=moment();this['channels'][_0x4faca3[_0x4ca5('0x3a')]]['endtime']=_0xef3089['format'](_0x4ca5('0x5e'));this[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]][_0x4ca5('0x5c')]=_0xef3089[_0x4ca5('0x6a')](this[_0x4ca5('0x1c')][_0x4faca3['uniqueid']][_0x4ca5('0x49')],_0x4ca5('0x5d'));if(this['channels'][_0x4faca3[_0x4ca5('0x3a')]][_0x4ca5('0x9a')]){this['channels'][_0x4faca3['uniqueid']]['billableseconds']=_0xef3089['diff'](this[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]]['answertime'],_0x4ca5('0x5d'));this[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]]['holdtime']=this[_0x4ca5('0x1c')][_0x4faca3['uniqueid']][_0x4ca5('0x5c')]-this[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]][_0x4ca5('0x9b')];}if(_0x4faca3['context']===_0x4ca5('0x4d')){if(this[_0x4ca5('0x1d')][_0x4faca3[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]){this[_0x4ca5('0x1d')][_0x4faca3[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]=_[_0x4ca5('0x9c')](this[_0x4ca5('0x1d')][_0x4faca3[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]],[_0x4ca5('0x4f')]);logger[_0x4ca5('0x3d')](_0x4ca5('0x9d'),_0x4faca3[_0x4ca5('0x3a')],util[_0x4ca5('0x35')]({'id':this[_0x4ca5('0x1d')][_0x4faca3[_0x4ca5('0x46')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x4ca5('0x1d')][_0x4faca3[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]][_0x4ca5('0x51')]},{'showHidden':![],'depth':null}));this[_0x4ca5('0x38')](util[_0x4ca5('0x4a')](_0x4ca5('0x52'),this[_0x4ca5('0x1d')][_0x4faca3[_0x4ca5('0x46')][_0x4ca5('0x4e')]('-')[0x0]]['name']),'user:agentcomplete',{'id':this['agents'][_0x4faca3['channel'][_0x4ca5('0x4e')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x4faca3[_0x4ca5('0x46')]['split']('-')[0x0]][_0x4ca5('0x51')]});}}var _0x54fd34=this;Promise[_0x4ca5('0x9e')]()[_0x4ca5('0x9f')](function(){var _0x4159b3=_0x54fd34[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]];if(typeof _0x4159b3[_0x4ca5('0xa0')]===_0x4ca5('0xa1'))return;if(_[_0x4ca5('0xa2')](_0x4159b3['monitors']))return;return RpcSetting[_0x4ca5('0xa3')]()[_0x4ca5('0x9f')](function(_0x515ee9){if(!_0x515ee9[_0x4ca5('0xa4')])return;return Promise['resolve']()['then'](function(){return ami[_0x4ca5('0xa5')]({'action':_0x4ca5('0xa6'),'channel':_0x4159b3[_0x4ca5('0x46')]})['catch'](function(){});})[_0x4ca5('0x9f')](function(){return ami[_0x4ca5('0xa5')]({'action':_0x4ca5('0xa6'),'channel':_0x4159b3[_0x4ca5('0x6e')]})[_0x4ca5('0xa7')](function(){})[_0x4ca5('0xa8')](function(){var _0x4721f1=_0x54fd34[_0x4ca5('0x1d')][_0x4159b3['destinationchannel'][_0x4ca5('0x4e')]('-')[0x0]];if(!_0x4721f1)return;io[_0x4ca5('0x38')](_0x4ca5('0xa9'),{'agentId':_0x4721f1['id'],'uniqueid':_0x4159b3[_0x4ca5('0x3a')]});});});});})[_0x4ca5('0x9f')](function(){if(_0x4faca3['event']===_0x4ca5('0xaa')){_0x54fd34[_0x4ca5('0x1e')][_0x4faca3['uniqueid']]=_0x54fd34['channels'][_0x4faca3[_0x4ca5('0x3a')]];}else{if(_0x54fd34[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]][_0x4ca5('0x86')]===_0x4ca5('0xab')&&_0x54fd34[_0x4ca5('0x1e')][_0x4faca3[_0x4ca5('0x3a')]]){_0x54fd34[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]]['uniqueid']=[_0x54fd34[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]][_0x4ca5('0x3f')],_0x54fd34[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]][_0x4ca5('0x3f')]=_0x54fd34[_0x4ca5('0x1c')][_0x4faca3['uniqueid']][_0x4ca5('0x3a')]][0x0];delete _0x54fd34['blindTransfers'][_0x4faca3[_0x4ca5('0x3a')]];}}logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x4faca3['uniqueid'],util[_0x4ca5('0x35')](_0x54fd34[_0x4ca5('0x1c')][_0x4faca3['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x4ca5('0x38')](_0x4ca5('0xac'),_0x54fd34[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]]);delete _0x54fd34[_0x4ca5('0x1c')][_0x4faca3[_0x4ca5('0x3a')]];});}}}catch(_0x1c1828){logger[_0x4ca5('0x33')]('[%s][voiceCallReport][hangup]',_0x4faca3[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0x1c1828,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ca5('0x37')][_0x4ca5('0x2b')]=function(_0xcaf345){try{if(this[_0x4ca5('0x44')](_0xcaf345)){logger[_0x4ca5('0x30')](_0x4ca5('0xad'),_0xcaf345[_0x4ca5('0x3a')],_0xcaf345[_0x4ca5('0xae')],_0xcaf345[_0x4ca5('0xaf')]);logger[_0x4ca5('0x3d')](_0x4ca5('0xb0'),_0xcaf345['uniqueid'],util[_0x4ca5('0x35')](_0xcaf345,{'showHidden':![],'depth':null}));if(this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb1')]]){this['channels'][_0xcaf345[_0x4ca5('0xb1')]]['transfercalleridnum']=_0xcaf345[_0x4ca5('0xae')];this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb1')]][_0x4ca5('0xb2')]=_0xcaf345[_0x4ca5('0xaf')];if(this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb3')]]){var _0x145508=this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb3')]];this[_0x4ca5('0x1c')][_0xcaf345['secondtransfereruniqueid']]=this['channels'][_0xcaf345[_0x4ca5('0xb1')]];this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb1')]]=_0x145508;}}else if(this[_0x4ca5('0x1c')][_0xcaf345['transfertargetuniqueid']]){this[_0x4ca5('0x1c')][_0xcaf345['transfertargetuniqueid']][_0x4ca5('0xb4')]=_0xcaf345['origtransferercalleridnum'];this['channels'][_0xcaf345['transfertargetuniqueid']]['transferconnectedlinenum']=_0xcaf345['transfertargetcalleridnum'];if(this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb5')]]){var _0x145508=this['channels'][_0xcaf345['origtransfereruniqueid']];this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb5')]]=this['channels'][_0xcaf345[_0x4ca5('0xb6')]];this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb6')]]=_0x145508;}}if((this[_0x4ca5('0x1c')][_0xcaf345['origtransfereruniqueid']]||this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb7')]])&&this['channels'][_0xcaf345[_0x4ca5('0xb3')]]){var _0x2414c7=_[_0x4ca5('0xb8')]([this[_0x4ca5('0x1c')][_0xcaf345['origtransfereruniqueid']],this[_0x4ca5('0x1c')][_0xcaf345['origtransfererlinkedid']],this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb3')]]],function(_0x43045c){return _0x43045c&&_0x43045c[_0x4ca5('0x86')]===_0x4ca5('0xab')&&_0x43045c[_0x4ca5('0xb9')];});if(_0x2414c7){if(this['channels'][_0xcaf345['origtransfereruniqueid']])this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb5')]]['transferType']=_0x4ca5('0xba');if(this['channels'][_0xcaf345[_0x4ca5('0xb7')]])this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb7')]][_0x4ca5('0xa0')]=_0x4ca5('0xba');this[_0x4ca5('0x1c')][_0xcaf345[_0x4ca5('0xb3')]]['transferType']=_0x4ca5('0xba');}}}}catch(_0x561a90){logger['error'](_0x4ca5('0xbb'),_0xcaf345['uniqueid'],util[_0x4ca5('0x35')](_0x561a90,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ca5('0x37')]['syncBlindTransfer']=function(_0x5660f0){try{if(this[_0x4ca5('0x44')](_0x5660f0)){logger['info']('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x5660f0[_0x4ca5('0x3a')],_0x5660f0[_0x4ca5('0xbc')],_0x5660f0['extension']);logger[_0x4ca5('0x3d')](_0x4ca5('0xbd'),_0x5660f0[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0x5660f0,{'showHidden':![],'depth':null}));if(this[_0x4ca5('0x1c')][_0x5660f0[_0x4ca5('0xb1')]]){this['channels'][_0x5660f0['transfereeuniqueid']][_0x4ca5('0xb4')]=_0x5660f0[_0x4ca5('0xbc')];this[_0x4ca5('0x1c')][_0x5660f0[_0x4ca5('0xb1')]]['transferconnectedlinenum']=_0x5660f0['extension'];this[_0x4ca5('0x1c')][_0x5660f0[_0x4ca5('0xb1')]][_0x4ca5('0xa0')]='BLIND';this[_0x4ca5('0x27')]({'event':_0x4ca5('0xaa'),'uniqueid':_0x5660f0[_0x4ca5('0xb1')],'context':_0x5660f0[_0x4ca5('0x47')],'channel':_0x5660f0[_0x4ca5('0xbe')]});}else{this[_0x4ca5('0x1c')][_0x5660f0[_0x4ca5('0xbf')]]['transferType']=_0x4ca5('0xc0');}}}catch(_0xb6b825){logger[_0x4ca5('0x33')]('[%s][voiceCallReport][blindtransfer]',_0x5660f0['uniqueid'],util['inspect'](_0xb6b825,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x38e6f0){try{if(this['isNotNull'](_0x38e6f0)){logger['debug'](_0x4ca5('0xc1'),_0x38e6f0[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0x38e6f0,{'showHidden':![],'depth':null}));if(this[_0x4ca5('0x1c')][_0x38e6f0['uniqueid']]){if(!_[_0x4ca5('0x7c')](this[_0x4ca5('0x1c')][_0x38e6f0[_0x4ca5('0x3a')]][_0x4ca5('0x68')])){this[_0x4ca5('0x1c')][_0x38e6f0['uniqueid']]['mohstarttime']=moment()[_0x4ca5('0x4a')](_0x4ca5('0x5e'));logger[_0x4ca5('0x30')](_0x4ca5('0xc2'),_0x38e6f0['uniqueid'],this['channels'][_0x38e6f0[_0x4ca5('0x3a')]]['mohstarttime']);}}}}catch(_0xbcfd4b){logger[_0x4ca5('0x33')](_0x4ca5('0xc3'),_0x38e6f0[_0x4ca5('0x3a')],util['inspect'](_0xbcfd4b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ca5('0x37')][_0x4ca5('0x2f')]=function(_0x1bcb3c){try{if(this[_0x4ca5('0x44')](_0x1bcb3c)){logger[_0x4ca5('0x3d')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x1bcb3c[_0x4ca5('0x3a')],util[_0x4ca5('0x35')](_0x1bcb3c,{'showHidden':![],'depth':null}));if(this[_0x4ca5('0x1c')][_0x1bcb3c[_0x4ca5('0x3a')]]){if(!_[_0x4ca5('0x7c')](this[_0x4ca5('0x1c')][_0x1bcb3c[_0x4ca5('0x3a')]][_0x4ca5('0xc4')])){this['channels'][_0x1bcb3c[_0x4ca5('0x3a')]][_0x4ca5('0xc5')]+=moment()['milliseconds'](0x0)[_0x4ca5('0x6a')](this[_0x4ca5('0x1c')][_0x1bcb3c['uniqueid']][_0x4ca5('0xc4')],_0x4ca5('0x5d'));logger['info'](_0x4ca5('0xc6'),_0x1bcb3c[_0x4ca5('0x3a')],this['channels'][_0x1bcb3c[_0x4ca5('0x3a')]][_0x4ca5('0xc5')]);delete this[_0x4ca5('0x1c')][_0x1bcb3c[_0x4ca5('0x3a')]][_0x4ca5('0xc4')];}}}}catch(_0x136920){logger[_0x4ca5('0x33')](_0x4ca5('0xc7'),_0x1bcb3c['uniqueid'],util['inspect'](_0x136920,{'showHidden':![],'depth':null}));}};module[_0x4ca5('0xc8')]=VoiceCallReport; \ No newline at end of file +var _0x79e5=['exten','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','merge','keys','from-sip','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','match','[%s][voiceCallReport][newexten]','answered','answertime','holdtime','diff','connectedlinenum','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','monitor','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','billableseconds','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','BlindTransfer','blindTransfers','type','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','outbound','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','transfercalleridnum','extension','BLIND','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','path','ioredis','../../../config/environment','../ami','inuse','busy','invalid','unavailable','ringinuse','onhold','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','channels','pick','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','isUndefined','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context'];(function(_0x492d28,_0x3e24ba){var _0x2aae48=function(_0x304b1f){while(--_0x304b1f){_0x492d28['push'](_0x492d28['shift']());}};_0x2aae48(++_0x3e24ba);}(_0x79e5,0x79));var _0x579e=function(_0x58402d,_0x34204a){_0x58402d=_0x58402d-0x0;var _0x2f48ed=_0x79e5[_0x58402d];return _0x2f48ed;};'use strict';var BPromise=require(_0x579e('0x0'));var _=require(_0x579e('0x1'));var moment=require(_0x579e('0x2'));var util=require('util');var path=require(_0x579e('0x3'));var Redis=require(_0x579e('0x4'));var config=require(_0x579e('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x579e('0x6'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var statusDesc=['unknown','not_inuse',_0x579e('0x7'),_0x579e('0x8'),_0x579e('0x9'),_0x579e('0xa'),'ringing',_0x579e('0xb'),_0x579e('0xc')];var applications=['set',_0x579e('0xd'),_0x579e('0xe'),_0x579e('0xf'),_0x579e('0x10'),_0x579e('0x11')];var dispositions=[_0x579e('0x12'),_0x579e('0x13'),_0x579e('0x13'),_0x579e('0x12'),_0x579e('0x12'),_0x579e('0x12'),_0x579e('0x14'),_0x579e('0x15'),_0x579e('0x13'),_0x579e('0x13'),_0x579e('0x13')];var actions={};config[_0x579e('0x16')]=_[_0x579e('0x17')](config[_0x579e('0x16')],{'host':_0x579e('0x18'),'port':0x18eb});var io=require(_0x579e('0x19'))(new Redis(config['redis']));function VoiceCallReport(_0x54c456){this['channels']=_0x54c456['channels'];this[_0x579e('0x1a')]=_0x54c456['agents'];this['blindTransfers']={};ami['on'](_0x579e('0x1b'),this[_0x579e('0x1c')][_0x579e('0x1d')](this));ami['on'](_0x579e('0x1e'),this[_0x579e('0x1c')][_0x579e('0x1d')](this));ami['on'](_0x579e('0x1f'),this[_0x579e('0x20')]['bind'](this));ami['on'](_0x579e('0x21'),this[_0x579e('0x22')]['bind'](this));ami['on']('varset',this[_0x579e('0x23')][_0x579e('0x1d')](this));ami['on'](_0x579e('0x24'),this[_0x579e('0x25')][_0x579e('0x1d')](this));ami['on'](_0x579e('0x26'),this['syncNewCallerId'][_0x579e('0x1d')](this));ami['on'](_0x579e('0x27'),this[_0x579e('0x28')]['bind'](this));ami['on']('blindtransfer',this[_0x579e('0x29')][_0x579e('0x1d')](this));ami['on'](_0x579e('0x2a'),this[_0x579e('0x2b')]['bind'](this));ami['on'](_0x579e('0x2c'),this['syncMusicOnHoldStop'][_0x579e('0x1d')](this));try{logger[_0x579e('0x2d')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x579e('0x2e')]();}catch(_0x229007){logger[_0x579e('0x2f')](_0x579e('0x30'),util[_0x579e('0x31')](_0x229007,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x579e('0x32')][_0x579e('0x33')]=function(_0x33cfb7){return _0x33cfb7!==null&&!_['isUndefined'](_0x33cfb7);};VoiceCallReport[_0x579e('0x32')][_0x579e('0x34')]=function(_0x2da33b,_0x6b26d8,_0xf91d53){io['to'](_0x2da33b)[_0x579e('0x34')](_0x6b26d8,_0xf91d53);};VoiceCallReport[_0x579e('0x32')][_0x579e('0x35')]=function(_0x4e42c0){try{if(this[_0x579e('0x33')](_0x4e42c0)){logger['info'](_0x579e('0x36'),_0x4e42c0[_0x579e('0x37')],_0x4e42c0[_0x579e('0x38')],_0x4e42c0[_0x579e('0x39')]);logger[_0x579e('0x3a')](_0x579e('0x3b'),_0x4e42c0[_0x579e('0x37')],util['inspect'](_0x4e42c0,{'showHidden':![],'depth':null}));if(_0x4e42c0[_0x579e('0x37')]===_0x4e42c0[_0x579e('0x3c')]){if(!_['isUndefined'](this[_0x579e('0x3d')][_0x4e42c0[_0x579e('0x37')]])){_['merge'](this[_0x579e('0x3d')][_0x4e42c0[_0x579e('0x37')]],_[_0x579e('0x3e')](_0x4e42c0,_['keys'](this['channels'][_0x4e42c0[_0x579e('0x37')]])));}}}}catch(_0x555f01){logger[_0x579e('0x2f')](_0x579e('0x3f'),_0x4e42c0[_0x579e('0x37')],util[_0x579e('0x31')](_0x555f01,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x579e('0x32')]['syncNewChannel']=function(_0x9f9562){try{if(this[_0x579e('0x33')](_0x9f9562)){logger[_0x579e('0x3a')](_0x579e('0x40'),_0x9f9562[_0x579e('0x37')],util[_0x579e('0x31')](_0x9f9562,{'showHidden':![],'depth':null}));if(_0x9f9562[_0x579e('0x37')]===_0x9f9562[_0x579e('0x3c')]&&_0x9f9562[_0x579e('0x41')]!='OutgoingSpoolFailed'){if(_[_0x579e('0x42')](this[_0x579e('0x3d')][_0x9f9562[_0x579e('0x37')]])){logger[_0x579e('0x2d')](_0x579e('0x43'),_0x9f9562[_0x579e('0x37')],_0x9f9562[_0x579e('0x44')],_0x9f9562[_0x579e('0x45')]);this[_0x579e('0x3d')][_0x9f9562['uniqueid']]=new Channel();this[_0x579e('0x3d')][_0x9f9562[_0x579e('0x37')]]['starttime']=moment()[_0x579e('0x46')](_0x579e('0x47'));this['channels'][_0x9f9562[_0x579e('0x37')]][_0x579e('0x48')]=dispositions[_[_0x579e('0x49')](_0x9f9562[_0x579e('0x4a')])];_[_0x579e('0x4b')](this[_0x579e('0x3d')][_0x9f9562[_0x579e('0x37')]],_[_0x579e('0x3e')](_0x9f9562,_[_0x579e('0x4c')](this[_0x579e('0x3d')][_0x9f9562[_0x579e('0x37')]])));if(_0x9f9562[_0x579e('0x44')]===_0x579e('0x4d')){if(this['agents'][_0x9f9562[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]){this[_0x579e('0x1a')][_0x9f9562['channel'][_0x579e('0x4e')]('-')[0x0]]['destconnectedlinenum']=_0x9f9562[_0x579e('0x45')];logger[_0x579e('0x3a')](_0x579e('0x4f'),_0x9f9562[_0x579e('0x37')],util[_0x579e('0x31')]({'id':this['agents'][_0x9f9562[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]['id'],'destaccountcode':this[_0x579e('0x1a')][_0x9f9562[_0x579e('0x41')]['split']('-')[0x0]][_0x579e('0x50')],'destconnectedlinenum':_0x9f9562[_0x579e('0x45')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x579e('0x51'),this[_0x579e('0x1a')][_0x9f9562[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]][_0x579e('0x52')]),_0x579e('0x53'),{'id':this[_0x579e('0x1a')][_0x9f9562['channel'][_0x579e('0x4e')]('-')[0x0]]['id'],'destaccountcode':this[_0x579e('0x1a')][_0x9f9562[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]][_0x579e('0x50')],'destconnectedlinenum':_0x9f9562[_0x579e('0x45')]});}}}}}}catch(_0x833c3d){logger[_0x579e('0x2f')](_0x579e('0x54'),_0x9f9562[_0x579e('0x37')],util[_0x579e('0x31')](_0x833c3d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x579e('0x32')][_0x579e('0x1c')]=function(_0x1522e8){try{if(this['isNotNull'](_0x1522e8)){logger[_0x579e('0x3a')]('[%s][voiceCallReport][newexten]\x20event:',_0x1522e8[_0x579e('0x37')],util['inspect'](_0x1522e8,{'showHidden':![],'depth':null}));if(_0x1522e8[_0x579e('0x37')]===_0x1522e8[_0x579e('0x3c')]&&_0x1522e8[_0x579e('0x45')]!='h'&&_0x1522e8[_0x579e('0x41')]!=_0x579e('0x55')){_0x1522e8[_0x579e('0x56')]=_0x1522e8[_0x579e('0x56')][_0x579e('0x57')]();_0x1522e8[_0x579e('0x58')]=(_0x1522e8[_0x579e('0x59')]||_0x1522e8[_0x579e('0x58')])[_0x579e('0x57')]();logger[_0x579e('0x2d')](_0x579e('0x5a'),_0x1522e8[_0x579e('0x37')],_0x1522e8[_0x579e('0x56')],_0x1522e8[_0x579e('0x58')]);if(_[_0x579e('0x42')](this[_0x579e('0x3d')][_0x1522e8['uniqueid']])){this[_0x579e('0x3d')][_0x1522e8['uniqueid']]=new Channel();this[_0x579e('0x3d')][_0x1522e8[_0x579e('0x37')]][_0x579e('0x5b')]=_0x1522e8[_0x579e('0x5c')]?moment()[_0x579e('0x5d')](moment[_0x579e('0x5c')](_0x1522e8[_0x579e('0x5c')])[_0x579e('0x5e')](),_0x579e('0x5e'))[_0x579e('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x579e('0x46')](_0x579e('0x47'));this[_0x579e('0x3d')][_0x1522e8[_0x579e('0x37')]][_0x579e('0x48')]=_0x579e('0x12');}_[_0x579e('0x4b')](this[_0x579e('0x3d')][_0x1522e8[_0x579e('0x37')]],_[_0x579e('0x3e')](_0x1522e8,_['keys'](this[_0x579e('0x3d')][_0x1522e8[_0x579e('0x37')]])));if(_[_0x579e('0x5f')](applications,_0x1522e8['application'])){this[_0x579e('0x3d')][_0x1522e8[_0x579e('0x37')]][_0x579e('0x60')]=_0x1522e8['application'];this['channels'][_0x1522e8[_0x579e('0x37')]]['lastdata']=_0x1522e8[_0x579e('0x58')];if(_0x1522e8['application']==='set'&&_['startsWith'](_0x1522e8[_0x579e('0x58')],'cdr(')){var _0x2950ce=_0x1522e8[_0x579e('0x58')][_0x579e('0x4e')]('=');var _0x236b83=_0x2950ce[0x0][_0x579e('0x61')](/cdr\((.*)\)/);if(_0x236b83){this['channels'][_0x1522e8[_0x579e('0x37')]][_0x236b83[0x1]]=_0x2950ce[0x1];}}else if(_0x1522e8[_0x579e('0x56')]==='queue'){this[_0x579e('0x3d')][_0x1522e8[_0x579e('0x37')]][_0x579e('0xd')]=_0x1522e8[_0x579e('0x58')][_0x579e('0x4e')](',')[0x0];}}}}}catch(_0x22e73b){logger[_0x579e('0x2f')](_0x579e('0x62'),_0x1522e8[_0x579e('0x37')],util[_0x579e('0x31')](_0x22e73b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x579e('0x32')][_0x579e('0x22')]=function(_0x4fc389){try{if(this['isNotNull'](_0x4fc389)){logger[_0x579e('0x2d')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x4fc389[_0x579e('0x37')],_0x4fc389[_0x579e('0x3c')],_0x4fc389[_0x579e('0x38')],_0x4fc389[_0x579e('0x39')]);logger[_0x579e('0x3a')]('[%s][voiceCallReport][newstate]\x20event:',_0x4fc389[_0x579e('0x37')],util['inspect'](_0x4fc389,{'showHidden':![],'depth':null}));if(_0x4fc389['uniqueid']!==_0x4fc389[_0x579e('0x3c')]){if(this['channels'][_0x4fc389[_0x579e('0x3c')]]){if(_0x4fc389['channelstate']==='6'){if(!this['channels'][_0x4fc389['linkedid']][_0x579e('0x63')]){var _0x46d446=moment();this[_0x579e('0x3d')][_0x4fc389[_0x579e('0x3c')]][_0x579e('0x63')]=!![];this['channels'][_0x4fc389['linkedid']][_0x579e('0x64')]=_0x46d446[_0x579e('0x46')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x579e('0x3d')][_0x4fc389['linkedid']][_0x579e('0x5b')]){this[_0x579e('0x3d')][_0x4fc389[_0x579e('0x3c')]][_0x579e('0x65')]=_0x46d446[_0x579e('0x66')](this['channels'][_0x4fc389[_0x579e('0x3c')]][_0x579e('0x5b')],_0x579e('0x5e'));}}this[_0x579e('0x3d')][_0x4fc389[_0x579e('0x3c')]][_0x579e('0x3c')]=_0x4fc389[_0x579e('0x37')];if(_0x4fc389['calleridnum']!=='xcally-motion-preview'){this[_0x579e('0x3d')][_0x4fc389[_0x579e('0x3c')]][_0x579e('0x67')]=_0x4fc389[_0x579e('0x39')];}this[_0x579e('0x3d')][_0x4fc389[_0x579e('0x3c')]]['connectedlinename']=_0x4fc389[_0x579e('0x38')];this[_0x579e('0x3d')][_0x4fc389[_0x579e('0x3c')]][_0x579e('0x68')]=_0x4fc389['channel'];this['channels'][_0x4fc389[_0x579e('0x3c')]][_0x579e('0x48')]=dispositions[_[_0x579e('0x49')](_0x4fc389[_0x579e('0x4a')])];if(this[_0x579e('0x1a')][_0x4fc389['channel']['split']('-')[0x0]]){this[_0x579e('0x3d')][_0x4fc389[_0x579e('0x3c')]][_0x579e('0x69')]=this[_0x579e('0x1a')][_0x4fc389[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]['id'];this[_0x579e('0x3d')][_0x4fc389['linkedid']]['membername']=this[_0x579e('0x1a')][_0x4fc389[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]][_0x579e('0x52')];}}}}else{if(this['channels'][_0x4fc389[_0x579e('0x37')]]){if(_0x4fc389[_0x579e('0x4a')]==='6'){if(this[_0x579e('0x1a')][_0x4fc389[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]){this[_0x579e('0x3d')][_0x4fc389['uniqueid']][_0x579e('0x69')]=this[_0x579e('0x1a')][_0x4fc389['channel'][_0x579e('0x4e')]('-')[0x0]]['id'];this['channels'][_0x4fc389[_0x579e('0x37')]][_0x579e('0x6a')]=this[_0x579e('0x1a')][_0x4fc389[_0x579e('0x41')]['split']('-')[0x0]][_0x579e('0x52')];}}}}}}catch(_0x24ab79){logger[_0x579e('0x2f')](_0x579e('0x6b'),_0x4fc389[_0x579e('0x37')],util['inspect'](_0x24ab79,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x3cf810,_0x1802cc){try{if(this['channels'][_0x3cf810]){logger[_0x579e('0x2d')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x3cf810,_0x1802cc);this[_0x579e('0x3d')][_0x3cf810][_0x579e('0x6c')]=!![];if(_[_0x579e('0x6d')](_0x1802cc,_0x579e('0x6e'))){_0x1802cc=_0x1802cc[_0x579e('0x6f')](_0x579e('0x6e'),_0x579e('0x70'));}this[_0x579e('0x3d')][_0x3cf810]['monitorFilename']=_0x1802cc;var _0x2893e1=_[_0x579e('0x71')](this['channels'][_0x3cf810][_0x579e('0x72')],{'filename':_0x1802cc});if(_[_0x579e('0x73')](_0x2893e1)){this[_0x579e('0x3d')][_0x3cf810][_0x579e('0x72')][_0x579e('0x74')]({'filename':_0x1802cc,'createdAt':moment()[_0x579e('0x46')](_0x579e('0x47')),'mixmonitorid':'','status':'rec'});}}}catch(_0x2c6e60){logger[_0x579e('0x2f')](_0x579e('0x75'),_0x3cf810,util[_0x579e('0x31')](_0x2c6e60,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x579e('0x32')]['syncVarSet']=function(_0x71a277){try{if(this['isNotNull'](_0x71a277)){logger[_0x579e('0x3a')](_0x579e('0x76'),_0x71a277[_0x579e('0x37')],util[_0x579e('0x31')](_0x71a277,{'showHidden':![],'depth':null}));if(this[_0x579e('0x3d')][_0x71a277[_0x579e('0x37')]]&&_0x71a277[_0x579e('0x41')]!='OutgoingSpoolFailed'){if(this[_0x579e('0x33')](_0x71a277['variable'])){if(this['isNotNull'](_0x71a277[_0x579e('0x77')]['mixmonitor_filename'])){logger[_0x579e('0x2d')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x71a277[_0x579e('0x37')],_0x71a277[_0x579e('0x78')]);this['syncMixMonitorFilename'](_0x71a277['uniqueid'],_0x71a277['value']);}else if(this[_0x579e('0x33')](_0x71a277[_0x579e('0x77')]['xmd-phone'])){logger['info'](_0x579e('0x79'),_0x71a277[_0x579e('0x37')],_0x71a277['value']);this[_0x579e('0x3d')][_0x71a277['uniqueid']][_0x579e('0x39')]=_0x71a277[_0x579e('0x78')];}else if(this[_0x579e('0x33')](_0x71a277['variable'][_0x579e('0x7a')])){logger[_0x579e('0x2d')](_0x579e('0x7b'),_0x71a277[_0x579e('0x37')],_0x71a277[_0x579e('0x78')]);this[_0x579e('0x3d')][_0x71a277[_0x579e('0x37')]][_0x579e('0x7c')]=_0x71a277[_0x579e('0x78')];}else if(this[_0x579e('0x33')](_0x71a277['variable'][_0x579e('0x7d')])){logger['info'](_0x579e('0x7e'),_0x71a277['uniqueid'],_0x71a277[_0x579e('0x78')]);this[_0x579e('0x3d')][_0x71a277[_0x579e('0x37')]]['type']=_0x71a277[_0x579e('0x78')];}else if(this[_0x579e('0x33')](_0x71a277[_0x579e('0x77')]['xmd-queue'])){logger[_0x579e('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x71a277[_0x579e('0x37')],_0x71a277[_0x579e('0x78')]['split'](',')[0x0]);this['channels'][_0x71a277[_0x579e('0x37')]][_0x579e('0xd')]=_0x71a277[_0x579e('0x78')][_0x579e('0x4e')](',')[0x0];}else if(this[_0x579e('0x33')](_0x71a277[_0x579e('0x77')][_0x579e('0x7f')])){logger[_0x579e('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x71a277['uniqueid'],_0x71a277[_0x579e('0x78')]);this[_0x579e('0x3d')][_0x71a277[_0x579e('0x37')]]['originatecalleridnum']=_0x71a277[_0x579e('0x78')];}else if(this[_0x579e('0x33')](_0x71a277[_0x579e('0x77')][_0x579e('0x80')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x71a277[_0x579e('0x37')],_0x71a277[_0x579e('0x78')]);this[_0x579e('0x3d')][_0x71a277[_0x579e('0x37')]]['destination']=_0x71a277[_0x579e('0x78')];}else if(this[_0x579e('0x33')](_0x71a277[_0x579e('0x77')]['xmd-callerid-preview'])){logger[_0x579e('0x2d')](_0x579e('0x81'),_0x71a277['uniqueid'],_0x71a277['value']);this[_0x579e('0x3d')][_0x71a277[_0x579e('0x37')]][_0x579e('0x82')]=_0x71a277['value'];}else if(this['isNotNull'](_0x71a277['variable']['xmcs-queue'])){logger['info'](_0x579e('0x83'),_0x71a277['uniqueid'],_0x71a277[_0x579e('0x78')]);this[_0x579e('0x3d')][_0x71a277['uniqueid']][_0x579e('0xd')]=_0x71a277[_0x579e('0x78')];}else if(this[_0x579e('0x33')](_0x71a277[_0x579e('0x77')]['sipcallid'])){logger[_0x579e('0x2d')](_0x579e('0x84'),_0x71a277[_0x579e('0x37')],_0x71a277[_0x579e('0x78')]);this['channels'][_0x71a277[_0x579e('0x37')]][_0x579e('0x85')]=_0x71a277[_0x579e('0x78')];}}}else if(this['isNotNull'](_0x71a277[_0x579e('0x77')][_0x579e('0x86')])){if(_0x71a277[_0x579e('0x78')]){var _0xb70f38=path['parse'](_0x71a277[_0x579e('0x78')])[_0x579e('0x52')];logger[_0x579e('0x2d')](_0x579e('0x87'),_0xb70f38,_0x71a277[_0x579e('0x78')]);this['syncMixMonitorFilename'](_0xb70f38,_0x71a277[_0x579e('0x78')]);}}else if(this['channels'][_0x71a277[_0x579e('0x3c')]]){if(this[_0x579e('0x33')](_0x71a277['variable'])){if(this[_0x579e('0x33')](_0x71a277[_0x579e('0x77')][_0x579e('0x88')])){logger[_0x579e('0x2d')](_0x579e('0x84'),_0x71a277[_0x579e('0x3c')],_0x71a277['value']);this[_0x579e('0x3d')][_0x71a277[_0x579e('0x3c')]][_0x579e('0x89')]=_0x71a277[_0x579e('0x78')];}}}}}catch(_0x24fe5d){logger[_0x579e('0x2f')]('[%s][voiceCallReport][varset]',_0x71a277[_0x579e('0x37')],util['inspect'](_0x24fe5d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x579e('0x32')][_0x579e('0x25')]=function(_0x51906e){try{if(this[_0x579e('0x33')](_0x51906e)){logger['debug'](_0x579e('0x8a'),_0x51906e[_0x579e('0x37')],util[_0x579e('0x31')](_0x51906e,{'showHidden':![],'depth':null}));if(this[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]]){logger[_0x579e('0x2d')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x51906e['uniqueid'],_0x51906e[_0x579e('0x8b')]);var _0x3fa526=moment();this['channels'][_0x51906e[_0x579e('0x37')]][_0x579e('0x8c')]=_0x3fa526['format'](_0x579e('0x47'));this[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]][_0x579e('0x5c')]=_0x3fa526['diff'](this['channels'][_0x51906e[_0x579e('0x37')]][_0x579e('0x5b')],_0x579e('0x5e'));if(this[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]][_0x579e('0x63')]){this[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]][_0x579e('0x8d')]=_0x3fa526[_0x579e('0x66')](this['channels'][_0x51906e[_0x579e('0x37')]][_0x579e('0x64')],_0x579e('0x5e'));this['channels'][_0x51906e['uniqueid']][_0x579e('0x65')]=this[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]][_0x579e('0x5c')]-this[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]][_0x579e('0x8d')];}if(_0x51906e[_0x579e('0x44')]==='from-sip'){if(this['agents'][_0x51906e[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]){this[_0x579e('0x1a')][_0x51906e[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]=_['omit'](this[_0x579e('0x1a')][_0x51906e['channel'][_0x579e('0x4e')]('-')[0x0]],[_0x579e('0x8e')]);logger[_0x579e('0x3a')](_0x579e('0x8f'),_0x51906e['uniqueid'],util[_0x579e('0x31')]({'id':this[_0x579e('0x1a')][_0x51906e[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]['id'],'destaccountcode':this[_0x579e('0x1a')][_0x51906e[_0x579e('0x41')]['split']('-')[0x0]][_0x579e('0x50')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x579e('0x46')](_0x579e('0x51'),this[_0x579e('0x1a')][_0x51906e[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]['name']),_0x579e('0x90'),{'id':this[_0x579e('0x1a')][_0x51906e[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]['id'],'destaccountcode':this[_0x579e('0x1a')][_0x51906e[_0x579e('0x41')][_0x579e('0x4e')]('-')[0x0]]['accountcode']});}}var _0x556902=this;Promise[_0x579e('0x91')]()[_0x579e('0x92')](function(){var _0x4cc3ae=_0x556902[_0x579e('0x3d')][_0x51906e['uniqueid']];if(typeof _0x4cc3ae[_0x579e('0x93')]===_0x579e('0x94'))return;if(_[_0x579e('0x95')](_0x4cc3ae[_0x579e('0x72')]))return;return RpcSetting[_0x579e('0x96')]()[_0x579e('0x92')](function(_0x26fd05){if(!_0x26fd05[_0x579e('0x97')])return;return Promise[_0x579e('0x91')]()[_0x579e('0x92')](function(){return ami[_0x579e('0x98')]({'action':'StopMixMonitor','channel':_0x4cc3ae[_0x579e('0x41')]})['catch'](function(){});})['then'](function(){return ami[_0x579e('0x98')]({'action':'StopMixMonitor','channel':_0x4cc3ae['destinationchannel']})[_0x579e('0x99')](function(){})['finally'](function(){var _0x44241e=_0x556902[_0x579e('0x1a')][_0x4cc3ae[_0x579e('0x68')]['split']('-')[0x0]];if(!_0x44241e)return;io['emit']('webbar:stopmonitors',{'agentId':_0x44241e['id'],'uniqueid':_0x4cc3ae[_0x579e('0x37')]});});});});})[_0x579e('0x92')](function(){if(_0x51906e['event']===_0x579e('0x9a')){_0x556902[_0x579e('0x9b')][_0x51906e[_0x579e('0x37')]]=_0x556902[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]];}else{if(_0x556902[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]][_0x579e('0x9c')]==='outbound'&&_0x556902[_0x579e('0x9b')][_0x51906e['uniqueid']]){_0x556902[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]]['uniqueid']=[_0x556902['channels'][_0x51906e['uniqueid']][_0x579e('0x3c')],_0x556902[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]][_0x579e('0x3c')]=_0x556902[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]][_0x579e('0x37')]][0x0];delete _0x556902['blindTransfers'][_0x51906e['uniqueid']];}}logger['debug'](_0x579e('0x9d'),_0x51906e[_0x579e('0x37')],util[_0x579e('0x31')](_0x556902[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]],{'showHidden':![],'depth':null}));ami[_0x579e('0x34')](_0x579e('0x9e'),_0x556902[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]]);delete _0x556902[_0x579e('0x3d')][_0x51906e[_0x579e('0x37')]];});}}}catch(_0x19be62){logger['error'](_0x579e('0x9f'),_0x51906e['uniqueid'],util[_0x579e('0x31')](_0x19be62,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x579e('0x32')][_0x579e('0x28')]=function(_0x2d9fa0){try{if(this[_0x579e('0x33')](_0x2d9fa0)){logger[_0x579e('0x2d')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x2d9fa0['uniqueid'],_0x2d9fa0[_0x579e('0xa0')],_0x2d9fa0[_0x579e('0xa1')]);logger[_0x579e('0x3a')](_0x579e('0xa2'),_0x2d9fa0[_0x579e('0x37')],util[_0x579e('0x31')](_0x2d9fa0,{'showHidden':![],'depth':null}));if(this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa3')]]){this[_0x579e('0x3d')][_0x2d9fa0['transfereeuniqueid']]['transfercalleridnum']=_0x2d9fa0['origtransferercalleridnum'];this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa3')]][_0x579e('0xa4')]=_0x2d9fa0[_0x579e('0xa1')];if(this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa5')]]){var _0x3835ae=this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa5')]];this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa5')]]=this[_0x579e('0x3d')][_0x2d9fa0['transfereeuniqueid']];this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa3')]]=_0x3835ae;}}else if(this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa6')]]){this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa6')]]['transfercalleridnum']=_0x2d9fa0[_0x579e('0xa0')];this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa6')]]['transferconnectedlinenum']=_0x2d9fa0[_0x579e('0xa1')];if(this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa7')]]){var _0x3835ae=this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa7')]];this[_0x579e('0x3d')][_0x2d9fa0['origtransfereruniqueid']]=this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa6')]];this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa6')]]=_0x3835ae;}}if((this[_0x579e('0x3d')][_0x2d9fa0['origtransfereruniqueid']]||this[_0x579e('0x3d')][_0x2d9fa0['origtransfererlinkedid']])&&this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa5')]]){var _0x3d1a0e=_[_0x579e('0xa8')]([this[_0x579e('0x3d')][_0x2d9fa0['origtransfereruniqueid']],this['channels'][_0x2d9fa0[_0x579e('0xa9')]],this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa5')]]],function(_0x5b8eda){return _0x5b8eda&&_0x5b8eda[_0x579e('0x9c')]===_0x579e('0xaa')&&_0x5b8eda[_0x579e('0xab')];});if(_0x3d1a0e){if(this[_0x579e('0x3d')][_0x2d9fa0['origtransfereruniqueid']])this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa7')]]['transferType']=_0x579e('0xac');if(this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa9')]])this[_0x579e('0x3d')][_0x2d9fa0[_0x579e('0xa9')]]['transferType']=_0x579e('0xac');this['channels'][_0x2d9fa0[_0x579e('0xa5')]][_0x579e('0x93')]=_0x579e('0xac');}}}}catch(_0x27449b){logger[_0x579e('0x2f')](_0x579e('0xad'),_0x2d9fa0[_0x579e('0x37')],util[_0x579e('0x31')](_0x27449b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x579e('0x32')][_0x579e('0x29')]=function(_0x3c0ecf){try{if(this[_0x579e('0x33')](_0x3c0ecf)){logger[_0x579e('0x2d')](_0x579e('0xae'),_0x3c0ecf['uniqueid'],_0x3c0ecf[_0x579e('0xaf')],_0x3c0ecf['extension']);logger[_0x579e('0x3a')](_0x579e('0xb0'),_0x3c0ecf[_0x579e('0x37')],util[_0x579e('0x31')](_0x3c0ecf,{'showHidden':![],'depth':null}));if(this[_0x579e('0x3d')][_0x3c0ecf[_0x579e('0xa3')]]){this[_0x579e('0x3d')][_0x3c0ecf['transfereeuniqueid']][_0x579e('0xb1')]=_0x3c0ecf[_0x579e('0xaf')];this[_0x579e('0x3d')][_0x3c0ecf[_0x579e('0xa3')]]['transferconnectedlinenum']=_0x3c0ecf[_0x579e('0xb2')];this[_0x579e('0x3d')][_0x3c0ecf[_0x579e('0xa3')]][_0x579e('0x93')]=_0x579e('0xb3');this['syncHangup']({'event':_0x579e('0x9a'),'uniqueid':_0x3c0ecf[_0x579e('0xa3')],'context':_0x3c0ecf[_0x579e('0x44')],'channel':_0x3c0ecf[_0x579e('0xb4')]});}else{this['channels'][_0x3c0ecf['transfereruniqueid']][_0x579e('0x93')]=_0x579e('0xb3');}}}catch(_0x40a40a){logger[_0x579e('0x2f')]('[%s][voiceCallReport][blindtransfer]',_0x3c0ecf[_0x579e('0x37')],util[_0x579e('0x31')](_0x40a40a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x579e('0x2b')]=function(_0x3c945a){try{if(this[_0x579e('0x33')](_0x3c945a)){logger[_0x579e('0x3a')](_0x579e('0xb5'),_0x3c945a[_0x579e('0x37')],util[_0x579e('0x31')](_0x3c945a,{'showHidden':![],'depth':null}));if(this[_0x579e('0x3d')][_0x3c945a[_0x579e('0x37')]]){if(!_[_0x579e('0x73')](this['channels'][_0x3c945a[_0x579e('0x37')]][_0x579e('0x64')])){this[_0x579e('0x3d')][_0x3c945a[_0x579e('0x37')]][_0x579e('0xb6')]=moment()['format'](_0x579e('0x47'));logger[_0x579e('0x2d')](_0x579e('0xb7'),_0x3c945a['uniqueid'],this[_0x579e('0x3d')][_0x3c945a[_0x579e('0x37')]][_0x579e('0xb6')]);}}}}catch(_0x54d429){logger['error'](_0x579e('0xb8'),_0x3c945a['uniqueid'],util[_0x579e('0x31')](_0x54d429,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x579e('0xb9')]=function(_0x50f5fb){try{if(this[_0x579e('0x33')](_0x50f5fb)){logger['debug'](_0x579e('0xba'),_0x50f5fb[_0x579e('0x37')],util['inspect'](_0x50f5fb,{'showHidden':![],'depth':null}));if(this[_0x579e('0x3d')][_0x50f5fb[_0x579e('0x37')]]){if(!_[_0x579e('0x73')](this[_0x579e('0x3d')][_0x50f5fb[_0x579e('0x37')]][_0x579e('0xb6')])){this[_0x579e('0x3d')][_0x50f5fb[_0x579e('0x37')]]['mohtime']+=moment()['milliseconds'](0x0)[_0x579e('0x66')](this['channels'][_0x50f5fb['uniqueid']][_0x579e('0xb6')],_0x579e('0x5e'));logger[_0x579e('0x2d')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x50f5fb[_0x579e('0x37')],this[_0x579e('0x3d')][_0x50f5fb[_0x579e('0x37')]][_0x579e('0xbb')]);delete this['channels'][_0x50f5fb[_0x579e('0x37')]][_0x579e('0xb6')];}}}}catch(_0x33f58e){logger[_0x579e('0x2f')](_0x579e('0xbc'),_0x50f5fb[_0x579e('0x37')],util[_0x579e('0x31')](_0x33f58e,{'showHidden':![],'depth':null}));}};module[_0x579e('0xbd')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 1b79388..6da403d 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbc7=['custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','seconds','lastevent','complete','outbound','holdtime','starttime','diff','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','error','[%s][voiceDialReport][hangup]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','channels','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','substring','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0xdbc7,0x1da));var _0x7dbc=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0xdbc7[_0x3f578f];return _0x32c754;};'use strict';var _=require('lodash');var moment=require(_0x7dbc('0x0'));var util=require(_0x7dbc('0x1'));var Redis=require(_0x7dbc('0x2'));var config=require(_0x7dbc('0x3'));var logger=require(_0x7dbc('0x4'))('ami');var ami=require(_0x7dbc('0x5'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x100c47){this[_0x7dbc('0x6')]=_0x100c47['outboundChannels'];this['outbound']=_0x100c47['outbound'];this[_0x7dbc('0x7')]={};ami['on'](_0x7dbc('0x8'),this[_0x7dbc('0x9')][_0x7dbc('0xa')](this));ami['on'](_0x7dbc('0xb'),this[_0x7dbc('0xc')][_0x7dbc('0xa')](this));ami['on'](_0x7dbc('0xd'),this[_0x7dbc('0xe')][_0x7dbc('0xa')](this));ami['on'](_0x7dbc('0xf'),this[_0x7dbc('0x10')][_0x7dbc('0xa')](this));}VoiceDialReport[_0x7dbc('0x11')][_0x7dbc('0x12')]=function(_0x349bff){return _0x349bff!==null&&!_[_0x7dbc('0x13')](_0x349bff);};VoiceDialReport[_0x7dbc('0x11')][_0x7dbc('0x14')]=function(_0x5bf7f3,_0xd74b44,_0x3d9705){io['to'](_0x5bf7f3)[_0x7dbc('0x14')](_0xd74b44,_0x3d9705);};VoiceDialReport[_0x7dbc('0x11')][_0x7dbc('0x9')]=function(_0x3b811e){try{if(this[_0x7dbc('0x12')](_0x3b811e)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x3b811e[_0x7dbc('0x15')],util[_0x7dbc('0x16')](_0x3b811e,{'showHidden':![],'depth':null}));if(this[_0x7dbc('0x6')][_0x3b811e[_0x7dbc('0x15')]]){_[_0x7dbc('0x17')](this['channels'][_0x3b811e[_0x7dbc('0x15')]],{'starttime':moment()[_0x7dbc('0x18')](_0x7dbc('0x19')),'lastevent':_0x7dbc('0x1a'),'interface':_0x3b811e['channel']['substring'](0x0,_0x3b811e[_0x7dbc('0x1b')][_0x7dbc('0x1c')]('-')),'membername':_0x3b811e['channel']['substring'](_0x3b811e['channel'][_0x7dbc('0x1c')]('/')+0x1,_0x3b811e[_0x7dbc('0x1b')][_0x7dbc('0x1c')]('-'))},_[_0x7dbc('0x1d')](_0x3b811e,[_0x7dbc('0x1e'),_0x7dbc('0x1f')]));logger[_0x7dbc('0x20')](_0x7dbc('0x21'),_0x3b811e['uniqueid'],this[_0x7dbc('0x6')][_0x3b811e[_0x7dbc('0x15')]][_0x7dbc('0x22')],this[_0x7dbc('0x6')][_0x3b811e['uniqueid']][_0x7dbc('0x23')]);logger[_0x7dbc('0x24')](_0x7dbc('0x25'),_0x3b811e['uniqueid'],util[_0x7dbc('0x16')](this[_0x7dbc('0x6')][_0x3b811e[_0x7dbc('0x15')]],{'showHidden':![],'depth':null}));this[_0x7dbc('0x14')](_0x7dbc('0x26'),_0x7dbc('0x27'),this[_0x7dbc('0x6')][_0x3b811e[_0x7dbc('0x15')]]);logger[_0x7dbc('0x24')](_0x7dbc('0x28'),_0x3b811e[_0x7dbc('0x15')],util['inspect'](this[_0x7dbc('0x6')][_0x3b811e[_0x7dbc('0x15')]],{'showHidden':![],'depth':null}));ami[_0x7dbc('0x14')](_0x7dbc('0x29'),this[_0x7dbc('0x6')][_0x3b811e[_0x7dbc('0x15')]]);}}}catch(_0x288f37){logger['error']('[%s][voiceDialReport][dialbegin]',_0x3b811e['uniqueid'],util[_0x7dbc('0x16')](_0x288f37,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7dbc('0x11')][_0x7dbc('0xc')]=function(_0x7a8eab){try{if(this[_0x7dbc('0x12')](_0x7a8eab)){logger[_0x7dbc('0x24')](_0x7dbc('0x2a'),_0x7a8eab[_0x7dbc('0x15')],util['inspect'](_0x7a8eab,{'showHidden':![],'depth':null}));if(this[_0x7dbc('0x6')][_0x7a8eab['uniqueid']]){this[_0x7dbc('0x6')][_0x7a8eab[_0x7dbc('0x15')]][_0x7dbc('0x2b')]=_0x7a8eab[_0x7dbc('0x2b')];if(_0x7a8eab[_0x7dbc('0x2b')]===_0x7dbc('0x2c')){this[_0x7dbc('0x6')][_0x7a8eab[_0x7dbc('0x15')]][_0x7dbc('0x2d')]=_0x7a8eab['connectedlinenum'];this[_0x7dbc('0x6')][_0x7a8eab['uniqueid']][_0x7dbc('0x2e')]=_0x7a8eab[_0x7dbc('0x2e')];this[_0x7dbc('0x6')][_0x7a8eab[_0x7dbc('0x15')]][_0x7dbc('0x2f')]=moment()[_0x7dbc('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7dbc('0x6')][_0x7a8eab[_0x7dbc('0x15')]]['lastevent']='connect';logger['info'](_0x7dbc('0x30'),_0x7a8eab[_0x7dbc('0x15')],_0x7a8eab[_0x7dbc('0x1b')][_0x7dbc('0x31')](_0x7a8eab[_0x7dbc('0x1b')][_0x7dbc('0x1c')]('/')+0x1,_0x7a8eab['channel']['lastIndexOf']('-')));logger[_0x7dbc('0x24')](_0x7dbc('0x32'),_0x7a8eab['uniqueid'],util[_0x7dbc('0x16')](this[_0x7dbc('0x6')][_0x7a8eab[_0x7dbc('0x15')]],{'showHidden':![],'depth':null}));ami[_0x7dbc('0x14')](_0x7dbc('0x33'),this[_0x7dbc('0x6')][_0x7a8eab['uniqueid']]);}logger[_0x7dbc('0x24')](_0x7dbc('0x34'),_0x7a8eab[_0x7dbc('0x15')],util['inspect'](this['channels'][_0x7a8eab['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x7dbc('0x6')][_0x7a8eab[_0x7dbc('0x15')]]);}}}catch(_0x299176){logger['error'](_0x7dbc('0x35'),_0x7a8eab['uniqueid'],util['inspect'](_0x299176,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7dbc('0x11')][_0x7dbc('0xe')]=function(_0x3ec0c7){try{if(this[_0x7dbc('0x12')](_0x3ec0c7)){logger['debug'](_0x7dbc('0x36'),_0x3ec0c7[_0x7dbc('0x15')],util[_0x7dbc('0x16')](_0x3ec0c7,{'showHidden':![],'depth':null}));this[_0x7dbc('0x37')](_0x3ec0c7[_0x7dbc('0x15')],_[_0x7dbc('0x38')](_0x3ec0c7['variable'])[0x0],_0x3ec0c7[_0x7dbc('0x39')]);if(this[_0x7dbc('0x12')](_0x3ec0c7['variable'])&&this[_0x7dbc('0x12')](_0x3ec0c7['variable'][_0x7dbc('0x3a')])){if(_[_0x7dbc('0x13')](this['channels'][_0x3ec0c7[_0x7dbc('0x15')]])){this[_0x7dbc('0x6')][_0x3ec0c7[_0x7dbc('0x15')]]={'routeId':_0x3ec0c7[_0x7dbc('0x39')],'variables':this['variables'][_0x3ec0c7[_0x7dbc('0x15')]]};logger[_0x7dbc('0x20')](_0x7dbc('0x3b'),_0x3ec0c7[_0x7dbc('0x15')],_0x3ec0c7[_0x7dbc('0x3c')][_0x7dbc('0x3a')],_[_0x7dbc('0x38')](_0x3ec0c7[_0x7dbc('0x3c')])[0x0],_0x3ec0c7[_0x7dbc('0x39')]);logger[_0x7dbc('0x24')](_0x7dbc('0x3d'),_0x3ec0c7[_0x7dbc('0x15')],util[_0x7dbc('0x16')](this[_0x7dbc('0x6')][_0x3ec0c7['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7dbc('0x14')](_0x7dbc('0x26'),_0x7dbc('0x27'),this['channels'][_0x3ec0c7[_0x7dbc('0x15')]]);}}}}catch(_0x577045){logger['error']('[%s][voiceDialReport][varset]',_0x3ec0c7[_0x7dbc('0x15')],util[_0x7dbc('0x16')](_0x577045,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7dbc('0x11')][_0x7dbc('0x37')]=function(_0x29c925,_0x57dcdd,_0x2189b7){var _0x17da37=['rtpaudioqos',_0x7dbc('0x3e'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x7dbc('0x3f'),'rtpaudioqoslossbridged',_0x7dbc('0x40'),_0x7dbc('0x41'),_0x7dbc('0x42'),_0x7dbc('0x43'),_0x7dbc('0x44'),_0x7dbc('0x45'),_0x7dbc('0x46'),_0x7dbc('0x47'),_0x7dbc('0x48'),_0x7dbc('0x49'),_0x7dbc('0x22'),_0x7dbc('0x4a'),_0x7dbc('0x4b')];if(!_[_0x7dbc('0x4c')](_0x57dcdd)&&!_['includes'](_0x17da37,_0x57dcdd)){if(_[_0x7dbc('0x13')](this[_0x7dbc('0x7')][_0x29c925])){this[_0x7dbc('0x7')][_0x29c925]={};}this[_0x7dbc('0x7')][_0x29c925][_0x57dcdd]=_0x2189b7;}};VoiceDialReport[_0x7dbc('0x11')][_0x7dbc('0x10')]=function(_0x53e9d5){try{if(this[_0x7dbc('0x12')](_0x53e9d5)){logger['debug'](_0x7dbc('0x4d'),_0x53e9d5[_0x7dbc('0x15')],util[_0x7dbc('0x16')](_0x53e9d5,{'showHidden':![],'depth':null}));if(this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]]){logger[_0x7dbc('0x20')](_0x7dbc('0x4e'),_0x53e9d5[_0x7dbc('0x15')],_0x53e9d5['cause-txt']);this['channels'][_0x53e9d5[_0x7dbc('0x15')]][_0x7dbc('0x4f')]=moment()[_0x7dbc('0x18')](_0x7dbc('0x19'));this['channels'][_0x53e9d5['uniqueid']][_0x7dbc('0x50')]=moment(this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]]['endtime'])['diff'](this['channels'][_0x53e9d5[_0x7dbc('0x15')]]['starttime'],_0x7dbc('0x51'));this['channels'][_0x53e9d5[_0x7dbc('0x15')]][_0x7dbc('0x52')]=_0x7dbc('0x53');this[_0x7dbc('0x54')]['total']+=0x1;if(this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]][_0x7dbc('0x2f')]){this['outbound']['answered']+=0x1;this[_0x7dbc('0x6')][_0x53e9d5['uniqueid']][_0x7dbc('0x55')]=moment(this['channels'][_0x53e9d5[_0x7dbc('0x15')]][_0x7dbc('0x2f')])['diff'](this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]][_0x7dbc('0x56')],_0x7dbc('0x51'));this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]]['billableseconds']=moment(this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]][_0x7dbc('0x4f')])[_0x7dbc('0x57')](this[_0x7dbc('0x6')][_0x53e9d5['uniqueid']][_0x7dbc('0x2f')],_0x7dbc('0x51'));this[_0x7dbc('0x54')][_0x7dbc('0x58')]+=this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]]['holdtime']||0x0;this[_0x7dbc('0x54')][_0x7dbc('0x59')]+=this[_0x7dbc('0x6')][_0x53e9d5['uniqueid']][_0x7dbc('0x5a')];}this[_0x7dbc('0x54')][_0x7dbc('0x5b')]+=this['channels'][_0x53e9d5[_0x7dbc('0x15')]][_0x7dbc('0x50')];logger[_0x7dbc('0x24')](_0x7dbc('0x5c'),_0x53e9d5['uniqueid'],util[_0x7dbc('0x16')](this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]],{'showHidden':![],'depth':null}));ami[_0x7dbc('0x14')]('custom:voiceDialReport',this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]]);logger[_0x7dbc('0x24')](_0x7dbc('0x5d'),_0x53e9d5['uniqueid'],util['inspect'](this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]],{'showHidden':![],'depth':null}));ami['emit'](_0x7dbc('0x5e'),this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]]);logger[_0x7dbc('0x24')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x53e9d5[_0x7dbc('0x15')],util[_0x7dbc('0x16')](this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]],{'showHidden':![],'depth':null}));this[_0x7dbc('0x14')](_0x7dbc('0x26'),_0x7dbc('0x5f'),this[_0x7dbc('0x54')]);logger[_0x7dbc('0x20')](_0x7dbc('0x60'),JSON[_0x7dbc('0x61')](this['channels'][_0x53e9d5['uniqueid']]));logger['debug'](_0x7dbc('0x62'),_0x53e9d5[_0x7dbc('0x15')],util[_0x7dbc('0x16')](this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]],{'showHidden':![],'depth':null}));this[_0x7dbc('0x14')](_0x7dbc('0x26'),_0x7dbc('0x63'),this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x15')]]);delete this['channels'][_0x53e9d5[_0x7dbc('0x15')]];}else if(this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x64')]]){this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x64')]][_0x7dbc('0x15')]=this[_0x7dbc('0x6')][_0x53e9d5[_0x7dbc('0x64')]][_0x7dbc('0x65')];}if(this[_0x7dbc('0x7')][_0x53e9d5[_0x7dbc('0x15')]]){delete this[_0x7dbc('0x7')][_0x53e9d5[_0x7dbc('0x15')]];}}}catch(_0x29077e){logger[_0x7dbc('0x66')](_0x7dbc('0x67'),_0x53e9d5[_0x7dbc('0x15')],util[_0x7dbc('0x16')](_0x29077e,{'showHidden':![],'depth':null}));}};module[_0x7dbc('0x68')]=VoiceDialReport; \ No newline at end of file +var _0x44ee=['[%s][voiceDialReport][hangup]','exports','lodash','moment','util','ioredis','../ami','defaults','redis','localhost','variables','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','inspect','channels','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','privilege','interface','debug','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','info','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','addVariable','value','variable','outboundrouteid','isUndefined','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','starttime','seconds','complete','outbound','total','answered','holdtime','diff','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid'];(function(_0x342841,_0x22eb36){var _0x2efe99=function(_0x4c97de){while(--_0x4c97de){_0x342841['push'](_0x342841['shift']());}};_0x2efe99(++_0x22eb36);}(_0x44ee,0x66));var _0xe44e=function(_0x3bf3c9,_0x3a69fc){_0x3bf3c9=_0x3bf3c9-0x0;var _0x59fcec=_0x44ee[_0x3bf3c9];return _0x59fcec;};'use strict';var _=require(_0xe44e('0x0'));var moment=require(_0xe44e('0x1'));var util=require(_0xe44e('0x2'));var Redis=require(_0xe44e('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0xe44e('0x4'));config['redis']=_[_0xe44e('0x5')](config[_0xe44e('0x6')],{'host':_0xe44e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x4948c1){this['channels']=_0x4948c1['outboundChannels'];this['outbound']=_0x4948c1['outbound'];this[_0xe44e('0x8')]={};ami['on'](_0xe44e('0x9'),this[_0xe44e('0xa')][_0xe44e('0xb')](this));ami['on'](_0xe44e('0xc'),this['syncDialEnd']['bind'](this));ami['on'](_0xe44e('0xd'),this[_0xe44e('0xe')][_0xe44e('0xb')](this));ami['on'](_0xe44e('0xf'),this[_0xe44e('0x10')][_0xe44e('0xb')](this));}VoiceDialReport[_0xe44e('0x11')][_0xe44e('0x12')]=function(_0x38e776){return _0x38e776!==null&&!_['isUndefined'](_0x38e776);};VoiceDialReport['prototype'][_0xe44e('0x13')]=function(_0x5be501,_0x4c086d,_0x41e2fa){io['to'](_0x5be501)['emit'](_0x4c086d,_0x41e2fa);};VoiceDialReport[_0xe44e('0x11')][_0xe44e('0xa')]=function(_0x1e65eb){try{if(this['isNotNull'](_0x1e65eb)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x1e65eb['uniqueid'],util[_0xe44e('0x14')](_0x1e65eb,{'showHidden':![],'depth':null}));if(this[_0xe44e('0x15')][_0x1e65eb[_0xe44e('0x16')]]){_['merge'](this[_0xe44e('0x15')][_0x1e65eb['uniqueid']],{'starttime':moment()[_0xe44e('0x17')](_0xe44e('0x18')),'lastevent':'called','interface':_0x1e65eb[_0xe44e('0x19')]['substring'](0x0,_0x1e65eb[_0xe44e('0x19')][_0xe44e('0x1a')]('-')),'membername':_0x1e65eb[_0xe44e('0x19')][_0xe44e('0x1b')](_0x1e65eb[_0xe44e('0x19')][_0xe44e('0x1a')]('/')+0x1,_0x1e65eb[_0xe44e('0x19')]['lastIndexOf']('-'))},_[_0xe44e('0x1c')](_0x1e65eb,[_0xe44e('0x1d'),_0xe44e('0x1e')]));logger['info']('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x1e65eb[_0xe44e('0x16')],this[_0xe44e('0x15')][_0x1e65eb[_0xe44e('0x16')]]['membername'],this['channels'][_0x1e65eb['uniqueid']][_0xe44e('0x1f')]);logger[_0xe44e('0x20')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1e65eb[_0xe44e('0x16')],util['inspect'](this[_0xe44e('0x15')][_0x1e65eb[_0xe44e('0x16')]],{'showHidden':![],'depth':null}));this[_0xe44e('0x13')](_0xe44e('0x21'),_0xe44e('0x22'),this[_0xe44e('0x15')][_0x1e65eb['uniqueid']]);logger[_0xe44e('0x20')](_0xe44e('0x23'),_0x1e65eb[_0xe44e('0x16')],util[_0xe44e('0x14')](this[_0xe44e('0x15')][_0x1e65eb['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xe44e('0x13')](_0xe44e('0x24'),this[_0xe44e('0x15')][_0x1e65eb['uniqueid']]);}}}catch(_0x50269e){logger[_0xe44e('0x25')](_0xe44e('0x26'),_0x1e65eb['uniqueid'],util['inspect'](_0x50269e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe44e('0x11')][_0xe44e('0x27')]=function(_0x43435a){try{if(this[_0xe44e('0x12')](_0x43435a)){logger['debug'](_0xe44e('0x28'),_0x43435a[_0xe44e('0x16')],util[_0xe44e('0x14')](_0x43435a,{'showHidden':![],'depth':null}));if(this['channels'][_0x43435a[_0xe44e('0x16')]]){this[_0xe44e('0x15')][_0x43435a[_0xe44e('0x16')]][_0xe44e('0x29')]=_0x43435a[_0xe44e('0x29')];if(_0x43435a[_0xe44e('0x29')]===_0xe44e('0x2a')){this['channels'][_0x43435a[_0xe44e('0x16')]][_0xe44e('0x2b')]=_0x43435a[_0xe44e('0x2b')];this[_0xe44e('0x15')][_0x43435a[_0xe44e('0x16')]][_0xe44e('0x2c')]=_0x43435a[_0xe44e('0x2c')];this[_0xe44e('0x15')][_0x43435a[_0xe44e('0x16')]][_0xe44e('0x2d')]=moment()[_0xe44e('0x17')](_0xe44e('0x18'));this[_0xe44e('0x15')][_0x43435a[_0xe44e('0x16')]][_0xe44e('0x2e')]=_0xe44e('0x2f');logger[_0xe44e('0x30')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x43435a['uniqueid'],_0x43435a['channel'][_0xe44e('0x1b')](_0x43435a[_0xe44e('0x19')][_0xe44e('0x1a')]('/')+0x1,_0x43435a[_0xe44e('0x19')]['lastIndexOf']('-')));logger[_0xe44e('0x20')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x43435a['uniqueid'],util[_0xe44e('0x14')](this[_0xe44e('0x15')][_0x43435a[_0xe44e('0x16')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe44e('0x31'),this[_0xe44e('0x15')][_0x43435a[_0xe44e('0x16')]]);}logger[_0xe44e('0x20')](_0xe44e('0x32'),_0x43435a[_0xe44e('0x16')],util[_0xe44e('0x14')](this[_0xe44e('0x15')][_0x43435a[_0xe44e('0x16')]],{'showHidden':![],'depth':null}));this[_0xe44e('0x13')](_0xe44e('0x21'),'voice_outbound_channel:save',this[_0xe44e('0x15')][_0x43435a[_0xe44e('0x16')]]);}}}catch(_0x353648){logger[_0xe44e('0x25')](_0xe44e('0x33'),_0x43435a[_0xe44e('0x16')],util[_0xe44e('0x14')](_0x353648,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe44e('0x11')][_0xe44e('0xe')]=function(_0x25ac9f){try{if(this[_0xe44e('0x12')](_0x25ac9f)){logger[_0xe44e('0x20')]('[%s][voiceDialReport][varset]\x20event:',_0x25ac9f['uniqueid'],util['inspect'](_0x25ac9f,{'showHidden':![],'depth':null}));this[_0xe44e('0x34')](_0x25ac9f[_0xe44e('0x16')],_['keys'](_0x25ac9f['variable'])[0x0],_0x25ac9f[_0xe44e('0x35')]);if(this[_0xe44e('0x12')](_0x25ac9f[_0xe44e('0x36')])&&this['isNotNull'](_0x25ac9f[_0xe44e('0x36')][_0xe44e('0x37')])){if(_[_0xe44e('0x38')](this['channels'][_0x25ac9f['uniqueid']])){this[_0xe44e('0x15')][_0x25ac9f[_0xe44e('0x16')]]={'routeId':_0x25ac9f[_0xe44e('0x35')],'variables':this['variables'][_0x25ac9f['uniqueid']]};logger[_0xe44e('0x30')](_0xe44e('0x39'),_0x25ac9f[_0xe44e('0x16')],_0x25ac9f[_0xe44e('0x36')]['outboundrouteid'],_['keys'](_0x25ac9f[_0xe44e('0x36')])[0x0],_0x25ac9f[_0xe44e('0x35')]);logger[_0xe44e('0x20')](_0xe44e('0x3a'),_0x25ac9f[_0xe44e('0x16')],util[_0xe44e('0x14')](this[_0xe44e('0x15')][_0x25ac9f[_0xe44e('0x16')]],{'showHidden':![],'depth':null}));this[_0xe44e('0x13')](_0xe44e('0x21'),'voice_outbound_channel:save',this[_0xe44e('0x15')][_0x25ac9f[_0xe44e('0x16')]]);}}}}catch(_0x213620){logger['error']('[%s][voiceDialReport][varset]',_0x25ac9f[_0xe44e('0x16')],util[_0xe44e('0x14')](_0x213620,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe44e('0x11')][_0xe44e('0x34')]=function(_0x207658,_0x3d9fbf,_0x2dd606){var _0x484d47=[_0xe44e('0x3b'),_0xe44e('0x3c'),_0xe44e('0x3d'),_0xe44e('0x3e'),_0xe44e('0x3f'),_0xe44e('0x40'),'rtpaudioqosrtt',_0xe44e('0x41'),_0xe44e('0x42'),_0xe44e('0x43'),'bridgepeer',_0xe44e('0x44'),'membercalls',_0xe44e('0x45'),_0xe44e('0x46'),_0xe44e('0x47'),_0xe44e('0x48'),'memberpenalty','memberrealtime'];if(!_[_0xe44e('0x49')](_0x3d9fbf)&&!_[_0xe44e('0x4a')](_0x484d47,_0x3d9fbf)){if(_['isUndefined'](this[_0xe44e('0x8')][_0x207658])){this[_0xe44e('0x8')][_0x207658]={};}this[_0xe44e('0x8')][_0x207658][_0x3d9fbf]=_0x2dd606;}};VoiceDialReport[_0xe44e('0x11')][_0xe44e('0x10')]=function(_0x4efedf){try{if(this[_0xe44e('0x12')](_0x4efedf)){logger[_0xe44e('0x20')]('[%s][voiceDialReport][hangup]\x20event:',_0x4efedf[_0xe44e('0x16')],util[_0xe44e('0x14')](_0x4efedf,{'showHidden':![],'depth':null}));if(this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]]){logger['info'](_0xe44e('0x4b'),_0x4efedf[_0xe44e('0x16')],_0x4efedf['cause-txt']);this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]][_0xe44e('0x4c')]=moment()[_0xe44e('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe44e('0x15')][_0x4efedf['uniqueid']][_0xe44e('0x4d')]=moment(this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]][_0xe44e('0x4c')])['diff'](this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]][_0xe44e('0x4e')],_0xe44e('0x4f'));this['channels'][_0x4efedf['uniqueid']][_0xe44e('0x2e')]=_0xe44e('0x50');this[_0xe44e('0x51')][_0xe44e('0x52')]+=0x1;if(this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]][_0xe44e('0x2d')]){this[_0xe44e('0x51')][_0xe44e('0x53')]+=0x1;this['channels'][_0x4efedf[_0xe44e('0x16')]][_0xe44e('0x54')]=moment(this[_0xe44e('0x15')][_0x4efedf['uniqueid']]['answertime'])[_0xe44e('0x55')](this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]]['starttime'],_0xe44e('0x4f'));this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]][_0xe44e('0x56')]=moment(this[_0xe44e('0x15')][_0x4efedf['uniqueid']][_0xe44e('0x4c')])[_0xe44e('0x55')](this['channels'][_0x4efedf[_0xe44e('0x16')]][_0xe44e('0x2d')],'seconds');this[_0xe44e('0x51')][_0xe44e('0x57')]+=this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]]['holdtime']||0x0;this[_0xe44e('0x51')]['sumBillable']+=this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]][_0xe44e('0x56')];}this['outbound'][_0xe44e('0x58')]+=this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]][_0xe44e('0x4d')];logger[_0xe44e('0x20')](_0xe44e('0x59'),_0x4efedf[_0xe44e('0x16')],util['inspect'](this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]],{'showHidden':![],'depth':null}));ami[_0xe44e('0x13')](_0xe44e('0x5a'),this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]]);logger[_0xe44e('0x20')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4efedf[_0xe44e('0x16')],util[_0xe44e('0x14')](this[_0xe44e('0x15')][_0x4efedf['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xe44e('0x13')](_0xe44e('0x5b'),this[_0xe44e('0x15')][_0x4efedf['uniqueid']]);logger[_0xe44e('0x20')](_0xe44e('0x5c'),_0x4efedf[_0xe44e('0x16')],util[_0xe44e('0x14')](this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]],{'showHidden':![],'depth':null}));this['emit'](_0xe44e('0x21'),_0xe44e('0x5d'),this[_0xe44e('0x51')]);logger[_0xe44e('0x30')](_0xe44e('0x5e'),JSON['stringify'](this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]]));logger[_0xe44e('0x20')](_0xe44e('0x5f'),_0x4efedf[_0xe44e('0x16')],util[_0xe44e('0x14')](this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x16')]],{'showHidden':![],'depth':null}));this[_0xe44e('0x13')](_0xe44e('0x21'),'voice_outbound_channel:remove',this['channels'][_0x4efedf[_0xe44e('0x16')]]);delete this[_0xe44e('0x15')][_0x4efedf['uniqueid']];}else if(this[_0xe44e('0x15')][_0x4efedf['linkedid']]){this[_0xe44e('0x15')][_0x4efedf[_0xe44e('0x60')]][_0xe44e('0x16')]=this['channels'][_0x4efedf[_0xe44e('0x60')]][_0xe44e('0x61')];}if(this[_0xe44e('0x8')][_0x4efedf[_0xe44e('0x16')]]){delete this['variables'][_0x4efedf[_0xe44e('0x16')]];}}}catch(_0x3c81d3){logger['error'](_0xe44e('0x62'),_0x4efedf[_0xe44e('0x16')],util[_0xe44e('0x14')](_0x3c81d3,{'showHidden':![],'depth':null}));}};module[_0xe44e('0x63')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 2710c34..f16ee57 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x255e=['queueChannels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','syncAgentConnect','varset','syncVarSet','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','pTalking','waiting','clearZombieChannels','switch','enqueue','isNil','Action','status','channel','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','prototype','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][','format','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','queues','catch','[voiceQueueReport][queues]','flagQueueSummary','then','[voiceQueueReport][queuesummary]','isNotNull','[voiceQueueReport][queuesummary]\x20event:','queue','info','countBy','callers','toNumber','loggedIn','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','position','count','pick','keys','push','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','add','seconds','transfertype','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','linkedid','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','agentcomplete','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','variable','value','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','[%s][voiceQueueReport][hangup]','abandoned','length','milliseconds','diff','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','secondtransfererexten','ATTENDEDTRANSFER','ATTENDED','secondtransfereruniqueid','transfereeuniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','md5','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','tail','sequence','queueReports','agents','channels'];(function(_0x366901,_0x116f78){var _0x4444fc=function(_0x470885){while(--_0x470885){_0x366901['push'](_0x366901['shift']());}};_0x4444fc(++_0x116f78);}(_0x255e,0x1b9));var _0xe255=function(_0x21edd,_0x35de0b){_0x21edd=_0x21edd-0x0;var _0x225429=_0x255e[_0x21edd];return _0x225429;};'use strict';var _=require(_0xe255('0x0'));var moment=require(_0xe255('0x1'));var util=require(_0xe255('0x2'));var md5=require(_0xe255('0x3'));var Redis=require(_0xe255('0x4'));var config=require(_0xe255('0x5'));var logger=require(_0xe255('0x6'))('ami');var ami=require(_0xe255('0x7'));var QueueReport=require('../model/queueReport');config[_0xe255('0x8')]=_[_0xe255('0x9')](config['redis'],{'host':_0xe255('0xa'),'port':0x18eb});var io=require(_0xe255('0xb'))(new Redis(config[_0xe255('0x8')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2cab64){this[_0xe255('0xc')]=this[_0xe255('0xc')]?this[_0xe255('0xc')]['finally'](_0x2cab64):_0x2cab64();};function VoiceQueueReport(_0x4552e0){this[_0xe255('0xd')]=new Sequence();this[_0xe255('0xe')]={};this[_0xe255('0xf')]=_0x4552e0['agents'];this[_0xe255('0x10')]=_0x4552e0[_0xe255('0x11')];this[_0xe255('0x12')]=_0x4552e0[_0xe255('0x12')];this['flagQueueSummary']=!![];this[_0xe255('0x13')]=_0x4552e0[_0xe255('0x13')];this[_0xe255('0x14')]={};ami['on'](_0xe255('0x15'),this[_0xe255('0x16')][_0xe255('0x17')](this));ami['on'](_0xe255('0x18'),this[_0xe255('0x19')][_0xe255('0x17')](this));ami['on']('queuecallerjoin',this[_0xe255('0x1a')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xe255('0x1b'),this[_0xe255('0x1c')][_0xe255('0x17')](this));ami['on']('agentcomplete',this[_0xe255('0x1d')][_0xe255('0x17')](this));ami['on']('agentconnect',this[_0xe255('0x1e')][_0xe255('0x17')](this));ami['on'](_0xe255('0x1f'),this[_0xe255('0x20')][_0xe255('0x17')](this));ami['on']('hangup',this[_0xe255('0x21')][_0xe255('0x17')](this));ami['on'](_0xe255('0x22'),this[_0xe255('0x23')][_0xe255('0x17')](this));ami['on'](_0xe255('0x24'),this[_0xe255('0x25')][_0xe255('0x17')](this));ami['on'](_0xe255('0x26'),this[_0xe255('0x27')][_0xe255('0x17')](this));ami['on'](_0xe255('0x28'),this[_0xe255('0x29')]['bind'](this));ami['on'](_0xe255('0x2a'),this['syncBlindTransfer'][_0xe255('0x17')](this));this[_0xe255('0x2b')]();this[_0xe255('0x2c')]();}function clearChannels(_0x509e16){if(!_['isEmpty'](_0x509e16)){for(var _0x503bda in _0x509e16){if(_0x509e16[_0xe255('0x2d')](_0x503bda)){delete _0x509e16[_0x503bda];}}}}function clearCampaigns(_0x2df836){if(!_[_0xe255('0x2e')](_0x2df836)){for(var _0x4efb35 in _0x2df836){if(_0x2df836['hasOwnProperty'](_0x4efb35)){_0x2df836[_0x4efb35][_0xe255('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x128eb3){if(!_[_0xe255('0x2e')](_0x128eb3)){for(var _0x214c87 in _0x128eb3){if(_0x128eb3[_0xe255('0x2d')](_0x214c87)){_0x128eb3[_0x214c87]['originated']=0x0;_0x128eb3[_0x214c87]['talking']=0x0;_0x128eb3[_0x214c87][_0xe255('0x30')]=0x0;_0x128eb3[_0x214c87][_0xe255('0x31')]=0x0;_0x128eb3[_0x214c87]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x17329c){if(!_[_0xe255('0x2e')](_0x17329c)){for(var _0x1bae0e in _0x17329c){if(_0x17329c['hasOwnProperty'](_0x1bae0e)){_0x17329c[_0x1bae0e]['unlockRR']=!![];}}}}VoiceQueueReport['prototype'][_0xe255('0x32')]=function(){var _0x41e606=this;for(var _0x56a9e8 in this[_0xe255('0x10')]){if(this[_0xe255('0x10')][_0xe255('0x2d')](_0x56a9e8)&&!this['channels'][_0x56a9e8][_0xe255('0x33')]){this['sequence'][_0xe255('0x34')](function(){if(!_[_0xe255('0x35')](_0x41e606['channels'][_0x56a9e8])){return ami[_0xe255('0x36')]({'action':_0xe255('0x37'),'channel':_0x41e606[_0xe255('0x10')][_0x56a9e8][_0xe255('0x38')]})['catch'](function(_0x5233d3){if(_0x5233d3[_0xe255('0x39')]===_0xe255('0x3a')){setTimeout(function(){if(_0x41e606['channels'][_0x56a9e8]){delete _0x41e606[_0xe255('0x10')][_0x56a9e8];logger[_0xe255('0x3b')](_0xe255('0x3c'),_0x56a9e8,util['inspect'](_0x5233d3,{'showHidden':![],'depth':null}));}if(_0x41e606['queueReports'][_0x56a9e8]){delete _0x41e606[_0xe255('0xe')][_0x56a9e8];logger[_0xe255('0x3b')](_0xe255('0x3d'),_0x56a9e8,util[_0xe255('0x3e')](_0x5233d3,{'showHidden':![],'depth':null}));}if(_0x41e606[_0xe255('0x14')][_0x56a9e8]){delete _0x41e606['variables'][_0x56a9e8];logger[_0xe255('0x3b')](_0xe255('0x3f'),_0x56a9e8,util[_0xe255('0x3e')](_0x5233d3,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xe255('0x40')][_0xe255('0x23')]=function(){logger[_0xe255('0x3b')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xe255('0x10')]);this[_0xe255('0x41')](this['queueReports']);clearAgentBooked(this[_0xe255('0xf')]);clearVoiceQueues(this[_0xe255('0x12')]);clearCampaigns(this[_0xe255('0x13')]);};VoiceQueueReport[_0xe255('0x40')]['clearQueueReport']=function(_0x33cfff){var _0x5a9f78=this;if(!_[_0xe255('0x2e')](_0x33cfff)){for(var _0x4e9a1a in _0x33cfff){if(_0x33cfff[_0xe255('0x2d')](_0x4e9a1a)){_0x5a9f78[_0xe255('0x42')](_0x33cfff[_0x4e9a1a],_0xe255('0x43'));delete _0x33cfff[_0x4e9a1a];}}}};VoiceQueueReport[_0xe255('0x40')]['emit']=function(_0x478365,_0x319613,_0x25e3f2){io['to'](_0x478365)[_0xe255('0x44')](_0x319613,_0x25e3f2);};VoiceQueueReport[_0xe255('0x40')][_0xe255('0x45')]=function(_0x21623a,_0x49dd6a){logger[_0xe255('0x46')]('[%s][voiceQueueReport]['+_0x49dd6a+_0xe255('0x47'),_0x21623a[_0xe255('0x48')],util[_0xe255('0x3e')](_0x21623a,{'showHidden':![],'depth':null}));this[_0xe255('0x44')](util['format'](_0xe255('0x49'),_0x21623a[_0xe255('0x4a')]),_0xe255('0x4b'),_0x21623a);io[_0xe255('0x44')](_0xe255('0x4c'),_0x21623a);};VoiceQueueReport['prototype'][_0xe255('0x42')]=function(_0x531065,_0x398477){logger[_0xe255('0x46')](_0xe255('0x4d')+_0x398477+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x531065[_0xe255('0x48')],util['inspect'](_0x531065,{'showHidden':![],'depth':null}));this[_0xe255('0x44')](util[_0xe255('0x4e')](_0xe255('0x49'),_0x531065[_0xe255('0x4a')]),'voice_queue_channel:remove',_0x531065);io[_0xe255('0x44')](_0xe255('0x4f'),_0x531065);};VoiceQueueReport[_0xe255('0x40')][_0xe255('0x50')]=function(_0x3b27d7,_0x1947d3){if(_0x3b27d7[_0xe255('0x51')]===_0xe255('0x52')){var _0x4ca003={'id':_0x3b27d7['id'],'name':_0x3b27d7[_0xe255('0x4a')],'strategy':_0x3b27d7[_0xe255('0x53')],'answered':_0x3b27d7[_0xe255('0x54')],'available':_0x3b27d7[_0xe255('0x55')],'loggedIn':_0x3b27d7['loggedIn'],'pTalking':_0x3b27d7[_0xe255('0x30')],'sumBillable':_0x3b27d7[_0xe255('0x56')],'sumDuration':_0x3b27d7[_0xe255('0x57')],'sumHoldTime':_0x3b27d7[_0xe255('0x58')]||0x0,'talking':_0x3b27d7[_0xe255('0x59')],'total':_0x3b27d7[_0xe255('0x5a')],'type':_0x3b27d7[_0xe255('0x51')],'unmanaged':_0x3b27d7[_0xe255('0x5b')],'abandoned':_0x3b27d7['abandoned'],'waiting':_0x3b27d7[_0xe255('0x31')]};if(_0x3b27d7[_0xe255('0x5c')]){_0x4ca003[_0xe255('0x5c')]={'id':_0x3b27d7[_0xe255('0x5c')]['id'],'name':_0x3b27d7[_0xe255('0x5c')][_0xe255('0x4a')],'active':_0x3b27d7[_0xe255('0x5c')][_0xe255('0x5d')],'callerid':_0x3b27d7[_0xe255('0x5c')][_0xe255('0x5e')]};}if(_0x3b27d7[_0xe255('0x5f')]){_0x4ca003[_0xe255('0x5f')]={'id':_0x3b27d7['Interval']['id'],'name':_0x3b27d7[_0xe255('0x5f')][_0xe255('0x4a')]};}var _0x296da0=md5(JSON[_0xe255('0x60')](_0x4ca003));if(_0x3b27d7['md5']!==_0x296da0){_0x3b27d7[_0xe255('0x3')]=_0x296da0;logger[_0xe255('0x46')](_0xe255('0x61')+_0x1947d3+_0xe255('0x62'),util[_0xe255('0x3e')](_0x4ca003,{'showHidden':![],'depth':null}));this['emit'](util[_0xe255('0x4e')](_0xe255('0x49'),_0x4ca003[_0xe255('0x4a')]),_0xe255('0x63'),_0x4ca003);}}};VoiceQueueReport[_0xe255('0x40')]['isNotNull']=function(_0x3c1edf){return _0x3c1edf!==null&&!_['isUndefined'](_0x3c1edf);};VoiceQueueReport[_0xe255('0x40')]['loopQueueShow']=function(){var _0x1a8c03=this;setInterval(function(){_0x1a8c03[_0xe255('0x32')]();ami[_0xe255('0x36')]({'action':_0xe255('0x64')})[_0xe255('0x65')](function(_0x2e2751){logger['error'](_0xe255('0x66'),util['inspect'](_0x2e2751,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xe255('0x40')]['loopQueueSummary']=function(){var _0x24b10d=this;setInterval(function(){if(_0x24b10d[_0xe255('0x67')]){return ami['Action']({'action':'queuesummary'})[_0xe255('0x68')](function(_0xdec9b3){_0x24b10d[_0xe255('0x67')]=![];})['catch'](function(_0x113f78){logger['error'](_0xe255('0x69'),util['inspect'](_0x113f78,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xe255('0x40')][_0xe255('0x16')]=function(_0xbc1d8d){try{if(this[_0xe255('0x6a')](_0xbc1d8d)&&this[_0xe255('0x6a')](_0xbc1d8d['queue'])){logger[_0xe255('0x46')](_0xe255('0x6b'),util['inspect'](_0xbc1d8d,{'showHidden':![],'depth':null}));if(this[_0xe255('0x12')][_0xbc1d8d[_0xe255('0x6c')]]){logger[_0xe255('0x6d')]('[voiceQueueReport][queuesummary]\x20name:%s',_0xbc1d8d[_0xe255('0x6c')]);var _0x5e03ae=_[_0xe255('0x6e')](this[_0xe255('0x10')],_0xe255('0x6c'))[_0xbc1d8d[_0xe255('0x6c')]]||0x0;var _0x571554=_0x5e03ae-_0xbc1d8d[_0xe255('0x6f')];if(this[_0xe255('0x12')][_0xbc1d8d[_0xe255('0x6c')]]['waiting']!==_[_0xe255('0x70')](_0xbc1d8d['callers'])||this[_0xe255('0x12')][_0xbc1d8d[_0xe255('0x6c')]][_0xe255('0x71')]!==_[_0xe255('0x70')](_0xbc1d8d['loggedin'])||this['voiceQueues'][_0xbc1d8d[_0xe255('0x6c')]][_0xe255('0x55')]!==_[_0xe255('0x70')](_0xbc1d8d['available'])||this[_0xe255('0x12')][_0xbc1d8d['queue']]['talking']!==_0x571554){this[_0xe255('0x12')][_0xbc1d8d[_0xe255('0x6c')]][_0xe255('0x31')]=_[_0xe255('0x70')](_0xbc1d8d['callers']);this[_0xe255('0x12')][_0xbc1d8d['queue']]['loggedIn']=_[_0xe255('0x70')](_0xbc1d8d[_0xe255('0x72')]);this[_0xe255('0x12')][_0xbc1d8d[_0xe255('0x6c')]][_0xe255('0x55')]=_[_0xe255('0x70')](_0xbc1d8d[_0xe255('0x55')]);this[_0xe255('0x12')][_0xbc1d8d[_0xe255('0x6c')]]['talking']=_0x571554>0x0?_0x571554:0x0;this[_0xe255('0x12')][_0xbc1d8d['queue']][_0xe255('0x59')]=this[_0xe255('0x12')][_0xbc1d8d[_0xe255('0x6c')]][_0xe255('0x59')]>_[_0xe255('0x70')](_0xbc1d8d[_0xe255('0x72')])?_['toNumber'](_0xbc1d8d[_0xe255('0x72')]):this[_0xe255('0x12')][_0xbc1d8d['queue']][_0xe255('0x59')];this['emitVoiceQueueSummary'](this[_0xe255('0x12')][_0xbc1d8d[_0xe255('0x6c')]],_0xe255('0x15'));}logger[_0xe255('0x46')](_0xe255('0x73'),util[_0xe255('0x3e')](this[_0xe255('0x12')][_0xbc1d8d[_0xe255('0x6c')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe255('0x74'),this['voiceQueues'][_0xbc1d8d[_0xe255('0x6c')]]);}}}catch(_0xe3122c){logger[_0xe255('0x3b')](_0xe255('0x69'),util['inspect'](_0xe3122c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe255('0x40')]['syncQueueSummaryComplete']=function(_0x71860a){logger[_0xe255('0x46')](_0xe255('0x75'),util[_0xe255('0x3e')](_0x71860a,{'showHidden':![],'depth':null}));this[_0xe255('0x67')]=!![];};VoiceQueueReport[_0xe255('0x40')][_0xe255('0x1a')]=function(_0x369873){try{if(this[_0xe255('0x6a')](_0x369873)){logger[_0xe255('0x46')](_0xe255('0x76'),_0x369873[_0xe255('0x48')],util['inspect'](_0x369873,{'showHidden':![],'depth':null}));if(_[_0xe255('0x77')](this['queueReports'][_0x369873['uniqueid']])){this[_0xe255('0xe')][_0x369873[_0xe255('0x48')]]=[];this['channels'][_0x369873['uniqueid']]={};}var _0x520ac9=new QueueReport();_0x520ac9[_0xe255('0x4a')]=_0x369873['queue'];_0x520ac9['type']=this[_0xe255('0x12')][_0x520ac9['name']]&&this[_0xe255('0x12')][_0x520ac9['name']]['type']?this[_0xe255('0x12')][_0x520ac9[_0xe255('0x4a')]][_0xe255('0x51')]||_0xe255('0x52'):'inbound';_0x520ac9[_0xe255('0x6c')]=_0x369873[_0xe255('0x6c')];_0x520ac9[_0xe255('0x78')]=moment()[_0xe255('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x520ac9[_0xe255('0x79')]=_0x369873['position'];_0x520ac9[_0xe255('0x7a')]=_0x369873[_0xe255('0x7a')];_0x520ac9[_0xe255('0x48')]=_0x369873[_0xe255('0x48')];logger[_0xe255('0x6d')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x520ac9[_0xe255('0x4a')],_0x520ac9[_0xe255('0x51')]);_['merge'](_0x520ac9,_[_0xe255('0x7b')](_0x369873,_[_0xe255('0x7c')](_0x520ac9)));this['queueReports'][_0x369873[_0xe255('0x48')]][_0xe255('0x7d')](_0x520ac9);this[_0xe255('0x10')][_0x369873[_0xe255('0x48')]]=_0x520ac9;this[_0xe255('0x45')](_0x520ac9,_0xe255('0x7e'));}}catch(_0x32e047){logger[_0xe255('0x3b')](_0xe255('0x76'),_0x369873['uniqueid'],util['inspect'](_0x32e047,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe255('0x40')]['syncQueueCallerAbandon']=function(_0x5023b3){try{if(this[_0xe255('0x6a')](_0x5023b3)){logger[_0xe255('0x46')](_0xe255('0x7f'),_0x5023b3[_0xe255('0x48')],util['inspect'](_0x5023b3,{'showHidden':![],'depth':null}));if(this[_0xe255('0xe')][_0x5023b3[_0xe255('0x48')]]){var _0x3d5564=_[_0xe255('0x80')](this[_0xe255('0xe')][_0x5023b3['uniqueid']]);_0x3d5564[_0xe255('0x81')]=![];_0x3d5564[_0xe255('0x82')]=null;_0x3d5564[_0xe255('0x83')]=_0x5023b3[_0xe255('0x83')];_0x3d5564['originalposition']=_0x5023b3[_0xe255('0x84')];_0x3d5564[_0xe255('0x85')]=!![];_0x3d5564[_0xe255('0x86')]=moment()['format'](_0xe255('0x87'));_0x3d5564[_0xe255('0x88')]=_0xe255('0x89');_0x3d5564['lastAssignedTo']=null;logger[_0xe255('0x6d')](_0xe255('0x8a'),_0x3d5564[_0xe255('0x4a')],_0x3d5564[_0xe255('0x51')]);this[_0xe255('0x10')][_0x5023b3[_0xe255('0x48')]]=_0x3d5564;this[_0xe255('0x42')](_0x3d5564,_0xe255('0x85'));}}}catch(_0x307c61){logger[_0xe255('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5023b3[_0xe255('0x48')],util[_0xe255('0x3e')](_0x307c61,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe255('0x40')]['syncQueueCallerLeave']=function(_0x350ff9){try{if(this['isNotNull'](_0x350ff9)){logger[_0xe255('0x46')]('[%s][voiceQueueReport][queuecallerleave]',_0x350ff9[_0xe255('0x48')],util[_0xe255('0x3e')](_0x350ff9,{'showHidden':![],'depth':null}));if(this[_0xe255('0xe')][_0x350ff9['uniqueid']]){var _0x5b3456=_[_0xe255('0x80')](this[_0xe255('0xe')][_0x350ff9[_0xe255('0x48')]]);_0x5b3456[_0xe255('0x8b')]=moment()[_0xe255('0x4e')](_0xe255('0x87'));_0x5b3456[_0xe255('0x8c')]=_0x350ff9['connectedlinenum'];_0x5b3456[_0xe255('0x8d')]=_0x350ff9[_0xe255('0x8d')];logger[_0xe255('0x6d')](_0xe255('0x8e'),_0x5b3456['name'],_0x5b3456[_0xe255('0x51')],_0x350ff9[_0xe255('0x8c')],_0x350ff9[_0xe255('0x8d')]);this['channels'][_0x350ff9[_0xe255('0x48')]]=_0x5b3456;this[_0xe255('0x45')](_0x5b3456,_0xe255('0x1b'));}}}catch(_0xaee877){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x350ff9[_0xe255('0x48')],util[_0xe255('0x3e')](_0xaee877,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe255('0x1e')]=function(_0xe5266b){try{if(this[_0xe255('0x6a')](_0xe5266b)){logger['debug'](_0xe255('0x8f'),_0xe5266b[_0xe255('0x48')],util[_0xe255('0x3e')](_0xe5266b,{'showHidden':![],'depth':null}));if(this[_0xe255('0xe')][_0xe5266b[_0xe255('0x48')]]){var _0x42ee71=_[_0xe255('0x80')](this['queueReports'][_0xe5266b[_0xe255('0x48')]]);_0x42ee71[_0xe255('0x81')]=!![];_0x42ee71[_0xe255('0x88')]=_0xe255('0x90');logger[_0xe255('0x6d')](_0xe255('0x91'),_0x42ee71[_0xe255('0x4a')],_0x42ee71[_0xe255('0x51')]);}}}catch(_0x33de2f){logger['error'](_0xe255('0x8f'),_0xe5266b[_0xe255('0x48')],util['inspect'](_0x33de2f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe255('0x40')][_0xe255('0x1d')]=function(_0x292006){try{if(this[_0xe255('0x6a')](_0x292006)){logger[_0xe255('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x292006[_0xe255('0x48')],util[_0xe255('0x3e')](_0x292006,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x292006[_0xe255('0x48')]]){var _0x36beb3=_['last'](this[_0xe255('0xe')][_0x292006[_0xe255('0x48')]]);_0x36beb3['queuecallerabandon']=![];_0x36beb3[_0xe255('0x86')]=null;_0x36beb3[_0xe255('0x92')]=!![];_0x36beb3[_0xe255('0x93')]=_0x292006[_0xe255('0x94')];_0x36beb3[_0xe255('0x83')]=_0x292006['holdtime'];_0x36beb3[_0xe255('0x81')]=!![];_0x36beb3[_0xe255('0x95')]=![];_0x36beb3[_0xe255('0x96')]=null;if(!_0x36beb3['transfer']){if(_0x292006[_0xe255('0x97')]==_0xe255('0x98')){_0x36beb3[_0xe255('0x88')]=_0xe255('0x99');logger[_0xe255('0x6d')](_0xe255('0x9a'),_0x36beb3[_0xe255('0x4a')],_0x36beb3[_0xe255('0x51')]);}else{if(_[_0xe255('0x9b')](_0x292006[_0xe255('0x38')]['toLowerCase'](),_0xe255('0x9c'))){if(this[_0xe255('0xe')][_0x292006['linkedid']]){var _0x186256=_['last'](this[_0xe255('0xe')][_0x292006['linkedid']]);_0x186256['queuecallercomplete']=![];_0x186256[_0xe255('0x95')]=!![];_0x186256[_0xe255('0x96')]=moment(_0x36beb3[_0xe255('0x78')])[_0xe255('0x9d')](_0x292006[_0xe255('0x83')],_0xe255('0x9e'))[_0xe255('0x4e')](_0xe255('0x87'));_0x186256[_0xe255('0x88')]='FORWARDTRANSFER';_0x186256['transfer']=!![];_0x186256[_0xe255('0x9f')]=_0xe255('0xa0');_0x186256[_0xe255('0xa1')]=_0x292006['destexten'];_0x186256[_0xe255('0xa2')]=_0x292006[_0xe255('0x48')];logger[_0xe255('0x6d')](_0xe255('0xa3'),_0x186256[_0xe255('0x4a')],_0x186256[_0xe255('0x51')]);var _0x47dadc=this[_0xe255('0xe')][_0x292006[_0xe255('0xa4')]];this[_0xe255('0xe')][_0x292006['linkedid']]=this['queueReports'][_0x292006['uniqueid']];this['queueReports'][_0x292006['uniqueid']]=_0x47dadc;}}else{_0x36beb3[_0xe255('0x88')]=_0xe255('0xa5')+_0x292006[_0xe255('0x97')]['toUpperCase']();logger[_0xe255('0x6d')](_0xe255('0xa6'),_0x36beb3[_0xe255('0x4a')],_0x36beb3[_0xe255('0x51')],_0x36beb3[_0xe255('0x88')]);}}}this[_0xe255('0x10')][_0x292006[_0xe255('0x48')]]=_0x36beb3;this['emitVoiceQueueChannelRemove'](_0x36beb3,_0xe255('0xa7'));}}}catch(_0x55e1af){logger[_0xe255('0x3b')](_0xe255('0xa8'),_0x292006[_0xe255('0x48')],util['inspect'](_0x55e1af,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe255('0x40')][_0xe255('0x20')]=function(_0x1f2256){try{if(this[_0xe255('0x6a')](_0x1f2256)){logger['debug'](_0xe255('0xa9'),_0x1f2256[_0xe255('0x48')],util['inspect'](_0x1f2256,{'showHidden':![],'depth':null}));this['addVariable'](_0x1f2256[_0xe255('0x48')],_[_0xe255('0x7c')](_0x1f2256[_0xe255('0xaa')])[0x0],_0x1f2256[_0xe255('0xab')]);if(this[_0xe255('0xe')][_0x1f2256[_0xe255('0x48')]]){var _0x1b4b80=_[_0xe255('0x80')](this[_0xe255('0xe')][_0x1f2256[_0xe255('0x48')]]);if(_0x1b4b80){if(this[_0xe255('0x6a')](_0x1f2256[_0xe255('0xaa')])&&this[_0xe255('0x6a')](_0x1f2256[_0xe255('0xaa')][_0xe255('0xac')])){switch(_0x1f2256[_0xe255('0xab')]){case _0xe255('0xad'):_0x1b4b80[_0xe255('0x95')]=![];_0x1b4b80[_0xe255('0x96')]=null;break;case _0xe255('0xae'):_0x1b4b80[_0xe255('0xaf')]=_0xe255('0xb0');_0x1b4b80[_0xe255('0x95')]=!![];_0x1b4b80['queuecallerexitAt']=moment()[_0xe255('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b4b80[_0xe255('0x8b')]=moment()[_0xe255('0x4e')](_0xe255('0x87'));logger[_0xe255('0x46')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x1f2256[_0xe255('0x48')],util['inspect'](_0x1b4b80,{'showHidden':![],'depth':null}));ami[_0xe255('0x44')](_0xe255('0xb1'),_0x1b4b80);break;default:_0x1b4b80[_0xe255('0x95')]=!![];_0x1b4b80['queuecallerexitAt']=moment()[_0xe255('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b4b80[_0xe255('0x8b')]=moment()[_0xe255('0x4e')](_0xe255('0x87'));}_0x1b4b80[_0xe255('0x85')]=![];_0x1b4b80['queuecallerabandonAt']=null;_0x1b4b80['queuecallerexitreason']=_0x1f2256[_0xe255('0xab')];this['channels'][_0x1f2256[_0xe255('0x48')]]=_0x1b4b80;this[_0xe255('0x42')](_0x1b4b80,_0xe255('0x1f'));}else if(this[_0xe255('0x6a')](_0x1f2256[_0xe255('0xaa')])&&this[_0xe255('0x6a')](_0x1f2256[_0xe255('0xaa')][_0xe255('0xb2')])){if(!_0x1b4b80[_0xe255('0x85')]){_0x1b4b80[_0xe255('0x95')]=!![];_0x1b4b80[_0xe255('0x96')]=moment()[_0xe255('0x4e')](_0xe255('0x87'));_0x1b4b80[_0xe255('0x88')]='EXITWITHKEY';_0x1b4b80[_0xe255('0x8b')]=moment()[_0xe255('0x4e')](_0xe255('0x87'));this['channels'][_0x1f2256[_0xe255('0x48')]]=_0x1b4b80;}}logger[_0xe255('0x6d')](_0xe255('0xb3'),_0x1f2256[_0xe255('0x48')],_0x1b4b80[_0xe255('0x4a')],_0x1b4b80[_0xe255('0x51')],_[_0xe255('0x7c')](_0x1f2256[_0xe255('0xaa')])[0x0],_0x1f2256[_0xe255('0xab')]);_0x1b4b80[_0xe255('0x14')]=this[_0xe255('0x14')][_0x1f2256[_0xe255('0x48')]];}}}}catch(_0x47990a){logger['error'](_0xe255('0xa9'),_0x1f2256[_0xe255('0x48')],util[_0xe255('0x3e')](_0x47990a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe255('0x40')][_0xe255('0xb4')]=function(_0x573ac4,_0x1c1a8a,_0x1c800c){var _0x33b822=[_0xe255('0xb5'),_0xe255('0xb6'),_0xe255('0xb7'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged',_0xe255('0xb8'),_0xe255('0xb9'),_0xe255('0xba'),'sipuri',_0xe255('0xbb'),'bridgepvtcallid',_0xe255('0xbc'),'memberdynamic',_0xe255('0xbd'),_0xe255('0xbe'),_0xe255('0x94'),_0xe255('0xbf'),_0xe255('0xc0')];if(!_['isNil'](_0x1c1a8a)&&!_['includes'](_0x33b822,_0x1c1a8a)){if(_[_0xe255('0x77')](this[_0xe255('0x14')][_0x573ac4])){this[_0xe255('0x14')][_0x573ac4]={};}this[_0xe255('0x14')][_0x573ac4][_0x1c1a8a]=_0x1c800c;}};VoiceQueueReport['prototype'][_0xe255('0x21')]=function(_0x23973f){try{if(this[_0xe255('0x6a')](_0x23973f)){logger[_0xe255('0x46')](_0xe255('0xc1'),_0x23973f[_0xe255('0x48')],util[_0xe255('0x3e')](_0x23973f,{'showHidden':![],'depth':null}));if(this[_0xe255('0xe')][_0x23973f[_0xe255('0x48')]]){for(var _0x3af74b=0x0,_0x1ff963={};_0x3af74b0x0?_0x23375d:0x0;this['voiceQueues'][_0x5e3d3f[_0x0489('0x68')]][_0x0489('0x33')]=this['voiceQueues'][_0x5e3d3f[_0x0489('0x68')]][_0x0489('0x33')]>_[_0x0489('0x6c')](_0x5e3d3f[_0x0489('0x6d')])?_['toNumber'](_0x5e3d3f[_0x0489('0x6d')]):this[_0x0489('0x12')][_0x5e3d3f[_0x0489('0x68')]][_0x0489('0x33')];this[_0x0489('0x52')](this[_0x0489('0x12')][_0x5e3d3f[_0x0489('0x68')]],_0x0489('0x16'));}logger[_0x0489('0x48')](_0x0489('0x6e'),util[_0x0489('0x40')](this[_0x0489('0x12')][_0x5e3d3f[_0x0489('0x68')]],{'showHidden':![],'depth':null}));ami[_0x0489('0x46')](_0x0489('0x6f'),this[_0x0489('0x12')][_0x5e3d3f[_0x0489('0x68')]]);}}}catch(_0x480691){logger[_0x0489('0x3e')](_0x0489('0x67'),util['inspect'](_0x480691,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0489('0x9')][_0x0489('0x70')]=function(_0x4e71cb){logger[_0x0489('0x48')](_0x0489('0x71'),util[_0x0489('0x40')](_0x4e71cb,{'showHidden':![],'depth':null}));this[_0x0489('0x13')]=!![];};VoiceQueueReport[_0x0489('0x9')]['syncQueueCallerJoin']=function(_0x14f0b7){try{if(this[_0x0489('0x62')](_0x14f0b7)){logger['debug'](_0x0489('0x72'),_0x14f0b7[_0x0489('0x4a')],util[_0x0489('0x40')](_0x14f0b7,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x0489('0xe')][_0x14f0b7[_0x0489('0x4a')]])){this[_0x0489('0xe')][_0x14f0b7[_0x0489('0x4a')]]=[];this[_0x0489('0x10')][_0x14f0b7[_0x0489('0x4a')]]={};}var _0x2afa00=new QueueReport();_0x2afa00['name']=_0x14f0b7['queue'];_0x2afa00[_0x0489('0x5a')]=this[_0x0489('0x12')][_0x2afa00[_0x0489('0x4d')]]&&this[_0x0489('0x12')][_0x2afa00['name']]['type']?this['voiceQueues'][_0x2afa00[_0x0489('0x4d')]][_0x0489('0x5a')]||'inbound':'inbound';_0x2afa00[_0x0489('0x68')]=_0x14f0b7['queue'];_0x2afa00[_0x0489('0x73')]=moment()[_0x0489('0x4b')](_0x0489('0x74'));_0x2afa00[_0x0489('0x75')]=_0x14f0b7['position'];_0x2afa00[_0x0489('0x76')]=_0x14f0b7[_0x0489('0x76')];_0x2afa00[_0x0489('0x4a')]=_0x14f0b7['uniqueid'];logger[_0x0489('0x77')](_0x0489('0x78'),_0x2afa00[_0x0489('0x4d')],_0x2afa00[_0x0489('0x5a')]);_[_0x0489('0x79')](_0x2afa00,_[_0x0489('0x7a')](_0x14f0b7,_[_0x0489('0x7b')](_0x2afa00)));this[_0x0489('0xe')][_0x14f0b7[_0x0489('0x4a')]][_0x0489('0x7c')](_0x2afa00);this['channels'][_0x14f0b7[_0x0489('0x4a')]]=_0x2afa00;this[_0x0489('0x47')](_0x2afa00,_0x0489('0x7d'));}}catch(_0x5c5982){logger[_0x0489('0x3e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x14f0b7[_0x0489('0x4a')],util[_0x0489('0x40')](_0x5c5982,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0489('0x9')][_0x0489('0x1a')]=function(_0x198142){try{if(this[_0x0489('0x62')](_0x198142)){logger['debug'](_0x0489('0x7e'),_0x198142[_0x0489('0x4a')],util['inspect'](_0x198142,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x198142[_0x0489('0x4a')]]){var _0x392fce=_[_0x0489('0x7f')](this[_0x0489('0xe')][_0x198142[_0x0489('0x4a')]]);_0x392fce[_0x0489('0x80')]=![];_0x392fce[_0x0489('0x81')]=null;_0x392fce[_0x0489('0x82')]=_0x198142[_0x0489('0x82')];_0x392fce[_0x0489('0x83')]=_0x198142['originalposition'];_0x392fce[_0x0489('0x19')]=!![];_0x392fce[_0x0489('0x84')]=moment()[_0x0489('0x4b')](_0x0489('0x74'));_0x392fce[_0x0489('0x85')]=_0x0489('0x86');_0x392fce[_0x0489('0x87')]=null;logger[_0x0489('0x77')](_0x0489('0x88'),_0x392fce[_0x0489('0x4d')],_0x392fce[_0x0489('0x5a')]);this[_0x0489('0x10')][_0x198142['uniqueid']]=_0x392fce;this[_0x0489('0x44')](_0x392fce,_0x0489('0x19'));}}}catch(_0x5e28b3){logger[_0x0489('0x3e')](_0x0489('0x7e'),_0x198142[_0x0489('0x4a')],util[_0x0489('0x40')](_0x5e28b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0489('0x9')][_0x0489('0x1c')]=function(_0x304738){try{if(this[_0x0489('0x62')](_0x304738)){logger[_0x0489('0x48')](_0x0489('0x89'),_0x304738[_0x0489('0x4a')],util[_0x0489('0x40')](_0x304738,{'showHidden':![],'depth':null}));if(this[_0x0489('0xe')][_0x304738[_0x0489('0x4a')]]){var _0x2ad100=_[_0x0489('0x7f')](this[_0x0489('0xe')][_0x304738['uniqueid']]);_0x2ad100[_0x0489('0x8a')]=moment()[_0x0489('0x4b')](_0x0489('0x74'));_0x2ad100['connectedlinenum']=_0x304738['connectedlinenum'];_0x2ad100[_0x0489('0x8b')]=_0x304738[_0x0489('0x8b')];logger[_0x0489('0x77')](_0x0489('0x8c'),_0x2ad100['name'],_0x2ad100[_0x0489('0x5a')],_0x304738[_0x0489('0x8d')],_0x304738[_0x0489('0x8b')]);this[_0x0489('0x10')][_0x304738[_0x0489('0x4a')]]=_0x2ad100;this[_0x0489('0x47')](_0x2ad100,_0x0489('0x1b'));}}}catch(_0x1a8d45){logger[_0x0489('0x3e')](_0x0489('0x89'),_0x304738[_0x0489('0x4a')],util[_0x0489('0x40')](_0x1a8d45,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0489('0x9')][_0x0489('0x20')]=function(_0x295764){try{if(this['isNotNull'](_0x295764)){logger[_0x0489('0x48')](_0x0489('0x8e'),_0x295764[_0x0489('0x4a')],util[_0x0489('0x40')](_0x295764,{'showHidden':![],'depth':null}));if(this[_0x0489('0xe')][_0x295764[_0x0489('0x4a')]]){var _0x55762c=_[_0x0489('0x7f')](this[_0x0489('0xe')][_0x295764[_0x0489('0x4a')]]);_0x55762c['queuecallercomplete']=!![];_0x55762c[_0x0489('0x85')]=_0x0489('0x8f');logger[_0x0489('0x77')](_0x0489('0x90'),_0x55762c[_0x0489('0x4d')],_0x55762c[_0x0489('0x5a')]);}}}catch(_0x276d91){logger['error'](_0x0489('0x8e'),_0x295764['uniqueid'],util[_0x0489('0x40')](_0x276d91,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0489('0x1e')]=function(_0x41b3e5){try{if(this[_0x0489('0x62')](_0x41b3e5)){logger[_0x0489('0x48')]('[%s][voiceQueueReport][agentcomplete]',_0x41b3e5[_0x0489('0x4a')],util['inspect'](_0x41b3e5,{'showHidden':![],'depth':null}));if(this[_0x0489('0xe')][_0x41b3e5[_0x0489('0x4a')]]){var _0x4dd871=_['last'](this[_0x0489('0xe')][_0x41b3e5['uniqueid']]);_0x4dd871[_0x0489('0x19')]=![];_0x4dd871[_0x0489('0x84')]=null;_0x4dd871[_0x0489('0x91')]=!![];_0x4dd871['lastAssignedTo']=_0x41b3e5[_0x0489('0x92')];_0x4dd871[_0x0489('0x82')]=_0x41b3e5[_0x0489('0x82')];_0x4dd871[_0x0489('0x80')]=!![];_0x4dd871[_0x0489('0x93')]=![];_0x4dd871['queuecallerexitAt']=null;if(!_0x4dd871[_0x0489('0x94')]){if(_0x41b3e5['reason']=='transfer'){_0x4dd871['queuecallerexitreason']=_0x0489('0x95');logger['info'](_0x0489('0x96'),_0x4dd871[_0x0489('0x4d')],_0x4dd871[_0x0489('0x5a')]);}else{if(_[_0x0489('0x97')](_0x41b3e5[_0x0489('0x3a')][_0x0489('0x98')](),_0x0489('0x99'))){if(this[_0x0489('0xe')][_0x41b3e5['linkedid']]){var _0x2bad1b=_[_0x0489('0x7f')](this[_0x0489('0xe')][_0x41b3e5[_0x0489('0x9a')]]);_0x2bad1b[_0x0489('0x80')]=![];_0x2bad1b[_0x0489('0x93')]=!![];_0x2bad1b[_0x0489('0x9b')]=moment(_0x4dd871[_0x0489('0x73')])[_0x0489('0x9c')](_0x41b3e5[_0x0489('0x82')],_0x0489('0x9d'))[_0x0489('0x4b')](_0x0489('0x74'));_0x2bad1b[_0x0489('0x85')]=_0x0489('0x9e');_0x2bad1b['transfer']=!![];_0x2bad1b[_0x0489('0x9f')]=_0x0489('0xa0');_0x2bad1b[_0x0489('0xa1')]=_0x41b3e5[_0x0489('0xa2')];_0x2bad1b['transferuniqueid']=_0x41b3e5['uniqueid'];logger[_0x0489('0x77')](_0x0489('0xa3'),_0x2bad1b[_0x0489('0x4d')],_0x2bad1b[_0x0489('0x5a')]);var _0x581490=this[_0x0489('0xe')][_0x41b3e5[_0x0489('0x9a')]];this[_0x0489('0xe')][_0x41b3e5[_0x0489('0x9a')]]=this[_0x0489('0xe')][_0x41b3e5[_0x0489('0x4a')]];this['queueReports'][_0x41b3e5[_0x0489('0x4a')]]=_0x581490;}}else{_0x4dd871[_0x0489('0x85')]='COMPLETEDBY'+_0x41b3e5[_0x0489('0xa4')][_0x0489('0xa5')]();logger[_0x0489('0x77')](_0x0489('0xa6'),_0x4dd871[_0x0489('0x4d')],_0x4dd871['type'],_0x4dd871[_0x0489('0x85')]);}}}this[_0x0489('0x10')][_0x41b3e5['uniqueid']]=_0x4dd871;this[_0x0489('0x44')](_0x4dd871,_0x0489('0x1d'));}}}catch(_0x573863){logger[_0x0489('0x3e')](_0x0489('0xa7'),_0x41b3e5[_0x0489('0x4a')],util['inspect'](_0x573863,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0489('0x9')][_0x0489('0x22')]=function(_0xcbd539){try{if(this[_0x0489('0x62')](_0xcbd539)){logger[_0x0489('0x48')](_0x0489('0xa8'),_0xcbd539['uniqueid'],util[_0x0489('0x40')](_0xcbd539,{'showHidden':![],'depth':null}));this[_0x0489('0xa9')](_0xcbd539[_0x0489('0x4a')],_[_0x0489('0x7b')](_0xcbd539[_0x0489('0xaa')])[0x0],_0xcbd539[_0x0489('0xab')]);if(this[_0x0489('0xe')][_0xcbd539[_0x0489('0x4a')]]){var _0x44c786=_[_0x0489('0x7f')](this['queueReports'][_0xcbd539['uniqueid']]);if(_0x44c786){if(this['isNotNull'](_0xcbd539[_0x0489('0xaa')])&&this[_0x0489('0x62')](_0xcbd539[_0x0489('0xaa')][_0x0489('0xac')])){switch(_0xcbd539['value']){case _0x0489('0xad'):_0x44c786[_0x0489('0x93')]=![];_0x44c786[_0x0489('0x9b')]=null;break;case _0x0489('0xae'):_0x44c786['lastevent']=_0x0489('0xaf');_0x44c786[_0x0489('0x93')]=!![];_0x44c786[_0x0489('0x9b')]=moment()[_0x0489('0x4b')](_0x0489('0x74'));_0x44c786[_0x0489('0x8a')]=moment()[_0x0489('0x4b')](_0x0489('0x74'));logger['debug'](_0x0489('0xb0'),_0xcbd539[_0x0489('0x4a')],util['inspect'](_0x44c786,{'showHidden':![],'depth':null}));ami[_0x0489('0x46')](_0x0489('0xb1'),_0x44c786);break;default:_0x44c786['queuecallerexit']=!![];_0x44c786[_0x0489('0x9b')]=moment()[_0x0489('0x4b')](_0x0489('0x74'));_0x44c786[_0x0489('0x8a')]=moment()[_0x0489('0x4b')](_0x0489('0x74'));}_0x44c786[_0x0489('0x19')]=![];_0x44c786['queuecallerabandonAt']=null;_0x44c786['queuecallerexitreason']=_0xcbd539[_0x0489('0xab')];this[_0x0489('0x10')][_0xcbd539['uniqueid']]=_0x44c786;this[_0x0489('0x44')](_0x44c786,_0x0489('0x21'));}else if(this[_0x0489('0x62')](_0xcbd539['variable'])&&this['isNotNull'](_0xcbd539[_0x0489('0xaa')][_0x0489('0xb2')])){if(!_0x44c786[_0x0489('0x19')]){_0x44c786[_0x0489('0x93')]=!![];_0x44c786['queuecallerexitAt']=moment()[_0x0489('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x44c786[_0x0489('0x85')]=_0x0489('0xb3');_0x44c786[_0x0489('0x8a')]=moment()[_0x0489('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xcbd539[_0x0489('0x4a')]]=_0x44c786;}}logger[_0x0489('0x77')](_0x0489('0xb4'),_0xcbd539[_0x0489('0x4a')],_0x44c786['name'],_0x44c786[_0x0489('0x5a')],_[_0x0489('0x7b')](_0xcbd539[_0x0489('0xaa')])[0x0],_0xcbd539['value']);_0x44c786[_0x0489('0x15')]=this['variables'][_0xcbd539[_0x0489('0x4a')]];}}}}catch(_0x401c71){logger['error'](_0x0489('0xa8'),_0xcbd539[_0x0489('0x4a')],util[_0x0489('0x40')](_0x401c71,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0489('0x9')][_0x0489('0xa9')]=function(_0x4286e1,_0xc61cb,_0x5ac2c1){var _0x3824fe=[_0x0489('0xb5'),_0x0489('0xb6'),'rtpaudioqosjitter',_0x0489('0xb7'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x0489('0xb8'),_0x0489('0xb9'),'sipuri','bridgepeer',_0x0489('0xba'),_0x0489('0xbb'),_0x0489('0xbc'),_0x0489('0xbd'),_0x0489('0xbe'),_0x0489('0x92'),_0x0489('0xbf'),'memberrealtime'];if(!_[_0x0489('0x37')](_0xc61cb)&&!_[_0x0489('0xc0')](_0x3824fe,_0xc61cb)){if(_[_0x0489('0x63')](this[_0x0489('0x15')][_0x4286e1])){this['variables'][_0x4286e1]={};}this[_0x0489('0x15')][_0x4286e1][_0xc61cb]=_0x5ac2c1;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x25bed4){try{if(this[_0x0489('0x62')](_0x25bed4)){logger[_0x0489('0x48')](_0x0489('0xc1'),_0x25bed4[_0x0489('0x4a')],util['inspect'](_0x25bed4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x25bed4[_0x0489('0x4a')]]){for(var _0x20fcd9=0x0,_0xf6d4e6={};_0x20fcd9=0x0?moment(_0x2fd973[_0x8b1b('0x17')])[_0x8b1b('0x18')](_0x2fd973['starttime'],'seconds'):null,'data1':_0x8b1b('0x19'),'data2':_0x2fd973['accountcode'],'data3':_0x2fd973[_0x8b1b('0x1a')],'data4':_0x2fd973['dialstring']||null,'role':'agent','internal':_0x2fd973[_0x8b1b('0x12')]?_[_0x8b1b('0x1b')](_0x2fd973[_0x8b1b('0x12')]):undefined,'uniqueid':_0x2fd973[_0x8b1b('0x13')]},'log':_0x8b1b('0x5')});}; \ No newline at end of file +var _0x9769=['voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','queue','agent','accountcode','membername','starttime','outbound','exten','uniqueid','CreateMemberReport','moment','lodash','util','../client','Request'];(function(_0x259a6f,_0x2696b1){var _0x191ecf=function(_0x2a4798){while(--_0x2a4798){_0x259a6f['push'](_0x259a6f['shift']());}};_0x191ecf(++_0x2696b1);}(_0x9769,0xa3));var _0x9976=function(_0x11fbd3,_0x25b4a2){_0x11fbd3=_0x11fbd3-0x0;var _0x42ce85=_0x9769[_0x11fbd3];return _0x42ce85;};'use strict';var moment=require(_0x9976('0x0'));var _=require(_0x9976('0x1'));var util=require(_0x9976('0x2'));var client=require(_0x9976('0x3'));exports['voiceQueueReport']=function(_0x5bcedc){var _0x566c11=_0x5bcedc['queuecallercompleteAt']||_0x5bcedc['queuecallerexitAt'];return client[_0x9976('0x4')]('CreateMemberReport',{'body':{'channel':_0x9976('0x5'),'membername':_0x5bcedc[_0x9976('0x6')],'interface':_[_0x9976('0x7')](_0x5bcedc[_0x9976('0x8')])?util[_0x9976('0x9')](_0x9976('0xa'),_0x5bcedc[_0x9976('0x6')]):_0x5bcedc[_0x9976('0x8')],'type':_0x9976('0xb'),'enterAt':_0x5bcedc[_0x9976('0xc')],'exitAt':_0x566c11,'duration':moment(_0x566c11)[_0x9976('0xd')](_0x5bcedc['queuecallerleaveAt'],_0x9976('0xe')),'data1':'inbound','data2':_0x5bcedc['calleridnum'],'data3':_0x5bcedc['exten'],'data4':null,'data5':_0x5bcedc[_0x9976('0xf')],'role':_0x9976('0x10'),'internal':_0x5bcedc[_0x9976('0x11')]?_['toNumber'](_0x5bcedc[_0x9976('0x11')]):undefined,'uniqueid':_0x5bcedc['uniqueid']},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x3f42f0){return client[_0x9976('0x4')]('CreateMemberReport',{'body':{'channel':_0x9976('0x5'),'membername':_0x3f42f0[_0x9976('0x12')],'interface':_0x3f42f0['interface'],'type':_0x9976('0xb'),'enterAt':_0x3f42f0[_0x9976('0x13')],'exitAt':_0x3f42f0['endtime'],'duration':moment(_0x3f42f0['endtime'])[_0x9976('0xd')](_0x3f42f0[_0x9976('0x13')],_0x9976('0xe'))>=0x0?moment(_0x3f42f0['endtime'])[_0x9976('0xd')](_0x3f42f0[_0x9976('0x13')],_0x9976('0xe')):null,'data1':_0x9976('0x14'),'data2':_0x3f42f0[_0x9976('0x11')],'data3':_0x3f42f0[_0x9976('0x15')],'data4':_0x3f42f0['dialstring']||null,'role':_0x9976('0x10'),'internal':_0x3f42f0[_0x9976('0x11')]?_['toNumber'](_0x3f42f0[_0x9976('0x11')]):undefined,'uniqueid':_0x3f42f0[_0x9976('0x16')]},'log':_0x9976('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 0a5b3c5..37e76bd 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 _0x5106=['stopRecordingOnTransfer','GetSettings','../client','Request'];(function(_0x577fc0,_0x332c44){var _0x43b48b=function(_0x576065){while(--_0x576065){_0x577fc0['push'](_0x577fc0['shift']());}};_0x43b48b(++_0x332c44);}(_0x5106,0x116));var _0x6510=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5106[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x6510('0x0'));exports['getSettings']=function(){return client[_0x6510('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6510('0x2')]},'log':_0x6510('0x3')});}; \ No newline at end of file +var _0x91ff=['stopRecordingOnTransfer','Request'];(function(_0x27fd7d,_0x753c58){var _0x10bfde=function(_0x3032a2){while(--_0x3032a2){_0x27fd7d['push'](_0x27fd7d['shift']());}};_0x10bfde(++_0x753c58);}(_0x91ff,0x15b));var _0xf91f=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x91ff[_0x34843e];return _0x598f7f;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xf91f('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf91f('0x1')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5bd1606..883192b 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 _0xaf60=['GetTemplate','../client','getTemplates'];(function(_0x24c086,_0x58503a){var _0x437816=function(_0x5ca169){while(--_0x5ca169){_0x24c086['push'](_0x24c086['shift']());}};_0x437816(++_0x58503a);}(_0xaf60,0x82));var _0x0af6=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xaf60[_0x2cfb58];return _0xd99951;};'use strict';var client=require(_0x0af6('0x0'));exports[_0x0af6('0x1')]=function(_0x1d4941){return function(_0x5073d8){return client['Request'](_0x0af6('0x2'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0x0af6('0x2')});};}; \ No newline at end of file +var _0xc113=['html','../client','getTemplates','Request','GetTemplate','name'];(function(_0x5a78d9,_0x4d2108){var _0x5b1b0f=function(_0x3cc522){while(--_0x3cc522){_0x5a78d9['push'](_0x5a78d9['shift']());}};_0x5b1b0f(++_0x4d2108);}(_0xc113,0x1ab));var _0x3c11=function(_0x575bf9,_0x5298fe){_0x575bf9=_0x575bf9-0x0;var _0x4ec71f=_0xc113[_0x575bf9];return _0x4ec71f;};'use strict';var client=require(_0x3c11('0x0'));exports[_0x3c11('0x1')]=function(_0x38620a){return function(_0x35905c){return client[_0x3c11('0x2')](_0x3c11('0x3'),{'options':{'raw':!![],'attributes':['id',_0x3c11('0x4'),_0x3c11('0x5')]},'log':_0x3c11('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 265039f..98330bd 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 _0x5aa8=['status','Condition','AllConditions','field','operator','value','AnyConditions','Action','action','data1','data2','data3','data4','data5','data6','data7','GetTrigger','getTriggers','name'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x5aa8,0x83));var _0x85aa=function(_0x3fa582,_0x3d38ea){_0x3fa582=_0x3fa582-0x0;var _0x55e7cf=_0x5aa8[_0x3fa582];return _0x55e7cf;};'use strict';var client=require('../client');exports[_0x85aa('0x0')]=function(_0x4074f9){return function(_0x13a5cd){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x85aa('0x1'),'channel',_0x85aa('0x2')],'include':[{'model':_0x85aa('0x3'),'as':_0x85aa('0x4'),'attributes':['id',_0x85aa('0x5'),_0x85aa('0x6'),_0x85aa('0x7')]},{'model':'Condition','as':_0x85aa('0x8'),'attributes':['id','field',_0x85aa('0x6'),_0x85aa('0x7')]},{'model':_0x85aa('0x9'),'as':'Actions','attributes':['id',_0x85aa('0xa'),_0x85aa('0xb'),_0x85aa('0xc'),_0x85aa('0xd'),_0x85aa('0xe'),_0x85aa('0xf'),_0x85aa('0x10'),_0x85aa('0x11')]}]},'log':_0x85aa('0x12')});};}; \ No newline at end of file +var _0xc9a0=['Condition','AllConditions','field','operator','AnyConditions','value','Actions','action','data1','data2','data3','data6','getTriggers','Request','GetTrigger','name','status'];(function(_0x1a416d,_0x6b32fe){var _0x1e3acf=function(_0xee395c){while(--_0xee395c){_0x1a416d['push'](_0x1a416d['shift']());}};_0x1e3acf(++_0x6b32fe);}(_0xc9a0,0x10b));var _0x0c9a=function(_0x41d961,_0x58911d){_0x41d961=_0x41d961-0x0;var _0x1d200c=_0xc9a0[_0x41d961];return _0x1d200c;};'use strict';var client=require('../client');exports[_0x0c9a('0x0')]=function(_0xa2e11a){return function(_0x39451f){return client[_0x0c9a('0x1')](_0x0c9a('0x2'),{'options':{'raw':![],'attributes':['id',_0x0c9a('0x3'),'channel',_0x0c9a('0x4')],'include':[{'model':_0x0c9a('0x5'),'as':_0x0c9a('0x6'),'attributes':['id',_0x0c9a('0x7'),_0x0c9a('0x8'),'value']},{'model':'Condition','as':_0x0c9a('0x9'),'attributes':['id','field','operator',_0x0c9a('0xa')]},{'model':'Action','as':_0x0c9a('0xb'),'attributes':['id',_0x0c9a('0xc'),_0x0c9a('0xd'),_0x0c9a('0xe'),_0x0c9a('0xf'),'data4','data5',_0x0c9a('0x10'),'data7']}]},'log':_0x0c9a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ee1c1a1..f84cb06 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 _0x8b50=['GetTrunk','../client','getTrunks','Request','registry','defaultuser'];(function(_0x4a779e,_0x27801a){var _0x38f12d=function(_0x54d42b){while(--_0x54d42b){_0x4a779e['push'](_0x4a779e['shift']());}};_0x38f12d(++_0x27801a);}(_0x8b50,0x13f));var _0x08b5=function(_0x4631b2,_0x521f57){_0x4631b2=_0x4631b2-0x0;var _0x354e56=_0x8b50[_0x4631b2];return _0x354e56;};'use strict';var client=require(_0x08b5('0x0'));exports[_0x08b5('0x1')]=function(_0x1dc009){return function(_0x39777b){return client[_0x08b5('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x08b5('0x3'),_0x08b5('0x4')]},'log':_0x08b5('0x5')});};}; \ No newline at end of file +var _0xaeab=['defaultuser','../client','Request','GetTrunk','name','registry'];(function(_0x556e75,_0x11a6ee){var _0x18f6e9=function(_0x6e3610){while(--_0x6e3610){_0x556e75['push'](_0x556e75['shift']());}};_0x18f6e9(++_0x11a6ee);}(_0xaeab,0x91));var _0xbaea=function(_0x41c15d,_0x25e188){_0x41c15d=_0x41c15d-0x0;var _0x5c5953=_0xaeab[_0x41c15d];return _0x5c5953;};'use strict';var client=require(_0xbaea('0x0'));exports['getTrunks']=function(_0x4aa896){return function(_0x5e8f3a){return client[_0xbaea('0x1')](_0xbaea('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xbaea('0x3'),_0xbaea('0x4'),_0xbaea('0x5')]},'log':_0xbaea('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index bb645dc..07c5a32 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x2245d2,_0x18f326){var _0x276daf=function(_0x556b19){while(--_0x556b19){_0x2245d2['push'](_0x2245d2['shift']());}};_0x276daf(++_0x18f326);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 5ba9639..2bb3373 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 _0x58ea=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x47edc4,_0x2f0791){var _0x131c8f=function(_0x531b83){while(--_0x531b83){_0x47edc4['push'](_0x47edc4['shift']());}};_0x131c8f(++_0x2f0791);}(_0x58ea,0xc2));var _0xa58e=function(_0x2d4d39,_0x3b50fb){_0x2d4d39=_0x2d4d39-0x0;var _0x580d16=_0x58ea[_0x2d4d39];return _0x580d16;};'use strict';var client=require(_0xa58e('0x0'));exports[_0xa58e('0x1')]=function(_0xdc0541){return client[_0xa58e('0x2')](_0xa58e('0x3'),{'body':_0xdc0541,'log':_0xa58e('0x3')});};exports[_0xa58e('0x4')]=function(_0x20fd6a,_0x4664b9,_0x2aa3e2){return client[_0xa58e('0x2')](_0xa58e('0x5'),{'body':_0x20fd6a,'options':{'where':{'uniqueid':_0x4664b9,'interface':_0x2aa3e2,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x575a=['Request','update','UpdateVoiceAgentReport','../client','create'];(function(_0x4da078,_0x236aa5){var _0x582a1b=function(_0x1959b1){while(--_0x1959b1){_0x4da078['push'](_0x4da078['shift']());}};_0x582a1b(++_0x236aa5);}(_0x575a,0x1ca));var _0xa575=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x575a[_0x5f0501];return _0x3c2c45;};'use strict';var client=require(_0xa575('0x0'));exports[_0xa575('0x1')]=function(_0x3c209b){return client[_0xa575('0x2')]('CreateVoiceAgentReport',{'body':_0x3c209b,'log':'CreateVoiceAgentReport'});};exports[_0xa575('0x3')]=function(_0x274614,_0x50f5aa,_0x94a0c3){return client['Request'](_0xa575('0x4'),{'body':_0x274614,'options':{'where':{'uniqueid':_0x50f5aa,'interface':_0x94a0c3,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7d96455..f6046ba 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 _0xcfae=['context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','type','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcfae,0x1d3));var _0xecfa=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xcfae[_0x1ddedd];return _0xa3e1ac;};'use strict';var moment=require(_0xecfa('0x0'));var util=require(_0xecfa('0x1'));var _=require(_0xecfa('0x2'));var client=require(_0xecfa('0x3'));exports['create']=function(_0x2d6ca7){return client[_0xecfa('0x4')](_0xecfa('0x5'),{'body':_[_0xecfa('0x6')](_0x2d6ca7,{'source':_0x2d6ca7[_0xecfa('0x7')],'destinationcontext':_0x2d6ca7[_0xecfa('0x8')],'callerid':_0x2d6ca7['callerid'],'amaflags':_0xecfa('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0xecfa('0xa')]=function(){return function(){return client[_0xecfa('0x4')](_0xecfa('0xb'),{'options':{'where':{'type':[_0xecfa('0xc')],'createdAt':{'$between':[moment()[_0xecfa('0xd')](_0xecfa('0xe'))[_0xecfa('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xecfa('0xe'))[_0xecfa('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xecfa('0x10'),'disposition','duration',_0xecfa('0x11')]},'log':_0xecfa('0x12')});};}; \ No newline at end of file +var _0x1504=['YYYY-MM-DD\x20HH:mm:ss','billableseconds','GetVoiceCallReports','util','lodash','../client','merge','context','CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','day','format'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1504,0x7b));var _0x4150=function(_0x1ff804,_0x263135){_0x1ff804=_0x1ff804-0x0;var _0x3454b8=_0x1504[_0x1ff804];return _0x3454b8;};'use strict';var moment=require('moment');var util=require(_0x4150('0x0'));var _=require(_0x4150('0x1'));var client=require(_0x4150('0x2'));exports['create']=function(_0x54b180){return client['Request']('CreateVoiceCallReport',{'body':_[_0x4150('0x3')](_0x54b180,{'source':_0x54b180['calleridnum'],'destinationcontext':_0x54b180[_0x4150('0x4')],'callerid':_0x54b180['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x4150('0x5')});};exports[_0x4150('0x6')]=function(){return function(){return client[_0x4150('0x7')](_0x4150('0x8'),{'options':{'where':{'type':[_0x4150('0x9')],'createdAt':{'$between':[moment()['startOf'](_0x4150('0xa'))[_0x4150('0xb')](_0x4150('0xc')),moment()['endOf']('day')[_0x4150('0xb')](_0x4150('0xc'))]}},'attributes':['type','disposition','duration',_0x4150('0xd')]},'log':_0x4150('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index e3bbc29..e868138 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 _0xd793=['create','Request','CreateVoiceDialReport','../client'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd793,0xb3));var _0x3d79=function(_0x18f0bd,_0x2675c3){_0x18f0bd=_0x18f0bd-0x0;var _0x314678=_0xd793[_0x18f0bd];return _0x314678;};'use strict';var client=require(_0x3d79('0x0'));exports[_0x3d79('0x1')]=function(_0x5521ac){return client[_0x3d79('0x2')](_0x3d79('0x3'),{'body':_0x5521ac,'log':_0x3d79('0x3')});}; \ No newline at end of file +var _0x609b=['CreateVoiceDialReport','../client','create'];(function(_0x56ee80,_0x484051){var _0x4a6381=function(_0x28b3fa){while(--_0x28b3fa){_0x56ee80['push'](_0x56ee80['shift']());}};_0x4a6381(++_0x484051);}(_0x609b,0x1d5));var _0xb609=function(_0xae460,_0x95fb98){_0xae460=_0xae460-0x0;var _0x512da4=_0x609b[_0xae460];return _0x512da4;};'use strict';var client=require(_0xb609('0x0'));exports[_0xb609('0x1')]=function(_0xd07a7){return client['Request'](_0xb609('0x2'),{'body':_0xd07a7,'log':_0xb609('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 21483a2..e724a38 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 _0xee4e=['../client','getVoiceExtensions','Request','exten','recordingFormat'];(function(_0x1fe1a5,_0x1f96cf){var _0x1378a8=function(_0xad8425){while(--_0xad8425){_0x1fe1a5['push'](_0x1fe1a5['shift']());}};_0x1378a8(++_0x1f96cf);}(_0xee4e,0x122));var _0xeee4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xee4e[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xeee4('0x0'));exports[_0xeee4('0x1')]=function(){return function(){return client[_0xeee4('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xeee4('0x3'),_0xeee4('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xeee4('0x1')});};}; \ No newline at end of file +var _0x9086=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9086,0x10b));var _0x6908=function(_0x35f035,_0x4e66c6){_0x35f035=_0x35f035-0x0;var _0x1b4ef3=_0x9086[_0x35f035];return _0x1b4ef3;};'use strict';var client=require(_0x6908('0x0'));exports[_0x6908('0x1')]=function(){return function(){return client['Request'](_0x6908('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6908('0x3'),_0x6908('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x6908('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index e5eecbb..f4d3c64 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 _0x109a=['acwTimeout','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0x109a,0x16f));var _0xa109=function(_0x2ea404,_0x2dc68f){_0x2ea404=_0x2ea404-0x0;var _0x4fe5ab=_0x109a[_0x2ea404];return _0x4fe5ab;};'use strict';var client=require(_0xa109('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xa109('0x1')](_0xa109('0x2'),{'options':{'raw':![],'attributes':['id',_0xa109('0x3'),_0xa109('0x4'),_0xa109('0x5'),'autopause','monitor_format','type','dialActive',_0xa109('0x6'),_0xa109('0x7'),_0xa109('0x8'),_0xa109('0x9'),'dialPredictiveOptimization',_0xa109('0xa'),'dialPredictiveInterval',_0xa109('0xb'),_0xa109('0xc'),_0xa109('0xd'),_0xa109('0xe'),_0xa109('0xf'),_0xa109('0x10'),'dialCongestionMaxRetry',_0xa109('0x11'),'dialBusyMaxRetry',_0xa109('0x12'),_0xa109('0x13'),_0xa109('0x14'),_0xa109('0x15'),_0xa109('0x16'),_0xa109('0x17'),_0xa109('0x18'),_0xa109('0x19'),_0xa109('0x1a'),'dialAMDInitialSilence',_0xa109('0x1b'),_0xa109('0x1c'),'dialAMDTotalAnalysisTime',_0xa109('0x1d'),_0xa109('0x1e'),_0xa109('0x1f'),_0xa109('0x20'),'dialAMDMaximumWordLength',_0xa109('0x21'),_0xa109('0x22'),_0xa109('0x23'),_0xa109('0x24'),_0xa109('0x25'),_0xa109('0x26'),_0xa109('0x27'),_0xa109('0x28'),_0xa109('0x29'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0xa109('0x2a'),_0xa109('0x2b'),_0xa109('0x2c'),'dialDropRetryFrequency',_0xa109('0x2d'),_0xa109('0x2e'),_0xa109('0x2f'),_0xa109('0x30'),'dialAgentRejectMaxRetry',_0xa109('0x31'),_0xa109('0x32'),_0xa109('0x33'),_0xa109('0x34')],'include':[{'model':_0xa109('0x35'),'as':'Trunk','attributes':['id',_0xa109('0x3'),_0xa109('0x36'),_0xa109('0x37')]},{'model':_0xa109('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0xa109('0x3')]},{'model':_0xa109('0x35'),'as':_0xa109('0x39'),'attributes':['id',_0xa109('0x3'),_0xa109('0x36'),_0xa109('0x37')]},{'model':_0xa109('0x3a'),'as':_0xa109('0x3a'),'attributes':['id',_0xa109('0x3')],'include':[{'model':_0xa109('0x3a'),'as':_0xa109('0x3b'),'attributes':['id','name',_0xa109('0x3c')]}]}]},'log':_0xa109('0x3d')});};}; \ No newline at end of file +var _0x1035=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0x1035,0x1c8));var _0x5103=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0x1035[_0x12aaee];return _0x37c350;};'use strict';var client=require(_0x5103('0x0'));exports[_0x5103('0x1')]=function(){return function(){return client[_0x5103('0x2')](_0x5103('0x3'),{'options':{'raw':![],'attributes':['id',_0x5103('0x4'),_0x5103('0x5'),_0x5103('0x6'),_0x5103('0x7'),_0x5103('0x8'),_0x5103('0x9'),_0x5103('0xa'),_0x5103('0xb'),_0x5103('0xc'),_0x5103('0xd'),_0x5103('0xe'),_0x5103('0xf'),_0x5103('0x10'),_0x5103('0x11'),_0x5103('0x12'),_0x5103('0x13'),'dialOriginateTimeout',_0x5103('0x14'),'dialQueueTimeout',_0x5103('0x15'),'dialCongestionMaxRetry',_0x5103('0x16'),'dialBusyMaxRetry',_0x5103('0x17'),'dialNoAnswerMaxRetry',_0x5103('0x18'),_0x5103('0x19'),_0x5103('0x1a'),_0x5103('0x1b'),_0x5103('0x1c'),_0x5103('0x1d'),'dialAMDActive',_0x5103('0x1e'),'dialAMDGreeting',_0x5103('0x1f'),_0x5103('0x20'),_0x5103('0x21'),_0x5103('0x22'),_0x5103('0x23'),_0x5103('0x24'),_0x5103('0x25'),_0x5103('0x26'),_0x5103('0x27'),'dialRecallInQueue',_0x5103('0x28'),_0x5103('0x29'),'dialAgiAfterHangupClient','dialQueueProject2',_0x5103('0x8'),_0x5103('0x2a'),_0x5103('0x2b'),'dialCutDigit',_0x5103('0x2c'),_0x5103('0x2d'),_0x5103('0x2e'),_0x5103('0x2f'),'dialAbandonedMaxRetry',_0x5103('0x30'),_0x5103('0x31'),_0x5103('0x32'),_0x5103('0x33'),_0x5103('0x34'),_0x5103('0x35'),_0x5103('0x36'),_0x5103('0x37')],'include':[{'model':_0x5103('0x38'),'as':_0x5103('0x38'),'attributes':['id',_0x5103('0x4'),_0x5103('0x39'),_0x5103('0x3a')]},{'model':_0x5103('0x3b'),'as':'mandatoryDispositionPause','attributes':['id',_0x5103('0x4')]},{'model':_0x5103('0x38'),'as':_0x5103('0x3c'),'attributes':['id',_0x5103('0x4'),_0x5103('0x39'),_0x5103('0x3a')]},{'model':_0x5103('0x3d'),'as':_0x5103('0x3d'),'attributes':['id',_0x5103('0x4')],'include':[{'model':_0x5103('0x3d'),'as':'Intervals','attributes':['id',_0x5103('0x4'),_0x5103('0x3e')]}]}]},'log':_0x5103('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4c1cd4d..be7e9ff 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(_0x488710,_0x5e5d23){var _0x1a9aa1=function(_0x149f70){while(--_0x149f70){_0x488710['push'](_0x488710['shift']());}};_0x1a9aa1(++_0x5e5d23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +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(_0x1e9487,_0x4f5e1f){var _0x308290=function(_0x2b75b8){while(--_0x2b75b8){_0x1e9487['push'](_0x1e9487['shift']());}};_0x308290(++_0x4f5e1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 68e8af8..f6298cc 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 _0x9581=['getVoiceQueueRtPauses','Request','../client'];(function(_0xd3bc07,_0x3a11a5){var _0x10aa85=function(_0xb8f14e){while(--_0xb8f14e){_0xd3bc07['push'](_0xd3bc07['shift']());}};_0x10aa85(++_0x3a11a5);}(_0x9581,0xbf));var _0x1958=function(_0x3ff1a1,_0x5f37d5){_0x3ff1a1=_0x3ff1a1-0x0;var _0x50200a=_0x9581[_0x3ff1a1];return _0x50200a;};'use strict';var client=require(_0x1958('0x0'));exports[_0x1958('0x1')]=function(_0x4f3fed){return function(){return client[_0x1958('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4f3fed,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x383d=['GetVoiceQueueRtPauses','Request'];(function(_0xf000b4,_0x558f29){var _0x4f4e00=function(_0x305199){while(--_0x305199){_0xf000b4['push'](_0xf000b4['shift']());}};_0x4f4e00(++_0x558f29);}(_0x383d,0xd3));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x3180f1){return function(){return client[_0xd383('0x0')](_0xd383('0x1'),{'options':{'where':{'VoiceQueueId':_0x3180f1,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index a73c1b1..607e18b 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(_0x5a0154,_0x2c2b91){var _0x41a102=function(_0x9cdfeb){while(--_0x9cdfeb){_0x5a0154['push'](_0x5a0154['shift']());}};_0x41a102(++_0x2c2b91);}(_0x7a54,0x106));var _0x47a5=function(_0x585405,_0x4b0cd2){_0x585405=_0x585405-0x0;var _0x5b599b=_0x7a54[_0x585405];return _0x5b599b;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4696cd,_0x27d29a){var _0xe32859=function(_0x9dc5a6){while(--_0x9dc5a6){_0x4696cd['push'](_0x4696cd['shift']());}};_0xe32859(++_0x27d29a);}(_0x7a54,0x106));var _0x47a5=function(_0x299909,_0x16791b){_0x299909=_0x299909-0x0;var _0x5e690c=_0x7a54[_0x299909];return _0x5e690c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 206f3d6..a428688 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 _0xefcb=['transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x5120f5,_0xcce456){var _0x3eef9e=function(_0x5f372d){while(--_0x5f372d){_0x5120f5['push'](_0x5120f5['shift']());}};_0x3eef9e(++_0xcce456);}(_0xefcb,0x1e4));var _0xbefc=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xefcb[_0x2d7f0e];return _0x110b07;};'use strict';var client=require(_0xbefc('0x0'));exports[_0xbefc('0x1')]={};exports[_0xbefc('0x2')]=function(_0x1d1118){return client['Request'](_0xbefc('0x3'),{'body':{'result':_0x1d1118['result'],'transfererchannel':_0x1d1118[_0xbefc('0x4')],'transferercalleridnum':_0x1d1118['transferercalleridnum'],'transferercalleridname':_0x1d1118[_0xbefc('0x5')],'transfererconnectedlinenum':_0x1d1118[_0xbefc('0x6')],'transfererconnectedlinename':_0x1d1118['transfererconnectedlinename'],'transfereraccountcode':_0x1d1118[_0xbefc('0x7')],'transferercontext':_0x1d1118[_0xbefc('0x8')],'transfererexten':_0x1d1118[_0xbefc('0x9')],'transfererlinkedid':_0x1d1118[_0xbefc('0xa')],'transfereechannel':_0x1d1118[_0xbefc('0xb')],'transfereecalleridnum':_0x1d1118[_0xbefc('0xc')],'transfereecalleridname':_0x1d1118['transfereecalleridname'],'transfereeconnectedlinenum':_0x1d1118[_0xbefc('0xd')],'transfereeconnectedlinename':_0x1d1118[_0xbefc('0xe')],'transfereeaccountcode':_0x1d1118['transfereeaccountcode'],'transfereecontext':_0x1d1118['transfereecontext'],'transfereeexten':_0x1d1118['transfereeexten'],'transfereelinkedid':_0x1d1118['transfereelinkedid'],'isexternal':_0x1d1118[_0xbefc('0xf')],'context':_0x1d1118[_0xbefc('0x10')],'extension':_0x1d1118[_0xbefc('0x11')],'type':_0xbefc('0x12')},'log':_0xbefc('0x3')});};exports[_0xbefc('0x13')]=function(_0x20a289){return client['Request'](_0xbefc('0x3'),{'body':{'result':_0x20a289['result'],'transfererchannel':_0x20a289[_0xbefc('0x14')],'transferercalleridnum':_0x20a289[_0xbefc('0x15')],'transferercalleridname':_0x20a289[_0xbefc('0x16')],'transfererconnectedlinenum':_0x20a289[_0xbefc('0x17')],'transfererconnectedlinename':_0x20a289[_0xbefc('0x18')],'transfereraccountcode':_0x20a289[_0xbefc('0x19')],'transferercontext':_0x20a289[_0xbefc('0x1a')],'transfererexten':_0x20a289[_0xbefc('0x1b')],'transfererlinkedid':_0x20a289[_0xbefc('0x1c')],'transfereechannel':_0x20a289[_0xbefc('0x1d')],'transfereecalleridnum':_0x20a289[_0xbefc('0x1e')],'transfereecalleridname':_0x20a289[_0xbefc('0x1f')],'transfereeconnectedlinenum':_0x20a289[_0xbefc('0x20')],'transfereeconnectedlinename':_0x20a289[_0xbefc('0x21')],'transfereeaccountcode':_0x20a289[_0xbefc('0x22')],'transfereecontext':_0x20a289[_0xbefc('0x23')],'transfereeexten':_0x20a289[_0xbefc('0x24')],'transfereelinkedid':_0x20a289[_0xbefc('0x25')],'isexternal':_0x20a289[_0xbefc('0xf')],'context':_0x20a289['origtransferercontext'],'extension':_0x20a289[_0xbefc('0x26')],'type':_0xbefc('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x2f55=['transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext'];(function(_0x5643fc,_0xc7d223){var _0x10a3f2=function(_0x3a48ca){while(--_0x3a48ca){_0x5643fc['push'](_0x5643fc['shift']());}};_0x10a3f2(++_0xc7d223);}(_0x2f55,0x85));var _0x52f5=function(_0x66cbd9,_0x2a6844){_0x66cbd9=_0x66cbd9-0x0;var _0x19a47c=_0x2f55[_0x66cbd9];return _0x19a47c;};'use strict';var client=require(_0x52f5('0x0'));exports[_0x52f5('0x1')]={};exports[_0x52f5('0x2')]=function(_0x1b3e5c){return client[_0x52f5('0x3')](_0x52f5('0x4'),{'body':{'result':_0x1b3e5c[_0x52f5('0x5')],'transfererchannel':_0x1b3e5c[_0x52f5('0x6')],'transferercalleridnum':_0x1b3e5c[_0x52f5('0x7')],'transferercalleridname':_0x1b3e5c[_0x52f5('0x8')],'transfererconnectedlinenum':_0x1b3e5c[_0x52f5('0x9')],'transfererconnectedlinename':_0x1b3e5c[_0x52f5('0xa')],'transfereraccountcode':_0x1b3e5c[_0x52f5('0xb')],'transferercontext':_0x1b3e5c['transferercontext'],'transfererexten':_0x1b3e5c[_0x52f5('0xc')],'transfererlinkedid':_0x1b3e5c[_0x52f5('0xd')],'transfereechannel':_0x1b3e5c[_0x52f5('0xe')],'transfereecalleridnum':_0x1b3e5c[_0x52f5('0xf')],'transfereecalleridname':_0x1b3e5c[_0x52f5('0x10')],'transfereeconnectedlinenum':_0x1b3e5c[_0x52f5('0x11')],'transfereeconnectedlinename':_0x1b3e5c[_0x52f5('0x12')],'transfereeaccountcode':_0x1b3e5c['transfereeaccountcode'],'transfereecontext':_0x1b3e5c[_0x52f5('0x13')],'transfereeexten':_0x1b3e5c['transfereeexten'],'transfereelinkedid':_0x1b3e5c[_0x52f5('0x14')],'isexternal':_0x1b3e5c[_0x52f5('0x15')],'context':_0x1b3e5c[_0x52f5('0x16')],'extension':_0x1b3e5c[_0x52f5('0x17')],'type':_0x52f5('0x18')},'log':_0x52f5('0x4')});};exports[_0x52f5('0x19')]=function(_0x3ccfb8){return client[_0x52f5('0x3')](_0x52f5('0x4'),{'body':{'result':_0x3ccfb8[_0x52f5('0x5')],'transfererchannel':_0x3ccfb8[_0x52f5('0x1a')],'transferercalleridnum':_0x3ccfb8[_0x52f5('0x1b')],'transferercalleridname':_0x3ccfb8[_0x52f5('0x1c')],'transfererconnectedlinenum':_0x3ccfb8['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3ccfb8[_0x52f5('0x1d')],'transfereraccountcode':_0x3ccfb8[_0x52f5('0x1e')],'transferercontext':_0x3ccfb8[_0x52f5('0x1f')],'transfererexten':_0x3ccfb8[_0x52f5('0x20')],'transfererlinkedid':_0x3ccfb8[_0x52f5('0x21')],'transfereechannel':_0x3ccfb8[_0x52f5('0x22')],'transfereecalleridnum':_0x3ccfb8[_0x52f5('0x23')],'transfereecalleridname':_0x3ccfb8[_0x52f5('0x24')],'transfereeconnectedlinenum':_0x3ccfb8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3ccfb8['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3ccfb8[_0x52f5('0x25')],'transfereecontext':_0x3ccfb8[_0x52f5('0x26')],'transfereeexten':_0x3ccfb8[_0x52f5('0x27')],'transfereelinkedid':_0x3ccfb8['transfertargetlinkedid'],'isexternal':_0x3ccfb8['isexternal'],'context':_0x3ccfb8[_0x52f5('0x28')],'extension':_0x3ccfb8[_0x52f5('0x29')],'type':_0x52f5('0x2a')},'log':_0x52f5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 4867b9b..127443e 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 _0xbd0a=['wav','MixMonitor','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','validate','resolve','StopMixMonitor','destinationchannel','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','outboundChannels','outbound','run','event','emit','custom:','faxAccounts','send','checkAfterSend','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','error','asterisk','username','command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s'];(function(_0x6b41b9,_0x15b912){var _0x86b38d=function(_0x385bc0){while(--_0x385bc0){_0x6b41b9['push'](_0x6b41b9['shift']());}};_0x86b38d(++_0x15b912);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x48a3d4,_0x4f2e96){_0x48a3d4=_0x48a3d4-0x0;var _0x383d5d=_0xbd0a[_0x48a3d4];return _0x383d5d;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var jayson=require(_0xabd0('0x1'));var schema=require('validate');var BPromise=require('bluebird');var moment=require('moment');var config=require(_0xabd0('0x2'));var properties=require(_0xabd0('0x3'));var ami=require(_0xabd0('0x4'));exports[_0xabd0('0x5')]=function(_0x1a4ff4,_0x123d13,_0x221368){return new BPromise(function(_0xb41697,_0xe18a18){var _0x4ac4ad={'QueuePause':function(_0xf44097){return new Promise(function(_0xb60e77,_0x2b50c1){var _0x57f735=util[_0xabd0('0x6')]('%s/%s',_0xabd0('0x7'),_0xf44097[_0xabd0('0x8')]);if(_0x1a4ff4[_0xabd0('0x9')]&&_0x1a4ff4[_0xabd0('0x9')][_0x57f735]&&_0x1a4ff4['timers'][_0x57f735][_0xabd0('0xa')]){_0x1a4ff4['timers'][_0x57f735][_0xabd0('0xb')]();}if(_0x1a4ff4[_0xabd0('0xc')][_0x57f735]){_0x1a4ff4[_0xabd0('0xc')][_0x57f735][_0xabd0('0xd')]({'statePause':_0xf44097[_0xabd0('0xe')]?!![]:![]});}_0xb60e77({'code':0xc8,'message':_0xabd0('0xf')});});},'Reload':function(_0x5b0f34){var _0x3ae1a7=this;return new Promise(function(_0x4d8e19,_0x3586cf){if(ami[_0xabd0('0x10')]()==![]){return _0x3586cf(_0x3ae1a7['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0xabd0('0x11')][_0xabd0('0x12')]('\x20')));}_0x5b0f34=_[_0xabd0('0x13')](_0x5b0f34,_[_0xabd0('0x14')](properties[_0xabd0('0x15')]));_0x5b0f34[_0xabd0('0x16')]=_0xabd0('0x17');return ami[_0xabd0('0x18')](_0x5b0f34)[_0xabd0('0x19')](function(_0x543461){_0x4d8e19({'code':0xc8,'message':_0x543461[_0xabd0('0x1a')]});})['catch'](function(_0x579dcd){_0x3586cf(_0x3ae1a7[_0xabd0('0x1b')](0x1f5,_0x579dcd[_0xabd0('0x1a')]));});});},'Command':function(_0x3c5886){var _0x23f955=this;return new Promise(function(_0x495c6d,_0x862492){if(ami[_0xabd0('0x10')]()==![]){return _0x862492(_0x23f955['error'](0x1f4,[config['asterisk']['ip'],config[_0xabd0('0x1c')][_0xabd0('0x1d')],'ami\x20disconnected'][_0xabd0('0x12')]('\x20')));}_0x3c5886=_[_0xabd0('0x13')](_0x3c5886,_0xabd0('0x1e'));_0x3c5886[_0xabd0('0x16')]='Command';return ami[_0xabd0('0x18')](_0x3c5886)[_0xabd0('0x19')](function(_0x3376bc){_0x495c6d({'code':0xc8,'message':_0x3376bc[_0xabd0('0x1f')]});})[_0xabd0('0x20')](function(_0xf6dbad){_0x862492(_0x23f955[_0xabd0('0x1b')](0x1f5,_0xf6dbad[_0xabd0('0x1a')]));});});},'VoiceQueues':function(_0x187fc5){return new Promise(function(_0x20b73d,_0x52c8be){var _0x369dd0=[];for(var _0x2699c4 in _0x1a4ff4[_0xabd0('0x21')]){if(_0x1a4ff4[_0xabd0('0x21')][_0xabd0('0x22')](_0x2699c4)){var _0x399996=_0x1a4ff4[_0xabd0('0x21')][_0x2699c4];var _0x3a10d6={'id':_0x399996['id'],'name':_0x399996[_0xabd0('0x8')],'strategy':_0x399996[_0xabd0('0x23')],'answered':_0x399996[_0xabd0('0x24')],'available':_0x399996[_0xabd0('0x25')],'loggedIn':_0x399996[_0xabd0('0x26')],'pTalking':_0x399996[_0xabd0('0x27')],'sumBillable':_0x399996[_0xabd0('0x28')],'sumDuration':_0x399996[_0xabd0('0x29')],'sumHoldTime':_0x399996['sumHoldTime']||0x0,'talking':_0x399996[_0xabd0('0x2a')],'total':_0x399996[_0xabd0('0x2b')],'type':_0x399996[_0xabd0('0x2c')],'unmanaged':_0x399996[_0xabd0('0x2d')],'abandoned':_0x399996['abandoned'],'waiting':_0x399996[_0xabd0('0x2e')],'loggedInDb':_0x399996[_0xabd0('0x2f')]};if(_0x399996[_0xabd0('0x2c')]==='outbound'){_0x3a10d6[_0xabd0('0x30')]=_0x399996[_0xabd0('0x30')];_0x3a10d6['dialMethod']=_0x399996[_0xabd0('0x31')];_0x3a10d6['dialOriginateCallerIdName']=_0x399996[_0xabd0('0x32')];_0x3a10d6[_0xabd0('0x33')]=_0x399996[_0xabd0('0x33')];_0x3a10d6[_0xabd0('0x34')]=_0x399996[_0xabd0('0x34')];_0x3a10d6[_0xabd0('0x35')]=_0x399996['dialPrefix'];_0x3a10d6[_0xabd0('0x36')]=_0x399996[_0xabd0('0x36')];_0x3a10d6[_0xabd0('0x37')]=_0x399996[_0xabd0('0x37')];_0x3a10d6[_0xabd0('0x38')]=_0x399996[_0xabd0('0x38')];_0x3a10d6[_0xabd0('0x39')]=_0x399996[_0xabd0('0x39')];_0x3a10d6[_0xabd0('0x3a')]=_0x399996[_0xabd0('0x3a')];_0x3a10d6[_0xabd0('0x3b')]=_0x399996[_0xabd0('0x3b')];_0x3a10d6[_0xabd0('0x3c')]=_0x399996[_0xabd0('0x3c')];_0x3a10d6[_0xabd0('0x3d')]=_0x399996['outboundDropCallsDayCallersExit'];_0x3a10d6['outboundDropCallsDayTimeout']=_0x399996['outboundDropCallsDayTimeout'];_0x3a10d6[_0xabd0('0x3e')]=_0x399996[_0xabd0('0x3e')];_0x3a10d6[_0xabd0('0x3f')]=_0x399996[_0xabd0('0x3f')];_0x3a10d6[_0xabd0('0x40')]=_0x399996['outboundOriginateFailureCallsDay'];_0x3a10d6['outboundReCallsDay']=_0x399996['outboundReCallsDay'];_0x3a10d6[_0xabd0('0x41')]=_0x399996['outboundRejectCallsDay'];_0x3a10d6[_0xabd0('0x42')]=_0x399996[_0xabd0('0x42')];_0x3a10d6[_0xabd0('0x43')]=_0x399996[_0xabd0('0x43')];_0x3a10d6[_0xabd0('0x44')]=_0x399996[_0xabd0('0x44')];_0x3a10d6[_0xabd0('0x45')]=_0x399996[_0xabd0('0x45')];_0x3a10d6['predictiveIntervalDroppedCallsCallersExit']=_0x399996[_0xabd0('0x46')];_0x3a10d6['predictiveIntervalDroppedCallsTimeout']=_0x399996['predictiveIntervalDroppedCallsTimeout'];_0x3a10d6[_0xabd0('0x47')]=_0x399996[_0xabd0('0x47')];_0x3a10d6[_0xabd0('0x48')]=_0x399996[_0xabd0('0x48')];_0x3a10d6[_0xabd0('0x49')]=_0x399996['predictiveIntervalHitRate'];_0x3a10d6[_0xabd0('0x4a')]=_0x399996[_0xabd0('0x4a')];_0x3a10d6[_0xabd0('0x4b')]=_0x399996[_0xabd0('0x4b')];_0x3a10d6['predictiveIntervalAvailable']=_0x399996[_0xabd0('0x4c')];_0x3a10d6[_0xabd0('0x4d')]=_0x399996[_0xabd0('0x4d')];_0x3a10d6[_0xabd0('0x1a')]=_0x399996[_0xabd0('0x1a')];_0x3a10d6[_0xabd0('0x4e')]=_0x399996[_0xabd0('0x4e')];_0x3a10d6[_0xabd0('0x4f')]=_0x399996[_0xabd0('0x4f')];_0x3a10d6[_0xabd0('0x50')]=_0x399996[_0xabd0('0x50')];_0x3a10d6[_0xabd0('0x51')]=_0x399996[_0xabd0('0x51')];_0x3a10d6['erlangBusyFactor']=_0x399996[_0xabd0('0x52')];_0x3a10d6[_0xabd0('0x53')]=_0x399996[_0xabd0('0x53')];_0x3a10d6['startProgressive']=_0x399996['startProgressive'];}if(_0x399996[_0xabd0('0x54')]){_0x3a10d6[_0xabd0('0x54')]={'id':_0x399996[_0xabd0('0x54')]['id'],'name':_0x399996[_0xabd0('0x54')][_0xabd0('0x8')],'active':_0x399996['Trunk']['active'],'callerid':_0x399996[_0xabd0('0x54')][_0xabd0('0x55')]};}if(_0x399996[_0xabd0('0x56')]){_0x3a10d6[_0xabd0('0x56')]={'id':_0x399996[_0xabd0('0x56')]['id'],'name':_0x399996['Interval'][_0xabd0('0x8')]};}_0x369dd0[_0xabd0('0x57')](_0x3a10d6);}}_0x20b73d({'count':_0x369dd0[_0xabd0('0x58')],'rows':_0x369dd0});});},'UpdateVoiceQueue':function(_0x47b98e){return new Promise(function(_0x46363f,_0x12f4ec){var _0x36c5dc=_[_0xabd0('0x59')](_0x1a4ff4['voiceQueues'],{'id':parseInt(_0x47b98e['id'])});var _0x2d8778=_[_0xabd0('0x5a')](_0x47b98e,['id']);if(_0x36c5dc){for(var _0x1f620c in _0x2d8778){if(typeof _0x2d8778[_0x1f620c]!==_0xabd0('0x5b')&&typeof _0x36c5dc[_0x1f620c]!=='undefined'){_0x36c5dc[_0x1f620c]=_0x2d8778[_0x1f620c];}}_0x46363f(_0x36c5dc);}else{_0x12f4ec();}});},'VoiceChannels':function(_0x35d19e){return new Promise(function(_0x35e948,_0x1a0fbc){var _0xc80459=_[_0xabd0('0x5c')](_0x1a4ff4[_0xabd0('0x5d')]);_0x35e948({'count':_0xc80459['length'],'rows':_0xc80459});});},'VoiceChannelMixMonitor':function(_0x5218f7){var _0x2ba587=this;return new Promise(function(_0x5dd55b,_0x4a78b4){if(ami[_0xabd0('0x10')]()==![]){return _0x4a78b4(_0x2ba587[_0xabd0('0x1b')](0x1f4,[config[_0xabd0('0x1c')]['ip'],config[_0xabd0('0x1c')]['username'],_0xabd0('0x11')][_0xabd0('0x12')]('\x20')));}var _0x1a655f=schema(properties[_0xabd0('0x5e')])['validate'](_0x5218f7);if(_0x1a655f['length']>0x0){return _0x4a78b4(_0x2ba587[_0xabd0('0x1b')](0x1f4,_[_0xabd0('0x5f')](_0x1a655f,_0xabd0('0x1a'))[_0xabd0('0x12')](',\x20')));}var _0x4496eb=_[_0xabd0('0x59')](_0x1a4ff4[_0xabd0('0x5d')],{'uniqueid':_0x5218f7[_0xabd0('0x60')]});if(_0x4496eb&&_0x4496eb[_0xabd0('0x61')]){var _0x5adfd9=util[_0xabd0('0x6')](_0xabd0('0x62'),_0x5218f7['filename']||_0x5218f7[_0xabd0('0x60')],_0x5218f7[_0xabd0('0x6')]||_0xabd0('0x63'));return ami[_0xabd0('0x18')]({'action':_0xabd0('0x64'),'channel':_0x4496eb[_0xabd0('0x61')],'file':_0x5adfd9,'options':'ai(mixmonitorid)'})[_0xabd0('0x19')](function(_0x155eb2){var _0x48a740=_[_0xabd0('0x59')](_0x4496eb[_0xabd0('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x5adfd9[_0xabd0('0x66')]()});if(_[_0xabd0('0x67')](_0x48a740)){_0x4496eb[_0xabd0('0x65')][_0xabd0('0x57')]({'filename':_0xabd0('0x68')+_0x5adfd9[_0xabd0('0x66')](),'createdAt':moment()['format'](_0xabd0('0x69')),'mixmonitorid':_0x155eb2['mixmonitorid'],'status':_0xabd0('0x6a')});}else{_0x48a740[_0xabd0('0x6b')]=_0x155eb2[_0xabd0('0x6b')];_0x48a740[_0xabd0('0x6c')]=_0xabd0('0x6a');}_0x5dd55b({'code':0xc8,'message':[_0x5218f7[_0xabd0('0x60')],_0xabd0('0x6d'),_0x155eb2[_0xabd0('0x6b')]][_0xabd0('0x12')]('\x20'),'mixmonitorid':_0x155eb2[_0xabd0('0x6b')]});})[_0xabd0('0x20')](function(_0x5349e7){_0x4a78b4(_0x2ba587[_0xabd0('0x1b')](0x1f5,[_0x5218f7[_0xabd0('0x60')],_0x5349e7['message'][_0xabd0('0x66')]()]['join']('\x20')));});}else{return _0x4a78b4(_0x2ba587[_0xabd0('0x1b')](0x1f5,_0xabd0('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x3d916c){var _0x2af3d1=this;return new Promise(function(_0x2c4fe2,_0x1a363e){if(ami['isConnected']()==![]){return _0x1a363e(_0x2af3d1[_0xabd0('0x1b')](0x1f4,[config[_0xabd0('0x1c')]['ip'],config['asterisk'][_0xabd0('0x1d')],_0xabd0('0x11')][_0xabd0('0x12')]('\x20')));}var _0x19df52=schema(properties[_0xabd0('0x5e')])[_0xabd0('0x6f')](_0x3d916c);if(_0x19df52['length']>0x0){return _0x1a363e(_0x2af3d1[_0xabd0('0x1b')](0x1f4,_['map'](_0x19df52,_0xabd0('0x1a'))[_0xabd0('0x12')](',\x20')));}var _0x4698d1=_[_0xabd0('0x59')](_0x1a4ff4[_0xabd0('0x5d')],{'uniqueid':_0x3d916c['uniqueid']});if(_0x4698d1){return BPromise[_0xabd0('0x70')]()[_0xabd0('0x19')](function(){if(_0x4698d1['channel']){return ami['Action']({'action':_0xabd0('0x71'),'channel':_0x4698d1['channel'],'mixmonitorid':_0x3d916c['mixmonitorid']})[_0xabd0('0x20')](function(_0x387b26){});}})[_0xabd0('0x19')](function(){if(_0x4698d1[_0xabd0('0x72')]){return ami['Action']({'action':_0xabd0('0x71'),'channel':_0x4698d1['destinationchannel'],'mixmonitorid':_0x3d916c[_0xabd0('0x6b')]})[_0xabd0('0x20')](function(_0x227674){});}})[_0xabd0('0x19')](function(_0x2708a8){var _0x248220=_['find'](_0x4698d1[_0xabd0('0x65')],{'mixmonitorid':_0x3d916c[_0xabd0('0x6b')]});if(_0x248220){_0x248220[_0xabd0('0x6c')]='stop';}})[_0xabd0('0x19')](function(){var _0x395114=util[_0xabd0('0x6')]('%s.%s',_0x3d916c[_0xabd0('0x73')]||_0x3d916c[_0xabd0('0x60')],_0x3d916c['format']||'wav');var _0x438655=_[_0xabd0('0x59')](_0x4698d1[_0xabd0('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x395114['toLowerCase']()});if(_0x438655){_0x438655[_0xabd0('0x6c')]='stop';}})[_0xabd0('0x19')](function(){_0x2c4fe2({'code':0xc8,'message':[_0x3d916c[_0xabd0('0x60')],_0xabd0('0x74')][_0xabd0('0x12')]('\x20')});})[_0xabd0('0x20')](function(_0x154b25){_0x1a363e(_0x2af3d1[_0xabd0('0x1b')](0x1f5,[_0x3d916c[_0xabd0('0x60')],_0x154b25[_0xabd0('0x1a')][_0xabd0('0x66')]()]['join']('\x20')));});}else{return _0x1a363e(_0x2af3d1[_0xabd0('0x1b')](0x1f5,_0xabd0('0x6e')));}});},'VoiceQueuesChannels':function(_0x1cfbdd){return new Promise(function(_0x57b8c2,_0x3beb9c){var _0x4a567a=_['values'](_0x1a4ff4[_0xabd0('0x75')]);_0x57b8c2({'count':_0x4a567a[_0xabd0('0x58')],'rows':_0x4a567a});});},'VoiceQueuesChannel':function(_0x44cc5f){var _0x9563ee=this;return new Promise(function(_0x5241b4,_0x1b0feb){var _0x5eb8b3=schema(properties[_0xabd0('0x76')])['validate'](_0x44cc5f);if(_0x5eb8b3[_0xabd0('0x58')]>0x0){return _0x1b0feb(_0x9563ee[_0xabd0('0x1b')](0x1f4,_[_0xabd0('0x5f')](_0x5eb8b3,'message')[_0xabd0('0x12')](',\x20')));}var _0x5653fc=_[_0xabd0('0x59')](_0x1a4ff4[_0xabd0('0x75')],{'uniqueid':_0x44cc5f[_0xabd0('0x60')]});if(_0x5653fc){_0x5241b4(_0x5653fc);}else{return _0x1b0feb(_0x9563ee['error'](0x1f5,_0xabd0('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x1551e4){var _0x27ba4f=this;return new Promise(function(_0x52f4d6,_0x182bc6){if(ami[_0xabd0('0x10')]()==![]){return _0x182bc6(_0x27ba4f[_0xabd0('0x1b')](0x1f4,[config[_0xabd0('0x1c')]['ip'],config[_0xabd0('0x1c')][_0xabd0('0x1d')],_0xabd0('0x11')]['join']('\x20')));}var _0x47f20c=schema(properties[_0xabd0('0x77')])[_0xabd0('0x6f')](_0x1551e4);if(_0x47f20c[_0xabd0('0x58')]>0x0){return _0x182bc6(_0x27ba4f[_0xabd0('0x1b')](0x1f4,_[_0xabd0('0x5f')](_0x47f20c,_0xabd0('0x1a'))[_0xabd0('0x12')](',\x20')));}var _0x51bbdb=_[_0xabd0('0x59')](_0x1a4ff4[_0xabd0('0x75')],{'uniqueid':_0x1551e4[_0xabd0('0x60')]});if(_0x51bbdb&&_0x51bbdb[_0xabd0('0x61')]){return ami[_0xabd0('0x18')]({'action':_0xabd0('0x78'),'channel':_0x51bbdb[_0xabd0('0x61')]})[_0xabd0('0x19')](function(_0x280407){_0x52f4d6({'code':0xc8,'message':[_0x1551e4[_0xabd0('0x60')],_0x280407[_0xabd0('0x1a')][_0xabd0('0x66')]()][_0xabd0('0x12')]('\x20')});})['catch'](function(_0x313550){_0x182bc6(_0x27ba4f[_0xabd0('0x1b')](0x1f5,[_0x1551e4[_0xabd0('0x60')],_0x313550[_0xabd0('0x1a')][_0xabd0('0x66')]()]['join']('\x20')));});}else{return _0x182bc6(_0x27ba4f[_0xabd0('0x1b')](0x1f5,_0xabd0('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x1c9024){var _0xb3742=this;return new Promise(function(_0x4a1c8d,_0x24d845){if(ami[_0xabd0('0x10')]()==![]){return _0x24d845(_0xb3742[_0xabd0('0x1b')](0x1f4,[config[_0xabd0('0x1c')]['ip'],config[_0xabd0('0x1c')]['username'],_0xabd0('0x11')][_0xabd0('0x12')]('\x20')));}var _0x379fb5=schema(properties['voicequeuechannelredirect'])['validate'](_0x1c9024);if(_0x379fb5[_0xabd0('0x58')]>0x0){return _0x24d845(_0xb3742[_0xabd0('0x1b')](0x1f4,_[_0xabd0('0x5f')](_0x379fb5,_0xabd0('0x1a'))[_0xabd0('0x12')](',\x20')));}var _0x46220b=_[_0xabd0('0x59')](_0x1a4ff4[_0xabd0('0x75')],{'uniqueid':_0x1c9024[_0xabd0('0x60')]});if(_0x46220b&&_0x46220b['channel']){return ami[_0xabd0('0x18')]({'action':_0xabd0('0x79'),'channel':_0x46220b['channel'],'exten':_0x1c9024[_0xabd0('0x7a')],'context':_0x1c9024['context']||_0x46220b['context'],'priority':0x1})[_0xabd0('0x19')](function(_0x49d160){_0x4a1c8d({'code':0xc8,'message':[_0x1c9024[_0xabd0('0x60')],_0x49d160[_0xabd0('0x1a')][_0xabd0('0x66')]()][_0xabd0('0x12')]('\x20')});})[_0xabd0('0x20')](function(_0x4f6582){_0x24d845(_0xb3742['error'](0x1f5,[_0x1c9024[_0xabd0('0x60')],_0x4f6582[_0xabd0('0x1a')][_0xabd0('0x66')]()][_0xabd0('0x12')]('\x20')));});}else{return _0x24d845(_0xb3742[_0xabd0('0x1b')](0x1f5,_0xabd0('0x6e')));}});},'Agents':function(_0x4c628d){return new Promise(function(_0x3919f1,_0x46c637){var _0x2f358c=_['values'](_0x1a4ff4[_0xabd0('0xc')]);_0x3919f1({'count':_0x2f358c['length'],'rows':_0x2f358c});});},'Telephones':function(_0x3753ed){return new Promise(function(_0x870a24,_0x1f7ec4){var _0xa304a2=_['values'](_0x1a4ff4['telephones']);_0x870a24({'count':_0xa304a2[_0xabd0('0x58')],'rows':_0xa304a2});});},'Trunks':function(_0x338f51){return new Promise(function(_0x53e54b,_0x40842b){var _0x42003f=_[_0xabd0('0x5c')](_0x1a4ff4['trunks']);_0x53e54b({'count':_0x42003f[_0xabd0('0x58')],'rows':_0x42003f});});},'OutboundChannels':function(_0x4aab81){return new Promise(function(_0x28b0d4,_0x50860d){var _0x35e7e3=_[_0xabd0('0x5c')](_0x1a4ff4[_0xabd0('0x7b')]);_0x28b0d4({'count':_0x35e7e3[_0xabd0('0x58')],'rows':_0x35e7e3});});},'Outbound':function(_0x30dab0){return new Promise(function(_0x31f166,_0x5a76bc){_0x31f166(_0x1a4ff4[_0xabd0('0x7c')]);});},'Campaigns':function(_0x23996c){return new Promise(function(_0x10370d,_0x408acc){var _0x3a895f=_[_0xabd0('0x5c')](_0x1a4ff4['campaigns']);_0x10370d({'count':_0x3a895f[_0xabd0('0x58')],'rows':_0x3a895f});});},'VoiceQueuesPreview':function(_0x33e1a5){var _0x2501fc=this;return new Promise(function(_0x4c8569,_0x364f77){_0x123d13[_0xabd0('0x7d')](_0x33e1a5['id'])[_0xabd0('0x19')](function(_0x297883){_0x4c8569({'code':0xc8,'message':_0x297883['message']});})['catch'](function(_0x2108ec){_0x364f77(_0x2501fc['error'](0x1f4,_0x2108ec[_0xabd0('0x1a')]));});});},'EventManager':function(_0x29cfda){var _0x146b88=this;return new Promise(function(_0x2fe1a6,_0x263d41){if(!_0x29cfda[_0xabd0('0x7e')]){return _0x263d41(_0x146b88[_0xabd0('0x1b')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xabd0('0x7f')](_0xabd0('0x80')+_0x29cfda[_0xabd0('0x7e')],_0x29cfda[_0xabd0('0x1a')]);_0x2fe1a6({'code':0xc8,'message':_0x29cfda});});},'FaxAccounts':function(_0x5a26bd){return new Promise(function(_0x261131,_0x2862c1){var _0x59dce0=_[_0xabd0('0x5c')](_0x1a4ff4[_0xabd0('0x81')]);_0x261131({'count':_0x59dce0[_0xabd0('0x58')],'rows':_0x59dce0});});},'SendFax':function(_0x2f868b){var _0x46f7f8=this;return new Promise(function(_0x413ca0,_0x4c4810){_0x221368[_0xabd0('0x82')](_0x2f868b)['then'](function(_0x489e49){_0x413ca0({'code':0xc8,'message':_0x489e49['message']});})[_0xabd0('0x20')](function(_0x4dc968){_0x4c4810(_0x46f7f8[_0xabd0('0x1b')](0x1f4,_0x4dc968[_0xabd0('0x1a')]));});});},'CheckAfterSend':function(_0x100daf){var _0x105afb=this;return new Promise(function(_0x38683d,_0x5c4fa9){_0x221368[_0xabd0('0x83')](_0x100daf)[_0xabd0('0x19')](function(_0x26cb77){_0x38683d({'code':0xc8,'message':_0x26cb77['message']});})[_0xabd0('0x20')](function(_0x2996b1){_0x5c4fa9(_0x105afb['error'](0x1f4,_0x2996b1[_0xabd0('0x1a')]));});});}};var _0x1d526a=jayson['server'](_0x4ac4ad)['http']();_0x1d526a['on'](_0xabd0('0x1b'),function(_0x5b894e){return _0xe18a18(_0x5b894e);});_0x1d526a['listen'](0x232a,_0xabd0('0x84'),function(){console['log'](_0xabd0('0x85'),0x232a);return _0xb41697(_0xabd0('0x86')+0x232a);});});}; \ No newline at end of file +var _0xdfa0=['then','message','catch','voiceQueues','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','length','find','omit','undefined','values','channels','voicechannel','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','monitors','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','campaigns','run','event','emit','custom:','send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','validate','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','timers','timer','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action'];(function(_0x196ddc,_0x514491){var _0x5d15f2=function(_0x5bcf05){while(--_0x5bcf05){_0x196ddc['push'](_0x196ddc['shift']());}};_0x5d15f2(++_0x514491);}(_0xdfa0,0x69));var _0x0dfa=function(_0x3a54a2,_0x3f1799){_0x3a54a2=_0x3a54a2-0x0;var _0x2e2df7=_0xdfa0[_0x3a54a2];return _0x2e2df7;};'use strict';var _=require(_0x0dfa('0x0'));var util=require('util');var jayson=require(_0x0dfa('0x1'));var schema=require(_0x0dfa('0x2'));var BPromise=require('bluebird');var moment=require(_0x0dfa('0x3'));var config=require(_0x0dfa('0x4'));var properties=require(_0x0dfa('0x5'));var ami=require('../ami');exports[_0x0dfa('0x6')]=function(_0x50b91e,_0x2f60d7,_0x2efe20){return new BPromise(function(_0x4830b6,_0x417f7a){var _0x29ca78={'QueuePause':function(_0x32280b){return new Promise(function(_0x16070c,_0x3b6881){var _0x4c7be0=util[_0x0dfa('0x7')](_0x0dfa('0x8'),_0x0dfa('0x9'),_0x32280b['name']);if(_0x50b91e[_0x0dfa('0xa')]&&_0x50b91e['timers'][_0x4c7be0]&&_0x50b91e[_0x0dfa('0xa')][_0x4c7be0][_0x0dfa('0xb')]){_0x50b91e[_0x0dfa('0xa')][_0x4c7be0]['updateAcw']();}if(_0x50b91e[_0x0dfa('0xc')][_0x4c7be0]){_0x50b91e[_0x0dfa('0xc')][_0x4c7be0]['updateStatusRealtime']({'statePause':_0x32280b[_0x0dfa('0xd')]?!![]:![]});}_0x16070c({'code':0xc8,'message':_0x0dfa('0xe')});});},'Reload':function(_0x47c37c){var _0x4162e1=this;return new Promise(function(_0x1e5532,_0x4215fd){if(ami[_0x0dfa('0xf')]()==![]){return _0x4215fd(_0x4162e1[_0x0dfa('0x10')](0x1f4,[config[_0x0dfa('0x11')]['ip'],config['asterisk'][_0x0dfa('0x12')],_0x0dfa('0x13')][_0x0dfa('0x14')]('\x20')));}_0x47c37c=_[_0x0dfa('0x15')](_0x47c37c,_[_0x0dfa('0x16')](properties[_0x0dfa('0x17')]));_0x47c37c[_0x0dfa('0x18')]=_0x0dfa('0x19');return ami[_0x0dfa('0x1a')](_0x47c37c)[_0x0dfa('0x1b')](function(_0xc524fe){_0x1e5532({'code':0xc8,'message':_0xc524fe[_0x0dfa('0x1c')]});})[_0x0dfa('0x1d')](function(_0x208c0b){_0x4215fd(_0x4162e1[_0x0dfa('0x10')](0x1f5,_0x208c0b['message']));});});},'Command':function(_0xd21935){var _0x22ff4e=this;return new Promise(function(_0x263d6c,_0x1bb2a){if(ami[_0x0dfa('0xf')]()==![]){return _0x1bb2a(_0x22ff4e['error'](0x1f4,[config['asterisk']['ip'],config[_0x0dfa('0x11')][_0x0dfa('0x12')],_0x0dfa('0x13')]['join']('\x20')));}_0xd21935=_[_0x0dfa('0x15')](_0xd21935,'command');_0xd21935[_0x0dfa('0x18')]='Command';return ami[_0x0dfa('0x1a')](_0xd21935)[_0x0dfa('0x1b')](function(_0x43f048){_0x263d6c({'code':0xc8,'message':_0x43f048['content']});})[_0x0dfa('0x1d')](function(_0x70ff72){_0x1bb2a(_0x22ff4e[_0x0dfa('0x10')](0x1f5,_0x70ff72[_0x0dfa('0x1c')]));});});},'VoiceQueues':function(_0x1dfbea){return new Promise(function(_0x12bd2a,_0x13005a){var _0x3f40e4=[];for(var _0x2e4523 in _0x50b91e[_0x0dfa('0x1e')]){if(_0x50b91e['voiceQueues']['hasOwnProperty'](_0x2e4523)){var _0x4084c6=_0x50b91e[_0x0dfa('0x1e')][_0x2e4523];var _0x4992b8={'id':_0x4084c6['id'],'name':_0x4084c6[_0x0dfa('0x1f')],'strategy':_0x4084c6[_0x0dfa('0x20')],'answered':_0x4084c6[_0x0dfa('0x21')],'available':_0x4084c6['available'],'loggedIn':_0x4084c6[_0x0dfa('0x22')],'pTalking':_0x4084c6[_0x0dfa('0x23')],'sumBillable':_0x4084c6[_0x0dfa('0x24')],'sumDuration':_0x4084c6[_0x0dfa('0x25')],'sumHoldTime':_0x4084c6[_0x0dfa('0x26')]||0x0,'talking':_0x4084c6[_0x0dfa('0x27')],'total':_0x4084c6['total'],'type':_0x4084c6[_0x0dfa('0x28')],'unmanaged':_0x4084c6[_0x0dfa('0x29')],'abandoned':_0x4084c6['abandoned'],'waiting':_0x4084c6[_0x0dfa('0x2a')],'loggedInDb':_0x4084c6[_0x0dfa('0x2b')]};if(_0x4084c6[_0x0dfa('0x28')]===_0x0dfa('0x2c')){_0x4992b8['dialActive']=_0x4084c6[_0x0dfa('0x2d')];_0x4992b8[_0x0dfa('0x2e')]=_0x4084c6[_0x0dfa('0x2e')];_0x4992b8['dialOriginateCallerIdName']=_0x4084c6['dialOriginateCallerIdName'];_0x4992b8[_0x0dfa('0x2f')]=_0x4084c6[_0x0dfa('0x2f')];_0x4992b8['dialOriginateTimeout']=_0x4084c6['dialOriginateTimeout'];_0x4992b8['dialPrefix']=_0x4084c6[_0x0dfa('0x30')];_0x4992b8[_0x0dfa('0x31')]=_0x4084c6[_0x0dfa('0x31')];_0x4992b8[_0x0dfa('0x32')]=_0x4084c6['outboundAnswerAgiCallsDay'];_0x4992b8[_0x0dfa('0x33')]=_0x4084c6[_0x0dfa('0x33')];_0x4992b8[_0x0dfa('0x34')]=_0x4084c6[_0x0dfa('0x34')];_0x4992b8[_0x0dfa('0x35')]=_0x4084c6[_0x0dfa('0x35')];_0x4992b8[_0x0dfa('0x36')]=_0x4084c6[_0x0dfa('0x36')];_0x4992b8[_0x0dfa('0x37')]=_0x4084c6[_0x0dfa('0x37')];_0x4992b8['outboundDropCallsDayCallersExit']=_0x4084c6['outboundDropCallsDayCallersExit'];_0x4992b8[_0x0dfa('0x38')]=_0x4084c6[_0x0dfa('0x38')];_0x4992b8[_0x0dfa('0x39')]=_0x4084c6[_0x0dfa('0x39')];_0x4992b8[_0x0dfa('0x3a')]=_0x4084c6['outboundNoSuchCallsDay'];_0x4992b8[_0x0dfa('0x3b')]=_0x4084c6['outboundOriginateFailureCallsDay'];_0x4992b8[_0x0dfa('0x3c')]=_0x4084c6[_0x0dfa('0x3c')];_0x4992b8[_0x0dfa('0x3d')]=_0x4084c6['outboundRejectCallsDay'];_0x4992b8['outboundUnknownCallsDay']=_0x4084c6[_0x0dfa('0x3e')];_0x4992b8[_0x0dfa('0x3f')]=_0x4084c6[_0x0dfa('0x3f')];_0x4992b8['predictiveIntervalAvgHoldtime']=_0x4084c6[_0x0dfa('0x40')];_0x4992b8['predictiveIntervalAvgTalktime']=_0x4084c6[_0x0dfa('0x41')];_0x4992b8[_0x0dfa('0x42')]=_0x4084c6['predictiveIntervalDroppedCallsCallersExit'];_0x4992b8[_0x0dfa('0x43')]=_0x4084c6[_0x0dfa('0x43')];_0x4992b8[_0x0dfa('0x44')]=_0x4084c6[_0x0dfa('0x44')];_0x4992b8[_0x0dfa('0x45')]=_0x4084c6[_0x0dfa('0x45')];_0x4992b8['predictiveIntervalHitRate']=_0x4084c6[_0x0dfa('0x46')];_0x4992b8[_0x0dfa('0x47')]=_0x4084c6[_0x0dfa('0x47')];_0x4992b8[_0x0dfa('0x48')]=_0x4084c6[_0x0dfa('0x48')];_0x4992b8[_0x0dfa('0x49')]=_0x4084c6[_0x0dfa('0x49')];_0x4992b8[_0x0dfa('0x4a')]=_0x4084c6[_0x0dfa('0x4a')];_0x4992b8[_0x0dfa('0x1c')]=_0x4084c6[_0x0dfa('0x1c')];_0x4992b8['originated']=_0x4084c6['originated'];_0x4992b8[_0x0dfa('0x4b')]=_0x4084c6[_0x0dfa('0x4b')];_0x4992b8['erlangCallToSecond']=_0x4084c6['erlangCallToSecond'];_0x4992b8['erlangAbandonmentRate']=_0x4084c6[_0x0dfa('0x4c')];_0x4992b8['erlangBusyFactor']=_0x4084c6[_0x0dfa('0x4d')];_0x4992b8[_0x0dfa('0x4e')]=_0x4084c6[_0x0dfa('0x4e')];_0x4992b8[_0x0dfa('0x4f')]=_0x4084c6[_0x0dfa('0x4f')];}if(_0x4084c6[_0x0dfa('0x50')]){_0x4992b8[_0x0dfa('0x50')]={'id':_0x4084c6[_0x0dfa('0x50')]['id'],'name':_0x4084c6['Trunk'][_0x0dfa('0x1f')],'active':_0x4084c6[_0x0dfa('0x50')]['active'],'callerid':_0x4084c6[_0x0dfa('0x50')][_0x0dfa('0x51')]};}if(_0x4084c6['Interval']){_0x4992b8[_0x0dfa('0x52')]={'id':_0x4084c6[_0x0dfa('0x52')]['id'],'name':_0x4084c6[_0x0dfa('0x52')][_0x0dfa('0x1f')]};}_0x3f40e4['push'](_0x4992b8);}}_0x12bd2a({'count':_0x3f40e4[_0x0dfa('0x53')],'rows':_0x3f40e4});});},'UpdateVoiceQueue':function(_0x2617b1){return new Promise(function(_0x483630,_0x3fc10d){var _0x13c4ad=_[_0x0dfa('0x54')](_0x50b91e[_0x0dfa('0x1e')],{'id':parseInt(_0x2617b1['id'])});var _0x1f31b7=_[_0x0dfa('0x55')](_0x2617b1,['id']);if(_0x13c4ad){for(var _0x33c17b in _0x1f31b7){if(typeof _0x1f31b7[_0x33c17b]!==_0x0dfa('0x56')&&typeof _0x13c4ad[_0x33c17b]!==_0x0dfa('0x56')){_0x13c4ad[_0x33c17b]=_0x1f31b7[_0x33c17b];}}_0x483630(_0x13c4ad);}else{_0x3fc10d();}});},'VoiceChannels':function(_0x5bb41a){return new Promise(function(_0x28573d,_0x326433){var _0x48de6c=_[_0x0dfa('0x57')](_0x50b91e[_0x0dfa('0x58')]);_0x28573d({'count':_0x48de6c[_0x0dfa('0x53')],'rows':_0x48de6c});});},'VoiceChannelMixMonitor':function(_0xa676cc){var _0x560dfe=this;return new Promise(function(_0x5df0e8,_0x5f4572){if(ami[_0x0dfa('0xf')]()==![]){return _0x5f4572(_0x560dfe[_0x0dfa('0x10')](0x1f4,[config[_0x0dfa('0x11')]['ip'],config[_0x0dfa('0x11')][_0x0dfa('0x12')],_0x0dfa('0x13')]['join']('\x20')));}var _0x595ba5=schema(properties[_0x0dfa('0x59')])[_0x0dfa('0x2')](_0xa676cc);if(_0x595ba5[_0x0dfa('0x53')]>0x0){return _0x5f4572(_0x560dfe[_0x0dfa('0x10')](0x1f4,_['map'](_0x595ba5,'message')['join'](',\x20')));}var _0x2f018c=_[_0x0dfa('0x54')](_0x50b91e[_0x0dfa('0x58')],{'uniqueid':_0xa676cc[_0x0dfa('0x5a')]});if(_0x2f018c&&_0x2f018c[_0x0dfa('0x5b')]){var _0x16b025=util[_0x0dfa('0x7')](_0x0dfa('0x5c'),_0xa676cc['filename']||_0xa676cc['uniqueid'],_0xa676cc['format']||_0x0dfa('0x5d'));return ami['Action']({'action':_0x0dfa('0x5e'),'channel':_0x2f018c[_0x0dfa('0x5b')],'file':_0x16b025,'options':_0x0dfa('0x5f')})[_0x0dfa('0x1b')](function(_0x748132){var _0x31f272=_['find'](_0x2f018c['monitors'],{'filename':_0x0dfa('0x60')+_0x16b025[_0x0dfa('0x61')]()});if(_[_0x0dfa('0x62')](_0x31f272)){_0x2f018c['monitors'][_0x0dfa('0x63')]({'filename':_0x0dfa('0x60')+_0x16b025[_0x0dfa('0x61')](),'createdAt':moment()[_0x0dfa('0x7')](_0x0dfa('0x64')),'mixmonitorid':_0x748132[_0x0dfa('0x65')],'status':_0x0dfa('0x66')});}else{_0x31f272[_0x0dfa('0x65')]=_0x748132['mixmonitorid'];_0x31f272[_0x0dfa('0x67')]=_0x0dfa('0x66');}_0x5df0e8({'code':0xc8,'message':[_0xa676cc[_0x0dfa('0x5a')],_0x0dfa('0x68'),_0x748132[_0x0dfa('0x65')]]['join']('\x20'),'mixmonitorid':_0x748132['mixmonitorid']});})[_0x0dfa('0x1d')](function(_0x5389d6){_0x5f4572(_0x560dfe[_0x0dfa('0x10')](0x1f5,[_0xa676cc[_0x0dfa('0x5a')],_0x5389d6[_0x0dfa('0x1c')]['toLowerCase']()][_0x0dfa('0x14')]('\x20')));});}else{return _0x5f4572(_0x560dfe[_0x0dfa('0x10')](0x1f5,_0x0dfa('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x417ee1){var _0x1dddca=this;return new Promise(function(_0x598888,_0x4b4b04){if(ami['isConnected']()==![]){return _0x4b4b04(_0x1dddca[_0x0dfa('0x10')](0x1f4,[config[_0x0dfa('0x11')]['ip'],config[_0x0dfa('0x11')][_0x0dfa('0x12')],_0x0dfa('0x13')][_0x0dfa('0x14')]('\x20')));}var _0x56e483=schema(properties[_0x0dfa('0x59')])[_0x0dfa('0x2')](_0x417ee1);if(_0x56e483[_0x0dfa('0x53')]>0x0){return _0x4b4b04(_0x1dddca[_0x0dfa('0x10')](0x1f4,_[_0x0dfa('0x6a')](_0x56e483,_0x0dfa('0x1c'))['join'](',\x20')));}var _0x34d1e1=_[_0x0dfa('0x54')](_0x50b91e[_0x0dfa('0x58')],{'uniqueid':_0x417ee1['uniqueid']});if(_0x34d1e1){return BPromise[_0x0dfa('0x6b')]()[_0x0dfa('0x1b')](function(){if(_0x34d1e1[_0x0dfa('0x5b')]){return ami[_0x0dfa('0x1a')]({'action':_0x0dfa('0x6c'),'channel':_0x34d1e1[_0x0dfa('0x5b')],'mixmonitorid':_0x417ee1[_0x0dfa('0x65')]})[_0x0dfa('0x1d')](function(_0x4a1c24){});}})[_0x0dfa('0x1b')](function(){if(_0x34d1e1['destinationchannel']){return ami['Action']({'action':_0x0dfa('0x6c'),'channel':_0x34d1e1['destinationchannel'],'mixmonitorid':_0x417ee1[_0x0dfa('0x65')]})[_0x0dfa('0x1d')](function(_0x34107a){});}})['then'](function(_0x20217b){var _0x2b0b2d=_['find'](_0x34d1e1[_0x0dfa('0x6d')],{'mixmonitorid':_0x417ee1[_0x0dfa('0x65')]});if(_0x2b0b2d){_0x2b0b2d[_0x0dfa('0x67')]=_0x0dfa('0x6e');}})[_0x0dfa('0x1b')](function(){var _0x36c123=util[_0x0dfa('0x7')]('%s.%s',_0x417ee1[_0x0dfa('0x6f')]||_0x417ee1['uniqueid'],_0x417ee1[_0x0dfa('0x7')]||_0x0dfa('0x5d'));var _0x4a96b3=_['find'](_0x34d1e1['monitors'],{'filename':_0x0dfa('0x60')+_0x36c123['toLowerCase']()});if(_0x4a96b3){_0x4a96b3['status']=_0x0dfa('0x6e');}})[_0x0dfa('0x1b')](function(){_0x598888({'code':0xc8,'message':[_0x417ee1[_0x0dfa('0x5a')],_0x0dfa('0x70')][_0x0dfa('0x14')]('\x20')});})[_0x0dfa('0x1d')](function(_0x3b1c93){_0x4b4b04(_0x1dddca[_0x0dfa('0x10')](0x1f5,[_0x417ee1[_0x0dfa('0x5a')],_0x3b1c93[_0x0dfa('0x1c')]['toLowerCase']()][_0x0dfa('0x14')]('\x20')));});}else{return _0x4b4b04(_0x1dddca[_0x0dfa('0x10')](0x1f5,_0x0dfa('0x69')));}});},'VoiceQueuesChannels':function(_0x478b01){return new Promise(function(_0x212c43,_0x4132b5){var _0x230333=_[_0x0dfa('0x57')](_0x50b91e[_0x0dfa('0x71')]);_0x212c43({'count':_0x230333[_0x0dfa('0x53')],'rows':_0x230333});});},'VoiceQueuesChannel':function(_0x2e5d85){var _0x1c1e49=this;return new Promise(function(_0x1b3c5c,_0x321219){var _0x311560=schema(properties[_0x0dfa('0x72')])['validate'](_0x2e5d85);if(_0x311560['length']>0x0){return _0x321219(_0x1c1e49[_0x0dfa('0x10')](0x1f4,_['map'](_0x311560,_0x0dfa('0x1c'))[_0x0dfa('0x14')](',\x20')));}var _0x44e3d3=_['find'](_0x50b91e[_0x0dfa('0x71')],{'uniqueid':_0x2e5d85[_0x0dfa('0x5a')]});if(_0x44e3d3){_0x1b3c5c(_0x44e3d3);}else{return _0x321219(_0x1c1e49['error'](0x1f5,_0x0dfa('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x2d10ba){var _0xbf4253=this;return new Promise(function(_0x1e66ed,_0x48930b){if(ami[_0x0dfa('0xf')]()==![]){return _0x48930b(_0xbf4253[_0x0dfa('0x10')](0x1f4,[config[_0x0dfa('0x11')]['ip'],config[_0x0dfa('0x11')][_0x0dfa('0x12')],_0x0dfa('0x13')]['join']('\x20')));}var _0x21828e=schema(properties[_0x0dfa('0x73')])[_0x0dfa('0x2')](_0x2d10ba);if(_0x21828e[_0x0dfa('0x53')]>0x0){return _0x48930b(_0xbf4253[_0x0dfa('0x10')](0x1f4,_[_0x0dfa('0x6a')](_0x21828e,_0x0dfa('0x1c'))[_0x0dfa('0x14')](',\x20')));}var _0x460210=_[_0x0dfa('0x54')](_0x50b91e[_0x0dfa('0x71')],{'uniqueid':_0x2d10ba[_0x0dfa('0x5a')]});if(_0x460210&&_0x460210[_0x0dfa('0x5b')]){return ami[_0x0dfa('0x1a')]({'action':'Hangup','channel':_0x460210['channel']})[_0x0dfa('0x1b')](function(_0x4e3d5c){_0x1e66ed({'code':0xc8,'message':[_0x2d10ba[_0x0dfa('0x5a')],_0x4e3d5c[_0x0dfa('0x1c')][_0x0dfa('0x61')]()]['join']('\x20')});})[_0x0dfa('0x1d')](function(_0x57cf28){_0x48930b(_0xbf4253[_0x0dfa('0x10')](0x1f5,[_0x2d10ba[_0x0dfa('0x5a')],_0x57cf28[_0x0dfa('0x1c')][_0x0dfa('0x61')]()][_0x0dfa('0x14')]('\x20')));});}else{return _0x48930b(_0xbf4253[_0x0dfa('0x10')](0x1f5,_0x0dfa('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x5b013d){var _0x47221a=this;return new Promise(function(_0x2e32eb,_0x13f23d){if(ami[_0x0dfa('0xf')]()==![]){return _0x13f23d(_0x47221a[_0x0dfa('0x10')](0x1f4,[config[_0x0dfa('0x11')]['ip'],config[_0x0dfa('0x11')]['username'],'ami\x20disconnected'][_0x0dfa('0x14')]('\x20')));}var _0x47ef36=schema(properties[_0x0dfa('0x74')])[_0x0dfa('0x2')](_0x5b013d);if(_0x47ef36[_0x0dfa('0x53')]>0x0){return _0x13f23d(_0x47221a[_0x0dfa('0x10')](0x1f4,_[_0x0dfa('0x6a')](_0x47ef36,_0x0dfa('0x1c'))[_0x0dfa('0x14')](',\x20')));}var _0x5d757c=_['find'](_0x50b91e[_0x0dfa('0x71')],{'uniqueid':_0x5b013d[_0x0dfa('0x5a')]});if(_0x5d757c&&_0x5d757c[_0x0dfa('0x5b')]){return ami[_0x0dfa('0x1a')]({'action':_0x0dfa('0x75'),'channel':_0x5d757c[_0x0dfa('0x5b')],'exten':_0x5b013d[_0x0dfa('0x76')],'context':_0x5b013d[_0x0dfa('0x77')]||_0x5d757c[_0x0dfa('0x77')],'priority':0x1})['then'](function(_0x1b3e83){_0x2e32eb({'code':0xc8,'message':[_0x5b013d[_0x0dfa('0x5a')],_0x1b3e83[_0x0dfa('0x1c')][_0x0dfa('0x61')]()][_0x0dfa('0x14')]('\x20')});})[_0x0dfa('0x1d')](function(_0x3c8641){_0x13f23d(_0x47221a[_0x0dfa('0x10')](0x1f5,[_0x5b013d[_0x0dfa('0x5a')],_0x3c8641[_0x0dfa('0x1c')]['toLowerCase']()][_0x0dfa('0x14')]('\x20')));});}else{return _0x13f23d(_0x47221a[_0x0dfa('0x10')](0x1f5,_0x0dfa('0x69')));}});},'Agents':function(_0xd61f76){return new Promise(function(_0x1541b0,_0x55571d){var _0x4d917b=_[_0x0dfa('0x57')](_0x50b91e[_0x0dfa('0xc')]);_0x1541b0({'count':_0x4d917b['length'],'rows':_0x4d917b});});},'Telephones':function(_0x207a7e){return new Promise(function(_0x49c24e,_0x22b554){var _0x31ad4b=_[_0x0dfa('0x57')](_0x50b91e[_0x0dfa('0x78')]);_0x49c24e({'count':_0x31ad4b[_0x0dfa('0x53')],'rows':_0x31ad4b});});},'Trunks':function(_0x1dfe90){return new Promise(function(_0x25c249,_0x300cf3){var _0xe5c893=_[_0x0dfa('0x57')](_0x50b91e['trunks']);_0x25c249({'count':_0xe5c893[_0x0dfa('0x53')],'rows':_0xe5c893});});},'OutboundChannels':function(_0x5cbd8c){return new Promise(function(_0x4060df,_0x10d2bb){var _0x5ccf40=_[_0x0dfa('0x57')](_0x50b91e[_0x0dfa('0x79')]);_0x4060df({'count':_0x5ccf40[_0x0dfa('0x53')],'rows':_0x5ccf40});});},'Outbound':function(_0x215164){return new Promise(function(_0x595432,_0x220503){_0x595432(_0x50b91e['outbound']);});},'Campaigns':function(_0x3293af){return new Promise(function(_0x457a6e,_0x235d55){var _0x246ec7=_['values'](_0x50b91e[_0x0dfa('0x7a')]);_0x457a6e({'count':_0x246ec7[_0x0dfa('0x53')],'rows':_0x246ec7});});},'VoiceQueuesPreview':function(_0x2fabad){var _0x1940c3=this;return new Promise(function(_0x43ed92,_0x9a23ac){_0x2f60d7[_0x0dfa('0x7b')](_0x2fabad['id'])['then'](function(_0x1422e3){_0x43ed92({'code':0xc8,'message':_0x1422e3[_0x0dfa('0x1c')]});})[_0x0dfa('0x1d')](function(_0x149c42){_0x9a23ac(_0x1940c3[_0x0dfa('0x10')](0x1f4,_0x149c42[_0x0dfa('0x1c')]));});});},'EventManager':function(_0xa31f6d){var _0x24b545=this;return new Promise(function(_0x1aaec4,_0x2d10fe){if(!_0xa31f6d[_0x0dfa('0x7c')]){return _0x2d10fe(_0x24b545['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x0dfa('0x7d')](_0x0dfa('0x7e')+_0xa31f6d[_0x0dfa('0x7c')],_0xa31f6d[_0x0dfa('0x1c')]);_0x1aaec4({'code':0xc8,'message':_0xa31f6d});});},'FaxAccounts':function(_0xf1a314){return new Promise(function(_0x415311,_0x5962b0){var _0x106093=_[_0x0dfa('0x57')](_0x50b91e['faxAccounts']);_0x415311({'count':_0x106093[_0x0dfa('0x53')],'rows':_0x106093});});},'SendFax':function(_0x4ec4e6){var _0x5bd9ca=this;return new Promise(function(_0x2160d8,_0x4ea5f9){_0x2efe20[_0x0dfa('0x7f')](_0x4ec4e6)[_0x0dfa('0x1b')](function(_0x279182){_0x2160d8({'code':0xc8,'message':_0x279182[_0x0dfa('0x1c')]});})['catch'](function(_0x588d9a){_0x4ea5f9(_0x5bd9ca[_0x0dfa('0x10')](0x1f4,_0x588d9a[_0x0dfa('0x1c')]));});});},'CheckAfterSend':function(_0x31c7e8){var _0x1fed70=this;return new Promise(function(_0x17c14f,_0x371df9){_0x2efe20[_0x0dfa('0x80')](_0x31c7e8)[_0x0dfa('0x1b')](function(_0x5a8633){_0x17c14f({'code':0xc8,'message':_0x5a8633[_0x0dfa('0x1c')]});})[_0x0dfa('0x1d')](function(_0x383be1){_0x371df9(_0x1fed70['error'](0x1f4,_0x383be1[_0x0dfa('0x1c')]));});});}};var _0xbe1c53=jayson['server'](_0x29ca78)['http']();_0xbe1c53['on'](_0x0dfa('0x10'),function(_0x464bc1){return _0x417f7a(_0x464bc1);});_0xbe1c53['listen'](0x232a,_0x0dfa('0x81'),function(){console[_0x0dfa('0x82')](_0x0dfa('0x83'),0x232a);return _0x4830b6('RPC\x20listening\x20on\x20port:'+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 ab12dc1..2b4de2d 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 _0x8acd=['getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','firstName','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','action','toLowerCase','bluebird','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','data3','split','phone','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then'];(function(_0x5cebc3,_0x3f0d41){var _0x595fa5=function(_0x455faa){while(--_0x455faa){_0x5cebc3['push'](_0x5cebc3['shift']());}};_0x595fa5(++_0x3f0d41);}(_0x8acd,0xc1));var _0xd8ac=function(_0x532d78,_0x25b6a8){_0x532d78=_0x532d78-0x0;var _0x5990c4=_0x8acd[_0x532d78];return _0x5990c4;};'use strict';var _=require('lodash');var BPromise=require(_0xd8ac('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0xd8ac('0x1'));var logger=require(_0xd8ac('0x2'))(_0xd8ac('0x3'));var cmContactRpc=require(_0xd8ac('0x4'));config[_0xd8ac('0x5')]=_['defaults'](config[_0xd8ac('0x5')],{'host':_0xd8ac('0x6'),'port':0x18eb});var io=require(_0xd8ac('0x7'))(new Redis(config[_0xd8ac('0x5')]));function emit(_0x4a6f1c,_0x38010b,_0x32551d,_0x8a6799,_0x2095b8){logger[_0xd8ac('0x8')](_0xd8ac('0x9'),_0x4a6f1c,_0x38010b['id'],_0x32551d,_0x8a6799,JSON[_0xd8ac('0xa')](_0x2095b8));io['to'](_0x32551d)[_0xd8ac('0xb')](_0x8a6799,_0x2095b8);}exports[_0xd8ac('0xc')]=function(_0x4f23ba,_0x3f76f0,_0x5e155e,_0x5dda2e){var _0x2e0489,_0xe503a4;var _0x6e6bfa={};var _0x1ebe32=Number(_0x5e155e[_0xd8ac('0xd')]);var _0x22656e=_0x5e155e[_0xd8ac('0xe')]?Boolean(Number(_0x5e155e[_0xd8ac('0xe')])):![];var _0x232318;if(_0x5dda2e[_0xd8ac('0xf')]){_0x6e6bfa['id']=_0x5dda2e[_0xd8ac('0xf')];}if(!_0x6e6bfa['id']){_0x6e6bfa['ListId']=_0x1ebe32;_0x232318=_0x5e155e['data3']&&_0x5e155e[_0xd8ac('0x10')]!=='0'?_0x5e155e[_0xd8ac('0x10')][_0xd8ac('0x11')](','):[_0xd8ac('0x12')];_0x6e6bfa['$or']=_[_0xd8ac('0x13')](_0x232318,function(_0x34b63c){var _0xc47356={};_0xc47356[_0x34b63c]=_0x5dda2e[_0xd8ac('0x14')]?_0x5dda2e[_0xd8ac('0x15')]:_0x5dda2e[_0xd8ac('0x16')];return _0xc47356;});}var _0x1fae61=['id','firstName',_0xd8ac('0x17'),'phone',_0xd8ac('0x18'),_0xd8ac('0x19'),'ListId',_0xd8ac('0x1a'),_0xd8ac('0x1b'),_0xd8ac('0x1c')];var _0x58dfb8=_['union'](_0x1fae61,_0x232318);BPromise[_0xd8ac('0x1d')]()[_0xd8ac('0x1e')](cmContactRpc[_0xd8ac('0x1f')]({'attributes':_0x58dfb8,'where':_0x6e6bfa}))[_0xd8ac('0x1e')](function(_0x1a594d){_0xe503a4=_0x1a594d;if(!_['isEmpty'](_0xe503a4)){if(_0xe503a4[_0xd8ac('0x20')]===0x1){_0x2e0489=_0xe503a4[0x0];logger[_0xd8ac('0x8')](_0xd8ac('0x21'),_0x5dda2e[_0xd8ac('0x22')],_0x3f76f0['id'],_0x2e0489['id']);}else{logger[_0xd8ac('0x8')](_0xd8ac('0x23'),_0x5dda2e[_0xd8ac('0x22')],_0x3f76f0['id'],_['map'](_0xe503a4,'id')[_0xd8ac('0x24')](','));}return;}else{logger['info'](_0xd8ac('0x25'),_0x5dda2e['uniqueid'],_0x3f76f0['id']);var _0x560649={'ListId':_0x1ebe32};var _0x3fab13=_0x5e155e[_0xd8ac('0x26')]&&_0x5e155e[_0xd8ac('0x26')]!=='0'?_0x5e155e['data4']:_0xd8ac('0x12');if(_0x22656e){logger['info'](_0xd8ac('0x27'),_0x5dda2e[_0xd8ac('0x22')],_0x3f76f0['id']);_0x560649[_0x3fab13]=_[_0xd8ac('0x28')](_0x5dda2e[_0xd8ac('0x14')])?_0x5dda2e[_0xd8ac('0x16')]:_0x5dda2e[_0xd8ac('0x15')];if(_['isNil'](_0x5dda2e['routeId'])){_0x560649['firstName']=_0x5dda2e[_0xd8ac('0x29')]&&_0x5dda2e[_0xd8ac('0x29')]!==_0xd8ac('0x2a')?_0x5dda2e['calleridname']:_0xd8ac('0x2b');}else{_0x560649[_0xd8ac('0x2c')]=_0x5dda2e['destcalleridname']&&_0x5dda2e['destcalleridname']!==_0xd8ac('0x2a')?_0x5dda2e[_0xd8ac('0x2d')]:_0xd8ac('0x2b');}return BPromise[_0xd8ac('0x1d')]()[_0xd8ac('0x1e')](cmContactRpc[_0xd8ac('0x2e')](_0x560649))[_0xd8ac('0x1e')](function(_0x3b8cf8){_0x2e0489=_0x3b8cf8;_0xe503a4['push'](_0x3b8cf8);if(_0x2e0489){logger[_0xd8ac('0x8')](_0xd8ac('0x2f'),_0x5dda2e[_0xd8ac('0x22')],_0x3f76f0['id'],_0x2e0489['id']);}return;});}else{logger[_0xd8ac('0x8')](_0xd8ac('0x30'),_0x5dda2e[_0xd8ac('0x22')],_0x3f76f0['id']);_0x560649[_0x3fab13]=_[_0xd8ac('0x28')](_0x5dda2e['routeId'])?_0x5dda2e['calleridnum']:_0x5dda2e[_0xd8ac('0x15')];if(_[_0xd8ac('0x28')](_0x5dda2e[_0xd8ac('0x14')])){_0x560649[_0xd8ac('0x2c')]=_0x5dda2e['calleridname']&&_0x5dda2e[_0xd8ac('0x29')]!==_0xd8ac('0x2a')?_0x5dda2e[_0xd8ac('0x29')]:_0xd8ac('0x2b');}else{_0x560649['firstName']=_0x5dda2e[_0xd8ac('0x2d')]&&_0x5dda2e['destcalleridname']!==''?_0x5dda2e[_0xd8ac('0x2d')]:_0xd8ac('0x2b');}_0x2e0489=_0x560649;_0xe503a4[_0xd8ac('0x31')](_0x560649);return;}}})['then'](function(){if(_0x4f23ba){emit(_0x5dda2e['uniqueid'],_0x3f76f0,util[_0xd8ac('0x32')](_0xd8ac('0x33'),_0x4f23ba[_0xd8ac('0x34')]),util[_0xd8ac('0x32')](_0xd8ac('0x35'),_0x5e155e[_0xd8ac('0x36')][_0xd8ac('0x37')]()),{'evt':_['merge'](_0x5dda2e,{'autoCreate':_0x22656e}),'contact':_0x2e0489===undefined?{}:_0x2e0489,'contacts':_0xe503a4[_0xd8ac('0x20')]===0x0?undefined:_0xe503a4});}});}; \ No newline at end of file +var _0xe9cf=['[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','calleridnum','format','user:%s','name','action','merge','lodash','bluebird','../../../../config/environment','trigger','../../rpc/cmContact','redis','localhost','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','updatedAt','union','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','Unknown','destcalleridname','','resolve','push'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe9cf,0x111));var _0xfe9c=function(_0x5ee89d,_0x1a7c29){_0x5ee89d=_0x5ee89d-0x0;var _0x3fa4cc=_0xe9cf[_0x5ee89d];return _0x3fa4cc;};'use strict';var _=require(_0xfe9c('0x0'));var BPromise=require(_0xfe9c('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xfe9c('0x2'));var logger=require('../../../../config/logger')(_0xfe9c('0x3'));var cmContactRpc=require(_0xfe9c('0x4'));config[_0xfe9c('0x5')]=_['defaults'](config[_0xfe9c('0x5')],{'host':_0xfe9c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe9c('0x5')]));function emit(_0x33763f,_0x59b1ab,_0x5b2a85,_0x3d2c11,_0x5799ac){logger['info'](_0xfe9c('0x7'),_0x33763f,_0x59b1ab['id'],_0x5b2a85,_0x3d2c11,JSON[_0xfe9c('0x8')](_0x5799ac));io['to'](_0x5b2a85)[_0xfe9c('0x9')](_0x3d2c11,_0x5799ac);}exports[_0xfe9c('0xa')]=function(_0x458c11,_0x231465,_0x373793,_0x20aac3){var _0x29909e,_0x19c2eb;var _0x400981={};var _0x10b152=Number(_0x373793[_0xfe9c('0xb')]);var _0x2adf61=_0x373793['data2']?Boolean(Number(_0x373793[_0xfe9c('0xc')])):![];var _0x45722c;if(_0x20aac3[_0xfe9c('0xd')]){_0x400981['id']=_0x20aac3[_0xfe9c('0xd')];}if(!_0x400981['id']){_0x400981[_0xfe9c('0xe')]=_0x10b152;_0x45722c=_0x373793['data3']&&_0x373793[_0xfe9c('0xf')]!=='0'?_0x373793[_0xfe9c('0xf')][_0xfe9c('0x10')](','):[_0xfe9c('0x11')];_0x400981[_0xfe9c('0x12')]=_[_0xfe9c('0x13')](_0x45722c,function(_0x4fe21b){var _0x52bd91={};_0x52bd91[_0x4fe21b]=_0x20aac3[_0xfe9c('0x14')]?_0x20aac3[_0xfe9c('0x15')]:_0x20aac3['calleridnum'];return _0x52bd91;});}var _0x4e4531=['id',_0xfe9c('0x16'),_0xfe9c('0x17'),_0xfe9c('0x11'),_0xfe9c('0x18'),_0xfe9c('0x19'),_0xfe9c('0xe'),_0xfe9c('0x1a'),'scheduledAt',_0xfe9c('0x1b')];var _0x2e4bf8=_[_0xfe9c('0x1c')](_0x4e4531,_0x45722c);BPromise['resolve']()[_0xfe9c('0x1d')](cmContactRpc[_0xfe9c('0x1e')]({'attributes':_0x2e4bf8,'where':_0x400981}))[_0xfe9c('0x1d')](function(_0x4b1600){_0x19c2eb=_0x4b1600;if(!_['isEmpty'](_0x19c2eb)){if(_0x19c2eb[_0xfe9c('0x1f')]===0x1){_0x29909e=_0x19c2eb[0x0];logger[_0xfe9c('0x20')](_0xfe9c('0x21'),_0x20aac3[_0xfe9c('0x22')],_0x231465['id'],_0x29909e['id']);}else{logger[_0xfe9c('0x20')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x20aac3[_0xfe9c('0x22')],_0x231465['id'],_[_0xfe9c('0x13')](_0x19c2eb,'id')[_0xfe9c('0x23')](','));}return;}else{logger[_0xfe9c('0x20')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x20aac3['uniqueid'],_0x231465['id']);var _0x33d59d={'ListId':_0x10b152};var _0x2a8f42=_0x373793['data4']&&_0x373793[_0xfe9c('0x24')]!=='0'?_0x373793[_0xfe9c('0x24')]:'phone';if(_0x2adf61){logger[_0xfe9c('0x20')](_0xfe9c('0x25'),_0x20aac3['uniqueid'],_0x231465['id']);_0x33d59d[_0x2a8f42]=_['isNil'](_0x20aac3[_0xfe9c('0x14')])?_0x20aac3['calleridnum']:_0x20aac3['destcalleridnum'];if(_[_0xfe9c('0x26')](_0x20aac3[_0xfe9c('0x14')])){_0x33d59d[_0xfe9c('0x16')]=_0x20aac3[_0xfe9c('0x27')]&&_0x20aac3['calleridname']!==''?_0x20aac3[_0xfe9c('0x27')]:_0xfe9c('0x28');}else{_0x33d59d['firstName']=_0x20aac3['destcalleridname']&&_0x20aac3[_0xfe9c('0x29')]!==_0xfe9c('0x2a')?_0x20aac3['destcalleridname']:_0xfe9c('0x28');}return BPromise[_0xfe9c('0x2b')]()['then'](cmContactRpc['createContact'](_0x33d59d))[_0xfe9c('0x1d')](function(_0x50d7be){_0x29909e=_0x50d7be;_0x19c2eb[_0xfe9c('0x2c')](_0x50d7be);if(_0x29909e){logger[_0xfe9c('0x20')](_0xfe9c('0x2d'),_0x20aac3[_0xfe9c('0x22')],_0x231465['id'],_0x29909e['id']);}return;});}else{logger[_0xfe9c('0x20')](_0xfe9c('0x2e'),_0x20aac3[_0xfe9c('0x22')],_0x231465['id']);_0x33d59d[_0x2a8f42]=_['isNil'](_0x20aac3['routeId'])?_0x20aac3[_0xfe9c('0x2f')]:_0x20aac3[_0xfe9c('0x15')];if(_[_0xfe9c('0x26')](_0x20aac3[_0xfe9c('0x14')])){_0x33d59d['firstName']=_0x20aac3[_0xfe9c('0x27')]&&_0x20aac3[_0xfe9c('0x27')]!==''?_0x20aac3['calleridname']:_0xfe9c('0x28');}else{_0x33d59d['firstName']=_0x20aac3[_0xfe9c('0x29')]&&_0x20aac3[_0xfe9c('0x29')]!==_0xfe9c('0x2a')?_0x20aac3[_0xfe9c('0x29')]:_0xfe9c('0x28');}_0x29909e=_0x33d59d;_0x19c2eb['push'](_0x33d59d);return;}}})['then'](function(){if(_0x458c11){emit(_0x20aac3[_0xfe9c('0x22')],_0x231465,util[_0xfe9c('0x30')](_0xfe9c('0x31'),_0x458c11[_0xfe9c('0x32')]),util[_0xfe9c('0x30')]('trigger:%s',_0x373793[_0xfe9c('0x33')]['toLowerCase']()),{'evt':_[_0xfe9c('0x34')](_0x20aac3,{'autoCreate':_0x2adf61}),'contact':_0x29909e===undefined?{}:_0x29909e,'contacts':_0x19c2eb[_0xfe9c('0x1f')]===0x0?undefined:_0x19c2eb});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2cf7580..dbe5202 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 _0x44dc=['TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','data5','800','windowHeight','data6','winApplication','format','name','jscripty','user:%s','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','AllConditions','every','checkConditions','channel','some','AnyConditions','field','account','chat','ChatWebsiteId','upperFirst','AccountId','value','message','event','operator','agent','membername','lastevent','exports','lodash','url','mustache','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:newinteraction','custom:outgoingmessage','custom:rejectmessage','emit','prototype','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','interface','action','toLowerCase','contactmanager','motionbar','data1'];(function(_0x3a99ca,_0x1e1db9){var _0x4c7bf9=function(_0x1d6826){while(--_0x1d6826){_0x3a99ca['push'](_0x3a99ca['shift']());}};_0x4c7bf9(++_0x1e1db9);}(_0x44dc,0x110));var _0xc44d=function(_0x3968c9,_0x346c1b){_0x3968c9=_0x3968c9-0x0;var _0x790570=_0x44dc[_0x3968c9];return _0x790570;};'use strict';var util=require('util');var _=require(_0xc44d('0x0'));var url=require(_0xc44d('0x1'));var Mustache=require(_0xc44d('0x2'));var Redis=require('ioredis');var urlforward=require(_0xc44d('0x3'));var integration=require('./integration');var cmContact=require(_0xc44d('0x4'));var script=require(_0xc44d('0x5'));var config=require(_0xc44d('0x6'));var logger=require(_0xc44d('0x7'))(_0xc44d('0x8'));var ami=require(_0xc44d('0x9'));config['redis']=_['defaults'](config[_0xc44d('0xa')],{'host':_0xc44d('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc44d('0xa')]));var operators={'equals':function(_0x52cb54,_0x3b588f){return _0x52cb54==_0x3b588f;},'not_equals':function(_0x52d30f,_0x378a4b){return _0x52d30f!=_0x378a4b;}};var barAndWebActions=[_0xc44d('0xc'),_0xc44d('0x1'),_0xc44d('0xd')];function Trigger(_0x11fc92){this[_0xc44d('0xe')]=_0x11fc92[_0xc44d('0xe')];this['agents']=_0x11fc92[_0xc44d('0xf')];this[_0xc44d('0x10')]=_0x11fc92['voiceQueues'];this['templates']=_0x11fc92[_0xc44d('0x11')];this['voiceExtensions']=_0x11fc92[_0xc44d('0x12')];this[_0xc44d('0x13')]=_0x11fc92[_0xc44d('0x13')];this[_0xc44d('0x14')]=_0x11fc92[_0xc44d('0x14')];this[_0xc44d('0x15')]=_0x11fc92['salesforceAccounts'];this[_0xc44d('0x16')]=_0x11fc92[_0xc44d('0x16')];this[_0xc44d('0x17')]=_0x11fc92[_0xc44d('0x17')];this[_0xc44d('0x18')]=_0x11fc92[_0xc44d('0x18')];this[_0xc44d('0x19')]=_0x11fc92[_0xc44d('0x19')];this[_0xc44d('0x1a')]=_0x11fc92[_0xc44d('0x1a')];this[_0xc44d('0x1b')]=_0x11fc92['dynamics365Accounts'];this['freshsalesAccounts']=_0x11fc92[_0xc44d('0x1c')];this[_0xc44d('0x1d')]={'zendesk':this[_0xc44d('0x13')],'salesforce':this[_0xc44d('0x15')],'freshdesk':this[_0xc44d('0x14')],'sugarcrm':this[_0xc44d('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0xc44d('0x18')],'vtiger':this[_0xc44d('0x19')],'dynamics365':this[_0xc44d('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0xc44d('0x1e'),this[_0xc44d('0x1f')][_0xc44d('0x20')](this));ami['on'](_0xc44d('0x21'),this[_0xc44d('0x1f')]['bind'](this));ami['on'](_0xc44d('0x22'),this[_0xc44d('0x1f')][_0xc44d('0x20')](this));ami['on'](_0xc44d('0x23'),this[_0xc44d('0x1f')]['bind'](this));ami['on'](_0xc44d('0x24'),this[_0xc44d('0x1f')][_0xc44d('0x20')](this));ami['on'](_0xc44d('0x25'),this[_0xc44d('0x1f')]['bind'](this));ami['on'](_0xc44d('0x26'),this[_0xc44d('0x1f')]['bind'](this));ami['on']('custom:agentcongestion',this[_0xc44d('0x1f')][_0xc44d('0x20')](this));ami['on']('custom:agentreject',this['syncCustomEvent']['bind'](this));ami['on'](_0xc44d('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0xc44d('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0xc44d('0x29'),this[_0xc44d('0x1f')][_0xc44d('0x20')](this));ami['on']('custom:dialbegin',this[_0xc44d('0x2a')][_0xc44d('0x20')](this));ami['on']('custom:dialconnect',this[_0xc44d('0x2a')][_0xc44d('0x20')](this));ami['on']('custom:dialend',this[_0xc44d('0x2a')][_0xc44d('0x20')](this));ami['on'](_0xc44d('0x2b'),this[_0xc44d('0x1f')][_0xc44d('0x20')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0xc44d('0x20')](this));ami['on']('custom:incomingmessage',this[_0xc44d('0x1f')][_0xc44d('0x20')](this));ami['on'](_0xc44d('0x2c'),this[_0xc44d('0x1f')][_0xc44d('0x20')](this));ami['on']('custom:acceptmessage',this[_0xc44d('0x1f')][_0xc44d('0x20')](this));ami['on'](_0xc44d('0x2d'),this[_0xc44d('0x1f')][_0xc44d('0x20')](this));}Trigger['prototype']['emit']=function(_0x471073,_0xc5a1bb,_0x2a87ab){logger['info'](_0x471073,_0xc5a1bb,JSON['stringify'](_0x2a87ab));io['to'](_0x471073)[_0xc44d('0x2e')](_0xc5a1bb,_0x2a87ab);};Trigger[_0xc44d('0x2f')]['syncCustomEvent']=function(_0x5ed2e3){var _0x14e75a=_['clone'](_0x5ed2e3);this[_0xc44d('0x30')](_0x14e75a);};Trigger[_0xc44d('0x2f')][_0xc44d('0x2a')]=function(_0x1b485f){if(this['agents'][_0x1b485f['interface']]){this[_0xc44d('0x1f')](_0x1b485f);}};Trigger[_0xc44d('0x2f')]['checkTriggers']=function(_0x8d7587){var _0x14eac7;for(var _0x57fadf in this[_0xc44d('0xe')]){if(this[_0xc44d('0xe')][_0xc44d('0x31')](_0x57fadf)){if(this[_0xc44d('0xe')][_0x57fadf][_0xc44d('0x32')]){_0x14eac7=this[_0xc44d('0x33')](this[_0xc44d('0xe')][_0x57fadf],_0x8d7587);if(_0x14eac7){_[_0xc44d('0x34')](_0x8d7587,_0x8d7587[_0xc44d('0x35')]);for(var _0x2fc2b9=0x0,_0x52958b,_0x32dbb1,_0x319141;_0x2fc2b90x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0x5fc3[_0x1f83a5];return _0x45edf0;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ 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 36b7d5d..aa5f746 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 _0xf089=['socket.io-emitter','POST','clientId','remoteUri','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','username','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','Bearer\x20','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','/systemusers(','phonecall','phonecalls','callDirection','queue','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','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','name','inspect','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost'];(function(_0x197289,_0x5475a7){var _0x50f06d=function(_0x232221){while(--_0x232221){_0x197289['push'](_0x197289['shift']());}};_0x50f06d(++_0x5475a7);}(_0xf089,0xba));var _0x9f08=function(_0x2d6340,_0x7f54cd){_0x2d6340=_0x2d6340-0x0;var _0x477513=_0xf089[_0x2d6340];return _0x477513;};'use strict';var _=require('lodash');var BPromise=require(_0x9f08('0x0'));var rp=require(_0x9f08('0x1'));var util=require('util');var intUtil=require(_0x9f08('0x2'));var md5=require(_0x9f08('0x3'));var Redis=require(_0x9f08('0x4'));var logger=require(_0x9f08('0x5'))('dynamics365');var config=require(_0x9f08('0x6'));config[_0x9f08('0x7')]=_[_0x9f08('0x8')](config[_0x9f08('0x7')],{'host':_0x9f08('0x9'),'port':0x18eb});var io=require(_0x9f08('0xa'))(new Redis(config['redis']));function getAuthToken(_0x9cfade,_0x4b37fc,_0x39e238){var _0x4ce5b6={'method':_0x9f08('0xb'),'uri':_0x4b37fc,'form':{'client_id':_0x9cfade[_0x9f08('0xc')],'resource':_0x9cfade[_0x9f08('0xd')],'username':_0x9cfade['username'],'password':_0x9cfade[_0x9f08('0xe')],'grant_type':_0x9f08('0xe'),'client_secret':_0x9cfade[_0x9f08('0xf')]},'json':!![]};return rp(_0x4ce5b6)['then'](function(_0x59aada){return _0x59aada[_0x9f08('0x10')];})[_0x9f08('0x11')](function(_0x52ab70){logger[_0x9f08('0x12')]('['+[_0x39e238[_0x9f08('0x13')]()]+_0x9f08('0x14'));return _0x52ab70['message'];});}function getUser(_0x582be0,_0x9cd154,_0x45e24e,_0x3c6c0a,_0x2ef45d,_0x4ee49c){return new BPromise(function(_0x2b892d,_0x187b1c){return getAuthToken(_0x9cd154,_0x3c6c0a,_0x4ee49c)[_0x9f08('0x15')](function(_0x4135cf){var _0x323146={'method':'GET','uri':_0x2ef45d+_0x9f08('0x16'),'headers':{'Authorization':'Bearer\x20'+_0x4135cf,'OData-Version':'4.0'},'json':!![]};return rp(_0x323146);})[_0x9f08('0x15')](function(_0x1bed09){var _0x2acec0=_0x1bed09[_0x9f08('0x17')];var _0x249190=![];var _0x46b5d1=null;if(!_[_0x9f08('0x18')](_0x45e24e)){if(intUtil[_0x9f08('0x19')](_0x45e24e[_0x9f08('0x1a')])){_0x582be0[_0x9f08('0x1b')]=_0x45e24e[_0x9f08('0x1a')];for(_0x46b5d1=0x0;_0x46b5d1<_0x2acec0[_0x9f08('0x1c')];_0x46b5d1++){if(_0x2acec0[_0x46b5d1][_0x9f08('0x1d')]===_0x45e24e[_0x9f08('0x1a')]&&!_0x2acec0[_0x46b5d1][_0x9f08('0x1e')]){_0x249190=!![];logger[_0x9f08('0x1f')]('['+[_0x4ee49c['toUpperCase']()]+_0x9f08('0x20')+_0x2acec0[_0x46b5d1][_0x9f08('0x21')]+'!');_0x582be0[_0x9f08('0x22')]=_0x2acec0[_0x46b5d1][_0x9f08('0x21')];}}}}if(!_0x249190){logger[_0x9f08('0x1f')]('['+[_0x4ee49c[_0x9f08('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x582be0[_0x9f08('0x1b')]=_0x9cd154[_0x9f08('0x23')];for(_0x46b5d1=0x0;_0x46b5d1<_0x2acec0[_0x9f08('0x1c')];_0x46b5d1++){if(_0x2acec0[_0x46b5d1][_0x9f08('0x1d')]===_0x9cd154[_0x9f08('0x23')]){_0x582be0[_0x9f08('0x22')]=_0x2acec0[_0x46b5d1][_0x9f08('0x21')];}}}_0x2b892d(_0x582be0);})['catch'](function(_0x5c3a60){_0x187b1c(_0x5c3a60[_0x9f08('0x24')]);});});}function createEndUser(_0x182016,_0x36988a,_0xc1c409,_0x3ceb8f,_0x266965,_0x1405ac){return new BPromise(function(_0x3474d9,_0x5a8bff){return getAuthToken(_0x36988a,_0xc1c409,_0x1405ac)[_0x9f08('0x15')](function(_0x1dfde0){var _0x20088f=_0x1405ac[_0x9f08('0x25')]()===_0x9f08('0x26')?_0x266965[_0x9f08('0x27')]:_0x266965[_0x9f08('0x28')];var _0xc0564b={'method':'POST','uri':_0x3ceb8f+_0x9f08('0x29'),'body':{'telephone1':_0x20088f,'fullname':_0x20088f,'firstname':_0x20088f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x182016[_0x9f08('0x22')]+')'},'headers':{'Authorization':_0x9f08('0x2a')+_0x1dfde0,'OData-Version':_0x9f08('0x2b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xc0564b);})[_0x9f08('0x15')](function(_0x3d204e){var _0x5ea66c=_0x3d204e[_0x9f08('0x2c')][_0x9f08('0x2d')];var _0x311735=_0x5ea66c[_0x9f08('0x2e')](_0x5ea66c[_0x9f08('0x2f')]('(')+0x1,_0x5ea66c[_0x9f08('0x2f')](')'));_0x182016[_0x9f08('0x30')]=_0x311735;_0x3474d9(_0x182016);})[_0x9f08('0x11')](function(_0x9adacc){_0x5a8bff(_0x9adacc['message']);});});}function getEndUser(_0x22bb0b,_0x597a33,_0x11691b,_0x3d172a,_0x36ef70,_0x1c4490){return new BPromise(function(_0x9b3786,_0x8a22ee){return getAuthToken(_0x597a33,_0x11691b,_0x1c4490)['then'](function(_0x159c62){var _0x2f24db={'method':_0x9f08('0x31'),'uri':_0x3d172a+_0x9f08('0x32'),'headers':{'Authorization':_0x9f08('0x2a')+_0x159c62,'If-None-Match':null,'OData-Version':_0x9f08('0x2b')},'json':!![]};return rp(_0x2f24db);})['then'](function(_0x264441){var _0x4b85b2=null;if(_0x264441){var _0x12c4bc=_0x264441[_0x9f08('0x17')];var _0x728238=![];for(_0x4b85b2=0x0;_0x4b85b2<_0x12c4bc[_0x9f08('0x1c')];_0x4b85b2++){var _0x453858=_0x1c4490['toLowerCase']()===_0x9f08('0x26')?_0x36ef70[_0x9f08('0x27')]:_0x36ef70[_0x9f08('0x28')];if(_0x12c4bc[_0x4b85b2]['telephone1']===_0x453858){_0x728238=!![];_0x22bb0b[_0x9f08('0x30')]=_0x12c4bc[_0x4b85b2][_0x9f08('0x33')];}}if(_0x728238){_0x9b3786(_0x22bb0b);}else{return createEndUser(_0x22bb0b,_0x597a33,_0x11691b,_0x3d172a,_0x36ef70,_0x1c4490)[_0x9f08('0x15')](function(_0x4618db){logger[_0x9f08('0x1f')]('['+[_0x1c4490['toUpperCase']()]+_0x9f08('0x34'),_0x4618db[_0x9f08('0x30')]);_0x9b3786(_0x4618db);});}}else{return createEndUser(_0x22bb0b,_0x597a33,_0x11691b,_0x3d172a,_0x36ef70,_0x1c4490)[_0x9f08('0x15')](function(_0x32ee86){logger[_0x9f08('0x1f')]('['+[_0x1c4490[_0x9f08('0x13')]()]+_0x9f08('0x35'),_0x32ee86[_0x9f08('0x30')]);_0x9b3786(_0x32ee86);});}});});}function getCustomFields(_0x2c3180,_0x89e90,_0x35c263){var _0x34dd35={};if(_0x2c3180[_0x9f08('0x1c')]>0x0){_['forEach'](_0x2c3180,function(_0x52f14a){if(_[_0x9f08('0x36')](['string',_0x9f08('0x37')],_0x52f14a[_0x9f08('0x38')])&&_0x52f14a[_0x9f08('0x39')]&&!_0x52f14a[_0x9f08('0x3a')]){var _0x5917bd=_0x52f14a[_0x9f08('0x3b')][_0x9f08('0x25')]();var _0x2363ef=_0x5917bd[_0x9f08('0x2e')](0x0,_0x5917bd[_0x9f08('0x3c')]('_'));var _0x249199=_0x5917bd['substring'](_0x5917bd[_0x9f08('0x3c')]('_')+0x1);if(_0x2363ef===_0x35c263){_0x34dd35[_0x249199]=_0x52f14a[_0x9f08('0x3d')];}}});}return _0x34dd35;}function getTicket(_0xae3a4c,_0x55c6c6,_0x3b396a,_0x587397,_0x2475ba,_0x45275c,_0x426a33){return new BPromise(function(_0x4e4230,_0x100e78){var _0x37e441;return getAuthToken(_0x55c6c6,_0x3b396a,_0x426a33)[_0x9f08('0x15')](function(_0x443e8d){if(_0x45275c[_0x9f08('0x3e')]===_0x9f08('0x3f')){_0x37e441={'method':'POST','uri':_0x587397+_0x9f08('0x40'),'body':Object['assign']({},{'title':intUtil[_0x9f08('0x41')](_0x45275c[_0x9f08('0x42')],_0x2475ba,'\x20'),'description':intUtil[_0x9f08('0x41')](_0x45275c[_0x9f08('0x43')],_0x2475ba,'\x0a'),'customerid_contact@odata.bind':_0x9f08('0x44')+_0xae3a4c[_0x9f08('0x30')]+')','ownerid@odata.bind':_0x9f08('0x45')+_0xae3a4c['userId']+')','caseorigincode':'1'},getCustomFields(_0x45275c['Fields'],_0x2475ba,_0x45275c['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x443e8d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x45275c[_0x9f08('0x3e')]===_0x9f08('0x46')){_0x37e441={'method':'POST','uri':_0x587397+_0x9f08('0x47'),'body':Object['assign']({},{'subject':intUtil[_0x9f08('0x41')](_0x45275c[_0x9f08('0x42')],_0x2475ba,'\x20'),'phonenumber':String(_0x2475ba[_0x9f08('0x28')]),'description':intUtil[_0x9f08('0x41')](_0x45275c['Descriptions'],_0x2475ba,'\x0a'),'regardingobjectid_contact@odata.bind':_0x9f08('0x44')+_0xae3a4c[_0x9f08('0x30')]+')','ownerid@odata.bind':_0x9f08('0x45')+_0xae3a4c['userId']+')','directioncode':_0xae3a4c[_0x9f08('0x48')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0xae3a4c['userId']+')','participationtypemask':_0xae3a4c[_0x9f08('0x48')]===_0x9f08('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x9f08('0x44')+_0xae3a4c[_0x9f08('0x30')]+')','participationtypemask':_0xae3a4c[_0x9f08('0x48')]==='queue'?0x1:0x2}]},getCustomFields(_0x45275c['Fields'],_0x2475ba,_0x45275c[_0x9f08('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x443e8d,'OData-Version':_0x9f08('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x37e441);})[_0x9f08('0x15')](function(_0x49e351){var _0x3fb332=_0x49e351[_0x9f08('0x2c')][_0x9f08('0x2d')];var _0x224e07=_0x3fb332['substring'](_0x3fb332[_0x9f08('0x2f')]('(')+0x1,_0x3fb332[_0x9f08('0x2f')](')'));_0xae3a4c['ticketId']=_0x224e07;_0x4e4230(_0xae3a4c);})['catch'](function(_0x28f169){_0x100e78(_0x28f169['message']);});});}function emit(_0x3d7c0f,_0x187629,_0x46821d,_0x592099){var _0x3132b2={'uri':util[_0x9f08('0x4a')](_0x9f08('0x4b'),_0x3d7c0f,_0x46821d,_0x592099)};io['to'](util[_0x9f08('0x4a')](_0x9f08('0x4c'),_0x187629))[_0x9f08('0x4d')](_0x9f08('0x4e'),_0x3132b2);}exports['cs']=function(_0x370833,_0x41ff72,_0x736f81,_0x2c9231,_0x2917a8,_0x21ddd9,_0x40bb28,_0x2e7b1b){var _0x30cd9e={};_0x21ddd9['remoteUri']=intUtil[_0x9f08('0x4f')](_0x21ddd9[_0x9f08('0xd')]);_0x21ddd9['serverUrl']=intUtil[_0x9f08('0x4f')](_0x21ddd9[_0x9f08('0x50')]);_0x30cd9e[_0x9f08('0x48')]=_0x2e7b1b===_0x9f08('0x49')||_0x2e7b1b===_0x9f08('0x51')?'queue':_0x9f08('0x26');var _0xde78e4=util[_0x9f08('0x4a')](_0x9f08('0x52'),_0x21ddd9[_0x9f08('0xd')]);var _0x1ddde6=util[_0x9f08('0x4a')](_0x9f08('0x53'),_0x21ddd9[_0x9f08('0x54')]);var _0x159601=util[_0x9f08('0x4a')](_0x9f08('0x55'),_0x21ddd9[_0x9f08('0x50')],_0x41ff72[_0x9f08('0x56')],md5(_0x41ff72[_0x9f08('0x56')]));if(_0x2917a8&&_0x2917a8[_0x9f08('0x57')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x41ff72[_0x9f08('0x58')]=_0x159601;}else if(_0x40bb28&&_0x40bb28['recordingFormat']&&_0x40bb28[_0x9f08('0x59')]!==_0x9f08('0x5a')){logger[_0x9f08('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x41ff72[_0x9f08('0x58')]=_0x159601;}else{_0x41ff72[_0x9f08('0x58')]='';}return getUser(_0x30cd9e,_0x21ddd9,_0x2c9231,_0x1ddde6,_0xde78e4,_0x2e7b1b)[_0x9f08('0x15')](function(_0x4bfbd1){logger['info']('['+_0x2e7b1b[_0x9f08('0x13')]()+_0x9f08('0x5b'),_0x4bfbd1[_0x9f08('0x22')]);logger[_0x9f08('0x1f')]('['+_0x2e7b1b[_0x9f08('0x13')]()+_0x9f08('0x5c'),_0x4bfbd1[_0x9f08('0x1b')]);return getEndUser(_0x4bfbd1,_0x21ddd9,_0x1ddde6,_0xde78e4,_0x41ff72,_0x2e7b1b);})['then'](function(_0x53080f){logger[_0x9f08('0x1f')]('['+_0x2e7b1b[_0x9f08('0x13')]()+_0x9f08('0x5d'),_0x53080f[_0x9f08('0x30')]);logger[_0x9f08('0x1f')]('['+_0x2e7b1b[_0x9f08('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x41ff72[_0x9f08('0x28')]);return getTicket(_0x53080f,_0x21ddd9,_0x1ddde6,_0xde78e4,_0x41ff72,_0x736f81,_0x2e7b1b);})['then'](function(_0x284fb5){logger[_0x9f08('0x1f')](util[_0x9f08('0x4a')]('['+_0x2e7b1b[_0x9f08('0x13')]()+_0x9f08('0x5e'),_0x736f81[_0x9f08('0x3e')],_0x284fb5[_0x9f08('0x5f')]));logger[_0x9f08('0x1f')](util[_0x9f08('0x4a')]('['+_0x2e7b1b['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x2e7b1b));if(_0x2e7b1b!==_0x9f08('0x51')){logger[_0x9f08('0x1f')]('['+_0x2e7b1b[_0x9f08('0x13')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x21ddd9[_0x9f08('0xd')],_0x2c9231[_0x9f08('0x60')],_0x736f81['ticketType'],_0x284fb5[_0x9f08('0x5f')]);}})[_0x9f08('0x11')](function(_0x5253cb){logger[_0x9f08('0x12')]('['+_0x2e7b1b[_0x9f08('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x9f08('0x61')](_0x5253cb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3095=[']\x20Enduser\x20Created!','forEach','includes','picklist','customField','idField','substring','indexOf','incidents','assign','getString','Subjects','Descriptions','Fields','ticketType','phonecall','callDirection','queue','/contacts(','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','remoteUri','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','contacts?$select=telephone1','calleridnum','telephone1','contactid',']\x20Enduser\x20created!','enduserId'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3095,0x158));var _0x5309=function(_0x761b6d,_0x7c7fa8){_0x761b6d=_0x761b6d-0x0;var _0x3a1639=_0x3095[_0x761b6d];return _0x3a1639;};'use strict';var _=require(_0x5309('0x0'));var BPromise=require(_0x5309('0x1'));var rp=require(_0x5309('0x2'));var util=require('util');var intUtil=require('./util');var md5=require(_0x5309('0x3'));var Redis=require(_0x5309('0x4'));var logger=require(_0x5309('0x5'))(_0x5309('0x6'));var config=require(_0x5309('0x7'));config[_0x5309('0x8')]=_[_0x5309('0x9')](config[_0x5309('0x8')],{'host':_0x5309('0xa'),'port':0x18eb});var io=require(_0x5309('0xb'))(new Redis(config[_0x5309('0x8')]));function getAuthToken(_0x40c392,_0x4e522f,_0x384b6e){var _0x1078d7={'method':_0x5309('0xc'),'uri':_0x4e522f,'form':{'client_id':_0x40c392[_0x5309('0xd')],'resource':_0x40c392['remoteUri'],'username':_0x40c392[_0x5309('0xe')],'password':_0x40c392[_0x5309('0xf')],'grant_type':_0x5309('0xf'),'client_secret':_0x40c392[_0x5309('0x10')]},'json':!![]};return rp(_0x1078d7)[_0x5309('0x11')](function(_0x19b5fe){return _0x19b5fe[_0x5309('0x12')];})[_0x5309('0x13')](function(_0xc7e98d){logger[_0x5309('0x14')]('['+[_0x384b6e[_0x5309('0x15')]()]+']\x20Wrong\x20credentials!');return _0xc7e98d['message'];});}function getUser(_0x6526f8,_0x516f44,_0x4cb644,_0x3bc3d8,_0x3dda22,_0x1b6410){return new BPromise(function(_0x525216,_0x321bc4){return getAuthToken(_0x516f44,_0x3bc3d8,_0x1b6410)['then'](function(_0x55ceea){var _0xde3215={'method':_0x5309('0x16'),'uri':_0x3dda22+_0x5309('0x17'),'headers':{'Authorization':_0x5309('0x18')+_0x55ceea,'OData-Version':_0x5309('0x19')},'json':!![]};return rp(_0xde3215);})['then'](function(_0x5d8ee0){var _0x3b763a=_0x5d8ee0[_0x5309('0x1a')];var _0x4cd49d=![];var _0x319a0b=null;if(!_[_0x5309('0x1b')](_0x4cb644)){if(intUtil['validateEmail'](_0x4cb644[_0x5309('0x1c')])){_0x6526f8['userEmail']=_0x4cb644[_0x5309('0x1c')];for(_0x319a0b=0x0;_0x319a0b<_0x3b763a[_0x5309('0x1d')];_0x319a0b++){if(_0x3b763a[_0x319a0b][_0x5309('0x1e')]===_0x4cb644[_0x5309('0x1c')]&&!_0x3b763a[_0x319a0b][_0x5309('0x1f')]){_0x4cd49d=!![];logger['info']('['+[_0x1b6410[_0x5309('0x15')]()]+_0x5309('0x20')+_0x3b763a[_0x319a0b][_0x5309('0x21')]+'!');_0x6526f8[_0x5309('0x22')]=_0x3b763a[_0x319a0b][_0x5309('0x21')];}}}}if(!_0x4cd49d){logger[_0x5309('0x23')]('['+[_0x1b6410[_0x5309('0x15')]()]+_0x5309('0x24'));_0x6526f8['userEmail']=_0x516f44[_0x5309('0xe')];for(_0x319a0b=0x0;_0x319a0b<_0x3b763a['length'];_0x319a0b++){if(_0x3b763a[_0x319a0b][_0x5309('0x1e')]===_0x516f44[_0x5309('0xe')]){_0x6526f8[_0x5309('0x22')]=_0x3b763a[_0x319a0b][_0x5309('0x21')];}}}_0x525216(_0x6526f8);})[_0x5309('0x13')](function(_0x259c38){_0x321bc4(_0x259c38[_0x5309('0x25')]);});});}function createEndUser(_0x271633,_0x35afe1,_0x3bd46a,_0x1c2e95,_0x1d640a,_0x474a75){return new BPromise(function(_0x37dbe5,_0x489cac){return getAuthToken(_0x35afe1,_0x3bd46a,_0x474a75)[_0x5309('0x11')](function(_0x284c94){var _0x137dff=_0x474a75[_0x5309('0x26')]()===_0x5309('0x27')?_0x1d640a[_0x5309('0x28')]:_0x1d640a['calleridnum'];var _0x32af40={'method':_0x5309('0xc'),'uri':_0x1c2e95+_0x5309('0x29'),'body':{'telephone1':_0x137dff,'fullname':_0x137dff,'firstname':_0x137dff,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5309('0x2a')+_0x271633[_0x5309('0x22')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x284c94,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x32af40);})[_0x5309('0x11')](function(_0x4e6f42){var _0x86aa18=_0x4e6f42[_0x5309('0x2b')][_0x5309('0x2c')];var _0x3d8dbe=_0x86aa18['substring'](_0x86aa18[_0x5309('0x2d')]('(')+0x1,_0x86aa18['lastIndexOf'](')'));_0x271633['enduserId']=_0x3d8dbe;_0x37dbe5(_0x271633);})['catch'](function(_0x581395){_0x489cac(_0x581395[_0x5309('0x25')]);});});}function getEndUser(_0x371292,_0x348933,_0x53bdd0,_0x5d9314,_0x49b283,_0x246b2f){return new BPromise(function(_0x24fef0,_0x3afe2f){return getAuthToken(_0x348933,_0x53bdd0,_0x246b2f)[_0x5309('0x11')](function(_0x269622){var _0x2bd5d3={'method':'GET','uri':_0x5d9314+_0x5309('0x2e'),'headers':{'Authorization':'Bearer\x20'+_0x269622,'If-None-Match':null,'OData-Version':_0x5309('0x19')},'json':!![]};return rp(_0x2bd5d3);})[_0x5309('0x11')](function(_0x58711d){var _0x3cf627=null;if(_0x58711d){var _0x10ba63=_0x58711d[_0x5309('0x1a')];var _0x4051c8=![];for(_0x3cf627=0x0;_0x3cf627<_0x10ba63[_0x5309('0x1d')];_0x3cf627++){var _0x21f26f=_0x246b2f[_0x5309('0x26')]()===_0x5309('0x27')?_0x49b283['destcalleridnum']:_0x49b283[_0x5309('0x2f')];if(_0x10ba63[_0x3cf627][_0x5309('0x30')]===_0x21f26f){_0x4051c8=!![];_0x371292['enduserId']=_0x10ba63[_0x3cf627][_0x5309('0x31')];}}if(_0x4051c8){_0x24fef0(_0x371292);}else{return createEndUser(_0x371292,_0x348933,_0x53bdd0,_0x5d9314,_0x49b283,_0x246b2f)[_0x5309('0x11')](function(_0x56e02f){logger['info']('['+[_0x246b2f[_0x5309('0x15')]()]+_0x5309('0x32'),_0x56e02f[_0x5309('0x33')]);_0x24fef0(_0x56e02f);});}}else{return createEndUser(_0x371292,_0x348933,_0x53bdd0,_0x5d9314,_0x49b283,_0x246b2f)['then'](function(_0x5ab97f){logger[_0x5309('0x23')]('['+[_0x246b2f['toUpperCase']()]+_0x5309('0x34'),_0x5ab97f[_0x5309('0x33')]);_0x24fef0(_0x5ab97f);});}});});}function getCustomFields(_0x1c4333,_0x2cf3a8,_0x4c4c3c){var _0x4a147e={};if(_0x1c4333[_0x5309('0x1d')]>0x0){_[_0x5309('0x35')](_0x1c4333,function(_0x41161d){if(_[_0x5309('0x36')](['string',_0x5309('0x37')],_0x41161d['type'])&&_0x41161d['nameField']&&!_0x41161d[_0x5309('0x38')]){var _0x34c28b=_0x41161d[_0x5309('0x39')][_0x5309('0x26')]();var _0x11cd5f=_0x34c28b[_0x5309('0x3a')](0x0,_0x34c28b[_0x5309('0x3b')]('_'));var _0x21098f=_0x34c28b[_0x5309('0x3a')](_0x34c28b[_0x5309('0x3b')]('_')+0x1);if(_0x11cd5f===_0x4c4c3c){_0x4a147e[_0x21098f]=_0x41161d['content'];}}});}return _0x4a147e;}function getTicket(_0x890fdb,_0x27fc33,_0x3af032,_0x5e91af,_0x3f1747,_0x32e43e,_0xf031bc){return new BPromise(function(_0x4c32ce,_0x3177f6){var _0x5e0066;return getAuthToken(_0x27fc33,_0x3af032,_0xf031bc)[_0x5309('0x11')](function(_0x41ab5c){if(_0x32e43e['ticketType']==='incident'){_0x5e0066={'method':_0x5309('0xc'),'uri':_0x5e91af+_0x5309('0x3c'),'body':Object[_0x5309('0x3d')]({},{'title':intUtil[_0x5309('0x3e')](_0x32e43e[_0x5309('0x3f')],_0x3f1747,'\x20'),'description':intUtil[_0x5309('0x3e')](_0x32e43e[_0x5309('0x40')],_0x3f1747,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x890fdb['enduserId']+')','ownerid@odata.bind':_0x5309('0x2a')+_0x890fdb[_0x5309('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x32e43e[_0x5309('0x41')],_0x3f1747,_0x32e43e[_0x5309('0x42')])),'headers':{'Authorization':_0x5309('0x18')+_0x41ab5c,'OData-Version':_0x5309('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x32e43e[_0x5309('0x42')]===_0x5309('0x43')){_0x5e0066={'method':'POST','uri':_0x5e91af+'phonecalls','body':Object[_0x5309('0x3d')]({},{'subject':intUtil[_0x5309('0x3e')](_0x32e43e[_0x5309('0x3f')],_0x3f1747,'\x20'),'phonenumber':String(_0x3f1747[_0x5309('0x2f')]),'description':intUtil[_0x5309('0x3e')](_0x32e43e[_0x5309('0x40')],_0x3f1747,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x890fdb[_0x5309('0x33')]+')','ownerid@odata.bind':'/systemusers('+_0x890fdb[_0x5309('0x22')]+')','directioncode':_0x890fdb[_0x5309('0x44')]===_0x5309('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x890fdb[_0x5309('0x22')]+')','participationtypemask':_0x890fdb[_0x5309('0x44')]===_0x5309('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x5309('0x46')+_0x890fdb['enduserId']+')','participationtypemask':_0x890fdb[_0x5309('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x32e43e[_0x5309('0x41')],_0x3f1747,_0x32e43e[_0x5309('0x42')])),'headers':{'Authorization':_0x5309('0x18')+_0x41ab5c,'OData-Version':_0x5309('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e0066);})[_0x5309('0x11')](function(_0x61f5cd){var _0x51c32d=_0x61f5cd[_0x5309('0x2b')][_0x5309('0x2c')];var _0x5142df=_0x51c32d[_0x5309('0x3a')](_0x51c32d[_0x5309('0x2d')]('(')+0x1,_0x51c32d[_0x5309('0x2d')](')'));_0x890fdb['ticketId']=_0x5142df;_0x4c32ce(_0x890fdb);})[_0x5309('0x13')](function(_0x3859ff){_0x3177f6(_0x3859ff['message']);});});}function emit(_0x27274e,_0x42d42a,_0x3f6743,_0x54ba18){var _0x439995={'uri':util[_0x5309('0x47')](_0x5309('0x48'),_0x27274e,_0x3f6743,_0x54ba18)};io['to'](util['format'](_0x5309('0x49'),_0x42d42a))[_0x5309('0x4a')](_0x5309('0x4b'),_0x439995);}exports['cs']=function(_0x54b8e7,_0x3fbb21,_0x15ba57,_0x4b5e3d,_0x8f8667,_0x26292c,_0x31d309,_0x3d9c66){var _0x442773={};_0x26292c['remoteUri']=intUtil[_0x5309('0x4c')](_0x26292c['remoteUri']);_0x26292c[_0x5309('0x4d')]=intUtil[_0x5309('0x4c')](_0x26292c[_0x5309('0x4d')]);_0x442773[_0x5309('0x44')]=_0x3d9c66===_0x5309('0x45')||_0x3d9c66==='unmanaged'?_0x5309('0x45'):_0x5309('0x27');var _0x2bb97=util[_0x5309('0x47')](_0x5309('0x4e'),_0x26292c['remoteUri']);var _0x2af694=util[_0x5309('0x47')](_0x5309('0x4f'),_0x26292c[_0x5309('0x50')]);var _0x557ee6=util[_0x5309('0x47')](_0x5309('0x51'),_0x26292c[_0x5309('0x4d')],_0x3fbb21[_0x5309('0x52')],md5(_0x3fbb21[_0x5309('0x52')]));if(_0x8f8667&&_0x8f8667[_0x5309('0x53')]){logger['info'](_0x5309('0x54'),'Recording\x20is\x20enabled!');_0x3fbb21[_0x5309('0x55')]=_0x557ee6;}else if(_0x31d309&&_0x31d309[_0x5309('0x56')]&&_0x31d309[_0x5309('0x56')]!==_0x5309('0x57')){logger[_0x5309('0x23')](_0x5309('0x58'),'Recording\x20is\x20enabled!');_0x3fbb21[_0x5309('0x55')]=_0x557ee6;}else{_0x3fbb21[_0x5309('0x55')]='';}return getUser(_0x442773,_0x26292c,_0x4b5e3d,_0x2af694,_0x2bb97,_0x3d9c66)[_0x5309('0x11')](function(_0x4f0e81){logger['info']('['+_0x3d9c66['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x4f0e81['userId']);logger[_0x5309('0x23')]('['+_0x3d9c66[_0x5309('0x15')]()+_0x5309('0x59'),_0x4f0e81['userEmail']);return getEndUser(_0x4f0e81,_0x26292c,_0x2af694,_0x2bb97,_0x3fbb21,_0x3d9c66);})[_0x5309('0x11')](function(_0x5cb8e9){logger[_0x5309('0x23')]('['+_0x3d9c66['toUpperCase']()+_0x5309('0x5a'),_0x5cb8e9[_0x5309('0x33')]);logger['info']('['+_0x3d9c66[_0x5309('0x15')]()+_0x5309('0x5b'),_0x3fbb21[_0x5309('0x2f')]);return getTicket(_0x5cb8e9,_0x26292c,_0x2af694,_0x2bb97,_0x3fbb21,_0x15ba57,_0x3d9c66);})[_0x5309('0x11')](function(_0x56f838){logger['info'](util['format']('['+_0x3d9c66[_0x5309('0x15')]()+_0x5309('0x5c'),_0x15ba57['ticketType'],_0x56f838['ticketId']));logger[_0x5309('0x23')](util['format']('['+_0x3d9c66[_0x5309('0x15')]()+_0x5309('0x5d'),_0x3d9c66));if(_0x3d9c66!=='unmanaged'){logger[_0x5309('0x23')]('['+_0x3d9c66[_0x5309('0x15')]()+']',_0x5309('0x5e'));emit(_0x26292c[_0x5309('0x5f')],_0x4b5e3d[_0x5309('0x60')],_0x15ba57[_0x5309('0x42')],_0x56f838[_0x5309('0x61')]);}})['catch'](function(_0x52c56f){logger['error']('['+_0x3d9c66['toUpperCase']()+_0x5309('0x62'),util['inspect'](_0x52c56f,{'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 e125ac3..d26ecde 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 _0xe54e=['Descriptions','
','name','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','%s/api/v2/agents','info','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','nameField','toLowerCase','content','picklist','idField','push','type','variable','variableName','customField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','unmanaged','monitor_format','calleridnum','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','calleridname','Subjects','getString'];(function(_0x1b4a4e,_0x3c77e2){var _0xb09f92=function(_0xc7f665){while(--_0xc7f665){_0x1b4a4e['push'](_0x1b4a4e['shift']());}};_0xb09f92(++_0x3c77e2);}(_0xe54e,0x1b6));var _0xee54=function(_0x4bbc56,_0x515e96){_0x4bbc56=_0x4bbc56-0x0;var _0x3ab938=_0xe54e[_0x4bbc56];return _0x3ab938;};'use strict';var _=require('lodash');var rp=require(_0xee54('0x0'));var md5=require(_0xee54('0x1'));var util=require('util');var Redis=require(_0xee54('0x2'));var intUtil=require(_0xee54('0x3'));var config=require(_0xee54('0x4'));var logger=require('../../../../config/logger')(_0xee54('0x5'));config[_0xee54('0x6')]=_[_0xee54('0x7')](config[_0xee54('0x6')],{'host':_0xee54('0x8'),'port':0x18eb});var io=require(_0xee54('0x9'))(new Redis(config[_0xee54('0x6')]));var headers={'Content-Type':_0xee54('0xa'),'Accept':_0xee54('0xa')};function emit(_0x767302,_0x365a53,_0x5821f3){io['to'](_0x767302)['emit'](_0x365a53,_0x5821f3);}function getTicket(_0x30f3bf,_0x288ef9,_0x11b078,_0x35d8e1,_0xee253e){logger['info'](_0xee54('0xb'));var _0x2fec2c=_[_0xee54('0xc')]({'responder_id':_0x288ef9['id'],'requester_id':_0x11b078['id'],'name':util[_0xee54('0xd')]('Caller\x20-\x20%s',_0xee253e[_0xee54('0xe')]),'phone':_0xee253e['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x35d8e1[_0xee54('0xf')],_0xee253e,'\x20'),'description':intUtil[_0xee54('0x10')](_0x35d8e1[_0xee54('0x11')],_0xee253e,_0xee54('0x12')),'tags':getTags(_0x35d8e1['Tags'],_0xee54('0x13'))},getCustomFields(_0x35d8e1['Fields'],_0xee253e));_0x2fec2c[_0xee54('0x14')]=_['mapValues'](_[_0xee54('0x15')](_0x2fec2c['custom_fields'],'id'),_0xee54('0x16'));return request({'uri':util[_0xee54('0xd')](_0xee54('0x17'),_0x30f3bf[_0xee54('0x18')]),'method':_0xee54('0x19'),'body':_0x2fec2c})[_0xee54('0x1a')](function(_0x3a963b){logger['info']('Ticket\x20created!');return _0x3a963b;});}function getUser(_0x5c9b3a,_0x37a475){if(intUtil[_0xee54('0x1b')](_0x37a475)){return request({'uri':util[_0xee54('0xd')](_0xee54('0x1c'),_0x5c9b3a[_0xee54('0x18')]),'qs':{'email':_0x37a475}})[_0xee54('0x1a')](function(_0x23c83a){if(_0x23c83a['length']){logger[_0xee54('0x1d')](_0xee54('0x1e'));return _['find'](_0x23c83a,function(_0x30331e){return _0x30331e[_0xee54('0x1f')][_0xee54('0x20')]===_0x37a475;});}else{logger[_0xee54('0x1d')](_0xee54('0x21'));return request({'uri':util[_0xee54('0xd')]('%s/api/v2/agents/me',_0x5c9b3a[_0xee54('0x18')])})['then'](function(_0x55ef76){logger['info'](_0xee54('0x22'));return _0x55ef76;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xee54('0x23'),_0x5c9b3a[_0xee54('0x18')])})[_0xee54('0x1a')](function(_0x362353){logger[_0xee54('0x1d')](_0xee54('0x22'));return _0x362353;});}}function getEndUser(_0x59bbad,_0x4e5d87,_0x1c4ecd){logger[_0xee54('0x1d')](_0xee54('0x24'),_0x1c4ecd);return request({'uri':util['format'](_0xee54('0x25'),_0x59bbad['remoteUri']),'qs':{'phone':_0x1c4ecd}})['then'](function(_0x54fd83){if(_0x54fd83[_0xee54('0x26')]){logger['info']('Enduser\x20found!');return _[_0xee54('0x27')](_0x54fd83,{'phone':_0x1c4ecd});}else{logger[_0xee54('0x1d')](_0xee54('0x28'));return request({'uri':util[_0xee54('0xd')](_0xee54('0x25'),_0x59bbad[_0xee54('0x18')]),'method':_0xee54('0x19'),'body':{'name':_0x4e5d87,'phone':_0x1c4ecd}})[_0xee54('0x1a')](function(_0xbb0f36){logger[_0xee54('0x1d')]('Enduser\x20created.');return _0xbb0f36;});}});}function getAuth(_0x52d541){return util['format'](_0xee54('0x29'),new Buffer(_0x52d541[_0xee54('0x2a')]+':X')[_0xee54('0x2b')](_0xee54('0x2c')));}function request(_0x55e77a){logger[_0xee54('0x2d')](_0xee54('0x2e'),JSON[_0xee54('0x2f')](_0x55e77a));return rp(_[_0xee54('0x7')](_0x55e77a,{'method':_0xee54('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x2785fd,_0x122fc0){var _0x14a17f=[];if(_0x2785fd&&_0x2785fd['length']>0x0){_0x14a17f=_['map'](_0x2785fd,_0x122fc0);}return _0x14a17f;}function getCustomFields(_0x25cd7c,_0xa97192){var _0x343f9f=[];var _0x3f1591={'custom_fields':[]};if(_0x25cd7c[_0xee54('0x26')]>0x0){_[_0xee54('0x31')](_0x25cd7c,function(_0x20cd08){if(_[_0xee54('0x32')]([_0xee54('0x33'),'picklist'],_0x20cd08['type'])&&_0x20cd08[_0xee54('0x34')]&&!_0x20cd08['customField']){_0x3f1591[_0x20cd08[_0xee54('0x34')][_0xee54('0x35')]()]=_0x20cd08[_0xee54('0x36')][_0xee54('0x2b')]();}else if(_[_0xee54('0x32')]([_0xee54('0x33'),_0xee54('0x37')],_0x20cd08['type'])&&_0x20cd08[_0xee54('0x38')]&&_0x20cd08['customField']){_0x3f1591[_0xee54('0x14')][_0xee54('0x39')]({'id':_0x20cd08[_0xee54('0x38')],'value':_0x20cd08[_0xee54('0x36')][_0xee54('0x2b')]()});}else if(_0x20cd08[_0xee54('0x3a')]===_0xee54('0x3b')&&_0x20cd08[_0xee54('0x3c')]&&_0x20cd08[_0xee54('0x38')]&&_0x20cd08[_0xee54('0x3d')]){_0xa97192[_0x20cd08[_0xee54('0x3c')]]&&_0x3f1591[_0xee54('0x14')][_0xee54('0x39')]({'id':_0x20cd08[_0xee54('0x38')],'value':_0xa97192[_0x20cd08[_0xee54('0x3c')]][_0xee54('0x2b')]()});}else if(_0x20cd08[_0xee54('0x3a')]===_0xee54('0x3e')&&_0x20cd08[_0xee54('0x3f')]&&_0x20cd08[_0xee54('0x3f')][_0xee54('0x13')]&&_0x20cd08[_0xee54('0x38')]&&_0x20cd08[_0xee54('0x3d')]){_0xa97192[_0x20cd08[_0xee54('0x3f')][_0xee54('0x13')][_0xee54('0x35')]()]&&_0x3f1591[_0xee54('0x14')][_0xee54('0x39')]({'id':_0x20cd08[_0xee54('0x38')],'value':_0xa97192[_0x20cd08[_0xee54('0x3f')][_0xee54('0x13')][_0xee54('0x35')]()][_0xee54('0x2b')]()});}});}return _0x3f1591;}exports[_0xee54('0x40')]=function(_0x1b1128,_0x4d985f,_0xdcbdeb,_0x429391,_0x5fceb7,_0x159859){var _0x5ae9d0,_0x383bbe;_0x159859[_0xee54('0x18')]=intUtil[_0xee54('0x41')](_0x159859[_0xee54('0x18')]);_0x159859[_0xee54('0x42')]=intUtil[_0xee54('0x41')](_0x159859['serverUrl']);if(_0x5fceb7&&_0x5fceb7['monitor_format']){logger[_0xee54('0x1d')](_0xee54('0x43'),_0xee54('0x44'));_0x4d985f[_0xee54('0x45')]=util[_0xee54('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x159859[_0xee54('0x42')],_0x4d985f[_0xee54('0x46')],md5(_0x4d985f[_0xee54('0x46')]));}else{_0x4d985f[_0xee54('0x45')]='';}headers[_0xee54('0x47')]=getAuth(_0x159859);return getUser(_0x159859,_0x429391[_0xee54('0x20')])[_0xee54('0x1a')](function(_0x3d2e92){_0x5ae9d0=_0x3d2e92;logger['info'](_0xee54('0x48'),_0x5ae9d0['id']);return getEndUser(_0x159859,_0x4d985f[_0xee54('0xe')],_0x4d985f['calleridnum']);})[_0xee54('0x1a')](function(_0x52c6d8){_0x383bbe=_0x52c6d8;logger['info'](_0xee54('0x49'),_0x383bbe['id']);return getTicket(_0x159859,_0x5ae9d0,_0x383bbe,_0xdcbdeb,_0x4d985f);})['then'](function(_0xd20d16){if(_0xd20d16&&_0xd20d16['id']){logger['info'](_0xee54('0x4a'));logger[_0xee54('0x1d')](_0xee54('0x4b'),_0xd20d16['id']);logger[_0xee54('0x1d')](_0xee54('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xee54('0x4c'),_0x429391[_0xee54('0x13')]),_0xee54('0x4d'),{'uri':util['format'](_0xee54('0x4e'),_0x159859[_0xee54('0x18')],_0xd20d16['id'])});}})[_0xee54('0x4f')](function(_0x486f40){logger[_0xee54('0x50')](_0xee54('0x43'),JSON[_0xee54('0x2f')](_0x486f40));});};exports['outbound']=function(_0x4a9212,_0x345d4e,_0x167f00,_0x10406a,_0x4ff2c4,_0x344e60,_0x12af8b){var _0x580b79,_0x45c916;_0x344e60['remoteUri']=intUtil['stripTrailingSlash'](_0x344e60[_0xee54('0x18')]);_0x344e60[_0xee54('0x42')]=intUtil[_0xee54('0x41')](_0x344e60['serverUrl']);if(_0x12af8b&&_0x12af8b[_0xee54('0x51')]&&_0x12af8b[_0xee54('0x51')]!==_0xee54('0x52')){logger[_0xee54('0x1d')](_0xee54('0x53'),_0xee54('0x44'));_0x345d4e[_0xee54('0x45')]=util[_0xee54('0xd')](_0xee54('0x54'),_0x344e60[_0xee54('0x42')],_0x345d4e['uniqueid'],md5(_0x345d4e[_0xee54('0x46')]));}headers[_0xee54('0x47')]=getAuth(_0x344e60);return getUser(_0x344e60,_0x10406a[_0xee54('0x20')])[_0xee54('0x1a')](function(_0x3e0ea6){_0x580b79=_0x3e0ea6;logger[_0xee54('0x1d')](_0xee54('0x48'),_0x580b79['id']);return getEndUser(_0x344e60,_0x345d4e[_0xee54('0x55')],_0x345d4e[_0xee54('0x56')]);})[_0xee54('0x1a')](function(_0x42b67c){_0x45c916=_0x42b67c;logger[_0xee54('0x1d')](_0xee54('0x49'),_0x45c916['id']);return getTicket(_0x344e60,_0x580b79,_0x45c916,_0x167f00,_0x345d4e);})['then'](function(_0x1eb1c6){if(_0x1eb1c6&&_0x1eb1c6['id']){logger[_0xee54('0x1d')](_0xee54('0x4a'));logger[_0xee54('0x1d')](_0xee54('0x4b'),_0x1eb1c6['id']);logger[_0xee54('0x1d')](_0xee54('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xee54('0xd')](_0xee54('0x4c'),_0x10406a[_0xee54('0x13')]),_0xee54('0x4d'),{'uri':util[_0xee54('0xd')](_0xee54('0x4e'),_0x344e60[_0xee54('0x18')],_0x1eb1c6['id'])});}})[_0xee54('0x4f')](function(_0xe46fef){logger[_0xee54('0x50')](_0xee54('0x53'),JSON[_0xee54('0x2f')](_0xe46fef));});};exports[_0xee54('0x57')]=function(_0x599e2d,_0x1df81e,_0x51b942,_0x33ee66,_0x234892,_0x3df19a){var _0x451bef,_0x37025b;_0x3df19a['remoteUri']=intUtil['stripTrailingSlash'](_0x3df19a[_0xee54('0x18')]);_0x3df19a[_0xee54('0x42')]=intUtil[_0xee54('0x41')](_0x3df19a[_0xee54('0x42')]);if(_0x234892&&_0x234892[_0xee54('0x58')]){logger[_0xee54('0x1d')]('['+_0x1df81e['lastevent']['toUpperCase']()+']',_0xee54('0x44'));_0x1df81e[_0xee54('0x45')]=util[_0xee54('0xd')](_0xee54('0x54'),_0x3df19a[_0xee54('0x42')],_0x1df81e['uniqueid'],md5(_0x1df81e[_0xee54('0x46')]));}else{_0x1df81e['recordingURL']='';}headers[_0xee54('0x47')]=getAuth(_0x3df19a);return getUser(_0x3df19a,'')[_0xee54('0x1a')](function(_0x7a68a9){_0x451bef=_0x7a68a9;logger['info']('The\x20User\x20ID\x20is:',_0x451bef['id']);return getEndUser(_0x3df19a,_0x1df81e[_0xee54('0xe')],_0x1df81e[_0xee54('0x59')]);})[_0xee54('0x1a')](function(_0x383890){_0x37025b=_0x383890;logger[_0xee54('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x37025b['id']);return getTicket(_0x3df19a,_0x451bef,_0x37025b,_0x51b942,_0x1df81e);})[_0xee54('0x1a')](function(_0x9664ce){if(_0x9664ce){logger[_0xee54('0x1d')]('Ticket\x20created!');logger[_0xee54('0x1d')](_0xee54('0x4b'),_0x9664ce['id']);}})[_0xee54('0x4f')](function(_0x2d1131){logger['error']('['+_0x1df81e['lastevent'][_0xee54('0x5a')]()+']',JSON['stringify'](_0x2d1131));});}; \ No newline at end of file +var _0x280b=['%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','customField','nameField','toLowerCase','string','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','catch','error','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','toUpperCase','lastevent','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','Tags','name','Fields','custom_fields','keyBy','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail'];(function(_0x26cd65,_0x3e6b6f){var _0x51c930=function(_0x48a242){while(--_0x48a242){_0x26cd65['push'](_0x26cd65['shift']());}};_0x51c930(++_0x3e6b6f);}(_0x280b,0x1f0));var _0xb280=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x280b[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var rp=require(_0xb280('0x0'));var md5=require(_0xb280('0x1'));var util=require(_0xb280('0x2'));var Redis=require('ioredis');var intUtil=require(_0xb280('0x3'));var config=require(_0xb280('0x4'));var logger=require(_0xb280('0x5'))('freshdesk');config['redis']=_[_0xb280('0x6')](config[_0xb280('0x7')],{'host':_0xb280('0x8'),'port':0x18eb});var io=require(_0xb280('0x9'))(new Redis(config[_0xb280('0x7')]));var headers={'Content-Type':_0xb280('0xa'),'Accept':_0xb280('0xa')};function emit(_0x4d3915,_0x18478e,_0xbd7e76){io['to'](_0x4d3915)[_0xb280('0xb')](_0x18478e,_0xbd7e76);}function getTicket(_0x15dddc,_0x90f13c,_0x322c9a,_0x29a752,_0x17da6a){logger[_0xb280('0xc')](_0xb280('0xd'));var _0x4f01ee=_[_0xb280('0xe')]({'responder_id':_0x90f13c['id'],'requester_id':_0x322c9a['id'],'name':util['format'](_0xb280('0xf'),_0x17da6a[_0xb280('0x10')]),'phone':_0x17da6a[_0xb280('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb280('0x12')](_0x29a752['Subjects'],_0x17da6a,'\x20'),'description':intUtil[_0xb280('0x12')](_0x29a752[_0xb280('0x13')],_0x17da6a,'
'),'tags':getTags(_0x29a752[_0xb280('0x14')],_0xb280('0x15'))},getCustomFields(_0x29a752[_0xb280('0x16')],_0x17da6a));_0x4f01ee[_0xb280('0x17')]=_['mapValues'](_[_0xb280('0x18')](_0x4f01ee[_0xb280('0x17')],'id'),'value');return request({'uri':util[_0xb280('0x19')](_0xb280('0x1a'),_0x15dddc[_0xb280('0x1b')]),'method':_0xb280('0x1c'),'body':_0x4f01ee})[_0xb280('0x1d')](function(_0x5a09ae){logger[_0xb280('0xc')](_0xb280('0x1e'));return _0x5a09ae;});}function getUser(_0x2ba2de,_0x2602b5){if(intUtil[_0xb280('0x1f')](_0x2602b5)){return request({'uri':util[_0xb280('0x19')](_0xb280('0x20'),_0x2ba2de[_0xb280('0x1b')]),'qs':{'email':_0x2602b5}})[_0xb280('0x1d')](function(_0xf4f25d){if(_0xf4f25d[_0xb280('0x21')]){logger['info'](_0xb280('0x22'));return _[_0xb280('0x23')](_0xf4f25d,function(_0x485738){return _0x485738[_0xb280('0x24')][_0xb280('0x25')]===_0x2602b5;});}else{logger[_0xb280('0xc')](_0xb280('0x26'));return request({'uri':util[_0xb280('0x19')]('%s/api/v2/agents/me',_0x2ba2de[_0xb280('0x1b')])})[_0xb280('0x1d')](function(_0x5f398a){logger['info']('Admin\x20account\x20selected.');return _0x5f398a;});}});}else{logger[_0xb280('0xc')](_0xb280('0x27'));return request({'uri':util[_0xb280('0x19')]('%s/api/v2/agents/me',_0x2ba2de[_0xb280('0x1b')])})[_0xb280('0x1d')](function(_0x55c62c){logger[_0xb280('0xc')]('Admin\x20account\x20selected.');return _0x55c62c;});}}function getEndUser(_0x84f2b0,_0x1637d2,_0x2b77cd){logger[_0xb280('0xc')]('Searching\x20enduser\x20with\x20phone',_0x2b77cd);return request({'uri':util['format'](_0xb280('0x28'),_0x84f2b0[_0xb280('0x1b')]),'qs':{'phone':_0x2b77cd}})[_0xb280('0x1d')](function(_0x505a50){if(_0x505a50[_0xb280('0x21')]){logger[_0xb280('0xc')]('Enduser\x20found!');return _['find'](_0x505a50,{'phone':_0x2b77cd});}else{logger[_0xb280('0xc')](_0xb280('0x29'));return request({'uri':util[_0xb280('0x19')](_0xb280('0x28'),_0x84f2b0[_0xb280('0x1b')]),'method':_0xb280('0x1c'),'body':{'name':_0x1637d2,'phone':_0x2b77cd}})[_0xb280('0x1d')](function(_0x58c550){logger['info'](_0xb280('0x2a'));return _0x58c550;});}});}function getAuth(_0x3181b3){return util['format']('Basic\x20%s',new Buffer(_0x3181b3[_0xb280('0x2b')]+':X')[_0xb280('0x2c')]('base64'));}function request(_0x2bb59a){logger['debug'](_0xb280('0x2d'),JSON[_0xb280('0x2e')](_0x2bb59a));return rp(_[_0xb280('0x6')](_0x2bb59a,{'method':_0xb280('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x59ecd5,_0x2ea39c){var _0x1d91f7=[];if(_0x59ecd5&&_0x59ecd5[_0xb280('0x21')]>0x0){_0x1d91f7=_[_0xb280('0x30')](_0x59ecd5,_0x2ea39c);}return _0x1d91f7;}function getCustomFields(_0x31231e,_0x35d370){var _0x3722e4=[];var _0x48c2e4={'custom_fields':[]};if(_0x31231e['length']>0x0){_[_0xb280('0x31')](_0x31231e,function(_0x4024a9){if(_[_0xb280('0x32')](['string',_0xb280('0x33')],_0x4024a9[_0xb280('0x34')])&&_0x4024a9['nameField']&&!_0x4024a9[_0xb280('0x35')]){_0x48c2e4[_0x4024a9[_0xb280('0x36')][_0xb280('0x37')]()]=_0x4024a9['content'][_0xb280('0x2c')]();}else if(_[_0xb280('0x32')]([_0xb280('0x38'),'picklist'],_0x4024a9[_0xb280('0x34')])&&_0x4024a9[_0xb280('0x39')]&&_0x4024a9[_0xb280('0x35')]){_0x48c2e4[_0xb280('0x17')][_0xb280('0x3a')]({'id':_0x4024a9[_0xb280('0x39')],'value':_0x4024a9['content'][_0xb280('0x2c')]()});}else if(_0x4024a9['type']===_0xb280('0x3b')&&_0x4024a9['variableName']&&_0x4024a9[_0xb280('0x39')]&&_0x4024a9['customField']){_0x35d370[_0x4024a9[_0xb280('0x3c')]]&&_0x48c2e4['custom_fields'][_0xb280('0x3a')]({'id':_0x4024a9[_0xb280('0x39')],'value':_0x35d370[_0x4024a9[_0xb280('0x3c')]][_0xb280('0x2c')]()});}else if(_0x4024a9[_0xb280('0x34')]===_0xb280('0x3d')&&_0x4024a9[_0xb280('0x3e')]&&_0x4024a9[_0xb280('0x3e')][_0xb280('0x15')]&&_0x4024a9['idField']&&_0x4024a9[_0xb280('0x35')]){_0x35d370[_0x4024a9[_0xb280('0x3e')][_0xb280('0x15')]['toLowerCase']()]&&_0x48c2e4[_0xb280('0x17')][_0xb280('0x3a')]({'id':_0x4024a9[_0xb280('0x39')],'value':_0x35d370[_0x4024a9[_0xb280('0x3e')][_0xb280('0x15')]['toLowerCase']()][_0xb280('0x2c')]()});}});}return _0x48c2e4;}exports[_0xb280('0x3f')]=function(_0x58c307,_0x1cd126,_0x256603,_0x17598f,_0x225c3c,_0xffb8cd){var _0x27ac8c,_0x130ea8;_0xffb8cd[_0xb280('0x1b')]=intUtil[_0xb280('0x40')](_0xffb8cd[_0xb280('0x1b')]);_0xffb8cd['serverUrl']=intUtil['stripTrailingSlash'](_0xffb8cd[_0xb280('0x41')]);if(_0x225c3c&&_0x225c3c[_0xb280('0x42')]){logger[_0xb280('0xc')]('[QUEUE]',_0xb280('0x43'));_0x1cd126[_0xb280('0x44')]=util['format'](_0xb280('0x45'),_0xffb8cd[_0xb280('0x41')],_0x1cd126[_0xb280('0x46')],md5(_0x1cd126['uniqueid']));}else{_0x1cd126[_0xb280('0x44')]='';}headers[_0xb280('0x47')]=getAuth(_0xffb8cd);return getUser(_0xffb8cd,_0x17598f[_0xb280('0x25')])[_0xb280('0x1d')](function(_0x3ad041){_0x27ac8c=_0x3ad041;logger[_0xb280('0xc')](_0xb280('0x48'),_0x27ac8c['id']);return getEndUser(_0xffb8cd,_0x1cd126['calleridname'],_0x1cd126['calleridnum']);})[_0xb280('0x1d')](function(_0x3e40e2){_0x130ea8=_0x3e40e2;logger[_0xb280('0xc')]('The\x20Enduser\x20ID\x20is:',_0x130ea8['id']);return getTicket(_0xffb8cd,_0x27ac8c,_0x130ea8,_0x256603,_0x1cd126);})['then'](function(_0x396e94){if(_0x396e94&&_0x396e94['id']){logger[_0xb280('0xc')]('Ticket\x20created!');logger[_0xb280('0xc')](_0xb280('0x49'),_0x396e94['id']);logger['info'](_0xb280('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb280('0x19')](_0xb280('0x4b'),_0x17598f[_0xb280('0x15')]),_0xb280('0x4c'),{'uri':util[_0xb280('0x19')]('%s/helpdesk/tickets/%d',_0xffb8cd[_0xb280('0x1b')],_0x396e94['id'])});}})[_0xb280('0x4d')](function(_0x11be83){logger[_0xb280('0x4e')]('[QUEUE]',JSON[_0xb280('0x2e')](_0x11be83));});};exports[_0xb280('0x4f')]=function(_0x15a4ec,_0x525f4d,_0x38f1e8,_0x2c20f1,_0x4105b8,_0x1a3002,_0x2d85ec){var _0x88e547,_0x5f06b2;_0x1a3002['remoteUri']=intUtil[_0xb280('0x40')](_0x1a3002['remoteUri']);_0x1a3002[_0xb280('0x41')]=intUtil[_0xb280('0x40')](_0x1a3002['serverUrl']);if(_0x2d85ec&&_0x2d85ec['recordingFormat']&&_0x2d85ec['recordingFormat']!==_0xb280('0x50')){logger[_0xb280('0xc')](_0xb280('0x51'),_0xb280('0x43'));_0x525f4d[_0xb280('0x44')]=util[_0xb280('0x19')](_0xb280('0x45'),_0x1a3002[_0xb280('0x41')],_0x525f4d[_0xb280('0x46')],md5(_0x525f4d[_0xb280('0x46')]));}headers[_0xb280('0x47')]=getAuth(_0x1a3002);return getUser(_0x1a3002,_0x2c20f1[_0xb280('0x25')])['then'](function(_0x1bc3ea){_0x88e547=_0x1bc3ea;logger[_0xb280('0xc')](_0xb280('0x48'),_0x88e547['id']);return getEndUser(_0x1a3002,_0x525f4d[_0xb280('0x52')],_0x525f4d[_0xb280('0x53')]);})['then'](function(_0x1b4475){_0x5f06b2=_0x1b4475;logger[_0xb280('0xc')](_0xb280('0x54'),_0x5f06b2['id']);return getTicket(_0x1a3002,_0x88e547,_0x5f06b2,_0x38f1e8,_0x525f4d);})[_0xb280('0x1d')](function(_0x34de50){if(_0x34de50&&_0x34de50['id']){logger['info']('Ticket\x20created!');logger['info'](_0xb280('0x49'),_0x34de50['id']);logger['info'](_0xb280('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb280('0x19')](_0xb280('0x4b'),_0x2c20f1[_0xb280('0x15')]),_0xb280('0x4c'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x1a3002[_0xb280('0x1b')],_0x34de50['id'])});}})[_0xb280('0x4d')](function(_0x2e49a6){logger[_0xb280('0x4e')](_0xb280('0x51'),JSON[_0xb280('0x2e')](_0x2e49a6));});};exports[_0xb280('0x55')]=function(_0x226123,_0x5d306b,_0x3a8b11,_0x46c558,_0x1d0b2c,_0x262206){var _0x294842,_0x2339f5;_0x262206[_0xb280('0x1b')]=intUtil[_0xb280('0x40')](_0x262206['remoteUri']);_0x262206[_0xb280('0x41')]=intUtil[_0xb280('0x40')](_0x262206['serverUrl']);if(_0x1d0b2c&&_0x1d0b2c[_0xb280('0x42')]){logger[_0xb280('0xc')]('['+_0x5d306b['lastevent'][_0xb280('0x56')]()+']',_0xb280('0x43'));_0x5d306b[_0xb280('0x44')]=util[_0xb280('0x19')](_0xb280('0x45'),_0x262206[_0xb280('0x41')],_0x5d306b[_0xb280('0x46')],md5(_0x5d306b[_0xb280('0x46')]));}else{_0x5d306b[_0xb280('0x44')]='';}headers['Authorization']=getAuth(_0x262206);return getUser(_0x262206,'')['then'](function(_0x5c7439){_0x294842=_0x5c7439;logger[_0xb280('0xc')]('The\x20User\x20ID\x20is:',_0x294842['id']);return getEndUser(_0x262206,_0x5d306b['calleridname'],_0x5d306b[_0xb280('0x11')]);})['then'](function(_0x387dd4){_0x2339f5=_0x387dd4;logger[_0xb280('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2339f5['id']);return getTicket(_0x262206,_0x294842,_0x2339f5,_0x3a8b11,_0x5d306b);})['then'](function(_0x204192){if(_0x204192){logger[_0xb280('0xc')](_0xb280('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x204192['id']);}})[_0xb280('0x4d')](function(_0x23877a){logger['error']('['+_0x5d306b[_0xb280('0x57')]['toUpperCase']()+']',JSON[_0xb280('0x2e')](_0x23877a));});}; \ 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 79661bd..f280b1a 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 _0x4c0d=['remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20with\x20email','userEmail','email','agentEmail','userId','Admin\x20selected','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','/api/contacts','contact','POST','/api/tasks','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey'];(function(_0x4cc56d,_0x17612e){var _0x5ca502=function(_0xdbd4ec){while(--_0xdbd4ec){_0x4cc56d['push'](_0x4cc56d['shift']());}};_0x5ca502(++_0x17612e);}(_0x4c0d,0xbf));var _0xd4c0=function(_0x1485ee,_0x5a8ba3){_0x1485ee=_0x1485ee-0x0;var _0x45934e=_0x4c0d[_0x1485ee];return _0x45934e;};'use strict';var _=require(_0xd4c0('0x0'));var rp=require(_0xd4c0('0x1'));var md5=require(_0xd4c0('0x2'));var util=require(_0xd4c0('0x3'));var moment=require(_0xd4c0('0x4'));var Promise=require(_0xd4c0('0x5'));var Redis=require(_0xd4c0('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xd4c0('0x7'))(_0xd4c0('0x8'));config[_0xd4c0('0x9')]=_[_0xd4c0('0xa')](config[_0xd4c0('0x9')],{'host':_0xd4c0('0xb'),'port':0x18eb});var io=require(_0xd4c0('0xc'))(new Redis(config[_0xd4c0('0x9')]));function getAdminId(_0x511ce9,_0x43e71f,_0x2651b4,_0x4da132){return new Promise(function(_0xa1ed5c,_0x3ec639){var _0x50b08a=![];var _0x1659b7={'method':_0xd4c0('0xd'),'uri':_0x4da132+'/api/selector/owners','json':!![]};_0x1659b7[_0xd4c0('0xe')]=_0x2651b4;logger[_0xd4c0('0xf')](_0xd4c0('0x10'));return rp(_0x1659b7)[_0xd4c0('0x11')](function(_0x2846d8){if(_0x2846d8){var _0x222844=_0x2846d8[_0xd4c0('0x12')];var _0x3eca9f=null;for(_0x3eca9f=0x0;_0x3eca9f<_0x222844[_0xd4c0('0x13')];_0x3eca9f++){if(_0x222844[_0x3eca9f]['email']===_0x511ce9[_0xd4c0('0x14')]){_0x511ce9[_0xd4c0('0x15')]=_0x222844[_0x3eca9f]['id'];_0x50b08a=!![];}}if(_0x50b08a){logger[_0xd4c0('0xf')](_0xd4c0('0x16'),_0x511ce9['adminId']);_0xa1ed5c(_0x511ce9);}else{_0x3ec639({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3ec639({'statusCode':0x194,'message':_0xd4c0('0x17')});}})[_0xd4c0('0x18')](function(_0x404a00){logger[_0xd4c0('0x19')]('['+[_0x43e71f[_0xd4c0('0x1a')]()]+']',_0x404a00[_0xd4c0('0x1b')]);_0x3ec639(_0x404a00);});});}function getUser(_0x574cbd,_0x4bcfd0,_0x36cd02){return function(_0x3399af){return new Promise(function(_0x5a3586,_0x17f8fb){var _0x596dde={'method':_0xd4c0('0xd'),'uri':_0x36cd02+_0xd4c0('0x1c'),'json':!![]};_0x596dde[_0xd4c0('0xe')]=_0x4bcfd0;logger['info']('Getting\x20user\x20list');return rp(_0x596dde)['then'](function(_0x28f0cd){if(_0x28f0cd){var _0x303010=_0x28f0cd[_0xd4c0('0x12')];var _0x359c7e=![];var _0x152c14=null;if(_0x3399af['agentEmail']!==null){logger['info'](_0xd4c0('0x1d'),_0x3399af['agentEmail']);_0x3399af[_0xd4c0('0x1e')]=_0x3399af['agentEmail'];for(_0x152c14=0x0;_0x152c14<_0x303010['length'];_0x152c14++){if(_0x303010[_0x152c14][_0xd4c0('0x1f')]===_0x3399af[_0xd4c0('0x20')]){_0x359c7e=!![];_0x3399af[_0xd4c0('0x21')]=_0x303010[_0x152c14]['id'];logger[_0xd4c0('0xf')]('User\x20found:',_0x3399af['userId']);}}}if(!_0x359c7e){logger[_0xd4c0('0xf')](_0xd4c0('0x22'));_0x3399af[_0xd4c0('0x1e')]=_0x3399af['adminEmail'];_0x3399af[_0xd4c0('0x21')]=_0x3399af[_0xd4c0('0x15')];_0x359c7e=!![];}if(_0x359c7e){_0x5a3586(_0x3399af);}else{_0x17f8fb({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x17f8fb({'statusCode':0x194,'message':_0xd4c0('0x17')});}})[_0xd4c0('0x18')](function(_0x25e171){logger[_0xd4c0('0x19')]('['+[_0x574cbd[_0xd4c0('0x1a')]()]+']',_0x25e171[_0xd4c0('0x1b')]);_0x17f8fb(_0x25e171);});});};}function searchContact(_0x32256a,_0xa890c7,_0x5223a6,_0x15e88e){return new Promise(function(_0x204136,_0x3f41ba){var _0x129ba5={'method':'GET','headers':_0xa890c7,'uri':_0x32256a+_0xd4c0('0x23')+_0x15e88e+_0xd4c0('0x24')+_0x5223a6+'&entities=contact','json':!![]};rp(_0x129ba5)[_0xd4c0('0x11')](function(_0x5ec459){var _0xdc6a8=_[_0xd4c0('0x25')](_0x5ec459[_0xd4c0('0x26')]['contacts'],[_0x5223a6,_0x15e88e]);_0x204136(_0xdc6a8);})[_0xd4c0('0x18')](function(_0x49496e){_0x3f41ba(_0x49496e);});});}function getEndUser(_0x53f098,_0x3de922,_0x5e7362){return function(_0x5a2fc0){return new Promise(function(_0x4cb9fc,_0x2ebff3){logger[_0xd4c0('0xf')](util[_0xd4c0('0x27')](_0xd4c0('0x28'),_0x5a2fc0['contactNumber']));searchContact(_0x5e7362,_0x3de922,_0xd4c0('0x29'),_0x5a2fc0[_0xd4c0('0x2a')])[_0xd4c0('0x11')](function(_0x402ad1){if(_0x402ad1){_0x5a2fc0[_0xd4c0('0x2b')]=_0x402ad1['id'];logger['info'](_0xd4c0('0x2c'),_0x5a2fc0[_0xd4c0('0x2b')]);return _0x4cb9fc(_0x5a2fc0);}searchContact(_0x5e7362,_0x3de922,_0xd4c0('0x2d'),_0x5a2fc0['contactNumber'])[_0xd4c0('0x11')](function(_0xdcce1a){if(_0xdcce1a){_0x5a2fc0[_0xd4c0('0x2b')]=_0xdcce1a['id'];logger[_0xd4c0('0xf')]('Contact\x20found\x20work_number:',_0x5a2fc0[_0xd4c0('0x2b')]);return _0x4cb9fc(_0x5a2fc0);}createEndUser(_0x5a2fc0,_0x53f098,_0x3de922,_0x5e7362)[_0xd4c0('0x11')](function(_0x4f0592){logger['info'](_0xd4c0('0x2e'),_0x4f0592[_0xd4c0('0x2b')]);return _0x4cb9fc(_0x4f0592);});});})[_0xd4c0('0x18')](function(_0x26b5a6){_0x2ebff3(_0x26b5a6);});});};}function createEndUser(_0x2da115,_0x514d6d,_0x2f8523,_0x2f20f6){return new Promise(function(_0x20fbbe,_0x3ff9e9){var _0x428982=moment();var _0x35afd3={'method':'POST','uri':_0x2f20f6+_0xd4c0('0x2f'),'body':{'contact':{'last_name':_0x2da115['contactNumber'],'work_number':_0x2da115[_0xd4c0('0x2a')],'mobile_number':_0x2da115['contactNumber'],'owner_id':_0x2da115[_0xd4c0('0x21')],'created_at':_0x428982['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x35afd3['headers']=_0x2f8523;logger[_0xd4c0('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x35afd3)[_0xd4c0('0x11')](function(_0x575818){_0x2da115[_0xd4c0('0x2b')]=_0x575818[_0xd4c0('0x30')]['id'];_0x20fbbe(_0x2da115);})[_0xd4c0('0x18')](function(_0x2bb6b0){logger[_0xd4c0('0x19')]('['+[_0x514d6d[_0xd4c0('0x1a')]()]+']',_0x2bb6b0[_0xd4c0('0x1b')]);_0x3ff9e9(_0x2bb6b0[_0xd4c0('0x1b')]);});});}function getTicket(_0x45ebdb,_0x43015c,_0x55b0a2,_0x532042,_0x43d970){return function(_0x15bf86){logger[_0xd4c0('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x39f3d8,_0x4f0370){var _0x81753b=moment();var _0x414b0c={'method':_0xd4c0('0x31'),'uri':_0x55b0a2+_0xd4c0('0x32'),'body':{'title':intUtil['getString'](_0x532042[_0xd4c0('0x33')],_0x43d970,'\x20'),'description':intUtil['getString'](_0x532042[_0xd4c0('0x34')],_0x43d970,'\x0a'),'owner_id':_0x15bf86[_0xd4c0('0x21')],'creater_id':_0x15bf86[_0xd4c0('0x15')],'targetable_id':_0x15bf86[_0xd4c0('0x2b')],'targetable_type':_0xd4c0('0x35'),'created_at':_0x81753b[_0xd4c0('0x27')](_0xd4c0('0x36')),'due_date':_0x81753b[_0xd4c0('0x37')](0x1e,'m')[_0xd4c0('0x27')](_0xd4c0('0x36'))},'json':!![]};_0x414b0c['headers']=_0x43015c;return rp(_0x414b0c)['then'](function(_0x330f74){_0x15bf86[_0xd4c0('0x38')]=_0x330f74[_0xd4c0('0x39')]['id'];logger[_0xd4c0('0xf')](_0xd4c0('0x3a'),_0x15bf86['ticketId']);_0x39f3d8(_0x15bf86);})['catch'](function(_0x39890a){logger['error']('['+[_0x45ebdb[_0xd4c0('0x1a')]()]+']',_0x39890a[_0xd4c0('0x1b')]);_0x4f0370(_0x39890a['message']);});});};}function emit(_0x2f7a8b,_0x5acbb1,_0x45d806){var _0x410e33={'uri':_0x2f7a8b+'/contacts/'+_0x45d806};io['to'](util['format'](_0xd4c0('0x3b'),_0x5acbb1))[_0xd4c0('0x3c')](_0xd4c0('0x3d'),_0x410e33);}exports['cs']=function(_0x18bb66,_0x30e606,_0x3471d0,_0x48445c,_0x3cc6c6,_0x5657c2,_0x3d2fa0,_0x19a7a7){var _0x56da12={};var _0xf80d9e={'Authorization':_0xd4c0('0x3e')+_0x5657c2[_0xd4c0('0x3f')]};_0x5657c2[_0xd4c0('0x40')]=intUtil['stripTrailingSlash'](_0x5657c2[_0xd4c0('0x40')]);_0x5657c2[_0xd4c0('0x41')]=intUtil[_0xd4c0('0x42')](_0x5657c2[_0xd4c0('0x41')]);var _0x12f644=_0x5657c2[_0xd4c0('0x40')];_0x56da12[_0xd4c0('0x14')]=_0x5657c2[_0xd4c0('0x43')];_0x56da12[_0xd4c0('0x2a')]=_0x19a7a7[_0xd4c0('0x44')]()===_0xd4c0('0x45')?_0x30e606[_0xd4c0('0x46')]:_0x30e606[_0xd4c0('0x47')];_0x56da12[_0xd4c0('0x48')]=_0x19a7a7===_0xd4c0('0x49')||_0x19a7a7===_0xd4c0('0x4a')?'queue':_0xd4c0('0x45');if(_0x48445c){_0x56da12[_0xd4c0('0x20')]=_0x48445c[_0xd4c0('0x1f')];}var _0xcddd45=util[_0xd4c0('0x27')](_0xd4c0('0x4b'),_0x5657c2[_0xd4c0('0x41')],_0x30e606[_0xd4c0('0x4c')],md5(_0x30e606[_0xd4c0('0x4c')]));if(_0x3cc6c6&&_0x3cc6c6['monitor_format']){logger['info']('[QUEUE]',_0xd4c0('0x4d'));_0x30e606[_0xd4c0('0x4e')]=_0xcddd45;}else if(_0x3d2fa0&&_0x3d2fa0[_0xd4c0('0x4f')]&&_0x3d2fa0['recordingFormat']!=='none'){logger['info'](_0xd4c0('0x50'),_0xd4c0('0x4d'));_0x30e606[_0xd4c0('0x4e')]=_0xcddd45;}else{_0x30e606[_0xd4c0('0x4e')]='';}return getAdminId(_0x56da12,_0x19a7a7,_0xf80d9e,_0x12f644)[_0xd4c0('0x11')](getUser(_0x19a7a7,_0xf80d9e,_0x12f644))[_0xd4c0('0x11')](getEndUser(_0x19a7a7,_0xf80d9e,_0x12f644))['then'](getTicket(_0x19a7a7,_0xf80d9e,_0x12f644,_0x3471d0,_0x30e606))['then'](function(_0x32dd15){logger[_0xd4c0('0xf')](util[_0xd4c0('0x27')](_0xd4c0('0x51'),_0x32dd15['ticketId']));if(_0x19a7a7!=='unmanaged'){logger[_0xd4c0('0xf')]('['+[_0x19a7a7[_0xd4c0('0x1a')]()]+']',_0xd4c0('0x52'));emit(_0x12f644,_0x48445c[_0xd4c0('0x53')],_0x32dd15['endUserId']);}})[_0xd4c0('0x18')](function(_0x3f00f0){logger[_0xd4c0('0x19')]('['+[_0x19a7a7['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xd4c0('0x54')](_0x3f00f0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7b31=['calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','length','adminId','Requested\x20Resource\x20not\x20Found','toUpperCase','message','headers','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','catch','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','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','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','outbound'];(function(_0x48d36c,_0x2baeab){var _0x3051c3=function(_0x10e4cd){while(--_0x10e4cd){_0x48d36c['push'](_0x48d36c['shift']());}};_0x3051c3(++_0x2baeab);}(_0x7b31,0xb0));var _0x17b3=function(_0x1a557a,_0x2db5ce){_0x1a557a=_0x1a557a-0x0;var _0x47f18f=_0x7b31[_0x1a557a];return _0x47f18f;};'use strict';var _=require(_0x17b3('0x0'));var rp=require(_0x17b3('0x1'));var md5=require(_0x17b3('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0x17b3('0x3'));var Redis=require(_0x17b3('0x4'));var intUtil=require(_0x17b3('0x5'));var config=require(_0x17b3('0x6'));var logger=require('../../../../config/logger')(_0x17b3('0x7'));config[_0x17b3('0x8')]=_[_0x17b3('0x9')](config[_0x17b3('0x8')],{'host':_0x17b3('0xa'),'port':0x18eb});var io=require(_0x17b3('0xb'))(new Redis(config['redis']));function getAdminId(_0x330e8f,_0x2b5521,_0x3b5017,_0x2a4deb){return new Promise(function(_0x2402c9,_0x21b0e2){var _0x1216f1=![];var _0x3b2a99={'method':_0x17b3('0xc'),'uri':_0x2a4deb+_0x17b3('0xd'),'json':!![]};_0x3b2a99['headers']=_0x3b5017;logger[_0x17b3('0xe')](_0x17b3('0xf'));return rp(_0x3b2a99)['then'](function(_0x19c1ed){if(_0x19c1ed){var _0x5730ca=_0x19c1ed[_0x17b3('0x10')];var _0x1110ea=null;for(_0x1110ea=0x0;_0x1110ea<_0x5730ca[_0x17b3('0x11')];_0x1110ea++){if(_0x5730ca[_0x1110ea]['email']===_0x330e8f['adminEmail']){_0x330e8f[_0x17b3('0x12')]=_0x5730ca[_0x1110ea]['id'];_0x1216f1=!![];}}if(_0x1216f1){logger['info']('Admin\x20found:',_0x330e8f[_0x17b3('0x12')]);_0x2402c9(_0x330e8f);}else{_0x21b0e2({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x21b0e2({'statusCode':0x194,'message':_0x17b3('0x13')});}})['catch'](function(_0xc0ea65){logger['error']('['+[_0x2b5521[_0x17b3('0x14')]()]+']',_0xc0ea65[_0x17b3('0x15')]);_0x21b0e2(_0xc0ea65);});});}function getUser(_0x4f5614,_0xe5af5,_0xd541b8){return function(_0x461873){return new Promise(function(_0x260e31,_0x484bb5){var _0x2823ec={'method':_0x17b3('0xc'),'uri':_0xd541b8+'/api/selector/owners','json':!![]};_0x2823ec[_0x17b3('0x16')]=_0xe5af5;logger[_0x17b3('0xe')]('Getting\x20user\x20list');return rp(_0x2823ec)[_0x17b3('0x17')](function(_0x2fa450){if(_0x2fa450){var _0x35509b=_0x2fa450[_0x17b3('0x10')];var _0x527217=![];var _0x24c4f1=null;if(_0x461873[_0x17b3('0x18')]!==null){logger[_0x17b3('0xe')](_0x17b3('0x19'),_0x461873[_0x17b3('0x18')]);_0x461873[_0x17b3('0x1a')]=_0x461873[_0x17b3('0x18')];for(_0x24c4f1=0x0;_0x24c4f1<_0x35509b['length'];_0x24c4f1++){if(_0x35509b[_0x24c4f1][_0x17b3('0x1b')]===_0x461873['agentEmail']){_0x527217=!![];_0x461873['userId']=_0x35509b[_0x24c4f1]['id'];logger[_0x17b3('0xe')]('User\x20found:',_0x461873[_0x17b3('0x1c')]);}}}if(!_0x527217){logger[_0x17b3('0xe')]('Admin\x20selected');_0x461873['userEmail']=_0x461873['adminEmail'];_0x461873[_0x17b3('0x1c')]=_0x461873[_0x17b3('0x12')];_0x527217=!![];}if(_0x527217){_0x260e31(_0x461873);}else{_0x484bb5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x484bb5({'statusCode':0x194,'message':_0x17b3('0x13')});}})[_0x17b3('0x1d')](function(_0x342ec0){logger[_0x17b3('0x1e')]('['+[_0x4f5614[_0x17b3('0x14')]()]+']',_0x342ec0[_0x17b3('0x15')]);_0x484bb5(_0x342ec0);});});};}function searchContact(_0x54f2e0,_0x5747e7,_0x2d11c6,_0x2c4525){return new Promise(function(_0x19f6aa,_0x16b412){var _0x5cce8d={'method':_0x17b3('0xc'),'headers':_0x5747e7,'uri':_0x54f2e0+_0x17b3('0x1f')+_0x2c4525+_0x17b3('0x20')+_0x2d11c6+_0x17b3('0x21'),'json':!![]};rp(_0x5cce8d)[_0x17b3('0x17')](function(_0x5572cf){var _0x5c1529=_[_0x17b3('0x22')](_0x5572cf[_0x17b3('0x23')]['contacts'],[_0x2d11c6,_0x2c4525]);_0x19f6aa(_0x5c1529);})[_0x17b3('0x1d')](function(_0x2cfc73){_0x16b412(_0x2cfc73);});});}function getEndUser(_0x54fe05,_0x1e3739,_0x31068f){return function(_0xed9dfe){return new Promise(function(_0x178019,_0x2ab15d){logger['info'](util[_0x17b3('0x24')](_0x17b3('0x25'),_0xed9dfe[_0x17b3('0x26')]));searchContact(_0x31068f,_0x1e3739,_0x17b3('0x27'),_0xed9dfe['contactNumber'])[_0x17b3('0x17')](function(_0x49a175){if(_0x49a175){_0xed9dfe[_0x17b3('0x28')]=_0x49a175['id'];logger[_0x17b3('0xe')]('Contact\x20found\x20mobile_number:',_0xed9dfe[_0x17b3('0x28')]);return _0x178019(_0xed9dfe);}searchContact(_0x31068f,_0x1e3739,_0x17b3('0x29'),_0xed9dfe[_0x17b3('0x26')])[_0x17b3('0x17')](function(_0x21c4d8){if(_0x21c4d8){_0xed9dfe[_0x17b3('0x28')]=_0x21c4d8['id'];logger[_0x17b3('0xe')](_0x17b3('0x2a'),_0xed9dfe[_0x17b3('0x28')]);return _0x178019(_0xed9dfe);}createEndUser(_0xed9dfe,_0x54fe05,_0x1e3739,_0x31068f)[_0x17b3('0x17')](function(_0x5c5c25){logger['info'](_0x17b3('0x2b'),_0x5c5c25[_0x17b3('0x28')]);return _0x178019(_0x5c5c25);});});})[_0x17b3('0x1d')](function(_0x10e5f3){_0x2ab15d(_0x10e5f3);});});};}function createEndUser(_0x13f652,_0x1e53e2,_0x310f39,_0x10d4a6){return new Promise(function(_0x2f3e27,_0x1e66fd){var _0x34226b=moment();var _0x11aa16={'method':_0x17b3('0x2c'),'uri':_0x10d4a6+_0x17b3('0x2d'),'body':{'contact':{'last_name':_0x13f652['contactNumber'],'work_number':_0x13f652[_0x17b3('0x26')],'mobile_number':_0x13f652[_0x17b3('0x26')],'owner_id':_0x13f652[_0x17b3('0x1c')],'created_at':_0x34226b[_0x17b3('0x24')](_0x17b3('0x2e'))}},'json':!![]};_0x11aa16[_0x17b3('0x16')]=_0x310f39;logger[_0x17b3('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x11aa16)['then'](function(_0x342468){_0x13f652[_0x17b3('0x28')]=_0x342468[_0x17b3('0x2f')]['id'];_0x2f3e27(_0x13f652);})[_0x17b3('0x1d')](function(_0x132709){logger[_0x17b3('0x1e')]('['+[_0x1e53e2[_0x17b3('0x14')]()]+']',_0x132709['message']);_0x1e66fd(_0x132709[_0x17b3('0x15')]);});});}function getTicket(_0x55c699,_0x1bdaca,_0x21836b,_0x4b1b6a,_0x329445){return function(_0x4fe886){logger[_0x17b3('0xe')](_0x17b3('0x30'));return new Promise(function(_0x31e180,_0x35fd14){var _0x293de3=moment();var _0x37ccb7={'method':_0x17b3('0x2c'),'uri':_0x21836b+'/api/tasks','body':{'title':intUtil[_0x17b3('0x31')](_0x4b1b6a[_0x17b3('0x32')],_0x329445,'\x20'),'description':intUtil[_0x17b3('0x31')](_0x4b1b6a[_0x17b3('0x33')],_0x329445,'\x0a'),'owner_id':_0x4fe886[_0x17b3('0x1c')],'creater_id':_0x4fe886[_0x17b3('0x12')],'targetable_id':_0x4fe886[_0x17b3('0x28')],'targetable_type':_0x17b3('0x34'),'created_at':_0x293de3[_0x17b3('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x293de3['add'](0x1e,'m')[_0x17b3('0x24')](_0x17b3('0x2e'))},'json':!![]};_0x37ccb7[_0x17b3('0x16')]=_0x1bdaca;return rp(_0x37ccb7)[_0x17b3('0x17')](function(_0x25f0ee){_0x4fe886[_0x17b3('0x35')]=_0x25f0ee['task']['id'];logger[_0x17b3('0xe')](_0x17b3('0x36'),_0x4fe886['ticketId']);_0x31e180(_0x4fe886);})[_0x17b3('0x1d')](function(_0x231872){logger[_0x17b3('0x1e')]('['+[_0x55c699[_0x17b3('0x14')]()]+']',_0x231872[_0x17b3('0x15')]);_0x35fd14(_0x231872[_0x17b3('0x15')]);});});};}function emit(_0x34e874,_0x439f8f,_0x358f65){var _0xfd7179={'uri':_0x34e874+_0x17b3('0x37')+_0x358f65};io['to'](util[_0x17b3('0x24')](_0x17b3('0x38'),_0x439f8f))[_0x17b3('0x39')](_0x17b3('0x3a'),_0xfd7179);}exports['cs']=function(_0x2258df,_0xe8df43,_0x58121c,_0x450544,_0x36ca43,_0x45a1c1,_0x5aa6a6,_0x5021f2){var _0x3a47dc={};var _0x35c8bf={'Authorization':'Token\x20token='+_0x45a1c1[_0x17b3('0x3b')]};_0x45a1c1[_0x17b3('0x3c')]=intUtil[_0x17b3('0x3d')](_0x45a1c1[_0x17b3('0x3c')]);_0x45a1c1['serverUrl']=intUtil[_0x17b3('0x3d')](_0x45a1c1[_0x17b3('0x3e')]);var _0x51b593=_0x45a1c1['remoteUri'];_0x3a47dc[_0x17b3('0x3f')]=_0x45a1c1[_0x17b3('0x40')];_0x3a47dc[_0x17b3('0x26')]=_0x5021f2[_0x17b3('0x41')]()===_0x17b3('0x42')?_0xe8df43['destcalleridnum']:_0xe8df43[_0x17b3('0x43')];_0x3a47dc[_0x17b3('0x44')]=_0x5021f2===_0x17b3('0x45')||_0x5021f2===_0x17b3('0x46')?_0x17b3('0x45'):'outbound';if(_0x450544){_0x3a47dc[_0x17b3('0x18')]=_0x450544[_0x17b3('0x1b')];}var _0x1fe72b=util[_0x17b3('0x24')](_0x17b3('0x47'),_0x45a1c1[_0x17b3('0x3e')],_0xe8df43[_0x17b3('0x48')],md5(_0xe8df43['uniqueid']));if(_0x36ca43&&_0x36ca43['monitor_format']){logger[_0x17b3('0xe')](_0x17b3('0x49'),_0x17b3('0x4a'));_0xe8df43['recordingURL']=_0x1fe72b;}else if(_0x5aa6a6&&_0x5aa6a6[_0x17b3('0x4b')]&&_0x5aa6a6[_0x17b3('0x4b')]!==_0x17b3('0x4c')){logger[_0x17b3('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xe8df43[_0x17b3('0x4d')]=_0x1fe72b;}else{_0xe8df43[_0x17b3('0x4d')]='';}return getAdminId(_0x3a47dc,_0x5021f2,_0x35c8bf,_0x51b593)[_0x17b3('0x17')](getUser(_0x5021f2,_0x35c8bf,_0x51b593))['then'](getEndUser(_0x5021f2,_0x35c8bf,_0x51b593))[_0x17b3('0x17')](getTicket(_0x5021f2,_0x35c8bf,_0x51b593,_0x58121c,_0xe8df43))[_0x17b3('0x17')](function(_0x33c837){logger[_0x17b3('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x33c837[_0x17b3('0x35')]));if(_0x5021f2!==_0x17b3('0x46')){logger[_0x17b3('0xe')]('['+[_0x5021f2[_0x17b3('0x14')]()]+']',_0x17b3('0x4e'));emit(_0x51b593,_0x450544[_0x17b3('0x4f')],_0x33c837[_0x17b3('0x28')]);}})[_0x17b3('0x1d')](function(_0x509841){logger[_0x17b3('0x1e')]('['+[_0x5021f2['toUpperCase']()]+_0x17b3('0x50'),util['inspect'](_0x509841,{'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 09623e8..842944a 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 _0x965c=['sugarcrm','desk','vtiger','freshsales','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshdesk','zoho','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk'];(function(_0x5d1e7a,_0x55aea3){var _0x2aec13=function(_0x42a002){while(--_0x42a002){_0x5d1e7a['push'](_0x5d1e7a['shift']());}};_0x2aec13(++_0x55aea3);}(_0x965c,0x8e));var _0xc965=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x965c[_0x38eb23];return _0x48506a;};'use strict';var _=require(_0xc965('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xc965('0x1'));var sugarcrm=require(_0xc965('0x2'));var freshdesk=require(_0xc965('0x3'));var zoho=require(_0xc965('0x4'));var desk=require(_0xc965('0x5'));var vtiger=require(_0xc965('0x6'));var servicenow=require(_0xc965('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xc965('0x8'));var integrations=[_0xc965('0x9'),'salesforce',_0xc965('0xa'),'freshdesk','zoho',_0xc965('0xb'),_0xc965('0xc'),'dynamics365',_0xc965('0xd'),'servicenow'];exports[_0xc965('0xe')]=function(_0x21c55c,_0x1735f6,_0x22aa51,_0x516573,_0x54b02b,_0x439e21){if(_0x22aa51){if(_[_0xc965('0xf')](integrations,_0x21c55c[_0xc965('0x10')][_0xc965('0x11')]())){try{var _0xef6e4f=null;var _0x139a4c='';var _0x1cb862=_0x22aa51[_0x21c55c[_0xc965('0x10')][_0xc965('0x11')]()];if(_0x1cb862){var _0x1c2db6=_0x1cb862[_0x21c55c[_0xc965('0x12')]];if(_0x1c2db6){var _0x30f7c6=_[_0xc965('0x13')](_0x1c2db6[_0xc965('0x14')],{'id':parseInt(_0x21c55c['data3'],0xa)});if(_0x30f7c6){if(_0x516573){if(_0x54b02b&&_0x1735f6[_0xc965('0x15')]){_0x139a4c='queue';}else if(_0x1735f6[_0xc965('0x16')]){_0x139a4c=_0xc965('0x17');}else{console[_0xc965('0x18')](_0xc965('0x19'),_0x1735f6);}}else{_0x139a4c=_0xc965('0x1a');}switch(_0x21c55c[_0xc965('0x10')][_0xc965('0x11')]()){case _0xc965('0x9'):zendesk[_0x139a4c](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21);break;case _0xc965('0x1b'):salesforce[_0x139a4c](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21);break;case _0xc965('0xa'):sugarcrm[_0x139a4c](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21);break;case _0xc965('0x1c'):freshdesk[_0x139a4c](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21);break;case _0xc965('0x1d'):zoho[_0x139a4c](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21);break;case _0xc965('0xb'):desk[_0x139a4c](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21);break;case'vtiger':vtiger[_0x139a4c](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21);break;case'freshsales':freshsales['cs'](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21,_0x139a4c);break;case _0xc965('0x1e'):servicenow['cs'](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21,_0x139a4c);break;case'dynamics365':dynamics365['cs'](_0x21c55c,_0x1735f6,_0x30f7c6,_0x516573,_0x54b02b,_0x1c2db6,_0x439e21,_0x139a4c);break;default:console['log'](_0xc965('0x1f'));}}else{_0xef6e4f=require(_0xc965('0x20'))(_0x21c55c[_0xc965('0x10')][_0xc965('0x11')]());_0xef6e4f[_0xc965('0x21')](_0xc965('0x22'),util[_0xc965('0x23')](_0xc965('0x24'),_0x21c55c['data1'][_0xc965('0x11')](),_0x21c55c['data3']));}}else{_0xef6e4f=require(_0xc965('0x20'))(_0x21c55c[_0xc965('0x10')][_0xc965('0x11')]());_0xef6e4f['error'](_0xc965('0x22'),util[_0xc965('0x23')](_0xc965('0x25'),_0x21c55c['data1'][_0xc965('0x11')](),_0x21c55c[_0xc965('0x12')]));}}else{}}catch(_0x303d18){console[_0xc965('0x21')](_0x303d18);}}}}; \ No newline at end of file +var _0xc1f2=['Configurations','queue','routeId','outbound','log','unmanaged','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','lodash','util','./sugarcrm','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','exec','includes','data1','toLowerCase','data2'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0xc1f2,0x1c9));var _0x2c1f=function(_0x45d0c6,_0x13f497){_0x45d0c6=_0x45d0c6-0x0;var _0x1be8e7=_0xc1f2[_0x45d0c6];return _0x1be8e7;};'use strict';var _=require(_0x2c1f('0x0'));var util=require(_0x2c1f('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x2c1f('0x2'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x2c1f('0x3'));var servicenow=require(_0x2c1f('0x4'));var dynamics365=require(_0x2c1f('0x5'));var freshsales=require('./freshsales');var integrations=[_0x2c1f('0x6'),_0x2c1f('0x7'),_0x2c1f('0x8'),_0x2c1f('0x9'),_0x2c1f('0xa'),_0x2c1f('0xb'),_0x2c1f('0xc'),'dynamics365',_0x2c1f('0xd'),'servicenow'];exports[_0x2c1f('0xe')]=function(_0xe4d29e,_0x47a765,_0x4e67cb,_0x4bd4cd,_0x488544,_0x360d08){if(_0x4e67cb){if(_[_0x2c1f('0xf')](integrations,_0xe4d29e[_0x2c1f('0x10')][_0x2c1f('0x11')]())){try{var _0x18524f=null;var _0x4c4ac8='';var _0x342ec5=_0x4e67cb[_0xe4d29e[_0x2c1f('0x10')][_0x2c1f('0x11')]()];if(_0x342ec5){var _0x477d83=_0x342ec5[_0xe4d29e[_0x2c1f('0x12')]];if(_0x477d83){var _0x17bd1f=_['find'](_0x477d83[_0x2c1f('0x13')],{'id':parseInt(_0xe4d29e['data3'],0xa)});if(_0x17bd1f){if(_0x4bd4cd){if(_0x488544&&_0x47a765[_0x2c1f('0x14')]){_0x4c4ac8=_0x2c1f('0x14');}else if(_0x47a765[_0x2c1f('0x15')]){_0x4c4ac8=_0x2c1f('0x16');}else{console[_0x2c1f('0x17')]('EVENT\x20UNKNOWN',_0x47a765);}}else{_0x4c4ac8=_0x2c1f('0x18');}switch(_0xe4d29e[_0x2c1f('0x10')][_0x2c1f('0x11')]()){case'zendesk':zendesk[_0x4c4ac8](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08);break;case _0x2c1f('0x7'):salesforce[_0x4c4ac8](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08);break;case'sugarcrm':sugarcrm[_0x4c4ac8](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08);break;case _0x2c1f('0x9'):freshdesk[_0x4c4ac8](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08);break;case _0x2c1f('0xa'):zoho[_0x4c4ac8](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08);break;case'desk':desk[_0x4c4ac8](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08);break;case _0x2c1f('0xc'):vtiger[_0x4c4ac8](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08);break;case'freshsales':freshsales['cs'](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08,_0x4c4ac8);break;case _0x2c1f('0x19'):servicenow['cs'](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08,_0x4c4ac8);break;case _0x2c1f('0x1a'):dynamics365['cs'](_0xe4d29e,_0x47a765,_0x17bd1f,_0x4bd4cd,_0x488544,_0x477d83,_0x360d08,_0x4c4ac8);break;default:console[_0x2c1f('0x17')](_0x2c1f('0x1b'));}}else{_0x18524f=require(_0x2c1f('0x1c'))(_0xe4d29e[_0x2c1f('0x10')][_0x2c1f('0x11')]());_0x18524f[_0x2c1f('0x1d')](_0x2c1f('0x1e'),util[_0x2c1f('0x1f')](_0x2c1f('0x20'),_0xe4d29e['data1'][_0x2c1f('0x11')](),_0xe4d29e[_0x2c1f('0x21')]));}}else{_0x18524f=require(_0x2c1f('0x1c'))(_0xe4d29e['data1'][_0x2c1f('0x11')]());_0x18524f[_0x2c1f('0x1d')]('[EXEC]',util[_0x2c1f('0x1f')]('%s\x20account\x20#%s\x20not\x20found',_0xe4d29e['data1'][_0x2c1f('0x11')](),_0xe4d29e[_0x2c1f('0x12')]));}}else{}}catch(_0x324e8d){console[_0x2c1f('0x1d')](_0x324e8d);}}}}; \ 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 7f26728..be9e21c 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 _0xbfdb=['lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','emit','assign','Subjects','getString','Descriptions','ticketType','IsReminderSet','IsRecurrence','contact','endUserType','WhatId','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','execute','cloneDeep','additionalSearchLead','Lead','additionalSearchAccount','Account','first','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','moduleCreate','Company','No\x20Company','account','upperFirst','create','forEach','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','toLowerCase','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','login','username','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','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.'];(function(_0xf43cb,_0x465374){var _0x14e869=function(_0x454719){while(--_0x454719){_0xf43cb['push'](_0xf43cb['shift']());}};_0x14e869(++_0x465374);}(_0xbfdb,0xfe));var _0xbbfd=function(_0x530af5,_0x563ac5){_0x530af5=_0x530af5-0x0;var _0x345496=_0xbfdb[_0x530af5];return _0x345496;};'use strict';var _=require(_0xbbfd('0x0'));var rp=require(_0xbbfd('0x1'));var moment=require(_0xbbfd('0x2'));var BPromise=require(_0xbbfd('0x3'));var md5=require(_0xbbfd('0x4'));var jsforce=require(_0xbbfd('0x5'));var util=require(_0xbbfd('0x6'));var Redis=require(_0xbbfd('0x7'));var intUtil=require(_0xbbfd('0x8'));var config=require('../../../../config/environment');var logger=require(_0xbbfd('0x9'))('salesforce');config[_0xbbfd('0xa')]=_[_0xbbfd('0xb')](config[_0xbbfd('0xa')],{'host':_0xbbfd('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbbfd('0xa')]));function emit(_0x2bbd9a,_0x89b064,_0x2386be){io['to'](_0x2bbd9a)[_0xbbfd('0xd')](_0x89b064,_0x2386be);}function getTicket(_0x5cf11d,_0x2ca1cf,_0x282d4a,_0x1e98c,_0x581bd2,_0x5e2789,_0x3ecca1,_0x2f3998){var _0x488fae=Object[_0xbbfd('0xe')]({},{'OwnerId':_0x2ca1cf['id'],'Subject':intUtil['getString'](_0x1e98c[_0xbbfd('0xf')],_0x581bd2,'\x20'),'Description':intUtil[_0xbbfd('0x10')](_0x1e98c[_0xbbfd('0x11')],_0x581bd2,'\x0a')},getCustomFields(_0x5e2789,_0x581bd2));if(_0x282d4a){if(_0x1e98c[_0xbbfd('0x12')]==='Task'){_0x488fae['ActivityDate']=moment['utc']();_0x488fae[_0xbbfd('0x13')]=![];_0x488fae[_0xbbfd('0x14')]=![];if(_0x282d4a['endUserType']===_0xbbfd('0x15')||_0x282d4a['endUserType']==='lead'){_0x488fae['WhoId']=_0x282d4a['id'];}else if(_0x282d4a[_0xbbfd('0x16')]==='account'){_0x488fae[_0xbbfd('0x17')]=_0x282d4a['id'];}}else if(_0x1e98c[_0xbbfd('0x12')]==='Case'){if(_0x282d4a[_0xbbfd('0x16')]==='contact'){_0x488fae[_0xbbfd('0x18')]=_0x282d4a['id'];}else if(_0x282d4a['endUserType']==='account'){_0x488fae[_0xbbfd('0x19')]=_0x282d4a['id'];}else if(_0x282d4a[_0xbbfd('0x16')]===_0xbbfd('0x1a')&&_0x1e98c[_0xbbfd('0x1b')]){_0x488fae[_0x1e98c['leadId']]=_0x282d4a['id'];}else{logger[_0xbbfd('0x1c')](_0xbbfd('0x1d'));}}}return _0x3ecca1[_0xbbfd('0x1e')](_0x1e98c['ticketType'])['create'](_0x488fae);}function getUser(_0x178a1d,_0x49a4a6,_0xff4ecd){if(!_['isNil'](_0x49a4a6)&&intUtil[_0xbbfd('0x1f')](_0x49a4a6)){var _0x9ae4a0={'Email':_0x49a4a6};var _0x29af77={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xff4ecd[_0xbbfd('0x1e')]('User')[_0xbbfd('0x20')](_0x9ae4a0,_0x29af77)['execute']()[_0xbbfd('0x21')](function(_0x562fc5){if(_0x562fc5[_0xbbfd('0x22')]){var _0x2708f1=_[_0xbbfd('0x20')](_0x562fc5,function(_0x4e0231){return _0x4e0231[_0xbbfd('0x23')]===_0x49a4a6;});if(_0x2708f1){logger[_0xbbfd('0x1c')](_0xbbfd('0x24'),_0x49a4a6);return BPromise[_0xbbfd('0x25')]({'id':_0x2708f1['Id'],'name':_0x2708f1[_0xbbfd('0x26')]});}}else{logger[_0xbbfd('0x1c')](_0xbbfd('0x27'),_0x49a4a6);return _0xff4ecd[_0xbbfd('0x28')]()[_0xbbfd('0x21')](function(_0x45e1c1){return BPromise['resolve']({'id':_0x45e1c1[_0xbbfd('0x29')],'name':_0x45e1c1[_0xbbfd('0x2a')]});});}});}else{logger[_0xbbfd('0x1c')](_0xbbfd('0x27'),_0x49a4a6);return _0xff4ecd[_0xbbfd('0x28')]()[_0xbbfd('0x21')](function(_0x189ee0){return BPromise[_0xbbfd('0x25')]({'id':_0x189ee0[_0xbbfd('0x29')],'name':_0x189ee0['display_name']});});}}function getEndUser(_0x6f2293,_0x5d37fc,_0x50d79e,_0x5c3de4,_0x2fbf0d){var _0x3647a9={'$or':{'Phone':_0x5c3de4}};var _0x142f18={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xbbfd('0x21')](function(){logger['info'](_0xbbfd('0x2b'),_0x5c3de4,_0x5d37fc[_0xbbfd('0x2c')]);switch(_0x5d37fc[_0xbbfd('0x2c')]){case _0xbbfd('0x2d'):var _0x86d8a3=_['cloneDeep'](_0x3647a9);if(_0x5d37fc['additionalSearchContact']){var _0x17919f={};_0x17919f[_0x5d37fc[_0xbbfd('0x2e')]]=_0x5c3de4;_[_0xbbfd('0x2f')](_0x86d8a3[_0xbbfd('0x30')],_0x17919f);}return _0x2fbf0d[_0xbbfd('0x1e')](_0xbbfd('0x31'))[_0xbbfd('0x20')](_0x86d8a3,_0x142f18)[_0xbbfd('0x32')]()[_0xbbfd('0x21')](function(_0x54f109){if(_0x54f109&&_0x54f109['length']){return _0x54f109;}else{var _0x1bb041=_[_0xbbfd('0x33')](_0x3647a9);if(_0x5d37fc[_0xbbfd('0x34')]){var _0x111688={};_0x111688[_0x5d37fc[_0xbbfd('0x34')]]=_0x5c3de4;_[_0xbbfd('0x2f')](_0x1bb041[_0xbbfd('0x30')],_0x111688);}return _0x2fbf0d[_0xbbfd('0x1e')](_0xbbfd('0x35'))[_0xbbfd('0x20')](_0x1bb041,_0x142f18);}});case'account_contact_lead':var _0x383522=_[_0xbbfd('0x33')](_0x3647a9);if(_0x5d37fc[_0xbbfd('0x36')]){var _0x17919f={};_0x17919f[_0x5d37fc['additionalSearchAccount']]=_0x5c3de4;_[_0xbbfd('0x2f')](_0x383522[_0xbbfd('0x30')],_0x17919f);}return _0x2fbf0d[_0xbbfd('0x1e')](_0xbbfd('0x37'))['find'](_0x383522,_0x142f18)['execute']()['then'](function(_0x3e4711){if(_0x3e4711&&_0x3e4711[_0xbbfd('0x22')]){return _0x3e4711;}else{var _0x15691b=_[_0xbbfd('0x33')](_0x3647a9);if(_0x5d37fc[_0xbbfd('0x2e')]){var _0x34a39e={};_0x34a39e[_0x5d37fc[_0xbbfd('0x2e')]]=_0x5c3de4;_['merge'](_0x15691b['$or'],_0x34a39e);}return _0x2fbf0d[_0xbbfd('0x1e')](_0xbbfd('0x31'))[_0xbbfd('0x20')](_0x15691b,_0x142f18)[_0xbbfd('0x21')](function(_0x38dfe8){if(_0x38dfe8&&_0x38dfe8[_0xbbfd('0x22')]){return _0x38dfe8;}else{var _0x512340=_[_0xbbfd('0x33')](_0x3647a9);if(_0x5d37fc[_0xbbfd('0x34')]){var _0x21bdeb={};_0x21bdeb[_0x5d37fc['additionalSearchLead']]=_0x5c3de4;_[_0xbbfd('0x2f')](_0x512340['$or'],_0x21bdeb);}return _0x2fbf0d[_0xbbfd('0x1e')](_0xbbfd('0x35'))[_0xbbfd('0x20')](_0x512340,_0x142f18);}});}});case _0xbbfd('0x15'):var _0x86d8a3=_[_0xbbfd('0x33')](_0x3647a9);if(_0x5d37fc[_0xbbfd('0x2e')]){var _0x17919f={};_0x17919f[_0x5d37fc[_0xbbfd('0x2e')]]=_0x5c3de4;_[_0xbbfd('0x2f')](_0x86d8a3[_0xbbfd('0x30')],_0x17919f);}return _0x2fbf0d[_0xbbfd('0x1e')]('Contact')[_0xbbfd('0x20')](_0x86d8a3,_0x142f18)[_0xbbfd('0x32')]();case'lead':var _0x2110bc=_[_0xbbfd('0x33')](_0x3647a9);if(_0x5d37fc['additionalSearchLead']){var _0x17919f={};_0x17919f[_0x5d37fc[_0xbbfd('0x34')]]=_0x5c3de4;_[_0xbbfd('0x2f')](_0x2110bc[_0xbbfd('0x30')],_0x17919f);}return _0x2fbf0d['sobject'](_0xbbfd('0x35'))[_0xbbfd('0x20')](_0x2110bc,_0x142f18);case'account':var _0x383522=_[_0xbbfd('0x33')](_0x3647a9);if(_0x5d37fc[_0xbbfd('0x36')]){var _0x17919f={};_0x17919f[_0x5d37fc[_0xbbfd('0x36')]]=_0x5c3de4;_[_0xbbfd('0x2f')](_0x383522['$or'],_0x17919f);}return _0x2fbf0d[_0xbbfd('0x1e')](_0xbbfd('0x37'))[_0xbbfd('0x20')](_0x383522,_0x142f18);default:return null;}})[_0xbbfd('0x21')](function(_0x583e7e){if(_0x583e7e&&_0x583e7e[_0xbbfd('0x22')]){var _0x560794=_[_0xbbfd('0x38')](_0x583e7e);if(_0x560794){return BPromise[_0xbbfd('0x25')]({'id':_0x560794['Id'],'name':_0x560794[_0xbbfd('0x26')],'phone':_0x560794[_0xbbfd('0x39')],'endUserType':_0x560794[_0xbbfd('0x3a')]['type']['toLowerCase']()});}}})[_0xbbfd('0x21')](function(_0x9fc0bf){if(_0x9fc0bf){logger[_0xbbfd('0x1c')](_0xbbfd('0x3b'),_0x9fc0bf['endUserType'],_0x5c3de4);return BPromise[_0xbbfd('0x25')](_0x9fc0bf);}else{logger['info'](_0xbbfd('0x3c'),_0x5c3de4);var _0x3f473b={'Phone':_0x5c3de4};if(_0x5d37fc['moduleCreate']){if(_0x5d37fc['moduleCreate']===_0xbbfd('0x15')){logger[_0xbbfd('0x1c')](_0xbbfd('0x3d'),_0x5c3de4,_0x5d37fc['moduleCreate']);_0x3f473b[_0xbbfd('0x3e')]=_0x50d79e!==_0xbbfd('0x3f')?_0x50d79e:util[_0xbbfd('0x40')](_0xbbfd('0x41'),_0x5c3de4);}else if(_0x5d37fc[_0xbbfd('0x42')]==='lead'){logger[_0xbbfd('0x1c')](_0xbbfd('0x3d'),_0x5c3de4,_0x5d37fc[_0xbbfd('0x42')]);_0x3f473b[_0xbbfd('0x3e')]=_0x50d79e!==''?_0x50d79e:util['format'](_0xbbfd('0x41'),_0x5c3de4);_0x3f473b[_0xbbfd('0x43')]=_0xbbfd('0x44');}else if(_0x5d37fc['moduleCreate']===_0xbbfd('0x45')){logger['info'](_0xbbfd('0x3d'),_0x5c3de4,_0x5d37fc[_0xbbfd('0x42')]);_0x3f473b[_0xbbfd('0x26')]=_0x50d79e!==_0xbbfd('0x3f')?_0x50d79e:util[_0xbbfd('0x40')](_0xbbfd('0x41'),_0x5c3de4);}else{return null;}}return _0x2fbf0d['sobject'](_[_0xbbfd('0x46')](_0x5d37fc[_0xbbfd('0x42')]))[_0xbbfd('0x47')](_0x3f473b)[_0xbbfd('0x21')](function(_0x31454a){return BPromise['resolve']({'id':_0x31454a['id'],'endUserType':_0x5d37fc['moduleCreate']});});}});}function getCustomFields(_0x160927,_0x2f611f){var _0x1801cd={};if(_0x160927[_0xbbfd('0x22')]>0x0){_[_0xbbfd('0x48')](_0x160927,function(_0x393dcc){if(_['includes'](['string',_0xbbfd('0x49')],_0x393dcc[_0xbbfd('0x4a')])&&_0x393dcc['idField']){_0x1801cd[_0x393dcc[_0xbbfd('0x4b')]]=_0x393dcc[_0xbbfd('0x4c')][_0xbbfd('0x4d')]();}else if(_0x393dcc[_0xbbfd('0x4a')]===_0xbbfd('0x4e')&&_0x393dcc[_0xbbfd('0x4f')]&&_0x393dcc[_0xbbfd('0x4b')]){_0x2f611f[_0x393dcc[_0xbbfd('0x4f')]]&&(_0x1801cd[_0x393dcc[_0xbbfd('0x4b')]]=_0x2f611f[_0x393dcc[_0xbbfd('0x4f')]][_0xbbfd('0x4d')]());}else if(_0x393dcc[_0xbbfd('0x4a')]===_0xbbfd('0x50')&&_0x393dcc[_0xbbfd('0x51')]&&_0x393dcc['Variable']['name']&&_0x393dcc[_0xbbfd('0x4b')]){_0x2f611f[_0x393dcc[_0xbbfd('0x51')]['name'][_0xbbfd('0x52')]()]&&(_0x1801cd[_0x393dcc[_0xbbfd('0x4b')]]=_0x2f611f[_0x393dcc['Variable'][_0xbbfd('0x53')][_0xbbfd('0x52')]()][_0xbbfd('0x4d')]());}});}return _0x1801cd;}function getConnection(_0x22bdc0){var _0x38be09=_0x22bdc0[_0xbbfd('0x54')][_0xbbfd('0x55')](_0x22bdc0[_0xbbfd('0x56')]);var _0x51ae78=new jsforce[(_0xbbfd('0x57'))]({'oauth2':{'loginUrl':_0x22bdc0[_0xbbfd('0x58')]||_0xbbfd('0x59'),'clientId':_0x22bdc0['clientId'],'clientSecret':_0x22bdc0['clientSecret']}});return _0x51ae78[_0xbbfd('0x5a')](_0x22bdc0[_0xbbfd('0x5b')],_0x38be09)[_0xbbfd('0x21')](function(){logger[_0xbbfd('0x1c')]('Connection\x20established.');return _0x51ae78;});}exports[_0xbbfd('0x5c')]=function(_0x3d9fe8,_0x52902f,_0x2c19fe,_0x28e9a8,_0x52ac4a,_0x32afe5){var _0x463a09,_0x27310e,_0x1a9c6e,_0x17fa08;_0x32afe5[_0xbbfd('0x5d')]=intUtil[_0xbbfd('0x5e')](_0x32afe5[_0xbbfd('0x5d')]);_0x32afe5['remoteUri']=intUtil['stripTrailingSlash'](_0x32afe5['remoteUri']);if(_0x52ac4a&&_0x52ac4a[_0xbbfd('0x5f')]){logger[_0xbbfd('0x1c')](_0xbbfd('0x60'),_0xbbfd('0x61'));_0x52902f[_0xbbfd('0x62')]=util['format'](_0xbbfd('0x63'),_0x32afe5[_0xbbfd('0x5d')],_0x52902f[_0xbbfd('0x64')],md5(_0x52902f[_0xbbfd('0x64')]));}else{_0x52902f[_0xbbfd('0x62')]='';}return getConnection(_0x32afe5)[_0xbbfd('0x21')](function(_0x35993a){_0x17fa08=_0x35993a;return getUser(_0x32afe5,_0x28e9a8[_0xbbfd('0x65')],_0x17fa08);})[_0xbbfd('0x21')](function(_0xf2c92a){_0x463a09=_0xf2c92a;return getEndUser(_0x32afe5,_0x2c19fe,_0x52902f[_0xbbfd('0x66')],_0x52902f[_0xbbfd('0x67')],_0x17fa08);})[_0xbbfd('0x21')](function(_0x575cd5){_0x27310e=_0x575cd5;return getTicket(_0x32afe5,_0x463a09,_0x27310e,_0x2c19fe,_0x52902f,_0x2c19fe[_0xbbfd('0x68')],_0x17fa08,_0xbbfd('0x5c'));})[_0xbbfd('0x21')](function(_0x5a9752){_0x1a9c6e=_0x5a9752;logger[_0xbbfd('0x1c')](_0xbbfd('0x69'),_0x1a9c6e['id']);logger[_0xbbfd('0x1c')](_0xbbfd('0x6a'),_0x1a9c6e['id'],_0x28e9a8['name'],_0x32afe5[_0xbbfd('0x4a')]);switch(_0x32afe5[_0xbbfd('0x4a')]){case _0xbbfd('0x6b'):emit(util[_0xbbfd('0x40')](_0xbbfd('0x6c'),_0x28e9a8['name']),'trigger:salesforce:display',{'recordId':_0x1a9c6e['id']});break;case _0xbbfd('0x6d'):emit(util[_0xbbfd('0x40')]('user:%s',_0x28e9a8[_0xbbfd('0x53')]),_0xbbfd('0x6e'),{'uri':util[_0xbbfd('0x40')](_0xbbfd('0x6f'),_0x17fa08[_0xbbfd('0x70')],_0x1a9c6e['id'])});break;default:logger[_0xbbfd('0x71')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xbbfd('0x72')](function(_0x297803){logger[_0xbbfd('0x71')](_0xbbfd('0x60'),_0x297803);});};exports['outbound']=function(_0x22a2c4,_0x2263d3,_0x140367,_0x34b096,_0x4bf52b,_0x472092,_0x403f3b){var _0x535d48,_0x2e4a5d,_0xd95c70,_0x28de62;_0x472092[_0xbbfd('0x5d')]=intUtil['stripTrailingSlash'](_0x472092[_0xbbfd('0x5d')]);_0x472092['remoteUri']=intUtil['stripTrailingSlash'](_0x472092[_0xbbfd('0x58')]);if(_0x403f3b&&_0x403f3b[_0xbbfd('0x73')]&&_0x403f3b['recordingFormat']!==_0xbbfd('0x74')){logger[_0xbbfd('0x1c')](_0xbbfd('0x75'),_0xbbfd('0x61'));_0x2263d3[_0xbbfd('0x62')]=util[_0xbbfd('0x40')](_0xbbfd('0x63'),_0x472092[_0xbbfd('0x5d')],_0x2263d3[_0xbbfd('0x64')],md5(_0x2263d3[_0xbbfd('0x64')]));}return getConnection(_0x472092)[_0xbbfd('0x21')](function(_0x18a2f2){_0x28de62=_0x18a2f2;return getUser(_0x472092,_0x34b096[_0xbbfd('0x65')],_0x28de62);})['then'](function(_0x14d1ba){_0x535d48=_0x14d1ba;return getEndUser(_0x472092,_0x140367,_0x2263d3[_0xbbfd('0x76')],_0x2263d3[_0xbbfd('0x77')],_0x28de62);})[_0xbbfd('0x21')](function(_0x596ec2){_0x2e4a5d=_0x596ec2;return getTicket(_0x472092,_0x535d48,_0x2e4a5d,_0x140367,_0x2263d3,_0x140367[_0xbbfd('0x68')],_0x28de62,_0xbbfd('0x78'));})[_0xbbfd('0x21')](function(_0x793b53){_0xd95c70=_0x793b53;logger[_0xbbfd('0x1c')](_0xbbfd('0x79'),_0xd95c70['id']);logger[_0xbbfd('0x1c')](_0xbbfd('0x7a'),_0xd95c70['id'],_0x34b096[_0xbbfd('0x53')],_0x472092[_0xbbfd('0x4a')]);switch(_0x472092[_0xbbfd('0x4a')]){case _0xbbfd('0x6b'):emit(util['format'](_0xbbfd('0x6c'),_0x34b096[_0xbbfd('0x53')]),'trigger:salesforce:display',{'recordId':_0xd95c70['id']});break;case _0xbbfd('0x6d'):emit(util['format'](_0xbbfd('0x6c'),_0x34b096[_0xbbfd('0x53')]),_0xbbfd('0x6e'),{'uri':util['format']('%s/%s/e',_0x28de62['instanceUrl'],_0xd95c70['id'])});break;default:logger[_0xbbfd('0x71')](_0xbbfd('0x75'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xbbfd('0x72')](function(_0x1d7252){logger[_0xbbfd('0x71')](_0xbbfd('0x75'),_0x1d7252);});};exports['unmanaged']=function(_0x270c0b,_0x13f18a,_0x38cf0f,_0xc0a2ff,_0x2ce148,_0x30f483){var _0x49e329,_0x5c8b0a,_0x49039e,_0x4a80c6;_0x30f483['serverUrl']=intUtil[_0xbbfd('0x5e')](_0x30f483[_0xbbfd('0x5d')]);_0x30f483[_0xbbfd('0x58')]=intUtil[_0xbbfd('0x5e')](_0x30f483[_0xbbfd('0x58')]);if(_0x2ce148&&_0x2ce148['monitor_format']){logger[_0xbbfd('0x1c')]('['+_0x13f18a[_0xbbfd('0x7b')][_0xbbfd('0x7c')]()+']','Recording\x20is\x20enabled!');_0x13f18a['recordingURL']=util[_0xbbfd('0x40')](_0xbbfd('0x63'),_0x30f483[_0xbbfd('0x5d')],_0x13f18a['uniqueid'],md5(_0x13f18a['uniqueid']));}else{_0x13f18a[_0xbbfd('0x62')]='';}return getConnection(_0x30f483)['then'](function(_0x38afaa){_0x4a80c6=_0x38afaa;if(!_['isNil'](_0xc0a2ff)){return getUser(_0x30f483,_0xc0a2ff['name'],_0x4a80c6);}else{return getUser(_0x30f483,null,_0x4a80c6);}})[_0xbbfd('0x21')](function(_0x209af8){_0x49e329=_0x209af8;return getEndUser(_0x30f483,_0x38cf0f,_0x13f18a['calleridname'],_0x13f18a[_0xbbfd('0x67')],_0x4a80c6);})[_0xbbfd('0x21')](function(_0x5e902d){_0x5c8b0a=_0x5e902d;return getTicket(_0x30f483,_0x49e329,_0x5c8b0a,_0x38cf0f,_0x13f18a,_0x38cf0f[_0xbbfd('0x68')],_0x4a80c6);})[_0xbbfd('0x21')](function(_0xb96b5e){_0x49039e=_0xb96b5e;logger[_0xbbfd('0x1c')]('['+_0x13f18a[_0xbbfd('0x7b')][_0xbbfd('0x7c')]()+_0xbbfd('0x7d'),_0x49039e['id']);logger[_0xbbfd('0x1c')]('['+_0x13f18a[_0xbbfd('0x7b')][_0xbbfd('0x7c')]()+_0xbbfd('0x7e'),_0x30f483['type']);})[_0xbbfd('0x72')](function(_0xb9cb70){logger[_0xbbfd('0x71')]('['+_0x13f18a[_0xbbfd('0x7b')][_0xbbfd('0x7c')]()+']',_0xb9cb70);});}; \ No newline at end of file +var _0x297f=['format','Caller\x20-\x20%s','moduleCreate','Company','upperFirst','create','forEach','includes','string','picklist','idField','content','toString','variableName','name','Variable','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','outbound','recordingFormat','[OUTBOUND]','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','%s/%s/e','catch','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','jsforce','util','ioredis','./util','../../../../config/environment','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','execute','then','find','Email','Agent\x20%s\x20found.','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','$or','Contact','length','additionalSearchLead','merge','Lead','account_contact_lead','cloneDeep','additionalSearchAccount','Account','additionalSearchContact','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName',''];(function(_0x40e0ea,_0x49d5cf){var _0x5c32bc=function(_0x535083){while(--_0x535083){_0x40e0ea['push'](_0x40e0ea['shift']());}};_0x5c32bc(++_0x49d5cf);}(_0x297f,0x132));var _0xf297=function(_0x18c512,_0x1e0278){_0x18c512=_0x18c512-0x0;var _0x3dd20e=_0x297f[_0x18c512];return _0x3dd20e;};'use strict';var _=require(_0xf297('0x0'));var rp=require(_0xf297('0x1'));var moment=require(_0xf297('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xf297('0x3'));var util=require(_0xf297('0x4'));var Redis=require(_0xf297('0x5'));var intUtil=require(_0xf297('0x6'));var config=require(_0xf297('0x7'));var logger=require('../../../../config/logger')('salesforce');config[_0xf297('0x8')]=_[_0xf297('0x9')](config[_0xf297('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf297('0xa'))(new Redis(config['redis']));function emit(_0x342d3e,_0x52763e,_0x3e7f51){io['to'](_0x342d3e)[_0xf297('0xb')](_0x52763e,_0x3e7f51);}function getTicket(_0x4879d0,_0x337533,_0x25e86b,_0xd6de56,_0x459fc5,_0x46f020,_0x592119,_0x5422f4){var _0x2785eb=Object[_0xf297('0xc')]({},{'OwnerId':_0x337533['id'],'Subject':intUtil[_0xf297('0xd')](_0xd6de56[_0xf297('0xe')],_0x459fc5,'\x20'),'Description':intUtil[_0xf297('0xd')](_0xd6de56[_0xf297('0xf')],_0x459fc5,'\x0a')},getCustomFields(_0x46f020,_0x459fc5));if(_0x25e86b){if(_0xd6de56[_0xf297('0x10')]==='Task'){_0x2785eb[_0xf297('0x11')]=moment[_0xf297('0x12')]();_0x2785eb[_0xf297('0x13')]=![];_0x2785eb[_0xf297('0x14')]=![];if(_0x25e86b[_0xf297('0x15')]==='contact'||_0x25e86b[_0xf297('0x15')]===_0xf297('0x16')){_0x2785eb[_0xf297('0x17')]=_0x25e86b['id'];}else if(_0x25e86b['endUserType']===_0xf297('0x18')){_0x2785eb[_0xf297('0x19')]=_0x25e86b['id'];}}else if(_0xd6de56[_0xf297('0x10')]===_0xf297('0x1a')){if(_0x25e86b[_0xf297('0x15')]===_0xf297('0x1b')){_0x2785eb[_0xf297('0x1c')]=_0x25e86b['id'];}else if(_0x25e86b[_0xf297('0x15')]===_0xf297('0x18')){_0x2785eb[_0xf297('0x1d')]=_0x25e86b['id'];}else if(_0x25e86b[_0xf297('0x15')]===_0xf297('0x16')&&_0xd6de56['leadId']){_0x2785eb[_0xd6de56[_0xf297('0x1e')]]=_0x25e86b['id'];}else{logger[_0xf297('0x1f')](_0xf297('0x20'));}}}return _0x592119[_0xf297('0x21')](_0xd6de56['ticketType'])['create'](_0x2785eb);}function getUser(_0x4eb4a4,_0x293d4e,_0x4f1885){if(!_[_0xf297('0x22')](_0x293d4e)&&intUtil[_0xf297('0x23')](_0x293d4e)){var _0x216c86={'Email':_0x293d4e};var _0x211e2d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4f1885[_0xf297('0x21')]('User')['find'](_0x216c86,_0x211e2d)[_0xf297('0x24')]()[_0xf297('0x25')](function(_0x40657b){if(_0x40657b['length']){var _0x177933=_[_0xf297('0x26')](_0x40657b,function(_0x10604d){return _0x10604d[_0xf297('0x27')]===_0x293d4e;});if(_0x177933){logger[_0xf297('0x1f')](_0xf297('0x28'),_0x293d4e);return BPromise[_0xf297('0x29')]({'id':_0x177933['Id'],'name':_0x177933['Name']});}}else{logger[_0xf297('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x293d4e);return _0x4f1885['identity']()[_0xf297('0x25')](function(_0x5e2008){return BPromise[_0xf297('0x29')]({'id':_0x5e2008[_0xf297('0x2a')],'name':_0x5e2008[_0xf297('0x2b')]});});}});}else{logger[_0xf297('0x1f')](_0xf297('0x2c'),_0x293d4e);return _0x4f1885[_0xf297('0x2d')]()[_0xf297('0x25')](function(_0x2032f8){return BPromise[_0xf297('0x29')]({'id':_0x2032f8[_0xf297('0x2a')],'name':_0x2032f8[_0xf297('0x2b')]});});}}function getEndUser(_0x3b7647,_0x582b47,_0x4e55b7,_0x44be91,_0x50e9f6){var _0xfc3679={'$or':{'Phone':_0x44be91}};var _0x5bf2e4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf297('0x29')]()[_0xf297('0x25')](function(){logger['info'](_0xf297('0x2e'),_0x44be91,_0x582b47['moduleSearch']);switch(_0x582b47['moduleSearch']){case'contact_lead':var _0xd1b4c1=_['cloneDeep'](_0xfc3679);if(_0x582b47['additionalSearchContact']){var _0x25f135={};_0x25f135[_0x582b47['additionalSearchContact']]=_0x44be91;_['merge'](_0xd1b4c1[_0xf297('0x2f')],_0x25f135);}return _0x50e9f6['sobject'](_0xf297('0x30'))[_0xf297('0x26')](_0xd1b4c1,_0x5bf2e4)[_0xf297('0x24')]()[_0xf297('0x25')](function(_0x28402b){if(_0x28402b&&_0x28402b[_0xf297('0x31')]){return _0x28402b;}else{var _0x1ab9e4=_['cloneDeep'](_0xfc3679);if(_0x582b47[_0xf297('0x32')]){var _0x55b68c={};_0x55b68c[_0x582b47[_0xf297('0x32')]]=_0x44be91;_[_0xf297('0x33')](_0x1ab9e4[_0xf297('0x2f')],_0x55b68c);}return _0x50e9f6['sobject'](_0xf297('0x34'))[_0xf297('0x26')](_0x1ab9e4,_0x5bf2e4);}});case _0xf297('0x35'):var _0x8cc296=_[_0xf297('0x36')](_0xfc3679);if(_0x582b47[_0xf297('0x37')]){var _0x25f135={};_0x25f135[_0x582b47['additionalSearchAccount']]=_0x44be91;_[_0xf297('0x33')](_0x8cc296['$or'],_0x25f135);}return _0x50e9f6[_0xf297('0x21')](_0xf297('0x38'))['find'](_0x8cc296,_0x5bf2e4)['execute']()[_0xf297('0x25')](function(_0x29ec18){if(_0x29ec18&&_0x29ec18[_0xf297('0x31')]){return _0x29ec18;}else{var _0x522beb=_[_0xf297('0x36')](_0xfc3679);if(_0x582b47[_0xf297('0x39')]){var _0x2ba026={};_0x2ba026[_0x582b47[_0xf297('0x39')]]=_0x44be91;_[_0xf297('0x33')](_0x522beb[_0xf297('0x2f')],_0x2ba026);}return _0x50e9f6[_0xf297('0x21')](_0xf297('0x30'))[_0xf297('0x26')](_0x522beb,_0x5bf2e4)[_0xf297('0x25')](function(_0x20ff6a){if(_0x20ff6a&&_0x20ff6a['length']){return _0x20ff6a;}else{var _0x2d41d0=_[_0xf297('0x36')](_0xfc3679);if(_0x582b47[_0xf297('0x32')]){var _0x1a55ae={};_0x1a55ae[_0x582b47[_0xf297('0x32')]]=_0x44be91;_[_0xf297('0x33')](_0x2d41d0[_0xf297('0x2f')],_0x1a55ae);}return _0x50e9f6['sobject'](_0xf297('0x34'))[_0xf297('0x26')](_0x2d41d0,_0x5bf2e4);}});}});case _0xf297('0x1b'):var _0xd1b4c1=_[_0xf297('0x36')](_0xfc3679);if(_0x582b47['additionalSearchContact']){var _0x25f135={};_0x25f135[_0x582b47['additionalSearchContact']]=_0x44be91;_['merge'](_0xd1b4c1[_0xf297('0x2f')],_0x25f135);}return _0x50e9f6[_0xf297('0x21')]('Contact')[_0xf297('0x26')](_0xd1b4c1,_0x5bf2e4)[_0xf297('0x24')]();case _0xf297('0x16'):var _0x2aaca9=_[_0xf297('0x36')](_0xfc3679);if(_0x582b47[_0xf297('0x32')]){var _0x25f135={};_0x25f135[_0x582b47[_0xf297('0x32')]]=_0x44be91;_['merge'](_0x2aaca9[_0xf297('0x2f')],_0x25f135);}return _0x50e9f6['sobject'](_0xf297('0x34'))[_0xf297('0x26')](_0x2aaca9,_0x5bf2e4);case _0xf297('0x18'):var _0x8cc296=_[_0xf297('0x36')](_0xfc3679);if(_0x582b47['additionalSearchAccount']){var _0x25f135={};_0x25f135[_0x582b47[_0xf297('0x37')]]=_0x44be91;_[_0xf297('0x33')](_0x8cc296[_0xf297('0x2f')],_0x25f135);}return _0x50e9f6[_0xf297('0x21')]('Account')[_0xf297('0x26')](_0x8cc296,_0x5bf2e4);default:return null;}})[_0xf297('0x25')](function(_0x38a7df){if(_0x38a7df&&_0x38a7df[_0xf297('0x31')]){var _0x38fcfc=_[_0xf297('0x3a')](_0x38a7df);if(_0x38fcfc){return BPromise['resolve']({'id':_0x38fcfc['Id'],'name':_0x38fcfc[_0xf297('0x3b')],'phone':_0x38fcfc[_0xf297('0x3c')],'endUserType':_0x38fcfc[_0xf297('0x3d')][_0xf297('0x3e')][_0xf297('0x3f')]()});}}})[_0xf297('0x25')](function(_0x47f4df){if(_0x47f4df){logger[_0xf297('0x1f')](_0xf297('0x40'),_0x47f4df[_0xf297('0x15')],_0x44be91);return BPromise[_0xf297('0x29')](_0x47f4df);}else{logger['info'](_0xf297('0x41'),_0x44be91);var _0x2a096c={'Phone':_0x44be91};if(_0x582b47['moduleCreate']){if(_0x582b47['moduleCreate']==='contact'){logger[_0xf297('0x1f')](_0xf297('0x42'),_0x44be91,_0x582b47['moduleCreate']);_0x2a096c[_0xf297('0x43')]=_0x4e55b7!==_0xf297('0x44')?_0x4e55b7:util[_0xf297('0x45')](_0xf297('0x46'),_0x44be91);}else if(_0x582b47[_0xf297('0x47')]===_0xf297('0x16')){logger[_0xf297('0x1f')](_0xf297('0x42'),_0x44be91,_0x582b47[_0xf297('0x47')]);_0x2a096c['LastName']=_0x4e55b7!==''?_0x4e55b7:util[_0xf297('0x45')](_0xf297('0x46'),_0x44be91);_0x2a096c[_0xf297('0x48')]='No\x20Company';}else if(_0x582b47[_0xf297('0x47')]==='account'){logger[_0xf297('0x1f')](_0xf297('0x42'),_0x44be91,_0x582b47[_0xf297('0x47')]);_0x2a096c[_0xf297('0x3b')]=_0x4e55b7!==_0xf297('0x44')?_0x4e55b7:util[_0xf297('0x45')](_0xf297('0x46'),_0x44be91);}else{return null;}}return _0x50e9f6[_0xf297('0x21')](_[_0xf297('0x49')](_0x582b47['moduleCreate']))[_0xf297('0x4a')](_0x2a096c)[_0xf297('0x25')](function(_0x1dd217){return BPromise[_0xf297('0x29')]({'id':_0x1dd217['id'],'endUserType':_0x582b47['moduleCreate']});});}});}function getCustomFields(_0x264372,_0x5b66ad){var _0x36bfbd={};if(_0x264372[_0xf297('0x31')]>0x0){_[_0xf297('0x4b')](_0x264372,function(_0x5baf45){if(_[_0xf297('0x4c')]([_0xf297('0x4d'),_0xf297('0x4e')],_0x5baf45['type'])&&_0x5baf45[_0xf297('0x4f')]){_0x36bfbd[_0x5baf45['idField']]=_0x5baf45[_0xf297('0x50')][_0xf297('0x51')]();}else if(_0x5baf45['type']==='variable'&&_0x5baf45['variableName']&&_0x5baf45['idField']){_0x5b66ad[_0x5baf45[_0xf297('0x52')]]&&(_0x36bfbd[_0x5baf45[_0xf297('0x4f')]]=_0x5b66ad[_0x5baf45[_0xf297('0x52')]][_0xf297('0x51')]());}else if(_0x5baf45[_0xf297('0x3e')]==='customVariable'&&_0x5baf45['Variable']&&_0x5baf45['Variable'][_0xf297('0x53')]&&_0x5baf45[_0xf297('0x4f')]){_0x5b66ad[_0x5baf45['Variable']['name'][_0xf297('0x3f')]()]&&(_0x36bfbd[_0x5baf45['idField']]=_0x5b66ad[_0x5baf45[_0xf297('0x54')][_0xf297('0x53')][_0xf297('0x3f')]()][_0xf297('0x51')]());}});}return _0x36bfbd;}function getConnection(_0x38f5b7){var _0x509e8c=_0x38f5b7[_0xf297('0x55')][_0xf297('0x56')](_0x38f5b7['securityToken']);var _0x27aeb3=new jsforce[(_0xf297('0x57'))]({'oauth2':{'loginUrl':_0x38f5b7[_0xf297('0x58')]||_0xf297('0x59'),'clientId':_0x38f5b7[_0xf297('0x5a')],'clientSecret':_0x38f5b7[_0xf297('0x5b')]}});return _0x27aeb3[_0xf297('0x5c')](_0x38f5b7[_0xf297('0x5d')],_0x509e8c)[_0xf297('0x25')](function(){logger['info'](_0xf297('0x5e'));return _0x27aeb3;});}exports[_0xf297('0x5f')]=function(_0x1b99c5,_0x52101d,_0x26a836,_0x44cfcc,_0x21bd49,_0x2cc216){var _0x391350,_0x74b8e7,_0xbcc0b4,_0x58353e;_0x2cc216[_0xf297('0x60')]=intUtil[_0xf297('0x61')](_0x2cc216[_0xf297('0x60')]);_0x2cc216[_0xf297('0x58')]=intUtil[_0xf297('0x61')](_0x2cc216[_0xf297('0x58')]);if(_0x21bd49&&_0x21bd49[_0xf297('0x62')]){logger[_0xf297('0x1f')]('[QUEUE]',_0xf297('0x63'));_0x52101d[_0xf297('0x64')]=util[_0xf297('0x45')](_0xf297('0x65'),_0x2cc216[_0xf297('0x60')],_0x52101d[_0xf297('0x66')],md5(_0x52101d[_0xf297('0x66')]));}else{_0x52101d[_0xf297('0x64')]='';}return getConnection(_0x2cc216)[_0xf297('0x25')](function(_0x551384){_0x58353e=_0x551384;return getUser(_0x2cc216,_0x44cfcc[_0xf297('0x67')],_0x58353e);})['then'](function(_0x313206){_0x391350=_0x313206;return getEndUser(_0x2cc216,_0x26a836,_0x52101d['calleridname'],_0x52101d[_0xf297('0x68')],_0x58353e);})[_0xf297('0x25')](function(_0x42b339){_0x74b8e7=_0x42b339;return getTicket(_0x2cc216,_0x391350,_0x74b8e7,_0x26a836,_0x52101d,_0x26a836['Fields'],_0x58353e,_0xf297('0x5f'));})['then'](function(_0x26b1f1){_0xbcc0b4=_0x26b1f1;logger[_0xf297('0x1f')](_0xf297('0x69'),_0xbcc0b4['id']);logger[_0xf297('0x1f')](_0xf297('0x6a'),_0xbcc0b4['id'],_0x44cfcc[_0xf297('0x53')],_0x2cc216['type']);switch(_0x2cc216[_0xf297('0x3e')]){case'integrationTab':emit(util[_0xf297('0x45')](_0xf297('0x6b'),_0x44cfcc[_0xf297('0x53')]),_0xf297('0x6c'),{'recordId':_0xbcc0b4['id']});break;case _0xf297('0x6d'):emit(util[_0xf297('0x45')](_0xf297('0x6b'),_0x44cfcc['name']),_0xf297('0x6e'),{'uri':util[_0xf297('0x45')]('%s/%s/e',_0x58353e['instanceUrl'],_0xbcc0b4['id'])});break;default:logger['error'](_0xf297('0x6f'));}})['catch'](function(_0x5f8931){logger[_0xf297('0x70')]('[QUEUE]',_0x5f8931);});};exports[_0xf297('0x71')]=function(_0x29156f,_0x24ae7b,_0x161486,_0x392d3b,_0x299a6b,_0x4b3608,_0x175642){var _0x5beab2,_0x5e76a0,_0x19aa77,_0x19725d;_0x4b3608['serverUrl']=intUtil[_0xf297('0x61')](_0x4b3608[_0xf297('0x60')]);_0x4b3608[_0xf297('0x58')]=intUtil['stripTrailingSlash'](_0x4b3608[_0xf297('0x58')]);if(_0x175642&&_0x175642[_0xf297('0x72')]&&_0x175642[_0xf297('0x72')]!=='none'){logger['info'](_0xf297('0x73'),_0xf297('0x63'));_0x24ae7b[_0xf297('0x64')]=util[_0xf297('0x45')](_0xf297('0x65'),_0x4b3608[_0xf297('0x60')],_0x24ae7b['uniqueid'],md5(_0x24ae7b['uniqueid']));}return getConnection(_0x4b3608)['then'](function(_0x4e3b89){_0x19725d=_0x4e3b89;return getUser(_0x4b3608,_0x392d3b['email'],_0x19725d);})[_0xf297('0x25')](function(_0x18469a){_0x5beab2=_0x18469a;return getEndUser(_0x4b3608,_0x161486,_0x24ae7b['destcalleridname'],_0x24ae7b['destcalleridnum'],_0x19725d);})[_0xf297('0x25')](function(_0x38e5f3){_0x5e76a0=_0x38e5f3;return getTicket(_0x4b3608,_0x5beab2,_0x5e76a0,_0x161486,_0x24ae7b,_0x161486[_0xf297('0x74')],_0x19725d,_0xf297('0x71'));})[_0xf297('0x25')](function(_0x345720){_0x19aa77=_0x345720;logger[_0xf297('0x1f')](_0xf297('0x75'),_0x19aa77['id']);logger[_0xf297('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x19aa77['id'],_0x392d3b[_0xf297('0x53')],_0x4b3608[_0xf297('0x3e')]);switch(_0x4b3608[_0xf297('0x3e')]){case _0xf297('0x76'):emit(util[_0xf297('0x45')](_0xf297('0x6b'),_0x392d3b[_0xf297('0x53')]),_0xf297('0x6c'),{'recordId':_0x19aa77['id']});break;case _0xf297('0x6d'):emit(util[_0xf297('0x45')](_0xf297('0x6b'),_0x392d3b['name']),_0xf297('0x6e'),{'uri':util[_0xf297('0x45')](_0xf297('0x77'),_0x19725d['instanceUrl'],_0x19aa77['id'])});break;default:logger['error'](_0xf297('0x73'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xf297('0x78')](function(_0x54d697){logger['error'](_0xf297('0x73'),_0x54d697);});};exports[_0xf297('0x79')]=function(_0x4028c9,_0x8b4ee4,_0xe05efd,_0x3712eb,_0x1f8ac2,_0x1f16f4){var _0x30ea87,_0xe16aa7,_0x42311f,_0x273251;_0x1f16f4[_0xf297('0x60')]=intUtil[_0xf297('0x61')](_0x1f16f4[_0xf297('0x60')]);_0x1f16f4[_0xf297('0x58')]=intUtil[_0xf297('0x61')](_0x1f16f4['remoteUri']);if(_0x1f8ac2&&_0x1f8ac2[_0xf297('0x62')]){logger[_0xf297('0x1f')]('['+_0x8b4ee4[_0xf297('0x7a')][_0xf297('0x7b')]()+']',_0xf297('0x63'));_0x8b4ee4[_0xf297('0x64')]=util[_0xf297('0x45')](_0xf297('0x65'),_0x1f16f4[_0xf297('0x60')],_0x8b4ee4[_0xf297('0x66')],md5(_0x8b4ee4[_0xf297('0x66')]));}else{_0x8b4ee4['recordingURL']='';}return getConnection(_0x1f16f4)[_0xf297('0x25')](function(_0x442d87){_0x273251=_0x442d87;if(!_[_0xf297('0x22')](_0x3712eb)){return getUser(_0x1f16f4,_0x3712eb[_0xf297('0x53')],_0x273251);}else{return getUser(_0x1f16f4,null,_0x273251);}})['then'](function(_0x2ea407){_0x30ea87=_0x2ea407;return getEndUser(_0x1f16f4,_0xe05efd,_0x8b4ee4['calleridname'],_0x8b4ee4[_0xf297('0x68')],_0x273251);})[_0xf297('0x25')](function(_0x1f1242){_0xe16aa7=_0x1f1242;return getTicket(_0x1f16f4,_0x30ea87,_0xe16aa7,_0xe05efd,_0x8b4ee4,_0xe05efd[_0xf297('0x74')],_0x273251);})[_0xf297('0x25')](function(_0x53c894){_0x42311f=_0x53c894;logger[_0xf297('0x1f')]('['+_0x8b4ee4['lastevent'][_0xf297('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x42311f['id']);logger[_0xf297('0x1f')]('['+_0x8b4ee4[_0xf297('0x7a')][_0xf297('0x7b')]()+_0xf297('0x7c'),_0x1f16f4['type']);})[_0xf297('0x78')](function(_0x4aa042){logger[_0xf297('0x70')]('['+_0x8b4ee4[_0xf297('0x7a')]['toUpperCase']()+']',_0x4aa042);});}; \ 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 a389a40..c0c5aff 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 _0x8ea7=['isNil','email','destcalleridnum','callDirection','queue','unmanaged','format','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','toUpperCase','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm','catch','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','endUserId','],\x20getEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x8ea7,0xdb));var _0x78ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x78ea('0x0'));var Promise=require(_0x78ea('0x1'));var rp=require(_0x78ea('0x2'));var util=require('util');var md5=require(_0x78ea('0x3'));var Redis=require('ioredis');var intUtil=require(_0x78ea('0x4'));var config=require(_0x78ea('0x5'));var logger=require(_0x78ea('0x6'))(_0x78ea('0x7'));config[_0x78ea('0x8')]=_[_0x78ea('0x9')](config[_0x78ea('0x8')],{'host':_0x78ea('0xa'),'port':0x18eb});var io=require(_0x78ea('0xb'))(new Redis(config[_0x78ea('0x8')]));function getAdminUser(_0x3f5346,_0x4514c8,_0x41775e,_0x41f01b,_0x230e31,_0xa10a94){return new Promise(function(_0x257c0f,_0x72660b){var _0x150bcc={'method':_0x78ea('0xc'),'uri':_0x41f01b+_0x78ea('0xd')+'&'+_0x230e31+'&'+_0xa10a94,'auth':_0x4514c8,'json':!![]};return rp(_0x150bcc)[_0x78ea('0xe')](function(_0x3526e2){if(_0x3526e2[_0x78ea('0xf')][_0x78ea('0x10')]>0x0){_0x41775e[_0x78ea('0x11')]=_0x3526e2['result'][0x0][_0x78ea('0x12')];}logger[_0x78ea('0x13')]('['+[_0x3f5346['toUpperCase']()]+_0x78ea('0x14'),_0x41775e);_0x257c0f(_0x41775e);})['catch'](function(_0x2ea666){logger['error']('['+[_0x3f5346[_0x78ea('0x15')]()]+']',_0x2ea666[_0x78ea('0x16')]);_0x72660b(_0x2ea666['message']);});});}function getUser(_0x208946,_0x4dd890,_0x5a7317,_0x262ecd,_0x4683c3){return function(_0x29be59){logger[_0x78ea('0x13')]('['+[_0x208946[_0x78ea('0x15')]()]+'],\x20getUser\x20input\x20crm',_0x29be59);return new Promise(function(_0x353037,_0x3a4fd0){if(intUtil[_0x78ea('0x17')](_0x29be59[_0x78ea('0x18')])){var _0x32f438={'method':_0x78ea('0xc'),'uri':_0x5a7317+_0x78ea('0x19')+_0x29be59[_0x78ea('0x18')]+'&'+_0x262ecd+'&'+_0x4683c3,'auth':_0x4dd890,'json':!![]};logger[_0x78ea('0x13')]('['+[_0x208946[_0x78ea('0x15')]()]+_0x78ea('0x1a'),_0x32f438);return rp(_0x32f438)[_0x78ea('0xe')](function(_0x3b51d6){logger['info']('['+[_0x208946['toUpperCase']()]+'],\x20getUser\x20entity',_0x3b51d6);if(_0x3b51d6[_0x78ea('0xf')][_0x78ea('0x10')]>0x0&&String(_0x3b51d6[_0x78ea('0xf')][0x0][_0x78ea('0x1b')])===_0x78ea('0x1c')){_0x29be59[_0x78ea('0x1d')]=_0x3b51d6[_0x78ea('0xf')][0x0][_0x78ea('0x12')];}else{_0x29be59[_0x78ea('0x1d')]=_0x29be59[_0x78ea('0x11')];_0x29be59[_0x78ea('0x18')]=_0x29be59[_0x78ea('0x1e')];}logger[_0x78ea('0x13')]('['+[_0x208946['toUpperCase']()]+_0x78ea('0x1f'),_0x29be59);_0x353037(_0x29be59);})[_0x78ea('0x20')](function(_0x1eb458){logger[_0x78ea('0x21')]('['+[_0x208946[_0x78ea('0x15')]()]+']',_0x1eb458[_0x78ea('0x16')]);_0x3a4fd0(_0x1eb458[_0x78ea('0x16')]);});}else{logger[_0x78ea('0x13')]('['+[_0x208946['toUpperCase']()]+_0x78ea('0x22'));_0x29be59[_0x78ea('0x1d')]=_0x29be59['adminId'];_0x29be59[_0x78ea('0x18')]=_0x29be59[_0x78ea('0x1e')];_0x353037(_0x29be59);}});};}function createEndUser(_0x39b8f4,_0x172220,_0x81a387,_0x4634f8,_0x2726e6){logger[_0x78ea('0x13')]('['+[_0x39b8f4[_0x78ea('0x15')]()]+_0x78ea('0x23'),_0x81a387);return new Promise(function(_0x2442b2,_0x29a5c1){var _0x5700a7={'method':_0x78ea('0x24'),'uri':_0x4634f8+_0x78ea('0x25')+_0x2726e6,'body':{'user_name':_0x81a387[_0x78ea('0x26')],'roles':'user','first_name':_0x81a387['endUserNumber'],'active':_0x78ea('0x1c'),'date_format':_0x78ea('0x27'),'phone':_0x81a387['endUserNumber']},'auth':_0x172220,'json':!![]};return rp(_0x5700a7)[_0x78ea('0xe')](function(_0x5cc97e){logger[_0x78ea('0x13')]('['+[_0x39b8f4['toUpperCase']()]+'],\x20EndUser\x20schema',_0x5cc97e[_0x78ea('0xf')]);_0x81a387[_0x78ea('0x28')]=_0x5cc97e[_0x78ea('0xf')][_0x78ea('0x12')];_0x2442b2(_0x81a387);})[_0x78ea('0x20')](function(_0x3cb780){logger[_0x78ea('0x21')]('['+[_0x39b8f4[_0x78ea('0x15')]()]+']',_0x3cb780[_0x78ea('0x16')]);_0x29a5c1(_0x3cb780[_0x78ea('0x16')]);});});}function getEndUser(_0x22a5df,_0x2d205b,_0x89c0e9,_0x41dfa2,_0x619ef1){return function(_0x206d88){logger[_0x78ea('0x13')]('['+[_0x22a5df['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x206d88);return new Promise(function(_0x3fc76b,_0x31f8ef){var _0x6f7704={'method':'GET','uri':_0x89c0e9+'sys_user?sysparm_query=phone%3D'+_0x206d88[_0x78ea('0x26')]+'&'+_0x41dfa2+'&'+_0x619ef1,'auth':_0x2d205b,'json':!![]};return rp(_0x6f7704)[_0x78ea('0xe')](function(_0x2954f4){if(_0x2954f4[_0x78ea('0xf')]['length']>0x0){_0x206d88['endUserId']=_0x2954f4[_0x78ea('0xf')][0x0]['sys_id'];logger['info']('['+[_0x22a5df[_0x78ea('0x15')]()]+_0x78ea('0x29'),_0x206d88);_0x3fc76b(_0x206d88);}else{return createEndUser(_0x22a5df,_0x2d205b,_0x206d88,_0x89c0e9,_0x41dfa2)[_0x78ea('0xe')](function(_0x471b74){logger['info']('['+[_0x22a5df['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x471b74);_0x3fc76b(_0x471b74);});}})[_0x78ea('0x20')](function(_0x36839f){logger[_0x78ea('0x21')]('['+[_0x22a5df[_0x78ea('0x15')]()]+']',_0x36839f[_0x78ea('0x16')]);_0x31f8ef(_0x36839f['message']);});});};}function getCustomFields(_0x56b088,_0x21f552){var _0x3fb0c7={};if(_0x56b088[_0x78ea('0x10')]>0x0){_[_0x78ea('0x2a')](_0x56b088,function(_0x447913){if(_[_0x78ea('0x2b')](['string',_0x78ea('0x2c')],_0x447913[_0x78ea('0x2d')])&&_0x447913[_0x78ea('0x2e')]&&!_0x447913[_0x78ea('0x2f')]){_0x3fb0c7[_0x447913['nameField'][_0x78ea('0x30')]()]=_0x447913[_0x78ea('0x31')]['toString']();}else if(_[_0x78ea('0x2b')]([_0x78ea('0x32'),_0x78ea('0x2c')],_0x447913['type'])&&_0x447913[_0x78ea('0x33')]&&_0x447913[_0x78ea('0x2f')]){_0x3fb0c7[_0x447913[_0x78ea('0x33')][_0x78ea('0x30')]()]=_0x447913[_0x78ea('0x31')][_0x78ea('0x34')]();}else if(_0x447913['type']==='variable'&&_0x447913[_0x78ea('0x35')]&&_0x447913[_0x78ea('0x33')]&&_0x447913[_0x78ea('0x2f')]){_0x3fb0c7[_0x447913[_0x78ea('0x33')][_0x78ea('0x30')]()]=_0x21f552[_0x447913[_0x78ea('0x35')]][_0x78ea('0x34')]();}else if(_0x447913['type']===_0x78ea('0x36')&&_0x447913[_0x78ea('0x37')]&&_0x447913[_0x78ea('0x37')]['name']&&_0x447913[_0x78ea('0x33')]&&_0x447913[_0x78ea('0x2f')]){_0x3fb0c7[_0x447913[_0x78ea('0x33')][_0x78ea('0x30')]()]=_0x21f552[_0x447913[_0x78ea('0x37')][_0x78ea('0x38')][_0x78ea('0x30')]()][_0x78ea('0x34')]();}});}return _0x3fb0c7;}function getTicket(_0x570ac2,_0x51ec12,_0x237e34,_0x5a9954,_0x444605,_0x2862d6){return function(_0x338704){logger[_0x78ea('0x13')]('['+[_0x570ac2[_0x78ea('0x15')]()]+_0x78ea('0x39'),_0x338704);return new Promise(function(_0x462d49,_0x323ef1){var _0x50003f=_0x570ac2[_0x78ea('0x30')]()===_0x78ea('0x3a')?_0x338704[_0x78ea('0x1d')]:_0x338704[_0x78ea('0x28')];var _0x332ebd={'method':_0x78ea('0x24'),'uri':_0x237e34+_0x78ea('0x3b')+'?'+_0x2862d6,'body':Object[_0x78ea('0x3c')]({},{'active':'true','caller_id':_0x50003f,'assigned_to':_0x338704['userId'],'short_description':intUtil[_0x78ea('0x3d')](_0x5a9954['Subjects'],_0x444605,'\x20'),'description':intUtil[_0x78ea('0x3d')](_0x5a9954['Descriptions'],_0x444605,'\x0a')},getCustomFields(_0x5a9954[_0x78ea('0x3e')],_0x444605)),'auth':_0x51ec12,'json':!![]};return rp(_0x332ebd)[_0x78ea('0xe')](function(_0x59d29f){logger[_0x78ea('0x13')]('['+[_0x570ac2[_0x78ea('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x59d29f[_0x78ea('0xf')]);_0x338704[_0x78ea('0x3f')]=_0x59d29f['result'][_0x78ea('0x12')];_0x338704[_0x78ea('0x40')]=_0x59d29f[_0x78ea('0xf')][_0x78ea('0x41')];logger[_0x78ea('0x13')]('['+[_0x570ac2['toUpperCase']()]+_0x78ea('0x42'),_0x338704);_0x462d49(_0x338704);})[_0x78ea('0x20')](function(_0x2c4aeb){logger['error']('['+[_0x570ac2['toUpperCase']()]+']',_0x2c4aeb[_0x78ea('0x16')]);_0x323ef1(_0x2c4aeb[_0x78ea('0x16')]);});});};}function createRemoteTag(_0x1d0383,_0x5ad9bc,_0x1fee6c,_0x3198fc){return new Promise(function(_0x3fb826,_0x23334b){var _0x459261={'method':_0x78ea('0x24'),'uri':_0x1fee6c+_0x78ea('0x43')+'?'+_0x3198fc,'body':{'short_description':_0x1d0383,'global':!![],'active':!![],'name':_0x1d0383},'auth':_0x5ad9bc,'json':!![]};return rp(_0x459261)[_0x78ea('0xe')](function(_0x41ccac){var _0x4d9323=_0x41ccac[_0x78ea('0xf')][_0x78ea('0x12')];_0x3fb826(_0x4d9323);});});}function getRemoteTag(_0x107f28,_0x430cec,_0x27a294,_0x4b4807,_0x1ea8ad){return new Promise(function(_0x78aff4,_0x183926){var _0x47832b={'method':_0x78ea('0xc'),'uri':_0x27a294+_0x78ea('0x43')+_0x78ea('0x44')+_0x107f28+'&'+_0x4b4807,'auth':_0x430cec,'json':!![]};return rp(_0x47832b)[_0x78ea('0xe')](function(_0xb95c6){if(_0xb95c6[_0x78ea('0xf')][_0x78ea('0x10')]>0x0){var _0x4248e1=_0xb95c6[_0x78ea('0xf')][0x0][_0x78ea('0x12')];_0x78aff4(_0x4248e1);}else{return createRemoteTag(_0x107f28,_0x430cec,_0x27a294,_0x4b4807)[_0x78ea('0xe')](function(_0x2b76be){_0x78aff4(_0x2b76be);});}});});}function assignTagToIncident(_0x87c696,_0x3337ae,_0x3cf98e,_0x428ed0,_0x267145){return new Promise(function(_0x4fbb4c,_0x2484d2){var _0x304f15={'method':_0x78ea('0x24'),'uri':_0x3cf98e+_0x78ea('0x45')+'?'+_0x267145,'body':{'label':_0x87c696,'table':_0x78ea('0x3b'),'id_type':'Incident','table_key':_0x428ed0[_0x78ea('0x3f')],'title':_0x78ea('0x46')+_0x428ed0[_0x78ea('0x40')],'id_display':_0x428ed0[_0x78ea('0x40')]},'auth':_0x3337ae,'json':!![]};return rp(_0x304f15)[_0x78ea('0xe')](function(_0x13992e){_0x4fbb4c();})[_0x78ea('0x20')](function(){_0x4fbb4c();});});}function manageTags(_0x4c8fc4,_0x26f62d,_0x3db015,_0x8d206f,_0x13aca1,_0x19e68b,_0x37a167){return new Promise(function(_0x595614,_0x1dc42a){var _0x5d4ffc=[];_0x26f62d[_0x78ea('0x2a')](function(_0x392885){_0x5d4ffc[_0x78ea('0x47')](getRemoteTag(_0x392885,_0x3db015,_0x8d206f,_0x19e68b,_0x37a167));});return Promise[_0x78ea('0x48')](_0x5d4ffc)[_0x78ea('0xe')](function(_0x3a1d6f){if(_0x3a1d6f[_0x78ea('0x10')]){logger[_0x78ea('0x13')]('['+[_0x4c8fc4['toUpperCase']()]+_0x78ea('0x49'),_0x3a1d6f);var _0x4cd074=[];_0x3a1d6f[_0x78ea('0x2a')](function(_0x3df6bd){_0x4cd074['push'](assignTagToIncident(_0x3df6bd,_0x3db015,_0x8d206f,_0x13aca1,_0x19e68b));});return Promise['all'](_0x4cd074)[_0x78ea('0xe')](function(){_0x595614();})[_0x78ea('0x20')](function(){_0x595614();});}else{_0x595614();}});});}function getTags(_0x25b2a2,_0x581e19,_0x2df90d,_0xb1d497,_0x2d2120,_0x1fcdab){return function(_0x5dca81){return new Promise(function(_0x4f0591,_0x1dab4c){var _0x5d25cc=[];var _0x501111=_0xb1d497[_0x78ea('0x4a')];if(_0x501111&&_0x501111[_0x78ea('0x10')]>0x0){_0x5d25cc=_[_0x78ea('0x4b')](_0x501111,_0x78ea('0x38'));}if(_0x5d25cc[_0x78ea('0x10')]>0x0){return manageTags(_0x25b2a2,_0x5d25cc,_0x581e19,_0x2df90d,_0x5dca81,_0x2d2120,_0x1fcdab)[_0x78ea('0xe')](function(){_0x4f0591(_0x5dca81);});}else{_0x4f0591(_0x5dca81);}});};}function emit(_0x293f52,_0x63890a,_0x3c8ace){var _0x31f749='%26sysparm_record_target%3Dincident'+_0x78ea('0x4c')+_0x78ea('0x4d')+_0x78ea('0x4e');var _0x5b34bd={'uri':_0x293f52+_0x78ea('0x4f')+_0x3c8ace+_0x31f749};io['to'](util['format']('user:%s',_0x63890a))[_0x78ea('0x50')](_0x78ea('0x51'),_0x5b34bd);}exports['cs']=function(_0x27eec4,_0x3f6912,_0x10e190,_0x5a7537,_0x121800,_0x344d9b,_0x97fa67,_0x52718d){var _0x333204={};var _0x4c2cb6={'user':_0x344d9b['username'],'pass':_0x344d9b['password']};var _0xe542bd='sysparm_limit=1';var _0x3aedfc=_0x78ea('0x52');_0x344d9b[_0x78ea('0x53')]=intUtil[_0x78ea('0x54')](_0x344d9b[_0x78ea('0x53')]);_0x344d9b[_0x78ea('0x55')]=intUtil['stripTrailingSlash'](_0x344d9b[_0x78ea('0x55')]);var _0x5196af=util['format'](_0x78ea('0x56'),_0x344d9b[_0x78ea('0x53')]);_0x333204[_0x78ea('0x18')]=!_[_0x78ea('0x57')](_0x5a7537)?_0x5a7537[_0x78ea('0x58')]:null;_0x333204[_0x78ea('0x1e')]=_0x344d9b[_0x78ea('0x58')];_0x333204[_0x78ea('0x26')]=_0x52718d[_0x78ea('0x30')]()===_0x78ea('0x3a')?_0x3f6912[_0x78ea('0x59')]:_0x3f6912['calleridnum'];_0x333204[_0x78ea('0x5a')]=_0x52718d===_0x78ea('0x5b')||_0x52718d===_0x78ea('0x5c')?_0x78ea('0x5b'):_0x78ea('0x3a');var _0x59feb6=util[_0x78ea('0x5d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x344d9b['serverUrl'],_0x3f6912[_0x78ea('0x5e')],md5(_0x3f6912[_0x78ea('0x5e')]));if(_0x121800&&_0x121800['monitor_format']){logger[_0x78ea('0x13')]('[QUEUE]',_0x78ea('0x5f'));_0x3f6912[_0x78ea('0x60')]=_0x59feb6;}else if(_0x97fa67&&_0x97fa67[_0x78ea('0x61')]&&_0x97fa67[_0x78ea('0x61')]!=='none'){logger[_0x78ea('0x13')](_0x78ea('0x62'),'Recording\x20is\x20enabled!');_0x3f6912[_0x78ea('0x60')]=_0x59feb6;}else{_0x3f6912[_0x78ea('0x60')]='';}return getAdminUser(_0x52718d,_0x4c2cb6,_0x333204,_0x5196af,_0x3aedfc,_0xe542bd)[_0x78ea('0xe')](getUser(_0x52718d,_0x4c2cb6,_0x5196af,_0x3aedfc,_0xe542bd))[_0x78ea('0xe')](getEndUser(_0x52718d,_0x4c2cb6,_0x5196af,_0x3aedfc,_0xe542bd))[_0x78ea('0xe')](getTicket(_0x52718d,_0x4c2cb6,_0x5196af,_0x10e190,_0x3f6912,_0x3aedfc))[_0x78ea('0xe')](function(_0x15908e){logger[_0x78ea('0x13')](util[_0x78ea('0x5d')](_0x78ea('0x63'),_0x15908e[_0x78ea('0x3f')]));logger['info'](util[_0x78ea('0x5d')](_0x78ea('0x64'),_0x52718d));if(_0x52718d!=='unmanaged'){logger['info']('['+[_0x52718d['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x344d9b['remoteUri'],_0x5a7537[_0x78ea('0x38')],_0x15908e[_0x78ea('0x3f')]);}})[_0x78ea('0x20')](function(_0x35a31e){logger[_0x78ea('0x21')]('['+[_0x52718d[_0x78ea('0x15')]()]+_0x78ea('0x65'),util['inspect'](_0x35a31e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcd05=['unmanaged','format','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','util','md5','./util','../../../../config/logger','defaults','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','length','active','userId','adminEmail','],\x20getUser\x20crm','error','adminId','POST','endUserNumber','user','true','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','ticketId','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','callDirection','queue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd05,0x1aa));var _0x5cd0=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0xcd05[_0x50cfc3];return _0x5c11ef;};'use strict';var _=require(_0x5cd0('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x5cd0('0x1'));var md5=require(_0x5cd0('0x2'));var Redis=require('ioredis');var intUtil=require(_0x5cd0('0x3'));var config=require('../../../../config/environment');var logger=require(_0x5cd0('0x4'))('servicenow');config['redis']=_[_0x5cd0('0x5')](config[_0x5cd0('0x6')],{'host':_0x5cd0('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5cd0('0x6')]));function getAdminUser(_0x31a950,_0x491fa2,_0x5ec2ff,_0x518b9c,_0x456f1b,_0x36843f){return new Promise(function(_0x20a944,_0x261aa8){var _0x126af8={'method':_0x5cd0('0x8'),'uri':_0x518b9c+_0x5cd0('0x9')+'&'+_0x456f1b+'&'+_0x36843f,'auth':_0x491fa2,'json':!![]};return rp(_0x126af8)[_0x5cd0('0xa')](function(_0x339bb6){if(_0x339bb6[_0x5cd0('0xb')]['length']>0x0){_0x5ec2ff['adminId']=_0x339bb6[_0x5cd0('0xb')][0x0][_0x5cd0('0xc')];}logger[_0x5cd0('0xd')]('['+[_0x31a950[_0x5cd0('0xe')]()]+_0x5cd0('0xf'),_0x5ec2ff);_0x20a944(_0x5ec2ff);})[_0x5cd0('0x10')](function(_0x28b67a){logger['error']('['+[_0x31a950[_0x5cd0('0xe')]()]+']',_0x28b67a['message']);_0x261aa8(_0x28b67a[_0x5cd0('0x11')]);});});}function getUser(_0x265ca2,_0xd314d5,_0x3de865,_0x299583,_0x3736f0){return function(_0x4594cd){logger[_0x5cd0('0xd')]('['+[_0x265ca2['toUpperCase']()]+_0x5cd0('0x12'),_0x4594cd);return new Promise(function(_0x2ffd7c,_0x2466b1){if(intUtil['validateEmail'](_0x4594cd[_0x5cd0('0x13')])){var _0x1b5e0e={'method':'GET','uri':_0x3de865+_0x5cd0('0x14')+_0x4594cd[_0x5cd0('0x13')]+'&'+_0x299583+'&'+_0x3736f0,'auth':_0xd314d5,'json':!![]};logger[_0x5cd0('0xd')]('['+[_0x265ca2[_0x5cd0('0xe')]()]+'],\x20getUser\x20rp\x20obj',_0x1b5e0e);return rp(_0x1b5e0e)[_0x5cd0('0xa')](function(_0x27d75b){logger[_0x5cd0('0xd')]('['+[_0x265ca2[_0x5cd0('0xe')]()]+_0x5cd0('0x15'),_0x27d75b);if(_0x27d75b[_0x5cd0('0xb')][_0x5cd0('0x16')]>0x0&&String(_0x27d75b['result'][0x0][_0x5cd0('0x17')])==='true'){_0x4594cd[_0x5cd0('0x18')]=_0x27d75b['result'][0x0][_0x5cd0('0xc')];}else{_0x4594cd[_0x5cd0('0x18')]=_0x4594cd['adminId'];_0x4594cd[_0x5cd0('0x13')]=_0x4594cd[_0x5cd0('0x19')];}logger[_0x5cd0('0xd')]('['+[_0x265ca2[_0x5cd0('0xe')]()]+_0x5cd0('0x1a'),_0x4594cd);_0x2ffd7c(_0x4594cd);})[_0x5cd0('0x10')](function(_0x3e94f3){logger[_0x5cd0('0x1b')]('['+[_0x265ca2[_0x5cd0('0xe')]()]+']',_0x3e94f3[_0x5cd0('0x11')]);_0x2466b1(_0x3e94f3[_0x5cd0('0x11')]);});}else{logger[_0x5cd0('0xd')]('['+[_0x265ca2[_0x5cd0('0xe')]()]+']\x20using\x20admin\x20profile');_0x4594cd[_0x5cd0('0x18')]=_0x4594cd[_0x5cd0('0x1c')];_0x4594cd['userEmail']=_0x4594cd[_0x5cd0('0x19')];_0x2ffd7c(_0x4594cd);}});};}function createEndUser(_0xfd1865,_0x43a49f,_0x4a225f,_0x101c40,_0x41a5f6){logger['info']('['+[_0xfd1865[_0x5cd0('0xe')]()]+'],\x20createEndUser\x20input\x20crm',_0x4a225f);return new Promise(function(_0x55d643,_0x1beb6e){var _0x3b69e0={'method':_0x5cd0('0x1d'),'uri':_0x101c40+'sys_user?'+_0x41a5f6,'body':{'user_name':_0x4a225f[_0x5cd0('0x1e')],'roles':_0x5cd0('0x1f'),'first_name':_0x4a225f[_0x5cd0('0x1e')],'active':_0x5cd0('0x20'),'date_format':'System','phone':_0x4a225f[_0x5cd0('0x1e')]},'auth':_0x43a49f,'json':!![]};return rp(_0x3b69e0)[_0x5cd0('0xa')](function(_0x59af22){logger[_0x5cd0('0xd')]('['+[_0xfd1865[_0x5cd0('0xe')]()]+_0x5cd0('0x21'),_0x59af22[_0x5cd0('0xb')]);_0x4a225f['endUserId']=_0x59af22[_0x5cd0('0xb')][_0x5cd0('0xc')];_0x55d643(_0x4a225f);})['catch'](function(_0x386073){logger[_0x5cd0('0x1b')]('['+[_0xfd1865[_0x5cd0('0xe')]()]+']',_0x386073[_0x5cd0('0x11')]);_0x1beb6e(_0x386073[_0x5cd0('0x11')]);});});}function getEndUser(_0x1bd116,_0x59211d,_0x14f400,_0x342518,_0x3e1328){return function(_0x319460){logger[_0x5cd0('0xd')]('['+[_0x1bd116[_0x5cd0('0xe')]()]+_0x5cd0('0x22'),_0x319460);return new Promise(function(_0xc6de1d,_0x41bb94){var _0x27ce52={'method':_0x5cd0('0x8'),'uri':_0x14f400+_0x5cd0('0x23')+_0x319460[_0x5cd0('0x1e')]+'&'+_0x342518+'&'+_0x3e1328,'auth':_0x59211d,'json':!![]};return rp(_0x27ce52)[_0x5cd0('0xa')](function(_0x11bc92){if(_0x11bc92['result'][_0x5cd0('0x16')]>0x0){_0x319460[_0x5cd0('0x24')]=_0x11bc92[_0x5cd0('0xb')][0x0][_0x5cd0('0xc')];logger[_0x5cd0('0xd')]('['+[_0x1bd116[_0x5cd0('0xe')]()]+_0x5cd0('0x25'),_0x319460);_0xc6de1d(_0x319460);}else{return createEndUser(_0x1bd116,_0x59211d,_0x319460,_0x14f400,_0x342518)['then'](function(_0x54aa70){logger[_0x5cd0('0xd')]('['+[_0x1bd116['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x54aa70);_0xc6de1d(_0x54aa70);});}})[_0x5cd0('0x10')](function(_0xceb4f){logger['error']('['+[_0x1bd116[_0x5cd0('0xe')]()]+']',_0xceb4f[_0x5cd0('0x11')]);_0x41bb94(_0xceb4f['message']);});});};}function getCustomFields(_0x375ba7,_0x18a2a9){var _0x24492b={};if(_0x375ba7[_0x5cd0('0x16')]>0x0){_[_0x5cd0('0x26')](_0x375ba7,function(_0x2948af){if(_[_0x5cd0('0x27')]([_0x5cd0('0x28'),_0x5cd0('0x29')],_0x2948af['type'])&&_0x2948af[_0x5cd0('0x2a')]&&!_0x2948af[_0x5cd0('0x2b')]){_0x24492b[_0x2948af[_0x5cd0('0x2a')][_0x5cd0('0x2c')]()]=_0x2948af[_0x5cd0('0x2d')][_0x5cd0('0x2e')]();}else if(_['includes']([_0x5cd0('0x28'),'picklist'],_0x2948af[_0x5cd0('0x2f')])&&_0x2948af[_0x5cd0('0x30')]&&_0x2948af['customField']){_0x24492b[_0x2948af['idField']['toLowerCase']()]=_0x2948af[_0x5cd0('0x2d')][_0x5cd0('0x2e')]();}else if(_0x2948af[_0x5cd0('0x2f')]===_0x5cd0('0x31')&&_0x2948af[_0x5cd0('0x32')]&&_0x2948af[_0x5cd0('0x30')]&&_0x2948af[_0x5cd0('0x2b')]){_0x24492b[_0x2948af['idField']['toLowerCase']()]=_0x18a2a9[_0x2948af[_0x5cd0('0x32')]][_0x5cd0('0x2e')]();}else if(_0x2948af[_0x5cd0('0x2f')]==='customVariable'&&_0x2948af[_0x5cd0('0x33')]&&_0x2948af[_0x5cd0('0x33')][_0x5cd0('0x34')]&&_0x2948af['idField']&&_0x2948af[_0x5cd0('0x2b')]){_0x24492b[_0x2948af['idField']['toLowerCase']()]=_0x18a2a9[_0x2948af[_0x5cd0('0x33')][_0x5cd0('0x34')][_0x5cd0('0x2c')]()][_0x5cd0('0x2e')]();}});}return _0x24492b;}function getTicket(_0x422397,_0x1dfe70,_0x126754,_0x28eb1c,_0x581357,_0x5d1ee2){return function(_0x1a184c){logger[_0x5cd0('0xd')]('['+[_0x422397[_0x5cd0('0xe')]()]+_0x5cd0('0x35'),_0x1a184c);return new Promise(function(_0x40646d,_0x348dff){var _0x461efa=_0x422397['toLowerCase']()===_0x5cd0('0x36')?_0x1a184c['userId']:_0x1a184c[_0x5cd0('0x24')];var _0x1fd5c5={'method':_0x5cd0('0x1d'),'uri':_0x126754+_0x5cd0('0x37')+'?'+_0x5d1ee2,'body':Object['assign']({},{'active':'true','caller_id':_0x461efa,'assigned_to':_0x1a184c[_0x5cd0('0x18')],'short_description':intUtil[_0x5cd0('0x38')](_0x28eb1c[_0x5cd0('0x39')],_0x581357,'\x20'),'description':intUtil[_0x5cd0('0x38')](_0x28eb1c[_0x5cd0('0x3a')],_0x581357,'\x0a')},getCustomFields(_0x28eb1c[_0x5cd0('0x3b')],_0x581357)),'auth':_0x1dfe70,'json':!![]};return rp(_0x1fd5c5)['then'](function(_0x3e1d7d){logger['info']('['+[_0x422397['toUpperCase']()]+_0x5cd0('0x3c'),_0x3e1d7d[_0x5cd0('0xb')]);_0x1a184c['ticketId']=_0x3e1d7d[_0x5cd0('0xb')][_0x5cd0('0xc')];_0x1a184c[_0x5cd0('0x3d')]=_0x3e1d7d['result'][_0x5cd0('0x3e')];logger[_0x5cd0('0xd')]('['+[_0x422397[_0x5cd0('0xe')]()]+_0x5cd0('0x3f'),_0x1a184c);_0x40646d(_0x1a184c);})[_0x5cd0('0x10')](function(_0x2284ec){logger[_0x5cd0('0x1b')]('['+[_0x422397[_0x5cd0('0xe')]()]+']',_0x2284ec[_0x5cd0('0x11')]);_0x348dff(_0x2284ec[_0x5cd0('0x11')]);});});};}function createRemoteTag(_0x4c4b16,_0x324e33,_0x4153e5,_0x674273){return new Promise(function(_0x2a4e59,_0x4074f4){var _0x2ad74c={'method':_0x5cd0('0x1d'),'uri':_0x4153e5+_0x5cd0('0x40')+'?'+_0x674273,'body':{'short_description':_0x4c4b16,'global':!![],'active':!![],'name':_0x4c4b16},'auth':_0x324e33,'json':!![]};return rp(_0x2ad74c)['then'](function(_0x3f01df){var _0x1eaefc=_0x3f01df[_0x5cd0('0xb')][_0x5cd0('0xc')];_0x2a4e59(_0x1eaefc);});});}function getRemoteTag(_0x2f8ced,_0x52743a,_0x3ecf06,_0x3b2440,_0x48f95d){return new Promise(function(_0x4d1405,_0x5d51fd){var _0x35ce10={'method':_0x5cd0('0x8'),'uri':_0x3ecf06+_0x5cd0('0x40')+_0x5cd0('0x41')+_0x2f8ced+'&'+_0x3b2440,'auth':_0x52743a,'json':!![]};return rp(_0x35ce10)['then'](function(_0x519f36){if(_0x519f36[_0x5cd0('0xb')]['length']>0x0){var _0x1f57aa=_0x519f36[_0x5cd0('0xb')][0x0][_0x5cd0('0xc')];_0x4d1405(_0x1f57aa);}else{return createRemoteTag(_0x2f8ced,_0x52743a,_0x3ecf06,_0x3b2440)[_0x5cd0('0xa')](function(_0x2fb8e1){_0x4d1405(_0x2fb8e1);});}});});}function assignTagToIncident(_0x258127,_0x1797a8,_0x25a1c4,_0x506604,_0x5d710){return new Promise(function(_0x2f5c24,_0xbc9012){var _0x1533fa={'method':'POST','uri':_0x25a1c4+_0x5cd0('0x42')+'?'+_0x5d710,'body':{'label':_0x258127,'table':_0x5cd0('0x37'),'id_type':'Incident','table_key':_0x506604[_0x5cd0('0x43')],'title':_0x5cd0('0x44')+_0x506604[_0x5cd0('0x3d')],'id_display':_0x506604[_0x5cd0('0x3d')]},'auth':_0x1797a8,'json':!![]};return rp(_0x1533fa)[_0x5cd0('0xa')](function(_0x3e62fb){_0x2f5c24();})[_0x5cd0('0x10')](function(){_0x2f5c24();});});}function manageTags(_0xda401d,_0x3e6f9d,_0x524997,_0x236501,_0x35d960,_0x516958,_0x22f54e){return new Promise(function(_0x41e324,_0x105e89){var _0x2aed58=[];_0x3e6f9d[_0x5cd0('0x26')](function(_0x4784d9){_0x2aed58['push'](getRemoteTag(_0x4784d9,_0x524997,_0x236501,_0x516958,_0x22f54e));});return Promise[_0x5cd0('0x45')](_0x2aed58)[_0x5cd0('0xa')](function(_0x3c2578){if(_0x3c2578[_0x5cd0('0x16')]){logger[_0x5cd0('0xd')]('['+[_0xda401d['toUpperCase']()]+_0x5cd0('0x46'),_0x3c2578);var _0x41f183=[];_0x3c2578[_0x5cd0('0x26')](function(_0x2027ce){_0x41f183[_0x5cd0('0x47')](assignTagToIncident(_0x2027ce,_0x524997,_0x236501,_0x35d960,_0x516958));});return Promise['all'](_0x41f183)[_0x5cd0('0xa')](function(){_0x41e324();})[_0x5cd0('0x10')](function(){_0x41e324();});}else{_0x41e324();}});});}function getTags(_0x22f8c1,_0xa139f8,_0xb9b662,_0x176466,_0x68eb70,_0xdc72b4){return function(_0x71eb82){return new Promise(function(_0x29998b,_0x1290db){var _0x5cd93b=[];var _0x6e6aee=_0x176466[_0x5cd0('0x48')];if(_0x6e6aee&&_0x6e6aee[_0x5cd0('0x16')]>0x0){_0x5cd93b=_[_0x5cd0('0x49')](_0x6e6aee,_0x5cd0('0x34'));}if(_0x5cd93b[_0x5cd0('0x16')]>0x0){return manageTags(_0x22f8c1,_0x5cd93b,_0xa139f8,_0xb9b662,_0x71eb82,_0x68eb70,_0xdc72b4)[_0x5cd0('0xa')](function(){_0x29998b(_0x71eb82);});}else{_0x29998b(_0x71eb82);}});};}function emit(_0x146a29,_0x1edbb5,_0x24ce4b){var _0x471689=_0x5cd0('0x4a')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x1132ff={'uri':_0x146a29+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x24ce4b+_0x471689};io['to'](util['format'](_0x5cd0('0x4b'),_0x1edbb5))[_0x5cd0('0x4c')](_0x5cd0('0x4d'),_0x1132ff);}exports['cs']=function(_0x3c4646,_0x75937c,_0x55ea7b,_0x43ed4d,_0x3b04ca,_0x1f3fdf,_0xb51f51,_0x45117b){var _0x469b57={};var _0x484708={'user':_0x1f3fdf['username'],'pass':_0x1f3fdf[_0x5cd0('0x4e')]};var _0x497f83=_0x5cd0('0x4f');var _0x2a6436=_0x5cd0('0x50');_0x1f3fdf[_0x5cd0('0x51')]=intUtil[_0x5cd0('0x52')](_0x1f3fdf['remoteUri']);_0x1f3fdf['serverUrl']=intUtil[_0x5cd0('0x52')](_0x1f3fdf['serverUrl']);var _0x421ae1=util['format']('%s/api/now/table/',_0x1f3fdf['remoteUri']);_0x469b57[_0x5cd0('0x13')]=!_[_0x5cd0('0x53')](_0x43ed4d)?_0x43ed4d[_0x5cd0('0x54')]:null;_0x469b57['adminEmail']=_0x1f3fdf[_0x5cd0('0x54')];_0x469b57['endUserNumber']=_0x45117b[_0x5cd0('0x2c')]()===_0x5cd0('0x36')?_0x75937c[_0x5cd0('0x55')]:_0x75937c[_0x5cd0('0x56')];_0x469b57[_0x5cd0('0x57')]=_0x45117b===_0x5cd0('0x58')||_0x45117b===_0x5cd0('0x59')?_0x5cd0('0x58'):_0x5cd0('0x36');var _0x597562=util[_0x5cd0('0x5a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f3fdf[_0x5cd0('0x5b')],_0x75937c[_0x5cd0('0x5c')],md5(_0x75937c[_0x5cd0('0x5c')]));if(_0x3b04ca&&_0x3b04ca[_0x5cd0('0x5d')]){logger['info'](_0x5cd0('0x5e'),_0x5cd0('0x5f'));_0x75937c['recordingURL']=_0x597562;}else if(_0xb51f51&&_0xb51f51[_0x5cd0('0x60')]&&_0xb51f51[_0x5cd0('0x60')]!=='none'){logger[_0x5cd0('0xd')](_0x5cd0('0x61'),'Recording\x20is\x20enabled!');_0x75937c[_0x5cd0('0x62')]=_0x597562;}else{_0x75937c['recordingURL']='';}return getAdminUser(_0x45117b,_0x484708,_0x469b57,_0x421ae1,_0x2a6436,_0x497f83)[_0x5cd0('0xa')](getUser(_0x45117b,_0x484708,_0x421ae1,_0x2a6436,_0x497f83))[_0x5cd0('0xa')](getEndUser(_0x45117b,_0x484708,_0x421ae1,_0x2a6436,_0x497f83))[_0x5cd0('0xa')](getTicket(_0x45117b,_0x484708,_0x421ae1,_0x55ea7b,_0x75937c,_0x2a6436))[_0x5cd0('0xa')](function(_0x60c045){logger[_0x5cd0('0xd')](util[_0x5cd0('0x5a')](_0x5cd0('0x63'),_0x60c045['ticketId']));logger[_0x5cd0('0xd')](util[_0x5cd0('0x5a')](_0x5cd0('0x64'),_0x45117b));if(_0x45117b!==_0x5cd0('0x59')){logger[_0x5cd0('0xd')]('['+[_0x45117b[_0x5cd0('0xe')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1f3fdf[_0x5cd0('0x51')],_0x43ed4d[_0x5cd0('0x34')],_0x60c045[_0x5cd0('0x43')]);}})['catch'](function(_0x4b67db){logger[_0x5cd0('0x1b')]('['+[_0x45117b[_0x5cd0('0xe')]()]+_0x5cd0('0x65'),util[_0x5cd0('0x66')](_0x4b67db,{'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 2a3caa5..c02f3cc 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 _0xef8c=['username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','users','contacts','version','charAt','[QUEUE]','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridnum','Outbound','%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','[OUTBOUND]','unmanaged','lastevent','toUpperCase','isNil','The\x20Ticket\x20ID\x20is:','lodash','request-promise','bluebird','md5','ioredis','./util','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','string','nameField','customField','type','custom_fields','content','variable','customVariable','Variable','toLowerCase','login'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0xef8c,0x1ad));var _0xcef8=function(_0xcb48ca,_0x540ecb){_0xcb48ca=_0xcb48ca-0x0;var _0x37be10=_0xef8c[_0xcb48ca];return _0x37be10;};'use strict';var _=require(_0xcef8('0x0'));var rp=require(_0xcef8('0x1'));var BPromise=require(_0xcef8('0x2'));var md5=require(_0xcef8('0x3'));var util=require('util');var Redis=require(_0xcef8('0x4'));var intUtil=require(_0xcef8('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xcef8('0x6'));config[_0xcef8('0x7')]=_[_0xcef8('0x8')](config[_0xcef8('0x7')],{'host':_0xcef8('0x9'),'port':0x18eb});var io=require(_0xcef8('0xa'))(new Redis(config['redis']));var def={'method':_0xcef8('0xb'),'json':!![]};function emit(_0x3fbf89,_0x4885a7,_0x491fc3){io['to'](_0x3fbf89)[_0xcef8('0xc')](_0x4885a7,_0x491fc3);}function getTicket(_0x20ee03,_0x151a89,_0x16ee4a,_0x1d8d01,_0x1120e7,_0x2d5a5f,_0x2a49af,_0x2f9dba){logger['info'](_0xcef8('0xd'));var _0x8058cc=new Date();var _0x2b1826=[{'name':_0xcef8('0xe'),'value':intUtil[_0xcef8('0xf')](_0x1d8d01['Subjects'],_0x1120e7,'\x20')},{'name':_0xcef8('0x10'),'value':_0x151a89['id']},{'name':_0xcef8('0x11'),'value':_0x151a89['id']},{'name':_0xcef8('0x12'),'value':intUtil['getString'](_0x1d8d01[_0xcef8('0x13')],_0x1120e7,'\x0a')},{'name':_0xcef8('0x14'),'value':_0x8058cc['toISOString']()['slice'](0x0,0x13)[_0xcef8('0x15')]('T','\x20')},{'name':_0xcef8('0x16'),'value':'0'},{'name':_0xcef8('0x17'),'value':'15'},{'name':_0xcef8('0x18'),'value':_0x16ee4a['id']},{'name':'parent_type','value':_0xcef8('0x19')},{'name':_0xcef8('0x1a'),'value':_0x16ee4a[_0xcef8('0xe')]},{'name':_0xcef8('0x1b'),'value':_0x2f9dba}];if(_0x2d5a5f['length']){_[_0xcef8('0x1c')](_0x2d5a5f,function(_0x4a6f87){if(_0x1120e7[_0x4a6f87[_0xcef8('0x1d')]]){_0x2b1826[_0xcef8('0x1e')]({'name':_0x4a6f87[_0xcef8('0x1f')],'value':_0x1120e7[_0x4a6f87['variableName']]});}});}return request({'form':{'method':_0xcef8('0x20'),'input_type':_0xcef8('0x21'),'response_type':_0xcef8('0x21'),'rest_data':JSON[_0xcef8('0x22')]({'session':_0x2a49af['id'],'module_name':_0xcef8('0x23'),'name_value_list':_0x2b1826})}});}function getAuth(_0x4a34b3){return util[_0xcef8('0x24')](_0xcef8('0x25'),new Buffer(_0x4a34b3[_0xcef8('0x26')]+':X')[_0xcef8('0x27')](_0xcef8('0x28')));}function getServerInfo(_0x188243){return request({'form':{'method':_0xcef8('0x29'),'input_type':_0xcef8('0x21'),'response_type':_0xcef8('0x21'),'rest_data':JSON[_0xcef8('0x22')]({'session':_0x188243['id']})}});}function getUser(_0x125b8a,_0x406dc6,_0x45441f){if(!_['isNil'](_0x406dc6)){logger[_0xcef8('0x2a')](_0xcef8('0x2b'),_0x406dc6);return request({'form':{'method':_0xcef8('0x2c'),'input_type':_0xcef8('0x21'),'response_type':_0xcef8('0x21'),'rest_data':JSON[_0xcef8('0x22')]({'session':_0x45441f['id'],'module_name':_0xcef8('0x2d'),'query':util[_0xcef8('0x24')](_0xcef8('0x2e'),_0x406dc6),'order_by':'','offset':'0','select_fields':['id',_0xcef8('0xe'),_0xcef8('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcef8('0x30')](function(_0x29c6b3){if(_0x29c6b3['entry_list']['length']){var _0x3f99d3=_[_0xcef8('0x31')](_0x29c6b3[_0xcef8('0x32')],function(_0x32410a){return _0x32410a[_0xcef8('0x33')][_0xcef8('0x2f')][_0xcef8('0x34')]===_0x406dc6;});if(_0x3f99d3){logger[_0xcef8('0x2a')](_0xcef8('0x35'));return BPromise[_0xcef8('0x36')]({'id':_0x3f99d3[_0xcef8('0x33')]['id']['value'],'name':_0x3f99d3[_0xcef8('0x33')][_0xcef8('0xe')][_0xcef8('0x34')]});}}logger[_0xcef8('0x2a')](_0xcef8('0x37'));return BPromise['resolve']({'id':_0x45441f['name_value_list'][_0xcef8('0x38')]['value'],'name':_0x45441f[_0xcef8('0x33')][_0xcef8('0x2f')][_0xcef8('0x34')]});});}else{logger[_0xcef8('0x2a')](_0xcef8('0x39'));return BPromise[_0xcef8('0x36')]({'id':_0x45441f[_0xcef8('0x33')][_0xcef8('0x38')][_0xcef8('0x34')],'name':_0x45441f[_0xcef8('0x33')][_0xcef8('0x2f')][_0xcef8('0x34')]});}}function getEndUser(_0x9cc195,_0x35fd25,_0x20b3f4,_0xc36e7c){logger[_0xcef8('0x2a')](_0xcef8('0x3a'),_0x20b3f4);return request({'form':{'method':_0xcef8('0x2c'),'input_type':_0xcef8('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xc36e7c['id'],'module_name':_0xcef8('0x19'),'query':util[_0xcef8('0x24')](_0xcef8('0x3b'),_0x20b3f4),'order_by':'','offset':'0','select_fields':['id','name',_0xcef8('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcef8('0x30')](function(_0x116c3a){if(_0x116c3a[_0xcef8('0x32')][_0xcef8('0x3d')]){var _0x2aea34=_[_0xcef8('0x31')](_0x116c3a[_0xcef8('0x32')],function(_0x7dbf37){return _0x7dbf37['name_value_list'][_0xcef8('0x3c')][_0xcef8('0x34')]===_0x20b3f4;});if(_0x2aea34){logger[_0xcef8('0x2a')](_0xcef8('0x3e'));return BPromise[_0xcef8('0x36')]({'id':_0x2aea34[_0xcef8('0x33')]['id'][_0xcef8('0x34')],'name':_0x2aea34['name_value_list'][_0xcef8('0xe')][_0xcef8('0x34')],'phone':_0x2aea34[_0xcef8('0x33')]['phone_home'][_0xcef8('0x34')]});}}else{logger[_0xcef8('0x2a')](_0xcef8('0x3f'));return request({'form':{'method':_0xcef8('0x20'),'input_type':_0xcef8('0x21'),'response_type':'JSON','rest_data':JSON[_0xcef8('0x22')]({'session':_0xc36e7c['id'],'module_name':_0xcef8('0x19'),'name_value_list':[{'name':_0xcef8('0x40'),'value':_0x35fd25!==_0xcef8('0x41')?_0x35fd25:util['format'](_0xcef8('0x42'),_0x20b3f4)},{'name':_0xcef8('0x3c'),'value':_0x20b3f4}]})}})[_0xcef8('0x30')](function(_0x50cac9){logger[_0xcef8('0x2a')](_0xcef8('0x43'));return BPromise[_0xcef8('0x36')]({'id':_0x50cac9['id'],'name':_0x50cac9[_0xcef8('0x32')]['first_name'][_0xcef8('0x34')],'phone':_0x50cac9[_0xcef8('0x32')][_0xcef8('0x3c')][_0xcef8('0x34')]});});}});}function request(_0x2cd2bf){logger[_0xcef8('0x44')](_0xcef8('0x45'),JSON['stringify'](_0x2cd2bf));return rp(_[_0xcef8('0x46')](def,_0x2cd2bf));}function getTags(_0x20ac39,_0x49d602){var _0x1de02b=[];if(_0x20ac39&&_0x20ac39['length']>0x0){_0x1de02b=_[_0xcef8('0x47')](_0x20ac39,_0x49d602);}return _0x1de02b;}function getCustomFields(_0x1fb0c6,_0x56084b){var _0xb8bc72=[];var _0x2ce40c={'custom_fields':[]};if(_0x1fb0c6[_0xcef8('0x3d')]>0x0){_[_0xcef8('0x1c')](_0x1fb0c6,function(_0x4d1bff){if(_0x4d1bff['type']===_0xcef8('0x48')&&_0x4d1bff[_0xcef8('0x49')]&&!_0x4d1bff[_0xcef8('0x4a')]){_0x2ce40c[_0x4d1bff['nameField']['toLowerCase']()]=_0x4d1bff['content'][_0xcef8('0x27')]();}else if(_0x4d1bff[_0xcef8('0x4b')]===_0xcef8('0x48')&&_0x4d1bff['idField']&&_0x4d1bff['customField']){_0x2ce40c[_0xcef8('0x4c')]['push']({'id':_0x4d1bff[_0xcef8('0x1f')],'value':_0x4d1bff[_0xcef8('0x4d')][_0xcef8('0x27')]()});}else if(_0x4d1bff[_0xcef8('0x4b')]===_0xcef8('0x4e')&&_0x4d1bff['variableName']&&_0x4d1bff[_0xcef8('0x1f')]&&_0x4d1bff['customField']){_0x56084b[_0x4d1bff[_0xcef8('0x1d')]]&&_0x2ce40c[_0xcef8('0x4c')]['push']({'id':_0x4d1bff['idField'],'value':_0x56084b[_0x4d1bff[_0xcef8('0x1d')]][_0xcef8('0x27')]()});}else if(_0x4d1bff[_0xcef8('0x4b')]===_0xcef8('0x4f')&&_0x4d1bff[_0xcef8('0x50')]&&_0x4d1bff[_0xcef8('0x50')][_0xcef8('0xe')]&&_0x4d1bff['idField']&&_0x4d1bff['customField']){_0x56084b[_0x4d1bff[_0xcef8('0x50')]['name'][_0xcef8('0x51')]()]&&_0x2ce40c['custom_fields']['push']({'id':_0x4d1bff[_0xcef8('0x1f')],'value':_0x56084b[_0x4d1bff[_0xcef8('0x50')][_0xcef8('0xe')][_0xcef8('0x51')]()][_0xcef8('0x27')]()});}});}return _0x2ce40c;}function getConnection(_0x52b695){return request({'method':_0xcef8('0xb'),'form':{'method':_0xcef8('0x52'),'input_type':_0xcef8('0x21'),'response_type':'JSON','rest_data':JSON[_0xcef8('0x22')]({'user_auth':{'user_name':_0x52b695[_0xcef8('0x53')],'password':_0x52b695[_0xcef8('0x54')],'encryption':_0xcef8('0x55')},'application':_0xcef8('0x56')})}})['then'](function(_0x52ded5){var _0x1870d2=_0x52ded5;if(_0x1870d2['id']){def[_0xcef8('0x57')]=_0x1870d2['id'];return BPromise['resolve'](_0x1870d2);}else{throw new Error(util[_0xcef8('0x24')](_0xcef8('0x58'),_0x52b695['id']));}});}function setRelationship(_0x5d1b72,_0x5294cf,_0x488d96,_0x16c9d5){return request({'form':{'method':'set_relationship','input_type':_0xcef8('0x21'),'response_type':_0xcef8('0x21'),'rest_data':JSON[_0xcef8('0x22')]({'session':_0x5d1b72['id'],'module_name':'Calls','module_id':_0x488d96['id'],'link_field_name':_0x16c9d5,'related_ids':[_0x5294cf['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xcef8('0x59')]=function(_0x550e46,_0x3c533d,_0x3de737,_0x57276c,_0x417486,_0x3d44ca){var _0x4d56cf,_0x3c7faa,_0x6903b2,_0x12de94;_0x3d44ca[_0xcef8('0x5a')]=intUtil[_0xcef8('0x5b')](_0x3d44ca[_0xcef8('0x5a')]);_0x3d44ca['serverUrl']=intUtil[_0xcef8('0x5b')](_0x3d44ca[_0xcef8('0x5c')]);def[_0xcef8('0x5d')]=util[_0xcef8('0x24')](_0xcef8('0x5e'),_0x3d44ca[_0xcef8('0x5a')]);if(_0x417486&&_0x417486[_0xcef8('0x5f')]){logger[_0xcef8('0x2a')]('[QUEUE]',_0xcef8('0x60'));_0x3c533d[_0xcef8('0x61')]=util[_0xcef8('0x24')](_0xcef8('0x62'),_0x3d44ca[_0xcef8('0x5c')],_0x3c533d[_0xcef8('0x63')],md5(_0x3c533d[_0xcef8('0x63')]));}else{_0x3c533d[_0xcef8('0x61')]='';}return getConnection(_0x3d44ca)[_0xcef8('0x30')](function(_0x818449){_0x12de94=_0x818449;return getUser(_0x3d44ca,_0x57276c['name'],_0x12de94);})['then'](function(_0x55fb96){_0x4d56cf=_0x55fb96;logger[_0xcef8('0x2a')](_0xcef8('0x64'),_0x4d56cf['id']);return getEndUser(_0x3d44ca,_0x3c533d[_0xcef8('0x65')],_0x3c533d[_0xcef8('0x66')],_0x12de94);})[_0xcef8('0x30')](function(_0x577ad9){_0x3c7faa=_0x577ad9;logger[_0xcef8('0x2a')](_0xcef8('0x67'),_0x3c7faa['id']);return getTicket(_0x3d44ca,_0x4d56cf,_0x3c7faa,_0x3de737,_0x3c533d,_0x3de737['Fields'],_0x12de94,_0xcef8('0x68'));})[_0xcef8('0x30')](function(_0x45743c){_0x6903b2=_0x45743c;logger[_0xcef8('0x2a')](_0xcef8('0x69'));logger[_0xcef8('0x2a')]('The\x20Ticket\x20ID\x20is:',_0x6903b2['id']);return setRelationship(_0x12de94,_0x4d56cf,_0x6903b2,_0xcef8('0x6a'));})['then'](function(){return setRelationship(_0x12de94,_0x3c7faa,_0x6903b2,_0xcef8('0x6b'));})[_0xcef8('0x30')](function(){return getServerInfo(_0x12de94);})[_0xcef8('0x30')](function(_0x2404e5){var _0x5c4fc4=parseInt(_0x2404e5[_0xcef8('0x6c')][_0xcef8('0x6d')](0x0));var _0x2bbed5=util[_0xcef8('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3d44ca[_0xcef8('0x5a')],_0x6903b2['id']);if(_0x5c4fc4>0x6){_0x2bbed5=util[_0xcef8('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3d44ca['remoteUri'],_0x6903b2['id']);}logger['info'](_0xcef8('0x6e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcef8('0x24')](_0xcef8('0x6f'),_0x57276c['name']),_0xcef8('0x70'),{'uri':_0x2bbed5});})[_0xcef8('0x71')](function(_0x3a00d8){logger[_0xcef8('0x72')]('[QUEUE]',JSON['stringify'](_0x3a00d8));});};exports[_0xcef8('0x73')]=function(_0x466527,_0x1dac80,_0x15a80a,_0x12799a,_0x5e87e9,_0x16e176,_0x1aed8b){var _0x36582e,_0xa40738,_0xd3a401,_0x13035b;_0x16e176['remoteUri']=intUtil[_0xcef8('0x5b')](_0x16e176[_0xcef8('0x5a')]);_0x16e176[_0xcef8('0x5c')]=intUtil[_0xcef8('0x5b')](_0x16e176[_0xcef8('0x5c')]);def[_0xcef8('0x5d')]=util['format']('%s/service/v4_1/rest.php',_0x16e176[_0xcef8('0x5a')]);if(_0x1aed8b&&_0x1aed8b[_0xcef8('0x74')]&&_0x1aed8b['recordingFormat']!==_0xcef8('0x75')){logger['info']('[OUTBOUND]',_0xcef8('0x60'));_0x1dac80[_0xcef8('0x61')]=util[_0xcef8('0x24')](_0xcef8('0x62'),_0x16e176['serverUrl'],_0x1dac80['uniqueid'],md5(_0x1dac80[_0xcef8('0x63')]));}return getConnection(_0x16e176)['then'](function(_0x58adc5){_0x13035b=_0x58adc5;return getUser(_0x16e176,_0x12799a[_0xcef8('0xe')],_0x13035b);})[_0xcef8('0x30')](function(_0x1ee29b){_0x36582e=_0x1ee29b;logger[_0xcef8('0x2a')]('The\x20User\x20ID\x20is:',_0x36582e['id']);return getEndUser(_0x16e176,_0x1dac80['destcalleridname'],_0x1dac80[_0xcef8('0x76')],_0x13035b);})[_0xcef8('0x30')](function(_0x22454a){_0xa40738=_0x22454a;logger[_0xcef8('0x2a')]('The\x20Enduser\x20ID\x20is:',_0xa40738['id']);return getTicket(_0x16e176,_0x36582e,_0xa40738,_0x15a80a,_0x1dac80,_0x15a80a['Fields'],_0x13035b,_0xcef8('0x77'));})[_0xcef8('0x30')](function(_0x478862){_0xd3a401=_0x478862;logger[_0xcef8('0x2a')]('Ticket\x20created!');logger[_0xcef8('0x2a')]('The\x20Ticket\x20ID\x20is:',_0xd3a401['id']);return setRelationship(_0x13035b,_0x36582e,_0xd3a401,_0xcef8('0x6a'));})[_0xcef8('0x30')](function(){return setRelationship(_0x13035b,_0xa40738,_0xd3a401,_0xcef8('0x6b'));})[_0xcef8('0x30')](function(){return getServerInfo(_0x13035b);})[_0xcef8('0x30')](function(_0xe7ea99){var _0x33b8b7=parseInt(_0xe7ea99[_0xcef8('0x6c')]['charAt'](0x0));var _0x29d16d=util[_0xcef8('0x24')](_0xcef8('0x78'),_0x16e176[_0xcef8('0x5a')],_0xd3a401['id']);if(_0x33b8b7>0x6){_0x29d16d=util[_0xcef8('0x24')](_0xcef8('0x79'),_0x16e176[_0xcef8('0x5a')],_0xd3a401['id']);}logger[_0xcef8('0x2a')](_0xcef8('0x7a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xcef8('0x6f'),_0x12799a[_0xcef8('0xe')]),_0xcef8('0x70'),{'uri':_0x29d16d});})[_0xcef8('0x71')](function(_0x48dbcd){logger[_0xcef8('0x72')](_0xcef8('0x7a'),JSON[_0xcef8('0x22')](_0x48dbcd));});};exports[_0xcef8('0x7b')]=function(_0x23b3e1,_0x46b8f1,_0x1ff122,_0x57695d,_0x431f88,_0x239f9f){var _0x17b27c,_0xc36825,_0x1c07d3,_0x248018;_0x239f9f[_0xcef8('0x5a')]=intUtil[_0xcef8('0x5b')](_0x239f9f['remoteUri']);_0x239f9f[_0xcef8('0x5c')]=intUtil['stripTrailingSlash'](_0x239f9f[_0xcef8('0x5c')]);def[_0xcef8('0x5d')]=util[_0xcef8('0x24')]('%s/service/v4_1/rest.php',_0x239f9f[_0xcef8('0x5a')]);if(_0x431f88&&_0x431f88[_0xcef8('0x5f')]){logger['info']('['+_0x46b8f1[_0xcef8('0x7c')][_0xcef8('0x7d')]()+']',_0xcef8('0x60'));_0x46b8f1[_0xcef8('0x61')]=util[_0xcef8('0x24')](_0xcef8('0x62'),_0x239f9f['serverUrl'],_0x46b8f1['uniqueid'],md5(_0x46b8f1[_0xcef8('0x63')]));}else{_0x46b8f1[_0xcef8('0x61')]='';}return getConnection(_0x239f9f)[_0xcef8('0x30')](function(_0x330a20){_0x248018=_0x330a20;if(!_[_0xcef8('0x7e')](_0x57695d)){return getUser(_0x239f9f,_0x57695d[_0xcef8('0xe')],_0x248018);}else{return getUser(_0x239f9f,null,_0x248018);}})[_0xcef8('0x30')](function(_0x37c0fa){_0x17b27c=_0x37c0fa;logger['info'](_0xcef8('0x64'),_0x17b27c['id']);return getEndUser(_0x239f9f,_0x46b8f1['calleridname'],_0x46b8f1[_0xcef8('0x66')],_0x248018);})[_0xcef8('0x30')](function(_0x1cebae){_0xc36825=_0x1cebae;logger[_0xcef8('0x2a')](_0xcef8('0x67'),_0xc36825['id']);return getTicket(_0x239f9f,_0x17b27c,_0xc36825,_0x1ff122,_0x46b8f1,_0x1ff122['Fields'],_0x248018,_0xcef8('0x68'));})[_0xcef8('0x30')](function(_0xd9c62e){_0x1c07d3=_0xd9c62e;logger[_0xcef8('0x2a')](_0xcef8('0x69'));logger['info'](_0xcef8('0x7f'),_0x1c07d3['id']);return setRelationship(_0x248018,_0x17b27c,_0x1c07d3,'users');})[_0xcef8('0x30')](function(){return setRelationship(_0x248018,_0xc36825,_0x1c07d3,'contacts');})['then'](function(){return getServerInfo(_0x248018);})[_0xcef8('0x71')](function(_0x46a47a){logger[_0xcef8('0x72')]('['+_0x46b8f1[_0xcef8('0x7c')]['toUpperCase']()+']',JSON[_0xcef8('0x22')](_0x46a47a));});}; \ No newline at end of file +var _0xe616=['remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','outbound','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','Ticket\x20created!','contacts','trigger:browser:url','error','monitor_format','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','apiKey','toString','get_server_info','isNil','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','type','string','variable','custom_fields','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue'];(function(_0x2da61b,_0xd52a4c){var _0x3e01fc=function(_0x593e34){while(--_0x593e34){_0x2da61b['push'](_0x2da61b['shift']());}};_0x3e01fc(++_0xd52a4c);}(_0xe616,0x194));var _0x6e61=function(_0x4a3dab,_0xe0b63c){_0x4a3dab=_0x4a3dab-0x0;var _0x41dac5=_0xe616[_0x4a3dab];return _0x41dac5;};'use strict';var _=require(_0x6e61('0x0'));var rp=require(_0x6e61('0x1'));var BPromise=require(_0x6e61('0x2'));var md5=require(_0x6e61('0x3'));var util=require(_0x6e61('0x4'));var Redis=require(_0x6e61('0x5'));var intUtil=require('./util');var config=require(_0x6e61('0x6'));var logger=require(_0x6e61('0x7'))(_0x6e61('0x8'));config['redis']=_['defaults'](config[_0x6e61('0x9')],{'host':_0x6e61('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6e61('0x9')]));var def={'method':_0x6e61('0xb'),'json':!![]};function emit(_0x303364,_0x4d4a33,_0x16b0bf){io['to'](_0x303364)[_0x6e61('0xc')](_0x4d4a33,_0x16b0bf);}function getTicket(_0x560933,_0x54da58,_0x25dfc4,_0x4189df,_0x8901a0,_0x58d1b0,_0xe94520,_0x2770ed){logger[_0x6e61('0xd')](_0x6e61('0xe'));var _0x61e1ac=new Date();var _0x450e7e=[{'name':_0x6e61('0xf'),'value':intUtil[_0x6e61('0x10')](_0x4189df[_0x6e61('0x11')],_0x8901a0,'\x20')},{'name':'assigned_user_id','value':_0x54da58['id']},{'name':_0x6e61('0x12'),'value':_0x54da58['id']},{'name':_0x6e61('0x13'),'value':intUtil[_0x6e61('0x10')](_0x4189df[_0x6e61('0x14')],_0x8901a0,'\x0a')},{'name':_0x6e61('0x15'),'value':_0x61e1ac[_0x6e61('0x16')]()[_0x6e61('0x17')](0x0,0x13)[_0x6e61('0x18')]('T','\x20')},{'name':_0x6e61('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x6e61('0x1a'),'value':_0x25dfc4['id']},{'name':_0x6e61('0x1b'),'value':'Contacts'},{'name':_0x6e61('0x1c'),'value':_0x25dfc4[_0x6e61('0xf')]},{'name':_0x6e61('0x1d'),'value':_0x2770ed}];if(_0x58d1b0[_0x6e61('0x1e')]){_[_0x6e61('0x1f')](_0x58d1b0,function(_0x517908){if(_0x8901a0[_0x517908[_0x6e61('0x20')]]){_0x450e7e[_0x6e61('0x21')]({'name':_0x517908[_0x6e61('0x22')],'value':_0x8901a0[_0x517908['variableName']]});}});}return request({'form':{'method':_0x6e61('0x23'),'input_type':_0x6e61('0x24'),'response_type':'JSON','rest_data':JSON[_0x6e61('0x25')]({'session':_0xe94520['id'],'module_name':_0x6e61('0x26'),'name_value_list':_0x450e7e})}});}function getAuth(_0x441862){return util['format']('Basic\x20%s',new Buffer(_0x441862[_0x6e61('0x27')]+':X')[_0x6e61('0x28')]('base64'));}function getServerInfo(_0x985532){return request({'form':{'method':_0x6e61('0x29'),'input_type':_0x6e61('0x24'),'response_type':_0x6e61('0x24'),'rest_data':JSON[_0x6e61('0x25')]({'session':_0x985532['id']})}});}function getUser(_0x5e9a63,_0x56964c,_0x5ecca3){if(!_[_0x6e61('0x2a')](_0x56964c)){logger[_0x6e61('0xd')]('Getting\x20agent\x20with\x20name',_0x56964c);return request({'form':{'method':'get_entry_list','input_type':_0x6e61('0x24'),'response_type':_0x6e61('0x24'),'rest_data':JSON[_0x6e61('0x25')]({'session':_0x5ecca3['id'],'module_name':_0x6e61('0x2b'),'query':util[_0x6e61('0x2c')](_0x6e61('0x2d'),_0x56964c),'order_by':'','offset':'0','select_fields':['id',_0x6e61('0xf'),_0x6e61('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6e61('0x2f')](function(_0xe4e812){if(_0xe4e812[_0x6e61('0x30')][_0x6e61('0x1e')]){var _0xe3d1c3=_[_0x6e61('0x31')](_0xe4e812['entry_list'],function(_0x3f94a2){return _0x3f94a2[_0x6e61('0x32')]['user_name'][_0x6e61('0x33')]===_0x56964c;});if(_0xe3d1c3){logger['info'](_0x6e61('0x34'));return BPromise['resolve']({'id':_0xe3d1c3[_0x6e61('0x32')]['id'][_0x6e61('0x33')],'name':_0xe3d1c3[_0x6e61('0x32')][_0x6e61('0xf')][_0x6e61('0x33')]});}}logger[_0x6e61('0xd')](_0x6e61('0x35'));return BPromise[_0x6e61('0x36')]({'id':_0x5ecca3[_0x6e61('0x32')][_0x6e61('0x37')]['value'],'name':_0x5ecca3['name_value_list'][_0x6e61('0x2e')][_0x6e61('0x33')]});});}else{logger[_0x6e61('0xd')](_0x6e61('0x38'));return BPromise['resolve']({'id':_0x5ecca3[_0x6e61('0x32')][_0x6e61('0x37')]['value'],'name':_0x5ecca3['name_value_list'][_0x6e61('0x2e')]['value']});}}function getEndUser(_0x1c7e03,_0x4b2dc8,_0x473a57,_0x1fb314){logger[_0x6e61('0xd')](_0x6e61('0x39'),_0x473a57);return request({'form':{'method':_0x6e61('0x3a'),'input_type':_0x6e61('0x24'),'response_type':'JSON','rest_data':JSON[_0x6e61('0x25')]({'session':_0x1fb314['id'],'module_name':_0x6e61('0x3b'),'query':util[_0x6e61('0x2c')](_0x6e61('0x3c'),_0x473a57),'order_by':'','offset':'0','select_fields':['id',_0x6e61('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4783be){if(_0x4783be[_0x6e61('0x30')][_0x6e61('0x1e')]){var _0x212bff=_[_0x6e61('0x31')](_0x4783be[_0x6e61('0x30')],function(_0x4b3d0b){return _0x4b3d0b[_0x6e61('0x32')][_0x6e61('0x3d')][_0x6e61('0x33')]===_0x473a57;});if(_0x212bff){logger[_0x6e61('0xd')](_0x6e61('0x3e'));return BPromise[_0x6e61('0x36')]({'id':_0x212bff['name_value_list']['id'][_0x6e61('0x33')],'name':_0x212bff[_0x6e61('0x32')]['name']['value'],'phone':_0x212bff[_0x6e61('0x32')][_0x6e61('0x3d')][_0x6e61('0x33')]});}}else{logger[_0x6e61('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x6e61('0x24'),'response_type':'JSON','rest_data':JSON[_0x6e61('0x25')]({'session':_0x1fb314['id'],'module_name':_0x6e61('0x3b'),'name_value_list':[{'name':_0x6e61('0x3f'),'value':_0x4b2dc8!==_0x6e61('0x40')?_0x4b2dc8:util[_0x6e61('0x2c')]('Caller\x20-\x20%s',_0x473a57)},{'name':'phone_home','value':_0x473a57}]})}})[_0x6e61('0x2f')](function(_0x18c7c3){logger[_0x6e61('0xd')](_0x6e61('0x41'));return BPromise[_0x6e61('0x36')]({'id':_0x18c7c3['id'],'name':_0x18c7c3[_0x6e61('0x30')][_0x6e61('0x3f')][_0x6e61('0x33')],'phone':_0x18c7c3[_0x6e61('0x30')][_0x6e61('0x3d')][_0x6e61('0x33')]});});}});}function request(_0x291cb2){logger[_0x6e61('0x42')](_0x6e61('0x43'),JSON[_0x6e61('0x25')](_0x291cb2));return rp(_[_0x6e61('0x44')](def,_0x291cb2));}function getTags(_0x22fca6,_0x306bda){var _0x1d6175=[];if(_0x22fca6&&_0x22fca6[_0x6e61('0x1e')]>0x0){_0x1d6175=_[_0x6e61('0x45')](_0x22fca6,_0x306bda);}return _0x1d6175;}function getCustomFields(_0x48200b,_0x172f5d){var _0x28196c=[];var _0x1b9411={'custom_fields':[]};if(_0x48200b['length']>0x0){_['forEach'](_0x48200b,function(_0x5cf8a9){if(_0x5cf8a9['type']==='string'&&_0x5cf8a9[_0x6e61('0x46')]&&!_0x5cf8a9[_0x6e61('0x47')]){_0x1b9411[_0x5cf8a9[_0x6e61('0x46')][_0x6e61('0x48')]()]=_0x5cf8a9[_0x6e61('0x49')][_0x6e61('0x28')]();}else if(_0x5cf8a9[_0x6e61('0x4a')]===_0x6e61('0x4b')&&_0x5cf8a9[_0x6e61('0x22')]&&_0x5cf8a9[_0x6e61('0x47')]){_0x1b9411['custom_fields']['push']({'id':_0x5cf8a9[_0x6e61('0x22')],'value':_0x5cf8a9[_0x6e61('0x49')]['toString']()});}else if(_0x5cf8a9['type']===_0x6e61('0x4c')&&_0x5cf8a9['variableName']&&_0x5cf8a9[_0x6e61('0x22')]&&_0x5cf8a9[_0x6e61('0x47')]){_0x172f5d[_0x5cf8a9[_0x6e61('0x20')]]&&_0x1b9411[_0x6e61('0x4d')][_0x6e61('0x21')]({'id':_0x5cf8a9[_0x6e61('0x22')],'value':_0x172f5d[_0x5cf8a9['variableName']][_0x6e61('0x28')]()});}else if(_0x5cf8a9[_0x6e61('0x4a')]===_0x6e61('0x4e')&&_0x5cf8a9[_0x6e61('0x4f')]&&_0x5cf8a9[_0x6e61('0x4f')][_0x6e61('0xf')]&&_0x5cf8a9['idField']&&_0x5cf8a9[_0x6e61('0x47')]){_0x172f5d[_0x5cf8a9['Variable']['name'][_0x6e61('0x48')]()]&&_0x1b9411[_0x6e61('0x4d')][_0x6e61('0x21')]({'id':_0x5cf8a9['idField'],'value':_0x172f5d[_0x5cf8a9[_0x6e61('0x4f')][_0x6e61('0xf')]['toLowerCase']()][_0x6e61('0x28')]()});}});}return _0x1b9411;}function getConnection(_0x51dd59){return request({'method':'POST','form':{'method':_0x6e61('0x50'),'input_type':_0x6e61('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x51dd59['username'],'password':_0x51dd59[_0x6e61('0x51')],'encryption':_0x6e61('0x52')},'application':_0x6e61('0x53')})}})['then'](function(_0x3d61cd){var _0x407cbe=_0x3d61cd;if(_0x407cbe['id']){def[_0x6e61('0x54')]=_0x407cbe['id'];return BPromise[_0x6e61('0x36')](_0x407cbe);}else{throw new Error(util[_0x6e61('0x2c')](_0x6e61('0x55'),_0x51dd59['id']));}});}function setRelationship(_0x52b6df,_0x180910,_0x38a1db,_0x5d6242){return request({'form':{'method':_0x6e61('0x56'),'input_type':'JSON','response_type':_0x6e61('0x24'),'rest_data':JSON[_0x6e61('0x25')]({'session':_0x52b6df['id'],'module_name':'Calls','module_id':_0x38a1db['id'],'link_field_name':_0x5d6242,'related_ids':[_0x180910['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6e61('0x57')]=function(_0xc43111,_0x44e388,_0x44bbe0,_0x484837,_0x40cda9,_0x159a99){var _0x44c28f,_0x5e3c74,_0xc78eea,_0x3bb4e2;_0x159a99[_0x6e61('0x58')]=intUtil['stripTrailingSlash'](_0x159a99['remoteUri']);_0x159a99['serverUrl']=intUtil[_0x6e61('0x59')](_0x159a99['serverUrl']);def[_0x6e61('0x5a')]=util[_0x6e61('0x2c')](_0x6e61('0x5b'),_0x159a99['remoteUri']);if(_0x40cda9&&_0x40cda9['monitor_format']){logger[_0x6e61('0xd')](_0x6e61('0x5c'),_0x6e61('0x5d'));_0x44e388['recordingURL']=util['format'](_0x6e61('0x5e'),_0x159a99[_0x6e61('0x5f')],_0x44e388[_0x6e61('0x60')],md5(_0x44e388[_0x6e61('0x60')]));}else{_0x44e388['recordingURL']='';}return getConnection(_0x159a99)[_0x6e61('0x2f')](function(_0x175420){_0x3bb4e2=_0x175420;return getUser(_0x159a99,_0x484837[_0x6e61('0xf')],_0x3bb4e2);})[_0x6e61('0x2f')](function(_0x366348){_0x44c28f=_0x366348;logger[_0x6e61('0xd')](_0x6e61('0x61'),_0x44c28f['id']);return getEndUser(_0x159a99,_0x44e388[_0x6e61('0x62')],_0x44e388[_0x6e61('0x63')],_0x3bb4e2);})[_0x6e61('0x2f')](function(_0x18e8d1){_0x5e3c74=_0x18e8d1;logger[_0x6e61('0xd')]('The\x20Enduser\x20ID\x20is:',_0x5e3c74['id']);return getTicket(_0x159a99,_0x44c28f,_0x5e3c74,_0x44bbe0,_0x44e388,_0x44bbe0[_0x6e61('0x64')],_0x3bb4e2,'Inbound');})[_0x6e61('0x2f')](function(_0x2aa820){_0xc78eea=_0x2aa820;logger[_0x6e61('0xd')]('Ticket\x20created!');logger[_0x6e61('0xd')](_0x6e61('0x65'),_0xc78eea['id']);return setRelationship(_0x3bb4e2,_0x44c28f,_0xc78eea,_0x6e61('0x66'));})[_0x6e61('0x2f')](function(){return setRelationship(_0x3bb4e2,_0x5e3c74,_0xc78eea,'contacts');})['then'](function(){return getServerInfo(_0x3bb4e2);})[_0x6e61('0x2f')](function(_0xa7bec4){var _0x599b4f=parseInt(_0xa7bec4[_0x6e61('0x67')][_0x6e61('0x68')](0x0));var _0x53b201=util[_0x6e61('0x2c')](_0x6e61('0x69'),_0x159a99['remoteUri'],_0xc78eea['id']);if(_0x599b4f>0x6){_0x53b201=util[_0x6e61('0x2c')](_0x6e61('0x6a'),_0x159a99[_0x6e61('0x58')],_0xc78eea['id']);}logger[_0x6e61('0xd')](_0x6e61('0x5c'),_0x6e61('0x6b'));emit(util[_0x6e61('0x2c')]('user:%s',_0x484837[_0x6e61('0xf')]),'trigger:browser:url',{'uri':_0x53b201});})[_0x6e61('0x6c')](function(_0x50c7af){logger['error'](_0x6e61('0x5c'),JSON[_0x6e61('0x25')](_0x50c7af));});};exports[_0x6e61('0x6d')]=function(_0x720ed6,_0x4c5ab4,_0x5dd909,_0x41017d,_0x184069,_0x4ba649,_0x3b6d84){var _0x111c24,_0x57946b,_0x577f6c,_0x30dbd6;_0x4ba649[_0x6e61('0x58')]=intUtil[_0x6e61('0x59')](_0x4ba649[_0x6e61('0x58')]);_0x4ba649['serverUrl']=intUtil[_0x6e61('0x59')](_0x4ba649[_0x6e61('0x5f')]);def[_0x6e61('0x5a')]=util['format'](_0x6e61('0x5b'),_0x4ba649[_0x6e61('0x58')]);if(_0x3b6d84&&_0x3b6d84[_0x6e61('0x6e')]&&_0x3b6d84['recordingFormat']!=='none'){logger[_0x6e61('0xd')](_0x6e61('0x6f'),'Recording\x20is\x20enabled!');_0x4c5ab4[_0x6e61('0x70')]=util[_0x6e61('0x2c')](_0x6e61('0x5e'),_0x4ba649[_0x6e61('0x5f')],_0x4c5ab4[_0x6e61('0x60')],md5(_0x4c5ab4[_0x6e61('0x60')]));}return getConnection(_0x4ba649)[_0x6e61('0x2f')](function(_0x5a397d){_0x30dbd6=_0x5a397d;return getUser(_0x4ba649,_0x41017d['name'],_0x30dbd6);})[_0x6e61('0x2f')](function(_0x4f6e40){_0x111c24=_0x4f6e40;logger[_0x6e61('0xd')](_0x6e61('0x61'),_0x111c24['id']);return getEndUser(_0x4ba649,_0x4c5ab4[_0x6e61('0x71')],_0x4c5ab4[_0x6e61('0x72')],_0x30dbd6);})['then'](function(_0x43791f){_0x57946b=_0x43791f;logger[_0x6e61('0xd')]('The\x20Enduser\x20ID\x20is:',_0x57946b['id']);return getTicket(_0x4ba649,_0x111c24,_0x57946b,_0x5dd909,_0x4c5ab4,_0x5dd909[_0x6e61('0x64')],_0x30dbd6,'Outbound');})[_0x6e61('0x2f')](function(_0x571b5c){_0x577f6c=_0x571b5c;logger[_0x6e61('0xd')](_0x6e61('0x73'));logger['info'](_0x6e61('0x65'),_0x577f6c['id']);return setRelationship(_0x30dbd6,_0x111c24,_0x577f6c,_0x6e61('0x66'));})[_0x6e61('0x2f')](function(){return setRelationship(_0x30dbd6,_0x57946b,_0x577f6c,_0x6e61('0x74'));})[_0x6e61('0x2f')](function(){return getServerInfo(_0x30dbd6);})[_0x6e61('0x2f')](function(_0x2ab9f4){var _0x1c47a0=parseInt(_0x2ab9f4[_0x6e61('0x67')]['charAt'](0x0));var _0x45ba10=util['format'](_0x6e61('0x69'),_0x4ba649[_0x6e61('0x58')],_0x577f6c['id']);if(_0x1c47a0>0x6){_0x45ba10=util['format'](_0x6e61('0x6a'),_0x4ba649[_0x6e61('0x58')],_0x577f6c['id']);}logger['info'](_0x6e61('0x6f'),_0x6e61('0x6b'));emit(util[_0x6e61('0x2c')]('user:%s',_0x41017d[_0x6e61('0xf')]),_0x6e61('0x75'),{'uri':_0x45ba10});})[_0x6e61('0x6c')](function(_0x480578){logger[_0x6e61('0x76')](_0x6e61('0x6f'),JSON[_0x6e61('0x25')](_0x480578));});};exports['unmanaged']=function(_0xaeeeec,_0x7325c1,_0x299dfd,_0x3dc2e1,_0x39bcea,_0x38b647){var _0x146009,_0x35bd4a,_0x233c38,_0x591efc;_0x38b647[_0x6e61('0x58')]=intUtil[_0x6e61('0x59')](_0x38b647['remoteUri']);_0x38b647[_0x6e61('0x5f')]=intUtil[_0x6e61('0x59')](_0x38b647[_0x6e61('0x5f')]);def[_0x6e61('0x5a')]=util[_0x6e61('0x2c')](_0x6e61('0x5b'),_0x38b647['remoteUri']);if(_0x39bcea&&_0x39bcea[_0x6e61('0x77')]){logger[_0x6e61('0xd')]('['+_0x7325c1[_0x6e61('0x78')][_0x6e61('0x79')]()+']','Recording\x20is\x20enabled!');_0x7325c1[_0x6e61('0x70')]=util['format'](_0x6e61('0x5e'),_0x38b647[_0x6e61('0x5f')],_0x7325c1[_0x6e61('0x60')],md5(_0x7325c1[_0x6e61('0x60')]));}else{_0x7325c1[_0x6e61('0x70')]='';}return getConnection(_0x38b647)[_0x6e61('0x2f')](function(_0x2b521b){_0x591efc=_0x2b521b;if(!_['isNil'](_0x3dc2e1)){return getUser(_0x38b647,_0x3dc2e1['name'],_0x591efc);}else{return getUser(_0x38b647,null,_0x591efc);}})[_0x6e61('0x2f')](function(_0x2c5b15){_0x146009=_0x2c5b15;logger[_0x6e61('0xd')](_0x6e61('0x61'),_0x146009['id']);return getEndUser(_0x38b647,_0x7325c1[_0x6e61('0x62')],_0x7325c1[_0x6e61('0x63')],_0x591efc);})[_0x6e61('0x2f')](function(_0xb7d2c9){_0x35bd4a=_0xb7d2c9;logger[_0x6e61('0xd')](_0x6e61('0x7a'),_0x35bd4a['id']);return getTicket(_0x38b647,_0x146009,_0x35bd4a,_0x299dfd,_0x7325c1,_0x299dfd['Fields'],_0x591efc,'Inbound');})[_0x6e61('0x2f')](function(_0x1ec564){_0x233c38=_0x1ec564;logger[_0x6e61('0xd')]('Ticket\x20created!');logger['info'](_0x6e61('0x65'),_0x233c38['id']);return setRelationship(_0x591efc,_0x146009,_0x233c38,_0x6e61('0x66'));})[_0x6e61('0x2f')](function(){return setRelationship(_0x591efc,_0x35bd4a,_0x233c38,'contacts');})['then'](function(){return getServerInfo(_0x591efc);})[_0x6e61('0x6c')](function(_0x11b8a5){logger[_0x6e61('0x76')]('['+_0x7325c1[_0x6e61('0x78')]['toUpperCase']()+']',JSON[_0x6e61('0x25')](_0x11b8a5));});}; \ 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 1381f0d..9e067fc 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 _0x7c1b=['keyValue','format','%s:\x20%s','key','keyContent','keyType','join','slice','substring','lastIndexOf','isNil','test','lodash','util','getString','length','sortBy','type','push','variable','variableName','toString','Variable','name','toLowerCase'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x7c1b,0x16a));var _0xb7c1=function(_0x29dfb1,_0x4f2272){_0x29dfb1=_0x29dfb1-0x0;var _0x3b2b5c=_0x7c1b[_0x29dfb1];return _0x3b2b5c;};'use strict';var _=require(_0xb7c1('0x0'));var util=require(_0xb7c1('0x1'));exports[_0xb7c1('0x2')]=function(_0xd2fd20,_0x59d597,_0x361103){var _0x2756a4=[];if(_0xd2fd20[_0xb7c1('0x3')]>0x0){var _0xc2e4e0=_[_0xb7c1('0x4')](_0xd2fd20,['id']);for(var _0x84e6d5=0x0;_0x84e6d5<_0xc2e4e0[_0xb7c1('0x3')];_0x84e6d5++){var _0x16a979=_0xc2e4e0[_0x84e6d5];if(_0x16a979[_0xb7c1('0x5')]==='string'){_0x2756a4[_0xb7c1('0x6')](_0x16a979['content']);}else if(_0x16a979[_0xb7c1('0x5')]===_0xb7c1('0x7')&&_0x16a979[_0xb7c1('0x8')]){_0x59d597[_0x16a979[_0xb7c1('0x8')]]&&_0x2756a4[_0xb7c1('0x6')](_0x59d597[_0x16a979['variableName']][_0xb7c1('0x9')]());}else if(_0x16a979[_0xb7c1('0x5')]==='customVariable'&&_0x16a979['Variable']&&_0x16a979[_0xb7c1('0xa')][_0xb7c1('0xb')]){_0x59d597[_0x16a979[_0xb7c1('0xa')][_0xb7c1('0xb')][_0xb7c1('0xc')]()]&&_0x2756a4['push'](_0x59d597[_0x16a979[_0xb7c1('0xa')][_0xb7c1('0xb')][_0xb7c1('0xc')]()][_0xb7c1('0x9')]());}else if(_0x16a979[_0xb7c1('0x5')]===_0xb7c1('0xd')){if(_0x16a979['keyType']==='string'&&_0x16a979['key']){_0x2756a4[_0xb7c1('0x6')](util[_0xb7c1('0xe')](_0xb7c1('0xf'),_0x16a979[_0xb7c1('0x10')],_0x16a979[_0xb7c1('0x11')]));}else if(_0x16a979[_0xb7c1('0x12')]===_0xb7c1('0x7')&&_0x16a979[_0xb7c1('0x8')]&&_0x16a979['key']){_0x59d597[_0x16a979[_0xb7c1('0x8')]]&&_0x2756a4[_0xb7c1('0x6')](util[_0xb7c1('0xe')](_0xb7c1('0xf'),_0x16a979['key'],_0x59d597[_0x16a979['variableName']]));}else if(_0x16a979[_0xb7c1('0x12')]==='customVariable'&&_0x16a979[_0xb7c1('0xa')]&&_0x16a979[_0xb7c1('0xa')][_0xb7c1('0xb')]&&_0x16a979[_0xb7c1('0x10')]){_0x59d597[_0x16a979[_0xb7c1('0xa')][_0xb7c1('0xb')]['toLowerCase']()]&&_0x2756a4['push'](util[_0xb7c1('0xe')](_0xb7c1('0xf'),_0x16a979[_0xb7c1('0x10')],_0x59d597[_0x16a979['Variable']['name'][_0xb7c1('0xc')]()]));}}}}return _0x2756a4[_0xb7c1('0x13')](_0x361103);};exports['stripTrailingSlash']=function(_0x56c083){var _0x25039b=_0x56c083[_0xb7c1('0x14')](-0x1);if(_0x25039b==='/'){_0x56c083=_0x56c083[_0xb7c1('0x15')](0x0,_0x56c083[_0xb7c1('0x16')](_0x25039b));}return _0x56c083;};exports['validateEmail']=function(_0x3d6748){if(!_[_0xb7c1('0x17')](_0x3d6748)&&_0x3d6748!==''){var _0x5ad42d=/^(([^<>()\[\]\\.,;:\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 _0x5ad42d[_0xb7c1('0x18')](String(_0x3d6748)[_0xb7c1('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x227d=['push','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type'];(function(_0x574f9e,_0x25a52e){var _0x6fe996=function(_0x31c62a){while(--_0x31c62a){_0x574f9e['push'](_0x574f9e['shift']());}};_0x6fe996(++_0x25a52e);}(_0x227d,0x86));var _0xd227=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0x227d[_0x478c8a];return _0x3b6b3e;};'use strict';var _=require(_0xd227('0x0'));var util=require(_0xd227('0x1'));exports[_0xd227('0x2')]=function(_0x465eea,_0x190a19,_0x1d09fb){var _0x1e78d3=[];if(_0x465eea[_0xd227('0x3')]>0x0){var _0x5af2ac=_[_0xd227('0x4')](_0x465eea,['id']);for(var _0x1ec7f2=0x0;_0x1ec7f2<_0x5af2ac[_0xd227('0x3')];_0x1ec7f2++){var _0x5ee977=_0x5af2ac[_0x1ec7f2];if(_0x5ee977[_0xd227('0x5')]==='string'){_0x1e78d3[_0xd227('0x6')](_0x5ee977['content']);}else if(_0x5ee977['type']===_0xd227('0x7')&&_0x5ee977[_0xd227('0x8')]){_0x190a19[_0x5ee977[_0xd227('0x8')]]&&_0x1e78d3[_0xd227('0x6')](_0x190a19[_0x5ee977['variableName']]['toString']());}else if(_0x5ee977['type']===_0xd227('0x9')&&_0x5ee977[_0xd227('0xa')]&&_0x5ee977[_0xd227('0xa')]['name']){_0x190a19[_0x5ee977[_0xd227('0xa')][_0xd227('0xb')][_0xd227('0xc')]()]&&_0x1e78d3[_0xd227('0x6')](_0x190a19[_0x5ee977[_0xd227('0xa')][_0xd227('0xb')][_0xd227('0xc')]()][_0xd227('0xd')]());}else if(_0x5ee977[_0xd227('0x5')]===_0xd227('0xe')){if(_0x5ee977[_0xd227('0xf')]===_0xd227('0x10')&&_0x5ee977[_0xd227('0x11')]){_0x1e78d3[_0xd227('0x6')](util[_0xd227('0x12')](_0xd227('0x13'),_0x5ee977['key'],_0x5ee977[_0xd227('0x14')]));}else if(_0x5ee977[_0xd227('0xf')]===_0xd227('0x7')&&_0x5ee977[_0xd227('0x8')]&&_0x5ee977[_0xd227('0x11')]){_0x190a19[_0x5ee977[_0xd227('0x8')]]&&_0x1e78d3[_0xd227('0x6')](util[_0xd227('0x12')]('%s:\x20%s',_0x5ee977[_0xd227('0x11')],_0x190a19[_0x5ee977['variableName']]));}else if(_0x5ee977['keyType']===_0xd227('0x9')&&_0x5ee977['Variable']&&_0x5ee977[_0xd227('0xa')]['name']&&_0x5ee977['key']){_0x190a19[_0x5ee977[_0xd227('0xa')][_0xd227('0xb')][_0xd227('0xc')]()]&&_0x1e78d3[_0xd227('0x6')](util['format'](_0xd227('0x13'),_0x5ee977['key'],_0x190a19[_0x5ee977[_0xd227('0xa')][_0xd227('0xb')][_0xd227('0xc')]()]));}}}}return _0x1e78d3[_0xd227('0x15')](_0x1d09fb);};exports[_0xd227('0x16')]=function(_0x40d43b){var _0x5f4cd1=_0x40d43b['slice'](-0x1);if(_0x5f4cd1==='/'){_0x40d43b=_0x40d43b[_0xd227('0x17')](0x0,_0x40d43b[_0xd227('0x18')](_0x5f4cd1));}return _0x40d43b;};exports[_0xd227('0x19')]=function(_0x4656e0){if(!_[_0xd227('0x1a')](_0x4656e0)&&_0x4656e0!==''){var _0x2c06f1=/^(([^<>()\[\]\\.,;:\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 _0x2c06f1[_0xd227('0x1b')](String(_0x4656e0)[_0xd227('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 2235132..3078065 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 5572b09..f33e3ab 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 _0x7258=['socket.io-emitter','emit','application/json','format','POST','merge','Tags','name','Subjects','getString','Descriptions','then','info','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','GET','map','forEach','includes','string','type','nameField','toLowerCase','picklist','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','recordingURL','uniqueid','destcalleridname','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format','lastevent','toUpperCase','calleridnum','catch','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults'];(function(_0x405513,_0x51d4c5){var _0x4a61ab=function(_0x1eb2db){while(--_0x1eb2db){_0x405513['push'](_0x405513['shift']());}};_0x4a61ab(++_0x51d4c5);}(_0x7258,0x19f));var _0x8725=function(_0x5efeb0,_0x1c6333){_0x5efeb0=_0x5efeb0-0x0;var _0x4bd545=_0x7258[_0x5efeb0];return _0x4bd545;};'use strict';var _=require('lodash');var rp=require(_0x8725('0x0'));var md5=require(_0x8725('0x1'));var util=require(_0x8725('0x2'));var Redis=require(_0x8725('0x3'));var intUtil=require(_0x8725('0x4'));var config=require(_0x8725('0x5'));var logger=require(_0x8725('0x6'))(_0x8725('0x7'));config['redis']=_[_0x8725('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8725('0x9'))(new Redis(config['redis']));function emit(_0x17bc07,_0x3077df,_0x3af567){io['to'](_0x17bc07)[_0x8725('0xa')](_0x3077df,_0x3af567);}var headers={'Content-Type':_0x8725('0xb'),'Accept':_0x8725('0xb')};function getTicket(_0x4179b8,_0x982383,_0x56cb29,_0x39ba22,_0x3f180f){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x8725('0xc')]('%s/tickets.json',_0x4179b8['remoteUri']),'method':_0x8725('0xd'),'body':{'ticket':_[_0x8725('0xe')]({'requester_id':_0x56cb29['id'],'submitter_id':_0x982383?_0x982383['id']:undefined,'assignee_id':_0x982383?_0x982383['id']:undefined,'tags':getTags(_0x39ba22[_0x8725('0xf')],_0x8725('0x10')),'subject':intUtil['getString'](_0x39ba22[_0x8725('0x11')],_0x3f180f,'\x20'),'description':intUtil[_0x8725('0x12')](_0x39ba22[_0x8725('0x13')],_0x3f180f,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8725('0x12')](_0x39ba22[_0x8725('0x13')],_0x3f180f,'\x0a')}},getCustomFields(_0x39ba22['Fields'],_0x3f180f))}})[_0x8725('0x14')](function(_0x36613e){logger[_0x8725('0x15')](_0x8725('0x16'));return _0x36613e['ticket'];});}function getUser(_0x178d77,_0x2ff098){if(intUtil[_0x8725('0x17')](_0x2ff098)){logger['info'](_0x8725('0x18'),_0x2ff098);return request({'uri':util[_0x8725('0xc')](_0x8725('0x19'),_0x178d77[_0x8725('0x1a')]),'qs':{'query':util[_0x8725('0xc')](_0x8725('0x1b'),_0x2ff098)}})[_0x8725('0x14')](function(_0x22bc78){if(_0x22bc78['count']){logger[_0x8725('0x15')](_0x8725('0x1c'));return _[_0x8725('0x1d')](_0x22bc78[_0x8725('0x1e')],{'email':_0x2ff098,'role':_0x8725('0x1f')});}else{logger['info'](_0x8725('0x20'));return request({'uri':util['format'](_0x8725('0x21'),_0x178d77[_0x8725('0x1a')])})[_0x8725('0x14')](function(_0x125ba3){logger[_0x8725('0x15')](_0x8725('0x22'));return _0x125ba3['user'];});}});}else{logger[_0x8725('0x15')](_0x8725('0x20'));return request({'uri':util[_0x8725('0xc')](_0x8725('0x21'),_0x178d77['remoteUri'])})[_0x8725('0x14')](function(_0x18af47){logger[_0x8725('0x15')](_0x8725('0x22'));return _0x18af47[_0x8725('0x23')];});}}function getEndUser(_0x554447,_0x1b3f75,_0x5aef20){logger[_0x8725('0x15')](_0x8725('0x24'),_0x5aef20);return request({'uri':util[_0x8725('0xc')](_0x8725('0x19'),_0x554447[_0x8725('0x1a')]),'qs':{'query':util[_0x8725('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x5aef20)}})['then'](function(_0x1049d3){var _0x232987;if(_0x1049d3[_0x8725('0x1e')]['length']){_0x1049d3[_0x8725('0x1e')]=_[_0x8725('0x25')](_0x1049d3[_0x8725('0x1e')],{'suspended':![],'role':_0x8725('0x26')});if(_0x1049d3[_0x8725('0x1e')][_0x8725('0x27')]){_0x232987=_['first'](_0x1049d3[_0x8725('0x1e')]);}}if(_0x232987){logger['info']('Enduser\x20found!');return _0x232987;}else{logger[_0x8725('0x15')](_0x8725('0x28'));return request({'uri':util[_0x8725('0xc')](_0x8725('0x29'),_0x554447[_0x8725('0x1a')]),'method':_0x8725('0xd'),'body':{'user':{'role':_0x8725('0x26'),'name':util['format'](_0x8725('0x2a'),_0x1b3f75||_0x5aef20),'phone':_0x5aef20}}})[_0x8725('0x14')](function(_0x43ce4e){logger[_0x8725('0x15')]('Enduser\x20created.');return _0x43ce4e[_0x8725('0x23')];});}});}function getAuth(_0x28ce96){var _0x5d4f02;if(_0x28ce96[_0x8725('0x2b')]===_0x8725('0x2c')){_0x5d4f02=util[_0x8725('0xc')](_0x8725('0x2d'),_0x28ce96[_0x8725('0x2e')],_0x28ce96[_0x8725('0x2c')]);}else if(_0x28ce96[_0x8725('0x2b')]===_0x8725('0x2f')){_0x5d4f02=util['format'](_0x8725('0x30'),_0x28ce96[_0x8725('0x2e')],_0x28ce96[_0x8725('0x2f')]);}return util[_0x8725('0xc')](_0x8725('0x31'),new Buffer(_0x5d4f02)[_0x8725('0x32')](_0x8725('0x33')));}function request(_0x4c4ae0){logger[_0x8725('0x34')]('[HTTP]',JSON['stringify'](_0x4c4ae0));return rp(_['defaults'](_0x4c4ae0,{'method':_0x8725('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x5b374d,_0x5a6249){var _0x321eca=[];if(_0x5b374d&&_0x5b374d[_0x8725('0x27')]>0x0){_0x321eca=_[_0x8725('0x36')](_0x5b374d,_0x5a6249);}return _0x321eca;}function getCustomFields(_0x55c950,_0x4636f2){var _0x338725=[];var _0x4819a2={'custom_fields':[]};if(_0x55c950['length']>0x0){_[_0x8725('0x37')](_0x55c950,function(_0x59149b){if(_[_0x8725('0x38')]([_0x8725('0x39'),'picklist'],_0x59149b[_0x8725('0x3a')])&&_0x59149b[_0x8725('0x3b')]&&!_0x59149b['customField']){_0x4819a2[_0x59149b['nameField'][_0x8725('0x3c')]()]=_0x59149b['content']['toString']();}else if(_['includes']([_0x8725('0x39'),_0x8725('0x3d')],_0x59149b[_0x8725('0x3a')])&&_0x59149b[_0x8725('0x3e')]&&_0x59149b[_0x8725('0x3f')]){_0x4819a2[_0x8725('0x40')][_0x8725('0x41')]({'id':_0x59149b[_0x8725('0x3e')],'value':_0x59149b['content'][_0x8725('0x32')]()});}else if(_0x59149b[_0x8725('0x3a')]===_0x8725('0x42')&&_0x59149b[_0x8725('0x43')]&&_0x59149b['idField']&&_0x59149b[_0x8725('0x3f')]){_0x4636f2[_0x59149b[_0x8725('0x43')]]&&_0x4819a2[_0x8725('0x40')][_0x8725('0x41')]({'id':_0x59149b[_0x8725('0x3e')],'value':_0x4636f2[_0x59149b['variableName']][_0x8725('0x32')]()});}else if(_0x59149b['type']===_0x8725('0x44')&&_0x59149b[_0x8725('0x45')]&&_0x59149b[_0x8725('0x45')][_0x8725('0x10')]&&_0x59149b[_0x8725('0x3e')]&&_0x59149b[_0x8725('0x3f')]){_0x4636f2[_0x59149b['Variable'][_0x8725('0x10')][_0x8725('0x3c')]()]&&_0x4819a2[_0x8725('0x40')][_0x8725('0x41')]({'id':_0x59149b[_0x8725('0x3e')],'value':_0x4636f2[_0x59149b[_0x8725('0x45')]['name']['toLowerCase']()][_0x8725('0x32')]()});}});}return _0x4819a2;}exports['queue']=function(_0x2be272,_0x215083,_0x4aab58,_0x467094,_0x3033d7,_0x5710ce){var _0x1b270a,_0x216112;_0x5710ce['remoteUri']=intUtil[_0x8725('0x46')](_0x5710ce['remoteUri']);_0x5710ce['serverUrl']=intUtil[_0x8725('0x46')](_0x5710ce[_0x8725('0x47')]);if(_0x3033d7&&_0x3033d7['monitor_format']){logger[_0x8725('0x15')]('[QUEUE]',_0x8725('0x48'));_0x215083['recordingURL']=util[_0x8725('0xc')](_0x8725('0x49'),_0x5710ce[_0x8725('0x47')],_0x215083['uniqueid'],md5(_0x215083['uniqueid']));}else{_0x215083['recordingURL']='';}headers[_0x8725('0x4a')]=getAuth(_0x5710ce);return getUser(_0x5710ce,_0x467094[_0x8725('0x4b')])[_0x8725('0x14')](function(_0x3bb3b2){_0x1b270a=_0x3bb3b2;logger[_0x8725('0x15')](_0x8725('0x4c'),_0x1b270a['id']);return getEndUser(_0x5710ce,_0x215083[_0x8725('0x4d')],_0x215083['calleridnum']);})[_0x8725('0x14')](function(_0x512479){_0x216112=_0x512479;logger[_0x8725('0x15')](_0x8725('0x4e'),_0x216112['id']);return getTicket(_0x5710ce,_0x1b270a,_0x216112,_0x4aab58,_0x215083);})[_0x8725('0x14')](function(_0x639c85){if(_0x639c85){logger[_0x8725('0x15')](_0x8725('0x4f'),_0x639c85['id']);switch(_0x5710ce[_0x8725('0x3a')]){case'integrationTab':logger[_0x8725('0x15')](_0x8725('0x50'),_0x8725('0x51'));return request({'uri':util[_0x8725('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5710ce[_0x8725('0x1a')],_0x1b270a['id'],_0x639c85['id']),'method':_0x8725('0xd')});case'newTab':logger[_0x8725('0x15')](_0x8725('0x50'),_0x8725('0x52'));emit(util[_0x8725('0xc')](_0x8725('0x53'),_0x467094[_0x8725('0x10')]),_0x8725('0x54'),{'uri':util[_0x8725('0xc')](_0x8725('0x55'),_0x5710ce[_0x8725('0x1a')][_0x8725('0x56')]('/api/v2',''),_0x639c85['id'])});break;default:logger[_0x8725('0x57')]('[QUEUE]',_0x8725('0x58'));}}})['catch'](function(_0x192cd5){logger[_0x8725('0x57')](_0x8725('0x59'),util[_0x8725('0x5a')](_0x192cd5,{'showHidden':!![],'depth':null}));});};exports[_0x8725('0x5b')]=function(_0x12a77e,_0x330266,_0x15f52d,_0x1f80fa,_0x24259d,_0x1af913,_0x3e0fac){var _0x48a437,_0x46c5cb;_0x1af913['remoteUri']=intUtil['stripTrailingSlash'](_0x1af913[_0x8725('0x1a')]);_0x1af913[_0x8725('0x47')]=intUtil['stripTrailingSlash'](_0x1af913[_0x8725('0x47')]);if(_0x3e0fac&&_0x3e0fac[_0x8725('0x5c')]&&_0x3e0fac[_0x8725('0x5c')]!=='none'){logger['info'](_0x8725('0x5d'),_0x8725('0x48'));_0x330266[_0x8725('0x5e')]=util[_0x8725('0xc')](_0x8725('0x49'),_0x1af913['serverUrl'],_0x330266[_0x8725('0x5f')],md5(_0x330266['uniqueid']));}headers[_0x8725('0x4a')]=getAuth(_0x1af913);return getUser(_0x1af913,_0x1f80fa[_0x8725('0x4b')])[_0x8725('0x14')](function(_0x116c77){_0x48a437=_0x116c77;logger[_0x8725('0x15')]('The\x20User\x20ID\x20is:',_0x48a437['id']);return getEndUser(_0x1af913,_0x330266[_0x8725('0x60')],_0x330266['destcalleridnum']);})[_0x8725('0x14')](function(_0x51d67a){_0x46c5cb=_0x51d67a;logger[_0x8725('0x15')]('The\x20Enduser\x20ID\x20is:',_0x46c5cb['id']);return getTicket(_0x1af913,_0x48a437,_0x46c5cb,_0x15f52d,_0x330266);})[_0x8725('0x14')](function(_0x239243){if(_0x239243){logger[_0x8725('0x15')](_0x8725('0x4f'),_0x239243['id']);switch(_0x1af913['type']){case _0x8725('0x61'):logger['info']('[OUTBOUND]',_0x8725('0x51'));return request({'uri':util[_0x8725('0xc')](_0x8725('0x62'),_0x1af913['remoteUri'],_0x48a437['id'],_0x239243['id']),'method':'POST'});case'newTab':logger[_0x8725('0x15')](_0x8725('0x5d'),_0x8725('0x52'));emit(util[_0x8725('0xc')](_0x8725('0x53'),_0x1f80fa[_0x8725('0x10')]),_0x8725('0x54'),{'uri':util[_0x8725('0xc')](_0x8725('0x55'),_0x1af913['remoteUri'][_0x8725('0x56')](_0x8725('0x63'),''),_0x239243['id'])});break;default:logger[_0x8725('0x57')](_0x8725('0x5d'),_0x8725('0x58'));}}})['catch'](function(_0x543b7e){logger[_0x8725('0x57')](_0x8725('0x64'),util[_0x8725('0x5a')](_0x543b7e,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1970fe,_0x35bffc,_0x2b9721,_0x2160bf,_0x1a2015,_0x4bc17c){var _0x25a2ce,_0x1e598b;_0x4bc17c[_0x8725('0x1a')]=intUtil[_0x8725('0x46')](_0x4bc17c[_0x8725('0x1a')]);_0x4bc17c['serverUrl']=intUtil[_0x8725('0x46')](_0x4bc17c[_0x8725('0x47')]);if(_0x1a2015&&_0x1a2015[_0x8725('0x65')]){logger[_0x8725('0x15')]('['+_0x35bffc[_0x8725('0x66')][_0x8725('0x67')]()+']',_0x8725('0x48'));_0x35bffc[_0x8725('0x5e')]=util[_0x8725('0xc')](_0x8725('0x49'),_0x4bc17c[_0x8725('0x47')],_0x35bffc[_0x8725('0x5f')],md5(_0x35bffc[_0x8725('0x5f')]));}else{_0x35bffc[_0x8725('0x5e')]='';}headers[_0x8725('0x4a')]=getAuth(_0x4bc17c);return getUser(_0x4bc17c)['then'](function(_0x2dc803){_0x25a2ce=_0x2dc803;logger[_0x8725('0x15')](_0x8725('0x4c'),_0x25a2ce['id']);return getEndUser(_0x4bc17c,_0x35bffc[_0x8725('0x4d')],_0x35bffc[_0x8725('0x68')]);})[_0x8725('0x14')](function(_0x589f6c){_0x1e598b=_0x589f6c;logger[_0x8725('0x15')](_0x8725('0x4e'),_0x1e598b['id']);return getTicket(_0x4bc17c,_0x25a2ce,_0x1e598b,_0x2b9721,_0x35bffc);})[_0x8725('0x14')](function(_0x3ecdca){if(_0x3ecdca){logger[_0x8725('0x15')](_0x8725('0x4f'),_0x3ecdca['id']);}})[_0x8725('0x69')](function(_0x1b12ac){logger[_0x8725('0x57')]('['+_0x35bffc[_0x8725('0x66')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x8725('0x5a')](_0x1b12ac,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9d3b=['%s:%s','username','authType','token','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','forEach','includes','picklist','type','customField','nameField','toLowerCase','content','toString','string','idField','custom_fields','push','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','calleridname','calleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','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!','Admin\x20account\x20selected.','%s/users/me.json','type:user\x20role:end-user\x20phone:%s','length','results','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','user','password'];(function(_0x3cb4ea,_0x1be099){var _0xa64c17=function(_0xd1d57b){while(--_0xd1d57b){_0x3cb4ea['push'](_0x3cb4ea['shift']());}};_0xa64c17(++_0x1be099);}(_0x9d3b,0xaf));var _0xb9d3=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x9d3b[_0x238671];return _0x474844;};'use strict';var _=require(_0xb9d3('0x0'));var rp=require(_0xb9d3('0x1'));var md5=require(_0xb9d3('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xb9d3('0x3'));var config=require(_0xb9d3('0x4'));var logger=require(_0xb9d3('0x5'))(_0xb9d3('0x6'));config[_0xb9d3('0x7')]=_[_0xb9d3('0x8')](config['redis'],{'host':_0xb9d3('0x9'),'port':0x18eb});var io=require(_0xb9d3('0xa'))(new Redis(config[_0xb9d3('0x7')]));function emit(_0x234736,_0x5d253d,_0x26d3ba){io['to'](_0x234736)[_0xb9d3('0xb')](_0x5d253d,_0x26d3ba);}var headers={'Content-Type':'application/json','Accept':_0xb9d3('0xc')};function getTicket(_0x40d4e6,_0x536f08,_0x24255b,_0x426b1b,_0x52c9a0){logger[_0xb9d3('0xd')](_0xb9d3('0xe'));return request({'uri':util[_0xb9d3('0xf')](_0xb9d3('0x10'),_0x40d4e6[_0xb9d3('0x11')]),'method':_0xb9d3('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x24255b['id'],'submitter_id':_0x536f08?_0x536f08['id']:undefined,'assignee_id':_0x536f08?_0x536f08['id']:undefined,'tags':getTags(_0x426b1b[_0xb9d3('0x13')],_0xb9d3('0x14')),'subject':intUtil[_0xb9d3('0x15')](_0x426b1b[_0xb9d3('0x16')],_0x52c9a0,'\x20'),'description':intUtil[_0xb9d3('0x15')](_0x426b1b[_0xb9d3('0x17')],_0x52c9a0,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb9d3('0x15')](_0x426b1b['Descriptions'],_0x52c9a0,'\x0a')}},getCustomFields(_0x426b1b[_0xb9d3('0x18')],_0x52c9a0))}})[_0xb9d3('0x19')](function(_0x5a9b51){logger[_0xb9d3('0xd')](_0xb9d3('0x1a'));return _0x5a9b51[_0xb9d3('0x1b')];});}function getUser(_0x4ebb30,_0x1235bb){if(intUtil[_0xb9d3('0x1c')](_0x1235bb)){logger[_0xb9d3('0xd')](_0xb9d3('0x1d'),_0x1235bb);return request({'uri':util[_0xb9d3('0xf')](_0xb9d3('0x1e'),_0x4ebb30[_0xb9d3('0x11')]),'qs':{'query':util['format'](_0xb9d3('0x1f'),_0x1235bb)}})[_0xb9d3('0x19')](function(_0x48d909){if(_0x48d909[_0xb9d3('0x20')]){logger[_0xb9d3('0xd')](_0xb9d3('0x21'));return _[_0xb9d3('0x22')](_0x48d909['results'],{'email':_0x1235bb,'role':_0xb9d3('0x23')});}else{logger['info'](_0xb9d3('0x24'));return request({'uri':util['format']('%s/users/me.json',_0x4ebb30[_0xb9d3('0x11')])})[_0xb9d3('0x19')](function(_0x4b53b5){logger[_0xb9d3('0xd')](_0xb9d3('0x25'));return _0x4b53b5['user'];});}});}else{logger[_0xb9d3('0xd')](_0xb9d3('0x24'));return request({'uri':util[_0xb9d3('0xf')](_0xb9d3('0x26'),_0x4ebb30[_0xb9d3('0x11')])})[_0xb9d3('0x19')](function(_0x1634e3){logger[_0xb9d3('0xd')]('Admin\x20account\x20selected.');return _0x1634e3['user'];});}}function getEndUser(_0x2cb178,_0x215d67,_0x36f177){logger[_0xb9d3('0xd')]('Searching\x20enduser\x20with\x20phone',_0x36f177);return request({'uri':util[_0xb9d3('0xf')](_0xb9d3('0x1e'),_0x2cb178[_0xb9d3('0x11')]),'qs':{'query':util[_0xb9d3('0xf')](_0xb9d3('0x27'),_0x36f177)}})['then'](function(_0x1626d3){var _0x8838b8;if(_0x1626d3['results'][_0xb9d3('0x28')]){_0x1626d3['results']=_['filter'](_0x1626d3[_0xb9d3('0x29')],{'suspended':![],'role':_0xb9d3('0x2a')});if(_0x1626d3['results'][_0xb9d3('0x28')]){_0x8838b8=_[_0xb9d3('0x2b')](_0x1626d3[_0xb9d3('0x29')]);}}if(_0x8838b8){logger[_0xb9d3('0xd')](_0xb9d3('0x2c'));return _0x8838b8;}else{logger['info'](_0xb9d3('0x2d'));return request({'uri':util[_0xb9d3('0xf')](_0xb9d3('0x2e'),_0x2cb178[_0xb9d3('0x11')]),'method':_0xb9d3('0x12'),'body':{'user':{'role':'end-user','name':util[_0xb9d3('0xf')](_0xb9d3('0x2f'),_0x215d67||_0x36f177),'phone':_0x36f177}}})[_0xb9d3('0x19')](function(_0x5110a6){logger['info'](_0xb9d3('0x30'));return _0x5110a6[_0xb9d3('0x31')];});}});}function getAuth(_0x1ecccb){var _0x35b945;if(_0x1ecccb['authType']===_0xb9d3('0x32')){_0x35b945=util['format'](_0xb9d3('0x33'),_0x1ecccb[_0xb9d3('0x34')],_0x1ecccb[_0xb9d3('0x32')]);}else if(_0x1ecccb[_0xb9d3('0x35')]===_0xb9d3('0x36')){_0x35b945=util['format']('%s/token:%s',_0x1ecccb['username'],_0x1ecccb['token']);}return util['format'](_0xb9d3('0x37'),new Buffer(_0x35b945)['toString'](_0xb9d3('0x38')));}function request(_0x43a880){logger[_0xb9d3('0x39')](_0xb9d3('0x3a'),JSON[_0xb9d3('0x3b')](_0x43a880));return rp(_[_0xb9d3('0x8')](_0x43a880,{'method':_0xb9d3('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0xf8e0be,_0x21458a){var _0x5d8002=[];if(_0xf8e0be&&_0xf8e0be[_0xb9d3('0x28')]>0x0){_0x5d8002=_['map'](_0xf8e0be,_0x21458a);}return _0x5d8002;}function getCustomFields(_0x5d1e8d,_0x59fde1){var _0x318d7c=[];var _0x39a39c={'custom_fields':[]};if(_0x5d1e8d[_0xb9d3('0x28')]>0x0){_[_0xb9d3('0x3d')](_0x5d1e8d,function(_0x5e73f8){if(_[_0xb9d3('0x3e')](['string',_0xb9d3('0x3f')],_0x5e73f8[_0xb9d3('0x40')])&&_0x5e73f8['nameField']&&!_0x5e73f8[_0xb9d3('0x41')]){_0x39a39c[_0x5e73f8[_0xb9d3('0x42')][_0xb9d3('0x43')]()]=_0x5e73f8[_0xb9d3('0x44')][_0xb9d3('0x45')]();}else if(_[_0xb9d3('0x3e')]([_0xb9d3('0x46'),_0xb9d3('0x3f')],_0x5e73f8[_0xb9d3('0x40')])&&_0x5e73f8[_0xb9d3('0x47')]&&_0x5e73f8[_0xb9d3('0x41')]){_0x39a39c[_0xb9d3('0x48')][_0xb9d3('0x49')]({'id':_0x5e73f8[_0xb9d3('0x47')],'value':_0x5e73f8['content'][_0xb9d3('0x45')]()});}else if(_0x5e73f8[_0xb9d3('0x40')]==='variable'&&_0x5e73f8[_0xb9d3('0x4a')]&&_0x5e73f8[_0xb9d3('0x47')]&&_0x5e73f8[_0xb9d3('0x41')]){_0x59fde1[_0x5e73f8['variableName']]&&_0x39a39c[_0xb9d3('0x48')][_0xb9d3('0x49')]({'id':_0x5e73f8[_0xb9d3('0x47')],'value':_0x59fde1[_0x5e73f8[_0xb9d3('0x4a')]][_0xb9d3('0x45')]()});}else if(_0x5e73f8[_0xb9d3('0x40')]==='customVariable'&&_0x5e73f8[_0xb9d3('0x4b')]&&_0x5e73f8['Variable'][_0xb9d3('0x14')]&&_0x5e73f8[_0xb9d3('0x47')]&&_0x5e73f8[_0xb9d3('0x41')]){_0x59fde1[_0x5e73f8[_0xb9d3('0x4b')][_0xb9d3('0x14')][_0xb9d3('0x43')]()]&&_0x39a39c[_0xb9d3('0x48')][_0xb9d3('0x49')]({'id':_0x5e73f8[_0xb9d3('0x47')],'value':_0x59fde1[_0x5e73f8[_0xb9d3('0x4b')][_0xb9d3('0x14')]['toLowerCase']()][_0xb9d3('0x45')]()});}});}return _0x39a39c;}exports[_0xb9d3('0x4c')]=function(_0x8a160a,_0x12c8ab,_0x344dc3,_0x25a93b,_0x5f13a9,_0x40bd48){var _0x317f09,_0x16a937;_0x40bd48[_0xb9d3('0x11')]=intUtil[_0xb9d3('0x4d')](_0x40bd48[_0xb9d3('0x11')]);_0x40bd48[_0xb9d3('0x4e')]=intUtil['stripTrailingSlash'](_0x40bd48[_0xb9d3('0x4e')]);if(_0x5f13a9&&_0x5f13a9[_0xb9d3('0x4f')]){logger[_0xb9d3('0xd')](_0xb9d3('0x50'),_0xb9d3('0x51'));_0x12c8ab['recordingURL']=util['format'](_0xb9d3('0x52'),_0x40bd48['serverUrl'],_0x12c8ab['uniqueid'],md5(_0x12c8ab['uniqueid']));}else{_0x12c8ab['recordingURL']='';}headers[_0xb9d3('0x53')]=getAuth(_0x40bd48);return getUser(_0x40bd48,_0x25a93b[_0xb9d3('0x54')])[_0xb9d3('0x19')](function(_0x36f913){_0x317f09=_0x36f913;logger['info']('The\x20User\x20ID\x20is:',_0x317f09['id']);return getEndUser(_0x40bd48,_0x12c8ab[_0xb9d3('0x55')],_0x12c8ab[_0xb9d3('0x56')]);})[_0xb9d3('0x19')](function(_0xe3df45){_0x16a937=_0xe3df45;logger[_0xb9d3('0xd')]('The\x20Enduser\x20ID\x20is:',_0x16a937['id']);return getTicket(_0x40bd48,_0x317f09,_0x16a937,_0x344dc3,_0x12c8ab);})['then'](function(_0x3b51bd){if(_0x3b51bd){logger[_0xb9d3('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3b51bd['id']);switch(_0x40bd48[_0xb9d3('0x40')]){case'integrationTab':logger[_0xb9d3('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb9d3('0xf')](_0xb9d3('0x57'),_0x40bd48[_0xb9d3('0x11')],_0x317f09['id'],_0x3b51bd['id']),'method':_0xb9d3('0x12')});case _0xb9d3('0x58'):logger[_0xb9d3('0xd')](_0xb9d3('0x50'),_0xb9d3('0x59'));emit(util[_0xb9d3('0xf')]('user:%s',_0x25a93b[_0xb9d3('0x14')]),'trigger:browser:url',{'uri':util[_0xb9d3('0xf')](_0xb9d3('0x5a'),_0x40bd48[_0xb9d3('0x11')][_0xb9d3('0x5b')]('/api/v2',''),_0x3b51bd['id'])});break;default:logger[_0xb9d3('0x5c')](_0xb9d3('0x50'),_0xb9d3('0x5d'));}}})[_0xb9d3('0x5e')](function(_0x19cd96){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x19cd96,{'showHidden':!![],'depth':null}));});};exports[_0xb9d3('0x5f')]=function(_0x21969c,_0x2f547c,_0xce31,_0x49cbdb,_0x1a0541,_0x257082,_0x5b5899){var _0x44c011,_0xb1bfb8;_0x257082[_0xb9d3('0x11')]=intUtil[_0xb9d3('0x4d')](_0x257082[_0xb9d3('0x11')]);_0x257082['serverUrl']=intUtil[_0xb9d3('0x4d')](_0x257082[_0xb9d3('0x4e')]);if(_0x5b5899&&_0x5b5899[_0xb9d3('0x60')]&&_0x5b5899[_0xb9d3('0x60')]!==_0xb9d3('0x61')){logger['info'](_0xb9d3('0x62'),'Recording\x20is\x20enabled!');_0x2f547c[_0xb9d3('0x63')]=util['format'](_0xb9d3('0x52'),_0x257082[_0xb9d3('0x4e')],_0x2f547c[_0xb9d3('0x64')],md5(_0x2f547c['uniqueid']));}headers['Authorization']=getAuth(_0x257082);return getUser(_0x257082,_0x49cbdb[_0xb9d3('0x54')])[_0xb9d3('0x19')](function(_0x55a70d){_0x44c011=_0x55a70d;logger[_0xb9d3('0xd')](_0xb9d3('0x65'),_0x44c011['id']);return getEndUser(_0x257082,_0x2f547c['destcalleridname'],_0x2f547c[_0xb9d3('0x66')]);})[_0xb9d3('0x19')](function(_0x3abd0b){_0xb1bfb8=_0x3abd0b;logger[_0xb9d3('0xd')](_0xb9d3('0x67'),_0xb1bfb8['id']);return getTicket(_0x257082,_0x44c011,_0xb1bfb8,_0xce31,_0x2f547c);})[_0xb9d3('0x19')](function(_0x1bfb99){if(_0x1bfb99){logger['info'](_0xb9d3('0x68'),_0x1bfb99['id']);switch(_0x257082[_0xb9d3('0x40')]){case _0xb9d3('0x69'):logger[_0xb9d3('0xd')]('[OUTBOUND]',_0xb9d3('0x6a'));return request({'uri':util[_0xb9d3('0xf')](_0xb9d3('0x57'),_0x257082['remoteUri'],_0x44c011['id'],_0x1bfb99['id']),'method':_0xb9d3('0x12')});case'newTab':logger[_0xb9d3('0xd')](_0xb9d3('0x62'),_0xb9d3('0x59'));emit(util[_0xb9d3('0xf')]('user:%s',_0x49cbdb['name']),'trigger:browser:url',{'uri':util[_0xb9d3('0xf')](_0xb9d3('0x5a'),_0x257082[_0xb9d3('0x11')][_0xb9d3('0x5b')](_0xb9d3('0x6b'),''),_0x1bfb99['id'])});break;default:logger[_0xb9d3('0x5c')](_0xb9d3('0x62'),_0xb9d3('0x5d'));}}})[_0xb9d3('0x5e')](function(_0x29628f){logger[_0xb9d3('0x5c')](_0xb9d3('0x6c'),util[_0xb9d3('0x6d')](_0x29628f,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x480172,_0x53f21a,_0x52ccf2,_0x2a97df,_0x5d246e,_0x11dcc6){var _0x5c0d00,_0x2a8c97;_0x11dcc6[_0xb9d3('0x11')]=intUtil['stripTrailingSlash'](_0x11dcc6['remoteUri']);_0x11dcc6[_0xb9d3('0x4e')]=intUtil[_0xb9d3('0x4d')](_0x11dcc6[_0xb9d3('0x4e')]);if(_0x5d246e&&_0x5d246e['monitor_format']){logger[_0xb9d3('0xd')]('['+_0x53f21a[_0xb9d3('0x6e')][_0xb9d3('0x6f')]()+']',_0xb9d3('0x51'));_0x53f21a['recordingURL']=util[_0xb9d3('0xf')](_0xb9d3('0x52'),_0x11dcc6[_0xb9d3('0x4e')],_0x53f21a['uniqueid'],md5(_0x53f21a['uniqueid']));}else{_0x53f21a[_0xb9d3('0x63')]='';}headers[_0xb9d3('0x53')]=getAuth(_0x11dcc6);return getUser(_0x11dcc6)[_0xb9d3('0x19')](function(_0x2b3425){_0x5c0d00=_0x2b3425;logger[_0xb9d3('0xd')](_0xb9d3('0x65'),_0x5c0d00['id']);return getEndUser(_0x11dcc6,_0x53f21a[_0xb9d3('0x55')],_0x53f21a[_0xb9d3('0x56')]);})[_0xb9d3('0x19')](function(_0x345508){_0x2a8c97=_0x345508;logger[_0xb9d3('0xd')]('The\x20Enduser\x20ID\x20is:',_0x2a8c97['id']);return getTicket(_0x11dcc6,_0x5c0d00,_0x2a8c97,_0x52ccf2,_0x53f21a);})['then'](function(_0x693782){if(_0x693782){logger[_0xb9d3('0xd')]('The\x20Ticket\x20ID\x20is:',_0x693782['id']);}})['catch'](function(_0x1a18ef){logger[_0xb9d3('0x5c')]('['+_0x53f21a['lastevent'][_0xb9d3('0x6f')]()+']'+_0xb9d3('0x70'),util['inspect'](_0x1a18ef,{'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 9709006..9e6a6a9 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 _0x8e63=['indexOf','split','access_token','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','then','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','isNil','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','Error:\x20','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Owner','profile','getString','Subjects','Description','Full_Name','First_Name','Last_Name','What_Id','utc','talktime','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','Answered','Rejected','timeout','Call_Start_Time','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','stack','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','request-promise','./util','moment','ioredis','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','length','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x4620c5,_0x2079db){var _0x15310d=function(_0x506c5f){while(--_0x506c5f){_0x4620c5['push'](_0x4620c5['shift']());}};_0x15310d(++_0x2079db);}(_0x8e63,0x7c));var _0x38e6=function(_0x19c7a3,_0x561adf){_0x19c7a3=_0x19c7a3-0x0;var _0x1f6302=_0x8e63[_0x19c7a3];return _0x1f6302;};'use strict';var _=require('lodash');var rp=require(_0x38e6('0x0'));var md5=require('md5');var util=require('util');var intUtil=require(_0x38e6('0x1'));var moment=require(_0x38e6('0x2'));var Redis=require(_0x38e6('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x38e6('0x4'))(_0x38e6('0x5'));config[_0x38e6('0x6')]=_['defaults'](config[_0x38e6('0x6')],{'host':_0x38e6('0x7'),'port':0x18eb});var io=require(_0x38e6('0x8'))(new Redis(config[_0x38e6('0x6')]));function emit(_0x51b586,_0x55abdf,_0x61cee2){io['to'](_0x51b586)[_0x38e6('0x9')](_0x55abdf,_0x61cee2);}function request(_0x1a4c20){logger[_0x38e6('0xa')](_0x38e6('0xb'),JSON['stringify'](_0x1a4c20));return rp(_0x1a4c20);}function getCustomFields(_0x563697,_0x27826e){var _0x4c5e34={};if(_0x563697[_0x38e6('0xc')]>0x0){_['forEach'](_0x563697,function(_0xe94c39){if(_[_0x38e6('0xd')]([_0x38e6('0xe'),_0x38e6('0xf')],_0xe94c39[_0x38e6('0x10')])&&_0xe94c39['idField']){_0x4c5e34[_0xe94c39[_0x38e6('0x11')]]=_0xe94c39[_0x38e6('0x12')]['toString']();}else if(_0xe94c39[_0x38e6('0x10')]===_0x38e6('0x13')&&_0xe94c39[_0x38e6('0x14')]&&_0xe94c39[_0x38e6('0x11')]&&_0x27826e[_0xe94c39[_0x38e6('0x14')]]){_0x4c5e34[_0xe94c39[_0x38e6('0x11')]]=_0x27826e[_0xe94c39['variableName']][_0x38e6('0x15')]();}else if(_0xe94c39[_0x38e6('0x10')]===_0x38e6('0x16')&&_0xe94c39[_0x38e6('0x17')]&&_0xe94c39[_0x38e6('0x17')]['name']&&_0xe94c39[_0x38e6('0x11')]&&_0x27826e[_0xe94c39['Variable'][_0x38e6('0x18')][_0x38e6('0x19')]()]){_0x4c5e34[_0xe94c39[_0x38e6('0x11')]]=_0x27826e[_0xe94c39[_0x38e6('0x17')]['name'][_0x38e6('0x19')]()]['toString']();}});}return _0x4c5e34;}function getName(_0x18ec00){if(_0x18ec00[_0x38e6('0x1a')]('\x20')>0x0){var _0x1781d3=_0x18ec00[_0x38e6('0x1b')](/ (.+)/);if(_0x1781d3[0x1]){return _0x1781d3;}}return[_0x18ec00,_0x18ec00];}var accountsTokens={};function getAccessToken(_0x3f1d54){return new Promise(function(_0x41bb24,_0x495268){if(!_['isNil'](accountsTokens[_0x3f1d54['id']])&&!_['isNil'](accountsTokens[_0x3f1d54['id']][_0x38e6('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x3f1d54['id']]['expires_in'])){_0x41bb24(accountsTokens[_0x3f1d54['id']][_0x38e6('0x1c')]);}}var _0xa4a8b9;switch(_0x3f1d54[_0x38e6('0x1d')]){case'US':_0xa4a8b9=_0x38e6('0x1e');break;case'AU':_0xa4a8b9='https://accounts.zoho.com.au';break;case'EU':_0xa4a8b9=_0x38e6('0x1f');break;case'IN':_0xa4a8b9=_0x38e6('0x20');break;case'CN':_0xa4a8b9=_0x38e6('0x21');break;default:_0xa4a8b9='https://accounts.zoho.eu';break;}var _0x832025={'method':_0x38e6('0x22'),'uri':_0xa4a8b9+_0x38e6('0x23'),'qs':{'refresh_token':_0x3f1d54[_0x38e6('0x24')],'client_id':_0x3f1d54[_0x38e6('0x25')],'client_secret':_0x3f1d54[_0x38e6('0x26')],'grant_type':_0x38e6('0x27')},'json':!![]};return rp(_0x832025)[_0x38e6('0x28')](function(_0x4a261a){accountsTokens[_0x3f1d54['id']]={'access_token':_0x4a261a[_0x38e6('0x1c')],'expires_in':moment()['add'](_0x4a261a[_0x38e6('0x29')],_0x38e6('0x2a'))};_0x41bb24(_0x4a261a[_0x38e6('0x1c')]);})[_0x38e6('0x2b')](function(_0x43f05f){logger[_0x38e6('0x2c')](_0x38e6('0x2d'),_0x43f05f['stack']);_0x495268(_0x43f05f);});});}function getUser(_0xe93f18,_0x1980a4,_0x48f5a2,_0x1aa78b){logger[_0x38e6('0x2e')]('Search\x20user');return request({'method':_0x38e6('0x2f'),'uri':util[_0x38e6('0x30')](_0x38e6('0x31'),_0x1980a4),'qs':{'type':_0x38e6('0x32')},'headers':{'Authorization':_0x38e6('0x33')+_0xe93f18},'json':!![]})[_0x38e6('0x28')](function(_0x1fe0e7){if(_0x1fe0e7['users']){var _0x220c19=-0x1;if(_[_0x38e6('0x34')](_0x1fe0e7[_0x38e6('0x35')])){if(!_[_0x38e6('0x36')](_0x1aa78b)){_0x220c19=_[_0x38e6('0x37')](_0x1fe0e7[_0x38e6('0x35')],function(_0x20bd62){return _0x20bd62['email']===_0x1aa78b;});}if(_0x220c19>=0x0){logger[_0x38e6('0x2e')](_0x38e6('0x38'));}else{logger[_0x38e6('0x2e')](_0x38e6('0x39'));_0x220c19=_[_0x38e6('0x37')](_0x1fe0e7[_0x38e6('0x35')],function(_0x40a596){return _0x40a596['profile'][_0x38e6('0x18')]===_0x38e6('0x3a');});}return _0x1fe0e7[_0x38e6('0x35')][_0x220c19];}else{if(_0x1fe0e7[_0x38e6('0x3b')]['profile'][_0x38e6('0x18')]===_0x38e6('0x3a')){logger['info'](_0x38e6('0x39'));user=_0x1fe0e7[_0x38e6('0x3b')];return user;}else{logger[_0x38e6('0x2c')](_0x38e6('0x3c'),JSON['stringify'](_0x1fe0e7));throw new Error(_0x38e6('0x3d')+JSON[_0x38e6('0x3e')](_0x1fe0e7));}}}else{logger[_0x38e6('0x2c')](_0x38e6('0x3c'),JSON['stringify'](_0x1fe0e7));throw new Error(_0x38e6('0x3d')+JSON[_0x38e6('0x3e')](_0x1fe0e7));}})[_0x38e6('0x2b')](function(_0x291c21){console[_0x38e6('0x2c')](_0x291c21);});}function getZohoUser(_0xe1d8ab,_0xf9677d){return new BPromise(function(_0x5d1386,_0x26ea1f){request(_0xe1d8ab)[_0x38e6('0x28')](function(_0x5700a1){var _0x56393b=null;if(_0x5700a1){_0x56393b=_0x5700a1[_0x38e6('0x3f')][0x0];_0x56393b[_0x38e6('0x40')]=_0xf9677d;}_0x5d1386(_0x56393b);})[_0x38e6('0x2b')](function(_0x399083){_0x26ea1f(_0x399083);});});}function createEndUser(_0x22e750,_0x2cb64c,_0x1c80eb,_0x1878e9,_0x200c9e,_0x4f38c2){var _0x1c80eb=getName(_0x1c80eb);return request({'method':_0x38e6('0x22'),'uri':_0x38e6('0x41')+_0x2cb64c+_0x38e6('0x42')+_[_0x38e6('0x43')](_0x4f38c2[_0x38e6('0x44')])+'s','body':{'data':[{'Last_Name':_0x1c80eb[0x1],'First_Name':_0x1c80eb[0x0],'Phone':_0x1878e9,'Owner':{'name':!_['isNil'](_0x200c9e[_0x38e6('0x45')]['name'])?_0x200c9e[_0x38e6('0x45')][_0x38e6('0x18')]:!_[_0x38e6('0x36')](_0x200c9e[_0x38e6('0x46')])?_0x200c9e[_0x38e6('0x46')]+'\x20'+_0x200c9e['last_name']:_0x200c9e[_0x38e6('0x47')],'id':_0x200c9e['id']}}]},'headers':{'Authorization':_0x38e6('0x33')+_0x22e750},'json':!![]})['then'](function(_0x385045){if(_0x385045&&_0x385045[_0x38e6('0x3f')][0x0][_0x38e6('0x48')]==='SUCCESS'){var _0x1904b5=_0x385045[_0x38e6('0x3f')][0x0]['details'];_0x1904b5[_0x38e6('0x40')]=_[_0x38e6('0x43')](_0x4f38c2[_0x38e6('0x44')])+'s';return _0x1904b5;}logger[_0x38e6('0x2c')](_0x38e6('0x3c'),JSON['stringify'](data));throw new Error(_0x38e6('0x49')+JSON['stringify'](data));})[_0x38e6('0x2b')](function(_0x206531){console['log'](_0x38e6('0x4a'),_0x206531);});}function getEndUser(_0x2c3cad,_0x57659a,_0x150097,_0x435b73,_0x6e7de2,_0x48a402,_0x3b36a0){var _0x1f84c2={'method':_0x38e6('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2c3cad},'json':!![]};switch(_0x3b36a0['moduleSearch']){case _0x38e6('0x4b'):_0x1f84c2[_0x38e6('0x4c')]='https://www.zohoapis.'+_0x57659a+_0x38e6('0x4d')+_0x6e7de2+'))';return getZohoUser(_0x1f84c2,_0x38e6('0x4e'))[_0x38e6('0x28')](function(_0x2e0644){if(_0x2e0644)return _0x2e0644;_0x1f84c2[_0x38e6('0x4c')]=_0x38e6('0x41')+_0x57659a+_0x38e6('0x4f')+_0x6e7de2+'))';return getZohoUser(_0x1f84c2,'Leads')['then'](function(_0x447808){if(_0x447808)return _0x447808;if(_0x3b36a0['moduleCreate']!=_0x38e6('0x50')){return createEndUser(_0x2c3cad,_0x57659a,_0x435b73,_0x6e7de2,_0x48a402,_0x3b36a0);}else{return{};}});});break;case _0x38e6('0x51'):_0x1f84c2['uri']='https://www.zohoapis.'+_0x57659a+_0x38e6('0x4d')+_0x6e7de2+'))';return getZohoUser(_0x1f84c2,_0x38e6('0x4e'))['then'](function(_0x175dfa){if(_0x175dfa)return _0x175dfa;if(_0x3b36a0['moduleCreate']!='nothing'){return createEndUser(_0x2c3cad,_0x57659a,_0x435b73,_0x6e7de2,_0x48a402,_0x3b36a0);}else{return{};}});break;case _0x38e6('0x52'):_0x1f84c2[_0x38e6('0x4c')]=_0x38e6('0x41')+_0x57659a+_0x38e6('0x4f')+_0x6e7de2+'))';return getZohoUser(_0x1f84c2,_0x38e6('0x53'))['then'](function(_0x753f8){if(_0x753f8)return _0x753f8;if(_0x3b36a0[_0x38e6('0x44')]!=_0x38e6('0x50')){return createEndUser(_0x2c3cad,_0x57659a,_0x435b73,_0x6e7de2,_0x48a402,_0x3b36a0);}else{return{};}});break;}}function getCall(_0x957a2a,_0x15f2c1,_0x361ff6,_0x138800,_0x4bd79d,_0x55bbe4,_0x487485,_0x32e8dc){logger[_0x38e6('0x2e')]('Creating\x20new\x20call...');var _0x263120={};_0x263120[_0x38e6('0x54')]={'name':!_[_0x38e6('0x36')](_0x138800[_0x38e6('0x45')][_0x38e6('0x18')])&&!_[_0x38e6('0x36')](_0x138800[_0x38e6('0x55')][_0x38e6('0x18')])&&_0x138800[_0x38e6('0x55')][_0x38e6('0x18')]==='administrator'?_0x138800[_0x38e6('0x45')][_0x38e6('0x18')]:!_[_0x38e6('0x36')](_0x138800[_0x38e6('0x46')])?_0x138800[_0x38e6('0x46')]+'\x20'+_0x138800[_0x38e6('0x47')]:_0x138800[_0x38e6('0x47')],'id':_0x138800['id']};_0x263120['Subject']=intUtil[_0x38e6('0x56')](_0x55bbe4[_0x38e6('0x57')],_0x487485,'\x20');_0x263120[_0x38e6('0x58')]=intUtil[_0x38e6('0x56')](_0x55bbe4['Descriptions'],_0x487485,'\x0a');if(_0x4bd79d['enduserType']==='Contacts'){_0x263120['Who_Id']={'name':!_[_0x38e6('0x36')](_0x4bd79d[_0x38e6('0x59')])?_0x4bd79d[_0x38e6('0x59')]:!_['isNil'](_0x4bd79d[_0x38e6('0x5a')])?_0x4bd79d[_0x38e6('0x5a')]+'\x20'+_0x4bd79d['Last_Name']:_0x4bd79d[_0x38e6('0x5b')],'id':_0x4bd79d['id']};}if(_0x4bd79d['enduserType']===_0x38e6('0x53')){_0x263120[_0x38e6('0x5c')]={'name':!_[_0x38e6('0x36')](_0x4bd79d['Full_Name'])?_0x4bd79d[_0x38e6('0x59')]:!_['isNil'](_0x4bd79d[_0x38e6('0x5a')])?_0x4bd79d['First_Name']+'\x20'+_0x4bd79d[_0x38e6('0x5b')]:_0x4bd79d[_0x38e6('0x5b')],'id':_0x4bd79d['id']};_0x263120['$se_module']=_[_0x38e6('0x43')](_0x4bd79d[_0x38e6('0x40')]);}if(_0x487485['talktime']){_0x263120['Call_Duration']=moment[_0x38e6('0x5d')](parseInt(_0x487485[_0x38e6('0x5e')])*0x3e8)[_0x38e6('0x30')](_0x38e6('0x5f'));}else if(_0x487485[_0x38e6('0x60')]&&_0x487485[_0x38e6('0x61')]){_0x263120[_0x38e6('0x62')]=moment['utc'](moment(_0x487485[_0x38e6('0x61')],_0x38e6('0x63'))[_0x38e6('0x64')](moment(_0x487485[_0x38e6('0x65')],'YYYY-MM-DDTHH:mm:ss')))[_0x38e6('0x30')](_0x38e6('0x5f'));}switch(_0x487485[_0x38e6('0x66')]){case _0x38e6('0x67'):_0x263120[_0x38e6('0x68')]=_0x38e6('0x69');break;case _0x38e6('0x6a'):case'connect':_0x263120[_0x38e6('0x68')]=_0x38e6('0x6b');break;case'rejected':_0x263120[_0x38e6('0x68')]=_0x38e6('0x6c');break;case'abandoned':_0x263120[_0x38e6('0x68')]='Abandoned';break;case _0x38e6('0x6d'):_0x263120[_0x38e6('0x68')]='Timeout';default:}_0x263120[_0x38e6('0x6e')]=(_0x32e8dc==='outbound'?moment(_0x487485[_0x38e6('0x65')])[_0x38e6('0x30')](_0x38e6('0x63')):moment(_0x487485['agentcalledAt'])['format'](_0x38e6('0x63')))||moment()[_0x38e6('0x30')](_0x38e6('0x63'));_0x263120[_0x38e6('0x6f')]=_0x32e8dc||_0x38e6('0x70');_0x263120=_[_0x38e6('0x71')](_0x263120,getCustomFields(_0x55bbe4['Fields'],_0x487485));return request({'method':'POST','uri':_0x38e6('0x41')+_0x15f2c1+_0x38e6('0x72'),'headers':{'Authorization':_0x38e6('0x33')+_0x957a2a},'body':{'data':[_0x263120]},'json':!![]})[_0x38e6('0x28')](function(_0x323e15){if(_0x323e15&&_0x323e15[_0x38e6('0x3f')][0x0][_0x38e6('0x48')]===_0x38e6('0x73')){logger[_0x38e6('0x2e')](_0x38e6('0x74'));return{'id':_0x323e15[_0x38e6('0x3f')][0x0][_0x38e6('0x75')]['id']};}})['catch'](function(_0xbd0a79){logger[_0x38e6('0x2e')](_0x38e6('0x76'),_0xbd0a79[_0x38e6('0x77')]);console['log'](_0x38e6('0x76'),_0xbd0a79);});}exports[_0x38e6('0x78')]=function(_0x28004d,_0x15ca57,_0x23a79e,_0x592512,_0x332315,_0x2fa987){var _0x2f9906,_0x252426,_0x55edc3;_0x2fa987['host']=intUtil[_0x38e6('0x79')](_0x2fa987[_0x38e6('0x7a')]);_0x2fa987['serverUrl']=intUtil['stripTrailingSlash'](_0x2fa987[_0x38e6('0x7b')]);if(_0x332315&&_0x332315[_0x38e6('0x7c')]){logger[_0x38e6('0x2e')](_0x38e6('0x7d'),'Recording\x20is\x20enabled!');_0x15ca57[_0x38e6('0x7e')]=_0x2fa987['serverUrl']+_0x38e6('0x7f')+_0x15ca57[_0x38e6('0x80')]+_0x38e6('0x81')+md5(_0x15ca57[_0x38e6('0x80')]);}else{_0x15ca57[_0x38e6('0x7e')]='';}var _0x590502=_0x2fa987[_0x38e6('0x7a')]===_0x38e6('0x82')?'eu':_0x38e6('0x83');return getAccessToken(_0x2fa987)[_0x38e6('0x28')](function(_0x39df3c){_0x55edc3=_0x39df3c;return getUser(_0x55edc3,_0x590502,_0x2fa987,_0x592512[_0x38e6('0x84')]);})[_0x38e6('0x28')](function(_0x2cc851){_0x2f9906=_0x2cc851;logger[_0x38e6('0x2e')](_0x38e6('0x85'),_0x2f9906['id']);return getEndUser(_0x55edc3,_0x590502,_0x2fa987,_0x15ca57[_0x38e6('0x86')],_0x15ca57[_0x38e6('0x87')],_0x2f9906,_0x23a79e);})[_0x38e6('0x28')](function(_0x4c6d09){_0x252426=_0x4c6d09;return getCall(_0x55edc3,_0x590502,_0x2fa987,_0x2f9906,_0x252426,_0x23a79e,_0x15ca57,_0x38e6('0x70'));})[_0x38e6('0x28')](function(_0x525073){if(_0x525073){logger['info'](_0x38e6('0x88'),_0x525073['id']);logger['info']('[QUEUE]',_0x38e6('0x89'));emit(util[_0x38e6('0x30')]('user:%s',_0x592512[_0x38e6('0x18')]),_0x38e6('0x8a'),{'uri':_0x38e6('0x8b')+_0x2fa987[_0x38e6('0x7a')]+_0x38e6('0x8c')+_0x525073['id']});}})[_0x38e6('0x2b')](function(_0x38a721){logger[_0x38e6('0x2c')](_0x38e6('0x7d'),JSON[_0x38e6('0x3e')](_0x38a721));});};exports[_0x38e6('0x8d')]=function(_0x429a44,_0x5de794,_0x58a13a,_0x360f67,_0x2f5a81,_0x2b1e71,_0x3a69af){var _0x398efb,_0x1916fa,_0x4b6077;_0x2b1e71[_0x38e6('0x7a')]=intUtil[_0x38e6('0x79')](_0x2b1e71[_0x38e6('0x7a')]);_0x2b1e71['serverUrl']=intUtil[_0x38e6('0x79')](_0x2b1e71[_0x38e6('0x7b')]);if(_0x3a69af&&_0x3a69af[_0x38e6('0x8e')]&&_0x3a69af['recordingFormat']!==_0x38e6('0x8f')){logger[_0x38e6('0x2e')](_0x38e6('0x90'),'Recording\x20is\x20enabled!');_0x5de794[_0x38e6('0x7e')]=_0x2b1e71[_0x38e6('0x7b')]+_0x38e6('0x7f')+_0x5de794[_0x38e6('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x5de794[_0x38e6('0x80')]);}var _0x2707e7=_0x2b1e71[_0x38e6('0x7a')]==='zoho.eu'?'eu':_0x38e6('0x83');return getAccessToken(_0x2b1e71)['then'](function(_0x265aa2){_0x4b6077=_0x265aa2;return getUser(_0x4b6077,_0x2707e7,_0x2b1e71,_0x360f67[_0x38e6('0x84')]);})[_0x38e6('0x28')](function(_0xbe5bb3){_0x398efb=_0xbe5bb3;logger[_0x38e6('0x2e')](_0x38e6('0x85'),_0x398efb['id']);return getEndUser(_0x4b6077,_0x2707e7,_0x2b1e71,_0x5de794[_0x38e6('0x91')],_0x5de794[_0x38e6('0x92')],_0x398efb,_0x58a13a);})[_0x38e6('0x28')](function(_0x4c13a0){_0x1916fa=_0x4c13a0;return getCall(_0x4b6077,_0x2707e7,_0x2b1e71,_0x398efb,_0x1916fa,_0x58a13a,_0x5de794,_0x38e6('0x93'));})[_0x38e6('0x28')](function(_0x3ffd5f){if(_0x3ffd5f){logger[_0x38e6('0x2e')]('The\x20Call\x20ID\x20is:',_0x3ffd5f['id']);logger['info'](_0x38e6('0x90'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x38e6('0x30')]('user:%s',_0x360f67[_0x38e6('0x18')]),_0x38e6('0x8a'),{'uri':_0x38e6('0x8b')+_0x2b1e71[_0x38e6('0x7a')]+_0x38e6('0x8c')+_0x3ffd5f['id']});}})[_0x38e6('0x2b')](function(_0x1436cd){logger[_0x38e6('0x2c')](_0x38e6('0x90'),JSON[_0x38e6('0x3e')](_0x1436cd));});};exports[_0x38e6('0x94')]=function(_0x1855d4,_0x786d34,_0x520b01,_0x2e1e9d,_0x5ae4ec,_0x1981cf){var _0x3a8ec3,_0x54bafa,_0x1579a7;_0x1981cf[_0x38e6('0x7a')]=intUtil[_0x38e6('0x79')](_0x1981cf['host']);_0x1981cf[_0x38e6('0x7b')]=intUtil[_0x38e6('0x79')](_0x1981cf[_0x38e6('0x7b')]);if(_0x5ae4ec&&_0x5ae4ec[_0x38e6('0x7c')]){logger[_0x38e6('0x2e')]('['+_0x786d34[_0x38e6('0x66')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x786d34['recordingURL']=_0x1981cf[_0x38e6('0x7b')]+_0x38e6('0x7f')+_0x786d34[_0x38e6('0x80')]+_0x38e6('0x81')+md5(_0x786d34[_0x38e6('0x80')]);}else{_0x786d34[_0x38e6('0x7e')]='';}var _0x547193=_0x1981cf[_0x38e6('0x7a')]===_0x38e6('0x82')?'eu':_0x38e6('0x83');return getAccessToken(_0x1981cf)[_0x38e6('0x28')](function(_0x3e1056){_0x1579a7=_0x3e1056;return getUser(_0x1579a7,_0x547193,_0x1981cf);})['then'](function(_0x3a92a7){_0x3a8ec3=_0x3a92a7;logger[_0x38e6('0x2e')](_0x38e6('0x85'),_0x3a8ec3['id']);return getEndUser(_0x1579a7,_0x547193,_0x1981cf,_0x786d34[_0x38e6('0x86')],_0x786d34[_0x38e6('0x87')],_0x3a8ec3,_0x520b01);})['then'](function(_0x5c8235){_0x54bafa=_0x5c8235;return getCall(_0x1579a7,_0x547193,_0x1981cf,_0x3a8ec3,_0x54bafa,_0x520b01,_0x786d34,_0x38e6('0x70'));})['then'](function(_0x31ca38){if(_0x31ca38){logger['info']('The\x20Call\x20ID\x20is:',_0x31ca38['id']);}})['catch'](function(_0x1bb7ad){logger[_0x38e6('0x2c')]('['+_0x786d34[_0x38e6('0x66')][_0x38e6('0x95')]()+']',JSON[_0x38e6('0x3e')](_0x1bb7ad));});}; \ No newline at end of file +var _0x3dc8=['recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','zoho.eu','com','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','request-promise','md5','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','debug','stringify','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Administrator','user','profile','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','data','enduserType','moduleCreate','role','first_name','last_name','SUCCESS','details','startCase','Error:\x20','log','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','contact','Contacts','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Descriptions','Full_Name','First_Name','What_Id','Last_Name','talktime','Call_Duration','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','connect','Answered','rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token='];(function(_0x3c8b0b,_0x2712df){var _0x58e5a5=function(_0x3fc1b9){while(--_0x3fc1b9){_0x3c8b0b['push'](_0x3c8b0b['shift']());}};_0x58e5a5(++_0x2712df);}(_0x3dc8,0x148));var _0x83dc=function(_0x1927e0,_0x22e246){_0x1927e0=_0x1927e0-0x0;var _0x290094=_0x3dc8[_0x1927e0];return _0x290094;};'use strict';var _=require('lodash');var rp=require(_0x83dc('0x0'));var md5=require(_0x83dc('0x1'));var util=require('util');var intUtil=require(_0x83dc('0x2'));var moment=require(_0x83dc('0x3'));var Redis=require(_0x83dc('0x4'));var BPromise=require('bluebird');var config=require(_0x83dc('0x5'));var logger=require(_0x83dc('0x6'))(_0x83dc('0x7'));config['redis']=_[_0x83dc('0x8')](config[_0x83dc('0x9')],{'host':_0x83dc('0xa'),'port':0x18eb});var io=require(_0x83dc('0xb'))(new Redis(config['redis']));function emit(_0x5962f2,_0xe237f7,_0x17f885){io['to'](_0x5962f2)['emit'](_0xe237f7,_0x17f885);}function request(_0x8c626a){logger[_0x83dc('0xc')]('[HTTP]',JSON[_0x83dc('0xd')](_0x8c626a));return rp(_0x8c626a);}function getCustomFields(_0x3fdaa6,_0x364049){var _0x3d5faa={};if(_0x3fdaa6['length']>0x0){_[_0x83dc('0xe')](_0x3fdaa6,function(_0x5a25c3){if(_[_0x83dc('0xf')]([_0x83dc('0x10'),_0x83dc('0x11')],_0x5a25c3['type'])&&_0x5a25c3[_0x83dc('0x12')]){_0x3d5faa[_0x5a25c3[_0x83dc('0x12')]]=_0x5a25c3[_0x83dc('0x13')][_0x83dc('0x14')]();}else if(_0x5a25c3['type']===_0x83dc('0x15')&&_0x5a25c3[_0x83dc('0x16')]&&_0x5a25c3['idField']&&_0x364049[_0x5a25c3['variableName']]){_0x3d5faa[_0x5a25c3['idField']]=_0x364049[_0x5a25c3['variableName']]['toString']();}else if(_0x5a25c3['type']===_0x83dc('0x17')&&_0x5a25c3[_0x83dc('0x18')]&&_0x5a25c3[_0x83dc('0x18')][_0x83dc('0x19')]&&_0x5a25c3[_0x83dc('0x12')]&&_0x364049[_0x5a25c3[_0x83dc('0x18')]['name'][_0x83dc('0x1a')]()]){_0x3d5faa[_0x5a25c3[_0x83dc('0x12')]]=_0x364049[_0x5a25c3[_0x83dc('0x18')]['name'][_0x83dc('0x1a')]()]['toString']();}});}return _0x3d5faa;}function getName(_0x211652){if(_0x211652[_0x83dc('0x1b')]('\x20')>0x0){var _0x92950d=_0x211652[_0x83dc('0x1c')](/ (.+)/);if(_0x92950d[0x1]){return _0x92950d;}}return[_0x211652,_0x211652];}var accountsTokens={};function getAccessToken(_0x90d42b){return new Promise(function(_0xd122f4,_0x40cdf4){if(!_[_0x83dc('0x1d')](accountsTokens[_0x90d42b['id']])&&!_['isNil'](accountsTokens[_0x90d42b['id']][_0x83dc('0x1e')])){if(moment()[_0x83dc('0x1f')](accountsTokens[_0x90d42b['id']][_0x83dc('0x20')])){_0xd122f4(accountsTokens[_0x90d42b['id']][_0x83dc('0x1e')]);}}var _0x206200;switch(_0x90d42b['zone']){case'US':_0x206200=_0x83dc('0x21');break;case'AU':_0x206200=_0x83dc('0x22');break;case'EU':_0x206200=_0x83dc('0x23');break;case'IN':_0x206200='https://accounts.zoho.in';break;case'CN':_0x206200=_0x83dc('0x24');break;default:_0x206200=_0x83dc('0x23');break;}var _0x350201={'method':_0x83dc('0x25'),'uri':_0x206200+_0x83dc('0x26'),'qs':{'refresh_token':_0x90d42b['refreshToken'],'client_id':_0x90d42b[_0x83dc('0x27')],'client_secret':_0x90d42b[_0x83dc('0x28')],'grant_type':_0x83dc('0x29')},'json':!![]};return rp(_0x350201)[_0x83dc('0x2a')](function(_0x576672){accountsTokens[_0x90d42b['id']]={'access_token':_0x576672[_0x83dc('0x1e')],'expires_in':moment()[_0x83dc('0x2b')](_0x576672[_0x83dc('0x20')],_0x83dc('0x2c'))};_0xd122f4(_0x576672[_0x83dc('0x1e')]);})[_0x83dc('0x2d')](function(_0x29f7b8){logger[_0x83dc('0x2e')](_0x83dc('0x2f'),_0x29f7b8[_0x83dc('0x30')]);_0x40cdf4(_0x29f7b8);});});}function getUser(_0x1a71a5,_0x2a7c85,_0x9be13d,_0x2a73ee){logger['info']('Search\x20user');return request({'method':_0x83dc('0x31'),'uri':util[_0x83dc('0x32')](_0x83dc('0x33'),_0x2a7c85),'qs':{'type':_0x83dc('0x34')},'headers':{'Authorization':_0x83dc('0x35')+_0x1a71a5},'json':!![]})[_0x83dc('0x2a')](function(_0x19257d){if(_0x19257d[_0x83dc('0x36')]){var _0x1150db=-0x1;if(_[_0x83dc('0x37')](_0x19257d[_0x83dc('0x36')])){if(!_[_0x83dc('0x1d')](_0x2a73ee)){_0x1150db=_[_0x83dc('0x38')](_0x19257d['users'],function(_0x2f8110){return _0x2f8110[_0x83dc('0x39')]===_0x2a73ee;});}if(_0x1150db>=0x0){logger[_0x83dc('0x3a')](_0x83dc('0x3b'));}else{logger[_0x83dc('0x3a')]('Using\x20the\x20admin\x20account!');_0x1150db=_['findIndex'](_0x19257d['users'],function(_0x1021ad){return _0x1021ad['profile'][_0x83dc('0x19')]===_0x83dc('0x3c');});}return _0x19257d[_0x83dc('0x36')][_0x1150db];}else{if(_0x19257d[_0x83dc('0x3d')][_0x83dc('0x3e')][_0x83dc('0x19')]===_0x83dc('0x3c')){logger[_0x83dc('0x3a')](_0x83dc('0x3f'));user=_0x19257d[_0x83dc('0x3d')];return user;}else{logger[_0x83dc('0x2e')](_0x83dc('0x40'),JSON[_0x83dc('0xd')](_0x19257d));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x83dc('0xd')](_0x19257d));}}}else{logger[_0x83dc('0x2e')](_0x83dc('0x40'),JSON[_0x83dc('0xd')](_0x19257d));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x83dc('0xd')](_0x19257d));}})['catch'](function(_0x3e00e8){console[_0x83dc('0x2e')](_0x3e00e8);});}function getZohoUser(_0x1ca216,_0x4ffda4){return new BPromise(function(_0x4bb611,_0x4b8897){request(_0x1ca216)[_0x83dc('0x2a')](function(_0xfc0840){var _0x4d9f98=null;if(_0xfc0840){_0x4d9f98=_0xfc0840[_0x83dc('0x41')][0x0];_0x4d9f98[_0x83dc('0x42')]=_0x4ffda4;}_0x4bb611(_0x4d9f98);})['catch'](function(_0x4892fd){_0x4b8897(_0x4892fd);});});}function createEndUser(_0x1c1d10,_0x4ae190,_0x2967ee,_0x287002,_0x37ce0a,_0x2234c4){var _0x2967ee=getName(_0x2967ee);return request({'method':_0x83dc('0x25'),'uri':'https://www.zohoapis.'+_0x4ae190+'/crm/v2/'+_['startCase'](_0x2234c4[_0x83dc('0x43')])+'s','body':{'data':[{'Last_Name':_0x2967ee[0x1],'First_Name':_0x2967ee[0x0],'Phone':_0x287002,'Owner':{'name':!_[_0x83dc('0x1d')](_0x37ce0a[_0x83dc('0x44')][_0x83dc('0x19')])?_0x37ce0a[_0x83dc('0x44')][_0x83dc('0x19')]:!_[_0x83dc('0x1d')](_0x37ce0a[_0x83dc('0x45')])?_0x37ce0a[_0x83dc('0x45')]+'\x20'+_0x37ce0a[_0x83dc('0x46')]:_0x37ce0a['last_name'],'id':_0x37ce0a['id']}}]},'headers':{'Authorization':_0x83dc('0x35')+_0x1c1d10},'json':!![]})[_0x83dc('0x2a')](function(_0x58eb1a){if(_0x58eb1a&&_0x58eb1a['data'][0x0]['code']===_0x83dc('0x47')){var _0x3dab0f=_0x58eb1a['data'][0x0][_0x83dc('0x48')];_0x3dab0f[_0x83dc('0x42')]=_[_0x83dc('0x49')](_0x2234c4[_0x83dc('0x43')])+'s';return _0x3dab0f;}logger[_0x83dc('0x2e')](_0x83dc('0x40'),JSON[_0x83dc('0xd')](data));throw new Error(_0x83dc('0x4a')+JSON['stringify'](data));})['catch'](function(_0x2f49a0){console[_0x83dc('0x4b')]('CREATE\x20ERROR',_0x2f49a0);});}function getEndUser(_0x21d288,_0x5b6b9d,_0x953cdc,_0x1b1f3f,_0x1c41c3,_0x4e0672,_0x2dfb15){var _0x338cb5={'method':_0x83dc('0x31'),'uri':'','headers':{'Authorization':_0x83dc('0x35')+_0x21d288},'json':!![]};switch(_0x2dfb15[_0x83dc('0x4c')]){case _0x83dc('0x4d'):_0x338cb5[_0x83dc('0x4e')]=_0x83dc('0x4f')+_0x5b6b9d+_0x83dc('0x50')+_0x1c41c3+'))';return getZohoUser(_0x338cb5,'Contacts')[_0x83dc('0x2a')](function(_0x1e95be){if(_0x1e95be)return _0x1e95be;_0x338cb5[_0x83dc('0x4e')]='https://www.zohoapis.'+_0x5b6b9d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1c41c3+'))';return getZohoUser(_0x338cb5,_0x83dc('0x51'))['then'](function(_0x3ccb51){if(_0x3ccb51)return _0x3ccb51;if(_0x2dfb15[_0x83dc('0x43')]!='nothing'){return createEndUser(_0x21d288,_0x5b6b9d,_0x1b1f3f,_0x1c41c3,_0x4e0672,_0x2dfb15);}else{return{};}});});break;case _0x83dc('0x52'):_0x338cb5[_0x83dc('0x4e')]=_0x83dc('0x4f')+_0x5b6b9d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1c41c3+'))';return getZohoUser(_0x338cb5,_0x83dc('0x53'))['then'](function(_0x571fdb){if(_0x571fdb)return _0x571fdb;if(_0x2dfb15[_0x83dc('0x43')]!=_0x83dc('0x54')){return createEndUser(_0x21d288,_0x5b6b9d,_0x1b1f3f,_0x1c41c3,_0x4e0672,_0x2dfb15);}else{return{};}});break;case _0x83dc('0x55'):_0x338cb5[_0x83dc('0x4e')]=_0x83dc('0x4f')+_0x5b6b9d+_0x83dc('0x56')+_0x1c41c3+'))';return getZohoUser(_0x338cb5,_0x83dc('0x51'))[_0x83dc('0x2a')](function(_0x17bb07){if(_0x17bb07)return _0x17bb07;if(_0x2dfb15[_0x83dc('0x43')]!=_0x83dc('0x54')){return createEndUser(_0x21d288,_0x5b6b9d,_0x1b1f3f,_0x1c41c3,_0x4e0672,_0x2dfb15);}else{return{};}});break;}}function getCall(_0x3f36bc,_0x56dd53,_0x4d5bb6,_0x58732d,_0x56421f,_0x7dd286,_0x167229,_0x74deab){logger[_0x83dc('0x3a')](_0x83dc('0x57'));var _0x18f5cb={};_0x18f5cb['Owner']={'name':!_[_0x83dc('0x1d')](_0x58732d['role'][_0x83dc('0x19')])&&!_[_0x83dc('0x1d')](_0x58732d['profile']['name'])&&_0x58732d[_0x83dc('0x3e')][_0x83dc('0x19')]===_0x83dc('0x58')?_0x58732d[_0x83dc('0x44')][_0x83dc('0x19')]:!_[_0x83dc('0x1d')](_0x58732d[_0x83dc('0x45')])?_0x58732d[_0x83dc('0x45')]+'\x20'+_0x58732d[_0x83dc('0x46')]:_0x58732d['last_name'],'id':_0x58732d['id']};_0x18f5cb[_0x83dc('0x59')]=intUtil[_0x83dc('0x5a')](_0x7dd286['Subjects'],_0x167229,'\x20');_0x18f5cb['Description']=intUtil['getString'](_0x7dd286[_0x83dc('0x5b')],_0x167229,'\x0a');if(_0x56421f[_0x83dc('0x42')]===_0x83dc('0x53')){_0x18f5cb['Who_Id']={'name':!_[_0x83dc('0x1d')](_0x56421f[_0x83dc('0x5c')])?_0x56421f[_0x83dc('0x5c')]:!_[_0x83dc('0x1d')](_0x56421f[_0x83dc('0x5d')])?_0x56421f[_0x83dc('0x5d')]+'\x20'+_0x56421f['Last_Name']:_0x56421f['Last_Name'],'id':_0x56421f['id']};}if(_0x56421f[_0x83dc('0x42')]===_0x83dc('0x51')){_0x18f5cb[_0x83dc('0x5e')]={'name':!_['isNil'](_0x56421f[_0x83dc('0x5c')])?_0x56421f[_0x83dc('0x5c')]:!_[_0x83dc('0x1d')](_0x56421f[_0x83dc('0x5d')])?_0x56421f['First_Name']+'\x20'+_0x56421f[_0x83dc('0x5f')]:_0x56421f['Last_Name'],'id':_0x56421f['id']};_0x18f5cb['$se_module']=_[_0x83dc('0x49')](_0x56421f['enduserType']);}if(_0x167229[_0x83dc('0x60')]){_0x18f5cb[_0x83dc('0x61')]=moment['utc'](parseInt(_0x167229['talktime'])*0x3e8)[_0x83dc('0x32')]('mm:ss');}else if(_0x167229[_0x83dc('0x62')]&&_0x167229[_0x83dc('0x63')]){_0x18f5cb['Call_Duration']=moment[_0x83dc('0x64')](moment(_0x167229['endtime'],_0x83dc('0x65'))[_0x83dc('0x66')](moment(_0x167229[_0x83dc('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0x83dc('0x32')](_0x83dc('0x68'));}switch(_0x167229[_0x83dc('0x69')]){case _0x83dc('0x6a'):_0x18f5cb[_0x83dc('0x6b')]=_0x83dc('0x6c');break;case'complete':case _0x83dc('0x6d'):_0x18f5cb[_0x83dc('0x6b')]=_0x83dc('0x6e');break;case _0x83dc('0x6f'):_0x18f5cb['Call_Result']='Rejected';break;case _0x83dc('0x70'):_0x18f5cb['Call_Result']=_0x83dc('0x71');break;case _0x83dc('0x72'):_0x18f5cb[_0x83dc('0x6b')]=_0x83dc('0x73');default:}_0x18f5cb['Call_Start_Time']=(_0x74deab===_0x83dc('0x74')?moment(_0x167229[_0x83dc('0x67')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x167229[_0x83dc('0x75')])[_0x83dc('0x32')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x83dc('0x32')](_0x83dc('0x65'));_0x18f5cb[_0x83dc('0x76')]=_0x74deab||_0x83dc('0x77');_0x18f5cb=_[_0x83dc('0x78')](_0x18f5cb,getCustomFields(_0x7dd286[_0x83dc('0x79')],_0x167229));return request({'method':_0x83dc('0x25'),'uri':_0x83dc('0x4f')+_0x56dd53+_0x83dc('0x7a'),'headers':{'Authorization':_0x83dc('0x35')+_0x3f36bc},'body':{'data':[_0x18f5cb]},'json':!![]})['then'](function(_0x3ca2dc){if(_0x3ca2dc&&_0x3ca2dc[_0x83dc('0x41')][0x0]['code']===_0x83dc('0x47')){logger['info'](_0x83dc('0x7b'));return{'id':_0x3ca2dc['data'][0x0][_0x83dc('0x48')]['id']};}})['catch'](function(_0x5ce958){logger[_0x83dc('0x3a')](_0x83dc('0x7c'),_0x5ce958[_0x83dc('0x30')]);console[_0x83dc('0x4b')](_0x83dc('0x7c'),_0x5ce958);});}exports[_0x83dc('0x7d')]=function(_0x102bc9,_0x2f8ae6,_0x1579cb,_0x145b00,_0x59ddeb,_0x1aea38){var _0x39c8f0,_0x2b1de8,_0x72c398;_0x1aea38['host']=intUtil[_0x83dc('0x7e')](_0x1aea38[_0x83dc('0x7f')]);_0x1aea38[_0x83dc('0x80')]=intUtil['stripTrailingSlash'](_0x1aea38[_0x83dc('0x80')]);if(_0x59ddeb&&_0x59ddeb[_0x83dc('0x81')]){logger[_0x83dc('0x3a')](_0x83dc('0x82'),_0x83dc('0x83'));_0x2f8ae6['recordingURL']=_0x1aea38['serverUrl']+'/api/voice/recordings/'+_0x2f8ae6[_0x83dc('0x84')]+_0x83dc('0x85')+md5(_0x2f8ae6[_0x83dc('0x84')]);}else{_0x2f8ae6[_0x83dc('0x86')]='';}var _0x2808b6=_0x1aea38[_0x83dc('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x1aea38)['then'](function(_0x16380b){_0x72c398=_0x16380b;return getUser(_0x72c398,_0x2808b6,_0x1aea38,_0x145b00['email']);})['then'](function(_0x190cce){_0x39c8f0=_0x190cce;logger[_0x83dc('0x3a')](_0x83dc('0x87'),_0x39c8f0['id']);return getEndUser(_0x72c398,_0x2808b6,_0x1aea38,_0x2f8ae6['calleridname'],_0x2f8ae6[_0x83dc('0x88')],_0x39c8f0,_0x1579cb);})[_0x83dc('0x2a')](function(_0x595094){_0x2b1de8=_0x595094;return getCall(_0x72c398,_0x2808b6,_0x1aea38,_0x39c8f0,_0x2b1de8,_0x1579cb,_0x2f8ae6,_0x83dc('0x77'));})['then'](function(_0x2088e5){if(_0x2088e5){logger[_0x83dc('0x3a')](_0x83dc('0x89'),_0x2088e5['id']);logger[_0x83dc('0x3a')](_0x83dc('0x82'),_0x83dc('0x8a'));emit(util['format'](_0x83dc('0x8b'),_0x145b00['name']),_0x83dc('0x8c'),{'uri':_0x83dc('0x8d')+_0x1aea38[_0x83dc('0x7f')]+_0x83dc('0x8e')+_0x2088e5['id']});}})[_0x83dc('0x2d')](function(_0x507fc3){logger[_0x83dc('0x2e')]('[QUEUE]',JSON[_0x83dc('0xd')](_0x507fc3));});};exports[_0x83dc('0x74')]=function(_0x348167,_0x4137d4,_0x46c39a,_0x32bd9e,_0x620268,_0x56ae60,_0x55a311){var _0x29f1a1,_0x5601dc,_0x1a959e;_0x56ae60[_0x83dc('0x7f')]=intUtil[_0x83dc('0x7e')](_0x56ae60[_0x83dc('0x7f')]);_0x56ae60['serverUrl']=intUtil['stripTrailingSlash'](_0x56ae60[_0x83dc('0x80')]);if(_0x55a311&&_0x55a311['recordingFormat']&&_0x55a311[_0x83dc('0x8f')]!==_0x83dc('0x90')){logger['info'](_0x83dc('0x91'),_0x83dc('0x83'));_0x4137d4[_0x83dc('0x86')]=_0x56ae60[_0x83dc('0x80')]+_0x83dc('0x92')+_0x4137d4['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4137d4[_0x83dc('0x84')]);}var _0x3b7e15=_0x56ae60[_0x83dc('0x7f')]===_0x83dc('0x93')?'eu':_0x83dc('0x94');return getAccessToken(_0x56ae60)['then'](function(_0x5a4ae8){_0x1a959e=_0x5a4ae8;return getUser(_0x1a959e,_0x3b7e15,_0x56ae60,_0x32bd9e[_0x83dc('0x39')]);})[_0x83dc('0x2a')](function(_0x4c8029){_0x29f1a1=_0x4c8029;logger[_0x83dc('0x3a')]('The\x20User\x20ID\x20is:',_0x29f1a1['id']);return getEndUser(_0x1a959e,_0x3b7e15,_0x56ae60,_0x4137d4[_0x83dc('0x95')],_0x4137d4[_0x83dc('0x96')],_0x29f1a1,_0x46c39a);})[_0x83dc('0x2a')](function(_0x44cc8a){_0x5601dc=_0x44cc8a;return getCall(_0x1a959e,_0x3b7e15,_0x56ae60,_0x29f1a1,_0x5601dc,_0x46c39a,_0x4137d4,_0x83dc('0x97'));})[_0x83dc('0x2a')](function(_0x33f662){if(_0x33f662){logger[_0x83dc('0x3a')]('The\x20Call\x20ID\x20is:',_0x33f662['id']);logger[_0x83dc('0x3a')](_0x83dc('0x91'),_0x83dc('0x8a'));emit(util[_0x83dc('0x32')](_0x83dc('0x8b'),_0x32bd9e[_0x83dc('0x19')]),_0x83dc('0x8c'),{'uri':_0x83dc('0x8d')+_0x56ae60['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x33f662['id']});}})['catch'](function(_0x43632d){logger[_0x83dc('0x2e')]('[OUTBOUND]',JSON[_0x83dc('0xd')](_0x43632d));});};exports[_0x83dc('0x98')]=function(_0x474252,_0x54ec9b,_0x1ac527,_0x2de14c,_0x22f23b,_0x1f7e27){var _0x3ffb44,_0x45381a,_0x2f88aa;_0x1f7e27[_0x83dc('0x7f')]=intUtil[_0x83dc('0x7e')](_0x1f7e27['host']);_0x1f7e27[_0x83dc('0x80')]=intUtil[_0x83dc('0x7e')](_0x1f7e27[_0x83dc('0x80')]);if(_0x22f23b&&_0x22f23b[_0x83dc('0x81')]){logger[_0x83dc('0x3a')]('['+_0x54ec9b[_0x83dc('0x69')][_0x83dc('0x99')]()+']',_0x83dc('0x83'));_0x54ec9b[_0x83dc('0x86')]=_0x1f7e27[_0x83dc('0x80')]+'/api/voice/recordings/'+_0x54ec9b[_0x83dc('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x54ec9b[_0x83dc('0x84')]);}else{_0x54ec9b[_0x83dc('0x86')]='';}var _0x34b4de=_0x1f7e27[_0x83dc('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x1f7e27)[_0x83dc('0x2a')](function(_0x5577d7){_0x2f88aa=_0x5577d7;return getUser(_0x2f88aa,_0x34b4de,_0x1f7e27);})[_0x83dc('0x2a')](function(_0x5b6bc4){_0x3ffb44=_0x5b6bc4;logger[_0x83dc('0x3a')](_0x83dc('0x87'),_0x3ffb44['id']);return getEndUser(_0x2f88aa,_0x34b4de,_0x1f7e27,_0x54ec9b['calleridname'],_0x54ec9b[_0x83dc('0x88')],_0x3ffb44,_0x1ac527);})[_0x83dc('0x2a')](function(_0x426660){_0x45381a=_0x426660;return getCall(_0x2f88aa,_0x34b4de,_0x1f7e27,_0x3ffb44,_0x45381a,_0x1ac527,_0x54ec9b,_0x83dc('0x77'));})['then'](function(_0x1571da){if(_0x1571da){logger[_0x83dc('0x3a')](_0x83dc('0x89'),_0x1571da['id']);}})['catch'](function(_0x40e5f7){logger[_0x83dc('0x2e')]('['+_0x54ec9b[_0x83dc('0x69')][_0x83dc('0x99')]()+']',JSON[_0x83dc('0xd')](_0x40e5f7));});}; \ 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 ed5114c..e02aaae 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 _0xe416=['trigger','exec','data2','Script','data3','render','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','mustache','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe416,0x15e));var _0x6e41=function(_0x4ed595,_0x2c2f40){_0x4ed595=_0x4ed595-0x0;var _0x321e2b=_0xe416[_0x4ed595];return _0x321e2b;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x6e41('0x0'));var logger=require(_0x6e41('0x1'))(_0x6e41('0x2'));exports[_0x6e41('0x3')]=function(_0x220a3c,_0x430a98){var _0x364c74=_0x220a3c[_0x6e41('0x4')]?_0x220a3c['data2']:_0x6e41('0x5');var _0x30ffa2=_0x220a3c[_0x6e41('0x6')]?Mustache[_0x6e41('0x7')](_0x220a3c[_0x6e41('0x6')],_0x430a98):_0x430a98;sh['exec'](_0x30ffa2,function(_0x2a301d,_0xe62617,_0x4bd588){if(_0x2a301d!==0x0){logger['error'](util[_0x6e41('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x364c74,_0x30ffa2,_0x2a301d,_0x4bd588));}else{logger[_0x6e41('0x9')](util[_0x6e41('0x8')](_0x6e41('0xa'),_0x364c74,_0x30ffa2,_0xe62617));}});}; \ No newline at end of file +var _0xf964=['trigger','exec','data2','Script','data3','render','format','info','util','shelljs','../../../../config/logger'];(function(_0x4c5013,_0x4198a1){var _0x2d1a74=function(_0x6dd2a){while(--_0x6dd2a){_0x4c5013['push'](_0x4c5013['shift']());}};_0x2d1a74(++_0x4198a1);}(_0xf964,0x194));var _0x4f96=function(_0x581c4a,_0x20ab18){_0x581c4a=_0x581c4a-0x0;var _0x19af22=_0xf964[_0x581c4a];return _0x19af22;};'use strict';var util=require(_0x4f96('0x0'));var sh=require(_0x4f96('0x1'));var Mustache=require('mustache');var logger=require(_0x4f96('0x2'))(_0x4f96('0x3'));exports[_0x4f96('0x4')]=function(_0x5d99dc,_0x3d8a9d){var _0x338b62=_0x5d99dc['data2']?_0x5d99dc[_0x4f96('0x5')]:_0x4f96('0x6');var _0x2cafa7=_0x5d99dc[_0x4f96('0x7')]?Mustache[_0x4f96('0x8')](_0x5d99dc[_0x4f96('0x7')],_0x3d8a9d):_0x3d8a9d;sh[_0x4f96('0x4')](_0x2cafa7,function(_0x254a45,_0x3f6379,_0x66c3e8){if(_0x254a45!==0x0){logger['error'](util[_0x4f96('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x338b62,_0x2cafa7,_0x254a45,_0x66c3e8));}else{logger[_0x4f96('0xa')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x338b62,_0x2cafa7,_0x3f6379));}});}; \ 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 b4f2932..67a6791 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 _0x8047=['stack','toUpperCase','GET','DELETE','POST','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','trigger','data1','data2','data5','number','data6','parse','render','error'];(function(_0x640755,_0x395248){var _0x5a133f=function(_0x42c76e){while(--_0x42c76e){_0x640755['push'](_0x640755['shift']());}};_0x5a133f(++_0x395248);}(_0x8047,0x153));var _0x7804=function(_0x1934fc,_0x437669){_0x1934fc=_0x1934fc-0x0;var _0x4c2de0=_0x8047[_0x1934fc];return _0x4c2de0;};'use strict';var rp=require(_0x7804('0x0'));var util=require(_0x7804('0x1'));var _=require('lodash');var Mustache=require(_0x7804('0x2'));var logger=require(_0x7804('0x3'))(_0x7804('0x4'));exports['exec']=function(_0xac9234,_0x132095){var _0xc29137,_0x4b82bf;var _0x3ec043={'method':_0xac9234[_0x7804('0x5')]['toUpperCase'](),'uri':Mustache['render'](_0xac9234[_0x7804('0x6')],_0x132095),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xac9234[_0x7804('0x7')])===_0x7804('0x8')&&parseInt(_0xac9234[_0x7804('0x7')])>=0x1&&parseInt(_0xac9234[_0x7804('0x7')])<=0xa?parseInt(_0xac9234[_0x7804('0x7')])*0x3e8:0x5*0x3e8};try{_0x3ec043['headers']=_0xac9234[_0x7804('0x9')]?JSON[_0x7804('0xa')](Mustache[_0x7804('0xb')](_0xac9234[_0x7804('0x9')],_0x132095)):{};}catch(_0x552f70){logger[_0x7804('0xc')](_0x552f70[_0x7804('0xd')]);}switch(_0xac9234[_0x7804('0x5')][_0x7804('0xe')]()){case _0x7804('0xf'):case _0x7804('0x10'):_0xc29137=null;_0x3ec043['qs']=_0x132095;break;case _0x7804('0x11'):case'PUT':if(_0xac9234['data7']){try{_0xc29137=JSON[_0x7804('0xa')](Mustache[_0x7804('0xb')](_0xac9234[_0x7804('0x12')],_0x132095));_0x3ec043['body']=_0xc29137;}catch(_0x5768e1){logger[_0x7804('0xc')](_0x5768e1[_0x7804('0xd')]);logger['error'](_0x7804('0x13'));}}else{_0xc29137=_0x132095;_0x3ec043[_0x7804('0x14')]=_0xc29137;}break;}logger[_0x7804('0x15')](util[_0x7804('0x16')](_0x7804('0x17'),_0xac9234['data1'],_0xac9234[_0x7804('0x6')],JSON[_0x7804('0x18')](_0x3ec043)));rp(_0x3ec043)['then'](function(_0x297278){_0xc29137=!_[_0x7804('0x19')](_0xc29137)?',\x20request\x20body:\x20'+_0xc29137:'';_0x4b82bf=typeof _0x297278['body']===_0x7804('0x1a')?JSON[_0x7804('0x18')](_0x297278[_0x7804('0x14')]):_0x297278[_0x7804('0x14')];logger[_0x7804('0x15')](util[_0x7804('0x16')](_0x7804('0x1b'),_0xac9234[_0x7804('0x5')],_0xac9234['data2'],_0x297278['statusCode'],_0x4b82bf));})[_0x7804('0x1c')](function(_0x394943){logger[_0x7804('0xc')](util['format'](_0x7804('0x1d'),_0xac9234[_0x7804('0x5')],_0xac9234[_0x7804('0x6')],_0x394943['statusCode'],_0x394943[_0x7804('0x1e')],_0x394943[_0x7804('0x1f')]));});}; \ No newline at end of file +var _0x091b=['stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','lodash','mustache','toUpperCase','render','data2','data5','number','headers','data6','parse','error','data1','GET','DELETE','POST','PUT','data7'];(function(_0x5c5a71,_0x2e8e35){var _0x221053=function(_0x383a27){while(--_0x383a27){_0x5c5a71['push'](_0x5c5a71['shift']());}};_0x221053(++_0x2e8e35);}(_0x091b,0x8e));var _0xb091=function(_0x2c0989,_0x8ca502){_0x2c0989=_0x2c0989-0x0;var _0x53f766=_0x091b[_0x2c0989];return _0x53f766;};'use strict';var rp=require(_0xb091('0x0'));var util=require('util');var _=require(_0xb091('0x1'));var Mustache=require(_0xb091('0x2'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x37a043,_0x3a81d8){var _0x2c855e,_0x177be4;var _0x4e56c2={'method':_0x37a043['data1'][_0xb091('0x3')](),'uri':Mustache[_0xb091('0x4')](_0x37a043[_0xb091('0x5')],_0x3a81d8),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x37a043[_0xb091('0x6')])===_0xb091('0x7')&&parseInt(_0x37a043[_0xb091('0x6')])>=0x1&&parseInt(_0x37a043['data5'])<=0xa?parseInt(_0x37a043[_0xb091('0x6')])*0x3e8:0x5*0x3e8};try{_0x4e56c2[_0xb091('0x8')]=_0x37a043[_0xb091('0x9')]?JSON[_0xb091('0xa')](Mustache[_0xb091('0x4')](_0x37a043[_0xb091('0x9')],_0x3a81d8)):{};}catch(_0x44cca8){logger[_0xb091('0xb')](_0x44cca8['stack']);}switch(_0x37a043[_0xb091('0xc')]['toUpperCase']()){case _0xb091('0xd'):case _0xb091('0xe'):_0x2c855e=null;_0x4e56c2['qs']=_0x3a81d8;break;case _0xb091('0xf'):case _0xb091('0x10'):if(_0x37a043[_0xb091('0x11')]){try{_0x2c855e=JSON[_0xb091('0xa')](Mustache[_0xb091('0x4')](_0x37a043[_0xb091('0x11')],_0x3a81d8));_0x4e56c2['body']=_0x2c855e;}catch(_0x155f4b){logger[_0xb091('0xb')](_0x155f4b[_0xb091('0x12')]);logger[_0xb091('0xb')](_0xb091('0x13'));}}else{_0x2c855e=_0x3a81d8;_0x4e56c2[_0xb091('0x14')]=_0x2c855e;}break;}logger[_0xb091('0x15')](util[_0xb091('0x16')](_0xb091('0x17'),_0x37a043[_0xb091('0xc')],_0x37a043[_0xb091('0x5')],JSON[_0xb091('0x18')](_0x4e56c2)));rp(_0x4e56c2)['then'](function(_0x3e09b2){_0x2c855e=!_[_0xb091('0x19')](_0x2c855e)?_0xb091('0x1a')+_0x2c855e:'';_0x177be4=typeof _0x3e09b2['body']===_0xb091('0x1b')?JSON[_0xb091('0x18')](_0x3e09b2[_0xb091('0x14')]):_0x3e09b2[_0xb091('0x14')];logger['info'](util[_0xb091('0x16')](_0xb091('0x1c'),_0x37a043['data1'],_0x37a043['data2'],_0x3e09b2[_0xb091('0x1d')],_0x177be4));})['catch'](function(_0xb5e238){logger[_0xb091('0xb')](util[_0xb091('0x16')](_0xb091('0x1e'),_0x37a043[_0xb091('0xc')],_0x37a043[_0xb091('0x5')],_0xb5e238[_0xb091('0x1d')],_0xb5e238['name'],_0xb5e238[_0xb091('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 413d764..fdeb372 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 _0x0301=['rpc','error','message','result','catch','jayson/promise','client','Request','then','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0301,0x181));var _0x1030=function(_0x2bf68e,_0x30428b){_0x2bf68e=_0x2bf68e-0x0;var _0x3b7f44=_0x0301[_0x2bf68e];return _0x3b7f44;};'use strict';var jayson=require(_0x1030('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x1030('0x1')]['http']({'port':0x2329});client[_0x1030('0x2')]=function(_0x112d17,_0x523d39){return new BPromise(function(_0x1e6e5f,_0x36f16){return client['request'](_0x112d17,_0x523d39)[_0x1030('0x3')](function(_0x3ea885){logger[_0x1030('0x4')](_0x1030('0x5'),'routing',_0x112d17,_0x523d39,_0x3ea885);if(_0x3ea885['error']){logger[_0x1030('0x6')](_0x1030('0x5'),'routing',_0x112d17,_0x3ea885[_0x1030('0x6')][_0x1030('0x7')],_0x523d39);return _0x36f16(_0x3ea885[_0x1030('0x6')]['message']);}else{return _0x1e6e5f(_0x3ea885[_0x1030('0x8')]);}})[_0x1030('0x9')](function(_0x3ccc0e){logger[_0x1030('0x6')](_0x1030('0x5'),'routing',_0x112d17,_0x3ccc0e,_0x523d39);return _0x36f16(_0x3ccc0e);});});};module['exports']=client; \ No newline at end of file +var _0xe6d0=['request','then','debug','routing','error','message','catch','rpc','jayson/promise','bluebird','../../config/logger','http'];(function(_0x54f8cd,_0x355bc5){var _0x28e589=function(_0x2f3049){while(--_0x2f3049){_0x54f8cd['push'](_0x54f8cd['shift']());}};_0x28e589(++_0x355bc5);}(_0xe6d0,0xbc));var _0x0e6d=function(_0x4be497,_0x57b16d){_0x4be497=_0x4be497-0x0;var _0x272931=_0xe6d0[_0x4be497];return _0x272931;};'use strict';var jayson=require(_0x0e6d('0x0'));var BPromise=require(_0x0e6d('0x1'));var logger=require(_0x0e6d('0x2'))('routing');var client=jayson['client'][_0x0e6d('0x3')]({'port':0x2329});client['Request']=function(_0xa4e59c,_0x3b4d13){return new BPromise(function(_0x449785,_0x1bac11){return client[_0x0e6d('0x4')](_0xa4e59c,_0x3b4d13)[_0x0e6d('0x5')](function(_0x174316){logger[_0x0e6d('0x6')]('rpc',_0x0e6d('0x7'),_0xa4e59c,_0x3b4d13,_0x174316);if(_0x174316[_0x0e6d('0x8')]){logger[_0x0e6d('0x8')]('rpc',_0x0e6d('0x7'),_0xa4e59c,_0x174316[_0x0e6d('0x8')]['message'],_0x3b4d13);return _0x1bac11(_0x174316[_0x0e6d('0x8')][_0x0e6d('0x9')]);}else{return _0x449785(_0x174316['result']);}})[_0x0e6d('0xa')](function(_0x2d6942){logger[_0x0e6d('0x8')](_0x0e6d('0xb'),_0x0e6d('0x7'),_0xa4e59c,_0x2d6942,_0x3b4d13);return _0x1bac11(_0x2d6942);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 497ec02..d954876 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 _0x7752=['initMailAccounts','refresh','getSettings','loginMailFrequency','catch','log','bluebird','./server','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts'];(function(_0x25d44d,_0xe72322){var _0xb05b5c=function(_0x55a793){while(--_0x55a793){_0x25d44d['push'](_0x25d44d['shift']());}};_0xb05b5c(++_0xe72322);}(_0x7752,0x92));var _0x2775=function(_0x6bd5d8,_0x4bb130){_0x6bd5d8=_0x6bd5d8-0x0;var _0x2f3972=_0x7752[_0x6bd5d8];return _0x2f3972;};'use strict';var BPromise=require(_0x2775('0x0'));var server=require(_0x2775('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x2775('0x2'));var mailAccount=require(_0x2775('0x3'));var setting=require(_0x2775('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x2775('0x5')]()[_0x2775('0x6')](mailAccount[_0x2775('0x7')]())[_0x2775('0x6')](realtime[_0x2775('0x8')]())[_0x2775('0x6')](function(){email[_0x2775('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x2775('0x6')](function(){return initRealtime();})[_0x2775('0x6')](function(){return setting[_0x2775('0xa')]();})[_0x2775('0x6')](function(_0x1f6199){return setInterval(initRealtime,_0x1f6199[_0x2775('0xb')]*0x3e8);})[_0x2775('0xc')](function(_0x225a3f){console[_0x2775('0xd')](_0x225a3f);});}main(); \ No newline at end of file +var _0x5f4d=['mailAccounts','listen','loginMailFrequency','catch','log','bluebird','./server','./realtime','./rpc/mailAccount','./rpc/setting','getMailAccounts','initMailAccounts','then','refresh'];(function(_0x2fc1ac,_0x4e36de){var _0x27c5c5=function(_0x1b4924){while(--_0x1b4924){_0x2fc1ac['push'](_0x2fc1ac['shift']());}};_0x27c5c5(++_0x4e36de);}(_0x5f4d,0x91));var _0xd5f4=function(_0x2c9be1,_0x4c45ce){_0x2c9be1=_0x2c9be1-0x0;var _0x389601=_0x5f4d[_0x2c9be1];return _0x389601;};'use strict';var BPromise=require(_0xd5f4('0x0'));var server=require(_0xd5f4('0x1'));var Realtime=require(_0xd5f4('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xd5f4('0x3'));var setting=require(_0xd5f4('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()['then'](mailAccount[_0xd5f4('0x5')]())['then'](realtime[_0xd5f4('0x6')]())[_0xd5f4('0x7')](function(){email[_0xd5f4('0x8')](realtime[_0xd5f4('0x9')]);return realtime;});}function main(){return server[_0xd5f4('0xa')](realtime,email)[_0xd5f4('0x7')](function(){return initRealtime();})[_0xd5f4('0x7')](function(){return setting['getSettings']();})[_0xd5f4('0x7')](function(_0x4471ad){return setInterval(initRealtime,_0x4471ad[_0xd5f4('0xb')]*0x3e8);})[_0xd5f4('0xc')](function(_0x504af0){console[_0xd5f4('0xd')](_0x504af0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 0653415..383cf34 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 _0x6657=['handleImapEmail','firstName','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','Smtp','verify','verified','exports','moment','bluebird','md5','../../../config/logger','defaults','redis','localhost','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','refresh','hasOwnProperty','email','box','bind','handleImapEnd','error','handleImapError','disabled','handleImapBox','messages'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6657,0xfe));var _0x7665=function(_0x1ff6d1,_0x52f903){_0x1ff6d1=_0x1ff6d1-0x0;var _0x1554cd=_0x6657[_0x1ff6d1];return _0x1554cd;};'use strict';var _=require('lodash');var moment=require(_0x7665('0x0'));var BPromise=require(_0x7665('0x1'));var md5=require(_0x7665('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x7665('0x3'))('email');config['redis']=_[_0x7665('0x4')](config[_0x7665('0x5')],{'host':_0x7665('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7665('0x5')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x7665('0x7'));var md5Accounts={};function EmailChannel(_0x2261d6){logger[_0x7665('0x8')](_0x7665('0x9'));this[_0x7665('0xa')]=_0x2261d6[_0x7665('0xa')];this[_0x7665('0xb')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x7665('0xc')][_0x7665('0xd')]=function(_0x3e58dd){var _0x61f9a7=this[_0x7665('0xa')][_0x3e58dd];var _0x4c3ec8={'id':_0x61f9a7['id'],'name':_0x61f9a7[_0x7665('0xe')],'key':_0x61f9a7[_0x7665('0xf')],'active':_0x61f9a7[_0x7665('0x10')],'Imap':{'status':_0x61f9a7[_0x7665('0x11')][_0x7665('0x12')],'messageStatus':_0x61f9a7[_0x7665('0x11')][_0x7665('0x13')],'total':_0x61f9a7['Imap'][_0x7665('0x14')]}};if(_[_0x7665('0x15')](md5Accounts[_0x3e58dd])){md5Accounts[_0x3e58dd]={};}var _0xd2bd44=md5(JSON[_0x7665('0x16')](_0x4c3ec8));if(md5Accounts[_0x3e58dd][_0x7665('0x2')]!==_0xd2bd44){md5Accounts[_0x3e58dd][_0x7665('0x2')]=_0xd2bd44;io[_0x7665('0xd')]('mailAccount:update',_0x4c3ec8);}};EmailChannel['prototype'][_0x7665('0x17')]=function(_0x27c5cc){for(var _0x4404e9 in _0x27c5cc){if(_0x27c5cc[_0x7665('0x18')](_0x4404e9)){if(_0x27c5cc[_0x4404e9][_0x7665('0x11')]&&_0x27c5cc[_0x4404e9][_0x7665('0x10')]){var _0x29e1fc=_0x27c5cc[_0x4404e9][_0x7665('0x11')];if(!this[_0x7665('0xb')][_0x7665('0x18')](_0x29e1fc['id'])){this['imapAccounts'][_0x29e1fc['id']]=new EmailImap(_0x29e1fc,_0x27c5cc[_0x4404e9][_0x7665('0x19')]);this[_0x7665('0xb')][_0x29e1fc['id']]['on'](_0x7665('0x1a'),this['handleImapBox'][_0x7665('0x1b')](this,_0x4404e9));this[_0x7665('0xb')][_0x29e1fc['id']]['on'](_0x7665('0x19'),this['handleImapEmail'][_0x7665('0x1b')](this,_0x4404e9));this['imapAccounts'][_0x29e1fc['id']]['on']('end',this[_0x7665('0x1c')]['bind'](this,_0x4404e9));this['imapAccounts'][_0x29e1fc['id']]['on'](_0x7665('0x1d'),this[_0x7665('0x1e')][_0x7665('0x1b')](this,_0x4404e9));}}else{if(_[_0x7665('0x15')](this[_0x7665('0xa')][_0x4404e9][_0x7665('0x11')])){this[_0x7665('0xa')][_0x4404e9][_0x7665('0x11')]={};}this['mailAccounts'][_0x4404e9]['Imap'][_0x7665('0x12')]=_0x7665('0x1f');this[_0x7665('0xa')][_0x4404e9][_0x7665('0x11')][_0x7665('0x13')]='';this[_0x7665('0xd')](_0x4404e9);}}}};EmailChannel['prototype'][_0x7665('0x20')]=function(_0x6d7aca,_0x5ad88c){if(this[_0x7665('0xa')][_0x6d7aca]){this[_0x7665('0xa')][_0x6d7aca]['Imap'][_0x7665('0x12')]='connected';this['mailAccounts'][_0x6d7aca][_0x7665('0x11')][_0x7665('0x13')]=_0x5ad88c[_0x7665('0xe')];if(_0x5ad88c[_0x7665('0x21')]){this[_0x7665('0xa')][_0x6d7aca][_0x7665('0x11')][_0x7665('0x14')]=_0x5ad88c[_0x7665('0x21')][_0x7665('0x14')];}return this[_0x7665('0xd')](_0x6d7aca);}};EmailChannel['prototype'][_0x7665('0x22')]=function(_0x246af6,_0x4bd758){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4bd758[_0x7665('0x23')],_0x4bd758['lastName'],_0x4bd758['from'],_0x246af6);if(this[_0x7665('0xa')][_0x246af6]){return mailAccount[_0x7665('0x24')](_0x246af6,_0x4bd758)[_0x7665('0x25')](function(_0x36049f){if(_0x36049f){logger[_0x7665('0x8')]('Mail\x20accepted\x20from\x20routing');}})[_0x7665('0x26')](function(_0x52a472){logger[_0x7665('0x1d')](_0x7665('0x27'),JSON['stringify'](_0x52a472));});}};EmailChannel['prototype'][_0x7665('0x1c')]=function(_0x4d7f3a){if(this[_0x7665('0xa')][_0x4d7f3a]&&this['mailAccounts'][_0x4d7f3a][_0x7665('0x11')]){if(this['imapAccounts'][this[_0x7665('0xa')][_0x4d7f3a][_0x7665('0x11')]['id']]){delete this['imapAccounts'][this[_0x7665('0xa')][_0x4d7f3a][_0x7665('0x11')]['id']];}this['mailAccounts'][_0x4d7f3a][_0x7665('0x11')][_0x7665('0x28')]=moment();this['emit'](_0x4d7f3a);}};EmailChannel[_0x7665('0xc')][_0x7665('0x1e')]=function(_0x2bed8b,_0x5cf078){if(this['mailAccounts'][_0x2bed8b]){this[_0x7665('0xa')][_0x2bed8b][_0x7665('0x11')][_0x7665('0x12')]='error';this['mailAccounts'][_0x2bed8b][_0x7665('0x11')][_0x7665('0x13')]=_0x5cf078;return this[_0x7665('0xd')](_0x2bed8b);}};EmailChannel['prototype'][_0x7665('0x29')]=function(_0x1516ae,_0x373677){return this[_0x7665('0x2a')][_0x7665('0x2b')](_0x1516ae,_0x373677);};EmailChannel[_0x7665('0xc')]['verifySmtp']=function(_0xb1bf3c){var _0x5198d5=this;if(this[_0x7665('0xa')][_0xb1bf3c['id']]){if(_[_0x7665('0x15')](this[_0x7665('0xa')][_0xb1bf3c['id']][_0x7665('0x2c')])){this['mailAccounts'][_0xb1bf3c['id']][_0x7665('0x2c')]={};}this[_0x7665('0xa')][_0xb1bf3c['id']]['Smtp'][_0x7665('0x28')]=moment();return new BPromise(function(_0x1173b6,_0x15d32c){return _0x5198d5[_0x7665('0x2a')][_0x7665('0x2d')](_0xb1bf3c)[_0x7665('0x25')](function(_0x45783d){_0x5198d5[_0x7665('0xa')][_0xb1bf3c['id']][_0x7665('0x2c')]['status']=_0x7665('0x2e');_0x5198d5[_0x7665('0xa')][_0xb1bf3c['id']][_0x7665('0x2c')]['messageStatus']='';_0x5198d5[_0x7665('0xd')](_0xb1bf3c['id']);_0x1173b6(_0x45783d);})[_0x7665('0x26')](function(_0x538313){_0x5198d5['mailAccounts'][_0xb1bf3c['id']][_0x7665('0x2c')][_0x7665('0x12')]='error';_0x5198d5[_0x7665('0xa')][_0xb1bf3c['id']]['Smtp'][_0x7665('0x13')]=_0x538313;_0x5198d5[_0x7665('0xd')](_0xb1bf3c['id']);_0x15d32c(_0x538313);});});}return this['smtp']['verify'](_0xb1bf3c);};module[_0x7665('0x2f')]=EmailChannel; \ No newline at end of file +var _0xa3d4=['lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','verifySmtp','Smtp','lodash','bluebird','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','stringify','md5','refresh','hasOwnProperty','bind','end','handleImapEnd','error','handleImapError','disabled','messageStatus','handleImapBox','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName'];(function(_0x4e50ff,_0x3659dc){var _0x4bb018=function(_0x1f7fa2){while(--_0x1f7fa2){_0x4e50ff['push'](_0x4e50ff['shift']());}};_0x4bb018(++_0x3659dc);}(_0xa3d4,0xde));var _0x4a3d=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xa3d4[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x4a3d('0x0'));var moment=require('moment');var BPromise=require(_0x4a3d('0x1'));var md5=require('md5');var Redis=require(_0x4a3d('0x2'));var config=require(_0x4a3d('0x3'));var logger=require(_0x4a3d('0x4'))(_0x4a3d('0x5'));config['redis']=_[_0x4a3d('0x6')](config[_0x4a3d('0x7')],{'host':_0x4a3d('0x8'),'port':0x18eb});var io=require(_0x4a3d('0x9'))(new Redis(config[_0x4a3d('0x7')]));var EmailImap=require(_0x4a3d('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x4a3d('0xb'));var md5Accounts={};function EmailChannel(_0x97f299){logger[_0x4a3d('0xc')](_0x4a3d('0xd'));this[_0x4a3d('0xe')]=_0x97f299[_0x4a3d('0xe')];this[_0x4a3d('0xf')]={};this[_0x4a3d('0x10')]=new EmailSmtp();}EmailChannel[_0x4a3d('0x11')][_0x4a3d('0x12')]=function(_0x7fca52){var _0x1705c1=this[_0x4a3d('0xe')][_0x7fca52];var _0x3fb276={'id':_0x1705c1['id'],'name':_0x1705c1[_0x4a3d('0x13')],'key':_0x1705c1[_0x4a3d('0x14')],'active':_0x1705c1[_0x4a3d('0x15')],'Imap':{'status':_0x1705c1[_0x4a3d('0x16')][_0x4a3d('0x17')],'messageStatus':_0x1705c1[_0x4a3d('0x16')]['messageStatus'],'total':_0x1705c1[_0x4a3d('0x16')][_0x4a3d('0x18')]}};if(_[_0x4a3d('0x19')](md5Accounts[_0x7fca52])){md5Accounts[_0x7fca52]={};}var _0x5a7e57=md5(JSON[_0x4a3d('0x1a')](_0x3fb276));if(md5Accounts[_0x7fca52][_0x4a3d('0x1b')]!==_0x5a7e57){md5Accounts[_0x7fca52][_0x4a3d('0x1b')]=_0x5a7e57;io['emit']('mailAccount:update',_0x3fb276);}};EmailChannel['prototype'][_0x4a3d('0x1c')]=function(_0x3b9983){for(var _0x160a88 in _0x3b9983){if(_0x3b9983[_0x4a3d('0x1d')](_0x160a88)){if(_0x3b9983[_0x160a88]['Imap']&&_0x3b9983[_0x160a88][_0x4a3d('0x15')]){var _0x18cbf2=_0x3b9983[_0x160a88][_0x4a3d('0x16')];if(!this['imapAccounts'][_0x4a3d('0x1d')](_0x18cbf2['id'])){this['imapAccounts'][_0x18cbf2['id']]=new EmailImap(_0x18cbf2,_0x3b9983[_0x160a88][_0x4a3d('0x5')]);this[_0x4a3d('0xf')][_0x18cbf2['id']]['on']('box',this['handleImapBox'][_0x4a3d('0x1e')](this,_0x160a88));this[_0x4a3d('0xf')][_0x18cbf2['id']]['on'](_0x4a3d('0x5'),this['handleImapEmail'][_0x4a3d('0x1e')](this,_0x160a88));this[_0x4a3d('0xf')][_0x18cbf2['id']]['on'](_0x4a3d('0x1f'),this[_0x4a3d('0x20')]['bind'](this,_0x160a88));this[_0x4a3d('0xf')][_0x18cbf2['id']]['on'](_0x4a3d('0x21'),this[_0x4a3d('0x22')]['bind'](this,_0x160a88));}}else{if(_[_0x4a3d('0x19')](this[_0x4a3d('0xe')][_0x160a88][_0x4a3d('0x16')])){this[_0x4a3d('0xe')][_0x160a88][_0x4a3d('0x16')]={};}this[_0x4a3d('0xe')][_0x160a88]['Imap'][_0x4a3d('0x17')]=_0x4a3d('0x23');this[_0x4a3d('0xe')][_0x160a88][_0x4a3d('0x16')][_0x4a3d('0x24')]='';this[_0x4a3d('0x12')](_0x160a88);}}}};EmailChannel['prototype'][_0x4a3d('0x25')]=function(_0x225a63,_0x329eb){if(this[_0x4a3d('0xe')][_0x225a63]){this[_0x4a3d('0xe')][_0x225a63]['Imap'][_0x4a3d('0x17')]=_0x4a3d('0x26');this[_0x4a3d('0xe')][_0x225a63][_0x4a3d('0x16')][_0x4a3d('0x24')]=_0x329eb['name'];if(_0x329eb[_0x4a3d('0x27')]){this['mailAccounts'][_0x225a63]['Imap'][_0x4a3d('0x18')]=_0x329eb[_0x4a3d('0x27')]['total'];}return this[_0x4a3d('0x12')](_0x225a63);}};EmailChannel[_0x4a3d('0x11')][_0x4a3d('0x28')]=function(_0x869774,_0x35101c){logger['info'](_0x4a3d('0x29'),_0x35101c[_0x4a3d('0x2a')],_0x35101c[_0x4a3d('0x2b')],_0x35101c[_0x4a3d('0x2c')],_0x869774);if(this[_0x4a3d('0xe')][_0x869774]){return mailAccount[_0x4a3d('0x2d')](_0x869774,_0x35101c)[_0x4a3d('0x2e')](function(_0x357a6d){if(_0x357a6d){logger[_0x4a3d('0xc')](_0x4a3d('0x2f'));}})[_0x4a3d('0x30')](function(_0x39a705){logger[_0x4a3d('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4a3d('0x1a')](_0x39a705));});}};EmailChannel[_0x4a3d('0x11')][_0x4a3d('0x20')]=function(_0x538908){if(this['mailAccounts'][_0x538908]&&this[_0x4a3d('0xe')][_0x538908]['Imap']){if(this[_0x4a3d('0xf')][this[_0x4a3d('0xe')][_0x538908][_0x4a3d('0x16')]['id']]){delete this[_0x4a3d('0xf')][this['mailAccounts'][_0x538908][_0x4a3d('0x16')]['id']];}this[_0x4a3d('0xe')][_0x538908]['Imap'][_0x4a3d('0x31')]=moment();this[_0x4a3d('0x12')](_0x538908);}};EmailChannel[_0x4a3d('0x11')][_0x4a3d('0x22')]=function(_0x3ad944,_0x2a2945){if(this[_0x4a3d('0xe')][_0x3ad944]){this[_0x4a3d('0xe')][_0x3ad944][_0x4a3d('0x16')][_0x4a3d('0x17')]=_0x4a3d('0x21');this[_0x4a3d('0xe')][_0x3ad944]['Imap'][_0x4a3d('0x24')]=_0x2a2945;return this[_0x4a3d('0x12')](_0x3ad944);}};EmailChannel[_0x4a3d('0x11')][_0x4a3d('0x32')]=function(_0xaf8771,_0x5d6efd){return this[_0x4a3d('0x10')]['send'](_0xaf8771,_0x5d6efd);};EmailChannel['prototype'][_0x4a3d('0x33')]=function(_0x542e74){var _0x388e2a=this;if(this[_0x4a3d('0xe')][_0x542e74['id']]){if(_[_0x4a3d('0x19')](this['mailAccounts'][_0x542e74['id']][_0x4a3d('0x34')])){this['mailAccounts'][_0x542e74['id']][_0x4a3d('0x34')]={};}this[_0x4a3d('0xe')][_0x542e74['id']][_0x4a3d('0x34')][_0x4a3d('0x31')]=moment();return new BPromise(function(_0x486291,_0x1832c3){return _0x388e2a[_0x4a3d('0x10')]['verify'](_0x542e74)[_0x4a3d('0x2e')](function(_0x4dbfca){_0x388e2a[_0x4a3d('0xe')][_0x542e74['id']][_0x4a3d('0x34')][_0x4a3d('0x17')]='verified';_0x388e2a[_0x4a3d('0xe')][_0x542e74['id']][_0x4a3d('0x34')][_0x4a3d('0x24')]='';_0x388e2a[_0x4a3d('0x12')](_0x542e74['id']);_0x486291(_0x4dbfca);})[_0x4a3d('0x30')](function(_0x3b85a5){_0x388e2a['mailAccounts'][_0x542e74['id']]['Smtp'][_0x4a3d('0x17')]=_0x4a3d('0x21');_0x388e2a[_0x4a3d('0xe')][_0x542e74['id']]['Smtp']['messageStatus']=_0x3b85a5;_0x388e2a['emit'](_0x542e74['id']);_0x1832c3(_0x3b85a5);});});}return this[_0x4a3d('0x10')]['verify'](_0x542e74);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a5550ac..6580d0b 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 _0xd58c=['util','imap','randomstring','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','ready','bind','once','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','getHost','email','handleReady','openBox','handleOpenBox','box','handleCloseBox','end','readUnseen','search','handleReadUnseen','length','message','handleFetchMessage','error','handleFetchError','closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','emit','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path'];(function(_0x55c020,_0x473631){var _0x412aa4=function(_0x41b5cb){while(--_0x41b5cb){_0x55c020['push'](_0x55c020['shift']());}};_0x412aa4(++_0x473631);}(_0xd58c,0xb6));var _0xcd58=function(_0x93d9a8,_0x1b3190){_0x93d9a8=_0x93d9a8-0x0;var _0x447a1d=_0xd58c[_0x93d9a8];return _0x447a1d;};'use strict';var fs=require('fs');var path=require(_0xcd58('0x0'));var util=require(_0xcd58('0x1'));var Imap=require(_0xcd58('0x2'));var _=require('lodash');var rs=require(_0xcd58('0x3'));var simpleParser=require('mailparser')[_0xcd58('0x4')];var Iconv=require('iconv')[_0xcd58('0x5')];var EventEmitter=require(_0xcd58('0x6'))[_0xcd58('0x7')];var utils=require(_0xcd58('0x8'));var logger=require(_0xcd58('0x9'))('email');function EmailImap(_0x546187,_0x3f2c97){this[_0xcd58('0xa')]=_0xcd58('0xb');this[_0xcd58('0xc')]=this[_0xcd58('0xd')](_0x546187,_0x3f2c97);this['imap']=new Imap(this[_0xcd58('0xc')]);this[_0xcd58('0x2')]['once'](_0xcd58('0xe'),this['handleReady'][_0xcd58('0xf')](this));this[_0xcd58('0x2')][_0xcd58('0x10')]('end',this[_0xcd58('0x11')]['bind'](this));this[_0xcd58('0x2')]['on']('error',this[_0xcd58('0x12')][_0xcd58('0xf')](this));this[_0xcd58('0x2')][_0xcd58('0x13')]();}util[_0xcd58('0x14')](EmailImap,EventEmitter);EmailImap[_0xcd58('0x15')][_0xcd58('0xd')]=function(_0x3376f3,_0x4d9a56){var _0x5d0aa3={'connTimeout':_0x3376f3[_0xcd58('0x16')]?_0x3376f3[_0xcd58('0x16')]*0x3e8:0x2710,'authTimeout':_0x3376f3[_0xcd58('0x17')]?_0x3376f3['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x3376f3[_0xcd58('0x18')])){if(_0x3376f3[_0xcd58('0x19')]){_0x5d0aa3[_0xcd58('0x1a')]=_0x3376f3['user'];_0x5d0aa3['password']=_0x3376f3[_0xcd58('0x1b')];}_0x5d0aa3['host']=_0x3376f3[_0xcd58('0x1c')];_0x5d0aa3[_0xcd58('0x1d')]=_0x3376f3[_0xcd58('0x1d')]||0x3e1;if(_0x3376f3[_0xcd58('0x1e')]){_0x5d0aa3['tls']=!![];}else{_0x5d0aa3[_0xcd58('0x1e')]=![];_0x5d0aa3['autotls']='required';}}else{_0x5d0aa3['user']=_0x3376f3[_0xcd58('0x1a')];_0x5d0aa3[_0xcd58('0x1b')]=_0x3376f3[_0xcd58('0x1b')];_0x5d0aa3['host']=utils[_0xcd58('0x1f')](_0x3376f3[_0xcd58('0x18')]);_0x5d0aa3['port']=0x3e1;_0x5d0aa3[_0xcd58('0x1e')]=!![];}_0x5d0aa3[_0xcd58('0x20')]=_0x4d9a56||_0x3376f3[_0xcd58('0x1a')]||'anonymous@xcally.com';return _0x5d0aa3;};EmailImap['prototype'][_0xcd58('0x21')]=function(){this[_0xcd58('0x2')][_0xcd58('0x22')](this[_0xcd58('0xa')],![],this[_0xcd58('0x23')][_0xcd58('0xf')](this));};EmailImap[_0xcd58('0x15')]['handleOpenBox']=function(_0x56e55e,_0x19010d){if(_0x56e55e){this[_0xcd58('0x12')](_0x56e55e,!![]);}else{this['emit'](_0xcd58('0x24'),_0x19010d);this['readUnseen']();}};EmailImap[_0xcd58('0x15')][_0xcd58('0x25')]=function(_0x75bb8e){if(_0x75bb8e){this[_0xcd58('0x12')](_0x75bb8e,!![]);}else{this[_0xcd58('0x2')][_0xcd58('0x26')]();}};EmailImap['prototype'][_0xcd58('0x27')]=function(){this['imap'][_0xcd58('0x28')](['UNSEEN'],this[_0xcd58('0x29')]['bind'](this));};EmailImap[_0xcd58('0x15')]['handleReadUnseen']=function(_0x202069,_0x5871da){if(_0x202069){this[_0xcd58('0x12')](_0x202069,!![]);}else{if(_0x5871da[_0xcd58('0x2a')]){try{var _0x554de0=this[_0xcd58('0x2')]['fetch'](_0x5871da,{'bodies':'','markSeen':!![]});_0x554de0['on'](_0xcd58('0x2b'),this[_0xcd58('0x2c')][_0xcd58('0xf')](this));_0x554de0[_0xcd58('0x10')](_0xcd58('0x2d'),this[_0xcd58('0x2e')]['bind'](this));_0x554de0['once'](_0xcd58('0x26'),this['handleFetchEnd']['bind'](this));}catch(_0x3c846e){logger[_0xcd58('0x2d')](_0x3c846e);}}else{this[_0xcd58('0x2')][_0xcd58('0x2f')](!![],this[_0xcd58('0x25')][_0xcd58('0xf')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x2e5a3a,_0x3d56d1){_0x2e5a3a['on'](_0xcd58('0x30'),this['handleMessageBody'][_0xcd58('0xf')](this));_0x2e5a3a[_0xcd58('0x10')](_0xcd58('0x31'),this['handleMessageAttributes']['bind'](this));_0x2e5a3a[_0xcd58('0x10')](_0xcd58('0x26'),this[_0xcd58('0x32')][_0xcd58('0xf')](this));};EmailImap[_0xcd58('0x15')][_0xcd58('0x33')]=function(_0x1fa80f,_0x24d522){simpleParser(_0x1fa80f,{'Iconv':Iconv},this[_0xcd58('0x34')][_0xcd58('0xf')](this));};EmailImap[_0xcd58('0x15')][_0xcd58('0x35')]=function(_0x17226c){};EmailImap[_0xcd58('0x15')][_0xcd58('0x32')]=function(){};EmailImap[_0xcd58('0x15')][_0xcd58('0x34')]=function(_0x37a094,_0x9d4a09){if(_0x37a094){logger[_0xcd58('0x2d')](_0x37a094);}else{var _0x32e7eb=this;utils['parser'](this[_0xcd58('0xc')],_0x9d4a09,function(_0x3696f9){_0x32e7eb[_0xcd58('0x36')]('email',_0x3696f9);});}};EmailImap[_0xcd58('0x15')][_0xcd58('0x37')]=function(){this['imap'][_0xcd58('0x2f')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xcd58('0x15')]['handleFetchError']=function(_0x5e5da2){this[_0xcd58('0x12')](_0x5e5da2);this[_0xcd58('0x2')][_0xcd58('0x2f')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xcd58('0x15')]['handleEnd']=function(){this[_0xcd58('0x36')](_0xcd58('0x26'));};EmailImap['prototype']['handleError']=function(_0x1f5e98,_0x25e69d){logger[_0xcd58('0x2d')](_0xcd58('0x12'),this[_0xcd58('0xc')][_0xcd58('0x20')],JSON[_0xcd58('0x38')](_0x1f5e98));var _0x3af1c6='';if(_0x1f5e98){if(_0x1f5e98[_0xcd58('0x39')]){_0x3af1c6=_0x1f5e98[_0xcd58('0x39')];}else{for(var _0x18a5ba in _0x1f5e98){if(_0x1f5e98[_0xcd58('0x3a')](_0x18a5ba)){_0x3af1c6+=_[_0xcd58('0x3b')](_0x18a5ba)+':\x20'+_0x1f5e98[_0x18a5ba]+'\x0a';}}}}if(_0x25e69d){this['imap'][_0xcd58('0x26')]();}else{this[_0xcd58('0x36')](_0xcd58('0x2d'),_0x3af1c6);this['emit'](_0xcd58('0x26'));}};module[_0xcd58('0x3c')]=EmailImap; \ No newline at end of file +var _0x6f7f=['user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','handleReady','handleOpenBox','prototype','emit','box','readUnseen','handleCloseBox','search','fetch','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','hasOwnProperty','exports','util','imap','lodash','randomstring','mailparser','iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','bind','once','end','handleEnd','handleError','connect','connTimeout','authTimeout','isNil','authentication'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x6f7f,0x177));var _0xf6f7=function(_0x5e36ec,_0x3f3133){_0x5e36ec=_0x5e36ec-0x0;var _0x269e29=_0x6f7f[_0x5e36ec];return _0x269e29;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xf6f7('0x0'));var Imap=require(_0xf6f7('0x1'));var _=require(_0xf6f7('0x2'));var rs=require(_0xf6f7('0x3'));var simpleParser=require(_0xf6f7('0x4'))['simpleParser'];var Iconv=require(_0xf6f7('0x5'))['Iconv'];var EventEmitter=require(_0xf6f7('0x6'))[_0xf6f7('0x7')];var utils=require(_0xf6f7('0x8'));var logger=require('../../../config/logger')(_0xf6f7('0x9'));function EmailImap(_0x543eb3,_0x33a2b2){this[_0xf6f7('0xa')]=_0xf6f7('0xb');this[_0xf6f7('0xc')]=this[_0xf6f7('0xd')](_0x543eb3,_0x33a2b2);this[_0xf6f7('0x1')]=new Imap(this['account']);this[_0xf6f7('0x1')]['once']('ready',this['handleReady'][_0xf6f7('0xe')](this));this[_0xf6f7('0x1')][_0xf6f7('0xf')](_0xf6f7('0x10'),this[_0xf6f7('0x11')][_0xf6f7('0xe')](this));this['imap']['on']('error',this[_0xf6f7('0x12')][_0xf6f7('0xe')](this));this[_0xf6f7('0x1')][_0xf6f7('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xf6f7('0xd')]=function(_0x4f8d9b,_0x87ae1a){var _0x57c323={'connTimeout':_0x4f8d9b[_0xf6f7('0x14')]?_0x4f8d9b[_0xf6f7('0x14')]*0x3e8:0x2710,'authTimeout':_0x4f8d9b[_0xf6f7('0x15')]?_0x4f8d9b[_0xf6f7('0x15')]*0x3e8:0x1388};if(_[_0xf6f7('0x16')](_0x4f8d9b['service'])){if(_0x4f8d9b[_0xf6f7('0x17')]){_0x57c323[_0xf6f7('0x18')]=_0x4f8d9b['user'];_0x57c323[_0xf6f7('0x19')]=_0x4f8d9b[_0xf6f7('0x19')];}_0x57c323[_0xf6f7('0x1a')]=_0x4f8d9b[_0xf6f7('0x1a')];_0x57c323['port']=_0x4f8d9b[_0xf6f7('0x1b')]||0x3e1;if(_0x4f8d9b[_0xf6f7('0x1c')]){_0x57c323['tls']=!![];}else{_0x57c323[_0xf6f7('0x1c')]=![];_0x57c323[_0xf6f7('0x1d')]=_0xf6f7('0x1e');}}else{_0x57c323[_0xf6f7('0x18')]=_0x4f8d9b[_0xf6f7('0x18')];_0x57c323[_0xf6f7('0x19')]=_0x4f8d9b[_0xf6f7('0x19')];_0x57c323['host']=utils[_0xf6f7('0x1f')](_0x4f8d9b['service']);_0x57c323['port']=0x3e1;_0x57c323[_0xf6f7('0x1c')]=!![];}_0x57c323['email']=_0x87ae1a||_0x4f8d9b[_0xf6f7('0x18')]||_0xf6f7('0x20');return _0x57c323;};EmailImap['prototype'][_0xf6f7('0x21')]=function(){this['imap']['openBox'](this[_0xf6f7('0xa')],![],this[_0xf6f7('0x22')][_0xf6f7('0xe')](this));};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x22')]=function(_0x5d3370,_0x4c1ecd){if(_0x5d3370){this[_0xf6f7('0x12')](_0x5d3370,!![]);}else{this[_0xf6f7('0x24')](_0xf6f7('0x25'),_0x4c1ecd);this[_0xf6f7('0x26')]();}};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x27')]=function(_0x4b6e82){if(_0x4b6e82){this[_0xf6f7('0x12')](_0x4b6e82,!![]);}else{this[_0xf6f7('0x1')][_0xf6f7('0x10')]();}};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x26')]=function(){this[_0xf6f7('0x1')][_0xf6f7('0x28')](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap[_0xf6f7('0x23')]['handleReadUnseen']=function(_0x29661e,_0x35b586){if(_0x29661e){this['handleError'](_0x29661e,!![]);}else{if(_0x35b586['length']){try{var _0x3b85db=this[_0xf6f7('0x1')][_0xf6f7('0x29')](_0x35b586,{'bodies':'','markSeen':!![]});_0x3b85db['on']('message',this[_0xf6f7('0x2a')]['bind'](this));_0x3b85db[_0xf6f7('0xf')](_0xf6f7('0x2b'),this[_0xf6f7('0x2c')][_0xf6f7('0xe')](this));_0x3b85db[_0xf6f7('0xf')](_0xf6f7('0x10'),this[_0xf6f7('0x2d')][_0xf6f7('0xe')](this));}catch(_0x3fbbf2){logger[_0xf6f7('0x2b')](_0x3fbbf2);}}else{this[_0xf6f7('0x1')][_0xf6f7('0x2e')](!![],this['handleCloseBox'][_0xf6f7('0xe')](this));}}};EmailImap['prototype'][_0xf6f7('0x2a')]=function(_0x4704d5,_0x2b5f41){_0x4704d5['on'](_0xf6f7('0x2f'),this[_0xf6f7('0x30')][_0xf6f7('0xe')](this));_0x4704d5[_0xf6f7('0xf')](_0xf6f7('0x31'),this[_0xf6f7('0x32')]['bind'](this));_0x4704d5['once'](_0xf6f7('0x10'),this[_0xf6f7('0x33')][_0xf6f7('0xe')](this));};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x30')]=function(_0x41975f,_0x15d21b){simpleParser(_0x41975f,{'Iconv':Iconv},this[_0xf6f7('0x34')][_0xf6f7('0xe')](this));};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x32')]=function(_0x427115){};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x33')]=function(){};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x34')]=function(_0x4cd474,_0x4d4f3d){if(_0x4cd474){logger[_0xf6f7('0x2b')](_0x4cd474);}else{var _0x1de44f=this;utils[_0xf6f7('0x35')](this[_0xf6f7('0xc')],_0x4d4f3d,function(_0x2e712c){_0x1de44f[_0xf6f7('0x24')]('email',_0x2e712c);});}};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x2d')]=function(){this[_0xf6f7('0x1')][_0xf6f7('0x2e')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xf6f7('0x23')]['handleFetchError']=function(_0x5b75ec){this[_0xf6f7('0x12')](_0x5b75ec);this[_0xf6f7('0x1')][_0xf6f7('0x2e')](!![],this['handleCloseBox'][_0xf6f7('0xe')](this));};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x11')]=function(){this[_0xf6f7('0x24')]('end');};EmailImap[_0xf6f7('0x23')][_0xf6f7('0x12')]=function(_0x49bfca,_0x4788f0){logger[_0xf6f7('0x2b')]('handleError',this[_0xf6f7('0xc')]['email'],JSON['stringify'](_0x49bfca));var _0x5007f6='';if(_0x49bfca){if(_0x49bfca[_0xf6f7('0x36')]){_0x5007f6=_0x49bfca[_0xf6f7('0x36')];}else{for(var _0x160bbd in _0x49bfca){if(_0x49bfca[_0xf6f7('0x37')](_0x160bbd)){_0x5007f6+=_['upperFirst'](_0x160bbd)+':\x20'+_0x49bfca[_0x160bbd]+'\x0a';}}}}if(_0x4788f0){this[_0xf6f7('0x1')]['end']();}else{this[_0xf6f7('0x24')]('error',_0x5007f6);this['emit'](_0xf6f7('0x10'));}};module[_0xf6f7('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 7c484c5..778a0ca 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 _0xa65d=['prototype','send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0xa65d,0x142));var _0xda65=function(_0x230ffd,_0x294b83){_0x230ffd=_0x230ffd-0x0;var _0x158913=_0xa65d[_0x230ffd];return _0x158913;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xda65('0x0'));var inlineBase64=require(_0xda65('0x1'));function EmailSmtp(){}EmailSmtp[_0xda65('0x2')][_0xda65('0x3')]=function(_0x4033c6,_0x1b0128){return new BPromise(function(_0x28bcde,_0x189791){var _0x53459d=nodemailer[_0xda65('0x4')](_0x4033c6);_0x53459d[_0xda65('0x5')](_0xda65('0x6'),inlineBase64());_0x53459d[_0xda65('0x7')](_0x1b0128,function(_0x574a8a,_0x474a3b){if(_0x574a8a){_0x189791(_0x574a8a[_0xda65('0x8')]());}else{_0x28bcde(_0x474a3b);}});});};EmailSmtp['prototype'][_0xda65('0x9')]=function(_0xee0fb){return new BPromise(function(_0xc5275d,_0x5f19eb){var _0x1cbd00=nodemailer[_0xda65('0x4')](_0xee0fb);_0x1cbd00['verify'](function(_0x2d584b,_0x34ee59){if(_0x2d584b){_0x5f19eb(_0x2d584b['toString']());}else{if(_0x34ee59){_0xc5275d(_0x34ee59);}else{_0x5f19eb(_0xda65('0xa'));}}});});};module[_0xda65('0xb')]=EmailSmtp; \ No newline at end of file +var _0xf625=['verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','toString'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf625,0xac));var _0x5f62=function(_0x19ccea,_0x5056b2){_0x19ccea=_0x19ccea-0x0;var _0x149dd4=_0xf625[_0x19ccea];return _0x149dd4;};'use strict';var nodemailer=require(_0x5f62('0x0'));var BPromise=require(_0x5f62('0x1'));var inlineBase64=require(_0x5f62('0x2'));function EmailSmtp(){}EmailSmtp[_0x5f62('0x3')][_0x5f62('0x4')]=function(_0x4233a4,_0x35bdb7){return new BPromise(function(_0x3875aa,_0x35aebc){var _0xca5e79=nodemailer[_0x5f62('0x5')](_0x4233a4);_0xca5e79[_0x5f62('0x6')](_0x5f62('0x7'),inlineBase64());_0xca5e79[_0x5f62('0x8')](_0x35bdb7,function(_0x3e0932,_0x4819f9){if(_0x3e0932){_0x35aebc(_0x3e0932[_0x5f62('0x9')]());}else{_0x3875aa(_0x4819f9);}});});};EmailSmtp[_0x5f62('0x3')][_0x5f62('0xa')]=function(_0x38f3b3){return new BPromise(function(_0x5a21c2,_0x13a231){var _0x247575=nodemailer[_0x5f62('0x5')](_0x38f3b3);_0x247575[_0x5f62('0xa')](function(_0x16b67d,_0x5c246a){if(_0x16b67d){_0x13a231(_0x16b67d['toString']());}else{if(_0x5c246a){_0x5a21c2(_0x5c246a);}else{_0x13a231(_0x5f62('0xb'));}}});});};module[_0x5f62('0xc')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 4c06d9f..266a63a 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 _0x7916=['YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','format','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','@xcally.com','head','name','split','slice','join','Anonymous','pop','isEmpty','generate','test','html','includes','\x20[Attachment:\x20','body','0x1?_0x11c730[_0x6791('0x11')]():'';}return'';}function getMails(_0x5122f9,_0x2a9151){var _0x4c32a1='';for(var _0x3be9f0=0x0;_0x3be9f0<_0x2a9151[_0x6791('0x7')]['length'];_0x3be9f0+=0x1){if(_0x2a9151[_0x6791('0x7')][_0x3be9f0]['address']!==_0x5122f9){if(!_[_0x6791('0x12')](_0x4c32a1)){_0x4c32a1+=',';}_0x4c32a1+=_0x2a9151[_0x6791('0x7')][_0x3be9f0]['name']||_0x2a9151[_0x6791('0x7')][_0x3be9f0][_0x6791('0x8')]||'';_0x4c32a1+='\x20<';_0x4c32a1+=_0x2a9151['value'][_0x3be9f0][_0x6791('0x8')]?_0x2a9151['value'][_0x3be9f0][_0x6791('0x8')]:_0x6791('0x9')+random[_0x6791('0x13')](0x6)+_0x6791('0xa');_0x4c32a1+='>';}}return _0x4c32a1;}function parseEmail(_0x25adbc,_0x2bc0ab,_0x2ba11a){if(_0x2bc0ab['html']){var _0x4a2922=/)<[^<]*)*<\/script>/gi;while(_0x4a2922[_0x6791('0x14')](_0x2bc0ab['html'])){_0x2bc0ab[_0x6791('0x15')]=_0x2bc0ab[_0x6791('0x15')]['replace'](_0x4a2922,'');}if(_0x2bc0ab[_0x6791('0x15')][_0x6791('0x16')](_0x6791('0x17'))){var _0x12d83b=[];_0x2bc0ab['attachments'][_0x6791('0x18')](_0x1b516d=>{_0x12d83b['push'](_0x1b516d['filename']);});var _0x4b23bc=/]+>/g;var _0x372dae=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x502043=_0x2bc0ab[_0x6791('0x15')]['replace'](_0x372dae,'_SRC');var _0x496273=_0x502043[_0x6791('0x19')](_0x4b23bc,_0x6791('0x1a'));for(let _0xd49b84=0x0;_0xd49b84<_0x12d83b['length'];_0xd49b84++){var _0x3def2e=_0x496273[_0x6791('0x19')]('_IMG',_0x6791('0x1b')+_0x12d83b[_0xd49b84]+'\x20]');_0x496273=_0x3def2e;}_0x2bc0ab[_0x6791('0x15')]=_0x496273;}_0x2ba11a['body']=_0x2bc0ab['html'];}else{_0x2ba11a[_0x6791('0x1c')]=_0x2bc0ab['textAsHtml'];}if(_0x2ba11a[_0x6791('0x1c')]){_0x2ba11a[_0x6791('0x1c')]=_0x2ba11a['body'][_0x6791('0x19')](/\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','hotmail','outlook365','outlook.office365.com','lodash'];(function(_0x1b526f,_0x2bfa2a){var _0x4f3a52=function(_0xaf8e5e){while(--_0xaf8e5e){_0x1b526f['push'](_0x1b526f['shift']());}};_0x4f3a52(++_0x2bfa2a);}(_0x4024,0x89));var _0x4402=function(_0x1140fd,_0x3e531b){_0x1140fd=_0x1140fd-0x0;var _0xa52806=_0x4024[_0x1140fd];return _0xa52806;};'use strict';var _=require(_0x4402('0x0'));var moment=require(_0x4402('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x4402('0x2'));var util=require(_0x4402('0x3'));var tnef=require('node-tnef');var logger=require(_0x4402('0x4'))('email');var config=require(_0x4402('0x5'));function getAddress(_0x117f90){var _0x5bdb3f=_['head'](_0x117f90[_0x4402('0x6')]);return _0x5bdb3f&&_0x5bdb3f[_0x4402('0x7')]?_0x5bdb3f[_0x4402('0x7')]:'anonymous'+random[_0x4402('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x5c0b70){var _0x734aae=_['head'](_0x5c0b70['value']);if(_0x734aae&&_0x734aae[_0x4402('0x9')]){var _0x4f56aa=_0x734aae[_0x4402('0x9')]['split'](/\s+/);return _0x4f56aa[_0x4402('0xa')]?_0x4f56aa['slice'](0x0,-0x1)[_0x4402('0xb')]('\x20'):_0x734aae[_0x4402('0x9')];}return'Anonymous';}function getLastName(_0x949ab7){var _0x302c4d=_[_0x4402('0xc')](_0x949ab7['value']);if(_0x302c4d&&_0x302c4d[_0x4402('0x9')]){var _0x34d952=_0x302c4d[_0x4402('0x9')][_0x4402('0xd')](/\s+/);return _0x34d952[_0x4402('0xa')]>0x1?_0x34d952[_0x4402('0xe')]():'';}return'';}function getMails(_0x18c7a8,_0x3c7dd2){var _0x295ac5='';for(var _0x263a57=0x0;_0x263a57<_0x3c7dd2[_0x4402('0x6')][_0x4402('0xa')];_0x263a57+=0x1){if(_0x3c7dd2[_0x4402('0x6')][_0x263a57][_0x4402('0x7')]!==_0x18c7a8){if(!_[_0x4402('0xf')](_0x295ac5)){_0x295ac5+=',';}_0x295ac5+=_0x3c7dd2[_0x4402('0x6')][_0x263a57][_0x4402('0x9')]||_0x3c7dd2[_0x4402('0x6')][_0x263a57][_0x4402('0x7')]||'';_0x295ac5+='\x20<';_0x295ac5+=_0x3c7dd2[_0x4402('0x6')][_0x263a57]['address']?_0x3c7dd2['value'][_0x263a57][_0x4402('0x7')]:_0x4402('0x10')+random['generate'](0x6)+_0x4402('0x11');_0x295ac5+='>';}}return _0x295ac5;}function parseEmail(_0x192855,_0x5cb0c5,_0x38b459){if(_0x5cb0c5['html']){var _0x55cc8c=/)<[^<]*)*<\/script>/gi;while(_0x55cc8c[_0x4402('0x12')](_0x5cb0c5[_0x4402('0x13')])){_0x5cb0c5[_0x4402('0x13')]=_0x5cb0c5['html'][_0x4402('0x14')](_0x55cc8c,'');}if(_0x5cb0c5['html']['includes'](_0x4402('0x15'))){var _0x275c70=[];_0x5cb0c5[_0x4402('0x16')][_0x4402('0x17')](_0x258d10=>{_0x275c70[_0x4402('0x18')](_0x258d10[_0x4402('0x19')]);});var _0x6b1fc5=/]+>/g;var _0x24a9b8=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x4d6846=_0x5cb0c5[_0x4402('0x13')]['replace'](_0x24a9b8,_0x4402('0x1a'));var _0x5ab28d=_0x4d6846[_0x4402('0x14')](_0x6b1fc5,_0x4402('0x1b'));for(let _0x5a43d0=0x0;_0x5a43d0<_0x275c70[_0x4402('0xa')];_0x5a43d0++){var _0x4e9cb5=_0x5ab28d['replace'](_0x4402('0x1b'),_0x4402('0x1c')+_0x275c70[_0x5a43d0]+_0x4402('0x1d'));_0x5ab28d=_0x4e9cb5;}_0x5cb0c5[_0x4402('0x13')]=_0x5ab28d;}_0x38b459[_0x4402('0x1e')]=_0x5cb0c5['html'];}else{_0x38b459[_0x4402('0x1e')]=_0x5cb0c5['textAsHtml'];}if(_0x38b459[_0x4402('0x1e')]){_0x38b459[_0x4402('0x1e')]=_0x38b459[_0x4402('0x1e')]['replace'](/0x0){if(this[_0x3a7935+_0x2abc('0x27')]>0x0&&this[_0x3a7935+_0x2abc('0x28')]>=this[_0x3a7935+_0x2abc('0x27')]){return'maxcapacity';}else{return _0x2abc('0x29');}}else{return _0x2abc('0x2a');}};Agent['prototype'][_0x2abc('0x25')]=function(){var _0x18aaab=[_0x2abc('0x2b'),_0x2abc('0x2c'),_0x2abc('0x2d'),_0x2abc('0x2e'),'sms',_0x2abc('0x2f')];for(var _0x1683df=0x0;_0x1683df<_0x18aaab[_0x2abc('0x30')];_0x1683df+=0x1){var _0x3bf014=this[_0x2abc('0x31')](_0x18aaab[_0x1683df]);if(this[_0x18aaab[_0x1683df]+_0x2abc('0x32')]!==_0x3bf014){this[_0x18aaab[_0x1683df]+_0x2abc('0x33')]=_[_0x2abc('0x34')](moment()['format']('x'));}this[_0x18aaab[_0x1683df]+_0x2abc('0x32')]=_0x3bf014;}var _0x51959c={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x2abc('0xb')],'mailPause':this[_0x2abc('0xc')],'smsPause':this[_0x2abc('0xe')],'faxPause':this[_0x2abc('0xd')],'openchannelPause':this[_0x2abc('0xf')],'chatStatus':this[_0x2abc('0x10')],'chatStatusTime':this[_0x2abc('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2abc('0x13')],'mailStatus':this[_0x2abc('0x14')],'mailStatusTime':this[_0x2abc('0x35')],'mailCapacity':this[_0x2abc('0x16')],'mailCurrentCapacity':this[_0x2abc('0x17')],'faxStatus':this[_0x2abc('0x18')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x2abc('0x1a')],'faxCurrentCapacity':this[_0x2abc('0x1b')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x2abc('0x1c')],'smsCapacity':this[_0x2abc('0x1d')],'smsCurrentCapacity':this[_0x2abc('0x36')],'whatsappStatus':this[_0x2abc('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x2abc('0x20')],'whatsappCurrentCapacity':this[_0x2abc('0x37')],'openchannelStatus':this[_0x2abc('0x38')],'openchannelStatusTime':this[_0x2abc('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x2abc('0x23')],'busy':this[_0x2abc('0x24')],'busyQueue':this[_0x2abc('0x39')]};var _0x1a282c=md5(JSON[_0x2abc('0x3a')](_0x51959c));if(this[_0x2abc('0x2')]!==_0x1a282c){this[_0x2abc('0x2')]=_0x1a282c;io[_0x2abc('0x3b')](_0x2abc('0x3c'),_0x51959c);}};module[_0x2abc('0x3d')]=Agent; \ No newline at end of file +var _0x4fd4=['openchannelCapacity','busy','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailPause','smsCurrentCapacity','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','stringify','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','faxPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus'];(function(_0x5be469,_0x36246c){var _0x35cddb=function(_0x1f58cf){while(--_0x1f58cf){_0x5be469['push'](_0x5be469['shift']());}};_0x35cddb(++_0x36246c);}(_0x4fd4,0x183));var _0x44fd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4fd4[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x44fd('0x0'));var moment=require('moment');var md5=require(_0x44fd('0x1'));var Redis=require(_0x44fd('0x2'));var config=require(_0x44fd('0x3'));config[_0x44fd('0x4')]=_['defaults'](config[_0x44fd('0x4')],{'host':_0x44fd('0x5'),'port':0x18eb});var io=require(_0x44fd('0x6'))(new Redis(config['redis']));function Agent(_0x1e04ec){this['id']=_0x1e04ec['id']||0x0;this[_0x44fd('0x7')]=_0x1e04ec[_0x44fd('0x7')]||'';this[_0x44fd('0x8')]=_0x1e04ec[_0x44fd('0x8')]||!![];this[_0x44fd('0x9')]=_0x1e04ec[_0x44fd('0x9')]||![];this[_0x44fd('0xa')]=_0x1e04ec['chatPause']||![];this['mailPause']=_0x1e04ec['mailPause']||![];this[_0x44fd('0xb')]=_0x1e04ec[_0x44fd('0xb')]||![];this['smsPause']=_0x1e04ec['smsPause']||![];this['openchannelPause']=_0x1e04ec[_0x44fd('0xc')]||![];this[_0x44fd('0xd')]='unknown';this[_0x44fd('0xe')]=0x0;this['chatCapacity']=_0x1e04ec[_0x44fd('0xf')]||0x0;this[_0x44fd('0x10')]=0x0;this[_0x44fd('0x11')]=_0x44fd('0x12');this[_0x44fd('0x13')]=0x0;this[_0x44fd('0x14')]=_0x1e04ec[_0x44fd('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x44fd('0x15')]=_0x44fd('0x12');this[_0x44fd('0x16')]=0x0;this[_0x44fd('0x17')]=_0x1e04ec['faxCapacity']||0x0;this[_0x44fd('0x18')]=0x0;this[_0x44fd('0x19')]=_0x44fd('0x12');this[_0x44fd('0x1a')]=0x0;this[_0x44fd('0x1b')]=_0x1e04ec['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x44fd('0x1c')]=_0x44fd('0x12');this[_0x44fd('0x1d')]=0x0;this['whatsappCapacity']=_0x1e04ec[_0x44fd('0x1e')]||0x0;this[_0x44fd('0x1f')]=0x0;this[_0x44fd('0x20')]=_0x44fd('0x12');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x1e04ec[_0x44fd('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x44fd('0x22')]=![];this['busyQueue']=undefined;this[_0x44fd('0x1')]='';this[_0x44fd('0x23')]();}Agent[_0x44fd('0x24')][_0x44fd('0x25')]=function(_0x19d455){if(this[_0x19d455+_0x44fd('0x26')]>0x0){if(this[_0x19d455+_0x44fd('0x27')]>0x0&&this[_0x19d455+_0x44fd('0x26')]>=this[_0x19d455+_0x44fd('0x27')]){return'maxcapacity';}else{return _0x44fd('0x28');}}else{return'idle';}};Agent[_0x44fd('0x24')][_0x44fd('0x23')]=function(){var _0x48101=[_0x44fd('0x29'),'chat',_0x44fd('0x2a'),_0x44fd('0x2b'),_0x44fd('0x2c'),_0x44fd('0x2d')];for(var _0x3bfd97=0x0;_0x3bfd97<_0x48101[_0x44fd('0x2e')];_0x3bfd97+=0x1){var _0x2d5e14=this[_0x44fd('0x25')](_0x48101[_0x3bfd97]);if(this[_0x48101[_0x3bfd97]+_0x44fd('0x2f')]!==_0x2d5e14){this[_0x48101[_0x3bfd97]+_0x44fd('0x30')]=_[_0x44fd('0x31')](moment()[_0x44fd('0x32')]('x'));}this[_0x48101[_0x3bfd97]+_0x44fd('0x2f')]=_0x2d5e14;}var _0x12881d={'id':this['id'],'name':this[_0x44fd('0x7')],'online':this[_0x44fd('0x8')],'voicePause':this[_0x44fd('0x9')],'chatPause':this[_0x44fd('0xa')],'mailPause':this[_0x44fd('0x33')],'smsPause':this['smsPause'],'faxPause':this[_0x44fd('0xb')],'openchannelPause':this[_0x44fd('0xc')],'chatStatus':this[_0x44fd('0xd')],'chatStatusTime':this[_0x44fd('0xe')],'chatCapacity':this[_0x44fd('0xf')],'chatCurrentCapacity':this[_0x44fd('0x10')],'mailStatus':this[_0x44fd('0x11')],'mailStatusTime':this[_0x44fd('0x13')],'mailCapacity':this[_0x44fd('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x44fd('0x15')],'faxStatusTime':this[_0x44fd('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x44fd('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x44fd('0x1b')],'smsCurrentCapacity':this[_0x44fd('0x34')],'whatsappStatus':this[_0x44fd('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x44fd('0x1f')],'openchannelStatus':this[_0x44fd('0x20')],'openchannelStatusTime':this[_0x44fd('0x35')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x44fd('0x36')],'busy':this['busy'],'busyQueue':this[_0x44fd('0x37')]};var _0x294aee=md5(JSON[_0x44fd('0x38')](_0x12881d));if(this[_0x44fd('0x1')]!==_0x294aee){this[_0x44fd('0x1')]=_0x294aee;io[_0x44fd('0x39')](_0x44fd('0x3a'),_0x12881d);}};module[_0x44fd('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index c85107b..d2fec81 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 _0x55d0=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x55d0,0x1d7));var _0x055d=function(_0x209f9c,_0x4ea385){_0x209f9c=_0x209f9c-0x0;var _0x13c1ef=_0x55d0[_0x209f9c];return _0x13c1ef;};'use strict';var _=require(_0x055d('0x0'));var md5=require(_0x055d('0x1'));var util=require(_0x055d('0x2'));var Redis=require(_0x055d('0x3'));var config=require(_0x055d('0x4'));config[_0x055d('0x5')]=_['defaults'](config[_0x055d('0x5')],{'host':_0x055d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x055d('0x5')]));function ChatQueue(_0x4fb454){this['id']=_0x4fb454['id']||0x0;this[_0x055d('0x7')]=_0x4fb454[_0x055d('0x7')]||'';this[_0x055d('0x8')]=_0x4fb454[_0x055d('0x8')]||0xa;this['strategy']=_0x4fb454[_0x055d('0x9')]||_0x055d('0xa');this['Agents']=_0x4fb454[_0x055d('0xb')];this[_0x055d('0xc')]={};this[_0x055d('0xd')]=0x0;this['md5']='';this[_0x055d('0xe')]();this[_0x055d('0xf')]();}ChatQueue[_0x055d('0x10')][_0x055d('0xe')]=function(){var _0x5858e4=this[_0x055d('0xc')][_0x055d('0x11')];this[_0x055d('0xc')]=_[_0x055d('0x12')](this[_0x055d('0xb')],'id');this[_0x055d('0xc')][_0x055d('0x11')]=_0x5858e4;};ChatQueue[_0x055d('0x10')][_0x055d('0xf')]=function(){this[_0x055d('0x13')]=0x0;this[_0x055d('0x14')]=0x0;for(var _0x4fc9c8=0x0;_0x4fc9c8=0x0?this[_0x055d('0x18')]:0x0;var _0x53b2db={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x202e5c=md5(JSON[_0x055d('0x19')](_0x53b2db));if(this[_0x055d('0x1')]!==_0x202e5c){this['md5']=_0x202e5c;io['to'](util[_0x055d('0x1a')](_0x055d('0x1b'),_0x53b2db['name']))[_0x055d('0x1c')]('chat_queue:save',_0x53b2db);}};module[_0x055d('0x1d')]=ChatQueue; \ No newline at end of file +var _0x476b=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','paused','length','loggedIn','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','../../../config/environment','redis','defaults'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x476b,0x109));var _0xb476=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x476b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb476('0x0'));var md5=require('md5');var util=require(_0xb476('0x1'));var Redis=require('ioredis');var config=require(_0xb476('0x2'));config[_0xb476('0x3')]=_[_0xb476('0x4')](config[_0xb476('0x3')],{'host':_0xb476('0x5'),'port':0x18eb});var io=require(_0xb476('0x6'))(new Redis(config[_0xb476('0x3')]));function ChatQueue(_0x542a96){this['id']=_0x542a96['id']||0x0;this[_0xb476('0x7')]=_0x542a96['name']||'';this['timeout']=_0x542a96[_0xb476('0x8')]||0xa;this[_0xb476('0x9')]=_0x542a96['strategy']||_0xb476('0xa');this['Agents']=_0x542a96[_0xb476('0xb')];this[_0xb476('0xc')]={};this[_0xb476('0xd')]=0x0;this[_0xb476('0xe')]='';this['updateRouting']();this[_0xb476('0xf')]();}ChatQueue[_0xb476('0x10')][_0xb476('0x11')]=function(){var _0x3f3738=this['mapAgentsId'][_0xb476('0x12')];this[_0xb476('0xc')]=_[_0xb476('0x13')](this[_0xb476('0xb')],'id');this['mapAgentsId']['_rr']=_0x3f3738;};ChatQueue[_0xb476('0x10')][_0xb476('0xf')]=function(){this['loggedIn']=0x0;this[_0xb476('0x14')]=0x0;for(var _0x1c158b=0x0;_0x1c158b=0x0?this['available']:0x0;var _0x178532={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb476('0x16')],'name':this['name'],'paused':this[_0xb476('0x14')],'waiting':this['waiting']};var _0x44c3d6=md5(JSON[_0xb476('0x18')](_0x178532));if(this[_0xb476('0xe')]!==_0x44c3d6){this[_0xb476('0xe')]=_0x44c3d6;io['to'](util[_0xb476('0x19')](_0xb476('0x1a'),_0x178532['name']))[_0xb476('0x1b')](_0xb476('0x1c'),_0x178532);}};module[_0xb476('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 00013d1..54634b1 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 _0x8c74=['mapAgentsId','_rr','map','loggedIn','paused','length','online','available','waiting','stringify','format','fax:queue:%s','exports','lodash','md5','util','redis','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype'];(function(_0x96fc7e,_0x27d864){var _0x4677af=function(_0x306b12){while(--_0x306b12){_0x96fc7e['push'](_0x96fc7e['shift']());}};_0x4677af(++_0x27d864);}(_0x8c74,0xcd));var _0x48c7=function(_0x5106c1,_0x13233a){_0x5106c1=_0x5106c1-0x0;var _0x5bcaac=_0x8c74[_0x5106c1];return _0x5bcaac;};'use strict';var _=require(_0x48c7('0x0'));var md5=require(_0x48c7('0x1'));var util=require(_0x48c7('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x48c7('0x3')]=_['defaults'](config[_0x48c7('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x48c7('0x3')]));function FaxQueue(_0x3f4382){this['id']=_0x3f4382['id']||0x0;this[_0x48c7('0x4')]=_0x3f4382[_0x48c7('0x4')]||'';this[_0x48c7('0x5')]=_0x3f4382[_0x48c7('0x5')]||0xa;this['strategy']=_0x3f4382[_0x48c7('0x6')]||'beepall';this[_0x48c7('0x7')]=_0x3f4382[_0x48c7('0x7')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x48c7('0x8')]();this[_0x48c7('0x9')]();}FaxQueue[_0x48c7('0xa')]['updateRouting']=function(){var _0x4ea059=this[_0x48c7('0xb')][_0x48c7('0xc')];this[_0x48c7('0xb')]=_[_0x48c7('0xd')](this['Agents'],'id');this[_0x48c7('0xb')][_0x48c7('0xc')]=_0x4ea059;};FaxQueue[_0x48c7('0xa')][_0x48c7('0x9')]=function(){this[_0x48c7('0xe')]=0x0;this[_0x48c7('0xf')]=0x0;for(var _0x1e4cf6=0x0;_0x1e4cf6=0x0?this[_0x48c7('0x12')]:0x0;var _0x403d4b={'id':this['id'],'available':this[_0x48c7('0x12')],'loggedIn':this[_0x48c7('0xe')],'name':this[_0x48c7('0x4')],'paused':this[_0x48c7('0xf')],'waiting':this[_0x48c7('0x13')]};var _0x3d6d22=md5(JSON[_0x48c7('0x14')](_0x403d4b));if(this[_0x48c7('0x1')]!==_0x3d6d22){this[_0x48c7('0x1')]=_0x3d6d22;io['to'](util[_0x48c7('0x15')](_0x48c7('0x16'),_0x403d4b[_0x48c7('0x4')]))['emit']('fax_queue:save',_0x403d4b);}};module[_0x48c7('0x17')]=FaxQueue; \ No newline at end of file +var _0xe83a=['beepall','Agents','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','available','waiting','format','name','emit','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout'];(function(_0x463f89,_0xf317cf){var _0x1e0849=function(_0x1cd10b){while(--_0x1cd10b){_0x463f89['push'](_0x463f89['shift']());}};_0x1e0849(++_0xf317cf);}(_0xe83a,0x1e4));var _0xae83=function(_0x1ca91c,_0x131938){_0x1ca91c=_0x1ca91c-0x0;var _0x5e858f=_0xe83a[_0x1ca91c];return _0x5e858f;};'use strict';var _=require(_0xae83('0x0'));var md5=require(_0xae83('0x1'));var util=require(_0xae83('0x2'));var Redis=require(_0xae83('0x3'));var config=require(_0xae83('0x4'));config['redis']=_[_0xae83('0x5')](config[_0xae83('0x6')],{'host':_0xae83('0x7'),'port':0x18eb});var io=require(_0xae83('0x8'))(new Redis(config[_0xae83('0x6')]));function FaxQueue(_0xa49249){this['id']=_0xa49249['id']||0x0;this['name']=_0xa49249['name']||'';this[_0xae83('0x9')]=_0xa49249[_0xae83('0x9')]||0xa;this['strategy']=_0xa49249['strategy']||_0xae83('0xa');this[_0xae83('0xb')]=_0xa49249[_0xae83('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xae83('0x1')]='';this['updateRouting']();this[_0xae83('0xc')]();}FaxQueue[_0xae83('0xd')]['updateRouting']=function(){var _0x41d0e8=this[_0xae83('0xe')][_0xae83('0xf')];this[_0xae83('0xe')]=_[_0xae83('0x10')](this[_0xae83('0xb')],'id');this[_0xae83('0xe')][_0xae83('0xf')]=_0x41d0e8;};FaxQueue['prototype'][_0xae83('0xc')]=function(){this[_0xae83('0x11')]=0x0;this[_0xae83('0x12')]=0x0;for(var _0x4e6a0b=0x0;_0x4e6a0b=0x0?this[_0xae83('0x15')]:0x0;var _0x5cd40a={'id':this['id'],'available':this[_0xae83('0x15')],'loggedIn':this[_0xae83('0x11')],'name':this['name'],'paused':this[_0xae83('0x12')],'waiting':this[_0xae83('0x16')]};var _0x453ac9=md5(JSON['stringify'](_0x5cd40a));if(this[_0xae83('0x1')]!==_0x453ac9){this[_0xae83('0x1')]=_0x453ac9;io['to'](util[_0xae83('0x17')]('fax:queue:%s',_0x5cd40a[_0xae83('0x18')]))[_0xae83('0x19')]('fax_queue:save',_0x5cd40a);}};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 2af905c..b8a8c6f 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 _0xfef1=['exports','name','Intervals'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0xfef1,0x70));var _0x1fef=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xfef1[_0x2cfb58];return _0xd99951;};'use strict';function Interval(_0x1c0bdc){this['id']=_0x1c0bdc['id']||0x0;this['name']=_0x1c0bdc[_0x1fef('0x0')]||'';this[_0x1fef('0x1')]=_0x1c0bdc[_0x1fef('0x1')]||{};}module[_0x1fef('0x2')]=Interval; \ No newline at end of file +var _0xe8c8=['Intervals','exports','name'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0xe8c8,0xda));var _0x8e8c=function(_0x2282a9,_0x102db8){_0x2282a9=_0x2282a9-0x0;var _0x31aa76=_0xe8c8[_0x2282a9];return _0x31aa76;};'use strict';function Interval(_0x335c47){this['id']=_0x335c47['id']||0x0;this[_0x8e8c('0x0')]=_0x335c47[_0x8e8c('0x0')]||'';this[_0x8e8c('0x1')]=_0x335c47['Intervals']||{};}module[_0x8e8c('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 9cfb376..c8bc929 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 _0x4bbb=['exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','length','online','loggedIn','mailPause','paused','available','stringify','format','emit','mail_queue:save'];(function(_0x2a3c4a,_0x43df31){var _0x40e61a=function(_0x5416d4){while(--_0x5416d4){_0x2a3c4a['push'](_0x2a3c4a['shift']());}};_0x40e61a(++_0x43df31);}(_0x4bbb,0x14b));var _0xb4bb=function(_0x531567,_0x206255){_0x531567=_0x531567-0x0;var _0x65222=_0x4bbb[_0x531567];return _0x65222;};'use strict';var _=require(_0xb4bb('0x0'));var md5=require(_0xb4bb('0x1'));var util=require(_0xb4bb('0x2'));var Redis=require(_0xb4bb('0x3'));var config=require('../../../config/environment');config[_0xb4bb('0x4')]=_[_0xb4bb('0x5')](config[_0xb4bb('0x4')],{'host':_0xb4bb('0x6'),'port':0x18eb});var io=require(_0xb4bb('0x7'))(new Redis(config[_0xb4bb('0x4')]));function MailQueue(_0x254fe4){this['id']=_0x254fe4['id']||0x0;this[_0xb4bb('0x8')]=_0x254fe4['name']||'';this[_0xb4bb('0x9')]=_0x254fe4[_0xb4bb('0x9')]||0xa;this[_0xb4bb('0xa')]=_0x254fe4[_0xb4bb('0xa')]||'beepall';this[_0xb4bb('0xb')]=_0x254fe4[_0xb4bb('0xb')];this[_0xb4bb('0xc')]={};this[_0xb4bb('0xd')]=0x0;this[_0xb4bb('0x1')]='';this[_0xb4bb('0xe')]();this[_0xb4bb('0xf')]();}MailQueue[_0xb4bb('0x10')][_0xb4bb('0xe')]=function(){var _0x386c9f=this[_0xb4bb('0xc')][_0xb4bb('0x11')];this['mapAgentsId']=_[_0xb4bb('0x12')](this[_0xb4bb('0xb')],'id');this[_0xb4bb('0xc')][_0xb4bb('0x11')]=_0x386c9f;};MailQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x21400a=0x0;_0x21400a=0x0?this[_0xb4bb('0x18')]:0x0;var _0x4b0591={'id':this['id'],'available':this[_0xb4bb('0x18')],'loggedIn':this[_0xb4bb('0x15')],'name':this[_0xb4bb('0x8')],'paused':this[_0xb4bb('0x17')],'waiting':this['waiting']};var _0x56e5b8=md5(JSON[_0xb4bb('0x19')](_0x4b0591));if(this['md5']!==_0x56e5b8){this[_0xb4bb('0x1')]=_0x56e5b8;io['to'](util[_0xb4bb('0x1a')]('mail:queue:%s',_0x4b0591[_0xb4bb('0x8')]))[_0xb4bb('0x1b')](_0xb4bb('0x1c'),_0x4b0591);}};module[_0xb4bb('0x1d')]=MailQueue; \ No newline at end of file +var _0x764f=['updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','md5','mail:queue:%s','mail_queue:save','exports','lodash','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x4e3d61,_0x445ce6){var _0x404b86=function(_0x368609){while(--_0x368609){_0x4e3d61['push'](_0x4e3d61['shift']());}};_0x404b86(++_0x445ce6);}(_0x764f,0xdd));var _0xf764=function(_0x3bbc58,_0x900969){_0x3bbc58=_0x3bbc58-0x0;var _0xaeef47=_0x764f[_0x3bbc58];return _0xaeef47;};'use strict';var _=require(_0xf764('0x0'));var md5=require('md5');var util=require(_0xf764('0x1'));var Redis=require('ioredis');var config=require(_0xf764('0x2'));config[_0xf764('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf764('0x4'))(new Redis(config[_0xf764('0x3')]));function MailQueue(_0x295f78){this['id']=_0x295f78['id']||0x0;this['name']=_0x295f78[_0xf764('0x5')]||'';this['timeout']=_0x295f78[_0xf764('0x6')]||0xa;this[_0xf764('0x7')]=_0x295f78[_0xf764('0x7')]||_0xf764('0x8');this[_0xf764('0x9')]=_0x295f78[_0xf764('0x9')];this[_0xf764('0xa')]={};this[_0xf764('0xb')]=0x0;this['md5']='';this[_0xf764('0xc')]();this[_0xf764('0xd')]();}MailQueue[_0xf764('0xe')][_0xf764('0xc')]=function(){var _0x519aac=this[_0xf764('0xa')][_0xf764('0xf')];this['mapAgentsId']=_[_0xf764('0x10')](this[_0xf764('0x9')],'id');this[_0xf764('0xa')][_0xf764('0xf')]=_0x519aac;};MailQueue['prototype'][_0xf764('0xd')]=function(){this[_0xf764('0x11')]=0x0;this[_0xf764('0x12')]=0x0;for(var _0x1623f7=0x0;_0x1623f7=0x0?this[_0xf764('0x15')]:0x0;var _0x114060={'id':this['id'],'available':this[_0xf764('0x15')],'loggedIn':this[_0xf764('0x11')],'name':this[_0xf764('0x5')],'paused':this[_0xf764('0x12')],'waiting':this[_0xf764('0xb')]};var _0x1bd632=md5(JSON['stringify'](_0x114060));if(this[_0xf764('0x16')]!==_0x1bd632){this['md5']=_0x1bd632;io['to'](util['format'](_0xf764('0x17'),_0x114060[_0xf764('0x5')]))['emit'](_0xf764('0x18'),_0x114060);}};module[_0xf764('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f5317c6..3c4adf8 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 _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(_0x572160,_0x329c30){var _0x4726a4=function(_0x148cd4){while(--_0x148cd4){_0x572160['push'](_0x572160['shift']());}};_0x4726a4(++_0x329c30);}(_0x814b,0x1a2));var _0xb814=function(_0x1ef547,_0x31bfdb){_0x1ef547=_0x1ef547-0x0;var _0x1d697b=_0x814b[_0x1ef547];return _0x1d697b;};'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 +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x7a54,0x106));var _0x47a5=function(_0x54560f,_0x4511df){_0x54560f=_0x54560f-0x0;var _0x22ae0a=_0x7a54[_0x54560f];return _0x22ae0a;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('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 7c95ce8..b189bfe 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 _0xa8eb=['md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x352c2a,_0x1545d9){var _0x23c6e8=function(_0x10f5c9){while(--_0x10f5c9){_0x352c2a['push'](_0x352c2a['shift']());}};_0x23c6e8(++_0x1545d9);}(_0xa8eb,0x179));var _0xba8e=function(_0x3af841,_0x4ea81c){_0x3af841=_0x3af841-0x0;var _0x573ce5=_0xa8eb[_0x3af841];return _0x573ce5;};'use strict';var _=require(_0xba8e('0x0'));var md5=require('md5');var util=require(_0xba8e('0x1'));var Redis=require('ioredis');var config=require(_0xba8e('0x2'));config[_0xba8e('0x3')]=_[_0xba8e('0x4')](config['redis'],{'host':_0xba8e('0x5'),'port':0x18eb});var io=require(_0xba8e('0x6'))(new Redis(config['redis']));function SmsQueue(_0x18a4d0){this['id']=_0x18a4d0['id']||0x0;this['name']=_0x18a4d0[_0xba8e('0x7')]||'';this['timeout']=_0x18a4d0[_0xba8e('0x8')]||0xa;this[_0xba8e('0x9')]=_0x18a4d0['strategy']||'beepall';this[_0xba8e('0xa')]=_0x18a4d0[_0xba8e('0xa')];this[_0xba8e('0xb')]={};this[_0xba8e('0xc')]=0x0;this[_0xba8e('0xd')]='';this[_0xba8e('0xe')]();this[_0xba8e('0xf')]();}SmsQueue[_0xba8e('0x10')][_0xba8e('0xe')]=function(){var _0x5142b1=this[_0xba8e('0xb')][_0xba8e('0x11')];this[_0xba8e('0xb')]=_[_0xba8e('0x12')](this[_0xba8e('0xa')],'id');this['mapAgentsId']['_rr']=_0x5142b1;};SmsQueue[_0xba8e('0x10')][_0xba8e('0xf')]=function(){this[_0xba8e('0x13')]=0x0;this[_0xba8e('0x14')]=0x0;for(var _0xec4952=0x0;_0xec4952=0x0?this[_0xba8e('0x17')]:0x0;var _0xbe34dc={'id':this['id'],'available':this[_0xba8e('0x17')],'loggedIn':this[_0xba8e('0x13')],'name':this[_0xba8e('0x7')],'paused':this[_0xba8e('0x14')],'waiting':this[_0xba8e('0xc')]};var _0x16284d=md5(JSON[_0xba8e('0x18')](_0xbe34dc));if(this[_0xba8e('0xd')]!==_0x16284d){this[_0xba8e('0xd')]=_0x16284d;io['to'](util[_0xba8e('0x19')](_0xba8e('0x1a'),_0xbe34dc[_0xba8e('0x7')]))[_0xba8e('0x1b')](_0xba8e('0x1c'),_0xbe34dc);}};module[_0xba8e('0x1d')]=SmsQueue; \ No newline at end of file +var _0xf194=['stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','paused','length','loggedIn','smsPause','available'];(function(_0xb34472,_0x37a2bc){var _0x221cc2=function(_0x5edae1){while(--_0x5edae1){_0xb34472['push'](_0xb34472['shift']());}};_0x221cc2(++_0x37a2bc);}(_0xf194,0x91));var _0x4f19=function(_0x4b9371,_0x5039af){_0x4b9371=_0x4b9371-0x0;var _0x171629=_0xf194[_0x4b9371];return _0x171629;};'use strict';var _=require(_0x4f19('0x0'));var md5=require(_0x4f19('0x1'));var util=require(_0x4f19('0x2'));var Redis=require(_0x4f19('0x3'));var config=require('../../../config/environment');config[_0x4f19('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4f19('0x5'))(new Redis(config[_0x4f19('0x4')]));function SmsQueue(_0x13ddda){this['id']=_0x13ddda['id']||0x0;this['name']=_0x13ddda[_0x4f19('0x6')]||'';this[_0x4f19('0x7')]=_0x13ddda['timeout']||0xa;this['strategy']=_0x13ddda[_0x4f19('0x8')]||_0x4f19('0x9');this[_0x4f19('0xa')]=_0x13ddda[_0x4f19('0xa')];this['mapAgentsId']={};this[_0x4f19('0xb')]=0x0;this[_0x4f19('0x1')]='';this[_0x4f19('0xc')]();this[_0x4f19('0xd')]();}SmsQueue[_0x4f19('0xe')][_0x4f19('0xc')]=function(){var _0x57b5e9=this['mapAgentsId']['_rr'];this[_0x4f19('0xf')]=_[_0x4f19('0x10')](this['Agents'],'id');this[_0x4f19('0xf')][_0x4f19('0x11')]=_0x57b5e9;};SmsQueue[_0x4f19('0xe')][_0x4f19('0xd')]=function(){this['loggedIn']=0x0;this[_0x4f19('0x12')]=0x0;for(var _0x25e5ce=0x0;_0x25e5ce=0x0?this['available']:0x0;var _0x1d9bf3={'id':this['id'],'available':this[_0x4f19('0x16')],'loggedIn':this[_0x4f19('0x14')],'name':this[_0x4f19('0x6')],'paused':this[_0x4f19('0x12')],'waiting':this['waiting']};var _0xf401d7=md5(JSON[_0x4f19('0x17')](_0x1d9bf3));if(this['md5']!==_0xf401d7){this[_0x4f19('0x1')]=_0xf401d7;io['to'](util[_0x4f19('0x18')](_0x4f19('0x19'),_0x1d9bf3[_0x4f19('0x6')]))['emit'](_0x4f19('0x1a'),_0x1d9bf3);}};module[_0x4f19('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 99824f6..93ad1c5 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 _0x522f=['Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','paused','loggedIn','whatsappPause','available','stringify','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0x1811dc,_0x4b8093){var _0x4544f9=function(_0x51be8a){while(--_0x51be8a){_0x1811dc['push'](_0x1811dc['shift']());}};_0x4544f9(++_0x4b8093);}(_0x522f,0x11e));var _0xf522=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x522f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf522('0x0'));var md5=require(_0xf522('0x1'));var util=require(_0xf522('0x2'));var Redis=require(_0xf522('0x3'));var config=require(_0xf522('0x4'));config[_0xf522('0x5')]=_[_0xf522('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf522('0x7'))(new Redis(config[_0xf522('0x5')]));function WhatsappQueue(_0x5acd2f){this['id']=_0x5acd2f['id']||0x0;this['name']=_0x5acd2f[_0xf522('0x8')]||'';this[_0xf522('0x9')]=_0x5acd2f[_0xf522('0x9')]||0xa;this[_0xf522('0xa')]=_0x5acd2f[_0xf522('0xa')]||'beepall';this[_0xf522('0xb')]=_0x5acd2f[_0xf522('0xb')];this[_0xf522('0xc')]={};this[_0xf522('0xd')]=0x0;this['md5']='';this[_0xf522('0xe')]();this['updateRealtime']();}WhatsappQueue[_0xf522('0xf')][_0xf522('0xe')]=function(){var _0x336cd7=this[_0xf522('0xc')][_0xf522('0x10')];this['mapAgentsId']=_[_0xf522('0x11')](this['Agents'],'id');this[_0xf522('0xc')][_0xf522('0x10')]=_0x336cd7;};WhatsappQueue['prototype'][_0xf522('0x12')]=function(){this['loggedIn']=0x0;this[_0xf522('0x13')]=0x0;for(var _0x40c6c3=0x0;_0x40c6c3=0x0?this[_0xf522('0x16')]:0x0;var _0x53b5da={'id':this['id'],'available':this[_0xf522('0x16')],'loggedIn':this[_0xf522('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xf522('0xd')]};var _0x4b21f5=md5(JSON[_0xf522('0x17')](_0x53b5da));if(this[_0xf522('0x1')]!==_0x4b21f5){this[_0xf522('0x1')]=_0x4b21f5;io['to'](util['format']('whatsapp:queue:%s',_0x53b5da[_0xf522('0x8')]))[_0xf522('0x18')](_0xf522('0x19'),_0x53b5da);}};module[_0xf522('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xb6b2=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','_rr','map','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment'];(function(_0x525e58,_0x245928){var _0x4a44f3=function(_0xa4fd13){while(--_0xa4fd13){_0x525e58['push'](_0x525e58['shift']());}};_0x4a44f3(++_0x245928);}(_0xb6b2,0x1e2));var _0x2b6b=function(_0x5d66ec,_0x17f77b){_0x5d66ec=_0x5d66ec-0x0;var _0x3089d=_0xb6b2[_0x5d66ec];return _0x3089d;};'use strict';var _=require(_0x2b6b('0x0'));var md5=require(_0x2b6b('0x1'));var util=require(_0x2b6b('0x2'));var Redis=require('ioredis');var config=require(_0x2b6b('0x3'));config['redis']=_['defaults'](config[_0x2b6b('0x4')],{'host':_0x2b6b('0x5'),'port':0x18eb});var io=require(_0x2b6b('0x6'))(new Redis(config[_0x2b6b('0x4')]));function WhatsappQueue(_0x88fe9d){this['id']=_0x88fe9d['id']||0x0;this['name']=_0x88fe9d[_0x2b6b('0x7')]||'';this[_0x2b6b('0x8')]=_0x88fe9d['timeout']||0xa;this[_0x2b6b('0x9')]=_0x88fe9d[_0x2b6b('0x9')]||_0x2b6b('0xa');this[_0x2b6b('0xb')]=_0x88fe9d[_0x2b6b('0xb')];this[_0x2b6b('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x2b6b('0xd')]();}WhatsappQueue[_0x2b6b('0xe')]['updateRouting']=function(){var _0x178423=this['mapAgentsId'][_0x2b6b('0xf')];this[_0x2b6b('0xc')]=_[_0x2b6b('0x10')](this[_0x2b6b('0xb')],'id');this[_0x2b6b('0xc')][_0x2b6b('0xf')]=_0x178423;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x2b6b('0x11')]=0x0;this[_0x2b6b('0x12')]=0x0;for(var _0x4d9d27=0x0;_0x4d9d27=0x0?this[_0x2b6b('0x15')]:0x0;var _0x48656a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2b6b('0x11')],'name':this[_0x2b6b('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x17f12c=md5(JSON[_0x2b6b('0x16')](_0x48656a));if(this['md5']!==_0x17f12c){this[_0x2b6b('0x1')]=_0x17f12c;io['to'](util[_0x2b6b('0x17')](_0x2b6b('0x18'),_0x48656a[_0x2b6b('0x7')]))['emit'](_0x2b6b('0x19'),_0x48656a);}};module[_0x2b6b('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 8cf068f..84feb51 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 5a379bc..55fc1d7 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 _0x079b=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x3d1cef,_0x3a09fa){var _0x2f6bd2=function(_0x4ab0a6){while(--_0x4ab0a6){_0x3d1cef['push'](_0x3d1cef['shift']());}};_0x2f6bd2(++_0x3a09fa);}(_0x079b,0xcb));var _0xb079=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x079b[_0x38c699];return _0x3b1ded;};'use strict';var client=require(_0xb079('0x0'));exports['update']=function(_0x18ee22,_0x46c06c){return client[_0xb079('0x1')]('UpdateChatInteraction',{'body':_0x46c06c,'options':{'where':{'id':_0x18ee22}},'log':_0xb079('0x2')});};exports[_0xb079('0x3')]=function(_0x14eaa0,_0x2a6027){return client[_0xb079('0x1')](_0xb079('0x4'),{'body':_0x2a6027,'options':{'where':{'id':_0x14eaa0}},'log':_0xb079('0x5')});}; \ No newline at end of file +var _0x6fb3=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x2f8b3a,_0x3dcb42){var _0x23fb19=function(_0x5edaaa){while(--_0x5edaaa){_0x2f8b3a['push'](_0x2f8b3a['shift']());}};_0x23fb19(++_0x3dcb42);}(_0x6fb3,0x6a));var _0x36fb=function(_0x2abc17,_0x4a52c9){_0x2abc17=_0x2abc17-0x0;var _0x662d5=_0x6fb3[_0x2abc17];return _0x662d5;};'use strict';var client=require(_0x36fb('0x0'));exports[_0x36fb('0x1')]=function(_0x107d7f,_0x1e7943){return client[_0x36fb('0x2')](_0x36fb('0x3'),{'body':_0x1e7943,'options':{'where':{'id':_0x107d7f}},'log':_0x36fb('0x4')});};exports[_0x36fb('0x5')]=function(_0x477b1c,_0x2307e5){return client['Request'](_0x36fb('0x6'),{'body':_0x2307e5,'options':{'where':{'id':_0x477b1c}},'log':_0x36fb('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1f71195..7279b3c 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 _0x90b2=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x46107a,_0x2ab8ee){var _0x5454b9=function(_0xc5af59){while(--_0xc5af59){_0x46107a['push'](_0x46107a['shift']());}};_0x5454b9(++_0x2ab8ee);}(_0x90b2,0x1d6));var _0x290b=function(_0x13ab22,_0x4cb699){_0x13ab22=_0x13ab22-0x0;var _0x220300=_0x90b2[_0x13ab22];return _0x220300;};'use strict';var client=require(_0x290b('0x0'));exports['create']=function(_0x581428){return client[_0x290b('0x1')](_0x290b('0x2'),{'body':_0x581428,'log':_0x290b('0x3')});}; \ No newline at end of file +var _0x02b3=['CreateChatMessage','createChatMessage','../client'];(function(_0x5970fc,_0x22f9a1){var _0xe4a709=function(_0x54edb6){while(--_0x54edb6){_0x5970fc['push'](_0x5970fc['shift']());}};_0xe4a709(++_0x22f9a1);}(_0x02b3,0x19d));var _0x302b=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x02b3[_0x193e28];return _0x20ef59;};'use strict';var client=require(_0x302b('0x0'));exports['create']=function(_0x27f128){return client['Request'](_0x302b('0x1'),{'body':_0x27f128,'log':_0x302b('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index f9809b7..cc63fef 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 _0x4fd7=['Request','GetChatQueue','strategy','User','name','chatPause','../client','getChatQueues'];(function(_0x38fe26,_0x1189c1){var _0x58db69=function(_0x1d2149){while(--_0x1d2149){_0x38fe26['push'](_0x38fe26['shift']());}};_0x58db69(++_0x1189c1);}(_0x4fd7,0xe6));var _0x74fd=function(_0x28c8de,_0x40bb08){_0x28c8de=_0x28c8de-0x0;var _0x150be4=_0x4fd7[_0x28c8de];return _0x150be4;};'use strict';var client=require(_0x74fd('0x0'));exports[_0x74fd('0x1')]=function(){return function(){return client[_0x74fd('0x2')](_0x74fd('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x74fd('0x4')],'include':[{'model':_0x74fd('0x5'),'as':'Agents','attributes':['id',_0x74fd('0x6'),'online',_0x74fd('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x8ba0=['name','User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x39f21e,_0x2b2496){_0x39f21e=_0x39f21e-0x0;var _0x51331b=_0x8ba0[_0x39f21e];return _0x51331b;};'use strict';var client=require(_0x08ba('0x0'));exports[_0x08ba('0x1')]=function(){return function(){return client[_0x08ba('0x2')](_0x08ba('0x3'),{'options':{'raw':![],'attributes':['id',_0x08ba('0x4'),'timeout','strategy'],'include':[{'model':_0x08ba('0x5'),'as':_0x08ba('0x6'),'attributes':['id',_0x08ba('0x4'),_0x08ba('0x7'),_0x08ba('0x8')]}]},'log':_0x08ba('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 77d1f6a..573e8c6 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 _0x3cd1=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0x3cd1,0x112));var _0x13cd=function(_0x36ccf0,_0x3fa6a6){_0x36ccf0=_0x36ccf0-0x0;var _0x416aed=_0x3cd1[_0x36ccf0];return _0x416aed;};'use strict';var client=require('../client');exports[_0x13cd('0x0')]=function(_0xf3275){return client[_0x13cd('0x1')](_0x13cd('0x2'),{'body':_0xf3275,'log':_0x13cd('0x2')});};exports[_0x13cd('0x3')]=function(_0x1d5db8,_0x5d0e7){return client['Request'](_0x13cd('0x4'),{'body':_0x5d0e7,'options':{'where':{'uniqueid':_0x1d5db8},'order':[['id',_0x13cd('0x5')]],'limit':0x1},'log':_0x13cd('0x4')});}; \ No newline at end of file +var _0xe600=['update','UpdateChatQueueReport','DESC','create','Request','CreateChatQueueReport'];(function(_0x528c26,_0x40cc85){var _0x43bbd1=function(_0x252a07){while(--_0x252a07){_0x528c26['push'](_0x528c26['shift']());}};_0x43bbd1(++_0x40cc85);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0x0e60('0x0')]=function(_0x4f3586){return client[_0x0e60('0x1')](_0x0e60('0x2'),{'body':_0x4f3586,'log':_0x0e60('0x2')});};exports[_0x0e60('0x3')]=function(_0x3c7873,_0x276bdb){return client[_0x0e60('0x1')](_0x0e60('0x4'),{'body':_0x276bdb,'options':{'where':{'uniqueid':_0x3c7873},'order':[['id',_0x0e60('0x5')]],'limit':0x1},'log':_0x0e60('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 12a0495..d547e54 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5602d4,_0x5a74f9){var _0x55e5ae=function(_0x184a4b){while(--_0x184a4b){_0x5602d4['push'](_0x5602d4['shift']());}};_0x55e5ae(++_0x5a74f9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x7a54,0x106));var _0x47a5=function(_0x4d407f,_0x3c461e){_0x4d407f=_0x4d407f-0x0;var _0x2672e8=_0x7a54[_0x4d407f];return _0x2672e8;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 7e6dcff..1b9eb4d 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 _0xf053=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf053,0x185));var _0x3f05=function(_0x913743,_0x1ced1f){_0x913743=_0x913743-0x0;var _0x523703=_0xf053[_0x913743];return _0x523703;};'use strict';var client=require(_0x3f05('0x0'));exports[_0x3f05('0x1')]=function(_0x547a79){return client[_0x3f05('0x2')](_0x3f05('0x3'),{'body':_0x547a79,'log':_0x3f05('0x4')});}; \ No newline at end of file +var _0x8d94=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8d94,0x1c0));var _0x48d9=function(_0x525842,_0x266be6){_0x525842=_0x525842-0x0;var _0xcc268=_0x8d94[_0x525842];return _0xcc268;};'use strict';var client=require(_0x48d9('0x0'));exports['create']=function(_0x203a27){return client[_0x48d9('0x1')](_0x48d9('0x2'),{'body':_0x203a27,'log':_0x48d9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 391597b..bb6d833 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 _0x1f59=['getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','Agents','online'];(function(_0x45050c,_0x2c514e){var _0x43be36=function(_0x48cb3a){while(--_0x48cb3a){_0x45050c['push'](_0x45050c['shift']());}};_0x43be36(++_0x2c514e);}(_0x1f59,0xd8));var _0x91f5=function(_0x453a1e,_0x483e10){_0x453a1e=_0x453a1e-0x0;var _0x20f87e=_0x1f59[_0x453a1e];return _0x20f87e;};'use strict';var client=require('../client');exports[_0x91f5('0x0')]=function(){return function(){return client[_0x91f5('0x1')](_0x91f5('0x2'),{'options':{'raw':![],'attributes':['id',_0x91f5('0x3'),_0x91f5('0x4'),_0x91f5('0x5')],'include':[{'model':'User','as':_0x91f5('0x6'),'attributes':['id',_0x91f5('0x3'),_0x91f5('0x7'),'faxPause']}]},'log':_0x91f5('0x0')});};}; \ No newline at end of file +var _0x9040=['name','timeout','strategy','User','Agents','faxPause','getFaxQueues','Request','GetFaxQueue'];(function(_0xa1bb3b,_0x1faa37){var _0x54e78f=function(_0x3846f7){while(--_0x3846f7){_0xa1bb3b['push'](_0xa1bb3b['shift']());}};_0x54e78f(++_0x1faa37);}(_0x9040,0x7b));var _0x0904=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9040[_0x6c993a];return _0x27f547;};'use strict';var client=require('../client');exports[_0x0904('0x0')]=function(){return function(){return client[_0x0904('0x1')](_0x0904('0x2'),{'options':{'raw':![],'attributes':['id',_0x0904('0x3'),_0x0904('0x4'),_0x0904('0x5')],'include':[{'model':_0x0904('0x6'),'as':_0x0904('0x7'),'attributes':['id',_0x0904('0x3'),'online',_0x0904('0x8')]}]},'log':_0x0904('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 8c7ab3e..5759e03 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 _0x7c40=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x4d230c,_0x3862fd){var _0x16b044=function(_0x3d61f6){while(--_0x3d61f6){_0x4d230c['push'](_0x4d230c['shift']());}};_0x16b044(++_0x3862fd);}(_0x7c40,0xc7));var _0x07c4=function(_0x1e7628,_0x1fc61e){_0x1e7628=_0x1e7628-0x0;var _0x3c15c0=_0x7c40[_0x1e7628];return _0x3c15c0;};'use strict';var client=require(_0x07c4('0x0'));exports[_0x07c4('0x1')]=function(_0x33809b){return client[_0x07c4('0x2')]('CreateFaxQueueReport',{'body':_0x33809b,'log':_0x07c4('0x3')});};exports[_0x07c4('0x4')]=function(_0x30eb4d,_0x2e271e){return client[_0x07c4('0x2')](_0x07c4('0x5'),{'body':_0x2e271e,'options':{'where':{'uniqueid':_0x30eb4d},'order':[['id',_0x07c4('0x6')]],'limit':0x1},'log':_0x07c4('0x5')});}; \ No newline at end of file +var _0x946b=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x35dca8,_0x2e6bb8){var _0x423cd8=function(_0x5e0ddb){while(--_0x5e0ddb){_0x35dca8['push'](_0x35dca8['shift']());}};_0x423cd8(++_0x2e6bb8);}(_0x946b,0x1a5));var _0xb946=function(_0x1298d5,_0x445186){_0x1298d5=_0x1298d5-0x0;var _0x2c71d2=_0x946b[_0x1298d5];return _0x2c71d2;};'use strict';var client=require(_0xb946('0x0'));exports[_0xb946('0x1')]=function(_0x591ccd){return client[_0xb946('0x2')](_0xb946('0x3'),{'body':_0x591ccd,'log':_0xb946('0x3')});};exports['update']=function(_0x4256de,_0x3e3d32){return client['Request'](_0xb946('0x4'),{'body':_0x3e3d32,'options':{'where':{'uniqueid':_0x4256de},'order':[['id',_0xb946('0x5')]],'limit':0x1},'log':_0xb946('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2295087..54992da 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 _0xce7a=['GetInterval','Intervals','name','interval','getIntervals','Request'];(function(_0x544d6e,_0x754a61){var _0xceeec4=function(_0x3ea5c5){while(--_0x3ea5c5){_0x544d6e['push'](_0x544d6e['shift']());}};_0xceeec4(++_0x754a61);}(_0xce7a,0x13c));var _0xace7=function(_0x53911f,_0x4eef81){_0x53911f=_0x53911f-0x0;var _0x3816f3=_0xce7a[_0x53911f];return _0x3816f3;};'use strict';var client=require('../client');exports[_0xace7('0x0')]=function(){return function(){return client[_0xace7('0x1')](_0xace7('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0xace7('0x3'),'attributes':['id',_0xace7('0x4'),_0xace7('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x7682=['GetInterval','name','Interval','getIntervals','../client'];(function(_0x29de86,_0x1427d5){var _0x25d145=function(_0x1c7a8b){while(--_0x1c7a8b){_0x29de86['push'](_0x29de86['shift']());}};_0x25d145(++_0x1427d5);}(_0x7682,0xb8));var _0x2768=function(_0x5c8a86,_0x5dc2f0){_0x5c8a86=_0x5c8a86-0x0;var _0x4aa0e8=_0x7682[_0x5c8a86];return _0x4aa0e8;};'use strict';var client=require(_0x2768('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0x2768('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2768('0x2')],'include':[{'model':_0x2768('0x3'),'as':'Intervals','attributes':['id','name','interval']}]},'log':_0x2768('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c84ec61..c06aca3 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 _0xbbbc=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x4232a8,_0x295a1e){_0x4232a8=_0x4232a8-0x0;var _0x26c6ca=_0xbbbc[_0x4232a8];return _0x26c6ca;};'use strict';var client=require(_0xcbbb('0x0'));exports[_0xcbbb('0x1')]=function(_0x4314a8,_0x4538f9){return client[_0xcbbb('0x2')](_0xcbbb('0x3'),{'body':_0x4538f9,'options':{'where':{'id':_0x4314a8}},'log':_0xcbbb('0x4')});};exports['addTags']=function(_0xb1ad23,_0x938376){return client[_0xcbbb('0x2')](_0xcbbb('0x5'),{'body':_0x938376,'options':{'where':{'id':_0xb1ad23}},'log':_0xcbbb('0x6')});}; \ No newline at end of file +var _0x1c9a=['updateMailInteraction','AddTagsToMailInteraction','../client','Request','UpdateMailInteraction'];(function(_0xc5c9ac,_0x57c492){var _0x3f4606=function(_0x2aa448){while(--_0x2aa448){_0xc5c9ac['push'](_0xc5c9ac['shift']());}};_0x3f4606(++_0x57c492);}(_0x1c9a,0x98));var _0xa1c9=function(_0x37f3e1,_0x5c48e9){_0x37f3e1=_0x37f3e1-0x0;var _0x5d4d40=_0x1c9a[_0x37f3e1];return _0x5d4d40;};'use strict';var client=require(_0xa1c9('0x0'));exports['update']=function(_0x470dcd,_0x5c45c5){return client[_0xa1c9('0x1')](_0xa1c9('0x2'),{'body':_0x5c45c5,'options':{'where':{'id':_0x470dcd}},'log':_0xa1c9('0x3')});};exports['addTags']=function(_0x21c0fc,_0x45d1f7){return client[_0xa1c9('0x1')](_0xa1c9('0x4'),{'body':_0x45d1f7,'options':{'where':{'id':_0x21c0fc}},'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 6249cb3..d9538bd 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 _0x1198=['create','Request','CreateMailMessage'];(function(_0x573e3b,_0x193d60){var _0x3321e8=function(_0x3ee6dc){while(--_0x3ee6dc){_0x573e3b['push'](_0x573e3b['shift']());}};_0x3321e8(++_0x193d60);}(_0x1198,0xc6));var _0x8119=function(_0xf905e2,_0xb11c99){_0xf905e2=_0xf905e2-0x0;var _0x1713b6=_0x1198[_0xf905e2];return _0x1713b6;};'use strict';var client=require('../client');exports[_0x8119('0x0')]=function(_0x10e808){return client[_0x8119('0x1')](_0x8119('0x2'),{'body':_0x10e808,'log':'createMailMessage'});}; \ No newline at end of file +var _0x607c=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x2f6452,_0x2b6930){var _0x188753=function(_0x332323){while(--_0x332323){_0x2f6452['push'](_0x2f6452['shift']());}};_0x188753(++_0x2b6930);}(_0x607c,0x13c));var _0xc607=function(_0x5a5f95,_0x53284b){_0x5a5f95=_0x5a5f95-0x0;var _0x316159=_0x607c[_0x5a5f95];return _0x316159;};'use strict';var client=require(_0xc607('0x0'));exports[_0xc607('0x1')]=function(_0x4e1d3a){return client[_0xc607('0x2')](_0xc607('0x3'),{'body':_0x4e1d3a,'log':_0xc607('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index d668d2e..14030e5 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 _0x10dc=['name','online','mailPause','../client','getMailQueues','GetMailQueue','timeout','strategy','User','Agents'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0x10dc,0x107));var _0xc10d=function(_0x353847,_0x5c84de){_0x353847=_0x353847-0x0;var _0x40d8a6=_0x10dc[_0x353847];return _0x40d8a6;};'use strict';var client=require(_0xc10d('0x0'));exports[_0xc10d('0x1')]=function(){return function(){return client['Request'](_0xc10d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xc10d('0x3'),_0xc10d('0x4')],'include':[{'model':_0xc10d('0x5'),'as':_0xc10d('0x6'),'attributes':['id',_0xc10d('0x7'),_0xc10d('0x8'),_0xc10d('0x9')]}]},'log':_0xc10d('0x1')});};}; \ No newline at end of file +var _0xcdfb=['strategy','Agents','online','../client','getMailQueues','Request','name','timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcdfb,0xa3));var _0xbcdf=function(_0xc92331,_0xd332e4){_0xc92331=_0xc92331-0x0;var _0x41794d=_0xcdfb[_0xc92331];return _0x41794d;};'use strict';var client=require(_0xbcdf('0x0'));exports[_0xbcdf('0x1')]=function(){return function(){return client[_0xbcdf('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xbcdf('0x3'),_0xbcdf('0x4'),_0xbcdf('0x5')],'include':[{'model':'User','as':_0xbcdf('0x6'),'attributes':['id',_0xbcdf('0x3'),_0xbcdf('0x7'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 49d5f9c..487b212 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 _0x9a96=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9a96,0x1e3));var _0x69a9=function(_0x5afc01,_0x83c92a){_0x5afc01=_0x5afc01-0x0;var _0xd2582e=_0x9a96[_0x5afc01];return _0xd2582e;};'use strict';var client=require(_0x69a9('0x0'));exports[_0x69a9('0x1')]=function(_0x1cb76){return client[_0x69a9('0x2')](_0x69a9('0x3'),{'body':_0x1cb76,'log':'CreateMailQueueReport'});};exports['update']=function(_0x40eeb3,_0x5b4146){return client['Request'](_0x69a9('0x4'),{'body':_0x5b4146,'options':{'where':{'uniqueid':_0x40eeb3},'order':[['id',_0x69a9('0x5')]],'limit':0x1},'log':_0x69a9('0x4')});}; \ No newline at end of file +var _0x78f3=['UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0x78f3,0xfc));var _0x378f=function(_0x2e64bc,_0x572a25){_0x2e64bc=_0x2e64bc-0x0;var _0x1fc752=_0x78f3[_0x2e64bc];return _0x1fc752;};'use strict';var client=require(_0x378f('0x0'));exports['create']=function(_0x1ba9d0){return client[_0x378f('0x1')]('CreateMailQueueReport',{'body':_0x1ba9d0,'log':_0x378f('0x2')});};exports['update']=function(_0x4d3016,_0x332090){return client[_0x378f('0x1')](_0x378f('0x3'),{'body':_0x332090,'options':{'where':{'uniqueid':_0x4d3016},'order':[['id',_0x378f('0x4')]],'limit':0x1},'log':_0x378f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c9095d0..e769ea1 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 _0x6d8f=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','addTagsToChatInteraction','../client'];(function(_0x52980c,_0x314920){var _0x5ee8dc=function(_0x18290f){while(--_0x18290f){_0x52980c['push'](_0x52980c['shift']());}};_0x5ee8dc(++_0x314920);}(_0x6d8f,0x141));var _0xf6d8=function(_0x552201,_0x17b56b){_0x552201=_0x552201-0x0;var _0x4e9e57=_0x6d8f[_0x552201];return _0x4e9e57;};'use strict';var client=require(_0xf6d8('0x0'));exports[_0xf6d8('0x1')]=function(_0x532d66,_0x150bda){return client['Request'](_0xf6d8('0x2'),{'body':_0x150bda,'options':{'where':{'id':_0x532d66}},'log':_0xf6d8('0x3')});};exports[_0xf6d8('0x4')]=function(_0x251eb3,_0x1a30bf){return client[_0xf6d8('0x5')]('AddTagsToOpenchannelInteraction',{'body':_0x1a30bf,'options':{'where':{'id':_0x251eb3}},'log':_0xf6d8('0x6')});}; \ No newline at end of file +var _0x5ea6=['Request','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0x5ea6,0x160));var _0x65ea=function(_0x1f8921,_0x38bd21){_0x1f8921=_0x1f8921-0x0;var _0x2c2f34=_0x5ea6[_0x1f8921];return _0x2c2f34;};'use strict';var client=require(_0x65ea('0x0'));exports[_0x65ea('0x1')]=function(_0x60b070,_0x36e8e8){return client['Request'](_0x65ea('0x2'),{'body':_0x36e8e8,'options':{'where':{'id':_0x60b070}},'log':_0x65ea('0x3')});};exports[_0x65ea('0x4')]=function(_0x4323e7,_0x21adcf){return client[_0x65ea('0x5')]('AddTagsToOpenchannelInteraction',{'body':_0x21adcf,'options':{'where':{'id':_0x4323e7}},'log':_0x65ea('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e857f03..8a6b6dd 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 _0xac41=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x9a62de,_0x127f28){var _0x14d7b3=function(_0x23d73f){while(--_0x23d73f){_0x9a62de['push'](_0x9a62de['shift']());}};_0x14d7b3(++_0x127f28);}(_0xac41,0x107));var _0x1ac4=function(_0x1faf05,_0x3af443){_0x1faf05=_0x1faf05-0x0;var _0x1b1f15=_0xac41[_0x1faf05];return _0x1b1f15;};'use strict';var client=require(_0x1ac4('0x0'));exports[_0x1ac4('0x1')]=function(_0x19ad39){return client[_0x1ac4('0x2')](_0x1ac4('0x3'),{'body':_0x19ad39,'log':_0x1ac4('0x4')});}; \ No newline at end of file +var _0x4f6c=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x4f6c,0x1ed));var _0xc4f6=function(_0x420bb8,_0x22f47a){_0x420bb8=_0x420bb8-0x0;var _0x2902ca=_0x4f6c[_0x420bb8];return _0x2902ca;};'use strict';var client=require(_0xc4f6('0x0'));exports[_0xc4f6('0x1')]=function(_0x3e9533){return client[_0xc4f6('0x2')](_0xc4f6('0x3'),{'body':_0x3e9533,'log':_0xc4f6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d2ab12a..d79f0c5 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 _0x3922=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','openchannelPause'];(function(_0x23ed93,_0x1c023b){var _0x5b99cd=function(_0x5bc0bb){while(--_0x5bc0bb){_0x23ed93['push'](_0x23ed93['shift']());}};_0x5b99cd(++_0x1c023b);}(_0x3922,0x69));var _0x2392=function(_0x50c7e1,_0x401e17){_0x50c7e1=_0x50c7e1-0x0;var _0x194891=_0x3922[_0x50c7e1];return _0x194891;};'use strict';var client=require(_0x2392('0x0'));exports[_0x2392('0x1')]=function(){return function(){return client[_0x2392('0x2')](_0x2392('0x3'),{'options':{'raw':![],'attributes':['id',_0x2392('0x4'),_0x2392('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0x2392('0x6')]}]},'log':_0x2392('0x1')});};}; \ No newline at end of file +var _0x3f19=['openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','timeout','strategy','User','Agents','name','online'];(function(_0x3460e3,_0x23d874){var _0x22a450=function(_0x2c1038){while(--_0x2c1038){_0x3460e3['push'](_0x3460e3['shift']());}};_0x22a450(++_0x23d874);}(_0x3f19,0x155));var _0x93f1=function(_0x309385,_0x3ab38f){_0x309385=_0x309385-0x0;var _0x45b0f5=_0x3f19[_0x309385];return _0x45b0f5;};'use strict';var client=require(_0x93f1('0x0'));exports[_0x93f1('0x1')]=function(){return function(){return client['Request'](_0x93f1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x93f1('0x3'),_0x93f1('0x4')],'include':[{'model':_0x93f1('0x5'),'as':_0x93f1('0x6'),'attributes':['id',_0x93f1('0x7'),_0x93f1('0x8'),_0x93f1('0x9')]}]},'log':_0x93f1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index f494854..54cb52c 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 _0x521b=['update','DESC','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x11e506,_0x3d2620){var _0x2cab68=function(_0x5b770c){while(--_0x5b770c){_0x11e506['push'](_0x11e506['shift']());}};_0x2cab68(++_0x3d2620);}(_0x521b,0xd5));var _0xb521=function(_0x5760c9,_0x3ad606){_0x5760c9=_0x5760c9-0x0;var _0x6da60c=_0x521b[_0x5760c9];return _0x6da60c;};'use strict';var client=require(_0xb521('0x0'));exports[_0xb521('0x1')]=function(_0x4eb295){return client[_0xb521('0x2')](_0xb521('0x3'),{'body':_0x4eb295,'log':_0xb521('0x3')});};exports[_0xb521('0x4')]=function(_0x21b283,_0x535457){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x535457,'options':{'where':{'uniqueid':_0x21b283},'order':[['id',_0xb521('0x5')]],'limit':0x1},'log':_0xb521('0x6')});}; \ No newline at end of file +var _0x593e=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x75caa,_0x390e63){var _0x8c7804=function(_0x1e152b){while(--_0x1e152b){_0x75caa['push'](_0x75caa['shift']());}};_0x8c7804(++_0x390e63);}(_0x593e,0xcb));var _0xe593=function(_0x23e718,_0x269076){_0x23e718=_0x23e718-0x0;var _0x2032f5=_0x593e[_0x23e718];return _0x2032f5;};'use strict';var client=require(_0xe593('0x0'));exports[_0xe593('0x1')]=function(_0x12f6de){return client[_0xe593('0x2')](_0xe593('0x3'),{'body':_0x12f6de,'log':_0xe593('0x3')});};exports[_0xe593('0x4')]=function(_0x2fa3a7,_0x550574){return client[_0xe593('0x2')](_0xe593('0x5'),{'body':_0x550574,'options':{'where':{'uniqueid':_0x2fa3a7},'order':[['id',_0xe593('0x6')]],'limit':0x1},'log':_0xe593('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 11329d8..a40ca35 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 _0xa7dc=['Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x5ab85d,_0x2c9887){var _0x439986=function(_0x2a6951){while(--_0x2a6951){_0x5ab85d['push'](_0x5ab85d['shift']());}};_0x439986(++_0x2c9887);}(_0xa7dc,0x11d));var _0xca7d=function(_0x1fa1a2,_0x4107a6){_0x1fa1a2=_0x1fa1a2-0x0;var _0x45b99c=_0xa7dc[_0x1fa1a2];return _0x45b99c;};'use strict';var client=require(_0xca7d('0x0'));exports[_0xca7d('0x1')]=function(_0x150001,_0x4ea9c6){return client[_0xca7d('0x2')]('UpdateSmsInteraction',{'body':_0x4ea9c6,'options':{'where':{'id':_0x150001}},'log':_0xca7d('0x3')});};exports[_0xca7d('0x4')]=function(_0xc9d57a,_0x833d25){return client[_0xca7d('0x2')](_0xca7d('0x5'),{'body':_0x833d25,'options':{'where':{'id':_0xc9d57a}},'log':_0xca7d('0x6')});}; \ No newline at end of file +var _0xd8b1=['addTags','../client','update','Request','updateSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b1,0x105));var _0x1d8b=function(_0x52d859,_0x586b81){_0x52d859=_0x52d859-0x0;var _0x7cf2db=_0xd8b1[_0x52d859];return _0x7cf2db;};'use strict';var client=require(_0x1d8b('0x0'));exports[_0x1d8b('0x1')]=function(_0x2e0722,_0x5c8d8a){return client[_0x1d8b('0x2')]('UpdateSmsInteraction',{'body':_0x5c8d8a,'options':{'where':{'id':_0x2e0722}},'log':_0x1d8b('0x3')});};exports[_0x1d8b('0x4')]=function(_0x531170,_0xad218){return client['Request']('AddTagsToSmsInteraction',{'body':_0xad218,'options':{'where':{'id':_0x531170}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ad44f9c..b179f6d 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 _0x836f=['createSmsMessage','../client','create','Request'];(function(_0x29881a,_0x377466){var _0x340373=function(_0x390bb4){while(--_0x390bb4){_0x29881a['push'](_0x29881a['shift']());}};_0x340373(++_0x377466);}(_0x836f,0x79));var _0xf836=function(_0x22d320,_0x1850fd){_0x22d320=_0x22d320-0x0;var _0x3d3a4c=_0x836f[_0x22d320];return _0x3d3a4c;};'use strict';var client=require(_0xf836('0x0'));exports[_0xf836('0x1')]=function(_0x56543e){return client[_0xf836('0x2')]('CreateSmsMessage',{'body':_0x56543e,'log':_0xf836('0x3')});}; \ No newline at end of file +var _0xbe41=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0xe8c02e,_0x5db88f){var _0x1acd8e=function(_0x43dba1){while(--_0x43dba1){_0xe8c02e['push'](_0xe8c02e['shift']());}};_0x1acd8e(++_0x5db88f);}(_0xbe41,0x6a));var _0x1be4=function(_0x29c02f,_0x3caa81){_0x29c02f=_0x29c02f-0x0;var _0x40d362=_0xbe41[_0x29c02f];return _0x40d362;};'use strict';var client=require(_0x1be4('0x0'));exports[_0x1be4('0x1')]=function(_0x53d0ab){return client[_0x1be4('0x2')](_0x1be4('0x3'),{'body':_0x53d0ab,'log':_0x1be4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 0d72fdc..0468158 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x17a16a,_0x5a881b){var _0x294913=function(_0x2e3a2f){while(--_0x2e3a2f){_0x17a16a['push'](_0x17a16a['shift']());}};_0x294913(++_0x5a881b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x3b3dcc,_0x31d242){var _0x12a8a6=function(_0x176089){while(--_0x176089){_0x3b3dcc['push'](_0x3b3dcc['shift']());}};_0x12a8a6(++_0x31d242);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c28aa01..2460997 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xedd9,0xfc));var _0x9edd=function(_0x4dc363,_0x1501a9){_0x4dc363=_0x4dc363-0x0;var _0x1b6ec7=_0xedd9[_0x4dc363];return _0x1b6ec7;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0xedd9[_0x3a0ebd];return _0x51a660;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6f32148..de031e0 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(_0x1c09cc,_0x360315){var _0xb82fb1=function(_0x3c85cf){while(--_0x3c85cf){_0x1c09cc['push'](_0x1c09cc['shift']());}};_0xb82fb1(++_0x360315);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x256465,_0x4cca46){var _0x3e09c4=function(_0x4c7e1b){while(--_0x4c7e1b){_0x256465['push'](_0x256465['shift']());}};_0x3e09c4(++_0x4cca46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 c7d7bf6..b392479 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 _0xba18=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x2e17a1,_0x52f710){var _0xcc1057=function(_0xc3c631){while(--_0xc3c631){_0x2e17a1['push'](_0x2e17a1['shift']());}};_0xcc1057(++_0x52f710);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8ba1('0x0'));exports[_0x8ba1('0x1')]=function(_0x2b1046,_0x43dc6a){return client[_0x8ba1('0x2')](_0x8ba1('0x3'),{'body':_0x43dc6a,'options':{'where':{'id':_0x2b1046}},'log':_0x8ba1('0x4')});};exports[_0x8ba1('0x5')]=function(_0x59c54c,_0xe3bc16){return client[_0x8ba1('0x2')](_0x8ba1('0x6'),{'body':_0xe3bc16,'options':{'where':{'id':_0x59c54c}},'log':_0x8ba1('0x7')});}; \ No newline at end of file +var _0x0958=['update','Request','UpdateWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0958,0x7c));var _0x8095=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0958[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x8095('0x0'));exports[_0x8095('0x1')]=function(_0xd53ca7,_0x5e3ac5){return client[_0x8095('0x2')](_0x8095('0x3'),{'body':_0x5e3ac5,'options':{'where':{'id':_0xd53ca7}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x4625ee,_0x3da09b){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x3da09b,'options':{'where':{'id':_0x4625ee}},'log':_0x8095('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3cf8b12..e4d9f53 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 _0x8984=['create','Request','createWhatsappMessage','../client'];(function(_0x524704,_0x4afa25){var _0x1a8f36=function(_0x397699){while(--_0x397699){_0x524704['push'](_0x524704['shift']());}};_0x1a8f36(++_0x4afa25);}(_0x8984,0x1ef));var _0x4898=function(_0x20cfe6,_0x596296){_0x20cfe6=_0x20cfe6-0x0;var _0x3debd8=_0x8984[_0x20cfe6];return _0x3debd8;};'use strict';var client=require(_0x4898('0x0'));exports[_0x4898('0x1')]=function(_0xd82c5c){return client[_0x4898('0x2')]('CreateWhatsappMessage',{'body':_0xd82c5c,'log':_0x4898('0x3')});}; \ No newline at end of file +var _0x07c2=['../client','Request','CreateWhatsappMessage'];(function(_0x5bda3b,_0x41160f){var _0x431bb9=function(_0x160122){while(--_0x160122){_0x5bda3b['push'](_0x5bda3b['shift']());}};_0x431bb9(++_0x41160f);}(_0x07c2,0x75));var _0x207c=function(_0x4f13f8,_0x5e13c5){_0x4f13f8=_0x4f13f8-0x0;var _0x1e6b83=_0x07c2[_0x4f13f8];return _0x1e6b83;};'use strict';var client=require(_0x207c('0x0'));exports['create']=function(_0x3ec476){return client[_0x207c('0x1')](_0x207c('0x2'),{'body':_0x3ec476,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index a26bc46..f4d2c7b 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 _0x7bfc=['GetWhatsappQueue','name','timeout','User','Agents','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x4ae172,_0x1efd6b){var _0x44dc0d=function(_0x53d0b8){while(--_0x53d0b8){_0x4ae172['push'](_0x4ae172['shift']());}};_0x44dc0d(++_0x1efd6b);}(_0x7bfc,0xa1));var _0xc7bf=function(_0x35d68a,_0x23a7a7){_0x35d68a=_0x35d68a-0x0;var _0x168eb3=_0x7bfc[_0x35d68a];return _0x168eb3;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0xc7bf('0x0')](_0xc7bf('0x1'),{'options':{'raw':![],'attributes':['id',_0xc7bf('0x2'),_0xc7bf('0x3'),'strategy'],'include':[{'model':_0xc7bf('0x4'),'as':_0xc7bf('0x5'),'attributes':['id',_0xc7bf('0x2'),_0xc7bf('0x6'),_0xc7bf('0x7')]}]},'log':_0xc7bf('0x8')});};}; \ No newline at end of file +var _0x4584=['timeout','User','Agents','online','whatsappPause','Request','GetWhatsappQueue','name'];(function(_0xe2ebaa,_0x138483){var _0x563838=function(_0x542a4c){while(--_0x542a4c){_0xe2ebaa['push'](_0xe2ebaa['shift']());}};_0x563838(++_0x138483);}(_0x4584,0x75));var _0x4458=function(_0x3a8114,_0x549ce8){_0x3a8114=_0x3a8114-0x0;var _0x4ebb2f=_0x4584[_0x3a8114];return _0x4ebb2f;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x4458('0x0')](_0x4458('0x1'),{'options':{'raw':![],'attributes':['id',_0x4458('0x2'),_0x4458('0x3'),'strategy'],'include':[{'model':_0x4458('0x4'),'as':_0x4458('0x5'),'attributes':['id','name',_0x4458('0x6'),_0x4458('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 352be4d..e68fac5 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 _0xb257=['UpdateWhatsappQueueReport','DESC','CreateWhatsappQueueReport','update','Request'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0xb257,0x11a));var _0x7b25=function(_0x3ae305,_0x400c0e){_0x3ae305=_0x3ae305-0x0;var _0x21cdb6=_0xb257[_0x3ae305];return _0x21cdb6;};'use strict';var client=require('../client');exports['create']=function(_0x4b169d){return client['Request'](_0x7b25('0x0'),{'body':_0x4b169d,'log':_0x7b25('0x0')});};exports[_0x7b25('0x1')]=function(_0x37056d,_0x372e26){return client[_0x7b25('0x2')](_0x7b25('0x3'),{'body':_0x372e26,'options':{'where':{'uniqueid':_0x37056d},'order':[['id',_0x7b25('0x4')]],'limit':0x1},'log':_0x7b25('0x3')});}; \ No newline at end of file +var _0xf5dc=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x197ed9,_0x502493){var _0x573ff1=function(_0x581ef1){while(--_0x581ef1){_0x197ed9['push'](_0x197ed9['shift']());}};_0x573ff1(++_0x502493);}(_0xf5dc,0xdc));var _0xcf5d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf5dc[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xcf5d('0x0'));exports[_0xcf5d('0x1')]=function(_0x1dc071){return client[_0xcf5d('0x2')]('CreateWhatsappQueueReport',{'body':_0x1dc071,'log':_0xcf5d('0x3')});};exports[_0xcf5d('0x4')]=function(_0x212246,_0xaa17e3){return client['Request'](_0xcf5d('0x5'),{'body':_0xaa17e3,'options':{'where':{'uniqueid':_0x212246},'order':[['id',_0xcf5d('0x6')]],'limit':0x1},'log':_0xcf5d('0x5')});}; \ 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 af35c67..0e824de 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 _0xbb78=['[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','util','../../../../config/logger','routing','./strategy','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete'];(function(_0x1ab316,_0x171a68){var _0x32eec4=function(_0x3d60d5){while(--_0x3d60d5){_0x1ab316['push'](_0x1ab316['shift']());}};_0x32eec4(++_0x171a68);}(_0xbb78,0xf4));var _0x8bb7=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xbb78[_0x53ccf2];return _0x5a2964;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x8bb7('0x0'));var seqqueue=require('seq-queue');var logger=require(_0x8bb7('0x1'))(_0x8bb7('0x2'));var strategy=require(_0x8bb7('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x8bb7('0x4'),'message':_0x8bb7('0x5')}});function writeLog(_0x57dc53,_0x21b90c,_0x1af8f7){return logger['info'](util[_0x8bb7('0x6')](_0x8bb7('0x7'),_0x57dc53,_0x21b90c[_0x8bb7('0x8')],_0x1af8f7));}function handleFindAgent(_0x5a4a12){return function(_0x37d676){return _0x37d676[_0x8bb7('0x8')][_0x8bb7('0x9')]()===_0x5a4a12['toLowerCase']();};}exports['consequence']=function(_0x275071,_0x192f88,_0x4dcb7f,_0x5c2ba2){return function(_0xfdfd8f){try{var _0x55bd79={'name':_0x192f88[0x0],'timeout':_0x192f88[0x1]};var _0x31e50a=queue['validate'](_0x55bd79,{'typecast':!![]});if(_0x31e50a[_0x8bb7('0xa')]){logger[_0x8bb7('0xb')](_0x8bb7('0xc'),_0x275071,_[_0x8bb7('0xd')](_0x31e50a,_0x8bb7('0xe'))['join'](',\x20'));_0xfdfd8f[_0x8bb7('0xf')]();}else{var _0x4c9d28=_[_0x8bb7('0x10')](_0x4dcb7f[_0x8bb7('0x11')],handleFindAgent(_0x55bd79[_0x8bb7('0x8')]));if(_0x4c9d28){var _0x31e4a8=(_0x55bd79['timeout']||0xa)*0x3e8;var _0x2eac6a,_0x483b03;var _0x101a2a=seqqueue[_0x8bb7('0x12')](_0x31e4a8);_0x101a2a['id']=_0x275071;_0x101a2a[_0x8bb7('0x13')]=_0x31e4a8;_0x101a2a[_0x8bb7('0x14')]=_0x5c2ba2[_0x8bb7('0x14')];writeLog(_0x275071,_0x4c9d28,util[_0x8bb7('0x6')](_0x8bb7('0x15'),_0x31e4a8));_0x4dcb7f[_0x8bb7('0x16')][_0x275071]['on'](_0x8bb7('0x17'),function(){logger[_0x8bb7('0x18')](_0x8bb7('0x19'),_0x275071);clearTimeout(_0x483b03);_0x483b03=undefined;_0x101a2a[_0x8bb7('0x1a')]();if(_0x4dcb7f[_0x8bb7('0x16')][_0x275071]){delete _0x4dcb7f[_0x8bb7('0x16')][_0x275071];}_0xfdfd8f['stop']();});_0x4dcb7f[_0x8bb7('0x16')][_0x275071]['on'](_0x8bb7('0x1b'),function(){if(_0x4dcb7f[_0x8bb7('0x16')][_0x275071]){delete _0x4dcb7f['rules'][_0x275071];}});_0x483b03=setTimeout(function(){logger['info'](_0x8bb7('0x1c'),_0x275071);clearTimeout(_0x483b03);_0x101a2a[_0x8bb7('0x1a')]();_0xfdfd8f[_0x8bb7('0x1d')]();},_0x31e4a8);strategy[_0x8bb7('0x1e')](_0x101a2a,_0x4c9d28,_0x4dcb7f,_0x5c2ba2);}else{logger[_0x8bb7('0xb')](_0x8bb7('0x1f'),_0x275071,_0x55bd79[_0x8bb7('0x8')]);_0xfdfd8f[_0x8bb7('0xf')]();}}}catch(_0xdcd57d){console['log'](_0xdcd57d);logger[_0x8bb7('0xb')](_0x8bb7('0x20'),_0x275071,_0xdcd57d[_0x8bb7('0x21')]);_0xfdfd8f[_0x8bb7('0xf')]();}};}; \ No newline at end of file +var _0xa1bb=['[%s][AGENT]\x20ROUTING\x20END','next','stack','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete'];(function(_0x1a794f,_0x41aebc){var _0x36e80b=function(_0x272180){while(--_0x272180){_0x1a794f['push'](_0x1a794f['shift']());}};_0x36e80b(++_0x41aebc);}(_0xa1bb,0x69));var _0xba1b=function(_0x316ec8,_0x2102df){_0x316ec8=_0x316ec8-0x0;var _0x40319b=_0xa1bb[_0x316ec8];return _0x40319b;};'use strict';var schema=require('validate');var _=require(_0xba1b('0x0'));var util=require(_0xba1b('0x1'));var seqqueue=require(_0xba1b('0x2'));var logger=require('../../../../config/logger')(_0xba1b('0x3'));var strategy=require(_0xba1b('0x4'));var queue=schema({'name':{'type':_0xba1b('0x5'),'required':!![],'message':_0xba1b('0x6')},'timeout':{'type':_0xba1b('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5cd548,_0x1d0ff0,_0x113d19){return logger[_0xba1b('0x8')](util[_0xba1b('0x9')](_0xba1b('0xa'),_0x5cd548,_0x1d0ff0[_0xba1b('0xb')],_0x113d19));}function handleFindAgent(_0x567457){return function(_0x417fcc){return _0x417fcc[_0xba1b('0xb')][_0xba1b('0xc')]()===_0x567457['toLowerCase']();};}exports['consequence']=function(_0x569c95,_0x3eb998,_0x1445f4,_0x1a3a68){return function(_0x1f53dc){try{var _0x1b6446={'name':_0x3eb998[0x0],'timeout':_0x3eb998[0x1]};var _0x4912d6=queue[_0xba1b('0xd')](_0x1b6446,{'typecast':!![]});if(_0x4912d6[_0xba1b('0xe')]){logger[_0xba1b('0xf')](_0xba1b('0x10'),_0x569c95,_['map'](_0x4912d6,_0xba1b('0x11'))[_0xba1b('0x12')](',\x20'));_0x1f53dc[_0xba1b('0x13')]();}else{var _0xb1aad7=_[_0xba1b('0x14')](_0x1445f4[_0xba1b('0x15')],handleFindAgent(_0x1b6446[_0xba1b('0xb')]));if(_0xb1aad7){var _0x2e6135=(_0x1b6446[_0xba1b('0x16')]||0xa)*0x3e8;var _0x559b25,_0x4e8258;var _0x524518=seqqueue[_0xba1b('0x17')](_0x2e6135);_0x524518['id']=_0x569c95;_0x524518[_0xba1b('0x18')]=_0x2e6135;_0x524518['channel']=_0x1a3a68[_0xba1b('0x19')];writeLog(_0x569c95,_0xb1aad7,util[_0xba1b('0x9')](_0xba1b('0x1a'),_0x2e6135));_0x1445f4[_0xba1b('0x1b')][_0x569c95]['on']('end',function(){logger['info'](_0xba1b('0x1c'),_0x569c95);clearTimeout(_0x4e8258);_0x4e8258=undefined;_0x524518[_0xba1b('0x1d')]();if(_0x1445f4[_0xba1b('0x1b')][_0x569c95]){delete _0x1445f4[_0xba1b('0x1b')][_0x569c95];}_0x1f53dc[_0xba1b('0x13')]();});_0x1445f4[_0xba1b('0x1b')][_0x569c95]['on'](_0xba1b('0x1e'),function(){if(_0x1445f4[_0xba1b('0x1b')][_0x569c95]){delete _0x1445f4[_0xba1b('0x1b')][_0x569c95];}});_0x4e8258=setTimeout(function(){logger[_0xba1b('0x8')](_0xba1b('0x1f'),_0x569c95);clearTimeout(_0x4e8258);_0x524518['close']();_0x1f53dc[_0xba1b('0x20')]();},_0x2e6135);strategy['agent'](_0x524518,_0xb1aad7,_0x1445f4,_0x1a3a68);}else{logger[_0xba1b('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x569c95,_0x1b6446[_0xba1b('0xb')]);_0x1f53dc['stop']();}}}catch(_0x27a6a0){console['log'](_0x27a6a0);logger[_0xba1b('0xf')]('[%s][QUEUE]\x20%s',_0x569c95,_0x27a6a0[_0xba1b('0x21')]);_0x1f53dc[_0xba1b('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index d5b7000..1faba56 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 _0x465d=['info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','finally','stop','$LATEST','toString','postText','message','amazonlex','providerName','dialogState','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x465d,0x142));var _0xd465=function(_0x3128f7,_0x5ec08a){_0x3128f7=_0x3128f7-0x0;var _0x5ce976=_0x465d[_0x3128f7];return _0x5ce976;};'use strict';var _=require(_0xd465('0x0'));var moment=require(_0xd465('0x1'));var AWS=require(_0xd465('0x2'));var utils=require(_0xd465('0x3'));var logger=require(_0xd465('0x4'))(_0xd465('0x5'));var rpc={'chatMessage':require(_0xd465('0x6')),'openchannelMessage':require(_0xd465('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd465('0x8')),'faxMessage':require(_0xd465('0x9')),'whatsappMessage':require(_0xd465('0xa'))};exports[_0xd465('0xb')]=function(_0x40fbe0,_0x34eda8){return function(_0x2a8821){try{if(!_['isNil'](this[_0xd465('0xc')][_0xd465('0xd')])){logger[_0xd465('0xe')](_0xd465('0xf'),_0x40fbe0,_0xd465('0x10'));return _0x2a8821[_0xd465('0x11')]();}var _0x5e4067={'ContactId':this[_0xd465('0x12')]['id'],'sentAt':moment()[_0xd465('0x13')](_0xd465('0x14')),'direction':'out'};if(this[_0xd465('0x15')]==='sms'||this[_0xd465('0x15')]==='whatsapp'){_0x5e4067[_0xd465('0x16')]=this[_0xd465('0xc')]['phone'];}var _0x500cca=this[_0xd465('0x15')];if(_0x500cca===_0xd465('0x17')){_0x5e4067[_0xd465('0x18')]=this[_0xd465('0x19')]['id'];}else{_0x5e4067[_[_0xd465('0x1a')](_0x500cca)+'AccountId']=this[_0xd465('0x19')]['id'];}_0x5e4067[_['upperFirst'](_0x500cca)+_0xd465('0x1b')]=this['interaction']['id'];if(this[_0xd465('0xc')][_0xd465('0x1c')]){var _0x39048a=_0x34eda8[0x4];if(!_[_0xd465('0x1d')](_0x39048a)){_0x5e4067[_0xd465('0x1e')]=utils[_0xd465('0x1f')](_0x39048a,this);return rpc[_0x500cca+_0xd465('0x20')][_0xd465('0x21')](_0x5e4067)[_0xd465('0x22')](function(_0x4db257){logger[_0xd465('0xe')](_0xd465('0xf'),_0x40fbe0,_0x5e4067['body']);})['catch'](function(_0x31c95c){logger[_0xd465('0x23')](_0xd465('0xf'),_0x40fbe0,JSON[_0xd465('0x24')](_0x31c95c));})[_0xd465('0x25')](function(){logger[_0xd465('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x40fbe0);_0x2a8821['stop']();});}else{logger[_0xd465('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x40fbe0);_0x2a8821[_0xd465('0x26')]();}}else{var _0x2ceab4=this;var _0x5941aa=new AWS['LexRuntime']({'accessKeyId':_0x34eda8[0x0],'secretAccessKey':_0x34eda8[0x1],'region':_0x34eda8[0x2]});var _0x59ca4b={'botAlias':_0xd465('0x27'),'botName':_0x34eda8[0x3],'inputText':this['message']['body'],'userId':this[_0xd465('0x15')]+':'+this[_0xd465('0xc')]['id'][_0xd465('0x28')]()};_0x5941aa[_0xd465('0x29')](_0x59ca4b,function(_0x3340d8,_0x1db729){if(_0x3340d8){logger[_0xd465('0x23')](_0xd465('0xf'),_0x40fbe0,_0x3340d8[_0xd465('0x2a')]);_0x2a8821[_0xd465('0x11')]();}else if(_0x1db729&&_0x1db729[_0xd465('0x2a')]){_0x2ceab4[_0xd465('0x1e')][_0xd465('0x2b')]=_0x1db729;_0x5e4067[_0xd465('0x1e')]=_0x1db729['message'];_0x5e4067[_0xd465('0x2c')]='amazonlex';_0x5e4067['providerResponse']=JSON['stringify'](_0x1db729);return rpc[_0x500cca+_0xd465('0x20')]['create'](_0x5e4067)[_0xd465('0x22')](function(_0x3e2684){logger[_0xd465('0xe')]('[%s][AMAZONLEX]\x20%s',_0x40fbe0,_0x5e4067[_0xd465('0x1e')]);if(_0x1db729[_0xd465('0x2d')]==_0xd465('0x2e')){_0x2a8821['next']();}else{_0x2a8821[_0xd465('0x26')]();}})[_0xd465('0x2f')](function(_0x10c459){logger[_0xd465('0x23')](_0xd465('0xf'),_0x40fbe0,JSON['stringify'](_0x10c459));_0x2a8821[_0xd465('0x11')]();});}else{_0x2a8821[_0xd465('0x11')]();}});}}catch(_0x48d876){logger[_0xd465('0x23')](_0xd465('0xf'),_0x40fbe0,JSON['stringify'](_0x48d876));_0x2a8821['stop']();}};}; \ No newline at end of file +var _0xb17a=['getMustacheRender','Message','create','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','amazonlex','providerName','providerResponse','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','account','created','isEmpty'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb17a,0x104));var _0xab17=function(_0x499be4,_0x14a46c){_0x499be4=_0x499be4-0x0;var _0x840cb5=_0xb17a[_0x499be4];return _0x840cb5;};'use strict';var _=require(_0xab17('0x0'));var moment=require(_0xab17('0x1'));var AWS=require(_0xab17('0x2'));var utils=require(_0xab17('0x3'));var logger=require('../../../../config/logger')(_0xab17('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xab17('0x5')),'mailMessage':require(_0xab17('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xab17('0x7'))};exports['consequence']=function(_0x36c590,_0x3bb2ed){return function(_0x7e6203){try{if(!_[_0xab17('0x8')](this[_0xab17('0x9')][_0xab17('0xa')])){logger[_0xab17('0xb')](_0xab17('0xc'),_0x36c590,_0xab17('0xd'));return _0x7e6203[_0xab17('0xe')]();}var _0x38feeb={'ContactId':this[_0xab17('0xf')]['id'],'sentAt':moment()[_0xab17('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xab17('0x11')};if(this[_0xab17('0x12')]===_0xab17('0x13')||this[_0xab17('0x12')]===_0xab17('0x14')){_0x38feeb[_0xab17('0x15')]=this[_0xab17('0x9')][_0xab17('0x15')];}var _0x2ab816=this['channel'];if(_0x2ab816===_0xab17('0x16')){_0x38feeb['ChatWebsiteId']=this['account']['id'];}else{_0x38feeb[_[_0xab17('0x17')](_0x2ab816)+_0xab17('0x18')]=this[_0xab17('0x19')]['id'];}_0x38feeb[_[_0xab17('0x17')](_0x2ab816)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0xab17('0x1a')]){var _0x480ee5=_0x3bb2ed[0x4];if(!_[_0xab17('0x1b')](_0x480ee5)){_0x38feeb['body']=utils[_0xab17('0x1c')](_0x480ee5,this);return rpc[_0x2ab816+_0xab17('0x1d')][_0xab17('0x1e')](_0x38feeb)['then'](function(_0x1e9d6b){logger[_0xab17('0xb')]('[%s][AMAZONLEX]\x20%s',_0x36c590,_0x38feeb[_0xab17('0x1f')]);})[_0xab17('0x20')](function(_0x2399a3){logger[_0xab17('0x21')](_0xab17('0xc'),_0x36c590,JSON[_0xab17('0x22')](_0x2399a3));})[_0xab17('0x23')](function(){logger[_0xab17('0xb')](_0xab17('0x24'),_0x36c590);_0x7e6203[_0xab17('0x25')]();});}else{logger[_0xab17('0xb')](_0xab17('0x26'),_0x36c590);_0x7e6203[_0xab17('0x25')]();}}else{var _0x5564f6=this;var _0x365a8b=new AWS[(_0xab17('0x27'))]({'accessKeyId':_0x3bb2ed[0x0],'secretAccessKey':_0x3bb2ed[0x1],'region':_0x3bb2ed[0x2]});var _0x5e7134={'botAlias':'$LATEST','botName':_0x3bb2ed[0x3],'inputText':this[_0xab17('0x28')][_0xab17('0x1f')],'userId':this[_0xab17('0x12')]+':'+this[_0xab17('0x9')]['id'][_0xab17('0x29')]()};_0x365a8b['postText'](_0x5e7134,function(_0x3bff33,_0x3f0793){if(_0x3bff33){logger[_0xab17('0x21')]('[%s][AMAZONLEX]\x20%s',_0x36c590,_0x3bff33[_0xab17('0x28')]);_0x7e6203[_0xab17('0xe')]();}else if(_0x3f0793&&_0x3f0793['message']){_0x5564f6['body'][_0xab17('0x2a')]=_0x3f0793;_0x38feeb[_0xab17('0x1f')]=_0x3f0793[_0xab17('0x28')];_0x38feeb[_0xab17('0x2b')]=_0xab17('0x2a');_0x38feeb[_0xab17('0x2c')]=JSON[_0xab17('0x22')](_0x3f0793);return rpc[_0x2ab816+'Message'][_0xab17('0x1e')](_0x38feeb)[_0xab17('0x2d')](function(_0x4d4caa){logger[_0xab17('0xb')]('[%s][AMAZONLEX]\x20%s',_0x36c590,_0x38feeb[_0xab17('0x1f')]);if(_0x3f0793[_0xab17('0x2e')]==_0xab17('0x2f')){_0x7e6203[_0xab17('0xe')]();}else{_0x7e6203[_0xab17('0x25')]();}})[_0xab17('0x20')](function(_0x53f398){logger[_0xab17('0x21')](_0xab17('0xc'),_0x36c590,JSON[_0xab17('0x22')](_0x53f398));_0x7e6203[_0xab17('0xe')]();});}else{_0x7e6203[_0xab17('0xe')]();}});}}catch(_0x5e6955){logger[_0xab17('0x21')](_0xab17('0xc'),_0x36c590,JSON[_0xab17('0x22')](_0x5e6955));_0x7e6203[_0xab17('0x25')]();}};}; \ 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 6eb2326..fbc7a9e 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 _0xbdf7=['info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo',''+_['replace'](_0x3391fd['body'],_0x7bdf('0x37'),_0x7bdf('0x38'))+'';_0x3391fd['headers']={'Auto-Submitted':_0x7bdf('0x39'),'X-Auto-Response-Suppress':'All','Precedence':_0x7bdf('0x3a')};return mailRpc[_0x7bdf('0x3b')](_0x41d38b,_0x3391fd)[_0x7bdf('0x3c')](function(_0x130537){logger[_0x7bdf('0x10')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x49a5b9);_0x3391fd['messageId']=_0x130537[_0x7bdf('0x1e')][_0x7bdf('0x3d')];return rpc[_0x11e9b9+_0x7bdf('0x2c')][_0x7bdf('0x3e')](_0x3391fd);})[_0x7bdf('0x3c')](function(_0x1f476d){logger[_0x7bdf('0x10')]('[%s][AUTOREPLY]\x20%s',_0x49a5b9,JSON[_0x7bdf('0x3f')](_0x1f476d));})['catch'](function(_0x3e106b){logger[_0x7bdf('0x40')](_0x7bdf('0x41'),_0x49a5b9,JSON[_0x7bdf('0x3f')](_0x3e106b));})['finally'](function(){Promise[_0x7bdf('0x42')]()[_0x7bdf('0x3c')](function(){if(_0x7089b2[0x0]!=='2'||_0x2455d3['autoreplyExecuted'])return;return rpc[_0x11e9b9+_0x7bdf('0x43')][_0x7bdf('0x44')](_0x2455d3['id'],{'autoreplyExecuted':!![]})[_0x7bdf('0x3c')](function(_0x58d3d1){logger[_0x7bdf('0x10')](_0x7bdf('0x15'),_0x49a5b9,JSON[_0x7bdf('0x3f')](_0x58d3d1));})[_0x7bdf('0x45')](function(_0x530c8a){logger[_0x7bdf('0x40')](_0x7bdf('0x46'),_0x49a5b9,JSON[_0x7bdf('0x3f')](_0x530c8a));});})[_0x7bdf('0x3c')](function(){_0x261557[_0x7bdf('0x13')]();});});}else{return rpc[this[_0x7bdf('0x16')]+_0x7bdf('0x2c')][_0x7bdf('0x3e')](_0x3391fd)[_0x7bdf('0x3c')](function(_0x4e9647){logger[_0x7bdf('0x10')]('[%s][AUTOREPLY]\x20%s',_0x49a5b9,_0x3391fd[_0x7bdf('0x1c')]);})[_0x7bdf('0x45')](function(_0x20f980){logger[_0x7bdf('0x40')](_0x7bdf('0x11'),_0x49a5b9,JSON[_0x7bdf('0x3f')](_0x20f980));})[_0x7bdf('0x47')](function(){Promise[_0x7bdf('0x42')]()[_0x7bdf('0x3c')](function(){if(_0x7089b2[0x0]!=='2'||_0x2455d3[_0x7bdf('0x14')])return;return rpc[_0x11e9b9+'Interaction'][_0x7bdf('0x44')](_0x2455d3['id'],{'autoreplyExecuted':!![]})[_0x7bdf('0x3c')](function(_0x37d5d5){logger[_0x7bdf('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x49a5b9,JSON['stringify'](_0x37d5d5));})[_0x7bdf('0x45')](function(_0x60402f){logger[_0x7bdf('0x40')](_0x7bdf('0x46'),_0x49a5b9,JSON[_0x7bdf('0x3f')](_0x60402f));});})[_0x7bdf('0x3c')](function(){_0x261557[_0x7bdf('0x13')]();});});}}}catch(_0x1e8298){logger[_0x7bdf('0x40')](_0x7bdf('0x11'),_0x49a5b9,JSON['stringify'](_0x1e8298));_0x261557['stop']();}};}; \ No newline at end of file +var _0x598d=['create','[%s][AUTOREPLY]\x20%s','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','interaction','created','info','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','getMustacheRender','body','message','from','phone','read','subject','Re:','Re:\x20','account','upperFirst','AccountId','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message'];(function(_0x746bb6,_0x323470){var _0x4cf954=function(_0x3ab970){while(--_0x3ab970){_0x746bb6['push'](_0x746bb6['shift']());}};_0x4cf954(++_0x323470);}(_0x598d,0xa0));var _0xd598=function(_0x362655,_0x2ddd0a){_0x362655=_0x362655-0x0;var _0x119bfe=_0x598d[_0x362655];return _0x119bfe;};'use strict';var _=require(_0xd598('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xd598('0x1'))(_0xd598('0x2'));var rpc={'chatMessage':require(_0xd598('0x3')),'openchannelMessage':require(_0xd598('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd598('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd598('0x6')),'chatInteraction':require(_0xd598('0x7')),'openchannelInteraction':require(_0xd598('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xd598('0x9')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xd598('0xa'))};var mailRpc=require(_0xd598('0xb'));exports[_0xd598('0xc')]=function(_0xad99ab,_0x533da3){return function(_0x1b28db){try{if(_0x533da3[0x0]==='1'&&(_['isNil'](this[_0xd598('0xd')][_0xd598('0xe')])||!this[_0xd598('0xd')][_0xd598('0xe')])){logger[_0xd598('0xf')]('[%s][AUTOREPLY]\x20%s',_0xad99ab,_0xd598('0x10'));return _0x1b28db['next']();}if(_0x533da3[0x0]==='2'&&this[_0xd598('0xd')]['autoreplyExecuted']){logger[_0xd598('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xad99ab,_0xd598('0x11'));return _0x1b28db[_0xd598('0x12')]();}var _0x1f4a65=this['channel'];var _0x44e04c={'ContactId':this[_0xd598('0x13')]['id'],'sentAt':moment()[_0xd598('0x14')](_0xd598('0x15')),'direction':_0xd598('0x16')};if(this[_0xd598('0x17')]===_0xd598('0x18')){_0x44e04c['body']=utils[_0xd598('0x19')](_0x533da3[0x2],this);}else{_0x44e04c[_0xd598('0x1a')]=utils[_0xd598('0x19')](_0x533da3[0x1],this);}if(this[_0xd598('0x1b')]){_0x44e04c['to']=this[_0xd598('0x1b')][_0xd598('0x1c')]||'';if(this[_0xd598('0x17')]===_0xd598('0x18')&&_0x533da3[0x1]==='1'){_0x44e04c['cc']=this[_0xd598('0x1b')]['cc']||'';}_0x44e04c[_0xd598('0x1c')]=this[_0xd598('0x1b')]['to']||'';_0x44e04c[_0xd598('0x1d')]=this[_0xd598('0x1b')][_0xd598('0x1d')]||'';_0x44e04c[_0xd598('0x1e')]=!![];if(this[_0xd598('0x1b')][_0xd598('0x1f')]){_0x44e04c['subject']='';_0x44e04c['subject']+=_['startsWith'](this['message'][_0xd598('0x1f')],_0xd598('0x20'))?'':_0xd598('0x21');_0x44e04c[_0xd598('0x1f')]+=this[_0xd598('0x1b')][_0xd598('0x1f')];}}if(this[_0xd598('0x17')]==='chat'){_0x44e04c['ChatWebsiteId']=this[_0xd598('0x22')]['id'];}else{_0x44e04c[_[_0xd598('0x23')](this[_0xd598('0x17')])+_0xd598('0x24')]=this[_0xd598('0x22')]['id'];}_0x44e04c[_['upperFirst'](this[_0xd598('0x17')])+'InteractionId']=this[_0xd598('0xd')]['id'];var _0x5bece8=this[_0xd598('0xd')];if(rpc[this['channel']+'Message']){if(this[_0xd598('0x17')]===_0xd598('0x18')){var _0x76496f={'tls':{'rejectUnauthorized':![]}};if(this[_0xd598('0x22')][_0xd598('0x25')][_0xd598('0x26')]){_0x76496f[_0xd598('0x26')]=this[_0xd598('0x22')]['Smtp'][_0xd598('0x26')];}else{_0x76496f[_0xd598('0x27')]=this[_0xd598('0x22')][_0xd598('0x25')][_0xd598('0x27')];_0x76496f[_0xd598('0x28')]=this['account'][_0xd598('0x25')][_0xd598('0x28')];_0x76496f[_0xd598('0x29')]=this[_0xd598('0x22')][_0xd598('0x25')][_0xd598('0x29')];}if(this[_0xd598('0x22')][_0xd598('0x25')]['authentication']){_0x76496f[_0xd598('0x2a')]={'user':this['account'][_0xd598('0x25')][_0xd598('0x2b')],'pass':this[_0xd598('0x22')][_0xd598('0x25')][_0xd598('0x2c')]};}_0x44e04c[_0xd598('0x2d')]=this[_0xd598('0x1b')][_0xd598('0x2e')];_0x44e04c['html']=''+_[_0xd598('0x2f')](_0x44e04c[_0xd598('0x1a')],_0xd598('0x30'),_0xd598('0x31'))+_0xd598('0x32');_0x44e04c[_0xd598('0x33')]={'Auto-Submitted':_0xd598('0x34'),'X-Auto-Response-Suppress':_0xd598('0x35'),'Precedence':_0xd598('0x36')};return mailRpc[_0xd598('0x37')](_0x76496f,_0x44e04c)[_0xd598('0x38')](function(_0x4bb3a1){logger['info'](_0xd598('0x39'),_0xad99ab);_0x44e04c[_0xd598('0x2e')]=_0x4bb3a1[_0xd598('0x1b')][_0xd598('0x2e')];return rpc[_0x1f4a65+_0xd598('0x3a')][_0xd598('0x3b')](_0x44e04c);})[_0xd598('0x38')](function(_0x43607e){logger['info'](_0xd598('0x3c'),_0xad99ab,JSON[_0xd598('0x3d')](_0x43607e));})[_0xd598('0x3e')](function(_0x152e19){logger['error'](_0xd598('0x3f'),_0xad99ab,JSON['stringify'](_0x152e19));})[_0xd598('0x40')](function(){Promise[_0xd598('0x41')]()[_0xd598('0x38')](function(){if(_0x533da3[0x0]!=='2'||_0x5bece8[_0xd598('0x42')])return;return rpc[_0x1f4a65+_0xd598('0x43')][_0xd598('0x44')](_0x5bece8['id'],{'autoreplyExecuted':!![]})[_0xd598('0x38')](function(_0x3a5321){logger[_0xd598('0xf')](_0xd598('0x45'),_0xad99ab,JSON[_0xd598('0x3d')](_0x3a5321));})[_0xd598('0x3e')](function(_0x4d0f0f){logger[_0xd598('0x46')](_0xd598('0x47'),_0xad99ab,JSON['stringify'](_0x4d0f0f));});})[_0xd598('0x38')](function(){_0x1b28db['next']();});});}else{return rpc[this[_0xd598('0x17')]+_0xd598('0x3a')][_0xd598('0x3b')](_0x44e04c)[_0xd598('0x38')](function(_0x5454de){logger['info'](_0xd598('0x3c'),_0xad99ab,_0x44e04c[_0xd598('0x1a')]);})[_0xd598('0x3e')](function(_0x4e4ea7){logger[_0xd598('0x46')](_0xd598('0x3c'),_0xad99ab,JSON[_0xd598('0x3d')](_0x4e4ea7));})[_0xd598('0x40')](function(){Promise[_0xd598('0x41')]()[_0xd598('0x38')](function(){if(_0x533da3[0x0]!=='2'||_0x5bece8[_0xd598('0x42')])return;return rpc[_0x1f4a65+_0xd598('0x43')][_0xd598('0x44')](_0x5bece8['id'],{'autoreplyExecuted':!![]})['then'](function(_0x129ccf){logger[_0xd598('0xf')](_0xd598('0x45'),_0xad99ab,JSON[_0xd598('0x3d')](_0x129ccf));})[_0xd598('0x3e')](function(_0x3e6ac7){logger['error'](_0xd598('0x47'),_0xad99ab,JSON[_0xd598('0x3d')](_0x3e6ac7));});})[_0xd598('0x38')](function(){_0x1b28db[_0xd598('0x12')]();});});}}}catch(_0xf00449){logger[_0xd598('0x46')](_0xd598('0x3c'),_0xad99ab,JSON[_0xd598('0x3d')](_0xf00449));_0x1b28db[_0xd598('0x48')]();}};}; \ 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 b8dba06..708291a 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 _0x710e=['error','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x710e,0x152));var _0xe710=function(_0x31e855,_0x11f1a1){_0x31e855=_0x31e855-0x0;var _0x43075b=_0x710e[_0x31e855];return _0x43075b;};'use strict';var moment=require(_0xe710('0x0'));var logger=require(_0xe710('0x1'))(_0xe710('0x2'));var rpc={'chatInteraction':require(_0xe710('0x3')),'openchannelInteraction':require(_0xe710('0x4')),'smsInteraction':require(_0xe710('0x5')),'mailInteraction':require(_0xe710('0x6')),'faxInteraction':require(_0xe710('0x7')),'whatsappInteraction':require(_0xe710('0x8'))};exports[_0xe710('0x9')]=function(_0x46654a,_0x2e2354,_0x5d01ec,_0x140871){return function(_0x21695e){try{logger[_0xe710('0xa')](_0xe710('0xb'),_0x46654a,_0x2e2354[0x0]);var _0x4656a1={'closed':0x1,'closedAt':moment()[_0xe710('0xc')](_0xe710('0xd')),'closeReason':_0xe710('0xe'),'disposition':_0x2e2354[0x0]};if(rpc[_0x140871[_0xe710('0xf')]+_0xe710('0x10')]){rpc[_0x140871[_0xe710('0xf')]+_0xe710('0x10')][_0xe710('0x11')](_0x140871[_0xe710('0x12')]['id'],_0x4656a1)['then'](function(_0x54ec08){logger['info'](_0xe710('0x13'),_0x46654a,_0x140871[_0xe710('0x12')]['id']);})[_0xe710('0x14')](function(_0x1789ea){logger['error']('[%s][CLOSE]\x20%s',_0x46654a,JSON[_0xe710('0x15')](_0x1789ea));})['finally'](function(){_0x21695e['stop']();});}}catch(_0x56920d){logger[_0xe710('0x16')]('[%s][CLOSE]\x20%s',_0x46654a,JSON[_0xe710('0x15')](_0x56920d));_0x21695e[_0xe710('0x17')]();}};}; \ No newline at end of file +var _0x9755=['../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0x9755,0x1c8));var _0x5975=function(_0x32a884,_0x183853){_0x32a884=_0x32a884-0x0;var _0x242f9b=_0x9755[_0x32a884];return _0x242f9b;};'use strict';var moment=require('moment');var logger=require(_0x5975('0x0'))(_0x5975('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5975('0x2')),'smsInteraction':require(_0x5975('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x5975('0x4')),'whatsappInteraction':require(_0x5975('0x5'))};exports[_0x5975('0x6')]=function(_0x18a232,_0x52bc43,_0x1cb665,_0x6101bc){return function(_0x10a1a9){try{logger[_0x5975('0x7')](_0x5975('0x8'),_0x18a232,_0x52bc43[0x0]);var _0x50c0b8={'closed':0x1,'closedAt':moment()[_0x5975('0x9')](_0x5975('0xa')),'closeReason':_0x5975('0xb'),'disposition':_0x52bc43[0x0]};if(rpc[_0x6101bc[_0x5975('0xc')]+'Interaction']){rpc[_0x6101bc['channel']+_0x5975('0xd')][_0x5975('0xe')](_0x6101bc[_0x5975('0xf')]['id'],_0x50c0b8)[_0x5975('0x10')](function(_0x3b9b31){logger[_0x5975('0x7')](_0x5975('0x11'),_0x18a232,_0x6101bc[_0x5975('0xf')]['id']);})[_0x5975('0x12')](function(_0x26e96f){logger[_0x5975('0x13')](_0x5975('0x14'),_0x18a232,JSON['stringify'](_0x26e96f));})[_0x5975('0x15')](function(){_0x10a1a9[_0x5975('0x16')]();});}}catch(_0x2b624b){logger[_0x5975('0x13')](_0x5975('0x14'),_0x18a232,JSON[_0x5975('0x17')](_0x2b624b));_0x10a1a9['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 3183e59..86efac3 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 _0x018c=['AccountId','InteractionId','created','isEmpty','body','getMustacheRender','then','error','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','result','fulfillment','providerName','providerResponse','stringify','create','catch','lodash','moment','apiai-promise','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x018c,0xda));var _0xc018=function(_0x5683f5,_0x383b83){_0x5683f5=_0x5683f5-0x0;var _0x15100b=_0x018c[_0x5683f5];return _0x15100b;};'use strict';var _=require(_0xc018('0x0'));var moment=require(_0xc018('0x1'));var apiai=require(_0xc018('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require(_0xc018('0x3'))('routing');var rpc={'chatMessage':require(_0xc018('0x4')),'openchannelMessage':require(_0xc018('0x5')),'mailMessage':require(_0xc018('0x6')),'smsMessage':require(_0xc018('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc018('0x8'))};exports[_0xc018('0x9')]=function(_0x46f194,_0x4762ab){return function(_0x29a572){try{if(!_[_0xc018('0xa')](this[_0xc018('0xb')][_0xc018('0xc')])){logger[_0xc018('0xd')](_0xc018('0xe'),_0x46f194,_0xc018('0xf'));return _0x29a572[_0xc018('0x10')]();}var _0x3c135b={'ContactId':this[_0xc018('0x11')]['id'],'sentAt':moment()[_0xc018('0x12')](_0xc018('0x13')),'direction':_0xc018('0x14')};if(this[_0xc018('0x15')]==='sms'||this[_0xc018('0x15')]==='whatsapp'){_0x3c135b[_0xc018('0x16')]=this[_0xc018('0xb')][_0xc018('0x16')];}var _0x36b436=this[_0xc018('0x15')];if(_0x36b436===_0xc018('0x17')){_0x3c135b[_0xc018('0x18')]=this[_0xc018('0x19')]['id'];}else{_0x3c135b[_[_0xc018('0x1a')](_0x36b436)+_0xc018('0x1b')]=this[_0xc018('0x19')]['id'];}_0x3c135b[_['upperFirst'](_0x36b436)+_0xc018('0x1c')]=this[_0xc018('0xb')]['id'];if(this[_0xc018('0xb')][_0xc018('0x1d')]){var _0x70a0fd=_0x4762ab[0x2];if(!_[_0xc018('0x1e')](_0x70a0fd)){_0x3c135b[_0xc018('0x1f')]=utils[_0xc018('0x20')](_0x70a0fd,this);return rpc[_0x36b436+'Message']['create'](_0x3c135b)[_0xc018('0x21')](function(_0x4e388e){logger[_0xc018('0xd')](_0xc018('0xe'),_0x46f194,_0x3c135b[_0xc018('0x1f')]);})['catch'](function(_0x423d21){logger[_0xc018('0x22')](_0xc018('0xe'),_0x46f194,JSON['stringify'](_0x423d21));})[_0xc018('0x23')](function(){logger[_0xc018('0xd')](_0xc018('0x24'),_0x46f194);_0x29a572[_0xc018('0x25')]();});}else{logger[_0xc018('0xd')](_0xc018('0x26'),_0x46f194);_0x29a572[_0xc018('0x25')]();}}else{var _0xfbbc65=this;var _0x991e64=apiai(_0x4762ab[0x0],{'language':_0x4762ab[0x1]||'en'});return _0x991e64[_0xc018('0x27')](this[_0xc018('0x28')][_0xc018('0x1f')],{'sessionId':md5(this[_0xc018('0xb')]['id'])})[_0xc018('0x21')](function(_0x41b7da){_0xfbbc65[_0xc018('0x1f')][_0xc018('0x29')]=_0x41b7da;_0x3c135b[_0xc018('0x1f')]=_0x41b7da[_0xc018('0x2a')][_0xc018('0x2b')]['speech'];_0x3c135b[_0xc018('0x2c')]=_0xc018('0x29');_0x3c135b[_0xc018('0x2d')]=JSON[_0xc018('0x2e')](_0x41b7da);return rpc[_0x36b436+'Message'][_0xc018('0x2f')](_0x3c135b)[_0xc018('0x21')](function(_0x2dc832){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x46f194,_0x3c135b[_0xc018('0x1f')]);if(_0x41b7da[_0xc018('0x2a')]['metadata']['endConversation']){_0x29a572[_0xc018('0x10')]();}else{_0x29a572[_0xc018('0x25')]();}})[_0xc018('0x30')](function(_0x5092a3){logger[_0xc018('0x22')](_0xc018('0xe'),_0x46f194,JSON[_0xc018('0x2e')](_0x5092a3));_0x29a572[_0xc018('0x10')]();});})[_0xc018('0x30')](function(_0x34fdf4){logger[_0xc018('0x22')](_0xc018('0xe'),_0x46f194,_0x34fdf4[_0xc018('0x28')]);_0x29a572[_0xc018('0x10')]();});}}catch(_0x52d076){logger[_0xc018('0x22')](_0xc018('0xe'),_0x46f194,JSON[_0xc018('0x2e')](_0x52d076));_0x29a572['stop']();}};}; \ No newline at end of file +var _0xd7ce=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','Message','create','then','body','catch','stringify','[%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','speech','providerName','providerResponse','result','metadata','endConversation','error','lodash','moment','apiai-promise','md5','routing'];(function(_0x37820d,_0x19111a){var _0x32ffe5=function(_0xa7c52d){while(--_0xa7c52d){_0x37820d['push'](_0x37820d['shift']());}};_0x32ffe5(++_0x19111a);}(_0xd7ce,0x16b));var _0xed7c=function(_0x246115,_0x398123){_0x246115=_0x246115-0x0;var _0x385878=_0xd7ce[_0x246115];return _0x385878;};'use strict';var _=require(_0xed7c('0x0'));var moment=require(_0xed7c('0x1'));var apiai=require(_0xed7c('0x2'));var md5=require(_0xed7c('0x3'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xed7c('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xed7c('0x5')),'faxMessage':require(_0xed7c('0x6')),'whatsappMessage':require(_0xed7c('0x7'))};exports[_0xed7c('0x8')]=function(_0x34bbd7,_0x43a9e7){return function(_0x41afb9){try{if(!_[_0xed7c('0x9')](this[_0xed7c('0xa')][_0xed7c('0xb')])){logger[_0xed7c('0xc')](_0xed7c('0xd'),_0x34bbd7,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x41afb9[_0xed7c('0xe')]();}var _0x1e337e={'ContactId':this[_0xed7c('0xf')]['id'],'sentAt':moment()[_0xed7c('0x10')](_0xed7c('0x11')),'direction':_0xed7c('0x12')};if(this['channel']===_0xed7c('0x13')||this['channel']==='whatsapp'){_0x1e337e['phone']=this[_0xed7c('0xa')][_0xed7c('0x14')];}var _0x52cf82=this['channel'];if(_0x52cf82==='chat'){_0x1e337e[_0xed7c('0x15')]=this['account']['id'];}else{_0x1e337e[_[_0xed7c('0x16')](_0x52cf82)+_0xed7c('0x17')]=this['account']['id'];}_0x1e337e[_[_0xed7c('0x16')](_0x52cf82)+_0xed7c('0x18')]=this['interaction']['id'];if(this['interaction'][_0xed7c('0x19')]){var _0x28d260=_0x43a9e7[0x2];if(!_[_0xed7c('0x1a')](_0x28d260)){_0x1e337e['body']=utils['getMustacheRender'](_0x28d260,this);return rpc[_0x52cf82+_0xed7c('0x1b')][_0xed7c('0x1c')](_0x1e337e)[_0xed7c('0x1d')](function(_0x1be073){logger[_0xed7c('0xc')](_0xed7c('0xd'),_0x34bbd7,_0x1e337e[_0xed7c('0x1e')]);})[_0xed7c('0x1f')](function(_0x2500be){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x34bbd7,JSON[_0xed7c('0x20')](_0x2500be));})['finally'](function(){logger[_0xed7c('0xc')](_0xed7c('0x21'),_0x34bbd7);_0x41afb9[_0xed7c('0x22')]();});}else{logger['info'](_0xed7c('0x23'),_0x34bbd7);_0x41afb9[_0xed7c('0x22')]();}}else{var _0x2b4043=this;var _0x177cdf=apiai(_0x43a9e7[0x0],{'language':_0x43a9e7[0x1]||'en'});return _0x177cdf[_0xed7c('0x24')](this[_0xed7c('0x25')][_0xed7c('0x1e')],{'sessionId':md5(this[_0xed7c('0xa')]['id'])})[_0xed7c('0x1d')](function(_0x10e1e1){_0x2b4043[_0xed7c('0x1e')][_0xed7c('0x26')]=_0x10e1e1;_0x1e337e['body']=_0x10e1e1['result']['fulfillment'][_0xed7c('0x27')];_0x1e337e[_0xed7c('0x28')]=_0xed7c('0x26');_0x1e337e[_0xed7c('0x29')]=JSON[_0xed7c('0x20')](_0x10e1e1);return rpc[_0x52cf82+_0xed7c('0x1b')][_0xed7c('0x1c')](_0x1e337e)[_0xed7c('0x1d')](function(_0x183874){logger[_0xed7c('0xc')](_0xed7c('0xd'),_0x34bbd7,_0x1e337e['body']);if(_0x10e1e1[_0xed7c('0x2a')][_0xed7c('0x2b')][_0xed7c('0x2c')]){_0x41afb9[_0xed7c('0xe')]();}else{_0x41afb9[_0xed7c('0x22')]();}})['catch'](function(_0x5301fb){logger[_0xed7c('0x2d')](_0xed7c('0xd'),_0x34bbd7,JSON['stringify'](_0x5301fb));_0x41afb9[_0xed7c('0xe')]();});})[_0xed7c('0x1f')](function(_0x4c8d17){logger['error'](_0xed7c('0xd'),_0x34bbd7,_0x4c8d17[_0xed7c('0x25')]);_0x41afb9[_0xed7c('0xe')]();});}}catch(_0x540a82){logger[_0xed7c('0x2d')]('[%s][DIALOGFLOW]\x20%s',_0x34bbd7,JSON[_0xed7c('0x20')](_0x540a82));_0x41afb9[_0xed7c('0x22')]();}};}; \ 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 8b3656f..a115780 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 _0x0f96=['account','upperFirst','AccountId','InteractionId','created','getMustacheRender','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','dialogflow','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId'];(function(_0x23cd34,_0xe7e8f7){var _0x1e1e48=function(_0x820992){while(--_0x820992){_0x23cd34['push'](_0x23cd34['shift']());}};_0x1e1e48(++_0xe7e8f7);}(_0x0f96,0xb3));var _0x60f9=function(_0x215fbb,_0xdbaab8){_0x215fbb=_0x215fbb-0x0;var _0x25a8a0=_0x0f96[_0x215fbb];return _0x25a8a0;};'use strict';var _=require('lodash');var dialogflow=require(_0x60f9('0x0'));var md5=require(_0x60f9('0x1'));var moment=require('moment');var Promise=require(_0x60f9('0x2'));var logger=require(_0x60f9('0x3'))(_0x60f9('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x60f9('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x60f9('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x60f9('0x7')),'whatsappMessage':require(_0x60f9('0x8'))};function createMessage(_0x2275d3,_0x1e825d,_0x3663cd,_0x7e8f49){return new Promise(function(_0xc64b4b,_0x2592ea){var _0x230fad=_[_0x60f9('0x9')](_0x3663cd);_0x230fad[_0x60f9('0xa')]=_0x7e8f49;return rpc[_0x1e825d+_0x60f9('0xb')][_0x60f9('0xc')](_0x230fad)[_0x60f9('0xd')](function(){logger[_0x60f9('0xe')](_0x60f9('0xf'),_0x2275d3,_0x230fad[_0x60f9('0xa')]);_0xc64b4b();})[_0x60f9('0x10')](function(_0x53aa66){logger[_0x60f9('0x11')](_0x60f9('0xf'),_0x2275d3,JSON['stringify'](_0x53aa66));_0x2592ea(_0x53aa66);});});}exports[_0x60f9('0x12')]=function(_0x362f3f,_0x26e599){return function(_0xd4ed35){try{if(!_['isNil'](this[_0x60f9('0x13')][_0x60f9('0x14')])){logger[_0x60f9('0xe')](_0x60f9('0xf'),_0x362f3f,_0x60f9('0x15'));return _0xd4ed35[_0x60f9('0x16')]();}var _0x4b44a7={'ContactId':this[_0x60f9('0x17')]['id'],'sentAt':moment()['format'](_0x60f9('0x18')),'direction':_0x60f9('0x19')};if(this[_0x60f9('0x1a')]===_0x60f9('0x1b')||this[_0x60f9('0x1a')]===_0x60f9('0x1c')){_0x4b44a7[_0x60f9('0x1d')]=this[_0x60f9('0x13')][_0x60f9('0x1d')];}var _0x3be352=this[_0x60f9('0x1a')];if(_0x3be352==='chat'){_0x4b44a7[_0x60f9('0x1e')]=this[_0x60f9('0x1f')]['id'];}else{_0x4b44a7[_[_0x60f9('0x20')](_0x3be352)+_0x60f9('0x21')]=this[_0x60f9('0x1f')]['id'];}_0x4b44a7[_[_0x60f9('0x20')](_0x3be352)+_0x60f9('0x22')]=this[_0x60f9('0x13')]['id'];if(this['interaction'][_0x60f9('0x23')]){var _0x4e721b=_0x26e599[0x4];if(!_['isEmpty'](_0x4e721b)){_0x4b44a7[_0x60f9('0xa')]=utils[_0x60f9('0x24')](_0x4e721b,this);return rpc[_0x3be352+'Message'][_0x60f9('0xc')](_0x4b44a7)[_0x60f9('0xd')](function(_0x4a9be0){logger[_0x60f9('0xe')](_0x60f9('0xf'),_0x362f3f,_0x4b44a7[_0x60f9('0xa')]);})[_0x60f9('0x10')](function(_0x4d6c26){logger[_0x60f9('0x11')](_0x60f9('0xf'),_0x362f3f,JSON[_0x60f9('0x25')](_0x4d6c26));})[_0x60f9('0x26')](function(){logger[_0x60f9('0xe')](_0x60f9('0x27'),_0x362f3f);_0xd4ed35['stop']();});}else{logger[_0x60f9('0xe')](_0x60f9('0x28'),_0x362f3f);_0xd4ed35[_0x60f9('0x29')]();}}else{var _0x3bf473=this;var _0x405415=_0x26e599[0x2]['replace'](/\\n/g,'\x0a');var _0x45357d={'credentials':{'private_key':_0x405415,'client_email':_0x26e599[0x1]}};var _0x1ec700=new dialogflow[(_0x60f9('0x2a'))](_0x45357d);var _0x206a01=_0x1ec700[_0x60f9('0x2b')](_0x26e599[0x0],md5(_0x3bf473[_0x60f9('0x13')]['id']));var _0x468ae8={'session':_0x206a01,'queryInput':{'text':{'text':_0x3bf473[_0x60f9('0x2c')][_0x60f9('0xa')],'languageCode':_0x26e599[0x3]||'en'}}};return _0x1ec700[_0x60f9('0x2d')](_0x468ae8)[_0x60f9('0xd')](function(_0x29e969){if(_0x29e969&&_0x29e969[_0x60f9('0x2e')]){_0x3bf473[_0x60f9('0xa')][_0x60f9('0x2f')]=_0x29e969;var _0x474415=_0x29e969[0x0];var _0x4a6bf5=_0x474415[_0x60f9('0x30')][_0x60f9('0x31')]&&_0x474415[_0x60f9('0x30')]['diagnosticInfo'][_0x60f9('0x32')]?_0x474415[_0x60f9('0x30')][_0x60f9('0x31')][_0x60f9('0x32')]['end_conversation'][_0x60f9('0x33')]:![];_0x3bf473[_0x60f9('0xa')][_0x60f9('0x34')]=_0x474415[_0x60f9('0x30')][_0x60f9('0x35')];_0x3bf473[_0x60f9('0xa')][_0x60f9('0x36')]=_0x474415[_0x60f9('0x30')][_0x60f9('0x37')];_0x3bf473[_0x60f9('0xa')][_0x60f9('0x38')]=_0x474415['queryResult'][_0x60f9('0x31')]&&_0x474415[_0x60f9('0x30')]['diagnosticInfo']['fields']?_0x474415[_0x60f9('0x30')][_0x60f9('0x31')][_0x60f9('0x32')][_0x60f9('0x39')][_0x60f9('0x33')]:![];_0x3bf473[_0x60f9('0xa')][_0x60f9('0x3a')]=_0x474415[_0x60f9('0x30')][_0x60f9('0x3b')][_0x60f9('0x3c')];_0x3bf473[_0x60f9('0xa')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x474415[_0x60f9('0x30')][_0x60f9('0x3b')][_0x60f9('0x3d')];_0x3bf473['body'][_0x60f9('0x3e')]=_0x474415[_0x60f9('0x30')][_0x60f9('0x3b')][_0x60f9('0x3f')];_0x3bf473[_0x60f9('0xa')]['DIALOGFLOWV2_LANGUAGECODE']=_0x474415[_0x60f9('0x30')]['languageCode'];_0x3bf473[_0x60f9('0xa')]['DIALOGFLOWV2_QUERYTEXT']=_0x474415[_0x60f9('0x30')][_0x60f9('0x40')];_0x3bf473[_0x60f9('0xa')][_0x60f9('0x41')]=_0x474415[_0x60f9('0x30')]['intentDetectionConfidence'];_0x4b44a7[_0x60f9('0x42')]=_0x60f9('0x2f');_0x4b44a7[_0x60f9('0x43')]=JSON[_0x60f9('0x25')](_0x29e969);var _0x4a5a33=[];for(var _0x1acd9b=0x0;_0x1acd9b<_0x29e969[_0x60f9('0x2e')];_0x1acd9b++){var _0x32b5e3=_0x29e969[_0x1acd9b];if(_0x32b5e3&&_0x32b5e3[_0x60f9('0x30')]&&_0x32b5e3[_0x60f9('0x30')][_0x60f9('0x44')]){_0x4a5a33[_0x60f9('0x45')](createMessage(_0x362f3f,_0x3be352,_0x4b44a7,_0x32b5e3[_0x60f9('0x30')][_0x60f9('0x44')]));}}return Promise['all'](_0x4a5a33)[_0x60f9('0xd')](function(){if(_0x4a6bf5){_0xd4ed35['next']();}else{_0xd4ed35[_0x60f9('0x29')]();}})['catch'](function(_0xa44cb8){logger['error'](_0x60f9('0xf'),_0x362f3f,JSON[_0x60f9('0x25')](_0xa44cb8));_0xd4ed35[_0x60f9('0x16')]();});}})[_0x60f9('0x10')](function(_0x53d63a){logger[_0x60f9('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x362f3f,_0x53d63a[_0x60f9('0x2c')]);_0xd4ed35['next']();});}}catch(_0x506fdd){logger[_0x60f9('0x11')](_0x60f9('0xf'),_0x362f3f,JSON['stringify'](_0x506fdd));_0xd4ed35[_0x60f9('0x29')]();}};}; \ No newline at end of file +var _0x3506=['info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','create','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','length','push','fulfillmentText','all','next','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','then'];(function(_0xd580aa,_0x876b1){var _0xb1fbe5=function(_0xc39ee){while(--_0xc39ee){_0xd580aa['push'](_0xd580aa['shift']());}};_0xb1fbe5(++_0x876b1);}(_0x3506,0x86));var _0x6350=function(_0x575ee3,_0x31b44a){_0x575ee3=_0x575ee3-0x0;var _0x185eba=_0x3506[_0x575ee3];return _0x185eba;};'use strict';var _=require(_0x6350('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x6350('0x1'));var moment=require(_0x6350('0x2'));var Promise=require(_0x6350('0x3'));var logger=require(_0x6350('0x4'))(_0x6350('0x5'));var utils=require(_0x6350('0x6'));var rpc={'chatMessage':require(_0x6350('0x7')),'openchannelMessage':require(_0x6350('0x8')),'mailMessage':require(_0x6350('0x9')),'smsMessage':require(_0x6350('0xa')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6350('0xb'))};function createMessage(_0x1d46bb,_0x4883d9,_0x2815f8,_0x164bf2){return new Promise(function(_0x50cc9b,_0xf529b1){var _0x1617d7=_[_0x6350('0xc')](_0x2815f8);_0x1617d7[_0x6350('0xd')]=_0x164bf2;return rpc[_0x4883d9+_0x6350('0xe')]['create'](_0x1617d7)[_0x6350('0xf')](function(){logger[_0x6350('0x10')](_0x6350('0x11'),_0x1d46bb,_0x1617d7[_0x6350('0xd')]);_0x50cc9b();})[_0x6350('0x12')](function(_0x1c46fc){logger[_0x6350('0x13')](_0x6350('0x11'),_0x1d46bb,JSON[_0x6350('0x14')](_0x1c46fc));_0xf529b1(_0x1c46fc);});});}exports[_0x6350('0x15')]=function(_0x5102d4,_0x5dc68e){return function(_0x50f11b){try{if(!_[_0x6350('0x16')](this[_0x6350('0x17')][_0x6350('0x18')])){logger[_0x6350('0x10')](_0x6350('0x11'),_0x5102d4,_0x6350('0x19'));return _0x50f11b['next']();}var _0x4ae8ad={'ContactId':this[_0x6350('0x1a')]['id'],'sentAt':moment()[_0x6350('0x1b')](_0x6350('0x1c')),'direction':_0x6350('0x1d')};if(this['channel']===_0x6350('0x1e')||this['channel']==='whatsapp'){_0x4ae8ad[_0x6350('0x1f')]=this[_0x6350('0x17')][_0x6350('0x1f')];}var _0x27f2e6=this[_0x6350('0x20')];if(_0x27f2e6==='chat'){_0x4ae8ad[_0x6350('0x21')]=this[_0x6350('0x22')]['id'];}else{_0x4ae8ad[_[_0x6350('0x23')](_0x27f2e6)+_0x6350('0x24')]=this[_0x6350('0x22')]['id'];}_0x4ae8ad[_['upperFirst'](_0x27f2e6)+_0x6350('0x25')]=this[_0x6350('0x17')]['id'];if(this[_0x6350('0x17')][_0x6350('0x26')]){var _0xbca724=_0x5dc68e[0x4];if(!_[_0x6350('0x27')](_0xbca724)){_0x4ae8ad[_0x6350('0xd')]=utils['getMustacheRender'](_0xbca724,this);return rpc[_0x27f2e6+'Message'][_0x6350('0x28')](_0x4ae8ad)[_0x6350('0xf')](function(_0x5d4098){logger[_0x6350('0x10')](_0x6350('0x11'),_0x5102d4,_0x4ae8ad[_0x6350('0xd')]);})['catch'](function(_0x17791e){logger[_0x6350('0x13')](_0x6350('0x11'),_0x5102d4,JSON[_0x6350('0x14')](_0x17791e));})['finally'](function(){logger[_0x6350('0x10')](_0x6350('0x29'),_0x5102d4);_0x50f11b[_0x6350('0x2a')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5102d4);_0x50f11b[_0x6350('0x2a')]();}}else{var _0x2a23bc=this;var _0x299a8d=_0x5dc68e[0x2][_0x6350('0x2b')](/\\n/g,'\x0a');var _0x26cdee={'credentials':{'private_key':_0x299a8d,'client_email':_0x5dc68e[0x1]}};var _0x9fbaba=new dialogflow[(_0x6350('0x2c'))](_0x26cdee);var _0x2b1ec7=_0x9fbaba[_0x6350('0x2d')](_0x5dc68e[0x0],md5(_0x2a23bc[_0x6350('0x17')]['id']));var _0x95746b={'session':_0x2b1ec7,'queryInput':{'text':{'text':_0x2a23bc[_0x6350('0x2e')][_0x6350('0xd')],'languageCode':_0x5dc68e[0x3]||'en'}}};return _0x9fbaba['detectIntent'](_0x95746b)[_0x6350('0xf')](function(_0x599cb1){if(_0x599cb1&&_0x599cb1['length']){_0x2a23bc['body'][_0x6350('0x2f')]=_0x599cb1;var _0x516d21=_0x599cb1[0x0];var _0x11095f=_0x516d21[_0x6350('0x30')]['diagnosticInfo']&&_0x516d21['queryResult'][_0x6350('0x31')][_0x6350('0x32')]?_0x516d21[_0x6350('0x30')][_0x6350('0x31')][_0x6350('0x32')][_0x6350('0x33')][_0x6350('0x34')]:![];_0x2a23bc[_0x6350('0xd')]['DIALOGFLOWV2_ACTION']=_0x516d21[_0x6350('0x30')][_0x6350('0x35')];_0x2a23bc[_0x6350('0xd')][_0x6350('0x36')]=_0x516d21[_0x6350('0x30')][_0x6350('0x37')];_0x2a23bc[_0x6350('0xd')][_0x6350('0x38')]=_0x516d21[_0x6350('0x30')]['diagnosticInfo']&&_0x516d21[_0x6350('0x30')]['diagnosticInfo']['fields']?_0x516d21[_0x6350('0x30')][_0x6350('0x31')]['fields'][_0x6350('0x33')][_0x6350('0x34')]:![];_0x2a23bc[_0x6350('0xd')][_0x6350('0x39')]=_0x516d21[_0x6350('0x30')][_0x6350('0x3a')][_0x6350('0x3b')];_0x2a23bc['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x516d21['queryResult'][_0x6350('0x3a')][_0x6350('0x3c')];_0x2a23bc['body'][_0x6350('0x3d')]=_0x516d21[_0x6350('0x30')][_0x6350('0x3a')][_0x6350('0x3e')];_0x2a23bc[_0x6350('0xd')][_0x6350('0x3f')]=_0x516d21[_0x6350('0x30')][_0x6350('0x40')];_0x2a23bc[_0x6350('0xd')][_0x6350('0x41')]=_0x516d21[_0x6350('0x30')][_0x6350('0x42')];_0x2a23bc['body'][_0x6350('0x43')]=_0x516d21['queryResult'][_0x6350('0x44')];_0x4ae8ad[_0x6350('0x45')]='dialogflowV2';_0x4ae8ad['providerResponse']=JSON[_0x6350('0x14')](_0x599cb1);var _0xf1b67d=[];for(var _0x4ab109=0x0;_0x4ab109<_0x599cb1[_0x6350('0x46')];_0x4ab109++){var _0x2550a7=_0x599cb1[_0x4ab109];if(_0x2550a7&&_0x2550a7[_0x6350('0x30')]&&_0x2550a7[_0x6350('0x30')]['fulfillmentText']){_0xf1b67d[_0x6350('0x47')](createMessage(_0x5102d4,_0x27f2e6,_0x4ae8ad,_0x2550a7[_0x6350('0x30')][_0x6350('0x48')]));}}return Promise[_0x6350('0x49')](_0xf1b67d)[_0x6350('0xf')](function(){if(_0x11095f){_0x50f11b[_0x6350('0x4a')]();}else{_0x50f11b['stop']();}})['catch'](function(_0x2e12c0){logger['error'](_0x6350('0x11'),_0x5102d4,JSON[_0x6350('0x14')](_0x2e12c0));_0x50f11b[_0x6350('0x4a')]();});}})['catch'](function(_0x475177){logger[_0x6350('0x13')](_0x6350('0x11'),_0x5102d4,_0x475177['message']);_0x50f11b['next']();});}}catch(_0x1554ca){logger['error'](_0x6350('0x11'),_0x5102d4,JSON[_0x6350('0x14')](_0x1554ca));_0x50f11b[_0x6350('0x2a')]();}};}; \ 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 32525a3..75cd740 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 _0x580c=['../../../../config/logger','routing','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','map','message','join','condition','priorityTrue','priorityFalse','info','findIndex','rules','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20%s','stringify','lodash','./utils'];(function(_0x156216,_0x2ca942){var _0x19b5a6=function(_0x55f4f1){while(--_0x55f4f1){_0x156216['push'](_0x156216['shift']());}};_0x19b5a6(++_0x2ca942);}(_0x580c,0x15a));var _0xc580=function(_0xb62642,_0x50ede8){_0xb62642=_0xb62642-0x0;var _0x18c6fb=_0x580c[_0xb62642];return _0x18c6fb;};'use strict';var schema=require('validate');var _=require(_0xc580('0x0'));var htmlToText=require('html-to-text');var utils=require(_0xc580('0x1'));var logger=require(_0xc580('0x2'))(_0xc580('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xc580('0x4')},'priorityTrue':{'type':_0xc580('0x5'),'message':_0xc580('0x6')},'priorityFalse':{'type':'number','message':_0xc580('0x7')}});exports[_0xc580('0x8')]=function(_0x2a2600,_0x271601){return function(_0x2f9082){try{var _0xa05cdf={'condition':htmlToText[_0xc580('0x9')](utils[_0xc580('0xa')](_0x271601[0x0],this),{'wordwrap':![]})[_0xc580('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x271601[0x1],'priorityFalse':_0x271601[0x2]};var _0x3b5fbf=gotoif[_0xc580('0xc')](_0xa05cdf,{'typecast':!![]});if(_0x3b5fbf[_0xc580('0xd')]){logger[_0xc580('0xe')]('[%s][GOTOIF]\x20%s',_0x2a2600,_[_0xc580('0xf')](_0x3b5fbf,_0xc580('0x10'))[_0xc580('0x11')](',\x20'));_0x2f9082['stop']();}else{try{var _0x5b1523=eval('('+_0xa05cdf[_0xc580('0x12')]+')');var _0x49ec5c=_0x5b1523?_0xa05cdf[_0xc580('0x13')]:_0xa05cdf[_0xc580('0x14')];logger[_0xc580('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2a2600,_0xa05cdf[_0xc580('0x12')],_0x5b1523,_0x49ec5c||'next');if(_0x49ec5c){var _0x50587f=_[_0xc580('0x16')](_0x2f9082[_0xc580('0x17')](),{'p':_0x49ec5c});if(_0x50587f>=0x0){logger[_0xc580('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2a2600,_0x49ec5c||_0xc580('0x18'),_0x50587f);_0x2f9082['next'](_0x50587f);}else{logger[_0xc580('0x15')](_0xc580('0x19'),_0x2a2600,_0x49ec5c||_0xc580('0x18'));_0x2f9082['stop']();}}else{_0x2f9082[_0xc580('0x18')]();}}catch(_0x1ac7a6){logger[_0xc580('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2a2600,_0x1ac7a6['message']);_0x2f9082[_0xc580('0x1a')]();}}}catch(_0x2bb4ae){logger[_0xc580('0xe')](_0xc580('0x1b'),_0x2a2600,JSON[_0xc580('0x1c')](_0x2bb4ae));_0x2f9082[_0xc580('0x1a')]();}};}; \ No newline at end of file +var _0xfd94=['length','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','string','priority\x20true\x20is\x20a\x20number','number','consequence','fromString','getMustacheRender','replace'];(function(_0x414dc7,_0x2bd872){var _0x544b04=function(_0x2eecd5){while(--_0x2eecd5){_0x414dc7['push'](_0x414dc7['shift']());}};_0x544b04(++_0x2bd872);}(_0xfd94,0x189));var _0x4fd9=function(_0x2d83c3,_0x564ad7){_0x2d83c3=_0x2d83c3-0x0;var _0x6832f3=_0xfd94[_0x2d83c3];return _0x6832f3;};'use strict';var schema=require(_0x4fd9('0x0'));var _=require(_0x4fd9('0x1'));var htmlToText=require(_0x4fd9('0x2'));var utils=require(_0x4fd9('0x3'));var logger=require(_0x4fd9('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x4fd9('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x4fd9('0x6')},'priorityFalse':{'type':_0x4fd9('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x4fd9('0x8')]=function(_0x4d0632,_0x58f856){return function(_0x18b585){try{var _0x5ea71f={'condition':htmlToText[_0x4fd9('0x9')](utils[_0x4fd9('0xa')](_0x58f856[0x0],this),{'wordwrap':![]})[_0x4fd9('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x58f856[0x1],'priorityFalse':_0x58f856[0x2]};var _0x2a0196=gotoif[_0x4fd9('0x0')](_0x5ea71f,{'typecast':!![]});if(_0x2a0196[_0x4fd9('0xc')]){logger['error']('[%s][GOTOIF]\x20%s',_0x4d0632,_[_0x4fd9('0xd')](_0x2a0196,_0x4fd9('0xe'))[_0x4fd9('0xf')](',\x20'));_0x18b585[_0x4fd9('0x10')]();}else{try{var _0x533efa=eval('('+_0x5ea71f[_0x4fd9('0x11')]+')');var _0x161eae=_0x533efa?_0x5ea71f['priorityTrue']:_0x5ea71f[_0x4fd9('0x12')];logger[_0x4fd9('0x13')](_0x4fd9('0x14'),_0x4d0632,_0x5ea71f['condition'],_0x533efa,_0x161eae||_0x4fd9('0x15'));if(_0x161eae){var _0x353c37=_[_0x4fd9('0x16')](_0x18b585['rules'](),{'p':_0x161eae});if(_0x353c37>=0x0){logger[_0x4fd9('0x13')](_0x4fd9('0x17'),_0x4d0632,_0x161eae||_0x4fd9('0x15'),_0x353c37);_0x18b585['next'](_0x353c37);}else{logger[_0x4fd9('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4d0632,_0x161eae||_0x4fd9('0x15'));_0x18b585[_0x4fd9('0x10')]();}}else{_0x18b585[_0x4fd9('0x15')]();}}catch(_0x70a042){logger[_0x4fd9('0x18')](_0x4fd9('0x19'),_0x4d0632,_0x70a042[_0x4fd9('0xe')]);_0x18b585[_0x4fd9('0x10')]();}}}catch(_0x5ab196){logger['error'](_0x4fd9('0x1a'),_0x4d0632,JSON['stringify'](_0x5ab196));_0x18b585[_0x4fd9('0x10')]();}};}; \ 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 3c3e083..18bf8b0 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 _0x30ec=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','message','stop','findIndex','priority','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number'];(function(_0x6ce53d,_0xc39b64){var _0x2e2344=function(_0x553680){while(--_0x553680){_0x6ce53d['push'](_0x6ce53d['shift']());}};_0x2e2344(++_0xc39b64);}(_0x30ec,0x19a));var _0xc30e=function(_0x30a457,_0x2aa6b5){_0x30a457=_0x30a457-0x0;var _0x2ae5cd=_0x30ec[_0x30a457];return _0x2ae5cd;};'use strict';var schema=require('validate');var _=require(_0xc30e('0x0'));var logger=require(_0xc30e('0x1'))(_0xc30e('0x2'));var gotop=schema({'priority':{'type':_0xc30e('0x3'),'required':!![],'message':_0xc30e('0x4')}});exports[_0xc30e('0x5')]=function(_0x43c3db,_0x198115){return function(_0xbc7298){try{var _0x4f2a0e={'priority':_0x198115[0x0]};var _0x33b4a4=gotop[_0xc30e('0x6')](_0x4f2a0e,{'typecast':!![]});if(_0x33b4a4[_0xc30e('0x7')]){logger[_0xc30e('0x8')]('[%s][GOTOP]\x20%s',_0x43c3db,_['map'](_0x33b4a4,_0xc30e('0x9'))['join'](',\x20'));_0xbc7298[_0xc30e('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x43c3db,_0x4f2a0e['priority']);if(_0x4f2a0e['priority']){var _0x339c19=_[_0xc30e('0xb')](_0xbc7298['rules'](),{'p':_0x4f2a0e[_0xc30e('0xc')]});if(_0x339c19>=0x0){logger[_0xc30e('0xd')](_0xc30e('0xe'),_0x43c3db,_0x4f2a0e[_0xc30e('0xc')]||_0xc30e('0xf'),_0x339c19);_0xbc7298['next'](_0x339c19);}else{logger['info'](_0xc30e('0x10'),_0x43c3db,_0x4f2a0e[_0xc30e('0xc')]||'next');_0xbc7298[_0xc30e('0xa')]();}}else{_0xbc7298[_0xc30e('0xf')]();}}}catch(_0x5431e0){logger[_0xc30e('0x8')]('[%s][GOTOP]\x20%s',_0x43c3db,JSON[_0xc30e('0x11')](_0x5431e0));_0xbc7298[_0xc30e('0xa')]();}};}; \ No newline at end of file +var _0x4fb7=['findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x4fb7,0x1d2));var _0x74fb=function(_0x5740be,_0x1f85e1){_0x5740be=_0x5740be-0x0;var _0x208aaf=_0x4fb7[_0x5740be];return _0x208aaf;};'use strict';var schema=require(_0x74fb('0x0'));var _=require(_0x74fb('0x1'));var logger=require(_0x74fb('0x2'))(_0x74fb('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x74fb('0x4')}});exports['consequence']=function(_0x2d07dc,_0x1fcb86){return function(_0x3f244d){try{var _0x198117={'priority':_0x1fcb86[0x0]};var _0x4ab284=gotop['validate'](_0x198117,{'typecast':!![]});if(_0x4ab284[_0x74fb('0x5')]){logger[_0x74fb('0x6')]('[%s][GOTOP]\x20%s',_0x2d07dc,_[_0x74fb('0x7')](_0x4ab284,_0x74fb('0x8'))[_0x74fb('0x9')](',\x20'));_0x3f244d[_0x74fb('0xa')]();}else{logger[_0x74fb('0xb')](_0x74fb('0xc'),_0x2d07dc,_0x198117[_0x74fb('0xd')]);if(_0x198117[_0x74fb('0xd')]){var _0xe1601a=_[_0x74fb('0xe')](_0x3f244d[_0x74fb('0xf')](),{'p':_0x198117[_0x74fb('0xd')]});if(_0xe1601a>=0x0){logger[_0x74fb('0xb')](_0x74fb('0x10'),_0x2d07dc,_0x198117[_0x74fb('0xd')]||_0x74fb('0x11'),_0xe1601a);_0x3f244d[_0x74fb('0x11')](_0xe1601a);}else{logger['info'](_0x74fb('0x12'),_0x2d07dc,_0x198117['priority']||_0x74fb('0x11'));_0x3f244d[_0x74fb('0xa')]();}}else{_0x3f244d[_0x74fb('0x11')]();}}}catch(_0x1c7956){logger['error']('[%s][GOTOP]\x20%s',_0x2d07dc,JSON[_0x74fb('0x13')](_0x1c7956));_0x3f244d[_0x74fb('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 d2f4b1d..ec355ec 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 _0xbb59=['consequence','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','Message','then','info','[%s][MESSAGE]\x20%s','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0xbb59,0x1d2));var _0x9bb5=function(_0x54096a,_0x38cd17){_0x54096a=_0x54096a-0x0;var _0x5090d9=_0xbb59[_0x54096a];return _0x5090d9;};'use strict';var _=require(_0x9bb5('0x0'));var utils=require('./utils');var logger=require(_0x9bb5('0x1'))(_0x9bb5('0x2'));var rpc={'chatMessage':require(_0x9bb5('0x3')),'openchannelMessage':require(_0x9bb5('0x4')),'mailMessage':require(_0x9bb5('0x5')),'smsMessage':require(_0x9bb5('0x6')),'faxMessage':require(_0x9bb5('0x7')),'whatsappMessage':require(_0x9bb5('0x8'))};exports[_0x9bb5('0x9')]=function(_0x1845e9,_0x2cf9a6){return function(_0x539756){try{var _0x5930df={'body':utils[_0x9bb5('0xa')](_0x2cf9a6[0x0],this),'ContactId':this[_0x9bb5('0xb')]['id']};if(this[_0x9bb5('0xc')]===_0x9bb5('0xd')){_0x5930df['ChatWebsiteId']=this[_0x9bb5('0xe')]['id'];}else{_0x5930df[_[_0x9bb5('0xf')](this[_0x9bb5('0xc')])+_0x9bb5('0x10')]=this[_0x9bb5('0xe')]['id'];}_0x5930df[_[_0x9bb5('0xf')](this[_0x9bb5('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x9bb5('0xc')]+'Message']){return rpc[this[_0x9bb5('0xc')]+_0x9bb5('0x11')]['create'](_0x5930df)[_0x9bb5('0x12')](function(_0x5a48e7){logger[_0x9bb5('0x13')](_0x9bb5('0x14'),_0x1845e9,_0x5930df['body']);_0x539756['next']();})[_0x9bb5('0x15')](function(_0x5d5438){logger[_0x9bb5('0x16')](_0x9bb5('0x14'),_0x1845e9,JSON[_0x9bb5('0x17')](_0x5d5438));_0x539756['stop']();});}}catch(_0xa440c4){logger['error'](_0x9bb5('0x14'),_0x1845e9,JSON['stringify'](_0xa440c4));_0x539756[_0x9bb5('0x18')]();}};}; \ No newline at end of file +var _0x0c8d=['AccountId','upperFirst','interaction','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','consequence','contact','channel','chat','ChatWebsiteId','account'];(function(_0x512563,_0x3a657c){var _0x42fa53=function(_0x3c1ac3){while(--_0x3c1ac3){_0x512563['push'](_0x512563['shift']());}};_0x42fa53(++_0x3a657c);}(_0x0c8d,0x79));var _0xd0c8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0c8d[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var utils=require(_0xd0c8('0x0'));var logger=require(_0xd0c8('0x1'))(_0xd0c8('0x2'));var rpc={'chatMessage':require(_0xd0c8('0x3')),'openchannelMessage':require(_0xd0c8('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd0c8('0x5')]=function(_0x15d739,_0xa4eeb2){return function(_0x50484d){try{var _0x16d1c1={'body':utils['getMustacheRender'](_0xa4eeb2[0x0],this),'ContactId':this[_0xd0c8('0x6')]['id']};if(this[_0xd0c8('0x7')]===_0xd0c8('0x8')){_0x16d1c1[_0xd0c8('0x9')]=this[_0xd0c8('0xa')]['id'];}else{_0x16d1c1[_['upperFirst'](this[_0xd0c8('0x7')])+_0xd0c8('0xb')]=this[_0xd0c8('0xa')]['id'];}_0x16d1c1[_[_0xd0c8('0xc')](this['channel'])+'InteractionId']=this[_0xd0c8('0xd')]['id'];if(rpc[this[_0xd0c8('0x7')]+'Message']){return rpc[this['channel']+'Message']['create'](_0x16d1c1)['then'](function(_0x367c89){logger[_0xd0c8('0xe')]('[%s][MESSAGE]\x20%s',_0x15d739,_0x16d1c1[_0xd0c8('0xf')]);_0x50484d[_0xd0c8('0x10')]();})[_0xd0c8('0x11')](function(_0x2cb982){logger[_0xd0c8('0x12')](_0xd0c8('0x13'),_0x15d739,JSON[_0xd0c8('0x14')](_0x2cb982));_0x50484d[_0xd0c8('0x15')]();});}}catch(_0x2c25e8){logger[_0xd0c8('0x12')](_0xd0c8('0x13'),_0x15d739,JSON[_0xd0c8('0x14')](_0x2c25e8));_0x50484d['stop']();}};}; \ 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 77090ad..f5cfffe 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 _0x3e01=['./utils','../../../../config/logger','consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stop'];(function(_0x352dc9,_0x165ef3){var _0x1db412=function(_0x540ace){while(--_0x540ace){_0x352dc9['push'](_0x352dc9['shift']());}};_0x1db412(++_0x165ef3);}(_0x3e01,0x7e));var _0x13e0=function(_0x1f9a81,_0x33ad2d){_0x1f9a81=_0x1f9a81-0x0;var _0xd0a764=_0x3e01[_0x1f9a81];return _0xd0a764;};'use strict';var utils=require(_0x13e0('0x0'));var logger=require(_0x13e0('0x1'))('routing');exports[_0x13e0('0x2')]=function(_0x721223,_0x1af318){return function(_0x4feb5a){try{logger[_0x13e0('0x3')]('[%s][NOOP]\x20%s',_0x721223,utils[_0x13e0('0x4')](_0x1af318[0x0],this));_0x4feb5a[_0x13e0('0x5')]();}catch(_0x4d8d8b){logger[_0x13e0('0x6')](_0x13e0('0x7'),_0x721223,JSON['stringify'](_0x4d8d8b));_0x4feb5a[_0x13e0('0x8')]();}};}; \ No newline at end of file +var _0xdd83=['getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x2923ca,_0x1e69e6){var _0x1774ca=function(_0x1f2df5){while(--_0x1f2df5){_0x2923ca['push'](_0x2923ca['shift']());}};_0x1774ca(++_0x1e69e6);}(_0xdd83,0xe1));var _0x3dd8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdd83[_0x4a9fb1];return _0x348672;};'use strict';var utils=require(_0x3dd8('0x0'));var logger=require(_0x3dd8('0x1'))(_0x3dd8('0x2'));exports[_0x3dd8('0x3')]=function(_0x466878,_0x2b4cdf){return function(_0x419e3c){try{logger['info'](_0x3dd8('0x4'),_0x466878,utils[_0x3dd8('0x5')](_0x2b4cdf[0x0],this));_0x419e3c[_0x3dd8('0x6')]();}catch(_0x3dee8a){logger[_0x3dd8('0x7')](_0x3dd8('0x4'),_0x466878,JSON[_0x3dd8('0x8')](_0x3dee8a));_0x419e3c[_0x3dd8('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 dde32e4..ff15821 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 _0xdb90=['create','catch','create\x20queue\x20report','waiting','[%s][STOP:QUEUE][NAME:%s]','update','error','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','moment','ioredis','routing','redis','defaults','socket.io-emitter','queue_id','account','from','emit','clone','queue','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xdb90,0xf8));var _0x0db9=function(_0x575818,_0xa55f3f){_0x575818=_0x575818-0x0;var _0x13bd05=_0xdb90[_0x575818];return _0x13bd05;};'use strict';var schema=require(_0x0db9('0x0'));var _=require(_0x0db9('0x1'));var util=require('util');var seqqueue=require(_0x0db9('0x2'));var moment=require(_0x0db9('0x3'));var Redis=require(_0x0db9('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x0db9('0x5'));var strategy=require('./strategy');config[_0x0db9('0x6')]=_[_0x0db9('0x7')](config[_0x0db9('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0db9('0x8'))(new Redis(config[_0x0db9('0x6')]));var attributes=['id',_0x0db9('0x9'),_0x0db9('0xa'),'queue',_0x0db9('0xb'),'joinAt'];function emit(_0x15ea70,_0x5a1901,_0x3a7e35){io['to'](_0x15ea70)[_0x0db9('0xc')](_0x5a1901,_0x3a7e35);}function emitChannelQueueInteraction(_0x3060f4,_0xc580af,_0x251321,_0x18c451,_0x33d977,_0x93e9a1,_0x4cfdfe,_0x583b7d){var _0x1ae3a3=_[_0x0db9('0xd')](_0x251321);_0x1ae3a3['queue_id']=_0x583b7d;_0x1ae3a3[_0x0db9('0xe')]=_0xc580af;_0x1ae3a3[_0x0db9('0xa')]=_0x18c451;_0x1ae3a3['id']=_0x33d977;if(_0x93e9a1){_0x4cfdfe[util[_0x0db9('0xf')](_0x0db9('0x10'),_0x3060f4)][_0x33d977]=_[_0x0db9('0x11')](_0x1ae3a3,attributes);}else{delete _0x4cfdfe[util[_0x0db9('0xf')](_0x0db9('0x10'),_0x3060f4)][_0x33d977];}emit(util['format'](_0x0db9('0x12'),_0x3060f4,_0xc580af),util[_0x0db9('0xf')](_0x0db9('0x13'),_0x3060f4,_0x93e9a1?_0x0db9('0x14'):'remove'),_['pick'](_0x1ae3a3,attributes));}var rpc={'openchannelQueueReport':require(_0x0db9('0x15')),'mailQueueReport':require(_0x0db9('0x16')),'chatQueueReport':require(_0x0db9('0x17')),'smsQueueReport':require(_0x0db9('0x18')),'faxQueueReport':require(_0x0db9('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0db9('0x1a'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xe19e5a,_0x212a91,_0x317a3d,_0xe0b6d0){if(_0xe19e5a&&_0x212a91&&_0x317a3d){_0x212a91['waiting']+=0x1;var _0x32c3b5={'uniqueid':_0xe19e5a,'from':_0x317a3d[_0x0db9('0x1b')]?_0x317a3d[_0x0db9('0x1b')][_0x0db9('0xb')]:'','joinAt':moment()[_0x0db9('0xf')](_0x0db9('0x1c')),'ContactId':_0x317a3d[_0x0db9('0x1d')]?_0x317a3d[_0x0db9('0x1d')]['id']:null,'ListId':_0x317a3d[_0x0db9('0x1e')]?_0x317a3d[_0x0db9('0x1e')]['id']:null};_0x32c3b5[_[_0x0db9('0x1f')](_0x317a3d[_0x0db9('0x20')])+_0x0db9('0x21')]=_0x212a91['id']||null;_0x32c3b5[_['upperFirst'](_0x317a3d[_0x0db9('0x20')])+_0x0db9('0x22')]=_0x317a3d[_0x0db9('0x23')]?_0x317a3d[_0x0db9('0x23')]['id']:null;_0x32c3b5[_[_0x0db9('0x1f')](_0x317a3d[_0x0db9('0x20')])+_0x0db9('0x24')]=_0x317a3d[_0x0db9('0x25')]?_0x317a3d[_0x0db9('0x25')]['id']:null;_0x32c3b5[_[_0x0db9('0x1f')](_0x317a3d['channel'])+(_0x317a3d[_0x0db9('0x20')]!==_0x0db9('0x26')?'AccountId':_0x0db9('0x27'))]=_0x317a3d['account']?_0x317a3d[_0x0db9('0xa')]['id']:null;logger[_0x0db9('0x28')](util[_0x0db9('0xf')](_0x0db9('0x29'),_0xe19e5a,_0x212a91['name']));emitChannelQueueInteraction(_0x317a3d[_0x0db9('0x20')],_0x212a91[_0x0db9('0x2a')],_0x32c3b5,_0x317a3d[_0x0db9('0xa')][_0x0db9('0x2a')],_0x317a3d[_0x0db9('0x25')]['id'],!![],_0xe0b6d0,_0x212a91['id']);if(rpc[_0x317a3d['channel']+'QueueReport']){return rpc[_0x317a3d[_0x0db9('0x20')]+_0x0db9('0x2b')][_0x0db9('0x2c')](_0x32c3b5)[_0x0db9('0x2d')](function(_0x234da8){logger['error'](_0x0db9('0x2e'));});}}}function stopRouting(_0x15f78c,_0x4e2cc0,_0x19c757,_0x483cd6){if(_0x15f78c&&_0x4e2cc0){_0x4e2cc0[_0x0db9('0x2f')]-=0x1;var _0x320f3a={'leaveAt':moment()['format'](_0x0db9('0x1c')),'acceptAt':moment()[_0x0db9('0xf')](_0x0db9('0x1c')),'reason':'accepted'};logger[_0x0db9('0x28')](util[_0x0db9('0xf')](_0x0db9('0x30'),_0x15f78c,_0x4e2cc0[_0x0db9('0x2a')]));emitChannelQueueInteraction(_0x19c757[_0x0db9('0x20')],_0x4e2cc0[_0x0db9('0x2a')],_0x19c757[_0x0db9('0x1b')],_0x19c757[_0x0db9('0xa')][_0x0db9('0x2a')],_0x19c757[_0x0db9('0x25')]['id'],![],_0x483cd6,_0x4e2cc0['id']);if(rpc[_0x19c757['channel']+'QueueReport']){return rpc[_0x19c757['channel']+'QueueReport'][_0x0db9('0x31')](_0x15f78c,_0x320f3a)[_0x0db9('0x2d')](function(_0x2747a9){logger[_0x0db9('0x32')]('update\x20queue\x20report');});}}}function endRouting(_0x45450c,_0x51033f,_0x38a75a,_0x1c8ca4){if(_0x45450c&&_0x51033f){_0x51033f[_0x0db9('0x2f')]-=0x1;var _0x57cd1d={'leaveAt':moment()[_0x0db9('0xf')](_0x0db9('0x1c')),'exitAt':moment()[_0x0db9('0xf')](_0x0db9('0x1c')),'reason':_0x0db9('0x33')};logger[_0x0db9('0x28')](util[_0x0db9('0xf')](_0x0db9('0x34'),_0x45450c,_0x51033f[_0x0db9('0x2a')]));emitChannelQueueInteraction(_0x38a75a['channel'],_0x51033f[_0x0db9('0x2a')],_0x38a75a[_0x0db9('0x1b')],_0x38a75a[_0x0db9('0xa')][_0x0db9('0x2a')],_0x38a75a[_0x0db9('0x25')]['id'],![],_0x1c8ca4);if(rpc[_0x38a75a[_0x0db9('0x20')]+_0x0db9('0x2b')]){return rpc[_0x38a75a[_0x0db9('0x20')]+_0x0db9('0x2b')][_0x0db9('0x31')](_0x45450c,_0x57cd1d)[_0x0db9('0x2d')](function(_0x3c84a2){logger[_0x0db9('0x32')](_0x0db9('0x35'));});}}}function handleFindQueue(_0x1bb043){return function(_0x24e3e0){return _0x24e3e0['name'][_0x0db9('0x36')]()===_0x1bb043[_0x0db9('0x36')]();};}exports['consequence']=function(_0x471a3c,_0x50b250,_0x2cb902,_0x3a6b33){return function(_0x4cebc3){try{var _0xe81c8b={'name':_0x50b250[0x0],'timeout':_0x50b250[0x1]};var _0x451601=queue[_0x0db9('0x0')](_0xe81c8b,{'typecast':!![]});if(_0x451601[_0x0db9('0x37')]){logger[_0x0db9('0x32')](_0x0db9('0x38'),_0x471a3c,_[_0x0db9('0x39')](_0x451601,_0x0db9('0x25'))['join'](',\x20'));_0x4cebc3[_0x0db9('0x3a')]();}else{var _0x239b94=_[_0x0db9('0x3b')](_0x2cb902[_0x3a6b33[_0x0db9('0x20')]+_0x0db9('0x3c')],handleFindQueue(_0xe81c8b[_0x0db9('0x2a')]));if(_0x239b94){startRouting(_0x471a3c,_0x239b94,_0x3a6b33,_0x2cb902);var _0x21cfcc=(_0x239b94[_0x0db9('0x33')]||0xa)*0x3e8;var _0x22561b=(_0xe81c8b[_0x0db9('0x33')]||0x14)*0x3e8;var _0x41cb9c,_0x174ea1;if(_0x21cfcc>_0x22561b){_0x22561b=_0x21cfcc;}var _0x12161f=seqqueue['createQueue'](_0x21cfcc);_0x12161f['id']=_0x471a3c;_0x12161f[_0x0db9('0x3d')]=_0x21cfcc;_0x12161f[_0x0db9('0x3e')]=_0x22561b;_0x12161f[_0x0db9('0x20')]=_0x3a6b33['channel'];_0x2cb902[_0x0db9('0x3f')][_0x471a3c]['on'](_0x0db9('0x40'),function(){logger[_0x0db9('0x28')](_0x0db9('0x41'),_0x471a3c);stopRouting(_0x471a3c,_0x239b94,_0x3a6b33,_0x2cb902);clearTimeout(_0x41cb9c);_0x41cb9c=undefined;_0x12161f[_0x0db9('0x42')](!![]);if(_0x2cb902[_0x0db9('0x3f')][_0x471a3c]){delete _0x2cb902['rules'][_0x471a3c];}_0x4cebc3[_0x0db9('0x3a')]();});_0x2cb902[_0x0db9('0x3f')][_0x471a3c]['on'](_0x0db9('0x43'),function(){if(_0x2cb902['rules'][_0x471a3c]){delete _0x2cb902[_0x0db9('0x3f')][_0x471a3c];}});_0x41cb9c=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x471a3c);endRouting(_0x471a3c,_0x239b94,_0x3a6b33,_0x2cb902);clearTimeout(_0x41cb9c);_0x12161f[_0x0db9('0x42')](!![]);_0x4cebc3[_0x0db9('0x44')]();},_0x22561b);switch(_0x239b94['strategy']){case _0x0db9('0x45'):strategy[_0x0db9('0x45')](_0x12161f,_0x239b94,_0x2cb902,_0x3a6b33);break;default:strategy[_0x0db9('0x46')](_0x12161f,_0x239b94,_0x2cb902,_0x3a6b33);}}else{logger[_0x0db9('0x32')](_0x0db9('0x47'),_0x471a3c,_0xe81c8b[_0x0db9('0x2a')]);_0x4cebc3[_0x0db9('0x3a')]();}}}catch(_0x2baa7d){console['log'](_0x2baa7d);logger[_0x0db9('0x32')](_0x0db9('0x38'),_0x471a3c,_0x2baa7d[_0x0db9('0x48')]);_0x4cebc3[_0x0db9('0x3a')]();}};}; \ No newline at end of file +var _0x0cce=['qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','waiting','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue'];(function(_0x2545d0,_0x397e79){var _0x10111b=function(_0x2fdcd8){while(--_0x2fdcd8){_0x2545d0['push'](_0x2545d0['shift']());}};_0x10111b(++_0x397e79);}(_0x0cce,0xf6));var _0xe0cc=function(_0x1539bf,_0x28aace){_0x1539bf=_0x1539bf-0x0;var _0x2607eb=_0x0cce[_0x1539bf];return _0x2607eb;};'use strict';var schema=require(_0xe0cc('0x0'));var _=require(_0xe0cc('0x1'));var util=require(_0xe0cc('0x2'));var seqqueue=require(_0xe0cc('0x3'));var moment=require('moment');var Redis=require(_0xe0cc('0x4'));var config=require(_0xe0cc('0x5'));var logger=require(_0xe0cc('0x6'))('routing');var strategy=require(_0xe0cc('0x7'));config[_0xe0cc('0x8')]=_['defaults'](config['redis'],{'host':_0xe0cc('0x9'),'port':0x18eb});var io=require(_0xe0cc('0xa'))(new Redis(config[_0xe0cc('0x8')]));var attributes=['id',_0xe0cc('0xb'),_0xe0cc('0xc'),_0xe0cc('0xd'),_0xe0cc('0xe'),_0xe0cc('0xf')];function emit(_0x353b76,_0x213dc6,_0x93b30){io['to'](_0x353b76)[_0xe0cc('0x10')](_0x213dc6,_0x93b30);}function emitChannelQueueInteraction(_0x481016,_0x35faae,_0x4bb09e,_0x300fc7,_0x1ab665,_0x44b5d6,_0x480814,_0x2ec915){var _0x2f224c=_[_0xe0cc('0x11')](_0x4bb09e);_0x2f224c[_0xe0cc('0xb')]=_0x2ec915;_0x2f224c[_0xe0cc('0xd')]=_0x35faae;_0x2f224c[_0xe0cc('0xc')]=_0x300fc7;_0x2f224c['id']=_0x1ab665;if(_0x44b5d6){_0x480814[util['format'](_0xe0cc('0x12'),_0x481016)][_0x1ab665]=_[_0xe0cc('0x13')](_0x2f224c,attributes);}else{delete _0x480814[util[_0xe0cc('0x14')](_0xe0cc('0x12'),_0x481016)][_0x1ab665];}emit(util[_0xe0cc('0x14')]('%s:queue:%s',_0x481016,_0x35faae),util[_0xe0cc('0x14')](_0xe0cc('0x15'),_0x481016,_0x44b5d6?_0xe0cc('0x16'):_0xe0cc('0x17')),_['pick'](_0x2f224c,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xe0cc('0x18')),'chatQueueReport':require(_0xe0cc('0x19')),'smsQueueReport':require(_0xe0cc('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xe0cc('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xe0cc('0x1c')},'timeout':{'type':_0xe0cc('0x1d'),'message':_0xe0cc('0x1e')}});function startRouting(_0x56f4dc,_0x361bd5,_0x522fbe,_0x33142a){if(_0x56f4dc&&_0x361bd5&&_0x522fbe){_0x361bd5['waiting']+=0x1;var _0x597136={'uniqueid':_0x56f4dc,'from':_0x522fbe[_0xe0cc('0x1f')]?_0x522fbe[_0xe0cc('0x1f')]['from']:'','joinAt':moment()[_0xe0cc('0x14')](_0xe0cc('0x20')),'ContactId':_0x522fbe[_0xe0cc('0x21')]?_0x522fbe['contact']['id']:null,'ListId':_0x522fbe[_0xe0cc('0x22')]?_0x522fbe[_0xe0cc('0x22')]['id']:null};_0x597136[_[_0xe0cc('0x23')](_0x522fbe[_0xe0cc('0x24')])+'QueueId']=_0x361bd5['id']||null;_0x597136[_[_0xe0cc('0x23')](_0x522fbe[_0xe0cc('0x24')])+_0xe0cc('0x25')]=_0x522fbe[_0xe0cc('0x26')]?_0x522fbe[_0xe0cc('0x26')]['id']:null;_0x597136[_[_0xe0cc('0x23')](_0x522fbe[_0xe0cc('0x24')])+_0xe0cc('0x27')]=_0x522fbe[_0xe0cc('0x28')]?_0x522fbe[_0xe0cc('0x28')]['id']:null;_0x597136[_[_0xe0cc('0x23')](_0x522fbe['channel'])+(_0x522fbe['channel']!==_0xe0cc('0x29')?_0xe0cc('0x2a'):_0xe0cc('0x2b'))]=_0x522fbe[_0xe0cc('0xc')]?_0x522fbe[_0xe0cc('0xc')]['id']:null;logger[_0xe0cc('0x2c')](util[_0xe0cc('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x56f4dc,_0x361bd5['name']));emitChannelQueueInteraction(_0x522fbe[_0xe0cc('0x24')],_0x361bd5[_0xe0cc('0x2d')],_0x597136,_0x522fbe[_0xe0cc('0xc')][_0xe0cc('0x2d')],_0x522fbe[_0xe0cc('0x28')]['id'],!![],_0x33142a,_0x361bd5['id']);if(rpc[_0x522fbe['channel']+_0xe0cc('0x2e')]){return rpc[_0x522fbe[_0xe0cc('0x24')]+'QueueReport'][_0xe0cc('0x2f')](_0x597136)[_0xe0cc('0x30')](function(_0x166e6a){logger['error'](_0xe0cc('0x31'));});}}}function stopRouting(_0x4abc85,_0x342a0e,_0xcd5862,_0xe7422c){if(_0x4abc85&&_0x342a0e){_0x342a0e['waiting']-=0x1;var _0x24b228={'leaveAt':moment()[_0xe0cc('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xe0cc('0x14')](_0xe0cc('0x20')),'reason':_0xe0cc('0x32')};logger[_0xe0cc('0x2c')](util[_0xe0cc('0x14')](_0xe0cc('0x33'),_0x4abc85,_0x342a0e['name']));emitChannelQueueInteraction(_0xcd5862[_0xe0cc('0x24')],_0x342a0e[_0xe0cc('0x2d')],_0xcd5862[_0xe0cc('0x1f')],_0xcd5862[_0xe0cc('0xc')][_0xe0cc('0x2d')],_0xcd5862['message']['id'],![],_0xe7422c,_0x342a0e['id']);if(rpc[_0xcd5862[_0xe0cc('0x24')]+_0xe0cc('0x2e')]){return rpc[_0xcd5862['channel']+_0xe0cc('0x2e')][_0xe0cc('0x34')](_0x4abc85,_0x24b228)['catch'](function(_0x591467){logger[_0xe0cc('0x35')](_0xe0cc('0x36'));});}}}function endRouting(_0x37cd97,_0x4d683a,_0x2e987f,_0x6095ee){if(_0x37cd97&&_0x4d683a){_0x4d683a[_0xe0cc('0x37')]-=0x1;var _0x3e5f67={'leaveAt':moment()[_0xe0cc('0x14')](_0xe0cc('0x20')),'exitAt':moment()[_0xe0cc('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xe0cc('0x14')](_0xe0cc('0x38'),_0x37cd97,_0x4d683a[_0xe0cc('0x2d')]));emitChannelQueueInteraction(_0x2e987f[_0xe0cc('0x24')],_0x4d683a[_0xe0cc('0x2d')],_0x2e987f[_0xe0cc('0x1f')],_0x2e987f[_0xe0cc('0xc')][_0xe0cc('0x2d')],_0x2e987f['message']['id'],![],_0x6095ee);if(rpc[_0x2e987f[_0xe0cc('0x24')]+_0xe0cc('0x2e')]){return rpc[_0x2e987f[_0xe0cc('0x24')]+'QueueReport'][_0xe0cc('0x34')](_0x37cd97,_0x3e5f67)['catch'](function(_0xf2e160){logger['error'](_0xe0cc('0x36'));});}}}function handleFindQueue(_0x44490e){return function(_0x402ee8){return _0x402ee8['name'][_0xe0cc('0x39')]()===_0x44490e[_0xe0cc('0x39')]();};}exports[_0xe0cc('0x3a')]=function(_0x44954e,_0x13cb57,_0x236f24,_0x4db084){return function(_0x47b243){try{var _0x3f916b={'name':_0x13cb57[0x0],'timeout':_0x13cb57[0x1]};var _0x4c1b39=queue[_0xe0cc('0x0')](_0x3f916b,{'typecast':!![]});if(_0x4c1b39[_0xe0cc('0x3b')]){logger[_0xe0cc('0x35')](_0xe0cc('0x3c'),_0x44954e,_[_0xe0cc('0x3d')](_0x4c1b39,_0xe0cc('0x28'))[_0xe0cc('0x3e')](',\x20'));_0x47b243['stop']();}else{var _0x27180d=_[_0xe0cc('0x3f')](_0x236f24[_0x4db084[_0xe0cc('0x24')]+'Queues'],handleFindQueue(_0x3f916b['name']));if(_0x27180d){startRouting(_0x44954e,_0x27180d,_0x4db084,_0x236f24);var _0x3eec1d=(_0x27180d[_0xe0cc('0x40')]||0xa)*0x3e8;var _0x1c6001=(_0x3f916b[_0xe0cc('0x40')]||0x14)*0x3e8;var _0x181cd0,_0x17f969;if(_0x3eec1d>_0x1c6001){_0x1c6001=_0x3eec1d;}var _0x2ab2f0=seqqueue[_0xe0cc('0x41')](_0x3eec1d);_0x2ab2f0['id']=_0x44954e;_0x2ab2f0['atimeout']=_0x3eec1d;_0x2ab2f0[_0xe0cc('0x42')]=_0x1c6001;_0x2ab2f0[_0xe0cc('0x24')]=_0x4db084[_0xe0cc('0x24')];_0x236f24[_0xe0cc('0x43')][_0x44954e]['on']('end',function(){logger['info'](_0xe0cc('0x44'),_0x44954e);stopRouting(_0x44954e,_0x27180d,_0x4db084,_0x236f24);clearTimeout(_0x181cd0);_0x181cd0=undefined;_0x2ab2f0[_0xe0cc('0x45')](!![]);if(_0x236f24[_0xe0cc('0x43')][_0x44954e]){delete _0x236f24[_0xe0cc('0x43')][_0x44954e];}_0x47b243[_0xe0cc('0x46')]();});_0x236f24[_0xe0cc('0x43')][_0x44954e]['on']('complete',function(){if(_0x236f24[_0xe0cc('0x43')][_0x44954e]){delete _0x236f24['rules'][_0x44954e];}});_0x181cd0=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x44954e);endRouting(_0x44954e,_0x27180d,_0x4db084,_0x236f24);clearTimeout(_0x181cd0);_0x2ab2f0[_0xe0cc('0x45')](!![]);_0x47b243[_0xe0cc('0x47')]();},_0x1c6001);switch(_0x27180d[_0xe0cc('0x48')]){case'rrmemory':strategy[_0xe0cc('0x49')](_0x2ab2f0,_0x27180d,_0x236f24,_0x4db084);break;default:strategy[_0xe0cc('0x4a')](_0x2ab2f0,_0x27180d,_0x236f24,_0x4db084);}}else{logger[_0xe0cc('0x35')](_0xe0cc('0x4b'),_0x44954e,_0x3f916b[_0xe0cc('0x2d')]);_0x47b243[_0xe0cc('0x46')]();}}}catch(_0xaeb140){console[_0xe0cc('0x4c')](_0xaeb140);logger['error'](_0xe0cc('0x3c'),_0x44954e,_0xaeb140[_0xe0cc('0x4d')]);_0x47b243[_0xe0cc('0x46')]();}};}; \ 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 cc6aa7d..d476d61 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 _0x2770=['RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busyQueue','STOP','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','push','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','isAgentAvailable','channel','busy','showNotification','writeLog'];(function(_0x443be7,_0x20c06c){var _0x3e70aa=function(_0x21337c){while(--_0x21337c){_0x443be7['push'](_0x443be7['shift']());}};_0x3e70aa(++_0x20c06c);}(_0x2770,0x108));var _0x0277=function(_0x28fa6f,_0x1b22ac){_0x28fa6f=_0x28fa6f-0x0;var _0x1ae01b=_0x2770[_0x28fa6f];return _0x1ae01b;};'use strict';var _=require('lodash');var uuid=require(_0x0277('0x0'));var util=require('./util');var logger=require(_0x0277('0x1'))(_0x0277('0x2'));var Agent=function(_0x3c5544,_0x4dd8e0,_0xdbb7d3,_0x1e595a){this[_0x0277('0x3')]=uuid['v4']();this[_0x0277('0x4')]=_0x3c5544;this[_0x0277('0x5')]=_0x4dd8e0;this[_0x0277('0x6')]=_0xdbb7d3;this['routing']=_0x1e595a;this[_0x0277('0x4')]['push'](this[_0x0277('0x7')][_0x0277('0x8')](this),this[_0x0277('0x9')][_0x0277('0x8')](this));this['squeue']['on'](_0x0277('0xa'),this['handleTimeout'][_0x0277('0x8')](this));this[_0x0277('0x4')]['on'](_0x0277('0xb'),this[_0x0277('0xc')]['bind'](this));};Agent['prototype'][_0x0277('0xd')]=function(){this['squeue'][_0x0277('0xd')](this[_0x0277('0x7')][_0x0277('0x8')](this),this[_0x0277('0x9')][_0x0277('0x8')](this));};Agent[_0x0277('0xe')][_0x0277('0xc')]=function(){this[_0x0277('0x9')](!![]);};Agent[_0x0277('0xe')][_0x0277('0x7')]=function(_0x16bd77){logger['info'](_0x0277('0xf'),this[_0x0277('0x4')]['id'],this[_0x0277('0x5')]['id']);if(_[_0x0277('0x10')](this[_0x0277('0x6')][_0x0277('0x11')][this[_0x0277('0x5')]['id']])){logger[_0x0277('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x0277('0x5')]['id']);setTimeout(this['push'][_0x0277('0x8')](this),0x3e8);}else{if(this[_0x0277('0x2')]['forcedOwnership']||util[_0x0277('0x13')](this[_0x0277('0x4')]['id'],this['realtime'][_0x0277('0x11')][this[_0x0277('0x5')]['id']],this[_0x0277('0x4')][_0x0277('0x14')],![])){this[_0x0277('0x6')][_0x0277('0x11')][this[_0x0277('0x5')]['id']][_0x0277('0x15')]=!![];this[_0x0277('0x6')][_0x0277('0x11')][this['agent']['id']]['busyQueue']=undefined;util[_0x0277('0x16')](this[_0x0277('0x3')],this[_0x0277('0x4')]['id'],this[_0x0277('0x6')][_0x0277('0x11')][this['agent']['id']],null,this[_0x0277('0x2')]);util[_0x0277('0x17')](this[_0x0277('0x4')]['id'],this[_0x0277('0x6')][_0x0277('0x11')][this['agent']['id']],_0x0277('0x18')+(this['routing'][_0x0277('0x19')]?_0x0277('0x1a'):''));}else{logger['info'](_0x0277('0x1b'),this[_0x0277('0x4')]['id'],this[_0x0277('0x5')]['id']);setTimeout(this[_0x0277('0xd')][_0x0277('0x8')](this),0x3e8);}}};Agent['prototype'][_0x0277('0x9')]=function(_0x1be5f0){if(_[_0x0277('0x10')](this[_0x0277('0x6')][_0x0277('0x11')][this[_0x0277('0x5')]['id']])){return logger[_0x0277('0x12')](_0x0277('0x1c'),this[_0x0277('0x4')]['id'],this[_0x0277('0x5')]['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x0277('0x5')]['id']);util['hideNotification'](this['notificationId'],this[_0x0277('0x4')]['id'],this[_0x0277('0x6')][_0x0277('0x11')][this['agent']['id']],null,this[_0x0277('0x2')]);this[_0x0277('0x6')][_0x0277('0x11')][this[_0x0277('0x5')]['id']][_0x0277('0x15')]=![];this[_0x0277('0x6')][_0x0277('0x11')][this['agent']['id']][_0x0277('0x1d')]=undefined;util[_0x0277('0x17')](this['squeue']['id'],this[_0x0277('0x6')][_0x0277('0x11')][this['agent']['id']],_0x1be5f0?_0x0277('0x1e'):'TIMEOUT');}if(!_0x1be5f0){setTimeout(this[_0x0277('0xd')][_0x0277('0x8')](this),0x3e8);}};function agent(_0x52e31f,_0x106115,_0x22a758,_0x20e58d){return new Agent(_0x52e31f,_0x106115,_0x22a758,_0x20e58d);}module[_0x0277('0x1f')]=agent; \ No newline at end of file +var _0x0e7f=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','agent','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING','forcedOwnership',':FORCED'];(function(_0x15e343,_0x4cae21){var _0xacf426=function(_0x2c997f){while(--_0x2c997f){_0x15e343['push'](_0x15e343['shift']());}};_0xacf426(++_0x4cae21);}(_0x0e7f,0x172));var _0xf0e7=function(_0x25acfe,_0x3797bc){_0x25acfe=_0x25acfe-0x0;var _0x547928=_0x0e7f[_0x25acfe];return _0x547928;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xf0e7('0x0'));var logger=require(_0xf0e7('0x1'))(_0xf0e7('0x2'));var Agent=function(_0x35f43c,_0x29ac28,_0x53f260,_0x7ec5fb){this['notificationId']=uuid['v4']();this['squeue']=_0x35f43c;this[_0xf0e7('0x3')]=_0x29ac28;this['realtime']=_0x53f260;this[_0xf0e7('0x2')]=_0x7ec5fb;this[_0xf0e7('0x4')][_0xf0e7('0x5')](this[_0xf0e7('0x6')][_0xf0e7('0x7')](this),this[_0xf0e7('0x8')]['bind'](this));this[_0xf0e7('0x4')]['on'](_0xf0e7('0x9'),this[_0xf0e7('0x8')][_0xf0e7('0x7')](this));this[_0xf0e7('0x4')]['on'](_0xf0e7('0xa'),this[_0xf0e7('0xb')][_0xf0e7('0x7')](this));};Agent[_0xf0e7('0xc')]['push']=function(){this['squeue'][_0xf0e7('0x5')](this[_0xf0e7('0x6')][_0xf0e7('0x7')](this),this[_0xf0e7('0x8')][_0xf0e7('0x7')](this));};Agent[_0xf0e7('0xc')][_0xf0e7('0xb')]=function(){this[_0xf0e7('0x8')](!![]);};Agent[_0xf0e7('0xc')][_0xf0e7('0x6')]=function(_0x349787){logger[_0xf0e7('0xd')](_0xf0e7('0xe'),this[_0xf0e7('0x4')]['id'],this['agent']['id']);if(_['isNil'](this[_0xf0e7('0xf')][_0xf0e7('0x10')][this[_0xf0e7('0x3')]['id']])){logger[_0xf0e7('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0e7('0x4')]['id'],this[_0xf0e7('0x3')]['id']);setTimeout(this[_0xf0e7('0x5')][_0xf0e7('0x7')](this),0x3e8);}else{if(this[_0xf0e7('0x2')]['forcedOwnership']||util['isAgentAvailable'](this[_0xf0e7('0x4')]['id'],this[_0xf0e7('0xf')]['agents'][this[_0xf0e7('0x3')]['id']],this[_0xf0e7('0x4')][_0xf0e7('0x11')],![])){this['realtime'][_0xf0e7('0x10')][this[_0xf0e7('0x3')]['id']][_0xf0e7('0x12')]=!![];this[_0xf0e7('0xf')][_0xf0e7('0x10')][this[_0xf0e7('0x3')]['id']][_0xf0e7('0x13')]=undefined;util[_0xf0e7('0x14')](this[_0xf0e7('0x15')],this[_0xf0e7('0x4')]['id'],this[_0xf0e7('0xf')]['agents'][this[_0xf0e7('0x3')]['id']],null,this[_0xf0e7('0x2')]);util[_0xf0e7('0x16')](this[_0xf0e7('0x4')]['id'],this[_0xf0e7('0xf')][_0xf0e7('0x10')][this['agent']['id']],_0xf0e7('0x17')+(this[_0xf0e7('0x2')][_0xf0e7('0x18')]?_0xf0e7('0x19'):''));}else{logger[_0xf0e7('0xd')](_0xf0e7('0x1a'),this[_0xf0e7('0x4')]['id'],this[_0xf0e7('0x3')]['id']);setTimeout(this[_0xf0e7('0x5')][_0xf0e7('0x7')](this),0x3e8);}}};Agent[_0xf0e7('0xc')][_0xf0e7('0x8')]=function(_0x17c4ec){if(_[_0xf0e7('0x1b')](this[_0xf0e7('0xf')][_0xf0e7('0x10')][this[_0xf0e7('0x3')]['id']])){return logger[_0xf0e7('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0e7('0x4')]['id'],this[_0xf0e7('0x3')]['id']);}else{logger[_0xf0e7('0xd')](_0xf0e7('0x1c'),this[_0xf0e7('0x4')]['id'],this['agent']['id']);util[_0xf0e7('0x1d')](this['notificationId'],this['squeue']['id'],this[_0xf0e7('0xf')][_0xf0e7('0x10')][this[_0xf0e7('0x3')]['id']],null,this['routing']);this[_0xf0e7('0xf')][_0xf0e7('0x10')][this['agent']['id']][_0xf0e7('0x12')]=![];this[_0xf0e7('0xf')][_0xf0e7('0x10')][this[_0xf0e7('0x3')]['id']]['busyQueue']=undefined;util['writeLog'](this[_0xf0e7('0x4')]['id'],this[_0xf0e7('0xf')][_0xf0e7('0x10')][this['agent']['id']],_0x17c4ec?_0xf0e7('0x1e'):_0xf0e7('0x1f'));}if(!_0x17c4ec){setTimeout(this['push'][_0xf0e7('0x7')](this),0x3e8);}};function agent(_0x1997c5,_0x2dfb83,_0x1dfa5e,_0x1a2d41){return new Agent(_0x1997c5,_0x2dfb83,_0x1dfa5e,_0x1a2d41);}module[_0xf0e7('0x20')]=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 ec8dc9b..4dd4d08 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 _0x86f4=['drained','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','handleRun','handleTimeout','bind','timeout'];(function(_0x2af619,_0x324132){var _0x53c410=function(_0x2aca3d){while(--_0x2aca3d){_0x2af619['push'](_0x2af619['shift']());}};_0x53c410(++_0x324132);}(_0x86f4,0x18a));var _0x486f=function(_0x2aeeb,_0xfff5b2){_0x2aeeb=_0x2aeeb-0x0;var _0x195bc5=_0x86f4[_0x2aeeb];return _0x195bc5;};'use strict';var _=require(_0x486f('0x0'));var uuid=require(_0x486f('0x1'));var util=require(_0x486f('0x2'));var logger=require(_0x486f('0x3'))(_0x486f('0x4'));var Beepall=function(_0x10339c,_0x45067a,_0x53305d,_0xf8d50f){this[_0x486f('0x5')]=uuid['v4']();this['squeue']=_0x10339c;this[_0x486f('0x6')]=_0x45067a;this[_0x486f('0x7')]=_0x53305d;this[_0x486f('0x4')]=_0xf8d50f;this[_0x486f('0x8')][_0x486f('0x9')](this[_0x486f('0xa')]['bind'](this),this[_0x486f('0xb')][_0x486f('0xc')](this));this[_0x486f('0x8')]['on'](_0x486f('0xd'),this[_0x486f('0xb')][_0x486f('0xc')](this));this[_0x486f('0x8')]['on'](_0x486f('0xe'),this[_0x486f('0xf')][_0x486f('0xc')](this));};Beepall[_0x486f('0x10')][_0x486f('0x9')]=function(){this[_0x486f('0x8')][_0x486f('0x9')](this[_0x486f('0xa')][_0x486f('0xc')](this),this[_0x486f('0xb')]['bind'](this));};Beepall[_0x486f('0x10')]['handleDrained']=function(_0x46d0a9){this[_0x486f('0xb')](!![]);};Beepall[_0x486f('0x10')]['handleRun']=function(_0x5721ad){var _0x11c2af=!![];if(!_[_0x486f('0x11')](this['queue'])&&!_[_0x486f('0x11')](this[_0x486f('0x6')][_0x486f('0x12')])&&this['queue']['Agents'][_0x486f('0x13')]>0x0){for(var _0x3eeae0=0x0,_0x360cb7;_0x3eeae00x0){for(var _0x499dbc=0x0,_0x3d48c3;_0x499dbc0x0&&_0x548093[_0x1f9d4a+_0x4042('0x23')]>=_0x548093[_0x1f9d4a+'Capacity']){writeLog(_0x352631,_0x548093,_0x1f9d4a['toUpperCase']()+_0x4042('0x24'));return![];}}return!![];};exports[_0x4042('0x25')]=function(_0x26542c,_0x3e5c02,_0x332fe3,_0x473a0d,_0x5eb84b){return sendNotification(!![],_0x26542c,_0x3e5c02,_0x332fe3,_0x473a0d,_0x5eb84b);};exports[_0x4042('0x26')]=function(_0x1e9bd7,_0x4a6a6e,_0xae26c2,_0x89e16,_0xe924fe){return sendNotification(![],_0x1e9bd7,_0x4a6a6e,_0xae26c2,_0x89e16,_0xe924fe);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xffd6=['routing','defaults','redis','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','showNotification','writeLog','lodash','util','../utils','../../../../../config/environment','../../../../../config/logger'];(function(_0x26f39,_0x5acefd){var _0x419e4e=function(_0x46a733){while(--_0x46a733){_0x26f39['push'](_0x26f39['shift']());}};_0x419e4e(++_0x5acefd);}(_0xffd6,0x97));var _0x6ffd=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0xffd6[_0x2bcddb];return _0x12a9e8;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var utils=require(_0x6ffd('0x2'));var Mustache=require('mustache');var Redis=require('ioredis');var config=require(_0x6ffd('0x3'));var logger=require(_0x6ffd('0x4'))(_0x6ffd('0x5'));config['redis']=_[_0x6ffd('0x6')](config[_0x6ffd('0x7')],{'host':_0x6ffd('0x8'),'port':0x18eb});var io=require(_0x6ffd('0x9'))(new Redis(config['redis']));function emit(_0x122b71,_0xeefe34,_0x2445a0){io['to'](_0x122b71)[_0x6ffd('0xa')](_0xeefe34,_0x2445a0);}function sendNotification(_0x1d8b50,_0x4a9f85,_0x455dda,_0x417f34,_0x4e57f5,_0x469d0d){io['to'](util[_0x6ffd('0xb')](_0x6ffd('0xc'),_0x417f34[_0x6ffd('0xd')]))[_0x6ffd('0xa')](_0x6ffd('0xe'),_0x417f34);var _0x836501=_0x469d0d||{};var _0x5892e1=_0x455dda[_0x6ffd('0xf')]('.');var _0x46936d={'uniqueid':_0x4a9f85,'channel':_0x5892e1[0x0],'id':_0x5892e1[0x1],'title':_0x5892e1[0x0]+'\x20interaction','interactionId':_0x5892e1[0x2],'queue':_0x4e57f5?_0x4e57f5[_0x6ffd('0xd')]:null,'sound':_0x836501[_0x6ffd('0x10')][_0x6ffd('0x11')],'shake':_0x836501[_0x6ffd('0x10')]['notificationShake']};try{if(!_0x836501[_0x6ffd('0x12')]){_0x836501['body']={};}if(_0x4e57f5){_0x836501[_0x6ffd('0x12')]['queue']=_0x4e57f5;}else if(_0x836501[_0x6ffd('0x12')][_0x6ffd('0x13')]){delete _0x836501[_0x6ffd('0x12')]['queue'];}_0x46936d[_0x6ffd('0x14')]=utils[_0x6ffd('0x15')](_0x836501[_0x6ffd('0x10')][_0x6ffd('0x16')],_0x836501);}catch(_0x29293a){_0x46936d[_0x6ffd('0x14')]=_0x6ffd('0x17');logger[_0x6ffd('0x18')](util['format'](_0x6ffd('0x19'),_0x4a9f85,_0x29293a['message']));}io['to'](util['format'](_0x6ffd('0xc'),_0x417f34[_0x6ffd('0xd')]))['emit'](util[_0x6ffd('0xb')](_0x6ffd('0x1a'),_0x1d8b50?'save':'remove'),_0x46936d);}function writeLog(_0x465971,_0x1c9d19,_0x4dcc50){return logger[_0x6ffd('0x1b')](util[_0x6ffd('0xb')](_0x6ffd('0x1c'),_0x465971,_0x1c9d19['name'],_0x4dcc50));}exports[_0x6ffd('0x1d')]=function(_0x2efeb5,_0x50896b,_0x356c9c,_0x438d1a){if(_0x50896b['busy']){writeLog(_0x2efeb5,_0x50896b,_0x6ffd('0x1e'));return![];}if(!_0x50896b[_0x6ffd('0x1f')]){writeLog(_0x2efeb5,_0x50896b,_0x6ffd('0x20'));return![];}if(_0x50896b[_0x356c9c+'Pause']){writeLog(_0x2efeb5,_0x50896b,_0x6ffd('0x21'));return![];}if(_0x438d1a&&_0x50896b[_0x6ffd('0x22')](_0x356c9c+_0x6ffd('0x23'))&&_0x50896b['hasOwnProperty'](_0x356c9c+_0x6ffd('0x24'))){if(_0x50896b[_0x356c9c+'Capacity']>0x0&&_0x50896b[_0x356c9c+_0x6ffd('0x24')]>=_0x50896b[_0x356c9c+_0x6ffd('0x23')]){writeLog(_0x2efeb5,_0x50896b,_0x356c9c['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6ffd('0x25')]=function(_0x2a0391,_0x1934d4,_0x5e24de,_0x534139,_0x32c399){return sendNotification(!![],_0x2a0391,_0x1934d4,_0x5e24de,_0x534139,_0x32c399);};exports['hideNotification']=function(_0x470021,_0x20c007,_0x51fdb6,_0x6b5aba,_0xc790b2){return sendNotification(![],_0x470021,_0x20c007,_0x51fdb6,_0x6b5aba,_0xc790b2);};exports[_0x6ffd('0x26')]=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 0fe414f..b44d78c 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 _0xabc4=['next','[%s][SYSTEM]\x20commnad:\x20%s','exec','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xabc4,0x160));var _0x4abc=function(_0x2766cc,_0x246297){_0x2766cc=_0x2766cc-0x0;var _0x3dd08f=_0xabc4[_0x2766cc];return _0x3dd08f;};'use strict';var schema=require('validate');var sh=require(_0x4abc('0x0'));var _=require(_0x4abc('0x1'));var utils=require(_0x4abc('0x2'));var logger=require('../../../../config/logger')(_0x4abc('0x3'));var system=schema({'command':{'type':_0x4abc('0x4'),'required':!![],'message':_0x4abc('0x5')}});exports[_0x4abc('0x6')]=function(_0x1eb8df,_0xea5876){return function(_0x5dd995){try{var _0x226fc3={'command':_0xea5876[0x0]};var _0x32d484=system[_0x4abc('0x7')](_0x226fc3,{'typecast':!![]});if(_0x32d484['length']){logger[_0x4abc('0x8')]('[%s][SYSTEM]\x20%s',_0x1eb8df,_['map'](_0x32d484,_0x4abc('0x9'))[_0x4abc('0xa')](',\x20'));logger['info'](_0x4abc('0xb'),_0x1eb8df);_0x5dd995[_0x4abc('0xc')]();}else{var _0x377fda=this;var _0x302f92=utils['getMustacheRender'](_0xea5876[0x0],this);logger['info'](_0x4abc('0xd'),_0x1eb8df,_0x302f92);sh[_0x4abc('0xe')](_['trim'](_0x302f92),function(_0x1a922e,_0x2922cd){logger[_0x4abc('0xf')](_0x4abc('0x10'),_0x1eb8df,_0x1a922e);if(_0x1a922e==0x0){var _0x414684=_0x2922cd[_0x4abc('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x4abc('0x12')](_0xea5876[0x1])||_[_0x4abc('0x13')](_0xea5876[0x1])){logger[_0x4abc('0xf')](_0x4abc('0x14'),_0x1eb8df);_0x377fda[_0x4abc('0x15')][_0xea5876[0x1]]=_0x414684;}else{logger[_0x4abc('0xf')](_0x4abc('0x16'),_0x1eb8df,_0xea5876[0x1],_0x414684);_0x377fda[_0x4abc('0x15')][_0xea5876[0x1]]=_0x414684;}}_0x5dd995[_0x4abc('0xc')]();});}}catch(_0x3f3b9b){logger['error'](_0x4abc('0x17'),_0x1eb8df,_[_0x4abc('0x18')](_0x3f3b9b)?JSON[_0x4abc('0x19')](_0x3f3b9b):_0x3f3b9b);logger[_0x4abc('0xf')](_0x4abc('0xb'),_0x1eb8df);_0x5dd995[_0x4abc('0xc')]();}};}; \ No newline at end of file +var _0x57c8=['consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','stringify','validate','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x57c8,0xa9));var _0x857c=function(_0x3da3b6,_0x1dddad){_0x3da3b6=_0x3da3b6-0x0;var _0x1bae9f=_0x57c8[_0x3da3b6];return _0x1bae9f;};'use strict';var schema=require(_0x857c('0x0'));var sh=require('shelljs');var _=require(_0x857c('0x1'));var utils=require('./utils');var logger=require(_0x857c('0x2'))(_0x857c('0x3'));var system=schema({'command':{'type':_0x857c('0x4'),'required':!![],'message':_0x857c('0x5')}});exports[_0x857c('0x6')]=function(_0x5ec3fb,_0x26c7a4){return function(_0x1b697d){try{var _0x3d33b6={'command':_0x26c7a4[0x0]};var _0x475d4c=system[_0x857c('0x0')](_0x3d33b6,{'typecast':!![]});if(_0x475d4c[_0x857c('0x7')]){logger[_0x857c('0x8')](_0x857c('0x9'),_0x5ec3fb,_[_0x857c('0xa')](_0x475d4c,_0x857c('0xb'))[_0x857c('0xc')](',\x20'));logger[_0x857c('0xd')](_0x857c('0xe'),_0x5ec3fb);_0x1b697d[_0x857c('0xf')]();}else{var _0x52375d=this;var _0x585d6c=utils[_0x857c('0x10')](_0x26c7a4[0x0],this);logger[_0x857c('0xd')](_0x857c('0x11'),_0x5ec3fb,_0x585d6c);sh['exec'](_['trim'](_0x585d6c),function(_0x5be39f,_0x352505){logger[_0x857c('0xd')](_0x857c('0x12'),_0x5ec3fb,_0x5be39f);if(_0x5be39f==0x0){var _0xb43429=_0x352505[_0x857c('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x857c('0x14')](_0x26c7a4[0x1])||_[_0x857c('0x15')](_0x26c7a4[0x1])){logger[_0x857c('0xd')](_0x857c('0x16'),_0x5ec3fb);_0x52375d['body'][_0x26c7a4[0x1]]=_0xb43429;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5ec3fb,_0x26c7a4[0x1],_0xb43429);_0x52375d[_0x857c('0x17')][_0x26c7a4[0x1]]=_0xb43429;}}_0x1b697d['next']();});}}catch(_0xd41dce){logger[_0x857c('0x8')](_0x857c('0x9'),_0x5ec3fb,_['isObject'](_0xd41dce)?JSON[_0x857c('0x18')](_0xd41dce):_0xd41dce);logger[_0x857c('0xd')](_0x857c('0xe'),_0x5ec3fb);_0x1b697d[_0x857c('0xf')]();}};}; \ 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 d8f0292..be5c79c 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 _0x2634=['join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','catch','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','message'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x2634,0x8e));var _0x4263=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2634[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x4263('0x0'));var _=require(_0x4263('0x1'));var rpc={'chatInteraction':require(_0x4263('0x2')),'openchannelInteraction':require(_0x4263('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x4263('0x4')),'faxInteraction':require(_0x4263('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x4263('0x6'))(_0x4263('0x7'));var tag=schema({'tag':{'type':_0x4263('0x8'),'required':!![],'message':_0x4263('0x9')}});exports[_0x4263('0xa')]=function(_0x181ffb,_0xd18702,_0x3e31c2,_0x501b08){return function(_0x3d6db3){try{var _0x2d064a={'tag':_0xd18702[0x0]};var _0xcff89e=tag[_0x4263('0x0')](_0x2d064a,{'typecast':!![]});if(_0xcff89e['length']){logger[_0x4263('0xb')](_0x4263('0xc'),_0x181ffb,_['map'](_0xcff89e,_0x4263('0xd'))[_0x4263('0xe')](',\x20'));logger[_0x4263('0xf')](_0x4263('0x10'),_0x181ffb);_0x3d6db3[_0x4263('0x11')]();}else{var _0x730f0b={'ids':[_0xd18702[0x0]]};if(rpc[_0x501b08[_0x4263('0x12')]+_0x4263('0x13')]){rpc[_0x501b08[_0x4263('0x12')]+_0x4263('0x13')][_0x4263('0x14')](_0x501b08[_0x4263('0x15')]['id'],_0x730f0b)[_0x4263('0x16')](function(_0x3df3c5){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x181ffb,_0xd18702[0x1],_0x501b08[_0x4263('0x12')],_0x501b08['interaction']['id']);})[_0x4263('0x17')](function(_0x3f9907){logger[_0x4263('0xb')](_0x4263('0xc'),_0x181ffb,JSON[_0x4263('0x18')](_0x3f9907));logger[_0x4263('0xf')](_0x4263('0x10'),_0x181ffb);})[_0x4263('0x19')](function(){_0x3d6db3[_0x4263('0x11')]();});}}}catch(_0x4fff5){logger[_0x4263('0xb')](_0x4263('0xc'),_0x181ffb,_['isObject'](_0x4fff5)?JSON[_0x4263('0x18')](_0x4fff5):_0x4fff5);logger[_0x4263('0xf')](_0x4263('0x10'),_0x181ffb);_0x3d6db3[_0x4263('0x11')]();}};}; \ No newline at end of file +var _0x75cb=['error','map','message','join','info','next','channel','Interaction','addTags','interaction','then','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','[%s][TAG]\x20%s','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x2c2e27,_0x19510b){var _0x2d61a5=function(_0x3e865e){while(--_0x3e865e){_0x2c2e27['push'](_0x2c2e27['shift']());}};_0x2d61a5(++_0x19510b);}(_0x75cb,0x97));var _0xb75c=function(_0x28ab95,_0x5e5670){_0x28ab95=_0x28ab95-0x0;var _0x369b86=_0x75cb[_0x28ab95];return _0x369b86;};'use strict';var schema=require(_0xb75c('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xb75c('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb75c('0x2')),'mailInteraction':require(_0xb75c('0x3')),'faxInteraction':require(_0xb75c('0x4')),'whatsappInteraction':require(_0xb75c('0x5'))};var logger=require(_0xb75c('0x6'))(_0xb75c('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xb75c('0x8')}});exports[_0xb75c('0x9')]=function(_0x17906d,_0x249dcf,_0x53c124,_0x2a46e1){return function(_0x1b69a5){try{var _0x1a3977={'tag':_0x249dcf[0x0]};var _0x154fa8=tag[_0xb75c('0x0')](_0x1a3977,{'typecast':!![]});if(_0x154fa8[_0xb75c('0xa')]){logger[_0xb75c('0xb')]('[%s][TAG]\x20%s',_0x17906d,_[_0xb75c('0xc')](_0x154fa8,_0xb75c('0xd'))[_0xb75c('0xe')](',\x20'));logger[_0xb75c('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x17906d);_0x1b69a5[_0xb75c('0x10')]();}else{var _0x4a584d={'ids':[_0x249dcf[0x0]]};if(rpc[_0x2a46e1[_0xb75c('0x11')]+_0xb75c('0x12')]){rpc[_0x2a46e1['channel']+_0xb75c('0x12')][_0xb75c('0x13')](_0x2a46e1[_0xb75c('0x14')]['id'],_0x4a584d)[_0xb75c('0x15')](function(_0x992d43){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x17906d,_0x249dcf[0x1],_0x2a46e1[_0xb75c('0x11')],_0x2a46e1[_0xb75c('0x14')]['id']);})[_0xb75c('0x16')](function(_0x5ecdad){logger[_0xb75c('0xb')]('[%s][TAG]\x20%s',_0x17906d,JSON[_0xb75c('0x17')](_0x5ecdad));logger['info'](_0xb75c('0x18'),_0x17906d);})[_0xb75c('0x19')](function(){_0x1b69a5[_0xb75c('0x10')]();});}}}catch(_0x468efd){logger[_0xb75c('0xb')](_0xb75c('0x1a'),_0x17906d,_['isObject'](_0x468efd)?JSON[_0xb75c('0x17')](_0x468efd):_0x468efd);logger[_0xb75c('0xf')](_0xb75c('0x18'),_0x17906d);_0x1b69a5[_0xb75c('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index d100b0a..a9b7bad 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x15084f,_0xd7985d){var _0x1bebc2=function(_0x4fff27){while(--_0x4fff27){_0x15084f['push'](_0x15084f['shift']());}};_0x1bebc2(++_0xd7985d);}(_0xe706,0xa3));var _0x6e70=function(_0x11be52,_0x2ef4f4){_0x11be52=_0x11be52-0x0;var _0x5b0bf8=_0xe706[_0x11be52];return _0x5b0bf8;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1a98de,_0x565cc0){var _0x3ba2e5=function(_0x3375a9){while(--_0x3375a9){_0x1a98de['push'](_0x1a98de['shift']());}};_0x3ba2e5(++_0x565cc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 6c01399..f7c245f 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 _0x3533=['listen','channel','message','interaction','applications','isArray','length','join','.js','app','toLowerCase','appdata','split','mail','push','slice','dialogflow','dialogflowv2','TagId','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','rules','execute','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','chatQueues','paused','mailQueues','available','loggedIn','name','waiting','openchannelQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval'];(function(_0x493720,_0x2e7724){var _0x3cfc8e=function(_0x1ceb74){while(--_0x1ceb74){_0x493720['push'](_0x493720['shift']());}};_0x3cfc8e(++_0x2e7724);}(_0x3533,0xf7));var _0x3353=function(_0x1cb489,_0x30495c){_0x1cb489=_0x1cb489-0x0;var _0x1a56b7=_0x3533[_0x1cb489];return _0x1a56b7;};'use strict';var _=require(_0x3353('0x0'));var util=require(_0x3353('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x3353('0x2'));var BPromise=require(_0x3353('0x3'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0x3353('0x4'))(_0x3353('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x3353('0x6')),'chatQueueReport':require(_0x3353('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x3353('0x8')),'whatsappQueueReport':require(_0x3353('0x9'))};var RuleEngine=require(_0x3353('0xa'));function getId(_0x1fb8a7,_0x8e7456,_0xd581b9){return util[_0x3353('0xb')](_0x3353('0xc'),_0x1fb8a7,_0x8e7456||0x0,_0xd581b9||0x0);}function getIntervals(_0x49ac2b,_0x453495){var _0x5a9339=[];if(!_[_0x3353('0xd')](_0x453495[_0x3353('0xe')])&&!_[_0x3353('0xd')](_0x49ac2b[_0x453495[_0x3353('0xe')]])&&!_[_0x3353('0xd')](_0x49ac2b[_0x453495[_0x3353('0xe')]][_0x3353('0xf')])){_0x5a9339=_['map'](_0x49ac2b[_0x453495[_0x3353('0xe')]][_0x3353('0xf')],_0x3353('0x10'));}else if(!_[_0x3353('0xd')](_0x453495[_0x3353('0x10')])){_0x5a9339=[_0x453495[_0x3353('0x10')]];}return _0x5a9339;}exports[_0x3353('0x11')]=function(_0x1c46cc){_0x1c46cc['rules']={};return new BPromise(function(_0x1c5a75,_0x337758){var _0x31b312={'Start':function(_0x35b52d){var _0x400c1d=this;return new Promise(function(_0x45dd92,_0x4be07b){if(_0x35b52d){try{var _0x241e79=[];var _0x2d936b=getId(_0x35b52d[_0x3353('0x12')],_0x35b52d[_0x3353('0x13')]?_0x35b52d[_0x3353('0x13')]['id']:0x0,_0x35b52d[_0x3353('0x14')]?_0x35b52d['interaction']['id']:0x0);if(_0x35b52d[_0x3353('0x15')]&&_[_0x3353('0x16')](_0x35b52d[_0x3353('0x15')])&&_0x35b52d[_0x3353('0x15')][_0x3353('0x17')]){for(var _0x13b061=0x0;_0x13b061<_0x35b52d[_0x3353('0x15')][_0x3353('0x17')];_0x13b061+=0x1){var _0x30becc=_0x35b52d[_0x3353('0x15')][_0x13b061];if(fs['existsSync'](path[_0x3353('0x18')](__dirname,_0x3353('0x15'),_0x30becc['app']+_0x3353('0x19')))){var _0x1dc328=[];switch(_0x30becc[_0x3353('0x1a')][_0x3353('0x1b')]()){case'autoreply':var _0x38c785=_0x30becc[_0x3353('0x1c')][_0x3353('0x1d')](',');if(_0x35b52d[_0x3353('0x12')]===_0x3353('0x1e')){_0x1dc328['push'](_0x38c785[0x0]);_0x1dc328[_0x3353('0x1f')](_0x38c785[0x1]);_0x1dc328[_0x3353('0x1f')](_0x38c785[_0x3353('0x20')](0x2,_0x38c785['length'])[_0x3353('0x18')](','));}else{_0x1dc328[_0x3353('0x1f')](_0x38c785[0x0]);_0x1dc328[_0x3353('0x1f')](_0x38c785[_0x3353('0x20')](0x1,_0x38c785[_0x3353('0x17')])[_0x3353('0x18')](','));}break;case _0x3353('0x21'):var _0x186017=_0x30becc[_0x3353('0x1c')][_0x3353('0x1d')](',');_0x1dc328[_0x3353('0x1f')](_0x186017[0x0]);_0x1dc328['push'](_0x186017[0x1]);_0x1dc328[_0x3353('0x1f')](_0x186017[_0x3353('0x20')](0x2,_0x186017[_0x3353('0x17')])[_0x3353('0x18')](','));break;case _0x3353('0x22'):var _0x489d15=_0x30becc[_0x3353('0x1c')]['split'](',');_0x1dc328['push'](_0x489d15[0x0]);_0x1dc328[_0x3353('0x1f')](_0x489d15[0x1]);_0x1dc328[_0x3353('0x1f')](_0x489d15[0x2]);_0x1dc328[_0x3353('0x1f')](_0x489d15[0x3]);_0x1dc328['push'](_0x489d15[_0x3353('0x20')](0x4,_0x489d15[_0x3353('0x17')])[_0x3353('0x18')](','));break;case'amazonlex':var _0x25628c=_0x30becc[_0x3353('0x1c')][_0x3353('0x1d')](',');_0x1dc328['push'](_0x25628c[0x0]);_0x1dc328[_0x3353('0x1f')](_0x25628c[0x1]);_0x1dc328[_0x3353('0x1f')](_0x25628c[0x2]);_0x1dc328[_0x3353('0x1f')](_0x25628c[0x3]);_0x1dc328[_0x3353('0x1f')](_0x25628c[_0x3353('0x20')](0x4,_0x25628c['length'])['join'](','));break;case _0x3353('0x13'):_0x1dc328[_0x3353('0x1f')](_0x30becc[_0x3353('0x1c')]);break;case'tag':_0x1dc328[_0x3353('0x1f')](_0x30becc[_0x3353('0x23')]);_0x1dc328['push'](_0x30becc[_0x3353('0x1c')]);break;default:_0x1dc328=_[_0x3353('0xd')](_0x30becc[_0x3353('0x1c')])?[]:_0x30becc['appdata']['split'](',');}var _0x14b707={'id':util[_0x3353('0xb')]('%s:%s:%s',_0x2d936b,_0x30becc['id'],_0x30becc[_0x3353('0x1a')]),'condition':require(_0x3353('0x24'))[_0x3353('0x25')](_0x2d936b,getIntervals(_0x1c46cc[_0x3353('0x26')],_0x30becc),_0x1c46cc),'consequence':require(_0x3353('0x27')+_0x30becc[_0x3353('0x1a')])[_0x3353('0x28')](_0x2d936b,_0x1dc328,_0x1c46cc,_0x35b52d),'p':_0x30becc['priority']||0x0};logger[_0x3353('0x29')](_0x3353('0x2a'),_0x14b707['id'],_0x3353('0x2b'),getIntervals(_0x1c46cc[_0x3353('0x26')],_0x30becc)[_0x3353('0x18')](_0x3353('0x2c')));_0x241e79[_0x3353('0x1f')](_0x14b707);}else{logger[_0x3353('0x2d')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x3353('0x18')](__dirname,'applications',_0x30becc[_0x3353('0x1a')]+_0x3353('0x19')));}}_0x1c46cc[_0x3353('0x2e')][_0x2d936b]=new RuleEngine(_0x241e79);_0x1c46cc[_0x3353('0x2e')][_0x2d936b][_0x3353('0x2f')](_0x35b52d,function(_0x23774e){logger[_0x3353('0x29')]('Applications\x20executed',JSON['stringify'](_0x23774e[_0x3353('0x30')]));if(_0x1c46cc[_0x3353('0x2e')][_0x2d936b]){_0x1c46cc['rules'][_0x2d936b][_0x3353('0x31')](_0x3353('0x32'));}});return _0x45dd92({'code':0xc8,'message':_0x35b52d});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x45dd92({'code':0xc8,'message':_0x35b52d});}}catch(_0x3825d5){logger[_0x3353('0x2d')](_0x3825d5[_0x3353('0x33')]);return _0x4be07b(_0x400c1d[_0x3353('0x2d')](0x1f4,_0x3825d5));}}return _0x4be07b(_0x3353('0x34'));});},'AcceptMessage':function(_0x34cca8){var _0x48a057=this;return new Promise(function(_0x4b9416,_0x240944){if(_0x34cca8[_0x3353('0x35')]&&_0x34cca8['agent']['id']){if(_0x1c46cc[_0x3353('0x36')][_0x34cca8['agent']['id']]){_0x1c46cc[_0x3353('0x36')][_0x34cca8[_0x3353('0x35')]['id']][_0x3353('0x37')]=![];_0x1c46cc['agents'][_0x34cca8[_0x3353('0x35')]['id']][_0x3353('0x38')]=undefined;}}if(_0x34cca8[_0x3353('0x13')]&&_0x34cca8[_0x3353('0x13')]['id']){try{var _0x57ff06=getId(_0x34cca8['channel'],_0x34cca8[_0x3353('0x13')]?_0x34cca8[_0x3353('0x13')]['id']:0x0,_0x34cca8['interaction']?_0x34cca8['interaction']['id']:0x0);if(_0x1c46cc[_0x3353('0x2e')][_0x57ff06]){_0x1c46cc[_0x3353('0x2e')][_0x57ff06][_0x3353('0x31')]('end');if(rpc[_0x34cca8[_0x3353('0x12')]+_0x3353('0x39')]){rpc[_0x34cca8[_0x3353('0x12')]+'QueueReport']['update'](_0x57ff06,{'UserId':_0x34cca8[_0x3353('0x13')][_0x3353('0x3a')]})[_0x3353('0x3b')](function(_0x2905ea){logger[_0x3353('0x2d')](_0x3353('0x3c'));});}}return _0x4b9416({'code':0xc8,'message':_0x34cca8});}catch(_0x412a3e){logger['error'](_0x412a3e[_0x3353('0x33')]);return _0x240944(_0x48a057[_0x3353('0x2d')](0x1f4,_0x412a3e));}}logger['error'](_0x3353('0x3d'));return _0x240944(_0x48a057[_0x3353('0x2d')](0x1f4,_0x3353('0x3d')));});},'RejectMessage':function(_0x87afbf){var _0x4a9987=this;return new Promise(function(_0x285fb2,_0x36ed00){if(_0x87afbf[_0x3353('0x35')]&&_0x87afbf[_0x3353('0x35')]['id']){try{if(_0x1c46cc[_0x3353('0x36')][_0x87afbf[_0x3353('0x35')]['id']]){_0x1c46cc['agents'][_0x87afbf['agent']['id']][_0x3353('0x37')]=![];_0x1c46cc[_0x3353('0x36')][_0x87afbf[_0x3353('0x35')]['id']][_0x3353('0x38')]=undefined;}return _0x285fb2({'code':0xc8,'message':_0x87afbf});}catch(_0x3f5bfe){logger['error'](_0x3f5bfe[_0x3353('0x33')]);return _0x36ed00(_0x4a9987[_0x3353('0x2d')](0x1f4,_0x3f5bfe));}}logger[_0x3353('0x2d')](_0x3353('0x3d'));return _0x36ed00(_0x4a9987[_0x3353('0x2d')](0x1f4,_0x3353('0x3d')));});},'AbandonInteraction':function(_0x1d29bf){var _0x25f8ee=this;return new Promise(function(_0x53ffe7,_0x12ac05){if(_0x1d29bf['channel']&&_0x1d29bf['interaction']&&_0x1d29bf['interaction']['id']){try{var _0xc766a=getId(_0x1d29bf[_0x3353('0x12')],_0x1d29bf[_0x3353('0x13')]?_0x1d29bf[_0x3353('0x13')]['id']:0x0,_0x1d29bf['interaction']?_0x1d29bf[_0x3353('0x14')]['id']:0x0);if(_0x1c46cc['rules'][_0xc766a]){_0x1c46cc[_0x3353('0x2e')][_0xc766a]['emit'](_0x3353('0x3e'));}return _0x53ffe7({'code':0xc8,'message':_0x1d29bf});}catch(_0xb9dc0f){logger[_0x3353('0x2d')](_0xb9dc0f[_0x3353('0x33')]);return _0x12ac05(_0x25f8ee[_0x3353('0x2d')](0x1f4,_0xb9dc0f));}}logger[_0x3353('0x2d')](_0x3353('0x3d'));return _0x12ac05(_0x25f8ee[_0x3353('0x2d')](0x1f4,_0x3353('0x3d')));});},'AgentCapacity':function(_0x39a6bd){var _0x10f8d5=this;return new Promise(function(_0x28ca4f,_0x49aa2f){if(_0x1c46cc[_0x3353('0x36')][_0x3353('0x3f')](_0x39a6bd['id'])){for(var _0x3d7183 in _0x39a6bd[_0x3353('0x40')]){if(_0x39a6bd['capacity'][_0x3353('0x3f')](_0x3d7183)){if(_0x1c46cc[_0x3353('0x36')][_0x39a6bd['id']][_0x3353('0x3f')](_0x3d7183+'CurrentCapacity')){_0x1c46cc[_0x3353('0x36')][_0x39a6bd['id']][_0x3d7183+_0x3353('0x41')]=parseInt(_0x39a6bd[_0x3353('0x40')][_0x3d7183],0xa);}}}_0x1c46cc[_0x3353('0x36')][_0x39a6bd['id']]['updateRealtime']();return _0x28ca4f({'code':0xc8,'message':_0x1c46cc[_0x3353('0x36')][_0x39a6bd['id']]});}else{return _0x49aa2f(_0x10f8d5[_0x3353('0x2d')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x29d601){return new Promise(function(_0x161495,_0x1a36f8){var _0x388774=_['values'](_0x1c46cc[_0x3353('0x36')]);_0x161495({'count':_0x388774[_0x3353('0x17')],'rows':_0x388774});});},'ChatQueues':function(_0x124366){return new Promise(function(_0x25e9d3,_0x4c605d){var _0x4944bc=[];for(var _0x370711 in _0x1c46cc['chatQueues']){if(_0x1c46cc['chatQueues'][_0x3353('0x3f')](_0x370711)){var _0x1dc8fd=_0x1c46cc[_0x3353('0x42')][_0x370711];var _0x9be32b={'id':_0x1dc8fd['id'],'available':_0x1dc8fd['available'],'loggedIn':_0x1dc8fd['loggedIn'],'name':_0x1dc8fd['name'],'paused':_0x1dc8fd[_0x3353('0x43')],'waiting':_0x1dc8fd['waiting']};_0x4944bc[_0x3353('0x1f')](_0x9be32b);}}_0x25e9d3({'count':_0x4944bc[_0x3353('0x17')],'rows':_0x4944bc});});},'MailQueues':function(_0x7a9240){return new Promise(function(_0x3d615c,_0x1ca2e0){var _0x301308=[];for(var _0x581500 in _0x1c46cc[_0x3353('0x44')]){if(_0x1c46cc['mailQueues'][_0x3353('0x3f')](_0x581500)){var _0x21a12a=_0x1c46cc[_0x3353('0x44')][_0x581500];var _0x358298={'id':_0x21a12a['id'],'available':_0x21a12a[_0x3353('0x45')],'loggedIn':_0x21a12a[_0x3353('0x46')],'name':_0x21a12a[_0x3353('0x47')],'paused':_0x21a12a['paused'],'waiting':_0x21a12a[_0x3353('0x48')]};_0x301308['push'](_0x358298);}}_0x3d615c({'count':_0x301308[_0x3353('0x17')],'rows':_0x301308});});},'OpenchannelQueues':function(_0x35f9a9){return new Promise(function(_0x1bf947,_0x514d04){var _0x2aa2f1=[];for(var _0x5450ee in _0x1c46cc[_0x3353('0x49')]){if(_0x1c46cc[_0x3353('0x49')][_0x3353('0x3f')](_0x5450ee)){var _0x1e3b22=_0x1c46cc[_0x3353('0x49')][_0x5450ee];var _0x34d605={'id':_0x1e3b22['id'],'available':_0x1e3b22[_0x3353('0x45')],'loggedIn':_0x1e3b22[_0x3353('0x46')],'name':_0x1e3b22['name'],'paused':_0x1e3b22[_0x3353('0x43')],'waiting':_0x1e3b22[_0x3353('0x48')]};_0x2aa2f1[_0x3353('0x1f')](_0x34d605);}}_0x1bf947({'count':_0x2aa2f1['length'],'rows':_0x2aa2f1});});},'SmsQueues':function(_0xbe3efb){return new Promise(function(_0x26ddd1,_0x5660b2){var _0x2b9293=[];for(var _0x35b6e1 in _0x1c46cc['smsQueues']){if(_0x1c46cc['smsQueues'][_0x3353('0x3f')](_0x35b6e1)){var _0xfd4ef0=_0x1c46cc['smsQueues'][_0x35b6e1];var _0x47cbc2={'id':_0xfd4ef0['id'],'available':_0xfd4ef0['available'],'loggedIn':_0xfd4ef0[_0x3353('0x46')],'name':_0xfd4ef0[_0x3353('0x47')],'paused':_0xfd4ef0['paused'],'waiting':_0xfd4ef0['waiting']};_0x2b9293['push'](_0x47cbc2);}}_0x26ddd1({'count':_0x2b9293[_0x3353('0x17')],'rows':_0x2b9293});});},'FaxQueues':function(_0x6f356b){return new Promise(function(_0x3e92f2,_0xdacf1c){var _0x433d2b=[];for(var _0x1b45fb in _0x1c46cc[_0x3353('0x4a')]){if(_0x1c46cc['faxQueues']['hasOwnProperty'](_0x1b45fb)){var _0x3d287f=_0x1c46cc[_0x3353('0x4a')][_0x1b45fb];var _0x519af0={'id':_0x3d287f['id'],'available':_0x3d287f[_0x3353('0x45')],'loggedIn':_0x3d287f[_0x3353('0x46')],'name':_0x3d287f['name'],'paused':_0x3d287f[_0x3353('0x43')],'waiting':_0x3d287f[_0x3353('0x48')]};_0x433d2b[_0x3353('0x1f')](_0x519af0);}}_0x3e92f2({'count':_0x433d2b[_0x3353('0x17')],'rows':_0x433d2b});});},'WhatsappQueues':function(_0x553cf5){return new Promise(function(_0x5249d2,_0x333b2b){var _0x10ad40=[];for(var _0x4c8979 in _0x1c46cc['whatsappQueues']){if(_0x1c46cc[_0x3353('0x4b')][_0x3353('0x3f')](_0x4c8979)){var _0x24a19d=_0x1c46cc[_0x3353('0x4b')][_0x4c8979];var _0x406d46={'id':_0x24a19d['id'],'available':_0x24a19d['available'],'loggedIn':_0x24a19d[_0x3353('0x46')],'name':_0x24a19d[_0x3353('0x47')],'paused':_0x24a19d['paused'],'waiting':_0x24a19d[_0x3353('0x48')]};_0x10ad40['push'](_0x406d46);}}_0x5249d2({'count':_0x10ad40['length'],'rows':_0x10ad40});});},'ChatQueuesWaitingInteractions':function(_0x3f4956){return new Promise(function(_0xb484ce,_0x469947){var _0x6ce2bc=_[_0x3353('0x4c')](_0x1c46cc['chatQueuesWaitingInteractions']);_0xb484ce({'count':_0x6ce2bc[_0x3353('0x17')],'rows':_0x6ce2bc});});},'MailQueuesWaitingInteractions':function(_0x5c22f8){return new Promise(function(_0x53b662,_0x3ef44e){var _0x5b8b19=_[_0x3353('0x4c')](_0x1c46cc[_0x3353('0x4d')]);_0x53b662({'count':_0x5b8b19['length'],'rows':_0x5b8b19});});},'OpenchannelQueuesWaitingInteractions':function(_0x17d35c){return new Promise(function(_0x382c8e,_0x4021dc){var _0x4d1fb3=_[_0x3353('0x4c')](_0x1c46cc[_0x3353('0x4e')]);_0x382c8e({'count':_0x4d1fb3[_0x3353('0x17')],'rows':_0x4d1fb3});});},'SmsQueuesWaitingInteractions':function(_0x5ded8b){return new Promise(function(_0x3a172f,_0x2e8e40){var _0x56d45d=_[_0x3353('0x4c')](_0x1c46cc[_0x3353('0x4f')]);_0x3a172f({'count':_0x56d45d['length'],'rows':_0x56d45d});});},'FaxQueuesWaitingInteractions':function(_0x549f17){return new Promise(function(_0xff8737,_0x408a0f){var _0x7483f5=_[_0x3353('0x4c')](_0x1c46cc[_0x3353('0x50')]);_0xff8737({'count':_0x7483f5[_0x3353('0x17')],'rows':_0x7483f5});});},'WhatsappQueuesWaitingInteractions':function(_0x5a1f6f){return new Promise(function(_0x43286a,_0x3a23c0){var _0x536ba4=_[_0x3353('0x4c')](_0x1c46cc['whatsappQueuesWaitingInteractions']);_0x43286a({'count':_0x536ba4['length'],'rows':_0x536ba4});});}};var _0xaf447b=jayson[_0x3353('0x51')](_0x31b312)[_0x3353('0x52')]();_0xaf447b['on']('error',function(_0x5adfab){logger[_0x3353('0x2d')](JSON[_0x3353('0x53')](_0x5adfab));return _0x337758(_0x5adfab);});_0xaf447b[_0x3353('0x11')](0x232c,_0x3353('0x54'),function(){console[_0x3353('0x55')](_0x3353('0x56'),0x232c);return _0x1c5a75(_0x3353('0x57')+0x232c);});});}; \ No newline at end of file +var _0x5c12=['interval','message','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','amazonlex','tag','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','.js','rules','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','interaction','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','isNil','IntervalId','Intervals','map'];(function(_0x97bba6,_0x4662ee){var _0x1299f7=function(_0x372fc6){while(--_0x372fc6){_0x97bba6['push'](_0x97bba6['shift']());}};_0x1299f7(++_0x4662ee);}(_0x5c12,0xac));var _0x25c1=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0x5c12[_0x1d2bbb];return _0x38082b;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var fs=require('fs');var jayson=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var uuid=require(_0x25c1('0x4'));var config=require('../../../config/environment');var logger=require(_0x25c1('0x5'))(_0x25c1('0x6'));var rpc={'openchannelQueueReport':require(_0x25c1('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x25c1('0x8')),'smsQueueReport':require(_0x25c1('0x9')),'faxQueueReport':require(_0x25c1('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x4600be,_0x58a64e,_0x452b01){return util[_0x25c1('0xb')]('%s.%s.%s',_0x4600be,_0x58a64e||0x0,_0x452b01||0x0);}function getIntervals(_0x5df8e3,_0x5ed3f1){var _0x15a6ad=[];if(!_[_0x25c1('0xc')](_0x5ed3f1[_0x25c1('0xd')])&&!_[_0x25c1('0xc')](_0x5df8e3[_0x5ed3f1[_0x25c1('0xd')]])&&!_[_0x25c1('0xc')](_0x5df8e3[_0x5ed3f1['IntervalId']][_0x25c1('0xe')])){_0x15a6ad=_[_0x25c1('0xf')](_0x5df8e3[_0x5ed3f1['IntervalId']]['Intervals'],'interval');}else if(!_[_0x25c1('0xc')](_0x5ed3f1['interval'])){_0x15a6ad=[_0x5ed3f1[_0x25c1('0x10')]];}return _0x15a6ad;}exports['listen']=function(_0x4c99c7){_0x4c99c7['rules']={};return new BPromise(function(_0x150671,_0x41b2a5){var _0x1fc251={'Start':function(_0x41ce80){var _0x389c87=this;return new Promise(function(_0x1adb68,_0x3c7d80){if(_0x41ce80){try{var _0x2a413f=[];var _0x5a599d=getId(_0x41ce80['channel'],_0x41ce80[_0x25c1('0x11')]?_0x41ce80['message']['id']:0x0,_0x41ce80['interaction']?_0x41ce80['interaction']['id']:0x0);if(_0x41ce80[_0x25c1('0x12')]&&_[_0x25c1('0x13')](_0x41ce80['applications'])&&_0x41ce80[_0x25c1('0x12')][_0x25c1('0x14')]){for(var _0x330952=0x0;_0x330952<_0x41ce80[_0x25c1('0x12')][_0x25c1('0x14')];_0x330952+=0x1){var _0xd974cf=_0x41ce80['applications'][_0x330952];if(fs[_0x25c1('0x15')](path[_0x25c1('0x16')](__dirname,_0x25c1('0x12'),_0xd974cf[_0x25c1('0x17')]+'.js'))){var _0x370b78=[];switch(_0xd974cf['app'][_0x25c1('0x18')]()){case _0x25c1('0x19'):var _0x5a7f23=_0xd974cf[_0x25c1('0x1a')][_0x25c1('0x1b')](',');if(_0x41ce80[_0x25c1('0x1c')]===_0x25c1('0x1d')){_0x370b78['push'](_0x5a7f23[0x0]);_0x370b78[_0x25c1('0x1e')](_0x5a7f23[0x1]);_0x370b78[_0x25c1('0x1e')](_0x5a7f23[_0x25c1('0x1f')](0x2,_0x5a7f23[_0x25c1('0x14')])[_0x25c1('0x16')](','));}else{_0x370b78[_0x25c1('0x1e')](_0x5a7f23[0x0]);_0x370b78[_0x25c1('0x1e')](_0x5a7f23['slice'](0x1,_0x5a7f23[_0x25c1('0x14')])[_0x25c1('0x16')](','));}break;case _0x25c1('0x20'):var _0x942cf4=_0xd974cf[_0x25c1('0x1a')]['split'](',');_0x370b78['push'](_0x942cf4[0x0]);_0x370b78[_0x25c1('0x1e')](_0x942cf4[0x1]);_0x370b78['push'](_0x942cf4[_0x25c1('0x1f')](0x2,_0x942cf4['length'])[_0x25c1('0x16')](','));break;case'dialogflowv2':var _0x569de5=_0xd974cf['appdata'][_0x25c1('0x1b')](',');_0x370b78[_0x25c1('0x1e')](_0x569de5[0x0]);_0x370b78['push'](_0x569de5[0x1]);_0x370b78[_0x25c1('0x1e')](_0x569de5[0x2]);_0x370b78[_0x25c1('0x1e')](_0x569de5[0x3]);_0x370b78['push'](_0x569de5[_0x25c1('0x1f')](0x4,_0x569de5[_0x25c1('0x14')])[_0x25c1('0x16')](','));break;case _0x25c1('0x21'):var _0x2b9858=_0xd974cf[_0x25c1('0x1a')][_0x25c1('0x1b')](',');_0x370b78[_0x25c1('0x1e')](_0x2b9858[0x0]);_0x370b78[_0x25c1('0x1e')](_0x2b9858[0x1]);_0x370b78['push'](_0x2b9858[0x2]);_0x370b78[_0x25c1('0x1e')](_0x2b9858[0x3]);_0x370b78[_0x25c1('0x1e')](_0x2b9858[_0x25c1('0x1f')](0x4,_0x2b9858['length'])[_0x25c1('0x16')](','));break;case _0x25c1('0x11'):_0x370b78[_0x25c1('0x1e')](_0xd974cf['appdata']);break;case _0x25c1('0x22'):_0x370b78[_0x25c1('0x1e')](_0xd974cf['TagId']);_0x370b78['push'](_0xd974cf[_0x25c1('0x1a')]);break;default:_0x370b78=_[_0x25c1('0xc')](_0xd974cf[_0x25c1('0x1a')])?[]:_0xd974cf[_0x25c1('0x1a')][_0x25c1('0x1b')](',');}var _0x5e507b={'id':util['format'](_0x25c1('0x23'),_0x5a599d,_0xd974cf['id'],_0xd974cf[_0x25c1('0x17')]),'condition':require(_0x25c1('0x24'))[_0x25c1('0x25')](_0x5a599d,getIntervals(_0x4c99c7[_0x25c1('0x26')],_0xd974cf),_0x4c99c7),'consequence':require('./applications/'+_0xd974cf['app'])[_0x25c1('0x27')](_0x5a599d,_0x370b78,_0x4c99c7,_0x41ce80),'p':_0xd974cf[_0x25c1('0x28')]||0x0};logger[_0x25c1('0x29')](_0x25c1('0x2a'),_0x5e507b['id'],_0x25c1('0x2b'),getIntervals(_0x4c99c7[_0x25c1('0x26')],_0xd974cf)[_0x25c1('0x16')](_0x25c1('0x2c')));_0x2a413f[_0x25c1('0x1e')](_0x5e507b);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x25c1('0x16')](__dirname,_0x25c1('0x12'),_0xd974cf[_0x25c1('0x17')]+_0x25c1('0x2d')));}}_0x4c99c7['rules'][_0x5a599d]=new RuleEngine(_0x2a413f);_0x4c99c7[_0x25c1('0x2e')][_0x5a599d]['execute'](_0x41ce80,function(_0x171d79){logger[_0x25c1('0x29')](_0x25c1('0x2f'),JSON[_0x25c1('0x30')](_0x171d79[_0x25c1('0x31')]));if(_0x4c99c7[_0x25c1('0x2e')][_0x5a599d]){_0x4c99c7['rules'][_0x5a599d][_0x25c1('0x32')](_0x25c1('0x33'));}});return _0x1adb68({'code':0xc8,'message':_0x41ce80});}else{logger[_0x25c1('0x29')](_0x25c1('0x34'));return _0x1adb68({'code':0xc8,'message':_0x41ce80});}}catch(_0x4c1ab3){logger[_0x25c1('0x35')](_0x4c1ab3[_0x25c1('0x36')]);return _0x3c7d80(_0x389c87[_0x25c1('0x35')](0x1f4,_0x4c1ab3));}}return _0x3c7d80(_0x25c1('0x37'));});},'AcceptMessage':function(_0x10a320){var _0x4013fa=this;return new Promise(function(_0x5316b5,_0x5d87dc){if(_0x10a320[_0x25c1('0x38')]&&_0x10a320[_0x25c1('0x38')]['id']){if(_0x4c99c7['agents'][_0x10a320[_0x25c1('0x38')]['id']]){_0x4c99c7[_0x25c1('0x39')][_0x10a320['agent']['id']]['busy']=![];_0x4c99c7[_0x25c1('0x39')][_0x10a320['agent']['id']][_0x25c1('0x3a')]=undefined;}}if(_0x10a320[_0x25c1('0x11')]&&_0x10a320[_0x25c1('0x11')]['id']){try{var _0x3c1c77=getId(_0x10a320[_0x25c1('0x1c')],_0x10a320[_0x25c1('0x11')]?_0x10a320[_0x25c1('0x11')]['id']:0x0,_0x10a320['interaction']?_0x10a320['interaction']['id']:0x0);if(_0x4c99c7[_0x25c1('0x2e')][_0x3c1c77]){_0x4c99c7[_0x25c1('0x2e')][_0x3c1c77][_0x25c1('0x32')]('end');if(rpc[_0x10a320[_0x25c1('0x1c')]+_0x25c1('0x3b')]){rpc[_0x10a320[_0x25c1('0x1c')]+_0x25c1('0x3b')][_0x25c1('0x3c')](_0x3c1c77,{'UserId':_0x10a320[_0x25c1('0x11')][_0x25c1('0x3d')]})[_0x25c1('0x3e')](function(_0x4006a6){logger[_0x25c1('0x35')](_0x25c1('0x3f'));});}}return _0x5316b5({'code':0xc8,'message':_0x10a320});}catch(_0xecb47d){logger[_0x25c1('0x35')](_0xecb47d[_0x25c1('0x36')]);return _0x5d87dc(_0x4013fa[_0x25c1('0x35')](0x1f4,_0xecb47d));}}logger[_0x25c1('0x35')](_0x25c1('0x40'));return _0x5d87dc(_0x4013fa['error'](0x1f4,_0x25c1('0x40')));});},'RejectMessage':function(_0x3aedc1){var _0x4ddc71=this;return new Promise(function(_0x554768,_0x4d2513){if(_0x3aedc1[_0x25c1('0x38')]&&_0x3aedc1[_0x25c1('0x38')]['id']){try{if(_0x4c99c7[_0x25c1('0x39')][_0x3aedc1[_0x25c1('0x38')]['id']]){_0x4c99c7['agents'][_0x3aedc1['agent']['id']][_0x25c1('0x41')]=![];_0x4c99c7[_0x25c1('0x39')][_0x3aedc1[_0x25c1('0x38')]['id']][_0x25c1('0x3a')]=undefined;}return _0x554768({'code':0xc8,'message':_0x3aedc1});}catch(_0x1b8df7){logger[_0x25c1('0x35')](_0x1b8df7[_0x25c1('0x36')]);return _0x4d2513(_0x4ddc71[_0x25c1('0x35')](0x1f4,_0x1b8df7));}}logger[_0x25c1('0x35')](_0x25c1('0x40'));return _0x4d2513(_0x4ddc71['error'](0x1f4,_0x25c1('0x40')));});},'AbandonInteraction':function(_0x496c9c){var _0x4bbf3d=this;return new Promise(function(_0x439a1a,_0x403ae2){if(_0x496c9c['channel']&&_0x496c9c['interaction']&&_0x496c9c[_0x25c1('0x42')]['id']){try{var _0x16623a=getId(_0x496c9c['channel'],_0x496c9c['message']?_0x496c9c[_0x25c1('0x11')]['id']:0x0,_0x496c9c['interaction']?_0x496c9c[_0x25c1('0x42')]['id']:0x0);if(_0x4c99c7[_0x25c1('0x2e')][_0x16623a]){_0x4c99c7[_0x25c1('0x2e')][_0x16623a][_0x25c1('0x32')](_0x25c1('0x43'));}return _0x439a1a({'code':0xc8,'message':_0x496c9c});}catch(_0x898030){logger[_0x25c1('0x35')](_0x898030[_0x25c1('0x36')]);return _0x403ae2(_0x4bbf3d[_0x25c1('0x35')](0x1f4,_0x898030));}}logger['error'](_0x25c1('0x40'));return _0x403ae2(_0x4bbf3d[_0x25c1('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1c77a4){var _0x4fe050=this;return new Promise(function(_0x2c0841,_0xe6e8d8){if(_0x4c99c7[_0x25c1('0x39')][_0x25c1('0x44')](_0x1c77a4['id'])){for(var _0x1c5588 in _0x1c77a4[_0x25c1('0x45')]){if(_0x1c77a4[_0x25c1('0x45')][_0x25c1('0x44')](_0x1c5588)){if(_0x4c99c7[_0x25c1('0x39')][_0x1c77a4['id']][_0x25c1('0x44')](_0x1c5588+'CurrentCapacity')){_0x4c99c7[_0x25c1('0x39')][_0x1c77a4['id']][_0x1c5588+_0x25c1('0x46')]=parseInt(_0x1c77a4['capacity'][_0x1c5588],0xa);}}}_0x4c99c7[_0x25c1('0x39')][_0x1c77a4['id']][_0x25c1('0x47')]();return _0x2c0841({'code':0xc8,'message':_0x4c99c7[_0x25c1('0x39')][_0x1c77a4['id']]});}else{return _0xe6e8d8(_0x4fe050[_0x25c1('0x35')](0x1f4,_0x25c1('0x48')));}});},'Agents':function(_0x41b34c){return new Promise(function(_0x3aa983,_0x34edfe){var _0x22f6a2=_[_0x25c1('0x49')](_0x4c99c7[_0x25c1('0x39')]);_0x3aa983({'count':_0x22f6a2['length'],'rows':_0x22f6a2});});},'ChatQueues':function(_0x20b8b5){return new Promise(function(_0x2c1ab6,_0x147f3){var _0x1ad6a9=[];for(var _0x173af7 in _0x4c99c7[_0x25c1('0x4a')]){if(_0x4c99c7[_0x25c1('0x4a')]['hasOwnProperty'](_0x173af7)){var _0x4ec730=_0x4c99c7[_0x25c1('0x4a')][_0x173af7];var _0x324350={'id':_0x4ec730['id'],'available':_0x4ec730[_0x25c1('0x4b')],'loggedIn':_0x4ec730[_0x25c1('0x4c')],'name':_0x4ec730[_0x25c1('0x4d')],'paused':_0x4ec730[_0x25c1('0x4e')],'waiting':_0x4ec730[_0x25c1('0x4f')]};_0x1ad6a9['push'](_0x324350);}}_0x2c1ab6({'count':_0x1ad6a9[_0x25c1('0x14')],'rows':_0x1ad6a9});});},'MailQueues':function(_0x5164d3){return new Promise(function(_0x2557a3,_0x37325b){var _0x22043b=[];for(var _0x4d0adf in _0x4c99c7['mailQueues']){if(_0x4c99c7[_0x25c1('0x50')][_0x25c1('0x44')](_0x4d0adf)){var _0x2a6a74=_0x4c99c7['mailQueues'][_0x4d0adf];var _0x74527e={'id':_0x2a6a74['id'],'available':_0x2a6a74['available'],'loggedIn':_0x2a6a74[_0x25c1('0x4c')],'name':_0x2a6a74[_0x25c1('0x4d')],'paused':_0x2a6a74[_0x25c1('0x4e')],'waiting':_0x2a6a74[_0x25c1('0x4f')]};_0x22043b['push'](_0x74527e);}}_0x2557a3({'count':_0x22043b[_0x25c1('0x14')],'rows':_0x22043b});});},'OpenchannelQueues':function(_0x2e54e5){return new Promise(function(_0x7c25b,_0x182111){var _0x279502=[];for(var _0x1cab04 in _0x4c99c7[_0x25c1('0x51')]){if(_0x4c99c7[_0x25c1('0x51')]['hasOwnProperty'](_0x1cab04)){var _0xfd6aac=_0x4c99c7[_0x25c1('0x51')][_0x1cab04];var _0x316361={'id':_0xfd6aac['id'],'available':_0xfd6aac[_0x25c1('0x4b')],'loggedIn':_0xfd6aac[_0x25c1('0x4c')],'name':_0xfd6aac[_0x25c1('0x4d')],'paused':_0xfd6aac[_0x25c1('0x4e')],'waiting':_0xfd6aac[_0x25c1('0x4f')]};_0x279502[_0x25c1('0x1e')](_0x316361);}}_0x7c25b({'count':_0x279502[_0x25c1('0x14')],'rows':_0x279502});});},'SmsQueues':function(_0x480939){return new Promise(function(_0x50b927,_0x4d7775){var _0x211682=[];for(var _0x231417 in _0x4c99c7[_0x25c1('0x52')]){if(_0x4c99c7[_0x25c1('0x52')][_0x25c1('0x44')](_0x231417)){var _0x5f3726=_0x4c99c7[_0x25c1('0x52')][_0x231417];var _0x3694cf={'id':_0x5f3726['id'],'available':_0x5f3726[_0x25c1('0x4b')],'loggedIn':_0x5f3726['loggedIn'],'name':_0x5f3726[_0x25c1('0x4d')],'paused':_0x5f3726[_0x25c1('0x4e')],'waiting':_0x5f3726[_0x25c1('0x4f')]};_0x211682['push'](_0x3694cf);}}_0x50b927({'count':_0x211682[_0x25c1('0x14')],'rows':_0x211682});});},'FaxQueues':function(_0xaf7f9){return new Promise(function(_0x5ce31d,_0x27ebcd){var _0x319c02=[];for(var _0xa4afda in _0x4c99c7[_0x25c1('0x53')]){if(_0x4c99c7[_0x25c1('0x53')][_0x25c1('0x44')](_0xa4afda)){var _0x4ab31f=_0x4c99c7[_0x25c1('0x53')][_0xa4afda];var _0x115a1d={'id':_0x4ab31f['id'],'available':_0x4ab31f['available'],'loggedIn':_0x4ab31f[_0x25c1('0x4c')],'name':_0x4ab31f[_0x25c1('0x4d')],'paused':_0x4ab31f[_0x25c1('0x4e')],'waiting':_0x4ab31f[_0x25c1('0x4f')]};_0x319c02['push'](_0x115a1d);}}_0x5ce31d({'count':_0x319c02[_0x25c1('0x14')],'rows':_0x319c02});});},'WhatsappQueues':function(_0xd3158a){return new Promise(function(_0x55dab3,_0x3cac78){var _0xcb9bfd=[];for(var _0x2c439f in _0x4c99c7[_0x25c1('0x54')]){if(_0x4c99c7[_0x25c1('0x54')][_0x25c1('0x44')](_0x2c439f)){var _0x1f454b=_0x4c99c7[_0x25c1('0x54')][_0x2c439f];var _0x5f0531={'id':_0x1f454b['id'],'available':_0x1f454b[_0x25c1('0x4b')],'loggedIn':_0x1f454b['loggedIn'],'name':_0x1f454b['name'],'paused':_0x1f454b[_0x25c1('0x4e')],'waiting':_0x1f454b[_0x25c1('0x4f')]};_0xcb9bfd[_0x25c1('0x1e')](_0x5f0531);}}_0x55dab3({'count':_0xcb9bfd[_0x25c1('0x14')],'rows':_0xcb9bfd});});},'ChatQueuesWaitingInteractions':function(_0x2fa247){return new Promise(function(_0x19b6f5,_0x5a1769){var _0x1570fe=_[_0x25c1('0x49')](_0x4c99c7[_0x25c1('0x55')]);_0x19b6f5({'count':_0x1570fe[_0x25c1('0x14')],'rows':_0x1570fe});});},'MailQueuesWaitingInteractions':function(_0x5dc8fa){return new Promise(function(_0x235b7d,_0x507cba){var _0x5295a1=_[_0x25c1('0x49')](_0x4c99c7[_0x25c1('0x56')]);_0x235b7d({'count':_0x5295a1[_0x25c1('0x14')],'rows':_0x5295a1});});},'OpenchannelQueuesWaitingInteractions':function(_0x4dd6fc){return new Promise(function(_0x4afa5c,_0xbc6aca){var _0xa286d1=_[_0x25c1('0x49')](_0x4c99c7['openchannelQueuesWaitingInteractions']);_0x4afa5c({'count':_0xa286d1[_0x25c1('0x14')],'rows':_0xa286d1});});},'SmsQueuesWaitingInteractions':function(_0x37051c){return new Promise(function(_0x55f72c,_0x3fc97c){var _0x24c4ac=_['values'](_0x4c99c7[_0x25c1('0x57')]);_0x55f72c({'count':_0x24c4ac[_0x25c1('0x14')],'rows':_0x24c4ac});});},'FaxQueuesWaitingInteractions':function(_0x1e0bb9){return new Promise(function(_0x1845cc,_0x5efa4b){var _0x4ce407=_[_0x25c1('0x49')](_0x4c99c7['faxQueuesWaitingInteractions']);_0x1845cc({'count':_0x4ce407['length'],'rows':_0x4ce407});});},'WhatsappQueuesWaitingInteractions':function(_0x19b654){return new Promise(function(_0x108f81,_0x3afda1){var _0x3f6684=_[_0x25c1('0x49')](_0x4c99c7[_0x25c1('0x58')]);_0x108f81({'count':_0x3f6684[_0x25c1('0x14')],'rows':_0x3f6684});});}};var _0x3a75d3=jayson[_0x25c1('0x59')](_0x1fc251)['http']();_0x3a75d3['on'](_0x25c1('0x35'),function(_0x30dd00){logger['error'](JSON['stringify'](_0x30dd00));return _0x41b2a5(_0x30dd00);});_0x3a75d3['listen'](0x232c,_0x25c1('0x5a'),function(){console[_0x25c1('0x5b')](_0x25c1('0x5c'),0x232c);return _0x150671(_0x25c1('0x5d')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index e8c5ea7..16b4f42 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 _0x0015=['client','http','request','error','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','true','catch','[%s][INTERVAL]\x20%s','all','then','[%s][INTERVAL]\x20%s\x20%s','join','when','log','stack','util','bluebird','lodash','../../../config/logger','routing'];(function(_0x5ef096,_0x4b109d){var _0x24a007=function(_0x51f6e9){while(--_0x51f6e9){_0x5ef096['push'](_0x5ef096['shift']());}};_0x24a007(++_0x4b109d);}(_0x0015,0x6f));var _0x5001=function(_0x4be1c2,_0x5da433){_0x4be1c2=_0x4be1c2-0x0;var _0x3e6c28=_0x0015[_0x4be1c2];return _0x3e6c28;};'use strict';var util=require(_0x5001('0x0'));var BPromise=require(_0x5001('0x1'));var jayson=require('jayson/promise');var _=require(_0x5001('0x2'));var logger=require(_0x5001('0x3'))(_0x5001('0x4'));var client=jayson[_0x5001('0x5')][_0x5001('0x6')]({'port':0x232a});function request(_0x20531e,_0x3cae5d){return new BPromise(function(_0x5cf80f,_0x3dd9c3){return client[_0x5001('0x7')](_0x20531e,_0x3cae5d)['then'](function(_0x1e8b1e){if(_0x1e8b1e[_0x5001('0x8')]){return _0x3dd9c3(_0x1e8b1e[_0x5001('0x8')][_0x5001('0x9')]);}else{return _0x5cf80f(_0x1e8b1e['result']);}})['catch'](function(_0xe5df4a){return _0x3dd9c3(_0xe5df4a);});});}exports[_0x5001('0xa')]=function(_0xa44db,_0x2315ca,_0x27a3bd){return function(_0x3e25dc){if(_0x27a3bd[_0x5001('0xb')]&&!_0x27a3bd[_0x5001('0xb')][_0xa44db]){logger[_0x5001('0xc')](_0x5001('0xd'),_0xa44db);return _0x3e25dc[_0x5001('0xe')]();}var _0x2a1530=[];for(var _0xeeecca=0x0;_0xeeecca<_0x2315ca['length'];_0xeeecca+=0x1){_0x2a1530[_0x5001('0xf')](request(_0x5001('0x10'),{'command':util[_0x5001('0x11')](_0x5001('0x12'),_0x2315ca[_0xeeecca])})['then'](function(_0x50102e){return _0x50102e&&_0x50102e['message']&&_0x50102e[_0x5001('0x9')]['indexOf'](_0x5001('0x13'))>=0x0?!![]:![];})[_0x5001('0x14')](function(_0x334c3b){logger[_0x5001('0x8')](_0x5001('0x15'),_0xa44db,_0x2315ca[_0xeeecca]);}));}BPromise[_0x5001('0x16')](_0x2a1530)[_0x5001('0x17')](function(_0x3c754b){var _0x57e8c4=_['some'](_0x3c754b);logger[_0x5001('0xc')](_0x5001('0x18'),_0xa44db,_0x2315ca[_0x5001('0x19')]('\x20|\x20'),_0x57e8c4);_0x3e25dc[_0x5001('0x1a')](_0x57e8c4);})[_0x5001('0x14')](function(_0x17c79c){console[_0x5001('0x1b')](_0x17c79c);logger['error'](_0x5001('0x18'),_0xa44db,_0x2315ca[_0x5001('0x19')]('\x20|\x20'),_0x17c79c[_0x5001('0x1c')]);_0x3e25dc['stop']();});};}; \ No newline at end of file +var _0xf56d=['http','request','error','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','then','message','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','when','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client'];(function(_0x407a4d,_0x428623){var _0x216346=function(_0x53b62b){while(--_0x53b62b){_0x407a4d['push'](_0x407a4d['shift']());}};_0x216346(++_0x428623);}(_0xf56d,0xf5));var _0xdf56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf56d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xdf56('0x0'));var BPromise=require(_0xdf56('0x1'));var jayson=require(_0xdf56('0x2'));var _=require(_0xdf56('0x3'));var logger=require(_0xdf56('0x4'))(_0xdf56('0x5'));var client=jayson[_0xdf56('0x6')][_0xdf56('0x7')]({'port':0x232a});function request(_0x1ce6ae,_0x52bafb){return new BPromise(function(_0x5783a3,_0xd3711f){return client[_0xdf56('0x8')](_0x1ce6ae,_0x52bafb)['then'](function(_0x1b9eb3){if(_0x1b9eb3[_0xdf56('0x9')]){return _0xd3711f(_0x1b9eb3[_0xdf56('0x9')]['message']);}else{return _0x5783a3(_0x1b9eb3['result']);}})[_0xdf56('0xa')](function(_0x1da13b){return _0xd3711f(_0x1da13b);});});}exports['condition']=function(_0x127ad7,_0x3c100a,_0x2cd6fd){return function(_0x2ec77a){if(_0x2cd6fd[_0xdf56('0xb')]&&!_0x2cd6fd['rules'][_0x127ad7]){logger[_0xdf56('0xc')](_0xdf56('0xd'),_0x127ad7);return _0x2ec77a[_0xdf56('0xe')]();}var _0x319e8a=[];for(var _0x2f4335=0x0;_0x2f4335<_0x3c100a[_0xdf56('0xf')];_0x2f4335+=0x1){_0x319e8a['push'](request(_0xdf56('0x10'),{'command':util[_0xdf56('0x11')](_0xdf56('0x12'),_0x3c100a[_0x2f4335])})[_0xdf56('0x13')](function(_0x390cdd){return _0x390cdd&&_0x390cdd[_0xdf56('0x14')]&&_0x390cdd[_0xdf56('0x14')][_0xdf56('0x15')](_0xdf56('0x16'))>=0x0?!![]:![];})[_0xdf56('0xa')](function(_0x3cb2fe){logger[_0xdf56('0x9')](_0xdf56('0x17'),_0x127ad7,_0x3c100a[_0x2f4335]);}));}BPromise[_0xdf56('0x18')](_0x319e8a)['then'](function(_0x6bcaa5){var _0x4de63d=_['some'](_0x6bcaa5);logger[_0xdf56('0xc')](_0xdf56('0x19'),_0x127ad7,_0x3c100a['join']('\x20|\x20'),_0x4de63d);_0x2ec77a[_0xdf56('0x1a')](_0x4de63d);})['catch'](function(_0x5bae63){console['log'](_0x5bae63);logger[_0xdf56('0x9')](_0xdf56('0x19'),_0x127ad7,_0x3c100a['join']('\x20|\x20'),_0x5bae63[_0xdf56('0x1b')]);_0x2ec77a[_0xdf56('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2be7263..18c126e 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 _0xf109=['transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','now','called','info','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','error','queuecallerabandon','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','forIn','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer'];(function(_0x2d4e2f,_0xb64db0){var _0x43f340=function(_0x3ed175){while(--_0x3ed175){_0x2d4e2f['push'](_0x2d4e2f['shift']());}};_0x43f340(++_0xb64db0);}(_0xf109,0xce));var _0x9f10=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xf109[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var utils=require(_0x9f10('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5d2950,_0x5b381d){utils['info'](util[_0x9f10('0x3')](_0x9f10('0x4'),_0x5d2950[_0x9f10('0x5')],_0x5d2950[_0x9f10('0x6')],_0x5d2950[_0x9f10('0x7')],_0x5d2950[_0x9f10('0x8')],_0x5d2950[_0x9f10('0x9')],_0x5d2950[_0x9f10('0xa')],_0x5d2950[_0x9f10('0xb')],_0x5d2950[_0x9f10('0xc')]));if(_0x5d2950[_0x9f10('0x7')]){utils['getVoiceQueueByName'](_0x5d2950[_0x9f10('0x7')])[_0x9f10('0xd')](function(_0x1a0668){if(_0x1a0668){_0x5d2950[_0x9f10('0xe')]=_0x1a0668[_0x9f10('0xe')];_0x5d2950['agentacw']=_0x5d2950[_0x9f10('0xf')]?_0x1a0668[_0x9f10('0x10')]:![];_0x5d2950[_0x9f10('0x11')]=_0x5d2950['agentacw']?_0x1a0668['acwTimeout']:0x0;}utils[_0x9f10('0x12')](_0x9f10('0x13'),_0x5d2950);});}else{utils[_0x9f10('0x12')]('CreateVoiceAgentReport',_0x5d2950);}if(_0x5b381d){delete transfers[_0x5d2950[_0x9f10('0x5')]];}else{delete agents[_0x5d2950[_0x9f10('0x14')]];}}exports[_0x9f10('0x15')]=function(_0x58067f){try{utils[_0x9f10('0x16')](util[_0x9f10('0x3')]('[%s][agents][agentcalled]',_0x58067f[_0x9f10('0x5')]),_0x58067f);agents[_0x58067f[_0x9f10('0x14')]]=_0x58067f;agents[_0x58067f['destuniqueid']]['agentcalledAt']=utils[_0x9f10('0x17')]();agents[_0x58067f[_0x9f10('0x14')]]['lastevent']=_0x9f10('0x18');agents[_0x58067f['destuniqueid']][_0x9f10('0xb')]=null;agents[_0x58067f[_0x9f10('0x14')]]['connectedlinename']=null;utils[_0x9f10('0x19')](util[_0x9f10('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x58067f[_0x9f10('0x5')],agents[_0x58067f['destuniqueid']][_0x9f10('0x8')],_0x58067f['destuniqueid']));}catch(_0x2c5064){utils['error'](util['format'](_0x9f10('0x1a'),_0x58067f[_0x9f10('0x5')]),_0x2c5064);}};exports[_0x9f10('0x1b')]=function(_0x3a78be){try{if(!_[_0x9f10('0x1c')](agents[_0x3a78be[_0x9f10('0x14')]])){utils[_0x9f10('0x16')](util['format'](_0x9f10('0x1d'),_0x3a78be['uniqueid']),_0x3a78be);utils[_0x9f10('0x19')](util[_0x9f10('0x3')](_0x9f10('0x1e'),_0x3a78be['uniqueid'],agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0x8')],_0x3a78be[_0x9f10('0x14')]));agents[_0x3a78be['destuniqueid']][_0x9f10('0x1b')]=!![];agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0x1f')]=utils['now']();agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0xc')]=_0x9f10('0x20');agents[_0x3a78be[_0x9f10('0x14')]]['reason']='timeout';agents[_0x3a78be['destuniqueid']][_0x9f10('0x21')]=_0x3a78be['ringtime']?parseInt(_0x3a78be[_0x9f10('0x22')])/0x3e8:0x0;agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0x23')]=0x0;unanswered[_0x9f10('0x24')](_0x3a78be[_0x9f10('0x14')]);}}catch(_0x4f6b0c){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x1d'),_0x3a78be[_0x9f10('0x5')]),_0x4f6b0c);}};exports[_0x9f10('0x26')]=function(_0x2c4373){try{_['forIn'](agents,function(_0x358d3f,_0x501ee){if(_0x358d3f[_0x9f10('0x5')]==_0x2c4373[_0x9f10('0x5')]&&!_['includes'](unanswered,_0x358d3f[_0x9f10('0x14')])){utils[_0x9f10('0x16')](util[_0x9f10('0x3')]('[%s][agents][queuecallerabandon]',_0x2c4373[_0x9f10('0x5')]),_0x2c4373);utils['info'](util[_0x9f10('0x3')](_0x9f10('0x27'),_0x2c4373[_0x9f10('0x5')],_0x358d3f['membername'],_0x358d3f[_0x9f10('0x14')]));_0x358d3f[_0x9f10('0x1b')]=!![];_0x358d3f[_0x9f10('0x1f')]=utils[_0x9f10('0x17')]();_0x358d3f[_0x9f10('0xc')]='abandoned';_0x358d3f[_0x9f10('0x28')]='abandoned';_0x358d3f[_0x9f10('0x21')]=_0x2c4373[_0x9f10('0x21')];_0x358d3f[_0x9f10('0x23')]=0x0;writeDB(_0x358d3f);}});}catch(_0x11ee9c){utils[_0x9f10('0x25')](util[_0x9f10('0x3')]('[%s][agents][queuecallerabandon]',_0x2c4373[_0x9f10('0x5')]),_0x11ee9c);}};exports[_0x9f10('0x29')]=function(_0x1b8018){try{if(agents[_0x1b8018['destuniqueid']]){utils[_0x9f10('0x16')](util[_0x9f10('0x3')]('[%s][agents][agentconnect]',_0x1b8018[_0x9f10('0x5')]),_0x1b8018);utils['info'](util[_0x9f10('0x3')](_0x9f10('0x2a'),_0x1b8018[_0x9f10('0x5')],agents[_0x1b8018[_0x9f10('0x14')]][_0x9f10('0x8')],_0x1b8018[_0x9f10('0x14')]));agents[_0x1b8018[_0x9f10('0x14')]][_0x9f10('0x2b')]=utils['now']();agents[_0x1b8018[_0x9f10('0x14')]][_0x9f10('0xb')]=_0x1b8018[_0x9f10('0xb')];agents[_0x1b8018['destuniqueid']][_0x9f10('0x2c')]=_0x1b8018[_0x9f10('0x2c')];agents[_0x1b8018['destuniqueid']][_0x9f10('0x21')]=_0x1b8018[_0x9f10('0x22')];agents[_0x1b8018[_0x9f10('0x14')]]['lastevent']='connect';_[_0x9f10('0x2d')](agents,function(_0x2ff98d,_0x1deed4){if(_0x2ff98d[_0x9f10('0x14')]!=_0x1b8018[_0x9f10('0x14')]&&_0x2ff98d[_0x9f10('0x5')]==_0x1b8018[_0x9f10('0x5')]){_0x2ff98d[_0x9f10('0x23')]=0x0;_0x2ff98d[_0x9f10('0x21')]=_0x1b8018[_0x9f10('0x22')];_0x2ff98d[_0x9f10('0x1b')]=!![];_0x2ff98d[_0x9f10('0x1f')]=utils['now']();_0x2ff98d['lastevent']='answered_elsewhere';_0x2ff98d[_0x9f10('0x28')]='answered_elsewhere';_0x2ff98d[_0x9f10('0x2e')]=_0x1b8018[_0x9f10('0x14')];_0x2ff98d[_0x9f10('0x2f')]=_0x1b8018['membername'];writeDB(_0x2ff98d);}});}}catch(_0x3cfce6){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x30'),_0x1b8018[_0x9f10('0x5')]),_0x3cfce6);}};exports['agentcomplete']=function(_0x578368){try{if(!_['isNil'](agents[_0x578368[_0x9f10('0x14')]])){utils['debug'](util[_0x9f10('0x3')]('[%s][agents][agentcomplete]',_0x578368[_0x9f10('0x5')]),_0x578368);utils[_0x9f10('0x19')](util[_0x9f10('0x3')](_0x9f10('0x31'),_0x578368['uniqueid'],agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x8')],_0x578368['destuniqueid']));agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0xf')]=!![];agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x32')]=utils[_0x9f10('0x17')]();agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x23')]=utils[_0x9f10('0x33')](agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x32')],agents[_0x578368['destuniqueid']][_0x9f10('0x2b')]);agents[_0x578368[_0x9f10('0x14')]]['reason']=_0x578368[_0x9f10('0x28')];agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0xc')]=_0x9f10('0x34');writeDB(agents[_0x578368['destuniqueid']]);}}catch(_0x283f04){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x35'),_0x578368[_0x9f10('0x5')]),_0x283f04);}};exports[_0x9f10('0x36')]=function(_0x479b46){try{if(!_[_0x9f10('0x1c')](agents[_0x479b46[_0x9f10('0x37')]])){utils[_0x9f10('0x16')](util[_0x9f10('0x3')](_0x9f10('0x38'),_0x479b46[_0x9f10('0x5')]),_0x479b46);utils['info'](util[_0x9f10('0x3')](_0x9f10('0x39'),_0x479b46[_0x9f10('0x5')],agents[_0x479b46[_0x9f10('0x37')]][_0x9f10('0x8')],agents[_0x479b46[_0x9f10('0x37')]][_0x9f10('0x5')]));agents[_0x479b46[_0x9f10('0x37')]]['transfer']=!![];agents[_0x479b46[_0x9f10('0x37')]]['transfertype']=_0x9f10('0x3a');agents[_0x479b46['transfereruniqueid']][_0x9f10('0x3b')]=_0x479b46[_0x9f10('0x3c')];agents[_0x479b46[_0x9f10('0x37')]][_0x9f10('0x3d')]=agents[_0x479b46[_0x9f10('0x37')]]['uniqueid'];}}catch(_0x12cf34){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x38'),_0x479b46['uniqueid']),_0x12cf34);}};exports['attendedtransfer']=function(_0x265f69){try{utils[_0x9f10('0x16')](util['format']('[%s][agents][attendedtransfer]',_0x265f69[_0x9f10('0x3e')]),_0x265f69);if(_0x265f69[_0x9f10('0x3e')]==_0x265f69[_0x9f10('0x3f')]){if(!_['isNil'](agents[_0x265f69[_0x9f10('0x40')]])){utils[_0x9f10('0x19')](util[_0x9f10('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x265f69[_0x9f10('0x3e')],agents[_0x265f69[_0x9f10('0x40')]][_0x9f10('0x8')]));agents[_0x265f69['secondtransfereruniqueid']][_0x9f10('0x41')]=!![];agents[_0x265f69[_0x9f10('0x40')]]['transfertype']=_0x9f10('0x42');agents[_0x265f69[_0x9f10('0x40')]][_0x9f10('0x3b')]=_0x265f69[_0x9f10('0x43')];agents[_0x265f69[_0x9f10('0x40')]]['transferuniqueid']=_0x265f69[_0x9f10('0x3e')];}if(_0x265f69['transfereeuniqueid']&&agents[_0x265f69['transfereeuniqueid']]){agents[_0x265f69[_0x9f10('0x44')]][_0x9f10('0x45')]=0x1;transfers[_0x265f69[_0x9f10('0x44')]]=_[_0x9f10('0x46')](agents[_0x265f69[_0x9f10('0x44')]]);transfers[_0x265f69[_0x9f10('0x44')]][_0x9f10('0xa')]=agents[_0x265f69['secondtransfereruniqueid']]['calleridnum'];transfers[_0x265f69[_0x9f10('0x44')]][_0x9f10('0x47')]=agents[_0x265f69[_0x9f10('0x40')]][_0x9f10('0x47')];transfers[_0x265f69[_0x9f10('0x44')]][_0x9f10('0x48')]=utils[_0x9f10('0x17')]();transfers[_0x265f69['transfereeuniqueid']][_0x9f10('0x2b')]=utils[_0x9f10('0x17')]();transfers[_0x265f69['transfereeuniqueid']][_0x9f10('0x21')]=0x0;transfers[_0x265f69[_0x9f10('0x44')]]['agententerreason']=0x2;}}else if(_0x265f69[_0x9f10('0x40')]==_0x265f69[_0x9f10('0x49')]){if(!_['isNil'](agents[_0x265f69[_0x9f10('0x3e')]])){utils['info'](util[_0x9f10('0x3')](_0x9f10('0x4a'),_0x265f69[_0x9f10('0x3e')],agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x8')]));agents[_0x265f69['origtransfereruniqueid']][_0x9f10('0x41')]=!![];agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x4b')]='ATTENDED';agents[_0x265f69['origtransfereruniqueid']][_0x9f10('0x3b')]=_0x265f69[_0x9f10('0x4c')];agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x3d')]=_0x265f69[_0x9f10('0x40')];}if(_0x265f69[_0x9f10('0x4d')]&&agents[_0x265f69[_0x9f10('0x4d')]]){agents[_0x265f69['transfertargetuniqueid']][_0x9f10('0x45')]=0x1;transfers[_0x265f69[_0x9f10('0x4d')]]=_['clone'](agents[_0x265f69[_0x9f10('0x4d')]]);transfers[_0x265f69['transfertargetuniqueid']][_0x9f10('0xa')]=agents[_0x265f69[_0x9f10('0x3e')]]['calleridnum'];transfers[_0x265f69[_0x9f10('0x4d')]]['calleridname']=agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x47')];transfers[_0x265f69[_0x9f10('0x4d')]]['agentcalledAt']=utils[_0x9f10('0x17')]();transfers[_0x265f69['transfertargetuniqueid']][_0x9f10('0x2b')]=utils[_0x9f10('0x17')]();transfers[_0x265f69[_0x9f10('0x4d')]]['holdtime']=0x0;transfers[_0x265f69[_0x9f10('0x4d')]]['agententerreason']=0x2;}}}catch(_0x5708c1){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x4e'),_0x265f69['origtransfereruniqueid']),_0x5708c1);}};exports[_0x9f10('0x4f')]=function(_0x5a64ae){try{utils['debug'](util[_0x9f10('0x3')]('[%s][agents][hangup]',_0x5a64ae['uniqueid']),_0x5a64ae);if(agents[_0x5a64ae[_0x9f10('0x5')]]&&agents[_0x5a64ae['uniqueid']][_0x9f10('0x28')]===_0x9f10('0x20')){if(_0x5a64ae[_0x9f10('0x50')]==='21'){agents[_0x5a64ae['uniqueid']][_0x9f10('0x28')]=_0x9f10('0x51');agents[_0x5a64ae['uniqueid']][_0x9f10('0xc')]='rejected';}utils['info'](util[_0x9f10('0x3')](_0x9f10('0x52'),_0x5a64ae[_0x9f10('0x5')],agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x8')],agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x28')],agents[_0x5a64ae['uniqueid']][_0x9f10('0xc')]));writeDB(agents[_0x5a64ae[_0x9f10('0x5')]]);var _0x27f337=unanswered[_0x9f10('0x53')](_0x5a64ae[_0x9f10('0x5')]);if(_0x27f337>-0x1){unanswered[_0x9f10('0x54')](_0x27f337,0x1);}}if(transfers[_0x5a64ae[_0x9f10('0x5')]]){transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xf')]=!![];transfers[_0x5a64ae['uniqueid']][_0x9f10('0x32')]=utils[_0x9f10('0x17')]();transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x23')]=utils['diffTime'](transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x32')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x2b')]);transfers[_0x5a64ae['uniqueid']]['reason']=_0x9f10('0x55');transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xc')]=_0x9f10('0x34');utils[_0x9f10('0x19')](util[_0x9f10('0x3')](_0x9f10('0x52'),_0x5a64ae[_0x9f10('0x5')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x8')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x28')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xc')]));writeDB(transfers[_0x5a64ae[_0x9f10('0x5')]],!![]);}if(agents[_0x5a64ae['uniqueid']]&&agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x2b')]){agents[_0x5a64ae['uniqueid']][_0x9f10('0xf')]=!![];agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x32')]=utils[_0x9f10('0x17')]();agents[_0x5a64ae['uniqueid']][_0x9f10('0x23')]=utils['diffTime'](agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x32')],agents[_0x5a64ae[_0x9f10('0x5')]]['agentconnectAt']);agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x28')]=agents[_0x5a64ae[_0x9f10('0x5')]]['transfer']?_0x9f10('0x41'):_0x9f10('0x55');agents[_0x5a64ae[_0x9f10('0x5')]]['lastevent']='complete';utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5a64ae['uniqueid'],agents[_0x5a64ae['uniqueid']][_0x9f10('0x8')],agents[_0x5a64ae[_0x9f10('0x5')]]['reason'],agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xc')]));writeDB(agents[_0x5a64ae[_0x9f10('0x5')]]);}}catch(_0x3b3dd8){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x56'),_0x5a64ae[_0x9f10('0x5')]),_0x3b3dd8);}}; \ No newline at end of file +var _0x0713=['cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]'];(function(_0x4b1314,_0xbdac65){var _0x3a25ca=function(_0x2be3b0){while(--_0x2be3b0){_0x4b1314['push'](_0x4b1314['shift']());}};_0x3a25ca(++_0xbdac65);}(_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 utils=require(_0x3071('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2afa91,_0x27405a){utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2afa91[_0x3071('0x3')],_0x2afa91[_0x3071('0x4')],_0x2afa91[_0x3071('0x5')],_0x2afa91[_0x3071('0x6')],_0x2afa91[_0x3071('0x7')],_0x2afa91[_0x3071('0x8')],_0x2afa91[_0x3071('0x9')],_0x2afa91[_0x3071('0xa')]));if(_0x2afa91[_0x3071('0x5')]){utils[_0x3071('0xb')](_0x2afa91[_0x3071('0x5')])[_0x3071('0xc')](function(_0x1a868e){if(_0x1a868e){_0x2afa91['type']=_0x1a868e[_0x3071('0xd')];_0x2afa91[_0x3071('0xe')]=_0x2afa91[_0x3071('0xf')]?_0x1a868e[_0x3071('0x10')]:![];_0x2afa91[_0x3071('0x11')]=_0x2afa91['agentacw']?_0x1a868e[_0x3071('0x12')]:0x0;}utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);});}else{utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);}if(_0x27405a){delete transfers[_0x2afa91['uniqueid']];}else{delete agents[_0x2afa91['destuniqueid']];}}exports[_0x3071('0x15')]=function(_0x5dc13b){try{utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][agentcalled]',_0x5dc13b[_0x3071('0x3')]),_0x5dc13b);agents[_0x5dc13b['destuniqueid']]=_0x5dc13b;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x18')]=utils[_0x3071('0x19')]();agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x1a');agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x9')]=null;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x1b')]=null;utils['info'](util[_0x3071('0x2')](_0x3071('0x1c'),_0x5dc13b[_0x3071('0x3')],agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x6')],_0x5dc13b[_0x3071('0x17')]));}catch(_0x105bbb){utils[_0x3071('0x1d')](util['format'](_0x3071('0x1e'),_0x5dc13b[_0x3071('0x3')]),_0x105bbb);}};exports[_0x3071('0x1f')]=function(_0x56c267){try{if(!_[_0x3071('0x20')](agents[_0x56c267['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x56c267);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x22'),_0x56c267[_0x3071('0x3')],agents[_0x56c267['destuniqueid']]['membername'],_0x56c267[_0x3071('0x17')]));agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x1f')]=!![];agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x23')]=utils[_0x3071('0x19')]();agents[_0x56c267[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x24');agents[_0x56c267['destuniqueid']][_0x3071('0x25')]=_0x3071('0x24');agents[_0x56c267[_0x3071('0x17')]]['holdtime']=_0x56c267[_0x3071('0x26')]?parseInt(_0x56c267[_0x3071('0x26')])/0x3e8:0x0;agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x27')]=0x0;unanswered[_0x3071('0x28')](_0x56c267[_0x3071('0x17')]);}}catch(_0x177b5f){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x177b5f);}};exports['queuecallerabandon']=function(_0x4f1484){try{_[_0x3071('0x29')](agents,function(_0x149e0d,_0x6ddf96){if(_0x149e0d[_0x3071('0x3')]==_0x4f1484[_0x3071('0x3')]&&!_[_0x3071('0x2a')](unanswered,_0x149e0d[_0x3071('0x17')])){utils[_0x3071('0x16')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484['uniqueid']),_0x4f1484);utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4f1484[_0x3071('0x3')],_0x149e0d[_0x3071('0x6')],_0x149e0d[_0x3071('0x17')]));_0x149e0d[_0x3071('0x1f')]=!![];_0x149e0d['agentringnoanswerAt']=utils[_0x3071('0x19')]();_0x149e0d[_0x3071('0xa')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x25')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x2c')]=_0x4f1484[_0x3071('0x2c')];_0x149e0d[_0x3071('0x27')]=0x0;writeDB(_0x149e0d);}});}catch(_0x596cc3){utils[_0x3071('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484[_0x3071('0x3')]),_0x596cc3);}};exports[_0x3071('0x2d')]=function(_0x54d9c3){try{if(agents[_0x54d9c3[_0x3071('0x17')]]){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x54d9c3);utils[_0x3071('0x1')](util['format'](_0x3071('0x2f'),_0x54d9c3[_0x3071('0x3')],agents[_0x54d9c3['destuniqueid']][_0x3071('0x6')],_0x54d9c3['destuniqueid']));agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0x30')]=utils['now']();agents[_0x54d9c3['destuniqueid']][_0x3071('0x9')]=_0x54d9c3[_0x3071('0x9')];agents[_0x54d9c3[_0x3071('0x17')]]['connectedlinename']=_0x54d9c3[_0x3071('0x1b')];agents[_0x54d9c3['destuniqueid']][_0x3071('0x2c')]=_0x54d9c3['ringtime'];agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x31');_[_0x3071('0x29')](agents,function(_0x30ab68,_0x593c9c){if(_0x30ab68['destuniqueid']!=_0x54d9c3[_0x3071('0x17')]&&_0x30ab68[_0x3071('0x3')]==_0x54d9c3[_0x3071('0x3')]){_0x30ab68[_0x3071('0x27')]=0x0;_0x30ab68['holdtime']=_0x54d9c3[_0x3071('0x26')];_0x30ab68[_0x3071('0x1f')]=!![];_0x30ab68[_0x3071('0x23')]=utils[_0x3071('0x19')]();_0x30ab68[_0x3071('0xa')]=_0x3071('0x32');_0x30ab68['reason']=_0x3071('0x32');_0x30ab68['answeredelsewheredestinationuniqueid']=_0x54d9c3['destuniqueid'];_0x30ab68['answeredelsewheremembername']=_0x54d9c3['membername'];writeDB(_0x30ab68);}});}}catch(_0x2992e6){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x2992e6);}};exports[_0x3071('0xf')]=function(_0xa711b5){try{if(!_[_0x3071('0x20')](agents[_0xa711b5['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x33'),_0xa711b5[_0x3071('0x3')]),_0xa711b5);utils[_0x3071('0x1')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xa711b5[_0x3071('0x3')],agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x6')],_0xa711b5[_0x3071('0x17')]));agents[_0xa711b5[_0x3071('0x17')]]['agentcomplete']=!![];agents[_0xa711b5[_0x3071('0x17')]]['agentcompleteAt']=utils[_0x3071('0x19')]();agents[_0xa711b5['destuniqueid']]['talktime']=utils[_0x3071('0x34')](agents[_0xa711b5['destuniqueid']][_0x3071('0x35')],agents[_0xa711b5['destuniqueid']][_0x3071('0x30')]);agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x25')]=_0xa711b5[_0x3071('0x25')];agents[_0xa711b5['destuniqueid']][_0x3071('0xa')]='complete';writeDB(agents[_0xa711b5[_0x3071('0x17')]]);}}catch(_0x4b6bbb){utils[_0x3071('0x1d')](util[_0x3071('0x2')]('[%s][agents][agentcomplete]',_0xa711b5[_0x3071('0x3')]),_0x4b6bbb);}};exports[_0x3071('0x36')]=function(_0x224a70){try{if(!_[_0x3071('0x20')](agents[_0x224a70[_0x3071('0x37')]])){utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x224a70);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x38'),_0x224a70['uniqueid'],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x6')],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')]));agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x39')]=!![];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3a')]=_0x3071('0x3b');agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3c')]=_0x224a70[_0x3071('0x3d')];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3e')]=agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')];}}catch(_0x596cdd){utils['error'](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x596cdd);}};exports[_0x3071('0x3f')]=function(_0x15c6f8){try{utils['debug'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x15c6f8);if(_0x15c6f8['origtransfereruniqueid']==_0x15c6f8[_0x3071('0x41')]){if(!_[_0x3071('0x20')](agents[_0x15c6f8[_0x3071('0x42')]])){utils[_0x3071('0x1')](util['format'](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x42')]]['transfer']=!![];agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3a')]=_0x3071('0x45');agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x46')];agents[_0x15c6f8[_0x3071('0x42')]]['transferuniqueid']=_0x15c6f8['origtransfereruniqueid'];}if(_0x15c6f8[_0x3071('0x47')]&&agents[_0x15c6f8['transfereeuniqueid']]){agents[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x1;transfers[_0x15c6f8['transfereeuniqueid']]=_[_0x3071('0x49')](agents[_0x15c6f8[_0x3071('0x47')]]);transfers[_0x15c6f8['transfereeuniqueid']][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x8')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x4a')]=agents[_0x15c6f8['secondtransfereruniqueid']][_0x3071('0x4a')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x18')]=utils['now']();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x2;}}else if(_0x15c6f8[_0x3071('0x42')]==_0x15c6f8[_0x3071('0x4b')]){if(!_['isNil'](agents[_0x15c6f8[_0x3071('0x44')]])){utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x39')]=!![];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3a')]='ATTENDED';agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x4c')];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3e')]=_0x15c6f8[_0x3071('0x42')];}if(_0x15c6f8[_0x3071('0x4d')]&&agents[_0x15c6f8[_0x3071('0x4d')]]){agents[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x48')]=0x1;transfers[_0x15c6f8[_0x3071('0x4d')]]=_['clone'](agents[_0x15c6f8['transfertargetuniqueid']]);transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x8')];transfers[_0x15c6f8['transfertargetuniqueid']]['calleridname']=agents[_0x15c6f8[_0x3071('0x44')]]['calleridname'];transfers[_0x15c6f8['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x48')]=0x2;}}}catch(_0x19a03d){utils['error'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x19a03d);}};exports[_0x3071('0x4e')]=function(_0x29ee70){try{utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70[_0x3071('0x3')]),_0x29ee70);if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']]['reason']===_0x3071('0x24')){if(_0x29ee70[_0x3071('0x50')]==='21'){agents[_0x29ee70[_0x3071('0x3')]]['reason']='rejected';agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x51');}utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]]['membername'],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);var _0x2fbac7=unanswered[_0x3071('0x53')](_0x29ee70[_0x3071('0x3')]);if(_0x2fbac7>-0x1){unanswered[_0x3071('0x54')](_0x2fbac7,0x1);}}if(transfers[_0x29ee70[_0x3071('0x3')]]){transfers[_0x29ee70['uniqueid']][_0x3071('0xf')]=!![];transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils['now']();transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](transfers[_0x29ee70['uniqueid']]['agentcompleteAt'],transfers[_0x29ee70[_0x3071('0x3')]]['agentconnectAt']);transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')]=_0x3071('0x55');transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x56');utils[_0x3071('0x1')](util['format'](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(transfers[_0x29ee70['uniqueid']],!![]);}if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']][_0x3071('0x30')]){agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xf')]=!![];agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils[_0x3071('0x19')]();agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](agents[_0x29ee70[_0x3071('0x3')]]['agentcompleteAt'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x30')]);agents[_0x29ee70['uniqueid']][_0x3071('0x25')]=agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x39')]?_0x3071('0x39'):_0x3071('0x55');agents[_0x29ee70['uniqueid']]['lastevent']=_0x3071('0x56');utils['info'](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);}}catch(_0x291bb9){utils['error'](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70['uniqueid']),_0x291bb9);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 13d46cb..22d4077 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 _0x6a33=['[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','includes','noop','execif','lodash','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','disposition','toNumber','hangup','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','endtime','duration','starttime','billableseconds','answertime','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','destinationchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype'];(function(_0x5a0cb2,_0x431e07){var _0x3da157=function(_0xf2a7a0){while(--_0xf2a7a0){_0x5a0cb2['push'](_0x5a0cb2['shift']());}};_0x3da157(++_0x431e07);}(_0x6a33,0xee));var _0x36a3=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x6a33[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0x36a3('0x0'));var util=require('util');var utils=require(_0x36a3('0x1'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0x36a3('0x2'),_0x36a3('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x36a3('0x3'),_0x36a3('0x4'),_0x36a3('0x5'),'FAILED',_0x36a3('0x2'),_0x36a3('0x2')];var channels={};function writeDB(_0x3ee70c){var _0x4151b0;if(transfers[_0x36a3('0x6')][_0x3ee70c[_0x36a3('0x7')]]){_0x4151b0=_0x3ee70c[_0x36a3('0x7')];_0x3ee70c['uniqueid']=transfers[_0x36a3('0x6')][_0x3ee70c[_0x36a3('0x7')]]['transfereeuniqueid'];}utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0xa'),_0x3ee70c[_0x36a3('0x7')],_0x3ee70c[_0x36a3('0xb')],_0x3ee70c[_0x36a3('0xc')],_0x3ee70c['membername'],_0x3ee70c['interface'],_0x3ee70c[_0x36a3('0xd')],_0x3ee70c[_0x36a3('0xe')],_0x3ee70c[_0x36a3('0xf')]));if(_0x3ee70c[_0x36a3('0x10')]){utils[_0x36a3('0x11')](_0x3ee70c[_0x36a3('0x10')])['then'](function(_0x483bf9){if(_0x483bf9){_0x3ee70c[_0x36a3('0x12')]=_0x483bf9['id'];}utils['request'](_0x36a3('0x13'),_0x3ee70c);});}else{utils['request'](_0x36a3('0x13'),_0x3ee70c);}if(channels[_0x3ee70c[_0x36a3('0x7')]]){delete channels[_0x3ee70c[_0x36a3('0x7')]];}else if(_0x4151b0&&channels[_0x4151b0]){delete transfers[_0x36a3('0x6')][_0x4151b0];delete channels[_0x4151b0];}}exports[_0x36a3('0x14')]=function(_0xf1cd7c){try{utils[_0x36a3('0x15')](util[_0x36a3('0x9')]('[%s][calls][newchannel]',_0xf1cd7c['uniqueid']),_0xf1cd7c);if(_0xf1cd7c[_0x36a3('0x7')]==_0xf1cd7c[_0x36a3('0x16')]&&_0xf1cd7c['channel']!=_0x36a3('0x17')){utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x18'),_0xf1cd7c[_0x36a3('0x7')],_0xf1cd7c[_0x36a3('0x19')],_0xf1cd7c[_0x36a3('0x1a')]));channels[_0xf1cd7c['uniqueid']]={'uniqueid':_0xf1cd7c[_0x36a3('0x7')],'accountcode':_0xf1cd7c[_0x36a3('0x10')],'source':_0xf1cd7c[_0x36a3('0xd')],'destination':_0xf1cd7c[_0x36a3('0x1a')],'destinationcontext':_0xf1cd7c[_0x36a3('0x19')],'channel':_0xf1cd7c['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x36a3('0x3'),'amaflags':_0x36a3('0x1b')};}}catch(_0x1cc0da){utils[_0x36a3('0x1c')](util[_0x36a3('0x9')](_0x36a3('0x1d'),_0xf1cd7c[_0x36a3('0x7')]),_0x1cc0da);}};exports['newstate']=function(_0x54774a){try{utils[_0x36a3('0x15')](util[_0x36a3('0x9')](_0x36a3('0x1e'),_0x54774a[_0x36a3('0x7')]),_0x54774a);if(!_[_0x36a3('0x1f')](channels[_0x54774a['uniqueid']])&&_0x54774a['channelstate']==0x6){utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x20'),_0x54774a['uniqueid'],_0x54774a['context'],_0x54774a[_0x36a3('0xb')]));if(_['isNil'](channels[_0x54774a[_0x36a3('0x7')]][_0x36a3('0x21')])){channels[_0x54774a[_0x36a3('0x7')]][_0x36a3('0x21')]=utils[_0x36a3('0x22')]();}}else if(!_[_0x36a3('0x1f')](channels[_0x54774a[_0x36a3('0x16')]])&&_0x54774a[_0x36a3('0x23')]==0x6&&_0x54774a[_0x36a3('0x19')]!=_0x36a3('0x24')){utils['info'](util[_0x36a3('0x9')](_0x36a3('0x25'),_0x54774a[_0x36a3('0x7')],_0x54774a[_0x36a3('0x16')],_0x54774a[_0x36a3('0x19')],_0x54774a[_0x36a3('0xb')]));channels[_0x54774a[_0x36a3('0x16')]][_0x36a3('0x10')]=_0x54774a['accountcode'];channels[_0x54774a['linkedid']]['destinationchannel']=_0x54774a[_0x36a3('0xb')];if(_[_0x36a3('0x1f')](channels[_0x54774a[_0x36a3('0x16')]]['answertime'])){channels[_0x54774a[_0x36a3('0x16')]]['answertime']=utils[_0x36a3('0x22')]();}channels[_0x54774a[_0x36a3('0x16')]][_0x36a3('0x26')]=dispositions[_[_0x36a3('0x27')](_0x54774a[_0x36a3('0x23')])]||'ANSWERED';}}catch(_0x29aa96){utils[_0x36a3('0x1c')](util[_0x36a3('0x9')](_0x36a3('0x1e'),_0x54774a['uniqueid']),_0x29aa96);}};exports[_0x36a3('0x28')]=function(_0x413b57){try{if(!_[_0x36a3('0x1f')](channels[_0x413b57[_0x36a3('0x7')]])){utils[_0x36a3('0x15')](util[_0x36a3('0x9')](_0x36a3('0x29'),_0x413b57[_0x36a3('0x7')]),_0x413b57);if(_[_0x36a3('0x1f')](channels[_0x413b57['uniqueid']]['callerid'])){channels[_0x413b57['uniqueid']]['callerid']=_0x413b57[_0x36a3('0x2a')]+'\x20<'+_0x413b57[_0x36a3('0xd')]+'>';}utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x2b'),_0x413b57[_0x36a3('0x7')],channels[_0x413b57[_0x36a3('0x7')]][_0x36a3('0x2c')],_0x413b57['cause-txt']));channels[_0x413b57[_0x36a3('0x7')]][_0x36a3('0x2d')]=utils['now']();channels[_0x413b57[_0x36a3('0x7')]][_0x36a3('0x2e')]=utils['diffTime'](channels[_0x413b57['uniqueid']][_0x36a3('0x2d')],channels[_0x413b57[_0x36a3('0x7')]][_0x36a3('0x2f')]);channels[_0x413b57[_0x36a3('0x7')]][_0x36a3('0x30')]=channels[_0x413b57[_0x36a3('0x7')]][_0x36a3('0x31')]?utils[_0x36a3('0x32')](channels[_0x413b57[_0x36a3('0x7')]][_0x36a3('0x2d')],channels[_0x413b57['uniqueid']][_0x36a3('0x31')]):0x0;writeDB(channels[_0x413b57[_0x36a3('0x7')]]);}}catch(_0x4dd8a3){utils['error'](util[_0x36a3('0x9')](_0x36a3('0x29'),_0x413b57[_0x36a3('0x7')]),_0x4dd8a3);}};exports[_0x36a3('0x33')]=function(_0x1dfe2a){try{if(!_['isNil'](channels[_0x1dfe2a['localtwolinkedid']])){utils[_0x36a3('0x15')](util[_0x36a3('0x9')](_0x36a3('0x34'),_0x1dfe2a[_0x36a3('0x35')]),_0x1dfe2a);if(channels[_0x1dfe2a[_0x36a3('0x36')]]['channel']==_0x1dfe2a[_0x36a3('0x37')]){utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x38'),_0x1dfe2a[_0x36a3('0x35')],_0x1dfe2a[_0x36a3('0x36')],_0x1dfe2a[_0x36a3('0x39')]));channels[_0x1dfe2a['localtwolinkedid']]['destinationchannel']=_0x1dfe2a[_0x36a3('0x39')];channels[_0x1dfe2a[_0x36a3('0x36')]][_0x36a3('0x3a')]='_attended';}else if(channels[_0x1dfe2a[_0x36a3('0x36')]][_0x36a3('0xb')]=_0x1dfe2a[_0x36a3('0x3b')]){utils['info'](util[_0x36a3('0x9')](_0x36a3('0x38'),_0x1dfe2a[_0x36a3('0x35')],_0x1dfe2a['localtwolinkedid'],_0x1dfe2a['origtransfererchannel']));channels[_0x1dfe2a[_0x36a3('0x36')]][_0x36a3('0x3c')]=_0x1dfe2a[_0x36a3('0x3d')];channels[_0x1dfe2a[_0x36a3('0x36')]][_0x36a3('0x3a')]=_0x36a3('0x3e');}}}catch(_0x3f51eb){utils['error'](util[_0x36a3('0x9')](_0x36a3('0x34'),_0x1dfe2a[_0x36a3('0x35')]),_0x3f51eb);}};exports[_0x36a3('0x3f')]=function(_0x1273ab){try{if(!_['isNil'](channels[_0x1273ab[_0x36a3('0x7')]])){utils['debug'](util[_0x36a3('0x9')](_0x36a3('0x40'),_0x1273ab[_0x36a3('0x7')]),_0x1273ab);channels[_0x1273ab[_0x36a3('0x7')]][_0x36a3('0x41')]=utils[_0x36a3('0x22')]();utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x42'),_0x1273ab['uniqueid'],channels[_0x1273ab[_0x36a3('0x7')]]['musiconholdstartAt']));}}catch(_0x2d8140){utils['error'](util['format'](_0x36a3('0x40'),_0x1273ab[_0x36a3('0x7')]),_0x2d8140);}};exports[_0x36a3('0x43')]=function(_0x573490){try{if(!_[_0x36a3('0x1f')](channels[_0x573490[_0x36a3('0x7')]])){utils[_0x36a3('0x15')](util['format'](_0x36a3('0x44'),_0x573490[_0x36a3('0x7')]),_0x573490);if(!_[_0x36a3('0x1f')](channels[_0x573490[_0x36a3('0x7')]][_0x36a3('0x41')])){channels[_0x573490[_0x36a3('0x7')]]['mohtime']+=utils[_0x36a3('0x32')](utils[_0x36a3('0x22')](),channels[_0x573490[_0x36a3('0x7')]][_0x36a3('0x41')]);utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x45'),_0x573490[_0x36a3('0x7')],channels[_0x573490['uniqueid']][_0x36a3('0x46')]));delete channels[_0x573490[_0x36a3('0x7')]][_0x36a3('0x41')];}}}catch(_0x365945){utils[_0x36a3('0x1c')](util[_0x36a3('0x9')](_0x36a3('0x44'),_0x573490[_0x36a3('0x7')]),_0x365945);}};exports['varset']=function(_0x10ced9){try{if(!_[_0x36a3('0x1f')](channels[_0x10ced9[_0x36a3('0x7')]])){utils['debug'](util[_0x36a3('0x9')](_0x36a3('0x47'),_0x10ced9[_0x36a3('0x7')]),_0x10ced9);if(!_[_0x36a3('0x1f')](_0x10ced9[_0x36a3('0x48')]['xmd-originatecalleridnum'])){utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x49'),_0x10ced9[_0x36a3('0x7')],_0x10ced9['value']));channels[_0x10ced9[_0x36a3('0x7')]][_0x36a3('0x4a')]=_0x10ced9['value'];}if(!_[_0x36a3('0x1f')](_0x10ced9['variable'][_0x36a3('0x4b')])){utils['info'](util['format'](_0x36a3('0x4c'),_0x10ced9[_0x36a3('0x7')],_0x10ced9[_0x36a3('0x4d')]));channels[_0x10ced9[_0x36a3('0x7')]]['destination']=_0x10ced9['value'];channels[_0x10ced9[_0x36a3('0x7')]]['callerid']='\x22'+_0x10ced9['value']+'\x22\x20<'+_0x10ced9['value']+'>';}if(!_[_0x36a3('0x1f')](_0x10ced9[_0x36a3('0x48')][_0x36a3('0x4e')])||!_[_0x36a3('0x1f')](_0x10ced9['variable'][_0x36a3('0x4f')])){utils[_0x36a3('0x8')](util['format'](_0x36a3('0x50'),_0x10ced9[_0x36a3('0x7')],!_[_0x36a3('0x1f')](_0x10ced9[_0x36a3('0x48')]['xmd-callerid-preview'])?'xmd-callerid-preview':'xmd-callerid',_0x10ced9[_0x36a3('0x4d')]));channels[_0x10ced9[_0x36a3('0x7')]][_0x36a3('0x2c')]=_0x10ced9['value'];}if(!_['isNil'](_0x10ced9['variable'][_0x36a3('0x51')])||!_[_0x36a3('0x1f')](_0x10ced9[_0x36a3('0x48')]['xmcs-queue'])){utils[_0x36a3('0x8')](util[_0x36a3('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x10ced9[_0x36a3('0x7')],!_[_0x36a3('0x1f')](_0x10ced9[_0x36a3('0x48')][_0x36a3('0x51')])?_0x36a3('0x51'):_0x36a3('0x52'),_0x10ced9['value']));channels[_0x10ced9[_0x36a3('0x7')]][_0x36a3('0x53')]=_0x36a3('0x54');channels[_0x10ced9[_0x36a3('0x7')]][_0x36a3('0x55')]=_0x10ced9[_0x36a3('0x4d')];channels[_0x10ced9[_0x36a3('0x7')]][_0x36a3('0xc')]=!![];}if(!_[_0x36a3('0x1f')](_0x10ced9[_0x36a3('0x48')][_0x36a3('0x56')])){utils[_0x36a3('0x8')](util[_0x36a3('0x9')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x10ced9[_0x36a3('0x7')],_0x10ced9[_0x36a3('0x4d')]));channels[_0x10ced9['uniqueid']][_0x36a3('0x57')]=_0x10ced9['value'];}if(!_['isNil'](_0x10ced9[_0x36a3('0x48')][_0x36a3('0x58')])){utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x59'),_0x10ced9[_0x36a3('0x7')],_0x10ced9[_0x36a3('0x4d')]));channels[_0x10ced9['uniqueid']][_0x36a3('0x5a')]=_0x10ced9['value'];}if(!_[_0x36a3('0x1f')](_0x10ced9[_0x36a3('0x48')][_0x36a3('0x5b')])){utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x5c'),_0x10ced9[_0x36a3('0x7')],_0x10ced9['value']));channels[_0x10ced9['uniqueid']][_0x36a3('0x5d')]=_0x10ced9[_0x36a3('0x4d')];}if(!_['isNil'](_0x10ced9[_0x36a3('0x48')][_0x36a3('0x5e')])){utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x5f'),_0x10ced9[_0x36a3('0x7')],_0x10ced9[_0x36a3('0x4d')]));channels[_0x10ced9[_0x36a3('0x7')]][_0x36a3('0x5e')]=_0x10ced9[_0x36a3('0x4d')];}}}catch(_0x5c5a82){utils['error'](util[_0x36a3('0x9')]('[%s][calls][varset]',_0x10ced9[_0x36a3('0x7')]),_0x5c5a82);}};exports[_0x36a3('0x60')]=function(_0x2df9f0){try{if(!_[_0x36a3('0x1f')](channels[_0x2df9f0[_0x36a3('0x7')]])){utils[_0x36a3('0x15')](util[_0x36a3('0x9')](_0x36a3('0x61'),_0x2df9f0[_0x36a3('0x7')]),_0x2df9f0);utils[_0x36a3('0x8')](util[_0x36a3('0x9')](_0x36a3('0x62'),_0x2df9f0[_0x36a3('0x7')],_0x2df9f0[_0x36a3('0x63')],_0x2df9f0[_0x36a3('0x64')]));if(_0x2df9f0[_0x36a3('0x63')][_0x36a3('0x65')]()==_0x36a3('0x66')&&_['startsWith'](_0x2df9f0[_0x36a3('0x64')][_0x36a3('0x65')](),_0x36a3('0x67'))){var _0x5bdc40=_0x2df9f0[_0x36a3('0x64')][_0x36a3('0x68')]('=');var _0x36a1b6=_0x5bdc40[0x0][_0x36a3('0x69')](_0x5bdc40[0x0]['lastIndexOf']('(')+0x1,_0x5bdc40[0x0]['lastIndexOf'](')'));var _0x3a933a=_0x5bdc40[0x1];channels[_0x2df9f0[_0x36a3('0x7')]][_0x36a1b6]=_0x3a933a;}if(!_[_0x36a3('0x6a')]([_0x36a3('0x28'),_0x36a3('0x6b'),_0x36a3('0x6c'),_0x36a3('0x66'),'gotoif'],_0x2df9f0[_0x36a3('0x63')]['toLowerCase']())){channels[_0x2df9f0['uniqueid']][_0x36a3('0x53')]=_0x2df9f0[_0x36a3('0x63')];channels[_0x2df9f0[_0x36a3('0x7')]][_0x36a3('0x55')]=_0x2df9f0[_0x36a3('0x64')];}}}catch(_0x1c1343){utils[_0x36a3('0x1c')](util['format']('[%s][calls][newexten]',_0x2df9f0[_0x36a3('0x7')]),_0x1c1343);}}; \ No newline at end of file +var _0x5ac6=['exten','accountcode','calleridnum','context','channel','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','cause-txt','diffTime','endtime','answertime','attendedtransfer','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','source','value','variable','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','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','noop','execif','set','lastapplication','util','NO\x20ANSWER','FAILED','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','lastevent','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x5ac6,0x11b));var _0x65ac=function(_0x63e4c,_0x2b8b13){_0x63e4c=_0x63e4c-0x0;var _0x4ad933=_0x5ac6[_0x63e4c];return _0x4ad933;};'use strict';var _=require('lodash');var util=require(_0x65ac('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0x65ac('0x1'),_0x65ac('0x2'),_0x65ac('0x2'),_0x65ac('0x1'),_0x65ac('0x1'),'NO\x20ANSWER','ANSWERED','BUSY',_0x65ac('0x2'),'FAILED',_0x65ac('0x2')];var channels={};function writeDB(_0x70893){var _0x321228;if(transfers[_0x65ac('0x3')][_0x70893[_0x65ac('0x4')]]){_0x321228=_0x70893[_0x65ac('0x4')];_0x70893[_0x65ac('0x4')]=transfers[_0x65ac('0x3')][_0x70893['uniqueid']][_0x65ac('0x5')];}utils['info'](util['format'](_0x65ac('0x6'),_0x70893[_0x65ac('0x4')],_0x70893['channel'],_0x70893[_0x65ac('0x7')],_0x70893[_0x65ac('0x8')],_0x70893[_0x65ac('0x9')],_0x70893['calleridnum'],_0x70893['connectedlinenum'],_0x70893[_0x65ac('0xa')]));if(_0x70893['accountcode']){utils[_0x65ac('0xb')](_0x70893['accountcode'])[_0x65ac('0xc')](function(_0x5e5133){if(_0x5e5133){_0x70893[_0x65ac('0xd')]=_0x5e5133['id'];}utils[_0x65ac('0xe')](_0x65ac('0xf'),_0x70893);});}else{utils[_0x65ac('0xe')](_0x65ac('0xf'),_0x70893);}if(channels[_0x70893[_0x65ac('0x4')]]){delete channels[_0x70893[_0x65ac('0x4')]];}else if(_0x321228&&channels[_0x321228]){delete transfers[_0x65ac('0x3')][_0x321228];delete channels[_0x321228];}}exports['newchannel']=function(_0x463505){try{utils[_0x65ac('0x10')](util['format'](_0x65ac('0x11'),_0x463505[_0x65ac('0x4')]),_0x463505);if(_0x463505[_0x65ac('0x4')]==_0x463505[_0x65ac('0x12')]&&_0x463505['channel']!=_0x65ac('0x13')){utils[_0x65ac('0x14')](util[_0x65ac('0x15')](_0x65ac('0x16'),_0x463505[_0x65ac('0x4')],_0x463505['context'],_0x463505[_0x65ac('0x17')]));channels[_0x463505[_0x65ac('0x4')]]={'uniqueid':_0x463505['uniqueid'],'accountcode':_0x463505[_0x65ac('0x18')],'source':_0x463505[_0x65ac('0x19')],'destination':_0x463505['exten'],'destinationcontext':_0x463505[_0x65ac('0x1a')],'channel':_0x463505[_0x65ac('0x1b')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x65ac('0x1'),'amaflags':'DOCUMENTATION'};}}catch(_0xa93ba2){utils[_0x65ac('0x1c')](util[_0x65ac('0x15')](_0x65ac('0x11'),_0x463505[_0x65ac('0x4')]),_0xa93ba2);}};exports[_0x65ac('0x1d')]=function(_0x1a969e){try{utils[_0x65ac('0x10')](util[_0x65ac('0x15')](_0x65ac('0x1e'),_0x1a969e[_0x65ac('0x4')]),_0x1a969e);if(!_['isNil'](channels[_0x1a969e[_0x65ac('0x4')]])&&_0x1a969e[_0x65ac('0x1f')]==0x6){utils[_0x65ac('0x14')](util[_0x65ac('0x15')](_0x65ac('0x20'),_0x1a969e[_0x65ac('0x4')],_0x1a969e[_0x65ac('0x1a')],_0x1a969e[_0x65ac('0x1b')]));if(_['isNil'](channels[_0x1a969e[_0x65ac('0x4')]]['systemanswertime'])){channels[_0x1a969e[_0x65ac('0x4')]][_0x65ac('0x21')]=utils[_0x65ac('0x22')]();}}else if(!_[_0x65ac('0x23')](channels[_0x1a969e[_0x65ac('0x12')]])&&_0x1a969e[_0x65ac('0x1f')]==0x6&&_0x1a969e['context']!=_0x65ac('0x24')){utils[_0x65ac('0x14')](util[_0x65ac('0x15')](_0x65ac('0x25'),_0x1a969e[_0x65ac('0x4')],_0x1a969e['linkedid'],_0x1a969e['context'],_0x1a969e[_0x65ac('0x1b')]));channels[_0x1a969e[_0x65ac('0x12')]][_0x65ac('0x18')]=_0x1a969e[_0x65ac('0x18')];channels[_0x1a969e[_0x65ac('0x12')]][_0x65ac('0x26')]=_0x1a969e[_0x65ac('0x1b')];if(_[_0x65ac('0x23')](channels[_0x1a969e[_0x65ac('0x12')]]['answertime'])){channels[_0x1a969e['linkedid']]['answertime']=utils[_0x65ac('0x22')]();}channels[_0x1a969e[_0x65ac('0x12')]][_0x65ac('0x27')]=dispositions[_[_0x65ac('0x28')](_0x1a969e[_0x65ac('0x1f')])]||_0x65ac('0x29');}}catch(_0x24d647){utils[_0x65ac('0x1c')](util[_0x65ac('0x15')](_0x65ac('0x1e'),_0x1a969e[_0x65ac('0x4')]),_0x24d647);}};exports[_0x65ac('0x2a')]=function(_0x2f7df0){try{if(!_[_0x65ac('0x23')](channels[_0x2f7df0[_0x65ac('0x4')]])){utils[_0x65ac('0x10')](util[_0x65ac('0x15')](_0x65ac('0x2b'),_0x2f7df0[_0x65ac('0x4')]),_0x2f7df0);if(_[_0x65ac('0x23')](channels[_0x2f7df0[_0x65ac('0x4')]][_0x65ac('0x2c')])){channels[_0x2f7df0['uniqueid']][_0x65ac('0x2c')]=_0x2f7df0['calleridname']+'\x20<'+_0x2f7df0[_0x65ac('0x19')]+'>';}utils[_0x65ac('0x14')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x2f7df0[_0x65ac('0x4')],channels[_0x2f7df0[_0x65ac('0x4')]][_0x65ac('0x2c')],_0x2f7df0[_0x65ac('0x2d')]));channels[_0x2f7df0[_0x65ac('0x4')]]['endtime']=utils[_0x65ac('0x22')]();channels[_0x2f7df0[_0x65ac('0x4')]]['duration']=utils[_0x65ac('0x2e')](channels[_0x2f7df0[_0x65ac('0x4')]][_0x65ac('0x2f')],channels[_0x2f7df0[_0x65ac('0x4')]]['starttime']);channels[_0x2f7df0[_0x65ac('0x4')]]['billableseconds']=channels[_0x2f7df0['uniqueid']]['answertime']?utils[_0x65ac('0x2e')](channels[_0x2f7df0['uniqueid']][_0x65ac('0x2f')],channels[_0x2f7df0[_0x65ac('0x4')]][_0x65ac('0x30')]):0x0;writeDB(channels[_0x2f7df0['uniqueid']]);}}catch(_0x18b120){utils['error'](util['format'](_0x65ac('0x2b'),_0x2f7df0[_0x65ac('0x4')]),_0x18b120);}};exports[_0x65ac('0x31')]=function(_0x48f8f1){try{if(!_[_0x65ac('0x23')](channels[_0x48f8f1['localtwolinkedid']])){utils[_0x65ac('0x10')](util[_0x65ac('0x15')](_0x65ac('0x32'),_0x48f8f1['origtransfereruniqueid']),_0x48f8f1);if(channels[_0x48f8f1[_0x65ac('0x33')]][_0x65ac('0x1b')]==_0x48f8f1[_0x65ac('0x34')]){utils[_0x65ac('0x14')](util[_0x65ac('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x48f8f1[_0x65ac('0x35')],_0x48f8f1[_0x65ac('0x33')],_0x48f8f1[_0x65ac('0x36')]));channels[_0x48f8f1[_0x65ac('0x33')]][_0x65ac('0x26')]=_0x48f8f1[_0x65ac('0x36')];channels[_0x48f8f1[_0x65ac('0x33')]][_0x65ac('0x37')]=_0x65ac('0x38');}else if(channels[_0x48f8f1['localtwolinkedid']][_0x65ac('0x1b')]=_0x48f8f1['transfertargetchannel']){utils[_0x65ac('0x14')](util[_0x65ac('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x48f8f1[_0x65ac('0x35')],_0x48f8f1[_0x65ac('0x33')],_0x48f8f1[_0x65ac('0x39')]));channels[_0x48f8f1[_0x65ac('0x33')]][_0x65ac('0x26')]=_0x48f8f1[_0x65ac('0x39')];channels[_0x48f8f1[_0x65ac('0x33')]][_0x65ac('0x37')]=_0x65ac('0x38');}}}catch(_0x5b09c5){utils[_0x65ac('0x1c')](util['format']('[%s][calls][attendedtransfer]',_0x48f8f1[_0x65ac('0x35')]),_0x5b09c5);}};exports[_0x65ac('0x3a')]=function(_0x593267){try{if(!_[_0x65ac('0x23')](channels[_0x593267['uniqueid']])){utils[_0x65ac('0x10')](util[_0x65ac('0x15')](_0x65ac('0x3b'),_0x593267[_0x65ac('0x4')]),_0x593267);channels[_0x593267['uniqueid']][_0x65ac('0x3c')]=utils[_0x65ac('0x22')]();utils[_0x65ac('0x14')](util['format'](_0x65ac('0x3d'),_0x593267['uniqueid'],channels[_0x593267[_0x65ac('0x4')]][_0x65ac('0x3c')]));}}catch(_0x5d091b){utils['error'](util['format'](_0x65ac('0x3b'),_0x593267[_0x65ac('0x4')]),_0x5d091b);}};exports[_0x65ac('0x3e')]=function(_0x45d346){try{if(!_[_0x65ac('0x23')](channels[_0x45d346[_0x65ac('0x4')]])){utils['debug'](util[_0x65ac('0x15')](_0x65ac('0x3f'),_0x45d346['uniqueid']),_0x45d346);if(!_[_0x65ac('0x23')](channels[_0x45d346[_0x65ac('0x4')]]['musiconholdstartAt'])){channels[_0x45d346['uniqueid']][_0x65ac('0x40')]+=utils[_0x65ac('0x2e')](utils[_0x65ac('0x22')](),channels[_0x45d346[_0x65ac('0x4')]][_0x65ac('0x3c')]);utils[_0x65ac('0x14')](util['format'](_0x65ac('0x41'),_0x45d346[_0x65ac('0x4')],channels[_0x45d346[_0x65ac('0x4')]]['mohtime']));delete channels[_0x45d346[_0x65ac('0x4')]][_0x65ac('0x3c')];}}}catch(_0xb3beb1){utils[_0x65ac('0x1c')](util[_0x65ac('0x15')](_0x65ac('0x3f'),_0x45d346[_0x65ac('0x4')]),_0xb3beb1);}};exports[_0x65ac('0x42')]=function(_0x2b8203){try{if(!_[_0x65ac('0x23')](channels[_0x2b8203['uniqueid']])){utils[_0x65ac('0x10')](util[_0x65ac('0x15')](_0x65ac('0x43'),_0x2b8203[_0x65ac('0x4')]),_0x2b8203);if(!_['isNil'](_0x2b8203['variable'][_0x65ac('0x44')])){utils[_0x65ac('0x14')](util[_0x65ac('0x15')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2b8203[_0x65ac('0x4')],_0x2b8203['value']));channels[_0x2b8203[_0x65ac('0x4')]][_0x65ac('0x45')]=_0x2b8203[_0x65ac('0x46')];}if(!_[_0x65ac('0x23')](_0x2b8203[_0x65ac('0x47')][_0x65ac('0x48')])){utils[_0x65ac('0x14')](util[_0x65ac('0x15')](_0x65ac('0x49'),_0x2b8203[_0x65ac('0x4')],_0x2b8203['value']));channels[_0x2b8203['uniqueid']][_0x65ac('0x4a')]=_0x2b8203[_0x65ac('0x46')];channels[_0x2b8203[_0x65ac('0x4')]][_0x65ac('0x2c')]='\x22'+_0x2b8203[_0x65ac('0x46')]+_0x65ac('0x4b')+_0x2b8203[_0x65ac('0x46')]+'>';}if(!_['isNil'](_0x2b8203[_0x65ac('0x47')][_0x65ac('0x4c')])||!_[_0x65ac('0x23')](_0x2b8203[_0x65ac('0x47')][_0x65ac('0x4d')])){utils['info'](util[_0x65ac('0x15')](_0x65ac('0x4e'),_0x2b8203[_0x65ac('0x4')],!_[_0x65ac('0x23')](_0x2b8203[_0x65ac('0x47')]['xmd-callerid-preview'])?_0x65ac('0x4c'):_0x65ac('0x4d'),_0x2b8203[_0x65ac('0x46')]));channels[_0x2b8203[_0x65ac('0x4')]][_0x65ac('0x2c')]=_0x2b8203['value'];}if(!_['isNil'](_0x2b8203['variable']['xmd-queue'])||!_[_0x65ac('0x23')](_0x2b8203[_0x65ac('0x47')]['xmcs-queue'])){utils[_0x65ac('0x14')](util[_0x65ac('0x15')](_0x65ac('0x4e'),_0x2b8203['uniqueid'],!_['isNil'](_0x2b8203[_0x65ac('0x47')]['xmd-queue'])?'xmd-queue':_0x65ac('0x4f'),_0x2b8203[_0x65ac('0x46')]));channels[_0x2b8203[_0x65ac('0x4')]]['lastapplication']='Queue';channels[_0x2b8203[_0x65ac('0x4')]][_0x65ac('0x50')]=_0x2b8203[_0x65ac('0x46')];channels[_0x2b8203['uniqueid']][_0x65ac('0x7')]=!![];}if(!_[_0x65ac('0x23')](_0x2b8203[_0x65ac('0x47')][_0x65ac('0x51')])){utils[_0x65ac('0x14')](util['format'](_0x65ac('0x52'),_0x2b8203['uniqueid'],_0x2b8203[_0x65ac('0x46')]));channels[_0x2b8203[_0x65ac('0x4')]]['ContactId']=_0x2b8203[_0x65ac('0x46')];}if(!_['isNil'](_0x2b8203[_0x65ac('0x47')][_0x65ac('0x53')])){utils[_0x65ac('0x14')](util[_0x65ac('0x15')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2b8203[_0x65ac('0x4')],_0x2b8203['value']));channels[_0x2b8203['uniqueid']][_0x65ac('0x54')]=_0x2b8203[_0x65ac('0x46')];}if(!_[_0x65ac('0x23')](_0x2b8203[_0x65ac('0x47')][_0x65ac('0x55')])){utils[_0x65ac('0x14')](util[_0x65ac('0x15')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2b8203[_0x65ac('0x4')],_0x2b8203[_0x65ac('0x46')]));channels[_0x2b8203[_0x65ac('0x4')]]['routeid']=_0x2b8203[_0x65ac('0x46')];}if(!_['isNil'](_0x2b8203[_0x65ac('0x47')][_0x65ac('0x56')])){utils[_0x65ac('0x14')](util[_0x65ac('0x15')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x2b8203[_0x65ac('0x4')],_0x2b8203[_0x65ac('0x46')]));channels[_0x2b8203[_0x65ac('0x4')]][_0x65ac('0x56')]=_0x2b8203[_0x65ac('0x46')];}}}catch(_0x2e8f2b){utils[_0x65ac('0x1c')](util[_0x65ac('0x15')](_0x65ac('0x43'),_0x2b8203[_0x65ac('0x4')]),_0x2e8f2b);}};exports[_0x65ac('0x57')]=function(_0x34d311){try{if(!_[_0x65ac('0x23')](channels[_0x34d311[_0x65ac('0x4')]])){utils[_0x65ac('0x10')](util[_0x65ac('0x15')](_0x65ac('0x58'),_0x34d311[_0x65ac('0x4')]),_0x34d311);utils[_0x65ac('0x14')](util[_0x65ac('0x15')](_0x65ac('0x59'),_0x34d311[_0x65ac('0x4')],_0x34d311[_0x65ac('0x5a')],_0x34d311[_0x65ac('0x5b')]));if(_0x34d311[_0x65ac('0x5a')]['toLowerCase']()=='set'&&_[_0x65ac('0x5c')](_0x34d311[_0x65ac('0x5b')][_0x65ac('0x5d')](),_0x65ac('0x5e'))){var _0x100375=_0x34d311[_0x65ac('0x5b')][_0x65ac('0x5f')]('=');var _0x2b0758=_0x100375[0x0][_0x65ac('0x60')](_0x100375[0x0]['lastIndexOf']('(')+0x1,_0x100375[0x0][_0x65ac('0x61')](')'));var _0x248fd8=_0x100375[0x1];channels[_0x34d311[_0x65ac('0x4')]][_0x2b0758]=_0x248fd8;}if(!_['includes']([_0x65ac('0x2a'),_0x65ac('0x62'),_0x65ac('0x63'),_0x65ac('0x64'),'gotoif'],_0x34d311[_0x65ac('0x5a')]['toLowerCase']())){channels[_0x34d311['uniqueid']][_0x65ac('0x65')]=_0x34d311['application'];channels[_0x34d311['uniqueid']][_0x65ac('0x50')]=_0x34d311['appdata'];}}}catch(_0x17d8ae){utils[_0x65ac('0x1c')](util[_0x65ac('0x15')](_0x65ac('0x58'),_0x34d311[_0x65ac('0x4')]),_0x17d8ae);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 0adf24a..2ecae41 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 _0x8b4c=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info'];(function(_0x5d7ae8,_0x48a800){var _0x680da3=function(_0xbe3fa0){while(--_0xbe3fa0){_0x5d7ae8['push'](_0x5d7ae8['shift']());}};_0x680da3(++_0x48a800);}(_0x8b4c,0x195));var _0xc8b4=function(_0x3acdf6,_0xa3d38d){_0x3acdf6=_0x3acdf6-0x0;var _0x4d75d5=_0x8b4c[_0x3acdf6];return _0x4d75d5;};'use strict';var utils=require(_0xc8b4('0x0'));exports['connect']=function(){utils[_0xc8b4('0x1')]('[core]\x20connected');};exports[_0xc8b4('0x2')]=function(){utils['info'](_0xc8b4('0x3'));};exports[_0xc8b4('0x4')]=function(){utils['info'](_0xc8b4('0x5'));};exports['error']=function(_0x1721d4){utils[_0xc8b4('0x6')](_0xc8b4('0x7'),_0x1721d4);};exports[_0xc8b4('0x8')]=function(){utils[_0xc8b4('0x1')](_0xc8b4('0x9'));};exports[_0xc8b4('0xa')]=function(_0x45479b){}; \ No newline at end of file +var _0xe58b=['error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x30f3b6,_0x42de8d){var _0x33dbb2=function(_0x545991){while(--_0x545991){_0x30f3b6['push'](_0x30f3b6['shift']());}};_0x33dbb2(++_0x42de8d);}(_0xe58b,0x17b));var _0xbe58=function(_0x325064,_0x35482f){_0x325064=_0x325064-0x0;var _0x5d9b73=_0xe58b[_0x325064];return _0x5d9b73;};'use strict';var utils=require('./utils');exports[_0xbe58('0x0')]=function(){utils[_0xbe58('0x1')](_0xbe58('0x2'));};exports[_0xbe58('0x3')]=function(){utils[_0xbe58('0x1')](_0xbe58('0x4'));};exports['fullybooted']=function(){utils[_0xbe58('0x1')](_0xbe58('0x5'));};exports[_0xbe58('0x6')]=function(_0x1a40c2){utils[_0xbe58('0x6')](_0xbe58('0x7'),_0x1a40c2);};exports[_0xbe58('0x8')]=function(){utils[_0xbe58('0x1')](_0xbe58('0x9'));};exports[_0xbe58('0xa')]=function(_0x1a5632){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d2e743f..ecad359 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 _0x5061=['assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','dialstatus','CreateVoiceDialReport','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','error','varset','[%s][dials][varset]','outboundrouteid','value','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','called','dialend','[%s][dials][dialend]','ANSWER'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x5061,0x121));var _0x1506=function(_0x1d16c0,_0x5c30b4){_0x1d16c0=_0x1d16c0-0x0;var _0xb017b3=_0x5061[_0x1d16c0];return _0xb017b3;};'use strict';var _=require(_0x1506('0x0'));var util=require('util');var utils=require(_0x1506('0x1'));var dials={};function writeDB(_0x1df0fb){utils[_0x1506('0x2')](util['format'](_0x1506('0x3'),_0x1df0fb[_0x1506('0x4')],_0x1df0fb[_0x1506('0x5')],_0x1df0fb[_0x1506('0x6')],_0x1df0fb[_0x1506('0x7')],_0x1df0fb['connectedlinenum'],_0x1df0fb[_0x1506('0x8')]));utils['request'](_0x1506('0x9'),_0x1df0fb);delete dials[_0x1df0fb['uniqueid']];}exports['newexten']=function(_0x59fea1){try{utils[_0x1506('0xa')](util[_0x1506('0xb')]('[%s][dials][newexten]',_0x59fea1['uniqueid']),_0x59fea1);utils[_0x1506('0x2')](util[_0x1506('0xb')](_0x1506('0xc'),_0x59fea1[_0x1506('0x4')],_0x59fea1[_0x1506('0xd')],_0x59fea1[_0x1506('0xe')]));if(_0x59fea1[_0x1506('0xd')]['toLowerCase']()==_0x1506('0xf')&&_[_0x1506('0x10')](_0x59fea1[_0x1506('0xe')][_0x1506('0x11')](),_0x1506('0x12'))){var _0x309a13=_0x59fea1[_0x1506('0xe')]['split']('=');dials[_0x59fea1[_0x1506('0x4')]]={'routeId':_0x309a13[0x1]};}}catch(_0x498b3a){utils[_0x1506('0x13')](util['format']('[%s][dials][newexten]',_0x59fea1[_0x1506('0x4')]),_0x498b3a);}};exports[_0x1506('0x14')]=function(_0x331db6){try{utils['debug'](util[_0x1506('0xb')](_0x1506('0x15'),_0x331db6[_0x1506('0x4')]),_0x331db6);if(!_['isNil'](_0x331db6['variable'][_0x1506('0x16')])){utils['info'](util[_0x1506('0xb')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x331db6['uniqueid'],_0x331db6[_0x1506('0x17')]));dials[_0x331db6[_0x1506('0x4')]]={'routeId':_0x331db6[_0x1506('0x17')]};}}catch(_0x5893da){utils['error'](util[_0x1506('0xb')](_0x1506('0x15'),_0x331db6[_0x1506('0x4')]),_0x5893da);}};exports['dialbegin']=function(_0x51f79b){try{if(!_[_0x1506('0x18')](dials[_0x51f79b[_0x1506('0x4')]])){utils['debug'](util[_0x1506('0xb')](_0x1506('0x19'),_0x51f79b[_0x1506('0x4')]),_0x51f79b);dials[_0x51f79b['uniqueid']]=_['assign'](dials[_0x51f79b['uniqueid']],_0x51f79b);dials[_0x51f79b[_0x1506('0x4')]][_0x1506('0x1a')]=utils[_0x1506('0x1b')]();dials[_0x51f79b[_0x1506('0x4')]][_0x1506('0x1c')]=_0x1506('0x1d');utils[_0x1506('0x2')](util[_0x1506('0xb')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x51f79b[_0x1506('0x4')],dials[_0x51f79b['uniqueid']][_0x1506('0x1a')]));}}catch(_0x5e2765){utils[_0x1506('0x13')](util['format'](_0x1506('0x19'),_0x51f79b['uniqueid']),_0x5e2765);}};exports[_0x1506('0x1e')]=function(_0x400a32){try{if(!_[_0x1506('0x18')](dials[_0x400a32[_0x1506('0x4')]])){utils['debug'](util['format'](_0x1506('0x1f'),_0x400a32['uniqueid']),_0x400a32);dials[_0x400a32[_0x1506('0x4')]][_0x1506('0x8')]=_0x400a32[_0x1506('0x8')];if(_0x400a32[_0x1506('0x8')]==_0x1506('0x20')){dials[_0x400a32['uniqueid']]=_[_0x1506('0x21')](dials[_0x400a32['uniqueid']],_0x400a32);dials[_0x400a32[_0x1506('0x4')]][_0x1506('0x22')]=utils[_0x1506('0x1b')]();dials[_0x400a32[_0x1506('0x4')]][_0x1506('0x1c')]=_0x1506('0x23');utils[_0x1506('0x2')](util[_0x1506('0xb')](_0x1506('0x24'),_0x400a32[_0x1506('0x4')],_0x400a32[_0x1506('0x8')],dials[_0x400a32['uniqueid']]['answertime']));}else{utils[_0x1506('0x2')](util[_0x1506('0xb')]('[%s][dials][dialend]\x20dialstatus:%s',_0x400a32[_0x1506('0x4')],_0x400a32[_0x1506('0x8')]));}}}catch(_0x1e8bf3){utils[_0x1506('0x13')](util[_0x1506('0xb')](_0x1506('0x1f'),_0x400a32[_0x1506('0x4')]),_0x1e8bf3);}};exports[_0x1506('0x25')]=function(_0x411397){try{if(!_[_0x1506('0x18')](dials[_0x411397[_0x1506('0x4')]])){utils[_0x1506('0xa')](util[_0x1506('0xb')]('[%s][dials][hangup]',_0x411397['uniqueid']),_0x411397);utils[_0x1506('0x2')](util[_0x1506('0xb')](_0x1506('0x26'),_0x411397[_0x1506('0x4')],_0x411397['calleridnum'],_0x411397[_0x1506('0x27')],_0x411397['cause-txt']));dials[_0x411397[_0x1506('0x4')]]=_[_0x1506('0x21')](dials[_0x411397['uniqueid']],{'endtime':utils[_0x1506('0x1b')](),'lastevent':_0x1506('0x28')});dials[_0x411397[_0x1506('0x4')]][_0x1506('0x29')]=utils['diffTime'](dials[_0x411397[_0x1506('0x4')]][_0x1506('0x2a')],dials[_0x411397[_0x1506('0x4')]]['starttime']);dials[_0x411397['uniqueid']][_0x1506('0x2b')]=utils[_0x1506('0x2c')](dials[_0x411397[_0x1506('0x4')]][_0x1506('0x22')]||dials[_0x411397[_0x1506('0x4')]]['endtime'],dials[_0x411397[_0x1506('0x4')]][_0x1506('0x1a')]);dials[_0x411397[_0x1506('0x4')]][_0x1506('0x2d')]=dials[_0x411397[_0x1506('0x4')]][_0x1506('0x22')]?utils[_0x1506('0x2c')](dials[_0x411397[_0x1506('0x4')]][_0x1506('0x2a')],dials[_0x411397['uniqueid']][_0x1506('0x22')]):0x0;writeDB(dials[_0x411397[_0x1506('0x4')]]);}}catch(_0x1816c1){utils[_0x1506('0x13')](util['format']('[%s][dials][hangup]',_0x411397[_0x1506('0x4')]),_0x1816c1);}}; \ No newline at end of file +var _0x110a=['varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','[%s][dials][dialbegin]','assign','starttime','now','called','dialend','answertime','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','calleridnum','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','./utils','info','format','uniqueid','channel','connectedlinenum','dialstatus','newexten','debug','[%s][dials][newexten]','application','toLowerCase','set','startsWith','cdr(routeid)','appdata','split'];(function(_0x26917f,_0x31b43b){var _0x38d00c=function(_0x4a03f3){while(--_0x4a03f3){_0x26917f['push'](_0x26917f['shift']());}};_0x38d00c(++_0x31b43b);}(_0x110a,0x15e));var _0xa110=function(_0x4b5aed,_0x3b6d4f){_0x4b5aed=_0x4b5aed-0x0;var _0x17a5ce=_0x110a[_0x4b5aed];return _0x17a5ce;};'use strict';var _=require(_0xa110('0x0'));var util=require('util');var utils=require(_0xa110('0x1'));var dials={};function writeDB(_0x1ee500){utils[_0xa110('0x2')](util[_0xa110('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1ee500[_0xa110('0x4')],_0x1ee500[_0xa110('0x5')],_0x1ee500['dialstring'],_0x1ee500['calleridnum'],_0x1ee500[_0xa110('0x6')],_0x1ee500[_0xa110('0x7')]));utils['request']('CreateVoiceDialReport',_0x1ee500);delete dials[_0x1ee500[_0xa110('0x4')]];}exports[_0xa110('0x8')]=function(_0x5ad972){try{utils[_0xa110('0x9')](util['format'](_0xa110('0xa'),_0x5ad972['uniqueid']),_0x5ad972);utils[_0xa110('0x2')](util[_0xa110('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x5ad972[_0xa110('0x4')],_0x5ad972['application'],_0x5ad972['appdata']));if(_0x5ad972[_0xa110('0xb')][_0xa110('0xc')]()==_0xa110('0xd')&&_[_0xa110('0xe')](_0x5ad972['appdata'][_0xa110('0xc')](),_0xa110('0xf'))){var _0x265822=_0x5ad972[_0xa110('0x10')][_0xa110('0x11')]('=');dials[_0x5ad972[_0xa110('0x4')]]={'routeId':_0x265822[0x1]};}}catch(_0x433499){utils['error'](util['format'](_0xa110('0xa'),_0x5ad972['uniqueid']),_0x433499);}};exports[_0xa110('0x12')]=function(_0x3b3dbb){try{utils[_0xa110('0x9')](util[_0xa110('0x3')]('[%s][dials][varset]',_0x3b3dbb[_0xa110('0x4')]),_0x3b3dbb);if(!_[_0xa110('0x13')](_0x3b3dbb[_0xa110('0x14')][_0xa110('0x15')])){utils[_0xa110('0x2')](util['format'](_0xa110('0x16'),_0x3b3dbb['uniqueid'],_0x3b3dbb[_0xa110('0x17')]));dials[_0x3b3dbb[_0xa110('0x4')]]={'routeId':_0x3b3dbb['value']};}}catch(_0x36fbe0){utils[_0xa110('0x18')](util[_0xa110('0x3')](_0xa110('0x19'),_0x3b3dbb['uniqueid']),_0x36fbe0);}};exports['dialbegin']=function(_0x2f7600){try{if(!_[_0xa110('0x13')](dials[_0x2f7600[_0xa110('0x4')]])){utils[_0xa110('0x9')](util[_0xa110('0x3')](_0xa110('0x1a'),_0x2f7600['uniqueid']),_0x2f7600);dials[_0x2f7600[_0xa110('0x4')]]=_[_0xa110('0x1b')](dials[_0x2f7600[_0xa110('0x4')]],_0x2f7600);dials[_0x2f7600[_0xa110('0x4')]][_0xa110('0x1c')]=utils[_0xa110('0x1d')]();dials[_0x2f7600['uniqueid']]['lastevent']=_0xa110('0x1e');utils['info'](util[_0xa110('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2f7600[_0xa110('0x4')],dials[_0x2f7600['uniqueid']]['starttime']));}}catch(_0x5c7a91){utils['error'](util['format']('[%s][dials][dialbegin]',_0x2f7600['uniqueid']),_0x5c7a91);}};exports[_0xa110('0x1f')]=function(_0x29cac2){try{if(!_['isNil'](dials[_0x29cac2[_0xa110('0x4')]])){utils['debug'](util[_0xa110('0x3')]('[%s][dials][dialend]',_0x29cac2[_0xa110('0x4')]),_0x29cac2);dials[_0x29cac2['uniqueid']]['dialstatus']=_0x29cac2[_0xa110('0x7')];if(_0x29cac2[_0xa110('0x7')]=='ANSWER'){dials[_0x29cac2['uniqueid']]=_[_0xa110('0x1b')](dials[_0x29cac2['uniqueid']],_0x29cac2);dials[_0x29cac2['uniqueid']][_0xa110('0x20')]=utils[_0xa110('0x1d')]();dials[_0x29cac2[_0xa110('0x4')]]['lastevent']=_0xa110('0x21');utils[_0xa110('0x2')](util[_0xa110('0x3')](_0xa110('0x22'),_0x29cac2[_0xa110('0x4')],_0x29cac2[_0xa110('0x7')],dials[_0x29cac2[_0xa110('0x4')]][_0xa110('0x20')]));}else{utils[_0xa110('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x29cac2[_0xa110('0x4')],_0x29cac2[_0xa110('0x7')]));}}}catch(_0x57d0c4){utils[_0xa110('0x18')](util['format'](_0xa110('0x23'),_0x29cac2[_0xa110('0x4')]),_0x57d0c4);}};exports[_0xa110('0x24')]=function(_0x4f1bca){try{if(!_[_0xa110('0x13')](dials[_0x4f1bca[_0xa110('0x4')]])){utils['debug'](util[_0xa110('0x3')](_0xa110('0x25'),_0x4f1bca[_0xa110('0x4')]),_0x4f1bca);utils[_0xa110('0x2')](util['format'](_0xa110('0x26'),_0x4f1bca[_0xa110('0x4')],_0x4f1bca[_0xa110('0x27')],_0x4f1bca['calleridname'],_0x4f1bca[_0xa110('0x28')]));dials[_0x4f1bca[_0xa110('0x4')]]=_['assign'](dials[_0x4f1bca[_0xa110('0x4')]],{'endtime':utils[_0xa110('0x1d')](),'lastevent':'complete'});dials[_0x4f1bca[_0xa110('0x4')]][_0xa110('0x29')]=utils[_0xa110('0x2a')](dials[_0x4f1bca[_0xa110('0x4')]][_0xa110('0x2b')],dials[_0x4f1bca[_0xa110('0x4')]][_0xa110('0x1c')]);dials[_0x4f1bca[_0xa110('0x4')]][_0xa110('0x2c')]=utils['diffTime'](dials[_0x4f1bca['uniqueid']][_0xa110('0x20')]||dials[_0x4f1bca[_0xa110('0x4')]]['endtime'],dials[_0x4f1bca[_0xa110('0x4')]][_0xa110('0x1c')]);dials[_0x4f1bca[_0xa110('0x4')]][_0xa110('0x2d')]=dials[_0x4f1bca[_0xa110('0x4')]][_0xa110('0x20')]?utils[_0xa110('0x2a')](dials[_0x4f1bca[_0xa110('0x4')]][_0xa110('0x2b')],dials[_0x4f1bca['uniqueid']]['answertime']):0x0;writeDB(dials[_0x4f1bca['uniqueid']]);}}catch(_0x5897f6){utils[_0xa110('0x18')](util[_0xa110('0x3')](_0xa110('0x25'),_0x4f1bca['uniqueid']),_0x5897f6);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 145ca47..d1963e3 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 _0x09a3=['XDR\x20DISABLED','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','info'];(function(_0x552d28,_0x14de0f){var _0x4b21ba=function(_0x331219){while(--_0x331219){_0x552d28['push'](_0x552d28['shift']());}};_0x4b21ba(++_0x14de0f);}(_0x09a3,0xfe));var _0x309a=function(_0x25f098,_0x3bd401){_0x25f098=_0x25f098-0x0;var _0x2a96c4=_0x09a3[_0x25f098];return _0x2a96c4;};var AsteriskManager=require(_0x309a('0x0'));var config=require(_0x309a('0x1'));var utils=require('./utils');var util=require(_0x309a('0x2'));var ami=new AsteriskManager(config[_0x309a('0x3')][_0x309a('0x4')],config[_0x309a('0x3')]['ip'],config['asterisk'][_0x309a('0x5')],config[_0x309a('0x3')][_0x309a('0x6')],!![]);ami[_0x309a('0x7')]();if(config[_0x309a('0x8')]&&config[_0x309a('0x8')]['disabled']){utils[_0x309a('0x9')](_0x309a('0xa'));}else{var agents=require(_0x309a('0xb'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x309a('0xc'));var members=require(_0x309a('0xd'));var dials=require(_0x309a('0xe'));var transfers=require(_0x309a('0xf'));var core=require('./core.controller');ami['on'](_0x309a('0x10'),core[_0x309a('0x10')]);ami['on'](_0x309a('0x11'),core[_0x309a('0x11')]);ami['on'](_0x309a('0x12'),core[_0x309a('0x12')]);ami['on'](_0x309a('0x13'),core[_0x309a('0x13')]);ami['on'](_0x309a('0x14'),core[_0x309a('0x14')]);ami['on'](_0x309a('0x15'),core[_0x309a('0x15')]);ami['on'](_0x309a('0x16'),function(_0x218fa9){try{utils[_0x309a('0x17')](util[_0x309a('0x18')](_0x309a('0x19'),_0x218fa9[_0x309a('0x1a')]),_0x218fa9);members[_0x309a('0x16')](_0x218fa9);}catch(_0x35975f){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x19'),_0x218fa9[_0x309a('0x1a')]),_0x35975f);}});ami['on'](_0x309a('0x1b'),function(_0x55827c){try{utils[_0x309a('0x17')](util['format'](_0x309a('0x1c'),_0x55827c[_0x309a('0x1d')]),_0x55827c);agents[_0x309a('0x1b')](_0x55827c);}catch(_0x48de0e){utils['error'](util[_0x309a('0x18')](_0x309a('0x1c'),_0x55827c[_0x309a('0x1d')]),_0x48de0e);}});ami['on'](_0x309a('0x1e'),function(_0x571dc3){try{utils[_0x309a('0x17')](util[_0x309a('0x18')](_0x309a('0x1f'),_0x571dc3['uniqueid']),_0x571dc3);agents[_0x309a('0x1e')](_0x571dc3);}catch(_0x36b03b){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x1f'),_0x571dc3['uniqueid']),_0x36b03b);}});ami['on'](_0x309a('0x20'),function(_0x5e1a27){try{utils[_0x309a('0x17')](util['format']('[%s][index][agentconnect]',_0x5e1a27[_0x309a('0x1d')]),_0x5e1a27);agents[_0x309a('0x20')](_0x5e1a27);queues['agentconnect'](_0x5e1a27);}catch(_0x4d20a2){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x21'),_0x5e1a27[_0x309a('0x1d')]),_0x4d20a2);}});ami['on'](_0x309a('0x22'),function(_0x2a3b57){try{utils[_0x309a('0x17')](util[_0x309a('0x18')](_0x309a('0x23'),_0x2a3b57[_0x309a('0x1d')]),_0x2a3b57);agents[_0x309a('0x22')](_0x2a3b57);queues['agentcomplete'](_0x2a3b57);members[_0x309a('0x22')](_0x2a3b57);}catch(_0x5db56f){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x23'),_0x2a3b57[_0x309a('0x1d')]),_0x5db56f);}});ami['on'](_0x309a('0x24'),function(_0x40ce72){try{utils[_0x309a('0x17')](util['format'](_0x309a('0x25'),_0x40ce72[_0x309a('0x1d')]),_0x40ce72);agents[_0x309a('0x24')](_0x40ce72);queues[_0x309a('0x24')](_0x40ce72);}catch(_0x4fe6d7){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x25'),_0x40ce72['uniqueid']),_0x4fe6d7);}});ami['on']('queuecallerjoin',function(_0x8340eb){try{utils[_0x309a('0x17')](util['format'](_0x309a('0x26'),_0x8340eb[_0x309a('0x1d')]),_0x8340eb);queues[_0x309a('0x27')](_0x8340eb);recordings[_0x309a('0x27')](_0x8340eb);}catch(_0x378d2b){utils['error'](util[_0x309a('0x18')]('[%s][index][queuecallerjoin]',_0x8340eb['uniqueid']),_0x378d2b);}});ami['on'](_0x309a('0x28'),function(_0x203cc8){try{utils[_0x309a('0x17')](util[_0x309a('0x18')](_0x309a('0x29'),_0x203cc8['uniqueid']),_0x203cc8);queues['queuecallerleave'](_0x203cc8);}catch(_0x40c4ba){utils['error'](util[_0x309a('0x18')](_0x309a('0x29'),_0x203cc8[_0x309a('0x1d')]),_0x40c4ba);}});ami['on'](_0x309a('0x2a'),function(_0x409e00){try{utils[_0x309a('0x17')](util[_0x309a('0x18')]('[%s][index][musiconholdstart]',_0x409e00[_0x309a('0x1d')]),_0x409e00);queues[_0x309a('0x2a')](_0x409e00);calls['musiconholdstart'](_0x409e00);}catch(_0x4283dd){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x2b'),_0x409e00['uniqueid']),_0x4283dd);}});ami['on'](_0x309a('0x2c'),function(_0x5a512f){try{utils[_0x309a('0x17')](util[_0x309a('0x18')](_0x309a('0x2d'),_0x5a512f[_0x309a('0x1d')]),_0x5a512f);queues['musiconholdstop'](_0x5a512f);calls[_0x309a('0x2c')](_0x5a512f);}catch(_0x20c496){utils[_0x309a('0x13')](util['format'](_0x309a('0x2d'),_0x5a512f['uniqueid']),_0x20c496);}});ami['on']('newstate',function(_0x53cd60){try{utils[_0x309a('0x17')](util[_0x309a('0x18')](_0x309a('0x2e'),_0x53cd60[_0x309a('0x1d')]),_0x53cd60);calls['newstate'](_0x53cd60);recordings[_0x309a('0x2f')](_0x53cd60);}catch(_0x250fce){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x2e'),_0x53cd60[_0x309a('0x1d')]),_0x250fce);}});ami['on'](_0x309a('0x30'),function(_0x204183){try{utils[_0x309a('0x17')](util[_0x309a('0x18')](_0x309a('0x31'),_0x204183[_0x309a('0x1d')]),_0x204183);calls['hangup'](_0x204183);recordings[_0x309a('0x30')](_0x204183);dials[_0x309a('0x30')](_0x204183);agents[_0x309a('0x30')](_0x204183);queues[_0x309a('0x30')](_0x204183);}catch(_0x3b8e99){utils[_0x309a('0x13')](util[_0x309a('0x18')]('[%s][index][hangup]',_0x204183[_0x309a('0x1d')]),_0x3b8e99);}});ami['on'](_0x309a('0x32'),function(_0x28240d){try{utils[_0x309a('0x17')](util['format'](_0x309a('0x33'),_0x28240d[_0x309a('0x1d')]),_0x28240d);members[_0x309a('0x32')](_0x28240d);}catch(_0x4bc7de){utils[_0x309a('0x13')](util['format'](_0x309a('0x33'),_0x28240d[_0x309a('0x1d')]),_0x4bc7de);}});ami['on'](_0x309a('0x34'),function(_0x3c05fb){try{utils[_0x309a('0x17')](util['format'](_0x309a('0x35'),_0x3c05fb['uniqueid']),_0x3c05fb);queues[_0x309a('0x34')](_0x3c05fb);agents['blindtransfer'](_0x3c05fb);transfers[_0x309a('0x34')](_0x3c05fb);}catch(_0x46957c){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x35'),_0x3c05fb[_0x309a('0x1d')]),_0x46957c);}});ami['on'](_0x309a('0x36'),function(_0x5b22af){try{utils['debug'](util['format'](_0x309a('0x37'),_0x5b22af[_0x309a('0x38')]),_0x5b22af);queues['attendedtransfer'](_0x5b22af);transfers[_0x309a('0x36')](_0x5b22af);agents[_0x309a('0x36')](_0x5b22af);calls[_0x309a('0x36')](_0x5b22af);}catch(_0x15dfb5){utils[_0x309a('0x13')](util[_0x309a('0x18')]('[%s][index][attendedtransfer]',_0x5b22af[_0x309a('0x38')]),_0x15dfb5);}});ami['on'](_0x309a('0x39'),function(_0x4f6b35){try{utils[_0x309a('0x17')](util[_0x309a('0x18')]('[%s][index][varset]',_0x4f6b35[_0x309a('0x1d')]),_0x4f6b35);queues['varset'](_0x4f6b35);recordings[_0x309a('0x39')](_0x4f6b35);calls[_0x309a('0x39')](_0x4f6b35);dials[_0x309a('0x39')](_0x4f6b35);}catch(_0xc5f24b){utils[_0x309a('0x13')](util[_0x309a('0x18')]('[%s][index][varset]',_0x4f6b35['uniqueid']),_0xc5f24b);}});ami['on']('newexten',function(_0x169b27){try{utils[_0x309a('0x17')](util[_0x309a('0x18')]('[%s][index][newexten]',_0x169b27[_0x309a('0x1d')]),_0x169b27);calls['newexten'](_0x169b27);recordings[_0x309a('0x3a')](_0x169b27);dials[_0x309a('0x3a')](_0x169b27);}catch(_0x10d2d5){utils[_0x309a('0x13')](util['format'](_0x309a('0x3b'),_0x169b27['uniqueid']),_0x10d2d5);}});ami['on'](_0x309a('0x3c'),function(_0x48ed47){try{utils[_0x309a('0x17')](util[_0x309a('0x18')](_0x309a('0x3d'),_0x48ed47['uniqueid']),_0x48ed47);calls[_0x309a('0x3c')](_0x48ed47);recordings[_0x309a('0x3c')](_0x48ed47);}catch(_0x12455e){utils[_0x309a('0x13')](util['format']('[%s][index][newchannel]',_0x48ed47[_0x309a('0x1d')]),_0x12455e);}});ami['on'](_0x309a('0x3e'),function(_0x5065a3){try{utils['debug'](util['format']('[%s][index][dialbegin]',_0x5065a3[_0x309a('0x1d')]),_0x5065a3);dials[_0x309a('0x3e')](_0x5065a3);}catch(_0x1555f4){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x3f'),_0x5065a3['uniqueid']),_0x1555f4);}});ami['on'](_0x309a('0x40'),function(_0x3c0521){try{utils['debug'](util[_0x309a('0x18')](_0x309a('0x41'),_0x3c0521[_0x309a('0x1d')]),_0x3c0521);dials['dialend'](_0x3c0521);}catch(_0x1ed602){utils[_0x309a('0x13')](util[_0x309a('0x18')](_0x309a('0x41'),_0x3c0521[_0x309a('0x1d')]),_0x1ed602);}});} \ No newline at end of file +var _0x248c=['../../config/environment','./utils','util','asterisk','port','username','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager'];(function(_0x174d7b,_0x50f7ab){var _0x506f7a=function(_0x5a2f14){while(--_0x5a2f14){_0x174d7b['push'](_0x174d7b['shift']());}};_0x506f7a(++_0x50f7ab);}(_0x248c,0x113));var _0xc248=function(_0x7eb73d,_0x598d0c){_0x7eb73d=_0x7eb73d-0x0;var _0x18bfc4=_0x248c[_0x7eb73d];return _0x18bfc4;};var AsteriskManager=require(_0xc248('0x0'));var config=require(_0xc248('0x1'));var utils=require(_0xc248('0x2'));var util=require(_0xc248('0x3'));var ami=new AsteriskManager(config[_0xc248('0x4')][_0xc248('0x5')],config['asterisk']['ip'],config[_0xc248('0x4')][_0xc248('0x6')],config[_0xc248('0x4')]['password'],!![]);ami['keepConnected']();if(config[_0xc248('0x7')]&&config[_0xc248('0x7')][_0xc248('0x8')]){utils['info'](_0xc248('0x9'));}else{var agents=require(_0xc248('0xa'));var calls=require(_0xc248('0xb'));var queues=require(_0xc248('0xc'));var recordings=require(_0xc248('0xd'));var members=require(_0xc248('0xe'));var dials=require(_0xc248('0xf'));var transfers=require('./transfers.controller');var core=require(_0xc248('0x10'));ami['on'](_0xc248('0x11'),core[_0xc248('0x11')]);ami['on'](_0xc248('0x12'),core[_0xc248('0x12')]);ami['on']('fullybooted',core[_0xc248('0x13')]);ami['on'](_0xc248('0x14'),core['error']);ami['on']('close',core[_0xc248('0x15')]);ami['on'](_0xc248('0x16'),core['managerevent']);ami['on'](_0xc248('0x17'),function(_0x5db016){try{utils[_0xc248('0x18')](util[_0xc248('0x19')]('[%s][index][devicestatechange]',_0x5db016[_0xc248('0x1a')]),_0x5db016);members['devicestatechange'](_0x5db016);}catch(_0xd35a79){utils['error'](util['format'](_0xc248('0x1b'),_0x5db016[_0xc248('0x1a')]),_0xd35a79);}});ami['on'](_0xc248('0x1c'),function(_0x1b87a6){try{utils['debug'](util[_0xc248('0x19')](_0xc248('0x1d'),_0x1b87a6['uniqueid']),_0x1b87a6);agents[_0xc248('0x1c')](_0x1b87a6);}catch(_0x40a208){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x1d'),_0x1b87a6[_0xc248('0x1e')]),_0x40a208);}});ami['on']('agentringnoanswer',function(_0x3f89a3){try{utils[_0xc248('0x18')](util[_0xc248('0x19')]('[%s][index][agentringnoanswer]',_0x3f89a3[_0xc248('0x1e')]),_0x3f89a3);agents[_0xc248('0x1f')](_0x3f89a3);}catch(_0x11352a){utils['error'](util[_0xc248('0x19')](_0xc248('0x20'),_0x3f89a3[_0xc248('0x1e')]),_0x11352a);}});ami['on'](_0xc248('0x21'),function(_0x8ffdf8){try{utils[_0xc248('0x18')](util[_0xc248('0x19')]('[%s][index][agentconnect]',_0x8ffdf8['uniqueid']),_0x8ffdf8);agents[_0xc248('0x21')](_0x8ffdf8);queues[_0xc248('0x21')](_0x8ffdf8);}catch(_0x345835){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x22'),_0x8ffdf8[_0xc248('0x1e')]),_0x345835);}});ami['on'](_0xc248('0x23'),function(_0x5a3997){try{utils[_0xc248('0x18')](util[_0xc248('0x19')](_0xc248('0x24'),_0x5a3997['uniqueid']),_0x5a3997);agents[_0xc248('0x23')](_0x5a3997);queues['agentcomplete'](_0x5a3997);members[_0xc248('0x23')](_0x5a3997);}catch(_0xac8170){utils['error'](util[_0xc248('0x19')](_0xc248('0x24'),_0x5a3997[_0xc248('0x1e')]),_0xac8170);}});ami['on'](_0xc248('0x25'),function(_0x123289){try{utils['debug'](util[_0xc248('0x19')](_0xc248('0x26'),_0x123289[_0xc248('0x1e')]),_0x123289);agents['queuecallerabandon'](_0x123289);queues[_0xc248('0x25')](_0x123289);}catch(_0x4c5121){utils['error'](util['format'](_0xc248('0x26'),_0x123289['uniqueid']),_0x4c5121);}});ami['on'](_0xc248('0x27'),function(_0x3255fb){try{utils[_0xc248('0x18')](util[_0xc248('0x19')](_0xc248('0x28'),_0x3255fb[_0xc248('0x1e')]),_0x3255fb);queues[_0xc248('0x27')](_0x3255fb);recordings[_0xc248('0x27')](_0x3255fb);}catch(_0x4c8db3){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x28'),_0x3255fb[_0xc248('0x1e')]),_0x4c8db3);}});ami['on'](_0xc248('0x29'),function(_0x436321){try{utils[_0xc248('0x18')](util[_0xc248('0x19')](_0xc248('0x2a'),_0x436321['uniqueid']),_0x436321);queues[_0xc248('0x29')](_0x436321);}catch(_0x2205ce){utils[_0xc248('0x14')](util[_0xc248('0x19')]('[%s][index][queuecallerleave]',_0x436321[_0xc248('0x1e')]),_0x2205ce);}});ami['on'](_0xc248('0x2b'),function(_0x38eb65){try{utils['debug'](util['format'](_0xc248('0x2c'),_0x38eb65['uniqueid']),_0x38eb65);queues[_0xc248('0x2b')](_0x38eb65);calls[_0xc248('0x2b')](_0x38eb65);}catch(_0x21f6e8){utils[_0xc248('0x14')](util[_0xc248('0x19')]('[%s][index][musiconholdstart]',_0x38eb65[_0xc248('0x1e')]),_0x21f6e8);}});ami['on'](_0xc248('0x2d'),function(_0x5e0a01){try{utils[_0xc248('0x18')](util['format'](_0xc248('0x2e'),_0x5e0a01[_0xc248('0x1e')]),_0x5e0a01);queues[_0xc248('0x2d')](_0x5e0a01);calls[_0xc248('0x2d')](_0x5e0a01);}catch(_0x2e951e){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x2e'),_0x5e0a01[_0xc248('0x1e')]),_0x2e951e);}});ami['on'](_0xc248('0x2f'),function(_0xc07c0b){try{utils['debug'](util[_0xc248('0x19')](_0xc248('0x30'),_0xc07c0b['uniqueid']),_0xc07c0b);calls['newstate'](_0xc07c0b);recordings[_0xc248('0x2f')](_0xc07c0b);}catch(_0x257e33){utils[_0xc248('0x14')](util['format'](_0xc248('0x30'),_0xc07c0b[_0xc248('0x1e')]),_0x257e33);}});ami['on'](_0xc248('0x31'),function(_0x3beb4a){try{utils[_0xc248('0x18')](util['format'](_0xc248('0x32'),_0x3beb4a[_0xc248('0x1e')]),_0x3beb4a);calls[_0xc248('0x31')](_0x3beb4a);recordings[_0xc248('0x31')](_0x3beb4a);dials[_0xc248('0x31')](_0x3beb4a);agents[_0xc248('0x31')](_0x3beb4a);queues[_0xc248('0x31')](_0x3beb4a);}catch(_0x2127a5){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x32'),_0x3beb4a['uniqueid']),_0x2127a5);}});ami['on']('cdr',function(_0x6b3c01){try{utils[_0xc248('0x18')](util[_0xc248('0x19')](_0xc248('0x33'),_0x6b3c01[_0xc248('0x1e')]),_0x6b3c01);members[_0xc248('0x34')](_0x6b3c01);}catch(_0xee858a){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x33'),_0x6b3c01[_0xc248('0x1e')]),_0xee858a);}});ami['on'](_0xc248('0x35'),function(_0x68aa7d){try{utils[_0xc248('0x18')](util[_0xc248('0x19')](_0xc248('0x36'),_0x68aa7d[_0xc248('0x1e')]),_0x68aa7d);queues['blindtransfer'](_0x68aa7d);agents[_0xc248('0x35')](_0x68aa7d);transfers[_0xc248('0x35')](_0x68aa7d);}catch(_0x1d19c0){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x36'),_0x68aa7d['uniqueid']),_0x1d19c0);}});ami['on']('attendedtransfer',function(_0x12822e){try{utils[_0xc248('0x18')](util[_0xc248('0x19')](_0xc248('0x37'),_0x12822e['origtransfereruniqueid']),_0x12822e);queues[_0xc248('0x38')](_0x12822e);transfers['attendedtransfer'](_0x12822e);agents[_0xc248('0x38')](_0x12822e);calls[_0xc248('0x38')](_0x12822e);}catch(_0xb3d330){utils['error'](util[_0xc248('0x19')](_0xc248('0x37'),_0x12822e[_0xc248('0x39')]),_0xb3d330);}});ami['on'](_0xc248('0x3a'),function(_0x3ed137){try{utils[_0xc248('0x18')](util[_0xc248('0x19')](_0xc248('0x3b'),_0x3ed137[_0xc248('0x1e')]),_0x3ed137);queues[_0xc248('0x3a')](_0x3ed137);recordings[_0xc248('0x3a')](_0x3ed137);calls[_0xc248('0x3a')](_0x3ed137);dials[_0xc248('0x3a')](_0x3ed137);}catch(_0x453a94){utils[_0xc248('0x14')](util[_0xc248('0x19')]('[%s][index][varset]',_0x3ed137['uniqueid']),_0x453a94);}});ami['on'](_0xc248('0x3c'),function(_0xe7333a){try{utils['debug'](util['format'](_0xc248('0x3d'),_0xe7333a[_0xc248('0x1e')]),_0xe7333a);calls['newexten'](_0xe7333a);recordings['newexten'](_0xe7333a);dials[_0xc248('0x3c')](_0xe7333a);}catch(_0x310751){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x3d'),_0xe7333a[_0xc248('0x1e')]),_0x310751);}});ami['on'](_0xc248('0x3e'),function(_0x4d76fb){try{utils[_0xc248('0x18')](util[_0xc248('0x19')]('[%s][index][newchannel]',_0x4d76fb[_0xc248('0x1e')]),_0x4d76fb);calls[_0xc248('0x3e')](_0x4d76fb);recordings[_0xc248('0x3e')](_0x4d76fb);}catch(_0x2f3d7b){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x3f'),_0x4d76fb[_0xc248('0x1e')]),_0x2f3d7b);}});ami['on'](_0xc248('0x40'),function(_0x9b339a){try{utils[_0xc248('0x18')](util['format'](_0xc248('0x41'),_0x9b339a[_0xc248('0x1e')]),_0x9b339a);dials[_0xc248('0x40')](_0x9b339a);}catch(_0x5405d4){utils['error'](util[_0xc248('0x19')](_0xc248('0x42'),_0x9b339a[_0xc248('0x1e')]),_0x5405d4);}});ami['on']('dialend',function(_0x10db6f){try{utils['debug'](util['format'](_0xc248('0x43'),_0x10db6f[_0xc248('0x1e')]),_0x10db6f);dials[_0xc248('0x44')](_0x10db6f);}catch(_0x5a1578){utils[_0xc248('0x14')](util[_0xc248('0x19')](_0xc248('0x43'),_0x10db6f['uniqueid']),_0x5a1578);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 78b077d..66c4ed5 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 _0xa637=['lodash','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','membername','type','interface','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','format','[%s][members][writeDB]','uniqueid','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','agent','NOT_INUSE','isNil','now','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','data3','exitAt','destinationchannel','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s'];(function(_0x2d84fe,_0x6b50e4){var _0x409e82=function(_0x25bf85){while(--_0x25bf85){_0x2d84fe['push'](_0x2d84fe['shift']());}};_0x409e82(++_0x6b50e4);}(_0xa637,0x113));var _0x7a63=function(_0x54be98,_0x5c571f){_0x54be98=_0x54be98-0x0;var _0x1980df=_0xa637[_0x54be98];return _0x1980df;};'use strict';var _=require(_0x7a63('0x0'));var util=require(_0x7a63('0x1'));var utils=require(_0x7a63('0x2'));var members={};var exclude=[_0x7a63('0x3'),_0x7a63('0x4')];function writeDB(_0x298352){utils[_0x7a63('0x5')](util['format'](_0x7a63('0x6'),_0x298352['uniqueid'],_0x298352['interface'],_0x298352[_0x7a63('0x7')],_0x298352['data2'],_0x298352[_0x7a63('0x8')],_0x298352[_0x7a63('0x9')]));if(_0x298352[_0x7a63('0xa')]){utils[_0x7a63('0xb')](_0x298352['interface'])['then'](function(_0x47576d){if(_0x47576d){_0x298352[_0x7a63('0x8')]=_0x47576d[_0x7a63('0xc')];_0x298352[_0x7a63('0xd')]=_0x47576d[_0x7a63('0xd')];utils[_0x7a63('0xe')](_0x7a63('0xf'),_0x298352);}else{utils[_0x7a63('0x10')](_0x298352['interface'][_0x7a63('0x11')]('/')[0x1])[_0x7a63('0x12')](function(_0x37c150){if(_0x37c150){_0x298352['membername']=_0x37c150[_0x7a63('0xc')];_0x298352[_0x7a63('0xd')]=_0x37c150[_0x7a63('0xd')];utils[_0x7a63('0xe')](_0x7a63('0xf'),_0x298352);}});}})[_0x7a63('0x13')](function(_0xe20477){utils[_0x7a63('0x14')](util[_0x7a63('0x15')](_0x7a63('0x16'),_0x298352[_0x7a63('0x17')]),_0xe20477);});}delete members[_0x298352['interface']];}function startsWith(_0xed87d1,_0x199530){return _['some'](_0xed87d1,function(_0x57829f){return _[_0x7a63('0x18')](_0x199530,_0x57829f);});}exports[_0x7a63('0x19')]=function(_0x78feab){try{utils[_0x7a63('0x1a')](util[_0x7a63('0x15')](_0x7a63('0x1b'),members[_0x78feab[_0x7a63('0x1c')]]?members[_0x78feab[_0x7a63('0x1c')]][_0x7a63('0x17')]:_0x78feab[_0x7a63('0x1c')]),_0x78feab);utils[_0x7a63('0x5')](util[_0x7a63('0x15')](_0x7a63('0x1d'),members[_0x78feab[_0x7a63('0x1c')]]?members[_0x78feab['device']]['uniqueid']:_0x78feab['device'],_0x78feab[_0x7a63('0x1e')],_0x78feab['device']));switch(_0x78feab[_0x7a63('0x1e')]){case _0x7a63('0x1f'):case _0x7a63('0x20'):if(!startsWith(exclude,_0x78feab[_0x7a63('0x1c')])){members[_0x78feab[_0x7a63('0x1c')]]={'channel':'voice','interface':_0x78feab[_0x7a63('0x1c')],'type':'TALKING','enterAt':utils['now'](),'role':_0x7a63('0x21')};}break;case _0x7a63('0x22'):if(!_[_0x7a63('0x23')](members[_0x78feab[_0x7a63('0x1c')]])){members[_0x78feab[_0x7a63('0x1c')]]['exitAt']=utils[_0x7a63('0x24')]();members[_0x78feab['device']][_0x7a63('0x25')]=utils[_0x7a63('0x26')](members[_0x78feab[_0x7a63('0x1c')]]['exitAt'],members[_0x78feab[_0x7a63('0x1c')]][_0x7a63('0x27')]);if(members[_0x78feab[_0x7a63('0x1c')]][_0x7a63('0x17')]){writeDB(members[_0x78feab[_0x7a63('0x1c')]]);}}break;default:break;}}catch(_0x504561){utils[_0x7a63('0x14')](util['format'](_0x7a63('0x1b'),members[_0x78feab[_0x7a63('0x1c')]]?members[_0x78feab[_0x7a63('0x1c')]][_0x7a63('0x17')]:_0x78feab[_0x7a63('0x1c')]),_0x504561);}};exports[_0x7a63('0x28')]=function(_0x40ce24){try{if(!_[_0x7a63('0x23')](members[_0x40ce24['interface']])){utils[_0x7a63('0x1a')](util[_0x7a63('0x15')](_0x7a63('0x29'),_0x40ce24[_0x7a63('0x17')]),_0x40ce24);utils[_0x7a63('0x5')](util[_0x7a63('0x15')](_0x7a63('0x2a'),_0x40ce24['uniqueid'],_0x40ce24[_0x7a63('0xa')],_0x40ce24[_0x7a63('0x2b')]));members[_0x40ce24[_0x7a63('0xa')]]=_[_0x7a63('0x2c')](members[_0x40ce24[_0x7a63('0xa')]],{'data4':_0x40ce24[_0x7a63('0x2b')],'uniqueid':_0x40ce24[_0x7a63('0x17')]});}}catch(_0x470d12){utils[_0x7a63('0x14')](util[_0x7a63('0x15')](_0x7a63('0x29'),_0x40ce24[_0x7a63('0x17')]),_0x470d12);}};exports[_0x7a63('0x2d')]=function(_0x50b8d3){try{utils[_0x7a63('0x1a')](util['format'](_0x7a63('0x2e'),_0x50b8d3[_0x7a63('0x17')]),_0x50b8d3);if(_0x50b8d3[_0x7a63('0x7')]){var _0x2c82dd=_0x50b8d3[_0x7a63('0x7')][_0x7a63('0x11')]('-')[0x0];if(!_['isNil'](members[_0x2c82dd])){members[_0x2c82dd]=_[_0x7a63('0x2c')](members[_0x2c82dd],{'data1':members[_0x2c82dd][_0x7a63('0x2f')]||_0x50b8d3[_0x7a63('0x9')],'data2':members[_0x2c82dd][_0x7a63('0x30')]||_0x50b8d3['source'],'data3':members[_0x2c82dd][_0x7a63('0x31')]||_0x50b8d3['destination'],'uniqueid':members[_0x2c82dd]['uniqueid']||_0x50b8d3[_0x7a63('0x17')]});utils[_0x7a63('0x5')](util[_0x7a63('0x15')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x50b8d3['uniqueid'],members[_0x2c82dd][_0x7a63('0x2f')],members[_0x2c82dd][_0x7a63('0x30')],members[_0x2c82dd][_0x7a63('0x31')]));if(members[_0x2c82dd][_0x7a63('0x32')]){writeDB(members[_0x2c82dd]);}}}if(_0x50b8d3[_0x7a63('0x33')]){var _0x2f45d5=_0x50b8d3[_0x7a63('0x33')][_0x7a63('0x11')]('-')[0x0];if(!_[_0x7a63('0x23')](members[_0x2f45d5])){members[_0x2f45d5]=_['assign'](members[_0x2f45d5],{'data1':members[_0x2f45d5][_0x7a63('0x2f')]||_0x50b8d3[_0x7a63('0x9')],'data2':members[_0x2f45d5][_0x7a63('0x30')]||_0x50b8d3[_0x7a63('0x34')],'data3':members[_0x2f45d5][_0x7a63('0x31')]||_0x50b8d3[_0x7a63('0x35')],'uniqueid':members[_0x2f45d5][_0x7a63('0x17')]||_0x50b8d3['uniqueid']});utils[_0x7a63('0x5')](util['format'](_0x7a63('0x36'),_0x50b8d3['uniqueid'],members[_0x2f45d5][_0x7a63('0x2f')],members[_0x2f45d5][_0x7a63('0x30')],members[_0x2f45d5][_0x7a63('0x31')]));if(members[_0x2f45d5][_0x7a63('0x32')]){writeDB(members[_0x2f45d5]);}}}}catch(_0x346d5c){utils[_0x7a63('0x14')](util[_0x7a63('0x15')](_0x7a63('0x2e'),_0x50b8d3[_0x7a63('0x17')]),_0x346d5c);}}; \ No newline at end of file +var _0x03bc=['internal','request','CreateMemberReport','catch','some','startsWith','debug','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','error','split','data1','type','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','./utils','Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','getUserByInterface','then','name'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x03bc,0xb8));var _0xc03b=function(_0x4ab531,_0x536e84){_0x4ab531=_0x4ab531-0x0;var _0x54ca3c=_0x03bc[_0x4ab531];return _0x54ca3c;};'use strict';var _=require(_0xc03b('0x0'));var util=require('util');var utils=require(_0xc03b('0x1'));var members={};var exclude=[_0xc03b('0x2'),'Queue:'];function writeDB(_0x5f8f09){utils['info'](util[_0xc03b('0x3')](_0xc03b('0x4'),_0x5f8f09[_0xc03b('0x5')],_0x5f8f09[_0xc03b('0x6')],_0x5f8f09[_0xc03b('0x7')],_0x5f8f09['data2'],_0x5f8f09[_0xc03b('0x8')],_0x5f8f09['type']));if(_0x5f8f09[_0xc03b('0x6')]){utils[_0xc03b('0x9')](_0x5f8f09[_0xc03b('0x6')])[_0xc03b('0xa')](function(_0x26cbb8){if(_0x26cbb8){_0x5f8f09[_0xc03b('0x8')]=_0x26cbb8[_0xc03b('0xb')];_0x5f8f09[_0xc03b('0xc')]=_0x26cbb8['internal'];utils[_0xc03b('0xd')]('CreateMemberReport',_0x5f8f09);}else{utils['getUserByName'](_0x5f8f09['interface']['split']('/')[0x1])[_0xc03b('0xa')](function(_0x5e1e2b){if(_0x5e1e2b){_0x5f8f09['membername']=_0x5e1e2b['name'];_0x5f8f09['internal']=_0x5e1e2b[_0xc03b('0xc')];utils[_0xc03b('0xd')](_0xc03b('0xe'),_0x5f8f09);}});}})[_0xc03b('0xf')](function(_0x42332b){utils['error'](util[_0xc03b('0x3')]('[%s][members][writeDB]',_0x5f8f09['uniqueid']),_0x42332b);});}delete members[_0x5f8f09['interface']];}function startsWith(_0x11374d,_0xcd680b){return _[_0xc03b('0x10')](_0x11374d,function(_0x45c890){return _[_0xc03b('0x11')](_0xcd680b,_0x45c890);});}exports['devicestatechange']=function(_0x519a8f){try{utils[_0xc03b('0x12')](util[_0xc03b('0x3')](_0xc03b('0x13'),members[_0x519a8f[_0xc03b('0x14')]]?members[_0x519a8f['device']][_0xc03b('0x5')]:_0x519a8f[_0xc03b('0x14')]),_0x519a8f);utils[_0xc03b('0x15')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x519a8f[_0xc03b('0x14')]]?members[_0x519a8f[_0xc03b('0x14')]][_0xc03b('0x5')]:_0x519a8f[_0xc03b('0x14')],_0x519a8f[_0xc03b('0x16')],_0x519a8f[_0xc03b('0x14')]));switch(_0x519a8f['state']){case _0xc03b('0x17'):case _0xc03b('0x18'):if(!startsWith(exclude,_0x519a8f['device'])){members[_0x519a8f[_0xc03b('0x14')]]={'channel':_0xc03b('0x19'),'interface':_0x519a8f[_0xc03b('0x14')],'type':'TALKING','enterAt':utils[_0xc03b('0x1a')](),'role':_0xc03b('0x1b')};}break;case _0xc03b('0x1c'):if(!_[_0xc03b('0x1d')](members[_0x519a8f[_0xc03b('0x14')]])){members[_0x519a8f[_0xc03b('0x14')]]['exitAt']=utils['now']();members[_0x519a8f[_0xc03b('0x14')]][_0xc03b('0x1e')]=utils[_0xc03b('0x1f')](members[_0x519a8f[_0xc03b('0x14')]][_0xc03b('0x20')],members[_0x519a8f[_0xc03b('0x14')]][_0xc03b('0x21')]);if(members[_0x519a8f['device']][_0xc03b('0x5')]){writeDB(members[_0x519a8f[_0xc03b('0x14')]]);}}break;default:break;}}catch(_0x50e5a5){utils['error'](util[_0xc03b('0x3')]('[%s][members][devicestatechange]',members[_0x519a8f[_0xc03b('0x14')]]?members[_0x519a8f[_0xc03b('0x14')]][_0xc03b('0x5')]:_0x519a8f[_0xc03b('0x14')]),_0x50e5a5);}};exports[_0xc03b('0x22')]=function(_0x1dd14d){try{if(!_[_0xc03b('0x1d')](members[_0x1dd14d[_0xc03b('0x6')]])){utils[_0xc03b('0x12')](util[_0xc03b('0x3')](_0xc03b('0x23'),_0x1dd14d[_0xc03b('0x5')]),_0x1dd14d);utils[_0xc03b('0x15')](util[_0xc03b('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x1dd14d[_0xc03b('0x5')],_0x1dd14d[_0xc03b('0x6')],_0x1dd14d[_0xc03b('0x24')]));members[_0x1dd14d[_0xc03b('0x6')]]=_[_0xc03b('0x25')](members[_0x1dd14d[_0xc03b('0x6')]],{'data4':_0x1dd14d[_0xc03b('0x24')],'uniqueid':_0x1dd14d[_0xc03b('0x5')]});}}catch(_0x305301){utils[_0xc03b('0x26')](util[_0xc03b('0x3')]('[%s][members][agentcomplete]',_0x1dd14d[_0xc03b('0x5')]),_0x305301);}};exports['cdr']=function(_0x61d710){try{utils['debug'](util[_0xc03b('0x3')]('[%s][members][cdr]',_0x61d710['uniqueid']),_0x61d710);if(_0x61d710[_0xc03b('0x7')]){var _0x52e89a=_0x61d710[_0xc03b('0x7')][_0xc03b('0x27')]('-')[0x0];if(!_[_0xc03b('0x1d')](members[_0x52e89a])){members[_0x52e89a]=_[_0xc03b('0x25')](members[_0x52e89a],{'data1':members[_0x52e89a][_0xc03b('0x28')]||_0x61d710[_0xc03b('0x29')],'data2':members[_0x52e89a][_0xc03b('0x2a')]||_0x61d710[_0xc03b('0x2b')],'data3':members[_0x52e89a][_0xc03b('0x2c')]||_0x61d710[_0xc03b('0x2d')],'uniqueid':members[_0x52e89a][_0xc03b('0x5')]||_0x61d710[_0xc03b('0x5')]});utils[_0xc03b('0x15')](util[_0xc03b('0x3')](_0xc03b('0x2e'),_0x61d710[_0xc03b('0x5')],members[_0x52e89a]['data1'],members[_0x52e89a]['data2'],members[_0x52e89a][_0xc03b('0x2c')]));if(members[_0x52e89a]['exitAt']){writeDB(members[_0x52e89a]);}}}if(_0x61d710[_0xc03b('0x2f')]){var _0x2e311c=_0x61d710[_0xc03b('0x2f')][_0xc03b('0x27')]('-')[0x0];if(!_[_0xc03b('0x1d')](members[_0x2e311c])){members[_0x2e311c]=_[_0xc03b('0x25')](members[_0x2e311c],{'data1':members[_0x2e311c][_0xc03b('0x28')]||_0x61d710[_0xc03b('0x29')],'data2':members[_0x2e311c][_0xc03b('0x2a')]||_0x61d710['source'],'data3':members[_0x2e311c][_0xc03b('0x2c')]||_0x61d710['destination'],'uniqueid':members[_0x2e311c][_0xc03b('0x5')]||_0x61d710[_0xc03b('0x5')]});utils[_0xc03b('0x15')](util['format'](_0xc03b('0x2e'),_0x61d710[_0xc03b('0x5')],members[_0x2e311c][_0xc03b('0x28')],members[_0x2e311c][_0xc03b('0x2a')],members[_0x2e311c][_0xc03b('0x2c')]));if(members[_0x2e311c][_0xc03b('0x20')]){writeDB(members[_0x2e311c]);}}}}catch(_0x12d426){utils[_0xc03b('0x26')](util['format'](_0xc03b('0x30'),_0x61d710[_0xc03b('0x5')]),_0x12d426);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 5c69fa0..14d21ff 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 _0x2a37=['holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','isNil','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','accountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfertype','BLIND','transfereeuniqueid','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname'];(function(_0x3765ac,_0x2c52c3){var _0x17d676=function(_0x4e9bd4){while(--_0x4e9bd4){_0x3765ac['push'](_0x3765ac['shift']());}};_0x17d676(++_0x2c52c3);}(_0x2a37,0x145));var _0x72a3=function(_0x1be6c3,_0x1f4397){_0x1be6c3=_0x1be6c3-0x0;var _0x2b9078=_0x2a37[_0x1be6c3];return _0x2b9078;};'use strict';var _=require(_0x72a3('0x0'));var util=require(_0x72a3('0x1'));var utils=require(_0x72a3('0x2'));var queues={};function writeDB(_0x5b6c4a){utils[_0x72a3('0x3')](util[_0x72a3('0x4')](_0x72a3('0x5'),_0x5b6c4a[_0x72a3('0x6')],_0x5b6c4a[_0x72a3('0x7')],_0x5b6c4a[_0x72a3('0x8')],_0x5b6c4a[_0x72a3('0x9')],_0x5b6c4a[_0x72a3('0xa')],_0x5b6c4a['accountcode'],_0x5b6c4a[_0x72a3('0xb')]));if(_0x5b6c4a[_0x72a3('0x8')]){utils[_0x72a3('0xc')](_0x5b6c4a[_0x72a3('0x8')])['then'](function(_0x57a236){if(_0x57a236){_0x5b6c4a[_0x72a3('0xd')]=_0x57a236[_0x72a3('0xd')];}utils[_0x72a3('0xe')](_0x72a3('0xf'),_0x5b6c4a);});}else{utils[_0x72a3('0xe')]('CreateVoiceQueueReport',_0x5b6c4a);}if(_0x5b6c4a[_0x72a3('0x10')]){delete queues[_0x5b6c4a[_0x72a3('0x10')]];}else{delete queues[_0x5b6c4a[_0x72a3('0x6')]];}}exports[_0x72a3('0x11')]=function(_0x5150d5){try{utils[_0x72a3('0x12')](util[_0x72a3('0x4')](_0x72a3('0x13'),_0x5150d5[_0x72a3('0x6')]),_0x5150d5);utils[_0x72a3('0x3')](util[_0x72a3('0x4')](_0x72a3('0x14'),_0x5150d5['uniqueid'],_0x5150d5[_0x72a3('0x8')],_0x5150d5['position']));queues[_0x5150d5[_0x72a3('0x6')]]=_[_0x72a3('0x15')](_0x5150d5,{'originalposition':_0x5150d5[_0x72a3('0x16')],'queuecallerjoinAt':utils[_0x72a3('0x17')](),'mohtime':0x0});}catch(_0x487b0e){utils[_0x72a3('0x18')](util[_0x72a3('0x4')]('[%s][queues][queuecallerjoin]',_0x5150d5[_0x72a3('0x6')]),_0x487b0e);}};exports['hangup']=function(_0x2b7b3a){try{if(!_['isNil'](queues[_0x2b7b3a[_0x72a3('0x6')]])){utils[_0x72a3('0x12')](util[_0x72a3('0x4')]('[%s][queues][hangup]',_0x2b7b3a[_0x72a3('0x6')]),_0x2b7b3a);if(queues[_0x2b7b3a[_0x72a3('0x6')]][_0x72a3('0x19')]){if(!queues[_0x2b7b3a['uniqueid']]['queuecallerabandon']&&!queues[_0x2b7b3a[_0x72a3('0x6')]][_0x72a3('0x1a')]){queues[_0x2b7b3a[_0x72a3('0x6')]][_0x72a3('0x1b')]=!![];queues[_0x2b7b3a[_0x72a3('0x6')]][_0x72a3('0x1c')]=utils[_0x72a3('0x17')]();queues[_0x2b7b3a['uniqueid']][_0x72a3('0xb')]=_0x72a3('0x1d');}utils[_0x72a3('0x3')](util[_0x72a3('0x4')](_0x72a3('0x1e'),_0x2b7b3a['uniqueid'],queues[_0x2b7b3a['uniqueid']]['name'],queues[_0x2b7b3a['uniqueid']][_0x72a3('0xb')]));writeDB(queues[_0x2b7b3a[_0x72a3('0x6')]]);}else if(queues[_0x2b7b3a[_0x72a3('0x6')]][_0x72a3('0x10')]){utils[_0x72a3('0x3')](util['format'](_0x72a3('0x1f'),_0x2b7b3a[_0x72a3('0x6')],queues[_0x2b7b3a[_0x72a3('0x6')]][_0x72a3('0x20')],queues[_0x2b7b3a['uniqueid']][_0x72a3('0x10')]));queues[queues[_0x2b7b3a[_0x72a3('0x6')]][_0x72a3('0x10')]]=queues[_0x2b7b3a[_0x72a3('0x6')]];queues[queues[_0x2b7b3a['uniqueid']]['transfereduniqueid']][_0x72a3('0x21')]=0x2;delete queues[_0x2b7b3a[_0x72a3('0x6')]];}}}catch(_0x288954){utils[_0x72a3('0x18')](util['format'](_0x72a3('0x22'),_0x2b7b3a[_0x72a3('0x6')]),_0x288954);}};exports[_0x72a3('0x23')]=function(_0x5989f8){try{utils['debug'](util[_0x72a3('0x4')](_0x72a3('0x24'),_0x5989f8[_0x72a3('0x6')]),_0x5989f8);if(!_[_0x72a3('0x25')](_0x5989f8['variable']['queuestatus'])&&_0x5989f8[_0x72a3('0x26')][_0x72a3('0x27')]()!==_0x72a3('0x28')){if(!_[_0x72a3('0x25')](queues[_0x5989f8[_0x72a3('0x6')]])){queues[_0x5989f8['uniqueid']][_0x72a3('0x29')]=![];queues[_0x5989f8[_0x72a3('0x6')]][_0x72a3('0x2a')]=null;queues[_0x5989f8[_0x72a3('0x6')]][_0x72a3('0x1a')]=!![];queues[_0x5989f8[_0x72a3('0x6')]][_0x72a3('0x2b')]=utils[_0x72a3('0x17')]();queues[_0x5989f8[_0x72a3('0x6')]]['queuecallerexitreason']=_0x5989f8['value'][_0x72a3('0x27')]();utils[_0x72a3('0x3')](util[_0x72a3('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x5989f8[_0x72a3('0x6')],queues[_0x5989f8['uniqueid']][_0x72a3('0x20')],_0x5989f8[_0x72a3('0x26')],queues[_0x5989f8[_0x72a3('0x6')]][_0x72a3('0xb')]));writeDB(queues[_0x5989f8[_0x72a3('0x6')]]);}}else if(!_['isNil'](_0x5989f8[_0x72a3('0x2c')][_0x72a3('0x2d')])){if(!_[_0x72a3('0x25')](queues[_0x5989f8[_0x72a3('0x6')]])&&!queues[_0x5989f8['uniqueid']][_0x72a3('0x29')]){queues[_0x5989f8[_0x72a3('0x6')]]['queuecallerabandon']=![];queues[_0x5989f8[_0x72a3('0x6')]][_0x72a3('0x2a')]=null;queues[_0x5989f8[_0x72a3('0x6')]][_0x72a3('0x1a')]=!![];queues[_0x5989f8[_0x72a3('0x6')]][_0x72a3('0x2b')]=utils[_0x72a3('0x17')]();queues[_0x5989f8['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util['format'](_0x72a3('0x2e'),_0x5989f8[_0x72a3('0x6')],queues[_0x5989f8['uniqueid']][_0x72a3('0x20')],_0x5989f8[_0x72a3('0x26')],queues[_0x5989f8[_0x72a3('0x6')]]['queuecallerexitreason']));}}}catch(_0x5dcb10){utils[_0x72a3('0x18')](util[_0x72a3('0x4')](_0x72a3('0x24'),_0x5989f8['uniqueid']),_0x5dcb10);}};exports['queuecallerabandon']=function(_0x2af440){try{if(!_[_0x72a3('0x25')](queues[_0x2af440[_0x72a3('0x6')]])){utils[_0x72a3('0x12')](util[_0x72a3('0x4')](_0x72a3('0x2f'),_0x2af440[_0x72a3('0x6')]),_0x2af440);queues[_0x2af440[_0x72a3('0x6')]][_0x72a3('0x1a')]=![];queues[_0x2af440[_0x72a3('0x6')]][_0x72a3('0x2b')]=null;queues[_0x2af440[_0x72a3('0x6')]][_0x72a3('0x29')]=!![];queues[_0x2af440[_0x72a3('0x6')]][_0x72a3('0x2a')]=utils['now']();queues[_0x2af440[_0x72a3('0x6')]][_0x72a3('0xb')]=_0x72a3('0x30');utils[_0x72a3('0x3')](util[_0x72a3('0x4')](_0x72a3('0x31'),_0x2af440[_0x72a3('0x6')],queues[_0x2af440[_0x72a3('0x6')]]['name'],queues[_0x2af440[_0x72a3('0x6')]][_0x72a3('0xb')]));}}catch(_0x4a2916){utils[_0x72a3('0x18')](util[_0x72a3('0x4')]('[%s][queues][queuecallerabandon]',_0x2af440[_0x72a3('0x6')]),_0x4a2916);}};exports['queuecallerleave']=function(_0x121d7c){try{if(!_['isNil'](queues[_0x121d7c['uniqueid']])){utils['debug'](util['format'](_0x72a3('0x32'),_0x121d7c[_0x72a3('0x6')]),_0x121d7c);utils[_0x72a3('0x3')](util[_0x72a3('0x4')](_0x72a3('0x33'),_0x121d7c[_0x72a3('0x6')],queues[_0x121d7c['uniqueid']][_0x72a3('0x20')],_0x121d7c[_0x72a3('0x34')],_0x121d7c['connectedlinename']));queues[_0x121d7c[_0x72a3('0x6')]]['queuecallerleave']=!![];queues[_0x121d7c[_0x72a3('0x6')]][_0x72a3('0x19')]=utils[_0x72a3('0x17')]();queues[_0x121d7c[_0x72a3('0x6')]]['holdtime']=utils[_0x72a3('0x35')](queues[_0x121d7c[_0x72a3('0x6')]]['queuecallerleaveAt'],queues[_0x121d7c['uniqueid']][_0x72a3('0x36')]);queues[_0x121d7c['uniqueid']]['position']=_0x121d7c[_0x72a3('0x16')];queues[_0x121d7c['uniqueid']][_0x72a3('0x37')]=_0x121d7c[_0x72a3('0x37')];queues[_0x121d7c[_0x72a3('0x6')]][_0x72a3('0x34')]=_0x121d7c[_0x72a3('0x34')];queues[_0x121d7c[_0x72a3('0x6')]][_0x72a3('0x38')]=_0x121d7c[_0x72a3('0x38')];}}catch(_0x19bcff){utils[_0x72a3('0x18')](util[_0x72a3('0x4')](_0x72a3('0x32'),_0x121d7c[_0x72a3('0x6')]),_0x19bcff);}};exports[_0x72a3('0x39')]=function(_0x78154c){try{if(!_[_0x72a3('0x25')](queues[_0x78154c['uniqueid']])){utils[_0x72a3('0x12')](util['format'](_0x72a3('0x3a'),_0x78154c[_0x72a3('0x6')]),_0x78154c);utils[_0x72a3('0x3')](util['format'](_0x72a3('0x3b'),_0x78154c[_0x72a3('0x6')],queues[_0x78154c[_0x72a3('0x6')]][_0x72a3('0x20')],_0x78154c[_0x72a3('0x3c')],_0x78154c['destaccountcode']));queues[_0x78154c[_0x72a3('0x6')]][_0x72a3('0x29')]=![];queues[_0x78154c[_0x72a3('0x6')]][_0x72a3('0x29')]=![];queues[_0x78154c['uniqueid']]['queuecallerabandonAt']=null;queues[_0x78154c[_0x72a3('0x6')]][_0x72a3('0x1a')]=![];queues[_0x78154c[_0x72a3('0x6')]]['queuecallerexitreason']=null;queues[_0x78154c[_0x72a3('0x6')]][_0x72a3('0x2b')]=null;queues[_0x78154c[_0x72a3('0x6')]]['assigned']=!![];queues[_0x78154c[_0x72a3('0x6')]][_0x72a3('0x3d')]=_0x78154c['destaccountcode'];queues[_0x78154c[_0x72a3('0x6')]][_0x72a3('0x9')]=_0x78154c[_0x72a3('0x3c')];}}catch(_0x515050){utils['error'](util[_0x72a3('0x4')](_0x72a3('0x3a'),_0x78154c[_0x72a3('0x6')]),_0x515050);}};exports[_0x72a3('0x3e')]=function(_0x361a04){try{if(!_['isNil'](queues[_0x361a04[_0x72a3('0x6')]])){if(queues[_0x361a04[_0x72a3('0x6')]][_0x72a3('0x19')]){utils[_0x72a3('0x12')](util[_0x72a3('0x4')](_0x72a3('0x3f'),_0x361a04[_0x72a3('0x6')]),_0x361a04);queues[_0x361a04[_0x72a3('0x6')]][_0x72a3('0x29')]=![];queues[_0x361a04[_0x72a3('0x6')]][_0x72a3('0x29')]=![];queues[_0x361a04['uniqueid']][_0x72a3('0x2a')]=null;queues[_0x361a04[_0x72a3('0x6')]][_0x72a3('0x1a')]=![];queues[_0x361a04['uniqueid']][_0x72a3('0x2b')]=null;queues[_0x361a04[_0x72a3('0x6')]][_0x72a3('0x40')]=!![];queues[_0x361a04[_0x72a3('0x6')]][_0x72a3('0x9')]=_0x361a04[_0x72a3('0x3c')];queues[_0x361a04[_0x72a3('0x6')]]['queuecallercomplete']=!![];queues[_0x361a04[_0x72a3('0x6')]][_0x72a3('0x1c')]=utils['now']();if(_0x361a04[_0x72a3('0x41')]==_0x72a3('0x42')){if(!queues[_0x361a04['uniqueid']]['transfer']){queues[_0x361a04[_0x72a3('0x6')]][_0x72a3('0xb')]='TRANSFER';}}else{queues[_0x361a04[_0x72a3('0x6')]][_0x72a3('0xb')]=_0x72a3('0x43')+_0x361a04[_0x72a3('0x41')][_0x72a3('0x27')]();}utils['info'](util[_0x72a3('0x4')](_0x72a3('0x44'),_0x361a04[_0x72a3('0x6')],queues[_0x361a04[_0x72a3('0x6')]]['name'],_0x361a04['membername'],queues[_0x361a04['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x361a04[_0x72a3('0x6')]]);}}}catch(_0x564e20){utils[_0x72a3('0x18')](util[_0x72a3('0x4')]('[%s][queues][agentcomplete]',_0x361a04['uniqueid']),_0x564e20);}};exports[_0x72a3('0x45')]=function(_0x4a0b8a){try{if(!_[_0x72a3('0x25')](queues[_0x4a0b8a['transfereeuniqueid']])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x4a0b8a['uniqueid']),_0x4a0b8a);queues[_0x4a0b8a['transfereeuniqueid']][_0x72a3('0x42')]=!![];queues[_0x4a0b8a['transfereeuniqueid']][_0x72a3('0x46')]=_0x72a3('0x47');queues[_0x4a0b8a[_0x72a3('0x48')]][_0x72a3('0x49')]=_0x4a0b8a[_0x72a3('0x4a')];queues[_0x4a0b8a['transfereeuniqueid']][_0x72a3('0x4b')]=_0x4a0b8a['transfereeuniqueid'];queues[_0x4a0b8a[_0x72a3('0x48')]][_0x72a3('0xb')]='BLINDTRANSFER';utils['info'](util[_0x72a3('0x4')](_0x72a3('0x4c'),_0x4a0b8a['uniqueid'],queues[_0x4a0b8a[_0x72a3('0x48')]][_0x72a3('0x20')],_0x4a0b8a[_0x72a3('0x48')],_0x4a0b8a['extension']));}}catch(_0x225b67){utils[_0x72a3('0x18')](util[_0x72a3('0x4')](_0x72a3('0x4d'),_0x4a0b8a[_0x72a3('0x6')]),_0x225b67);}};exports[_0x72a3('0x4e')]=function(_0x158d16){try{utils['debug'](util[_0x72a3('0x4')](_0x72a3('0x4f'),_0x158d16['origtransfereruniqueid']),_0x158d16);if(_0x158d16[_0x72a3('0x50')]==_0x158d16[_0x72a3('0x51')]){if(!_['isNil'](queues[_0x158d16['secondtransfererlinkedid']])){utils[_0x72a3('0x3')](util[_0x72a3('0x4')](_0x72a3('0x52'),_0x158d16[_0x72a3('0x50')],queues[_0x158d16[_0x72a3('0x53')]]['name'],_0x158d16[_0x72a3('0x54')]));queues[_0x158d16['secondtransfererlinkedid']][_0x72a3('0x42')]=!![];queues[_0x158d16[_0x72a3('0x53')]][_0x72a3('0x46')]=_0x72a3('0x55');queues[_0x158d16[_0x72a3('0x53')]]['transferexten']=_0x158d16[_0x72a3('0x54')];queues[_0x158d16['secondtransfererlinkedid']][_0x72a3('0x4b')]=_0x158d16[_0x72a3('0x50')];queues[_0x158d16[_0x72a3('0x53')]][_0x72a3('0xb')]=_0x72a3('0x56');}if(!_[_0x72a3('0x25')](queues[_0x158d16[_0x72a3('0x51')]])){if(_0x158d16[_0x72a3('0x57')]&&queues[_0x158d16['transfereelinkedid']]){queues[_0x158d16[_0x72a3('0x57')]][_0x72a3('0x21')]=0x1;queues[_0x158d16[_0x72a3('0x48')]]=_[_0x72a3('0x58')](queues[_0x158d16[_0x72a3('0x57')]]);queues[_0x158d16[_0x72a3('0x48')]]['transfereduniqueid']=_0x158d16[_0x72a3('0x59')];queues[_0x158d16['transfereeuniqueid']][_0x72a3('0x21')]=0x2;queues[_0x158d16[_0x72a3('0x48')]][_0x72a3('0xa')]=queues[_0x158d16[_0x72a3('0x53')]][_0x72a3('0xa')];queues[_0x158d16[_0x72a3('0x48')]][_0x72a3('0x5a')]=queues[_0x158d16['secondtransfererlinkedid']][_0x72a3('0x5a')];queues[_0x158d16[_0x72a3('0x48')]]['queuecallerjoinAt']=utils[_0x72a3('0x17')]();queues[_0x158d16[_0x72a3('0x48')]][_0x72a3('0x19')]=utils[_0x72a3('0x17')]();queues[_0x158d16[_0x72a3('0x48')]][_0x72a3('0x5b')]=0x0;queues[_0x158d16[_0x72a3('0x48')]][_0x72a3('0x5c')]=0x0;utils[_0x72a3('0x3')](util[_0x72a3('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x158d16[_0x72a3('0x50')],queues[_0x158d16[_0x72a3('0x48')]][_0x72a3('0x20')],queues[_0x158d16[_0x72a3('0x48')]]['calleridnum'],queues[_0x158d16[_0x72a3('0x48')]][_0x72a3('0x5a')]));}else{utils[_0x72a3('0x3')](util[_0x72a3('0x4')](_0x72a3('0x5d'),_0x158d16['origtransfereruniqueid'],queues[_0x158d16['origtransfererlinkedid']][_0x72a3('0x20')],_0x158d16['secondtransfererlinkedid']));queues[_0x158d16[_0x72a3('0x51')]][_0x72a3('0x10')]=_0x158d16[_0x72a3('0x53')];}}}else if(_0x158d16[_0x72a3('0x5e')]==_0x158d16[_0x72a3('0x53')]){if(!_[_0x72a3('0x25')](queues[_0x158d16['origtransfererlinkedid']])){utils[_0x72a3('0x3')](util[_0x72a3('0x4')](_0x72a3('0x5f'),_0x158d16[_0x72a3('0x50')],queues[_0x158d16['origtransfererlinkedid']]['name'],_0x158d16[_0x72a3('0x5e')],_0x158d16['secondtransfererexten']));queues[_0x158d16[_0x72a3('0x51')]][_0x72a3('0x42')]=!![];queues[_0x158d16[_0x72a3('0x51')]][_0x72a3('0x46')]=_0x72a3('0x55');queues[_0x158d16[_0x72a3('0x51')]]['transferexten']=_0x158d16[_0x72a3('0x60')];queues[_0x158d16['origtransfererlinkedid']]['transferuniqueid']=_0x158d16[_0x72a3('0x5e')];queues[_0x158d16[_0x72a3('0x51')]][_0x72a3('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x72a3('0x25')](queues[_0x158d16['secondtransfererlinkedid']])){if(_0x158d16[_0x72a3('0x61')]&&queues[_0x158d16[_0x72a3('0x61')]]){queues[_0x158d16[_0x72a3('0x61')]][_0x72a3('0x21')]=0x1;queues[_0x158d16[_0x72a3('0x59')]]=_['clone'](queues[_0x158d16[_0x72a3('0x61')]]);queues[_0x158d16['transfertargetuniqueid']][_0x72a3('0x10')]=_0x158d16['transfertargetuniqueid'];queues[_0x158d16['transfertargetuniqueid']][_0x72a3('0x21')]=0x2;queues[_0x158d16[_0x72a3('0x59')]][_0x72a3('0xa')]=queues[_0x158d16[_0x72a3('0x51')]]['calleridnum'];queues[_0x158d16[_0x72a3('0x59')]][_0x72a3('0x5a')]=queues[_0x158d16[_0x72a3('0x51')]]['calleridname'];queues[_0x158d16[_0x72a3('0x59')]][_0x72a3('0x36')]=utils[_0x72a3('0x17')]();queues[_0x158d16[_0x72a3('0x59')]][_0x72a3('0x19')]=utils['now']();queues[_0x158d16[_0x72a3('0x59')]]['holdtime']=0x0;queues[_0x158d16[_0x72a3('0x59')]][_0x72a3('0x5c')]=0x0;utils[_0x72a3('0x3')](util['format'](_0x72a3('0x62'),_0x158d16[_0x72a3('0x50')],queues[_0x158d16[_0x72a3('0x59')]][_0x72a3('0x20')],queues[_0x158d16[_0x72a3('0x59')]][_0x72a3('0x10')],queues[_0x158d16['transfertargetuniqueid']]['calleridnum'],queues[_0x158d16[_0x72a3('0x59')]]['calleridname']));}else{utils[_0x72a3('0x3')](util[_0x72a3('0x4')](_0x72a3('0x5d'),_0x158d16[_0x72a3('0x50')],queues[_0x158d16[_0x72a3('0x53')]][_0x72a3('0x20')],_0x158d16[_0x72a3('0x51')]));queues[_0x158d16[_0x72a3('0x53')]][_0x72a3('0x10')]=_0x158d16['origtransfererlinkedid'];}}}}catch(_0x3eed8c){utils[_0x72a3('0x18')](util[_0x72a3('0x4')](_0x72a3('0x4f'),_0x158d16[_0x72a3('0x50')]),_0x3eed8c);}};exports['musiconholdstart']=function(_0x22db7a){try{if(!_[_0x72a3('0x25')](queues[_0x22db7a[_0x72a3('0x6')]])){utils[_0x72a3('0x12')](util[_0x72a3('0x4')]('[%s][queues][musiconholdstart]',_0x22db7a[_0x72a3('0x6')]),_0x22db7a);queues[_0x22db7a['uniqueid']][_0x72a3('0x63')]=utils[_0x72a3('0x17')]();utils[_0x72a3('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x22db7a[_0x72a3('0x6')],queues[_0x22db7a[_0x72a3('0x6')]]['name'],queues[_0x22db7a['uniqueid']]['musiconholdstartAt']));}}catch(_0x29c803){utils[_0x72a3('0x18')](util[_0x72a3('0x4')](_0x72a3('0x64'),_0x22db7a['uniqueid']),_0x29c803);}};exports[_0x72a3('0x65')]=function(_0x2754a6){try{if(!_[_0x72a3('0x25')](queues[_0x2754a6[_0x72a3('0x6')]])){if(!_['isNil'](queues[_0x2754a6[_0x72a3('0x6')]]['musiconholdstartAt'])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x2754a6['uniqueid']),_0x2754a6);queues[_0x2754a6['uniqueid']][_0x72a3('0x5c')]+=utils[_0x72a3('0x35')](utils[_0x72a3('0x17')](),queues[_0x2754a6[_0x72a3('0x6')]][_0x72a3('0x63')]);utils[_0x72a3('0x3')](util['format'](_0x72a3('0x66'),_0x2754a6['uniqueid'],queues[_0x2754a6[_0x72a3('0x6')]]['name'],queues[_0x2754a6[_0x72a3('0x6')]][_0x72a3('0x5c')]));delete queues[_0x2754a6['uniqueid']]['musiconholdstartAt'];}}}catch(_0x226301){utils['error'](util[_0x72a3('0x4')](_0x72a3('0x67'),_0x2754a6[_0x72a3('0x6')]),_0x226301);}}; \ No newline at end of file +var _0x3210=['[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','transferexten','extension','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','format','hangup','isNil','debug','queuecallerexit','queuecallercomplete','now','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset'];(function(_0x274063,_0x373368){var _0x261d25=function(_0x486b7c){while(--_0x486b7c){_0x274063['push'](_0x274063['shift']());}};_0x261d25(++_0x373368);}(_0x3210,0x1ce));var _0x0321=function(_0x1e3e9f,_0x5e5658){_0x1e3e9f=_0x1e3e9f-0x0;var _0x3bf4aa=_0x3210[_0x1e3e9f];return _0x3bf4aa;};'use strict';var _=require('lodash');var util=require(_0x0321('0x0'));var utils=require(_0x0321('0x1'));var queues={};function writeDB(_0x5259e7){utils['info'](util['format'](_0x0321('0x2'),_0x5259e7[_0x0321('0x3')],_0x5259e7[_0x0321('0x4')],_0x5259e7['queue'],_0x5259e7[_0x0321('0x5')],_0x5259e7['calleridnum'],_0x5259e7[_0x0321('0x6')],_0x5259e7[_0x0321('0x7')]));if(_0x5259e7['queue']){utils[_0x0321('0x8')](_0x5259e7[_0x0321('0x9')])[_0x0321('0xa')](function(_0x9f15c1){if(_0x9f15c1){_0x5259e7[_0x0321('0xb')]=_0x9f15c1[_0x0321('0xb')];}utils[_0x0321('0xc')](_0x0321('0xd'),_0x5259e7);});}else{utils['request'](_0x0321('0xd'),_0x5259e7);}if(_0x5259e7[_0x0321('0xe')]){delete queues[_0x5259e7['transfereduniqueid']];}else{delete queues[_0x5259e7[_0x0321('0x3')]];}}exports[_0x0321('0xf')]=function(_0x3d05c2){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x3d05c2[_0x0321('0x3')]),_0x3d05c2);utils['info'](util['format'](_0x0321('0x10'),_0x3d05c2['uniqueid'],_0x3d05c2[_0x0321('0x9')],_0x3d05c2[_0x0321('0x11')]));queues[_0x3d05c2['uniqueid']]=_[_0x0321('0x12')](_0x3d05c2,{'originalposition':_0x3d05c2[_0x0321('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3a64bc){utils[_0x0321('0x13')](util[_0x0321('0x14')]('[%s][queues][queuecallerjoin]',_0x3d05c2[_0x0321('0x3')]),_0x3a64bc);}};exports[_0x0321('0x15')]=function(_0x521a29){try{if(!_[_0x0321('0x16')](queues[_0x521a29[_0x0321('0x3')]])){utils[_0x0321('0x17')](util['format']('[%s][queues][hangup]',_0x521a29[_0x0321('0x3')]),_0x521a29);if(queues[_0x521a29[_0x0321('0x3')]]['queuecallerleaveAt']){if(!queues[_0x521a29['uniqueid']]['queuecallerabandon']&&!queues[_0x521a29[_0x0321('0x3')]][_0x0321('0x18')]){queues[_0x521a29[_0x0321('0x3')]][_0x0321('0x19')]=!![];queues[_0x521a29['uniqueid']]['queuecallercompleteAt']=utils[_0x0321('0x1a')]();queues[_0x521a29[_0x0321('0x3')]][_0x0321('0x7')]='COMPLETEDBYAGENT';}utils[_0x0321('0x1b')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x521a29['uniqueid'],queues[_0x521a29[_0x0321('0x3')]]['name'],queues[_0x521a29['uniqueid']][_0x0321('0x7')]));writeDB(queues[_0x521a29[_0x0321('0x3')]]);}else if(queues[_0x521a29[_0x0321('0x3')]][_0x0321('0xe')]){utils[_0x0321('0x1b')](util[_0x0321('0x14')](_0x0321('0x1c'),_0x521a29[_0x0321('0x3')],queues[_0x521a29[_0x0321('0x3')]][_0x0321('0x1d')],queues[_0x521a29[_0x0321('0x3')]][_0x0321('0xe')]));queues[queues[_0x521a29['uniqueid']][_0x0321('0xe')]]=queues[_0x521a29['uniqueid']];queues[queues[_0x521a29[_0x0321('0x3')]][_0x0321('0xe')]][_0x0321('0x1e')]=0x2;delete queues[_0x521a29[_0x0321('0x3')]];}}}catch(_0xbd764a){utils[_0x0321('0x13')](util['format'](_0x0321('0x1f'),_0x521a29[_0x0321('0x3')]),_0xbd764a);}};exports[_0x0321('0x20')]=function(_0x417db2){try{utils[_0x0321('0x17')](util[_0x0321('0x14')](_0x0321('0x21'),_0x417db2['uniqueid']),_0x417db2);if(!_[_0x0321('0x16')](_0x417db2['variable'][_0x0321('0x22')])&&_0x417db2[_0x0321('0x23')][_0x0321('0x24')]()!==_0x0321('0x25')){if(!_['isNil'](queues[_0x417db2['uniqueid']])){queues[_0x417db2[_0x0321('0x3')]]['queuecallerabandon']=![];queues[_0x417db2['uniqueid']][_0x0321('0x26')]=null;queues[_0x417db2[_0x0321('0x3')]][_0x0321('0x18')]=!![];queues[_0x417db2[_0x0321('0x3')]][_0x0321('0x27')]=utils[_0x0321('0x1a')]();queues[_0x417db2[_0x0321('0x3')]][_0x0321('0x7')]=_0x417db2[_0x0321('0x23')][_0x0321('0x24')]();utils[_0x0321('0x1b')](util[_0x0321('0x14')](_0x0321('0x28'),_0x417db2['uniqueid'],queues[_0x417db2[_0x0321('0x3')]][_0x0321('0x1d')],_0x417db2[_0x0321('0x23')],queues[_0x417db2[_0x0321('0x3')]][_0x0321('0x7')]));writeDB(queues[_0x417db2['uniqueid']]);}}else if(!_[_0x0321('0x16')](_0x417db2[_0x0321('0x29')]['queueposition'])){if(!_[_0x0321('0x16')](queues[_0x417db2[_0x0321('0x3')]])&&!queues[_0x417db2['uniqueid']][_0x0321('0x2a')]){queues[_0x417db2[_0x0321('0x3')]][_0x0321('0x2a')]=![];queues[_0x417db2['uniqueid']]['queuecallerabandonAt']=null;queues[_0x417db2[_0x0321('0x3')]]['queuecallerexit']=!![];queues[_0x417db2[_0x0321('0x3')]]['queuecallerexitAt']=utils[_0x0321('0x1a')]();queues[_0x417db2[_0x0321('0x3')]][_0x0321('0x7')]=_0x0321('0x2b');utils[_0x0321('0x1b')](util[_0x0321('0x14')](_0x0321('0x2c'),_0x417db2['uniqueid'],queues[_0x417db2[_0x0321('0x3')]][_0x0321('0x1d')],_0x417db2['value'],queues[_0x417db2[_0x0321('0x3')]][_0x0321('0x7')]));}}}catch(_0x5bd36a){utils['error'](util['format']('[%s][queues][varset]',_0x417db2['uniqueid']),_0x5bd36a);}};exports['queuecallerabandon']=function(_0x43abfd){try{if(!_[_0x0321('0x16')](queues[_0x43abfd[_0x0321('0x3')]])){utils[_0x0321('0x17')](util[_0x0321('0x14')](_0x0321('0x2d'),_0x43abfd['uniqueid']),_0x43abfd);queues[_0x43abfd['uniqueid']][_0x0321('0x18')]=![];queues[_0x43abfd['uniqueid']]['queuecallerexitAt']=null;queues[_0x43abfd[_0x0321('0x3')]]['queuecallerabandon']=!![];queues[_0x43abfd['uniqueid']][_0x0321('0x26')]=utils[_0x0321('0x1a')]();queues[_0x43abfd[_0x0321('0x3')]][_0x0321('0x7')]=_0x0321('0x2e');utils[_0x0321('0x1b')](util[_0x0321('0x14')](_0x0321('0x2f'),_0x43abfd[_0x0321('0x3')],queues[_0x43abfd[_0x0321('0x3')]][_0x0321('0x1d')],queues[_0x43abfd[_0x0321('0x3')]][_0x0321('0x7')]));}}catch(_0x2b0079){utils[_0x0321('0x13')](util[_0x0321('0x14')](_0x0321('0x2d'),_0x43abfd[_0x0321('0x3')]),_0x2b0079);}};exports[_0x0321('0x30')]=function(_0xbcefe6){try{if(!_[_0x0321('0x16')](queues[_0xbcefe6[_0x0321('0x3')]])){utils[_0x0321('0x17')](util[_0x0321('0x14')](_0x0321('0x31'),_0xbcefe6[_0x0321('0x3')]),_0xbcefe6);utils[_0x0321('0x1b')](util[_0x0321('0x14')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xbcefe6[_0x0321('0x3')],queues[_0xbcefe6[_0x0321('0x3')]][_0x0321('0x1d')],_0xbcefe6['connectedlinenum'],_0xbcefe6[_0x0321('0x32')]));queues[_0xbcefe6['uniqueid']][_0x0321('0x30')]=!![];queues[_0xbcefe6[_0x0321('0x3')]][_0x0321('0x33')]=utils[_0x0321('0x1a')]();queues[_0xbcefe6['uniqueid']]['holdtime']=utils[_0x0321('0x34')](queues[_0xbcefe6[_0x0321('0x3')]][_0x0321('0x33')],queues[_0xbcefe6[_0x0321('0x3')]][_0x0321('0x35')]);queues[_0xbcefe6[_0x0321('0x3')]]['position']=_0xbcefe6['position'];queues[_0xbcefe6[_0x0321('0x3')]][_0x0321('0x36')]=_0xbcefe6['count'];queues[_0xbcefe6['uniqueid']][_0x0321('0x37')]=_0xbcefe6['connectedlinenum'];queues[_0xbcefe6[_0x0321('0x3')]][_0x0321('0x32')]=_0xbcefe6[_0x0321('0x32')];}}catch(_0xdc08a3){utils[_0x0321('0x13')](util['format']('[%s][queues][queuecallerleave]',_0xbcefe6[_0x0321('0x3')]),_0xdc08a3);}};exports[_0x0321('0x38')]=function(_0x3d8a4a){try{if(!_[_0x0321('0x16')](queues[_0x3d8a4a['uniqueid']])){utils['debug'](util['format'](_0x0321('0x39'),_0x3d8a4a[_0x0321('0x3')]),_0x3d8a4a);utils[_0x0321('0x1b')](util['format'](_0x0321('0x3a'),_0x3d8a4a[_0x0321('0x3')],queues[_0x3d8a4a['uniqueid']]['name'],_0x3d8a4a[_0x0321('0x3b')],_0x3d8a4a['destaccountcode']));queues[_0x3d8a4a[_0x0321('0x3')]][_0x0321('0x2a')]=![];queues[_0x3d8a4a[_0x0321('0x3')]]['queuecallerabandon']=![];queues[_0x3d8a4a[_0x0321('0x3')]]['queuecallerabandonAt']=null;queues[_0x3d8a4a[_0x0321('0x3')]][_0x0321('0x18')]=![];queues[_0x3d8a4a[_0x0321('0x3')]]['queuecallerexitreason']=null;queues[_0x3d8a4a[_0x0321('0x3')]][_0x0321('0x27')]=null;queues[_0x3d8a4a[_0x0321('0x3')]]['assigned']=!![];queues[_0x3d8a4a[_0x0321('0x3')]][_0x0321('0x6')]=_0x3d8a4a['destaccountcode'];queues[_0x3d8a4a[_0x0321('0x3')]]['lastAssignedTo']=_0x3d8a4a['membername'];}}catch(_0x4034f0){utils['error'](util[_0x0321('0x14')](_0x0321('0x39'),_0x3d8a4a[_0x0321('0x3')]),_0x4034f0);}};exports[_0x0321('0x3c')]=function(_0x26fb0f){try{if(!_[_0x0321('0x16')](queues[_0x26fb0f['uniqueid']])){if(queues[_0x26fb0f[_0x0321('0x3')]]['queuecallerleaveAt']){utils[_0x0321('0x17')](util[_0x0321('0x14')](_0x0321('0x3d'),_0x26fb0f[_0x0321('0x3')]),_0x26fb0f);queues[_0x26fb0f[_0x0321('0x3')]][_0x0321('0x2a')]=![];queues[_0x26fb0f[_0x0321('0x3')]][_0x0321('0x2a')]=![];queues[_0x26fb0f[_0x0321('0x3')]][_0x0321('0x26')]=null;queues[_0x26fb0f['uniqueid']][_0x0321('0x18')]=![];queues[_0x26fb0f[_0x0321('0x3')]][_0x0321('0x27')]=null;queues[_0x26fb0f[_0x0321('0x3')]][_0x0321('0x3e')]=!![];queues[_0x26fb0f[_0x0321('0x3')]][_0x0321('0x5')]=_0x26fb0f['membername'];queues[_0x26fb0f['uniqueid']][_0x0321('0x19')]=!![];queues[_0x26fb0f[_0x0321('0x3')]]['queuecallercompleteAt']=utils[_0x0321('0x1a')]();if(_0x26fb0f[_0x0321('0x3f')]=='transfer'){if(!queues[_0x26fb0f[_0x0321('0x3')]][_0x0321('0x40')]){queues[_0x26fb0f['uniqueid']]['queuecallerexitreason']=_0x0321('0x41');}}else{queues[_0x26fb0f[_0x0321('0x3')]]['queuecallerexitreason']='COMPLETEDBY'+_0x26fb0f[_0x0321('0x3f')][_0x0321('0x24')]();}utils['info'](util[_0x0321('0x14')](_0x0321('0x42'),_0x26fb0f[_0x0321('0x3')],queues[_0x26fb0f[_0x0321('0x3')]][_0x0321('0x1d')],_0x26fb0f[_0x0321('0x3b')],queues[_0x26fb0f[_0x0321('0x3')]][_0x0321('0x7')]));writeDB(queues[_0x26fb0f['uniqueid']]);}}}catch(_0x26ed1b){utils[_0x0321('0x13')](util[_0x0321('0x14')](_0x0321('0x3d'),_0x26fb0f[_0x0321('0x3')]),_0x26ed1b);}};exports['blindtransfer']=function(_0x429ce9){try{if(!_[_0x0321('0x16')](queues[_0x429ce9[_0x0321('0x43')]])){utils[_0x0321('0x17')](util[_0x0321('0x14')]('[%s][queues][blindtransfer]',_0x429ce9[_0x0321('0x3')]),_0x429ce9);queues[_0x429ce9[_0x0321('0x43')]][_0x0321('0x40')]=!![];queues[_0x429ce9['transfereeuniqueid']][_0x0321('0x44')]=_0x0321('0x45');queues[_0x429ce9[_0x0321('0x43')]][_0x0321('0x46')]=_0x429ce9[_0x0321('0x47')];queues[_0x429ce9[_0x0321('0x43')]]['transferuniqueid']=_0x429ce9[_0x0321('0x43')];queues[_0x429ce9[_0x0321('0x43')]][_0x0321('0x7')]='BLINDTRANSFER';utils[_0x0321('0x1b')](util[_0x0321('0x14')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x429ce9[_0x0321('0x3')],queues[_0x429ce9[_0x0321('0x43')]]['name'],_0x429ce9[_0x0321('0x43')],_0x429ce9['extension']));}}catch(_0x31580f){utils[_0x0321('0x13')](util[_0x0321('0x14')](_0x0321('0x48'),_0x429ce9[_0x0321('0x3')]),_0x31580f);}};exports[_0x0321('0x49')]=function(_0x4c7b6f){try{utils[_0x0321('0x17')](util[_0x0321('0x14')](_0x0321('0x4a'),_0x4c7b6f[_0x0321('0x4b')]),_0x4c7b6f);if(_0x4c7b6f[_0x0321('0x4b')]==_0x4c7b6f[_0x0321('0x4c')]){if(!_['isNil'](queues[_0x4c7b6f['secondtransfererlinkedid']])){utils[_0x0321('0x1b')](util[_0x0321('0x14')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4c7b6f[_0x0321('0x4b')],queues[_0x4c7b6f[_0x0321('0x4d')]][_0x0321('0x1d')],_0x4c7b6f['origtransfererexten']));queues[_0x4c7b6f['secondtransfererlinkedid']][_0x0321('0x40')]=!![];queues[_0x4c7b6f[_0x0321('0x4d')]]['transfertype']=_0x0321('0x4e');queues[_0x4c7b6f['secondtransfererlinkedid']][_0x0321('0x46')]=_0x4c7b6f[_0x0321('0x4f')];queues[_0x4c7b6f['secondtransfererlinkedid']]['transferuniqueid']=_0x4c7b6f['origtransfereruniqueid'];queues[_0x4c7b6f[_0x0321('0x4d')]][_0x0321('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x0321('0x16')](queues[_0x4c7b6f[_0x0321('0x4c')]])){if(_0x4c7b6f[_0x0321('0x50')]&&queues[_0x4c7b6f[_0x0321('0x50')]]){queues[_0x4c7b6f[_0x0321('0x50')]]['queuecallerenterreason']=0x1;queues[_0x4c7b6f['transfereeuniqueid']]=_[_0x0321('0x51')](queues[_0x4c7b6f[_0x0321('0x50')]]);queues[_0x4c7b6f[_0x0321('0x43')]]['transfereduniqueid']=_0x4c7b6f[_0x0321('0x52')];queues[_0x4c7b6f[_0x0321('0x43')]][_0x0321('0x1e')]=0x2;queues[_0x4c7b6f[_0x0321('0x43')]][_0x0321('0x53')]=queues[_0x4c7b6f[_0x0321('0x4d')]]['calleridnum'];queues[_0x4c7b6f[_0x0321('0x43')]][_0x0321('0x54')]=queues[_0x4c7b6f[_0x0321('0x4d')]][_0x0321('0x54')];queues[_0x4c7b6f[_0x0321('0x43')]][_0x0321('0x35')]=utils[_0x0321('0x1a')]();queues[_0x4c7b6f[_0x0321('0x43')]][_0x0321('0x33')]=utils[_0x0321('0x1a')]();queues[_0x4c7b6f[_0x0321('0x43')]]['holdtime']=0x0;queues[_0x4c7b6f[_0x0321('0x43')]]['mohtime']=0x0;utils[_0x0321('0x1b')](util[_0x0321('0x14')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x4c7b6f['origtransfereruniqueid'],queues[_0x4c7b6f[_0x0321('0x43')]][_0x0321('0x1d')],queues[_0x4c7b6f['transfereeuniqueid']][_0x0321('0x53')],queues[_0x4c7b6f[_0x0321('0x43')]]['calleridname']));}else{utils[_0x0321('0x1b')](util[_0x0321('0x14')](_0x0321('0x55'),_0x4c7b6f[_0x0321('0x4b')],queues[_0x4c7b6f[_0x0321('0x4c')]][_0x0321('0x1d')],_0x4c7b6f[_0x0321('0x4d')]));queues[_0x4c7b6f[_0x0321('0x4c')]][_0x0321('0xe')]=_0x4c7b6f[_0x0321('0x4d')];}}}else if(_0x4c7b6f[_0x0321('0x56')]==_0x4c7b6f['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x4c7b6f[_0x0321('0x4c')]])){utils[_0x0321('0x1b')](util[_0x0321('0x14')](_0x0321('0x57'),_0x4c7b6f[_0x0321('0x4b')],queues[_0x4c7b6f['origtransfererlinkedid']][_0x0321('0x1d')],_0x4c7b6f[_0x0321('0x56')],_0x4c7b6f[_0x0321('0x58')]));queues[_0x4c7b6f[_0x0321('0x4c')]]['transfer']=!![];queues[_0x4c7b6f[_0x0321('0x4c')]][_0x0321('0x44')]=_0x0321('0x4e');queues[_0x4c7b6f[_0x0321('0x4c')]][_0x0321('0x46')]=_0x4c7b6f[_0x0321('0x58')];queues[_0x4c7b6f['origtransfererlinkedid']]['transferuniqueid']=_0x4c7b6f['secondtransfereruniqueid'];queues[_0x4c7b6f[_0x0321('0x4c')]][_0x0321('0x7')]=_0x0321('0x59');}if(!_[_0x0321('0x16')](queues[_0x4c7b6f['secondtransfererlinkedid']])){if(_0x4c7b6f[_0x0321('0x5a')]&&queues[_0x4c7b6f[_0x0321('0x5a')]]){queues[_0x4c7b6f['transfertargetlinkedid']][_0x0321('0x1e')]=0x1;queues[_0x4c7b6f[_0x0321('0x52')]]=_[_0x0321('0x51')](queues[_0x4c7b6f[_0x0321('0x5a')]]);queues[_0x4c7b6f[_0x0321('0x52')]]['transfereduniqueid']=_0x4c7b6f[_0x0321('0x52')];queues[_0x4c7b6f['transfertargetuniqueid']][_0x0321('0x1e')]=0x2;queues[_0x4c7b6f[_0x0321('0x52')]][_0x0321('0x53')]=queues[_0x4c7b6f['origtransfererlinkedid']][_0x0321('0x53')];queues[_0x4c7b6f[_0x0321('0x52')]]['calleridname']=queues[_0x4c7b6f[_0x0321('0x4c')]][_0x0321('0x54')];queues[_0x4c7b6f['transfertargetuniqueid']][_0x0321('0x35')]=utils[_0x0321('0x1a')]();queues[_0x4c7b6f[_0x0321('0x52')]][_0x0321('0x33')]=utils[_0x0321('0x1a')]();queues[_0x4c7b6f[_0x0321('0x52')]][_0x0321('0x5b')]=0x0;queues[_0x4c7b6f[_0x0321('0x52')]][_0x0321('0x5c')]=0x0;utils[_0x0321('0x1b')](util[_0x0321('0x14')](_0x0321('0x5d'),_0x4c7b6f[_0x0321('0x4b')],queues[_0x4c7b6f['transfertargetuniqueid']][_0x0321('0x1d')],queues[_0x4c7b6f[_0x0321('0x52')]][_0x0321('0xe')],queues[_0x4c7b6f[_0x0321('0x52')]][_0x0321('0x53')],queues[_0x4c7b6f[_0x0321('0x52')]][_0x0321('0x54')]));}else{utils[_0x0321('0x1b')](util['format'](_0x0321('0x55'),_0x4c7b6f[_0x0321('0x4b')],queues[_0x4c7b6f[_0x0321('0x4d')]][_0x0321('0x1d')],_0x4c7b6f['origtransfererlinkedid']));queues[_0x4c7b6f[_0x0321('0x4d')]][_0x0321('0xe')]=_0x4c7b6f[_0x0321('0x4c')];}}}}catch(_0x231d6e){utils[_0x0321('0x13')](util[_0x0321('0x14')](_0x0321('0x4a'),_0x4c7b6f[_0x0321('0x4b')]),_0x231d6e);}};exports['musiconholdstart']=function(_0x389295){try{if(!_[_0x0321('0x16')](queues[_0x389295[_0x0321('0x3')]])){utils[_0x0321('0x17')](util[_0x0321('0x14')]('[%s][queues][musiconholdstart]',_0x389295[_0x0321('0x3')]),_0x389295);queues[_0x389295['uniqueid']]['musiconholdstartAt']=utils['now']();utils['info'](util[_0x0321('0x14')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x389295[_0x0321('0x3')],queues[_0x389295[_0x0321('0x3')]]['name'],queues[_0x389295[_0x0321('0x3')]]['musiconholdstartAt']));}}catch(_0x5e0af8){utils[_0x0321('0x13')](util[_0x0321('0x14')](_0x0321('0x5e'),_0x389295[_0x0321('0x3')]),_0x5e0af8);}};exports[_0x0321('0x5f')]=function(_0x2724a0){try{if(!_[_0x0321('0x16')](queues[_0x2724a0[_0x0321('0x3')]])){if(!_['isNil'](queues[_0x2724a0[_0x0321('0x3')]]['musiconholdstartAt'])){utils['debug'](util[_0x0321('0x14')](_0x0321('0x60'),_0x2724a0[_0x0321('0x3')]),_0x2724a0);queues[_0x2724a0[_0x0321('0x3')]][_0x0321('0x5c')]+=utils['diffTime'](utils[_0x0321('0x1a')](),queues[_0x2724a0[_0x0321('0x3')]][_0x0321('0x61')]);utils['info'](util['format'](_0x0321('0x62'),_0x2724a0[_0x0321('0x3')],queues[_0x2724a0[_0x0321('0x3')]][_0x0321('0x1d')],queues[_0x2724a0['uniqueid']][_0x0321('0x5c')]));delete queues[_0x2724a0[_0x0321('0x3')]][_0x0321('0x61')];}}}catch(_0x5b1e1a){utils[_0x0321('0x13')](util['format'](_0x0321('0x60'),_0x2724a0[_0x0321('0x3')]),_0x5b1e1a);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 6c169ae..ee8d636 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 _0x4da3=['split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0x4da3,0x13d));var _0x34da=function(_0x1bbf50,_0x13ad03){_0x1bbf50=_0x1bbf50-0x0;var _0x4b683d=_0x4da3[_0x1bbf50];return _0x4b683d;};'use strict';var _=require(_0x34da('0x0'));var util=require(_0x34da('0x1'));var utils=require(_0x34da('0x2'));var recordings={};function writeDB(_0x8e912a){utils['info'](util[_0x34da('0x3')](_0x34da('0x4'),_0x8e912a['uniqueid']));if(_0x8e912a[_0x34da('0x5')]){utils[_0x34da('0x6')](_0x8e912a[_0x34da('0x5')])['then'](function(_0x4a9dc2){if(_0x4a9dc2){_0x8e912a['membername']=_0x4a9dc2[_0x34da('0x7')];_0x8e912a[_0x34da('0x8')]=_0x4a9dc2['id'];}utils['request'](_0x34da('0x9'),_0x8e912a);});}else{utils[_0x34da('0xa')]('CreateVoiceRecording',_0x8e912a);}}exports[_0x34da('0xb')]=function(_0x3d58f6){try{utils[_0x34da('0xc')](util[_0x34da('0x3')](_0x34da('0xd'),_0x3d58f6[_0x34da('0xe')]),_0x3d58f6);if(_0x3d58f6[_0x34da('0xe')]==_0x3d58f6[_0x34da('0xf')]){utils[_0x34da('0x10')](util[_0x34da('0x3')](_0x34da('0x11'),_0x3d58f6[_0x34da('0xe')],_0x3d58f6['context'],_0x3d58f6[_0x34da('0x12')]));recordings[_0x3d58f6[_0x34da('0xe')]]={'uniqueid':_0x3d58f6[_0x34da('0xe')],'accountcode':_0x3d58f6['accountcode'],'exten':_0x3d58f6['exten'],'context':_0x3d58f6[_0x34da('0x13')],'channel':_0x3d58f6[_0x34da('0x14')],'monitors':[]};}}catch(_0x4a6d32){utils[_0x34da('0x15')](util[_0x34da('0x3')](_0x34da('0xd'),_0x3d58f6[_0x34da('0xe')]),_0x4a6d32);}};exports[_0x34da('0x16')]=function(_0x5597c5){try{utils['debug'](util[_0x34da('0x3')](_0x34da('0x17'),_0x5597c5['uniqueid']),_0x5597c5);if(!_[_0x34da('0x18')](recordings[_0x5597c5[_0x34da('0xe')]])&&_0x5597c5[_0x34da('0x19')]==0x6){utils[_0x34da('0x10')](util[_0x34da('0x3')](_0x34da('0x1a'),_0x5597c5[_0x34da('0xe')],_0x5597c5[_0x34da('0x13')],_0x5597c5[_0x34da('0x14')]));}else if(!_[_0x34da('0x18')](recordings[_0x5597c5['linkedid']])&&_0x5597c5[_0x34da('0x19')]==0x6&&_0x5597c5['context']!=_0x34da('0x1b')){utils[_0x34da('0x10')](util[_0x34da('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5597c5[_0x34da('0xe')],_0x5597c5[_0x34da('0xf')],_0x5597c5['context'],_0x5597c5[_0x34da('0x14')]));recordings[_0x5597c5['linkedid']][_0x34da('0x5')]=_0x5597c5[_0x34da('0x5')];}}catch(_0x1d5632){utils[_0x34da('0x15')](util[_0x34da('0x3')]('[%s][recordings][newstate]',_0x5597c5[_0x34da('0xe')]),_0x1d5632);}};exports[_0x34da('0x1c')]=function(_0x2915b5){try{if(!_[_0x34da('0x18')](_0x2915b5[_0x34da('0x1d')])&&!_[_0x34da('0x18')](_0x2915b5[_0x34da('0x1d')][_0x34da('0x1e')])){utils[_0x34da('0xc')](util[_0x34da('0x3')](_0x34da('0x1f'),_0x2915b5[_0x34da('0xe')]),_0x2915b5);utils[_0x34da('0x10')](util[_0x34da('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2915b5[_0x34da('0xe')],_0x2915b5[_0x34da('0x1d')],_0x2915b5[_0x34da('0x20')]));if(_['endsWith'](_0x2915b5['value'],_0x34da('0x21'))){_0x2915b5[_0x34da('0x20')]=_0x2915b5['value'][_0x34da('0x22')]('.wav49',_0x34da('0x23'));}if(recordings[_0x2915b5[_0x34da('0xf')]]){var _0x289ee9=_['find'](recordings[_0x2915b5[_0x34da('0xf')]]['monitors'],{'value':_0x2915b5[_0x34da('0x20')]});if(_['isNil'](_0x289ee9)){recordings[_0x2915b5['linkedid']][_0x34da('0x24')][_0x34da('0x25')]({'value':_0x2915b5['value']});}}}}catch(_0x4599d9){utils[_0x34da('0x15')](util[_0x34da('0x3')]('[%s][recordings][varset]',_0x2915b5[_0x34da('0xe')]),_0x4599d9);}};exports[_0x34da('0x26')]=function(_0x4fa664){try{if(!_[_0x34da('0x18')](recordings[_0x4fa664[_0x34da('0xe')]])){utils[_0x34da('0xc')](util[_0x34da('0x3')](_0x34da('0x27'),_0x4fa664[_0x34da('0xe')]),_0x4fa664);utils[_0x34da('0x10')](util[_0x34da('0x3')](_0x34da('0x28'),_0x4fa664[_0x34da('0xe')],_0x4fa664[_0x34da('0x29')],_0x4fa664[_0x34da('0x2a')],_0x4fa664[_0x34da('0x2b')]));recordings[_0x4fa664[_0x34da('0xe')]][_0x34da('0x29')]=_0x4fa664['calleridnum'];recordings[_0x4fa664['uniqueid']]['calleridname']=_0x4fa664[_0x34da('0x2a')];recordings[_0x4fa664['uniqueid']][_0x34da('0x2c')]=_0x4fa664[_0x34da('0x2c')];recordings[_0x4fa664[_0x34da('0xe')]][_0x34da('0x2d')]=_0x4fa664[_0x34da('0x2d')];if(recordings[_0x4fa664[_0x34da('0xe')]][_0x34da('0x2e')]==_0x34da('0x2f')&&recordings[_0x4fa664[_0x34da('0xe')]]['accountcode']){recordings[_0x4fa664['uniqueid']][_0x34da('0x2c')]=recordings[_0x4fa664[_0x34da('0xe')]][_0x34da('0x5')];recordings[_0x4fa664[_0x34da('0xe')]]['connectedlinename']='';}recordings[_0x4fa664[_0x34da('0xe')]][_0x34da('0x24')]['forEach'](function(_0x10aa28){var _0x4b0ffe=_[_0x34da('0x30')](recordings[_0x4fa664['uniqueid']]);_0x4b0ffe[_0x34da('0x20')]=_0x10aa28['value'];writeDB(_0x4b0ffe);});delete recordings[_0x4fa664['uniqueid']];}}catch(_0x7d2495){utils[_0x34da('0x15')](util[_0x34da('0x3')]('[%s][recordings][hangup]',_0x4fa664[_0x34da('0xe')]),_0x7d2495);}};exports['newexten']=function(_0x58a85a){try{if(!_[_0x34da('0x18')](recordings[_0x58a85a[_0x34da('0xe')]])){utils[_0x34da('0xc')](util[_0x34da('0x3')]('[%s][recordings][newexten]',_0x58a85a['uniqueid']),_0x58a85a);utils[_0x34da('0x10')](util['format'](_0x34da('0x31'),_0x58a85a[_0x34da('0xe')],_0x58a85a[_0x34da('0x32')],_0x58a85a[_0x34da('0x33')]));if(_0x58a85a['application']['toLowerCase']()==_0x34da('0x34')&&_[_0x34da('0x35')](_0x58a85a[_0x34da('0x33')]['toLowerCase'](),_0x34da('0x36'))){var _0x35c6f4=_0x58a85a[_0x34da('0x33')][_0x34da('0x37')]('=');var _0x13d393=_0x35c6f4[0x0][_0x34da('0x38')](_0x35c6f4[0x0][_0x34da('0x39')]('(')+0x1,_0x35c6f4[0x0][_0x34da('0x39')](')'));var _0x423666=_0x35c6f4[0x1];recordings[_0x58a85a[_0x34da('0xe')]][_0x13d393]=_0x423666;}}}catch(_0x1e45d8){utils['error'](util[_0x34da('0x3')]('[%s][recordings][newexten]',_0x58a85a['uniqueid']),_0x1e45d8);}};exports[_0x34da('0x3a')]=function(_0x308bac){try{if(!_['isNil'](recordings[_0x308bac[_0x34da('0xe')]])){utils[_0x34da('0xc')](util[_0x34da('0x3')](_0x34da('0x3b'),_0x308bac[_0x34da('0xe')]),_0x308bac);utils[_0x34da('0x10')](util[_0x34da('0x3')](_0x34da('0x3c'),_0x308bac[_0x34da('0xe')],_0x308bac[_0x34da('0x3d')]));recordings[_0x308bac['uniqueid']]['queue']=_0x308bac[_0x34da('0x3d')];}}catch(_0x2746b1){utils[_0x34da('0x15')](util[_0x34da('0x3')](_0x34da('0x3b'),_0x308bac[_0x34da('0xe')]),_0x2746b1);}}; \ No newline at end of file +var _0x5cff=['[%s][recordings][queuecallerjoin]','queue','lodash','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording','newchannel','debug','linkedid','context','exten','channel','[%s][recordings][newchannel]','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','error','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','type','outbound','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin'];(function(_0x4247e5,_0x30b7bb){var _0x5ee3d5=function(_0x5056cd){while(--_0x5056cd){_0x4247e5['push'](_0x4247e5['shift']());}};_0x5ee3d5(++_0x30b7bb);}(_0x5cff,0x133));var _0xf5cf=function(_0x33f841,_0x2f5b6b){_0x33f841=_0x33f841-0x0;var _0x446e55=_0x5cff[_0x33f841];return _0x446e55;};'use strict';var _=require(_0xf5cf('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x3400e6){utils[_0xf5cf('0x1')](util[_0xf5cf('0x2')](_0xf5cf('0x3'),_0x3400e6[_0xf5cf('0x4')]));if(_0x3400e6[_0xf5cf('0x5')]){utils[_0xf5cf('0x6')](_0x3400e6[_0xf5cf('0x5')])[_0xf5cf('0x7')](function(_0x8ea0ab){if(_0x8ea0ab){_0x3400e6[_0xf5cf('0x8')]=_0x8ea0ab[_0xf5cf('0x9')];_0x3400e6['UserId']=_0x8ea0ab['id'];}utils['request'](_0xf5cf('0xa'),_0x3400e6);});}else{utils['request']('CreateVoiceRecording',_0x3400e6);}}exports[_0xf5cf('0xb')]=function(_0x5278bb){try{utils[_0xf5cf('0xc')](util['format']('[%s][recordings][newchannel]',_0x5278bb[_0xf5cf('0x4')]),_0x5278bb);if(_0x5278bb[_0xf5cf('0x4')]==_0x5278bb[_0xf5cf('0xd')]){utils['info'](util[_0xf5cf('0x2')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x5278bb[_0xf5cf('0x4')],_0x5278bb[_0xf5cf('0xe')],_0x5278bb[_0xf5cf('0xf')]));recordings[_0x5278bb[_0xf5cf('0x4')]]={'uniqueid':_0x5278bb[_0xf5cf('0x4')],'accountcode':_0x5278bb[_0xf5cf('0x5')],'exten':_0x5278bb[_0xf5cf('0xf')],'context':_0x5278bb[_0xf5cf('0xe')],'channel':_0x5278bb[_0xf5cf('0x10')],'monitors':[]};}}catch(_0x17b075){utils['error'](util[_0xf5cf('0x2')](_0xf5cf('0x11'),_0x5278bb['uniqueid']),_0x17b075);}};exports['newstate']=function(_0x4ded65){try{utils[_0xf5cf('0xc')](util[_0xf5cf('0x2')](_0xf5cf('0x12'),_0x4ded65[_0xf5cf('0x4')]),_0x4ded65);if(!_[_0xf5cf('0x13')](recordings[_0x4ded65[_0xf5cf('0x4')]])&&_0x4ded65['channelstate']==0x6){utils[_0xf5cf('0x1')](util[_0xf5cf('0x2')](_0xf5cf('0x14'),_0x4ded65[_0xf5cf('0x4')],_0x4ded65[_0xf5cf('0xe')],_0x4ded65[_0xf5cf('0x10')]));}else if(!_[_0xf5cf('0x13')](recordings[_0x4ded65[_0xf5cf('0xd')]])&&_0x4ded65[_0xf5cf('0x15')]==0x6&&_0x4ded65[_0xf5cf('0xe')]!=_0xf5cf('0x16')){utils[_0xf5cf('0x1')](util[_0xf5cf('0x2')](_0xf5cf('0x17'),_0x4ded65['uniqueid'],_0x4ded65['linkedid'],_0x4ded65[_0xf5cf('0xe')],_0x4ded65[_0xf5cf('0x10')]));recordings[_0x4ded65[_0xf5cf('0xd')]][_0xf5cf('0x5')]=_0x4ded65[_0xf5cf('0x5')];}}catch(_0x5e8049){utils['error'](util[_0xf5cf('0x2')](_0xf5cf('0x12'),_0x4ded65[_0xf5cf('0x4')]),_0x5e8049);}};exports[_0xf5cf('0x18')]=function(_0x5a9784){try{if(!_[_0xf5cf('0x13')](_0x5a9784['variable'])&&!_['isNil'](_0x5a9784[_0xf5cf('0x19')][_0xf5cf('0x1a')])){utils['debug'](util[_0xf5cf('0x2')]('[%s][recordings][varset]',_0x5a9784['uniqueid']),_0x5a9784);utils[_0xf5cf('0x1')](util[_0xf5cf('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5a9784[_0xf5cf('0x4')],_0x5a9784[_0xf5cf('0x19')],_0x5a9784[_0xf5cf('0x1b')]));if(_['endsWith'](_0x5a9784[_0xf5cf('0x1b')],_0xf5cf('0x1c'))){_0x5a9784[_0xf5cf('0x1b')]=_0x5a9784['value'][_0xf5cf('0x1d')](_0xf5cf('0x1c'),_0xf5cf('0x1e'));}if(recordings[_0x5a9784['linkedid']]){var _0x439c3a=_[_0xf5cf('0x1f')](recordings[_0x5a9784['linkedid']][_0xf5cf('0x20')],{'value':_0x5a9784['value']});if(_[_0xf5cf('0x13')](_0x439c3a)){recordings[_0x5a9784[_0xf5cf('0xd')]][_0xf5cf('0x20')]['push']({'value':_0x5a9784[_0xf5cf('0x1b')]});}}}}catch(_0x589f47){utils[_0xf5cf('0x21')](util[_0xf5cf('0x2')](_0xf5cf('0x22'),_0x5a9784[_0xf5cf('0x4')]),_0x589f47);}};exports[_0xf5cf('0x23')]=function(_0x1ee892){try{if(!_[_0xf5cf('0x13')](recordings[_0x1ee892[_0xf5cf('0x4')]])){utils[_0xf5cf('0xc')](util[_0xf5cf('0x2')](_0xf5cf('0x24'),_0x1ee892[_0xf5cf('0x4')]),_0x1ee892);utils[_0xf5cf('0x1')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1ee892[_0xf5cf('0x4')],_0x1ee892[_0xf5cf('0x25')],_0x1ee892['calleridname'],_0x1ee892[_0xf5cf('0x26')]));recordings[_0x1ee892[_0xf5cf('0x4')]][_0xf5cf('0x25')]=_0x1ee892[_0xf5cf('0x25')];recordings[_0x1ee892[_0xf5cf('0x4')]][_0xf5cf('0x27')]=_0x1ee892[_0xf5cf('0x27')];recordings[_0x1ee892[_0xf5cf('0x4')]][_0xf5cf('0x28')]=_0x1ee892['connectedlinenum'];recordings[_0x1ee892[_0xf5cf('0x4')]]['connectedlinename']=_0x1ee892['connectedlinename'];if(recordings[_0x1ee892[_0xf5cf('0x4')]][_0xf5cf('0x29')]==_0xf5cf('0x2a')&&recordings[_0x1ee892[_0xf5cf('0x4')]][_0xf5cf('0x5')]){recordings[_0x1ee892[_0xf5cf('0x4')]][_0xf5cf('0x28')]=recordings[_0x1ee892[_0xf5cf('0x4')]][_0xf5cf('0x5')];recordings[_0x1ee892[_0xf5cf('0x4')]][_0xf5cf('0x2b')]='';}recordings[_0x1ee892['uniqueid']][_0xf5cf('0x20')][_0xf5cf('0x2c')](function(_0x385d0f){var _0xa3f8b=_[_0xf5cf('0x2d')](recordings[_0x1ee892[_0xf5cf('0x4')]]);_0xa3f8b[_0xf5cf('0x1b')]=_0x385d0f[_0xf5cf('0x1b')];writeDB(_0xa3f8b);});delete recordings[_0x1ee892[_0xf5cf('0x4')]];}}catch(_0x11b9c0){utils[_0xf5cf('0x21')](util['format'](_0xf5cf('0x24'),_0x1ee892['uniqueid']),_0x11b9c0);}};exports[_0xf5cf('0x2e')]=function(_0x2abdcb){try{if(!_[_0xf5cf('0x13')](recordings[_0x2abdcb[_0xf5cf('0x4')]])){utils['debug'](util[_0xf5cf('0x2')](_0xf5cf('0x2f'),_0x2abdcb[_0xf5cf('0x4')]),_0x2abdcb);utils['info'](util[_0xf5cf('0x2')](_0xf5cf('0x30'),_0x2abdcb[_0xf5cf('0x4')],_0x2abdcb[_0xf5cf('0x31')],_0x2abdcb[_0xf5cf('0x32')]));if(_0x2abdcb[_0xf5cf('0x31')][_0xf5cf('0x33')]()==_0xf5cf('0x34')&&_[_0xf5cf('0x35')](_0x2abdcb[_0xf5cf('0x32')][_0xf5cf('0x33')](),_0xf5cf('0x36'))){var _0x5f511a=_0x2abdcb[_0xf5cf('0x32')][_0xf5cf('0x37')]('=');var _0x42e42b=_0x5f511a[0x0][_0xf5cf('0x38')](_0x5f511a[0x0][_0xf5cf('0x39')]('(')+0x1,_0x5f511a[0x0][_0xf5cf('0x39')](')'));var _0x5ab191=_0x5f511a[0x1];recordings[_0x2abdcb[_0xf5cf('0x4')]][_0x42e42b]=_0x5ab191;}}}catch(_0x57d297){utils[_0xf5cf('0x21')](util['format'](_0xf5cf('0x2f'),_0x2abdcb[_0xf5cf('0x4')]),_0x57d297);}};exports[_0xf5cf('0x3a')]=function(_0x59aef8){try{if(!_['isNil'](recordings[_0x59aef8[_0xf5cf('0x4')]])){utils[_0xf5cf('0xc')](util[_0xf5cf('0x2')](_0xf5cf('0x3b'),_0x59aef8[_0xf5cf('0x4')]),_0x59aef8);utils[_0xf5cf('0x1')](util[_0xf5cf('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x59aef8[_0xf5cf('0x4')],_0x59aef8[_0xf5cf('0x3c')]));recordings[_0x59aef8[_0xf5cf('0x4')]][_0xf5cf('0x3c')]=_0x59aef8[_0xf5cf('0x3c')];}}catch(_0x4c0cb6){utils[_0xf5cf('0x21')](util['format'](_0xf5cf('0x3b'),_0x59aef8['uniqueid']),_0x4c0cb6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index bbdf951..956a7dc 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 _0x42c7=['error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','blinds','transfereruniqueid'];(function(_0x2955db,_0x4dd8e6){var _0x5eba31=function(_0x501e54){while(--_0x501e54){_0x2955db['push'](_0x2955db['shift']());}};_0x5eba31(++_0x4dd8e6);}(_0x42c7,0x181));var _0x742c=function(_0x147605,_0x38686d){_0x147605=_0x147605-0x0;var _0x490376=_0x42c7[_0x147605];return _0x490376;};'use strict';var _=require(_0x742c('0x0'));var util=require('util');var utils=require(_0x742c('0x1'));function writeDB(_0x56a153){utils['info'](util[_0x742c('0x2')](_0x742c('0x3'),_0x56a153[_0x742c('0x4')]===_0x742c('0x5')?_0x56a153['origtransfereruniqueid']:_0x56a153[_0x742c('0x6')],_0x56a153[_0x742c('0x4')]));utils[_0x742c('0x7')](_0x742c('0x8'),_0x56a153);}exports['blinds']={};exports[_0x742c('0x9')]=function(_0x4d2df5){try{utils[_0x742c('0xa')](util[_0x742c('0x2')](_0x742c('0xb'),_0x4d2df5[_0x742c('0x6')]),_0x4d2df5);utils[_0x742c('0xc')](util[_0x742c('0x2')](_0x742c('0xd'),_0x4d2df5[_0x742c('0x6')],_0x4d2df5['transferercalleridnum'],_0x4d2df5[_0x742c('0xe')],_0x4d2df5[_0x742c('0xf')],_0x4d2df5[_0x742c('0x10')]));_0x4d2df5['type']=_0x742c('0x11');exports[_0x742c('0x12')][_0x4d2df5[_0x742c('0x13')]]=_0x4d2df5;writeDB(_0x4d2df5);}catch(_0x3de518){utils[_0x742c('0x14')](util[_0x742c('0x2')](_0x742c('0xb'),_0x4d2df5[_0x742c('0x6')]),_0x3de518);}};exports[_0x742c('0x15')]=function(_0x33e3a5){try{utils[_0x742c('0xa')](util[_0x742c('0x2')](_0x742c('0x16'),_0x33e3a5[_0x742c('0x17')]),_0x33e3a5);utils['info'](util[_0x742c('0x2')](_0x742c('0x18'),_0x33e3a5[_0x742c('0x17')],_0x33e3a5[_0x742c('0x19')],_0x33e3a5[_0x742c('0x1a')],_0x33e3a5[_0x742c('0x1b')],_0x33e3a5[_0x742c('0x1c')]));_0x33e3a5=_['assign'](_0x33e3a5,{'transfererchannel':_0x33e3a5[_0x742c('0x1d')],'transferercalleridnum':_0x33e3a5[_0x742c('0x19')],'transferercalleridname':_0x33e3a5[_0x742c('0x1a')],'transfererconnectedlinenum':_0x33e3a5[_0x742c('0x1e')],'transfererconnectedlinename':_0x33e3a5['secondtransfererconnectedlinename'],'transfereraccountcode':_0x33e3a5[_0x742c('0x1f')],'transferercontext':_0x33e3a5[_0x742c('0x20')],'transfererexten':_0x33e3a5[_0x742c('0x21')],'transfererlinkedid':_0x33e3a5['origtransfererlinkedid'],'context':_0x33e3a5[_0x742c('0x22')],'extension':_0x33e3a5[_0x742c('0x23')],'type':'attended'});if(_[_0x742c('0x24')](_0x33e3a5['transfereechannel'])){_0x33e3a5=_[_0x742c('0x25')](_0x33e3a5,{'transfereechannel':_0x33e3a5[_0x742c('0x26')],'transfereecalleridnum':_0x33e3a5[_0x742c('0x1b')],'transfereecalleridname':_0x33e3a5['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x33e3a5[_0x742c('0x27')],'transfereeconnectedlinename':_0x33e3a5[_0x742c('0x28')],'transfereeaccountcode':_0x33e3a5[_0x742c('0x29')],'transfereecontext':_0x33e3a5[_0x742c('0x2a')],'transfereeexten':_0x33e3a5[_0x742c('0x2b')],'transfereelinkedid':_0x33e3a5[_0x742c('0x2c')]});}writeDB(_0x33e3a5);}catch(_0x50bee8){utils['error'](util[_0x742c('0x2')](_0x742c('0x16'),_0x33e3a5[_0x742c('0x17')]),_0x50bee8);}}; \ No newline at end of file +var _0xfee7=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','error','debug'];(function(_0x26bbba,_0x5480d5){var _0x5d9aad=function(_0x149887){while(--_0x149887){_0x26bbba['push'](_0x26bbba['shift']());}};_0x5d9aad(++_0x5480d5);}(_0xfee7,0x1bf));var _0x7fee=function(_0x55d2fd,_0x4ab1bf){_0x55d2fd=_0x55d2fd-0x0;var _0x48a013=_0xfee7[_0x55d2fd];return _0x48a013;};'use strict';var _=require(_0x7fee('0x0'));var util=require(_0x7fee('0x1'));var utils=require('./utils');function writeDB(_0x3bac59){utils[_0x7fee('0x2')](util[_0x7fee('0x3')](_0x7fee('0x4'),_0x3bac59[_0x7fee('0x5')]===_0x7fee('0x6')?_0x3bac59[_0x7fee('0x7')]:_0x3bac59['uniqueid'],_0x3bac59[_0x7fee('0x5')]));utils[_0x7fee('0x8')](_0x7fee('0x9'),_0x3bac59);}exports[_0x7fee('0xa')]={};exports['blindtransfer']=function(_0x10aeb2){try{utils['debug'](util[_0x7fee('0x3')](_0x7fee('0xb'),_0x10aeb2[_0x7fee('0xc')]),_0x10aeb2);utils[_0x7fee('0x2')](util[_0x7fee('0x3')](_0x7fee('0xd'),_0x10aeb2[_0x7fee('0xc')],_0x10aeb2[_0x7fee('0xe')],_0x10aeb2[_0x7fee('0xf')],_0x10aeb2[_0x7fee('0x10')],_0x10aeb2['transfereecalleridname']));_0x10aeb2[_0x7fee('0x5')]=_0x7fee('0x11');exports['blinds'][_0x10aeb2[_0x7fee('0x12')]]=_0x10aeb2;writeDB(_0x10aeb2);}catch(_0x1de45b){utils[_0x7fee('0x13')](util[_0x7fee('0x3')](_0x7fee('0xb'),_0x10aeb2[_0x7fee('0xc')]),_0x1de45b);}};exports['attendedtransfer']=function(_0x26815c){try{utils[_0x7fee('0x14')](util['format'](_0x7fee('0x15'),_0x26815c[_0x7fee('0x7')]),_0x26815c);utils[_0x7fee('0x2')](util[_0x7fee('0x3')](_0x7fee('0x16'),_0x26815c['origtransfereruniqueid'],_0x26815c[_0x7fee('0x17')],_0x26815c[_0x7fee('0x18')],_0x26815c[_0x7fee('0x19')],_0x26815c['transfertargetcalleridname']));_0x26815c=_[_0x7fee('0x1a')](_0x26815c,{'transfererchannel':_0x26815c['origtransfererchannel'],'transferercalleridnum':_0x26815c[_0x7fee('0x17')],'transferercalleridname':_0x26815c[_0x7fee('0x18')],'transfererconnectedlinenum':_0x26815c[_0x7fee('0x1b')],'transfererconnectedlinename':_0x26815c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x26815c['origtransfereraccountcode'],'transferercontext':_0x26815c[_0x7fee('0x1c')],'transfererexten':_0x26815c[_0x7fee('0x1d')],'transfererlinkedid':_0x26815c[_0x7fee('0x1e')],'context':_0x26815c[_0x7fee('0x1f')],'extension':_0x26815c[_0x7fee('0x20')],'type':_0x7fee('0x6')});if(_['isNil'](_0x26815c['transfereechannel'])){_0x26815c=_['assign'](_0x26815c,{'transfereechannel':_0x26815c[_0x7fee('0x21')],'transfereecalleridnum':_0x26815c['transfertargetcalleridnum'],'transfereecalleridname':_0x26815c['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x26815c[_0x7fee('0x22')],'transfereeconnectedlinename':_0x26815c[_0x7fee('0x23')],'transfereeaccountcode':_0x26815c['transfertargetaccountcode'],'transfereecontext':_0x26815c[_0x7fee('0x24')],'transfereeexten':_0x26815c[_0x7fee('0x25')],'transfereelinkedid':_0x26815c[_0x7fee('0x26')]});}writeDB(_0x26815c);}catch(_0x379edc){utils[_0x7fee('0x13')](util[_0x7fee('0x3')](_0x7fee('0x15'),_0x26815c[_0x7fee('0x7')]),_0x379edc);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index bcb8c87..2f2bb81 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 _0x1967=['../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','sumTime','isAfter','isBefore','jayson/promise','moment','util','client','http'];(function(_0x52df53,_0x5fe4db){var _0xa3ea95=function(_0x5cdf5c){while(--_0x5cdf5c){_0x52df53['push'](_0x52df53['shift']());}};_0xa3ea95(++_0x5fe4db);}(_0x1967,0x173));var _0x7196=function(_0x4c1b82,_0x128fd7){_0x4c1b82=_0x4c1b82-0x0;var _0x3b7674=_0x1967[_0x4c1b82];return _0x3b7674;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var util=require(_0x7196('0x2'));var client=jayson[_0x7196('0x3')][_0x7196('0x4')]({'port':0x2329});var logger=require(_0x7196('0x5'))(_0x7196('0x6'));exports[_0x7196('0x7')]=function(_0x458ae8,_0x3ae43f){logger['info'](_0x458ae8,_0x3ae43f?util[_0x7196('0x8')](_0x3ae43f,{'showHidden':![],'depth':null}):'');};exports[_0x7196('0x9')]=function(_0x194746,_0x40e0af){logger[_0x7196('0x9')](_0x194746,_0x40e0af?util[_0x7196('0x8')](_0x40e0af,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x218520,_0xc6366f){logger[_0x7196('0xa')](_0x218520,_0xc6366f?util[_0x7196('0x8')](_0xc6366f,{'showHidden':![],'depth':null}):'');};exports[_0x7196('0xb')]=function(_0x503070,_0x49e5fb){return client[_0x7196('0xb')](_0x503070,{'body':_0x49e5fb})[_0x7196('0xc')](function(_0x97bbff){logger[_0x7196('0x9')](_0x7196('0xd'),_0x503070,_0x97bbff?util[_0x7196('0x8')](_0x97bbff,{'showHidden':![],'depth':null}):'');})[_0x7196('0xe')](function(_0x325641){logger[_0x7196('0xa')](_0x7196('0xd'),_0x503070,_0x325641?util[_0x7196('0x8')](_0x325641,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4e8c4c){return client[_0x7196('0xb')](_0x7196('0xf'),{'options':{'raw':!![],'attributes':['id',_0x7196('0x10'),_0x7196('0x11'),'interface'],'where':_0x4e8c4c,'limit':0x1}})[_0x7196('0xc')](function(_0x539414){logger[_0x7196('0x9')](_0x7196('0x12'),JSON[_0x7196('0x13')](_0x4e8c4c),_0x539414?util[_0x7196('0x8')](_0x539414,{'showHidden':![],'depth':null}):'');return _0x539414[_0x7196('0x14')][_0x7196('0x15')]?_0x539414[_0x7196('0x14')][0x0]:null;});}exports[_0x7196('0x16')]=function(_0x3e4e69){return new BPromise(function(_0x32fe2b,_0x385f2d){if(_0x3e4e69){return getUser({'internal':_0x3e4e69})['then'](function(_0x4c4f91){logger[_0x7196('0x7')](_0x7196('0x17'),_0x3e4e69,_0x4c4f91?_0x7196('0x18'):'notfound');return _0x32fe2b(_0x4c4f91);})[_0x7196('0xe')](function(_0x539d8b){logger['error'](_0x7196('0x19'),_0x539d8b?util[_0x7196('0x8')](_0x539d8b,{'showHidden':![],'depth':null}):'');return _0x32fe2b(null);});}return _0x32fe2b(null);});};exports[_0x7196('0x1a')]=function(_0x4ddf78){return new BPromise(function(_0x57c390,_0x38d291){if(_0x4ddf78){return getUser({'interface':_0x4ddf78})[_0x7196('0xc')](function(_0x598a26){logger[_0x7196('0x7')](_0x7196('0x1b'),_0x4ddf78,_0x598a26?_0x7196('0x18'):_0x7196('0x1c'));return _0x57c390(_0x598a26);})[_0x7196('0xe')](function(_0x549f34){logger[_0x7196('0xa')]('[utils][getUserByInterface]',_0x549f34?util[_0x7196('0x8')](_0x549f34,{'showHidden':![],'depth':null}):'');return _0x57c390(null);});}return _0x57c390(null);});};exports[_0x7196('0x1d')]=function(_0x2e15c7){return new BPromise(function(_0xa69810,_0x70aa65){if(_0x2e15c7){return getUser({'name':_0x2e15c7})[_0x7196('0xc')](function(_0x530ab5){logger['info'](_0x7196('0x1e'),_0x2e15c7,_0x530ab5?_0x7196('0x18'):_0x7196('0x1c'));return _0xa69810(_0x530ab5);})['catch'](function(_0x5aa538){logger[_0x7196('0xa')](_0x7196('0x1f'),_0x5aa538?util[_0x7196('0x8')](_0x5aa538,{'showHidden':![],'depth':null}):'');return _0xa69810(null);});}return _0xa69810(null);});};exports['getVoiceQueueByName']=function(_0x35eef9){return new BPromise(function(_0x4ecea1,_0x4fd339){if(_0x35eef9){return client['request'](_0x7196('0x20'),{'options':{'raw':!![],'attributes':['id',_0x7196('0x11'),_0x7196('0x21'),'acw',_0x7196('0x22')],'where':{'name':_0x35eef9},'limit':0x1}})[_0x7196('0xc')](function(_0x2f9583){logger[_0x7196('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x35eef9,_0x2f9583?util[_0x7196('0x8')](_0x2f9583,{'showHidden':![],'depth':null}):'');logger[_0x7196('0x7')](_0x7196('0x23'),_0x35eef9,_0x2f9583?_0x7196('0x18'):_0x7196('0x1c'));return _0x4ecea1(_0x2f9583[_0x7196('0x14')][_0x7196('0x15')]?_0x2f9583[_0x7196('0x14')][0x0]:null);})[_0x7196('0xe')](function(_0xf33b59){logger[_0x7196('0xa')]('[utils][getVoiceQueueByName]',_0xf33b59?util[_0x7196('0x8')](_0xf33b59,{'showHidden':![],'depth':null}):'');return _0x4ecea1(null);});}return _0x4ecea1(null);});};exports['addTime']=function(_0x2452f6,_0x4c3365){return moment(_0x2452f6)[_0x7196('0x24')](_0x4c3365,_0x7196('0x25'))['format'](_0x7196('0x26'));};exports[_0x7196('0x27')]=function(_0x4531d7,_0x3a56b4){return moment(_0x4531d7)[_0x7196('0x28')](_0x3a56b4,'seconds')[_0x7196('0x29')](_0x7196('0x26'));};exports[_0x7196('0x2a')]=function(_0xf2b652,_0x3e8f98){return moment(_0xf2b652)[_0x7196('0x2b')](moment(_0x3e8f98),'seconds');};exports[_0x7196('0x2c')]=function(_0xe04e44,_0x191df2){return parseInt(_0xe04e44,0xa)+parseInt(_0x191df2,0xa);};exports['now']=function(){return moment()[_0x7196('0x29')](_0x7196('0x26'));};exports[_0x7196('0x2d')]=function(_0xa24847,_0x11d4ec){if(_0x11d4ec){return moment(_0xa24847)[_0x7196('0x2d')](_0x11d4ec);}return!![];};exports[_0x7196('0x2e')]=function(_0x1ab720,_0x92cfb1){if(_0x92cfb1){return moment(_0x1ab720)[_0x7196('0x2e')](_0x92cfb1);}else if(_0x1ab720){return!![];}return![];}; \ No newline at end of file +var _0x8d5a=['type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','internal','name','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x53d729,_0x1a2198){var _0x568f90=function(_0x48bd5b){while(--_0x48bd5b){_0x53d729['push'](_0x53d729['shift']());}};_0x568f90(++_0x1a2198);}(_0x8d5a,0x9f));var _0xa8d5=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x8d5a[_0x468b0f];return _0x3e74d9;};'use strict';var BPromise=require(_0xa8d5('0x0'));var jayson=require(_0xa8d5('0x1'));var moment=require(_0xa8d5('0x2'));var util=require(_0xa8d5('0x3'));var client=jayson['client'][_0xa8d5('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports['info']=function(_0x12caf6,_0x7ec367){logger[_0xa8d5('0x5')](_0x12caf6,_0x7ec367?util[_0xa8d5('0x6')](_0x7ec367,{'showHidden':![],'depth':null}):'');};exports[_0xa8d5('0x7')]=function(_0x10fce4,_0x3858cc){logger[_0xa8d5('0x7')](_0x10fce4,_0x3858cc?util[_0xa8d5('0x6')](_0x3858cc,{'showHidden':![],'depth':null}):'');};exports[_0xa8d5('0x8')]=function(_0x31f4ba,_0x269d2c){logger[_0xa8d5('0x8')](_0x31f4ba,_0x269d2c?util[_0xa8d5('0x6')](_0x269d2c,{'showHidden':![],'depth':null}):'');};exports[_0xa8d5('0x9')]=function(_0x471e83,_0x47938f){return client[_0xa8d5('0x9')](_0x471e83,{'body':_0x47938f})[_0xa8d5('0xa')](function(_0x566020){logger[_0xa8d5('0x7')](_0xa8d5('0xb'),_0x471e83,_0x566020?util[_0xa8d5('0x6')](_0x566020,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4c960b){logger[_0xa8d5('0x8')]('[utils][request]\x20name:%s',_0x471e83,_0x4c960b?util[_0xa8d5('0x6')](_0x4c960b,{'showHidden':![],'depth':null}):'');});};function getUser(_0xa4afa1){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0xa8d5('0xc'),_0xa8d5('0xd'),'interface'],'where':_0xa4afa1,'limit':0x1}})[_0xa8d5('0xa')](function(_0x4fcb29){logger['debug'](_0xa8d5('0xe'),JSON[_0xa8d5('0xf')](_0xa4afa1),_0x4fcb29?util[_0xa8d5('0x6')](_0x4fcb29,{'showHidden':![],'depth':null}):'');return _0x4fcb29[_0xa8d5('0x10')]['length']?_0x4fcb29['result'][0x0]:null;});}exports[_0xa8d5('0x11')]=function(_0xd11cf0){return new BPromise(function(_0x109d9d,_0x37da48){if(_0xd11cf0){return getUser({'internal':_0xd11cf0})['then'](function(_0xef1bbd){logger['info'](_0xa8d5('0x12'),_0xd11cf0,_0xef1bbd?_0xa8d5('0x13'):_0xa8d5('0x14'));return _0x109d9d(_0xef1bbd);})[_0xa8d5('0x15')](function(_0x28b45c){logger['error'](_0xa8d5('0x16'),_0x28b45c?util[_0xa8d5('0x6')](_0x28b45c,{'showHidden':![],'depth':null}):'');return _0x109d9d(null);});}return _0x109d9d(null);});};exports['getUserByInterface']=function(_0x61ea2b){return new BPromise(function(_0x29fe80,_0x4e81e2){if(_0x61ea2b){return getUser({'interface':_0x61ea2b})[_0xa8d5('0xa')](function(_0x43fecd){logger[_0xa8d5('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x61ea2b,_0x43fecd?'found':_0xa8d5('0x14'));return _0x29fe80(_0x43fecd);})[_0xa8d5('0x15')](function(_0x242433){logger['error'](_0xa8d5('0x17'),_0x242433?util[_0xa8d5('0x6')](_0x242433,{'showHidden':![],'depth':null}):'');return _0x29fe80(null);});}return _0x29fe80(null);});};exports[_0xa8d5('0x18')]=function(_0x33d6f4){return new BPromise(function(_0x4ae549,_0x502095){if(_0x33d6f4){return getUser({'name':_0x33d6f4})[_0xa8d5('0xa')](function(_0x759fe8){logger[_0xa8d5('0x5')](_0xa8d5('0x19'),_0x33d6f4,_0x759fe8?_0xa8d5('0x13'):_0xa8d5('0x14'));return _0x4ae549(_0x759fe8);})['catch'](function(_0x2a429b){logger[_0xa8d5('0x8')](_0xa8d5('0x1a'),_0x2a429b?util[_0xa8d5('0x6')](_0x2a429b,{'showHidden':![],'depth':null}):'');return _0x4ae549(null);});}return _0x4ae549(null);});};exports[_0xa8d5('0x1b')]=function(_0x4e792f){return new BPromise(function(_0x13fcb3,_0x467055){if(_0x4e792f){return client[_0xa8d5('0x9')](_0xa8d5('0x1c'),{'options':{'raw':!![],'attributes':['id',_0xa8d5('0xd'),_0xa8d5('0x1d'),'acw',_0xa8d5('0x1e')],'where':{'name':_0x4e792f},'limit':0x1}})['then'](function(_0x160b68){logger[_0xa8d5('0x7')](_0xa8d5('0x1f'),_0x4e792f,_0x160b68?util['inspect'](_0x160b68,{'showHidden':![],'depth':null}):'');logger[_0xa8d5('0x5')](_0xa8d5('0x20'),_0x4e792f,_0x160b68?_0xa8d5('0x13'):_0xa8d5('0x14'));return _0x13fcb3(_0x160b68[_0xa8d5('0x10')][_0xa8d5('0x21')]?_0x160b68[_0xa8d5('0x10')][0x0]:null);})['catch'](function(_0x45cb69){logger[_0xa8d5('0x8')]('[utils][getVoiceQueueByName]',_0x45cb69?util['inspect'](_0x45cb69,{'showHidden':![],'depth':null}):'');return _0x13fcb3(null);});}return _0x13fcb3(null);});};exports[_0xa8d5('0x22')]=function(_0x459592,_0xbbfe00){return moment(_0x459592)[_0xa8d5('0x23')](_0xbbfe00,_0xa8d5('0x24'))['format'](_0xa8d5('0x25'));};exports[_0xa8d5('0x26')]=function(_0x347d5c,_0x7662de){return moment(_0x347d5c)[_0xa8d5('0x27')](_0x7662de,_0xa8d5('0x24'))[_0xa8d5('0x28')](_0xa8d5('0x25'));};exports[_0xa8d5('0x29')]=function(_0x3da44f,_0x5dafba){return moment(_0x3da44f)[_0xa8d5('0x2a')](moment(_0x5dafba),_0xa8d5('0x24'));};exports[_0xa8d5('0x2b')]=function(_0x2fa7ca,_0x8ad1ca){return parseInt(_0x2fa7ca,0xa)+parseInt(_0x8ad1ca,0xa);};exports[_0xa8d5('0x2c')]=function(){return moment()['format'](_0xa8d5('0x25'));};exports[_0xa8d5('0x2d')]=function(_0x6fac6b,_0x3cefbe){if(_0x3cefbe){return moment(_0x6fac6b)[_0xa8d5('0x2d')](_0x3cefbe);}return!![];};exports[_0xa8d5('0x2e')]=function(_0x1e3f4a,_0x4ba45c){if(_0x4ba45c){return moment(_0x1e3f4a)[_0xa8d5('0x2e')](_0x4ba45c);}else if(_0x1e3f4a){return!![];}return![];}; \ No newline at end of file